From: support Date: Thu, 6 Apr 2023 15:43:46 +0000 (+0000) Subject: Built motion from commit 1ea47bf4.|2.6.34 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=5c4c85703d974d20222c44d906e168119a04a318;p=motion2.git Built motion from commit 1ea47bf4.|2.6.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 49e8f0d..976cf43 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-04-06T15:09:26.848Z", + "time": "2023-04-06T15:33:16.121Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index f794d4d..f4feac1 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-04-06T15:09:26.848Z", + "time": "2023-04-06T15:33:16.121Z", "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 2dde944..48a2ed9 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 _0xabe0=['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','urlForward','bot','script'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xabe0,0x182));var _0x0abe=function(_0x15601f,_0x35938f){_0x15601f=_0x15601f-0x0;var _0x15d32d=_0xabe0[_0x15601f];return _0x15d32d;};'use strict';var Sequelize=require(_0x0abe('0x0'));module[_0x0abe('0x1')]={'name':{'type':Sequelize[_0x0abe('0x2')],'get':function(_0x2f356a){return this[_0x0abe('0x3')](_0x0abe('0x4'));}},'action':{'type':Sequelize[_0x0abe('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0abe('0x6'),_0x0abe('0x7'),_0x0abe('0x8'),_0x0abe('0x9'),_0x0abe('0xa'),'browser',_0x0abe('0xb'),_0x0abe('0xc')]],'msg':_0x0abe('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x0abe('0xe')},'data2':{'type':Sequelize[_0x0abe('0x5')](0x1000),'comment':_0x0abe('0xf')},'data3':{'type':Sequelize[_0x0abe('0x5')](0x1000),'comment':_0x0abe('0x10')},'data4':{'type':Sequelize[_0x0abe('0x5')](0x1000),'comments':_0x0abe('0x11')},'data5':{'type':Sequelize[_0x0abe('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x0abe('0x5')],'comments':_0x0abe('0x12')},'data7':{'type':Sequelize[_0x0abe('0x13')],'comments':_0x0abe('0x14')}}; \ No newline at end of file +var _0xf517=['exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize'];(function(_0x4be2ed,_0x396c5f){var _0x26ec31=function(_0x2d4121){while(--_0x2d4121){_0x4be2ed['push'](_0x4be2ed['shift']());}};_0x26ec31(++_0x396c5f);}(_0xf517,0x97));var _0x7f51=function(_0x48ca42,_0x52a695){_0x48ca42=_0x48ca42-0x0;var _0x5a17e0=_0xf517[_0x48ca42];return _0x5a17e0;};'use strict';var Sequelize=require(_0x7f51('0x0'));module[_0x7f51('0x1')]={'name':{'type':Sequelize[_0x7f51('0x2')],'get':function(_0x137a32){return this[_0x7f51('0x3')](_0x7f51('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x7f51('0x5'),_0x7f51('0x6'),_0x7f51('0x7'),_0x7f51('0x8'),_0x7f51('0x9'),'browser',_0x7f51('0xa'),_0x7f51('0xb')]],'msg':_0x7f51('0xc')}},'comment':_0x7f51('0xc')},'data1':{'type':Sequelize[_0x7f51('0xd')](0x1000),'comment':_0x7f51('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x7f51('0xf')},'data3':{'type':Sequelize['STRING'](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[_0x7f51('0xd')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x7f51('0xd')](0x1000),'comments':_0x7f51('0x10')},'data6':{'type':Sequelize[_0x7f51('0xd')],'comments':_0x7f51('0x11')},'data7':{'type':Sequelize[_0x7f51('0x12')],'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 97e09ba..b717c29 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 _0xc216=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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','limit','count','set','apply','save','update','then','destroy','error','name','send','body','find','params','catch'];(function(_0x2261d1,_0x514c90){var _0x36c3ce=function(_0x465c49){while(--_0x465c49){_0x2261d1['push'](_0x2261d1['shift']());}};_0x36c3ce(++_0x514c90);}(_0xc216,0xc4));var _0x6c21=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc216[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c21('0x0'));var zipdir=require(_0x6c21('0x1'));var jsonpatch=require(_0x6c21('0x2'));var rp=require(_0x6c21('0x3'));var moment=require(_0x6c21('0x4'));var BPromise=require(_0x6c21('0x5'));var Mustache=require(_0x6c21('0x6'));var util=require(_0x6c21('0x7'));var path=require('path');var sox=require(_0x6c21('0x8'));var csv=require(_0x6c21('0x9'));var ejs=require(_0x6c21('0xa'));var fs=require('fs');var fs_extra=require(_0x6c21('0xb'));var _=require(_0x6c21('0xc'));var squel=require(_0x6c21('0xd'));var crypto=require(_0x6c21('0xe'));var jsforce=require(_0x6c21('0xf'));var deskjs=require(_0x6c21('0x10'));var toCsv=require(_0x6c21('0x9'));var querystring=require(_0x6c21('0x11'));var Papa=require(_0x6c21('0x12'));var Redis=require(_0x6c21('0x13'));var authService=require(_0x6c21('0x14'));var qs=require(_0x6c21('0x15'));var as=require(_0x6c21('0x16'));var hardwareService=require(_0x6c21('0x17'));var logger=require('../../config/logger')(_0x6c21('0x18'));var utils=require(_0x6c21('0x19'));var config=require(_0x6c21('0x1a'));var licenseUtil=require(_0x6c21('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5b97,_0x17baa8){_0x17baa8=_0x17baa8||0xcc;return function(_0x552436){if(_0x552436){return _0x1e5b97[_0x6c21('0x1c')](_0x17baa8);}return _0x1e5b97[_0x6c21('0x1d')](_0x17baa8)[_0x6c21('0x1e')]();};}function respondWithResult(_0x1ec8e0,_0x7c50fd){_0x7c50fd=_0x7c50fd||0xc8;return function(_0x24030a){if(_0x24030a){return _0x1ec8e0['status'](_0x7c50fd)[_0x6c21('0x1f')](_0x24030a);}};}function respondWithFilteredResult(_0x29dfe8,_0x3284fc){return function(_0xae5259){if(_0xae5259){var _0x3e7429=typeof _0x3284fc[_0x6c21('0x20')]===_0x6c21('0x21')&&typeof _0x3284fc[_0x6c21('0x22')]===_0x6c21('0x21');var _0x4d976c=_0xae5259[_0x6c21('0x23')];var _0x38de0b=_0x3e7429?0x0:_0x3284fc['offset'];var _0x408219=_0x3e7429?_0xae5259['count']:_0x3284fc[_0x6c21('0x20')]+_0x3284fc['limit'];var _0x1637b6;if(_0x408219>=_0x4d976c){_0x408219=_0x4d976c;_0x1637b6=0xc8;}else{_0x1637b6=0xce;}_0x29dfe8[_0x6c21('0x1d')](_0x1637b6);return _0x29dfe8[_0x6c21('0x24')]('Content-Range',_0x38de0b+'-'+_0x408219+'/'+_0x4d976c)[_0x6c21('0x1f')](_0xae5259);}return null;};}function patchUpdates(_0x505dac){return function(_0x1a476d){try{jsonpatch[_0x6c21('0x25')](_0x1a476d,_0x505dac,!![]);}catch(_0x26af81){return BPromise['reject'](_0x26af81);}return _0x1a476d[_0x6c21('0x26')]();};}function saveUpdates(_0x35ad90,_0x365287){return function(_0xf24cce){if(_0xf24cce){return _0xf24cce[_0x6c21('0x27')](_0x35ad90)[_0x6c21('0x28')](function(_0x1b2c61){return _0x1b2c61;});}return null;};}function removeEntity(_0xd261a3,_0xcaf75c){return function(_0x141c09){if(_0x141c09){return _0x141c09[_0x6c21('0x29')]()[_0x6c21('0x28')](function(){_0xd261a3[_0x6c21('0x1d')](0xcc)[_0x6c21('0x1e')]();});}};}function handleEntityNotFound(_0x365d11,_0x28de92){return function(_0x40ef52){if(!_0x40ef52){_0x365d11[_0x6c21('0x1c')](0x194);}return _0x40ef52;};}function handleError(_0x24ee81,_0x2fb173){_0x2fb173=_0x2fb173||0x1f4;return function(_0x173dea){logger[_0x6c21('0x2a')](_0x173dea['stack']);if(_0x173dea['name']){delete _0x173dea[_0x6c21('0x2b')];}_0x24ee81[_0x6c21('0x1d')](_0x2fb173)[_0x6c21('0x2c')](_0x173dea);};}exports[_0x6c21('0x27')]=function(_0x5d488b,_0x5d8916){if(_0x5d488b[_0x6c21('0x2d')]['id']){delete _0x5d488b[_0x6c21('0x2d')]['id'];}return db['Action'][_0x6c21('0x2e')]({'where':{'id':_0x5d488b['params']['id']}})[_0x6c21('0x28')](handleEntityNotFound(_0x5d8916,null))[_0x6c21('0x28')](saveUpdates(_0x5d488b[_0x6c21('0x2d')],null))[_0x6c21('0x28')](respondWithResult(_0x5d8916,null))['catch'](handleError(_0x5d8916,null));};exports['destroy']=function(_0x5959d1,_0x2e8864){return db['Action'][_0x6c21('0x2e')]({'where':{'id':_0x5959d1[_0x6c21('0x2f')]['id']}})[_0x6c21('0x28')](handleEntityNotFound(_0x2e8864,null))[_0x6c21('0x28')](removeEntity(_0x2e8864,null))[_0x6c21('0x30')](handleError(_0x2e8864,null));}; \ No newline at end of file +var _0xa731=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','send','body','Action','find','params','catch','rimraf','fast-json-patch','moment','bluebird','util'];(function(_0x4abe09,_0x319000){var _0x51c711=function(_0x4bbfcc){while(--_0x4bbfcc){_0x4abe09['push'](_0x4abe09['shift']());}};_0x51c711(++_0x319000);}(_0xa731,0x144));var _0x1a73=function(_0x234ae4,_0x1482c2){_0x234ae4=_0x234ae4-0x0;var _0x2db683=_0xa731[_0x234ae4];return _0x2db683;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a73('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a73('0x1'));var rp=require('request-promise');var moment=require(_0x1a73('0x2'));var BPromise=require(_0x1a73('0x3'));var Mustache=require('mustache');var util=require(_0x1a73('0x4'));var path=require(_0x1a73('0x5'));var sox=require(_0x1a73('0x6'));var csv=require(_0x1a73('0x7'));var ejs=require(_0x1a73('0x8'));var fs=require('fs');var fs_extra=require(_0x1a73('0x9'));var _=require(_0x1a73('0xa'));var squel=require(_0x1a73('0xb'));var crypto=require(_0x1a73('0xc'));var jsforce=require(_0x1a73('0xd'));var deskjs=require(_0x1a73('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a73('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1a73('0x10'));var as=require(_0x1a73('0x11'));var hardwareService=require(_0x1a73('0x12'));var logger=require(_0x1a73('0x13'))(_0x1a73('0x14'));var utils=require(_0x1a73('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1a73('0x16'));var db=require(_0x1a73('0x17'))['db'];function respondWithStatusCode(_0x4bda29,_0x2ba3a3){_0x2ba3a3=_0x2ba3a3||0xcc;return function(_0x41933b){if(_0x41933b){return _0x4bda29[_0x1a73('0x18')](_0x2ba3a3);}return _0x4bda29[_0x1a73('0x19')](_0x2ba3a3)[_0x1a73('0x1a')]();};}function respondWithResult(_0x1d8de5,_0x30307a){_0x30307a=_0x30307a||0xc8;return function(_0x5cf4ee){if(_0x5cf4ee){return _0x1d8de5[_0x1a73('0x19')](_0x30307a)['json'](_0x5cf4ee);}};}function respondWithFilteredResult(_0x567a22,_0x2ac40b){return function(_0x5ddfaf){if(_0x5ddfaf){var _0x512392=typeof _0x2ac40b[_0x1a73('0x1b')]===_0x1a73('0x1c')&&typeof _0x2ac40b[_0x1a73('0x1d')]==='undefined';var _0x405d07=_0x5ddfaf[_0x1a73('0x1e')];var _0x5bac7d=_0x512392?0x0:_0x2ac40b[_0x1a73('0x1b')];var _0x5c6c4a=_0x512392?_0x5ddfaf[_0x1a73('0x1e')]:_0x2ac40b['offset']+_0x2ac40b[_0x1a73('0x1d')];var _0x3dbc9f;if(_0x5c6c4a>=_0x405d07){_0x5c6c4a=_0x405d07;_0x3dbc9f=0xc8;}else{_0x3dbc9f=0xce;}_0x567a22[_0x1a73('0x19')](_0x3dbc9f);return _0x567a22[_0x1a73('0x1f')]('Content-Range',_0x5bac7d+'-'+_0x5c6c4a+'/'+_0x405d07)[_0x1a73('0x20')](_0x5ddfaf);}return null;};}function patchUpdates(_0x29d1f9){return function(_0x3ff135){try{jsonpatch[_0x1a73('0x21')](_0x3ff135,_0x29d1f9,!![]);}catch(_0x11a5f7){return BPromise[_0x1a73('0x22')](_0x11a5f7);}return _0x3ff135[_0x1a73('0x23')]();};}function saveUpdates(_0x2b6cfe,_0x32da28){return function(_0x5551e2){if(_0x5551e2){return _0x5551e2[_0x1a73('0x24')](_0x2b6cfe)[_0x1a73('0x25')](function(_0x290be4){return _0x290be4;});}return null;};}function removeEntity(_0x5bc51b,_0xa002ce){return function(_0x48d7e2){if(_0x48d7e2){return _0x48d7e2[_0x1a73('0x26')]()['then'](function(){_0x5bc51b['status'](0xcc)[_0x1a73('0x1a')]();});}};}function handleEntityNotFound(_0x317c17,_0x5c31b0){return function(_0x461613){if(!_0x461613){_0x317c17[_0x1a73('0x18')](0x194);}return _0x461613;};}function handleError(_0x28aa65,_0x135ff6){_0x135ff6=_0x135ff6||0x1f4;return function(_0x3f6b18){logger[_0x1a73('0x27')](_0x3f6b18[_0x1a73('0x28')]);if(_0x3f6b18['name']){delete _0x3f6b18['name'];}_0x28aa65[_0x1a73('0x19')](_0x135ff6)[_0x1a73('0x29')](_0x3f6b18);};}exports[_0x1a73('0x24')]=function(_0x1d920a,_0x722d96){if(_0x1d920a[_0x1a73('0x2a')]['id']){delete _0x1d920a['body']['id'];}return db[_0x1a73('0x2b')][_0x1a73('0x2c')]({'where':{'id':_0x1d920a[_0x1a73('0x2d')]['id']}})[_0x1a73('0x25')](handleEntityNotFound(_0x722d96,null))[_0x1a73('0x25')](saveUpdates(_0x1d920a[_0x1a73('0x2a')],null))['then'](respondWithResult(_0x722d96,null))[_0x1a73('0x2e')](handleError(_0x722d96,null));};exports[_0x1a73('0x26')]=function(_0x2af22d,_0x4b44dc){return db[_0x1a73('0x2b')][_0x1a73('0x2c')]({'where':{'id':_0x2af22d['params']['id']}})['then'](handleEntityNotFound(_0x4b44dc,null))[_0x1a73('0x25')](removeEntity(_0x4b44dc,null))['catch'](handleError(_0x4b44dc,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 011237c..a257180 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 _0xd1d9=['request-promise','rimraf','./action.attributes','exports','tools_actions','lodash','util','../../config/logger','moment','bluebird'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xd1d9,0x13b));var _0x9d1d=function(_0x154f26,_0x228c67){_0x154f26=_0x154f26-0x0;var _0x2a1b3f=_0xd1d9[_0x154f26];return _0x2a1b3f;};'use strict';var _=require(_0x9d1d('0x0'));var util=require(_0x9d1d('0x1'));var logger=require(_0x9d1d('0x2'))('api');var moment=require(_0x9d1d('0x3'));var BPromise=require(_0x9d1d('0x4'));var rp=require(_0x9d1d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d1d('0x6'));var config=require('../../config/environment');var attributes=require(_0x9d1d('0x7'));module[_0x9d1d('0x8')]=function(_0x1bde9f,_0xad9da9){return _0x1bde9f['define']('Action',attributes,{'tableName':_0x9d1d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x173d=['./action.attributes','define','tools_actions','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x59b0c3,_0x2599d8){var _0x18c961=function(_0x3018dc){while(--_0x3018dc){_0x59b0c3['push'](_0x59b0c3['shift']());}};_0x18c961(++_0x2599d8);}(_0x173d,0x108));var _0xd173=function(_0x3f9029,_0xeb1ce6){_0x3f9029=_0x3f9029-0x0;var _0x217cc6=_0x173d[_0x3f9029];return _0x217cc6;};'use strict';var _=require('lodash');var util=require(_0xd173('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd173('0x1'));var BPromise=require('bluebird');var rp=require(_0xd173('0x2'));var fs=require('fs');var path=require(_0xd173('0x3'));var rimraf=require(_0xd173('0x4'));var config=require(_0xd173('0x5'));var attributes=require(_0xd173('0x6'));module['exports']=function(_0x24f796,_0x2d464b){return _0x24f796[_0xd173('0x7')]('Action',attributes,{'tableName':_0xd173('0x8'),'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 45c9a95..73edaf6 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\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(_0x2d5abe,_0x421434){var _0x4a603c=function(_0x196bac){while(--_0x196bac){_0x2d5abe['push'](_0x2d5abe['shift']());}};_0x4a603c(++_0x421434);}(_0x1261,0x144));var _0x1126=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x1261[_0x380307];return _0x9ea14b;};'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')]('Action,\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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x457d29,_0x37da9f){var _0x190272=function(_0x5027d3){while(--_0x5027d3){_0x457d29['push'](_0x457d29['shift']());}};_0x190272(++_0x37da9f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0x5fc3[_0x40911a];return _0x27e8e3;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 821edcd..45e8c01 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 _0x7600=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x4c0ca7,_0x267486){var _0x198a33=function(_0xd3c479){while(--_0xd3c479){_0x4c0ca7['push'](_0x4c0ca7['shift']());}};_0x198a33(++_0x267486);}(_0x7600,0xf3));var _0x0760=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x7600[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0x0760('0x0'));var util=require(_0x0760('0x1'));var path=require(_0x0760('0x2'));var timeout=require(_0x0760('0x3'));var express=require('express');var router=express[_0x0760('0x4')]();var fs_extra=require(_0x0760('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0760('0x6'));var config=require(_0x0760('0x7'));var controller=require(_0x0760('0x8'));router[_0x0760('0x9')](_0x0760('0xa'),auth[_0x0760('0xb')](),controller[_0x0760('0xc')]);router[_0x0760('0xd')](_0x0760('0xa'),auth[_0x0760('0xb')](),controller[_0x0760('0xe')]);module[_0x0760('0xf')]=router; \ No newline at end of file +var _0x076e=['../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x076e,0x1ad));var _0xe076=function(_0x1a6e48,_0x2f14de){_0x1a6e48=_0x1a6e48-0x0;var _0x4b1025=_0x076e[_0x1a6e48];return _0x4b1025;};'use strict';var multer=require(_0xe076('0x0'));var util=require('util');var path=require(_0xe076('0x1'));var timeout=require(_0xe076('0x2'));var express=require(_0xe076('0x3'));var router=express[_0xe076('0x4')]();var fs_extra=require(_0xe076('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe076('0x6'));var config=require(_0xe076('0x7'));var controller=require(_0xe076('0x8'));router[_0xe076('0x9')](_0xe076('0xa'),auth[_0xe076('0xb')](),controller[_0xe076('0xc')]);router['delete']('/:id',auth[_0xe076('0xb')](),controller[_0xe076('0xd')]);module[_0xe076('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 922a17f..78a3736 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 _0xc4aa=['STRING','sequelize','exports'];(function(_0x17de62,_0x561f1b){var _0x1014d4=function(_0x4dd9f1){while(--_0x4dd9f1){_0x17de62['push'](_0x17de62['shift']());}};_0x1014d4(++_0x561f1b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x038b=['exports','STRING','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x038b,0x114));var _0xb038=function(_0x509210,_0x33fb39){_0x509210=_0x509210-0x0;var _0x23f5b0=_0x038b[_0x509210];return _0x23f5b0;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb038('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb038('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f1338a5..49b9da7 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 _0x93f4=['CustomReports','UserProfileResource','sendStatus','error','stack','name','index','AnalyticCustomReport','rawAttributes','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','keyBy','select','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','COUNT(%s)','IS\x20EMPTY','operator','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','groupBy','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','run','runReport','MAX(%s)','eml-format','rimraf','fast-json-patch','moment','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','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','count','limit','set','apply','then','destroy','get'];(function(_0x149cbe,_0x37e5b8){var _0x70795=function(_0x4cb85c){while(--_0x4cb85c){_0x149cbe['push'](_0x149cbe['shift']());}};_0x70795(++_0x37e5b8);}(_0x93f4,0x124));var _0x493f=function(_0xb29e9b,_0x6dee8c){_0xb29e9b=_0xb29e9b-0x0;var _0x10b5dc=_0x93f4[_0xb29e9b];return _0x10b5dc;};'use strict';var emlformat=require(_0x493f('0x0'));var rimraf=require(_0x493f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x493f('0x2'));var rp=require('request-promise');var moment=require(_0x493f('0x3'));var BPromise=require(_0x493f('0x4'));var Mustache=require(_0x493f('0x5'));var util=require(_0x493f('0x6'));var path=require(_0x493f('0x7'));var sox=require(_0x493f('0x8'));var csv=require(_0x493f('0x9'));var ejs=require(_0x493f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x493f('0xb'));var squel=require(_0x493f('0xc'));var crypto=require(_0x493f('0xd'));var jsforce=require(_0x493f('0xe'));var deskjs=require(_0x493f('0xf'));var toCsv=require(_0x493f('0x9'));var querystring=require(_0x493f('0x10'));var Papa=require(_0x493f('0x11'));var Redis=require(_0x493f('0x12'));var authService=require(_0x493f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x493f('0x14'));var hardwareService=require(_0x493f('0x15'));var logger=require('../../config/logger')(_0x493f('0x16'));var utils=require(_0x493f('0x17'));var config=require(_0x493f('0x18'));var licenseUtil=require(_0x493f('0x19'));var db=require(_0x493f('0x1a'))['db'];var dbH=require(_0x493f('0x1a'))[_0x493f('0x1b')];function respondWithStatusCode(_0x4bdc5e,_0x43a352){_0x43a352=_0x43a352||0xcc;return function(_0x436b02){if(_0x436b02){return _0x4bdc5e['sendStatus'](_0x43a352);}return _0x4bdc5e[_0x493f('0x1c')](_0x43a352)[_0x493f('0x1d')]();};}function respondWithResult(_0x2e83df,_0x1e7156){_0x1e7156=_0x1e7156||0xc8;return function(_0x33a910){if(_0x33a910){return _0x2e83df[_0x493f('0x1c')](_0x1e7156)[_0x493f('0x1e')](_0x33a910);}};}function respondWithFilteredResult(_0x13884f,_0x408fe1){return function(_0x2fe523){if(_0x2fe523){var _0x6905d0=typeof _0x408fe1[_0x493f('0x1f')]==='undefined'&&typeof _0x408fe1['limit']===_0x493f('0x20');var _0x208568=_0x2fe523[_0x493f('0x21')];var _0x276eaf=_0x6905d0?0x0:_0x408fe1['offset'];var _0x571a7c=_0x6905d0?_0x2fe523[_0x493f('0x21')]:_0x408fe1['offset']+_0x408fe1[_0x493f('0x22')];var _0x36cef8;if(_0x571a7c>=_0x208568){_0x571a7c=_0x208568;_0x36cef8=0xc8;}else{_0x36cef8=0xce;}_0x13884f[_0x493f('0x1c')](_0x36cef8);return _0x13884f[_0x493f('0x23')]('Content-Range',_0x276eaf+'-'+_0x571a7c+'/'+_0x208568)[_0x493f('0x1e')](_0x2fe523);}return null;};}function patchUpdates(_0x26cd55){return function(_0x1913ef){try{jsonpatch[_0x493f('0x24')](_0x1913ef,_0x26cd55,!![]);}catch(_0x233db6){return BPromise['reject'](_0x233db6);}return _0x1913ef['save']();};}function saveUpdates(_0x43830c,_0xb21fe6){return function(_0x13c0c9){if(_0x13c0c9){return _0x13c0c9['update'](_0x43830c)[_0x493f('0x25')](function(_0x404d47){return _0x404d47;});}return null;};}function removeEntity(_0x3eb068,_0xe9b085){return function(_0x58d06){if(_0x58d06){return _0x58d06[_0x493f('0x26')]()['then'](function(){var _0x3eb381=_0x58d06[_0x493f('0x27')]({'plain':!![]});var _0x2b7108=_0x493f('0x28');return db[_0x493f('0x29')][_0x493f('0x26')]({'where':{'type':_0x2b7108,'resourceId':_0x3eb381['id']}})['then'](function(){return _0x58d06;});})[_0x493f('0x25')](function(){_0x3eb068['status'](0xcc)[_0x493f('0x1d')]();});}};}function handleEntityNotFound(_0x180052,_0x45d0be){return function(_0x4209b8){if(!_0x4209b8){_0x180052[_0x493f('0x2a')](0x194);}return _0x4209b8;};}function handleError(_0xc552c,_0x24681b){_0x24681b=_0x24681b||0x1f4;return function(_0x1dfa3e){logger[_0x493f('0x2b')](_0x1dfa3e[_0x493f('0x2c')]);if(_0x1dfa3e[_0x493f('0x2d')]){delete _0x1dfa3e['name'];}_0xc552c['status'](_0x24681b)['send'](_0x1dfa3e);};}exports[_0x493f('0x2e')]=function(_0x588180,_0x3b4bf3){var _0x4bcf53={},_0x45609b={},_0x352656={'count':0x0,'rows':[]};var _0x5d9347=_['map'](db[_0x493f('0x2f')][_0x493f('0x30')],function(_0x230d35){return{'name':_0x230d35['fieldName'],'type':_0x230d35[_0x493f('0x31')][_0x493f('0x32')]};});_0x45609b['model']=_[_0x493f('0x33')](_0x5d9347,'name');_0x45609b[_0x493f('0x34')]=_['keys'](_0x588180[_0x493f('0x34')]);_0x45609b['filters']=_[_0x493f('0x35')](_0x45609b['model'],_0x45609b['query']);_0x4bcf53['attributes']=_[_0x493f('0x35')](_0x45609b[_0x493f('0x36')],qs['fields'](_0x588180[_0x493f('0x34')][_0x493f('0x37')]));_0x4bcf53[_0x493f('0x38')]=_0x4bcf53[_0x493f('0x38')][_0x493f('0x39')]?_0x4bcf53['attributes']:_0x45609b[_0x493f('0x36')];if(!_0x588180[_0x493f('0x34')][_0x493f('0x3a')](_0x493f('0x3b'))){_0x4bcf53[_0x493f('0x22')]=qs['limit'](_0x588180[_0x493f('0x34')]['limit']);_0x4bcf53[_0x493f('0x1f')]=qs[_0x493f('0x1f')](_0x588180[_0x493f('0x34')]['offset']);}_0x4bcf53[_0x493f('0x3c')]=qs[_0x493f('0x3d')](_0x588180[_0x493f('0x34')]['sort']);_0x4bcf53[_0x493f('0x3e')]=qs['filters'](_[_0x493f('0x3f')](_0x588180[_0x493f('0x34')],_0x45609b[_0x493f('0x40')]),_0x5d9347);if(_0x588180[_0x493f('0x34')][_0x493f('0x41')]){_0x4bcf53['where']=_['merge'](_0x4bcf53[_0x493f('0x3e')],{'$or':_[_0x493f('0x33')](_0x5d9347,function(_0x4ffa01){if(_0x4ffa01[_0x493f('0x31')]!=='VIRTUAL'){var _0x5c259e={};_0x5c259e[_0x4ffa01['name']]={'$like':'%'+_0x588180[_0x493f('0x34')][_0x493f('0x41')]+'%'};return _0x5c259e;}})});}_0x4bcf53=_[_0x493f('0x42')]({},_0x4bcf53,_0x588180[_0x493f('0x43')]);var _0x4c0230={'where':_0x4bcf53[_0x493f('0x3e')]};return db['AnalyticCustomReport'][_0x493f('0x21')](_0x4c0230)[_0x493f('0x25')](function(_0x5ea662){_0x352656[_0x493f('0x21')]=_0x5ea662;if(_0x588180[_0x493f('0x34')][_0x493f('0x44')]){_0x4bcf53[_0x493f('0x45')]=[{'all':!![]}];}return db[_0x493f('0x2f')][_0x493f('0x46')](_0x4bcf53);})[_0x493f('0x25')](function(_0x25d373){_0x352656[_0x493f('0x47')]=_0x25d373;return _0x352656;})[_0x493f('0x25')](respondWithFilteredResult(_0x3b4bf3,_0x4bcf53))[_0x493f('0x48')](handleError(_0x3b4bf3,null));};exports['show']=function(_0x28b3f9,_0x3fc614){var _0x122b1f={'raw':![],'where':{'id':_0x28b3f9['params']['id']}},_0x2b1150={};_0x2b1150['model']=_['keys'](db[_0x493f('0x2f')][_0x493f('0x30')]);_0x2b1150[_0x493f('0x34')]=_['keys'](_0x28b3f9['query']);_0x2b1150[_0x493f('0x40')]=_['intersection'](_0x2b1150[_0x493f('0x36')],_0x2b1150[_0x493f('0x34')]);_0x122b1f['attributes']=_[_0x493f('0x35')](_0x2b1150[_0x493f('0x36')],qs['fields'](_0x28b3f9[_0x493f('0x34')][_0x493f('0x37')]));_0x122b1f[_0x493f('0x38')]=_0x122b1f[_0x493f('0x38')]['length']?_0x122b1f[_0x493f('0x38')]:_0x2b1150[_0x493f('0x36')];if(_0x28b3f9[_0x493f('0x34')][_0x493f('0x44')]){_0x122b1f[_0x493f('0x45')]=[{'all':!![]}];}_0x122b1f=_[_0x493f('0x42')]({},_0x122b1f,_0x28b3f9['options']);return db[_0x493f('0x2f')][_0x493f('0x49')](_0x122b1f)[_0x493f('0x25')](handleEntityNotFound(_0x3fc614,null))[_0x493f('0x25')](respondWithResult(_0x3fc614,null))['catch'](handleError(_0x3fc614,null));};exports['create']=function(_0x5ae1d2,_0x5a61f1){return db[_0x493f('0x2f')][_0x493f('0x4a')](_0x5ae1d2[_0x493f('0x4b')],{})[_0x493f('0x25')](function(_0x32075d){var _0x35dc3e=_0x5ae1d2[_0x493f('0x4c')][_0x493f('0x27')]({'plain':!![]});if(!_0x35dc3e)throw new Error(_0x493f('0x4d'));if(_0x35dc3e['role']===_0x493f('0x4c')){var _0x4ee012=_0x32075d[_0x493f('0x27')]({'plain':!![]});var _0x1dc8d4=_0x493f('0x4e');return db['UserProfileSection'][_0x493f('0x49')]({'where':{'name':_0x1dc8d4,'userProfileId':_0x35dc3e[_0x493f('0x4f')]},'raw':!![]})[_0x493f('0x25')](function(_0x1e8c9b){if(_0x1e8c9b&&_0x1e8c9b[_0x493f('0x50')]===0x0){return db[_0x493f('0x29')][_0x493f('0x4a')]({'name':_0x4ee012[_0x493f('0x2d')],'resourceId':_0x4ee012['id'],'type':'CustomReports','sectionId':_0x1e8c9b['id']},{})[_0x493f('0x25')](function(){return _0x32075d;});}else{return _0x32075d;}})['catch'](function(_0x35b104){logger[_0x493f('0x2b')](_0x493f('0x51'),_0x35b104);throw _0x35b104;});}return _0x32075d;})['then'](respondWithResult(_0x5a61f1,0xc9))[_0x493f('0x48')](handleError(_0x5a61f1,null));};exports[_0x493f('0x52')]=function(_0x414e43,_0x581704){if(_0x414e43[_0x493f('0x4b')]['id']){delete _0x414e43[_0x493f('0x4b')]['id'];}return db[_0x493f('0x2f')][_0x493f('0x49')]({'where':{'id':_0x414e43[_0x493f('0x53')]['id']}})[_0x493f('0x25')](handleEntityNotFound(_0x581704,null))[_0x493f('0x25')](saveUpdates(_0x414e43['body'],null))[_0x493f('0x25')](respondWithResult(_0x581704,null))[_0x493f('0x48')](handleError(_0x581704,null));};exports['destroy']=function(_0x1aa548,_0x565995){return db[_0x493f('0x2f')]['find']({'where':{'id':_0x1aa548[_0x493f('0x53')]['id']}})[_0x493f('0x25')](handleEntityNotFound(_0x565995,null))['then'](removeEntity(_0x565995,null))[_0x493f('0x48')](handleError(_0x565995,null));};exports['preview']=function(_0x9c6e08,_0x2db416){var _0x44ffde=0xa;var _0x5ed462=['join',_0x493f('0x54'),_0x493f('0x55'),_0x493f('0x56')];var _0x2b95d1={'SUM':_0x493f('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x493f('0x58'),'MAX':'MAX(%s)','MIN':_0x493f('0x59'),'AVG':_0x493f('0x5a'),'GROUP_CONCAT':_0x493f('0x5b'),'GROUP_CONCAT ASC':_0x493f('0x5c'),'GROUP_CONCAT DESC':_0x493f('0x5d')};var _0x2bc93b={'SEC_TO_TIME':_0x493f('0x5e'),'DATE':_0x493f('0x5f'),'HOUR':_0x493f('0x60'),'ROUND':_0x493f('0x61'),'UNIX_TIMESTAMP':_0x493f('0x62')};var _0x1eb8e7=function(_0x23a273){return!_[_0x493f('0x63')]([_0x493f('0x64'),_0x493f('0x65'),'IS\x20EMPTY',_0x493f('0x66')],_0x23a273);};var _0x507376=function(_0x472a06){if(!_0x472a06||!_0x472a06[_0x493f('0x67')][_0x493f('0x39')]){return'';}for(var _0x215327='(',_0x4ebd9b=0x0;_0x4ebd9b<_0x472a06[_0x493f('0x67')]['length'];_0x4ebd9b+=0x1){_0x4ebd9b>0x0&&(_0x215327+='\x20'+_0x472a06['operator']+'\x20');_0x215327+=_0x472a06['rules'][_0x4ebd9b]['group']?_0x507376(_0x472a06[_0x493f('0x67')][_0x4ebd9b][_0x493f('0x68')]):_0x472a06[_0x493f('0x67')][_0x4ebd9b][_0x493f('0x69')]+'\x20'+_0x472a06['rules'][_0x4ebd9b]['condition']+(_0x1eb8e7(_0x472a06[_0x493f('0x67')][_0x4ebd9b][_0x493f('0x6a')])?'\x20'+_0x472a06[_0x493f('0x67')][_0x4ebd9b][_0x493f('0x6b')]:'');}return _0x215327+')';};var _0x54cdbd={'where':{'id':_0x9c6e08[_0x493f('0x53')]['id']}},_0x269988,_0x31c420,_0x276acb,_0x59a0e8,_0x28b988;_0x54cdbd=_[_0x493f('0x42')]({},_0x54cdbd,_0x9c6e08[_0x493f('0x43')]);return db['AnalyticCustomReport'][_0x493f('0x49')](_0x54cdbd)[_0x493f('0x25')](function(_0x5edc4c){if(_0x5edc4c){_0x269988=_0x5edc4c;return _0x5edc4c['getFields']();}return null;})['then'](function(_0x3c8692){if(_0x3c8692){if(!_0x3c8692['length']){throw new db[(_0x493f('0x6c'))][(_0x493f('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x31c420=_0x3c8692;return db['AnalyticMetric'][_0x493f('0x46')]({'raw':!![]});}return null;})[_0x493f('0x25')](function(_0x2a192d){if(_0x2a192d){_0x276acb=_[_0x493f('0x6e')](_0x2a192d,'id');var _0x17571d;var _0x380e6d=squel[_0x493f('0x6f')]();_0x380e6d['from'](_0x269988[_0x493f('0x70')]);for(var _0x481d7e=0x0;_0x481d7e<_0x31c420[_0x493f('0x39')];_0x481d7e+=0x1){_0x17571d=_0x31c420[_0x481d7e][_0x493f('0x71')]?_0x276acb[_0x31c420[_0x481d7e][_0x493f('0x71')]][_0x493f('0x72')]:_0x31c420[_0x481d7e][_0x493f('0x69')];_0x17571d=_0x31c420[_0x481d7e][_0x493f('0x73')]?_[_0x493f('0x74')](_0x2b95d1[_0x31c420[_0x481d7e][_0x493f('0x73')]],'%s',_0x17571d):_0x17571d;_0x17571d=_0x31c420[_0x481d7e][_0x493f('0x75')]?_[_0x493f('0x74')](_0x2bc93b[_0x31c420[_0x481d7e][_0x493f('0x75')]],'%s',_0x17571d):_0x17571d;if(_0x31c420[_0x481d7e]['groupBy']){_0x380e6d[_0x493f('0x68')](_0x17571d);}_0x31c420[_0x481d7e][_0x493f('0x76')]&&_0x380e6d[_0x493f('0x3c')](_0x17571d,_0x31c420[_0x481d7e]['orderBy']===_0x493f('0x77')?![]:!![]);_0x380e6d[_0x493f('0x69')](_0x17571d,_0x31c420[_0x481d7e][_0x493f('0x78')]||_0x17571d);}if(_0x269988['joins']){_0x269988[_0x493f('0x79')]=JSON['parse'](_0x269988['joins']);for(var _0x1cfa36=0x0;_0x1cfa36<_0x269988[_0x493f('0x79')][_0x493f('0x39')];_0x1cfa36+=0x1){if(_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x31')]&&_[_0x493f('0x63')](_0x5ed462,_0x269988[_0x493f('0x79')][_0x1cfa36]['type'])&&_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7a')]&&_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7b')]&&_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7c')]){_0x380e6d[_0x269988[_0x493f('0x79')][_0x1cfa36]['type']](_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7b')],null,util['format'](_0x493f('0x7d'),_0x269988[_0x493f('0x70')],_0x269988['joins'][_0x1cfa36]['parentKey'],_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7b')],_0x269988[_0x493f('0x79')][_0x1cfa36]['foreignKey']));}}}if(_0x269988[_0x493f('0x7e')]){_0x269988[_0x493f('0x7e')]=JSON[_0x493f('0x7f')](_0x269988[_0x493f('0x7e')]);_0x380e6d['where'](_0x507376(_0x269988[_0x493f('0x7e')]['group']));}_0x28b988=_0x380e6d[_0x493f('0x80')]();_0x380e6d['limit'](_0x44ffde);_0x380e6d[_0x493f('0x1f')](0x0);logger[_0x493f('0x81')](_0x493f('0x82'),_0x380e6d[_0x493f('0x83')]());return dbH[_0x493f('0x84')]['query'](_0x380e6d['toString'](),{'type':dbH[_0x493f('0x84')][_0x493f('0x85')][_0x493f('0x86')]});}})[_0x493f('0x25')](respondWithResult(_0x2db416,null))[_0x493f('0x48')](handleError(_0x2db416,null));};function runReport(_0x2a0a75,_0x15a0a5,_0x1a77ee){var _0x268523=_0x15a0a5['name'];var _0x41bf51=0xa;var _0x17aa99=[_0x493f('0x87'),_0x493f('0x54'),_0x493f('0x55'),'cross_join'];var _0x5b9ee3={'SUM':_0x493f('0x57'),'COUNT':_0x493f('0x88'),'COUNT DISTINCT':_0x493f('0x58'),'MAX':'MAX(%s)','MIN':_0x493f('0x59'),'AVG':_0x493f('0x5a'),'GROUP_CONCAT':_0x493f('0x5b'),'GROUP_CONCAT ASC':_0x493f('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x153bf8={'SEC_TO_TIME':_0x493f('0x5e'),'DATE':_0x493f('0x5f'),'HOUR':_0x493f('0x60'),'ROUND':_0x493f('0x61'),'UNIX_TIMESTAMP':_0x493f('0x62')};var _0x4eccc3=function(_0xaf934){return!_[_0x493f('0x63')]([_0x493f('0x64'),'IS\x20NOT\x20NULL',_0x493f('0x89'),'IS\x20NOT\x20EMPTY'],_0xaf934);};var _0x2b1bfe=function(_0x373ce3){if(!_0x373ce3||!_0x373ce3[_0x493f('0x67')]['length']){return'';}for(var _0x300b42='(',_0x5bab0a=0x0;_0x5bab0a<_0x373ce3[_0x493f('0x67')][_0x493f('0x39')];_0x5bab0a+=0x1){_0x5bab0a>0x0&&(_0x300b42+='\x20'+_0x373ce3[_0x493f('0x8a')]+'\x20');_0x300b42+=_0x373ce3['rules'][_0x5bab0a]['group']?_0x2b1bfe(_0x373ce3[_0x493f('0x67')][_0x5bab0a][_0x493f('0x68')]):_0x373ce3['rules'][_0x5bab0a]['field']+'\x20'+_0x373ce3[_0x493f('0x67')][_0x5bab0a][_0x493f('0x6a')]+(_0x4eccc3(_0x373ce3[_0x493f('0x67')][_0x5bab0a][_0x493f('0x6a')])?'\x20'+_0x373ce3[_0x493f('0x67')][_0x5bab0a][_0x493f('0x6b')]:'');}return _0x300b42+')';};var _0x131b58={'where':{'id':_0x2a0a75['id']}},_0x3204dc,_0x22e77d,_0xc628d4,_0xee874b,_0xdb2949;_0x131b58=_[_0x493f('0x42')]({},_0x131b58,_0x1a77ee);return db[_0x493f('0x2f')][_0x493f('0x49')](_0x131b58)['then'](function(_0x1122e9){if(_0x1122e9){_0x3204dc=_0x1122e9;return _0x1122e9[_0x493f('0x8b')]();}return null;})['then'](function(_0xe82b58){if(_0xe82b58){if(!_0xe82b58['length']){throw new db[(_0x493f('0x6c'))][(_0x493f('0x6d'))](_0x493f('0x8c'),0x193);}_0x22e77d=_0xe82b58;return db[_0x493f('0x8d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0xa46a16){if(_0xa46a16){_0xc628d4=_[_0x493f('0x6e')](_0xa46a16,'id');var _0xf24eef;var _0x5895c1=squel[_0x493f('0x6f')]();_0x5895c1[_0x493f('0x8e')](_0x3204dc['table']);for(var _0x1c55d6=0x0;_0x1c55d6<_0x22e77d[_0x493f('0x39')];_0x1c55d6+=0x1){_0xf24eef=_0x22e77d[_0x1c55d6][_0x493f('0x71')]?_0xc628d4[_0x22e77d[_0x1c55d6][_0x493f('0x71')]]['metric']:_0x22e77d[_0x1c55d6][_0x493f('0x69')];_0xf24eef=_0x22e77d[_0x1c55d6][_0x493f('0x73')]?_['replace'](_0x5b9ee3[_0x22e77d[_0x1c55d6]['function']],'%s',_0xf24eef):_0xf24eef;_0xf24eef=_0x22e77d[_0x1c55d6]['format']?_[_0x493f('0x74')](_0x153bf8[_0x22e77d[_0x1c55d6][_0x493f('0x75')]],'%s',_0xf24eef):_0xf24eef;if(_0x22e77d[_0x1c55d6][_0x493f('0x8f')]){_0x5895c1[_0x493f('0x68')](_0xf24eef);}_0x22e77d[_0x1c55d6]['orderBy']&&_0x5895c1['order'](_0xf24eef,_0x22e77d[_0x1c55d6][_0x493f('0x76')]==='DESC'?![]:!![]);_0x5895c1[_0x493f('0x69')](_0xf24eef,_0x22e77d[_0x1c55d6][_0x493f('0x78')]||_0xf24eef);}if(_0x3204dc[_0x493f('0x79')]){_0x3204dc[_0x493f('0x79')]=JSON['parse'](_0x3204dc[_0x493f('0x79')]);for(var _0x10845e=0x0;_0x10845e<_0x3204dc[_0x493f('0x79')][_0x493f('0x39')];_0x10845e+=0x1){if(_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x31')]&&_['includes'](_0x17aa99,_0x3204dc[_0x493f('0x79')][_0x10845e]['type'])&&_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x7a')]&&_0x3204dc[_0x493f('0x79')][_0x10845e]['foreignTable']&&_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x7c')]){_0x5895c1[_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x31')]](_0x3204dc['joins'][_0x10845e][_0x493f('0x7b')],null,util[_0x493f('0x75')](_0x493f('0x7d'),_0x3204dc['table'],_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x7a')],_0x3204dc[_0x493f('0x79')][_0x10845e]['foreignTable'],_0x3204dc[_0x493f('0x79')][_0x10845e]['foreignKey']));}}}if(_0x3204dc[_0x493f('0x7e')]){_0x3204dc[_0x493f('0x7e')]=JSON[_0x493f('0x7f')](_0x3204dc[_0x493f('0x7e')]);_0x5895c1[_0x493f('0x3e')](_0x2b1bfe(_0x3204dc[_0x493f('0x7e')]['group']));}_0xdb2949=_0x5895c1[_0x493f('0x80')]();_0x5895c1[_0x493f('0x22')](_0x41bf51);_0x5895c1[_0x493f('0x1f')](0x0);return;}})[_0x493f('0x25')](function(){if(_0x15a0a5[_0x493f('0x90')]==='web'){return null;}var _0x44ff76=_['merge'](_0x15a0a5,{'name':_0x15a0a5[_0x493f('0x91')]||_0x15a0a5['name']||_0x3204dc[_0x493f('0x2d')],'basename':_0x268523,'savename':util['format'](_0x493f('0x92'),_0x15a0a5['name']||_0x3204dc[_0x493f('0x2d')],require(_0x493f('0x93'))[_0x493f('0x94')](0x4),_0x15a0a5[_0x493f('0x90')]||_0x493f('0x95')),'reportId':_0x3204dc['id'],'reportType':_0x493f('0x96')});return db[_0x493f('0x97')][_0x493f('0x4a')](_0x44ff76,{'raw':!![]});})[_0x493f('0x25')](function(_0xe73fed){if(_0x3204dc['table']==='cdr'){_0xdb2949[_0x493f('0x3e')](_0x3204dc[_0x493f('0x70')]+_0x493f('0x98'),_0x15a0a5[_0x493f('0x99')],_0x15a0a5['endDate']);}else{_0xdb2949[_0x493f('0x3e')](_0x3204dc[_0x493f('0x70')]+_0x493f('0x9a'),_0x15a0a5['startDate'],_0x15a0a5[_0x493f('0x9b')]);}if(_0xe73fed){logger[_0x493f('0x9c')](_0x493f('0x9d'),_0xdb2949[_0x493f('0x83')]());require(_0x493f('0x9e'))['fork'](path[_0x493f('0x87')](__dirname,'../../components/export/',_0xe73fed[_0x493f('0x90')]),[_0xe73fed['id'],_0xdb2949[_0x493f('0x83')](),path[_0x493f('0x87')](__dirname,_0x493f('0x9f'),_0xe73fed[_0x493f('0xa0')]),_0x268523]);return _0xe73fed;}else{var _0x3859ef=squel[_0x493f('0x6f')]();_0x3859ef[_0x493f('0x8e')]('('+_0xdb2949[_0x493f('0x83')]()+')',_0x493f('0xa1'));_0x3859ef[_0x493f('0x69')](_0x493f('0xa2'),_0x493f('0x21'));_0xdb2949[_0x493f('0x22')](_0x15a0a5['limit']||_0x41bf51);_0xdb2949['offset'](_0x15a0a5[_0x493f('0x1f')]||0x0);return dbH[_0x493f('0x84')]['query'](_0x3859ef[_0x493f('0x83')](),{'type':dbH['sequelize'][_0x493f('0x85')]['SELECT']})[_0x493f('0x25')](function(_0x39bf78){if(!_0x39bf78[_0x493f('0x39')]){_0xee874b=0x0;}else{_0xee874b=_0x39bf78[0x0][_0x493f('0x21')]||0x0;}return dbH[_0x493f('0x84')][_0x493f('0x34')](_0xdb2949[_0x493f('0x83')](),{'type':dbH[_0x493f('0x84')][_0x493f('0x85')][_0x493f('0x86')]});})['then'](function(_0x4ab383){return{'rows':_0x4ab383||[],'count':_0xee874b};});}});}exports[_0x493f('0xa3')]=function(_0x4f232f,_0x3ac606){return runReport(_0x4f232f[_0x493f('0x53')],_0x4f232f[_0x493f('0x34')],_0x4f232f[_0x493f('0x43')])[_0x493f('0x25')](respondWithResult(_0x3ac606,null))[_0x493f('0x48')](handleError(_0x3ac606,null));};exports[_0x493f('0xa4')]=runReport;exports[_0x493f('0x34')]=function(_0x3896a3,_0x1138da){var _0x435789=0xa;var _0x3ae1ea=[_0x493f('0x87'),_0x493f('0x54'),_0x493f('0x55'),_0x493f('0x56')];var _0x35a20a={'SUM':_0x493f('0x57'),'COUNT':_0x493f('0x88'),'COUNT DISTINCT':_0x493f('0x58'),'MAX':_0x493f('0xa5'),'MIN':_0x493f('0x59'),'AVG':_0x493f('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x493f('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x362a15={'SEC_TO_TIME':_0x493f('0x5e'),'DATE':_0x493f('0x5f'),'HOUR':_0x493f('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x493f('0x62')};var _0x5d7d13=function(_0x39aec6){return!_[_0x493f('0x63')]([_0x493f('0x64'),_0x493f('0x65'),_0x493f('0x89'),'IS\x20NOT\x20EMPTY'],_0x39aec6);};var _0x2fff0c=function(_0x521633){if(!_0x521633||!_0x521633['rules'][_0x493f('0x39')]){return'';}for(var _0x3f28fe='(',_0x54f17f=0x0;_0x54f17f<_0x521633['rules'][_0x493f('0x39')];_0x54f17f+=0x1){_0x54f17f>0x0&&(_0x3f28fe+='\x20'+_0x521633['operator']+'\x20');_0x3f28fe+=_0x521633['rules'][_0x54f17f][_0x493f('0x68')]?_0x2fff0c(_0x521633[_0x493f('0x67')][_0x54f17f][_0x493f('0x68')]):_0x521633['rules'][_0x54f17f]['field']+'\x20'+_0x521633[_0x493f('0x67')][_0x54f17f]['condition']+(_0x5d7d13(_0x521633['rules'][_0x54f17f][_0x493f('0x6a')])?'\x20'+_0x521633[_0x493f('0x67')][_0x54f17f]['value']:'');}return _0x3f28fe+')';};var _0x4dbaf8={'where':{'id':_0x3896a3[_0x493f('0x53')]['id']}},_0x1fdf35,_0x4d5cac,_0x20d5c3,_0x40ea7e,_0x5abf64;_0x4dbaf8=_[_0x493f('0x42')]({},_0x4dbaf8,_0x3896a3[_0x493f('0x43')]);return db['AnalyticCustomReport'][_0x493f('0x49')](_0x4dbaf8)['then'](function(_0x1b745f){if(_0x1b745f){_0x1fdf35=_0x1b745f;return _0x1b745f[_0x493f('0x8b')]();}return null;})[_0x493f('0x25')](function(_0x2531a6){if(_0x2531a6){if(!_0x2531a6[_0x493f('0x39')]){throw new db[(_0x493f('0x6c'))]['ValidationErrorItem'](_0x493f('0x8c'),0x193);}_0x4d5cac=_0x2531a6;return db[_0x493f('0x8d')][_0x493f('0x46')]({'raw':!![]});}return null;})[_0x493f('0x25')](function(_0x3e93a5){if(_0x3e93a5){_0x20d5c3=_['keyBy'](_0x3e93a5,'id');var _0x245265;var _0x3168d1=squel[_0x493f('0x6f')]();_0x3168d1['from'](_0x1fdf35['table']);for(var _0x5a3707=0x0;_0x5a3707<_0x4d5cac['length'];_0x5a3707+=0x1){_0x245265=_0x4d5cac[_0x5a3707][_0x493f('0x71')]?_0x20d5c3[_0x4d5cac[_0x5a3707][_0x493f('0x71')]][_0x493f('0x72')]:_0x4d5cac[_0x5a3707][_0x493f('0x69')];_0x245265=_0x4d5cac[_0x5a3707]['function']?_[_0x493f('0x74')](_0x35a20a[_0x4d5cac[_0x5a3707][_0x493f('0x73')]],'%s',_0x245265):_0x245265;_0x245265=_0x4d5cac[_0x5a3707][_0x493f('0x75')]?_[_0x493f('0x74')](_0x362a15[_0x4d5cac[_0x5a3707][_0x493f('0x75')]],'%s',_0x245265):_0x245265;if(_0x4d5cac[_0x5a3707][_0x493f('0x8f')]){_0x3168d1['group'](_0x245265);}_0x4d5cac[_0x5a3707][_0x493f('0x76')]&&_0x3168d1[_0x493f('0x3c')](_0x245265,_0x4d5cac[_0x5a3707][_0x493f('0x76')]===_0x493f('0x77')?![]:!![]);_0x3168d1[_0x493f('0x69')](_0x245265,_0x4d5cac[_0x5a3707][_0x493f('0x78')]||_0x245265);}if(_0x1fdf35[_0x493f('0x79')]){_0x1fdf35[_0x493f('0x79')]=JSON[_0x493f('0x7f')](_0x1fdf35[_0x493f('0x79')]);for(var _0x956283=0x0;_0x956283<_0x1fdf35[_0x493f('0x79')][_0x493f('0x39')];_0x956283+=0x1){if(_0x1fdf35['joins'][_0x956283]['type']&&_[_0x493f('0x63')](_0x3ae1ea,_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x31')])&&_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7a')]&&_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7b')]&&_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7c')]){_0x3168d1[_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x31')]](_0x1fdf35['joins'][_0x956283][_0x493f('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1fdf35['table'],_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7a')],_0x1fdf35['joins'][_0x956283][_0x493f('0x7b')],_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7c')]));}}}if(_0x1fdf35[_0x493f('0x7e')]){_0x1fdf35[_0x493f('0x7e')]=JSON[_0x493f('0x7f')](_0x1fdf35[_0x493f('0x7e')]);_0x3168d1['where'](_0x2fff0c(_0x1fdf35['conditions'][_0x493f('0x68')]));}_0x5abf64=_0x3168d1[_0x493f('0x80')]();_0x3168d1[_0x493f('0x22')](_0x435789);_0x3168d1['offset'](0x0);logger[_0x493f('0x81')](_0x493f('0x82'),_0x3168d1[_0x493f('0x83')]());return dbH[_0x493f('0x84')][_0x493f('0x34')](_0x3168d1['toString'](),{'type':dbH[_0x493f('0x84')][_0x493f('0x85')]['SELECT']});}})['then'](function(){return{'sql':_0x5abf64['toString']()};})[_0x493f('0x25')](respondWithResult(_0x1138da,null))[_0x493f('0x48')](handleError(_0x1138da,null));}; \ No newline at end of file +var _0xba94=['group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(%s)','IS\x20NOT\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','DESC','parentKey','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','fieldName','key','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','merge','find','catch','create','body','get','role','user','Reports','UserProfileSection','preview','join','left_join','right_join','cross_join','SUM(%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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator'];(function(_0x561aea,_0x1f3a48){var _0x7e5dbb=function(_0x24d79b){while(--_0x24d79b){_0x561aea['push'](_0x561aea['shift']());}};_0x7e5dbb(++_0x1f3a48);}(_0xba94,0xe3));var _0x4ba9=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xba94[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require(_0x4ba9('0x0'));var rimraf=require(_0x4ba9('0x1'));var zipdir=require(_0x4ba9('0x2'));var jsonpatch=require(_0x4ba9('0x3'));var rp=require('request-promise');var moment=require(_0x4ba9('0x4'));var BPromise=require(_0x4ba9('0x5'));var Mustache=require(_0x4ba9('0x6'));var util=require(_0x4ba9('0x7'));var path=require('path');var sox=require(_0x4ba9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ba9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ba9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4ba9('0xb'));var querystring=require(_0x4ba9('0xc'));var Papa=require('papaparse');var Redis=require(_0x4ba9('0xd'));var authService=require(_0x4ba9('0xe'));var qs=require(_0x4ba9('0xf'));var as=require(_0x4ba9('0x10'));var hardwareService=require(_0x4ba9('0x11'));var logger=require(_0x4ba9('0x12'))(_0x4ba9('0x13'));var utils=require(_0x4ba9('0x14'));var config=require(_0x4ba9('0x15'));var licenseUtil=require(_0x4ba9('0x16'));var db=require(_0x4ba9('0x17'))['db'];var dbH=require(_0x4ba9('0x17'))[_0x4ba9('0x18')];function respondWithStatusCode(_0x23a998,_0x8eed89){_0x8eed89=_0x8eed89||0xcc;return function(_0x41c884){if(_0x41c884){return _0x23a998[_0x4ba9('0x19')](_0x8eed89);}return _0x23a998[_0x4ba9('0x1a')](_0x8eed89)[_0x4ba9('0x1b')]();};}function respondWithResult(_0x5923e3,_0x298600){_0x298600=_0x298600||0xc8;return function(_0x18b20a){if(_0x18b20a){return _0x5923e3[_0x4ba9('0x1a')](_0x298600)[_0x4ba9('0x1c')](_0x18b20a);}};}function respondWithFilteredResult(_0x46d6a8,_0x3e22fc){return function(_0x577d69){if(_0x577d69){var _0x530ad8=typeof _0x3e22fc[_0x4ba9('0x1d')]===_0x4ba9('0x1e')&&typeof _0x3e22fc[_0x4ba9('0x1f')]===_0x4ba9('0x1e');var _0x116424=_0x577d69[_0x4ba9('0x20')];var _0x4adb56=_0x530ad8?0x0:_0x3e22fc[_0x4ba9('0x1d')];var _0x1ea302=_0x530ad8?_0x577d69['count']:_0x3e22fc['offset']+_0x3e22fc[_0x4ba9('0x1f')];var _0x4b049d;if(_0x1ea302>=_0x116424){_0x1ea302=_0x116424;_0x4b049d=0xc8;}else{_0x4b049d=0xce;}_0x46d6a8[_0x4ba9('0x1a')](_0x4b049d);return _0x46d6a8['set'](_0x4ba9('0x21'),_0x4adb56+'-'+_0x1ea302+'/'+_0x116424)[_0x4ba9('0x1c')](_0x577d69);}return null;};}function patchUpdates(_0x365cf4){return function(_0x3f3210){try{jsonpatch[_0x4ba9('0x22')](_0x3f3210,_0x365cf4,!![]);}catch(_0x2fda4b){return BPromise[_0x4ba9('0x23')](_0x2fda4b);}return _0x3f3210[_0x4ba9('0x24')]();};}function saveUpdates(_0x1c97ca,_0x3c3bcc){return function(_0x18394c){if(_0x18394c){return _0x18394c[_0x4ba9('0x25')](_0x1c97ca)['then'](function(_0x7eb9ab){return _0x7eb9ab;});}return null;};}function removeEntity(_0x47c3e6,_0x539de4){return function(_0x6c0125){if(_0x6c0125){return _0x6c0125[_0x4ba9('0x26')]()[_0x4ba9('0x27')](function(){var _0xa11b9c=_0x6c0125['get']({'plain':!![]});var _0x4f529d='CustomReports';return db[_0x4ba9('0x28')][_0x4ba9('0x26')]({'where':{'type':_0x4f529d,'resourceId':_0xa11b9c['id']}})[_0x4ba9('0x27')](function(){return _0x6c0125;});})['then'](function(){_0x47c3e6[_0x4ba9('0x1a')](0xcc)[_0x4ba9('0x1b')]();});}};}function handleEntityNotFound(_0x1dfb8f,_0x5ca0a0){return function(_0x7b9fe0){if(!_0x7b9fe0){_0x1dfb8f[_0x4ba9('0x19')](0x194);}return _0x7b9fe0;};}function handleError(_0x97306d,_0x854ff4){_0x854ff4=_0x854ff4||0x1f4;return function(_0x50527e){logger[_0x4ba9('0x29')](_0x50527e[_0x4ba9('0x2a')]);if(_0x50527e[_0x4ba9('0x2b')]){delete _0x50527e[_0x4ba9('0x2b')];}_0x97306d[_0x4ba9('0x1a')](_0x854ff4)[_0x4ba9('0x2c')](_0x50527e);};}exports[_0x4ba9('0x2d')]=function(_0x442c79,_0x439a3b){var _0x349bde={},_0x3c6670={},_0x13e218={'count':0x0,'rows':[]};var _0x59b7c2=_['map'](db[_0x4ba9('0x2e')]['rawAttributes'],function(_0x24c3ff){return{'name':_0x24c3ff[_0x4ba9('0x2f')],'type':_0x24c3ff['type'][_0x4ba9('0x30')]};});_0x3c6670[_0x4ba9('0x31')]=_[_0x4ba9('0x32')](_0x59b7c2,_0x4ba9('0x2b'));_0x3c6670['query']=_['keys'](_0x442c79[_0x4ba9('0x33')]);_0x3c6670[_0x4ba9('0x34')]=_[_0x4ba9('0x35')](_0x3c6670[_0x4ba9('0x31')],_0x3c6670[_0x4ba9('0x33')]);_0x349bde['attributes']=_[_0x4ba9('0x35')](_0x3c6670[_0x4ba9('0x31')],qs[_0x4ba9('0x36')](_0x442c79[_0x4ba9('0x33')][_0x4ba9('0x36')]));_0x349bde['attributes']=_0x349bde['attributes'][_0x4ba9('0x37')]?_0x349bde[_0x4ba9('0x38')]:_0x3c6670['model'];if(!_0x442c79[_0x4ba9('0x33')][_0x4ba9('0x39')](_0x4ba9('0x3a'))){_0x349bde[_0x4ba9('0x1f')]=qs[_0x4ba9('0x1f')](_0x442c79[_0x4ba9('0x33')]['limit']);_0x349bde['offset']=qs['offset'](_0x442c79['query'][_0x4ba9('0x1d')]);}_0x349bde[_0x4ba9('0x3b')]=qs['sort'](_0x442c79[_0x4ba9('0x33')]['sort']);_0x349bde[_0x4ba9('0x3c')]=qs[_0x4ba9('0x34')](_[_0x4ba9('0x3d')](_0x442c79[_0x4ba9('0x33')],_0x3c6670[_0x4ba9('0x34')]),_0x59b7c2);if(_0x442c79[_0x4ba9('0x33')][_0x4ba9('0x3e')]){_0x349bde[_0x4ba9('0x3c')]=_['merge'](_0x349bde[_0x4ba9('0x3c')],{'$or':_[_0x4ba9('0x32')](_0x59b7c2,function(_0x213d83){if(_0x213d83[_0x4ba9('0x3f')]!==_0x4ba9('0x40')){var _0x46b41b={};_0x46b41b[_0x213d83[_0x4ba9('0x2b')]]={'$like':'%'+_0x442c79['query']['filter']+'%'};return _0x46b41b;}})});}_0x349bde=_['merge']({},_0x349bde,_0x442c79[_0x4ba9('0x41')]);var _0x141c24={'where':_0x349bde[_0x4ba9('0x3c')]};return db[_0x4ba9('0x2e')][_0x4ba9('0x20')](_0x141c24)['then'](function(_0x399527){_0x13e218[_0x4ba9('0x20')]=_0x399527;if(_0x442c79[_0x4ba9('0x33')][_0x4ba9('0x42')]){_0x349bde[_0x4ba9('0x43')]=[{'all':!![]}];}return db[_0x4ba9('0x2e')][_0x4ba9('0x44')](_0x349bde);})['then'](function(_0x2c5e11){_0x13e218[_0x4ba9('0x45')]=_0x2c5e11;return _0x13e218;})['then'](respondWithFilteredResult(_0x439a3b,_0x349bde))['catch'](handleError(_0x439a3b,null));};exports[_0x4ba9('0x46')]=function(_0x25a974,_0x213595){var _0x53d5db={'raw':![],'where':{'id':_0x25a974[_0x4ba9('0x47')]['id']}},_0x5440c7={};_0x5440c7[_0x4ba9('0x31')]=_[_0x4ba9('0x48')](db[_0x4ba9('0x2e')][_0x4ba9('0x49')]);_0x5440c7[_0x4ba9('0x33')]=_[_0x4ba9('0x48')](_0x25a974[_0x4ba9('0x33')]);_0x5440c7[_0x4ba9('0x34')]=_[_0x4ba9('0x35')](_0x5440c7[_0x4ba9('0x31')],_0x5440c7[_0x4ba9('0x33')]);_0x53d5db[_0x4ba9('0x38')]=_[_0x4ba9('0x35')](_0x5440c7['model'],qs[_0x4ba9('0x36')](_0x25a974['query']['fields']));_0x53d5db['attributes']=_0x53d5db[_0x4ba9('0x38')][_0x4ba9('0x37')]?_0x53d5db[_0x4ba9('0x38')]:_0x5440c7[_0x4ba9('0x31')];if(_0x25a974[_0x4ba9('0x33')][_0x4ba9('0x42')]){_0x53d5db[_0x4ba9('0x43')]=[{'all':!![]}];}_0x53d5db=_[_0x4ba9('0x4a')]({},_0x53d5db,_0x25a974[_0x4ba9('0x41')]);return db[_0x4ba9('0x2e')][_0x4ba9('0x4b')](_0x53d5db)[_0x4ba9('0x27')](handleEntityNotFound(_0x213595,null))[_0x4ba9('0x27')](respondWithResult(_0x213595,null))[_0x4ba9('0x4c')](handleError(_0x213595,null));};exports[_0x4ba9('0x4d')]=function(_0x41f323,_0x4031a8){return db[_0x4ba9('0x2e')]['create'](_0x41f323[_0x4ba9('0x4e')],{})['then'](function(_0x441205){var _0x49eff7=_0x41f323['user'][_0x4ba9('0x4f')]({'plain':!![]});if(!_0x49eff7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49eff7[_0x4ba9('0x50')]===_0x4ba9('0x51')){var _0x47ce71=_0x441205[_0x4ba9('0x4f')]({'plain':!![]});var _0x5063e9=_0x4ba9('0x52');return db[_0x4ba9('0x53')][_0x4ba9('0x4b')]({'where':{'name':_0x5063e9,'userProfileId':_0x49eff7['userProfileId']},'raw':!![]})['then'](function(_0x24c520){if(_0x24c520&&_0x24c520['autoAssociation']===0x0){return db[_0x4ba9('0x28')][_0x4ba9('0x4d')]({'name':_0x47ce71['name'],'resourceId':_0x47ce71['id'],'type':'CustomReports','sectionId':_0x24c520['id']},{})[_0x4ba9('0x27')](function(){return _0x441205;});}else{return _0x441205;}})[_0x4ba9('0x4c')](function(_0x4580c6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4580c6);throw _0x4580c6;});}return _0x441205;})[_0x4ba9('0x27')](respondWithResult(_0x4031a8,0xc9))[_0x4ba9('0x4c')](handleError(_0x4031a8,null));};exports['update']=function(_0x56a545,_0x54f2d8){if(_0x56a545[_0x4ba9('0x4e')]['id']){delete _0x56a545[_0x4ba9('0x4e')]['id'];}return db[_0x4ba9('0x2e')]['find']({'where':{'id':_0x56a545[_0x4ba9('0x47')]['id']}})[_0x4ba9('0x27')](handleEntityNotFound(_0x54f2d8,null))['then'](saveUpdates(_0x56a545[_0x4ba9('0x4e')],null))[_0x4ba9('0x27')](respondWithResult(_0x54f2d8,null))[_0x4ba9('0x4c')](handleError(_0x54f2d8,null));};exports['destroy']=function(_0x560ae8,_0x4fd267){return db[_0x4ba9('0x2e')][_0x4ba9('0x4b')]({'where':{'id':_0x560ae8[_0x4ba9('0x47')]['id']}})['then'](handleEntityNotFound(_0x4fd267,null))[_0x4ba9('0x27')](removeEntity(_0x4fd267,null))[_0x4ba9('0x4c')](handleError(_0x4fd267,null));};exports[_0x4ba9('0x54')]=function(_0x5c68e5,_0x164ab0){var _0x1401d4=0xa;var _0x22defb=[_0x4ba9('0x55'),_0x4ba9('0x56'),_0x4ba9('0x57'),_0x4ba9('0x58')];var _0x40c5a1={'SUM':_0x4ba9('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba9('0x5a'),'MAX':_0x4ba9('0x5b'),'MIN':_0x4ba9('0x5c'),'AVG':_0x4ba9('0x5d'),'GROUP_CONCAT':_0x4ba9('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba9('0x5f')};var _0x5a36c4={'SEC_TO_TIME':_0x4ba9('0x60'),'DATE':_0x4ba9('0x61'),'HOUR':_0x4ba9('0x62'),'ROUND':_0x4ba9('0x63'),'UNIX_TIMESTAMP':_0x4ba9('0x64')};var _0x3196c5=function(_0x2c9276){return!_[_0x4ba9('0x65')]([_0x4ba9('0x66'),_0x4ba9('0x67'),_0x4ba9('0x68'),'IS\x20NOT\x20EMPTY'],_0x2c9276);};var _0x222d8c=function(_0x1b3200){if(!_0x1b3200||!_0x1b3200[_0x4ba9('0x69')][_0x4ba9('0x37')]){return'';}for(var _0x22bad9='(',_0x1504c1=0x0;_0x1504c1<_0x1b3200[_0x4ba9('0x69')][_0x4ba9('0x37')];_0x1504c1+=0x1){_0x1504c1>0x0&&(_0x22bad9+='\x20'+_0x1b3200[_0x4ba9('0x6a')]+'\x20');_0x22bad9+=_0x1b3200[_0x4ba9('0x69')][_0x1504c1][_0x4ba9('0x6b')]?_0x222d8c(_0x1b3200[_0x4ba9('0x69')][_0x1504c1][_0x4ba9('0x6b')]):_0x1b3200[_0x4ba9('0x69')][_0x1504c1][_0x4ba9('0x6c')]+'\x20'+_0x1b3200[_0x4ba9('0x69')][_0x1504c1][_0x4ba9('0x6d')]+(_0x3196c5(_0x1b3200[_0x4ba9('0x69')][_0x1504c1][_0x4ba9('0x6d')])?'\x20'+_0x1b3200[_0x4ba9('0x69')][_0x1504c1][_0x4ba9('0x6e')]:'');}return _0x22bad9+')';};var _0xffc10b={'where':{'id':_0x5c68e5['params']['id']}},_0x461fa6,_0x37b2a5,_0x22e246,_0xc78d51,_0x2d75b8;_0xffc10b=_[_0x4ba9('0x4a')]({},_0xffc10b,_0x5c68e5['options']);return db[_0x4ba9('0x2e')][_0x4ba9('0x4b')](_0xffc10b)[_0x4ba9('0x27')](function(_0x34747b){if(_0x34747b){_0x461fa6=_0x34747b;return _0x34747b[_0x4ba9('0x6f')]();}return null;})[_0x4ba9('0x27')](function(_0x42540f){if(_0x42540f){if(!_0x42540f['length']){throw new db[(_0x4ba9('0x70'))][(_0x4ba9('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x37b2a5=_0x42540f;return db[_0x4ba9('0x72')][_0x4ba9('0x44')]({'raw':!![]});}return null;})['then'](function(_0x2e0f04){if(_0x2e0f04){_0x22e246=_[_0x4ba9('0x73')](_0x2e0f04,'id');var _0x62159;var _0x434ea2=squel[_0x4ba9('0x74')]();_0x434ea2[_0x4ba9('0x75')](_0x461fa6[_0x4ba9('0x76')]);for(var _0x1761a8=0x0;_0x1761a8<_0x37b2a5[_0x4ba9('0x37')];_0x1761a8+=0x1){_0x62159=_0x37b2a5[_0x1761a8][_0x4ba9('0x77')]?_0x22e246[_0x37b2a5[_0x1761a8][_0x4ba9('0x77')]][_0x4ba9('0x78')]:_0x37b2a5[_0x1761a8][_0x4ba9('0x6c')];_0x62159=_0x37b2a5[_0x1761a8][_0x4ba9('0x79')]?_['replace'](_0x40c5a1[_0x37b2a5[_0x1761a8][_0x4ba9('0x79')]],'%s',_0x62159):_0x62159;_0x62159=_0x37b2a5[_0x1761a8][_0x4ba9('0x7a')]?_[_0x4ba9('0x7b')](_0x5a36c4[_0x37b2a5[_0x1761a8][_0x4ba9('0x7a')]],'%s',_0x62159):_0x62159;if(_0x37b2a5[_0x1761a8][_0x4ba9('0x7c')]){_0x434ea2[_0x4ba9('0x6b')](_0x62159);}_0x37b2a5[_0x1761a8][_0x4ba9('0x7d')]&&_0x434ea2[_0x4ba9('0x3b')](_0x62159,_0x37b2a5[_0x1761a8]['orderBy']==='DESC'?![]:!![]);_0x434ea2[_0x4ba9('0x6c')](_0x62159,_0x37b2a5[_0x1761a8][_0x4ba9('0x7e')]||_0x62159);}if(_0x461fa6['joins']){_0x461fa6[_0x4ba9('0x7f')]=JSON[_0x4ba9('0x80')](_0x461fa6[_0x4ba9('0x7f')]);for(var _0x278f70=0x0;_0x278f70<_0x461fa6['joins']['length'];_0x278f70+=0x1){if(_0x461fa6[_0x4ba9('0x7f')][_0x278f70]['type']&&_['includes'](_0x22defb,_0x461fa6[_0x4ba9('0x7f')][_0x278f70]['type'])&&_0x461fa6[_0x4ba9('0x7f')][_0x278f70]['parentKey']&&_0x461fa6[_0x4ba9('0x7f')][_0x278f70][_0x4ba9('0x81')]&&_0x461fa6['joins'][_0x278f70][_0x4ba9('0x82')]){_0x434ea2[_0x461fa6['joins'][_0x278f70]['type']](_0x461fa6[_0x4ba9('0x7f')][_0x278f70][_0x4ba9('0x81')],null,util[_0x4ba9('0x7a')](_0x4ba9('0x83'),_0x461fa6[_0x4ba9('0x76')],_0x461fa6[_0x4ba9('0x7f')][_0x278f70]['parentKey'],_0x461fa6[_0x4ba9('0x7f')][_0x278f70]['foreignTable'],_0x461fa6[_0x4ba9('0x7f')][_0x278f70][_0x4ba9('0x82')]));}}}if(_0x461fa6[_0x4ba9('0x84')]){_0x461fa6['conditions']=JSON['parse'](_0x461fa6[_0x4ba9('0x84')]);_0x434ea2[_0x4ba9('0x3c')](_0x222d8c(_0x461fa6[_0x4ba9('0x84')][_0x4ba9('0x6b')]));}_0x2d75b8=_0x434ea2[_0x4ba9('0x85')]();_0x434ea2['limit'](_0x1401d4);_0x434ea2[_0x4ba9('0x1d')](0x0);logger['debug'](_0x4ba9('0x86'),_0x434ea2['toString']());return dbH[_0x4ba9('0x87')][_0x4ba9('0x33')](_0x434ea2[_0x4ba9('0x88')](),{'type':dbH['sequelize'][_0x4ba9('0x89')]['SELECT']});}})[_0x4ba9('0x27')](respondWithResult(_0x164ab0,null))[_0x4ba9('0x4c')](handleError(_0x164ab0,null));};function runReport(_0x19716d,_0x5cba0e,_0x79d406){var _0x1f2353=_0x5cba0e[_0x4ba9('0x2b')];var _0x516022=0xa;var _0x267741=[_0x4ba9('0x55'),_0x4ba9('0x56'),_0x4ba9('0x57'),_0x4ba9('0x58')];var _0x492ab0={'SUM':_0x4ba9('0x59'),'COUNT':_0x4ba9('0x8a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x4ba9('0x5b'),'MIN':'MIN(%s)','AVG':_0x4ba9('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba9('0x5f')};var _0x54e3b0={'SEC_TO_TIME':_0x4ba9('0x60'),'DATE':'DATE(%s)','HOUR':_0x4ba9('0x62'),'ROUND':_0x4ba9('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2e5561=function(_0x34f2b3){return!_[_0x4ba9('0x65')]([_0x4ba9('0x66'),_0x4ba9('0x67'),_0x4ba9('0x68'),_0x4ba9('0x8b')],_0x34f2b3);};var _0x32bc92=function(_0x57cfa7){if(!_0x57cfa7||!_0x57cfa7[_0x4ba9('0x69')][_0x4ba9('0x37')]){return'';}for(var _0x133b07='(',_0x24df33=0x0;_0x24df33<_0x57cfa7['rules'][_0x4ba9('0x37')];_0x24df33+=0x1){_0x24df33>0x0&&(_0x133b07+='\x20'+_0x57cfa7['operator']+'\x20');_0x133b07+=_0x57cfa7[_0x4ba9('0x69')][_0x24df33][_0x4ba9('0x6b')]?_0x32bc92(_0x57cfa7[_0x4ba9('0x69')][_0x24df33]['group']):_0x57cfa7[_0x4ba9('0x69')][_0x24df33]['field']+'\x20'+_0x57cfa7[_0x4ba9('0x69')][_0x24df33]['condition']+(_0x2e5561(_0x57cfa7[_0x4ba9('0x69')][_0x24df33][_0x4ba9('0x6d')])?'\x20'+_0x57cfa7[_0x4ba9('0x69')][_0x24df33][_0x4ba9('0x6e')]:'');}return _0x133b07+')';};var _0x1377f9={'where':{'id':_0x19716d['id']}},_0x399878,_0x1869a0,_0x2c974e,_0x35efef,_0xf9408b;_0x1377f9=_[_0x4ba9('0x4a')]({},_0x1377f9,_0x79d406);return db['AnalyticCustomReport']['find'](_0x1377f9)[_0x4ba9('0x27')](function(_0x1b7549){if(_0x1b7549){_0x399878=_0x1b7549;return _0x1b7549['getFields']();}return null;})[_0x4ba9('0x27')](function(_0x50f8dd){if(_0x50f8dd){if(!_0x50f8dd[_0x4ba9('0x37')]){throw new db[(_0x4ba9('0x70'))]['ValidationErrorItem'](_0x4ba9('0x8c'),0x193);}_0x1869a0=_0x50f8dd;return db['AnalyticMetric'][_0x4ba9('0x44')]({'raw':!![]});}return null;})[_0x4ba9('0x27')](function(_0xb59654){if(_0xb59654){_0x2c974e=_[_0x4ba9('0x73')](_0xb59654,'id');var _0x2b63c4;var _0xd19d39=squel[_0x4ba9('0x74')]();_0xd19d39[_0x4ba9('0x75')](_0x399878['table']);for(var _0x30b77b=0x0;_0x30b77b<_0x1869a0[_0x4ba9('0x37')];_0x30b77b+=0x1){_0x2b63c4=_0x1869a0[_0x30b77b][_0x4ba9('0x77')]?_0x2c974e[_0x1869a0[_0x30b77b][_0x4ba9('0x77')]][_0x4ba9('0x78')]:_0x1869a0[_0x30b77b]['field'];_0x2b63c4=_0x1869a0[_0x30b77b]['function']?_[_0x4ba9('0x7b')](_0x492ab0[_0x1869a0[_0x30b77b]['function']],'%s',_0x2b63c4):_0x2b63c4;_0x2b63c4=_0x1869a0[_0x30b77b]['format']?_[_0x4ba9('0x7b')](_0x54e3b0[_0x1869a0[_0x30b77b][_0x4ba9('0x7a')]],'%s',_0x2b63c4):_0x2b63c4;if(_0x1869a0[_0x30b77b][_0x4ba9('0x7c')]){_0xd19d39[_0x4ba9('0x6b')](_0x2b63c4);}_0x1869a0[_0x30b77b]['orderBy']&&_0xd19d39['order'](_0x2b63c4,_0x1869a0[_0x30b77b][_0x4ba9('0x7d')]===_0x4ba9('0x8d')?![]:!![]);_0xd19d39[_0x4ba9('0x6c')](_0x2b63c4,_0x1869a0[_0x30b77b][_0x4ba9('0x7e')]||_0x2b63c4);}if(_0x399878['joins']){_0x399878[_0x4ba9('0x7f')]=JSON[_0x4ba9('0x80')](_0x399878[_0x4ba9('0x7f')]);for(var _0x557293=0x0;_0x557293<_0x399878[_0x4ba9('0x7f')][_0x4ba9('0x37')];_0x557293+=0x1){if(_0x399878[_0x4ba9('0x7f')][_0x557293]['type']&&_[_0x4ba9('0x65')](_0x267741,_0x399878[_0x4ba9('0x7f')][_0x557293][_0x4ba9('0x3f')])&&_0x399878[_0x4ba9('0x7f')][_0x557293][_0x4ba9('0x8e')]&&_0x399878[_0x4ba9('0x7f')][_0x557293][_0x4ba9('0x81')]&&_0x399878[_0x4ba9('0x7f')][_0x557293][_0x4ba9('0x82')]){_0xd19d39[_0x399878['joins'][_0x557293][_0x4ba9('0x3f')]](_0x399878[_0x4ba9('0x7f')][_0x557293][_0x4ba9('0x81')],null,util[_0x4ba9('0x7a')](_0x4ba9('0x83'),_0x399878['table'],_0x399878[_0x4ba9('0x7f')][_0x557293]['parentKey'],_0x399878[_0x4ba9('0x7f')][_0x557293][_0x4ba9('0x81')],_0x399878[_0x4ba9('0x7f')][_0x557293]['foreignKey']));}}}if(_0x399878['conditions']){_0x399878[_0x4ba9('0x84')]=JSON[_0x4ba9('0x80')](_0x399878[_0x4ba9('0x84')]);_0xd19d39[_0x4ba9('0x3c')](_0x32bc92(_0x399878[_0x4ba9('0x84')]['group']));}_0xf9408b=_0xd19d39[_0x4ba9('0x85')]();_0xd19d39[_0x4ba9('0x1f')](_0x516022);_0xd19d39['offset'](0x0);return;}})[_0x4ba9('0x27')](function(){if(_0x5cba0e[_0x4ba9('0x8f')]===_0x4ba9('0x90')){return null;}var _0x41aaa9=_[_0x4ba9('0x4a')](_0x5cba0e,{'name':_0x5cba0e[_0x4ba9('0x91')]||_0x5cba0e[_0x4ba9('0x2b')]||_0x399878['name'],'basename':_0x1f2353,'savename':util['format'](_0x4ba9('0x92'),_0x5cba0e[_0x4ba9('0x2b')]||_0x399878[_0x4ba9('0x2b')],require(_0x4ba9('0x93'))[_0x4ba9('0x94')](0x4),_0x5cba0e['output']||_0x4ba9('0x95')),'reportId':_0x399878['id'],'reportType':_0x4ba9('0x96')});return db['AnalyticExtractedReport'][_0x4ba9('0x4d')](_0x41aaa9,{'raw':!![]});})[_0x4ba9('0x27')](function(_0x45d0b5){if(_0x399878[_0x4ba9('0x76')]===_0x4ba9('0x97')){_0xf9408b[_0x4ba9('0x3c')](_0x399878[_0x4ba9('0x76')]+_0x4ba9('0x98'),_0x5cba0e[_0x4ba9('0x99')],_0x5cba0e['endDate']);}else{_0xf9408b['where'](_0x399878['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5cba0e['startDate'],_0x5cba0e[_0x4ba9('0x9a')]);}if(_0x45d0b5){logger[_0x4ba9('0x9b')]('Run\x20Query:',_0xf9408b[_0x4ba9('0x88')]());require(_0x4ba9('0x9c'))[_0x4ba9('0x9d')](path[_0x4ba9('0x55')](__dirname,_0x4ba9('0x9e'),_0x45d0b5[_0x4ba9('0x8f')]),[_0x45d0b5['id'],_0xf9408b[_0x4ba9('0x88')](),path['join'](__dirname,_0x4ba9('0x9f'),_0x45d0b5[_0x4ba9('0xa0')]),_0x1f2353]);return _0x45d0b5;}else{var _0x59ec35=squel['select']();_0x59ec35[_0x4ba9('0x75')]('('+_0xf9408b[_0x4ba9('0x88')]()+')',_0x4ba9('0xa1'));_0x59ec35[_0x4ba9('0x6c')](_0x4ba9('0xa2'),_0x4ba9('0x20'));_0xf9408b['limit'](_0x5cba0e[_0x4ba9('0x1f')]||_0x516022);_0xf9408b[_0x4ba9('0x1d')](_0x5cba0e[_0x4ba9('0x1d')]||0x0);return dbH[_0x4ba9('0x87')][_0x4ba9('0x33')](_0x59ec35[_0x4ba9('0x88')](),{'type':dbH[_0x4ba9('0x87')]['QueryTypes']['SELECT']})[_0x4ba9('0x27')](function(_0x1872a2){if(!_0x1872a2[_0x4ba9('0x37')]){_0x35efef=0x0;}else{_0x35efef=_0x1872a2[0x0][_0x4ba9('0x20')]||0x0;}return dbH[_0x4ba9('0x87')][_0x4ba9('0x33')](_0xf9408b[_0x4ba9('0x88')](),{'type':dbH[_0x4ba9('0x87')][_0x4ba9('0x89')][_0x4ba9('0xa3')]});})[_0x4ba9('0x27')](function(_0x2717ab){return{'rows':_0x2717ab||[],'count':_0x35efef};});}});}exports[_0x4ba9('0xa4')]=function(_0x5b35b,_0x5a3ab5){return runReport(_0x5b35b[_0x4ba9('0x47')],_0x5b35b[_0x4ba9('0x33')],_0x5b35b['options'])[_0x4ba9('0x27')](respondWithResult(_0x5a3ab5,null))['catch'](handleError(_0x5a3ab5,null));};exports[_0x4ba9('0xa5')]=runReport;exports['query']=function(_0x44b7ad,_0xb7a41c){var _0x1524ce=0xa;var _0x29d2f0=[_0x4ba9('0x55'),_0x4ba9('0x56'),_0x4ba9('0x57'),_0x4ba9('0x58')];var _0x1b3648={'SUM':_0x4ba9('0x59'),'COUNT':_0x4ba9('0x8a'),'COUNT DISTINCT':_0x4ba9('0x5a'),'MAX':_0x4ba9('0x5b'),'MIN':'MIN(%s)','AVG':_0x4ba9('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba9('0x5f')};var _0x4d16d3={'SEC_TO_TIME':_0x4ba9('0x60'),'DATE':_0x4ba9('0x61'),'HOUR':_0x4ba9('0x62'),'ROUND':_0x4ba9('0x63'),'UNIX_TIMESTAMP':_0x4ba9('0x64')};var _0x38e1c4=function(_0x497379){return!_[_0x4ba9('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x4ba9('0x68'),_0x4ba9('0x8b')],_0x497379);};var _0x297d89=function(_0x75afad){if(!_0x75afad||!_0x75afad[_0x4ba9('0x69')]['length']){return'';}for(var _0x58fcf5='(',_0x577fa8=0x0;_0x577fa8<_0x75afad['rules'][_0x4ba9('0x37')];_0x577fa8+=0x1){_0x577fa8>0x0&&(_0x58fcf5+='\x20'+_0x75afad[_0x4ba9('0x6a')]+'\x20');_0x58fcf5+=_0x75afad[_0x4ba9('0x69')][_0x577fa8][_0x4ba9('0x6b')]?_0x297d89(_0x75afad[_0x4ba9('0x69')][_0x577fa8][_0x4ba9('0x6b')]):_0x75afad[_0x4ba9('0x69')][_0x577fa8][_0x4ba9('0x6c')]+'\x20'+_0x75afad[_0x4ba9('0x69')][_0x577fa8]['condition']+(_0x38e1c4(_0x75afad[_0x4ba9('0x69')][_0x577fa8][_0x4ba9('0x6d')])?'\x20'+_0x75afad[_0x4ba9('0x69')][_0x577fa8]['value']:'');}return _0x58fcf5+')';};var _0x4e5df0={'where':{'id':_0x44b7ad[_0x4ba9('0x47')]['id']}},_0x141f5f,_0xe46bfa,_0x2d61a6,_0x1deda6,_0x39af1f;_0x4e5df0=_[_0x4ba9('0x4a')]({},_0x4e5df0,_0x44b7ad['options']);return db[_0x4ba9('0x2e')][_0x4ba9('0x4b')](_0x4e5df0)['then'](function(_0x37ba4d){if(_0x37ba4d){_0x141f5f=_0x37ba4d;return _0x37ba4d[_0x4ba9('0x6f')]();}return null;})[_0x4ba9('0x27')](function(_0x4db414){if(_0x4db414){if(!_0x4db414[_0x4ba9('0x37')]){throw new db[(_0x4ba9('0x70'))]['ValidationErrorItem'](_0x4ba9('0x8c'),0x193);}_0xe46bfa=_0x4db414;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba9('0x27')](function(_0x50471f){if(_0x50471f){_0x2d61a6=_[_0x4ba9('0x73')](_0x50471f,'id');var _0x337e77;var _0x17dc0f=squel[_0x4ba9('0x74')]();_0x17dc0f[_0x4ba9('0x75')](_0x141f5f[_0x4ba9('0x76')]);for(var _0x54a47c=0x0;_0x54a47c<_0xe46bfa[_0x4ba9('0x37')];_0x54a47c+=0x1){_0x337e77=_0xe46bfa[_0x54a47c][_0x4ba9('0x77')]?_0x2d61a6[_0xe46bfa[_0x54a47c][_0x4ba9('0x77')]][_0x4ba9('0x78')]:_0xe46bfa[_0x54a47c][_0x4ba9('0x6c')];_0x337e77=_0xe46bfa[_0x54a47c][_0x4ba9('0x79')]?_[_0x4ba9('0x7b')](_0x1b3648[_0xe46bfa[_0x54a47c][_0x4ba9('0x79')]],'%s',_0x337e77):_0x337e77;_0x337e77=_0xe46bfa[_0x54a47c][_0x4ba9('0x7a')]?_[_0x4ba9('0x7b')](_0x4d16d3[_0xe46bfa[_0x54a47c][_0x4ba9('0x7a')]],'%s',_0x337e77):_0x337e77;if(_0xe46bfa[_0x54a47c][_0x4ba9('0x7c')]){_0x17dc0f[_0x4ba9('0x6b')](_0x337e77);}_0xe46bfa[_0x54a47c]['orderBy']&&_0x17dc0f[_0x4ba9('0x3b')](_0x337e77,_0xe46bfa[_0x54a47c][_0x4ba9('0x7d')]===_0x4ba9('0x8d')?![]:!![]);_0x17dc0f[_0x4ba9('0x6c')](_0x337e77,_0xe46bfa[_0x54a47c][_0x4ba9('0x7e')]||_0x337e77);}if(_0x141f5f[_0x4ba9('0x7f')]){_0x141f5f[_0x4ba9('0x7f')]=JSON[_0x4ba9('0x80')](_0x141f5f['joins']);for(var _0x23d859=0x0;_0x23d859<_0x141f5f['joins'][_0x4ba9('0x37')];_0x23d859+=0x1){if(_0x141f5f['joins'][_0x23d859][_0x4ba9('0x3f')]&&_['includes'](_0x29d2f0,_0x141f5f[_0x4ba9('0x7f')][_0x23d859][_0x4ba9('0x3f')])&&_0x141f5f[_0x4ba9('0x7f')][_0x23d859][_0x4ba9('0x8e')]&&_0x141f5f[_0x4ba9('0x7f')][_0x23d859][_0x4ba9('0x81')]&&_0x141f5f['joins'][_0x23d859][_0x4ba9('0x82')]){_0x17dc0f[_0x141f5f[_0x4ba9('0x7f')][_0x23d859][_0x4ba9('0x3f')]](_0x141f5f[_0x4ba9('0x7f')][_0x23d859][_0x4ba9('0x81')],null,util[_0x4ba9('0x7a')](_0x4ba9('0x83'),_0x141f5f['table'],_0x141f5f[_0x4ba9('0x7f')][_0x23d859]['parentKey'],_0x141f5f[_0x4ba9('0x7f')][_0x23d859][_0x4ba9('0x81')],_0x141f5f[_0x4ba9('0x7f')][_0x23d859][_0x4ba9('0x82')]));}}}if(_0x141f5f[_0x4ba9('0x84')]){_0x141f5f[_0x4ba9('0x84')]=JSON[_0x4ba9('0x80')](_0x141f5f[_0x4ba9('0x84')]);_0x17dc0f[_0x4ba9('0x3c')](_0x297d89(_0x141f5f['conditions'][_0x4ba9('0x6b')]));}_0x39af1f=_0x17dc0f[_0x4ba9('0x85')]();_0x17dc0f[_0x4ba9('0x1f')](_0x1524ce);_0x17dc0f[_0x4ba9('0x1d')](0x0);logger[_0x4ba9('0xa6')](_0x4ba9('0x86'),_0x17dc0f['toString']());return dbH[_0x4ba9('0x87')]['query'](_0x17dc0f['toString'](),{'type':dbH[_0x4ba9('0x87')][_0x4ba9('0x89')][_0x4ba9('0xa3')]});}})[_0x4ba9('0x27')](function(){return{'sql':_0x39af1f[_0x4ba9('0x88')]()};})[_0x4ba9('0x27')](respondWithResult(_0xb7a41c,null))[_0x4ba9('0x4c')](handleError(_0xb7a41c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 635aa01..4e75f52 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 _0x1052=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x4e8099,_0x1372ed){var _0x535f9e=function(_0x5238c4){while(--_0x5238c4){_0x4e8099['push'](_0x4e8099['shift']());}};_0x535f9e(++_0x1372ed);}(_0x1052,0x168));var _0x2105=function(_0x4c8779,_0x399ca4){_0x4c8779=_0x4c8779-0x0;var _0x55a207=_0x1052[_0x4c8779];return _0x55a207;};'use strict';var _=require(_0x2105('0x0'));var util=require(_0x2105('0x1'));var logger=require(_0x2105('0x2'))(_0x2105('0x3'));var moment=require('moment');var BPromise=require(_0x2105('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2105('0x5'));var rimraf=require(_0x2105('0x6'));var config=require(_0x2105('0x7'));var attributes=require(_0x2105('0x8'));module[_0x2105('0x9')]=function(_0x16f76c,_0x34e4eb){return _0x16f76c[_0x2105('0xa')](_0x2105('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8b4=['bluebird','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment'];(function(_0x1b00aa,_0x531268){var _0x319a0f=function(_0xfc7889){while(--_0xfc7889){_0x1b00aa['push'](_0x1b00aa['shift']());}};_0x319a0f(++_0x531268);}(_0xc8b4,0x98));var _0x4c8b=function(_0x58ac3e,_0x356e2c){_0x58ac3e=_0x58ac3e-0x0;var _0x50f771=_0xc8b4[_0x58ac3e];return _0x50f771;};'use strict';var _=require(_0x4c8b('0x0'));var util=require('util');var logger=require(_0x4c8b('0x1'))(_0x4c8b('0x2'));var moment=require(_0x4c8b('0x3'));var BPromise=require(_0x4c8b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c8b('0x5'));var rimraf=require(_0x4c8b('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c8b('0x7'));module[_0x4c8b('0x8')]=function(_0x4a925b,_0x13f51b){return _0x4a925b[_0x4c8b('0x9')](_0x4c8b('0xa'),attributes,{'tableName':_0x4c8b('0xb'),'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 c9d568a..822658e 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 _0x7768=['../../config/utils','rpc','../../config/environment','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2f560e,_0x1cc398){var _0x652c1c=function(_0x320efa){while(--_0x320efa){_0x2f560e['push'](_0x2f560e['shift']());}};_0x652c1c(++_0x1cc398);}(_0x7768,0x1f0));var _0x8776=function(_0x3d9669,_0x471ea2){_0x3d9669=_0x3d9669-0x0;var _0x5c63ea=_0x7768[_0x3d9669];return _0x5c63ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8776('0x0'));var BPromise=require(_0x8776('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8776('0x2'));var db=require(_0x8776('0x3'))['db'];var utils=require(_0x8776('0x4'));var logger=require('../../config/logger')(_0x8776('0x5'));var config=require(_0x8776('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8776('0x7')][_0x8776('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f158a,_0x569785,_0xac3149){return new BPromise(function(_0x3be907,_0x5da419){return client[_0x8776('0x9')](_0x1f158a,_0xac3149)['then'](function(_0x14a348){logger[_0x8776('0xa')](_0x8776('0xb'),_0x569785,'request\x20sent');logger[_0x8776('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x569785,_0x8776('0xd'),JSON[_0x8776('0xe')](_0x14a348));if(_0x14a348[_0x8776('0xf')]){if(_0x14a348[_0x8776('0xf')][_0x8776('0x10')]===0x1f4){logger[_0x8776('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x569785,_0x14a348[_0x8776('0xf')][_0x8776('0x11')]);return _0x5da419(_0x14a348[_0x8776('0xf')]['message']);}logger[_0x8776('0xf')](_0x8776('0xb'),_0x569785,_0x14a348[_0x8776('0xf')][_0x8776('0x11')]);return _0x3be907(_0x14a348['error']['message']);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x569785,_0x8776('0xd'));_0x3be907(_0x14a348[_0x8776('0x12')][_0x8776('0x11')]);}})[_0x8776('0x13')](function(_0xe5ac83){logger[_0x8776('0xf')](_0x8776('0xb'),_0x569785,_0xe5ac83);_0x5da419(_0xe5ac83);});});} \ No newline at end of file +var _0xcd79=['lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0xff5684,_0xfe6e00){var _0x41e374=function(_0x145196){while(--_0x145196){_0xff5684['push'](_0xff5684['shift']());}};_0x41e374(++_0xfe6e00);}(_0xcd79,0xd2));var _0x9cd7=function(_0x38898d,_0xf72310){_0x38898d=_0x38898d-0x0;var _0xdcc1=_0xcd79[_0x38898d];return _0xdcc1;};'use strict';var _=require(_0x9cd7('0x0'));var util=require('util');var moment=require(_0x9cd7('0x1'));var BPromise=require('bluebird');var rs=require(_0x9cd7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9cd7('0x3'));var logger=require(_0x9cd7('0x4'))(_0x9cd7('0x5'));var config=require(_0x9cd7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cd7('0x7')][_0x9cd7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25411f,_0x57e827,_0xf63fbc){return new BPromise(function(_0x3a8e1f,_0x10ac2e){return client[_0x9cd7('0x9')](_0x25411f,_0xf63fbc)[_0x9cd7('0xa')](function(_0x3dfb24){logger['info'](_0x9cd7('0xb'),_0x57e827,_0x9cd7('0xc'));logger[_0x9cd7('0xd')](_0x9cd7('0xe'),_0x57e827,_0x9cd7('0xc'),JSON[_0x9cd7('0xf')](_0x3dfb24));if(_0x3dfb24[_0x9cd7('0x10')]){if(_0x3dfb24[_0x9cd7('0x10')]['code']===0x1f4){logger[_0x9cd7('0x10')](_0x9cd7('0xb'),_0x57e827,_0x3dfb24[_0x9cd7('0x10')][_0x9cd7('0x11')]);return _0x10ac2e(_0x3dfb24[_0x9cd7('0x10')][_0x9cd7('0x11')]);}logger[_0x9cd7('0x10')](_0x9cd7('0xb'),_0x57e827,_0x3dfb24[_0x9cd7('0x10')]['message']);return _0x3a8e1f(_0x3dfb24['error'][_0x9cd7('0x11')]);}else{logger[_0x9cd7('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x57e827,_0x9cd7('0xc'));_0x3a8e1f(_0x3dfb24[_0x9cd7('0x13')]['message']);}})[_0x9cd7('0x14')](function(_0x4f65cc){logger[_0x9cd7('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x57e827,_0x4f65cc);_0x10ac2e(_0x4f65cc);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a9132da..42df134 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 _0x347e=['put','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create'];(function(_0x58943d,_0x18b43e){var _0x238275=function(_0x3e0413){while(--_0x3e0413){_0x58943d['push'](_0x58943d['shift']());}};_0x238275(++_0x18b43e);}(_0x347e,0x18f));var _0xe347=function(_0x434c42,_0x4f687b){_0x434c42=_0x434c42-0x0;var _0x272e65=_0x347e[_0x434c42];return _0x272e65;};'use strict';var multer=require(_0xe347('0x0'));var util=require(_0xe347('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe347('0x2'));var router=express[_0xe347('0x3')]();var fs_extra=require(_0xe347('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe347('0x5'));var config=require(_0xe347('0x6'));var controller=require(_0xe347('0x7'));router[_0xe347('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe347('0x8')](_0xe347('0x9'),auth[_0xe347('0xa')](),controller[_0xe347('0xb')]);router['get'](_0xe347('0xc'),auth[_0xe347('0xa')](),controller[_0xe347('0xd')]);router[_0xe347('0x8')](_0xe347('0xe'),auth[_0xe347('0xa')](),controller[_0xe347('0xf')]);router[_0xe347('0x8')](_0xe347('0x10'),auth[_0xe347('0xa')](),controller[_0xe347('0x11')]);router['post']('/',auth[_0xe347('0xa')](),controller[_0xe347('0x12')]);router[_0xe347('0x13')](_0xe347('0x9'),auth[_0xe347('0xa')](),controller['update']);router[_0xe347('0x14')](_0xe347('0x9'),auth[_0xe347('0xa')](),controller['destroy']);module[_0xe347('0x15')]=router; \ No newline at end of file +var _0xe03b=['isAuthenticated','index','get','/:id','show','preview','/:id/run','run','/:id/query','query','create','put','update','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xe03b,0xbf));var _0xbe03=function(_0x2cb13c,_0x4fc1b6){_0x2cb13c=_0x2cb13c-0x0;var _0x23613c=_0xe03b[_0x2cb13c];return _0x23613c;};'use strict';var multer=require(_0xbe03('0x0'));var util=require(_0xbe03('0x1'));var path=require(_0xbe03('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbe03('0x3'));var auth=require(_0xbe03('0x4'));var interaction=require(_0xbe03('0x5'));var config=require('../../config/environment');var controller=require(_0xbe03('0x6'));router['get']('/',auth[_0xbe03('0x7')](),controller[_0xbe03('0x8')]);router[_0xbe03('0x9')](_0xbe03('0xa'),auth[_0xbe03('0x7')](),controller[_0xbe03('0xb')]);router[_0xbe03('0x9')]('/:id/preview',auth[_0xbe03('0x7')](),controller[_0xbe03('0xc')]);router[_0xbe03('0x9')](_0xbe03('0xd'),auth[_0xbe03('0x7')](),controller[_0xbe03('0xe')]);router[_0xbe03('0x9')](_0xbe03('0xf'),auth['isAuthenticated'](),controller[_0xbe03('0x10')]);router['post']('/',auth[_0xbe03('0x7')](),controller[_0xbe03('0x11')]);router[_0xbe03('0x12')](_0xbe03('0xa'),auth[_0xbe03('0x7')](),controller[_0xbe03('0x13')]);router[_0xbe03('0x14')]('/:id',auth[_0xbe03('0x7')](),controller[_0xbe03('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 31826d4..15b1380 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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x25a741,_0x5a072a){var _0x245fd3=function(_0x548856){while(--_0x548856){_0x25a741['push'](_0x25a741['shift']());}};_0x245fd3(++_0x5a072a);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x4d76b2,_0x41e6c3){var _0x3d0ff5=function(_0x155b68){while(--_0x155b68){_0x4d76b2['push'](_0x4d76b2['shift']());}};_0x3d0ff5(++_0x41e6c3);}(_0xeff8,0x186));var _0x8eff=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xeff8[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index eff830c..a92e6ed 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 _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x39489a,_0x451b19){var _0x4490c4=function(_0x403970){while(--_0x403970){_0x39489a['push'](_0x39489a['shift']());}};_0x4490c4(++_0x451b19);}(_0x1967,0x173));var _0x7196=function(_0x4d0cf9,_0x24f340){_0x4d0cf9=_0x4d0cf9-0x0;var _0x3dfa90=_0x1967[_0x4d0cf9];return _0x3dfa90;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x4edec4,_0x421b1d){var _0x1f74f9=function(_0x50c1cf){while(--_0x50c1cf){_0x4edec4['push'](_0x4edec4['shift']());}};_0x1f74f9(++_0x421b1d);}(_0x4975,0x86));var _0x5497=function(_0x26fd41,_0x2a4929){_0x26fd41=_0x26fd41-0x0;var _0x498c30=_0x4975[_0x26fd41];return _0x498c30;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f45fd1f..08f3ced 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 _0xadfa=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x26b9ec,_0x5363de){var _0x2321aa=function(_0x5e8458){while(--_0x5e8458){_0x26b9ec['push'](_0x26b9ec['shift']());}};_0x2321aa(++_0x5363de);}(_0xadfa,0x99));var _0xaadf=function(_0x247175,_0x7f804d){_0x247175=_0x247175-0x0;var _0x14ccf6=_0xadfa[_0x247175];return _0x14ccf6;};'use strict';var _=require(_0xaadf('0x0'));var util=require(_0xaadf('0x1'));var logger=require(_0xaadf('0x2'))('api');var moment=require(_0xaadf('0x3'));var BPromise=require(_0xaadf('0x4'));var rp=require(_0xaadf('0x5'));var fs=require('fs');var path=require(_0xaadf('0x6'));var rimraf=require(_0xaadf('0x7'));var config=require(_0xaadf('0x8'));var attributes=require(_0xaadf('0x9'));module[_0xaadf('0xa')]=function(_0x2db6a2,_0x1abebb){return _0x2db6a2[_0xaadf('0xb')](_0xaadf('0xc'),attributes,{'tableName':_0xaadf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7257=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7257,0x122));var _0x7725=function(_0x224dda,_0x16d0f9){_0x224dda=_0x224dda-0x0;var _0x2987ac=_0x7257[_0x224dda];return _0x2987ac;};'use strict';var _=require(_0x7725('0x0'));var util=require(_0x7725('0x1'));var logger=require(_0x7725('0x2'))(_0x7725('0x3'));var moment=require('moment');var BPromise=require(_0x7725('0x4'));var rp=require(_0x7725('0x5'));var fs=require('fs');var path=require(_0x7725('0x6'));var rimraf=require('rimraf');var config=require(_0x7725('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x7725('0x8')]=function(_0x5e547f,_0x3f0170){return _0x5e547f[_0x7725('0x9')](_0x7725('0xa'),attributes,{'tableName':_0x7725('0xb'),'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 8a17d3f..b5b2065 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 _0x93fa=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x1a6d6b,_0x1c5439){var _0x170bcd=function(_0x5df420){while(--_0x5df420){_0x1a6d6b['push'](_0x1a6d6b['shift']());}};_0x170bcd(++_0x1c5439);}(_0x93fa,0x141));var _0xa93f=function(_0x56aab0,_0x4afd25){_0x56aab0=_0x56aab0-0x0;var _0xa15bf4=_0x93fa[_0x56aab0];return _0xa15bf4;};'use strict';var _=require(_0xa93f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa93f('0x1'));var rs=require(_0xa93f('0x2'));var fs=require('fs');var Redis=require(_0xa93f('0x3'));var db=require(_0xa93f('0x4'))['db'];var utils=require(_0xa93f('0x5'));var logger=require(_0xa93f('0x6'))(_0xa93f('0x7'));var config=require(_0xa93f('0x8'));var jayson=require(_0xa93f('0x9'));var client=jayson[_0xa93f('0xa')][_0xa93f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb0a3e5,_0x2ff3f7,_0x1ff97e){return new BPromise(function(_0x12e311,_0x27b322){return client[_0xa93f('0xc')](_0xb0a3e5,_0x1ff97e)[_0xa93f('0xd')](function(_0x24ff06){logger[_0xa93f('0xe')](_0xa93f('0xf'),_0x2ff3f7,_0xa93f('0x10'));logger[_0xa93f('0x11')](_0xa93f('0x12'),_0x2ff3f7,_0xa93f('0x10'),JSON[_0xa93f('0x13')](_0x24ff06));if(_0x24ff06[_0xa93f('0x14')]){if(_0x24ff06[_0xa93f('0x14')][_0xa93f('0x15')]===0x1f4){logger[_0xa93f('0x14')](_0xa93f('0xf'),_0x2ff3f7,_0x24ff06[_0xa93f('0x14')][_0xa93f('0x16')]);return _0x27b322(_0x24ff06['error'][_0xa93f('0x16')]);}logger['error'](_0xa93f('0xf'),_0x2ff3f7,_0x24ff06[_0xa93f('0x14')][_0xa93f('0x16')]);return _0x12e311(_0x24ff06[_0xa93f('0x14')][_0xa93f('0x16')]);}else{logger[_0xa93f('0xe')](_0xa93f('0xf'),_0x2ff3f7,_0xa93f('0x10'));_0x12e311(_0x24ff06[_0xa93f('0x17')][_0xa93f('0x16')]);}})[_0xa93f('0x18')](function(_0x5d341a){logger[_0xa93f('0x14')](_0xa93f('0xf'),_0x2ff3f7,_0x5d341a);_0x27b322(_0x5d341a);});});} \ No newline at end of file +var _0x2520=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info'];(function(_0x1c905c,_0x836087){var _0x47de7f=function(_0x52b3fa){while(--_0x52b3fa){_0x1c905c['push'](_0x1c905c['shift']());}};_0x47de7f(++_0x836087);}(_0x2520,0xe5));var _0x0252=function(_0x49a8f2,_0x24a7a7){_0x49a8f2=_0x49a8f2-0x0;var _0x5756ce=_0x2520[_0x49a8f2];return _0x5756ce;};'use strict';var _=require(_0x0252('0x0'));var util=require('util');var moment=require(_0x0252('0x1'));var BPromise=require(_0x0252('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0252('0x3'))['db'];var utils=require(_0x0252('0x4'));var logger=require(_0x0252('0x5'))(_0x0252('0x6'));var config=require('../../config/environment');var jayson=require(_0x0252('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ee178,_0x1b23b2,_0x4e3380){return new BPromise(function(_0x72381c,_0xd9f6ac){return client[_0x0252('0x8')](_0x3ee178,_0x4e3380)[_0x0252('0x9')](function(_0x271479){logger[_0x0252('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1b23b2,'request\x20sent');logger[_0x0252('0xb')](_0x0252('0xc'),_0x1b23b2,_0x0252('0xd'),JSON[_0x0252('0xe')](_0x271479));if(_0x271479['error']){if(_0x271479[_0x0252('0xf')]['code']===0x1f4){logger[_0x0252('0xf')](_0x0252('0x10'),_0x1b23b2,_0x271479[_0x0252('0xf')]['message']);return _0xd9f6ac(_0x271479['error'][_0x0252('0x11')]);}logger[_0x0252('0xf')](_0x0252('0x10'),_0x1b23b2,_0x271479[_0x0252('0xf')][_0x0252('0x11')]);return _0x72381c(_0x271479[_0x0252('0xf')][_0x0252('0x11')]);}else{logger[_0x0252('0xa')](_0x0252('0x10'),_0x1b23b2,'request\x20sent');_0x72381c(_0x271479[_0x0252('0x12')][_0x0252('0x11')]);}})[_0x0252('0x13')](function(_0x53f277){logger[_0x0252('0xf')](_0x0252('0x10'),_0x1b23b2,_0x53f277);_0xd9f6ac(_0x53f277);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 34bde10..e94fc99 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 _0x4149=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','update','delete','destroy','exports','util','path'];(function(_0x2d6a5b,_0x39bb49){var _0x127cda=function(_0x5deff9){while(--_0x5deff9){_0x2d6a5b['push'](_0x2d6a5b['shift']());}};_0x127cda(++_0x39bb49);}(_0x4149,0xa6));var _0x9414=function(_0x32c7aa,_0x238e2f){_0x32c7aa=_0x32c7aa-0x0;var _0x201abc=_0x4149[_0x32c7aa];return _0x201abc;};'use strict';var multer=require('multer');var util=require(_0x9414('0x0'));var path=require(_0x9414('0x1'));var timeout=require(_0x9414('0x2'));var express=require(_0x9414('0x3'));var router=express[_0x9414('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9414('0x5'));var interaction=require(_0x9414('0x6'));var config=require('../../config/environment');var controller=require(_0x9414('0x7'));router['get']('/',auth[_0x9414('0x8')](),controller[_0x9414('0x9')]);router[_0x9414('0xa')](_0x9414('0xb'),auth[_0x9414('0x8')](),controller[_0x9414('0xc')]);router[_0x9414('0xa')](_0x9414('0xd'),auth[_0x9414('0x8')](),controller[_0x9414('0xe')]);router[_0x9414('0xa')]('/:id/run',auth[_0x9414('0x8')](),controller[_0x9414('0xf')]);router[_0x9414('0xa')](_0x9414('0x10'),auth[_0x9414('0x8')](),controller[_0x9414('0x11')]);router[_0x9414('0x12')]('/',auth[_0x9414('0x8')](),controller[_0x9414('0x13')]);router['put'](_0x9414('0xb'),auth['isAuthenticated'](),controller[_0x9414('0x14')]);router[_0x9414('0x15')]('/:id',auth[_0x9414('0x8')](),controller[_0x9414('0x16')]);module[_0x9414('0x17')]=router; \ No newline at end of file +var _0x7ba4=['fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','/:id/run','/:id/query','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x24563c,_0x49d7cd){var _0x14796e=function(_0x3ab3d9){while(--_0x3ab3d9){_0x24563c['push'](_0x24563c['shift']());}};_0x14796e(++_0x49d7cd);}(_0x7ba4,0x8c));var _0x47ba=function(_0x507ba0,_0x47afae){_0x507ba0=_0x507ba0-0x0;var _0x3fa6fd=_0x7ba4[_0x507ba0];return _0x3fa6fd;};'use strict';var multer=require(_0x47ba('0x0'));var util=require(_0x47ba('0x1'));var path=require('path');var timeout=require(_0x47ba('0x2'));var express=require(_0x47ba('0x3'));var router=express['Router']();var fs_extra=require(_0x47ba('0x4'));var auth=require(_0x47ba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x47ba('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x47ba('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x47ba('0x7')](_0x47ba('0x8'),auth[_0x47ba('0x9')](),controller['show']);router[_0x47ba('0x7')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0x47ba('0x7')](_0x47ba('0xa'),auth[_0x47ba('0x9')](),controller['run']);router[_0x47ba('0x7')](_0x47ba('0xb'),auth['isAuthenticated'](),controller['query']);router[_0x47ba('0xc')]('/',auth[_0x47ba('0x9')](),controller['create']);router[_0x47ba('0xd')](_0x47ba('0x8'),auth['isAuthenticated'](),controller[_0x47ba('0xe')]);router[_0x47ba('0xf')](_0x47ba('0x8'),auth['isAuthenticated'](),controller[_0x47ba('0x10')]);module[_0x47ba('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 95a1edd..de29b33 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 _0x8270=['moment','STRING','ENUM','pdf','csv','DATE','Loading','manual','scheduled'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x8270,0xb4));var _0x0827=function(_0x4e44ae,_0x51df27){_0x4e44ae=_0x4e44ae-0x0;var _0x4cb789=_0x8270[_0x4e44ae];return _0x4cb789;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0827('0x0'));module['exports']={'name':{'type':Sequelize[_0x0827('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x0827('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x0827('0x2')]('csv',_0x0827('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0x0827('0x4')},'savename':{'type':Sequelize[_0x0827('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0827('0x5')]},'endDate':{'type':Sequelize[_0x0827('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x0827('0x6')},'type':{'type':Sequelize[_0x0827('0x2')](_0x0827('0x7'),_0x0827('0x8')),'allowNull':![],'defaultValue':_0x0827('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa6d7=['scheduled','manual','INTEGER','exports','STRING','ENUM','xlsx','csv','DATE'];(function(_0x43c5a5,_0x5398ff){var _0x25e81d=function(_0x176cfa){while(--_0x176cfa){_0x43c5a5['push'](_0x43c5a5['shift']());}};_0x25e81d(++_0x5398ff);}(_0xa6d7,0xb7));var _0x7a6d=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa6d7[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x7a6d('0x0')]={'name':{'type':Sequelize[_0x7a6d('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x7a6d('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x7a6d('0x2')]('csv','pdf',_0x7a6d('0x3')),'allowNull':![],'defaultValue':_0x7a6d('0x4')},'savename':{'type':Sequelize[_0x7a6d('0x1')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x7a6d('0x5')]},'status':{'type':Sequelize[_0x7a6d('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x7a6d('0x2')]('manual',_0x7a6d('0x6')),'allowNull':![],'defaultValue':_0x7a6d('0x7')},'reportId':{'type':Sequelize[_0x7a6d('0x8')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x7a6d('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e1d6fcb..4618587 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 _0x7d50=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','get','user','UserProfileSection','UserProfileResource','error','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','download','format','basename','toLowerCase','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','ExtractedReports','destroy','sendStatus','stack','name','send','index','map','AnalyticExtractedReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options'];(function(_0x23f44d,_0x5d6a85){var _0x16b62b=function(_0x17b8df){while(--_0x17b8df){_0x23f44d['push'](_0x23f44d['shift']());}};_0x16b62b(++_0x5d6a85);}(_0x7d50,0x7e));var _0x07d5=function(_0x20aeb5,_0x16cd11){_0x20aeb5=_0x20aeb5-0x0;var _0x325c0e=_0x7d50[_0x20aeb5];return _0x325c0e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x07d5('0x0'));var jsonpatch=require(_0x07d5('0x1'));var rp=require('request-promise');var moment=require(_0x07d5('0x2'));var BPromise=require(_0x07d5('0x3'));var Mustache=require(_0x07d5('0x4'));var util=require(_0x07d5('0x5'));var path=require(_0x07d5('0x6'));var sox=require(_0x07d5('0x7'));var csv=require('to-csv');var ejs=require(_0x07d5('0x8'));var fs=require('fs');var fs_extra=require(_0x07d5('0x9'));var _=require(_0x07d5('0xa'));var squel=require('squel');var crypto=require(_0x07d5('0xb'));var jsforce=require(_0x07d5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x07d5('0xd'));var querystring=require(_0x07d5('0xe'));var Papa=require(_0x07d5('0xf'));var Redis=require(_0x07d5('0x10'));var authService=require(_0x07d5('0x11'));var qs=require(_0x07d5('0x12'));var as=require(_0x07d5('0x13'));var hardwareService=require(_0x07d5('0x14'));var logger=require(_0x07d5('0x15'))(_0x07d5('0x16'));var utils=require('../../config/utils');var config=require(_0x07d5('0x17'));var licenseUtil=require(_0x07d5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46f2ce,_0x5c70ae){_0x5c70ae=_0x5c70ae||0xcc;return function(_0x161e09){if(_0x161e09){return _0x46f2ce['sendStatus'](_0x5c70ae);}return _0x46f2ce[_0x07d5('0x19')](_0x5c70ae)[_0x07d5('0x1a')]();};}function respondWithResult(_0x579385,_0x5de016){_0x5de016=_0x5de016||0xc8;return function(_0x270fb6){if(_0x270fb6){return _0x579385[_0x07d5('0x19')](_0x5de016)[_0x07d5('0x1b')](_0x270fb6);}};}function respondWithFilteredResult(_0x3b3e70,_0x31b20d){return function(_0x1940f0){if(_0x1940f0){var _0x55b268=typeof _0x31b20d[_0x07d5('0x1c')]===_0x07d5('0x1d')&&typeof _0x31b20d[_0x07d5('0x1e')]==='undefined';var _0x1467fc=_0x1940f0[_0x07d5('0x1f')];var _0x2b5859=_0x55b268?0x0:_0x31b20d[_0x07d5('0x1c')];var _0x36b3fb=_0x55b268?_0x1940f0[_0x07d5('0x1f')]:_0x31b20d[_0x07d5('0x1c')]+_0x31b20d['limit'];var _0x23dd12;if(_0x36b3fb>=_0x1467fc){_0x36b3fb=_0x1467fc;_0x23dd12=0xc8;}else{_0x23dd12=0xce;}_0x3b3e70[_0x07d5('0x19')](_0x23dd12);return _0x3b3e70[_0x07d5('0x20')](_0x07d5('0x21'),_0x2b5859+'-'+_0x36b3fb+'/'+_0x1467fc)[_0x07d5('0x1b')](_0x1940f0);}return null;};}function patchUpdates(_0x345320){return function(_0x587469){try{jsonpatch[_0x07d5('0x22')](_0x587469,_0x345320,!![]);}catch(_0x2c8427){return BPromise[_0x07d5('0x23')](_0x2c8427);}return _0x587469['save']();};}function saveUpdates(_0x915e80,_0x2466f5){return function(_0x420aa3){if(_0x420aa3){return _0x420aa3[_0x07d5('0x24')](_0x915e80)[_0x07d5('0x25')](function(_0x5b6371){return _0x5b6371;});}return null;};}function removeEntity(_0x27d40b,_0x40e968){return function(_0x4f253b){if(_0x4f253b){return _0x4f253b['destroy']()[_0x07d5('0x25')](function(){var _0x2e79da=_0x4f253b['get']({'plain':!![]});var _0x2568a8=_0x07d5('0x26');return db['UserProfileResource'][_0x07d5('0x27')]({'where':{'type':_0x2568a8,'resourceId':_0x2e79da['id']}})[_0x07d5('0x25')](function(){return _0x4f253b;});})['then'](function(){_0x27d40b[_0x07d5('0x19')](0xcc)[_0x07d5('0x1a')]();});}};}function handleEntityNotFound(_0x26d527,_0x40cb54){return function(_0x4fc2d8){if(!_0x4fc2d8){_0x26d527[_0x07d5('0x28')](0x194);}return _0x4fc2d8;};}function handleError(_0x62bb73,_0x249208){_0x249208=_0x249208||0x1f4;return function(_0x228782){logger['error'](_0x228782[_0x07d5('0x29')]);if(_0x228782[_0x07d5('0x2a')]){delete _0x228782['name'];}_0x62bb73[_0x07d5('0x19')](_0x249208)[_0x07d5('0x2b')](_0x228782);};}exports[_0x07d5('0x2c')]=function(_0x5ada8c,_0x51e224){var _0x2b9f12={},_0x22a115={},_0x2e6b60={'count':0x0,'rows':[]};var _0x4f52d7=_[_0x07d5('0x2d')](db[_0x07d5('0x2e')]['rawAttributes'],function(_0x1f7507){return{'name':_0x1f7507[_0x07d5('0x2f')],'type':_0x1f7507['type'][_0x07d5('0x30')]};});_0x22a115[_0x07d5('0x31')]=_[_0x07d5('0x2d')](_0x4f52d7,_0x07d5('0x2a'));_0x22a115[_0x07d5('0x32')]=_[_0x07d5('0x33')](_0x5ada8c[_0x07d5('0x32')]);_0x22a115[_0x07d5('0x34')]=_[_0x07d5('0x35')](_0x22a115[_0x07d5('0x31')],_0x22a115[_0x07d5('0x32')]);_0x2b9f12[_0x07d5('0x36')]=_[_0x07d5('0x35')](_0x22a115[_0x07d5('0x31')],qs[_0x07d5('0x37')](_0x5ada8c['query'][_0x07d5('0x37')]));_0x2b9f12[_0x07d5('0x36')]=_0x2b9f12[_0x07d5('0x36')][_0x07d5('0x38')]?_0x2b9f12[_0x07d5('0x36')]:_0x22a115[_0x07d5('0x31')];if(!_0x5ada8c['query'][_0x07d5('0x39')](_0x07d5('0x3a'))){_0x2b9f12[_0x07d5('0x1e')]=qs['limit'](_0x5ada8c['query'][_0x07d5('0x1e')]);_0x2b9f12[_0x07d5('0x1c')]=qs[_0x07d5('0x1c')](_0x5ada8c['query'][_0x07d5('0x1c')]);}_0x2b9f12[_0x07d5('0x3b')]=qs['sort'](_0x5ada8c[_0x07d5('0x32')][_0x07d5('0x3c')]);_0x2b9f12['where']=qs[_0x07d5('0x34')](_[_0x07d5('0x3d')](_0x5ada8c[_0x07d5('0x32')],_0x22a115[_0x07d5('0x34')]),_0x4f52d7);if(_0x5ada8c[_0x07d5('0x32')][_0x07d5('0x3e')]){_0x2b9f12['where']=_[_0x07d5('0x3f')](_0x2b9f12[_0x07d5('0x40')],{'$or':_['map'](_0x4f52d7,function(_0x4ec811){if(_0x4ec811[_0x07d5('0x41')]!==_0x07d5('0x42')){var _0x393c15={};_0x393c15[_0x4ec811[_0x07d5('0x2a')]]={'$like':'%'+_0x5ada8c[_0x07d5('0x32')][_0x07d5('0x3e')]+'%'};return _0x393c15;}})});}_0x2b9f12=_[_0x07d5('0x3f')]({},_0x2b9f12,_0x5ada8c[_0x07d5('0x43')]);var _0x1a85c8={'where':_0x2b9f12['where']};return db[_0x07d5('0x2e')][_0x07d5('0x1f')](_0x1a85c8)[_0x07d5('0x25')](function(_0x166ec8){_0x2e6b60['count']=_0x166ec8;if(_0x5ada8c[_0x07d5('0x32')][_0x07d5('0x44')]){_0x2b9f12[_0x07d5('0x45')]=[{'all':!![]}];}return db[_0x07d5('0x2e')][_0x07d5('0x46')](_0x2b9f12);})[_0x07d5('0x25')](function(_0xc39f3e){_0x2e6b60[_0x07d5('0x47')]=_0xc39f3e;return _0x2e6b60;})[_0x07d5('0x25')](respondWithFilteredResult(_0x51e224,_0x2b9f12))[_0x07d5('0x48')](handleError(_0x51e224,null));};exports[_0x07d5('0x49')]=function(_0x26787a,_0x3c2991){var _0x5950ce={'raw':!![],'where':{'id':_0x26787a[_0x07d5('0x4a')]['id']}},_0xb9b954={};_0xb9b954['model']=_[_0x07d5('0x33')](db[_0x07d5('0x2e')][_0x07d5('0x4b')]);_0xb9b954['query']=_['keys'](_0x26787a[_0x07d5('0x32')]);_0xb9b954['filters']=_[_0x07d5('0x35')](_0xb9b954[_0x07d5('0x31')],_0xb9b954[_0x07d5('0x32')]);_0x5950ce[_0x07d5('0x36')]=_[_0x07d5('0x35')](_0xb9b954[_0x07d5('0x31')],qs[_0x07d5('0x37')](_0x26787a[_0x07d5('0x32')][_0x07d5('0x37')]));_0x5950ce['attributes']=_0x5950ce[_0x07d5('0x36')]['length']?_0x5950ce[_0x07d5('0x36')]:_0xb9b954['model'];if(_0x26787a[_0x07d5('0x32')][_0x07d5('0x44')]){_0x5950ce['include']=[{'all':!![]}];}_0x5950ce=_['merge']({},_0x5950ce,_0x26787a[_0x07d5('0x43')]);return db[_0x07d5('0x2e')][_0x07d5('0x4c')](_0x5950ce)[_0x07d5('0x25')](handleEntityNotFound(_0x3c2991,null))[_0x07d5('0x25')](respondWithResult(_0x3c2991,null))[_0x07d5('0x48')](handleError(_0x3c2991,null));};exports[_0x07d5('0x4d')]=function(_0x444fab,_0x4345a4){return db[_0x07d5('0x2e')][_0x07d5('0x4d')](_0x444fab[_0x07d5('0x4e')],{})[_0x07d5('0x25')](function(_0x43db19){var _0x1f5061=_0x444fab['user'][_0x07d5('0x4f')]({'plain':!![]});if(!_0x1f5061)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f5061['role']===_0x07d5('0x50')){var _0x2dac65=_0x43db19[_0x07d5('0x4f')]({'plain':!![]});var _0x2e7bee=_0x07d5('0x26');return db[_0x07d5('0x51')]['find']({'where':{'name':_0x2e7bee,'userProfileId':_0x1f5061['userProfileId']},'raw':!![]})[_0x07d5('0x25')](function(_0x27374e){if(_0x27374e&&_0x27374e['autoAssociation']===0x0){return db[_0x07d5('0x52')][_0x07d5('0x4d')]({'name':_0x2dac65[_0x07d5('0x2a')],'resourceId':_0x2dac65['id'],'type':_0x27374e[_0x07d5('0x2a')],'sectionId':_0x27374e['id']},{})[_0x07d5('0x25')](function(){return _0x43db19;});}else{return _0x43db19;}})[_0x07d5('0x48')](function(_0x456b75){logger[_0x07d5('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x456b75);throw _0x456b75;});}return _0x43db19;})[_0x07d5('0x25')](respondWithResult(_0x4345a4,0xc9))[_0x07d5('0x48')](handleError(_0x4345a4,null));};exports['update']=function(_0x332d2e,_0x181119){if(_0x332d2e[_0x07d5('0x4e')]['id']){delete _0x332d2e[_0x07d5('0x4e')]['id'];}return db[_0x07d5('0x2e')]['find']({'where':{'id':_0x332d2e[_0x07d5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x181119,null))[_0x07d5('0x25')](saveUpdates(_0x332d2e[_0x07d5('0x4e')],null))[_0x07d5('0x25')](respondWithResult(_0x181119,null))['catch'](handleError(_0x181119,null));};exports[_0x07d5('0x27')]=function(_0x12c6ec,_0x29431b){return db[_0x07d5('0x2e')][_0x07d5('0x4c')]({'where':{'id':_0x12c6ec[_0x07d5('0x4a')]['id']}})[_0x07d5('0x25')](handleEntityNotFound(_0x29431b,null))['then'](removeEntity(_0x29431b,null))[_0x07d5('0x48')](handleError(_0x29431b,null));};exports['download']=function(_0xfb1401,_0xece9bc,_0x2d4a5a){return db[_0x07d5('0x2e')][_0x07d5('0x4c')]({'where':{'id':_0xfb1401[_0x07d5('0x4a')]['id']},'attributes':[_0x07d5('0x2a'),'basename',_0x07d5('0x54'),_0x07d5('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0xece9bc,null))[_0x07d5('0x25')](function(_0x1eddac){if(_0x1eddac){if(!fs[_0x07d5('0x56')](path[_0x07d5('0x57')](config[_0x07d5('0x58')],_0x07d5('0x59'),_0x1eddac[_0x07d5('0x54')]))){throw new db[(_0x07d5('0x5a'))][(_0x07d5('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0xfb1401[_0x07d5('0x32')][_0x07d5('0x5c')]){return _0xece9bc[_0x07d5('0x28')](0xc8);}return _0xece9bc[_0x07d5('0x5d')](path['join'](config[_0x07d5('0x58')],'server/files/reports',_0x1eddac[_0x07d5('0x54')]),util[_0x07d5('0x5e')]('%s.%s',_0x1eddac[_0x07d5('0x5f')]||_0x1eddac['name'],_0x1eddac[_0x07d5('0x55')][_0x07d5('0x60')]()));}})['catch'](handleError(_0xece9bc,null));}; \ No newline at end of file +var _0x1557=['save','update','then','get','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','findAll','catch','show','params','merge','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','download','basename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','savename','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x5a7abb,_0x5940f9){var _0x5489d9=function(_0x209f7d){while(--_0x209f7d){_0x5a7abb['push'](_0x5a7abb['shift']());}};_0x5489d9(++_0x5940f9);}(_0x1557,0x1c4));var _0x7155=function(_0x42604b,_0x27c00a){_0x42604b=_0x42604b-0x0;var _0x579e6c=_0x1557[_0x42604b];return _0x579e6c;};'use strict';var emlformat=require(_0x7155('0x0'));var rimraf=require(_0x7155('0x1'));var zipdir=require(_0x7155('0x2'));var jsonpatch=require(_0x7155('0x3'));var rp=require(_0x7155('0x4'));var moment=require(_0x7155('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7155('0x6'));var util=require('util');var path=require(_0x7155('0x7'));var sox=require(_0x7155('0x8'));var csv=require(_0x7155('0x9'));var ejs=require(_0x7155('0xa'));var fs=require('fs');var fs_extra=require(_0x7155('0xb'));var _=require(_0x7155('0xc'));var squel=require(_0x7155('0xd'));var crypto=require(_0x7155('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7155('0xf'));var toCsv=require(_0x7155('0x9'));var querystring=require('querystring');var Papa=require(_0x7155('0x10'));var Redis=require(_0x7155('0x11'));var authService=require(_0x7155('0x12'));var qs=require(_0x7155('0x13'));var as=require(_0x7155('0x14'));var hardwareService=require(_0x7155('0x15'));var logger=require(_0x7155('0x16'))('api');var utils=require(_0x7155('0x17'));var config=require(_0x7155('0x18'));var licenseUtil=require(_0x7155('0x19'));var db=require(_0x7155('0x1a'))['db'];function respondWithStatusCode(_0x2b966d,_0x5b28f2){_0x5b28f2=_0x5b28f2||0xcc;return function(_0x3294df){if(_0x3294df){return _0x2b966d[_0x7155('0x1b')](_0x5b28f2);}return _0x2b966d[_0x7155('0x1c')](_0x5b28f2)[_0x7155('0x1d')]();};}function respondWithResult(_0x45a2fe,_0x114f4c){_0x114f4c=_0x114f4c||0xc8;return function(_0x2faf69){if(_0x2faf69){return _0x45a2fe[_0x7155('0x1c')](_0x114f4c)[_0x7155('0x1e')](_0x2faf69);}};}function respondWithFilteredResult(_0x4ebb07,_0x3801e9){return function(_0x2a810f){if(_0x2a810f){var _0x145cdd=typeof _0x3801e9['offset']===_0x7155('0x1f')&&typeof _0x3801e9[_0x7155('0x20')]===_0x7155('0x1f');var _0x3af053=_0x2a810f[_0x7155('0x21')];var _0x9c1528=_0x145cdd?0x0:_0x3801e9['offset'];var _0x4244c0=_0x145cdd?_0x2a810f[_0x7155('0x21')]:_0x3801e9[_0x7155('0x22')]+_0x3801e9['limit'];var _0x3b6acc;if(_0x4244c0>=_0x3af053){_0x4244c0=_0x3af053;_0x3b6acc=0xc8;}else{_0x3b6acc=0xce;}_0x4ebb07[_0x7155('0x1c')](_0x3b6acc);return _0x4ebb07[_0x7155('0x23')](_0x7155('0x24'),_0x9c1528+'-'+_0x4244c0+'/'+_0x3af053)['json'](_0x2a810f);}return null;};}function patchUpdates(_0x298002){return function(_0x2610af){try{jsonpatch[_0x7155('0x25')](_0x2610af,_0x298002,!![]);}catch(_0x59237d){return BPromise['reject'](_0x59237d);}return _0x2610af[_0x7155('0x26')]();};}function saveUpdates(_0x5028e5,_0x38fd6f){return function(_0x259824){if(_0x259824){return _0x259824[_0x7155('0x27')](_0x5028e5)['then'](function(_0x5e7054){return _0x5e7054;});}return null;};}function removeEntity(_0x3385b5,_0x11f116){return function(_0x1e64ba){if(_0x1e64ba){return _0x1e64ba['destroy']()[_0x7155('0x28')](function(){var _0x3805b1=_0x1e64ba[_0x7155('0x29')]({'plain':!![]});var _0x12eb61='ExtractedReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x12eb61,'resourceId':_0x3805b1['id']}})[_0x7155('0x28')](function(){return _0x1e64ba;});})[_0x7155('0x28')](function(){_0x3385b5[_0x7155('0x1c')](0xcc)[_0x7155('0x1d')]();});}};}function handleEntityNotFound(_0x5ab684,_0x250fa2){return function(_0x3e9b8f){if(!_0x3e9b8f){_0x5ab684['sendStatus'](0x194);}return _0x3e9b8f;};}function handleError(_0x303ee5,_0x2ecf8c){_0x2ecf8c=_0x2ecf8c||0x1f4;return function(_0x2501ce){logger[_0x7155('0x2a')](_0x2501ce['stack']);if(_0x2501ce[_0x7155('0x2b')]){delete _0x2501ce['name'];}_0x303ee5[_0x7155('0x1c')](_0x2ecf8c)[_0x7155('0x2c')](_0x2501ce);};}exports[_0x7155('0x2d')]=function(_0x44e1f9,_0x50857c){var _0x52e48d={},_0xa71dfe={},_0x178740={'count':0x0,'rows':[]};var _0x2f968b=_[_0x7155('0x2e')](db[_0x7155('0x2f')][_0x7155('0x30')],function(_0x4a1b67){return{'name':_0x4a1b67[_0x7155('0x31')],'type':_0x4a1b67[_0x7155('0x32')]['key']};});_0xa71dfe[_0x7155('0x33')]=_['map'](_0x2f968b,_0x7155('0x2b'));_0xa71dfe[_0x7155('0x34')]=_[_0x7155('0x35')](_0x44e1f9[_0x7155('0x34')]);_0xa71dfe[_0x7155('0x36')]=_['intersection'](_0xa71dfe[_0x7155('0x33')],_0xa71dfe[_0x7155('0x34')]);_0x52e48d[_0x7155('0x37')]=_[_0x7155('0x38')](_0xa71dfe[_0x7155('0x33')],qs[_0x7155('0x39')](_0x44e1f9[_0x7155('0x34')]['fields']));_0x52e48d[_0x7155('0x37')]=_0x52e48d[_0x7155('0x37')][_0x7155('0x3a')]?_0x52e48d[_0x7155('0x37')]:_0xa71dfe[_0x7155('0x33')];if(!_0x44e1f9[_0x7155('0x34')][_0x7155('0x3b')](_0x7155('0x3c'))){_0x52e48d[_0x7155('0x20')]=qs[_0x7155('0x20')](_0x44e1f9[_0x7155('0x34')][_0x7155('0x20')]);_0x52e48d[_0x7155('0x22')]=qs[_0x7155('0x22')](_0x44e1f9[_0x7155('0x34')][_0x7155('0x22')]);}_0x52e48d[_0x7155('0x3d')]=qs[_0x7155('0x3e')](_0x44e1f9['query']['sort']);_0x52e48d[_0x7155('0x3f')]=qs['filters'](_[_0x7155('0x40')](_0x44e1f9['query'],_0xa71dfe[_0x7155('0x36')]),_0x2f968b);if(_0x44e1f9[_0x7155('0x34')][_0x7155('0x41')]){_0x52e48d[_0x7155('0x3f')]=_['merge'](_0x52e48d[_0x7155('0x3f')],{'$or':_[_0x7155('0x2e')](_0x2f968b,function(_0x227fe3){if(_0x227fe3[_0x7155('0x32')]!=='VIRTUAL'){var _0x583c00={};_0x583c00[_0x227fe3[_0x7155('0x2b')]]={'$like':'%'+_0x44e1f9[_0x7155('0x34')][_0x7155('0x41')]+'%'};return _0x583c00;}})});}_0x52e48d=_['merge']({},_0x52e48d,_0x44e1f9[_0x7155('0x42')]);var _0x837c11={'where':_0x52e48d[_0x7155('0x3f')]};return db[_0x7155('0x2f')][_0x7155('0x21')](_0x837c11)['then'](function(_0x331f3a){_0x178740[_0x7155('0x21')]=_0x331f3a;if(_0x44e1f9[_0x7155('0x34')][_0x7155('0x43')]){_0x52e48d['include']=[{'all':!![]}];}return db[_0x7155('0x2f')][_0x7155('0x44')](_0x52e48d);})[_0x7155('0x28')](function(_0x5765f2){_0x178740['rows']=_0x5765f2;return _0x178740;})['then'](respondWithFilteredResult(_0x50857c,_0x52e48d))[_0x7155('0x45')](handleError(_0x50857c,null));};exports[_0x7155('0x46')]=function(_0x4aa236,_0x7fc4b8){var _0x24355b={'raw':!![],'where':{'id':_0x4aa236[_0x7155('0x47')]['id']}},_0x22c121={};_0x22c121[_0x7155('0x33')]=_[_0x7155('0x35')](db[_0x7155('0x2f')]['rawAttributes']);_0x22c121[_0x7155('0x34')]=_[_0x7155('0x35')](_0x4aa236[_0x7155('0x34')]);_0x22c121[_0x7155('0x36')]=_[_0x7155('0x38')](_0x22c121[_0x7155('0x33')],_0x22c121[_0x7155('0x34')]);_0x24355b[_0x7155('0x37')]=_[_0x7155('0x38')](_0x22c121[_0x7155('0x33')],qs[_0x7155('0x39')](_0x4aa236['query']['fields']));_0x24355b[_0x7155('0x37')]=_0x24355b[_0x7155('0x37')]['length']?_0x24355b[_0x7155('0x37')]:_0x22c121[_0x7155('0x33')];if(_0x4aa236['query'][_0x7155('0x43')]){_0x24355b['include']=[{'all':!![]}];}_0x24355b=_[_0x7155('0x48')]({},_0x24355b,_0x4aa236['options']);return db['AnalyticExtractedReport'][_0x7155('0x49')](_0x24355b)[_0x7155('0x28')](handleEntityNotFound(_0x7fc4b8,null))[_0x7155('0x28')](respondWithResult(_0x7fc4b8,null))['catch'](handleError(_0x7fc4b8,null));};exports[_0x7155('0x4a')]=function(_0x345047,_0x4c4047){return db[_0x7155('0x2f')][_0x7155('0x4a')](_0x345047[_0x7155('0x4b')],{})[_0x7155('0x28')](function(_0x4e16e8){var _0x3a9617=_0x345047[_0x7155('0x4c')]['get']({'plain':!![]});if(!_0x3a9617)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a9617[_0x7155('0x4d')]==='user'){var _0x388d95=_0x4e16e8[_0x7155('0x29')]({'plain':!![]});var _0x5db931='ExtractedReports';return db[_0x7155('0x4e')][_0x7155('0x49')]({'where':{'name':_0x5db931,'userProfileId':_0x3a9617[_0x7155('0x4f')]},'raw':!![]})[_0x7155('0x28')](function(_0x35ebba){if(_0x35ebba&&_0x35ebba['autoAssociation']===0x0){return db[_0x7155('0x50')][_0x7155('0x4a')]({'name':_0x388d95[_0x7155('0x2b')],'resourceId':_0x388d95['id'],'type':_0x35ebba[_0x7155('0x2b')],'sectionId':_0x35ebba['id']},{})[_0x7155('0x28')](function(){return _0x4e16e8;});}else{return _0x4e16e8;}})['catch'](function(_0x3b2033){logger[_0x7155('0x2a')](_0x7155('0x51'),_0x3b2033);throw _0x3b2033;});}return _0x4e16e8;})[_0x7155('0x28')](respondWithResult(_0x4c4047,0xc9))['catch'](handleError(_0x4c4047,null));};exports[_0x7155('0x27')]=function(_0x327753,_0x4880ef){if(_0x327753['body']['id']){delete _0x327753[_0x7155('0x4b')]['id'];}return db[_0x7155('0x2f')]['find']({'where':{'id':_0x327753['params']['id']}})[_0x7155('0x28')](handleEntityNotFound(_0x4880ef,null))[_0x7155('0x28')](saveUpdates(_0x327753[_0x7155('0x4b')],null))['then'](respondWithResult(_0x4880ef,null))[_0x7155('0x45')](handleError(_0x4880ef,null));};exports[_0x7155('0x52')]=function(_0x5c8787,_0x131ef4){return db['AnalyticExtractedReport'][_0x7155('0x49')]({'where':{'id':_0x5c8787[_0x7155('0x47')]['id']}})[_0x7155('0x28')](handleEntityNotFound(_0x131ef4,null))[_0x7155('0x28')](removeEntity(_0x131ef4,null))[_0x7155('0x45')](handleError(_0x131ef4,null));};exports[_0x7155('0x53')]=function(_0x2902d1,_0x1515ad,_0x2c0855){return db[_0x7155('0x2f')]['find']({'where':{'id':_0x2902d1[_0x7155('0x47')]['id']},'attributes':[_0x7155('0x2b'),_0x7155('0x54'),'savename',_0x7155('0x55')],'raw':!![]})[_0x7155('0x28')](handleEntityNotFound(_0x1515ad,null))['then'](function(_0x4c3db0){if(_0x4c3db0){if(!fs[_0x7155('0x56')](path['join'](config[_0x7155('0x57')],_0x7155('0x58'),_0x4c3db0['savename']))){throw new db[(_0x7155('0x59'))][(_0x7155('0x5a'))](_0x7155('0x5b'));}if(_0x2902d1[_0x7155('0x34')][_0x7155('0x5c')]){return _0x1515ad[_0x7155('0x1b')](0xc8);}return _0x1515ad[_0x7155('0x53')](path[_0x7155('0x5d')](config[_0x7155('0x57')],_0x7155('0x58'),_0x4c3db0[_0x7155('0x5e')]),util[_0x7155('0x5f')](_0x7155('0x60'),_0x4c3db0[_0x7155('0x54')]||_0x4c3db0[_0x7155('0x2b')],_0x4c3db0['output'][_0x7155('0x61')]()));}})[_0x7155('0x45')](handleError(_0x1515ad,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f557dd8..1b31cfc 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 _0xfd37=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5e390e,_0x396801){var _0x34b044=function(_0x59f5d9){while(--_0x59f5d9){_0x5e390e['push'](_0x5e390e['shift']());}};_0x34b044(++_0x396801);}(_0xfd37,0x78));var _0x7fd3=function(_0x2b191e,_0x3f477d){_0x2b191e=_0x2b191e-0x0;var _0x420881=_0xfd37[_0x2b191e];return _0x420881;};'use strict';var _=require(_0x7fd3('0x0'));var util=require(_0x7fd3('0x1'));var logger=require(_0x7fd3('0x2'))(_0x7fd3('0x3'));var moment=require('moment');var BPromise=require(_0x7fd3('0x4'));var rp=require(_0x7fd3('0x5'));var fs=require('fs');var path=require(_0x7fd3('0x6'));var rimraf=require(_0x7fd3('0x7'));var config=require(_0x7fd3('0x8'));var attributes=require(_0x7fd3('0x9'));module[_0x7fd3('0xa')]=function(_0x3d24c8,_0x158d16){return _0x3d24c8[_0x7fd3('0xb')](_0x7fd3('0xc'),attributes,{'tableName':_0x7fd3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x996c=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x482956,_0x2f0908){var _0x374562=function(_0x2aa3ae){while(--_0x2aa3ae){_0x482956['push'](_0x482956['shift']());}};_0x374562(++_0x2f0908);}(_0x996c,0x1ea));var _0xc996=function(_0x5ee2b7,_0x34790f){_0x5ee2b7=_0x5ee2b7-0x0;var _0x43842d=_0x996c[_0x5ee2b7];return _0x43842d;};'use strict';var _=require(_0xc996('0x0'));var util=require(_0xc996('0x1'));var logger=require(_0xc996('0x2'))(_0xc996('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc996('0x4'));var fs=require('fs');var path=require(_0xc996('0x5'));var rimraf=require(_0xc996('0x6'));var config=require(_0xc996('0x7'));var attributes=require(_0xc996('0x8'));module['exports']=function(_0x89fdf4,_0x24fd4e){return _0x89fdf4[_0xc996('0x9')](_0xc996('0xa'),attributes,{'tableName':_0xc996('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 91124e9..96ec189 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 _0x4b39=['AnalyticExtractedReport,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x468148,_0x50e263){var _0x2b67ab=function(_0x1baee5){while(--_0x1baee5){_0x468148['push'](_0x468148['shift']());}};_0x2b67ab(++_0x50e263);}(_0x4b39,0x133));var _0x94b3=function(_0x4b17da,_0x3b50b4){_0x4b17da=_0x4b17da-0x0;var _0x1dce95=_0x4b39[_0x4b17da];return _0x1dce95;};'use strict';var _=require(_0x94b3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x94b3('0x1'));var rs=require(_0x94b3('0x2'));var fs=require('fs');var Redis=require(_0x94b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x94b3('0x4'));var logger=require(_0x94b3('0x5'))(_0x94b3('0x6'));var config=require(_0x94b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x94b3('0x8')][_0x94b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25daa0,_0x547e4d,_0x19a221){return new BPromise(function(_0x538ad5,_0x363a67){return client['request'](_0x25daa0,_0x19a221)[_0x94b3('0xa')](function(_0x4e6307){logger[_0x94b3('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x547e4d,_0x94b3('0xc'));logger['debug'](_0x94b3('0xd'),_0x547e4d,_0x94b3('0xc'),JSON[_0x94b3('0xe')](_0x4e6307));if(_0x4e6307['error']){if(_0x4e6307[_0x94b3('0xf')]['code']===0x1f4){logger[_0x94b3('0xf')](_0x94b3('0x10'),_0x547e4d,_0x4e6307[_0x94b3('0xf')][_0x94b3('0x11')]);return _0x363a67(_0x4e6307['error']['message']);}logger[_0x94b3('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x547e4d,_0x4e6307[_0x94b3('0xf')]['message']);return _0x538ad5(_0x4e6307[_0x94b3('0xf')][_0x94b3('0x11')]);}else{logger['info'](_0x94b3('0x10'),_0x547e4d,_0x94b3('0xc'));_0x538ad5(_0x4e6307['result'][_0x94b3('0x11')]);}})[_0x94b3('0x12')](function(_0x1896ec){logger[_0x94b3('0xf')](_0x94b3('0x10'),_0x547e4d,_0x1896ec);_0x363a67(_0x1896ec);});});} \ No newline at end of file +var _0xf7e0=['stringify','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x3b2a59,_0x36e582){var _0x4160f3=function(_0x2f062f){while(--_0x2f062f){_0x3b2a59['push'](_0x3b2a59['shift']());}};_0x4160f3(++_0x36e582);}(_0xf7e0,0x68));var _0x0f7e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf7e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0f7e('0x0'));var util=require(_0x0f7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0f7e('0x2'));var fs=require('fs');var Redis=require(_0x0f7e('0x3'));var db=require(_0x0f7e('0x4'))['db'];var utils=require(_0x0f7e('0x5'));var logger=require(_0x0f7e('0x6'))('rpc');var config=require(_0x0f7e('0x7'));var jayson=require(_0x0f7e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8da890,_0x5aea9d,_0x57b995){return new BPromise(function(_0x2c4006,_0x2611b1){return client[_0x0f7e('0x9')](_0x8da890,_0x57b995)[_0x0f7e('0xa')](function(_0x1defe1){logger[_0x0f7e('0xb')](_0x0f7e('0xc'),_0x5aea9d,_0x0f7e('0xd'));logger[_0x0f7e('0xe')](_0x0f7e('0xf'),_0x5aea9d,_0x0f7e('0xd'),JSON[_0x0f7e('0x10')](_0x1defe1));if(_0x1defe1[_0x0f7e('0x11')]){if(_0x1defe1[_0x0f7e('0x11')]['code']===0x1f4){logger[_0x0f7e('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5aea9d,_0x1defe1['error'][_0x0f7e('0x12')]);return _0x2611b1(_0x1defe1[_0x0f7e('0x11')][_0x0f7e('0x12')]);}logger[_0x0f7e('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5aea9d,_0x1defe1[_0x0f7e('0x11')][_0x0f7e('0x12')]);return _0x2c4006(_0x1defe1['error'][_0x0f7e('0x12')]);}else{logger[_0x0f7e('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5aea9d,'request\x20sent');_0x2c4006(_0x1defe1['result']['message']);}})[_0x0f7e('0x13')](function(_0x3118c1){logger[_0x0f7e('0x11')](_0x0f7e('0xc'),_0x5aea9d,_0x3118c1);_0x2611b1(_0x3118c1);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 4233a3e..46555e9 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 _0x97c2=['./analyticExtractedReport.controller','get','index','/:id','show','/:id/download','isAuthenticated','download','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29b65b,_0x3b7633){var _0x2d80ba=function(_0x6a7752){while(--_0x6a7752){_0x29b65b['push'](_0x29b65b['shift']());}};_0x2d80ba(++_0x3b7633);}(_0x97c2,0x138));var _0x297c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x97c2[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x297c('0x0'));var util=require(_0x297c('0x1'));var path=require(_0x297c('0x2'));var timeout=require(_0x297c('0x3'));var express=require(_0x297c('0x4'));var router=express[_0x297c('0x5')]();var fs_extra=require(_0x297c('0x6'));var auth=require(_0x297c('0x7'));var interaction=require(_0x297c('0x8'));var config=require(_0x297c('0x9'));var controller=require(_0x297c('0xa'));router[_0x297c('0xb')]('/',auth['isAuthenticated'](),controller[_0x297c('0xc')]);router['get'](_0x297c('0xd'),auth['isAuthenticated'](),controller[_0x297c('0xe')]);router[_0x297c('0xb')](_0x297c('0xf'),auth[_0x297c('0x10')](),controller[_0x297c('0x11')]);router[_0x297c('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x297c('0x13')]('/:id',auth[_0x297c('0x10')](),controller[_0x297c('0x14')]);router['delete']('/:id',auth[_0x297c('0x10')](),controller[_0x297c('0x15')]);module[_0x297c('0x16')]=router; \ No newline at end of file +var _0xbc5e=['/:id/download','post','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xbc5e,0xa6));var _0xebc5=function(_0x3c7996,_0x1b65a3){_0x3c7996=_0x3c7996-0x0;var _0x1d1170=_0xbc5e[_0x3c7996];return _0x1d1170;};'use strict';var multer=require('multer');var util=require(_0xebc5('0x0'));var path=require(_0xebc5('0x1'));var timeout=require(_0xebc5('0x2'));var express=require(_0xebc5('0x3'));var router=express[_0xebc5('0x4')]();var fs_extra=require(_0xebc5('0x5'));var auth=require(_0xebc5('0x6'));var interaction=require(_0xebc5('0x7'));var config=require(_0xebc5('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xebc5('0x9')]('/',auth[_0xebc5('0xa')](),controller[_0xebc5('0xb')]);router[_0xebc5('0x9')](_0xebc5('0xc'),auth[_0xebc5('0xa')](),controller[_0xebc5('0xd')]);router[_0xebc5('0x9')](_0xebc5('0xe'),auth[_0xebc5('0xa')](),controller['download']);router[_0xebc5('0xf')]('/',auth[_0xebc5('0xa')](),controller[_0xebc5('0x10')]);router['put']('/:id',auth[_0xebc5('0xa')](),controller[_0xebc5('0x11')]);router[_0xebc5('0x12')](_0xebc5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xebc5('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 59c649c..e680218 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 _0x7f80=['sequelize','exports','TEXT','STRING'];(function(_0x9cae0c,_0x42b12d){var _0x45542e=function(_0x31623a){while(--_0x31623a){_0x9cae0c['push'](_0x9cae0c['shift']());}};_0x45542e(++_0x42b12d);}(_0x7f80,0xec));var _0x07f8=function(_0x51304d,_0x42c2e7){_0x51304d=_0x51304d-0x0;var _0x588e90=_0x7f80[_0x51304d];return _0x588e90;};'use strict';var Sequelize=require(_0x07f8('0x0'));module[_0x07f8('0x1')]={'field':{'type':Sequelize[_0x07f8('0x2')]},'alias':{'type':Sequelize[_0x07f8('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x07f8('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc17a=['STRING','BOOLEAN','sequelize'];(function(_0x5e9aad,_0x3582a8){var _0xb99dad=function(_0x164234){while(--_0x164234){_0x5e9aad['push'](_0x5e9aad['shift']());}};_0xb99dad(++_0x3582a8);}(_0xc17a,0xe6));var _0xac17=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xc17a[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0xac17('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xac17('0x1')]},'function':{'type':Sequelize[_0xac17('0x1')]},'format':{'type':Sequelize[_0xac17('0x1')]},'groupBy':{'type':Sequelize[_0xac17('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xac17('0x1')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e6ce079..a5c5f59 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 _0x78b9=['moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise'];(function(_0xab477c,_0x4ee058){var _0x466db2=function(_0x3b9522){while(--_0x3b9522){_0xab477c['push'](_0xab477c['shift']());}};_0x466db2(++_0x4ee058);}(_0x78b9,0x191));var _0x978b=function(_0x58df49,_0x109194){_0x58df49=_0x58df49-0x0;var _0x123dba=_0x78b9[_0x58df49];return _0x123dba;};'use strict';var emlformat=require(_0x978b('0x0'));var rimraf=require(_0x978b('0x1'));var zipdir=require(_0x978b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x978b('0x3'));var moment=require(_0x978b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x978b('0x5'));var path=require(_0x978b('0x6'));var sox=require(_0x978b('0x7'));var csv=require(_0x978b('0x8'));var ejs=require(_0x978b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x978b('0xa'));var squel=require(_0x978b('0xb'));var crypto=require('crypto');var jsforce=require(_0x978b('0xc'));var deskjs=require(_0x978b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x978b('0xe'));var Papa=require(_0x978b('0xf'));var Redis=require(_0x978b('0x10'));var authService=require(_0x978b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x978b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x978b('0x13'));var config=require(_0x978b('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x137c02,_0x1c200b){_0x1c200b=_0x1c200b||0xcc;return function(_0x191a39){if(_0x191a39){return _0x137c02['sendStatus'](_0x1c200b);}return _0x137c02[_0x978b('0x15')](_0x1c200b)[_0x978b('0x16')]();};}function respondWithResult(_0x5f19dc,_0x2f6d8a){_0x2f6d8a=_0x2f6d8a||0xc8;return function(_0x2f5a7f){if(_0x2f5a7f){return _0x5f19dc[_0x978b('0x15')](_0x2f6d8a)['json'](_0x2f5a7f);}};}function respondWithFilteredResult(_0x4b0165,_0x1bc253){return function(_0x439dac){if(_0x439dac){var _0x1056f2=typeof _0x1bc253[_0x978b('0x17')]===_0x978b('0x18')&&typeof _0x1bc253[_0x978b('0x19')]===_0x978b('0x18');var _0x3103aa=_0x439dac[_0x978b('0x1a')];var _0xc66865=_0x1056f2?0x0:_0x1bc253[_0x978b('0x17')];var _0x5413de=_0x1056f2?_0x439dac[_0x978b('0x1a')]:_0x1bc253[_0x978b('0x17')]+_0x1bc253['limit'];var _0x56fdd1;if(_0x5413de>=_0x3103aa){_0x5413de=_0x3103aa;_0x56fdd1=0xc8;}else{_0x56fdd1=0xce;}_0x4b0165[_0x978b('0x15')](_0x56fdd1);return _0x4b0165['set'](_0x978b('0x1b'),_0xc66865+'-'+_0x5413de+'/'+_0x3103aa)[_0x978b('0x1c')](_0x439dac);}return null;};}function patchUpdates(_0x396538){return function(_0x1808a6){try{jsonpatch['apply'](_0x1808a6,_0x396538,!![]);}catch(_0x498a50){return BPromise[_0x978b('0x1d')](_0x498a50);}return _0x1808a6[_0x978b('0x1e')]();};}function saveUpdates(_0x9f4a97,_0x343ce3){return function(_0x66c66e){if(_0x66c66e){return _0x66c66e[_0x978b('0x1f')](_0x9f4a97)[_0x978b('0x20')](function(_0x100d01){return _0x100d01;});}return null;};}function removeEntity(_0x384cd1,_0x417ad7){return function(_0x9492c9){if(_0x9492c9){return _0x9492c9[_0x978b('0x21')]()[_0x978b('0x20')](function(){_0x384cd1[_0x978b('0x15')](0xcc)[_0x978b('0x16')]();});}};}function handleEntityNotFound(_0x11208e,_0x5b8d14){return function(_0x3ffebd){if(!_0x3ffebd){_0x11208e[_0x978b('0x22')](0x194);}return _0x3ffebd;};}function handleError(_0x331948,_0x22f2a5){_0x22f2a5=_0x22f2a5||0x1f4;return function(_0x1c07d5){logger[_0x978b('0x23')](_0x1c07d5[_0x978b('0x24')]);if(_0x1c07d5[_0x978b('0x25')]){delete _0x1c07d5['name'];}_0x331948[_0x978b('0x15')](_0x22f2a5)[_0x978b('0x26')](_0x1c07d5);};}exports[_0x978b('0x27')]=function(_0x508a81,_0x40fa30){var _0xb52846={},_0x24fefb={},_0x3aa5ae={'count':0x0,'rows':[]};var _0xc55a67=_[_0x978b('0x28')](db[_0x978b('0x29')][_0x978b('0x2a')],function(_0x233525){return{'name':_0x233525['fieldName'],'type':_0x233525['type'][_0x978b('0x2b')]};});_0x24fefb[_0x978b('0x2c')]=_[_0x978b('0x28')](_0xc55a67,_0x978b('0x25'));_0x24fefb[_0x978b('0x2d')]=_[_0x978b('0x2e')](_0x508a81['query']);_0x24fefb[_0x978b('0x2f')]=_[_0x978b('0x30')](_0x24fefb[_0x978b('0x2c')],_0x24fefb[_0x978b('0x2d')]);_0xb52846['attributes']=_['intersection'](_0x24fefb[_0x978b('0x2c')],qs['fields'](_0x508a81[_0x978b('0x2d')][_0x978b('0x31')]));_0xb52846[_0x978b('0x32')]=_0xb52846[_0x978b('0x32')][_0x978b('0x33')]?_0xb52846['attributes']:_0x24fefb['model'];if(!_0x508a81['query'][_0x978b('0x34')](_0x978b('0x35'))){_0xb52846['limit']=qs[_0x978b('0x19')](_0x508a81[_0x978b('0x2d')]['limit']);_0xb52846[_0x978b('0x17')]=qs[_0x978b('0x17')](_0x508a81[_0x978b('0x2d')][_0x978b('0x17')]);}_0xb52846[_0x978b('0x36')]=qs[_0x978b('0x37')](_0x508a81['query'][_0x978b('0x37')]);_0xb52846[_0x978b('0x38')]=qs[_0x978b('0x2f')](_[_0x978b('0x39')](_0x508a81[_0x978b('0x2d')],_0x24fefb[_0x978b('0x2f')]),_0xc55a67);if(_0x508a81[_0x978b('0x2d')][_0x978b('0x3a')]){_0xb52846['where']=_[_0x978b('0x3b')](_0xb52846['where'],{'$or':_[_0x978b('0x28')](_0xc55a67,function(_0x493d75){if(_0x493d75[_0x978b('0x3c')]!==_0x978b('0x3d')){var _0x32e06b={};_0x32e06b[_0x493d75['name']]={'$like':'%'+_0x508a81[_0x978b('0x2d')]['filter']+'%'};return _0x32e06b;}})});}_0xb52846=_['merge']({},_0xb52846,_0x508a81[_0x978b('0x3e')]);var _0x218737={'where':_0xb52846['where']};return db['AnalyticFieldReport'][_0x978b('0x1a')](_0x218737)[_0x978b('0x20')](function(_0x31b771){_0x3aa5ae['count']=_0x31b771;if(_0x508a81[_0x978b('0x2d')][_0x978b('0x3f')]){_0xb52846['include']=[{'all':!![]}];}return db[_0x978b('0x29')][_0x978b('0x40')](_0xb52846);})['then'](function(_0x5e2b1d){_0x3aa5ae[_0x978b('0x41')]=_0x5e2b1d;return _0x3aa5ae;})[_0x978b('0x20')](respondWithFilteredResult(_0x40fa30,_0xb52846))['catch'](handleError(_0x40fa30,null));};exports[_0x978b('0x42')]=function(_0x433ef2,_0x1e573e){var _0x559e88={'raw':![],'where':{'id':_0x433ef2[_0x978b('0x43')]['id']}},_0x24ff3d={};_0x24ff3d[_0x978b('0x2c')]=_[_0x978b('0x2e')](db[_0x978b('0x29')][_0x978b('0x2a')]);_0x24ff3d[_0x978b('0x2d')]=_[_0x978b('0x2e')](_0x433ef2[_0x978b('0x2d')]);_0x24ff3d[_0x978b('0x2f')]=_['intersection'](_0x24ff3d[_0x978b('0x2c')],_0x24ff3d['query']);_0x559e88[_0x978b('0x32')]=_['intersection'](_0x24ff3d[_0x978b('0x2c')],qs[_0x978b('0x31')](_0x433ef2[_0x978b('0x2d')][_0x978b('0x31')]));_0x559e88['attributes']=_0x559e88[_0x978b('0x32')][_0x978b('0x33')]?_0x559e88[_0x978b('0x32')]:_0x24ff3d[_0x978b('0x2c')];if(_0x433ef2['query']['includeAll']){_0x559e88[_0x978b('0x44')]=[{'all':!![]}];}_0x559e88=_[_0x978b('0x3b')]({},_0x559e88,_0x433ef2[_0x978b('0x3e')]);return db[_0x978b('0x29')][_0x978b('0x45')](_0x559e88)[_0x978b('0x20')](handleEntityNotFound(_0x1e573e,null))[_0x978b('0x20')](respondWithResult(_0x1e573e,null))[_0x978b('0x46')](handleError(_0x1e573e,null));};exports[_0x978b('0x47')]=function(_0x3fa71f,_0x35510e){return db[_0x978b('0x29')][_0x978b('0x47')](_0x3fa71f[_0x978b('0x48')],{})[_0x978b('0x20')](respondWithResult(_0x35510e,0xc9))['catch'](handleError(_0x35510e,null));};exports['bulkCreate']=function(_0x33f857,_0x272345){return db[_0x978b('0x29')][_0x978b('0x49')](_0x33f857[_0x978b('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x272345,0xc9))['catch'](handleError(_0x272345,null));};exports[_0x978b('0x1f')]=function(_0x26a165,_0x37a24d){if(_0x26a165[_0x978b('0x48')]['id']){delete _0x26a165['body']['id'];}return db[_0x978b('0x29')][_0x978b('0x45')]({'where':{'id':_0x26a165[_0x978b('0x43')]['id']}})[_0x978b('0x20')](handleEntityNotFound(_0x37a24d,null))[_0x978b('0x20')](saveUpdates(_0x26a165[_0x978b('0x48')],null))[_0x978b('0x20')](respondWithResult(_0x37a24d,null))['catch'](handleError(_0x37a24d,null));};exports['destroy']=function(_0x3b28c1,_0x1bc616){return db[_0x978b('0x29')][_0x978b('0x45')]({'where':{'id':_0x3b28c1[_0x978b('0x43')]['id']}})[_0x978b('0x20')](handleEntityNotFound(_0x1bc616,null))[_0x978b('0x20')](removeEntity(_0x1bc616,null))[_0x978b('0x46')](handleError(_0x1bc616,null));};exports[_0x978b('0x4a')]=function(_0x4c2d2d,_0x10578e){return db[_0x978b('0x29')][_0x978b('0x21')]({'where':{'id':_0x4c2d2d[_0x978b('0x2d')][_0x978b('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x10578e,0xcc))['catch'](handleError(_0x10578e,null));};exports[_0x978b('0x4c')]=function(_0x292ecf,_0x1ec4c9,_0x356c40){return db[_0x978b('0x4d')]['findOne']({'where':{'id':_0x292ecf[_0x978b('0x43')]['id']}})[_0x978b('0x20')](handleEntityNotFound(_0x1ec4c9,null))[_0x978b('0x20')](function(_0x542ff4){if(_0x542ff4){return db[_0x978b('0x4e')][_0x978b('0x4f')](function(_0x3c1b50){return db[_0x978b('0x29')][_0x978b('0x21')]({'where':{'CustomReportId':_0x292ecf[_0x978b('0x43')]['id']},'transaction':_0x3c1b50})[_0x978b('0x20')](function(_0x558489){var _0xfd41be=_[_0x978b('0x28')](_0x292ecf[_0x978b('0x48')],function(_0x4037f4){delete _0x4037f4['id'];_0x4037f4[_0x978b('0x50')]=_0x292ecf[_0x978b('0x43')]['id'];return _0x4037f4;});return db[_0x978b('0x29')][_0x978b('0x49')](_0xfd41be,{'transaction':_0x3c1b50});});})['then'](function(){return db[_0x978b('0x29')]['findAll']({'where':{'CustomReportId':_0x292ecf['params']['id']}});});}})[_0x978b('0x20')](respondWithResult(_0x1ec4c9,null))[_0x978b('0x46')](handleError(_0x1ec4c9,null));}; \ No newline at end of file +var _0xe2b6=['include','findAll','rows','catch','show','find','create','bulkCreate','body','params','ids','AnalyticCustomReport','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','AnalyticFieldReport','includeAll'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0xe2b6,0x1d0));var _0x6e2b=function(_0x2761f7,_0x26278d){_0x2761f7=_0x2761f7-0x0;var _0x3519d1=_0xe2b6[_0x2761f7];return _0x3519d1;};'use strict';var emlformat=require(_0x6e2b('0x0'));var rimraf=require(_0x6e2b('0x1'));var zipdir=require(_0x6e2b('0x2'));var jsonpatch=require(_0x6e2b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6e2b('0x4'));var util=require(_0x6e2b('0x5'));var path=require(_0x6e2b('0x6'));var sox=require('sox');var csv=require(_0x6e2b('0x7'));var ejs=require(_0x6e2b('0x8'));var fs=require('fs');var fs_extra=require(_0x6e2b('0x9'));var _=require(_0x6e2b('0xa'));var squel=require(_0x6e2b('0xb'));var crypto=require(_0x6e2b('0xc'));var jsforce=require(_0x6e2b('0xd'));var deskjs=require(_0x6e2b('0xe'));var toCsv=require(_0x6e2b('0x7'));var querystring=require('querystring');var Papa=require(_0x6e2b('0xf'));var Redis=require(_0x6e2b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6e2b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e2b('0x12'));var logger=require('../../config/logger')(_0x6e2b('0x13'));var utils=require(_0x6e2b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6e2b('0x15'))['db'];function respondWithStatusCode(_0x448c75,_0x4460f0){_0x4460f0=_0x4460f0||0xcc;return function(_0x7086e4){if(_0x7086e4){return _0x448c75[_0x6e2b('0x16')](_0x4460f0);}return _0x448c75[_0x6e2b('0x17')](_0x4460f0)[_0x6e2b('0x18')]();};}function respondWithResult(_0x3f9ba0,_0x138fb8){_0x138fb8=_0x138fb8||0xc8;return function(_0x3b79a3){if(_0x3b79a3){return _0x3f9ba0[_0x6e2b('0x17')](_0x138fb8)[_0x6e2b('0x19')](_0x3b79a3);}};}function respondWithFilteredResult(_0x49e3ea,_0x33fdf7){return function(_0x5b84b6){if(_0x5b84b6){var _0x5b63ea=typeof _0x33fdf7[_0x6e2b('0x1a')]==='undefined'&&typeof _0x33fdf7['limit']==='undefined';var _0x3fe7b8=_0x5b84b6['count'];var _0x5aefb2=_0x5b63ea?0x0:_0x33fdf7[_0x6e2b('0x1a')];var _0x15858c=_0x5b63ea?_0x5b84b6[_0x6e2b('0x1b')]:_0x33fdf7['offset']+_0x33fdf7[_0x6e2b('0x1c')];var _0x3c0287;if(_0x15858c>=_0x3fe7b8){_0x15858c=_0x3fe7b8;_0x3c0287=0xc8;}else{_0x3c0287=0xce;}_0x49e3ea['status'](_0x3c0287);return _0x49e3ea[_0x6e2b('0x1d')](_0x6e2b('0x1e'),_0x5aefb2+'-'+_0x15858c+'/'+_0x3fe7b8)[_0x6e2b('0x19')](_0x5b84b6);}return null;};}function patchUpdates(_0x29b605){return function(_0xdc2ed8){try{jsonpatch[_0x6e2b('0x1f')](_0xdc2ed8,_0x29b605,!![]);}catch(_0x153faf){return BPromise[_0x6e2b('0x20')](_0x153faf);}return _0xdc2ed8[_0x6e2b('0x21')]();};}function saveUpdates(_0x168951,_0x9632){return function(_0x1baf16){if(_0x1baf16){return _0x1baf16[_0x6e2b('0x22')](_0x168951)[_0x6e2b('0x23')](function(_0x440e19){return _0x440e19;});}return null;};}function removeEntity(_0x36239f,_0x4435f5){return function(_0x997dbb){if(_0x997dbb){return _0x997dbb[_0x6e2b('0x24')]()[_0x6e2b('0x23')](function(){_0x36239f[_0x6e2b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x112e7f,_0x241c0d){return function(_0x3000b0){if(!_0x3000b0){_0x112e7f[_0x6e2b('0x16')](0x194);}return _0x3000b0;};}function handleError(_0x13ec8c,_0x77180){_0x77180=_0x77180||0x1f4;return function(_0x2c5243){logger[_0x6e2b('0x25')](_0x2c5243[_0x6e2b('0x26')]);if(_0x2c5243[_0x6e2b('0x27')]){delete _0x2c5243['name'];}_0x13ec8c['status'](_0x77180)['send'](_0x2c5243);};}exports['index']=function(_0x2fb41d,_0x7dc028){var _0x2d34ca={},_0x50d6da={},_0x1facad={'count':0x0,'rows':[]};var _0x145da6=_[_0x6e2b('0x28')](db['AnalyticFieldReport'][_0x6e2b('0x29')],function(_0x4b0190){return{'name':_0x4b0190['fieldName'],'type':_0x4b0190[_0x6e2b('0x2a')][_0x6e2b('0x2b')]};});_0x50d6da[_0x6e2b('0x2c')]=_[_0x6e2b('0x28')](_0x145da6,_0x6e2b('0x27'));_0x50d6da['query']=_[_0x6e2b('0x2d')](_0x2fb41d[_0x6e2b('0x2e')]);_0x50d6da[_0x6e2b('0x2f')]=_[_0x6e2b('0x30')](_0x50d6da[_0x6e2b('0x2c')],_0x50d6da[_0x6e2b('0x2e')]);_0x2d34ca['attributes']=_['intersection'](_0x50d6da['model'],qs[_0x6e2b('0x31')](_0x2fb41d['query']['fields']));_0x2d34ca[_0x6e2b('0x32')]=_0x2d34ca[_0x6e2b('0x32')][_0x6e2b('0x33')]?_0x2d34ca['attributes']:_0x50d6da['model'];if(!_0x2fb41d[_0x6e2b('0x2e')]['hasOwnProperty'](_0x6e2b('0x34'))){_0x2d34ca[_0x6e2b('0x1c')]=qs[_0x6e2b('0x1c')](_0x2fb41d[_0x6e2b('0x2e')][_0x6e2b('0x1c')]);_0x2d34ca[_0x6e2b('0x1a')]=qs[_0x6e2b('0x1a')](_0x2fb41d[_0x6e2b('0x2e')][_0x6e2b('0x1a')]);}_0x2d34ca['order']=qs[_0x6e2b('0x35')](_0x2fb41d[_0x6e2b('0x2e')][_0x6e2b('0x35')]);_0x2d34ca[_0x6e2b('0x36')]=qs[_0x6e2b('0x2f')](_[_0x6e2b('0x37')](_0x2fb41d[_0x6e2b('0x2e')],_0x50d6da[_0x6e2b('0x2f')]),_0x145da6);if(_0x2fb41d[_0x6e2b('0x2e')][_0x6e2b('0x38')]){_0x2d34ca[_0x6e2b('0x36')]=_[_0x6e2b('0x39')](_0x2d34ca['where'],{'$or':_[_0x6e2b('0x28')](_0x145da6,function(_0x5c3f1e){if(_0x5c3f1e[_0x6e2b('0x2a')]!=='VIRTUAL'){var _0xb1972e={};_0xb1972e[_0x5c3f1e[_0x6e2b('0x27')]]={'$like':'%'+_0x2fb41d[_0x6e2b('0x2e')][_0x6e2b('0x38')]+'%'};return _0xb1972e;}})});}_0x2d34ca=_['merge']({},_0x2d34ca,_0x2fb41d[_0x6e2b('0x3a')]);var _0x4feeca={'where':_0x2d34ca['where']};return db[_0x6e2b('0x3b')][_0x6e2b('0x1b')](_0x4feeca)['then'](function(_0x2ed3cc){_0x1facad['count']=_0x2ed3cc;if(_0x2fb41d[_0x6e2b('0x2e')][_0x6e2b('0x3c')]){_0x2d34ca[_0x6e2b('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x6e2b('0x3e')](_0x2d34ca);})[_0x6e2b('0x23')](function(_0x5cbd21){_0x1facad[_0x6e2b('0x3f')]=_0x5cbd21;return _0x1facad;})[_0x6e2b('0x23')](respondWithFilteredResult(_0x7dc028,_0x2d34ca))[_0x6e2b('0x40')](handleError(_0x7dc028,null));};exports[_0x6e2b('0x41')]=function(_0xacda4e,_0x4354f7){var _0x39b436={'raw':![],'where':{'id':_0xacda4e['params']['id']}},_0x1e4cd3={};_0x1e4cd3[_0x6e2b('0x2c')]=_['keys'](db[_0x6e2b('0x3b')][_0x6e2b('0x29')]);_0x1e4cd3['query']=_['keys'](_0xacda4e[_0x6e2b('0x2e')]);_0x1e4cd3[_0x6e2b('0x2f')]=_[_0x6e2b('0x30')](_0x1e4cd3[_0x6e2b('0x2c')],_0x1e4cd3['query']);_0x39b436[_0x6e2b('0x32')]=_[_0x6e2b('0x30')](_0x1e4cd3[_0x6e2b('0x2c')],qs[_0x6e2b('0x31')](_0xacda4e[_0x6e2b('0x2e')]['fields']));_0x39b436[_0x6e2b('0x32')]=_0x39b436[_0x6e2b('0x32')][_0x6e2b('0x33')]?_0x39b436[_0x6e2b('0x32')]:_0x1e4cd3[_0x6e2b('0x2c')];if(_0xacda4e[_0x6e2b('0x2e')]['includeAll']){_0x39b436[_0x6e2b('0x3d')]=[{'all':!![]}];}_0x39b436=_[_0x6e2b('0x39')]({},_0x39b436,_0xacda4e[_0x6e2b('0x3a')]);return db[_0x6e2b('0x3b')][_0x6e2b('0x42')](_0x39b436)[_0x6e2b('0x23')](handleEntityNotFound(_0x4354f7,null))[_0x6e2b('0x23')](respondWithResult(_0x4354f7,null))['catch'](handleError(_0x4354f7,null));};exports[_0x6e2b('0x43')]=function(_0x520c81,_0x3ce6b1){return db[_0x6e2b('0x3b')]['create'](_0x520c81['body'],{})[_0x6e2b('0x23')](respondWithResult(_0x3ce6b1,0xc9))[_0x6e2b('0x40')](handleError(_0x3ce6b1,null));};exports['bulkCreate']=function(_0x7ed180,_0x4da44e){return db[_0x6e2b('0x3b')][_0x6e2b('0x44')](_0x7ed180['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4da44e,0xc9))[_0x6e2b('0x40')](handleError(_0x4da44e,null));};exports['update']=function(_0x6f8f68,_0x556edd){if(_0x6f8f68[_0x6e2b('0x45')]['id']){delete _0x6f8f68[_0x6e2b('0x45')]['id'];}return db['AnalyticFieldReport'][_0x6e2b('0x42')]({'where':{'id':_0x6f8f68['params']['id']}})[_0x6e2b('0x23')](handleEntityNotFound(_0x556edd,null))['then'](saveUpdates(_0x6f8f68[_0x6e2b('0x45')],null))[_0x6e2b('0x23')](respondWithResult(_0x556edd,null))[_0x6e2b('0x40')](handleError(_0x556edd,null));};exports[_0x6e2b('0x24')]=function(_0x4bdcb9,_0x4731ca){return db[_0x6e2b('0x3b')]['find']({'where':{'id':_0x4bdcb9[_0x6e2b('0x46')]['id']}})[_0x6e2b('0x23')](handleEntityNotFound(_0x4731ca,null))[_0x6e2b('0x23')](removeEntity(_0x4731ca,null))[_0x6e2b('0x40')](handleError(_0x4731ca,null));};exports['bulkDestroy']=function(_0x57c9e9,_0x152663){return db[_0x6e2b('0x3b')][_0x6e2b('0x24')]({'where':{'id':_0x57c9e9['query'][_0x6e2b('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x6e2b('0x23')](respondWithResult(_0x152663,0xcc))[_0x6e2b('0x40')](handleError(_0x152663,null));};exports['addFields']=function(_0x5538d9,_0x285530,_0x371218){return db[_0x6e2b('0x48')]['findOne']({'where':{'id':_0x5538d9[_0x6e2b('0x46')]['id']}})[_0x6e2b('0x23')](handleEntityNotFound(_0x285530,null))[_0x6e2b('0x23')](function(_0x2769e6){if(_0x2769e6){return db['sequelize'][_0x6e2b('0x49')](function(_0x4ef055){return db['AnalyticFieldReport'][_0x6e2b('0x24')]({'where':{'CustomReportId':_0x5538d9[_0x6e2b('0x46')]['id']},'transaction':_0x4ef055})['then'](function(_0x1b2c3b){var _0x355d84=_['map'](_0x5538d9[_0x6e2b('0x45')],function(_0x276fe0){delete _0x276fe0['id'];_0x276fe0[_0x6e2b('0x4a')]=_0x5538d9['params']['id'];return _0x276fe0;});return db[_0x6e2b('0x3b')][_0x6e2b('0x44')](_0x355d84,{'transaction':_0x4ef055});});})[_0x6e2b('0x23')](function(){return db[_0x6e2b('0x3b')][_0x6e2b('0x3e')]({'where':{'CustomReportId':_0x5538d9[_0x6e2b('0x46')]['id']}});});}})[_0x6e2b('0x23')](respondWithResult(_0x285530,null))[_0x6e2b('0x40')](handleError(_0x285530,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3129142..26eee76 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 _0xe0a2=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe0a2,0x155));var _0x2e0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0a2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2e0a('0x0'));var util=require(_0x2e0a('0x1'));var logger=require(_0x2e0a('0x2'))('api');var moment=require(_0x2e0a('0x3'));var BPromise=require(_0x2e0a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e0a('0x5'));var rimraf=require('rimraf');var config=require(_0x2e0a('0x6'));var attributes=require(_0x2e0a('0x7'));module[_0x2e0a('0x8')]=function(_0x32a4bd,_0xdded2a){return _0x32a4bd['define'](_0x2e0a('0x9'),attributes,{'tableName':_0x2e0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad80=['util','moment','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','lodash'];(function(_0x2876f9,_0x4e9922){var _0x2d37cb=function(_0x6e9c42){while(--_0x6e9c42){_0x2876f9['push'](_0x2876f9['shift']());}};_0x2d37cb(++_0x4e9922);}(_0xad80,0x9f));var _0x0ad8=function(_0x241480,_0x47de78){_0x241480=_0x241480-0x0;var _0x181e8d=_0xad80[_0x241480];return _0x181e8d;};'use strict';var _=require(_0x0ad8('0x0'));var util=require(_0x0ad8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0ad8('0x2'));var BPromise=require(_0x0ad8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ad8('0x4'));var rimraf=require(_0x0ad8('0x5'));var config=require(_0x0ad8('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x0ad8('0x7')]=function(_0x558a21,_0x19ca36){return _0x558a21[_0x0ad8('0x8')](_0x0ad8('0x9'),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 8da4975..d82a54c 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 _0xe402=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x42aff9,_0xe4fd11){var _0xa54edd=function(_0x2d3190){while(--_0x2d3190){_0x42aff9['push'](_0x42aff9['shift']());}};_0xa54edd(++_0xe4fd11);}(_0xe402,0x1c5));var _0x2e40=function(_0x2aecf8,_0x22eef6){_0x2aecf8=_0x2aecf8-0x0;var _0x36b77=_0xe402[_0x2aecf8];return _0x36b77;};'use strict';var _=require(_0x2e40('0x0'));var util=require(_0x2e40('0x1'));var moment=require(_0x2e40('0x2'));var BPromise=require(_0x2e40('0x3'));var rs=require(_0x2e40('0x4'));var fs=require('fs');var Redis=require(_0x2e40('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e40('0x6'));var logger=require(_0x2e40('0x7'))('rpc');var config=require(_0x2e40('0x8'));var jayson=require(_0x2e40('0x9'));var client=jayson['client'][_0x2e40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x415f63,_0x2345b1,_0x35ce24){return new BPromise(function(_0x59680a,_0x4f745f){return client[_0x2e40('0xb')](_0x415f63,_0x35ce24)[_0x2e40('0xc')](function(_0x1a4a68){logger[_0x2e40('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2345b1,_0x2e40('0xe'));logger[_0x2e40('0xf')](_0x2e40('0x10'),_0x2345b1,_0x2e40('0xe'),JSON[_0x2e40('0x11')](_0x1a4a68));if(_0x1a4a68[_0x2e40('0x12')]){if(_0x1a4a68[_0x2e40('0x12')][_0x2e40('0x13')]===0x1f4){logger['error'](_0x2e40('0x14'),_0x2345b1,_0x1a4a68[_0x2e40('0x12')][_0x2e40('0x15')]);return _0x4f745f(_0x1a4a68[_0x2e40('0x12')][_0x2e40('0x15')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2345b1,_0x1a4a68[_0x2e40('0x12')][_0x2e40('0x15')]);return _0x59680a(_0x1a4a68[_0x2e40('0x12')]['message']);}else{logger[_0x2e40('0xd')](_0x2e40('0x14'),_0x2345b1,_0x2e40('0xe'));_0x59680a(_0x1a4a68[_0x2e40('0x16')][_0x2e40('0x15')]);}})[_0x2e40('0x17')](function(_0x16f983){logger[_0x2e40('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2345b1,_0x16f983);_0x4f745f(_0x16f983);});});} \ No newline at end of file +var _0xfe9e=['code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x477b74,_0x28657a){var _0x43cc4f=function(_0x33f74e){while(--_0x33f74e){_0x477b74['push'](_0x477b74['shift']());}};_0x43cc4f(++_0x28657a);}(_0xfe9e,0x1cf));var _0xefe9=function(_0x4ccf96,_0x34978e){_0x4ccf96=_0x4ccf96-0x0;var _0xd103b7=_0xfe9e[_0x4ccf96];return _0xd103b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xefe9('0x0'));var BPromise=require(_0xefe9('0x1'));var rs=require(_0xefe9('0x2'));var fs=require('fs');var Redis=require(_0xefe9('0x3'));var db=require(_0xefe9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xefe9('0x5'))(_0xefe9('0x6'));var config=require(_0xefe9('0x7'));var jayson=require(_0xefe9('0x8'));var client=jayson['client'][_0xefe9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5caf72,_0x11b4f9,_0x1eb644){return new BPromise(function(_0x317a6c,_0xe21239){return client[_0xefe9('0xa')](_0x5caf72,_0x1eb644)['then'](function(_0x26701b){logger[_0xefe9('0xb')](_0xefe9('0xc'),_0x11b4f9,_0xefe9('0xd'));logger['debug'](_0xefe9('0xe'),_0x11b4f9,_0xefe9('0xd'),JSON[_0xefe9('0xf')](_0x26701b));if(_0x26701b[_0xefe9('0x10')]){if(_0x26701b[_0xefe9('0x10')][_0xefe9('0x11')]===0x1f4){logger[_0xefe9('0x10')](_0xefe9('0xc'),_0x11b4f9,_0x26701b[_0xefe9('0x10')]['message']);return _0xe21239(_0x26701b['error'][_0xefe9('0x12')]);}logger['error'](_0xefe9('0xc'),_0x11b4f9,_0x26701b[_0xefe9('0x10')][_0xefe9('0x12')]);return _0x317a6c(_0x26701b[_0xefe9('0x10')][_0xefe9('0x12')]);}else{logger[_0xefe9('0xb')](_0xefe9('0xc'),_0x11b4f9,_0xefe9('0xd'));_0x317a6c(_0x26701b['result']['message']);}})[_0xefe9('0x13')](function(_0x201c20){logger[_0xefe9('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x11b4f9,_0x201c20);_0xe21239(_0x201c20);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 799779c..c720b49 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(_0x5dcfe2,_0x397a20){var _0x373e3a=function(_0x54e6d7){while(--_0x54e6d7){_0x5dcfe2['push'](_0x5dcfe2['shift']());}};_0x373e3a(++_0x397a20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x3388d8,_0x256024){var _0x2bbe73=function(_0x3c0cb2){while(--_0x3c0cb2){_0x3388d8['push'](_0x3388d8['shift']());}};_0x2bbe73(++_0x256024);}(_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'));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 ff25487..4f4d9b0 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 _0x9a1b=['TEXT','sequelize','STRING'];(function(_0x1bef23,_0x331853){var _0x2c0295=function(_0x1613eb){while(--_0x1613eb){_0x1bef23['push'](_0x1bef23['shift']());}};_0x2c0295(++_0x331853);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x293181,_0x1f01ae){_0x293181=_0x293181-0x0;var _0x20680b=_0x9a1b[_0x293181];return _0x20680b;};'use strict';var Sequelize=require(_0xb9a1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xb9a1('0x1')]},'metric':{'type':Sequelize[_0xb9a1('0x2')]},'description':{'type':Sequelize[_0xb9a1('0x1')]}}; \ No newline at end of file +var _0xd404=['exports','name','STRING','sequelize'];(function(_0x2580dd,_0x4d6507){var _0x39de0c=function(_0x4b8992){while(--_0x4b8992){_0x2580dd['push'](_0x2580dd['shift']());}};_0x39de0c(++_0x4d6507);}(_0xd404,0x15b));var _0x4d40=function(_0x1ba4d1,_0x54fd0e){_0x1ba4d1=_0x1ba4d1-0x0;var _0x29a4a5=_0xd404[_0x1ba4d1];return _0x29a4a5;};'use strict';var Sequelize=require(_0x4d40('0x0'));module[_0x4d40('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4d40('0x2')},'table':{'type':Sequelize[_0x4d40('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x4d40('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index abbbc49..18f7fb5 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 _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x20c993,_0xca841c){var _0x3fc1e2=function(_0x1e134f){while(--_0x1e134f){_0x20c993['push'](_0x20c993['shift']());}};_0x3fc1e2(++_0xca841c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xe445b3,_0x26ae0c){_0xe445b3=_0xe445b3-0x0;var _0x266a98=_0x9c5a[_0xe445b3];return _0x266a98;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file +var _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x4d9470,_0x1e85a3){var _0x2ab521=function(_0x46e8ba){while(--_0x46e8ba){_0x4d9470['push'](_0x4d9470['shift']());}};_0x2ab521(++_0x1e85a3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 391a13a..673f882 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 _0x22da=['moment','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','../../config/logger','api'];(function(_0x2266e6,_0x1c781f){var _0x346c55=function(_0x43bc56){while(--_0x43bc56){_0x2266e6['push'](_0x2266e6['shift']());}};_0x346c55(++_0x1c781f);}(_0x22da,0x80));var _0xa22d=function(_0x247aa1,_0x33fd7b){_0x247aa1=_0x247aa1-0x0;var _0x433190=_0x22da[_0x247aa1];return _0x433190;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa22d('0x0'))(_0xa22d('0x1'));var moment=require(_0xa22d('0x2'));var BPromise=require(_0xa22d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa22d('0x4'));var rimraf=require(_0xa22d('0x5'));var config=require(_0xa22d('0x6'));var attributes=require(_0xa22d('0x7'));module['exports']=function(_0x4007bd,_0x9bc0eb){return _0x4007bd['define'](_0xa22d('0x8'),attributes,{'tableName':_0xa22d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6455=['request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5acd1e,_0x2267b9){var _0x164688=function(_0xc67557){while(--_0xc67557){_0x5acd1e['push'](_0x5acd1e['shift']());}};_0x164688(++_0x2267b9);}(_0x6455,0x97));var _0x5645=function(_0xdf1738,_0x5456ea){_0xdf1738=_0xdf1738-0x0;var _0x15092e=_0x6455[_0xdf1738];return _0x15092e;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 530dead..bf8f571 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 _0xa30d=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x3f404d,_0x4210a8){var _0x3a267d=function(_0x8a6881){while(--_0x8a6881){_0x3f404d['push'](_0x3f404d['shift']());}};_0x3a267d(++_0x4210a8);}(_0xa30d,0x115));var _0xda30=function(_0x447db1,_0x11030d){_0x447db1=_0x447db1-0x0;var _0x4269d5=_0xa30d[_0x447db1];return _0x4269d5;};'use strict';var _=require(_0xda30('0x0'));var util=require(_0xda30('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda30('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xda30('0x3'));var config=require(_0xda30('0x4'));var jayson=require(_0xda30('0x5'));var client=jayson[_0xda30('0x6')][_0xda30('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe150d7,_0x45a108,_0x54f520){return new BPromise(function(_0x4533d0,_0x269d31){return client['request'](_0xe150d7,_0x54f520)['then'](function(_0x33644a){logger[_0xda30('0x8')](_0xda30('0x9'),_0x45a108,_0xda30('0xa'));logger[_0xda30('0xb')](_0xda30('0xc'),_0x45a108,_0xda30('0xa'),JSON[_0xda30('0xd')](_0x33644a));if(_0x33644a[_0xda30('0xe')]){if(_0x33644a[_0xda30('0xe')][_0xda30('0xf')]===0x1f4){logger['error'](_0xda30('0x9'),_0x45a108,_0x33644a[_0xda30('0xe')][_0xda30('0x10')]);return _0x269d31(_0x33644a[_0xda30('0xe')]['message']);}logger['error'](_0xda30('0x9'),_0x45a108,_0x33644a[_0xda30('0xe')][_0xda30('0x10')]);return _0x4533d0(_0x33644a[_0xda30('0xe')]['message']);}else{logger[_0xda30('0x8')](_0xda30('0x9'),_0x45a108,'request\x20sent');_0x4533d0(_0x33644a[_0xda30('0x11')]['message']);}})['catch'](function(_0x3afab3){logger[_0xda30('0xe')](_0xda30('0x9'),_0x45a108,_0x3afab3);_0x269d31(_0x3afab3);});});} \ No newline at end of file +var _0x1c6a=['../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','bluebird','ioredis'];(function(_0x508c7b,_0x517d80){var _0xd25467=function(_0x40966b){while(--_0x40966b){_0x508c7b['push'](_0x508c7b['shift']());}};_0xd25467(++_0x517d80);}(_0x1c6a,0xb0));var _0xa1c6=function(_0x50cf08,_0x5eb8c5){_0x50cf08=_0x50cf08-0x0;var _0x23a9df=_0x1c6a[_0x50cf08];return _0x23a9df;};'use strict';var _=require(_0xa1c6('0x0'));var util=require(_0xa1c6('0x1'));var moment=require('moment');var BPromise=require(_0xa1c6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1c6('0x3'));var db=require(_0xa1c6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa1c6('0x5'));var config=require(_0xa1c6('0x6'));var jayson=require(_0xa1c6('0x7'));var client=jayson['client'][_0xa1c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a8a00,_0x3ef0d8,_0x800597){return new BPromise(function(_0x2e1691,_0x1b64bc){return client[_0xa1c6('0x9')](_0x2a8a00,_0x800597)[_0xa1c6('0xa')](function(_0x1837fa){logger['info'](_0xa1c6('0xb'),_0x3ef0d8,'request\x20sent');logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x3ef0d8,_0xa1c6('0xc'),JSON['stringify'](_0x1837fa));if(_0x1837fa['error']){if(_0x1837fa[_0xa1c6('0xd')]['code']===0x1f4){logger[_0xa1c6('0xd')](_0xa1c6('0xb'),_0x3ef0d8,_0x1837fa[_0xa1c6('0xd')][_0xa1c6('0xe')]);return _0x1b64bc(_0x1837fa['error'][_0xa1c6('0xe')]);}logger[_0xa1c6('0xd')](_0xa1c6('0xb'),_0x3ef0d8,_0x1837fa['error']['message']);return _0x2e1691(_0x1837fa['error'][_0xa1c6('0xe')]);}else{logger[_0xa1c6('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x3ef0d8,_0xa1c6('0xc'));_0x2e1691(_0x1837fa[_0xa1c6('0x10')]['message']);}})[_0xa1c6('0x11')](function(_0x1ec5bd){logger[_0xa1c6('0xd')](_0xa1c6('0xb'),_0x3ef0d8,_0x1ec5bd);_0x1b64bc(_0x1ec5bd);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 37d4f20..c5dd67c 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 _0x5c1f=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0x5c1f[_0x3f94f9];return _0x46f84f;};'use strict';var multer=require(_0xf5c1('0x0'));var util=require('util');var path=require(_0xf5c1('0x1'));var timeout=require(_0xf5c1('0x2'));var express=require('express');var router=express[_0xf5c1('0x3')]();var fs_extra=require(_0xf5c1('0x4'));var auth=require(_0xf5c1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0xf5c1('0x6')]('/',auth[_0xf5c1('0x7')](),controller['index']);router[_0xf5c1('0x6')](_0xf5c1('0x8'),auth[_0xf5c1('0x7')](),controller[_0xf5c1('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf5c1('0x8'),auth[_0xf5c1('0x7')](),controller[_0xf5c1('0xa')]);router[_0xf5c1('0xb')](_0xf5c1('0x8'),auth[_0xf5c1('0x7')](),controller[_0xf5c1('0xc')]);module[_0xf5c1('0xd')]=router; \ No newline at end of file +var _0xf29c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf29c,0xc7));var _0xcf29=function(_0x45cec6,_0x2d2195){_0x45cec6=_0x45cec6-0x0;var _0x25710a=_0xf29c[_0x45cec6];return _0x25710a;};'use strict';var multer=require('multer');var util=require(_0xcf29('0x0'));var path=require(_0xcf29('0x1'));var timeout=require(_0xcf29('0x2'));var express=require(_0xcf29('0x3'));var router=express[_0xcf29('0x4')]();var fs_extra=require(_0xcf29('0x5'));var auth=require(_0xcf29('0x6'));var interaction=require(_0xcf29('0x7'));var config=require(_0xcf29('0x8'));var controller=require(_0xcf29('0x9'));router[_0xcf29('0xa')]('/',auth[_0xcf29('0xb')](),controller[_0xcf29('0xc')]);router[_0xcf29('0xa')](_0xcf29('0xd'),auth[_0xcf29('0xb')](),controller['show']);router['post']('/',auth[_0xcf29('0xb')](),controller[_0xcf29('0xe')]);router[_0xcf29('0xf')](_0xcf29('0xd'),auth[_0xcf29('0xb')](),controller[_0xcf29('0x10')]);router[_0xcf29('0x11')](_0xcf29('0xd'),auth[_0xcf29('0xb')](),controller[_0xcf29('0x12')]);module[_0xcf29('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index e2e08ef..677b49d 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 _0x6b19=['sequelize','exports'];(function(_0x204acd,_0x11f6f6){var _0x2bcf2e=function(_0x418400){while(--_0x418400){_0x204acd['push'](_0x204acd['shift']());}};_0x2bcf2e(++_0x11f6f6);}(_0x6b19,0xe8));var _0x96b1=function(_0x3a726f,_0x94d6c8){_0x3a726f=_0x3a726f-0x0;var _0x3fa939=_0x6b19[_0x3a726f];return _0x3fa939;};'use strict';var Sequelize=require(_0x96b1('0x0'));module[_0x96b1('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xd1ac=['exports','sequelize'];(function(_0x33498a,_0x34b9d1){var _0x37ac48=function(_0x3342c2){while(--_0x3342c2){_0x33498a['push'](_0x33498a['shift']());}};_0x37ac48(++_0x34b9d1);}(_0xd1ac,0x18d));var _0xcd1a=function(_0x59575d,_0x3c389b){_0x59575d=_0x59575d-0x0;var _0x4a6ad4=_0xd1ac[_0x59575d];return _0x4a6ad4;};'use strict';var Sequelize=require(_0xcd1a('0x0'));module[_0xcd1a('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 659e194..3e9ff0c 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 _0xfec1=['Content-Range','reject','save','update','then','end','error','send','index','map','rawAttributes','fieldName','type','key','model','name','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','AnalyticTreeReport','rows','catch','show','params','keys','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfec1,0x196));var _0x1fec=function(_0x332888,_0x23d697){_0x332888=_0x332888-0x0;var _0x261dff=_0xfec1[_0x332888];return _0x261dff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fec('0x0'));var zipdir=require(_0x1fec('0x1'));var jsonpatch=require(_0x1fec('0x2'));var rp=require(_0x1fec('0x3'));var moment=require(_0x1fec('0x4'));var BPromise=require(_0x1fec('0x5'));var Mustache=require(_0x1fec('0x6'));var util=require(_0x1fec('0x7'));var path=require('path');var sox=require(_0x1fec('0x8'));var csv=require(_0x1fec('0x9'));var ejs=require(_0x1fec('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fec('0xb'));var squel=require(_0x1fec('0xc'));var crypto=require('crypto');var jsforce=require(_0x1fec('0xd'));var deskjs=require(_0x1fec('0xe'));var toCsv=require(_0x1fec('0x9'));var querystring=require(_0x1fec('0xf'));var Papa=require(_0x1fec('0x10'));var Redis=require(_0x1fec('0x11'));var authService=require(_0x1fec('0x12'));var qs=require(_0x1fec('0x13'));var as=require(_0x1fec('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1fec('0x15'));var utils=require(_0x1fec('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1fec('0x17'));var db=require(_0x1fec('0x18'))['db'];function respondWithStatusCode(_0x5f3e7b,_0x45c8e1){_0x45c8e1=_0x45c8e1||0xcc;return function(_0x4b4891){if(_0x4b4891){return _0x5f3e7b[_0x1fec('0x19')](_0x45c8e1);}return _0x5f3e7b[_0x1fec('0x1a')](_0x45c8e1)['end']();};}function respondWithResult(_0x238f49,_0x354919){_0x354919=_0x354919||0xc8;return function(_0x253264){if(_0x253264){return _0x238f49[_0x1fec('0x1a')](_0x354919)[_0x1fec('0x1b')](_0x253264);}};}function respondWithFilteredResult(_0x24d04e,_0x285672){return function(_0x56a777){if(_0x56a777){var _0x231576=typeof _0x285672[_0x1fec('0x1c')]===_0x1fec('0x1d')&&typeof _0x285672[_0x1fec('0x1e')]===_0x1fec('0x1d');var _0x5210b1=_0x56a777[_0x1fec('0x1f')];var _0x312d82=_0x231576?0x0:_0x285672['offset'];var _0x198f57=_0x231576?_0x56a777[_0x1fec('0x1f')]:_0x285672[_0x1fec('0x1c')]+_0x285672[_0x1fec('0x1e')];var _0x1b90a2;if(_0x198f57>=_0x5210b1){_0x198f57=_0x5210b1;_0x1b90a2=0xc8;}else{_0x1b90a2=0xce;}_0x24d04e[_0x1fec('0x1a')](_0x1b90a2);return _0x24d04e['set'](_0x1fec('0x20'),_0x312d82+'-'+_0x198f57+'/'+_0x5210b1)['json'](_0x56a777);}return null;};}function patchUpdates(_0x52215a){return function(_0x416da5){try{jsonpatch['apply'](_0x416da5,_0x52215a,!![]);}catch(_0x3bc737){return BPromise[_0x1fec('0x21')](_0x3bc737);}return _0x416da5[_0x1fec('0x22')]();};}function saveUpdates(_0x17fda0,_0x3cc32f){return function(_0x4f5b09){if(_0x4f5b09){return _0x4f5b09[_0x1fec('0x23')](_0x17fda0)[_0x1fec('0x24')](function(_0x5c2e60){return _0x5c2e60;});}return null;};}function removeEntity(_0x1570d3,_0x568e51){return function(_0x538fc1){if(_0x538fc1){return _0x538fc1['destroy']()[_0x1fec('0x24')](function(){_0x1570d3['status'](0xcc)[_0x1fec('0x25')]();});}};}function handleEntityNotFound(_0x525055,_0x3ea836){return function(_0x5b42c6){if(!_0x5b42c6){_0x525055['sendStatus'](0x194);}return _0x5b42c6;};}function handleError(_0x4bb3c2,_0x3d3f9e){_0x3d3f9e=_0x3d3f9e||0x1f4;return function(_0x330279){logger[_0x1fec('0x26')](_0x330279['stack']);if(_0x330279['name']){delete _0x330279['name'];}_0x4bb3c2['status'](_0x3d3f9e)[_0x1fec('0x27')](_0x330279);};}exports[_0x1fec('0x28')]=function(_0x4a7755,_0x6580f1){var _0x32e556={},_0x551df3={},_0x1750b7={'count':0x0,'rows':[]};var _0x2597ee=_[_0x1fec('0x29')](db['AnalyticTreeReport'][_0x1fec('0x2a')],function(_0x13d9d0){return{'name':_0x13d9d0[_0x1fec('0x2b')],'type':_0x13d9d0[_0x1fec('0x2c')][_0x1fec('0x2d')]};});_0x551df3[_0x1fec('0x2e')]=_[_0x1fec('0x29')](_0x2597ee,_0x1fec('0x2f'));_0x551df3[_0x1fec('0x30')]=_['keys'](_0x4a7755[_0x1fec('0x30')]);_0x551df3['filters']=_['intersection'](_0x551df3[_0x1fec('0x2e')],_0x551df3['query']);_0x32e556[_0x1fec('0x31')]=_[_0x1fec('0x32')](_0x551df3[_0x1fec('0x2e')],qs['fields'](_0x4a7755[_0x1fec('0x30')][_0x1fec('0x33')]));_0x32e556[_0x1fec('0x31')]=_0x32e556[_0x1fec('0x31')][_0x1fec('0x34')]?_0x32e556['attributes']:_0x551df3['model'];if(!_0x4a7755[_0x1fec('0x30')][_0x1fec('0x35')]('nolimit')){_0x32e556[_0x1fec('0x1e')]=qs[_0x1fec('0x1e')](_0x4a7755['query'][_0x1fec('0x1e')]);_0x32e556[_0x1fec('0x1c')]=qs[_0x1fec('0x1c')](_0x4a7755[_0x1fec('0x30')][_0x1fec('0x1c')]);}_0x32e556[_0x1fec('0x36')]=qs[_0x1fec('0x37')](_0x4a7755[_0x1fec('0x30')]['sort']);_0x32e556[_0x1fec('0x38')]=qs[_0x1fec('0x39')](_['pick'](_0x4a7755[_0x1fec('0x30')],_0x551df3[_0x1fec('0x39')]),_0x2597ee);if(_0x4a7755[_0x1fec('0x30')][_0x1fec('0x3a')]){_0x32e556[_0x1fec('0x38')]=_[_0x1fec('0x3b')](_0x32e556[_0x1fec('0x38')],{'$or':_[_0x1fec('0x29')](_0x2597ee,function(_0x3d19f){if(_0x3d19f[_0x1fec('0x2c')]!==_0x1fec('0x3c')){var _0x21a56d={};_0x21a56d[_0x3d19f[_0x1fec('0x2f')]]={'$like':'%'+_0x4a7755[_0x1fec('0x30')][_0x1fec('0x3a')]+'%'};return _0x21a56d;}})});}_0x32e556=_[_0x1fec('0x3b')]({},_0x32e556,_0x4a7755['options']);var _0x17aa2c={'where':_0x32e556[_0x1fec('0x38')]};return db['AnalyticTreeReport'][_0x1fec('0x1f')](_0x17aa2c)[_0x1fec('0x24')](function(_0x3a924c){_0x1750b7[_0x1fec('0x1f')]=_0x3a924c;if(_0x4a7755[_0x1fec('0x30')][_0x1fec('0x3d')]){_0x32e556[_0x1fec('0x3e')]=[{'all':!![]}];}return db[_0x1fec('0x3f')]['findAll'](_0x32e556);})['then'](function(_0x58f4fb){_0x1750b7[_0x1fec('0x40')]=_0x58f4fb;return _0x1750b7;})[_0x1fec('0x24')](respondWithFilteredResult(_0x6580f1,_0x32e556))[_0x1fec('0x41')](handleError(_0x6580f1,null));};exports[_0x1fec('0x42')]=function(_0x2b0449,_0x345dc0){var _0x2a2b37={'raw':!![],'where':{'id':_0x2b0449[_0x1fec('0x43')]['id']}},_0x44f6c7={};_0x44f6c7[_0x1fec('0x2e')]=_[_0x1fec('0x44')](db[_0x1fec('0x3f')]['rawAttributes']);_0x44f6c7['query']=_['keys'](_0x2b0449[_0x1fec('0x30')]);_0x44f6c7[_0x1fec('0x39')]=_[_0x1fec('0x32')](_0x44f6c7[_0x1fec('0x2e')],_0x44f6c7[_0x1fec('0x30')]);_0x2a2b37[_0x1fec('0x31')]=_['intersection'](_0x44f6c7[_0x1fec('0x2e')],qs[_0x1fec('0x33')](_0x2b0449[_0x1fec('0x30')][_0x1fec('0x33')]));_0x2a2b37['attributes']=_0x2a2b37[_0x1fec('0x31')]['length']?_0x2a2b37[_0x1fec('0x31')]:_0x44f6c7[_0x1fec('0x2e')];if(_0x2b0449[_0x1fec('0x30')][_0x1fec('0x3d')]){_0x2a2b37['include']=[{'all':!![]}];}_0x2a2b37=_[_0x1fec('0x3b')]({},_0x2a2b37,_0x2b0449['options']);return db[_0x1fec('0x3f')][_0x1fec('0x45')](_0x2a2b37)[_0x1fec('0x24')](handleEntityNotFound(_0x345dc0,null))['then'](respondWithResult(_0x345dc0,null))[_0x1fec('0x41')](handleError(_0x345dc0,null));};exports[_0x1fec('0x46')]=function(_0x456625,_0x1863d3){return db['AnalyticTreeReport'][_0x1fec('0x46')](_0x456625[_0x1fec('0x47')],{})['then'](respondWithResult(_0x1863d3,0xc9))[_0x1fec('0x41')](handleError(_0x1863d3,null));};exports['update']=function(_0x2f2c10,_0x214fe5){if(_0x2f2c10['body']['id']){delete _0x2f2c10[_0x1fec('0x47')]['id'];}return db[_0x1fec('0x3f')][_0x1fec('0x45')]({'where':{'id':_0x2f2c10[_0x1fec('0x43')]['id']}})[_0x1fec('0x24')](handleEntityNotFound(_0x214fe5,null))[_0x1fec('0x24')](saveUpdates(_0x2f2c10[_0x1fec('0x47')],null))[_0x1fec('0x24')](respondWithResult(_0x214fe5,null))[_0x1fec('0x41')](handleError(_0x214fe5,null));};exports[_0x1fec('0x48')]=function(_0x358a98,_0x13b359){return db[_0x1fec('0x3f')][_0x1fec('0x45')]({'where':{'id':_0x358a98[_0x1fec('0x43')]['id']}})[_0x1fec('0x24')](handleEntityNotFound(_0x13b359,null))[_0x1fec('0x24')](removeEntity(_0x13b359,null))[_0x1fec('0x41')](handleError(_0x13b359,null));}; \ No newline at end of file +var _0xf360=['rimraf','zip-dir','fast-json-patch','mustache','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','update','body','eml-format'];(function(_0x4c5561,_0x36eae8){var _0x5b91f9=function(_0x19a73c){while(--_0x19a73c){_0x4c5561['push'](_0x4c5561['shift']());}};_0x5b91f9(++_0x36eae8);}(_0xf360,0x158));var _0x0f36=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xf360[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x0f36('0x0'));var rimraf=require(_0x0f36('0x1'));var zipdir=require(_0x0f36('0x2'));var jsonpatch=require(_0x0f36('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0f36('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0f36('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f36('0x6'));var _=require(_0x0f36('0x7'));var squel=require(_0x0f36('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f36('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0f36('0xa'));var Papa=require(_0x0f36('0xb'));var Redis=require(_0x0f36('0xc'));var authService=require(_0x0f36('0xd'));var qs=require(_0x0f36('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f36('0xf'))(_0x0f36('0x10'));var utils=require(_0x0f36('0x11'));var config=require(_0x0f36('0x12'));var licenseUtil=require(_0x0f36('0x13'));var db=require(_0x0f36('0x14'))['db'];function respondWithStatusCode(_0x5cf325,_0x18cbe4){_0x18cbe4=_0x18cbe4||0xcc;return function(_0x347a02){if(_0x347a02){return _0x5cf325[_0x0f36('0x15')](_0x18cbe4);}return _0x5cf325[_0x0f36('0x16')](_0x18cbe4)[_0x0f36('0x17')]();};}function respondWithResult(_0x288491,_0x412698){_0x412698=_0x412698||0xc8;return function(_0x255d4b){if(_0x255d4b){return _0x288491[_0x0f36('0x16')](_0x412698)[_0x0f36('0x18')](_0x255d4b);}};}function respondWithFilteredResult(_0xb81f77,_0xf3d8bd){return function(_0x21671b){if(_0x21671b){var _0x1fc4b1=typeof _0xf3d8bd[_0x0f36('0x19')]==='undefined'&&typeof _0xf3d8bd[_0x0f36('0x1a')]==='undefined';var _0x325ea7=_0x21671b[_0x0f36('0x1b')];var _0x293661=_0x1fc4b1?0x0:_0xf3d8bd['offset'];var _0x39d541=_0x1fc4b1?_0x21671b['count']:_0xf3d8bd[_0x0f36('0x19')]+_0xf3d8bd['limit'];var _0x5b0276;if(_0x39d541>=_0x325ea7){_0x39d541=_0x325ea7;_0x5b0276=0xc8;}else{_0x5b0276=0xce;}_0xb81f77[_0x0f36('0x16')](_0x5b0276);return _0xb81f77['set'](_0x0f36('0x1c'),_0x293661+'-'+_0x39d541+'/'+_0x325ea7)[_0x0f36('0x18')](_0x21671b);}return null;};}function patchUpdates(_0x5c54e7){return function(_0x159fad){try{jsonpatch[_0x0f36('0x1d')](_0x159fad,_0x5c54e7,!![]);}catch(_0x232b45){return BPromise[_0x0f36('0x1e')](_0x232b45);}return _0x159fad['save']();};}function saveUpdates(_0x308d5c,_0x369e59){return function(_0x302775){if(_0x302775){return _0x302775['update'](_0x308d5c)[_0x0f36('0x1f')](function(_0x59b77f){return _0x59b77f;});}return null;};}function removeEntity(_0x655c80,_0x47603a){return function(_0x5caa74){if(_0x5caa74){return _0x5caa74[_0x0f36('0x20')]()[_0x0f36('0x1f')](function(){_0x655c80[_0x0f36('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1d03,_0xe85a53){return function(_0x4e246c){if(!_0x4e246c){_0x2d1d03[_0x0f36('0x15')](0x194);}return _0x4e246c;};}function handleError(_0x4a6d5d,_0x3101d0){_0x3101d0=_0x3101d0||0x1f4;return function(_0x2f2570){logger[_0x0f36('0x21')](_0x2f2570[_0x0f36('0x22')]);if(_0x2f2570[_0x0f36('0x23')]){delete _0x2f2570[_0x0f36('0x23')];}_0x4a6d5d[_0x0f36('0x16')](_0x3101d0)['send'](_0x2f2570);};}exports[_0x0f36('0x24')]=function(_0x1a7bcc,_0x340809){var _0x6ba308={},_0xf45b9={},_0x26c4ff={'count':0x0,'rows':[]};var _0x4b6e83=_[_0x0f36('0x25')](db[_0x0f36('0x26')][_0x0f36('0x27')],function(_0x267385){return{'name':_0x267385[_0x0f36('0x28')],'type':_0x267385['type'][_0x0f36('0x29')]};});_0xf45b9[_0x0f36('0x2a')]=_[_0x0f36('0x25')](_0x4b6e83,_0x0f36('0x23'));_0xf45b9[_0x0f36('0x2b')]=_[_0x0f36('0x2c')](_0x1a7bcc[_0x0f36('0x2b')]);_0xf45b9['filters']=_[_0x0f36('0x2d')](_0xf45b9[_0x0f36('0x2a')],_0xf45b9[_0x0f36('0x2b')]);_0x6ba308['attributes']=_[_0x0f36('0x2d')](_0xf45b9[_0x0f36('0x2a')],qs[_0x0f36('0x2e')](_0x1a7bcc[_0x0f36('0x2b')][_0x0f36('0x2e')]));_0x6ba308[_0x0f36('0x2f')]=_0x6ba308[_0x0f36('0x2f')][_0x0f36('0x30')]?_0x6ba308[_0x0f36('0x2f')]:_0xf45b9[_0x0f36('0x2a')];if(!_0x1a7bcc[_0x0f36('0x2b')][_0x0f36('0x31')](_0x0f36('0x32'))){_0x6ba308[_0x0f36('0x1a')]=qs['limit'](_0x1a7bcc[_0x0f36('0x2b')][_0x0f36('0x1a')]);_0x6ba308['offset']=qs[_0x0f36('0x19')](_0x1a7bcc[_0x0f36('0x2b')][_0x0f36('0x19')]);}_0x6ba308[_0x0f36('0x33')]=qs['sort'](_0x1a7bcc[_0x0f36('0x2b')]['sort']);_0x6ba308[_0x0f36('0x34')]=qs[_0x0f36('0x35')](_['pick'](_0x1a7bcc['query'],_0xf45b9[_0x0f36('0x35')]),_0x4b6e83);if(_0x1a7bcc[_0x0f36('0x2b')][_0x0f36('0x36')]){_0x6ba308[_0x0f36('0x34')]=_[_0x0f36('0x37')](_0x6ba308[_0x0f36('0x34')],{'$or':_[_0x0f36('0x25')](_0x4b6e83,function(_0x45ede8){if(_0x45ede8['type']!==_0x0f36('0x38')){var _0x303a23={};_0x303a23[_0x45ede8[_0x0f36('0x23')]]={'$like':'%'+_0x1a7bcc[_0x0f36('0x2b')][_0x0f36('0x36')]+'%'};return _0x303a23;}})});}_0x6ba308=_[_0x0f36('0x37')]({},_0x6ba308,_0x1a7bcc[_0x0f36('0x39')]);var _0xcb7daa={'where':_0x6ba308['where']};return db[_0x0f36('0x26')][_0x0f36('0x1b')](_0xcb7daa)['then'](function(_0x5ba2c4){_0x26c4ff['count']=_0x5ba2c4;if(_0x1a7bcc[_0x0f36('0x2b')]['includeAll']){_0x6ba308['include']=[{'all':!![]}];}return db[_0x0f36('0x26')][_0x0f36('0x3a')](_0x6ba308);})[_0x0f36('0x1f')](function(_0x21420e){_0x26c4ff[_0x0f36('0x3b')]=_0x21420e;return _0x26c4ff;})['then'](respondWithFilteredResult(_0x340809,_0x6ba308))[_0x0f36('0x3c')](handleError(_0x340809,null));};exports[_0x0f36('0x3d')]=function(_0x4072a4,_0x9efdfa){var _0x114f35={'raw':!![],'where':{'id':_0x4072a4[_0x0f36('0x3e')]['id']}},_0x4ac12e={};_0x4ac12e[_0x0f36('0x2a')]=_[_0x0f36('0x2c')](db['AnalyticTreeReport'][_0x0f36('0x27')]);_0x4ac12e[_0x0f36('0x2b')]=_['keys'](_0x4072a4[_0x0f36('0x2b')]);_0x4ac12e[_0x0f36('0x35')]=_[_0x0f36('0x2d')](_0x4ac12e[_0x0f36('0x2a')],_0x4ac12e['query']);_0x114f35['attributes']=_[_0x0f36('0x2d')](_0x4ac12e[_0x0f36('0x2a')],qs['fields'](_0x4072a4['query'][_0x0f36('0x2e')]));_0x114f35[_0x0f36('0x2f')]=_0x114f35[_0x0f36('0x2f')][_0x0f36('0x30')]?_0x114f35[_0x0f36('0x2f')]:_0x4ac12e[_0x0f36('0x2a')];if(_0x4072a4[_0x0f36('0x2b')][_0x0f36('0x3f')]){_0x114f35[_0x0f36('0x40')]=[{'all':!![]}];}_0x114f35=_[_0x0f36('0x37')]({},_0x114f35,_0x4072a4['options']);return db[_0x0f36('0x26')][_0x0f36('0x41')](_0x114f35)['then'](handleEntityNotFound(_0x9efdfa,null))[_0x0f36('0x1f')](respondWithResult(_0x9efdfa,null))[_0x0f36('0x3c')](handleError(_0x9efdfa,null));};exports[_0x0f36('0x42')]=function(_0x12835f,_0x2f5dda){return db[_0x0f36('0x26')][_0x0f36('0x42')](_0x12835f['body'],{})['then'](respondWithResult(_0x2f5dda,0xc9))[_0x0f36('0x3c')](handleError(_0x2f5dda,null));};exports[_0x0f36('0x43')]=function(_0x3e24ef,_0x335409){if(_0x3e24ef[_0x0f36('0x44')]['id']){delete _0x3e24ef[_0x0f36('0x44')]['id'];}return db[_0x0f36('0x26')][_0x0f36('0x41')]({'where':{'id':_0x3e24ef[_0x0f36('0x3e')]['id']}})[_0x0f36('0x1f')](handleEntityNotFound(_0x335409,null))[_0x0f36('0x1f')](saveUpdates(_0x3e24ef[_0x0f36('0x44')],null))[_0x0f36('0x1f')](respondWithResult(_0x335409,null))[_0x0f36('0x3c')](handleError(_0x335409,null));};exports[_0x0f36('0x20')]=function(_0x3d6525,_0x3687ca){return db[_0x0f36('0x26')][_0x0f36('0x41')]({'where':{'id':_0x3d6525[_0x0f36('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3687ca,null))[_0x0f36('0x1f')](removeEntity(_0x3687ca,null))[_0x0f36('0x3c')](handleError(_0x3687ca,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index af06683..afe8d45 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 _0x62c8=['../../config/logger','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x2c4102,_0x192c7f){var _0x52e02c=function(_0x526df7){while(--_0x526df7){_0x2c4102['push'](_0x2c4102['shift']());}};_0x52e02c(++_0x192c7f);}(_0x62c8,0x169));var _0x862c=function(_0x374a81,_0x571052){_0x374a81=_0x374a81-0x0;var _0x50f580=_0x62c8[_0x374a81];return _0x50f580;};'use strict';var _=require(_0x862c('0x0'));var util=require(_0x862c('0x1'));var logger=require(_0x862c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x862c('0x3'));var rp=require(_0x862c('0x4'));var fs=require('fs');var path=require(_0x862c('0x5'));var rimraf=require(_0x862c('0x6'));var config=require('../../config/environment');var attributes=require(_0x862c('0x7'));module[_0x862c('0x8')]=function(_0x5b6067,_0xdc07c3){return _0x5b6067['define'](_0x862c('0x9'),attributes,{'tableName':_0x862c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x358b=['path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0xe501ff,_0x955b7e){var _0x17135d=function(_0x8e3458){while(--_0x8e3458){_0xe501ff['push'](_0xe501ff['shift']());}};_0x17135d(++_0x955b7e);}(_0x358b,0x140));var _0xb358=function(_0xdf4cdb,_0x4407ff){_0xdf4cdb=_0xdf4cdb-0x0;var _0x256475=_0x358b[_0xdf4cdb];return _0x256475;};'use strict';var _=require(_0xb358('0x0'));var util=require(_0xb358('0x1'));var logger=require(_0xb358('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb358('0x3'));var rp=require(_0xb358('0x4'));var fs=require('fs');var path=require(_0xb358('0x5'));var rimraf=require(_0xb358('0x6'));var config=require(_0xb358('0x7'));var attributes=require(_0xb358('0x8'));module[_0xb358('0x9')]=function(_0x2792c3,_0x1eb194){return _0x2792c3[_0xb358('0xa')](_0xb358('0xb'),attributes,{'tableName':_0xb358('0xc'),'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 ff0ac7d..15304b5 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2f1ac4,_0x236a72){var _0x18e1a5=function(_0x18f34b){while(--_0x18f34b){_0x2f1ac4['push'](_0x2f1ac4['shift']());}};_0x18e1a5(++_0x236a72);}(_0x2ef3,0xba));var _0x32ef=function(_0x2af6fd,_0xb2798d){_0x2af6fd=_0x2af6fd-0x0;var _0x2da8d9=_0x2ef3[_0x2af6fd];return _0x2da8d9;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0xd4fb2,_0x436540){var _0x81fc39=function(_0x494802){while(--_0x494802){_0xd4fb2['push'](_0xd4fb2['shift']());}};_0x81fc39(++_0x436540);}(_0x5f2f,0x73));var _0xf5f2=function(_0x873500,_0x3f8480){_0x873500=_0x873500-0x0;var _0x5eedcb=_0x5f2f[_0x873500];return _0x5eedcb;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 1329ae2..56da71f 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 _0xc4a8=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','post'];(function(_0x2d033d,_0x5bf31a){var _0x36ea6c=function(_0x22f07f){while(--_0x22f07f){_0x2d033d['push'](_0x2d033d['shift']());}};_0x36ea6c(++_0x5bf31a);}(_0xc4a8,0x193));var _0x8c4a=function(_0x346b92,_0x286185){_0x346b92=_0x346b92-0x0;var _0x5a8e1c=_0xc4a8[_0x346b92];return _0x5a8e1c;};'use strict';var multer=require(_0x8c4a('0x0'));var util=require(_0x8c4a('0x1'));var path=require(_0x8c4a('0x2'));var timeout=require(_0x8c4a('0x3'));var express=require(_0x8c4a('0x4'));var router=express[_0x8c4a('0x5')]();var fs_extra=require(_0x8c4a('0x6'));var auth=require(_0x8c4a('0x7'));var interaction=require(_0x8c4a('0x8'));var config=require(_0x8c4a('0x9'));var controller=require(_0x8c4a('0xa'));router[_0x8c4a('0xb')]('/',auth[_0x8c4a('0xc')](),controller['index']);router['get'](_0x8c4a('0xd'),auth[_0x8c4a('0xc')](),controller['show']);router[_0x8c4a('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8c4a('0xf')](_0x8c4a('0xd'),auth[_0x8c4a('0xc')](),controller[_0x8c4a('0x10')]);router['delete']('/:id',auth[_0x8c4a('0xc')](),controller[_0x8c4a('0x11')]);module[_0x8c4a('0x12')]=router; \ No newline at end of file +var _0x460c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x460c,0x160));var _0xc460=function(_0x24a6da,_0x3f7abe){_0x24a6da=_0x24a6da-0x0;var _0x1f19e6=_0x460c[_0x24a6da];return _0x1f19e6;};'use strict';var multer=require(_0xc460('0x0'));var util=require(_0xc460('0x1'));var path=require(_0xc460('0x2'));var timeout=require(_0xc460('0x3'));var express=require(_0xc460('0x4'));var router=express[_0xc460('0x5')]();var fs_extra=require(_0xc460('0x6'));var auth=require(_0xc460('0x7'));var interaction=require(_0xc460('0x8'));var config=require(_0xc460('0x9'));var controller=require(_0xc460('0xa'));router[_0xc460('0xb')]('/',auth[_0xc460('0xc')](),controller[_0xc460('0xd')]);router[_0xc460('0xb')](_0xc460('0xe'),auth[_0xc460('0xc')](),controller[_0xc460('0xf')]);router['post']('/',auth[_0xc460('0xc')](),controller[_0xc460('0x10')]);router['put'](_0xc460('0xe'),auth['isAuthenticated'](),controller[_0xc460('0x11')]);router[_0xc460('0x12')](_0xc460('0xe'),auth['isAuthenticated'](),controller[_0xc460('0x13')]);module[_0xc460('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 279c896..a96ea1c 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 _0x8bdf=['sequelize','exports','STRING'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8bdf[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xf8bd('0x0'));module[_0xf8bd('0x1')]={'name':{'type':Sequelize[_0xf8bd('0x2')]},'basename':{'type':Sequelize[_0xf8bd('0x2')]},'type':{'type':Sequelize[_0xf8bd('0x2')]}}; \ No newline at end of file +var _0x5db8=['STRING','sequelize','exports'];(function(_0x1978a2,_0x10284){var _0x313bf1=function(_0x30c3ba){while(--_0x30c3ba){_0x1978a2['push'](_0x1978a2['shift']());}};_0x313bf1(++_0x10284);}(_0x5db8,0xbb));var _0x85db=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0x5db8[_0x28fe94];return _0x3560da;};'use strict';var Sequelize=require(_0x85db('0x0'));module[_0x85db('0x1')]={'name':{'type':Sequelize[_0x85db('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x85db('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9816eba..5488536 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 _0xf1d9=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','Attachment','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','find','clone','params','get','updatedAt','body','createdAt','create','file','originalname','basename','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5f5cce,_0x138cc5){var _0x705ecf=function(_0x28bc5d){while(--_0x28bc5d){_0x5f5cce['push'](_0x5f5cce['shift']());}};_0x705ecf(++_0x138cc5);}(_0xf1d9,0x1a9));var _0x9f1d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9f1d('0x0'));var rimraf=require(_0x9f1d('0x1'));var zipdir=require(_0x9f1d('0x2'));var jsonpatch=require(_0x9f1d('0x3'));var rp=require(_0x9f1d('0x4'));var moment=require(_0x9f1d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9f1d('0x6'));var util=require(_0x9f1d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9f1d('0x8'));var ejs=require(_0x9f1d('0x9'));var fs=require('fs');var fs_extra=require(_0x9f1d('0xa'));var _=require(_0x9f1d('0xb'));var squel=require('squel');var crypto=require(_0x9f1d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9f1d('0xd'));var toCsv=require(_0x9f1d('0x8'));var querystring=require('querystring');var Papa=require(_0x9f1d('0xe'));var Redis=require(_0x9f1d('0xf'));var authService=require(_0x9f1d('0x10'));var qs=require(_0x9f1d('0x11'));var as=require(_0x9f1d('0x12'));var hardwareService=require(_0x9f1d('0x13'));var logger=require(_0x9f1d('0x14'))(_0x9f1d('0x15'));var utils=require(_0x9f1d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9f1d('0x17'));var db=require(_0x9f1d('0x18'))['db'];function respondWithStatusCode(_0x5e28dc,_0x205f19){_0x205f19=_0x205f19||0xcc;return function(_0x58791d){if(_0x58791d){return _0x5e28dc[_0x9f1d('0x19')](_0x205f19);}return _0x5e28dc['status'](_0x205f19)[_0x9f1d('0x1a')]();};}function respondWithResult(_0x5a7564,_0x2501fd){_0x2501fd=_0x2501fd||0xc8;return function(_0x47bba3){if(_0x47bba3){return _0x5a7564[_0x9f1d('0x1b')](_0x2501fd)[_0x9f1d('0x1c')](_0x47bba3);}};}function respondWithFilteredResult(_0x4855d4,_0x5140a5){return function(_0x32d667){if(_0x32d667){var _0x4966f6=typeof _0x5140a5['offset']==='undefined'&&typeof _0x5140a5['limit']==='undefined';var _0x542ad5=_0x32d667[_0x9f1d('0x1d')];var _0x33a1d3=_0x4966f6?0x0:_0x5140a5[_0x9f1d('0x1e')];var _0x24a270=_0x4966f6?_0x32d667['count']:_0x5140a5[_0x9f1d('0x1e')]+_0x5140a5[_0x9f1d('0x1f')];var _0x431f98;if(_0x24a270>=_0x542ad5){_0x24a270=_0x542ad5;_0x431f98=0xc8;}else{_0x431f98=0xce;}_0x4855d4[_0x9f1d('0x1b')](_0x431f98);return _0x4855d4[_0x9f1d('0x20')](_0x9f1d('0x21'),_0x33a1d3+'-'+_0x24a270+'/'+_0x542ad5)[_0x9f1d('0x1c')](_0x32d667);}return null;};}function patchUpdates(_0xdadd76){return function(_0x9382af){try{jsonpatch['apply'](_0x9382af,_0xdadd76,!![]);}catch(_0x39e9b9){return BPromise[_0x9f1d('0x22')](_0x39e9b9);}return _0x9382af[_0x9f1d('0x23')]();};}function saveUpdates(_0x172803,_0x3fcdf1){return function(_0xf95710){if(_0xf95710){return _0xf95710[_0x9f1d('0x24')](_0x172803)['then'](function(_0x2cf093){return _0x2cf093;});}return null;};}function removeEntity(_0x32adbf,_0x199a03){return function(_0xec41b5){if(_0xec41b5){return _0xec41b5[_0x9f1d('0x25')]()['then'](function(){_0x32adbf[_0x9f1d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7264da,_0x5dea66){return function(_0x3a6d63){if(!_0x3a6d63){_0x7264da[_0x9f1d('0x19')](0x194);}return _0x3a6d63;};}function handleError(_0x209691,_0x29ef53){_0x29ef53=_0x29ef53||0x1f4;return function(_0x3304fc){logger[_0x9f1d('0x26')](_0x3304fc[_0x9f1d('0x27')]);if(_0x3304fc['name']){delete _0x3304fc[_0x9f1d('0x28')];}_0x209691[_0x9f1d('0x1b')](_0x29ef53)[_0x9f1d('0x29')](_0x3304fc);};}exports[_0x9f1d('0x2a')]=function(_0xbdf40d,_0x2a538a){var _0x5a1e9e={},_0x5b87e1={},_0xe5425b={'count':0x0,'rows':[]};var _0x8c25ce=_[_0x9f1d('0x2b')](db[_0x9f1d('0x2c')]['rawAttributes'],function(_0x1387a8){return{'name':_0x1387a8['fieldName'],'type':_0x1387a8['type']['key']};});_0x5b87e1[_0x9f1d('0x2d')]=_[_0x9f1d('0x2b')](_0x8c25ce,_0x9f1d('0x28'));_0x5b87e1[_0x9f1d('0x2e')]=_['keys'](_0xbdf40d[_0x9f1d('0x2e')]);_0x5b87e1[_0x9f1d('0x2f')]=_[_0x9f1d('0x30')](_0x5b87e1[_0x9f1d('0x2d')],_0x5b87e1[_0x9f1d('0x2e')]);_0x5a1e9e['attributes']=_['intersection'](_0x5b87e1[_0x9f1d('0x2d')],qs[_0x9f1d('0x31')](_0xbdf40d[_0x9f1d('0x2e')]['fields']));_0x5a1e9e['attributes']=_0x5a1e9e[_0x9f1d('0x32')][_0x9f1d('0x33')]?_0x5a1e9e[_0x9f1d('0x32')]:_0x5b87e1['model'];if(!_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x34')](_0x9f1d('0x35'))){_0x5a1e9e[_0x9f1d('0x1f')]=qs[_0x9f1d('0x1f')](_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x1f')]);_0x5a1e9e[_0x9f1d('0x1e')]=qs[_0x9f1d('0x1e')](_0xbdf40d[_0x9f1d('0x2e')]['offset']);}_0x5a1e9e[_0x9f1d('0x36')]=qs['sort'](_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x37')]);_0x5a1e9e[_0x9f1d('0x38')]=qs[_0x9f1d('0x2f')](_['pick'](_0xbdf40d[_0x9f1d('0x2e')],_0x5b87e1[_0x9f1d('0x2f')]),_0x8c25ce);if(_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x39')]){_0x5a1e9e[_0x9f1d('0x38')]=_[_0x9f1d('0x3a')](_0x5a1e9e['where'],{'$or':_[_0x9f1d('0x2b')](_0x8c25ce,function(_0x1567c2){if(_0x1567c2[_0x9f1d('0x3b')]!==_0x9f1d('0x3c')){var _0x1a3c99={};_0x1a3c99[_0x1567c2['name']]={'$like':'%'+_0xbdf40d[_0x9f1d('0x2e')]['filter']+'%'};return _0x1a3c99;}})});}_0x5a1e9e=_[_0x9f1d('0x3a')]({},_0x5a1e9e,_0xbdf40d['options']);var _0x498141={'where':_0x5a1e9e[_0x9f1d('0x38')]};return db['Attachment'][_0x9f1d('0x1d')](_0x498141)[_0x9f1d('0x3d')](function(_0xfaf88a){_0xe5425b[_0x9f1d('0x1d')]=_0xfaf88a;if(_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x3e')]){_0x5a1e9e[_0x9f1d('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0x9f1d('0x40')](_0x5a1e9e);})[_0x9f1d('0x3d')](function(_0x5a1992){_0xe5425b[_0x9f1d('0x41')]=_0x5a1992;return _0xe5425b;})['then'](respondWithFilteredResult(_0x2a538a,_0x5a1e9e))[_0x9f1d('0x42')](handleError(_0x2a538a,null));};exports[_0x9f1d('0x43')]=function(_0x23ca40,_0x73260b){var _0x56cef3={'raw':!![],'where':{'id':_0x23ca40['params']['id']}},_0x383ef5={};_0x383ef5[_0x9f1d('0x2d')]=_['keys'](db[_0x9f1d('0x2c')][_0x9f1d('0x44')]);_0x383ef5['query']=_[_0x9f1d('0x45')](_0x23ca40[_0x9f1d('0x2e')]);_0x383ef5[_0x9f1d('0x2f')]=_[_0x9f1d('0x30')](_0x383ef5[_0x9f1d('0x2d')],_0x383ef5[_0x9f1d('0x2e')]);_0x56cef3[_0x9f1d('0x32')]=_['intersection'](_0x383ef5[_0x9f1d('0x2d')],qs['fields'](_0x23ca40[_0x9f1d('0x2e')][_0x9f1d('0x31')]));_0x56cef3[_0x9f1d('0x32')]=_0x56cef3['attributes'][_0x9f1d('0x33')]?_0x56cef3[_0x9f1d('0x32')]:_0x383ef5['model'];if(_0x23ca40[_0x9f1d('0x2e')][_0x9f1d('0x3e')]){_0x56cef3[_0x9f1d('0x3f')]=[{'all':!![]}];}_0x56cef3=_[_0x9f1d('0x3a')]({},_0x56cef3,_0x23ca40[_0x9f1d('0x46')]);return db[_0x9f1d('0x2c')][_0x9f1d('0x47')](_0x56cef3)[_0x9f1d('0x3d')](handleEntityNotFound(_0x73260b,null))[_0x9f1d('0x3d')](respondWithResult(_0x73260b,null))['catch'](handleError(_0x73260b,null));};exports[_0x9f1d('0x48')]=function(_0x171b4d,_0x4905a3){var _0x22a3af={'where':{'id':_0x171b4d[_0x9f1d('0x49')]['id']}},_0x29ad15={};_0x29ad15['model']=_[_0x9f1d('0x45')](db[_0x9f1d('0x2c')][_0x9f1d('0x44')]);_0x22a3af[_0x9f1d('0x32')]=_[_0x9f1d('0x30')](_0x29ad15[_0x9f1d('0x2d')],qs[_0x9f1d('0x31')](_0x171b4d[_0x9f1d('0x2e')][_0x9f1d('0x31')]));_0x22a3af[_0x9f1d('0x32')]=_0x22a3af[_0x9f1d('0x32')][_0x9f1d('0x33')]?_0x22a3af[_0x9f1d('0x32')]:_0x29ad15[_0x9f1d('0x2d')];if(_0x171b4d[_0x9f1d('0x2e')]['includeAll']){_0x22a3af[_0x9f1d('0x3f')]=[{'all':!![]}];}_0x22a3af=_[_0x9f1d('0x3a')]({},_0x22a3af,_0x171b4d['options']);return db[_0x9f1d('0x2c')][_0x9f1d('0x47')](_0x22a3af)['then'](handleEntityNotFound(_0x4905a3,null))[_0x9f1d('0x3d')](function(_0x5e414d){if(_0x5e414d){var _0x3d1f6a=_0x5e414d[_0x9f1d('0x4a')]({'plain':!![]});_0x3d1f6a=qs['omit'](_0x3d1f6a,['id','createdAt',_0x9f1d('0x4b')]);_0x171b4d[_0x9f1d('0x4c')]=_['omit'](_0x171b4d[_0x9f1d('0x4c')],['id',_0x9f1d('0x4d'),_0x9f1d('0x4b')]);return db[_0x9f1d('0x2c')][_0x9f1d('0x4e')](_[_0x9f1d('0x3a')](_0x3d1f6a,_0x171b4d[_0x9f1d('0x4c')]),{'include':_0x171b4d[_0x9f1d('0x2e')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x9f1d('0x3d')](respondWithResult(_0x4905a3,0xc9))[_0x9f1d('0x42')](handleError(_0x4905a3,null));};exports[_0x9f1d('0x24')]=function(_0xbf603b,_0x861258){if(_0xbf603b['body']['id']){delete _0xbf603b[_0x9f1d('0x4c')]['id'];}return db[_0x9f1d('0x2c')]['find']({'where':{'id':_0xbf603b[_0x9f1d('0x49')]['id']}})[_0x9f1d('0x3d')](handleEntityNotFound(_0x861258,null))[_0x9f1d('0x3d')](saveUpdates(_0xbf603b[_0x9f1d('0x4c')],null))[_0x9f1d('0x3d')](respondWithResult(_0x861258,null))[_0x9f1d('0x42')](handleError(_0x861258,null));};exports['destroy']=function(_0x1a4fb0,_0x197eaa){return db[_0x9f1d('0x2c')][_0x9f1d('0x47')]({'where':{'id':_0x1a4fb0[_0x9f1d('0x49')]['id']}})[_0x9f1d('0x3d')](handleEntityNotFound(_0x197eaa,null))[_0x9f1d('0x3d')](removeEntity(_0x197eaa,null))[_0x9f1d('0x42')](handleError(_0x197eaa,null));};exports['create']=function(_0xfbb8c5,_0x5cdc31,_0x30ddf7){_0xfbb8c5[_0x9f1d('0x4c')]['name']=_0xfbb8c5[_0x9f1d('0x4f')][_0x9f1d('0x50')];_0xfbb8c5['body'][_0x9f1d('0x51')]=_0xfbb8c5[_0x9f1d('0x4f')][_0x9f1d('0x52')];_0xfbb8c5[_0x9f1d('0x4c')][_0x9f1d('0x3b')]=_0xfbb8c5[_0x9f1d('0x4f')]['mimetype'];return db[_0x9f1d('0x2c')]['create'](_0xfbb8c5[_0x9f1d('0x4c')])[_0x9f1d('0x3d')](respondWithResult(_0x5cdc31,0xc9))[_0x9f1d('0x42')](handleError(_0x5cdc31,null));};exports['download']=function(_0xd6089a,_0x4568f1,_0x38bf92){return db[_0x9f1d('0x2c')][_0x9f1d('0x53')]({'where':{'id':_0xd6089a[_0x9f1d('0x49')]['id']},'raw':!![]})[_0x9f1d('0x3d')](handleEntityNotFound(_0x4568f1,null))[_0x9f1d('0x3d')](function(_0xeaa598){if(_0xeaa598){var _0x498890=_0xeaa598[_0x9f1d('0x54')]!==null;var _0x5e6163=path[_0x9f1d('0x55')](config[_0x9f1d('0x56')],_0x9f1d('0x57'));if(_0x498890){_0x5e6163=path[_0x9f1d('0x55')](_0x5e6163,'offline-chat/');}var _0x5a759e=path[_0x9f1d('0x55')](_0x5e6163,_0xeaa598[_0x9f1d('0x51')]);return _0x4568f1[_0x9f1d('0x58')](_0x5a759e);}})[_0x9f1d('0x42')](handleError(_0x4568f1,null));}; \ No newline at end of file +var _0xe659=['mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','Attachment','include','rows','show','includeAll','options','find','catch','params','get','omit','createdAt','updatedAt','body','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','zip-dir','request-promise','moment'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0xe659,0xad));var _0x9e65=function(_0x2dca8c,_0x5583f5){_0x2dca8c=_0x2dca8c-0x0;var _0x1db10c=_0xe659[_0x2dca8c];return _0x1db10c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9e65('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e65('0x1'));var moment=require(_0x9e65('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9e65('0x3'));var util=require(_0x9e65('0x4'));var path=require('path');var sox=require(_0x9e65('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e65('0x6'));var _=require(_0x9e65('0x7'));var squel=require('squel');var crypto=require(_0x9e65('0x8'));var jsforce=require(_0x9e65('0x9'));var deskjs=require(_0x9e65('0xa'));var toCsv=require(_0x9e65('0xb'));var querystring=require(_0x9e65('0xc'));var Papa=require(_0x9e65('0xd'));var Redis=require(_0x9e65('0xe'));var authService=require(_0x9e65('0xf'));var qs=require(_0x9e65('0x10'));var as=require(_0x9e65('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e65('0x12'))(_0x9e65('0x13'));var utils=require(_0x9e65('0x14'));var config=require(_0x9e65('0x15'));var licenseUtil=require(_0x9e65('0x16'));var db=require(_0x9e65('0x17'))['db'];function respondWithStatusCode(_0x27d19d,_0x4302a7){_0x4302a7=_0x4302a7||0xcc;return function(_0x19761a){if(_0x19761a){return _0x27d19d[_0x9e65('0x18')](_0x4302a7);}return _0x27d19d[_0x9e65('0x19')](_0x4302a7)[_0x9e65('0x1a')]();};}function respondWithResult(_0x180d23,_0x15c605){_0x15c605=_0x15c605||0xc8;return function(_0x407554){if(_0x407554){return _0x180d23[_0x9e65('0x19')](_0x15c605)['json'](_0x407554);}};}function respondWithFilteredResult(_0xfd0f13,_0x2748b7){return function(_0x51fdee){if(_0x51fdee){var _0x497625=typeof _0x2748b7[_0x9e65('0x1b')]===_0x9e65('0x1c')&&typeof _0x2748b7[_0x9e65('0x1d')]===_0x9e65('0x1c');var _0x32b757=_0x51fdee[_0x9e65('0x1e')];var _0x249acf=_0x497625?0x0:_0x2748b7[_0x9e65('0x1b')];var _0x149454=_0x497625?_0x51fdee['count']:_0x2748b7['offset']+_0x2748b7[_0x9e65('0x1d')];var _0x395991;if(_0x149454>=_0x32b757){_0x149454=_0x32b757;_0x395991=0xc8;}else{_0x395991=0xce;}_0xfd0f13['status'](_0x395991);return _0xfd0f13[_0x9e65('0x1f')]('Content-Range',_0x249acf+'-'+_0x149454+'/'+_0x32b757)[_0x9e65('0x20')](_0x51fdee);}return null;};}function patchUpdates(_0x319eba){return function(_0x208d4f){try{jsonpatch[_0x9e65('0x21')](_0x208d4f,_0x319eba,!![]);}catch(_0x133766){return BPromise[_0x9e65('0x22')](_0x133766);}return _0x208d4f[_0x9e65('0x23')]();};}function saveUpdates(_0x1f898c,_0x346a8c){return function(_0x147251){if(_0x147251){return _0x147251[_0x9e65('0x24')](_0x1f898c)[_0x9e65('0x25')](function(_0x3c043d){return _0x3c043d;});}return null;};}function removeEntity(_0x1c49c2,_0x5b7eea){return function(_0x33d72b){if(_0x33d72b){return _0x33d72b[_0x9e65('0x26')]()[_0x9e65('0x25')](function(){_0x1c49c2[_0x9e65('0x19')](0xcc)[_0x9e65('0x1a')]();});}};}function handleEntityNotFound(_0x101159,_0x539758){return function(_0x3027d7){if(!_0x3027d7){_0x101159[_0x9e65('0x18')](0x194);}return _0x3027d7;};}function handleError(_0x32c370,_0x579ce7){_0x579ce7=_0x579ce7||0x1f4;return function(_0x2d0754){logger[_0x9e65('0x27')](_0x2d0754[_0x9e65('0x28')]);if(_0x2d0754[_0x9e65('0x29')]){delete _0x2d0754[_0x9e65('0x29')];}_0x32c370[_0x9e65('0x19')](_0x579ce7)['send'](_0x2d0754);};}exports[_0x9e65('0x2a')]=function(_0x166f35,_0x5efa7c){var _0x1e4193={},_0x4482d6={},_0x17599e={'count':0x0,'rows':[]};var _0x3d1aa2=_[_0x9e65('0x2b')](db['Attachment'][_0x9e65('0x2c')],function(_0x289034){return{'name':_0x289034[_0x9e65('0x2d')],'type':_0x289034[_0x9e65('0x2e')][_0x9e65('0x2f')]};});_0x4482d6[_0x9e65('0x30')]=_['map'](_0x3d1aa2,'name');_0x4482d6['query']=_[_0x9e65('0x31')](_0x166f35[_0x9e65('0x32')]);_0x4482d6[_0x9e65('0x33')]=_[_0x9e65('0x34')](_0x4482d6['model'],_0x4482d6['query']);_0x1e4193['attributes']=_[_0x9e65('0x34')](_0x4482d6['model'],qs[_0x9e65('0x35')](_0x166f35[_0x9e65('0x32')][_0x9e65('0x35')]));_0x1e4193['attributes']=_0x1e4193['attributes'][_0x9e65('0x36')]?_0x1e4193[_0x9e65('0x37')]:_0x4482d6[_0x9e65('0x30')];if(!_0x166f35[_0x9e65('0x32')][_0x9e65('0x38')](_0x9e65('0x39'))){_0x1e4193['limit']=qs['limit'](_0x166f35[_0x9e65('0x32')][_0x9e65('0x1d')]);_0x1e4193[_0x9e65('0x1b')]=qs['offset'](_0x166f35[_0x9e65('0x32')]['offset']);}_0x1e4193['order']=qs[_0x9e65('0x3a')](_0x166f35['query'][_0x9e65('0x3a')]);_0x1e4193[_0x9e65('0x3b')]=qs[_0x9e65('0x33')](_['pick'](_0x166f35[_0x9e65('0x32')],_0x4482d6[_0x9e65('0x33')]),_0x3d1aa2);if(_0x166f35[_0x9e65('0x32')][_0x9e65('0x3c')]){_0x1e4193[_0x9e65('0x3b')]=_['merge'](_0x1e4193['where'],{'$or':_[_0x9e65('0x2b')](_0x3d1aa2,function(_0x774eab){if(_0x774eab[_0x9e65('0x2e')]!=='VIRTUAL'){var _0x22c553={};_0x22c553[_0x774eab[_0x9e65('0x29')]]={'$like':'%'+_0x166f35[_0x9e65('0x32')][_0x9e65('0x3c')]+'%'};return _0x22c553;}})});}_0x1e4193=_[_0x9e65('0x3d')]({},_0x1e4193,_0x166f35['options']);var _0x5ba1e6={'where':_0x1e4193['where']};return db[_0x9e65('0x3e')][_0x9e65('0x1e')](_0x5ba1e6)['then'](function(_0x3af690){_0x17599e[_0x9e65('0x1e')]=_0x3af690;if(_0x166f35['query']['includeAll']){_0x1e4193[_0x9e65('0x3f')]=[{'all':!![]}];}return db[_0x9e65('0x3e')]['findAll'](_0x1e4193);})[_0x9e65('0x25')](function(_0xdcdc5){_0x17599e[_0x9e65('0x40')]=_0xdcdc5;return _0x17599e;})[_0x9e65('0x25')](respondWithFilteredResult(_0x5efa7c,_0x1e4193))['catch'](handleError(_0x5efa7c,null));};exports[_0x9e65('0x41')]=function(_0x3f1224,_0xfedb51){var _0xa1834a={'raw':!![],'where':{'id':_0x3f1224['params']['id']}},_0x5ed9c8={};_0x5ed9c8[_0x9e65('0x30')]=_[_0x9e65('0x31')](db[_0x9e65('0x3e')][_0x9e65('0x2c')]);_0x5ed9c8[_0x9e65('0x32')]=_['keys'](_0x3f1224[_0x9e65('0x32')]);_0x5ed9c8[_0x9e65('0x33')]=_[_0x9e65('0x34')](_0x5ed9c8[_0x9e65('0x30')],_0x5ed9c8['query']);_0xa1834a['attributes']=_[_0x9e65('0x34')](_0x5ed9c8[_0x9e65('0x30')],qs['fields'](_0x3f1224[_0x9e65('0x32')][_0x9e65('0x35')]));_0xa1834a[_0x9e65('0x37')]=_0xa1834a[_0x9e65('0x37')]['length']?_0xa1834a[_0x9e65('0x37')]:_0x5ed9c8[_0x9e65('0x30')];if(_0x3f1224['query'][_0x9e65('0x42')]){_0xa1834a['include']=[{'all':!![]}];}_0xa1834a=_[_0x9e65('0x3d')]({},_0xa1834a,_0x3f1224[_0x9e65('0x43')]);return db[_0x9e65('0x3e')][_0x9e65('0x44')](_0xa1834a)[_0x9e65('0x25')](handleEntityNotFound(_0xfedb51,null))[_0x9e65('0x25')](respondWithResult(_0xfedb51,null))[_0x9e65('0x45')](handleError(_0xfedb51,null));};exports['clone']=function(_0x37744b,_0x33b232){var _0x183b4e={'where':{'id':_0x37744b[_0x9e65('0x46')]['id']}},_0x2be8fc={};_0x2be8fc['model']=_[_0x9e65('0x31')](db['Attachment'][_0x9e65('0x2c')]);_0x183b4e[_0x9e65('0x37')]=_['intersection'](_0x2be8fc[_0x9e65('0x30')],qs[_0x9e65('0x35')](_0x37744b[_0x9e65('0x32')][_0x9e65('0x35')]));_0x183b4e[_0x9e65('0x37')]=_0x183b4e['attributes'][_0x9e65('0x36')]?_0x183b4e[_0x9e65('0x37')]:_0x2be8fc[_0x9e65('0x30')];if(_0x37744b[_0x9e65('0x32')][_0x9e65('0x42')]){_0x183b4e['include']=[{'all':!![]}];}_0x183b4e=_[_0x9e65('0x3d')]({},_0x183b4e,_0x37744b[_0x9e65('0x43')]);return db[_0x9e65('0x3e')][_0x9e65('0x44')](_0x183b4e)[_0x9e65('0x25')](handleEntityNotFound(_0x33b232,null))[_0x9e65('0x25')](function(_0x584896){if(_0x584896){var _0x3f8022=_0x584896[_0x9e65('0x47')]({'plain':!![]});_0x3f8022=qs[_0x9e65('0x48')](_0x3f8022,['id',_0x9e65('0x49'),_0x9e65('0x4a')]);_0x37744b[_0x9e65('0x4b')]=_[_0x9e65('0x48')](_0x37744b[_0x9e65('0x4b')],['id','createdAt',_0x9e65('0x4a')]);return db[_0x9e65('0x3e')]['create'](_[_0x9e65('0x3d')](_0x3f8022,_0x37744b['body']),{'include':_0x37744b[_0x9e65('0x32')][_0x9e65('0x42')]?[{'all':!![]}]:undefined});}})[_0x9e65('0x25')](respondWithResult(_0x33b232,0xc9))['catch'](handleError(_0x33b232,null));};exports[_0x9e65('0x24')]=function(_0xae2127,_0x27df3a){if(_0xae2127[_0x9e65('0x4b')]['id']){delete _0xae2127['body']['id'];}return db['Attachment'][_0x9e65('0x44')]({'where':{'id':_0xae2127[_0x9e65('0x46')]['id']}})['then'](handleEntityNotFound(_0x27df3a,null))['then'](saveUpdates(_0xae2127[_0x9e65('0x4b')],null))[_0x9e65('0x25')](respondWithResult(_0x27df3a,null))[_0x9e65('0x45')](handleError(_0x27df3a,null));};exports[_0x9e65('0x26')]=function(_0x1c69fb,_0x202a84){return db['Attachment'][_0x9e65('0x44')]({'where':{'id':_0x1c69fb[_0x9e65('0x46')]['id']}})[_0x9e65('0x25')](handleEntityNotFound(_0x202a84,null))[_0x9e65('0x25')](removeEntity(_0x202a84,null))[_0x9e65('0x45')](handleError(_0x202a84,null));};exports['create']=function(_0x7c63cb,_0x3f5d09,_0x13362f){_0x7c63cb[_0x9e65('0x4b')][_0x9e65('0x29')]=_0x7c63cb[_0x9e65('0x4c')][_0x9e65('0x4d')];_0x7c63cb[_0x9e65('0x4b')][_0x9e65('0x4e')]=_0x7c63cb['file'][_0x9e65('0x4f')];_0x7c63cb[_0x9e65('0x4b')][_0x9e65('0x2e')]=_0x7c63cb[_0x9e65('0x4c')][_0x9e65('0x50')];return db[_0x9e65('0x3e')]['create'](_0x7c63cb[_0x9e65('0x4b')])[_0x9e65('0x25')](respondWithResult(_0x3f5d09,0xc9))[_0x9e65('0x45')](handleError(_0x3f5d09,null));};exports[_0x9e65('0x51')]=function(_0x20b4b4,_0x55bd18,_0x294d03){return db[_0x9e65('0x3e')][_0x9e65('0x52')]({'where':{'id':_0x20b4b4[_0x9e65('0x46')]['id']},'raw':!![]})[_0x9e65('0x25')](handleEntityNotFound(_0x55bd18,null))['then'](function(_0x3e6446){if(_0x3e6446){var _0x589ce2=_0x3e6446[_0x9e65('0x53')]!==null;var _0x25aedb=path[_0x9e65('0x54')](config[_0x9e65('0x55')],_0x9e65('0x56'));if(_0x589ce2){_0x25aedb=path[_0x9e65('0x54')](_0x25aedb,_0x9e65('0x57'));}var _0x8f9731=path[_0x9e65('0x54')](_0x25aedb,_0x3e6446[_0x9e65('0x4e')]);return _0x55bd18['download'](_0x8f9731);}})['catch'](handleError(_0x55bd18,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5569d09..e2b224e 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 _0xc978=['request-promise','path','../../config/environment','./attachment.attributes','exports','define','lodash','api','moment','bluebird'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xc978,0xce));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rp=require(_0x8c97('0x4'));var fs=require('fs');var path=require(_0x8c97('0x5'));var rimraf=require('rimraf');var config=require(_0x8c97('0x6'));var attributes=require(_0x8c97('0x7'));module[_0x8c97('0x8')]=function(_0x398d4c,_0x145a9e){return _0x398d4c[_0x8c97('0x9')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x134e=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','util'];(function(_0x2cef9c,_0x31130d){var _0x20ce49=function(_0x5d508d){while(--_0x5d508d){_0x2cef9c['push'](_0x2cef9c['shift']());}};_0x20ce49(++_0x31130d);}(_0x134e,0x6b));var _0xe134=function(_0xb3b81b,_0x11beb3){_0xb3b81b=_0xb3b81b-0x0;var _0xbf27fd=_0x134e[_0xb3b81b];return _0xbf27fd;};'use strict';var _=require('lodash');var util=require(_0xe134('0x0'));var logger=require(_0xe134('0x1'))('api');var moment=require(_0xe134('0x2'));var BPromise=require('bluebird');var rp=require(_0xe134('0x3'));var fs=require('fs');var path=require(_0xe134('0x4'));var rimraf=require(_0xe134('0x5'));var config=require(_0xe134('0x6'));var attributes=require(_0xe134('0x7'));module[_0xe134('0x8')]=function(_0x56898f,_0xe1e63c){return _0x56898f[_0xe134('0x9')](_0xe134('0xa'),attributes,{'tableName':_0xe134('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 2cc7a6e..d8bb2b4 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 _0xeea4=['Attachment,\x20%s,\x20%s','message','result','CreateAttachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x29e401,_0x4d374d){var _0x4d8b63=function(_0x1a3225){while(--_0x1a3225){_0x29e401['push'](_0x29e401['shift']());}};_0x4d8b63(++_0x4d374d);}(_0xeea4,0x19e));var _0x4eea=function(_0x278fd6,_0x4cd636){_0x278fd6=_0x278fd6-0x0;var _0x1d24ba=_0xeea4[_0x278fd6];return _0x1d24ba;};'use strict';var _=require(_0x4eea('0x0'));var util=require(_0x4eea('0x1'));var moment=require(_0x4eea('0x2'));var BPromise=require(_0x4eea('0x3'));var rs=require(_0x4eea('0x4'));var fs=require('fs');var Redis=require(_0x4eea('0x5'));var db=require(_0x4eea('0x6'))['db'];var utils=require(_0x4eea('0x7'));var logger=require(_0x4eea('0x8'))('rpc');var config=require(_0x4eea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4eea('0xa')][_0x4eea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d5aa8,_0x48538e,_0x1a2e5e){return new BPromise(function(_0x44116a,_0x4cc630){return client[_0x4eea('0xc')](_0x3d5aa8,_0x1a2e5e)[_0x4eea('0xd')](function(_0x2bba91){logger[_0x4eea('0xe')]('Attachment,\x20%s,\x20%s',_0x48538e,_0x4eea('0xf'));logger[_0x4eea('0x10')](_0x4eea('0x11'),_0x48538e,_0x4eea('0xf'),JSON[_0x4eea('0x12')](_0x2bba91));if(_0x2bba91[_0x4eea('0x13')]){if(_0x2bba91[_0x4eea('0x13')][_0x4eea('0x14')]===0x1f4){logger[_0x4eea('0x13')](_0x4eea('0x15'),_0x48538e,_0x2bba91['error']['message']);return _0x4cc630(_0x2bba91[_0x4eea('0x13')][_0x4eea('0x16')]);}logger[_0x4eea('0x13')](_0x4eea('0x15'),_0x48538e,_0x2bba91[_0x4eea('0x13')][_0x4eea('0x16')]);return _0x44116a(_0x2bba91[_0x4eea('0x13')][_0x4eea('0x16')]);}else{logger['info'](_0x4eea('0x15'),_0x48538e,_0x4eea('0xf'));_0x44116a(_0x2bba91[_0x4eea('0x17')][_0x4eea('0x16')]);}})['catch'](function(_0x446474){logger[_0x4eea('0x13')](_0x4eea('0x15'),_0x48538e,_0x446474);_0x4cc630(_0x446474);});});}exports[_0x4eea('0x18')]=function(_0x27a227){var _0x5bd90b=this;return new Promise(function(_0x1571f3,_0x29de0e){return db['Attachment'][_0x4eea('0x19')](_0x27a227[_0x4eea('0x1a')],{'raw':_0x27a227[_0x4eea('0x1b')]?_0x27a227[_0x4eea('0x1b')][_0x4eea('0x1c')]===undefined?!![]:![]:!![]})[_0x4eea('0xd')](function(_0x56fefc){logger[_0x4eea('0xe')](_0x4eea('0x18'),_0x27a227);logger[_0x4eea('0x10')](_0x4eea('0x18'),_0x27a227,JSON[_0x4eea('0x12')](_0x56fefc));_0x1571f3(_0x56fefc);})['catch'](function(_0x4898e8){logger[_0x4eea('0x13')]('CreateAttachment',_0x4898e8['message'],_0x27a227);_0x29de0e(_0x5bd90b['error'](0x1f4,_0x4898e8[_0x4eea('0x16')]));});});}; \ No newline at end of file +var _0x6a24=['create','body','options','raw','then','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6a24,0xd1));var _0x46a2=function(_0x5d4a41,_0x194a29){_0x5d4a41=_0x5d4a41-0x0;var _0x5587bf=_0x6a24[_0x5d4a41];return _0x5587bf;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require(_0x46a2('0x3'));var fs=require('fs');var Redis=require(_0x46a2('0x4'));var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require('../../config/logger')(_0x46a2('0x7'));var config=require(_0x46a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a2('0x9')][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506698,_0x49870f,_0x2092f3){return new BPromise(function(_0x321b88,_0x587092){return client[_0x46a2('0xb')](_0x506698,_0x2092f3)['then'](function(_0x395578){logger['info'](_0x46a2('0xc'),_0x49870f,_0x46a2('0xd'));logger[_0x46a2('0xe')](_0x46a2('0xf'),_0x49870f,_0x46a2('0xd'),JSON[_0x46a2('0x10')](_0x395578));if(_0x395578[_0x46a2('0x11')]){if(_0x395578[_0x46a2('0x11')]['code']===0x1f4){logger['error'](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')]['message']);return _0x587092(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}logger[_0x46a2('0x11')](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);return _0x321b88(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x49870f,_0x46a2('0xd'));_0x321b88(_0x395578[_0x46a2('0x13')]['message']);}})[_0x46a2('0x14')](function(_0x2d755b){logger['error'](_0x46a2('0xc'),_0x49870f,_0x2d755b);_0x587092(_0x2d755b);});});}exports[_0x46a2('0x15')]=function(_0x577f18){var _0x27250b=this;return new Promise(function(_0x24f75f,_0x529bb5){return db[_0x46a2('0x16')][_0x46a2('0x17')](_0x577f18[_0x46a2('0x18')],{'raw':_0x577f18[_0x46a2('0x19')]?_0x577f18[_0x46a2('0x19')][_0x46a2('0x1a')]===undefined?!![]:![]:!![]})[_0x46a2('0x1b')](function(_0x202294){logger[_0x46a2('0x1c')](_0x46a2('0x15'),_0x577f18);logger[_0x46a2('0xe')](_0x46a2('0x15'),_0x577f18,JSON[_0x46a2('0x10')](_0x202294));_0x24f75f(_0x202294);})['catch'](function(_0xa37d90){logger['error'](_0x46a2('0x15'),_0xa37d90[_0x46a2('0x12')],_0x577f18);_0x529bb5(_0x27250b['error'](0x1f4,_0xa37d90[_0x46a2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index d5d41d1..0fed999 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x1aece3,_0x1360b7){_0x1aece3=_0x1aece3-0x0;var _0x7f3a5a=_0xdb28[_0x1aece3];return _0x7f3a5a;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x400a90,_0x19b6ad){var _0x33e181=function(_0x2f28d8){while(--_0x2f28d8){_0x400a90['push'](_0x400a90['shift']());}};_0x33e181(++_0x19b6ad);}(_0x2032,0xd9));var _0x2203=function(_0x9b3682,_0x519be0){_0x9b3682=_0x9b3682-0x0;var _0x2d783b=_0x2032[_0x9b3682];return _0x2d783b;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 0370564..35f1ca3 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 _0xc3ef=['online','User','passport','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blocked','blockedAt','admin','user','agent','add','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json'];(function(_0x59b589,_0x11a824){var _0x4782d6=function(_0x24aa49){while(--_0x24aa49){_0x59b589['push'](_0x59b589['shift']());}};_0x4782d6(++_0x11a824);}(_0xc3ef,0x122));var _0xfc3e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc3ef[_0x8c43de];return _0xa6591b;};'use strict';var passport=require(_0xfc3e('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0xfc3e('0x1'));var ActiveDirectory=require(_0xfc3e('0x2'));var BPromise=require(_0xfc3e('0x3'));var util=require('util');var db=require(_0xfc3e('0x4'))['db'];var authService=require(_0xfc3e('0x5'));var utils=require(_0xfc3e('0x6'));var config=require('../../config/environment');var logger=require(_0xfc3e('0x7'))(_0xfc3e('0x8'));function isActiveDirectoryConfigured(_0x419560){var _0x531371=![];if(typeof _0x419560[_0xfc3e('0x9')]!=='undefined'){_0x531371=_0x419560['activedirectory'][_0xfc3e('0xa')]&&_0x419560[_0xfc3e('0x9')][_0xfc3e('0xb')]&&_0x419560[_0xfc3e('0x9')][_0xfc3e('0xc')];}return _0x531371;}function adAuthenticate(_0x48acb3,_0x31f208,_0x24cfbc){return new BPromise(function(_0x5e9e92,_0x514c5e){try{var _0x3246de=new ActiveDirectory(_0x48acb3);_0x3246de[_0xfc3e('0xd')](_0x31f208,_0x24cfbc,function(_0x55e343,_0x5448e4){if(_0x55e343){logger[_0xfc3e('0xe')](_0xfc3e('0xf'),_0x31f208,util[_0xfc3e('0x10')](_0x55e343,{'showHidden':![],'depth':null}));_0x514c5e(_0xfc3e('0x11'));}else if(!_0x5448e4){logger[_0xfc3e('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x31f208);_0x514c5e(_0xfc3e('0x11'));}else{_0x5e9e92(_0x5448e4);}});}catch(_0x2eb7d2){_0x514c5e(_0x2eb7d2);}});}function ActiveDirectoryAuthenticate(_0x16bcf9,_0x4fabdf,_0x4ce346,_0x456c21){var _0x3dd3f5,_0x479d37;if(!isActiveDirectoryConfigured(config)){logger[_0xfc3e('0xe')](_0xfc3e('0x12'),_0x4fabdf);return _0x456c21(null,![],{'message':_0xfc3e('0x11')});}return db[_0xfc3e('0x13')][_0xfc3e('0x14')]({'where':{'id':0x1},'attributes':[_0xfc3e('0x15'),_0xfc3e('0x16')],'raw':!![]})[_0xfc3e('0x17')](function(_0x257cdc){_0x3dd3f5=_0x257cdc;if(!_0x3dd3f5[_0xfc3e('0x15')]){logger[_0xfc3e('0xe')](_0xfc3e('0x18'),_0x4fabdf);throw new Error(_0xfc3e('0x11'));}return _0x16bcf9[_0xfc3e('0x14')]({'attributes':['id',_0xfc3e('0x19'),_0xfc3e('0x1a'),'salt',_0xfc3e('0x1b'),_0xfc3e('0x1c'),_0xfc3e('0x1d'),_0xfc3e('0x1e'),'online'],'where':{'name':_0x4fabdf,'role':{'$or':[_0xfc3e('0x1f'),_0xfc3e('0x20'),_0xfc3e('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0x4fd6f5){if(!_0x4fd6f5||_0x4fd6f5&&_0x4fd6f5['name']!==_0x4fabdf){throw new Error(_0xfc3e('0x11'));}_0x479d37=_0x4fd6f5;var _0x1ee6ca=_0x479d37['name']+'@'+config[_0xfc3e('0x9')]['domain'];return adAuthenticate(config['activedirectory'],_0x1ee6ca,_0x4ce346);})['then'](function(_0x4f4401){if(_0x479d37['disabled']){throw new Error(_0xfc3e('0x11'));}if(_0x3dd3f5[_0xfc3e('0x16')]>0x0){if(_0x479d37['blocked']){if(moment(_0x479d37['blockedAt'])[_0xfc3e('0x22')](_0x3dd3f5[_0xfc3e('0x16')],_0xfc3e('0x23'))>moment()){throw new Error(_0xfc3e('0x11'));}return utils[_0xfc3e('0x24')](_0x479d37,0x0,![],null)['then'](function(){return utils[_0xfc3e('0x25')](_0x479d37);})[_0xfc3e('0x17')](function(){return _0x456c21(null,_0x479d37);});}else{return utils['getLicense'](_0x479d37)['then'](function(){return _0x456c21(null,_0x479d37);});}}else{return utils[_0xfc3e('0x25')](_0x479d37)[_0xfc3e('0x17')](function(){return _0x456c21(null,_0x479d37);});}})['catch'](function(_0x409d5a){return _0x456c21(null,![],_0x409d5a);});}function handleError(_0x18499a,_0x471801,_0x20b82e){return _0x18499a[_0xfc3e('0x26')](_0x471801||0x1f4)[_0xfc3e('0x27')]({'message':_0x20b82e?_0x20b82e[_0xfc3e('0x28')]||_0x20b82e:''});}exports[_0xfc3e('0x29')]=function(_0x5e4423,_0x5dbea8,_0x261e92){passport[_0xfc3e('0xd')](_0xfc3e('0x2a'),function(_0x5bfeb2,_0x40e8fd,_0x5e5f31){var _0x216108=_0x5bfeb2||_0x5e5f31;if(_0x216108){return handleError(_0x5dbea8,0x191,_0x216108);}if(!_0x40e8fd){return handleError(_0x5dbea8,0x194,{'message':_0xfc3e('0x2b')});}else{var _0x164da0={'payload':{'id':_0x40e8fd['id'],'role':_0x40e8fd['role']},'options':{'expiresIn':0x15180}};return authService[_0xfc3e('0x2c')](_0x164da0)[_0xfc3e('0x17')](function(_0x96a76d){_0x5dbea8[_0xfc3e('0x2d')]({'id':_0x40e8fd['id'],'token':_0x96a76d,'statusCall':'','isAlreadyLogged':_0x40e8fd[_0xfc3e('0x2e')]});});}})(_0x5e4423,_0x5dbea8,_0x261e92);};passport['use'](_0xfc3e('0x2a'),new LocalStrategy({'usernameField':_0xfc3e('0x19'),'passwordField':_0xfc3e('0x1a')},function(_0x465689,_0x498ac8,_0xb3c188){return ActiveDirectoryAuthenticate(db[_0xfc3e('0x2f')],_0x465689,_0x498ac8,_0xb3c188);})); \ No newline at end of file +var _0x15b3=['error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','online','user','agent','name','add','minutes','clearBlockUser','getLicense','status','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','User','passport','passport-local','Strategy','moment','activedirectory2','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','authenticate'];(function(_0x517586,_0xc97d01){var _0x4d7494=function(_0x1383d8){while(--_0x1383d8){_0x517586['push'](_0x517586['shift']());}};_0x4d7494(++_0xc97d01);}(_0x15b3,0x1b5));var _0x315b=function(_0x44d36b,_0x50dc95){_0x44d36b=_0x44d36b-0x0;var _0x562b25=_0x15b3[_0x44d36b];return _0x562b25;};'use strict';var passport=require(_0x315b('0x0'));var LocalStrategy=require(_0x315b('0x1'))[_0x315b('0x2')];var moment=require(_0x315b('0x3'));var ActiveDirectory=require(_0x315b('0x4'));var BPromise=require('bluebird');var util=require('util');var db=require(_0x315b('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x315b('0x6'));var config=require(_0x315b('0x7'));var logger=require(_0x315b('0x8'))(_0x315b('0x9'));function isActiveDirectoryConfigured(_0x3719d7){var _0x238d13=![];if(typeof _0x3719d7[_0x315b('0xa')]!==_0x315b('0xb')){_0x238d13=_0x3719d7[_0x315b('0xa')]['baseDN']&&_0x3719d7[_0x315b('0xa')]['url']&&_0x3719d7[_0x315b('0xa')]['domain'];}return _0x238d13;}function adAuthenticate(_0x2549dc,_0x5493cf,_0x1bb67d){return new BPromise(function(_0x7128ed,_0x1e3ba0){try{var _0x308258=new ActiveDirectory(_0x2549dc);_0x308258[_0x315b('0xc')](_0x5493cf,_0x1bb67d,function(_0x38f8f0,_0x498e38){if(_0x38f8f0){logger[_0x315b('0xd')]('Error\x20authenticate\x20%s:\x20%s',_0x5493cf,util[_0x315b('0xe')](_0x38f8f0,{'showHidden':![],'depth':null}));_0x1e3ba0(_0x315b('0xf'));}else if(!_0x498e38){logger['error'](_0x315b('0x10'),_0x5493cf);_0x1e3ba0(_0x315b('0xf'));}else{_0x7128ed(_0x498e38);}});}catch(_0x8fde7b){_0x1e3ba0(_0x8fde7b);}});}function ActiveDirectoryAuthenticate(_0x3c012c,_0x3bee1e,_0x12ded2,_0x1b1e4f){var _0x4ec361,_0x2d1d8b;if(!isActiveDirectoryConfigured(config)){logger[_0x315b('0xd')](_0x315b('0x11'),_0x3bee1e);return _0x1b1e4f(null,![],{'message':_0x315b('0xf')});}return db[_0x315b('0x12')][_0x315b('0x13')]({'where':{'id':0x1},'attributes':[_0x315b('0x14'),_0x315b('0x15')],'raw':!![]})[_0x315b('0x16')](function(_0xaaea9){_0x4ec361=_0xaaea9;if(!_0x4ec361[_0x315b('0x14')]){logger[_0x315b('0xd')](_0x315b('0x17'),_0x3bee1e);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3c012c[_0x315b('0x13')]({'attributes':['id','name',_0x315b('0x18'),_0x315b('0x19'),_0x315b('0x1a'),_0x315b('0x1b'),_0x315b('0x1c'),_0x315b('0x1d'),_0x315b('0x1e')],'where':{'name':_0x3bee1e,'role':{'$or':['admin',_0x315b('0x1f'),_0x315b('0x20')]},'adSsoEnabled':!![]}});})[_0x315b('0x16')](function(_0x12cdea){if(!_0x12cdea||_0x12cdea&&_0x12cdea['name']!==_0x3bee1e){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x2d1d8b=_0x12cdea;var _0x3c23f4=_0x2d1d8b[_0x315b('0x21')]+'@'+config[_0x315b('0xa')]['domain'];return adAuthenticate(config['activedirectory'],_0x3c23f4,_0x12ded2);})[_0x315b('0x16')](function(_0x266b67){if(_0x2d1d8b[_0x315b('0x1b')]){throw new Error(_0x315b('0xf'));}if(_0x4ec361[_0x315b('0x15')]>0x0){if(_0x2d1d8b['blocked']){if(moment(_0x2d1d8b[_0x315b('0x1d')])[_0x315b('0x22')](_0x4ec361[_0x315b('0x15')],_0x315b('0x23'))>moment()){throw new Error(_0x315b('0xf'));}return utils[_0x315b('0x24')](_0x2d1d8b,0x0,![],null)[_0x315b('0x16')](function(){return utils['getLicense'](_0x2d1d8b);})['then'](function(){return _0x1b1e4f(null,_0x2d1d8b);});}else{return utils['getLicense'](_0x2d1d8b)[_0x315b('0x16')](function(){return _0x1b1e4f(null,_0x2d1d8b);});}}else{return utils[_0x315b('0x25')](_0x2d1d8b)[_0x315b('0x16')](function(){return _0x1b1e4f(null,_0x2d1d8b);});}})['catch'](function(_0xafc4d6){return _0x1b1e4f(null,![],_0xafc4d6);});}function handleError(_0x3e4dae,_0x242e57,_0x5257e8){return _0x3e4dae[_0x315b('0x26')](_0x242e57||0x1f4)['send']({'message':_0x5257e8?_0x5257e8[_0x315b('0x27')]||_0x5257e8:''});}exports['login']=function(_0x17882e,_0xee52b9,_0x32709b){passport['authenticate'](_0x315b('0x28'),function(_0x2e3984,_0xaa5f27,_0x10d069){var _0x23a58e=_0x2e3984||_0x10d069;if(_0x23a58e){return handleError(_0xee52b9,0x191,_0x23a58e);}if(!_0xaa5f27){return handleError(_0xee52b9,0x194,{'message':_0x315b('0x29')});}else{var _0x297711={'payload':{'id':_0xaa5f27['id'],'role':_0xaa5f27[_0x315b('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x315b('0x2a')](_0x297711)[_0x315b('0x16')](function(_0x5cfdc4){_0xee52b9[_0x315b('0x2b')]({'id':_0xaa5f27['id'],'token':_0x5cfdc4,'statusCall':'','isAlreadyLogged':_0xaa5f27[_0x315b('0x1e')]});});}})(_0x17882e,_0xee52b9,_0x32709b);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0x315b('0x21'),'passwordField':_0x315b('0x18')},function(_0x59b0dc,_0x79c44b,_0x58a90d){return ActiveDirectoryAuthenticate(db[_0x315b('0x2c')],_0x59b0dc,_0x79c44b,_0x58a90d);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 814d631..7f34e9e 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 _0xf1fc=['post','login','express','Router','./authActiveDirectory.controller'];(function(_0x5e4813,_0x21ef94){var _0x3a18b5=function(_0xe5348){while(--_0xe5348){_0x5e4813['push'](_0x5e4813['shift']());}};_0x3a18b5(++_0x21ef94);}(_0xf1fc,0xfc));var _0xcf1f=function(_0x51fdab,_0x25059f){_0x51fdab=_0x51fdab-0x0;var _0x5ddf22=_0xf1fc[_0x51fdab];return _0x5ddf22;};'use strict';var express=require(_0xcf1f('0x0'));var router=express[_0xcf1f('0x1')]();var controller=require(_0xcf1f('0x2'));router[_0xcf1f('0x3')]('/',controller[_0xcf1f('0x4')]);module['exports']=router; \ No newline at end of file +var _0xdf60=['./authActiveDirectory.controller','post','login','express','Router'];(function(_0x443480,_0x23b513){var _0x560f6f=function(_0x43fc9c){while(--_0x43fc9c){_0x443480['push'](_0x443480['shift']());}};_0x560f6f(++_0x23b513);}(_0xdf60,0xf3));var _0x0df6=function(_0x1f686f,_0x26a753){_0x1f686f=_0x1f686f-0x0;var _0x1973f0=_0xdf60[_0x1f686f];return _0x1973f0;};'use strict';var express=require(_0x0df6('0x0'));var router=express[_0x0df6('0x1')]();var controller=require(_0x0df6('0x2'));router[_0x0df6('0x3')]('/',controller[_0x0df6('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index eff82f2..93a37b6 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x7a54,0x106));var _0x47a5=function(_0x2a1645,_0x35d23f){_0x2a1645=_0x2a1645-0x0;var _0x17f545=_0x7a54[_0x2a1645];return _0x17f545;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x18d50f,_0x124aff){var _0x8ce385=function(_0x321962){while(--_0x321962){_0x18d50f['push'](_0x18d50f['shift']());}};_0x8ce385(++_0x124aff);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 211389e..d49c692 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 _0x3dc7=['login','/callback','callback','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3dc7,0x138));var _0x73dc=function(_0x51dc0f,_0x18379f){_0x51dc0f=_0x51dc0f-0x0;var _0x3d004e=_0x3dc7[_0x51dc0f];return _0x3d004e;};'use strict';var express=require(_0x73dc('0x0'));var passport=require(_0x73dc('0x1'));var router=express[_0x73dc('0x2')]();var controller=require(_0x73dc('0x3'));var userController=require(_0x73dc('0x4'));var authService=require(_0x73dc('0x5'));router[_0x73dc('0x6')]('/',controller[_0x73dc('0x7')]);router[_0x73dc('0x6')](_0x73dc('0x8'),controller[_0x73dc('0x9')],authService['isMiddleware'],userController[_0x73dc('0x7')],authService[_0x73dc('0xa')]);module['exports']=router; \ No newline at end of file +var _0x4532=['isMiddleware','setTokenCookie','passport','Router','../../components/auth/service','get','login','/callback'];(function(_0x40bc32,_0x428c83){var _0x2351e3=function(_0x3ba9f0){while(--_0x3ba9f0){_0x40bc32['push'](_0x40bc32['shift']());}};_0x2351e3(++_0x428c83);}(_0x4532,0x142));var _0x2453=function(_0x23a9c7,_0x22a546){_0x23a9c7=_0x23a9c7-0x0;var _0x56a791=_0x4532[_0x23a9c7];return _0x56a791;};'use strict';var express=require('express');var passport=require(_0x2453('0x0'));var router=express[_0x2453('0x1')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x2453('0x2'));router[_0x2453('0x3')]('/',controller[_0x2453('0x4')]);router[_0x2453('0x3')](_0x2453('0x5'),controller['callback'],authService[_0x2453('0x6')],userController[_0x2453('0x4')],authService[_0x2453('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 780560a..dc49482 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 _0x8d66=['body','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','name','password','salt','role','blocked','blockedAt','admin','user','agent','then','authenticate','loginAttempts','disabled','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','minutes','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','Smtp','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','Email\x20parameter\x20is\x20missing','generate','toLowerCase','findOne','User','find'];(function(_0x18bfdb,_0x241d43){var _0x44334c=function(_0x55e999){while(--_0x55e999){_0x18bfdb['push'](_0x18bfdb['shift']());}};_0x44334c(++_0x241d43);}(_0x8d66,0x1c0));var _0x68d6=function(_0x48bb9c,_0x34c5f4){_0x48bb9c=_0x48bb9c-0x0;var _0x31cc55=_0x8d66[_0x48bb9c];return _0x31cc55;};'use strict';var util=require(_0x68d6('0x0'));var passport=require('passport');var LocalStrategy=require(_0x68d6('0x1'))[_0x68d6('0x2')];var jayson=require(_0x68d6('0x3'));var _=require(_0x68d6('0x4'));var rs=require(_0x68d6('0x5'));var moment=require('moment');var db=require(_0x68d6('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x68d6('0x7'));var client=jayson['client'][_0x68d6('0x8')]({'port':0x232b});function localAuthenticate(_0xf9a177,_0x3a58b,_0x5b17cc,_0x1c361d){var _0x48e223,_0x40424e;return db[_0x68d6('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x68d6('0xa'),_0x68d6('0xb')],'raw':!![]})['then'](function(_0x5b0366){_0x48e223=_0x5b0366;return _0xf9a177['findOne']({'attributes':['id',_0x68d6('0xc'),_0x68d6('0xd'),_0x68d6('0xe'),_0x68d6('0xf'),'disabled',_0x68d6('0x10'),_0x68d6('0x11'),'loginAttempts'],'where':{'name':_0x3a58b,'role':{'$or':[_0x68d6('0x12'),_0x68d6('0x13'),_0x68d6('0x14')]}}});})['then'](function(_0x2a4dbf){if(!_0x2a4dbf||_0x2a4dbf&&_0x2a4dbf[_0x68d6('0xc')]!==_0x3a58b){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x40424e=_0x2a4dbf;return _0x40424e;}})[_0x68d6('0x15')](function(){_0x40424e[_0x68d6('0x16')](_0x5b17cc,function(_0x183e4f,_0xd2db08){var _0x5a522a=_0x40424e[_0x68d6('0x17')]+0x1;if(_0x183e4f){return _0x1c361d(_0x183e4f);}else if(!_0xd2db08){if(_0x40424e[_0x68d6('0x18')]){return _0x1c361d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x48e223['allowedLoginAttempts']>0x0){if(_0x40424e[_0x68d6('0x10')]){if(_0x48e223[_0x68d6('0xb')]>0x0){if(moment(_0x40424e[_0x68d6('0x11')])[_0x68d6('0x19')](_0x48e223['blockDuration'],'minutes')>moment()){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}else{return utils[_0x68d6('0x1b')](_0x40424e,_0x5a522a,![],null)[_0x68d6('0x15')](function(){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});});}}else{return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}}else{if(_0x5a522a>=_0x48e223[_0x68d6('0xa')]){return utils['clearBlockUser'](_0x40424e,0x0,!![],moment())[_0x68d6('0x15')](function(){return _0x1c361d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x40424e,_0x5a522a,![],null)['then'](function(){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});});}}}else{return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}}else{if(_0x40424e[_0x68d6('0x18')]){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}else if(_0x48e223['allowedLoginAttempts']>0x0){if(_0x40424e['blocked']){if(_0x48e223[_0x68d6('0xb')]>0x0){if(moment(_0x40424e[_0x68d6('0x11')])[_0x68d6('0x19')](_0x48e223[_0x68d6('0xb')],_0x68d6('0x1c'))>moment()){return _0x1c361d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x68d6('0x1b')](_0x40424e,0x0,![],null)[_0x68d6('0x15')](function(){return utils['getLicense'](_0x40424e);})[_0x68d6('0x15')](function(){return _0x1c361d(null,_0x40424e);});}}else{return _0x1c361d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x68d6('0x1b')](_0x40424e,0x0,![],null)['then'](function(){return utils[_0x68d6('0x1d')](_0x40424e);})[_0x68d6('0x15')](function(){return _0x1c361d(null,_0x40424e);})[_0x68d6('0x1e')](function(_0x59bb3a){return _0x1c361d(null,![],_0x59bb3a);});}}else{if(_0x40424e[_0x68d6('0x10')]){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}else{return utils[_0x68d6('0x1d')](_0x40424e)[_0x68d6('0x15')](function(){return _0x1c361d(null,_0x40424e);});}}}});})[_0x68d6('0x1e')](function(_0x583e1c){return _0x1c361d(null,![],_0x583e1c);});}function sendServiceMail(_0x6be2db){return db[_0x68d6('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x68d6('0xc'),_0x68d6('0x20')],'include':[{'model':db[_0x68d6('0x21')],'as':'Smtp','include':[{'model':db[_0x68d6('0x22')],'as':_0x68d6('0x22')}]}]})[_0x68d6('0x15')](function(_0x3a6c18){if(!_0x3a6c18){throw new Error(_0x68d6('0x23'));}var _0x125743=_0x3a6c18[_0x68d6('0x24')]();var _0x7251bc={'account':_0x125743,'message':_['merge']({'from':util[_0x68d6('0x25')]('\x22%s\x22\x20<%s>',_0x3a6c18['name'],_0x3a6c18[_0x68d6('0x20')]||_0x3a6c18[_0x68d6('0x26')][_0x68d6('0x13')])},_0x6be2db)};return client['request'](_0x68d6('0x27'),_0x7251bc);})[_0x68d6('0x15')](function(_0xc16799){if(_0xc16799['error']){throw new Error(util[_0x68d6('0x25')](_0x68d6('0x28'),_0xc16799['error'][_0x68d6('0x29')]||JSON['stringify'](_0xc16799[_0x68d6('0x2a')])));}return!![];});}function handleError(_0x15b202,_0x31d00b,_0x12067c){return _0x15b202[_0x68d6('0x2b')](_0x31d00b||0x1f4)[_0x68d6('0x2c')]({'message':_0x12067c?_0x12067c[_0x68d6('0x29')]||_0x12067c:''});}exports[_0x68d6('0x2d')]=function(_0x31781d,_0x529626,_0x512448){passport[_0x68d6('0x16')](_0x68d6('0x2e'),function(_0x103cc0,_0x1ad9d6,_0x3931dd){var _0x11c8d0=_0x103cc0||_0x3931dd;if(_0x11c8d0){return handleError(_0x529626,0x191,_0x11c8d0);}if(!_0x1ad9d6){return handleError(_0x529626,0x194,{'message':_0x68d6('0x2f')});}else{var _0x44a44c={'payload':{'id':_0x1ad9d6['id'],'role':_0x1ad9d6[_0x68d6('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x68d6('0x30')](_0x44a44c)[_0x68d6('0x15')](function(_0x356397){_0x529626['json']({'id':_0x1ad9d6['id'],'token':_0x356397,'statusCall':'','isAlreadyLogged':_0x1ad9d6['online']});});}})(_0x31781d,_0x529626,_0x512448);};exports[_0x68d6('0x31')]=function(_0x32acba,_0x141093){if(!_0x32acba['body'][_0x68d6('0x20')]){return handleError(_0x141093,0x1f4,{'message':_0x68d6('0x32')});}var _0x127908=rs[_0x68d6('0x33')]();_0x32acba['body'][_0x68d6('0x20')]=_0x32acba['body'][_0x68d6('0x20')]['trim']()[_0x68d6('0x34')]();var _0x213c7a;return db[_0x68d6('0x9')][_0x68d6('0x35')]({'where':{'id':0x1},'attributes':[_0x68d6('0xa'),_0x68d6('0xb')],'raw':!![]})[_0x68d6('0x15')](function(_0x4338ba){_0x213c7a=_0x4338ba;return db[_0x68d6('0x36')][_0x68d6('0x37')]({'where':{'email':_0x32acba[_0x68d6('0x38')]['email']}});})['then'](function(_0x47f03c){if(!_0x47f03c){throw new Error(_0x68d6('0x39'));}if(_0x47f03c[_0x68d6('0x18')]){throw new Error(_0x68d6('0x3a'));}if(_0x47f03c[_0x68d6('0x10')]){if(moment(_0x47f03c['blockedAt'])[_0x68d6('0x19')](_0x213c7a[_0x68d6('0xb')],_0x68d6('0x1c'))>moment()){throw new Error(_0x68d6('0x3b'));}else{_0x47f03c[_0x68d6('0x10')]=![];_0x47f03c[_0x68d6('0x11')]=null;}}_0x47f03c['resetPasswordToken']=_0x127908;_0x47f03c[_0x68d6('0x3c')]=Date[_0x68d6('0x3d')]()+0x36ee80;return _0x47f03c[_0x68d6('0x3e')]();})[_0x68d6('0x15')](function(){return sendServiceMail({'to':_0x32acba[_0x68d6('0x38')]['email'],'subject':_0x68d6('0x3f'),'text':_0x68d6('0x40')+_0x68d6('0x41')+_0x68d6('0x42')+_0x32acba[_0x68d6('0x43')][_0x68d6('0x44')]+'/reset/'+_0x127908+'\x0a\x0a'+_0x68d6('0x45')});})['then'](function(){_0x141093[_0x68d6('0x2b')](0xc8)[_0x68d6('0x2c')]({'message':_0x68d6('0x46')});})['catch'](function(_0x4771c0){return handleError(_0x141093,0x1f4,_0x4771c0);});};exports[_0x68d6('0x47')]=function(_0x3f266b,_0x557bbe){return db[_0x68d6('0x36')][_0x68d6('0x37')]({'where':{'resetPasswordToken':_0x3f266b[_0x68d6('0x48')][_0x68d6('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x68d6('0x15')](function(_0x398b73){if(!_0x398b73){throw new Error(_0x68d6('0x4a'));}return db['Setting'][_0x68d6('0x35')]({'attributes':['id',_0x68d6('0x4b'),_0x68d6('0x4c'),'passwordHistoryLimit']})[_0x68d6('0x15')](function(_0x127b1a){if(_0x127b1a[_0x68d6('0x4b')])authService[_0x68d6('0x4d')](_0x3f266b['body'][_0x68d6('0xd')]);if(!_0x127b1a[_0x68d6('0x4c')]||!_0x398b73[_0x68d6('0x4e')])return _0x398b73;authService[_0x68d6('0x4f')](_0x3f266b[_0x68d6('0x38')][_0x68d6('0xd')],_0x398b73[_0x68d6('0x4e')],_0x127b1a[_0x68d6('0x50')]);return _0x398b73;})[_0x68d6('0x15')](function(){_0x398b73[_0x68d6('0xd')]=_0x3f266b[_0x68d6('0x38')][_0x68d6('0xd')];_0x398b73[_0x68d6('0x51')]=null;_0x398b73[_0x68d6('0x3c')]=null;return _0x398b73[_0x68d6('0x3e')]();});})['then'](function(){_0x557bbe[_0x68d6('0x2b')](0xc8)[_0x68d6('0x2c')]({'message':_0x68d6('0x52')});})['catch'](function(_0xe75d77){return handleError(_0x557bbe,0x1f4,_0xe75d77);});};passport[_0x68d6('0x53')](_0x68d6('0x2e'),new LocalStrategy({'usernameField':_0x68d6('0xc'),'passwordField':_0x68d6('0xd')},function(_0x3e26ee,_0x297aca,_0x53bb46){return localAuthenticate(db[_0x68d6('0x36')],_0x3e26ee,_0x297aca,_0x53bb46);})); \ No newline at end of file +var _0x5a2f=['Password\x20reset!','use','local-login','util','passport','Strategy','jayson/promise','randomstring','../../mysqldb','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','minutes','clearBlockUser','catch','getLicense','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','login','authenticate','signToken','json','body','email','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory'];(function(_0x47ff3d,_0x5c9fd1){var _0x3fba05=function(_0x44d3ff){while(--_0x44d3ff){_0x47ff3d['push'](_0x47ff3d['shift']());}};_0x3fba05(++_0x5c9fd1);}(_0x5a2f,0x9b));var _0xf5a2=function(_0x1a950c,_0x44e719){_0x1a950c=_0x1a950c-0x0;var _0x529b82=_0x5a2f[_0x1a950c];return _0x529b82;};'use strict';var util=require(_0xf5a2('0x0'));var passport=require(_0xf5a2('0x1'));var LocalStrategy=require('passport-local')[_0xf5a2('0x2')];var jayson=require(_0xf5a2('0x3'));var _=require('lodash');var rs=require(_0xf5a2('0x4'));var moment=require('moment');var db=require(_0xf5a2('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xf5a2('0x6'));var client=jayson['client'][_0xf5a2('0x7')]({'port':0x232b});function localAuthenticate(_0xd5cc62,_0x310122,_0x5500ed,_0x18437d){var _0x53c97c,_0x4d2df8;return db[_0xf5a2('0x8')][_0xf5a2('0x9')]({'where':{'id':0x1},'attributes':[_0xf5a2('0xa'),_0xf5a2('0xb')],'raw':!![]})[_0xf5a2('0xc')](function(_0x254afe){_0x53c97c=_0x254afe;return _0xd5cc62[_0xf5a2('0x9')]({'attributes':['id',_0xf5a2('0xd'),_0xf5a2('0xe'),_0xf5a2('0xf'),_0xf5a2('0x10'),_0xf5a2('0x11'),_0xf5a2('0x12'),_0xf5a2('0x13'),'loginAttempts'],'where':{'name':_0x310122,'role':{'$or':[_0xf5a2('0x14'),_0xf5a2('0x15'),_0xf5a2('0x16')]}}});})[_0xf5a2('0xc')](function(_0x4e7422){if(!_0x4e7422||_0x4e7422&&_0x4e7422[_0xf5a2('0xd')]!==_0x310122){throw new Error(_0xf5a2('0x17'));}else{_0x4d2df8=_0x4e7422;return _0x4d2df8;}})[_0xf5a2('0xc')](function(){_0x4d2df8['authenticate'](_0x5500ed,function(_0x30c63f,_0x2f376a){var _0x5b3251=_0x4d2df8[_0xf5a2('0x18')]+0x1;if(_0x30c63f){return _0x18437d(_0x30c63f);}else if(!_0x2f376a){if(_0x4d2df8[_0xf5a2('0x11')]){return _0x18437d(null,![],{'message':_0xf5a2('0x17')});}else if(_0x53c97c[_0xf5a2('0xa')]>0x0){if(_0x4d2df8[_0xf5a2('0x12')]){if(_0x53c97c[_0xf5a2('0xb')]>0x0){if(moment(_0x4d2df8['blockedAt'])['add'](_0x53c97c['blockDuration'],_0xf5a2('0x19'))>moment()){return _0x18437d(null,![],{'message':_0xf5a2('0x17')});}else{return utils[_0xf5a2('0x1a')](_0x4d2df8,_0x5b3251,![],null)[_0xf5a2('0xc')](function(){return _0x18437d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x18437d(null,![],{'message':_0xf5a2('0x17')});}}else{if(_0x5b3251>=_0x53c97c[_0xf5a2('0xa')]){return utils['clearBlockUser'](_0x4d2df8,0x0,!![],moment())[_0xf5a2('0xc')](function(){return _0x18437d(null,![],{'message':_0xf5a2('0x17')});});}else{return utils[_0xf5a2('0x1a')](_0x4d2df8,_0x5b3251,![],null)[_0xf5a2('0xc')](function(){return _0x18437d(null,![],{'message':_0xf5a2('0x17')});});}}}else{return _0x18437d(null,![],{'message':_0xf5a2('0x17')});}}else{if(_0x4d2df8[_0xf5a2('0x11')]){return _0x18437d(null,![],{'message':_0xf5a2('0x17')});}else if(_0x53c97c[_0xf5a2('0xa')]>0x0){if(_0x4d2df8['blocked']){if(_0x53c97c[_0xf5a2('0xb')]>0x0){if(moment(_0x4d2df8[_0xf5a2('0x13')])['add'](_0x53c97c[_0xf5a2('0xb')],_0xf5a2('0x19'))>moment()){return _0x18437d(null,![],{'message':_0xf5a2('0x17')});}else{return utils[_0xf5a2('0x1a')](_0x4d2df8,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4d2df8);})[_0xf5a2('0xc')](function(){return _0x18437d(null,_0x4d2df8);});}}else{return _0x18437d(null,![],{'message':_0xf5a2('0x17')});}}else{return utils['clearBlockUser'](_0x4d2df8,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4d2df8);})[_0xf5a2('0xc')](function(){return _0x18437d(null,_0x4d2df8);})[_0xf5a2('0x1b')](function(_0x2c9ed4){return _0x18437d(null,![],_0x2c9ed4);});}}else{if(_0x4d2df8[_0xf5a2('0x12')]){return _0x18437d(null,![],{'message':_0xf5a2('0x17')});}else{return utils[_0xf5a2('0x1c')](_0x4d2df8)[_0xf5a2('0xc')](function(){return _0x18437d(null,_0x4d2df8);});}}}});})[_0xf5a2('0x1b')](function(_0x449f19){return _0x18437d(null,![],_0x449f19);});}function sendServiceMail(_0x5a8337){return db['MailAccount'][_0xf5a2('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xf5a2('0xd'),'email'],'include':[{'model':db[_0xf5a2('0x1e')],'as':_0xf5a2('0x1f'),'include':[{'model':db[_0xf5a2('0x20')],'as':'CloudProvider'}]}]})[_0xf5a2('0xc')](function(_0x40e906){if(!_0x40e906){throw new Error(_0xf5a2('0x21'));}var _0x2ee658=_0x40e906[_0xf5a2('0x22')]();var _0x3c6b42={'account':_0x2ee658,'message':_[_0xf5a2('0x23')]({'from':util[_0xf5a2('0x24')](_0xf5a2('0x25'),_0x40e906[_0xf5a2('0xd')],_0x40e906['email']||_0x40e906[_0xf5a2('0x1f')][_0xf5a2('0x15')])},_0x5a8337)};return client[_0xf5a2('0x26')]('SendMail',_0x3c6b42);})[_0xf5a2('0xc')](function(_0x2f28c6){if(_0x2f28c6[_0xf5a2('0x27')]){throw new Error(util[_0xf5a2('0x24')](_0xf5a2('0x28'),_0x2f28c6['error']['message']||JSON['stringify'](_0x2f28c6[_0xf5a2('0x27')])));}return!![];});}function handleError(_0x4b5f2c,_0x36415e,_0x298170){return _0x4b5f2c[_0xf5a2('0x29')](_0x36415e||0x1f4)[_0xf5a2('0x2a')]({'message':_0x298170?_0x298170['message']||_0x298170:''});}exports[_0xf5a2('0x2b')]=function(_0x5f47de,_0x34086f,_0x47e3ef){passport[_0xf5a2('0x2c')]('local-login',function(_0x30b6bb,_0x1252b1,_0x6b1ce5){var _0x227c1f=_0x30b6bb||_0x6b1ce5;if(_0x227c1f){return handleError(_0x34086f,0x191,_0x227c1f);}if(!_0x1252b1){return handleError(_0x34086f,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x13113d={'payload':{'id':_0x1252b1['id'],'role':_0x1252b1['role']},'options':{'expiresIn':0x15180}};return authService[_0xf5a2('0x2d')](_0x13113d)[_0xf5a2('0xc')](function(_0x538740){_0x34086f[_0xf5a2('0x2e')]({'id':_0x1252b1['id'],'token':_0x538740,'statusCall':'','isAlreadyLogged':_0x1252b1['online']});});}})(_0x5f47de,_0x34086f,_0x47e3ef);};exports['forgot']=function(_0x303263,_0x373aa8){if(!_0x303263[_0xf5a2('0x2f')][_0xf5a2('0x30')]){return handleError(_0x373aa8,0x1f4,{'message':_0xf5a2('0x31')});}var _0x56eadf=rs['generate']();_0x303263['body']['email']=_0x303263['body']['email'][_0xf5a2('0x32')]()[_0xf5a2('0x33')]();var _0x35749f;return db['Setting'][_0xf5a2('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xf5a2('0xc')](function(_0x32de55){_0x35749f=_0x32de55;return db[_0xf5a2('0x34')]['find']({'where':{'email':_0x303263[_0xf5a2('0x2f')][_0xf5a2('0x30')]}});})[_0xf5a2('0xc')](function(_0xfe151f){if(!_0xfe151f){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xfe151f[_0xf5a2('0x11')]){throw new Error(_0xf5a2('0x35'));}if(_0xfe151f[_0xf5a2('0x12')]){if(moment(_0xfe151f[_0xf5a2('0x13')])['add'](_0x35749f[_0xf5a2('0xb')],_0xf5a2('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0xfe151f[_0xf5a2('0x12')]=![];_0xfe151f[_0xf5a2('0x13')]=null;}}_0xfe151f[_0xf5a2('0x36')]=_0x56eadf;_0xfe151f[_0xf5a2('0x37')]=Date[_0xf5a2('0x38')]()+0x36ee80;return _0xfe151f[_0xf5a2('0x39')]();})[_0xf5a2('0xc')](function(){return sendServiceMail({'to':_0x303263['body'][_0xf5a2('0x30')],'subject':_0xf5a2('0x3a'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xf5a2('0x3b')+_0x303263[_0xf5a2('0x3c')][_0xf5a2('0x3d')]+_0xf5a2('0x3e')+_0x56eadf+'\x0a\x0a'+_0xf5a2('0x3f')});})[_0xf5a2('0xc')](function(){_0x373aa8['status'](0xc8)['send']({'message':_0xf5a2('0x40')});})[_0xf5a2('0x1b')](function(_0x38878d){return handleError(_0x373aa8,0x1f4,_0x38878d);});};exports[_0xf5a2('0x41')]=function(_0x160c90,_0x4c7f19){return db['User'][_0xf5a2('0x1d')]({'where':{'resetPasswordToken':_0x160c90['params'][_0xf5a2('0x42')],'resetPasswordExpires':{'$gt':Date[_0xf5a2('0x38')]()}}})[_0xf5a2('0xc')](function(_0x5cb67c){if(!_0x5cb67c){throw new Error(_0xf5a2('0x43'));}return db['Setting'][_0xf5a2('0x9')]({'attributes':['id',_0xf5a2('0x44'),_0xf5a2('0x45'),_0xf5a2('0x46')]})['then'](function(_0x1a5c48){if(_0x1a5c48[_0xf5a2('0x44')])authService['validatePasswordPattern'](_0x160c90[_0xf5a2('0x2f')][_0xf5a2('0xe')]);if(!_0x1a5c48['enforcePasswordHistory']||!_0x5cb67c[_0xf5a2('0x47')])return _0x5cb67c;authService[_0xf5a2('0x48')](_0x160c90[_0xf5a2('0x2f')][_0xf5a2('0xe')],_0x5cb67c['previousPasswords'],_0x1a5c48[_0xf5a2('0x46')]);return _0x5cb67c;})['then'](function(){_0x5cb67c['password']=_0x160c90[_0xf5a2('0x2f')]['password'];_0x5cb67c[_0xf5a2('0x36')]=null;_0x5cb67c[_0xf5a2('0x37')]=null;return _0x5cb67c[_0xf5a2('0x39')]();});})[_0xf5a2('0xc')](function(){_0x4c7f19['status'](0xc8)['send']({'message':_0xf5a2('0x49')});})[_0xf5a2('0x1b')](function(_0x50059d){return handleError(_0x4c7f19,0x1f4,_0x50059d);});};passport[_0xf5a2('0x4a')](_0xf5a2('0x4b'),new LocalStrategy({'usernameField':_0xf5a2('0xd'),'passwordField':_0xf5a2('0xe')},function(_0x526c7a,_0x4f1f9a,_0x3bcf0b){return localAuthenticate(db[_0xf5a2('0x34')],_0x526c7a,_0x4f1f9a,_0x3bcf0b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3ae3741..15eec9e 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 _0x6914=['Router','./authLocal.controller','post','login','/reset/:token','reset','express'];(function(_0x39b8a8,_0x25ca73){var _0x34737e=function(_0x699b){while(--_0x699b){_0x39b8a8['push'](_0x39b8a8['shift']());}};_0x34737e(++_0x25ca73);}(_0x6914,0xd8));var _0x4691=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x6914[_0x12fc8d];return _0x3f9d04;};'use strict';var express=require(_0x4691('0x0'));var router=express[_0x4691('0x1')]();var controller=require(_0x4691('0x2'));router[_0x4691('0x3')]('/',controller[_0x4691('0x4')]);router[_0x4691('0x3')]('/forgot',controller['forgot']);router['post'](_0x4691('0x5'),controller[_0x4691('0x6')]);module['exports']=router; \ No newline at end of file +var _0x76c6=['login','/forgot','forgot','/reset/:token','reset','Router','./authLocal.controller','post'];(function(_0x10cc81,_0x172700){var _0x3bbe1e=function(_0x319ed2){while(--_0x319ed2){_0x10cc81['push'](_0x10cc81['shift']());}};_0x3bbe1e(++_0x172700);}(_0x76c6,0xed));var _0x676c=function(_0x490048,_0x32c740){_0x490048=_0x490048-0x0;var _0x34212d=_0x76c6[_0x490048];return _0x34212d;};'use strict';var express=require('express');var router=express[_0x676c('0x0')]();var controller=require(_0x676c('0x1'));router[_0x676c('0x2')]('/',controller[_0x676c('0x3')]);router[_0x676c('0x2')](_0x676c('0x4'),controller[_0x676c('0x5')]);router[_0x676c('0x2')](_0x676c('0x6'),controller[_0x676c('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 9e63b8a..b4b4005 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 _0xb3eb=['exports','STRING','INTEGER','sequelize'];(function(_0x5505b7,_0x5e1ab5){var _0x4e58d1=function(_0x368e17){while(--_0x368e17){_0x5505b7['push'](_0x5505b7['shift']());}};_0x4e58d1(++_0x5e1ab5);}(_0xb3eb,0x127));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbb3e('0x0'));module[_0xbb3e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xbb3e('0x2')]},'description':{'type':Sequelize[_0xbb3e('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xbb3e('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xa2aa=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x4a3acd,_0x4bf641){var _0x3efdaa=function(_0x32842d){while(--_0x32842d){_0x4a3acd['push'](_0x4a3acd['shift']());}};_0x3efdaa(++_0x4bf641);}(_0xa2aa,0xdc));var _0xaa2a=function(_0x346aef,_0x1d1870){_0x346aef=_0x346aef-0x0;var _0x2eeacb=_0xa2aa[_0x346aef];return _0x2eeacb;};'use strict';var Sequelize=require(_0xaa2a('0x0'));module[_0xaa2a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaa2a('0x2')]},'status':{'type':Sequelize[_0xaa2a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xaa2a('0x4')],'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 bf6e830..4c6f6c5 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 _0x5442=['to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','Automation','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','rawAttributes','length','find','create','body','update','addConditions','Condition','ids','getConditions','findOne','Action','omit','getActions','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x5442,0xf3));var _0x2544=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0x5442[_0x5c7a85];return _0x35290f;};'use strict';var emlformat=require(_0x2544('0x0'));var rimraf=require(_0x2544('0x1'));var zipdir=require(_0x2544('0x2'));var jsonpatch=require(_0x2544('0x3'));var rp=require(_0x2544('0x4'));var moment=require(_0x2544('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2544('0x6'));var util=require(_0x2544('0x7'));var path=require(_0x2544('0x8'));var sox=require('sox');var csv=require(_0x2544('0x9'));var ejs=require(_0x2544('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2544('0xb'));var crypto=require(_0x2544('0xc'));var jsforce=require(_0x2544('0xd'));var deskjs=require(_0x2544('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2544('0xf'));var Redis=require('ioredis');var authService=require(_0x2544('0x10'));var qs=require(_0x2544('0x11'));var as=require(_0x2544('0x12'));var hardwareService=require(_0x2544('0x13'));var logger=require(_0x2544('0x14'))(_0x2544('0x15'));var utils=require(_0x2544('0x16'));var config=require(_0x2544('0x17'));var licenseUtil=require(_0x2544('0x18'));var db=require(_0x2544('0x19'))['db'];function respondWithStatusCode(_0x303a76,_0x472155){_0x472155=_0x472155||0xcc;return function(_0x14b1a9){if(_0x14b1a9){return _0x303a76[_0x2544('0x1a')](_0x472155);}return _0x303a76['status'](_0x472155)['end']();};}function respondWithResult(_0x3bdb47,_0x451c11){_0x451c11=_0x451c11||0xc8;return function(_0x401e97){if(_0x401e97){return _0x3bdb47[_0x2544('0x1b')](_0x451c11)[_0x2544('0x1c')](_0x401e97);}};}function respondWithFilteredResult(_0x5e5401,_0xca1d77){return function(_0x102a03){if(_0x102a03){var _0x4d934d=typeof _0xca1d77[_0x2544('0x1d')]===_0x2544('0x1e')&&typeof _0xca1d77[_0x2544('0x1f')]===_0x2544('0x1e');var _0xc19ad8=_0x102a03[_0x2544('0x20')];var _0x2870eb=_0x4d934d?0x0:_0xca1d77['offset'];var _0x96cfac=_0x4d934d?_0x102a03[_0x2544('0x20')]:_0xca1d77[_0x2544('0x1d')]+_0xca1d77['limit'];var _0x1e9110;if(_0x96cfac>=_0xc19ad8){_0x96cfac=_0xc19ad8;_0x1e9110=0xc8;}else{_0x1e9110=0xce;}_0x5e5401[_0x2544('0x1b')](_0x1e9110);return _0x5e5401['set'](_0x2544('0x21'),_0x2870eb+'-'+_0x96cfac+'/'+_0xc19ad8)[_0x2544('0x1c')](_0x102a03);}return null;};}function patchUpdates(_0x15fa11){return function(_0x1366d2){try{jsonpatch[_0x2544('0x22')](_0x1366d2,_0x15fa11,!![]);}catch(_0x2be4f8){return BPromise[_0x2544('0x23')](_0x2be4f8);}return _0x1366d2[_0x2544('0x24')]();};}function saveUpdates(_0x3928a7,_0xc0f864){return function(_0x34b1a1){if(_0x34b1a1){return _0x34b1a1['update'](_0x3928a7)[_0x2544('0x25')](function(_0x2b3d7d){return _0x2b3d7d;});}return null;};}function removeEntity(_0x14dfb2,_0x36156d){return function(_0x2dc649){if(_0x2dc649){return _0x2dc649[_0x2544('0x26')]()[_0x2544('0x25')](function(){_0x14dfb2[_0x2544('0x1b')](0xcc)[_0x2544('0x27')]();});}};}function handleEntityNotFound(_0x487b18,_0x3c17ca){return function(_0x36d6ec){if(!_0x36d6ec){_0x487b18[_0x2544('0x1a')](0x194);}return _0x36d6ec;};}function handleError(_0xeec4e6,_0x3d26a6){_0x3d26a6=_0x3d26a6||0x1f4;return function(_0x53ab39){logger['error'](_0x53ab39[_0x2544('0x28')]);if(_0x53ab39[_0x2544('0x29')]){delete _0x53ab39[_0x2544('0x29')];}_0xeec4e6[_0x2544('0x1b')](_0x3d26a6)[_0x2544('0x2a')](_0x53ab39);};}exports[_0x2544('0x2b')]=function(_0x1d289e,_0x3f55ab){var _0x42252={},_0x2029c0={},_0x427ed4={'count':0x0,'rows':[]};var _0x511d6c=_[_0x2544('0x2c')](db[_0x2544('0x2d')]['rawAttributes'],function(_0x401b84){return{'name':_0x401b84['fieldName'],'type':_0x401b84[_0x2544('0x2e')][_0x2544('0x2f')]};});_0x2029c0[_0x2544('0x30')]=_[_0x2544('0x2c')](_0x511d6c,'name');_0x2029c0[_0x2544('0x31')]=_['keys'](_0x1d289e['query']);_0x2029c0[_0x2544('0x32')]=_[_0x2544('0x33')](_0x2029c0[_0x2544('0x30')],_0x2029c0['query']);_0x42252[_0x2544('0x34')]=_[_0x2544('0x33')](_0x2029c0[_0x2544('0x30')],qs['fields'](_0x1d289e['query'][_0x2544('0x35')]));_0x42252[_0x2544('0x34')]=_0x42252[_0x2544('0x34')]['length']?_0x42252[_0x2544('0x34')]:_0x2029c0[_0x2544('0x30')];if(!_0x1d289e['query'][_0x2544('0x36')](_0x2544('0x37'))){_0x42252[_0x2544('0x1f')]=qs['limit'](_0x1d289e['query'][_0x2544('0x1f')]);_0x42252[_0x2544('0x1d')]=qs[_0x2544('0x1d')](_0x1d289e[_0x2544('0x31')][_0x2544('0x1d')]);}_0x42252[_0x2544('0x38')]=qs['sort'](_0x1d289e['query']['sort']);_0x42252['where']=qs[_0x2544('0x32')](_[_0x2544('0x39')](_0x1d289e['query'],_0x2029c0[_0x2544('0x32')]),_0x511d6c);if(_0x1d289e[_0x2544('0x31')][_0x2544('0x3a')]){_0x42252[_0x2544('0x3b')]=_[_0x2544('0x3c')](_0x42252['where'],{'$or':_['map'](_0x511d6c,function(_0x4da934){if(_0x4da934[_0x2544('0x2e')]!==_0x2544('0x3d')){var _0x50bca3={};_0x50bca3[_0x4da934[_0x2544('0x29')]]={'$like':'%'+_0x1d289e[_0x2544('0x31')][_0x2544('0x3a')]+'%'};return _0x50bca3;}})});}_0x42252=_['merge']({},_0x42252,_0x1d289e[_0x2544('0x3e')]);var _0x32fedc={'where':_0x42252['where']};return db['Automation'][_0x2544('0x20')](_0x32fedc)[_0x2544('0x25')](function(_0x19951e){_0x427ed4[_0x2544('0x20')]=_0x19951e;if(_0x1d289e[_0x2544('0x31')][_0x2544('0x3f')]){_0x42252[_0x2544('0x40')]=[{'all':!![]}];}return db[_0x2544('0x2d')]['findAll'](_0x42252);})[_0x2544('0x25')](function(_0x276618){_0x427ed4['rows']=_0x276618;return _0x427ed4;})['then'](respondWithFilteredResult(_0x3f55ab,_0x42252))[_0x2544('0x41')](handleError(_0x3f55ab,null));};exports[_0x2544('0x42')]=function(_0x2a2a4d,_0x551e93){var _0x2c47c5={'raw':![],'where':{'id':_0x2a2a4d[_0x2544('0x43')]['id']}},_0x6df698={};_0x6df698[_0x2544('0x30')]=_[_0x2544('0x44')](db[_0x2544('0x2d')][_0x2544('0x45')]);_0x6df698[_0x2544('0x31')]=_[_0x2544('0x44')](_0x2a2a4d[_0x2544('0x31')]);_0x6df698['filters']=_['intersection'](_0x6df698[_0x2544('0x30')],_0x6df698[_0x2544('0x31')]);_0x2c47c5[_0x2544('0x34')]=_[_0x2544('0x33')](_0x6df698[_0x2544('0x30')],qs['fields'](_0x2a2a4d[_0x2544('0x31')][_0x2544('0x35')]));_0x2c47c5['attributes']=_0x2c47c5['attributes'][_0x2544('0x46')]?_0x2c47c5['attributes']:_0x6df698[_0x2544('0x30')];if(_0x2a2a4d[_0x2544('0x31')][_0x2544('0x3f')]){_0x2c47c5[_0x2544('0x40')]=[{'all':!![]}];}_0x2c47c5=_[_0x2544('0x3c')]({},_0x2c47c5,_0x2a2a4d[_0x2544('0x3e')]);return db[_0x2544('0x2d')][_0x2544('0x47')](_0x2c47c5)[_0x2544('0x25')](handleEntityNotFound(_0x551e93,null))[_0x2544('0x25')](respondWithResult(_0x551e93,null))['catch'](handleError(_0x551e93,null));};exports[_0x2544('0x48')]=function(_0x4e8673,_0x1491ce){return db['Automation'][_0x2544('0x48')](_0x4e8673[_0x2544('0x49')],{})[_0x2544('0x25')](respondWithResult(_0x1491ce,0xc9))[_0x2544('0x41')](handleError(_0x1491ce,null));};exports[_0x2544('0x4a')]=function(_0x493331,_0x30d8d2){if(_0x493331['body']['id']){delete _0x493331[_0x2544('0x49')]['id'];}return db[_0x2544('0x2d')][_0x2544('0x47')]({'where':{'id':_0x493331[_0x2544('0x43')]['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x30d8d2,null))[_0x2544('0x25')](saveUpdates(_0x493331['body'],null))['then'](respondWithResult(_0x30d8d2,null))[_0x2544('0x41')](handleError(_0x30d8d2,null));};exports[_0x2544('0x26')]=function(_0x186b0f,_0x2aeac7){return db['Automation'][_0x2544('0x47')]({'where':{'id':_0x186b0f[_0x2544('0x43')]['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x2aeac7,null))['then'](removeEntity(_0x2aeac7,null))[_0x2544('0x41')](handleError(_0x2aeac7,null));};exports[_0x2544('0x4b')]=function(_0x5b4de5,_0x3701b2,_0x19dfa8){return db[_0x2544('0x4c')][_0x2544('0x47')]({'where':{'id':_0x5b4de5[_0x2544('0x43')]['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x3701b2,null))['then'](function(_0x419720){if(_0x419720){return _0x419720['addConditions'](_0x5b4de5[_0x2544('0x49')][_0x2544('0x4d')],_['omit'](_0x5b4de5['body'],[_0x2544('0x4d'),'id'])||{});}})[_0x2544('0x25')](respondWithResult(_0x3701b2,null))[_0x2544('0x41')](handleError(_0x3701b2,null));};exports[_0x2544('0x4e')]=function(_0x127fd3,_0x241089,_0x2c4149){var _0x46b820={};var _0x39d5d6={};var _0x2007ee;var _0x781233;return db[_0x2544('0x2d')][_0x2544('0x4f')]({'where':{'id':_0x127fd3['params']['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x241089,null))['then'](function(_0x4f0474){if(_0x4f0474){_0x2007ee=_0x4f0474;_0x39d5d6[_0x2544('0x30')]=_[_0x2544('0x44')](db[_0x2544('0x4c')][_0x2544('0x45')]);_0x39d5d6[_0x2544('0x31')]=_[_0x2544('0x44')](_0x127fd3['query']);_0x39d5d6[_0x2544('0x32')]=_['intersection'](_0x39d5d6[_0x2544('0x30')],_0x39d5d6['query']);_0x46b820[_0x2544('0x34')]=_[_0x2544('0x33')](_0x39d5d6[_0x2544('0x30')],qs['fields'](_0x127fd3[_0x2544('0x31')]['fields']));_0x46b820['attributes']=_0x46b820['attributes']['length']?_0x46b820[_0x2544('0x34')]:_0x39d5d6['model'];_0x46b820['order']=qs['sort'](_0x127fd3[_0x2544('0x31')]['sort']);_0x46b820[_0x2544('0x3b')]=qs['filters'](_[_0x2544('0x39')](_0x127fd3[_0x2544('0x31')],_0x39d5d6[_0x2544('0x32')]));if(_0x127fd3[_0x2544('0x31')][_0x2544('0x3a')]){_0x46b820[_0x2544('0x3b')]=_[_0x2544('0x3c')](_0x46b820[_0x2544('0x3b')],{'$or':_[_0x2544('0x2c')](_0x46b820['attributes'],function(_0x3d98f9){var _0xa8f35d={};_0xa8f35d[_0x3d98f9]={'$like':'%'+_0x127fd3['query']['filter']+'%'};return _0xa8f35d;})});}_0x46b820=_[_0x2544('0x3c')]({},_0x46b820,_0x127fd3['options']);return _0x2007ee[_0x2544('0x4e')](_0x46b820);}})[_0x2544('0x25')](function(_0x5f4b42){if(_0x5f4b42){_0x781233=_0x5f4b42[_0x2544('0x46')];if(!_0x127fd3[_0x2544('0x31')][_0x2544('0x36')](_0x2544('0x37'))){_0x46b820[_0x2544('0x1f')]=qs[_0x2544('0x1f')](_0x127fd3[_0x2544('0x31')][_0x2544('0x1f')]);_0x46b820[_0x2544('0x1d')]=qs[_0x2544('0x1d')](_0x127fd3[_0x2544('0x31')][_0x2544('0x1d')]);}return _0x2007ee[_0x2544('0x4e')](_0x46b820);}})['then'](function(_0x40d37b){if(_0x40d37b){return _0x40d37b?{'count':_0x781233,'rows':_0x40d37b}:null;}})['then'](respondWithResult(_0x241089,null))[_0x2544('0x41')](handleError(_0x241089,null));};exports['addActions']=function(_0x40a622,_0x44cd33,_0x4c4d7a){return db[_0x2544('0x50')][_0x2544('0x47')]({'where':{'id':_0x40a622[_0x2544('0x43')]['id']}})['then'](handleEntityNotFound(_0x44cd33,null))[_0x2544('0x25')](function(_0x2d60cf){if(_0x2d60cf){return _0x2d60cf['addActions'](_0x40a622[_0x2544('0x49')][_0x2544('0x4d')],_[_0x2544('0x51')](_0x40a622[_0x2544('0x49')],[_0x2544('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x44cd33,null))[_0x2544('0x41')](handleError(_0x44cd33,null));};exports[_0x2544('0x52')]=function(_0x2dbaef,_0x425275,_0x175247){var _0x1befe4={};var _0x463295={};var _0x585fc9;var _0x17cb78;return db[_0x2544('0x2d')]['findOne']({'where':{'id':_0x2dbaef[_0x2544('0x43')]['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x425275,null))[_0x2544('0x25')](function(_0x448f26){if(_0x448f26){_0x585fc9=_0x448f26;_0x463295[_0x2544('0x30')]=_[_0x2544('0x44')](db[_0x2544('0x50')][_0x2544('0x45')]);_0x463295[_0x2544('0x31')]=_[_0x2544('0x44')](_0x2dbaef[_0x2544('0x31')]);_0x463295['filters']=_[_0x2544('0x33')](_0x463295['model'],_0x463295['query']);_0x1befe4['attributes']=_[_0x2544('0x33')](_0x463295[_0x2544('0x30')],qs[_0x2544('0x35')](_0x2dbaef[_0x2544('0x31')][_0x2544('0x35')]));_0x1befe4['attributes']=_0x1befe4[_0x2544('0x34')][_0x2544('0x46')]?_0x1befe4[_0x2544('0x34')]:_0x463295[_0x2544('0x30')];_0x1befe4[_0x2544('0x38')]=qs[_0x2544('0x53')](_0x2dbaef[_0x2544('0x31')][_0x2544('0x53')]);_0x1befe4[_0x2544('0x3b')]=qs[_0x2544('0x32')](_[_0x2544('0x39')](_0x2dbaef[_0x2544('0x31')],_0x463295[_0x2544('0x32')]));if(_0x2dbaef['query'][_0x2544('0x3a')]){_0x1befe4[_0x2544('0x3b')]=_[_0x2544('0x3c')](_0x1befe4['where'],{'$or':_[_0x2544('0x2c')](_0x1befe4[_0x2544('0x34')],function(_0x522f0f){var _0x5532c4={};_0x5532c4[_0x522f0f]={'$like':'%'+_0x2dbaef['query'][_0x2544('0x3a')]+'%'};return _0x5532c4;})});}_0x1befe4=_[_0x2544('0x3c')]({},_0x1befe4,_0x2dbaef[_0x2544('0x3e')]);return _0x585fc9[_0x2544('0x52')](_0x1befe4);}})[_0x2544('0x25')](function(_0x4f9a45){if(_0x4f9a45){_0x17cb78=_0x4f9a45[_0x2544('0x46')];if(!_0x2dbaef[_0x2544('0x31')]['hasOwnProperty']('nolimit')){_0x1befe4['limit']=qs[_0x2544('0x1f')](_0x2dbaef[_0x2544('0x31')][_0x2544('0x1f')]);_0x1befe4[_0x2544('0x1d')]=qs[_0x2544('0x1d')](_0x2dbaef[_0x2544('0x31')][_0x2544('0x1d')]);}return _0x585fc9[_0x2544('0x52')](_0x1befe4);}})[_0x2544('0x25')](function(_0x2b6616){if(_0x2b6616){return _0x2b6616?{'count':_0x17cb78,'rows':_0x2b6616}:null;}})[_0x2544('0x25')](respondWithResult(_0x425275,null))['catch'](handleError(_0x425275,null));}; \ No newline at end of file +var _0x9059=['status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','Automation','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','params','find','catch','create','body','addConditions','Condition','ids','omit','getConditions','addActions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x4e9fed,_0x19f4f3){var _0x5c8cc0=function(_0x36116c){while(--_0x36116c){_0x4e9fed['push'](_0x4e9fed['shift']());}};_0x5c8cc0(++_0x19f4f3);}(_0x9059,0xda));var _0x9905=function(_0x271de1,_0x42ac41){_0x271de1=_0x271de1-0x0;var _0x5666ff=_0x9059[_0x271de1];return _0x5666ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9905('0x0'));var zipdir=require(_0x9905('0x1'));var jsonpatch=require(_0x9905('0x2'));var rp=require(_0x9905('0x3'));var moment=require(_0x9905('0x4'));var BPromise=require(_0x9905('0x5'));var Mustache=require(_0x9905('0x6'));var util=require(_0x9905('0x7'));var path=require(_0x9905('0x8'));var sox=require(_0x9905('0x9'));var csv=require(_0x9905('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9905('0xb'));var _=require(_0x9905('0xc'));var squel=require(_0x9905('0xd'));var crypto=require(_0x9905('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9905('0xf'));var toCsv=require(_0x9905('0xa'));var querystring=require(_0x9905('0x10'));var Papa=require(_0x9905('0x11'));var Redis=require(_0x9905('0x12'));var authService=require(_0x9905('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9905('0x14'));var logger=require(_0x9905('0x15'))(_0x9905('0x16'));var utils=require(_0x9905('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9905('0x18'))['db'];function respondWithStatusCode(_0x33f1b9,_0x36d8b8){_0x36d8b8=_0x36d8b8||0xcc;return function(_0x367783){if(_0x367783){return _0x33f1b9['sendStatus'](_0x36d8b8);}return _0x33f1b9[_0x9905('0x19')](_0x36d8b8)['end']();};}function respondWithResult(_0x43356f,_0x56174e){_0x56174e=_0x56174e||0xc8;return function(_0x30cce7){if(_0x30cce7){return _0x43356f[_0x9905('0x19')](_0x56174e)[_0x9905('0x1a')](_0x30cce7);}};}function respondWithFilteredResult(_0x3a849a,_0x23749a){return function(_0xde151){if(_0xde151){var _0x25c98e=typeof _0x23749a[_0x9905('0x1b')]==='undefined'&&typeof _0x23749a[_0x9905('0x1c')]===_0x9905('0x1d');var _0x548770=_0xde151[_0x9905('0x1e')];var _0x5452de=_0x25c98e?0x0:_0x23749a[_0x9905('0x1b')];var _0x12ab5d=_0x25c98e?_0xde151['count']:_0x23749a[_0x9905('0x1b')]+_0x23749a[_0x9905('0x1c')];var _0x5000e5;if(_0x12ab5d>=_0x548770){_0x12ab5d=_0x548770;_0x5000e5=0xc8;}else{_0x5000e5=0xce;}_0x3a849a['status'](_0x5000e5);return _0x3a849a[_0x9905('0x1f')](_0x9905('0x20'),_0x5452de+'-'+_0x12ab5d+'/'+_0x548770)['json'](_0xde151);}return null;};}function patchUpdates(_0x965e4a){return function(_0x43025d){try{jsonpatch['apply'](_0x43025d,_0x965e4a,!![]);}catch(_0x23351f){return BPromise[_0x9905('0x21')](_0x23351f);}return _0x43025d['save']();};}function saveUpdates(_0x20c7f4,_0x12346d){return function(_0x4ea8d0){if(_0x4ea8d0){return _0x4ea8d0[_0x9905('0x22')](_0x20c7f4)[_0x9905('0x23')](function(_0x42b175){return _0x42b175;});}return null;};}function removeEntity(_0x51ed93,_0x383736){return function(_0x2ed4e2){if(_0x2ed4e2){return _0x2ed4e2[_0x9905('0x24')]()[_0x9905('0x23')](function(){_0x51ed93[_0x9905('0x19')](0xcc)[_0x9905('0x25')]();});}};}function handleEntityNotFound(_0x4bb3a0,_0x2ebcb0){return function(_0xf71b77){if(!_0xf71b77){_0x4bb3a0['sendStatus'](0x194);}return _0xf71b77;};}function handleError(_0x3e003c,_0x4a3efb){_0x4a3efb=_0x4a3efb||0x1f4;return function(_0x4d4a1b){logger['error'](_0x4d4a1b[_0x9905('0x26')]);if(_0x4d4a1b['name']){delete _0x4d4a1b[_0x9905('0x27')];}_0x3e003c['status'](_0x4a3efb)[_0x9905('0x28')](_0x4d4a1b);};}exports[_0x9905('0x29')]=function(_0x5290ce,_0x3f5f62){var _0x5d9777={},_0x2291a0={},_0x117d5c={'count':0x0,'rows':[]};var _0x43e042=_[_0x9905('0x2a')](db[_0x9905('0x2b')][_0x9905('0x2c')],function(_0x228a36){return{'name':_0x228a36[_0x9905('0x2d')],'type':_0x228a36['type']['key']};});_0x2291a0[_0x9905('0x2e')]=_[_0x9905('0x2a')](_0x43e042,'name');_0x2291a0[_0x9905('0x2f')]=_[_0x9905('0x30')](_0x5290ce['query']);_0x2291a0['filters']=_[_0x9905('0x31')](_0x2291a0[_0x9905('0x2e')],_0x2291a0['query']);_0x5d9777[_0x9905('0x32')]=_[_0x9905('0x31')](_0x2291a0[_0x9905('0x2e')],qs[_0x9905('0x33')](_0x5290ce[_0x9905('0x2f')]['fields']));_0x5d9777[_0x9905('0x32')]=_0x5d9777[_0x9905('0x32')][_0x9905('0x34')]?_0x5d9777['attributes']:_0x2291a0['model'];if(!_0x5290ce['query'][_0x9905('0x35')](_0x9905('0x36'))){_0x5d9777[_0x9905('0x1c')]=qs[_0x9905('0x1c')](_0x5290ce['query'][_0x9905('0x1c')]);_0x5d9777[_0x9905('0x1b')]=qs[_0x9905('0x1b')](_0x5290ce['query'][_0x9905('0x1b')]);}_0x5d9777[_0x9905('0x37')]=qs[_0x9905('0x38')](_0x5290ce['query'][_0x9905('0x38')]);_0x5d9777['where']=qs[_0x9905('0x39')](_[_0x9905('0x3a')](_0x5290ce[_0x9905('0x2f')],_0x2291a0[_0x9905('0x39')]),_0x43e042);if(_0x5290ce[_0x9905('0x2f')][_0x9905('0x3b')]){_0x5d9777[_0x9905('0x3c')]=_['merge'](_0x5d9777['where'],{'$or':_['map'](_0x43e042,function(_0x33b374){if(_0x33b374[_0x9905('0x3d')]!==_0x9905('0x3e')){var _0x3c8813={};_0x3c8813[_0x33b374[_0x9905('0x27')]]={'$like':'%'+_0x5290ce['query'][_0x9905('0x3b')]+'%'};return _0x3c8813;}})});}_0x5d9777=_[_0x9905('0x3f')]({},_0x5d9777,_0x5290ce[_0x9905('0x40')]);var _0x458235={'where':_0x5d9777[_0x9905('0x3c')]};return db[_0x9905('0x2b')][_0x9905('0x1e')](_0x458235)[_0x9905('0x23')](function(_0x5c89a8){_0x117d5c[_0x9905('0x1e')]=_0x5c89a8;if(_0x5290ce[_0x9905('0x2f')][_0x9905('0x41')]){_0x5d9777[_0x9905('0x42')]=[{'all':!![]}];}return db[_0x9905('0x2b')][_0x9905('0x43')](_0x5d9777);})[_0x9905('0x23')](function(_0x368d9e){_0x117d5c['rows']=_0x368d9e;return _0x117d5c;})['then'](respondWithFilteredResult(_0x3f5f62,_0x5d9777))['catch'](handleError(_0x3f5f62,null));};exports['show']=function(_0x3b4de0,_0x5b1958){var _0x1d27eb={'raw':![],'where':{'id':_0x3b4de0[_0x9905('0x44')]['id']}},_0x5a1044={};_0x5a1044[_0x9905('0x2e')]=_['keys'](db[_0x9905('0x2b')][_0x9905('0x2c')]);_0x5a1044[_0x9905('0x2f')]=_[_0x9905('0x30')](_0x3b4de0[_0x9905('0x2f')]);_0x5a1044[_0x9905('0x39')]=_[_0x9905('0x31')](_0x5a1044[_0x9905('0x2e')],_0x5a1044['query']);_0x1d27eb[_0x9905('0x32')]=_['intersection'](_0x5a1044[_0x9905('0x2e')],qs[_0x9905('0x33')](_0x3b4de0[_0x9905('0x2f')][_0x9905('0x33')]));_0x1d27eb[_0x9905('0x32')]=_0x1d27eb[_0x9905('0x32')]['length']?_0x1d27eb[_0x9905('0x32')]:_0x5a1044['model'];if(_0x3b4de0['query'][_0x9905('0x41')]){_0x1d27eb[_0x9905('0x42')]=[{'all':!![]}];}_0x1d27eb=_['merge']({},_0x1d27eb,_0x3b4de0['options']);return db[_0x9905('0x2b')][_0x9905('0x45')](_0x1d27eb)[_0x9905('0x23')](handleEntityNotFound(_0x5b1958,null))[_0x9905('0x23')](respondWithResult(_0x5b1958,null))[_0x9905('0x46')](handleError(_0x5b1958,null));};exports[_0x9905('0x47')]=function(_0x2ecc0f,_0x53b145){return db[_0x9905('0x2b')][_0x9905('0x47')](_0x2ecc0f[_0x9905('0x48')],{})[_0x9905('0x23')](respondWithResult(_0x53b145,0xc9))[_0x9905('0x46')](handleError(_0x53b145,null));};exports[_0x9905('0x22')]=function(_0x3ee0e1,_0x5e002b){if(_0x3ee0e1[_0x9905('0x48')]['id']){delete _0x3ee0e1[_0x9905('0x48')]['id'];}return db[_0x9905('0x2b')][_0x9905('0x45')]({'where':{'id':_0x3ee0e1[_0x9905('0x44')]['id']}})[_0x9905('0x23')](handleEntityNotFound(_0x5e002b,null))[_0x9905('0x23')](saveUpdates(_0x3ee0e1['body'],null))[_0x9905('0x23')](respondWithResult(_0x5e002b,null))[_0x9905('0x46')](handleError(_0x5e002b,null));};exports[_0x9905('0x24')]=function(_0x474804,_0xa7f72b){return db[_0x9905('0x2b')][_0x9905('0x45')]({'where':{'id':_0x474804['params']['id']}})['then'](handleEntityNotFound(_0xa7f72b,null))[_0x9905('0x23')](removeEntity(_0xa7f72b,null))[_0x9905('0x46')](handleError(_0xa7f72b,null));};exports[_0x9905('0x49')]=function(_0x587ae8,_0x51262a,_0x4e7813){return db[_0x9905('0x4a')]['find']({'where':{'id':_0x587ae8['params']['id']}})[_0x9905('0x23')](handleEntityNotFound(_0x51262a,null))['then'](function(_0x381994){if(_0x381994){return _0x381994[_0x9905('0x49')](_0x587ae8['body'][_0x9905('0x4b')],_[_0x9905('0x4c')](_0x587ae8[_0x9905('0x48')],[_0x9905('0x4b'),'id'])||{});}})[_0x9905('0x23')](respondWithResult(_0x51262a,null))[_0x9905('0x46')](handleError(_0x51262a,null));};exports[_0x9905('0x4d')]=function(_0x4bfa40,_0x14a8b6,_0x2cedd2){var _0x1d9bb4={};var _0x438d7c={};var _0x2364ef;var _0x56b021;return db[_0x9905('0x2b')]['findOne']({'where':{'id':_0x4bfa40['params']['id']}})['then'](handleEntityNotFound(_0x14a8b6,null))[_0x9905('0x23')](function(_0x4b6716){if(_0x4b6716){_0x2364ef=_0x4b6716;_0x438d7c[_0x9905('0x2e')]=_[_0x9905('0x30')](db['Condition'][_0x9905('0x2c')]);_0x438d7c['query']=_[_0x9905('0x30')](_0x4bfa40[_0x9905('0x2f')]);_0x438d7c[_0x9905('0x39')]=_[_0x9905('0x31')](_0x438d7c[_0x9905('0x2e')],_0x438d7c['query']);_0x1d9bb4[_0x9905('0x32')]=_[_0x9905('0x31')](_0x438d7c[_0x9905('0x2e')],qs[_0x9905('0x33')](_0x4bfa40[_0x9905('0x2f')][_0x9905('0x33')]));_0x1d9bb4[_0x9905('0x32')]=_0x1d9bb4[_0x9905('0x32')][_0x9905('0x34')]?_0x1d9bb4[_0x9905('0x32')]:_0x438d7c[_0x9905('0x2e')];_0x1d9bb4[_0x9905('0x37')]=qs[_0x9905('0x38')](_0x4bfa40[_0x9905('0x2f')]['sort']);_0x1d9bb4[_0x9905('0x3c')]=qs[_0x9905('0x39')](_[_0x9905('0x3a')](_0x4bfa40[_0x9905('0x2f')],_0x438d7c[_0x9905('0x39')]));if(_0x4bfa40['query'][_0x9905('0x3b')]){_0x1d9bb4[_0x9905('0x3c')]=_['merge'](_0x1d9bb4['where'],{'$or':_[_0x9905('0x2a')](_0x1d9bb4[_0x9905('0x32')],function(_0x391688){var _0x27267a={};_0x27267a[_0x391688]={'$like':'%'+_0x4bfa40[_0x9905('0x2f')][_0x9905('0x3b')]+'%'};return _0x27267a;})});}_0x1d9bb4=_[_0x9905('0x3f')]({},_0x1d9bb4,_0x4bfa40['options']);return _0x2364ef[_0x9905('0x4d')](_0x1d9bb4);}})[_0x9905('0x23')](function(_0x482e2d){if(_0x482e2d){_0x56b021=_0x482e2d[_0x9905('0x34')];if(!_0x4bfa40[_0x9905('0x2f')][_0x9905('0x35')](_0x9905('0x36'))){_0x1d9bb4[_0x9905('0x1c')]=qs[_0x9905('0x1c')](_0x4bfa40[_0x9905('0x2f')][_0x9905('0x1c')]);_0x1d9bb4[_0x9905('0x1b')]=qs[_0x9905('0x1b')](_0x4bfa40[_0x9905('0x2f')][_0x9905('0x1b')]);}return _0x2364ef[_0x9905('0x4d')](_0x1d9bb4);}})['then'](function(_0x3dc31f){if(_0x3dc31f){return _0x3dc31f?{'count':_0x56b021,'rows':_0x3dc31f}:null;}})['then'](respondWithResult(_0x14a8b6,null))[_0x9905('0x46')](handleError(_0x14a8b6,null));};exports[_0x9905('0x4e')]=function(_0x546eff,_0x2db651,_0x5473e5){return db[_0x9905('0x4f')][_0x9905('0x45')]({'where':{'id':_0x546eff[_0x9905('0x44')]['id']}})[_0x9905('0x23')](handleEntityNotFound(_0x2db651,null))['then'](function(_0x470058){if(_0x470058){return _0x470058[_0x9905('0x4e')](_0x546eff[_0x9905('0x48')][_0x9905('0x4b')],_[_0x9905('0x4c')](_0x546eff[_0x9905('0x48')],[_0x9905('0x4b'),'id'])||{});}})[_0x9905('0x23')](respondWithResult(_0x2db651,null))[_0x9905('0x46')](handleError(_0x2db651,null));};exports[_0x9905('0x50')]=function(_0x5b7ef1,_0x36dddd,_0x2019e8){var _0xf546d0={};var _0x3ce036={};var _0x46aa1f;var _0x5b4531;return db[_0x9905('0x2b')]['findOne']({'where':{'id':_0x5b7ef1[_0x9905('0x44')]['id']}})[_0x9905('0x23')](handleEntityNotFound(_0x36dddd,null))[_0x9905('0x23')](function(_0x331142){if(_0x331142){_0x46aa1f=_0x331142;_0x3ce036[_0x9905('0x2e')]=_[_0x9905('0x30')](db['Action'][_0x9905('0x2c')]);_0x3ce036['query']=_[_0x9905('0x30')](_0x5b7ef1['query']);_0x3ce036['filters']=_[_0x9905('0x31')](_0x3ce036[_0x9905('0x2e')],_0x3ce036[_0x9905('0x2f')]);_0xf546d0[_0x9905('0x32')]=_[_0x9905('0x31')](_0x3ce036[_0x9905('0x2e')],qs['fields'](_0x5b7ef1[_0x9905('0x2f')]['fields']));_0xf546d0[_0x9905('0x32')]=_0xf546d0['attributes'][_0x9905('0x34')]?_0xf546d0[_0x9905('0x32')]:_0x3ce036['model'];_0xf546d0[_0x9905('0x37')]=qs['sort'](_0x5b7ef1['query'][_0x9905('0x38')]);_0xf546d0['where']=qs[_0x9905('0x39')](_[_0x9905('0x3a')](_0x5b7ef1['query'],_0x3ce036[_0x9905('0x39')]));if(_0x5b7ef1[_0x9905('0x2f')][_0x9905('0x3b')]){_0xf546d0[_0x9905('0x3c')]=_[_0x9905('0x3f')](_0xf546d0['where'],{'$or':_[_0x9905('0x2a')](_0xf546d0[_0x9905('0x32')],function(_0x3f8639){var _0x13852d={};_0x13852d[_0x3f8639]={'$like':'%'+_0x5b7ef1[_0x9905('0x2f')][_0x9905('0x3b')]+'%'};return _0x13852d;})});}_0xf546d0=_[_0x9905('0x3f')]({},_0xf546d0,_0x5b7ef1[_0x9905('0x40')]);return _0x46aa1f['getActions'](_0xf546d0);}})[_0x9905('0x23')](function(_0x103d2c){if(_0x103d2c){_0x5b4531=_0x103d2c[_0x9905('0x34')];if(!_0x5b7ef1[_0x9905('0x2f')][_0x9905('0x35')](_0x9905('0x36'))){_0xf546d0[_0x9905('0x1c')]=qs['limit'](_0x5b7ef1['query'][_0x9905('0x1c')]);_0xf546d0['offset']=qs['offset'](_0x5b7ef1['query'][_0x9905('0x1b')]);}return _0x46aa1f['getActions'](_0xf546d0);}})['then'](function(_0x31a240){if(_0x31a240){return _0x31a240?{'count':_0x5b4531,'rows':_0x31a240}:null;}})['then'](respondWithResult(_0x36dddd,null))['catch'](handleError(_0x36dddd,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 763943d..eb7ba7c 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 _0x292a=['./automation.attributes','exports','define','Automation','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x492547,_0x4cd3bc){var _0x43c08a=function(_0xbba0c5){while(--_0xbba0c5){_0x492547['push'](_0x492547['shift']());}};_0x43c08a(++_0x4cd3bc);}(_0x292a,0x68));var _0xa292=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x292a[_0xf51c06];return _0x1d5420;};'use strict';var _=require('lodash');var util=require(_0xa292('0x0'));var logger=require(_0xa292('0x1'))(_0xa292('0x2'));var moment=require('moment');var BPromise=require(_0xa292('0x3'));var rp=require(_0xa292('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa292('0x5'));var config=require('../../config/environment');var attributes=require(_0xa292('0x6'));module[_0xa292('0x7')]=function(_0x4f8de3,_0x242c49){return _0x4f8de3[_0xa292('0x8')](_0xa292('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e0d=['moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','Automation','util','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3e0d,0xce));var _0xd3e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e0d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3e0('0x0'));var logger=require(_0xd3e0('0x1'))(_0xd3e0('0x2'));var moment=require(_0xd3e0('0x3'));var BPromise=require(_0xd3e0('0x4'));var rp=require(_0xd3e0('0x5'));var fs=require('fs');var path=require(_0xd3e0('0x6'));var rimraf=require('rimraf');var config=require(_0xd3e0('0x7'));var attributes=require(_0xd3e0('0x8'));module[_0xd3e0('0x9')]=function(_0x51edc7,_0x519cf5){return _0x51edc7['define'](_0xd3e0('0xa'),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 41a993d..ca1fc6f 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 _0x5a13=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','stringify','code','message','error'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x5a13,0x145));var _0x35a1=function(_0x11ba2d,_0xb2a851){_0x11ba2d=_0x11ba2d-0x0;var _0x5c3efd=_0x5a13[_0x11ba2d];return _0x5c3efd;};'use strict';var _=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var moment=require('moment');var BPromise=require(_0x35a1('0x2'));var rs=require(_0x35a1('0x3'));var fs=require('fs');var Redis=require(_0x35a1('0x4'));var db=require(_0x35a1('0x5'))['db'];var utils=require(_0x35a1('0x6'));var logger=require(_0x35a1('0x7'))(_0x35a1('0x8'));var config=require(_0x35a1('0x9'));var jayson=require(_0x35a1('0xa'));var client=jayson[_0x35a1('0xb')][_0x35a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x407b26,_0x10a34f,_0x3aa00e){return new BPromise(function(_0x58afca,_0x57d9fd){return client['request'](_0x407b26,_0x3aa00e)[_0x35a1('0xd')](function(_0x103ec8){logger['info'](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x10a34f,_0x35a1('0xf'),JSON[_0x35a1('0x10')](_0x103ec8));if(_0x103ec8['error']){if(_0x103ec8['error'][_0x35a1('0x11')]===0x1f4){logger['error'](_0x35a1('0xe'),_0x10a34f,_0x103ec8['error'][_0x35a1('0x12')]);return _0x57d9fd(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);return _0x58afca(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}else{logger[_0x35a1('0x14')](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));_0x58afca(_0x103ec8[_0x35a1('0x15')][_0x35a1('0x12')]);}})[_0x35a1('0x16')](function(_0x251d32){logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x251d32);_0x57d9fd(_0x251d32);});});} \ No newline at end of file +var _0x47d6=['debug','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x10f875,_0x51f8cf){var _0x3accfa=function(_0x1918ea){while(--_0x1918ea){_0x10f875['push'](_0x10f875['shift']());}};_0x3accfa(++_0x51f8cf);}(_0x47d6,0x13f));var _0x647d=function(_0x19cd14,_0x3ef302){_0x19cd14=_0x19cd14-0x0;var _0x3382db=_0x47d6[_0x19cd14];return _0x3382db;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var moment=require(_0x647d('0x2'));var BPromise=require(_0x647d('0x3'));var rs=require(_0x647d('0x4'));var fs=require('fs');var Redis=require(_0x647d('0x5'));var db=require(_0x647d('0x6'))['db'];var utils=require(_0x647d('0x7'));var logger=require(_0x647d('0x8'))(_0x647d('0x9'));var config=require(_0x647d('0xa'));var jayson=require(_0x647d('0xb'));var client=jayson[_0x647d('0xc')][_0x647d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db1db,_0x1c6a88,_0x4baa1e){return new BPromise(function(_0x119c54,_0x348540){return client[_0x647d('0xe')](_0x1db1db,_0x4baa1e)[_0x647d('0xf')](function(_0x414518){logger[_0x647d('0x10')](_0x647d('0x11'),_0x1c6a88,_0x647d('0x12'));logger[_0x647d('0x13')](_0x647d('0x14'),_0x1c6a88,_0x647d('0x12'),JSON[_0x647d('0x15')](_0x414518));if(_0x414518['error']){if(_0x414518['error'][_0x647d('0x16')]===0x1f4){logger[_0x647d('0x17')](_0x647d('0x11'),_0x1c6a88,_0x414518[_0x647d('0x17')][_0x647d('0x18')]);return _0x348540(_0x414518[_0x647d('0x17')][_0x647d('0x18')]);}logger[_0x647d('0x17')]('Automation,\x20%s,\x20%s',_0x1c6a88,_0x414518[_0x647d('0x17')][_0x647d('0x18')]);return _0x119c54(_0x414518['error'][_0x647d('0x18')]);}else{logger[_0x647d('0x10')](_0x647d('0x11'),_0x1c6a88,'request\x20sent');_0x119c54(_0x414518['result'][_0x647d('0x18')]);}})[_0x647d('0x19')](function(_0x433cc1){logger['error'](_0x647d('0x11'),_0x1c6a88,_0x433cc1);_0x348540(_0x433cc1);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 8a2b500..7d9e6e6 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 _0x0cd6=['/:id/conditions','getConditions','/:id/actions','post','addConditions','addActions','/:id','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./automation.controller','get','isAuthenticated','show'];(function(_0x3c8b42,_0x3429fa){var _0x6f8135=function(_0x5e4b40){while(--_0x5e4b40){_0x3c8b42['push'](_0x3c8b42['shift']());}};_0x6f8135(++_0x3429fa);}(_0x0cd6,0x113));var _0x60cd=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x0cd6[_0x26f1b2];return _0x1624a4;};'use strict';var multer=require(_0x60cd('0x0'));var util=require(_0x60cd('0x1'));var path=require('path');var timeout=require(_0x60cd('0x2'));var express=require(_0x60cd('0x3'));var router=express['Router']();var fs_extra=require(_0x60cd('0x4'));var auth=require(_0x60cd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x60cd('0x6'));router[_0x60cd('0x7')]('/',auth[_0x60cd('0x8')](),controller['index']);router[_0x60cd('0x7')]('/:id',auth[_0x60cd('0x8')](),controller[_0x60cd('0x9')]);router[_0x60cd('0x7')](_0x60cd('0xa'),auth[_0x60cd('0x8')](),controller[_0x60cd('0xb')]);router[_0x60cd('0x7')](_0x60cd('0xc'),auth[_0x60cd('0x8')](),controller['getActions']);router[_0x60cd('0xd')]('/',auth[_0x60cd('0x8')](),controller['create']);router[_0x60cd('0xd')]('/:id/conditions',auth[_0x60cd('0x8')](),controller[_0x60cd('0xe')]);router['post'](_0x60cd('0xc'),auth[_0x60cd('0x8')](),controller[_0x60cd('0xf')]);router['put'](_0x60cd('0x10'),auth[_0x60cd('0x8')](),controller['update']);router[_0x60cd('0x11')]('/:id',auth[_0x60cd('0x8')](),controller[_0x60cd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa2ae=['post','create','addConditions','addActions','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xa2ae,0x1dd));var _0xea2a=function(_0x497672,_0x12ffe6){_0x497672=_0x497672-0x0;var _0x392c0b=_0xa2ae[_0x497672];return _0x392c0b;};'use strict';var multer=require('multer');var util=require(_0xea2a('0x0'));var path=require('path');var timeout=require(_0xea2a('0x1'));var express=require(_0xea2a('0x2'));var router=express[_0xea2a('0x3')]();var fs_extra=require(_0xea2a('0x4'));var auth=require(_0xea2a('0x5'));var interaction=require(_0xea2a('0x6'));var config=require('../../config/environment');var controller=require(_0xea2a('0x7'));router['get']('/',auth[_0xea2a('0x8')](),controller[_0xea2a('0x9')]);router[_0xea2a('0xa')](_0xea2a('0xb'),auth[_0xea2a('0x8')](),controller[_0xea2a('0xc')]);router[_0xea2a('0xa')](_0xea2a('0xd'),auth[_0xea2a('0x8')](),controller[_0xea2a('0xe')]);router[_0xea2a('0xa')](_0xea2a('0xf'),auth[_0xea2a('0x8')](),controller[_0xea2a('0x10')]);router[_0xea2a('0x11')]('/',auth[_0xea2a('0x8')](),controller[_0xea2a('0x12')]);router[_0xea2a('0x11')]('/:id/conditions',auth[_0xea2a('0x8')](),controller[_0xea2a('0x13')]);router['post']('/:id/actions',auth[_0xea2a('0x8')](),controller[_0xea2a('0x14')]);router[_0xea2a('0x15')](_0xea2a('0xb'),auth[_0xea2a('0x8')](),controller[_0xea2a('0x16')]);router[_0xea2a('0x17')](_0xea2a('0xb'),auth[_0xea2a('0x8')](),controller[_0xea2a('0x18')]);module[_0xea2a('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 1ebdea5..bdb4be6 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 _0x6bfc=['INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\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)','sequelize','exports','ivr','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','STRING'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0x6bfc,0x1da));var _0xc6bf=function(_0x39ddf1,_0x4ddf8a){_0x39ddf1=_0x39ddf1-0x0;var _0xe30e04=_0x6bfc[_0x39ddf1];return _0xe30e04;};'use strict';var Sequelize=require(_0xc6bf('0x0'));module[_0xc6bf('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xc6bf('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc6bf('0x3')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xc6bf('0x4')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc6bf('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc6bf('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc6bf('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0xc6bf('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'comment':_0xc6bf('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc6bf('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc6bf('0x6')],'defaultValue':_0xc6bf('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xc6bf('0xf')](_0xc6bf('0x10'),_0xc6bf('0x11'),'onlyIfOpen'),'defaultValue':_0xc6bf('0x10')},'dialAMDActive':{'type':Sequelize[_0xc6bf('0x12')],'defaultValue':0x0,'comment':_0xc6bf('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc6bf('0x4')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc6bf('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc6bf('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc6bf('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc6bf('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc6bf('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc6bf('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc6bf('0xf')](_0xc6bf('0x19'),_0xc6bf('0x1a')),'defaultValue':_0xc6bf('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xc6bf('0x4')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc6bf('0x1b')},'dialCutDigit':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc6bf('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x758c=['sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x5de6c9,_0x471538){var _0x4f45f6=function(_0xe0c086){while(--_0xe0c086){_0x5de6c9['push'](_0x5de6c9['shift']());}};_0x4f45f6(++_0x471538);}(_0x758c,0xac));var _0xc758=function(_0x4be2d4,_0x11f5b7){_0x4be2d4=_0x4be2d4-0x0;var _0x5f398a=_0x758c[_0x4be2d4];return _0x5f398a;};'use strict';var Sequelize=require(_0xc758('0x0'));module['exports']={'name':{'type':Sequelize[_0xc758('0x1')],'unique':_0xc758('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc758('0x3')](_0xc758('0x4')),'allowNull':![],'defaultValue':_0xc758('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc758('0x5')],'defaultValue':0x0,'comment':_0xc758('0x6')},'limitCalls':{'type':Sequelize[_0xc758('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc758('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc758('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc758('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc758('0x7')](0x5)[_0xc758('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc758('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc758('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc758('0x7')](0x5)[_0xc758('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc758('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc758('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc758('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc758('0x7')](0x5)[_0xc758('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc758('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc758('0x11')},'dialTimezone':{'type':Sequelize[_0xc758('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc758('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc758('0x13'),_0xc758('0x14'),_0xc758('0x15')),'defaultValue':_0xc758('0x13')},'dialAMDActive':{'type':Sequelize[_0xc758('0x5')],'defaultValue':0x0,'comment':_0xc758('0x16')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc758('0x17')},'dialAMDGreeting':{'type':Sequelize[_0xc758('0x7')](0x9)[_0xc758('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc758('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc758('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc758('0x7')](0x9)[_0xc758('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc758('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0xc758('0x7')](0x9)[_0xc758('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc758('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc758('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc758('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc758('0x7')](0x9)[_0xc758('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc758('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc758('0x7')](0x5)[_0xc758('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc758('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc758('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc758('0x3')](_0xc758('0x1e'),_0xc758('0x1f')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc758('0x20')},'dialCutDigit':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc758('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc758('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc758('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc758('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc758('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc758('0x24')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc758('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc758('0x26')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc758('0x7')](0x5)[_0xc758('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc758('0x27')},'dialMachineMaxRetry':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc758('0x28')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc758('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc758('0x7')](0x3)[_0xc758('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc758('0x29')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc758('0x7')](0x5)[_0xc758('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc758('0x2a')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 522e686..b45e708 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 _0x9bb4=['clone','createdAt','omit','updatedAt','user','error','getHoppers','findOne','CmHopper','hasOwnProperty','order','pick','CampaignId','findAll','getHopperHistories','nolimit','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','into','cmHopperId','h.id','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','IvrCampaigns','UserProfileResource','destroy','stack','name','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x157f75,_0x28cb0e){var _0x25a52d=function(_0x5b5856){while(--_0x5b5856){_0x157f75['push'](_0x157f75['shift']());}};_0x25a52d(++_0x28cb0e);}(_0x9bb4,0xd5));var _0x49bb=function(_0x41eab3,_0x2949fa){_0x41eab3=_0x41eab3-0x0;var _0x1318a3=_0x9bb4[_0x41eab3];return _0x1318a3;};'use strict';var emlformat=require(_0x49bb('0x0'));var rimraf=require(_0x49bb('0x1'));var zipdir=require(_0x49bb('0x2'));var jsonpatch=require(_0x49bb('0x3'));var rp=require(_0x49bb('0x4'));var moment=require(_0x49bb('0x5'));var BPromise=require(_0x49bb('0x6'));var Mustache=require(_0x49bb('0x7'));var util=require(_0x49bb('0x8'));var path=require('path');var sox=require(_0x49bb('0x9'));var csv=require(_0x49bb('0xa'));var ejs=require(_0x49bb('0xb'));var fs=require('fs');var fs_extra=require(_0x49bb('0xc'));var _=require('lodash');var squel=require(_0x49bb('0xd'));var crypto=require(_0x49bb('0xe'));var jsforce=require(_0x49bb('0xf'));var deskjs=require(_0x49bb('0x10'));var toCsv=require(_0x49bb('0xa'));var querystring=require('querystring');var Papa=require(_0x49bb('0x11'));var Redis=require('ioredis');var authService=require(_0x49bb('0x12'));var qs=require(_0x49bb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49bb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x49bb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x49bb('0x16'));var db=require(_0x49bb('0x17'))['db'];function respondWithStatusCode(_0xfab080,_0x3b85fc){_0x3b85fc=_0x3b85fc||0xcc;return function(_0x1ff6d1){if(_0x1ff6d1){return _0xfab080[_0x49bb('0x18')](_0x3b85fc);}return _0xfab080[_0x49bb('0x19')](_0x3b85fc)[_0x49bb('0x1a')]();};}function respondWithResult(_0x3beb36,_0x59472f){_0x59472f=_0x59472f||0xc8;return function(_0x13c850){if(_0x13c850){return _0x3beb36['status'](_0x59472f)[_0x49bb('0x1b')](_0x13c850);}};}function respondWithFilteredResult(_0x1f7573,_0x1f0210){return function(_0x230f20){if(_0x230f20){var _0x145d52=typeof _0x1f0210[_0x49bb('0x1c')]===_0x49bb('0x1d')&&typeof _0x1f0210[_0x49bb('0x1e')]==='undefined';var _0x2d76be=_0x230f20[_0x49bb('0x1f')];var _0x5b45c0=_0x145d52?0x0:_0x1f0210[_0x49bb('0x1c')];var _0x3d41f2=_0x145d52?_0x230f20['count']:_0x1f0210[_0x49bb('0x1c')]+_0x1f0210[_0x49bb('0x1e')];var _0x4af5e0;if(_0x3d41f2>=_0x2d76be){_0x3d41f2=_0x2d76be;_0x4af5e0=0xc8;}else{_0x4af5e0=0xce;}_0x1f7573[_0x49bb('0x19')](_0x4af5e0);return _0x1f7573[_0x49bb('0x20')]('Content-Range',_0x5b45c0+'-'+_0x3d41f2+'/'+_0x2d76be)[_0x49bb('0x1b')](_0x230f20);}return null;};}function patchUpdates(_0x5387ed){return function(_0x1728e9){try{jsonpatch['apply'](_0x1728e9,_0x5387ed,!![]);}catch(_0x47918a){return BPromise[_0x49bb('0x21')](_0x47918a);}return _0x1728e9['save']();};}function saveUpdates(_0x5b18f0,_0x16b8fa){return function(_0x1ade8b){if(_0x1ade8b){return _0x1ade8b[_0x49bb('0x22')](_0x5b18f0)[_0x49bb('0x23')](function(_0x4f2764){return _0x4f2764;});}return null;};}function removeEntity(_0x490c3e,_0x5cacdb){return function(_0x4eae24){if(_0x4eae24){return _0x4eae24['destroy']()[_0x49bb('0x23')](function(){var _0x570847=_0x4eae24['get']({'plain':!![]});var _0x6dac61=_0x49bb('0x24');return db[_0x49bb('0x25')][_0x49bb('0x26')]({'where':{'type':_0x6dac61,'resourceId':_0x570847['id']}})[_0x49bb('0x23')](function(){return _0x4eae24;});})['then'](function(){_0x490c3e[_0x49bb('0x19')](0xcc)[_0x49bb('0x1a')]();});}};}function handleEntityNotFound(_0x1a6afb,_0x712959){return function(_0x5370d7){if(!_0x5370d7){_0x1a6afb[_0x49bb('0x18')](0x194);}return _0x5370d7;};}function handleError(_0x3d025d,_0x3985a6){_0x3985a6=_0x3985a6||0x1f4;return function(_0x47540c){logger['error'](_0x47540c[_0x49bb('0x27')]);if(_0x47540c[_0x49bb('0x28')]){delete _0x47540c[_0x49bb('0x28')];}_0x3d025d[_0x49bb('0x19')](_0x3985a6)['send'](_0x47540c);};}exports[_0x49bb('0x29')]=function(_0x1537ef,_0x5cd7c2){var _0x38108d={},_0x56b65b={},_0x2fbea2={'count':0x0,'rows':[]};var _0x242371=_['map'](db[_0x49bb('0x2a')][_0x49bb('0x2b')],function(_0x521e09){return{'name':_0x521e09[_0x49bb('0x2c')],'type':_0x521e09[_0x49bb('0x2d')][_0x49bb('0x2e')]};});_0x56b65b[_0x49bb('0x2f')]=_[_0x49bb('0x30')](_0x242371,_0x49bb('0x28'));_0x56b65b[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0x1537ef['query']);_0x56b65b[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x56b65b[_0x49bb('0x2f')],_0x56b65b[_0x49bb('0x31')]);_0x38108d['attributes']=_[_0x49bb('0x34')](_0x56b65b['model'],qs[_0x49bb('0x35')](_0x1537ef['query'][_0x49bb('0x35')]));_0x38108d['attributes']=_0x38108d[_0x49bb('0x36')][_0x49bb('0x37')]?_0x38108d['attributes']:_0x56b65b['model'];if(!_0x1537ef['query']['hasOwnProperty']('nolimit')){_0x38108d[_0x49bb('0x1e')]=qs[_0x49bb('0x1e')](_0x1537ef[_0x49bb('0x31')][_0x49bb('0x1e')]);_0x38108d[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0x1537ef[_0x49bb('0x31')]['offset']);}_0x38108d['order']=qs[_0x49bb('0x38')](_0x1537ef[_0x49bb('0x31')]['sort']);_0x38108d[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_['pick'](_0x1537ef['query'],_0x56b65b[_0x49bb('0x33')]),_0x242371);if(_0x1537ef['query'][_0x49bb('0x3a')]){_0x38108d[_0x49bb('0x39')]=_[_0x49bb('0x3b')](_0x38108d[_0x49bb('0x39')],{'$or':_[_0x49bb('0x30')](_0x242371,function(_0x72d90e){if(_0x72d90e[_0x49bb('0x2d')]!==_0x49bb('0x3c')){var _0x783852={};_0x783852[_0x72d90e[_0x49bb('0x28')]]={'$like':'%'+_0x1537ef[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x783852;}})});}_0x38108d=_[_0x49bb('0x3b')]({},_0x38108d,_0x1537ef[_0x49bb('0x3d')]);var _0x25c70e={'where':_0x38108d[_0x49bb('0x39')]};return db[_0x49bb('0x2a')][_0x49bb('0x1f')](_0x25c70e)[_0x49bb('0x23')](function(_0x41b969){_0x2fbea2[_0x49bb('0x1f')]=_0x41b969;if(_0x1537ef[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x38108d['include']=[{'all':!![]}];}return db[_0x49bb('0x2a')]['findAll'](_0x38108d);})[_0x49bb('0x23')](function(_0x1eac94){_0x2fbea2[_0x49bb('0x3f')]=_0x1eac94;return _0x2fbea2;})[_0x49bb('0x23')](respondWithFilteredResult(_0x5cd7c2,_0x38108d))[_0x49bb('0x40')](handleError(_0x5cd7c2,null));};exports['show']=function(_0x445e15,_0x31aaee){var _0x138f2b={'raw':![],'where':{'id':_0x445e15[_0x49bb('0x41')]['id']}},_0x46912f={};_0x46912f['model']=_[_0x49bb('0x32')](db[_0x49bb('0x2a')][_0x49bb('0x2b')]);_0x46912f[_0x49bb('0x31')]=_['keys'](_0x445e15['query']);_0x46912f[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x46912f[_0x49bb('0x2f')],_0x46912f[_0x49bb('0x31')]);_0x138f2b[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x46912f['model'],qs[_0x49bb('0x35')](_0x445e15['query'][_0x49bb('0x35')]));_0x138f2b[_0x49bb('0x36')]=_0x138f2b['attributes']['length']?_0x138f2b['attributes']:_0x46912f['model'];if(_0x445e15[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x138f2b[_0x49bb('0x42')]=[{'all':!![]}];}_0x138f2b=_[_0x49bb('0x3b')]({},_0x138f2b,_0x445e15['options']);return db['Campaign'][_0x49bb('0x43')](_0x138f2b)[_0x49bb('0x23')](handleEntityNotFound(_0x31aaee,null))[_0x49bb('0x23')](respondWithResult(_0x31aaee,null))[_0x49bb('0x40')](handleError(_0x31aaee,null));};exports['create']=function(_0x3b0f01,_0x382bc4){return db['Campaign'][_0x49bb('0x44')](_0x3b0f01[_0x49bb('0x45')],{})[_0x49bb('0x23')](function(_0x46bb56){var _0xbad45a=_0x3b0f01['user'][_0x49bb('0x46')]({'plain':!![]});if(!_0xbad45a)throw new Error(_0x49bb('0x47'));if(_0xbad45a[_0x49bb('0x48')]==='user'){var _0x266abf=_0x46bb56[_0x49bb('0x46')]({'plain':!![]});var _0x144a77=_0x49bb('0x24');return db[_0x49bb('0x49')]['find']({'where':{'name':_0x144a77,'userProfileId':_0xbad45a[_0x49bb('0x4a')]},'raw':!![]})[_0x49bb('0x23')](function(_0xfae9ab){if(_0xfae9ab&&_0xfae9ab[_0x49bb('0x4b')]===0x0){return db[_0x49bb('0x25')][_0x49bb('0x44')]({'name':_0x266abf[_0x49bb('0x28')],'resourceId':_0x266abf['id'],'type':_0xfae9ab[_0x49bb('0x28')],'sectionId':_0xfae9ab['id']},{})[_0x49bb('0x23')](function(){return _0x46bb56;});}else{return _0x46bb56;}})[_0x49bb('0x40')](function(_0x2ead0f){logger['error'](_0x49bb('0x4c'),_0x2ead0f);throw _0x2ead0f;});}return _0x46bb56;})[_0x49bb('0x23')](respondWithResult(_0x382bc4,0xc9))[_0x49bb('0x40')](handleError(_0x382bc4,null));};exports[_0x49bb('0x4d')]=function(_0x10327c,_0x3fc2f1){var _0x4151c5={'where':{'id':_0x10327c[_0x49bb('0x41')]['id']}},_0x23e8bc={};_0x23e8bc[_0x49bb('0x2f')]=_[_0x49bb('0x32')](db[_0x49bb('0x2a')][_0x49bb('0x2b')]);_0x4151c5[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x23e8bc[_0x49bb('0x2f')],qs[_0x49bb('0x35')](_0x10327c[_0x49bb('0x31')][_0x49bb('0x35')]));_0x4151c5[_0x49bb('0x36')]=_0x4151c5[_0x49bb('0x36')][_0x49bb('0x37')]?_0x4151c5[_0x49bb('0x36')]:_0x23e8bc['model'];if(_0x10327c[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x4151c5[_0x49bb('0x42')]=[{'all':!![]}];}_0x4151c5=_[_0x49bb('0x3b')]({},_0x4151c5,_0x10327c[_0x49bb('0x3d')]);return db[_0x49bb('0x2a')][_0x49bb('0x43')](_0x4151c5)[_0x49bb('0x23')](handleEntityNotFound(_0x3fc2f1,null))[_0x49bb('0x23')](function(_0x348da4){if(_0x348da4){var _0x48a8d6=_0x348da4['get']({'plain':!![]});_0x48a8d6=qs['omit'](_0x48a8d6,['id',_0x49bb('0x4e'),'updatedAt']);_0x10327c[_0x49bb('0x45')]=_[_0x49bb('0x4f')](_0x10327c[_0x49bb('0x45')],['id',_0x49bb('0x4e'),_0x49bb('0x50')]);return db[_0x49bb('0x2a')][_0x49bb('0x44')](_[_0x49bb('0x3b')](_0x48a8d6,_0x10327c['body']),{'include':_0x10327c[_0x49bb('0x31')][_0x49bb('0x3e')]?[{'all':!![]}]:undefined})[_0x49bb('0x23')](function(_0x435761){var _0x225341=_0x10327c[_0x49bb('0x51')][_0x49bb('0x46')]({'plain':!![]});if(!_0x225341)throw new Error(_0x49bb('0x47'));if(_0x225341['role']===_0x49bb('0x51')){var _0x35bb5b=_0x435761[_0x49bb('0x46')]({'plain':!![]});var _0xb2d741='IvrCampaigns';return db[_0x49bb('0x49')][_0x49bb('0x43')]({'where':{'name':_0xb2d741,'userProfileId':_0x225341['userProfileId']},'raw':!![]})[_0x49bb('0x23')](function(_0x36ff04){if(_0x36ff04&&_0x36ff04[_0x49bb('0x4b')]===0x0){return db[_0x49bb('0x25')][_0x49bb('0x44')]({'name':_0x35bb5b['name'],'resourceId':_0x35bb5b['id'],'type':_0x36ff04[_0x49bb('0x28')],'sectionId':_0x36ff04['id']},{})[_0x49bb('0x23')](function(){return _0x435761;});}else{return _0x435761;}})[_0x49bb('0x40')](function(_0x1f273a){logger[_0x49bb('0x52')](_0x49bb('0x4c'),_0x1f273a);throw _0x1f273a;});}return _0x435761;});}})['then'](respondWithResult(_0x3fc2f1,0xc9))[_0x49bb('0x40')](handleError(_0x3fc2f1,null));};exports[_0x49bb('0x22')]=function(_0x56b2e7,_0x4b13e5){if(_0x56b2e7[_0x49bb('0x45')]['id']){delete _0x56b2e7[_0x49bb('0x45')]['id'];}return db['Campaign'][_0x49bb('0x43')]({'where':{'id':_0x56b2e7[_0x49bb('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b13e5,null))[_0x49bb('0x23')](saveUpdates(_0x56b2e7[_0x49bb('0x45')],null))[_0x49bb('0x23')](respondWithResult(_0x4b13e5,null))['catch'](handleError(_0x4b13e5,null));};exports[_0x49bb('0x26')]=function(_0x4a3906,_0x4478f4){return db[_0x49bb('0x2a')][_0x49bb('0x43')]({'where':{'id':_0x4a3906[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x4478f4,null))[_0x49bb('0x23')](removeEntity(_0x4478f4,null))[_0x49bb('0x40')](handleError(_0x4478f4,null));};exports[_0x49bb('0x53')]=function(_0xcc062f,_0x52ac3b,_0x29a1b7){var _0x28da4a={'raw':!![],'where':{}};var _0x277e04={};var _0x193259={'count':0x0,'rows':[]};return db['Campaign'][_0x49bb('0x54')]({'where':{'id':_0xcc062f[_0x49bb('0x41')]['id']}})['then'](handleEntityNotFound(_0x52ac3b,null))[_0x49bb('0x23')](function(_0x437d3b){if(_0x437d3b){_0x277e04['model']=_[_0x49bb('0x32')](db[_0x49bb('0x55')][_0x49bb('0x2b')]);_0x277e04[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0xcc062f[_0x49bb('0x31')]);_0x277e04[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x277e04['model'],_0x277e04[_0x49bb('0x31')]);_0x28da4a[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x277e04[_0x49bb('0x2f')],qs[_0x49bb('0x35')](_0xcc062f[_0x49bb('0x31')][_0x49bb('0x35')]));_0x28da4a['attributes']=_0x28da4a[_0x49bb('0x36')][_0x49bb('0x37')]?_0x28da4a[_0x49bb('0x36')]:_0x277e04[_0x49bb('0x2f')];if(!_0xcc062f['query'][_0x49bb('0x56')]('nolimit')){_0x28da4a[_0x49bb('0x1e')]=qs['limit'](_0xcc062f['query']['limit']);_0x28da4a[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0xcc062f['query']['offset']);}_0x28da4a[_0x49bb('0x57')]=qs[_0x49bb('0x38')](_0xcc062f[_0x49bb('0x31')][_0x49bb('0x38')]);_0x28da4a[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_[_0x49bb('0x58')](_0xcc062f[_0x49bb('0x31')],_0x277e04[_0x49bb('0x33')]));_0x28da4a[_0x49bb('0x39')][_0x49bb('0x59')]=_0x437d3b['id'];if(_0xcc062f['query'][_0x49bb('0x3a')]){_0x28da4a[_0x49bb('0x39')]=_[_0x49bb('0x3b')](_0x28da4a[_0x49bb('0x39')],{'$or':_[_0x49bb('0x30')](_0x28da4a[_0x49bb('0x36')],function(_0x3454be){var _0x500af1={};_0x500af1[_0x3454be]={'$like':'%'+_0xcc062f[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x500af1;})});}_0x28da4a=_['merge']({},_0x28da4a,_0xcc062f[_0x49bb('0x3d')]);return db[_0x49bb('0x55')]['count']({'where':_0x28da4a[_0x49bb('0x39')]})[_0x49bb('0x23')](function(_0x37f97b){_0x193259[_0x49bb('0x1f')]=_0x37f97b;if(_0xcc062f[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x28da4a['include']=[{'all':!![]}];}return db['CmHopper'][_0x49bb('0x5a')](_0x28da4a);})[_0x49bb('0x23')](function(_0x1499b6){_0x193259[_0x49bb('0x3f')]=_0x1499b6;return _0x193259;});}})[_0x49bb('0x23')](respondWithFilteredResult(_0x52ac3b,_0x28da4a))[_0x49bb('0x40')](handleError(_0x52ac3b,null));};exports[_0x49bb('0x5b')]=function(_0xc7016a,_0x136726,_0x36db19){var _0x3459de={'raw':!![],'where':{}};var _0x426505={};var _0x81e179={'count':0x0,'rows':[]};return db[_0x49bb('0x2a')][_0x49bb('0x54')]({'where':{'id':_0xc7016a['params']['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x136726,null))['then'](function(_0x7897dd){if(_0x7897dd){_0x426505[_0x49bb('0x2f')]=_['keys'](db['CmHopperHistory'][_0x49bb('0x2b')]);_0x426505[_0x49bb('0x31')]=_['keys'](_0xc7016a[_0x49bb('0x31')]);_0x426505[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x426505[_0x49bb('0x2f')],_0x426505[_0x49bb('0x31')]);_0x3459de[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x426505[_0x49bb('0x2f')],qs['fields'](_0xc7016a[_0x49bb('0x31')]['fields']));_0x3459de[_0x49bb('0x36')]=_0x3459de[_0x49bb('0x36')][_0x49bb('0x37')]?_0x3459de['attributes']:_0x426505[_0x49bb('0x2f')];if(!_0xc7016a[_0x49bb('0x31')][_0x49bb('0x56')](_0x49bb('0x5c'))){_0x3459de[_0x49bb('0x1e')]=qs['limit'](_0xc7016a[_0x49bb('0x31')][_0x49bb('0x1e')]);_0x3459de[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0xc7016a[_0x49bb('0x31')][_0x49bb('0x1c')]);}_0x3459de[_0x49bb('0x57')]=qs[_0x49bb('0x38')](_0xc7016a[_0x49bb('0x31')][_0x49bb('0x38')]);_0x3459de[_0x49bb('0x39')]=qs['filters'](_[_0x49bb('0x58')](_0xc7016a[_0x49bb('0x31')],_0x426505[_0x49bb('0x33')]));_0x3459de[_0x49bb('0x39')]['CampaignId']=_0x7897dd['id'];if(_0xc7016a[_0x49bb('0x31')]['filter']){_0x3459de[_0x49bb('0x39')]=_['merge'](_0x3459de[_0x49bb('0x39')],{'$or':_[_0x49bb('0x30')](_0x3459de[_0x49bb('0x36')],function(_0x2b953a){var _0x5d4c93={};_0x5d4c93[_0x2b953a]={'$like':'%'+_0xc7016a[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x5d4c93;})});}_0x3459de=_[_0x49bb('0x3b')]({},_0x3459de,_0xc7016a[_0x49bb('0x3d')]);return db[_0x49bb('0x5d')]['count']({'where':_0x3459de[_0x49bb('0x39')]})[_0x49bb('0x23')](function(_0x46fcc5){_0x81e179['count']=_0x46fcc5;if(_0xc7016a[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x3459de['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x49bb('0x5a')](_0x3459de);})[_0x49bb('0x23')](function(_0x2a40aa){_0x81e179[_0x49bb('0x3f')]=_0x2a40aa;return _0x81e179;});}})['then'](respondWithFilteredResult(_0x136726,_0x3459de))[_0x49bb('0x40')](handleError(_0x136726,null));};exports[_0x49bb('0x5e')]=function(_0x535bed,_0x137965,_0x208e1b){var _0x1c9cfb={'raw':!![],'where':{}};var _0x4157ae={};var _0x1b0529={'count':0x0,'rows':[]};return db['Campaign'][_0x49bb('0x54')]({'where':{'id':_0x535bed['params']['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x137965,null))['then'](function(_0x36bf90){if(_0x36bf90){_0x4157ae[_0x49bb('0x2f')]=_[_0x49bb('0x32')](db[_0x49bb('0x5f')][_0x49bb('0x2b')]);_0x4157ae[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0x535bed['query']);_0x4157ae[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x4157ae['model'],_0x4157ae[_0x49bb('0x31')]);_0x1c9cfb[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x4157ae[_0x49bb('0x2f')],qs['fields'](_0x535bed['query'][_0x49bb('0x35')]));_0x1c9cfb['attributes']=_0x1c9cfb[_0x49bb('0x36')]['length']?_0x1c9cfb[_0x49bb('0x36')]:_0x4157ae[_0x49bb('0x2f')];if(!_0x535bed[_0x49bb('0x31')][_0x49bb('0x56')]('nolimit')){_0x1c9cfb[_0x49bb('0x1e')]=qs[_0x49bb('0x1e')](_0x535bed['query']['limit']);_0x1c9cfb[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0x535bed['query'][_0x49bb('0x1c')]);}_0x1c9cfb[_0x49bb('0x57')]=qs[_0x49bb('0x38')](_0x535bed['query'][_0x49bb('0x38')]);_0x1c9cfb[_0x49bb('0x39')]=qs['filters'](_['pick'](_0x535bed['query'],_0x4157ae[_0x49bb('0x33')]));_0x1c9cfb[_0x49bb('0x39')][_0x49bb('0x59')]=_0x36bf90['id'];if(_0x535bed[_0x49bb('0x31')][_0x49bb('0x3a')]){_0x1c9cfb['where']=_['merge'](_0x1c9cfb[_0x49bb('0x39')],{'$or':_[_0x49bb('0x30')](_0x1c9cfb['attributes'],function(_0x5b1f07){var _0x378128={};_0x378128[_0x5b1f07]={'$like':'%'+_0x535bed[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x378128;})});}_0x1c9cfb=_['merge']({},_0x1c9cfb,_0x535bed[_0x49bb('0x3d')]);return db[_0x49bb('0x5f')]['count']({'where':_0x1c9cfb[_0x49bb('0x39')]})[_0x49bb('0x23')](function(_0x3b7d47){_0x1b0529[_0x49bb('0x1f')]=_0x3b7d47;if(_0x535bed['query'][_0x49bb('0x3e')]){_0x1c9cfb[_0x49bb('0x42')]=[{'all':!![]}];}return db[_0x49bb('0x5f')][_0x49bb('0x5a')](_0x1c9cfb);})['then'](function(_0x2ccf78){_0x1b0529[_0x49bb('0x3f')]=_0x2ccf78;return _0x1b0529;});}})[_0x49bb('0x23')](respondWithFilteredResult(_0x137965,_0x1c9cfb))[_0x49bb('0x40')](handleError(_0x137965,null));};exports[_0x49bb('0x60')]=function(_0x4e6e43,_0x5a4f59,_0x251fc8){var _0x382bf9={'raw':!![],'where':{}};var _0x5bdf3d={};var _0x1dcaac={'count':0x0,'rows':[]};return db[_0x49bb('0x2a')][_0x49bb('0x54')]({'where':{'id':_0x4e6e43[_0x49bb('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a4f59,null))['then'](function(_0xe5a2){if(_0xe5a2){_0x5bdf3d[_0x49bb('0x2f')]=_['keys'](db['CmHopperBlack'][_0x49bb('0x2b')]);_0x5bdf3d[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0x4e6e43['query']);_0x5bdf3d[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x5bdf3d[_0x49bb('0x2f')],_0x5bdf3d[_0x49bb('0x31')]);_0x382bf9[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x5bdf3d[_0x49bb('0x2f')],qs['fields'](_0x4e6e43[_0x49bb('0x31')]['fields']));_0x382bf9[_0x49bb('0x36')]=_0x382bf9[_0x49bb('0x36')][_0x49bb('0x37')]?_0x382bf9['attributes']:_0x5bdf3d[_0x49bb('0x2f')];if(!_0x4e6e43[_0x49bb('0x31')][_0x49bb('0x56')]('nolimit')){_0x382bf9[_0x49bb('0x1e')]=qs['limit'](_0x4e6e43['query'][_0x49bb('0x1e')]);_0x382bf9['offset']=qs[_0x49bb('0x1c')](_0x4e6e43[_0x49bb('0x31')][_0x49bb('0x1c')]);}_0x382bf9[_0x49bb('0x57')]=qs['sort'](_0x4e6e43[_0x49bb('0x31')][_0x49bb('0x38')]);_0x382bf9[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_[_0x49bb('0x58')](_0x4e6e43[_0x49bb('0x31')],_0x5bdf3d[_0x49bb('0x33')]));_0x382bf9[_0x49bb('0x39')][_0x49bb('0x59')]=_0xe5a2['id'];if(_0x4e6e43[_0x49bb('0x31')]['filter']){_0x382bf9[_0x49bb('0x39')]=_[_0x49bb('0x3b')](_0x382bf9['where'],{'$or':_[_0x49bb('0x30')](_0x382bf9[_0x49bb('0x36')],function(_0x12b674){var _0x2822f7={};_0x2822f7[_0x12b674]={'$like':'%'+_0x4e6e43['query']['filter']+'%'};return _0x2822f7;})});}_0x382bf9=_[_0x49bb('0x3b')]({},_0x382bf9,_0x4e6e43[_0x49bb('0x3d')]);return db[_0x49bb('0x61')]['count']({'where':_0x382bf9['where']})[_0x49bb('0x23')](function(_0xf5c477){_0x1dcaac['count']=_0xf5c477;if(_0x4e6e43[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x382bf9[_0x49bb('0x42')]=[{'all':!![]}];}return db[_0x49bb('0x61')]['findAll'](_0x382bf9);})['then'](function(_0x1770bc){_0x1dcaac[_0x49bb('0x3f')]=_0x1770bc;return _0x1dcaac;});}})[_0x49bb('0x23')](respondWithFilteredResult(_0x5a4f59,_0x382bf9))['catch'](handleError(_0x5a4f59,null));};exports[_0x49bb('0x62')]=function(_0x9f2ff7,_0x3f93bd,_0x504b4f){var _0x582b42={};var _0x2948a0={};var _0x5a861f;var _0xaf6237;return db[_0x49bb('0x2a')][_0x49bb('0x54')]({'where':{'id':_0x9f2ff7[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x3f93bd,null))[_0x49bb('0x23')](function(_0x59e5c1){if(_0x59e5c1){_0x5a861f=_0x59e5c1;_0x2948a0[_0x49bb('0x2f')]=_[_0x49bb('0x32')](db[_0x49bb('0x63')][_0x49bb('0x2b')]);_0x2948a0[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0x9f2ff7[_0x49bb('0x31')]);_0x2948a0[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x2948a0[_0x49bb('0x2f')],_0x2948a0['query']);_0x582b42[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x2948a0[_0x49bb('0x2f')],qs[_0x49bb('0x35')](_0x9f2ff7[_0x49bb('0x31')]['fields']));_0x582b42[_0x49bb('0x36')]=_0x582b42[_0x49bb('0x36')][_0x49bb('0x37')]?_0x582b42[_0x49bb('0x36')]:_0x2948a0[_0x49bb('0x2f')];_0x582b42[_0x49bb('0x57')]=qs['sort'](_0x9f2ff7['query']['sort']);_0x582b42[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_[_0x49bb('0x58')](_0x9f2ff7[_0x49bb('0x31')],_0x2948a0[_0x49bb('0x33')]));if(_0x9f2ff7[_0x49bb('0x31')][_0x49bb('0x3a')]){_0x582b42[_0x49bb('0x39')]=_[_0x49bb('0x3b')](_0x582b42['where'],{'$or':_[_0x49bb('0x30')](_0x582b42[_0x49bb('0x36')],function(_0x42b52f){var _0x22a2e3={};_0x22a2e3[_0x42b52f]={'$like':'%'+_0x9f2ff7[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x22a2e3;})});}_0x582b42=_[_0x49bb('0x3b')]({},_0x582b42,_0x9f2ff7['options']);return _0x5a861f['getLists'](_0x582b42);}})['then'](function(_0x521567){if(_0x521567){_0xaf6237=_0x521567[_0x49bb('0x37')];if(!_0x9f2ff7['query'][_0x49bb('0x56')](_0x49bb('0x5c'))){_0x582b42[_0x49bb('0x1e')]=qs['limit'](_0x9f2ff7['query']['limit']);_0x582b42[_0x49bb('0x1c')]=qs['offset'](_0x9f2ff7['query']['offset']);}return _0x5a861f[_0x49bb('0x62')](_0x582b42);}})[_0x49bb('0x23')](function(_0x5eec09){if(_0x5eec09){return _0x5eec09?{'count':_0xaf6237,'rows':_0x5eec09}:null;}})['then'](respondWithResult(_0x3f93bd,null))['catch'](handleError(_0x3f93bd,null));};exports['addLists']=function(_0x333a64,_0x4742be,_0x3ef899){var _0x29e5f9,_0x38a3d5;var _0xd2cd1a=[];var _0x3d761d=moment()[_0x49bb('0x64')](_0x49bb('0x65'));return db[_0x49bb('0x2a')][_0x49bb('0x43')]({'where':{'id':_0x333a64[_0x49bb('0x41')]['id']}})['then'](handleEntityNotFound(_0x4742be,null))[_0x49bb('0x23')](function(_0x4092df){if(_0x4092df){_0x38a3d5=_0x4092df;return _0x4092df[_0x49bb('0x66')](_0x333a64[_0x49bb('0x45')][_0x49bb('0x67')],_[_0x49bb('0x4f')](_0x333a64[_0x49bb('0x45')],[_0x49bb('0x67'),'id'])||{});}return null;})[_0x49bb('0x68')](function(_0x534677){var _0x5b27b1;var _0x3d1da9;_0x29e5f9=_0x534677||[];var _0x20a650=[];if(_0x534677){for(var _0x33c254=0x0;_0x33c254<_0x534677[_0x49bb('0x37')];_0x33c254+=0x1){var _0x403726=_0x534677[_0x33c254]['get']({'plain':!![]});_0x38a3d5[_0x49bb('0x69')]=_0x333a64[_0x49bb('0x45')][_0x49bb('0x69')]?_0x333a64[_0x49bb('0x45')][_0x49bb('0x69')]:_0x38a3d5['dialCheckDuplicateType'];switch(_0x38a3d5[_0x49bb('0x69')]){case _0x49bb('0x6a'):_0x5b27b1=squel[_0x49bb('0x6b')]()['into'](_0x49bb('0x6c'))[_0x49bb('0x6d')]([_0x49bb('0x6e'),_0x49bb('0x6f'),'ContactId',_0x49bb('0x70'),_0x49bb('0x59'),_0x49bb('0x4e'),'updatedAt'],squel[_0x49bb('0x71')]()[_0x49bb('0x72')]('phone','phone')[_0x49bb('0x72')](_0x49bb('0x73'),_0x49bb('0x6f'))[_0x49bb('0x72')]('id',_0x49bb('0x74'))[_0x49bb('0x72')](_0x403726[_0x49bb('0x75')][_0x49bb('0x76')](),_0x49bb('0x70'))[_0x49bb('0x72')](_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')](),_0x49bb('0x59'))['field']('\x27'+_0x3d761d+'\x27',_0x49bb('0x4e'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x50'))['from'](_0x49bb('0x77'))['where'](_0x49bb('0x78'))[_0x49bb('0x39')](_0x49bb('0x79'),_0x403726['CmListId'][_0x49bb('0x76')]())[_0x49bb('0x39')](_0x49bb('0x7a'))[_0x49bb('0x39')](_0x49bb('0x7b'),squel[_0x49bb('0x71')]()['field'](_0x49bb('0x7c'))[_0x49bb('0x7d')](_0x49bb('0x7e'))[_0x49bb('0x39')](_0x49bb('0x7f'),_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')]()))[_0x49bb('0x39')](_0x49bb('0x7b'),squel[_0x49bb('0x71')]()[_0x49bb('0x72')]('COALESCE(phone,\x27\x27)')[_0x49bb('0x7d')](_0x49bb('0x6c'))['where'](_0x49bb('0x7f'),_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')]())))[_0x49bb('0x76')]();break;case _0x49bb('0x80'):_0x5b27b1=squel[_0x49bb('0x6b')]()[_0x49bb('0x81')](_0x49bb('0x6c'))[_0x49bb('0x6d')](['phone',_0x49bb('0x6f'),_0x49bb('0x74'),_0x49bb('0x70'),'CampaignId','createdAt','updatedAt'],squel['select']()[_0x49bb('0x72')](_0x49bb('0x6e'),_0x49bb('0x6e'))['field']('NOW()',_0x49bb('0x6f'))[_0x49bb('0x72')]('id',_0x49bb('0x74'))[_0x49bb('0x72')](_0x403726[_0x49bb('0x75')][_0x49bb('0x76')](),_0x49bb('0x70'))[_0x49bb('0x72')](_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')](),_0x49bb('0x59'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x4e'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x50'))[_0x49bb('0x7d')](_0x49bb('0x77'))[_0x49bb('0x39')](_0x49bb('0x78'))['where'](_0x49bb('0x79'),_0x403726[_0x49bb('0x75')]['toString']())[_0x49bb('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x49bb('0x39')](_0x49bb('0x7b'),squel[_0x49bb('0x71')]()[_0x49bb('0x72')]('COALESCE(phone,\x27\x27)')['from'](_0x49bb('0x6c'))[_0x49bb('0x39')](_0x49bb('0x7f'),_0x333a64['params']['id'][_0x49bb('0x76')]())))['toString']();break;default:_0x5b27b1=squel[_0x49bb('0x6b')]()[_0x49bb('0x81')]('cm_hopper')['fromQuery']([_0x49bb('0x6e'),_0x49bb('0x6f'),_0x49bb('0x74'),_0x49bb('0x70'),_0x49bb('0x59'),_0x49bb('0x4e'),_0x49bb('0x50')],squel[_0x49bb('0x71')]()[_0x49bb('0x72')](_0x49bb('0x6e'),'phone')[_0x49bb('0x72')]('NOW()',_0x49bb('0x6f'))[_0x49bb('0x72')]('id',_0x49bb('0x74'))[_0x49bb('0x72')](_0x403726[_0x49bb('0x75')]['toString'](),_0x49bb('0x70'))['field'](_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')](),'CampaignId')[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x4e'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x50'))[_0x49bb('0x7d')]('cm_contacts')[_0x49bb('0x39')](_0x49bb('0x78'))[_0x49bb('0x39')]('ListId\x20=\x20?',_0x403726['CmListId'][_0x49bb('0x76')]())[_0x49bb('0x39')](_0x49bb('0x7a')))[_0x49bb('0x76')]();}_0x3d1da9=squel[_0x49bb('0x6b')]()[_0x49bb('0x81')]('cm_hopper_additional_phones')[_0x49bb('0x6d')]([_0x49bb('0x82'),_0x49bb('0x6f'),_0x49bb('0x6e'),'OrderBy',_0x49bb('0x4e'),_0x49bb('0x50')],squel[_0x49bb('0x71')]()[_0x49bb('0x72')](_0x49bb('0x83'),'id')['field'](_0x49bb('0x73'),_0x49bb('0x6f'))['field']('ci.item',_0x49bb('0x6e'))[_0x49bb('0x72')]('ci.OrderBY','OrderBy')[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x4e'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x50'))[_0x49bb('0x7d')]('cm_contact_has_items','ci')[_0x49bb('0x84')](_0x49bb('0x6c'),'h',_0x49bb('0x85'))[_0x49bb('0x39')](_0x49bb('0x86'),_0x403726[_0x49bb('0x75')][_0x49bb('0x76')]())['where'](_0x49bb('0x87'),_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')]())[_0x49bb('0x39')](_0x49bb('0x88'),_0x3d761d))[_0x49bb('0x76')]();_0x20a650['push'](db['sequelize'][_0x49bb('0x31')](_0x5b27b1));_0xd2cd1a[_0x49bb('0x89')](db[_0x49bb('0x8a')][_0x49bb('0x31')](_0x3d1da9));}return BPromise[_0x49bb('0x8b')](_0x20a650);}})[_0x49bb('0x23')](function(){return BPromise[_0x49bb('0x8b')](_0xd2cd1a);})[_0x49bb('0x23')](function(){return _0x29e5f9;})[_0x49bb('0x23')](respondWithResult(_0x4742be,null))[_0x49bb('0x40')](handleError(_0x4742be,null));};exports[_0x49bb('0x8c')]=function(_0x463ed6,_0x4f887c,_0x6cfddb){return db['Campaign'][_0x49bb('0x43')]({'where':{'id':_0x463ed6[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x4f887c,null))['then'](function(_0x2e2e87){if(_0x2e2e87){return _0x2e2e87[_0x49bb('0x8c')](_0x463ed6[_0x49bb('0x31')]['ids']);}})['then'](function(_0x45957b){if(_0x45957b){return db[_0x49bb('0x55')][_0x49bb('0x26')]({'where':{'ListId':_0x463ed6[_0x49bb('0x31')][_0x49bb('0x67')],'CampaignId':_0x463ed6[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](function(){return _0x45957b;});}})[_0x49bb('0x23')](respondWithStatusCode(_0x4f887c,null))[_0x49bb('0x40')](handleError(_0x4f887c,null));};exports[_0x49bb('0x8d')]=function(_0x5418e4,_0x4e133b,_0x460091){var _0x1346fa={};var _0x52a9d4={};var _0x7f3477;var _0x3b0592;return db[_0x49bb('0x2a')][_0x49bb('0x54')]({'where':{'id':_0x5418e4[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x4e133b,null))[_0x49bb('0x23')](function(_0x1036f0){if(_0x1036f0){_0x7f3477=_0x1036f0;_0x52a9d4[_0x49bb('0x2f')]=_[_0x49bb('0x32')](db['CmList'][_0x49bb('0x2b')]);_0x52a9d4['query']=_[_0x49bb('0x32')](_0x5418e4[_0x49bb('0x31')]);_0x52a9d4[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x52a9d4[_0x49bb('0x2f')],_0x52a9d4[_0x49bb('0x31')]);_0x1346fa[_0x49bb('0x36')]=_['intersection'](_0x52a9d4[_0x49bb('0x2f')],qs[_0x49bb('0x35')](_0x5418e4['query'][_0x49bb('0x35')]));_0x1346fa[_0x49bb('0x36')]=_0x1346fa[_0x49bb('0x36')][_0x49bb('0x37')]?_0x1346fa[_0x49bb('0x36')]:_0x52a9d4['model'];_0x1346fa[_0x49bb('0x57')]=qs[_0x49bb('0x38')](_0x5418e4['query'][_0x49bb('0x38')]);_0x1346fa[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_[_0x49bb('0x58')](_0x5418e4[_0x49bb('0x31')],_0x52a9d4['filters']));if(_0x5418e4[_0x49bb('0x31')]['filter']){_0x1346fa['where']=_[_0x49bb('0x3b')](_0x1346fa[_0x49bb('0x39')],{'$or':_['map'](_0x1346fa[_0x49bb('0x36')],function(_0x38bac0){var _0x1021ea={};_0x1021ea[_0x38bac0]={'$like':'%'+_0x5418e4[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x1021ea;})});}_0x1346fa=_['merge']({},_0x1346fa,_0x5418e4[_0x49bb('0x3d')]);return _0x7f3477[_0x49bb('0x8d')](_0x1346fa);}})['then'](function(_0x162884){if(_0x162884){_0x3b0592=_0x162884[_0x49bb('0x37')];if(!_0x5418e4[_0x49bb('0x31')][_0x49bb('0x56')]('nolimit')){_0x1346fa[_0x49bb('0x1e')]=qs[_0x49bb('0x1e')](_0x5418e4[_0x49bb('0x31')][_0x49bb('0x1e')]);_0x1346fa[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0x5418e4[_0x49bb('0x31')][_0x49bb('0x1c')]);}return _0x7f3477[_0x49bb('0x8d')](_0x1346fa);}})['then'](function(_0x5bd052){if(_0x5bd052){return _0x5bd052?{'count':_0x3b0592,'rows':_0x5bd052}:null;}})[_0x49bb('0x23')](respondWithResult(_0x4e133b,null))[_0x49bb('0x40')](handleError(_0x4e133b,null));};exports[_0x49bb('0x8e')]=function(_0x5cc812,_0x308a85,_0x526469){var _0x2e4be8,_0x139929;var _0x17f942=[];var _0x4456b3=moment()[_0x49bb('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x49bb('0x2a')][_0x49bb('0x43')]({'where':{'id':_0x5cc812[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x308a85,null))[_0x49bb('0x23')](function(_0xac35e6){if(_0xac35e6){_0x139929=_0xac35e6;return _0xac35e6[_0x49bb('0x8e')](_0x5cc812[_0x49bb('0x45')][_0x49bb('0x67')],_['omit'](_0x5cc812[_0x49bb('0x45')],[_0x49bb('0x67'),'id'])||{});}return null;})['spread'](function(_0x2caab6){var _0x5cc412;var _0x34e4bb;_0x2e4be8=_0x2caab6||[];var _0x1c7a91=[];if(_0x2caab6){for(var _0x44ef98=0x0;_0x44ef98<_0x2caab6[_0x49bb('0x37')];_0x44ef98+=0x1){var _0x526e52=_0x2caab6[_0x44ef98][_0x49bb('0x46')]({'plain':!![]});_0x5cc412=squel['insert']()[_0x49bb('0x81')](_0x49bb('0x8f'))[_0x49bb('0x6d')]([_0x49bb('0x6e'),_0x49bb('0x74'),_0x49bb('0x70'),_0x49bb('0x59'),'createdAt',_0x49bb('0x50')],squel['select']()[_0x49bb('0x72')]('phone',_0x49bb('0x6e'))[_0x49bb('0x72')]('id',_0x49bb('0x74'))[_0x49bb('0x72')](_0x526e52[_0x49bb('0x75')][_0x49bb('0x76')](),_0x49bb('0x70'))[_0x49bb('0x72')](_0x5cc812[_0x49bb('0x41')]['id'][_0x49bb('0x76')](),'CampaignId')['field']('NOW()',_0x49bb('0x4e'))[_0x49bb('0x72')](_0x49bb('0x73'),_0x49bb('0x50'))[_0x49bb('0x7d')]('cm_contacts')[_0x49bb('0x39')]('deletedAt\x20IS\x20NULL')[_0x49bb('0x39')]('ListId\x20=\x20?',_0x526e52[_0x49bb('0x75')]['toString']())[_0x49bb('0x39')](_0x49bb('0x7a')))[_0x49bb('0x76')]();_0x1c7a91[_0x49bb('0x89')](db['sequelize']['query'](_0x5cc412));}return BPromise[_0x49bb('0x8b')](_0x1c7a91);}})[_0x49bb('0x23')](function(){return _0x2e4be8;})[_0x49bb('0x23')](respondWithResult(_0x308a85,null))['catch'](handleError(_0x308a85,null));};exports[_0x49bb('0x90')]=function(_0x423817,_0xbf83a4,_0x2084e3){return db[_0x49bb('0x2a')]['find']({'where':{'id':_0x423817[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0xbf83a4,null))[_0x49bb('0x23')](function(_0x32ebdd){if(_0x32ebdd){return _0x32ebdd[_0x49bb('0x90')](_0x423817['query']['ids']);}})[_0x49bb('0x23')](function(_0x8a44b6){if(_0x8a44b6){return db[_0x49bb('0x61')][_0x49bb('0x26')]({'where':{'ListId':_0x423817[_0x49bb('0x31')]['ids'],'CampaignId':_0x423817[_0x49bb('0x41')]['id']}})['then'](function(){return _0x8a44b6;});}})[_0x49bb('0x23')](respondWithStatusCode(_0xbf83a4,null))[_0x49bb('0x40')](handleError(_0xbf83a4,null));}; \ No newline at end of file +var _0x8863=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','Campaign','includeAll','include','findAll','rows','catch','show','params','intersection','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','nolimit','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','ListId','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','ContactId','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','push','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x8863,0x1b6));var _0x3886=function(_0x1ec1fa,_0x3efb52){_0x1ec1fa=_0x1ec1fa-0x0;var _0x3e00f0=_0x8863[_0x1ec1fa];return _0x3e00f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3886('0x0'));var zipdir=require(_0x3886('0x1'));var jsonpatch=require(_0x3886('0x2'));var rp=require(_0x3886('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3886('0x4'));var sox=require(_0x3886('0x5'));var csv=require('to-csv');var ejs=require(_0x3886('0x6'));var fs=require('fs');var fs_extra=require(_0x3886('0x7'));var _=require('lodash');var squel=require(_0x3886('0x8'));var crypto=require(_0x3886('0x9'));var jsforce=require(_0x3886('0xa'));var deskjs=require(_0x3886('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3886('0xc'));var Papa=require(_0x3886('0xd'));var Redis=require(_0x3886('0xe'));var authService=require(_0x3886('0xf'));var qs=require(_0x3886('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3886('0x11'));var logger=require(_0x3886('0x12'))(_0x3886('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3886('0x14'));var db=require(_0x3886('0x15'))['db'];function respondWithStatusCode(_0x197f5c,_0x990453){_0x990453=_0x990453||0xcc;return function(_0x6bc2c2){if(_0x6bc2c2){return _0x197f5c[_0x3886('0x16')](_0x990453);}return _0x197f5c[_0x3886('0x17')](_0x990453)[_0x3886('0x18')]();};}function respondWithResult(_0x429d69,_0x1bb402){_0x1bb402=_0x1bb402||0xc8;return function(_0x23ff84){if(_0x23ff84){return _0x429d69[_0x3886('0x17')](_0x1bb402)['json'](_0x23ff84);}};}function respondWithFilteredResult(_0x1c5b7f,_0x42c20b){return function(_0x509201){if(_0x509201){var _0x27545c=typeof _0x42c20b['offset']===_0x3886('0x19')&&typeof _0x42c20b[_0x3886('0x1a')]===_0x3886('0x19');var _0x18021b=_0x509201['count'];var _0x5d4761=_0x27545c?0x0:_0x42c20b[_0x3886('0x1b')];var _0x3d4e74=_0x27545c?_0x509201[_0x3886('0x1c')]:_0x42c20b[_0x3886('0x1b')]+_0x42c20b[_0x3886('0x1a')];var _0x113c1b;if(_0x3d4e74>=_0x18021b){_0x3d4e74=_0x18021b;_0x113c1b=0xc8;}else{_0x113c1b=0xce;}_0x1c5b7f[_0x3886('0x17')](_0x113c1b);return _0x1c5b7f[_0x3886('0x1d')](_0x3886('0x1e'),_0x5d4761+'-'+_0x3d4e74+'/'+_0x18021b)[_0x3886('0x1f')](_0x509201);}return null;};}function patchUpdates(_0x1d44af){return function(_0x4ec1d0){try{jsonpatch[_0x3886('0x20')](_0x4ec1d0,_0x1d44af,!![]);}catch(_0x26e65c){return BPromise[_0x3886('0x21')](_0x26e65c);}return _0x4ec1d0['save']();};}function saveUpdates(_0x2bd588,_0x1e8a4c){return function(_0x128183){if(_0x128183){return _0x128183[_0x3886('0x22')](_0x2bd588)[_0x3886('0x23')](function(_0x3e929e){return _0x3e929e;});}return null;};}function removeEntity(_0x219c8e,_0x554d78){return function(_0x2a773b){if(_0x2a773b){return _0x2a773b[_0x3886('0x24')]()['then'](function(){var _0x116bce=_0x2a773b['get']({'plain':!![]});var _0xe75870='IvrCampaigns';return db['UserProfileResource'][_0x3886('0x24')]({'where':{'type':_0xe75870,'resourceId':_0x116bce['id']}})[_0x3886('0x23')](function(){return _0x2a773b;});})[_0x3886('0x23')](function(){_0x219c8e[_0x3886('0x17')](0xcc)[_0x3886('0x18')]();});}};}function handleEntityNotFound(_0x6e163f,_0x472a38){return function(_0x1b8a62){if(!_0x1b8a62){_0x6e163f[_0x3886('0x16')](0x194);}return _0x1b8a62;};}function handleError(_0xecca38,_0x2a822d){_0x2a822d=_0x2a822d||0x1f4;return function(_0x353d84){logger[_0x3886('0x25')](_0x353d84[_0x3886('0x26')]);if(_0x353d84[_0x3886('0x27')]){delete _0x353d84[_0x3886('0x27')];}_0xecca38[_0x3886('0x17')](_0x2a822d)[_0x3886('0x28')](_0x353d84);};}exports[_0x3886('0x29')]=function(_0x5c6331,_0x6a1bbb){var _0x2feca4={},_0x34ed81={},_0x348909={'count':0x0,'rows':[]};var _0x384e91=_[_0x3886('0x2a')](db['Campaign'][_0x3886('0x2b')],function(_0x1a390a){return{'name':_0x1a390a['fieldName'],'type':_0x1a390a[_0x3886('0x2c')][_0x3886('0x2d')]};});_0x34ed81[_0x3886('0x2e')]=_[_0x3886('0x2a')](_0x384e91,_0x3886('0x27'));_0x34ed81[_0x3886('0x2f')]=_[_0x3886('0x30')](_0x5c6331[_0x3886('0x2f')]);_0x34ed81[_0x3886('0x31')]=_['intersection'](_0x34ed81[_0x3886('0x2e')],_0x34ed81[_0x3886('0x2f')]);_0x2feca4[_0x3886('0x32')]=_['intersection'](_0x34ed81[_0x3886('0x2e')],qs[_0x3886('0x33')](_0x5c6331['query'][_0x3886('0x33')]));_0x2feca4[_0x3886('0x32')]=_0x2feca4[_0x3886('0x32')][_0x3886('0x34')]?_0x2feca4[_0x3886('0x32')]:_0x34ed81['model'];if(!_0x5c6331['query']['hasOwnProperty']('nolimit')){_0x2feca4[_0x3886('0x1a')]=qs[_0x3886('0x1a')](_0x5c6331[_0x3886('0x2f')][_0x3886('0x1a')]);_0x2feca4[_0x3886('0x1b')]=qs[_0x3886('0x1b')](_0x5c6331['query'][_0x3886('0x1b')]);}_0x2feca4[_0x3886('0x35')]=qs[_0x3886('0x36')](_0x5c6331[_0x3886('0x2f')][_0x3886('0x36')]);_0x2feca4[_0x3886('0x37')]=qs['filters'](_[_0x3886('0x38')](_0x5c6331[_0x3886('0x2f')],_0x34ed81[_0x3886('0x31')]),_0x384e91);if(_0x5c6331[_0x3886('0x2f')][_0x3886('0x39')]){_0x2feca4[_0x3886('0x37')]=_[_0x3886('0x3a')](_0x2feca4[_0x3886('0x37')],{'$or':_['map'](_0x384e91,function(_0x2a4263){if(_0x2a4263['type']!==_0x3886('0x3b')){var _0x430899={};_0x430899[_0x2a4263[_0x3886('0x27')]]={'$like':'%'+_0x5c6331[_0x3886('0x2f')][_0x3886('0x39')]+'%'};return _0x430899;}})});}_0x2feca4=_[_0x3886('0x3a')]({},_0x2feca4,_0x5c6331['options']);var _0x4097cb={'where':_0x2feca4[_0x3886('0x37')]};return db[_0x3886('0x3c')][_0x3886('0x1c')](_0x4097cb)[_0x3886('0x23')](function(_0xb5bacb){_0x348909['count']=_0xb5bacb;if(_0x5c6331[_0x3886('0x2f')][_0x3886('0x3d')]){_0x2feca4[_0x3886('0x3e')]=[{'all':!![]}];}return db[_0x3886('0x3c')][_0x3886('0x3f')](_0x2feca4);})['then'](function(_0x19f493){_0x348909[_0x3886('0x40')]=_0x19f493;return _0x348909;})[_0x3886('0x23')](respondWithFilteredResult(_0x6a1bbb,_0x2feca4))[_0x3886('0x41')](handleError(_0x6a1bbb,null));};exports[_0x3886('0x42')]=function(_0x3e86e7,_0x4b409e){var _0x3023e3={'raw':![],'where':{'id':_0x3e86e7[_0x3886('0x43')]['id']}},_0x23bb75={};_0x23bb75[_0x3886('0x2e')]=_[_0x3886('0x30')](db['Campaign'][_0x3886('0x2b')]);_0x23bb75['query']=_[_0x3886('0x30')](_0x3e86e7[_0x3886('0x2f')]);_0x23bb75[_0x3886('0x31')]=_[_0x3886('0x44')](_0x23bb75[_0x3886('0x2e')],_0x23bb75['query']);_0x3023e3[_0x3886('0x32')]=_[_0x3886('0x44')](_0x23bb75[_0x3886('0x2e')],qs[_0x3886('0x33')](_0x3e86e7[_0x3886('0x2f')][_0x3886('0x33')]));_0x3023e3['attributes']=_0x3023e3[_0x3886('0x32')]['length']?_0x3023e3['attributes']:_0x23bb75[_0x3886('0x2e')];if(_0x3e86e7[_0x3886('0x2f')][_0x3886('0x3d')]){_0x3023e3[_0x3886('0x3e')]=[{'all':!![]}];}_0x3023e3=_[_0x3886('0x3a')]({},_0x3023e3,_0x3e86e7[_0x3886('0x45')]);return db[_0x3886('0x3c')]['find'](_0x3023e3)[_0x3886('0x23')](handleEntityNotFound(_0x4b409e,null))['then'](respondWithResult(_0x4b409e,null))[_0x3886('0x41')](handleError(_0x4b409e,null));};exports[_0x3886('0x46')]=function(_0x1de518,_0x2f8be9){return db[_0x3886('0x3c')][_0x3886('0x46')](_0x1de518[_0x3886('0x47')],{})['then'](function(_0x1196d1){var _0x4ec22b=_0x1de518[_0x3886('0x48')][_0x3886('0x49')]({'plain':!![]});if(!_0x4ec22b)throw new Error(_0x3886('0x4a'));if(_0x4ec22b[_0x3886('0x4b')]==='user'){var _0x28b8f6=_0x1196d1[_0x3886('0x49')]({'plain':!![]});var _0x2b2b11=_0x3886('0x4c');return db[_0x3886('0x4d')][_0x3886('0x4e')]({'where':{'name':_0x2b2b11,'userProfileId':_0x4ec22b[_0x3886('0x4f')]},'raw':!![]})[_0x3886('0x23')](function(_0x45d34c){if(_0x45d34c&&_0x45d34c[_0x3886('0x50')]===0x0){return db[_0x3886('0x51')][_0x3886('0x46')]({'name':_0x28b8f6[_0x3886('0x27')],'resourceId':_0x28b8f6['id'],'type':_0x45d34c['name'],'sectionId':_0x45d34c['id']},{})[_0x3886('0x23')](function(){return _0x1196d1;});}else{return _0x1196d1;}})[_0x3886('0x41')](function(_0x47cf74){logger['error'](_0x3886('0x52'),_0x47cf74);throw _0x47cf74;});}return _0x1196d1;})[_0x3886('0x23')](respondWithResult(_0x2f8be9,0xc9))[_0x3886('0x41')](handleError(_0x2f8be9,null));};exports[_0x3886('0x53')]=function(_0x4cb1ab,_0x30e0c0){var _0x523f01={'where':{'id':_0x4cb1ab[_0x3886('0x43')]['id']}},_0x457c90={};_0x457c90[_0x3886('0x2e')]=_[_0x3886('0x30')](db[_0x3886('0x3c')][_0x3886('0x2b')]);_0x523f01['attributes']=_[_0x3886('0x44')](_0x457c90[_0x3886('0x2e')],qs[_0x3886('0x33')](_0x4cb1ab[_0x3886('0x2f')]['fields']));_0x523f01['attributes']=_0x523f01[_0x3886('0x32')][_0x3886('0x34')]?_0x523f01[_0x3886('0x32')]:_0x457c90[_0x3886('0x2e')];if(_0x4cb1ab[_0x3886('0x2f')][_0x3886('0x3d')]){_0x523f01[_0x3886('0x3e')]=[{'all':!![]}];}_0x523f01=_[_0x3886('0x3a')]({},_0x523f01,_0x4cb1ab[_0x3886('0x45')]);return db['Campaign'][_0x3886('0x4e')](_0x523f01)[_0x3886('0x23')](handleEntityNotFound(_0x30e0c0,null))['then'](function(_0x35716f){if(_0x35716f){var _0x4adfa6=_0x35716f[_0x3886('0x49')]({'plain':!![]});_0x4adfa6=qs[_0x3886('0x54')](_0x4adfa6,['id',_0x3886('0x55'),_0x3886('0x56')]);_0x4cb1ab[_0x3886('0x47')]=_[_0x3886('0x54')](_0x4cb1ab['body'],['id',_0x3886('0x55'),_0x3886('0x56')]);return db['Campaign'][_0x3886('0x46')](_[_0x3886('0x3a')](_0x4adfa6,_0x4cb1ab['body']),{'include':_0x4cb1ab[_0x3886('0x2f')][_0x3886('0x3d')]?[{'all':!![]}]:undefined})[_0x3886('0x23')](function(_0x45bdc2){var _0x1d7c12=_0x4cb1ab[_0x3886('0x48')][_0x3886('0x49')]({'plain':!![]});if(!_0x1d7c12)throw new Error(_0x3886('0x4a'));if(_0x1d7c12['role']==='user'){var _0x148d4e=_0x45bdc2['get']({'plain':!![]});var _0x410f50=_0x3886('0x4c');return db[_0x3886('0x4d')][_0x3886('0x4e')]({'where':{'name':_0x410f50,'userProfileId':_0x1d7c12[_0x3886('0x4f')]},'raw':!![]})[_0x3886('0x23')](function(_0x5a6714){if(_0x5a6714&&_0x5a6714['autoAssociation']===0x0){return db[_0x3886('0x51')]['create']({'name':_0x148d4e[_0x3886('0x27')],'resourceId':_0x148d4e['id'],'type':_0x5a6714[_0x3886('0x27')],'sectionId':_0x5a6714['id']},{})['then'](function(){return _0x45bdc2;});}else{return _0x45bdc2;}})['catch'](function(_0x112e4a){logger[_0x3886('0x25')](_0x3886('0x52'),_0x112e4a);throw _0x112e4a;});}return _0x45bdc2;});}})[_0x3886('0x23')](respondWithResult(_0x30e0c0,0xc9))[_0x3886('0x41')](handleError(_0x30e0c0,null));};exports[_0x3886('0x22')]=function(_0x490ec3,_0x327fdb){if(_0x490ec3[_0x3886('0x47')]['id']){delete _0x490ec3['body']['id'];}return db['Campaign'][_0x3886('0x4e')]({'where':{'id':_0x490ec3[_0x3886('0x43')]['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x327fdb,null))[_0x3886('0x23')](saveUpdates(_0x490ec3['body'],null))['then'](respondWithResult(_0x327fdb,null))['catch'](handleError(_0x327fdb,null));};exports['destroy']=function(_0x5cdd86,_0x2af577){return db[_0x3886('0x3c')][_0x3886('0x4e')]({'where':{'id':_0x5cdd86[_0x3886('0x43')]['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x2af577,null))[_0x3886('0x23')](removeEntity(_0x2af577,null))[_0x3886('0x41')](handleError(_0x2af577,null));};exports[_0x3886('0x57')]=function(_0x2cf6a8,_0x46456b,_0x430768){var _0x4b0598={'raw':!![],'where':{}};var _0x5df6e4={};var _0x5a3095={'count':0x0,'rows':[]};return db[_0x3886('0x3c')][_0x3886('0x58')]({'where':{'id':_0x2cf6a8[_0x3886('0x43')]['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x46456b,null))[_0x3886('0x23')](function(_0x26ff0b){if(_0x26ff0b){_0x5df6e4['model']=_['keys'](db[_0x3886('0x59')][_0x3886('0x2b')]);_0x5df6e4[_0x3886('0x2f')]=_[_0x3886('0x30')](_0x2cf6a8[_0x3886('0x2f')]);_0x5df6e4[_0x3886('0x31')]=_[_0x3886('0x44')](_0x5df6e4[_0x3886('0x2e')],_0x5df6e4[_0x3886('0x2f')]);_0x4b0598['attributes']=_[_0x3886('0x44')](_0x5df6e4[_0x3886('0x2e')],qs[_0x3886('0x33')](_0x2cf6a8[_0x3886('0x2f')]['fields']));_0x4b0598[_0x3886('0x32')]=_0x4b0598['attributes']['length']?_0x4b0598['attributes']:_0x5df6e4['model'];if(!_0x2cf6a8[_0x3886('0x2f')][_0x3886('0x5a')]('nolimit')){_0x4b0598['limit']=qs[_0x3886('0x1a')](_0x2cf6a8[_0x3886('0x2f')][_0x3886('0x1a')]);_0x4b0598[_0x3886('0x1b')]=qs[_0x3886('0x1b')](_0x2cf6a8[_0x3886('0x2f')][_0x3886('0x1b')]);}_0x4b0598[_0x3886('0x35')]=qs['sort'](_0x2cf6a8[_0x3886('0x2f')][_0x3886('0x36')]);_0x4b0598[_0x3886('0x37')]=qs['filters'](_[_0x3886('0x38')](_0x2cf6a8[_0x3886('0x2f')],_0x5df6e4[_0x3886('0x31')]));_0x4b0598[_0x3886('0x37')][_0x3886('0x5b')]=_0x26ff0b['id'];if(_0x2cf6a8[_0x3886('0x2f')][_0x3886('0x39')]){_0x4b0598[_0x3886('0x37')]=_[_0x3886('0x3a')](_0x4b0598['where'],{'$or':_[_0x3886('0x2a')](_0x4b0598['attributes'],function(_0x4a1a0e){var _0x115bab={};_0x115bab[_0x4a1a0e]={'$like':'%'+_0x2cf6a8[_0x3886('0x2f')][_0x3886('0x39')]+'%'};return _0x115bab;})});}_0x4b0598=_[_0x3886('0x3a')]({},_0x4b0598,_0x2cf6a8[_0x3886('0x45')]);return db['CmHopper'][_0x3886('0x1c')]({'where':_0x4b0598[_0x3886('0x37')]})[_0x3886('0x23')](function(_0x49649c){_0x5a3095[_0x3886('0x1c')]=_0x49649c;if(_0x2cf6a8['query']['includeAll']){_0x4b0598[_0x3886('0x3e')]=[{'all':!![]}];}return db[_0x3886('0x59')][_0x3886('0x3f')](_0x4b0598);})['then'](function(_0x1697c0){_0x5a3095['rows']=_0x1697c0;return _0x5a3095;});}})['then'](respondWithFilteredResult(_0x46456b,_0x4b0598))['catch'](handleError(_0x46456b,null));};exports[_0x3886('0x5c')]=function(_0x53609a,_0x3bd8a5,_0x3f154a){var _0x2a561c={'raw':!![],'where':{}};var _0x361f0e={};var _0x1b99f6={'count':0x0,'rows':[]};return db[_0x3886('0x3c')][_0x3886('0x58')]({'where':{'id':_0x53609a['params']['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x3bd8a5,null))[_0x3886('0x23')](function(_0x13173c){if(_0x13173c){_0x361f0e[_0x3886('0x2e')]=_[_0x3886('0x30')](db['CmHopperHistory']['rawAttributes']);_0x361f0e[_0x3886('0x2f')]=_['keys'](_0x53609a[_0x3886('0x2f')]);_0x361f0e[_0x3886('0x31')]=_[_0x3886('0x44')](_0x361f0e[_0x3886('0x2e')],_0x361f0e[_0x3886('0x2f')]);_0x2a561c[_0x3886('0x32')]=_['intersection'](_0x361f0e[_0x3886('0x2e')],qs[_0x3886('0x33')](_0x53609a[_0x3886('0x2f')]['fields']));_0x2a561c[_0x3886('0x32')]=_0x2a561c['attributes'][_0x3886('0x34')]?_0x2a561c[_0x3886('0x32')]:_0x361f0e['model'];if(!_0x53609a[_0x3886('0x2f')][_0x3886('0x5a')](_0x3886('0x5d'))){_0x2a561c['limit']=qs[_0x3886('0x1a')](_0x53609a[_0x3886('0x2f')]['limit']);_0x2a561c['offset']=qs['offset'](_0x53609a['query']['offset']);}_0x2a561c[_0x3886('0x35')]=qs[_0x3886('0x36')](_0x53609a[_0x3886('0x2f')][_0x3886('0x36')]);_0x2a561c[_0x3886('0x37')]=qs[_0x3886('0x31')](_['pick'](_0x53609a[_0x3886('0x2f')],_0x361f0e[_0x3886('0x31')]));_0x2a561c[_0x3886('0x37')][_0x3886('0x5b')]=_0x13173c['id'];if(_0x53609a[_0x3886('0x2f')]['filter']){_0x2a561c['where']=_[_0x3886('0x3a')](_0x2a561c[_0x3886('0x37')],{'$or':_[_0x3886('0x2a')](_0x2a561c[_0x3886('0x32')],function(_0x4497e6){var _0x446e70={};_0x446e70[_0x4497e6]={'$like':'%'+_0x53609a[_0x3886('0x2f')][_0x3886('0x39')]+'%'};return _0x446e70;})});}_0x2a561c=_[_0x3886('0x3a')]({},_0x2a561c,_0x53609a[_0x3886('0x45')]);return db[_0x3886('0x5e')][_0x3886('0x1c')]({'where':_0x2a561c[_0x3886('0x37')]})['then'](function(_0x45e2c4){_0x1b99f6[_0x3886('0x1c')]=_0x45e2c4;if(_0x53609a[_0x3886('0x2f')]['includeAll']){_0x2a561c['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x3886('0x3f')](_0x2a561c);})['then'](function(_0x462000){_0x1b99f6[_0x3886('0x40')]=_0x462000;return _0x1b99f6;});}})[_0x3886('0x23')](respondWithFilteredResult(_0x3bd8a5,_0x2a561c))[_0x3886('0x41')](handleError(_0x3bd8a5,null));};exports[_0x3886('0x5f')]=function(_0x129ed0,_0x29bab2,_0x3b6304){var _0x1b411a={'raw':!![],'where':{}};var _0x59440f={};var _0x1c08b7={'count':0x0,'rows':[]};return db[_0x3886('0x3c')][_0x3886('0x58')]({'where':{'id':_0x129ed0['params']['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x29bab2,null))['then'](function(_0x19aef4){if(_0x19aef4){_0x59440f[_0x3886('0x2e')]=_[_0x3886('0x30')](db['CmHopperFinal'][_0x3886('0x2b')]);_0x59440f['query']=_[_0x3886('0x30')](_0x129ed0['query']);_0x59440f[_0x3886('0x31')]=_['intersection'](_0x59440f[_0x3886('0x2e')],_0x59440f['query']);_0x1b411a['attributes']=_[_0x3886('0x44')](_0x59440f[_0x3886('0x2e')],qs[_0x3886('0x33')](_0x129ed0[_0x3886('0x2f')][_0x3886('0x33')]));_0x1b411a['attributes']=_0x1b411a[_0x3886('0x32')][_0x3886('0x34')]?_0x1b411a[_0x3886('0x32')]:_0x59440f[_0x3886('0x2e')];if(!_0x129ed0['query'][_0x3886('0x5a')](_0x3886('0x5d'))){_0x1b411a[_0x3886('0x1a')]=qs['limit'](_0x129ed0[_0x3886('0x2f')]['limit']);_0x1b411a['offset']=qs[_0x3886('0x1b')](_0x129ed0[_0x3886('0x2f')][_0x3886('0x1b')]);}_0x1b411a[_0x3886('0x35')]=qs[_0x3886('0x36')](_0x129ed0[_0x3886('0x2f')][_0x3886('0x36')]);_0x1b411a[_0x3886('0x37')]=qs[_0x3886('0x31')](_[_0x3886('0x38')](_0x129ed0['query'],_0x59440f['filters']));_0x1b411a['where'][_0x3886('0x5b')]=_0x19aef4['id'];if(_0x129ed0[_0x3886('0x2f')][_0x3886('0x39')]){_0x1b411a['where']=_[_0x3886('0x3a')](_0x1b411a[_0x3886('0x37')],{'$or':_[_0x3886('0x2a')](_0x1b411a[_0x3886('0x32')],function(_0x5e97a6){var _0x54cdfc={};_0x54cdfc[_0x5e97a6]={'$like':'%'+_0x129ed0[_0x3886('0x2f')]['filter']+'%'};return _0x54cdfc;})});}_0x1b411a=_[_0x3886('0x3a')]({},_0x1b411a,_0x129ed0[_0x3886('0x45')]);return db[_0x3886('0x60')][_0x3886('0x1c')]({'where':_0x1b411a['where']})['then'](function(_0x1ff20b){_0x1c08b7[_0x3886('0x1c')]=_0x1ff20b;if(_0x129ed0[_0x3886('0x2f')][_0x3886('0x3d')]){_0x1b411a['include']=[{'all':!![]}];}return db[_0x3886('0x60')][_0x3886('0x3f')](_0x1b411a);})[_0x3886('0x23')](function(_0x2b14b1){_0x1c08b7[_0x3886('0x40')]=_0x2b14b1;return _0x1c08b7;});}})[_0x3886('0x23')](respondWithFilteredResult(_0x29bab2,_0x1b411a))[_0x3886('0x41')](handleError(_0x29bab2,null));};exports['getHopperBlacks']=function(_0x3c508a,_0x3191e8,_0x3cde0a){var _0x17acbe={'raw':!![],'where':{}};var _0x17312c={};var _0x3197c={'count':0x0,'rows':[]};return db['Campaign'][_0x3886('0x58')]({'where':{'id':_0x3c508a[_0x3886('0x43')]['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x3191e8,null))['then'](function(_0xad4a3){if(_0xad4a3){_0x17312c['model']=_[_0x3886('0x30')](db[_0x3886('0x61')]['rawAttributes']);_0x17312c[_0x3886('0x2f')]=_[_0x3886('0x30')](_0x3c508a[_0x3886('0x2f')]);_0x17312c['filters']=_[_0x3886('0x44')](_0x17312c[_0x3886('0x2e')],_0x17312c[_0x3886('0x2f')]);_0x17acbe['attributes']=_[_0x3886('0x44')](_0x17312c[_0x3886('0x2e')],qs[_0x3886('0x33')](_0x3c508a[_0x3886('0x2f')][_0x3886('0x33')]));_0x17acbe[_0x3886('0x32')]=_0x17acbe['attributes'][_0x3886('0x34')]?_0x17acbe[_0x3886('0x32')]:_0x17312c['model'];if(!_0x3c508a[_0x3886('0x2f')][_0x3886('0x5a')](_0x3886('0x5d'))){_0x17acbe['limit']=qs[_0x3886('0x1a')](_0x3c508a[_0x3886('0x2f')]['limit']);_0x17acbe[_0x3886('0x1b')]=qs[_0x3886('0x1b')](_0x3c508a['query']['offset']);}_0x17acbe[_0x3886('0x35')]=qs['sort'](_0x3c508a[_0x3886('0x2f')][_0x3886('0x36')]);_0x17acbe[_0x3886('0x37')]=qs[_0x3886('0x31')](_[_0x3886('0x38')](_0x3c508a[_0x3886('0x2f')],_0x17312c[_0x3886('0x31')]));_0x17acbe[_0x3886('0x37')][_0x3886('0x5b')]=_0xad4a3['id'];if(_0x3c508a[_0x3886('0x2f')][_0x3886('0x39')]){_0x17acbe[_0x3886('0x37')]=_[_0x3886('0x3a')](_0x17acbe[_0x3886('0x37')],{'$or':_[_0x3886('0x2a')](_0x17acbe[_0x3886('0x32')],function(_0x5c0ff7){var _0x6d5591={};_0x6d5591[_0x5c0ff7]={'$like':'%'+_0x3c508a[_0x3886('0x2f')][_0x3886('0x39')]+'%'};return _0x6d5591;})});}_0x17acbe=_['merge']({},_0x17acbe,_0x3c508a[_0x3886('0x45')]);return db[_0x3886('0x61')]['count']({'where':_0x17acbe[_0x3886('0x37')]})[_0x3886('0x23')](function(_0x47d2ba){_0x3197c[_0x3886('0x1c')]=_0x47d2ba;if(_0x3c508a['query']['includeAll']){_0x17acbe[_0x3886('0x3e')]=[{'all':!![]}];}return db[_0x3886('0x61')][_0x3886('0x3f')](_0x17acbe);})[_0x3886('0x23')](function(_0x10a6ed){_0x3197c['rows']=_0x10a6ed;return _0x3197c;});}})['then'](respondWithFilteredResult(_0x3191e8,_0x17acbe))[_0x3886('0x41')](handleError(_0x3191e8,null));};exports['getLists']=function(_0xdc7f0a,_0x14e00e,_0x25fbf6){var _0x579a8c={};var _0x4eac2c={};var _0x4c061c;var _0x119223;return db[_0x3886('0x3c')][_0x3886('0x58')]({'where':{'id':_0xdc7f0a[_0x3886('0x43')]['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x14e00e,null))[_0x3886('0x23')](function(_0x53db87){if(_0x53db87){_0x4c061c=_0x53db87;_0x4eac2c[_0x3886('0x2e')]=_[_0x3886('0x30')](db[_0x3886('0x62')]['rawAttributes']);_0x4eac2c[_0x3886('0x2f')]=_[_0x3886('0x30')](_0xdc7f0a[_0x3886('0x2f')]);_0x4eac2c[_0x3886('0x31')]=_[_0x3886('0x44')](_0x4eac2c[_0x3886('0x2e')],_0x4eac2c['query']);_0x579a8c[_0x3886('0x32')]=_[_0x3886('0x44')](_0x4eac2c[_0x3886('0x2e')],qs['fields'](_0xdc7f0a[_0x3886('0x2f')][_0x3886('0x33')]));_0x579a8c[_0x3886('0x32')]=_0x579a8c[_0x3886('0x32')][_0x3886('0x34')]?_0x579a8c[_0x3886('0x32')]:_0x4eac2c[_0x3886('0x2e')];_0x579a8c[_0x3886('0x35')]=qs['sort'](_0xdc7f0a[_0x3886('0x2f')][_0x3886('0x36')]);_0x579a8c[_0x3886('0x37')]=qs[_0x3886('0x31')](_[_0x3886('0x38')](_0xdc7f0a[_0x3886('0x2f')],_0x4eac2c[_0x3886('0x31')]));if(_0xdc7f0a[_0x3886('0x2f')][_0x3886('0x39')]){_0x579a8c[_0x3886('0x37')]=_[_0x3886('0x3a')](_0x579a8c['where'],{'$or':_[_0x3886('0x2a')](_0x579a8c[_0x3886('0x32')],function(_0x5ff10e){var _0x5d7f0a={};_0x5d7f0a[_0x5ff10e]={'$like':'%'+_0xdc7f0a[_0x3886('0x2f')][_0x3886('0x39')]+'%'};return _0x5d7f0a;})});}_0x579a8c=_['merge']({},_0x579a8c,_0xdc7f0a[_0x3886('0x45')]);return _0x4c061c[_0x3886('0x63')](_0x579a8c);}})['then'](function(_0x44a60d){if(_0x44a60d){_0x119223=_0x44a60d[_0x3886('0x34')];if(!_0xdc7f0a[_0x3886('0x2f')][_0x3886('0x5a')](_0x3886('0x5d'))){_0x579a8c[_0x3886('0x1a')]=qs[_0x3886('0x1a')](_0xdc7f0a[_0x3886('0x2f')][_0x3886('0x1a')]);_0x579a8c[_0x3886('0x1b')]=qs[_0x3886('0x1b')](_0xdc7f0a[_0x3886('0x2f')][_0x3886('0x1b')]);}return _0x4c061c['getLists'](_0x579a8c);}})[_0x3886('0x23')](function(_0x159285){if(_0x159285){return _0x159285?{'count':_0x119223,'rows':_0x159285}:null;}})['then'](respondWithResult(_0x14e00e,null))[_0x3886('0x41')](handleError(_0x14e00e,null));};exports[_0x3886('0x64')]=function(_0x31d251,_0x4fdcd9,_0x3b8523){var _0x2071d6,_0x302f70;var _0x433fc6=[];var _0x453515=moment()[_0x3886('0x65')](_0x3886('0x66'));return db['Campaign']['find']({'where':{'id':_0x31d251[_0x3886('0x43')]['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x4fdcd9,null))['then'](function(_0x57ccbb){if(_0x57ccbb){_0x302f70=_0x57ccbb;return _0x57ccbb[_0x3886('0x64')](_0x31d251[_0x3886('0x47')][_0x3886('0x67')],_[_0x3886('0x54')](_0x31d251[_0x3886('0x47')],['ids','id'])||{});}return null;})['spread'](function(_0x4422f5){var _0x163a1f;var _0x51a2c0;_0x2071d6=_0x4422f5||[];var _0x295792=[];if(_0x4422f5){for(var _0x2d7ff0=0x0;_0x2d7ff0<_0x4422f5['length'];_0x2d7ff0+=0x1){var _0x83400=_0x4422f5[_0x2d7ff0]['get']({'plain':!![]});_0x302f70[_0x3886('0x68')]=_0x31d251['body'][_0x3886('0x68')]?_0x31d251[_0x3886('0x47')][_0x3886('0x68')]:_0x302f70[_0x3886('0x68')];switch(_0x302f70['dialCheckDuplicateType']){case _0x3886('0x69'):_0x163a1f=squel['insert']()[_0x3886('0x6a')](_0x3886('0x6b'))[_0x3886('0x6c')]([_0x3886('0x6d'),'scheduledAt','ContactId',_0x3886('0x6e'),_0x3886('0x5b'),'createdAt',_0x3886('0x56')],squel[_0x3886('0x6f')]()[_0x3886('0x70')](_0x3886('0x6d'),_0x3886('0x6d'))[_0x3886('0x70')](_0x3886('0x71'),_0x3886('0x72'))[_0x3886('0x70')]('id','ContactId')[_0x3886('0x70')](_0x83400['CmListId'][_0x3886('0x73')](),'ListId')['field'](_0x31d251[_0x3886('0x43')]['id'][_0x3886('0x73')](),_0x3886('0x5b'))[_0x3886('0x70')]('\x27'+_0x453515+'\x27',_0x3886('0x55'))[_0x3886('0x70')]('\x27'+_0x453515+'\x27','updatedAt')[_0x3886('0x74')](_0x3886('0x75'))[_0x3886('0x37')](_0x3886('0x76'))['where'](_0x3886('0x77'),_0x83400[_0x3886('0x78')][_0x3886('0x73')]())['where'](_0x3886('0x79'))['where'](_0x3886('0x7a'),squel['select']()[_0x3886('0x70')](_0x3886('0x7b'))['from']('cm_hopper_final')[_0x3886('0x37')](_0x3886('0x7c'),_0x31d251[_0x3886('0x43')]['id'][_0x3886('0x73')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x3886('0x6f')]()[_0x3886('0x70')](_0x3886('0x7d'))[_0x3886('0x74')](_0x3886('0x6b'))[_0x3886('0x37')]('CampaignId\x20=\x20?',_0x31d251[_0x3886('0x43')]['id']['toString']())))[_0x3886('0x73')]();break;case _0x3886('0x7e'):_0x163a1f=squel[_0x3886('0x7f')]()[_0x3886('0x6a')]('cm_hopper')[_0x3886('0x6c')]([_0x3886('0x6d'),_0x3886('0x72'),_0x3886('0x80'),_0x3886('0x6e'),_0x3886('0x5b'),_0x3886('0x55'),_0x3886('0x56')],squel[_0x3886('0x6f')]()[_0x3886('0x70')]('phone',_0x3886('0x6d'))['field'](_0x3886('0x71'),_0x3886('0x72'))['field']('id',_0x3886('0x80'))[_0x3886('0x70')](_0x83400[_0x3886('0x78')]['toString'](),'ListId')[_0x3886('0x70')](_0x31d251[_0x3886('0x43')]['id'][_0x3886('0x73')](),_0x3886('0x5b'))[_0x3886('0x70')]('\x27'+_0x453515+'\x27',_0x3886('0x55'))[_0x3886('0x70')]('\x27'+_0x453515+'\x27',_0x3886('0x56'))['from'](_0x3886('0x75'))[_0x3886('0x37')](_0x3886('0x76'))[_0x3886('0x37')]('ListId\x20=\x20?',_0x83400[_0x3886('0x78')]['toString']())[_0x3886('0x37')](_0x3886('0x79'))[_0x3886('0x37')](_0x3886('0x7a'),squel['select']()[_0x3886('0x70')]('COALESCE(phone,\x27\x27)')[_0x3886('0x74')](_0x3886('0x6b'))['where'](_0x3886('0x7c'),_0x31d251['params']['id']['toString']())))[_0x3886('0x73')]();break;default:_0x163a1f=squel[_0x3886('0x7f')]()[_0x3886('0x6a')](_0x3886('0x6b'))[_0x3886('0x6c')](['phone',_0x3886('0x72'),'ContactId','ListId',_0x3886('0x5b'),_0x3886('0x55'),'updatedAt'],squel[_0x3886('0x6f')]()[_0x3886('0x70')](_0x3886('0x6d'),_0x3886('0x6d'))[_0x3886('0x70')](_0x3886('0x71'),_0x3886('0x72'))[_0x3886('0x70')]('id',_0x3886('0x80'))[_0x3886('0x70')](_0x83400[_0x3886('0x78')]['toString'](),_0x3886('0x6e'))[_0x3886('0x70')](_0x31d251[_0x3886('0x43')]['id'][_0x3886('0x73')](),'CampaignId')[_0x3886('0x70')]('\x27'+_0x453515+'\x27',_0x3886('0x55'))[_0x3886('0x70')]('\x27'+_0x453515+'\x27',_0x3886('0x56'))[_0x3886('0x74')]('cm_contacts')[_0x3886('0x37')](_0x3886('0x76'))[_0x3886('0x37')](_0x3886('0x77'),_0x83400[_0x3886('0x78')]['toString']())[_0x3886('0x37')](_0x3886('0x79')))[_0x3886('0x73')]();}_0x51a2c0=squel[_0x3886('0x7f')]()['into'](_0x3886('0x81'))['fromQuery']([_0x3886('0x82'),_0x3886('0x72'),_0x3886('0x6d'),_0x3886('0x83'),_0x3886('0x55'),_0x3886('0x56')],squel['select']()[_0x3886('0x70')](_0x3886('0x84'),'id')[_0x3886('0x70')](_0x3886('0x71'),_0x3886('0x72'))[_0x3886('0x70')](_0x3886('0x85'),_0x3886('0x6d'))[_0x3886('0x70')](_0x3886('0x86'),_0x3886('0x83'))[_0x3886('0x70')]('\x27'+_0x453515+'\x27','createdAt')[_0x3886('0x70')]('\x27'+_0x453515+'\x27','updatedAt')[_0x3886('0x74')](_0x3886('0x87'),'ci')[_0x3886('0x88')](_0x3886('0x6b'),'h',_0x3886('0x89'))[_0x3886('0x37')](_0x3886('0x8a'),_0x83400['CmListId'][_0x3886('0x73')]())[_0x3886('0x37')](_0x3886('0x8b'),_0x31d251['params']['id'][_0x3886('0x73')]())[_0x3886('0x37')](_0x3886('0x8c'),_0x453515))[_0x3886('0x73')]();_0x295792['push'](db[_0x3886('0x8d')][_0x3886('0x2f')](_0x163a1f));_0x433fc6['push'](db['sequelize'][_0x3886('0x2f')](_0x51a2c0));}return BPromise[_0x3886('0x8e')](_0x295792);}})[_0x3886('0x23')](function(){return BPromise[_0x3886('0x8e')](_0x433fc6);})['then'](function(){return _0x2071d6;})[_0x3886('0x23')](respondWithResult(_0x4fdcd9,null))[_0x3886('0x41')](handleError(_0x4fdcd9,null));};exports[_0x3886('0x8f')]=function(_0x1ad475,_0x9bbaff,_0x35f9c4){return db['Campaign'][_0x3886('0x4e')]({'where':{'id':_0x1ad475[_0x3886('0x43')]['id']}})['then'](handleEntityNotFound(_0x9bbaff,null))[_0x3886('0x23')](function(_0x399ed3){if(_0x399ed3){return _0x399ed3[_0x3886('0x8f')](_0x1ad475[_0x3886('0x2f')][_0x3886('0x67')]);}})[_0x3886('0x23')](function(_0x46e6a5){if(_0x46e6a5){return db['CmHopper']['destroy']({'where':{'ListId':_0x1ad475[_0x3886('0x2f')][_0x3886('0x67')],'CampaignId':_0x1ad475[_0x3886('0x43')]['id']}})[_0x3886('0x23')](function(){return _0x46e6a5;});}})[_0x3886('0x23')](respondWithStatusCode(_0x9bbaff,null))[_0x3886('0x41')](handleError(_0x9bbaff,null));};exports[_0x3886('0x90')]=function(_0x27d2ed,_0x27049d,_0x1c8e38){var _0x4212cd={};var _0x563f2b={};var _0x4d9a;var _0xaa8f6a;return db[_0x3886('0x3c')][_0x3886('0x58')]({'where':{'id':_0x27d2ed[_0x3886('0x43')]['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x27049d,null))[_0x3886('0x23')](function(_0x157b30){if(_0x157b30){_0x4d9a=_0x157b30;_0x563f2b[_0x3886('0x2e')]=_[_0x3886('0x30')](db[_0x3886('0x62')][_0x3886('0x2b')]);_0x563f2b[_0x3886('0x2f')]=_[_0x3886('0x30')](_0x27d2ed[_0x3886('0x2f')]);_0x563f2b[_0x3886('0x31')]=_[_0x3886('0x44')](_0x563f2b['model'],_0x563f2b[_0x3886('0x2f')]);_0x4212cd[_0x3886('0x32')]=_[_0x3886('0x44')](_0x563f2b[_0x3886('0x2e')],qs[_0x3886('0x33')](_0x27d2ed[_0x3886('0x2f')]['fields']));_0x4212cd[_0x3886('0x32')]=_0x4212cd[_0x3886('0x32')][_0x3886('0x34')]?_0x4212cd[_0x3886('0x32')]:_0x563f2b[_0x3886('0x2e')];_0x4212cd[_0x3886('0x35')]=qs[_0x3886('0x36')](_0x27d2ed[_0x3886('0x2f')][_0x3886('0x36')]);_0x4212cd[_0x3886('0x37')]=qs[_0x3886('0x31')](_[_0x3886('0x38')](_0x27d2ed['query'],_0x563f2b[_0x3886('0x31')]));if(_0x27d2ed[_0x3886('0x2f')][_0x3886('0x39')]){_0x4212cd[_0x3886('0x37')]=_[_0x3886('0x3a')](_0x4212cd[_0x3886('0x37')],{'$or':_['map'](_0x4212cd['attributes'],function(_0x5acaf4){var _0x19ebc2={};_0x19ebc2[_0x5acaf4]={'$like':'%'+_0x27d2ed[_0x3886('0x2f')]['filter']+'%'};return _0x19ebc2;})});}_0x4212cd=_[_0x3886('0x3a')]({},_0x4212cd,_0x27d2ed[_0x3886('0x45')]);return _0x4d9a[_0x3886('0x90')](_0x4212cd);}})[_0x3886('0x23')](function(_0x7757a3){if(_0x7757a3){_0xaa8f6a=_0x7757a3[_0x3886('0x34')];if(!_0x27d2ed[_0x3886('0x2f')]['hasOwnProperty'](_0x3886('0x5d'))){_0x4212cd[_0x3886('0x1a')]=qs[_0x3886('0x1a')](_0x27d2ed[_0x3886('0x2f')]['limit']);_0x4212cd[_0x3886('0x1b')]=qs[_0x3886('0x1b')](_0x27d2ed[_0x3886('0x2f')][_0x3886('0x1b')]);}return _0x4d9a[_0x3886('0x90')](_0x4212cd);}})['then'](function(_0x2cb4ef){if(_0x2cb4ef){return _0x2cb4ef?{'count':_0xaa8f6a,'rows':_0x2cb4ef}:null;}})[_0x3886('0x23')](respondWithResult(_0x27049d,null))[_0x3886('0x41')](handleError(_0x27049d,null));};exports[_0x3886('0x91')]=function(_0x498af3,_0x2c15ea,_0x3034e7){var _0x471b45,_0x7f7cb;var _0x5a611e=[];var _0x26574e=moment()[_0x3886('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x3886('0x3c')]['find']({'where':{'id':_0x498af3[_0x3886('0x43')]['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x2c15ea,null))[_0x3886('0x23')](function(_0x4cfc5b){if(_0x4cfc5b){_0x7f7cb=_0x4cfc5b;return _0x4cfc5b[_0x3886('0x91')](_0x498af3['body']['ids'],_['omit'](_0x498af3[_0x3886('0x47')],[_0x3886('0x67'),'id'])||{});}return null;})[_0x3886('0x92')](function(_0x12c3e1){var _0x5ec338;var _0x350af0;_0x471b45=_0x12c3e1||[];var _0x14c12d=[];if(_0x12c3e1){for(var _0x274dbd=0x0;_0x274dbd<_0x12c3e1[_0x3886('0x34')];_0x274dbd+=0x1){var _0x3aa560=_0x12c3e1[_0x274dbd][_0x3886('0x49')]({'plain':!![]});_0x5ec338=squel[_0x3886('0x7f')]()[_0x3886('0x6a')](_0x3886('0x93'))['fromQuery'](['phone','ContactId',_0x3886('0x6e'),_0x3886('0x5b'),_0x3886('0x55'),_0x3886('0x56')],squel['select']()['field'](_0x3886('0x6d'),_0x3886('0x6d'))[_0x3886('0x70')]('id','ContactId')[_0x3886('0x70')](_0x3aa560[_0x3886('0x78')]['toString'](),_0x3886('0x6e'))[_0x3886('0x70')](_0x498af3[_0x3886('0x43')]['id'][_0x3886('0x73')](),'CampaignId')[_0x3886('0x70')](_0x3886('0x71'),'createdAt')[_0x3886('0x70')]('NOW()',_0x3886('0x56'))[_0x3886('0x74')](_0x3886('0x75'))['where'](_0x3886('0x76'))[_0x3886('0x37')]('ListId\x20=\x20?',_0x3aa560[_0x3886('0x78')][_0x3886('0x73')]())[_0x3886('0x37')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x14c12d[_0x3886('0x94')](db[_0x3886('0x8d')][_0x3886('0x2f')](_0x5ec338));}return BPromise[_0x3886('0x8e')](_0x14c12d);}})[_0x3886('0x23')](function(){return _0x471b45;})[_0x3886('0x23')](respondWithResult(_0x2c15ea,null))[_0x3886('0x41')](handleError(_0x2c15ea,null));};exports['removeBlackLists']=function(_0xf3032c,_0x2d93d5,_0x44b920){return db[_0x3886('0x3c')][_0x3886('0x4e')]({'where':{'id':_0xf3032c[_0x3886('0x43')]['id']}})[_0x3886('0x23')](handleEntityNotFound(_0x2d93d5,null))[_0x3886('0x23')](function(_0x343a7e){if(_0x343a7e){return _0x343a7e[_0x3886('0x95')](_0xf3032c[_0x3886('0x2f')][_0x3886('0x67')]);}})[_0x3886('0x23')](function(_0x471fa6){if(_0x471fa6){return db[_0x3886('0x61')][_0x3886('0x24')]({'where':{'ListId':_0xf3032c[_0x3886('0x2f')][_0x3886('0x67')],'CampaignId':_0xf3032c['params']['id']}})[_0x3886('0x23')](function(){return _0x471fa6;});}})[_0x3886('0x23')](respondWithStatusCode(_0x2d93d5,null))['catch'](handleError(_0x2d93d5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 93091ca..72747f3 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1730e1,_0x81c0ea){var _0x2d3b5b=function(_0x2de0e7){while(--_0x2de0e7){_0x1730e1['push'](_0x1730e1['shift']());}};_0x2d3b5b(++_0x81c0ea);}(_0x7a54,0x106));var _0x47a5=function(_0x1c6658,_0x40b509){_0x1c6658=_0x1c6658-0x0;var _0x300971=_0x7a54[_0x1c6658];return _0x300971;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 5079682..32e38b1 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 _0x37b4=['stringify','error','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','options','attributes','include','map','model','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent'];(function(_0x231a02,_0x2a9e36){var _0x3ae533=function(_0xba726e){while(--_0xba726e){_0x231a02['push'](_0x231a02['shift']());}};_0x3ae533(++_0x2a9e36);}(_0x37b4,0xef));var _0x437b=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x37b4[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x437b('0x0'));var util=require('util');var moment=require(_0x437b('0x1'));var BPromise=require(_0x437b('0x2'));var rs=require(_0x437b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x437b('0x4'))['db'];var utils=require(_0x437b('0x5'));var logger=require(_0x437b('0x6'))(_0x437b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x437b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7dea,_0x4aada7,_0x226e3c){return new BPromise(function(_0x5df980,_0x432b63){return client['request'](_0x3c7dea,_0x226e3c)['then'](function(_0x44bf1d){logger[_0x437b('0x9')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'),JSON[_0x437b('0xb')](_0x44bf1d));if(_0x44bf1d[_0x437b('0xc')]){if(_0x44bf1d[_0x437b('0xc')]['code']===0x1f4){logger[_0x437b('0xc')](_0x437b('0xd'),_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x432b63(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}logger[_0x437b('0xc')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x5df980(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}else{logger[_0x437b('0x9')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));_0x5df980(_0x44bf1d[_0x437b('0xf')][_0x437b('0xe')]);}})[_0x437b('0x10')](function(_0x1d31af){logger[_0x437b('0xc')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x1d31af);_0x432b63(_0x1d31af);});});}exports[_0x437b('0x11')]=function(_0x501d8c){var _0x2b3994=this;return new Promise(function(_0x107024,_0x1c91bc){return db[_0x437b('0x12')]['findAll']({'raw':_0x501d8c['options']?_0x501d8c['options']['raw']===undefined?!![]:![]:!![],'where':_0x501d8c[_0x437b('0x13')]?_0x501d8c[_0x437b('0x13')]['where']||null:null,'attributes':_0x501d8c[_0x437b('0x13')]?_0x501d8c['options'][_0x437b('0x14')]||null:null,'limit':_0x501d8c[_0x437b('0x13')]?_0x501d8c[_0x437b('0x13')]['limit']||null:null,'include':_0x501d8c['options']?_0x501d8c['options'][_0x437b('0x15')]?_[_0x437b('0x16')](_0x501d8c[_0x437b('0x13')][_0x437b('0x15')],function(_0x8c5852){return{'model':db[_0x8c5852[_0x437b('0x17')]],'as':_0x8c5852['as'],'attributes':_0x8c5852[_0x437b('0x14')],'include':_0x8c5852[_0x437b('0x15')]?_[_0x437b('0x16')](_0x8c5852[_0x437b('0x15')],function(_0x258198){return{'model':db[_0x258198['model']],'as':_0x258198['as'],'attributes':_0x258198[_0x437b('0x14')],'include':_0x258198[_0x437b('0x15')]?_[_0x437b('0x16')](_0x258198[_0x437b('0x15')],function(_0x17092c){return{'model':db[_0x17092c['model']],'as':_0x17092c['as'],'attributes':_0x17092c[_0x437b('0x14')]};}):[]};}):[]};}):[]:[]})[_0x437b('0x18')](function(_0x4a7d0b){logger[_0x437b('0x9')]('GetCampaign',_0x501d8c);logger['debug']('GetCampaign',_0x501d8c,JSON[_0x437b('0xb')](_0x4a7d0b));_0x107024(_0x4a7d0b);})['catch'](function(_0x37a3d7){logger[_0x437b('0xc')](_0x437b('0x11'),_0x37a3d7['message'],_0x501d8c);_0x1c91bc(_0x2b3994['error'](0x1f4,_0x37a3d7[_0x437b('0xe')]));});});}; \ No newline at end of file +var _0x7dc2=['Campaign','findAll','options','raw','include','model','map','attributes','stringify','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetCampaign'];(function(_0x53aaf8,_0x863bcb){var _0x1fedb1=function(_0x5696f4){while(--_0x5696f4){_0x53aaf8['push'](_0x53aaf8['shift']());}};_0x1fedb1(++_0x863bcb);}(_0x7dc2,0x19d));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x27dc('0x0'));var BPromise=require(_0x27dc('0x1'));var rs=require(_0x27dc('0x2'));var fs=require('fs');var Redis=require(_0x27dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27dc('0x4'));var logger=require(_0x27dc('0x5'))('rpc');var config=require(_0x27dc('0x6'));var jayson=require(_0x27dc('0x7'));var client=jayson['client'][_0x27dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d2e10,_0x95bbb6,_0x3b3eee){return new BPromise(function(_0x5181ab,_0x45aa07){return client[_0x27dc('0x9')](_0x4d2e10,_0x3b3eee)[_0x27dc('0xa')](function(_0x242997){logger['info'](_0x27dc('0xb'),_0x95bbb6,'request\x20sent');logger[_0x27dc('0xc')](_0x27dc('0xd'),_0x95bbb6,_0x27dc('0xe'),JSON['stringify'](_0x242997));if(_0x242997['error']){if(_0x242997[_0x27dc('0xf')][_0x27dc('0x10')]===0x1f4){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x242997['error'][_0x27dc('0x11')]);return _0x45aa07(_0x242997['error'][_0x27dc('0x11')]);}logger['error'](_0x27dc('0xb'),_0x95bbb6,_0x242997[_0x27dc('0xf')][_0x27dc('0x11')]);return _0x5181ab(_0x242997[_0x27dc('0xf')]['message']);}else{logger[_0x27dc('0x12')](_0x27dc('0xb'),_0x95bbb6,_0x27dc('0xe'));_0x5181ab(_0x242997[_0x27dc('0x13')][_0x27dc('0x11')]);}})['catch'](function(_0x3ff8f8){logger[_0x27dc('0xf')](_0x27dc('0xb'),_0x95bbb6,_0x3ff8f8);_0x45aa07(_0x3ff8f8);});});}exports[_0x27dc('0x14')]=function(_0x5d308b){var _0x5ecb19=this;return new Promise(function(_0x1ff9a2,_0x225b2c){return db[_0x27dc('0x15')][_0x27dc('0x16')]({'raw':_0x5d308b[_0x27dc('0x17')]?_0x5d308b[_0x27dc('0x17')][_0x27dc('0x18')]===undefined?!![]:![]:!![],'where':_0x5d308b[_0x27dc('0x17')]?_0x5d308b[_0x27dc('0x17')]['where']||null:null,'attributes':_0x5d308b[_0x27dc('0x17')]?_0x5d308b[_0x27dc('0x17')]['attributes']||null:null,'limit':_0x5d308b[_0x27dc('0x17')]?_0x5d308b['options']['limit']||null:null,'include':_0x5d308b[_0x27dc('0x17')]?_0x5d308b['options'][_0x27dc('0x19')]?_['map'](_0x5d308b['options'][_0x27dc('0x19')],function(_0x4a9da0){return{'model':db[_0x4a9da0[_0x27dc('0x1a')]],'as':_0x4a9da0['as'],'attributes':_0x4a9da0['attributes'],'include':_0x4a9da0[_0x27dc('0x19')]?_[_0x27dc('0x1b')](_0x4a9da0[_0x27dc('0x19')],function(_0x19db16){return{'model':db[_0x19db16['model']],'as':_0x19db16['as'],'attributes':_0x19db16[_0x27dc('0x1c')],'include':_0x19db16['include']?_['map'](_0x19db16[_0x27dc('0x19')],function(_0x25bfb7){return{'model':db[_0x25bfb7['model']],'as':_0x25bfb7['as'],'attributes':_0x25bfb7[_0x27dc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x27dc('0xa')](function(_0x2ac84c){logger[_0x27dc('0x12')](_0x27dc('0x14'),_0x5d308b);logger[_0x27dc('0xc')](_0x27dc('0x14'),_0x5d308b,JSON[_0x27dc('0x1d')](_0x2ac84c));_0x1ff9a2(_0x2ac84c);})[_0x27dc('0x1e')](function(_0xb4e273){logger[_0x27dc('0xf')]('GetCampaign',_0xb4e273[_0x27dc('0x11')],_0x5d308b);_0x225b2c(_0x5ecb19[_0x27dc('0xf')](0x1f4,_0xb4e273['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 42fb499..1805905 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 _0xf185=['/:id/lists','getLists','/:id/blacklists','getBlackLists','/:id/clone','clone','post','addLists','addBlackLists','update','removeLists','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks'];(function(_0x32ce61,_0x2ba733){var _0x28eded=function(_0x34db11){while(--_0x34db11){_0x32ce61['push'](_0x32ce61['shift']());}};_0x28eded(++_0x2ba733);}(_0xf185,0x1be));var _0x5f18=function(_0x3cd774,_0x1c01b1){_0x3cd774=_0x3cd774-0x0;var _0x1f4922=_0xf185[_0x3cd774];return _0x1f4922;};'use strict';var multer=require(_0x5f18('0x0'));var util=require('util');var path=require(_0x5f18('0x1'));var timeout=require(_0x5f18('0x2'));var express=require(_0x5f18('0x3'));var router=express[_0x5f18('0x4')]();var fs_extra=require(_0x5f18('0x5'));var auth=require(_0x5f18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f18('0x7'));var controller=require(_0x5f18('0x8'));router[_0x5f18('0x9')]('/',auth[_0x5f18('0xa')](),controller['index']);router[_0x5f18('0x9')](_0x5f18('0xb'),auth['isAuthenticated'](),controller[_0x5f18('0xc')]);router['get'](_0x5f18('0xd'),auth[_0x5f18('0xa')](),controller['getHoppers']);router[_0x5f18('0x9')](_0x5f18('0xe'),auth['isAuthenticated'](),controller[_0x5f18('0xf')]);router[_0x5f18('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x5f18('0x10')]);router[_0x5f18('0x9')](_0x5f18('0x11'),auth['isAuthenticated'](),controller[_0x5f18('0x12')]);router[_0x5f18('0x9')](_0x5f18('0x13'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x14')]);router[_0x5f18('0x9')](_0x5f18('0x15'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x16')]);router['post']('/',auth[_0x5f18('0xa')](),controller['create']);router['post'](_0x5f18('0x17'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x18')]);router[_0x5f18('0x19')](_0x5f18('0x13'),auth['isAuthenticated'](),controller[_0x5f18('0x1a')]);router[_0x5f18('0x19')](_0x5f18('0x15'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x1b')]);router['put'](_0x5f18('0xb'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x1c')]);router['delete'](_0x5f18('0xb'),auth[_0x5f18('0xa')](),controller['destroy']);router['delete'](_0x5f18('0x13'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x1d')]);router[_0x5f18('0x1e')](_0x5f18('0x15'),auth[_0x5f18('0xa')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0xd200=['./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','post','/:id/clone','clone','addLists','update','destroy','delete','/:id/blacklists','removeBlackLists','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x33f1e8,_0x21c9bd){var _0x3176ae=function(_0x2e8cb7){while(--_0x2e8cb7){_0x33f1e8['push'](_0x33f1e8['shift']());}};_0x3176ae(++_0x21c9bd);}(_0xd200,0x7d));var _0x0d20=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xd200[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0d20('0x0'));var util=require(_0x0d20('0x1'));var path=require(_0x0d20('0x2'));var timeout=require(_0x0d20('0x3'));var express=require('express');var router=express[_0x0d20('0x4')]();var fs_extra=require(_0x0d20('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0d20('0x6'));var config=require('../../config/environment');var controller=require(_0x0d20('0x7'));router[_0x0d20('0x8')]('/',auth[_0x0d20('0x9')](),controller[_0x0d20('0xa')]);router[_0x0d20('0x8')](_0x0d20('0xb'),auth['isAuthenticated'](),controller[_0x0d20('0xc')]);router[_0x0d20('0x8')](_0x0d20('0xd'),auth[_0x0d20('0x9')](),controller[_0x0d20('0xe')]);router[_0x0d20('0x8')](_0x0d20('0xf'),auth[_0x0d20('0x9')](),controller[_0x0d20('0x10')]);router[_0x0d20('0x8')](_0x0d20('0x11'),auth[_0x0d20('0x9')](),controller[_0x0d20('0x12')]);router[_0x0d20('0x8')](_0x0d20('0x13'),auth[_0x0d20('0x9')](),controller[_0x0d20('0x14')]);router[_0x0d20('0x8')](_0x0d20('0x15'),auth[_0x0d20('0x9')](),controller[_0x0d20('0x16')]);router[_0x0d20('0x8')]('/:id/blacklists',auth[_0x0d20('0x9')](),controller['getBlackLists']);router[_0x0d20('0x17')]('/',auth[_0x0d20('0x9')](),controller['create']);router['post'](_0x0d20('0x18'),auth['isAuthenticated'](),controller[_0x0d20('0x19')]);router[_0x0d20('0x17')](_0x0d20('0x15'),auth[_0x0d20('0x9')](),controller[_0x0d20('0x1a')]);router['post']('/:id/blacklists',auth[_0x0d20('0x9')](),controller['addBlackLists']);router['put']('/:id',auth[_0x0d20('0x9')](),controller[_0x0d20('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0d20('0x1c')]);router[_0x0d20('0x1d')]('/:id/lists',auth['isAuthenticated'](),controller['removeLists']);router['delete'](_0x0d20('0x1e'),auth[_0x0d20('0x9')](),controller[_0x0d20('0x1f')]);module[_0x0d20('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 b784986..d8f804c 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 _0x98ee=['sequelize','exports','STRING','TEXT','VIRTUAL','key'];(function(_0x236fd6,_0x55fb7d){var _0x479e14=function(_0x7488ef){while(--_0x7488ef){_0x236fd6['push'](_0x236fd6['shift']());}};_0x479e14(++_0x55fb7d);}(_0x98ee,0x144));var _0xe98e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x98ee[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xe98e('0x0'));module[_0xe98e('0x1')]={'key':{'type':Sequelize[_0xe98e('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe98e('0x3')],'length':'medium','allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xe98e('0x4')],'get':function(){return this['getDataValue'](_0xe98e('0x5'));}}}; \ No newline at end of file +var _0x28fe=['key','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x28fe,0x151));var _0xe28f=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x28fe[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0xe28f('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0xe28f('0x1')],'length':_0xe28f('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xe28f('0x3')],'get':function(){return this[_0xe28f('0x4')](_0xe28f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index cf0ff41..ca42ae6 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 _0xb65b=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','then','include','findAll','rows','catch','params','CannedAnswer','rawAttributes','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb65b,0x1a1));var _0xbb65=function(_0x4acaee,_0x2a5f32){_0x4acaee=_0x4acaee-0x0;var _0x418cb3=_0xb65b[_0x4acaee];return _0x418cb3;};'use strict';var emlformat=require(_0xbb65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb65('0x1'));var jsonpatch=require(_0xbb65('0x2'));var rp=require(_0xbb65('0x3'));var moment=require(_0xbb65('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb65('0x5'));var util=require(_0xbb65('0x6'));var path=require(_0xbb65('0x7'));var sox=require(_0xbb65('0x8'));var csv=require(_0xbb65('0x9'));var ejs=require(_0xbb65('0xa'));var fs=require('fs');var fs_extra=require(_0xbb65('0xb'));var _=require(_0xbb65('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb65('0xd'));var deskjs=require(_0xbb65('0xe'));var toCsv=require(_0xbb65('0x9'));var querystring=require('querystring');var Papa=require(_0xbb65('0xf'));var Redis=require('ioredis');var authService=require(_0xbb65('0x10'));var qs=require(_0xbb65('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb65('0x12'));var logger=require(_0xbb65('0x13'))(_0xbb65('0x14'));var utils=require(_0xbb65('0x15'));var config=require(_0xbb65('0x16'));var licenseUtil=require(_0xbb65('0x17'));var db=require(_0xbb65('0x18'))['db'];function respondWithStatusCode(_0x4fe5b0,_0x19b33c){_0x19b33c=_0x19b33c||0xcc;return function(_0xbedf9c){if(_0xbedf9c){return _0x4fe5b0[_0xbb65('0x19')](_0x19b33c);}return _0x4fe5b0[_0xbb65('0x1a')](_0x19b33c)[_0xbb65('0x1b')]();};}function respondWithResult(_0x128d92,_0x36dae3){_0x36dae3=_0x36dae3||0xc8;return function(_0x2ede3f){if(_0x2ede3f){return _0x128d92[_0xbb65('0x1a')](_0x36dae3)[_0xbb65('0x1c')](_0x2ede3f);}};}function respondWithFilteredResult(_0x155859,_0x2b9e08){return function(_0xbd544a){if(_0xbd544a){var _0x4e0c59=typeof _0x2b9e08[_0xbb65('0x1d')]===_0xbb65('0x1e')&&typeof _0x2b9e08[_0xbb65('0x1f')]===_0xbb65('0x1e');var _0x55c18f=_0xbd544a[_0xbb65('0x20')];var _0x3a1994=_0x4e0c59?0x0:_0x2b9e08[_0xbb65('0x1d')];var _0x2fc420=_0x4e0c59?_0xbd544a[_0xbb65('0x20')]:_0x2b9e08[_0xbb65('0x1d')]+_0x2b9e08[_0xbb65('0x1f')];var _0x4c3439;if(_0x2fc420>=_0x55c18f){_0x2fc420=_0x55c18f;_0x4c3439=0xc8;}else{_0x4c3439=0xce;}_0x155859[_0xbb65('0x1a')](_0x4c3439);return _0x155859[_0xbb65('0x21')]('Content-Range',_0x3a1994+'-'+_0x2fc420+'/'+_0x55c18f)[_0xbb65('0x1c')](_0xbd544a);}return null;};}function patchUpdates(_0x486203){return function(_0x1e7708){try{jsonpatch['apply'](_0x1e7708,_0x486203,!![]);}catch(_0x5cf0c0){return BPromise[_0xbb65('0x22')](_0x5cf0c0);}return _0x1e7708[_0xbb65('0x23')]();};}function saveUpdates(_0x1d6653,_0x5580e5){return function(_0x1a93d3){if(_0x1a93d3){return _0x1a93d3[_0xbb65('0x24')](_0x1d6653)['then'](function(_0x5e274b){return _0x5e274b;});}return null;};}function removeEntity(_0x381390,_0x4032fb){return function(_0x427d14){if(_0x427d14){return _0x427d14[_0xbb65('0x25')]()['then'](function(){var _0xe37cee=_0x427d14[_0xbb65('0x26')]({'plain':!![]});var _0x4276ba=_0xbb65('0x27');return db[_0xbb65('0x28')][_0xbb65('0x25')]({'where':{'type':_0x4276ba,'resourceId':_0xe37cee['id']}})['then'](function(){return _0x427d14;});})['then'](function(){_0x381390['status'](0xcc)[_0xbb65('0x1b')]();});}};}function handleEntityNotFound(_0x53c926,_0x2359f2){return function(_0x55f2c5){if(!_0x55f2c5){_0x53c926[_0xbb65('0x19')](0x194);}return _0x55f2c5;};}function handleError(_0x42e90b,_0x4254ef){_0x4254ef=_0x4254ef||0x1f4;return function(_0x5867d3){logger[_0xbb65('0x29')](_0x5867d3['stack']);if(_0x5867d3['name']){delete _0x5867d3[_0xbb65('0x2a')];}_0x42e90b[_0xbb65('0x1a')](_0x4254ef)[_0xbb65('0x2b')](_0x5867d3);};}exports[_0xbb65('0x2c')]=function(_0x3d0944,_0x3e4bf9){var _0xdbd450={},_0x53ca66={},_0x3222cf={'count':0x0,'rows':[]};var _0x58825c=_[_0xbb65('0x2d')](db['CannedAnswer']['rawAttributes'],function(_0x44d4d3){return{'name':_0x44d4d3[_0xbb65('0x2e')],'type':_0x44d4d3[_0xbb65('0x2f')][_0xbb65('0x30')]};});_0x53ca66[_0xbb65('0x31')]=_[_0xbb65('0x2d')](_0x58825c,_0xbb65('0x2a'));_0x53ca66['query']=_[_0xbb65('0x32')](_0x3d0944[_0xbb65('0x33')]);_0x53ca66['filters']=_[_0xbb65('0x34')](_0x53ca66[_0xbb65('0x31')],_0x53ca66[_0xbb65('0x33')]);_0xdbd450['attributes']=_[_0xbb65('0x34')](_0x53ca66[_0xbb65('0x31')],qs[_0xbb65('0x35')](_0x3d0944[_0xbb65('0x33')]['fields']));_0xdbd450['attributes']=_0xdbd450[_0xbb65('0x36')][_0xbb65('0x37')]?_0xdbd450['attributes']:_0x53ca66['model'];if(!_0x3d0944[_0xbb65('0x33')][_0xbb65('0x38')](_0xbb65('0x39'))){_0xdbd450[_0xbb65('0x1f')]=qs[_0xbb65('0x1f')](_0x3d0944[_0xbb65('0x33')]['limit']);_0xdbd450[_0xbb65('0x1d')]=qs[_0xbb65('0x1d')](_0x3d0944[_0xbb65('0x33')][_0xbb65('0x1d')]);}_0xdbd450['order']=qs[_0xbb65('0x3a')](_0x3d0944[_0xbb65('0x33')][_0xbb65('0x3a')]);_0xdbd450[_0xbb65('0x3b')]=qs['filters'](_[_0xbb65('0x3c')](_0x3d0944[_0xbb65('0x33')],_0x53ca66[_0xbb65('0x3d')]),_0x58825c);if(_0x3d0944['query'][_0xbb65('0x3e')]){_0xdbd450[_0xbb65('0x3b')]=_[_0xbb65('0x3f')](_0xdbd450[_0xbb65('0x3b')],{'$or':[{'key':{'$like':'%'+_0x3d0944['query'][_0xbb65('0x3e')]+'%'}},{'value':{'$like':'%'+_0x3d0944['query'][_0xbb65('0x3e')]+'%'}}]});}_0xdbd450=_[_0xbb65('0x3f')]({},_0xdbd450,_0x3d0944[_0xbb65('0x40')]);var _0x18627a={'where':_0xdbd450['where']};return db['CannedAnswer']['count'](_0x18627a)[_0xbb65('0x41')](function(_0x350d7e){_0x3222cf[_0xbb65('0x20')]=_0x350d7e;if(_0x3d0944[_0xbb65('0x33')]['includeAll']){_0xdbd450[_0xbb65('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbb65('0x43')](_0xdbd450);})['then'](function(_0x5aacd5){_0x3222cf[_0xbb65('0x44')]=_0x5aacd5;return _0x3222cf;})['then'](respondWithFilteredResult(_0x3e4bf9,_0xdbd450))[_0xbb65('0x45')](handleError(_0x3e4bf9,null));};exports['show']=function(_0x28bc05,_0x353d0e){var _0x3a72c8={'raw':!![],'where':{'id':_0x28bc05[_0xbb65('0x46')]['id']}},_0x2d4c1c={};_0x2d4c1c[_0xbb65('0x31')]=_['keys'](db[_0xbb65('0x47')][_0xbb65('0x48')]);_0x2d4c1c[_0xbb65('0x33')]=_[_0xbb65('0x32')](_0x28bc05[_0xbb65('0x33')]);_0x2d4c1c[_0xbb65('0x3d')]=_[_0xbb65('0x34')](_0x2d4c1c[_0xbb65('0x31')],_0x2d4c1c[_0xbb65('0x33')]);_0x3a72c8[_0xbb65('0x36')]=_['intersection'](_0x2d4c1c[_0xbb65('0x31')],qs[_0xbb65('0x35')](_0x28bc05[_0xbb65('0x33')][_0xbb65('0x35')]));_0x3a72c8['attributes']=_0x3a72c8['attributes'][_0xbb65('0x37')]?_0x3a72c8['attributes']:_0x2d4c1c['model'];if(_0x28bc05[_0xbb65('0x33')][_0xbb65('0x49')]){_0x3a72c8[_0xbb65('0x42')]=[{'all':!![]}];}_0x3a72c8=_[_0xbb65('0x3f')]({},_0x3a72c8,_0x28bc05[_0xbb65('0x40')]);return db[_0xbb65('0x47')][_0xbb65('0x4a')](_0x3a72c8)['then'](handleEntityNotFound(_0x353d0e,null))[_0xbb65('0x41')](respondWithResult(_0x353d0e,null))[_0xbb65('0x45')](handleError(_0x353d0e,null));};exports[_0xbb65('0x24')]=function(_0x371f08,_0x1b7f37){if(_0x371f08[_0xbb65('0x4b')]['id']){delete _0x371f08[_0xbb65('0x4b')]['id'];}return db[_0xbb65('0x47')]['find']({'where':{'id':_0x371f08['params']['id']}})[_0xbb65('0x41')](handleEntityNotFound(_0x1b7f37,null))[_0xbb65('0x41')](saveUpdates(_0x371f08[_0xbb65('0x4b')],null))[_0xbb65('0x41')](respondWithResult(_0x1b7f37,null))[_0xbb65('0x45')](handleError(_0x1b7f37,null));};exports[_0xbb65('0x25')]=function(_0x54f852,_0xd1b1bd){return db[_0xbb65('0x47')][_0xbb65('0x4a')]({'where':{'id':_0x54f852[_0xbb65('0x46')]['id']}})['then'](handleEntityNotFound(_0xd1b1bd,null))[_0xbb65('0x41')](removeEntity(_0xd1b1bd,null))[_0xbb65('0x45')](handleError(_0xd1b1bd,null));};exports[_0xbb65('0x4c')]=function(_0x1a0245,_0x4da031){var _0xa45a9f={'key':_0x1a0245[_0xbb65('0x4b')][_0xbb65('0x30')]};if(_0x1a0245['body']['MailAccountId']){_0xa45a9f[_0xbb65('0x4d')]=_0x1a0245['body'][_0xbb65('0x4d')];}else if(_0x1a0245['body'][_0xbb65('0x4e')]){_0xa45a9f[_0xbb65('0x4e')]=_0x1a0245['body']['SmsAccountId'];}else if(_0x1a0245['body'][_0xbb65('0x4f')]){_0xa45a9f[_0xbb65('0x4f')]=_0x1a0245['body'][_0xbb65('0x4f')];}else if(_0x1a0245[_0xbb65('0x4b')][_0xbb65('0x50')]){_0xa45a9f[_0xbb65('0x50')]=_0x1a0245[_0xbb65('0x4b')][_0xbb65('0x50')];}return db['CannedAnswer']['find']({'where':_0xa45a9f})[_0xbb65('0x41')](function(_0x41ca28){if(_0x41ca28){throw new db['Sequelize']['ValidationError'](_0xbb65('0x51'));}return db[_0xbb65('0x47')][_0xbb65('0x4c')](_0x1a0245[_0xbb65('0x4b')]);})[_0xbb65('0x41')](function(_0x11467c){var _0x1b619f=_0x1a0245[_0xbb65('0x52')][_0xbb65('0x26')]({'plain':!![]});if(!_0x1b619f)throw new Error(_0xbb65('0x53'));if(_0x1b619f[_0xbb65('0x54')]===_0xbb65('0x52')){var _0x7213ee=_0x11467c[_0xbb65('0x26')]({'plain':!![]});return db[_0xbb65('0x55')]['find']({'where':{'name':_0xbb65('0x27'),'userProfileId':_0x1b619f[_0xbb65('0x56')]},'raw':!![]})[_0xbb65('0x41')](function(_0x2b085e){if(_0x2b085e&&_0x2b085e['autoAssociation']===0x0){return db[_0xbb65('0x28')]['create']({'name':_0x7213ee[_0xbb65('0x2a')],'resourceId':_0x7213ee['id'],'type':_0x2b085e['name'],'sectionId':_0x2b085e['id']},{})[_0xbb65('0x41')](function(){return _0x11467c;});}else{return _0x11467c;}})[_0xbb65('0x45')](function(_0x3e2051){logger[_0xbb65('0x29')](_0xbb65('0x57'),_0x3e2051);throw _0x3e2051;});}return _0x11467c;})[_0xbb65('0x41')](respondWithResult(_0x4da031,0xc9))[_0xbb65('0x45')](handleError(_0x4da031,null));}; \ No newline at end of file +var _0xdb0a=['MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','create'];(function(_0x4b1475,_0x2912a3){var _0x3457d0=function(_0x15276b){while(--_0x15276b){_0x4b1475['push'](_0x4b1475['shift']());}};_0x3457d0(++_0x2912a3);}(_0xdb0a,0xcd));var _0xadb0=function(_0x5a5bd4,_0x473f27){_0x5a5bd4=_0x5a5bd4-0x0;var _0x45c150=_0xdb0a[_0x5a5bd4];return _0x45c150;};'use strict';var emlformat=require(_0xadb0('0x0'));var rimraf=require(_0xadb0('0x1'));var zipdir=require(_0xadb0('0x2'));var jsonpatch=require(_0xadb0('0x3'));var rp=require(_0xadb0('0x4'));var moment=require(_0xadb0('0x5'));var BPromise=require(_0xadb0('0x6'));var Mustache=require(_0xadb0('0x7'));var util=require(_0xadb0('0x8'));var path=require('path');var sox=require(_0xadb0('0x9'));var csv=require(_0xadb0('0xa'));var ejs=require(_0xadb0('0xb'));var fs=require('fs');var fs_extra=require(_0xadb0('0xc'));var _=require(_0xadb0('0xd'));var squel=require(_0xadb0('0xe'));var crypto=require('crypto');var jsforce=require(_0xadb0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xadb0('0xa'));var querystring=require('querystring');var Papa=require(_0xadb0('0x10'));var Redis=require(_0xadb0('0x11'));var authService=require(_0xadb0('0x12'));var qs=require(_0xadb0('0x13'));var as=require(_0xadb0('0x14'));var hardwareService=require(_0xadb0('0x15'));var logger=require(_0xadb0('0x16'))(_0xadb0('0x17'));var utils=require(_0xadb0('0x18'));var config=require(_0xadb0('0x19'));var licenseUtil=require(_0xadb0('0x1a'));var db=require(_0xadb0('0x1b'))['db'];function respondWithStatusCode(_0x241d3f,_0x274abb){_0x274abb=_0x274abb||0xcc;return function(_0x630af0){if(_0x630af0){return _0x241d3f[_0xadb0('0x1c')](_0x274abb);}return _0x241d3f[_0xadb0('0x1d')](_0x274abb)[_0xadb0('0x1e')]();};}function respondWithResult(_0x1d20c2,_0x1b107e){_0x1b107e=_0x1b107e||0xc8;return function(_0x2ad1f0){if(_0x2ad1f0){return _0x1d20c2[_0xadb0('0x1d')](_0x1b107e)[_0xadb0('0x1f')](_0x2ad1f0);}};}function respondWithFilteredResult(_0x18492f,_0x529e8d){return function(_0x11b015){if(_0x11b015){var _0x156ac6=typeof _0x529e8d[_0xadb0('0x20')]===_0xadb0('0x21')&&typeof _0x529e8d[_0xadb0('0x22')]===_0xadb0('0x21');var _0x4d1b1f=_0x11b015[_0xadb0('0x23')];var _0x126534=_0x156ac6?0x0:_0x529e8d['offset'];var _0x162e1e=_0x156ac6?_0x11b015['count']:_0x529e8d['offset']+_0x529e8d[_0xadb0('0x22')];var _0x3a8aea;if(_0x162e1e>=_0x4d1b1f){_0x162e1e=_0x4d1b1f;_0x3a8aea=0xc8;}else{_0x3a8aea=0xce;}_0x18492f[_0xadb0('0x1d')](_0x3a8aea);return _0x18492f[_0xadb0('0x24')](_0xadb0('0x25'),_0x126534+'-'+_0x162e1e+'/'+_0x4d1b1f)[_0xadb0('0x1f')](_0x11b015);}return null;};}function patchUpdates(_0x53729f){return function(_0xa2578a){try{jsonpatch[_0xadb0('0x26')](_0xa2578a,_0x53729f,!![]);}catch(_0x362ae3){return BPromise[_0xadb0('0x27')](_0x362ae3);}return _0xa2578a[_0xadb0('0x28')]();};}function saveUpdates(_0x127be7,_0x14df58){return function(_0x27c8f0){if(_0x27c8f0){return _0x27c8f0[_0xadb0('0x29')](_0x127be7)['then'](function(_0x2b96cb){return _0x2b96cb;});}return null;};}function removeEntity(_0x444363,_0x47ea54){return function(_0x7f8c4){if(_0x7f8c4){return _0x7f8c4[_0xadb0('0x2a')]()[_0xadb0('0x2b')](function(){var _0x515828=_0x7f8c4['get']({'plain':!![]});var _0x5266de=_0xadb0('0x2c');return db[_0xadb0('0x2d')][_0xadb0('0x2a')]({'where':{'type':_0x5266de,'resourceId':_0x515828['id']}})['then'](function(){return _0x7f8c4;});})[_0xadb0('0x2b')](function(){_0x444363[_0xadb0('0x1d')](0xcc)[_0xadb0('0x1e')]();});}};}function handleEntityNotFound(_0x5a329d,_0x54649){return function(_0x341580){if(!_0x341580){_0x5a329d[_0xadb0('0x1c')](0x194);}return _0x341580;};}function handleError(_0x4e71f3,_0x418f45){_0x418f45=_0x418f45||0x1f4;return function(_0x55cf35){logger[_0xadb0('0x2e')](_0x55cf35[_0xadb0('0x2f')]);if(_0x55cf35['name']){delete _0x55cf35[_0xadb0('0x30')];}_0x4e71f3[_0xadb0('0x1d')](_0x418f45)[_0xadb0('0x31')](_0x55cf35);};}exports[_0xadb0('0x32')]=function(_0x5543e3,_0x2044b4){var _0x109f81={},_0x37dc22={},_0x45754b={'count':0x0,'rows':[]};var _0x13efc5=_[_0xadb0('0x33')](db[_0xadb0('0x34')]['rawAttributes'],function(_0x59a581){return{'name':_0x59a581[_0xadb0('0x35')],'type':_0x59a581[_0xadb0('0x36')][_0xadb0('0x37')]};});_0x37dc22[_0xadb0('0x38')]=_['map'](_0x13efc5,_0xadb0('0x30'));_0x37dc22['query']=_[_0xadb0('0x39')](_0x5543e3[_0xadb0('0x3a')]);_0x37dc22[_0xadb0('0x3b')]=_[_0xadb0('0x3c')](_0x37dc22[_0xadb0('0x38')],_0x37dc22[_0xadb0('0x3a')]);_0x109f81[_0xadb0('0x3d')]=_[_0xadb0('0x3c')](_0x37dc22[_0xadb0('0x38')],qs['fields'](_0x5543e3[_0xadb0('0x3a')][_0xadb0('0x3e')]));_0x109f81[_0xadb0('0x3d')]=_0x109f81['attributes'][_0xadb0('0x3f')]?_0x109f81[_0xadb0('0x3d')]:_0x37dc22[_0xadb0('0x38')];if(!_0x5543e3[_0xadb0('0x3a')][_0xadb0('0x40')](_0xadb0('0x41'))){_0x109f81['limit']=qs[_0xadb0('0x22')](_0x5543e3[_0xadb0('0x3a')][_0xadb0('0x22')]);_0x109f81['offset']=qs[_0xadb0('0x20')](_0x5543e3['query'][_0xadb0('0x20')]);}_0x109f81['order']=qs[_0xadb0('0x42')](_0x5543e3[_0xadb0('0x3a')][_0xadb0('0x42')]);_0x109f81['where']=qs[_0xadb0('0x3b')](_[_0xadb0('0x43')](_0x5543e3[_0xadb0('0x3a')],_0x37dc22[_0xadb0('0x3b')]),_0x13efc5);if(_0x5543e3[_0xadb0('0x3a')][_0xadb0('0x44')]){_0x109f81[_0xadb0('0x45')]=_[_0xadb0('0x46')](_0x109f81[_0xadb0('0x45')],{'$or':[{'key':{'$like':'%'+_0x5543e3[_0xadb0('0x3a')][_0xadb0('0x44')]+'%'}},{'value':{'$like':'%'+_0x5543e3[_0xadb0('0x3a')][_0xadb0('0x44')]+'%'}}]});}_0x109f81=_['merge']({},_0x109f81,_0x5543e3[_0xadb0('0x47')]);var _0x116b8d={'where':_0x109f81[_0xadb0('0x45')]};return db[_0xadb0('0x34')]['count'](_0x116b8d)[_0xadb0('0x2b')](function(_0x20f5ff){_0x45754b['count']=_0x20f5ff;if(_0x5543e3[_0xadb0('0x3a')]['includeAll']){_0x109f81[_0xadb0('0x48')]=[{'all':!![]}];}return db[_0xadb0('0x34')][_0xadb0('0x49')](_0x109f81);})[_0xadb0('0x2b')](function(_0x5d52bf){_0x45754b[_0xadb0('0x4a')]=_0x5d52bf;return _0x45754b;})[_0xadb0('0x2b')](respondWithFilteredResult(_0x2044b4,_0x109f81))[_0xadb0('0x4b')](handleError(_0x2044b4,null));};exports[_0xadb0('0x4c')]=function(_0x51843f,_0x53d611){var _0x570db8={'raw':!![],'where':{'id':_0x51843f[_0xadb0('0x4d')]['id']}},_0x1561c4={};_0x1561c4[_0xadb0('0x38')]=_[_0xadb0('0x39')](db[_0xadb0('0x34')][_0xadb0('0x4e')]);_0x1561c4[_0xadb0('0x3a')]=_['keys'](_0x51843f[_0xadb0('0x3a')]);_0x1561c4[_0xadb0('0x3b')]=_[_0xadb0('0x3c')](_0x1561c4[_0xadb0('0x38')],_0x1561c4[_0xadb0('0x3a')]);_0x570db8['attributes']=_[_0xadb0('0x3c')](_0x1561c4[_0xadb0('0x38')],qs[_0xadb0('0x3e')](_0x51843f[_0xadb0('0x3a')][_0xadb0('0x3e')]));_0x570db8[_0xadb0('0x3d')]=_0x570db8[_0xadb0('0x3d')][_0xadb0('0x3f')]?_0x570db8['attributes']:_0x1561c4[_0xadb0('0x38')];if(_0x51843f[_0xadb0('0x3a')][_0xadb0('0x4f')]){_0x570db8[_0xadb0('0x48')]=[{'all':!![]}];}_0x570db8=_[_0xadb0('0x46')]({},_0x570db8,_0x51843f[_0xadb0('0x47')]);return db[_0xadb0('0x34')][_0xadb0('0x50')](_0x570db8)[_0xadb0('0x2b')](handleEntityNotFound(_0x53d611,null))[_0xadb0('0x2b')](respondWithResult(_0x53d611,null))[_0xadb0('0x4b')](handleError(_0x53d611,null));};exports[_0xadb0('0x29')]=function(_0xa9c733,_0x2cb190){if(_0xa9c733['body']['id']){delete _0xa9c733[_0xadb0('0x51')]['id'];}return db[_0xadb0('0x34')][_0xadb0('0x50')]({'where':{'id':_0xa9c733['params']['id']}})[_0xadb0('0x2b')](handleEntityNotFound(_0x2cb190,null))[_0xadb0('0x2b')](saveUpdates(_0xa9c733[_0xadb0('0x51')],null))['then'](respondWithResult(_0x2cb190,null))[_0xadb0('0x4b')](handleError(_0x2cb190,null));};exports['destroy']=function(_0x33484b,_0x5db5cf){return db[_0xadb0('0x34')]['find']({'where':{'id':_0x33484b[_0xadb0('0x4d')]['id']}})[_0xadb0('0x2b')](handleEntityNotFound(_0x5db5cf,null))['then'](removeEntity(_0x5db5cf,null))['catch'](handleError(_0x5db5cf,null));};exports[_0xadb0('0x52')]=function(_0x4fb8c7,_0x179a60){var _0x54c548={'key':_0x4fb8c7[_0xadb0('0x51')][_0xadb0('0x37')]};if(_0x4fb8c7[_0xadb0('0x51')]['MailAccountId']){_0x54c548[_0xadb0('0x53')]=_0x4fb8c7[_0xadb0('0x51')][_0xadb0('0x53')];}else if(_0x4fb8c7[_0xadb0('0x51')][_0xadb0('0x54')]){_0x54c548[_0xadb0('0x54')]=_0x4fb8c7['body'][_0xadb0('0x54')];}else if(_0x4fb8c7[_0xadb0('0x51')][_0xadb0('0x55')]){_0x54c548['OpenchannelAccountId']=_0x4fb8c7['body'][_0xadb0('0x55')];}else if(_0x4fb8c7[_0xadb0('0x51')][_0xadb0('0x56')]){_0x54c548[_0xadb0('0x56')]=_0x4fb8c7['body'][_0xadb0('0x56')];}return db[_0xadb0('0x34')]['find']({'where':_0x54c548})[_0xadb0('0x2b')](function(_0xb3b9b9){if(_0xb3b9b9){throw new db[(_0xadb0('0x57'))][(_0xadb0('0x58'))](_0xadb0('0x59'));}return db[_0xadb0('0x34')][_0xadb0('0x52')](_0x4fb8c7['body']);})[_0xadb0('0x2b')](function(_0x163c88){var _0x2da7f0=_0x4fb8c7[_0xadb0('0x5a')][_0xadb0('0x5b')]({'plain':!![]});if(!_0x2da7f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2da7f0[_0xadb0('0x5c')]===_0xadb0('0x5a')){var _0x3044c3=_0x163c88[_0xadb0('0x5b')]({'plain':!![]});return db[_0xadb0('0x5d')]['find']({'where':{'name':_0xadb0('0x2c'),'userProfileId':_0x2da7f0[_0xadb0('0x5e')]},'raw':!![]})['then'](function(_0x1615d6){if(_0x1615d6&&_0x1615d6[_0xadb0('0x5f')]===0x0){return db[_0xadb0('0x2d')]['create']({'name':_0x3044c3[_0xadb0('0x30')],'resourceId':_0x3044c3['id'],'type':_0x1615d6['name'],'sectionId':_0x1615d6['id']},{})['then'](function(){return _0x163c88;});}else{return _0x163c88;}})['catch'](function(_0x5556d2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5556d2);throw _0x5556d2;});}return _0x163c88;})['then'](respondWithResult(_0x179a60,0xc9))[_0xadb0('0x4b')](handleError(_0x179a60,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 55f7776..f7268d7 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 _0x8ca9=['rimraf','exports','tools_canned_answers','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0x8ca9,0x1a1));var _0x98ca=function(_0x2b9972,_0x3a8d75){_0x2b9972=_0x2b9972-0x0;var _0x299e8b=_0x8ca9[_0x2b9972];return _0x299e8b;};'use strict';var _=require(_0x98ca('0x0'));var util=require('util');var logger=require(_0x98ca('0x1'))(_0x98ca('0x2'));var moment=require('moment');var BPromise=require(_0x98ca('0x3'));var rp=require(_0x98ca('0x4'));var fs=require('fs');var path=require(_0x98ca('0x5'));var rimraf=require(_0x98ca('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x98ca('0x7')]=function(_0x51c890,_0x2e5f12){return _0x51c890['define']('CannedAnswer',attributes,{'tableName':_0x98ca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa3e1=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','CannedAnswer'];(function(_0x3b83f3,_0x8488b){var _0x146b69=function(_0x58a93d){while(--_0x58a93d){_0x3b83f3['push'](_0x3b83f3['shift']());}};_0x146b69(++_0x8488b);}(_0xa3e1,0x13b));var _0x1a3e=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0xa3e1[_0x27b423];return _0x5c11b8;};'use strict';var _=require('lodash');var util=require(_0x1a3e('0x0'));var logger=require(_0x1a3e('0x1'))(_0x1a3e('0x2'));var moment=require(_0x1a3e('0x3'));var BPromise=require(_0x1a3e('0x4'));var rp=require(_0x1a3e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a3e('0x6'));var config=require(_0x1a3e('0x7'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x4cbdc5,_0x3f5ce8){return _0x4cbdc5[_0x1a3e('0x8')](_0x1a3e('0x9'),attributes,{'tableName':_0x1a3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a3e('0xb'),'collate':_0x1a3e('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 3d6febb..b2aefa9 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(_0x2e7efa,_0x27499d){var _0x47c46f=function(_0x1812ee){while(--_0x1812ee){_0x2e7efa['push'](_0x2e7efa['shift']());}};_0x47c46f(++_0x27499d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x3dd346,_0x30eb12){var _0x58f64c=function(_0x52a7ce){while(--_0x52a7ce){_0x3dd346['push'](_0x3dd346['shift']());}};_0x58f64c(++_0x30eb12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index c28235d..dbd85f3 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 _0x1c9e=['create','put','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x1c9e,0x72));var _0xe1c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c9e[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xe1c9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe1c9('0x1'));var express=require(_0xe1c9('0x2'));var router=express[_0xe1c9('0x3')]();var fs_extra=require(_0xe1c9('0x4'));var auth=require(_0xe1c9('0x5'));var interaction=require(_0xe1c9('0x6'));var config=require(_0xe1c9('0x7'));var controller=require('./cannedAnswer.controller');router[_0xe1c9('0x8')]('/',auth[_0xe1c9('0x9')](),controller[_0xe1c9('0xa')]);router[_0xe1c9('0x8')]('/:id',auth[_0xe1c9('0x9')](),controller['show']);router[_0xe1c9('0xb')]('/',auth[_0xe1c9('0x9')](),controller[_0xe1c9('0xc')]);router[_0xe1c9('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe1c9('0xe')](_0xe1c9('0xf'),auth[_0xe1c9('0x9')](),controller[_0xe1c9('0x10')]);module[_0xe1c9('0x11')]=router; \ No newline at end of file +var _0xd6d6=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xd6d6,0x184));var _0x6d6d=function(_0x372594,_0x4953cf){_0x372594=_0x372594-0x0;var _0x539748=_0xd6d6[_0x372594];return _0x539748;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require('connect-timeout');var express=require(_0x6d6d('0x3'));var router=express[_0x6d6d('0x4')]();var fs_extra=require(_0x6d6d('0x5'));var auth=require(_0x6d6d('0x6'));var interaction=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var controller=require(_0x6d6d('0x9'));router[_0x6d6d('0xa')]('/',auth[_0x6d6d('0xb')](),controller[_0x6d6d('0xc')]);router[_0x6d6d('0xa')](_0x6d6d('0xd'),auth[_0x6d6d('0xb')](),controller[_0x6d6d('0xe')]);router[_0x6d6d('0xf')]('/',auth[_0x6d6d('0xb')](),controller[_0x6d6d('0x10')]);router[_0x6d6d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6d6d('0x12')]);router['delete'](_0x6d6d('0xd'),auth[_0x6d6d('0xb')](),controller[_0x6d6d('0x13')]);module[_0x6d6d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d72bd4b..ee11b28 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 _0x3c8c=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x3832b8,_0x4491cf){var _0x4b383a=function(_0x27ac30){while(--_0x27ac30){_0x3832b8['push'](_0x3832b8['shift']());}};_0x4b383a(++_0x4491cf);}(_0x3c8c,0xb0));var _0xc3c8=function(_0x122a4a,_0x47d80f){_0x122a4a=_0x122a4a-0x0;var _0x38004a=_0x3c8c[_0x122a4a];return _0x38004a;};'use strict';var Sequelize=require(_0xc3c8('0x0'));module[_0xc3c8('0x1')]={'calldate':{'type':Sequelize[_0xc3c8('0x2')],'allowNull':![],'defaultValue':_0xc3c8('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xc3c8('0x4')]},'dst':{'type':Sequelize[_0xc3c8('0x4')]},'dcontext':{'type':Sequelize[_0xc3c8('0x4')]},'channel':{'type':Sequelize[_0xc3c8('0x4')]},'dstchannel':{'type':Sequelize[_0xc3c8('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc3c8('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc3c8('0x4')]},'amaflags':{'type':Sequelize[_0xc3c8('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xc3c8('0x4')]},'uniqueid':{'type':Sequelize[_0xc3c8('0x4')]},'linkedid':{'type':Sequelize[_0xc3c8('0x4')]},'sequence':{'type':Sequelize[_0xc3c8('0x4')]},'peeraccount':{'type':Sequelize[_0xc3c8('0x4')]},'type':{'type':Sequelize[_0xc3c8('0x4')]},'tag':{'type':Sequelize[_0xc3c8('0x4')]}}; \ No newline at end of file +var _0xa047=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xa047,0x1c5));var _0x7a04=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0xa047[_0x1558ab];return _0x53b64a;};'use strict';var Sequelize=require(_0x7a04('0x0'));module[_0x7a04('0x1')]={'calldate':{'type':Sequelize[_0x7a04('0x2')],'allowNull':![],'defaultValue':_0x7a04('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x7a04('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x7a04('0x4')]},'channel':{'type':Sequelize[_0x7a04('0x4')]},'dstchannel':{'type':Sequelize[_0x7a04('0x4')]},'lastapp':{'type':Sequelize[_0x7a04('0x4')]},'lastdata':{'type':Sequelize[_0x7a04('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7a04('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7a04('0x4')]},'amaflags':{'type':Sequelize[_0x7a04('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x7a04('0x4')]},'uniqueid':{'type':Sequelize[_0x7a04('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x7a04('0x4')]},'peeraccount':{'type':Sequelize[_0x7a04('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x7a04('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index ec3f931..a1ca3db 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 _0xb647=['bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','sendStatus','name','send','index','Cdr','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xab766d,_0x607780){var _0x1b57fd=function(_0x22cfeb){while(--_0x22cfeb){_0xab766d['push'](_0xab766d['shift']());}};_0x1b57fd(++_0x607780);}(_0xb647,0xdb));var _0x7b64=function(_0x52c309,_0x52db5e){_0x52c309=_0x52c309-0x0;var _0x1b67ec=_0xb647[_0x52c309];return _0x1b67ec;};'use strict';var emlformat=require(_0x7b64('0x0'));var rimraf=require(_0x7b64('0x1'));var zipdir=require(_0x7b64('0x2'));var jsonpatch=require(_0x7b64('0x3'));var rp=require(_0x7b64('0x4'));var moment=require(_0x7b64('0x5'));var BPromise=require(_0x7b64('0x6'));var Mustache=require(_0x7b64('0x7'));var util=require('util');var path=require(_0x7b64('0x8'));var sox=require('sox');var csv=require(_0x7b64('0x9'));var ejs=require(_0x7b64('0xa'));var fs=require('fs');var fs_extra=require(_0x7b64('0xb'));var _=require(_0x7b64('0xc'));var squel=require(_0x7b64('0xd'));var crypto=require(_0x7b64('0xe'));var jsforce=require(_0x7b64('0xf'));var deskjs=require(_0x7b64('0x10'));var toCsv=require(_0x7b64('0x9'));var querystring=require('querystring');var Papa=require(_0x7b64('0x11'));var Redis=require('ioredis');var authService=require(_0x7b64('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b64('0x13'));var logger=require(_0x7b64('0x14'))('api');var utils=require(_0x7b64('0x15'));var config=require(_0x7b64('0x16'));var licenseUtil=require(_0x7b64('0x17'));var db=require(_0x7b64('0x18'))['db'];function respondWithStatusCode(_0x25e135,_0x432626){_0x432626=_0x432626||0xcc;return function(_0x5ea1dd){if(_0x5ea1dd){return _0x25e135['sendStatus'](_0x432626);}return _0x25e135[_0x7b64('0x19')](_0x432626)['end']();};}function respondWithResult(_0x530938,_0x2f21d8){_0x2f21d8=_0x2f21d8||0xc8;return function(_0x29a596){if(_0x29a596){return _0x530938[_0x7b64('0x19')](_0x2f21d8)[_0x7b64('0x1a')](_0x29a596);}};}function respondWithFilteredResult(_0x33ebe7,_0x437ddc){return function(_0x306a4e){if(_0x306a4e){var _0x519316=typeof _0x437ddc[_0x7b64('0x1b')]===_0x7b64('0x1c')&&typeof _0x437ddc[_0x7b64('0x1d')]===_0x7b64('0x1c');var _0x157c03=_0x306a4e['count'];var _0x3935c3=_0x519316?0x0:_0x437ddc[_0x7b64('0x1b')];var _0x58517e=_0x519316?_0x306a4e[_0x7b64('0x1e')]:_0x437ddc[_0x7b64('0x1b')]+_0x437ddc['limit'];var _0x23845e;if(_0x58517e>=_0x157c03){_0x58517e=_0x157c03;_0x23845e=0xc8;}else{_0x23845e=0xce;}_0x33ebe7[_0x7b64('0x19')](_0x23845e);return _0x33ebe7[_0x7b64('0x1f')](_0x7b64('0x20'),_0x3935c3+'-'+_0x58517e+'/'+_0x157c03)['json'](_0x306a4e);}return null;};}function patchUpdates(_0x123a3b){return function(_0x5c4135){try{jsonpatch['apply'](_0x5c4135,_0x123a3b,!![]);}catch(_0x3f73cf){return BPromise['reject'](_0x3f73cf);}return _0x5c4135[_0x7b64('0x21')]();};}function saveUpdates(_0x587da6,_0x1bbd87){return function(_0x1ad95f){if(_0x1ad95f){return _0x1ad95f[_0x7b64('0x22')](_0x587da6)[_0x7b64('0x23')](function(_0x450b7e){return _0x450b7e;});}return null;};}function removeEntity(_0x3c0d97,_0x215ea9){return function(_0x3d4bef){if(_0x3d4bef){return _0x3d4bef[_0x7b64('0x24')]()[_0x7b64('0x23')](function(){_0x3c0d97[_0x7b64('0x19')](0xcc)[_0x7b64('0x25')]();});}};}function handleEntityNotFound(_0x24b68e,_0x42efa1){return function(_0x50d06c){if(!_0x50d06c){_0x24b68e[_0x7b64('0x26')](0x194);}return _0x50d06c;};}function handleError(_0x5d9586,_0x1580d0){_0x1580d0=_0x1580d0||0x1f4;return function(_0x21fbd3){logger['error'](_0x21fbd3['stack']);if(_0x21fbd3[_0x7b64('0x27')]){delete _0x21fbd3[_0x7b64('0x27')];}_0x5d9586[_0x7b64('0x19')](_0x1580d0)[_0x7b64('0x28')](_0x21fbd3);};}exports[_0x7b64('0x29')]=function(_0x3c9fad,_0x6740b2){var _0x2729f1={},_0x53e29b={},_0x1616c9={'count':0x0,'rows':[]};var _0x2c4619=_['map'](db[_0x7b64('0x2a')][_0x7b64('0x2b')],function(_0x369402){return{'name':_0x369402[_0x7b64('0x2c')],'type':_0x369402[_0x7b64('0x2d')][_0x7b64('0x2e')]};});_0x53e29b['model']=_['map'](_0x2c4619,_0x7b64('0x27'));_0x53e29b[_0x7b64('0x2f')]=_['keys'](_0x3c9fad['query']);_0x53e29b[_0x7b64('0x30')]=_['intersection'](_0x53e29b[_0x7b64('0x31')],_0x53e29b['query']);_0x2729f1['attributes']=_['intersection'](_0x53e29b[_0x7b64('0x31')],qs[_0x7b64('0x32')](_0x3c9fad[_0x7b64('0x2f')]['fields']));_0x2729f1[_0x7b64('0x33')]=_0x2729f1['attributes'][_0x7b64('0x34')]?_0x2729f1[_0x7b64('0x33')]:_0x53e29b[_0x7b64('0x31')];if(!_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x35')]('nolimit')){_0x2729f1[_0x7b64('0x1d')]=qs[_0x7b64('0x1d')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x1d')]);_0x2729f1['offset']=qs[_0x7b64('0x1b')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x1b')]);}_0x2729f1[_0x7b64('0x36')]=qs[_0x7b64('0x37')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x37')]);_0x2729f1['where']=qs['filters'](_[_0x7b64('0x38')](_0x3c9fad[_0x7b64('0x2f')],_0x53e29b[_0x7b64('0x30')]),_0x2c4619);if(_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x39')]){_0x2729f1[_0x7b64('0x3a')]=_[_0x7b64('0x3b')](_0x2729f1[_0x7b64('0x3a')],{'$or':_[_0x7b64('0x3c')](_0x2c4619,function(_0x5b1278){if(_0x5b1278[_0x7b64('0x2d')]!==_0x7b64('0x3d')){var _0x451f9b={};_0x451f9b[_0x5b1278[_0x7b64('0x27')]]={'$like':'%'+_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x39')]+'%'};return _0x451f9b;}})});}_0x2729f1=_[_0x7b64('0x3b')]({},_0x2729f1,_0x3c9fad[_0x7b64('0x3e')]);var _0x3c4467={'where':_0x2729f1[_0x7b64('0x3a')]};return db[_0x7b64('0x2a')][_0x7b64('0x1e')](_0x3c4467)[_0x7b64('0x23')](function(_0x36cfce){_0x1616c9[_0x7b64('0x1e')]=_0x36cfce;if(_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x3f')]){_0x2729f1[_0x7b64('0x40')]=[{'all':!![]}];}return db[_0x7b64('0x2a')][_0x7b64('0x41')](_0x2729f1);})['then'](function(_0x442d65){_0x1616c9[_0x7b64('0x42')]=_0x442d65;return _0x1616c9;})[_0x7b64('0x23')](respondWithFilteredResult(_0x6740b2,_0x2729f1))['catch'](handleError(_0x6740b2,null));};exports[_0x7b64('0x43')]=function(_0x2e4d0f,_0x55c889){var _0x216c58={'raw':!![],'where':{'id':_0x2e4d0f['params']['id']}},_0xf0d4a1={};_0xf0d4a1[_0x7b64('0x31')]=_['keys'](db[_0x7b64('0x2a')][_0x7b64('0x2b')]);_0xf0d4a1[_0x7b64('0x2f')]=_['keys'](_0x2e4d0f[_0x7b64('0x2f')]);_0xf0d4a1[_0x7b64('0x30')]=_[_0x7b64('0x44')](_0xf0d4a1[_0x7b64('0x31')],_0xf0d4a1[_0x7b64('0x2f')]);_0x216c58[_0x7b64('0x33')]=_['intersection'](_0xf0d4a1[_0x7b64('0x31')],qs[_0x7b64('0x32')](_0x2e4d0f[_0x7b64('0x2f')][_0x7b64('0x32')]));_0x216c58[_0x7b64('0x33')]=_0x216c58['attributes']['length']?_0x216c58['attributes']:_0xf0d4a1['model'];if(_0x2e4d0f[_0x7b64('0x2f')][_0x7b64('0x3f')]){_0x216c58[_0x7b64('0x40')]=[{'all':!![]}];}_0x216c58=_[_0x7b64('0x3b')]({},_0x216c58,_0x2e4d0f[_0x7b64('0x3e')]);return db[_0x7b64('0x2a')][_0x7b64('0x45')](_0x216c58)[_0x7b64('0x23')](handleEntityNotFound(_0x55c889,null))[_0x7b64('0x23')](respondWithResult(_0x55c889,null))[_0x7b64('0x46')](handleError(_0x55c889,null));};exports[_0x7b64('0x47')]=function(_0x38983a,_0x4add4d){return db['Cdr'][_0x7b64('0x47')](_0x38983a[_0x7b64('0x48')],{})[_0x7b64('0x23')](respondWithResult(_0x4add4d,0xc9))[_0x7b64('0x46')](handleError(_0x4add4d,null));};exports[_0x7b64('0x22')]=function(_0x5a8639,_0x3e5321){if(_0x5a8639[_0x7b64('0x48')]['id']){delete _0x5a8639[_0x7b64('0x48')]['id'];}return db['Cdr'][_0x7b64('0x45')]({'where':{'id':_0x5a8639[_0x7b64('0x49')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x3e5321,null))[_0x7b64('0x23')](saveUpdates(_0x5a8639[_0x7b64('0x48')],null))['then'](respondWithResult(_0x3e5321,null))[_0x7b64('0x46')](handleError(_0x3e5321,null));};exports[_0x7b64('0x24')]=function(_0x52b04a,_0x3656b8){return db[_0x7b64('0x2a')]['find']({'where':{'id':_0x52b04a[_0x7b64('0x49')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x3656b8,null))[_0x7b64('0x23')](removeEntity(_0x3656b8,null))[_0x7b64('0x46')](handleError(_0x3656b8,null));};exports[_0x7b64('0x4a')]=function(_0x79cbc9,_0x253b33){return db[_0x7b64('0x2a')][_0x7b64('0x4a')]()[_0x7b64('0x23')](respondWithResult(_0x253b33,null))[_0x7b64('0x46')](handleError(_0x253b33,null));}; \ No newline at end of file +var _0xf69d=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','then','send','map','Cdr','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x3a2097,_0x2c9c75){var _0x3c2d41=function(_0x3c6a1f){while(--_0x3c6a1f){_0x3a2097['push'](_0x3a2097['shift']());}};_0x3c2d41(++_0x2c9c75);}(_0xf69d,0xd3));var _0xdf69=function(_0x2616d7,_0x2fe262){_0x2616d7=_0x2616d7-0x0;var _0x111b31=_0xf69d[_0x2616d7];return _0x111b31;};'use strict';var emlformat=require(_0xdf69('0x0'));var rimraf=require(_0xdf69('0x1'));var zipdir=require(_0xdf69('0x2'));var jsonpatch=require(_0xdf69('0x3'));var rp=require(_0xdf69('0x4'));var moment=require('moment');var BPromise=require(_0xdf69('0x5'));var Mustache=require(_0xdf69('0x6'));var util=require(_0xdf69('0x7'));var path=require(_0xdf69('0x8'));var sox=require(_0xdf69('0x9'));var csv=require(_0xdf69('0xa'));var ejs=require(_0xdf69('0xb'));var fs=require('fs');var fs_extra=require(_0xdf69('0xc'));var _=require(_0xdf69('0xd'));var squel=require(_0xdf69('0xe'));var crypto=require(_0xdf69('0xf'));var jsforce=require(_0xdf69('0x10'));var deskjs=require(_0xdf69('0x11'));var toCsv=require(_0xdf69('0xa'));var querystring=require(_0xdf69('0x12'));var Papa=require(_0xdf69('0x13'));var Redis=require(_0xdf69('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdf69('0x15'));var as=require(_0xdf69('0x16'));var hardwareService=require(_0xdf69('0x17'));var logger=require(_0xdf69('0x18'))(_0xdf69('0x19'));var utils=require(_0xdf69('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5df98a,_0x3dcda8){_0x3dcda8=_0x3dcda8||0xcc;return function(_0xbacdc6){if(_0xbacdc6){return _0x5df98a[_0xdf69('0x1b')](_0x3dcda8);}return _0x5df98a[_0xdf69('0x1c')](_0x3dcda8)[_0xdf69('0x1d')]();};}function respondWithResult(_0x38aee2,_0x584cbd){_0x584cbd=_0x584cbd||0xc8;return function(_0x41cc77){if(_0x41cc77){return _0x38aee2[_0xdf69('0x1c')](_0x584cbd)[_0xdf69('0x1e')](_0x41cc77);}};}function respondWithFilteredResult(_0xef2df5,_0x4f28fc){return function(_0xa4242f){if(_0xa4242f){var _0x56be66=typeof _0x4f28fc[_0xdf69('0x1f')]===_0xdf69('0x20')&&typeof _0x4f28fc['limit']===_0xdf69('0x20');var _0x449908=_0xa4242f[_0xdf69('0x21')];var _0x85d1d=_0x56be66?0x0:_0x4f28fc['offset'];var _0x5ae237=_0x56be66?_0xa4242f[_0xdf69('0x21')]:_0x4f28fc[_0xdf69('0x1f')]+_0x4f28fc['limit'];var _0x32cf65;if(_0x5ae237>=_0x449908){_0x5ae237=_0x449908;_0x32cf65=0xc8;}else{_0x32cf65=0xce;}_0xef2df5[_0xdf69('0x1c')](_0x32cf65);return _0xef2df5[_0xdf69('0x22')]('Content-Range',_0x85d1d+'-'+_0x5ae237+'/'+_0x449908)[_0xdf69('0x1e')](_0xa4242f);}return null;};}function patchUpdates(_0x452cfa){return function(_0x4d09d5){try{jsonpatch['apply'](_0x4d09d5,_0x452cfa,!![]);}catch(_0x32505a){return BPromise[_0xdf69('0x23')](_0x32505a);}return _0x4d09d5[_0xdf69('0x24')]();};}function saveUpdates(_0x5d91b8,_0x50ef18){return function(_0x5be7dd){if(_0x5be7dd){return _0x5be7dd[_0xdf69('0x25')](_0x5d91b8)['then'](function(_0x21f757){return _0x21f757;});}return null;};}function removeEntity(_0x311534,_0x1d37d8){return function(_0x54d2ca){if(_0x54d2ca){return _0x54d2ca['destroy']()[_0xdf69('0x26')](function(){_0x311534[_0xdf69('0x1c')](0xcc)[_0xdf69('0x1d')]();});}};}function handleEntityNotFound(_0x3fd933,_0x549191){return function(_0x3b727c){if(!_0x3b727c){_0x3fd933[_0xdf69('0x1b')](0x194);}return _0x3b727c;};}function handleError(_0x3e4f28,_0x5969cb){_0x5969cb=_0x5969cb||0x1f4;return function(_0x2da3df){logger['error'](_0x2da3df['stack']);if(_0x2da3df['name']){delete _0x2da3df['name'];}_0x3e4f28[_0xdf69('0x1c')](_0x5969cb)[_0xdf69('0x27')](_0x2da3df);};}exports['index']=function(_0x301bd2,_0xd81d0a){var _0x19cf2d={},_0x12aec3={},_0x1b7c16={'count':0x0,'rows':[]};var _0x1b57b3=_[_0xdf69('0x28')](db[_0xdf69('0x29')][_0xdf69('0x2a')],function(_0x3b97df){return{'name':_0x3b97df[_0xdf69('0x2b')],'type':_0x3b97df[_0xdf69('0x2c')][_0xdf69('0x2d')]};});_0x12aec3[_0xdf69('0x2e')]=_[_0xdf69('0x28')](_0x1b57b3,_0xdf69('0x2f'));_0x12aec3[_0xdf69('0x30')]=_['keys'](_0x301bd2[_0xdf69('0x30')]);_0x12aec3[_0xdf69('0x31')]=_[_0xdf69('0x32')](_0x12aec3[_0xdf69('0x2e')],_0x12aec3[_0xdf69('0x30')]);_0x19cf2d['attributes']=_[_0xdf69('0x32')](_0x12aec3['model'],qs[_0xdf69('0x33')](_0x301bd2[_0xdf69('0x30')]['fields']));_0x19cf2d[_0xdf69('0x34')]=_0x19cf2d['attributes'][_0xdf69('0x35')]?_0x19cf2d[_0xdf69('0x34')]:_0x12aec3[_0xdf69('0x2e')];if(!_0x301bd2[_0xdf69('0x30')][_0xdf69('0x36')]('nolimit')){_0x19cf2d[_0xdf69('0x37')]=qs['limit'](_0x301bd2[_0xdf69('0x30')][_0xdf69('0x37')]);_0x19cf2d[_0xdf69('0x1f')]=qs[_0xdf69('0x1f')](_0x301bd2['query'][_0xdf69('0x1f')]);}_0x19cf2d['order']=qs[_0xdf69('0x38')](_0x301bd2['query'][_0xdf69('0x38')]);_0x19cf2d['where']=qs[_0xdf69('0x31')](_[_0xdf69('0x39')](_0x301bd2[_0xdf69('0x30')],_0x12aec3[_0xdf69('0x31')]),_0x1b57b3);if(_0x301bd2[_0xdf69('0x30')]['filter']){_0x19cf2d[_0xdf69('0x3a')]=_[_0xdf69('0x3b')](_0x19cf2d['where'],{'$or':_['map'](_0x1b57b3,function(_0x4ee03c){if(_0x4ee03c['type']!==_0xdf69('0x3c')){var _0x5aff7d={};_0x5aff7d[_0x4ee03c[_0xdf69('0x2f')]]={'$like':'%'+_0x301bd2[_0xdf69('0x30')][_0xdf69('0x3d')]+'%'};return _0x5aff7d;}})});}_0x19cf2d=_[_0xdf69('0x3b')]({},_0x19cf2d,_0x301bd2['options']);var _0x3de096={'where':_0x19cf2d[_0xdf69('0x3a')]};return db[_0xdf69('0x29')]['count'](_0x3de096)[_0xdf69('0x26')](function(_0xdd919d){_0x1b7c16[_0xdf69('0x21')]=_0xdd919d;if(_0x301bd2[_0xdf69('0x30')][_0xdf69('0x3e')]){_0x19cf2d[_0xdf69('0x3f')]=[{'all':!![]}];}return db[_0xdf69('0x29')]['findAll'](_0x19cf2d);})['then'](function(_0x1fc4aa){_0x1b7c16[_0xdf69('0x40')]=_0x1fc4aa;return _0x1b7c16;})[_0xdf69('0x26')](respondWithFilteredResult(_0xd81d0a,_0x19cf2d))[_0xdf69('0x41')](handleError(_0xd81d0a,null));};exports['show']=function(_0x4a972c,_0x5980b1){var _0x5454e1={'raw':!![],'where':{'id':_0x4a972c['params']['id']}},_0x2abc7f={};_0x2abc7f[_0xdf69('0x2e')]=_['keys'](db[_0xdf69('0x29')][_0xdf69('0x2a')]);_0x2abc7f[_0xdf69('0x30')]=_[_0xdf69('0x42')](_0x4a972c[_0xdf69('0x30')]);_0x2abc7f[_0xdf69('0x31')]=_[_0xdf69('0x32')](_0x2abc7f[_0xdf69('0x2e')],_0x2abc7f[_0xdf69('0x30')]);_0x5454e1['attributes']=_['intersection'](_0x2abc7f[_0xdf69('0x2e')],qs['fields'](_0x4a972c[_0xdf69('0x30')][_0xdf69('0x33')]));_0x5454e1[_0xdf69('0x34')]=_0x5454e1['attributes'][_0xdf69('0x35')]?_0x5454e1[_0xdf69('0x34')]:_0x2abc7f[_0xdf69('0x2e')];if(_0x4a972c[_0xdf69('0x30')]['includeAll']){_0x5454e1[_0xdf69('0x3f')]=[{'all':!![]}];}_0x5454e1=_[_0xdf69('0x3b')]({},_0x5454e1,_0x4a972c['options']);return db['Cdr'][_0xdf69('0x43')](_0x5454e1)[_0xdf69('0x26')](handleEntityNotFound(_0x5980b1,null))[_0xdf69('0x26')](respondWithResult(_0x5980b1,null))[_0xdf69('0x41')](handleError(_0x5980b1,null));};exports[_0xdf69('0x44')]=function(_0x1b46c6,_0x578eec){return db['Cdr'][_0xdf69('0x44')](_0x1b46c6[_0xdf69('0x45')],{})[_0xdf69('0x26')](respondWithResult(_0x578eec,0xc9))[_0xdf69('0x41')](handleError(_0x578eec,null));};exports['update']=function(_0x4bc70f,_0xb34f76){if(_0x4bc70f[_0xdf69('0x45')]['id']){delete _0x4bc70f[_0xdf69('0x45')]['id'];}return db[_0xdf69('0x29')][_0xdf69('0x43')]({'where':{'id':_0x4bc70f[_0xdf69('0x46')]['id']}})[_0xdf69('0x26')](handleEntityNotFound(_0xb34f76,null))[_0xdf69('0x26')](saveUpdates(_0x4bc70f[_0xdf69('0x45')],null))[_0xdf69('0x26')](respondWithResult(_0xb34f76,null))[_0xdf69('0x41')](handleError(_0xb34f76,null));};exports[_0xdf69('0x47')]=function(_0x9a24c9,_0x439b06){return db['Cdr'][_0xdf69('0x43')]({'where':{'id':_0x9a24c9[_0xdf69('0x46')]['id']}})[_0xdf69('0x26')](handleEntityNotFound(_0x439b06,null))['then'](removeEntity(_0x439b06,null))[_0xdf69('0x41')](handleError(_0x439b06,null));};exports[_0xdf69('0x48')]=function(_0x15ca48,_0x4abeb7){return db[_0xdf69('0x29')]['describe']()[_0xdf69('0x26')](respondWithResult(_0x4abeb7,null))[_0xdf69('0x41')](handleError(_0x4abeb7,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3cba8e9..3e5936b 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1d7bfc,_0x9dc01){var _0x34d68d=function(_0x3a7380){while(--_0x3a7380){_0x1d7bfc['push'](_0x1d7bfc['shift']());}};_0x34d68d(++_0x9dc01);}(_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':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x55dd9d,_0x39bb00){var _0x300f11=function(_0x86f10a){while(--_0x86f10a){_0x55dd9d['push'](_0x55dd9d['shift']());}};_0x300f11(++_0x39bb00);}(_0x7a54,0x106));var _0x47a5=function(_0x1a1ac0,_0x5b3b56){_0x1a1ac0=_0x1a1ac0-0x0;var _0x3dd4ce=_0x7a54[_0x1a1ac0];return _0x3dd4ce;};'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 11aba53..ff2a522 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 _0xe24a=['../../config/logger','rpc','../../config/environment','jayson/promise','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3c2a87,_0x301e33){var _0x3a4efd=function(_0x2c5e19){while(--_0x2c5e19){_0x3c2a87['push'](_0x3c2a87['shift']());}};_0x3a4efd(++_0x301e33);}(_0xe24a,0x1dc));var _0xae24=function(_0x502a31,_0x1aeeca){_0x502a31=_0x502a31-0x0;var _0x1b003b=_0xe24a[_0x502a31];return _0x1b003b;};'use strict';var _=require(_0xae24('0x0'));var util=require(_0xae24('0x1'));var moment=require(_0xae24('0x2'));var BPromise=require(_0xae24('0x3'));var rs=require(_0xae24('0x4'));var fs=require('fs');var Redis=require(_0xae24('0x5'));var db=require(_0xae24('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xae24('0x7'))(_0xae24('0x8'));var config=require(_0xae24('0x9'));var jayson=require(_0xae24('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2da4b4,_0x5d5370,_0x4d4745){return new BPromise(function(_0xebdbb4,_0x64b120){return client['request'](_0x2da4b4,_0x4d4745)['then'](function(_0x2abe37){logger[_0xae24('0xb')]('Cdr,\x20%s,\x20%s',_0x5d5370,_0xae24('0xc'));logger[_0xae24('0xd')](_0xae24('0xe'),_0x5d5370,_0xae24('0xc'),JSON[_0xae24('0xf')](_0x2abe37));if(_0x2abe37['error']){if(_0x2abe37[_0xae24('0x10')]['code']===0x1f4){logger[_0xae24('0x10')]('Cdr,\x20%s,\x20%s',_0x5d5370,_0x2abe37[_0xae24('0x10')][_0xae24('0x11')]);return _0x64b120(_0x2abe37[_0xae24('0x10')]['message']);}logger[_0xae24('0x10')](_0xae24('0x12'),_0x5d5370,_0x2abe37[_0xae24('0x10')][_0xae24('0x11')]);return _0xebdbb4(_0x2abe37[_0xae24('0x10')][_0xae24('0x11')]);}else{logger[_0xae24('0xb')]('Cdr,\x20%s,\x20%s',_0x5d5370,'request\x20sent');_0xebdbb4(_0x2abe37[_0xae24('0x13')][_0xae24('0x11')]);}})[_0xae24('0x14')](function(_0x26b773){logger[_0xae24('0x10')]('Cdr,\x20%s,\x20%s',_0x5d5370,_0x26b773);_0x64b120(_0x26b773);});});} \ No newline at end of file +var _0x2ec4=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3d6cf2,_0x456384){var _0x3aa3eb=function(_0x5b685f){while(--_0x5b685f){_0x3d6cf2['push'](_0x3d6cf2['shift']());}};_0x3aa3eb(++_0x456384);}(_0x2ec4,0x1d2));var _0x42ec=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2ec4[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x42ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x42ec('0x1'));var fs=require('fs');var Redis=require(_0x42ec('0x2'));var db=require(_0x42ec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x42ec('0x4'))('rpc');var config=require(_0x42ec('0x5'));var jayson=require(_0x42ec('0x6'));var client=jayson['client'][_0x42ec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fb9b3,_0x4f6fcd,_0x2ab2a2){return new BPromise(function(_0x53866a,_0x74c41c){return client[_0x42ec('0x8')](_0x4fb9b3,_0x2ab2a2)[_0x42ec('0x9')](function(_0x3074a8){logger[_0x42ec('0xa')](_0x42ec('0xb'),_0x4f6fcd,_0x42ec('0xc'));logger[_0x42ec('0xd')](_0x42ec('0xe'),_0x4f6fcd,_0x42ec('0xc'),JSON[_0x42ec('0xf')](_0x3074a8));if(_0x3074a8[_0x42ec('0x10')]){if(_0x3074a8[_0x42ec('0x10')][_0x42ec('0x11')]===0x1f4){logger[_0x42ec('0x10')]('Cdr,\x20%s,\x20%s',_0x4f6fcd,_0x3074a8['error'][_0x42ec('0x12')]);return _0x74c41c(_0x3074a8[_0x42ec('0x10')][_0x42ec('0x12')]);}logger['error'](_0x42ec('0xb'),_0x4f6fcd,_0x3074a8[_0x42ec('0x10')][_0x42ec('0x12')]);return _0x53866a(_0x3074a8[_0x42ec('0x10')]['message']);}else{logger[_0x42ec('0xa')](_0x42ec('0xb'),_0x4f6fcd,_0x42ec('0xc'));_0x53866a(_0x3074a8['result']['message']);}})[_0x42ec('0x13')](function(_0x47d660){logger[_0x42ec('0x10')](_0x42ec('0xb'),_0x4f6fcd,_0x47d660);_0x74c41c(_0x47d660);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 0f99064..d5bbe5b 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x474030,_0x38397a){var _0x584ab0=function(_0xfd7646){while(--_0xfd7646){_0x474030['push'](_0x474030['shift']());}};_0x584ab0(++_0x38397a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e9903,_0x3ec512){_0x3e9903=_0x3e9903-0x0;var _0xcab758=_0xb10b[_0x3e9903];return _0xcab758;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +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(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 a854680..bc50742 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 _0x42ab=['INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x50b342,_0x3fdd5a){var _0x3426d5=function(_0x597d34){while(--_0x597d34){_0x50b342['push'](_0x50b342['shift']());}};_0x3426d5(++_0x3fdd5a);}(_0x42ab,0x194));var _0xb42a=function(_0x262f44,_0x3847ba){_0x262f44=_0x262f44-0x0;var _0x33b27c=_0x42ab[_0x262f44];return _0x33b27c;};'use strict';var Sequelize=require(_0xb42a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb42a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb42a('0x2')],'allowNull':![],'defaultValue':_0xb42a('0x3')},'appdata':{'type':Sequelize[_0xb42a('0x4')]()},'description':{'type':Sequelize[_0xb42a('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf5b0=['noop','TEXT','sequelize','exports','STRING'];(function(_0x4d5dfc,_0xd5042b){var _0x2c29f0=function(_0x2ae258){while(--_0x2ae258){_0x4d5dfc['push'](_0x4d5dfc['shift']());}};_0x2c29f0(++_0xd5042b);}(_0xf5b0,0x1b5));var _0x0f5b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xf5b0[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0x0f5b('0x0'));module[_0x0f5b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0f5b('0x2')],'allowNull':![],'defaultValue':_0x0f5b('0x3')},'appdata':{'type':Sequelize[_0x0f5b('0x4')]()},'description':{'type':Sequelize[_0x0f5b('0x2')]},'interval':{'type':Sequelize[_0x0f5b('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 6282a3d..818556c 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 _0x2746=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','find','params','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3da001,_0x256e26){var _0x2947e9=function(_0x4afdc0){while(--_0x4afdc0){_0x3da001['push'](_0x3da001['shift']());}};_0x2947e9(++_0x256e26);}(_0x2746,0x19c));var _0x6274=function(_0x85465a,_0x4dfeb2){_0x85465a=_0x85465a-0x0;var _0x57ffb9=_0x2746[_0x85465a];return _0x57ffb9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6274('0x0'));var jsonpatch=require(_0x6274('0x1'));var rp=require(_0x6274('0x2'));var moment=require(_0x6274('0x3'));var BPromise=require(_0x6274('0x4'));var Mustache=require(_0x6274('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6274('0x6'));var csv=require(_0x6274('0x7'));var ejs=require(_0x6274('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6274('0x9'));var squel=require(_0x6274('0xa'));var crypto=require(_0x6274('0xb'));var jsforce=require(_0x6274('0xc'));var deskjs=require(_0x6274('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6274('0xe'));var Papa=require('papaparse');var Redis=require(_0x6274('0xf'));var authService=require(_0x6274('0x10'));var qs=require(_0x6274('0x11'));var as=require(_0x6274('0x12'));var hardwareService=require(_0x6274('0x13'));var logger=require(_0x6274('0x14'))(_0x6274('0x15'));var utils=require(_0x6274('0x16'));var config=require(_0x6274('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59a0a1,_0xd3a0a2){_0xd3a0a2=_0xd3a0a2||0xcc;return function(_0x479fdc){if(_0x479fdc){return _0x59a0a1[_0x6274('0x18')](_0xd3a0a2);}return _0x59a0a1[_0x6274('0x19')](_0xd3a0a2)[_0x6274('0x1a')]();};}function respondWithResult(_0x4f4f9e,_0x58a4e3){_0x58a4e3=_0x58a4e3||0xc8;return function(_0x488b60){if(_0x488b60){return _0x4f4f9e[_0x6274('0x19')](_0x58a4e3)[_0x6274('0x1b')](_0x488b60);}};}function respondWithFilteredResult(_0x4b581a,_0x5e6ff8){return function(_0x425c8b){if(_0x425c8b){var _0x1d0dc4=typeof _0x5e6ff8[_0x6274('0x1c')]===_0x6274('0x1d')&&typeof _0x5e6ff8[_0x6274('0x1e')]==='undefined';var _0x3219d1=_0x425c8b[_0x6274('0x1f')];var _0x40cc32=_0x1d0dc4?0x0:_0x5e6ff8['offset'];var _0x5cdf5e=_0x1d0dc4?_0x425c8b[_0x6274('0x1f')]:_0x5e6ff8['offset']+_0x5e6ff8['limit'];var _0x402b97;if(_0x5cdf5e>=_0x3219d1){_0x5cdf5e=_0x3219d1;_0x402b97=0xc8;}else{_0x402b97=0xce;}_0x4b581a['status'](_0x402b97);return _0x4b581a[_0x6274('0x20')](_0x6274('0x21'),_0x40cc32+'-'+_0x5cdf5e+'/'+_0x3219d1)['json'](_0x425c8b);}return null;};}function patchUpdates(_0x55dab9){return function(_0x3e0248){try{jsonpatch[_0x6274('0x22')](_0x3e0248,_0x55dab9,!![]);}catch(_0xe2b388){return BPromise[_0x6274('0x23')](_0xe2b388);}return _0x3e0248[_0x6274('0x24')]();};}function saveUpdates(_0x221c7a,_0x3b8fb6){return function(_0x12df93){if(_0x12df93){return _0x12df93[_0x6274('0x25')](_0x221c7a)[_0x6274('0x26')](function(_0x1d1a09){return _0x1d1a09;});}return null;};}function removeEntity(_0xc49220,_0x125f14){return function(_0xa0c8bd){if(_0xa0c8bd){return _0xa0c8bd[_0x6274('0x27')]()[_0x6274('0x26')](function(){_0xc49220[_0x6274('0x19')](0xcc)[_0x6274('0x1a')]();});}};}function handleEntityNotFound(_0x5228a1,_0x425241){return function(_0x486d1f){if(!_0x486d1f){_0x5228a1[_0x6274('0x18')](0x194);}return _0x486d1f;};}function handleError(_0x543ac7,_0x234149){_0x234149=_0x234149||0x1f4;return function(_0x1513e8){logger['error'](_0x1513e8[_0x6274('0x28')]);if(_0x1513e8['name']){delete _0x1513e8['name'];}_0x543ac7[_0x6274('0x19')](_0x234149)[_0x6274('0x29')](_0x1513e8);};}exports[_0x6274('0x2a')]=function(_0x490541,_0x3feefd){var _0x49df2e={'raw':!![],'where':{'id':_0x490541['params']['id']}},_0x4818e2={};_0x4818e2[_0x6274('0x2b')]=_[_0x6274('0x2c')](db[_0x6274('0x2d')][_0x6274('0x2e')]);_0x4818e2[_0x6274('0x2f')]=_[_0x6274('0x2c')](_0x490541['query']);_0x4818e2[_0x6274('0x30')]=_[_0x6274('0x31')](_0x4818e2[_0x6274('0x2b')],_0x4818e2[_0x6274('0x2f')]);_0x49df2e[_0x6274('0x32')]=_[_0x6274('0x31')](_0x4818e2[_0x6274('0x2b')],qs['fields'](_0x490541['query'][_0x6274('0x33')]));_0x49df2e[_0x6274('0x32')]=_0x49df2e[_0x6274('0x32')][_0x6274('0x34')]?_0x49df2e[_0x6274('0x32')]:_0x4818e2[_0x6274('0x2b')];if(_0x490541[_0x6274('0x2f')][_0x6274('0x35')]){_0x49df2e[_0x6274('0x36')]=[{'all':!![]}];}_0x49df2e=_[_0x6274('0x37')]({},_0x49df2e,_0x490541[_0x6274('0x38')]);return db[_0x6274('0x2d')]['find'](_0x49df2e)[_0x6274('0x26')](handleEntityNotFound(_0x3feefd,null))[_0x6274('0x26')](respondWithResult(_0x3feefd,null))[_0x6274('0x39')](handleError(_0x3feefd,null));};exports[_0x6274('0x25')]=function(_0x167cba,_0x8b1bd4){if(_0x167cba['body']['id']){delete _0x167cba['body']['id'];}return db['ChatApplication'][_0x6274('0x3a')]({'where':{'id':_0x167cba[_0x6274('0x3b')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x8b1bd4,null))[_0x6274('0x26')](saveUpdates(_0x167cba[_0x6274('0x3c')],null))[_0x6274('0x26')](respondWithResult(_0x8b1bd4,null))[_0x6274('0x39')](handleError(_0x8b1bd4,null));};exports[_0x6274('0x27')]=function(_0x3a63ca,_0x115077){return db[_0x6274('0x2d')][_0x6274('0x3a')]({'where':{'id':_0x3a63ca[_0x6274('0x3b')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x115077,null))[_0x6274('0x26')](removeEntity(_0x115077,null))[_0x6274('0x39')](handleError(_0x115077,null));}; \ No newline at end of file +var _0x9780=['end','offset','undefined','limit','count','set','json','reject','save','update','destroy','error','stack','name','send','show','model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','find','then','body','params','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x9780,0x1d4));var _0x0978=function(_0x4ae506,_0x5a97ed){_0x4ae506=_0x4ae506-0x0;var _0x18e3a1=_0x9780[_0x4ae506];return _0x18e3a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0978('0x0'));var jsonpatch=require(_0x0978('0x1'));var rp=require(_0x0978('0x2'));var moment=require(_0x0978('0x3'));var BPromise=require(_0x0978('0x4'));var Mustache=require(_0x0978('0x5'));var util=require(_0x0978('0x6'));var path=require(_0x0978('0x7'));var sox=require(_0x0978('0x8'));var csv=require(_0x0978('0x9'));var ejs=require(_0x0978('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0978('0xb'));var squel=require(_0x0978('0xc'));var crypto=require(_0x0978('0xd'));var jsforce=require(_0x0978('0xe'));var deskjs=require(_0x0978('0xf'));var toCsv=require(_0x0978('0x9'));var querystring=require(_0x0978('0x10'));var Papa=require(_0x0978('0x11'));var Redis=require(_0x0978('0x12'));var authService=require(_0x0978('0x13'));var qs=require(_0x0978('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0978('0x15'));var logger=require('../../config/logger')(_0x0978('0x16'));var utils=require(_0x0978('0x17'));var config=require(_0x0978('0x18'));var licenseUtil=require(_0x0978('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3db101,_0x4cb5f5){_0x4cb5f5=_0x4cb5f5||0xcc;return function(_0x3cc5e6){if(_0x3cc5e6){return _0x3db101[_0x0978('0x1a')](_0x4cb5f5);}return _0x3db101[_0x0978('0x1b')](_0x4cb5f5)[_0x0978('0x1c')]();};}function respondWithResult(_0x155a71,_0xe18785){_0xe18785=_0xe18785||0xc8;return function(_0x1fc724){if(_0x1fc724){return _0x155a71[_0x0978('0x1b')](_0xe18785)['json'](_0x1fc724);}};}function respondWithFilteredResult(_0x28d1b8,_0x2177e0){return function(_0x1fe6a9){if(_0x1fe6a9){var _0x20e9ab=typeof _0x2177e0[_0x0978('0x1d')]===_0x0978('0x1e')&&typeof _0x2177e0[_0x0978('0x1f')]===_0x0978('0x1e');var _0x2f2d4c=_0x1fe6a9['count'];var _0x18f40a=_0x20e9ab?0x0:_0x2177e0[_0x0978('0x1d')];var _0x23d426=_0x20e9ab?_0x1fe6a9[_0x0978('0x20')]:_0x2177e0[_0x0978('0x1d')]+_0x2177e0[_0x0978('0x1f')];var _0x1cdd40;if(_0x23d426>=_0x2f2d4c){_0x23d426=_0x2f2d4c;_0x1cdd40=0xc8;}else{_0x1cdd40=0xce;}_0x28d1b8[_0x0978('0x1b')](_0x1cdd40);return _0x28d1b8[_0x0978('0x21')]('Content-Range',_0x18f40a+'-'+_0x23d426+'/'+_0x2f2d4c)[_0x0978('0x22')](_0x1fe6a9);}return null;};}function patchUpdates(_0xad6a1d){return function(_0x346ffc){try{jsonpatch['apply'](_0x346ffc,_0xad6a1d,!![]);}catch(_0x1ac591){return BPromise[_0x0978('0x23')](_0x1ac591);}return _0x346ffc[_0x0978('0x24')]();};}function saveUpdates(_0x5b6558,_0x1c97a9){return function(_0x5b3c5c){if(_0x5b3c5c){return _0x5b3c5c[_0x0978('0x25')](_0x5b6558)['then'](function(_0x2f61db){return _0x2f61db;});}return null;};}function removeEntity(_0x4f4fa6,_0x1a968d){return function(_0x58e40d){if(_0x58e40d){return _0x58e40d[_0x0978('0x26')]()['then'](function(){_0x4f4fa6['status'](0xcc)[_0x0978('0x1c')]();});}};}function handleEntityNotFound(_0x45d953,_0x453e2c){return function(_0x2e3612){if(!_0x2e3612){_0x45d953[_0x0978('0x1a')](0x194);}return _0x2e3612;};}function handleError(_0x1fcb09,_0x3f5c6d){_0x3f5c6d=_0x3f5c6d||0x1f4;return function(_0x39fff2){logger[_0x0978('0x27')](_0x39fff2[_0x0978('0x28')]);if(_0x39fff2[_0x0978('0x29')]){delete _0x39fff2[_0x0978('0x29')];}_0x1fcb09[_0x0978('0x1b')](_0x3f5c6d)[_0x0978('0x2a')](_0x39fff2);};}exports[_0x0978('0x2b')]=function(_0x4215a3,_0x16a8e8){var _0xc68e34={'raw':!![],'where':{'id':_0x4215a3['params']['id']}},_0x111966={};_0x111966[_0x0978('0x2c')]=_['keys'](db[_0x0978('0x2d')][_0x0978('0x2e')]);_0x111966[_0x0978('0x2f')]=_[_0x0978('0x30')](_0x4215a3[_0x0978('0x2f')]);_0x111966[_0x0978('0x31')]=_[_0x0978('0x32')](_0x111966[_0x0978('0x2c')],_0x111966[_0x0978('0x2f')]);_0xc68e34[_0x0978('0x33')]=_[_0x0978('0x32')](_0x111966[_0x0978('0x2c')],qs[_0x0978('0x34')](_0x4215a3[_0x0978('0x2f')][_0x0978('0x34')]));_0xc68e34[_0x0978('0x33')]=_0xc68e34[_0x0978('0x33')][_0x0978('0x35')]?_0xc68e34['attributes']:_0x111966[_0x0978('0x2c')];if(_0x4215a3[_0x0978('0x2f')][_0x0978('0x36')]){_0xc68e34[_0x0978('0x37')]=[{'all':!![]}];}_0xc68e34=_[_0x0978('0x38')]({},_0xc68e34,_0x4215a3['options']);return db[_0x0978('0x2d')][_0x0978('0x39')](_0xc68e34)[_0x0978('0x3a')](handleEntityNotFound(_0x16a8e8,null))[_0x0978('0x3a')](respondWithResult(_0x16a8e8,null))['catch'](handleError(_0x16a8e8,null));};exports['update']=function(_0x5dcc5e,_0x2f937b){if(_0x5dcc5e[_0x0978('0x3b')]['id']){delete _0x5dcc5e['body']['id'];}return db[_0x0978('0x2d')][_0x0978('0x39')]({'where':{'id':_0x5dcc5e[_0x0978('0x3c')]['id']}})[_0x0978('0x3a')](handleEntityNotFound(_0x2f937b,null))['then'](saveUpdates(_0x5dcc5e[_0x0978('0x3b')],null))['then'](respondWithResult(_0x2f937b,null))[_0x0978('0x3d')](handleError(_0x2f937b,null));};exports[_0x0978('0x26')]=function(_0x185477,_0x2b7511){return db[_0x0978('0x2d')][_0x0978('0x39')]({'where':{'id':_0x185477[_0x0978('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2b7511,null))[_0x0978('0x3a')](removeEntity(_0x2b7511,null))[_0x0978('0x3d')](handleError(_0x2b7511,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7400fed..a555f4a 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 _0xfdd7=['path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdd7,0xa3));var _0x7fdd=function(_0x33aa5f,_0x28b469){_0x33aa5f=_0x33aa5f-0x0;var _0x4774a1=_0xfdd7[_0x33aa5f];return _0x4774a1;};'use strict';var _=require(_0x7fdd('0x0'));var util=require(_0x7fdd('0x1'));var logger=require(_0x7fdd('0x2'))('api');var moment=require(_0x7fdd('0x3'));var BPromise=require(_0x7fdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fdd('0x5'));var rimraf=require(_0x7fdd('0x6'));var config=require(_0x7fdd('0x7'));var attributes=require(_0x7fdd('0x8'));module[_0x7fdd('0x9')]=function(_0x54deda,_0x40dbe3){return _0x54deda[_0x7fdd('0xa')](_0x7fdd('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7fdd('0xc'),'collate':_0x7fdd('0xd')});}; \ No newline at end of file +var _0x2b6c=['define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x32ea14,_0x5cf630){var _0x4c7d20=function(_0x332286){while(--_0x332286){_0x32ea14['push'](_0x32ea14['shift']());}};_0x4c7d20(++_0x5cf630);}(_0x2b6c,0xa1));var _0xc2b6=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x2b6c[_0x2aea9e];return _0x430b92;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc2b6('0x0'));var moment=require('moment');var BPromise=require(_0xc2b6('0x1'));var rp=require(_0xc2b6('0x2'));var fs=require('fs');var path=require(_0xc2b6('0x3'));var rimraf=require(_0xc2b6('0x4'));var config=require(_0xc2b6('0x5'));var attributes=require('./chatApplication.attributes');module[_0xc2b6('0x6')]=function(_0x7e1215,_0x38a364){return _0x7e1215[_0xc2b6('0x7')](_0xc2b6('0x8'),attributes,{'tableName':_0xc2b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc2b6('0xa'),'collate':_0xc2b6('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 586d00f..c0d8ce1 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 _0x6c36=['code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x19a8b5,_0x3d98c2){var _0xb4e415=function(_0x4c02b7){while(--_0x4c02b7){_0x19a8b5['push'](_0x19a8b5['shift']());}};_0xb4e415(++_0x3d98c2);}(_0x6c36,0x112));var _0x66c3=function(_0x2b7337,_0x324cc6){_0x2b7337=_0x2b7337-0x0;var _0x3d894d=_0x6c36[_0x2b7337];return _0x3d894d;};'use strict';var _=require(_0x66c3('0x0'));var util=require(_0x66c3('0x1'));var moment=require('moment');var BPromise=require(_0x66c3('0x2'));var rs=require(_0x66c3('0x3'));var fs=require('fs');var Redis=require(_0x66c3('0x4'));var db=require(_0x66c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x66c3('0x6'));var config=require(_0x66c3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x66c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41a106,_0x3e017a,_0x47552b){return new BPromise(function(_0x34cb24,_0x3c7ca8){return client['request'](_0x41a106,_0x47552b)[_0x66c3('0x9')](function(_0x5550b9){logger['info'](_0x66c3('0xa'),_0x3e017a,_0x66c3('0xb'));logger[_0x66c3('0xc')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3e017a,_0x66c3('0xb'),JSON['stringify'](_0x5550b9));if(_0x5550b9[_0x66c3('0xd')]){if(_0x5550b9['error'][_0x66c3('0xe')]===0x1f4){logger[_0x66c3('0xd')](_0x66c3('0xa'),_0x3e017a,_0x5550b9[_0x66c3('0xd')][_0x66c3('0xf')]);return _0x3c7ca8(_0x5550b9[_0x66c3('0xd')][_0x66c3('0xf')]);}logger['error'](_0x66c3('0xa'),_0x3e017a,_0x5550b9[_0x66c3('0xd')][_0x66c3('0xf')]);return _0x34cb24(_0x5550b9[_0x66c3('0xd')][_0x66c3('0xf')]);}else{logger[_0x66c3('0x10')]('ChatApplication,\x20%s,\x20%s',_0x3e017a,_0x66c3('0xb'));_0x34cb24(_0x5550b9[_0x66c3('0x11')]['message']);}})['catch'](function(_0x5a6bba){logger['error'](_0x66c3('0xa'),_0x3e017a,_0x5a6bba);_0x3c7ca8(_0x5a6bba);});});} \ No newline at end of file +var _0x275f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x275f,0x154));var _0xf275=function(_0x492221,_0x9e2521){_0x492221=_0x492221-0x0;var _0x398bf9=_0x275f[_0x492221];return _0x398bf9;};'use strict';var _=require(_0xf275('0x0'));var util=require('util');var moment=require(_0xf275('0x1'));var BPromise=require(_0xf275('0x2'));var rs=require(_0xf275('0x3'));var fs=require('fs');var Redis=require(_0xf275('0x4'));var db=require(_0xf275('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf275('0x6'))(_0xf275('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf275('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d6fb6,_0x14f81c,_0x153a32){return new BPromise(function(_0x5074a4,_0x3f9823){return client[_0xf275('0x9')](_0x4d6fb6,_0x153a32)[_0xf275('0xa')](function(_0x11c49a){logger[_0xf275('0xb')](_0xf275('0xc'),_0x14f81c,'request\x20sent');logger['debug'](_0xf275('0xd'),_0x14f81c,_0xf275('0xe'),JSON[_0xf275('0xf')](_0x11c49a));if(_0x11c49a[_0xf275('0x10')]){if(_0x11c49a[_0xf275('0x10')]['code']===0x1f4){logger[_0xf275('0x10')](_0xf275('0xc'),_0x14f81c,_0x11c49a[_0xf275('0x10')][_0xf275('0x11')]);return _0x3f9823(_0x11c49a['error']['message']);}logger[_0xf275('0x10')](_0xf275('0xc'),_0x14f81c,_0x11c49a[_0xf275('0x10')][_0xf275('0x11')]);return _0x5074a4(_0x11c49a[_0xf275('0x10')][_0xf275('0x11')]);}else{logger[_0xf275('0xb')]('ChatApplication,\x20%s,\x20%s',_0x14f81c,_0xf275('0xe'));_0x5074a4(_0x11c49a[_0xf275('0x12')][_0xf275('0x11')]);}})['catch'](function(_0x4216b8){logger[_0xf275('0x10')](_0xf275('0xc'),_0x14f81c,_0x4216b8);_0x3f9823(_0x4216b8);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c4a455b..56bf5d6 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 _0x759d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4017fc,_0x4734de){var _0x49b7e4=function(_0x414b2f){while(--_0x414b2f){_0x4017fc['push'](_0x4017fc['shift']());}};_0x49b7e4(++_0x4734de);}(_0x759d,0x10a));var _0xd759=function(_0x226e5d,_0x3d7316){_0x226e5d=_0x226e5d-0x0;var _0x8d9bdc=_0x759d[_0x226e5d];return _0x8d9bdc;};'use strict';var multer=require(_0xd759('0x0'));var util=require('util');var path=require(_0xd759('0x1'));var timeout=require(_0xd759('0x2'));var express=require(_0xd759('0x3'));var router=express[_0xd759('0x4')]();var fs_extra=require(_0xd759('0x5'));var auth=require(_0xd759('0x6'));var interaction=require(_0xd759('0x7'));var config=require(_0xd759('0x8'));var controller=require(_0xd759('0x9'));router['get'](_0xd759('0xa'),auth[_0xd759('0xb')](),controller[_0xd759('0xc')]);router[_0xd759('0xd')](_0xd759('0xa'),auth[_0xd759('0xb')](),controller[_0xd759('0xe')]);router['delete'](_0xd759('0xa'),auth[_0xd759('0xb')](),controller['destroy']);module[_0xd759('0xf')]=router; \ No newline at end of file +var _0xe359=['put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xe359,0xdc));var _0x9e35=function(_0x5115c0,_0x2d588e){_0x5115c0=_0x5115c0-0x0;var _0x4344d7=_0xe359[_0x5115c0];return _0x4344d7;};'use strict';var multer=require(_0x9e35('0x0'));var util=require(_0x9e35('0x1'));var path=require('path');var timeout=require(_0x9e35('0x2'));var express=require(_0x9e35('0x3'));var router=express[_0x9e35('0x4')]();var fs_extra=require(_0x9e35('0x5'));var auth=require(_0x9e35('0x6'));var interaction=require(_0x9e35('0x7'));var config=require(_0x9e35('0x8'));var controller=require(_0x9e35('0x9'));router[_0x9e35('0xa')](_0x9e35('0xb'),auth[_0x9e35('0xc')](),controller[_0x9e35('0xd')]);router[_0x9e35('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x9e35('0xf')]);router['delete'](_0x9e35('0xb'),auth[_0x9e35('0xc')](),controller[_0x9e35('0x10')]);module[_0x9e35('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 9136603..f19b033 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 _0xd668=['STRING','BOOLEAN','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd668,0x18e));var _0x8d66=function(_0x204ef6,_0x14dc9b){_0x204ef6=_0x204ef6-0x0;var _0x5e3a4b=_0xd668[_0x204ef6];return _0x5e3a4b;};'use strict';var Sequelize=require(_0x8d66('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d66('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8d66('0x1')]},'write':{'type':Sequelize[_0x8d66('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xffb1=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xffb1,0x93));var _0x1ffb=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0xffb1[_0x2ce6d5];return _0x32d272;};'use strict';var Sequelize=require(_0x1ffb('0x0'));module[_0x1ffb('0x1')]={'name':{'type':Sequelize[_0x1ffb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1ffb('0x2')]},'write':{'type':Sequelize[_0x1ffb('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 8ca3743..6b7d6d4 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 _0x28c7=['include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','getMembers','findOne','User','pick','removeMembers','addMessage','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ChatGroup','includeAll'];(function(_0x27c0f8,_0xd1bd2f){var _0x426b4e=function(_0x1d3f4b){while(--_0x1d3f4b){_0x27c0f8['push'](_0x27c0f8['shift']());}};_0x426b4e(++_0xd1bd2f);}(_0x28c7,0x7d));var _0x728c=function(_0x476350,_0x481037){_0x476350=_0x476350-0x0;var _0x452d18=_0x28c7[_0x476350];return _0x452d18;};'use strict';var emlformat=require(_0x728c('0x0'));var rimraf=require(_0x728c('0x1'));var zipdir=require(_0x728c('0x2'));var jsonpatch=require(_0x728c('0x3'));var rp=require(_0x728c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x728c('0x5'));var util=require(_0x728c('0x6'));var path=require(_0x728c('0x7'));var sox=require(_0x728c('0x8'));var csv=require(_0x728c('0x9'));var ejs=require(_0x728c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x728c('0xb'));var crypto=require(_0x728c('0xc'));var jsforce=require(_0x728c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x728c('0x9'));var querystring=require('querystring');var Papa=require(_0x728c('0xe'));var Redis=require(_0x728c('0xf'));var authService=require(_0x728c('0x10'));var qs=require(_0x728c('0x11'));var as=require(_0x728c('0x12'));var hardwareService=require(_0x728c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x728c('0x14'));var config=require(_0x728c('0x15'));var licenseUtil=require(_0x728c('0x16'));var db=require(_0x728c('0x17'))['db'];config[_0x728c('0x18')]=_[_0x728c('0x19')](config[_0x728c('0x18')],{'host':_0x728c('0x1a'),'port':0x18eb});var socket=require(_0x728c('0x1b'))(new Redis(config['redis']));require(_0x728c('0x1c'))[_0x728c('0x1d')](socket);function respondWithStatusCode(_0x5ec169,_0x8afd0b){_0x8afd0b=_0x8afd0b||0xcc;return function(_0x4b5046){if(_0x4b5046){return _0x5ec169[_0x728c('0x1e')](_0x8afd0b);}return _0x5ec169[_0x728c('0x1f')](_0x8afd0b)[_0x728c('0x20')]();};}function respondWithResult(_0x11e97f,_0x8ab394){_0x8ab394=_0x8ab394||0xc8;return function(_0x2b621b){if(_0x2b621b){return _0x11e97f[_0x728c('0x1f')](_0x8ab394)['json'](_0x2b621b);}};}function respondWithFilteredResult(_0x594e64,_0x320b3d){return function(_0x2b18dc){if(_0x2b18dc){var _0x3cdf6b=typeof _0x320b3d[_0x728c('0x21')]===_0x728c('0x22')&&typeof _0x320b3d[_0x728c('0x23')]===_0x728c('0x22');var _0x38fb5c=_0x2b18dc[_0x728c('0x24')];var _0x1440f8=_0x3cdf6b?0x0:_0x320b3d[_0x728c('0x21')];var _0xc1a8e3=_0x3cdf6b?_0x2b18dc[_0x728c('0x24')]:_0x320b3d[_0x728c('0x21')]+_0x320b3d[_0x728c('0x23')];var _0x3178e6;if(_0xc1a8e3>=_0x38fb5c){_0xc1a8e3=_0x38fb5c;_0x3178e6=0xc8;}else{_0x3178e6=0xce;}_0x594e64['status'](_0x3178e6);return _0x594e64[_0x728c('0x25')]('Content-Range',_0x1440f8+'-'+_0xc1a8e3+'/'+_0x38fb5c)[_0x728c('0x26')](_0x2b18dc);}return null;};}function patchUpdates(_0x1a3b51){return function(_0x3a24c8){try{jsonpatch[_0x728c('0x27')](_0x3a24c8,_0x1a3b51,!![]);}catch(_0x48ec9b){return BPromise[_0x728c('0x28')](_0x48ec9b);}return _0x3a24c8[_0x728c('0x29')]();};}function saveUpdates(_0x504b2d,_0x35edd6){return function(_0x505c10){if(_0x505c10){return _0x505c10[_0x728c('0x2a')](_0x504b2d)[_0x728c('0x2b')](function(_0x42cf4f){return _0x42cf4f;});}return null;};}function removeEntity(_0x189ddc,_0x40bb3e){return function(_0x3a4645){if(_0x3a4645){return _0x3a4645[_0x728c('0x2c')]()[_0x728c('0x2b')](function(){_0x189ddc['status'](0xcc)[_0x728c('0x20')]();});}};}function handleEntityNotFound(_0x57a8d1,_0x38ea70){return function(_0x510e56){if(!_0x510e56){_0x57a8d1[_0x728c('0x1e')](0x194);}return _0x510e56;};}function handleError(_0x652ad1,_0x1347f4){_0x1347f4=_0x1347f4||0x1f4;return function(_0x4a8da7){logger[_0x728c('0x2d')](_0x4a8da7[_0x728c('0x2e')]);if(_0x4a8da7[_0x728c('0x2f')]){delete _0x4a8da7[_0x728c('0x2f')];}_0x652ad1['status'](_0x1347f4)[_0x728c('0x30')](_0x4a8da7);};}exports['index']=function(_0x21c7ef,_0x9dc0dd){var _0x49c6eb={},_0x11dc0d={},_0x2e9e9f={'count':0x0,'rows':[]};var _0x12c727=_['map'](db['ChatGroup']['rawAttributes'],function(_0xe340fc){return{'name':_0xe340fc[_0x728c('0x31')],'type':_0xe340fc[_0x728c('0x32')][_0x728c('0x33')]};});_0x11dc0d['model']=_[_0x728c('0x34')](_0x12c727,'name');_0x11dc0d['query']=_[_0x728c('0x35')](_0x21c7ef[_0x728c('0x36')]);_0x11dc0d[_0x728c('0x37')]=_[_0x728c('0x38')](_0x11dc0d[_0x728c('0x39')],_0x11dc0d[_0x728c('0x36')]);_0x49c6eb['attributes']=_[_0x728c('0x38')](_0x11dc0d[_0x728c('0x39')],qs[_0x728c('0x3a')](_0x21c7ef[_0x728c('0x36')][_0x728c('0x3a')]));_0x49c6eb[_0x728c('0x3b')]=_0x49c6eb['attributes'][_0x728c('0x3c')]?_0x49c6eb[_0x728c('0x3b')]:_0x11dc0d[_0x728c('0x39')];if(!_0x21c7ef[_0x728c('0x36')][_0x728c('0x3d')](_0x728c('0x3e'))){_0x49c6eb['limit']=qs[_0x728c('0x23')](_0x21c7ef[_0x728c('0x36')][_0x728c('0x23')]);_0x49c6eb[_0x728c('0x21')]=qs[_0x728c('0x21')](_0x21c7ef[_0x728c('0x36')][_0x728c('0x21')]);}_0x49c6eb[_0x728c('0x3f')]=qs[_0x728c('0x40')](_0x21c7ef[_0x728c('0x36')]['sort']);_0x49c6eb[_0x728c('0x41')]=qs['filters'](_['pick'](_0x21c7ef['query'],_0x11dc0d['filters']),_0x12c727);if(_0x21c7ef[_0x728c('0x36')][_0x728c('0x42')]){_0x49c6eb[_0x728c('0x41')]=_[_0x728c('0x43')](_0x49c6eb[_0x728c('0x41')],{'$or':_[_0x728c('0x34')](_0x12c727,function(_0x12e445){if(_0x12e445[_0x728c('0x32')]!=='VIRTUAL'){var _0x38c7d9={};_0x38c7d9[_0x12e445[_0x728c('0x2f')]]={'$like':'%'+_0x21c7ef[_0x728c('0x36')][_0x728c('0x42')]+'%'};return _0x38c7d9;}})});}_0x49c6eb=_[_0x728c('0x43')]({},_0x49c6eb,_0x21c7ef[_0x728c('0x44')]);var _0x42c751={'where':_0x49c6eb[_0x728c('0x41')]};return db[_0x728c('0x45')][_0x728c('0x24')](_0x42c751)[_0x728c('0x2b')](function(_0x128b78){_0x2e9e9f[_0x728c('0x24')]=_0x128b78;if(_0x21c7ef[_0x728c('0x36')][_0x728c('0x46')]){_0x49c6eb[_0x728c('0x47')]=[{'all':!![]}];}return db[_0x728c('0x45')][_0x728c('0x48')](_0x49c6eb);})[_0x728c('0x2b')](function(_0x44259d){_0x2e9e9f[_0x728c('0x49')]=_0x44259d;return _0x2e9e9f;})[_0x728c('0x2b')](respondWithFilteredResult(_0x9dc0dd,_0x49c6eb))[_0x728c('0x4a')](handleError(_0x9dc0dd,null));};exports['show']=function(_0x1fd311,_0x6e83c0){var _0x1ba3c4={'raw':!![],'where':{'id':_0x1fd311[_0x728c('0x4b')]['id']}},_0x3a9a9a={};_0x3a9a9a['model']=_[_0x728c('0x35')](db[_0x728c('0x45')][_0x728c('0x4c')]);_0x3a9a9a[_0x728c('0x36')]=_[_0x728c('0x35')](_0x1fd311[_0x728c('0x36')]);_0x3a9a9a[_0x728c('0x37')]=_[_0x728c('0x38')](_0x3a9a9a[_0x728c('0x39')],_0x3a9a9a['query']);_0x1ba3c4[_0x728c('0x3b')]=_[_0x728c('0x38')](_0x3a9a9a[_0x728c('0x39')],qs[_0x728c('0x3a')](_0x1fd311[_0x728c('0x36')]['fields']));_0x1ba3c4[_0x728c('0x3b')]=_0x1ba3c4[_0x728c('0x3b')]['length']?_0x1ba3c4['attributes']:_0x3a9a9a[_0x728c('0x39')];if(_0x1fd311[_0x728c('0x36')]['includeAll']){_0x1ba3c4[_0x728c('0x47')]=[{'all':!![]}];}_0x1ba3c4=_[_0x728c('0x43')]({},_0x1ba3c4,_0x1fd311[_0x728c('0x44')]);return db[_0x728c('0x45')][_0x728c('0x4d')](_0x1ba3c4)['then'](handleEntityNotFound(_0x6e83c0,null))['then'](respondWithResult(_0x6e83c0,null))[_0x728c('0x4a')](handleError(_0x6e83c0,null));};exports[_0x728c('0x4e')]=function(_0x6a39a5,_0x3dec30){return db[_0x728c('0x45')]['create'](_0x6a39a5[_0x728c('0x4f')],{})[_0x728c('0x2b')](respondWithResult(_0x3dec30,0xc9))[_0x728c('0x4a')](handleError(_0x3dec30,null));};exports[_0x728c('0x2a')]=function(_0x2c2709,_0x2431e0){if(_0x2c2709[_0x728c('0x4f')]['id']){delete _0x2c2709[_0x728c('0x4f')]['id'];}return db[_0x728c('0x45')][_0x728c('0x4d')]({'where':{'id':_0x2c2709[_0x728c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2431e0,null))[_0x728c('0x2b')](saveUpdates(_0x2c2709['body'],null))[_0x728c('0x2b')](respondWithResult(_0x2431e0,null))[_0x728c('0x4a')](handleError(_0x2431e0,null));};exports[_0x728c('0x2c')]=function(_0x9e7300,_0x509cf1){return db['ChatGroup'][_0x728c('0x4d')]({'where':{'id':_0x9e7300[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x509cf1,null))[_0x728c('0x2b')](removeEntity(_0x509cf1,null))[_0x728c('0x4a')](handleError(_0x509cf1,null));};exports['describe']=function(_0x277764,_0x2a1e04){return db[_0x728c('0x45')][_0x728c('0x50')]()[_0x728c('0x2b')](respondWithResult(_0x2a1e04,null))[_0x728c('0x4a')](handleError(_0x2a1e04,null));};exports[_0x728c('0x51')]=function(_0x48630d,_0x4621c9,_0x2fda2e){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x48630d['params']['id'],'ToId':_0x48630d[_0x728c('0x52')]['id'],'read':![]}})[_0x728c('0x2b')](function(_0x20bc46){return{'id':_[_0x728c('0x53')](_0x48630d['params']['id']),'count':_0x20bc46};})['then'](respondWithResult(_0x4621c9,null))['catch'](handleError(_0x4621c9,null));};exports[_0x728c('0x54')]=function(_0x591d64,_0x38e45a,_0x12e3a3){return db['ChatGroup'][_0x728c('0x4d')]({'where':{'id':_0x591d64[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x38e45a,null))[_0x728c('0x2b')](function(_0x8ef293){if(_0x8ef293){return _0x8ef293[_0x728c('0x54')](_0x591d64[_0x728c('0x4f')]['ids'],_['omit'](_0x591d64[_0x728c('0x4f')],[_0x728c('0x55'),'id'])||{});}})[_0x728c('0x2b')](respondWithResult(_0x38e45a,null))[_0x728c('0x4a')](handleError(_0x38e45a,null));};exports[_0x728c('0x56')]=function(_0x3caec6,_0x2acc95,_0x2dbd2b){var _0x197beb={};var _0x45ee62={};var _0x5e772b;var _0x5f29da;return db[_0x728c('0x45')][_0x728c('0x57')]({'where':{'id':_0x3caec6[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x2acc95,null))[_0x728c('0x2b')](function(_0x2fe8cd){if(_0x2fe8cd){_0x5e772b=_0x2fe8cd;_0x45ee62[_0x728c('0x39')]=_[_0x728c('0x35')](db[_0x728c('0x58')][_0x728c('0x4c')]);_0x45ee62['query']=_[_0x728c('0x35')](_0x3caec6[_0x728c('0x36')]);_0x45ee62[_0x728c('0x37')]=_[_0x728c('0x38')](_0x45ee62['model'],_0x45ee62[_0x728c('0x36')]);_0x197beb[_0x728c('0x3b')]=_[_0x728c('0x38')](_0x45ee62[_0x728c('0x39')],qs[_0x728c('0x3a')](_0x3caec6[_0x728c('0x36')][_0x728c('0x3a')]));_0x197beb[_0x728c('0x3b')]=_0x197beb['attributes'][_0x728c('0x3c')]?_0x197beb[_0x728c('0x3b')]:_0x45ee62[_0x728c('0x39')];_0x197beb[_0x728c('0x3f')]=qs['sort'](_0x3caec6[_0x728c('0x36')][_0x728c('0x40')]);_0x197beb[_0x728c('0x41')]=qs[_0x728c('0x37')](_[_0x728c('0x59')](_0x3caec6['query'],_0x45ee62[_0x728c('0x37')]));if(_0x3caec6[_0x728c('0x36')][_0x728c('0x42')]){_0x197beb[_0x728c('0x41')]=_[_0x728c('0x43')](_0x197beb[_0x728c('0x41')],{'$or':_[_0x728c('0x34')](_0x197beb[_0x728c('0x3b')],function(_0x4d047e){var _0x4b899b={};_0x4b899b[_0x4d047e]={'$like':'%'+_0x3caec6[_0x728c('0x36')][_0x728c('0x42')]+'%'};return _0x4b899b;})});}_0x197beb=_[_0x728c('0x43')]({},_0x197beb,_0x3caec6[_0x728c('0x44')]);return _0x5e772b[_0x728c('0x56')](_0x197beb);}})[_0x728c('0x2b')](function(_0x108adf){if(_0x108adf){_0x5f29da=_0x108adf['length'];if(!_0x3caec6[_0x728c('0x36')]['hasOwnProperty'](_0x728c('0x3e'))){_0x197beb[_0x728c('0x23')]=qs['limit'](_0x3caec6[_0x728c('0x36')][_0x728c('0x23')]);_0x197beb[_0x728c('0x21')]=qs['offset'](_0x3caec6[_0x728c('0x36')][_0x728c('0x21')]);}return _0x5e772b[_0x728c('0x56')](_0x197beb);}})[_0x728c('0x2b')](function(_0x5ce0ca){if(_0x5ce0ca){return _0x5ce0ca?{'count':_0x5f29da,'rows':_0x5ce0ca}:null;}})['then'](respondWithResult(_0x2acc95,null))[_0x728c('0x4a')](handleError(_0x2acc95,null));};exports[_0x728c('0x5a')]=function(_0x3f6cf,_0x4dbd70,_0x447601){return db['ChatGroup'][_0x728c('0x4d')]({'where':{'id':_0x3f6cf[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x4dbd70,null))[_0x728c('0x2b')](function(_0x14889b){if(_0x14889b){return _0x14889b['removeMembers'](_0x3f6cf[_0x728c('0x36')][_0x728c('0x55')]);}})[_0x728c('0x2b')](respondWithStatusCode(_0x4dbd70,null))[_0x728c('0x4a')](handleError(_0x4dbd70,null));};exports[_0x728c('0x5b')]=function(_0x4f6be0,_0x511cae,_0x275e67){if(_0x4f6be0[_0x728c('0x4f')]['id']){delete _0x4f6be0['body']['id'];}return db[_0x728c('0x45')][_0x728c('0x4d')]({'where':{'id':_0x4f6be0[_0x728c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x511cae,null))[_0x728c('0x2b')](function(_0x21dd0b){if(_0x21dd0b){_0x4f6be0[_0x728c('0x4f')]['ChatGroupId']=_0x21dd0b['id'];return db[_0x728c('0x5c')][_0x728c('0x4e')](_0x4f6be0[_0x728c('0x4f')]);}})[_0x728c('0x2b')](respondWithResult(_0x511cae,null))['catch'](handleError(_0x511cae,null));};exports['getMessages']=function(_0x59f627,_0x25a662,_0x16e3c1){var _0x4d1a48={};var _0x33dd0c={};var _0x4d2ac5;var _0x4484b3;return db['ChatGroup'][_0x728c('0x57')]({'where':{'id':_0x59f627[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x25a662,null))[_0x728c('0x2b')](function(_0x1a78bf){if(_0x1a78bf){_0x4d2ac5=_0x1a78bf;_0x33dd0c[_0x728c('0x39')]=_['keys'](db['ChatInternalMessage'][_0x728c('0x4c')]);_0x33dd0c[_0x728c('0x36')]=_[_0x728c('0x35')](_0x59f627[_0x728c('0x36')]);_0x33dd0c[_0x728c('0x37')]=_[_0x728c('0x38')](_0x33dd0c[_0x728c('0x39')],_0x33dd0c[_0x728c('0x36')]);_0x4d1a48[_0x728c('0x3b')]=_['intersection'](_0x33dd0c[_0x728c('0x39')],qs['fields'](_0x59f627[_0x728c('0x36')][_0x728c('0x3a')]));_0x4d1a48[_0x728c('0x3b')]=_0x4d1a48['attributes'][_0x728c('0x3c')]?_0x4d1a48[_0x728c('0x3b')]:_0x33dd0c[_0x728c('0x39')];_0x4d1a48[_0x728c('0x3f')]=qs['sort'](_0x59f627['query'][_0x728c('0x40')]);_0x4d1a48[_0x728c('0x41')]=qs['filters'](_['pick'](_0x59f627['query'],_0x33dd0c[_0x728c('0x37')]));if(_0x59f627[_0x728c('0x36')][_0x728c('0x42')]){_0x4d1a48[_0x728c('0x41')]=_[_0x728c('0x43')](_0x4d1a48['where'],{'$or':_[_0x728c('0x34')](_0x4d1a48[_0x728c('0x3b')],function(_0x418d2d){var _0x496fda={};_0x496fda[_0x418d2d]={'$like':'%'+_0x59f627[_0x728c('0x36')][_0x728c('0x42')]+'%'};return _0x496fda;})});}if(_0x59f627[_0x728c('0x36')][_0x728c('0x5d')]){var _0x5e3af5=_0x59f627[_0x728c('0x36')][_0x728c('0x5d')][_0x728c('0x5e')](',');var _0x15aafa={};_0x15aafa[_0x5e3af5[0x0]]={'$gte':moment(_0x5e3af5[0x1])[_0x728c('0x5f')](_0x728c('0x60'))};_0x4d1a48[_0x728c('0x41')]=_[_0x728c('0x43')](_0x4d1a48[_0x728c('0x41')],_0x15aafa);}_0x4d1a48=_[_0x728c('0x43')]({},_0x4d1a48,_0x59f627[_0x728c('0x44')]);return _0x4d2ac5[_0x728c('0x61')](_0x4d1a48);}})[_0x728c('0x2b')](function(_0xc795b2){if(_0xc795b2){_0x4484b3=_0xc795b2[_0x728c('0x3c')];if(!_0x59f627[_0x728c('0x36')][_0x728c('0x3d')](_0x728c('0x3e'))){_0x4d1a48[_0x728c('0x23')]=qs[_0x728c('0x23')](_0x59f627[_0x728c('0x36')][_0x728c('0x23')]);_0x4d1a48[_0x728c('0x21')]=qs[_0x728c('0x21')](_0x59f627[_0x728c('0x36')][_0x728c('0x21')]);}return _0x4d2ac5['getMessages'](_0x4d1a48);}})['then'](function(_0x19a3d2){if(_0x19a3d2){return _0x19a3d2?{'count':_0x4484b3,'rows':_0x19a3d2}:null;}})[_0x728c('0x2b')](respondWithResult(_0x25a662,null))[_0x728c('0x4a')](handleError(_0x25a662,null));}; \ No newline at end of file +var _0x79a9=['catch','show','params','includeAll','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','getMembers','findOne','User','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','pick','$gte','format','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','rows'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x79a9,0x7a));var _0x979a=function(_0x448c06,_0x363654){_0x448c06=_0x448c06-0x0;var _0x29f030=_0x79a9[_0x448c06];return _0x29f030;};'use strict';var emlformat=require(_0x979a('0x0'));var rimraf=require(_0x979a('0x1'));var zipdir=require(_0x979a('0x2'));var jsonpatch=require(_0x979a('0x3'));var rp=require(_0x979a('0x4'));var moment=require(_0x979a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x979a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x979a('0x7'));var ejs=require(_0x979a('0x8'));var fs=require('fs');var fs_extra=require(_0x979a('0x9'));var _=require(_0x979a('0xa'));var squel=require(_0x979a('0xb'));var crypto=require('crypto');var jsforce=require(_0x979a('0xc'));var deskjs=require(_0x979a('0xd'));var toCsv=require(_0x979a('0x7'));var querystring=require(_0x979a('0xe'));var Papa=require(_0x979a('0xf'));var Redis=require(_0x979a('0x10'));var authService=require(_0x979a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x979a('0x12'));var hardwareService=require(_0x979a('0x13'));var logger=require('../../config/logger')(_0x979a('0x14'));var utils=require('../../config/utils');var config=require(_0x979a('0x15'));var licenseUtil=require(_0x979a('0x16'));var db=require(_0x979a('0x17'))['db'];config['redis']=_[_0x979a('0x18')](config[_0x979a('0x19')],{'host':_0x979a('0x1a'),'port':0x18eb});var socket=require(_0x979a('0x1b'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x979a('0x1c')](socket);function respondWithStatusCode(_0x1e670a,_0x4bcc1a){_0x4bcc1a=_0x4bcc1a||0xcc;return function(_0x4a8ed4){if(_0x4a8ed4){return _0x1e670a[_0x979a('0x1d')](_0x4bcc1a);}return _0x1e670a[_0x979a('0x1e')](_0x4bcc1a)['end']();};}function respondWithResult(_0x499242,_0x4dd63b){_0x4dd63b=_0x4dd63b||0xc8;return function(_0x2780dd){if(_0x2780dd){return _0x499242[_0x979a('0x1e')](_0x4dd63b)[_0x979a('0x1f')](_0x2780dd);}};}function respondWithFilteredResult(_0x5ca699,_0x10a3de){return function(_0x359895){if(_0x359895){var _0x48bba1=typeof _0x10a3de[_0x979a('0x20')]==='undefined'&&typeof _0x10a3de['limit']===_0x979a('0x21');var _0x3a84d5=_0x359895[_0x979a('0x22')];var _0x44a65d=_0x48bba1?0x0:_0x10a3de['offset'];var _0x52b93a=_0x48bba1?_0x359895[_0x979a('0x22')]:_0x10a3de['offset']+_0x10a3de[_0x979a('0x23')];var _0x43fd57;if(_0x52b93a>=_0x3a84d5){_0x52b93a=_0x3a84d5;_0x43fd57=0xc8;}else{_0x43fd57=0xce;}_0x5ca699[_0x979a('0x1e')](_0x43fd57);return _0x5ca699[_0x979a('0x24')](_0x979a('0x25'),_0x44a65d+'-'+_0x52b93a+'/'+_0x3a84d5)[_0x979a('0x1f')](_0x359895);}return null;};}function patchUpdates(_0x4bb4e5){return function(_0x1678a8){try{jsonpatch['apply'](_0x1678a8,_0x4bb4e5,!![]);}catch(_0xbf2dba){return BPromise['reject'](_0xbf2dba);}return _0x1678a8[_0x979a('0x26')]();};}function saveUpdates(_0x2249f8,_0x4134f3){return function(_0x10e972){if(_0x10e972){return _0x10e972[_0x979a('0x27')](_0x2249f8)[_0x979a('0x28')](function(_0x2c1583){return _0x2c1583;});}return null;};}function removeEntity(_0x11ed9a,_0x1dbe9c){return function(_0x5015fd){if(_0x5015fd){return _0x5015fd[_0x979a('0x29')]()[_0x979a('0x28')](function(){_0x11ed9a[_0x979a('0x1e')](0xcc)[_0x979a('0x2a')]();});}};}function handleEntityNotFound(_0x551a04,_0x6e77f){return function(_0x468c1c){if(!_0x468c1c){_0x551a04[_0x979a('0x1d')](0x194);}return _0x468c1c;};}function handleError(_0xea8e68,_0x3c0966){_0x3c0966=_0x3c0966||0x1f4;return function(_0x11fdd9){logger[_0x979a('0x2b')](_0x11fdd9[_0x979a('0x2c')]);if(_0x11fdd9[_0x979a('0x2d')]){delete _0x11fdd9[_0x979a('0x2d')];}_0xea8e68['status'](_0x3c0966)[_0x979a('0x2e')](_0x11fdd9);};}exports[_0x979a('0x2f')]=function(_0xcddd8c,_0xd17a7f){var _0x41be30={},_0x59a12e={},_0xa8241e={'count':0x0,'rows':[]};var _0x4cc42c=_[_0x979a('0x30')](db[_0x979a('0x31')][_0x979a('0x32')],function(_0x12b868){return{'name':_0x12b868[_0x979a('0x33')],'type':_0x12b868[_0x979a('0x34')][_0x979a('0x35')]};});_0x59a12e[_0x979a('0x36')]=_[_0x979a('0x30')](_0x4cc42c,_0x979a('0x2d'));_0x59a12e[_0x979a('0x37')]=_[_0x979a('0x38')](_0xcddd8c[_0x979a('0x37')]);_0x59a12e[_0x979a('0x39')]=_[_0x979a('0x3a')](_0x59a12e[_0x979a('0x36')],_0x59a12e[_0x979a('0x37')]);_0x41be30[_0x979a('0x3b')]=_[_0x979a('0x3a')](_0x59a12e[_0x979a('0x36')],qs[_0x979a('0x3c')](_0xcddd8c[_0x979a('0x37')]['fields']));_0x41be30[_0x979a('0x3b')]=_0x41be30[_0x979a('0x3b')][_0x979a('0x3d')]?_0x41be30[_0x979a('0x3b')]:_0x59a12e[_0x979a('0x36')];if(!_0xcddd8c['query'][_0x979a('0x3e')]('nolimit')){_0x41be30[_0x979a('0x23')]=qs[_0x979a('0x23')](_0xcddd8c[_0x979a('0x37')]['limit']);_0x41be30['offset']=qs[_0x979a('0x20')](_0xcddd8c[_0x979a('0x37')]['offset']);}_0x41be30[_0x979a('0x3f')]=qs['sort'](_0xcddd8c[_0x979a('0x37')][_0x979a('0x40')]);_0x41be30['where']=qs['filters'](_['pick'](_0xcddd8c[_0x979a('0x37')],_0x59a12e['filters']),_0x4cc42c);if(_0xcddd8c[_0x979a('0x37')][_0x979a('0x41')]){_0x41be30[_0x979a('0x42')]=_[_0x979a('0x43')](_0x41be30[_0x979a('0x42')],{'$or':_[_0x979a('0x30')](_0x4cc42c,function(_0x251d78){if(_0x251d78['type']!==_0x979a('0x44')){var _0x4c172d={};_0x4c172d[_0x251d78['name']]={'$like':'%'+_0xcddd8c['query']['filter']+'%'};return _0x4c172d;}})});}_0x41be30=_[_0x979a('0x43')]({},_0x41be30,_0xcddd8c[_0x979a('0x45')]);var _0x429d32={'where':_0x41be30[_0x979a('0x42')]};return db['ChatGroup'][_0x979a('0x22')](_0x429d32)[_0x979a('0x28')](function(_0x42dbfe){_0xa8241e[_0x979a('0x22')]=_0x42dbfe;if(_0xcddd8c['query']['includeAll']){_0x41be30[_0x979a('0x46')]=[{'all':!![]}];}return db[_0x979a('0x31')]['findAll'](_0x41be30);})[_0x979a('0x28')](function(_0x17e805){_0xa8241e[_0x979a('0x47')]=_0x17e805;return _0xa8241e;})['then'](respondWithFilteredResult(_0xd17a7f,_0x41be30))[_0x979a('0x48')](handleError(_0xd17a7f,null));};exports[_0x979a('0x49')]=function(_0x496991,_0x2640ea){var _0x5567a1={'raw':!![],'where':{'id':_0x496991[_0x979a('0x4a')]['id']}},_0x5730e7={};_0x5730e7[_0x979a('0x36')]=_[_0x979a('0x38')](db[_0x979a('0x31')][_0x979a('0x32')]);_0x5730e7[_0x979a('0x37')]=_['keys'](_0x496991[_0x979a('0x37')]);_0x5730e7[_0x979a('0x39')]=_[_0x979a('0x3a')](_0x5730e7[_0x979a('0x36')],_0x5730e7['query']);_0x5567a1[_0x979a('0x3b')]=_[_0x979a('0x3a')](_0x5730e7[_0x979a('0x36')],qs[_0x979a('0x3c')](_0x496991[_0x979a('0x37')][_0x979a('0x3c')]));_0x5567a1['attributes']=_0x5567a1[_0x979a('0x3b')][_0x979a('0x3d')]?_0x5567a1[_0x979a('0x3b')]:_0x5730e7[_0x979a('0x36')];if(_0x496991[_0x979a('0x37')][_0x979a('0x4b')]){_0x5567a1[_0x979a('0x46')]=[{'all':!![]}];}_0x5567a1=_[_0x979a('0x43')]({},_0x5567a1,_0x496991['options']);return db[_0x979a('0x31')][_0x979a('0x4c')](_0x5567a1)['then'](handleEntityNotFound(_0x2640ea,null))[_0x979a('0x28')](respondWithResult(_0x2640ea,null))[_0x979a('0x48')](handleError(_0x2640ea,null));};exports[_0x979a('0x4d')]=function(_0x4012f0,_0x23ea5b){return db[_0x979a('0x31')][_0x979a('0x4d')](_0x4012f0[_0x979a('0x4e')],{})[_0x979a('0x28')](respondWithResult(_0x23ea5b,0xc9))[_0x979a('0x48')](handleError(_0x23ea5b,null));};exports[_0x979a('0x27')]=function(_0x521802,_0x5d4519){if(_0x521802['body']['id']){delete _0x521802['body']['id'];}return db[_0x979a('0x31')][_0x979a('0x4c')]({'where':{'id':_0x521802['params']['id']}})[_0x979a('0x28')](handleEntityNotFound(_0x5d4519,null))[_0x979a('0x28')](saveUpdates(_0x521802[_0x979a('0x4e')],null))['then'](respondWithResult(_0x5d4519,null))[_0x979a('0x48')](handleError(_0x5d4519,null));};exports[_0x979a('0x29')]=function(_0x5c6e49,_0x30d3c2){return db[_0x979a('0x31')][_0x979a('0x4c')]({'where':{'id':_0x5c6e49[_0x979a('0x4a')]['id']}})[_0x979a('0x28')](handleEntityNotFound(_0x30d3c2,null))[_0x979a('0x28')](removeEntity(_0x30d3c2,null))[_0x979a('0x48')](handleError(_0x30d3c2,null));};exports[_0x979a('0x4f')]=function(_0x70e87e,_0x132a51){return db['ChatGroup'][_0x979a('0x4f')]()[_0x979a('0x28')](respondWithResult(_0x132a51,null))[_0x979a('0x48')](handleError(_0x132a51,null));};exports[_0x979a('0x50')]=function(_0x1b6953,_0x4de06f,_0x26c74c){return db['ChatInternalMessage'][_0x979a('0x22')]({'where':{'ChatGroupId':_0x1b6953[_0x979a('0x4a')]['id'],'ToId':_0x1b6953[_0x979a('0x51')]['id'],'read':![]}})[_0x979a('0x28')](function(_0x40fe69){return{'id':_[_0x979a('0x52')](_0x1b6953['params']['id']),'count':_0x40fe69};})[_0x979a('0x28')](respondWithResult(_0x4de06f,null))[_0x979a('0x48')](handleError(_0x4de06f,null));};exports[_0x979a('0x53')]=function(_0x1f19bc,_0x263e42,_0x5835b9){return db[_0x979a('0x31')][_0x979a('0x4c')]({'where':{'id':_0x1f19bc[_0x979a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x263e42,null))['then'](function(_0x2575d4){if(_0x2575d4){return _0x2575d4[_0x979a('0x53')](_0x1f19bc[_0x979a('0x4e')][_0x979a('0x54')],_['omit'](_0x1f19bc[_0x979a('0x4e')],[_0x979a('0x54'),'id'])||{});}})[_0x979a('0x28')](respondWithResult(_0x263e42,null))[_0x979a('0x48')](handleError(_0x263e42,null));};exports[_0x979a('0x55')]=function(_0x514c46,_0x212f30,_0x2b2808){var _0x4c05a6={};var _0x5c9cc2={};var _0x2b5da3;var _0x3d8562;return db[_0x979a('0x31')][_0x979a('0x56')]({'where':{'id':_0x514c46[_0x979a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x212f30,null))[_0x979a('0x28')](function(_0x3f1324){if(_0x3f1324){_0x2b5da3=_0x3f1324;_0x5c9cc2[_0x979a('0x36')]=_[_0x979a('0x38')](db[_0x979a('0x57')][_0x979a('0x32')]);_0x5c9cc2[_0x979a('0x37')]=_['keys'](_0x514c46[_0x979a('0x37')]);_0x5c9cc2['filters']=_[_0x979a('0x3a')](_0x5c9cc2[_0x979a('0x36')],_0x5c9cc2[_0x979a('0x37')]);_0x4c05a6[_0x979a('0x3b')]=_[_0x979a('0x3a')](_0x5c9cc2['model'],qs['fields'](_0x514c46[_0x979a('0x37')][_0x979a('0x3c')]));_0x4c05a6['attributes']=_0x4c05a6[_0x979a('0x3b')][_0x979a('0x3d')]?_0x4c05a6['attributes']:_0x5c9cc2[_0x979a('0x36')];_0x4c05a6[_0x979a('0x3f')]=qs['sort'](_0x514c46['query'][_0x979a('0x40')]);_0x4c05a6['where']=qs[_0x979a('0x39')](_['pick'](_0x514c46['query'],_0x5c9cc2[_0x979a('0x39')]));if(_0x514c46[_0x979a('0x37')][_0x979a('0x41')]){_0x4c05a6[_0x979a('0x42')]=_[_0x979a('0x43')](_0x4c05a6[_0x979a('0x42')],{'$or':_[_0x979a('0x30')](_0x4c05a6['attributes'],function(_0x2a902f){var _0xba68d4={};_0xba68d4[_0x2a902f]={'$like':'%'+_0x514c46[_0x979a('0x37')][_0x979a('0x41')]+'%'};return _0xba68d4;})});}_0x4c05a6=_[_0x979a('0x43')]({},_0x4c05a6,_0x514c46[_0x979a('0x45')]);return _0x2b5da3[_0x979a('0x55')](_0x4c05a6);}})[_0x979a('0x28')](function(_0x152f65){if(_0x152f65){_0x3d8562=_0x152f65['length'];if(!_0x514c46[_0x979a('0x37')][_0x979a('0x3e')](_0x979a('0x58'))){_0x4c05a6['limit']=qs[_0x979a('0x23')](_0x514c46[_0x979a('0x37')][_0x979a('0x23')]);_0x4c05a6['offset']=qs[_0x979a('0x20')](_0x514c46[_0x979a('0x37')]['offset']);}return _0x2b5da3['getMembers'](_0x4c05a6);}})[_0x979a('0x28')](function(_0x476eae){if(_0x476eae){return _0x476eae?{'count':_0x3d8562,'rows':_0x476eae}:null;}})[_0x979a('0x28')](respondWithResult(_0x212f30,null))[_0x979a('0x48')](handleError(_0x212f30,null));};exports[_0x979a('0x59')]=function(_0x53a417,_0x3aed71,_0x301926){return db[_0x979a('0x31')][_0x979a('0x4c')]({'where':{'id':_0x53a417[_0x979a('0x4a')]['id']}})[_0x979a('0x28')](handleEntityNotFound(_0x3aed71,null))[_0x979a('0x28')](function(_0x1baf98){if(_0x1baf98){return _0x1baf98[_0x979a('0x59')](_0x53a417[_0x979a('0x37')][_0x979a('0x54')]);}})[_0x979a('0x28')](respondWithStatusCode(_0x3aed71,null))[_0x979a('0x48')](handleError(_0x3aed71,null));};exports[_0x979a('0x5a')]=function(_0x58d74a,_0x467c2c,_0x31d412){if(_0x58d74a['body']['id']){delete _0x58d74a[_0x979a('0x4e')]['id'];}return db[_0x979a('0x31')][_0x979a('0x4c')]({'where':{'id':_0x58d74a['params']['id']}})[_0x979a('0x28')](handleEntityNotFound(_0x467c2c,null))['then'](function(_0x13b27d){if(_0x13b27d){_0x58d74a[_0x979a('0x4e')][_0x979a('0x5b')]=_0x13b27d['id'];return db['ChatInternalMessage']['create'](_0x58d74a[_0x979a('0x4e')]);}})['then'](respondWithResult(_0x467c2c,null))['catch'](handleError(_0x467c2c,null));};exports['getMessages']=function(_0xa596d7,_0x14d824,_0x20f47e){var _0x3c2b10={};var _0x21023b={};var _0x551094;var _0x3fc648;return db[_0x979a('0x31')]['findOne']({'where':{'id':_0xa596d7[_0x979a('0x4a')]['id']}})[_0x979a('0x28')](handleEntityNotFound(_0x14d824,null))[_0x979a('0x28')](function(_0x8cdd4){if(_0x8cdd4){_0x551094=_0x8cdd4;_0x21023b[_0x979a('0x36')]=_[_0x979a('0x38')](db[_0x979a('0x5c')][_0x979a('0x32')]);_0x21023b[_0x979a('0x37')]=_[_0x979a('0x38')](_0xa596d7['query']);_0x21023b[_0x979a('0x39')]=_[_0x979a('0x3a')](_0x21023b[_0x979a('0x36')],_0x21023b[_0x979a('0x37')]);_0x3c2b10['attributes']=_['intersection'](_0x21023b[_0x979a('0x36')],qs[_0x979a('0x3c')](_0xa596d7[_0x979a('0x37')][_0x979a('0x3c')]));_0x3c2b10[_0x979a('0x3b')]=_0x3c2b10[_0x979a('0x3b')]['length']?_0x3c2b10[_0x979a('0x3b')]:_0x21023b[_0x979a('0x36')];_0x3c2b10[_0x979a('0x3f')]=qs[_0x979a('0x40')](_0xa596d7[_0x979a('0x37')][_0x979a('0x40')]);_0x3c2b10[_0x979a('0x42')]=qs['filters'](_[_0x979a('0x5d')](_0xa596d7[_0x979a('0x37')],_0x21023b['filters']));if(_0xa596d7[_0x979a('0x37')]['filter']){_0x3c2b10['where']=_['merge'](_0x3c2b10[_0x979a('0x42')],{'$or':_[_0x979a('0x30')](_0x3c2b10[_0x979a('0x3b')],function(_0x496c46){var _0x5968d8={};_0x5968d8[_0x496c46]={'$like':'%'+_0xa596d7[_0x979a('0x37')]['filter']+'%'};return _0x5968d8;})});}if(_0xa596d7[_0x979a('0x37')][_0x979a('0x5e')]){var _0x4fe262=_0xa596d7['query'][_0x979a('0x5e')]['split'](',');var _0x1b7d61={};_0x1b7d61[_0x4fe262[0x0]]={'$gte':moment(_0x4fe262[0x1])[_0x979a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3c2b10[_0x979a('0x42')]=_[_0x979a('0x43')](_0x3c2b10[_0x979a('0x42')],_0x1b7d61);}_0x3c2b10=_[_0x979a('0x43')]({},_0x3c2b10,_0xa596d7['options']);return _0x551094[_0x979a('0x60')](_0x3c2b10);}})[_0x979a('0x28')](function(_0xf60a4d){if(_0xf60a4d){_0x3fc648=_0xf60a4d[_0x979a('0x3d')];if(!_0xa596d7[_0x979a('0x37')][_0x979a('0x3e')]('nolimit')){_0x3c2b10['limit']=qs[_0x979a('0x23')](_0xa596d7[_0x979a('0x37')][_0x979a('0x23')]);_0x3c2b10[_0x979a('0x20')]=qs['offset'](_0xa596d7[_0x979a('0x37')][_0x979a('0x20')]);}return _0x551094[_0x979a('0x60')](_0x3c2b10);}})[_0x979a('0x28')](function(_0x3dc27e){if(_0x3dc27e){return _0x3dc27e?{'count':_0x3fc648,'rows':_0x3dc27e}:null;}})[_0x979a('0x28')](respondWithResult(_0x14d824,null))[_0x979a('0x48')](handleError(_0x14d824,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e855f55..92bb089 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 _0xfba2=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1c5896,_0x34e0b1){var _0x91aaff=function(_0x2f05bf){while(--_0x2f05bf){_0x1c5896['push'](_0x1c5896['shift']());}};_0x91aaff(++_0x34e0b1);}(_0xfba2,0xf9));var _0x2fba=function(_0x1d751f,_0xcac928){_0x1d751f=_0x1d751f-0x0;var _0x162d5f=_0xfba2[_0x1d751f];return _0x162d5f;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2fba('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2fba('0x1')](0x0);var events={'afterCreate':_0x2fba('0x2'),'afterUpdate':_0x2fba('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2db851){return function(_0x3eef22,_0x233e9c,_0x16c6ed){ChatGroupEvents[_0x2fba('0x4')](_0x2db851+':'+_0x3eef22['id'],_0x3eef22);ChatGroupEvents['emit'](_0x2db851,_0x3eef22);_0x16c6ed(null);};}for(var e in events){if(events[_0x2fba('0x5')](e)){var event=events[e];ChatGroup[_0x2fba('0x6')](e,emitEvent(event));}}module[_0x2fba('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x157f=['emit','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4d88f6,_0x52f758){var _0x2041c8=function(_0x16f556){while(--_0x16f556){_0x4d88f6['push'](_0x4d88f6['shift']());}};_0x2041c8(++_0x52f758);}(_0x157f,0xd2));var _0xf157=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x157f[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xf157('0x0'));var ChatGroup=require(_0xf157('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf157('0x2')](0x0);var events={'afterCreate':_0xf157('0x3'),'afterUpdate':_0xf157('0x4'),'afterDestroy':_0xf157('0x5')};function emitEvent(_0x19d725){return function(_0x6920cf,_0x34a187,_0x248c09){ChatGroupEvents[_0xf157('0x6')](_0x19d725+':'+_0x6920cf['id'],_0x6920cf);ChatGroupEvents[_0xf157('0x6')](_0x19d725,_0x6920cf);_0x248c09(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xf157('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 1fae7cb..38c0bb4 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 _0xfa2b=['moment','bluebird','request-promise','path','rimraf','exports','ChatGroup','lodash','util','../../config/logger','api'];(function(_0x165ec6,_0x2d6664){var _0x3c475a=function(_0x4ebfdd){while(--_0x4ebfdd){_0x165ec6['push'](_0x165ec6['shift']());}};_0x3c475a(++_0x2d6664);}(_0xfa2b,0x1ca));var _0xbfa2=function(_0x3b0bb4,_0x32a3ac){_0x3b0bb4=_0x3b0bb4-0x0;var _0x57e927=_0xfa2b[_0x3b0bb4];return _0x57e927;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var logger=require(_0xbfa2('0x2'))(_0xbfa2('0x3'));var moment=require(_0xbfa2('0x4'));var BPromise=require(_0xbfa2('0x5'));var rp=require(_0xbfa2('0x6'));var fs=require('fs');var path=require(_0xbfa2('0x7'));var rimraf=require(_0xbfa2('0x8'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xbfa2('0x9')]=function(_0x2fdd37,_0x39f154){return _0x2fdd37['define'](_0xbfa2('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d9b=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define'];(function(_0x6cf3b6,_0x4b7560){var _0xdbe948=function(_0x1504d6){while(--_0x1504d6){_0x6cf3b6['push'](_0x6cf3b6['shift']());}};_0xdbe948(++_0x4b7560);}(_0x2d9b,0x19a));var _0xb2d9=function(_0x3d77d9,_0x19e90a){_0x3d77d9=_0x3d77d9-0x0;var _0x2a12a0=_0x2d9b[_0x3d77d9];return _0x2a12a0;};'use strict';var _=require(_0xb2d9('0x0'));var util=require('util');var logger=require(_0xb2d9('0x1'))('api');var moment=require(_0xb2d9('0x2'));var BPromise=require(_0xb2d9('0x3'));var rp=require(_0xb2d9('0x4'));var fs=require('fs');var path=require(_0xb2d9('0x5'));var rimraf=require(_0xb2d9('0x6'));var config=require('../../config/environment');var attributes=require(_0xb2d9('0x7'));module[_0xb2d9('0x8')]=function(_0x2b2822,_0x462635){return _0x2b2822[_0xb2d9('0x9')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 3447f31..e906121 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 _0x3204=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xc844cd,_0x1d55f8){var _0xb85fc7=function(_0xb0b367){while(--_0xb0b367){_0xc844cd['push'](_0xc844cd['shift']());}};_0xb85fc7(++_0x1d55f8);}(_0x3204,0x12e));var _0x4320=function(_0x43a8ff,_0x28ee24){_0x43a8ff=_0x43a8ff-0x0;var _0x44558b=_0x3204[_0x43a8ff];return _0x44558b;};'use strict';var _=require(_0x4320('0x0'));var util=require(_0x4320('0x1'));var moment=require(_0x4320('0x2'));var BPromise=require(_0x4320('0x3'));var rs=require(_0x4320('0x4'));var fs=require('fs');var Redis=require(_0x4320('0x5'));var db=require(_0x4320('0x6'))['db'];var utils=require(_0x4320('0x7'));var logger=require(_0x4320('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4320('0x9'));var client=jayson[_0x4320('0xa')][_0x4320('0xb')]({'port':0x232a});config[_0x4320('0xc')]=_[_0x4320('0xd')](config[_0x4320('0xc')],{'host':_0x4320('0xe'),'port':0x18eb});var socket=require(_0x4320('0xf'))(new Redis(config[_0x4320('0xc')]));require('./chatGroup.socket')[_0x4320('0x10')](socket);function respondWithRpcPromise(_0x2b8f99,_0x33a378,_0x245419){return new BPromise(function(_0x5142c8,_0x3cc8cd){return client[_0x4320('0x11')](_0x2b8f99,_0x245419)['then'](function(_0x505b60){logger['info'](_0x4320('0x12'),_0x33a378,_0x4320('0x13'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x33a378,_0x4320('0x13'),JSON[_0x4320('0x14')](_0x505b60));if(_0x505b60[_0x4320('0x15')]){if(_0x505b60[_0x4320('0x15')][_0x4320('0x16')]===0x1f4){logger[_0x4320('0x15')]('ChatGroup,\x20%s,\x20%s',_0x33a378,_0x505b60['error'][_0x4320('0x17')]);return _0x3cc8cd(_0x505b60[_0x4320('0x15')][_0x4320('0x17')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x33a378,_0x505b60['error'][_0x4320('0x17')]);return _0x5142c8(_0x505b60[_0x4320('0x15')][_0x4320('0x17')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x33a378,_0x4320('0x13'));_0x5142c8(_0x505b60[_0x4320('0x18')][_0x4320('0x17')]);}})['catch'](function(_0x436e6d){logger['error'](_0x4320('0x12'),_0x33a378,_0x436e6d);_0x3cc8cd(_0x436e6d);});});} \ No newline at end of file +var _0xc688=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','defaults','socket.io-emitter','redis','register','then','info','request\x20sent'];(function(_0x42f1eb,_0x5364a2){var _0x51ac7f=function(_0x40b1c0){while(--_0x40b1c0){_0x42f1eb['push'](_0x42f1eb['shift']());}};_0x51ac7f(++_0x5364a2);}(_0xc688,0xc0));var _0x8c68=function(_0x4e9552,_0x2c65b5){_0x4e9552=_0x4e9552-0x0;var _0x27fd4a=_0xc688[_0x4e9552];return _0x27fd4a;};'use strict';var _=require(_0x8c68('0x0'));var util=require(_0x8c68('0x1'));var moment=require('moment');var BPromise=require(_0x8c68('0x2'));var rs=require(_0x8c68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c68('0x4'))['db'];var utils=require(_0x8c68('0x5'));var logger=require('../../config/logger')(_0x8c68('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c68('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8c68('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8c68('0x9'))(new Redis(config[_0x8c68('0xa')]));require('./chatGroup.socket')[_0x8c68('0xb')](socket);function respondWithRpcPromise(_0x531bf2,_0xc29a6e,_0x150f09){return new BPromise(function(_0xcb9bee,_0x96f2f1){return client['request'](_0x531bf2,_0x150f09)[_0x8c68('0xc')](function(_0x3c97ea){logger[_0x8c68('0xd')]('ChatGroup,\x20%s,\x20%s',_0xc29a6e,_0x8c68('0xe'));logger[_0x8c68('0xf')](_0x8c68('0x10'),_0xc29a6e,_0x8c68('0xe'),JSON[_0x8c68('0x11')](_0x3c97ea));if(_0x3c97ea[_0x8c68('0x12')]){if(_0x3c97ea[_0x8c68('0x12')][_0x8c68('0x13')]===0x1f4){logger[_0x8c68('0x12')]('ChatGroup,\x20%s,\x20%s',_0xc29a6e,_0x3c97ea[_0x8c68('0x12')]['message']);return _0x96f2f1(_0x3c97ea[_0x8c68('0x12')]['message']);}logger['error'](_0x8c68('0x14'),_0xc29a6e,_0x3c97ea['error'][_0x8c68('0x15')]);return _0xcb9bee(_0x3c97ea[_0x8c68('0x12')][_0x8c68('0x15')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0xc29a6e,_0x8c68('0xe'));_0xcb9bee(_0x3c97ea['result'][_0x8c68('0x15')]);}})[_0x8c68('0x16')](function(_0x1b6e32){logger['error'](_0x8c68('0x14'),_0xc29a6e,_0x1b6e32);_0x96f2f1(_0x1b6e32);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index b9fdd2d..d8b6c14 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 _0x156d=['./chatGroup.events','save','remove','update','register','length','chatGroup:'];(function(_0xd3b64b,_0x189e4a){var _0x4d24ab=function(_0x9efedf){while(--_0x9efedf){_0xd3b64b['push'](_0xd3b64b['shift']());}};_0x4d24ab(++_0x189e4a);}(_0x156d,0x1c0));var _0xd156=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x156d[_0x4b369d];return _0x571a98;};'use strict';var ChatGroupEvents=require(_0xd156('0x0'));var events=[_0xd156('0x1'),_0xd156('0x2'),_0xd156('0x3')];function createListener(_0xec20ea,_0x256dd3){return function(_0x4b7a40){_0x256dd3['emit'](_0xec20ea,_0x4b7a40);};}function removeListener(_0xeed629,_0x3280a8){return function(){ChatGroupEvents['removeListener'](_0xeed629,_0x3280a8);};}exports[_0xd156('0x4')]=function(_0x5ce1d6){for(var _0x157a77=0x0,_0x258561=events[_0xd156('0x5')];_0x157a77<_0x258561;_0x157a77++){var _0x23ed99=events[_0x157a77];var _0x44cc2b=createListener(_0xd156('0x6')+_0x23ed99,_0x5ce1d6);ChatGroupEvents['on'](_0x23ed99,_0x44cc2b);}}; \ No newline at end of file +var _0x4711=['./chatGroup.events','save','remove','emit','removeListener','register','chatGroup:'];(function(_0x56464a,_0x3551ba){var _0x25a4a9=function(_0x1bf19d){while(--_0x1bf19d){_0x56464a['push'](_0x56464a['shift']());}};_0x25a4a9(++_0x3551ba);}(_0x4711,0x70));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var ChatGroupEvents=require(_0x1471('0x0'));var events=[_0x1471('0x1'),_0x1471('0x2'),'update'];function createListener(_0x486e4f,_0x36da61){return function(_0x33d7ac){_0x36da61[_0x1471('0x3')](_0x486e4f,_0x33d7ac);};}function removeListener(_0x1dba49,_0x29e02e){return function(){ChatGroupEvents[_0x1471('0x4')](_0x1dba49,_0x29e02e);};}exports[_0x1471('0x5')]=function(_0x562387){for(var _0x15db41=0x0,_0x89dd0=events['length'];_0x15db41<_0x89dd0;_0x15db41++){var _0x1ec66b=events[_0x15db41];var _0x4bd634=createListener(_0x1471('0x6')+_0x1ec66b,_0x562387);ChatGroupEvents['on'](_0x1ec66b,_0x4bd634);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1072bb8..028442a 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 _0x47f7=['./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','post','create','addMembers','put','update','delete','removeMembers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2efd54,_0x241172){var _0x3f923e=function(_0x3cfd1d){while(--_0x3cfd1d){_0x2efd54['push'](_0x2efd54['shift']());}};_0x3f923e(++_0x241172);}(_0x47f7,0x17f));var _0x747f=function(_0x36ac6b,_0x5eba33){_0x36ac6b=_0x36ac6b-0x0;var _0x3068db=_0x47f7[_0x36ac6b];return _0x3068db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x747f('0x0'));var timeout=require(_0x747f('0x1'));var express=require(_0x747f('0x2'));var router=express[_0x747f('0x3')]();var fs_extra=require(_0x747f('0x4'));var auth=require(_0x747f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x747f('0x6'));var controller=require(_0x747f('0x7'));router[_0x747f('0x8')]('/',auth[_0x747f('0x9')](),controller['index']);router[_0x747f('0x8')](_0x747f('0xa'),auth[_0x747f('0x9')](),controller[_0x747f('0xb')]);router[_0x747f('0x8')](_0x747f('0xc'),auth[_0x747f('0x9')](),controller[_0x747f('0xd')]);router[_0x747f('0x8')](_0x747f('0xe'),auth[_0x747f('0x9')](),controller[_0x747f('0xf')]);router[_0x747f('0x8')](_0x747f('0x10'),auth[_0x747f('0x9')](),controller['getMembers']);router[_0x747f('0x8')](_0x747f('0x11'),auth[_0x747f('0x9')](),controller['getMessages']);router[_0x747f('0x12')]('/',auth[_0x747f('0x9')](),controller[_0x747f('0x13')]);router[_0x747f('0x12')](_0x747f('0x10'),auth[_0x747f('0x9')](),controller[_0x747f('0x14')]);router[_0x747f('0x12')](_0x747f('0x11'),auth[_0x747f('0x9')](),controller['addMessage']);router[_0x747f('0x15')](_0x747f('0xc'),auth['isAuthenticated'](),controller[_0x747f('0x16')]);router[_0x747f('0x17')](_0x747f('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/members',auth[_0x747f('0x9')](),controller[_0x747f('0x18')]);module[_0x747f('0x19')]=router; \ No newline at end of file +var _0xddd2=['create','post','addMembers','addMessage','put','update','/:id','destroy','delete','removeMembers','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages'];(function(_0x4c6df4,_0x503373){var _0x2409c3=function(_0x22a0cf){while(--_0x22a0cf){_0x4c6df4['push'](_0x4c6df4['shift']());}};_0x2409c3(++_0x503373);}(_0xddd2,0xfb));var _0x2ddd=function(_0x1f3e80,_0x19e38f){_0x1f3e80=_0x1f3e80-0x0;var _0x4455a2=_0xddd2[_0x1f3e80];return _0x4455a2;};'use strict';var multer=require(_0x2ddd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ddd('0x1'));var express=require(_0x2ddd('0x2'));var router=express['Router']();var fs_extra=require(_0x2ddd('0x3'));var auth=require(_0x2ddd('0x4'));var interaction=require(_0x2ddd('0x5'));var config=require(_0x2ddd('0x6'));var controller=require(_0x2ddd('0x7'));router[_0x2ddd('0x8')]('/',auth[_0x2ddd('0x9')](),controller[_0x2ddd('0xa')]);router[_0x2ddd('0x8')](_0x2ddd('0xb'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0xc')]);router[_0x2ddd('0x8')]('/:id',auth[_0x2ddd('0x9')](),controller[_0x2ddd('0xd')]);router[_0x2ddd('0x8')](_0x2ddd('0xe'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0xf')]);router[_0x2ddd('0x8')]('/:id/members',auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x10')]);router[_0x2ddd('0x8')](_0x2ddd('0x11'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x12')]);router['post']('/',auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x13')]);router[_0x2ddd('0x14')]('/:id/members',auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x15')]);router[_0x2ddd('0x14')](_0x2ddd('0x11'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x16')]);router[_0x2ddd('0x17')]('/:id',auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x18')]);router['delete'](_0x2ddd('0x19'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x1a')]);router[_0x2ddd('0x1b')]('/:id/members',auth['isAuthenticated'](),controller[_0x2ddd('0x1c')]);module[_0x2ddd('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2001151..0d5c683 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 _0x0ed1=['out','BOOLEAN','INTEGER','exports','ENUM','star','TEXT','STRING','DATE','long'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x0ed1,0x99));var _0x10ed=function(_0x29854a,_0x4d43bb){_0x29854a=_0x29854a-0x0;var _0x357e4b=_0x0ed1[_0x29854a];return _0x357e4b;};'use strict';var Sequelize=require('sequelize');module[_0x10ed('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x10ed('0x1')](_0x10ed('0x2'),'thumb'),'defaultValue':_0x10ed('0x2')},'ratingMessage':{'type':Sequelize[_0x10ed('0x3')]},'pathTranscript':{'type':Sequelize[_0x10ed('0x3')]},'mailTranscript':{'type':Sequelize[_0x10ed('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x10ed('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x10ed('0x4')]},'thirdDisposition':{'type':Sequelize[_0x10ed('0x4')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x10ed('0x4')]},'browserVersion':{'type':Sequelize[_0x10ed('0x4')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x10ed('0x4')]},'deviceModel':{'type':Sequelize[_0x10ed('0x4')]},'deviceVendor':{'type':Sequelize[_0x10ed('0x4')]},'deviceType':{'type':Sequelize[_0x10ed('0x4')]},'referer':{'type':Sequelize[_0x10ed('0x3')]},'customerIp':{'type':Sequelize[_0x10ed('0x4')]},'formData':{'type':Sequelize[_0x10ed('0x3')](_0x10ed('0x6'))},'read1stAt':{'type':Sequelize[_0x10ed('0x5')]},'lastMsgAt':{'type':Sequelize[_0x10ed('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x10ed('0x1')]('in',_0x10ed('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x10ed('0x4')]},'customerPort':{'type':Sequelize[_0x10ed('0x4')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x10ed('0x8')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x10ed('0x9')]}}; \ No newline at end of file +var _0x30bb=['BOOLEAN','INTEGER','thumb','star','TEXT','DATE','STRING','long','out'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x30bb,0xfd));var _0xb30b=function(_0x513c7d,_0x2b5369){_0x513c7d=_0x513c7d-0x0;var _0x59722=_0x30bb[_0x513c7d];return _0x59722;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb30b('0x0')]},'ratingType':{'type':Sequelize['ENUM']('star',_0xb30b('0x1')),'defaultValue':_0xb30b('0x2')},'ratingMessage':{'type':Sequelize[_0xb30b('0x3')]},'pathTranscript':{'type':Sequelize[_0xb30b('0x3')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb30b('0x4')]},'disposition':{'type':Sequelize[_0xb30b('0x5')]},'secondDisposition':{'type':Sequelize[_0xb30b('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb30b('0x5')]},'browserName':{'type':Sequelize[_0xb30b('0x5')]},'browserVersion':{'type':Sequelize[_0xb30b('0x5')]},'osName':{'type':Sequelize[_0xb30b('0x5')]},'osVersion':{'type':Sequelize[_0xb30b('0x5')]},'deviceModel':{'type':Sequelize[_0xb30b('0x5')]},'deviceVendor':{'type':Sequelize[_0xb30b('0x5')]},'deviceType':{'type':Sequelize[_0xb30b('0x5')]},'referer':{'type':Sequelize[_0xb30b('0x3')]},'customerIp':{'type':Sequelize[_0xb30b('0x5')]},'formData':{'type':Sequelize[_0xb30b('0x3')](_0xb30b('0x6'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xb30b('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb30b('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xb30b('0x5')]},'vidaooSessionId':{'type':Sequelize[_0xb30b('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xb30b('0x8')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 72f6346..82d11b5 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 _0xe6aa=['removeTags','unix','toString','server','files','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','ChatWebsite','Account','Owner','mkdirSync','Chat','createdAt','closedAt','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','pipe','out','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','bluebird','mustache','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','update','name','render','body','contact','agent','account','rawAttributes','fieldName','type','key','findAll','chat','query','user','show','model','ChatInteraction','keys','attributes','intersection','fields','options','find','create','params','destroy','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooMetadata','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','email','isNull','follow','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','mimetype','Attachment','closed','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','User','ContactId','format','%s%d','agentAlias','customer','Visitor','agentIdentifier','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','omit','ids','getMessages','filters','length','hasOwnProperty','nolimit','sort','where','merge','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','order','pick','ChatInteractionId','secret','includeAgent','includeAll','addTags','spread','Tag','color','emit','chatInteractionTags:save'];(function(_0x58bbeb,_0x19caf1){var _0x5d9f3e=function(_0x27e100){while(--_0x27e100){_0x58bbeb['push'](_0x58bbeb['shift']());}};_0x5d9f3e(++_0x19caf1);}(_0xe6aa,0x1ca));var _0xae6a=function(_0x123dba,_0x58ff2d){_0x123dba=_0x123dba-0x0;var _0x41b42d=_0xe6aa[_0x123dba];return _0x41b42d;};'use strict';var rimraf=require(_0xae6a('0x0'));var zipdir=require('zip-dir');var rp=require(_0xae6a('0x1'));var moment=require('moment');var BPromise=require(_0xae6a('0x2'));var Mustache=require(_0xae6a('0x3'));var util=require('util');var path=require(_0xae6a('0x4'));var ejs=require(_0xae6a('0x5'));var fs=require('fs');var _=require(_0xae6a('0x6'));var Redis=require('ioredis');var interaction=require(_0xae6a('0x7'));var qs=require(_0xae6a('0x8'));var pdf=require(_0xae6a('0x9'));var logger=require(_0xae6a('0xa'))('api');var config=require(_0xae6a('0xb'));var db=require(_0xae6a('0xc'))['db'];config['redis']=_[_0xae6a('0xd')](config[_0xae6a('0xe')],{'host':_0xae6a('0xf'),'port':0x18eb});var socket=require(_0xae6a('0x10'))(new Redis(config[_0xae6a('0xe')]));require(_0xae6a('0x11'))[_0xae6a('0x12')](socket);var jayson=require(_0xae6a('0x13'));var client=jayson['client'][_0xae6a('0x14')]({'port':0x232b});var client9004=jayson[_0xae6a('0x15')][_0xae6a('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x4998fd,_0x26572c,_0x148261,_0xb30f94){return new BPromise(function(_0x50d0d5,_0x31527a){var _0x3990cf=_0xb30f94||client;return _0x3990cf[_0xae6a('0x16')](_0x4998fd,_0x148261)[_0xae6a('0x17')](function(_0x1c0015){logger[_0xae6a('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x26572c,_0xae6a('0x19'));logger[_0xae6a('0x1a')](_0xae6a('0x1b'),_0x26572c,_0xae6a('0x19'),JSON[_0xae6a('0x1c')](_0x1c0015));if(_0x1c0015[_0xae6a('0x1d')]){if(_0x1c0015[_0xae6a('0x1d')]['code']===0x1f4){logger['error'](_0xae6a('0x1e'),_0x26572c,_0x1c0015['error'][_0xae6a('0x1f')]);return _0x31527a(_0x1c0015[_0xae6a('0x1d')][_0xae6a('0x1f')]);}logger[_0xae6a('0x1d')](_0xae6a('0x1e'),_0x26572c,_0x1c0015['error']['message']);return _0x50d0d5(_0x1c0015[_0xae6a('0x1d')][_0xae6a('0x1f')]);}else{logger[_0xae6a('0x18')](_0xae6a('0x1e'),_0x26572c,_0xae6a('0x19'));_0x50d0d5(_0x1c0015[_0xae6a('0x20')][_0xae6a('0x1f')]);}})[_0xae6a('0x21')](function(_0x26e83f){logger[_0xae6a('0x1d')](_0xae6a('0x1e'),_0x26572c,_0x26e83f);_0x31527a(_0x26e83f);});});}function respondWithStatusCode(_0x5b71f1,_0x554db7){_0x554db7=_0x554db7||0xcc;return function(_0x4aab98){if(_0x4aab98){return _0x5b71f1[_0xae6a('0x22')](_0x554db7);}return _0x5b71f1[_0xae6a('0x23')](_0x554db7)[_0xae6a('0x24')]();};}function respondWithResult(_0x423a54,_0x28ceff){_0x28ceff=_0x28ceff||0xc8;return function(_0x32724b){if(_0x32724b){return _0x423a54['status'](_0x28ceff)[_0xae6a('0x25')](_0x32724b);}};}function respondWithFilteredResult(_0x5df151,_0x2bb3f4){return function(_0x30968b){if(_0x30968b){var _0x266eab=typeof _0x2bb3f4[_0xae6a('0x26')]==='undefined'&&typeof _0x2bb3f4['limit']===_0xae6a('0x27');var _0x4d2725=_0x30968b[_0xae6a('0x28')];var _0x29ae99=_0x266eab?0x0:_0x2bb3f4[_0xae6a('0x26')];var _0x14213e=_0x266eab?_0x30968b[_0xae6a('0x28')]:_0x2bb3f4['offset']+_0x2bb3f4[_0xae6a('0x29')];var _0x2d70ca;if(_0x14213e>=_0x4d2725){_0x14213e=_0x4d2725;_0x2d70ca=0xc8;}else{_0x2d70ca=0xce;}_0x5df151[_0xae6a('0x23')](_0x2d70ca);return _0x5df151['set']('Content-Range',_0x29ae99+'-'+_0x14213e+'/'+_0x4d2725)[_0xae6a('0x25')](_0x30968b);}return null;};}function saveUpdates(_0x36b8af){return function(_0x23980d){if(_0x23980d){return _0x23980d[_0xae6a('0x2a')](_0x36b8af)[_0xae6a('0x17')](function(_0x2cee1e){return _0x2cee1e;});}return null;};}function removeEntity(_0x1a1f2b){return function(_0x4ae06f){if(_0x4ae06f){return _0x4ae06f['destroy']()[_0xae6a('0x17')](function(){_0x1a1f2b[_0xae6a('0x23')](0xcc)[_0xae6a('0x24')]();});}};}function handleEntityNotFound(_0x1cc51f){return function(_0x3a74e1){if(!_0x3a74e1){_0x1cc51f[_0xae6a('0x22')](0x194);}return _0x3a74e1;};}function handleError(_0x3793e0,_0x208af8){_0x208af8=_0x208af8||0x1f4;return function(_0x3dfbfa){logger[_0xae6a('0x1d')](_0x3dfbfa['stack']);if(_0x3dfbfa[_0xae6a('0x2b')]){delete _0x3dfbfa[_0xae6a('0x2b')];}_0x3793e0[_0xae6a('0x23')](_0x208af8)['send'](_0x3dfbfa);};}function getMustacheRender(_0x56c778,_0xd75e0){return Mustache[_0xae6a('0x2c')](_0x56c778,_['merge'](_0xd75e0[_0xae6a('0x2d')],{'contact':_0xd75e0[_0xae6a('0x2e')],'message':_0xd75e0[_0xae6a('0x1f')],'agent':_0xd75e0[_0xae6a('0x2f')],'interaction':_0xd75e0['interaction'],'account':_0xd75e0[_0xae6a('0x30')]}))||'';}exports['index']=function(_0x592cc4,_0x264e3a){var _0x210645={};var _0x14582f=_['map'](db['ChatInteraction'][_0xae6a('0x31')],function(_0x29bff6){return{'name':_0x29bff6[_0xae6a('0x32')],'type':_0x29bff6[_0xae6a('0x33')][_0xae6a('0x34')]};});_0x210645=qs['getOptions'](_0x14582f,_0x592cc4);return interaction[_0xae6a('0x35')](_0xae6a('0x36'),_0x592cc4[_0xae6a('0x37')],_0x592cc4[_0xae6a('0x38')],_0x210645,_0x14582f)[_0xae6a('0x17')](respondWithFilteredResult(_0x264e3a,_0x210645))[_0xae6a('0x21')](handleError(_0x264e3a,null));};exports[_0xae6a('0x39')]=function(_0x418f48,_0x1c5d79){var _0x92015a={'raw':![],'where':{'id':_0x418f48['params']['id']}},_0x4059b9={};_0x4059b9[_0xae6a('0x3a')]=_['keys'](db[_0xae6a('0x3b')]['rawAttributes']);_0x4059b9[_0xae6a('0x37')]=_[_0xae6a('0x3c')](_0x418f48['query']);_0x4059b9['filters']=_['intersection'](_0x4059b9[_0xae6a('0x3a')],_0x4059b9[_0xae6a('0x37')]);_0x92015a[_0xae6a('0x3d')]=_[_0xae6a('0x3e')](_0x4059b9[_0xae6a('0x3a')],qs[_0xae6a('0x3f')](_0x418f48[_0xae6a('0x37')][_0xae6a('0x3f')]));_0x92015a['attributes']=_0x92015a[_0xae6a('0x3d')]['length']?_0x92015a[_0xae6a('0x3d')]:_0x4059b9[_0xae6a('0x3a')];if(_0x418f48[_0xae6a('0x37')]['includeAll']){_0x92015a['include']=[{'all':!![]}];}_0x92015a=_['merge']({},_0x92015a,_0x418f48[_0xae6a('0x40')]);return db[_0xae6a('0x3b')][_0xae6a('0x41')](_0x92015a)['then'](handleEntityNotFound(_0x1c5d79,null))['then'](respondWithResult(_0x1c5d79,null))['catch'](handleError(_0x1c5d79,null));};exports[_0xae6a('0x42')]=function(_0x4c25ab,_0x3b0b9a){return db[_0xae6a('0x3b')][_0xae6a('0x42')](_0x4c25ab[_0xae6a('0x2d')],{})[_0xae6a('0x17')](respondWithResult(_0x3b0b9a,0xc9))['catch'](handleError(_0x3b0b9a,null));};exports[_0xae6a('0x2a')]=function(_0x10af07,_0x22941f){if(_0x10af07[_0xae6a('0x2d')]['id']){delete _0x10af07[_0xae6a('0x2d')]['id'];}return db[_0xae6a('0x3b')][_0xae6a('0x41')]({'where':{'id':_0x10af07[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x22941f,null))['then'](saveUpdates(_0x10af07[_0xae6a('0x2d')],null))[_0xae6a('0x17')](respondWithResult(_0x22941f,null))['catch'](handleError(_0x22941f,null));};exports[_0xae6a('0x44')]=function(_0xce0a7e,_0x383d28){return db[_0xae6a('0x3b')][_0xae6a('0x41')]({'where':{'id':_0xce0a7e[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x383d28,null))[_0xae6a('0x17')](removeEntity(_0x383d28,null))[_0xae6a('0x21')](handleError(_0x383d28,null));};exports[_0xae6a('0x45')]=function(_0x2b2ab7,_0xdb6106){return db['ChatInteraction'][_0xae6a('0x45')]()[_0xae6a('0x17')](respondWithResult(_0xdb6106,null))['catch'](handleError(_0xdb6106,null));};exports[_0xae6a('0x46')]=function(_0x3bc6e7,_0x381ed0){var _0x471c10=_0x3bc6e7[_0xae6a('0x43')]['id'];var _0x1c1bb2;var _0xbfef90;var _0x290da0;return db[_0xae6a('0x3b')][_0xae6a('0x47')]({'where':{'id':_0x471c10}})[_0xae6a('0x17')](function(_0x450b2e){_0x1c1bb2=_0x450b2e;return db['ChatWebsite'][_0xae6a('0x47')]({'where':{'id':_0x450b2e[_0xae6a('0x48')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xae6a('0x49'),_0xae6a('0x4a'),_0xae6a('0x4b')],'raw':!![]});})[_0xae6a('0x17')](function(_0x73bb7a){if(_0x73bb7a&&_0x73bb7a['vidaooApiKey']&&_0x73bb7a['vidaooEscalation']){_0xbfef90=_0x73bb7a;var _0x4aceb7={'interaction':{'id':_0x471c10},'agent':{'id':_0x3bc6e7['user']['id'],'name':_0x3bc6e7[_0xae6a('0x38')]['name'],'fullname':_0x3bc6e7[_0xae6a('0x38')][_0xae6a('0x4c')],'email':_0x3bc6e7['user']['email']},'contact':_0x3bc6e7[_0xae6a('0x2d')][_0xae6a('0x2e')],'account':_0x3bc6e7[_0xae6a('0x2d')][_0xae6a('0x30')]};var _0x43df6e={'rejectUnauthorized':![],'method':_0xae6a('0x4d'),'url':_0xae6a('0x4e'),'headers':{'X-APIKEY':_0x73bb7a[_0xae6a('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3bc6e7[_0xae6a('0x38')][_0xae6a('0x50')]],'buttons':null,'topic':_0xbfef90[_0xae6a('0x49')],'note':_[_0xae6a('0x51')](_0xbfef90[_0xae6a('0x4a')])?null:getMustacheRender(_0xbfef90[_0xae6a('0x4a')],_0x4aceb7),'metadata':null},'redirect':_0xae6a('0x52'),'json':!![]};try{if(!_['isNull'](_0xbfef90[_0xae6a('0x4b')])){var _0x3606fc=getMustacheRender(_0xbfef90[_0xae6a('0x4b')],_0x4aceb7);var _0x2034d5=JSON[_0xae6a('0x53')](_0x3606fc);_0x43df6e[_0xae6a('0x2d')][_0xae6a('0x54')]=_0x2034d5;}}catch(_0x50eb28){throw new db['Sequelize'][(_0xae6a('0x55'))](_0xae6a('0x56'));}return rp(_0x43df6e);}else{throw new db['Sequelize']['ValidationError'](_0xae6a('0x57'));}})[_0xae6a('0x17')](function(_0x2b878b){_0x290da0=_0x2b878b;if(_0x290da0['id']){var _0x52f504={'body':_0x290da0[_0xae6a('0x58')],'ChatWebsiteId':_0xbfef90['id'],'ChatInteractionId':_0x1c1bb2['id'],'direction':'out','UserId':_0x3bc6e7['user']['id']};return db[_0xae6a('0x59')][_0xae6a('0x42')](_0x52f504,{});}else{throw new db[(_0xae6a('0x5a'))]['ValidationError'](_0xae6a('0x5b'));}})[_0xae6a('0x17')](function(){return _0x1c1bb2[_0xae6a('0x5c')]({'vidaooSessionId':_0x290da0['id']});})['then'](respondWithResult(_0x381ed0,null))[_0xae6a('0x21')](handleError(_0x381ed0,null));};exports[_0xae6a('0x5d')]=function(_0x49345a,_0x4f8230){if(_0x49345a[_0xae6a('0x2d')]['id']){delete _0x49345a[_0xae6a('0x2d')]['id'];}return db[_0xae6a('0x3b')]['find']({'where':{'id':_0x49345a[_0xae6a('0x43')]['id']},'include':[{'model':db[_0xae6a('0x5e')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x4f8230,null))[_0xae6a('0x17')](saveUpdates(_0x49345a['body'],null))['then'](respondWithResult(_0x4f8230,null))[_0xae6a('0x21')](handleError(_0x4f8230,null));};exports[_0xae6a('0x5f')]=function(_0x5e5803,_0x2734ce){if(_0x5e5803[_0xae6a('0x2d')]['id']){delete _0x5e5803[_0xae6a('0x2d')]['id'];}return db['ChatInteraction'][_0xae6a('0x41')]({'where':{'id':_0x5e5803['params']['id']}})[_0xae6a('0x17')](function(_0x379253){if(!_0x379253){logger[_0xae6a('0x1d')](_0xae6a('0x60'),_0xae6a('0x5f'),0x194,_0xae6a('0x61'));_0x2734ce[_0xae6a('0x22')](0x194);}else{if(_0x379253[_0xae6a('0x62')]){throw new db['Sequelize'][(_0xae6a('0x55'))]('Interaction\x20already\x20assigned');}}return _0x379253;})['then'](function(_0x2a3639){if(_0x2a3639){return _0x2a3639[_0xae6a('0x2a')]({'closed':_0x5e5803['body']['closed'],'disposition':_0x5e5803[_0xae6a('0x2d')][_0xae6a('0x63')]})[_0xae6a('0x17')](function(_0x316f71){return _0x316f71;});}})['then'](function(){return respondWithRpcPromise(_0xae6a('0x64'),_0xae6a('0x5f'),_0x5e5803[_0xae6a('0x2d')],client9004);})[_0xae6a('0x17')](respondWithResult(_0x2734ce,null))[_0xae6a('0x21')](handleError(_0x2734ce,null));};exports[_0xae6a('0x65')]=function(_0x35322d,_0x2f7403){_0x35322d['body'][_0xae6a('0x2b')]=_0x35322d[_0xae6a('0x66')]['originalname'];_0x35322d[_0xae6a('0x2d')][_0xae6a('0x67')]=_0x35322d[_0xae6a('0x66')][_0xae6a('0x68')];_0x35322d[_0xae6a('0x2d')][_0xae6a('0x33')]=_0x35322d[_0xae6a('0x66')][_0xae6a('0x69')];return db[_0xae6a('0x6a')][_0xae6a('0x42')](_0x35322d['body'])[_0xae6a('0x17')](respondWithResult(_0x2f7403,0xc9))['catch'](handleError(_0x2f7403,null));};exports['attachmentDownload']=function(_0x1165d5,_0x31c015){return db['ChatInteraction'][_0xae6a('0x47')]({'where':{'id':_0x1165d5[_0xae6a('0x43')]['id']},'raw':!![]})[_0xae6a('0x17')](handleEntityNotFound(_0x31c015,null))[_0xae6a('0x17')](function(_0x777720){if(_0x777720){if(_0x777720[_0xae6a('0x6b')]){return _0x31c015['status'](0x193)[_0xae6a('0x25')]({'status':0x193,'message':_0xae6a('0x6c')});}return db[_0xae6a('0x6a')]['findOne']({'where':{'id':_0x1165d5[_0xae6a('0x37')]['attachId']},'raw':!![]})[_0xae6a('0x17')](handleEntityNotFound(_0x31c015,null));}})[_0xae6a('0x17')](function(_0x5022fc){if(_0x5022fc){var _0x44cc44=_0x5022fc[_0xae6a('0x6d')]!==null;var _0x4f3f9d=path['join'](config[_0xae6a('0x6e')],_0xae6a('0x6f'));if(_0x44cc44){_0x4f3f9d=path[_0xae6a('0x70')](_0x4f3f9d,_0xae6a('0x71'));}var _0x3c38b6=path['join'](_0x4f3f9d,_0x5022fc[_0xae6a('0x67')]);return _0x31c015[_0xae6a('0x72')](_0x3c38b6);}})['catch'](handleError(_0x31c015,null));};exports[_0xae6a('0x73')]=function(_0x33ecc9,_0x23ffdd){var _0x42a833=null;var _0x2cf004=null;var _0x1f02b5=null;if(_0x33ecc9[_0xae6a('0x2d')]['id']){delete _0x33ecc9[_0xae6a('0x2d')]['id'];}if(_0x33ecc9['body']['mailTranscript']){_0x1f02b5=path[_0xae6a('0x70')](config['root'],_0xae6a('0x74'),util['format'](_0xae6a('0x75'),Date['now']()));_0x33ecc9[_0xae6a('0x2d')][_0xae6a('0x76')]=_0x1f02b5;}return db['ChatInteraction'][_0xae6a('0x41')]({'where':{'id':_0x33ecc9[_0xae6a('0x43')]['id']},'include':[{'model':db[_0xae6a('0x59')],'as':_0xae6a('0x77'),'include':[{'model':db[_0xae6a('0x78')],'as':'User'}]}]})[_0xae6a('0x17')](handleEntityNotFound(_0x23ffdd,null))[_0xae6a('0x17')](saveUpdates(_0x33ecc9['body'],null))[_0xae6a('0x17')](function(_0x262af3){if(_0x262af3){_0x42a833=_0x262af3;return db['ChatWebsite'][_0xae6a('0x41')]({'where':{'id':_0x42a833[_0xae6a('0x48')]}});}})[_0xae6a('0x17')](function(_0x5f425e){if(_0x5f425e){_0x2cf004=_0x5f425e;return db[_0xae6a('0x5e')][_0xae6a('0x41')]({'where':{'id':_0x42a833[_0xae6a('0x79')]}});}})[_0xae6a('0x17')](function(_0x214b6d){if(_0x214b6d){if(_0x1f02b5){var _0x4eb0cb=null;for(var _0x4af66a=0x1;_0x4af66a<_0x42a833[_0xae6a('0x77')]['length'];++_0x4af66a){_0x4eb0cb=_0x42a833['Messages'][_0x4af66a];var _0x2eacd8=_0x4eb0cb['UserId']?util[_0xae6a('0x7a')](_0xae6a('0x7b'),_0x2cf004[_0xae6a('0x7c')],_0x4eb0cb[_0xae6a('0x62')]):'System';var _0x2db7b4=_0x33ecc9[_0xae6a('0x2d')][_0xae6a('0x7d')]||util['format'](_0xae6a('0x7b'),_0xae6a('0x7e'),_0x4eb0cb[_0xae6a('0x79')]);switch(_0x2cf004[_0xae6a('0x7f')]){case'website_alias':_0x2eacd8=_0x4eb0cb[_0xae6a('0x62')]?util['format']('%s%d',_0x2cf004[_0xae6a('0x7c')],_0x4eb0cb[_0xae6a('0x62')]):_0xae6a('0x80');break;case'agent_alias':_0x2eacd8=_0x4eb0cb[_0xae6a('0x62')]?_0x4eb0cb[_0xae6a('0x78')][_0xae6a('0x81')]||_0x4eb0cb[_0xae6a('0x78')]['fullname']:_0xae6a('0x80');break;case _0xae6a('0x82'):_0x2eacd8=_0x4eb0cb['UserId']?_0x4eb0cb[_0xae6a('0x78')][_0xae6a('0x4c')]:_0xae6a('0x80');break;default:_0x2eacd8=_0x4eb0cb['UserId']?util[_0xae6a('0x7a')](_0xae6a('0x7b'),_0x2cf004[_0xae6a('0x7c')],_0x4eb0cb['UserId']):'System';}var _0x3a34c6=util['format'](_0xae6a('0x83'),moment(_0x4eb0cb['createdAt'])[_0xae6a('0x7a')](_0xae6a('0x84')),_0x4eb0cb[_0xae6a('0x85')]==='in'?_0x2db7b4:_0x2eacd8,_0x4eb0cb[_0xae6a('0x2d')]);if(!_0x4eb0cb['secret']){fs[_0xae6a('0x86')](_0x1f02b5,_0x3a34c6);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xae6a('0x87')],'as':_0xae6a('0x88'),'raw':!![],'include':[{'model':db[_0xae6a('0x89')],'as':_0xae6a('0x89'),'raw':!![]}]}]});}}})[_0xae6a('0x17')](function(_0x48e3e4){if(!_0x48e3e4||!_0x48e3e4[_0xae6a('0x88')]||!_0x33ecc9[_0xae6a('0x2d')])return _0x42a833;var _0x4737d2=_0x48e3e4[_0xae6a('0x8a')]();return respondWithRpcPromise(_0xae6a('0x8b'),_0xae6a('0x8c'),{'account':_0x4737d2,'message':{'from':util[_0xae6a('0x7a')](_0xae6a('0x8d'),_0x48e3e4['name'],_0x48e3e4[_0xae6a('0x50')]||_0x48e3e4[_0xae6a('0x88')][_0xae6a('0x38')]),'to':_0x33ecc9[_0xae6a('0x2d')][_0xae6a('0x8e')],'subject':_0xae6a('0x8f'),'text':util[_0xae6a('0x7a')](_0xae6a('0x90'),_0x33ecc9[_0xae6a('0x2d')]['mailTranscript']),'attachments':[{'path':_0x1f02b5}]}})['then'](function(){return _0x42a833;})[_0xae6a('0x21')](function(_0x17c3ed){logger['error'](_0x17c3ed);});})['then'](respondWithStatusCode(_0x23ffdd,0xc8))[_0xae6a('0x21')](handleError(_0x23ffdd,null));};exports['addMessage']=function(_0x11f794,_0x126fe1){return db[_0xae6a('0x59')][_0xae6a('0x41')]({'where':{'id':_0x11f794[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x126fe1,null))[_0xae6a('0x17')](function(_0x337d64){if(_0x337d64){return _0x337d64['addMessage'](_0x11f794['body']['ids'],_[_0xae6a('0x91')](_0x11f794[_0xae6a('0x2d')],[_0xae6a('0x92'),'id'])||{});}})['then'](respondWithResult(_0x126fe1,null))[_0xae6a('0x21')](handleError(_0x126fe1,null));};exports[_0xae6a('0x93')]=function(_0xc15337,_0x4e2e2d){var _0x1df31a={'raw':![],'where':{}};var _0x4102f4={};var _0x502b73={'count':0x0,'rows':[]};return db[_0xae6a('0x3b')][_0xae6a('0x47')]({'where':{'id':_0xc15337[_0xae6a('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e2e2d,null))[_0xae6a('0x17')](function(_0x2aa14e){if(_0x2aa14e){_0x4102f4[_0xae6a('0x3a')]=_['keys'](db[_0xae6a('0x59')][_0xae6a('0x31')]);_0x4102f4['query']=_[_0xae6a('0x3c')](_0xc15337[_0xae6a('0x37')]);_0x4102f4[_0xae6a('0x94')]=_[_0xae6a('0x3e')](_0x4102f4[_0xae6a('0x3a')],_0x4102f4['query']);_0x1df31a['attributes']=_[_0xae6a('0x3e')](_0x4102f4[_0xae6a('0x3a')],qs[_0xae6a('0x3f')](_0xc15337['query']['fields']));_0x1df31a['attributes']=_0x1df31a[_0xae6a('0x3d')][_0xae6a('0x95')]?_0x1df31a[_0xae6a('0x3d')]:_0x4102f4[_0xae6a('0x3a')];if(!_0xc15337['query'][_0xae6a('0x96')](_0xae6a('0x97'))){_0x1df31a['limit']=qs[_0xae6a('0x29')](_0xc15337['query'][_0xae6a('0x29')]);_0x1df31a[_0xae6a('0x26')]=qs[_0xae6a('0x26')](_0xc15337['query'][_0xae6a('0x26')]);}_0x1df31a['order']=qs[_0xae6a('0x98')](_0xc15337[_0xae6a('0x37')][_0xae6a('0x98')]);_0x1df31a['where']=qs[_0xae6a('0x94')](_['pick'](_0xc15337[_0xae6a('0x37')],_0x4102f4[_0xae6a('0x94')]));_0x1df31a['where']['ChatInteractionId']=_0x2aa14e['id'];if(_0xc15337['query']['filter']){_0x1df31a[_0xae6a('0x99')]=_[_0xae6a('0x9a')](_0x1df31a[_0xae6a('0x99')],{'$or':_[_0xae6a('0x9b')](_0x1df31a[_0xae6a('0x3d')],function(_0x27d60e){var _0x5f3baf={};_0x5f3baf[_0x27d60e]={'$like':'%'+_0xc15337['query'][_0xae6a('0x9c')]+'%'};return _0x5f3baf;})});}if(_0xc15337[_0xae6a('0x37')][_0xae6a('0x9d')]){var _0x3c1174=_0xc15337['query'][_0xae6a('0x9d')][_0xae6a('0x9e')](',');var _0x37c322={};_0x37c322[_0x3c1174[0x0]]={'$gte':moment(_0x3c1174[0x1])[_0xae6a('0x7a')](_0xae6a('0x9f'))};_0x1df31a[_0xae6a('0x99')]=_[_0xae6a('0x9a')](_0x1df31a[_0xae6a('0x99')],_0x37c322);}_0x1df31a=_[_0xae6a('0x9a')]({},_0x1df31a,_0xc15337[_0xae6a('0x40')]);return db[_0xae6a('0x59')][_0xae6a('0x28')]({'where':_0x1df31a[_0xae6a('0x99')]})[_0xae6a('0x17')](function(_0x3ccf5d){_0x502b73['count']=_0x3ccf5d;if(_0xc15337[_0xae6a('0x37')]['includeAll']){_0x1df31a[_0xae6a('0xa0')]=[{'all':!![]}];}return db[_0xae6a('0x59')][_0xae6a('0x35')](_0x1df31a);})[_0xae6a('0x17')](function(_0x2a51f3){_0x502b73[_0xae6a('0xa1')]=_0x2a51f3;return _0x502b73;});}})['then'](respondWithFilteredResult(_0x4e2e2d,_0x1df31a))[_0xae6a('0x21')](handleError(_0x4e2e2d,null));};exports[_0xae6a('0xa2')]=function(_0x467efb,_0x46b413){var _0x2ee7b2={'where':{}},_0x1e618a={},_0x1a0101={'count':0x0,'rows':[]};return db[_0xae6a('0x3b')][_0xae6a('0x47')]({'where':{'id':_0x467efb['params']['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x46b413,null))[_0xae6a('0x17')](function(_0x58b88e){if(_0x58b88e){_0x1e618a[_0xae6a('0x3a')]=_['keys'](db[_0xae6a('0x59')][_0xae6a('0x31')]);_0x1e618a['query']=_['keys'](_0x467efb[_0xae6a('0x37')]);_0x1e618a[_0xae6a('0x94')]=_[_0xae6a('0x3e')](_0x1e618a[_0xae6a('0x3a')],_0x1e618a['query']);_0x2ee7b2['attributes']=_[_0xae6a('0x3e')](_0x1e618a[_0xae6a('0x3a')],qs['fields'](_0x467efb[_0xae6a('0x37')][_0xae6a('0x3f')]));_0x2ee7b2[_0xae6a('0x3d')]=_0x2ee7b2[_0xae6a('0x3d')][_0xae6a('0x95')]?_0x2ee7b2['attributes']:_0x1e618a[_0xae6a('0x3a')];if(!_0x467efb[_0xae6a('0x37')][_0xae6a('0x96')]('nolimit')){_0x2ee7b2[_0xae6a('0x29')]=qs[_0xae6a('0x29')](_0x467efb[_0xae6a('0x37')][_0xae6a('0x29')]);_0x2ee7b2[_0xae6a('0x26')]=qs['offset'](_0x467efb[_0xae6a('0x37')]['offset']);}_0x2ee7b2[_0xae6a('0xa3')]=qs['sort'](_0x467efb['query'][_0xae6a('0x98')]);_0x2ee7b2['where']=qs[_0xae6a('0x94')](_[_0xae6a('0xa4')](_0x467efb[_0xae6a('0x37')],_0x1e618a[_0xae6a('0x94')]));_0x2ee7b2[_0xae6a('0x99')][_0xae6a('0xa5')]=_0x58b88e['id'];if(_0x467efb['query'][_0xae6a('0x9c')]){_0x2ee7b2[_0xae6a('0x99')]=_[_0xae6a('0x9a')](_0x2ee7b2[_0xae6a('0x99')],{'$or':_['map'](_0x2ee7b2['attributes'],function(_0x2f8472){var _0xf46d66={};_0xf46d66[_0x2f8472]={'$like':'%'+_0x467efb[_0xae6a('0x37')]['filter']+'%'};return _0xf46d66;})});}_0x2ee7b2[_0xae6a('0x99')][_0xae6a('0xa6')]=![];if(_0x467efb[_0xae6a('0x37')]['id']){_0x2ee7b2['where']['id']={'$gt':_0x467efb[_0xae6a('0x37')]['id']};}_0x2ee7b2=_[_0xae6a('0x9a')]({},_0x2ee7b2,_0x467efb[_0xae6a('0x40')]);return db['ChatMessage'][_0xae6a('0x28')]({'where':_0x2ee7b2[_0xae6a('0x99')]})[_0xae6a('0x17')](function(_0x42dd4e){_0x1a0101['count']=_0x42dd4e;_0x2ee7b2[_0xae6a('0xa0')]=[];if(_0x467efb[_0xae6a('0x37')][_0xae6a('0xa7')]){_0x2ee7b2[_0xae6a('0xa0')]['push']({'model':db[_0xae6a('0x78')],'as':_0xae6a('0x78'),'attributes':['id',_0xae6a('0x4c'),_0xae6a('0x81')]});}if(_0x467efb['query'][_0xae6a('0xa8')]){_0x2ee7b2[_0xae6a('0xa0')]=[{'all':!![]}];}return db[_0xae6a('0x59')][_0xae6a('0x35')](_0x2ee7b2);})[_0xae6a('0x17')](function(_0x30737d){_0x1a0101['rows']=_0x30737d;return _0x1a0101;});}})['then'](respondWithFilteredResult(_0x46b413,_0x2ee7b2))[_0xae6a('0x21')](handleError(_0x46b413,null));};exports[_0xae6a('0xa9')]=function(_0x2bfc9a,_0x2bafb3){return db[_0xae6a('0x3b')][_0xae6a('0x41')]({'where':{'id':_0x2bfc9a[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x2bafb3,null))[_0xae6a('0x17')](function(_0x85d6c5){if(_0x85d6c5){return _0x85d6c5['setTags'](_0x2bfc9a[_0xae6a('0x2d')][_0xae6a('0x92')],_['omit'](_0x2bfc9a[_0xae6a('0x2d')],['ids','id'])||{})[_0xae6a('0xaa')](function(){return db[_0xae6a('0xab')][_0xae6a('0x35')]({'attributes':['id',_0xae6a('0x2b'),_0xae6a('0xac')],'where':{'id':_0x2bfc9a[_0xae6a('0x2d')][_0xae6a('0x92')]}});})[_0xae6a('0x17')](function(_0x324adb){socket[_0xae6a('0xad')](_0xae6a('0xae'),{'id':Number(_0x2bfc9a['params']['id']),'tags':_0x324adb||[]});return{'id':Number(_0x2bfc9a['params']['id']),'tags':_0x324adb||[]};});}})[_0xae6a('0x17')](respondWithResult(_0x2bafb3,null))['catch'](handleError(_0x2bafb3,null));};exports[_0xae6a('0xaf')]=function(_0x354a3b,_0x246434){return db['ChatInteraction'][_0xae6a('0x41')]({'where':{'id':_0x354a3b[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x246434,null))[_0xae6a('0x17')](function(_0x250ddb){if(_0x250ddb){return _0x250ddb[_0xae6a('0xaf')](_0x354a3b[_0xae6a('0x37')][_0xae6a('0x92')]);}})['then'](respondWithStatusCode(_0x246434,null))['catch'](handleError(_0x246434,null));};exports['download']=function(_0x585885,_0x16e591){var _0xcede78=moment()[_0xae6a('0xb0')]()[_0xae6a('0xb1')]();var _0x4b6e9d=path['join'](config[_0xae6a('0x6e')],'server','files','tmp');var _0x52be63=path[_0xae6a('0x70')](config[_0xae6a('0x6e')],_0xae6a('0xb2'),_0xae6a('0xb3'),_0xae6a('0xb4'));var _0x317b65=path['join'](_0x4b6e9d,_0xcede78);var _0x12c801=util[_0xae6a('0x7a')](_0xae6a('0xb5'),_0x585885[_0xae6a('0x43')]['id'],_0xcede78);var _0x105860=path[_0xae6a('0x70')](_0x4b6e9d,_0x12c801);var _0x3bcf83=[];_0x3bcf83[_0xae6a('0xb6')]({'model':db[_0xae6a('0x78')],'as':'User','attributes':['id',_0xae6a('0x4c')],'raw':!![]});_0x3bcf83[_0xae6a('0xb6')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xae6a('0xb7'),_0xae6a('0xb8')],'raw':!![]});if(_0x585885[_0xae6a('0x37')][_0xae6a('0xb4')]){_0x3bcf83['push']({'model':db[_0xae6a('0x6a')],'as':'Attachment','raw':!![]});}var _0x5eba4b=[{'model':db[_0xae6a('0x59')],'as':_0xae6a('0x77'),'attributes':['id','body','createdAt',_0xae6a('0x85'),_0xae6a('0xa6'),_0xae6a('0xb9')],'include':_0x3bcf83}];_0x5eba4b['push']({'model':db[_0xae6a('0xba')],'as':_0xae6a('0xbb'),'attributes':['id',_0xae6a('0x2b')]});_0x5eba4b[_0xae6a('0xb6')]({'model':db['User'],'as':_0xae6a('0xbc'),'attributes':['id',_0xae6a('0x4c')]});return db[_0xae6a('0x3b')][_0xae6a('0x41')]({'where':{'id':_0x585885[_0xae6a('0x43')]['id']},'include':_0x5eba4b})[_0xae6a('0x17')](handleEntityNotFound(_0x16e591,null))[_0xae6a('0x17')](function(_0x5d0f25){if(_0x5d0f25){var _0x308352=_0x5d0f25['get']({'plain':!![]});fs[_0xae6a('0xbd')](_0x317b65);var _0x2a6113={'channel':_0xae6a('0xbe'),'account':_0x308352['Account']['name'],'agent':_0x308352[_0xae6a('0xbc')]?_0x308352[_0xae6a('0xbc')]['fullname']:'N.A.','createdAt':moment(_0x308352[_0xae6a('0xbf')])[_0xae6a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae6a('0xb1')](),'closedAt':_0x308352[_0xae6a('0x6b')]?moment(_0x308352[_0xae6a('0xc0')])[_0xae6a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae6a('0xb1')]():'','disposition':_0x308352['disposition'],'chatInfo':{'browser':_0x308352['browserName'],'os':_0x308352[_0xae6a('0xc1')],'referer':_0x308352[_0xae6a('0xc2')],'customerIp':_0x308352[_0xae6a('0xc3')],'customerPort':_0x308352[_0xae6a('0xc4')]?_0x308352[_0xae6a('0xc4')]:_0xae6a('0xc5')},'messages':_(_0x308352['Messages'])[_0xae6a('0xc6')]()['filter']({'secret':![]})['map'](function(_0x48d949){if(_0x48d949[_0xae6a('0x6a')]){var _0x28af58=path[_0xae6a('0x70')](_0x52be63,_0x48d949[_0xae6a('0x6a')][_0xae6a('0x67')]);if(fs[_0xae6a('0xc7')](_0x28af58)){fs['createReadStream'](_0x28af58)[_0xae6a('0xc8')](fs['createWriteStream'](path['join'](_0x317b65,_0x48d949[_0xae6a('0x6a')][_0xae6a('0x67')])));}}return{'date':moment(_0x48d949['createdAt'])[_0xae6a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae6a('0xb1')](),'sender':_0x48d949[_0xae6a('0x85')]===_0xae6a('0xc9')?_0x48d949['User']?_0x48d949[_0xae6a('0x78')][_0xae6a('0x4c')]:_0xae6a('0x80'):_0x48d949[_0xae6a('0xca')][_0xae6a('0xb7')]+(_0x48d949[_0xae6a('0xca')][_0xae6a('0xb8')]?'\x20'+_0x48d949[_0xae6a('0xca')][_0xae6a('0xb8')]:''),'body':_0x48d949[_0xae6a('0x6a')]?_0x48d949[_0xae6a('0x6a')][_0xae6a('0x67')]:_0x48d949[_0xae6a('0x2d')],'direction':_0x48d949['direction']===_0xae6a('0xc9')?'A':'C','secret':_0x48d949[_0xae6a('0xa6')],'read':_0x48d949[_0xae6a('0xb9')],'attachment':_0x48d949['Attachment']};})[_0xae6a('0xcb')]()};return ejs[_0xae6a('0xcc')](path[_0xae6a('0x70')](config[_0xae6a('0x6e')],_0xae6a('0xb2'),_0xae6a('0xcd'),_0xae6a('0xce')),{'interaction':_0x2a6113})['then'](function(_0x324b90){var _0x575dfe=path[_0xae6a('0x70')](_0x317b65,_0xae6a('0xcf')+_0x308352['id']+'-'+_0xcede78+'.pdf');var _0x3024df={'path':_0x575dfe,'channel':_0xae6a('0xbe'),'interactionId':_0x308352['id']};return pdf[_0xae6a('0xd0')](_0x324b90,_0x3024df);})[_0xae6a('0x17')](function(){return new Promise(function(_0x4af8bd,_0x2721d3){zipdir(_0x317b65,{'saveTo':_0x105860},function(_0x4fea87,_0x2a9af6){if(_0x4fea87)return _0x2721d3(_0x4fea87);return _0x4af8bd(_0x2a9af6);});})['then'](function(){return new BPromise(function(_0x282223,_0x2ccf18){rimraf(_0x317b65,function(_0x41dfee){if(_0x41dfee)_0x2ccf18(_0x41dfee);return _0x282223();});});})[_0xae6a('0x17')](function(){return _0x16e591[_0xae6a('0x72')](_0x105860,_0x12c801,function(_0x2ff712){if(_0x2ff712){logger[_0xae6a('0x1d')](_0xae6a('0xd1'),_0x2ff712);}else{fs[_0xae6a('0xd2')](_0x105860);}});});});}else{return _0x16e591[_0xae6a('0x22')](0xc8);}})[_0xae6a('0x21')](handleError(_0x16e591,null));}; \ No newline at end of file +var _0xa479=['then','stack','name','send','render','merge','body','contact','agent','account','index','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','chat','query','user','show','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','params','destroy','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','follow','isNull','parse','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','mailTranscript','now','pathTranscript','Messages','User','ContactId','format','agentAlias','customer','%s%d','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','secret','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','nolimit','sort','where','pick','filter','map','$gte','split','rows','getMyMessages','ChatInteractionId','push','addTags','Tag','chatInteractionTags:save','removeTags','unix','toString','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','direction','read','Account','get','mkdirSync','Owner','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','osName','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','err','zip-dir','moment','mustache','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s','catch','status','end','json','undefined','limit','count','offset','update'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xa479,0x160));var _0x9a47=function(_0x625ee2,_0x35458f){_0x625ee2=_0x625ee2-0x0;var _0x40aa97=_0xa479[_0x625ee2];return _0x40aa97;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9a47('0x0'));var rp=require('request-promise');var moment=require(_0x9a47('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x9a47('0x2'));var util=require(_0x9a47('0x3'));var path=require(_0x9a47('0x4'));var ejs=require(_0x9a47('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x9a47('0x6'));var qs=require(_0x9a47('0x7'));var pdf=require(_0x9a47('0x8'));var logger=require(_0x9a47('0x9'))(_0x9a47('0xa'));var config=require(_0x9a47('0xb'));var db=require(_0x9a47('0xc'))['db'];config[_0x9a47('0xd')]=_['defaults'](config[_0x9a47('0xd')],{'host':_0x9a47('0xe'),'port':0x18eb});var socket=require(_0x9a47('0xf'))(new Redis(config['redis']));require(_0x9a47('0x10'))[_0x9a47('0x11')](socket);var jayson=require(_0x9a47('0x12'));var client=jayson['client'][_0x9a47('0x13')]({'port':0x232b});var client9004=jayson[_0x9a47('0x14')][_0x9a47('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x2d55b6,_0x2148f1,_0x54fd08,_0x106ceb){return new BPromise(function(_0x2fae37,_0x2b3978){var _0x5e09bc=_0x106ceb||client;return _0x5e09bc['request'](_0x2d55b6,_0x54fd08)['then'](function(_0x204322){logger[_0x9a47('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x2148f1,_0x9a47('0x16'));logger[_0x9a47('0x17')](_0x9a47('0x18'),_0x2148f1,_0x9a47('0x16'),JSON[_0x9a47('0x19')](_0x204322));if(_0x204322['error']){if(_0x204322[_0x9a47('0x1a')]['code']===0x1f4){logger[_0x9a47('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x2148f1,_0x204322[_0x9a47('0x1a')]['message']);return _0x2b3978(_0x204322[_0x9a47('0x1a')][_0x9a47('0x1b')]);}logger['error'](_0x9a47('0x1c'),_0x2148f1,_0x204322['error'][_0x9a47('0x1b')]);return _0x2fae37(_0x204322['error']['message']);}else{logger[_0x9a47('0x15')](_0x9a47('0x1c'),_0x2148f1,_0x9a47('0x16'));_0x2fae37(_0x204322['result'][_0x9a47('0x1b')]);}})[_0x9a47('0x1d')](function(_0x59300b){logger[_0x9a47('0x1a')](_0x9a47('0x1c'),_0x2148f1,_0x59300b);_0x2b3978(_0x59300b);});});}function respondWithStatusCode(_0x26e9ad,_0xb76964){_0xb76964=_0xb76964||0xcc;return function(_0x8cdcc1){if(_0x8cdcc1){return _0x26e9ad['sendStatus'](_0xb76964);}return _0x26e9ad[_0x9a47('0x1e')](_0xb76964)[_0x9a47('0x1f')]();};}function respondWithResult(_0x54a86e,_0x1db9d0){_0x1db9d0=_0x1db9d0||0xc8;return function(_0x4b0b29){if(_0x4b0b29){return _0x54a86e['status'](_0x1db9d0)[_0x9a47('0x20')](_0x4b0b29);}};}function respondWithFilteredResult(_0x14b102,_0x11a267){return function(_0x3dd778){if(_0x3dd778){var _0xa98450=typeof _0x11a267['offset']===_0x9a47('0x21')&&typeof _0x11a267[_0x9a47('0x22')]===_0x9a47('0x21');var _0x59a40a=_0x3dd778[_0x9a47('0x23')];var _0x45676a=_0xa98450?0x0:_0x11a267['offset'];var _0x47c3c5=_0xa98450?_0x3dd778['count']:_0x11a267[_0x9a47('0x24')]+_0x11a267[_0x9a47('0x22')];var _0x2ceb8f;if(_0x47c3c5>=_0x59a40a){_0x47c3c5=_0x59a40a;_0x2ceb8f=0xc8;}else{_0x2ceb8f=0xce;}_0x14b102[_0x9a47('0x1e')](_0x2ceb8f);return _0x14b102['set']('Content-Range',_0x45676a+'-'+_0x47c3c5+'/'+_0x59a40a)[_0x9a47('0x20')](_0x3dd778);}return null;};}function saveUpdates(_0x1b87bd){return function(_0x18fe3a){if(_0x18fe3a){return _0x18fe3a[_0x9a47('0x25')](_0x1b87bd)['then'](function(_0x551ff0){return _0x551ff0;});}return null;};}function removeEntity(_0xd84ffa){return function(_0x505145){if(_0x505145){return _0x505145['destroy']()[_0x9a47('0x26')](function(){_0xd84ffa[_0x9a47('0x1e')](0xcc)[_0x9a47('0x1f')]();});}};}function handleEntityNotFound(_0x1a4c4c){return function(_0x26c67f){if(!_0x26c67f){_0x1a4c4c['sendStatus'](0x194);}return _0x26c67f;};}function handleError(_0x594a50,_0x7d0ee6){_0x7d0ee6=_0x7d0ee6||0x1f4;return function(_0x1b558a){logger['error'](_0x1b558a[_0x9a47('0x27')]);if(_0x1b558a[_0x9a47('0x28')]){delete _0x1b558a[_0x9a47('0x28')];}_0x594a50['status'](_0x7d0ee6)[_0x9a47('0x29')](_0x1b558a);};}function getMustacheRender(_0x24d911,_0x549fc2){return Mustache[_0x9a47('0x2a')](_0x24d911,_[_0x9a47('0x2b')](_0x549fc2[_0x9a47('0x2c')],{'contact':_0x549fc2[_0x9a47('0x2d')],'message':_0x549fc2[_0x9a47('0x1b')],'agent':_0x549fc2[_0x9a47('0x2e')],'interaction':_0x549fc2['interaction'],'account':_0x549fc2[_0x9a47('0x2f')]}))||'';}exports[_0x9a47('0x30')]=function(_0x4b710b,_0x5068b5){var _0x2a5d40={};var _0x52484b=_['map'](db[_0x9a47('0x31')][_0x9a47('0x32')],function(_0x15d351){return{'name':_0x15d351[_0x9a47('0x33')],'type':_0x15d351[_0x9a47('0x34')]['key']};});_0x2a5d40=qs[_0x9a47('0x35')](_0x52484b,_0x4b710b);return interaction[_0x9a47('0x36')](_0x9a47('0x37'),_0x4b710b[_0x9a47('0x38')],_0x4b710b[_0x9a47('0x39')],_0x2a5d40,_0x52484b)[_0x9a47('0x26')](respondWithFilteredResult(_0x5068b5,_0x2a5d40))['catch'](handleError(_0x5068b5,null));};exports[_0x9a47('0x3a')]=function(_0x3c1f7f,_0x1d2ff3){var _0xc9cd65={'raw':![],'where':{'id':_0x3c1f7f['params']['id']}},_0x18f346={};_0x18f346[_0x9a47('0x3b')]=_[_0x9a47('0x3c')](db[_0x9a47('0x31')][_0x9a47('0x32')]);_0x18f346[_0x9a47('0x38')]=_[_0x9a47('0x3c')](_0x3c1f7f[_0x9a47('0x38')]);_0x18f346[_0x9a47('0x3d')]=_[_0x9a47('0x3e')](_0x18f346[_0x9a47('0x3b')],_0x18f346[_0x9a47('0x38')]);_0xc9cd65['attributes']=_['intersection'](_0x18f346[_0x9a47('0x3b')],qs[_0x9a47('0x3f')](_0x3c1f7f['query'][_0x9a47('0x3f')]));_0xc9cd65['attributes']=_0xc9cd65[_0x9a47('0x40')][_0x9a47('0x41')]?_0xc9cd65[_0x9a47('0x40')]:_0x18f346[_0x9a47('0x3b')];if(_0x3c1f7f[_0x9a47('0x38')][_0x9a47('0x42')]){_0xc9cd65[_0x9a47('0x43')]=[{'all':!![]}];}_0xc9cd65=_['merge']({},_0xc9cd65,_0x3c1f7f[_0x9a47('0x44')]);return db['ChatInteraction'][_0x9a47('0x45')](_0xc9cd65)[_0x9a47('0x26')](handleEntityNotFound(_0x1d2ff3,null))['then'](respondWithResult(_0x1d2ff3,null))[_0x9a47('0x1d')](handleError(_0x1d2ff3,null));};exports[_0x9a47('0x46')]=function(_0x215308,_0x54618b){return db[_0x9a47('0x31')][_0x9a47('0x46')](_0x215308[_0x9a47('0x2c')],{})[_0x9a47('0x26')](respondWithResult(_0x54618b,0xc9))[_0x9a47('0x1d')](handleError(_0x54618b,null));};exports[_0x9a47('0x25')]=function(_0xc5582,_0x443925){if(_0xc5582[_0x9a47('0x2c')]['id']){delete _0xc5582[_0x9a47('0x2c')]['id'];}return db[_0x9a47('0x31')][_0x9a47('0x45')]({'where':{'id':_0xc5582[_0x9a47('0x47')]['id']}})['then'](handleEntityNotFound(_0x443925,null))[_0x9a47('0x26')](saveUpdates(_0xc5582[_0x9a47('0x2c')],null))['then'](respondWithResult(_0x443925,null))['catch'](handleError(_0x443925,null));};exports[_0x9a47('0x48')]=function(_0x4588a0,_0x5281f5){return db[_0x9a47('0x31')][_0x9a47('0x45')]({'where':{'id':_0x4588a0[_0x9a47('0x47')]['id']}})[_0x9a47('0x26')](handleEntityNotFound(_0x5281f5,null))[_0x9a47('0x26')](removeEntity(_0x5281f5,null))[_0x9a47('0x1d')](handleError(_0x5281f5,null));};exports[_0x9a47('0x49')]=function(_0x3f89f0,_0xe0c98c){return db[_0x9a47('0x31')][_0x9a47('0x49')]()[_0x9a47('0x26')](respondWithResult(_0xe0c98c,null))[_0x9a47('0x1d')](handleError(_0xe0c98c,null));};exports[_0x9a47('0x4a')]=function(_0x74d970,_0x36ce23){var _0x154821=_0x74d970[_0x9a47('0x47')]['id'];var _0x1fd70e;var _0x4cd5cd;var _0x3ed0e9;return db[_0x9a47('0x31')][_0x9a47('0x4b')]({'where':{'id':_0x154821}})[_0x9a47('0x26')](function(_0x55e358){_0x1fd70e=_0x55e358;return db[_0x9a47('0x4c')][_0x9a47('0x4b')]({'where':{'id':_0x55e358[_0x9a47('0x4d')]},'attributes':['id',_0x9a47('0x4e'),_0x9a47('0x4f'),'vidaooTopic',_0x9a47('0x50'),_0x9a47('0x51')],'raw':!![]});})[_0x9a47('0x26')](function(_0x569c4e){if(_0x569c4e&&_0x569c4e[_0x9a47('0x4e')]&&_0x569c4e[_0x9a47('0x4f')]){_0x4cd5cd=_0x569c4e;var _0x25c198={'interaction':{'id':_0x154821},'agent':{'id':_0x74d970[_0x9a47('0x39')]['id'],'name':_0x74d970[_0x9a47('0x39')]['name'],'fullname':_0x74d970[_0x9a47('0x39')][_0x9a47('0x52')],'email':_0x74d970[_0x9a47('0x39')][_0x9a47('0x53')]},'contact':_0x74d970[_0x9a47('0x2c')][_0x9a47('0x2d')],'account':_0x74d970['body'][_0x9a47('0x2f')]};var _0xaa8c4e={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x569c4e['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x74d970[_0x9a47('0x39')]['email']],'buttons':null,'topic':_0x4cd5cd['vidaooTopic'],'note':_['isNull'](_0x4cd5cd[_0x9a47('0x50')])?null:getMustacheRender(_0x4cd5cd[_0x9a47('0x50')],_0x25c198),'metadata':null},'redirect':_0x9a47('0x54'),'json':!![]};try{if(!_[_0x9a47('0x55')](_0x4cd5cd[_0x9a47('0x51')])){var _0x24cd6b=getMustacheRender(_0x4cd5cd['vidaooMetadata'],_0x25c198);var _0x4d5b4b=JSON[_0x9a47('0x56')](_0x24cd6b);_0xaa8c4e['body'][_0x9a47('0x57')]=_0x4d5b4b;}}catch(_0x593f34){throw new db['Sequelize']['ValidationError'](_0x9a47('0x58'));}return rp(_0xaa8c4e);}else{throw new db[(_0x9a47('0x59'))][(_0x9a47('0x5a'))](_0x9a47('0x5b'));}})[_0x9a47('0x26')](function(_0x1f3ecc){_0x3ed0e9=_0x1f3ecc;if(_0x3ed0e9['id']){var _0x443032={'body':_0x3ed0e9['join_url'],'ChatWebsiteId':_0x4cd5cd['id'],'ChatInteractionId':_0x1fd70e['id'],'direction':_0x9a47('0x5c'),'UserId':_0x74d970[_0x9a47('0x39')]['id']};return db[_0x9a47('0x5d')][_0x9a47('0x46')](_0x443032,{});}else{throw new db['Sequelize'][(_0x9a47('0x5a'))](_0x9a47('0x5e'));}})[_0x9a47('0x26')](function(){return _0x1fd70e['updateAttributes']({'vidaooSessionId':_0x3ed0e9['id']});})[_0x9a47('0x26')](respondWithResult(_0x36ce23,null))[_0x9a47('0x1d')](handleError(_0x36ce23,null));};exports[_0x9a47('0x5f')]=function(_0x6553a3,_0x2b954f){if(_0x6553a3[_0x9a47('0x2c')]['id']){delete _0x6553a3['body']['id'];}return db[_0x9a47('0x31')]['find']({'where':{'id':_0x6553a3[_0x9a47('0x47')]['id']},'include':[{'model':db[_0x9a47('0x60')],'as':_0x9a47('0x61')}]})['then'](handleEntityNotFound(_0x2b954f,null))[_0x9a47('0x26')](saveUpdates(_0x6553a3[_0x9a47('0x2c')],null))[_0x9a47('0x26')](respondWithResult(_0x2b954f,null))['catch'](handleError(_0x2b954f,null));};exports['abandon']=function(_0x241390,_0x3ee2d9){if(_0x241390['body']['id']){delete _0x241390[_0x9a47('0x2c')]['id'];}return db[_0x9a47('0x31')]['find']({'where':{'id':_0x241390[_0x9a47('0x47')]['id']}})[_0x9a47('0x26')](function(_0x463795){if(!_0x463795){logger['error'](_0x9a47('0x62'),_0x9a47('0x63'),0x194,_0x9a47('0x64'));_0x3ee2d9[_0x9a47('0x65')](0x194);}else{if(_0x463795[_0x9a47('0x66')]){throw new db[(_0x9a47('0x59'))][(_0x9a47('0x5a'))](_0x9a47('0x67'));}}return _0x463795;})[_0x9a47('0x26')](function(_0x1bc6db){if(_0x1bc6db){return _0x1bc6db[_0x9a47('0x25')]({'closed':_0x241390[_0x9a47('0x2c')][_0x9a47('0x68')],'disposition':_0x241390[_0x9a47('0x2c')]['disposition']})['then'](function(_0x4d54ed){return _0x4d54ed;});}})[_0x9a47('0x26')](function(){return respondWithRpcPromise(_0x9a47('0x69'),_0x9a47('0x63'),_0x241390['body'],client9004);})['then'](respondWithResult(_0x3ee2d9,null))[_0x9a47('0x1d')](handleError(_0x3ee2d9,null));};exports['attachmentUpload']=function(_0x3a1645,_0x558aef){_0x3a1645[_0x9a47('0x2c')][_0x9a47('0x28')]=_0x3a1645[_0x9a47('0x6a')]['originalname'];_0x3a1645[_0x9a47('0x2c')][_0x9a47('0x6b')]=_0x3a1645[_0x9a47('0x6a')][_0x9a47('0x6c')];_0x3a1645[_0x9a47('0x2c')][_0x9a47('0x34')]=_0x3a1645[_0x9a47('0x6a')][_0x9a47('0x6d')];return db[_0x9a47('0x6e')][_0x9a47('0x46')](_0x3a1645[_0x9a47('0x2c')])[_0x9a47('0x26')](respondWithResult(_0x558aef,0xc9))[_0x9a47('0x1d')](handleError(_0x558aef,null));};exports[_0x9a47('0x6f')]=function(_0x260981,_0x553a63){return db['ChatInteraction']['findOne']({'where':{'id':_0x260981[_0x9a47('0x47')]['id']},'raw':!![]})[_0x9a47('0x26')](handleEntityNotFound(_0x553a63,null))[_0x9a47('0x26')](function(_0x660463){if(_0x660463){if(_0x660463['closed']){return _0x553a63[_0x9a47('0x1e')](0x193)[_0x9a47('0x20')]({'status':0x193,'message':'Unauthorized'});}return db[_0x9a47('0x6e')][_0x9a47('0x4b')]({'where':{'id':_0x260981['query']['attachId']},'raw':!![]})[_0x9a47('0x26')](handleEntityNotFound(_0x553a63,null));}})[_0x9a47('0x26')](function(_0x452043){if(_0x452043){var _0x3e1724=_0x452043[_0x9a47('0x70')]!==null;var _0xa328e3=path[_0x9a47('0x71')](config[_0x9a47('0x72')],_0x9a47('0x73'));if(_0x3e1724){_0xa328e3=path[_0x9a47('0x71')](_0xa328e3,'offline-chat/');}var _0x434699=path[_0x9a47('0x71')](_0xa328e3,_0x452043[_0x9a47('0x6b')]);return _0x553a63[_0x9a47('0x74')](_0x434699);}})[_0x9a47('0x1d')](handleError(_0x553a63,null));};exports[_0x9a47('0x75')]=function(_0x1ec51e,_0x4e152c){var _0x2bd4f3=null;var _0x266461=null;var _0x33cdc0=null;if(_0x1ec51e[_0x9a47('0x2c')]['id']){delete _0x1ec51e[_0x9a47('0x2c')]['id'];}if(_0x1ec51e[_0x9a47('0x2c')][_0x9a47('0x76')]){_0x33cdc0=path[_0x9a47('0x71')](config[_0x9a47('0x72')],'server/files/chat/upload/',util['format']('transcript-%s.txt',Date[_0x9a47('0x77')]()));_0x1ec51e[_0x9a47('0x2c')][_0x9a47('0x78')]=_0x33cdc0;}return db[_0x9a47('0x31')][_0x9a47('0x45')]({'where':{'id':_0x1ec51e['params']['id']},'include':[{'model':db[_0x9a47('0x5d')],'as':_0x9a47('0x79'),'include':[{'model':db['User'],'as':_0x9a47('0x7a')}]}]})[_0x9a47('0x26')](handleEntityNotFound(_0x4e152c,null))['then'](saveUpdates(_0x1ec51e[_0x9a47('0x2c')],null))[_0x9a47('0x26')](function(_0x12097a){if(_0x12097a){_0x2bd4f3=_0x12097a;return db[_0x9a47('0x4c')][_0x9a47('0x45')]({'where':{'id':_0x2bd4f3[_0x9a47('0x4d')]}});}})[_0x9a47('0x26')](function(_0x5cef83){if(_0x5cef83){_0x266461=_0x5cef83;return db[_0x9a47('0x60')][_0x9a47('0x45')]({'where':{'id':_0x2bd4f3[_0x9a47('0x7b')]}});}})[_0x9a47('0x26')](function(_0x2392bd){if(_0x2392bd){if(_0x33cdc0){var _0x5b13d5=null;for(var _0x3d9ceb=0x1;_0x3d9ceb<_0x2bd4f3[_0x9a47('0x79')][_0x9a47('0x41')];++_0x3d9ceb){_0x5b13d5=_0x2bd4f3[_0x9a47('0x79')][_0x3d9ceb];var _0x48cc07=_0x5b13d5[_0x9a47('0x66')]?util[_0x9a47('0x7c')]('%s%d',_0x266461[_0x9a47('0x7d')],_0x5b13d5[_0x9a47('0x66')]):'System';var _0x4f2786=_0x1ec51e[_0x9a47('0x2c')][_0x9a47('0x7e')]||util[_0x9a47('0x7c')](_0x9a47('0x7f'),'Visitor',_0x5b13d5[_0x9a47('0x7b')]);switch(_0x266461['agentIdentifier']){case'website_alias':_0x48cc07=_0x5b13d5[_0x9a47('0x66')]?util[_0x9a47('0x7c')]('%s%d',_0x266461[_0x9a47('0x7d')],_0x5b13d5['UserId']):_0x9a47('0x80');break;case _0x9a47('0x81'):_0x48cc07=_0x5b13d5[_0x9a47('0x66')]?_0x5b13d5[_0x9a47('0x7a')][_0x9a47('0x82')]||_0x5b13d5['User'][_0x9a47('0x52')]:_0x9a47('0x80');break;case _0x9a47('0x83'):_0x48cc07=_0x5b13d5[_0x9a47('0x66')]?_0x5b13d5[_0x9a47('0x7a')][_0x9a47('0x52')]:_0x9a47('0x80');break;default:_0x48cc07=_0x5b13d5['UserId']?util[_0x9a47('0x7c')](_0x9a47('0x7f'),_0x266461[_0x9a47('0x7d')],_0x5b13d5[_0x9a47('0x66')]):'System';}var _0x580266=util[_0x9a47('0x7c')](_0x9a47('0x84'),moment(_0x5b13d5['createdAt'])[_0x9a47('0x7c')]('MM/DD/YYYY\x20HH:mm:ss'),_0x5b13d5['direction']==='in'?_0x4f2786:_0x48cc07,_0x5b13d5[_0x9a47('0x2c')]);if(!_0x5b13d5[_0x9a47('0x85')]){fs['appendFileSync'](_0x33cdc0,_0x580266);}}return db[_0x9a47('0x86')][_0x9a47('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0x9a47('0x87')],'as':_0x9a47('0x88'),'raw':!![],'include':[{'model':db[_0x9a47('0x89')],'as':_0x9a47('0x89'),'raw':!![]}]}]});}}})[_0x9a47('0x26')](function(_0x109044){if(!_0x109044||!_0x109044[_0x9a47('0x88')]||!_0x1ec51e[_0x9a47('0x2c')])return _0x2bd4f3;var _0xb241f3=_0x109044['getSmtpOptions']();return respondWithRpcPromise(_0x9a47('0x8a'),_0x9a47('0x8b'),{'account':_0xb241f3,'message':{'from':util[_0x9a47('0x7c')]('\x22%s\x22\x20<%s>',_0x109044['name'],_0x109044['email']||_0x109044['Smtp'][_0x9a47('0x39')]),'to':_0x1ec51e[_0x9a47('0x2c')][_0x9a47('0x76')],'subject':'Mail\x20Transcript','text':util[_0x9a47('0x7c')](_0x9a47('0x8c'),_0x1ec51e[_0x9a47('0x2c')][_0x9a47('0x76')]),'attachments':[{'path':_0x33cdc0}]}})[_0x9a47('0x26')](function(){return _0x2bd4f3;})['catch'](function(_0xa3f42c){logger[_0x9a47('0x1a')](_0xa3f42c);});})[_0x9a47('0x26')](respondWithStatusCode(_0x4e152c,0xc8))['catch'](handleError(_0x4e152c,null));};exports[_0x9a47('0x8d')]=function(_0x530682,_0x2fbe1c){return db[_0x9a47('0x5d')][_0x9a47('0x45')]({'where':{'id':_0x530682[_0x9a47('0x47')]['id']}})[_0x9a47('0x26')](handleEntityNotFound(_0x2fbe1c,null))[_0x9a47('0x26')](function(_0x11fbfc){if(_0x11fbfc){return _0x11fbfc[_0x9a47('0x8d')](_0x530682['body'][_0x9a47('0x8e')],_[_0x9a47('0x8f')](_0x530682[_0x9a47('0x2c')],[_0x9a47('0x8e'),'id'])||{});}})[_0x9a47('0x26')](respondWithResult(_0x2fbe1c,null))[_0x9a47('0x1d')](handleError(_0x2fbe1c,null));};exports['getMessages']=function(_0x4c54be,_0x4ae8df){var _0x5a4df4={'raw':![],'where':{}};var _0x3f5526={};var _0x5723b7={'count':0x0,'rows':[]};return db[_0x9a47('0x31')][_0x9a47('0x4b')]({'where':{'id':_0x4c54be[_0x9a47('0x47')]['id']}})[_0x9a47('0x26')](handleEntityNotFound(_0x4ae8df,null))[_0x9a47('0x26')](function(_0xddaf64){if(_0xddaf64){_0x3f5526[_0x9a47('0x3b')]=_[_0x9a47('0x3c')](db['ChatMessage'][_0x9a47('0x32')]);_0x3f5526[_0x9a47('0x38')]=_['keys'](_0x4c54be[_0x9a47('0x38')]);_0x3f5526[_0x9a47('0x3d')]=_['intersection'](_0x3f5526[_0x9a47('0x3b')],_0x3f5526[_0x9a47('0x38')]);_0x5a4df4[_0x9a47('0x40')]=_[_0x9a47('0x3e')](_0x3f5526[_0x9a47('0x3b')],qs[_0x9a47('0x3f')](_0x4c54be[_0x9a47('0x38')][_0x9a47('0x3f')]));_0x5a4df4[_0x9a47('0x40')]=_0x5a4df4['attributes'][_0x9a47('0x41')]?_0x5a4df4[_0x9a47('0x40')]:_0x3f5526[_0x9a47('0x3b')];if(!_0x4c54be[_0x9a47('0x38')][_0x9a47('0x90')](_0x9a47('0x91'))){_0x5a4df4['limit']=qs[_0x9a47('0x22')](_0x4c54be[_0x9a47('0x38')][_0x9a47('0x22')]);_0x5a4df4[_0x9a47('0x24')]=qs[_0x9a47('0x24')](_0x4c54be[_0x9a47('0x38')]['offset']);}_0x5a4df4['order']=qs[_0x9a47('0x92')](_0x4c54be[_0x9a47('0x38')][_0x9a47('0x92')]);_0x5a4df4[_0x9a47('0x93')]=qs[_0x9a47('0x3d')](_[_0x9a47('0x94')](_0x4c54be[_0x9a47('0x38')],_0x3f5526[_0x9a47('0x3d')]));_0x5a4df4[_0x9a47('0x93')]['ChatInteractionId']=_0xddaf64['id'];if(_0x4c54be[_0x9a47('0x38')][_0x9a47('0x95')]){_0x5a4df4[_0x9a47('0x93')]=_[_0x9a47('0x2b')](_0x5a4df4[_0x9a47('0x93')],{'$or':_[_0x9a47('0x96')](_0x5a4df4[_0x9a47('0x40')],function(_0x143486){var _0x86560e={};_0x86560e[_0x143486]={'$like':'%'+_0x4c54be[_0x9a47('0x38')][_0x9a47('0x95')]+'%'};return _0x86560e;})});}if(_0x4c54be['query']['$gte']){var _0x521753=_0x4c54be[_0x9a47('0x38')][_0x9a47('0x97')][_0x9a47('0x98')](',');var _0x2b1f7b={};_0x2b1f7b[_0x521753[0x0]]={'$gte':moment(_0x521753[0x1])[_0x9a47('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5a4df4[_0x9a47('0x93')]=_[_0x9a47('0x2b')](_0x5a4df4[_0x9a47('0x93')],_0x2b1f7b);}_0x5a4df4=_[_0x9a47('0x2b')]({},_0x5a4df4,_0x4c54be[_0x9a47('0x44')]);return db['ChatMessage'][_0x9a47('0x23')]({'where':_0x5a4df4[_0x9a47('0x93')]})[_0x9a47('0x26')](function(_0x298fee){_0x5723b7[_0x9a47('0x23')]=_0x298fee;if(_0x4c54be['query'][_0x9a47('0x42')]){_0x5a4df4['include']=[{'all':!![]}];}return db[_0x9a47('0x5d')]['findAll'](_0x5a4df4);})[_0x9a47('0x26')](function(_0x5e8a40){_0x5723b7[_0x9a47('0x99')]=_0x5e8a40;return _0x5723b7;});}})[_0x9a47('0x26')](respondWithFilteredResult(_0x4ae8df,_0x5a4df4))[_0x9a47('0x1d')](handleError(_0x4ae8df,null));};exports[_0x9a47('0x9a')]=function(_0x1d9976,_0xd31915){var _0x26709c={'where':{}},_0x508f2c={},_0x417c24={'count':0x0,'rows':[]};return db[_0x9a47('0x31')][_0x9a47('0x4b')]({'where':{'id':_0x1d9976[_0x9a47('0x47')]['id']}})[_0x9a47('0x26')](handleEntityNotFound(_0xd31915,null))[_0x9a47('0x26')](function(_0x56fac9){if(_0x56fac9){_0x508f2c['model']=_[_0x9a47('0x3c')](db[_0x9a47('0x5d')]['rawAttributes']);_0x508f2c[_0x9a47('0x38')]=_['keys'](_0x1d9976[_0x9a47('0x38')]);_0x508f2c[_0x9a47('0x3d')]=_[_0x9a47('0x3e')](_0x508f2c['model'],_0x508f2c[_0x9a47('0x38')]);_0x26709c[_0x9a47('0x40')]=_[_0x9a47('0x3e')](_0x508f2c['model'],qs[_0x9a47('0x3f')](_0x1d9976[_0x9a47('0x38')][_0x9a47('0x3f')]));_0x26709c['attributes']=_0x26709c[_0x9a47('0x40')][_0x9a47('0x41')]?_0x26709c['attributes']:_0x508f2c['model'];if(!_0x1d9976[_0x9a47('0x38')]['hasOwnProperty'](_0x9a47('0x91'))){_0x26709c['limit']=qs[_0x9a47('0x22')](_0x1d9976[_0x9a47('0x38')][_0x9a47('0x22')]);_0x26709c[_0x9a47('0x24')]=qs[_0x9a47('0x24')](_0x1d9976['query'][_0x9a47('0x24')]);}_0x26709c['order']=qs['sort'](_0x1d9976[_0x9a47('0x38')]['sort']);_0x26709c['where']=qs[_0x9a47('0x3d')](_['pick'](_0x1d9976['query'],_0x508f2c[_0x9a47('0x3d')]));_0x26709c[_0x9a47('0x93')][_0x9a47('0x9b')]=_0x56fac9['id'];if(_0x1d9976[_0x9a47('0x38')][_0x9a47('0x95')]){_0x26709c[_0x9a47('0x93')]=_[_0x9a47('0x2b')](_0x26709c[_0x9a47('0x93')],{'$or':_['map'](_0x26709c['attributes'],function(_0x2bb5e1){var _0x4a3a0b={};_0x4a3a0b[_0x2bb5e1]={'$like':'%'+_0x1d9976[_0x9a47('0x38')][_0x9a47('0x95')]+'%'};return _0x4a3a0b;})});}_0x26709c[_0x9a47('0x93')][_0x9a47('0x85')]=![];if(_0x1d9976[_0x9a47('0x38')]['id']){_0x26709c[_0x9a47('0x93')]['id']={'$gt':_0x1d9976[_0x9a47('0x38')]['id']};}_0x26709c=_[_0x9a47('0x2b')]({},_0x26709c,_0x1d9976[_0x9a47('0x44')]);return db['ChatMessage']['count']({'where':_0x26709c['where']})[_0x9a47('0x26')](function(_0x4a21b6){_0x417c24[_0x9a47('0x23')]=_0x4a21b6;_0x26709c['include']=[];if(_0x1d9976[_0x9a47('0x38')]['includeAgent']){_0x26709c['include'][_0x9a47('0x9c')]({'model':db[_0x9a47('0x7a')],'as':_0x9a47('0x7a'),'attributes':['id',_0x9a47('0x52'),_0x9a47('0x82')]});}if(_0x1d9976['query'][_0x9a47('0x42')]){_0x26709c[_0x9a47('0x43')]=[{'all':!![]}];}return db[_0x9a47('0x5d')]['findAll'](_0x26709c);})[_0x9a47('0x26')](function(_0x4ac92f){_0x417c24[_0x9a47('0x99')]=_0x4ac92f;return _0x417c24;});}})[_0x9a47('0x26')](respondWithFilteredResult(_0xd31915,_0x26709c))['catch'](handleError(_0xd31915,null));};exports[_0x9a47('0x9d')]=function(_0x5efa29,_0x319e8e){return db[_0x9a47('0x31')][_0x9a47('0x45')]({'where':{'id':_0x5efa29['params']['id']}})[_0x9a47('0x26')](handleEntityNotFound(_0x319e8e,null))[_0x9a47('0x26')](function(_0x189c2b){if(_0x189c2b){return _0x189c2b['setTags'](_0x5efa29['body'][_0x9a47('0x8e')],_['omit'](_0x5efa29[_0x9a47('0x2c')],[_0x9a47('0x8e'),'id'])||{})['spread'](function(){return db[_0x9a47('0x9e')]['findAll']({'attributes':['id',_0x9a47('0x28'),'color'],'where':{'id':_0x5efa29['body'][_0x9a47('0x8e')]}});})[_0x9a47('0x26')](function(_0x66829f){socket['emit'](_0x9a47('0x9f'),{'id':Number(_0x5efa29[_0x9a47('0x47')]['id']),'tags':_0x66829f||[]});return{'id':Number(_0x5efa29['params']['id']),'tags':_0x66829f||[]};});}})['then'](respondWithResult(_0x319e8e,null))[_0x9a47('0x1d')](handleError(_0x319e8e,null));};exports[_0x9a47('0xa0')]=function(_0x3a48e0,_0x1d8d45){return db[_0x9a47('0x31')][_0x9a47('0x45')]({'where':{'id':_0x3a48e0[_0x9a47('0x47')]['id']}})[_0x9a47('0x26')](handleEntityNotFound(_0x1d8d45,null))['then'](function(_0x5a751b){if(_0x5a751b){return _0x5a751b[_0x9a47('0xa0')](_0x3a48e0[_0x9a47('0x38')][_0x9a47('0x8e')]);}})['then'](respondWithStatusCode(_0x1d8d45,null))['catch'](handleError(_0x1d8d45,null));};exports[_0x9a47('0x74')]=function(_0x1965fa,_0x5e57ec){var _0x4b745c=moment()[_0x9a47('0xa1')]()[_0x9a47('0xa2')]();var _0x27414a=path[_0x9a47('0x71')](config[_0x9a47('0x72')],'server',_0x9a47('0xa3'),'tmp');var _0x3b3e24=path[_0x9a47('0x71')](config['root'],'server',_0x9a47('0xa3'),_0x9a47('0xa4'));var _0x4069bc=path[_0x9a47('0x71')](_0x27414a,_0x4b745c);var _0x150704=util[_0x9a47('0x7c')](_0x9a47('0xa5'),_0x1965fa['params']['id'],_0x4b745c);var _0x9ce6f2=path[_0x9a47('0x71')](_0x27414a,_0x150704);var _0x47dac9=[];_0x47dac9['push']({'model':db[_0x9a47('0x7a')],'as':_0x9a47('0x7a'),'attributes':['id',_0x9a47('0x52')],'raw':!![]});_0x47dac9[_0x9a47('0x9c')]({'model':db[_0x9a47('0x60')],'as':_0x9a47('0x61'),'attributes':['id',_0x9a47('0xa6'),_0x9a47('0xa7')],'raw':!![]});if(_0x1965fa[_0x9a47('0x38')][_0x9a47('0xa4')]){_0x47dac9[_0x9a47('0x9c')]({'model':db['Attachment'],'as':_0x9a47('0x6e'),'raw':!![]});}var _0x49eb82=[{'model':db[_0x9a47('0x5d')],'as':'Messages','attributes':['id',_0x9a47('0x2c'),_0x9a47('0xa8'),_0x9a47('0xa9'),_0x9a47('0x85'),_0x9a47('0xaa')],'include':_0x47dac9}];_0x49eb82[_0x9a47('0x9c')]({'model':db[_0x9a47('0x4c')],'as':_0x9a47('0xab'),'attributes':['id',_0x9a47('0x28')]});_0x49eb82[_0x9a47('0x9c')]({'model':db['User'],'as':'Owner','attributes':['id',_0x9a47('0x52')]});return db[_0x9a47('0x31')][_0x9a47('0x45')]({'where':{'id':_0x1965fa[_0x9a47('0x47')]['id']},'include':_0x49eb82})[_0x9a47('0x26')](handleEntityNotFound(_0x5e57ec,null))[_0x9a47('0x26')](function(_0xc605b4){if(_0xc605b4){var _0x402c8e=_0xc605b4[_0x9a47('0xac')]({'plain':!![]});fs[_0x9a47('0xad')](_0x4069bc);var _0x25589f={'channel':'Chat','account':_0x402c8e[_0x9a47('0xab')][_0x9a47('0x28')],'agent':_0x402c8e['Owner']?_0x402c8e[_0x9a47('0xae')][_0x9a47('0x52')]:_0x9a47('0xaf'),'createdAt':moment(_0x402c8e['createdAt'])[_0x9a47('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9a47('0xa2')](),'closedAt':_0x402c8e[_0x9a47('0x68')]?moment(_0x402c8e[_0x9a47('0xb0')])[_0x9a47('0x7c')](_0x9a47('0xb1'))[_0x9a47('0xa2')]():'','disposition':_0x402c8e[_0x9a47('0xb2')],'chatInfo':{'browser':_0x402c8e[_0x9a47('0xb3')],'os':_0x402c8e[_0x9a47('0xb4')],'referer':_0x402c8e['referer'],'customerIp':_0x402c8e[_0x9a47('0xb5')],'customerPort':_0x402c8e['customerPort']?_0x402c8e[_0x9a47('0xb6')]:_0x9a47('0xaf')},'messages':_(_0x402c8e[_0x9a47('0x79')])[_0x9a47('0xb7')]()['filter']({'secret':![]})[_0x9a47('0x96')](function(_0x189a04){if(_0x189a04['Attachment']){var _0x2f4b76=path['join'](_0x3b3e24,_0x189a04[_0x9a47('0x6e')][_0x9a47('0x6b')]);if(fs[_0x9a47('0xb8')](_0x2f4b76)){fs['createReadStream'](_0x2f4b76)[_0x9a47('0xb9')](fs[_0x9a47('0xba')](path[_0x9a47('0x71')](_0x4069bc,_0x189a04[_0x9a47('0x6e')][_0x9a47('0x6b')])));}}return{'date':moment(_0x189a04['createdAt'])['format'](_0x9a47('0xb1'))[_0x9a47('0xa2')](),'sender':_0x189a04[_0x9a47('0xa9')]===_0x9a47('0x5c')?_0x189a04[_0x9a47('0x7a')]?_0x189a04[_0x9a47('0x7a')][_0x9a47('0x52')]:_0x9a47('0x80'):_0x189a04[_0x9a47('0x61')][_0x9a47('0xa6')]+(_0x189a04[_0x9a47('0x61')][_0x9a47('0xa7')]?'\x20'+_0x189a04[_0x9a47('0x61')][_0x9a47('0xa7')]:''),'body':_0x189a04['Attachment']?_0x189a04[_0x9a47('0x6e')]['basename']:_0x189a04[_0x9a47('0x2c')],'direction':_0x189a04[_0x9a47('0xa9')]===_0x9a47('0x5c')?'A':'C','secret':_0x189a04['secret'],'read':_0x189a04['read'],'attachment':_0x189a04['Attachment']};})['value']()};return ejs[_0x9a47('0xbb')](path[_0x9a47('0x71')](config[_0x9a47('0x72')],'server',_0x9a47('0xbc'),_0x9a47('0xbd')),{'interaction':_0x25589f})[_0x9a47('0x26')](function(_0x54d774){var _0x1d675e=path[_0x9a47('0x71')](_0x4069bc,_0x9a47('0xbe')+_0x402c8e['id']+'-'+_0x4b745c+_0x9a47('0xbf'));var _0x169be7={'path':_0x1d675e,'channel':_0x9a47('0xc0'),'interactionId':_0x402c8e['id']};return pdf[_0x9a47('0xc1')](_0x54d774,_0x169be7);})[_0x9a47('0x26')](function(){return new Promise(function(_0x5cf492,_0x1763f7){zipdir(_0x4069bc,{'saveTo':_0x9ce6f2},function(_0x535db0,_0x2b3885){if(_0x535db0)return _0x1763f7(_0x535db0);return _0x5cf492(_0x2b3885);});})[_0x9a47('0x26')](function(){return new BPromise(function(_0x24c9f4,_0x26302f){rimraf(_0x4069bc,function(_0x2158e6){if(_0x2158e6)_0x26302f(_0x2158e6);return _0x24c9f4();});});})[_0x9a47('0x26')](function(){return _0x5e57ec['download'](_0x9ce6f2,_0x150704,function(_0x3c9320){if(_0x3c9320){logger[_0x9a47('0x1a')](_0x9a47('0xc2'),_0x3c9320);}else{fs['unlinkSync'](_0x9ce6f2);}});});});}else{return _0x5e57ec[_0x9a47('0x65')](0xc8);}})[_0x9a47('0x1d')](handleError(_0x5e57ec,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a5c3a6d..8d064b7 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 _0xca2b=['getUsers','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','save','update','remove'];(function(_0x575006,_0x26719a){var _0x183b83=function(_0x488b77){while(--_0x488b77){_0x575006['push'](_0x575006['shift']());}};_0x183b83(++_0x26719a);}(_0xca2b,0x8a));var _0xbca2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xca2b[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xbca2('0x0'));var ChatInteraction=require(_0xbca2('0x1'))['db'][_0xbca2('0x2')];var ChatMessage=require(_0xbca2('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbca2('0x3'),'afterUpdate':_0xbca2('0x4'),'afterDestroy':_0xbca2('0x5')};function emitEvent(_0x4fe21b){return function(_0xd54425,_0x43cacf,_0x567b50){_0xd54425[_0xbca2('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x9011ef){_0xd54425['setDataValue']('Users',_0x9011ef[_0xbca2('0x7')](function(_0x543c0f){return{'id':_0x543c0f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0xd54425['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x6643df){_0xd54425[_0xbca2('0x8')](_0xbca2('0x9'),_0x6643df[_0xbca2('0xa')]);ChatInteractionEvents[_0xbca2('0xb')](_0x4fe21b+':'+_0xd54425['id'],_0xd54425);ChatInteractionEvents[_0xbca2('0xb')](_0x4fe21b,_0xd54425);_0x567b50(null);})[_0xbca2('0xc')](_0x567b50(null));};}for(var e in events){if(events[_0xbca2('0xd')](e)){var event=events[e];ChatInteraction[_0xbca2('0xe')](e,emitEvent(event));}}module[_0xbca2('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x3725=['then','unreadMessages','emit','exports','events','../../mysqldb','ChatMessage','save','update','remove','getUsers','setDataValue','Users','map','findAll'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x3725,0x13f));var _0x5372=function(_0x4d973c,_0x36153f){_0x4d973c=_0x4d973c-0x0;var _0x33d408=_0x3725[_0x4d973c];return _0x33d408;};'use strict';var EventEmitter=require(_0x5372('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x5372('0x1'))['db'][_0x5372('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5372('0x3'),'afterUpdate':_0x5372('0x4'),'afterDestroy':_0x5372('0x5')};function emitEvent(_0x2beb86){return function(_0x43b022,_0x3356d8,_0x270b9a){_0x43b022[_0x5372('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4f84a9){_0x43b022[_0x5372('0x7')](_0x5372('0x8'),_0x4f84a9[_0x5372('0x9')](function(_0xc91dc3){return{'id':_0xc91dc3['id']};}));return ChatMessage[_0x5372('0xa')]({'where':{'ChatInteractionId':_0x43b022['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5372('0xb')](function(_0x2050da){_0x43b022[_0x5372('0x7')](_0x5372('0xc'),_0x2050da['length']);ChatInteractionEvents[_0x5372('0xd')](_0x2beb86+':'+_0x43b022['id'],_0x43b022);ChatInteractionEvents[_0x5372('0xd')](_0x2beb86,_0x43b022);_0x270b9a(null);})['catch'](_0x270b9a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x5372('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 825e8e7..38363e3 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 _0x3f8c=['api','moment','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x3f8c,0x1a6));var _0xc3f8=function(_0x5796a6,_0x20267a){_0x5796a6=_0x5796a6-0x0;var _0x1370da=_0x3f8c[_0x5796a6];return _0x1370da;};'use strict';var _=require(_0xc3f8('0x0'));var util=require(_0xc3f8('0x1'));var logger=require(_0xc3f8('0x2'))(_0xc3f8('0x3'));var moment=require(_0xc3f8('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3f8('0x5'));var fs=require('fs');var path=require(_0xc3f8('0x6'));var rimraf=require('rimraf');var config=require(_0xc3f8('0x7'));var attributes=require(_0xc3f8('0x8'));module[_0xc3f8('0x9')]=function(_0x53ca64,_0x555dcb){return _0x53ca64[_0xc3f8('0xa')](_0xc3f8('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x228893,_0x110afe,_0x3ce100){if(_0x228893['changed'](_0xc3f8('0xc'))){_0x228893[_0xc3f8('0xd')]=moment()[_0xc3f8('0xe')](_0xc3f8('0xf'));}_0x3ce100(null,_0x228893);}},'charset':_0xc3f8('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa557=['closed','closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','chat_interactions','changed'];(function(_0x5d75e5,_0x3b0e32){var _0x238cc3=function(_0x50ab73){while(--_0x50ab73){_0x5d75e5['push'](_0x5d75e5['shift']());}};_0x238cc3(++_0x3b0e32);}(_0xa557,0x16c));var _0x7a55=function(_0x25188d,_0x43a52d){_0x25188d=_0x25188d-0x0;var _0x4eca6f=_0xa557[_0x25188d];return _0x4eca6f;};'use strict';var _=require(_0x7a55('0x0'));var util=require('util');var logger=require(_0x7a55('0x1'))(_0x7a55('0x2'));var moment=require(_0x7a55('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a55('0x5'));var config=require(_0x7a55('0x6'));var attributes=require(_0x7a55('0x7'));module[_0x7a55('0x8')]=function(_0xb2aaf9,_0x7c56a7){return _0xb2aaf9['define']('ChatInteraction',attributes,{'tableName':_0x7a55('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4644db,_0x3ecafe,_0x5ba350){if(_0x4644db[_0x7a55('0xa')](_0x7a55('0xb'))){_0x4644db[_0x7a55('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5ba350(null,_0x4644db);}},'charset':_0x7a55('0xd'),'collate':_0x7a55('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index fc78229..db7840e 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 _0xfa89=['message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','where','attributes','stringify','AddTagsToChatInteraction','find','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s'];(function(_0x1833e7,_0x37bda7){var _0x37ee75=function(_0x5b8a59){while(--_0x5b8a59){_0x1833e7['push'](_0x1833e7['shift']());}};_0x37ee75(++_0x37bda7);}(_0xfa89,0xa7));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9fa8('0x0'));var moment=require(_0x9fa8('0x1'));var BPromise=require(_0x9fa8('0x2'));var rs=require(_0x9fa8('0x3'));var fs=require('fs');var Redis=require(_0x9fa8('0x4'));var db=require(_0x9fa8('0x5'))['db'];var utils=require(_0x9fa8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fa8('0x7'));var jayson=require(_0x9fa8('0x8'));var client=jayson['client'][_0x9fa8('0x9')]({'port':0x232a});config[_0x9fa8('0xa')]=_[_0x9fa8('0xb')](config[_0x9fa8('0xa')],{'host':_0x9fa8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9fa8('0xa')]));require(_0x9fa8('0xd'))[_0x9fa8('0xe')](socket);function respondWithRpcPromise(_0x951e87,_0x2b68c1,_0x334fdd){return new BPromise(function(_0xee411b,_0x9cd50f){return client[_0x9fa8('0xf')](_0x951e87,_0x334fdd)[_0x9fa8('0x10')](function(_0x551ff9){logger[_0x9fa8('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x2b68c1,_0x9fa8('0x12'));logger[_0x9fa8('0x13')](_0x9fa8('0x14'),_0x2b68c1,_0x9fa8('0x12'),JSON['stringify'](_0x551ff9));if(_0x551ff9['error']){if(_0x551ff9['error']['code']===0x1f4){logger[_0x9fa8('0x15')](_0x9fa8('0x16'),_0x2b68c1,_0x551ff9[_0x9fa8('0x15')][_0x9fa8('0x17')]);return _0x9cd50f(_0x551ff9[_0x9fa8('0x15')][_0x9fa8('0x17')]);}logger[_0x9fa8('0x15')](_0x9fa8('0x16'),_0x2b68c1,_0x551ff9['error'][_0x9fa8('0x17')]);return _0xee411b(_0x551ff9['error']['message']);}else{logger[_0x9fa8('0x11')](_0x9fa8('0x16'),_0x2b68c1,'request\x20sent');_0xee411b(_0x551ff9[_0x9fa8('0x18')][_0x9fa8('0x17')]);}})[_0x9fa8('0x19')](function(_0x11ca25){logger['error'](_0x9fa8('0x16'),_0x2b68c1,_0x11ca25);_0x9cd50f(_0x11ca25);});});}exports[_0x9fa8('0x1a')]=function(_0x52f2cd){var _0x396147=this;return new Promise(function(_0x3a726a,_0x491767){return db[_0x9fa8('0x1b')]['update'](_0x52f2cd[_0x9fa8('0x1c')],{'raw':_0x52f2cd[_0x9fa8('0x1d')]?_0x52f2cd[_0x9fa8('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52f2cd[_0x9fa8('0x1d')]?_0x52f2cd[_0x9fa8('0x1d')][_0x9fa8('0x1e')]||null:null,'attributes':_0x52f2cd[_0x9fa8('0x1d')]?_0x52f2cd[_0x9fa8('0x1d')][_0x9fa8('0x1f')]||null:null,'limit':_0x52f2cd['options']?_0x52f2cd[_0x9fa8('0x1d')]['limit']||null:null})[_0x9fa8('0x10')](function(_0x4e3c95){logger[_0x9fa8('0x11')]('UpdateChatInteraction',_0x52f2cd);logger[_0x9fa8('0x13')](_0x9fa8('0x1a'),_0x52f2cd,JSON[_0x9fa8('0x20')](_0x4e3c95));_0x3a726a(_0x4e3c95);})[_0x9fa8('0x19')](function(_0x470b6e){logger[_0x9fa8('0x15')](_0x9fa8('0x1a'),_0x470b6e[_0x9fa8('0x17')],_0x52f2cd);_0x491767(_0x396147[_0x9fa8('0x15')](0x1f4,_0x470b6e[_0x9fa8('0x17')]));});});};exports[_0x9fa8('0x21')]=function(_0x4f84d7){return new Promise(function(_0xa7e9e9,_0x78b12d){return db[_0x9fa8('0x1b')][_0x9fa8('0x22')]({'where':_0x4f84d7[_0x9fa8('0x1d')]?_0x4f84d7['options'][_0x9fa8('0x1e')]||null:null})[_0x9fa8('0x10')](function(_0x4d6711){if(_0x4d6711){return _0x4d6711['addTags'](_0x4f84d7[_0x9fa8('0x1c')]['ids'],_['omit'](_0x4f84d7[_0x9fa8('0x1c')],[_0x9fa8('0x23'),'id'])||{});}})[_0x9fa8('0x24')](function(_0x215867){logger['info'](_0x9fa8('0x25'),_0x4f84d7);logger['debug']('AddTags',_0x4f84d7,JSON[_0x9fa8('0x20')](_0x215867));_0xa7e9e9(_0x215867);})[_0x9fa8('0x19')](function(_0x5d825a){logger['error'](_0x9fa8('0x25'),_0x5d825a[_0x9fa8('0x17')],_0x4f84d7);_0x78b12d(_this['error'](0x1f4,_0x5d825a['message']));});});}; \ No newline at end of file +var _0xf6e2=['then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0xbd9650,_0x51ba81){var _0x374b5d=function(_0x300d18){while(--_0x300d18){_0xbd9650['push'](_0xbd9650['shift']());}};_0x374b5d(++_0x51ba81);}(_0xf6e2,0x14f));var _0x2f6e=function(_0x4fe6f1,_0x386a7a){_0x4fe6f1=_0x4fe6f1-0x0;var _0x338075=_0xf6e2[_0x4fe6f1];return _0x338075;};'use strict';var _=require('lodash');var util=require(_0x2f6e('0x0'));var moment=require(_0x2f6e('0x1'));var BPromise=require(_0x2f6e('0x2'));var rs=require(_0x2f6e('0x3'));var fs=require('fs');var Redis=require(_0x2f6e('0x4'));var db=require(_0x2f6e('0x5'))['db'];var utils=require(_0x2f6e('0x6'));var logger=require(_0x2f6e('0x7'))(_0x2f6e('0x8'));var config=require('../../config/environment');var jayson=require(_0x2f6e('0x9'));var client=jayson[_0x2f6e('0xa')]['http']({'port':0x232a});config[_0x2f6e('0xb')]=_[_0x2f6e('0xc')](config[_0x2f6e('0xb')],{'host':_0x2f6e('0xd'),'port':0x18eb});var socket=require(_0x2f6e('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x2f6e('0xf')](socket);function respondWithRpcPromise(_0x5ac768,_0x3e01ba,_0x37584f){return new BPromise(function(_0x14dd57,_0x432cf2){return client[_0x2f6e('0x10')](_0x5ac768,_0x37584f)[_0x2f6e('0x11')](function(_0x47943a){logger[_0x2f6e('0x12')](_0x2f6e('0x13'),_0x3e01ba,_0x2f6e('0x14'));logger[_0x2f6e('0x15')](_0x2f6e('0x16'),_0x3e01ba,_0x2f6e('0x14'),JSON[_0x2f6e('0x17')](_0x47943a));if(_0x47943a['error']){if(_0x47943a['error']['code']===0x1f4){logger[_0x2f6e('0x18')](_0x2f6e('0x13'),_0x3e01ba,_0x47943a[_0x2f6e('0x18')][_0x2f6e('0x19')]);return _0x432cf2(_0x47943a['error'][_0x2f6e('0x19')]);}logger[_0x2f6e('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x3e01ba,_0x47943a[_0x2f6e('0x18')][_0x2f6e('0x19')]);return _0x14dd57(_0x47943a[_0x2f6e('0x18')][_0x2f6e('0x19')]);}else{logger[_0x2f6e('0x12')](_0x2f6e('0x13'),_0x3e01ba,'request\x20sent');_0x14dd57(_0x47943a[_0x2f6e('0x1a')]['message']);}})[_0x2f6e('0x1b')](function(_0x28c865){logger[_0x2f6e('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x3e01ba,_0x28c865);_0x432cf2(_0x28c865);});});}exports['UpdateChatInteraction']=function(_0xe00f6f){var _0x5d5211=this;return new Promise(function(_0x20f107,_0x73ace9){return db[_0x2f6e('0x1c')][_0x2f6e('0x1d')](_0xe00f6f[_0x2f6e('0x1e')],{'raw':_0xe00f6f[_0x2f6e('0x1f')]?_0xe00f6f[_0x2f6e('0x1f')][_0x2f6e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe00f6f[_0x2f6e('0x1f')]?_0xe00f6f[_0x2f6e('0x1f')][_0x2f6e('0x21')]||null:null,'attributes':_0xe00f6f[_0x2f6e('0x1f')]?_0xe00f6f[_0x2f6e('0x1f')][_0x2f6e('0x22')]||null:null,'limit':_0xe00f6f['options']?_0xe00f6f['options'][_0x2f6e('0x23')]||null:null})['then'](function(_0x316219){logger[_0x2f6e('0x12')](_0x2f6e('0x24'),_0xe00f6f);logger['debug'](_0x2f6e('0x24'),_0xe00f6f,JSON['stringify'](_0x316219));_0x20f107(_0x316219);})[_0x2f6e('0x1b')](function(_0x4282d3){logger[_0x2f6e('0x18')](_0x2f6e('0x24'),_0x4282d3[_0x2f6e('0x19')],_0xe00f6f);_0x73ace9(_0x5d5211[_0x2f6e('0x18')](0x1f4,_0x4282d3[_0x2f6e('0x19')]));});});};exports[_0x2f6e('0x25')]=function(_0x23378b){return new Promise(function(_0x410c62,_0x37995d){return db[_0x2f6e('0x1c')][_0x2f6e('0x26')]({'where':_0x23378b[_0x2f6e('0x1f')]?_0x23378b[_0x2f6e('0x1f')]['where']||null:null})['then'](function(_0x1234b0){if(_0x1234b0){return _0x1234b0[_0x2f6e('0x27')](_0x23378b[_0x2f6e('0x1e')][_0x2f6e('0x28')],_[_0x2f6e('0x29')](_0x23378b[_0x2f6e('0x1e')],[_0x2f6e('0x28'),'id'])||{});}})[_0x2f6e('0x2a')](function(_0x31260c){logger[_0x2f6e('0x12')](_0x2f6e('0x2b'),_0x23378b);logger['debug'](_0x2f6e('0x2b'),_0x23378b,JSON[_0x2f6e('0x17')](_0x31260c));_0x410c62(_0x31260c);})[_0x2f6e('0x1b')](function(_0x286739){logger[_0x2f6e('0x18')](_0x2f6e('0x2b'),_0x286739[_0x2f6e('0x19')],_0x23378b);_0x37995d(_this[_0x2f6e('0x18')](0x1f4,_0x286739['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c88067b..47bd34d 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 _0x7eea=['./chatInteraction.events','save','remove','update','emit','removeListener','chatInteraction:'];(function(_0x2849f5,_0x5d2c3f){var _0x2aa0e4=function(_0xb415a7){while(--_0xb415a7){_0x2849f5['push'](_0x2849f5['shift']());}};_0x2aa0e4(++_0x5d2c3f);}(_0x7eea,0x7e));var _0xa7ee=function(_0x395152,_0x1507a8){_0x395152=_0x395152-0x0;var _0x373b2f=_0x7eea[_0x395152];return _0x373b2f;};'use strict';var ChatInteractionEvents=require(_0xa7ee('0x0'));var events=[_0xa7ee('0x1'),_0xa7ee('0x2'),_0xa7ee('0x3')];function createListener(_0x2a6a72,_0xda5fc6){return function(_0xe2ecac){_0xda5fc6[_0xa7ee('0x4')](_0x2a6a72,_0xe2ecac);};}function removeListener(_0x2779aa,_0xf00933){return function(){ChatInteractionEvents[_0xa7ee('0x5')](_0x2779aa,_0xf00933);};}exports['register']=function(_0x2c726c){for(var _0x3f3417=0x0,_0x35d130=events['length'];_0x3f3417<_0x35d130;_0x3f3417++){var _0x55adc4=events[_0x3f3417];var _0x3c18e5=createListener(_0xa7ee('0x6')+_0x55adc4,_0x2c726c);ChatInteractionEvents['on'](_0x55adc4,_0x3c18e5);}}; \ No newline at end of file +var _0xbb0d=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','update'];(function(_0x2119ee,_0x2b6196){var _0x19202c=function(_0xa20981){while(--_0xa20981){_0x2119ee['push'](_0x2119ee['shift']());}};_0x19202c(++_0x2b6196);}(_0xbb0d,0x1ad));var _0xdbb0=function(_0x592c0c,_0x28b163){_0x592c0c=_0x592c0c-0x0;var _0x44ce56=_0xbb0d[_0x592c0c];return _0x44ce56;};'use strict';var ChatInteractionEvents=require(_0xdbb0('0x0'));var events=[_0xdbb0('0x1'),'remove',_0xdbb0('0x2')];function createListener(_0x1bf6dd,_0x3189f3){return function(_0x2b11de){_0x3189f3[_0xdbb0('0x3')](_0x1bf6dd,_0x2b11de);};}function removeListener(_0x4247da,_0xe5bc84){return function(){ChatInteractionEvents[_0xdbb0('0x4')](_0x4247da,_0xe5bc84);};}exports[_0xdbb0('0x5')]=function(_0x5eaccd){for(var _0x17fdce=0x0,_0x1cbd30=events[_0xdbb0('0x6')];_0x17fdce<_0x1cbd30;_0x17fdce++){var _0x1ee4a3=events[_0x17fdce];var _0x3b0d1e=createListener(_0xdbb0('0x7')+_0x1ee4a3,_0x5eaccd);ChatInteractionEvents['on'](_0x1ee4a3,_0x3b0d1e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 758d389..20ce9ce 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 _0x46b0=['%s-%s','now','replace','single','file','addMessage','/:id/tags','tracked','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chat','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/'];(function(_0x4a0a02,_0x4c8dc5){var _0x2beac7=function(_0x32b784){while(--_0x32b784){_0x4a0a02['push'](_0x4a0a02['shift']());}};_0x2beac7(++_0x4c8dc5);}(_0x46b0,0x1bf));var _0x046b=function(_0x4cf252,_0x6c073e){_0x4cf252=_0x4cf252-0x0;var _0x16b1e5=_0x46b0[_0x4cf252];return _0x16b1e5;};'use strict';var multer=require(_0x046b('0x0'));var util=require(_0x046b('0x1'));var path=require('path');var timeout=require(_0x046b('0x2'));var express=require(_0x046b('0x3'));var router=express[_0x046b('0x4')]();var fs_extra=require(_0x046b('0x5'));var auth=require(_0x046b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x046b('0x7'));var controller=require(_0x046b('0x8'));router[_0x046b('0x9')]('/',auth[_0x046b('0xa')](),controller[_0x046b('0xb')]);router['get'](_0x046b('0xc'),auth[_0x046b('0xa')](),controller[_0x046b('0xd')]);router[_0x046b('0x9')](_0x046b('0xe'),auth[_0x046b('0xf')](),controller[_0x046b('0x10')]);router[_0x046b('0x9')]('/:id/attachment_download',auth[_0x046b('0xf')](),controller['attachmentDownload']);router[_0x046b('0x9')](_0x046b('0x11'),auth['isAuthenticated'](),controller[_0x046b('0x12')]);router[_0x046b('0x9')](_0x046b('0x13'),auth[_0x046b('0xf')](),controller[_0x046b('0x14')]);router[_0x046b('0x9')](_0x046b('0x15'),auth['isAuthenticated'](),controller[_0x046b('0x16')]);router[_0x046b('0x17')]('/',auth[_0x046b('0xa')](),controller[_0x046b('0x18')]);router['post'](_0x046b('0x19'),auth[_0x046b('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x046b('0x1a')]({'destination':function(_0x1bb762,_0x2f34af,_0x92d44a){_0x92d44a(null,path[_0x046b('0x1b')](config[_0x046b('0x1c')],_0x046b('0x1d')));},'filename':function(_0xa87a95,_0x3dffe5,_0x7267a2){_0x7267a2(null,util['format'](_0x046b('0x1e'),Date[_0x046b('0x1f')](),_0x3dffe5['originalname'][_0x046b('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x046b('0x21')](_0x046b('0x22')),controller['attachmentUpload']);router['post'](_0x046b('0x11'),auth[_0x046b('0xf')](),controller[_0x046b('0x23')]);router[_0x046b('0x17')](_0x046b('0x24'),auth[_0x046b('0xa')](),interaction[_0x046b('0x25')]('chat','chatinteraction:addtags'),controller[_0x046b('0x26')]);router[_0x046b('0x27')](_0x046b('0xe'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x046b('0x28')),controller[_0x046b('0x29')]);router[_0x046b('0x27')](_0x046b('0x2a'),controller[_0x046b('0x2b')]);router['put'](_0x046b('0x2c'),auth[_0x046b('0xf')](),controller['abandon']);router[_0x046b('0x27')](_0x046b('0x2d'),controller[_0x046b('0x2e')]);router[_0x046b('0x2f')]('/:id',auth[_0x046b('0xa')](),interaction[_0x046b('0x25')](_0x046b('0x30'),_0x046b('0x31')),controller[_0x046b('0x32')]);router[_0x046b('0x2f')](_0x046b('0x24'),auth[_0x046b('0xa')](),controller[_0x046b('0x33')]);module[_0x046b('0x34')]=router; \ No newline at end of file +var _0xc90b=['isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','format','%s-%s','now','originalname','replace','attachmentUpload','/:id/messages','addMessage','tracked','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','abandon','/:id/close','delete','chat','/:id/tags','removeTags','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xc90b,0x13b));var _0xbc90=function(_0x2f6891,_0xe2ce5a){_0x2f6891=_0x2f6891-0x0;var _0x6bcf76=_0xc90b[_0x2f6891];return _0x6bcf76;};'use strict';var multer=require(_0xbc90('0x0'));var util=require(_0xbc90('0x1'));var path=require(_0xbc90('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc90('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbc90('0x4'));var interaction=require(_0xbc90('0x5'));var config=require(_0xbc90('0x6'));var controller=require('./chatInteraction.controller');router[_0xbc90('0x7')]('/',auth['isAuthenticated'](),controller[_0xbc90('0x8')]);router[_0xbc90('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xbc90('0x7')](_0xbc90('0x9'),auth[_0xbc90('0xa')](),controller[_0xbc90('0xb')]);router[_0xbc90('0x7')](_0xbc90('0xc'),auth[_0xbc90('0xa')](),controller[_0xbc90('0xd')]);router[_0xbc90('0x7')]('/:id/messages',auth[_0xbc90('0xe')](),controller[_0xbc90('0xf')]);router[_0xbc90('0x7')](_0xbc90('0x10'),auth[_0xbc90('0xa')](),controller[_0xbc90('0x11')]);router[_0xbc90('0x7')](_0xbc90('0x12'),auth[_0xbc90('0xe')](),controller[_0xbc90('0x13')]);router[_0xbc90('0x14')]('/',auth['isAuthenticated'](),controller[_0xbc90('0x15')]);router[_0xbc90('0x14')](_0xbc90('0x16'),auth[_0xbc90('0xe')](),controller[_0xbc90('0x17')]);var upload=multer({'storage':multer[_0xbc90('0x18')]({'destination':function(_0x7ecd20,_0x3ea90e,_0x56ffe7){_0x56ffe7(null,path['join'](config[_0xbc90('0x19')],'server/files/attachments/'));},'filename':function(_0xcc503e,_0xb18d56,_0x9e61be){_0x9e61be(null,util[_0xbc90('0x1a')](_0xbc90('0x1b'),Date[_0xbc90('0x1c')](),_0xb18d56[_0xbc90('0x1d')][_0xbc90('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbc90('0x14')]('/:id/attachment_upload',upload['single']('file'),controller[_0xbc90('0x1f')]);router[_0xbc90('0x14')](_0xbc90('0x20'),auth['isChatInteractionAuthorized'](),controller[_0xbc90('0x21')]);router['post']('/:id/tags',auth[_0xbc90('0xe')](),interaction[_0xbc90('0x22')]('chat',_0xbc90('0x23')),controller[_0xbc90('0x24')]);router[_0xbc90('0x25')](_0xbc90('0x9'),auth[_0xbc90('0xe')](),interaction[_0xbc90('0x22')]('chat','chatinteraction:update'),controller[_0xbc90('0x26')]);router[_0xbc90('0x25')](_0xbc90('0x27'),controller[_0xbc90('0x28')]);router[_0xbc90('0x25')]('/:id/abandon',auth[_0xbc90('0xa')](),controller[_0xbc90('0x29')]);router[_0xbc90('0x25')](_0xbc90('0x2a'),controller['close']);router[_0xbc90('0x2b')](_0xbc90('0x9'),auth[_0xbc90('0xe')](),interaction[_0xbc90('0x22')](_0xbc90('0x2c'),'chatinteraction:destroy'),controller['destroy']);router['delete'](_0xbc90('0x2d'),auth[_0xbc90('0xe')](),controller[_0xbc90('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 227d7a2..7d00bca 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 _0x8abb=['TEXT','medium','INTEGER','sequelize'];(function(_0x53433f,_0x3b7cf7){var _0x526c67=function(_0x274519){while(--_0x274519){_0x53433f['push'](_0x53433f['shift']());}};_0x526c67(++_0x3b7cf7);}(_0x8abb,0x9f));var _0xb8ab=function(_0x48ec35,_0x22bbf5){_0x48ec35=_0x48ec35-0x0;var _0x25f526=_0x8abb[_0x48ec35];return _0x25f526;};'use strict';var Sequelize=require(_0xb8ab('0x0'));module['exports']={'body':{'type':Sequelize[_0xb8ab('0x1')](_0xb8ab('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb8ab('0x3')]}}; \ No newline at end of file +var _0xaa02=['sequelize'];(function(_0x2f4ca1,_0x8c1158){var _0x2a7056=function(_0x56a99a){while(--_0x56a99a){_0x2f4ca1['push'](_0x2f4ca1['shift']());}};_0x2a7056(++_0x8c1158);}(_0xaa02,0x1f2));var _0x2aa0=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xaa02[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x2aa0('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'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 4e737c2..f8de404 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 _0x571c=['include','ChatInternalMessage','catch','params','intersection','create','body','describe','get','lastMessageAt','createdAt','lastMessage','format','getUsers','User','findAll','agent','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','Agents','userProfileId','UserProfileResource','length','push','messages','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x3bc15e,_0x872aff){var _0x49087c=function(_0x3dbf7a){while(--_0x3dbf7a){_0x3bc15e['push'](_0x3bc15e['shift']());}};_0x49087c(++_0x872aff);}(_0x571c,0x106));var _0xc571=function(_0x3088ac,_0x1647f2){_0x3088ac=_0x3088ac-0x0;var _0x19d89d=_0x571c[_0x3088ac];return _0x19d89d;};'use strict';var emlformat=require(_0xc571('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc571('0x1'));var jsonpatch=require(_0xc571('0x2'));var rp=require('request-promise');var moment=require(_0xc571('0x3'));var BPromise=require(_0xc571('0x4'));var Mustache=require(_0xc571('0x5'));var util=require(_0xc571('0x6'));var path=require(_0xc571('0x7'));var sox=require(_0xc571('0x8'));var csv=require('to-csv');var ejs=require(_0xc571('0x9'));var fs=require('fs');var fs_extra=require(_0xc571('0xa'));var _=require(_0xc571('0xb'));var squel=require(_0xc571('0xc'));var crypto=require('crypto');var jsforce=require(_0xc571('0xd'));var deskjs=require(_0xc571('0xe'));var toCsv=require(_0xc571('0xf'));var querystring=require(_0xc571('0x10'));var Papa=require(_0xc571('0x11'));var Redis=require(_0xc571('0x12'));var authService=require(_0xc571('0x13'));var qs=require(_0xc571('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc571('0x15'))(_0xc571('0x16'));var utils=require('../../config/utils');var config=require(_0xc571('0x17'));var licenseUtil=require(_0xc571('0x18'));var db=require(_0xc571('0x19'))['db'];config[_0xc571('0x1a')]=_[_0xc571('0x1b')](config['redis'],{'host':_0xc571('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc571('0x1a')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x3b219b,_0x11ec97){_0x11ec97=_0x11ec97||0xcc;return function(_0x1198b2){if(_0x1198b2){return _0x3b219b[_0xc571('0x1d')](_0x11ec97);}return _0x3b219b[_0xc571('0x1e')](_0x11ec97)[_0xc571('0x1f')]();};}function respondWithResult(_0x1e559d,_0x4a8c92){_0x4a8c92=_0x4a8c92||0xc8;return function(_0x264967){if(_0x264967){return _0x1e559d['status'](_0x4a8c92)['json'](_0x264967);}};}function respondWithFilteredResult(_0x233ceb,_0x200cdd){return function(_0xc9c95e){if(_0xc9c95e){var _0x405c28=typeof _0x200cdd[_0xc571('0x20')]===_0xc571('0x21')&&typeof _0x200cdd[_0xc571('0x22')]===_0xc571('0x21');var _0x43987f=_0xc9c95e[_0xc571('0x23')];var _0x4f42d2=_0x405c28?0x0:_0x200cdd[_0xc571('0x20')];var _0x1ca9de=_0x405c28?_0xc9c95e[_0xc571('0x23')]:_0x200cdd[_0xc571('0x20')]+_0x200cdd[_0xc571('0x22')];var _0x14c735;if(_0x1ca9de>=_0x43987f){_0x1ca9de=_0x43987f;_0x14c735=0xc8;}else{_0x14c735=0xce;}_0x233ceb['status'](_0x14c735);return _0x233ceb[_0xc571('0x24')](_0xc571('0x25'),_0x4f42d2+'-'+_0x1ca9de+'/'+_0x43987f)[_0xc571('0x26')](_0xc9c95e);}return null;};}function patchUpdates(_0x107448){return function(_0x1d864e){try{jsonpatch[_0xc571('0x27')](_0x1d864e,_0x107448,!![]);}catch(_0x5a0142){return BPromise[_0xc571('0x28')](_0x5a0142);}return _0x1d864e[_0xc571('0x29')]();};}function saveUpdates(_0x2bffde,_0x465f64){return function(_0x29591f){if(_0x29591f){return _0x29591f[_0xc571('0x2a')](_0x2bffde)[_0xc571('0x2b')](function(_0xb70b03){return _0xb70b03;});}return null;};}function removeEntity(_0x46eab2,_0x2ebb7f){return function(_0x109921){if(_0x109921){return _0x109921[_0xc571('0x2c')]()[_0xc571('0x2b')](function(){_0x46eab2[_0xc571('0x1e')](0xcc)[_0xc571('0x1f')]();});}};}function handleEntityNotFound(_0xf122f2,_0x1c4662){return function(_0x2afc79){if(!_0x2afc79){_0xf122f2[_0xc571('0x1d')](0x194);}return _0x2afc79;};}function handleError(_0xd5718b,_0x43a93e){_0x43a93e=_0x43a93e||0x1f4;return function(_0xbca8e3){logger[_0xc571('0x2d')](_0xbca8e3[_0xc571('0x2e')]);if(_0xbca8e3['name']){delete _0xbca8e3['name'];}_0xd5718b[_0xc571('0x1e')](_0x43a93e)[_0xc571('0x2f')](_0xbca8e3);};}exports['index']=function(_0x59bda7,_0x103d94){var _0x45b862={},_0x3f5b2f={},_0x4bcdf7={'count':0x0,'rows':[]};var _0x5ea250=_[_0xc571('0x30')](db['ChatInternalMessage'][_0xc571('0x31')],function(_0x194a27){return{'name':_0x194a27[_0xc571('0x32')],'type':_0x194a27[_0xc571('0x33')][_0xc571('0x34')]};});_0x3f5b2f[_0xc571('0x35')]=_[_0xc571('0x30')](_0x5ea250,_0xc571('0x36'));_0x3f5b2f[_0xc571('0x37')]=_[_0xc571('0x38')](_0x59bda7[_0xc571('0x37')]);_0x3f5b2f[_0xc571('0x39')]=_['intersection'](_0x3f5b2f['model'],_0x3f5b2f[_0xc571('0x37')]);_0x45b862[_0xc571('0x3a')]=_['intersection'](_0x3f5b2f[_0xc571('0x35')],qs[_0xc571('0x3b')](_0x59bda7[_0xc571('0x37')]['fields']));_0x45b862['attributes']=_0x45b862[_0xc571('0x3a')]['length']?_0x45b862[_0xc571('0x3a')]:_0x3f5b2f['model'];if(!_0x59bda7[_0xc571('0x37')][_0xc571('0x3c')](_0xc571('0x3d'))){_0x45b862[_0xc571('0x22')]=qs[_0xc571('0x22')](_0x59bda7[_0xc571('0x37')][_0xc571('0x22')]);_0x45b862['offset']=qs[_0xc571('0x20')](_0x59bda7[_0xc571('0x37')]['offset']);}_0x45b862[_0xc571('0x3e')]=qs[_0xc571('0x3f')](_0x59bda7['query'][_0xc571('0x3f')]);_0x45b862['where']=qs['filters'](_[_0xc571('0x40')](_0x59bda7[_0xc571('0x37')],_0x3f5b2f[_0xc571('0x39')]),_0x5ea250);if(_0x59bda7[_0xc571('0x37')][_0xc571('0x41')]){_0x45b862[_0xc571('0x42')]=_[_0xc571('0x43')](_0x45b862[_0xc571('0x42')],{'$or':_[_0xc571('0x30')](_0x5ea250,function(_0x42a3ea){if(_0x42a3ea[_0xc571('0x33')]!==_0xc571('0x44')){var _0x59a621={};_0x59a621[_0x42a3ea['name']]={'$like':'%'+_0x59bda7[_0xc571('0x37')][_0xc571('0x41')]+'%'};return _0x59a621;}})});}_0x45b862=_[_0xc571('0x43')]({},_0x45b862,_0x59bda7[_0xc571('0x45')]);var _0x123fa9={'where':_0x45b862[_0xc571('0x42')]};return db['ChatInternalMessage'][_0xc571('0x23')](_0x123fa9)[_0xc571('0x2b')](function(_0x2788ba){_0x4bcdf7['count']=_0x2788ba;if(_0x59bda7['query'][_0xc571('0x46')]){_0x45b862[_0xc571('0x47')]=[{'all':!![]}];}return db[_0xc571('0x48')]['findAll'](_0x45b862);})['then'](function(_0x11f5ea){_0x4bcdf7['rows']=_0x11f5ea;return _0x4bcdf7;})[_0xc571('0x2b')](respondWithFilteredResult(_0x103d94,_0x45b862))[_0xc571('0x49')](handleError(_0x103d94,null));};exports['show']=function(_0x4d7af9,_0x272485){var _0x2decd7={'raw':!![],'where':{'id':_0x4d7af9[_0xc571('0x4a')]['id']}},_0x4ae188={};_0x4ae188[_0xc571('0x35')]=_[_0xc571('0x38')](db['ChatInternalMessage'][_0xc571('0x31')]);_0x4ae188['query']=_[_0xc571('0x38')](_0x4d7af9['query']);_0x4ae188[_0xc571('0x39')]=_[_0xc571('0x4b')](_0x4ae188[_0xc571('0x35')],_0x4ae188[_0xc571('0x37')]);_0x2decd7[_0xc571('0x3a')]=_['intersection'](_0x4ae188[_0xc571('0x35')],qs[_0xc571('0x3b')](_0x4d7af9['query'][_0xc571('0x3b')]));_0x2decd7['attributes']=_0x2decd7[_0xc571('0x3a')]['length']?_0x2decd7[_0xc571('0x3a')]:_0x4ae188[_0xc571('0x35')];if(_0x4d7af9['query']['includeAll']){_0x2decd7[_0xc571('0x47')]=[{'all':!![]}];}_0x2decd7=_['merge']({},_0x2decd7,_0x4d7af9[_0xc571('0x45')]);return db[_0xc571('0x48')]['find'](_0x2decd7)[_0xc571('0x2b')](handleEntityNotFound(_0x272485,null))['then'](respondWithResult(_0x272485,null))[_0xc571('0x49')](handleError(_0x272485,null));};exports[_0xc571('0x4c')]=function(_0x6298f1,_0x10b33b){return db['ChatInternalMessage']['create'](_0x6298f1[_0xc571('0x4d')],{})[_0xc571('0x2b')](respondWithResult(_0x10b33b,0xc9))[_0xc571('0x49')](handleError(_0x10b33b,null));};exports[_0xc571('0x2a')]=function(_0xfeb373,_0xad4b35){if(_0xfeb373[_0xc571('0x4d')]['id']){delete _0xfeb373[_0xc571('0x4d')]['id'];}return db[_0xc571('0x48')]['find']({'where':{'id':_0xfeb373[_0xc571('0x4a')]['id']}})[_0xc571('0x2b')](handleEntityNotFound(_0xad4b35,null))['then'](saveUpdates(_0xfeb373[_0xc571('0x4d')],null))[_0xc571('0x2b')](respondWithResult(_0xad4b35,null))['catch'](handleError(_0xad4b35,null));};exports[_0xc571('0x2c')]=function(_0x10b861,_0x43c2fa){return db[_0xc571('0x48')]['find']({'where':{'id':_0x10b861[_0xc571('0x4a')]['id']}})[_0xc571('0x2b')](handleEntityNotFound(_0x43c2fa,null))[_0xc571('0x2b')](removeEntity(_0x43c2fa,null))['catch'](handleError(_0x43c2fa,null));};exports[_0xc571('0x4e')]=function(_0x43e72a,_0x244801){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x244801,null))[_0xc571('0x49')](handleError(_0x244801,null));};function wrapUser(_0x428661){return function(_0x12b6cf){var _0x2cf7b9=_0x428661[_0xc571('0x4f')]({'plain':!![]});_0x2cf7b9['messages']=[];if(_0x12b6cf){_0x2cf7b9[_0xc571('0x50')]=_0x12b6cf[_0xc571('0x51')];_0x2cf7b9[_0xc571('0x52')]=_0x12b6cf;}else{_0x2cf7b9['lastMessageAt']=moment(0x0)[_0xc571('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x2cf7b9[_0xc571('0x52')]={};}return _0x2cf7b9;};}exports[_0xc571('0x54')]=function(_0xff5a14,_0x2d18b3,_0x689bdb){var _0xeb1d91=[];return db[_0xc571('0x55')][_0xc571('0x56')]({'where':{'role':[_0xc571('0x57'),_0xc571('0x58'),_0xc571('0x59')]},'attributes':['id',_0xc571('0x5a'),'name',_0xc571('0x5b'),_0xc571('0x5c'),_0xc571('0x5d'),'online',_0xc571('0x5e'),_0xc571('0x5f'),_0xc571('0x60')],'order':qs[_0xc571('0x3f')]('-online'),'include':[{'model':db[_0xc571('0x61')],'as':_0xc571('0x62'),'attributes':['id',_0xc571('0x36'),_0xc571('0x33')],'through':{'attributes':[]}}]})[_0xc571('0x2b')](function(_0x5ac25e){if(_0x5ac25e){var _0x3ee3ae=_0xff5a14['user'][_0xc571('0x4f')]({'plain':!![]});if(!_0x3ee3ae)throw new Error(_0xc571('0x63'));if(_0x3ee3ae[_0xc571('0x5b')]==='user'){return db['UserProfileSection'][_0xc571('0x64')]({'where':{'name':_0xc571('0x65'),'userProfileId':_0x3ee3ae[_0xc571('0x66')]},'raw':!![]})[_0xc571('0x2b')](function(_0x559c61){if(_0x559c61){if(_0x559c61['autoAssociation']===0x0){return db[_0xc571('0x67')]['findAll']({'where':{'sectionId':_0x559c61['id']},'raw':!![]})['then'](function(_0x5097e1){var _0x4de96f=[];if(_['isEmpty'](_0x5097e1)){_0x4de96f=_[_0xc571('0x41')](_0x5ac25e,function(_0x487e08){if(_0x487e08[_0xc571('0x5b')]!=='agent'){return _0x487e08;}});return _0x4de96f;}else{for(var _0x64d9c8=0x0;_0x64d9c8<_0x5ac25e[_0xc571('0x68')];_0x64d9c8++){var _0x3fac51=_0x5ac25e[_0x64d9c8];if(_0x3fac51[_0xc571('0x5b')]===_0xc571('0x57')){var _0x218df0=_[_0xc571('0x64')](_0x5097e1,function(_0x4eb52b){return _0x4eb52b['resourceId']===_0x3fac51['id'];});if(_0x218df0)_0x4de96f[_0xc571('0x69')](_0x3fac51);}else{_0x4de96f[_0xc571('0x69')](_0x3fac51);}}return _0x4de96f;}});}else{return _0x5ac25e;}}else{var _0x1c0861=_[_0xc571('0x41')](_0x5ac25e,function(_0x231080){if(_0x231080['role']!==_0xc571('0x57')){return _0x231080;}});return _0x1c0861;}});}else{return _0x5ac25e;}}})[_0xc571('0x2b')](function(_0x5675bd){var _0x599e0a=[];if(_0x5675bd){_0xeb1d91=_0x5675bd;for(var _0x44ed5a=0x0;_0x44ed5a<_0x5675bd[_0xc571('0x68')];_0x44ed5a+=0x1){_0xeb1d91[_0x44ed5a][_0xc571('0x6a')]=[];_0x599e0a[_0xc571('0x69')](db[_0xc571('0x48')][_0xc571('0x64')]({'where':{'FromId':[_0xff5a14[_0xc571('0x59')]['id'],_0x5675bd[_0x44ed5a]['id']],'ToId':[_0xff5a14[_0xc571('0x59')]['id'],_0x5675bd[_0x44ed5a]['id']],'ChatGroupId':null},'attributes':['id',_0xc571('0x51'),'FromId',_0xc571('0x6b'),_0xc571('0x6c'),_0xc571('0x4d')],'order':qs[_0xc571('0x3f')](_0xc571('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc571('0x2b')](wrapUser(_0x5675bd[_0x44ed5a])));}return BPromise[_0xc571('0x6e')](_0x599e0a);}return[];})[_0xc571('0x2b')](function(_0x511dd8){return{'rows':_0x511dd8,'count':_0x511dd8[_0xc571('0x68')]};})[_0xc571('0x2b')](respondWithResult(_0x2d18b3,null))['catch'](handleError(_0x2d18b3,null));}; \ No newline at end of file +var _0x88cc=['format','User','agent','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','push','FromId','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','send','index','ChatInternalMessage','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','rows','catch','params','include','find','create','body','update','describe','get','messages','createdAt','lastMessage','lastMessageAt'];(function(_0x3ae6f0,_0xf814e){var _0x5d4aa4=function(_0x2280fb){while(--_0x2280fb){_0x3ae6f0['push'](_0x3ae6f0['shift']());}};_0x5d4aa4(++_0xf814e);}(_0x88cc,0x16b));var _0xc88c=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0x88cc[_0x4c06ac];return _0x2333cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc88c('0x0'));var zipdir=require(_0xc88c('0x1'));var jsonpatch=require(_0xc88c('0x2'));var rp=require(_0xc88c('0x3'));var moment=require(_0xc88c('0x4'));var BPromise=require(_0xc88c('0x5'));var Mustache=require(_0xc88c('0x6'));var util=require(_0xc88c('0x7'));var path=require(_0xc88c('0x8'));var sox=require(_0xc88c('0x9'));var csv=require(_0xc88c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc88c('0xb'));var _=require('lodash');var squel=require(_0xc88c('0xc'));var crypto=require(_0xc88c('0xd'));var jsforce=require(_0xc88c('0xe'));var deskjs=require(_0xc88c('0xf'));var toCsv=require(_0xc88c('0xa'));var querystring=require(_0xc88c('0x10'));var Papa=require(_0xc88c('0x11'));var Redis=require(_0xc88c('0x12'));var authService=require(_0xc88c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc88c('0x14'));var hardwareService=require(_0xc88c('0x15'));var logger=require(_0xc88c('0x16'))(_0xc88c('0x17'));var utils=require(_0xc88c('0x18'));var config=require(_0xc88c('0x19'));var licenseUtil=require(_0xc88c('0x1a'));var db=require(_0xc88c('0x1b'))['db'];config['redis']=_['defaults'](config[_0xc88c('0x1c')],{'host':_0xc88c('0x1d'),'port':0x18eb});var socket=require(_0xc88c('0x1e'))(new Redis(config['redis']));require(_0xc88c('0x1f'))[_0xc88c('0x20')](socket);function respondWithStatusCode(_0x386023,_0x3f22ad){_0x3f22ad=_0x3f22ad||0xcc;return function(_0xc61ebe){if(_0xc61ebe){return _0x386023[_0xc88c('0x21')](_0x3f22ad);}return _0x386023['status'](_0x3f22ad)['end']();};}function respondWithResult(_0x3acf0f,_0x1e9b32){_0x1e9b32=_0x1e9b32||0xc8;return function(_0x4cf3fe){if(_0x4cf3fe){return _0x3acf0f[_0xc88c('0x22')](_0x1e9b32)[_0xc88c('0x23')](_0x4cf3fe);}};}function respondWithFilteredResult(_0x88f26f,_0x1d0af3){return function(_0x263801){if(_0x263801){var _0x270ef0=typeof _0x1d0af3[_0xc88c('0x24')]===_0xc88c('0x25')&&typeof _0x1d0af3[_0xc88c('0x26')]===_0xc88c('0x25');var _0x1e3711=_0x263801[_0xc88c('0x27')];var _0x4522e2=_0x270ef0?0x0:_0x1d0af3[_0xc88c('0x24')];var _0x1e39f7=_0x270ef0?_0x263801[_0xc88c('0x27')]:_0x1d0af3[_0xc88c('0x24')]+_0x1d0af3[_0xc88c('0x26')];var _0x3a877f;if(_0x1e39f7>=_0x1e3711){_0x1e39f7=_0x1e3711;_0x3a877f=0xc8;}else{_0x3a877f=0xce;}_0x88f26f[_0xc88c('0x22')](_0x3a877f);return _0x88f26f[_0xc88c('0x28')](_0xc88c('0x29'),_0x4522e2+'-'+_0x1e39f7+'/'+_0x1e3711)['json'](_0x263801);}return null;};}function patchUpdates(_0x1e3da5){return function(_0x37a09e){try{jsonpatch[_0xc88c('0x2a')](_0x37a09e,_0x1e3da5,!![]);}catch(_0x190ea9){return BPromise['reject'](_0x190ea9);}return _0x37a09e[_0xc88c('0x2b')]();};}function saveUpdates(_0x3f00e1,_0x4ff21d){return function(_0x151726){if(_0x151726){return _0x151726['update'](_0x3f00e1)[_0xc88c('0x2c')](function(_0x595146){return _0x595146;});}return null;};}function removeEntity(_0x36888a,_0x8a95c0){return function(_0x4f7da9){if(_0x4f7da9){return _0x4f7da9[_0xc88c('0x2d')]()[_0xc88c('0x2c')](function(){_0x36888a['status'](0xcc)[_0xc88c('0x2e')]();});}};}function handleEntityNotFound(_0x76440e,_0x3ea352){return function(_0x25cd48){if(!_0x25cd48){_0x76440e[_0xc88c('0x21')](0x194);}return _0x25cd48;};}function handleError(_0x9ccbe0,_0x13e407){_0x13e407=_0x13e407||0x1f4;return function(_0x5637ae){logger[_0xc88c('0x2f')](_0x5637ae['stack']);if(_0x5637ae['name']){delete _0x5637ae['name'];}_0x9ccbe0['status'](_0x13e407)[_0xc88c('0x30')](_0x5637ae);};}exports[_0xc88c('0x31')]=function(_0x4ade37,_0x1a121c){var _0x3e7560={},_0x1bde1c={},_0x4cf2ac={'count':0x0,'rows':[]};var _0x4ba997=_['map'](db[_0xc88c('0x32')][_0xc88c('0x33')],function(_0x475a2d){return{'name':_0x475a2d[_0xc88c('0x34')],'type':_0x475a2d['type'][_0xc88c('0x35')]};});_0x1bde1c[_0xc88c('0x36')]=_[_0xc88c('0x37')](_0x4ba997,'name');_0x1bde1c['query']=_[_0xc88c('0x38')](_0x4ade37[_0xc88c('0x39')]);_0x1bde1c[_0xc88c('0x3a')]=_[_0xc88c('0x3b')](_0x1bde1c['model'],_0x1bde1c['query']);_0x3e7560[_0xc88c('0x3c')]=_['intersection'](_0x1bde1c[_0xc88c('0x36')],qs[_0xc88c('0x3d')](_0x4ade37[_0xc88c('0x39')]['fields']));_0x3e7560['attributes']=_0x3e7560[_0xc88c('0x3c')][_0xc88c('0x3e')]?_0x3e7560[_0xc88c('0x3c')]:_0x1bde1c['model'];if(!_0x4ade37[_0xc88c('0x39')][_0xc88c('0x3f')]('nolimit')){_0x3e7560[_0xc88c('0x26')]=qs[_0xc88c('0x26')](_0x4ade37[_0xc88c('0x39')][_0xc88c('0x26')]);_0x3e7560[_0xc88c('0x24')]=qs['offset'](_0x4ade37[_0xc88c('0x39')][_0xc88c('0x24')]);}_0x3e7560[_0xc88c('0x40')]=qs[_0xc88c('0x41')](_0x4ade37[_0xc88c('0x39')][_0xc88c('0x41')]);_0x3e7560['where']=qs[_0xc88c('0x3a')](_[_0xc88c('0x42')](_0x4ade37[_0xc88c('0x39')],_0x1bde1c['filters']),_0x4ba997);if(_0x4ade37[_0xc88c('0x39')][_0xc88c('0x43')]){_0x3e7560[_0xc88c('0x44')]=_[_0xc88c('0x45')](_0x3e7560['where'],{'$or':_['map'](_0x4ba997,function(_0x57950e){if(_0x57950e['type']!==_0xc88c('0x46')){var _0x46b7c1={};_0x46b7c1[_0x57950e[_0xc88c('0x47')]]={'$like':'%'+_0x4ade37[_0xc88c('0x39')][_0xc88c('0x43')]+'%'};return _0x46b7c1;}})});}_0x3e7560=_['merge']({},_0x3e7560,_0x4ade37[_0xc88c('0x48')]);var _0x49d5a1={'where':_0x3e7560[_0xc88c('0x44')]};return db['ChatInternalMessage'][_0xc88c('0x27')](_0x49d5a1)[_0xc88c('0x2c')](function(_0x432001){_0x4cf2ac[_0xc88c('0x27')]=_0x432001;if(_0x4ade37[_0xc88c('0x39')][_0xc88c('0x49')]){_0x3e7560['include']=[{'all':!![]}];}return db[_0xc88c('0x32')][_0xc88c('0x4a')](_0x3e7560);})['then'](function(_0x4f5dfe){_0x4cf2ac[_0xc88c('0x4b')]=_0x4f5dfe;return _0x4cf2ac;})['then'](respondWithFilteredResult(_0x1a121c,_0x3e7560))[_0xc88c('0x4c')](handleError(_0x1a121c,null));};exports['show']=function(_0x2f255b,_0x429af5){var _0x4239fe={'raw':!![],'where':{'id':_0x2f255b[_0xc88c('0x4d')]['id']}},_0x4ddb53={};_0x4ddb53[_0xc88c('0x36')]=_[_0xc88c('0x38')](db['ChatInternalMessage'][_0xc88c('0x33')]);_0x4ddb53['query']=_[_0xc88c('0x38')](_0x2f255b[_0xc88c('0x39')]);_0x4ddb53['filters']=_[_0xc88c('0x3b')](_0x4ddb53[_0xc88c('0x36')],_0x4ddb53[_0xc88c('0x39')]);_0x4239fe['attributes']=_[_0xc88c('0x3b')](_0x4ddb53[_0xc88c('0x36')],qs[_0xc88c('0x3d')](_0x2f255b['query'][_0xc88c('0x3d')]));_0x4239fe[_0xc88c('0x3c')]=_0x4239fe['attributes'][_0xc88c('0x3e')]?_0x4239fe[_0xc88c('0x3c')]:_0x4ddb53['model'];if(_0x2f255b['query'][_0xc88c('0x49')]){_0x4239fe[_0xc88c('0x4e')]=[{'all':!![]}];}_0x4239fe=_[_0xc88c('0x45')]({},_0x4239fe,_0x2f255b[_0xc88c('0x48')]);return db[_0xc88c('0x32')][_0xc88c('0x4f')](_0x4239fe)[_0xc88c('0x2c')](handleEntityNotFound(_0x429af5,null))['then'](respondWithResult(_0x429af5,null))['catch'](handleError(_0x429af5,null));};exports[_0xc88c('0x50')]=function(_0x49fbdd,_0x27ccaa){return db[_0xc88c('0x32')][_0xc88c('0x50')](_0x49fbdd[_0xc88c('0x51')],{})[_0xc88c('0x2c')](respondWithResult(_0x27ccaa,0xc9))[_0xc88c('0x4c')](handleError(_0x27ccaa,null));};exports[_0xc88c('0x52')]=function(_0x31139a,_0x95ef6f){if(_0x31139a[_0xc88c('0x51')]['id']){delete _0x31139a[_0xc88c('0x51')]['id'];}return db['ChatInternalMessage'][_0xc88c('0x4f')]({'where':{'id':_0x31139a[_0xc88c('0x4d')]['id']}})[_0xc88c('0x2c')](handleEntityNotFound(_0x95ef6f,null))[_0xc88c('0x2c')](saveUpdates(_0x31139a[_0xc88c('0x51')],null))['then'](respondWithResult(_0x95ef6f,null))['catch'](handleError(_0x95ef6f,null));};exports[_0xc88c('0x2d')]=function(_0x512403,_0x109648){return db[_0xc88c('0x32')]['find']({'where':{'id':_0x512403[_0xc88c('0x4d')]['id']}})[_0xc88c('0x2c')](handleEntityNotFound(_0x109648,null))['then'](removeEntity(_0x109648,null))[_0xc88c('0x4c')](handleError(_0x109648,null));};exports['describe']=function(_0x2e1c3b,_0x308423){return db['ChatInternalMessage'][_0xc88c('0x53')]()['then'](respondWithResult(_0x308423,null))[_0xc88c('0x4c')](handleError(_0x308423,null));};function wrapUser(_0x54abcc){return function(_0x56c075){var _0x4130d6=_0x54abcc[_0xc88c('0x54')]({'plain':!![]});_0x4130d6[_0xc88c('0x55')]=[];if(_0x56c075){_0x4130d6['lastMessageAt']=_0x56c075[_0xc88c('0x56')];_0x4130d6[_0xc88c('0x57')]=_0x56c075;}else{_0x4130d6[_0xc88c('0x58')]=moment(0x0)[_0xc88c('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x4130d6[_0xc88c('0x57')]={};}return _0x4130d6;};}exports['getUsers']=function(_0x4d404f,_0x59b871,_0x1e5c01){var _0x1ea0ff=[];return db[_0xc88c('0x5a')]['findAll']({'where':{'role':[_0xc88c('0x5b'),_0xc88c('0x5c'),_0xc88c('0x5d')]},'attributes':['id',_0xc88c('0x5e'),_0xc88c('0x47'),_0xc88c('0x5f'),_0xc88c('0x60'),_0xc88c('0x61'),'online',_0xc88c('0x62'),_0xc88c('0x63'),_0xc88c('0x64')],'order':qs[_0xc88c('0x41')](_0xc88c('0x65')),'include':[{'model':db[_0xc88c('0x66')],'as':_0xc88c('0x67'),'attributes':['id',_0xc88c('0x47'),_0xc88c('0x68')],'through':{'attributes':[]}}]})[_0xc88c('0x2c')](function(_0x5d61e9){if(_0x5d61e9){var _0x530bc5=_0x4d404f['user'][_0xc88c('0x54')]({'plain':!![]});if(!_0x530bc5)throw new Error(_0xc88c('0x69'));if(_0x530bc5[_0xc88c('0x5f')]==='user'){return db[_0xc88c('0x6a')][_0xc88c('0x4f')]({'where':{'name':'Agents','userProfileId':_0x530bc5[_0xc88c('0x6b')]},'raw':!![]})[_0xc88c('0x2c')](function(_0x392a03){if(_0x392a03){if(_0x392a03['autoAssociation']===0x0){return db[_0xc88c('0x6c')][_0xc88c('0x4a')]({'where':{'sectionId':_0x392a03['id']},'raw':!![]})[_0xc88c('0x2c')](function(_0x57bba0){var _0x381bf7=[];if(_['isEmpty'](_0x57bba0)){_0x381bf7=_[_0xc88c('0x43')](_0x5d61e9,function(_0x304880){if(_0x304880[_0xc88c('0x5f')]!==_0xc88c('0x5b')){return _0x304880;}});return _0x381bf7;}else{for(var _0xbb9dfa=0x0;_0xbb9dfa<_0x5d61e9['length'];_0xbb9dfa++){var _0x154d82=_0x5d61e9[_0xbb9dfa];if(_0x154d82[_0xc88c('0x5f')]==='agent'){var _0x3af848=_['find'](_0x57bba0,function(_0x4fbde8){return _0x4fbde8['resourceId']===_0x154d82['id'];});if(_0x3af848)_0x381bf7[_0xc88c('0x6d')](_0x154d82);}else{_0x381bf7[_0xc88c('0x6d')](_0x154d82);}}return _0x381bf7;}});}else{return _0x5d61e9;}}else{var _0x52edc8=_[_0xc88c('0x43')](_0x5d61e9,function(_0xf58e20){if(_0xf58e20[_0xc88c('0x5f')]!==_0xc88c('0x5b')){return _0xf58e20;}});return _0x52edc8;}});}else{return _0x5d61e9;}}})[_0xc88c('0x2c')](function(_0x31d74e){var _0x2e59c2=[];if(_0x31d74e){_0x1ea0ff=_0x31d74e;for(var _0x7e9996=0x0;_0x7e9996<_0x31d74e[_0xc88c('0x3e')];_0x7e9996+=0x1){_0x1ea0ff[_0x7e9996][_0xc88c('0x55')]=[];_0x2e59c2[_0xc88c('0x6d')](db['ChatInternalMessage'][_0xc88c('0x4f')]({'where':{'FromId':[_0x4d404f[_0xc88c('0x5d')]['id'],_0x31d74e[_0x7e9996]['id']],'ToId':[_0x4d404f[_0xc88c('0x5d')]['id'],_0x31d74e[_0x7e9996]['id']],'ChatGroupId':null},'attributes':['id',_0xc88c('0x56'),_0xc88c('0x6e'),'ToId','read',_0xc88c('0x51')],'order':qs[_0xc88c('0x41')](_0xc88c('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc88c('0x2c')](wrapUser(_0x31d74e[_0x7e9996])));}return BPromise[_0xc88c('0x70')](_0x2e59c2);}return[];})[_0xc88c('0x2c')](function(_0x9f1282){return{'rows':_0x9f1282,'count':_0x9f1282['length']};})[_0xc88c('0x2c')](respondWithResult(_0x59b871,null))['catch'](handleError(_0x59b871,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0ba9996..3d360d4 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 _0xd98c=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x49aed9,_0x4a7b44){var _0x5c913e=function(_0x454bf7){while(--_0x454bf7){_0x49aed9['push'](_0x49aed9['shift']());}};_0x5c913e(++_0x4a7b44);}(_0xd98c,0xe3));var _0xcd98=function(_0x1f68e1,_0x206dc8){_0x1f68e1=_0x1f68e1-0x0;var _0x35d201=_0xd98c[_0x1f68e1];return _0x35d201;};'use strict';var EventEmitter=require(_0xcd98('0x0'));var ChatInternalMessage=require(_0xcd98('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xcd98('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcd98('0x3'),'afterDestroy':_0xcd98('0x4')};function emitEvent(_0x2c4b4b){return function(_0x526bc9,_0x5c245c,_0x2c69b5){ChatInternalMessageEvents[_0xcd98('0x5')](_0x2c4b4b+':'+_0x526bc9['id'],_0x526bc9);ChatInternalMessageEvents['emit'](_0x2c4b4b,_0x526bc9);_0x2c69b5(null);};}for(var e in events){if(events[_0xcd98('0x6')](e)){var event=events[e];ChatInternalMessage[_0xcd98('0x7')](e,emitEvent(event));}}module[_0xcd98('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb16a=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0xcba290,_0xd59e33){var _0x5a813b=function(_0x340860){while(--_0x340860){_0xcba290['push'](_0xcba290['shift']());}};_0x5a813b(++_0xd59e33);}(_0xb16a,0x178));var _0xab16=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb16a[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0xab16('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xab16('0x1')](0x0);var events={'afterCreate':_0xab16('0x2'),'afterUpdate':_0xab16('0x3'),'afterDestroy':_0xab16('0x4')};function emitEvent(_0x1ddca0){return function(_0x5dae4a,_0x1823cc,_0x4ee03e){ChatInternalMessageEvents[_0xab16('0x5')](_0x1ddca0+':'+_0x5dae4a['id'],_0x5dae4a);ChatInternalMessageEvents['emit'](_0x1ddca0,_0x5dae4a);_0x4ee03e(null);};}for(var e in events){if(events[_0xab16('0x6')](e)){var event=events[e];ChatInternalMessage[_0xab16('0x7')](e,emitEvent(event));}}module[_0xab16('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3e8408e..3a748a9 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 _0x3ccf=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatInternalMessage.attributes','exports','define'];(function(_0x68b457,_0x525e03){var _0x994162=function(_0x5224f7){while(--_0x5224f7){_0x68b457['push'](_0x68b457['shift']());}};_0x994162(++_0x525e03);}(_0x3ccf,0xd6));var _0xf3cc=function(_0x3fe929,_0x1f90e5){_0x3fe929=_0x3fe929-0x0;var _0x1f46a3=_0x3ccf[_0x3fe929];return _0x1f46a3;};'use strict';var _=require(_0xf3cc('0x0'));var util=require(_0xf3cc('0x1'));var logger=require(_0xf3cc('0x2'))(_0xf3cc('0x3'));var moment=require(_0xf3cc('0x4'));var BPromise=require(_0xf3cc('0x5'));var rp=require(_0xf3cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3cc('0x7'));var config=require('../../config/environment');var attributes=require(_0xf3cc('0x8'));module[_0xf3cc('0x9')]=function(_0x50f8e6,_0x5a6dda){return _0x50f8e6[_0xf3cc('0xa')](_0xf3cc('0xb'),attributes,{'tableName':_0xf3cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf3cc('0xd'),'collate':_0xf3cc('0xe')});}; \ No newline at end of file +var _0x5928=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x41df75,_0x2b4605){var _0x3dfc97=function(_0x567477){while(--_0x567477){_0x41df75['push'](_0x41df75['shift']());}};_0x3dfc97(++_0x2b4605);}(_0x5928,0x14d));var _0x8592=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5928[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8592('0x0'));var util=require(_0x8592('0x1'));var logger=require(_0x8592('0x2'))(_0x8592('0x3'));var moment=require(_0x8592('0x4'));var BPromise=require(_0x8592('0x5'));var rp=require(_0x8592('0x6'));var fs=require('fs');var path=require(_0x8592('0x7'));var rimraf=require(_0x8592('0x8'));var config=require(_0x8592('0x9'));var attributes=require(_0x8592('0xa'));module[_0x8592('0xb')]=function(_0x56150b,_0x1a4118){return _0x56150b[_0x8592('0xc')](_0x8592('0xd'),attributes,{'tableName':_0x8592('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8592('0xf'),'collate':_0x8592('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1d8ee5e..9016114 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 _0x636d=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','util','moment'];(function(_0x38d3bd,_0x49f837){var _0x19022c=function(_0x30341f){while(--_0x30341f){_0x38d3bd['push'](_0x38d3bd['shift']());}};_0x19022c(++_0x49f837);}(_0x636d,0xf0));var _0xd636=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x636d[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0xd636('0x0'));var util=require(_0xd636('0x1'));var moment=require(_0xd636('0x2'));var BPromise=require(_0xd636('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd636('0x4'))['db'];var utils=require(_0xd636('0x5'));var logger=require(_0xd636('0x6'))(_0xd636('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd636('0x8')][_0xd636('0x9')]({'port':0x232a});config['redis']=_[_0xd636('0xa')](config['redis'],{'host':_0xd636('0xb'),'port':0x18eb});var socket=require(_0xd636('0xc'))(new Redis(config[_0xd636('0xd')]));require(_0xd636('0xe'))[_0xd636('0xf')](socket);function respondWithRpcPromise(_0x4b02db,_0x587d55,_0x526e0f){return new BPromise(function(_0x3863db,_0x36099d){return client[_0xd636('0x10')](_0x4b02db,_0x526e0f)[_0xd636('0x11')](function(_0x41784c){logger['info'](_0xd636('0x12'),_0x587d55,_0xd636('0x13'));logger['debug'](_0xd636('0x14'),_0x587d55,_0xd636('0x13'),JSON[_0xd636('0x15')](_0x41784c));if(_0x41784c['error']){if(_0x41784c['error'][_0xd636('0x16')]===0x1f4){logger[_0xd636('0x17')](_0xd636('0x12'),_0x587d55,_0x41784c[_0xd636('0x17')][_0xd636('0x18')]);return _0x36099d(_0x41784c['error']['message']);}logger[_0xd636('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x587d55,_0x41784c['error'][_0xd636('0x18')]);return _0x3863db(_0x41784c[_0xd636('0x17')][_0xd636('0x18')]);}else{logger[_0xd636('0x19')](_0xd636('0x12'),_0x587d55,_0xd636('0x13'));_0x3863db(_0x41784c[_0xd636('0x1a')]['message']);}})['catch'](function(_0x56a6a5){logger[_0xd636('0x17')](_0xd636('0x12'),_0x587d55,_0x56a6a5);_0x36099d(_0x56a6a5);});});} \ No newline at end of file +var _0x88b4=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xa9f2e0,_0x4821ed){var _0x4526cc=function(_0x233007){while(--_0x233007){_0xa9f2e0['push'](_0xa9f2e0['shift']());}};_0x4526cc(++_0x4821ed);}(_0x88b4,0xa8));var _0x488b=function(_0x266ddc,_0x45aa52){_0x266ddc=_0x266ddc-0x0;var _0x39c1d7=_0x88b4[_0x266ddc];return _0x39c1d7;};'use strict';var _=require(_0x488b('0x0'));var util=require(_0x488b('0x1'));var moment=require(_0x488b('0x2'));var BPromise=require('bluebird');var rs=require(_0x488b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x488b('0x4'));var logger=require(_0x488b('0x5'))(_0x488b('0x6'));var config=require(_0x488b('0x7'));var jayson=require(_0x488b('0x8'));var client=jayson[_0x488b('0x9')][_0x488b('0xa')]({'port':0x232a});config[_0x488b('0xb')]=_[_0x488b('0xc')](config[_0x488b('0xb')],{'host':_0x488b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x488b('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ee69e,_0x40932a,_0x34e733){return new BPromise(function(_0x5b37aa,_0x3066c0){return client[_0x488b('0xf')](_0x4ee69e,_0x34e733)[_0x488b('0x10')](function(_0x453092){logger[_0x488b('0x11')](_0x488b('0x12'),_0x40932a,_0x488b('0x13'));logger[_0x488b('0x14')](_0x488b('0x15'),_0x40932a,_0x488b('0x13'),JSON[_0x488b('0x16')](_0x453092));if(_0x453092['error']){if(_0x453092[_0x488b('0x17')][_0x488b('0x18')]===0x1f4){logger[_0x488b('0x17')](_0x488b('0x12'),_0x40932a,_0x453092['error'][_0x488b('0x19')]);return _0x3066c0(_0x453092[_0x488b('0x17')]['message']);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x40932a,_0x453092[_0x488b('0x17')]['message']);return _0x5b37aa(_0x453092['error']['message']);}else{logger['info'](_0x488b('0x12'),_0x40932a,_0x488b('0x13'));_0x5b37aa(_0x453092[_0x488b('0x1a')][_0x488b('0x19')]);}})[_0x488b('0x1b')](function(_0x4f6edb){logger['error'](_0x488b('0x12'),_0x40932a,_0x4f6edb);_0x3066c0(_0x4f6edb);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 2ce5abe..278dcbe 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 _0x674f=['emit','removeListener','register','length','./chatInternalMessage.events','save','remove','update'];(function(_0x75c2cc,_0x3ada99){var _0x340fe4=function(_0x3b2401){while(--_0x3b2401){_0x75c2cc['push'](_0x75c2cc['shift']());}};_0x340fe4(++_0x3ada99);}(_0x674f,0x1c4));var _0xf674=function(_0x34af24,_0x14918f){_0x34af24=_0x34af24-0x0;var _0x33fd87=_0x674f[_0x34af24];return _0x33fd87;};'use strict';var ChatInternalMessageEvents=require(_0xf674('0x0'));var events=[_0xf674('0x1'),_0xf674('0x2'),_0xf674('0x3')];function createListener(_0x44b6fa,_0x5b0df8){return function(_0x3daefd){_0x5b0df8[_0xf674('0x4')](_0x44b6fa,_0x3daefd);};}function removeListener(_0x3fe02a,_0x19f66f){return function(){ChatInternalMessageEvents[_0xf674('0x5')](_0x3fe02a,_0x19f66f);};}exports[_0xf674('0x6')]=function(_0xba55e4){for(var _0x271696=0x0,_0x525450=events[_0xf674('0x7')];_0x271696<_0x525450;_0x271696++){var _0x747ed6=events[_0x271696];var _0x4c2d54=createListener('chatInternalMessage:'+_0x747ed6,_0xba55e4);ChatInternalMessageEvents['on'](_0x747ed6,_0x4c2d54);}}; \ No newline at end of file +var _0x1775=['update','emit','removeListener','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x1fac11,_0x419598){var _0x4d4b72=function(_0x24c1c0){while(--_0x24c1c0){_0x1fac11['push'](_0x1fac11['shift']());}};_0x4d4b72(++_0x419598);}(_0x1775,0xa5));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var ChatInternalMessageEvents=require(_0x5177('0x0'));var events=[_0x5177('0x1'),_0x5177('0x2'),_0x5177('0x3')];function createListener(_0x5151f4,_0x4c6b4a){return function(_0x1d8f64){_0x4c6b4a[_0x5177('0x4')](_0x5151f4,_0x1d8f64);};}function removeListener(_0x4ca381,_0x2ff3b3){return function(){ChatInternalMessageEvents[_0x5177('0x5')](_0x4ca381,_0x2ff3b3);};}exports['register']=function(_0x14099d){for(var _0x277312=0x0,_0x13c7ad=events['length'];_0x277312<_0x13c7ad;_0x277312++){var _0x3afc7d=events[_0x277312];var _0x30e354=createListener(_0x5177('0x6')+_0x3afc7d,_0x14099d);ChatInternalMessageEvents['on'](_0x3afc7d,_0x30e354);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 479ff91..59bcee1 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 _0x1402=['/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers'];(function(_0x5ca644,_0x3d2165){var _0x5c87a2=function(_0x3dc7d9){while(--_0x3dc7d9){_0x5ca644['push'](_0x5ca644['shift']());}};_0x5c87a2(++_0x3d2165);}(_0x1402,0x1eb));var _0x2140=function(_0x1170e5,_0xc0e250){_0x1170e5=_0x1170e5-0x0;var _0x3ec902=_0x1402[_0x1170e5];return _0x3ec902;};'use strict';var multer=require(_0x2140('0x0'));var util=require(_0x2140('0x1'));var path=require('path');var timeout=require(_0x2140('0x2'));var express=require(_0x2140('0x3'));var router=express['Router']();var fs_extra=require(_0x2140('0x4'));var auth=require(_0x2140('0x5'));var interaction=require(_0x2140('0x6'));var config=require(_0x2140('0x7'));var controller=require(_0x2140('0x8'));router[_0x2140('0x9')]('/',auth[_0x2140('0xa')](),controller['index']);router['get'](_0x2140('0xb'),auth[_0x2140('0xa')](),controller[_0x2140('0xc')]);router[_0x2140('0x9')](_0x2140('0xd'),auth[_0x2140('0xa')](),controller[_0x2140('0xe')]);router[_0x2140('0x9')](_0x2140('0xf'),auth[_0x2140('0xa')](),controller[_0x2140('0x10')]);router['post']('/',auth[_0x2140('0xa')](),controller[_0x2140('0x11')]);router[_0x2140('0x12')]('/:id',controller[_0x2140('0x13')]);router[_0x2140('0x14')](_0x2140('0xf'),auth[_0x2140('0xa')](),controller[_0x2140('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbf8e=['../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b3a32,_0x548cdd){var _0x3d0dd5=function(_0x53b5e5){while(--_0x53b5e5){_0x2b3a32['push'](_0x2b3a32['shift']());}};_0x3d0dd5(++_0x548cdd);}(_0xbf8e,0x100));var _0xebf8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbf8e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xebf8('0x0'));var util=require(_0xebf8('0x1'));var path=require(_0xebf8('0x2'));var timeout=require('connect-timeout');var express=require(_0xebf8('0x3'));var router=express[_0xebf8('0x4')]();var fs_extra=require(_0xebf8('0x5'));var auth=require(_0xebf8('0x6'));var interaction=require(_0xebf8('0x7'));var config=require(_0xebf8('0x8'));var controller=require(_0xebf8('0x9'));router[_0xebf8('0xa')]('/',auth[_0xebf8('0xb')](),controller[_0xebf8('0xc')]);router['get'](_0xebf8('0xd'),auth[_0xebf8('0xb')](),controller['describe']);router[_0xebf8('0xa')](_0xebf8('0xe'),auth[_0xebf8('0xb')](),controller[_0xebf8('0xf')]);router[_0xebf8('0xa')](_0xebf8('0x10'),auth['isAuthenticated'](),controller[_0xebf8('0x11')]);router['post']('/',auth[_0xebf8('0xb')](),controller[_0xebf8('0x12')]);router[_0xebf8('0x13')](_0xebf8('0x10'),controller[_0xebf8('0x14')]);router[_0xebf8('0x15')](_0xebf8('0x10'),auth[_0xebf8('0xb')](),controller[_0xebf8('0x16')]);module[_0xebf8('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 96d3e2e..4e7e820 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 _0x1219=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9121('0x0'));module[_0x9121('0x1')]={'body':{'type':Sequelize[_0x9121('0x2')](_0x9121('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9121('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9121('0x5')]('in','out'),'defaultValue':_0x9121('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9121('0x7')]},'providerName':{'type':Sequelize[_0x9121('0x8')]},'providerResponse':{'type':Sequelize[_0x9121('0x2')]}}; \ No newline at end of file +var _0xb10b=['DATE','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x2bfc60,_0xa254ab){_0x2bfc60=_0x2bfc60-0x0;var _0x44ea2c=_0xb10b[_0x2bfc60];return _0x44ea2c;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb10('0x4')]('in',_0xbb10('0x5')),'defaultValue':_0xbb10('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbb10('0x6')]},'providerName':{'type':Sequelize[_0xbb10('0x7')]},'providerResponse':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 2429d84..08f0757 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 _0x51b8=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','../../config/logger','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','name','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','accept','chat','UserId','user','agent','get','ChatInteraction','interaction','role','null','rejectMessage','ContactId','Sequelize','QueryTypes','contact','User','email','SIP/%s','channel','motionChannel','event','reject','EventManager','rejectmessage','parse','formData','util','ioredis','../../components/interaction/service','api'];(function(_0x1ea7d4,_0x2257bd){var _0x55e995=function(_0x34937a){while(--_0x34937a){_0x1ea7d4['push'](_0x1ea7d4['shift']());}};_0x55e995(++_0x2257bd);}(_0x51b8,0x190));var _0x851b=function(_0x43d4f7,_0x2aba64){_0x43d4f7=_0x43d4f7-0x0;var _0x2ad52e=_0x51b8[_0x43d4f7];return _0x2ad52e;};'use strict';var util=require(_0x851b('0x0'));var _=require('lodash');var Redis=require(_0x851b('0x1'));var interactionService=require(_0x851b('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x851b('0x3'));var config=require(_0x851b('0x4'));var db=require(_0x851b('0x5'))['db'];config[_0x851b('0x6')]=_[_0x851b('0x7')](config['redis'],{'host':_0x851b('0x8'),'port':0x18eb});var socket=require(_0x851b('0x9'))(new Redis(config[_0x851b('0x6')]));require(_0x851b('0xa'))[_0x851b('0xb')](socket);var jayson=require(_0x851b('0xc'));var client=jayson['client'][_0x851b('0xd')]({'port':0x232c});var client9002=jayson[_0x851b('0xe')]['http']({'port':0x232a});var interaction_log=require(_0x851b('0xf'))('chat-interactions');function respondWithRpcPromise(_0x1f7cb3,_0x12ff9a,_0x1076eb,_0x32a3fe){return new Promise(function(_0x294e73,_0x12c168){var _0x40ec72=_0x32a3fe||client;return _0x40ec72[_0x851b('0x10')](_0x1f7cb3,_0x1076eb)[_0x851b('0x11')](function(_0xf4b5d){logger[_0x851b('0x12')](_0x851b('0x13'),_0x12ff9a,_0x851b('0x14'));logger[_0x851b('0x15')](_0x851b('0x16'),_0x12ff9a,'request\x20sent',JSON['stringify'](_0xf4b5d));if(_0xf4b5d[_0x851b('0x17')]){if(_0xf4b5d[_0x851b('0x17')][_0x851b('0x18')]===0x1f4){logger['error'](_0x851b('0x13'),_0x12ff9a,_0xf4b5d[_0x851b('0x17')]['message']);return _0x12c168(_0xf4b5d[_0x851b('0x17')][_0x851b('0x19')]);}logger[_0x851b('0x17')]('ChatMessage,\x20%s,\x20%s',_0x12ff9a,_0xf4b5d[_0x851b('0x17')][_0x851b('0x19')]);return _0x294e73(_0xf4b5d[_0x851b('0x17')][_0x851b('0x19')]);}else{logger['info'](_0x851b('0x13'),_0x12ff9a,'request\x20sent');_0x294e73(_0xf4b5d[_0x851b('0x1a')][_0x851b('0x19')]);}})['catch'](function(_0x179687){logger[_0x851b('0x17')]('ChatMessage,\x20%s,\x20%s',_0x12ff9a,_0x179687);_0x12c168(_0x179687);});});}function respondWithResult(_0x4e1361,_0x701f07){_0x701f07=_0x701f07||0xc8;return function(_0x19bd98){if(_0x19bd98){return _0x4e1361[_0x851b('0x1b')](_0x701f07)[_0x851b('0x1c')](_0x19bd98);}};}function respondWithFilteredResult(_0x32f804,_0x33f352){return function(_0x27d4df){if(_0x27d4df){var _0x2ce246=typeof _0x33f352[_0x851b('0x1d')]===_0x851b('0x1e')&&typeof _0x33f352[_0x851b('0x1f')]===_0x851b('0x1e');var _0x326753=_0x27d4df[_0x851b('0x20')];var _0x249a78=_0x2ce246?0x0:_0x33f352[_0x851b('0x1d')];var _0x3528f5=_0x2ce246?_0x27d4df[_0x851b('0x20')]:_0x33f352[_0x851b('0x1d')]+_0x33f352[_0x851b('0x1f')];var _0x4a9ad1;if(_0x3528f5>=_0x326753){_0x3528f5=_0x326753;_0x4a9ad1=0xc8;}else{_0x4a9ad1=0xce;}_0x32f804['status'](_0x4a9ad1);return _0x32f804[_0x851b('0x21')]('Content-Range',_0x249a78+'-'+_0x3528f5+'/'+_0x326753)[_0x851b('0x1c')](_0x27d4df);}return null;};}function saveUpdates(_0x417e01){return function(_0x38b2d9){if(_0x38b2d9){return _0x38b2d9[_0x851b('0x22')](_0x417e01)[_0x851b('0x11')](function(_0x2c3f4d){return _0x2c3f4d;});}return null;};}function removeEntity(_0x27851a){return function(_0xff943b){if(_0xff943b){return _0xff943b[_0x851b('0x23')]()['then'](function(){_0x27851a[_0x851b('0x1b')](0xcc)[_0x851b('0x24')]();});}};}function handleEntityNotFound(_0x53a6ee){return function(_0x24b79d){if(!_0x24b79d){_0x53a6ee[_0x851b('0x25')](0x194);}return _0x24b79d;};}function handleError(_0x3e9ad2,_0x175491){_0x175491=_0x175491||0x1f4;return function(_0x2d902b){logger['error'](_0x2d902b[_0x851b('0x26')]);if(_0x2d902b['name']){delete _0x2d902b['name'];}_0x3e9ad2[_0x851b('0x1b')](_0x175491)[_0x851b('0x27')](_0x2d902b);};}exports[_0x851b('0x28')]=function(_0x416c6c,_0x5563d4){var _0x2f297d={},_0x1c1fe6={},_0x404a11={'count':0x0,'rows':[]};var _0x1c7d4d=_[_0x851b('0x29')](db[_0x851b('0x2a')][_0x851b('0x2b')],function(_0x51d358){return{'name':_0x51d358[_0x851b('0x2c')],'type':_0x51d358[_0x851b('0x2d')][_0x851b('0x2e')]};});_0x1c1fe6[_0x851b('0x2f')]=_[_0x851b('0x29')](_0x1c7d4d,'name');_0x1c1fe6[_0x851b('0x30')]=_[_0x851b('0x31')](_0x416c6c['query']);_0x1c1fe6['filters']=_[_0x851b('0x32')](_0x1c1fe6['model'],_0x1c1fe6[_0x851b('0x30')]);_0x2f297d[_0x851b('0x33')]=_[_0x851b('0x32')](_0x1c1fe6['model'],qs[_0x851b('0x34')](_0x416c6c['query'][_0x851b('0x34')]));_0x2f297d[_0x851b('0x33')]=_0x2f297d[_0x851b('0x33')][_0x851b('0x35')]?_0x2f297d['attributes']:_0x1c1fe6['model'];if(!_0x416c6c['query'][_0x851b('0x36')]('nolimit')){_0x2f297d[_0x851b('0x1f')]=qs[_0x851b('0x1f')](_0x416c6c[_0x851b('0x30')][_0x851b('0x1f')]);_0x2f297d[_0x851b('0x1d')]=qs[_0x851b('0x1d')](_0x416c6c['query']['offset']);}_0x2f297d[_0x851b('0x37')]=qs[_0x851b('0x38')](_0x416c6c[_0x851b('0x30')][_0x851b('0x38')]);_0x2f297d[_0x851b('0x39')]=qs[_0x851b('0x3a')](_[_0x851b('0x3b')](_0x416c6c[_0x851b('0x30')],_0x1c1fe6[_0x851b('0x3a')]),_0x1c7d4d);if(_0x416c6c[_0x851b('0x30')][_0x851b('0x3c')]){_0x2f297d[_0x851b('0x39')]=_[_0x851b('0x3d')](_0x2f297d['where'],{'$or':_[_0x851b('0x29')](_0x1c7d4d,function(_0x345f97){if(_0x345f97['type']!=='VIRTUAL'){var _0x2b3237={};_0x2b3237[_0x345f97[_0x851b('0x3e')]]={'$like':'%'+_0x416c6c[_0x851b('0x30')][_0x851b('0x3c')]+'%'};return _0x2b3237;}})});}_0x2f297d=_[_0x851b('0x3d')]({},_0x2f297d,_0x416c6c[_0x851b('0x3f')]);var _0x577dcc={'where':_0x2f297d[_0x851b('0x39')]};return db[_0x851b('0x2a')][_0x851b('0x20')](_0x577dcc)[_0x851b('0x11')](function(_0x54b668){_0x404a11['count']=_0x54b668;if(_0x416c6c['query'][_0x851b('0x40')]){_0x2f297d['include']=[{'all':!![]}];}return db[_0x851b('0x2a')][_0x851b('0x41')](_0x2f297d);})[_0x851b('0x11')](function(_0x454939){_0x404a11[_0x851b('0x42')]=_0x454939;return _0x404a11;})[_0x851b('0x11')](respondWithFilteredResult(_0x5563d4,_0x2f297d))['catch'](handleError(_0x5563d4,null));};exports[_0x851b('0x43')]=function(_0x40ee53,_0x2a821d){var _0x1c7b45={'raw':!![],'where':{'id':_0x40ee53[_0x851b('0x44')]['id']}},_0x13fa3a={};_0x13fa3a['model']=_[_0x851b('0x31')](db[_0x851b('0x2a')][_0x851b('0x2b')]);_0x13fa3a[_0x851b('0x30')]=_[_0x851b('0x31')](_0x40ee53['query']);_0x13fa3a['filters']=_[_0x851b('0x32')](_0x13fa3a[_0x851b('0x2f')],_0x13fa3a[_0x851b('0x30')]);_0x1c7b45[_0x851b('0x33')]=_['intersection'](_0x13fa3a[_0x851b('0x2f')],qs['fields'](_0x40ee53[_0x851b('0x30')]['fields']));_0x1c7b45[_0x851b('0x33')]=_0x1c7b45[_0x851b('0x33')]['length']?_0x1c7b45[_0x851b('0x33')]:_0x13fa3a[_0x851b('0x2f')];if(_0x40ee53[_0x851b('0x30')][_0x851b('0x40')]){_0x1c7b45[_0x851b('0x45')]=[{'all':!![]}];}_0x1c7b45=_[_0x851b('0x3d')]({},_0x1c7b45,_0x40ee53[_0x851b('0x3f')]);return db[_0x851b('0x2a')]['find'](_0x1c7b45)[_0x851b('0x11')](handleEntityNotFound(_0x2a821d,null))[_0x851b('0x11')](respondWithResult(_0x2a821d,null))[_0x851b('0x46')](handleError(_0x2a821d,null));};exports[_0x851b('0x47')]=function(_0x42a48b,_0x379b1){return db[_0x851b('0x2a')][_0x851b('0x47')](_0x42a48b['body'],{})[_0x851b('0x11')](respondWithResult(_0x379b1,0xc9))[_0x851b('0x46')](handleError(_0x379b1,null));};exports[_0x851b('0x22')]=function(_0x189529,_0x3cc46c){if(_0x189529[_0x851b('0x48')]['id']){delete _0x189529[_0x851b('0x48')]['id'];}return db[_0x851b('0x2a')][_0x851b('0x49')]({'where':{'id':_0x189529[_0x851b('0x44')]['id']}})[_0x851b('0x11')](handleEntityNotFound(_0x3cc46c,null))[_0x851b('0x11')](saveUpdates(_0x189529[_0x851b('0x48')],null))[_0x851b('0x11')](respondWithResult(_0x3cc46c,null))['catch'](handleError(_0x3cc46c,null));};exports[_0x851b('0x23')]=function(_0x107c0a,_0x3cb7e5){return db['ChatMessage']['find']({'where':{'id':_0x107c0a[_0x851b('0x44')]['id']}})['then'](handleEntityNotFound(_0x3cb7e5,null))[_0x851b('0x11')](removeEntity(_0x3cb7e5,null))[_0x851b('0x46')](handleError(_0x3cb7e5,null));};exports[_0x851b('0x4a')]=function(_0xe1413c,_0x5297f7){return db[_0x851b('0x2a')][_0x851b('0x4a')]()['then'](respondWithResult(_0x5297f7,null))['catch'](handleError(_0x5297f7,null));};exports[_0x851b('0x4b')]=function(_0x1d9de4,_0x33b1ae){var _0x4a7c36=_0x851b('0x4c');return interactionService['acceptMessage'](_0x1d9de4,_0x4a7c36)[_0x851b('0x11')](respondWithResult(_0x33b1ae,null))[_0x851b('0x46')](handleError(_0x33b1ae,null));};exports['reject']=function(_0x1fb3a2,_0x9702e1){var _0x1b6386={'agent':{},'channel':_0x851b('0x4c')};if(_0x1fb3a2['body']['id']){delete _0x1fb3a2['body']['id'];}_0x1fb3a2[_0x851b('0x48')][_0x851b('0x4d')]=_0x1fb3a2['body'][_0x851b('0x4d')]||_0x1fb3a2[_0x851b('0x4e')]['id'];_0x1b6386[_0x851b('0x4f')]['id']=_0x1fb3a2[_0x851b('0x48')][_0x851b('0x4d')];return db[_0x851b('0x2a')][_0x851b('0x49')]({'where':{'id':_0x1fb3a2[_0x851b('0x44')]['id'],'UserId':null}})[_0x851b('0x11')](handleEntityNotFound(_0x9702e1,null))['then'](function(_0x4ad686){if(_0x4ad686){_0x1b6386[_0x851b('0x19')]=_0x4ad686[_0x851b('0x50')]({'plain':!![]});return db[_0x851b('0x51')][_0x851b('0x49')]({'where':{'id':_0x4ad686['ChatInteractionId']}});}return null;})[_0x851b('0x11')](handleEntityNotFound(_0x9702e1,null))[_0x851b('0x11')](function(_0x3b62f2){if(_0x3b62f2){_0x1b6386[_0x851b('0x52')]=_0x3b62f2[_0x851b('0x50')]({'plain':!![]});interaction_log[_0x851b('0x12')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1fb3a2[_0x851b('0x4e')]['id'],_0x1fb3a2[_0x851b('0x4e')]['name'],_0x1fb3a2[_0x851b('0x4e')][_0x851b('0x53')],_0x1b6386[_0x851b('0x52')]['id'],_0x1fb3a2[_0x851b('0x48')]?JSON['stringify'](_0x1fb3a2['body']):_0x851b('0x54'));return respondWithRpcPromise('RejectMessage',_0x851b('0x55'),_0x1b6386);}return null;})[_0x851b('0x11')](function(_0x5a9ff0){var _0x3852d2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a9ff0[_0x851b('0x19')][_0x851b('0x56')];return db['sequelize']['query'](_0x3852d2,{'type':db[_0x851b('0x57')][_0x851b('0x58')]['SELECT'],'raw':!![]})['then'](function(_0x51e0da){return _0x51e0da;});})[_0x851b('0x11')](function(_0x2f1e7a){if(_0x2f1e7a){_0x1b6386[_0x851b('0x19')][_0x851b('0x59')]=_0x2f1e7a[0x0];if(!_0x1fb3a2[_0x851b('0x48')]['UserId'])return;return db[_0x851b('0x5a')][_0x851b('0x49')]({'where':{'id':_0x1fb3a2[_0x851b('0x48')][_0x851b('0x4d')],'role':'agent'},'attributes':['id',_0x851b('0x3e'),'fullname',_0x851b('0x5b'),'internal'],'raw':!![]});}return null;})[_0x851b('0x11')](function(_0x27ea2f){if(!_0x27ea2f)return null;_0x1b6386[_0x851b('0x19')][_0x851b('0x4f')]=_0x27ea2f;return _0x1b6386;})[_0x851b('0x11')](function(_0x2f084c){if(_0x2f084c){_0x2f084c['message']['interface']=util['format'](_0x851b('0x5c'),_0x1fb3a2[_0x851b('0x4e')][_0x851b('0x3e')]);_0x2f084c[_0x851b('0x19')]['channel']=_0x1b6386[_0x851b('0x5d')];_0x2f084c[_0x851b('0x19')][_0x851b('0x5e')]=_0x1b6386[_0x851b('0x5d')];_0x2f084c[_0x851b('0x19')][_0x851b('0x5f')]=_0x851b('0x60');respondWithRpcPromise(_0x851b('0x61'),'EventManager',{'event':_0x851b('0x62'),'message':_[_0x851b('0x3d')](_0x1b6386[_0x851b('0x19')],JSON[_0x851b('0x63')](_0x1b6386['interaction'][_0x851b('0x64')]))},client9002);return _0x1b6386;}return null;})[_0x851b('0x11')](respondWithResult(_0x9702e1,null))[_0x851b('0x46')](handleError(_0x9702e1,null));}; \ No newline at end of file +var _0x2423=['stack','send','index','map','rawAttributes','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','includeAll','findAll','show','params','include','find','create','body','destroy','describe','accept','chat','reject','UserId','agent','get','ChatInteraction','ChatInteractionId','interaction','user','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','format','channel','motionChannel','EventManager','rejectmessage','parse','util','../../components/parsers/qs','../../config/logger','api','redis','localhost','socket.io-emitter','register','jayson/promise','client','chat-interactions','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus'];(function(_0x1bac9a,_0x49f25b){var _0x39b6aa=function(_0x180ad4){while(--_0x180ad4){_0x1bac9a['push'](_0x1bac9a['shift']());}};_0x39b6aa(++_0x49f25b);}(_0x2423,0x107));var _0x3242=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2423[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x3242('0x0'));var _=require('lodash');var Redis=require('ioredis');var interactionService=require('../../components/interaction/service');var qs=require(_0x3242('0x1'));var logger=require(_0x3242('0x2'))(_0x3242('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x3242('0x4')],{'host':_0x3242('0x5'),'port':0x18eb});var socket=require(_0x3242('0x6'))(new Redis(config[_0x3242('0x4')]));require('./chatMessage.socket')[_0x3242('0x7')](socket);var jayson=require(_0x3242('0x8'));var client=jayson[_0x3242('0x9')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0x3242('0x2'))(_0x3242('0xa'));function respondWithRpcPromise(_0x260281,_0x3608cb,_0x3e8850,_0x1a0e5a){return new Promise(function(_0x4a9f53,_0x41b315){var _0x12d13f=_0x1a0e5a||client;return _0x12d13f[_0x3242('0xb')](_0x260281,_0x3e8850)[_0x3242('0xc')](function(_0x2c98d8){logger[_0x3242('0xd')](_0x3242('0xe'),_0x3608cb,_0x3242('0xf'));logger[_0x3242('0x10')](_0x3242('0x11'),_0x3608cb,_0x3242('0xf'),JSON[_0x3242('0x12')](_0x2c98d8));if(_0x2c98d8[_0x3242('0x13')]){if(_0x2c98d8[_0x3242('0x13')][_0x3242('0x14')]===0x1f4){logger[_0x3242('0x13')](_0x3242('0xe'),_0x3608cb,_0x2c98d8[_0x3242('0x13')]['message']);return _0x41b315(_0x2c98d8[_0x3242('0x13')][_0x3242('0x15')]);}logger[_0x3242('0x13')](_0x3242('0xe'),_0x3608cb,_0x2c98d8[_0x3242('0x13')][_0x3242('0x15')]);return _0x4a9f53(_0x2c98d8[_0x3242('0x13')][_0x3242('0x15')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x3608cb,_0x3242('0xf'));_0x4a9f53(_0x2c98d8[_0x3242('0x16')][_0x3242('0x15')]);}})[_0x3242('0x17')](function(_0x464128){logger[_0x3242('0x13')](_0x3242('0xe'),_0x3608cb,_0x464128);_0x41b315(_0x464128);});});}function respondWithResult(_0x4d0e70,_0x47aa52){_0x47aa52=_0x47aa52||0xc8;return function(_0x59b8e3){if(_0x59b8e3){return _0x4d0e70['status'](_0x47aa52)[_0x3242('0x18')](_0x59b8e3);}};}function respondWithFilteredResult(_0x208bb7,_0x4945e3){return function(_0x22cc74){if(_0x22cc74){var _0x28335d=typeof _0x4945e3[_0x3242('0x19')]===_0x3242('0x1a')&&typeof _0x4945e3[_0x3242('0x1b')]===_0x3242('0x1a');var _0x333829=_0x22cc74[_0x3242('0x1c')];var _0xba175d=_0x28335d?0x0:_0x4945e3[_0x3242('0x19')];var _0x2809d2=_0x28335d?_0x22cc74[_0x3242('0x1c')]:_0x4945e3[_0x3242('0x19')]+_0x4945e3[_0x3242('0x1b')];var _0xdc9fae;if(_0x2809d2>=_0x333829){_0x2809d2=_0x333829;_0xdc9fae=0xc8;}else{_0xdc9fae=0xce;}_0x208bb7['status'](_0xdc9fae);return _0x208bb7[_0x3242('0x1d')](_0x3242('0x1e'),_0xba175d+'-'+_0x2809d2+'/'+_0x333829)['json'](_0x22cc74);}return null;};}function saveUpdates(_0x1cfb12){return function(_0x491561){if(_0x491561){return _0x491561[_0x3242('0x1f')](_0x1cfb12)[_0x3242('0xc')](function(_0x59b328){return _0x59b328;});}return null;};}function removeEntity(_0x151548){return function(_0x30d8c2){if(_0x30d8c2){return _0x30d8c2['destroy']()['then'](function(){_0x151548['status'](0xcc)[_0x3242('0x20')]();});}};}function handleEntityNotFound(_0x28ff70){return function(_0x3b8d4f){if(!_0x3b8d4f){_0x28ff70[_0x3242('0x21')](0x194);}return _0x3b8d4f;};}function handleError(_0x14771b,_0x4d0b5e){_0x4d0b5e=_0x4d0b5e||0x1f4;return function(_0x38960b){logger[_0x3242('0x13')](_0x38960b[_0x3242('0x22')]);if(_0x38960b['name']){delete _0x38960b['name'];}_0x14771b['status'](_0x4d0b5e)[_0x3242('0x23')](_0x38960b);};}exports[_0x3242('0x24')]=function(_0x5cb356,_0x34c8a0){var _0x18f01f={},_0x272f66={},_0x217fe9={'count':0x0,'rows':[]};var _0x5612f9=_[_0x3242('0x25')](db['ChatMessage'][_0x3242('0x26')],function(_0x3845a2){return{'name':_0x3845a2['fieldName'],'type':_0x3845a2['type'][_0x3242('0x27')]};});_0x272f66[_0x3242('0x28')]=_[_0x3242('0x25')](_0x5612f9,_0x3242('0x29'));_0x272f66['query']=_[_0x3242('0x2a')](_0x5cb356[_0x3242('0x2b')]);_0x272f66[_0x3242('0x2c')]=_[_0x3242('0x2d')](_0x272f66[_0x3242('0x28')],_0x272f66[_0x3242('0x2b')]);_0x18f01f[_0x3242('0x2e')]=_[_0x3242('0x2d')](_0x272f66[_0x3242('0x28')],qs['fields'](_0x5cb356[_0x3242('0x2b')][_0x3242('0x2f')]));_0x18f01f[_0x3242('0x2e')]=_0x18f01f['attributes'][_0x3242('0x30')]?_0x18f01f[_0x3242('0x2e')]:_0x272f66[_0x3242('0x28')];if(!_0x5cb356[_0x3242('0x2b')][_0x3242('0x31')](_0x3242('0x32'))){_0x18f01f['limit']=qs[_0x3242('0x1b')](_0x5cb356['query'][_0x3242('0x1b')]);_0x18f01f[_0x3242('0x19')]=qs[_0x3242('0x19')](_0x5cb356[_0x3242('0x2b')][_0x3242('0x19')]);}_0x18f01f[_0x3242('0x33')]=qs[_0x3242('0x34')](_0x5cb356[_0x3242('0x2b')][_0x3242('0x34')]);_0x18f01f[_0x3242('0x35')]=qs[_0x3242('0x2c')](_[_0x3242('0x36')](_0x5cb356[_0x3242('0x2b')],_0x272f66['filters']),_0x5612f9);if(_0x5cb356['query'][_0x3242('0x37')]){_0x18f01f[_0x3242('0x35')]=_[_0x3242('0x38')](_0x18f01f[_0x3242('0x35')],{'$or':_[_0x3242('0x25')](_0x5612f9,function(_0xb9713d){if(_0xb9713d['type']!==_0x3242('0x39')){var _0x23d368={};_0x23d368[_0xb9713d[_0x3242('0x29')]]={'$like':'%'+_0x5cb356['query'][_0x3242('0x37')]+'%'};return _0x23d368;}})});}_0x18f01f=_['merge']({},_0x18f01f,_0x5cb356[_0x3242('0x3a')]);var _0x1a212a={'where':_0x18f01f[_0x3242('0x35')]};return db[_0x3242('0x3b')][_0x3242('0x1c')](_0x1a212a)['then'](function(_0x5d6720){_0x217fe9[_0x3242('0x1c')]=_0x5d6720;if(_0x5cb356[_0x3242('0x2b')][_0x3242('0x3c')]){_0x18f01f['include']=[{'all':!![]}];}return db[_0x3242('0x3b')][_0x3242('0x3d')](_0x18f01f);})[_0x3242('0xc')](function(_0x16bb1f){_0x217fe9['rows']=_0x16bb1f;return _0x217fe9;})[_0x3242('0xc')](respondWithFilteredResult(_0x34c8a0,_0x18f01f))[_0x3242('0x17')](handleError(_0x34c8a0,null));};exports[_0x3242('0x3e')]=function(_0x546ef1,_0x1aa92c){var _0x1738f2={'raw':!![],'where':{'id':_0x546ef1[_0x3242('0x3f')]['id']}},_0x568862={};_0x568862[_0x3242('0x28')]=_['keys'](db[_0x3242('0x3b')]['rawAttributes']);_0x568862['query']=_[_0x3242('0x2a')](_0x546ef1[_0x3242('0x2b')]);_0x568862[_0x3242('0x2c')]=_['intersection'](_0x568862[_0x3242('0x28')],_0x568862[_0x3242('0x2b')]);_0x1738f2[_0x3242('0x2e')]=_[_0x3242('0x2d')](_0x568862[_0x3242('0x28')],qs[_0x3242('0x2f')](_0x546ef1[_0x3242('0x2b')][_0x3242('0x2f')]));_0x1738f2[_0x3242('0x2e')]=_0x1738f2[_0x3242('0x2e')][_0x3242('0x30')]?_0x1738f2['attributes']:_0x568862[_0x3242('0x28')];if(_0x546ef1[_0x3242('0x2b')][_0x3242('0x3c')]){_0x1738f2[_0x3242('0x40')]=[{'all':!![]}];}_0x1738f2=_[_0x3242('0x38')]({},_0x1738f2,_0x546ef1[_0x3242('0x3a')]);return db[_0x3242('0x3b')][_0x3242('0x41')](_0x1738f2)['then'](handleEntityNotFound(_0x1aa92c,null))['then'](respondWithResult(_0x1aa92c,null))[_0x3242('0x17')](handleError(_0x1aa92c,null));};exports['create']=function(_0xb41a6a,_0x5b4acb){return db[_0x3242('0x3b')][_0x3242('0x42')](_0xb41a6a['body'],{})['then'](respondWithResult(_0x5b4acb,0xc9))['catch'](handleError(_0x5b4acb,null));};exports[_0x3242('0x1f')]=function(_0x2128f2,_0x4fc2ff){if(_0x2128f2[_0x3242('0x43')]['id']){delete _0x2128f2[_0x3242('0x43')]['id'];}return db[_0x3242('0x3b')][_0x3242('0x41')]({'where':{'id':_0x2128f2[_0x3242('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4fc2ff,null))[_0x3242('0xc')](saveUpdates(_0x2128f2[_0x3242('0x43')],null))[_0x3242('0xc')](respondWithResult(_0x4fc2ff,null))[_0x3242('0x17')](handleError(_0x4fc2ff,null));};exports[_0x3242('0x44')]=function(_0x3d1bb9,_0x52aa57){return db[_0x3242('0x3b')][_0x3242('0x41')]({'where':{'id':_0x3d1bb9[_0x3242('0x3f')]['id']}})[_0x3242('0xc')](handleEntityNotFound(_0x52aa57,null))[_0x3242('0xc')](removeEntity(_0x52aa57,null))[_0x3242('0x17')](handleError(_0x52aa57,null));};exports[_0x3242('0x45')]=function(_0x1a7657,_0x1dd352){return db[_0x3242('0x3b')]['describe']()[_0x3242('0xc')](respondWithResult(_0x1dd352,null))[_0x3242('0x17')](handleError(_0x1dd352,null));};exports[_0x3242('0x46')]=function(_0x8cbcab,_0x47cc88){var _0x40f0e6=_0x3242('0x47');return interactionService['acceptMessage'](_0x8cbcab,_0x40f0e6)[_0x3242('0xc')](respondWithResult(_0x47cc88,null))['catch'](handleError(_0x47cc88,null));};exports[_0x3242('0x48')]=function(_0x15b9bc,_0x219a25){var _0x33c332={'agent':{},'channel':_0x3242('0x47')};if(_0x15b9bc[_0x3242('0x43')]['id']){delete _0x15b9bc[_0x3242('0x43')]['id'];}_0x15b9bc[_0x3242('0x43')][_0x3242('0x49')]=_0x15b9bc[_0x3242('0x43')][_0x3242('0x49')]||_0x15b9bc['user']['id'];_0x33c332[_0x3242('0x4a')]['id']=_0x15b9bc[_0x3242('0x43')][_0x3242('0x49')];return db[_0x3242('0x3b')][_0x3242('0x41')]({'where':{'id':_0x15b9bc['params']['id'],'UserId':null}})[_0x3242('0xc')](handleEntityNotFound(_0x219a25,null))[_0x3242('0xc')](function(_0x7544db){if(_0x7544db){_0x33c332['message']=_0x7544db[_0x3242('0x4b')]({'plain':!![]});return db[_0x3242('0x4c')][_0x3242('0x41')]({'where':{'id':_0x7544db[_0x3242('0x4d')]}});}return null;})[_0x3242('0xc')](handleEntityNotFound(_0x219a25,null))[_0x3242('0xc')](function(_0x417ef4){if(_0x417ef4){_0x33c332[_0x3242('0x4e')]=_0x417ef4[_0x3242('0x4b')]({'plain':!![]});interaction_log[_0x3242('0xd')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x15b9bc['user']['id'],_0x15b9bc[_0x3242('0x4f')][_0x3242('0x29')],_0x15b9bc[_0x3242('0x4f')][_0x3242('0x50')],_0x33c332[_0x3242('0x4e')]['id'],_0x15b9bc[_0x3242('0x43')]?JSON[_0x3242('0x12')](_0x15b9bc['body']):_0x3242('0x51'));return respondWithRpcPromise(_0x3242('0x52'),_0x3242('0x53'),_0x33c332);}return null;})[_0x3242('0xc')](function(_0x4d7109){var _0x271190=_0x3242('0x54')+_0x4d7109[_0x3242('0x15')][_0x3242('0x55')];return db[_0x3242('0x56')][_0x3242('0x2b')](_0x271190,{'type':db[_0x3242('0x57')]['QueryTypes'][_0x3242('0x58')],'raw':!![]})[_0x3242('0xc')](function(_0x2aff15){return _0x2aff15;});})[_0x3242('0xc')](function(_0x667837){if(_0x667837){_0x33c332[_0x3242('0x15')][_0x3242('0x59')]=_0x667837[0x0];if(!_0x15b9bc[_0x3242('0x43')]['UserId'])return;return db[_0x3242('0x5a')]['find']({'where':{'id':_0x15b9bc[_0x3242('0x43')][_0x3242('0x49')],'role':_0x3242('0x4a')},'attributes':['id',_0x3242('0x29'),_0x3242('0x5b'),'email',_0x3242('0x5c')],'raw':!![]});}return null;})['then'](function(_0x138398){if(!_0x138398)return null;_0x33c332[_0x3242('0x15')][_0x3242('0x4a')]=_0x138398;return _0x33c332;})[_0x3242('0xc')](function(_0x1b7921){if(_0x1b7921){_0x1b7921['message']['interface']=util[_0x3242('0x5d')]('SIP/%s',_0x15b9bc[_0x3242('0x4f')][_0x3242('0x29')]);_0x1b7921[_0x3242('0x15')]['channel']=_0x33c332[_0x3242('0x5e')];_0x1b7921[_0x3242('0x15')][_0x3242('0x5f')]=_0x33c332[_0x3242('0x5e')];_0x1b7921[_0x3242('0x15')]['event']='reject';respondWithRpcPromise(_0x3242('0x60'),'EventManager',{'event':_0x3242('0x61'),'message':_[_0x3242('0x38')](_0x33c332[_0x3242('0x15')],JSON[_0x3242('0x62')](_0x33c332['interaction']['formData']))},client9002);return _0x33c332;}return null;})[_0x3242('0xc')](respondWithResult(_0x219a25,null))[_0x3242('0x17')](handleError(_0x219a25,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7fbf39d..2aec584 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 _0x13b9=['remove','hasOwnProperty','exports','ChatMessage'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x13b9,0x117));var _0x913b=function(_0x66b39c,_0xad7354){_0x66b39c=_0x66b39c-0x0;var _0x451fe4=_0x13b9[_0x66b39c];return _0x451fe4;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x913b('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x913b('0x1')};function emitEvent(_0x160366){return function(_0x3a1ae1,_0x422c3e,_0xe52964){ChatMessageEvents['emit'](_0x160366+':'+_0x3a1ae1['id'],_0x3a1ae1);ChatMessageEvents['emit'](_0x160366,_0x3a1ae1);_0xe52964(null);};}for(var e in events){if(events[_0x913b('0x2')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x913b('0x3')]=ChatMessageEvents; \ No newline at end of file +var _0x3ff4=['emit','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove'];(function(_0x5043c7,_0x40e9d5){var _0x3f2079=function(_0x360719){while(--_0x360719){_0x5043c7['push'](_0x5043c7['shift']());}};_0x3f2079(++_0x40e9d5);}(_0x3ff4,0xd3));var _0x43ff=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x3ff4[_0x1d24eb];return _0x1dc576;};'use strict';var EventEmitter=require(_0x43ff('0x0'));var ChatMessage=require(_0x43ff('0x1'))['db'][_0x43ff('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x43ff('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x43ff('0x4'),'afterDestroy':_0x43ff('0x5')};function emitEvent(_0x32e4bc){return function(_0x375d61,_0x37811b,_0xd68234){ChatMessageEvents[_0x43ff('0x6')](_0x32e4bc+':'+_0x375d61['id'],_0x375d61);ChatMessageEvents[_0x43ff('0x6')](_0x32e4bc,_0x375d61);_0xd68234(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](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 166e9ef..c04a5db 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 _0xe797=['moment','bluebird','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x15664f,_0x3c74c5){var _0x1747f1=function(_0x3ca956){while(--_0x3ca956){_0x15664f['push'](_0x15664f['shift']());}};_0x1747f1(++_0x3c74c5);}(_0xe797,0x1da));var _0x7e79=function(_0x409c62,_0x52c0f5){_0x409c62=_0x409c62-0x0;var _0x15c3b6=_0xe797[_0x409c62];return _0x15c3b6;};'use strict';var _=require('lodash');var util=require(_0x7e79('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7e79('0x1'));var BPromise=require(_0x7e79('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e79('0x3'));var config=require(_0x7e79('0x4'));var attributes=require(_0x7e79('0x5'));module['exports']=function(_0x3ee086,_0x531453){return _0x3ee086[_0x7e79('0x6')](_0x7e79('0x7'),attributes,{'tableName':_0x7e79('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x7e79('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cdaba,_0xc4d48,_0x4b202f){var _0x388dca=_0x3ee086[_0x7e79('0xa')];var _0x52a7d3=_0x1cdaba[_0x7e79('0xb')]({'plain':!![]});if(_0x52a7d3[_0x7e79('0xc')][_0x7e79('0xd')]()==='in'||_0x52a7d3[_0x7e79('0xc')][_0x7e79('0xd')]()==='out'&&!_0x52a7d3[_0x7e79('0xe')]&&!_[_0x7e79('0xf')](_0x52a7d3[_0x7e79('0x10')])){_0x388dca[_0x7e79('0x11')][_0x7e79('0x12')]({'where':{'id':_0x52a7d3[_0x7e79('0x13')]}})[_0x7e79('0x14')](function(_0x118236){if(_0x118236){_0x118236['update']({'lastMsgAt':_0x52a7d3[_0x7e79('0x15')],'lastMsgDirection':_0x52a7d3[_0x7e79('0xc')]['toLowerCase']()});}})[_0x7e79('0x16')](function(_0x3fc7e4){console['error'](_0x3fc7e4);});}_0x4b202f();}},'charset':_0x7e79('0x17'),'collate':_0x7e79('0x18')});}; \ No newline at end of file +var _0xfb64=['then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','get','direction','toLowerCase','out','UserId','findOne'];(function(_0x152929,_0x1456d0){var _0x4c0dc7=function(_0x12628a){while(--_0x12628a){_0x152929['push'](_0x152929['shift']());}};_0x4c0dc7(++_0x1456d0);}(_0xfb64,0x157));var _0x4fb6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xfb64[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4fb6('0x0'));var util=require(_0x4fb6('0x1'));var logger=require(_0x4fb6('0x2'))(_0x4fb6('0x3'));var moment=require(_0x4fb6('0x4'));var BPromise=require('bluebird');var rp=require(_0x4fb6('0x5'));var fs=require('fs');var path=require(_0x4fb6('0x6'));var rimraf=require(_0x4fb6('0x7'));var config=require(_0x4fb6('0x8'));var attributes=require(_0x4fb6('0x9'));module[_0x4fb6('0xa')]=function(_0x3aa438,_0x214021){return _0x3aa438[_0x4fb6('0xb')](_0x4fb6('0xc'),attributes,{'tableName':_0x4fb6('0xd'),'paranoid':![],'indexes':[{'name':_0x4fb6('0xe'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfad1b1,_0x3e03d6,_0x557912){var _0x45e655=_0x3aa438['models'];var _0x1208c2=_0xfad1b1[_0x4fb6('0xf')]({'plain':!![]});if(_0x1208c2[_0x4fb6('0x10')][_0x4fb6('0x11')]()==='in'||_0x1208c2[_0x4fb6('0x10')][_0x4fb6('0x11')]()===_0x4fb6('0x12')&&!_0x1208c2['secret']&&!_['isNil'](_0x1208c2[_0x4fb6('0x13')])){_0x45e655['ChatInteraction'][_0x4fb6('0x14')]({'where':{'id':_0x1208c2['ChatInteractionId']}})[_0x4fb6('0x15')](function(_0x333e9c){if(_0x333e9c){_0x333e9c[_0x4fb6('0x16')]({'lastMsgAt':_0x1208c2[_0x4fb6('0x17')],'lastMsgDirection':_0x1208c2[_0x4fb6('0x10')][_0x4fb6('0x11')]()});}})[_0x4fb6('0x18')](function(_0x4d8104){console[_0x4fb6('0x19')](_0x4d8104);});}_0x557912();}},'charset':_0x4fb6('0x1a'),'collate':_0x4fb6('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 1742f73..3bffc2d 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 _0x7c24=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','register','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','options','raw','then','debug','CreateChatMessage','lodash','util','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7c24,0xf9));var _0x47c2=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x7c24[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var moment=require(_0x47c2('0x2'));var BPromise=require(_0x47c2('0x3'));var rs=require(_0x47c2('0x4'));var fs=require('fs');var Redis=require(_0x47c2('0x5'));var db=require(_0x47c2('0x6'))['db'];var utils=require(_0x47c2('0x7'));var logger=require(_0x47c2('0x8'))(_0x47c2('0x9'));var config=require(_0x47c2('0xa'));var jayson=require(_0x47c2('0xb'));var client=jayson[_0x47c2('0xc')][_0x47c2('0xd')]({'port':0x232a});config['redis']=_[_0x47c2('0xe')](config['redis'],{'host':_0x47c2('0xf'),'port':0x18eb});var socket=require(_0x47c2('0x10'))(new Redis(config[_0x47c2('0x11')]));require(_0x47c2('0x12'))[_0x47c2('0x13')](socket);function respondWithRpcPromise(_0x40c88a,_0x398bc8,_0xd84fcc){return new BPromise(function(_0x1dd2d9,_0x5554f2){return client['request'](_0x40c88a,_0xd84fcc)['then'](function(_0x27749e){logger['info'](_0x47c2('0x14'),_0x398bc8,_0x47c2('0x15'));logger['debug'](_0x47c2('0x16'),_0x398bc8,_0x47c2('0x15'),JSON[_0x47c2('0x17')](_0x27749e));if(_0x27749e[_0x47c2('0x18')]){if(_0x27749e[_0x47c2('0x18')][_0x47c2('0x19')]===0x1f4){logger[_0x47c2('0x18')]('ChatMessage,\x20%s,\x20%s',_0x398bc8,_0x27749e[_0x47c2('0x18')][_0x47c2('0x1a')]);return _0x5554f2(_0x27749e['error'][_0x47c2('0x1a')]);}logger[_0x47c2('0x18')](_0x47c2('0x14'),_0x398bc8,_0x27749e[_0x47c2('0x18')][_0x47c2('0x1a')]);return _0x1dd2d9(_0x27749e[_0x47c2('0x18')][_0x47c2('0x1a')]);}else{logger[_0x47c2('0x1b')](_0x47c2('0x14'),_0x398bc8,_0x47c2('0x15'));_0x1dd2d9(_0x27749e[_0x47c2('0x1c')][_0x47c2('0x1a')]);}})[_0x47c2('0x1d')](function(_0x4799b5){logger[_0x47c2('0x18')](_0x47c2('0x14'),_0x398bc8,_0x4799b5);_0x5554f2(_0x4799b5);});});}exports['CreateChatMessage']=function(_0x4fb528){var _0x2c2bf2=this;return new Promise(function(_0x2a8fed,_0x2eaf3e){return db['ChatMessage'][_0x47c2('0x1e')](_0x4fb528['body'],{'raw':_0x4fb528['options']?_0x4fb528[_0x47c2('0x1f')][_0x47c2('0x20')]===undefined?!![]:![]:!![]})[_0x47c2('0x21')](function(_0x242890){logger[_0x47c2('0x1b')]('CreateChatMessage',_0x4fb528);logger[_0x47c2('0x22')](_0x47c2('0x23'),_0x4fb528,JSON[_0x47c2('0x17')](_0x242890));_0x2a8fed(_0x242890);})['catch'](function(_0x5870ff){logger[_0x47c2('0x18')](_0x47c2('0x23'),_0x5870ff[_0x47c2('0x1a')],_0x4fb528);_0x2eaf3e(_0x2c2bf2[_0x47c2('0x18')](0x1f4,_0x5870ff[_0x47c2('0x1a')]));});});}; \ No newline at end of file +var _0x6016=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','create','body','options','raw','CreateChatMessage','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x6016,0x1ba));var _0x6601=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0x6016[_0x500785];return _0x1f8bcc;};'use strict';var _=require(_0x6601('0x0'));var util=require('util');var moment=require(_0x6601('0x1'));var BPromise=require('bluebird');var rs=require(_0x6601('0x2'));var fs=require('fs');var Redis=require(_0x6601('0x3'));var db=require(_0x6601('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6601('0x5'))('rpc');var config=require(_0x6601('0x6'));var jayson=require(_0x6601('0x7'));var client=jayson[_0x6601('0x8')][_0x6601('0x9')]({'port':0x232a});config[_0x6601('0xa')]=_['defaults'](config[_0x6601('0xa')],{'host':_0x6601('0xb'),'port':0x18eb});var socket=require(_0x6601('0xc'))(new Redis(config[_0x6601('0xa')]));require(_0x6601('0xd'))[_0x6601('0xe')](socket);function respondWithRpcPromise(_0x4bc49c,_0xfc9110,_0xe444ed){return new BPromise(function(_0x4c8182,_0x10777b){return client[_0x6601('0xf')](_0x4bc49c,_0xe444ed)[_0x6601('0x10')](function(_0x224aa5){logger[_0x6601('0x11')](_0x6601('0x12'),_0xfc9110,'request\x20sent');logger['debug'](_0x6601('0x13'),_0xfc9110,_0x6601('0x14'),JSON['stringify'](_0x224aa5));if(_0x224aa5['error']){if(_0x224aa5['error'][_0x6601('0x15')]===0x1f4){logger[_0x6601('0x16')]('ChatMessage,\x20%s,\x20%s',_0xfc9110,_0x224aa5['error'][_0x6601('0x17')]);return _0x10777b(_0x224aa5[_0x6601('0x16')][_0x6601('0x17')]);}logger[_0x6601('0x16')](_0x6601('0x12'),_0xfc9110,_0x224aa5[_0x6601('0x16')][_0x6601('0x17')]);return _0x4c8182(_0x224aa5[_0x6601('0x16')][_0x6601('0x17')]);}else{logger['info'](_0x6601('0x12'),_0xfc9110,_0x6601('0x14'));_0x4c8182(_0x224aa5[_0x6601('0x18')][_0x6601('0x17')]);}})[_0x6601('0x19')](function(_0x1e3230){logger[_0x6601('0x16')](_0x6601('0x12'),_0xfc9110,_0x1e3230);_0x10777b(_0x1e3230);});});}exports['CreateChatMessage']=function(_0x1733b1){var _0x28ac48=this;return new Promise(function(_0x9413ba,_0x3bbcff){return db['ChatMessage'][_0x6601('0x1a')](_0x1733b1[_0x6601('0x1b')],{'raw':_0x1733b1[_0x6601('0x1c')]?_0x1733b1[_0x6601('0x1c')][_0x6601('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1ea437){logger[_0x6601('0x11')](_0x6601('0x1e'),_0x1733b1);logger['debug']('CreateChatMessage',_0x1733b1,JSON[_0x6601('0x1f')](_0x1ea437));_0x9413ba(_0x1ea437);})[_0x6601('0x19')](function(_0x22e218){logger[_0x6601('0x16')](_0x6601('0x1e'),_0x22e218[_0x6601('0x17')],_0x1733b1);_0x3bbcff(_0x28ac48[_0x6601('0x16')](0x1f4,_0x22e218[_0x6601('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index cba1248..68114ca 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 _0x3eea=['removeListener','register','length','./chatMessage.events','remove','update','emit'];(function(_0x266945,_0x5c5e8c){var _0x4477d5=function(_0x18c0b2){while(--_0x18c0b2){_0x266945['push'](_0x266945['shift']());}};_0x4477d5(++_0x5c5e8c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5a15a2,_0x5873d3){_0x5a15a2=_0x5a15a2-0x0;var _0x2ab56c=_0x3eea[_0x5a15a2];return _0x2ab56c;};'use strict';var ChatMessageEvents=require(_0xa3ee('0x0'));var events=['save',_0xa3ee('0x1'),_0xa3ee('0x2')];function createListener(_0x16512c,_0x1c6a49){return function(_0x46acfa){_0x1c6a49[_0xa3ee('0x3')](_0x16512c,_0x46acfa);};}function removeListener(_0x104913,_0x35ed7d){return function(){ChatMessageEvents[_0xa3ee('0x4')](_0x104913,_0x35ed7d);};}exports[_0xa3ee('0x5')]=function(_0xb93cdb){for(var _0x5776bb=0x0,_0x538bf9=events[_0xa3ee('0x6')];_0x5776bb<_0x538bf9;_0x5776bb++){var _0x4e4588=events[_0x5776bb];var _0x37a3f0=createListener('chatMessage:'+_0x4e4588,_0xb93cdb);ChatMessageEvents['on'](_0x4e4588,_0x37a3f0);}}; \ No newline at end of file +var _0xab86=['remove','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x4b1fb4,_0x36f2e0){var _0x1617cc=function(_0x49a5ad){while(--_0x49a5ad){_0x4b1fb4['push'](_0x4b1fb4['shift']());}};_0x1617cc(++_0x36f2e0);}(_0xab86,0x13e));var _0x6ab8=function(_0x141a33,_0x44996b){_0x141a33=_0x141a33-0x0;var _0x51b489=_0xab86[_0x141a33];return _0x51b489;};'use strict';var ChatMessageEvents=require(_0x6ab8('0x0'));var events=[_0x6ab8('0x1'),_0x6ab8('0x2'),'update'];function createListener(_0x548007,_0xfa522f){return function(_0x4bcc45){_0xfa522f[_0x6ab8('0x3')](_0x548007,_0x4bcc45);};}function removeListener(_0x48cb6a,_0xf27ba7){return function(){ChatMessageEvents[_0x6ab8('0x4')](_0x48cb6a,_0xf27ba7);};}exports[_0x6ab8('0x5')]=function(_0x154d17){for(var _0x6f41f=0x0,_0x265771=events[_0x6ab8('0x6')];_0x6f41f<_0x265771;_0x6f41f++){var _0x2a452=events[_0x6f41f];var _0x363c5e=createListener(_0x6ab8('0x7')+_0x2a452,_0x154d17);ChatMessageEvents['on'](_0x2a452,_0x363c5e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f3d37ab..b797a2d 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 _0x4a86=['delete','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','update','/:id/accept','/:id/reject','reject'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4a86,0x1a5));var _0x64a8=function(_0x1da2b3,_0xc2e7cf){_0x1da2b3=_0x1da2b3-0x0;var _0x2c1ac6=_0x4a86[_0x1da2b3];return _0x2c1ac6;};'use strict';var multer=require('multer');var util=require(_0x64a8('0x0'));var path=require(_0x64a8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x64a8('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x64a8('0x3'));var interaction=require(_0x64a8('0x4'));var config=require('../../config/environment');var controller=require(_0x64a8('0x5'));router[_0x64a8('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x64a8('0x7'),auth[_0x64a8('0x8')](),controller[_0x64a8('0x9')]);router[_0x64a8('0x6')](_0x64a8('0xa'),auth[_0x64a8('0x8')](),controller[_0x64a8('0xb')]);router[_0x64a8('0xc')]('/',auth[_0x64a8('0x8')](),interaction[_0x64a8('0xd')](_0x64a8('0xe'),_0x64a8('0xf')),controller['create']);router['put'](_0x64a8('0xa'),controller[_0x64a8('0x10')]);router['put'](_0x64a8('0x11'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x64a8('0x12'),auth[_0x64a8('0x8')](),controller[_0x64a8('0x13')]);router[_0x64a8('0x14')](_0x64a8('0xa'),auth[_0x64a8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x04da=['post','chat','chatmessage:create','create','put','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x52a019,_0x234e71){var _0x527e82=function(_0x3ed76f){while(--_0x3ed76f){_0x52a019['push'](_0x52a019['shift']());}};_0x527e82(++_0x234e71);}(_0x04da,0xb9));var _0xa04d=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x04da[_0x585133];return _0x18254a;};'use strict';var multer=require(_0xa04d('0x0'));var util=require(_0xa04d('0x1'));var path=require(_0xa04d('0x2'));var timeout=require(_0xa04d('0x3'));var express=require('express');var router=express[_0xa04d('0x4')]();var fs_extra=require(_0xa04d('0x5'));var auth=require(_0xa04d('0x6'));var interaction=require(_0xa04d('0x7'));var config=require(_0xa04d('0x8'));var controller=require('./chatMessage.controller');router[_0xa04d('0x9')]('/',auth[_0xa04d('0xa')](),controller['index']);router[_0xa04d('0x9')](_0xa04d('0xb'),auth[_0xa04d('0xa')](),controller[_0xa04d('0xc')]);router[_0xa04d('0x9')](_0xa04d('0xd'),auth[_0xa04d('0xa')](),controller[_0xa04d('0xe')]);router[_0xa04d('0xf')]('/',auth[_0xa04d('0xa')](),interaction['tracked'](_0xa04d('0x10'),_0xa04d('0x11')),controller[_0xa04d('0x12')]);router[_0xa04d('0x13')](_0xa04d('0xd'),controller['update']);router[_0xa04d('0x13')]('/:id/accept',auth[_0xa04d('0xa')](),controller[_0xa04d('0x14')]);router[_0xa04d('0x13')](_0xa04d('0x15'),auth[_0xa04d('0xa')](),controller[_0xa04d('0x16')]);router['delete'](_0xa04d('0xd'),auth['isAuthenticated'](),controller[_0xa04d('0x17')]);module[_0xa04d('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 334c383..0cbbbad 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['medium','sequelize','TEXT'];(function(_0x464e93,_0x39e4b9){var _0x591865=function(_0x3c60e1){while(--_0x3c60e1){_0x464e93['push'](_0x464e93['shift']());}};_0x591865(++_0x39e4b9);}(_0xb10b,0x12a));var _0xbb10=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0xb10b[_0x3fe042];return _0x7d4a1f;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x5ec17c,_0x4100a3){var _0x50bd2e=function(_0x4f228c){while(--_0x4f228c){_0x5ec17c['push'](_0x5ec17c['shift']());}};_0x50bd2e(++_0x4100a3);}(_0x2032,0xd9));var _0x2203=function(_0x12eec3,_0x3d693a){_0x12eec3=_0x12eec3-0x0;var _0x46da51=_0x2032[_0x12eec3];return _0x46da51;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index e499903..1471131 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x30a1d6,_0x57eedc){var _0x5afa8e=function(_0x445377){while(--_0x445377){_0x30a1d6['push'](_0x30a1d6['shift']());}};_0x5afa8e(++_0x57eedc);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x23609e,_0x2d91f2){var _0x151315=function(_0x12c3f7){while(--_0x12c3f7){_0x23609e['push'](_0x23609e['shift']());}};_0x151315(++_0x2d91f2);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 0269ef9..b74c0d1 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 _0x4607=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0x24dac7,_0x2ffbaa){var _0x32c81f=function(_0x5e6475){while(--_0x5e6475){_0x24dac7['push'](_0x24dac7['shift']());}};_0x32c81f(++_0x2ffbaa);}(_0x4607,0x121));var _0x7460=function(_0x1a7987,_0x2b7aa2){_0x1a7987=_0x1a7987-0x0;var _0x4c89c4=_0x4607[_0x1a7987];return _0x4c89c4;};'use strict';var EventEmitter=require(_0x7460('0x0'));var ChatOfflineMessage=require(_0x7460('0x1'))['db'][_0x7460('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7460('0x3')](0x0);var events={'afterCreate':_0x7460('0x4'),'afterUpdate':_0x7460('0x5'),'afterDestroy':_0x7460('0x6')};function emitEvent(_0x2de7f8){return function(_0x353411,_0x53ebd1,_0x117045){ChatOfflineMessageEvents[_0x7460('0x7')](_0x2de7f8+':'+_0x353411['id'],_0x353411);ChatOfflineMessageEvents[_0x7460('0x7')](_0x2de7f8,_0x353411);_0x117045(null);};}for(var e in events){if(events[_0x7460('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x7460('0x9')](e,emitEvent(event));}}module[_0x7460('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xf2d7=['update','remove','emit','hook','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xf2d7,0xd3));var _0x7f2d=function(_0x351274,_0xa3dc98){_0x351274=_0x351274-0x0;var _0x2c388a=_0xf2d7[_0x351274];return _0x2c388a;};'use strict';var EventEmitter=require(_0x7f2d('0x0'));var ChatOfflineMessage=require(_0x7f2d('0x1'))['db'][_0x7f2d('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7f2d('0x3')](0x0);var events={'afterCreate':_0x7f2d('0x4'),'afterUpdate':_0x7f2d('0x5'),'afterDestroy':_0x7f2d('0x6')};function emitEvent(_0x30966c){return function(_0x353a51,_0x31c645,_0xfffefc){ChatOfflineMessageEvents[_0x7f2d('0x7')](_0x30966c+':'+_0x353a51['id'],_0x353a51);ChatOfflineMessageEvents[_0x7f2d('0x7')](_0x30966c,_0x353a51);_0xfffefc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x7f2d('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2fb7fa1..b29cf1d 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 _0xc216=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x148bad,_0x1ac85a){var _0x52aec4=function(_0x4a9faf){while(--_0x4a9faf){_0x148bad['push'](_0x148bad['shift']());}};_0x52aec4(++_0x1ac85a);}(_0xc216,0x9b));var _0x6c21=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xc216[_0x26f1b2];return _0x1624a4;};'use strict';var attributes=require(_0x6c21('0x0'));module['exports']=function(_0x4000ff){return _0x4000ff[_0x6c21('0x1')](_0x6c21('0x2'),attributes,{'tableName':_0x6c21('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c21('0x4'),'collate':_0x6c21('0x5')});}; \ No newline at end of file +var _0x5fc8=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define'];(function(_0xaab8cd,_0x469c73){var _0x21a175=function(_0x55fe2b){while(--_0x55fe2b){_0xaab8cd['push'](_0xaab8cd['shift']());}};_0x21a175(++_0x469c73);}(_0x5fc8,0xdf));var _0x85fc=function(_0xa7c258,_0x8729ef){_0xa7c258=_0xa7c258-0x0;var _0x30474b=_0x5fc8[_0xa7c258];return _0x30474b;};'use strict';var attributes=require(_0x85fc('0x0'));module['exports']=function(_0x5e020e){return _0x5e020e[_0x85fc('0x1')](_0x85fc('0x2'),attributes,{'tableName':_0x85fc('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x85fc('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0c713d0..8519ef4 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 _0x8966=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8966,0x184));var _0x6896=function(_0x3edccf,_0xe16b3){_0x3edccf=_0x3edccf-0x0;var _0x2295b5=_0x8966[_0x3edccf];return _0x2295b5;};'use strict';var _=require('lodash');var util=require(_0x6896('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6896('0x1'));var fs=require('fs');var Redis=require(_0x6896('0x2'));var db=require(_0x6896('0x3'))['db'];var utils=require(_0x6896('0x4'));var logger=require('../../config/logger')(_0x6896('0x5'));var config=require('../../config/environment');var jayson=require(_0x6896('0x6'));var client=jayson['client'][_0x6896('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5655f0,_0x53dddc,_0x232300){return new BPromise(function(_0x595a00,_0xa35530){return client['request'](_0x5655f0,_0x232300)['then'](function(_0x54ac4a){logger[_0x6896('0x8')](_0x6896('0x9'),_0x53dddc,_0x6896('0xa'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x53dddc,_0x6896('0xa'),JSON['stringify'](_0x54ac4a));if(_0x54ac4a[_0x6896('0xb')]){if(_0x54ac4a[_0x6896('0xb')][_0x6896('0xc')]===0x1f4){logger[_0x6896('0xb')](_0x6896('0x9'),_0x53dddc,_0x54ac4a[_0x6896('0xb')][_0x6896('0xd')]);return _0xa35530(_0x54ac4a[_0x6896('0xb')][_0x6896('0xd')]);}logger[_0x6896('0xb')](_0x6896('0x9'),_0x53dddc,_0x54ac4a[_0x6896('0xb')][_0x6896('0xd')]);return _0x595a00(_0x54ac4a[_0x6896('0xb')]['message']);}else{logger[_0x6896('0x8')]('ChatOfflineMessage,\x20%s,\x20%s',_0x53dddc,_0x6896('0xa'));_0x595a00(_0x54ac4a[_0x6896('0xe')][_0x6896('0xd')]);}})['catch'](function(_0xe6da5e){logger[_0x6896('0xb')](_0x6896('0x9'),_0x53dddc,_0xe6da5e);_0xa35530(_0xe6da5e);});});} \ No newline at end of file +var _0x4634=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x4634,0xe3));var _0x4463=function(_0xdb6d73,_0x406132){_0xdb6d73=_0xdb6d73-0x0;var _0x3dd50d=_0x4634[_0xdb6d73];return _0x3dd50d;};'use strict';var _=require('lodash');var util=require(_0x4463('0x0'));var moment=require(_0x4463('0x1'));var BPromise=require(_0x4463('0x2'));var rs=require(_0x4463('0x3'));var fs=require('fs');var Redis=require(_0x4463('0x4'));var db=require(_0x4463('0x5'))['db'];var utils=require(_0x4463('0x6'));var logger=require('../../config/logger')(_0x4463('0x7'));var config=require(_0x4463('0x8'));var jayson=require(_0x4463('0x9'));var client=jayson['client'][_0x4463('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18f97a,_0xc6b5b4,_0x22a9ae){return new BPromise(function(_0x235705,_0x558177){return client['request'](_0x18f97a,_0x22a9ae)[_0x4463('0xb')](function(_0x4e1137){logger[_0x4463('0xc')](_0x4463('0xd'),_0xc6b5b4,_0x4463('0xe'));logger[_0x4463('0xf')](_0x4463('0x10'),_0xc6b5b4,_0x4463('0xe'),JSON[_0x4463('0x11')](_0x4e1137));if(_0x4e1137[_0x4463('0x12')]){if(_0x4e1137[_0x4463('0x12')][_0x4463('0x13')]===0x1f4){logger[_0x4463('0x12')](_0x4463('0xd'),_0xc6b5b4,_0x4e1137[_0x4463('0x12')][_0x4463('0x14')]);return _0x558177(_0x4e1137[_0x4463('0x12')][_0x4463('0x14')]);}logger[_0x4463('0x12')](_0x4463('0xd'),_0xc6b5b4,_0x4e1137[_0x4463('0x12')]['message']);return _0x235705(_0x4e1137[_0x4463('0x12')][_0x4463('0x14')]);}else{logger[_0x4463('0xc')](_0x4463('0xd'),_0xc6b5b4,'request\x20sent');_0x235705(_0x4e1137['result'][_0x4463('0x14')]);}})[_0x4463('0x15')](function(_0x1412c0){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0xc6b5b4,_0x1412c0);_0x558177(_0x1412c0);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index beda700..ec75b26 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 _0xde5b=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','put','update','delete','exports','multer','path','express','Router'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0xde5b,0x13f));var _0xbde5=function(_0x27cbb6,_0x3e5142){_0x27cbb6=_0x27cbb6-0x0;var _0x219d8e=_0xde5b[_0x27cbb6];return _0x219d8e;};'use strict';var multer=require(_0xbde5('0x0'));var util=require('util');var path=require(_0xbde5('0x1'));var timeout=require('connect-timeout');var express=require(_0xbde5('0x2'));var router=express[_0xbde5('0x3')]();var fs_extra=require(_0xbde5('0x4'));var auth=require(_0xbde5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbde5('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0xbde5('0x7')]('/',auth[_0xbde5('0x8')](),controller[_0xbde5('0x9')]);router['get']('/describe',auth[_0xbde5('0x8')](),controller[_0xbde5('0xa')]);router[_0xbde5('0x7')](_0xbde5('0xb'),auth[_0xbde5('0x8')](),controller[_0xbde5('0xc')]);router['post']('/',auth[_0xbde5('0x8')](),controller['create']);router[_0xbde5('0xd')]('/:id',auth[_0xbde5('0x8')](),controller[_0xbde5('0xe')]);router[_0xbde5('0xf')](_0xbde5('0xb'),auth[_0xbde5('0x8')](),controller['destroy']);module[_0xbde5('0x10')]=router; \ No newline at end of file +var _0x4069=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3f6ae9,_0x250970){var _0x1a3047=function(_0x516ac8){while(--_0x516ac8){_0x3f6ae9['push'](_0x3f6ae9['shift']());}};_0x1a3047(++_0x250970);}(_0x4069,0x134));var _0x9406=function(_0x30ea22,_0x175f80){_0x30ea22=_0x30ea22-0x0;var _0xd9670a=_0x4069[_0x30ea22];return _0xd9670a;};'use strict';var multer=require(_0x9406('0x0'));var util=require(_0x9406('0x1'));var path=require(_0x9406('0x2'));var timeout=require(_0x9406('0x3'));var express=require(_0x9406('0x4'));var router=express[_0x9406('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9406('0x6'));var interaction=require(_0x9406('0x7'));var config=require(_0x9406('0x8'));var controller=require(_0x9406('0x9'));router[_0x9406('0xa')]('/',auth[_0x9406('0xb')](),controller[_0x9406('0xc')]);router[_0x9406('0xa')](_0x9406('0xd'),auth[_0x9406('0xb')](),controller[_0x9406('0xe')]);router['get'](_0x9406('0xf'),auth[_0x9406('0xb')](),controller['show']);router[_0x9406('0x10')]('/',auth['isAuthenticated'](),controller[_0x9406('0x11')]);router['put'](_0x9406('0xf'),auth[_0x9406('0xb')](),controller['update']);router[_0x9406('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9406('0x13')]);module[_0x9406('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 3acdd6c..10393f0 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 _0xc20c=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0xc20c,0x19e));var _0xcc20=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0xc20c[_0x1ccbcc];return _0x1e873f;};'use strict';var Sequelize=require(_0xcc20('0x0'));module[_0xcc20('0x1')]={'name':{'type':Sequelize[_0xcc20('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcc20('0x3')](_0xcc20('0x4'),_0xcc20('0x5')),'defaultValue':_0xcc20('0x4')},'selector':{'type':Sequelize[_0xcc20('0x2')]},'timeout':{'type':Sequelize[_0xcc20('0x6')]}}; \ No newline at end of file +var _0x3f5f=['exports','STRING','mouseOver','INTEGER'];(function(_0x13517f,_0x4d1fbe){var _0x5b0b25=function(_0xe03da0){while(--_0xe03da0){_0x13517f['push'](_0x13517f['shift']());}};_0x5b0b25(++_0x4d1fbe);}(_0x3f5f,0x78));var _0xf3f5=function(_0x31bf4a,_0x51eb5f){_0x31bf4a=_0x31bf4a-0x0;var _0x2265ec=_0x3f5f[_0x31bf4a];return _0x2265ec;};'use strict';var Sequelize=require('sequelize');module[_0xf3f5('0x0')]={'name':{'type':Sequelize[_0xf3f5('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver','timeout'),'defaultValue':_0xf3f5('0x2')},'selector':{'type':Sequelize[_0xf3f5('0x1')]},'timeout':{'type':Sequelize[_0xf3f5('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 645e5bf..cfd52f9 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 _0x78b7=['rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','then','destroy','error','stack','name','send','params','keys','ChatProactiveAction'];(function(_0x3bd78d,_0x381dbf){var _0x1c5bad=function(_0x1dc0b7){while(--_0x1dc0b7){_0x3bd78d['push'](_0x3bd78d['shift']());}};_0x1c5bad(++_0x381dbf);}(_0x78b7,0x194));var _0x778b=function(_0x4c117d,_0xf11d85){_0x4c117d=_0x4c117d-0x0;var _0x1d1319=_0x78b7[_0x4c117d];return _0x1d1319;};'use strict';var emlformat=require(_0x778b('0x0'));var rimraf=require(_0x778b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x778b('0x2'));var rp=require(_0x778b('0x3'));var moment=require(_0x778b('0x4'));var BPromise=require(_0x778b('0x5'));var Mustache=require(_0x778b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x778b('0x7'));var csv=require(_0x778b('0x8'));var ejs=require(_0x778b('0x9'));var fs=require('fs');var fs_extra=require(_0x778b('0xa'));var _=require(_0x778b('0xb'));var squel=require(_0x778b('0xc'));var crypto=require('crypto');var jsforce=require(_0x778b('0xd'));var deskjs=require(_0x778b('0xe'));var toCsv=require(_0x778b('0x8'));var querystring=require(_0x778b('0xf'));var Papa=require(_0x778b('0x10'));var Redis=require('ioredis');var authService=require(_0x778b('0x11'));var qs=require(_0x778b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x778b('0x13'));var logger=require(_0x778b('0x14'))(_0x778b('0x15'));var utils=require(_0x778b('0x16'));var config=require(_0x778b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7ca7,_0x8ae3a9){_0x8ae3a9=_0x8ae3a9||0xcc;return function(_0x39584a){if(_0x39584a){return _0x2f7ca7[_0x778b('0x18')](_0x8ae3a9);}return _0x2f7ca7[_0x778b('0x19')](_0x8ae3a9)[_0x778b('0x1a')]();};}function respondWithResult(_0x47026b,_0x5c09c9){_0x5c09c9=_0x5c09c9||0xc8;return function(_0x1a7672){if(_0x1a7672){return _0x47026b[_0x778b('0x19')](_0x5c09c9)[_0x778b('0x1b')](_0x1a7672);}};}function respondWithFilteredResult(_0x389d63,_0x7aa12){return function(_0x52be17){if(_0x52be17){var _0x1bf480=typeof _0x7aa12['offset']===_0x778b('0x1c')&&typeof _0x7aa12[_0x778b('0x1d')]==='undefined';var _0x23069d=_0x52be17['count'];var _0x2d2732=_0x1bf480?0x0:_0x7aa12[_0x778b('0x1e')];var _0x5d9376=_0x1bf480?_0x52be17[_0x778b('0x1f')]:_0x7aa12[_0x778b('0x1e')]+_0x7aa12[_0x778b('0x1d')];var _0x5d4c05;if(_0x5d9376>=_0x23069d){_0x5d9376=_0x23069d;_0x5d4c05=0xc8;}else{_0x5d4c05=0xce;}_0x389d63[_0x778b('0x19')](_0x5d4c05);return _0x389d63[_0x778b('0x20')](_0x778b('0x21'),_0x2d2732+'-'+_0x5d9376+'/'+_0x23069d)[_0x778b('0x1b')](_0x52be17);}return null;};}function patchUpdates(_0x128388){return function(_0xa9c869){try{jsonpatch['apply'](_0xa9c869,_0x128388,!![]);}catch(_0x3f7282){return BPromise[_0x778b('0x22')](_0x3f7282);}return _0xa9c869['save']();};}function saveUpdates(_0x4083c2,_0x4a9564){return function(_0x3736f1){if(_0x3736f1){return _0x3736f1['update'](_0x4083c2)[_0x778b('0x23')](function(_0x4efc37){return _0x4efc37;});}return null;};}function removeEntity(_0x5bf9bb,_0xcef5c){return function(_0x578252){if(_0x578252){return _0x578252[_0x778b('0x24')]()[_0x778b('0x23')](function(){_0x5bf9bb[_0x778b('0x19')](0xcc)[_0x778b('0x1a')]();});}};}function handleEntityNotFound(_0x2095af,_0x4f1b03){return function(_0xa9083a){if(!_0xa9083a){_0x2095af[_0x778b('0x18')](0x194);}return _0xa9083a;};}function handleError(_0x1bc22f,_0x4ce74d){_0x4ce74d=_0x4ce74d||0x1f4;return function(_0x554c67){logger[_0x778b('0x25')](_0x554c67[_0x778b('0x26')]);if(_0x554c67[_0x778b('0x27')]){delete _0x554c67[_0x778b('0x27')];}_0x1bc22f[_0x778b('0x19')](_0x4ce74d)[_0x778b('0x28')](_0x554c67);};}exports['show']=function(_0x527051,_0x480714){var _0x17721e={'raw':!![],'where':{'id':_0x527051[_0x778b('0x29')]['id']}},_0xccca67={};_0xccca67['model']=_[_0x778b('0x2a')](db[_0x778b('0x2b')][_0x778b('0x2c')]);_0xccca67[_0x778b('0x2d')]=_[_0x778b('0x2a')](_0x527051['query']);_0xccca67[_0x778b('0x2e')]=_[_0x778b('0x2f')](_0xccca67['model'],_0xccca67['query']);_0x17721e[_0x778b('0x30')]=_[_0x778b('0x2f')](_0xccca67['model'],qs[_0x778b('0x31')](_0x527051[_0x778b('0x2d')][_0x778b('0x31')]));_0x17721e[_0x778b('0x30')]=_0x17721e[_0x778b('0x30')][_0x778b('0x32')]?_0x17721e['attributes']:_0xccca67['model'];if(_0x527051[_0x778b('0x2d')][_0x778b('0x33')]){_0x17721e['include']=[{'all':!![]}];}_0x17721e=_['merge']({},_0x17721e,_0x527051['options']);return db[_0x778b('0x2b')]['find'](_0x17721e)[_0x778b('0x23')](handleEntityNotFound(_0x480714,null))['then'](respondWithResult(_0x480714,null))[_0x778b('0x34')](handleError(_0x480714,null));};exports[_0x778b('0x35')]=function(_0x51b580,_0x179e51){return db['ChatProactiveAction'][_0x778b('0x35')](_0x51b580[_0x778b('0x36')],{})[_0x778b('0x23')](respondWithResult(_0x179e51,0xc9))[_0x778b('0x34')](handleError(_0x179e51,null));};exports['update']=function(_0x4d49e9,_0x2feb02){if(_0x4d49e9['body']['id']){delete _0x4d49e9[_0x778b('0x36')]['id'];}return db[_0x778b('0x2b')][_0x778b('0x37')]({'where':{'id':_0x4d49e9[_0x778b('0x29')]['id']}})[_0x778b('0x23')](handleEntityNotFound(_0x2feb02,null))[_0x778b('0x23')](saveUpdates(_0x4d49e9['body'],null))['then'](respondWithResult(_0x2feb02,null))[_0x778b('0x34')](handleError(_0x2feb02,null));};exports[_0x778b('0x24')]=function(_0x57aaac,_0x1b3da5){return db[_0x778b('0x2b')][_0x778b('0x37')]({'where':{'id':_0x57aaac[_0x778b('0x29')]['id']}})[_0x778b('0x23')](handleEntityNotFound(_0x1b3da5,null))[_0x778b('0x23')](removeEntity(_0x1b3da5,null))[_0x778b('0x34')](handleError(_0x1b3da5,null));}; \ No newline at end of file +var _0x2d17=['../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','then','error','name','show','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','merge','options','ChatProactiveAction','find','catch','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2d17,0x17e));var _0x72d1=function(_0x43ccbb,_0x2223c9){_0x43ccbb=_0x43ccbb-0x0;var _0x18f1b6=_0x2d17[_0x43ccbb];return _0x18f1b6;};'use strict';var emlformat=require(_0x72d1('0x0'));var rimraf=require(_0x72d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72d1('0x2'));var rp=require(_0x72d1('0x3'));var moment=require('moment');var BPromise=require(_0x72d1('0x4'));var Mustache=require(_0x72d1('0x5'));var util=require('util');var path=require(_0x72d1('0x6'));var sox=require('sox');var csv=require(_0x72d1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72d1('0x8'));var _=require(_0x72d1('0x9'));var squel=require('squel');var crypto=require(_0x72d1('0xa'));var jsforce=require(_0x72d1('0xb'));var deskjs=require(_0x72d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72d1('0xd'));var Papa=require(_0x72d1('0xe'));var Redis=require(_0x72d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x72d1('0x10'));var as=require(_0x72d1('0x11'));var hardwareService=require(_0x72d1('0x12'));var logger=require(_0x72d1('0x13'))(_0x72d1('0x14'));var utils=require(_0x72d1('0x15'));var config=require(_0x72d1('0x16'));var licenseUtil=require(_0x72d1('0x17'));var db=require(_0x72d1('0x18'))['db'];function respondWithStatusCode(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xcc;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0x19')](_0x5ad4df);}return _0x2f5a78[_0x72d1('0x1a')](_0x5ad4df)[_0x72d1('0x1b')]();};}function respondWithResult(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0xc8;return function(_0x143718){if(_0x143718){return _0x22ac6f[_0x72d1('0x1a')](_0x685a27)[_0x72d1('0x1c')](_0x143718);}};}function respondWithFilteredResult(_0x3f190f,_0x21c85e){return function(_0x23a238){if(_0x23a238){var _0x8d458=typeof _0x21c85e['offset']===_0x72d1('0x1d')&&typeof _0x21c85e['limit']===_0x72d1('0x1d');var _0x2c9851=_0x23a238['count'];var _0x1061b7=_0x8d458?0x0:_0x21c85e[_0x72d1('0x1e')];var _0x1ca18d=_0x8d458?_0x23a238['count']:_0x21c85e['offset']+_0x21c85e[_0x72d1('0x1f')];var _0x10d464;if(_0x1ca18d>=_0x2c9851){_0x1ca18d=_0x2c9851;_0x10d464=0xc8;}else{_0x10d464=0xce;}_0x3f190f[_0x72d1('0x1a')](_0x10d464);return _0x3f190f[_0x72d1('0x20')](_0x72d1('0x21'),_0x1061b7+'-'+_0x1ca18d+'/'+_0x2c9851)[_0x72d1('0x1c')](_0x23a238);}return null;};}function patchUpdates(_0x1e2411){return function(_0x5c7982){try{jsonpatch[_0x72d1('0x22')](_0x5c7982,_0x1e2411,!![]);}catch(_0x56e8d3){return BPromise['reject'](_0x56e8d3);}return _0x5c7982['save']();};}function saveUpdates(_0x585243,_0x445985){return function(_0x374602){if(_0x374602){return _0x374602['update'](_0x585243)[_0x72d1('0x23')](function(_0x256dc1){return _0x256dc1;});}return null;};}function removeEntity(_0x492086,_0x1431ee){return function(_0x26fa35){if(_0x26fa35){return _0x26fa35['destroy']()['then'](function(){_0x492086[_0x72d1('0x1a')](0xcc)[_0x72d1('0x1b')]();});}};}function handleEntityNotFound(_0x2f661,_0x2f879f){return function(_0xdf6a69){if(!_0xdf6a69){_0x2f661[_0x72d1('0x19')](0x194);}return _0xdf6a69;};}function handleError(_0x163bec,_0x589f7c){_0x589f7c=_0x589f7c||0x1f4;return function(_0x57ec9e){logger[_0x72d1('0x24')](_0x57ec9e['stack']);if(_0x57ec9e[_0x72d1('0x25')]){delete _0x57ec9e[_0x72d1('0x25')];}_0x163bec[_0x72d1('0x1a')](_0x589f7c)['send'](_0x57ec9e);};}exports[_0x72d1('0x26')]=function(_0x4c4c41,_0x707cd0){var _0x20055f={'raw':!![],'where':{'id':_0x4c4c41[_0x72d1('0x27')]['id']}},_0x32588f={};_0x32588f['model']=_[_0x72d1('0x28')](db['ChatProactiveAction'][_0x72d1('0x29')]);_0x32588f[_0x72d1('0x2a')]=_['keys'](_0x4c4c41[_0x72d1('0x2a')]);_0x32588f[_0x72d1('0x2b')]=_[_0x72d1('0x2c')](_0x32588f[_0x72d1('0x2d')],_0x32588f[_0x72d1('0x2a')]);_0x20055f['attributes']=_[_0x72d1('0x2c')](_0x32588f[_0x72d1('0x2d')],qs[_0x72d1('0x2e')](_0x4c4c41['query'][_0x72d1('0x2e')]));_0x20055f[_0x72d1('0x2f')]=_0x20055f['attributes'][_0x72d1('0x30')]?_0x20055f[_0x72d1('0x2f')]:_0x32588f[_0x72d1('0x2d')];if(_0x4c4c41['query'][_0x72d1('0x31')]){_0x20055f['include']=[{'all':!![]}];}_0x20055f=_[_0x72d1('0x32')]({},_0x20055f,_0x4c4c41[_0x72d1('0x33')]);return db[_0x72d1('0x34')][_0x72d1('0x35')](_0x20055f)[_0x72d1('0x23')](handleEntityNotFound(_0x707cd0,null))[_0x72d1('0x23')](respondWithResult(_0x707cd0,null))[_0x72d1('0x36')](handleError(_0x707cd0,null));};exports[_0x72d1('0x37')]=function(_0x4006b9,_0x24be04){return db[_0x72d1('0x34')]['create'](_0x4006b9[_0x72d1('0x38')],{})[_0x72d1('0x23')](respondWithResult(_0x24be04,0xc9))[_0x72d1('0x36')](handleError(_0x24be04,null));};exports[_0x72d1('0x39')]=function(_0x49e074,_0x3eb3da){if(_0x49e074[_0x72d1('0x38')]['id']){delete _0x49e074[_0x72d1('0x38')]['id'];}return db['ChatProactiveAction'][_0x72d1('0x35')]({'where':{'id':_0x49e074[_0x72d1('0x27')]['id']}})[_0x72d1('0x23')](handleEntityNotFound(_0x3eb3da,null))['then'](saveUpdates(_0x49e074[_0x72d1('0x38')],null))[_0x72d1('0x23')](respondWithResult(_0x3eb3da,null))[_0x72d1('0x36')](handleError(_0x3eb3da,null));};exports['destroy']=function(_0x43b419,_0x40cdbd){return db[_0x72d1('0x34')][_0x72d1('0x35')]({'where':{'id':_0x43b419[_0x72d1('0x27')]['id']}})[_0x72d1('0x23')](handleEntityNotFound(_0x40cdbd,null))[_0x72d1('0x23')](removeEntity(_0x40cdbd,null))['catch'](handleError(_0x40cdbd,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 9510a9f..4c1b6c9 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 _0x64ac=['moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util','../../config/logger'];(function(_0x47985e,_0x350685){var _0x23e631=function(_0x10838e){while(--_0x10838e){_0x47985e['push'](_0x47985e['shift']());}};_0x23e631(++_0x350685);}(_0x64ac,0x6c));var _0xc64a=function(_0x5c44c9,_0x3350d4){_0x5c44c9=_0x5c44c9-0x0;var _0x31a957=_0x64ac[_0x5c44c9];return _0x31a957;};'use strict';var _=require('lodash');var util=require(_0xc64a('0x0'));var logger=require(_0xc64a('0x1'))('api');var moment=require(_0xc64a('0x2'));var BPromise=require(_0xc64a('0x3'));var rp=require(_0xc64a('0x4'));var fs=require('fs');var path=require(_0xc64a('0x5'));var rimraf=require('rimraf');var config=require(_0xc64a('0x6'));var attributes=require(_0xc64a('0x7'));module[_0xc64a('0x8')]=function(_0x2215fa,_0x224e72){return _0x2215fa[_0xc64a('0x9')](_0xc64a('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6a4=['path','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xd6a4,0x123));var _0x4d6a=function(_0xb70c12,_0x3e092b){_0xb70c12=_0xb70c12-0x0;var _0x5b86d9=_0xd6a4[_0xb70c12];return _0x5b86d9;};'use strict';var _=require(_0x4d6a('0x0'));var util=require(_0x4d6a('0x1'));var logger=require(_0x4d6a('0x2'))('api');var moment=require(_0x4d6a('0x3'));var BPromise=require(_0x4d6a('0x4'));var rp=require(_0x4d6a('0x5'));var fs=require('fs');var path=require(_0x4d6a('0x6'));var rimraf=require('rimraf');var config=require(_0x4d6a('0x7'));var attributes=require(_0x4d6a('0x8'));module['exports']=function(_0x494f72,_0xf21151){return _0x494f72[_0x4d6a('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x4d6a('0xa'),'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 768e8c1..1d4be1f 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 _0x75d5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x15e8fe,_0x14d43e){var _0x28bd91=function(_0x5bfc87){while(--_0x5bfc87){_0x15e8fe['push'](_0x15e8fe['shift']());}};_0x28bd91(++_0x14d43e);}(_0x75d5,0x1c7));var _0x575d=function(_0x1ad47e,_0x5bc8eb){_0x1ad47e=_0x1ad47e-0x0;var _0x175aa2=_0x75d5[_0x1ad47e];return _0x175aa2;};'use strict';var _=require(_0x575d('0x0'));var util=require(_0x575d('0x1'));var moment=require(_0x575d('0x2'));var BPromise=require(_0x575d('0x3'));var rs=require(_0x575d('0x4'));var fs=require('fs');var Redis=require(_0x575d('0x5'));var db=require(_0x575d('0x6'))['db'];var utils=require(_0x575d('0x7'));var logger=require(_0x575d('0x8'))(_0x575d('0x9'));var config=require('../../config/environment');var jayson=require(_0x575d('0xa'));var client=jayson[_0x575d('0xb')][_0x575d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5366ea,_0x2ff9fe,_0x3bc7d5){return new BPromise(function(_0x4b3cb0,_0x478d97){return client[_0x575d('0xd')](_0x5366ea,_0x3bc7d5)[_0x575d('0xe')](function(_0x51c8ed){logger[_0x575d('0xf')](_0x575d('0x10'),_0x2ff9fe,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2ff9fe,_0x575d('0x11'),JSON[_0x575d('0x12')](_0x51c8ed));if(_0x51c8ed['error']){if(_0x51c8ed['error'][_0x575d('0x13')]===0x1f4){logger[_0x575d('0x14')](_0x575d('0x10'),_0x2ff9fe,_0x51c8ed[_0x575d('0x14')]['message']);return _0x478d97(_0x51c8ed[_0x575d('0x14')]['message']);}logger[_0x575d('0x14')](_0x575d('0x10'),_0x2ff9fe,_0x51c8ed['error'][_0x575d('0x15')]);return _0x4b3cb0(_0x51c8ed[_0x575d('0x14')][_0x575d('0x15')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2ff9fe,'request\x20sent');_0x4b3cb0(_0x51c8ed['result'][_0x575d('0x15')]);}})[_0x575d('0x16')](function(_0x4c7307){logger[_0x575d('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x2ff9fe,_0x4c7307);_0x478d97(_0x4c7307);});});} \ No newline at end of file +var _0x4fad=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fad,0x10a));var _0xd4fa=function(_0x551c43,_0x347e8e){_0x551c43=_0x551c43-0x0;var _0x27d763=_0x4fad[_0x551c43];return _0x27d763;};'use strict';var _=require('lodash');var util=require(_0xd4fa('0x0'));var moment=require(_0xd4fa('0x1'));var BPromise=require(_0xd4fa('0x2'));var rs=require(_0xd4fa('0x3'));var fs=require('fs');var Redis=require(_0xd4fa('0x4'));var db=require(_0xd4fa('0x5'))['db'];var utils=require(_0xd4fa('0x6'));var logger=require(_0xd4fa('0x7'))(_0xd4fa('0x8'));var config=require(_0xd4fa('0x9'));var jayson=require(_0xd4fa('0xa'));var client=jayson[_0xd4fa('0xb')][_0xd4fa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c8a35,_0x311dd1,_0x30c2ac){return new BPromise(function(_0x51137a,_0x2b706d){return client[_0xd4fa('0xd')](_0x2c8a35,_0x30c2ac)['then'](function(_0x44e777){logger[_0xd4fa('0xe')](_0xd4fa('0xf'),_0x311dd1,_0xd4fa('0x10'));logger[_0xd4fa('0x11')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x311dd1,_0xd4fa('0x10'),JSON[_0xd4fa('0x12')](_0x44e777));if(_0x44e777[_0xd4fa('0x13')]){if(_0x44e777['error']['code']===0x1f4){logger['error'](_0xd4fa('0xf'),_0x311dd1,_0x44e777[_0xd4fa('0x13')][_0xd4fa('0x14')]);return _0x2b706d(_0x44e777[_0xd4fa('0x13')]['message']);}logger[_0xd4fa('0x13')](_0xd4fa('0xf'),_0x311dd1,_0x44e777[_0xd4fa('0x13')][_0xd4fa('0x14')]);return _0x51137a(_0x44e777[_0xd4fa('0x13')]['message']);}else{logger[_0xd4fa('0xe')](_0xd4fa('0xf'),_0x311dd1,_0xd4fa('0x10'));_0x51137a(_0x44e777[_0xd4fa('0x15')][_0xd4fa('0x14')]);}})['catch'](function(_0x137bd3){logger[_0xd4fa('0x13')](_0xd4fa('0xf'),_0x311dd1,_0x137bd3);_0x2b706d(_0x137bd3);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8d80512..591fb0c 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 _0x2eb2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','update','delete','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2eb2,0x19f));var _0x22eb=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x2eb2[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x22eb('0x7')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xa')]);router[_0x22eb('0xb')]('/',auth[_0x22eb('0x9')](),controller[_0x22eb('0xc')]);router[_0x22eb('0xd')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xe')]);router[_0x22eb('0xf')]('/:id',auth[_0x22eb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8958=['show','post','put','update','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x462725,_0x24546f){var _0x523672=function(_0xcd2c05){while(--_0xcd2c05){_0x462725['push'](_0x462725['shift']());}};_0x523672(++_0x24546f);}(_0x8958,0x93));var _0x8895=function(_0x343493,_0x2b85bc){_0x343493=_0x343493-0x0;var _0x11776a=_0x8958[_0x343493];return _0x11776a;};'use strict';var multer=require('multer');var util=require(_0x8895('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8895('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var controller=require(_0x8895('0x4'));router['get'](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0x7')]);router[_0x8895('0x8')]('/',auth[_0x8895('0x6')](),controller['create']);router[_0x8895('0x9')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xa')]);router[_0x8895('0xb')](_0x8895('0x5'),auth[_0x8895('0x6')](),controller[_0x8895('0xc')]);module[_0x8895('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 54d2c8b..030fd89 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 _0x6579=['beepall','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6579,0x10f));var _0x9657=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6579[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9657('0x0'));module['exports']={'name':{'type':Sequelize[_0x9657('0x1')],'unique':_0x9657('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9657('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9657('0x3')](_0x9657('0x4'),_0x9657('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x398a=['STRING','INTEGER','ENUM','rrmemory','sequelize','exports','name'];(function(_0x3f9864,_0x24d8a1){var _0x4f03c2=function(_0x2c13aa){while(--_0x2c13aa){_0x3f9864['push'](_0x3f9864['shift']());}};_0x4f03c2(++_0x24d8a1);}(_0x398a,0x154));var _0xa398=function(_0xc690c2,_0x307dbe){_0xc690c2=_0xc690c2-0x0;var _0x131ba9=_0x398a[_0xc690c2];return _0x131ba9;};'use strict';var Sequelize=require(_0xa398('0x0'));module[_0xa398('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa398('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa398('0x3')]},'timeout':{'type':Sequelize[_0xa398('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa398('0x5')](_0xa398('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 043c1be..a53f0c3 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 _0xceea=['count','set','then','destroy','UserProfileResource','error','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','UserProfileSection','autoAssociation','update','describe','getMembers','findOne','get','UserChatQueue','hasOwnProperty','sort','pick','ChatQueueId','filter','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','nolimit','addTeams','Agents','online','flatMap','transaction','each','findOrCreate','forEach','emit','ids','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','json','offset','limit','undefined'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xceea,0xe7));var _0xacee=function(_0x49b1ca,_0x32f161){_0x49b1ca=_0x49b1ca-0x0;var _0x5650bb=_0xceea[_0x49b1ca];return _0x5650bb;};'use strict';var BPromise=require(_0xacee('0x0'));var util=require('util');var _=require(_0xacee('0x1'));var squel=require(_0xacee('0x2'));var Redis=require('ioredis');var qs=require(_0xacee('0x3'));var logger=require(_0xacee('0x4'))(_0xacee('0x5'));var config=require('../../config/environment');var db=require(_0xacee('0x6'))['db'];config['redis']=_[_0xacee('0x7')](config[_0xacee('0x8')],{'host':_0xacee('0x9'),'port':0x18eb});var socket=require(_0xacee('0xa'))(new Redis(config[_0xacee('0x8')]));require(_0xacee('0xb'))[_0xacee('0xc')](socket);function respondWithStatusCode(_0x9575f3,_0x133999){_0x133999=_0x133999||0xcc;return function(_0x179935){if(_0x179935){return _0x9575f3['sendStatus'](_0x133999);}return _0x9575f3[_0xacee('0xd')](_0x133999)[_0xacee('0xe')]();};}function respondWithResult(_0x55ea18,_0x593b1f){_0x593b1f=_0x593b1f||0xc8;return function(_0x4ec6d9){if(_0x4ec6d9){return _0x55ea18[_0xacee('0xd')](_0x593b1f)[_0xacee('0xf')](_0x4ec6d9);}};}function respondWithFilteredResult(_0x46ce65,_0x2cb230){return function(_0x557c68){if(_0x557c68){var _0x4d0489=typeof _0x2cb230[_0xacee('0x10')]==='undefined'&&typeof _0x2cb230[_0xacee('0x11')]===_0xacee('0x12');var _0x181d9e=_0x557c68[_0xacee('0x13')];var _0x38073a=_0x4d0489?0x0:_0x2cb230['offset'];var _0x328784=_0x4d0489?_0x557c68['count']:_0x2cb230[_0xacee('0x10')]+_0x2cb230[_0xacee('0x11')];var _0x57f589;if(_0x328784>=_0x181d9e){_0x328784=_0x181d9e;_0x57f589=0xc8;}else{_0x57f589=0xce;}_0x46ce65['status'](_0x57f589);return _0x46ce65[_0xacee('0x14')]('Content-Range',_0x38073a+'-'+_0x328784+'/'+_0x181d9e)[_0xacee('0xf')](_0x557c68);}return null;};}function saveUpdates(_0x22bd6e){return function(_0x749fa4){if(_0x749fa4){return _0x749fa4['update'](_0x22bd6e)[_0xacee('0x15')](function(_0x1885ce){return _0x1885ce;});}return null;};}function removeEntity(_0x49fed2){return function(_0x2b4457){if(_0x2b4457){return _0x2b4457[_0xacee('0x16')]()['then'](function(){var _0x2d1101=_0x2b4457['get']({'plain':!![]});var _0x23d3ed='ChatQueues';return db[_0xacee('0x17')]['destroy']({'where':{'type':_0x23d3ed,'resourceId':_0x2d1101['id']}})[_0xacee('0x15')](function(){return _0x2b4457;});})[_0xacee('0x15')](function(){_0x49fed2[_0xacee('0xd')](0xcc)[_0xacee('0xe')]();});}};}function handleEntityNotFound(_0x315908){return function(_0x2d3742){if(!_0x2d3742){_0x315908['sendStatus'](0x194);}return _0x2d3742;};}function handleError(_0x4509c6,_0x5021ea){_0x5021ea=_0x5021ea||0x1f4;return function(_0x436f30){logger[_0xacee('0x18')](_0x436f30['stack']);if(_0x436f30[_0xacee('0x19')]){delete _0x436f30[_0xacee('0x19')];}_0x4509c6[_0xacee('0xd')](_0x5021ea)[_0xacee('0x1a')](_0x436f30);};}exports[_0xacee('0x1b')]=function(_0xfb9adb,_0x2c07a8){var _0x4e69a2={};var _0x57e87e={'count':0x0,'rows':[]};var _0x3036f2=_[_0xacee('0x1c')](db[_0xacee('0x1d')][_0xacee('0x1e')],function(_0x44514c){return{'name':_0x44514c[_0xacee('0x1f')],'type':_0x44514c[_0xacee('0x20')][_0xacee('0x21')]};});_0x4e69a2=qs[_0xacee('0x22')](_0x3036f2,_0xfb9adb);var _0x37e3a7={'where':_0x4e69a2[_0xacee('0x23')]};return db[_0xacee('0x1d')][_0xacee('0x13')](_0x37e3a7)['then'](function(_0x403315){_0x57e87e['count']=_0x403315;_0x4e69a2[_0xacee('0x24')]=qs[_0xacee('0x24')](_0xfb9adb[_0xacee('0x25')]);return db[_0xacee('0x1d')][_0xacee('0x26')](_0x4e69a2);})[_0xacee('0x15')](function(_0x26da1c){_0x57e87e[_0xacee('0x27')]=_0x26da1c;return _0x57e87e;})[_0xacee('0x15')](respondWithFilteredResult(_0x2c07a8,_0x4e69a2))[_0xacee('0x28')](handleError(_0x2c07a8,null));};exports[_0xacee('0x29')]=function(_0x308df7,_0x443634){var _0x21d9d6={'raw':!![],'where':{'id':_0x308df7[_0xacee('0x2a')]['id']}},_0x12fdd4={};_0x12fdd4[_0xacee('0x2b')]=_[_0xacee('0x2c')](db['ChatQueue'][_0xacee('0x1e')]);_0x12fdd4['query']=_[_0xacee('0x2c')](_0x308df7[_0xacee('0x25')]);_0x12fdd4[_0xacee('0x2d')]=_[_0xacee('0x2e')](_0x12fdd4['model'],_0x12fdd4[_0xacee('0x25')]);_0x21d9d6[_0xacee('0x2f')]=_[_0xacee('0x2e')](_0x12fdd4[_0xacee('0x2b')],qs[_0xacee('0x30')](_0x308df7[_0xacee('0x25')][_0xacee('0x30')]));_0x21d9d6[_0xacee('0x2f')]=_0x21d9d6['attributes'][_0xacee('0x31')]?_0x21d9d6[_0xacee('0x2f')]:_0x12fdd4[_0xacee('0x2b')];if(_0x308df7['query'][_0xacee('0x32')]){_0x21d9d6[_0xacee('0x24')]=[{'all':!![]}];}_0x21d9d6=_[_0xacee('0x33')]({},_0x21d9d6,_0x308df7[_0xacee('0x34')]);return db[_0xacee('0x1d')][_0xacee('0x35')](_0x21d9d6)[_0xacee('0x15')](handleEntityNotFound(_0x443634,null))[_0xacee('0x15')](respondWithResult(_0x443634,null))[_0xacee('0x28')](handleError(_0x443634,null));};exports[_0xacee('0x36')]=function(_0x4bd734,_0x56dba5){return db[_0xacee('0x1d')]['create'](_0x4bd734[_0xacee('0x37')],{})['then'](function(_0x30b0ca){var _0x435ea1=_0x4bd734['user']['get']({'plain':!![]});if(!_0x435ea1)throw new Error(_0xacee('0x38'));if(_0x435ea1['role']==='user'){var _0x444f1f=_0x30b0ca['get']({'plain':!![]});var _0x117b31=_0xacee('0x39');return db[_0xacee('0x3a')]['find']({'where':{'name':_0x117b31,'userProfileId':_0x435ea1['userProfileId']},'raw':!![]})['then'](function(_0x28f677){if(_0x28f677&&_0x28f677[_0xacee('0x3b')]===0x0){return db[_0xacee('0x17')][_0xacee('0x36')]({'name':_0x444f1f[_0xacee('0x19')],'resourceId':_0x444f1f['id'],'type':_0x28f677['name'],'sectionId':_0x28f677['id']},{})[_0xacee('0x15')](function(){return _0x30b0ca;});}else{return _0x30b0ca;}})[_0xacee('0x28')](function(_0x1f6d54){logger[_0xacee('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f6d54);throw _0x1f6d54;});}return _0x30b0ca;})[_0xacee('0x15')](respondWithResult(_0x56dba5,0xc9))[_0xacee('0x28')](handleError(_0x56dba5,null));};exports[_0xacee('0x3c')]=function(_0x5306b3,_0x17602f){if(_0x5306b3[_0xacee('0x37')]['id']){delete _0x5306b3[_0xacee('0x37')]['id'];}return db[_0xacee('0x1d')]['find']({'where':{'id':_0x5306b3[_0xacee('0x2a')]['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x17602f,null))[_0xacee('0x15')](saveUpdates(_0x5306b3[_0xacee('0x37')],null))['then'](respondWithResult(_0x17602f,null))['catch'](handleError(_0x17602f,null));};exports[_0xacee('0x16')]=function(_0x1e3a60,_0x46f2bb){return db[_0xacee('0x1d')]['find']({'where':{'id':_0x1e3a60[_0xacee('0x2a')]['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x46f2bb,null))[_0xacee('0x15')](removeEntity(_0x46f2bb,null))[_0xacee('0x28')](handleError(_0x46f2bb,null));};exports[_0xacee('0x3d')]=function(_0x2e8520,_0x5e77ab){return db[_0xacee('0x1d')][_0xacee('0x3d')]()[_0xacee('0x15')](respondWithResult(_0x5e77ab,null))[_0xacee('0x28')](handleError(_0x5e77ab,null));};exports[_0xacee('0x3e')]=function(_0xf5785f,_0x326871){var _0x4e0e4a={'raw':!![],'where':{}},_0xd93c1a={},_0x3237de;return db['ChatQueue'][_0xacee('0x3f')]({'where':{'id':_0xf5785f[_0xacee('0x2a')]['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x326871,null))[_0xacee('0x15')](function(_0xad2411){if(_0xad2411){_0x3237de=_0xad2411[_0xacee('0x40')]({'plain':!![]});_0xd93c1a[_0xacee('0x2b')]=_['keys'](db[_0xacee('0x41')][_0xacee('0x1e')]);_0xd93c1a[_0xacee('0x25')]=_[_0xacee('0x2c')](_0xf5785f[_0xacee('0x25')]);_0xd93c1a[_0xacee('0x2d')]=_[_0xacee('0x2e')](_0xd93c1a[_0xacee('0x2b')],_0xd93c1a[_0xacee('0x25')]);_0x4e0e4a['attributes']=_[_0xacee('0x2e')](_0xd93c1a[_0xacee('0x2b')],qs[_0xacee('0x30')](_0xf5785f[_0xacee('0x25')][_0xacee('0x30')]));_0x4e0e4a[_0xacee('0x2f')]=_0x4e0e4a['attributes']['length']?_0x4e0e4a['attributes']:_0xd93c1a['model'];if(!_0xf5785f[_0xacee('0x25')][_0xacee('0x42')]('nolimit')){_0x4e0e4a[_0xacee('0x11')]=qs[_0xacee('0x11')](_0xf5785f[_0xacee('0x25')]['limit']);_0x4e0e4a[_0xacee('0x10')]=qs[_0xacee('0x10')](_0xf5785f[_0xacee('0x25')]['offset']);}_0x4e0e4a['order']=qs[_0xacee('0x43')](_0xf5785f[_0xacee('0x25')]['sort']);_0x4e0e4a['where']=qs['filters'](_[_0xacee('0x44')](_0xf5785f[_0xacee('0x25')],_0xd93c1a['filters']));_0x4e0e4a[_0xacee('0x23')][_0xacee('0x45')]=_0xad2411['id'];if(_0xf5785f[_0xacee('0x25')][_0xacee('0x46')]){_0x4e0e4a[_0xacee('0x23')]=_['merge'](_0x4e0e4a[_0xacee('0x23')],{'$or':_[_0xacee('0x1c')](_0x4e0e4a['attributes'],function(_0x518ae6){var _0x3b6e52={};_0x3b6e52[_0x518ae6]={'$like':'%'+_0xf5785f['query'][_0xacee('0x46')]+'%'};return _0x3b6e52;})});}_0x4e0e4a=_[_0xacee('0x33')]({},_0x4e0e4a,_0xf5785f['options']);return db[_0xacee('0x41')][_0xacee('0x26')](_0x4e0e4a);}})['then'](function(_0x34e863){if(_0x34e863){return db[_0xacee('0x47')][_0xacee('0x48')]({'where':{'id':_['map'](_0x34e863,_0xacee('0x49')),'role':_0xacee('0x4a')},'attributes':['id',_0xacee('0x19'),_0xacee('0x4b'),_0xacee('0x4c'),_0xacee('0x4d')]});}})[_0xacee('0x15')](function(_0xe2d289){if(_0xe2d289){return{'count':_0xe2d289[_0xacee('0x13')],'rows':_['map'](_0xe2d289[_0xacee('0x27')],function(_0x5851d5){return{'membername':_0x5851d5[_0xacee('0x19')],'UserId':_0x5851d5['id'],'queue_name':_0x3237de[_0xacee('0x19')],'ChatQueueId':_0x3237de['id'],'interface':util[_0xacee('0x4e')](_0xacee('0x4f'),_0xacee('0x50'),_0x5851d5[_0xacee('0x19')]),'penalty':0x0,'paused':_0x5851d5[_0xacee('0x4b')],'createdAt':_0x5851d5[_0xacee('0x4d')],'updatedAt':_0x5851d5[_0xacee('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x326871,_0x4e0e4a))['catch'](handleError(_0x326871,null));};exports[_0xacee('0x51')]=function(_0x38067a,_0x291278){var _0x3ab7dc={};var _0xa7363f={};var _0x59adb0;var _0x5f491d;return db[_0xacee('0x1d')]['findOne']({'where':{'id':_0x38067a[_0xacee('0x2a')]['id']}})['then'](handleEntityNotFound(_0x291278,null))[_0xacee('0x15')](function(_0x1d5c76){if(_0x1d5c76){_0x59adb0=_0x1d5c76;_0xa7363f['model']=_[_0xacee('0x2c')](db[_0xacee('0x52')][_0xacee('0x1e')]);_0xa7363f[_0xacee('0x25')]=_[_0xacee('0x2c')](_0x38067a[_0xacee('0x25')]);_0xa7363f['filters']=_[_0xacee('0x2e')](_0xa7363f[_0xacee('0x2b')],_0xa7363f['query']);_0x3ab7dc['attributes']=_[_0xacee('0x2e')](_0xa7363f[_0xacee('0x2b')],qs['fields'](_0x38067a[_0xacee('0x25')]['fields']));_0x3ab7dc[_0xacee('0x2f')]=_0x3ab7dc[_0xacee('0x2f')][_0xacee('0x31')]?_0x3ab7dc[_0xacee('0x2f')]:_0xa7363f[_0xacee('0x2b')];_0x3ab7dc[_0xacee('0x53')]=qs[_0xacee('0x43')](_0x38067a[_0xacee('0x25')][_0xacee('0x43')]);_0x3ab7dc[_0xacee('0x23')]=qs[_0xacee('0x2d')](_[_0xacee('0x44')](_0x38067a[_0xacee('0x25')],_0xa7363f[_0xacee('0x2d')]));if(_0x38067a[_0xacee('0x25')][_0xacee('0x46')]){_0x3ab7dc[_0xacee('0x23')]=_[_0xacee('0x33')](_0x3ab7dc[_0xacee('0x23')],{'$or':_[_0xacee('0x1c')](_0x3ab7dc[_0xacee('0x2f')],function(_0x580ea1){var _0x161dca={};_0x161dca[_0x580ea1]={'$like':'%'+_0x38067a[_0xacee('0x25')][_0xacee('0x46')]+'%'};return _0x161dca;})});}_0x3ab7dc=_[_0xacee('0x33')]({},_0x3ab7dc,_0x38067a[_0xacee('0x34')]);return _0x59adb0[_0xacee('0x51')](_0x3ab7dc);}})[_0xacee('0x15')](function(_0x2e5c38){if(_0x2e5c38){_0x5f491d=_0x2e5c38['length'];if(!_0x38067a['query'][_0xacee('0x42')](_0xacee('0x54'))){_0x3ab7dc['limit']=qs['limit'](_0x38067a['query'][_0xacee('0x11')]);_0x3ab7dc[_0xacee('0x10')]=qs[_0xacee('0x10')](_0x38067a[_0xacee('0x25')][_0xacee('0x10')]);}return _0x59adb0['getTeams'](_0x3ab7dc);}})[_0xacee('0x15')](function(_0x1c9507){if(_0x1c9507){return _0x1c9507?{'count':_0x5f491d,'rows':_0x1c9507}:null;}})[_0xacee('0x15')](respondWithResult(_0x291278,null))['catch'](handleError(_0x291278,null));};exports[_0xacee('0x55')]=function(_0x1935b9,_0x512f9d){var _0x5df4dd=_0x1935b9[_0xacee('0x37')]['ids'];return db['Team'][_0xacee('0x26')]({'where':{'id':_0x5df4dd},'attributes':['id'],'include':[{'model':db['User'],'as':_0xacee('0x56'),'attributes':['id',_0xacee('0x19'),_0xacee('0x57'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1bef58){if(_0x1bef58){var _0x28cb9a=_[_0xacee('0x58')](_0x1bef58,function(_0x48393d){var _0x26aa49=_0x48393d[_0xacee('0x40')]({'plain':!![]});return _0x26aa49['Agents'];});return db[_0xacee('0x1d')]['find']({'where':{'id':_0x1935b9['params']['id']}})[_0xacee('0x15')](function(_0x40e632){return db['sequelize'][_0xacee('0x59')](function(_0x41a6b9){return _0x40e632['addTeams'](_0x5df4dd,{'transaction':_0x41a6b9})[_0xacee('0x15')](function(){return BPromise[_0xacee('0x5a')](_0x28cb9a,function(_0x1c97dc){return db[_0xacee('0x41')][_0xacee('0x5b')]({'where':{'UserId':_0x1c97dc['id'],'ChatQueueId':_0x1935b9[_0xacee('0x2a')]['id']},'transaction':_0x41a6b9});});})[_0xacee('0x15')](function(){_0x28cb9a[_0xacee('0x5c')](function(_0x238c52){socket[_0xacee('0x5d')]('userChatQueue:save',{'UserId':_0x238c52['id'],'ChatQueueId':_0x40e632['id']});});});});});}})[_0xacee('0x15')](respondWithStatusCode(_0x512f9d,null))[_0xacee('0x28')](handleError(_0x512f9d,null));};exports['removeTeams']=function(_0x339285,_0x1f15bd){return db[_0xacee('0x52')][_0xacee('0x26')]({'where':{'id':_0x339285['query'][_0xacee('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xacee('0x47')],'as':_0xacee('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1f15bd,null))[_0xacee('0x15')](function(_0x4a8998){var _0x2b9973=_[_0xacee('0x1c')](_0x4a8998,'id');var _0x34dfa2=[];var _0x2f39b3=[];var _0x7189cc=squel[_0xacee('0x5f')]();_0x7189cc['field'](_0xacee('0x60'))[_0xacee('0x61')](_0xacee('0x62'),'tq')[_0xacee('0x63')](_0xacee('0x64'),'ut',_0xacee('0x65'))[_0xacee('0x23')](_0xacee('0x66'),_0x339285[_0xacee('0x2a')]['id']);for(var _0x1fafcc=0x0;_0x1fafcc<_0x4a8998['length'];_0x1fafcc+=0x1){let _0x1f880c=_0x4a8998[_0x1fafcc];for(var _0x12872a=0x0;_0x12872a<_0x1f880c['Agents'][_0xacee('0x31')];_0x12872a+=0x1){let _0x221682=_0x1f880c['Agents'][_0x12872a];var _0x1c5f85=_0x7189cc[_0xacee('0x67')]();_0x1c5f85['where'](_0xacee('0x68'),_0x221682['id']);_0x2f39b3[_0xacee('0x69')](db[_0xacee('0x6a')]['query'](_0x1c5f85[_0xacee('0x6b')](),{'type':db[_0xacee('0x6a')][_0xacee('0x6c')]['SELECT']})[_0xacee('0x15')](function(_0x2fe41d){if(_0x2fe41d[_0xacee('0x31')]===0x1){return _0x221682['id'];}else{var _0x969d70=_[_0xacee('0x6d')](_['map'](_0x2fe41d,_0xacee('0x6e')),function(_0x242598){return _[_0xacee('0x6f')](_0x2b9973,_0x242598);});if(_0x969d70){return _0x221682['id'];}}}));}}return BPromise[_0xacee('0x70')](_0x2f39b3)[_0xacee('0x15')](function(_0x2a9d6d){_0x34dfa2=_(_0x34dfa2)[_0xacee('0x71')](_0x2a9d6d)[_0xacee('0x72')]()[_0xacee('0x73')]();return db[_0xacee('0x1d')][_0xacee('0x35')]({'where':{'id':_0x339285['params']['id']}})[_0xacee('0x15')](function(_0x1c15eb){return db[_0xacee('0x6a')][_0xacee('0x59')](function(_0x5ab2ce){return _0x1c15eb[_0xacee('0x74')](_0x339285[_0xacee('0x25')][_0xacee('0x5e')],{'transaction':_0x5ab2ce})['then'](function(){if(!_['isEmpty'](_0x34dfa2)){return _0x1c15eb[_0xacee('0x75')](_0x34dfa2,{'transaction':_0x5ab2ce});}})['then'](function(){_0x34dfa2[_0xacee('0x5c')](function(_0x124a55){socket[_0xacee('0x5d')](_0xacee('0x76'),{'UserId':_0x124a55,'ChatQueueId':_0x1c15eb['id']});});});});});});})['then'](respondWithStatusCode(_0x1f15bd,null))[_0xacee('0x28')](handleError(_0x1f15bd,null));};exports[_0xacee('0x77')]=function(_0x289596,_0x42bd5a){return db[_0xacee('0x1d')][_0xacee('0x35')]({'where':{'id':_0x289596['params']['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x42bd5a,null))['then'](function(_0x30a68c){if(_0x30a68c){return _0x30a68c[_0xacee('0x77')](_0x289596['body']['ids'],_[_0xacee('0x78')](_0x289596[_0xacee('0x37')],[_0xacee('0x5e'),'id'])||{})[_0xacee('0x79')](function(_0x44913e){for(var _0x1e62b6=0x0;_0x1e62b6<_0x289596[_0xacee('0x37')][_0xacee('0x5e')]['length'];_0x1e62b6+=0x1){socket[_0xacee('0x5d')](_0xacee('0x7a'),{'UserId':Number(_0x289596[_0xacee('0x37')][_0xacee('0x5e')][_0x1e62b6]),'ChatQueueId':Number(_0x289596[_0xacee('0x2a')]['id'])});}return _0x44913e;});}})[_0xacee('0x15')](respondWithResult(_0x42bd5a,null))[_0xacee('0x28')](handleError(_0x42bd5a,null));};exports[_0xacee('0x75')]=function(_0x56aac0,_0xd90440){return db['ChatQueue']['find']({'where':{'id':_0x56aac0['params']['id']}})['then'](handleEntityNotFound(_0xd90440,null))[_0xacee('0x15')](function(_0x1c9194){if(_0x1c9194){return _0x1c9194['removeAgents'](_0x56aac0['query'][_0xacee('0x5e')])[_0xacee('0x15')](function(){if(_[_0xacee('0x7b')](_0x56aac0[_0xacee('0x25')][_0xacee('0x5e')])){for(var _0x1b59b8=0x0;_0x1b59b8<_0x56aac0[_0xacee('0x25')][_0xacee('0x5e')][_0xacee('0x31')];_0x1b59b8+=0x1){socket[_0xacee('0x5d')](_0xacee('0x76'),{'UserId':Number(_0x56aac0[_0xacee('0x25')][_0xacee('0x5e')][_0x1b59b8]),'ChatQueueId':Number(_0x56aac0[_0xacee('0x2a')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x56aac0[_0xacee('0x25')][_0xacee('0x5e')]),'ChatQueueId':Number(_0x56aac0[_0xacee('0x2a')]['id'])});}});}})[_0xacee('0x15')](respondWithStatusCode(_0xd90440,null))['catch'](handleError(_0xd90440,null));};exports[_0xacee('0x7c')]=function(_0x36e4c7,_0x5bc0b6){var _0x2f2997={};var _0x5c25f9={};var _0x172538;var _0x3ff528;return db[_0xacee('0x1d')][_0xacee('0x3f')]({'where':{'id':_0x36e4c7[_0xacee('0x2a')]['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x5bc0b6,null))[_0xacee('0x15')](function(_0x26b5c4){if(_0x26b5c4){_0x172538=_0x26b5c4;_0x5c25f9[_0xacee('0x2b')]=_[_0xacee('0x2c')](db[_0xacee('0x47')][_0xacee('0x1e')]);_0x5c25f9[_0xacee('0x25')]=_['keys'](_0x36e4c7[_0xacee('0x25')]);_0x5c25f9['filters']=_[_0xacee('0x2e')](_0x5c25f9[_0xacee('0x2b')],_0x5c25f9[_0xacee('0x25')]);_0x2f2997[_0xacee('0x2f')]=_[_0xacee('0x2e')](_0x5c25f9[_0xacee('0x2b')],qs['fields'](_0x36e4c7['query'][_0xacee('0x30')]));_0x2f2997['attributes']=_0x2f2997[_0xacee('0x2f')][_0xacee('0x31')]?_0x2f2997[_0xacee('0x2f')]:_0x5c25f9[_0xacee('0x2b')];_0x2f2997[_0xacee('0x53')]=qs[_0xacee('0x43')](_0x36e4c7[_0xacee('0x25')][_0xacee('0x43')]);_0x2f2997[_0xacee('0x23')]=qs[_0xacee('0x2d')](_[_0xacee('0x44')](_0x36e4c7['query'],_0x5c25f9[_0xacee('0x2d')]));if(_0x36e4c7['query']['filter']){_0x2f2997[_0xacee('0x23')]=_[_0xacee('0x33')](_0x2f2997[_0xacee('0x23')],{'$or':_[_0xacee('0x1c')](_0x2f2997[_0xacee('0x2f')],function(_0x4619dd){var _0x3f545f={};_0x3f545f[_0x4619dd]={'$like':'%'+_0x36e4c7[_0xacee('0x25')]['filter']+'%'};return _0x3f545f;})});}_0x2f2997=_[_0xacee('0x33')]({},_0x2f2997,_0x36e4c7['options']);return _0x172538[_0xacee('0x7c')](_0x2f2997);}})[_0xacee('0x15')](function(_0x1bf0cc){if(_0x1bf0cc){_0x3ff528=_0x1bf0cc[_0xacee('0x31')];if(!_0x36e4c7[_0xacee('0x25')][_0xacee('0x42')](_0xacee('0x54'))){_0x2f2997[_0xacee('0x11')]=qs[_0xacee('0x11')](_0x36e4c7[_0xacee('0x25')][_0xacee('0x11')]);_0x2f2997['offset']=qs[_0xacee('0x10')](_0x36e4c7[_0xacee('0x25')]['offset']);}return _0x172538[_0xacee('0x7c')](_0x2f2997);}})[_0xacee('0x15')](function(_0x14b81e){if(_0x14b81e){return _0x14b81e?{'count':_0x3ff528,'rows':_0x14b81e}:null;}})['then'](respondWithResult(_0x5bc0b6,null))['catch'](handleError(_0x5bc0b6,null));}; \ No newline at end of file +var _0x36db=['rawAttributes','type','where','include','catch','show','params','model','query','filters','intersection','attributes','fields','length','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','keys','nolimit','order','sort','pick','ChatQueueId','filter','findAll','User','agent','chatPause','rows','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','transaction','each','findOrCreate','emit','removeTeams','select','tq.TeamId','from','team_has_chat_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','includes','all','compact','value','isEmpty','removeAgents','forEach','omit','spread','isArray','userChatQueue:remove','getAgents','hasOwnProperty','bluebird','util','squel','ioredis','api','../../mysqldb','redis','defaults','localhost','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','UserProfileResource','name','send','index','map','ChatQueue'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x36db,0x19b));var _0xb36d=function(_0x36a469,_0x59d84c){_0x36a469=_0x36a469-0x0;var _0x3347fc=_0x36db[_0x36a469];return _0x3347fc;};'use strict';var BPromise=require(_0xb36d('0x0'));var util=require(_0xb36d('0x1'));var _=require('lodash');var squel=require(_0xb36d('0x2'));var Redis=require(_0xb36d('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xb36d('0x4'));var config=require('../../config/environment');var db=require(_0xb36d('0x5'))['db'];config[_0xb36d('0x6')]=_[_0xb36d('0x7')](config[_0xb36d('0x6')],{'host':_0xb36d('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb36d('0x6')]));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0x330050,_0x1a824e){_0x1a824e=_0x1a824e||0xcc;return function(_0x4a9182){if(_0x4a9182){return _0x330050[_0xb36d('0x9')](_0x1a824e);}return _0x330050['status'](_0x1a824e)[_0xb36d('0xa')]();};}function respondWithResult(_0x434cb6,_0x51ebf8){_0x51ebf8=_0x51ebf8||0xc8;return function(_0x30d78b){if(_0x30d78b){return _0x434cb6[_0xb36d('0xb')](_0x51ebf8)[_0xb36d('0xc')](_0x30d78b);}};}function respondWithFilteredResult(_0x54005a,_0x17ecad){return function(_0x2b490f){if(_0x2b490f){var _0x43f90b=typeof _0x17ecad[_0xb36d('0xd')]===_0xb36d('0xe')&&typeof _0x17ecad['limit']===_0xb36d('0xe');var _0x3ca4c2=_0x2b490f[_0xb36d('0xf')];var _0x15e393=_0x43f90b?0x0:_0x17ecad[_0xb36d('0xd')];var _0x29c2e9=_0x43f90b?_0x2b490f[_0xb36d('0xf')]:_0x17ecad[_0xb36d('0xd')]+_0x17ecad[_0xb36d('0x10')];var _0x1cd617;if(_0x29c2e9>=_0x3ca4c2){_0x29c2e9=_0x3ca4c2;_0x1cd617=0xc8;}else{_0x1cd617=0xce;}_0x54005a[_0xb36d('0xb')](_0x1cd617);return _0x54005a[_0xb36d('0x11')](_0xb36d('0x12'),_0x15e393+'-'+_0x29c2e9+'/'+_0x3ca4c2)[_0xb36d('0xc')](_0x2b490f);}return null;};}function saveUpdates(_0x4c80fa){return function(_0x15a35e){if(_0x15a35e){return _0x15a35e[_0xb36d('0x13')](_0x4c80fa)[_0xb36d('0x14')](function(_0x390703){return _0x390703;});}return null;};}function removeEntity(_0x27d310){return function(_0x1c1780){if(_0x1c1780){return _0x1c1780[_0xb36d('0x15')]()[_0xb36d('0x14')](function(){var _0x11be3b=_0x1c1780[_0xb36d('0x16')]({'plain':!![]});var _0x4d0c89='ChatQueues';return db[_0xb36d('0x17')]['destroy']({'where':{'type':_0x4d0c89,'resourceId':_0x11be3b['id']}})[_0xb36d('0x14')](function(){return _0x1c1780;});})['then'](function(){_0x27d310[_0xb36d('0xb')](0xcc)[_0xb36d('0xa')]();});}};}function handleEntityNotFound(_0x1a3dd1){return function(_0x22aa52){if(!_0x22aa52){_0x1a3dd1[_0xb36d('0x9')](0x194);}return _0x22aa52;};}function handleError(_0xb18f2a,_0x42d65b){_0x42d65b=_0x42d65b||0x1f4;return function(_0x2dac72){logger['error'](_0x2dac72['stack']);if(_0x2dac72['name']){delete _0x2dac72[_0xb36d('0x18')];}_0xb18f2a[_0xb36d('0xb')](_0x42d65b)[_0xb36d('0x19')](_0x2dac72);};}exports[_0xb36d('0x1a')]=function(_0x2f6646,_0x1fe8a8){var _0x954f5b={};var _0x318a9f={'count':0x0,'rows':[]};var _0x1516fa=_[_0xb36d('0x1b')](db[_0xb36d('0x1c')][_0xb36d('0x1d')],function(_0x5f0988){return{'name':_0x5f0988['fieldName'],'type':_0x5f0988[_0xb36d('0x1e')]['key']};});_0x954f5b=qs['getOptions'](_0x1516fa,_0x2f6646);var _0x21d6e2={'where':_0x954f5b[_0xb36d('0x1f')]};return db[_0xb36d('0x1c')][_0xb36d('0xf')](_0x21d6e2)[_0xb36d('0x14')](function(_0x41b1da){_0x318a9f[_0xb36d('0xf')]=_0x41b1da;_0x954f5b['include']=qs[_0xb36d('0x20')](_0x2f6646['query']);return db[_0xb36d('0x1c')]['findAll'](_0x954f5b);})[_0xb36d('0x14')](function(_0x4b41b3){_0x318a9f['rows']=_0x4b41b3;return _0x318a9f;})[_0xb36d('0x14')](respondWithFilteredResult(_0x1fe8a8,_0x954f5b))[_0xb36d('0x21')](handleError(_0x1fe8a8,null));};exports[_0xb36d('0x22')]=function(_0x889f83,_0x484c22){var _0x3c16b1={'raw':!![],'where':{'id':_0x889f83[_0xb36d('0x23')]['id']}},_0x4f634e={};_0x4f634e[_0xb36d('0x24')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x4f634e[_0xb36d('0x25')]=_['keys'](_0x889f83['query']);_0x4f634e[_0xb36d('0x26')]=_[_0xb36d('0x27')](_0x4f634e['model'],_0x4f634e[_0xb36d('0x25')]);_0x3c16b1[_0xb36d('0x28')]=_['intersection'](_0x4f634e[_0xb36d('0x24')],qs[_0xb36d('0x29')](_0x889f83[_0xb36d('0x25')][_0xb36d('0x29')]));_0x3c16b1['attributes']=_0x3c16b1[_0xb36d('0x28')][_0xb36d('0x2a')]?_0x3c16b1[_0xb36d('0x28')]:_0x4f634e[_0xb36d('0x24')];if(_0x889f83['query']['includeAll']){_0x3c16b1[_0xb36d('0x20')]=[{'all':!![]}];}_0x3c16b1=_[_0xb36d('0x2b')]({},_0x3c16b1,_0x889f83[_0xb36d('0x2c')]);return db['ChatQueue'][_0xb36d('0x2d')](_0x3c16b1)[_0xb36d('0x14')](handleEntityNotFound(_0x484c22,null))[_0xb36d('0x14')](respondWithResult(_0x484c22,null))[_0xb36d('0x21')](handleError(_0x484c22,null));};exports[_0xb36d('0x2e')]=function(_0x33ad6f,_0x1bc486){return db[_0xb36d('0x1c')][_0xb36d('0x2e')](_0x33ad6f[_0xb36d('0x2f')],{})[_0xb36d('0x14')](function(_0x55ab41){var _0x2c836e=_0x33ad6f['user']['get']({'plain':!![]});if(!_0x2c836e)throw new Error(_0xb36d('0x30'));if(_0x2c836e['role']===_0xb36d('0x31')){var _0x2edad5=_0x55ab41[_0xb36d('0x16')]({'plain':!![]});var _0x245347='ChatQueues';return db['UserProfileSection'][_0xb36d('0x2d')]({'where':{'name':_0x245347,'userProfileId':_0x2c836e[_0xb36d('0x32')]},'raw':!![]})[_0xb36d('0x14')](function(_0x3d0187){if(_0x3d0187&&_0x3d0187[_0xb36d('0x33')]===0x0){return db[_0xb36d('0x17')]['create']({'name':_0x2edad5[_0xb36d('0x18')],'resourceId':_0x2edad5['id'],'type':_0x3d0187[_0xb36d('0x18')],'sectionId':_0x3d0187['id']},{})[_0xb36d('0x14')](function(){return _0x55ab41;});}else{return _0x55ab41;}})[_0xb36d('0x21')](function(_0x2b591e){logger[_0xb36d('0x34')](_0xb36d('0x35'),_0x2b591e);throw _0x2b591e;});}return _0x55ab41;})[_0xb36d('0x14')](respondWithResult(_0x1bc486,0xc9))[_0xb36d('0x21')](handleError(_0x1bc486,null));};exports[_0xb36d('0x13')]=function(_0x1ea227,_0x3e93a5){if(_0x1ea227[_0xb36d('0x2f')]['id']){delete _0x1ea227[_0xb36d('0x2f')]['id'];}return db[_0xb36d('0x1c')][_0xb36d('0x2d')]({'where':{'id':_0x1ea227[_0xb36d('0x23')]['id']}})['then'](handleEntityNotFound(_0x3e93a5,null))[_0xb36d('0x14')](saveUpdates(_0x1ea227['body'],null))[_0xb36d('0x14')](respondWithResult(_0x3e93a5,null))[_0xb36d('0x21')](handleError(_0x3e93a5,null));};exports['destroy']=function(_0x40c215,_0x2e5986){return db[_0xb36d('0x1c')]['find']({'where':{'id':_0x40c215[_0xb36d('0x23')]['id']}})[_0xb36d('0x14')](handleEntityNotFound(_0x2e5986,null))[_0xb36d('0x14')](removeEntity(_0x2e5986,null))[_0xb36d('0x21')](handleError(_0x2e5986,null));};exports[_0xb36d('0x36')]=function(_0x489387,_0x1e0248){return db[_0xb36d('0x1c')]['describe']()[_0xb36d('0x14')](respondWithResult(_0x1e0248,null))[_0xb36d('0x21')](handleError(_0x1e0248,null));};exports['getMembers']=function(_0x237182,_0x33cee9){var _0x2e4222={'raw':!![],'where':{}},_0x69bcad={},_0x4333f9;return db['ChatQueue'][_0xb36d('0x37')]({'where':{'id':_0x237182[_0xb36d('0x23')]['id']}})['then'](handleEntityNotFound(_0x33cee9,null))[_0xb36d('0x14')](function(_0x19c4e9){if(_0x19c4e9){_0x4333f9=_0x19c4e9[_0xb36d('0x16')]({'plain':!![]});_0x69bcad['model']=_['keys'](db[_0xb36d('0x38')][_0xb36d('0x1d')]);_0x69bcad[_0xb36d('0x25')]=_[_0xb36d('0x39')](_0x237182['query']);_0x69bcad[_0xb36d('0x26')]=_[_0xb36d('0x27')](_0x69bcad[_0xb36d('0x24')],_0x69bcad[_0xb36d('0x25')]);_0x2e4222[_0xb36d('0x28')]=_['intersection'](_0x69bcad[_0xb36d('0x24')],qs[_0xb36d('0x29')](_0x237182[_0xb36d('0x25')][_0xb36d('0x29')]));_0x2e4222[_0xb36d('0x28')]=_0x2e4222[_0xb36d('0x28')][_0xb36d('0x2a')]?_0x2e4222['attributes']:_0x69bcad[_0xb36d('0x24')];if(!_0x237182[_0xb36d('0x25')]['hasOwnProperty'](_0xb36d('0x3a'))){_0x2e4222[_0xb36d('0x10')]=qs['limit'](_0x237182[_0xb36d('0x25')]['limit']);_0x2e4222[_0xb36d('0xd')]=qs['offset'](_0x237182[_0xb36d('0x25')][_0xb36d('0xd')]);}_0x2e4222[_0xb36d('0x3b')]=qs['sort'](_0x237182[_0xb36d('0x25')][_0xb36d('0x3c')]);_0x2e4222[_0xb36d('0x1f')]=qs[_0xb36d('0x26')](_[_0xb36d('0x3d')](_0x237182[_0xb36d('0x25')],_0x69bcad[_0xb36d('0x26')]));_0x2e4222[_0xb36d('0x1f')][_0xb36d('0x3e')]=_0x19c4e9['id'];if(_0x237182[_0xb36d('0x25')]['filter']){_0x2e4222[_0xb36d('0x1f')]=_[_0xb36d('0x2b')](_0x2e4222[_0xb36d('0x1f')],{'$or':_[_0xb36d('0x1b')](_0x2e4222[_0xb36d('0x28')],function(_0x20f2d9){var _0x1d3ab2={};_0x1d3ab2[_0x20f2d9]={'$like':'%'+_0x237182[_0xb36d('0x25')][_0xb36d('0x3f')]+'%'};return _0x1d3ab2;})});}_0x2e4222=_[_0xb36d('0x2b')]({},_0x2e4222,_0x237182[_0xb36d('0x2c')]);return db['UserChatQueue'][_0xb36d('0x40')](_0x2e4222);}})[_0xb36d('0x14')](function(_0x4f227f){if(_0x4f227f){return db[_0xb36d('0x41')]['findAndCountAll']({'where':{'id':_['map'](_0x4f227f,'UserId'),'role':_0xb36d('0x42')},'attributes':['id',_0xb36d('0x18'),_0xb36d('0x43'),'updatedAt','createdAt']});}})[_0xb36d('0x14')](function(_0x23494f){if(_0x23494f){return{'count':_0x23494f[_0xb36d('0xf')],'rows':_[_0xb36d('0x1b')](_0x23494f[_0xb36d('0x44')],function(_0x389974){return{'membername':_0x389974[_0xb36d('0x18')],'UserId':_0x389974['id'],'queue_name':_0x4333f9[_0xb36d('0x18')],'ChatQueueId':_0x4333f9['id'],'interface':util['format'](_0xb36d('0x45'),_0xb36d('0x46'),_0x389974[_0xb36d('0x18')]),'penalty':0x0,'paused':_0x389974[_0xb36d('0x43')],'createdAt':_0x389974[_0xb36d('0x47')],'updatedAt':_0x389974[_0xb36d('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb36d('0x14')](respondWithFilteredResult(_0x33cee9,_0x2e4222))[_0xb36d('0x21')](handleError(_0x33cee9,null));};exports[_0xb36d('0x49')]=function(_0x33dafc,_0x5dfca2){var _0x1d02c7={};var _0xdd640={};var _0x25599f;var _0x3329e2;return db['ChatQueue'][_0xb36d('0x37')]({'where':{'id':_0x33dafc[_0xb36d('0x23')]['id']}})[_0xb36d('0x14')](handleEntityNotFound(_0x5dfca2,null))[_0xb36d('0x14')](function(_0x5866a6){if(_0x5866a6){_0x25599f=_0x5866a6;_0xdd640[_0xb36d('0x24')]=_['keys'](db[_0xb36d('0x4a')]['rawAttributes']);_0xdd640[_0xb36d('0x25')]=_[_0xb36d('0x39')](_0x33dafc[_0xb36d('0x25')]);_0xdd640[_0xb36d('0x26')]=_[_0xb36d('0x27')](_0xdd640[_0xb36d('0x24')],_0xdd640[_0xb36d('0x25')]);_0x1d02c7[_0xb36d('0x28')]=_[_0xb36d('0x27')](_0xdd640[_0xb36d('0x24')],qs[_0xb36d('0x29')](_0x33dafc[_0xb36d('0x25')][_0xb36d('0x29')]));_0x1d02c7[_0xb36d('0x28')]=_0x1d02c7[_0xb36d('0x28')]['length']?_0x1d02c7[_0xb36d('0x28')]:_0xdd640[_0xb36d('0x24')];_0x1d02c7[_0xb36d('0x3b')]=qs['sort'](_0x33dafc[_0xb36d('0x25')][_0xb36d('0x3c')]);_0x1d02c7[_0xb36d('0x1f')]=qs[_0xb36d('0x26')](_[_0xb36d('0x3d')](_0x33dafc[_0xb36d('0x25')],_0xdd640['filters']));if(_0x33dafc['query'][_0xb36d('0x3f')]){_0x1d02c7[_0xb36d('0x1f')]=_['merge'](_0x1d02c7['where'],{'$or':_[_0xb36d('0x1b')](_0x1d02c7[_0xb36d('0x28')],function(_0x1250b4){var _0x5d758d={};_0x5d758d[_0x1250b4]={'$like':'%'+_0x33dafc['query']['filter']+'%'};return _0x5d758d;})});}_0x1d02c7=_[_0xb36d('0x2b')]({},_0x1d02c7,_0x33dafc[_0xb36d('0x2c')]);return _0x25599f['getTeams'](_0x1d02c7);}})[_0xb36d('0x14')](function(_0x20db27){if(_0x20db27){_0x3329e2=_0x20db27['length'];if(!_0x33dafc[_0xb36d('0x25')]['hasOwnProperty'](_0xb36d('0x3a'))){_0x1d02c7[_0xb36d('0x10')]=qs[_0xb36d('0x10')](_0x33dafc[_0xb36d('0x25')][_0xb36d('0x10')]);_0x1d02c7[_0xb36d('0xd')]=qs[_0xb36d('0xd')](_0x33dafc['query'][_0xb36d('0xd')]);}return _0x25599f[_0xb36d('0x49')](_0x1d02c7);}})['then'](function(_0x2c0dc0){if(_0x2c0dc0){return _0x2c0dc0?{'count':_0x3329e2,'rows':_0x2c0dc0}:null;}})['then'](respondWithResult(_0x5dfca2,null))[_0xb36d('0x21')](handleError(_0x5dfca2,null));};exports[_0xb36d('0x4b')]=function(_0xdedc54,_0x35d2f5){var _0x44b472=_0xdedc54[_0xb36d('0x2f')][_0xb36d('0x4c')];return db['Team'][_0xb36d('0x40')]({'where':{'id':_0x44b472},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb36d('0x4d'),'attributes':['id',_0xb36d('0x18'),_0xb36d('0x4e'),'voicePause',_0xb36d('0x4f')],'raw':!![]}]})['then'](function(_0x137811){if(_0x137811){var _0x385569=_[_0xb36d('0x50')](_0x137811,function(_0x5be958){var _0x5ae06b=_0x5be958[_0xb36d('0x16')]({'plain':!![]});return _0x5ae06b['Agents'];});return db[_0xb36d('0x1c')][_0xb36d('0x2d')]({'where':{'id':_0xdedc54['params']['id']}})[_0xb36d('0x14')](function(_0x1d08ec){return db['sequelize'][_0xb36d('0x51')](function(_0x3dd4da){return _0x1d08ec['addTeams'](_0x44b472,{'transaction':_0x3dd4da})[_0xb36d('0x14')](function(){return BPromise[_0xb36d('0x52')](_0x385569,function(_0x5bc4d2){return db['UserChatQueue'][_0xb36d('0x53')]({'where':{'UserId':_0x5bc4d2['id'],'ChatQueueId':_0xdedc54['params']['id']},'transaction':_0x3dd4da});});})['then'](function(){_0x385569['forEach'](function(_0xb2a149){socket[_0xb36d('0x54')]('userChatQueue:save',{'UserId':_0xb2a149['id'],'ChatQueueId':_0x1d08ec['id']});});});});});}})['then'](respondWithStatusCode(_0x35d2f5,null))[_0xb36d('0x21')](handleError(_0x35d2f5,null));};exports[_0xb36d('0x55')]=function(_0x2c1404,_0x49aa68){return db[_0xb36d('0x4a')][_0xb36d('0x40')]({'where':{'id':_0x2c1404[_0xb36d('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb36d('0x41')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb36d('0x14')](handleEntityNotFound(_0x49aa68,null))[_0xb36d('0x14')](function(_0xcf202e){var _0xd7b56=_[_0xb36d('0x1b')](_0xcf202e,'id');var _0x1ba7ac=[];var _0x5da68a=[];var _0x59c2ce=squel[_0xb36d('0x56')]();_0x59c2ce['field'](_0xb36d('0x57'))[_0xb36d('0x58')](_0xb36d('0x59'),'tq')['join'](_0xb36d('0x5a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb36d('0x1f')]('ChatQueueId\x20=\x20?',_0x2c1404[_0xb36d('0x23')]['id']);for(var _0x2e7ef4=0x0;_0x2e7ef4<_0xcf202e[_0xb36d('0x2a')];_0x2e7ef4+=0x1){let _0x28e847=_0xcf202e[_0x2e7ef4];for(var _0xe4a530=0x0;_0xe4a530<_0x28e847['Agents'][_0xb36d('0x2a')];_0xe4a530+=0x1){let _0x1899c6=_0x28e847[_0xb36d('0x4d')][_0xe4a530];var _0x5eb1a7=_0x59c2ce[_0xb36d('0x5b')]();_0x5eb1a7[_0xb36d('0x1f')](_0xb36d('0x5c'),_0x1899c6['id']);_0x5da68a[_0xb36d('0x5d')](db['sequelize'][_0xb36d('0x25')](_0x5eb1a7[_0xb36d('0x5e')](),{'type':db[_0xb36d('0x5f')][_0xb36d('0x60')]['SELECT']})[_0xb36d('0x14')](function(_0x262dd2){if(_0x262dd2[_0xb36d('0x2a')]===0x1){return _0x1899c6['id'];}else{var _0x5b85c6=_['every'](_['map'](_0x262dd2,'TeamId'),function(_0x4187d8){return _[_0xb36d('0x61')](_0xd7b56,_0x4187d8);});if(_0x5b85c6){return _0x1899c6['id'];}}}));}}return BPromise[_0xb36d('0x62')](_0x5da68a)[_0xb36d('0x14')](function(_0x34d6ec){_0x1ba7ac=_(_0x1ba7ac)['union'](_0x34d6ec)[_0xb36d('0x63')]()[_0xb36d('0x64')]();return db[_0xb36d('0x1c')][_0xb36d('0x2d')]({'where':{'id':_0x2c1404[_0xb36d('0x23')]['id']}})[_0xb36d('0x14')](function(_0x35fb69){return db[_0xb36d('0x5f')][_0xb36d('0x51')](function(_0x3b722d){return _0x35fb69[_0xb36d('0x55')](_0x2c1404[_0xb36d('0x25')]['ids'],{'transaction':_0x3b722d})[_0xb36d('0x14')](function(){if(!_[_0xb36d('0x65')](_0x1ba7ac)){return _0x35fb69[_0xb36d('0x66')](_0x1ba7ac,{'transaction':_0x3b722d});}})[_0xb36d('0x14')](function(){_0x1ba7ac[_0xb36d('0x67')](function(_0xe6ae79){socket[_0xb36d('0x54')]('userChatQueue:remove',{'UserId':_0xe6ae79,'ChatQueueId':_0x35fb69['id']});});});});});});})[_0xb36d('0x14')](respondWithStatusCode(_0x49aa68,null))['catch'](handleError(_0x49aa68,null));};exports['addAgents']=function(_0x2455ff,_0x14e58f){return db['ChatQueue'][_0xb36d('0x2d')]({'where':{'id':_0x2455ff[_0xb36d('0x23')]['id']}})[_0xb36d('0x14')](handleEntityNotFound(_0x14e58f,null))['then'](function(_0x567bf9){if(_0x567bf9){return _0x567bf9['addAgents'](_0x2455ff[_0xb36d('0x2f')][_0xb36d('0x4c')],_[_0xb36d('0x68')](_0x2455ff['body'],['ids','id'])||{})[_0xb36d('0x69')](function(_0x1b9e34){for(var _0x2d0f08=0x0;_0x2d0f08<_0x2455ff['body'][_0xb36d('0x4c')][_0xb36d('0x2a')];_0x2d0f08+=0x1){socket[_0xb36d('0x54')]('userChatQueue:save',{'UserId':Number(_0x2455ff['body'][_0xb36d('0x4c')][_0x2d0f08]),'ChatQueueId':Number(_0x2455ff[_0xb36d('0x23')]['id'])});}return _0x1b9e34;});}})['then'](respondWithResult(_0x14e58f,null))[_0xb36d('0x21')](handleError(_0x14e58f,null));};exports['removeAgents']=function(_0x4f44d1,_0x3f5b81){return db[_0xb36d('0x1c')]['find']({'where':{'id':_0x4f44d1[_0xb36d('0x23')]['id']}})['then'](handleEntityNotFound(_0x3f5b81,null))[_0xb36d('0x14')](function(_0x80fea4){if(_0x80fea4){return _0x80fea4[_0xb36d('0x66')](_0x4f44d1['query'][_0xb36d('0x4c')])[_0xb36d('0x14')](function(){if(_[_0xb36d('0x6a')](_0x4f44d1[_0xb36d('0x25')][_0xb36d('0x4c')])){for(var _0x41aedf=0x0;_0x41aedf<_0x4f44d1['query'][_0xb36d('0x4c')][_0xb36d('0x2a')];_0x41aedf+=0x1){socket['emit'](_0xb36d('0x6b'),{'UserId':Number(_0x4f44d1[_0xb36d('0x25')]['ids'][_0x41aedf]),'ChatQueueId':Number(_0x4f44d1['params']['id'])});}}else{socket[_0xb36d('0x54')](_0xb36d('0x6b'),{'UserId':Number(_0x4f44d1[_0xb36d('0x25')]['ids']),'ChatQueueId':Number(_0x4f44d1[_0xb36d('0x23')]['id'])});}});}})[_0xb36d('0x14')](respondWithStatusCode(_0x3f5b81,null))[_0xb36d('0x21')](handleError(_0x3f5b81,null));};exports[_0xb36d('0x6c')]=function(_0x413707,_0x2b02cf){var _0x8da210={};var _0x255198={};var _0x2b42e0;var _0x252922;return db[_0xb36d('0x1c')][_0xb36d('0x37')]({'where':{'id':_0x413707[_0xb36d('0x23')]['id']}})[_0xb36d('0x14')](handleEntityNotFound(_0x2b02cf,null))['then'](function(_0x5b7c4d){if(_0x5b7c4d){_0x2b42e0=_0x5b7c4d;_0x255198[_0xb36d('0x24')]=_[_0xb36d('0x39')](db[_0xb36d('0x41')]['rawAttributes']);_0x255198['query']=_[_0xb36d('0x39')](_0x413707[_0xb36d('0x25')]);_0x255198[_0xb36d('0x26')]=_[_0xb36d('0x27')](_0x255198['model'],_0x255198[_0xb36d('0x25')]);_0x8da210['attributes']=_['intersection'](_0x255198['model'],qs[_0xb36d('0x29')](_0x413707['query'][_0xb36d('0x29')]));_0x8da210['attributes']=_0x8da210[_0xb36d('0x28')][_0xb36d('0x2a')]?_0x8da210[_0xb36d('0x28')]:_0x255198['model'];_0x8da210[_0xb36d('0x3b')]=qs[_0xb36d('0x3c')](_0x413707[_0xb36d('0x25')]['sort']);_0x8da210['where']=qs[_0xb36d('0x26')](_[_0xb36d('0x3d')](_0x413707[_0xb36d('0x25')],_0x255198[_0xb36d('0x26')]));if(_0x413707['query'][_0xb36d('0x3f')]){_0x8da210['where']=_[_0xb36d('0x2b')](_0x8da210['where'],{'$or':_[_0xb36d('0x1b')](_0x8da210['attributes'],function(_0x1e452e){var _0x101fd7={};_0x101fd7[_0x1e452e]={'$like':'%'+_0x413707[_0xb36d('0x25')][_0xb36d('0x3f')]+'%'};return _0x101fd7;})});}_0x8da210=_['merge']({},_0x8da210,_0x413707[_0xb36d('0x2c')]);return _0x2b42e0[_0xb36d('0x6c')](_0x8da210);}})['then'](function(_0x392b63){if(_0x392b63){_0x252922=_0x392b63[_0xb36d('0x2a')];if(!_0x413707[_0xb36d('0x25')][_0xb36d('0x6d')](_0xb36d('0x3a'))){_0x8da210[_0xb36d('0x10')]=qs[_0xb36d('0x10')](_0x413707[_0xb36d('0x25')][_0xb36d('0x10')]);_0x8da210[_0xb36d('0xd')]=qs[_0xb36d('0xd')](_0x413707[_0xb36d('0x25')]['offset']);}return _0x2b42e0[_0xb36d('0x6c')](_0x8da210);}})['then'](function(_0x313a21){if(_0x313a21){return _0x313a21?{'count':_0x252922,'rows':_0x313a21}:null;}})[_0xb36d('0x14')](respondWithResult(_0x2b02cf,null))[_0xb36d('0x21')](handleError(_0x2b02cf,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d9fad18..9b830bd 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 _0x79e3=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x5afbd5,_0x48a693){var _0x298511=function(_0x2f4262){while(--_0x2f4262){_0x5afbd5['push'](_0x5afbd5['shift']());}};_0x298511(++_0x48a693);}(_0x79e3,0x77));var _0x379e=function(_0x1fa3d4,_0x39e1a5){_0x1fa3d4=_0x1fa3d4-0x0;var _0x1bf27c=_0x79e3[_0x1fa3d4];return _0x1bf27c;};'use strict';var EventEmitter=require(_0x379e('0x0'));var ChatQueue=require(_0x379e('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x379e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x379e('0x3'),'afterDestroy':_0x379e('0x4')};function emitEvent(_0x2e6d6b){return function(_0x234aa2,_0x2d61cd,_0x5bd2c6){ChatQueueEvents[_0x379e('0x5')](_0x2e6d6b+':'+_0x234aa2['id'],_0x234aa2);ChatQueueEvents[_0x379e('0x5')](_0x2e6d6b,_0x234aa2);_0x5bd2c6(null);};}for(var e in events){if(events[_0x379e('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xe2b4=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x556c52,_0x465925){var _0x3cfb76=function(_0x2f26f8){while(--_0x2f26f8){_0x556c52['push'](_0x556c52['shift']());}};_0x3cfb76(++_0x465925);}(_0xe2b4,0x18f));var _0x4e2b=function(_0x42cb1d,_0x22fc5b){_0x42cb1d=_0x42cb1d-0x0;var _0xf5ecc=_0xe2b4[_0x42cb1d];return _0xf5ecc;};'use strict';var EventEmitter=require(_0x4e2b('0x0'));var ChatQueue=require(_0x4e2b('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4e2b('0x2')](0x0);var events={'afterCreate':_0x4e2b('0x3'),'afterUpdate':_0x4e2b('0x4'),'afterDestroy':_0x4e2b('0x5')};function emitEvent(_0x57efee){return function(_0x52371c,_0x7b72cf,_0x1c7077){ChatQueueEvents[_0x4e2b('0x6')](_0x57efee+':'+_0x52371c['id'],_0x52371c);ChatQueueEvents[_0x4e2b('0x6')](_0x57efee,_0x52371c);_0x1c7077(null);};}for(var e in events){if(events[_0x4e2b('0x7')](e)){var event=events[e];ChatQueue[_0x4e2b('0x8')](e,emitEvent(event));}}module[_0x4e2b('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index e1a89a3..ed44a8f 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 _0x5457=['request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue','api','bluebird'];(function(_0x408110,_0x29c63a){var _0x272714=function(_0x2637ae){while(--_0x2637ae){_0x408110['push'](_0x408110['shift']());}};_0x272714(++_0x29c63a);}(_0x5457,0xb2));var _0x7545=function(_0x5c01d3,_0x1cc626){_0x5c01d3=_0x5c01d3-0x0;var _0x546b80=_0x5457[_0x5c01d3];return _0x546b80;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7545('0x0'));var moment=require('moment');var BPromise=require(_0x7545('0x1'));var rp=require(_0x7545('0x2'));var fs=require('fs');var path=require(_0x7545('0x3'));var rimraf=require(_0x7545('0x4'));var config=require(_0x7545('0x5'));var attributes=require('./chatQueue.attributes');module[_0x7545('0x6')]=function(_0x57f623,_0x5e3e8c){return _0x57f623[_0x7545('0x7')](_0x7545('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe20d=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x1e39ba,_0x5946cf){var _0x4dfe65=function(_0x1acadd){while(--_0x1acadd){_0x1e39ba['push'](_0x1e39ba['shift']());}};_0x4dfe65(++_0x5946cf);}(_0xe20d,0x11f));var _0xde20=function(_0x2b5584,_0x2c1bab){_0x2b5584=_0x2b5584-0x0;var _0x3f8885=_0xe20d[_0x2b5584];return _0x3f8885;};'use strict';var _=require(_0xde20('0x0'));var util=require(_0xde20('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde20('0x2'));var BPromise=require(_0xde20('0x3'));var rp=require(_0xde20('0x4'));var fs=require('fs');var path=require(_0xde20('0x5'));var rimraf=require(_0xde20('0x6'));var config=require(_0xde20('0x7'));var attributes=require('./chatQueue.attributes');module[_0xde20('0x8')]=function(_0x2681f8,_0x1568e1){return _0x2681f8[_0xde20('0x9')](_0xde20('0xa'),attributes,{'tableName':_0xde20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index e29176f..8ae5e86 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 _0x3c8b=['socket.io-emitter','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','options','where','limit','include','map','model','attributes','debug','ShowChatQueue','find','raw','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x5a408b,_0x242bea){_0x5a408b=_0x5a408b-0x0;var _0x2d9caf=_0x3c8b[_0x5a408b];return _0x2d9caf;};'use strict';var _=require('lodash');var util=require(_0xb3c8('0x0'));var moment=require('moment');var BPromise=require(_0xb3c8('0x1'));var rs=require(_0xb3c8('0x2'));var fs=require('fs');var Redis=require(_0xb3c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3c8('0x4'));var logger=require(_0xb3c8('0x5'))(_0xb3c8('0x6'));var config=require(_0xb3c8('0x7'));var jayson=require(_0xb3c8('0x8'));var client=jayson[_0xb3c8('0x9')][_0xb3c8('0xa')]({'port':0x232a});config[_0xb3c8('0xb')]=_['defaults'](config[_0xb3c8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb3c8('0xc'))(new Redis(config[_0xb3c8('0xb')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4790d0,_0x3cea69,_0x363230){return new BPromise(function(_0xdf4041,_0x508b1f){return client[_0xb3c8('0xd')](_0x4790d0,_0x363230)[_0xb3c8('0xe')](function(_0x21eac8){logger[_0xb3c8('0xf')]('ChatQueue,\x20%s,\x20%s',_0x3cea69,_0xb3c8('0x10'));logger['debug'](_0xb3c8('0x11'),_0x3cea69,'request\x20sent',JSON[_0xb3c8('0x12')](_0x21eac8));if(_0x21eac8[_0xb3c8('0x13')]){if(_0x21eac8[_0xb3c8('0x13')]['code']===0x1f4){logger['error'](_0xb3c8('0x14'),_0x3cea69,_0x21eac8[_0xb3c8('0x13')][_0xb3c8('0x15')]);return _0x508b1f(_0x21eac8['error']['message']);}logger[_0xb3c8('0x13')](_0xb3c8('0x14'),_0x3cea69,_0x21eac8[_0xb3c8('0x13')]['message']);return _0xdf4041(_0x21eac8[_0xb3c8('0x13')][_0xb3c8('0x15')]);}else{logger[_0xb3c8('0xf')](_0xb3c8('0x14'),_0x3cea69,_0xb3c8('0x10'));_0xdf4041(_0x21eac8[_0xb3c8('0x16')][_0xb3c8('0x15')]);}})[_0xb3c8('0x17')](function(_0x168555){logger['error']('ChatQueue,\x20%s,\x20%s',_0x3cea69,_0x168555);_0x508b1f(_0x168555);});});}exports[_0xb3c8('0x18')]=function(_0x5390cc){var _0x4d4bda=this;return new Promise(function(_0x433549,_0x4df53e){return db[_0xb3c8('0x19')]['findAll']({'raw':_0x5390cc['options']?_0x5390cc[_0xb3c8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5390cc[_0xb3c8('0x1a')]?_0x5390cc[_0xb3c8('0x1a')][_0xb3c8('0x1b')]||null:null,'attributes':_0x5390cc['options']?_0x5390cc[_0xb3c8('0x1a')]['attributes']||null:null,'limit':_0x5390cc[_0xb3c8('0x1a')]?_0x5390cc[_0xb3c8('0x1a')][_0xb3c8('0x1c')]||null:null,'include':_0x5390cc[_0xb3c8('0x1a')]?_0x5390cc[_0xb3c8('0x1a')][_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x5390cc[_0xb3c8('0x1a')][_0xb3c8('0x1d')],function(_0x557be7){return{'model':db[_0x557be7[_0xb3c8('0x1f')]],'as':_0x557be7['as'],'attributes':_0x557be7['attributes'],'include':_0x557be7[_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x557be7[_0xb3c8('0x1d')],function(_0x1d0b73){return{'model':db[_0x1d0b73['model']],'as':_0x1d0b73['as'],'attributes':_0x1d0b73[_0xb3c8('0x20')],'include':_0x1d0b73[_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x1d0b73[_0xb3c8('0x1d')],function(_0x275312){return{'model':db[_0x275312[_0xb3c8('0x1f')]],'as':_0x275312['as'],'attributes':_0x275312[_0xb3c8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35bd6d){logger[_0xb3c8('0xf')]('GetChatQueue',_0x5390cc);logger[_0xb3c8('0x21')](_0xb3c8('0x18'),_0x5390cc,JSON[_0xb3c8('0x12')](_0x35bd6d));_0x433549(_0x35bd6d);})[_0xb3c8('0x17')](function(_0x27e928){logger[_0xb3c8('0x13')](_0xb3c8('0x18'),_0x27e928['message'],_0x5390cc);_0x4df53e(_0x4d4bda[_0xb3c8('0x13')](0x1f4,_0x27e928[_0xb3c8('0x15')]));});});};exports[_0xb3c8('0x22')]=function(_0x320e3f){var _0x4511cf=this;return new Promise(function(_0x557745,_0x2369e5){return db[_0xb3c8('0x19')][_0xb3c8('0x23')]({'raw':_0x320e3f[_0xb3c8('0x1a')]?_0x320e3f[_0xb3c8('0x1a')][_0xb3c8('0x24')]===undefined?!![]:![]:!![],'where':_0x320e3f[_0xb3c8('0x1a')]?_0x320e3f[_0xb3c8('0x1a')][_0xb3c8('0x1b')]||null:null,'attributes':_0x320e3f['options']?_0x320e3f[_0xb3c8('0x1a')]['attributes']||null:null,'include':_0x320e3f[_0xb3c8('0x1a')]?_0x320e3f[_0xb3c8('0x1a')][_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x320e3f[_0xb3c8('0x1a')][_0xb3c8('0x1d')],function(_0x550ab8){return{'model':db[_0x550ab8[_0xb3c8('0x1f')]],'as':_0x550ab8['as'],'attributes':_0x550ab8['attributes'],'include':_0x550ab8[_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x550ab8[_0xb3c8('0x1d')],function(_0xc6554d){return{'model':db[_0xc6554d['model']],'as':_0xc6554d['as'],'attributes':_0xc6554d[_0xb3c8('0x20')],'include':_0xc6554d[_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0xc6554d[_0xb3c8('0x1d')],function(_0x3ee715){return{'model':db[_0x3ee715[_0xb3c8('0x1f')]],'as':_0x3ee715['as'],'attributes':_0x3ee715['attributes']};}):[]};}):[]};}):[]:[]})[_0xb3c8('0xe')](function(_0x287521){logger[_0xb3c8('0xf')](_0xb3c8('0x22'),_0x320e3f);logger[_0xb3c8('0x21')]('ShowChatQueue',_0x320e3f,JSON['stringify'](_0x287521));_0x557745(_0x287521);})[_0xb3c8('0x17')](function(_0x1ecefb){logger[_0xb3c8('0x13')]('ShowChatQueue',_0x1ecefb[_0xb3c8('0x15')],_0x320e3f);_0x2369e5(_0x4511cf['error'](0x1f4,_0x1ecefb[_0xb3c8('0x15')]));});});}; \ No newline at end of file +var _0xe1aa=['then','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','raw','attributes','limit','include','model','map','ShowChatQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','./chatQueue.socket','request'];(function(_0x4c4634,_0x43d778){var _0x1a44a9=function(_0x428abb){while(--_0x428abb){_0x4c4634['push'](_0x4c4634['shift']());}};_0x1a44a9(++_0x43d778);}(_0xe1aa,0xfc));var _0xae1a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe1aa[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xae1a('0x0'));var util=require(_0xae1a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xae1a('0x2'));var fs=require('fs');var Redis=require(_0xae1a('0x3'));var db=require(_0xae1a('0x4'))['db'];var utils=require(_0xae1a('0x5'));var logger=require(_0xae1a('0x6'))('rpc');var config=require(_0xae1a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xae1a('0x8')][_0xae1a('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xae1a('0xa')],{'host':_0xae1a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae1a('0xa')]));require(_0xae1a('0xc'))['register'](socket);function respondWithRpcPromise(_0x22bb87,_0x31abc0,_0x39efce){return new BPromise(function(_0xcd51ac,_0x4a648b){return client[_0xae1a('0xd')](_0x22bb87,_0x39efce)[_0xae1a('0xe')](function(_0x54722b){logger[_0xae1a('0xf')](_0xae1a('0x10'),_0x31abc0,_0xae1a('0x11'));logger[_0xae1a('0x12')](_0xae1a('0x13'),_0x31abc0,_0xae1a('0x11'),JSON[_0xae1a('0x14')](_0x54722b));if(_0x54722b[_0xae1a('0x15')]){if(_0x54722b[_0xae1a('0x15')][_0xae1a('0x16')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x31abc0,_0x54722b['error']['message']);return _0x4a648b(_0x54722b[_0xae1a('0x15')][_0xae1a('0x17')]);}logger[_0xae1a('0x15')](_0xae1a('0x10'),_0x31abc0,_0x54722b[_0xae1a('0x15')]['message']);return _0xcd51ac(_0x54722b[_0xae1a('0x15')][_0xae1a('0x17')]);}else{logger['info'](_0xae1a('0x10'),_0x31abc0,_0xae1a('0x11'));_0xcd51ac(_0x54722b[_0xae1a('0x18')][_0xae1a('0x17')]);}})[_0xae1a('0x19')](function(_0x28ad91){logger[_0xae1a('0x15')](_0xae1a('0x10'),_0x31abc0,_0x28ad91);_0x4a648b(_0x28ad91);});});}exports[_0xae1a('0x1a')]=function(_0xd7bb55){var _0x49a8af=this;return new Promise(function(_0x2493d5,_0x112604){return db[_0xae1a('0x1b')][_0xae1a('0x1c')]({'raw':_0xd7bb55[_0xae1a('0x1d')]?_0xd7bb55['options'][_0xae1a('0x1e')]===undefined?!![]:![]:!![],'where':_0xd7bb55[_0xae1a('0x1d')]?_0xd7bb55[_0xae1a('0x1d')]['where']||null:null,'attributes':_0xd7bb55[_0xae1a('0x1d')]?_0xd7bb55[_0xae1a('0x1d')][_0xae1a('0x1f')]||null:null,'limit':_0xd7bb55[_0xae1a('0x1d')]?_0xd7bb55[_0xae1a('0x1d')][_0xae1a('0x20')]||null:null,'include':_0xd7bb55['options']?_0xd7bb55[_0xae1a('0x1d')]['include']?_['map'](_0xd7bb55[_0xae1a('0x1d')][_0xae1a('0x21')],function(_0x3907c6){return{'model':db[_0x3907c6[_0xae1a('0x22')]],'as':_0x3907c6['as'],'attributes':_0x3907c6[_0xae1a('0x1f')],'include':_0x3907c6['include']?_[_0xae1a('0x23')](_0x3907c6[_0xae1a('0x21')],function(_0x29ed55){return{'model':db[_0x29ed55['model']],'as':_0x29ed55['as'],'attributes':_0x29ed55['attributes'],'include':_0x29ed55['include']?_[_0xae1a('0x23')](_0x29ed55[_0xae1a('0x21')],function(_0x536ddd){return{'model':db[_0x536ddd['model']],'as':_0x536ddd['as'],'attributes':_0x536ddd[_0xae1a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xae1a('0xe')](function(_0x127d6d){logger[_0xae1a('0xf')](_0xae1a('0x1a'),_0xd7bb55);logger[_0xae1a('0x12')](_0xae1a('0x1a'),_0xd7bb55,JSON['stringify'](_0x127d6d));_0x2493d5(_0x127d6d);})['catch'](function(_0x1d0626){logger[_0xae1a('0x15')](_0xae1a('0x1a'),_0x1d0626['message'],_0xd7bb55);_0x112604(_0x49a8af[_0xae1a('0x15')](0x1f4,_0x1d0626[_0xae1a('0x17')]));});});};exports[_0xae1a('0x24')]=function(_0x59ad9e){var _0x2dcf41=this;return new Promise(function(_0x10d50b,_0x5b75a0){return db[_0xae1a('0x1b')][_0xae1a('0x25')]({'raw':_0x59ad9e[_0xae1a('0x1d')]?_0x59ad9e[_0xae1a('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x59ad9e['options']?_0x59ad9e['options']['where']||null:null,'attributes':_0x59ad9e[_0xae1a('0x1d')]?_0x59ad9e['options'][_0xae1a('0x1f')]||null:null,'include':_0x59ad9e['options']?_0x59ad9e['options'][_0xae1a('0x21')]?_[_0xae1a('0x23')](_0x59ad9e[_0xae1a('0x1d')]['include'],function(_0x412791){return{'model':db[_0x412791[_0xae1a('0x22')]],'as':_0x412791['as'],'attributes':_0x412791[_0xae1a('0x1f')],'include':_0x412791[_0xae1a('0x21')]?_['map'](_0x412791['include'],function(_0x564dc0){return{'model':db[_0x564dc0[_0xae1a('0x22')]],'as':_0x564dc0['as'],'attributes':_0x564dc0[_0xae1a('0x1f')],'include':_0x564dc0['include']?_[_0xae1a('0x23')](_0x564dc0[_0xae1a('0x21')],function(_0x283148){return{'model':db[_0x283148[_0xae1a('0x22')]],'as':_0x283148['as'],'attributes':_0x283148['attributes']};}):[]};}):[]};}):[]:[]})[_0xae1a('0xe')](function(_0x5068ca){logger[_0xae1a('0xf')](_0xae1a('0x24'),_0x59ad9e);logger[_0xae1a('0x12')](_0xae1a('0x24'),_0x59ad9e,JSON[_0xae1a('0x14')](_0x5068ca));_0x10d50b(_0x5068ca);})[_0xae1a('0x19')](function(_0x331dc8){logger['error'](_0xae1a('0x24'),_0x331dc8[_0xae1a('0x17')],_0x59ad9e);_0x5b75a0(_0x2dcf41[_0xae1a('0x15')](0x1f4,_0x331dc8[_0xae1a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8c2c9bd..d9b71d6 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 _0x9f62=['save','update','removeListener','register','length'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x9f62,0x154));var _0x29f6=function(_0x2c49cf,_0x55329f){_0x2c49cf=_0x2c49cf-0x0;var _0x1928f4=_0x9f62[_0x2c49cf];return _0x1928f4;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x29f6('0x0'),'remove',_0x29f6('0x1')];function createListener(_0x254ab3,_0x548050){return function(_0x5618b7){_0x548050['emit'](_0x254ab3,_0x5618b7);};}function removeListener(_0x258ddd,_0x2f0420){return function(){ChatQueueEvents[_0x29f6('0x2')](_0x258ddd,_0x2f0420);};}exports[_0x29f6('0x3')]=function(_0x595034){for(var _0xf66137=0x0,_0x272876=events[_0x29f6('0x4')];_0xf66137<_0x272876;_0xf66137++){var _0x2ba602=events[_0xf66137];var _0x416c6c=createListener('chatQueue:'+_0x2ba602,_0x595034);ChatQueueEvents['on'](_0x2ba602,_0x416c6c);}}; \ No newline at end of file +var _0xe107=['remove','update','removeListener','register','length','./chatQueue.events'];(function(_0x5a90af,_0x49cf78){var _0x309ac3=function(_0x223880){while(--_0x223880){_0x5a90af['push'](_0x5a90af['shift']());}};_0x309ac3(++_0x49cf78);}(_0xe107,0xb3));var _0x7e10=function(_0x150eff,_0x5b7ce3){_0x150eff=_0x150eff-0x0;var _0x4f7e93=_0xe107[_0x150eff];return _0x4f7e93;};'use strict';var ChatQueueEvents=require(_0x7e10('0x0'));var events=['save',_0x7e10('0x1'),_0x7e10('0x2')];function createListener(_0x2871b0,_0x570b2a){return function(_0x31212d){_0x570b2a['emit'](_0x2871b0,_0x31212d);};}function removeListener(_0x4db676,_0x2bdf3c){return function(){ChatQueueEvents[_0x7e10('0x3')](_0x4db676,_0x2bdf3c);};}exports[_0x7e10('0x4')]=function(_0x5be19f){for(var _0x5f1edf=0x0,_0x1dd3de=events[_0x7e10('0x5')];_0x5f1edf<_0x1dd3de;_0x5f1edf++){var _0x156c56=events[_0x5f1edf];var _0x3413f7=createListener('chatQueue:'+_0x156c56,_0x5be19f);ChatQueueEvents['on'](_0x156c56,_0x3413f7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e589084..f738476 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0x3c4515,_0x52f867){_0x3c4515=_0x3c4515-0x0;var _0x3ef194=_0x3e74[_0x3c4515];return _0x3ef194;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x319a45,_0x4eee0d){var _0x3d6229=function(_0x10c715){while(--_0x10c715){_0x319a45['push'](_0x319a45['shift']());}};_0x3d6229(++_0x4eee0d);}(_0x814b,0x1a2));var _0xb814=function(_0xbf09ab,_0x251a19){_0xbf09ab=_0xbf09ab-0x0;var _0x2a9aef=_0x814b[_0xbf09ab];return _0x2a9aef;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index e91c4a5..d56be93 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 _0x71f8=['moment','sequelize','exports','STRING','DATE'];(function(_0xe8e040,_0x278f92){var _0x6be7b8=function(_0x3dabd0){while(--_0x3dabd0){_0xe8e040['push'](_0xe8e040['shift']());}};_0x6be7b8(++_0x278f92);}(_0x71f8,0x1ae));var _0x871f=function(_0x4ea2f7,_0x11c547){_0x4ea2f7=_0x4ea2f7-0x0;var _0x532c3c=_0x71f8[_0x4ea2f7];return _0x532c3c;};'use strict';var moment=require(_0x871f('0x0'));var Sequelize=require(_0x871f('0x1'));module[_0x871f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x871f('0x3')]},'joinAt':{'type':Sequelize[_0x871f('0x4')]},'leaveAt':{'type':Sequelize[_0x871f('0x4')]},'acceptAt':{'type':Sequelize[_0x871f('0x4')]},'exitAt':{'type':Sequelize[_0x871f('0x4')]},'reason':{'type':Sequelize[_0x871f('0x3')]}}; \ No newline at end of file +var _0x2f8f=['DATE','moment','sequelize','exports','STRING'];(function(_0x5685c3,_0x275a26){var _0x3ffb25=function(_0x57ea05){while(--_0x57ea05){_0x5685c3['push'](_0x5685c3['shift']());}};_0x3ffb25(++_0x275a26);}(_0x2f8f,0x13c));var _0xf2f8=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x2f8f[_0x26d6d9];return _0x1b4875;};'use strict';var moment=require(_0xf2f8('0x0'));var Sequelize=require(_0xf2f8('0x1'));module[_0xf2f8('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf2f8('0x3')]},'joinAt':{'type':Sequelize[_0xf2f8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf2f8('0x4')]},'exitAt':{'type':Sequelize[_0xf2f8('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 ae037ca..d889444 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 _0x9120=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x9120,0x1b3));var _0x0912=function(_0x23d2c0,_0x271f90){_0x23d2c0=_0x23d2c0-0x0;var _0x34b324=_0x9120[_0x23d2c0];return _0x34b324;};'use strict';var emlformat=require(_0x0912('0x0'));var rimraf=require(_0x0912('0x1'));var zipdir=require(_0x0912('0x2'));var jsonpatch=require(_0x0912('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0912('0x4'));var Mustache=require(_0x0912('0x5'));var util=require(_0x0912('0x6'));var path=require(_0x0912('0x7'));var sox=require(_0x0912('0x8'));var csv=require(_0x0912('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0912('0xa'));var _=require(_0x0912('0xb'));var squel=require(_0x0912('0xc'));var crypto=require('crypto');var jsforce=require(_0x0912('0xd'));var deskjs=require(_0x0912('0xe'));var toCsv=require(_0x0912('0x9'));var querystring=require(_0x0912('0xf'));var Papa=require(_0x0912('0x10'));var Redis=require('ioredis');var authService=require(_0x0912('0x11'));var qs=require(_0x0912('0x12'));var as=require(_0x0912('0x13'));var hardwareService=require(_0x0912('0x14'));var logger=require('../../config/logger')(_0x0912('0x15'));var utils=require('../../config/utils');var config=require(_0x0912('0x16'));var licenseUtil=require(_0x0912('0x17'));var db=require(_0x0912('0x18'))['db'];function respondWithStatusCode(_0xc7af62,_0x22752b){_0x22752b=_0x22752b||0xcc;return function(_0x10faac){if(_0x10faac){return _0xc7af62[_0x0912('0x19')](_0x22752b);}return _0xc7af62[_0x0912('0x1a')](_0x22752b)[_0x0912('0x1b')]();};}function respondWithResult(_0x102468,_0x17f22d){_0x17f22d=_0x17f22d||0xc8;return function(_0x350d6b){if(_0x350d6b){return _0x102468[_0x0912('0x1a')](_0x17f22d)[_0x0912('0x1c')](_0x350d6b);}};}function respondWithFilteredResult(_0x247612,_0x5eb1c9){return function(_0x4d00fd){if(_0x4d00fd){var _0x1ed3e8=typeof _0x5eb1c9['offset']===_0x0912('0x1d')&&typeof _0x5eb1c9['limit']===_0x0912('0x1d');var _0x49b581=_0x4d00fd[_0x0912('0x1e')];var _0x5eace1=_0x1ed3e8?0x0:_0x5eb1c9[_0x0912('0x1f')];var _0x5357db=_0x1ed3e8?_0x4d00fd[_0x0912('0x1e')]:_0x5eb1c9['offset']+_0x5eb1c9['limit'];var _0x3377af;if(_0x5357db>=_0x49b581){_0x5357db=_0x49b581;_0x3377af=0xc8;}else{_0x3377af=0xce;}_0x247612['status'](_0x3377af);return _0x247612[_0x0912('0x20')](_0x0912('0x21'),_0x5eace1+'-'+_0x5357db+'/'+_0x49b581)['json'](_0x4d00fd);}return null;};}function patchUpdates(_0x106008){return function(_0xb1af32){try{jsonpatch[_0x0912('0x22')](_0xb1af32,_0x106008,!![]);}catch(_0x5927d2){return BPromise['reject'](_0x5927d2);}return _0xb1af32[_0x0912('0x23')]();};}function saveUpdates(_0x626428,_0x1f04a1){return function(_0x30b7cc){if(_0x30b7cc){return _0x30b7cc[_0x0912('0x24')](_0x626428)[_0x0912('0x25')](function(_0x6c4902){return _0x6c4902;});}return null;};}function removeEntity(_0x2a3e70,_0xca7f8b){return function(_0x572d12){if(_0x572d12){return _0x572d12[_0x0912('0x26')]()[_0x0912('0x25')](function(){_0x2a3e70[_0x0912('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a938e,_0x21d65b){return function(_0x53d673){if(!_0x53d673){_0x4a938e['sendStatus'](0x194);}return _0x53d673;};}function handleError(_0x39462e,_0x39e96b){_0x39e96b=_0x39e96b||0x1f4;return function(_0x4d45d2){logger[_0x0912('0x27')](_0x4d45d2[_0x0912('0x28')]);if(_0x4d45d2[_0x0912('0x29')]){delete _0x4d45d2[_0x0912('0x29')];}_0x39462e[_0x0912('0x1a')](_0x39e96b)['send'](_0x4d45d2);};}exports[_0x0912('0x2a')]=function(_0x1d6c87,_0x4ac024){var _0x2b1653={},_0x3428a9={},_0x2ce714={'count':0x0,'rows':[]};var _0x5b3956=_[_0x0912('0x2b')](db[_0x0912('0x2c')][_0x0912('0x2d')],function(_0x176529){return{'name':_0x176529['fieldName'],'type':_0x176529[_0x0912('0x2e')][_0x0912('0x2f')]};});_0x3428a9[_0x0912('0x30')]=_[_0x0912('0x2b')](_0x5b3956,_0x0912('0x29'));_0x3428a9[_0x0912('0x31')]=_['keys'](_0x1d6c87['query']);_0x3428a9[_0x0912('0x32')]=_[_0x0912('0x33')](_0x3428a9['model'],_0x3428a9['query']);_0x2b1653[_0x0912('0x34')]=_[_0x0912('0x33')](_0x3428a9[_0x0912('0x30')],qs[_0x0912('0x35')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x35')]));_0x2b1653[_0x0912('0x34')]=_0x2b1653[_0x0912('0x34')]['length']?_0x2b1653['attributes']:_0x3428a9[_0x0912('0x30')];if(!_0x1d6c87[_0x0912('0x31')]['hasOwnProperty'](_0x0912('0x36'))){_0x2b1653[_0x0912('0x37')]=qs[_0x0912('0x37')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x37')]);_0x2b1653[_0x0912('0x1f')]=qs[_0x0912('0x1f')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x1f')]);}_0x2b1653['order']=qs[_0x0912('0x38')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x38')]);_0x2b1653[_0x0912('0x39')]=qs[_0x0912('0x32')](_[_0x0912('0x3a')](_0x1d6c87[_0x0912('0x31')],_0x3428a9['filters']),_0x5b3956);if(_0x1d6c87[_0x0912('0x31')]['filter']){_0x2b1653['where']=_['merge'](_0x2b1653[_0x0912('0x39')],{'$or':_[_0x0912('0x2b')](_0x5b3956,function(_0x5db5f9){if(_0x5db5f9[_0x0912('0x2e')]!==_0x0912('0x3b')){var _0xfdf81c={};_0xfdf81c[_0x5db5f9['name']]={'$like':'%'+_0x1d6c87[_0x0912('0x31')][_0x0912('0x3c')]+'%'};return _0xfdf81c;}})});}_0x2b1653=_['merge']({},_0x2b1653,_0x1d6c87[_0x0912('0x3d')]);var _0x40de57={'where':_0x2b1653[_0x0912('0x39')]};return db[_0x0912('0x2c')][_0x0912('0x1e')](_0x40de57)[_0x0912('0x25')](function(_0x4eb359){_0x2ce714[_0x0912('0x1e')]=_0x4eb359;if(_0x1d6c87[_0x0912('0x31')][_0x0912('0x3e')]){_0x2b1653[_0x0912('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0912('0x40')](_0x2b1653);})[_0x0912('0x25')](function(_0x10040b){_0x2ce714['rows']=_0x10040b;return _0x2ce714;})[_0x0912('0x25')](respondWithFilteredResult(_0x4ac024,_0x2b1653))[_0x0912('0x41')](handleError(_0x4ac024,null));};exports[_0x0912('0x42')]=function(_0x19839e,_0x1c5158){var _0x320f98={'raw':!![],'where':{'id':_0x19839e[_0x0912('0x43')]['id']}},_0x15e23b={};_0x15e23b['model']=_[_0x0912('0x44')](db['ChatQueueReport'][_0x0912('0x2d')]);_0x15e23b[_0x0912('0x31')]=_[_0x0912('0x44')](_0x19839e[_0x0912('0x31')]);_0x15e23b[_0x0912('0x32')]=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],_0x15e23b[_0x0912('0x31')]);_0x320f98['attributes']=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],qs[_0x0912('0x35')](_0x19839e['query'][_0x0912('0x35')]));_0x320f98[_0x0912('0x34')]=_0x320f98[_0x0912('0x34')][_0x0912('0x45')]?_0x320f98[_0x0912('0x34')]:_0x15e23b[_0x0912('0x30')];if(_0x19839e[_0x0912('0x31')][_0x0912('0x3e')]){_0x320f98[_0x0912('0x3f')]=[{'all':!![]}];}_0x320f98=_[_0x0912('0x46')]({},_0x320f98,_0x19839e[_0x0912('0x3d')]);return db[_0x0912('0x2c')][_0x0912('0x47')](_0x320f98)[_0x0912('0x25')](handleEntityNotFound(_0x1c5158,null))[_0x0912('0x25')](respondWithResult(_0x1c5158,null))[_0x0912('0x41')](handleError(_0x1c5158,null));};exports[_0x0912('0x48')]=function(_0x255ee5,_0x3b0548){return db[_0x0912('0x2c')][_0x0912('0x48')](_0x255ee5[_0x0912('0x49')],{})[_0x0912('0x25')](respondWithResult(_0x3b0548,0xc9))['catch'](handleError(_0x3b0548,null));};exports[_0x0912('0x24')]=function(_0x3b94cc,_0x591c83){if(_0x3b94cc[_0x0912('0x49')]['id']){delete _0x3b94cc[_0x0912('0x49')]['id'];}return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x3b94cc[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x591c83,null))['then'](saveUpdates(_0x3b94cc[_0x0912('0x49')],null))[_0x0912('0x25')](respondWithResult(_0x591c83,null))[_0x0912('0x41')](handleError(_0x591c83,null));};exports['destroy']=function(_0x11364e,_0x3ce4bf){return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x11364e[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x3ce4bf,null))[_0x0912('0x25')](removeEntity(_0x3ce4bf,null))[_0x0912('0x41')](handleError(_0x3ce4bf,null));};exports['describe']=function(_0x91bb1a,_0x360313){return db[_0x0912('0x2c')][_0x0912('0x4a')]()[_0x0912('0x25')](respondWithResult(_0x360313,null))['catch'](handleError(_0x360313,null));}; \ No newline at end of file +var _0xcddb=['nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','body','update','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','then','destroy','end','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x57cc40,_0x3bacf8){_0x57cc40=_0x57cc40-0x0;var _0x43c6fa=_0xcddb[_0x57cc40];return _0x43c6fa;};'use strict';var emlformat=require(_0xbcdd('0x0'));var rimraf=require(_0xbcdd('0x1'));var zipdir=require(_0xbcdd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbcdd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbcdd('0x4'));var util=require(_0xbcdd('0x5'));var path=require(_0xbcdd('0x6'));var sox=require(_0xbcdd('0x7'));var csv=require('to-csv');var ejs=require(_0xbcdd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcdd('0x9'));var squel=require(_0xbcdd('0xa'));var crypto=require('crypto');var jsforce=require(_0xbcdd('0xb'));var deskjs=require(_0xbcdd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbcdd('0xd'));var Redis=require(_0xbcdd('0xe'));var authService=require(_0xbcdd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbcdd('0x10'));var hardwareService=require(_0xbcdd('0x11'));var logger=require(_0xbcdd('0x12'))(_0xbcdd('0x13'));var utils=require('../../config/utils');var config=require(_0xbcdd('0x14'));var licenseUtil=require(_0xbcdd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33cb85,_0x948ca6){_0x948ca6=_0x948ca6||0xcc;return function(_0x5a84c4){if(_0x5a84c4){return _0x33cb85[_0xbcdd('0x16')](_0x948ca6);}return _0x33cb85[_0xbcdd('0x17')](_0x948ca6)['end']();};}function respondWithResult(_0x59da7a,_0x3be98b){_0x3be98b=_0x3be98b||0xc8;return function(_0x34e4cb){if(_0x34e4cb){return _0x59da7a[_0xbcdd('0x17')](_0x3be98b)[_0xbcdd('0x18')](_0x34e4cb);}};}function respondWithFilteredResult(_0x377448,_0x5b66cb){return function(_0x87eb1e){if(_0x87eb1e){var _0x408055=typeof _0x5b66cb['offset']===_0xbcdd('0x19')&&typeof _0x5b66cb['limit']===_0xbcdd('0x19');var _0x2e7eeb=_0x87eb1e[_0xbcdd('0x1a')];var _0x47ae02=_0x408055?0x0:_0x5b66cb[_0xbcdd('0x1b')];var _0x39d865=_0x408055?_0x87eb1e[_0xbcdd('0x1a')]:_0x5b66cb[_0xbcdd('0x1b')]+_0x5b66cb[_0xbcdd('0x1c')];var _0x5ad171;if(_0x39d865>=_0x2e7eeb){_0x39d865=_0x2e7eeb;_0x5ad171=0xc8;}else{_0x5ad171=0xce;}_0x377448[_0xbcdd('0x17')](_0x5ad171);return _0x377448[_0xbcdd('0x1d')](_0xbcdd('0x1e'),_0x47ae02+'-'+_0x39d865+'/'+_0x2e7eeb)[_0xbcdd('0x18')](_0x87eb1e);}return null;};}function patchUpdates(_0x45ae83){return function(_0x1b8c70){try{jsonpatch['apply'](_0x1b8c70,_0x45ae83,!![]);}catch(_0x224a84){return BPromise['reject'](_0x224a84);}return _0x1b8c70[_0xbcdd('0x1f')]();};}function saveUpdates(_0x1d9e2d,_0x26798d){return function(_0x23bbd5){if(_0x23bbd5){return _0x23bbd5['update'](_0x1d9e2d)[_0xbcdd('0x20')](function(_0x2cd0dd){return _0x2cd0dd;});}return null;};}function removeEntity(_0x1e4db6,_0x19e183){return function(_0x527e71){if(_0x527e71){return _0x527e71[_0xbcdd('0x21')]()[_0xbcdd('0x20')](function(){_0x1e4db6[_0xbcdd('0x17')](0xcc)[_0xbcdd('0x22')]();});}};}function handleEntityNotFound(_0x3cfd0f,_0x5441a9){return function(_0x1f334d){if(!_0x1f334d){_0x3cfd0f[_0xbcdd('0x16')](0x194);}return _0x1f334d;};}function handleError(_0x14a34b,_0x3f57a5){_0x3f57a5=_0x3f57a5||0x1f4;return function(_0x37f2a9){logger['error'](_0x37f2a9[_0xbcdd('0x23')]);if(_0x37f2a9[_0xbcdd('0x24')]){delete _0x37f2a9['name'];}_0x14a34b[_0xbcdd('0x17')](_0x3f57a5)[_0xbcdd('0x25')](_0x37f2a9);};}exports[_0xbcdd('0x26')]=function(_0x18b13b,_0x3f6487){var _0x553e98={},_0x163a3e={},_0x485696={'count':0x0,'rows':[]};var _0x5d6234=_[_0xbcdd('0x27')](db[_0xbcdd('0x28')]['rawAttributes'],function(_0x2dc944){return{'name':_0x2dc944[_0xbcdd('0x29')],'type':_0x2dc944[_0xbcdd('0x2a')][_0xbcdd('0x2b')]};});_0x163a3e[_0xbcdd('0x2c')]=_[_0xbcdd('0x27')](_0x5d6234,_0xbcdd('0x24'));_0x163a3e[_0xbcdd('0x2d')]=_[_0xbcdd('0x2e')](_0x18b13b['query']);_0x163a3e[_0xbcdd('0x2f')]=_[_0xbcdd('0x30')](_0x163a3e['model'],_0x163a3e['query']);_0x553e98[_0xbcdd('0x31')]=_[_0xbcdd('0x30')](_0x163a3e['model'],qs[_0xbcdd('0x32')](_0x18b13b['query'][_0xbcdd('0x32')]));_0x553e98['attributes']=_0x553e98[_0xbcdd('0x31')]['length']?_0x553e98[_0xbcdd('0x31')]:_0x163a3e[_0xbcdd('0x2c')];if(!_0x18b13b['query'][_0xbcdd('0x33')](_0xbcdd('0x34'))){_0x553e98[_0xbcdd('0x1c')]=qs[_0xbcdd('0x1c')](_0x18b13b[_0xbcdd('0x2d')]['limit']);_0x553e98[_0xbcdd('0x1b')]=qs['offset'](_0x18b13b[_0xbcdd('0x2d')][_0xbcdd('0x1b')]);}_0x553e98['order']=qs['sort'](_0x18b13b[_0xbcdd('0x2d')]['sort']);_0x553e98[_0xbcdd('0x35')]=qs[_0xbcdd('0x2f')](_[_0xbcdd('0x36')](_0x18b13b['query'],_0x163a3e[_0xbcdd('0x2f')]),_0x5d6234);if(_0x18b13b[_0xbcdd('0x2d')][_0xbcdd('0x37')]){_0x553e98[_0xbcdd('0x35')]=_[_0xbcdd('0x38')](_0x553e98[_0xbcdd('0x35')],{'$or':_[_0xbcdd('0x27')](_0x5d6234,function(_0xd646d1){if(_0xd646d1[_0xbcdd('0x2a')]!==_0xbcdd('0x39')){var _0x40d4fd={};_0x40d4fd[_0xd646d1[_0xbcdd('0x24')]]={'$like':'%'+_0x18b13b['query'][_0xbcdd('0x37')]+'%'};return _0x40d4fd;}})});}_0x553e98=_[_0xbcdd('0x38')]({},_0x553e98,_0x18b13b[_0xbcdd('0x3a')]);var _0x2a9568={'where':_0x553e98[_0xbcdd('0x35')]};return db[_0xbcdd('0x28')]['count'](_0x2a9568)[_0xbcdd('0x20')](function(_0x57ab36){_0x485696[_0xbcdd('0x1a')]=_0x57ab36;if(_0x18b13b['query'][_0xbcdd('0x3b')]){_0x553e98[_0xbcdd('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xbcdd('0x3d')](_0x553e98);})[_0xbcdd('0x20')](function(_0x41721d){_0x485696[_0xbcdd('0x3e')]=_0x41721d;return _0x485696;})['then'](respondWithFilteredResult(_0x3f6487,_0x553e98))['catch'](handleError(_0x3f6487,null));};exports[_0xbcdd('0x3f')]=function(_0xd41482,_0x41fc62){var _0x4b184b={'raw':!![],'where':{'id':_0xd41482[_0xbcdd('0x40')]['id']}},_0x3e65ce={};_0x3e65ce['model']=_[_0xbcdd('0x2e')](db[_0xbcdd('0x28')][_0xbcdd('0x41')]);_0x3e65ce['query']=_[_0xbcdd('0x2e')](_0xd41482[_0xbcdd('0x2d')]);_0x3e65ce[_0xbcdd('0x2f')]=_['intersection'](_0x3e65ce[_0xbcdd('0x2c')],_0x3e65ce[_0xbcdd('0x2d')]);_0x4b184b[_0xbcdd('0x31')]=_[_0xbcdd('0x30')](_0x3e65ce[_0xbcdd('0x2c')],qs[_0xbcdd('0x32')](_0xd41482[_0xbcdd('0x2d')][_0xbcdd('0x32')]));_0x4b184b[_0xbcdd('0x31')]=_0x4b184b[_0xbcdd('0x31')][_0xbcdd('0x42')]?_0x4b184b[_0xbcdd('0x31')]:_0x3e65ce['model'];if(_0xd41482[_0xbcdd('0x2d')]['includeAll']){_0x4b184b[_0xbcdd('0x3c')]=[{'all':!![]}];}_0x4b184b=_[_0xbcdd('0x38')]({},_0x4b184b,_0xd41482['options']);return db[_0xbcdd('0x28')][_0xbcdd('0x43')](_0x4b184b)[_0xbcdd('0x20')](handleEntityNotFound(_0x41fc62,null))[_0xbcdd('0x20')](respondWithResult(_0x41fc62,null))[_0xbcdd('0x44')](handleError(_0x41fc62,null));};exports['create']=function(_0xb1f54d,_0x6f4939){return db['ChatQueueReport']['create'](_0xb1f54d[_0xbcdd('0x45')],{})[_0xbcdd('0x20')](respondWithResult(_0x6f4939,0xc9))[_0xbcdd('0x44')](handleError(_0x6f4939,null));};exports[_0xbcdd('0x46')]=function(_0x26535a,_0x6708f5){if(_0x26535a[_0xbcdd('0x45')]['id']){delete _0x26535a['body']['id'];}return db[_0xbcdd('0x28')][_0xbcdd('0x43')]({'where':{'id':_0x26535a['params']['id']}})[_0xbcdd('0x20')](handleEntityNotFound(_0x6708f5,null))['then'](saveUpdates(_0x26535a[_0xbcdd('0x45')],null))[_0xbcdd('0x20')](respondWithResult(_0x6708f5,null))[_0xbcdd('0x44')](handleError(_0x6708f5,null));};exports[_0xbcdd('0x21')]=function(_0x282450,_0x304966){return db[_0xbcdd('0x28')][_0xbcdd('0x43')]({'where':{'id':_0x282450['params']['id']}})['then'](handleEntityNotFound(_0x304966,null))[_0xbcdd('0x20')](removeEntity(_0x304966,null))[_0xbcdd('0x44')](handleError(_0x304966,null));};exports['describe']=function(_0x2242bd,_0x312832){return db[_0xbcdd('0x28')][_0xbcdd('0x47')]()[_0xbcdd('0x20')](respondWithResult(_0x312832,null))['catch'](handleError(_0x312832,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 10657e3..918808c 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x229742,_0x5c682d){var _0x536bbf=function(_0x142918){while(--_0x142918){_0x229742['push'](_0x229742['shift']());}};_0x536bbf(++_0x5c682d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb7e7[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 9a7233b..4fd0af2 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 _0x3fc4=['debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x518ee7,_0x18f4a4){var _0x59b1d7=function(_0x238778){while(--_0x238778){_0x518ee7['push'](_0x518ee7['shift']());}};_0x59b1d7(++_0x18f4a4);}(_0x3fc4,0x179));var _0x43fc=function(_0x22ec7e,_0x24fde9){_0x22ec7e=_0x22ec7e-0x0;var _0x2bd9d2=_0x3fc4[_0x22ec7e];return _0x2bd9d2;};'use strict';var _=require('lodash');var util=require(_0x43fc('0x0'));var moment=require(_0x43fc('0x1'));var BPromise=require(_0x43fc('0x2'));var rs=require(_0x43fc('0x3'));var fs=require('fs');var Redis=require(_0x43fc('0x4'));var db=require(_0x43fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x43fc('0x6'))('rpc');var config=require(_0x43fc('0x7'));var jayson=require(_0x43fc('0x8'));var client=jayson[_0x43fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8d6c,_0x509e56,_0x2b17a5){return new BPromise(function(_0x38e8ba,_0x56116a){return client['request'](_0x2a8d6c,_0x2b17a5)[_0x43fc('0xa')](function(_0x2cc50c){logger['info'](_0x43fc('0xb'),_0x509e56,_0x43fc('0xc'));logger[_0x43fc('0xd')](_0x43fc('0xe'),_0x509e56,_0x43fc('0xc'),JSON[_0x43fc('0xf')](_0x2cc50c));if(_0x2cc50c[_0x43fc('0x10')]){if(_0x2cc50c[_0x43fc('0x10')]['code']===0x1f4){logger['error'](_0x43fc('0xb'),_0x509e56,_0x2cc50c[_0x43fc('0x10')][_0x43fc('0x11')]);return _0x56116a(_0x2cc50c[_0x43fc('0x10')][_0x43fc('0x11')]);}logger[_0x43fc('0x10')](_0x43fc('0xb'),_0x509e56,_0x2cc50c[_0x43fc('0x10')][_0x43fc('0x11')]);return _0x38e8ba(_0x2cc50c[_0x43fc('0x10')]['message']);}else{logger[_0x43fc('0x12')](_0x43fc('0xb'),_0x509e56,_0x43fc('0xc'));_0x38e8ba(_0x2cc50c[_0x43fc('0x13')][_0x43fc('0x11')]);}})[_0x43fc('0x14')](function(_0x54f01b){logger[_0x43fc('0x10')](_0x43fc('0xb'),_0x509e56,_0x54f01b);_0x56116a(_0x54f01b);});});}exports[_0x43fc('0x15')]=function(_0x10fbcf){var _0x4763ea=this;return new Promise(function(_0x2a68e6,_0x45ac0a){return db[_0x43fc('0x16')]['create'](_0x10fbcf[_0x43fc('0x17')],{'raw':_0x10fbcf[_0x43fc('0x18')]?_0x10fbcf[_0x43fc('0x18')][_0x43fc('0x19')]===undefined?!![]:![]:!![]})[_0x43fc('0xa')](function(_0x5c133a){logger[_0x43fc('0x12')](_0x43fc('0x15'),_0x10fbcf);logger['debug'](_0x43fc('0x15'),_0x10fbcf,JSON[_0x43fc('0xf')](_0x5c133a));_0x2a68e6(_0x5c133a);})[_0x43fc('0x14')](function(_0x2bda3b){logger['error'](_0x43fc('0x15'),_0x2bda3b[_0x43fc('0x11')],_0x10fbcf);_0x45ac0a(_0x4763ea[_0x43fc('0x10')](0x1f4,_0x2bda3b[_0x43fc('0x11')]));});});};exports[_0x43fc('0x1a')]=function(_0x3cbc4e){var _0x113069=this;return new Promise(function(_0x5c7cc2,_0x25f9a9){return db[_0x43fc('0x16')][_0x43fc('0x1b')](_0x3cbc4e['body'],{'raw':_0x3cbc4e['options']?_0x3cbc4e['options'][_0x43fc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cbc4e[_0x43fc('0x18')]?_0x3cbc4e[_0x43fc('0x18')]['where']||null:null,'attributes':_0x3cbc4e[_0x43fc('0x18')]?_0x3cbc4e[_0x43fc('0x18')][_0x43fc('0x1c')]||null:null,'limit':_0x3cbc4e['options']?_0x3cbc4e[_0x43fc('0x18')][_0x43fc('0x1d')]||null:null})['then'](function(_0x1836e1){logger[_0x43fc('0x12')]('UpdateChatQueueReport',_0x3cbc4e);logger[_0x43fc('0xd')]('UpdateChatQueueReport',_0x3cbc4e,JSON[_0x43fc('0xf')](_0x1836e1));_0x5c7cc2(_0x1836e1);})[_0x43fc('0x14')](function(_0x3ff3d2){logger[_0x43fc('0x10')](_0x43fc('0x1a'),_0x3ff3d2['message'],_0x3cbc4e);_0x25f9a9(_0x113069[_0x43fc('0x10')](0x1f4,_0x3ff3d2[_0x43fc('0x11')]));});});}; \ No newline at end of file +var _0x25c9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','lodash','util','moment'];(function(_0x490e0a,_0x1eca50){var _0x212ff2=function(_0x281eb2){while(--_0x281eb2){_0x490e0a['push'](_0x490e0a['shift']());}};_0x212ff2(++_0x1eca50);}(_0x25c9,0x1d9));var _0x925c=function(_0x307592,_0x4249d3){_0x307592=_0x307592-0x0;var _0x189387=_0x25c9[_0x307592];return _0x189387;};'use strict';var _=require(_0x925c('0x0'));var util=require(_0x925c('0x1'));var moment=require(_0x925c('0x2'));var BPromise=require(_0x925c('0x3'));var rs=require(_0x925c('0x4'));var fs=require('fs');var Redis=require(_0x925c('0x5'));var db=require(_0x925c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x925c('0x7'))('rpc');var config=require(_0x925c('0x8'));var jayson=require(_0x925c('0x9'));var client=jayson['client'][_0x925c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4af9af,_0x9d7ac3,_0x8d7d33){return new BPromise(function(_0x8da534,_0x1034b8){return client[_0x925c('0xb')](_0x4af9af,_0x8d7d33)['then'](function(_0x2f76ca){logger[_0x925c('0xc')](_0x925c('0xd'),_0x9d7ac3,'request\x20sent');logger[_0x925c('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x9d7ac3,_0x925c('0xf'),JSON[_0x925c('0x10')](_0x2f76ca));if(_0x2f76ca[_0x925c('0x11')]){if(_0x2f76ca[_0x925c('0x11')][_0x925c('0x12')]===0x1f4){logger['error'](_0x925c('0xd'),_0x9d7ac3,_0x2f76ca[_0x925c('0x11')][_0x925c('0x13')]);return _0x1034b8(_0x2f76ca['error'][_0x925c('0x13')]);}logger[_0x925c('0x11')](_0x925c('0xd'),_0x9d7ac3,_0x2f76ca[_0x925c('0x11')]['message']);return _0x8da534(_0x2f76ca['error'][_0x925c('0x13')]);}else{logger[_0x925c('0xc')](_0x925c('0xd'),_0x9d7ac3,_0x925c('0xf'));_0x8da534(_0x2f76ca[_0x925c('0x14')][_0x925c('0x13')]);}})[_0x925c('0x15')](function(_0x531853){logger['error'](_0x925c('0xd'),_0x9d7ac3,_0x531853);_0x1034b8(_0x531853);});});}exports[_0x925c('0x16')]=function(_0x5f50e9){var _0x1de978=this;return new Promise(function(_0xeacc0d,_0x298bb9){return db['ChatQueueReport'][_0x925c('0x17')](_0x5f50e9[_0x925c('0x18')],{'raw':_0x5f50e9[_0x925c('0x19')]?_0x5f50e9[_0x925c('0x19')][_0x925c('0x1a')]===undefined?!![]:![]:!![]})[_0x925c('0x1b')](function(_0x53fb3d){logger['info'](_0x925c('0x16'),_0x5f50e9);logger[_0x925c('0xe')](_0x925c('0x16'),_0x5f50e9,JSON['stringify'](_0x53fb3d));_0xeacc0d(_0x53fb3d);})[_0x925c('0x15')](function(_0x51468e){logger[_0x925c('0x11')](_0x925c('0x16'),_0x51468e[_0x925c('0x13')],_0x5f50e9);_0x298bb9(_0x1de978[_0x925c('0x11')](0x1f4,_0x51468e['message']));});});};exports[_0x925c('0x1c')]=function(_0x1adfff){var _0x32c21f=this;return new Promise(function(_0x3f4faa,_0x4a5520){return db[_0x925c('0x1d')][_0x925c('0x1e')](_0x1adfff[_0x925c('0x18')],{'raw':_0x1adfff[_0x925c('0x19')]?_0x1adfff[_0x925c('0x19')][_0x925c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1adfff[_0x925c('0x19')]?_0x1adfff[_0x925c('0x19')][_0x925c('0x1f')]||null:null,'attributes':_0x1adfff[_0x925c('0x19')]?_0x1adfff['options'][_0x925c('0x20')]||null:null,'limit':_0x1adfff[_0x925c('0x19')]?_0x1adfff[_0x925c('0x19')][_0x925c('0x21')]||null:null})['then'](function(_0xd29b3f){logger[_0x925c('0xc')](_0x925c('0x1c'),_0x1adfff);logger[_0x925c('0xe')]('UpdateChatQueueReport',_0x1adfff,JSON[_0x925c('0x10')](_0xd29b3f));_0x3f4faa(_0xd29b3f);})['catch'](function(_0x47b2fd){logger[_0x925c('0x11')](_0x925c('0x1c'),_0x47b2fd[_0x925c('0x13')],_0x1adfff);_0x4a5520(_0x32c21f[_0x925c('0x11')](0x1f4,_0x47b2fd[_0x925c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e86ca0a..8d92d1f 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 _0x11de=['connect-timeout','express','Router','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0xc3a71f,_0x54fe71){var _0x46a474=function(_0x47e601){while(--_0x47e601){_0xc3a71f['push'](_0xc3a71f['shift']());}};_0x46a474(++_0x54fe71);}(_0x11de,0x8a));var _0xe11d=function(_0x468431,_0x4a46d0){_0x468431=_0x468431-0x0;var _0x2a9dd4=_0x11de[_0x468431];return _0x2a9dd4;};'use strict';var multer=require(_0xe11d('0x0'));var util=require('util');var path=require(_0xe11d('0x1'));var timeout=require(_0xe11d('0x2'));var express=require(_0xe11d('0x3'));var router=express[_0xe11d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe11d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe11d('0x6'));router[_0xe11d('0x7')]('/',auth[_0xe11d('0x8')](),controller[_0xe11d('0x9')]);router[_0xe11d('0x7')](_0xe11d('0xa'),auth[_0xe11d('0x8')](),controller[_0xe11d('0xb')]);router['get'](_0xe11d('0xc'),auth[_0xe11d('0x8')](),controller[_0xe11d('0xd')]);router['post']('/',auth[_0xe11d('0x8')](),controller[_0xe11d('0xe')]);router[_0xe11d('0xf')]('/:id',auth[_0xe11d('0x8')](),controller[_0xe11d('0x10')]);router[_0xe11d('0x11')](_0xe11d('0xc'),auth[_0xe11d('0x8')](),controller[_0xe11d('0x12')]);module[_0xe11d('0x13')]=router; \ No newline at end of file +var _0x58f8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x58f8,0x72));var _0x858f=function(_0x181d91,_0x5442f2){_0x181d91=_0x181d91-0x0;var _0x94ee39=_0x58f8[_0x181d91];return _0x94ee39;};'use strict';var multer=require(_0x858f('0x0'));var util=require(_0x858f('0x1'));var path=require(_0x858f('0x2'));var timeout=require(_0x858f('0x3'));var express=require(_0x858f('0x4'));var router=express[_0x858f('0x5')]();var fs_extra=require(_0x858f('0x6'));var auth=require(_0x858f('0x7'));var interaction=require(_0x858f('0x8'));var config=require(_0x858f('0x9'));var controller=require(_0x858f('0xa'));router[_0x858f('0xb')]('/',auth[_0x858f('0xc')](),controller[_0x858f('0xd')]);router[_0x858f('0xb')](_0x858f('0xe'),auth['isAuthenticated'](),controller[_0x858f('0xf')]);router[_0x858f('0xb')]('/:id',auth[_0x858f('0xc')](),controller[_0x858f('0x10')]);router[_0x858f('0x11')]('/',auth[_0x858f('0xc')](),controller['create']);router[_0x858f('0x12')](_0x858f('0x13'),auth[_0x858f('0xc')](),controller[_0x858f('0x14')]);router[_0x858f('0x15')]('/:id',auth[_0x858f('0xc')](),controller[_0x858f('0x16')]);module[_0x858f('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index b536586..3f7d1d2 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x25be3b,_0x55e82b){var _0x3dbf80=function(_0x4928a2){while(--_0x4928a2){_0x25be3b['push'](_0x25be3b['shift']());}};_0x3dbf80(++_0x55e82b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'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 +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x56e43b,_0x2f347f){var _0x5ee377=function(_0x1c5ca9){while(--_0x1c5ca9){_0x56e43b['push'](_0x56e43b['shift']());}};_0x5ee377(++_0x2f347f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xcb91[_0x16539a];return _0x200796;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4dad233..ebcb129 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 _0x025b=['rows','catch','show','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll'];(function(_0x1840c7,_0xb8b170){var _0x225acb=function(_0x425118){while(--_0x425118){_0x1840c7['push'](_0x1840c7['shift']());}};_0x225acb(++_0xb8b170);}(_0x025b,0x1c5));var _0xb025=function(_0x320e21,_0x1f9905){_0x320e21=_0x320e21-0x0;var _0x3d174a=_0x025b[_0x320e21];return _0x3d174a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb025('0x0'));var zipdir=require(_0xb025('0x1'));var jsonpatch=require(_0xb025('0x2'));var rp=require(_0xb025('0x3'));var moment=require(_0xb025('0x4'));var BPromise=require(_0xb025('0x5'));var Mustache=require(_0xb025('0x6'));var util=require(_0xb025('0x7'));var path=require(_0xb025('0x8'));var sox=require('sox');var csv=require(_0xb025('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb025('0xa'));var _=require(_0xb025('0xb'));var squel=require('squel');var crypto=require(_0xb025('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb025('0xd'));var toCsv=require(_0xb025('0x9'));var querystring=require(_0xb025('0xe'));var Papa=require('papaparse');var Redis=require(_0xb025('0xf'));var authService=require(_0xb025('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb025('0x11'));var hardwareService=require(_0xb025('0x12'));var logger=require(_0xb025('0x13'))(_0xb025('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb025('0x15'))['db'];function respondWithStatusCode(_0x69ccf5,_0x3ef3be){_0x3ef3be=_0x3ef3be||0xcc;return function(_0x23a764){if(_0x23a764){return _0x69ccf5[_0xb025('0x16')](_0x3ef3be);}return _0x69ccf5[_0xb025('0x17')](_0x3ef3be)[_0xb025('0x18')]();};}function respondWithResult(_0x74d0d,_0x36f978){_0x36f978=_0x36f978||0xc8;return function(_0x475f1f){if(_0x475f1f){return _0x74d0d[_0xb025('0x17')](_0x36f978)['json'](_0x475f1f);}};}function respondWithFilteredResult(_0x593f44,_0x8c1b51){return function(_0x90cf0b){if(_0x90cf0b){var _0x22a3eb=typeof _0x8c1b51[_0xb025('0x19')]===_0xb025('0x1a')&&typeof _0x8c1b51[_0xb025('0x1b')]===_0xb025('0x1a');var _0xa826e0=_0x90cf0b[_0xb025('0x1c')];var _0x3251a8=_0x22a3eb?0x0:_0x8c1b51[_0xb025('0x19')];var _0x1a4b94=_0x22a3eb?_0x90cf0b[_0xb025('0x1c')]:_0x8c1b51[_0xb025('0x19')]+_0x8c1b51[_0xb025('0x1b')];var _0x4dbc87;if(_0x1a4b94>=_0xa826e0){_0x1a4b94=_0xa826e0;_0x4dbc87=0xc8;}else{_0x4dbc87=0xce;}_0x593f44[_0xb025('0x17')](_0x4dbc87);return _0x593f44['set'](_0xb025('0x1d'),_0x3251a8+'-'+_0x1a4b94+'/'+_0xa826e0)['json'](_0x90cf0b);}return null;};}function patchUpdates(_0x407fa0){return function(_0x2f124d){try{jsonpatch[_0xb025('0x1e')](_0x2f124d,_0x407fa0,!![]);}catch(_0x5bfd89){return BPromise[_0xb025('0x1f')](_0x5bfd89);}return _0x2f124d[_0xb025('0x20')]();};}function saveUpdates(_0x1f3b18,_0x4743d){return function(_0x567358){if(_0x567358){return _0x567358[_0xb025('0x21')](_0x1f3b18)['then'](function(_0x335e49){return _0x335e49;});}return null;};}function removeEntity(_0x569e35,_0x14b21e){return function(_0x3076cd){if(_0x3076cd){return _0x3076cd['destroy']()[_0xb025('0x22')](function(){_0x569e35['status'](0xcc)[_0xb025('0x18')]();});}};}function handleEntityNotFound(_0x136233,_0x5b1547){return function(_0x20913f){if(!_0x20913f){_0x136233[_0xb025('0x16')](0x194);}return _0x20913f;};}function handleError(_0x59195d,_0x255ca7){_0x255ca7=_0x255ca7||0x1f4;return function(_0x423b5a){logger[_0xb025('0x23')](_0x423b5a[_0xb025('0x24')]);if(_0x423b5a[_0xb025('0x25')]){delete _0x423b5a[_0xb025('0x25')];}_0x59195d[_0xb025('0x17')](_0x255ca7)[_0xb025('0x26')](_0x423b5a);};}exports[_0xb025('0x27')]=function(_0x2201cb,_0x40e280){var _0x555aa3={},_0x4e2930={},_0x2593e1={'count':0x0,'rows':[]};var _0x8dc14a=_[_0xb025('0x28')](db[_0xb025('0x29')][_0xb025('0x2a')],function(_0x58677c){return{'name':_0x58677c[_0xb025('0x2b')],'type':_0x58677c['type'][_0xb025('0x2c')]};});_0x4e2930[_0xb025('0x2d')]=_[_0xb025('0x28')](_0x8dc14a,_0xb025('0x25'));_0x4e2930[_0xb025('0x2e')]=_[_0xb025('0x2f')](_0x2201cb[_0xb025('0x2e')]);_0x4e2930[_0xb025('0x30')]=_[_0xb025('0x31')](_0x4e2930['model'],_0x4e2930[_0xb025('0x2e')]);_0x555aa3[_0xb025('0x32')]=_[_0xb025('0x31')](_0x4e2930[_0xb025('0x2d')],qs[_0xb025('0x33')](_0x2201cb['query'][_0xb025('0x33')]));_0x555aa3['attributes']=_0x555aa3[_0xb025('0x32')][_0xb025('0x34')]?_0x555aa3['attributes']:_0x4e2930['model'];if(!_0x2201cb[_0xb025('0x2e')][_0xb025('0x35')](_0xb025('0x36'))){_0x555aa3[_0xb025('0x1b')]=qs['limit'](_0x2201cb[_0xb025('0x2e')]['limit']);_0x555aa3[_0xb025('0x19')]=qs[_0xb025('0x19')](_0x2201cb[_0xb025('0x2e')][_0xb025('0x19')]);}_0x555aa3['order']=qs[_0xb025('0x37')](_0x2201cb['query']['sort']);_0x555aa3[_0xb025('0x38')]=qs[_0xb025('0x30')](_[_0xb025('0x39')](_0x2201cb[_0xb025('0x2e')],_0x4e2930[_0xb025('0x30')]),_0x8dc14a);if(_0x2201cb[_0xb025('0x2e')][_0xb025('0x3a')]){_0x555aa3[_0xb025('0x38')]=_[_0xb025('0x3b')](_0x555aa3['where'],{'$or':_['map'](_0x8dc14a,function(_0x951edb){if(_0x951edb[_0xb025('0x3c')]!=='VIRTUAL'){var _0x32fc22={};_0x32fc22[_0x951edb[_0xb025('0x25')]]={'$like':'%'+_0x2201cb[_0xb025('0x2e')][_0xb025('0x3a')]+'%'};return _0x32fc22;}})});}_0x555aa3=_[_0xb025('0x3b')]({},_0x555aa3,_0x2201cb[_0xb025('0x3d')]);var _0xec3e46={'where':_0x555aa3['where']};return db[_0xb025('0x29')][_0xb025('0x1c')](_0xec3e46)['then'](function(_0x4a5d9a){_0x2593e1[_0xb025('0x1c')]=_0x4a5d9a;if(_0x2201cb[_0xb025('0x2e')][_0xb025('0x3e')]){_0x555aa3[_0xb025('0x3f')]=[{'all':!![]}];}return db[_0xb025('0x29')][_0xb025('0x40')](_0x555aa3);})['then'](function(_0x27f695){_0x2593e1[_0xb025('0x41')]=_0x27f695;return _0x2593e1;})['then'](respondWithFilteredResult(_0x40e280,_0x555aa3))[_0xb025('0x42')](handleError(_0x40e280,null));};exports[_0xb025('0x43')]=function(_0x2ae6e3,_0x2d02a0){var _0x3280db={'raw':!![],'where':{'id':_0x2ae6e3[_0xb025('0x44')]['id']}},_0x549884={};_0x549884[_0xb025('0x2d')]=_[_0xb025('0x2f')](db[_0xb025('0x29')][_0xb025('0x2a')]);_0x549884[_0xb025('0x2e')]=_['keys'](_0x2ae6e3[_0xb025('0x2e')]);_0x549884[_0xb025('0x30')]=_[_0xb025('0x31')](_0x549884['model'],_0x549884[_0xb025('0x2e')]);_0x3280db['attributes']=_['intersection'](_0x549884[_0xb025('0x2d')],qs['fields'](_0x2ae6e3[_0xb025('0x2e')][_0xb025('0x33')]));_0x3280db['attributes']=_0x3280db[_0xb025('0x32')][_0xb025('0x34')]?_0x3280db[_0xb025('0x32')]:_0x549884[_0xb025('0x2d')];if(_0x2ae6e3[_0xb025('0x2e')][_0xb025('0x3e')]){_0x3280db[_0xb025('0x3f')]=[{'all':!![]}];}_0x3280db=_[_0xb025('0x3b')]({},_0x3280db,_0x2ae6e3['options']);return db[_0xb025('0x29')][_0xb025('0x45')](_0x3280db)[_0xb025('0x22')](handleEntityNotFound(_0x2d02a0,null))[_0xb025('0x22')](respondWithResult(_0x2d02a0,null))[_0xb025('0x42')](handleError(_0x2d02a0,null));};exports[_0xb025('0x46')]=function(_0xddad1e,_0x2a17a3){return db[_0xb025('0x29')]['create'](_0xddad1e[_0xb025('0x47')],{})[_0xb025('0x22')](respondWithResult(_0x2a17a3,0xc9))['catch'](handleError(_0x2a17a3,null));};exports[_0xb025('0x21')]=function(_0x5c3846,_0x4fa1d4){if(_0x5c3846[_0xb025('0x47')]['id']){delete _0x5c3846['body']['id'];}return db[_0xb025('0x29')][_0xb025('0x45')]({'where':{'id':_0x5c3846[_0xb025('0x44')]['id']}})[_0xb025('0x22')](handleEntityNotFound(_0x4fa1d4,null))['then'](saveUpdates(_0x5c3846[_0xb025('0x47')],null))[_0xb025('0x22')](respondWithResult(_0x4fa1d4,null))[_0xb025('0x42')](handleError(_0x4fa1d4,null));};exports[_0xb025('0x48')]=function(_0x596e57,_0xd846aa){return db['ChatTransferReport'][_0xb025('0x45')]({'where':{'id':_0x596e57[_0xb025('0x44')]['id']}})[_0xb025('0x22')](handleEntityNotFound(_0xd846aa,null))[_0xb025('0x22')](removeEntity(_0xd846aa,null))[_0xb025('0x42')](handleError(_0xd846aa,null));};exports[_0xb025('0x49')]=function(_0x3267b8,_0x37c7a7){return db[_0xb025('0x29')][_0xb025('0x49')]()[_0xb025('0x22')](respondWithResult(_0x37c7a7,null))[_0xb025('0x42')](handleError(_0x37c7a7,null));}; \ No newline at end of file +var _0x60e0=['VIRTUAL','filter','options','ChatTransferReport','then','includeAll','include','catch','show','params','create','body','find','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','status','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','pick','where','merge'];(function(_0x5d0521,_0x4eab58){var _0x4a78b8=function(_0x392828){while(--_0x392828){_0x5d0521['push'](_0x5d0521['shift']());}};_0x4a78b8(++_0x4eab58);}(_0x60e0,0x176));var _0x060e=function(_0x5bba54,_0x2771b5){_0x5bba54=_0x5bba54-0x0;var _0x59e1ce=_0x60e0[_0x5bba54];return _0x59e1ce;};'use strict';var emlformat=require(_0x060e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x060e('0x1'));var rp=require('request-promise');var moment=require(_0x060e('0x2'));var BPromise=require(_0x060e('0x3'));var Mustache=require(_0x060e('0x4'));var util=require(_0x060e('0x5'));var path=require(_0x060e('0x6'));var sox=require('sox');var csv=require(_0x060e('0x7'));var ejs=require(_0x060e('0x8'));var fs=require('fs');var fs_extra=require(_0x060e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x060e('0xa'));var jsforce=require(_0x060e('0xb'));var deskjs=require(_0x060e('0xc'));var toCsv=require(_0x060e('0x7'));var querystring=require(_0x060e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x060e('0xe'));var as=require(_0x060e('0xf'));var hardwareService=require(_0x060e('0x10'));var logger=require('../../config/logger')(_0x060e('0x11'));var utils=require(_0x060e('0x12'));var config=require(_0x060e('0x13'));var licenseUtil=require(_0x060e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7046f6,_0x5ddef9){_0x5ddef9=_0x5ddef9||0xcc;return function(_0x3a6f7f){if(_0x3a6f7f){return _0x7046f6[_0x060e('0x15')](_0x5ddef9);}return _0x7046f6['status'](_0x5ddef9)[_0x060e('0x16')]();};}function respondWithResult(_0x163130,_0x37455c){_0x37455c=_0x37455c||0xc8;return function(_0x495977){if(_0x495977){return _0x163130['status'](_0x37455c)[_0x060e('0x17')](_0x495977);}};}function respondWithFilteredResult(_0xe909cc,_0x2c95f7){return function(_0x366b87){if(_0x366b87){var _0x5f4611=typeof _0x2c95f7[_0x060e('0x18')]==='undefined'&&typeof _0x2c95f7['limit']===_0x060e('0x19');var _0x2d3ecf=_0x366b87['count'];var _0x5eb8e1=_0x5f4611?0x0:_0x2c95f7[_0x060e('0x18')];var _0x56a406=_0x5f4611?_0x366b87['count']:_0x2c95f7['offset']+_0x2c95f7['limit'];var _0x30afb0;if(_0x56a406>=_0x2d3ecf){_0x56a406=_0x2d3ecf;_0x30afb0=0xc8;}else{_0x30afb0=0xce;}_0xe909cc[_0x060e('0x1a')](_0x30afb0);return _0xe909cc['set'](_0x060e('0x1b'),_0x5eb8e1+'-'+_0x56a406+'/'+_0x2d3ecf)[_0x060e('0x17')](_0x366b87);}return null;};}function patchUpdates(_0x48f050){return function(_0x318156){try{jsonpatch[_0x060e('0x1c')](_0x318156,_0x48f050,!![]);}catch(_0x1c8250){return BPromise[_0x060e('0x1d')](_0x1c8250);}return _0x318156[_0x060e('0x1e')]();};}function saveUpdates(_0x4e74b9,_0x47d257){return function(_0x5a4d39){if(_0x5a4d39){return _0x5a4d39[_0x060e('0x1f')](_0x4e74b9)['then'](function(_0x55f245){return _0x55f245;});}return null;};}function removeEntity(_0x56783c,_0x3518a9){return function(_0x34f1f0){if(_0x34f1f0){return _0x34f1f0[_0x060e('0x20')]()['then'](function(){_0x56783c['status'](0xcc)[_0x060e('0x16')]();});}};}function handleEntityNotFound(_0x42e391,_0x323bf1){return function(_0x3319b1){if(!_0x3319b1){_0x42e391[_0x060e('0x15')](0x194);}return _0x3319b1;};}function handleError(_0x5ab4cd,_0x3649cb){_0x3649cb=_0x3649cb||0x1f4;return function(_0x23a90b){logger[_0x060e('0x21')](_0x23a90b[_0x060e('0x22')]);if(_0x23a90b['name']){delete _0x23a90b[_0x060e('0x23')];}_0x5ab4cd[_0x060e('0x1a')](_0x3649cb)[_0x060e('0x24')](_0x23a90b);};}exports[_0x060e('0x25')]=function(_0x2721e9,_0x5d857b){var _0x3aa8c5={},_0x4d8550={},_0x44d856={'count':0x0,'rows':[]};var _0x2d4bbc=_[_0x060e('0x26')](db['ChatTransferReport'][_0x060e('0x27')],function(_0x573432){return{'name':_0x573432[_0x060e('0x28')],'type':_0x573432[_0x060e('0x29')][_0x060e('0x2a')]};});_0x4d8550['model']=_['map'](_0x2d4bbc,_0x060e('0x23'));_0x4d8550[_0x060e('0x2b')]=_[_0x060e('0x2c')](_0x2721e9[_0x060e('0x2b')]);_0x4d8550[_0x060e('0x2d')]=_['intersection'](_0x4d8550['model'],_0x4d8550['query']);_0x3aa8c5['attributes']=_[_0x060e('0x2e')](_0x4d8550[_0x060e('0x2f')],qs['fields'](_0x2721e9[_0x060e('0x2b')][_0x060e('0x30')]));_0x3aa8c5[_0x060e('0x31')]=_0x3aa8c5['attributes'][_0x060e('0x32')]?_0x3aa8c5[_0x060e('0x31')]:_0x4d8550[_0x060e('0x2f')];if(!_0x2721e9['query']['hasOwnProperty'](_0x060e('0x33'))){_0x3aa8c5[_0x060e('0x34')]=qs[_0x060e('0x34')](_0x2721e9[_0x060e('0x2b')][_0x060e('0x34')]);_0x3aa8c5[_0x060e('0x18')]=qs[_0x060e('0x18')](_0x2721e9[_0x060e('0x2b')][_0x060e('0x18')]);}_0x3aa8c5[_0x060e('0x35')]=qs[_0x060e('0x36')](_0x2721e9['query'][_0x060e('0x36')]);_0x3aa8c5['where']=qs[_0x060e('0x2d')](_[_0x060e('0x37')](_0x2721e9[_0x060e('0x2b')],_0x4d8550[_0x060e('0x2d')]),_0x2d4bbc);if(_0x2721e9[_0x060e('0x2b')]['filter']){_0x3aa8c5[_0x060e('0x38')]=_[_0x060e('0x39')](_0x3aa8c5[_0x060e('0x38')],{'$or':_[_0x060e('0x26')](_0x2d4bbc,function(_0x36ef10){if(_0x36ef10['type']!==_0x060e('0x3a')){var _0x5de8c8={};_0x5de8c8[_0x36ef10[_0x060e('0x23')]]={'$like':'%'+_0x2721e9[_0x060e('0x2b')][_0x060e('0x3b')]+'%'};return _0x5de8c8;}})});}_0x3aa8c5=_[_0x060e('0x39')]({},_0x3aa8c5,_0x2721e9[_0x060e('0x3c')]);var _0x4c800f={'where':_0x3aa8c5[_0x060e('0x38')]};return db[_0x060e('0x3d')]['count'](_0x4c800f)[_0x060e('0x3e')](function(_0x235208){_0x44d856['count']=_0x235208;if(_0x2721e9['query'][_0x060e('0x3f')]){_0x3aa8c5[_0x060e('0x40')]=[{'all':!![]}];}return db[_0x060e('0x3d')]['findAll'](_0x3aa8c5);})[_0x060e('0x3e')](function(_0xea30a2){_0x44d856['rows']=_0xea30a2;return _0x44d856;})['then'](respondWithFilteredResult(_0x5d857b,_0x3aa8c5))[_0x060e('0x41')](handleError(_0x5d857b,null));};exports[_0x060e('0x42')]=function(_0xc907b3,_0x12bf15){var _0x5a1da9={'raw':!![],'where':{'id':_0xc907b3[_0x060e('0x43')]['id']}},_0x5a2779={};_0x5a2779[_0x060e('0x2f')]=_[_0x060e('0x2c')](db[_0x060e('0x3d')][_0x060e('0x27')]);_0x5a2779[_0x060e('0x2b')]=_['keys'](_0xc907b3[_0x060e('0x2b')]);_0x5a2779[_0x060e('0x2d')]=_[_0x060e('0x2e')](_0x5a2779['model'],_0x5a2779['query']);_0x5a1da9[_0x060e('0x31')]=_['intersection'](_0x5a2779['model'],qs[_0x060e('0x30')](_0xc907b3[_0x060e('0x2b')][_0x060e('0x30')]));_0x5a1da9[_0x060e('0x31')]=_0x5a1da9[_0x060e('0x31')][_0x060e('0x32')]?_0x5a1da9[_0x060e('0x31')]:_0x5a2779[_0x060e('0x2f')];if(_0xc907b3[_0x060e('0x2b')]['includeAll']){_0x5a1da9[_0x060e('0x40')]=[{'all':!![]}];}_0x5a1da9=_[_0x060e('0x39')]({},_0x5a1da9,_0xc907b3[_0x060e('0x3c')]);return db[_0x060e('0x3d')]['find'](_0x5a1da9)[_0x060e('0x3e')](handleEntityNotFound(_0x12bf15,null))['then'](respondWithResult(_0x12bf15,null))[_0x060e('0x41')](handleError(_0x12bf15,null));};exports[_0x060e('0x44')]=function(_0xe87cc7,_0x613991){return db[_0x060e('0x3d')][_0x060e('0x44')](_0xe87cc7[_0x060e('0x45')],{})[_0x060e('0x3e')](respondWithResult(_0x613991,0xc9))['catch'](handleError(_0x613991,null));};exports[_0x060e('0x1f')]=function(_0x40b40c,_0x33a7e1){if(_0x40b40c[_0x060e('0x45')]['id']){delete _0x40b40c[_0x060e('0x45')]['id'];}return db[_0x060e('0x3d')][_0x060e('0x46')]({'where':{'id':_0x40b40c[_0x060e('0x43')]['id']}})[_0x060e('0x3e')](handleEntityNotFound(_0x33a7e1,null))['then'](saveUpdates(_0x40b40c[_0x060e('0x45')],null))[_0x060e('0x3e')](respondWithResult(_0x33a7e1,null))['catch'](handleError(_0x33a7e1,null));};exports[_0x060e('0x20')]=function(_0xc051de,_0x1c3928){return db[_0x060e('0x3d')]['find']({'where':{'id':_0xc051de[_0x060e('0x43')]['id']}})[_0x060e('0x3e')](handleEntityNotFound(_0x1c3928,null))[_0x060e('0x3e')](removeEntity(_0x1c3928,null))['catch'](handleError(_0x1c3928,null));};exports[_0x060e('0x47')]=function(_0x113e96,_0x406e81){return db[_0x060e('0x3d')]['describe']()[_0x060e('0x3e')](respondWithResult(_0x406e81,null))[_0x060e('0x41')](handleError(_0x406e81,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 7d8223c..157ed6b 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 _0x2180=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer'];(function(_0x109294,_0x62001){var _0x80a6fa=function(_0x2b3726){while(--_0x2b3726){_0x109294['push'](_0x109294['shift']());}};_0x80a6fa(++_0x62001);}(_0x2180,0xa9));var _0x0218=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0x2180[_0x954b3a];return _0x3a313e;};'use strict';var _=require(_0x0218('0x0'));var util=require(_0x0218('0x1'));var logger=require(_0x0218('0x2'))(_0x0218('0x3'));var moment=require(_0x0218('0x4'));var BPromise=require(_0x0218('0x5'));var rp=require(_0x0218('0x6'));var fs=require('fs');var path=require(_0x0218('0x7'));var rimraf=require('rimraf');var config=require(_0x0218('0x8'));var attributes=require(_0x0218('0x9'));module[_0x0218('0xa')]=function(_0x1a51e9,_0x5604f2){return _0x1a51e9[_0x0218('0xb')]('ChatTransferReport',attributes,{'tableName':_0x0218('0xc'),'paranoid':![],'indexes':[{'name':_0x0218('0xd'),'fields':[_0x0218('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa456=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa456,0x15c));var _0x6a45=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xa456[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var logger=require('../../config/logger')(_0x6a45('0x2'));var moment=require('moment');var BPromise=require(_0x6a45('0x3'));var rp=require(_0x6a45('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a45('0x5'));var config=require(_0x6a45('0x6'));var attributes=require(_0x6a45('0x7'));module[_0x6a45('0x8')]=function(_0x2a7862,_0x2cdd9b){return _0x2a7862[_0x6a45('0x9')]('ChatTransferReport',attributes,{'tableName':_0x6a45('0xa'),'paranoid':![],'indexes':[{'name':_0x6a45('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index cef520b..8e6e556 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 _0x1bc3=['code','message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x452ab2,_0x6da72b){var _0x5e9940=function(_0x45c3d4){while(--_0x45c3d4){_0x452ab2['push'](_0x452ab2['shift']());}};_0x5e9940(++_0x6da72b);}(_0x1bc3,0x144));var _0x31bc=function(_0x521f4e,_0x1114c2){_0x521f4e=_0x521f4e-0x0;var _0x407fda=_0x1bc3[_0x521f4e];return _0x407fda;};'use strict';var _=require(_0x31bc('0x0'));var util=require('util');var moment=require(_0x31bc('0x1'));var BPromise=require(_0x31bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31bc('0x3'));var db=require(_0x31bc('0x4'))['db'];var utils=require(_0x31bc('0x5'));var logger=require(_0x31bc('0x6'))(_0x31bc('0x7'));var config=require(_0x31bc('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x31bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d0112,_0x5b54a3,_0x16db44){return new BPromise(function(_0x1a6040,_0x1c4dde){return client['request'](_0x5d0112,_0x16db44)[_0x31bc('0xa')](function(_0x282049){logger['info'](_0x31bc('0xb'),_0x5b54a3,'request\x20sent');logger[_0x31bc('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x5b54a3,_0x31bc('0xd'),JSON[_0x31bc('0xe')](_0x282049));if(_0x282049[_0x31bc('0xf')]){if(_0x282049[_0x31bc('0xf')][_0x31bc('0x10')]===0x1f4){logger[_0x31bc('0xf')](_0x31bc('0xb'),_0x5b54a3,_0x282049[_0x31bc('0xf')][_0x31bc('0x11')]);return _0x1c4dde(_0x282049['error'][_0x31bc('0x11')]);}logger[_0x31bc('0xf')](_0x31bc('0xb'),_0x5b54a3,_0x282049['error'][_0x31bc('0x11')]);return _0x1a6040(_0x282049[_0x31bc('0xf')][_0x31bc('0x11')]);}else{logger[_0x31bc('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x5b54a3,_0x31bc('0xd'));_0x1a6040(_0x282049[_0x31bc('0x13')]['message']);}})['catch'](function(_0x2d4d1d){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x5b54a3,_0x2d4d1d);_0x1c4dde(_0x2d4d1d);});});} \ No newline at end of file +var _0xba15=['request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatTransferReport,\x20%s,\x20%s'];(function(_0x12964c,_0x12843c){var _0x5e6329=function(_0x5be832){while(--_0x5be832){_0x12964c['push'](_0x12964c['shift']());}};_0x5e6329(++_0x12843c);}(_0xba15,0x143));var _0x5ba1=function(_0xba75d3,_0x39035b){_0xba75d3=_0xba75d3-0x0;var _0x4202ce=_0xba15[_0xba75d3];return _0x4202ce;};'use strict';var _=require(_0x5ba1('0x0'));var util=require(_0x5ba1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ba1('0x2'));var fs=require('fs');var Redis=require(_0x5ba1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ba1('0x4'));var logger=require(_0x5ba1('0x5'))(_0x5ba1('0x6'));var config=require(_0x5ba1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ba1('0x8')][_0x5ba1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e186f,_0x2a2760,_0x41b2c7){return new BPromise(function(_0x25fd56,_0x454bb4){return client['request'](_0x4e186f,_0x41b2c7)[_0x5ba1('0xa')](function(_0x416214){logger[_0x5ba1('0xb')](_0x5ba1('0xc'),_0x2a2760,_0x5ba1('0xd'));logger['debug'](_0x5ba1('0xe'),_0x2a2760,_0x5ba1('0xd'),JSON[_0x5ba1('0xf')](_0x416214));if(_0x416214[_0x5ba1('0x10')]){if(_0x416214['error'][_0x5ba1('0x11')]===0x1f4){logger[_0x5ba1('0x10')](_0x5ba1('0xc'),_0x2a2760,_0x416214[_0x5ba1('0x10')]['message']);return _0x454bb4(_0x416214['error'][_0x5ba1('0x12')]);}logger[_0x5ba1('0x10')](_0x5ba1('0xc'),_0x2a2760,_0x416214[_0x5ba1('0x10')][_0x5ba1('0x12')]);return _0x25fd56(_0x416214[_0x5ba1('0x10')]['message']);}else{logger[_0x5ba1('0xb')](_0x5ba1('0xc'),_0x2a2760,'request\x20sent');_0x25fd56(_0x416214[_0x5ba1('0x13')][_0x5ba1('0x12')]);}})[_0x5ba1('0x14')](function(_0x218fe){logger[_0x5ba1('0x10')](_0x5ba1('0xc'),_0x2a2760,_0x218fe);_0x454bb4(_0x218fe);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c08bf26..ea0e504 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 _0x9748=['express','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','/describe','describe','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x9748,0x1d1));var _0x8974=function(_0x5d2c0e,_0x864cca){_0x5d2c0e=_0x5d2c0e-0x0;var _0x3ac730=_0x9748[_0x5d2c0e];return _0x3ac730;};'use strict';var multer=require(_0x8974('0x0'));var util=require('util');var path=require(_0x8974('0x1'));var timeout=require(_0x8974('0x2'));var express=require(_0x8974('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8974('0x4'));var interaction=require(_0x8974('0x5'));var config=require('../../config/environment');var controller=require(_0x8974('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8974('0x7')](_0x8974('0x8'),auth['isAuthenticated'](),controller[_0x8974('0x9')]);router[_0x8974('0x7')](_0x8974('0xa'),auth['isAuthenticated'](),controller[_0x8974('0xb')]);router['post']('/',auth[_0x8974('0xc')](),controller['create']);router[_0x8974('0xd')](_0x8974('0xa'),auth[_0x8974('0xc')](),controller[_0x8974('0xe')]);router[_0x8974('0xf')](_0x8974('0xa'),auth[_0x8974('0xc')](),controller[_0x8974('0x10')]);module[_0x8974('0x11')]=router; \ No newline at end of file +var _0x5a34=['./chatTransferReport.controller','get','/describe','isAuthenticated','describe','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2e4c9b,_0x1ddbe9){var _0x392189=function(_0x1caed6){while(--_0x1caed6){_0x2e4c9b['push'](_0x2e4c9b['shift']());}};_0x392189(++_0x1ddbe9);}(_0x5a34,0x9f));var _0x45a3=function(_0x503733,_0x3428a2){_0x503733=_0x503733-0x0;var _0x29baa4=_0x5a34[_0x503733];return _0x29baa4;};'use strict';var multer=require(_0x45a3('0x0'));var util=require(_0x45a3('0x1'));var path=require(_0x45a3('0x2'));var timeout=require(_0x45a3('0x3'));var express=require(_0x45a3('0x4'));var router=express[_0x45a3('0x5')]();var fs_extra=require(_0x45a3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x45a3('0x7'));var config=require(_0x45a3('0x8'));var controller=require(_0x45a3('0x9'));router[_0x45a3('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x45a3('0xa')](_0x45a3('0xb'),auth[_0x45a3('0xc')](),controller[_0x45a3('0xd')]);router[_0x45a3('0xa')]('/:id',auth[_0x45a3('0xc')](),controller[_0x45a3('0xe')]);router[_0x45a3('0xf')]('/',auth[_0x45a3('0xc')](),controller[_0x45a3('0x10')]);router[_0x45a3('0x11')]('/:id',auth[_0x45a3('0xc')](),controller[_0x45a3('0x12')]);router[_0x45a3('0x13')]('/:id',auth[_0x45a3('0xc')](),controller['destroy']);module[_0x45a3('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4b518dd..8b3684a 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 _0x447f=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.'];(function(_0x754f0,_0x4b0d70){var _0x486710=function(_0x24105c){while(--_0x24105c){_0x754f0['push'](_0x754f0['shift']());}};_0x486710(++_0x4b0d70);}(_0x447f,0x156));var _0xf447=function(_0x546c3b,_0x248e63){_0x546c3b=_0x546c3b-0x0;var _0x7b2f47=_0x447f[_0x546c3b];return _0x7b2f47;};'use strict';var Sequelize=require(_0xf447('0x0'));var rs=require(_0xf447('0x1'));module[_0xf447('0x2')]={'name':{'type':Sequelize[_0xf447('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'unique':_0xf447('0x4')},'description':{'type':Sequelize[_0xf447('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0x5')},'mapKeyOffline':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x5')},'key':{'type':Sequelize[_0xf447('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0x6')},'customerAlias':{'type':Sequelize[_0xf447('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':_0xf447('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':_0xf447('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf447('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf447('0x3')]},'animation':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf447('0xb')](_0xf447('0xc'),_0xf447('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0xf')},'header_offline':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x10')},'download_transcript':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf447('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf447('0x11')]},'closingQuestion':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0x15')},'placeholderMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0xf')},'skipMessageButton':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x17')},'conditionAgreement':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x18')},'ratingType':{'type':Sequelize[_0xf447('0xb')](_0xf447('0x19'),_0xf447('0x1a')),'defaultValue':_0xf447('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xf447('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf447('0x1b')]({'items':[{'type':_0xf447('0x1c'),'variable':null,'config':{'placeholder':'name','type':_0xf447('0x1d'),'required':!![]},'props':{'title':_0xf447('0x1e'),'helpText':''}},{'type':_0xf447('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf447('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf447('0x1f')](_0xf447('0x20'))?JSON[_0xf447('0x21')](this[_0xf447('0x1f')](_0xf447('0x20'))):{};},'set':function(_0x3edcde){return this['setDataValue'](_0xf447('0x20'),JSON[_0xf447('0x1b')](_0x3edcde));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xf447('0x1c'),'props':{'title':_0xf447('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf447('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xf447('0x22'),'helpText':_0xf447('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xf447('0x24'))?JSON[_0xf447('0x21')](this[_0xf447('0x1f')](_0xf447('0x24'))):{};},'set':function(_0x58af63){return this['setDataValue'](_0xf447('0x24'),JSON[_0xf447('0x1b')](_0x58af63));}},'token':{'type':Sequelize[_0xf447('0x3')],'defaultValue':function(){return rs[_0xf447('0x25')]();}},'autoclose':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf447('0x3')]},'forwardOffline':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf447('0x3')]},'waitingTitle':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x26')},'waitingMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x28')},'offlineMessageBody':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf447('0x11')],'defaultValue':function(){return _0xf447('0x2b');}},'notificationSound':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf447('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf447('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xf447('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf447('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':_0xf447('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf447('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf447('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf447('0x9')],'comment':_0xf447('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![],'comment':_0xf447('0x32'),'set':function(_0xa0a312){if(!_0xa0a312)this['setDataValue'](_0xf447('0x33'),null);this[_0xf447('0x34')](_0xf447('0x35'),_0xa0a312);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf447('0x3')]},'vidaooTopic':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xf447('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf447('0x11')]}}; \ No newline at end of file +var _0x9670=['squared','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','name','text','input','getDataValue','onlineForm','parse','setDataValue','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.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','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}}','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded'];(function(_0xc051b2,_0x3d6d9d){var _0x599dc2=function(_0x235ded){while(--_0x235ded){_0xc051b2['push'](_0xc051b2['shift']());}};_0x599dc2(++_0x3d6d9d);}(_0x9670,0x16f));var _0x0967=function(_0x25d255,_0x44231b){_0x25d255=_0x25d255-0x0;var _0x2d6b09=_0x9670[_0x25d255];return _0x2d6b09;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0967('0x0'));module[_0x0967('0x1')]={'name':{'type':Sequelize[_0x0967('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x0967('0x2')],'allowNull':![],'unique':_0x0967('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x0967('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x4')},'key':{'type':Sequelize[_0x0967('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x5')},'customerAlias':{'type':Sequelize[_0x0967('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0967('0x2')],'allowNull':![],'defaultValue':_0x0967('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0967('0x2')],'allowNull':![],'defaultValue':_0x0967('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0967('0x2')],'allowNull':![],'defaultValue':_0x0967('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x0967('0x2')],'allowNull':![],'defaultValue':_0x0967('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0967('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0967('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0967('0x9')](_0x0967('0xa'),_0x0967('0xb')),'defaultValue':_0x0967('0xa')},'header_online':{'type':Sequelize[_0x0967('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0xc')},'offline_chat_button':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x0967('0xe')},'download_transcript':{'type':Sequelize[_0x0967('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0967('0x11')]},'closingQuestion':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0967('0x15')},'placeholderMessage':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x16')},'closingMessage':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x17')},'closingMessageButton':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0xd')},'skipMessageButton':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x18')},'conditionAgreement':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0967('0x19')},'ratingType':{'type':Sequelize['ENUM'](_0x0967('0x1a'),'thumb'),'defaultValue':_0x0967('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x0967('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0967('0x11')],'defaultValue':function(){return JSON[_0x0967('0x1b')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0967('0x1c'),'type':_0x0967('0x1d'),'required':!![]},'props':{'title':_0x0967('0x1c'),'helpText':''}},{'type':_0x0967('0x1e'),'props':{'title':_0x0967('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0967('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0967('0x1f')](_0x0967('0x20'))?JSON[_0x0967('0x21')](this['getDataValue'](_0x0967('0x20'))):{};},'set':function(_0x41191e){return this[_0x0967('0x22')](_0x0967('0x20'),JSON[_0x0967('0x1b')](_0x41191e));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0967('0x1b')]({'items':[{'type':'input','props':{'title':_0x0967('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0967('0x4')},'variable':null},{'type':_0x0967('0x23'),'config':{'placeholder':_0x0967('0x24')},'props':{'title':_0x0967('0x24'),'helpText':_0x0967('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0x0967('0x1f')](_0x0967('0x26'))?JSON[_0x0967('0x21')](this[_0x0967('0x1f')]('offlineForm')):{};},'set':function(_0x11645f){return this[_0x0967('0x22')](_0x0967('0x26'),JSON[_0x0967('0x1b')](_0x11645f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0967('0x2')]},'waitingTitle':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x27')},'waitingMessage':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x0967('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x0967('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x0967('0x18')},'sendUnmanaged':{'type':Sequelize[_0x0967('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x0967('0x11')],'defaultValue':function(){return _0x0967('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0967('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0967('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x0967('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x2c')},'messagesAlignment':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x2d')},'defaultTitle':{'type':Sequelize[_0x0967('0x2')]},'customerAvatar':{'type':Sequelize[_0x0967('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0967('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0967('0x2')],'allowNull':![],'defaultValue':_0x0967('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0967('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0967('0x2')],'defaultValue':_0x0967('0x2f')},'systemAvatar':{'type':Sequelize[_0x0967('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0967('0x8')],'comment':_0x0967('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0967('0x31'),'set':function(_0xb65e38){if(!_0xb65e38)this[_0x0967('0x22')](_0x0967('0x32'),null);this['setDataValue'](_0x0967('0x33'),_0xb65e38);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0967('0x2')]},'vidaooTopic':{'type':Sequelize[_0x0967('0x2')],'allowNull':![],'defaultValue':_0x0967('0x34')},'vidaooNote':{'type':Sequelize[_0x0967('0x2')],'defaultValue':function(){return _0x0967('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x0967('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x0967('0xf')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0967('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 20ab415..09d36ab 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 _0xa8a8=['device','model','vendor','%s\x20%s\x20%s','type','stringify','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','length','find','create','body','address','forEach','trim','testWildcardValidity','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','describe','addDisposition','ChatWebsiteId','Disposition','order','sort','include','removeDispositions','ids','CannedAnswer','getAnswers','findOne','findAll','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','download','root','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','CmContact','createdAt','updatedAt','includes','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','DESC','Applications','Intervals','format','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','priority','asc','list','List','Contacts','contact','headers','threadId','ChatInteraction','customerIp','closed','externalUrl','interaction','lastName','messageId','created','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','server','attachments','offline-chat','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','\x22%s\x22\x20<%s>','email','offlineMessageSubject','mimetype','subjectOffline','toPairsIn','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','internal','Tags','color','tag','getSnippet','getProactiveActions','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','addApplications','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','./helpers/wildcard-expressions','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','update','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','user-agent-parser','setUA','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','%s\x20%s','unknown'];(function(_0x4baebc,_0x41de8c){var _0x31b89c=function(_0x368217){while(--_0x368217){_0x4baebc['push'](_0x4baebc['shift']());}};_0x31b89c(++_0x41de8c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4888a4,_0x46a30){_0x4888a4=_0x4888a4-0x0;var _0x1f2445=_0xa8a8[_0x4888a4];return _0x1f2445;};'use strict';var Mustache=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var ejs=require(_0x8a8a('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a8a('0x4'));var querystring=require(_0x8a8a('0x5'));var htmlToText=require(_0x8a8a('0x6'));var Redis=require(_0x8a8a('0x7'));var jayson=require(_0x8a8a('0x8'));var qs=require(_0x8a8a('0x9'));var logger=require(_0x8a8a('0xa'))(_0x8a8a('0xb'));var config=require(_0x8a8a('0xc'));var APIBadRequestError=require(_0x8a8a('0xd'))[_0x8a8a('0xe')];var APINotFoundError=require(_0x8a8a('0xd'))[_0x8a8a('0xf')];var APIOutOfIntervalError=require(_0x8a8a('0xd'))[_0x8a8a('0x10')];var APIHandleError=require('../../errors/api')['handleError'];var APIConflictError=require(_0x8a8a('0xd'))['APIConflictError'];var wildcardUtils=require(_0x8a8a('0x11'));var URL=require(_0x8a8a('0x12'))['URL'];var db=require(_0x8a8a('0x13'))['db'];config[_0x8a8a('0x14')]=_[_0x8a8a('0x15')](config['redis'],{'host':_0x8a8a('0x16'),'port':0x18eb});var socket=require(_0x8a8a('0x17'))(new Redis(config[_0x8a8a('0x14')]));require(_0x8a8a('0x18'))['register'](socket);var client=jayson[_0x8a8a('0x19')]['http']({'port':0x232c});var client9002=jayson[_0x8a8a('0x19')][_0x8a8a('0x1a')]({'port':0x232a});var client9003=jayson[_0x8a8a('0x19')][_0x8a8a('0x1a')]({'port':0x232b});var client9001=jayson[_0x8a8a('0x19')][_0x8a8a('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x16d38d,_0x51ce75,_0x1ed3be,_0x568b83){return new Promise(function(_0x1f36b6,_0x3046ae){var _0x46a4f4=_0x568b83||client;return _0x46a4f4[_0x8a8a('0x1b')](_0x16d38d,_0x1ed3be)[_0x8a8a('0x1c')](function(_0x5dd616){logger[_0x8a8a('0x1d')](_0x8a8a('0x1e'),_0x51ce75,_0x8a8a('0x1f'));logger[_0x8a8a('0x20')](_0x8a8a('0x21'),_0x51ce75,_0x8a8a('0x1f'),JSON['stringify'](_0x5dd616));if(_0x5dd616['error']){if(_0x5dd616['error']['code']===0x1f4){logger['error'](_0x8a8a('0x1e'),_0x51ce75,_0x5dd616[_0x8a8a('0x22')][_0x8a8a('0x23')]);return _0x3046ae(_0x5dd616[_0x8a8a('0x22')][_0x8a8a('0x23')]);}logger[_0x8a8a('0x22')](_0x8a8a('0x1e'),_0x51ce75,_0x5dd616[_0x8a8a('0x22')][_0x8a8a('0x23')]);return _0x1f36b6(_0x5dd616[_0x8a8a('0x22')][_0x8a8a('0x23')]);}else{logger[_0x8a8a('0x1d')](_0x8a8a('0x1e'),_0x51ce75,_0x8a8a('0x1f'));_0x1f36b6(_0x5dd616[_0x8a8a('0x24')]['message']);}})[_0x8a8a('0x25')](function(_0x16c55b){logger[_0x8a8a('0x22')](_0x8a8a('0x1e'),_0x51ce75,_0x16c55b);_0x3046ae(_0x16c55b);});});}function respondWithStatusCode(_0x36e6d4,_0x251315){_0x251315=_0x251315||0xcc;return function(_0x3aa46d){if(_0x3aa46d){return _0x36e6d4['sendStatus'](_0x251315);}return _0x36e6d4[_0x8a8a('0x26')](_0x251315)[_0x8a8a('0x27')]();};}function respondWithResult(_0x2e217a,_0x54ff7e){_0x54ff7e=_0x54ff7e||0xc8;return function(_0x58f42b){if(_0x58f42b){return _0x2e217a[_0x8a8a('0x26')](_0x54ff7e)[_0x8a8a('0x28')](_0x58f42b);}};}function respondWithFilteredResult(_0x5c70bd,_0x4d8760){return function(_0x4b3bc5){if(_0x4b3bc5){var _0x78fd48=typeof _0x4d8760['offset']===_0x8a8a('0x29')&&typeof _0x4d8760[_0x8a8a('0x2a')]==='undefined';var _0x36c7f8=_0x4b3bc5[_0x8a8a('0x2b')];var _0x250852=_0x78fd48?0x0:_0x4d8760[_0x8a8a('0x2c')];var _0x41802e=_0x78fd48?_0x4b3bc5[_0x8a8a('0x2b')]:_0x4d8760[_0x8a8a('0x2c')]+_0x4d8760[_0x8a8a('0x2a')];var _0x5768a6;if(_0x41802e>=_0x36c7f8){_0x41802e=_0x36c7f8;_0x5768a6=0xc8;}else{_0x5768a6=0xce;}_0x5c70bd['status'](_0x5768a6);return _0x5c70bd['set'](_0x8a8a('0x2d'),_0x250852+'-'+_0x41802e+'/'+_0x36c7f8)[_0x8a8a('0x28')](_0x4b3bc5);}return null;};}function saveUpdates(_0x5f301e){return function(_0x2b5dc9){if(_0x2b5dc9){return _0x2b5dc9[_0x8a8a('0x2e')](_0x5f301e)['then'](function(_0x3abab2){return _0x3abab2;});}return null;};}function removeEntity(_0x431b3a){return function(_0x63b9be){if(_0x63b9be){return _0x63b9be['destroy']()['then'](function(){var _0x8457a0=_0x63b9be['get']({'plain':!![]});var _0x2a3198=_0x8a8a('0x2f');return db[_0x8a8a('0x30')][_0x8a8a('0x31')]({'where':{'type':_0x2a3198,'resourceId':_0x8457a0['id']}})[_0x8a8a('0x1c')](function(){return _0x63b9be;});})[_0x8a8a('0x1c')](function(){_0x431b3a[_0x8a8a('0x26')](0xcc)[_0x8a8a('0x27')]();});}};}function handleEntityNotFound(_0x320398){return function(_0xf7d4d7){if(!_0xf7d4d7){_0x320398[_0x8a8a('0x32')](0x194);}return _0xf7d4d7;};}function handleError(_0x45ddb4,_0x17a36c){_0x17a36c=_0x17a36c||0x1f4;return function(_0x37e644){logger[_0x8a8a('0x22')](_0x37e644[_0x8a8a('0x33')]);if(_0x37e644[_0x8a8a('0x34')]){delete _0x37e644[_0x8a8a('0x34')];}_0x45ddb4['status'](_0x17a36c)['send'](_0x37e644);};}function createInteractionObject(_0x53da01,_0x34db33,_0x9e0128,_0x376de3){var _0x117a5c=require(_0x8a8a('0x35'));var _0x508e67=new _0x117a5c();var _0x4ee92e=_0x508e67[_0x8a8a('0x36')](_0x9e0128['user-agent'])[_0x8a8a('0x37')]();var _0x5c210e=_0x34db33['customerIp'];if(_0x9e0128[_0x8a8a('0x38')]){_0x5c210e=_0x9e0128[_0x8a8a('0x38')];}else if(_0x9e0128[_0x8a8a('0x39')]){_0x5c210e=_[_0x8a8a('0x3a')](_0x9e0128[_0x8a8a('0x39')][_0x8a8a('0x3b')](','));}return{'ContactId':_0x376de3['id'],'ChatWebsiteId':_0x53da01,'from':(_0x376de3[_0x8a8a('0x3c')]||'')+'\x20'+(_0x376de3['lastName']||''),'customerIp':_0x5c210e,'customerPort':_0x9e0128[_0x8a8a('0x3d')]?_0x9e0128[_0x8a8a('0x3d')]:null,'referer':_0x34db33[_0x8a8a('0x3e')],'browserName':_0x4ee92e['browser'][_0x8a8a('0x34')]&&_0x4ee92e[_0x8a8a('0x3f')][_0x8a8a('0x40')]?util['format'](_0x8a8a('0x41'),_0x4ee92e[_0x8a8a('0x3f')][_0x8a8a('0x34')],_0x4ee92e[_0x8a8a('0x3f')][_0x8a8a('0x40')]):_0x8a8a('0x42'),'browserVersion':_0x4ee92e['browser']['version']||_0x8a8a('0x42'),'osName':util['format'](_0x8a8a('0x41'),_0x4ee92e['os'][_0x8a8a('0x34')],_0x4ee92e['os']['version']),'osVersion':_0x4ee92e['os']['version'],'deviceModel':_0x4ee92e[_0x8a8a('0x43')][_0x8a8a('0x44')]&&_0x4ee92e[_0x8a8a('0x43')][_0x8a8a('0x45')]?util['format'](_0x8a8a('0x46'),_0x4ee92e['device'][_0x8a8a('0x44')],_0x4ee92e[_0x8a8a('0x43')]['vendor'],_0x4ee92e[_0x8a8a('0x43')][_0x8a8a('0x47')]):null,'deviceVendor':_0x4ee92e[_0x8a8a('0x43')]['vendor'],'deviceType':_0x4ee92e[_0x8a8a('0x43')][_0x8a8a('0x47')],'formData':JSON[_0x8a8a('0x48')](_0x34db33)};}exports['index']=function(_0x5466d4,_0x44aed3){var _0x1eb8bf={'include':[{'model':db[_0x8a8a('0x49')],'as':_0x8a8a('0x4a')}]},_0x1b842a={},_0x5c6c98={'count':0x0,'rows':[]};var _0x86588c=_[_0x8a8a('0x4b')](db[_0x8a8a('0x4c')][_0x8a8a('0x4d')],function(_0x13c233){return{'name':_0x13c233[_0x8a8a('0x4e')],'type':_0x13c233[_0x8a8a('0x47')][_0x8a8a('0x4f')]};});_0x1b842a[_0x8a8a('0x44')]=_['map'](_0x86588c,_0x8a8a('0x34'));_0x1b842a[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x5466d4[_0x8a8a('0x50')]);_0x1b842a[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x1b842a['model'],_0x1b842a[_0x8a8a('0x50')]);_0x1eb8bf[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x1b842a[_0x8a8a('0x44')],qs['fields'](_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x1eb8bf[_0x8a8a('0x54')]=_0x1eb8bf['attributes']['length']?_0x1eb8bf[_0x8a8a('0x54')]:_0x1b842a[_0x8a8a('0x44')];if(!_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x56')](_0x8a8a('0x57'))){_0x1eb8bf[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x2a')]);_0x1eb8bf['offset']=qs['offset'](_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}_0x1eb8bf['order']=qs['sort'](_0x5466d4[_0x8a8a('0x50')]['sort']);_0x1eb8bf[_0x8a8a('0x58')]=qs['filters'](_[_0x8a8a('0x59')](_0x5466d4[_0x8a8a('0x50')],_0x1b842a[_0x8a8a('0x52')]),_0x86588c);if(_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x5a')]){_0x1eb8bf[_0x8a8a('0x58')]=_[_0x8a8a('0x5b')](_0x1eb8bf[_0x8a8a('0x58')],{'$or':_[_0x8a8a('0x4b')](_0x86588c,function(_0x2c771e){if(_0x2c771e['type']!==_0x8a8a('0x5c')){var _0x133bae={};_0x133bae[_0x2c771e[_0x8a8a('0x34')]]={'$like':'%'+_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x5a')]+'%'};return _0x133bae;}})});}_0x1eb8bf=_['merge']({},_0x1eb8bf,_0x5466d4[_0x8a8a('0x5d')]);var _0x140673={'where':_0x1eb8bf['where']};return db['ChatWebsite'][_0x8a8a('0x2b')](_0x140673)[_0x8a8a('0x1c')](function(_0x322b4c){_0x5c6c98[_0x8a8a('0x2b')]=_0x322b4c;if(_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x5e')]){_0x1eb8bf['include']=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x1eb8bf);})[_0x8a8a('0x1c')](function(_0x54d848){_0x5c6c98[_0x8a8a('0x5f')]=_0x54d848;return _0x5c6c98;})[_0x8a8a('0x1c')](respondWithFilteredResult(_0x44aed3,_0x1eb8bf))['catch'](handleError(_0x44aed3,null));};exports[_0x8a8a('0x60')]=function(_0x38ba9f,_0x183f88){var _0x119fb5={'raw':![],'where':{'id':_0x38ba9f[_0x8a8a('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x8a8a('0x4a')}]},_0x4cf6ae={};_0x4cf6ae[_0x8a8a('0x44')]=_['keys'](db[_0x8a8a('0x4c')][_0x8a8a('0x4d')]);_0x4cf6ae[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x38ba9f['query']);_0x4cf6ae[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x4cf6ae[_0x8a8a('0x44')],_0x4cf6ae['query']);_0x119fb5['attributes']=_[_0x8a8a('0x53')](_0x4cf6ae['model'],qs['fields'](_0x38ba9f['query'][_0x8a8a('0x55')]));_0x119fb5[_0x8a8a('0x54')]=_0x119fb5['attributes'][_0x8a8a('0x62')]?_0x119fb5['attributes']:_0x4cf6ae['model'];if(_0x38ba9f[_0x8a8a('0x50')][_0x8a8a('0x5e')]){_0x119fb5['include']=[{'all':!![]}];}_0x119fb5=_[_0x8a8a('0x5b')]({},_0x119fb5,_0x38ba9f[_0x8a8a('0x5d')]);return db[_0x8a8a('0x4c')][_0x8a8a('0x63')](_0x119fb5)[_0x8a8a('0x1c')](handleEntityNotFound(_0x183f88,null))[_0x8a8a('0x1c')](respondWithResult(_0x183f88,null))['catch'](handleError(_0x183f88,null));};exports[_0x8a8a('0x64')]=function(_0x402b5f,_0x587ea8){var _0x2ce579=null;_0x402b5f[_0x8a8a('0x65')][_0x8a8a('0x66')][_0x8a8a('0x3b')](',')[_0x8a8a('0x67')](_0x450afc=>{if(_0x450afc[_0x8a8a('0x68')]()!==''&&!wildcardUtils[_0x8a8a('0x69')](_0x450afc[_0x8a8a('0x68')]())){_0x2ce579=new APIBadRequestError('\x22'+_0x450afc[_0x8a8a('0x68')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x2ce579){return handleError(_0x587ea8,null)(_0x2ce579);}return db[_0x8a8a('0x4c')][_0x8a8a('0x64')](_0x402b5f['body'],{})[_0x8a8a('0x1c')](function(_0x1f90af){var _0x2640e3=_0x402b5f[_0x8a8a('0x6a')][_0x8a8a('0x6b')]({'plain':!![]});if(!_0x2640e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2640e3[_0x8a8a('0x6c')]===_0x8a8a('0x6a')){var _0x3edc54=_0x1f90af[_0x8a8a('0x6b')]({'plain':!![]});var _0x3fc483=_0x8a8a('0x2f');return db[_0x8a8a('0x6d')]['find']({'where':{'name':_0x3fc483,'userProfileId':_0x2640e3[_0x8a8a('0x6e')]},'raw':!![]})[_0x8a8a('0x1c')](function(_0x35ed30){if(_0x35ed30&&_0x35ed30['autoAssociation']===0x0){return db[_0x8a8a('0x30')]['create']({'name':_0x3edc54[_0x8a8a('0x34')],'resourceId':_0x3edc54['id'],'type':_0x35ed30[_0x8a8a('0x34')],'sectionId':_0x35ed30['id']},{})['then'](function(){return _0x1f90af;});}else{return _0x1f90af;}})[_0x8a8a('0x25')](function(_0x42891b){logger[_0x8a8a('0x22')](_0x8a8a('0x6f'),_0x42891b);throw _0x42891b;});}return _0x1f90af;})[_0x8a8a('0x1c')](respondWithResult(_0x587ea8,0xc9))[_0x8a8a('0x25')](handleError(_0x587ea8,null));};exports[_0x8a8a('0x2e')]=function(_0x25b684,_0x31c0dc){var _0x218e5b=null;_0x25b684[_0x8a8a('0x65')][_0x8a8a('0x66')][_0x8a8a('0x3b')](',')[_0x8a8a('0x67')](_0x8a0a49=>{if(_0x8a0a49[_0x8a8a('0x68')]()!==''&&!wildcardUtils[_0x8a8a('0x69')](_0x8a0a49[_0x8a8a('0x68')]())){_0x218e5b=new APIBadRequestError('\x22'+_0x8a0a49['trim']()+_0x8a8a('0x70'));}});if(_0x218e5b){return handleError(_0x31c0dc,null)(_0x218e5b);}if(_0x25b684['body']['id']){delete _0x25b684[_0x8a8a('0x65')]['id'];}return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x25b684['params']['id']},'include':[{'model':db['Pause'],'as':_0x8a8a('0x4a')}]})[_0x8a8a('0x1c')](handleEntityNotFound(_0x31c0dc,null))[_0x8a8a('0x1c')](saveUpdates(_0x25b684['body'],null))['then'](respondWithResult(_0x31c0dc,null))[_0x8a8a('0x25')](handleError(_0x31c0dc,null));};exports[_0x8a8a('0x31')]=function(_0x46a556,_0x155cc4){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x46a556[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x155cc4,null))['then'](removeEntity(_0x155cc4,null))[_0x8a8a('0x25')](handleError(_0x155cc4,null));};exports[_0x8a8a('0x71')]=function(_0x4a906c,_0x3158f2){return db[_0x8a8a('0x4c')][_0x8a8a('0x71')]()[_0x8a8a('0x1c')](respondWithResult(_0x3158f2,null))[_0x8a8a('0x25')](handleError(_0x3158f2,null));};exports[_0x8a8a('0x72')]=function(_0x4a886f,_0x2924a4){if(_0x4a886f[_0x8a8a('0x65')]['id']){delete _0x4a886f[_0x8a8a('0x65')]['id'];}return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x4a886f['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x2924a4,null))[_0x8a8a('0x1c')](function(_0x34d140){if(_0x34d140){_0x4a886f[_0x8a8a('0x65')][_0x8a8a('0x73')]=_0x34d140['id'];return db[_0x8a8a('0x74')][_0x8a8a('0x64')](_0x4a886f[_0x8a8a('0x65')]);}})[_0x8a8a('0x1c')](respondWithResult(_0x2924a4,null))[_0x8a8a('0x25')](handleError(_0x2924a4,null));};exports['getDispositions']=function(_0x306a50,_0x20b40e){var _0x3bb8d7={'raw':![],'where':{}};var _0x3391b5={};var _0xb74976={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x306a50[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x20b40e,null))[_0x8a8a('0x1c')](function(_0x50b105){if(_0x50b105){_0x3391b5[_0x8a8a('0x44')]=_[_0x8a8a('0x51')](db[_0x8a8a('0x74')][_0x8a8a('0x4d')]);_0x3391b5['query']=_[_0x8a8a('0x51')](_0x306a50[_0x8a8a('0x50')]);_0x3391b5[_0x8a8a('0x52')]=_['intersection'](_0x3391b5['model'],_0x3391b5['query']);_0x3bb8d7[_0x8a8a('0x54')]=_['intersection'](_0x3391b5[_0x8a8a('0x44')],qs['fields'](_0x306a50['query'][_0x8a8a('0x55')]));_0x3bb8d7['attributes']=_0x3bb8d7['attributes']['length']?_0x3bb8d7[_0x8a8a('0x54')]:_0x3391b5['model'];if(!_0x306a50['query'][_0x8a8a('0x56')]('nolimit')){_0x3bb8d7[_0x8a8a('0x2a')]=qs['limit'](_0x306a50[_0x8a8a('0x50')][_0x8a8a('0x2a')]);_0x3bb8d7[_0x8a8a('0x2c')]=qs[_0x8a8a('0x2c')](_0x306a50['query'][_0x8a8a('0x2c')]);}_0x3bb8d7[_0x8a8a('0x75')]=qs['sort'](_0x306a50[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x3bb8d7[_0x8a8a('0x58')]=qs[_0x8a8a('0x52')](_['pick'](_0x306a50['query'],_0x3391b5[_0x8a8a('0x52')]));_0x3bb8d7[_0x8a8a('0x58')][_0x8a8a('0x73')]=_0x50b105['id'];if(_0x306a50['query'][_0x8a8a('0x5a')]){_0x3bb8d7[_0x8a8a('0x58')]=_[_0x8a8a('0x5b')](_0x3bb8d7['where'],{'$or':_[_0x8a8a('0x4b')](_0x3bb8d7[_0x8a8a('0x54')],function(_0x1e60a6){var _0x3a7e46={};_0x3a7e46[_0x1e60a6]={'$like':'%'+_0x306a50[_0x8a8a('0x50')]['filter']+'%'};return _0x3a7e46;})});}_0x3bb8d7=_[_0x8a8a('0x5b')]({},_0x3bb8d7,_0x306a50[_0x8a8a('0x5d')]);return db[_0x8a8a('0x74')][_0x8a8a('0x2b')]({'where':_0x3bb8d7[_0x8a8a('0x58')]})[_0x8a8a('0x1c')](function(_0x276126){_0xb74976['count']=_0x276126;if(_0x306a50['query'][_0x8a8a('0x5e')]){_0x3bb8d7[_0x8a8a('0x77')]=[{'all':!![]}];}return db[_0x8a8a('0x74')]['findAll'](_0x3bb8d7);})[_0x8a8a('0x1c')](function(_0xd53cec){_0xb74976[_0x8a8a('0x5f')]=_0xd53cec;return _0xb74976;});}})[_0x8a8a('0x1c')](respondWithFilteredResult(_0x20b40e,_0x3bb8d7))[_0x8a8a('0x25')](handleError(_0x20b40e,null));};exports[_0x8a8a('0x78')]=function(_0x3a0e27,_0x26d57f){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x3a0e27['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x26d57f,null))[_0x8a8a('0x1c')](function(_0x311c6c){if(_0x311c6c){return _0x311c6c['removeDispositions'](_0x3a0e27[_0x8a8a('0x50')][_0x8a8a('0x79')]);}})[_0x8a8a('0x1c')](respondWithStatusCode(_0x26d57f,null))['catch'](handleError(_0x26d57f,null));};exports['addAnswer']=function(_0x1f409b,_0x450b1a){if(_0x1f409b[_0x8a8a('0x65')]['id']){delete _0x1f409b[_0x8a8a('0x65')]['id'];}return db['ChatWebsite'][_0x8a8a('0x63')]({'where':{'id':_0x1f409b[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x450b1a,null))[_0x8a8a('0x1c')](function(_0x5df060){if(_0x5df060){_0x1f409b['body'][_0x8a8a('0x73')]=_0x5df060['id'];return db[_0x8a8a('0x7a')][_0x8a8a('0x64')](_0x1f409b['body']);}})[_0x8a8a('0x1c')](respondWithResult(_0x450b1a,null))[_0x8a8a('0x25')](handleError(_0x450b1a,null));};exports[_0x8a8a('0x7b')]=function(_0x198083,_0x31f2e6){var _0x5ac7b7={'raw':![],'where':{}};var _0x5ac592={};var _0x5d727e={'count':0x0,'rows':[]};return db[_0x8a8a('0x4c')][_0x8a8a('0x7c')]({'where':{'id':_0x198083[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x31f2e6,null))[_0x8a8a('0x1c')](function(_0x34502e){if(_0x34502e){_0x5ac592['model']=_[_0x8a8a('0x51')](db[_0x8a8a('0x7a')]['rawAttributes']);_0x5ac592['query']=_[_0x8a8a('0x51')](_0x198083[_0x8a8a('0x50')]);_0x5ac592['filters']=_[_0x8a8a('0x53')](_0x5ac592['model'],_0x5ac592['query']);_0x5ac7b7[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x5ac592[_0x8a8a('0x44')],qs['fields'](_0x198083[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x5ac7b7[_0x8a8a('0x54')]=_0x5ac7b7[_0x8a8a('0x54')][_0x8a8a('0x62')]?_0x5ac7b7[_0x8a8a('0x54')]:_0x5ac592['model'];if(!_0x198083['query']['hasOwnProperty'](_0x8a8a('0x57'))){_0x5ac7b7[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x198083[_0x8a8a('0x50')][_0x8a8a('0x2a')]);_0x5ac7b7[_0x8a8a('0x2c')]=qs[_0x8a8a('0x2c')](_0x198083[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}_0x5ac7b7['order']=qs[_0x8a8a('0x76')](_0x198083[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x5ac7b7[_0x8a8a('0x58')]=qs[_0x8a8a('0x52')](_[_0x8a8a('0x59')](_0x198083['query'],_0x5ac592['filters']));_0x5ac7b7['where'][_0x8a8a('0x73')]=_0x34502e['id'];if(_0x198083['query'][_0x8a8a('0x5a')]){_0x5ac7b7['where']=_[_0x8a8a('0x5b')](_0x5ac7b7['where'],{'$or':_[_0x8a8a('0x4b')](_0x5ac7b7[_0x8a8a('0x54')],function(_0x5e8094){var _0x12110e={};_0x12110e[_0x5e8094]={'$like':'%'+_0x198083['query']['filter']+'%'};return _0x12110e;})});}_0x5ac7b7=_[_0x8a8a('0x5b')]({},_0x5ac7b7,_0x198083['options']);return db[_0x8a8a('0x7a')]['count']({'where':_0x5ac7b7[_0x8a8a('0x58')]})['then'](function(_0x34aa82){_0x5d727e[_0x8a8a('0x2b')]=_0x34aa82;if(_0x198083[_0x8a8a('0x50')][_0x8a8a('0x5e')]){_0x5ac7b7['include']=[{'all':!![]}];}return db[_0x8a8a('0x7a')][_0x8a8a('0x7d')](_0x5ac7b7);})[_0x8a8a('0x1c')](function(_0x33ac80){_0x5d727e['rows']=_0x33ac80;return _0x5d727e;});}})[_0x8a8a('0x1c')](respondWithFilteredResult(_0x31f2e6,_0x5ac7b7))[_0x8a8a('0x25')](handleError(_0x31f2e6,null));};exports[_0x8a8a('0x7e')]=function(_0x4e4983,_0xd5f3cf){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x4e4983[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0xd5f3cf,null))['then'](function(_0x5b5087){if(_0x5b5087){return _0x5b5087[_0x8a8a('0x7e')](_0x4e4983[_0x8a8a('0x50')][_0x8a8a('0x79')]);}})['then'](respondWithStatusCode(_0xd5f3cf,null))[_0x8a8a('0x25')](handleError(_0xd5f3cf,null));};exports[_0x8a8a('0x7f')]=function(_0x559f13,_0x568cb2){_0x559f13[_0x8a8a('0x65')][_0x8a8a('0x80')]=_0x559f13[_0x8a8a('0x81')]['filename'];return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x559f13['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x568cb2,null))[_0x8a8a('0x1c')](saveUpdates(_0x559f13['body'],null))[_0x8a8a('0x1c')](respondWithResult(_0x568cb2,null))['catch'](handleError(_0x568cb2,null));};exports[_0x8a8a('0x82')]=function(_0x16a4a8,_0x575f64){_0x16a4a8[_0x8a8a('0x65')][_0x8a8a('0x83')]=_0x16a4a8['file'][_0x8a8a('0x84')];return db['ChatWebsite'][_0x8a8a('0x63')]({'where':{'id':_0x16a4a8[_0x8a8a('0x61')]['id']}})['then'](handleEntityNotFound(_0x575f64,null))[_0x8a8a('0x1c')](saveUpdates(_0x16a4a8[_0x8a8a('0x65')],null))[_0x8a8a('0x1c')](respondWithResult(_0x575f64,null))['catch'](handleError(_0x575f64,null));};exports[_0x8a8a('0x85')]=function(_0x4d1fc0,_0x269d17){_0x4d1fc0[_0x8a8a('0x65')][_0x8a8a('0x86')]=_0x4d1fc0[_0x8a8a('0x81')][_0x8a8a('0x84')];return db['ChatWebsite'][_0x8a8a('0x63')]({'where':{'id':_0x4d1fc0[_0x8a8a('0x61')]['id']}})['then'](handleEntityNotFound(_0x269d17,null))[_0x8a8a('0x1c')](saveUpdates(_0x4d1fc0[_0x8a8a('0x65')],null))[_0x8a8a('0x1c')](respondWithResult(_0x269d17,null))['catch'](handleError(_0x269d17,null));};exports['addSystemAvatar']=function(_0x35d9e2,_0x1cb3aa){_0x35d9e2[_0x8a8a('0x65')][_0x8a8a('0x87')]=_0x35d9e2[_0x8a8a('0x81')][_0x8a8a('0x84')];return db[_0x8a8a('0x4c')]['find']({'where':{'id':_0x35d9e2['params']['id']}})['then'](handleEntityNotFound(_0x1cb3aa,null))[_0x8a8a('0x1c')](saveUpdates(_0x35d9e2[_0x8a8a('0x65')],null))[_0x8a8a('0x1c')](respondWithResult(_0x1cb3aa,null))['catch'](handleError(_0x1cb3aa,null));};exports[_0x8a8a('0x88')]=function(_0xe6030b,_0x39d705){var _0x19c264=path[_0x8a8a('0x89')](config['root'],_0x8a8a('0x8a'));var _0xde7f73={'where':{'id':_0xe6030b[_0x8a8a('0x61')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x913a2f=![];return require(_0x8a8a('0x8b'))[_0x8a8a('0x8c')]()['then'](function(_0x4a2af9){if(_0x4a2af9){_0x913a2f=_0x4a2af9[_0x8a8a('0x8d')];}})[_0x8a8a('0x1c')](function(){return db[_0x8a8a('0x4c')]['find'](_0xde7f73);})[_0x8a8a('0x1c')](handleEntityNotFound(_0x39d705,null))[_0x8a8a('0x1c')](function(_0x5b555e){if(_0x5b555e){if(!_[_0x8a8a('0x8e')](_0x5b555e[_0x8a8a('0x80')])){if(fs['existsSync'](path[_0x8a8a('0x89')](config['root'],'server/files/images/logos/',_0x5b555e[_0x8a8a('0x80')]))&&_0x913a2f){_0x19c264=path[_0x8a8a('0x89')](config['root'],'server/files/images/logos/',_0x5b555e['sitepic']);}}return _0x39d705[_0x8a8a('0x8f')](_0x19c264);}})['catch'](handleError(_0x39d705,null));};exports['getAvatar']=function(_0xc0fb22,_0x69e16){var _0x58ac24=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x91'));var _0x43ab4d={'where':{'id':_0xc0fb22[_0x8a8a('0x61')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x8a8a('0x4c')]['find'](_0x43ab4d)[_0x8a8a('0x1c')](handleEntityNotFound(_0x69e16,null))[_0x8a8a('0x1c')](function(_0x9bd75e){if(_0x9bd75e){if(!_[_0x8a8a('0x8e')](_0x9bd75e['agentAvatar'])){if(fs['existsSync'](path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],'server/files/images/avatars/',_0x9bd75e[_0x8a8a('0x83')]))){_0x58ac24=path[_0x8a8a('0x89')](config['root'],_0x8a8a('0x92'),_0x9bd75e[_0x8a8a('0x83')]);}}return _0x69e16[_0x8a8a('0x8f')](_0x58ac24);}})['catch'](handleError(_0x69e16,null));};exports['getCustomerAvatar']=function(_0x83f17d,_0x4d9d70){var _0x46aff7=path['join'](config[_0x8a8a('0x90')],'server/files/images/avatars/customer_avatar.png');var _0x4caec3={'where':{'id':_0x83f17d['params']['id']},'attributes':['id','customerAvatar',_0x8a8a('0x93')],'raw':!![]};return db[_0x8a8a('0x4c')][_0x8a8a('0x63')](_0x4caec3)['then'](handleEntityNotFound(_0x4d9d70,null))[_0x8a8a('0x1c')](function(_0x16b941){if(_0x16b941){if(!_[_0x8a8a('0x8e')](_0x16b941[_0x8a8a('0x86')])){if(fs[_0x8a8a('0x94')](path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],'server/files/images/avatars/',_0x16b941['customerAvatar']))&&_0x16b941[_0x8a8a('0x93')]){_0x46aff7=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],'server/files/images/avatars/',_0x16b941[_0x8a8a('0x86')]);}}return _0x4d9d70[_0x8a8a('0x8f')](_0x46aff7);}})[_0x8a8a('0x25')](handleError(_0x4d9d70,null));};exports[_0x8a8a('0x95')]=function(_0x5130d3,_0x5023d7){var _0x45647=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x96'));var _0x3a30c6={'where':{'id':_0x5130d3[_0x8a8a('0x61')]['id']},'attributes':['id',_0x8a8a('0x87')],'raw':!![]};return db[_0x8a8a('0x4c')][_0x8a8a('0x63')](_0x3a30c6)[_0x8a8a('0x1c')](handleEntityNotFound(_0x5023d7,null))[_0x8a8a('0x1c')](function(_0x5376b6){if(_0x5376b6){if(!_[_0x8a8a('0x8e')](_0x5376b6[_0x8a8a('0x87')])){if(fs[_0x8a8a('0x94')](path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x92'),_0x5376b6[_0x8a8a('0x87')]))){_0x45647=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x92'),_0x5376b6[_0x8a8a('0x87')]);}}return _0x5023d7['download'](_0x45647);}})[_0x8a8a('0x25')](handleError(_0x5023d7,null));};function checkWebsiteInterval(_0x211dfc){var _0x2d7ed6=_0x211dfc[_0x8a8a('0x97')];if(!_0x2d7ed6){return Promise['resolve'](_0x211dfc);}var _0x44561a=_0x211dfc[_0x8a8a('0x98')]||undefined;return _0x2d7ed6[_0x8a8a('0x99')](_0x44561a)[_0x8a8a('0x1c')](function(_0x474e27){if(!_0x474e27){throw new APIOutOfIntervalError();}return _0x211dfc;});}exports[_0x8a8a('0x9a')]=function(_0x59ed64,_0x33667d){var _0x3c2e96={'body':_0x59ed64[_0x8a8a('0x65')],'channel':_0x8a8a('0x9b')};var _0x35bb17=[];var _0x17e607=[];var _0x184310={};var _0xfa3640=![];if(_0x59ed64['body']['id']){delete _0x59ed64[_0x8a8a('0x65')]['id'];}if(_[_0x8a8a('0x8e')](_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9c')])){throw new APIBadRequestError(_0x8a8a('0x9d'));}if(_[_0x8a8a('0x8e')](_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9e')])){throw new APIBadRequestError(_0x8a8a('0x9f'));}if(_['isEmpty'](_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x65')])){throw new APIBadRequestError(_0x8a8a('0xa0'));}var _0x1f54d4=_0x59ed64[_0x8a8a('0x65')]['customerIp']&&_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x3e')];return db[_0x8a8a('0xa1')][_0x8a8a('0x71')]()[_0x8a8a('0x1c')](function(_0x55e474){if(!_0x55e474){throw new Error('No\x20available\x20attributes');}_0x35bb17=Object['keys'](_0x55e474)[_0x8a8a('0x5a')](function(_0x3074a2){return![_0x8a8a('0xa2'),_0x8a8a('0xa3')][_0x8a8a('0xa4')](_0x3074a2);});_0x17e607=Object[_0x8a8a('0x51')](_0x55e474)['filter'](function(_0x1c7c8a){return![_0x8a8a('0xa2'),_0x8a8a('0xa3'),'CompanyId',_0x8a8a('0xa5')][_0x8a8a('0xa4')](_0x1c7c8a);});if(!_[_0x8a8a('0xa4')](_0x17e607,_0x59ed64['body'][_0x8a8a('0x9e')])){throw new APIBadRequestError(_0x8a8a('0xa6')+_0x17e607['join'](',\x20'));}_0x184310[_0x59ed64['body'][_0x8a8a('0x9e')]]=_0x59ed64['body']['from'];})['then'](function(){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x59ed64[_0x8a8a('0x61')]['id']},'include':[{'model':db[_0x8a8a('0xa7')],'as':'List','include':[{'model':db[_0x8a8a('0xa1')],'as':'Contacts','where':_0x184310,'limit':0x1,'order':[[_0x8a8a('0xa3'),_0x8a8a('0xa8')]]}]},{'model':db['ChatApplication'],'as':_0x8a8a('0xa9')},{'model':db[_0x8a8a('0x97')],'as':'Interval','include':[{'model':db[_0x8a8a('0x97')],'as':_0x8a8a('0xaa'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x8a8a('0x1c')](function(_0x1dc93c){if(!_0x1dc93c){throw new APINotFoundError(util[_0x8a8a('0xab')](_0x8a8a('0xac'),_0x59ed64[_0x8a8a('0x61')]['id']));}if(_0x1f54d4){return checkWebsiteInterval(_0x1dc93c);}return _0x1dc93c;})['then'](function(_0x5ab5e1){_0x3c2e96[_0x8a8a('0xad')]=_0x5ab5e1;_0x3c2e96[_0x8a8a('0xae')]=_['orderBy'](_0x5ab5e1[_0x8a8a('0xa9')],[_0x8a8a('0xaf')],[_0x8a8a('0xb0')]);if(_0x3c2e96[_0x8a8a('0xad')][_0x8a8a('0xa9')]){delete _0x3c2e96[_0x8a8a('0xad')][_0x8a8a('0xa9')];}_0x3c2e96[_0x8a8a('0xb1')]=_0x5ab5e1[_0x8a8a('0xb2')]||{'id':_0x5ab5e1[_0x8a8a('0xa5')]};if(_0x3c2e96[_0x8a8a('0xb1')]&&_0x3c2e96[_0x8a8a('0xb1')][_0x8a8a('0xb3')]['length']){return _0x3c2e96[_0x8a8a('0xb1')][_0x8a8a('0xb3')][0x0];}var _0x3d4dee=_['defaults'](_0x59ed64[_0x8a8a('0x65')],{'firstName':_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9c')],'ListId':_0x5ab5e1[_0x8a8a('0xa5')]});_0x3d4dee[_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9e')]]=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9c')];return db[_0x8a8a('0xa1')][_0x8a8a('0x64')](_0x3d4dee,{'fields':_0x35bb17,'raw':!![]});})[_0x8a8a('0x1c')](function(_0x5c9358){_0x3c2e96[_0x8a8a('0xb4')]=_0x5c9358;var _0x35d518=createInteractionObject(_0x59ed64[_0x8a8a('0x61')]['id'],_0x59ed64[_0x8a8a('0x65')],_0x59ed64[_0x8a8a('0xb5')],_0x5c9358);var _0x3f0724={'ChatWebsiteId':_0x59ed64[_0x8a8a('0x61')]['id']};if(_0x59ed64['body'][_0x8a8a('0xb6')]){_0x3f0724[_0x8a8a('0xb6')]=_0x59ed64['body'][_0x8a8a('0xb6')];_0x3f0724['closed']=![];return db[_0x8a8a('0xb7')][_0x8a8a('0x63')]({'where':_0x3f0724})['then'](function(_0x2d8647){var _0x32ba47=_0x59ed64['body'][_0x8a8a('0xb8')]&&_0x59ed64[_0x8a8a('0x65')]['referer'];if(_0x2d8647){_0xfa3640=!![];return _0x2d8647;}else if(!_0x32ba47&&_0x2d8647&&_0x2d8647[_0x8a8a('0xb9')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x35d518[_0x8a8a('0xb6')]=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xb6')];_0x35d518['externalUrl']=_0x59ed64['body'][_0x8a8a('0xba')];return db['ChatInteraction'][_0x8a8a('0x64')](_0x35d518);});}_0x3f0724['ContactId']=_0x5c9358['id'];if(_0x59ed64['body'][_0x8a8a('0xbb')]&&_0x59ed64['body']['interaction']['id']){_0x3f0724['id']=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xbb')]['id'];return db[_0x8a8a('0xb7')][_0x8a8a('0x63')]({'where':_0x3f0724})[_0x8a8a('0x1c')](function(_0x4cb1da){var _0x3d757a=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xb8')]&&_0x59ed64['body'][_0x8a8a('0x3e')];if(!_0x3d757a&&_0x4cb1da&&_0x4cb1da['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x4cb1da){_0xfa3640=!![];return _0x4cb1da;}else{return db['ChatInteraction'][_0x8a8a('0x64')](_0x35d518);}});}return db['ChatInteraction']['create'](_0x35d518);})['then'](function(_0x203b2d){if(!_0xfa3640){return _0x203b2d;}var _0x159c37={'from':(_0x3c2e96[_0x8a8a('0xb4')][_0x8a8a('0x3c')]||'')+'\x20'+(_0x3c2e96['contact'][_0x8a8a('0xbc')]||'')};if(_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xb6')]&&_0x59ed64['body'][_0x8a8a('0xbd')]&&_0x59ed64['body']['threadId']!=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xbd')]){_0x159c37[_0x8a8a('0xb6')]=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xbd')];}return _0x203b2d['update'](_0x159c37);})[_0x8a8a('0x1c')](function(_0x33e008){_0x3c2e96[_0x8a8a('0xbb')]=_0x33e008[_0x8a8a('0x6b')]({'plain':!![]});_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xbe')]=!_0xfa3640;if(_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xbe')]){if(_0x3c2e96[_0x8a8a('0xad')]['autoclose']){_0x3c2e96[_0x8a8a('0xae')]['push']({'id':0x0,'priority':_0x3c2e96[_0x8a8a('0xae')][_0x8a8a('0x62')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x8a8a('0xbf')});}}return db[_0x8a8a('0xc0')][_0x8a8a('0x64')]({'body':_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x65')],'ChatWebsiteId':_0x59ed64[_0x8a8a('0x61')]['id'],'ChatInteractionId':_0x33e008['id'],'direction':'in','ContactId':_0x3c2e96[_0x8a8a('0xb4')]['id'],'AttachmentId':_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xc1')]});})[_0x8a8a('0x1c')](function(_0x3e4b43){_0x3c2e96[_0x8a8a('0x23')]=_0x3e4b43;if(!_0x3c2e96[_0x8a8a('0xbb')]['UserId']){return;}return db[_0x8a8a('0xc2')][_0x8a8a('0x63')]({'attributes':['id',_0x8a8a('0x34')],'where':{'id':_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xc3')]}});})[_0x8a8a('0x1c')](function(_0x5a7fcd){if(_0x5a7fcd){_0x3c2e96[_0x8a8a('0xae')][_0x8a8a('0xc4')]({'id':0x0,'priority':0x0,'app':_0x8a8a('0xc5'),'appdata':_0x5a7fcd[_0x8a8a('0x34')]+','+(_0x3c2e96[_0x8a8a('0xad')][_0x8a8a('0xc6')]||0xa),'interval':_0x8a8a('0xbf')});_0x3c2e96[_0x8a8a('0xc7')]=!![];}if(!_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xc8')]){return;}return db[_0x8a8a('0xc9')][_0x8a8a('0x63')]({'attributes':['id',_0x8a8a('0x34')],'where':{'id':_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xc8')]}});})[_0x8a8a('0x1c')](function(_0x433051){if(_0x433051){_0x3c2e96[_0x8a8a('0xae')][_0x8a8a('0xc4')]({'id':0x0,'priority':0x1,'app':_0x8a8a('0xca'),'appdata':_0x433051[_0x8a8a('0x34')]+','+(_0x3c2e96[_0x8a8a('0xad')][_0x8a8a('0xcb')]||0x12c),'interval':_0x8a8a('0xbf')});}return respondWithRpcPromise('Start','startRouting',_0x3c2e96);})[_0x8a8a('0x1c')](function(_0x55d97e){respondWithRpcPromise(_0x8a8a('0xcc'),_0x8a8a('0xcc'),{'event':_0x8a8a('0x9a'),'message':_0x55d97e},client9002);return _0x55d97e;})[_0x8a8a('0x1c')](respondWithResult(_0x33667d,null))['catch'](APIHandleError(_0x33667d));};exports[_0x8a8a('0xcd')]=function(_0x1cad71,_0x2ae822){var _0xb988c3,_0x36e8c6,_0x204dde;var _0x155a64=[];var _0x21504d={};var _0x123c98=_0x1cad71[_0x8a8a('0xce')]||[];var _0x2c82d4=[];var _0x4bf38e;return db[_0x8a8a('0xa1')][_0x8a8a('0x71')]()[_0x8a8a('0x1c')](function(_0xb2fc5b){if(!_0xb2fc5b){throw new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))](_0x8a8a('0xd1'));}_0x155a64=_[_0x8a8a('0xd2')](_[_0x8a8a('0x51')](_0xb2fc5b),[_0x8a8a('0xa2'),_0x8a8a('0xa3'),'CompanyId',_0x8a8a('0xa5')]);if(_0x1cad71[_0x8a8a('0x65')]['id']){delete _0x1cad71[_0x8a8a('0x65')]['id'];}if(_[_0x8a8a('0x8e')](_0x1cad71[_0x8a8a('0x65')]['from'])){throw _0x2ae822['status'](0x1f4)[_0x8a8a('0xd3')](new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))](_0x8a8a('0xd4')));}if(_[_0x8a8a('0x8e')](_0x1cad71['body'][_0x8a8a('0x65')])||_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0x65')]===''){throw _0x2ae822[_0x8a8a('0x26')](0x1f4)[_0x8a8a('0xd3')](new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8a8a('0x8e')](_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0xd5')])){throw _0x2ae822[_0x8a8a('0x26')](0x1f4)[_0x8a8a('0xd3')](new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))](_0x8a8a('0xd6')+_0x155a64));}if(!_[_0x8a8a('0xa4')](_0x155a64,_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0xd5')])){throw _0x2ae822['status'](0x1f4)[_0x8a8a('0xd3')](new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))](_0x8a8a('0xd7')+_0x155a64));}_0x21504d[_0x1cad71[_0x8a8a('0x65')]['mapKeyOffline']]=_0x1cad71['body'][_0x8a8a('0x9c')];})[_0x8a8a('0x1c')](function(){return db['ChatWebsite'][_0x8a8a('0x63')]({'where':{'id':_0x1cad71[_0x8a8a('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x8a8a('0xb2')},{'model':db[_0x8a8a('0xd8')],'as':_0x8a8a('0xd8')}]});})[_0x8a8a('0x1c')](handleEntityNotFound(_0x2ae822,null))['then'](function(_0x2f68b3){if(_0x2f68b3&&_0x2f68b3[_0x8a8a('0xb2')]){_0x36e8c6=_0x2f68b3;var _0x2e583f=_[_0x8a8a('0x15')](_0x1cad71['body'],{'firstName':_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0x9c')],'phone':_0x1cad71['body'][_0x8a8a('0x9c')],'ListId':_0x2f68b3[_0x8a8a('0xa5')]});_0x2e583f[_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0xd5')]]=_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0x9c')];return db[_0x8a8a('0xa1')][_0x8a8a('0xd9')]({'where':_0x21504d,'defaults':_0x2e583f});}})[_0x8a8a('0xda')](function(_0x30ee47){if(_0x30ee47){_0x204dde=_0x30ee47;var _0xd1803f=fs[_0x8a8a('0xdb')](path['join'](config[_0x8a8a('0x90')],'server/files/templates/chatOfflineMessage.ejs'),_0x8a8a('0xdc'));var _0x4b334b=ejs[_0x8a8a('0xdd')](_0xd1803f,{'body':_[_0x8a8a('0xde')](_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0x65')]),'bodyTitle':_0x36e8c6['offlineMessageBody']});return db[_0x8a8a('0xdf')]['create']({'body':_0x4b334b,'plainBody':htmlToText[_0x8a8a('0xe0')](_0x4b334b),'ContactId':_0x30ee47['id'],'ChatWebsiteId':_0x36e8c6['id']});}})[_0x8a8a('0x1c')](function(_0x3c292a){_0x4bf38e=_0x3c292a;if(_0x123c98[_0x8a8a('0x62')]){var _0x327020=_0x123c98[_0x8a8a('0x4b')](function(_0x1edb12){return{'name':_0x1edb12[_0x8a8a('0xe1')],'basename':_0x1edb12['filename'],'type':_0x1edb12['mimetype'],'ChatOfflineMessageId':_0x3c292a['id']};});_0x2c82d4=_0x327020[_0x8a8a('0x4b')](_0x268a78=>{var _0xb02292={'filename':_0x268a78[_0x8a8a('0x34')],'path':path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0xe2'),_0x8a8a('0xce'),_0x8a8a('0xe3'),_0x8a8a('0xe4'),_0x268a78['basename'])};return _0xb02292;});if(!_0x36e8c6['openNewInteraction']){return db[_0x8a8a('0xe5')][_0x8a8a('0xe6')](function(_0x4bffba){return db[_0x8a8a('0xe7')][_0x8a8a('0xe8')](_0x327020,{'transaction':_0x4bffba});});}}})[_0x8a8a('0x1c')](function(){if(_0x4bf38e){_0xb988c3=_0x4bf38e;return db['MailAccount'][_0x8a8a('0x7c')]({'where':{'service':!![]},'include':[{'model':db[_0x8a8a('0xe9')],'as':_0x8a8a('0xea'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x8a8a('0x1c')](function(_0x25d338){if(_0x25d338&&_0x25d338[_0x8a8a('0xea')]&&_0x36e8c6[_0x8a8a('0xeb')]&&_0x36e8c6[_0x8a8a('0xec')]){var _0x327f00=_0x25d338[_0x8a8a('0xed')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x327f00,'message':{'from':util[_0x8a8a('0xab')](_0x8a8a('0xee'),_0x25d338['name'],_0x25d338[_0x8a8a('0xef')]||_0x25d338['Smtp']['user']),'to':_0x36e8c6['forwardOfflineAddress'],'subject':_0x36e8c6[_0x8a8a('0xf0')],'html':_0xb988c3[_0x8a8a('0x65')],'attachments':_0x2c82d4}},client9003)[_0x8a8a('0x1c')](function(){return _0xb988c3;})[_0x8a8a('0x25')](function(_0xcfd82f){logger[_0x8a8a('0x22')](_0xcfd82f);});}})['then'](function(){if(_0x36e8c6&&_0x36e8c6['openNewInteraction']&&_0x36e8c6['MailAccountId']){var _0x192040=[];if(_0x123c98[_0x8a8a('0x62')]){_0x192040=_0x123c98[_0x8a8a('0x4b')](function(_0x5843c8){return{'name':_0x5843c8['originalname'],'basename':_0x5843c8['filename'],'type':_0x5843c8[_0x8a8a('0xf1')],'ChatOfflineMessageId':_0x4bf38e['id']};});}var _0x5168b5;if(!_[_0x8a8a('0x8e')](_0x36e8c6[_0x8a8a('0xf2')])){var _0x51c6f8=_[_0x8a8a('0x4b')](_0x1cad71['body'],function(_0x51744a){return _0x51744a;});var _0x19c612=_[_0x8a8a('0xf3')](_0x51c6f8)[0x0];var _0x220434=_['mapValues'](_0x19c612,function(_0x29e6d0){return _0x29e6d0;});_0x5168b5=_0x220434[0x1][_0x36e8c6[_0x8a8a('0xf2')]];}var _0x517c95={'from':_0x204dde[_0x8a8a('0xef')],'firstName':_0x204dde[_0x8a8a('0x3c')],'lastName':_0x204dde[_0x8a8a('0xbc')],'mapKey':_0x8a8a('0xef'),'message':{'from':_0x204dde[_0x8a8a('0xef')],'to':_0x36e8c6[_0x8a8a('0xd8')]['email'],'cc':'','subject':_[_0x8a8a('0x8e')](_0x5168b5)?_0x36e8c6[_0x8a8a('0xf0')]:_0x5168b5,'messageId':'','sentAt':new Date(),'attach':_0x192040[_0x8a8a('0x62')],'attachments':_0x192040,'originChannel':_0x8a8a('0xf4'),'ChatWebsiteId':_0x36e8c6['id'],'ChatOfflineMessageId':_0xb988c3['id'],'originTo':_0x36e8c6[_0x8a8a('0xd8')]['email']},'body':_0xb988c3[_0x8a8a('0x65')]};var _0x55737e={'account':{'id':_0x36e8c6[_0x8a8a('0xf5')]},'body':_0x517c95,'log':_0x8a8a('0xf6')};return respondWithRpcPromise(_0x8a8a('0xf6'),_0x8a8a('0xf7'),_0x55737e,client9001)[_0x8a8a('0x1c')](function(){return _0xb988c3;})[_0x8a8a('0x25')](function(_0x540e6e){logger['error'](_0x540e6e);});}return;})[_0x8a8a('0x1c')](function(){if(_0xb988c3){return _0xb988c3;}})[_0x8a8a('0x1c')](respondWithResult(_0x2ae822,null))[_0x8a8a('0x25')](function(){for(var _0x20f945 of _0x123c98){var _0x1baed2=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0xe2'),_0x8a8a('0xce'),_0x8a8a('0xe3'),_0x8a8a('0xe4'),_0x20f945[_0x8a8a('0x84')]);fs_extra['remove'](_0x1baed2)[_0x8a8a('0x25')](function(_0x4f31a2){logger[_0x8a8a('0x22')](_0x8a8a('0xf8'),_0x1baed2,_0x4f31a2);});}});};exports[_0x8a8a('0xf9')]=function(_0x203707,_0x3cdc0a){return db[_0x8a8a('0xb7')][_0x8a8a('0x63')]({'where':{'id':_0x203707['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x3cdc0a,null))['then'](function(_0x1e3017){if(_0x1e3017){return _0x1e3017['addInteraction'](_0x203707[_0x8a8a('0x65')][_0x8a8a('0x79')],_[_0x8a8a('0xfa')](_0x203707[_0x8a8a('0x65')],['ids','id'])||{});}})['then'](respondWithResult(_0x3cdc0a,null))[_0x8a8a('0x25')](handleError(_0x3cdc0a,null));};exports[_0x8a8a('0xfb')]=function(_0x4dd128,_0x15b30c){var _0x59022b={'raw':![],'where':{}};var _0x577662={};var _0x24f65a={'count':0x0,'rows':[]};return db[_0x8a8a('0x4c')][_0x8a8a('0x7c')]({'where':{'id':_0x4dd128['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x15b30c,null))[_0x8a8a('0x1c')](function(_0x2e34e6){if(_0x2e34e6){_0x577662['model']=_[_0x8a8a('0x51')](db[_0x8a8a('0xb7')]['rawAttributes']);_0x577662['query']=_[_0x8a8a('0x51')](_0x4dd128[_0x8a8a('0x50')]);_0x577662[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x577662[_0x8a8a('0x44')],_0x577662['query']);_0x59022b[_0x8a8a('0x54')]=_['intersection'](_0x577662['model'],qs[_0x8a8a('0x55')](_0x4dd128[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x59022b[_0x8a8a('0x54')]=_0x59022b[_0x8a8a('0x54')][_0x8a8a('0x62')]?_0x59022b['attributes']:_0x577662[_0x8a8a('0x44')];if(!_0x4dd128[_0x8a8a('0x50')][_0x8a8a('0x56')](_0x8a8a('0x57'))){_0x59022b[_0x8a8a('0x2a')]=qs['limit'](_0x4dd128[_0x8a8a('0x50')]['limit']);_0x59022b[_0x8a8a('0x2c')]=qs['offset'](_0x4dd128['query'][_0x8a8a('0x2c')]);}_0x59022b[_0x8a8a('0x75')]=qs[_0x8a8a('0x76')](_0x4dd128['query'][_0x8a8a('0x76')]);_0x59022b['where']=qs[_0x8a8a('0x52')](_[_0x8a8a('0x59')](_0x4dd128[_0x8a8a('0x50')],_0x577662[_0x8a8a('0x52')]));_0x59022b[_0x8a8a('0x58')][_0x8a8a('0x73')]=_0x2e34e6['id'];if(_0x4dd128[_0x8a8a('0x50')][_0x8a8a('0x5a')]){_0x59022b[_0x8a8a('0x58')]=_[_0x8a8a('0x5b')](_0x59022b[_0x8a8a('0x58')],{'$or':_['map'](_0x59022b['attributes'],function(_0x2d23ae){var _0x1d3559={};_0x1d3559[_0x2d23ae]={'$like':'%'+_0x4dd128[_0x8a8a('0x50')]['filter']+'%'};return _0x1d3559;})});}_0x59022b=_['merge']({},_0x59022b,_0x4dd128[_0x8a8a('0x5d')]);return db[_0x8a8a('0xb7')]['count']({'where':_0x59022b['where']})[_0x8a8a('0x1c')](function(_0xb08e40){_0x24f65a['count']=_0xb08e40;if(_0x4dd128['query'][_0x8a8a('0x5e')]){_0x59022b['include']=[{'model':db[_0x8a8a('0xa1')],'as':'Contact','required':![]},{'model':db[_0x8a8a('0xc2')],'as':'Owner','attributes':['name','fullname',_0x8a8a('0xfc')],'required':![]},{'model':db['Tag'],'as':_0x8a8a('0xfd'),'attributes':['id',_0x8a8a('0x34'),_0x8a8a('0xfe')],'where':_0x4dd128['query']['tag']?{'id':_0x4dd128[_0x8a8a('0x50')][_0x8a8a('0xff')]}:undefined,'required':_0x4dd128[_0x8a8a('0x50')]['tag']?!![]:![]}];}return db[_0x8a8a('0xb7')][_0x8a8a('0x7d')](_0x59022b);})[_0x8a8a('0x1c')](function(_0x5e4abc){_0x24f65a['rows']=_0x5e4abc;return _0x24f65a;});}})['then'](respondWithFilteredResult(_0x15b30c,_0x59022b))['catch'](handleError(_0x15b30c,null));};exports[_0x8a8a('0x100')]=function(_0x3488b4,_0x3fd5b2){var _0x6120b4=0x0;var _0x255a29=0x0;var _0x3723d9=![];var _0x82197;var _0x5e11da;return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x3488b4[_0x8a8a('0x61')]['id']},'include':[{'model':db['Interval'],'as':_0x8a8a('0x97'),'include':[{'model':db[_0x8a8a('0x97')],'as':_0x8a8a('0xaa'),'attributes':['id','interval']}]}]})[_0x8a8a('0x1c')](handleEntityNotFound(_0x3fd5b2,null))[_0x8a8a('0x1c')](function(_0x10e059){if(_0x10e059){_0x82197=_0x10e059;return _0x10e059[_0x8a8a('0x101')]({'raw':!![]});}})[_0x8a8a('0x1c')](function(_0x142a8c){if(_0x82197){if(_0x142a8c){_0x5e11da=_0x142a8c;}}return require('../../config/license/util')[_0x8a8a('0x8c')]();})[_0x8a8a('0x1c')](function(_0x3a0fd0){if(_0x3a0fd0){_0x255a29=_0x3a0fd0[_0x8a8a('0x102')];_0x3723d9=_0x3a0fd0[_0x8a8a('0x8d')];}})[_0x8a8a('0x1c')](function(){return db[_0x8a8a('0xb7')][_0x8a8a('0x2b')]({'where':{'closed':![]}});})[_0x8a8a('0x1c')](function(_0x234485){_0x6120b4=_0x234485;if(_0x255a29&&_0x234485>_0x255a29){return db[_0x8a8a('0x103')][_0x8a8a('0x7c')]({'where':{'id':0x1}})[_0x8a8a('0x1c')](function(_0x874574){if(_0x874574){_0x874574[_0x8a8a('0x104')](_0x8a8a('0x105'));}});}})[_0x8a8a('0x1c')](function(){var _0x1f882e=_0x82197[_0x8a8a('0x97')];var _0x270117=_0x82197[_0x8a8a('0x98')]||undefined;return _0x1f882e?_0x1f882e[_0x8a8a('0x99')](_0x270117):!![];})[_0x8a8a('0x1c')](function(_0x25d8ea){var _0x5ce17f=fs['readFileSync'](path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x106')),_0x8a8a('0xdc'));var _0x4da155=_0x8a8a('0x107');var _0x3265d7=![];var _0x546652,_0x332c4c;if(_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x3e')]){_0x546652=new URL(_0x3488b4[_0x8a8a('0xb5')]['referer'])[_0x8a8a('0x108')];}else if(_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x108')]){_0x546652=new URL(_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x108')])[_0x8a8a('0x108')];}else{_0x546652=_0x8a8a('0x109');}_0x332c4c=typeof _0x82197[_0x8a8a('0x66')][_0x8a8a('0x3b')](',')[_0x8a8a('0x63')](function(_0x268030){return wildcardUtils['testWebsiteWithWildcard'](_0x268030,_0x546652);})!==_0x8a8a('0x29');var _0x3c07fa={'chatVersion':_0x4da155,'chatWebsiteAddressOrigin':_0x332c4c?_0x546652:_0x82197[_0x8a8a('0x66')],'remote':_0x82197['remote'],'query':querystring[_0x8a8a('0x48')](_[_0x8a8a('0x5b')](_0x82197[_0x8a8a('0x6b')]({'plain':!![]}),{'customerIp':_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x39')]||_0x3488b4['headers'][_0x8a8a('0x10a')]||_0x3488b4['connection'][_0x8a8a('0x10b')]||_0x3488b4['ip'],'referer':_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x3e')],'openedInteractions':_0x6120b4,'maxInteractions':_0x255a29,'virtual':_0x3723d9[_0x8a8a('0x102')],'online':_0x25d8ea,'custom':_0x3723d9,'address':_0x332c4c?_0x546652:null}))[_0x8a8a('0x10c')](/'/g,'\x5c\x27')};_0x3fd5b2[_0x8a8a('0xd3')](ejs[_0x8a8a('0xdd')](Mustache[_0x8a8a('0xdd')](_0x5ce17f,_0x3c07fa),{'proactiveActions':_0x5e11da,'alignment':_0x82197[_0x8a8a('0x10d')],'verticalAlignment':_0x82197[_0x8a8a('0x10e')],'div_color':_0x82197[_0x8a8a('0xfe')],'labelText':_0x82197[_0x8a8a('0x10f')],'text_color':_0x82197[_0x8a8a('0x110')],'text_button_color':_0x82197['textButtonColor'],'button_color':_0x82197[_0x8a8a('0x111')],'background_color':_0x82197[_0x8a8a('0x112')],'hideWhenOffline':_0x82197[_0x8a8a('0x113')],'intervalId':_0x82197['IntervalId'],'isDevelopment':_0x3265d7,'chatVersion':_0x4da155}));})[_0x8a8a('0x25')](handleError(_0x3fd5b2,null));};exports[_0x8a8a('0x114')]=function(_0x3c3829,_0x38f151){var _0x500151=_0x3c3829['params']['id'];var _0x13e934=_0x3c3829[_0x8a8a('0x65')];var _0x578863=0xc8;var _0x321588=null;return db[_0x8a8a('0xe5')][_0x8a8a('0xe6')]({'isolationLevel':db[_0x8a8a('0xe5')]['Transaction'][_0x8a8a('0x115')][_0x8a8a('0x116')]},function(_0x377fb){return db['ChatWebsite'][_0x8a8a('0x7c')]({'where':{'id':_0x500151},'transaction':_0x377fb})['then'](function(_0x3415f2){if(_0x3415f2){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x500151},'transaction':_0x377fb})[_0x8a8a('0x1c')](function(){var _0x487ac2=_[_0x8a8a('0x4b')](_0x13e934,function(_0x300627){_0x300627[_0x8a8a('0x73')]=_0x500151;return _0x300627;});return db[_0x8a8a('0x117')][_0x8a8a('0xe8')](_0x487ac2,{'transaction':_0x377fb});});}else{_0x578863=0x194;_0x321588=[];}});})['then'](function(){if(_0x578863!==0x194){return db[_0x8a8a('0x117')][_0x8a8a('0x118')]({'where':{'ChatWebsiteId':_0x500151},'order':_0x8a8a('0xaf')})[_0x8a8a('0x1c')](function(_0x2b3f58){_0x321588=_0x2b3f58;});}})[_0x8a8a('0x25')](function(_0x5bcf5e){_0x578863=0x1f4;logger[_0x8a8a('0x22')](_0x5bcf5e[_0x8a8a('0x33')]);if(_0x5bcf5e[_0x8a8a('0x34')]){delete _0x5bcf5e[_0x8a8a('0x34')];}_0x321588=_0x5bcf5e;})[_0x8a8a('0x119')](function(){if(_0x321588===null){_0x38f151[_0x8a8a('0x32')](_0x578863);}else{if(_0x578863===0x1f4){_0x38f151[_0x8a8a('0x26')](_0x578863)[_0x8a8a('0xd3')](_0x321588);}else{_0x38f151[_0x8a8a('0x26')](_0x578863)[_0x8a8a('0x28')](_0x321588);}}});};exports[_0x8a8a('0x11a')]=function(_0x515e99,_0x49f317){var _0x4e4a02={};var _0x2cb19e={};var _0x2e97f5;var _0x1c0953;return db['ChatWebsite']['findOne']({'where':{'id':_0x515e99[_0x8a8a('0x61')]['id']}})['then'](handleEntityNotFound(_0x49f317,null))['then'](function(_0x4f6f49){if(_0x4f6f49){_0x2e97f5=_0x4f6f49;_0x2cb19e[_0x8a8a('0x44')]=_['keys'](db[_0x8a8a('0x117')][_0x8a8a('0x4d')]);_0x2cb19e[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x515e99['query']);_0x2cb19e[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x2cb19e['model'],_0x2cb19e['query']);_0x4e4a02[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x2cb19e[_0x8a8a('0x44')],qs['fields'](_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x4e4a02[_0x8a8a('0x54')]=_0x4e4a02[_0x8a8a('0x54')][_0x8a8a('0x62')]?_0x4e4a02[_0x8a8a('0x54')]:_0x2cb19e[_0x8a8a('0x44')];_0x4e4a02[_0x8a8a('0x75')]=qs[_0x8a8a('0x76')](_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x4e4a02['where']=qs[_0x8a8a('0x52')](_['pick'](_0x515e99[_0x8a8a('0x50')],_0x2cb19e['filters']));if(_0x515e99['query'][_0x8a8a('0x5a')]){_0x4e4a02['where']=_['merge'](_0x4e4a02['where'],{'$or':_['map'](_0x4e4a02[_0x8a8a('0x54')],function(_0x3a1604){var _0x3e87d3={};_0x3e87d3[_0x3a1604]={'$like':'%'+_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x5a')]+'%'};return _0x3e87d3;})});}_0x4e4a02=_[_0x8a8a('0x5b')]({},_0x4e4a02,_0x515e99[_0x8a8a('0x5d')]);return _0x2e97f5[_0x8a8a('0x11a')](_0x4e4a02);}})[_0x8a8a('0x1c')](function(_0x9f342e){if(_0x9f342e){_0x1c0953=_0x9f342e[_0x8a8a('0x62')];if(!_0x515e99['query'][_0x8a8a('0x56')]('nolimit')){_0x4e4a02[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x2a')]);_0x4e4a02[_0x8a8a('0x2c')]=qs[_0x8a8a('0x2c')](_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}return _0x2e97f5[_0x8a8a('0x11a')](_0x4e4a02);}})[_0x8a8a('0x1c')](function(_0x13fb20){if(_0x13fb20){return _0x13fb20?{'count':_0x1c0953,'rows':_0x13fb20}:null;}})['then'](respondWithResult(_0x49f317,null))['catch'](handleError(_0x49f317,null));};exports['addProactiveActions']=function(_0xda869f,_0x55931b){return db[_0x8a8a('0x11b')][_0x8a8a('0x63')]({'where':{'id':_0xda869f[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x55931b,null))[_0x8a8a('0x1c')](function(_0x591976){if(_0x591976){return _0x591976[_0x8a8a('0x11c')](_0xda869f['body'][_0x8a8a('0x79')],_['omit'](_0xda869f[_0x8a8a('0x65')],[_0x8a8a('0x79'),'id'])||{});}})[_0x8a8a('0x1c')](respondWithResult(_0x55931b,null))[_0x8a8a('0x25')](handleError(_0x55931b,null));};exports[_0x8a8a('0x101')]=function(_0x43bfeb,_0x2406f1){var _0x511fac={};var _0x3bef44={};var _0x5b4ca0;var _0x4cff06;return db['ChatWebsite']['findOne']({'where':{'id':_0x43bfeb['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x2406f1,null))[_0x8a8a('0x1c')](function(_0x374b3f){if(_0x374b3f){_0x5b4ca0=_0x374b3f;_0x3bef44[_0x8a8a('0x44')]=_[_0x8a8a('0x51')](db[_0x8a8a('0x11d')][_0x8a8a('0x4d')]);_0x3bef44['query']=_['keys'](_0x43bfeb['query']);_0x3bef44[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x3bef44[_0x8a8a('0x44')],_0x3bef44[_0x8a8a('0x50')]);_0x511fac[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x3bef44['model'],qs[_0x8a8a('0x55')](_0x43bfeb[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x511fac['attributes']=_0x511fac[_0x8a8a('0x54')][_0x8a8a('0x62')]?_0x511fac[_0x8a8a('0x54')]:_0x3bef44['model'];_0x511fac[_0x8a8a('0x75')]=qs[_0x8a8a('0x76')](_0x43bfeb[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x511fac[_0x8a8a('0x58')]=qs[_0x8a8a('0x52')](_[_0x8a8a('0x59')](_0x43bfeb[_0x8a8a('0x50')],_0x3bef44['filters']));if(_0x43bfeb['query'][_0x8a8a('0x5a')]){_0x511fac['where']=_['merge'](_0x511fac['where'],{'$or':_['map'](_0x511fac['attributes'],function(_0x5d28bb){var _0x55b0c2={};_0x55b0c2[_0x5d28bb]={'$like':'%'+_0x43bfeb[_0x8a8a('0x50')]['filter']+'%'};return _0x55b0c2;})});}_0x511fac=_[_0x8a8a('0x5b')]({},_0x511fac,_0x43bfeb[_0x8a8a('0x5d')]);return _0x5b4ca0[_0x8a8a('0x101')](_0x511fac);}})['then'](function(_0x433bd5){if(_0x433bd5){_0x4cff06=_0x433bd5[_0x8a8a('0x62')];if(!_0x43bfeb[_0x8a8a('0x50')][_0x8a8a('0x56')]('nolimit')){_0x511fac['limit']=qs[_0x8a8a('0x2a')](_0x43bfeb[_0x8a8a('0x50')]['limit']);_0x511fac[_0x8a8a('0x2c')]=qs['offset'](_0x43bfeb[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}return _0x5b4ca0['getProactiveActions'](_0x511fac);}})[_0x8a8a('0x1c')](function(_0x51c902){if(_0x51c902){return _0x51c902?{'count':_0x4cff06,'rows':_0x51c902}:null;}})[_0x8a8a('0x1c')](respondWithResult(_0x2406f1,null))[_0x8a8a('0x25')](handleError(_0x2406f1,null));};exports[_0x8a8a('0x11e')]=function(_0x269483,_0x3f9d81){var _0x565d4f=_0x269483[_0x8a8a('0x50')][_0x8a8a('0x11f')]===_0x8a8a('0x120')?_0x8a8a('0x121'):_0x8a8a('0x122');return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'attributes':['id',_0x565d4f],'where':{'id':_0x269483[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x3f9d81,null))['then'](function(_0x2810fc){if(_0x2810fc){var _0x3e8ddf=_0x2810fc[_0x565d4f];var _0x2eddb9=_0x3e8ddf&&_0x3e8ddf[_0x8a8a('0x123')]?_0x3e8ddf[_0x8a8a('0x123')]:[];_0x3f9d81[_0x8a8a('0xd3')]({'fromKey':_['isNil'](_0x3e8ddf[_0x8a8a('0x124')])?undefined:_0x3e8ddf[_0x8a8a('0x124')],'count':_0x2eddb9['length'],'rows':_0x2eddb9});}})[_0x8a8a('0x25')](handleError(_0x3f9d81,null));};exports[_0x8a8a('0x125')]=function(_0x2f5102,_0x51dc09){var _0x48676a={'raw':![],'where':{}};var _0x586205={};var _0x462121={'count':0x0,'rows':[]};return db[_0x8a8a('0x4c')][_0x8a8a('0x7c')]({'where':{'id':_0x2f5102['params']['id']}})['then'](handleEntityNotFound(_0x51dc09,null))[_0x8a8a('0x1c')](function(_0x1b021a){if(_0x1b021a){_0x586205['model']=_[_0x8a8a('0x51')](db[_0x8a8a('0xdf')][_0x8a8a('0x4d')]);_0x586205[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x2f5102['query']);_0x586205['filters']=_['intersection'](_0x586205[_0x8a8a('0x44')],_0x586205['query']);_0x48676a[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x586205[_0x8a8a('0x44')],qs[_0x8a8a('0x55')](_0x2f5102[_0x8a8a('0x50')]['fields']));_0x48676a[_0x8a8a('0x54')]=_0x48676a[_0x8a8a('0x54')]['length']?_0x48676a[_0x8a8a('0x54')]:_0x586205[_0x8a8a('0x44')];if(!_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x56')](_0x8a8a('0x57'))){_0x48676a[_0x8a8a('0x2a')]=qs['limit'](_0x2f5102['query'][_0x8a8a('0x2a')]);_0x48676a[_0x8a8a('0x2c')]=qs['offset'](_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}_0x48676a[_0x8a8a('0x75')]=qs[_0x8a8a('0x76')](_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x48676a[_0x8a8a('0x58')]=qs[_0x8a8a('0x52')](_['pick'](_0x2f5102['query'],_0x586205['filters']));_0x48676a[_0x8a8a('0x58')][_0x8a8a('0x73')]=_0x1b021a['id'];if(_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x5a')]){_0x48676a[_0x8a8a('0x58')]=_['merge'](_0x48676a[_0x8a8a('0x58')],{'$or':_[_0x8a8a('0x4b')](_0x48676a['attributes'],function(_0x43af89){var _0xc8998e={};_0xc8998e[_0x43af89]={'$like':'%'+_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x5a')]+'%'};return _0xc8998e;})});}_0x48676a=_[_0x8a8a('0x5b')]({},_0x48676a,_0x2f5102['options']);return db[_0x8a8a('0xdf')][_0x8a8a('0x2b')]({'where':_0x48676a[_0x8a8a('0x58')]})[_0x8a8a('0x1c')](function(_0x48901b){_0x462121[_0x8a8a('0x2b')]=_0x48901b;if(_0x2f5102['query'][_0x8a8a('0x5e')]){_0x48676a[_0x8a8a('0x77')]=[{'all':!![]}];}else{_0x48676a[_0x8a8a('0x77')]=[{'model':db[_0x8a8a('0xa1')],'as':_0x8a8a('0x126'),'required':![]},{'model':db['Attachment'],'as':_0x8a8a('0x127'),'required':![]}];}return db['ChatOfflineMessage'][_0x8a8a('0x7d')](_0x48676a);})['then'](function(_0x4b44b9){_0x462121[_0x8a8a('0x5f')]=_0x4b44b9;return _0x462121;});}})[_0x8a8a('0x1c')](respondWithFilteredResult(_0x51dc09,_0x48676a))[_0x8a8a('0x25')](handleError(_0x51dc09,null));};exports[_0x8a8a('0x128')]=function(_0x2d99d3,_0x1dff03){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x2d99d3[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x1dff03,null))[_0x8a8a('0x1c')](function(_0x4125a3){if(_0x4125a3){return _0x4125a3[_0x8a8a('0x128')](_0x2d99d3[_0x8a8a('0x65')][_0x8a8a('0x79')],_[_0x8a8a('0xfa')](_0x2d99d3[_0x8a8a('0x65')],[_0x8a8a('0x79'),'id'])||{})[_0x8a8a('0xda')](function(_0x4447dc){for(var _0x2d3f1c=0x0;_0x2d3f1c<_0x2d99d3[_0x8a8a('0x65')]['ids']['length'];_0x2d3f1c+=0x1){socket[_0x8a8a('0x129')](_0x8a8a('0x12a'),{'UserId':Number(_0x2d99d3[_0x8a8a('0x65')][_0x8a8a('0x79')][_0x2d3f1c]),'ChatWebsiteId':Number(_0x2d99d3['params']['id'])});}return _0x4447dc;});}})[_0x8a8a('0x1c')](respondWithResult(_0x1dff03,null))['catch'](handleError(_0x1dff03,null));};exports[_0x8a8a('0x12b')]=function(_0x3991e8,_0x1d221f){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x3991e8[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x1d221f,null))[_0x8a8a('0x1c')](function(_0x11ae8d){if(_0x11ae8d){return _0x11ae8d[_0x8a8a('0x12b')](_0x3991e8[_0x8a8a('0x50')]['ids'])[_0x8a8a('0x1c')](function(){if(_[_0x8a8a('0x12c')](_0x3991e8['query'][_0x8a8a('0x79')])){for(var _0x4676bb=0x0;_0x4676bb<_0x3991e8['query'][_0x8a8a('0x79')][_0x8a8a('0x62')];_0x4676bb+=0x1){socket['emit'](_0x8a8a('0x12d'),{'UserId':Number(_0x3991e8[_0x8a8a('0x50')][_0x8a8a('0x79')][_0x4676bb]),'ChatWebsiteId':Number(_0x3991e8['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x3991e8['query'][_0x8a8a('0x79')]),'ChatWebsiteId':Number(_0x3991e8[_0x8a8a('0x61')]['id'])});}});}})[_0x8a8a('0x1c')](respondWithStatusCode(_0x1d221f,null))[_0x8a8a('0x25')](handleError(_0x1d221f,null));};exports['getAgents']=function(_0x3fb3c0,_0x3b0476){var _0x37a540={};var _0x2cee68={};var _0x206127;var _0x21cd36;return db[_0x8a8a('0x4c')][_0x8a8a('0x7c')]({'where':{'id':_0x3fb3c0[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x3b0476,null))[_0x8a8a('0x1c')](function(_0xac535c){if(_0xac535c){_0x206127=_0xac535c;_0x2cee68[_0x8a8a('0x44')]=_[_0x8a8a('0x51')](db['User'][_0x8a8a('0x4d')]);_0x2cee68[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x3fb3c0[_0x8a8a('0x50')]);_0x2cee68[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x2cee68[_0x8a8a('0x44')],_0x2cee68[_0x8a8a('0x50')]);_0x37a540['attributes']=_[_0x8a8a('0x53')](_0x2cee68[_0x8a8a('0x44')],qs['fields'](_0x3fb3c0['query']['fields']));_0x37a540['attributes']=_0x37a540[_0x8a8a('0x54')]['length']?_0x37a540[_0x8a8a('0x54')]:_0x2cee68[_0x8a8a('0x44')];_0x37a540[_0x8a8a('0x75')]=qs['sort'](_0x3fb3c0[_0x8a8a('0x50')]['sort']);_0x37a540['where']=qs[_0x8a8a('0x52')](_['pick'](_0x3fb3c0[_0x8a8a('0x50')],_0x2cee68[_0x8a8a('0x52')]));if(_0x3fb3c0[_0x8a8a('0x50')]['filter']){_0x37a540['where']=_[_0x8a8a('0x5b')](_0x37a540[_0x8a8a('0x58')],{'$or':_['map'](_0x37a540[_0x8a8a('0x54')],function(_0x5c0bd5){var _0x33ca5d={};_0x33ca5d[_0x5c0bd5]={'$like':'%'+_0x3fb3c0[_0x8a8a('0x50')]['filter']+'%'};return _0x33ca5d;})});}_0x37a540=_['merge']({},_0x37a540,_0x3fb3c0[_0x8a8a('0x5d')]);return _0x206127[_0x8a8a('0x12e')](_0x37a540);}})[_0x8a8a('0x1c')](function(_0x2ee77d){if(_0x2ee77d){_0x21cd36=_0x2ee77d[_0x8a8a('0x62')];if(!_0x3fb3c0[_0x8a8a('0x50')][_0x8a8a('0x56')]('nolimit')){_0x37a540[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x3fb3c0['query']['limit']);_0x37a540[_0x8a8a('0x2c')]=qs[_0x8a8a('0x2c')](_0x3fb3c0['query'][_0x8a8a('0x2c')]);}return _0x206127[_0x8a8a('0x12e')](_0x37a540);}})['then'](function(_0x1bd6a8){if(_0x1bd6a8){return _0x1bd6a8?{'count':_0x21cd36,'rows':_0x1bd6a8}:null;}})['then'](respondWithResult(_0x3b0476,null))[_0x8a8a('0x25')](handleError(_0x3b0476,null));}; \ No newline at end of file +var _0x81bd=['autoclose','close','*,*,*,*','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','ValidationError','no\x20available\x20attributes','difference','CompanyId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','Smtp','mimetype','subjectOffline','mapValues','offlineMessageSubject','Chat','MailAccountId','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','virtual','custom','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','headers','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','destroy','UserProfileResource','name','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','params','Pause','options','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findAll','rows','removeDispositions','ids','ChatWebsiteId','CannedAnswer','getAnswers','findOne','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','createdAt','includes','updatedAt','ListId','from','CmList','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','priority','asc','list','contact','threadId','closed','externalUrl','ContactId','interaction','ChatInteraction','Writing\x20on\x20closed\x20interaction','messageId','created'];(function(_0x305195,_0x1c9e74){var _0x113e42=function(_0x2abc0f){while(--_0x2abc0f){_0x305195['push'](_0x305195['shift']());}};_0x113e42(++_0x1c9e74);}(_0x81bd,0x7c));var _0xd81b=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x81bd[_0x5f42f1];return _0x5534ee;};'use strict';var Mustache=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var ejs=require(_0xd81b('0x3'));var fs=require('fs');var fs_extra=require(_0xd81b('0x4'));var _=require(_0xd81b('0x5'));var querystring=require(_0xd81b('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0xd81b('0x7'));var jayson=require(_0xd81b('0x8'));var qs=require(_0xd81b('0x9'));var logger=require('../../config/logger')(_0xd81b('0xa'));var config=require(_0xd81b('0xb'));var APIBadRequestError=require(_0xd81b('0xc'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0xd81b('0xd')];var APIOutOfIntervalError=require('../../errors/api')[_0xd81b('0xe')];var APIHandleError=require(_0xd81b('0xc'))[_0xd81b('0xf')];var APIConflictError=require(_0xd81b('0xc'))[_0xd81b('0x10')];var wildcardUtils=require(_0xd81b('0x11'));var URL=require(_0xd81b('0x12'))[_0xd81b('0x13')];var db=require(_0xd81b('0x14'))['db'];config[_0xd81b('0x15')]=_[_0xd81b('0x16')](config[_0xd81b('0x15')],{'host':_0xd81b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0x15')]));require('./chatWebsite.socket')[_0xd81b('0x18')](socket);var client=jayson[_0xd81b('0x19')]['http']({'port':0x232c});var client9002=jayson[_0xd81b('0x19')]['http']({'port':0x232a});var client9003=jayson[_0xd81b('0x19')][_0xd81b('0x1a')]({'port':0x232b});var client9001=jayson[_0xd81b('0x19')][_0xd81b('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x128162,_0x552215,_0x1c620d,_0x27b7a0){return new Promise(function(_0x5c2863,_0x2abef4){var _0x26df61=_0x27b7a0||client;return _0x26df61[_0xd81b('0x1b')](_0x128162,_0x1c620d)[_0xd81b('0x1c')](function(_0x5f7db6){logger[_0xd81b('0x1d')](_0xd81b('0x1e'),_0x552215,_0xd81b('0x1f'));logger[_0xd81b('0x20')](_0xd81b('0x21'),_0x552215,_0xd81b('0x1f'),JSON[_0xd81b('0x22')](_0x5f7db6));if(_0x5f7db6[_0xd81b('0x23')]){if(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x24')]===0x1f4){logger[_0xd81b('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x552215,_0x5f7db6['error'][_0xd81b('0x25')]);return _0x2abef4(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x25')]);}logger['error'](_0xd81b('0x1e'),_0x552215,_0x5f7db6[_0xd81b('0x23')]['message']);return _0x5c2863(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x25')]);}else{logger[_0xd81b('0x1d')](_0xd81b('0x1e'),_0x552215,_0xd81b('0x1f'));_0x5c2863(_0x5f7db6[_0xd81b('0x26')][_0xd81b('0x25')]);}})[_0xd81b('0x27')](function(_0x341aec){logger[_0xd81b('0x23')](_0xd81b('0x1e'),_0x552215,_0x341aec);_0x2abef4(_0x341aec);});});}function respondWithStatusCode(_0x1bf351,_0x596389){_0x596389=_0x596389||0xcc;return function(_0x28768f){if(_0x28768f){return _0x1bf351[_0xd81b('0x28')](_0x596389);}return _0x1bf351[_0xd81b('0x29')](_0x596389)[_0xd81b('0x2a')]();};}function respondWithResult(_0x3266c2,_0x2d0d02){_0x2d0d02=_0x2d0d02||0xc8;return function(_0x3e28dd){if(_0x3e28dd){return _0x3266c2[_0xd81b('0x29')](_0x2d0d02)[_0xd81b('0x2b')](_0x3e28dd);}};}function respondWithFilteredResult(_0x483a3d,_0x469cc4){return function(_0x4e2eff){if(_0x4e2eff){var _0x5c8aee=typeof _0x469cc4[_0xd81b('0x2c')]===_0xd81b('0x2d')&&typeof _0x469cc4['limit']==='undefined';var _0x4093c8=_0x4e2eff[_0xd81b('0x2e')];var _0x1b1434=_0x5c8aee?0x0:_0x469cc4[_0xd81b('0x2c')];var _0x1a1572=_0x5c8aee?_0x4e2eff[_0xd81b('0x2e')]:_0x469cc4['offset']+_0x469cc4[_0xd81b('0x2f')];var _0x26f629;if(_0x1a1572>=_0x4093c8){_0x1a1572=_0x4093c8;_0x26f629=0xc8;}else{_0x26f629=0xce;}_0x483a3d['status'](_0x26f629);return _0x483a3d['set'](_0xd81b('0x30'),_0x1b1434+'-'+_0x1a1572+'/'+_0x4093c8)[_0xd81b('0x2b')](_0x4e2eff);}return null;};}function saveUpdates(_0x50472a){return function(_0x50ce25){if(_0x50ce25){return _0x50ce25['update'](_0x50472a)[_0xd81b('0x1c')](function(_0x3ead68){return _0x3ead68;});}return null;};}function removeEntity(_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x31')]()[_0xd81b('0x1c')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='ChatWebsites';return db[_0xd81b('0x32')][_0xd81b('0x31')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1c')](function(){return _0x1c4cf7;});})[_0xd81b('0x1c')](function(){_0x1d2f46[_0xd81b('0x29')](0xcc)[_0xd81b('0x2a')]();});}};}function handleEntityNotFound(_0x1c20d3){return function(_0x2d23b9){if(!_0x2d23b9){_0x1c20d3[_0xd81b('0x28')](0x194);}return _0x2d23b9;};}function handleError(_0xe88a33,_0x1be4e2){_0x1be4e2=_0x1be4e2||0x1f4;return function(_0x3c8371){logger[_0xd81b('0x23')](_0x3c8371['stack']);if(_0x3c8371['name']){delete _0x3c8371[_0xd81b('0x33')];}_0xe88a33[_0xd81b('0x29')](_0x1be4e2)[_0xd81b('0x34')](_0x3c8371);};}function createInteractionObject(_0x59c066,_0x362ebc,_0x37ba34,_0x5a236a){var _0x46f058=require(_0xd81b('0x35'));var _0x512e39=new _0x46f058();var _0xed5272=_0x512e39['setUA'](_0x37ba34[_0xd81b('0x36')])[_0xd81b('0x37')]();var _0x203365=_0x362ebc[_0xd81b('0x38')];if(_0x37ba34['cf-connecting-ip']){_0x203365=_0x37ba34[_0xd81b('0x39')];}else if(_0x37ba34[_0xd81b('0x3a')]){_0x203365=_[_0xd81b('0x3b')](_0x37ba34[_0xd81b('0x3a')][_0xd81b('0x3c')](','));}return{'ContactId':_0x5a236a['id'],'ChatWebsiteId':_0x59c066,'from':(_0x5a236a[_0xd81b('0x3d')]||'')+'\x20'+(_0x5a236a[_0xd81b('0x3e')]||''),'customerIp':_0x203365,'customerPort':_0x37ba34['x-real-port']?_0x37ba34[_0xd81b('0x3f')]:null,'referer':_0x362ebc[_0xd81b('0x40')],'browserName':_0xed5272[_0xd81b('0x41')]['name']&&_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]?util[_0xd81b('0x43')](_0xd81b('0x44'),_0xed5272[_0xd81b('0x41')]['name'],_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]):_0xd81b('0x45'),'browserVersion':_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]||_0xd81b('0x45'),'osName':util[_0xd81b('0x43')](_0xd81b('0x44'),_0xed5272['os'][_0xd81b('0x33')],_0xed5272['os'][_0xd81b('0x42')]),'osVersion':_0xed5272['os'][_0xd81b('0x42')],'deviceModel':_0xed5272['device'][_0xd81b('0x46')]&&_0xed5272[_0xd81b('0x47')][_0xd81b('0x48')]?util[_0xd81b('0x43')](_0xd81b('0x49'),_0xed5272[_0xd81b('0x47')][_0xd81b('0x46')],_0xed5272[_0xd81b('0x47')]['vendor'],_0xed5272['device'][_0xd81b('0x4a')]):null,'deviceVendor':_0xed5272[_0xd81b('0x47')][_0xd81b('0x48')],'deviceType':_0xed5272[_0xd81b('0x47')][_0xd81b('0x4a')],'formData':JSON[_0xd81b('0x22')](_0x362ebc)};}exports[_0xd81b('0x4b')]=function(_0x2e44f3,_0x2fa588){var _0xcfbbc2={'include':[{'model':db['Pause'],'as':_0xd81b('0x4c')}]},_0x41e2e6={},_0x38e436={'count':0x0,'rows':[]};var _0x2b61fc=_[_0xd81b('0x4d')](db[_0xd81b('0x4e')][_0xd81b('0x4f')],function(_0x410ef3){return{'name':_0x410ef3[_0xd81b('0x50')],'type':_0x410ef3[_0xd81b('0x4a')][_0xd81b('0x51')]};});_0x41e2e6['model']=_[_0xd81b('0x4d')](_0x2b61fc,_0xd81b('0x33'));_0x41e2e6[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x2e44f3['query']);_0x41e2e6[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x41e2e6[_0xd81b('0x46')],_0x41e2e6[_0xd81b('0x52')]);_0xcfbbc2[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x41e2e6[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x2e44f3[_0xd81b('0x52')]['fields']));_0xcfbbc2['attributes']=_0xcfbbc2[_0xd81b('0x56')][_0xd81b('0x58')]?_0xcfbbc2[_0xd81b('0x56')]:_0x41e2e6[_0xd81b('0x46')];if(!_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0xcfbbc2[_0xd81b('0x2f')]=qs['limit'](_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x2f')]);_0xcfbbc2[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x2e44f3[_0xd81b('0x52')]['offset']);}_0xcfbbc2[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x2e44f3['query'][_0xd81b('0x5c')]);_0xcfbbc2[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x2e44f3[_0xd81b('0x52')],_0x41e2e6[_0xd81b('0x54')]),_0x2b61fc);if(_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x5f')]){_0xcfbbc2[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0xcfbbc2[_0xd81b('0x5d')],{'$or':_['map'](_0x2b61fc,function(_0x285e82){if(_0x285e82['type']!==_0xd81b('0x61')){var _0x7b438c={};_0x7b438c[_0x285e82[_0xd81b('0x33')]]={'$like':'%'+_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x7b438c;}})});}_0xcfbbc2=_[_0xd81b('0x60')]({},_0xcfbbc2,_0x2e44f3['options']);var _0x2d978d={'where':_0xcfbbc2[_0xd81b('0x5d')]};return db['ChatWebsite']['count'](_0x2d978d)[_0xd81b('0x1c')](function(_0x59e018){_0x38e436[_0xd81b('0x2e')]=_0x59e018;if(_0x2e44f3['query'][_0xd81b('0x62')]){_0xcfbbc2[_0xd81b('0x63')]=[{'all':!![]}];}return db[_0xd81b('0x4e')]['findAll'](_0xcfbbc2);})[_0xd81b('0x1c')](function(_0x10ed99){_0x38e436['rows']=_0x10ed99;return _0x38e436;})[_0xd81b('0x1c')](respondWithFilteredResult(_0x2fa588,_0xcfbbc2))[_0xd81b('0x27')](handleError(_0x2fa588,null));};exports['show']=function(_0x1ba5d6,_0x5e1cd7){var _0x3c9264={'raw':![],'where':{'id':_0x1ba5d6[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x65')],'as':_0xd81b('0x4c')}]},_0x31553e={};_0x31553e[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0x4e')][_0xd81b('0x4f')]);_0x31553e[_0xd81b('0x52')]=_['keys'](_0x1ba5d6[_0xd81b('0x52')]);_0x31553e[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x31553e[_0xd81b('0x46')],_0x31553e[_0xd81b('0x52')]);_0x3c9264[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x31553e['model'],qs['fields'](_0x1ba5d6['query'][_0xd81b('0x57')]));_0x3c9264[_0xd81b('0x56')]=_0x3c9264[_0xd81b('0x56')][_0xd81b('0x58')]?_0x3c9264[_0xd81b('0x56')]:_0x31553e[_0xd81b('0x46')];if(_0x1ba5d6[_0xd81b('0x52')]['includeAll']){_0x3c9264[_0xd81b('0x63')]=[{'all':!![]}];}_0x3c9264=_[_0xd81b('0x60')]({},_0x3c9264,_0x1ba5d6[_0xd81b('0x66')]);return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x3c9264)[_0xd81b('0x1c')](handleEntityNotFound(_0x5e1cd7,null))[_0xd81b('0x1c')](respondWithResult(_0x5e1cd7,null))['catch'](handleError(_0x5e1cd7,null));};exports[_0xd81b('0x68')]=function(_0x15f003,_0x12b2a7){var _0x8cf25d=null;_0x15f003[_0xd81b('0x69')][_0xd81b('0x6a')][_0xd81b('0x3c')](',')[_0xd81b('0x6b')](_0x8fa8cd=>{if(_0x8fa8cd[_0xd81b('0x6c')]()!==''&&!wildcardUtils[_0xd81b('0x6d')](_0x8fa8cd[_0xd81b('0x6c')]())){_0x8cf25d=new APIBadRequestError('\x22'+_0x8fa8cd['trim']()+_0xd81b('0x6e'));}});if(_0x8cf25d){return handleError(_0x12b2a7,null)(_0x8cf25d);}return db['ChatWebsite'][_0xd81b('0x68')](_0x15f003[_0xd81b('0x69')],{})[_0xd81b('0x1c')](function(_0xc3c117){var _0xb94a69=_0x15f003[_0xd81b('0x6f')][_0xd81b('0x70')]({'plain':!![]});if(!_0xb94a69)throw new Error(_0xd81b('0x71'));if(_0xb94a69[_0xd81b('0x72')]===_0xd81b('0x6f')){var _0x5bcfd7=_0xc3c117[_0xd81b('0x70')]({'plain':!![]});var _0x344c32=_0xd81b('0x73');return db[_0xd81b('0x74')][_0xd81b('0x67')]({'where':{'name':_0x344c32,'userProfileId':_0xb94a69['userProfileId']},'raw':!![]})['then'](function(_0x3274d2){if(_0x3274d2&&_0x3274d2[_0xd81b('0x75')]===0x0){return db[_0xd81b('0x32')][_0xd81b('0x68')]({'name':_0x5bcfd7[_0xd81b('0x33')],'resourceId':_0x5bcfd7['id'],'type':_0x3274d2[_0xd81b('0x33')],'sectionId':_0x3274d2['id']},{})[_0xd81b('0x1c')](function(){return _0xc3c117;});}else{return _0xc3c117;}})['catch'](function(_0x2190df){logger[_0xd81b('0x23')](_0xd81b('0x76'),_0x2190df);throw _0x2190df;});}return _0xc3c117;})[_0xd81b('0x1c')](respondWithResult(_0x12b2a7,0xc9))[_0xd81b('0x27')](handleError(_0x12b2a7,null));};exports[_0xd81b('0x77')]=function(_0x1e0da3,_0x185f28){var _0x2315db=null;_0x1e0da3['body'][_0xd81b('0x6a')][_0xd81b('0x3c')](',')[_0xd81b('0x6b')](_0x9c30e7=>{if(_0x9c30e7[_0xd81b('0x6c')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x9c30e7[_0xd81b('0x6c')]())){_0x2315db=new APIBadRequestError('\x22'+_0x9c30e7[_0xd81b('0x6c')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x2315db){return handleError(_0x185f28,null)(_0x2315db);}if(_0x1e0da3[_0xd81b('0x69')]['id']){delete _0x1e0da3[_0xd81b('0x69')]['id'];}return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x1e0da3[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x65')],'as':'mandatoryDispositionPause'}]})[_0xd81b('0x1c')](handleEntityNotFound(_0x185f28,null))[_0xd81b('0x1c')](saveUpdates(_0x1e0da3[_0xd81b('0x69')],null))['then'](respondWithResult(_0x185f28,null))['catch'](handleError(_0x185f28,null));};exports[_0xd81b('0x31')]=function(_0x950cc3,_0x36c694){return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x950cc3[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x36c694,null))[_0xd81b('0x1c')](removeEntity(_0x36c694,null))['catch'](handleError(_0x36c694,null));};exports['describe']=function(_0x42ae01,_0x256696){return db[_0xd81b('0x4e')][_0xd81b('0x78')]()['then'](respondWithResult(_0x256696,null))[_0xd81b('0x27')](handleError(_0x256696,null));};exports[_0xd81b('0x79')]=function(_0x4b8294,_0x46e36b){if(_0x4b8294['body']['id']){delete _0x4b8294[_0xd81b('0x69')]['id'];}return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x4b8294[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x46e36b,null))[_0xd81b('0x1c')](function(_0x2490f1){if(_0x2490f1){_0x4b8294[_0xd81b('0x69')]['ChatWebsiteId']=_0x2490f1['id'];return db[_0xd81b('0x7a')][_0xd81b('0x68')](_0x4b8294[_0xd81b('0x69')]);}})[_0xd81b('0x1c')](respondWithResult(_0x46e36b,null))[_0xd81b('0x27')](handleError(_0x46e36b,null));};exports[_0xd81b('0x7b')]=function(_0x579052,_0x5c8ea0){var _0x31509d={'raw':![],'where':{}};var _0x3023d9={};var _0x97bd3e={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')]['findOne']({'where':{'id':_0x579052[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x5c8ea0,null))[_0xd81b('0x1c')](function(_0x195f1c){if(_0x195f1c){_0x3023d9[_0xd81b('0x46')]=_['keys'](db[_0xd81b('0x7a')][_0xd81b('0x4f')]);_0x3023d9[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x579052[_0xd81b('0x52')]);_0x3023d9[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x3023d9['model'],_0x3023d9[_0xd81b('0x52')]);_0x31509d[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x3023d9[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x579052[_0xd81b('0x52')]['fields']));_0x31509d[_0xd81b('0x56')]=_0x31509d['attributes'][_0xd81b('0x58')]?_0x31509d[_0xd81b('0x56')]:_0x3023d9[_0xd81b('0x46')];if(!_0x579052['query'][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x31509d[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x579052[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x31509d['offset']=qs[_0xd81b('0x2c')](_0x579052['query']['offset']);}_0x31509d[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x579052[_0xd81b('0x52')]['sort']);_0x31509d[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x579052[_0xd81b('0x52')],_0x3023d9[_0xd81b('0x54')]));_0x31509d[_0xd81b('0x5d')]['ChatWebsiteId']=_0x195f1c['id'];if(_0x579052[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x31509d[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x31509d[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x31509d[_0xd81b('0x56')],function(_0x270d82){var _0x380951={};_0x380951[_0x270d82]={'$like':'%'+_0x579052[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x380951;})});}_0x31509d=_[_0xd81b('0x60')]({},_0x31509d,_0x579052[_0xd81b('0x66')]);return db[_0xd81b('0x7a')][_0xd81b('0x2e')]({'where':_0x31509d['where']})[_0xd81b('0x1c')](function(_0x47f90e){_0x97bd3e[_0xd81b('0x2e')]=_0x47f90e;if(_0x579052[_0xd81b('0x52')][_0xd81b('0x62')]){_0x31509d[_0xd81b('0x63')]=[{'all':!![]}];}return db[_0xd81b('0x7a')][_0xd81b('0x7c')](_0x31509d);})['then'](function(_0x3a41e6){_0x97bd3e[_0xd81b('0x7d')]=_0x3a41e6;return _0x97bd3e;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x5c8ea0,_0x31509d))[_0xd81b('0x27')](handleError(_0x5c8ea0,null));};exports[_0xd81b('0x7e')]=function(_0x6e4c25,_0x2481e9){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x6e4c25[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x2481e9,null))[_0xd81b('0x1c')](function(_0x5a02f7){if(_0x5a02f7){return _0x5a02f7[_0xd81b('0x7e')](_0x6e4c25[_0xd81b('0x52')][_0xd81b('0x7f')]);}})[_0xd81b('0x1c')](respondWithStatusCode(_0x2481e9,null))[_0xd81b('0x27')](handleError(_0x2481e9,null));};exports['addAnswer']=function(_0x421c2b,_0x1e61d8){if(_0x421c2b[_0xd81b('0x69')]['id']){delete _0x421c2b[_0xd81b('0x69')]['id'];}return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x421c2b['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x1e61d8,null))['then'](function(_0x4461f3){if(_0x4461f3){_0x421c2b[_0xd81b('0x69')][_0xd81b('0x80')]=_0x4461f3['id'];return db[_0xd81b('0x81')]['create'](_0x421c2b[_0xd81b('0x69')]);}})[_0xd81b('0x1c')](respondWithResult(_0x1e61d8,null))['catch'](handleError(_0x1e61d8,null));};exports[_0xd81b('0x82')]=function(_0x142d78,_0x2c1a0e){var _0x1c6291={'raw':![],'where':{}};var _0x2f9a9f={};var _0x4c8925={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd81b('0x83')]({'where':{'id':_0x142d78['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x2c1a0e,null))['then'](function(_0x509001){if(_0x509001){_0x2f9a9f[_0xd81b('0x46')]=_[_0xd81b('0x53')](db['CannedAnswer']['rawAttributes']);_0x2f9a9f[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x142d78['query']);_0x2f9a9f[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x2f9a9f[_0xd81b('0x46')],_0x2f9a9f[_0xd81b('0x52')]);_0x1c6291['attributes']=_[_0xd81b('0x55')](_0x2f9a9f[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x142d78['query']['fields']));_0x1c6291[_0xd81b('0x56')]=_0x1c6291[_0xd81b('0x56')][_0xd81b('0x58')]?_0x1c6291[_0xd81b('0x56')]:_0x2f9a9f[_0xd81b('0x46')];if(!_0x142d78['query']['hasOwnProperty'](_0xd81b('0x5a'))){_0x1c6291[_0xd81b('0x2f')]=qs['limit'](_0x142d78['query'][_0xd81b('0x2f')]);_0x1c6291[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x142d78[_0xd81b('0x52')][_0xd81b('0x2c')]);}_0x1c6291[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x142d78[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x1c6291[_0xd81b('0x5d')]=qs['filters'](_['pick'](_0x142d78[_0xd81b('0x52')],_0x2f9a9f[_0xd81b('0x54')]));_0x1c6291[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x509001['id'];if(_0x142d78[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x1c6291[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x1c6291[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x1c6291[_0xd81b('0x56')],function(_0x32e484){var _0x30fb62={};_0x30fb62[_0x32e484]={'$like':'%'+_0x142d78[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x30fb62;})});}_0x1c6291=_['merge']({},_0x1c6291,_0x142d78[_0xd81b('0x66')]);return db[_0xd81b('0x81')][_0xd81b('0x2e')]({'where':_0x1c6291['where']})[_0xd81b('0x1c')](function(_0x3bd28c){_0x4c8925[_0xd81b('0x2e')]=_0x3bd28c;if(_0x142d78[_0xd81b('0x52')][_0xd81b('0x62')]){_0x1c6291['include']=[{'all':!![]}];}return db[_0xd81b('0x81')][_0xd81b('0x7c')](_0x1c6291);})[_0xd81b('0x1c')](function(_0x30fe56){_0x4c8925[_0xd81b('0x7d')]=_0x30fe56;return _0x4c8925;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x2c1a0e,_0x1c6291))[_0xd81b('0x27')](handleError(_0x2c1a0e,null));};exports[_0xd81b('0x84')]=function(_0x1c3ea4,_0x282e83){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x1c3ea4['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x282e83,null))[_0xd81b('0x1c')](function(_0x15d52d){if(_0x15d52d){return _0x15d52d['removeAnswers'](_0x1c3ea4[_0xd81b('0x52')][_0xd81b('0x7f')]);}})[_0xd81b('0x1c')](respondWithStatusCode(_0x282e83,null))[_0xd81b('0x27')](handleError(_0x282e83,null));};exports['addLogo']=function(_0x1e5f94,_0x4e037b){_0x1e5f94['body'][_0xd81b('0x85')]=_0x1e5f94[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x1e5f94['params']['id']}})['then'](handleEntityNotFound(_0x4e037b,null))[_0xd81b('0x1c')](saveUpdates(_0x1e5f94[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x4e037b,null))[_0xd81b('0x27')](handleError(_0x4e037b,null));};exports[_0xd81b('0x88')]=function(_0x36611b,_0x368fc6){_0x36611b[_0xd81b('0x69')][_0xd81b('0x89')]=_0x36611b[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x36611b[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x368fc6,null))[_0xd81b('0x1c')](saveUpdates(_0x36611b[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x368fc6,null))[_0xd81b('0x27')](handleError(_0x368fc6,null));};exports[_0xd81b('0x8a')]=function(_0x4c6848,_0x1162c0){_0x4c6848[_0xd81b('0x69')][_0xd81b('0x8b')]=_0x4c6848[_0xd81b('0x86')][_0xd81b('0x87')];return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x4c6848[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x1162c0,null))[_0xd81b('0x1c')](saveUpdates(_0x4c6848[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x1162c0,null))[_0xd81b('0x27')](handleError(_0x1162c0,null));};exports[_0xd81b('0x8c')]=function(_0x11b49d,_0x22e808){_0x11b49d[_0xd81b('0x69')][_0xd81b('0x8d')]=_0x11b49d[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x11b49d[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x22e808,null))[_0xd81b('0x1c')](saveUpdates(_0x11b49d['body'],null))[_0xd81b('0x1c')](respondWithResult(_0x22e808,null))[_0xd81b('0x27')](handleError(_0x22e808,null));};exports[_0xd81b('0x8e')]=function(_0x478b92,_0xf13081){var _0x3069d1=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/logos/default_logo.svg');var _0x2a6dcb={'where':{'id':_0x478b92[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x85')],'raw':!![]};var _0xf2e1b5=![];return require(_0xd81b('0x91'))[_0xd81b('0x92')]()[_0xd81b('0x1c')](function(_0x55384e){if(_0x55384e){_0xf2e1b5=_0x55384e['custom'];}})[_0xd81b('0x1c')](function(){return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x2a6dcb);})['then'](handleEntityNotFound(_0xf13081,null))[_0xd81b('0x1c')](function(_0x5189b8){if(_0x5189b8){if(!_[_0xd81b('0x93')](_0x5189b8[_0xd81b('0x85')])){if(fs[_0xd81b('0x94')](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x95'),_0x5189b8[_0xd81b('0x85')]))&&_0xf2e1b5){_0x3069d1=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/logos/',_0x5189b8[_0xd81b('0x85')]);}}return _0xf13081[_0xd81b('0x96')](_0x3069d1);}})[_0xd81b('0x27')](handleError(_0xf13081,null));};exports['getAvatar']=function(_0x4b2b45,_0x4d44d7){var _0x3c5ea6=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x97'));var _0x175d02={'where':{'id':_0x4b2b45[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x89')],'raw':!![]};return db['ChatWebsite'][_0xd81b('0x67')](_0x175d02)[_0xd81b('0x1c')](handleEntityNotFound(_0x4d44d7,null))[_0xd81b('0x1c')](function(_0x361d5a){if(_0x361d5a){if(!_['isNil'](_0x361d5a[_0xd81b('0x89')])){if(fs['existsSync'](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x98'),_0x361d5a['agentAvatar']))){_0x3c5ea6=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0x361d5a[_0xd81b('0x89')]);}}return _0x4d44d7['download'](_0x3c5ea6);}})[_0xd81b('0x27')](handleError(_0x4d44d7,null));};exports[_0xd81b('0x99')]=function(_0x10449f,_0x539668){var _0x277379=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x9a'));var _0x1e2612={'where':{'id':_0x10449f[_0xd81b('0x64')]['id']},'attributes':['id','customerAvatar',_0xd81b('0x9b')],'raw':!![]};return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x1e2612)['then'](handleEntityNotFound(_0x539668,null))[_0xd81b('0x1c')](function(_0xc9bdfe){if(_0xc9bdfe){if(!_[_0xd81b('0x93')](_0xc9bdfe[_0xd81b('0x8b')])){if(fs[_0xd81b('0x94')](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0xc9bdfe['customerAvatar']))&&_0xc9bdfe['showCustomerAvatar']){_0x277379=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0xc9bdfe[_0xd81b('0x8b')]);}}return _0x539668['download'](_0x277379);}})['catch'](handleError(_0x539668,null));};exports[_0xd81b('0x9c')]=function(_0x397d26,_0x335713){var _0x1b18ef=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x9d'));var _0x13e25f={'where':{'id':_0x397d26[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x8d')],'raw':!![]};return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x13e25f)[_0xd81b('0x1c')](handleEntityNotFound(_0x335713,null))[_0xd81b('0x1c')](function(_0x4283bd){if(_0x4283bd){if(!_['isNil'](_0x4283bd[_0xd81b('0x8d')])){if(fs[_0xd81b('0x94')](path['join'](config[_0xd81b('0x90')],'server/files/images/avatars/',_0x4283bd[_0xd81b('0x8d')]))){_0x1b18ef=path['join'](config[_0xd81b('0x90')],_0xd81b('0x98'),_0x4283bd[_0xd81b('0x8d')]);}}return _0x335713[_0xd81b('0x96')](_0x1b18ef);}})[_0xd81b('0x27')](handleError(_0x335713,null));};function checkWebsiteInterval(_0x2164d4){var _0x7e3d22=_0x2164d4[_0xd81b('0x9e')];if(!_0x7e3d22){return Promise[_0xd81b('0x9f')](_0x2164d4);}var _0x1b0156=_0x2164d4[_0xd81b('0xa0')]||undefined;return _0x7e3d22[_0xd81b('0xa1')](_0x1b0156)['then'](function(_0x8cda4b){if(!_0x8cda4b){throw new APIOutOfIntervalError();}return _0x2164d4;});}exports[_0xd81b('0xa2')]=function(_0x22dd20,_0x2ea321){var _0x305014={'body':_0x22dd20[_0xd81b('0x69')],'channel':_0xd81b('0xa3')};var _0x10382d=[];var _0x282942=[];var _0x24a88b={};var _0x48e6ba=![];if(_0x22dd20[_0xd81b('0x69')]['id']){delete _0x22dd20[_0xd81b('0x69')]['id'];}if(_['isNil'](_0x22dd20[_0xd81b('0x69')]['from'])){throw new APIBadRequestError(_0xd81b('0xa4'));}if(_[_0xd81b('0x93')](_0x22dd20['body'][_0xd81b('0xa5')])){throw new APIBadRequestError(_0xd81b('0xa6'));}if(_[_0xd81b('0xa7')](_0x22dd20[_0xd81b('0x69')]['body'])){throw new APIBadRequestError(_0xd81b('0xa8'));}var _0x3a248d=_0x22dd20[_0xd81b('0x69')][_0xd81b('0x38')]&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0x40')];return db['CmContact'][_0xd81b('0x78')]()[_0xd81b('0x1c')](function(_0x14a219){if(!_0x14a219){throw new Error('No\x20available\x20attributes');}_0x10382d=Object['keys'](_0x14a219)[_0xd81b('0x5f')](function(_0x322771){return![_0xd81b('0xa9'),'updatedAt'][_0xd81b('0xaa')](_0x322771);});_0x282942=Object[_0xd81b('0x53')](_0x14a219)[_0xd81b('0x5f')](function(_0x4719f3){return![_0xd81b('0xa9'),_0xd81b('0xab'),'CompanyId',_0xd81b('0xac')][_0xd81b('0xaa')](_0x4719f3);});if(!_['includes'](_0x282942,_0x22dd20[_0xd81b('0x69')][_0xd81b('0xa5')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x282942[_0xd81b('0x8f')](',\x20'));}_0x24a88b[_0x22dd20[_0xd81b('0x69')][_0xd81b('0xa5')]]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xad')];})[_0xd81b('0x1c')](function(){return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x22dd20[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0xae')],'as':'List','include':[{'model':db[_0xd81b('0xaf')],'as':_0xd81b('0xb0'),'where':_0x24a88b,'limit':0x1,'order':[['updatedAt',_0xd81b('0xb1')]]}]},{'model':db[_0xd81b('0xb2')],'as':_0xd81b('0xb3')},{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0x9e'),'include':[{'model':db['Interval'],'as':_0xd81b('0xb4'),'attributes':['id',_0xd81b('0xb5')],'raw':!![]}]}]});})[_0xd81b('0x1c')](function(_0x9658e){if(!_0x9658e){throw new APINotFoundError(util[_0xd81b('0x43')](_0xd81b('0xb6'),_0x22dd20[_0xd81b('0x64')]['id']));}if(_0x3a248d){return checkWebsiteInterval(_0x9658e);}return _0x9658e;})[_0xd81b('0x1c')](function(_0x44d405){_0x305014[_0xd81b('0xb7')]=_0x44d405;_0x305014[_0xd81b('0xb8')]=_['orderBy'](_0x44d405['Applications'],[_0xd81b('0xb9')],[_0xd81b('0xba')]);if(_0x305014[_0xd81b('0xb7')]['Applications']){delete _0x305014[_0xd81b('0xb7')][_0xd81b('0xb3')];}_0x305014[_0xd81b('0xbb')]=_0x44d405['List']||{'id':_0x44d405[_0xd81b('0xac')]};if(_0x305014[_0xd81b('0xbb')]&&_0x305014['list'][_0xd81b('0xb0')][_0xd81b('0x58')]){return _0x305014[_0xd81b('0xbb')][_0xd81b('0xb0')][0x0];}var _0x8026d7=_[_0xd81b('0x16')](_0x22dd20[_0xd81b('0x69')],{'firstName':_0x22dd20['body'][_0xd81b('0xad')],'ListId':_0x44d405[_0xd81b('0xac')]});_0x8026d7[_0x22dd20['body'][_0xd81b('0xa5')]]=_0x22dd20['body'][_0xd81b('0xad')];return db[_0xd81b('0xaf')][_0xd81b('0x68')](_0x8026d7,{'fields':_0x10382d,'raw':!![]});})[_0xd81b('0x1c')](function(_0x3a6e15){_0x305014[_0xd81b('0xbc')]=_0x3a6e15;var _0x87b315=createInteractionObject(_0x22dd20['params']['id'],_0x22dd20[_0xd81b('0x69')],_0x22dd20['headers'],_0x3a6e15);var _0x48073b={'ChatWebsiteId':_0x22dd20[_0xd81b('0x64')]['id']};if(_0x22dd20['body'][_0xd81b('0xbd')]){_0x48073b[_0xd81b('0xbd')]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')];_0x48073b['closed']=![];return db['ChatInteraction'][_0xd81b('0x67')]({'where':_0x48073b})[_0xd81b('0x1c')](function(_0x50529b){var _0x2ec729=_0x22dd20[_0xd81b('0x69')][_0xd81b('0x38')]&&_0x22dd20['body'][_0xd81b('0x40')];if(_0x50529b){_0x48e6ba=!![];return _0x50529b;}else if(!_0x2ec729&&_0x50529b&&_0x50529b[_0xd81b('0xbe')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x87b315[_0xd81b('0xbd')]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')];_0x87b315[_0xd81b('0xbf')]=_0x22dd20[_0xd81b('0x69')]['externalUrl'];return db['ChatInteraction'][_0xd81b('0x68')](_0x87b315);});}_0x48073b[_0xd81b('0xc0')]=_0x3a6e15['id'];if(_0x22dd20[_0xd81b('0x69')][_0xd81b('0xc1')]&&_0x22dd20['body'][_0xd81b('0xc1')]['id']){_0x48073b['id']=_0x22dd20['body'][_0xd81b('0xc1')]['id'];return db[_0xd81b('0xc2')]['find']({'where':_0x48073b})[_0xd81b('0x1c')](function(_0x264d72){var _0x1d5dac=_0x22dd20['body'][_0xd81b('0x38')]&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0x40')];if(!_0x1d5dac&&_0x264d72&&_0x264d72['closed']){throw new APIConflictError(_0xd81b('0xc3'));}else if(_0x264d72){_0x48e6ba=!![];return _0x264d72;}else{return db[_0xd81b('0xc2')][_0xd81b('0x68')](_0x87b315);}});}return db[_0xd81b('0xc2')][_0xd81b('0x68')](_0x87b315);})['then'](function(_0x5c3dce){if(!_0x48e6ba){return _0x5c3dce;}var _0x105735={'from':(_0x305014[_0xd81b('0xbc')][_0xd81b('0x3d')]||'')+'\x20'+(_0x305014[_0xd81b('0xbc')]['lastName']||'')};if(_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')]&&_0x22dd20[_0xd81b('0x69')]['messageId']&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')]!=_0x22dd20[_0xd81b('0x69')]['messageId']){_0x105735['threadId']=_0x22dd20['body'][_0xd81b('0xc4')];}return _0x5c3dce['update'](_0x105735);})[_0xd81b('0x1c')](function(_0x3d7a57){_0x305014[_0xd81b('0xc1')]=_0x3d7a57['get']({'plain':!![]});_0x305014['interaction'][_0xd81b('0xc5')]=!_0x48e6ba;if(_0x305014['interaction'][_0xd81b('0xc5')]){if(_0x305014[_0xd81b('0xb7')][_0xd81b('0xc6')]){_0x305014[_0xd81b('0xb8')]['push']({'id':0x0,'priority':_0x305014[_0xd81b('0xb8')][_0xd81b('0x58')]+0x1,'app':_0xd81b('0xc7'),'appdata':'unmanaged','interval':_0xd81b('0xc8')});}}return db['ChatMessage'][_0xd81b('0x68')]({'body':_0x22dd20[_0xd81b('0x69')]['body'],'ChatWebsiteId':_0x22dd20[_0xd81b('0x64')]['id'],'ChatInteractionId':_0x3d7a57['id'],'direction':'in','ContactId':_0x305014[_0xd81b('0xbc')]['id'],'AttachmentId':_0x22dd20[_0xd81b('0x69')]['AttachmentId']});})['then'](function(_0x1c10da){_0x305014[_0xd81b('0x25')]=_0x1c10da;if(!_0x305014[_0xd81b('0xc1')][_0xd81b('0xc9')]){return;}return db[_0xd81b('0xca')][_0xd81b('0x67')]({'attributes':['id',_0xd81b('0x33')],'where':{'id':_0x305014['interaction']['UserId']}});})[_0xd81b('0x1c')](function(_0x10f27c){if(_0x10f27c){_0x305014[_0xd81b('0xb8')][_0xd81b('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10f27c[_0xd81b('0x33')]+','+(_0x305014[_0xd81b('0xb7')][_0xd81b('0xcc')]||0xa),'interval':_0xd81b('0xc8')});_0x305014[_0xd81b('0xcd')]=!![];}if(!_0x305014['interaction']['queueId']){return;}return db[_0xd81b('0xce')][_0xd81b('0x67')]({'attributes':['id',_0xd81b('0x33')],'where':{'id':_0x305014[_0xd81b('0xc1')][_0xd81b('0xcf')]}});})['then'](function(_0x49e5dd){if(_0x49e5dd){_0x305014[_0xd81b('0xb8')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd81b('0xd0'),'appdata':_0x49e5dd[_0xd81b('0x33')]+','+(_0x305014[_0xd81b('0xb7')][_0xd81b('0xd1')]||0x12c),'interval':_0xd81b('0xc8')});}return respondWithRpcPromise(_0xd81b('0xd2'),_0xd81b('0xd3'),_0x305014);})[_0xd81b('0x1c')](function(_0x538cc2){respondWithRpcPromise(_0xd81b('0xd4'),_0xd81b('0xd4'),{'event':_0xd81b('0xa2'),'message':_0x538cc2},client9002);return _0x538cc2;})[_0xd81b('0x1c')](respondWithResult(_0x2ea321,null))[_0xd81b('0x27')](APIHandleError(_0x2ea321));};exports[_0xd81b('0xd5')]=function(_0x2f4b2b,_0x59779e){var _0x1e184c,_0x5d6b18,_0x19eef8;var _0x520762=[];var _0x36650d={};var _0x1c5923=_0x2f4b2b['files']||[];var _0x16865b=[];var _0x522616;return db[_0xd81b('0xaf')][_0xd81b('0x78')]()['then'](function(_0x98f92e){if(!_0x98f92e){throw new db['Sequelize'][(_0xd81b('0xd6'))](_0xd81b('0xd7'));}_0x520762=_[_0xd81b('0xd8')](_[_0xd81b('0x53')](_0x98f92e),[_0xd81b('0xa9'),_0xd81b('0xab'),_0xd81b('0xd9'),_0xd81b('0xac')]);if(_0x2f4b2b[_0xd81b('0x69')]['id']){delete _0x2f4b2b[_0xd81b('0x69')]['id'];}if(_[_0xd81b('0x93')](_0x2f4b2b[_0xd81b('0x69')]['from'])){throw _0x59779e[_0xd81b('0x29')](0x1f4)['send'](new db[(_0xd81b('0xda'))][(_0xd81b('0xd6'))](_0xd81b('0xdb')));}if(_[_0xd81b('0x93')](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0x69')])||_0x2f4b2b[_0xd81b('0x69')]['body']===''){throw _0x59779e[_0xd81b('0x29')](0x1f4)['send'](new db[(_0xd81b('0xda'))]['ValidationError'](_0xd81b('0xdc')));}if(_['isNil'](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0xdd')])){throw _0x59779e[_0xd81b('0x29')](0x1f4)[_0xd81b('0x34')](new db['Sequelize'][(_0xd81b('0xd6'))](_0xd81b('0xde')+_0x520762));}if(!_['includes'](_0x520762,_0x2f4b2b['body']['mapKeyOffline'])){throw _0x59779e[_0xd81b('0x29')](0x1f4)[_0xd81b('0x34')](new db[(_0xd81b('0xda'))][(_0xd81b('0xd6'))](_0xd81b('0xdf')+_0x520762));}_0x36650d[_0x2f4b2b[_0xd81b('0x69')]['mapKeyOffline']]=_0x2f4b2b['body'][_0xd81b('0xad')];})['then'](function(){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x2f4b2b[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0xae')],'as':_0xd81b('0xe0')},{'model':db[_0xd81b('0xe1')],'as':_0xd81b('0xe1')}]});})[_0xd81b('0x1c')](handleEntityNotFound(_0x59779e,null))[_0xd81b('0x1c')](function(_0x28cbe7){if(_0x28cbe7&&_0x28cbe7[_0xd81b('0xe0')]){_0x5d6b18=_0x28cbe7;var _0x30abaf=_[_0xd81b('0x16')](_0x2f4b2b[_0xd81b('0x69')],{'firstName':_0x2f4b2b['body'][_0xd81b('0xad')],'phone':_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0xad')],'ListId':_0x28cbe7[_0xd81b('0xac')]});_0x30abaf[_0x2f4b2b[_0xd81b('0x69')]['mapKeyOffline']]=_0x2f4b2b[_0xd81b('0x69')]['from'];return db['CmContact'][_0xd81b('0xe2')]({'where':_0x36650d,'defaults':_0x30abaf});}})['spread'](function(_0x126aaa){if(_0x126aaa){_0x19eef8=_0x126aaa;var _0x3e8623=fs[_0xd81b('0xe3')](path['join'](config[_0xd81b('0x90')],_0xd81b('0xe4')),_0xd81b('0xe5'));var _0x576d9d=ejs[_0xd81b('0xe6')](_0x3e8623,{'body':_[_0xd81b('0xe7')](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0x69')]),'bodyTitle':_0x5d6b18[_0xd81b('0xe8')]});return db[_0xd81b('0xe9')]['create']({'body':_0x576d9d,'plainBody':htmlToText[_0xd81b('0xea')](_0x576d9d),'ContactId':_0x126aaa['id'],'ChatWebsiteId':_0x5d6b18['id']});}})[_0xd81b('0x1c')](function(_0x3b6ed5){_0x522616=_0x3b6ed5;if(_0x1c5923[_0xd81b('0x58')]){var _0x11b997=_0x1c5923[_0xd81b('0x4d')](function(_0x3ec25d){return{'name':_0x3ec25d[_0xd81b('0xeb')],'basename':_0x3ec25d[_0xd81b('0x87')],'type':_0x3ec25d['mimetype'],'ChatOfflineMessageId':_0x3b6ed5['id']};});_0x16865b=_0x11b997[_0xd81b('0x4d')](_0x10a82f=>{var _0x255f26={'filename':_0x10a82f[_0xd81b('0x33')],'path':path['join'](config[_0xd81b('0x90')],_0xd81b('0xec'),_0xd81b('0xed'),'attachments',_0xd81b('0xee'),_0x10a82f[_0xd81b('0xef')])};return _0x255f26;});if(!_0x5d6b18[_0xd81b('0xf0')]){return db[_0xd81b('0xf1')][_0xd81b('0xf2')](function(_0x4f1d2b){return db[_0xd81b('0xf3')][_0xd81b('0xf4')](_0x11b997,{'transaction':_0x4f1d2b});});}}})[_0xd81b('0x1c')](function(){if(_0x522616){_0x1e184c=_0x522616;return db['MailAccount'][_0xd81b('0x83')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd81b('0xf5')],'as':_0xd81b('0xf5'),'raw':!![]}]}]});}})['then'](function(_0x2e4523){if(_0x2e4523&&_0x2e4523['Smtp']&&_0x5d6b18[_0xd81b('0xf6')]&&_0x5d6b18[_0xd81b('0xf7')]){var _0x3a10ac=_0x2e4523[_0xd81b('0xf8')]();return respondWithRpcPromise('SendMail',_0xd81b('0xf9'),{'account':_0x3a10ac,'message':{'from':util[_0xd81b('0x43')](_0xd81b('0xfa'),_0x2e4523[_0xd81b('0x33')],_0x2e4523[_0xd81b('0xfb')]||_0x2e4523[_0xd81b('0xfc')]['user']),'to':_0x5d6b18[_0xd81b('0xf7')],'subject':_0x5d6b18['offlineMessageSubject'],'html':_0x1e184c['body'],'attachments':_0x16865b}},client9003)[_0xd81b('0x1c')](function(){return _0x1e184c;})[_0xd81b('0x27')](function(_0xb2d684){logger['error'](_0xb2d684);});}})[_0xd81b('0x1c')](function(){if(_0x5d6b18&&_0x5d6b18[_0xd81b('0xf0')]&&_0x5d6b18['MailAccountId']){var _0x50fbfd=[];if(_0x1c5923[_0xd81b('0x58')]){_0x50fbfd=_0x1c5923[_0xd81b('0x4d')](function(_0x44e2a8){return{'name':_0x44e2a8[_0xd81b('0xeb')],'basename':_0x44e2a8[_0xd81b('0x87')],'type':_0x44e2a8[_0xd81b('0xfd')],'ChatOfflineMessageId':_0x522616['id']};});}var _0x462925;if(!_[_0xd81b('0x93')](_0x5d6b18[_0xd81b('0xfe')])){var _0x41d12a=_[_0xd81b('0x4d')](_0x2f4b2b[_0xd81b('0x69')],function(_0x2f3170){return _0x2f3170;});var _0xfc4221=_['toPairsIn'](_0x41d12a)[0x0];var _0x25939f=_[_0xd81b('0xff')](_0xfc4221,function(_0x5a7cb8){return _0x5a7cb8;});_0x462925=_0x25939f[0x1][_0x5d6b18[_0xd81b('0xfe')]];}var _0x250cd7={'from':_0x19eef8[_0xd81b('0xfb')],'firstName':_0x19eef8[_0xd81b('0x3d')],'lastName':_0x19eef8['lastName'],'mapKey':_0xd81b('0xfb'),'message':{'from':_0x19eef8[_0xd81b('0xfb')],'to':_0x5d6b18[_0xd81b('0xe1')][_0xd81b('0xfb')],'cc':'','subject':_[_0xd81b('0x93')](_0x462925)?_0x5d6b18[_0xd81b('0x100')]:_0x462925,'messageId':'','sentAt':new Date(),'attach':_0x50fbfd['length'],'attachments':_0x50fbfd,'originChannel':_0xd81b('0x101'),'ChatWebsiteId':_0x5d6b18['id'],'ChatOfflineMessageId':_0x1e184c['id'],'originTo':_0x5d6b18[_0xd81b('0xe1')][_0xd81b('0xfb')]},'body':_0x1e184c[_0xd81b('0x69')]};var _0x35320d={'account':{'id':_0x5d6b18[_0xd81b('0x102')]},'body':_0x250cd7,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xd81b('0x103'),_0x35320d,client9001)[_0xd81b('0x1c')](function(){return _0x1e184c;})[_0xd81b('0x27')](function(_0x3c329e){logger['error'](_0x3c329e);});}return;})[_0xd81b('0x1c')](function(){if(_0x1e184c){return _0x1e184c;}})[_0xd81b('0x1c')](respondWithResult(_0x59779e,null))[_0xd81b('0x27')](function(){for(var _0x468794 of _0x1c5923){var _0x1c3473=path['join'](config[_0xd81b('0x90')],'server',_0xd81b('0xed'),_0xd81b('0x104'),'offline-chat',_0x468794['filename']);fs_extra[_0xd81b('0x105')](_0x1c3473)['catch'](function(_0x5f1c6b){logger[_0xd81b('0x23')](_0xd81b('0x106'),_0x1c3473,_0x5f1c6b);});}});};exports[_0xd81b('0x107')]=function(_0x56195b,_0x584698){return db[_0xd81b('0xc2')][_0xd81b('0x67')]({'where':{'id':_0x56195b[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x584698,null))[_0xd81b('0x1c')](function(_0xae9cb8){if(_0xae9cb8){return _0xae9cb8['addInteraction'](_0x56195b['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x56195b[_0xd81b('0x69')],['ids','id'])||{});}})[_0xd81b('0x1c')](respondWithResult(_0x584698,null))[_0xd81b('0x27')](handleError(_0x584698,null));};exports['getInteractions']=function(_0x22e159,_0x3d3ee1){var _0x31e7f7={'raw':![],'where':{}};var _0x4850d8={};var _0x51c975={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0x22e159[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x3d3ee1,null))[_0xd81b('0x1c')](function(_0x525220){if(_0x525220){_0x4850d8[_0xd81b('0x46')]=_[_0xd81b('0x53')](db['ChatInteraction'][_0xd81b('0x4f')]);_0x4850d8[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x22e159['query']);_0x4850d8[_0xd81b('0x54')]=_['intersection'](_0x4850d8[_0xd81b('0x46')],_0x4850d8['query']);_0x31e7f7[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x4850d8[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x22e159[_0xd81b('0x52')][_0xd81b('0x57')]));_0x31e7f7['attributes']=_0x31e7f7['attributes'][_0xd81b('0x58')]?_0x31e7f7[_0xd81b('0x56')]:_0x4850d8[_0xd81b('0x46')];if(!_0x22e159[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x31e7f7[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x22e159['query'][_0xd81b('0x2f')]);_0x31e7f7[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x22e159[_0xd81b('0x52')]['offset']);}_0x31e7f7[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x22e159[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x31e7f7['where']=qs[_0xd81b('0x54')](_['pick'](_0x22e159['query'],_0x4850d8[_0xd81b('0x54')]));_0x31e7f7[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x525220['id'];if(_0x22e159[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x31e7f7[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x31e7f7['where'],{'$or':_[_0xd81b('0x4d')](_0x31e7f7[_0xd81b('0x56')],function(_0x16ef58){var _0x3b4240={};_0x3b4240[_0x16ef58]={'$like':'%'+_0x22e159['query'][_0xd81b('0x5f')]+'%'};return _0x3b4240;})});}_0x31e7f7=_[_0xd81b('0x60')]({},_0x31e7f7,_0x22e159['options']);return db[_0xd81b('0xc2')]['count']({'where':_0x31e7f7[_0xd81b('0x5d')]})['then'](function(_0x54062e){_0x51c975[_0xd81b('0x2e')]=_0x54062e;if(_0x22e159[_0xd81b('0x52')][_0xd81b('0x62')]){_0x31e7f7[_0xd81b('0x63')]=[{'model':db['CmContact'],'as':_0xd81b('0x109'),'required':![]},{'model':db['User'],'as':_0xd81b('0x10a'),'attributes':[_0xd81b('0x33'),_0xd81b('0x10b'),_0xd81b('0x10c')],'required':![]},{'model':db[_0xd81b('0x10d')],'as':_0xd81b('0x10e'),'attributes':['id',_0xd81b('0x33'),_0xd81b('0x10f')],'where':_0x22e159[_0xd81b('0x52')]['tag']?{'id':_0x22e159[_0xd81b('0x52')][_0xd81b('0x110')]}:undefined,'required':_0x22e159[_0xd81b('0x52')][_0xd81b('0x110')]?!![]:![]}];}return db[_0xd81b('0xc2')][_0xd81b('0x7c')](_0x31e7f7);})[_0xd81b('0x1c')](function(_0x23139c){_0x51c975[_0xd81b('0x7d')]=_0x23139c;return _0x51c975;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x3d3ee1,_0x31e7f7))['catch'](handleError(_0x3d3ee1,null));};exports[_0xd81b('0x111')]=function(_0x432b04,_0x2ff8f6){var _0x30a57a=0x0;var _0x25f776=0x0;var _0x1313da=![];var _0x115026;var _0x202316;return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x432b04[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0x9e'),'include':[{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0xb4'),'attributes':['id',_0xd81b('0xb5')]}]}]})[_0xd81b('0x1c')](handleEntityNotFound(_0x2ff8f6,null))['then'](function(_0x16ccac){if(_0x16ccac){_0x115026=_0x16ccac;return _0x16ccac['getProactiveActions']({'raw':!![]});}})[_0xd81b('0x1c')](function(_0x1c3879){if(_0x115026){if(_0x1c3879){_0x202316=_0x1c3879;}}return require(_0xd81b('0x91'))[_0xd81b('0x92')]();})[_0xd81b('0x1c')](function(_0x4e6c6d){if(_0x4e6c6d){_0x25f776=_0x4e6c6d[_0xd81b('0x112')];_0x1313da=_0x4e6c6d[_0xd81b('0x113')];}})[_0xd81b('0x1c')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xd81b('0x1c')](function(_0x366808){_0x30a57a=_0x366808;if(_0x25f776&&_0x366808>_0x25f776){return db['License'][_0xd81b('0x83')]({'where':{'id':0x1}})[_0xd81b('0x1c')](function(_0x2ac7d3){if(_0x2ac7d3){_0x2ac7d3[_0xd81b('0x114')](_0xd81b('0x115'));}});}})[_0xd81b('0x1c')](function(){var _0x203fbe=_0x115026[_0xd81b('0x9e')];var _0xf1f6f2=_0x115026[_0xd81b('0xa0')]||undefined;return _0x203fbe?_0x203fbe[_0xd81b('0xa1')](_0xf1f6f2):!![];})[_0xd81b('0x1c')](function(_0xe0b626){var _0x5a187a=fs[_0xd81b('0xe3')](path['join'](config[_0xd81b('0x90')],_0xd81b('0x116')),_0xd81b('0xe5'));var _0x4cb573=_0xd81b('0x117');var _0x53d707=![];var _0x480fab,_0x1685e6;if(_0x432b04[_0xd81b('0x118')]['referer']){_0x480fab=new URL(_0x432b04['headers'][_0xd81b('0x40')])[_0xd81b('0x119')];}else if(_0x432b04[_0xd81b('0x118')][_0xd81b('0x119')]){_0x480fab=new URL(_0x432b04[_0xd81b('0x118')]['origin'])[_0xd81b('0x119')];}else{_0x480fab=_0xd81b('0x11a');}_0x1685e6=typeof _0x115026[_0xd81b('0x6a')][_0xd81b('0x3c')](',')['find'](function(_0x549d83){return wildcardUtils[_0xd81b('0x11b')](_0x549d83,_0x480fab);})!==_0xd81b('0x2d');var _0x39eb20={'chatVersion':_0x4cb573,'chatWebsiteAddressOrigin':_0x1685e6?_0x480fab:_0x115026[_0xd81b('0x6a')],'remote':_0x115026[_0xd81b('0x11c')],'query':querystring[_0xd81b('0x22')](_['merge'](_0x115026[_0xd81b('0x70')]({'plain':!![]}),{'customerIp':_0x432b04[_0xd81b('0x118')]['x-forwarded-for']||_0x432b04[_0xd81b('0x118')][_0xd81b('0x11d')]||_0x432b04[_0xd81b('0x11e')][_0xd81b('0x11f')]||_0x432b04['ip'],'referer':_0x432b04['headers'][_0xd81b('0x40')],'openedInteractions':_0x30a57a,'maxInteractions':_0x25f776,'virtual':_0x1313da[_0xd81b('0x112')],'online':_0xe0b626,'custom':_0x1313da,'address':_0x1685e6?_0x480fab:null}))[_0xd81b('0x120')](/'/g,'\x5c\x27')};_0x2ff8f6[_0xd81b('0x34')](ejs[_0xd81b('0xe6')](Mustache[_0xd81b('0xe6')](_0x5a187a,_0x39eb20),{'proactiveActions':_0x202316,'alignment':_0x115026[_0xd81b('0x121')],'verticalAlignment':_0x115026[_0xd81b('0x122')],'div_color':_0x115026[_0xd81b('0x10f')],'labelText':_0x115026[_0xd81b('0x123')],'text_color':_0x115026[_0xd81b('0x124')],'text_button_color':_0x115026['textButtonColor'],'button_color':_0x115026[_0xd81b('0x125')],'background_color':_0x115026[_0xd81b('0x126')],'hideWhenOffline':_0x115026[_0xd81b('0x127')],'intervalId':_0x115026[_0xd81b('0x128')],'isDevelopment':_0x53d707,'chatVersion':_0x4cb573}));})[_0xd81b('0x27')](handleError(_0x2ff8f6,null));};exports[_0xd81b('0x129')]=function(_0x2eefbd,_0x2883fe){var _0x34cf85=_0x2eefbd[_0xd81b('0x64')]['id'];var _0x4eae4a=_0x2eefbd[_0xd81b('0x69')];var _0x388752=0xc8;var _0x580b1f=null;return db[_0xd81b('0xf1')][_0xd81b('0xf2')]({'isolationLevel':db[_0xd81b('0xf1')][_0xd81b('0x12a')]['ISOLATION_LEVELS'][_0xd81b('0x12b')]},function(_0x33d580){return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0x34cf85},'transaction':_0x33d580})[_0xd81b('0x1c')](function(_0x386b39){if(_0x386b39){return db[_0xd81b('0xb2')][_0xd81b('0x31')]({'where':{'ChatWebsiteId':_0x34cf85},'transaction':_0x33d580})[_0xd81b('0x1c')](function(){var _0x3c839c=_[_0xd81b('0x4d')](_0x4eae4a,function(_0x9bbfea){_0x9bbfea[_0xd81b('0x80')]=_0x34cf85;return _0x9bbfea;});return db[_0xd81b('0xb2')][_0xd81b('0xf4')](_0x3c839c,{'transaction':_0x33d580});});}else{_0x388752=0x194;_0x580b1f=[];}});})['then'](function(){if(_0x388752!==0x194){return db[_0xd81b('0xb2')][_0xd81b('0x12c')]({'where':{'ChatWebsiteId':_0x34cf85},'order':_0xd81b('0xb9')})['then'](function(_0x5ae954){_0x580b1f=_0x5ae954;});}})[_0xd81b('0x27')](function(_0x5ab098){_0x388752=0x1f4;logger[_0xd81b('0x23')](_0x5ab098['stack']);if(_0x5ab098[_0xd81b('0x33')]){delete _0x5ab098[_0xd81b('0x33')];}_0x580b1f=_0x5ab098;})[_0xd81b('0x12d')](function(){if(_0x580b1f===null){_0x2883fe[_0xd81b('0x28')](_0x388752);}else{if(_0x388752===0x1f4){_0x2883fe['status'](_0x388752)['send'](_0x580b1f);}else{_0x2883fe[_0xd81b('0x29')](_0x388752)[_0xd81b('0x2b')](_0x580b1f);}}});};exports[_0xd81b('0x12e')]=function(_0x1e841d,_0x6121cf){var _0x15ce6c={};var _0x29e6d9={};var _0x57ef3b;var _0xf7cefc;return db['ChatWebsite']['findOne']({'where':{'id':_0x1e841d[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x6121cf,null))['then'](function(_0x28e08c){if(_0x28e08c){_0x57ef3b=_0x28e08c;_0x29e6d9[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0xb2')][_0xd81b('0x4f')]);_0x29e6d9[_0xd81b('0x52')]=_['keys'](_0x1e841d['query']);_0x29e6d9[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x29e6d9['model'],_0x29e6d9['query']);_0x15ce6c[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x29e6d9['model'],qs[_0xd81b('0x57')](_0x1e841d[_0xd81b('0x52')]['fields']));_0x15ce6c[_0xd81b('0x56')]=_0x15ce6c[_0xd81b('0x56')][_0xd81b('0x58')]?_0x15ce6c['attributes']:_0x29e6d9[_0xd81b('0x46')];_0x15ce6c[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x15ce6c['where']=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x1e841d[_0xd81b('0x52')],_0x29e6d9[_0xd81b('0x54')]));if(_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x15ce6c[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x15ce6c[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x15ce6c['attributes'],function(_0x407136){var _0x3b5455={};_0x3b5455[_0x407136]={'$like':'%'+_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x3b5455;})});}_0x15ce6c=_[_0xd81b('0x60')]({},_0x15ce6c,_0x1e841d[_0xd81b('0x66')]);return _0x57ef3b[_0xd81b('0x12e')](_0x15ce6c);}})['then'](function(_0x5b1898){if(_0x5b1898){_0xf7cefc=_0x5b1898[_0xd81b('0x58')];if(!_0x1e841d[_0xd81b('0x52')][_0xd81b('0x59')]('nolimit')){_0x15ce6c[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x15ce6c[_0xd81b('0x2c')]=qs['offset'](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x57ef3b[_0xd81b('0x12e')](_0x15ce6c);}})[_0xd81b('0x1c')](function(_0x89764a){if(_0x89764a){return _0x89764a?{'count':_0xf7cefc,'rows':_0x89764a}:null;}})[_0xd81b('0x1c')](respondWithResult(_0x6121cf,null))[_0xd81b('0x27')](handleError(_0x6121cf,null));};exports['addProactiveActions']=function(_0x5a8445,_0x47a903){return db['chatProactiveAction']['find']({'where':{'id':_0x5a8445[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x47a903,null))[_0xd81b('0x1c')](function(_0x4d4feb){if(_0x4d4feb){return _0x4d4feb[_0xd81b('0x12f')](_0x5a8445['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x5a8445[_0xd81b('0x69')],['ids','id'])||{});}})[_0xd81b('0x1c')](respondWithResult(_0x47a903,null))[_0xd81b('0x27')](handleError(_0x47a903,null));};exports[_0xd81b('0x130')]=function(_0xd09d12,_0x251bf4){var _0x3682e4={};var _0x49f9d1={};var _0x5c97b9;var _0x1e4634;return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0xd09d12[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x251bf4,null))[_0xd81b('0x1c')](function(_0x4e3323){if(_0x4e3323){_0x5c97b9=_0x4e3323;_0x49f9d1[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0x131')][_0xd81b('0x4f')]);_0x49f9d1['query']=_['keys'](_0xd09d12[_0xd81b('0x52')]);_0x49f9d1[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x49f9d1[_0xd81b('0x46')],_0x49f9d1[_0xd81b('0x52')]);_0x3682e4[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x49f9d1['model'],qs[_0xd81b('0x57')](_0xd09d12['query']['fields']));_0x3682e4['attributes']=_0x3682e4[_0xd81b('0x56')][_0xd81b('0x58')]?_0x3682e4[_0xd81b('0x56')]:_0x49f9d1[_0xd81b('0x46')];_0x3682e4[_0xd81b('0x5b')]=qs['sort'](_0xd09d12[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x3682e4[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_['pick'](_0xd09d12['query'],_0x49f9d1[_0xd81b('0x54')]));if(_0xd09d12[_0xd81b('0x52')]['filter']){_0x3682e4[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x3682e4[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x3682e4[_0xd81b('0x56')],function(_0x111dd0){var _0x37301b={};_0x37301b[_0x111dd0]={'$like':'%'+_0xd09d12['query']['filter']+'%'};return _0x37301b;})});}_0x3682e4=_[_0xd81b('0x60')]({},_0x3682e4,_0xd09d12['options']);return _0x5c97b9[_0xd81b('0x130')](_0x3682e4);}})['then'](function(_0x222acd){if(_0x222acd){_0x1e4634=_0x222acd[_0xd81b('0x58')];if(!_0xd09d12[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x3682e4[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0xd09d12[_0xd81b('0x52')]['limit']);_0x3682e4[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0xd09d12[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x5c97b9[_0xd81b('0x130')](_0x3682e4);}})['then'](function(_0x3c96d4){if(_0x3c96d4){return _0x3c96d4?{'count':_0x1e4634,'rows':_0x3c96d4}:null;}})['then'](respondWithResult(_0x251bf4,null))[_0xd81b('0x27')](handleError(_0x251bf4,null));};exports[_0xd81b('0x132')]=function(_0x4387a7,_0x24fc43){var _0x498cc0=_0x4387a7[_0xd81b('0x52')][_0xd81b('0x133')]===_0xd81b('0x134')?_0xd81b('0x135'):_0xd81b('0x136');return db[_0xd81b('0x4e')]['find']({'attributes':['id',_0x498cc0],'where':{'id':_0x4387a7[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x24fc43,null))[_0xd81b('0x1c')](function(_0x597c54){if(_0x597c54){var _0x4e792e=_0x597c54[_0x498cc0];var _0x58e782=_0x4e792e&&_0x4e792e[_0xd81b('0x137')]?_0x4e792e['items']:[];_0x24fc43[_0xd81b('0x34')]({'fromKey':_[_0xd81b('0x93')](_0x4e792e['fromKey'])?undefined:_0x4e792e[_0xd81b('0x138')],'count':_0x58e782[_0xd81b('0x58')],'rows':_0x58e782});}})[_0xd81b('0x27')](handleError(_0x24fc43,null));};exports['getOfflineMessages']=function(_0x5f10b0,_0x19ff30){var _0x398e61={'raw':![],'where':{}};var _0xcb2433={};var _0x32573b={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')]['findOne']({'where':{'id':_0x5f10b0['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x19ff30,null))[_0xd81b('0x1c')](function(_0x1eea94){if(_0x1eea94){_0xcb2433[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0xe9')]['rawAttributes']);_0xcb2433['query']=_[_0xd81b('0x53')](_0x5f10b0[_0xd81b('0x52')]);_0xcb2433[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0xcb2433['model'],_0xcb2433[_0xd81b('0x52')]);_0x398e61['attributes']=_[_0xd81b('0x55')](_0xcb2433['model'],qs[_0xd81b('0x57')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x57')]));_0x398e61['attributes']=_0x398e61[_0xd81b('0x56')][_0xd81b('0x58')]?_0x398e61[_0xd81b('0x56')]:_0xcb2433[_0xd81b('0x46')];if(!_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x398e61[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x5f10b0['query'][_0xd81b('0x2f')]);_0x398e61[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x2c')]);}_0x398e61[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x398e61[_0xd81b('0x5d')]=qs['filters'](_[_0xd81b('0x5e')](_0x5f10b0[_0xd81b('0x52')],_0xcb2433[_0xd81b('0x54')]));_0x398e61[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x1eea94['id'];if(_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x398e61[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x398e61['where'],{'$or':_['map'](_0x398e61[_0xd81b('0x56')],function(_0x56f4c8){var _0xa5dd60={};_0xa5dd60[_0x56f4c8]={'$like':'%'+_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0xa5dd60;})});}_0x398e61=_[_0xd81b('0x60')]({},_0x398e61,_0x5f10b0[_0xd81b('0x66')]);return db[_0xd81b('0xe9')][_0xd81b('0x2e')]({'where':_0x398e61[_0xd81b('0x5d')]})['then'](function(_0x443a17){_0x32573b[_0xd81b('0x2e')]=_0x443a17;if(_0x5f10b0['query'][_0xd81b('0x62')]){_0x398e61[_0xd81b('0x63')]=[{'all':!![]}];}else{_0x398e61['include']=[{'model':db['CmContact'],'as':_0xd81b('0x109'),'required':![]},{'model':db[_0xd81b('0xf3')],'as':_0xd81b('0x139'),'required':![]}];}return db[_0xd81b('0xe9')][_0xd81b('0x7c')](_0x398e61);})[_0xd81b('0x1c')](function(_0x57da47){_0x32573b[_0xd81b('0x7d')]=_0x57da47;return _0x32573b;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x19ff30,_0x398e61))['catch'](handleError(_0x19ff30,null));};exports[_0xd81b('0x13a')]=function(_0x207681,_0x212f03){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x207681[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x212f03,null))[_0xd81b('0x1c')](function(_0x3ea155){if(_0x3ea155){return _0x3ea155[_0xd81b('0x13a')](_0x207681['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x207681[_0xd81b('0x69')],[_0xd81b('0x7f'),'id'])||{})[_0xd81b('0x13b')](function(_0x3b393b){for(var _0xd6d130=0x0;_0xd6d130<_0x207681['body'][_0xd81b('0x7f')][_0xd81b('0x58')];_0xd6d130+=0x1){socket[_0xd81b('0x13c')](_0xd81b('0x13d'),{'UserId':Number(_0x207681['body'][_0xd81b('0x7f')][_0xd6d130]),'ChatWebsiteId':Number(_0x207681[_0xd81b('0x64')]['id'])});}return _0x3b393b;});}})['then'](respondWithResult(_0x212f03,null))['catch'](handleError(_0x212f03,null));};exports[_0xd81b('0x13e')]=function(_0x44a9e1,_0x26d2c2){return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x44a9e1['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x26d2c2,null))[_0xd81b('0x1c')](function(_0x4c684a){if(_0x4c684a){return _0x4c684a[_0xd81b('0x13e')](_0x44a9e1['query'][_0xd81b('0x7f')])['then'](function(){if(_[_0xd81b('0x13f')](_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')])){for(var _0x56d986=0x0;_0x56d986<_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')][_0xd81b('0x58')];_0x56d986+=0x1){socket[_0xd81b('0x13c')](_0xd81b('0x140'),{'UserId':Number(_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')][_0x56d986]),'ChatWebsiteId':Number(_0x44a9e1['params']['id'])});}}else{socket[_0xd81b('0x13c')](_0xd81b('0x140'),{'UserId':Number(_0x44a9e1['query']['ids']),'ChatWebsiteId':Number(_0x44a9e1['params']['id'])});}});}})[_0xd81b('0x1c')](respondWithStatusCode(_0x26d2c2,null))[_0xd81b('0x27')](handleError(_0x26d2c2,null));};exports[_0xd81b('0x141')]=function(_0xb7102c,_0x2b1519){var _0x1c5a61={};var _0x4c1201={};var _0x1f76aa;var _0x36fa37;return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0xb7102c[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x2b1519,null))[_0xd81b('0x1c')](function(_0x4fc360){if(_0x4fc360){_0x1f76aa=_0x4fc360;_0x4c1201[_0xd81b('0x46')]=_['keys'](db[_0xd81b('0xca')]['rawAttributes']);_0x4c1201[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0xb7102c[_0xd81b('0x52')]);_0x4c1201['filters']=_[_0xd81b('0x55')](_0x4c1201[_0xd81b('0x46')],_0x4c1201[_0xd81b('0x52')]);_0x1c5a61['attributes']=_[_0xd81b('0x55')](_0x4c1201['model'],qs[_0xd81b('0x57')](_0xb7102c['query'][_0xd81b('0x57')]));_0x1c5a61[_0xd81b('0x56')]=_0x1c5a61[_0xd81b('0x56')][_0xd81b('0x58')]?_0x1c5a61[_0xd81b('0x56')]:_0x4c1201[_0xd81b('0x46')];_0x1c5a61['order']=qs[_0xd81b('0x5c')](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x1c5a61[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0xb7102c[_0xd81b('0x52')],_0x4c1201[_0xd81b('0x54')]));if(_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x1c5a61['where']=_[_0xd81b('0x60')](_0x1c5a61['where'],{'$or':_[_0xd81b('0x4d')](_0x1c5a61['attributes'],function(_0x45bf7e){var _0x29464b={};_0x29464b[_0x45bf7e]={'$like':'%'+_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x29464b;})});}_0x1c5a61=_[_0xd81b('0x60')]({},_0x1c5a61,_0xb7102c[_0xd81b('0x66')]);return _0x1f76aa[_0xd81b('0x141')](_0x1c5a61);}})['then'](function(_0xec700e){if(_0xec700e){_0x36fa37=_0xec700e[_0xd81b('0x58')];if(!_0xb7102c[_0xd81b('0x52')][_0xd81b('0x59')]('nolimit')){_0x1c5a61[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x1c5a61['offset']=qs['offset'](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x1f76aa[_0xd81b('0x141')](_0x1c5a61);}})[_0xd81b('0x1c')](function(_0x450634){if(_0x450634){return _0x450634?{'count':_0x36fa37,'rows':_0x450634}:null;}})[_0xd81b('0x1c')](respondWithResult(_0x2b1519,null))[_0xd81b('0x27')](handleError(_0x2b1519,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b3305c7..002e184 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 _0xc43c=['ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3b545c,_0x491912){var _0xc9eb90=function(_0x35aeec){while(--_0x35aeec){_0x3b545c['push'](_0x3b545c['shift']());}};_0xc9eb90(++_0x491912);}(_0xc43c,0x152));var _0xcc43=function(_0x44d357,_0x5d25fa){_0x44d357=_0x44d357-0x0;var _0x564514=_0xc43c[_0x44d357];return _0x564514;};'use strict';var EventEmitter=require(_0xcc43('0x0'));var ChatWebsite=require(_0xcc43('0x1'))['db'][_0xcc43('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcc43('0x3')](0x0);var events={'afterCreate':_0xcc43('0x4'),'afterUpdate':_0xcc43('0x5'),'afterDestroy':'remove'};function emitEvent(_0x162a11){return function(_0x258c7e,_0x5c21a3,_0x1b589f){ChatWebsiteEvents[_0xcc43('0x6')](_0x162a11+':'+_0x258c7e['id'],_0x258c7e);ChatWebsiteEvents[_0xcc43('0x6')](_0x162a11,_0x258c7e);_0x1b589f(null);};}for(var e in events){if(events[_0xcc43('0x7')](e)){var event=events[e];ChatWebsite[_0xcc43('0x8')](e,emitEvent(event));}}module[_0xcc43('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xd846=['../../mysqldb','ChatWebsite','update','emit','hook','exports','events'];(function(_0x5e58b2,_0x52b950){var _0x2e7bd3=function(_0x38d8cf){while(--_0x38d8cf){_0x5e58b2['push'](_0x5e58b2['shift']());}};_0x2e7bd3(++_0x52b950);}(_0xd846,0x195));var _0x6d84=function(_0x548d50,_0xec2bcd){_0x548d50=_0x548d50-0x0;var _0x2c3049=_0xd846[_0x548d50];return _0x2c3049;};'use strict';var EventEmitter=require(_0x6d84('0x0'));var ChatWebsite=require(_0x6d84('0x1'))['db'][_0x6d84('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d84('0x3'),'afterDestroy':'remove'};function emitEvent(_0x47e90f){return function(_0x15fb0c,_0xa19796,_0x5c2176){ChatWebsiteEvents[_0x6d84('0x4')](_0x47e90f+':'+_0x15fb0c['id'],_0x15fb0c);ChatWebsiteEvents['emit'](_0x47e90f,_0x15fb0c);_0x5c2176(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x6d84('0x5')](e,emitEvent(event));}}module[_0x6d84('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 3961379..2ec2b6e 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 _0x85fb=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x112db5,_0x38a06d){var _0x1d7d06=function(_0x44571e){while(--_0x44571e){_0x112db5['push'](_0x112db5['shift']());}};_0x1d7d06(++_0x38a06d);}(_0x85fb,0x6a));var _0xb85f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x85fb[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xb85f('0x0'));var util=require(_0xb85f('0x1'));var logger=require(_0xb85f('0x2'))(_0xb85f('0x3'));var moment=require(_0xb85f('0x4'));var BPromise=require('bluebird');var rp=require(_0xb85f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb85f('0x6'));var config=require(_0xb85f('0x7'));var attributes=require(_0xb85f('0x8'));module['exports']=function(_0x447109,_0x2f2e6f){return _0x447109[_0xb85f('0x9')](_0xb85f('0xa'),attributes,{'tableName':_0xb85f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ada=['moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x0ada,0x176));var _0xa0ad=function(_0x2741c2,_0x4a688f){_0x2741c2=_0x2741c2-0x0;var _0x162ace=_0x0ada[_0x2741c2];return _0x162ace;};'use strict';var _=require(_0xa0ad('0x0'));var util=require(_0xa0ad('0x1'));var logger=require(_0xa0ad('0x2'))(_0xa0ad('0x3'));var moment=require(_0xa0ad('0x4'));var BPromise=require('bluebird');var rp=require(_0xa0ad('0x5'));var fs=require('fs');var path=require(_0xa0ad('0x6'));var rimraf=require(_0xa0ad('0x7'));var config=require(_0xa0ad('0x8'));var attributes=require(_0xa0ad('0x9'));module[_0xa0ad('0xa')]=function(_0x37717b,_0x3b5653){return _0x37717b[_0xa0ad('0xb')](_0xa0ad('0xc'),attributes,{'tableName':_0xa0ad('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index c40f1d1..2bf840f 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 _0x9791=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','localhost','redis','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9791,0x1ac));var _0x1979=function(_0x3c687b,_0x83ea4){_0x3c687b=_0x3c687b-0x0;var _0x20dfa5=_0x9791[_0x3c687b];return _0x20dfa5;};'use strict';var _=require(_0x1979('0x0'));var util=require(_0x1979('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1979('0x2'));var fs=require('fs');var Redis=require(_0x1979('0x3'));var db=require(_0x1979('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1979('0x5'))(_0x1979('0x6'));var config=require('../../config/environment');var jayson=require(_0x1979('0x7'));var client=jayson[_0x1979('0x8')]['http']({'port':0x232a});config['redis']=_[_0x1979('0x9')](config['redis'],{'host':_0x1979('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1979('0xb')]));require(_0x1979('0xc'))[_0x1979('0xd')](socket);function respondWithRpcPromise(_0x5885f8,_0x37d8c9,_0x16789d){return new BPromise(function(_0xc944c2,_0x495a39){return client[_0x1979('0xe')](_0x5885f8,_0x16789d)[_0x1979('0xf')](function(_0x4af758){logger[_0x1979('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x37d8c9,_0x1979('0x11'));logger[_0x1979('0x12')](_0x1979('0x13'),_0x37d8c9,_0x1979('0x11'),JSON[_0x1979('0x14')](_0x4af758));if(_0x4af758[_0x1979('0x15')]){if(_0x4af758[_0x1979('0x15')][_0x1979('0x16')]===0x1f4){logger['error'](_0x1979('0x17'),_0x37d8c9,_0x4af758[_0x1979('0x15')][_0x1979('0x18')]);return _0x495a39(_0x4af758[_0x1979('0x15')][_0x1979('0x18')]);}logger[_0x1979('0x15')](_0x1979('0x17'),_0x37d8c9,_0x4af758[_0x1979('0x15')][_0x1979('0x18')]);return _0xc944c2(_0x4af758[_0x1979('0x15')][_0x1979('0x18')]);}else{logger[_0x1979('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x37d8c9,'request\x20sent');_0xc944c2(_0x4af758[_0x1979('0x19')]['message']);}})[_0x1979('0x1a')](function(_0x20eac8){logger[_0x1979('0x15')](_0x1979('0x17'),_0x37d8c9,_0x20eac8);_0x495a39(_0x20eac8);});});} \ No newline at end of file +var _0xc211=['catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','request\x20sent','debug','error','ChatWebsite,\x20%s,\x20%s','message','info','result'];(function(_0x319ed9,_0x255199){var _0x19b360=function(_0x105317){while(--_0x105317){_0x319ed9['push'](_0x319ed9['shift']());}};_0x19b360(++_0x255199);}(_0xc211,0x16d));var _0x1c21=function(_0x189564,_0x419229){_0x189564=_0x189564-0x0;var _0x531d23=_0xc211[_0x189564];return _0x531d23;};'use strict';var _=require(_0x1c21('0x0'));var util=require('util');var moment=require(_0x1c21('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c21('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c21('0x3'))['db'];var utils=require(_0x1c21('0x4'));var logger=require('../../config/logger')(_0x1c21('0x5'));var config=require(_0x1c21('0x6'));var jayson=require(_0x1c21('0x7'));var client=jayson[_0x1c21('0x8')][_0x1c21('0x9')]({'port':0x232a});config['redis']=_[_0x1c21('0xa')](config[_0x1c21('0xb')],{'host':_0x1c21('0xc'),'port':0x18eb});var socket=require(_0x1c21('0xd'))(new Redis(config['redis']));require(_0x1c21('0xe'))[_0x1c21('0xf')](socket);function respondWithRpcPromise(_0x801aec,_0x198113,_0x1544f2){return new BPromise(function(_0x453f76,_0x3624ad){return client[_0x1c21('0x10')](_0x801aec,_0x1544f2)[_0x1c21('0x11')](function(_0x5a7b6a){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x198113,_0x1c21('0x12'));logger[_0x1c21('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x198113,'request\x20sent',JSON['stringify'](_0x5a7b6a));if(_0x5a7b6a['error']){if(_0x5a7b6a[_0x1c21('0x14')]['code']===0x1f4){logger[_0x1c21('0x14')](_0x1c21('0x15'),_0x198113,_0x5a7b6a[_0x1c21('0x14')][_0x1c21('0x16')]);return _0x3624ad(_0x5a7b6a[_0x1c21('0x14')][_0x1c21('0x16')]);}logger[_0x1c21('0x14')](_0x1c21('0x15'),_0x198113,_0x5a7b6a[_0x1c21('0x14')][_0x1c21('0x16')]);return _0x453f76(_0x5a7b6a[_0x1c21('0x14')][_0x1c21('0x16')]);}else{logger[_0x1c21('0x17')](_0x1c21('0x15'),_0x198113,'request\x20sent');_0x453f76(_0x5a7b6a[_0x1c21('0x18')]['message']);}})[_0x1c21('0x19')](function(_0x467e82){logger[_0x1c21('0x14')](_0x1c21('0x15'),_0x198113,_0x467e82);_0x3624ad(_0x467e82);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 5021535..444033c 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 _0x3ea2=['length','./chatWebsite.events','update','emit','removeListener','register'];(function(_0x5c5953,_0x44bf4a){var _0x13a1a4=function(_0x593948){while(--_0x593948){_0x5c5953['push'](_0x5c5953['shift']());}};_0x13a1a4(++_0x44bf4a);}(_0x3ea2,0x121));var _0x23ea=function(_0x2035ef,_0x3f7d39){_0x2035ef=_0x2035ef-0x0;var _0x86c909=_0x3ea2[_0x2035ef];return _0x86c909;};'use strict';var ChatWebsiteEvents=require(_0x23ea('0x0'));var events=['save','remove',_0x23ea('0x1')];function createListener(_0x4f5c40,_0x4a7a67){return function(_0x53082c){_0x4a7a67[_0x23ea('0x2')](_0x4f5c40,_0x53082c);};}function removeListener(_0x2dee7d,_0x378570){return function(){ChatWebsiteEvents[_0x23ea('0x3')](_0x2dee7d,_0x378570);};}exports[_0x23ea('0x4')]=function(_0x24d6f4){for(var _0x298590=0x0,_0xab2159=events[_0x23ea('0x5')];_0x298590<_0xab2159;_0x298590++){var _0x5babfb=events[_0x298590];var _0x4a2a80=createListener('chatWebsite:'+_0x5babfb,_0x24d6f4);ChatWebsiteEvents['on'](_0x5babfb,_0x4a2a80);}}; \ No newline at end of file +var _0xd585=['remove','update','emit','removeListener','register','chatWebsite:','./chatWebsite.events','save'];(function(_0x2661a4,_0x4b56f1){var _0x176b8e=function(_0x55e3c5){while(--_0x55e3c5){_0x2661a4['push'](_0x2661a4['shift']());}};_0x176b8e(++_0x4b56f1);}(_0xd585,0x13e));var _0x5d58=function(_0x4d5330,_0x48e3ef){_0x4d5330=_0x4d5330-0x0;var _0x121916=_0xd585[_0x4d5330];return _0x121916;};'use strict';var ChatWebsiteEvents=require(_0x5d58('0x0'));var events=[_0x5d58('0x1'),_0x5d58('0x2'),_0x5d58('0x3')];function createListener(_0x5b0737,_0x172236){return function(_0x37e370){_0x172236[_0x5d58('0x4')](_0x5b0737,_0x37e370);};}function removeListener(_0x15a661,_0x54b5bc){return function(){ChatWebsiteEvents[_0x5d58('0x5')](_0x15a661,_0x54b5bc);};}exports[_0x5d58('0x6')]=function(_0x56f80d){for(var _0x14ad78=0x0,_0x23a3a3=events['length'];_0x14ad78<_0x23a3a3;_0x14ad78++){var _0x1c1d49=events[_0x14ad78];var _0x4b30d9=createListener(_0x5d58('0x7')+_0x1c1d49,_0x56f80d);ChatWebsiteEvents['on'](_0x1c1d49,_0x4b30d9);}}; \ 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 51b6742..2f2f7cf 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 _0x0650=['localhost','test','replace','([\x5cw]+)','exports','../../../utils/misc','url','URL'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0x0650,0xed));var _0x0065=function(_0x4f3e5a,_0x1ee150){_0x4f3e5a=_0x4f3e5a-0x0;var _0x452880=_0x0650[_0x4f3e5a];return _0x452880;};var escapeRegExp=require(_0x0065('0x0'))['escapeRegExp'];var URL=require(_0x0065('0x1'))[_0x0065('0x2')];function testWildcardValidity(_0x5e6e6c){var _0x16f9eb=!![];try{new URL(_0x5e6e6c['replace']('*',_0x0065('0x3')));}catch(_0x8260ba){_0x16f9eb=![];}return _0x16f9eb&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x0065('0x4')](_0x5e6e6c);}function testWebsiteWithWildcard(_0x4b15b1,_0xdf9084){var _0x507ed3;var _0x5cf16e=escapeRegExp(_0x4b15b1['trim']()[_0x0065('0x5')](/\/$/,''))[_0x0065('0x5')]('\x5c*',_0x0065('0x6'));try{new URL(_0x4b15b1[_0x0065('0x5')]('\x5c*',_0x0065('0x3')));_0x507ed3=new RegExp(_0x5cf16e)[_0x0065('0x4')](_0xdf9084);}catch(_0x8974f){_0x507ed3=![];}return _0x507ed3;}module[_0x0065('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x57b7=['localhost','exports','../../../utils/misc','escapeRegExp','url','URL','replace','test','trim','([\x5cw]+)'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x57b7,0x160));var _0x757b=function(_0x2d223a,_0x3c63cb){_0x2d223a=_0x2d223a-0x0;var _0x28c01a=_0x57b7[_0x2d223a];return _0x28c01a;};var escapeRegExp=require(_0x757b('0x0'))[_0x757b('0x1')];var URL=require(_0x757b('0x2'))[_0x757b('0x3')];function testWildcardValidity(_0x30c202){var _0x451dc6=!![];try{new URL(_0x30c202[_0x757b('0x4')]('*','localhost'));}catch(_0x22daa8){_0x451dc6=![];}return _0x451dc6&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x757b('0x5')](_0x30c202);}function testWebsiteWithWildcard(_0x25fe8a,_0x29dab0){var _0x5a1447;var _0x1b4949=escapeRegExp(_0x25fe8a[_0x757b('0x6')]()[_0x757b('0x4')](/\/$/,''))[_0x757b('0x4')]('\x5c*',_0x757b('0x7'));try{new URL(_0x25fe8a[_0x757b('0x4')]('\x5c*',_0x757b('0x8')));_0x5a1447=new RegExp(_0x1b4949)[_0x757b('0x5')](_0x29dab0);}catch(_0x53a1ce){_0x5a1447=![];}return _0x5a1447;}module[_0x757b('0x9')]={'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 690c999..7540f27 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 _0x19db=['/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','create','post','addDisposition','addAnswer','root','server/files/images/logos/','format','%s-%s','now','originalname','file','diskStorage','join','server/files/images/avatars/','single','/:id/customer_avatar','/:id/notify','attachments','ensureDir','extname','replace','/:id/offline','addInteraction','addProactiveActions'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x19db,0x196));var _0xb19d=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x19db[_0x2fb87c];return _0x43038b;};'use strict';var multer=require(_0xb19d('0x0'));var util=require(_0xb19d('0x1'));var path=require(_0xb19d('0x2'));var timeout=require(_0xb19d('0x3'));var express=require(_0xb19d('0x4'));var router=express['Router']();var fs_extra=require(_0xb19d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb19d('0x6'));var controller=require(_0xb19d('0x7'));router[_0xb19d('0x8')]('/',auth[_0xb19d('0x9')](),controller[_0xb19d('0xa')]);router[_0xb19d('0x8')]('/describe',auth[_0xb19d('0x9')](),controller[_0xb19d('0xb')]);router[_0xb19d('0x8')](_0xb19d('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb19d('0xd'),auth[_0xb19d('0x9')](),controller[_0xb19d('0xe')]);router[_0xb19d('0x8')](_0xb19d('0xf'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x10')]);router[_0xb19d('0x8')](_0xb19d('0x11'),controller[_0xb19d('0x12')]);router[_0xb19d('0x8')](_0xb19d('0x13'),controller['getAvatar']);router[_0xb19d('0x8')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0xb19d('0x8')](_0xb19d('0x14'),controller[_0xb19d('0x15')]);router[_0xb19d('0x8')](_0xb19d('0x16'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x17')]);router[_0xb19d('0x8')]('/:id/snippet',controller['getSnippet']);router['get'](_0xb19d('0x18'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x19')]);router[_0xb19d('0x8')](_0xb19d('0x1a'),auth['isAuthenticated'](),controller[_0xb19d('0x1b')]);router[_0xb19d('0x8')]('/:id/fields',controller[_0xb19d('0x1c')]);router[_0xb19d('0x8')](_0xb19d('0x1d'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x1e')]);router[_0xb19d('0x8')]('/:id/users',auth[_0xb19d('0x9')](),controller[_0xb19d('0x1f')]);router['post']('/',auth[_0xb19d('0x9')](),controller[_0xb19d('0x20')]);router[_0xb19d('0x21')]('/:id/dispositions',auth[_0xb19d('0x9')](),controller[_0xb19d('0x22')]);router[_0xb19d('0x21')]('/:id/canned_answers',auth[_0xb19d('0x9')](),controller[_0xb19d('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x37415e,_0x5a7765,_0x3aa77d){_0x3aa77d(null,path['join'](config[_0xb19d('0x24')],_0xb19d('0x25')));},'filename':function(_0x48e33f,_0x254671,_0x4a25e4){_0x4a25e4(null,util[_0xb19d('0x26')](_0xb19d('0x27'),Date[_0xb19d('0x28')](),_0x254671[_0xb19d('0x29')]));}})});router['post'](_0xb19d('0x11'),upload['single'](_0xb19d('0x2a')),controller['addLogo']);var upload=multer({'storage':multer[_0xb19d('0x2b')]({'destination':function(_0x39b118,_0x2a79f6,_0x59010a){_0x59010a(null,path[_0xb19d('0x2c')](config['root'],_0xb19d('0x2d')));},'filename':function(_0x312e9a,_0x4a1ad4,_0x82bfa7){_0x82bfa7(null,util[_0xb19d('0x26')]('%s-%s',Date[_0xb19d('0x28')](),_0x4a1ad4[_0xb19d('0x29')]));}})});router[_0xb19d('0x21')]('/:id/avatar',upload[_0xb19d('0x2e')](_0xb19d('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28d32a,_0x298238,_0x21fe16){_0x21fe16(null,path[_0xb19d('0x2c')](config[_0xb19d('0x24')],_0xb19d('0x2d')));},'filename':function(_0x51c400,_0x4b3ee6,_0x204ba9){_0x204ba9(null,util[_0xb19d('0x26')](_0xb19d('0x27'),Date['now'](),_0x4b3ee6[_0xb19d('0x29')]));}})});router[_0xb19d('0x21')](_0xb19d('0x2f'),upload[_0xb19d('0x2e')](_0xb19d('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xb19d('0x2b')]({'destination':function(_0x458279,_0xb611b7,_0x357c5c){_0x357c5c(null,path['join'](config[_0xb19d('0x24')],_0xb19d('0x2d')));},'filename':function(_0x1eb73e,_0x36e221,_0x4dbbde){_0x4dbbde(null,util[_0xb19d('0x26')](_0xb19d('0x27'),Date[_0xb19d('0x28')](),_0x36e221[_0xb19d('0x29')]));}})});router[_0xb19d('0x21')](_0xb19d('0x14'),upload[_0xb19d('0x2e')]('file'),controller['addSystemAvatar']);router['post'](_0xb19d('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x13f727,_0x38eb02,_0xb95950){const _0x1fe7c2=path[_0xb19d('0x2c')](config[_0xb19d('0x24')],'server/files',_0xb19d('0x31'),'offline-chat');fs_extra[_0xb19d('0x32')](_0x1fe7c2,function(){_0xb95950(null,_0x1fe7c2);});},'filename':function(_0x3b26ba,_0x25d374,_0x54de63){const _0xb647e1=_0x25d374['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x15ca2c=path[_0xb19d('0x33')](_0xb647e1);const _0x153bc4=Date['now']()+'-'+_0xb647e1[_0xb19d('0x34')](_0x15ca2c,'')+_0x15ca2c;_0x54de63(null,_0x153bc4);}})});router['post'](_0xb19d('0x35'),offlineUploadMulter['any'](),controller['offline']);router[_0xb19d('0x21')](_0xb19d('0x16'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x36')]);router['post']('/:id/applications',auth[_0xb19d('0x9')](),controller['addApplications']);router[_0xb19d('0x21')](_0xb19d('0x1a'),auth['isAuthenticated'](),controller[_0xb19d('0x37')]);router[_0xb19d('0x21')](_0xb19d('0x38'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x39')]);router[_0xb19d('0x3a')]('/:id',auth[_0xb19d('0x9')](),controller[_0xb19d('0x3b')]);router[_0xb19d('0x3c')](_0xb19d('0xc'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x3d')]);router['delete'](_0xb19d('0xd'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x3e')]);router[_0xb19d('0x3c')](_0xb19d('0xf'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x3f')]);router[_0xb19d('0x3c')](_0xb19d('0x38'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x40')]);module[_0xb19d('0x41')]=router; \ No newline at end of file +var _0xbff3=['getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','/:id/users','post','/:id/dispositions','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','single','file','addLogo','diskStorage','now','originalname','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet'];(function(_0x5dcc7c,_0x5e3b9d){var _0x4dfa73=function(_0x17ebfb){while(--_0x17ebfb){_0x5dcc7c['push'](_0x5dcc7c['shift']());}};_0x4dfa73(++_0x5e3b9d);}(_0xbff3,0x194));var _0x3bff=function(_0x43fbc9,_0x59e518){_0x43fbc9=_0x43fbc9-0x0;var _0x3ae36b=_0xbff3[_0x43fbc9];return _0x3ae36b;};'use strict';var multer=require('multer');var util=require(_0x3bff('0x0'));var path=require(_0x3bff('0x1'));var timeout=require(_0x3bff('0x2'));var express=require('express');var router=express[_0x3bff('0x3')]();var fs_extra=require(_0x3bff('0x4'));var auth=require(_0x3bff('0x5'));var interaction=require(_0x3bff('0x6'));var config=require(_0x3bff('0x7'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x3bff('0x8')](),controller[_0x3bff('0x9')]);router[_0x3bff('0xa')](_0x3bff('0xb'),auth[_0x3bff('0x8')](),controller[_0x3bff('0xc')]);router[_0x3bff('0xa')](_0x3bff('0xd'),auth[_0x3bff('0x8')](),controller[_0x3bff('0xe')]);router[_0x3bff('0xa')]('/:id/dispositions',auth[_0x3bff('0x8')](),controller[_0x3bff('0xf')]);router[_0x3bff('0xa')](_0x3bff('0x10'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x11')]);router['get'](_0x3bff('0x12'),controller[_0x3bff('0x13')]);router[_0x3bff('0xa')](_0x3bff('0x14'),controller[_0x3bff('0x15')]);router[_0x3bff('0xa')](_0x3bff('0x16'),controller[_0x3bff('0x17')]);router[_0x3bff('0xa')](_0x3bff('0x18'),controller[_0x3bff('0x19')]);router['get'](_0x3bff('0x1a'),auth[_0x3bff('0x8')](),controller['getInteractions']);router['get'](_0x3bff('0x1b'),controller[_0x3bff('0x1c')]);router[_0x3bff('0xa')](_0x3bff('0x1d'),auth['isAuthenticated'](),controller[_0x3bff('0x1e')]);router['get'](_0x3bff('0x1f'),auth[_0x3bff('0x8')](),controller['getProactiveActions']);router[_0x3bff('0xa')]('/:id/fields',controller[_0x3bff('0x20')]);router[_0x3bff('0xa')](_0x3bff('0x21'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x3bff('0xa')](_0x3bff('0x22'),auth[_0x3bff('0x8')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3bff('0x23')](_0x3bff('0x24'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x25')]);router[_0x3bff('0x23')](_0x3bff('0x10'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3e6f6e,_0xa097ba,_0x3035c6){_0x3035c6(null,path[_0x3bff('0x27')](config[_0x3bff('0x28')],_0x3bff('0x29')));},'filename':function(_0x4c31e8,_0x4c2a4c,_0x221ad6){_0x221ad6(null,util[_0x3bff('0x2a')](_0x3bff('0x2b'),Date['now'](),_0x4c2a4c['originalname']));}})});router['post']('/:id/logo',upload[_0x3bff('0x2c')](_0x3bff('0x2d')),controller[_0x3bff('0x2e')]);var upload=multer({'storage':multer[_0x3bff('0x2f')]({'destination':function(_0x3d0878,_0x27287a,_0x2bbaa8){_0x2bbaa8(null,path[_0x3bff('0x27')](config[_0x3bff('0x28')],'server/files/images/avatars/'));},'filename':function(_0x5f2dd8,_0x571389,_0x56ddb9){_0x56ddb9(null,util[_0x3bff('0x2a')](_0x3bff('0x2b'),Date[_0x3bff('0x30')](),_0x571389[_0x3bff('0x31')]));}})});router['post'](_0x3bff('0x14'),upload[_0x3bff('0x2c')](_0x3bff('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x3bff('0x2f')]({'destination':function(_0x4f9b4c,_0x2b669c,_0x5b98a2){_0x5b98a2(null,path[_0x3bff('0x27')](config[_0x3bff('0x28')],'server/files/images/avatars/'));},'filename':function(_0x484ba1,_0x36bb5f,_0x9a1b79){_0x9a1b79(null,util['format']('%s-%s',Date['now'](),_0x36bb5f['originalname']));}})});router[_0x3bff('0x23')](_0x3bff('0x16'),upload['single'](_0x3bff('0x2d')),controller[_0x3bff('0x32')]);var upload=multer({'storage':multer[_0x3bff('0x2f')]({'destination':function(_0xa3db26,_0x2edf63,_0x217da1){_0x217da1(null,path[_0x3bff('0x27')](config[_0x3bff('0x28')],_0x3bff('0x33')));},'filename':function(_0x3d6eea,_0xf8d6e,_0x49c459){_0x49c459(null,util[_0x3bff('0x2a')]('%s-%s',Date[_0x3bff('0x30')](),_0xf8d6e[_0x3bff('0x31')]));}})});router[_0x3bff('0x23')](_0x3bff('0x18'),upload[_0x3bff('0x2c')](_0x3bff('0x2d')),controller[_0x3bff('0x34')]);router[_0x3bff('0x23')](_0x3bff('0x35'),controller[_0x3bff('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x3bff('0x2f')]({'destination':function(_0x528474,_0x55cb29,_0x53ae71){const _0xb6a7f4=path[_0x3bff('0x27')](config['root'],'server/files',_0x3bff('0x37'),_0x3bff('0x38'));fs_extra['ensureDir'](_0xb6a7f4,function(){_0x53ae71(null,_0xb6a7f4);});},'filename':function(_0x224904,_0x36a90a,_0x3e928a){const _0x42f28a=_0x36a90a[_0x3bff('0x31')][_0x3bff('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2a7244=path[_0x3bff('0x3a')](_0x42f28a);const _0x3425f2=Date[_0x3bff('0x30')]()+'-'+_0x42f28a[_0x3bff('0x39')](_0x2a7244,'')+_0x2a7244;_0x3e928a(null,_0x3425f2);}})});router['post'](_0x3bff('0x3b'),offlineUploadMulter[_0x3bff('0x3c')](),controller[_0x3bff('0x3d')]);router['post'](_0x3bff('0x1a'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x3e')]);router[_0x3bff('0x23')](_0x3bff('0x1d'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x3f')]);router[_0x3bff('0x23')]('/:id/proactive_actions',auth[_0x3bff('0x8')](),controller[_0x3bff('0x40')]);router[_0x3bff('0x23')]('/:id/users',auth[_0x3bff('0x8')](),controller[_0x3bff('0x41')]);router[_0x3bff('0x42')](_0x3bff('0xd'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x43')]);router[_0x3bff('0x44')](_0x3bff('0xd'),auth[_0x3bff('0x8')](),controller['destroy']);router[_0x3bff('0x44')](_0x3bff('0x24'),auth[_0x3bff('0x8')](),controller['removeDispositions']);router[_0x3bff('0x44')](_0x3bff('0x10'),auth[_0x3bff('0x8')](),controller[_0x3bff('0x45')]);router[_0x3bff('0x44')]('/:id/users',auth[_0x3bff('0x8')](),controller[_0x3bff('0x46')]);module[_0x3bff('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 7429f13..7997faa 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 _0x203d=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','express','../components/auth/service','Router','env','app','get'];(function(_0x23e314,_0x2ba525){var _0x3c1bf4=function(_0x7ec1b4){while(--_0x7ec1b4){_0x23e314['push'](_0x23e314['shift']());}};_0x3c1bf4(++_0x2ba525);}(_0x203d,0x66));var _0xd203=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x203d[_0xdea41a];return _0x15d0d8;};var beaverLogger=require('beaver-logger/server');var express=require(_0xd203('0x0'));var auth=require(_0xd203('0x1'));var config=require('../config/environment');var router=express[_0xd203('0x2')]();var isProduction=config[_0xd203('0x3')]==='production'||![];function clientSideLogs(_0x1b0785,_0x3766ac,_0x264de3){var _0x532383=_0x1b0785[_0xd203('0x4')][_0xd203('0x5')]('client-side-logger');if(!_0x532383){throw new Error(_0xd203('0x6'));}return beaverLogger[_0xd203('0x7')]({'uri':_0xd203('0x8'),'logger':_0x532383,'enableCors':!isProduction})(_0x1b0785,_0x3766ac,_0x264de3);}router[_0xd203('0x9')](auth[_0xd203('0xa')](),clientSideLogs);module[_0xd203('0xb')]=router; \ No newline at end of file +var _0x8b17=['use','exports','../components/auth/service','../config/environment','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x1af84c,_0x4d766e){var _0x3a4351=function(_0x11bd8f){while(--_0x11bd8f){_0x1af84c['push'](_0x1af84c['shift']());}};_0x3a4351(++_0x4d766e);}(_0x8b17,0x9e));var _0x78b1=function(_0x91c9d6,_0x4bfa45){_0x91c9d6=_0x91c9d6-0x0;var _0x13de68=_0x8b17[_0x91c9d6];return _0x13de68;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0x78b1('0x0'));var config=require(_0x78b1('0x1'));var router=express['Router']();var isProduction=config[_0x78b1('0x2')]===_0x78b1('0x3')||![];function clientSideLogs(_0x2c0133,_0x3b1527,_0x3ad0e2){var _0x281373=_0x2c0133[_0x78b1('0x4')][_0x78b1('0x5')](_0x78b1('0x6'));if(!_0x281373){throw new Error(_0x78b1('0x7'));}return beaverLogger[_0x78b1('0x8')]({'uri':_0x78b1('0x9'),'logger':_0x281373,'enableCors':!isProduction})(_0x2c0133,_0x3b1527,_0x3ad0e2);}router[_0x78b1('0xa')](auth['isAuthenticated'](),clientSideLogs);module[_0x78b1('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 1eaf327..9cc0376 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 _0x7554=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x34d8a1,_0x4e9d8f){var _0x11b1ce=function(_0x4ac29e){while(--_0x4ac29e){_0x34d8a1['push'](_0x34d8a1['shift']());}};_0x11b1ce(++_0x4e9d8f);}(_0x7554,0x1a5));var _0x4755=function(_0x1cd762,_0x223478){_0x1cd762=_0x1cd762-0x0;var _0x45128a=_0x7554[_0x1cd762];return _0x45128a;};'use strict';var Sequelize=require(_0x4755('0x0'));module[_0x4755('0x1')]={'name':{'type':Sequelize[_0x4755('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4755('0x3')]('AmazonAWS','Google',_0x4755('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4755('0x3')](_0x4755('0x5'),_0x4755('0x6'))},'data1':{'type':Sequelize[_0x4755('0x2')],'comment':_0x4755('0x7')},'data2':{'type':Sequelize[_0x4755('0x2')],'comment':_0x4755('0x8')},'data3':{'type':Sequelize[_0x4755('0x2')],'comment':_0x4755('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0x4755('0xa')},'data5':{'type':Sequelize[_0x4755('0xb')],'comment':_0x4755('0xc')},'data6':{'type':Sequelize[_0x4755('0xb')],'comment':_0x4755('0xd')},'data7':{'type':Sequelize[_0x4755('0xb')],'comment':_0x4755('0xe')}}; \ No newline at end of file +var _0x4a34=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a34,0x1cd));var _0x44a3=function(_0x4426fe,_0x40d3b7){_0x4426fe=_0x4426fe-0x0;var _0x2f79df=_0x4a34[_0x4426fe];return _0x2f79df;};'use strict';var Sequelize=require('sequelize');module[_0x44a3('0x0')]={'name':{'type':Sequelize[_0x44a3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x44a3('0x2')]('AmazonAWS',_0x44a3('0x3'),_0x44a3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x44a3('0x2')](_0x44a3('0x5'),_0x44a3('0x6'))},'data1':{'type':Sequelize[_0x44a3('0x1')],'comment':_0x44a3('0x7')},'data2':{'type':Sequelize[_0x44a3('0x1')],'comment':_0x44a3('0x8')},'data3':{'type':Sequelize[_0x44a3('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0x44a3('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x44a3('0xa')],'comment':_0x44a3('0xb')},'data7':{'type':Sequelize[_0x44a3('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 660f1c9..5188fff 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 _0x9c59=['../../components/encryptor','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','update','then','end','error','stack','name','send','padEnd','index','CloudProvider','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','service','MicrosoftAzure','data3','catch','show','params','rawAttributes','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','toString','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','stringify','lodash','../../components/parsers/qs'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x9c59,0x115));var _0x99c5=function(_0xe3e56a,_0xd3462d){_0xe3e56a=_0xe3e56a-0x0;var _0x5617f2=_0x9c59[_0xe3e56a];return _0x5617f2;};'use strict';var _=require(_0x99c5('0x0'));var Redis=require('ioredis');var qs=require(_0x99c5('0x1'));var encryptor=require(_0x99c5('0x2'));var config=require('../../config/environment');var logger=require(_0x99c5('0x3'))(_0x99c5('0x4'));var db=require(_0x99c5('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x99c5('0x6')]=_['defaults'](config[_0x99c5('0x6')],{'host':_0x99c5('0x7'),'port':0x18eb});var socket=require(_0x99c5('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x99c5('0x6')]);function respondWithStatusCode(_0x14358e,_0xd44207){_0xd44207=_0xd44207||0xcc;return function(_0x42c247){if(_0x42c247){return _0x14358e[_0x99c5('0x9')](_0xd44207);}return _0x14358e[_0x99c5('0xa')](_0xd44207)['end']();};}function respondWithResult(_0x28b684,_0x562839){_0x562839=_0x562839||0xc8;return function(_0x240210){if(_0x240210){return _0x28b684['status'](_0x562839)[_0x99c5('0xb')](_0x240210);}};}function respondWithFilteredResult(_0x54ae0a,_0x5f1861){return function(_0xa2ddb){if(_0xa2ddb){var _0x17eae1=typeof _0x5f1861[_0x99c5('0xc')]===_0x99c5('0xd')&&typeof _0x5f1861[_0x99c5('0xe')]==='undefined';var _0x48bad0=_0xa2ddb[_0x99c5('0xf')];var _0x52510b=_0x17eae1?0x0:_0x5f1861[_0x99c5('0xc')];var _0x41b68c=_0x17eae1?_0xa2ddb[_0x99c5('0xf')]:_0x5f1861['offset']+_0x5f1861[_0x99c5('0xe')];var _0x308d0a;if(_0x41b68c>=_0x48bad0){_0x41b68c=_0x48bad0;_0x308d0a=0xc8;}else{_0x308d0a=0xce;}_0x54ae0a[_0x99c5('0xa')](_0x308d0a);return _0x54ae0a[_0x99c5('0x10')]('Content-Range',_0x52510b+'-'+_0x41b68c+'/'+_0x48bad0)['json'](_0xa2ddb);}return null;};}function saveUpdates(_0x39bac1){return function(_0x51726f){if(_0x51726f){return _0x51726f[_0x99c5('0x11')](_0x39bac1)[_0x99c5('0x12')](function(_0x5e4f4f){return _0x5e4f4f;});}return null;};}function removeEntity(_0x4ea965){return function(_0x891141){if(_0x891141){return _0x891141['destroy']()[_0x99c5('0x12')](function(){_0x4ea965[_0x99c5('0xa')](0xcc)[_0x99c5('0x13')]();});}};}function handleEntityNotFound(_0x178bee){return function(_0x49ad00){if(!_0x49ad00){_0x178bee['sendStatus'](0x194);}return _0x49ad00;};}function handleError(_0x42098a,_0x39326b){_0x39326b=_0x39326b||0x1f4;return function(_0x24156a){logger[_0x99c5('0x14')](_0x24156a[_0x99c5('0x15')]);if(_0x24156a[_0x99c5('0x16')]){delete _0x24156a[_0x99c5('0x16')];}_0x42098a[_0x99c5('0xa')](_0x39326b)[_0x99c5('0x17')](_0x24156a);};}function maskClientSecret(_0x4794f9){return _[_0x99c5('0x18')](_0x4794f9['slice'](0x0,0x3),0x14,'*');}exports[_0x99c5('0x19')]=function(_0x206032,_0x1396e2){var _0x597b4a={},_0x4346c4={},_0x1ee82d={'count':0x0,'rows':[]};var _0x15d7a0=_['map'](db[_0x99c5('0x1a')]['rawAttributes'],function(_0x235483){return{'name':_0x235483[_0x99c5('0x1b')],'type':_0x235483[_0x99c5('0x1c')]['key']};});_0x4346c4[_0x99c5('0x1d')]=_[_0x99c5('0x1e')](_0x15d7a0,_0x99c5('0x16'));_0x4346c4['query']=_[_0x99c5('0x1f')](_0x206032[_0x99c5('0x20')]);_0x4346c4[_0x99c5('0x21')]=_[_0x99c5('0x22')](_0x4346c4[_0x99c5('0x1d')],_0x4346c4[_0x99c5('0x20')]);_0x597b4a[_0x99c5('0x23')]=_[_0x99c5('0x22')](_0x4346c4[_0x99c5('0x1d')],qs['fields'](_0x206032[_0x99c5('0x20')][_0x99c5('0x24')]));_0x597b4a[_0x99c5('0x23')]=_0x597b4a[_0x99c5('0x23')][_0x99c5('0x25')]?_0x597b4a[_0x99c5('0x23')]:_0x4346c4['model'];if(!_0x206032[_0x99c5('0x20')][_0x99c5('0x26')](_0x99c5('0x27'))){_0x597b4a['limit']=qs[_0x99c5('0xe')](_0x206032['query']['limit']);_0x597b4a['offset']=qs['offset'](_0x206032[_0x99c5('0x20')][_0x99c5('0xc')]);}_0x597b4a[_0x99c5('0x28')]=qs[_0x99c5('0x29')](_0x206032[_0x99c5('0x20')][_0x99c5('0x29')]);_0x597b4a[_0x99c5('0x2a')]=qs['filters'](_[_0x99c5('0x2b')](_0x206032[_0x99c5('0x20')],_0x4346c4['filters']),_0x15d7a0);if(_0x206032[_0x99c5('0x20')][_0x99c5('0x2c')]){_0x597b4a[_0x99c5('0x2a')]=_[_0x99c5('0x2d')](_0x597b4a['where'],{'$or':_[_0x99c5('0x1e')](_0x15d7a0,function(_0x3d1251){if(_0x3d1251['type']!==_0x99c5('0x2e')){var _0x490089={};_0x490089[_0x3d1251[_0x99c5('0x16')]]={'$like':'%'+_0x206032[_0x99c5('0x20')][_0x99c5('0x2c')]+'%'};return _0x490089;}})});}_0x597b4a=_[_0x99c5('0x2d')]({},_0x597b4a,_0x206032[_0x99c5('0x2f')]);var _0x3405a7={'where':_0x597b4a[_0x99c5('0x2a')]};return db[_0x99c5('0x1a')][_0x99c5('0xf')](_0x3405a7)['then'](function(_0x5e11fb){_0x1ee82d['count']=_0x5e11fb;if(_0x206032['query'][_0x99c5('0x30')]){_0x597b4a[_0x99c5('0x31')]=[{'all':!![]}];}return db[_0x99c5('0x1a')][_0x99c5('0x32')](_0x597b4a);})[_0x99c5('0x12')](function(_0x2fb05f){_0x1ee82d['rows']=_[_0x99c5('0x1e')](_0x2fb05f,function(_0x13f50e){if(_0x13f50e[_0x99c5('0x33')]===_0x99c5('0x34')){var _0x2be319=encryptor['decryptString'](_0x13f50e[_0x99c5('0x35')]);_0x13f50e['data3']=maskClientSecret(_0x2be319);}return _0x13f50e;});return _0x1ee82d;})[_0x99c5('0x12')](respondWithFilteredResult(_0x1396e2,_0x597b4a))[_0x99c5('0x36')](handleError(_0x1396e2,null));};exports[_0x99c5('0x37')]=function(_0x371e21,_0x16c02b){var _0x348f9a={'raw':!![],'where':{'id':_0x371e21[_0x99c5('0x38')]['id']}},_0x549ac7={};_0x549ac7['model']=_[_0x99c5('0x1f')](db['CloudProvider'][_0x99c5('0x39')]);_0x549ac7[_0x99c5('0x20')]=_[_0x99c5('0x1f')](_0x371e21[_0x99c5('0x20')]);_0x549ac7[_0x99c5('0x21')]=_[_0x99c5('0x22')](_0x549ac7[_0x99c5('0x1d')],_0x549ac7[_0x99c5('0x20')]);_0x348f9a[_0x99c5('0x23')]=_['intersection'](_0x549ac7[_0x99c5('0x1d')],qs[_0x99c5('0x24')](_0x371e21[_0x99c5('0x20')][_0x99c5('0x24')]));_0x348f9a['attributes']=_0x348f9a['attributes'][_0x99c5('0x25')]?_0x348f9a[_0x99c5('0x23')]:_0x549ac7[_0x99c5('0x1d')];if(_0x371e21[_0x99c5('0x20')][_0x99c5('0x30')]){_0x348f9a['include']=[{'all':!![]}];}_0x348f9a=_['merge']({},_0x348f9a,_0x371e21[_0x99c5('0x2f')]);return db[_0x99c5('0x1a')][_0x99c5('0x3a')](_0x348f9a)[_0x99c5('0x12')](handleEntityNotFound(_0x16c02b,null))['then'](function(_0x13b83c){if(_0x13b83c[_0x99c5('0x33')]===_0x99c5('0x34')){var _0xd9978a=encryptor[_0x99c5('0x3b')](_0x13b83c[_0x99c5('0x35')]);_0x13b83c[_0x99c5('0x35')]=maskClientSecret(_0xd9978a);}return _0x13b83c;})[_0x99c5('0x12')](respondWithResult(_0x16c02b,null))[_0x99c5('0x36')](handleError(_0x16c02b,null));};exports[_0x99c5('0x3c')]=function(_0x28d21a,_0x18edaf){if(!_0x28d21a[_0x99c5('0x3d')]['name'])throw new Error(_0x99c5('0x3e'));if(!_0x28d21a['body'][_0x99c5('0x33')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x5761de=db['CloudProvider'][_0x99c5('0x39')][_0x99c5('0x33')][_0x99c5('0x3f')];if(!_0x5761de[_0x99c5('0x40')](_0x28d21a[_0x99c5('0x3d')]['service']))throw new Error(_0x99c5('0x41')+_0x5761de[_0x99c5('0x42')](',\x20'));if(_0x28d21a[_0x99c5('0x3d')]['service']===_0x99c5('0x34')&&_0x28d21a[_0x99c5('0x3d')][_0x99c5('0x35')]){_0x28d21a['body']['data3']=encryptor[_0x99c5('0x43')](_0x28d21a['body'][_0x99c5('0x35')]);}return db[_0x99c5('0x1a')][_0x99c5('0x3c')](_0x28d21a[_0x99c5('0x3d')],{})[_0x99c5('0x12')](respondWithResult(_0x18edaf,0xc9))[_0x99c5('0x36')](handleError(_0x18edaf,null));};exports[_0x99c5('0x11')]=function(_0x2d2e3b,_0x5367e5){if(_0x2d2e3b[_0x99c5('0x3d')]['id']){delete _0x2d2e3b[_0x99c5('0x3d')]['id'];}return db[_0x99c5('0x1a')]['find']({'where':{'id':_0x2d2e3b[_0x99c5('0x38')]['id']}})[_0x99c5('0x12')](handleEntityNotFound(_0x5367e5,null))['then'](function(_0x35aece){if(_0x35aece[_0x99c5('0x33')]==='MicrosoftAzure'&&_0x2d2e3b['body']['data3']){_0x2d2e3b[_0x99c5('0x3d')][_0x99c5('0x35')]=encryptor['encryptString'](_0x2d2e3b[_0x99c5('0x3d')][_0x99c5('0x35')]);}return _0x35aece;})[_0x99c5('0x12')](saveUpdates(_0x2d2e3b[_0x99c5('0x3d')],null))[_0x99c5('0x12')](respondWithResult(_0x5367e5,null))['catch'](handleError(_0x5367e5,null));};exports['destroy']=function(_0x3877ba,_0xb657d4){return db[_0x99c5('0x1a')][_0x99c5('0x3a')]({'where':{'id':_0x3877ba[_0x99c5('0x38')]['id']}})[_0x99c5('0x12')](handleEntityNotFound(_0xb657d4,null))[_0x99c5('0x12')](removeEntity(_0xb657d4,null))[_0x99c5('0x36')](handleError(_0xb657d4,null));};exports[_0x99c5('0x44')]=function(_0x2d3621,_0xc73eff){return db[_0x99c5('0x1a')][_0x99c5('0x45')]({'where':{'id':_0x2d3621[_0x99c5('0x38')]['id']},'raw':!![]})[_0x99c5('0x12')](function(_0x3310c0){if(!_0x3310c0)return _0xc73eff['sendStatus'](0x194);return{'url':oauth[_0x99c5('0x46')](_0x3310c0,_0x2d3621[_0x99c5('0x47')]['id'])};})[_0x99c5('0x12')](respondWithResult(_0xc73eff,null))[_0x99c5('0x36')](handleError(_0xc73eff,null));};exports[_0x99c5('0x48')]=function(_0x2e4c0e,_0xe4c8f9){var _0x5dd88a=_0x2e4c0e[_0x99c5('0x3d')];var _0x9069b3;var _0x3f5e14;if(_0x5dd88a[_0x99c5('0x14')])throw _0x5dd88a;redis[_0x99c5('0x49')](_0x5dd88a[_0x99c5('0x4a')])['then'](function(_0x190561){if(!_0x190561)throw new Error(_0x99c5('0x4b'));_0x9069b3=JSON[_0x99c5('0x4c')](_0x190561);var _0x281e14=Buffer['from'](_0x5dd88a[_0x99c5('0x4a')],'base64')[_0x99c5('0x4d')]('ascii');_0x3f5e14=JSON[_0x99c5('0x4c')](_0x281e14);if(!oauth[_0x99c5('0x4e')](_0x5dd88a[_0x99c5('0x4f')],_0x9069b3['oauth2Claims']))throw new Error(_0x99c5('0x50'));redis[_0x99c5('0x51')](_0x5dd88a[_0x99c5('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0x5dd88a[_0x99c5('0x52')],_0x9069b3);})[_0x99c5('0x12')](function(_0x5d2df4){_0x9069b3[_0x99c5('0x53')]=_0x5d2df4[_0x99c5('0x54')];_0x9069b3[_0x99c5('0x55')]=_0x5d2df4[_0x99c5('0x56')];return db[_0x99c5('0x1a')][_0x99c5('0x11')]({'data5':_0x9069b3[_0x99c5('0x53')],'data6':_0x9069b3[_0x99c5('0x55')]},{'where':{'id':_0x9069b3['id']}});})['then'](function(){oauth[_0x99c5('0x57')](_0x9069b3);socket[_0x99c5('0x58')](_0x99c5('0x59'),{'id':_0x3f5e14['id']});return;})[_0x99c5('0x12')](respondWithStatusCode(_0xe4c8f9,null))[_0x99c5('0x36')](function(_0xfaa083){if(_0x3f5e14){socket[_0x99c5('0x58')](_0x99c5('0x5a'),{'id':_0x3f5e14['id']});}if(!_0x9069b3){logger[_0x99c5('0x14')]('Invalid\x20authentication\x20state\x20parameter',_0xfaa083);return _0xe4c8f9[_0x99c5('0xa')](0x1f4)[_0x99c5('0x17')](_0xfaa083[_0x99c5('0x5b')]);}logger[_0x99c5('0x14')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x9069b3['id'],JSON[_0x99c5('0x5c')](_0xfaa083));});}; \ No newline at end of file +var _0x1c0d=['Content-Range','json','update','then','end','sendStatus','error','stack','name','send','padEnd','slice','CloudProvider','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','where','VIRTUAL','filter','includeAll','include','findAll','MicrosoftAzure','decryptString','data3','catch','params','rawAttributes','intersection','length','merge','options','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','state','parse','from','base64','toString','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','status','offset','undefined','count','limit','set'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1c0d,0x1cf));var _0xd1c0=function(_0x1e125a,_0x4f87fe){_0x1e125a=_0x1e125a-0x0;var _0x584e68=_0x1c0d[_0x1e125a];return _0x584e68;};'use strict';var _=require(_0xd1c0('0x0'));var Redis=require(_0xd1c0('0x1'));var qs=require(_0xd1c0('0x2'));var encryptor=require(_0xd1c0('0x3'));var config=require('../../config/environment');var logger=require(_0xd1c0('0x4'))(_0xd1c0('0x5'));var db=require(_0xd1c0('0x6'))['db'];var oauth=require(_0xd1c0('0x7'));config['redis']=_[_0xd1c0('0x8')](config[_0xd1c0('0x9')],{'host':_0xd1c0('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd1c0('0x9')]));var redis=new Redis(config[_0xd1c0('0x9')]);function respondWithStatusCode(_0x1a96f8,_0x260814){_0x260814=_0x260814||0xcc;return function(_0x297b79){if(_0x297b79){return _0x1a96f8['sendStatus'](_0x260814);}return _0x1a96f8[_0xd1c0('0xb')](_0x260814)['end']();};}function respondWithResult(_0x2fb513,_0x38781d){_0x38781d=_0x38781d||0xc8;return function(_0x4c90fe){if(_0x4c90fe){return _0x2fb513[_0xd1c0('0xb')](_0x38781d)['json'](_0x4c90fe);}};}function respondWithFilteredResult(_0x536ef4,_0x5cee8f){return function(_0x24d170){if(_0x24d170){var _0x533f65=typeof _0x5cee8f[_0xd1c0('0xc')]===_0xd1c0('0xd')&&typeof _0x5cee8f['limit']===_0xd1c0('0xd');var _0x5df0c6=_0x24d170[_0xd1c0('0xe')];var _0x2b3d0a=_0x533f65?0x0:_0x5cee8f[_0xd1c0('0xc')];var _0x41f7bf=_0x533f65?_0x24d170[_0xd1c0('0xe')]:_0x5cee8f['offset']+_0x5cee8f[_0xd1c0('0xf')];var _0x3ee6f8;if(_0x41f7bf>=_0x5df0c6){_0x41f7bf=_0x5df0c6;_0x3ee6f8=0xc8;}else{_0x3ee6f8=0xce;}_0x536ef4[_0xd1c0('0xb')](_0x3ee6f8);return _0x536ef4[_0xd1c0('0x10')](_0xd1c0('0x11'),_0x2b3d0a+'-'+_0x41f7bf+'/'+_0x5df0c6)[_0xd1c0('0x12')](_0x24d170);}return null;};}function saveUpdates(_0x138eb9){return function(_0xf754c6){if(_0xf754c6){return _0xf754c6[_0xd1c0('0x13')](_0x138eb9)[_0xd1c0('0x14')](function(_0x134216){return _0x134216;});}return null;};}function removeEntity(_0x148f1b){return function(_0x20d068){if(_0x20d068){return _0x20d068['destroy']()['then'](function(){_0x148f1b['status'](0xcc)[_0xd1c0('0x15')]();});}};}function handleEntityNotFound(_0x10cd44){return function(_0x559edb){if(!_0x559edb){_0x10cd44[_0xd1c0('0x16')](0x194);}return _0x559edb;};}function handleError(_0x321b9a,_0x544f3b){_0x544f3b=_0x544f3b||0x1f4;return function(_0x3e404d){logger[_0xd1c0('0x17')](_0x3e404d[_0xd1c0('0x18')]);if(_0x3e404d['name']){delete _0x3e404d[_0xd1c0('0x19')];}_0x321b9a[_0xd1c0('0xb')](_0x544f3b)[_0xd1c0('0x1a')](_0x3e404d);};}function maskClientSecret(_0x3fcbd2){return _[_0xd1c0('0x1b')](_0x3fcbd2[_0xd1c0('0x1c')](0x0,0x3),0x14,'*');}exports['index']=function(_0x4ab7d2,_0x43d457){var _0x35742d={},_0x47a8c6={},_0x55b4cc={'count':0x0,'rows':[]};var _0x54d00a=_['map'](db[_0xd1c0('0x1d')]['rawAttributes'],function(_0x546a1e){return{'name':_0x546a1e[_0xd1c0('0x1e')],'type':_0x546a1e[_0xd1c0('0x1f')][_0xd1c0('0x20')]};});_0x47a8c6[_0xd1c0('0x21')]=_[_0xd1c0('0x22')](_0x54d00a,_0xd1c0('0x19'));_0x47a8c6[_0xd1c0('0x23')]=_[_0xd1c0('0x24')](_0x4ab7d2['query']);_0x47a8c6[_0xd1c0('0x25')]=_['intersection'](_0x47a8c6[_0xd1c0('0x21')],_0x47a8c6[_0xd1c0('0x23')]);_0x35742d[_0xd1c0('0x26')]=_['intersection'](_0x47a8c6['model'],qs['fields'](_0x4ab7d2[_0xd1c0('0x23')][_0xd1c0('0x27')]));_0x35742d[_0xd1c0('0x26')]=_0x35742d[_0xd1c0('0x26')]['length']?_0x35742d[_0xd1c0('0x26')]:_0x47a8c6[_0xd1c0('0x21')];if(!_0x4ab7d2['query'][_0xd1c0('0x28')](_0xd1c0('0x29'))){_0x35742d[_0xd1c0('0xf')]=qs[_0xd1c0('0xf')](_0x4ab7d2[_0xd1c0('0x23')][_0xd1c0('0xf')]);_0x35742d['offset']=qs[_0xd1c0('0xc')](_0x4ab7d2[_0xd1c0('0x23')][_0xd1c0('0xc')]);}_0x35742d[_0xd1c0('0x2a')]=qs['sort'](_0x4ab7d2[_0xd1c0('0x23')]['sort']);_0x35742d[_0xd1c0('0x2b')]=qs[_0xd1c0('0x25')](_['pick'](_0x4ab7d2[_0xd1c0('0x23')],_0x47a8c6[_0xd1c0('0x25')]),_0x54d00a);if(_0x4ab7d2[_0xd1c0('0x23')]['filter']){_0x35742d[_0xd1c0('0x2b')]=_['merge'](_0x35742d['where'],{'$or':_[_0xd1c0('0x22')](_0x54d00a,function(_0x9f57f7){if(_0x9f57f7[_0xd1c0('0x1f')]!==_0xd1c0('0x2c')){var _0x3a7653={};_0x3a7653[_0x9f57f7[_0xd1c0('0x19')]]={'$like':'%'+_0x4ab7d2[_0xd1c0('0x23')][_0xd1c0('0x2d')]+'%'};return _0x3a7653;}})});}_0x35742d=_['merge']({},_0x35742d,_0x4ab7d2['options']);var _0x37fb9e={'where':_0x35742d[_0xd1c0('0x2b')]};return db[_0xd1c0('0x1d')][_0xd1c0('0xe')](_0x37fb9e)[_0xd1c0('0x14')](function(_0x2e2be4){_0x55b4cc[_0xd1c0('0xe')]=_0x2e2be4;if(_0x4ab7d2['query'][_0xd1c0('0x2e')]){_0x35742d[_0xd1c0('0x2f')]=[{'all':!![]}];}return db['CloudProvider'][_0xd1c0('0x30')](_0x35742d);})[_0xd1c0('0x14')](function(_0x5f5bb3){_0x55b4cc['rows']=_[_0xd1c0('0x22')](_0x5f5bb3,function(_0x7c2a19){if(_0x7c2a19['service']===_0xd1c0('0x31')){var _0x13fb68=encryptor[_0xd1c0('0x32')](_0x7c2a19[_0xd1c0('0x33')]);_0x7c2a19[_0xd1c0('0x33')]=maskClientSecret(_0x13fb68);}return _0x7c2a19;});return _0x55b4cc;})[_0xd1c0('0x14')](respondWithFilteredResult(_0x43d457,_0x35742d))[_0xd1c0('0x34')](handleError(_0x43d457,null));};exports['show']=function(_0x32d5c7,_0xbbd326){var _0x1e34b7={'raw':!![],'where':{'id':_0x32d5c7[_0xd1c0('0x35')]['id']}},_0x25725e={};_0x25725e['model']=_[_0xd1c0('0x24')](db[_0xd1c0('0x1d')][_0xd1c0('0x36')]);_0x25725e[_0xd1c0('0x23')]=_['keys'](_0x32d5c7[_0xd1c0('0x23')]);_0x25725e['filters']=_[_0xd1c0('0x37')](_0x25725e[_0xd1c0('0x21')],_0x25725e[_0xd1c0('0x23')]);_0x1e34b7[_0xd1c0('0x26')]=_['intersection'](_0x25725e['model'],qs[_0xd1c0('0x27')](_0x32d5c7[_0xd1c0('0x23')]['fields']));_0x1e34b7['attributes']=_0x1e34b7['attributes'][_0xd1c0('0x38')]?_0x1e34b7[_0xd1c0('0x26')]:_0x25725e[_0xd1c0('0x21')];if(_0x32d5c7[_0xd1c0('0x23')][_0xd1c0('0x2e')]){_0x1e34b7[_0xd1c0('0x2f')]=[{'all':!![]}];}_0x1e34b7=_[_0xd1c0('0x39')]({},_0x1e34b7,_0x32d5c7[_0xd1c0('0x3a')]);return db[_0xd1c0('0x1d')][_0xd1c0('0x3b')](_0x1e34b7)[_0xd1c0('0x14')](handleEntityNotFound(_0xbbd326,null))[_0xd1c0('0x14')](function(_0x3d2bd3){if(_0x3d2bd3[_0xd1c0('0x3c')]===_0xd1c0('0x31')){var _0x449284=encryptor[_0xd1c0('0x32')](_0x3d2bd3[_0xd1c0('0x33')]);_0x3d2bd3[_0xd1c0('0x33')]=maskClientSecret(_0x449284);}return _0x3d2bd3;})[_0xd1c0('0x14')](respondWithResult(_0xbbd326,null))['catch'](handleError(_0xbbd326,null));};exports[_0xd1c0('0x3d')]=function(_0x12625f,_0x5ea16d){if(!_0x12625f[_0xd1c0('0x3e')][_0xd1c0('0x19')])throw new Error(_0xd1c0('0x3f'));if(!_0x12625f[_0xd1c0('0x3e')][_0xd1c0('0x3c')])throw new Error(_0xd1c0('0x40'));var _0x3d7e7d=db[_0xd1c0('0x1d')][_0xd1c0('0x36')][_0xd1c0('0x3c')][_0xd1c0('0x41')];if(!_0x3d7e7d[_0xd1c0('0x42')](_0x12625f[_0xd1c0('0x3e')][_0xd1c0('0x3c')]))throw new Error(_0xd1c0('0x43')+_0x3d7e7d[_0xd1c0('0x44')](',\x20'));if(_0x12625f['body'][_0xd1c0('0x3c')]===_0xd1c0('0x31')&&_0x12625f[_0xd1c0('0x3e')][_0xd1c0('0x33')]){_0x12625f['body']['data3']=encryptor[_0xd1c0('0x45')](_0x12625f[_0xd1c0('0x3e')][_0xd1c0('0x33')]);}return db[_0xd1c0('0x1d')][_0xd1c0('0x3d')](_0x12625f['body'],{})['then'](respondWithResult(_0x5ea16d,0xc9))[_0xd1c0('0x34')](handleError(_0x5ea16d,null));};exports[_0xd1c0('0x13')]=function(_0x48590a,_0xce774f){if(_0x48590a['body']['id']){delete _0x48590a[_0xd1c0('0x3e')]['id'];}return db[_0xd1c0('0x1d')][_0xd1c0('0x3b')]({'where':{'id':_0x48590a[_0xd1c0('0x35')]['id']}})[_0xd1c0('0x14')](handleEntityNotFound(_0xce774f,null))['then'](function(_0x16b524){if(_0x16b524[_0xd1c0('0x3c')]===_0xd1c0('0x31')&&_0x48590a['body']['data3']){_0x48590a[_0xd1c0('0x3e')][_0xd1c0('0x33')]=encryptor[_0xd1c0('0x45')](_0x48590a[_0xd1c0('0x3e')]['data3']);}return _0x16b524;})['then'](saveUpdates(_0x48590a[_0xd1c0('0x3e')],null))['then'](respondWithResult(_0xce774f,null))[_0xd1c0('0x34')](handleError(_0xce774f,null));};exports[_0xd1c0('0x46')]=function(_0x215cc1,_0x3ab1f4){return db[_0xd1c0('0x1d')][_0xd1c0('0x3b')]({'where':{'id':_0x215cc1[_0xd1c0('0x35')]['id']}})['then'](handleEntityNotFound(_0x3ab1f4,null))[_0xd1c0('0x14')](removeEntity(_0x3ab1f4,null))[_0xd1c0('0x34')](handleError(_0x3ab1f4,null));};exports[_0xd1c0('0x47')]=function(_0x39753d,_0x3d86a0){return db[_0xd1c0('0x1d')][_0xd1c0('0x48')]({'where':{'id':_0x39753d[_0xd1c0('0x35')]['id']},'raw':!![]})[_0xd1c0('0x14')](function(_0x3fcb91){if(!_0x3fcb91)return _0x3d86a0['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x3fcb91,_0x39753d[_0xd1c0('0x49')]['id'])};})[_0xd1c0('0x14')](respondWithResult(_0x3d86a0,null))[_0xd1c0('0x34')](handleError(_0x3d86a0,null));};exports[_0xd1c0('0x4a')]=function(_0x1138ce,_0x347f40){var _0x4079db=_0x1138ce[_0xd1c0('0x3e')];var _0xf3f99a;var _0x2cb120;if(_0x4079db[_0xd1c0('0x17')])throw _0x4079db;redis['get'](_0x4079db[_0xd1c0('0x4b')])['then'](function(_0x53828f){if(!_0x53828f)throw new Error('Invalid\x20state\x20parameter');_0xf3f99a=JSON[_0xd1c0('0x4c')](_0x53828f);var _0xe97fd5=Buffer[_0xd1c0('0x4d')](_0x4079db[_0xd1c0('0x4b')],_0xd1c0('0x4e'))[_0xd1c0('0x4f')]('ascii');_0x2cb120=JSON[_0xd1c0('0x4c')](_0xe97fd5);if(!oauth['isValidIdToken'](_0x4079db[_0xd1c0('0x50')],_0xf3f99a[_0xd1c0('0x51')]))throw new Error(_0xd1c0('0x52'));redis[_0xd1c0('0x53')](_0x4079db[_0xd1c0('0x4b')]);return oauth[_0xd1c0('0x54')](_0x4079db['code'],_0xf3f99a);})[_0xd1c0('0x14')](function(_0x2dd9cf){_0xf3f99a['data5']=_0x2dd9cf[_0xd1c0('0x55')];_0xf3f99a[_0xd1c0('0x56')]=_0x2dd9cf[_0xd1c0('0x57')];return db[_0xd1c0('0x1d')][_0xd1c0('0x13')]({'data5':_0xf3f99a[_0xd1c0('0x58')],'data6':_0xf3f99a[_0xd1c0('0x56')]},{'where':{'id':_0xf3f99a['id']}});})['then'](function(){oauth[_0xd1c0('0x59')](_0xf3f99a);socket[_0xd1c0('0x5a')](_0xd1c0('0x5b'),{'id':_0x2cb120['id']});return;})[_0xd1c0('0x14')](respondWithStatusCode(_0x347f40,null))[_0xd1c0('0x34')](function(_0x365365){if(_0x2cb120){socket[_0xd1c0('0x5a')](_0xd1c0('0x5c'),{'id':_0x2cb120['id']});}if(!_0xf3f99a){logger[_0xd1c0('0x17')](_0xd1c0('0x5d'),_0x365365);return _0x347f40[_0xd1c0('0xb')](0x1f4)[_0xd1c0('0x1a')](_0x365365[_0xd1c0('0x5e')]);}logger[_0xd1c0('0x17')](_0xd1c0('0x5f'),_0xf3f99a['id'],JSON['stringify'](_0x365365));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0f29706..edb7434 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 _0x0ac2=['../../config/logger','api','moment','request-promise','path','../../config/environment','CloudProvider'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0x0ac2,0x15e));var _0x20ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ac2[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20ac('0x0'))(_0x20ac('0x1'));var moment=require(_0x20ac('0x2'));var BPromise=require('bluebird');var rp=require(_0x20ac('0x3'));var fs=require('fs');var path=require(_0x20ac('0x4'));var rimraf=require('rimraf');var config=require(_0x20ac('0x5'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x75ed64,_0x294ca6){return _0x75ed64['define'](_0x20ac('0x6'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f27=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers'];(function(_0x555e05,_0x21c425){var _0x1d4250=function(_0x37f705){while(--_0x37f705){_0x555e05['push'](_0x555e05['shift']());}};_0x1d4250(++_0x21c425);}(_0x7f27,0x142));var _0x77f2=function(_0x1cb272,_0x325587){_0x1cb272=_0x1cb272-0x0;var _0x5a6857=_0x7f27[_0x1cb272];return _0x5a6857;};'use strict';var _=require(_0x77f2('0x0'));var util=require('util');var logger=require(_0x77f2('0x1'))(_0x77f2('0x2'));var moment=require(_0x77f2('0x3'));var BPromise=require(_0x77f2('0x4'));var rp=require(_0x77f2('0x5'));var fs=require('fs');var path=require(_0x77f2('0x6'));var rimraf=require(_0x77f2('0x7'));var config=require(_0x77f2('0x8'));var attributes=require(_0x77f2('0x9'));module[_0x77f2('0xa')]=function(_0xd3661d,_0x149515){return _0xd3661d[_0x77f2('0xb')](_0x77f2('0xc'),attributes,{'tableName':_0x77f2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 7d778c6..e944e70 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 _0xa26d=['findOne','refresh_token','data6','data4','decryptString','POST','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','all','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','type','push','/.default','join','Outlook365','Dynamics365','data7','replace','{TENANT_ID}','data2','code','from','base64','randomBytes','toString','hex','client_id','data1','redirect_uri','form_post','state','nonce','prompt','map','key','value','oauth2Claims','oauth2/','set','stringify','payload','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider'];(function(_0x9cdbe2,_0x5d2fa2){var _0x4e0f87=function(_0x224cc4){while(--_0x224cc4){_0x9cdbe2['push'](_0x9cdbe2['shift']());}};_0x4e0f87(++_0x5d2fa2);}(_0xa26d,0x108));var _0xda26=function(_0x5ef2b7,_0xfec6f9){_0x5ef2b7=_0x5ef2b7-0x0;var _0x1c5ef4=_0xa26d[_0x5ef2b7];return _0x1c5ef4;};'use strict';var _=require('lodash');var crypto=require(_0xda26('0x0'));var jwt=require(_0xda26('0x1'));var moment=require(_0xda26('0x2'));var Redis=require(_0xda26('0x3'));var rp=require(_0xda26('0x4'));var util=require(_0xda26('0x5'));var encryptor=require(_0xda26('0x6'));var config=require(_0xda26('0x7'));var logger=require(_0xda26('0x8'))(_0xda26('0x9'));var schedule=require(_0xda26('0xa'));var db=require(_0xda26('0xb'))['db'];config[_0xda26('0xc')]=_['defaults'](config[_0xda26('0xc')],{'host':_0xda26('0xd'),'port':0x18eb});var redis=new Redis(config[_0xda26('0xc')]);var MICROSOFT_AUTH_URL=_0xda26('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xda26('0xf'),_0xda26('0x10'),_0xda26('0x11'),'offline_access',_0xda26('0x12'),_0xda26('0x13'),_0xda26('0x14')],'Dynamics365':[_0xda26('0xf'),_0xda26('0x15')]};var MICROSOFT_AUTH_ENDPOINT=_0xda26('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0xda26('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xf832b2){var _0x3fb91f=_['map'](AZURE_AUTH_SCOPES[_0xf832b2[_0xda26('0x18')]]);if(_0xf832b2[_0xda26('0x18')]==='Dynamics365')_0x3fb91f[_0xda26('0x19')](_0xf832b2['data7']+_0xda26('0x1a'));return _0x3fb91f[_0xda26('0x1b')]('\x20');}function getAccessTokenScope(_0xe60e1){if(_0xe60e1['type']===_0xda26('0x1c'))return _0xda26('0x12');if(_0xe60e1[_0xda26('0x18')]===_0xda26('0x1d'))return _0xe60e1[_0xda26('0x1e')]+_0xda26('0x1a');}function generateMicrosoftAuthorizationUrl(_0x3d6434,_0x94274d){var _0x439410=MICROSOFT_AUTH_URL[_0xda26('0x1f')](_0xda26('0x20'),_0x3d6434[_0xda26('0x21')]);var _0x2ca64c=[_0xda26('0x22'),'id_token'];var _0xc6f7d8=Buffer[_0xda26('0x23')](JSON['stringify']({'id':_0x94274d}))['toString'](_0xda26('0x24'));var _0x282383=crypto[_0xda26('0x25')](0x10)[_0xda26('0x26')](_0xda26('0x27'));var _0x41bb92=getAuthorizationScopes(_0x3d6434);var _0x1f4a00=[{'key':_0xda26('0x28'),'value':_0x3d6434[_0xda26('0x29')]},{'key':'response_type','value':encodeURIComponent(_0x2ca64c[_0xda26('0x1b')]('\x20'))},{'key':_0xda26('0x2a'),'value':_0x3d6434['data4']},{'key':'response_mode','value':_0xda26('0x2b')},{'key':'scope','value':encodeURIComponent(_0x41bb92)},{'key':_0xda26('0x2c'),'value':_0xc6f7d8},{'key':_0xda26('0x2d'),'value':_0x282383},{'key':_0xda26('0x2e'),'value':'login'}];var _0x88e17d=_0x439410+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xda26('0x2f')](_0x1f4a00,function(_0x2e2add){return _0x2e2add[_0xda26('0x30')]+'='+_0x2e2add[_0xda26('0x31')];})[_0xda26('0x1b')]('&');_0x3d6434[_0xda26('0x32')]={'issuer':_0x439410[_0xda26('0x1f')](_0xda26('0x33'),''),'audience':_0x3d6434[_0xda26('0x29')],'state':_0xc6f7d8,'nonce':_0x282383};redis[_0xda26('0x34')](_0xc6f7d8,JSON[_0xda26('0x35')](_0x3d6434));return _0x88e17d;}function isValidIdToken(_0x4c6972,_0x46ef95){try{var _0x422a7b=jwt['decode'](_0x4c6972,{'complete':!![]});var _0x2949d3=_0x422a7b[_0xda26('0x36')];if(_0x2949d3['iss']!==_0x46ef95['issuer'])return![];if(_0x2949d3[_0xda26('0x37')]!==_0x46ef95[_0xda26('0x38')])return![];if(_0x2949d3[_0xda26('0x2d')]!==_0x46ef95[_0xda26('0x2d')])return![];if(moment()[_0xda26('0x39')](moment[_0xda26('0x3a')](_0x2949d3[_0xda26('0x3b')])))return![];return!![];}catch(_0x404abe){throw _0x404abe;}}function refreshOauth2MicrosoftAccessToken(_0x4b1d89){return Promise[_0xda26('0x3c')]()[_0xda26('0x3d')](function(){if(_0x4b1d89[_0xda26('0x3e')])return _0x4b1d89;return db[_0xda26('0x3f')][_0xda26('0x40')]({'where':{'id':_0x4b1d89['id']},'raw':!![]});})[_0xda26('0x3d')](function(_0x4969b0){var _0x23cc98={'grant_type':_0xda26('0x41'),'refresh_token':_0x4969b0[_0xda26('0x42')],'scope':getAccessTokenScope(_0x4969b0),'redirect_uri':_0x4969b0[_0xda26('0x43')],'client_id':_0x4969b0[_0xda26('0x29')],'client_secret':encryptor[_0xda26('0x44')](_0x4969b0[_0xda26('0x3e')])};var _0x51ed92={'method':_0xda26('0x45'),'uri':MICROSOFT_AUTH_URL[_0xda26('0x1f')]('{TENANT_ID}',_0x4969b0[_0xda26('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x23cc98,'json':!![]};return rp(_0x51ed92);})['then'](function(_0x2f7eca){_0x4b1d89[_0xda26('0x46')]=_0x2f7eca[_0xda26('0x47')];_0x4b1d89[_0xda26('0x42')]=_0x2f7eca['refresh_token'];return db['CloudProvider'][_0xda26('0x48')]({'data5':_0x4b1d89[_0xda26('0x46')],'data6':_0x4b1d89[_0xda26('0x42')]},{'where':{'id':_0x4b1d89['id']}});})['then'](function(){return _0x4b1d89;})[_0xda26('0x49')](function(_0x15d0fb){logger['error'](_0xda26('0x4a'),_0x4b1d89['id'],_0x15d0fb);});}function getOauth2MicrosoftAccessToken(_0x50bb53,_0x2cc2c1){var _0x28273a={'grant_type':'authorization_code','code':_0x50bb53,'scope':getAccessTokenScope(_0x2cc2c1),'redirect_uri':_0x2cc2c1[_0xda26('0x43')],'client_id':_0x2cc2c1[_0xda26('0x29')],'client_secret':encryptor[_0xda26('0x44')](_0x2cc2c1['data3'])};var _0x557048={'method':_0xda26('0x45'),'uri':MICROSOFT_AUTH_URL[_0xda26('0x1f')]('{TENANT_ID}',_0x2cc2c1['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x28273a,'json':!![]};return rp(_0x557048);}function startRefreshInterval(_0x5726de){var _0x2f49dd=schedule[_0xda26('0x4b')];if(_0x2f49dd[_0x5726de['id']])clearInterval(_0x2f49dd[_0x5726de['id']]);_0x2f49dd[_0x5726de['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xda26('0x4c')](this,{'id':_0x5726de['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xda26('0x4b')]=_0x2f49dd;}function startAllRefreshIntervals(){return db[_0xda26('0x3f')][_0xda26('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x45090f){var _0x52094f=_0x45090f[_0xda26('0x2f')](function(_0x24e86a){return refreshOauth2MicrosoftAccessToken(_0x24e86a)[_0xda26('0x3d')](function(_0x2797d5){startRefreshInterval(_0x2797d5);});});return Promise[_0xda26('0x4e')](_0x52094f);})[_0xda26('0x49')](function(_0x23d2a9){var _0x1b21b9=_0x23d2a9?util['inspect'](_0x23d2a9,{'showHidden':![],'depth':null}):'';logger[_0xda26('0x4f')](_0xda26('0x50'),_0x1b21b9);});}module[_0xda26('0x51')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x8f3d=['stringify','base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','form_post','scope','state','nonce','prompt','value','join','oauth2Claims','decode','payload','iss','issuer','aud','audience','isAfter','exp','resolve','then','data3','CloudProvider','refresh_token','data6','decryptString','POST','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data1','bind','intervals','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','map','type','data7','/.default','Outlook365','replace','{TENANT_ID}','data2','code','id_token'];(function(_0x5676d3,_0x582062){var _0x573736=function(_0x3760bc){while(--_0x3760bc){_0x5676d3['push'](_0x5676d3['shift']());}};_0x573736(++_0x582062);}(_0x8f3d,0xbf));var _0xd8f3=function(_0x59617b,_0x3f3fbd){_0x59617b=_0x59617b-0x0;var _0xa9b90b=_0x8f3d[_0x59617b];return _0xa9b90b;};'use strict';var _=require('lodash');var crypto=require(_0xd8f3('0x0'));var jwt=require(_0xd8f3('0x1'));var moment=require(_0xd8f3('0x2'));var Redis=require(_0xd8f3('0x3'));var rp=require(_0xd8f3('0x4'));var util=require(_0xd8f3('0x5'));var encryptor=require(_0xd8f3('0x6'));var config=require(_0xd8f3('0x7'));var logger=require('../../config/logger')(_0xd8f3('0x8'));var schedule=require(_0xd8f3('0x9'));var db=require(_0xd8f3('0xa'))['db'];config[_0xd8f3('0xb')]=_[_0xd8f3('0xc')](config[_0xd8f3('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xd8f3('0xd'),_0xd8f3('0xe'),_0xd8f3('0xf'),'offline_access',_0xd8f3('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0xd8f3('0x11')],'Dynamics365':[_0xd8f3('0xd'),_0xd8f3('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0xd8f3('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xd8f3('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x9a72fe){var _0x25e255=_[_0xd8f3('0x15')](AZURE_AUTH_SCOPES[_0x9a72fe['type']]);if(_0x9a72fe[_0xd8f3('0x16')]==='Dynamics365')_0x25e255['push'](_0x9a72fe[_0xd8f3('0x17')]+_0xd8f3('0x18'));return _0x25e255['join']('\x20');}function getAccessTokenScope(_0x186f33){if(_0x186f33[_0xd8f3('0x16')]===_0xd8f3('0x19'))return _0xd8f3('0x10');if(_0x186f33[_0xd8f3('0x16')]==='Dynamics365')return _0x186f33['data7']+_0xd8f3('0x18');}function generateMicrosoftAuthorizationUrl(_0x37f057,_0x41c4ec){var _0x11e56e=MICROSOFT_AUTH_URL[_0xd8f3('0x1a')](_0xd8f3('0x1b'),_0x37f057[_0xd8f3('0x1c')]);var _0xeac49f=[_0xd8f3('0x1d'),_0xd8f3('0x1e')];var _0x2c0a21=Buffer['from'](JSON[_0xd8f3('0x1f')]({'id':_0x41c4ec}))['toString'](_0xd8f3('0x20'));var _0xaa55e9=crypto[_0xd8f3('0x21')](0x10)['toString'](_0xd8f3('0x22'));var _0x3c94e6=getAuthorizationScopes(_0x37f057);var _0x396977=[{'key':_0xd8f3('0x23'),'value':_0x37f057['data1']},{'key':_0xd8f3('0x24'),'value':encodeURIComponent(_0xeac49f['join']('\x20'))},{'key':_0xd8f3('0x25'),'value':_0x37f057[_0xd8f3('0x26')]},{'key':'response_mode','value':_0xd8f3('0x27')},{'key':_0xd8f3('0x28'),'value':encodeURIComponent(_0x3c94e6)},{'key':_0xd8f3('0x29'),'value':_0x2c0a21},{'key':_0xd8f3('0x2a'),'value':_0xaa55e9},{'key':_0xd8f3('0x2b'),'value':'login'}];var _0x56e648=_0x11e56e+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xd8f3('0x15')](_0x396977,function(_0x5c6e34){return _0x5c6e34['key']+'='+_0x5c6e34[_0xd8f3('0x2c')];})[_0xd8f3('0x2d')]('&');_0x37f057[_0xd8f3('0x2e')]={'issuer':_0x11e56e['replace']('oauth2/',''),'audience':_0x37f057['data1'],'state':_0x2c0a21,'nonce':_0xaa55e9};redis['set'](_0x2c0a21,JSON[_0xd8f3('0x1f')](_0x37f057));return _0x56e648;}function isValidIdToken(_0x213334,_0x2495d6){try{var _0x2ff04d=jwt[_0xd8f3('0x2f')](_0x213334,{'complete':!![]});var _0x21d598=_0x2ff04d[_0xd8f3('0x30')];if(_0x21d598[_0xd8f3('0x31')]!==_0x2495d6[_0xd8f3('0x32')])return![];if(_0x21d598[_0xd8f3('0x33')]!==_0x2495d6[_0xd8f3('0x34')])return![];if(_0x21d598['nonce']!==_0x2495d6['nonce'])return![];if(moment()[_0xd8f3('0x35')](moment['unix'](_0x21d598[_0xd8f3('0x36')])))return![];return!![];}catch(_0x2a39d0){throw _0x2a39d0;}}function refreshOauth2MicrosoftAccessToken(_0x4258da){return Promise[_0xd8f3('0x37')]()[_0xd8f3('0x38')](function(){if(_0x4258da[_0xd8f3('0x39')])return _0x4258da;return db[_0xd8f3('0x3a')]['findOne']({'where':{'id':_0x4258da['id']},'raw':!![]});})[_0xd8f3('0x38')](function(_0x4b76d8){var _0x341ad3={'grant_type':_0xd8f3('0x3b'),'refresh_token':_0x4b76d8[_0xd8f3('0x3c')],'scope':getAccessTokenScope(_0x4b76d8),'redirect_uri':_0x4b76d8[_0xd8f3('0x26')],'client_id':_0x4b76d8['data1'],'client_secret':encryptor[_0xd8f3('0x3d')](_0x4b76d8['data3'])};var _0x41e4bb={'method':_0xd8f3('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xd8f3('0x1a')](_0xd8f3('0x1b'),_0x4b76d8[_0xd8f3('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x341ad3,'json':!![]};return rp(_0x41e4bb);})[_0xd8f3('0x38')](function(_0x16c070){_0x4258da[_0xd8f3('0x3f')]=_0x16c070['access_token'];_0x4258da['data6']=_0x16c070[_0xd8f3('0x3b')];return db['CloudProvider'][_0xd8f3('0x40')]({'data5':_0x4258da[_0xd8f3('0x3f')],'data6':_0x4258da[_0xd8f3('0x3c')]},{'where':{'id':_0x4258da['id']}});})[_0xd8f3('0x38')](function(){return _0x4258da;})[_0xd8f3('0x41')](function(_0x44d2d9){logger[_0xd8f3('0x42')](_0xd8f3('0x43'),_0x4258da['id'],_0x44d2d9);});}function getOauth2MicrosoftAccessToken(_0x240a7f,_0x12b8d8){var _0x276d23={'grant_type':'authorization_code','code':_0x240a7f,'scope':getAccessTokenScope(_0x12b8d8),'redirect_uri':_0x12b8d8[_0xd8f3('0x26')],'client_id':_0x12b8d8[_0xd8f3('0x44')],'client_secret':encryptor[_0xd8f3('0x3d')](_0x12b8d8[_0xd8f3('0x39')])};var _0x4ac142={'method':_0xd8f3('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xd8f3('0x1a')]('{TENANT_ID}',_0x12b8d8[_0xd8f3('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x276d23,'json':!![]};return rp(_0x4ac142);}function startRefreshInterval(_0x45aa9d){var _0x4fbb6f=schedule['intervals'];if(_0x4fbb6f[_0x45aa9d['id']])clearInterval(_0x4fbb6f[_0x45aa9d['id']]);_0x4fbb6f[_0x45aa9d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xd8f3('0x45')](this,{'id':_0x45aa9d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xd8f3('0x46')]=_0x4fbb6f;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x4678c7){var _0x1eeed4=_0x4678c7[_0xd8f3('0x15')](function(_0x15fa8c){return refreshOauth2MicrosoftAccessToken(_0x15fa8c)[_0xd8f3('0x38')](function(_0x10e7df){startRefreshInterval(_0x10e7df);});});return Promise[_0xd8f3('0x47')](_0x1eeed4);})['catch'](function(_0x48e457){var _0x5a06d9=_0x48e457?util['inspect'](_0x48e457,{'showHidden':![],'depth':null}):'';logger[_0xd8f3('0x42')](_0xd8f3('0x48'),_0x5a06d9);});}module[_0xd8f3('0x49')]={'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 a7fdb94..c666284 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 _0xba5a=['error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x4c0de6,_0x4f95d0){var _0x47795b=function(_0x27a7fb){while(--_0x27a7fb){_0x4c0de6['push'](_0x4c0de6['shift']());}};_0x47795b(++_0x4f95d0);}(_0xba5a,0x1d0));var _0xaba5=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xba5a[_0x4a9beb];return _0x2d4c58;};'use strict';var _=require('lodash');var util=require(_0xaba5('0x0'));var moment=require(_0xaba5('0x1'));var BPromise=require(_0xaba5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaba5('0x3'))['db'];var utils=require(_0xaba5('0x4'));var logger=require(_0xaba5('0x5'))(_0xaba5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xaba5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e6b46,_0x2ef868,_0x1dba58){return new BPromise(function(_0x3772a2,_0x45f5ea){return client[_0xaba5('0x8')](_0x5e6b46,_0x1dba58)['then'](function(_0x3be776){logger[_0xaba5('0x9')](_0xaba5('0xa'),_0x2ef868,_0xaba5('0xb'));logger[_0xaba5('0xc')](_0xaba5('0xd'),_0x2ef868,_0xaba5('0xb'),JSON[_0xaba5('0xe')](_0x3be776));if(_0x3be776['error']){if(_0x3be776['error'][_0xaba5('0xf')]===0x1f4){logger['error'](_0xaba5('0xa'),_0x2ef868,_0x3be776['error']['message']);return _0x45f5ea(_0x3be776[_0xaba5('0x10')][_0xaba5('0x11')]);}logger[_0xaba5('0x10')](_0xaba5('0xa'),_0x2ef868,_0x3be776[_0xaba5('0x10')][_0xaba5('0x11')]);return _0x3772a2(_0x3be776[_0xaba5('0x10')]['message']);}else{logger['info'](_0xaba5('0xa'),_0x2ef868,_0xaba5('0xb'));_0x3772a2(_0x3be776[_0xaba5('0x12')][_0xaba5('0x11')]);}})[_0xaba5('0x13')](function(_0x53ec3c){logger[_0xaba5('0x10')]('CloudProvider,\x20%s,\x20%s',_0x2ef868,_0x53ec3c);_0x45f5ea(_0x53ec3c);});});} \ No newline at end of file +var _0xb2af=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb2af,0xd2));var _0xfb2a=function(_0x53b70f,_0x2f4571){_0x53b70f=_0x53b70f-0x0;var _0x169483=_0xb2af[_0x53b70f];return _0x169483;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var moment=require(_0xfb2a('0x2'));var BPromise=require(_0xfb2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb2a('0x4'));var db=require(_0xfb2a('0x5'))['db'];var utils=require(_0xfb2a('0x6'));var logger=require(_0xfb2a('0x7'))(_0xfb2a('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb2a('0x9'));var client=jayson[_0xfb2a('0xa')][_0xfb2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55cf25,_0x715404,_0x3e20de){return new BPromise(function(_0x1f3315,_0x55bb4e){return client[_0xfb2a('0xc')](_0x55cf25,_0x3e20de)[_0xfb2a('0xd')](function(_0x3d3333){logger[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));logger[_0xfb2a('0x11')](_0xfb2a('0x12'),_0x715404,_0xfb2a('0x10'),JSON[_0xfb2a('0x13')](_0x3d3333));if(_0x3d3333[_0xfb2a('0x14')]){if(_0x3d3333[_0xfb2a('0x14')]['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x715404,_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);return _0x55bb4e(_0x3d3333[_0xfb2a('0x14')][_0xfb2a('0x15')]);}logger['error'](_0xfb2a('0xf'),_0x715404,_0x3d3333['error']['message']);return _0x1f3315(_0x3d3333[_0xfb2a('0x14')]['message']);}else{logger['info'](_0xfb2a('0xf'),_0x715404,_0xfb2a('0x10'));_0x1f3315(_0x3d3333[_0xfb2a('0x16')][_0xfb2a('0x15')]);}})[_0xfb2a('0x17')](function(_0xc85abf){logger[_0xfb2a('0x14')](_0xfb2a('0xf'),_0x715404,_0xc85abf);_0x55bb4e(_0xc85abf);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f07556e..1523ff3 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x3c9ca5,_0x25cbbf){var _0x515ebe=function(_0x2e3b18){while(--_0x2e3b18){_0x3c9ca5['push'](_0x3c9ca5['shift']());}};_0x515ebe(++_0x25cbbf);}(_0xadb5,0xad));var _0x5adb=function(_0x493c72,_0x2018d6){_0x493c72=_0x493c72-0x0;var _0x1924aa=_0xadb5[_0x493c72];return _0x1924aa;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x5f2f,0x73));var _0xf5f2=function(_0xa44713,_0x785a44){_0xa44713=_0xa44713-0x0;var _0x214686=_0x5f2f[_0xa44713];return _0x214686;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7240263..fd87609 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 _0xba4d=['STRING','name','sequelize'];(function(_0x1012a0,_0x52bc09){var _0xf439d1=function(_0x33c572){while(--_0x33c572){_0x1012a0['push'](_0x1012a0['shift']());}};_0xf439d1(++_0x52bc09);}(_0xba4d,0x15b));var _0xdba4=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xba4d[_0x555b2f];return _0x81c0a6;};'use strict';var Sequelize=require(_0xdba4('0x0'));module['exports']={'name':{'type':Sequelize[_0xdba4('0x1')],'unique':_0xdba4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xdba4('0x1')]},'website':{'type':Sequelize[_0xdba4('0x1')]},'phone':{'type':Sequelize[_0xdba4('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xdba4('0x1')]},'postalCode':{'type':Sequelize[_0xdba4('0x1')]},'city':{'type':Sequelize[_0xdba4('0x1')]},'country':{'type':Sequelize[_0xdba4('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xdba4('0x1')]},'sCity':{'type':Sequelize[_0xdba4('0x1')]},'sCountry':{'type':Sequelize[_0xdba4('0x1')]},'description':{'type':Sequelize[_0xdba4('0x1')]}}; \ No newline at end of file +var _0x08dc=['STRING','name','sequelize'];(function(_0x5566bc,_0x2dcdb4){var _0x4cca9a=function(_0x113225){while(--_0x113225){_0x5566bc['push'](_0x5566bc['shift']());}};_0x4cca9a(++_0x2dcdb4);}(_0x08dc,0x1e8));var _0xc08d=function(_0x1632a9,_0x36f4a3){_0x1632a9=_0x1632a9-0x0;var _0x33ddf1=_0x08dc[_0x1632a9];return _0x33ddf1;};'use strict';var Sequelize=require(_0xc08d('0x0'));module['exports']={'name':{'type':Sequelize[_0xc08d('0x1')],'unique':_0xc08d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc08d('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc08d('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xc08d('0x1')]},'type':{'type':Sequelize[_0xc08d('0x1')]},'street':{'type':Sequelize[_0xc08d('0x1')]},'postalCode':{'type':Sequelize[_0xc08d('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc08d('0x1')]},'email':{'type':Sequelize[_0xc08d('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xc08d('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xc08d('0x1')]},'sCountry':{'type':Sequelize['STRING']},'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 1925dd6..d090bb6 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 _0x1ccb=['stack','name','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','merge','where','map','filter','options','count','rows','catch','params','rawAttributes','length','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','omit','ids','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','then','destroy','Companies','UserProfileResource','error'];(function(_0x4548ca,_0x4b9074){var _0x45f913=function(_0x16dd4d){while(--_0x16dd4d){_0x4548ca['push'](_0x4548ca['shift']());}};_0x45f913(++_0x4b9074);}(_0x1ccb,0x178));var _0xb1cc=function(_0xf8408d,_0x2c374c){_0xf8408d=_0xf8408d-0x0;var _0x4d0fa2=_0x1ccb[_0xf8408d];return _0x4d0fa2;};'use strict';var emlformat=require(_0xb1cc('0x0'));var rimraf=require(_0xb1cc('0x1'));var zipdir=require(_0xb1cc('0x2'));var jsonpatch=require(_0xb1cc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb1cc('0x4'));var util=require(_0xb1cc('0x5'));var path=require('path');var sox=require(_0xb1cc('0x6'));var csv=require(_0xb1cc('0x7'));var ejs=require(_0xb1cc('0x8'));var fs=require('fs');var fs_extra=require(_0xb1cc('0x9'));var _=require(_0xb1cc('0xa'));var squel=require(_0xb1cc('0xb'));var crypto=require('crypto');var jsforce=require(_0xb1cc('0xc'));var deskjs=require(_0xb1cc('0xd'));var toCsv=require(_0xb1cc('0x7'));var querystring=require(_0xb1cc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb1cc('0xf'));var as=require(_0xb1cc('0x10'));var hardwareService=require(_0xb1cc('0x11'));var logger=require(_0xb1cc('0x12'))(_0xb1cc('0x13'));var utils=require(_0xb1cc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb1cc('0x15'));var db=require(_0xb1cc('0x16'))['db'];function respondWithStatusCode(_0x4e3dde,_0x304b65){_0x304b65=_0x304b65||0xcc;return function(_0x946516){if(_0x946516){return _0x4e3dde[_0xb1cc('0x17')](_0x304b65);}return _0x4e3dde[_0xb1cc('0x18')](_0x304b65)[_0xb1cc('0x19')]();};}function respondWithResult(_0x16eaf9,_0x206e98){_0x206e98=_0x206e98||0xc8;return function(_0x3b4aa9){if(_0x3b4aa9){return _0x16eaf9[_0xb1cc('0x18')](_0x206e98)['json'](_0x3b4aa9);}};}function respondWithFilteredResult(_0x4aab54,_0x15e5d8){return function(_0x25e89e){if(_0x25e89e){var _0x30bac9=typeof _0x15e5d8['offset']===_0xb1cc('0x1a')&&typeof _0x15e5d8[_0xb1cc('0x1b')]==='undefined';var _0x11011d=_0x25e89e['count'];var _0x5e39a4=_0x30bac9?0x0:_0x15e5d8[_0xb1cc('0x1c')];var _0xfd21fc=_0x30bac9?_0x25e89e['count']:_0x15e5d8[_0xb1cc('0x1c')]+_0x15e5d8[_0xb1cc('0x1b')];var _0x1a3f12;if(_0xfd21fc>=_0x11011d){_0xfd21fc=_0x11011d;_0x1a3f12=0xc8;}else{_0x1a3f12=0xce;}_0x4aab54[_0xb1cc('0x18')](_0x1a3f12);return _0x4aab54[_0xb1cc('0x1d')](_0xb1cc('0x1e'),_0x5e39a4+'-'+_0xfd21fc+'/'+_0x11011d)[_0xb1cc('0x1f')](_0x25e89e);}return null;};}function patchUpdates(_0x215f0b){return function(_0x3aa055){try{jsonpatch[_0xb1cc('0x20')](_0x3aa055,_0x215f0b,!![]);}catch(_0x421bdd){return BPromise[_0xb1cc('0x21')](_0x421bdd);}return _0x3aa055['save']();};}function saveUpdates(_0x30a2b7,_0x50d1f2){return function(_0x472bda){if(_0x472bda){return _0x472bda['update'](_0x30a2b7)[_0xb1cc('0x22')](function(_0x2f43e0){return _0x2f43e0;});}return null;};}function removeEntity(_0x4a3e38,_0x57e970){return function(_0x1c25f1){if(_0x1c25f1){return _0x1c25f1[_0xb1cc('0x23')]()[_0xb1cc('0x22')](function(){var _0xae0760=_0x1c25f1['get']({'plain':!![]});var _0x3ea486=_0xb1cc('0x24');return db[_0xb1cc('0x25')][_0xb1cc('0x23')]({'where':{'type':_0x3ea486,'resourceId':_0xae0760['id']}})[_0xb1cc('0x22')](function(){return _0x1c25f1;});})[_0xb1cc('0x22')](function(){_0x4a3e38[_0xb1cc('0x18')](0xcc)[_0xb1cc('0x19')]();});}};}function handleEntityNotFound(_0x4c78a4,_0x396fc2){return function(_0x248411){if(!_0x248411){_0x4c78a4[_0xb1cc('0x17')](0x194);}return _0x248411;};}function handleError(_0x54caf2,_0x1d54ed){_0x1d54ed=_0x1d54ed||0x1f4;return function(_0x811083){logger[_0xb1cc('0x26')](_0x811083[_0xb1cc('0x27')]);if(_0x811083['name']){delete _0x811083[_0xb1cc('0x28')];}_0x54caf2[_0xb1cc('0x18')](_0x1d54ed)['send'](_0x811083);};}exports[_0xb1cc('0x29')]=function(_0x3feb1c,_0x5c9b06){var _0x176655={},_0x3f095f={},_0x1c4bb7={'count':0x0,'rows':[]};return db[_0xb1cc('0x2a')][_0xb1cc('0x2b')]()[_0xb1cc('0x22')](function(_0x5079d8){_0x3f095f[_0xb1cc('0x2c')]=_[_0xb1cc('0x2d')](_0x5079d8);_0x3f095f[_0xb1cc('0x2e')]=_[_0xb1cc('0x2d')](_0x3feb1c['query']);_0x3f095f[_0xb1cc('0x2f')]=_['intersection'](_0x3f095f[_0xb1cc('0x2c')],_0x3f095f[_0xb1cc('0x2e')]);_0x176655[_0xb1cc('0x30')]=_[_0xb1cc('0x31')](_0x3f095f[_0xb1cc('0x2c')],qs[_0xb1cc('0x32')](_0x3feb1c[_0xb1cc('0x2e')][_0xb1cc('0x32')]));_0x176655[_0xb1cc('0x30')]=_0x176655['attributes']['length']?_0x176655[_0xb1cc('0x30')]:_0x3f095f[_0xb1cc('0x2c')];if(!_0x3feb1c[_0xb1cc('0x2e')][_0xb1cc('0x33')](_0xb1cc('0x34'))){_0x176655[_0xb1cc('0x1b')]=qs['limit'](_0x3feb1c['query'][_0xb1cc('0x1b')]);_0x176655[_0xb1cc('0x1c')]=qs[_0xb1cc('0x1c')](_0x3feb1c[_0xb1cc('0x2e')]['offset']);}_0x176655[_0xb1cc('0x35')]=qs[_0xb1cc('0x36')](_0x3feb1c['query'][_0xb1cc('0x36')]);_0x176655['where']=qs[_0xb1cc('0x2f')](_['pick'](_0x3feb1c[_0xb1cc('0x2e')],_0x3f095f[_0xb1cc('0x2f')]),_0x5079d8);if(_0x3feb1c[_0xb1cc('0x2e')]['filter']){_0x176655['where']=_[_0xb1cc('0x37')](_0x176655[_0xb1cc('0x38')],{'$or':_[_0xb1cc('0x39')](_0x176655[_0xb1cc('0x30')],function(_0x420a6b){var _0x377def={};_0x377def[_0x420a6b]={'$like':'%'+_0x3feb1c[_0xb1cc('0x2e')][_0xb1cc('0x3a')]+'%'};return _0x377def;})});}_0x176655=_['merge']({},_0x176655,_0x3feb1c[_0xb1cc('0x3b')]);var _0x4f8157={'where':_0x176655['where']};return db[_0xb1cc('0x2a')]['count'](_0x4f8157)['then'](function(_0x157f14){_0x1c4bb7[_0xb1cc('0x3c')]=_0x157f14;if(_0x3feb1c[_0xb1cc('0x2e')]['includeAll']){_0x176655['include']=[{'all':!![]}];}return db[_0xb1cc('0x2a')]['findAll'](_0x176655);})[_0xb1cc('0x22')](function(_0x1807eb){_0x1c4bb7[_0xb1cc('0x3d')]=_0x1807eb;return _0x1c4bb7;})['then'](respondWithFilteredResult(_0x5c9b06,_0x176655))[_0xb1cc('0x3e')](handleError(_0x5c9b06,null));})[_0xb1cc('0x3e')](handleError(_0x5c9b06,null));};exports['show']=function(_0x14f938,_0x254f3c){var _0x1b87f6={'raw':![],'where':{'id':_0x14f938[_0xb1cc('0x3f')]['id']}},_0x29783e={};_0x29783e[_0xb1cc('0x2c')]=_['keys'](db[_0xb1cc('0x2a')][_0xb1cc('0x40')]);_0x29783e[_0xb1cc('0x2e')]=_['keys'](_0x14f938[_0xb1cc('0x2e')]);_0x29783e[_0xb1cc('0x2f')]=_[_0xb1cc('0x31')](_0x29783e[_0xb1cc('0x2c')],_0x29783e['query']);_0x1b87f6[_0xb1cc('0x30')]=_['intersection'](_0x29783e['model'],qs[_0xb1cc('0x32')](_0x14f938['query'][_0xb1cc('0x32')]));_0x1b87f6[_0xb1cc('0x30')]=_0x1b87f6[_0xb1cc('0x30')][_0xb1cc('0x41')]?_0x1b87f6['attributes']:_0x29783e[_0xb1cc('0x2c')];if(_0x14f938[_0xb1cc('0x2e')][_0xb1cc('0x42')]){_0x1b87f6[_0xb1cc('0x43')]=[{'all':!![]}];}_0x1b87f6=_[_0xb1cc('0x37')]({},_0x1b87f6,_0x14f938[_0xb1cc('0x3b')]);return db[_0xb1cc('0x2a')][_0xb1cc('0x44')](_0x1b87f6)[_0xb1cc('0x22')](handleEntityNotFound(_0x254f3c,null))['then'](respondWithResult(_0x254f3c,null))[_0xb1cc('0x3e')](handleError(_0x254f3c,null));};exports[_0xb1cc('0x45')]=function(_0x2ace43,_0x5d8a66){return db['CmCompany'][_0xb1cc('0x45')](_0x2ace43[_0xb1cc('0x46')],{})[_0xb1cc('0x22')](function(_0x2faa1e){var _0x2d4c84=_0x2ace43[_0xb1cc('0x47')][_0xb1cc('0x48')]({'plain':!![]});if(!_0x2d4c84)throw new Error(_0xb1cc('0x49'));if(_0x2d4c84['role']===_0xb1cc('0x47')){var _0x223243=_0x2faa1e[_0xb1cc('0x48')]({'plain':!![]});var _0x4b65b8='Companies';return db['UserProfileSection']['find']({'where':{'name':_0x4b65b8,'userProfileId':_0x2d4c84[_0xb1cc('0x4a')]},'raw':!![]})[_0xb1cc('0x22')](function(_0x52482c){if(_0x52482c&&_0x52482c[_0xb1cc('0x4b')]===0x0){return db[_0xb1cc('0x25')][_0xb1cc('0x45')]({'name':_0x223243[_0xb1cc('0x28')],'resourceId':_0x223243['id'],'type':_0x52482c[_0xb1cc('0x28')],'sectionId':_0x52482c['id']},{})[_0xb1cc('0x22')](function(){return _0x2faa1e;});}else{return _0x2faa1e;}})[_0xb1cc('0x3e')](function(_0x367564){logger[_0xb1cc('0x26')](_0xb1cc('0x4c'),_0x367564);throw _0x367564;});}return _0x2faa1e;})[_0xb1cc('0x22')](respondWithResult(_0x5d8a66,0xc9))[_0xb1cc('0x3e')](handleError(_0x5d8a66,null));};exports[_0xb1cc('0x4d')]=function(_0x278f3e,_0x1631a3){if(_0x278f3e[_0xb1cc('0x46')]['id']){delete _0x278f3e[_0xb1cc('0x46')]['id'];}return db[_0xb1cc('0x2a')][_0xb1cc('0x44')]({'where':{'id':_0x278f3e['params']['id']}})[_0xb1cc('0x22')](handleEntityNotFound(_0x1631a3,null))[_0xb1cc('0x22')](saveUpdates(_0x278f3e[_0xb1cc('0x46')],null))[_0xb1cc('0x22')](respondWithResult(_0x1631a3,null))[_0xb1cc('0x3e')](handleError(_0x1631a3,null));};exports['destroy']=function(_0x1bce8d,_0x1e90a3){return db[_0xb1cc('0x2a')][_0xb1cc('0x44')]({'where':{'id':_0x1bce8d['params']['id']}})[_0xb1cc('0x22')](handleEntityNotFound(_0x1e90a3,null))[_0xb1cc('0x22')](removeEntity(_0x1e90a3,null))[_0xb1cc('0x3e')](handleError(_0x1e90a3,null));};exports[_0xb1cc('0x2b')]=function(_0x3f10e0,_0x23b31a){return db[_0xb1cc('0x2a')][_0xb1cc('0x2b')]()[_0xb1cc('0x22')](respondWithResult(_0x23b31a,null))[_0xb1cc('0x3e')](handleError(_0x23b31a,null));};exports[_0xb1cc('0x4e')]=function(_0x16f994,_0x5d59b,_0x5ba40){return db[_0xb1cc('0x4f')]['find']({'where':{'id':_0x16f994['params']['id']}})['then'](handleEntityNotFound(_0x5d59b,null))[_0xb1cc('0x22')](function(_0x379eb1){if(_0x379eb1){return _0x379eb1[_0xb1cc('0x4e')](_0x16f994[_0xb1cc('0x46')]['ids'],_[_0xb1cc('0x50')](_0x16f994[_0xb1cc('0x46')],[_0xb1cc('0x51'),'id'])||{});}})['then'](respondWithResult(_0x5d59b,null))[_0xb1cc('0x3e')](handleError(_0x5d59b,null));};exports[_0xb1cc('0x52')]=function(_0x13ea9d,_0x5a648f,_0x4f7d4b){var _0x2b986a={};var _0x377104={};var _0x5c5271;var _0x3305c1;return db[_0xb1cc('0x2a')]['findOne']({'where':{'id':_0x13ea9d['params']['id']}})[_0xb1cc('0x22')](handleEntityNotFound(_0x5a648f,null))[_0xb1cc('0x22')](function(_0x325ca2){if(_0x325ca2){_0x5c5271=_0x325ca2;_0x377104['model']=_[_0xb1cc('0x2d')](db[_0xb1cc('0x4f')][_0xb1cc('0x40')]);_0x377104[_0xb1cc('0x2e')]=_[_0xb1cc('0x2d')](_0x13ea9d[_0xb1cc('0x2e')]);_0x377104['filters']=_[_0xb1cc('0x31')](_0x377104[_0xb1cc('0x2c')],_0x377104['query']);_0x2b986a[_0xb1cc('0x30')]=_[_0xb1cc('0x31')](_0x377104[_0xb1cc('0x2c')],qs[_0xb1cc('0x32')](_0x13ea9d[_0xb1cc('0x2e')][_0xb1cc('0x32')]));_0x2b986a[_0xb1cc('0x30')]=_0x2b986a['attributes'][_0xb1cc('0x41')]?_0x2b986a[_0xb1cc('0x30')]:_0x377104[_0xb1cc('0x2c')];_0x2b986a[_0xb1cc('0x35')]=qs[_0xb1cc('0x36')](_0x13ea9d['query'][_0xb1cc('0x36')]);_0x2b986a['where']=qs[_0xb1cc('0x2f')](_['pick'](_0x13ea9d[_0xb1cc('0x2e')],_0x377104[_0xb1cc('0x2f')]));if(_0x13ea9d['query'][_0xb1cc('0x3a')]){_0x2b986a['where']=_[_0xb1cc('0x37')](_0x2b986a['where'],{'$or':_[_0xb1cc('0x39')](_0x2b986a[_0xb1cc('0x30')],function(_0x34f797){var _0xab4d88={};_0xab4d88[_0x34f797]={'$like':'%'+_0x13ea9d['query'][_0xb1cc('0x3a')]+'%'};return _0xab4d88;})});}_0x2b986a=_[_0xb1cc('0x37')]({},_0x2b986a,_0x13ea9d['options']);return _0x5c5271[_0xb1cc('0x52')](_0x2b986a);}})['then'](function(_0x5bd85d){if(_0x5bd85d){_0x3305c1=_0x5bd85d[_0xb1cc('0x41')];if(!_0x13ea9d[_0xb1cc('0x2e')][_0xb1cc('0x33')](_0xb1cc('0x34'))){_0x2b986a[_0xb1cc('0x1b')]=qs[_0xb1cc('0x1b')](_0x13ea9d[_0xb1cc('0x2e')][_0xb1cc('0x1b')]);_0x2b986a[_0xb1cc('0x1c')]=qs['offset'](_0x13ea9d['query'][_0xb1cc('0x1c')]);}return _0x5c5271['getContacts'](_0x2b986a);}})['then'](function(_0x42cef8){if(_0x42cef8){return _0x42cef8?{'count':_0x3305c1,'rows':_0x42cef8}:null;}})[_0xb1cc('0x22')](respondWithResult(_0x5a648f,null))[_0xb1cc('0x3e')](handleError(_0x5a648f,null));}; \ No newline at end of file +var _0x3779=['index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','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','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','then','UserProfileResource','destroy','sendStatus','stack','name','send'];(function(_0x5eef07,_0x2edb41){var _0x458e15=function(_0xabd3d3){while(--_0xabd3d3){_0x5eef07['push'](_0x5eef07['shift']());}};_0x458e15(++_0x2edb41);}(_0x3779,0x127));var _0x9377=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x3779[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9377('0x0'));var zipdir=require(_0x9377('0x1'));var jsonpatch=require(_0x9377('0x2'));var rp=require(_0x9377('0x3'));var moment=require('moment');var BPromise=require(_0x9377('0x4'));var Mustache=require(_0x9377('0x5'));var util=require('util');var path=require(_0x9377('0x6'));var sox=require('sox');var csv=require(_0x9377('0x7'));var ejs=require(_0x9377('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9377('0x9'));var squel=require(_0x9377('0xa'));var crypto=require(_0x9377('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9377('0xc'));var toCsv=require(_0x9377('0x7'));var querystring=require('querystring');var Papa=require(_0x9377('0xd'));var Redis=require(_0x9377('0xe'));var authService=require(_0x9377('0xf'));var qs=require(_0x9377('0x10'));var as=require(_0x9377('0x11'));var hardwareService=require(_0x9377('0x12'));var logger=require(_0x9377('0x13'))(_0x9377('0x14'));var utils=require(_0x9377('0x15'));var config=require(_0x9377('0x16'));var licenseUtil=require(_0x9377('0x17'));var db=require(_0x9377('0x18'))['db'];function respondWithStatusCode(_0x2cde9f,_0x83d310){_0x83d310=_0x83d310||0xcc;return function(_0x2df25a){if(_0x2df25a){return _0x2cde9f['sendStatus'](_0x83d310);}return _0x2cde9f['status'](_0x83d310)[_0x9377('0x19')]();};}function respondWithResult(_0x1759bb,_0x48f6fa){_0x48f6fa=_0x48f6fa||0xc8;return function(_0x161953){if(_0x161953){return _0x1759bb[_0x9377('0x1a')](_0x48f6fa)[_0x9377('0x1b')](_0x161953);}};}function respondWithFilteredResult(_0x407452,_0xcf80b5){return function(_0x4ee962){if(_0x4ee962){var _0x5b83ba=typeof _0xcf80b5[_0x9377('0x1c')]===_0x9377('0x1d')&&typeof _0xcf80b5[_0x9377('0x1e')]==='undefined';var _0x680e9f=_0x4ee962['count'];var _0x5e89a4=_0x5b83ba?0x0:_0xcf80b5[_0x9377('0x1c')];var _0x2901fb=_0x5b83ba?_0x4ee962[_0x9377('0x1f')]:_0xcf80b5['offset']+_0xcf80b5[_0x9377('0x1e')];var _0x2ea54a;if(_0x2901fb>=_0x680e9f){_0x2901fb=_0x680e9f;_0x2ea54a=0xc8;}else{_0x2ea54a=0xce;}_0x407452[_0x9377('0x1a')](_0x2ea54a);return _0x407452['set'](_0x9377('0x20'),_0x5e89a4+'-'+_0x2901fb+'/'+_0x680e9f)[_0x9377('0x1b')](_0x4ee962);}return null;};}function patchUpdates(_0x4c8b7a){return function(_0x317a77){try{jsonpatch[_0x9377('0x21')](_0x317a77,_0x4c8b7a,!![]);}catch(_0x5c22d9){return BPromise['reject'](_0x5c22d9);}return _0x317a77['save']();};}function saveUpdates(_0x1a5963,_0x3dfd7a){return function(_0x4389d5){if(_0x4389d5){return _0x4389d5['update'](_0x1a5963)[_0x9377('0x22')](function(_0x19ce3f){return _0x19ce3f;});}return null;};}function removeEntity(_0x421a1f,_0x3e7507){return function(_0x26aa60){if(_0x26aa60){return _0x26aa60['destroy']()[_0x9377('0x22')](function(){var _0xac2c1d=_0x26aa60['get']({'plain':!![]});var _0x29ef4e='Companies';return db[_0x9377('0x23')][_0x9377('0x24')]({'where':{'type':_0x29ef4e,'resourceId':_0xac2c1d['id']}})[_0x9377('0x22')](function(){return _0x26aa60;});})['then'](function(){_0x421a1f[_0x9377('0x1a')](0xcc)[_0x9377('0x19')]();});}};}function handleEntityNotFound(_0x56b4e6,_0x369af6){return function(_0x5f5a64){if(!_0x5f5a64){_0x56b4e6[_0x9377('0x25')](0x194);}return _0x5f5a64;};}function handleError(_0x5d01eb,_0x5331ee){_0x5331ee=_0x5331ee||0x1f4;return function(_0x205f88){logger['error'](_0x205f88[_0x9377('0x26')]);if(_0x205f88[_0x9377('0x27')]){delete _0x205f88['name'];}_0x5d01eb[_0x9377('0x1a')](_0x5331ee)[_0x9377('0x28')](_0x205f88);};}exports[_0x9377('0x29')]=function(_0x47005c,_0x13703d){var _0x1b8fcd={},_0x411616={},_0x44f1cc={'count':0x0,'rows':[]};return db[_0x9377('0x2a')][_0x9377('0x2b')]()[_0x9377('0x22')](function(_0x19a6b8){_0x411616[_0x9377('0x2c')]=_[_0x9377('0x2d')](_0x19a6b8);_0x411616[_0x9377('0x2e')]=_[_0x9377('0x2d')](_0x47005c['query']);_0x411616[_0x9377('0x2f')]=_[_0x9377('0x30')](_0x411616[_0x9377('0x2c')],_0x411616[_0x9377('0x2e')]);_0x1b8fcd[_0x9377('0x31')]=_[_0x9377('0x30')](_0x411616[_0x9377('0x2c')],qs[_0x9377('0x32')](_0x47005c[_0x9377('0x2e')][_0x9377('0x32')]));_0x1b8fcd[_0x9377('0x31')]=_0x1b8fcd[_0x9377('0x31')][_0x9377('0x33')]?_0x1b8fcd[_0x9377('0x31')]:_0x411616[_0x9377('0x2c')];if(!_0x47005c[_0x9377('0x2e')][_0x9377('0x34')](_0x9377('0x35'))){_0x1b8fcd[_0x9377('0x1e')]=qs['limit'](_0x47005c[_0x9377('0x2e')][_0x9377('0x1e')]);_0x1b8fcd[_0x9377('0x1c')]=qs['offset'](_0x47005c[_0x9377('0x2e')][_0x9377('0x1c')]);}_0x1b8fcd[_0x9377('0x36')]=qs[_0x9377('0x37')](_0x47005c[_0x9377('0x2e')][_0x9377('0x37')]);_0x1b8fcd[_0x9377('0x38')]=qs[_0x9377('0x2f')](_[_0x9377('0x39')](_0x47005c[_0x9377('0x2e')],_0x411616[_0x9377('0x2f')]),_0x19a6b8);if(_0x47005c['query'][_0x9377('0x3a')]){_0x1b8fcd[_0x9377('0x38')]=_['merge'](_0x1b8fcd[_0x9377('0x38')],{'$or':_[_0x9377('0x3b')](_0x1b8fcd[_0x9377('0x31')],function(_0x432654){var _0x321fae={};_0x321fae[_0x432654]={'$like':'%'+_0x47005c['query']['filter']+'%'};return _0x321fae;})});}_0x1b8fcd=_[_0x9377('0x3c')]({},_0x1b8fcd,_0x47005c[_0x9377('0x3d')]);var _0x1c0c3e={'where':_0x1b8fcd[_0x9377('0x38')]};return db['CmCompany'][_0x9377('0x1f')](_0x1c0c3e)['then'](function(_0x452c5d){_0x44f1cc[_0x9377('0x1f')]=_0x452c5d;if(_0x47005c[_0x9377('0x2e')][_0x9377('0x3e')]){_0x1b8fcd['include']=[{'all':!![]}];}return db['CmCompany'][_0x9377('0x3f')](_0x1b8fcd);})['then'](function(_0x677111){_0x44f1cc[_0x9377('0x40')]=_0x677111;return _0x44f1cc;})[_0x9377('0x22')](respondWithFilteredResult(_0x13703d,_0x1b8fcd))[_0x9377('0x41')](handleError(_0x13703d,null));})[_0x9377('0x41')](handleError(_0x13703d,null));};exports['show']=function(_0x46a742,_0x562a8e){var _0x576f8c={'raw':![],'where':{'id':_0x46a742[_0x9377('0x42')]['id']}},_0x470415={};_0x470415[_0x9377('0x2c')]=_[_0x9377('0x2d')](db[_0x9377('0x2a')][_0x9377('0x43')]);_0x470415['query']=_[_0x9377('0x2d')](_0x46a742['query']);_0x470415[_0x9377('0x2f')]=_[_0x9377('0x30')](_0x470415[_0x9377('0x2c')],_0x470415[_0x9377('0x2e')]);_0x576f8c[_0x9377('0x31')]=_[_0x9377('0x30')](_0x470415[_0x9377('0x2c')],qs['fields'](_0x46a742[_0x9377('0x2e')]['fields']));_0x576f8c[_0x9377('0x31')]=_0x576f8c[_0x9377('0x31')][_0x9377('0x33')]?_0x576f8c[_0x9377('0x31')]:_0x470415[_0x9377('0x2c')];if(_0x46a742['query']['includeAll']){_0x576f8c[_0x9377('0x44')]=[{'all':!![]}];}_0x576f8c=_['merge']({},_0x576f8c,_0x46a742[_0x9377('0x3d')]);return db[_0x9377('0x2a')][_0x9377('0x45')](_0x576f8c)[_0x9377('0x22')](handleEntityNotFound(_0x562a8e,null))[_0x9377('0x22')](respondWithResult(_0x562a8e,null))[_0x9377('0x41')](handleError(_0x562a8e,null));};exports[_0x9377('0x46')]=function(_0x40419e,_0x426ff3){return db[_0x9377('0x2a')]['create'](_0x40419e[_0x9377('0x47')],{})[_0x9377('0x22')](function(_0x484bb4){var _0x5c30a6=_0x40419e[_0x9377('0x48')][_0x9377('0x49')]({'plain':!![]});if(!_0x5c30a6)throw new Error(_0x9377('0x4a'));if(_0x5c30a6['role']==='user'){var _0x2b89b4=_0x484bb4['get']({'plain':!![]});var _0x7b5f1e=_0x9377('0x4b');return db[_0x9377('0x4c')][_0x9377('0x45')]({'where':{'name':_0x7b5f1e,'userProfileId':_0x5c30a6[_0x9377('0x4d')]},'raw':!![]})[_0x9377('0x22')](function(_0x24960e){if(_0x24960e&&_0x24960e[_0x9377('0x4e')]===0x0){return db['UserProfileResource'][_0x9377('0x46')]({'name':_0x2b89b4['name'],'resourceId':_0x2b89b4['id'],'type':_0x24960e[_0x9377('0x27')],'sectionId':_0x24960e['id']},{})[_0x9377('0x22')](function(){return _0x484bb4;});}else{return _0x484bb4;}})['catch'](function(_0x19a148){logger['error'](_0x9377('0x4f'),_0x19a148);throw _0x19a148;});}return _0x484bb4;})[_0x9377('0x22')](respondWithResult(_0x426ff3,0xc9))[_0x9377('0x41')](handleError(_0x426ff3,null));};exports[_0x9377('0x50')]=function(_0x4261e9,_0x5ac130){if(_0x4261e9['body']['id']){delete _0x4261e9['body']['id'];}return db[_0x9377('0x2a')][_0x9377('0x45')]({'where':{'id':_0x4261e9[_0x9377('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ac130,null))[_0x9377('0x22')](saveUpdates(_0x4261e9[_0x9377('0x47')],null))[_0x9377('0x22')](respondWithResult(_0x5ac130,null))['catch'](handleError(_0x5ac130,null));};exports['destroy']=function(_0x181997,_0x14b678){return db['CmCompany'][_0x9377('0x45')]({'where':{'id':_0x181997[_0x9377('0x42')]['id']}})['then'](handleEntityNotFound(_0x14b678,null))[_0x9377('0x22')](removeEntity(_0x14b678,null))[_0x9377('0x41')](handleError(_0x14b678,null));};exports[_0x9377('0x2b')]=function(_0x5618b6,_0x5ae406){return db[_0x9377('0x2a')]['describe']()['then'](respondWithResult(_0x5ae406,null))['catch'](handleError(_0x5ae406,null));};exports[_0x9377('0x51')]=function(_0x27f20a,_0xdf353f,_0x2a84c2){return db[_0x9377('0x52')][_0x9377('0x45')]({'where':{'id':_0x27f20a['params']['id']}})[_0x9377('0x22')](handleEntityNotFound(_0xdf353f,null))[_0x9377('0x22')](function(_0x440921){if(_0x440921){return _0x440921['addContacts'](_0x27f20a[_0x9377('0x47')]['ids'],_['omit'](_0x27f20a[_0x9377('0x47')],['ids','id'])||{});}})['then'](respondWithResult(_0xdf353f,null))[_0x9377('0x41')](handleError(_0xdf353f,null));};exports[_0x9377('0x53')]=function(_0x4cd77d,_0x12871c,_0x55c8b2){var _0x24c27d={};var _0x3c05a9={};var _0x178447;var _0x37278e;return db[_0x9377('0x2a')]['findOne']({'where':{'id':_0x4cd77d[_0x9377('0x42')]['id']}})[_0x9377('0x22')](handleEntityNotFound(_0x12871c,null))[_0x9377('0x22')](function(_0x30e89f){if(_0x30e89f){_0x178447=_0x30e89f;_0x3c05a9[_0x9377('0x2c')]=_[_0x9377('0x2d')](db['CmContact']['rawAttributes']);_0x3c05a9[_0x9377('0x2e')]=_['keys'](_0x4cd77d[_0x9377('0x2e')]);_0x3c05a9['filters']=_[_0x9377('0x30')](_0x3c05a9[_0x9377('0x2c')],_0x3c05a9['query']);_0x24c27d[_0x9377('0x31')]=_[_0x9377('0x30')](_0x3c05a9[_0x9377('0x2c')],qs[_0x9377('0x32')](_0x4cd77d[_0x9377('0x2e')]['fields']));_0x24c27d[_0x9377('0x31')]=_0x24c27d[_0x9377('0x31')]['length']?_0x24c27d[_0x9377('0x31')]:_0x3c05a9[_0x9377('0x2c')];_0x24c27d['order']=qs['sort'](_0x4cd77d[_0x9377('0x2e')][_0x9377('0x37')]);_0x24c27d[_0x9377('0x38')]=qs['filters'](_['pick'](_0x4cd77d[_0x9377('0x2e')],_0x3c05a9['filters']));if(_0x4cd77d[_0x9377('0x2e')]['filter']){_0x24c27d[_0x9377('0x38')]=_[_0x9377('0x3c')](_0x24c27d['where'],{'$or':_['map'](_0x24c27d[_0x9377('0x31')],function(_0x349ea8){var _0x119c10={};_0x119c10[_0x349ea8]={'$like':'%'+_0x4cd77d[_0x9377('0x2e')][_0x9377('0x3a')]+'%'};return _0x119c10;})});}_0x24c27d=_[_0x9377('0x3c')]({},_0x24c27d,_0x4cd77d['options']);return _0x178447[_0x9377('0x53')](_0x24c27d);}})[_0x9377('0x22')](function(_0x317974){if(_0x317974){_0x37278e=_0x317974[_0x9377('0x33')];if(!_0x4cd77d[_0x9377('0x2e')][_0x9377('0x34')](_0x9377('0x35'))){_0x24c27d[_0x9377('0x1e')]=qs[_0x9377('0x1e')](_0x4cd77d[_0x9377('0x2e')][_0x9377('0x1e')]);_0x24c27d[_0x9377('0x1c')]=qs[_0x9377('0x1c')](_0x4cd77d['query'][_0x9377('0x1c')]);}return _0x178447[_0x9377('0x53')](_0x24c27d);}})[_0x9377('0x22')](function(_0x35a569){if(_0x35a569){return _0x35a569?{'count':_0x37278e,'rows':_0x35a569}:null;}})[_0x9377('0x22')](respondWithResult(_0x12871c,null))[_0x9377('0x41')](handleError(_0x12871c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 85d968c..54f6498 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 _0x1ae0=['CmCompany','cm_companies','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x1ae0,0x147));var _0x01ae=function(_0x49c5af,_0x29c031){_0x49c5af=_0x49c5af-0x0;var _0x2111e6=_0x1ae0[_0x49c5af];return _0x2111e6;};'use strict';var _=require(_0x01ae('0x0'));var util=require(_0x01ae('0x1'));var logger=require('../../config/logger')(_0x01ae('0x2'));var moment=require('moment');var BPromise=require(_0x01ae('0x3'));var rp=require(_0x01ae('0x4'));var fs=require('fs');var path=require(_0x01ae('0x5'));var rimraf=require(_0x01ae('0x6'));var config=require(_0x01ae('0x7'));var attributes=require(_0x01ae('0x8'));module[_0x01ae('0x9')]=function(_0x221cbe,_0xfce1ea){return _0x221cbe[_0x01ae('0xa')](_0x01ae('0xb'),attributes,{'tableName':_0x01ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3ce=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash'];(function(_0x5f0495,_0xe7a0d2){var _0x120167=function(_0x22e563){while(--_0x22e563){_0x5f0495['push'](_0x5f0495['shift']());}};_0x120167(++_0xe7a0d2);}(_0xf3ce,0x8e));var _0xef3c=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0xf3ce[_0x307086];return _0x699043;};'use strict';var _=require(_0xef3c('0x0'));var util=require('util');var logger=require(_0xef3c('0x1'))(_0xef3c('0x2'));var moment=require(_0xef3c('0x3'));var BPromise=require(_0xef3c('0x4'));var rp=require(_0xef3c('0x5'));var fs=require('fs');var path=require(_0xef3c('0x6'));var rimraf=require(_0xef3c('0x7'));var config=require(_0xef3c('0x8'));var attributes=require(_0xef3c('0x9'));module[_0xef3c('0xa')]=function(_0x453c6c,_0x10967e){return _0x453c6c[_0xef3c('0xb')]('CmCompany',attributes,{'tableName':_0xef3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 1608be1..49c268b 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 _0xce3e=['request','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xce3e,0x129));var _0xece3=function(_0x3e29e5,_0x1cd087){_0x3e29e5=_0x3e29e5-0x0;var _0x37f88a=_0xce3e[_0x3e29e5];return _0x37f88a;};'use strict';var _=require('lodash');var util=require(_0xece3('0x0'));var moment=require(_0xece3('0x1'));var BPromise=require(_0xece3('0x2'));var rs=require(_0xece3('0x3'));var fs=require('fs');var Redis=require(_0xece3('0x4'));var db=require(_0xece3('0x5'))['db'];var utils=require(_0xece3('0x6'));var logger=require(_0xece3('0x7'))(_0xece3('0x8'));var config=require(_0xece3('0x9'));var jayson=require(_0xece3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20cb3a,_0x4668bc,_0x185d2c){return new BPromise(function(_0x51bcf7,_0x2d2111){return client[_0xece3('0xb')](_0x20cb3a,_0x185d2c)[_0xece3('0xc')](function(_0x792283){logger[_0xece3('0xd')](_0xece3('0xe'),_0x4668bc,'request\x20sent');logger['debug'](_0xece3('0xf'),_0x4668bc,'request\x20sent',JSON[_0xece3('0x10')](_0x792283));if(_0x792283['error']){if(_0x792283[_0xece3('0x11')][_0xece3('0x12')]===0x1f4){logger[_0xece3('0x11')](_0xece3('0xe'),_0x4668bc,_0x792283['error'][_0xece3('0x13')]);return _0x2d2111(_0x792283[_0xece3('0x11')][_0xece3('0x13')]);}logger[_0xece3('0x11')](_0xece3('0xe'),_0x4668bc,_0x792283[_0xece3('0x11')][_0xece3('0x13')]);return _0x51bcf7(_0x792283[_0xece3('0x11')][_0xece3('0x13')]);}else{logger[_0xece3('0xd')](_0xece3('0xe'),_0x4668bc,_0xece3('0x14'));_0x51bcf7(_0x792283['result'][_0xece3('0x13')]);}})[_0xece3('0x15')](function(_0x238aa0){logger[_0xece3('0x11')](_0xece3('0xe'),_0x4668bc,_0x238aa0);_0x2d2111(_0x238aa0);});});} \ No newline at end of file +var _0xaba1=['http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x431f87,_0x4b0d8a){var _0x154786=function(_0x4c73d3){while(--_0x4c73d3){_0x431f87['push'](_0x431f87['shift']());}};_0x154786(++_0x4b0d8a);}(_0xaba1,0x175));var _0x1aba=function(_0x360f70,_0x1a0325){_0x360f70=_0x360f70-0x0;var _0x3a628b=_0xaba1[_0x360f70];return _0x3a628b;};'use strict';var _=require(_0x1aba('0x0'));var util=require('util');var moment=require(_0x1aba('0x1'));var BPromise=require(_0x1aba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1aba('0x3'))['db'];var utils=require(_0x1aba('0x4'));var logger=require('../../config/logger')(_0x1aba('0x5'));var config=require('../../config/environment');var jayson=require(_0x1aba('0x6'));var client=jayson['client'][_0x1aba('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x52b628,_0x1935e1,_0x278047){return new BPromise(function(_0x3d664e,_0x3493de){return client[_0x1aba('0x8')](_0x52b628,_0x278047)[_0x1aba('0x9')](function(_0xbcb153){logger['info'](_0x1aba('0xa'),_0x1935e1,_0x1aba('0xb'));logger[_0x1aba('0xc')](_0x1aba('0xd'),_0x1935e1,_0x1aba('0xb'),JSON['stringify'](_0xbcb153));if(_0xbcb153[_0x1aba('0xe')]){if(_0xbcb153[_0x1aba('0xe')][_0x1aba('0xf')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x1935e1,_0xbcb153[_0x1aba('0xe')]['message']);return _0x3493de(_0xbcb153[_0x1aba('0xe')][_0x1aba('0x10')]);}logger[_0x1aba('0xe')](_0x1aba('0xa'),_0x1935e1,_0xbcb153['error'][_0x1aba('0x10')]);return _0x3d664e(_0xbcb153[_0x1aba('0xe')][_0x1aba('0x10')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x1935e1,_0x1aba('0xb'));_0x3d664e(_0xbcb153[_0x1aba('0x11')][_0x1aba('0x10')]);}})[_0x1aba('0x12')](function(_0x16d7db){logger['error'](_0x1aba('0xa'),_0x1935e1,_0x16d7db);_0x3493de(_0x16d7db);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 664a813..1000848 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 _0xbf13=['addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','create'];(function(_0x2d652f,_0x58c104){var _0x670d67=function(_0x455be5){while(--_0x455be5){_0x2d652f['push'](_0x2d652f['shift']());}};_0x670d67(++_0x58c104);}(_0xbf13,0xe2));var _0x3bf1=function(_0x144a67,_0x52c58b){_0x144a67=_0x144a67-0x0;var _0x67d893=_0xbf13[_0x144a67];return _0x67d893;};'use strict';var multer=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var path=require(_0x3bf1('0x2'));var timeout=require(_0x3bf1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3bf1('0x4'));var auth=require(_0x3bf1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3bf1('0x6'));var controller=require(_0x3bf1('0x7'));router[_0x3bf1('0x8')]('/',auth[_0x3bf1('0x9')](),controller[_0x3bf1('0xa')]);router['get']('/describe',auth[_0x3bf1('0x9')](),controller[_0x3bf1('0xb')]);router['get'](_0x3bf1('0xc'),auth[_0x3bf1('0x9')](),controller[_0x3bf1('0xd')]);router[_0x3bf1('0x8')](_0x3bf1('0xe'),auth[_0x3bf1('0x9')](),controller['getContacts']);router['post']('/',auth[_0x3bf1('0x9')](),controller[_0x3bf1('0xf')]);router['post'](_0x3bf1('0xe'),auth['isAuthenticated'](),controller[_0x3bf1('0x10')]);router[_0x3bf1('0x11')](_0x3bf1('0xc'),auth[_0x3bf1('0x9')](),controller[_0x3bf1('0x12')]);router[_0x3bf1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3bf1('0x14')]);module[_0x3bf1('0x15')]=router; \ No newline at end of file +var _0xc962=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','addContacts','put','update','delete','multer'];(function(_0x232ba4,_0x1eb213){var _0x3849b2=function(_0x29cf3a){while(--_0x29cf3a){_0x232ba4['push'](_0x232ba4['shift']());}};_0x3849b2(++_0x1eb213);}(_0xc962,0x6d));var _0x2c96=function(_0x1f44c8,_0x3dfb66){_0x1f44c8=_0x1f44c8-0x0;var _0x2ee697=_0xc962[_0x1f44c8];return _0x2ee697;};'use strict';var multer=require(_0x2c96('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2c96('0x1'));var router=express[_0x2c96('0x2')]();var fs_extra=require(_0x2c96('0x3'));var auth=require(_0x2c96('0x4'));var interaction=require(_0x2c96('0x5'));var config=require(_0x2c96('0x6'));var controller=require(_0x2c96('0x7'));router[_0x2c96('0x8')]('/',auth['isAuthenticated'](),controller[_0x2c96('0x9')]);router[_0x2c96('0x8')](_0x2c96('0xa'),auth[_0x2c96('0xb')](),controller[_0x2c96('0xc')]);router[_0x2c96('0x8')](_0x2c96('0xd'),auth[_0x2c96('0xb')](),controller[_0x2c96('0xe')]);router['get']('/:id/contacts',auth[_0x2c96('0xb')](),controller[_0x2c96('0xf')]);router[_0x2c96('0x10')]('/',auth[_0x2c96('0xb')](),controller[_0x2c96('0x11')]);router[_0x2c96('0x10')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x2c96('0x12')]);router[_0x2c96('0x13')](_0x2c96('0xd'),auth[_0x2c96('0xb')](),controller[_0x2c96('0x14')]);router[_0x2c96('0x15')](_0x2c96('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6cedac0..1fe3220 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 _0x6bf1=['INTEGER','DATE','NOW','exports','STRING','TEXT'];(function(_0x2a0c6c,_0x42f63d){var _0x2300a4=function(_0x47a1b7){while(--_0x47a1b7){_0x2a0c6c['push'](_0x2a0c6c['shift']());}};_0x2300a4(++_0x42f63d);}(_0x6bf1,0x9f));var _0x16bf=function(_0x2bc081,_0x15f9de){_0x2bc081=_0x2bc081-0x0;var _0x8b3bdf=_0x6bf1[_0x2bc081];return _0x8b3bdf;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x16bf('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x16bf('0x1')]},'street':{'type':Sequelize[_0x16bf('0x1')]},'postalCode':{'type':Sequelize[_0x16bf('0x1')]},'city':{'type':Sequelize[_0x16bf('0x1')]},'country':{'type':Sequelize[_0x16bf('0x1')]},'dateOfBirth':{'type':Sequelize[_0x16bf('0x1')]},'description':{'type':Sequelize[_0x16bf('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x16bf('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x16bf('0x1')]},'url':{'type':Sequelize[_0x16bf('0x1')]},'facebook':{'type':Sequelize[_0x16bf('0x1')]},'fb_data':{'type':Sequelize[_0x16bf('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x16bf('0x1')]},'teams':{'type':Sequelize[_0x16bf('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x16bf('0x1')]},'wechat':{'type':Sequelize[_0x16bf('0x1')]},'telegram':{'type':Sequelize[_0x16bf('0x1')]},'UserId':{'type':Sequelize[_0x16bf('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x16bf('0x1')]},'priority':{'type':Sequelize[_0x16bf('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x16bf('0x4')],'defaultValue':Sequelize[_0x16bf('0x5')]},'dialTimezone':{'type':Sequelize[_0x16bf('0x1')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa2a0=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash','sequelize'];(function(_0x147483,_0x4806c4){var _0x483fe5=function(_0x5da942){while(--_0x5da942){_0x147483['push'](_0x147483['shift']());}};_0x483fe5(++_0x4806c4);}(_0xa2a0,0xd6));var _0x0a2a=function(_0x49b2da,_0x4514de){_0x49b2da=_0x49b2da-0x0;var _0x3471d4=_0xa2a0[_0x49b2da];return _0x3471d4;};'use strict';var _=require(_0x0a2a('0x0'));var Sequelize=require(_0x0a2a('0x1'));module[_0x0a2a('0x2')]={'firstName':{'type':Sequelize[_0x0a2a('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0a2a('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x0a2a('0x3')]},'country':{'type':Sequelize[_0x0a2a('0x3')]},'dateOfBirth':{'type':Sequelize[_0x0a2a('0x3')]},'description':{'type':Sequelize[_0x0a2a('0x4')]},'phone':{'type':Sequelize[_0x0a2a('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x0a2a('0x3')]},'facebook':{'type':Sequelize[_0x0a2a('0x3')]},'fb_data':{'type':Sequelize[_0x0a2a('0x3')]},'twitter':{'type':Sequelize[_0x0a2a('0x3')]},'skype':{'type':Sequelize[_0x0a2a('0x3')]},'teams':{'type':Sequelize[_0x0a2a('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x0a2a('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x0a2a('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x0a2a('0x3')]},'priority':{'type':Sequelize[_0x0a2a('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0a2a('0x6')],'defaultValue':Sequelize[_0x0a2a('0x7')]},'dialTimezone':{'type':Sequelize[_0x0a2a('0x3')]},'utcOffset':{'type':Sequelize[_0x0a2a('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0f68e16..68eda05 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 _0x5dbe=['findAll','query','user','CmContact','find','catch','keys','length','startsWith','cf_','columnName','displayName','alias','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','body','from','get','mergeWith','isArray','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','info','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','ListId','findOrCreate','push','contact','all','show','params','Tag','Tags','color','Phones','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','CmCustomField','pickBy','isEmpty','table','setFields','id\x20=\x20?','toParam','text','findOne','model','filters','intersection','fields','attributes','order','sort','pick','merge','filter','options','getTags','hasOwnProperty','setTags','ContactItemType','items','item_types','ItemTypeId','description','phone','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','rawAttributes','nolimit','includeAll','include','rows','getHopperHistories','ContactId','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','createReadStream','meta','import','agent','binding','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','User','fork','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','DESC','findAndCountAll','startCase','Website','Account','closed','disposition','secondDisposition','UserId','key','Owner','browserName','customerIp','deviceModel','osName','ratingType','ratingValue','subject','substatus','threadId','Interaction','flatten','sortBy','value','slice','moment','bluebird','path','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','json','offset','undefined','count','limit','status','set','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','index','describe'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x5dbe,0xe1));var _0xe5db=function(_0x337651,_0x2af690){_0x337651=_0x337651-0x0;var _0x20893c=_0x5dbe[_0x337651];return _0x20893c;};'use strict';var moment=require(_0xe5db('0x0'));var BPromise=require(_0xe5db('0x1'));var util=require('util');var path=require(_0xe5db('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe5db('0x3'));var Papa=require(_0xe5db('0x4'));var Redis=require(_0xe5db('0x5'));var contacts=require(_0xe5db('0x6'));var qs=require(_0xe5db('0x7'));var logger=require(_0xe5db('0x8'))('api');var config=require(_0xe5db('0x9'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xe5db('0xa')],{'host':_0xe5db('0xb'),'port':0x18eb});var socket=require(_0xe5db('0xc'))(new Redis(config[_0xe5db('0xa')]));require('./cmContact.socket')[_0xe5db('0xd')](socket);function respondWithResult(_0xe4d3cc,_0x3ef830){_0x3ef830=_0x3ef830||0xc8;return function(_0x43a032){if(_0x43a032){return _0xe4d3cc['status'](_0x3ef830)[_0xe5db('0xe')](_0x43a032);}};}function respondWithFilteredResult(_0x1c962a,_0x638866){return function(_0x1b68b6){if(_0x1b68b6){var _0x6fa943=typeof _0x638866[_0xe5db('0xf')]==='undefined'&&typeof _0x638866['limit']===_0xe5db('0x10');var _0x49dea2=_0x1b68b6[_0xe5db('0x11')];var _0x2fe0d5=_0x6fa943?0x0:_0x638866[_0xe5db('0xf')];var _0x1dec25=_0x6fa943?_0x1b68b6['count']:_0x638866['offset']+_0x638866[_0xe5db('0x12')];var _0x3a605b;if(_0x1dec25>=_0x49dea2){_0x1dec25=_0x49dea2;_0x3a605b=0xc8;}else{_0x3a605b=0xce;}_0x1c962a[_0xe5db('0x13')](_0x3a605b);return _0x1c962a[_0xe5db('0x14')](_0xe5db('0x15'),_0x2fe0d5+'-'+_0x1dec25+'/'+_0x49dea2)['json'](_0x1b68b6);}return null;};}function saveUpdates(_0x46d2d5){return function(_0x14adff){if(_0x14adff){return _0x14adff[_0xe5db('0x16')](_0x46d2d5)['then'](function(_0x29b029){return _0x29b029;});}return null;};}function removeEntity(_0x3777a4){return function(_0x1b5e06){if(_0x1b5e06){return _0x1b5e06[_0xe5db('0x17')]()[_0xe5db('0x18')](function(){_0x3777a4['status'](0xcc)[_0xe5db('0x19')]();});}};}function handleEntityNotFound(_0x4b455a){return function(_0x113d25){if(!_0x113d25){_0x4b455a[_0xe5db('0x1a')](0x194);}return _0x113d25;};}function handleError(_0x4d4907,_0xd0cf0a){_0xd0cf0a=_0xd0cf0a||0x1f4;return function(_0x58a33d){logger[_0xe5db('0x1b')](_0x58a33d[_0xe5db('0x1c')]);if(_0x58a33d[_0xe5db('0x1d')]){delete _0x58a33d[_0xe5db('0x1d')];}_0x4d4907[_0xe5db('0x13')](_0xd0cf0a)[_0xe5db('0x1e')](_0x58a33d);};}exports[_0xe5db('0x1f')]=function(_0x2c16f8,_0x46252c){var _0x245860={};return contacts[_0xe5db('0x20')]()[_0xe5db('0x18')](function(_0x55a486){_0x245860=qs['getOptions'](_0x55a486,_0x2c16f8);return contacts[_0xe5db('0x21')](_0x2c16f8[_0xe5db('0x22')],_0x2c16f8[_0xe5db('0x23')],_0x245860,_0x55a486);})[_0xe5db('0x18')](respondWithFilteredResult(_0x46252c,_0x245860))['catch'](handleError(_0x46252c,null));};exports[_0xe5db('0x17')]=function(_0x3d0422,_0x51804f){return db[_0xe5db('0x24')][_0xe5db('0x25')]({'where':{'id':_0x3d0422['params']['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x51804f,null))['then'](removeEntity(_0x51804f,null))[_0xe5db('0x26')](handleError(_0x51804f,null));};exports['describe']=function(_0x348980,_0x510b48){return db['CmContact'][_0xe5db('0x20')]()[_0xe5db('0x18')](function(_0x25013c){delete _0x25013c['tags'];for(var _0x4efbe0=0x0;_0x4efbe00x0){return new Promise(function(_0x5b8cba){var _0x4f7df9=[];for(var _0xe8b1db=0x0;_0xe8b1db<_0x2b2c94['length'];_0xe8b1db++){_0x4f7df9[_0xe5db('0x5d')](insertAdditionalPhones(_0x2b2c94[_0xe8b1db][_0xe5db('0x5e')],_0x2b2c94[_0xe8b1db][_0xe5db('0x57')]));}Promise[_0xe5db('0x5f')](_0x4f7df9)[_0xe5db('0x18')](function(){_0x5b8cba(0x1);});})['then'](function(){return{'success':_0x57d4fb,'failure':_0x5aeb68,'duplicates':_0x3a9953};});}else{return{'success':_0x57d4fb,'failure':_0x5aeb68,'duplicates':_0x3a9953};}}})['then'](respondWithResult(_0x141220,0xc9))[_0xe5db('0x26')](handleError(_0x141220,null));};exports[_0xe5db('0x60')]=function(_0x480c3a,_0xc6964a){var _0x3fdf0f;return db[_0xe5db('0x24')][_0xe5db('0x20')]()[_0xe5db('0x18')](function(_0x101efc){return db[_0xe5db('0x24')][_0xe5db('0x25')]({'where':{'id':_0x480c3a[_0xe5db('0x61')]['id']},'include':[{'model':db[_0xe5db('0x62')],'as':_0xe5db('0x63'),'attributes':['id','name',_0xe5db('0x64')],'required':_0x480c3a[_0xe5db('0x22')]['tag']?!![]:![]},{'model':db[_0xe5db('0x46')],'as':_0xe5db('0x65'),'where':{'CmContactId':_0x480c3a['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xe5db('0x66')}]}],'order':[db[_0xe5db('0x67')][_0xe5db('0x68')](_0xe5db('0x69'))],'attributes':_[_0xe5db('0x27')](_0x101efc)});})[_0xe5db('0x18')](function(_0x14842f){if(!_[_0xe5db('0x53')](_0x14842f)){_0x3fdf0f=_0x14842f[_0xe5db('0x34')]({'plain':!![]});var _0x28924a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x14842f&&_0x14842f[_0xe5db('0x5b')]){if(_0x14842f[_0xe5db('0x5b')]){_0x28924a[_0xe5db('0x59')][_0xe5db('0x6a')][_0xe5db('0x5d')]({'ListId':{'$ne':_0x14842f[_0xe5db('0x5b')]}});}}return db['CmCustomField']['findAll'](_0x28924a);}})['then'](function(_0x1c6fcd){if(!_[_0xe5db('0x53')](_0x1c6fcd)){return _[_0xe5db('0x6b')](_0x3fdf0f,_[_0xe5db('0x6c')](_0x1c6fcd,function(_0x529473){return util[_0xe5db('0x6d')](_0xe5db('0x6e'),_0x529473['id']);}));}})[_0xe5db('0x18')](handleEntityNotFound(_0xc6964a,null))['then'](respondWithResult(_0xc6964a,null))[_0xe5db('0x26')](handleError(_0xc6964a,null));};exports[_0xe5db('0x16')]=function(_0x1a7e56,_0x23b68c){var _0x551af5;if(_0x1a7e56['body']['id']){delete _0x1a7e56['body']['id'];}if(!_['isNil'](_0x1a7e56[_0xe5db('0x32')][_0xe5db('0x54')])){var _0x4bfece=_0x1a7e56[_0xe5db('0x32')][_0xe5db('0x54')];if(!_[_0xe5db('0x53')](shared[_0xe5db('0x55')][_0x4bfece]))_0x1a7e56['body']['utcOffset']=shared[_0xe5db('0x55')][_0x4bfece][_0xe5db('0x56')];}return db[_0xe5db('0x24')][_0xe5db('0x25')]({'where':{'id':_0x1a7e56['params']['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x23b68c,null))[_0xe5db('0x18')](saveUpdates(_0x1a7e56[_0xe5db('0x32')],null))[_0xe5db('0x18')](function(_0x49c45f){_0x551af5=_0x49c45f;var _0x551b13={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x49c45f&&_0x49c45f['ListId']){if(_0x49c45f[_0xe5db('0x5b')]){_0x551b13[_0xe5db('0x59')][_0xe5db('0x6a')][_0xe5db('0x5d')]({'ListId':{'$ne':_0x49c45f[_0xe5db('0x5b')]}});}}return db[_0xe5db('0x6f')][_0xe5db('0x21')](_0x551b13);})[_0xe5db('0x18')](function(_0xd6128){if(_0xd6128){return _[_0xe5db('0x6b')](_[_0xe5db('0x70')](_0x1a7e56['body'],function(_0x58aba4,_0x3d1820){return _[_0xe5db('0x29')](_0x3d1820,_0xe5db('0x2a'));}),_[_0xe5db('0x6c')](_0xd6128,function(_0x83a341){return util[_0xe5db('0x6d')](_0xe5db('0x6e'),_0x83a341['id']);}));}})['then'](function(_0x5336b9){if(_0x5336b9&&!_[_0xe5db('0x71')](_0x5336b9)){var _0x3d007e=squel[_0xe5db('0x16')]()[_0xe5db('0x72')]('cm_contacts')[_0xe5db('0x73')](_0x5336b9)[_0xe5db('0x59')](_0xe5db('0x74'),_0x1a7e56['params']['id'])[_0xe5db('0x75')]();return db[_0xe5db('0x67')]['query'](_0x3d007e[_0xe5db('0x76')],{'replacements':_0x3d007e[_0xe5db('0x2f')]});}})[_0xe5db('0x18')](function(){if(_0x1a7e56[_0xe5db('0x32')]['phone']&&_0x551af5){return db[_0xe5db('0x39')][_0xe5db('0x16')]({'phone':_0x1a7e56[_0xe5db('0x32')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x551af5['id']}});}})['then'](function(){return _0x551af5;})[_0xe5db('0x18')](respondWithResult(_0x23b68c,null))['catch'](handleError(_0x23b68c,null));};exports['getTags']=function(_0x36a47a,_0x1c6058){var _0x5754e8={};var _0x42eaaa={};var _0xc1a49b;var _0x5a4606;return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x36a47a[_0xe5db('0x61')]['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x1c6058,null))[_0xe5db('0x18')](function(_0x215932){if(_0x215932){_0xc1a49b=_0x215932;_0x42eaaa[_0xe5db('0x78')]=_[_0xe5db('0x27')](db[_0xe5db('0x62')]['rawAttributes']);_0x42eaaa[_0xe5db('0x22')]=_[_0xe5db('0x27')](_0x36a47a['query']);_0x42eaaa[_0xe5db('0x79')]=_[_0xe5db('0x7a')](_0x42eaaa[_0xe5db('0x78')],_0x42eaaa[_0xe5db('0x22')]);_0x5754e8['attributes']=_[_0xe5db('0x7a')](_0x42eaaa[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x36a47a[_0xe5db('0x22')][_0xe5db('0x7b')]));_0x5754e8['attributes']=_0x5754e8[_0xe5db('0x7c')][_0xe5db('0x28')]?_0x5754e8[_0xe5db('0x7c')]:_0x42eaaa[_0xe5db('0x78')];_0x5754e8[_0xe5db('0x7d')]=qs[_0xe5db('0x7e')](_0x36a47a[_0xe5db('0x22')][_0xe5db('0x7e')]);_0x5754e8[_0xe5db('0x59')]=qs[_0xe5db('0x79')](_[_0xe5db('0x7f')](_0x36a47a[_0xe5db('0x22')],_0x42eaaa[_0xe5db('0x79')]));if(_0x36a47a[_0xe5db('0x22')]['filter']){_0x5754e8[_0xe5db('0x59')]=_[_0xe5db('0x80')](_0x5754e8[_0xe5db('0x59')],{'$or':_['map'](_0x5754e8['attributes'],function(_0x4db90b){var _0x2dfada={};_0x2dfada[_0x4db90b]={'$like':'%'+_0x36a47a['query'][_0xe5db('0x81')]+'%'};return _0x2dfada;})});}_0x5754e8=_['merge']({},_0x5754e8,_0x36a47a[_0xe5db('0x82')]);return _0xc1a49b[_0xe5db('0x83')](_0x5754e8);}})[_0xe5db('0x18')](function(_0x3f054b){if(_0x3f054b){_0x5a4606=_0x3f054b[_0xe5db('0x28')];if(!_0x36a47a[_0xe5db('0x22')][_0xe5db('0x84')]('nolimit')){_0x5754e8[_0xe5db('0x12')]=qs[_0xe5db('0x12')](_0x36a47a[_0xe5db('0x22')][_0xe5db('0x12')]);_0x5754e8[_0xe5db('0xf')]=qs[_0xe5db('0xf')](_0x36a47a[_0xe5db('0x22')][_0xe5db('0xf')]);}return _0xc1a49b[_0xe5db('0x83')](_0x5754e8);}})[_0xe5db('0x18')](function(_0x5c030d){if(_0x5c030d){return _0x5c030d?{'count':_0x5a4606,'rows':_0x5c030d}:null;}})[_0xe5db('0x18')](respondWithResult(_0x1c6058,null))[_0xe5db('0x26')](handleError(_0x1c6058,null));};exports[_0xe5db('0x85')]=function(_0x213625,_0x3891de){if(_0x213625[_0xe5db('0x32')]['id']){delete _0x213625[_0xe5db('0x32')]['id'];}return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x213625['params']['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x3891de,null))[_0xe5db('0x18')](function(_0x8c1985){if(_0x8c1985){return _0x8c1985[_0xe5db('0x85')](_0x213625[_0xe5db('0x32')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3891de,null))[_0xe5db('0x26')](handleError(_0x3891de,null));};exports['setAdditionalPhones']=function(_0x4fc67,_0x18398c){var _0x26d260=[];_0x26d260['push'](addAdditionalPhones(_0x4fc67[_0xe5db('0x32')]));Promise[_0xe5db('0x5f')](_0x26d260)[_0xe5db('0x18')](function(){_0x26d260=[];_0x26d260[_0xe5db('0x5d')](deleteCmHopperPhones(_0x4fc67['body']['id']));_0x26d260[_0xe5db('0x5d')](addCmHopperPhones(_0x4fc67[_0xe5db('0x32')]['id']));Promise['all'](_0x26d260)[_0xe5db('0x18')](function(){return[0x1];})[_0xe5db('0x18')](respondWithResult(_0x18398c,null));});};function addAdditionalPhones(_0x54b5ff){var _0x2b75db;return new Promise(function(_0x457715){return db[_0xe5db('0x46')][_0xe5db('0x17')]({'where':{'CmContactId':_0x54b5ff['id']}})['then'](function(){db[_0xe5db('0x86')]['findAll']({'raw':!![],'attributes':['id','OrderBy']})['then'](function(_0x155756){var _0xfeeeb2=[];for(var _0x3cfe20=0x0;_0x3cfe20<_0x54b5ff[_0xe5db('0x87')][_0xe5db('0x28')];_0x3cfe20++){var _0x2a82a5=_0x54b5ff[_0xe5db('0x88')]?_[_0xe5db('0x53')](_0x54b5ff['item_types'][_0x3cfe20])?'':_0x54b5ff[_0xe5db('0x88')][_0x3cfe20]:_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x89')]?_0x54b5ff[_0xe5db('0x87')][_0x3cfe20]['ItemTypeId']:'';var _0x942ff6=_[_0xe5db('0x53')](_0x54b5ff[_0xe5db('0x87')][_0x3cfe20]['description'])?'':_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x8a')];var _0x62c7e3=_0x2a82a5+':'+_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x8b')]+'§'+_0x942ff6;if(_[_0xe5db('0x53')](_0x2b75db))_0x2b75db=_0x62c7e3;else _0x2b75db+=';'+_0x62c7e3;var _0x327f2f=null;var _0x7f7fd6=null;if(_0x54b5ff[_0xe5db('0x88')]){if(!_[_0xe5db('0x53')](_0x54b5ff[_0xe5db('0x88')][_0x3cfe20])){_0x7f7fd6=_[_0xe5db('0x25')](_0x155756,function(_0x2a2d20){return _0x2a2d20['id']===_0x54b5ff[_0xe5db('0x88')][_0x3cfe20];});if(!_['isNil'](_0x7f7fd6)){_0x327f2f=_0x7f7fd6[_0xe5db('0x8c')];}}}else{if(!_[_0xe5db('0x53')](_0x54b5ff[_0xe5db('0x87')][_0x3cfe20])){_0x7f7fd6=_[_0xe5db('0x25')](_0x155756,function(_0x3af72f){return _0x3af72f['id']===_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x89')];});if(!_[_0xe5db('0x53')](_0x7f7fd6)){_0x327f2f=_0x3cfe20;}}}if(_['isNil'](_0x327f2f)){_0x327f2f=0x64;}_0xfeeeb2[_0xe5db('0x5d')](addAdditionalPhone(_0x54b5ff['id'],_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x8b')],_0x54b5ff[_0xe5db('0x88')]?_[_0xe5db('0x53')](_0x54b5ff['item_types'][_0x3cfe20])?null:_0x54b5ff[_0xe5db('0x88')][_0x3cfe20]:_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x89')]?_0x54b5ff[_0xe5db('0x87')][_0x3cfe20]['ItemTypeId']:null,_0x327f2f,_0x942ff6));}Promise['all'](_0xfeeeb2)[_0xe5db('0x18')](function(){db['CmContact'][_0xe5db('0x16')]({'AdditionalPhones':_0x2b75db},{'where':{'id':_0x54b5ff['id']}})[_0xe5db('0x18')](function(){_0x457715(0x1);});});});});});}function addAdditionalPhone(_0x2f404e,_0x115a0f,_0x2ca7e9,_0x151a41,_0x374337){return db[_0xe5db('0x46')][_0xe5db('0x25')]({'where':{'CmContactId':_0x2f404e,'item':_0x115a0f}})[_0xe5db('0x18')](function(_0x395ca2){if(_0x395ca2)logger[_0xe5db('0x3c')](_0xe5db('0x8d'),_0x395ca2);else{db[_0xe5db('0x46')][_0xe5db('0x3e')]({'CmContactId':_0x2f404e,'item':_0x115a0f,'ItemTypeId':_0x2ca7e9,'OrderBy':_0x151a41,'ItemClass':_0xe5db('0x8e'),'description':_0x374337});}});}function deleteCmHopperPhones(_0x5bb7cd){return new Promise(function(_0xaf9693){return db['CmHopper'][_0xe5db('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5bb7cd}})[_0xe5db('0x18')](function(_0x39645a){db[_0xe5db('0x8f')][_0xe5db('0x17')]({'where':{'CmHopperId':{'$in':_[_0xe5db('0x6c')](_0x39645a,'id')}}});})[_0xe5db('0x18')](function(){_0xaf9693(0x1);});});}function addCmHopperPhones(_0x45edb8){return new Promise(function(_0xb0cb20){return db[_0xe5db('0x39')][_0xe5db('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x45edb8}})[_0xe5db('0x18')](function(_0x50f10b){var _0x1650de=[];_['map'](_0x50f10b,function(_0x76cefb){_0x1650de[_0xe5db('0x5d')](createCmHopperPhone(_0x45edb8,_0x76cefb['id']));});Promise[_0xe5db('0x5f')](_0x1650de)[_0xe5db('0x18')](function(){_0xb0cb20(0x1);});});});}function createCmHopperPhone(_0x568351,_0x4e0c0c){return new Promise(function(_0x5b8698){db[_0xe5db('0x46')]['findAll']({'raw':!![],'attributes':['item',_0xe5db('0x8c')],'where':{'CmContactId':_0x568351,'ItemClass':_0xe5db('0x8e')},'include':[{'model':db[_0xe5db('0x86')],'attributes':['OrderBy'],'as':_0xe5db('0x66')}],'order':[_0xe5db('0x8c'),db[_0xe5db('0x67')]['literal']('`ItemType`.OrderBy')]})['then'](function(_0x3d838b){var _0x2ee31b=0x1;var _0x25dc51=_[_0xe5db('0x6c')](_0x3d838b,function(_0x3d7156){_0x3d7156['CmHopperId']=_0x4e0c0c;_0x3d7156[_0xe5db('0x8b')]=_0x3d7156[_0xe5db('0x90')];_0x3d7156[_0xe5db('0x8c')]=_0x2ee31b;delete _0x3d7156['ItemType.OrderBy'];_0x2ee31b=_0x2ee31b+0x1;return _0x3d7156;});return db[_0xe5db('0x8f')]['bulkCreate'](_0x25dc51,{});})[_0xe5db('0x18')](function(){_0x5b8698(0x1);});});}function insertAdditionalPhones(_0x18135d,_0x4b0970){return new Promise(function(_0x3fda2e){var _0x3cf948=[];for(var _0x18abdf=0x0;_0x18abdf<_0x4b0970[_0xe5db('0x28')];_0x18abdf++){var _0x4d2c96=_0x4b0970[_0x18abdf];_0x3cf948[_0xe5db('0x5d')](parseContactItemType(_0x4d2c96));}Promise[_0xe5db('0x5f')](_0x3cf948)['then'](function(){var _0x50e049={'id':_0x18135d['id'],'items':_0x4b0970};return addAdditionalPhones(_0x50e049)['then'](function(){return addCmHopperPhones(_0x18135d['id']);});})[_0xe5db('0x18')](function(){_0x3fda2e(_0x18135d);});});}function parseContactItemType(_0x58d224){return new Promise(function(_0x2030c0){if(_0x58d224[_0xe5db('0x84')]('ItemTypeId')){_0x2030c0(_0x58d224);}else{return db[_0xe5db('0x86')][_0xe5db('0x25')]({'where':{'name':_0x58d224['ItemType']}})[_0xe5db('0x18')](function(_0x446bbd){if(_[_0xe5db('0x53')](_0x446bbd))_0x58d224[_0xe5db('0x89')]=null;else _0x58d224[_0xe5db('0x89')]=_0x446bbd['id'];_0x2030c0(_0x58d224);});}});}exports[_0xe5db('0x91')]=function(_0x3d4b62,_0x1420a7){return db[_0xe5db('0x46')][_0xe5db('0x21')]({'raw':!![],'where':{'CmContactId':_0x3d4b62[_0xe5db('0x61')]['id'],'ItemClass':_0xe5db('0x8e')},'include':[{'model':db[_0xe5db('0x86')],'as':_0xe5db('0x66')}],'order':[[_0xe5db('0x8c')],[db['sequelize']['literal'](_0xe5db('0x92'))]]})[_0xe5db('0x18')](function(_0x465596){return _0x465596;})[_0xe5db('0x18')](respondWithResult(_0x1420a7,null))[_0xe5db('0x26')](handleError(_0x1420a7,null));};exports[_0xe5db('0x93')]=function(_0x23ce32,_0xd194fe){return db[_0xe5db('0x46')][_0xe5db('0x21')]({'raw':!![],'where':{'CmContactId':_0x23ce32['body'][_0xe5db('0x94')]}})['then'](function(_0x19138f){var _0x569ac5=_[_0xe5db('0x6c')](_0x19138f,function(_0x27bdbc){_0x27bdbc[_0xe5db('0x95')]=_0x23ce32['body'][_0xe5db('0x96')];return _0x27bdbc;});return db[_0xe5db('0x46')][_0xe5db('0x97')](_0x569ac5,{});})[_0xe5db('0x18')](function(){return addCmHopperPhones(_0x23ce32[_0xe5db('0x32')][_0xe5db('0x96')]);})['then'](function(){return['ok'];})[_0xe5db('0x18')](respondWithResult(_0xd194fe,null))[_0xe5db('0x26')](handleError(_0xd194fe,null));};exports[_0xe5db('0x98')]=function(_0x5c6ca4,_0x595484){var _0x2085fe=[];_0x2085fe[_0xe5db('0x5d')](createCmHopperPhone(_0x5c6ca4[_0xe5db('0x32')]['id'],_0x5c6ca4['body']['hopperId']));Promise['all'](_0x2085fe)['then'](function(){return[0x1];})['then'](respondWithResult(_0x595484,null));};exports['getHoppers']=function(_0x1549ef,_0x2a3094){var _0x1c2e2c={'raw':![],'where':{}};var _0x4bfa0c={};var _0x3b3332={'count':0x0,'rows':[]};return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x1549ef[_0xe5db('0x61')]['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x2a3094,null))[_0xe5db('0x18')](function(_0x2804d8){if(_0x2804d8){_0x4bfa0c['model']=_['keys'](db['CmHopper'][_0xe5db('0x99')]);_0x4bfa0c['query']=_['keys'](_0x1549ef[_0xe5db('0x22')]);_0x4bfa0c[_0xe5db('0x79')]=_[_0xe5db('0x7a')](_0x4bfa0c[_0xe5db('0x78')],_0x4bfa0c[_0xe5db('0x22')]);_0x1c2e2c['attributes']=_[_0xe5db('0x7a')](_0x4bfa0c[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x1549ef[_0xe5db('0x22')][_0xe5db('0x7b')]));_0x1c2e2c[_0xe5db('0x7c')]=_0x1c2e2c[_0xe5db('0x7c')][_0xe5db('0x28')]?_0x1c2e2c['attributes']:_0x4bfa0c[_0xe5db('0x78')];if(!_0x1549ef['query'][_0xe5db('0x84')](_0xe5db('0x9a'))){_0x1c2e2c[_0xe5db('0x12')]=qs[_0xe5db('0x12')](_0x1549ef[_0xe5db('0x22')]['limit']);_0x1c2e2c[_0xe5db('0xf')]=qs['offset'](_0x1549ef['query'][_0xe5db('0xf')]);}_0x1c2e2c[_0xe5db('0x7d')]=qs['sort'](_0x1549ef[_0xe5db('0x22')][_0xe5db('0x7e')]);_0x1c2e2c[_0xe5db('0x59')]=qs[_0xe5db('0x79')](_[_0xe5db('0x7f')](_0x1549ef[_0xe5db('0x22')],_0x4bfa0c['filters']));_0x1c2e2c[_0xe5db('0x59')]['ContactId']=_0x2804d8['id'];if(_0x1549ef[_0xe5db('0x22')][_0xe5db('0x81')]){_0x1c2e2c[_0xe5db('0x59')]=_['merge'](_0x1c2e2c['where'],{'$or':_[_0xe5db('0x6c')](_0x1c2e2c[_0xe5db('0x7c')],function(_0x26357b){var _0x2a8bde={};_0x2a8bde[_0x26357b]={'$like':'%'+_0x1549ef[_0xe5db('0x22')][_0xe5db('0x81')]+'%'};return _0x2a8bde;})});}_0x1c2e2c=_[_0xe5db('0x80')]({},_0x1c2e2c,_0x1549ef['options']);return db[_0xe5db('0x39')][_0xe5db('0x11')]({'where':_0x1c2e2c['where']})[_0xe5db('0x18')](function(_0x137204){_0x3b3332[_0xe5db('0x11')]=_0x137204;if(_0x1549ef[_0xe5db('0x22')][_0xe5db('0x9b')]){_0x1c2e2c[_0xe5db('0x9c')]=[{'all':!![]}];}return db[_0xe5db('0x39')][_0xe5db('0x21')](_0x1c2e2c);})['then'](function(_0x181a0b){_0x3b3332[_0xe5db('0x9d')]=_0x181a0b;return _0x3b3332;});}})[_0xe5db('0x18')](respondWithFilteredResult(_0x2a3094,_0x1c2e2c))[_0xe5db('0x26')](handleError(_0x2a3094,null));};exports[_0xe5db('0x9e')]=function(_0x4d39e6,_0x5ae83e){var _0x49c1db={'raw':!![],'where':{}};var _0x549890={};var _0x54a850={'count':0x0,'rows':[]};return db['CmContact'][_0xe5db('0x77')]({'where':{'id':_0x4d39e6['params']['id']}})['then'](handleEntityNotFound(_0x5ae83e,null))[_0xe5db('0x18')](function(_0x23ef7f){if(_0x23ef7f){_0x549890[_0xe5db('0x78')]=_[_0xe5db('0x27')](db['CmHopperHistory'][_0xe5db('0x99')]);_0x549890[_0xe5db('0x22')]=_[_0xe5db('0x27')](_0x4d39e6[_0xe5db('0x22')]);_0x549890[_0xe5db('0x79')]=_[_0xe5db('0x7a')](_0x549890[_0xe5db('0x78')],_0x549890[_0xe5db('0x22')]);_0x49c1db['attributes']=_['intersection'](_0x549890[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x4d39e6[_0xe5db('0x22')][_0xe5db('0x7b')]));_0x49c1db[_0xe5db('0x7c')]=_0x49c1db['attributes']['length']?_0x49c1db[_0xe5db('0x7c')]:_0x549890['model'];if(!_0x4d39e6[_0xe5db('0x22')]['hasOwnProperty'](_0xe5db('0x9a'))){_0x49c1db['limit']=qs['limit'](_0x4d39e6[_0xe5db('0x22')][_0xe5db('0x12')]);_0x49c1db[_0xe5db('0xf')]=qs[_0xe5db('0xf')](_0x4d39e6[_0xe5db('0x22')][_0xe5db('0xf')]);}_0x49c1db[_0xe5db('0x7d')]=qs[_0xe5db('0x7e')](_0x4d39e6['query'][_0xe5db('0x7e')]);_0x49c1db['where']=qs[_0xe5db('0x79')](_[_0xe5db('0x7f')](_0x4d39e6[_0xe5db('0x22')],_0x549890[_0xe5db('0x79')]));_0x49c1db[_0xe5db('0x59')][_0xe5db('0x9f')]=_0x23ef7f['id'];if(_0x4d39e6[_0xe5db('0x22')][_0xe5db('0x81')]){_0x49c1db[_0xe5db('0x59')]=_[_0xe5db('0x80')](_0x49c1db[_0xe5db('0x59')],{'$or':_[_0xe5db('0x6c')](_0x49c1db[_0xe5db('0x7c')],function(_0x1580a9){var _0x430243={};_0x430243[_0x1580a9]={'$like':'%'+_0x4d39e6[_0xe5db('0x22')][_0xe5db('0x81')]+'%'};return _0x430243;})});}_0x49c1db=_[_0xe5db('0x80')]({},_0x49c1db,_0x4d39e6['options']);return db[_0xe5db('0x47')][_0xe5db('0x11')]({'where':_0x49c1db['where']})[_0xe5db('0x18')](function(_0x39468f){_0x54a850[_0xe5db('0x11')]=_0x39468f;if(_0x4d39e6[_0xe5db('0x22')]['includeAll']){_0x49c1db[_0xe5db('0x9c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe5db('0x21')](_0x49c1db);})[_0xe5db('0x18')](function(_0x1db7ca){_0x54a850['rows']=_0x1db7ca;return _0x54a850;});}})['then'](respondWithFilteredResult(_0x5ae83e,_0x49c1db))['catch'](handleError(_0x5ae83e,null));};exports[_0xe5db('0xa0')]=function(_0x584a9e,_0x3bb675){var _0x4dd699={'raw':!![],'where':{}};var _0x35a14a={};var _0x379e84={'count':0x0,'rows':[]};return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x584a9e[_0xe5db('0x61')]['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x3bb675,null))[_0xe5db('0x18')](function(_0x574c8a){if(_0x574c8a){_0x35a14a[_0xe5db('0x78')]=_[_0xe5db('0x27')](db[_0xe5db('0xa1')][_0xe5db('0x99')]);_0x35a14a[_0xe5db('0x22')]=_['keys'](_0x584a9e['query']);_0x35a14a['filters']=_[_0xe5db('0x7a')](_0x35a14a[_0xe5db('0x78')],_0x35a14a[_0xe5db('0x22')]);_0x4dd699[_0xe5db('0x7c')]=_['intersection'](_0x35a14a[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x584a9e['query'][_0xe5db('0x7b')]));_0x4dd699[_0xe5db('0x7c')]=_0x4dd699[_0xe5db('0x7c')][_0xe5db('0x28')]?_0x4dd699[_0xe5db('0x7c')]:_0x35a14a[_0xe5db('0x78')];if(!_0x584a9e['query'][_0xe5db('0x84')](_0xe5db('0x9a'))){_0x4dd699['limit']=qs[_0xe5db('0x12')](_0x584a9e[_0xe5db('0x22')][_0xe5db('0x12')]);_0x4dd699[_0xe5db('0xf')]=qs['offset'](_0x584a9e[_0xe5db('0x22')][_0xe5db('0xf')]);}_0x4dd699[_0xe5db('0x7d')]=qs['sort'](_0x584a9e[_0xe5db('0x22')][_0xe5db('0x7e')]);_0x4dd699[_0xe5db('0x59')]=qs[_0xe5db('0x79')](_[_0xe5db('0x7f')](_0x584a9e['query'],_0x35a14a['filters']));_0x4dd699[_0xe5db('0x59')]['ContactId']=_0x574c8a['id'];if(_0x584a9e['query']['filter']){_0x4dd699[_0xe5db('0x59')]=_[_0xe5db('0x80')](_0x4dd699['where'],{'$or':_[_0xe5db('0x6c')](_0x4dd699[_0xe5db('0x7c')],function(_0x533144){var _0x1449b8={};_0x1449b8[_0x533144]={'$like':'%'+_0x584a9e['query'][_0xe5db('0x81')]+'%'};return _0x1449b8;})});}_0x4dd699=_[_0xe5db('0x80')]({},_0x4dd699,_0x584a9e[_0xe5db('0x82')]);return db['CmHopperFinal'][_0xe5db('0x11')]({'where':_0x4dd699[_0xe5db('0x59')]})[_0xe5db('0x18')](function(_0x367708){_0x379e84[_0xe5db('0x11')]=_0x367708;if(_0x584a9e[_0xe5db('0x22')]['includeAll']){_0x4dd699[_0xe5db('0x9c')]=[{'all':!![]}];}return db[_0xe5db('0xa1')]['findAll'](_0x4dd699);})['then'](function(_0xc9d963){_0x379e84[_0xe5db('0x9d')]=_0xc9d963;return _0x379e84;});}})['then'](respondWithFilteredResult(_0x3bb675,_0x4dd699))[_0xe5db('0x26')](handleError(_0x3bb675,null));};exports[_0xe5db('0xa2')]=function(_0x340fef,_0x4a81e8){var _0x4a3b1f={'raw':!![],'where':{}};var _0x8df847={};var _0x19d457={'count':0x0,'rows':[]};return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x340fef[_0xe5db('0x61')]['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x4a81e8,null))[_0xe5db('0x18')](function(_0x1a0773){if(_0x1a0773){_0x8df847[_0xe5db('0x78')]=_['keys'](db[_0xe5db('0x4f')][_0xe5db('0x99')]);_0x8df847[_0xe5db('0x22')]=_[_0xe5db('0x27')](_0x340fef[_0xe5db('0x22')]);_0x8df847[_0xe5db('0x79')]=_[_0xe5db('0x7a')](_0x8df847[_0xe5db('0x78')],_0x8df847[_0xe5db('0x22')]);_0x4a3b1f[_0xe5db('0x7c')]=_[_0xe5db('0x7a')](_0x8df847[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x340fef[_0xe5db('0x22')][_0xe5db('0x7b')]));_0x4a3b1f[_0xe5db('0x7c')]=_0x4a3b1f[_0xe5db('0x7c')]['length']?_0x4a3b1f[_0xe5db('0x7c')]:_0x8df847[_0xe5db('0x78')];if(!_0x340fef[_0xe5db('0x22')][_0xe5db('0x84')]('nolimit')){_0x4a3b1f['limit']=qs['limit'](_0x340fef[_0xe5db('0x22')]['limit']);_0x4a3b1f['offset']=qs[_0xe5db('0xf')](_0x340fef[_0xe5db('0x22')][_0xe5db('0xf')]);}_0x4a3b1f[_0xe5db('0x7d')]=qs['sort'](_0x340fef['query'][_0xe5db('0x7e')]);_0x4a3b1f['where']=qs[_0xe5db('0x79')](_['pick'](_0x340fef[_0xe5db('0x22')],_0x8df847['filters']));_0x4a3b1f[_0xe5db('0x59')][_0xe5db('0x9f')]=_0x1a0773['id'];if(_0x340fef['query'][_0xe5db('0x81')]){_0x4a3b1f[_0xe5db('0x59')]=_[_0xe5db('0x80')](_0x4a3b1f[_0xe5db('0x59')],{'$or':_[_0xe5db('0x6c')](_0x4a3b1f['attributes'],function(_0x4de43a){var _0x44c5fe={};_0x44c5fe[_0x4de43a]={'$like':'%'+_0x340fef[_0xe5db('0x22')][_0xe5db('0x81')]+'%'};return _0x44c5fe;})});}_0x4a3b1f=_[_0xe5db('0x80')]({},_0x4a3b1f,_0x340fef[_0xe5db('0x82')]);return db['JscriptySessionReport'][_0xe5db('0x11')]({'where':_0x4a3b1f[_0xe5db('0x59')]})[_0xe5db('0x18')](function(_0x3dc0a2){_0x19d457[_0xe5db('0x11')]=_0x3dc0a2;if(_0x340fef[_0xe5db('0x22')][_0xe5db('0x9b')]){_0x4a3b1f[_0xe5db('0x9c')]=[{'all':!![]}];}return db[_0xe5db('0x4f')][_0xe5db('0x21')](_0x4a3b1f);})[_0xe5db('0x18')](function(_0x562635){_0x19d457[_0xe5db('0x9d')]=_0x562635;return _0x19d457;});}})[_0xe5db('0x18')](respondWithFilteredResult(_0x4a81e8,_0x4a3b1f))[_0xe5db('0x26')](handleError(_0x4a81e8,null));};exports[_0xe5db('0xa3')]=function(_0x2673ca,_0x1e4f6a){try{if(!_0x2673ca[_0xe5db('0x32')][_0xe5db('0x5b')]){throw new Error(_0xe5db('0xa4'));}if(!_0x2673ca[_0xe5db('0x32')][_0xe5db('0xa5')]){throw new Error(_0xe5db('0xa6'));}if(!_0x2673ca['body']['binding_values']){throw new Error(_0xe5db('0xa7'));}if(!_0x2673ca['body']['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x28292c=_0x2673ca[_0xe5db('0x32')][_0xe5db('0xa5')][_0xe5db('0xa8')](',');var _0x2a0aa1=_0x2673ca[_0xe5db('0x32')][_0xe5db('0xa9')][_0xe5db('0xa8')](',');if(!_0x28292c['length']||!_0x2a0aa1['length']||_0x28292c[_0xe5db('0x28')]!==_0x2a0aa1[_0xe5db('0x28')]){throw new Error(_0xe5db('0xaa'));}_0x2673ca[_0xe5db('0x32')]['fields']=_[_0xe5db('0xab')](_0x28292c,_0x2a0aa1);if(!_0x2673ca['body'][_0xe5db('0x7b')]['phone']){throw new Error(_0xe5db('0xac'));}if(!_0x2673ca['body']['fields'][_0xe5db('0xad')]){throw new Error(_0xe5db('0xae'));}var _0x209757=path[_0xe5db('0xaf')](config[_0xe5db('0xb0')],_0xe5db('0xb1'),_0x2673ca[_0xe5db('0xb2')][_0xe5db('0xb3')]);fs[_0xe5db('0xb4')](_0x209757,parseInt(_0xe5db('0xb5'),0x8));var _0x187871=require(_0xe5db('0xb6'))['fork'](path['join'](__dirname,_0xe5db('0xb7')),[_0x209757,_0x2673ca[_0xe5db('0x32')][_0xe5db('0xa5')],_0x2673ca['body'][_0xe5db('0xa9')],_0x2673ca[_0xe5db('0x32')]['ListId'],_0x2673ca[_0xe5db('0x32')][_0xe5db('0xb8')],_0x2673ca['body'][_0xe5db('0x58')],_0x2673ca[_0xe5db('0x32')]['socket_timestamp']]);return _0x1e4f6a[_0xe5db('0x13')](0xc8)[_0xe5db('0xe')]({'message':_0xe5db('0xb9'),'pid':_0x187871['pid']});}catch(_0x5977c5){return _0x1e4f6a[_0xe5db('0x13')](0x1f4)[_0xe5db('0x1e')](_0x5977c5);}};exports['upload']=function(_0x4781da,_0x214b96){var _0x488a23=fs[_0xe5db('0xba')](_0x4781da[_0xe5db('0xb2')][_0xe5db('0x2')]);Papa['parse'](_0x488a23,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1a8500){return _0x214b96[_0xe5db('0x13')](0xc8)[_0xe5db('0xe')]({'file':_0x4781da[_0xe5db('0xb2')],'fields':_0x1a8500[_0xe5db('0xbb')][_0xe5db('0x7b')]});}});};exports[_0xe5db('0xbc')]=function(_0x1b8631,_0x35520a){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xe5db('0xbd')}})[_0xe5db('0x18')](function(_0x5b5f1c){var _0x7de2da=![];if(!_0x1b8631[_0xe5db('0x32')][_0xe5db('0x5b')]){throw new Error(_0xe5db('0xa4'));}if(!_0x1b8631[_0xe5db('0x32')][_0xe5db('0xbe')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1b8631['body']['binding'][_0xe5db('0xad')]){throw new Error(_0xe5db('0xae'));}if(!_0x1b8631[_0xe5db('0x32')][_0xe5db('0xbf')]){throw new Error(_0xe5db('0xc0'));}var _0x257340=require(_0xe5db('0xb6'))['fork'](path[_0xe5db('0xaf')](__dirname,_0xe5db('0xc1')),[_0x1b8631[_0xe5db('0x61')]['id'],JSON[_0xe5db('0xc2')](_0x1b8631[_0xe5db('0x32')]),JSON['stringify'](_0x5b5f1c)]);_0x257340['on'](_0xe5db('0xc3'),function(){_0x7de2da=!![];return _0x35520a[_0xe5db('0x13')](0xc8)['json']({'message':_0xe5db('0xc4'),'pid':_0x257340[_0xe5db('0xc5')]});});_0x257340['on'](_0xe5db('0xc6'),function(_0x13b3bf){if(_0x13b3bf&&!_0x7de2da){return _0x35520a[_0xe5db('0x13')](0x1f4)[_0xe5db('0xe')]({'message':_0xe5db('0xc7'),'pid':_0x257340['pid']});}});})[_0xe5db('0x26')](handleError(_0x35520a,null));};exports[_0xe5db('0xc8')]=function(_0x17c119,_0x42f151){return db[_0xe5db('0xc9')][_0xe5db('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xe5db('0xbd')}})[_0xe5db('0x18')](function(_0x45187f){var _0x2af463=![];if(!_0x17c119[_0xe5db('0x32')][_0xe5db('0x5b')]){throw new Error(_0xe5db('0xa4'));}if(!_0x17c119[_0xe5db('0x32')][_0xe5db('0xbe')][_0xe5db('0x8b')]){throw new Error(_0xe5db('0xac'));}if(!_0x17c119[_0xe5db('0x32')]['binding']['firstName']){throw new Error(_0xe5db('0xae'));}if(!_0x17c119['body'][_0xe5db('0xbf')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1754a7=require('child_process')[_0xe5db('0xca')](path[_0xe5db('0xaf')](__dirname,'../../components/import/cm/csvUpdates'),[_0x17c119[_0xe5db('0x61')]['id'],JSON[_0xe5db('0xc2')](_0x17c119[_0xe5db('0x32')]),JSON[_0xe5db('0xc2')](_0x45187f)]);_0x1754a7['on']('message',function(){_0x2af463=!![];return _0x42f151['status'](0xc8)[_0xe5db('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1754a7[_0xe5db('0xc5')]});});_0x1754a7['on'](_0xe5db('0xc6'),function(_0x437242){if(_0x437242&&!_0x2af463){return _0x42f151[_0xe5db('0x13')](0x1f4)[_0xe5db('0xe')]({'message':_0xe5db('0xc7'),'pid':_0x1754a7[_0xe5db('0xc5')]});}});})['catch'](handleError(_0x42f151,null));};exports[_0xe5db('0xcb')]=function(_0x4b1bae,_0x43d927){var _0x2eba6d=[_0xe5db('0xcc'),_0xe5db('0xcd'),_0xe5db('0xce'),_0xe5db('0xcf'),_0xe5db('0xd0'),_0xe5db('0xd1'),_0xe5db('0xd2')];var _0x13eb64={'offset':0x0,'order':qs[_0xe5db('0x7e')](_0xe5db('0xd3'))},_0x1d3150={'count':0x0,'rows':[]};Promise[_0xe5db('0xd4')]()['then'](function(){if(_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd5')]){if(!_['includes'](_0x2eba6d,_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd5')][_0xe5db('0xd6')]())){throw new Error('Invalid\x20channel');}_0x2eba6d=[_0x4b1bae[_0xe5db('0x22')]['channel']['toLowerCase']()];}if(_0x4b1bae['query'][_0xe5db('0xd7')]){try{var _0x17f00d=JSON[_0xe5db('0xd8')](_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd7')]);if(!moment(_0x17f00d['from'])[_0xe5db('0xd9')]()){throw new Error(_0xe5db('0xda'));}if(!moment(_0x17f00d['to'])['isValid']()){throw new Error(_0xe5db('0xdb'));}}catch(_0x15c41c){throw new Error(_0xe5db('0xdc'));}}if(!_0x4b1bae['query']['hasOwnProperty'](_0xe5db('0x9a'))){_0x13eb64['limit']=qs[_0xe5db('0x12')](_0x4b1bae[_0xe5db('0x22')][_0xe5db('0x12')]||0xa);_0x13eb64[_0xe5db('0xf')]=qs[_0xe5db('0xf')](_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xf')]);}var _0x459cbe=_0x2eba6d[_0xe5db('0x6c')](function(_0x178d10){if(_0x178d10===_0xe5db('0xd2')){var _0x3d56a8={'attributes':['id',_0xe5db('0xdd'),'type','source',_0xe5db('0xde'),_0xe5db('0xdf'),_0xe5db('0xe0'),_0xe5db('0xe1'),_0xe5db('0xe2'),_0xe5db('0xe3'),_0xe5db('0xe4'),_0xe5db('0xe5'),_0xe5db('0xe6'),_0xe5db('0xe7'),'UserId'],'where':{'ContactId':_0x4b1bae[_0xe5db('0x61')]['id']},'include':[{'model':db[_0xe5db('0xc9')],'as':_0xe5db('0xc9'),'attributes':['id','name',_0xe5db('0xe8'),_0xe5db('0x2d')]}],'order':[[_0xe5db('0xe4'),_0xe5db('0xe9')]]};if(_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd7')]){_0x3d56a8['where'][_0xe5db('0xe4')]={'$gte':_0x17f00d[_0xe5db('0x33')],'$lte':_0x17f00d['to']};}return db[_0xe5db('0x49')][_0xe5db('0xea')](_0x3d56a8)[_0xe5db('0x18')](function(_0x5f0010){_0x1d3150[_0xe5db('0x11')]+=_0x5f0010[_0xe5db('0x11')];return _[_0xe5db('0x6c')](_0x5f0010['rows'],function(_0x5f293b){var _0x2c0739=_0x5f293b[_0xe5db('0x34')]({'plain':!![]});_0x2c0739[_0xe5db('0xd5')]=_0x178d10;if(_0x2c0739['User']){_0x2c0739['User']={'id':_0x2c0739['User']['id'],'name':_0x2c0739[_0xe5db('0xc9')]['name'],'fullname':_0x2c0739[_0xe5db('0xc9')]['fullname'],'alias':_0x2c0739[_0xe5db('0xc9')][_0xe5db('0x2d')]};}return _0x2c0739;});});}else{var _0x9e7b1e=_[_0xe5db('0xeb')](_0x178d10)+(_0x178d10===_0xe5db('0xcd')?_0xe5db('0xec'):_0xe5db('0xed'));var _0x2856d4={'attributes':['id',_0xe5db('0xee'),'closedAt',_0xe5db('0xe4'),_0xe5db('0xe3'),_0xe5db('0xef'),_0xe5db('0xf0'),'thirdDisposition',_0xe5db('0xf1'),_0x9e7b1e+'Id'],'where':{'ContactId':_0x4b1bae['params']['id']},'include':[{'model':db[_0x9e7b1e],'as':_0xe5db('0xed'),'attributes':['id',_0xe5db('0x1d'),_0xe5db('0xf2')]},{'model':db[_0xe5db('0xc9')],'as':_0xe5db('0xf3'),'attributes':['id',_0xe5db('0x1d'),'fullname']},{'model':db[_0xe5db('0x62')],'as':_0xe5db('0x63'),'attributes':['id',_0xe5db('0x1d'),_0xe5db('0x64')],'through':{'attributes':[]}}],'order':[['createdAt',_0xe5db('0xe9')]]};if(_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd7')]){_0x2856d4['where'][_0xe5db('0xe4')]={'$gte':_0x17f00d['from'],'$lte':_0x17f00d['to']};}switch(_0x178d10){case _0xe5db('0xcd'):_0x2856d4['attributes'][_0xe5db('0x5d')](_0xe5db('0xf4'),_0xe5db('0xf5'),'customerPort',_0xe5db('0xf6'),_0xe5db('0xf7'),'ratingMessage',_0xe5db('0xf8'),_0xe5db('0xf9'),'referer');break;case _0xe5db('0xcc'):_0x2856d4['attributes'][_0xe5db('0x5d')](_0xe5db('0xfa'),_0xe5db('0xfb'));break;case'openchannel':_0x2856d4[_0xe5db('0x7c')][_0xe5db('0x5d')]('externalUrl',_0xe5db('0xfc'));break;}return db[_[_0xe5db('0xeb')](_0x178d10)+_0xe5db('0xfd')][_0xe5db('0xea')](_0x2856d4)[_0xe5db('0x18')](function(_0x4a6bba){_0x1d3150[_0xe5db('0x11')]+=_0x4a6bba[_0xe5db('0x11')];return _[_0xe5db('0x6c')](_0x4a6bba[_0xe5db('0x9d')],function(_0x4ce3ea){var _0x5ebcc5=_0x4ce3ea[_0xe5db('0x34')]({'plain':!![]});_0x5ebcc5[_0xe5db('0xd5')]=_0x178d10;if(_0x5ebcc5[_0xe5db('0xf3')]){_0x5ebcc5[_0xe5db('0xf3')]={'id':_0x5ebcc5['Owner']['id'],'name':_0x5ebcc5[_0xe5db('0xf3')][_0xe5db('0x1d')],'fullname':_0x5ebcc5[_0xe5db('0xf3')][_0xe5db('0xe8')]};}return _0x5ebcc5;});});}});return Promise[_0xe5db('0x5f')](_0x459cbe);})['then'](function(_0x396470){return _(_0x396470)[_0xe5db('0xfe')]()[_0xe5db('0xff')]('createdAt')['reverse']()[_0xe5db('0x100')]();})[_0xe5db('0x18')](function(_0x40e435){_0x1d3150[_0xe5db('0x9d')]=_0x13eb64[_0xe5db('0x12')]?_0x40e435[_0xe5db('0x101')](_0x13eb64[_0xe5db('0xf')],_0x13eb64['offset']+_0x13eb64[_0xe5db('0x12')]):_0x40e435;return _0x1d3150;})['then'](respondWithFilteredResult(_0x43d927,_0x13eb64))[_0xe5db('0x26')](handleError(_0x43d927,null));}; \ No newline at end of file +var _0x8e3a=['isArray','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','all','show','params','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','get','format','cf_%d','dialTimezone','$and','omit','pickBy','cf_','map','isEmpty','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','rawAttributes','filters','intersection','fields','attributes','model','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','CmContactHasItem','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','includeAll','rows','order','include','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','send','upload','createReadStream','meta','import','agent','binding','fork','../../components/import/cm/csv2','stringify','message','pid','exit','error\x20child\x20process','importUpdates','User','No\x20firstName\x20column\x20specified','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','fax','whatsapp','voice','resolve','includes','channel','toLowerCase','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','starttime','duration','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','startCase','Website','Account','closed','note','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','threadId','sortBy','value','slice','moment','util','path','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','name','describe','getOptions','findAll','query','user','catch','CmContact','find','tags','keys','length','startsWith','columnName','analytics','CmCustomField','displayName','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from'];(function(_0x4e2832,_0x2758b2){var _0x33352e=function(_0x33cf6f){while(--_0x33cf6f){_0x4e2832['push'](_0x4e2832['shift']());}};_0x33352e(++_0x2758b2);}(_0x8e3a,0xc2));var _0xa8e3=function(_0x1d51a4,_0x3e798e){_0x1d51a4=_0x1d51a4-0x0;var _0xea5eb6=_0x8e3a[_0x1d51a4];return _0xea5eb6;};'use strict';var moment=require(_0xa8e3('0x0'));var BPromise=require('bluebird');var util=require(_0xa8e3('0x1'));var path=require(_0xa8e3('0x2'));var fs=require('fs');var _=require(_0xa8e3('0x3'));var squel=require(_0xa8e3('0x4'));var Papa=require('papaparse');var Redis=require(_0xa8e3('0x5'));var contacts=require('../../components/contacts');var qs=require(_0xa8e3('0x6'));var logger=require('../../config/logger')(_0xa8e3('0x7'));var config=require(_0xa8e3('0x8'));var shared=require(_0xa8e3('0x9'));var db=require('../../mysqldb')['db'];config[_0xa8e3('0xa')]=_[_0xa8e3('0xb')](config['redis'],{'host':_0xa8e3('0xc'),'port':0x18eb});var socket=require(_0xa8e3('0xd'))(new Redis(config[_0xa8e3('0xa')]));require(_0xa8e3('0xe'))[_0xa8e3('0xf')](socket);function respondWithResult(_0x45ede0,_0x6aeadc){_0x6aeadc=_0x6aeadc||0xc8;return function(_0xf5981){if(_0xf5981){return _0x45ede0[_0xa8e3('0x10')](_0x6aeadc)[_0xa8e3('0x11')](_0xf5981);}};}function respondWithFilteredResult(_0x4e581b,_0x3d971b){return function(_0x446624){if(_0x446624){var _0x114b94=typeof _0x3d971b[_0xa8e3('0x12')]==='undefined'&&typeof _0x3d971b['limit']===_0xa8e3('0x13');var _0x10d6c3=_0x446624['count'];var _0x31f22a=_0x114b94?0x0:_0x3d971b['offset'];var _0x43f392=_0x114b94?_0x446624[_0xa8e3('0x14')]:_0x3d971b[_0xa8e3('0x12')]+_0x3d971b[_0xa8e3('0x15')];var _0x5583cc;if(_0x43f392>=_0x10d6c3){_0x43f392=_0x10d6c3;_0x5583cc=0xc8;}else{_0x5583cc=0xce;}_0x4e581b[_0xa8e3('0x10')](_0x5583cc);return _0x4e581b[_0xa8e3('0x16')](_0xa8e3('0x17'),_0x31f22a+'-'+_0x43f392+'/'+_0x10d6c3)[_0xa8e3('0x11')](_0x446624);}return null;};}function saveUpdates(_0x27cc43){return function(_0x15896c){if(_0x15896c){return _0x15896c[_0xa8e3('0x18')](_0x27cc43)[_0xa8e3('0x19')](function(_0x59b52d){return _0x59b52d;});}return null;};}function removeEntity(_0x11ff1b){return function(_0x876371){if(_0x876371){return _0x876371[_0xa8e3('0x1a')]()[_0xa8e3('0x19')](function(){_0x11ff1b[_0xa8e3('0x10')](0xcc)[_0xa8e3('0x1b')]();});}};}function handleEntityNotFound(_0x3e9c9c){return function(_0x180315){if(!_0x180315){_0x3e9c9c['sendStatus'](0x194);}return _0x180315;};}function handleError(_0x47cf34,_0x8c858){_0x8c858=_0x8c858||0x1f4;return function(_0x31ca0c){logger['error'](_0x31ca0c['stack']);if(_0x31ca0c['name']){delete _0x31ca0c[_0xa8e3('0x1c')];}_0x47cf34[_0xa8e3('0x10')](_0x8c858)['send'](_0x31ca0c);};}exports['index']=function(_0x38e097,_0x752942){var _0x5cd263={};return contacts[_0xa8e3('0x1d')]()[_0xa8e3('0x19')](function(_0x4c6291){_0x5cd263=qs[_0xa8e3('0x1e')](_0x4c6291,_0x38e097);return contacts[_0xa8e3('0x1f')](_0x38e097[_0xa8e3('0x20')],_0x38e097[_0xa8e3('0x21')],_0x5cd263,_0x4c6291);})['then'](respondWithFilteredResult(_0x752942,_0x5cd263))[_0xa8e3('0x22')](handleError(_0x752942,null));};exports[_0xa8e3('0x1a')]=function(_0x2c1091,_0x369a15){return db[_0xa8e3('0x23')][_0xa8e3('0x24')]({'where':{'id':_0x2c1091['params']['id']}})[_0xa8e3('0x19')](handleEntityNotFound(_0x369a15,null))[_0xa8e3('0x19')](removeEntity(_0x369a15,null))['catch'](handleError(_0x369a15,null));};exports[_0xa8e3('0x1d')]=function(_0x1746b0,_0x6be3e){return db[_0xa8e3('0x23')][_0xa8e3('0x1d')]()['then'](function(_0x5c289f){delete _0x5c289f[_0xa8e3('0x25')];for(var _0x4ae18f=0x0;_0x4ae18f0x0){return new Promise(function(_0x32092c){var _0x227a18=[];for(var _0x174f50=0x0;_0x174f50<_0xdd595c[_0xa8e3('0x27')];_0x174f50++){_0x227a18[_0xa8e3('0x59')](insertAdditionalPhones(_0xdd595c[_0x174f50]['contact'],_0xdd595c[_0x174f50]['additionalPhones']));}Promise[_0xa8e3('0x5c')](_0x227a18)['then'](function(){_0x32092c(0x1);});})['then'](function(){return{'success':_0x2b65e7,'failure':_0x4a2e02,'duplicates':_0x54cb17};});}else{return{'success':_0x2b65e7,'failure':_0x4a2e02,'duplicates':_0x54cb17};}}})[_0xa8e3('0x19')](respondWithResult(_0x111df2,0xc9))[_0xa8e3('0x22')](handleError(_0x111df2,null));};exports[_0xa8e3('0x5d')]=function(_0x5b345f,_0x1b2028){var _0x14bca9;return db[_0xa8e3('0x23')]['describe']()['then'](function(_0x456381){return db[_0xa8e3('0x23')][_0xa8e3('0x24')]({'where':{'id':_0x5b345f[_0xa8e3('0x5e')]['id']},'include':[{'model':db[_0xa8e3('0x5f')],'as':_0xa8e3('0x60'),'attributes':['id',_0xa8e3('0x1c'),_0xa8e3('0x61')],'required':_0x5b345f[_0xa8e3('0x20')][_0xa8e3('0x62')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xa8e3('0x63'),'where':{'CmContactId':_0x5b345f[_0xa8e3('0x5e')]['id']},'required':![],'include':[{'model':db[_0xa8e3('0x64')],'as':_0xa8e3('0x65')}]}],'order':[db[_0xa8e3('0x66')][_0xa8e3('0x67')](_0xa8e3('0x68'))],'attributes':_[_0xa8e3('0x26')](_0x456381)});})[_0xa8e3('0x19')](function(_0x5d9306){if(!_[_0xa8e3('0x50')](_0x5d9306)){_0x14bca9=_0x5d9306[_0xa8e3('0x69')]({'plain':!![]});var _0x18de22={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5d9306&&_0x5d9306['ListId']){if(_0x5d9306[_0xa8e3('0x5a')]){_0x18de22[_0xa8e3('0x57')]['$and'][_0xa8e3('0x59')]({'ListId':{'$ne':_0x5d9306[_0xa8e3('0x5a')]}});}}return db['CmCustomField'][_0xa8e3('0x1f')](_0x18de22);}})['then'](function(_0x335f4e){if(!_[_0xa8e3('0x50')](_0x335f4e)){return _['omit'](_0x14bca9,_['map'](_0x335f4e,function(_0x11aac5){return util[_0xa8e3('0x6a')](_0xa8e3('0x6b'),_0x11aac5['id']);}));}})[_0xa8e3('0x19')](handleEntityNotFound(_0x1b2028,null))[_0xa8e3('0x19')](respondWithResult(_0x1b2028,null))[_0xa8e3('0x22')](handleError(_0x1b2028,null));};exports[_0xa8e3('0x18')]=function(_0x4fe652,_0x40831b){var _0x21b683;if(_0x4fe652['body']['id']){delete _0x4fe652['body']['id'];}if(!_[_0xa8e3('0x50')](_0x4fe652['body'][_0xa8e3('0x6c')])){var _0x29128b=_0x4fe652[_0xa8e3('0x36')][_0xa8e3('0x6c')];if(!_[_0xa8e3('0x50')](shared[_0xa8e3('0x51')][_0x29128b]))_0x4fe652[_0xa8e3('0x36')][_0xa8e3('0x52')]=shared[_0xa8e3('0x51')][_0x29128b][_0xa8e3('0x52')];}return db['CmContact'][_0xa8e3('0x24')]({'where':{'id':_0x4fe652[_0xa8e3('0x5e')]['id']}})['then'](handleEntityNotFound(_0x40831b,null))[_0xa8e3('0x19')](saveUpdates(_0x4fe652[_0xa8e3('0x36')],null))[_0xa8e3('0x19')](function(_0x56ea9c){_0x21b683=_0x56ea9c;var _0x19bfcf={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x56ea9c&&_0x56ea9c['ListId']){if(_0x56ea9c[_0xa8e3('0x5a')]){_0x19bfcf['where'][_0xa8e3('0x6d')]['push']({'ListId':{'$ne':_0x56ea9c[_0xa8e3('0x5a')]}});}}return db[_0xa8e3('0x2b')]['findAll'](_0x19bfcf);})[_0xa8e3('0x19')](function(_0x7b7d4d){if(_0x7b7d4d){return _[_0xa8e3('0x6e')](_[_0xa8e3('0x6f')](_0x4fe652['body'],function(_0x4e1a82,_0x5044e4){return _[_0xa8e3('0x28')](_0x5044e4,_0xa8e3('0x70'));}),_[_0xa8e3('0x71')](_0x7b7d4d,function(_0x1ecc2e){return util['format'](_0xa8e3('0x6b'),_0x1ecc2e['id']);}));}})['then'](function(_0x1a5048){if(_0x1a5048&&!_[_0xa8e3('0x72')](_0x1a5048)){var _0x11eb19=squel[_0xa8e3('0x18')]()['table'](_0xa8e3('0x73'))[_0xa8e3('0x74')](_0x1a5048)[_0xa8e3('0x57')](_0xa8e3('0x75'),_0x4fe652[_0xa8e3('0x5e')]['id'])[_0xa8e3('0x76')]();return db[_0xa8e3('0x66')]['query'](_0x11eb19[_0xa8e3('0x77')],{'replacements':_0x11eb19[_0xa8e3('0x30')]});}})[_0xa8e3('0x19')](function(){if(_0x4fe652['body'][_0xa8e3('0x78')]&&_0x21b683){return db['CmHopper'][_0xa8e3('0x18')]({'phone':_0x4fe652['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x21b683['id']}});}})[_0xa8e3('0x19')](function(){return _0x21b683;})[_0xa8e3('0x19')](respondWithResult(_0x40831b,null))['catch'](handleError(_0x40831b,null));};exports[_0xa8e3('0x79')]=function(_0x3cab66,_0x31f410){var _0x30563f={};var _0x2b561c={};var _0x5b3fff;var _0x4809a0;return db['CmContact'][_0xa8e3('0x7a')]({'where':{'id':_0x3cab66[_0xa8e3('0x5e')]['id']}})[_0xa8e3('0x19')](handleEntityNotFound(_0x31f410,null))['then'](function(_0x41d044){if(_0x41d044){_0x5b3fff=_0x41d044;_0x2b561c['model']=_[_0xa8e3('0x26')](db[_0xa8e3('0x5f')][_0xa8e3('0x7b')]);_0x2b561c[_0xa8e3('0x20')]=_[_0xa8e3('0x26')](_0x3cab66[_0xa8e3('0x20')]);_0x2b561c[_0xa8e3('0x7c')]=_[_0xa8e3('0x7d')](_0x2b561c['model'],_0x2b561c['query']);_0x30563f['attributes']=_['intersection'](_0x2b561c['model'],qs[_0xa8e3('0x7e')](_0x3cab66[_0xa8e3('0x20')][_0xa8e3('0x7e')]));_0x30563f[_0xa8e3('0x7f')]=_0x30563f[_0xa8e3('0x7f')][_0xa8e3('0x27')]?_0x30563f[_0xa8e3('0x7f')]:_0x2b561c[_0xa8e3('0x80')];_0x30563f['order']=qs['sort'](_0x3cab66['query'][_0xa8e3('0x81')]);_0x30563f['where']=qs[_0xa8e3('0x7c')](_[_0xa8e3('0x82')](_0x3cab66[_0xa8e3('0x20')],_0x2b561c['filters']));if(_0x3cab66['query'][_0xa8e3('0x83')]){_0x30563f[_0xa8e3('0x57')]=_['merge'](_0x30563f[_0xa8e3('0x57')],{'$or':_[_0xa8e3('0x71')](_0x30563f[_0xa8e3('0x7f')],function(_0x1bbc8e){var _0x4961dc={};_0x4961dc[_0x1bbc8e]={'$like':'%'+_0x3cab66[_0xa8e3('0x20')][_0xa8e3('0x83')]+'%'};return _0x4961dc;})});}_0x30563f=_['merge']({},_0x30563f,_0x3cab66[_0xa8e3('0x84')]);return _0x5b3fff[_0xa8e3('0x79')](_0x30563f);}})[_0xa8e3('0x19')](function(_0x1c85d4){if(_0x1c85d4){_0x4809a0=_0x1c85d4[_0xa8e3('0x27')];if(!_0x3cab66[_0xa8e3('0x20')][_0xa8e3('0x34')](_0xa8e3('0x85'))){_0x30563f[_0xa8e3('0x15')]=qs[_0xa8e3('0x15')](_0x3cab66['query'][_0xa8e3('0x15')]);_0x30563f[_0xa8e3('0x12')]=qs[_0xa8e3('0x12')](_0x3cab66[_0xa8e3('0x20')][_0xa8e3('0x12')]);}return _0x5b3fff[_0xa8e3('0x79')](_0x30563f);}})[_0xa8e3('0x19')](function(_0x235468){if(_0x235468){return _0x235468?{'count':_0x4809a0,'rows':_0x235468}:null;}})['then'](respondWithResult(_0x31f410,null))['catch'](handleError(_0x31f410,null));};exports['setTags']=function(_0x40ae0a,_0xb92383){if(_0x40ae0a[_0xa8e3('0x36')]['id']){delete _0x40ae0a['body']['id'];}return db['CmContact'][_0xa8e3('0x7a')]({'where':{'id':_0x40ae0a[_0xa8e3('0x5e')]['id']}})[_0xa8e3('0x19')](handleEntityNotFound(_0xb92383,null))[_0xa8e3('0x19')](function(_0x3042c2){if(_0x3042c2){return _0x3042c2[_0xa8e3('0x86')](_0x40ae0a[_0xa8e3('0x36')][_0xa8e3('0x87')]||[]);}return null;})[_0xa8e3('0x19')](respondWithResult(_0xb92383,null))['catch'](handleError(_0xb92383,null));};exports[_0xa8e3('0x88')]=function(_0x2aa616,_0x157350){var _0x481081=[];_0x481081[_0xa8e3('0x59')](addAdditionalPhones(_0x2aa616[_0xa8e3('0x36')]));Promise[_0xa8e3('0x5c')](_0x481081)[_0xa8e3('0x19')](function(){_0x481081=[];_0x481081[_0xa8e3('0x59')](deleteCmHopperPhones(_0x2aa616[_0xa8e3('0x36')]['id']));_0x481081[_0xa8e3('0x59')](addCmHopperPhones(_0x2aa616[_0xa8e3('0x36')]['id']));Promise[_0xa8e3('0x5c')](_0x481081)['then'](function(){return[0x1];})[_0xa8e3('0x19')](respondWithResult(_0x157350,null));});};function addAdditionalPhones(_0x398047){var _0x5af379;return new Promise(function(_0x3f0957){return db[_0xa8e3('0x89')][_0xa8e3('0x1a')]({'where':{'CmContactId':_0x398047['id']}})[_0xa8e3('0x19')](function(){db[_0xa8e3('0x64')]['findAll']({'raw':!![],'attributes':['id','OrderBy']})[_0xa8e3('0x19')](function(_0x20c6d3){var _0x57a340=[];for(var _0x50cb84=0x0;_0x50cb84<_0x398047[_0xa8e3('0x8a')][_0xa8e3('0x27')];_0x50cb84++){var _0x4ee498=_0x398047[_0xa8e3('0x8b')]?_[_0xa8e3('0x50')](_0x398047[_0xa8e3('0x8b')][_0x50cb84])?'':_0x398047[_0xa8e3('0x8b')][_0x50cb84]:_0x398047[_0xa8e3('0x8a')][_0x50cb84][_0xa8e3('0x8c')]?_0x398047[_0xa8e3('0x8a')][_0x50cb84]['ItemTypeId']:'';var _0x76e1c=_[_0xa8e3('0x50')](_0x398047['items'][_0x50cb84][_0xa8e3('0x8d')])?'':_0x398047[_0xa8e3('0x8a')][_0x50cb84][_0xa8e3('0x8d')];var _0x3d1f09=_0x4ee498+':'+_0x398047['items'][_0x50cb84]['phone']+'§'+_0x76e1c;if(_[_0xa8e3('0x50')](_0x5af379))_0x5af379=_0x3d1f09;else _0x5af379+=';'+_0x3d1f09;var _0x23440d=null;var _0x161bb5=null;if(_0x398047['item_types']){if(!_[_0xa8e3('0x50')](_0x398047[_0xa8e3('0x8b')][_0x50cb84])){_0x161bb5=_[_0xa8e3('0x24')](_0x20c6d3,function(_0x3493a2){return _0x3493a2['id']===_0x398047[_0xa8e3('0x8b')][_0x50cb84];});if(!_[_0xa8e3('0x50')](_0x161bb5)){_0x23440d=_0x161bb5[_0xa8e3('0x8e')];}}}else{if(!_['isNil'](_0x398047[_0xa8e3('0x8a')][_0x50cb84])){_0x161bb5=_[_0xa8e3('0x24')](_0x20c6d3,function(_0x42948e){return _0x42948e['id']===_0x398047[_0xa8e3('0x8a')][_0x50cb84][_0xa8e3('0x8c')];});if(!_[_0xa8e3('0x50')](_0x161bb5)){_0x23440d=_0x50cb84;}}}if(_[_0xa8e3('0x50')](_0x23440d)){_0x23440d=0x64;}_0x57a340[_0xa8e3('0x59')](addAdditionalPhone(_0x398047['id'],_0x398047[_0xa8e3('0x8a')][_0x50cb84][_0xa8e3('0x78')],_0x398047[_0xa8e3('0x8b')]?_[_0xa8e3('0x50')](_0x398047[_0xa8e3('0x8b')][_0x50cb84])?null:_0x398047[_0xa8e3('0x8b')][_0x50cb84]:_0x398047[_0xa8e3('0x8a')][_0x50cb84][_0xa8e3('0x8c')]?_0x398047[_0xa8e3('0x8a')][_0x50cb84][_0xa8e3('0x8c')]:null,_0x23440d,_0x76e1c));}Promise[_0xa8e3('0x5c')](_0x57a340)[_0xa8e3('0x19')](function(){db[_0xa8e3('0x23')][_0xa8e3('0x18')]({'AdditionalPhones':_0x5af379},{'where':{'id':_0x398047['id']}})[_0xa8e3('0x19')](function(){_0x3f0957(0x1);});});});});});}function addAdditionalPhone(_0x517dc9,_0x1418c3,_0x2f9e1c,_0x319016,_0x1851a2){return db[_0xa8e3('0x89')]['find']({'where':{'CmContactId':_0x517dc9,'item':_0x1418c3}})['then'](function(_0x3e8740){if(_0x3e8740)logger[_0xa8e3('0x31')](_0xa8e3('0x8f'),_0x3e8740);else{db[_0xa8e3('0x89')][_0xa8e3('0x3e')]({'CmContactId':_0x517dc9,'item':_0x1418c3,'ItemTypeId':_0x2f9e1c,'OrderBy':_0x319016,'ItemClass':_0xa8e3('0x90'),'description':_0x1851a2});}});}function deleteCmHopperPhones(_0x509862){return new Promise(function(_0x20aad9){return db['CmHopper'][_0xa8e3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x509862}})[_0xa8e3('0x19')](function(_0xa730f0){db[_0xa8e3('0x91')][_0xa8e3('0x1a')]({'where':{'CmHopperId':{'$in':_[_0xa8e3('0x71')](_0xa730f0,'id')}}});})['then'](function(){_0x20aad9(0x1);});});}function addCmHopperPhones(_0x42458d){return new Promise(function(_0x40e041){return db[_0xa8e3('0x3a')][_0xa8e3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x42458d}})['then'](function(_0x171f69){var _0x5ddef5=[];_[_0xa8e3('0x71')](_0x171f69,function(_0x342dab){_0x5ddef5[_0xa8e3('0x59')](createCmHopperPhone(_0x42458d,_0x342dab['id']));});Promise[_0xa8e3('0x5c')](_0x5ddef5)[_0xa8e3('0x19')](function(){_0x40e041(0x1);});});});}function createCmHopperPhone(_0x5684a8,_0x1d8a3c){return new Promise(function(_0xfddc50){db[_0xa8e3('0x89')]['findAll']({'raw':!![],'attributes':[_0xa8e3('0x92'),_0xa8e3('0x8e')],'where':{'CmContactId':_0x5684a8,'ItemClass':_0xa8e3('0x90')},'include':[{'model':db[_0xa8e3('0x64')],'attributes':['OrderBy'],'as':_0xa8e3('0x65')}],'order':[_0xa8e3('0x8e'),db[_0xa8e3('0x66')][_0xa8e3('0x67')](_0xa8e3('0x93'))]})[_0xa8e3('0x19')](function(_0xed86ed){var _0x2e0868=0x1;var _0x22329c=_[_0xa8e3('0x71')](_0xed86ed,function(_0x11fd9c){_0x11fd9c[_0xa8e3('0x94')]=_0x1d8a3c;_0x11fd9c['phone']=_0x11fd9c['item'];_0x11fd9c[_0xa8e3('0x8e')]=_0x2e0868;delete _0x11fd9c['ItemType.OrderBy'];_0x2e0868=_0x2e0868+0x1;return _0x11fd9c;});return db[_0xa8e3('0x91')]['bulkCreate'](_0x22329c,{});})[_0xa8e3('0x19')](function(){_0xfddc50(0x1);});});}function insertAdditionalPhones(_0x2f4543,_0x5ced3e){return new Promise(function(_0x597b66){var _0x41d850=[];for(var _0x4acc59=0x0;_0x4acc59<_0x5ced3e[_0xa8e3('0x27')];_0x4acc59++){var _0x140eaf=_0x5ced3e[_0x4acc59];_0x41d850['push'](parseContactItemType(_0x140eaf));}Promise['all'](_0x41d850)['then'](function(){var _0x27fc09={'id':_0x2f4543['id'],'items':_0x5ced3e};return addAdditionalPhones(_0x27fc09)[_0xa8e3('0x19')](function(){return addCmHopperPhones(_0x2f4543['id']);});})[_0xa8e3('0x19')](function(){_0x597b66(_0x2f4543);});});}function parseContactItemType(_0x200fe4){return new Promise(function(_0x2cc096){if(_0x200fe4[_0xa8e3('0x34')](_0xa8e3('0x8c'))){_0x2cc096(_0x200fe4);}else{return db[_0xa8e3('0x64')]['find']({'where':{'name':_0x200fe4[_0xa8e3('0x65')]}})[_0xa8e3('0x19')](function(_0x461486){if(_[_0xa8e3('0x50')](_0x461486))_0x200fe4[_0xa8e3('0x8c')]=null;else _0x200fe4[_0xa8e3('0x8c')]=_0x461486['id'];_0x2cc096(_0x200fe4);});}});}exports[_0xa8e3('0x95')]=function(_0x3d0818,_0x403bd6){return db[_0xa8e3('0x89')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3d0818[_0xa8e3('0x5e')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xa8e3('0x64')],'as':_0xa8e3('0x65')}],'order':[[_0xa8e3('0x8e')],[db[_0xa8e3('0x66')][_0xa8e3('0x67')](_0xa8e3('0x93'))]]})[_0xa8e3('0x19')](function(_0x3e9f32){return _0x3e9f32;})[_0xa8e3('0x19')](respondWithResult(_0x403bd6,null))[_0xa8e3('0x22')](handleError(_0x403bd6,null));};exports['duplicateAdditionalPhones']=function(_0x110b9b,_0x3dfaf6){return db[_0xa8e3('0x89')][_0xa8e3('0x1f')]({'raw':!![],'where':{'CmContactId':_0x110b9b['body'][_0xa8e3('0x96')]}})[_0xa8e3('0x19')](function(_0x518334){var _0x2ffc2d=_[_0xa8e3('0x71')](_0x518334,function(_0x4d6a9e){_0x4d6a9e[_0xa8e3('0x97')]=_0x110b9b['body'][_0xa8e3('0x98')];return _0x4d6a9e;});return db['CmContactHasItem']['bulkCreate'](_0x2ffc2d,{});})[_0xa8e3('0x19')](function(){return addCmHopperPhones(_0x110b9b[_0xa8e3('0x36')][_0xa8e3('0x98')]);})[_0xa8e3('0x19')](function(){return['ok'];})[_0xa8e3('0x19')](respondWithResult(_0x3dfaf6,null))[_0xa8e3('0x22')](handleError(_0x3dfaf6,null));};exports[_0xa8e3('0x99')]=function(_0x2fc428,_0x4923a1){var _0x2ba890=[];_0x2ba890[_0xa8e3('0x59')](createCmHopperPhone(_0x2fc428[_0xa8e3('0x36')]['id'],_0x2fc428[_0xa8e3('0x36')]['hopperId']));Promise[_0xa8e3('0x5c')](_0x2ba890)[_0xa8e3('0x19')](function(){return[0x1];})['then'](respondWithResult(_0x4923a1,null));};exports['getHoppers']=function(_0x10dd28,_0x14fee2){var _0x22fccd={'raw':![],'where':{}};var _0x2af1e7={};var _0x457005={'count':0x0,'rows':[]};return db[_0xa8e3('0x23')][_0xa8e3('0x7a')]({'where':{'id':_0x10dd28[_0xa8e3('0x5e')]['id']}})[_0xa8e3('0x19')](handleEntityNotFound(_0x14fee2,null))[_0xa8e3('0x19')](function(_0x1dc9cb){if(_0x1dc9cb){_0x2af1e7[_0xa8e3('0x80')]=_[_0xa8e3('0x26')](db['CmHopper']['rawAttributes']);_0x2af1e7[_0xa8e3('0x20')]=_[_0xa8e3('0x26')](_0x10dd28['query']);_0x2af1e7[_0xa8e3('0x7c')]=_[_0xa8e3('0x7d')](_0x2af1e7['model'],_0x2af1e7[_0xa8e3('0x20')]);_0x22fccd[_0xa8e3('0x7f')]=_[_0xa8e3('0x7d')](_0x2af1e7[_0xa8e3('0x80')],qs[_0xa8e3('0x7e')](_0x10dd28[_0xa8e3('0x20')]['fields']));_0x22fccd['attributes']=_0x22fccd['attributes'][_0xa8e3('0x27')]?_0x22fccd['attributes']:_0x2af1e7[_0xa8e3('0x80')];if(!_0x10dd28['query'][_0xa8e3('0x34')]('nolimit')){_0x22fccd[_0xa8e3('0x15')]=qs[_0xa8e3('0x15')](_0x10dd28[_0xa8e3('0x20')][_0xa8e3('0x15')]);_0x22fccd[_0xa8e3('0x12')]=qs[_0xa8e3('0x12')](_0x10dd28[_0xa8e3('0x20')][_0xa8e3('0x12')]);}_0x22fccd['order']=qs[_0xa8e3('0x81')](_0x10dd28[_0xa8e3('0x20')]['sort']);_0x22fccd[_0xa8e3('0x57')]=qs[_0xa8e3('0x7c')](_['pick'](_0x10dd28['query'],_0x2af1e7[_0xa8e3('0x7c')]));_0x22fccd['where'][_0xa8e3('0x9a')]=_0x1dc9cb['id'];if(_0x10dd28[_0xa8e3('0x20')][_0xa8e3('0x83')]){_0x22fccd['where']=_[_0xa8e3('0x35')](_0x22fccd['where'],{'$or':_['map'](_0x22fccd[_0xa8e3('0x7f')],function(_0x5595dd){var _0x216b19={};_0x216b19[_0x5595dd]={'$like':'%'+_0x10dd28[_0xa8e3('0x20')][_0xa8e3('0x83')]+'%'};return _0x216b19;})});}_0x22fccd=_[_0xa8e3('0x35')]({},_0x22fccd,_0x10dd28[_0xa8e3('0x84')]);return db[_0xa8e3('0x3a')][_0xa8e3('0x14')]({'where':_0x22fccd[_0xa8e3('0x57')]})[_0xa8e3('0x19')](function(_0x37ae6a){_0x457005['count']=_0x37ae6a;if(_0x10dd28[_0xa8e3('0x20')][_0xa8e3('0x9b')]){_0x22fccd['include']=[{'all':!![]}];}return db[_0xa8e3('0x3a')][_0xa8e3('0x1f')](_0x22fccd);})[_0xa8e3('0x19')](function(_0x2fc9f9){_0x457005[_0xa8e3('0x9c')]=_0x2fc9f9;return _0x457005;});}})['then'](respondWithFilteredResult(_0x14fee2,_0x22fccd))['catch'](handleError(_0x14fee2,null));};exports['getHopperHistories']=function(_0x37f408,_0x17016c){var _0x6ff5d7={'raw':!![],'where':{}};var _0x5b70ed={};var _0x4f0afc={'count':0x0,'rows':[]};return db[_0xa8e3('0x23')][_0xa8e3('0x7a')]({'where':{'id':_0x37f408[_0xa8e3('0x5e')]['id']}})[_0xa8e3('0x19')](handleEntityNotFound(_0x17016c,null))[_0xa8e3('0x19')](function(_0x22ea87){if(_0x22ea87){_0x5b70ed['model']=_[_0xa8e3('0x26')](db['CmHopperHistory'][_0xa8e3('0x7b')]);_0x5b70ed['query']=_[_0xa8e3('0x26')](_0x37f408[_0xa8e3('0x20')]);_0x5b70ed[_0xa8e3('0x7c')]=_[_0xa8e3('0x7d')](_0x5b70ed[_0xa8e3('0x80')],_0x5b70ed[_0xa8e3('0x20')]);_0x6ff5d7['attributes']=_[_0xa8e3('0x7d')](_0x5b70ed[_0xa8e3('0x80')],qs[_0xa8e3('0x7e')](_0x37f408[_0xa8e3('0x20')][_0xa8e3('0x7e')]));_0x6ff5d7[_0xa8e3('0x7f')]=_0x6ff5d7[_0xa8e3('0x7f')]['length']?_0x6ff5d7[_0xa8e3('0x7f')]:_0x5b70ed[_0xa8e3('0x80')];if(!_0x37f408['query'][_0xa8e3('0x34')](_0xa8e3('0x85'))){_0x6ff5d7['limit']=qs['limit'](_0x37f408[_0xa8e3('0x20')][_0xa8e3('0x15')]);_0x6ff5d7[_0xa8e3('0x12')]=qs[_0xa8e3('0x12')](_0x37f408[_0xa8e3('0x20')]['offset']);}_0x6ff5d7[_0xa8e3('0x9d')]=qs[_0xa8e3('0x81')](_0x37f408[_0xa8e3('0x20')][_0xa8e3('0x81')]);_0x6ff5d7[_0xa8e3('0x57')]=qs[_0xa8e3('0x7c')](_[_0xa8e3('0x82')](_0x37f408[_0xa8e3('0x20')],_0x5b70ed[_0xa8e3('0x7c')]));_0x6ff5d7[_0xa8e3('0x57')][_0xa8e3('0x9a')]=_0x22ea87['id'];if(_0x37f408[_0xa8e3('0x20')][_0xa8e3('0x83')]){_0x6ff5d7[_0xa8e3('0x57')]=_['merge'](_0x6ff5d7[_0xa8e3('0x57')],{'$or':_[_0xa8e3('0x71')](_0x6ff5d7['attributes'],function(_0x3475a6){var _0xfaeb75={};_0xfaeb75[_0x3475a6]={'$like':'%'+_0x37f408[_0xa8e3('0x20')]['filter']+'%'};return _0xfaeb75;})});}_0x6ff5d7=_[_0xa8e3('0x35')]({},_0x6ff5d7,_0x37f408[_0xa8e3('0x84')]);return db['CmHopperHistory']['count']({'where':_0x6ff5d7[_0xa8e3('0x57')]})[_0xa8e3('0x19')](function(_0x3fc022){_0x4f0afc[_0xa8e3('0x14')]=_0x3fc022;if(_0x37f408[_0xa8e3('0x20')][_0xa8e3('0x9b')]){_0x6ff5d7[_0xa8e3('0x9e')]=[{'all':!![]}];}return db[_0xa8e3('0x48')][_0xa8e3('0x1f')](_0x6ff5d7);})[_0xa8e3('0x19')](function(_0x383c66){_0x4f0afc['rows']=_0x383c66;return _0x4f0afc;});}})[_0xa8e3('0x19')](respondWithFilteredResult(_0x17016c,_0x6ff5d7))[_0xa8e3('0x22')](handleError(_0x17016c,null));};exports[_0xa8e3('0x9f')]=function(_0x3d999b,_0x25d606){var _0xecdfea={'raw':!![],'where':{}};var _0x49c5f1={};var _0x5dc8b9={'count':0x0,'rows':[]};return db[_0xa8e3('0x23')][_0xa8e3('0x7a')]({'where':{'id':_0x3d999b['params']['id']}})[_0xa8e3('0x19')](handleEntityNotFound(_0x25d606,null))[_0xa8e3('0x19')](function(_0x5927ba){if(_0x5927ba){_0x49c5f1['model']=_[_0xa8e3('0x26')](db['CmHopperFinal'][_0xa8e3('0x7b')]);_0x49c5f1[_0xa8e3('0x20')]=_[_0xa8e3('0x26')](_0x3d999b['query']);_0x49c5f1[_0xa8e3('0x7c')]=_[_0xa8e3('0x7d')](_0x49c5f1['model'],_0x49c5f1[_0xa8e3('0x20')]);_0xecdfea[_0xa8e3('0x7f')]=_['intersection'](_0x49c5f1[_0xa8e3('0x80')],qs[_0xa8e3('0x7e')](_0x3d999b[_0xa8e3('0x20')][_0xa8e3('0x7e')]));_0xecdfea[_0xa8e3('0x7f')]=_0xecdfea['attributes']['length']?_0xecdfea[_0xa8e3('0x7f')]:_0x49c5f1[_0xa8e3('0x80')];if(!_0x3d999b['query'][_0xa8e3('0x34')](_0xa8e3('0x85'))){_0xecdfea[_0xa8e3('0x15')]=qs[_0xa8e3('0x15')](_0x3d999b[_0xa8e3('0x20')]['limit']);_0xecdfea[_0xa8e3('0x12')]=qs[_0xa8e3('0x12')](_0x3d999b[_0xa8e3('0x20')][_0xa8e3('0x12')]);}_0xecdfea[_0xa8e3('0x9d')]=qs[_0xa8e3('0x81')](_0x3d999b[_0xa8e3('0x20')][_0xa8e3('0x81')]);_0xecdfea['where']=qs['filters'](_[_0xa8e3('0x82')](_0x3d999b[_0xa8e3('0x20')],_0x49c5f1[_0xa8e3('0x7c')]));_0xecdfea['where']['ContactId']=_0x5927ba['id'];if(_0x3d999b[_0xa8e3('0x20')][_0xa8e3('0x83')]){_0xecdfea[_0xa8e3('0x57')]=_['merge'](_0xecdfea[_0xa8e3('0x57')],{'$or':_['map'](_0xecdfea[_0xa8e3('0x7f')],function(_0x226a43){var _0x1d57e2={};_0x1d57e2[_0x226a43]={'$like':'%'+_0x3d999b[_0xa8e3('0x20')][_0xa8e3('0x83')]+'%'};return _0x1d57e2;})});}_0xecdfea=_[_0xa8e3('0x35')]({},_0xecdfea,_0x3d999b[_0xa8e3('0x84')]);return db[_0xa8e3('0x47')][_0xa8e3('0x14')]({'where':_0xecdfea[_0xa8e3('0x57')]})[_0xa8e3('0x19')](function(_0x4ac96d){_0x5dc8b9[_0xa8e3('0x14')]=_0x4ac96d;if(_0x3d999b[_0xa8e3('0x20')]['includeAll']){_0xecdfea['include']=[{'all':!![]}];}return db[_0xa8e3('0x47')][_0xa8e3('0x1f')](_0xecdfea);})[_0xa8e3('0x19')](function(_0x7d6888){_0x5dc8b9['rows']=_0x7d6888;return _0x5dc8b9;});}})[_0xa8e3('0x19')](respondWithFilteredResult(_0x25d606,_0xecdfea))[_0xa8e3('0x22')](handleError(_0x25d606,null));};exports[_0xa8e3('0xa0')]=function(_0x58ba86,_0x2eb894){var _0x4af35c={'raw':!![],'where':{}};var _0x4b35ab={};var _0x331cf4={'count':0x0,'rows':[]};return db[_0xa8e3('0x23')][_0xa8e3('0x7a')]({'where':{'id':_0x58ba86[_0xa8e3('0x5e')]['id']}})[_0xa8e3('0x19')](handleEntityNotFound(_0x2eb894,null))[_0xa8e3('0x19')](function(_0x59c5fa){if(_0x59c5fa){_0x4b35ab[_0xa8e3('0x80')]=_['keys'](db[_0xa8e3('0xa1')][_0xa8e3('0x7b')]);_0x4b35ab[_0xa8e3('0x20')]=_[_0xa8e3('0x26')](_0x58ba86[_0xa8e3('0x20')]);_0x4b35ab['filters']=_[_0xa8e3('0x7d')](_0x4b35ab[_0xa8e3('0x80')],_0x4b35ab[_0xa8e3('0x20')]);_0x4af35c['attributes']=_[_0xa8e3('0x7d')](_0x4b35ab[_0xa8e3('0x80')],qs[_0xa8e3('0x7e')](_0x58ba86[_0xa8e3('0x20')][_0xa8e3('0x7e')]));_0x4af35c[_0xa8e3('0x7f')]=_0x4af35c['attributes'][_0xa8e3('0x27')]?_0x4af35c[_0xa8e3('0x7f')]:_0x4b35ab[_0xa8e3('0x80')];if(!_0x58ba86['query'][_0xa8e3('0x34')](_0xa8e3('0x85'))){_0x4af35c[_0xa8e3('0x15')]=qs[_0xa8e3('0x15')](_0x58ba86['query'][_0xa8e3('0x15')]);_0x4af35c[_0xa8e3('0x12')]=qs[_0xa8e3('0x12')](_0x58ba86[_0xa8e3('0x20')]['offset']);}_0x4af35c[_0xa8e3('0x9d')]=qs['sort'](_0x58ba86['query'][_0xa8e3('0x81')]);_0x4af35c[_0xa8e3('0x57')]=qs['filters'](_['pick'](_0x58ba86[_0xa8e3('0x20')],_0x4b35ab[_0xa8e3('0x7c')]));_0x4af35c[_0xa8e3('0x57')][_0xa8e3('0x9a')]=_0x59c5fa['id'];if(_0x58ba86[_0xa8e3('0x20')][_0xa8e3('0x83')]){_0x4af35c[_0xa8e3('0x57')]=_[_0xa8e3('0x35')](_0x4af35c[_0xa8e3('0x57')],{'$or':_[_0xa8e3('0x71')](_0x4af35c[_0xa8e3('0x7f')],function(_0x24cd6f){var _0x263c8={};_0x263c8[_0x24cd6f]={'$like':'%'+_0x58ba86[_0xa8e3('0x20')][_0xa8e3('0x83')]+'%'};return _0x263c8;})});}_0x4af35c=_[_0xa8e3('0x35')]({},_0x4af35c,_0x58ba86[_0xa8e3('0x84')]);return db[_0xa8e3('0xa1')][_0xa8e3('0x14')]({'where':_0x4af35c['where']})['then'](function(_0x32a299){_0x331cf4[_0xa8e3('0x14')]=_0x32a299;if(_0x58ba86['query']['includeAll']){_0x4af35c[_0xa8e3('0x9e')]=[{'all':!![]}];}return db[_0xa8e3('0xa1')][_0xa8e3('0x1f')](_0x4af35c);})['then'](function(_0x2cc515){_0x331cf4['rows']=_0x2cc515;return _0x331cf4;});}})[_0xa8e3('0x19')](respondWithFilteredResult(_0x2eb894,_0x4af35c))[_0xa8e3('0x22')](handleError(_0x2eb894,null));};exports[_0xa8e3('0xa2')]=function(_0x54eb1e,_0x4f15ef){try{if(!_0x54eb1e['body'][_0xa8e3('0x5a')]){throw new Error(_0xa8e3('0xa3'));}if(!_0x54eb1e[_0xa8e3('0x36')][_0xa8e3('0xa4')]){throw new Error(_0xa8e3('0xa5'));}if(!_0x54eb1e['body']['binding_values']){throw new Error(_0xa8e3('0xa6'));}if(!_0x54eb1e[_0xa8e3('0x36')]['socket_timestamp']){throw new Error(_0xa8e3('0xa7'));}var _0x2b618e=_0x54eb1e[_0xa8e3('0x36')][_0xa8e3('0xa4')][_0xa8e3('0xa8')](',');var _0x3ad094=_0x54eb1e[_0xa8e3('0x36')][_0xa8e3('0xa9')][_0xa8e3('0xa8')](',');if(!_0x2b618e[_0xa8e3('0x27')]||!_0x3ad094[_0xa8e3('0x27')]||_0x2b618e[_0xa8e3('0x27')]!==_0x3ad094[_0xa8e3('0x27')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x54eb1e[_0xa8e3('0x36')][_0xa8e3('0x7e')]=_[_0xa8e3('0xaa')](_0x2b618e,_0x3ad094);if(!_0x54eb1e['body'][_0xa8e3('0x7e')][_0xa8e3('0x78')]){throw new Error(_0xa8e3('0xab'));}if(!_0x54eb1e[_0xa8e3('0x36')]['fields'][_0xa8e3('0xac')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x1241ee=path[_0xa8e3('0x39')](config[_0xa8e3('0xad')],_0xa8e3('0xae'),_0x54eb1e[_0xa8e3('0xaf')][_0xa8e3('0xb0')]);fs[_0xa8e3('0xb1')](_0x1241ee,parseInt(_0xa8e3('0xb2'),0x8));var _0x20c895=require(_0xa8e3('0xb3'))['fork'](path[_0xa8e3('0x39')](__dirname,_0xa8e3('0xb4')),[_0x1241ee,_0x54eb1e['body']['binding_keys'],_0x54eb1e['body'][_0xa8e3('0xa9')],_0x54eb1e[_0xa8e3('0x36')][_0xa8e3('0x5a')],_0x54eb1e['body'][_0xa8e3('0xb5')],_0x54eb1e['body']['duplicates'],_0x54eb1e[_0xa8e3('0x36')][_0xa8e3('0xb6')]]);return _0x4f15ef[_0xa8e3('0x10')](0xc8)[_0xa8e3('0x11')]({'message':_0xa8e3('0xb7'),'pid':_0x20c895['pid']});}catch(_0x5149b2){return _0x4f15ef[_0xa8e3('0x10')](0x1f4)[_0xa8e3('0xb8')](_0x5149b2);}};exports[_0xa8e3('0xb9')]=function(_0x5ce8c8,_0x340f81){var _0x453e5e=fs[_0xa8e3('0xba')](_0x5ce8c8['file'][_0xa8e3('0x2')]);Papa['parse'](_0x453e5e,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3de667){return _0x340f81[_0xa8e3('0x10')](0xc8)[_0xa8e3('0x11')]({'file':_0x5ce8c8[_0xa8e3('0xaf')],'fields':_0x3de667[_0xa8e3('0xbb')]['fields']});}});};exports[_0xa8e3('0xbc')]=function(_0x8863db,_0x5958c4){return db['User'][_0xa8e3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xa8e3('0xbd')}})[_0xa8e3('0x19')](function(_0x18e5e9){var _0x1fa836=![];if(!_0x8863db['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x8863db[_0xa8e3('0x36')]['binding'][_0xa8e3('0x78')]){throw new Error(_0xa8e3('0xab'));}if(!_0x8863db['body'][_0xa8e3('0xbe')][_0xa8e3('0xac')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x8863db[_0xa8e3('0x36')]['socket_timestamp']){throw new Error(_0xa8e3('0xa7'));}var _0x16798a=require(_0xa8e3('0xb3'))[_0xa8e3('0xbf')](path[_0xa8e3('0x39')](__dirname,_0xa8e3('0xc0')),[_0x8863db[_0xa8e3('0x5e')]['id'],JSON[_0xa8e3('0xc1')](_0x8863db['body']),JSON[_0xa8e3('0xc1')](_0x18e5e9)]);_0x16798a['on'](_0xa8e3('0xc2'),function(){_0x1fa836=!![];return _0x5958c4[_0xa8e3('0x10')](0xc8)[_0xa8e3('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x16798a[_0xa8e3('0xc3')]});});_0x16798a['on'](_0xa8e3('0xc4'),function(_0x19df17){if(_0x19df17&&!_0x1fa836){return _0x5958c4['status'](0x1f4)[_0xa8e3('0x11')]({'message':_0xa8e3('0xc5'),'pid':_0x16798a[_0xa8e3('0xc3')]});}});})['catch'](handleError(_0x5958c4,null));};exports[_0xa8e3('0xc6')]=function(_0x18115e,_0x28a531){return db[_0xa8e3('0xc7')][_0xa8e3('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xa8e3('0xbd')}})[_0xa8e3('0x19')](function(_0xce21af){var _0x38d7ab=![];if(!_0x18115e[_0xa8e3('0x36')]['ListId']){throw new Error(_0xa8e3('0xa3'));}if(!_0x18115e['body']['binding'][_0xa8e3('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x18115e[_0xa8e3('0x36')][_0xa8e3('0xbe')][_0xa8e3('0xac')]){throw new Error(_0xa8e3('0xc8'));}if(!_0x18115e['body'][_0xa8e3('0xb6')]){throw new Error(_0xa8e3('0xa7'));}var _0x2b87da=require(_0xa8e3('0xb3'))[_0xa8e3('0xbf')](path[_0xa8e3('0x39')](__dirname,_0xa8e3('0xc9')),[_0x18115e[_0xa8e3('0x5e')]['id'],JSON[_0xa8e3('0xc1')](_0x18115e['body']),JSON[_0xa8e3('0xc1')](_0xce21af)]);_0x2b87da['on'](_0xa8e3('0xc2'),function(){_0x38d7ab=!![];return _0x28a531[_0xa8e3('0x10')](0xc8)[_0xa8e3('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x2b87da[_0xa8e3('0xc3')]});});_0x2b87da['on'](_0xa8e3('0xc4'),function(_0x39687e){if(_0x39687e&&!_0x38d7ab){return _0x28a531[_0xa8e3('0x10')](0x1f4)['json']({'message':_0xa8e3('0xc5'),'pid':_0x2b87da[_0xa8e3('0xc3')]});}});})[_0xa8e3('0x22')](handleError(_0x28a531,null));};exports[_0xa8e3('0xca')]=function(_0x260686,_0xa81227){var _0x4852fa=[_0xa8e3('0xcb'),_0xa8e3('0xcc'),_0xa8e3('0xcd'),'openchannel',_0xa8e3('0xce'),_0xa8e3('0xcf'),_0xa8e3('0xd0')];var _0x19b31a={'offset':0x0,'order':qs[_0xa8e3('0x81')]('-createdAt')},_0x41197b={'count':0x0,'rows':[]};Promise[_0xa8e3('0xd1')]()[_0xa8e3('0x19')](function(){if(_0x260686[_0xa8e3('0x20')]['channel']){if(!_[_0xa8e3('0xd2')](_0x4852fa,_0x260686[_0xa8e3('0x20')][_0xa8e3('0xd3')][_0xa8e3('0xd4')]())){throw new Error('Invalid\x20channel');}_0x4852fa=[_0x260686[_0xa8e3('0x20')][_0xa8e3('0xd3')][_0xa8e3('0xd4')]()];}if(_0x260686[_0xa8e3('0x20')][_0xa8e3('0xd5')]){try{var _0x42131f=JSON[_0xa8e3('0xd6')](_0x260686['query']['range']);if(!moment(_0x42131f['from'])[_0xa8e3('0xd7')]()){throw new Error(_0xa8e3('0xd8'));}if(!moment(_0x42131f['to'])[_0xa8e3('0xd7')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x3340fa){throw new Error(_0xa8e3('0xd9'));}}if(!_0x260686[_0xa8e3('0x20')][_0xa8e3('0x34')](_0xa8e3('0x85'))){_0x19b31a[_0xa8e3('0x15')]=qs[_0xa8e3('0x15')](_0x260686['query']['limit']||0xa);_0x19b31a[_0xa8e3('0x12')]=qs[_0xa8e3('0x12')](_0x260686[_0xa8e3('0x20')][_0xa8e3('0x12')]);}var _0x5ead96=_0x4852fa[_0xa8e3('0x71')](function(_0x431c02){if(_0x431c02==='voice'){var _0x1be883={'attributes':['id',_0xa8e3('0xda'),_0xa8e3('0x2f'),'source',_0xa8e3('0xdb'),'callerid',_0xa8e3('0xdc'),'endtime',_0xa8e3('0xdd'),'note',_0xa8e3('0xde'),'userDisposition',_0xa8e3('0xdf'),_0xa8e3('0xe0'),_0xa8e3('0xe1')],'where':{'ContactId':_0x260686[_0xa8e3('0x5e')]['id']},'include':[{'model':db[_0xa8e3('0xc7')],'as':_0xa8e3('0xc7'),'attributes':['id',_0xa8e3('0x1c'),_0xa8e3('0xe2'),_0xa8e3('0x2d')]}],'order':[[_0xa8e3('0xde'),_0xa8e3('0xe3')]]};if(_0x260686[_0xa8e3('0x20')]['range']){_0x1be883[_0xa8e3('0x57')][_0xa8e3('0xde')]={'$gte':_0x42131f[_0xa8e3('0x37')],'$lte':_0x42131f['to']};}return db[_0xa8e3('0x4a')][_0xa8e3('0xe4')](_0x1be883)['then'](function(_0x202f69){_0x41197b[_0xa8e3('0x14')]+=_0x202f69[_0xa8e3('0x14')];return _[_0xa8e3('0x71')](_0x202f69[_0xa8e3('0x9c')],function(_0x3b2241){var _0x17b00f=_0x3b2241[_0xa8e3('0x69')]({'plain':!![]});_0x17b00f[_0xa8e3('0xd3')]=_0x431c02;if(_0x17b00f[_0xa8e3('0xc7')]){_0x17b00f['User']={'id':_0x17b00f[_0xa8e3('0xc7')]['id'],'name':_0x17b00f[_0xa8e3('0xc7')]['name'],'fullname':_0x17b00f[_0xa8e3('0xc7')][_0xa8e3('0xe2')],'alias':_0x17b00f[_0xa8e3('0xc7')][_0xa8e3('0x2d')]};}return _0x17b00f;});});}else{var _0x48f248=_[_0xa8e3('0xe5')](_0x431c02)+(_0x431c02===_0xa8e3('0xcc')?_0xa8e3('0xe6'):_0xa8e3('0xe7'));var _0x440974={'attributes':['id',_0xa8e3('0xe8'),'closedAt',_0xa8e3('0xde'),_0xa8e3('0xe9'),_0xa8e3('0xea'),_0xa8e3('0xeb'),_0xa8e3('0xec'),_0xa8e3('0xe1'),_0x48f248+'Id'],'where':{'ContactId':_0x260686[_0xa8e3('0x5e')]['id']},'include':[{'model':db[_0x48f248],'as':_0xa8e3('0xe7'),'attributes':['id','name',_0xa8e3('0xed')]},{'model':db[_0xa8e3('0xc7')],'as':_0xa8e3('0xee'),'attributes':['id',_0xa8e3('0x1c'),_0xa8e3('0xe2')]},{'model':db[_0xa8e3('0x5f')],'as':_0xa8e3('0x60'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[[_0xa8e3('0xde'),_0xa8e3('0xe3')]]};if(_0x260686[_0xa8e3('0x20')]['range']){_0x440974[_0xa8e3('0x57')][_0xa8e3('0xde')]={'$gte':_0x42131f[_0xa8e3('0x37')],'$lte':_0x42131f['to']};}switch(_0x431c02){case _0xa8e3('0xcc'):_0x440974[_0xa8e3('0x7f')]['push'](_0xa8e3('0xef'),_0xa8e3('0xf0'),_0xa8e3('0xf1'),'deviceModel',_0xa8e3('0xf2'),_0xa8e3('0xf3'),_0xa8e3('0xf4'),_0xa8e3('0xf5'),'referer');break;case'mail':_0x440974[_0xa8e3('0x7f')][_0xa8e3('0x59')]('subject','substatus');break;case'openchannel':_0x440974[_0xa8e3('0x7f')][_0xa8e3('0x59')]('externalUrl',_0xa8e3('0xf6'));break;}return db[_[_0xa8e3('0xe5')](_0x431c02)+'Interaction'][_0xa8e3('0xe4')](_0x440974)[_0xa8e3('0x19')](function(_0x5ae7bb){_0x41197b[_0xa8e3('0x14')]+=_0x5ae7bb[_0xa8e3('0x14')];return _[_0xa8e3('0x71')](_0x5ae7bb[_0xa8e3('0x9c')],function(_0x29b558){var _0x2fb66c=_0x29b558[_0xa8e3('0x69')]({'plain':!![]});_0x2fb66c[_0xa8e3('0xd3')]=_0x431c02;if(_0x2fb66c[_0xa8e3('0xee')]){_0x2fb66c[_0xa8e3('0xee')]={'id':_0x2fb66c[_0xa8e3('0xee')]['id'],'name':_0x2fb66c[_0xa8e3('0xee')][_0xa8e3('0x1c')],'fullname':_0x2fb66c[_0xa8e3('0xee')][_0xa8e3('0xe2')]};}return _0x2fb66c;});});}});return Promise[_0xa8e3('0x5c')](_0x5ead96);})['then'](function(_0x1d83c4){return _(_0x1d83c4)['flatten']()[_0xa8e3('0xf7')](_0xa8e3('0xde'))['reverse']()[_0xa8e3('0xf8')]();})[_0xa8e3('0x19')](function(_0xfc14c2){_0x41197b[_0xa8e3('0x9c')]=_0x19b31a['limit']?_0xfc14c2[_0xa8e3('0xf9')](_0x19b31a[_0xa8e3('0x12')],_0x19b31a[_0xa8e3('0x12')]+_0x19b31a['limit']):_0xfc14c2;return _0x41197b;})[_0xa8e3('0x19')](respondWithFilteredResult(_0xa81227,_0x19b31a))['catch'](handleError(_0xa81227,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index dc7e806..42069fe 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 _0xa813=['hasOwnProperty','exports','events','../../mysqldb','save','remove','emit'];(function(_0x479722,_0x231cef){var _0x2310fe=function(_0xd96529){while(--_0xd96529){_0x479722['push'](_0x479722['shift']());}};_0x2310fe(++_0x231cef);}(_0xa813,0x144));var _0x3a81=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xa813[_0x39096d];return _0x13da4f;};'use strict';var EventEmitter=require(_0x3a81('0x0'));var CmContact=require(_0x3a81('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3a81('0x2'),'afterUpdate':'update','afterDestroy':_0x3a81('0x3')};function emitEvent(_0x46d31e){return function(_0x4d6e31,_0xe018bd,_0x14ce59){CmContactEvents[_0x3a81('0x4')](_0x46d31e+':'+_0x4d6e31['id'],_0x4d6e31);CmContactEvents['emit'](_0x46d31e,_0x4d6e31);_0x14ce59(null);};}for(var e in events){if(events[_0x3a81('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x3a81('0x6')]=CmContactEvents; \ No newline at end of file +var _0x76a4=['emit','hasOwnProperty','hook','events','../../mysqldb','CmContact','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76a4,0xe9));var _0x476a=function(_0x2e8054,_0x18d274){_0x2e8054=_0x2e8054-0x0;var _0x1870d2=_0x76a4[_0x2e8054];return _0x1870d2;};'use strict';var EventEmitter=require(_0x476a('0x0'));var CmContact=require(_0x476a('0x1'))['db'][_0x476a('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x476a('0x3')](0x0);var events={'afterCreate':_0x476a('0x4'),'afterUpdate':_0x476a('0x5'),'afterDestroy':_0x476a('0x6')};function emitEvent(_0x42b17d){return function(_0x203d73,_0x33a0fb,_0x14446e){CmContactEvents[_0x476a('0x7')](_0x42b17d+':'+_0x203d73['id'],_0x203d73);CmContactEvents[_0x476a('0x7')](_0x42b17d,_0x203d73);_0x14446e(null);};}for(var e in events){if(events[_0x476a('0x8')](e)){var event=events[e];CmContact[_0x476a('0x9')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 4280529..747c913 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 _0xbf44=['CmContact','fti_cm_contacts','firstName','lastName','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','length','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','timezones','utcOffset','add','minutes','phone','ListId','priority','callbackUniqueid','assign','findOne','then','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','CmHopper','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','always','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','map','all','Campaign','outbound','BlackLists','CmHopperBlack','exports','define'];(function(_0x1332d8,_0x5e34a5){var _0x109ea9=function(_0xbec8c){while(--_0xbec8c){_0x1332d8['push'](_0x1332d8['shift']());}};_0x109ea9(++_0x5e34a5);}(_0xbf44,0x9e));var _0x4bf4=function(_0x10548e,_0x80eaff){_0x10548e=_0x10548e-0x0;var _0x540aa4=_0xbf44[_0x10548e];return _0x540aa4;};'use strict';var _=require(_0x4bf4('0x0'));var util=require(_0x4bf4('0x1'));var logger=require(_0x4bf4('0x2'))(_0x4bf4('0x3'));var moment=require('moment');var shared=require(_0x4bf4('0x4'));var attributes=require(_0x4bf4('0x5'));function getTimezoneCallbackAt(_0xefcfda,_0x37d5f9,_0x1c12b0,_0x35e5fb){var _0x5728d6=_0x35e5fb?'Campaign':'VoiceQueue';var _0x4aeafe=_0x1c12b0[_0x4bf4('0x6')]?_0x1c12b0[_0x4bf4('0x6')]:moment()[_0x4bf4('0x7')](_0x4bf4('0x8'));if(_[_0x4bf4('0x9')](_0x1c12b0['dialTimezone'])){return Promise['resolve'](_0x4aeafe);}return _0xefcfda[_0x5728d6]['findOne']({'where':{'id':_0x37d5f9}})['then'](function(_0x4f409b){if(_[_0x4bf4('0x9')](_0x4f409b)||_[_0x4bf4('0x9')](_0x4f409b[_0x4bf4('0xa')])){return Promise[_0x4bf4('0xb')](_0x4aeafe);}var _0x19f6d5=shared[_0x4bf4('0xc')];var _0x19e8aa=_0x19f6d5[_0x4f409b[_0x4bf4('0xa')]];var _0x73bdaa=_0x19f6d5[_0x1c12b0[_0x4bf4('0xa')]];if(_[_0x4bf4('0x9')](_0x19e8aa)&&_[_0x4bf4('0x9')](_0x73bdaa)){return Promise[_0x4bf4('0xb')](_0x4aeafe);}var _0x8f5ffe=_0x19e8aa['utcOffset']-_0x73bdaa[_0x4bf4('0xd')];var _0x4dfe0a=_0x1c12b0[_0x4bf4('0x6')]?_0x1c12b0[_0x4bf4('0x6')]:moment();_0x4aeafe=moment(_0x4dfe0a)[_0x4bf4('0xe')](_0x8f5ffe,_0x4bf4('0xf'))[_0x4bf4('0x7')](_0x4bf4('0x8'));return Promise[_0x4bf4('0xb')](_0x4aeafe);});}function getNewHopperPayload(_0x2d0155){return{'phone':_0x2d0155[_0x4bf4('0x10')],'ContactId':_0x2d0155['id'],'ListId':_0x2d0155[_0x4bf4('0x11')],'scheduledat':_0x2d0155[_0x4bf4('0x6')]?_0x2d0155['scheduledat']:moment()[_0x4bf4('0x7')](_0x4bf4('0x8')),'priority':_0x2d0155['priority']?_0x2d0155[_0x4bf4('0x12')]:0x2,'callback':_0x2d0155[_0x4bf4('0x13')]?!![]:![],'callbackuniqueid':_0x2d0155[_0x4bf4('0x13')]?_0x2d0155[_0x4bf4('0x13')]:undefined,'callbackat':_0x2d0155[_0x4bf4('0x13')]?moment()[_0x4bf4('0x7')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x54e666,_0xeb9be,_0x502e85,_0x44551f){var _0x2f5cea={'phone':_0x502e85['phone']};var _0xef067c={'calleridnum':_0x502e85['phone']};if(_0x44551f){Object[_0x4bf4('0x14')](_0x2f5cea,{'CampaignId':_0xeb9be['id']});Object[_0x4bf4('0x14')](_0xef067c,{'CampaignId':_0xeb9be['id']});}else{Object['assign'](_0x2f5cea,{'VoiceQueueId':_0xeb9be['id']});Object[_0x4bf4('0x14')](_0xef067c,{'VoiceQueueId':_0xeb9be['id']});}return _0x54e666['CmHopper'][_0x4bf4('0x15')]({'where':_0x2f5cea})[_0x4bf4('0x16')](function(_0x392702){if(_0x392702){throw new Error(_0x4bf4('0x17')+_0x502e85[_0x4bf4('0x10')]+_0x4bf4('0x18')+_0xeb9be['id']);}return _0x54e666[_0x4bf4('0x19')][_0x4bf4('0x15')]({'where':_0xef067c});})['then'](function(_0x458181){if(_0x458181){throw new Error(_0x4bf4('0x1a')+_0x502e85[_0x4bf4('0x10')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0xeb9be['id']);}var _0x408f67=getNewHopperPayload(_0x502e85);if(_0x44551f){_0x408f67['CampaignId']=_0xeb9be['id'];}else{_0x408f67[_0x4bf4('0x1b')]=_0xeb9be['id'];}return _0x54e666[_0x4bf4('0x1c')]['create'](_0x408f67);});}function handleOnlyIfOpenCheckDuplicate(_0x40c428,_0x338c14,_0x3c80f7,_0x1aed6c){var _0x44b15b={'phone':_0x3c80f7[_0x4bf4('0x10')]};if(_0x1aed6c){Object[_0x4bf4('0x14')](_0x44b15b,{'CampaignId':_0x338c14['id']});}else{Object[_0x4bf4('0x14')](_0x44b15b,{'VoiceQueueId':_0x338c14['id']});}return _0x40c428[_0x4bf4('0x1c')][_0x4bf4('0x15')]({'where':_0x44b15b})['then'](function(_0x410926){if(_0x410926){throw new Error(_0x4bf4('0x1d')+_0x3c80f7[_0x4bf4('0x10')]+_0x4bf4('0x18')+_0x338c14['id']);}var _0x1a39e5=getNewHopperPayload(_0x3c80f7);if(_0x1aed6c){_0x1a39e5[_0x4bf4('0x1e')]=_0x338c14['id'];}else{_0x1a39e5[_0x4bf4('0x1b')]=_0x338c14['id'];}return _0x40c428[_0x4bf4('0x1c')][_0x4bf4('0x1f')](_0x1a39e5);});}function handleNeverCheckDuplicate(_0x42156a,_0x58bccc,_0x1f43a6){var _0x30e7a5=getNewHopperPayload(_0x1f43a6);_0x30e7a5['VoiceQueueId']=_0x58bccc['id'];return _0x42156a[_0x4bf4('0x1c')]['create'](_0x30e7a5);}function handleCheckDuplicate(_0x4c4e95,_0x532d2e,_0x3daa2f,_0x279343){return getTimezoneCallbackAt(_0x4c4e95,_0x532d2e,_0x3daa2f,_0x279343)[_0x4bf4('0x16')](function(_0x8167ad){_0x3daa2f[_0x4bf4('0x6')]=_0x8167ad;switch(_0x532d2e['dialCheckDuplicateType']){case _0x4bf4('0x20'):return handleAlwaysCheckDuplicate(_0x4c4e95,_0x532d2e,_0x3daa2f,_0x279343);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x4c4e95,_0x532d2e,_0x3daa2f,_0x279343);default:return handleNeverCheckDuplicate(_0x4c4e95,_0x532d2e,_0x3daa2f);}});}function createHopperForVoiceQueues(_0x4aa429,_0x412261){return _0x4aa429[_0x4bf4('0x21')][_0x4bf4('0x22')]({'where':{'type':'outbound'},'attributes':['id',_0x4bf4('0x23'),'dialTimezone'],'include':[{'model':_0x4aa429[_0x4bf4('0x24')],'as':_0x4bf4('0x25'),'where':{'id':_0x412261['ListId']}}],'raw':!![]})[_0x4bf4('0x16')](function(_0x508cef){var _0x16778f=_0x508cef[_0x4bf4('0x26')](function(_0xadd2bd){return handleCheckDuplicate(_0x4aa429,_0xadd2bd,_0x412261,![]);});return Promise[_0x4bf4('0x27')](_0x16778f);});}function createHopperForCampaigns(_0x5e4288,_0x47c52e){return _0x5e4288[_0x4bf4('0x28')][_0x4bf4('0x22')]({'attributes':['id',_0x4bf4('0x23'),_0x4bf4('0xa')],'include':[{'model':_0x5e4288[_0x4bf4('0x24')],'as':_0x4bf4('0x25'),'where':{'id':_0x47c52e[_0x4bf4('0x11')]}}],'raw':!![]})[_0x4bf4('0x16')](function(_0x40e0af){var _0x4b9ab1=_0x40e0af[_0x4bf4('0x26')](function(_0x4e16e1){return handleCheckDuplicate(_0x5e4288,_0x4e16e1,_0x47c52e,!![]);});return Promise[_0x4bf4('0x27')](_0x4b9ab1);});}function createHopperBlackForVoiceQueues(_0x77bdef,_0x203534){return _0x77bdef['VoiceQueue'][_0x4bf4('0x22')]({'where':{'type':_0x4bf4('0x29')},'attributes':['id'],'include':[{'model':_0x77bdef[_0x4bf4('0x24')],'as':_0x4bf4('0x2a'),'where':{'id':_0x203534[_0x4bf4('0x11')]}}],'raw':!![]})[_0x4bf4('0x16')](function(_0x56969b){var _0x1b27dd=_0x56969b['map'](function(_0x4dbd7d){return _0x77bdef[_0x4bf4('0x2b')][_0x4bf4('0x1f')]({'phone':_0x203534[_0x4bf4('0x10')],'ContactId':_0x203534['id'],'ListId':_0x203534['ListId'],'VoiceQueueId':_0x4dbd7d['id']});});return Promise[_0x4bf4('0x27')](_0x1b27dd);});}function createHopperBlackForCampaigns(_0x35f486,_0x3bff63){return _0x35f486[_0x4bf4('0x28')][_0x4bf4('0x22')]({'attributes':['id'],'include':[{'model':_0x35f486[_0x4bf4('0x24')],'as':_0x4bf4('0x2a'),'where':{'id':_0x3bff63[_0x4bf4('0x11')]}}],'raw':!![]})[_0x4bf4('0x16')](function(_0x5a0837){var _0x793972=_0x5a0837['map'](function(_0x3267e8){return _0x35f486['CmHopperBlack']['create']({'phone':_0x3bff63[_0x4bf4('0x10')],'ContactId':_0x3bff63['id'],'ListId':_0x3bff63[_0x4bf4('0x11')],'CampaignId':_0x3267e8['id']});});return Promise['all'](_0x793972);});}module[_0x4bf4('0x2c')]=function(_0x3e1d80){return _0x3e1d80[_0x4bf4('0x2d')](_0x4bf4('0x2e'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x4bf4('0x10'),'fields':['phone']},{'name':_0x4bf4('0x2f'),'fields':[_0x4bf4('0x30'),_0x4bf4('0x31'),_0x4bf4('0x10'),'mobile','fax',_0x4bf4('0x32')],'type':_0x4bf4('0x33')}],'timestamps':!![],'charset':_0x4bf4('0x34'),'collate':_0x4bf4('0x35'),'hooks':{'afterCreate':function(_0x57b335,_0x3ca242,_0xfbf603){var _0x416c84=_0x3e1d80[_0x4bf4('0x36')];var _0x4654c1=_0x57b335[_0x4bf4('0x37')]({'plain':!![]});if(!_0x4654c1['ListId']){logger[_0x4bf4('0x38')](_0x4bf4('0x39')+_0x4654c1['id']);return _0xfbf603();}if(!_0x4654c1[_0x4bf4('0x10')]){return _0xfbf603();}return createHopperForVoiceQueues(_0x416c84,_0x4654c1)[_0x4bf4('0x16')](function(){return createHopperBlackForVoiceQueues(_0x416c84,_0x4654c1);})[_0x4bf4('0x16')](function(){return createHopperForCampaigns(_0x416c84,_0x4654c1);})[_0x4bf4('0x16')](function(){return createHopperBlackForCampaigns(_0x416c84,_0x4654c1);})['then'](function(){return _0xfbf603();})[_0x4bf4('0x3a')](function(_0x44517f){logger[_0x4bf4('0x38')](_0x4bf4('0x3b'),_0x44517f[_0x4bf4('0x3c')]);_0xfbf603();});},'afterDestroy':function(_0x2f5657,_0x243d3a,_0x5b2c3b){var _0x3f1940=_0x3e1d80['models'];var _0x2f7fb0=_0x2f5657[_0x4bf4('0x37')]({'plain':!![]});return _0x3f1940[_0x4bf4('0x1c')][_0x4bf4('0x22')]({'raw':!![],'where':{'ListId':_0x2f7fb0['ListId'],'ContactId':_0x2f7fb0['id']}})[_0x4bf4('0x16')](function(_0x3f8c1a){if(!_['isEmpty'](_0x3f8c1a)){var _0x3db1b4=[];for(var _0x16185a=0x0;_0x16185a<_0x3f8c1a[_0x4bf4('0x3d')];_0x16185a+=0x1){var _0x973b00=_0x3f1940[_0x4bf4('0x1c')][_0x4bf4('0x3e')]({'where':{'ListId':_0x3f8c1a[_0x16185a][_0x4bf4('0x11')],'ContactId':_0x3f8c1a[_0x16185a][_0x4bf4('0x3f')],'VoiceQueueId':_0x3f8c1a[_0x16185a]['VoiceQueueId'],'CampaignId':_0x3f8c1a[_0x16185a]['CampaignId']}});_0x3db1b4[_0x4bf4('0x40')](_0x973b00);}return Promise[_0x4bf4('0x27')](_0x3db1b4);}})[_0x4bf4('0x16')](function(_0x5c4595){logger['info'](_0x4bf4('0x41'),util[_0x4bf4('0x42')](_0x5c4595,{'showHidden':![],'depth':null}));_0x5b2c3b();})['catch'](function(_0x869ba5){logger[_0x4bf4('0x38')](_0x4bf4('0x43'),util[_0x4bf4('0x42')](_0x869ba5,{'showHidden':![],'depth':null}));_0x5b2c3b(_0x869ba5);});}}});}; \ No newline at end of file +var _0x80a8=['VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','then','timezones','utcOffset','add','minutes','ListId','priority','callbackUniqueid','phone','assign','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','CmHopper','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','onlyIfOpen','findAll','outbound','CmList','map','all','Campaign','Lists','BlackLists','create','define','CmContact','cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','models','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','message','get','length','destroy','push','info','[CmContact][afterDestroy][Succesfull]','inspect','lodash','util','api','moment','../../config/environment/shared','./cmContact.attributes'];(function(_0x27042b,_0x279eb1){var _0x25f459=function(_0x3078f6){while(--_0x3078f6){_0x27042b['push'](_0x27042b['shift']());}};_0x25f459(++_0x279eb1);}(_0x80a8,0xba));var _0x880a=function(_0x10acb2,_0x3ca870){_0x10acb2=_0x10acb2-0x0;var _0x186379=_0x80a8[_0x10acb2];return _0x186379;};'use strict';var _=require(_0x880a('0x0'));var util=require(_0x880a('0x1'));var logger=require('../../config/logger')(_0x880a('0x2'));var moment=require(_0x880a('0x3'));var shared=require(_0x880a('0x4'));var attributes=require(_0x880a('0x5'));function getTimezoneCallbackAt(_0x54415e,_0x26080b,_0x48bb18,_0x353ee3){var _0x3635aa=_0x353ee3?'Campaign':_0x880a('0x6');var _0x1fa1f2=_0x48bb18[_0x880a('0x7')]?_0x48bb18[_0x880a('0x7')]:moment()[_0x880a('0x8')](_0x880a('0x9'));if(_[_0x880a('0xa')](_0x48bb18[_0x880a('0xb')])){return Promise[_0x880a('0xc')](_0x1fa1f2);}return _0x54415e[_0x3635aa]['findOne']({'where':{'id':_0x26080b}})[_0x880a('0xd')](function(_0x1ead43){if(_[_0x880a('0xa')](_0x1ead43)||_[_0x880a('0xa')](_0x1ead43[_0x880a('0xb')])){return Promise[_0x880a('0xc')](_0x1fa1f2);}var _0x106bab=shared[_0x880a('0xe')];var _0x2e24f5=_0x106bab[_0x1ead43[_0x880a('0xb')]];var _0x212db5=_0x106bab[_0x48bb18[_0x880a('0xb')]];if(_[_0x880a('0xa')](_0x2e24f5)&&_['isNil'](_0x212db5)){return Promise[_0x880a('0xc')](_0x1fa1f2);}var _0x4d45fd=_0x2e24f5[_0x880a('0xf')]-_0x212db5[_0x880a('0xf')];var _0x40ff2f=_0x48bb18[_0x880a('0x7')]?_0x48bb18[_0x880a('0x7')]:moment();_0x1fa1f2=moment(_0x40ff2f)[_0x880a('0x10')](_0x4d45fd,_0x880a('0x11'))[_0x880a('0x8')](_0x880a('0x9'));return Promise[_0x880a('0xc')](_0x1fa1f2);});}function getNewHopperPayload(_0x11d445){return{'phone':_0x11d445['phone'],'ContactId':_0x11d445['id'],'ListId':_0x11d445[_0x880a('0x12')],'scheduledat':_0x11d445[_0x880a('0x7')]?_0x11d445['scheduledat']:moment()[_0x880a('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x11d445[_0x880a('0x13')]?_0x11d445['priority']:0x2,'callback':_0x11d445['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x11d445['callbackUniqueid']?_0x11d445[_0x880a('0x14')]:undefined,'callbackat':_0x11d445['callbackUniqueid']?moment()[_0x880a('0x8')](_0x880a('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x45ed74,_0x553a7e,_0x13c779,_0x26558e){var _0x3d8d8d={'phone':_0x13c779[_0x880a('0x15')]};var _0xb43477={'calleridnum':_0x13c779[_0x880a('0x15')]};if(_0x26558e){Object[_0x880a('0x16')](_0x3d8d8d,{'CampaignId':_0x553a7e['id']});Object['assign'](_0xb43477,{'CampaignId':_0x553a7e['id']});}else{Object[_0x880a('0x16')](_0x3d8d8d,{'VoiceQueueId':_0x553a7e['id']});Object[_0x880a('0x16')](_0xb43477,{'VoiceQueueId':_0x553a7e['id']});}return _0x45ed74['CmHopper'][_0x880a('0x17')]({'where':_0x3d8d8d})['then'](function(_0x259286){if(_0x259286){throw new Error(_0x880a('0x18')+_0x13c779[_0x880a('0x15')]+_0x880a('0x19')+_0x553a7e['id']);}return _0x45ed74[_0x880a('0x1a')]['findOne']({'where':_0xb43477});})[_0x880a('0xd')](function(_0x1df224){if(_0x1df224){throw new Error(_0x880a('0x1b')+_0x13c779[_0x880a('0x15')]+_0x880a('0x19')+_0x553a7e['id']);}var _0x497f4c=getNewHopperPayload(_0x13c779);if(_0x26558e){_0x497f4c[_0x880a('0x1c')]=_0x553a7e['id'];}else{_0x497f4c[_0x880a('0x1d')]=_0x553a7e['id'];}return _0x45ed74[_0x880a('0x1e')]['create'](_0x497f4c);});}function handleOnlyIfOpenCheckDuplicate(_0x53ac59,_0x2e6094,_0x3a3947,_0x3f635a){var _0x2aee46={'phone':_0x3a3947[_0x880a('0x15')]};if(_0x3f635a){Object['assign'](_0x2aee46,{'CampaignId':_0x2e6094['id']});}else{Object[_0x880a('0x16')](_0x2aee46,{'VoiceQueueId':_0x2e6094['id']});}return _0x53ac59[_0x880a('0x1e')][_0x880a('0x17')]({'where':_0x2aee46})['then'](function(_0x1bdca6){if(_0x1bdca6){throw new Error(_0x880a('0x1f')+_0x3a3947[_0x880a('0x15')]+_0x880a('0x19')+_0x2e6094['id']);}var _0x4a4c1c=getNewHopperPayload(_0x3a3947);if(_0x3f635a){_0x4a4c1c['CampaignId']=_0x2e6094['id'];}else{_0x4a4c1c[_0x880a('0x1d')]=_0x2e6094['id'];}return _0x53ac59['CmHopper']['create'](_0x4a4c1c);});}function handleNeverCheckDuplicate(_0x446f8a,_0x32d2a3,_0x242136){var _0x7ad34a=getNewHopperPayload(_0x242136);_0x7ad34a[_0x880a('0x1d')]=_0x32d2a3['id'];return _0x446f8a[_0x880a('0x1e')]['create'](_0x7ad34a);}function handleCheckDuplicate(_0x53a77c,_0x47d971,_0xb48709,_0x5b1a39){return getTimezoneCallbackAt(_0x53a77c,_0x47d971,_0xb48709,_0x5b1a39)[_0x880a('0xd')](function(_0x34d530){_0xb48709[_0x880a('0x7')]=_0x34d530;switch(_0x47d971[_0x880a('0x20')]){case'always':return handleAlwaysCheckDuplicate(_0x53a77c,_0x47d971,_0xb48709,_0x5b1a39);case _0x880a('0x21'):return handleOnlyIfOpenCheckDuplicate(_0x53a77c,_0x47d971,_0xb48709,_0x5b1a39);default:return handleNeverCheckDuplicate(_0x53a77c,_0x47d971,_0xb48709);}});}function createHopperForVoiceQueues(_0x1c0f48,_0x492a35){return _0x1c0f48[_0x880a('0x6')][_0x880a('0x22')]({'where':{'type':_0x880a('0x23')},'attributes':['id',_0x880a('0x20'),'dialTimezone'],'include':[{'model':_0x1c0f48[_0x880a('0x24')],'as':'Lists','where':{'id':_0x492a35[_0x880a('0x12')]}}],'raw':!![]})['then'](function(_0x35f6a4){var _0x164c2d=_0x35f6a4[_0x880a('0x25')](function(_0x7b704e){return handleCheckDuplicate(_0x1c0f48,_0x7b704e,_0x492a35,![]);});return Promise[_0x880a('0x26')](_0x164c2d);});}function createHopperForCampaigns(_0x2f9e77,_0x2ea62){return _0x2f9e77[_0x880a('0x27')]['findAll']({'attributes':['id','dialCheckDuplicateType',_0x880a('0xb')],'include':[{'model':_0x2f9e77[_0x880a('0x24')],'as':_0x880a('0x28'),'where':{'id':_0x2ea62[_0x880a('0x12')]}}],'raw':!![]})[_0x880a('0xd')](function(_0x20b660){var _0xf92753=_0x20b660[_0x880a('0x25')](function(_0x372b4c){return handleCheckDuplicate(_0x2f9e77,_0x372b4c,_0x2ea62,!![]);});return Promise['all'](_0xf92753);});}function createHopperBlackForVoiceQueues(_0x9d954f,_0x2c6067){return _0x9d954f[_0x880a('0x6')][_0x880a('0x22')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x9d954f[_0x880a('0x24')],'as':_0x880a('0x29'),'where':{'id':_0x2c6067['ListId']}}],'raw':!![]})[_0x880a('0xd')](function(_0x2d2042){var _0x4d0751=_0x2d2042['map'](function(_0x1b26d8){return _0x9d954f['CmHopperBlack'][_0x880a('0x2a')]({'phone':_0x2c6067[_0x880a('0x15')],'ContactId':_0x2c6067['id'],'ListId':_0x2c6067[_0x880a('0x12')],'VoiceQueueId':_0x1b26d8['id']});});return Promise[_0x880a('0x26')](_0x4d0751);});}function createHopperBlackForCampaigns(_0x20ea46,_0xc4445f){return _0x20ea46[_0x880a('0x27')]['findAll']({'attributes':['id'],'include':[{'model':_0x20ea46[_0x880a('0x24')],'as':'BlackLists','where':{'id':_0xc4445f['ListId']}}],'raw':!![]})[_0x880a('0xd')](function(_0x464c0f){var _0x3c4428=_0x464c0f[_0x880a('0x25')](function(_0xa8b306){return _0x20ea46['CmHopperBlack'][_0x880a('0x2a')]({'phone':_0xc4445f[_0x880a('0x15')],'ContactId':_0xc4445f['id'],'ListId':_0xc4445f[_0x880a('0x12')],'CampaignId':_0xa8b306['id']});});return Promise['all'](_0x3c4428);});}module['exports']=function(_0x5c3a3f){return _0x5c3a3f[_0x880a('0x2b')](_0x880a('0x2c'),attributes,{'tableName':_0x880a('0x2d'),'paranoid':!![],'indexes':[{'name':_0x880a('0x15'),'fields':[_0x880a('0x15')]},{'name':'fti_cm_contacts','fields':[_0x880a('0x2e'),'lastName','phone',_0x880a('0x2f'),_0x880a('0x30'),_0x880a('0x31')],'type':_0x880a('0x32')}],'timestamps':!![],'charset':_0x880a('0x33'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x40884a,_0x1e8fd0,_0x20de89){var _0x466d7f=_0x5c3a3f[_0x880a('0x34')];var _0x216716=_0x40884a['get']({'plain':!![]});if(!_0x216716[_0x880a('0x12')]){logger[_0x880a('0x35')](_0x880a('0x36')+_0x216716['id']);return _0x20de89();}if(!_0x216716[_0x880a('0x15')]){return _0x20de89();}return createHopperForVoiceQueues(_0x466d7f,_0x216716)[_0x880a('0xd')](function(){return createHopperBlackForVoiceQueues(_0x466d7f,_0x216716);})[_0x880a('0xd')](function(){return createHopperForCampaigns(_0x466d7f,_0x216716);})[_0x880a('0xd')](function(){return createHopperBlackForCampaigns(_0x466d7f,_0x216716);})[_0x880a('0xd')](function(){return _0x20de89();})[_0x880a('0x37')](function(_0x579c5a){logger['error']('[cmContact][afterCreate]',_0x579c5a[_0x880a('0x38')]);_0x20de89();});},'afterDestroy':function(_0x2e7d96,_0x1c7a5c,_0x3ded2d){var _0xfa055=_0x5c3a3f[_0x880a('0x34')];var _0xf38dd3=_0x2e7d96[_0x880a('0x39')]({'plain':!![]});return _0xfa055[_0x880a('0x1e')][_0x880a('0x22')]({'raw':!![],'where':{'ListId':_0xf38dd3[_0x880a('0x12')],'ContactId':_0xf38dd3['id']}})[_0x880a('0xd')](function(_0x253ad4){if(!_['isEmpty'](_0x253ad4)){var _0x35a369=[];for(var _0x2b6832=0x0;_0x2b6832<_0x253ad4[_0x880a('0x3a')];_0x2b6832+=0x1){var _0x3ac5f8=_0xfa055[_0x880a('0x1e')][_0x880a('0x3b')]({'where':{'ListId':_0x253ad4[_0x2b6832][_0x880a('0x12')],'ContactId':_0x253ad4[_0x2b6832]['ContactId'],'VoiceQueueId':_0x253ad4[_0x2b6832][_0x880a('0x1d')],'CampaignId':_0x253ad4[_0x2b6832][_0x880a('0x1c')]}});_0x35a369[_0x880a('0x3c')](_0x3ac5f8);}return Promise[_0x880a('0x26')](_0x35a369);}})[_0x880a('0xd')](function(_0x3d7dec){logger[_0x880a('0x3d')](_0x880a('0x3e'),util[_0x880a('0x3f')](_0x3d7dec,{'showHidden':![],'depth':null}));_0x3ded2d();})[_0x880a('0x37')](function(_0x578345){logger[_0x880a('0x35')]('[CmContact][afterDestroy][Error]',util[_0x880a('0x3f')](_0x578345,{'showHidden':![],'depth':null}));_0x3ded2d(_0x578345);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index c646500..92db7a1 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(_0x968008,_0x1d0964){var _0x21e216=function(_0x3f1245){while(--_0x3f1245){_0x968008['push'](_0x968008['shift']());}};_0x21e216(++_0x1d0964);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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(_0x1d5ef2,_0x402710){var _0x198cf9=function(_0x3ee337){while(--_0x3ee337){_0x1d5ef2['push'](_0x1d5ef2['shift']());}};_0x198cf9(++_0x402710);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/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 f2a013a..e603dce 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 _0xc577=['INTEGER','PHONE','sequelize','STRING'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0xc577,0x172));var _0x7c57=function(_0x6376b0,_0x52d8c1){_0x6376b0=_0x6376b0-0x0;var _0x47ac71=_0xc577[_0x6376b0];return _0x47ac71;};'use strict';var Sequelize=require(_0x7c57('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x7c57('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7c57('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7c57('0x1')],'defaultValue':_0x7c57('0x3')},'OrderBy':{'type':Sequelize[_0x7c57('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x7c57('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xad36=['exports','INTEGER','STRING','PHONE'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xad36,0x11c));var _0x6ad3=function(_0x1a944a,_0x2312d1){_0x1a944a=_0x1a944a-0x0;var _0x26dd6e=_0xad36[_0x1a944a];return _0x26dd6e;};'use strict';var Sequelize=require('sequelize');module[_0x6ad3('0x0')]={'CmContactId':{'type':Sequelize[_0x6ad3('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x6ad3('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x6ad3('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x6ad3('0x2')],'defaultValue':_0x6ad3('0x3')},'OrderBy':{'type':Sequelize[_0x6ad3('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x6ad3('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 8a78112..3c05516 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 _0x58a3=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x5df5df,_0x7c3836){var _0x728577=function(_0x357425){while(--_0x357425){_0x5df5df['push'](_0x5df5df['shift']());}};_0x728577(++_0x7c3836);}(_0x58a3,0xa5));var _0x358a=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x58a3[_0x4350c2];return _0x8b6406;};'use strict';var emlformat=require(_0x358a('0x0'));var rimraf=require(_0x358a('0x1'));var zipdir=require(_0x358a('0x2'));var jsonpatch=require(_0x358a('0x3'));var rp=require(_0x358a('0x4'));var moment=require(_0x358a('0x5'));var BPromise=require(_0x358a('0x6'));var Mustache=require(_0x358a('0x7'));var util=require(_0x358a('0x8'));var path=require('path');var sox=require(_0x358a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x358a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x358a('0xb'));var jsforce=require(_0x358a('0xc'));var deskjs=require(_0x358a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x358a('0xe'));var Papa=require(_0x358a('0xf'));var Redis=require(_0x358a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x358a('0x11'));var as=require(_0x358a('0x12'));var hardwareService=require(_0x358a('0x13'));var logger=require(_0x358a('0x14'))('api');var utils=require(_0x358a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x358a('0x16'));var db=require(_0x358a('0x17'))['db'];function respondWithStatusCode(_0x4dc44e,_0x43ecac){_0x43ecac=_0x43ecac||0xcc;return function(_0x5d4a65){if(_0x5d4a65){return _0x4dc44e[_0x358a('0x18')](_0x43ecac);}return _0x4dc44e[_0x358a('0x19')](_0x43ecac)[_0x358a('0x1a')]();};}function respondWithResult(_0x4b4225,_0x2a65c7){_0x2a65c7=_0x2a65c7||0xc8;return function(_0x3d3c23){if(_0x3d3c23){return _0x4b4225[_0x358a('0x19')](_0x2a65c7)[_0x358a('0x1b')](_0x3d3c23);}};}function respondWithFilteredResult(_0x2a844d,_0x5ed07c){return function(_0x5476fa){if(_0x5476fa){var _0x44e9ab=typeof _0x5ed07c[_0x358a('0x1c')]===_0x358a('0x1d')&&typeof _0x5ed07c[_0x358a('0x1e')]===_0x358a('0x1d');var _0x5a89b3=_0x5476fa[_0x358a('0x1f')];var _0xc7f96f=_0x44e9ab?0x0:_0x5ed07c['offset'];var _0x2a2e7a=_0x44e9ab?_0x5476fa[_0x358a('0x1f')]:_0x5ed07c['offset']+_0x5ed07c[_0x358a('0x1e')];var _0x5dff66;if(_0x2a2e7a>=_0x5a89b3){_0x2a2e7a=_0x5a89b3;_0x5dff66=0xc8;}else{_0x5dff66=0xce;}_0x2a844d[_0x358a('0x19')](_0x5dff66);return _0x2a844d[_0x358a('0x20')](_0x358a('0x21'),_0xc7f96f+'-'+_0x2a2e7a+'/'+_0x5a89b3)[_0x358a('0x1b')](_0x5476fa);}return null;};}function patchUpdates(_0x328163){return function(_0x870515){try{jsonpatch[_0x358a('0x22')](_0x870515,_0x328163,!![]);}catch(_0x4aaef5){return BPromise[_0x358a('0x23')](_0x4aaef5);}return _0x870515[_0x358a('0x24')]();};}function saveUpdates(_0x3da300,_0x5ecd92){return function(_0x430651){if(_0x430651){return _0x430651[_0x358a('0x25')](_0x3da300)[_0x358a('0x26')](function(_0x4c31a2){return _0x4c31a2;});}return null;};}function removeEntity(_0x5f026b,_0xb9723c){return function(_0xd1fa1a){if(_0xd1fa1a){return _0xd1fa1a[_0x358a('0x27')]()['then'](function(){var _0x228817=_0xd1fa1a['get']({'plain':!![]});var _0x21df2c=_0x358a('0x28');return db[_0x358a('0x29')][_0x358a('0x27')]({'where':{'type':_0x21df2c,'resourceId':_0x228817['id']}})[_0x358a('0x26')](function(){return _0xd1fa1a;});})[_0x358a('0x26')](function(){_0x5f026b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x487d0f,_0x20e17c){return function(_0x5df57b){if(!_0x5df57b){_0x487d0f['sendStatus'](0x194);}return _0x5df57b;};}function handleError(_0x405641,_0x54eb1c){_0x54eb1c=_0x54eb1c||0x1f4;return function(_0xfd2bc9){logger[_0x358a('0x2a')](_0xfd2bc9[_0x358a('0x2b')]);if(_0xfd2bc9[_0x358a('0x2c')]){delete _0xfd2bc9[_0x358a('0x2c')];}_0x405641['status'](_0x54eb1c)[_0x358a('0x2d')](_0xfd2bc9);};}exports[_0x358a('0x2e')]=function(_0x243aee,_0x13977f){var _0x4805c5={},_0x206fc1={},_0x2752bd={'count':0x0,'rows':[]};var _0x3ba3be=_[_0x358a('0x2f')](db[_0x358a('0x30')][_0x358a('0x31')],function(_0x39725a){return{'name':_0x39725a['fieldName'],'type':_0x39725a[_0x358a('0x32')][_0x358a('0x33')]};});_0x206fc1[_0x358a('0x34')]=_['map'](_0x3ba3be,_0x358a('0x2c'));_0x206fc1['query']=_[_0x358a('0x35')](_0x243aee[_0x358a('0x36')]);_0x206fc1[_0x358a('0x37')]=_[_0x358a('0x38')](_0x206fc1[_0x358a('0x34')],_0x206fc1[_0x358a('0x36')]);_0x4805c5[_0x358a('0x39')]=_[_0x358a('0x38')](_0x206fc1[_0x358a('0x34')],qs['fields'](_0x243aee['query'][_0x358a('0x3a')]));_0x4805c5[_0x358a('0x39')]=_0x4805c5[_0x358a('0x39')]['length']?_0x4805c5[_0x358a('0x39')]:_0x206fc1[_0x358a('0x34')];if(!_0x243aee[_0x358a('0x36')][_0x358a('0x3b')]('nolimit')){_0x4805c5[_0x358a('0x1e')]=qs[_0x358a('0x1e')](_0x243aee['query'][_0x358a('0x1e')]);_0x4805c5[_0x358a('0x1c')]=qs[_0x358a('0x1c')](_0x243aee[_0x358a('0x36')]['offset']);}_0x4805c5[_0x358a('0x3c')]=qs['sort'](_0x243aee[_0x358a('0x36')]['sort']);_0x4805c5[_0x358a('0x3d')]=qs[_0x358a('0x37')](_[_0x358a('0x3e')](_0x243aee[_0x358a('0x36')],_0x206fc1['filters']),_0x3ba3be);if(_0x243aee[_0x358a('0x36')][_0x358a('0x3f')]){_0x4805c5[_0x358a('0x3d')]=_[_0x358a('0x40')](_0x4805c5[_0x358a('0x3d')],{'$or':_[_0x358a('0x2f')](_0x3ba3be,function(_0x595848){if(_0x595848[_0x358a('0x32')]!==_0x358a('0x41')){var _0x38af3f={};_0x38af3f[_0x595848['name']]={'$like':'%'+_0x243aee[_0x358a('0x36')][_0x358a('0x3f')]+'%'};return _0x38af3f;}})});}_0x4805c5=_[_0x358a('0x40')]({},_0x4805c5,_0x243aee[_0x358a('0x42')]);var _0x169fe5={'where':_0x4805c5[_0x358a('0x3d')]};return db[_0x358a('0x30')]['count'](_0x169fe5)['then'](function(_0xa6f729){_0x2752bd[_0x358a('0x1f')]=_0xa6f729;if(_0x243aee[_0x358a('0x36')][_0x358a('0x43')]){_0x4805c5[_0x358a('0x44')]=[{'all':!![]}];}return db[_0x358a('0x30')][_0x358a('0x45')](_0x4805c5);})[_0x358a('0x26')](function(_0x1bef94){_0x2752bd[_0x358a('0x46')]=_0x1bef94;return _0x2752bd;})[_0x358a('0x26')](respondWithFilteredResult(_0x13977f,_0x4805c5))['catch'](handleError(_0x13977f,null));};exports['show']=function(_0x108b5b,_0x1fd953){var _0x49e3a9={'raw':!![],'where':{'id':_0x108b5b[_0x358a('0x47')]['id']}},_0x3fd8c8={};_0x3fd8c8[_0x358a('0x34')]=_[_0x358a('0x35')](db[_0x358a('0x30')][_0x358a('0x31')]);_0x3fd8c8[_0x358a('0x36')]=_[_0x358a('0x35')](_0x108b5b[_0x358a('0x36')]);_0x3fd8c8[_0x358a('0x37')]=_[_0x358a('0x38')](_0x3fd8c8[_0x358a('0x34')],_0x3fd8c8[_0x358a('0x36')]);_0x49e3a9[_0x358a('0x39')]=_[_0x358a('0x38')](_0x3fd8c8[_0x358a('0x34')],qs[_0x358a('0x3a')](_0x108b5b[_0x358a('0x36')]['fields']));_0x49e3a9['attributes']=_0x49e3a9['attributes']['length']?_0x49e3a9[_0x358a('0x39')]:_0x3fd8c8[_0x358a('0x34')];if(_0x108b5b[_0x358a('0x36')]['includeAll']){_0x49e3a9[_0x358a('0x44')]=[{'all':!![]}];}_0x49e3a9=_[_0x358a('0x40')]({},_0x49e3a9,_0x108b5b[_0x358a('0x42')]);return db[_0x358a('0x30')][_0x358a('0x48')](_0x49e3a9)[_0x358a('0x26')](handleEntityNotFound(_0x1fd953,null))['then'](respondWithResult(_0x1fd953,null))[_0x358a('0x49')](handleError(_0x1fd953,null));};exports['create']=function(_0x59190b,_0x1a7719){return db[_0x358a('0x30')]['create'](_0x59190b[_0x358a('0x4a')],{})[_0x358a('0x26')](function(_0x2a893d){var _0x528798=_0x59190b[_0x358a('0x4b')][_0x358a('0x4c')]({'plain':!![]});if(!_0x528798)throw new Error(_0x358a('0x4d'));if(_0x528798[_0x358a('0x4e')]==='user'){var _0x2f0a61=_0x2a893d[_0x358a('0x4c')]({'plain':!![]});var _0x488470='CmContactHasItems';return db[_0x358a('0x4f')]['find']({'where':{'name':_0x488470,'userProfileId':_0x528798[_0x358a('0x50')]},'raw':!![]})[_0x358a('0x26')](function(_0x225289){if(_0x225289&&_0x225289[_0x358a('0x51')]===0x0){return db[_0x358a('0x29')][_0x358a('0x52')]({'name':_0x2f0a61['name'],'resourceId':_0x2f0a61['id'],'type':_0x225289[_0x358a('0x2c')],'sectionId':_0x225289['id']},{})[_0x358a('0x26')](function(){return _0x2a893d;});}else{return _0x2a893d;}})[_0x358a('0x49')](function(_0x102cb6){logger[_0x358a('0x2a')](_0x358a('0x53'),_0x102cb6);throw _0x102cb6;});}return _0x2a893d;})[_0x358a('0x26')](respondWithResult(_0x1a7719,0xc9))[_0x358a('0x49')](handleError(_0x1a7719,null));};exports[_0x358a('0x25')]=function(_0x385491,_0x25e8f8){if(_0x385491['body']['id']){delete _0x385491[_0x358a('0x4a')]['id'];}return db[_0x358a('0x30')][_0x358a('0x48')]({'where':{'id':_0x385491[_0x358a('0x47')]['id']}})[_0x358a('0x26')](handleEntityNotFound(_0x25e8f8,null))[_0x358a('0x26')](saveUpdates(_0x385491[_0x358a('0x4a')],null))[_0x358a('0x26')](respondWithResult(_0x25e8f8,null))[_0x358a('0x49')](handleError(_0x25e8f8,null));};exports[_0x358a('0x27')]=function(_0x298ba6,_0x37f992){return db[_0x358a('0x30')][_0x358a('0x48')]({'where':{'id':_0x298ba6[_0x358a('0x47')]['id']}})[_0x358a('0x26')](handleEntityNotFound(_0x37f992,null))[_0x358a('0x26')](removeEntity(_0x37f992,null))[_0x358a('0x49')](handleError(_0x37f992,null));}; \ No newline at end of file +var _0x99c3=['CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','show','params','find','catch','create','role','user','get','autoAssociation','error','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','name','send','index','map'];(function(_0x4dc1a2,_0x541967){var _0x2f4413=function(_0x388456){while(--_0x388456){_0x4dc1a2['push'](_0x4dc1a2['shift']());}};_0x2f4413(++_0x541967);}(_0x99c3,0x1a2));var _0x399c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x99c3[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x399c('0x0'));var rimraf=require(_0x399c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x399c('0x2'));var rp=require(_0x399c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x399c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x399c('0x5'));var csv=require(_0x399c('0x6'));var ejs=require(_0x399c('0x7'));var fs=require('fs');var fs_extra=require(_0x399c('0x8'));var _=require(_0x399c('0x9'));var squel=require('squel');var crypto=require(_0x399c('0xa'));var jsforce=require(_0x399c('0xb'));var deskjs=require(_0x399c('0xc'));var toCsv=require(_0x399c('0x6'));var querystring=require(_0x399c('0xd'));var Papa=require(_0x399c('0xe'));var Redis=require(_0x399c('0xf'));var authService=require(_0x399c('0x10'));var qs=require(_0x399c('0x11'));var as=require(_0x399c('0x12'));var hardwareService=require(_0x399c('0x13'));var logger=require('../../config/logger')(_0x399c('0x14'));var utils=require(_0x399c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x399c('0x16'));var db=require(_0x399c('0x17'))['db'];function respondWithStatusCode(_0x3cad69,_0x1b4382){_0x1b4382=_0x1b4382||0xcc;return function(_0x31c6f1){if(_0x31c6f1){return _0x3cad69[_0x399c('0x18')](_0x1b4382);}return _0x3cad69[_0x399c('0x19')](_0x1b4382)['end']();};}function respondWithResult(_0x3f4a5c,_0x23e6cb){_0x23e6cb=_0x23e6cb||0xc8;return function(_0x4acbfb){if(_0x4acbfb){return _0x3f4a5c['status'](_0x23e6cb)[_0x399c('0x1a')](_0x4acbfb);}};}function respondWithFilteredResult(_0x36cf79,_0x328041){return function(_0x44d94c){if(_0x44d94c){var _0x5a0fc5=typeof _0x328041[_0x399c('0x1b')]===_0x399c('0x1c')&&typeof _0x328041[_0x399c('0x1d')]==='undefined';var _0x16bbd3=_0x44d94c[_0x399c('0x1e')];var _0x247332=_0x5a0fc5?0x0:_0x328041['offset'];var _0x4efe3a=_0x5a0fc5?_0x44d94c['count']:_0x328041[_0x399c('0x1b')]+_0x328041['limit'];var _0x3f5408;if(_0x4efe3a>=_0x16bbd3){_0x4efe3a=_0x16bbd3;_0x3f5408=0xc8;}else{_0x3f5408=0xce;}_0x36cf79['status'](_0x3f5408);return _0x36cf79[_0x399c('0x1f')](_0x399c('0x20'),_0x247332+'-'+_0x4efe3a+'/'+_0x16bbd3)[_0x399c('0x1a')](_0x44d94c);}return null;};}function patchUpdates(_0xa935d8){return function(_0x5b71f8){try{jsonpatch[_0x399c('0x21')](_0x5b71f8,_0xa935d8,!![]);}catch(_0x138077){return BPromise[_0x399c('0x22')](_0x138077);}return _0x5b71f8[_0x399c('0x23')]();};}function saveUpdates(_0x553acf,_0x37fea2){return function(_0x5f037d){if(_0x5f037d){return _0x5f037d[_0x399c('0x24')](_0x553acf)['then'](function(_0x42bec0){return _0x42bec0;});}return null;};}function removeEntity(_0x160aba,_0x415b79){return function(_0x38f102){if(_0x38f102){return _0x38f102[_0x399c('0x25')]()[_0x399c('0x26')](function(){var _0x24f413=_0x38f102['get']({'plain':!![]});var _0x3bc0d7='CmContactHasItems';return db[_0x399c('0x27')]['destroy']({'where':{'type':_0x3bc0d7,'resourceId':_0x24f413['id']}})['then'](function(){return _0x38f102;});})[_0x399c('0x26')](function(){_0x160aba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a8973,_0x512c29){return function(_0x239252){if(!_0x239252){_0x5a8973[_0x399c('0x18')](0x194);}return _0x239252;};}function handleError(_0x10f197,_0x360e43){_0x360e43=_0x360e43||0x1f4;return function(_0x30a52e){logger['error'](_0x30a52e['stack']);if(_0x30a52e['name']){delete _0x30a52e[_0x399c('0x28')];}_0x10f197[_0x399c('0x19')](_0x360e43)[_0x399c('0x29')](_0x30a52e);};}exports[_0x399c('0x2a')]=function(_0x3d3a48,_0x4d7ab0){var _0x281979={},_0x131783={},_0x72d085={'count':0x0,'rows':[]};var _0x35c496=_[_0x399c('0x2b')](db[_0x399c('0x2c')][_0x399c('0x2d')],function(_0x2dac7f){return{'name':_0x2dac7f[_0x399c('0x2e')],'type':_0x2dac7f[_0x399c('0x2f')]['key']};});_0x131783[_0x399c('0x30')]=_[_0x399c('0x2b')](_0x35c496,_0x399c('0x28'));_0x131783[_0x399c('0x31')]=_[_0x399c('0x32')](_0x3d3a48[_0x399c('0x31')]);_0x131783[_0x399c('0x33')]=_[_0x399c('0x34')](_0x131783[_0x399c('0x30')],_0x131783[_0x399c('0x31')]);_0x281979['attributes']=_[_0x399c('0x34')](_0x131783['model'],qs[_0x399c('0x35')](_0x3d3a48['query'][_0x399c('0x35')]));_0x281979['attributes']=_0x281979['attributes'][_0x399c('0x36')]?_0x281979[_0x399c('0x37')]:_0x131783[_0x399c('0x30')];if(!_0x3d3a48['query'][_0x399c('0x38')](_0x399c('0x39'))){_0x281979['limit']=qs[_0x399c('0x1d')](_0x3d3a48[_0x399c('0x31')][_0x399c('0x1d')]);_0x281979['offset']=qs[_0x399c('0x1b')](_0x3d3a48[_0x399c('0x31')]['offset']);}_0x281979['order']=qs[_0x399c('0x3a')](_0x3d3a48[_0x399c('0x31')][_0x399c('0x3a')]);_0x281979[_0x399c('0x3b')]=qs['filters'](_[_0x399c('0x3c')](_0x3d3a48[_0x399c('0x31')],_0x131783[_0x399c('0x33')]),_0x35c496);if(_0x3d3a48[_0x399c('0x31')][_0x399c('0x3d')]){_0x281979[_0x399c('0x3b')]=_[_0x399c('0x3e')](_0x281979[_0x399c('0x3b')],{'$or':_[_0x399c('0x2b')](_0x35c496,function(_0x34dca9){if(_0x34dca9['type']!==_0x399c('0x3f')){var _0x330f39={};_0x330f39[_0x34dca9['name']]={'$like':'%'+_0x3d3a48[_0x399c('0x31')]['filter']+'%'};return _0x330f39;}})});}_0x281979=_['merge']({},_0x281979,_0x3d3a48[_0x399c('0x40')]);var _0xb75537={'where':_0x281979[_0x399c('0x3b')]};return db['CmContactHasItem']['count'](_0xb75537)[_0x399c('0x26')](function(_0x2f5e11){_0x72d085[_0x399c('0x1e')]=_0x2f5e11;if(_0x3d3a48[_0x399c('0x31')]['includeAll']){_0x281979[_0x399c('0x41')]=[{'all':!![]}];}return db[_0x399c('0x2c')]['findAll'](_0x281979);})['then'](function(_0x4f2571){_0x72d085['rows']=_0x4f2571;return _0x72d085;})[_0x399c('0x26')](respondWithFilteredResult(_0x4d7ab0,_0x281979))['catch'](handleError(_0x4d7ab0,null));};exports[_0x399c('0x42')]=function(_0x21f930,_0x320db3){var _0x4c36d4={'raw':!![],'where':{'id':_0x21f930[_0x399c('0x43')]['id']}},_0x20c27f={};_0x20c27f[_0x399c('0x30')]=_[_0x399c('0x32')](db['CmContactHasItem'][_0x399c('0x2d')]);_0x20c27f[_0x399c('0x31')]=_['keys'](_0x21f930[_0x399c('0x31')]);_0x20c27f[_0x399c('0x33')]=_['intersection'](_0x20c27f['model'],_0x20c27f[_0x399c('0x31')]);_0x4c36d4[_0x399c('0x37')]=_['intersection'](_0x20c27f['model'],qs[_0x399c('0x35')](_0x21f930['query']['fields']));_0x4c36d4['attributes']=_0x4c36d4['attributes'][_0x399c('0x36')]?_0x4c36d4['attributes']:_0x20c27f['model'];if(_0x21f930[_0x399c('0x31')]['includeAll']){_0x4c36d4[_0x399c('0x41')]=[{'all':!![]}];}_0x4c36d4=_[_0x399c('0x3e')]({},_0x4c36d4,_0x21f930['options']);return db[_0x399c('0x2c')][_0x399c('0x44')](_0x4c36d4)[_0x399c('0x26')](handleEntityNotFound(_0x320db3,null))[_0x399c('0x26')](respondWithResult(_0x320db3,null))[_0x399c('0x45')](handleError(_0x320db3,null));};exports[_0x399c('0x46')]=function(_0x10bbd8,_0x1b9579){return db[_0x399c('0x2c')]['create'](_0x10bbd8['body'],{})[_0x399c('0x26')](function(_0x405126){var _0x43117f=_0x10bbd8['user']['get']({'plain':!![]});if(!_0x43117f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43117f[_0x399c('0x47')]===_0x399c('0x48')){var _0x39091d=_0x405126[_0x399c('0x49')]({'plain':!![]});var _0x3435fc='CmContactHasItems';return db['UserProfileSection'][_0x399c('0x44')]({'where':{'name':_0x3435fc,'userProfileId':_0x43117f['userProfileId']},'raw':!![]})[_0x399c('0x26')](function(_0x4e0b6a){if(_0x4e0b6a&&_0x4e0b6a[_0x399c('0x4a')]===0x0){return db[_0x399c('0x27')][_0x399c('0x46')]({'name':_0x39091d['name'],'resourceId':_0x39091d['id'],'type':_0x4e0b6a['name'],'sectionId':_0x4e0b6a['id']},{})[_0x399c('0x26')](function(){return _0x405126;});}else{return _0x405126;}})[_0x399c('0x45')](function(_0x3fdc48){logger[_0x399c('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fdc48);throw _0x3fdc48;});}return _0x405126;})[_0x399c('0x26')](respondWithResult(_0x1b9579,0xc9))[_0x399c('0x45')](handleError(_0x1b9579,null));};exports['update']=function(_0x355e7e,_0x967ea6){if(_0x355e7e[_0x399c('0x4c')]['id']){delete _0x355e7e[_0x399c('0x4c')]['id'];}return db[_0x399c('0x2c')][_0x399c('0x44')]({'where':{'id':_0x355e7e[_0x399c('0x43')]['id']}})[_0x399c('0x26')](handleEntityNotFound(_0x967ea6,null))['then'](saveUpdates(_0x355e7e[_0x399c('0x4c')],null))[_0x399c('0x26')](respondWithResult(_0x967ea6,null))[_0x399c('0x45')](handleError(_0x967ea6,null));};exports[_0x399c('0x25')]=function(_0x350922,_0x5d309c){return db[_0x399c('0x2c')][_0x399c('0x44')]({'where':{'id':_0x350922[_0x399c('0x43')]['id']}})[_0x399c('0x26')](handleEntityNotFound(_0x5d309c,null))[_0x399c('0x26')](removeEntity(_0x5d309c,null))['catch'](handleError(_0x5d309c,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2762e1a..27f8b91 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 _0x7a24=['path','rimraf','../../config/environment','define','cm_contact_has_items','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a24,0xa5));var _0x47a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a24[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x47a2('0x0'));var logger=require(_0x47a2('0x1'))('api');var moment=require(_0x47a2('0x2'));var BPromise=require(_0x47a2('0x3'));var rp=require(_0x47a2('0x4'));var fs=require('fs');var path=require(_0x47a2('0x5'));var rimraf=require(_0x47a2('0x6'));var config=require(_0x47a2('0x7'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0xd9c192,_0x30d134){return _0xd9c192[_0x47a2('0x8')]('CmContactHasItem',attributes,{'tableName':_0x47a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4962=['cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4962,0xf1));var _0x2496=function(_0x40951a,_0x2cbe60){_0x40951a=_0x40951a-0x0;var _0xdb2028=_0x4962[_0x40951a];return _0xdb2028;};'use strict';var _=require(_0x2496('0x0'));var util=require(_0x2496('0x1'));var logger=require(_0x2496('0x2'))(_0x2496('0x3'));var moment=require(_0x2496('0x4'));var BPromise=require(_0x2496('0x5'));var rp=require(_0x2496('0x6'));var fs=require('fs');var path=require(_0x2496('0x7'));var rimraf=require(_0x2496('0x8'));var config=require(_0x2496('0x9'));var attributes=require(_0x2496('0xa'));module[_0x2496('0xb')]=function(_0x47d1a1,_0x257139){return _0x47d1a1[_0x2496('0xc')](_0x2496('0xd'),attributes,{'tableName':_0x2496('0xe'),'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 982f17c..4ccce20 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 _0x9720=['request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x22e34b,_0x564b45){var _0x374b0e=function(_0x3fa8d5){while(--_0x3fa8d5){_0x22e34b['push'](_0x22e34b['shift']());}};_0x374b0e(++_0x564b45);}(_0x9720,0xd2));var _0x0972=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9720[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x0972('0x0'));var moment=require(_0x0972('0x1'));var BPromise=require(_0x0972('0x2'));var rs=require(_0x0972('0x3'));var fs=require('fs');var Redis=require(_0x0972('0x4'));var db=require(_0x0972('0x5'))['db'];var utils=require(_0x0972('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0972('0x7'));var client=jayson[_0x0972('0x8')][_0x0972('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5155a0,_0xea7ecc,_0x2d9e38){return new BPromise(function(_0x5daa1d,_0x193c68){return client[_0x0972('0xa')](_0x5155a0,_0x2d9e38)[_0x0972('0xb')](function(_0x2cc547){logger[_0x0972('0xc')](_0x0972('0xd'),_0xea7ecc,'request\x20sent');logger[_0x0972('0xe')](_0x0972('0xf'),_0xea7ecc,_0x0972('0x10'),JSON['stringify'](_0x2cc547));if(_0x2cc547['error']){if(_0x2cc547[_0x0972('0x11')][_0x0972('0x12')]===0x1f4){logger[_0x0972('0x11')](_0x0972('0xd'),_0xea7ecc,_0x2cc547[_0x0972('0x11')][_0x0972('0x13')]);return _0x193c68(_0x2cc547['error'][_0x0972('0x13')]);}logger[_0x0972('0x11')](_0x0972('0xd'),_0xea7ecc,_0x2cc547[_0x0972('0x11')][_0x0972('0x13')]);return _0x5daa1d(_0x2cc547[_0x0972('0x11')][_0x0972('0x13')]);}else{logger[_0x0972('0xc')](_0x0972('0xd'),_0xea7ecc,_0x0972('0x10'));_0x5daa1d(_0x2cc547[_0x0972('0x14')]['message']);}})[_0x0972('0x15')](function(_0x5697b9){logger['error'](_0x0972('0xd'),_0xea7ecc,_0x5697b9);_0x193c68(_0x5697b9);});});} \ No newline at end of file +var _0xa3c0=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa3c0,0x152));var _0x0a3c=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0xa3c0[_0x1e2321];return _0x1d346d;};'use strict';var _=require(_0x0a3c('0x0'));var util=require(_0x0a3c('0x1'));var moment=require(_0x0a3c('0x2'));var BPromise=require(_0x0a3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a3c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a3c('0x5'));var logger=require(_0x0a3c('0x6'))(_0x0a3c('0x7'));var config=require('../../config/environment');var jayson=require(_0x0a3c('0x8'));var client=jayson[_0x0a3c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd8d7b,_0x915099,_0x485cee){return new BPromise(function(_0x8f9638,_0xda6796){return client[_0x0a3c('0xa')](_0xfd8d7b,_0x485cee)['then'](function(_0x50e257){logger[_0x0a3c('0xb')](_0x0a3c('0xc'),_0x915099,_0x0a3c('0xd'));logger['debug'](_0x0a3c('0xe'),_0x915099,_0x0a3c('0xd'),JSON[_0x0a3c('0xf')](_0x50e257));if(_0x50e257[_0x0a3c('0x10')]){if(_0x50e257['error'][_0x0a3c('0x11')]===0x1f4){logger[_0x0a3c('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x915099,_0x50e257['error'][_0x0a3c('0x12')]);return _0xda6796(_0x50e257['error'][_0x0a3c('0x12')]);}logger[_0x0a3c('0x10')](_0x0a3c('0xc'),_0x915099,_0x50e257[_0x0a3c('0x10')][_0x0a3c('0x12')]);return _0x8f9638(_0x50e257[_0x0a3c('0x10')][_0x0a3c('0x12')]);}else{logger[_0x0a3c('0xb')](_0x0a3c('0xc'),_0x915099,_0x0a3c('0xd'));_0x8f9638(_0x50e257['result'][_0x0a3c('0x12')]);}})['catch'](function(_0x3ee02c){logger[_0x0a3c('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x915099,_0x3ee02c);_0xda6796(_0x3ee02c);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index a3a9ef8..982bb5d 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 _0x40e8=['../../config/environment','get','index','/:id','isAuthenticated','post','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x40e8,0x1d5));var _0x840e=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0x40e8[_0x403c8d];return _0x4ca60d;};'use strict';var multer=require('multer');var util=require(_0x840e('0x0'));var path=require(_0x840e('0x1'));var timeout=require(_0x840e('0x2'));var express=require('express');var router=express[_0x840e('0x3')]();var fs_extra=require(_0x840e('0x4'));var auth=require(_0x840e('0x5'));var interaction=require(_0x840e('0x6'));var config=require(_0x840e('0x7'));var controller=require('./cmContactHasItem.controller');router[_0x840e('0x8')]('/',auth['isAuthenticated'](),controller[_0x840e('0x9')]);router[_0x840e('0x8')](_0x840e('0xa'),auth[_0x840e('0xb')](),controller['show']);router[_0x840e('0xc')]('/',auth[_0x840e('0xb')](),controller['create']);router[_0x840e('0xd')](_0x840e('0xa'),auth[_0x840e('0xb')](),controller[_0x840e('0xe')]);router['delete'](_0x840e('0xa'),auth[_0x840e('0xb')](),controller[_0x840e('0xf')]);module[_0x840e('0x10')]=router; \ No newline at end of file +var _0x980c=['../../config/environment','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','post','create','put','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x50d993,_0x300507){var _0x5483d4=function(_0x10b741){while(--_0x10b741){_0x50d993['push'](_0x50d993['shift']());}};_0x5483d4(++_0x300507);}(_0x980c,0x161));var _0xc980=function(_0x5310cc,_0x41c235){_0x5310cc=_0x5310cc-0x0;var _0x2c8f9b=_0x980c[_0x5310cc];return _0x2c8f9b;};'use strict';var multer=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var path=require(_0xc980('0x2'));var timeout=require('connect-timeout');var express=require(_0xc980('0x3'));var router=express['Router']();var fs_extra=require(_0xc980('0x4'));var auth=require(_0xc980('0x5'));var interaction=require(_0xc980('0x6'));var config=require(_0xc980('0x7'));var controller=require(_0xc980('0x8'));router[_0xc980('0x9')]('/',auth['isAuthenticated'](),controller[_0xc980('0xa')]);router[_0xc980('0x9')](_0xc980('0xb'),auth[_0xc980('0xc')](),controller['show']);router[_0xc980('0xd')]('/',auth[_0xc980('0xc')](),controller[_0xc980('0xe')]);router[_0xc980('0xf')](_0xc980('0xb'),auth[_0xc980('0xc')](),controller[_0xc980('0x10')]);router['delete']('/:id',auth[_0xc980('0xc')](),controller['destroy']);module[_0xc980('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index d940d80..28e3e85 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 _0x82d3=['BOOLEAN','voice','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','long','type','parse','values'];(function(_0xe3a3fa,_0x4a6be2){var _0x5f2c72=function(_0x3212dd){while(--_0x3212dd){_0xe3a3fa['push'](_0xe3a3fa['shift']());}};_0x5f2c72(++_0x4a6be2);}(_0x82d3,0xe2));var _0x382d=function(_0x3f6133,_0x2b2928){_0x3f6133=_0x3f6133-0x0;var _0x4602a0=_0x82d3[_0x3f6133];return _0x4602a0;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x382d('0x0')]={'name':{'type':Sequelize[_0x382d('0x1')],'get':function(_0x2b24fb){return this[_0x382d('0x2')]('alias');}},'alias':{'type':Sequelize[_0x382d('0x3')],'allowNull':![],'set':function(_0x9dd209){this[_0x382d('0x4')](_0x382d('0x5'),_0x9dd209?_0x9dd209:this[_0x382d('0x2')](_0x382d('0x6')));}},'type':{'type':Sequelize[_0x382d('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x382d('0x7')](_0x382d('0x8')),'get':function(){if(this[_0x382d('0x2')](_0x382d('0x9'))==='select'){return JSON[_0x382d('0xa')](this[_0x382d('0x2')](_0x382d('0xb')));}else{return this[_0x382d('0x2')](_0x382d('0xb'));}},'set':function(_0x3b93f2){if(Array['isArray'](_0x3b93f2)){this['setDataValue'](_0x382d('0xb'),JSON['stringify'](_0x3b93f2));}else{this[_0x382d('0x4')](_0x382d('0xb'),_0x3b93f2);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x382d('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x382d('0xd'))}}; \ No newline at end of file +var _0xb24a=['parse','values','stringify','BOOLEAN','voice','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','long','type','select'];(function(_0x278d7,_0x3a4d16){var _0x5a0cad=function(_0xc35576){while(--_0xc35576){_0x278d7['push'](_0x278d7['shift']());}};_0x5a0cad(++_0x3a4d16);}(_0xb24a,0x19d));var _0xab24=function(_0x3a166a,_0x2018be){_0x3a166a=_0x3a166a-0x0;var _0x1b0279=_0xb24a[_0x3a166a];return _0x1b0279;};'use strict';var Sequelize=require('sequelize');var _=require(_0xab24('0x0'));module[_0xab24('0x1')]={'name':{'type':Sequelize[_0xab24('0x2')],'get':function(_0x2143ed){return this[_0xab24('0x3')]('alias');}},'alias':{'type':Sequelize[_0xab24('0x4')],'allowNull':![],'set':function(_0x36bdf6){this[_0xab24('0x5')](_0xab24('0x6'),_0x36bdf6?_0x36bdf6:this[_0xab24('0x3')](_0xab24('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xab24('0x8')](_0xab24('0x9')),'get':function(){if(this['getDataValue'](_0xab24('0xa'))===_0xab24('0xb')){return JSON[_0xab24('0xc')](this[_0xab24('0x3')](_0xab24('0xd')));}else{return this[_0xab24('0x3')](_0xab24('0xd'));}},'set':function(_0x6d8e6){if(Array['isArray'](_0x6d8e6)){this[_0xab24('0x5')](_0xab24('0xd'),JSON[_0xab24('0xe')](_0x6d8e6));}else{this[_0xab24('0x5')](_0xab24('0xd'),_0x6d8e6);}}},'required':{'type':Sequelize[_0xab24('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xab24('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6a7353e..46ed798 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 _0x3d6e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','then','destroy','error','index','map','rawAttributes','fieldName','key','differenceBy','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','CmCustomField','findAll','rows','catch','show','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','format','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x4c36bd,_0x1ea67b){var _0x12c4b2=function(_0x33e6ce){while(--_0x33e6ce){_0x4c36bd['push'](_0x4c36bd['shift']());}};_0x12c4b2(++_0x1ea67b);}(_0x3d6e,0x9a));var _0xe3d6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x3d6e[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0xe3d6('0x0'));var rimraf=require(_0xe3d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3d6('0x2'));var BPromise=require(_0xe3d6('0x3'));var Mustache=require(_0xe3d6('0x4'));var util=require('util');var path=require(_0xe3d6('0x5'));var sox=require('sox');var csv=require(_0xe3d6('0x6'));var ejs=require(_0xe3d6('0x7'));var fs=require('fs');var fs_extra=require(_0xe3d6('0x8'));var _=require(_0xe3d6('0x9'));var squel=require(_0xe3d6('0xa'));var crypto=require(_0xe3d6('0xb'));var jsforce=require(_0xe3d6('0xc'));var deskjs=require(_0xe3d6('0xd'));var toCsv=require(_0xe3d6('0x6'));var querystring=require('querystring');var Papa=require(_0xe3d6('0xe'));var Redis=require(_0xe3d6('0xf'));var authService=require(_0xe3d6('0x10'));var qs=require(_0xe3d6('0x11'));var as=require(_0xe3d6('0x12'));var hardwareService=require(_0xe3d6('0x13'));var logger=require(_0xe3d6('0x14'))(_0xe3d6('0x15'));var utils=require('../../config/utils');var config=require(_0xe3d6('0x16'));var licenseUtil=require(_0xe3d6('0x17'));var db=require(_0xe3d6('0x18'))['db'];function respondWithStatusCode(_0x109c7b,_0x10b0f3){_0x10b0f3=_0x10b0f3||0xcc;return function(_0x24112f){if(_0x24112f){return _0x109c7b[_0xe3d6('0x19')](_0x10b0f3);}return _0x109c7b[_0xe3d6('0x1a')](_0x10b0f3)[_0xe3d6('0x1b')]();};}function respondWithResult(_0x56ea52,_0x525cd4){_0x525cd4=_0x525cd4||0xc8;return function(_0x564b52){if(_0x564b52){return _0x56ea52[_0xe3d6('0x1a')](_0x525cd4)[_0xe3d6('0x1c')](_0x564b52);}};}function respondWithFilteredResult(_0x4f4f7f,_0x2397ae){return function(_0x48648b){if(_0x48648b){var _0x1a8109=typeof _0x2397ae[_0xe3d6('0x1d')]===_0xe3d6('0x1e')&&typeof _0x2397ae['limit']===_0xe3d6('0x1e');var _0x246a28=_0x48648b['count'];var _0x58b0fc=_0x1a8109?0x0:_0x2397ae[_0xe3d6('0x1d')];var _0x5e043f=_0x1a8109?_0x48648b['count']:_0x2397ae[_0xe3d6('0x1d')]+_0x2397ae[_0xe3d6('0x1f')];var _0x2ae645;if(_0x5e043f>=_0x246a28){_0x5e043f=_0x246a28;_0x2ae645=0xc8;}else{_0x2ae645=0xce;}_0x4f4f7f[_0xe3d6('0x1a')](_0x2ae645);return _0x4f4f7f[_0xe3d6('0x20')]('Content-Range',_0x58b0fc+'-'+_0x5e043f+'/'+_0x246a28)[_0xe3d6('0x1c')](_0x48648b);}return null;};}function patchUpdates(_0x5cc6cd){return function(_0x397301){try{jsonpatch[_0xe3d6('0x21')](_0x397301,_0x5cc6cd,!![]);}catch(_0x555b8d){return BPromise['reject'](_0x555b8d);}return _0x397301['save']();};}function saveUpdates(_0x697340,_0x42e52a){return function(_0x197af9){if(_0x197af9){return _0x197af9['update'](_0x697340)[_0xe3d6('0x22')](function(_0xa2de85){return _0xa2de85;});}return null;};}function removeEntity(_0x41b84e,_0x2576d0){return function(_0x288077){if(_0x288077){return _0x288077[_0xe3d6('0x23')]()['then'](function(){_0x41b84e[_0xe3d6('0x1a')](0xcc)[_0xe3d6('0x1b')]();});}};}function handleEntityNotFound(_0x12fba3,_0x4ccfdb){return function(_0x3dfc77){if(!_0x3dfc77){_0x12fba3[_0xe3d6('0x19')](0x194);}return _0x3dfc77;};}function handleError(_0x3a1b93,_0x148cd1){_0x148cd1=_0x148cd1||0x1f4;return function(_0x21afdf){logger[_0xe3d6('0x24')](_0x21afdf['stack']);if(_0x21afdf['name']){delete _0x21afdf['name'];}_0x3a1b93[_0xe3d6('0x1a')](_0x148cd1)['send'](_0x21afdf);};}exports[_0xe3d6('0x25')]=function(_0x58a4a7,_0x3b598b){var _0x27800c={},_0x4b238f={},_0x2bf98f={'count':0x0,'rows':[]};var _0x5abde1=_[_0xe3d6('0x26')](db['CmCustomField'][_0xe3d6('0x27')],function(_0x1dd679){return{'name':_0x1dd679[_0xe3d6('0x28')],'type':_0x1dd679['type'][_0xe3d6('0x29')]};});_0x4b238f['model']=_[_0xe3d6('0x2a')](_['map'](_0x5abde1,_0xe3d6('0x2b')),[_0xe3d6('0x2b')]);_0x4b238f[_0xe3d6('0x2c')]=_[_0xe3d6('0x2d')](_0x58a4a7[_0xe3d6('0x2c')]);_0x4b238f[_0xe3d6('0x2e')]=_[_0xe3d6('0x2f')](_0x4b238f[_0xe3d6('0x30')],_0x4b238f[_0xe3d6('0x2c')]);_0x27800c[_0xe3d6('0x31')]=_[_0xe3d6('0x2f')](_0x4b238f[_0xe3d6('0x30')],qs['fields'](_0x58a4a7['query'][_0xe3d6('0x32')]));_0x27800c['attributes']=_0x27800c[_0xe3d6('0x31')][_0xe3d6('0x33')]?_0x27800c[_0xe3d6('0x31')]:_0x4b238f['model'];if(!_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x34')]('nolimit')){_0x27800c['limit']=qs[_0xe3d6('0x1f')](_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x1f')]);_0x27800c[_0xe3d6('0x1d')]=qs[_0xe3d6('0x1d')](_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x1d')]);}_0x27800c[_0xe3d6('0x35')]=qs['sort'](_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x36')]);_0x27800c[_0xe3d6('0x37')]=qs[_0xe3d6('0x2e')](_['pick'](_0x58a4a7['query'],_0x4b238f[_0xe3d6('0x2e')]),_0x5abde1);if(_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x38')]){_0x27800c[_0xe3d6('0x37')]=_[_0xe3d6('0x39')](_0x27800c[_0xe3d6('0x37')],{'$or':_[_0xe3d6('0x26')](_0x5abde1,function(_0x599460){if(_0x599460[_0xe3d6('0x3a')]!==_0xe3d6('0x3b')){var _0x288826={};_0x288826[_0x599460[_0xe3d6('0x2b')]]={'$like':'%'+_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x38')]+'%'};return _0x288826;}})});}_0x27800c=_['merge']({},_0x27800c,_0x58a4a7[_0xe3d6('0x3c')]);var _0x442fdb={'where':_0x27800c[_0xe3d6('0x37')]};return db['CmCustomField'][_0xe3d6('0x3d')](_0x442fdb)['then'](function(_0x412d6f){_0x2bf98f[_0xe3d6('0x3d')]=_0x412d6f;if(_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x3e')]){_0x27800c[_0xe3d6('0x3f')]=[{'all':!![]}];}return db[_0xe3d6('0x40')][_0xe3d6('0x41')](_0x27800c);})['then'](function(_0x34eace){_0x2bf98f[_0xe3d6('0x42')]=_0x34eace;return _0x2bf98f;})[_0xe3d6('0x22')](respondWithFilteredResult(_0x3b598b,_0x27800c))[_0xe3d6('0x43')](handleError(_0x3b598b,null));};exports[_0xe3d6('0x44')]=function(_0x41da8e,_0x4a3739){var _0x23d2bc={'raw':!![],'where':{'id':_0x41da8e['params']['id']}},_0xcf8397={};_0xcf8397[_0xe3d6('0x30')]=_['keys'](db[_0xe3d6('0x40')]['rawAttributes']);_0xcf8397['query']=_[_0xe3d6('0x2d')](_0x41da8e[_0xe3d6('0x2c')]);_0xcf8397[_0xe3d6('0x2e')]=_[_0xe3d6('0x2f')](_0xcf8397['model'],_0xcf8397[_0xe3d6('0x2c')]);_0x23d2bc['attributes']=_[_0xe3d6('0x2f')](_0xcf8397[_0xe3d6('0x30')],qs[_0xe3d6('0x32')](_0x41da8e[_0xe3d6('0x2c')][_0xe3d6('0x32')]));_0x23d2bc[_0xe3d6('0x31')]=_0x23d2bc[_0xe3d6('0x31')][_0xe3d6('0x33')]?_0x23d2bc[_0xe3d6('0x31')]:_0xcf8397[_0xe3d6('0x30')];if(_0x41da8e[_0xe3d6('0x2c')][_0xe3d6('0x3e')]){_0x23d2bc[_0xe3d6('0x3f')]=[{'all':!![]}];}_0x23d2bc=_[_0xe3d6('0x39')]({},_0x23d2bc,_0x41da8e[_0xe3d6('0x3c')]);return db[_0xe3d6('0x40')][_0xe3d6('0x45')](_0x23d2bc)['then'](handleEntityNotFound(_0x4a3739,null))[_0xe3d6('0x22')](respondWithResult(_0x4a3739,null))['catch'](handleError(_0x4a3739,null));};exports['update']=function(_0x2cf8c7,_0x5891b5){if(_0x2cf8c7[_0xe3d6('0x46')]['id']){delete _0x2cf8c7[_0xe3d6('0x46')]['id'];}return db[_0xe3d6('0x40')][_0xe3d6('0x45')]({'where':{'id':_0x2cf8c7[_0xe3d6('0x47')]['id']}})['then'](handleEntityNotFound(_0x5891b5,null))[_0xe3d6('0x22')](saveUpdates(_0x2cf8c7[_0xe3d6('0x46')],null))[_0xe3d6('0x22')](respondWithResult(_0x5891b5,null))[_0xe3d6('0x43')](handleError(_0x5891b5,null));};exports['destroy']=function(_0x5a5428,_0x142928){return db[_0xe3d6('0x40')][_0xe3d6('0x45')]({'where':{'id':_0x5a5428[_0xe3d6('0x47')]['id']}})[_0xe3d6('0x22')](handleEntityNotFound(_0x142928,null))['then'](removeEntity(_0x142928,null))[_0xe3d6('0x43')](handleError(_0x142928,null));};exports[_0xe3d6('0x48')]=function(_0x1c6545,_0x39302f){var _0xb09749;return db[_0xe3d6('0x49')][_0xe3d6('0x4a')](function(_0x43f82d){return db[_0xe3d6('0x40')][_0xe3d6('0x48')](_0x1c6545['body'],{'transaction':_0x43f82d})['then'](function(_0x10b7ae){_0xb09749=_0x10b7ae;var _0x5c9d18={'type':db[_0xe3d6('0x4b')][_0xe3d6('0x4c')],'transaction':_0x43f82d};switch(_0x1c6545[_0xe3d6('0x46')][_0xe3d6('0x3a')]){case _0xe3d6('0x4d'):_0x5c9d18[_0xe3d6('0x3a')]=db['Sequelize'][_0xe3d6('0x4c')];break;case _0xe3d6('0x4e'):_0x5c9d18[_0xe3d6('0x3a')]=db['Sequelize'][_0xe3d6('0x4f')];break;case _0xe3d6('0x50'):_0x5c9d18[_0xe3d6('0x3a')]=db[_0xe3d6('0x4b')][_0xe3d6('0x51')];_0x5c9d18[_0xe3d6('0x52')]=![];break;default:}return db[_0xe3d6('0x49')][_0xe3d6('0x53')]['addColumn']('cm_contacts',util[_0xe3d6('0x54')]('cf_%d',_0xb09749['id']),_0x5c9d18);})[_0xe3d6('0x22')](function(){return _0xb09749;});})['then'](respondWithResult(_0x39302f,0xc9))[_0xe3d6('0x43')](handleError(_0x39302f,null));}; \ No newline at end of file +var _0xd935=['update','destroy','then','end','sendStatus','error','stack','name','send','CmCustomField','rawAttributes','type','key','differenceBy','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','body','find','create','transaction','Sequelize','TEXT','text','number','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0xd935,0x1e1));var _0x5d93=function(_0x3af648,_0xe82ba6){_0x3af648=_0x3af648-0x0;var _0x3b13f8=_0xd935[_0x3af648];return _0x3b13f8;};'use strict';var emlformat=require(_0x5d93('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d93('0x1'));var jsonpatch=require(_0x5d93('0x2'));var rp=require(_0x5d93('0x3'));var moment=require(_0x5d93('0x4'));var BPromise=require(_0x5d93('0x5'));var Mustache=require(_0x5d93('0x6'));var util=require('util');var path=require(_0x5d93('0x7'));var sox=require(_0x5d93('0x8'));var csv=require('to-csv');var ejs=require(_0x5d93('0x9'));var fs=require('fs');var fs_extra=require(_0x5d93('0xa'));var _=require('lodash');var squel=require(_0x5d93('0xb'));var crypto=require(_0x5d93('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5d93('0xd'));var toCsv=require(_0x5d93('0xe'));var querystring=require(_0x5d93('0xf'));var Papa=require(_0x5d93('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5d93('0x11'));var as=require(_0x5d93('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d93('0x13'))(_0x5d93('0x14'));var utils=require(_0x5d93('0x15'));var config=require(_0x5d93('0x16'));var licenseUtil=require(_0x5d93('0x17'));var db=require(_0x5d93('0x18'))['db'];function respondWithStatusCode(_0x143d52,_0x4b79af){_0x4b79af=_0x4b79af||0xcc;return function(_0x2dd58c){if(_0x2dd58c){return _0x143d52['sendStatus'](_0x4b79af);}return _0x143d52[_0x5d93('0x19')](_0x4b79af)['end']();};}function respondWithResult(_0x37fe9a,_0x38f831){_0x38f831=_0x38f831||0xc8;return function(_0x458100){if(_0x458100){return _0x37fe9a[_0x5d93('0x19')](_0x38f831)['json'](_0x458100);}};}function respondWithFilteredResult(_0x39f551,_0x246741){return function(_0xc5efe0){if(_0xc5efe0){var _0x53c16d=typeof _0x246741[_0x5d93('0x1a')]===_0x5d93('0x1b')&&typeof _0x246741[_0x5d93('0x1c')]===_0x5d93('0x1b');var _0x4c0dc4=_0xc5efe0[_0x5d93('0x1d')];var _0x3026fe=_0x53c16d?0x0:_0x246741['offset'];var _0x4ac6a6=_0x53c16d?_0xc5efe0[_0x5d93('0x1d')]:_0x246741[_0x5d93('0x1a')]+_0x246741[_0x5d93('0x1c')];var _0x4e6ee9;if(_0x4ac6a6>=_0x4c0dc4){_0x4ac6a6=_0x4c0dc4;_0x4e6ee9=0xc8;}else{_0x4e6ee9=0xce;}_0x39f551[_0x5d93('0x19')](_0x4e6ee9);return _0x39f551[_0x5d93('0x1e')](_0x5d93('0x1f'),_0x3026fe+'-'+_0x4ac6a6+'/'+_0x4c0dc4)['json'](_0xc5efe0);}return null;};}function patchUpdates(_0x58f35c){return function(_0x67bb05){try{jsonpatch[_0x5d93('0x20')](_0x67bb05,_0x58f35c,!![]);}catch(_0x48efa7){return BPromise[_0x5d93('0x21')](_0x48efa7);}return _0x67bb05[_0x5d93('0x22')]();};}function saveUpdates(_0x430fcc,_0x575874){return function(_0x105776){if(_0x105776){return _0x105776[_0x5d93('0x23')](_0x430fcc)['then'](function(_0x2ba41f){return _0x2ba41f;});}return null;};}function removeEntity(_0x593604,_0x429158){return function(_0x49d07e){if(_0x49d07e){return _0x49d07e[_0x5d93('0x24')]()[_0x5d93('0x25')](function(){_0x593604[_0x5d93('0x19')](0xcc)[_0x5d93('0x26')]();});}};}function handleEntityNotFound(_0x5869b7,_0x7bda35){return function(_0x19e131){if(!_0x19e131){_0x5869b7[_0x5d93('0x27')](0x194);}return _0x19e131;};}function handleError(_0x9e7f24,_0x198cd8){_0x198cd8=_0x198cd8||0x1f4;return function(_0x1b3117){logger[_0x5d93('0x28')](_0x1b3117[_0x5d93('0x29')]);if(_0x1b3117[_0x5d93('0x2a')]){delete _0x1b3117[_0x5d93('0x2a')];}_0x9e7f24[_0x5d93('0x19')](_0x198cd8)[_0x5d93('0x2b')](_0x1b3117);};}exports['index']=function(_0x40594e,_0x48010f){var _0x360d5c={},_0x1dcc1f={},_0xf2e6e3={'count':0x0,'rows':[]};var _0x2b50c6=_['map'](db[_0x5d93('0x2c')][_0x5d93('0x2d')],function(_0x28a37b){return{'name':_0x28a37b['fieldName'],'type':_0x28a37b[_0x5d93('0x2e')][_0x5d93('0x2f')]};});_0x1dcc1f['model']=_[_0x5d93('0x30')](_[_0x5d93('0x31')](_0x2b50c6,_0x5d93('0x2a')),[_0x5d93('0x2a')]);_0x1dcc1f[_0x5d93('0x32')]=_['keys'](_0x40594e['query']);_0x1dcc1f[_0x5d93('0x33')]=_[_0x5d93('0x34')](_0x1dcc1f[_0x5d93('0x35')],_0x1dcc1f['query']);_0x360d5c['attributes']=_[_0x5d93('0x34')](_0x1dcc1f['model'],qs[_0x5d93('0x36')](_0x40594e[_0x5d93('0x32')][_0x5d93('0x36')]));_0x360d5c['attributes']=_0x360d5c[_0x5d93('0x37')][_0x5d93('0x38')]?_0x360d5c['attributes']:_0x1dcc1f['model'];if(!_0x40594e[_0x5d93('0x32')][_0x5d93('0x39')]('nolimit')){_0x360d5c[_0x5d93('0x1c')]=qs[_0x5d93('0x1c')](_0x40594e[_0x5d93('0x32')][_0x5d93('0x1c')]);_0x360d5c[_0x5d93('0x1a')]=qs['offset'](_0x40594e[_0x5d93('0x32')][_0x5d93('0x1a')]);}_0x360d5c[_0x5d93('0x3a')]=qs['sort'](_0x40594e[_0x5d93('0x32')]['sort']);_0x360d5c[_0x5d93('0x3b')]=qs[_0x5d93('0x33')](_[_0x5d93('0x3c')](_0x40594e['query'],_0x1dcc1f[_0x5d93('0x33')]),_0x2b50c6);if(_0x40594e['query'][_0x5d93('0x3d')]){_0x360d5c[_0x5d93('0x3b')]=_[_0x5d93('0x3e')](_0x360d5c[_0x5d93('0x3b')],{'$or':_[_0x5d93('0x31')](_0x2b50c6,function(_0x1ae2e0){if(_0x1ae2e0[_0x5d93('0x2e')]!==_0x5d93('0x3f')){var _0x3c6f0a={};_0x3c6f0a[_0x1ae2e0['name']]={'$like':'%'+_0x40594e['query'][_0x5d93('0x3d')]+'%'};return _0x3c6f0a;}})});}_0x360d5c=_['merge']({},_0x360d5c,_0x40594e[_0x5d93('0x40')]);var _0x58e9eb={'where':_0x360d5c[_0x5d93('0x3b')]};return db[_0x5d93('0x2c')]['count'](_0x58e9eb)[_0x5d93('0x25')](function(_0xf9460d){_0xf2e6e3[_0x5d93('0x1d')]=_0xf9460d;if(_0x40594e[_0x5d93('0x32')][_0x5d93('0x41')]){_0x360d5c[_0x5d93('0x42')]=[{'all':!![]}];}return db[_0x5d93('0x2c')][_0x5d93('0x43')](_0x360d5c);})[_0x5d93('0x25')](function(_0x555df7){_0xf2e6e3[_0x5d93('0x44')]=_0x555df7;return _0xf2e6e3;})[_0x5d93('0x25')](respondWithFilteredResult(_0x48010f,_0x360d5c))[_0x5d93('0x45')](handleError(_0x48010f,null));};exports[_0x5d93('0x46')]=function(_0x1556e5,_0x25f879){var _0xe13dce={'raw':!![],'where':{'id':_0x1556e5[_0x5d93('0x47')]['id']}},_0x240b34={};_0x240b34[_0x5d93('0x35')]=_[_0x5d93('0x48')](db[_0x5d93('0x2c')][_0x5d93('0x2d')]);_0x240b34[_0x5d93('0x32')]=_[_0x5d93('0x48')](_0x1556e5['query']);_0x240b34[_0x5d93('0x33')]=_[_0x5d93('0x34')](_0x240b34[_0x5d93('0x35')],_0x240b34['query']);_0xe13dce[_0x5d93('0x37')]=_[_0x5d93('0x34')](_0x240b34['model'],qs[_0x5d93('0x36')](_0x1556e5['query'][_0x5d93('0x36')]));_0xe13dce[_0x5d93('0x37')]=_0xe13dce[_0x5d93('0x37')]['length']?_0xe13dce[_0x5d93('0x37')]:_0x240b34[_0x5d93('0x35')];if(_0x1556e5['query']['includeAll']){_0xe13dce['include']=[{'all':!![]}];}_0xe13dce=_['merge']({},_0xe13dce,_0x1556e5[_0x5d93('0x40')]);return db[_0x5d93('0x2c')]['find'](_0xe13dce)[_0x5d93('0x25')](handleEntityNotFound(_0x25f879,null))[_0x5d93('0x25')](respondWithResult(_0x25f879,null))[_0x5d93('0x45')](handleError(_0x25f879,null));};exports['update']=function(_0x411aa4,_0x70d1f9){if(_0x411aa4['body']['id']){delete _0x411aa4[_0x5d93('0x49')]['id'];}return db[_0x5d93('0x2c')]['find']({'where':{'id':_0x411aa4[_0x5d93('0x47')]['id']}})[_0x5d93('0x25')](handleEntityNotFound(_0x70d1f9,null))[_0x5d93('0x25')](saveUpdates(_0x411aa4[_0x5d93('0x49')],null))['then'](respondWithResult(_0x70d1f9,null))['catch'](handleError(_0x70d1f9,null));};exports[_0x5d93('0x24')]=function(_0x4f36e1,_0x2c6bcf){return db['CmCustomField'][_0x5d93('0x4a')]({'where':{'id':_0x4f36e1[_0x5d93('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c6bcf,null))[_0x5d93('0x25')](removeEntity(_0x2c6bcf,null))[_0x5d93('0x45')](handleError(_0x2c6bcf,null));};exports[_0x5d93('0x4b')]=function(_0x1e3424,_0x255b56){var _0x280507;return db['sequelize'][_0x5d93('0x4c')](function(_0x6126ea){return db['CmCustomField']['create'](_0x1e3424[_0x5d93('0x49')],{'transaction':_0x6126ea})['then'](function(_0x1b9f46){_0x280507=_0x1b9f46;var _0x2319d9={'type':db[_0x5d93('0x4d')][_0x5d93('0x4e')],'transaction':_0x6126ea};switch(_0x1e3424[_0x5d93('0x49')][_0x5d93('0x2e')]){case _0x5d93('0x4f'):_0x2319d9[_0x5d93('0x2e')]=db[_0x5d93('0x4d')]['TEXT'];break;case _0x5d93('0x50'):_0x2319d9[_0x5d93('0x2e')]=db[_0x5d93('0x4d')]['INTEGER'];break;case'switch':_0x2319d9[_0x5d93('0x2e')]=db['Sequelize'][_0x5d93('0x51')];_0x2319d9[_0x5d93('0x52')]=![];break;default:}return db[_0x5d93('0x53')]['queryInterface'][_0x5d93('0x54')](_0x5d93('0x55'),util['format']('cf_%d',_0x280507['id']),_0x2319d9);})[_0x5d93('0x25')](function(){return _0x280507;});})[_0x5d93('0x25')](respondWithResult(_0x255b56,0xc9))[_0x5d93('0x45')](handleError(_0x255b56,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6163c13..458ff6a 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 _0xb10c=['../../config/logger','bluebird','request-promise','path','../../config/environment','define','cm_custom_fields','lodash','util'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb10c,0x6a));var _0xcb10=function(_0x4a72a0,_0x2b8292){_0x4a72a0=_0x4a72a0-0x0;var _0x143dd3=_0xb10c[_0x4a72a0];return _0x143dd3;};'use strict';var _=require(_0xcb10('0x0'));var util=require(_0xcb10('0x1'));var logger=require(_0xcb10('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcb10('0x3'));var rp=require(_0xcb10('0x4'));var fs=require('fs');var path=require(_0xcb10('0x5'));var rimraf=require('rimraf');var config=require(_0xcb10('0x6'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x557554,_0x110d82){return _0x557554[_0xcb10('0x7')]('CmCustomField',attributes,{'tableName':_0xcb10('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8881=['bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','api','moment'];(function(_0x5e5226,_0x3039c1){var _0xed9a85=function(_0x1f22f3){while(--_0x1f22f3){_0x5e5226['push'](_0x5e5226['shift']());}};_0xed9a85(++_0x3039c1);}(_0x8881,0xec));var _0x1888=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x8881[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require(_0x1888('0x0'));var util=require(_0x1888('0x1'));var logger=require('../../config/logger')(_0x1888('0x2'));var moment=require(_0x1888('0x3'));var BPromise=require(_0x1888('0x4'));var rp=require(_0x1888('0x5'));var fs=require('fs');var path=require(_0x1888('0x6'));var rimraf=require('rimraf');var config=require(_0x1888('0x7'));var attributes=require(_0x1888('0x8'));module[_0x1888('0x9')]=function(_0x48aa8b,_0x1ee086){return _0x48aa8b[_0x1888('0xa')]('CmCustomField',attributes,{'tableName':_0x1888('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 004c877..a379be9 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 _0xf194=['code','CmCustomField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53fc28,_0x59588a){var _0x1984af=function(_0xc4f172){while(--_0xc4f172){_0x53fc28['push'](_0x53fc28['shift']());}};_0x1984af(++_0x59588a);}(_0xf194,0x1b6));var _0x4f19=function(_0x3ade6b,_0x4789ef){_0x3ade6b=_0x3ade6b-0x0;var _0x235b4e=_0xf194[_0x3ade6b];return _0x235b4e;};'use strict';var _=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var moment=require(_0x4f19('0x2'));var BPromise=require(_0x4f19('0x3'));var rs=require(_0x4f19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f19('0x5'));var logger=require(_0x4f19('0x6'))(_0x4f19('0x7'));var config=require(_0x4f19('0x8'));var jayson=require(_0x4f19('0x9'));var client=jayson['client'][_0x4f19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e762,_0x230035,_0x44e9b5){return new BPromise(function(_0x1558b5,_0x2055e8){return client[_0x4f19('0xb')](_0x2e762,_0x44e9b5)[_0x4f19('0xc')](function(_0x48ecae){logger['info']('CmCustomField,\x20%s,\x20%s',_0x230035,_0x4f19('0xd'));logger[_0x4f19('0xe')](_0x4f19('0xf'),_0x230035,_0x4f19('0xd'),JSON[_0x4f19('0x10')](_0x48ecae));if(_0x48ecae[_0x4f19('0x11')]){if(_0x48ecae[_0x4f19('0x11')][_0x4f19('0x12')]===0x1f4){logger[_0x4f19('0x11')](_0x4f19('0x13'),_0x230035,_0x48ecae[_0x4f19('0x11')]['message']);return _0x2055e8(_0x48ecae[_0x4f19('0x11')]['message']);}logger[_0x4f19('0x11')](_0x4f19('0x13'),_0x230035,_0x48ecae[_0x4f19('0x11')][_0x4f19('0x14')]);return _0x1558b5(_0x48ecae[_0x4f19('0x11')][_0x4f19('0x14')]);}else{logger[_0x4f19('0x15')](_0x4f19('0x13'),_0x230035,_0x4f19('0xd'));_0x1558b5(_0x48ecae[_0x4f19('0x16')][_0x4f19('0x14')]);}})[_0x4f19('0x17')](function(_0x277dec){logger[_0x4f19('0x11')](_0x4f19('0x13'),_0x230035,_0x277dec);_0x2055e8(_0x277dec);});});} \ No newline at end of file +var _0x32f3=['jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x32f3,0xd4));var _0x332f=function(_0xa057d7,_0x60c63){_0xa057d7=_0xa057d7-0x0;var _0x4506ca=_0x32f3[_0xa057d7];return _0x4506ca;};'use strict';var _=require('lodash');var util=require(_0x332f('0x0'));var moment=require(_0x332f('0x1'));var BPromise=require(_0x332f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x332f('0x3'));var db=require(_0x332f('0x4'))['db'];var utils=require(_0x332f('0x5'));var logger=require('../../config/logger')(_0x332f('0x6'));var config=require(_0x332f('0x7'));var jayson=require(_0x332f('0x8'));var client=jayson[_0x332f('0x9')][_0x332f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f3c2c,_0x32537d,_0x12fde1){return new BPromise(function(_0xe6e45f,_0x44eee3){return client[_0x332f('0xb')](_0x2f3c2c,_0x12fde1)['then'](function(_0x38dd4e){logger[_0x332f('0xc')]('CmCustomField,\x20%s,\x20%s',_0x32537d,_0x332f('0xd'));logger[_0x332f('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x32537d,_0x332f('0xd'),JSON[_0x332f('0xf')](_0x38dd4e));if(_0x38dd4e[_0x332f('0x10')]){if(_0x38dd4e['error'][_0x332f('0x11')]===0x1f4){logger[_0x332f('0x10')](_0x332f('0x12'),_0x32537d,_0x38dd4e[_0x332f('0x10')][_0x332f('0x13')]);return _0x44eee3(_0x38dd4e[_0x332f('0x10')]['message']);}logger[_0x332f('0x10')](_0x332f('0x12'),_0x32537d,_0x38dd4e[_0x332f('0x10')][_0x332f('0x13')]);return _0xe6e45f(_0x38dd4e[_0x332f('0x10')]['message']);}else{logger[_0x332f('0xc')](_0x332f('0x12'),_0x32537d,'request\x20sent');_0xe6e45f(_0x38dd4e[_0x332f('0x14')][_0x332f('0x13')]);}})[_0x332f('0x15')](function(_0x2e2b7f){logger[_0x332f('0x10')](_0x332f('0x12'),_0x32537d,_0x2e2b7f);_0x44eee3(_0x2e2b7f);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 96476f6..20552b8 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 _0x78b7=['create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x5c24c7,_0x537966){var _0x176969=function(_0x325522){while(--_0x325522){_0x5c24c7['push'](_0x5c24c7['shift']());}};_0x176969(++_0x537966);}(_0x78b7,0x194));var _0x778b=function(_0x1cbb45,_0x1ce25d){_0x1cbb45=_0x1cbb45-0x0;var _0x91c4f1=_0x78b7[_0x1cbb45];return _0x91c4f1;};'use strict';var multer=require(_0x778b('0x0'));var util=require(_0x778b('0x1'));var path=require('path');var timeout=require(_0x778b('0x2'));var express=require(_0x778b('0x3'));var router=express[_0x778b('0x4')]();var fs_extra=require(_0x778b('0x5'));var auth=require(_0x778b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x778b('0x7'));router[_0x778b('0x8')]('/',auth[_0x778b('0x9')](),controller[_0x778b('0xa')]);router[_0x778b('0x8')](_0x778b('0xb'),auth['isAuthenticated'](),controller[_0x778b('0xc')]);router[_0x778b('0xd')]('/',auth[_0x778b('0x9')](),controller[_0x778b('0xe')]);router[_0x778b('0xf')]('/:id',auth[_0x778b('0x9')](),controller[_0x778b('0x10')]);router['delete'](_0x778b('0xb'),auth[_0x778b('0x9')](),controller[_0x778b('0x11')]);module[_0x778b('0x12')]=router; \ No newline at end of file +var _0xb4e6=['express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2cc5da,_0x4aeff5){var _0x5eaae6=function(_0x1b39fe){while(--_0x1b39fe){_0x2cc5da['push'](_0x2cc5da['shift']());}};_0x5eaae6(++_0x4aeff5);}(_0xb4e6,0xd8));var _0x6b4e=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0xb4e6[_0xf9a6cf];return _0x59e2bc;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require(_0x6b4e('0x1'));var path=require(_0x6b4e('0x2'));var timeout=require(_0x6b4e('0x3'));var express=require(_0x6b4e('0x4'));var router=express[_0x6b4e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6b4e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b4e('0x7'));var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')](_0x6b4e('0xb'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0xd')]('/',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')](_0x6b4e('0xb'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x10')]);router[_0x6b4e('0x11')](_0x6b4e('0xb'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x12')]);module[_0x6b4e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 77da871..3e04525 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 _0x9f94=['contactListQueue','sequelize','exports','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0xed4881,_0x45771c){var _0x7fcbd5=function(_0x36b960){while(--_0x36b960){_0xed4881['push'](_0xed4881['shift']());}};_0x7fcbd5(++_0x45771c);}(_0x9f94,0x1e1));var _0x49f9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9f94[_0x46e363];return _0x3fb059;};'use strict';var moment=require('moment');var Sequelize=require(_0x49f9('0x0'));module[_0x49f9('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x49f9('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x49f9('0x3')],'defaultValue':moment()['format'](_0x49f9('0x4'))},'countbusyretry':{'type':Sequelize[_0x49f9('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x49f9('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x49f9('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x49f9('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x49f9('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x49f9('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x49f9('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x49f9('0x5')],'unique':_0x49f9('0x7')},'ListId':{'type':Sequelize[_0x49f9('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x49f9('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x49f9('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x49f9('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9e9b=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN'];(function(_0x445f9d,_0x582e07){var _0x271683=function(_0x3749ab){while(--_0x3749ab){_0x445f9d['push'](_0x445f9d['shift']());}};_0x271683(++_0x582e07);}(_0x9e9b,0x164));var _0xb9e9=function(_0x2cbec0,_0x262fef){_0x2cbec0=_0x2cbec0-0x0;var _0x3d4101=_0x9e9b[_0x2cbec0];return _0x3d4101;};'use strict';var moment=require(_0xb9e9('0x0'));var Sequelize=require(_0xb9e9('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb9e9('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb9e9('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb9e9('0x4')],'defaultValue':moment()['format'](_0xb9e9('0x5'))},'countbusyretry':{'type':Sequelize[_0xb9e9('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb9e9('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb9e9('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb9e9('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb9e9('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb9e9('0x4')]},'priority':{'type':Sequelize[_0xb9e9('0x6')](0x2)[_0xb9e9('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb9e9('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb9e9('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb9e9('0x6')],'unique':_0xb9e9('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xb9e9('0x6')],'unique':_0xb9e9('0x8')},'CampaignId':{'type':Sequelize[_0xb9e9('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb9e9('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb9e9('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb9e9('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xb9e9('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xb9e9('0x4')],'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 81fed28..547d108 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 _0x8ece=['index','CmHopper','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','concat','$and','$or','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','statedesc','deleted','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','UPDATE','Contact','CmCompany','Company','List','VoiceQueue','dialActive','getPreviewRecall','findOne','recallme','LOCK','CmList','getOpenContacts','isNumber','error','entity\x20not\x20found','getTimezones','timezones','push','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','sendStatus','stack','name','send'];(function(_0x4b9ae4,_0x4be975){var _0x4d2f8b=function(_0x15db51){while(--_0x15db51){_0x4b9ae4['push'](_0x4b9ae4['shift']());}};_0x4d2f8b(++_0x4be975);}(_0x8ece,0x195));var _0xe8ec=function(_0x51b8eb,_0x45e664){_0x51b8eb=_0x51b8eb-0x0;var _0x219949=_0x8ece[_0x51b8eb];return _0x219949;};'use strict';var moment=require(_0xe8ec('0x0'));var _=require(_0xe8ec('0x1'));var qs=require(_0xe8ec('0x2'));var logger=require(_0xe8ec('0x3'))('api');var shared=require('../../config/environment');var db=require(_0xe8ec('0x4'))['db'];function respondWithResult(_0x30c05a,_0x5047e7){_0x5047e7=_0x5047e7||0xc8;return function(_0x433734){if(_0x433734){return _0x30c05a[_0xe8ec('0x5')](_0x5047e7)['json'](_0x433734);}};}function respondWithFilteredResult(_0x346577,_0x23fa35){return function(_0x64ed4c){if(_0x64ed4c){var _0x234b67=typeof _0x23fa35[_0xe8ec('0x6')]===_0xe8ec('0x7')&&typeof _0x23fa35[_0xe8ec('0x8')]==='undefined';var _0x44d128=_0x64ed4c['count'];var _0x1345e0=_0x234b67?0x0:_0x23fa35['offset'];var _0x1b0a84=_0x234b67?_0x64ed4c[_0xe8ec('0x9')]:_0x23fa35[_0xe8ec('0x6')]+_0x23fa35[_0xe8ec('0x8')];var _0x235e18;if(_0x1b0a84>=_0x44d128){_0x1b0a84=_0x44d128;_0x235e18=0xc8;}else{_0x235e18=0xce;}_0x346577[_0xe8ec('0x5')](_0x235e18);return _0x346577[_0xe8ec('0xa')](_0xe8ec('0xb'),_0x1345e0+'-'+_0x1b0a84+'/'+_0x44d128)[_0xe8ec('0xc')](_0x64ed4c);}return null;};}function saveUpdates(_0x69a424,_0xf72aa7){return function(_0x153203){if(_0x153203){return _0x153203[_0xe8ec('0xd')](_0x69a424)['then'](function(_0x15de29){return _0x15de29;});}return null;};}function handleEntityNotFound(_0x431723,_0x2e5a88){return function(_0x167ebb){if(!_0x167ebb){_0x431723[_0xe8ec('0xe')](0x194);}return _0x167ebb;};}function handleError(_0xdb2565,_0x1e76ac){_0x1e76ac=_0x1e76ac||0x1f4;return function(_0x218a4b){logger['error'](_0x218a4b[_0xe8ec('0xf')]);if(_0x218a4b[_0xe8ec('0x10')]){delete _0x218a4b[_0xe8ec('0x10')];}_0xdb2565['status'](_0x1e76ac)[_0xe8ec('0x11')](_0x218a4b);};}exports[_0xe8ec('0x12')]=function(_0x2a3b73,_0x34a582){var _0x9a6f0c={},_0x39e557={},_0x1d183a={'count':0x0,'rows':[]};var _0x2e54f0=_['map'](db[_0xe8ec('0x13')][_0xe8ec('0x14')],function(_0x13c5c8){return{'name':_0x13c5c8[_0xe8ec('0x15')],'type':_0x13c5c8[_0xe8ec('0x16')][_0xe8ec('0x17')]};});_0x39e557[_0xe8ec('0x18')]=_[_0xe8ec('0x19')](_0x2e54f0,_0xe8ec('0x10'));_0x39e557['query']=_[_0xe8ec('0x1a')](_0x2a3b73[_0xe8ec('0x1b')]);_0x39e557[_0xe8ec('0x1c')]=_[_0xe8ec('0x1d')](_0x39e557[_0xe8ec('0x18')],_0x39e557['query']);_0x39e557[_0xe8ec('0x1c')]=_[_0xe8ec('0x1e')](_0x39e557[_0xe8ec('0x1c')],[_0xe8ec('0x1f'),_0xe8ec('0x20'),_0xe8ec('0x21'),'$gte','$lt',_0xe8ec('0x22'),_0xe8ec('0x23'),_0xe8ec('0x24'),_0xe8ec('0x25'),_0xe8ec('0x26'),_0xe8ec('0x27'),_0xe8ec('0x28'),_0xe8ec('0x29'),_0xe8ec('0x2a'),_0xe8ec('0x2b'),_0xe8ec('0x2c'),_0xe8ec('0x2d'),_0xe8ec('0x2a'),_0xe8ec('0x2e'),_0xe8ec('0x2f'),'$contained',_0xe8ec('0x30')]);_0x9a6f0c[_0xe8ec('0x31')]=_[_0xe8ec('0x1d')](_0x39e557['model'],qs[_0xe8ec('0x32')](_0x2a3b73['query'][_0xe8ec('0x32')]));_0x9a6f0c[_0xe8ec('0x31')]=_0x9a6f0c[_0xe8ec('0x31')][_0xe8ec('0x33')]?_0x9a6f0c[_0xe8ec('0x31')]:_0x39e557['model'];if(!_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x34')](_0xe8ec('0x35'))){_0x9a6f0c['limit']=qs[_0xe8ec('0x8')](_0x2a3b73['query'][_0xe8ec('0x8')]);_0x9a6f0c[_0xe8ec('0x6')]=qs[_0xe8ec('0x6')](_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x6')]);}_0x9a6f0c[_0xe8ec('0x36')]=qs[_0xe8ec('0x37')](_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x37')]);_0x9a6f0c['where']=qs[_0xe8ec('0x1c')](_[_0xe8ec('0x38')](_0x2a3b73[_0xe8ec('0x1b')],_0x39e557['filters']),_0x2e54f0);if(_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x39')]){_0x9a6f0c['where']=_[_0xe8ec('0x3a')](_0x9a6f0c[_0xe8ec('0x3b')],{'$or':_[_0xe8ec('0x19')](_0x2e54f0,function(_0x15dd54){if(_0x15dd54['type']!==_0xe8ec('0x3c')){var _0x3c3a12={};_0x3c3a12[_0x15dd54[_0xe8ec('0x10')]]={'$like':'%'+_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x39')]+'%'};return _0x3c3a12;}})});}_0x9a6f0c=_[_0xe8ec('0x3a')]({},_0x9a6f0c,_0x2a3b73[_0xe8ec('0x3d')]);var _0x29f78a={'where':_0x9a6f0c['where']};return db['CmHopper'][_0xe8ec('0x9')](_0x29f78a)[_0xe8ec('0x3e')](function(_0x25406d){_0x1d183a[_0xe8ec('0x9')]=_0x25406d;if(_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x3f')]){_0x9a6f0c[_0xe8ec('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0xe8ec('0x41')](_0x9a6f0c);})['then'](function(_0x341c75){_0x1d183a[_0xe8ec('0x42')]=_0x341c75;return _0x1d183a;})['then'](respondWithFilteredResult(_0x34a582,_0x9a6f0c))['catch'](handleError(_0x34a582,null));};exports[_0xe8ec('0x43')]=function(_0x2591e5,_0x34c572){var _0x5c99cd={'raw':!![],'where':{'id':_0x2591e5[_0xe8ec('0x44')]['id']}},_0x1223b8={};_0x1223b8[_0xe8ec('0x18')]=_[_0xe8ec('0x1a')](db[_0xe8ec('0x13')]['rawAttributes']);_0x1223b8['query']=_[_0xe8ec('0x1a')](_0x2591e5['query']);_0x1223b8[_0xe8ec('0x1c')]=_[_0xe8ec('0x1d')](_0x1223b8[_0xe8ec('0x18')],_0x1223b8[_0xe8ec('0x1b')]);_0x5c99cd[_0xe8ec('0x31')]=_[_0xe8ec('0x1d')](_0x1223b8[_0xe8ec('0x18')],qs['fields'](_0x2591e5[_0xe8ec('0x1b')][_0xe8ec('0x32')]));_0x5c99cd[_0xe8ec('0x31')]=_0x5c99cd[_0xe8ec('0x31')][_0xe8ec('0x33')]?_0x5c99cd[_0xe8ec('0x31')]:_0x1223b8[_0xe8ec('0x18')];if(_0x2591e5[_0xe8ec('0x1b')]['includeAll']){_0x5c99cd[_0xe8ec('0x40')]=[{'all':!![]}];}_0x5c99cd=_[_0xe8ec('0x3a')]({},_0x5c99cd,_0x2591e5[_0xe8ec('0x3d')]);return db['CmHopper'][_0xe8ec('0x45')](_0x5c99cd)['then'](handleEntityNotFound(_0x34c572,null))[_0xe8ec('0x3e')](respondWithResult(_0x34c572,null))[_0xe8ec('0x46')](handleError(_0x34c572,null));};exports[_0xe8ec('0x47')]=function(_0x5e8740,_0x230305){return db[_0xe8ec('0x13')]['create'](_0x5e8740[_0xe8ec('0x48')],{})['then'](respondWithResult(_0x230305,0xc9))[_0xe8ec('0x46')](handleError(_0x230305,null));};exports['update']=function(_0x82a0db,_0x1028dd){if(_0x82a0db[_0xe8ec('0x48')]['id']){delete _0x82a0db[_0xe8ec('0x48')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x82a0db['params']['id']}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x1028dd,null))[_0xe8ec('0x3e')](saveUpdates(_0x82a0db[_0xe8ec('0x48')],null))['then'](respondWithResult(_0x1028dd,null))[_0xe8ec('0x46')](handleError(_0x1028dd,null));};exports[_0xe8ec('0x49')]=function(_0x96ca5f,_0x1f96d9){return db[_0xe8ec('0x13')]['describe']()[_0xe8ec('0x3e')](respondWithResult(_0x1f96d9,null))[_0xe8ec('0x46')](handleError(_0x1f96d9,null));};exports[_0xe8ec('0x4a')]=function(_0x3de7aa,_0x329ef3){var _0xd3127;var _0x37611a=_0x3de7aa['params']['id'];return db[_0xe8ec('0x13')][_0xe8ec('0x45')]({'where':{'id':_0x3de7aa['params']['id']}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x329ef3,null))[_0xe8ec('0x3e')](function(_0x40b8e6){if(_0x40b8e6){return _0x40b8e6[_0xe8ec('0x4a')]()['then'](function(_0x30f211){return _0x30f211;});}})[_0xe8ec('0x3e')](function(_0x3ae6ae){_0xd3127=_0x3ae6ae;if(_0x3ae6ae){if(_0x3ae6ae[_0xe8ec('0x4b')]||_0x3ae6ae[_0xe8ec('0x4c')]){return db[_0x3ae6ae[_0xe8ec('0x4b')]?'VoiceQueue':_0xe8ec('0x4d')][_0xe8ec('0x45')]({'where':{'id':_0x3ae6ae['VoiceQueueId']?_0x3ae6ae['VoiceQueueId']:_0x3ae6ae[_0xe8ec('0x4c')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x3bd3fb){var _0xb2731e={};if(_0x3bd3fb){_[_0xe8ec('0x3a')](_0xb2731e,_[_0xe8ec('0x4e')](_0xd3127[_0xe8ec('0x4f')],[_0xe8ec('0x50'),'updatedAt','id']));_0xb2731e['state']=0x15;_0xb2731e[_0xe8ec('0x51')]=_0xe8ec('0x52');_0xb2731e['campaign']=_0x3bd3fb['name'];_0xb2731e[_0xe8ec('0x53')]=_0x3de7aa[_0xe8ec('0x54')][_0xe8ec('0x10')];_0xb2731e['UserId']=_0x3de7aa['user']['id'];_0xb2731e[_0xe8ec('0x52')]=!![];_0xb2731e[_0xe8ec('0x55')]=moment()[_0xe8ec('0x56')](_0xe8ec('0x57'));_0xb2731e['calleridnum']=_0xd3127['phone'];_0xb2731e[_0xe8ec('0x58')]=_0xd3127['VoiceQueueId']?_0xe8ec('0x59'):_0xe8ec('0x5a');return db['CmContact'][_0xe8ec('0x45')]({'where':{'id':_0xb2731e['ContactId']},'attributes':[_0xe8ec('0x5b'),'lastName']})[_0xe8ec('0x3e')](function(_0x307fce){if(!_[_0xe8ec('0x5c')](_0x329ef3)&&!_[_0xe8ec('0x5c')](_0x307fce[_0xe8ec('0x5b')])){_0xb2731e[_0xe8ec('0x5d')]=_0x307fce['firstName'];if(!_[_0xe8ec('0x5c')](_0x307fce['lastName'])){_0xb2731e[_0xe8ec('0x5d')]+='\x20'+_0x307fce[_0xe8ec('0x5e')];}}})[_0xe8ec('0x5f')](function(){return db[_0xe8ec('0x60')][_0xe8ec('0x47')](_0xb2731e);});}})['then'](function(_0x471a6a){return db[_0xe8ec('0x61')]['destroy']({'where':{'CmHopperId':_0x37611a}});})['then'](function(){return _0x329ef3[_0xe8ec('0x5')](0xcc)[_0xe8ec('0x62')]();})['catch'](handleError(_0x329ef3,null));};exports[_0xe8ec('0x63')]=function(_0x41e5a5,_0x4ee845){var _0x492062=[];return db[_0xe8ec('0x64')][_0xe8ec('0x49')]()['then'](function(_0x4fef2b){_0x492062=_[_0xe8ec('0x1a')](_0x4fef2b);return _0x41e5a5[_0xe8ec('0x54')][_0xe8ec('0x65')]({'where':{'type':_0xe8ec('0x66'),'dialActive':!![],'dialMethod':_0xe8ec('0x67')},'attributes':['id',_0xe8ec('0x68'),_0xe8ec('0x69')],'raw':!![]});})[_0xe8ec('0x3e')](function(_0x6071b5){if(_0x6071b5&&_0x6071b5[_0xe8ec('0x33')]){return db[_0xe8ec('0x6a')][_0xe8ec('0x6b')](function(_0x903ed5){var _0x277fc0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe8ec('0x56')](_0xe8ec('0x57'))},'VoiceQueueId':{'$in':_['map'](_0x6071b5,'id')},'$or':[{'UserId':null},{'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']}]};var _0x27850d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x6071b5)[_0xe8ec('0x39')]([_0xe8ec('0x69'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']}]};var _0x50c78d={'$or':[_0x277fc0,_0x27850d]};var _0x1ae75a=[];if(_0x41e5a5['body'][_0xe8ec('0x6c')]&&_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6c')]===_0xe8ec('0x6d')){if(!_[_0xe8ec('0x6e')](_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')])){_0x50c78d['id']={'$in':_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')]};}_0x1ae75a=[[_0xe8ec('0x70'),'ASC'],[_0xe8ec('0x71'),_0x6071b5[0x0][_0xe8ec('0x68')]===_0xe8ec('0x72')?_0xe8ec('0x73'):'ASC'],db[_0xe8ec('0x6a')]['literal'](_0xe8ec('0x74')),['id','DESC']];}else{if(!_[_0xe8ec('0x6e')](_0x41e5a5['body'][_0xe8ec('0x6f')])){_0x50c78d['id']={'$notIn':_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')]};}_0x1ae75a=[[_0xe8ec('0x70'),'DESC'],[_0xe8ec('0x71'),_0x6071b5[0x0]['dialOrderByScheduledAt']],db[_0xe8ec('0x6a')][_0xe8ec('0x75')](_0xe8ec('0x76')),['id',_0xe8ec('0x72')]];}return db[_0xe8ec('0x13')]['findOne']({'attributes':['id',_0xe8ec('0x77'),_0xe8ec('0x78'),'recallme'],'where':_0x50c78d,'order':_0x1ae75a,'transaction':_0x903ed5,'lock':_0x903ed5['LOCK'][_0xe8ec('0x79')],'include':[{'model':db[_0xe8ec('0x64')],'as':_0xe8ec('0x7a'),'attributes':_0x492062,'include':[{'model':db[_0xe8ec('0x7b')],'as':_0xe8ec('0x7c'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xe8ec('0x7d'),'attributes':['id',_0xe8ec('0x10')]},{'model':db[_0xe8ec('0x7e')],'as':'Queue','attributes':['id','name',_0xe8ec('0x7f')]}]})['then'](function(_0x39928f){if(_0x39928f){return _0x39928f['update']({'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']},{'transaction':_0x903ed5});}});});}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x4ee845,null))[_0xe8ec('0x3e')](respondWithResult(_0x4ee845,null))['catch'](handleError(_0x4ee845,null));};exports[_0xe8ec('0x80')]=function(_0x173dd9,_0x543a25,_0x16a85b){var _0x31125a=[];var _0x1bd095=_0x173dd9[_0xe8ec('0x44')]['id'];var _0x5a5aa7=_0x173dd9[_0xe8ec('0x54')]['id'];return db['CmContact'][_0xe8ec('0x49')]()[_0xe8ec('0x3e')](function(_0x4f116c){_0x31125a=_[_0xe8ec('0x1a')](_0x4f116c);return db[_0xe8ec('0x6a')][_0xe8ec('0x6b')](function(_0x49e13b){const _0x43af9b={'id':_0x1bd095};return db[_0xe8ec('0x13')][_0xe8ec('0x81')]({'attributes':['id',_0xe8ec('0x77'),_0xe8ec('0x82')],'where':_0x43af9b,'transaction':_0x49e13b,'lock':_0x49e13b[_0xe8ec('0x83')][_0xe8ec('0x79')],'include':[{'model':db[_0xe8ec('0x64')],'as':'Contact','attributes':_0x31125a,'include':[{'model':db['CmCompany'],'as':_0xe8ec('0x7c'),'attributes':['id',_0xe8ec('0x10')]}]},{'model':db[_0xe8ec('0x84')],'as':_0xe8ec('0x7d'),'attributes':['id',_0xe8ec('0x10')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0xe8ec('0x7f')]}]})[_0xe8ec('0x3e')](function(_0xb0dce6){if(_0xb0dce6){return _0xb0dce6[_0xe8ec('0xd')]({'UserId':_0x5a5aa7},{'transaction':_0x49e13b});}});});})[_0xe8ec('0x3e')](handleEntityNotFound(_0x543a25,null))['then'](respondWithResult(_0x543a25,null))['catch'](handleError(_0x543a25,null));};exports[_0xe8ec('0x85')]=function(_0x229753,_0x2f0f34){return _0x229753[_0xe8ec('0x54')]['getVoiceQueues']({'where':{'type':_0xe8ec('0x66'),'dialActive':!![],'dialMethod':_0xe8ec('0x67')},'attributes':['id'],'raw':!![]})[_0xe8ec('0x3e')](function(_0x5c20ba){if(_0x5c20ba&&_0x5c20ba[_0xe8ec('0x33')]){return db[_0xe8ec('0x13')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe8ec('0x56')](_0xe8ec('0x57'))},'VoiceQueueId':{'$in':_[_0xe8ec('0x19')](_0x5c20ba,'id')},'$or':[{'UserId':null},{'UserId':_0x229753[_0xe8ec('0x54')]['id']}]}});}return 0x0;})[_0xe8ec('0x3e')](function(_0x24c698){if(!_[_0xe8ec('0x5c')](_0x24c698)&&_[_0xe8ec('0x86')](_0x24c698)){return _0x2f0f34[_0xe8ec('0x5')](0xc8)[_0xe8ec('0xc')]({'contacts':_0x24c698});}else{logger[_0xe8ec('0x87')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xe8ec('0x85'),0x194,_0xe8ec('0x88'));_0x2f0f34[_0xe8ec('0xe')](0x194);}})['catch'](handleError(_0x2f0f34,null));};exports[_0xe8ec('0x89')]=function(_0x155a68,_0x1011f5){var _0x32b42c=shared[_0xe8ec('0x8a')];var _0x473c23=[];_['map'](_0x32b42c,function(_0x52fffa){_0x473c23[_0xe8ec('0x8b')]({'id':_0x52fffa['name'],'name':_0x52fffa[_0xe8ec('0x10')],'utcOffset':_0x52fffa['utcOffset']});});return _0x1011f5[_0xe8ec('0x5')](0xc8)['json']({'tz':_0x473c23});};exports[_0xe8ec('0x8c')]=function(_0x380048,_0x336204){var _0x54851b=shared['timezones'];var _0x1bd533={};if(!_[_0xe8ec('0x5c')](_0x54851b[_0x380048[_0xe8ec('0x48')]['id']]))_0x1bd533=_0x54851b[_0x380048[_0xe8ec('0x48')]['id']];return _0x336204['status'](0xc8)[_0xe8ec('0xc')](_0x1bd533);}; \ No newline at end of file +var _0x0689=['params','keys','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','ContactId','firstName','isNil','lastName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','dialActive','getPreviewRecall','LOCK','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','push','utcOffset','getTimezone','timezones','lodash','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','query','concat','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$in','$notIn','$iLike','$like','$overlap','$contains','$contained','$any','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','CmHopper','includeAll','include','findAll','rows','catch','show'];(function(_0x42e495,_0x49d9da){var _0x595da1=function(_0x587489){while(--_0x587489){_0x42e495['push'](_0x42e495['shift']());}};_0x595da1(++_0x49d9da);}(_0x0689,0x161));var _0x9068=function(_0x23f8d2,_0x301fec){_0x23f8d2=_0x23f8d2-0x0;var _0x5d174b=_0x0689[_0x23f8d2];return _0x5d174b;};'use strict';var moment=require('moment');var _=require(_0x9068('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x9068('0x1'))(_0x9068('0x2'));var shared=require(_0x9068('0x3'));var db=require(_0x9068('0x4'))['db'];function respondWithResult(_0x44080a,_0x1c35ba){_0x1c35ba=_0x1c35ba||0xc8;return function(_0x3b12f4){if(_0x3b12f4){return _0x44080a[_0x9068('0x5')](_0x1c35ba)[_0x9068('0x6')](_0x3b12f4);}};}function respondWithFilteredResult(_0x287846,_0x5ce5a7){return function(_0x34cb67){if(_0x34cb67){var _0x5c833f=typeof _0x5ce5a7['offset']===_0x9068('0x7')&&typeof _0x5ce5a7[_0x9068('0x8')]===_0x9068('0x7');var _0x77a2db=_0x34cb67[_0x9068('0x9')];var _0xf611cf=_0x5c833f?0x0:_0x5ce5a7[_0x9068('0xa')];var _0x141e26=_0x5c833f?_0x34cb67[_0x9068('0x9')]:_0x5ce5a7['offset']+_0x5ce5a7[_0x9068('0x8')];var _0xcba25d;if(_0x141e26>=_0x77a2db){_0x141e26=_0x77a2db;_0xcba25d=0xc8;}else{_0xcba25d=0xce;}_0x287846[_0x9068('0x5')](_0xcba25d);return _0x287846[_0x9068('0xb')]('Content-Range',_0xf611cf+'-'+_0x141e26+'/'+_0x77a2db)[_0x9068('0x6')](_0x34cb67);}return null;};}function saveUpdates(_0x1a89d4,_0x39eae8){return function(_0x4ba797){if(_0x4ba797){return _0x4ba797[_0x9068('0xc')](_0x1a89d4)[_0x9068('0xd')](function(_0x414054){return _0x414054;});}return null;};}function handleEntityNotFound(_0x479675,_0x322640){return function(_0x3ea030){if(!_0x3ea030){_0x479675['sendStatus'](0x194);}return _0x3ea030;};}function handleError(_0x2db941,_0x2952f8){_0x2952f8=_0x2952f8||0x1f4;return function(_0x486714){logger[_0x9068('0xe')](_0x486714[_0x9068('0xf')]);if(_0x486714[_0x9068('0x10')]){delete _0x486714[_0x9068('0x10')];}_0x2db941['status'](_0x2952f8)[_0x9068('0x11')](_0x486714);};}exports[_0x9068('0x12')]=function(_0x3ab698,_0x36d591){var _0x3e3a1c={},_0x1d09bf={},_0xebe833={'count':0x0,'rows':[]};var _0x2cc220=_[_0x9068('0x13')](db['CmHopper'][_0x9068('0x14')],function(_0x39ed88){return{'name':_0x39ed88[_0x9068('0x15')],'type':_0x39ed88[_0x9068('0x16')][_0x9068('0x17')]};});_0x1d09bf[_0x9068('0x18')]=_[_0x9068('0x13')](_0x2cc220,_0x9068('0x10'));_0x1d09bf['query']=_['keys'](_0x3ab698['query']);_0x1d09bf[_0x9068('0x19')]=_['intersection'](_0x1d09bf['model'],_0x1d09bf[_0x9068('0x1a')]);_0x1d09bf[_0x9068('0x19')]=_[_0x9068('0x1b')](_0x1d09bf[_0x9068('0x19')],['$and',_0x9068('0x1c'),_0x9068('0x1d'),_0x9068('0x1e'),_0x9068('0x1f'),_0x9068('0x20'),_0x9068('0x21'),'$eq',_0x9068('0x22'),_0x9068('0x23'),'$notBetween',_0x9068('0x24'),_0x9068('0x25'),'$like','$notLike',_0x9068('0x26'),'$notILike',_0x9068('0x27'),_0x9068('0x28'),_0x9068('0x29'),_0x9068('0x2a'),_0x9068('0x2b')]);_0x3e3a1c['attributes']=_[_0x9068('0x2c')](_0x1d09bf[_0x9068('0x18')],qs[_0x9068('0x2d')](_0x3ab698[_0x9068('0x1a')]['fields']));_0x3e3a1c['attributes']=_0x3e3a1c[_0x9068('0x2e')][_0x9068('0x2f')]?_0x3e3a1c[_0x9068('0x2e')]:_0x1d09bf[_0x9068('0x18')];if(!_0x3ab698[_0x9068('0x1a')][_0x9068('0x30')](_0x9068('0x31'))){_0x3e3a1c[_0x9068('0x8')]=qs[_0x9068('0x8')](_0x3ab698[_0x9068('0x1a')]['limit']);_0x3e3a1c[_0x9068('0xa')]=qs[_0x9068('0xa')](_0x3ab698[_0x9068('0x1a')]['offset']);}_0x3e3a1c[_0x9068('0x32')]=qs[_0x9068('0x33')](_0x3ab698[_0x9068('0x1a')][_0x9068('0x33')]);_0x3e3a1c['where']=qs[_0x9068('0x19')](_['pick'](_0x3ab698[_0x9068('0x1a')],_0x1d09bf['filters']),_0x2cc220);if(_0x3ab698[_0x9068('0x1a')][_0x9068('0x34')]){_0x3e3a1c[_0x9068('0x35')]=_[_0x9068('0x36')](_0x3e3a1c[_0x9068('0x35')],{'$or':_['map'](_0x2cc220,function(_0xc05c9c){if(_0xc05c9c[_0x9068('0x16')]!==_0x9068('0x37')){var _0x247a76={};_0x247a76[_0xc05c9c[_0x9068('0x10')]]={'$like':'%'+_0x3ab698[_0x9068('0x1a')][_0x9068('0x34')]+'%'};return _0x247a76;}})});}_0x3e3a1c=_[_0x9068('0x36')]({},_0x3e3a1c,_0x3ab698[_0x9068('0x38')]);var _0x509483={'where':_0x3e3a1c[_0x9068('0x35')]};return db[_0x9068('0x39')][_0x9068('0x9')](_0x509483)[_0x9068('0xd')](function(_0x52f537){_0xebe833['count']=_0x52f537;if(_0x3ab698[_0x9068('0x1a')][_0x9068('0x3a')]){_0x3e3a1c[_0x9068('0x3b')]=[{'all':!![]}];}return db[_0x9068('0x39')][_0x9068('0x3c')](_0x3e3a1c);})[_0x9068('0xd')](function(_0x1b552f){_0xebe833[_0x9068('0x3d')]=_0x1b552f;return _0xebe833;})[_0x9068('0xd')](respondWithFilteredResult(_0x36d591,_0x3e3a1c))[_0x9068('0x3e')](handleError(_0x36d591,null));};exports[_0x9068('0x3f')]=function(_0x8f132c,_0x41961d){var _0x3749ff={'raw':!![],'where':{'id':_0x8f132c[_0x9068('0x40')]['id']}},_0x3c0ccd={};_0x3c0ccd[_0x9068('0x18')]=_[_0x9068('0x41')](db['CmHopper'][_0x9068('0x14')]);_0x3c0ccd[_0x9068('0x1a')]=_[_0x9068('0x41')](_0x8f132c[_0x9068('0x1a')]);_0x3c0ccd['filters']=_[_0x9068('0x2c')](_0x3c0ccd['model'],_0x3c0ccd[_0x9068('0x1a')]);_0x3749ff['attributes']=_[_0x9068('0x2c')](_0x3c0ccd[_0x9068('0x18')],qs[_0x9068('0x2d')](_0x8f132c[_0x9068('0x1a')]['fields']));_0x3749ff[_0x9068('0x2e')]=_0x3749ff[_0x9068('0x2e')][_0x9068('0x2f')]?_0x3749ff[_0x9068('0x2e')]:_0x3c0ccd[_0x9068('0x18')];if(_0x8f132c[_0x9068('0x1a')]['includeAll']){_0x3749ff['include']=[{'all':!![]}];}_0x3749ff=_[_0x9068('0x36')]({},_0x3749ff,_0x8f132c[_0x9068('0x38')]);return db[_0x9068('0x39')][_0x9068('0x42')](_0x3749ff)[_0x9068('0xd')](handleEntityNotFound(_0x41961d,null))[_0x9068('0xd')](respondWithResult(_0x41961d,null))[_0x9068('0x3e')](handleError(_0x41961d,null));};exports[_0x9068('0x43')]=function(_0x13baa6,_0x13da8e){return db['CmHopper'][_0x9068('0x43')](_0x13baa6[_0x9068('0x44')],{})['then'](respondWithResult(_0x13da8e,0xc9))[_0x9068('0x3e')](handleError(_0x13da8e,null));};exports['update']=function(_0xad12b7,_0x5b99b6){if(_0xad12b7[_0x9068('0x44')]['id']){delete _0xad12b7[_0x9068('0x44')]['id'];}return db['CmHopper'][_0x9068('0x42')]({'where':{'id':_0xad12b7[_0x9068('0x40')]['id']}})[_0x9068('0xd')](handleEntityNotFound(_0x5b99b6,null))[_0x9068('0xd')](saveUpdates(_0xad12b7['body'],null))[_0x9068('0xd')](respondWithResult(_0x5b99b6,null))[_0x9068('0x3e')](handleError(_0x5b99b6,null));};exports['describe']=function(_0x18430f,_0x3c3f0b){return db[_0x9068('0x39')][_0x9068('0x45')]()[_0x9068('0xd')](respondWithResult(_0x3c3f0b,null))[_0x9068('0x3e')](handleError(_0x3c3f0b,null));};exports[_0x9068('0x46')]=function(_0x552933,_0x49513f){var _0x49e5b6;var _0x5e29b5=_0x552933['params']['id'];return db[_0x9068('0x39')][_0x9068('0x42')]({'where':{'id':_0x552933[_0x9068('0x40')]['id']}})[_0x9068('0xd')](handleEntityNotFound(_0x49513f,null))[_0x9068('0xd')](function(_0x4578e5){if(_0x4578e5){return _0x4578e5['destroy']()[_0x9068('0xd')](function(_0x4cea5d){return _0x4cea5d;});}})[_0x9068('0xd')](function(_0x2c6b94){_0x49e5b6=_0x2c6b94;if(_0x2c6b94){if(_0x2c6b94['VoiceQueueId']||_0x2c6b94[_0x9068('0x47')]){return db[_0x2c6b94[_0x9068('0x48')]?_0x9068('0x49'):_0x9068('0x4a')][_0x9068('0x42')]({'where':{'id':_0x2c6b94[_0x9068('0x48')]?_0x2c6b94[_0x9068('0x48')]:_0x2c6b94[_0x9068('0x47')]},'attributes':['id',_0x9068('0x10')],'raw':!![]});}}})[_0x9068('0xd')](function(_0x18e1fd){var _0x2221f4={};if(_0x18e1fd){_[_0x9068('0x36')](_0x2221f4,_[_0x9068('0x4b')](_0x49e5b6[_0x9068('0x4c')],[_0x9068('0x4d'),_0x9068('0x4e'),'id']));_0x2221f4[_0x9068('0x4f')]=0x15;_0x2221f4[_0x9068('0x50')]='deleted';_0x2221f4[_0x9068('0x51')]=_0x18e1fd[_0x9068('0x10')];_0x2221f4['membername']=_0x552933[_0x9068('0x52')]['name'];_0x2221f4[_0x9068('0x53')]=_0x552933[_0x9068('0x52')]['id'];_0x2221f4[_0x9068('0x54')]=!![];_0x2221f4[_0x9068('0x55')]=moment()[_0x9068('0x56')](_0x9068('0x57'));_0x2221f4['calleridnum']=_0x49e5b6[_0x9068('0x58')];_0x2221f4[_0x9068('0x59')]=_0x49e5b6[_0x9068('0x48')]?_0x9068('0x5a'):_0x9068('0x5b');return db['CmContact'][_0x9068('0x42')]({'where':{'id':_0x2221f4[_0x9068('0x5c')]},'attributes':[_0x9068('0x5d'),'lastName']})['then'](function(_0x1e66a5){if(!_[_0x9068('0x5e')](_0x49513f)&&!_[_0x9068('0x5e')](_0x1e66a5[_0x9068('0x5d')])){_0x2221f4['calleridname']=_0x1e66a5['firstName'];if(!_['isNil'](_0x1e66a5[_0x9068('0x5f')])){_0x2221f4[_0x9068('0x60')]+='\x20'+_0x1e66a5['lastName'];}}})['finally'](function(){return db[_0x9068('0x61')][_0x9068('0x43')](_0x2221f4);});}})[_0x9068('0xd')](function(_0xd2f2dd){return db[_0x9068('0x62')]['destroy']({'where':{'CmHopperId':_0x5e29b5}});})[_0x9068('0xd')](function(){return _0x49513f[_0x9068('0x5')](0xcc)[_0x9068('0x63')]();})[_0x9068('0x3e')](handleError(_0x49513f,null));};exports[_0x9068('0x64')]=function(_0x216902,_0x20b3fc){var _0x29cb57=[];return db[_0x9068('0x65')][_0x9068('0x45')]()[_0x9068('0xd')](function(_0x2a8337){_0x29cb57=_[_0x9068('0x41')](_0x2a8337);return _0x216902['user'][_0x9068('0x66')]({'where':{'type':_0x9068('0x67'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x9068('0x68'),_0x9068('0x69')],'raw':!![]});})[_0x9068('0xd')](function(_0x1093d5){if(_0x1093d5&&_0x1093d5[_0x9068('0x2f')]){return db[_0x9068('0x6a')][_0x9068('0x6b')](function(_0x4836cb){var _0x4aedb4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9068('0x56')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x9068('0x13')](_0x1093d5,'id')},'$or':[{'UserId':null},{'UserId':_0x216902[_0x9068('0x52')]['id']}]};var _0x32bd18={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1093d5)[_0x9068('0x34')]([_0x9068('0x69'),0x0])[_0x9068('0x13')]('id')[_0x9068('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x216902['user']['id']}]};var _0x4c4383={'$or':[_0x4aedb4,_0x32bd18]};var _0x4a1dcc=[];if(_0x216902['body'][_0x9068('0x6d')]&&_0x216902['body'][_0x9068('0x6d')]===_0x9068('0x6e')){if(!_['isEmpty'](_0x216902[_0x9068('0x44')][_0x9068('0x6f')])){_0x4c4383['id']={'$in':_0x216902[_0x9068('0x44')][_0x9068('0x6f')]};}_0x4a1dcc=[[_0x9068('0x70'),_0x9068('0x71')],[_0x9068('0x72'),_0x1093d5[0x0][_0x9068('0x68')]==='ASC'?_0x9068('0x73'):_0x9068('0x71')],db[_0x9068('0x6a')][_0x9068('0x74')](_0x9068('0x75')),['id',_0x9068('0x73')]];}else{if(!_[_0x9068('0x76')](_0x216902[_0x9068('0x44')][_0x9068('0x6f')])){_0x4c4383['id']={'$notIn':_0x216902[_0x9068('0x44')]['hopperIds']};}_0x4a1dcc=[[_0x9068('0x70'),'DESC'],['scheduledAt',_0x1093d5[0x0]['dialOrderByScheduledAt']],db[_0x9068('0x6a')][_0x9068('0x74')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x9068('0x71')]];}return db[_0x9068('0x39')][_0x9068('0x77')]({'attributes':['id',_0x9068('0x78'),'phone',_0x9068('0x79')],'where':_0x4c4383,'order':_0x4a1dcc,'transaction':_0x4836cb,'lock':_0x4836cb['LOCK'][_0x9068('0x7a')],'include':[{'model':db[_0x9068('0x65')],'as':_0x9068('0x7b'),'attributes':_0x29cb57,'include':[{'model':db[_0x9068('0x7c')],'as':_0x9068('0x7d'),'attributes':['id',_0x9068('0x10')]}]},{'model':db[_0x9068('0x7e')],'as':_0x9068('0x7f'),'attributes':['id','name']},{'model':db[_0x9068('0x49')],'as':'Queue','attributes':['id','name',_0x9068('0x80')]}]})[_0x9068('0xd')](function(_0x533158){if(_0x533158){return _0x533158[_0x9068('0xc')]({'UserId':_0x216902[_0x9068('0x52')]['id']},{'transaction':_0x4836cb});}});});}})[_0x9068('0xd')](handleEntityNotFound(_0x20b3fc,null))[_0x9068('0xd')](respondWithResult(_0x20b3fc,null))['catch'](handleError(_0x20b3fc,null));};exports[_0x9068('0x81')]=function(_0x567d51,_0x71ee42,_0x436e2a){var _0x6eb3a4=[];var _0x47f4fc=_0x567d51[_0x9068('0x40')]['id'];var _0x11b781=_0x567d51[_0x9068('0x52')]['id'];return db[_0x9068('0x65')][_0x9068('0x45')]()['then'](function(_0x1b59cc){_0x6eb3a4=_['keys'](_0x1b59cc);return db[_0x9068('0x6a')][_0x9068('0x6b')](function(_0x30bde5){const _0x206f14={'id':_0x47f4fc};return db[_0x9068('0x39')][_0x9068('0x77')]({'attributes':['id',_0x9068('0x78'),_0x9068('0x79')],'where':_0x206f14,'transaction':_0x30bde5,'lock':_0x30bde5[_0x9068('0x82')][_0x9068('0x7a')],'include':[{'model':db['CmContact'],'as':_0x9068('0x7b'),'attributes':_0x6eb3a4,'include':[{'model':db[_0x9068('0x7c')],'as':_0x9068('0x7d'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x9068('0x7f'),'attributes':['id',_0x9068('0x10')]},{'model':db[_0x9068('0x49')],'as':_0x9068('0x83'),'attributes':['id',_0x9068('0x10'),_0x9068('0x80')]}]})[_0x9068('0xd')](function(_0x29b415){if(_0x29b415){return _0x29b415[_0x9068('0xc')]({'UserId':_0x11b781},{'transaction':_0x30bde5});}});});})[_0x9068('0xd')](handleEntityNotFound(_0x71ee42,null))[_0x9068('0xd')](respondWithResult(_0x71ee42,null))[_0x9068('0x3e')](handleError(_0x71ee42,null));};exports[_0x9068('0x84')]=function(_0x4d0a62,_0x1fa874){return _0x4d0a62[_0x9068('0x52')][_0x9068('0x66')]({'where':{'type':_0x9068('0x67'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x9068('0xd')](function(_0x7a4b55){if(_0x7a4b55&&_0x7a4b55[_0x9068('0x2f')]){return db[_0x9068('0x39')][_0x9068('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x9068('0x57'))},'VoiceQueueId':{'$in':_['map'](_0x7a4b55,'id')},'$or':[{'UserId':null},{'UserId':_0x4d0a62[_0x9068('0x52')]['id']}]}});}return 0x0;})[_0x9068('0xd')](function(_0x3ce701){if(!_[_0x9068('0x5e')](_0x3ce701)&&_[_0x9068('0x85')](_0x3ce701)){return _0x1fa874[_0x9068('0x5')](0xc8)[_0x9068('0x6')]({'contacts':_0x3ce701});}else{logger[_0x9068('0xe')](_0x9068('0x86'),_0x9068('0x84'),0x194,'entity\x20not\x20found');_0x1fa874['sendStatus'](0x194);}})[_0x9068('0x3e')](handleError(_0x1fa874,null));};exports['getTimezones']=function(_0x42b53b,_0x573216){var _0x49dae4=shared['timezones'];var _0x3b7fd8=[];_[_0x9068('0x13')](_0x49dae4,function(_0x392b59){_0x3b7fd8[_0x9068('0x87')]({'id':_0x392b59['name'],'name':_0x392b59[_0x9068('0x10')],'utcOffset':_0x392b59[_0x9068('0x88')]});});return _0x573216[_0x9068('0x5')](0xc8)['json']({'tz':_0x3b7fd8});};exports[_0x9068('0x89')]=function(_0x4c2907,_0x2d9ae4){var _0x130e1f=shared[_0x9068('0x8a')];var _0x362f73={};if(!_[_0x9068('0x5e')](_0x130e1f[_0x4c2907[_0x9068('0x44')]['id']]))_0x362f73=_0x130e1f[_0x4c2907['body']['id']];return _0x2d9ae4[_0x9068('0x5')](0xc8)[_0x9068('0x6')](_0x362f73);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 6fc2532..702a14f 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 _0xeff8=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0x2f6be2,_0x22a573){var _0x477b83=function(_0x559c80){while(--_0x559c80){_0x2f6be2['push'](_0x2f6be2['shift']());}};_0x477b83(++_0x22a573);}(_0xeff8,0x186));var _0x8eff=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xeff8[_0x349367];return _0x14179b;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xb')]},{'name':_0x8eff('0xc'),'fields':[_0x8eff('0xc')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['util','../../config/logger','api','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','phone'];(function(_0x491241,_0x5600cd){var _0x481d5b=function(_0x3169b1){while(--_0x3169b1){_0x491241['push'](_0x491241['shift']());}};_0x481d5b(++_0x5600cd);}(_0x038b,0x114));var _0xb038=function(_0x28f980,_0x15306b){_0x28f980=_0x28f980-0x0;var _0x3cf30c=_0x038b[_0x28f980];return _0x3cf30c;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xb038('0xb'),'fields':[_0xb038('0xb')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 031728e..b396ecb 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 _0x9fb6=['debug','catch','error','message','ShowCmHopper','CmHopper','find','stringify','CreateCmHopper','create','then','update','UpdateCmHopper','body','active','DestroyCmHopper','destroy','CmContact','describe','limit','order','LOCK','UPDATE','Contact','User','Agent','name','includes','push','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','\x20MINUTE','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','findAll','options','raw','where','attributes','map','model','include','info'];(function(_0x4bd0ac,_0x20f2fe){var _0xac7c18=function(_0x28a379){while(--_0x28a379){_0x4bd0ac['push'](_0x4bd0ac['shift']());}};_0xac7c18(++_0x20f2fe);}(_0x9fb6,0x17c));var _0x69fb=function(_0x2268fe,_0x5dfb26){_0x2268fe=_0x2268fe-0x0;var _0x344679=_0x9fb6[_0x2268fe];return _0x344679;};'use strict';var _=require('lodash');var util=require(_0x69fb('0x0'));var moment=require(_0x69fb('0x1'));var BPromise=require(_0x69fb('0x2'));var db=require(_0x69fb('0x3'))['db'];var logger=require('../../config/logger')(_0x69fb('0x4'));exports[_0x69fb('0x5')]=function(_0x27c292){var _0x157623=this;return new Promise(function(_0x45f36c,_0x545ef7){return db['CmHopper'][_0x69fb('0x6')]({'raw':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')][_0x69fb('0x8')]===undefined?!![]:![]:!![],'where':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')][_0x69fb('0x9')]||null:null,'attributes':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')][_0x69fb('0xa')]||null:null,'limit':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')]['limit']||null:null,'include':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')]['include']?_[_0x69fb('0xb')](_0x27c292[_0x69fb('0x7')]['include'],function(_0x1d511b){return{'model':db[_0x1d511b[_0x69fb('0xc')]],'as':_0x1d511b['as'],'attributes':_0x1d511b[_0x69fb('0xa')],'include':_0x1d511b[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x1d511b['include'],function(_0x4e9c4b){return{'model':db[_0x4e9c4b['model']],'as':_0x4e9c4b['as'],'attributes':_0x4e9c4b[_0x69fb('0xa')],'include':_0x4e9c4b['include']?_[_0x69fb('0xb')](_0x4e9c4b['include'],function(_0x29d3ab){return{'model':db[_0x29d3ab[_0x69fb('0xc')]],'as':_0x29d3ab['as'],'attributes':_0x29d3ab['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4be296){logger[_0x69fb('0xe')](_0x69fb('0x5'),_0x27c292);logger[_0x69fb('0xf')]('GetCmHopper',_0x27c292,JSON['stringify'](_0x4be296));_0x45f36c(_0x4be296);})[_0x69fb('0x10')](function(_0x5d5c52){logger[_0x69fb('0x11')]('GetCmHopper',_0x5d5c52[_0x69fb('0x12')],_0x27c292);_0x545ef7(_0x157623[_0x69fb('0x11')](0x1f4,_0x5d5c52['message']));});});};exports[_0x69fb('0x13')]=function(_0x165fb2){var _0x23eb07=this;return new Promise(function(_0x28964f,_0x267784){return db[_0x69fb('0x14')][_0x69fb('0x15')]({'raw':_0x165fb2[_0x69fb('0x7')]?_0x165fb2[_0x69fb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x165fb2[_0x69fb('0x7')]?_0x165fb2[_0x69fb('0x7')]['where']||null:null,'attributes':_0x165fb2['options']?_0x165fb2[_0x69fb('0x7')]['attributes']||null:null,'include':_0x165fb2[_0x69fb('0x7')]?_0x165fb2[_0x69fb('0x7')][_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x165fb2[_0x69fb('0x7')][_0x69fb('0xd')],function(_0x372cbf){return{'model':db[_0x372cbf[_0x69fb('0xc')]],'as':_0x372cbf['as'],'attributes':_0x372cbf['attributes'],'include':_0x372cbf[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x372cbf[_0x69fb('0xd')],function(_0x1a5495){return{'model':db[_0x1a5495['model']],'as':_0x1a5495['as'],'attributes':_0x1a5495['attributes'],'include':_0x1a5495[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x1a5495[_0x69fb('0xd')],function(_0x27f2da){return{'model':db[_0x27f2da[_0x69fb('0xc')]],'as':_0x27f2da['as'],'attributes':_0x27f2da[_0x69fb('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb98a73){logger['info'](_0x69fb('0x13'),_0x165fb2);logger['debug'](_0x69fb('0x13'),_0x165fb2,JSON[_0x69fb('0x16')](_0xb98a73));_0x28964f(_0xb98a73);})[_0x69fb('0x10')](function(_0x6c7de5){logger[_0x69fb('0x11')]('ShowCmHopper',_0x6c7de5[_0x69fb('0x12')],_0x165fb2);_0x267784(_0x23eb07[_0x69fb('0x11')](0x1f4,_0x6c7de5['message']));});});};exports[_0x69fb('0x17')]=function(_0x15c9e5){var _0x407a76=this;return new Promise(function(_0x27a741,_0x3305e3){return db[_0x69fb('0x14')][_0x69fb('0x18')](_0x15c9e5['body'],{'raw':_0x15c9e5['options']?_0x15c9e5['options'][_0x69fb('0x8')]===undefined?!![]:![]:!![]})[_0x69fb('0x19')](function(_0x3eb966){logger['info']('CreateCmHopper',_0x15c9e5);logger[_0x69fb('0xf')]('CreateCmHopper',_0x15c9e5,JSON[_0x69fb('0x16')](_0x3eb966));_0x27a741(_0x3eb966);})[_0x69fb('0x10')](function(_0x3fb66d){logger[_0x69fb('0x11')]('CreateCmHopper',_0x3fb66d[_0x69fb('0x12')],_0x15c9e5);_0x3305e3(_0x407a76[_0x69fb('0x11')](0x1f4,_0x3fb66d[_0x69fb('0x12')]));});});};exports['UpdateCmHopper']=function(_0x2c48b8){var _0x510256=this;return new Promise(function(_0x8e256a,_0x160c12){return db['CmHopper'][_0x69fb('0x1a')](_0x2c48b8['body'],{'raw':_0x2c48b8[_0x69fb('0x7')]?_0x2c48b8[_0x69fb('0x7')][_0x69fb('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c48b8[_0x69fb('0x7')]?_0x2c48b8[_0x69fb('0x7')][_0x69fb('0x9')]||null:null,'attributes':_0x2c48b8[_0x69fb('0x7')]?_0x2c48b8[_0x69fb('0x7')][_0x69fb('0xa')]||null:null,'limit':_0x2c48b8['options']?_0x2c48b8[_0x69fb('0x7')]['limit']||null:null})[_0x69fb('0x19')](function(_0x50d751){logger[_0x69fb('0xe')](_0x69fb('0x1b'),_0x2c48b8);logger[_0x69fb('0xe')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x69fb('0x16')](_0x2c48b8[_0x69fb('0x7')][_0x69fb('0x9')]),_0x2c48b8[_0x69fb('0x1c')][_0x69fb('0x1d')]);logger[_0x69fb('0xf')](_0x69fb('0x1b'),_0x2c48b8,JSON[_0x69fb('0x16')](_0x50d751));_0x8e256a(_0x50d751);})[_0x69fb('0x10')](function(_0x302281){logger[_0x69fb('0x11')](_0x69fb('0x1b'),_0x302281[_0x69fb('0x12')],_0x2c48b8);_0x160c12(_0x510256[_0x69fb('0x11')](0x1f4,_0x302281[_0x69fb('0x12')]));});});};exports[_0x69fb('0x1e')]=function(_0x327bee){var _0x313cc2=this;return new Promise(function(_0x3a2217,_0x279709){return db[_0x69fb('0x14')][_0x69fb('0x1f')]({'where':_0x327bee[_0x69fb('0x7')]?_0x327bee['options'][_0x69fb('0x9')]||null:null})['then'](function(_0x1c4d45){logger[_0x69fb('0xe')](_0x69fb('0x1e'),_0x327bee);logger[_0x69fb('0xf')](_0x69fb('0x1e'),_0x327bee,JSON[_0x69fb('0x16')](_0x1c4d45));_0x3a2217(_0x1c4d45);})[_0x69fb('0x10')](function(_0x19ccab){logger[_0x69fb('0x11')]('DestroyCmHopper',_0x19ccab['message'],_0x327bee);_0x279709(_0x313cc2[_0x69fb('0x11')](0x1f4,_0x19ccab[_0x69fb('0x12')]));});});};exports['GetContactDialer']=function(_0x8939b6){var _0x409a66=this;return new Promise(function(_0x54676f,_0x23f209){return db[_0x69fb('0x20')][_0x69fb('0x21')]()[_0x69fb('0x19')](function(_0x4f1538){return db['sequelize']['transaction'](function(_0x257b9e){return db[_0x69fb('0x14')]['findAll']({'where':_0x8939b6[_0x69fb('0x7')]?_0x8939b6[_0x69fb('0x7')]['where']||null:null,'attributes':_0x8939b6[_0x69fb('0x7')]?_0x8939b6['options'][_0x69fb('0xa')]||null:null,'limit':_0x8939b6['options']?_0x8939b6[_0x69fb('0x7')][_0x69fb('0x22')]||null:null,'order':_0x8939b6['options']?_0x8939b6['options'][_0x69fb('0x23')]||null:null,'transaction':_0x257b9e,'lock':_0x257b9e[_0x69fb('0x24')][_0x69fb('0x25')],'include':[{'model':db['CmContact'],'as':_0x69fb('0x26'),'attributes':_['keys'](_0x4f1538)},{'model':db[_0x69fb('0x27')],'as':_0x69fb('0x28'),'attributes':['id',_0x69fb('0x29'),'voicePause']}]})['then'](function(_0x283ccb){var _0x1312f4=[];var _0x169efc=[];for(var _0x317d73=0x0;_0x317d73<_0x283ccb['length'];_0x317d73+=0x1){var _0x296564=_0x283ccb[_0x317d73]['UserId'];if(_0x296564===null){_0x1312f4['push'](_0x283ccb[_0x317d73][_0x69fb('0x1a')](_0x8939b6[_0x69fb('0x1c')],{'transaction':_0x257b9e}));}else if(!_0x169efc[_0x69fb('0x2a')](_0x296564)){_0x169efc[_0x69fb('0x2b')](_0x296564);_0x1312f4[_0x69fb('0x2b')](_0x283ccb[_0x317d73][_0x69fb('0x1a')](_0x8939b6[_0x69fb('0x1c')],{'transaction':_0x257b9e}));}}return BPromise[_0x69fb('0x2c')](_0x1312f4);});})[_0x69fb('0x19')](function(_0x512e7f){logger['info'](_0x69fb('0x2d'),_0x8939b6);if(_0x512e7f[_0x69fb('0x2e')]>0x0){logger[_0x69fb('0xe')](_0x69fb('0x2f'),_0x512e7f[0x0][_0x69fb('0x30')]['id'],_0x512e7f[0x0][_0x69fb('0x30')][_0x69fb('0x31')],_0x512e7f[0x0][_0x69fb('0x30')][_0x69fb('0x1d')]);}logger[_0x69fb('0xf')]('GetContactDialer',_0x8939b6,JSON[_0x69fb('0x16')](_0x512e7f));_0x54676f(_0x512e7f);})[_0x69fb('0x10')](function(_0x53c556){logger[_0x69fb('0x11')]('GetContactDialer',_0x53c556[_0x69fb('0x12')],_0x8939b6);_0x23f209(_0x409a66[_0x69fb('0x11')](0x1f4,_0x53c556[_0x69fb('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x249c57){var _0x234a58=this;return new Promise(function(_0x172276,_0xcd6281){return db[_0x69fb('0x32')][_0x69fb('0x33')](function(_0xb18e82){return db[_0x69fb('0x34')][_0x69fb('0x18')](_0x249c57[_0x69fb('0x1c')],{'raw':_0x249c57[_0x69fb('0x7')]?_0x249c57[_0x69fb('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0xb18e82})[_0x69fb('0x19')](function(){logger[_0x69fb('0xe')](_0x69fb('0x35'),JSON['stringify'](_0x249c57[_0x69fb('0x7')][_0x69fb('0x9')]),_0x249c57[_0x69fb('0x7')][_0x69fb('0x9')][_0x69fb('0x1d')]);return db['CmHopper'][_0x69fb('0x1f')]({'where':_0x249c57[_0x69fb('0x7')]?_0x249c57[_0x69fb('0x7')]['where']||null:null,'transaction':_0xb18e82});});})[_0x69fb('0x19')](function(_0x128e0b){logger[_0x69fb('0xe')](_0x69fb('0x36'),_0x249c57);logger['debug'](_0x69fb('0x36'),_0x249c57,JSON[_0x69fb('0x16')](_0x128e0b));_0x172276(_0x128e0b);})[_0x69fb('0x10')](function(_0xcc52d6){logger[_0x69fb('0x11')](_0x69fb('0x36'),_0xcc52d6['message'],_0x249c57);_0xcd6281(_0x234a58[_0x69fb('0x11')](0x1f4,_0xcc52d6[_0x69fb('0x12')]));});});};exports[_0x69fb('0x37')]=function(_0x27ea3d){var _0x586306=this;return new Promise(function(_0x365dca,_0x2d0102){return db[_0x69fb('0x14')][_0x69fb('0x6')]({'raw':_0x27ea3d[_0x69fb('0x7')]?_0x27ea3d[_0x69fb('0x7')][_0x69fb('0x8')]===undefined?!![]:![]:!![],'where':_0x27ea3d['options']?_0x27ea3d[_0x69fb('0x7')][_0x69fb('0x9')]||null:null,'attributes':[[db[_0x69fb('0x32')]['fn'](_0x69fb('0x38'),db[_0x69fb('0x32')]['fn']('IF',db[_0x69fb('0x32')][_0x69fb('0x39')](_0x69fb('0x3a')+util[_0x69fb('0x3b')](_0x69fb('0x3c'),moment()[_0x69fb('0x3b')](_0x69fb('0x3d')))+_0x69fb('0x3e')))),_0x69fb('0x3f')]]})[_0x69fb('0x19')](function(_0x478837){logger[_0x69fb('0xe')](_0x69fb('0x37'),_0x27ea3d);logger[_0x69fb('0xf')](_0x69fb('0x37'),_0x27ea3d,JSON[_0x69fb('0x16')](_0x478837));_0x365dca(_0x478837);})[_0x69fb('0x10')](function(_0x43ce9f){logger['error'](_0x69fb('0x37'),_0x43ce9f['message'],_0x27ea3d);_0x2d0102(_0x586306[_0x69fb('0x11')](0x1f4,_0x43ce9f[_0x69fb('0x12')]));});});};exports[_0x69fb('0x40')]=function(_0x503b12){var _0x2d2fff=this;return new Promise(function(_0x58ba70,_0x4d0dfd){return db['CmContact'][_0x69fb('0x21')]()['then'](function(){return db['sequelize'][_0x69fb('0x33')](function(_0x546751){return db[_0x69fb('0x14')][_0x69fb('0x6')]({'where':_0x503b12[_0x69fb('0x7')]?_0x503b12[_0x69fb('0x7')]['where']||null:null,'attributes':_0x503b12[_0x69fb('0x7')]?_0x503b12[_0x69fb('0x7')][_0x69fb('0xa')]||null:null,'limit':0x1,'order':_0x503b12[_0x69fb('0x7')]?_0x503b12[_0x69fb('0x7')][_0x69fb('0x23')]||null:null,'group':db[_0x69fb('0x14')][_0x69fb('0x41')],'transaction':_0x546751,'lock':_0x546751[_0x69fb('0x24')][_0x69fb('0x25')],'include':_0x503b12['options']?_0x503b12['options'][_0x69fb('0xd')]?_['map'](_0x503b12[_0x69fb('0x7')][_0x69fb('0xd')],function(_0x2ac43f){return{'model':db[_0x2ac43f[_0x69fb('0xc')]],'as':_0x2ac43f['as'],'attributes':_0x2ac43f[_0x69fb('0xa')],'include':_0x2ac43f['include']?_[_0x69fb('0xb')](_0x2ac43f['include'],function(_0x158ee3){return{'model':db[_0x158ee3[_0x69fb('0xc')]],'as':_0x158ee3['as'],'attributes':_0x158ee3[_0x69fb('0xa')],'include':_0x158ee3[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x158ee3[_0x69fb('0xd')],function(_0x3db80f){return{'model':db[_0x3db80f[_0x69fb('0xc')]],'as':_0x3db80f['as'],'attributes':_0x3db80f['attributes']};}):[]};}):[]};}):[]:[]})[_0x69fb('0x19')](function(_0x113d9b){var _0x41dd25=[];for(var _0x8b8631=0x0;_0x8b8631<_0x113d9b[_0x69fb('0x2e')];_0x8b8631+=0x1){_0x41dd25['push'](_0x113d9b[_0x8b8631][_0x69fb('0x1a')](_0x503b12['body'],{'transaction':_0x546751}));}return BPromise['all'](_0x41dd25);});})[_0x69fb('0x19')](function(_0x3b8077){logger[_0x69fb('0xe')](_0x69fb('0x40'),_0x503b12);logger[_0x69fb('0xf')]('GetContactRecallMe',_0x503b12,JSON[_0x69fb('0x16')](_0x3b8077));_0x58ba70(_0x3b8077);})[_0x69fb('0x10')](function(_0x3ecc8e){logger[_0x69fb('0x11')](_0x69fb('0x40'),_0x3ecc8e[_0x69fb('0x12')],_0x503b12);_0x4d0dfd(_0x2d2fff[_0x69fb('0x11')](0x1f4,_0x3ecc8e[_0x69fb('0x12')]));});});});};exports[_0x69fb('0x42')]=function(_0x50ab91){var _0x392484=this;return new Promise(function(_0x5f0f50,_0x53ee83){db['CmContact'][_0x69fb('0x21')]()[_0x69fb('0x19')](function(_0x384440){return db[_0x69fb('0x14')]['findAll']({'raw':_0x50ab91[_0x69fb('0x7')]?_0x50ab91[_0x69fb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x50ab91[_0x69fb('0x7')]?_0x50ab91[_0x69fb('0x7')]['where']||null:null,'attributes':_0x50ab91[_0x69fb('0x7')]?_0x50ab91[_0x69fb('0x7')]['attributes']||null:null,'limit':_0x50ab91[_0x69fb('0x7')]?_0x50ab91['options'][_0x69fb('0x22')]||null:null,'include':_0x50ab91['options']?_0x50ab91[_0x69fb('0x7')][_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x50ab91['options'][_0x69fb('0xd')],function(_0x2f4172){return{'model':db[_0x2f4172[_0x69fb('0xc')]],'as':_0x2f4172['as'],'attributes':_0x2f4172['as']==='Contact'?_['keys'](_0x384440):_0x2f4172[_0x69fb('0xa')],'include':_0x2f4172[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x2f4172[_0x69fb('0xd')],function(_0x251573){return{'model':db[_0x251573[_0x69fb('0xc')]],'as':_0x251573['as'],'attributes':_0x251573[_0x69fb('0xa')],'include':_0x251573[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x251573[_0x69fb('0xd')],function(_0x426c4c){return{'model':db[_0x426c4c[_0x69fb('0xc')]],'as':_0x426c4c['as'],'attributes':_0x426c4c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x51cb63){logger[_0x69fb('0xe')](_0x69fb('0x5'),_0x50ab91);logger['debug']('GetCmHopper',_0x50ab91,JSON[_0x69fb('0x16')](_0x51cb63));_0x5f0f50(_0x51cb63);})['catch'](function(_0x34df5c){logger[_0x69fb('0x11')]('GetCmHopper',_0x34df5c['message'],_0x50ab91);_0x53ee83(_0x392484['error'](0x1f4,_0x34df5c[_0x69fb('0x12')]));});});});};exports[_0x69fb('0x43')]=function(_0x17ff83){var _0x517a73=this;return new Promise(function(_0x2297ee,_0x259c14){return db[_0x69fb('0x20')][_0x69fb('0x44')]({'raw':!![],'where':{'phone':_0x17ff83[_0x69fb('0x7')][_0x69fb('0x9')][_0x69fb('0x45')]},'attributes':['id','dialTimezone'],'order':[['id',_0x69fb('0x46')]]})[_0x69fb('0x19')](function(_0x468b9e){logger[_0x69fb('0xe')](_0x69fb('0x47'),_0x17ff83);logger[_0x69fb('0xf')]('getContactByPhone',_0x17ff83,JSON[_0x69fb('0x16')](_0x468b9e));_0x2297ee(_0x468b9e);})['catch'](function(_0x22dc84){logger['error']('getContactByPhone',_0x22dc84['message'],_0x17ff83);_0x259c14(_0x517a73[_0x69fb('0x11')](0x1f4,_0x22dc84[_0x69fb('0x12')]));});});};exports[_0x69fb('0x48')]=function(_0x4c8ca6){var _0x558778=this;return new Promise(function(_0x2c0a90,_0x4622b2){return db[_0x69fb('0x32')]['transaction'](function(_0xb9c4f9){var _0xe78ee3=_0x4c8ca6[_0x69fb('0x7')]&&_0x4c8ca6[_0x69fb('0x7')][_0x69fb('0x9')]?_0x4c8ca6[_0x69fb('0x7')]['where']:{};return db[_0x69fb('0x14')][_0x69fb('0x1a')](_0x4c8ca6[_0x69fb('0x1c')],{'where':_0xe78ee3,'transaction':_0xb9c4f9})[_0x69fb('0x19')](function(_0x3b2390){logger[_0x69fb('0xe')](_0x69fb('0x48'),_0x4c8ca6);logger['debug']('ResetActiveCalls',_0x4c8ca6,JSON['stringify'](_0x3b2390));_0x2c0a90(_0x3b2390);})[_0x69fb('0x10')](function(_0x5b130b){logger[_0x69fb('0x11')](_0x69fb('0x48'),_0x5b130b['message'],_0x4c8ca6);_0x4622b2(_0x558778[_0x69fb('0x11')](0x1f4,_0x5b130b[_0x69fb('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x21084c){var _0x4692c6=this;var _0x26831e=_0x21084c[_0x69fb('0x1c')][_0x69fb('0x9')]['voiceQueueIds'];var _0x475e3f=_0x21084c[_0x69fb('0x1c')]['where'][_0x69fb('0x49')];var _0x517f40=_0x21084c[_0x69fb('0x1c')][_0x69fb('0x9')][_0x69fb('0x4a')];return new Promise(function(_0xbba0af,_0x2c3185){return db[_0x69fb('0x14')][_0x69fb('0x6')]({'where':{'voiceQueueId':{'$in':_0x26831e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x69fb('0x32')][_0x69fb('0x39')]('NOW()\x20+\x20INTERVAL\x20'+_0x475e3f+_0x69fb('0x4b')),'$gt':db[_0x69fb('0x32')][_0x69fb('0x39')](_0x69fb('0x4c'))}},'UserId':{'$in':_0x517f40}},'include':[{'model':db['CmContact'],'as':_0x69fb('0x26')},{'model':db['User'],'as':_0x69fb('0x28'),'attributes':['id',_0x69fb('0x29'),'voicePause']},{'model':db[_0x69fb('0x4d')],'as':'List'}]})[_0x69fb('0x19')](function(_0x4fcfd9){if(_0x4fcfd9[_0x69fb('0x2e')]>0x0){return db[_0x69fb('0x32')]['transaction'](function(_0x2ea6ad){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0x69fb('0x32')]['literal'](_0x69fb('0x4c'))},{'where':{'id':{'$in':_[_0x69fb('0xb')](_0x4fcfd9,'id')}},'transaction':_0x2ea6ad})[_0x69fb('0x19')](function(){_0xbba0af(_0x4fcfd9);})[_0x69fb('0x10')](function(_0x125c03){logger['error'](_0x69fb('0x4e'),_0x125c03[_0x69fb('0x12')],_0x21084c);_0x2c3185(_0x4692c6['error'](0x1f4,_0x125c03[_0x69fb('0x12')]));});})[_0x69fb('0x10')](function(_0x5cda3a){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x5cda3a[_0x69fb('0x12')],_0x21084c);_0x2c3185(_0x4692c6[_0x69fb('0x11')](0x1f4,_0x5cda3a['message']));});}else{_0xbba0af(_0x4fcfd9);}});});}; \ No newline at end of file +var _0x655c=['active','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','GetContactRecallMe','order','GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','voicePause','List','length','NOW()','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','CmHopper','findAll','options','raw','limit','include','map','attributes','model','then','info','GetCmHopper','debug','stringify','catch','message','error','ShowCmHopper','find','where','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','LOCK','UPDATE','CmContact','Contact','User','Agent','name','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x655c,0x6c));var _0xc655=function(_0x26ae5b,_0x4973ce){_0x26ae5b=_0x26ae5b-0x0;var _0x33f788=_0x655c[_0x26ae5b];return _0x33f788;};'use strict';var _=require(_0xc655('0x0'));var util=require(_0xc655('0x1'));var moment=require(_0xc655('0x2'));var BPromise=require(_0xc655('0x3'));var db=require(_0xc655('0x4'))['db'];var logger=require(_0xc655('0x5'))('rpc');exports['GetCmHopper']=function(_0x11a0a3){var _0x2de983=this;return new Promise(function(_0x8b4030,_0x5b9f0c){return db[_0xc655('0x6')][_0xc655('0x7')]({'raw':_0x11a0a3['options']?_0x11a0a3[_0xc655('0x8')][_0xc655('0x9')]===undefined?!![]:![]:!![],'where':_0x11a0a3[_0xc655('0x8')]?_0x11a0a3['options']['where']||null:null,'attributes':_0x11a0a3[_0xc655('0x8')]?_0x11a0a3[_0xc655('0x8')]['attributes']||null:null,'limit':_0x11a0a3[_0xc655('0x8')]?_0x11a0a3[_0xc655('0x8')][_0xc655('0xa')]||null:null,'include':_0x11a0a3[_0xc655('0x8')]?_0x11a0a3[_0xc655('0x8')][_0xc655('0xb')]?_[_0xc655('0xc')](_0x11a0a3[_0xc655('0x8')][_0xc655('0xb')],function(_0x9a4910){return{'model':db[_0x9a4910['model']],'as':_0x9a4910['as'],'attributes':_0x9a4910[_0xc655('0xd')],'include':_0x9a4910['include']?_[_0xc655('0xc')](_0x9a4910[_0xc655('0xb')],function(_0x6c83aa){return{'model':db[_0x6c83aa['model']],'as':_0x6c83aa['as'],'attributes':_0x6c83aa[_0xc655('0xd')],'include':_0x6c83aa[_0xc655('0xb')]?_[_0xc655('0xc')](_0x6c83aa[_0xc655('0xb')],function(_0x1b3198){return{'model':db[_0x1b3198[_0xc655('0xe')]],'as':_0x1b3198['as'],'attributes':_0x1b3198[_0xc655('0xd')]};}):[]};}):[]};}):[]:[]})[_0xc655('0xf')](function(_0x486b4e){logger[_0xc655('0x10')](_0xc655('0x11'),_0x11a0a3);logger[_0xc655('0x12')](_0xc655('0x11'),_0x11a0a3,JSON[_0xc655('0x13')](_0x486b4e));_0x8b4030(_0x486b4e);})[_0xc655('0x14')](function(_0x742a22){logger['error'](_0xc655('0x11'),_0x742a22[_0xc655('0x15')],_0x11a0a3);_0x5b9f0c(_0x2de983[_0xc655('0x16')](0x1f4,_0x742a22[_0xc655('0x15')]));});});};exports[_0xc655('0x17')]=function(_0x1598d8){var _0x3dc430=this;return new Promise(function(_0x462ad6,_0x4307ff){return db[_0xc655('0x6')][_0xc655('0x18')]({'raw':_0x1598d8['options']?_0x1598d8[_0xc655('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x1598d8[_0xc655('0x8')]?_0x1598d8['options'][_0xc655('0x19')]||null:null,'attributes':_0x1598d8[_0xc655('0x8')]?_0x1598d8[_0xc655('0x8')][_0xc655('0xd')]||null:null,'include':_0x1598d8[_0xc655('0x8')]?_0x1598d8[_0xc655('0x8')]['include']?_[_0xc655('0xc')](_0x1598d8[_0xc655('0x8')][_0xc655('0xb')],function(_0x43f72c){return{'model':db[_0x43f72c[_0xc655('0xe')]],'as':_0x43f72c['as'],'attributes':_0x43f72c['attributes'],'include':_0x43f72c['include']?_[_0xc655('0xc')](_0x43f72c[_0xc655('0xb')],function(_0x5c3164){return{'model':db[_0x5c3164[_0xc655('0xe')]],'as':_0x5c3164['as'],'attributes':_0x5c3164[_0xc655('0xd')],'include':_0x5c3164[_0xc655('0xb')]?_[_0xc655('0xc')](_0x5c3164[_0xc655('0xb')],function(_0x279209){return{'model':db[_0x279209[_0xc655('0xe')]],'as':_0x279209['as'],'attributes':_0x279209['attributes']};}):[]};}):[]};}):[]:[]})[_0xc655('0xf')](function(_0x26ad9d){logger[_0xc655('0x10')](_0xc655('0x17'),_0x1598d8);logger[_0xc655('0x12')]('ShowCmHopper',_0x1598d8,JSON[_0xc655('0x13')](_0x26ad9d));_0x462ad6(_0x26ad9d);})[_0xc655('0x14')](function(_0x439e0e){logger[_0xc655('0x16')](_0xc655('0x17'),_0x439e0e['message'],_0x1598d8);_0x4307ff(_0x3dc430['error'](0x1f4,_0x439e0e[_0xc655('0x15')]));});});};exports[_0xc655('0x1a')]=function(_0x523913){var _0xd5410a=this;return new Promise(function(_0x3275bd,_0x22a06f){return db[_0xc655('0x6')]['create'](_0x523913[_0xc655('0x1b')],{'raw':_0x523913['options']?_0x523913['options'][_0xc655('0x9')]===undefined?!![]:![]:!![]})[_0xc655('0xf')](function(_0x24446f){logger[_0xc655('0x10')](_0xc655('0x1a'),_0x523913);logger[_0xc655('0x12')]('CreateCmHopper',_0x523913,JSON[_0xc655('0x13')](_0x24446f));_0x3275bd(_0x24446f);})[_0xc655('0x14')](function(_0x19fe0a){logger['error'](_0xc655('0x1a'),_0x19fe0a['message'],_0x523913);_0x22a06f(_0xd5410a[_0xc655('0x16')](0x1f4,_0x19fe0a[_0xc655('0x15')]));});});};exports[_0xc655('0x1c')]=function(_0x14a7a0){var _0x243ed5=this;return new Promise(function(_0xdca4fd,_0x25641a){return db['CmHopper'][_0xc655('0x1d')](_0x14a7a0[_0xc655('0x1b')],{'raw':_0x14a7a0[_0xc655('0x8')]?_0x14a7a0[_0xc655('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14a7a0[_0xc655('0x8')]?_0x14a7a0[_0xc655('0x8')]['where']||null:null,'attributes':_0x14a7a0[_0xc655('0x8')]?_0x14a7a0[_0xc655('0x8')]['attributes']||null:null,'limit':_0x14a7a0[_0xc655('0x8')]?_0x14a7a0[_0xc655('0x8')][_0xc655('0xa')]||null:null})[_0xc655('0xf')](function(_0x48dc9){logger[_0xc655('0x10')](_0xc655('0x1c'),_0x14a7a0);logger[_0xc655('0x10')](_0xc655('0x1e'),JSON['stringify'](_0x14a7a0[_0xc655('0x8')]['where']),_0x14a7a0['body']['active']);logger[_0xc655('0x12')](_0xc655('0x1c'),_0x14a7a0,JSON[_0xc655('0x13')](_0x48dc9));_0xdca4fd(_0x48dc9);})['catch'](function(_0x3d426d){logger[_0xc655('0x16')](_0xc655('0x1c'),_0x3d426d[_0xc655('0x15')],_0x14a7a0);_0x25641a(_0x243ed5[_0xc655('0x16')](0x1f4,_0x3d426d['message']));});});};exports[_0xc655('0x1f')]=function(_0x462a32){var _0x1f81ca=this;return new Promise(function(_0x3113d6,_0x59f827){return db[_0xc655('0x6')][_0xc655('0x20')]({'where':_0x462a32[_0xc655('0x8')]?_0x462a32[_0xc655('0x8')][_0xc655('0x19')]||null:null})[_0xc655('0xf')](function(_0x3e440f){logger[_0xc655('0x10')](_0xc655('0x1f'),_0x462a32);logger[_0xc655('0x12')](_0xc655('0x1f'),_0x462a32,JSON[_0xc655('0x13')](_0x3e440f));_0x3113d6(_0x3e440f);})[_0xc655('0x14')](function(_0x545547){logger[_0xc655('0x16')](_0xc655('0x1f'),_0x545547[_0xc655('0x15')],_0x462a32);_0x59f827(_0x1f81ca[_0xc655('0x16')](0x1f4,_0x545547['message']));});});};exports[_0xc655('0x21')]=function(_0x24c9cf){var _0x2ab7dc=this;return new Promise(function(_0x936a1d,_0x345830){return db['CmContact'][_0xc655('0x22')]()['then'](function(_0x46f92b){return db[_0xc655('0x23')][_0xc655('0x24')](function(_0x12a29a){return db[_0xc655('0x6')][_0xc655('0x7')]({'where':_0x24c9cf[_0xc655('0x8')]?_0x24c9cf[_0xc655('0x8')][_0xc655('0x19')]||null:null,'attributes':_0x24c9cf['options']?_0x24c9cf['options'][_0xc655('0xd')]||null:null,'limit':_0x24c9cf['options']?_0x24c9cf[_0xc655('0x8')][_0xc655('0xa')]||null:null,'order':_0x24c9cf[_0xc655('0x8')]?_0x24c9cf[_0xc655('0x8')]['order']||null:null,'transaction':_0x12a29a,'lock':_0x12a29a[_0xc655('0x25')][_0xc655('0x26')],'include':[{'model':db[_0xc655('0x27')],'as':_0xc655('0x28'),'attributes':_['keys'](_0x46f92b)},{'model':db[_0xc655('0x29')],'as':_0xc655('0x2a'),'attributes':['id',_0xc655('0x2b'),'voicePause']}]})[_0xc655('0xf')](function(_0x754dcf){var _0x4a9d34=[];var _0x10a2cc=[];for(var _0x1d5530=0x0;_0x1d5530<_0x754dcf['length'];_0x1d5530+=0x1){var _0x5e3e96=_0x754dcf[_0x1d5530][_0xc655('0x2c')];if(_0x5e3e96===null){_0x4a9d34['push'](_0x754dcf[_0x1d5530]['update'](_0x24c9cf[_0xc655('0x1b')],{'transaction':_0x12a29a}));}else if(!_0x10a2cc['includes'](_0x5e3e96)){_0x10a2cc[_0xc655('0x2d')](_0x5e3e96);_0x4a9d34['push'](_0x754dcf[_0x1d5530][_0xc655('0x1d')](_0x24c9cf[_0xc655('0x1b')],{'transaction':_0x12a29a}));}}return BPromise[_0xc655('0x2e')](_0x4a9d34);});})[_0xc655('0xf')](function(_0x1b202e){logger[_0xc655('0x10')](_0xc655('0x21'),_0x24c9cf);if(_0x1b202e['length']>0x0){logger[_0xc655('0x10')](_0xc655('0x2f'),_0x1b202e[0x0][_0xc655('0x30')]['id'],_0x1b202e[0x0][_0xc655('0x30')][_0xc655('0x31')],_0x1b202e[0x0][_0xc655('0x30')][_0xc655('0x32')]);}logger[_0xc655('0x12')]('GetContactDialer',_0x24c9cf,JSON[_0xc655('0x13')](_0x1b202e));_0x936a1d(_0x1b202e);})[_0xc655('0x14')](function(_0x330100){logger[_0xc655('0x16')](_0xc655('0x21'),_0x330100['message'],_0x24c9cf);_0x345830(_0x2ab7dc[_0xc655('0x16')](0x1f4,_0x330100['message']));});});});};exports[_0xc655('0x33')]=function(_0x119b76){var _0x52ab4b=this;return new Promise(function(_0x2ce8eb,_0x4f43a5){return db[_0xc655('0x23')][_0xc655('0x24')](function(_0x102b0e){return db[_0xc655('0x34')][_0xc655('0x35')](_0x119b76[_0xc655('0x1b')],{'raw':_0x119b76[_0xc655('0x8')]?_0x119b76[_0xc655('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x102b0e})[_0xc655('0xf')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc655('0x13')](_0x119b76['options'][_0xc655('0x19')]),_0x119b76[_0xc655('0x8')][_0xc655('0x19')]['active']);return db[_0xc655('0x6')][_0xc655('0x20')]({'where':_0x119b76['options']?_0x119b76[_0xc655('0x8')][_0xc655('0x19')]||null:null,'transaction':_0x102b0e});});})[_0xc655('0xf')](function(_0x4be20e){logger[_0xc655('0x10')](_0xc655('0x33'),_0x119b76);logger['debug'](_0xc655('0x33'),_0x119b76,JSON[_0xc655('0x13')](_0x4be20e));_0x2ce8eb(_0x4be20e);})[_0xc655('0x14')](function(_0x17c96e){logger['error'](_0xc655('0x33'),_0x17c96e['message'],_0x119b76);_0x4f43a5(_0x52ab4b[_0xc655('0x16')](0x1f4,_0x17c96e[_0xc655('0x15')]));});});};exports[_0xc655('0x36')]=function(_0x330e90){var _0x28f3a4=this;return new Promise(function(_0x33406e,_0x24231b){return db[_0xc655('0x6')][_0xc655('0x7')]({'raw':_0x330e90['options']?_0x330e90[_0xc655('0x8')][_0xc655('0x9')]===undefined?!![]:![]:!![],'where':_0x330e90[_0xc655('0x8')]?_0x330e90[_0xc655('0x8')][_0xc655('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0xc655('0x37'),db[_0xc655('0x23')]['fn']('IF',db[_0xc655('0x23')]['literal'](_0xc655('0x38')+util['format'](_0xc655('0x39'),moment()[_0xc655('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xc655('0x3b')))),'contactsRescheduled']]})[_0xc655('0xf')](function(_0x8fbc71){logger[_0xc655('0x10')](_0xc655('0x36'),_0x330e90);logger[_0xc655('0x12')]('CountReScheduled',_0x330e90,JSON['stringify'](_0x8fbc71));_0x33406e(_0x8fbc71);})['catch'](function(_0x1e31b1){logger['error'](_0xc655('0x36'),_0x1e31b1[_0xc655('0x15')],_0x330e90);_0x24231b(_0x28f3a4[_0xc655('0x16')](0x1f4,_0x1e31b1['message']));});});};exports[_0xc655('0x3c')]=function(_0x5b39f2){var _0x2ab3e8=this;return new Promise(function(_0x33f67f,_0x4d2ca8){return db['CmContact'][_0xc655('0x22')]()[_0xc655('0xf')](function(){return db[_0xc655('0x23')]['transaction'](function(_0x4d8bb4){return db[_0xc655('0x6')][_0xc655('0x7')]({'where':_0x5b39f2['options']?_0x5b39f2[_0xc655('0x8')][_0xc655('0x19')]||null:null,'attributes':_0x5b39f2[_0xc655('0x8')]?_0x5b39f2[_0xc655('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x5b39f2[_0xc655('0x8')]?_0x5b39f2[_0xc655('0x8')][_0xc655('0x3d')]||null:null,'group':db[_0xc655('0x6')][_0xc655('0x2c')],'transaction':_0x4d8bb4,'lock':_0x4d8bb4[_0xc655('0x25')]['UPDATE'],'include':_0x5b39f2[_0xc655('0x8')]?_0x5b39f2[_0xc655('0x8')][_0xc655('0xb')]?_[_0xc655('0xc')](_0x5b39f2[_0xc655('0x8')][_0xc655('0xb')],function(_0x2587c6){return{'model':db[_0x2587c6[_0xc655('0xe')]],'as':_0x2587c6['as'],'attributes':_0x2587c6[_0xc655('0xd')],'include':_0x2587c6[_0xc655('0xb')]?_[_0xc655('0xc')](_0x2587c6['include'],function(_0x2d1f2a){return{'model':db[_0x2d1f2a['model']],'as':_0x2d1f2a['as'],'attributes':_0x2d1f2a['attributes'],'include':_0x2d1f2a[_0xc655('0xb')]?_[_0xc655('0xc')](_0x2d1f2a['include'],function(_0x2e5b2d){return{'model':db[_0x2e5b2d[_0xc655('0xe')]],'as':_0x2e5b2d['as'],'attributes':_0x2e5b2d[_0xc655('0xd')]};}):[]};}):[]};}):[]:[]})[_0xc655('0xf')](function(_0x385f01){var _0x365b14=[];for(var _0x5e8096=0x0;_0x5e8096<_0x385f01['length'];_0x5e8096+=0x1){_0x365b14[_0xc655('0x2d')](_0x385f01[_0x5e8096][_0xc655('0x1d')](_0x5b39f2['body'],{'transaction':_0x4d8bb4}));}return BPromise[_0xc655('0x2e')](_0x365b14);});})['then'](function(_0x1f5515){logger['info'](_0xc655('0x3c'),_0x5b39f2);logger[_0xc655('0x12')](_0xc655('0x3c'),_0x5b39f2,JSON['stringify'](_0x1f5515));_0x33f67f(_0x1f5515);})[_0xc655('0x14')](function(_0x1bb62a){logger[_0xc655('0x16')](_0xc655('0x3c'),_0x1bb62a[_0xc655('0x15')],_0x5b39f2);_0x4d2ca8(_0x2ab3e8[_0xc655('0x16')](0x1f4,_0x1bb62a['message']));});});});};exports[_0xc655('0x3e')]=function(_0x4994f4){var _0x366afe=this;return new Promise(function(_0x3b425f,_0x44e03c){db['CmContact'][_0xc655('0x22')]()[_0xc655('0xf')](function(_0x1db6e3){return db[_0xc655('0x6')]['findAll']({'raw':_0x4994f4['options']?_0x4994f4[_0xc655('0x8')][_0xc655('0x9')]===undefined?!![]:![]:!![],'where':_0x4994f4['options']?_0x4994f4[_0xc655('0x8')]['where']||null:null,'attributes':_0x4994f4[_0xc655('0x8')]?_0x4994f4['options'][_0xc655('0xd')]||null:null,'limit':_0x4994f4[_0xc655('0x8')]?_0x4994f4[_0xc655('0x8')][_0xc655('0xa')]||null:null,'include':_0x4994f4['options']?_0x4994f4['options'][_0xc655('0xb')]?_[_0xc655('0xc')](_0x4994f4[_0xc655('0x8')][_0xc655('0xb')],function(_0x3f33ef){return{'model':db[_0x3f33ef[_0xc655('0xe')]],'as':_0x3f33ef['as'],'attributes':_0x3f33ef['as']===_0xc655('0x28')?_['keys'](_0x1db6e3):_0x3f33ef['attributes'],'include':_0x3f33ef[_0xc655('0xb')]?_['map'](_0x3f33ef[_0xc655('0xb')],function(_0x5dccb2){return{'model':db[_0x5dccb2[_0xc655('0xe')]],'as':_0x5dccb2['as'],'attributes':_0x5dccb2[_0xc655('0xd')],'include':_0x5dccb2[_0xc655('0xb')]?_[_0xc655('0xc')](_0x5dccb2[_0xc655('0xb')],function(_0x734ac5){return{'model':db[_0x734ac5[_0xc655('0xe')]],'as':_0x734ac5['as'],'attributes':_0x734ac5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc655('0xf')](function(_0x3a89c4){logger['info']('GetCmHopper',_0x4994f4);logger[_0xc655('0x12')](_0xc655('0x11'),_0x4994f4,JSON[_0xc655('0x13')](_0x3a89c4));_0x3b425f(_0x3a89c4);})[_0xc655('0x14')](function(_0x2359e7){logger[_0xc655('0x16')]('GetCmHopper',_0x2359e7[_0xc655('0x15')],_0x4994f4);_0x44e03c(_0x366afe['error'](0x1f4,_0x2359e7[_0xc655('0x15')]));});});});};exports['GetContactByPhone']=function(_0x45dea7){var _0x2e9cd1=this;return new Promise(function(_0x4cdb1b,_0x4218d7){return db[_0xc655('0x27')][_0xc655('0x3f')]({'raw':!![],'where':{'phone':_0x45dea7[_0xc655('0x8')][_0xc655('0x19')][_0xc655('0x40')]},'attributes':['id',_0xc655('0x41')],'order':[['id',_0xc655('0x42')]]})[_0xc655('0xf')](function(_0x255569){logger['info'](_0xc655('0x43'),_0x45dea7);logger[_0xc655('0x12')]('getContactByPhone',_0x45dea7,JSON['stringify'](_0x255569));_0x4cdb1b(_0x255569);})['catch'](function(_0x38d2b3){logger[_0xc655('0x16')](_0xc655('0x43'),_0x38d2b3[_0xc655('0x15')],_0x45dea7);_0x4218d7(_0x2e9cd1[_0xc655('0x16')](0x1f4,_0x38d2b3['message']));});});};exports[_0xc655('0x44')]=function(_0x37d8ca){var _0x4a822f=this;return new Promise(function(_0x21e40f,_0x27df71){return db['sequelize'][_0xc655('0x24')](function(_0x19723e){var _0x5f23e6=_0x37d8ca['options']&&_0x37d8ca[_0xc655('0x8')][_0xc655('0x19')]?_0x37d8ca['options'][_0xc655('0x19')]:{};return db[_0xc655('0x6')][_0xc655('0x1d')](_0x37d8ca[_0xc655('0x1b')],{'where':_0x5f23e6,'transaction':_0x19723e})[_0xc655('0xf')](function(_0xf2a711){logger[_0xc655('0x10')](_0xc655('0x44'),_0x37d8ca);logger['debug'](_0xc655('0x44'),_0x37d8ca,JSON[_0xc655('0x13')](_0xf2a711));_0x21e40f(_0xf2a711);})[_0xc655('0x14')](function(_0x4f09b9){logger[_0xc655('0x16')](_0xc655('0x44'),_0x4f09b9[_0xc655('0x15')],_0x37d8ca);_0x27df71(_0x4a822f[_0xc655('0x16')](0x1f4,_0x4f09b9[_0xc655('0x15')]));});});});};exports[_0xc655('0x45')]=function(_0x454b69){var _0x3b364b=this;var _0x13d9ee=_0x454b69[_0xc655('0x1b')]['where'][_0xc655('0x46')];var _0x241338=_0x454b69['body'][_0xc655('0x19')][_0xc655('0x47')];var _0x40f451=_0x454b69[_0xc655('0x1b')][_0xc655('0x19')]['availableAgentsIds'];return new Promise(function(_0x5609c2,_0x5c8e66){return db['CmHopper'][_0xc655('0x7')]({'where':{'voiceQueueId':{'$in':_0x13d9ee},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xc655('0x48')](_0xc655('0x49')+_0x241338+_0xc655('0x4a')),'$gt':db[_0xc655('0x23')][_0xc655('0x48')]('NOW()')}},'UserId':{'$in':_0x40f451}},'include':[{'model':db[_0xc655('0x27')],'as':'Contact'},{'model':db[_0xc655('0x29')],'as':_0xc655('0x2a'),'attributes':['id',_0xc655('0x2b'),_0xc655('0x4b')]},{'model':db['CmList'],'as':_0xc655('0x4c')}]})[_0xc655('0xf')](function(_0x3e1eb){if(_0x3e1eb[_0xc655('0x4d')]>0x0){return db[_0xc655('0x23')]['transaction'](function(_0x365cb8){return db['CmHopper'][_0xc655('0x1d')]({'recallmeNotifiedDate':db[_0xc655('0x23')][_0xc655('0x48')](_0xc655('0x4e'))},{'where':{'id':{'$in':_[_0xc655('0xc')](_0x3e1eb,'id')}},'transaction':_0x365cb8})['then'](function(){_0x5609c2(_0x3e1eb);})[_0xc655('0x14')](function(_0x4b086f){logger[_0xc655('0x16')]('CmHopperHandlePreviewRecallNotifications',_0x4b086f[_0xc655('0x15')],_0x454b69);_0x5c8e66(_0x3b364b['error'](0x1f4,_0x4b086f['message']));});})[_0xc655('0x14')](function(_0x245ef3){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x245ef3[_0xc655('0x15')],_0x454b69);_0x5c8e66(_0x3b364b[_0xc655('0x16')](0x1f4,_0x245ef3['message']));});}else{_0x5609c2(_0x3e1eb);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 030a73f..4927dbb 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 _0xa883=['exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','isAuthenticated','describe','/opencontacts','/:id','show','/:id/previewrecall','post','create','/preview','getPreview','getTimezone','update','delete','destroy'];(function(_0x25e2bc,_0x27d1ef){var _0x5152d3=function(_0x354708){while(--_0x354708){_0x25e2bc['push'](_0x25e2bc['shift']());}};_0x5152d3(++_0x27d1ef);}(_0xa883,0x13c));var _0x3a88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa883[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x3a88('0x0'));var router=express[_0x3a88('0x1')]();var auth=require(_0x3a88('0x2'));var controller=require(_0x3a88('0x3'));router[_0x3a88('0x4')]('/',auth['isAuthenticated'](),controller[_0x3a88('0x5')]);router[_0x3a88('0x4')]('/describe',auth[_0x3a88('0x6')](),controller[_0x3a88('0x7')]);router[_0x3a88('0x4')](_0x3a88('0x8'),auth[_0x3a88('0x6')](),controller['getOpenContacts']);router['get']('/timezones',auth[_0x3a88('0x6')](),controller['getTimezones']);router['get'](_0x3a88('0x9'),auth[_0x3a88('0x6')](),controller[_0x3a88('0xa')]);router['get'](_0x3a88('0xb'),auth[_0x3a88('0x6')](),controller['getPreviewRecall']);router[_0x3a88('0xc')]('/',auth['isAuthenticated'](),controller[_0x3a88('0xd')]);router['post'](_0x3a88('0xe'),auth['isAuthenticated'](),controller[_0x3a88('0xf')]);router[_0x3a88('0xc')]('/timezone',auth[_0x3a88('0x6')](),controller[_0x3a88('0x10')]);router['put'](_0x3a88('0x9'),auth[_0x3a88('0x6')](),controller[_0x3a88('0x11')]);router[_0x3a88('0x12')](_0x3a88('0x9'),auth[_0x3a88('0x6')](),controller[_0x3a88('0x13')]);module[_0x3a88('0x14')]=router; \ No newline at end of file +var _0xc119=['delete','destroy','exports','express','../../components/auth/service','get','isAuthenticated','index','/describe','describe','getOpenContacts','/timezones','getTimezones','show','getPreviewRecall','post','create','/preview','/timezone','getTimezone','put','/:id','update'];(function(_0x44d27b,_0x54bbf6){var _0x44e01e=function(_0x86f444){while(--_0x86f444){_0x44d27b['push'](_0x44d27b['shift']());}};_0x44e01e(++_0x54bbf6);}(_0xc119,0xbb));var _0x9c11=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0xc119[_0x1d39f6];return _0x3dbd7a;};'use strict';var express=require(_0x9c11('0x0'));var router=express['Router']();var auth=require(_0x9c11('0x1'));var controller=require('./cmHopper.controller');router[_0x9c11('0x2')]('/',auth[_0x9c11('0x3')](),controller[_0x9c11('0x4')]);router['get'](_0x9c11('0x5'),auth[_0x9c11('0x3')](),controller[_0x9c11('0x6')]);router[_0x9c11('0x2')]('/opencontacts',auth[_0x9c11('0x3')](),controller[_0x9c11('0x7')]);router[_0x9c11('0x2')](_0x9c11('0x8'),auth[_0x9c11('0x3')](),controller[_0x9c11('0x9')]);router[_0x9c11('0x2')]('/:id',auth[_0x9c11('0x3')](),controller[_0x9c11('0xa')]);router[_0x9c11('0x2')]('/:id/previewrecall',auth[_0x9c11('0x3')](),controller[_0x9c11('0xb')]);router[_0x9c11('0xc')]('/',auth[_0x9c11('0x3')](),controller[_0x9c11('0xd')]);router['post'](_0x9c11('0xe'),auth[_0x9c11('0x3')](),controller['getPreview']);router['post'](_0x9c11('0xf'),auth[_0x9c11('0x3')](),controller[_0x9c11('0x10')]);router[_0x9c11('0x11')](_0x9c11('0x12'),auth[_0x9c11('0x3')](),controller[_0x9c11('0x13')]);router[_0x9c11('0x14')](_0x9c11('0x12'),auth[_0x9c11('0x3')](),controller[_0x9c11('0x15')]);module[_0x9c11('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 5c58154..e4f179f 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 _0xb394=['INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0xb394,0x9a));var _0x4b39=function(_0x2e180b,_0x7d7e32){_0x2e180b=_0x2e180b-0x0;var _0x20b1e4=_0xb394[_0x2e180b];return _0x20b1e4;};'use strict';var moment=require(_0x4b39('0x0'));var Sequelize=require('sequelize');module[_0x4b39('0x1')]={'CmHopperId':{'type':Sequelize[_0x4b39('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4b39('0x3')],'defaultValue':moment()[_0x4b39('0x4')](_0x4b39('0x5'))},'countbusyretry':{'type':Sequelize[_0x4b39('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4b39('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4b39('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4b39('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4b39('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1dad=['sequelize','exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x1dad,0x12c));var _0xd1da=function(_0x19556f,_0x48243c){_0x19556f=_0x19556f-0x0;var _0x2c30ef=_0x1dad[_0x19556f];return _0x2c30ef;};'use strict';var moment=require(_0xd1da('0x0'));var Sequelize=require(_0xd1da('0x1'));module[_0xd1da('0x2')]={'CmHopperId':{'type':Sequelize[_0xd1da('0x3')]},'phone':{'type':Sequelize[_0xd1da('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd1da('0x5')](_0xd1da('0x6'))},'countbusyretry':{'type':Sequelize[_0xd1da('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xd1da('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd1da('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd1da('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd1da('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index f7ecfc9..66f6e15 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 _0xf51e=['where','pick','filter','map','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','update','destroy','then','UserProfileResource','error','stack','name','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x1006d5,_0x31bf70){var _0x4513da=function(_0x345cb6){while(--_0x345cb6){_0x1006d5['push'](_0x1006d5['shift']());}};_0x4513da(++_0x31bf70);}(_0xf51e,0x1ad));var _0xef51=function(_0x15a807,_0x102fdb){_0x15a807=_0x15a807-0x0;var _0x4008a8=_0xf51e[_0x15a807];return _0x4008a8;};'use strict';var emlformat=require(_0xef51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef51('0x1'));var jsonpatch=require(_0xef51('0x2'));var rp=require('request-promise');var moment=require(_0xef51('0x3'));var BPromise=require(_0xef51('0x4'));var Mustache=require(_0xef51('0x5'));var util=require(_0xef51('0x6'));var path=require(_0xef51('0x7'));var sox=require(_0xef51('0x8'));var csv=require(_0xef51('0x9'));var ejs=require(_0xef51('0xa'));var fs=require('fs');var fs_extra=require(_0xef51('0xb'));var _=require(_0xef51('0xc'));var squel=require(_0xef51('0xd'));var crypto=require(_0xef51('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xef51('0xf'));var toCsv=require(_0xef51('0x9'));var querystring=require(_0xef51('0x10'));var Papa=require(_0xef51('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xef51('0x12'));var as=require(_0xef51('0x13'));var hardwareService=require(_0xef51('0x14'));var logger=require(_0xef51('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xef51('0x16'));var licenseUtil=require(_0xef51('0x17'));var db=require(_0xef51('0x18'))['db'];function respondWithStatusCode(_0x1bdb7e,_0xc8914f){_0xc8914f=_0xc8914f||0xcc;return function(_0x2d9f97){if(_0x2d9f97){return _0x1bdb7e[_0xef51('0x19')](_0xc8914f);}return _0x1bdb7e[_0xef51('0x1a')](_0xc8914f)['end']();};}function respondWithResult(_0x47d40c,_0x466597){_0x466597=_0x466597||0xc8;return function(_0x14ba0e){if(_0x14ba0e){return _0x47d40c['status'](_0x466597)[_0xef51('0x1b')](_0x14ba0e);}};}function respondWithFilteredResult(_0x4d2913,_0x7bb19a){return function(_0x59453f){if(_0x59453f){var _0x42277c=typeof _0x7bb19a[_0xef51('0x1c')]===_0xef51('0x1d')&&typeof _0x7bb19a['limit']===_0xef51('0x1d');var _0x4ccb78=_0x59453f[_0xef51('0x1e')];var _0x1e0c6f=_0x42277c?0x0:_0x7bb19a[_0xef51('0x1c')];var _0x437aed=_0x42277c?_0x59453f['count']:_0x7bb19a[_0xef51('0x1c')]+_0x7bb19a[_0xef51('0x1f')];var _0x494a25;if(_0x437aed>=_0x4ccb78){_0x437aed=_0x4ccb78;_0x494a25=0xc8;}else{_0x494a25=0xce;}_0x4d2913[_0xef51('0x1a')](_0x494a25);return _0x4d2913['set'](_0xef51('0x20'),_0x1e0c6f+'-'+_0x437aed+'/'+_0x4ccb78)[_0xef51('0x1b')](_0x59453f);}return null;};}function patchUpdates(_0xd79381){return function(_0x4a8a82){try{jsonpatch[_0xef51('0x21')](_0x4a8a82,_0xd79381,!![]);}catch(_0x128784){return BPromise['reject'](_0x128784);}return _0x4a8a82['save']();};}function saveUpdates(_0x3f9a02,_0xe22a16){return function(_0x2d25b1){if(_0x2d25b1){return _0x2d25b1[_0xef51('0x22')](_0x3f9a02)['then'](function(_0x3a2616){return _0x3a2616;});}return null;};}function removeEntity(_0xe0e466,_0x1a02d4){return function(_0x1653dc){if(_0x1653dc){return _0x1653dc[_0xef51('0x23')]()[_0xef51('0x24')](function(){var _0x187cc9=_0x1653dc['get']({'plain':!![]});var _0x256237='CmHopperAdditionalPhones';return db[_0xef51('0x25')][_0xef51('0x23')]({'where':{'type':_0x256237,'resourceId':_0x187cc9['id']}})[_0xef51('0x24')](function(){return _0x1653dc;});})['then'](function(){_0xe0e466[_0xef51('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x394cdc,_0x5d31b8){return function(_0x589743){if(!_0x589743){_0x394cdc[_0xef51('0x19')](0x194);}return _0x589743;};}function handleError(_0x570274,_0x1f6a68){_0x1f6a68=_0x1f6a68||0x1f4;return function(_0x58d2e0){logger[_0xef51('0x26')](_0x58d2e0[_0xef51('0x27')]);if(_0x58d2e0['name']){delete _0x58d2e0[_0xef51('0x28')];}_0x570274[_0xef51('0x1a')](_0x1f6a68)['send'](_0x58d2e0);};}exports['index']=function(_0x37e14c,_0x4a7b8e){var _0x2b6e82={},_0x1ff41f={},_0x1b3a29={'count':0x0,'rows':[]};var _0x1eda4e=_['map'](db[_0xef51('0x29')][_0xef51('0x2a')],function(_0x95cb3c){return{'name':_0x95cb3c[_0xef51('0x2b')],'type':_0x95cb3c[_0xef51('0x2c')][_0xef51('0x2d')]};});_0x1ff41f[_0xef51('0x2e')]=_['map'](_0x1eda4e,_0xef51('0x28'));_0x1ff41f[_0xef51('0x2f')]=_[_0xef51('0x30')](_0x37e14c[_0xef51('0x2f')]);_0x1ff41f[_0xef51('0x31')]=_[_0xef51('0x32')](_0x1ff41f[_0xef51('0x2e')],_0x1ff41f['query']);_0x2b6e82['attributes']=_[_0xef51('0x32')](_0x1ff41f[_0xef51('0x2e')],qs[_0xef51('0x33')](_0x37e14c[_0xef51('0x2f')][_0xef51('0x33')]));_0x2b6e82[_0xef51('0x34')]=_0x2b6e82[_0xef51('0x34')][_0xef51('0x35')]?_0x2b6e82['attributes']:_0x1ff41f[_0xef51('0x2e')];if(!_0x37e14c['query']['hasOwnProperty'](_0xef51('0x36'))){_0x2b6e82['limit']=qs[_0xef51('0x1f')](_0x37e14c['query'][_0xef51('0x1f')]);_0x2b6e82[_0xef51('0x1c')]=qs['offset'](_0x37e14c[_0xef51('0x2f')][_0xef51('0x1c')]);}_0x2b6e82[_0xef51('0x37')]=qs[_0xef51('0x38')](_0x37e14c[_0xef51('0x2f')][_0xef51('0x38')]);_0x2b6e82[_0xef51('0x39')]=qs[_0xef51('0x31')](_[_0xef51('0x3a')](_0x37e14c['query'],_0x1ff41f[_0xef51('0x31')]),_0x1eda4e);if(_0x37e14c['query'][_0xef51('0x3b')]){_0x2b6e82[_0xef51('0x39')]=_['merge'](_0x2b6e82['where'],{'$or':_[_0xef51('0x3c')](_0x1eda4e,function(_0xe90898){if(_0xe90898[_0xef51('0x2c')]!=='VIRTUAL'){var _0x1272e5={};_0x1272e5[_0xe90898[_0xef51('0x28')]]={'$like':'%'+_0x37e14c['query'][_0xef51('0x3b')]+'%'};return _0x1272e5;}})});}_0x2b6e82=_[_0xef51('0x3d')]({},_0x2b6e82,_0x37e14c[_0xef51('0x3e')]);var _0x4e9b24={'where':_0x2b6e82[_0xef51('0x39')]};return db[_0xef51('0x29')][_0xef51('0x1e')](_0x4e9b24)[_0xef51('0x24')](function(_0x95228b){_0x1b3a29[_0xef51('0x1e')]=_0x95228b;if(_0x37e14c['query']['includeAll']){_0x2b6e82[_0xef51('0x3f')]=[{'all':!![]}];}return db[_0xef51('0x29')][_0xef51('0x40')](_0x2b6e82);})[_0xef51('0x24')](function(_0x1bc4d2){_0x1b3a29[_0xef51('0x41')]=_0x1bc4d2;return _0x1b3a29;})['then'](respondWithFilteredResult(_0x4a7b8e,_0x2b6e82))['catch'](handleError(_0x4a7b8e,null));};exports[_0xef51('0x42')]=function(_0x4f21ed,_0x3d6e01){var _0x5b8ead={'raw':!![],'where':{'id':_0x4f21ed[_0xef51('0x43')]['id']}},_0x4f4695={};_0x4f4695[_0xef51('0x2e')]=_[_0xef51('0x30')](db['CmHopperAdditionalPhone'][_0xef51('0x2a')]);_0x4f4695['query']=_['keys'](_0x4f21ed[_0xef51('0x2f')]);_0x4f4695[_0xef51('0x31')]=_['intersection'](_0x4f4695[_0xef51('0x2e')],_0x4f4695[_0xef51('0x2f')]);_0x5b8ead['attributes']=_[_0xef51('0x32')](_0x4f4695[_0xef51('0x2e')],qs[_0xef51('0x33')](_0x4f21ed[_0xef51('0x2f')][_0xef51('0x33')]));_0x5b8ead[_0xef51('0x34')]=_0x5b8ead[_0xef51('0x34')][_0xef51('0x35')]?_0x5b8ead[_0xef51('0x34')]:_0x4f4695['model'];if(_0x4f21ed[_0xef51('0x2f')][_0xef51('0x44')]){_0x5b8ead[_0xef51('0x3f')]=[{'all':!![]}];}_0x5b8ead=_['merge']({},_0x5b8ead,_0x4f21ed['options']);return db[_0xef51('0x29')][_0xef51('0x45')](_0x5b8ead)[_0xef51('0x24')](handleEntityNotFound(_0x3d6e01,null))[_0xef51('0x24')](respondWithResult(_0x3d6e01,null))[_0xef51('0x46')](handleError(_0x3d6e01,null));};exports[_0xef51('0x47')]=function(_0xe32a87,_0x53faca){return db[_0xef51('0x29')][_0xef51('0x47')](_0xe32a87['body'],{})['then'](function(_0x522bc5){var _0x7f937a=_0xe32a87['user'][_0xef51('0x48')]({'plain':!![]});if(!_0x7f937a)throw new Error(_0xef51('0x49'));if(_0x7f937a[_0xef51('0x4a')]===_0xef51('0x4b')){var _0x59c9dd=_0x522bc5[_0xef51('0x48')]({'plain':!![]});var _0x3b6cdb=_0xef51('0x4c');return db[_0xef51('0x4d')][_0xef51('0x45')]({'where':{'name':_0x3b6cdb,'userProfileId':_0x7f937a[_0xef51('0x4e')]},'raw':!![]})[_0xef51('0x24')](function(_0x5161b5){if(_0x5161b5&&_0x5161b5[_0xef51('0x4f')]===0x0){return db[_0xef51('0x25')][_0xef51('0x47')]({'name':_0x59c9dd[_0xef51('0x28')],'resourceId':_0x59c9dd['id'],'type':_0x5161b5[_0xef51('0x28')],'sectionId':_0x5161b5['id']},{})[_0xef51('0x24')](function(){return _0x522bc5;});}else{return _0x522bc5;}})[_0xef51('0x46')](function(_0x3d4c3d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d4c3d);throw _0x3d4c3d;});}return _0x522bc5;})[_0xef51('0x24')](respondWithResult(_0x53faca,0xc9))[_0xef51('0x46')](handleError(_0x53faca,null));};exports[_0xef51('0x22')]=function(_0x2bc7de,_0x43d2fb){if(_0x2bc7de[_0xef51('0x50')]['id']){delete _0x2bc7de[_0xef51('0x50')]['id'];}return db['CmHopperAdditionalPhone'][_0xef51('0x45')]({'where':{'id':_0x2bc7de[_0xef51('0x43')]['id']}})['then'](handleEntityNotFound(_0x43d2fb,null))['then'](saveUpdates(_0x2bc7de[_0xef51('0x50')],null))[_0xef51('0x24')](respondWithResult(_0x43d2fb,null))[_0xef51('0x46')](handleError(_0x43d2fb,null));};exports[_0xef51('0x23')]=function(_0x28bee1,_0x4ec616){return db[_0xef51('0x29')][_0xef51('0x45')]({'where':{'id':_0x28bee1['params']['id']}})[_0xef51('0x24')](handleEntityNotFound(_0x4ec616,null))[_0xef51('0x24')](removeEntity(_0x4ec616,null))['catch'](handleError(_0x4ec616,null));}; \ No newline at end of file +var _0x3bf8=['desk.js','papaparse','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','update','then','UserProfileResource','destroy','end','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x3bf8,0x1d9));var _0x83bf=function(_0x58a47c,_0x24790b){_0x58a47c=_0x58a47c-0x0;var _0x465bad=_0x3bf8[_0x58a47c];return _0x465bad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83bf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83bf('0x1'));var rp=require(_0x83bf('0x2'));var moment=require(_0x83bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x83bf('0x4'));var util=require(_0x83bf('0x5'));var path=require(_0x83bf('0x6'));var sox=require(_0x83bf('0x7'));var csv=require(_0x83bf('0x8'));var ejs=require(_0x83bf('0x9'));var fs=require('fs');var fs_extra=require(_0x83bf('0xa'));var _=require(_0x83bf('0xb'));var squel=require('squel');var crypto=require(_0x83bf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x83bf('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x83bf('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x83bf('0xf'))(_0x83bf('0x10'));var utils=require('../../config/utils');var config=require(_0x83bf('0x11'));var licenseUtil=require(_0x83bf('0x12'));var db=require(_0x83bf('0x13'))['db'];function respondWithStatusCode(_0x34228d,_0x3d1f89){_0x3d1f89=_0x3d1f89||0xcc;return function(_0x18563f){if(_0x18563f){return _0x34228d[_0x83bf('0x14')](_0x3d1f89);}return _0x34228d['status'](_0x3d1f89)['end']();};}function respondWithResult(_0x1e481e,_0x24eb39){_0x24eb39=_0x24eb39||0xc8;return function(_0x2afd54){if(_0x2afd54){return _0x1e481e['status'](_0x24eb39)[_0x83bf('0x15')](_0x2afd54);}};}function respondWithFilteredResult(_0xd31dfa,_0xeec8f){return function(_0x217b0e){if(_0x217b0e){var _0x5d9eec=typeof _0xeec8f[_0x83bf('0x16')]===_0x83bf('0x17')&&typeof _0xeec8f[_0x83bf('0x18')]===_0x83bf('0x17');var _0x7a86b9=_0x217b0e[_0x83bf('0x19')];var _0x17d4e0=_0x5d9eec?0x0:_0xeec8f[_0x83bf('0x16')];var _0x3b2202=_0x5d9eec?_0x217b0e[_0x83bf('0x19')]:_0xeec8f[_0x83bf('0x16')]+_0xeec8f['limit'];var _0x3845c1;if(_0x3b2202>=_0x7a86b9){_0x3b2202=_0x7a86b9;_0x3845c1=0xc8;}else{_0x3845c1=0xce;}_0xd31dfa[_0x83bf('0x1a')](_0x3845c1);return _0xd31dfa[_0x83bf('0x1b')]('Content-Range',_0x17d4e0+'-'+_0x3b2202+'/'+_0x7a86b9)[_0x83bf('0x15')](_0x217b0e);}return null;};}function patchUpdates(_0x47a53b){return function(_0x5304ab){try{jsonpatch[_0x83bf('0x1c')](_0x5304ab,_0x47a53b,!![]);}catch(_0x58fe20){return BPromise[_0x83bf('0x1d')](_0x58fe20);}return _0x5304ab['save']();};}function saveUpdates(_0x4a4392,_0x2c31af){return function(_0x13f160){if(_0x13f160){return _0x13f160[_0x83bf('0x1e')](_0x4a4392)[_0x83bf('0x1f')](function(_0x35dae9){return _0x35dae9;});}return null;};}function removeEntity(_0x5eb94b,_0x4d66fa){return function(_0x41d95c){if(_0x41d95c){return _0x41d95c['destroy']()[_0x83bf('0x1f')](function(){var _0x414a2d=_0x41d95c['get']({'plain':!![]});var _0x2549ee='CmHopperAdditionalPhones';return db[_0x83bf('0x20')][_0x83bf('0x21')]({'where':{'type':_0x2549ee,'resourceId':_0x414a2d['id']}})[_0x83bf('0x1f')](function(){return _0x41d95c;});})[_0x83bf('0x1f')](function(){_0x5eb94b['status'](0xcc)[_0x83bf('0x22')]();});}};}function handleEntityNotFound(_0x1f2ae6,_0x5784a6){return function(_0x20bf35){if(!_0x20bf35){_0x1f2ae6[_0x83bf('0x14')](0x194);}return _0x20bf35;};}function handleError(_0x110956,_0x5b02c9){_0x5b02c9=_0x5b02c9||0x1f4;return function(_0x2f6ea2){logger['error'](_0x2f6ea2[_0x83bf('0x23')]);if(_0x2f6ea2[_0x83bf('0x24')]){delete _0x2f6ea2[_0x83bf('0x24')];}_0x110956[_0x83bf('0x1a')](_0x5b02c9)[_0x83bf('0x25')](_0x2f6ea2);};}exports[_0x83bf('0x26')]=function(_0xb61294,_0x3d79bb){var _0x21056c={},_0x15ae23={},_0x394c5e={'count':0x0,'rows':[]};var _0xe22732=_[_0x83bf('0x27')](db[_0x83bf('0x28')]['rawAttributes'],function(_0x140598){return{'name':_0x140598[_0x83bf('0x29')],'type':_0x140598['type'][_0x83bf('0x2a')]};});_0x15ae23['model']=_[_0x83bf('0x27')](_0xe22732,_0x83bf('0x24'));_0x15ae23[_0x83bf('0x2b')]=_['keys'](_0xb61294[_0x83bf('0x2b')]);_0x15ae23[_0x83bf('0x2c')]=_['intersection'](_0x15ae23[_0x83bf('0x2d')],_0x15ae23[_0x83bf('0x2b')]);_0x21056c['attributes']=_[_0x83bf('0x2e')](_0x15ae23[_0x83bf('0x2d')],qs['fields'](_0xb61294[_0x83bf('0x2b')][_0x83bf('0x2f')]));_0x21056c[_0x83bf('0x30')]=_0x21056c['attributes']['length']?_0x21056c[_0x83bf('0x30')]:_0x15ae23[_0x83bf('0x2d')];if(!_0xb61294[_0x83bf('0x2b')][_0x83bf('0x31')](_0x83bf('0x32'))){_0x21056c['limit']=qs[_0x83bf('0x18')](_0xb61294[_0x83bf('0x2b')]['limit']);_0x21056c['offset']=qs[_0x83bf('0x16')](_0xb61294[_0x83bf('0x2b')][_0x83bf('0x16')]);}_0x21056c['order']=qs[_0x83bf('0x33')](_0xb61294['query'][_0x83bf('0x33')]);_0x21056c[_0x83bf('0x34')]=qs[_0x83bf('0x2c')](_[_0x83bf('0x35')](_0xb61294[_0x83bf('0x2b')],_0x15ae23[_0x83bf('0x2c')]),_0xe22732);if(_0xb61294[_0x83bf('0x2b')][_0x83bf('0x36')]){_0x21056c['where']=_[_0x83bf('0x37')](_0x21056c['where'],{'$or':_[_0x83bf('0x27')](_0xe22732,function(_0x20d521){if(_0x20d521[_0x83bf('0x38')]!==_0x83bf('0x39')){var _0x4279aa={};_0x4279aa[_0x20d521[_0x83bf('0x24')]]={'$like':'%'+_0xb61294[_0x83bf('0x2b')][_0x83bf('0x36')]+'%'};return _0x4279aa;}})});}_0x21056c=_[_0x83bf('0x37')]({},_0x21056c,_0xb61294[_0x83bf('0x3a')]);var _0x543a47={'where':_0x21056c['where']};return db[_0x83bf('0x28')][_0x83bf('0x19')](_0x543a47)[_0x83bf('0x1f')](function(_0x3acd13){_0x394c5e['count']=_0x3acd13;if(_0xb61294['query']['includeAll']){_0x21056c[_0x83bf('0x3b')]=[{'all':!![]}];}return db[_0x83bf('0x28')][_0x83bf('0x3c')](_0x21056c);})[_0x83bf('0x1f')](function(_0x513d7f){_0x394c5e[_0x83bf('0x3d')]=_0x513d7f;return _0x394c5e;})['then'](respondWithFilteredResult(_0x3d79bb,_0x21056c))[_0x83bf('0x3e')](handleError(_0x3d79bb,null));};exports[_0x83bf('0x3f')]=function(_0x5a2751,_0x20c950){var _0x3071f4={'raw':!![],'where':{'id':_0x5a2751[_0x83bf('0x40')]['id']}},_0x1c6de4={};_0x1c6de4[_0x83bf('0x2d')]=_[_0x83bf('0x41')](db[_0x83bf('0x28')][_0x83bf('0x42')]);_0x1c6de4['query']=_[_0x83bf('0x41')](_0x5a2751['query']);_0x1c6de4[_0x83bf('0x2c')]=_[_0x83bf('0x2e')](_0x1c6de4[_0x83bf('0x2d')],_0x1c6de4[_0x83bf('0x2b')]);_0x3071f4[_0x83bf('0x30')]=_[_0x83bf('0x2e')](_0x1c6de4[_0x83bf('0x2d')],qs[_0x83bf('0x2f')](_0x5a2751['query'][_0x83bf('0x2f')]));_0x3071f4[_0x83bf('0x30')]=_0x3071f4[_0x83bf('0x30')][_0x83bf('0x43')]?_0x3071f4[_0x83bf('0x30')]:_0x1c6de4['model'];if(_0x5a2751['query'][_0x83bf('0x44')]){_0x3071f4[_0x83bf('0x3b')]=[{'all':!![]}];}_0x3071f4=_[_0x83bf('0x37')]({},_0x3071f4,_0x5a2751[_0x83bf('0x3a')]);return db[_0x83bf('0x28')][_0x83bf('0x45')](_0x3071f4)[_0x83bf('0x1f')](handleEntityNotFound(_0x20c950,null))[_0x83bf('0x1f')](respondWithResult(_0x20c950,null))[_0x83bf('0x3e')](handleError(_0x20c950,null));};exports[_0x83bf('0x46')]=function(_0x1d4818,_0xb9e7db){return db['CmHopperAdditionalPhone'][_0x83bf('0x46')](_0x1d4818['body'],{})['then'](function(_0x129beb){var _0x4c4cf9=_0x1d4818[_0x83bf('0x47')][_0x83bf('0x48')]({'plain':!![]});if(!_0x4c4cf9)throw new Error(_0x83bf('0x49'));if(_0x4c4cf9[_0x83bf('0x4a')]==='user'){var _0x1a81f8=_0x129beb[_0x83bf('0x48')]({'plain':!![]});var _0x5c2d87='CmHopperAdditionalPhones';return db[_0x83bf('0x4b')][_0x83bf('0x45')]({'where':{'name':_0x5c2d87,'userProfileId':_0x4c4cf9[_0x83bf('0x4c')]},'raw':!![]})[_0x83bf('0x1f')](function(_0x4c7209){if(_0x4c7209&&_0x4c7209[_0x83bf('0x4d')]===0x0){return db[_0x83bf('0x20')][_0x83bf('0x46')]({'name':_0x1a81f8[_0x83bf('0x24')],'resourceId':_0x1a81f8['id'],'type':_0x4c7209[_0x83bf('0x24')],'sectionId':_0x4c7209['id']},{})['then'](function(){return _0x129beb;});}else{return _0x129beb;}})[_0x83bf('0x3e')](function(_0x49db98){logger[_0x83bf('0x4e')](_0x83bf('0x4f'),_0x49db98);throw _0x49db98;});}return _0x129beb;})[_0x83bf('0x1f')](respondWithResult(_0xb9e7db,0xc9))[_0x83bf('0x3e')](handleError(_0xb9e7db,null));};exports[_0x83bf('0x1e')]=function(_0x31d288,_0x4950d5){if(_0x31d288['body']['id']){delete _0x31d288[_0x83bf('0x50')]['id'];}return db[_0x83bf('0x28')][_0x83bf('0x45')]({'where':{'id':_0x31d288['params']['id']}})['then'](handleEntityNotFound(_0x4950d5,null))['then'](saveUpdates(_0x31d288[_0x83bf('0x50')],null))[_0x83bf('0x1f')](respondWithResult(_0x4950d5,null))['catch'](handleError(_0x4950d5,null));};exports[_0x83bf('0x21')]=function(_0x490337,_0x307633){return db['CmHopperAdditionalPhone'][_0x83bf('0x45')]({'where':{'id':_0x490337[_0x83bf('0x40')]['id']}})[_0x83bf('0x1f')](handleEntityNotFound(_0x307633,null))[_0x83bf('0x1f')](removeEntity(_0x307633,null))[_0x83bf('0x3e')](handleError(_0x307633,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index addfced..466eea4 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 _0x7710=['moment','bluebird','request-promise','path','exports','define','CmHopperAdditionalPhone','util','api'];(function(_0x261b3a,_0x57eab1){var _0x44c2c5=function(_0x27b222){while(--_0x27b222){_0x261b3a['push'](_0x261b3a['shift']());}};_0x44c2c5(++_0x57eab1);}(_0x7710,0x130));var _0x0771=function(_0x5c56c1,_0x3c1325){_0x5c56c1=_0x5c56c1-0x0;var _0x49a58e=_0x7710[_0x5c56c1];return _0x49a58e;};'use strict';var _=require('lodash');var util=require(_0x0771('0x0'));var logger=require('../../config/logger')(_0x0771('0x1'));var moment=require(_0x0771('0x2'));var BPromise=require(_0x0771('0x3'));var rp=require(_0x0771('0x4'));var fs=require('fs');var path=require(_0x0771('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x0771('0x6')]=function(_0x31f6e6,_0x3724da){return _0x31f6e6[_0x0771('0x7')](_0x0771('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5716=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','util','api'];(function(_0x45416d,_0x1f42bf){var _0x4d8666=function(_0x28e8a4){while(--_0x28e8a4){_0x45416d['push'](_0x45416d['shift']());}};_0x4d8666(++_0x1f42bf);}(_0x5716,0xcd));var _0x6571=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x5716[_0x1b76e6];return _0x333b53;};'use strict';var _=require(_0x6571('0x0'));var util=require(_0x6571('0x1'));var logger=require('../../config/logger')(_0x6571('0x2'));var moment=require(_0x6571('0x3'));var BPromise=require(_0x6571('0x4'));var rp=require(_0x6571('0x5'));var fs=require('fs');var path=require(_0x6571('0x6'));var rimraf=require(_0x6571('0x7'));var config=require(_0x6571('0x8'));var attributes=require(_0x6571('0x9'));module[_0x6571('0xa')]=function(_0x4d2a49,_0x1fa703){return _0x4d2a49[_0x6571('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x6571('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index fbabfe8..e42c9dd 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 _0x6903=['CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countmachineretry','countagentrejectretry','ASC','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','phone','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId'];(function(_0x403c09,_0xef2dd5){var _0x1d517f=function(_0x1c7c6f){while(--_0x1c7c6f){_0x403c09['push'](_0x403c09['shift']());}};_0x1d517f(++_0xef2dd5);}(_0x6903,0x104));var _0x3690=function(_0x46665e,_0x37dbe9){_0x46665e=_0x46665e-0x0;var _0x4e30eb=_0x6903[_0x46665e];return _0x4e30eb;};'use strict';var _=require(_0x3690('0x0'));var util=require(_0x3690('0x1'));var moment=require(_0x3690('0x2'));var BPromise=require(_0x3690('0x3'));var rs=require(_0x3690('0x4'));var fs=require('fs');var Redis=require(_0x3690('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3690('0x6'));var logger=require(_0x3690('0x7'))(_0x3690('0x8'));var config=require('../../config/environment');var jayson=require(_0x3690('0x9'));var client=jayson[_0x3690('0xa')][_0x3690('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x74bfe4,_0xe1dda,_0x4e231c){return new BPromise(function(_0x53263f,_0x3b11f7){return client[_0x3690('0xc')](_0x74bfe4,_0x4e231c)[_0x3690('0xd')](function(_0x5f52e5){logger[_0x3690('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xe1dda,_0x3690('0xf'));logger[_0x3690('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0xe1dda,_0x3690('0xf'),JSON['stringify'](_0x5f52e5));if(_0x5f52e5[_0x3690('0x11')]){if(_0x5f52e5[_0x3690('0x11')][_0x3690('0x12')]===0x1f4){logger[_0x3690('0x11')](_0x3690('0x13'),_0xe1dda,_0x5f52e5['error']['message']);return _0x3b11f7(_0x5f52e5['error']['message']);}logger[_0x3690('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xe1dda,_0x5f52e5[_0x3690('0x11')][_0x3690('0x14')]);return _0x53263f(_0x5f52e5[_0x3690('0x11')][_0x3690('0x14')]);}else{logger[_0x3690('0xe')](_0x3690('0x13'),_0xe1dda,'request\x20sent');_0x53263f(_0x5f52e5[_0x3690('0x15')]['message']);}})[_0x3690('0x16')](function(_0x367730){logger[_0x3690('0x11')](_0x3690('0x13'),_0xe1dda,_0x367730);_0x3b11f7(_0x367730);});});}exports[_0x3690('0x17')]=function(_0x1049b6){var _0x1b5320=this;return new Promise(function(_0x2ad04e,_0x4e4cf0){return db[_0x3690('0x18')][_0x3690('0x19')]({'raw':!![],'where':{'ContactId':_0x1049b6['body'][_0x3690('0x1a')],'ListId':_0x1049b6[_0x3690('0x1b')][_0x3690('0x1c')],'VoiceQueueId':_0x1049b6[_0x3690('0x1b')][_0x3690('0x1d')]===undefined?null:_0x1049b6[_0x3690('0x1b')][_0x3690('0x1d')],'CampaignId':_0x1049b6['body'][_0x3690('0x1e')]===undefined?null:_0x1049b6[_0x3690('0x1b')][_0x3690('0x1e')]}})[_0x3690('0xd')](function(_0x399333){if(_0x399333!=null){return db[_0x3690('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x399333['id'],'OrderBy':{'$gt':_0x399333[_0x3690('0x20')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x5b1779){var _0xf82f75=0x0;if(_0x5b1779){if(_0x5b1779[_0x3690('0x21')]+_0x5b1779[_0x3690('0x22')]+_0x5b1779['countnoanswerretry']+_0x5b1779['countnosuchnumberretry']+_0x5b1779['countdropretry']+_0x5b1779['countabandonedretry']+_0x5b1779[_0x3690('0x23')]+_0x5b1779[_0x3690('0x24')]<_0x1049b6['entity']['dialGlobalMaxRetry'])_0xf82f75=0x1;_0x2ad04e({'additional':_0xf82f75});}else{return db[_0x3690('0x1f')][_0x3690('0x19')]({'raw':!![],'where':{'CmHopperId':_0x399333['id']},'order':[[_0x3690('0x20'),_0x3690('0x25')]]})[_0x3690('0xd')](function(_0x1dfb73){var _0x537a4b=0x0;if(_0x1dfb73){if(_0x1dfb73[_0x3690('0x21')]+_0x1dfb73[_0x3690('0x22')]+_0x1dfb73['countnoanswerretry']+_0x1dfb73[_0x3690('0x26')]+_0x1dfb73[_0x3690('0x27')]+_0x1dfb73[_0x3690('0x28')]+_0x1dfb73[_0x3690('0x23')]+_0x1dfb73[_0x3690('0x24')]<_0x1049b6['entity'][_0x3690('0x29')])_0x537a4b=0x1;_0x2ad04e({'additional':_0x537a4b});}else{_0x2ad04e({'additional':0x0});}})[_0x3690('0x16')](function(_0xa877a1){logger['error'](_0x3690('0x17'),_0xa877a1[_0x3690('0x14')]);_0x4e4cf0(_0x1b5320[_0x3690('0x11')](0x1f4,_0xa877a1['message']));});}})[_0x3690('0x16')](function(_0x43c4e0){logger[_0x3690('0x11')](_0x3690('0x17'),_0x43c4e0[_0x3690('0x14')]);_0x4e4cf0(_0x1b5320[_0x3690('0x11')](0x1f4,_0x43c4e0['message']));});}else _0x2ad04e({'additional':0x0});});});};exports[_0x3690('0x2a')]=function(_0x4bcc06){var _0x482f57=this;return new Promise(function(_0x4a231a,_0x5d8ae4){return db['CmHopper'][_0x3690('0x19')]({'raw':!![],'where':{'ContactId':_0x4bcc06[_0x3690('0x1b')]['ContactId'],'ListId':_0x4bcc06[_0x3690('0x1b')]['ListId'],'VoiceQueueId':_0x4bcc06[_0x3690('0x1b')][_0x3690('0x1d')]===undefined?null:_0x4bcc06[_0x3690('0x1b')][_0x3690('0x1d')],'CampaignId':_0x4bcc06['body'][_0x3690('0x1e')]===undefined?null:_0x4bcc06[_0x3690('0x1b')]['CampaignId']}})[_0x3690('0xd')](function(_0x38ddbe){if(_0x38ddbe!=null){return db[_0x3690('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x38ddbe['id'],'OrderBy':{'$gte':_0x38ddbe[_0x3690('0x20')]}},'order':[[_0x3690('0x20'),_0x3690('0x25')]]})['then'](function(_0x2b4c00){if(_0x2b4c00)return activateAdditionalPhone(_0x38ddbe,_0x4bcc06['body'],_0x2b4c00,_0x4bcc06[_0x3690('0x2b')],_0x4bcc06['waitTime'])[_0x3690('0xd')](function(_0x59af76){_0x4a231a(_0x59af76);});else{return db[_0x3690('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x38ddbe['id']},'order':[[_0x3690('0x20'),_0x3690('0x25')]]})[_0x3690('0xd')](function(_0x1fb619){if(_0x1fb619)return activateAdditionalPhone(_0x38ddbe,_0x4bcc06['body'],_0x1fb619,_0x4bcc06[_0x3690('0x2b')],_0x4bcc06[_0x3690('0x2c')])[_0x3690('0xd')](function(_0xc9cc34){_0x4a231a(_0xc9cc34);});else{_0x4a231a({'id':_0x38ddbe['id'],'phone':''});}})['catch'](function(_0x2dd682){logger['error']('VerifyAdditionalPhones',_0x2dd682[_0x3690('0x14')]);_0x5d8ae4(_0x482f57[_0x3690('0x11')](0x1f4,_0x2dd682['message']));});}})[_0x3690('0x16')](function(_0x2aeb0b){logger[_0x3690('0x11')](_0x3690('0x17'),_0x2aeb0b['message']);_0x5d8ae4(_0x482f57[_0x3690('0x11')](0x1f4,_0x2aeb0b[_0x3690('0x14')]));});}else _0x4a231a(0x1);});});};function activateAdditionalPhone(_0x16d5f5,_0x4d5d01,_0x3bd33e,_0x53f084,_0x5aed0c){return new Promise(function(_0x767e89,_0x68b36b){var _0x160dd3;if(_[_0x3690('0x2d')](_0x3bd33e[_0x3690('0x2e')])){_0x3bd33e['scheduledat']=moment();}if(moment()>moment(_0x3bd33e[_0x3690('0x2e')])){_0x160dd3=moment()[_0x3690('0x2f')](_0x5aed0c||0x3,'minutes');}else{if(_0x3bd33e['OrderBy']==0x0){_0x160dd3=moment(_0x3bd33e[_0x3690('0x2e')]);}else{_0x160dd3=moment()[_0x3690('0x2f')](_0x5aed0c||0x3,'minutes');}}if(_['isNil'](_0x160dd3)){_0x160dd3=moment()[_0x3690('0x2f')](_0x5aed0c||0x3,_0x3690('0x30'));}var _0x56b493={'phone':_0x16d5f5['phone'],'active':0x0,'OrderBy':_[_0x3690('0x2d')](_0x16d5f5['OrderBy'])?0x0:_0x16d5f5['OrderBy'],'scheduledat':moment()[_0x3690('0x2f')](_0x53f084||0x1,_0x3690('0x30')),'countbusyretry':_0x4d5d01[_0x3690('0x21')],'countcongestionretry':_0x4d5d01['countcongestionretry'],'countnoanswerretry':_0x4d5d01['countnoanswerretry'],'countnosuchnumberretry':_0x4d5d01[_0x3690('0x26')],'countdropretry':_0x4d5d01[_0x3690('0x27')],'countabandonedretry':_0x4d5d01[_0x3690('0x28')],'countmachineretry':_0x4d5d01['countmachineretry'],'countagentrejectretry':_0x4d5d01[_0x3690('0x24')],'createdAt':_0x4d5d01[_0x3690('0x31')],'updatedAt':_0x4d5d01['updatedAt']};var _0x3d96de={'CmHopperId':_0x16d5f5['id'],'phone':_0x3bd33e[_0x3690('0x32')],'active':0x0,'OrderBy':_[_0x3690('0x2d')](_0x3bd33e['OrderBy'])?0x0:_0x3bd33e[_0x3690('0x20')],'scheduledat':_0x160dd3,'countbusyretry':_0x3bd33e[_0x3690('0x21')],'countcongestionretry':_0x3bd33e['countcongestionretry'],'countnoanswerretry':_0x3bd33e['countnoanswerretry'],'countnosuchnumberretry':_0x3bd33e[_0x3690('0x26')],'countdropretry':_0x3bd33e[_0x3690('0x27')],'countabandonedretry':_0x3bd33e['countabandonedretry'],'countmachineretry':_0x3bd33e[_0x3690('0x23')],'countagentrejectretry':_0x3bd33e[_0x3690('0x24')],'createdAt':_0x3bd33e[_0x3690('0x31')],'updatedAt':_0x3bd33e[_0x3690('0x33')]};return db[_0x3690('0x34')][_0x3690('0x35')](function(_0xb7fa9d){return db[_0x3690('0x1f')][_0x3690('0x36')](_0x56b493,{'where':{'id':_0x3bd33e['id']}},{'transaction':_0xb7fa9d})[_0x3690('0xd')](function(){return db[_0x3690('0x18')][_0x3690('0x36')](_0x3d96de,{'where':{'id':_0x16d5f5['id']}},{'transaction':_0xb7fa9d});});})[_0x3690('0xd')](function(_0x45d8f6){_0x767e89({'id':_0x16d5f5['id'],'phone':_0x3bd33e[_0x3690('0x32')]});})[_0x3690('0x16')](function(_0x624a0d){logger[_0x3690('0x11')](_0x3690('0x37'),_0x624a0d[_0x3690('0x14')]);_0x68b36b({'error':_0x624a0d[_0x3690('0x14')]});});});}exports[_0x3690('0x38')]=function(_0x308190){var _0x551504=this;return new Promise(function(_0x3f2d9d,_0x976d90){return db[_0x3690('0x18')][_0x3690('0x36')](_0x308190[_0x3690('0x1b')][_0x3690('0x39')],{'where':{'id':_0x308190[_0x3690('0x1b')]['id']}})[_0x3690('0xd')](function(_0x85c26b){_0x3f2d9d(_0x85c26b);})['catch'](function(_0x174282){logger[_0x3690('0x11')]('IncrementPreviewCounters',_0x174282[_0x3690('0x14')]);_0x976d90(_0x551504[_0x3690('0x11')](0x1f4,_0x174282[_0x3690('0x14')]));});});}; \ No newline at end of file +var _0xaada=['request','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','CmHopper','findOne','ContactId','body','ListId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countnoanswerretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','ASC','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http'];(function(_0x119850,_0x402589){var _0x1d4879=function(_0x2ef608){while(--_0x2ef608){_0x119850['push'](_0x119850['shift']());}};_0x1d4879(++_0x402589);}(_0xaada,0x1ce));var _0xaaad=function(_0x77b81e,_0x46e03c){_0x77b81e=_0x77b81e-0x0;var _0x1e9466=_0xaada[_0x77b81e];return _0x1e9466;};'use strict';var _=require(_0xaaad('0x0'));var util=require(_0xaaad('0x1'));var moment=require(_0xaaad('0x2'));var BPromise=require(_0xaaad('0x3'));var rs=require(_0xaaad('0x4'));var fs=require('fs');var Redis=require(_0xaaad('0x5'));var db=require(_0xaaad('0x6'))['db'];var utils=require(_0xaaad('0x7'));var logger=require('../../config/logger')(_0xaaad('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xaaad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59ffc6,_0x3a16a2,_0x5c9b75){return new BPromise(function(_0xac3600,_0x306797){return client[_0xaaad('0xa')](_0x59ffc6,_0x5c9b75)['then'](function(_0x2afc20){logger[_0xaaad('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3a16a2,_0xaaad('0xc'));logger[_0xaaad('0xd')](_0xaaad('0xe'),_0x3a16a2,_0xaaad('0xc'),JSON[_0xaaad('0xf')](_0x2afc20));if(_0x2afc20[_0xaaad('0x10')]){if(_0x2afc20[_0xaaad('0x10')][_0xaaad('0x11')]===0x1f4){logger['error'](_0xaaad('0x12'),_0x3a16a2,_0x2afc20[_0xaaad('0x10')][_0xaaad('0x13')]);return _0x306797(_0x2afc20[_0xaaad('0x10')][_0xaaad('0x13')]);}logger['error'](_0xaaad('0x12'),_0x3a16a2,_0x2afc20[_0xaaad('0x10')][_0xaaad('0x13')]);return _0xac3600(_0x2afc20[_0xaaad('0x10')][_0xaaad('0x13')]);}else{logger['info'](_0xaaad('0x12'),_0x3a16a2,_0xaaad('0xc'));_0xac3600(_0x2afc20[_0xaaad('0x14')][_0xaaad('0x13')]);}})[_0xaaad('0x15')](function(_0x35728a){logger[_0xaaad('0x10')](_0xaaad('0x12'),_0x3a16a2,_0x35728a);_0x306797(_0x35728a);});});}exports['VerifyAdditionalPhones']=function(_0x414e88){var _0x172311=this;return new Promise(function(_0x4c7bc5,_0x2b4ee0){return db[_0xaaad('0x16')][_0xaaad('0x17')]({'raw':!![],'where':{'ContactId':_0x414e88['body'][_0xaaad('0x18')],'ListId':_0x414e88[_0xaaad('0x19')][_0xaaad('0x1a')],'VoiceQueueId':_0x414e88[_0xaaad('0x19')]['VoiceQueueId']===undefined?null:_0x414e88[_0xaaad('0x19')]['VoiceQueueId'],'CampaignId':_0x414e88[_0xaaad('0x19')]['CampaignId']===undefined?null:_0x414e88[_0xaaad('0x19')][_0xaaad('0x1b')]}})[_0xaaad('0x1c')](function(_0x934ce8){if(_0x934ce8!=null){return db[_0xaaad('0x1d')][_0xaaad('0x17')]({'raw':!![],'where':{'CmHopperId':_0x934ce8['id'],'OrderBy':{'$gt':_0x934ce8[_0xaaad('0x1e')]}},'order':[[_0xaaad('0x1e'),'ASC']]})['then'](function(_0xc7bb7){var _0x177bad=0x0;if(_0xc7bb7){if(_0xc7bb7[_0xaaad('0x1f')]+_0xc7bb7[_0xaaad('0x20')]+_0xc7bb7['countnoanswerretry']+_0xc7bb7[_0xaaad('0x21')]+_0xc7bb7[_0xaaad('0x22')]+_0xc7bb7[_0xaaad('0x23')]+_0xc7bb7[_0xaaad('0x24')]+_0xc7bb7[_0xaaad('0x25')]<_0x414e88[_0xaaad('0x26')]['dialGlobalMaxRetry'])_0x177bad=0x1;_0x4c7bc5({'additional':_0x177bad});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x934ce8['id']},'order':[[_0xaaad('0x1e'),'ASC']]})[_0xaaad('0x1c')](function(_0x789381){var _0x6d1d66=0x0;if(_0x789381){if(_0x789381[_0xaaad('0x1f')]+_0x789381[_0xaaad('0x20')]+_0x789381[_0xaaad('0x27')]+_0x789381[_0xaaad('0x21')]+_0x789381[_0xaaad('0x22')]+_0x789381[_0xaaad('0x23')]+_0x789381[_0xaaad('0x24')]+_0x789381['countagentrejectretry']<_0x414e88['entity'][_0xaaad('0x28')])_0x6d1d66=0x1;_0x4c7bc5({'additional':_0x6d1d66});}else{_0x4c7bc5({'additional':0x0});}})[_0xaaad('0x15')](function(_0x4afd09){logger['error'](_0xaaad('0x29'),_0x4afd09[_0xaaad('0x13')]);_0x2b4ee0(_0x172311[_0xaaad('0x10')](0x1f4,_0x4afd09[_0xaaad('0x13')]));});}})[_0xaaad('0x15')](function(_0x22fff2){logger['error']('VerifyAdditionalPhones',_0x22fff2[_0xaaad('0x13')]);_0x2b4ee0(_0x172311[_0xaaad('0x10')](0x1f4,_0x22fff2['message']));});}else _0x4c7bc5({'additional':0x0});});});};exports[_0xaaad('0x2a')]=function(_0x8fb429){var _0x38bd24=this;return new Promise(function(_0x369b2a,_0x2e1f45){return db[_0xaaad('0x16')][_0xaaad('0x17')]({'raw':!![],'where':{'ContactId':_0x8fb429[_0xaaad('0x19')][_0xaaad('0x18')],'ListId':_0x8fb429[_0xaaad('0x19')]['ListId'],'VoiceQueueId':_0x8fb429[_0xaaad('0x19')]['VoiceQueueId']===undefined?null:_0x8fb429[_0xaaad('0x19')]['VoiceQueueId'],'CampaignId':_0x8fb429[_0xaaad('0x19')]['CampaignId']===undefined?null:_0x8fb429['body'][_0xaaad('0x1b')]}})[_0xaaad('0x1c')](function(_0x1ac03a){if(_0x1ac03a!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1ac03a['id'],'OrderBy':{'$gte':_0x1ac03a[_0xaaad('0x1e')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x4b0a35){if(_0x4b0a35)return activateAdditionalPhone(_0x1ac03a,_0x8fb429['body'],_0x4b0a35,_0x8fb429[_0xaaad('0x2b')],_0x8fb429[_0xaaad('0x2c')])[_0xaaad('0x1c')](function(_0x4d1b21){_0x369b2a(_0x4d1b21);});else{return db[_0xaaad('0x1d')][_0xaaad('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1ac03a['id']},'order':[[_0xaaad('0x1e'),_0xaaad('0x2d')]]})['then'](function(_0x57f963){if(_0x57f963)return activateAdditionalPhone(_0x1ac03a,_0x8fb429[_0xaaad('0x19')],_0x57f963,_0x8fb429[_0xaaad('0x2b')],_0x8fb429['waitTime'])[_0xaaad('0x1c')](function(_0x25bb86){_0x369b2a(_0x25bb86);});else{_0x369b2a({'id':_0x1ac03a['id'],'phone':''});}})['catch'](function(_0x20bf58){logger[_0xaaad('0x10')](_0xaaad('0x29'),_0x20bf58['message']);_0x2e1f45(_0x38bd24[_0xaaad('0x10')](0x1f4,_0x20bf58['message']));});}})[_0xaaad('0x15')](function(_0xd9f118){logger[_0xaaad('0x10')](_0xaaad('0x29'),_0xd9f118['message']);_0x2e1f45(_0x38bd24[_0xaaad('0x10')](0x1f4,_0xd9f118[_0xaaad('0x13')]));});}else _0x369b2a(0x1);});});};function activateAdditionalPhone(_0x55f63d,_0x2ccb7f,_0x4d6972,_0x561523,_0x5a1736){return new Promise(function(_0x2404f6,_0x549b79){var _0x477ba5;if(_[_0xaaad('0x2e')](_0x4d6972[_0xaaad('0x2f')])){_0x4d6972[_0xaaad('0x2f')]=moment();}if(moment()>moment(_0x4d6972[_0xaaad('0x2f')])){_0x477ba5=moment()[_0xaaad('0x30')](_0x5a1736||0x3,_0xaaad('0x31'));}else{if(_0x4d6972[_0xaaad('0x1e')]==0x0){_0x477ba5=moment(_0x4d6972[_0xaaad('0x2f')]);}else{_0x477ba5=moment()[_0xaaad('0x30')](_0x5a1736||0x3,'minutes');}}if(_[_0xaaad('0x2e')](_0x477ba5)){_0x477ba5=moment()['add'](_0x5a1736||0x3,_0xaaad('0x31'));}var _0x5e4336={'phone':_0x55f63d[_0xaaad('0x32')],'active':0x0,'OrderBy':_[_0xaaad('0x2e')](_0x55f63d['OrderBy'])?0x0:_0x55f63d[_0xaaad('0x1e')],'scheduledat':moment()[_0xaaad('0x30')](_0x561523||0x1,_0xaaad('0x31')),'countbusyretry':_0x2ccb7f[_0xaaad('0x1f')],'countcongestionretry':_0x2ccb7f[_0xaaad('0x20')],'countnoanswerretry':_0x2ccb7f['countnoanswerretry'],'countnosuchnumberretry':_0x2ccb7f[_0xaaad('0x21')],'countdropretry':_0x2ccb7f['countdropretry'],'countabandonedretry':_0x2ccb7f[_0xaaad('0x23')],'countmachineretry':_0x2ccb7f[_0xaaad('0x24')],'countagentrejectretry':_0x2ccb7f['countagentrejectretry'],'createdAt':_0x2ccb7f[_0xaaad('0x33')],'updatedAt':_0x2ccb7f[_0xaaad('0x34')]};var _0x4d57a9={'CmHopperId':_0x55f63d['id'],'phone':_0x4d6972['phone'],'active':0x0,'OrderBy':_['isNil'](_0x4d6972['OrderBy'])?0x0:_0x4d6972[_0xaaad('0x1e')],'scheduledat':_0x477ba5,'countbusyretry':_0x4d6972[_0xaaad('0x1f')],'countcongestionretry':_0x4d6972[_0xaaad('0x20')],'countnoanswerretry':_0x4d6972[_0xaaad('0x27')],'countnosuchnumberretry':_0x4d6972[_0xaaad('0x21')],'countdropretry':_0x4d6972[_0xaaad('0x22')],'countabandonedretry':_0x4d6972['countabandonedretry'],'countmachineretry':_0x4d6972[_0xaaad('0x24')],'countagentrejectretry':_0x4d6972[_0xaaad('0x25')],'createdAt':_0x4d6972[_0xaaad('0x33')],'updatedAt':_0x4d6972[_0xaaad('0x34')]};return db[_0xaaad('0x35')][_0xaaad('0x36')](function(_0x52be58){return db['CmHopperAdditionalPhone']['update'](_0x5e4336,{'where':{'id':_0x4d6972['id']}},{'transaction':_0x52be58})['then'](function(){return db[_0xaaad('0x16')][_0xaaad('0x37')](_0x4d57a9,{'where':{'id':_0x55f63d['id']}},{'transaction':_0x52be58});});})['then'](function(_0x383ec0){_0x2404f6({'id':_0x55f63d['id'],'phone':_0x4d6972['phone']});})[_0xaaad('0x15')](function(_0x2edfaa){logger[_0xaaad('0x10')](_0xaaad('0x38'),_0x2edfaa['message']);_0x549b79({'error':_0x2edfaa[_0xaaad('0x13')]});});});}exports['IncrementPreviewCounters']=function(_0x2638b3){var _0x5d6121=this;return new Promise(function(_0x31b9e3,_0x41f3a6){return db[_0xaaad('0x16')][_0xaaad('0x37')](_0x2638b3[_0xaaad('0x19')][_0xaaad('0x39')],{'where':{'id':_0x2638b3[_0xaaad('0x19')]['id']}})[_0xaaad('0x1c')](function(_0x1b0123){_0x31b9e3(_0x1b0123);})[_0xaaad('0x15')](function(_0x7e8374){logger[_0xaaad('0x10')](_0xaaad('0x3a'),_0x7e8374[_0xaaad('0x13')]);_0x41f3a6(_0x5d6121['error'](0x1f4,_0x7e8374[_0xaaad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 5fb7e65..7b203c5 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 _0xe126=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x2076ff,_0x2e8ae3){var _0x322c9b=function(_0x2b2d97){while(--_0x2b2d97){_0x2076ff['push'](_0x2076ff['shift']());}};_0x322c9b(++_0x2e8ae3);}(_0xe126,0xeb));var _0x6e12=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe126[_0x1da527];return _0x40fc7c;};'use strict';var multer=require(_0x6e12('0x0'));var util=require(_0x6e12('0x1'));var path=require('path');var timeout=require(_0x6e12('0x2'));var express=require(_0x6e12('0x3'));var router=express[_0x6e12('0x4')]();var fs_extra=require(_0x6e12('0x5'));var auth=require(_0x6e12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e12('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x6e12('0x8')]('/',auth[_0x6e12('0x9')](),controller['index']);router[_0x6e12('0x8')](_0x6e12('0xa'),auth[_0x6e12('0x9')](),controller[_0x6e12('0xb')]);router[_0x6e12('0xc')]('/',auth[_0x6e12('0x9')](),controller[_0x6e12('0xd')]);router['put']('/:id',auth[_0x6e12('0x9')](),controller[_0x6e12('0xe')]);router['delete'](_0x6e12('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e12('0xf')]=router; \ No newline at end of file +var _0xc23d=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','post'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc23d,0x7f));var _0xdc23=function(_0x4d95db,_0x28b7e9){_0x4d95db=_0x4d95db-0x0;var _0x1cc484=_0xc23d[_0x4d95db];return _0x1cc484;};'use strict';var multer=require(_0xdc23('0x0'));var util=require(_0xdc23('0x1'));var path=require(_0xdc23('0x2'));var timeout=require(_0xdc23('0x3'));var express=require(_0xdc23('0x4'));var router=express[_0xdc23('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdc23('0x6'));var interaction=require(_0xdc23('0x7'));var config=require(_0xdc23('0x8'));var controller=require(_0xdc23('0x9'));router[_0xdc23('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc23('0xa')]('/:id',auth[_0xdc23('0xb')](),controller['show']);router[_0xdc23('0xc')]('/',auth[_0xdc23('0xb')](),controller[_0xdc23('0xd')]);router[_0xdc23('0xe')](_0xdc23('0xf'),auth['isAuthenticated'](),controller[_0xdc23('0x10')]);router[_0xdc23('0x11')](_0xdc23('0xf'),auth[_0xdc23('0xb')](),controller[_0xdc23('0x12')]);module[_0xdc23('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 22cdfc0..e3f8d64 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 _0x1d3c=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x274262,_0x5da9fb){var _0x283be5=function(_0xc3ae9){while(--_0xc3ae9){_0x274262['push'](_0x274262['shift']());}};_0x283be5(++_0x5da9fb);}(_0x1d3c,0x6f));var _0xc1d3=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x1d3c[_0x5db313];return _0x36d503;};'use strict';var moment=require(_0xc1d3('0x0'));var Sequelize=require(_0xc1d3('0x1'));module[_0xc1d3('0x2')]={'phone':{'type':Sequelize[_0xc1d3('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc1d3('0x4')],'unique':_0xc1d3('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xc1d3('0x4')],'unique':_0xc1d3('0x5')}}; \ No newline at end of file +var _0xcbe7=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x24d792,_0x390b19){var _0x1e8994=function(_0xf0132e){while(--_0xf0132e){_0x24d792['push'](_0x24d792['shift']());}};_0x1e8994(++_0x390b19);}(_0xcbe7,0x152));var _0x7cbe=function(_0x3fa897,_0x1da072){_0x3fa897=_0x3fa897-0x0;var _0x46d6e7=_0xcbe7[_0x3fa897];return _0x46d6e7;};'use strict';var moment=require('moment');var Sequelize=require(_0x7cbe('0x0'));module[_0x7cbe('0x1')]={'phone':{'type':Sequelize[_0x7cbe('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7cbe('0x3')],'unique':_0x7cbe('0x4')},'ListId':{'type':Sequelize[_0x7cbe('0x3')],'unique':_0x7cbe('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x7cbe('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6099089..07f7b36 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 _0xd58b=['zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','send','index','type','key','model','map','name','query','attributes','intersection','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','CmHopperBlack','include','findAll','rows','show','params','keys','rawAttributes','fields','find','body','catch','describe','rimraf'];(function(_0x2eaee7,_0x157285){var _0x127264=function(_0x257b43){while(--_0x257b43){_0x2eaee7['push'](_0x2eaee7['shift']());}};_0x127264(++_0x157285);}(_0xd58b,0x8b));var _0xbd58=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xd58b[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd58('0x0'));var zipdir=require(_0xbd58('0x1'));var jsonpatch=require(_0xbd58('0x2'));var rp=require('request-promise');var moment=require(_0xbd58('0x3'));var BPromise=require(_0xbd58('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbd58('0x5'));var sox=require(_0xbd58('0x6'));var csv=require(_0xbd58('0x7'));var ejs=require(_0xbd58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd58('0x9'));var squel=require(_0xbd58('0xa'));var crypto=require(_0xbd58('0xb'));var jsforce=require(_0xbd58('0xc'));var deskjs=require(_0xbd58('0xd'));var toCsv=require(_0xbd58('0x7'));var querystring=require(_0xbd58('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd58('0xf'));var as=require(_0xbd58('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd58('0x11'))(_0xbd58('0x12'));var utils=require('../../config/utils');var config=require(_0xbd58('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd58('0x14'))['db'];function respondWithStatusCode(_0x123733,_0x320217){_0x320217=_0x320217||0xcc;return function(_0x31ee4c){if(_0x31ee4c){return _0x123733[_0xbd58('0x15')](_0x320217);}return _0x123733[_0xbd58('0x16')](_0x320217)[_0xbd58('0x17')]();};}function respondWithResult(_0x416323,_0x39069c){_0x39069c=_0x39069c||0xc8;return function(_0x4b9ab1){if(_0x4b9ab1){return _0x416323[_0xbd58('0x16')](_0x39069c)['json'](_0x4b9ab1);}};}function respondWithFilteredResult(_0x454e22,_0x64a85a){return function(_0x57c6f3){if(_0x57c6f3){var _0x2f1f17=typeof _0x64a85a[_0xbd58('0x18')]===_0xbd58('0x19')&&typeof _0x64a85a[_0xbd58('0x1a')]==='undefined';var _0x27c2f7=_0x57c6f3['count'];var _0xe736c5=_0x2f1f17?0x0:_0x64a85a[_0xbd58('0x18')];var _0x4e5b26=_0x2f1f17?_0x57c6f3[_0xbd58('0x1b')]:_0x64a85a['offset']+_0x64a85a[_0xbd58('0x1a')];var _0x5c720f;if(_0x4e5b26>=_0x27c2f7){_0x4e5b26=_0x27c2f7;_0x5c720f=0xc8;}else{_0x5c720f=0xce;}_0x454e22[_0xbd58('0x16')](_0x5c720f);return _0x454e22[_0xbd58('0x1c')](_0xbd58('0x1d'),_0xe736c5+'-'+_0x4e5b26+'/'+_0x27c2f7)[_0xbd58('0x1e')](_0x57c6f3);}return null;};}function patchUpdates(_0x30dc30){return function(_0x68a5df){try{jsonpatch['apply'](_0x68a5df,_0x30dc30,!![]);}catch(_0x3edc82){return BPromise[_0xbd58('0x1f')](_0x3edc82);}return _0x68a5df[_0xbd58('0x20')]();};}function saveUpdates(_0x430a52,_0x51617c){return function(_0x1262e1){if(_0x1262e1){return _0x1262e1[_0xbd58('0x21')](_0x430a52)[_0xbd58('0x22')](function(_0x3c5078){return _0x3c5078;});}return null;};}function removeEntity(_0xc8d82e,_0x2ca3fe){return function(_0x463038){if(_0x463038){return _0x463038[_0xbd58('0x23')]()[_0xbd58('0x22')](function(){_0xc8d82e[_0xbd58('0x16')](0xcc)[_0xbd58('0x17')]();});}};}function handleEntityNotFound(_0x29c8f7,_0x42d41b){return function(_0x5912ab){if(!_0x5912ab){_0x29c8f7[_0xbd58('0x15')](0x194);}return _0x5912ab;};}function handleError(_0x337e6,_0x31cef7){_0x31cef7=_0x31cef7||0x1f4;return function(_0x23315e){logger[_0xbd58('0x24')](_0x23315e['stack']);if(_0x23315e['name']){delete _0x23315e['name'];}_0x337e6['status'](_0x31cef7)[_0xbd58('0x25')](_0x23315e);};}exports[_0xbd58('0x26')]=function(_0x139ac5,_0xd6298){var _0x5b080e={},_0x1d380a={},_0x108e09={'count':0x0,'rows':[]};var _0x1c9d9a=_['map'](db['CmHopperBlack']['rawAttributes'],function(_0x31874b){return{'name':_0x31874b['fieldName'],'type':_0x31874b[_0xbd58('0x27')][_0xbd58('0x28')]};});_0x1d380a[_0xbd58('0x29')]=_[_0xbd58('0x2a')](_0x1c9d9a,_0xbd58('0x2b'));_0x1d380a['query']=_['keys'](_0x139ac5[_0xbd58('0x2c')]);_0x1d380a['filters']=_['intersection'](_0x1d380a[_0xbd58('0x29')],_0x1d380a[_0xbd58('0x2c')]);_0x5b080e[_0xbd58('0x2d')]=_[_0xbd58('0x2e')](_0x1d380a[_0xbd58('0x29')],qs['fields'](_0x139ac5[_0xbd58('0x2c')]['fields']));_0x5b080e[_0xbd58('0x2d')]=_0x5b080e[_0xbd58('0x2d')][_0xbd58('0x2f')]?_0x5b080e[_0xbd58('0x2d')]:_0x1d380a[_0xbd58('0x29')];if(!_0x139ac5[_0xbd58('0x2c')][_0xbd58('0x30')]('nolimit')){_0x5b080e[_0xbd58('0x1a')]=qs['limit'](_0x139ac5[_0xbd58('0x2c')]['limit']);_0x5b080e[_0xbd58('0x18')]=qs[_0xbd58('0x18')](_0x139ac5['query']['offset']);}_0x5b080e[_0xbd58('0x31')]=qs[_0xbd58('0x32')](_0x139ac5[_0xbd58('0x2c')]['sort']);_0x5b080e['where']=qs[_0xbd58('0x33')](_[_0xbd58('0x34')](_0x139ac5['query'],_0x1d380a['filters']),_0x1c9d9a);if(_0x139ac5[_0xbd58('0x2c')][_0xbd58('0x35')]){_0x5b080e[_0xbd58('0x36')]=_[_0xbd58('0x37')](_0x5b080e[_0xbd58('0x36')],{'$or':_[_0xbd58('0x2a')](_0x1c9d9a,function(_0x540478){if(_0x540478[_0xbd58('0x27')]!=='VIRTUAL'){var _0x1cacbb={};_0x1cacbb[_0x540478[_0xbd58('0x2b')]]={'$like':'%'+_0x139ac5[_0xbd58('0x2c')][_0xbd58('0x35')]+'%'};return _0x1cacbb;}})});}_0x5b080e=_[_0xbd58('0x37')]({},_0x5b080e,_0x139ac5[_0xbd58('0x38')]);var _0x4d6d00={'where':_0x5b080e[_0xbd58('0x36')]};return db[_0xbd58('0x39')][_0xbd58('0x1b')](_0x4d6d00)[_0xbd58('0x22')](function(_0x302124){_0x108e09['count']=_0x302124;if(_0x139ac5['query']['includeAll']){_0x5b080e[_0xbd58('0x3a')]=[{'all':!![]}];}return db[_0xbd58('0x39')][_0xbd58('0x3b')](_0x5b080e);})[_0xbd58('0x22')](function(_0x543c88){_0x108e09[_0xbd58('0x3c')]=_0x543c88;return _0x108e09;})[_0xbd58('0x22')](respondWithFilteredResult(_0xd6298,_0x5b080e))['catch'](handleError(_0xd6298,null));};exports[_0xbd58('0x3d')]=function(_0x481d40,_0x4ab46c){var _0x5238e8={'raw':!![],'where':{'id':_0x481d40[_0xbd58('0x3e')]['id']}},_0x67cf42={};_0x67cf42[_0xbd58('0x29')]=_[_0xbd58('0x3f')](db[_0xbd58('0x39')][_0xbd58('0x40')]);_0x67cf42[_0xbd58('0x2c')]=_[_0xbd58('0x3f')](_0x481d40['query']);_0x67cf42[_0xbd58('0x33')]=_[_0xbd58('0x2e')](_0x67cf42[_0xbd58('0x29')],_0x67cf42[_0xbd58('0x2c')]);_0x5238e8[_0xbd58('0x2d')]=_['intersection'](_0x67cf42[_0xbd58('0x29')],qs[_0xbd58('0x41')](_0x481d40[_0xbd58('0x2c')]['fields']));_0x5238e8[_0xbd58('0x2d')]=_0x5238e8[_0xbd58('0x2d')][_0xbd58('0x2f')]?_0x5238e8[_0xbd58('0x2d')]:_0x67cf42['model'];if(_0x481d40['query']['includeAll']){_0x5238e8[_0xbd58('0x3a')]=[{'all':!![]}];}_0x5238e8=_[_0xbd58('0x37')]({},_0x5238e8,_0x481d40[_0xbd58('0x38')]);return db[_0xbd58('0x39')][_0xbd58('0x42')](_0x5238e8)[_0xbd58('0x22')](handleEntityNotFound(_0x4ab46c,null))['then'](respondWithResult(_0x4ab46c,null))['catch'](handleError(_0x4ab46c,null));};exports['update']=function(_0x28b68b,_0x3ff5ad){if(_0x28b68b[_0xbd58('0x43')]['id']){delete _0x28b68b[_0xbd58('0x43')]['id'];}return db[_0xbd58('0x39')][_0xbd58('0x42')]({'where':{'id':_0x28b68b[_0xbd58('0x3e')]['id']}})[_0xbd58('0x22')](handleEntityNotFound(_0x3ff5ad,null))[_0xbd58('0x22')](saveUpdates(_0x28b68b[_0xbd58('0x43')],null))[_0xbd58('0x22')](respondWithResult(_0x3ff5ad,null))['catch'](handleError(_0x3ff5ad,null));};exports[_0xbd58('0x23')]=function(_0x1e63d7,_0x158c7c){return db[_0xbd58('0x39')][_0xbd58('0x42')]({'where':{'id':_0x1e63d7['params']['id']}})[_0xbd58('0x22')](handleEntityNotFound(_0x158c7c,null))[_0xbd58('0x22')](removeEntity(_0x158c7c,null))[_0xbd58('0x44')](handleError(_0x158c7c,null));};exports[_0xbd58('0x45')]=function(_0xfc9883,_0x5c7ac6){return db[_0xbd58('0x39')][_0xbd58('0x45')]()[_0xbd58('0x22')](respondWithResult(_0x5c7ac6,null))['catch'](handleError(_0x5c7ac6,null));}; \ No newline at end of file +var _0xa7c8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','show','keys','find','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa7c8,0x82));var _0x8a7c=function(_0x510fa3,_0x2d06cc){_0x510fa3=_0x510fa3-0x0;var _0x12b7f8=_0xa7c8[_0x510fa3];return _0x12b7f8;};'use strict';var emlformat=require(_0x8a7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a7c('0x1'));var jsonpatch=require(_0x8a7c('0x2'));var rp=require(_0x8a7c('0x3'));var moment=require('moment');var BPromise=require(_0x8a7c('0x4'));var Mustache=require('mustache');var util=require(_0x8a7c('0x5'));var path=require(_0x8a7c('0x6'));var sox=require(_0x8a7c('0x7'));var csv=require(_0x8a7c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a7c('0x9'));var _=require('lodash');var squel=require(_0x8a7c('0xa'));var crypto=require(_0x8a7c('0xb'));var jsforce=require(_0x8a7c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a7c('0xd'));var Papa=require(_0x8a7c('0xe'));var Redis=require(_0x8a7c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8a7c('0x10'));var hardwareService=require(_0x8a7c('0x11'));var logger=require(_0x8a7c('0x12'))(_0x8a7c('0x13'));var utils=require(_0x8a7c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8a7c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa89e8e,_0x25aea2){_0x25aea2=_0x25aea2||0xcc;return function(_0x7b2382){if(_0x7b2382){return _0xa89e8e[_0x8a7c('0x16')](_0x25aea2);}return _0xa89e8e[_0x8a7c('0x17')](_0x25aea2)[_0x8a7c('0x18')]();};}function respondWithResult(_0x682348,_0x1de2e3){_0x1de2e3=_0x1de2e3||0xc8;return function(_0xca119a){if(_0xca119a){return _0x682348[_0x8a7c('0x17')](_0x1de2e3)[_0x8a7c('0x19')](_0xca119a);}};}function respondWithFilteredResult(_0x218e02,_0xe5c029){return function(_0x3ad57b){if(_0x3ad57b){var _0x509eb5=typeof _0xe5c029[_0x8a7c('0x1a')]===_0x8a7c('0x1b')&&typeof _0xe5c029['limit']===_0x8a7c('0x1b');var _0xcb241b=_0x3ad57b[_0x8a7c('0x1c')];var _0x2615ec=_0x509eb5?0x0:_0xe5c029['offset'];var _0x61dd44=_0x509eb5?_0x3ad57b[_0x8a7c('0x1c')]:_0xe5c029['offset']+_0xe5c029[_0x8a7c('0x1d')];var _0x216f44;if(_0x61dd44>=_0xcb241b){_0x61dd44=_0xcb241b;_0x216f44=0xc8;}else{_0x216f44=0xce;}_0x218e02[_0x8a7c('0x17')](_0x216f44);return _0x218e02[_0x8a7c('0x1e')](_0x8a7c('0x1f'),_0x2615ec+'-'+_0x61dd44+'/'+_0xcb241b)[_0x8a7c('0x19')](_0x3ad57b);}return null;};}function patchUpdates(_0xddcfc5){return function(_0x57170f){try{jsonpatch[_0x8a7c('0x20')](_0x57170f,_0xddcfc5,!![]);}catch(_0x1408f5){return BPromise['reject'](_0x1408f5);}return _0x57170f['save']();};}function saveUpdates(_0xc39305,_0x377d52){return function(_0x1cafeb){if(_0x1cafeb){return _0x1cafeb[_0x8a7c('0x21')](_0xc39305)[_0x8a7c('0x22')](function(_0x4b6009){return _0x4b6009;});}return null;};}function removeEntity(_0x4234ad,_0x70efdc){return function(_0x21ab6b){if(_0x21ab6b){return _0x21ab6b[_0x8a7c('0x23')]()['then'](function(){_0x4234ad[_0x8a7c('0x17')](0xcc)[_0x8a7c('0x18')]();});}};}function handleEntityNotFound(_0x1d1c6b,_0x4443c4){return function(_0x4ef459){if(!_0x4ef459){_0x1d1c6b[_0x8a7c('0x16')](0x194);}return _0x4ef459;};}function handleError(_0x2c061d,_0x3384c6){_0x3384c6=_0x3384c6||0x1f4;return function(_0x21f8d8){logger[_0x8a7c('0x24')](_0x21f8d8['stack']);if(_0x21f8d8[_0x8a7c('0x25')]){delete _0x21f8d8['name'];}_0x2c061d['status'](_0x3384c6)[_0x8a7c('0x26')](_0x21f8d8);};}exports[_0x8a7c('0x27')]=function(_0x2e0e07,_0x35acdd){var _0x5d1cb0={},_0x398305={},_0x4ba87c={'count':0x0,'rows':[]};var _0x2eccd3=_[_0x8a7c('0x28')](db[_0x8a7c('0x29')]['rawAttributes'],function(_0x5001ea){return{'name':_0x5001ea[_0x8a7c('0x2a')],'type':_0x5001ea[_0x8a7c('0x2b')][_0x8a7c('0x2c')]};});_0x398305[_0x8a7c('0x2d')]=_[_0x8a7c('0x28')](_0x2eccd3,_0x8a7c('0x25'));_0x398305[_0x8a7c('0x2e')]=_['keys'](_0x2e0e07[_0x8a7c('0x2e')]);_0x398305[_0x8a7c('0x2f')]=_[_0x8a7c('0x30')](_0x398305[_0x8a7c('0x2d')],_0x398305[_0x8a7c('0x2e')]);_0x5d1cb0[_0x8a7c('0x31')]=_[_0x8a7c('0x30')](_0x398305[_0x8a7c('0x2d')],qs[_0x8a7c('0x32')](_0x2e0e07[_0x8a7c('0x2e')][_0x8a7c('0x32')]));_0x5d1cb0[_0x8a7c('0x31')]=_0x5d1cb0[_0x8a7c('0x31')][_0x8a7c('0x33')]?_0x5d1cb0[_0x8a7c('0x31')]:_0x398305[_0x8a7c('0x2d')];if(!_0x2e0e07[_0x8a7c('0x2e')][_0x8a7c('0x34')]('nolimit')){_0x5d1cb0[_0x8a7c('0x1d')]=qs['limit'](_0x2e0e07[_0x8a7c('0x2e')][_0x8a7c('0x1d')]);_0x5d1cb0[_0x8a7c('0x1a')]=qs[_0x8a7c('0x1a')](_0x2e0e07[_0x8a7c('0x2e')]['offset']);}_0x5d1cb0[_0x8a7c('0x35')]=qs[_0x8a7c('0x36')](_0x2e0e07[_0x8a7c('0x2e')][_0x8a7c('0x36')]);_0x5d1cb0[_0x8a7c('0x37')]=qs['filters'](_[_0x8a7c('0x38')](_0x2e0e07[_0x8a7c('0x2e')],_0x398305[_0x8a7c('0x2f')]),_0x2eccd3);if(_0x2e0e07[_0x8a7c('0x2e')][_0x8a7c('0x39')]){_0x5d1cb0[_0x8a7c('0x37')]=_['merge'](_0x5d1cb0[_0x8a7c('0x37')],{'$or':_[_0x8a7c('0x28')](_0x2eccd3,function(_0x7c317a){if(_0x7c317a['type']!==_0x8a7c('0x3a')){var _0x3e904e={};_0x3e904e[_0x7c317a[_0x8a7c('0x25')]]={'$like':'%'+_0x2e0e07[_0x8a7c('0x2e')][_0x8a7c('0x39')]+'%'};return _0x3e904e;}})});}_0x5d1cb0=_['merge']({},_0x5d1cb0,_0x2e0e07['options']);var _0x2708c9={'where':_0x5d1cb0[_0x8a7c('0x37')]};return db[_0x8a7c('0x29')]['count'](_0x2708c9)[_0x8a7c('0x22')](function(_0x4e53aa){_0x4ba87c['count']=_0x4e53aa;if(_0x2e0e07['query'][_0x8a7c('0x3b')]){_0x5d1cb0[_0x8a7c('0x3c')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x5d1cb0);})[_0x8a7c('0x22')](function(_0x464295){_0x4ba87c[_0x8a7c('0x3d')]=_0x464295;return _0x4ba87c;})['then'](respondWithFilteredResult(_0x35acdd,_0x5d1cb0))['catch'](handleError(_0x35acdd,null));};exports[_0x8a7c('0x3e')]=function(_0x4f4ae3,_0x1d28c3){var _0x339c8c={'raw':!![],'where':{'id':_0x4f4ae3['params']['id']}},_0xdc108d={};_0xdc108d[_0x8a7c('0x2d')]=_[_0x8a7c('0x3f')](db[_0x8a7c('0x29')]['rawAttributes']);_0xdc108d[_0x8a7c('0x2e')]=_[_0x8a7c('0x3f')](_0x4f4ae3['query']);_0xdc108d[_0x8a7c('0x2f')]=_['intersection'](_0xdc108d['model'],_0xdc108d[_0x8a7c('0x2e')]);_0x339c8c[_0x8a7c('0x31')]=_[_0x8a7c('0x30')](_0xdc108d['model'],qs[_0x8a7c('0x32')](_0x4f4ae3['query'][_0x8a7c('0x32')]));_0x339c8c[_0x8a7c('0x31')]=_0x339c8c['attributes'][_0x8a7c('0x33')]?_0x339c8c[_0x8a7c('0x31')]:_0xdc108d[_0x8a7c('0x2d')];if(_0x4f4ae3[_0x8a7c('0x2e')][_0x8a7c('0x3b')]){_0x339c8c[_0x8a7c('0x3c')]=[{'all':!![]}];}_0x339c8c=_['merge']({},_0x339c8c,_0x4f4ae3['options']);return db[_0x8a7c('0x29')][_0x8a7c('0x40')](_0x339c8c)['then'](handleEntityNotFound(_0x1d28c3,null))[_0x8a7c('0x22')](respondWithResult(_0x1d28c3,null))['catch'](handleError(_0x1d28c3,null));};exports[_0x8a7c('0x21')]=function(_0xdea6bb,_0x7742bd){if(_0xdea6bb['body']['id']){delete _0xdea6bb[_0x8a7c('0x41')]['id'];}return db[_0x8a7c('0x29')][_0x8a7c('0x40')]({'where':{'id':_0xdea6bb['params']['id']}})[_0x8a7c('0x22')](handleEntityNotFound(_0x7742bd,null))[_0x8a7c('0x22')](saveUpdates(_0xdea6bb['body'],null))[_0x8a7c('0x22')](respondWithResult(_0x7742bd,null))[_0x8a7c('0x42')](handleError(_0x7742bd,null));};exports[_0x8a7c('0x23')]=function(_0x20ee56,_0x15b5ec){return db[_0x8a7c('0x29')][_0x8a7c('0x40')]({'where':{'id':_0x20ee56[_0x8a7c('0x43')]['id']}})[_0x8a7c('0x22')](handleEntityNotFound(_0x15b5ec,null))[_0x8a7c('0x22')](removeEntity(_0x15b5ec,null))['catch'](handleError(_0x15b5ec,null));};exports['describe']=function(_0x2779e4,_0x32aa06){return db[_0x8a7c('0x29')]['describe']()['then'](respondWithResult(_0x32aa06,null))[_0x8a7c('0x42')](handleError(_0x32aa06,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b2a8e86..c2499c9 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 _0x490f=['CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define'];(function(_0x5f3902,_0x462d8e){var _0x3b3dd2=function(_0x4818a5){while(--_0x4818a5){_0x5f3902['push'](_0x5f3902['shift']());}};_0x3b3dd2(++_0x462d8e);}(_0x490f,0x154));var _0xf490=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x490f[_0x2d486b];return _0x4291d1;};'use strict';var _=require('lodash');var util=require(_0xf490('0x0'));var logger=require(_0xf490('0x1'))(_0xf490('0x2'));var moment=require(_0xf490('0x3'));var BPromise=require('bluebird');var rp=require(_0xf490('0x4'));var fs=require('fs');var path=require(_0xf490('0x5'));var rimraf=require(_0xf490('0x6'));var config=require(_0xf490('0x7'));var attributes=require(_0xf490('0x8'));module[_0xf490('0x9')]=function(_0x532e71,_0x4f8fd6){return _0x532e71[_0xf490('0xa')](_0xf490('0xb'),attributes,{'tableName':_0xf490('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9395=['request-promise','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','api','moment','bluebird'];(function(_0x46ca06,_0x3a3765){var _0x4b2f67=function(_0x1d7d9e){while(--_0x1d7d9e){_0x46ca06['push'](_0x46ca06['shift']());}};_0x4b2f67(++_0x3a3765);}(_0x9395,0xb0));var _0x5939=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9395[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5939('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5939('0x1'));var moment=require(_0x5939('0x2'));var BPromise=require(_0x5939('0x3'));var rp=require(_0x5939('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5939('0x5'));var attributes=require(_0x5939('0x6'));module[_0x5939('0x7')]=function(_0x58ffd9,_0x48a3e1){return _0x58ffd9[_0x5939('0x8')]('CmHopperBlack',attributes,{'tableName':_0x5939('0x9'),'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 adc24c4..06b5ee9 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 _0x4717=['GetCmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperBlack','options','raw','where','attributes','limit','include','map','model'];(function(_0x421613,_0x4cd335){var _0x3a24a8=function(_0x44e411){while(--_0x44e411){_0x421613['push'](_0x421613['shift']());}};_0x3a24a8(++_0x4cd335);}(_0x4717,0x182));var _0x7471=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x4717[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0x7471('0x0'));var moment=require(_0x7471('0x1'));var BPromise=require(_0x7471('0x2'));var rs=require(_0x7471('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7471('0x4'))['db'];var utils=require(_0x7471('0x5'));var logger=require(_0x7471('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7471('0x7'));var client=jayson[_0x7471('0x8')][_0x7471('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf27439,_0x57b81c,_0x470185){return new BPromise(function(_0x169b00,_0x1857db){return client[_0x7471('0xa')](_0xf27439,_0x470185)[_0x7471('0xb')](function(_0x4701c7){logger[_0x7471('0xc')](_0x7471('0xd'),_0x57b81c,_0x7471('0xe'));logger[_0x7471('0xf')](_0x7471('0x10'),_0x57b81c,_0x7471('0xe'),JSON[_0x7471('0x11')](_0x4701c7));if(_0x4701c7[_0x7471('0x12')]){if(_0x4701c7[_0x7471('0x12')][_0x7471('0x13')]===0x1f4){logger[_0x7471('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x57b81c,_0x4701c7[_0x7471('0x12')][_0x7471('0x14')]);return _0x1857db(_0x4701c7['error'][_0x7471('0x14')]);}logger[_0x7471('0x12')](_0x7471('0xd'),_0x57b81c,_0x4701c7[_0x7471('0x12')][_0x7471('0x14')]);return _0x169b00(_0x4701c7[_0x7471('0x12')][_0x7471('0x14')]);}else{logger[_0x7471('0xc')](_0x7471('0xd'),_0x57b81c,_0x7471('0xe'));_0x169b00(_0x4701c7[_0x7471('0x15')][_0x7471('0x14')]);}})[_0x7471('0x16')](function(_0x14fb5e){logger[_0x7471('0x12')](_0x7471('0xd'),_0x57b81c,_0x14fb5e);_0x1857db(_0x14fb5e);});});}exports['GetCmHopperBlack']=function(_0x3669be){var _0x1b921e=this;return new Promise(function(_0x3c1b9b,_0x43a6ec){return db[_0x7471('0x17')]['findAll']({'raw':_0x3669be[_0x7471('0x18')]?_0x3669be[_0x7471('0x18')][_0x7471('0x19')]===undefined?!![]:![]:!![],'where':_0x3669be[_0x7471('0x18')]?_0x3669be[_0x7471('0x18')][_0x7471('0x1a')]||null:null,'attributes':_0x3669be['options']?_0x3669be[_0x7471('0x18')][_0x7471('0x1b')]||null:null,'limit':_0x3669be[_0x7471('0x18')]?_0x3669be[_0x7471('0x18')][_0x7471('0x1c')]||null:null,'include':_0x3669be[_0x7471('0x18')]?_0x3669be[_0x7471('0x18')][_0x7471('0x1d')]?_[_0x7471('0x1e')](_0x3669be['options']['include'],function(_0x3e76c6){return{'model':db[_0x3e76c6[_0x7471('0x1f')]],'as':_0x3e76c6['as'],'attributes':_0x3e76c6[_0x7471('0x1b')],'include':_0x3e76c6[_0x7471('0x1d')]?_['map'](_0x3e76c6[_0x7471('0x1d')],function(_0x35d2ea){return{'model':db[_0x35d2ea[_0x7471('0x1f')]],'as':_0x35d2ea['as'],'attributes':_0x35d2ea[_0x7471('0x1b')],'include':_0x35d2ea['include']?_['map'](_0x35d2ea[_0x7471('0x1d')],function(_0x288f71){return{'model':db[_0x288f71[_0x7471('0x1f')]],'as':_0x288f71['as'],'attributes':_0x288f71[_0x7471('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7471('0xb')](function(_0xc2ff10){logger['info']('GetCmHopperBlack',_0x3669be);logger['debug'](_0x7471('0x20'),_0x3669be,JSON['stringify'](_0xc2ff10));_0x3c1b9b(_0xc2ff10);})[_0x7471('0x16')](function(_0x443ce7){logger['error'](_0x7471('0x20'),_0x443ce7[_0x7471('0x14')],_0x3669be);_0x43a6ec(_0x1b921e[_0x7471('0x12')](0x1f4,_0x443ce7[_0x7471('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x83ccc5){var _0x525e20=this;return new Promise(function(_0x56cc3c,_0x18c72f){return db[_0x7471('0x17')][_0x7471('0x21')](_0x83ccc5[_0x7471('0x22')],{'raw':_0x83ccc5['options']?_0x83ccc5[_0x7471('0x18')][_0x7471('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x83ccc5[_0x7471('0x18')]?_0x83ccc5[_0x7471('0x18')][_0x7471('0x1a')]||null:null,'attributes':_0x83ccc5[_0x7471('0x18')]?_0x83ccc5[_0x7471('0x18')][_0x7471('0x1b')]||null:null,'limit':_0x83ccc5[_0x7471('0x18')]?_0x83ccc5['options'][_0x7471('0x1c')]||null:null})[_0x7471('0xb')](function(_0x3fea42){logger[_0x7471('0xc')](_0x7471('0x23'),_0x83ccc5);logger['debug'](_0x7471('0x23'),_0x83ccc5,JSON[_0x7471('0x11')](_0x3fea42));_0x56cc3c(_0x3fea42);})[_0x7471('0x16')](function(_0xce9e1d){logger[_0x7471('0x12')](_0x7471('0x23'),_0xce9e1d[_0x7471('0x14')],_0x83ccc5);_0x18c72f(_0x525e20[_0x7471('0x12')](0x1f4,_0xce9e1d['message']));});});};exports[_0x7471('0x24')]=function(_0x172eca){var _0x25bca9=this;return new Promise(function(_0xc5c4d9,_0xc2a410){return db[_0x7471('0x17')][_0x7471('0x25')]({'where':_0x172eca[_0x7471('0x18')]?_0x172eca[_0x7471('0x18')]['where']||null:null})[_0x7471('0xb')](function(_0x1b460f){logger[_0x7471('0xc')]('DestroyCmHopperBlack',_0x172eca);logger[_0x7471('0xf')](_0x7471('0x24'),_0x172eca,JSON['stringify'](_0x1b460f));_0xc5c4d9(_0x1b460f);})['catch'](function(_0x1153d0){logger[_0x7471('0x12')](_0x7471('0x24'),_0x1153d0[_0x7471('0x14')],_0x172eca);_0xc2a410(_0x25bca9['error'](0x1f4,_0x1153d0[_0x7471('0x14')]));});});}; \ No newline at end of file +var _0x911a=['client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x911a,0x9f));var _0xa911=function(_0x1b7f33,_0x4656a1){_0x1b7f33=_0x1b7f33-0x0;var _0x228a4a=_0x911a[_0x1b7f33];return _0x228a4a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa911('0x0'));var rs=require(_0xa911('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa911('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa911('0x3'))(_0xa911('0x4'));var config=require('../../config/environment');var jayson=require(_0xa911('0x5'));var client=jayson[_0xa911('0x6')][_0xa911('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19e5de,_0x16fb46,_0x23a37c){return new BPromise(function(_0x58ff03,_0x2d39d9){return client[_0xa911('0x8')](_0x19e5de,_0x23a37c)[_0xa911('0x9')](function(_0x3ea57d){logger[_0xa911('0xa')](_0xa911('0xb'),_0x16fb46,_0xa911('0xc'));logger[_0xa911('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x16fb46,_0xa911('0xc'),JSON[_0xa911('0xe')](_0x3ea57d));if(_0x3ea57d[_0xa911('0xf')]){if(_0x3ea57d[_0xa911('0xf')]['code']===0x1f4){logger[_0xa911('0xf')](_0xa911('0xb'),_0x16fb46,_0x3ea57d[_0xa911('0xf')]['message']);return _0x2d39d9(_0x3ea57d[_0xa911('0xf')][_0xa911('0x10')]);}logger[_0xa911('0xf')](_0xa911('0xb'),_0x16fb46,_0x3ea57d['error']['message']);return _0x58ff03(_0x3ea57d[_0xa911('0xf')][_0xa911('0x10')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x16fb46,_0xa911('0xc'));_0x58ff03(_0x3ea57d[_0xa911('0x11')][_0xa911('0x10')]);}})[_0xa911('0x12')](function(_0xd9917){logger[_0xa911('0xf')](_0xa911('0xb'),_0x16fb46,_0xd9917);_0x2d39d9(_0xd9917);});});}exports[_0xa911('0x13')]=function(_0xd3895f){var _0x5ce1e6=this;return new Promise(function(_0x43335b,_0x2eb501){return db[_0xa911('0x14')][_0xa911('0x15')]({'raw':_0xd3895f[_0xa911('0x16')]?_0xd3895f[_0xa911('0x16')][_0xa911('0x17')]===undefined?!![]:![]:!![],'where':_0xd3895f[_0xa911('0x16')]?_0xd3895f[_0xa911('0x16')][_0xa911('0x18')]||null:null,'attributes':_0xd3895f[_0xa911('0x16')]?_0xd3895f[_0xa911('0x16')]['attributes']||null:null,'limit':_0xd3895f[_0xa911('0x16')]?_0xd3895f[_0xa911('0x16')][_0xa911('0x19')]||null:null,'include':_0xd3895f[_0xa911('0x16')]?_0xd3895f[_0xa911('0x16')][_0xa911('0x1a')]?_[_0xa911('0x1b')](_0xd3895f[_0xa911('0x16')]['include'],function(_0x2d468e){return{'model':db[_0x2d468e[_0xa911('0x1c')]],'as':_0x2d468e['as'],'attributes':_0x2d468e[_0xa911('0x1d')],'include':_0x2d468e[_0xa911('0x1a')]?_[_0xa911('0x1b')](_0x2d468e[_0xa911('0x1a')],function(_0x21e5e3){return{'model':db[_0x21e5e3['model']],'as':_0x21e5e3['as'],'attributes':_0x21e5e3['attributes'],'include':_0x21e5e3[_0xa911('0x1a')]?_[_0xa911('0x1b')](_0x21e5e3[_0xa911('0x1a')],function(_0x1c2694){return{'model':db[_0x1c2694[_0xa911('0x1c')]],'as':_0x1c2694['as'],'attributes':_0x1c2694[_0xa911('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b2283){logger[_0xa911('0xa')](_0xa911('0x13'),_0xd3895f);logger['debug'](_0xa911('0x13'),_0xd3895f,JSON[_0xa911('0xe')](_0x2b2283));_0x43335b(_0x2b2283);})[_0xa911('0x12')](function(_0x46abee){logger[_0xa911('0xf')]('GetCmHopperBlack',_0x46abee[_0xa911('0x10')],_0xd3895f);_0x2eb501(_0x5ce1e6[_0xa911('0xf')](0x1f4,_0x46abee[_0xa911('0x10')]));});});};exports[_0xa911('0x1e')]=function(_0x1021fc){var _0x4c8c7a=this;return new Promise(function(_0x4502b7,_0x4ab258){return db[_0xa911('0x14')]['update'](_0x1021fc['body'],{'raw':_0x1021fc[_0xa911('0x16')]?_0x1021fc[_0xa911('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1021fc['options']?_0x1021fc[_0xa911('0x16')]['where']||null:null,'attributes':_0x1021fc[_0xa911('0x16')]?_0x1021fc[_0xa911('0x16')]['attributes']||null:null,'limit':_0x1021fc['options']?_0x1021fc['options'][_0xa911('0x19')]||null:null})[_0xa911('0x9')](function(_0x257771){logger['info'](_0xa911('0x1e'),_0x1021fc);logger['debug']('UpdateCmHopperBlack',_0x1021fc,JSON[_0xa911('0xe')](_0x257771));_0x4502b7(_0x257771);})['catch'](function(_0xdea8be){logger[_0xa911('0xf')]('UpdateCmHopperBlack',_0xdea8be[_0xa911('0x10')],_0x1021fc);_0x4ab258(_0x4c8c7a[_0xa911('0xf')](0x1f4,_0xdea8be[_0xa911('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x551e83){var _0xf83926=this;return new Promise(function(_0xe3f8cd,_0x4fc48a){return db[_0xa911('0x14')][_0xa911('0x1f')]({'where':_0x551e83['options']?_0x551e83[_0xa911('0x16')][_0xa911('0x18')]||null:null})['then'](function(_0x8080fb){logger['info'](_0xa911('0x20'),_0x551e83);logger[_0xa911('0xd')]('DestroyCmHopperBlack',_0x551e83,JSON[_0xa911('0xe')](_0x8080fb));_0xe3f8cd(_0x8080fb);})[_0xa911('0x12')](function(_0x49232d){logger[_0xa911('0xf')](_0xa911('0x20'),_0x49232d[_0xa911('0x10')],_0x551e83);_0x4fc48a(_0xf83926['error'](0x1f4,_0x49232d[_0xa911('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index bc5e208..c2dc684 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 _0x1967=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x438434,_0x39d178){var _0x40a547=function(_0x5593c0){while(--_0x5593c0){_0x438434['push'](_0x438434['shift']());}};_0x40a547(++_0x39d178);}(_0x1967,0x173));var _0x7196=function(_0x440604,_0x1177b4){_0x440604=_0x440604-0x0;var _0x35266e=_0x1967[_0x440604];return _0x35266e;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')](_0x7196('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x7196('0x12')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x13')]);module[_0x7196('0x14')]=router; \ No newline at end of file +var _0xfdbd=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','describe','get','show','put','/:id','update','delete','destroy'];(function(_0x3a223a,_0x303433){var _0xb6ac7d=function(_0x4a076d){while(--_0x4a076d){_0x3a223a['push'](_0x3a223a['shift']());}};_0xb6ac7d(++_0x303433);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1f52ea,_0x1dd436){_0x1f52ea=_0x1f52ea-0x0;var _0x2d4b16=_0xfdbd[_0x1f52ea];return _0x2d4b16;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0x10'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x11')]);router[_0xdfdb('0x12')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('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 bf02099..470f80d 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 _0x58a1=['diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0x2fd131,_0x342b53){var _0x35931f=function(_0x5aacc9){while(--_0x5aacc9){_0x2fd131['push'](_0x2fd131['shift']());}};_0x35931f(++_0x342b53);}(_0x58a1,0xde));var _0x158a=function(_0x2a0bf0,_0x247ffd){_0x2a0bf0=_0x2a0bf0-0x0;var _0x104fd6=_0x58a1[_0x2a0bf0];return _0x104fd6;};'use strict';var Sequelize=require(_0x158a('0x0'));var moment=require(_0x158a('0x1'));module[_0x158a('0x2')]={'state':{'type':Sequelize[_0x158a('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x158a('0x4')]},'scheduledat':{'type':Sequelize[_0x158a('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x158a('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x158a('0x4')]},'originatecalleridname':{'type':Sequelize[_0x158a('0x4')]},'calleridnum':{'type':Sequelize[_0x158a('0x4')]},'calleridname':{'type':Sequelize[_0x158a('0x4')]},'starttime':{'type':Sequelize[_0x158a('0x5')]},'responsetime':{'type':Sequelize[_0x158a('0x5')]},'answertime':{'type':Sequelize[_0x158a('0x5')]},'droptime':{'type':Sequelize[_0x158a('0x5')]},'endtime':{'type':Sequelize[_0x158a('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x158a('0x4')]},'campaign':{'type':Sequelize[_0x158a('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x158a('0x4')]},'reason':{'type':Sequelize[_0x158a('0x4')]},'disposition':{'type':Sequelize[_0x158a('0x4')]},'secondDisposition':{'type':Sequelize[_0x158a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x158a('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4906a8){var _0x525c02=this[_0x158a('0x6')](_0x158a('0x7'));if(_0x525c02&&_0x4906a8){this[_0x158a('0x8')]('followuptime',moment(_0x4906a8)[_0x158a('0x9')](moment(_0x525c02),'seconds'));}}},'amd':{'type':Sequelize[_0x158a('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x158a('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x158a('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x158a('0x5')]},'callback':{'type':Sequelize[_0x158a('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x158a('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x158a('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x158a('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3486=['STRING','DATE','followuptime','diff','BOOLEAN','moment','exports','INTEGER'];(function(_0xa21c85,_0x1dabfa){var _0x490538=function(_0x1f92c9){while(--_0x1f92c9){_0xa21c85['push'](_0xa21c85['shift']());}};_0x490538(++_0x1dabfa);}(_0x3486,0x18d));var _0x6348=function(_0x1e909d,_0x4a8f3d){_0x1e909d=_0x1e909d-0x0;var _0x4762cd=_0x3486[_0x1e909d];return _0x4762cd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6348('0x0'));module[_0x6348('0x1')]={'state':{'type':Sequelize[_0x6348('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6348('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6348('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6348('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6348('0x3')]},'calleridnum':{'type':Sequelize[_0x6348('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6348('0x4')]},'responsetime':{'type':Sequelize[_0x6348('0x4')]},'answertime':{'type':Sequelize[_0x6348('0x4')]},'droptime':{'type':Sequelize[_0x6348('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6348('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6348('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6348('0x3')]},'secondDisposition':{'type':Sequelize[_0x6348('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x6348('0x4')],'set':function(_0x228e5d){var _0x5b5302=this['getDataValue']('endtime');if(_0x5b5302&&_0x228e5d){this['setDataValue'](_0x6348('0x5'),moment(_0x228e5d)[_0x6348('0x6')](moment(_0x5b5302),'seconds'));}}},'amd':{'type':Sequelize[_0x6348('0x7')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6348('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6348('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6348('0x4')]},'callback':{'type':Sequelize[_0x6348('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6348('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6348('0x4')]},'deleted':{'type':Sequelize[_0x6348('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6348('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6348('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6348('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 4af7ce4..ac8c924 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 _0xadb5=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','VoiceQueueId','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','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x78699f,_0x9b5e13){var _0x26bfc7=function(_0x2fbc27){while(--_0x2fbc27){_0x78699f['push'](_0x78699f['shift']());}};_0x26bfc7(++_0x9b5e13);}(_0xadb5,0xad));var _0x5adb=function(_0x2e284d,_0x4813ef){_0x2e284d=_0x2e284d-0x0;var _0x240296=_0xadb5[_0x2e284d];return _0x240296;};'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['CmHopperFinal']['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')]()['then'](respondWithResult(_0x3a5409,null))[_0x5adb('0x42')](handleError(_0x3a5409,null));};exports['update']=function(_0x51bc49,_0x5015ee){if(_0x51bc49[_0x5adb('0x47')][_0x5adb('0x48')]){delete _0x51bc49[_0x5adb('0x47')]['uniqueid'];}return db[_0x5adb('0x2a')]['find']({'where':{'uniqueid':_0x51bc49[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x5015ee,null))[_0x5adb('0x22')](saveUpdates(_0x51bc49['body'],null))[_0x5adb('0x22')](respondWithResult(_0x5015ee,null))['catch'](handleError(_0x5015ee,null));};exports[_0x5adb('0x49')]=function(_0x6dc067,_0x55c535,_0x2402a3){return db[_0x5adb('0x2a')][_0x5adb('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x6dc067[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x4c')))),'noSuchContacts'],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize'][_0x5adb('0x4b')](_0x5adb('0x4e')))),_0x5adb('0x4f')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x52')))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),_0x5adb('0x58')],[db[_0x5adb('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})['then'](handleEntityNotFound(_0x55c535,null))[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x42')](handleError(_0x55c535,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5cb50e,_0x476e62,_0x1505f7){return db['CmHopperFinal'][_0x5adb('0x40')]({'raw':![],'where':{'CampaignId':_0x5cb50e[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x4c')))),_0x5adb('0x5b')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5adb('0x4f')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})[_0x5adb('0x22')](handleEntityNotFound(_0x476e62,null))[_0x5adb('0x22')](respondWithResult(_0x476e62,null))[_0x5adb('0x42')](handleError(_0x476e62,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5e55c2,_0x1fc73b,_0x56df90){return db[_0x5adb('0x5c')][_0x5adb('0x5d')]({'where':{'id':_0x5e55c2[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x1fc73b,null))[_0x5adb('0x22')](function(_0x236f59){var _0x338aee;if(_0x236f59){_0x338aee=squel[_0x5adb('0x5e')]()['into'](_0x5adb('0x5f'))[_0x5adb('0x60')]([_0x5adb('0x61'),'scheduledAt',_0x5adb('0x62'),_0x5adb('0x63'),'VoiceQueueId',_0x5adb('0x64'),'updatedAt'],squel[_0x5adb('0x65')]()[_0x5adb('0x66')]('ANY_VALUE(calleridnum)',_0x5adb('0x61'))[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')]('ANY_VALUE(ListId)',_0x5adb('0x63'))[_0x5adb('0x66')](_0x5adb('0x6a'),'VoiceQueueId')['field'](_0x5adb('0x67'),'createdAt')[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x6b'))['from'](_0x5adb('0x6c'))[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())['where'](_0x5adb('0x6f'),_0x5e55c2[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())['where'](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x61'))[_0x5adb('0x73')]('cm_hopper')[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2['params']['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5adb('0x65')]()['field'](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')]('VoiceQueueId\x20=\x20?',_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')]('ContactId'))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')][_0x5adb('0x2f')](_0x338aee);}return[];})[_0x5adb('0x22')](respondWithResult(_0x1fc73b,null))['catch'](handleError(_0x1fc73b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f3db9,_0x461a07,_0x2e5c96){return db[_0x5adb('0x77')][_0x5adb('0x5d')]({'where':{'id':_0x3f3db9[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x461a07,null))['then'](function(_0xda26cc){var _0x14bada;if(_0xda26cc){_0x14bada=squel[_0x5adb('0x5e')]()[_0x5adb('0x78')]('cm_hopper')[_0x5adb('0x60')]([_0x5adb('0x61'),_0x5adb('0x68'),_0x5adb('0x62'),_0x5adb('0x63'),_0x5adb('0x79'),_0x5adb('0x64'),_0x5adb('0x6b')],squel[_0x5adb('0x65')]()['field'](_0x5adb('0x7a'),_0x5adb('0x61'))['field'](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')](_0x5adb('0x7b'),_0x5adb('0x63'))['field'](_0x5adb('0x7c'),_0x5adb('0x79'))['field'](_0x5adb('0x67'),_0x5adb('0x64'))[_0x5adb('0x66')]('NOW()','updatedAt')[_0x5adb('0x73')](_0x5adb('0x6c'))[_0x5adb('0x37')]('CampaignId\x20=\x20?',_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x6f'),_0x3f3db9[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()['field']('phone')[_0x5adb('0x73')](_0x5adb('0x5f'))['where'](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id']['toString']())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')](_0x5adb('0x62')))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')]['query'](_0x14bada);}return[];})[_0x5adb('0x22')](respondWithResult(_0x461a07,null))[_0x5adb('0x42')](handleError(_0x461a07,null));};exports[_0x5adb('0x7e')]=function(_0x1e5532,_0x2c3af8,_0x3a201a){return db[_0x5adb('0x7f')][_0x5adb('0x80')]({'where':{'VoiceQueueId':_0x1e5532[_0x5adb('0x47')][_0x5adb('0x81')],'CampaignId':_0x1e5532['body'][_0x5adb('0x79')],'ContactId':_0x1e5532['body'][_0x5adb('0x62')]}})[_0x5adb('0x22')](handleEntityNotFound(_0x2c3af8,null))[_0x5adb('0x22')](function(_0x193a29){if(_0x193a29){return _0x193a29;}return null;})[_0x5adb('0x22')](respondWithResult(_0x2c3af8,null))['catch'](handleError(_0x2c3af8,null));}; \ No newline at end of file +var _0x7a54=['calleridnum\x20NOT\x20IN\x20(?)','calleridnum','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','findOne','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','CmHopperFinal','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL'];(function(_0x3d0ef2,_0x50add6){var _0x433bd0=function(_0x2e49c9){while(--_0x2e49c9){_0x3d0ef2['push'](_0x3d0ef2['shift']());}};_0x433bd0(++_0x50add6);}(_0x7a54,0x106));var _0x47a5=function(_0x17fb59,_0x49299f){_0x17fb59=_0x17fb59-0x0;var _0x34ca44=_0x7a54[_0x17fb59];return _0x34ca44;};'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['CmHopperFinal'][_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['CmHopperFinal']['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['describe']=function(_0x2d38de,_0x23bb04){return db['CmHopperFinal']['describe']()[_0x47a5('0x23')](respondWithResult(_0x23bb04,null))['catch'](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0xd93e37,_0x54c35f){if(_0xd93e37['body'][_0x47a5('0x47')]){delete _0xd93e37['body'][_0x47a5('0x47')];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'uniqueid':_0xd93e37[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x54c35f,null))[_0x47a5('0x23')](saveUpdates(_0xd93e37[_0x47a5('0x48')],null))['then'](respondWithResult(_0x54c35f,null))['catch'](handleError(_0x54c35f,null));};exports[_0x47a5('0x49')]=function(_0x411230,_0x1163e3,_0x9ea93e){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x411230[_0x47a5('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4c')))),'noSuchContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4d')))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x47a5('0x50')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x52')))),'dropContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x47a5('0x53')))),'abandonedContacts'],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2022,\x201,\x20null'))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x55')))),_0x47a5('0x56')]]})['then'](handleEntityNotFound(_0x1163e3,null))[_0x47a5('0x23')](respondWithResult(_0x1163e3,null))[_0x47a5('0x46')](handleError(_0x1163e3,null));};exports[_0x47a5('0x57')]=function(_0x5a33b8,_0x30ea7a,_0x4db625){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'CampaignId':_0x5a33b8[_0x47a5('0x41')]['id']},'attributes':[[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x58')))),'busyContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x59')))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x52')))),_0x47a5('0x5a')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize'][_0x47a5('0x4f')](_0x47a5('0x53')))),_0x47a5('0x5b')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x5c')))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x47a5('0x56')]]})[_0x47a5('0x23')](handleEntityNotFound(_0x30ea7a,null))[_0x47a5('0x23')](respondWithResult(_0x30ea7a,null))['catch'](handleError(_0x30ea7a,null));};exports[_0x47a5('0x5d')]=function(_0x2e46af,_0x36c67,_0x26f1ac){return db['VoiceQueue'][_0x47a5('0x45')]({'where':{'id':_0x2e46af['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x36c67,null))['then'](function(_0x43f649){var _0x4cf7c5;if(_0x43f649){_0x4cf7c5=squel[_0x47a5('0x5e')]()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery'](['phone','scheduledAt',_0x47a5('0x61'),_0x47a5('0x62'),_0x47a5('0x63'),_0x47a5('0x64'),'updatedAt'],squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x67'),_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6a'))[_0x47a5('0x66')](_0x47a5('0x6b'),_0x47a5('0x61'))[_0x47a5('0x66')](_0x47a5('0x6c'),'ListId')[_0x47a5('0x66')]('ANY_VALUE(VoiceQueueId)',_0x47a5('0x63'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6d'))[_0x47a5('0x6e')](_0x47a5('0x6f'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x72'),_0x2e46af['body']['state']['toString']())['where'](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x68'))[_0x47a5('0x6e')](_0x47a5('0x60'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')](_0x47a5('0x74'),squel['select']()[_0x47a5('0x66')](_0x47a5('0x75'))[_0x47a5('0x6e')]('cm_hopper_final')[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')]('state\x20=\x204'))['group'](_0x47a5('0x61')))[_0x47a5('0x71')]();return db[_0x47a5('0x4b')][_0x47a5('0x2f')](_0x4cf7c5);}return[];})[_0x47a5('0x23')](respondWithResult(_0x36c67,null))[_0x47a5('0x46')](handleError(_0x36c67,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x592322,_0x3e0dbd,_0x4f2361){return db[_0x47a5('0x76')][_0x47a5('0x45')]({'where':{'id':_0x592322[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x3e0dbd,null))['then'](function(_0x3c66e3){var _0x550bde;if(_0x3c66e3){_0x550bde=squel['insert']()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery']([_0x47a5('0x68'),_0x47a5('0x6a'),_0x47a5('0x61'),'ListId',_0x47a5('0x77'),'createdAt',_0x47a5('0x6d')],squel[_0x47a5('0x65')]()[_0x47a5('0x66')]('ANY_VALUE(calleridnum)',_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),'scheduledAt')[_0x47a5('0x66')]('ANY_VALUE(ContactId)',_0x47a5('0x61'))['field'](_0x47a5('0x6c'),_0x47a5('0x62'))[_0x47a5('0x66')](_0x47a5('0x78'),'CampaignId')[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),'updatedAt')['from'](_0x47a5('0x6f'))['where'](_0x47a5('0x79'),_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())['where'](_0x47a5('0x72'),_0x592322[_0x47a5('0x48')]['state'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x47a5('0x66')](_0x47a5('0x68'))['from'](_0x47a5('0x60'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()['field'](_0x47a5('0x75'))['from'](_0x47a5('0x6f'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')](_0x47a5('0x7a')))[_0x47a5('0x7b')](_0x47a5('0x61')))['toString']();return db[_0x47a5('0x4b')]['query'](_0x550bde);}return[];})['then'](respondWithResult(_0x3e0dbd,null))[_0x47a5('0x46')](handleError(_0x3e0dbd,null));};exports[_0x47a5('0x7c')]=function(_0x352238,_0x96fb22,_0x380c8b){return db['CmHopper'][_0x47a5('0x7d')]({'where':{'VoiceQueueId':_0x352238[_0x47a5('0x48')][_0x47a5('0x63')],'CampaignId':_0x352238[_0x47a5('0x48')]['CampaignId'],'ContactId':_0x352238[_0x47a5('0x48')]['ContactId']}})[_0x47a5('0x23')](handleEntityNotFound(_0x96fb22,null))[_0x47a5('0x23')](function(_0x3f93f0){if(_0x3f93f0){return _0x3f93f0;}return null;})[_0x47a5('0x23')](respondWithResult(_0x96fb22,null))[_0x47a5('0x46')](handleError(_0x96fb22,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d0701dc..c5bb03a 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 _0xf700=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','../../config/logger','api'];(function(_0x198e29,_0x642e00){var _0x28c55b=function(_0x1831d7){while(--_0x1831d7){_0x198e29['push'](_0x198e29['shift']());}};_0x28c55b(++_0x642e00);}(_0xf700,0x15c));var _0x0f70=function(_0x11e333,_0xf8593e){_0x11e333=_0x11e333-0x0;var _0x4d726e=_0xf700[_0x11e333];return _0x4d726e;};'use strict';var _=require(_0x0f70('0x0'));var util=require('util');var logger=require(_0x0f70('0x1'))(_0x0f70('0x2'));var moment=require(_0x0f70('0x3'));var BPromise=require(_0x0f70('0x4'));var rp=require(_0x0f70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f70('0x6'));var config=require(_0x0f70('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x0f70('0x8')]=function(_0x2bae59,_0x5c27b3){return _0x2bae59[_0x0f70('0x9')](_0x0f70('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x0f70('0xb'),'fields':[_0x0f70('0xb')]},{'name':'uniqueid','fields':[_0x0f70('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a1f=['define','CmHopperFinal','calleridnum','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0x4a1f,0xd4));var _0xf4a1=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x4a1f[_0x1e1965];return _0x1a2e96;};'use strict';var _=require('lodash');var util=require(_0xf4a1('0x0'));var logger=require(_0xf4a1('0x1'))(_0xf4a1('0x2'));var moment=require('moment');var BPromise=require(_0xf4a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4a1('0x4'));var rimraf=require(_0xf4a1('0x5'));var config=require(_0xf4a1('0x6'));var attributes=require(_0xf4a1('0x7'));module['exports']=function(_0xee8403,_0x52ca86){return _0xee8403[_0xf4a1('0x8')](_0xf4a1('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xf4a1('0xa'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 12ae1a4..7f37109 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(_0x501119,_0x168137){var _0x393fca=function(_0x1baf32){while(--_0x1baf32){_0x501119['push'](_0x501119['shift']());}};_0x393fca(++_0x168137);}(_0xb10b,0x12a));var _0xbb10=function(_0x295849,_0x42b3eb){_0x295849=_0x295849-0x0;var _0x27d8d4=_0xb10b[_0x295849];return _0x27d8d4;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x201d0b,_0x37b251){var _0x2c7ee1=function(_0x2123c0){while(--_0x2123c0){_0x201d0b['push'](_0x201d0b['shift']());}};_0x2c7ee1(++_0x37b251);}(_0x7a54,0x106));var _0x47a5=function(_0x271a27,_0x49b118){_0x271a27=_0x271a27-0x0;var _0x3dbb6f=_0x7a54[_0x271a27];return _0x3dbb6f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 577914b..b55870e 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 _0x381e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','/:id','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2afe3c,_0x559154){var _0x466eb2=function(_0x35ad2c){while(--_0x35ad2c){_0x2afe3c['push'](_0x2afe3c['shift']());}};_0x466eb2(++_0x559154);}(_0x381e,0x18f));var _0xe381=function(_0x4f106c,_0x271839){_0x4f106c=_0x4f106c-0x0;var _0xb66b4b=_0x381e[_0x4f106c];return _0xb66b4b;};'use strict';var multer=require(_0xe381('0x0'));var util=require(_0xe381('0x1'));var path=require(_0xe381('0x2'));var timeout=require(_0xe381('0x3'));var express=require(_0xe381('0x4'));var router=express[_0xe381('0x5')]();var fs_extra=require(_0xe381('0x6'));var auth=require(_0xe381('0x7'));var interaction=require(_0xe381('0x8'));var config=require(_0xe381('0x9'));var controller=require(_0xe381('0xa'));router['get']('/',auth[_0xe381('0xb')](),controller[_0xe381('0xc')]);router[_0xe381('0xd')](_0xe381('0xe'),auth[_0xe381('0xb')](),controller['describe']);router['get'](_0xe381('0xf'),auth[_0xe381('0xb')](),controller['show']);router[_0xe381('0xd')](_0xe381('0x10'),auth[_0xe381('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xe381('0xd')](_0xe381('0x11'),auth['isAuthenticated'](),controller[_0xe381('0x12')]);router[_0xe381('0x13')](_0xe381('0x14'),auth[_0xe381('0xb')](),controller[_0xe381('0x15')]);router[_0xe381('0x13')]('/voice/campaign/moveContacts/:id',auth[_0xe381('0xb')](),controller[_0xe381('0x16')]);router['post'](_0xe381('0x17'),auth['isAuthenticated'](),controller[_0xe381('0x18')]);router['put'](_0xe381('0xf'),auth[_0xe381('0xb')](),controller[_0xe381('0x19')]);module[_0xe381('0x1a')]=router; \ No newline at end of file +var _0x8bd2=['/:id','isAuthenticated','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','describe'];(function(_0xb66224,_0x3a3f2f){var _0x346365=function(_0x51de16){while(--_0x51de16){_0xb66224['push'](_0xb66224['shift']());}};_0x346365(++_0x3a3f2f);}(_0x8bd2,0x1d3));var _0x28bd=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x8bd2[_0x2eb5bc];return _0x51c7b1;};'use strict';var multer=require('multer');var util=require(_0x28bd('0x0'));var path=require(_0x28bd('0x1'));var timeout=require(_0x28bd('0x2'));var express=require('express');var router=express[_0x28bd('0x3')]();var fs_extra=require(_0x28bd('0x4'));var auth=require(_0x28bd('0x5'));var interaction=require(_0x28bd('0x6'));var config=require(_0x28bd('0x7'));var controller=require(_0x28bd('0x8'));router[_0x28bd('0x9')]('/',auth['isAuthenticated'](),controller[_0x28bd('0xa')]);router[_0x28bd('0x9')](_0x28bd('0xb'),auth['isAuthenticated'](),controller[_0x28bd('0xc')]);router['get'](_0x28bd('0xd'),auth[_0x28bd('0xe')](),controller['show']);router[_0x28bd('0x9')](_0x28bd('0xf'),auth[_0x28bd('0xe')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x28bd('0x9')](_0x28bd('0x10'),auth[_0x28bd('0xe')](),controller[_0x28bd('0x11')]);router['post']('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x28bd('0x12')]);router[_0x28bd('0x13')](_0x28bd('0x14'),auth[_0x28bd('0xe')](),controller[_0x28bd('0x15')]);router[_0x28bd('0x13')](_0x28bd('0x16'),auth[_0x28bd('0xe')](),controller['checkContactHopper']);router[_0x28bd('0x17')](_0x28bd('0xd'),auth[_0x28bd('0xe')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7897693..e19d816 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 _0x6b23=['DATE','INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x53e3c9,_0x323b2b){var _0x5e3a3b=function(_0x11e30d){while(--_0x11e30d){_0x53e3c9['push'](_0x53e3c9['shift']());}};_0x5e3a3b(++_0x323b2b);}(_0x6b23,0x102));var _0x36b2=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x6b23[_0x245afe];return _0x4eefde;};'use strict';var Sequelize=require(_0x36b2('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x36b2('0x1')]},'scheduledat':{'type':Sequelize[_0x36b2('0x2')]},'countbusyretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x36b2('0x1')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x36b2('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x36b2('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x36b2('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x36b2('0x2')]},'endtime':{'type':Sequelize[_0x36b2('0x2')]},'ringtime':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x36b2('0x1')]},'campaign':{'type':Sequelize[_0x36b2('0x1')]},'campaigntype':{'type':Sequelize[_0x36b2('0x1')]},'membername':{'type':Sequelize[_0x36b2('0x1')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x36b2('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x36b2('0x2')]},'recallme':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x36b2('0x2')]},'edited':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x36b2('0x1')]}}; \ No newline at end of file +var _0x0731=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0731,0x175));var _0x1073=function(_0x3c6aa5,_0x2944f4){_0x3c6aa5=_0x3c6aa5-0x0;var _0x4fa8a3=_0x0731[_0x3c6aa5];return _0x4fa8a3;};'use strict';var Sequelize=require(_0x1073('0x0'));module[_0x1073('0x1')]={'state':{'type':Sequelize[_0x1073('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1073('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1073('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1073('0x3')]},'calleridname':{'type':Sequelize[_0x1073('0x3')]},'starttime':{'type':Sequelize[_0x1073('0x4')]},'responsetime':{'type':Sequelize[_0x1073('0x4')]},'answertime':{'type':Sequelize[_0x1073('0x4')]},'droptime':{'type':Sequelize[_0x1073('0x4')]},'endtime':{'type':Sequelize[_0x1073('0x4')]},'ringtime':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1073('0x3')]},'campaign':{'type':Sequelize[_0x1073('0x3')]},'campaigntype':{'type':Sequelize[_0x1073('0x3')]},'membername':{'type':Sequelize[_0x1073('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x1073('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1073('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1073('0x4')]},'recallme':{'type':Sequelize[_0x1073('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x1073('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1073('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 4d7df91..b1d91c2 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 _0xb376=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','then','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','model','create','describe','body','uniqueid','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xd6895d,_0x2623e1){var _0x342c9c=function(_0x1ff5d1){while(--_0x1ff5d1){_0xd6895d['push'](_0xd6895d['shift']());}};_0x342c9c(++_0x2623e1);}(_0xb376,0x7d));var _0x6b37=function(_0x5d5349,_0x3fa22e){_0x5d5349=_0x5d5349-0x0;var _0x3443c8=_0xb376[_0x5d5349];return _0x3443c8;};'use strict';var emlformat=require(_0x6b37('0x0'));var rimraf=require(_0x6b37('0x1'));var zipdir=require(_0x6b37('0x2'));var jsonpatch=require(_0x6b37('0x3'));var rp=require(_0x6b37('0x4'));var moment=require(_0x6b37('0x5'));var BPromise=require(_0x6b37('0x6'));var Mustache=require(_0x6b37('0x7'));var util=require(_0x6b37('0x8'));var path=require(_0x6b37('0x9'));var sox=require(_0x6b37('0xa'));var csv=require(_0x6b37('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b37('0xc'));var squel=require(_0x6b37('0xd'));var crypto=require('crypto');var jsforce=require(_0x6b37('0xe'));var deskjs=require(_0x6b37('0xf'));var toCsv=require(_0x6b37('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6b37('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6b37('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b37('0x12'));var logger=require(_0x6b37('0x13'))(_0x6b37('0x14'));var utils=require(_0x6b37('0x15'));var config=require(_0x6b37('0x16'));var licenseUtil=require(_0x6b37('0x17'));var db=require(_0x6b37('0x18'))['db'];function respondWithStatusCode(_0x205869,_0x10da10){_0x10da10=_0x10da10||0xcc;return function(_0x17dd71){if(_0x17dd71){return _0x205869[_0x6b37('0x19')](_0x10da10);}return _0x205869[_0x6b37('0x1a')](_0x10da10)[_0x6b37('0x1b')]();};}function respondWithResult(_0x2fb8bb,_0x345c41){_0x345c41=_0x345c41||0xc8;return function(_0x4edd94){if(_0x4edd94){return _0x2fb8bb[_0x6b37('0x1a')](_0x345c41)['json'](_0x4edd94);}};}function respondWithFilteredResult(_0x199e6f,_0x33e22a){return function(_0x1e247e){if(_0x1e247e){var _0x4a35e8=typeof _0x33e22a[_0x6b37('0x1c')]===_0x6b37('0x1d')&&typeof _0x33e22a[_0x6b37('0x1e')]===_0x6b37('0x1d');var _0x2b6c33=_0x1e247e[_0x6b37('0x1f')];var _0xddfa2e=_0x4a35e8?0x0:_0x33e22a['offset'];var _0x4de4bd=_0x4a35e8?_0x1e247e['count']:_0x33e22a[_0x6b37('0x1c')]+_0x33e22a[_0x6b37('0x1e')];var _0x1b456b;if(_0x4de4bd>=_0x2b6c33){_0x4de4bd=_0x2b6c33;_0x1b456b=0xc8;}else{_0x1b456b=0xce;}_0x199e6f[_0x6b37('0x1a')](_0x1b456b);return _0x199e6f['set']('Content-Range',_0xddfa2e+'-'+_0x4de4bd+'/'+_0x2b6c33)[_0x6b37('0x20')](_0x1e247e);}return null;};}function patchUpdates(_0x42ccb5){return function(_0x128a6c){try{jsonpatch[_0x6b37('0x21')](_0x128a6c,_0x42ccb5,!![]);}catch(_0x176207){return BPromise['reject'](_0x176207);}return _0x128a6c[_0x6b37('0x22')]();};}function saveUpdates(_0xe065da,_0xbeb685){return function(_0x124c6c){if(_0x124c6c){return _0x124c6c[_0x6b37('0x23')](_0xe065da)[_0x6b37('0x24')](function(_0x30b71d){return _0x30b71d;});}return null;};}function removeEntity(_0x2cbb2f,_0x5c74df){return function(_0x53cbfb){if(_0x53cbfb){return _0x53cbfb['destroy']()['then'](function(){_0x2cbb2f[_0x6b37('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e6831,_0xd34347){return function(_0x4b0a73){if(!_0x4b0a73){_0x4e6831['sendStatus'](0x194);}return _0x4b0a73;};}function handleError(_0x55977e,_0x50ef91){_0x50ef91=_0x50ef91||0x1f4;return function(_0x1a7265){logger['error'](_0x1a7265[_0x6b37('0x25')]);if(_0x1a7265[_0x6b37('0x26')]){delete _0x1a7265[_0x6b37('0x26')];}_0x55977e[_0x6b37('0x1a')](_0x50ef91)[_0x6b37('0x27')](_0x1a7265);};}exports[_0x6b37('0x28')]=function(_0x4988f0,_0x282a58){var _0x443f45={},_0x236f65={},_0x249468={'count':0x0,'rows':[]};var _0x2108bb=_[_0x6b37('0x29')](db[_0x6b37('0x2a')][_0x6b37('0x2b')],function(_0x282a2a){return{'name':_0x282a2a[_0x6b37('0x2c')],'type':_0x282a2a['type'][_0x6b37('0x2d')]};});_0x236f65['model']=_[_0x6b37('0x29')](_0x2108bb,'name');_0x236f65[_0x6b37('0x2e')]=_['keys'](_0x4988f0[_0x6b37('0x2e')]);_0x236f65[_0x6b37('0x2f')]=_['intersection'](_0x236f65['model'],_0x236f65['query']);_0x443f45['attributes']=_[_0x6b37('0x30')](_0x236f65['model'],qs[_0x6b37('0x31')](_0x4988f0[_0x6b37('0x2e')]['fields']));_0x443f45[_0x6b37('0x32')]=_0x443f45[_0x6b37('0x32')][_0x6b37('0x33')]?_0x443f45[_0x6b37('0x32')]:_0x236f65['model'];if(!_0x4988f0[_0x6b37('0x2e')]['hasOwnProperty'](_0x6b37('0x34'))){_0x443f45['limit']=qs['limit'](_0x4988f0['query'][_0x6b37('0x1e')]);_0x443f45['offset']=qs[_0x6b37('0x1c')](_0x4988f0[_0x6b37('0x2e')]['offset']);}_0x443f45[_0x6b37('0x35')]=qs[_0x6b37('0x36')](_0x4988f0[_0x6b37('0x2e')]['sort']);_0x443f45[_0x6b37('0x37')]=qs[_0x6b37('0x2f')](_[_0x6b37('0x38')](_0x4988f0[_0x6b37('0x2e')],_0x236f65[_0x6b37('0x2f')]),_0x2108bb);if(_0x4988f0[_0x6b37('0x2e')]['filter']){_0x443f45[_0x6b37('0x37')]=_[_0x6b37('0x39')](_0x443f45[_0x6b37('0x37')],{'$or':_['map'](_0x2108bb,function(_0x5f065b){if(_0x5f065b['type']!==_0x6b37('0x3a')){var _0x2491a2={};_0x2491a2[_0x5f065b[_0x6b37('0x26')]]={'$like':'%'+_0x4988f0[_0x6b37('0x2e')][_0x6b37('0x3b')]+'%'};return _0x2491a2;}})});}_0x443f45=_[_0x6b37('0x39')]({},_0x443f45,_0x4988f0[_0x6b37('0x3c')]);var _0xc3c4f3={'where':_0x443f45[_0x6b37('0x37')]};return db[_0x6b37('0x2a')][_0x6b37('0x1f')](_0xc3c4f3)[_0x6b37('0x24')](function(_0x3928be){_0x249468[_0x6b37('0x1f')]=_0x3928be;if(_0x4988f0[_0x6b37('0x2e')][_0x6b37('0x3d')]){_0x443f45[_0x6b37('0x3e')]=[{'all':!![]}];}return db[_0x6b37('0x2a')][_0x6b37('0x3f')](_0x443f45);})[_0x6b37('0x24')](function(_0x2b3699){_0x249468[_0x6b37('0x40')]=_0x2b3699;return _0x249468;})[_0x6b37('0x24')](respondWithFilteredResult(_0x282a58,_0x443f45))['catch'](handleError(_0x282a58,null));};exports['show']=function(_0x5eaf06,_0x3118c3){var _0x4f065e={'raw':!![],'where':{'id':_0x5eaf06[_0x6b37('0x41')]['id']}},_0x3d4f5b={};_0x3d4f5b['model']=_['keys'](db[_0x6b37('0x2a')][_0x6b37('0x2b')]);_0x3d4f5b[_0x6b37('0x2e')]=_[_0x6b37('0x42')](_0x5eaf06[_0x6b37('0x2e')]);_0x3d4f5b['filters']=_[_0x6b37('0x30')](_0x3d4f5b['model'],_0x3d4f5b[_0x6b37('0x2e')]);_0x4f065e[_0x6b37('0x32')]=_[_0x6b37('0x30')](_0x3d4f5b[_0x6b37('0x43')],qs['fields'](_0x5eaf06['query']['fields']));_0x4f065e[_0x6b37('0x32')]=_0x4f065e[_0x6b37('0x32')]['length']?_0x4f065e[_0x6b37('0x32')]:_0x3d4f5b[_0x6b37('0x43')];if(_0x5eaf06[_0x6b37('0x2e')][_0x6b37('0x3d')]){_0x4f065e[_0x6b37('0x3e')]=[{'all':!![]}];}_0x4f065e=_['merge']({},_0x4f065e,_0x5eaf06[_0x6b37('0x3c')]);return db[_0x6b37('0x2a')]['find'](_0x4f065e)[_0x6b37('0x24')](handleEntityNotFound(_0x3118c3,null))[_0x6b37('0x24')](respondWithResult(_0x3118c3,null))['catch'](handleError(_0x3118c3,null));};exports[_0x6b37('0x44')]=function(_0xa202df,_0x5cec40){return db['CmHopperHistory'][_0x6b37('0x44')](_0xa202df['body'],{})['then'](respondWithResult(_0x5cec40,0xc9))['catch'](handleError(_0x5cec40,null));};exports[_0x6b37('0x45')]=function(_0x2af1b3,_0x58f89f){return db[_0x6b37('0x2a')]['describe']()[_0x6b37('0x24')](respondWithResult(_0x58f89f,null))['catch'](handleError(_0x58f89f,null));};exports[_0x6b37('0x23')]=function(_0x4208d8,_0x355d8f){if(_0x4208d8[_0x6b37('0x46')]['uniqueid']){delete _0x4208d8['body'][_0x6b37('0x47')];}return db[_0x6b37('0x2a')][_0x6b37('0x48')]({'where':{'uniqueid':_0x4208d8['params']['id']}})[_0x6b37('0x24')](handleEntityNotFound(_0x355d8f,null))[_0x6b37('0x24')](saveUpdates(_0x4208d8[_0x6b37('0x46')],null))[_0x6b37('0x24')](respondWithResult(_0x355d8f,null))[_0x6b37('0x49')](handleError(_0x355d8f,null));}; \ No newline at end of file +var _0x8ce1=['uniqueid','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','then','stack','name','send','map','CmHopperHistory','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','rawAttributes','find','create','describe','update','body'];(function(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0x8ce1,0x16f));var _0x18ce=function(_0x3304be,_0x4045eb){_0x3304be=_0x3304be-0x0;var _0x39a6dd=_0x8ce1[_0x3304be];return _0x39a6dd;};'use strict';var emlformat=require(_0x18ce('0x0'));var rimraf=require(_0x18ce('0x1'));var zipdir=require(_0x18ce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var Mustache=require(_0x18ce('0x6'));var util=require(_0x18ce('0x7'));var path=require(_0x18ce('0x8'));var sox=require(_0x18ce('0x9'));var csv=require('to-csv');var ejs=require(_0x18ce('0xa'));var fs=require('fs');var fs_extra=require(_0x18ce('0xb'));var _=require(_0x18ce('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x18ce('0xd'));var deskjs=require(_0x18ce('0xe'));var toCsv=require(_0x18ce('0xf'));var querystring=require(_0x18ce('0x10'));var Papa=require(_0x18ce('0x11'));var Redis=require('ioredis');var authService=require(_0x18ce('0x12'));var qs=require(_0x18ce('0x13'));var as=require(_0x18ce('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x15'));var utils=require(_0x18ce('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x18ce('0x17'));var db=require(_0x18ce('0x18'))['db'];function respondWithStatusCode(_0x27c57a,_0x3cacd1){_0x3cacd1=_0x3cacd1||0xcc;return function(_0x23326c){if(_0x23326c){return _0x27c57a[_0x18ce('0x19')](_0x3cacd1);}return _0x27c57a[_0x18ce('0x1a')](_0x3cacd1)[_0x18ce('0x1b')]();};}function respondWithResult(_0x5391ee,_0x1a21b3){_0x1a21b3=_0x1a21b3||0xc8;return function(_0x517b30){if(_0x517b30){return _0x5391ee['status'](_0x1a21b3)['json'](_0x517b30);}};}function respondWithFilteredResult(_0x5195b7,_0x472638){return function(_0x45643d){if(_0x45643d){var _0x36429a=typeof _0x472638[_0x18ce('0x1c')]==='undefined'&&typeof _0x472638[_0x18ce('0x1d')]==='undefined';var _0x5ed01c=_0x45643d[_0x18ce('0x1e')];var _0x13fb69=_0x36429a?0x0:_0x472638[_0x18ce('0x1c')];var _0x22f3a2=_0x36429a?_0x45643d[_0x18ce('0x1e')]:_0x472638[_0x18ce('0x1c')]+_0x472638[_0x18ce('0x1d')];var _0x4490cc;if(_0x22f3a2>=_0x5ed01c){_0x22f3a2=_0x5ed01c;_0x4490cc=0xc8;}else{_0x4490cc=0xce;}_0x5195b7['status'](_0x4490cc);return _0x5195b7[_0x18ce('0x1f')](_0x18ce('0x20'),_0x13fb69+'-'+_0x22f3a2+'/'+_0x5ed01c)[_0x18ce('0x21')](_0x45643d);}return null;};}function patchUpdates(_0x5b2b0f){return function(_0x424cf2){try{jsonpatch['apply'](_0x424cf2,_0x5b2b0f,!![]);}catch(_0x1b73e7){return BPromise[_0x18ce('0x22')](_0x1b73e7);}return _0x424cf2[_0x18ce('0x23')]();};}function saveUpdates(_0xae8339,_0x2cf3df){return function(_0x54d406){if(_0x54d406){return _0x54d406['update'](_0xae8339)[_0x18ce('0x24')](function(_0x1287d0){return _0x1287d0;});}return null;};}function removeEntity(_0x28377c,_0x2e1cbf){return function(_0x357e37){if(_0x357e37){return _0x357e37['destroy']()[_0x18ce('0x24')](function(){_0x28377c[_0x18ce('0x1a')](0xcc)[_0x18ce('0x1b')]();});}};}function handleEntityNotFound(_0x2bf9fa,_0x84df13){return function(_0x18715b){if(!_0x18715b){_0x2bf9fa['sendStatus'](0x194);}return _0x18715b;};}function handleError(_0x41ebdc,_0x297644){_0x297644=_0x297644||0x1f4;return function(_0x520af9){logger['error'](_0x520af9[_0x18ce('0x25')]);if(_0x520af9[_0x18ce('0x26')]){delete _0x520af9['name'];}_0x41ebdc[_0x18ce('0x1a')](_0x297644)[_0x18ce('0x27')](_0x520af9);};}exports['index']=function(_0xc9c1e7,_0x3c923d){var _0x4c1ee1={},_0x378317={},_0x26b0dd={'count':0x0,'rows':[]};var _0x4c7863=_[_0x18ce('0x28')](db[_0x18ce('0x29')]['rawAttributes'],function(_0x45ed23){return{'name':_0x45ed23[_0x18ce('0x2a')],'type':_0x45ed23[_0x18ce('0x2b')]['key']};});_0x378317[_0x18ce('0x2c')]=_[_0x18ce('0x28')](_0x4c7863,_0x18ce('0x26'));_0x378317[_0x18ce('0x2d')]=_[_0x18ce('0x2e')](_0xc9c1e7[_0x18ce('0x2d')]);_0x378317[_0x18ce('0x2f')]=_['intersection'](_0x378317[_0x18ce('0x2c')],_0x378317[_0x18ce('0x2d')]);_0x4c1ee1[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x378317[_0x18ce('0x2c')],qs[_0x18ce('0x32')](_0xc9c1e7['query'][_0x18ce('0x32')]));_0x4c1ee1[_0x18ce('0x30')]=_0x4c1ee1[_0x18ce('0x30')][_0x18ce('0x33')]?_0x4c1ee1[_0x18ce('0x30')]:_0x378317[_0x18ce('0x2c')];if(!_0xc9c1e7['query'][_0x18ce('0x34')](_0x18ce('0x35'))){_0x4c1ee1[_0x18ce('0x1d')]=qs[_0x18ce('0x1d')](_0xc9c1e7['query'][_0x18ce('0x1d')]);_0x4c1ee1['offset']=qs[_0x18ce('0x1c')](_0xc9c1e7[_0x18ce('0x2d')]['offset']);}_0x4c1ee1[_0x18ce('0x36')]=qs[_0x18ce('0x37')](_0xc9c1e7[_0x18ce('0x2d')][_0x18ce('0x37')]);_0x4c1ee1[_0x18ce('0x38')]=qs[_0x18ce('0x2f')](_[_0x18ce('0x39')](_0xc9c1e7[_0x18ce('0x2d')],_0x378317[_0x18ce('0x2f')]),_0x4c7863);if(_0xc9c1e7['query']['filter']){_0x4c1ee1[_0x18ce('0x38')]=_[_0x18ce('0x3a')](_0x4c1ee1[_0x18ce('0x38')],{'$or':_['map'](_0x4c7863,function(_0x4e317d){if(_0x4e317d[_0x18ce('0x2b')]!==_0x18ce('0x3b')){var _0x247bf6={};_0x247bf6[_0x4e317d[_0x18ce('0x26')]]={'$like':'%'+_0xc9c1e7['query'][_0x18ce('0x3c')]+'%'};return _0x247bf6;}})});}_0x4c1ee1=_[_0x18ce('0x3a')]({},_0x4c1ee1,_0xc9c1e7[_0x18ce('0x3d')]);var _0x20e5c5={'where':_0x4c1ee1['where']};return db[_0x18ce('0x29')][_0x18ce('0x1e')](_0x20e5c5)[_0x18ce('0x24')](function(_0x40797e){_0x26b0dd['count']=_0x40797e;if(_0xc9c1e7[_0x18ce('0x2d')][_0x18ce('0x3e')]){_0x4c1ee1[_0x18ce('0x3f')]=[{'all':!![]}];}return db[_0x18ce('0x29')]['findAll'](_0x4c1ee1);})['then'](function(_0x2570eb){_0x26b0dd['rows']=_0x2570eb;return _0x26b0dd;})['then'](respondWithFilteredResult(_0x3c923d,_0x4c1ee1))[_0x18ce('0x40')](handleError(_0x3c923d,null));};exports['show']=function(_0x23dc11,_0x343876){var _0x260f32={'raw':!![],'where':{'id':_0x23dc11['params']['id']}},_0x359867={};_0x359867[_0x18ce('0x2c')]=_[_0x18ce('0x2e')](db[_0x18ce('0x29')][_0x18ce('0x41')]);_0x359867[_0x18ce('0x2d')]=_[_0x18ce('0x2e')](_0x23dc11['query']);_0x359867[_0x18ce('0x2f')]=_[_0x18ce('0x31')](_0x359867['model'],_0x359867['query']);_0x260f32[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x359867[_0x18ce('0x2c')],qs[_0x18ce('0x32')](_0x23dc11[_0x18ce('0x2d')][_0x18ce('0x32')]));_0x260f32[_0x18ce('0x30')]=_0x260f32['attributes'][_0x18ce('0x33')]?_0x260f32[_0x18ce('0x30')]:_0x359867['model'];if(_0x23dc11[_0x18ce('0x2d')][_0x18ce('0x3e')]){_0x260f32[_0x18ce('0x3f')]=[{'all':!![]}];}_0x260f32=_[_0x18ce('0x3a')]({},_0x260f32,_0x23dc11[_0x18ce('0x3d')]);return db[_0x18ce('0x29')][_0x18ce('0x42')](_0x260f32)[_0x18ce('0x24')](handleEntityNotFound(_0x343876,null))[_0x18ce('0x24')](respondWithResult(_0x343876,null))['catch'](handleError(_0x343876,null));};exports['create']=function(_0x23e583,_0x32421a){return db[_0x18ce('0x29')][_0x18ce('0x43')](_0x23e583['body'],{})[_0x18ce('0x24')](respondWithResult(_0x32421a,0xc9))[_0x18ce('0x40')](handleError(_0x32421a,null));};exports[_0x18ce('0x44')]=function(_0x5c9490,_0x3eaf56){return db[_0x18ce('0x29')][_0x18ce('0x44')]()[_0x18ce('0x24')](respondWithResult(_0x3eaf56,null))[_0x18ce('0x40')](handleError(_0x3eaf56,null));};exports[_0x18ce('0x45')]=function(_0x10d757,_0x5081f7){if(_0x10d757[_0x18ce('0x46')][_0x18ce('0x47')]){delete _0x10d757[_0x18ce('0x46')][_0x18ce('0x47')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x10d757[_0x18ce('0x48')]['id']}})[_0x18ce('0x24')](handleEntityNotFound(_0x5081f7,null))[_0x18ce('0x24')](saveUpdates(_0x10d757['body'],null))['then'](respondWithResult(_0x5081f7,null))['catch'](handleError(_0x5081f7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 607485b..218df1d 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 _0xda81=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory'];(function(_0x4d12ec,_0x250e5c){var _0x3831ea=function(_0x15c9fd){while(--_0x15c9fd){_0x4d12ec['push'](_0x4d12ec['shift']());}};_0x3831ea(++_0x250e5c);}(_0xda81,0x1c3));var _0x1da8=function(_0x54b04b,_0x4b54b1){_0x54b04b=_0x54b04b-0x0;var _0x117535=_0xda81[_0x54b04b];return _0x117535;};'use strict';var _=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var logger=require(_0x1da8('0x2'))('api');var moment=require(_0x1da8('0x3'));var BPromise=require(_0x1da8('0x4'));var rp=require(_0x1da8('0x5'));var fs=require('fs');var path=require(_0x1da8('0x6'));var rimraf=require('rimraf');var config=require(_0x1da8('0x7'));var attributes=require(_0x1da8('0x8'));module['exports']=function(_0x1aef7a,_0x57e8f6){return _0x1aef7a[_0x1da8('0x9')](_0x1da8('0xa'),attributes,{'tableName':_0x1da8('0xb'),'paranoid':![],'indexes':[{'name':_0x1da8('0xc'),'fields':[_0x1da8('0xc')]},{'name':_0x1da8('0xd'),'fields':[_0x1da8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf960=['define','endtime','uniqueid','lodash','../../config/logger','moment','bluebird','path','./cmHopperHistory.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf960,0x193));var _0x0f96=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0xf960[_0x404957];return _0x4e0365;};'use strict';var _=require(_0x0f96('0x0'));var util=require('util');var logger=require(_0x0f96('0x1'))('api');var moment=require(_0x0f96('0x2'));var BPromise=require(_0x0f96('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f96('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0f96('0x5'));module[_0x0f96('0x6')]=function(_0x2811c3,_0x29ab2a){return _0x2811c3[_0x0f96('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x0f96('0x8'),'fields':[_0x0f96('0x8')]},{'name':_0x0f96('0x9'),'fields':[_0x0f96('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index f28fa1f..e5a7d76 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 _0x95c5=['options','raw','stringify','AvgHandleTime','where','sequelize','COUNT','col','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','catch','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x95c5,0x153));var _0x595c=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x95c5[_0x342700];return _0x53406f;};'use strict';var _=require(_0x595c('0x0'));var util=require(_0x595c('0x1'));var moment=require('moment');var BPromise=require(_0x595c('0x2'));var rs=require(_0x595c('0x3'));var fs=require('fs');var Redis=require(_0x595c('0x4'));var db=require(_0x595c('0x5'))['db'];var utils=require(_0x595c('0x6'));var logger=require(_0x595c('0x7'))(_0x595c('0x8'));var config=require(_0x595c('0x9'));var jayson=require(_0x595c('0xa'));var client=jayson[_0x595c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49a115,_0xc9f937,_0xfcaf47){return new BPromise(function(_0x218eca,_0x3b55ad){return client[_0x595c('0xc')](_0x49a115,_0xfcaf47)[_0x595c('0xd')](function(_0x1250e7){logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,'request\x20sent');logger[_0x595c('0x10')](_0x595c('0x11'),_0xc9f937,_0x595c('0x12'),JSON['stringify'](_0x1250e7));if(_0x1250e7[_0x595c('0x13')]){if(_0x1250e7[_0x595c('0x13')][_0x595c('0x14')]===0x1f4){logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x3b55ad(_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);}logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x218eca(_0x1250e7[_0x595c('0x13')]['message']);}else{logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,_0x595c('0x12'));_0x218eca(_0x1250e7[_0x595c('0x16')]['message']);}})['catch'](function(_0x3a2a04){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xc9f937,_0x3a2a04);_0x3b55ad(_0x3a2a04);});});}exports[_0x595c('0x17')]=function(_0xe45721){var _0xe7cf1e=this;return new Promise(function(_0x4f9936,_0x66c9fb){return db[_0x595c('0x18')]['create'](_0xe45721[_0x595c('0x19')],{'raw':_0xe45721[_0x595c('0x1a')]?_0xe45721[_0x595c('0x1a')][_0x595c('0x1b')]===undefined?!![]:![]:!![]})[_0x595c('0xd')](function(_0x3195b8){logger[_0x595c('0xe')](_0x595c('0x17'),_0xe45721);logger[_0x595c('0x10')]('CreateCmHopperHistory',_0xe45721,JSON[_0x595c('0x1c')](_0x3195b8));_0x4f9936(_0x3195b8);})['catch'](function(_0x378eaf){logger[_0x595c('0x13')](_0x595c('0x17'),_0x378eaf[_0x595c('0x15')],_0xe45721);_0x66c9fb(_0xe7cf1e[_0x595c('0x13')](0x1f4,_0x378eaf[_0x595c('0x15')]));});});};exports[_0x595c('0x1d')]=function(_0x1eb0ff){var _0x53ed36=this;return new Promise(function(_0x458cb6,_0x58178e){return db[_0x595c('0x18')]['findAll']({'raw':_0x1eb0ff[_0x595c('0x1a')]?_0x1eb0ff[_0x595c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1eb0ff[_0x595c('0x1a')]?_0x1eb0ff[_0x595c('0x1a')][_0x595c('0x1e')]||null:null,'attributes':[[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')][_0x595c('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x595c('0x1f')]['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x23')))),_0x595c('0x24')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x595c('0x25')))),_0x595c('0x26')],[db[_0x595c('0x1f')]['fn']('AVG',db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x27')))),_0x595c('0x28')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x29'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x2a')))),'predictiveIntervalAvgTalktime']]})[_0x595c('0xd')](function(_0x432ea4){logger['info']('AvgHandleTime',_0x1eb0ff);logger[_0x595c('0x10')](_0x595c('0x1d'),_0x1eb0ff,JSON[_0x595c('0x1c')](_0x432ea4));_0x458cb6(_0x432ea4);})[_0x595c('0x2b')](function(_0x34bc34){logger[_0x595c('0x13')]('AvgHandleTime',_0x34bc34[_0x595c('0x15')],_0x1eb0ff);_0x58178e(_0x53ed36[_0x595c('0x13')](0x1f4,_0x34bc34['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x36af22){var _0x32dae5=this;return new Promise(function(_0x10571c,_0x2be239){return db[_0x595c('0x18')]['findAll']({'raw':_0x36af22[_0x595c('0x1a')]?_0x36af22[_0x595c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x36af22[_0x595c('0x1a')]?_0x36af22['options'][_0x595c('0x1e')]||null:null,'attributes':[[_0x595c('0x2c'),'name'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0x595c('0x2d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x595c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2f')))),_0x595c('0x30')],[db['sequelize']['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x31')))),_0x595c('0x32')],[db['sequelize']['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')](_0x595c('0x33')))),_0x595c('0x34')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x595c('0x35')))),_0x595c('0x36')],[db[_0x595c('0x1f')]['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x595c('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x38')))),'outboundUnknownCallsDay'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x595c('0x39')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')](_0x595c('0x3a')))),_0x595c('0x3b')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x3c')))),_0x595c('0x3d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x3e')))),_0x595c('0x3f')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x40')))),_0x595c('0x3d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x41')))),_0x595c('0x42')]],'group':[_0x595c('0x2c')]})['then'](function(_0x35a292){logger[_0x595c('0xe')]('GetVoiceQueueHopperHistory',_0x36af22);logger[_0x595c('0x10')]('GetVoiceQueueHopperHistory',_0x36af22,JSON['stringify'](_0x35a292));_0x10571c(_0x35a292);})[_0x595c('0x2b')](function(_0x1d1b03){logger[_0x595c('0x13')](_0x595c('0x43'),_0x1d1b03[_0x595c('0x15')],_0x36af22);_0x2be239(_0x32dae5[_0x595c('0x13')](0x1f4,_0x1d1b03['message']));});});};exports[_0x595c('0x44')]=function(_0x23597a){var _0x92d2dd=this;return new Promise(function(_0x554960,_0x2b8243){return db['CmHopperHistory'][_0x595c('0x45')]({'raw':_0x23597a[_0x595c('0x1a')]?_0x23597a[_0x595c('0x1a')][_0x595c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23597a[_0x595c('0x1a')]?_0x23597a[_0x595c('0x1a')]['where']||null:null,'attributes':[[_0x595c('0x2c'),_0x595c('0x46')],[db['sequelize']['fn'](_0x595c('0x20'),db[_0x595c('0x1f')][_0x595c('0x21')]('id')),_0x595c('0x47')],[db['sequelize']['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2f')))),_0x595c('0x48')]],'group':[_0x595c('0x2c')]})[_0x595c('0xd')](function(_0x569f8b){logger[_0x595c('0xe')](_0x595c('0x44'),_0x23597a);logger['debug'](_0x595c('0x44'),_0x23597a,JSON['stringify'](_0x569f8b));_0x554960(_0x569f8b);})[_0x595c('0x2b')](function(_0x5272d4){logger[_0x595c('0x13')](_0x595c('0x44'),_0x5272d4['message'],_0x23597a);_0x2b8243(_0x92d2dd[_0x595c('0x13')](0x1f4,_0x5272d4[_0x595c('0x15')]));});});}; \ No newline at end of file +var _0x1fee=['predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','col','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','then','AvgHandleTime','findAll','raw','COUNT','predictiveIntervalTotalCalls','sequelize','literal','predictiveIntervalAnsweredCalls'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0x1fee,0x12e));var _0xe1fe=function(_0xf4e7a3,_0x27e4df){_0xf4e7a3=_0xf4e7a3-0x0;var _0x294217=_0x1fee[_0xf4e7a3];return _0x294217;};'use strict';var _=require(_0xe1fe('0x0'));var util=require(_0xe1fe('0x1'));var moment=require(_0xe1fe('0x2'));var BPromise=require(_0xe1fe('0x3'));var rs=require(_0xe1fe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe1fe('0x5'))['db'];var utils=require(_0xe1fe('0x6'));var logger=require(_0xe1fe('0x7'))(_0xe1fe('0x8'));var config=require(_0xe1fe('0x9'));var jayson=require(_0xe1fe('0xa'));var client=jayson[_0xe1fe('0xb')][_0xe1fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48462a,_0x5a25b5,_0xcd0968){return new BPromise(function(_0x40bd2e,_0x56ee79){return client[_0xe1fe('0xd')](_0x48462a,_0xcd0968)['then'](function(_0x245ebc){logger[_0xe1fe('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x5a25b5,_0xe1fe('0xf'));logger[_0xe1fe('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5a25b5,_0xe1fe('0xf'),JSON[_0xe1fe('0x11')](_0x245ebc));if(_0x245ebc[_0xe1fe('0x12')]){if(_0x245ebc[_0xe1fe('0x12')][_0xe1fe('0x13')]===0x1f4){logger[_0xe1fe('0x12')](_0xe1fe('0x14'),_0x5a25b5,_0x245ebc[_0xe1fe('0x12')][_0xe1fe('0x15')]);return _0x56ee79(_0x245ebc['error']['message']);}logger[_0xe1fe('0x12')](_0xe1fe('0x14'),_0x5a25b5,_0x245ebc[_0xe1fe('0x12')][_0xe1fe('0x15')]);return _0x40bd2e(_0x245ebc[_0xe1fe('0x12')][_0xe1fe('0x15')]);}else{logger[_0xe1fe('0xe')](_0xe1fe('0x14'),_0x5a25b5,_0xe1fe('0xf'));_0x40bd2e(_0x245ebc[_0xe1fe('0x16')][_0xe1fe('0x15')]);}})[_0xe1fe('0x17')](function(_0x5daa4f){logger[_0xe1fe('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x5a25b5,_0x5daa4f);_0x56ee79(_0x5daa4f);});});}exports[_0xe1fe('0x18')]=function(_0xdc8d47){var _0x59075d=this;return new Promise(function(_0x374b4f,_0x335c69){return db[_0xe1fe('0x19')][_0xe1fe('0x1a')](_0xdc8d47[_0xe1fe('0x1b')],{'raw':_0xdc8d47[_0xe1fe('0x1c')]?_0xdc8d47[_0xe1fe('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xe1fe('0x1d')](function(_0x53f8ed){logger['info'](_0xe1fe('0x18'),_0xdc8d47);logger[_0xe1fe('0x10')](_0xe1fe('0x18'),_0xdc8d47,JSON[_0xe1fe('0x11')](_0x53f8ed));_0x374b4f(_0x53f8ed);})[_0xe1fe('0x17')](function(_0x874a69){logger[_0xe1fe('0x12')]('CreateCmHopperHistory',_0x874a69[_0xe1fe('0x15')],_0xdc8d47);_0x335c69(_0x59075d['error'](0x1f4,_0x874a69[_0xe1fe('0x15')]));});});};exports[_0xe1fe('0x1e')]=function(_0x2da709){var _0x3ee0bc=this;return new Promise(function(_0x29b3da,_0x5304cd){return db[_0xe1fe('0x19')][_0xe1fe('0x1f')]({'raw':_0x2da709[_0xe1fe('0x1c')]?_0x2da709['options'][_0xe1fe('0x20')]===undefined?!![]:![]:!![],'where':_0x2da709[_0xe1fe('0x1c')]?_0x2da709[_0xe1fe('0x1c')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xe1fe('0x21'),db['sequelize']['col']('id')),_0xe1fe('0x22')],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db['sequelize']['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xe1fe('0x25')],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0xe1fe('0x26')],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')](_0xe1fe('0x27')))),_0xe1fe('0x28')],[db['sequelize']['fn'](_0xe1fe('0x29'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x29'),db[_0xe1fe('0x23')]['fn']('IF',db['sequelize']['literal'](_0xe1fe('0x2a')))),_0xe1fe('0x2b')]]})[_0xe1fe('0x1d')](function(_0x5da38f){logger[_0xe1fe('0xe')](_0xe1fe('0x1e'),_0x2da709);logger[_0xe1fe('0x10')](_0xe1fe('0x1e'),_0x2da709,JSON[_0xe1fe('0x11')](_0x5da38f));_0x29b3da(_0x5da38f);})[_0xe1fe('0x17')](function(_0x38be56){logger[_0xe1fe('0x12')](_0xe1fe('0x1e'),_0x38be56[_0xe1fe('0x15')],_0x2da709);_0x5304cd(_0x3ee0bc[_0xe1fe('0x12')](0x1f4,_0x38be56[_0xe1fe('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2e27c4){var _0x7e3b4f=this;return new Promise(function(_0x5e150a,_0x469d9d){return db[_0xe1fe('0x19')]['findAll']({'raw':_0x2e27c4['options']?_0x2e27c4[_0xe1fe('0x1c')][_0xe1fe('0x20')]===undefined?!![]:![]:!![],'where':_0x2e27c4['options']?_0x2e27c4[_0xe1fe('0x1c')][_0xe1fe('0x2c')]||null:null,'attributes':[['campaign',_0xe1fe('0x2d')],[db['sequelize']['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db['sequelize'][_0xe1fe('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0xe1fe('0x2e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')](_0xe1fe('0x2f')))),_0xe1fe('0x30')],[db[_0xe1fe('0x23')]['fn']('COUNT',db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')]['literal'](_0xe1fe('0x31')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db['sequelize'][_0xe1fe('0x24')](_0xe1fe('0x32')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')](_0xe1fe('0x33')))),_0xe1fe('0x34')],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')](_0xe1fe('0x35')))),_0xe1fe('0x36')],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')](_0xe1fe('0x37')))),_0xe1fe('0x38')],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db['sequelize']['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')](_0xe1fe('0x39')))),_0xe1fe('0x3a')],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')]['literal'](_0xe1fe('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0xe1fe('0x23')]['fn']('COUNT',db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),_0xe1fe('0x3c')],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')]['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')](_0xe1fe('0x3d')))),'outboundRejectCallsDay'],[db[_0xe1fe('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xe1fe('0x3e')]],'group':[_0xe1fe('0x3f')]})[_0xe1fe('0x1d')](function(_0x4d0abe){logger[_0xe1fe('0xe')](_0xe1fe('0x40'),_0x2e27c4);logger[_0xe1fe('0x10')](_0xe1fe('0x40'),_0x2e27c4,JSON[_0xe1fe('0x11')](_0x4d0abe));_0x5e150a(_0x4d0abe);})[_0xe1fe('0x17')](function(_0x58c3d7){logger[_0xe1fe('0x12')](_0xe1fe('0x40'),_0x58c3d7['message'],_0x2e27c4);_0x469d9d(_0x7e3b4f[_0xe1fe('0x12')](0x1f4,_0x58c3d7[_0xe1fe('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x3b41cc){var _0x185205=this;return new Promise(function(_0x22e6e6,_0x27e3c1){return db[_0xe1fe('0x19')]['findAll']({'raw':_0x3b41cc[_0xe1fe('0x1c')]?_0x3b41cc[_0xe1fe('0x1c')][_0xe1fe('0x20')]===undefined?!![]:![]:!![],'where':_0x3b41cc[_0xe1fe('0x1c')]?_0x3b41cc['options']['where']||null:null,'attributes':[[_0xe1fe('0x3f'),_0xe1fe('0x2d')],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db[_0xe1fe('0x23')][_0xe1fe('0x41')]('id')),'ivrTotalCallsDays'],[db[_0xe1fe('0x23')]['fn'](_0xe1fe('0x21'),db['sequelize']['fn']('IF',db[_0xe1fe('0x23')][_0xe1fe('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xe1fe('0x42')]],'group':[_0xe1fe('0x3f')]})[_0xe1fe('0x1d')](function(_0xf360e5){logger[_0xe1fe('0xe')](_0xe1fe('0x43'),_0x3b41cc);logger[_0xe1fe('0x10')](_0xe1fe('0x43'),_0x3b41cc,JSON[_0xe1fe('0x11')](_0xf360e5));_0x22e6e6(_0xf360e5);})[_0xe1fe('0x17')](function(_0x23bf80){logger['error']('GetCampaignHopperHistory',_0x23bf80['message'],_0x3b41cc);_0x27e3c1(_0x185205[_0xe1fe('0x12')](0x1f4,_0x23bf80[_0xe1fe('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 815da1b..7d3c60c 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 _0x926f=['fs-extra','../../components/auth/service','./cmHopperHistory.controller','get','/describe','/:id','isAuthenticated','show','post','create','put','update','util','path','express','Router'];(function(_0x400bc6,_0x2535b3){var _0x19b4ab=function(_0x24cde0){while(--_0x24cde0){_0x400bc6['push'](_0x400bc6['shift']());}};_0x19b4ab(++_0x2535b3);}(_0x926f,0xec));var _0xf926=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x926f[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xf926('0x0'));var path=require(_0xf926('0x1'));var timeout=require('connect-timeout');var express=require(_0xf926('0x2'));var router=express[_0xf926('0x3')]();var fs_extra=require(_0xf926('0x4'));var auth=require(_0xf926('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf926('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf926('0x7')](_0xf926('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf926('0x9'),auth[_0xf926('0xa')](),controller[_0xf926('0xb')]);router[_0xf926('0xc')]('/',auth[_0xf926('0xa')](),controller[_0xf926('0xd')]);router[_0xf926('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf926('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe307=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','index','/describe','isAuthenticated','describe','get','post','create','put','exports','multer'];(function(_0x3c76e3,_0x4a23ac){var _0x238a70=function(_0x2bd338){while(--_0x2bd338){_0x3c76e3['push'](_0x3c76e3['shift']());}};_0x238a70(++_0x4a23ac);}(_0xe307,0x19d));var _0x7e30=function(_0x455642,_0x3248cf){_0x455642=_0x455642-0x0;var _0x483a4e=_0xe307[_0x455642];return _0x483a4e;};'use strict';var multer=require(_0x7e30('0x0'));var util=require('util');var path=require(_0x7e30('0x1'));var timeout=require('connect-timeout');var express=require(_0x7e30('0x2'));var router=express[_0x7e30('0x3')]();var fs_extra=require(_0x7e30('0x4'));var auth=require(_0x7e30('0x5'));var interaction=require(_0x7e30('0x6'));var config=require(_0x7e30('0x7'));var controller=require(_0x7e30('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7e30('0x9')]);router['get'](_0x7e30('0xa'),auth[_0x7e30('0xb')](),controller[_0x7e30('0xc')]);router[_0x7e30('0xd')]('/:id',auth[_0x7e30('0xb')](),controller['show']);router[_0x7e30('0xe')]('/',auth[_0x7e30('0xb')](),controller[_0x7e30('0xf')]);router[_0x7e30('0x10')]('/:id',auth[_0x7e30('0xb')](),controller['update']);module[_0x7e30('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index ca7289b..35c0983 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 _0x92f0=['STRING','exports'];(function(_0x200210,_0x30d4ef){var _0x65bc53=function(_0xbe996f){while(--_0xbe996f){_0x200210['push'](_0x200210['shift']());}};_0x65bc53(++_0x30d4ef);}(_0x92f0,0x10d));var _0x092f=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x92f0[_0x1551af];return _0xd8eb82;};'use strict';var Sequelize=require('sequelize');module[_0x092f('0x0')]={'name':{'type':Sequelize[_0x092f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x092f('0x1')]},'dialPrefix':{'type':Sequelize[_0x092f('0x1')]}}; \ No newline at end of file +var _0x746f=['sequelize','exports','STRING','name'];(function(_0x540d48,_0x32e8e8){var _0x446469=function(_0x4033d9){while(--_0x4033d9){_0x540d48['push'](_0x540d48['shift']());}};_0x446469(++_0x32e8e8);}(_0x746f,0x9c));var _0xf746=function(_0x3821cc,_0x3a0a4e){_0x3821cc=_0x3821cc-0x0;var _0x4519cd=_0x746f[_0x3821cc];return _0x4519cd;};'use strict';var Sequelize=require(_0xf746('0x0'));module[_0xf746('0x1')]={'name':{'type':Sequelize[_0xf746('0x2')],'unique':_0xf746('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf746('0x2')]},'dialPrefix':{'type':Sequelize[_0xf746('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index c9083d2..3e0641e 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 _0xdd19=['fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','getDispositions','Disposition','ListId','rows','ids','CmContact','tags','isArray','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','OrderBy','alias','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','select','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','addCustomField','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','UserProfileResource','status','end','error','name','send','index','map','CmList','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xdd19,0x10a));var _0x9dd1=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xdd19[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x9dd1('0x0'));var rimraf=require(_0x9dd1('0x1'));var zipdir=require(_0x9dd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9dd1('0x3'));var moment=require(_0x9dd1('0x4'));var BPromise=require(_0x9dd1('0x5'));var Mustache=require(_0x9dd1('0x6'));var util=require(_0x9dd1('0x7'));var path=require(_0x9dd1('0x8'));var sox=require('sox');var csv=require(_0x9dd1('0x9'));var ejs=require(_0x9dd1('0xa'));var fs=require('fs');var fs_extra=require(_0x9dd1('0xb'));var _=require(_0x9dd1('0xc'));var squel=require(_0x9dd1('0xd'));var crypto=require('crypto');var jsforce=require(_0x9dd1('0xe'));var deskjs=require(_0x9dd1('0xf'));var toCsv=require(_0x9dd1('0x9'));var querystring=require(_0x9dd1('0x10'));var Papa=require(_0x9dd1('0x11'));var Redis=require(_0x9dd1('0x12'));var authService=require(_0x9dd1('0x13'));var qs=require(_0x9dd1('0x14'));var as=require(_0x9dd1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dd1('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x9dd1('0x17'));var licenseUtil=require(_0x9dd1('0x18'));var db=require(_0x9dd1('0x19'))['db'];var csv_results;config[_0x9dd1('0x1a')]=_[_0x9dd1('0x1b')](config['redis'],{'host':_0x9dd1('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9dd1('0x1a')]));require(_0x9dd1('0x1d'))[_0x9dd1('0x1e')](socket);function respondWithStatusCode(_0x228e34,_0x13d04e){_0x13d04e=_0x13d04e||0xcc;return function(_0x369582){if(_0x369582){return _0x228e34[_0x9dd1('0x1f')](_0x13d04e);}return _0x228e34['status'](_0x13d04e)['end']();};}function respondWithResult(_0x10f849,_0xd298b1){_0xd298b1=_0xd298b1||0xc8;return function(_0x3428a1){if(_0x3428a1){return _0x10f849['status'](_0xd298b1)[_0x9dd1('0x20')](_0x3428a1);}};}function respondWithFilteredResult(_0x44607c,_0x4e8cba){return function(_0x1f6f1a){if(_0x1f6f1a){var _0x5b5a43=typeof _0x4e8cba[_0x9dd1('0x21')]===_0x9dd1('0x22')&&typeof _0x4e8cba[_0x9dd1('0x23')]===_0x9dd1('0x22');var _0x1947fc=_0x1f6f1a[_0x9dd1('0x24')];var _0x5a70f9=_0x5b5a43?0x0:_0x4e8cba['offset'];var _0x2a3e2f=_0x5b5a43?_0x1f6f1a[_0x9dd1('0x24')]:_0x4e8cba[_0x9dd1('0x21')]+_0x4e8cba[_0x9dd1('0x23')];var _0x510f22;if(_0x2a3e2f>=_0x1947fc){_0x2a3e2f=_0x1947fc;_0x510f22=0xc8;}else{_0x510f22=0xce;}_0x44607c['status'](_0x510f22);return _0x44607c[_0x9dd1('0x25')](_0x9dd1('0x26'),_0x5a70f9+'-'+_0x2a3e2f+'/'+_0x1947fc)[_0x9dd1('0x20')](_0x1f6f1a);}return null;};}function patchUpdates(_0x136282){return function(_0x3e311c){try{jsonpatch[_0x9dd1('0x27')](_0x3e311c,_0x136282,!![]);}catch(_0x3c6b81){return BPromise[_0x9dd1('0x28')](_0x3c6b81);}return _0x3e311c['save']();};}function saveUpdates(_0x33455f,_0x302eef){return function(_0x43576e){if(_0x43576e){return _0x43576e['update'](_0x33455f)[_0x9dd1('0x29')](function(_0x19868c){return _0x19868c;});}return null;};}function removeEntity(_0x30a3a8,_0x72da7c){return function(_0x1a63b3){if(_0x1a63b3){return _0x1a63b3[_0x9dd1('0x2a')]()['then'](function(){var _0x55d386=_0x1a63b3['get']({'plain':!![]});var _0x3b6ad4='Lists';return db[_0x9dd1('0x2b')][_0x9dd1('0x2a')]({'where':{'type':_0x3b6ad4,'resourceId':_0x55d386['id']}})['then'](function(){return _0x1a63b3;});})[_0x9dd1('0x29')](function(){_0x30a3a8[_0x9dd1('0x2c')](0xcc)[_0x9dd1('0x2d')]();});}};}function handleEntityNotFound(_0xe2dde,_0x4ec2e5){return function(_0x4fca27){if(!_0x4fca27){_0xe2dde[_0x9dd1('0x1f')](0x194);}return _0x4fca27;};}function handleError(_0x55a349,_0x508f0b){_0x508f0b=_0x508f0b||0x1f4;return function(_0x4e689f){logger[_0x9dd1('0x2e')](_0x4e689f['stack']);if(_0x4e689f[_0x9dd1('0x2f')]){delete _0x4e689f[_0x9dd1('0x2f')];}_0x55a349[_0x9dd1('0x2c')](_0x508f0b)[_0x9dd1('0x30')](_0x4e689f);};}exports[_0x9dd1('0x31')]=function(_0x51e559,_0x185b0a){var _0x4cfd39={},_0x39791a={},_0x78fb12={'count':0x0,'rows':[]};var _0x304848=_[_0x9dd1('0x32')](db[_0x9dd1('0x33')]['rawAttributes'],function(_0x5a2446){return{'name':_0x5a2446[_0x9dd1('0x34')],'type':_0x5a2446[_0x9dd1('0x35')][_0x9dd1('0x36')]};});_0x39791a['model']=_['map'](_0x304848,_0x9dd1('0x2f'));_0x39791a[_0x9dd1('0x37')]=_[_0x9dd1('0x38')](_0x51e559[_0x9dd1('0x37')]);_0x39791a[_0x9dd1('0x39')]=_[_0x9dd1('0x3a')](_0x39791a[_0x9dd1('0x3b')],_0x39791a['query']);_0x4cfd39['attributes']=_['intersection'](_0x39791a[_0x9dd1('0x3b')],qs[_0x9dd1('0x3c')](_0x51e559['query'][_0x9dd1('0x3c')]));_0x4cfd39[_0x9dd1('0x3d')]=_0x4cfd39[_0x9dd1('0x3d')]['length']?_0x4cfd39[_0x9dd1('0x3d')]:_0x39791a[_0x9dd1('0x3b')];if(!_0x51e559[_0x9dd1('0x37')]['hasOwnProperty'](_0x9dd1('0x3e'))){_0x4cfd39['limit']=qs['limit'](_0x51e559[_0x9dd1('0x37')][_0x9dd1('0x23')]);_0x4cfd39['offset']=qs['offset'](_0x51e559['query'][_0x9dd1('0x21')]);}_0x4cfd39[_0x9dd1('0x3f')]=qs['sort'](_0x51e559['query'][_0x9dd1('0x40')]);_0x4cfd39[_0x9dd1('0x41')]=qs['filters'](_[_0x9dd1('0x42')](_0x51e559[_0x9dd1('0x37')],_0x39791a[_0x9dd1('0x39')]),_0x304848);if(_0x51e559[_0x9dd1('0x37')][_0x9dd1('0x43')]){_0x4cfd39[_0x9dd1('0x41')]=_[_0x9dd1('0x44')](_0x4cfd39[_0x9dd1('0x41')],{'$or':_[_0x9dd1('0x32')](_0x304848,function(_0x4daedc){if(_0x4daedc[_0x9dd1('0x35')]!==_0x9dd1('0x45')){var _0x4d5175={};_0x4d5175[_0x4daedc[_0x9dd1('0x2f')]]={'$like':'%'+_0x51e559[_0x9dd1('0x37')][_0x9dd1('0x43')]+'%'};return _0x4d5175;}})});}_0x4cfd39=_['merge']({},_0x4cfd39,_0x51e559['options']);var _0x8c214b={'where':_0x4cfd39[_0x9dd1('0x41')]};return db[_0x9dd1('0x33')][_0x9dd1('0x24')](_0x8c214b)[_0x9dd1('0x29')](function(_0x128603){_0x78fb12['count']=_0x128603;if(_0x51e559[_0x9dd1('0x37')][_0x9dd1('0x46')]){_0x4cfd39[_0x9dd1('0x47')]=[{'all':!![]}];}return db[_0x9dd1('0x33')][_0x9dd1('0x48')](_0x4cfd39);})[_0x9dd1('0x29')](function(_0xf39d89){_0x78fb12['rows']=_0xf39d89;return _0x78fb12;})['then'](respondWithFilteredResult(_0x185b0a,_0x4cfd39))['catch'](handleError(_0x185b0a,null));};exports[_0x9dd1('0x49')]=function(_0x338cb1,_0xc5864a){var _0x183203={'raw':![],'where':{'id':_0x338cb1[_0x9dd1('0x4a')]['id']}},_0x2da507={};_0x2da507[_0x9dd1('0x3b')]=_[_0x9dd1('0x38')](db[_0x9dd1('0x33')][_0x9dd1('0x4b')]);_0x2da507[_0x9dd1('0x37')]=_['keys'](_0x338cb1[_0x9dd1('0x37')]);_0x2da507[_0x9dd1('0x39')]=_['intersection'](_0x2da507[_0x9dd1('0x3b')],_0x2da507[_0x9dd1('0x37')]);_0x183203[_0x9dd1('0x3d')]=_['intersection'](_0x2da507[_0x9dd1('0x3b')],qs['fields'](_0x338cb1['query'][_0x9dd1('0x3c')]));_0x183203[_0x9dd1('0x3d')]=_0x183203['attributes'][_0x9dd1('0x4c')]?_0x183203[_0x9dd1('0x3d')]:_0x2da507[_0x9dd1('0x3b')];if(_0x338cb1[_0x9dd1('0x37')][_0x9dd1('0x46')]){_0x183203[_0x9dd1('0x47')]=[{'all':!![]}];}_0x183203=_[_0x9dd1('0x44')]({},_0x183203,_0x338cb1[_0x9dd1('0x4d')]);return db['CmList'][_0x9dd1('0x4e')](_0x183203)[_0x9dd1('0x29')](handleEntityNotFound(_0xc5864a,null))[_0x9dd1('0x29')](respondWithResult(_0xc5864a,null))['catch'](handleError(_0xc5864a,null));};exports[_0x9dd1('0x4f')]=function(_0x3ec33a,_0x2fb43c){return db[_0x9dd1('0x33')][_0x9dd1('0x4f')](_0x3ec33a[_0x9dd1('0x50')],{})[_0x9dd1('0x29')](function(_0x5a27c1){var _0x5da32d=_0x3ec33a[_0x9dd1('0x51')][_0x9dd1('0x52')]({'plain':!![]});if(!_0x5da32d)throw new Error(_0x9dd1('0x53'));if(_0x5da32d[_0x9dd1('0x54')]===_0x9dd1('0x51')){var _0x3d9038=_0x5a27c1[_0x9dd1('0x52')]({'plain':!![]});var _0x3e7c63=_0x9dd1('0x55');return db[_0x9dd1('0x56')][_0x9dd1('0x4e')]({'where':{'name':_0x3e7c63,'userProfileId':_0x5da32d[_0x9dd1('0x57')]},'raw':!![]})[_0x9dd1('0x29')](function(_0x421355){if(_0x421355&&_0x421355[_0x9dd1('0x58')]===0x0){return db['UserProfileResource'][_0x9dd1('0x4f')]({'name':_0x3d9038[_0x9dd1('0x2f')],'resourceId':_0x3d9038['id'],'type':_0x421355[_0x9dd1('0x2f')],'sectionId':_0x421355['id']},{})['then'](function(){return _0x5a27c1;});}else{return _0x5a27c1;}})[_0x9dd1('0x59')](function(_0x3a04cb){logger[_0x9dd1('0x2e')](_0x9dd1('0x5a'),_0x3a04cb);throw _0x3a04cb;});}return _0x5a27c1;})['then'](respondWithResult(_0x2fb43c,0xc9))[_0x9dd1('0x59')](handleError(_0x2fb43c,null));};exports[_0x9dd1('0x5b')]=function(_0x2aee11,_0x4aee2b){if(_0x2aee11['body']['id']){delete _0x2aee11[_0x9dd1('0x50')]['id'];}return db[_0x9dd1('0x33')][_0x9dd1('0x4e')]({'where':{'id':_0x2aee11[_0x9dd1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4aee2b,null))[_0x9dd1('0x29')](saveUpdates(_0x2aee11['body'],null))[_0x9dd1('0x29')](respondWithResult(_0x4aee2b,null))[_0x9dd1('0x59')](handleError(_0x4aee2b,null));};exports[_0x9dd1('0x2a')]=function(_0x244f74,_0x3e3f55){return db[_0x9dd1('0x33')]['find']({'where':{'id':_0x244f74[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x3e3f55,null))[_0x9dd1('0x29')](removeEntity(_0x3e3f55,null))['catch'](handleError(_0x3e3f55,null));};exports[_0x9dd1('0x5c')]=function(_0x4613d1,_0x382758){return db[_0x9dd1('0x33')][_0x9dd1('0x5c')]()[_0x9dd1('0x29')](respondWithResult(_0x382758,null))['catch'](handleError(_0x382758,null));};exports[_0x9dd1('0x5d')]=function(_0x3e8267,_0x254c15,_0x4b8e18){if(_0x3e8267['body']['id']){delete _0x3e8267[_0x9dd1('0x50')]['id'];}return db[_0x9dd1('0x33')][_0x9dd1('0x4e')]({'where':{'id':_0x3e8267['params']['id']}})['then'](handleEntityNotFound(_0x254c15,null))[_0x9dd1('0x29')](function(_0x5ab1a2){if(_0x5ab1a2){_0x3e8267[_0x9dd1('0x50')]['ListId']=_0x5ab1a2['id'];return db['Disposition']['create'](_0x3e8267[_0x9dd1('0x50')]);}})[_0x9dd1('0x29')](respondWithResult(_0x254c15,null))[_0x9dd1('0x59')](handleError(_0x254c15,null));};exports[_0x9dd1('0x5e')]=function(_0x46977c,_0x213b84,_0x41f756){var _0x247f5a={'raw':![],'where':{}};var _0x1b9368={};var _0x503877={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x46977c[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x213b84,null))[_0x9dd1('0x29')](function(_0x5449d6){if(_0x5449d6){_0x1b9368[_0x9dd1('0x3b')]=_[_0x9dd1('0x38')](db[_0x9dd1('0x5f')][_0x9dd1('0x4b')]);_0x1b9368['query']=_[_0x9dd1('0x38')](_0x46977c[_0x9dd1('0x37')]);_0x1b9368[_0x9dd1('0x39')]=_[_0x9dd1('0x3a')](_0x1b9368[_0x9dd1('0x3b')],_0x1b9368['query']);_0x247f5a[_0x9dd1('0x3d')]=_[_0x9dd1('0x3a')](_0x1b9368['model'],qs[_0x9dd1('0x3c')](_0x46977c[_0x9dd1('0x37')]['fields']));_0x247f5a[_0x9dd1('0x3d')]=_0x247f5a['attributes'][_0x9dd1('0x4c')]?_0x247f5a[_0x9dd1('0x3d')]:_0x1b9368[_0x9dd1('0x3b')];if(!_0x46977c[_0x9dd1('0x37')]['hasOwnProperty'](_0x9dd1('0x3e'))){_0x247f5a[_0x9dd1('0x23')]=qs[_0x9dd1('0x23')](_0x46977c[_0x9dd1('0x37')]['limit']);_0x247f5a[_0x9dd1('0x21')]=qs[_0x9dd1('0x21')](_0x46977c['query']['offset']);}_0x247f5a[_0x9dd1('0x3f')]=qs['sort'](_0x46977c[_0x9dd1('0x37')]['sort']);_0x247f5a[_0x9dd1('0x41')]=qs[_0x9dd1('0x39')](_[_0x9dd1('0x42')](_0x46977c[_0x9dd1('0x37')],_0x1b9368[_0x9dd1('0x39')]));_0x247f5a[_0x9dd1('0x41')][_0x9dd1('0x60')]=_0x5449d6['id'];if(_0x46977c[_0x9dd1('0x37')][_0x9dd1('0x43')]){_0x247f5a['where']=_[_0x9dd1('0x44')](_0x247f5a[_0x9dd1('0x41')],{'$or':_[_0x9dd1('0x32')](_0x247f5a[_0x9dd1('0x3d')],function(_0x1d46a1){var _0x1ba3c4={};_0x1ba3c4[_0x1d46a1]={'$like':'%'+_0x46977c[_0x9dd1('0x37')][_0x9dd1('0x43')]+'%'};return _0x1ba3c4;})});}_0x247f5a=_['merge']({},_0x247f5a,_0x46977c[_0x9dd1('0x4d')]);return db[_0x9dd1('0x5f')]['count']({'where':_0x247f5a[_0x9dd1('0x41')]})[_0x9dd1('0x29')](function(_0x720e08){_0x503877[_0x9dd1('0x24')]=_0x720e08;if(_0x46977c[_0x9dd1('0x37')]['includeAll']){_0x247f5a[_0x9dd1('0x47')]=[{'all':!![]}];}return db[_0x9dd1('0x5f')][_0x9dd1('0x48')](_0x247f5a);})[_0x9dd1('0x29')](function(_0x205291){_0x503877[_0x9dd1('0x61')]=_0x205291;return _0x503877;});}})[_0x9dd1('0x29')](respondWithFilteredResult(_0x213b84,_0x247f5a))[_0x9dd1('0x59')](handleError(_0x213b84,null));};exports['removeDispositions']=function(_0x44a287,_0x1292f6,_0xcc21c){return db[_0x9dd1('0x33')][_0x9dd1('0x4e')]({'where':{'id':_0x44a287[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x1292f6,null))['then'](function(_0x5e9546){if(_0x5e9546){return _0x5e9546['removeDispositions'](_0x44a287[_0x9dd1('0x37')][_0x9dd1('0x62')]);}})[_0x9dd1('0x29')](respondWithStatusCode(_0x1292f6,null))['catch'](handleError(_0x1292f6,null));};exports['addContacts']=function(_0x9262e3,_0x35b8f9,_0x2f8104){return db['CmList'][_0x9dd1('0x4e')]({'where':{'id':_0x9262e3[_0x9dd1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35b8f9,null))[_0x9dd1('0x29')](function(_0x43d634){if(_0x43d634){var _0x2a8d3b=[];var _0x477a9c={'success':[],'errors':[]};return db[_0x9dd1('0x63')]['describe']()[_0x9dd1('0x29')](function(_0x4dac6b){if(_0x9262e3['body'][_0x9dd1('0x64')]&&_['isArray'](_0x9262e3[_0x9dd1('0x50')][_0x9dd1('0x64')])){if(_0x9262e3[_0x9dd1('0x50')][_0x9dd1('0x64')][_0x9dd1('0x4c')]){_0x9262e3['body'][_0x9dd1('0x64')]=_0x9262e3[_0x9dd1('0x50')]['tags']['join'](';')+';';}else{_0x9262e3[_0x9dd1('0x50')][_0x9dd1('0x64')]=null;}}else{_0x9262e3[_0x9dd1('0x50')]['tags']=null;}if(_0x9262e3[_0x9dd1('0x50')]&&_[_0x9dd1('0x65')](_0x9262e3[_0x9dd1('0x50')])){for(var _0x515739=0x0;_0x515739<_0x9262e3[_0x9dd1('0x50')]['length'];_0x515739+=0x1){_0x9262e3[_0x9dd1('0x50')][_0x515739][_0x9dd1('0x60')]=_0x9262e3[_0x9dd1('0x4a')]['id'];_0x2a8d3b[_0x9dd1('0x66')](_0x9262e3[_0x9dd1('0x50')][_0x515739]);}return BPromise[_0x9dd1('0x67')](_0x2a8d3b,function(_0x576233){return db['CmContact'][_0x9dd1('0x4f')](_[_0x9dd1('0x68')](_0x576233,[_0x9dd1('0x62'),'id'])||{},{'fields':_['keys'](_0x4dac6b),'raw':!![]})[_0x9dd1('0x29')](function(_0x1b3714){_0x477a9c[_0x9dd1('0x69')][_0x9dd1('0x66')](_0x1b3714[_0x9dd1('0x6a')]);})['catch'](function(_0xdcbf64){_0x477a9c['errors']['push']({'data':_0x576233,'error':_0xdcbf64[_0x9dd1('0x6b')]});});})[_0x9dd1('0x29')](function(_0x12715f){return _0x477a9c;})['catch'](function(_0x38f0da){return _0x38f0da;});}else{_0x35b8f9[_0x9dd1('0x2c')](0x190)[_0x9dd1('0x20')]({'message':_0x9dd1('0x6c')});}});}})['then'](respondWithResult(_0x35b8f9,null))[_0x9dd1('0x59')](handleError(_0x35b8f9,null));};exports['getContacts']=function(_0x97c664,_0x503b2e,_0x5a3f01){var _0x277b66;return db[_0x9dd1('0x33')][_0x9dd1('0x4e')]({'where':{'id':_0x97c664[_0x9dd1('0x4a')]['id']},'include':[{'model':db[_0x9dd1('0x6d')],'as':_0x9dd1('0x6e')}]})['then'](handleEntityNotFound(_0x503b2e,null))[_0x9dd1('0x29')](function(_0x5bf124){if(_0x5bf124){_0x277b66=_0x5bf124;return db[_0x9dd1('0x63')][_0x9dd1('0x4b')];}})['then'](function(_0x2b163e){if(_0x2b163e){var _0x5d3ddf={};var _0x8f304d={};_0x8f304d[_0x9dd1('0x3b')]=_[_0x9dd1('0x6f')](_['keys'](_0x2b163e),_[_0x9dd1('0x32')](_0x277b66['CustomFields'],function(_0x4e4c09){return util[_0x9dd1('0x70')](_0x9dd1('0x71'),_0x4e4c09['id']);}));_0x8f304d[_0x9dd1('0x37')]=_[_0x9dd1('0x38')](_0x97c664['query']);_0x8f304d['filters']=_[_0x9dd1('0x3a')](_0x8f304d[_0x9dd1('0x3b')],_0x8f304d[_0x9dd1('0x37')]);_0x5d3ddf['attributes']=_['intersection'](_0x8f304d[_0x9dd1('0x3b')],qs[_0x9dd1('0x3c')](_0x97c664[_0x9dd1('0x37')][_0x9dd1('0x3c')]));_0x5d3ddf['attributes']=_0x5d3ddf[_0x9dd1('0x3d')][_0x9dd1('0x4c')]?_0x5d3ddf[_0x9dd1('0x3d')]:_0x8f304d['model'];if(!_0x97c664[_0x9dd1('0x37')]['hasOwnProperty'](_0x9dd1('0x3e'))){_0x5d3ddf['limit']=qs['limit'](_0x97c664['query'][_0x9dd1('0x23')]);_0x5d3ddf[_0x9dd1('0x21')]=qs[_0x9dd1('0x21')](_0x97c664[_0x9dd1('0x37')][_0x9dd1('0x21')]);}_0x5d3ddf[_0x9dd1('0x3f')]=qs[_0x9dd1('0x40')](_0x97c664[_0x9dd1('0x37')][_0x9dd1('0x40')]);_0x5d3ddf[_0x9dd1('0x41')]=qs[_0x9dd1('0x39')](_[_0x9dd1('0x42')](_0x97c664['query'],_0x8f304d[_0x9dd1('0x39')]));_0x5d3ddf[_0x9dd1('0x72')]=!![];if(_0x97c664[_0x9dd1('0x37')]['filter']){_0x5d3ddf[_0x9dd1('0x41')]=_['merge'](_0x5d3ddf['where'],{'$or':_['map'](_0x5d3ddf[_0x9dd1('0x3d')],function(_0x27e491){var _0x3cfac9={};_0x3cfac9[_0x27e491]={'$like':'%'+_0x97c664['query']['filter']+'%'};return _0x3cfac9;})});}_0x5d3ddf=_['merge']({},_0x5d3ddf,_0x97c664[_0x9dd1('0x4d')]);return _0x277b66[_0x9dd1('0x73')](_0x5d3ddf);}})[_0x9dd1('0x29')](respondWithResult(_0x503b2e,null))[_0x9dd1('0x59')](handleError(_0x503b2e,null));};exports[_0x9dd1('0x74')]=function(_0x386c21,_0x16ffa6,_0x408b2f){var _0x47b923;var _0x4a4616;var _0x19f13d;var _0x2d04be=_0x386c21[_0x9dd1('0x4a')]['id'];csv_results=[];return db['ContactItemType'][_0x9dd1('0x48')]({'attributes':['id','name'],'raw':!![],'order':[_0x9dd1('0x75')]})[_0x9dd1('0x29')](function(_0x3130c3){_0x47b923=_0x3130c3;var _0xa42c80=_['keys'](db[_0x9dd1('0x63')][_0x9dd1('0x4b')]);return db[_0x9dd1('0x6d')][_0x9dd1('0x48')]({'raw':!![],'attributes':['id',_0x9dd1('0x76')]})[_0x9dd1('0x29')](function(_0x2c4fd8){_0x4a4616=_0x2c4fd8;var _0x38ddb1=squel['select']()['fields'](_0xa42c80)[_0x9dd1('0x77')](_0x9dd1('0x78'),'c')[_0x9dd1('0x41')]('c.ListId\x20=\x20?',_0x2d04be)[_0x9dd1('0x41')](_0x9dd1('0x79'))[_0x9dd1('0x7a')]();for(var _0x39b4ea=0x0;_0x39b4ea<_0x4a4616[_0x9dd1('0x4c')];_0x39b4ea++){_0x38ddb1['field'](_0x9dd1('0x7b')+_0x4a4616[_0x39b4ea]['id'],_0x9dd1('0x7c')+_0x4a4616[_0x39b4ea][_0x9dd1('0x76')]);}for(var _0x39b4ea=0x0;_0x39b4ea<_0x47b923[_0x9dd1('0x4c')];_0x39b4ea++){_0x38ddb1[_0x9dd1('0x7d')](squel[_0x9dd1('0x7e')]()['field'](_0x9dd1('0x7f'))[_0x9dd1('0x77')](_0x9dd1('0x80'))['where']('ItemTypeId\x20=\x20?',_0x47b923[_0x39b4ea]['id'])[_0x9dd1('0x41')](_0x9dd1('0x81')),_0x9dd1('0x82')+_0x47b923[_0x39b4ea][_0x9dd1('0x2f')]);_0x38ddb1['field'](squel['select']()['field'](_0x9dd1('0x83'))[_0x9dd1('0x77')]('cm_contact_has_items')[_0x9dd1('0x41')]('ItemTypeId\x20=\x20?',_0x47b923[_0x39b4ea]['id'])[_0x9dd1('0x41')]('CmContactId\x20=\x20c.id'),_0x9dd1('0x84')+_0x47b923[_0x39b4ea][_0x9dd1('0x2f')]);}var _0x1662f7=[];_0x1662f7['push'](_0x38ddb1[_0x9dd1('0x85')]());BPromise[_0x9dd1('0x67')](_0x1662f7,handleQuery)[_0x9dd1('0x29')](function(_0x5ae787){handleQuery(_0x38ddb1['toString']());var _0x558fa5=csv_results[0x0];if(!_[_0x9dd1('0x86')](_0x558fa5)){var _0x584da7=toCsv(_0x558fa5);var _0x3c1033=Date['now']();fs[_0x9dd1('0x87')](util['format'](_0x9dd1('0x88'),_0x2d04be,_0x3c1033),_0x584da7);_0x16ffa6['setHeader'](_0x9dd1('0x89'),_0x9dd1('0x8a')+util[_0x9dd1('0x70')](_0x9dd1('0x8b'),_0x2d04be,_0x3c1033));_0x16ffa6[_0x9dd1('0x8c')](_0x9dd1('0x8d'),'text/csv');return _0x16ffa6['download'](util[_0x9dd1('0x70')](_0x9dd1('0x88'),_0x2d04be,_0x3c1033));}else{return _0x16ffa6[_0x9dd1('0x1f')](0xcc);}});});});};exports[_0x9dd1('0x8e')]=function(_0xe67ebd,_0x48594a,_0x5c01cd){var _0x344641;delete _0xe67ebd['body']['id'];return db[_0x9dd1('0x33')][_0x9dd1('0x8f')]({'where':{'id':_0xe67ebd[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x48594a,null))[_0x9dd1('0x29')](function(_0x52a4a9){if(_0x52a4a9){return db[_0x9dd1('0x90')]['transaction'](function(_0x559aff){return db[_0x9dd1('0x6d')][_0x9dd1('0x4f')](_0xe67ebd[_0x9dd1('0x50')],{'transaction':_0x559aff})[_0x9dd1('0x29')](function(_0x21d1df){_0x344641=_0x21d1df;return _0x52a4a9[_0x9dd1('0x91')](_0x21d1df,{'transaction':_0x559aff});})[_0x9dd1('0x29')](function(){var _0x1e8389={'type':db[_0x9dd1('0x92')][_0x9dd1('0x93')],'transaction':_0x559aff};switch(_0xe67ebd['body'][_0x9dd1('0x35')]){case _0x9dd1('0x94'):_0x1e8389[_0x9dd1('0x35')]=db['Sequelize']['TEXT'];break;case'number':_0x1e8389['type']=db[_0x9dd1('0x92')][_0x9dd1('0x95')];break;case _0x9dd1('0x96'):_0x1e8389['type']=db[_0x9dd1('0x92')]['BOOLEAN'];_0x1e8389['defaultValue']=![];break;default:}return db[_0x9dd1('0x90')][_0x9dd1('0x97')][_0x9dd1('0x98')](_0x9dd1('0x78'),util['format'](_0x9dd1('0x99'),_0x344641['id']),_0x1e8389);})[_0x9dd1('0x29')](function(){return _0x344641;});});}})['then'](respondWithResult(_0x48594a,null))[_0x9dd1('0x59')](handleError(_0x48594a,null));};exports[_0x9dd1('0x9a')]=function(_0x416cd8,_0x533ad6,_0x490558){var _0x29a952={};var _0x1ba0b2={};var _0x4e51f7;var _0x24d72d;return db['CmList']['findOne']({'where':{'id':_0x416cd8[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x533ad6,null))['then'](function(_0xeae765){if(_0xeae765){_0x4e51f7=_0xeae765;_0x1ba0b2[_0x9dd1('0x3b')]=_[_0x9dd1('0x38')](db['CmCustomField']['rawAttributes']);_0x1ba0b2[_0x9dd1('0x37')]=_[_0x9dd1('0x38')](_0x416cd8['query']);_0x1ba0b2[_0x9dd1('0x39')]=_[_0x9dd1('0x3a')](_0x1ba0b2['model'],_0x1ba0b2[_0x9dd1('0x37')]);_0x29a952['attributes']=_['intersection'](_0x1ba0b2[_0x9dd1('0x3b')],qs['fields'](_0x416cd8[_0x9dd1('0x37')][_0x9dd1('0x3c')]));_0x29a952[_0x9dd1('0x3d')]=_0x29a952[_0x9dd1('0x3d')][_0x9dd1('0x4c')]?_0x29a952['attributes']:_0x1ba0b2['model'];_0x29a952[_0x9dd1('0x3f')]=qs[_0x9dd1('0x40')](_0x416cd8[_0x9dd1('0x37')][_0x9dd1('0x40')]);_0x29a952[_0x9dd1('0x41')]=qs[_0x9dd1('0x39')](_['pick'](_0x416cd8[_0x9dd1('0x37')],_0x1ba0b2[_0x9dd1('0x39')]));_0x29a952[_0x9dd1('0x41')]=_[_0x9dd1('0x44')](_0x29a952[_0x9dd1('0x41')],{'$or':[{'ListId':_0xeae765['id']},{'ListId':null}]});if(_0x416cd8[_0x9dd1('0x37')][_0x9dd1('0x43')]){_0x29a952[_0x9dd1('0x41')]=_[_0x9dd1('0x44')](_0x29a952[_0x9dd1('0x41')],{'$or':_['map'](_0x29a952[_0x9dd1('0x3d')],function(_0x345588){var _0x49d6a5={};_0x49d6a5[_0x345588]={'$like':'%'+_0x416cd8['query'][_0x9dd1('0x43')]+'%'};return _0x49d6a5;})});}_0x29a952=_[_0x9dd1('0x44')]({},_0x29a952,_0x416cd8['options']);return db[_0x9dd1('0x6d')]['findAndCountAll'](_0x29a952);}})[_0x9dd1('0x29')](respondWithResult(_0x533ad6,null))[_0x9dd1('0x59')](handleError(_0x533ad6,null));};exports[_0x9dd1('0x9b')]=function(_0x14f4bf,_0x39b790){return db[_0x9dd1('0x6d')][_0x9dd1('0x9c')]({'where':{'ListId':null}})[_0x9dd1('0x29')](handleEntityNotFound(_0x39b790,null))['then'](function(_0xcd2f6d){return _0xcd2f6d;})['then'](respondWithResult(_0x39b790,null))['catch'](handleError(_0x39b790,null));};exports[_0x9dd1('0x9d')]=function(_0x9bdfc9,_0x66b36,_0x40a832){return db[_0x9dd1('0x33')]['find']({'where':{'id':_0x9bdfc9[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x66b36,null))[_0x9dd1('0x29')](function(_0x4b9803){if(_0x4b9803){return _0x4b9803[_0x9dd1('0x9d')](_0x9bdfc9[_0x9dd1('0x50')][_0x9dd1('0x62')],_['omit'](_0x9bdfc9[_0x9dd1('0x50')],['ids','id'])||{})['spread'](function(_0x35e5c5){for(var _0x51409f=0x0;_0x51409f<_0x9bdfc9['body'][_0x9dd1('0x62')]['length'];_0x51409f+=0x1){socket[_0x9dd1('0x9e')]('userCmList:save',{'UserId':Number(_0x9bdfc9[_0x9dd1('0x50')][_0x9dd1('0x62')][_0x51409f]),'CmListId':Number(_0x9bdfc9[_0x9dd1('0x4a')]['id'])});}return _0x35e5c5;});}})[_0x9dd1('0x29')](respondWithResult(_0x66b36,null))[_0x9dd1('0x59')](handleError(_0x66b36,null));};exports[_0x9dd1('0x9f')]=function(_0x3f9a14,_0x3cc809,_0x5b0e55){return db['CmList'][_0x9dd1('0x4e')]({'where':{'id':_0x3f9a14[_0x9dd1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3cc809,null))[_0x9dd1('0x29')](function(_0x3b6738){if(_0x3b6738){return _0x3b6738[_0x9dd1('0x9f')](_0x3f9a14[_0x9dd1('0x37')][_0x9dd1('0x62')])[_0x9dd1('0x29')](function(){if(_[_0x9dd1('0x65')](_0x3f9a14['query'][_0x9dd1('0x62')])){for(var _0x412aa7=0x0;_0x412aa7<_0x3f9a14[_0x9dd1('0x37')][_0x9dd1('0x62')][_0x9dd1('0x4c')];_0x412aa7+=0x1){socket[_0x9dd1('0x9e')](_0x9dd1('0xa0'),{'UserId':Number(_0x3f9a14['query'][_0x9dd1('0x62')][_0x412aa7]),'CmListId':Number(_0x3f9a14[_0x9dd1('0x4a')]['id'])});}}else{socket['emit'](_0x9dd1('0xa0'),{'UserId':Number(_0x3f9a14[_0x9dd1('0x37')][_0x9dd1('0x62')]),'CmListId':Number(_0x3f9a14[_0x9dd1('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3cc809,null))['catch'](handleError(_0x3cc809,null));};exports[_0x9dd1('0xa1')]=function(_0x7a054b,_0x219536,_0x3e63aa){var _0x5832d3={};var _0x33f197={};var _0x5bf4af;var _0x54a17e;return db['CmList'][_0x9dd1('0x8f')]({'where':{'id':_0x7a054b[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x219536,null))[_0x9dd1('0x29')](function(_0x2cbea8){if(_0x2cbea8){_0x5bf4af=_0x2cbea8;_0x33f197[_0x9dd1('0x3b')]=_[_0x9dd1('0x38')](db['User'][_0x9dd1('0x4b')]);_0x33f197['query']=_[_0x9dd1('0x38')](_0x7a054b[_0x9dd1('0x37')]);_0x33f197[_0x9dd1('0x39')]=_['intersection'](_0x33f197[_0x9dd1('0x3b')],_0x33f197[_0x9dd1('0x37')]);_0x5832d3[_0x9dd1('0x3d')]=_[_0x9dd1('0x3a')](_0x33f197[_0x9dd1('0x3b')],qs['fields'](_0x7a054b['query'][_0x9dd1('0x3c')]));_0x5832d3['attributes']=_0x5832d3[_0x9dd1('0x3d')][_0x9dd1('0x4c')]?_0x5832d3[_0x9dd1('0x3d')]:_0x33f197[_0x9dd1('0x3b')];_0x5832d3[_0x9dd1('0x3f')]=qs['sort'](_0x7a054b['query'][_0x9dd1('0x40')]);_0x5832d3[_0x9dd1('0x41')]=qs[_0x9dd1('0x39')](_[_0x9dd1('0x42')](_0x7a054b[_0x9dd1('0x37')],_0x33f197[_0x9dd1('0x39')]));if(_0x7a054b[_0x9dd1('0x37')][_0x9dd1('0x43')]){_0x5832d3[_0x9dd1('0x41')]=_[_0x9dd1('0x44')](_0x5832d3[_0x9dd1('0x41')],{'$or':_[_0x9dd1('0x32')](_0x5832d3[_0x9dd1('0x3d')],function(_0x100c75){var _0x475d59={};_0x475d59[_0x100c75]={'$like':'%'+_0x7a054b['query'][_0x9dd1('0x43')]+'%'};return _0x475d59;})});}_0x5832d3=_[_0x9dd1('0x44')]({},_0x5832d3,_0x7a054b['options']);return _0x5bf4af[_0x9dd1('0xa1')](_0x5832d3);}})[_0x9dd1('0x29')](function(_0x25e005){if(_0x25e005){_0x54a17e=_0x25e005[_0x9dd1('0x4c')];if(!_0x7a054b[_0x9dd1('0x37')]['hasOwnProperty'](_0x9dd1('0x3e'))){_0x5832d3[_0x9dd1('0x23')]=qs[_0x9dd1('0x23')](_0x7a054b['query'][_0x9dd1('0x23')]);_0x5832d3[_0x9dd1('0x21')]=qs['offset'](_0x7a054b['query'][_0x9dd1('0x21')]);}return _0x5bf4af[_0x9dd1('0xa1')](_0x5832d3);}})[_0x9dd1('0x29')](function(_0x5465cc){if(_0x5465cc){return _0x5465cc?{'count':_0x54a17e,'rows':_0x5465cc}:null;}})[_0x9dd1('0x29')](respondWithResult(_0x219536,null))[_0x9dd1('0x59')](handleError(_0x219536,null));};function handleQuery(_0x384f72){logger[_0x9dd1('0xa2')](_0x384f72);return db[_0x9dd1('0x90')][_0x9dd1('0x37')](_0x384f72)['spread'](function(_0x216fe8){csv_results['push'](_0x216fe8);})[_0x9dd1('0x59')](function(_0x408e47){logger[_0x9dd1('0x2e')](_0x408e47['message']);});} \ No newline at end of file +var _0x0214=['UserProfileSection','UserProfileResource','error','describe','addDisposition','ListId','Disposition','order','options','removeDispositions','ids','addContacts','tags','isArray','join','push','each','CmContact','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findOne','findAndCountAll','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','get','Lists','end','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','CmList','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x51da5b,_0x5a6b52){var _0x58b292=function(_0x306b53){while(--_0x306b53){_0x51da5b['push'](_0x51da5b['shift']());}};_0x58b292(++_0x5a6b52);}(_0x0214,0xf0));var _0x4021=function(_0x3ed666,_0x3345f9){_0x3ed666=_0x3ed666-0x0;var _0x1587f5=_0x0214[_0x3ed666];return _0x1587f5;};'use strict';var emlformat=require(_0x4021('0x0'));var rimraf=require(_0x4021('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4021('0x2'));var moment=require(_0x4021('0x3'));var BPromise=require(_0x4021('0x4'));var Mustache=require(_0x4021('0x5'));var util=require('util');var path=require(_0x4021('0x6'));var sox=require(_0x4021('0x7'));var csv=require(_0x4021('0x8'));var ejs=require(_0x4021('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4021('0xa'));var squel=require(_0x4021('0xb'));var crypto=require(_0x4021('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4021('0xd'));var toCsv=require(_0x4021('0x8'));var querystring=require(_0x4021('0xe'));var Papa=require(_0x4021('0xf'));var Redis=require(_0x4021('0x10'));var authService=require(_0x4021('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4021('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4021('0x13'))(_0x4021('0x14'));var utils=require(_0x4021('0x15'));var config=require(_0x4021('0x16'));var licenseUtil=require(_0x4021('0x17'));var db=require(_0x4021('0x18'))['db'];var csv_results;config[_0x4021('0x19')]=_[_0x4021('0x1a')](config['redis'],{'host':_0x4021('0x1b'),'port':0x18eb});var socket=require(_0x4021('0x1c'))(new Redis(config[_0x4021('0x19')]));require(_0x4021('0x1d'))[_0x4021('0x1e')](socket);function respondWithStatusCode(_0x4e0b2e,_0x1a62f5){_0x1a62f5=_0x1a62f5||0xcc;return function(_0x424c34){if(_0x424c34){return _0x4e0b2e['sendStatus'](_0x1a62f5);}return _0x4e0b2e['status'](_0x1a62f5)['end']();};}function respondWithResult(_0x2c4e64,_0x4f546e){_0x4f546e=_0x4f546e||0xc8;return function(_0x169ee7){if(_0x169ee7){return _0x2c4e64[_0x4021('0x1f')](_0x4f546e)[_0x4021('0x20')](_0x169ee7);}};}function respondWithFilteredResult(_0x487ca8,_0x2d3c51){return function(_0x319fde){if(_0x319fde){var _0x14782f=typeof _0x2d3c51[_0x4021('0x21')]===_0x4021('0x22')&&typeof _0x2d3c51[_0x4021('0x23')]===_0x4021('0x22');var _0x598e5e=_0x319fde[_0x4021('0x24')];var _0x14da6f=_0x14782f?0x0:_0x2d3c51['offset'];var _0x10245=_0x14782f?_0x319fde[_0x4021('0x24')]:_0x2d3c51['offset']+_0x2d3c51[_0x4021('0x23')];var _0x5e2812;if(_0x10245>=_0x598e5e){_0x10245=_0x598e5e;_0x5e2812=0xc8;}else{_0x5e2812=0xce;}_0x487ca8[_0x4021('0x1f')](_0x5e2812);return _0x487ca8['set']('Content-Range',_0x14da6f+'-'+_0x10245+'/'+_0x598e5e)[_0x4021('0x20')](_0x319fde);}return null;};}function patchUpdates(_0x2a6132){return function(_0x2e14fb){try{jsonpatch[_0x4021('0x25')](_0x2e14fb,_0x2a6132,!![]);}catch(_0x5168ec){return BPromise['reject'](_0x5168ec);}return _0x2e14fb[_0x4021('0x26')]();};}function saveUpdates(_0x432b14,_0x41019a){return function(_0x5b7f38){if(_0x5b7f38){return _0x5b7f38[_0x4021('0x27')](_0x432b14)[_0x4021('0x28')](function(_0x36cf2c){return _0x36cf2c;});}return null;};}function removeEntity(_0x412e37,_0x19d47a){return function(_0x21417f){if(_0x21417f){return _0x21417f[_0x4021('0x29')]()[_0x4021('0x28')](function(){var _0x52385d=_0x21417f[_0x4021('0x2a')]({'plain':!![]});var _0x356735=_0x4021('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x356735,'resourceId':_0x52385d['id']}})['then'](function(){return _0x21417f;});})[_0x4021('0x28')](function(){_0x412e37[_0x4021('0x1f')](0xcc)[_0x4021('0x2c')]();});}};}function handleEntityNotFound(_0x29b484,_0x52636e){return function(_0x37fffc){if(!_0x37fffc){_0x29b484[_0x4021('0x2d')](0x194);}return _0x37fffc;};}function handleError(_0x52fb33,_0x155d94){_0x155d94=_0x155d94||0x1f4;return function(_0x2d4f39){logger['error'](_0x2d4f39[_0x4021('0x2e')]);if(_0x2d4f39[_0x4021('0x2f')]){delete _0x2d4f39[_0x4021('0x2f')];}_0x52fb33[_0x4021('0x1f')](_0x155d94)[_0x4021('0x30')](_0x2d4f39);};}exports[_0x4021('0x31')]=function(_0x9bc08e,_0x5619ff){var _0x31d1fb={},_0x3cf72d={},_0xf33c10={'count':0x0,'rows':[]};var _0x4cd613=_[_0x4021('0x32')](db['CmList'][_0x4021('0x33')],function(_0x90bd6c){return{'name':_0x90bd6c['fieldName'],'type':_0x90bd6c[_0x4021('0x34')][_0x4021('0x35')]};});_0x3cf72d[_0x4021('0x36')]=_['map'](_0x4cd613,_0x4021('0x2f'));_0x3cf72d[_0x4021('0x37')]=_[_0x4021('0x38')](_0x9bc08e[_0x4021('0x37')]);_0x3cf72d['filters']=_[_0x4021('0x39')](_0x3cf72d[_0x4021('0x36')],_0x3cf72d['query']);_0x31d1fb['attributes']=_[_0x4021('0x39')](_0x3cf72d[_0x4021('0x36')],qs[_0x4021('0x3a')](_0x9bc08e[_0x4021('0x37')][_0x4021('0x3a')]));_0x31d1fb[_0x4021('0x3b')]=_0x31d1fb[_0x4021('0x3b')]['length']?_0x31d1fb[_0x4021('0x3b')]:_0x3cf72d[_0x4021('0x36')];if(!_0x9bc08e[_0x4021('0x37')][_0x4021('0x3c')](_0x4021('0x3d'))){_0x31d1fb[_0x4021('0x23')]=qs['limit'](_0x9bc08e[_0x4021('0x37')]['limit']);_0x31d1fb[_0x4021('0x21')]=qs[_0x4021('0x21')](_0x9bc08e['query'][_0x4021('0x21')]);}_0x31d1fb['order']=qs[_0x4021('0x3e')](_0x9bc08e[_0x4021('0x37')]['sort']);_0x31d1fb[_0x4021('0x3f')]=qs[_0x4021('0x40')](_[_0x4021('0x41')](_0x9bc08e[_0x4021('0x37')],_0x3cf72d[_0x4021('0x40')]),_0x4cd613);if(_0x9bc08e['query'][_0x4021('0x42')]){_0x31d1fb[_0x4021('0x3f')]=_[_0x4021('0x43')](_0x31d1fb[_0x4021('0x3f')],{'$or':_[_0x4021('0x32')](_0x4cd613,function(_0x5c8941){if(_0x5c8941[_0x4021('0x34')]!==_0x4021('0x44')){var _0x1d3df4={};_0x1d3df4[_0x5c8941[_0x4021('0x2f')]]={'$like':'%'+_0x9bc08e[_0x4021('0x37')][_0x4021('0x42')]+'%'};return _0x1d3df4;}})});}_0x31d1fb=_[_0x4021('0x43')]({},_0x31d1fb,_0x9bc08e['options']);var _0x114296={'where':_0x31d1fb[_0x4021('0x3f')]};return db[_0x4021('0x45')][_0x4021('0x24')](_0x114296)['then'](function(_0x1c83b4){_0xf33c10[_0x4021('0x24')]=_0x1c83b4;if(_0x9bc08e[_0x4021('0x37')][_0x4021('0x46')]){_0x31d1fb[_0x4021('0x47')]=[{'all':!![]}];}return db[_0x4021('0x45')][_0x4021('0x48')](_0x31d1fb);})['then'](function(_0xb4e7f1){_0xf33c10[_0x4021('0x49')]=_0xb4e7f1;return _0xf33c10;})[_0x4021('0x28')](respondWithFilteredResult(_0x5619ff,_0x31d1fb))[_0x4021('0x4a')](handleError(_0x5619ff,null));};exports['show']=function(_0x8885d7,_0xcddf15){var _0x513f19={'raw':![],'where':{'id':_0x8885d7[_0x4021('0x4b')]['id']}},_0x1871c3={};_0x1871c3[_0x4021('0x36')]=_['keys'](db[_0x4021('0x45')]['rawAttributes']);_0x1871c3[_0x4021('0x37')]=_[_0x4021('0x38')](_0x8885d7[_0x4021('0x37')]);_0x1871c3[_0x4021('0x40')]=_[_0x4021('0x39')](_0x1871c3[_0x4021('0x36')],_0x1871c3[_0x4021('0x37')]);_0x513f19['attributes']=_[_0x4021('0x39')](_0x1871c3[_0x4021('0x36')],qs[_0x4021('0x3a')](_0x8885d7[_0x4021('0x37')][_0x4021('0x3a')]));_0x513f19[_0x4021('0x3b')]=_0x513f19['attributes'][_0x4021('0x4c')]?_0x513f19[_0x4021('0x3b')]:_0x1871c3[_0x4021('0x36')];if(_0x8885d7[_0x4021('0x37')][_0x4021('0x46')]){_0x513f19[_0x4021('0x47')]=[{'all':!![]}];}_0x513f19=_[_0x4021('0x43')]({},_0x513f19,_0x8885d7['options']);return db[_0x4021('0x45')][_0x4021('0x4d')](_0x513f19)[_0x4021('0x28')](handleEntityNotFound(_0xcddf15,null))['then'](respondWithResult(_0xcddf15,null))[_0x4021('0x4a')](handleError(_0xcddf15,null));};exports[_0x4021('0x4e')]=function(_0x5100cf,_0x2648ac){return db[_0x4021('0x45')][_0x4021('0x4e')](_0x5100cf[_0x4021('0x4f')],{})[_0x4021('0x28')](function(_0x5c16b8){var _0x1a481a=_0x5100cf[_0x4021('0x50')]['get']({'plain':!![]});if(!_0x1a481a)throw new Error(_0x4021('0x51'));if(_0x1a481a['role']===_0x4021('0x50')){var _0x2fc087=_0x5c16b8[_0x4021('0x2a')]({'plain':!![]});var _0x347002='Lists';return db[_0x4021('0x52')]['find']({'where':{'name':_0x347002,'userProfileId':_0x1a481a['userProfileId']},'raw':!![]})['then'](function(_0x460b06){if(_0x460b06&&_0x460b06['autoAssociation']===0x0){return db[_0x4021('0x53')][_0x4021('0x4e')]({'name':_0x2fc087[_0x4021('0x2f')],'resourceId':_0x2fc087['id'],'type':_0x460b06[_0x4021('0x2f')],'sectionId':_0x460b06['id']},{})[_0x4021('0x28')](function(){return _0x5c16b8;});}else{return _0x5c16b8;}})['catch'](function(_0x37c1c1){logger[_0x4021('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37c1c1);throw _0x37c1c1;});}return _0x5c16b8;})[_0x4021('0x28')](respondWithResult(_0x2648ac,0xc9))[_0x4021('0x4a')](handleError(_0x2648ac,null));};exports[_0x4021('0x27')]=function(_0x355817,_0x431c98){if(_0x355817[_0x4021('0x4f')]['id']){delete _0x355817[_0x4021('0x4f')]['id'];}return db['CmList'][_0x4021('0x4d')]({'where':{'id':_0x355817[_0x4021('0x4b')]['id']}})[_0x4021('0x28')](handleEntityNotFound(_0x431c98,null))[_0x4021('0x28')](saveUpdates(_0x355817['body'],null))[_0x4021('0x28')](respondWithResult(_0x431c98,null))[_0x4021('0x4a')](handleError(_0x431c98,null));};exports[_0x4021('0x29')]=function(_0x30d87f,_0x1dc826){return db['CmList'][_0x4021('0x4d')]({'where':{'id':_0x30d87f[_0x4021('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1dc826,null))['then'](removeEntity(_0x1dc826,null))[_0x4021('0x4a')](handleError(_0x1dc826,null));};exports['describe']=function(_0x4477cf,_0x3b49f4){return db['CmList'][_0x4021('0x55')]()[_0x4021('0x28')](respondWithResult(_0x3b49f4,null))['catch'](handleError(_0x3b49f4,null));};exports[_0x4021('0x56')]=function(_0x44d1fa,_0x508ebd,_0x390585){if(_0x44d1fa[_0x4021('0x4f')]['id']){delete _0x44d1fa[_0x4021('0x4f')]['id'];}return db[_0x4021('0x45')][_0x4021('0x4d')]({'where':{'id':_0x44d1fa['params']['id']}})['then'](handleEntityNotFound(_0x508ebd,null))['then'](function(_0x168408){if(_0x168408){_0x44d1fa['body'][_0x4021('0x57')]=_0x168408['id'];return db[_0x4021('0x58')][_0x4021('0x4e')](_0x44d1fa['body']);}})[_0x4021('0x28')](respondWithResult(_0x508ebd,null))[_0x4021('0x4a')](handleError(_0x508ebd,null));};exports['getDispositions']=function(_0x56eb8e,_0x1b8e7b,_0x3affd4){var _0x5888c5={'raw':![],'where':{}};var _0x19c6f4={};var _0x484e91={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x56eb8e[_0x4021('0x4b')]['id']}})[_0x4021('0x28')](handleEntityNotFound(_0x1b8e7b,null))[_0x4021('0x28')](function(_0x1964c8){if(_0x1964c8){_0x19c6f4[_0x4021('0x36')]=_[_0x4021('0x38')](db[_0x4021('0x58')][_0x4021('0x33')]);_0x19c6f4[_0x4021('0x37')]=_['keys'](_0x56eb8e[_0x4021('0x37')]);_0x19c6f4[_0x4021('0x40')]=_[_0x4021('0x39')](_0x19c6f4['model'],_0x19c6f4['query']);_0x5888c5[_0x4021('0x3b')]=_['intersection'](_0x19c6f4['model'],qs[_0x4021('0x3a')](_0x56eb8e['query'][_0x4021('0x3a')]));_0x5888c5['attributes']=_0x5888c5[_0x4021('0x3b')][_0x4021('0x4c')]?_0x5888c5[_0x4021('0x3b')]:_0x19c6f4[_0x4021('0x36')];if(!_0x56eb8e[_0x4021('0x37')]['hasOwnProperty'](_0x4021('0x3d'))){_0x5888c5[_0x4021('0x23')]=qs[_0x4021('0x23')](_0x56eb8e[_0x4021('0x37')][_0x4021('0x23')]);_0x5888c5[_0x4021('0x21')]=qs['offset'](_0x56eb8e[_0x4021('0x37')][_0x4021('0x21')]);}_0x5888c5[_0x4021('0x59')]=qs[_0x4021('0x3e')](_0x56eb8e[_0x4021('0x37')][_0x4021('0x3e')]);_0x5888c5[_0x4021('0x3f')]=qs[_0x4021('0x40')](_['pick'](_0x56eb8e[_0x4021('0x37')],_0x19c6f4[_0x4021('0x40')]));_0x5888c5['where']['ListId']=_0x1964c8['id'];if(_0x56eb8e[_0x4021('0x37')][_0x4021('0x42')]){_0x5888c5['where']=_['merge'](_0x5888c5[_0x4021('0x3f')],{'$or':_[_0x4021('0x32')](_0x5888c5[_0x4021('0x3b')],function(_0xba6ee4){var _0xb501c8={};_0xb501c8[_0xba6ee4]={'$like':'%'+_0x56eb8e[_0x4021('0x37')][_0x4021('0x42')]+'%'};return _0xb501c8;})});}_0x5888c5=_[_0x4021('0x43')]({},_0x5888c5,_0x56eb8e[_0x4021('0x5a')]);return db[_0x4021('0x58')][_0x4021('0x24')]({'where':_0x5888c5['where']})[_0x4021('0x28')](function(_0x78cc7d){_0x484e91[_0x4021('0x24')]=_0x78cc7d;if(_0x56eb8e[_0x4021('0x37')][_0x4021('0x46')]){_0x5888c5[_0x4021('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x4021('0x48')](_0x5888c5);})['then'](function(_0x1c304a){_0x484e91[_0x4021('0x49')]=_0x1c304a;return _0x484e91;});}})['then'](respondWithFilteredResult(_0x1b8e7b,_0x5888c5))[_0x4021('0x4a')](handleError(_0x1b8e7b,null));};exports[_0x4021('0x5b')]=function(_0x157af1,_0x50cfc9,_0x1f06cd){return db['CmList']['find']({'where':{'id':_0x157af1['params']['id']}})['then'](handleEntityNotFound(_0x50cfc9,null))[_0x4021('0x28')](function(_0x4f1f9b){if(_0x4f1f9b){return _0x4f1f9b[_0x4021('0x5b')](_0x157af1['query'][_0x4021('0x5c')]);}})[_0x4021('0x28')](respondWithStatusCode(_0x50cfc9,null))['catch'](handleError(_0x50cfc9,null));};exports[_0x4021('0x5d')]=function(_0x340cb6,_0x3251f6,_0x410b01){return db[_0x4021('0x45')]['find']({'where':{'id':_0x340cb6[_0x4021('0x4b')]['id']}})[_0x4021('0x28')](handleEntityNotFound(_0x3251f6,null))[_0x4021('0x28')](function(_0x22e509){if(_0x22e509){var _0x2e9fed=[];var _0x1c7082={'success':[],'errors':[]};return db['CmContact'][_0x4021('0x55')]()[_0x4021('0x28')](function(_0x1754cb){if(_0x340cb6[_0x4021('0x4f')][_0x4021('0x5e')]&&_[_0x4021('0x5f')](_0x340cb6[_0x4021('0x4f')][_0x4021('0x5e')])){if(_0x340cb6[_0x4021('0x4f')][_0x4021('0x5e')]['length']){_0x340cb6[_0x4021('0x4f')]['tags']=_0x340cb6[_0x4021('0x4f')]['tags'][_0x4021('0x60')](';')+';';}else{_0x340cb6[_0x4021('0x4f')][_0x4021('0x5e')]=null;}}else{_0x340cb6[_0x4021('0x4f')][_0x4021('0x5e')]=null;}if(_0x340cb6[_0x4021('0x4f')]&&_[_0x4021('0x5f')](_0x340cb6[_0x4021('0x4f')])){for(var _0x55f5b6=0x0;_0x55f5b6<_0x340cb6['body'][_0x4021('0x4c')];_0x55f5b6+=0x1){_0x340cb6[_0x4021('0x4f')][_0x55f5b6][_0x4021('0x57')]=_0x340cb6['params']['id'];_0x2e9fed[_0x4021('0x61')](_0x340cb6['body'][_0x55f5b6]);}return BPromise[_0x4021('0x62')](_0x2e9fed,function(_0x6da7fb){return db[_0x4021('0x63')][_0x4021('0x4e')](_['omit'](_0x6da7fb,[_0x4021('0x5c'),'id'])||{},{'fields':_[_0x4021('0x38')](_0x1754cb),'raw':!![]})[_0x4021('0x28')](function(_0x412396){_0x1c7082['success'][_0x4021('0x61')](_0x412396[_0x4021('0x64')]);})[_0x4021('0x4a')](function(_0x503c57){_0x1c7082[_0x4021('0x65')][_0x4021('0x61')]({'data':_0x6da7fb,'error':_0x503c57[_0x4021('0x66')]});});})[_0x4021('0x28')](function(_0x2780ef){return _0x1c7082;})[_0x4021('0x4a')](function(_0x2d8727){return _0x2d8727;});}else{_0x3251f6[_0x4021('0x1f')](0x190)[_0x4021('0x20')]({'message':_0x4021('0x67')});}});}})['then'](respondWithResult(_0x3251f6,null))['catch'](handleError(_0x3251f6,null));};exports[_0x4021('0x68')]=function(_0x56fcb6,_0x3d4469,_0x2f07e9){var _0x1e53ea;return db['CmList']['find']({'where':{'id':_0x56fcb6[_0x4021('0x4b')]['id']},'include':[{'model':db[_0x4021('0x69')],'as':_0x4021('0x6a')}]})['then'](handleEntityNotFound(_0x3d4469,null))[_0x4021('0x28')](function(_0x3575d2){if(_0x3575d2){_0x1e53ea=_0x3575d2;return db[_0x4021('0x63')][_0x4021('0x33')];}})['then'](function(_0x21096b){if(_0x21096b){var _0x518ade={};var _0x57e2d1={};_0x57e2d1[_0x4021('0x36')]=_[_0x4021('0x6b')](_[_0x4021('0x38')](_0x21096b),_[_0x4021('0x32')](_0x1e53ea[_0x4021('0x6a')],function(_0x2307f6){return util[_0x4021('0x6c')]('cf_%d',_0x2307f6['id']);}));_0x57e2d1['query']=_['keys'](_0x56fcb6['query']);_0x57e2d1[_0x4021('0x40')]=_[_0x4021('0x39')](_0x57e2d1[_0x4021('0x36')],_0x57e2d1[_0x4021('0x37')]);_0x518ade[_0x4021('0x3b')]=_['intersection'](_0x57e2d1[_0x4021('0x36')],qs[_0x4021('0x3a')](_0x56fcb6[_0x4021('0x37')][_0x4021('0x3a')]));_0x518ade[_0x4021('0x3b')]=_0x518ade[_0x4021('0x3b')][_0x4021('0x4c')]?_0x518ade[_0x4021('0x3b')]:_0x57e2d1['model'];if(!_0x56fcb6[_0x4021('0x37')][_0x4021('0x3c')](_0x4021('0x3d'))){_0x518ade['limit']=qs['limit'](_0x56fcb6[_0x4021('0x37')][_0x4021('0x23')]);_0x518ade[_0x4021('0x21')]=qs[_0x4021('0x21')](_0x56fcb6['query'][_0x4021('0x21')]);}_0x518ade[_0x4021('0x59')]=qs['sort'](_0x56fcb6[_0x4021('0x37')][_0x4021('0x3e')]);_0x518ade[_0x4021('0x3f')]=qs['filters'](_['pick'](_0x56fcb6['query'],_0x57e2d1[_0x4021('0x40')]));_0x518ade[_0x4021('0x6d')]=!![];if(_0x56fcb6['query'][_0x4021('0x42')]){_0x518ade['where']=_[_0x4021('0x43')](_0x518ade[_0x4021('0x3f')],{'$or':_['map'](_0x518ade[_0x4021('0x3b')],function(_0xfd2090){var _0xc1cec={};_0xc1cec[_0xfd2090]={'$like':'%'+_0x56fcb6[_0x4021('0x37')][_0x4021('0x42')]+'%'};return _0xc1cec;})});}_0x518ade=_['merge']({},_0x518ade,_0x56fcb6[_0x4021('0x5a')]);return _0x1e53ea[_0x4021('0x68')](_0x518ade);}})['then'](respondWithResult(_0x3d4469,null))['catch'](handleError(_0x3d4469,null));};exports[_0x4021('0x6e')]=function(_0x5da7b2,_0x32f085,_0x4f7d25){var _0x335ef9;var _0x1dce8e;var _0x20b0a0;var _0x1f3604=_0x5da7b2['params']['id'];csv_results=[];return db['ContactItemType'][_0x4021('0x48')]({'attributes':['id',_0x4021('0x2f')],'raw':!![],'order':[_0x4021('0x6f')]})[_0x4021('0x28')](function(_0x19c423){_0x335ef9=_0x19c423;var _0x48060b=_[_0x4021('0x38')](db['CmContact']['rawAttributes']);return db[_0x4021('0x69')][_0x4021('0x48')]({'raw':!![],'attributes':['id',_0x4021('0x70')]})[_0x4021('0x28')](function(_0x7eb74d){_0x1dce8e=_0x7eb74d;var _0x24d85e=squel['select']()[_0x4021('0x3a')](_0x48060b)[_0x4021('0x71')](_0x4021('0x72'),'c')[_0x4021('0x3f')](_0x4021('0x73'),_0x1f3604)[_0x4021('0x3f')]('c.deletedAt\x20is\x20null')[_0x4021('0x74')]();for(var _0x508958=0x0;_0x508958<_0x1dce8e[_0x4021('0x4c')];_0x508958++){_0x24d85e[_0x4021('0x75')]('c.cf_'+_0x1dce8e[_0x508958]['id'],_0x4021('0x76')+_0x1dce8e[_0x508958][_0x4021('0x70')]);}for(var _0x508958=0x0;_0x508958<_0x335ef9['length'];_0x508958++){_0x24d85e[_0x4021('0x75')](squel[_0x4021('0x77')]()[_0x4021('0x75')](_0x4021('0x78'))[_0x4021('0x71')](_0x4021('0x79'))[_0x4021('0x3f')](_0x4021('0x7a'),_0x335ef9[_0x508958]['id'])[_0x4021('0x3f')](_0x4021('0x7b')),_0x4021('0x7c')+_0x335ef9[_0x508958][_0x4021('0x2f')]);_0x24d85e[_0x4021('0x75')](squel[_0x4021('0x77')]()[_0x4021('0x75')](_0x4021('0x7d'))[_0x4021('0x71')]('cm_contact_has_items')[_0x4021('0x3f')](_0x4021('0x7a'),_0x335ef9[_0x508958]['id'])[_0x4021('0x3f')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x335ef9[_0x508958][_0x4021('0x2f')]);}var _0x1b7804=[];_0x1b7804[_0x4021('0x61')](_0x24d85e['toString']());BPromise['each'](_0x1b7804,handleQuery)[_0x4021('0x28')](function(_0x128f57){handleQuery(_0x24d85e[_0x4021('0x7e')]());var _0x12eb24=csv_results[0x0];if(!_[_0x4021('0x7f')](_0x12eb24)){var _0x1b190e=toCsv(_0x12eb24);var _0x293d21=Date[_0x4021('0x80')]();fs[_0x4021('0x81')](util[_0x4021('0x6c')](_0x4021('0x82'),_0x1f3604,_0x293d21),_0x1b190e);_0x32f085[_0x4021('0x83')](_0x4021('0x84'),_0x4021('0x85')+util['format'](_0x4021('0x86'),_0x1f3604,_0x293d21));_0x32f085[_0x4021('0x83')](_0x4021('0x87'),_0x4021('0x88'));return _0x32f085['download'](util[_0x4021('0x6c')]('/tmp/list_%d_%s.csv',_0x1f3604,_0x293d21));}else{return _0x32f085[_0x4021('0x2d')](0xcc);}});});});};exports[_0x4021('0x89')]=function(_0xef06f1,_0x25b56f,_0x18c635){var _0x261008;delete _0xef06f1['body']['id'];return db['CmList']['findOne']({'where':{'id':_0xef06f1[_0x4021('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25b56f,null))['then'](function(_0x3f1900){if(_0x3f1900){return db[_0x4021('0x8a')][_0x4021('0x8b')](function(_0x26e1f0){return db['CmCustomField']['create'](_0xef06f1['body'],{'transaction':_0x26e1f0})['then'](function(_0x145b19){_0x261008=_0x145b19;return _0x3f1900[_0x4021('0x8c')](_0x145b19,{'transaction':_0x26e1f0});})[_0x4021('0x28')](function(){var _0x2c604f={'type':db[_0x4021('0x8d')]['TEXT'],'transaction':_0x26e1f0};switch(_0xef06f1[_0x4021('0x4f')]['type']){case'text':_0x2c604f[_0x4021('0x34')]=db[_0x4021('0x8d')]['TEXT'];break;case _0x4021('0x8e'):_0x2c604f[_0x4021('0x34')]=db[_0x4021('0x8d')]['INTEGER'];break;case _0x4021('0x8f'):_0x2c604f[_0x4021('0x34')]=db[_0x4021('0x8d')][_0x4021('0x90')];_0x2c604f[_0x4021('0x91')]=![];break;default:}return db[_0x4021('0x8a')][_0x4021('0x92')][_0x4021('0x93')](_0x4021('0x72'),util['format'](_0x4021('0x94'),_0x261008['id']),_0x2c604f);})[_0x4021('0x28')](function(){return _0x261008;});});}})[_0x4021('0x28')](respondWithResult(_0x25b56f,null))[_0x4021('0x4a')](handleError(_0x25b56f,null));};exports[_0x4021('0x95')]=function(_0x24048d,_0x4a2aa6,_0x56abc6){var _0x11e013={};var _0xc34afb={};var _0x4ad9bf;var _0x53a08a;return db[_0x4021('0x45')][_0x4021('0x96')]({'where':{'id':_0x24048d[_0x4021('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a2aa6,null))[_0x4021('0x28')](function(_0x23884d){if(_0x23884d){_0x4ad9bf=_0x23884d;_0xc34afb[_0x4021('0x36')]=_[_0x4021('0x38')](db[_0x4021('0x69')][_0x4021('0x33')]);_0xc34afb[_0x4021('0x37')]=_[_0x4021('0x38')](_0x24048d['query']);_0xc34afb[_0x4021('0x40')]=_[_0x4021('0x39')](_0xc34afb['model'],_0xc34afb['query']);_0x11e013[_0x4021('0x3b')]=_['intersection'](_0xc34afb[_0x4021('0x36')],qs['fields'](_0x24048d[_0x4021('0x37')]['fields']));_0x11e013[_0x4021('0x3b')]=_0x11e013[_0x4021('0x3b')][_0x4021('0x4c')]?_0x11e013[_0x4021('0x3b')]:_0xc34afb[_0x4021('0x36')];_0x11e013['order']=qs[_0x4021('0x3e')](_0x24048d[_0x4021('0x37')][_0x4021('0x3e')]);_0x11e013[_0x4021('0x3f')]=qs['filters'](_['pick'](_0x24048d[_0x4021('0x37')],_0xc34afb[_0x4021('0x40')]));_0x11e013[_0x4021('0x3f')]=_[_0x4021('0x43')](_0x11e013[_0x4021('0x3f')],{'$or':[{'ListId':_0x23884d['id']},{'ListId':null}]});if(_0x24048d[_0x4021('0x37')][_0x4021('0x42')]){_0x11e013[_0x4021('0x3f')]=_['merge'](_0x11e013[_0x4021('0x3f')],{'$or':_['map'](_0x11e013[_0x4021('0x3b')],function(_0x1d87ab){var _0x2e5c7b={};_0x2e5c7b[_0x1d87ab]={'$like':'%'+_0x24048d['query']['filter']+'%'};return _0x2e5c7b;})});}_0x11e013=_[_0x4021('0x43')]({},_0x11e013,_0x24048d[_0x4021('0x5a')]);return db[_0x4021('0x69')][_0x4021('0x97')](_0x11e013);}})[_0x4021('0x28')](respondWithResult(_0x4a2aa6,null))[_0x4021('0x4a')](handleError(_0x4a2aa6,null));};exports['getGlobalCustomFields']=function(_0x58cc32,_0x296adb){return db[_0x4021('0x69')]['findAndCountAll']({'where':{'ListId':null}})[_0x4021('0x28')](handleEntityNotFound(_0x296adb,null))['then'](function(_0x4bd6b2){return _0x4bd6b2;})[_0x4021('0x28')](respondWithResult(_0x296adb,null))[_0x4021('0x4a')](handleError(_0x296adb,null));};exports['addAgents']=function(_0x510bf4,_0x3cb5b,_0x1100eb){return db[_0x4021('0x45')][_0x4021('0x4d')]({'where':{'id':_0x510bf4[_0x4021('0x4b')]['id']}})[_0x4021('0x28')](handleEntityNotFound(_0x3cb5b,null))[_0x4021('0x28')](function(_0x55bfe6){if(_0x55bfe6){return _0x55bfe6['addAgents'](_0x510bf4['body'][_0x4021('0x5c')],_[_0x4021('0x98')](_0x510bf4[_0x4021('0x4f')],['ids','id'])||{})[_0x4021('0x99')](function(_0x4d73e1){for(var _0x5240f6=0x0;_0x5240f6<_0x510bf4[_0x4021('0x4f')]['ids'][_0x4021('0x4c')];_0x5240f6+=0x1){socket[_0x4021('0x9a')](_0x4021('0x9b'),{'UserId':Number(_0x510bf4[_0x4021('0x4f')][_0x4021('0x5c')][_0x5240f6]),'CmListId':Number(_0x510bf4[_0x4021('0x4b')]['id'])});}return _0x4d73e1;});}})[_0x4021('0x28')](respondWithResult(_0x3cb5b,null))[_0x4021('0x4a')](handleError(_0x3cb5b,null));};exports[_0x4021('0x9c')]=function(_0x1e4e63,_0x55bf3a,_0x3810d9){return db[_0x4021('0x45')][_0x4021('0x4d')]({'where':{'id':_0x1e4e63[_0x4021('0x4b')]['id']}})[_0x4021('0x28')](handleEntityNotFound(_0x55bf3a,null))['then'](function(_0x357b7f){if(_0x357b7f){return _0x357b7f[_0x4021('0x9c')](_0x1e4e63[_0x4021('0x37')][_0x4021('0x5c')])[_0x4021('0x28')](function(){if(_[_0x4021('0x5f')](_0x1e4e63[_0x4021('0x37')]['ids'])){for(var _0x435449=0x0;_0x435449<_0x1e4e63['query'][_0x4021('0x5c')]['length'];_0x435449+=0x1){socket[_0x4021('0x9a')](_0x4021('0x9d'),{'UserId':Number(_0x1e4e63[_0x4021('0x37')][_0x4021('0x5c')][_0x435449]),'CmListId':Number(_0x1e4e63['params']['id'])});}}else{socket[_0x4021('0x9a')](_0x4021('0x9d'),{'UserId':Number(_0x1e4e63[_0x4021('0x37')][_0x4021('0x5c')]),'CmListId':Number(_0x1e4e63[_0x4021('0x4b')]['id'])});}});}})[_0x4021('0x28')](respondWithStatusCode(_0x55bf3a,null))[_0x4021('0x4a')](handleError(_0x55bf3a,null));};exports['getAgents']=function(_0x472d37,_0x1b77c0,_0x3341ea){var _0x4caff1={};var _0x10c723={};var _0x3e8107;var _0x4fc172;return db[_0x4021('0x45')]['findOne']({'where':{'id':_0x472d37['params']['id']}})[_0x4021('0x28')](handleEntityNotFound(_0x1b77c0,null))[_0x4021('0x28')](function(_0x3a6da5){if(_0x3a6da5){_0x3e8107=_0x3a6da5;_0x10c723['model']=_[_0x4021('0x38')](db[_0x4021('0x9e')][_0x4021('0x33')]);_0x10c723[_0x4021('0x37')]=_[_0x4021('0x38')](_0x472d37['query']);_0x10c723[_0x4021('0x40')]=_[_0x4021('0x39')](_0x10c723['model'],_0x10c723[_0x4021('0x37')]);_0x4caff1[_0x4021('0x3b')]=_[_0x4021('0x39')](_0x10c723['model'],qs[_0x4021('0x3a')](_0x472d37[_0x4021('0x37')]['fields']));_0x4caff1['attributes']=_0x4caff1[_0x4021('0x3b')][_0x4021('0x4c')]?_0x4caff1[_0x4021('0x3b')]:_0x10c723[_0x4021('0x36')];_0x4caff1[_0x4021('0x59')]=qs[_0x4021('0x3e')](_0x472d37[_0x4021('0x37')][_0x4021('0x3e')]);_0x4caff1[_0x4021('0x3f')]=qs[_0x4021('0x40')](_['pick'](_0x472d37[_0x4021('0x37')],_0x10c723['filters']));if(_0x472d37['query'][_0x4021('0x42')]){_0x4caff1[_0x4021('0x3f')]=_[_0x4021('0x43')](_0x4caff1['where'],{'$or':_['map'](_0x4caff1[_0x4021('0x3b')],function(_0x8a2085){var _0x1656ac={};_0x1656ac[_0x8a2085]={'$like':'%'+_0x472d37['query'][_0x4021('0x42')]+'%'};return _0x1656ac;})});}_0x4caff1=_[_0x4021('0x43')]({},_0x4caff1,_0x472d37['options']);return _0x3e8107[_0x4021('0x9f')](_0x4caff1);}})[_0x4021('0x28')](function(_0x555cf0){if(_0x555cf0){_0x4fc172=_0x555cf0[_0x4021('0x4c')];if(!_0x472d37[_0x4021('0x37')][_0x4021('0x3c')](_0x4021('0x3d'))){_0x4caff1[_0x4021('0x23')]=qs[_0x4021('0x23')](_0x472d37[_0x4021('0x37')][_0x4021('0x23')]);_0x4caff1[_0x4021('0x21')]=qs[_0x4021('0x21')](_0x472d37['query'][_0x4021('0x21')]);}return _0x3e8107['getAgents'](_0x4caff1);}})['then'](function(_0xf973bd){if(_0xf973bd){return _0xf973bd?{'count':_0x4fc172,'rows':_0xf973bd}:null;}})['then'](respondWithResult(_0x1b77c0,null))[_0x4021('0x4a')](handleError(_0x1b77c0,null));};function handleQuery(_0xb1c13){logger[_0x4021('0xa0')](_0xb1c13);return db[_0x4021('0x8a')][_0x4021('0x37')](_0xb1c13)[_0x4021('0x99')](function(_0x4d36a5){csv_results[_0x4021('0x61')](_0x4d36a5);})[_0x4021('0x4a')](function(_0x1344a4){logger[_0x4021('0x54')](_0x1344a4[_0x4021('0x66')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c8674ce..d6d1120 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x312e4a,_0xff2cba){_0x312e4a=_0x312e4a-0x0;var _0xf9b60a=_0x3e74[_0x312e4a];return _0xf9b60a;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x5410a2,_0x12247a){_0x5410a2=_0x5410a2-0x0;var _0x481667=_0x3e74[_0x5410a2];return _0x481667;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 0568b01..0407963 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 _0x2750=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x286bd8,_0x1f9988){var _0x8e2843=function(_0x2729b0){while(--_0x2729b0){_0x286bd8['push'](_0x286bd8['shift']());}};_0x8e2843(++_0x1f9988);}(_0x2750,0x13b));var _0x0275=function(_0x3b954b,_0x4dc85b){_0x3b954b=_0x3b954b-0x0;var _0x394a3c=_0x2750[_0x3b954b];return _0x394a3c;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ea=['cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0xd2ea,0x15f));var _0xad2e=function(_0x31e964,_0x533231){_0x31e964=_0x31e964-0x0;var _0x5d443d=_0xd2ea[_0x31e964];return _0x5d443d;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'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 1e200a3..f51d305 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 _0x1111=['./cmList.socket','register','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0x1cb2c5,_0x2589dc){var _0x1e373c=function(_0x55121a){while(--_0x55121a){_0x1cb2c5['push'](_0x1cb2c5['shift']());}};_0x1e373c(++_0x2589dc);}(_0x1111,0x78));var _0x1111=function(_0x434496,_0x3dfe5b){_0x434496=_0x434496-0x0;var _0x34c2d9=_0x1111[_0x434496];return _0x34c2d9;};'use strict';var _=require(_0x1111('0x0'));var util=require(_0x1111('0x1'));var moment=require(_0x1111('0x2'));var BPromise=require(_0x1111('0x3'));var rs=require(_0x1111('0x4'));var fs=require('fs');var Redis=require(_0x1111('0x5'));var db=require(_0x1111('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1111('0x7'));var config=require(_0x1111('0x8'));var jayson=require(_0x1111('0x9'));var client=jayson[_0x1111('0xa')][_0x1111('0xb')]({'port':0x232a});config['redis']=_[_0x1111('0xc')](config[_0x1111('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1111('0xe'))(new Redis(config[_0x1111('0xd')]));require(_0x1111('0xf'))[_0x1111('0x10')](socket);function respondWithRpcPromise(_0x444854,_0x4adb5e,_0x40828d){return new BPromise(function(_0x2e5830,_0x3a857a){return client['request'](_0x444854,_0x40828d)[_0x1111('0x11')](function(_0x1cc826){logger[_0x1111('0x12')]('CmList,\x20%s,\x20%s',_0x4adb5e,_0x1111('0x13'));logger[_0x1111('0x14')](_0x1111('0x15'),_0x4adb5e,_0x1111('0x13'),JSON[_0x1111('0x16')](_0x1cc826));if(_0x1cc826[_0x1111('0x17')]){if(_0x1cc826[_0x1111('0x17')]['code']===0x1f4){logger[_0x1111('0x17')](_0x1111('0x18'),_0x4adb5e,_0x1cc826[_0x1111('0x17')]['message']);return _0x3a857a(_0x1cc826['error'][_0x1111('0x19')]);}logger['error'](_0x1111('0x18'),_0x4adb5e,_0x1cc826[_0x1111('0x17')]['message']);return _0x2e5830(_0x1cc826[_0x1111('0x17')]['message']);}else{logger[_0x1111('0x12')](_0x1111('0x18'),_0x4adb5e,'request\x20sent');_0x2e5830(_0x1cc826['result'][_0x1111('0x19')]);}})[_0x1111('0x1a')](function(_0x5e9484){logger[_0x1111('0x17')]('CmList,\x20%s,\x20%s',_0x4adb5e,_0x5e9484);_0x3a857a(_0x5e9484);});});} \ No newline at end of file +var _0xdce8=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x59c7b3,_0x342282){var _0x5459b7=function(_0x3c1813){while(--_0x3c1813){_0x59c7b3['push'](_0x59c7b3['shift']());}};_0x5459b7(++_0x342282);}(_0xdce8,0xed));var _0x8dce=function(_0x3d3913,_0x179462){_0x3d3913=_0x3d3913-0x0;var _0x5a914a=_0xdce8[_0x3d3913];return _0x5a914a;};'use strict';var _=require(_0x8dce('0x0'));var util=require(_0x8dce('0x1'));var moment=require(_0x8dce('0x2'));var BPromise=require('bluebird');var rs=require(_0x8dce('0x3'));var fs=require('fs');var Redis=require(_0x8dce('0x4'));var db=require(_0x8dce('0x5'))['db'];var utils=require(_0x8dce('0x6'));var logger=require('../../config/logger')(_0x8dce('0x7'));var config=require(_0x8dce('0x8'));var jayson=require(_0x8dce('0x9'));var client=jayson[_0x8dce('0xa')][_0x8dce('0xb')]({'port':0x232a});config[_0x8dce('0xc')]=_[_0x8dce('0xd')](config[_0x8dce('0xc')],{'host':_0x8dce('0xe'),'port':0x18eb});var socket=require(_0x8dce('0xf'))(new Redis(config[_0x8dce('0xc')]));require(_0x8dce('0x10'))['register'](socket);function respondWithRpcPromise(_0x948e11,_0xc06396,_0x1a57a2){return new BPromise(function(_0x3de8c8,_0x75f84b){return client[_0x8dce('0x11')](_0x948e11,_0x1a57a2)['then'](function(_0x130767){logger[_0x8dce('0x12')](_0x8dce('0x13'),_0xc06396,_0x8dce('0x14'));logger[_0x8dce('0x15')](_0x8dce('0x16'),_0xc06396,_0x8dce('0x14'),JSON['stringify'](_0x130767));if(_0x130767[_0x8dce('0x17')]){if(_0x130767['error']['code']===0x1f4){logger[_0x8dce('0x17')](_0x8dce('0x13'),_0xc06396,_0x130767[_0x8dce('0x17')][_0x8dce('0x18')]);return _0x75f84b(_0x130767['error'][_0x8dce('0x18')]);}logger[_0x8dce('0x17')](_0x8dce('0x13'),_0xc06396,_0x130767[_0x8dce('0x17')][_0x8dce('0x18')]);return _0x3de8c8(_0x130767['error'][_0x8dce('0x18')]);}else{logger[_0x8dce('0x12')](_0x8dce('0x13'),_0xc06396,'request\x20sent');_0x3de8c8(_0x130767[_0x8dce('0x19')]['message']);}})[_0x8dce('0x1a')](function(_0x2c193d){logger[_0x8dce('0x17')]('CmList,\x20%s,\x20%s',_0xc06396,_0x2c193d);_0x75f84b(_0x2c193d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index db2d210..f47fc0f 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 _0xc9b7=['remove','emit','removeListener','./cmList.events','save'];(function(_0x1212a6,_0x2f97e7){var _0x21fbdc=function(_0x92100d){while(--_0x92100d){_0x1212a6['push'](_0x1212a6['shift']());}};_0x21fbdc(++_0x2f97e7);}(_0xc9b7,0x1e8));var _0x7c9b=function(_0x4d05dd,_0x258cdd){_0x4d05dd=_0x4d05dd-0x0;var _0x1c5226=_0xc9b7[_0x4d05dd];return _0x1c5226;};'use strict';var CmListEvents=require(_0x7c9b('0x0'));var events=[_0x7c9b('0x1'),_0x7c9b('0x2'),'update'];function createListener(_0x381e2d,_0x28e569){return function(_0x4151a1){_0x28e569[_0x7c9b('0x3')](_0x381e2d,_0x4151a1);};}function removeListener(_0x4ee2e7,_0x68ea18){return function(){CmListEvents[_0x7c9b('0x4')](_0x4ee2e7,_0x68ea18);};}exports['register']=function(_0xac80a4){for(var _0x58372d=0x0,_0x5019ef=events['length'];_0x58372d<_0x5019ef;_0x58372d++){var _0x2a02e0=events[_0x58372d];var _0x48c46f=createListener('cmList:'+_0x2a02e0,_0xac80a4);CmListEvents['on'](_0x2a02e0,_0x48c46f);}}; \ No newline at end of file +var _0x9966=['removeListener','register','length','cmList:','save','update'];(function(_0x2d7be9,_0x109ac5){var _0xcb6f2=function(_0x3f42d7){while(--_0x3f42d7){_0x2d7be9['push'](_0x2d7be9['shift']());}};_0xcb6f2(++_0x109ac5);}(_0x9966,0x11e));var _0x6996=function(_0x4eaac7,_0x26d1cf){_0x4eaac7=_0x4eaac7-0x0;var _0x46bad2=_0x9966[_0x4eaac7];return _0x46bad2;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x6996('0x0'),'remove',_0x6996('0x1')];function createListener(_0x438bb0,_0x3e905b){return function(_0x484de7){_0x3e905b['emit'](_0x438bb0,_0x484de7);};}function removeListener(_0xf4b70e,_0x555110){return function(){CmListEvents[_0x6996('0x2')](_0xf4b70e,_0x555110);};}exports[_0x6996('0x3')]=function(_0x3146ee){for(var _0x1da1e9=0x0,_0x1e1612=events[_0x6996('0x4')];_0x1da1e9<_0x1e1612;_0x1da1e9++){var _0xde4bef=events[_0x1da1e9];var _0x104aec=createListener(_0x6996('0x5')+_0xde4bef,_0x3146ee);CmListEvents['on'](_0xde4bef,_0x104aec);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 851454a..fb3c53d 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 _0x9122=['/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','/:id','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','show','getDispositions','/:id/contacts'];(function(_0x5ad262,_0x2c6555){var _0x5d72cf=function(_0x369fc8){while(--_0x369fc8){_0x5ad262['push'](_0x5ad262['shift']());}};_0x5d72cf(++_0x2c6555);}(_0x9122,0xa5));var _0x2912=function(_0x3252f7,_0x1678e5){_0x3252f7=_0x3252f7-0x0;var _0x591cf0=_0x9122[_0x3252f7];return _0x591cf0;};'use strict';var multer=require(_0x2912('0x0'));var util=require(_0x2912('0x1'));var path=require(_0x2912('0x2'));var timeout=require(_0x2912('0x3'));var express=require(_0x2912('0x4'));var router=express[_0x2912('0x5')]();var fs_extra=require(_0x2912('0x6'));var auth=require(_0x2912('0x7'));var interaction=require(_0x2912('0x8'));var config=require(_0x2912('0x9'));var controller=require(_0x2912('0xa'));router[_0x2912('0xb')]('/',auth[_0x2912('0xc')](),controller[_0x2912('0xd')]);router[_0x2912('0xb')](_0x2912('0xe'),auth[_0x2912('0xc')](),controller[_0x2912('0xf')]);router[_0x2912('0xb')](_0x2912('0x10'),auth[_0x2912('0xc')](),controller['getGlobalCustomFields']);router['get']('/:id',auth[_0x2912('0xc')](),controller[_0x2912('0x11')]);router[_0x2912('0xb')]('/:id/dispositions',auth[_0x2912('0xc')](),controller[_0x2912('0x12')]);router['get'](_0x2912('0x13'),auth[_0x2912('0xc')](),controller['getContacts']);router['get'](_0x2912('0x14'),auth[_0x2912('0xc')](),controller['getContactsCsv']);router[_0x2912('0xb')](_0x2912('0x15'),auth['isAuthenticated'](),controller[_0x2912('0x16')]);router['get'](_0x2912('0x17'),auth[_0x2912('0xc')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2912('0x18')](_0x2912('0x19'),auth[_0x2912('0xc')](),controller[_0x2912('0x1a')]);router['post'](_0x2912('0x13'),auth[_0x2912('0xc')](),controller[_0x2912('0x1b')]);router[_0x2912('0x18')](_0x2912('0x15'),auth[_0x2912('0xc')](),controller[_0x2912('0x1c')]);router[_0x2912('0x18')](_0x2912('0x17'),auth[_0x2912('0xc')](),controller[_0x2912('0x1d')]);router[_0x2912('0x1e')]('/:id',auth[_0x2912('0xc')](),controller[_0x2912('0x1f')]);router[_0x2912('0x20')](_0x2912('0x21'),auth[_0x2912('0xc')](),controller[_0x2912('0x22')]);router['delete']('/:id/dispositions',auth[_0x2912('0xc')](),controller['removeDispositions']);router[_0x2912('0x20')](_0x2912('0x17'),auth[_0x2912('0xc')](),controller[_0x2912('0x23')]);module[_0x2912('0x24')]=router; \ No newline at end of file +var _0xfa12=['getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','/:id','update','delete','destroy','removeDispositions','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','isAuthenticated','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x2ee549,_0x4444af){_0x2ee549=_0x2ee549-0x0;var _0x1f852b=_0xfa12[_0x2ee549];return _0x1f852b;};'use strict';var multer=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var path=require('path');var timeout=require(_0x2fa1('0x2'));var express=require(_0x2fa1('0x3'));var router=express[_0x2fa1('0x4')]();var fs_extra=require(_0x2fa1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2fa1('0x6'));var config=require(_0x2fa1('0x7'));var controller=require(_0x2fa1('0x8'));router[_0x2fa1('0x9')]('/',auth['isAuthenticated'](),controller[_0x2fa1('0xa')]);router[_0x2fa1('0x9')]('/describe',auth[_0x2fa1('0xb')](),controller[_0x2fa1('0xc')]);router[_0x2fa1('0x9')](_0x2fa1('0xd'),auth['isAuthenticated'](),controller[_0x2fa1('0xe')]);router[_0x2fa1('0x9')]('/:id',auth[_0x2fa1('0xb')](),controller[_0x2fa1('0xf')]);router[_0x2fa1('0x9')](_0x2fa1('0x10'),auth[_0x2fa1('0xb')](),controller[_0x2fa1('0x11')]);router[_0x2fa1('0x9')](_0x2fa1('0x12'),auth['isAuthenticated'](),controller[_0x2fa1('0x13')]);router[_0x2fa1('0x9')](_0x2fa1('0x14'),auth[_0x2fa1('0xb')](),controller[_0x2fa1('0x15')]);router[_0x2fa1('0x9')]('/:id/fields',auth[_0x2fa1('0xb')](),controller[_0x2fa1('0x16')]);router[_0x2fa1('0x9')](_0x2fa1('0x17'),auth['isAuthenticated'](),controller[_0x2fa1('0x18')]);router[_0x2fa1('0x19')]('/',auth['isAuthenticated'](),controller[_0x2fa1('0x1a')]);router[_0x2fa1('0x19')](_0x2fa1('0x10'),auth[_0x2fa1('0xb')](),controller[_0x2fa1('0x1b')]);router[_0x2fa1('0x19')](_0x2fa1('0x12'),auth[_0x2fa1('0xb')](),controller['addContacts']);router[_0x2fa1('0x19')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2fa1('0x1c')]);router[_0x2fa1('0x19')](_0x2fa1('0x17'),auth[_0x2fa1('0xb')](),controller[_0x2fa1('0x1d')]);router['put'](_0x2fa1('0x1e'),auth['isAuthenticated'](),controller[_0x2fa1('0x1f')]);router[_0x2fa1('0x20')](_0x2fa1('0x1e'),auth[_0x2fa1('0xb')](),controller[_0x2fa1('0x21')]);router[_0x2fa1('0x20')](_0x2fa1('0x10'),auth[_0x2fa1('0xb')](),controller[_0x2fa1('0x22')]);router[_0x2fa1('0x20')]('/:id/users',auth[_0x2fa1('0xb')](),controller['removeAgents']);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 87f9b82..a8142c2 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 _0xf013=['VIRTUAL','STRING','sequelize','exports'];(function(_0x433fbc,_0x318620){var _0x3e5b8f=function(_0x5845c4){while(--_0x5845c4){_0x433fbc['push'](_0x433fbc['shift']());}};_0x3e5b8f(++_0x318620);}(_0xf013,0xae));var _0x3f01=function(_0x356efe,_0x480f92){_0x356efe=_0x356efe-0x0;var _0x5dca67=_0xf013[_0x356efe];return _0x5dca67;};'use strict';var Sequelize=require(_0x3f01('0x0'));module[_0x3f01('0x1')]={'name':{'type':Sequelize[_0x3f01('0x2')],'get':function(_0x34cc26){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x3f01('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x3f01('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x3f01('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xce89=['VIRTUAL','STRING','sequelize','exports'];(function(_0x54a266,_0x4f3915){var _0x474b87=function(_0x4ed076){while(--_0x4ed076){_0x54a266['push'](_0x54a266['shift']());}};_0x474b87(++_0x4f3915);}(_0xce89,0xf6));var _0x9ce8=function(_0x2d4958,_0x46806d){_0x2d4958=_0x2d4958-0x0;var _0x2cd107=_0xce89[_0x2d4958];return _0x2cd107;};'use strict';var Sequelize=require(_0x9ce8('0x0'));module[_0x9ce8('0x1')]={'name':{'type':Sequelize[_0x9ce8('0x2')],'get':function(_0x20df17){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x9ce8('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x9ce8('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x9ce8('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 ff187c6..ba8f4bd 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0xec901a,_0x11894b){var _0x3831b1=function(_0x27c5a9){while(--_0x27c5a9){_0xec901a['push'](_0xec901a['shift']());}};_0x3831b1(++_0x11894b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x5e9629,_0x5c003f){var _0x119697=function(_0x1bd283){while(--_0x1bd283){_0x5e9629['push'](_0x5e9629['shift']());}};_0x119697(++_0x5c003f);}(_0x7a54,0x106));var _0x47a5=function(_0x4ec585,_0x195b5b){_0x4ec585=_0x4ec585-0x0;var _0x3be290=_0x7a54[_0x4ec585];return _0x3be290;};'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 f78fa5f..94c2027 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 _0x1921=['request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','moment','bluebird'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x1921,0x178));var _0x1192=function(_0x406871,_0x5b554e){_0x406871=_0x406871-0x0;var _0x394d7a=_0x1921[_0x406871];return _0x394d7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1192('0x0'));var BPromise=require(_0x1192('0x1'));var rp=require(_0x1192('0x2'));var fs=require('fs');var path=require(_0x1192('0x3'));var rimraf=require('rimraf');var config=require(_0x1192('0x4'));var attributes=require(_0x1192('0x5'));module[_0x1192('0x6')]=function(_0x4fe6ad,_0x420837){return _0x4fe6ad[_0x1192('0x7')](_0x1192('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc593=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','tools_conditions','lodash','util','../../config/logger'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0xc593,0x1b7));var _0x3c59=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc593[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3c59('0x0'));var util=require(_0x3c59('0x1'));var logger=require(_0x3c59('0x2'))(_0x3c59('0x3'));var moment=require(_0x3c59('0x4'));var BPromise=require(_0x3c59('0x5'));var rp=require(_0x3c59('0x6'));var fs=require('fs');var path=require(_0x3c59('0x7'));var rimraf=require(_0x3c59('0x8'));var config=require(_0x3c59('0x9'));var attributes=require(_0x3c59('0xa'));module[_0x3c59('0xb')]=function(_0x63eae1,_0x3be4fb){return _0x63eae1['define']('Condition',attributes,{'tableName':_0x3c59('0xc'),'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 7b26720..18a79e7 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 _0xdb1d=['jayson/promise','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2758f8,_0x49a1ee){var _0x1ef670=function(_0x9f86d0){while(--_0x9f86d0){_0x2758f8['push'](_0x2758f8['shift']());}};_0x1ef670(++_0x49a1ee);}(_0xdb1d,0xb3));var _0xddb1=function(_0x57555f,_0x3c6a1f){_0x57555f=_0x57555f-0x0;var _0xda0def=_0xdb1d[_0x57555f];return _0xda0def;};'use strict';var _=require(_0xddb1('0x0'));var util=require(_0xddb1('0x1'));var moment=require(_0xddb1('0x2'));var BPromise=require(_0xddb1('0x3'));var rs=require(_0xddb1('0x4'));var fs=require('fs');var Redis=require(_0xddb1('0x5'));var db=require(_0xddb1('0x6'))['db'];var utils=require(_0xddb1('0x7'));var logger=require(_0xddb1('0x8'))('rpc');var config=require(_0xddb1('0x9'));var jayson=require(_0xddb1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3532b4,_0x5c6379,_0x514336){return new BPromise(function(_0x122579,_0x3ea77c){return client['request'](_0x3532b4,_0x514336)[_0xddb1('0xb')](function(_0x227c15){logger[_0xddb1('0xc')](_0xddb1('0xd'),_0x5c6379,_0xddb1('0xe'));logger[_0xddb1('0xf')](_0xddb1('0x10'),_0x5c6379,'request\x20sent',JSON[_0xddb1('0x11')](_0x227c15));if(_0x227c15['error']){if(_0x227c15[_0xddb1('0x12')]['code']===0x1f4){logger['error'](_0xddb1('0xd'),_0x5c6379,_0x227c15[_0xddb1('0x12')][_0xddb1('0x13')]);return _0x3ea77c(_0x227c15[_0xddb1('0x12')][_0xddb1('0x13')]);}logger[_0xddb1('0x12')](_0xddb1('0xd'),_0x5c6379,_0x227c15[_0xddb1('0x12')][_0xddb1('0x13')]);return _0x122579(_0x227c15[_0xddb1('0x12')][_0xddb1('0x13')]);}else{logger['info'](_0xddb1('0xd'),_0x5c6379,'request\x20sent');_0x122579(_0x227c15['result'][_0xddb1('0x13')]);}})[_0xddb1('0x14')](function(_0x1d8287){logger['error'](_0xddb1('0xd'),_0x5c6379,_0x1d8287);_0x3ea77c(_0x1d8287);});});} \ No newline at end of file +var _0x49d0=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','bluebird'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x49d0,0x1b8));var _0x049d=function(_0x4631c7,_0x25c495){_0x4631c7=_0x4631c7-0x0;var _0x70af4f=_0x49d0[_0x4631c7];return _0x70af4f;};'use strict';var _=require(_0x049d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x049d('0x1'));var rs=require(_0x049d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x049d('0x3'));var logger=require(_0x049d('0x4'))(_0x049d('0x5'));var config=require('../../config/environment');var jayson=require(_0x049d('0x6'));var client=jayson[_0x049d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a401f,_0xb2ee9b,_0x4d7634){return new BPromise(function(_0x35359c,_0x22d3a7){return client[_0x049d('0x8')](_0x1a401f,_0x4d7634)['then'](function(_0x5e35ef){logger[_0x049d('0x9')](_0x049d('0xa'),_0xb2ee9b,'request\x20sent');logger['debug'](_0x049d('0xb'),_0xb2ee9b,'request\x20sent',JSON[_0x049d('0xc')](_0x5e35ef));if(_0x5e35ef[_0x049d('0xd')]){if(_0x5e35ef[_0x049d('0xd')]['code']===0x1f4){logger[_0x049d('0xd')](_0x049d('0xa'),_0xb2ee9b,_0x5e35ef[_0x049d('0xd')][_0x049d('0xe')]);return _0x22d3a7(_0x5e35ef['error'][_0x049d('0xe')]);}logger['error']('Condition,\x20%s,\x20%s',_0xb2ee9b,_0x5e35ef[_0x049d('0xd')]['message']);return _0x35359c(_0x5e35ef[_0x049d('0xd')][_0x049d('0xe')]);}else{logger[_0x049d('0x9')](_0x049d('0xa'),_0xb2ee9b,_0x049d('0xf'));_0x35359c(_0x5e35ef['result'][_0x049d('0xe')]);}})[_0x049d('0x10')](function(_0x1a4f81){logger['error'](_0x049d('0xa'),_0xb2ee9b,_0x1a4f81);_0x22d3a7(_0x1a4f81);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index cfffb7d..fd66d7c 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 _0x64e6=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','delete','isAuthenticated','destroy'];(function(_0x3bfc71,_0x3858e1){var _0x270d6f=function(_0x2c8ef7){while(--_0x2c8ef7){_0x3bfc71['push'](_0x3bfc71['shift']());}};_0x270d6f(++_0x3858e1);}(_0x64e6,0xb1));var _0x664e=function(_0x60932,_0x8122f4){_0x60932=_0x60932-0x0;var _0x4a201e=_0x64e6[_0x60932];return _0x4a201e;};'use strict';var multer=require(_0x664e('0x0'));var util=require(_0x664e('0x1'));var path=require(_0x664e('0x2'));var timeout=require(_0x664e('0x3'));var express=require(_0x664e('0x4'));var router=express[_0x664e('0x5')]();var fs_extra=require(_0x664e('0x6'));var auth=require(_0x664e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x664e('0x8'));var controller=require(_0x664e('0x9'));router[_0x664e('0xa')](_0x664e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x664e('0xc')](_0x664e('0xb'),auth[_0x664e('0xd')](),controller[_0x664e('0xe')]);module[_0x664e('0xf')]=router; \ No newline at end of file +var _0x5257=['update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id'];(function(_0xae0e3c,_0x137faa){var _0xa7e346=function(_0x297834){while(--_0x297834){_0xae0e3c['push'](_0xae0e3c['shift']());}};_0xa7e346(++_0x137faa);}(_0x5257,0x116));var _0x7525=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x5257[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0x7525('0x0'));var util=require(_0x7525('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7525('0x2'));var router=express[_0x7525('0x3')]();var fs_extra=require(_0x7525('0x4'));var auth=require(_0x7525('0x5'));var interaction=require(_0x7525('0x6'));var config=require(_0x7525('0x7'));var controller=require('./condition.controller');router[_0x7525('0x8')](_0x7525('0x9'),auth['isAuthenticated'](),controller[_0x7525('0xa')]);router[_0x7525('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 400e46e..293b3a7 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 _0x7300=['exports','name','INTEGER','STRING','sequelize'];(function(_0x3ce82c,_0x519b0a){var _0xdfdc80=function(_0x4b5b8c){while(--_0x4b5b8c){_0x3ce82c['push'](_0x3ce82c['shift']());}};_0xdfdc80(++_0x519b0a);}(_0x7300,0x72));var _0x0730=function(_0x1912a0,_0x3a24a2){_0x1912a0=_0x1912a0-0x0;var _0x545a78=_0x7300[_0x1912a0];return _0x545a78;};'use strict';var Sequelize=require(_0x0730('0x0'));module[_0x0730('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0730('0x2')},'OrderBy':{'type':Sequelize[_0x0730('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0730('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x634e=['INTEGER','sequelize','exports','STRING','name'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x634e,0x1b9));var _0xe634=function(_0x3af54c,_0x436158){_0x3af54c=_0x3af54c-0x0;var _0x4bc816=_0x634e[_0x3af54c];return _0x4bc816;};'use strict';var Sequelize=require(_0xe634('0x0'));module[_0xe634('0x1')]={'name':{'type':Sequelize[_0xe634('0x2')],'allowNull':![],'unique':_0xe634('0x3')},'OrderBy':{'type':Sequelize[_0xe634('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 55163af..2e7ad24 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 _0xd914=['count','set','Content-Range','apply','reject','update','then','destroy','ContactItemTypes','UserProfileResource','name','send','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','options','ContactItemType','includeAll','include','rows','catch','show','params','merge','find','create','body','get','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x416d75,_0x2c8e81){var _0x10af66=function(_0x48f136){while(--_0x48f136){_0x416d75['push'](_0x416d75['shift']());}};_0x10af66(++_0x2c8e81);}(_0xd914,0x17f));var _0x4d91=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0xd914[_0x912d27];return _0x31b918;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];function respondWithStatusCode(_0x1c15b7,_0x318e0c){_0x318e0c=_0x318e0c||0xcc;return function(_0x4ea591){if(_0x4ea591){return _0x1c15b7['sendStatus'](_0x318e0c);}return _0x1c15b7[_0x4d91('0x1b')](_0x318e0c)[_0x4d91('0x1c')]();};}function respondWithResult(_0xb6590d,_0x3c9fd6){_0x3c9fd6=_0x3c9fd6||0xc8;return function(_0x33fbd4){if(_0x33fbd4){return _0xb6590d[_0x4d91('0x1b')](_0x3c9fd6)[_0x4d91('0x1d')](_0x33fbd4);}};}function respondWithFilteredResult(_0x4f5aef,_0x3a8ec9){return function(_0x42631a){if(_0x42631a){var _0x1e2ef7=typeof _0x3a8ec9[_0x4d91('0x1e')]===_0x4d91('0x1f')&&typeof _0x3a8ec9['limit']===_0x4d91('0x1f');var _0xb75abf=_0x42631a[_0x4d91('0x20')];var _0x44b9a7=_0x1e2ef7?0x0:_0x3a8ec9['offset'];var _0x350e23=_0x1e2ef7?_0x42631a[_0x4d91('0x20')]:_0x3a8ec9[_0x4d91('0x1e')]+_0x3a8ec9['limit'];var _0x13ef2c;if(_0x350e23>=_0xb75abf){_0x350e23=_0xb75abf;_0x13ef2c=0xc8;}else{_0x13ef2c=0xce;}_0x4f5aef[_0x4d91('0x1b')](_0x13ef2c);return _0x4f5aef[_0x4d91('0x21')](_0x4d91('0x22'),_0x44b9a7+'-'+_0x350e23+'/'+_0xb75abf)[_0x4d91('0x1d')](_0x42631a);}return null;};}function patchUpdates(_0x40cde4){return function(_0xc1d44f){try{jsonpatch[_0x4d91('0x23')](_0xc1d44f,_0x40cde4,!![]);}catch(_0x30d911){return BPromise[_0x4d91('0x24')](_0x30d911);}return _0xc1d44f['save']();};}function saveUpdates(_0x4493da,_0x5f5236){return function(_0x57913e){if(_0x57913e){return _0x57913e[_0x4d91('0x25')](_0x4493da)[_0x4d91('0x26')](function(_0x341d18){return _0x341d18;});}return null;};}function removeEntity(_0x9cb864,_0x7d8cbf){return function(_0x12b722){if(_0x12b722){return _0x12b722[_0x4d91('0x27')]()[_0x4d91('0x26')](function(){var _0x55356b=_0x12b722['get']({'plain':!![]});var _0x1ee6b3=_0x4d91('0x28');return db[_0x4d91('0x29')][_0x4d91('0x27')]({'where':{'type':_0x1ee6b3,'resourceId':_0x55356b['id']}})[_0x4d91('0x26')](function(){return _0x12b722;});})[_0x4d91('0x26')](function(){_0x9cb864[_0x4d91('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dc353,_0xda9802){return function(_0x12ac74){if(!_0x12ac74){_0x3dc353['sendStatus'](0x194);}return _0x12ac74;};}function handleError(_0x480a56,_0x299f27){_0x299f27=_0x299f27||0x1f4;return function(_0x470079){logger['error'](_0x470079['stack']);if(_0x470079[_0x4d91('0x2a')]){delete _0x470079[_0x4d91('0x2a')];}_0x480a56[_0x4d91('0x1b')](_0x299f27)[_0x4d91('0x2b')](_0x470079);};}exports['index']=function(_0x2587a1,_0x31bbf8){var _0x468e95={},_0xee7535={},_0xa63422={'count':0x0,'rows':[]};var _0x3466f3=_[_0x4d91('0x2c')](db['ContactItemType'][_0x4d91('0x2d')],function(_0x4f44ff){return{'name':_0x4f44ff['fieldName'],'type':_0x4f44ff[_0x4d91('0x2e')][_0x4d91('0x2f')]};});_0xee7535['model']=_[_0x4d91('0x2c')](_0x3466f3,_0x4d91('0x2a'));_0xee7535[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x2587a1[_0x4d91('0x30')]);_0xee7535['filters']=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],_0xee7535[_0x4d91('0x30')]);_0x468e95[_0x4d91('0x34')]=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],qs['fields'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x35')]));_0x468e95['attributes']=_0x468e95[_0x4d91('0x34')][_0x4d91('0x36')]?_0x468e95[_0x4d91('0x34')]:_0xee7535['model'];if(!_0x2587a1[_0x4d91('0x30')][_0x4d91('0x37')](_0x4d91('0x38'))){_0x468e95[_0x4d91('0x39')]=qs['limit'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x39')]);_0x468e95[_0x4d91('0x1e')]=qs[_0x4d91('0x1e')](_0x2587a1['query']['offset']);}_0x468e95[_0x4d91('0x3a')]=qs[_0x4d91('0x3b')](_0x2587a1['query'][_0x4d91('0x3b')]);_0x468e95[_0x4d91('0x3c')]=qs[_0x4d91('0x3d')](_[_0x4d91('0x3e')](_0x2587a1['query'],_0xee7535[_0x4d91('0x3d')]),_0x3466f3);if(_0x2587a1[_0x4d91('0x30')]['filter']){_0x468e95[_0x4d91('0x3c')]=_['merge'](_0x468e95[_0x4d91('0x3c')],{'$or':_['map'](_0x3466f3,function(_0x2dc892){if(_0x2dc892['type']!==_0x4d91('0x3f')){var _0x2782d2={};_0x2782d2[_0x2dc892[_0x4d91('0x2a')]]={'$like':'%'+_0x2587a1[_0x4d91('0x30')]['filter']+'%'};return _0x2782d2;}})});}_0x468e95=_['merge']({},_0x468e95,_0x2587a1[_0x4d91('0x40')]);var _0x55c8d0={'where':_0x468e95[_0x4d91('0x3c')]};return db[_0x4d91('0x41')]['count'](_0x55c8d0)[_0x4d91('0x26')](function(_0x2ae356){_0xa63422[_0x4d91('0x20')]=_0x2ae356;if(_0x2587a1[_0x4d91('0x30')][_0x4d91('0x42')]){_0x468e95[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x41')]['findAll'](_0x468e95);})[_0x4d91('0x26')](function(_0x4c70af){_0xa63422[_0x4d91('0x44')]=_0x4c70af;return _0xa63422;})[_0x4d91('0x26')](respondWithFilteredResult(_0x31bbf8,_0x468e95))[_0x4d91('0x45')](handleError(_0x31bbf8,null));};exports[_0x4d91('0x46')]=function(_0x20ec78,_0x1fc884){var _0x4b8e12={'raw':!![],'where':{'id':_0x20ec78[_0x4d91('0x47')]['id']}},_0x4ffc08={};_0x4ffc08[_0x4d91('0x33')]=_['keys'](db[_0x4d91('0x41')][_0x4d91('0x2d')]);_0x4ffc08[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x20ec78[_0x4d91('0x30')]);_0x4ffc08[_0x4d91('0x3d')]=_[_0x4d91('0x32')](_0x4ffc08[_0x4d91('0x33')],_0x4ffc08[_0x4d91('0x30')]);_0x4b8e12['attributes']=_['intersection'](_0x4ffc08[_0x4d91('0x33')],qs['fields'](_0x20ec78[_0x4d91('0x30')][_0x4d91('0x35')]));_0x4b8e12[_0x4d91('0x34')]=_0x4b8e12[_0x4d91('0x34')]['length']?_0x4b8e12[_0x4d91('0x34')]:_0x4ffc08['model'];if(_0x20ec78['query'][_0x4d91('0x42')]){_0x4b8e12[_0x4d91('0x43')]=[{'all':!![]}];}_0x4b8e12=_[_0x4d91('0x48')]({},_0x4b8e12,_0x20ec78[_0x4d91('0x40')]);return db[_0x4d91('0x41')][_0x4d91('0x49')](_0x4b8e12)['then'](handleEntityNotFound(_0x1fc884,null))[_0x4d91('0x26')](respondWithResult(_0x1fc884,null))[_0x4d91('0x45')](handleError(_0x1fc884,null));};exports[_0x4d91('0x4a')]=function(_0x449dd8,_0x106e5b){return db[_0x4d91('0x41')][_0x4d91('0x4a')](_0x449dd8[_0x4d91('0x4b')],{})[_0x4d91('0x26')](function(_0x145dfd){var _0x16f776=_0x449dd8['user'][_0x4d91('0x4c')]({'plain':!![]});if(!_0x16f776)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16f776[_0x4d91('0x4d')]===_0x4d91('0x4e')){var _0x195e65=_0x145dfd[_0x4d91('0x4c')]({'plain':!![]});var _0x436a3d=_0x4d91('0x28');return db[_0x4d91('0x4f')][_0x4d91('0x49')]({'where':{'name':_0x436a3d,'userProfileId':_0x16f776['userProfileId']},'raw':!![]})[_0x4d91('0x26')](function(_0x43e72c){if(_0x43e72c&&_0x43e72c[_0x4d91('0x50')]===0x0){return db[_0x4d91('0x29')][_0x4d91('0x4a')]({'name':_0x195e65[_0x4d91('0x2a')],'resourceId':_0x195e65['id'],'type':_0x43e72c[_0x4d91('0x2a')],'sectionId':_0x43e72c['id']},{})['then'](function(){return _0x145dfd;});}else{return _0x145dfd;}})[_0x4d91('0x45')](function(_0x2159e4){logger[_0x4d91('0x51')](_0x4d91('0x52'),_0x2159e4);throw _0x2159e4;});}return _0x145dfd;})[_0x4d91('0x26')](respondWithResult(_0x106e5b,0xc9))[_0x4d91('0x45')](handleError(_0x106e5b,null));};exports[_0x4d91('0x25')]=function(_0x4138c5,_0x645923){if(_0x4138c5[_0x4d91('0x4b')]['id']){delete _0x4138c5[_0x4d91('0x4b')]['id'];}return db[_0x4d91('0x41')][_0x4d91('0x49')]({'where':{'id':_0x4138c5[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x645923,null))[_0x4d91('0x26')](saveUpdates(_0x4138c5[_0x4d91('0x4b')],null))['then'](respondWithResult(_0x645923,null))['catch'](handleError(_0x645923,null));};exports['destroy']=function(_0x45cf4e,_0x10c1dd){return db[_0x4d91('0x41')]['find']({'where':{'id':_0x45cf4e[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x10c1dd,null))[_0x4d91('0x26')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x45cf4e['params']['id']}}))[_0x4d91('0x26')](removeEntity(_0x10c1dd,null))[_0x4d91('0x45')](handleError(_0x10c1dd,null));}; \ No newline at end of file +var _0xd824=['query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','stack','index','ContactItemType','rawAttributes','fieldName','key','map','name'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xd824,0xc2));var _0x4d82=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd824[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x4d82('0x0'));var rimraf=require(_0x4d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d82('0x2'));var moment=require(_0x4d82('0x3'));var BPromise=require(_0x4d82('0x4'));var Mustache=require(_0x4d82('0x5'));var util=require(_0x4d82('0x6'));var path=require(_0x4d82('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d82('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d82('0x9'));var crypto=require(_0x4d82('0xa'));var jsforce=require(_0x4d82('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4d82('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d82('0xd'));var authService=require(_0x4d82('0xe'));var qs=require(_0x4d82('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d82('0x10'));var logger=require('../../config/logger')(_0x4d82('0x11'));var utils=require(_0x4d82('0x12'));var config=require(_0x4d82('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x346394,_0x248eed){_0x248eed=_0x248eed||0xcc;return function(_0x319ba8){if(_0x319ba8){return _0x346394[_0x4d82('0x14')](_0x248eed);}return _0x346394['status'](_0x248eed)[_0x4d82('0x15')]();};}function respondWithResult(_0x2094bc,_0x41f5b2){_0x41f5b2=_0x41f5b2||0xc8;return function(_0x486152){if(_0x486152){return _0x2094bc[_0x4d82('0x16')](_0x41f5b2)['json'](_0x486152);}};}function respondWithFilteredResult(_0x3382c4,_0x5012db){return function(_0x469e09){if(_0x469e09){var _0x496f3b=typeof _0x5012db[_0x4d82('0x17')]===_0x4d82('0x18')&&typeof _0x5012db[_0x4d82('0x19')]===_0x4d82('0x18');var _0x2648a8=_0x469e09[_0x4d82('0x1a')];var _0x258c59=_0x496f3b?0x0:_0x5012db[_0x4d82('0x17')];var _0x2f2127=_0x496f3b?_0x469e09['count']:_0x5012db[_0x4d82('0x17')]+_0x5012db[_0x4d82('0x19')];var _0x1b1e39;if(_0x2f2127>=_0x2648a8){_0x2f2127=_0x2648a8;_0x1b1e39=0xc8;}else{_0x1b1e39=0xce;}_0x3382c4[_0x4d82('0x16')](_0x1b1e39);return _0x3382c4[_0x4d82('0x1b')](_0x4d82('0x1c'),_0x258c59+'-'+_0x2f2127+'/'+_0x2648a8)[_0x4d82('0x1d')](_0x469e09);}return null;};}function patchUpdates(_0x64669c){return function(_0x19832f){try{jsonpatch[_0x4d82('0x1e')](_0x19832f,_0x64669c,!![]);}catch(_0xf2f5a5){return BPromise['reject'](_0xf2f5a5);}return _0x19832f[_0x4d82('0x1f')]();};}function saveUpdates(_0x748ee7,_0x5e5bdf){return function(_0x1a419f){if(_0x1a419f){return _0x1a419f[_0x4d82('0x20')](_0x748ee7)[_0x4d82('0x21')](function(_0x14a2d4){return _0x14a2d4;});}return null;};}function removeEntity(_0xe17d70,_0x15f5d1){return function(_0x11c043){if(_0x11c043){return _0x11c043[_0x4d82('0x22')]()[_0x4d82('0x21')](function(){var _0x2df104=_0x11c043[_0x4d82('0x23')]({'plain':!![]});var _0x395efc=_0x4d82('0x24');return db[_0x4d82('0x25')][_0x4d82('0x22')]({'where':{'type':_0x395efc,'resourceId':_0x2df104['id']}})['then'](function(){return _0x11c043;});})['then'](function(){_0xe17d70[_0x4d82('0x16')](0xcc)[_0x4d82('0x15')]();});}};}function handleEntityNotFound(_0x2a0572,_0x3348d9){return function(_0x5cbd7e){if(!_0x5cbd7e){_0x2a0572[_0x4d82('0x14')](0x194);}return _0x5cbd7e;};}function handleError(_0x33cb5a,_0x128817){_0x128817=_0x128817||0x1f4;return function(_0x11d022){logger['error'](_0x11d022[_0x4d82('0x26')]);if(_0x11d022['name']){delete _0x11d022['name'];}_0x33cb5a['status'](_0x128817)['send'](_0x11d022);};}exports[_0x4d82('0x27')]=function(_0x8cfbf1,_0x88318c){var _0x52e320={},_0x713c56={},_0x37cdc4={'count':0x0,'rows':[]};var _0x5cf3e6=_['map'](db[_0x4d82('0x28')][_0x4d82('0x29')],function(_0x16d30a){return{'name':_0x16d30a[_0x4d82('0x2a')],'type':_0x16d30a['type'][_0x4d82('0x2b')]};});_0x713c56['model']=_[_0x4d82('0x2c')](_0x5cf3e6,_0x4d82('0x2d'));_0x713c56['query']=_['keys'](_0x8cfbf1[_0x4d82('0x2e')]);_0x713c56[_0x4d82('0x2f')]=_[_0x4d82('0x30')](_0x713c56[_0x4d82('0x31')],_0x713c56[_0x4d82('0x2e')]);_0x52e320[_0x4d82('0x32')]=_[_0x4d82('0x30')](_0x713c56[_0x4d82('0x31')],qs[_0x4d82('0x33')](_0x8cfbf1[_0x4d82('0x2e')]['fields']));_0x52e320[_0x4d82('0x32')]=_0x52e320[_0x4d82('0x32')][_0x4d82('0x34')]?_0x52e320['attributes']:_0x713c56[_0x4d82('0x31')];if(!_0x8cfbf1[_0x4d82('0x2e')]['hasOwnProperty'](_0x4d82('0x35'))){_0x52e320[_0x4d82('0x19')]=qs[_0x4d82('0x19')](_0x8cfbf1['query'][_0x4d82('0x19')]);_0x52e320[_0x4d82('0x17')]=qs['offset'](_0x8cfbf1[_0x4d82('0x2e')]['offset']);}_0x52e320[_0x4d82('0x36')]=qs[_0x4d82('0x37')](_0x8cfbf1['query'][_0x4d82('0x37')]);_0x52e320['where']=qs[_0x4d82('0x2f')](_['pick'](_0x8cfbf1['query'],_0x713c56[_0x4d82('0x2f')]),_0x5cf3e6);if(_0x8cfbf1['query'][_0x4d82('0x38')]){_0x52e320['where']=_[_0x4d82('0x39')](_0x52e320[_0x4d82('0x3a')],{'$or':_['map'](_0x5cf3e6,function(_0x28f826){if(_0x28f826['type']!==_0x4d82('0x3b')){var _0xc541b5={};_0xc541b5[_0x28f826['name']]={'$like':'%'+_0x8cfbf1[_0x4d82('0x2e')]['filter']+'%'};return _0xc541b5;}})});}_0x52e320=_[_0x4d82('0x39')]({},_0x52e320,_0x8cfbf1[_0x4d82('0x3c')]);var _0x25b5e2={'where':_0x52e320[_0x4d82('0x3a')]};return db[_0x4d82('0x28')][_0x4d82('0x1a')](_0x25b5e2)['then'](function(_0x222b35){_0x37cdc4[_0x4d82('0x1a')]=_0x222b35;if(_0x8cfbf1[_0x4d82('0x2e')][_0x4d82('0x3d')]){_0x52e320[_0x4d82('0x3e')]=[{'all':!![]}];}return db[_0x4d82('0x28')][_0x4d82('0x3f')](_0x52e320);})['then'](function(_0x3c80d6){_0x37cdc4[_0x4d82('0x40')]=_0x3c80d6;return _0x37cdc4;})[_0x4d82('0x21')](respondWithFilteredResult(_0x88318c,_0x52e320))[_0x4d82('0x41')](handleError(_0x88318c,null));};exports[_0x4d82('0x42')]=function(_0x5b9cd8,_0x6e68d2){var _0x1592fe={'raw':!![],'where':{'id':_0x5b9cd8[_0x4d82('0x43')]['id']}},_0x3f0a9f={};_0x3f0a9f[_0x4d82('0x31')]=_[_0x4d82('0x44')](db[_0x4d82('0x28')]['rawAttributes']);_0x3f0a9f[_0x4d82('0x2e')]=_[_0x4d82('0x44')](_0x5b9cd8['query']);_0x3f0a9f[_0x4d82('0x2f')]=_['intersection'](_0x3f0a9f[_0x4d82('0x31')],_0x3f0a9f[_0x4d82('0x2e')]);_0x1592fe['attributes']=_[_0x4d82('0x30')](_0x3f0a9f[_0x4d82('0x31')],qs['fields'](_0x5b9cd8[_0x4d82('0x2e')][_0x4d82('0x33')]));_0x1592fe[_0x4d82('0x32')]=_0x1592fe['attributes'][_0x4d82('0x34')]?_0x1592fe[_0x4d82('0x32')]:_0x3f0a9f['model'];if(_0x5b9cd8['query'][_0x4d82('0x3d')]){_0x1592fe[_0x4d82('0x3e')]=[{'all':!![]}];}_0x1592fe=_[_0x4d82('0x39')]({},_0x1592fe,_0x5b9cd8[_0x4d82('0x3c')]);return db[_0x4d82('0x28')][_0x4d82('0x45')](_0x1592fe)[_0x4d82('0x21')](handleEntityNotFound(_0x6e68d2,null))['then'](respondWithResult(_0x6e68d2,null))[_0x4d82('0x41')](handleError(_0x6e68d2,null));};exports[_0x4d82('0x46')]=function(_0x2e4083,_0x234ce3){return db['ContactItemType']['create'](_0x2e4083['body'],{})[_0x4d82('0x21')](function(_0xcd5941){var _0x21bbdb=_0x2e4083[_0x4d82('0x47')][_0x4d82('0x23')]({'plain':!![]});if(!_0x21bbdb)throw new Error(_0x4d82('0x48'));if(_0x21bbdb['role']===_0x4d82('0x47')){var _0x1c022d=_0xcd5941[_0x4d82('0x23')]({'plain':!![]});var _0x34be19=_0x4d82('0x24');return db[_0x4d82('0x49')][_0x4d82('0x45')]({'where':{'name':_0x34be19,'userProfileId':_0x21bbdb[_0x4d82('0x4a')]},'raw':!![]})[_0x4d82('0x21')](function(_0x4ca465){if(_0x4ca465&&_0x4ca465[_0x4d82('0x4b')]===0x0){return db[_0x4d82('0x25')][_0x4d82('0x46')]({'name':_0x1c022d[_0x4d82('0x2d')],'resourceId':_0x1c022d['id'],'type':_0x4ca465[_0x4d82('0x2d')],'sectionId':_0x4ca465['id']},{})[_0x4d82('0x21')](function(){return _0xcd5941;});}else{return _0xcd5941;}})['catch'](function(_0x5cf138){logger[_0x4d82('0x4c')](_0x4d82('0x4d'),_0x5cf138);throw _0x5cf138;});}return _0xcd5941;})[_0x4d82('0x21')](respondWithResult(_0x234ce3,0xc9))[_0x4d82('0x41')](handleError(_0x234ce3,null));};exports[_0x4d82('0x20')]=function(_0x24629a,_0x200958){if(_0x24629a[_0x4d82('0x4e')]['id']){delete _0x24629a[_0x4d82('0x4e')]['id'];}return db[_0x4d82('0x28')][_0x4d82('0x45')]({'where':{'id':_0x24629a[_0x4d82('0x43')]['id']}})['then'](handleEntityNotFound(_0x200958,null))[_0x4d82('0x21')](saveUpdates(_0x24629a['body'],null))['then'](respondWithResult(_0x200958,null))[_0x4d82('0x41')](handleError(_0x200958,null));};exports[_0x4d82('0x22')]=function(_0x257dc4,_0x4fad01){return db[_0x4d82('0x28')][_0x4d82('0x45')]({'where':{'id':_0x257dc4[_0x4d82('0x43')]['id']}})[_0x4d82('0x21')](handleEntityNotFound(_0x4fad01,null))['then'](db[_0x4d82('0x4f')][_0x4d82('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x257dc4[_0x4d82('0x43')]['id']}}))[_0x4d82('0x21')](removeEntity(_0x4fad01,null))[_0x4d82('0x41')](handleError(_0x4fad01,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 4198d96..f5c88cf 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 _0x0e74=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','define','ContactItemType','tools_contact_item_types'];(function(_0x284c11,_0x15eed3){var _0x43cc1d=function(_0x45e2c2){while(--_0x45e2c2){_0x284c11['push'](_0x284c11['shift']());}};_0x43cc1d(++_0x15eed3);}(_0x0e74,0x9a));var _0x40e7=function(_0x546e4a,_0x3a0819){_0x546e4a=_0x546e4a-0x0;var _0x398f06=_0x0e74[_0x546e4a];return _0x398f06;};'use strict';var _=require(_0x40e7('0x0'));var util=require(_0x40e7('0x1'));var logger=require('../../config/logger')(_0x40e7('0x2'));var moment=require(_0x40e7('0x3'));var BPromise=require(_0x40e7('0x4'));var rp=require(_0x40e7('0x5'));var fs=require('fs');var path=require(_0x40e7('0x6'));var rimraf=require(_0x40e7('0x7'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module['exports']=function(_0x5b311c,_0x5d0344){return _0x5b311c[_0x40e7('0x8')](_0x40e7('0x9'),attributes,{'tableName':_0x40e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11ed=['api','moment','bluebird','path','../../config/environment','./contactItemType.attributes','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x25f7d0,_0x7eaf73){var _0x5d60f5=function(_0x4088f2){while(--_0x4088f2){_0x25f7d0['push'](_0x25f7d0['shift']());}};_0x5d60f5(++_0x7eaf73);}(_0x11ed,0x10b));var _0xd11e=function(_0x453125,_0x49b046){_0x453125=_0x453125-0x0;var _0x1d3c97=_0x11ed[_0x453125];return _0x1d3c97;};'use strict';var _=require(_0xd11e('0x0'));var util=require(_0xd11e('0x1'));var logger=require(_0xd11e('0x2'))(_0xd11e('0x3'));var moment=require(_0xd11e('0x4'));var BPromise=require(_0xd11e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd11e('0x6'));var rimraf=require('rimraf');var config=require(_0xd11e('0x7'));var attributes=require(_0xd11e('0x8'));module['exports']=function(_0xe70eda,_0x1787a7){return _0xe70eda['define']('ContactItemType',attributes,{'tableName':_0xd11e('0x9'),'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 a4a213b..ed2b3aa 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 _0xe74a=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x115f75,_0x3e6b57){var _0x4e509a=function(_0x3acd7a){while(--_0x3acd7a){_0x115f75['push'](_0x115f75['shift']());}};_0x4e509a(++_0x3e6b57);}(_0xe74a,0x127));var _0xae74=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0xe74a[_0x39a2d6];return _0x23af66;};'use strict';var _=require(_0xae74('0x0'));var util=require(_0xae74('0x1'));var moment=require('moment');var BPromise=require(_0xae74('0x2'));var rs=require(_0xae74('0x3'));var fs=require('fs');var Redis=require(_0xae74('0x4'));var db=require(_0xae74('0x5'))['db'];var utils=require(_0xae74('0x6'));var logger=require('../../config/logger')(_0xae74('0x7'));var config=require('../../config/environment');var jayson=require(_0xae74('0x8'));var client=jayson[_0xae74('0x9')][_0xae74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e19e6,_0x2dc15e,_0x122b87){return new BPromise(function(_0x13cc22,_0x458bf7){return client[_0xae74('0xb')](_0x1e19e6,_0x122b87)[_0xae74('0xc')](function(_0x6edd7b){logger[_0xae74('0xd')](_0xae74('0xe'),_0x2dc15e,_0xae74('0xf'));logger['debug'](_0xae74('0x10'),_0x2dc15e,_0xae74('0xf'),JSON[_0xae74('0x11')](_0x6edd7b));if(_0x6edd7b['error']){if(_0x6edd7b[_0xae74('0x12')][_0xae74('0x13')]===0x1f4){logger[_0xae74('0x12')](_0xae74('0xe'),_0x2dc15e,_0x6edd7b['error'][_0xae74('0x14')]);return _0x458bf7(_0x6edd7b[_0xae74('0x12')][_0xae74('0x14')]);}logger['error'](_0xae74('0xe'),_0x2dc15e,_0x6edd7b[_0xae74('0x12')][_0xae74('0x14')]);return _0x13cc22(_0x6edd7b[_0xae74('0x12')][_0xae74('0x14')]);}else{logger[_0xae74('0xd')](_0xae74('0xe'),_0x2dc15e,_0xae74('0xf'));_0x13cc22(_0x6edd7b[_0xae74('0x15')]['message']);}})[_0xae74('0x16')](function(_0x148a02){logger['error'](_0xae74('0xe'),_0x2dc15e,_0x148a02);_0x458bf7(_0x148a02);});});} \ No newline at end of file +var _0x3e1d=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x492c1c,_0x15f94a){var _0x26c08d=function(_0xa5833){while(--_0xa5833){_0x492c1c['push'](_0x492c1c['shift']());}};_0x26c08d(++_0x15f94a);}(_0x3e1d,0xad));var _0xd3e1=function(_0x11acac,_0x37d55f){_0x11acac=_0x11acac-0x0;var _0x1daa7e=_0x3e1d[_0x11acac];return _0x1daa7e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd3e1('0x0'));var BPromise=require(_0xd3e1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3e1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3e1('0x3'));var logger=require(_0xd3e1('0x4'))(_0xd3e1('0x5'));var config=require('../../config/environment');var jayson=require(_0xd3e1('0x6'));var client=jayson[_0xd3e1('0x7')][_0xd3e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40dab3,_0x1d7951,_0x35af20){return new BPromise(function(_0x217f96,_0x2a7a7a){return client[_0xd3e1('0x9')](_0x40dab3,_0x35af20)[_0xd3e1('0xa')](function(_0x1ef91b){logger[_0xd3e1('0xb')](_0xd3e1('0xc'),_0x1d7951,_0xd3e1('0xd'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1d7951,_0xd3e1('0xd'),JSON[_0xd3e1('0xe')](_0x1ef91b));if(_0x1ef91b[_0xd3e1('0xf')]){if(_0x1ef91b[_0xd3e1('0xf')][_0xd3e1('0x10')]===0x1f4){logger[_0xd3e1('0xf')]('ContactItemType,\x20%s,\x20%s',_0x1d7951,_0x1ef91b['error'][_0xd3e1('0x11')]);return _0x2a7a7a(_0x1ef91b['error'][_0xd3e1('0x11')]);}logger[_0xd3e1('0xf')](_0xd3e1('0xc'),_0x1d7951,_0x1ef91b[_0xd3e1('0xf')][_0xd3e1('0x11')]);return _0x217f96(_0x1ef91b[_0xd3e1('0xf')][_0xd3e1('0x11')]);}else{logger[_0xd3e1('0xb')]('ContactItemType,\x20%s,\x20%s',_0x1d7951,_0xd3e1('0xd'));_0x217f96(_0x1ef91b[_0xd3e1('0x12')]['message']);}})[_0xd3e1('0x13')](function(_0x5c276e){logger[_0xd3e1('0xf')](_0xd3e1('0xc'),_0x1d7951,_0x5c276e);_0x2a7a7a(_0x5c276e);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index fd3cfc2..51667b5 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 _0x4262=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x136e98,_0x1825aa){var _0x15f529=function(_0x252cde){while(--_0x252cde){_0x136e98['push'](_0x136e98['shift']());}};_0x15f529(++_0x1825aa);}(_0x4262,0x10d));var _0x2426=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4262[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x2426('0x0'));var util=require('util');var path=require(_0x2426('0x1'));var timeout=require(_0x2426('0x2'));var express=require(_0x2426('0x3'));var router=express[_0x2426('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2426('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2426('0x6'));var controller=require(_0x2426('0x7'));router[_0x2426('0x8')]('/',auth[_0x2426('0x9')](),controller[_0x2426('0xa')]);router[_0x2426('0x8')](_0x2426('0xb'),auth[_0x2426('0x9')](),controller[_0x2426('0xc')]);router[_0x2426('0xd')]('/',auth[_0x2426('0x9')](),controller[_0x2426('0xe')]);router['put'](_0x2426('0xb'),auth[_0x2426('0x9')](),controller[_0x2426('0xf')]);router['delete'](_0x2426('0xb'),auth[_0x2426('0x9')](),controller[_0x2426('0x10')]);module[_0x2426('0x11')]=router; \ No newline at end of file +var _0x12ab=['../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x12ab,0xff));var _0xb12a=function(_0x12b6ad,_0x106784){_0x12b6ad=_0x12b6ad-0x0;var _0x1f65a8=_0x12ab[_0x12b6ad];return _0x1f65a8;};'use strict';var multer=require(_0xb12a('0x0'));var util=require(_0xb12a('0x1'));var path=require(_0xb12a('0x2'));var timeout=require(_0xb12a('0x3'));var express=require(_0xb12a('0x4'));var router=express[_0xb12a('0x5')]();var fs_extra=require(_0xb12a('0x6'));var auth=require(_0xb12a('0x7'));var interaction=require(_0xb12a('0x8'));var config=require(_0xb12a('0x9'));var controller=require(_0xb12a('0xa'));router[_0xb12a('0xb')]('/',auth[_0xb12a('0xc')](),controller[_0xb12a('0xd')]);router[_0xb12a('0xb')]('/:id',auth[_0xb12a('0xc')](),controller[_0xb12a('0xe')]);router[_0xb12a('0xf')]('/',auth['isAuthenticated'](),controller[_0xb12a('0x10')]);router[_0xb12a('0x11')](_0xb12a('0x12'),auth[_0xb12a('0xc')](),controller['update']);router[_0xb12a('0x13')]('/:id',auth[_0xb12a('0xc')](),controller[_0xb12a('0x14')]);module[_0xb12a('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 6736c1c..e94a517 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x57f23f,_0x5142dd){var _0x3040c8=function(_0x21416b){while(--_0x21416b){_0x57f23f['push'](_0x57f23f['shift']());}};_0x3040c8(++_0x5142dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x19416d,_0x54c85e){_0x19416d=_0x19416d-0x0;var _0x17528f=_0xb10b[_0x19416d];return _0x17528f;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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 d51cc8a..922f798 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 _0xe152=['https://','custom','attrPath','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','sendStatus','error','stack','name','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Dashboard','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','user','role','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value'];(function(_0x404cbf,_0x2daecc){var _0x2602ee=function(_0x409c4c){while(--_0x409c4c){_0x404cbf['push'](_0x404cbf['shift']());}};_0x2602ee(++_0x2daecc);}(_0xe152,0xa6));var _0x2e15=function(_0x36c59a,_0x132d1d){_0x36c59a=_0x36c59a-0x0;var _0x2f1375=_0xe152[_0x36c59a];return _0x2f1375;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e15('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e15('0x1'));var rp=require(_0x2e15('0x2'));var moment=require(_0x2e15('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2e15('0x4'));var util=require(_0x2e15('0x5'));var path=require('path');var sox=require(_0x2e15('0x6'));var csv=require(_0x2e15('0x7'));var ejs=require(_0x2e15('0x8'));var fs=require('fs');var fs_extra=require(_0x2e15('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e15('0xa'));var jsforce=require(_0x2e15('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2e15('0x7'));var querystring=require(_0x2e15('0xc'));var Papa=require(_0x2e15('0xd'));var Redis=require(_0x2e15('0xe'));var authService=require(_0x2e15('0xf'));var qs=require(_0x2e15('0x10'));var as=require(_0x2e15('0x11'));var hardwareService=require(_0x2e15('0x12'));var logger=require(_0x2e15('0x13'))(_0x2e15('0x14'));var utils=require(_0x2e15('0x15'));var config=require(_0x2e15('0x16'));var licenseUtil=require(_0x2e15('0x17'));var db=require(_0x2e15('0x18'))['db'];config[_0x2e15('0x19')]=_[_0x2e15('0x1a')](config[_0x2e15('0x19')],{'host':_0x2e15('0x1b'),'port':0x18eb});var socket=require(_0x2e15('0x1c'))(new Redis(config[_0x2e15('0x19')]));require('./dashboard.socket')[_0x2e15('0x1d')](socket);function respondWithStatusCode(_0xd507d6,_0xf76c3d){_0xf76c3d=_0xf76c3d||0xcc;return function(_0x1f438c){if(_0x1f438c){return _0xd507d6['sendStatus'](_0xf76c3d);}return _0xd507d6[_0x2e15('0x1e')](_0xf76c3d)[_0x2e15('0x1f')]();};}function respondWithResult(_0x131383,_0x2a192d){_0x2a192d=_0x2a192d||0xc8;return function(_0x4cdf1e){if(_0x4cdf1e){return _0x131383[_0x2e15('0x1e')](_0x2a192d)[_0x2e15('0x20')](_0x4cdf1e);}};}function respondWithFilteredResult(_0x9e1988,_0x38f24d){return function(_0x26c1b1){if(_0x26c1b1){var _0x4ae228=typeof _0x38f24d[_0x2e15('0x21')]===_0x2e15('0x22')&&typeof _0x38f24d[_0x2e15('0x23')]==='undefined';var _0xdcdda9=_0x26c1b1[_0x2e15('0x24')];var _0x2a20a5=_0x4ae228?0x0:_0x38f24d[_0x2e15('0x21')];var _0xdbb683=_0x4ae228?_0x26c1b1[_0x2e15('0x24')]:_0x38f24d[_0x2e15('0x21')]+_0x38f24d[_0x2e15('0x23')];var _0x3eacdf;if(_0xdbb683>=_0xdcdda9){_0xdbb683=_0xdcdda9;_0x3eacdf=0xc8;}else{_0x3eacdf=0xce;}_0x9e1988[_0x2e15('0x1e')](_0x3eacdf);return _0x9e1988['set'](_0x2e15('0x25'),_0x2a20a5+'-'+_0xdbb683+'/'+_0xdcdda9)[_0x2e15('0x20')](_0x26c1b1);}return null;};}function patchUpdates(_0x7f0435){return function(_0x13cbbb){try{jsonpatch['apply'](_0x13cbbb,_0x7f0435,!![]);}catch(_0x2ba420){return BPromise[_0x2e15('0x26')](_0x2ba420);}return _0x13cbbb[_0x2e15('0x27')]();};}function saveUpdates(_0x304a37,_0x1e59aa){return function(_0x10e04a){if(_0x10e04a){return _0x10e04a[_0x2e15('0x28')](_0x304a37)[_0x2e15('0x29')](function(_0x508bbf){return _0x508bbf;});}return null;};}function removeEntity(_0x42c271,_0x2e383a){return function(_0x4a4432){if(_0x4a4432){return _0x4a4432[_0x2e15('0x2a')]()['then'](function(){var _0x3601bb=_0x4a4432[_0x2e15('0x2b')]({'plain':!![]});var _0x505117='CustomDashboards';return db['UserProfileResource'][_0x2e15('0x2a')]({'where':{'type':_0x505117,'resourceId':_0x3601bb['id']}})[_0x2e15('0x29')](function(){return _0x4a4432;});})[_0x2e15('0x29')](function(){_0x42c271[_0x2e15('0x1e')](0xcc)[_0x2e15('0x1f')]();});}};}function handleEntityNotFound(_0xa0b401,_0x30a429){return function(_0x76e095){if(!_0x76e095){_0xa0b401[_0x2e15('0x2c')](0x194);}return _0x76e095;};}function handleError(_0x10e884,_0x5c390d){_0x5c390d=_0x5c390d||0x1f4;return function(_0x4d9cdf){logger[_0x2e15('0x2d')](_0x4d9cdf[_0x2e15('0x2e')]);if(_0x4d9cdf[_0x2e15('0x2f')]){delete _0x4d9cdf[_0x2e15('0x2f')];}_0x10e884['status'](_0x5c390d)['send'](_0x4d9cdf);};}exports[_0x2e15('0x30')]=function(_0x18a25a,_0x73fbd4){var _0x333641={},_0x5e04bd={},_0x14899b={'count':0x0,'rows':[]};var _0x4355ac=_[_0x2e15('0x31')](db['Dashboard']['rawAttributes'],function(_0x27893a){return{'name':_0x27893a[_0x2e15('0x32')],'type':_0x27893a[_0x2e15('0x33')][_0x2e15('0x34')]};});_0x5e04bd['model']=_[_0x2e15('0x31')](_0x4355ac,_0x2e15('0x2f'));_0x5e04bd[_0x2e15('0x35')]=_[_0x2e15('0x36')](_0x18a25a['query']);_0x5e04bd[_0x2e15('0x37')]=_[_0x2e15('0x38')](_0x5e04bd[_0x2e15('0x39')],_0x5e04bd[_0x2e15('0x35')]);_0x333641[_0x2e15('0x3a')]=_['intersection'](_0x5e04bd[_0x2e15('0x39')],qs[_0x2e15('0x3b')](_0x18a25a['query'][_0x2e15('0x3b')]));_0x333641['attributes']=_0x333641['attributes'][_0x2e15('0x3c')]?_0x333641[_0x2e15('0x3a')]:_0x5e04bd[_0x2e15('0x39')];if(!_0x18a25a[_0x2e15('0x35')][_0x2e15('0x3d')](_0x2e15('0x3e'))){_0x333641[_0x2e15('0x23')]=qs['limit'](_0x18a25a['query']['limit']);_0x333641[_0x2e15('0x21')]=qs['offset'](_0x18a25a[_0x2e15('0x35')]['offset']);}_0x333641[_0x2e15('0x3f')]=qs[_0x2e15('0x40')](_0x18a25a['query'][_0x2e15('0x40')]);_0x333641[_0x2e15('0x41')]=qs[_0x2e15('0x37')](_[_0x2e15('0x42')](_0x18a25a[_0x2e15('0x35')],_0x5e04bd[_0x2e15('0x37')]),_0x4355ac);if(_0x18a25a[_0x2e15('0x35')][_0x2e15('0x43')]){_0x333641[_0x2e15('0x41')]=_['merge'](_0x333641[_0x2e15('0x41')],{'$or':_[_0x2e15('0x31')](_0x4355ac,function(_0x3fa37a){if(_0x3fa37a[_0x2e15('0x33')]!==_0x2e15('0x44')){var _0x518d45={};_0x518d45[_0x3fa37a[_0x2e15('0x2f')]]={'$like':'%'+_0x18a25a[_0x2e15('0x35')][_0x2e15('0x43')]+'%'};return _0x518d45;}})});}_0x333641=_[_0x2e15('0x45')]({},_0x333641,_0x18a25a[_0x2e15('0x46')]);var _0x3329af={'where':_0x333641[_0x2e15('0x41')]};return db[_0x2e15('0x47')]['count'](_0x3329af)[_0x2e15('0x29')](function(_0x2b5743){_0x14899b[_0x2e15('0x24')]=_0x2b5743;if(_0x18a25a[_0x2e15('0x35')][_0x2e15('0x48')]){_0x333641[_0x2e15('0x49')]=[{'all':!![]}];}return db['Dashboard'][_0x2e15('0x4a')](_0x333641);})[_0x2e15('0x29')](function(_0x18574f){_0x14899b[_0x2e15('0x4b')]=_0x18574f;return _0x14899b;})['then'](respondWithFilteredResult(_0x73fbd4,_0x333641))['catch'](handleError(_0x73fbd4,null));};exports[_0x2e15('0x4c')]=function(_0x485976,_0x30c8d3){var _0x350111={'raw':![],'where':{'id':_0x485976[_0x2e15('0x4d')]['id']}},_0x1c34dc={};_0x1c34dc[_0x2e15('0x39')]=_[_0x2e15('0x36')](db[_0x2e15('0x47')][_0x2e15('0x4e')]);_0x1c34dc['query']=_['keys'](_0x485976[_0x2e15('0x35')]);_0x1c34dc[_0x2e15('0x37')]=_['intersection'](_0x1c34dc[_0x2e15('0x39')],_0x1c34dc[_0x2e15('0x35')]);_0x350111[_0x2e15('0x3a')]=_[_0x2e15('0x38')](_0x1c34dc['model'],qs['fields'](_0x485976[_0x2e15('0x35')][_0x2e15('0x3b')]));_0x350111[_0x2e15('0x3a')]=_0x350111[_0x2e15('0x3a')][_0x2e15('0x3c')]?_0x350111['attributes']:_0x1c34dc[_0x2e15('0x39')];if(_0x485976['query'][_0x2e15('0x48')]){_0x350111[_0x2e15('0x49')]=[{'all':!![]}];}_0x350111=_['merge']({},_0x350111,_0x485976['options']);return db[_0x2e15('0x47')]['find'](_0x350111)[_0x2e15('0x29')](handleEntityNotFound(_0x30c8d3,null))[_0x2e15('0x29')](respondWithResult(_0x30c8d3,null))['catch'](handleError(_0x30c8d3,null));};exports[_0x2e15('0x4f')]=function(_0x139049,_0x3694e1){return db[_0x2e15('0x47')][_0x2e15('0x4f')](_0x139049[_0x2e15('0x50')],{})[_0x2e15('0x29')](function(_0x17f7c6){var _0x275ae7=_0x139049[_0x2e15('0x51')]['get']({'plain':!![]});if(!_0x275ae7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x275ae7[_0x2e15('0x52')]===_0x2e15('0x51')){var _0x104576=_0x17f7c6['get']({'plain':!![]});var _0x12cd86=_0x2e15('0x53');return db[_0x2e15('0x54')][_0x2e15('0x55')]({'where':{'name':_0x12cd86,'userProfileId':_0x275ae7[_0x2e15('0x56')]},'raw':!![]})[_0x2e15('0x29')](function(_0x5cf254){if(_0x5cf254&&_0x5cf254[_0x2e15('0x57')]===0x0){return db[_0x2e15('0x58')][_0x2e15('0x4f')]({'name':_0x104576['name'],'resourceId':_0x104576['id'],'type':_0x5cf254[_0x2e15('0x2f')],'sectionId':_0x5cf254['id']},{})[_0x2e15('0x29')](function(){return _0x17f7c6;});}else{return _0x17f7c6;}})['catch'](function(_0x2660d0){logger[_0x2e15('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2660d0);throw _0x2660d0;});}return _0x17f7c6;})[_0x2e15('0x29')](respondWithResult(_0x3694e1,0xc9))[_0x2e15('0x59')](handleError(_0x3694e1,null));};exports[_0x2e15('0x5a')]=function(_0x37137d,_0x287161){var _0x302be6={'where':{'id':_0x37137d[_0x2e15('0x4d')]['id']}},_0x493c6a={};_0x493c6a[_0x2e15('0x39')]=_[_0x2e15('0x36')](db[_0x2e15('0x47')][_0x2e15('0x4e')]);_0x302be6[_0x2e15('0x3a')]=_[_0x2e15('0x38')](_0x493c6a[_0x2e15('0x39')],qs['fields'](_0x37137d[_0x2e15('0x35')][_0x2e15('0x3b')]));_0x302be6[_0x2e15('0x3a')]=_0x302be6['attributes']['length']?_0x302be6[_0x2e15('0x3a')]:_0x493c6a[_0x2e15('0x39')];if(_0x37137d[_0x2e15('0x35')][_0x2e15('0x48')]){_0x302be6[_0x2e15('0x49')]=[{'all':!![]}];}_0x302be6=_[_0x2e15('0x45')]({},_0x302be6,_0x37137d[_0x2e15('0x46')]);return db[_0x2e15('0x47')]['find'](_0x302be6)['then'](handleEntityNotFound(_0x287161,null))[_0x2e15('0x29')](function(_0x78cb62){if(_0x78cb62){var _0x5a9028=_0x78cb62[_0x2e15('0x2b')]({'plain':!![]});_0x5a9028=qs['omit'](_0x5a9028,['id',_0x2e15('0x5b'),_0x2e15('0x5c')]);_0x37137d['body']=_[_0x2e15('0x5d')](_0x37137d['body'],['id',_0x2e15('0x5b'),_0x2e15('0x5c')]);return db[_0x2e15('0x47')]['create'](_['merge'](_0x5a9028,_0x37137d[_0x2e15('0x50')]),{'include':_0x37137d[_0x2e15('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x2e15('0x29')](function(_0x227cae){var _0x379ff4=_0x37137d['user'][_0x2e15('0x2b')]({'plain':!![]});if(!_0x379ff4)throw new Error(_0x2e15('0x5e'));if(_0x379ff4[_0x2e15('0x52')]==='user'){var _0x199373=_0x227cae[_0x2e15('0x2b')]({'plain':!![]});var _0x13e588=_0x2e15('0x53');return db[_0x2e15('0x54')][_0x2e15('0x55')]({'where':{'name':_0x13e588,'userProfileId':_0x379ff4[_0x2e15('0x56')]},'raw':!![]})[_0x2e15('0x29')](function(_0x2ad965){if(_0x2ad965&&_0x2ad965[_0x2e15('0x57')]===0x0){return db['UserProfileResource'][_0x2e15('0x4f')]({'name':_0x199373[_0x2e15('0x2f')],'resourceId':_0x199373['id'],'type':_0x2ad965[_0x2e15('0x2f')],'sectionId':_0x2ad965['id']},{})[_0x2e15('0x29')](function(){return _0x227cae;});}else{return _0x227cae;}})['catch'](function(_0x418a92){logger['error'](_0x2e15('0x5f'),_0x418a92);throw _0x418a92;});}return _0x227cae;});}})[_0x2e15('0x29')](respondWithResult(_0x287161,0xc9))['catch'](handleError(_0x287161,null));};exports[_0x2e15('0x28')]=function(_0xa6dcc8,_0x458147){if(_0xa6dcc8[_0x2e15('0x50')]['id']){delete _0xa6dcc8[_0x2e15('0x50')]['id'];}return db[_0x2e15('0x47')][_0x2e15('0x55')]({'where':{'id':_0xa6dcc8[_0x2e15('0x4d')]['id']}})[_0x2e15('0x29')](handleEntityNotFound(_0x458147,null))['then'](saveUpdates(_0xa6dcc8[_0x2e15('0x50')],null))[_0x2e15('0x29')](respondWithResult(_0x458147,null))[_0x2e15('0x59')](handleError(_0x458147,null));};exports[_0x2e15('0x2a')]=function(_0x384fcb,_0x414b7a){return db['Dashboard'][_0x2e15('0x55')]({'where':{'id':_0x384fcb[_0x2e15('0x4d')]['id']}})[_0x2e15('0x29')](handleEntityNotFound(_0x414b7a,null))['then'](removeEntity(_0x414b7a,null))[_0x2e15('0x59')](handleError(_0x414b7a,null));};function widgetAttributes(_0x1faa95){try{switch(_0x1faa95[_0x2e15('0x33')]){case _0x2e15('0x60'):return[{'name':_0x2e15('0x61'),'value':_0x1faa95['attrUrl']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x0]?_0x1faa95['attrs'][0x0][_0x2e15('0x63')]:undefined)||_0x2e15('0x64')}];case _0x2e15('0x65'):return[{'name':_0x2e15('0x66'),'value':_0x1faa95[_0x2e15('0x66')]||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x0]?_0x1faa95[_0x2e15('0x62')][0x0][_0x2e15('0x63')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x1faa95['attrHourFormat']||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x0]?_0x1faa95[_0x2e15('0x62')][0x0][_0x2e15('0x63')]:undefined)||_0x2e15('0x67')},{'name':'attrTimezone','value':_0x1faa95[_0x2e15('0x68')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x1]?_0x1faa95[_0x2e15('0x62')][0x1][_0x2e15('0x63')]:undefined)||_0x2e15('0x69')},{'name':_0x2e15('0x6a'),'value':_0x1faa95[_0x2e15('0x6a')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x2]?_0x1faa95['attrs'][0x2][_0x2e15('0x63')]:undefined)||0xc}];case _0x2e15('0x6b'):return[{'name':_0x2e15('0x6c'),'value':_0x1faa95['attrMetric']||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x0]?_0x1faa95['attrs'][0x0][_0x2e15('0x63')]:undefined)||_0x2e15('0x6d')},{'name':_0x2e15('0x6e'),'value':_0x1faa95[_0x2e15('0x6e')]||(_0x1faa95['attrs']&&_0x1faa95['attrs'][0x1]?_0x1faa95['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x1faa95[_0x2e15('0x6a')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x2]?_0x1faa95[_0x2e15('0x62')][0x2][_0x2e15('0x63')]:undefined)||0x14},{'name':'attrChannel','value':_0x1faa95[_0x2e15('0x6f')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x3]?_0x1faa95[_0x2e15('0x62')][0x3][_0x2e15('0x63')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x1faa95[_0x2e15('0x70')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0x4]?_0x1faa95['attrs'][0x4][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x71'),'value':_0x1faa95['attrFaxAccounts']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x5]?_0x1faa95[_0x2e15('0x62')][0x5][_0x2e15('0x63')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1faa95[_0x2e15('0x72')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x6]?_0x1faa95[_0x2e15('0x62')][0x6][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x73'),'value':_0x1faa95['attrOpenchannelAccounts']||(_0x1faa95['attrs']&&_0x1faa95['attrs'][0x7]?_0x1faa95[_0x2e15('0x62')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1faa95[_0x2e15('0x74')]||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x8]?_0x1faa95[_0x2e15('0x62')][0x8]['value']:undefined)||''},{'name':_0x2e15('0x75'),'value':_0x1faa95[_0x2e15('0x75')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x9]?_0x1faa95[_0x2e15('0x62')][0x9]['value']:undefined)||''}];case _0x2e15('0x76'):case'pie-chart':return[{'name':_0x2e15('0x77'),'value':_0x1faa95['attrSerie1']||(_0x1faa95['attrs']&&_0x1faa95['attrs'][0x0]?_0x1faa95[_0x2e15('0x62')][0x0][_0x2e15('0x63')]:undefined)||_0x2e15('0x6d')},{'name':_0x2e15('0x78'),'value':_0x1faa95[_0x2e15('0x78')]||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x1]?_0x1faa95[_0x2e15('0x62')][0x1][_0x2e15('0x63')]:undefined)||null},{'name':_0x2e15('0x79'),'value':_0x1faa95['attrSerie3']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x2]?_0x1faa95[_0x2e15('0x62')][0x2][_0x2e15('0x63')]:undefined)||null},{'name':_0x2e15('0x6e'),'value':_0x1faa95[_0x2e15('0x6e')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0x3]?_0x1faa95[_0x2e15('0x62')][0x3][_0x2e15('0x63')]:undefined)||[]},{'name':_0x2e15('0x6f'),'value':_0x1faa95[_0x2e15('0x6f')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x4]?_0x1faa95[_0x2e15('0x62')][0x4][_0x2e15('0x63')]:undefined)||_0x2e15('0x7a')},{'name':_0x2e15('0x70'),'value':_0x1faa95['attrEmailAccounts']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x5]?_0x1faa95[_0x2e15('0x62')][0x5][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x71'),'value':_0x1faa95[_0x2e15('0x71')]||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x6]?_0x1faa95[_0x2e15('0x62')][0x6][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x72'),'value':_0x1faa95['attrSmsAccounts']||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x7]?_0x1faa95[_0x2e15('0x62')][0x7][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x73'),'value':_0x1faa95[_0x2e15('0x73')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x8]?_0x1faa95['attrs'][0x8][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x74'),'value':_0x1faa95['attrWhatsappAccounts']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x9]?_0x1faa95[_0x2e15('0x62')][0x9][_0x2e15('0x63')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1faa95[_0x2e15('0x75')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0xa]?_0x1faa95[_0x2e15('0x62')][0xa][_0x2e15('0x63')]:undefined)||''}];case _0x2e15('0x7b'):return[{'name':_0x2e15('0x7c'),'type':_0x1faa95[_0x2e15('0x7d')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0x0]?_0x1faa95['attrs'][0x0][_0x2e15('0x33')]:undefined)||null,'value':_0x1faa95['attrReport']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0x0]?_0x1faa95['attrs'][0x0][_0x2e15('0x63')]:undefined)||null},{'name':_0x2e15('0x7e'),'value':_0x1faa95['attrRefresh']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x1]?_0x1faa95[_0x2e15('0x62')][0x1][_0x2e15('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x60cc87){logger['error'](_0x2e15('0x7f'),JSON[_0x2e15('0x80')](_0x60cc87));return[];}}exports[_0x2e15('0x81')]=function(_0x232a7e,_0x2a28da,_0x3fc30b){if(_0x232a7e['body']['id']){delete _0x232a7e[_0x2e15('0x50')]['id'];}return db['Dashboard'][_0x2e15('0x55')]({'where':{'id':_0x232a7e[_0x2e15('0x4d')]['id']}})[_0x2e15('0x29')](handleEntityNotFound(_0x2a28da,null))[_0x2e15('0x29')](function(_0x3c312c){if(_0x3c312c){_0x232a7e[_0x2e15('0x50')]['DashboardId']=_0x3c312c['id'];_0x232a7e[_0x2e15('0x50')][_0x2e15('0x62')]=widgetAttributes(_0x232a7e[_0x2e15('0x50')]);return db[_0x2e15('0x82')][_0x2e15('0x4f')](_0x232a7e[_0x2e15('0x50')]);}})[_0x2e15('0x29')](respondWithResult(_0x2a28da,null))[_0x2e15('0x59')](handleError(_0x2a28da,null));};exports[_0x2e15('0x83')]=function(_0x20e614,_0x4c26b1,_0x3439e5){var _0x9cdde0={};var _0x402e9b={};var _0x21f5fe;var _0x38458d;return db[_0x2e15('0x47')][_0x2e15('0x84')]({'where':{'id':_0x20e614['params']['id']}})[_0x2e15('0x29')](handleEntityNotFound(_0x4c26b1,null))['then'](function(_0x25474a){if(_0x25474a){_0x21f5fe=_0x25474a;_0x402e9b[_0x2e15('0x39')]=_[_0x2e15('0x36')](db[_0x2e15('0x82')][_0x2e15('0x4e')]);_0x402e9b['query']=_[_0x2e15('0x36')](_0x20e614[_0x2e15('0x35')]);_0x402e9b[_0x2e15('0x37')]=_[_0x2e15('0x38')](_0x402e9b[_0x2e15('0x39')],_0x402e9b[_0x2e15('0x35')]);_0x9cdde0[_0x2e15('0x3a')]=_[_0x2e15('0x38')](_0x402e9b[_0x2e15('0x39')],qs[_0x2e15('0x3b')](_0x20e614[_0x2e15('0x35')]['fields']));_0x9cdde0['attributes']=_0x9cdde0[_0x2e15('0x3a')][_0x2e15('0x3c')]?_0x9cdde0[_0x2e15('0x3a')]:_0x402e9b[_0x2e15('0x39')];_0x9cdde0[_0x2e15('0x3f')]=qs[_0x2e15('0x40')](_0x20e614[_0x2e15('0x35')][_0x2e15('0x40')]);_0x9cdde0[_0x2e15('0x41')]=qs[_0x2e15('0x37')](_[_0x2e15('0x42')](_0x20e614[_0x2e15('0x35')],_0x402e9b[_0x2e15('0x37')]));if(_0x20e614[_0x2e15('0x35')][_0x2e15('0x43')]){_0x9cdde0['where']=_[_0x2e15('0x45')](_0x9cdde0[_0x2e15('0x41')],{'$or':_[_0x2e15('0x31')](_0x9cdde0['attributes'],function(_0x126873){var _0x5edf6e={};_0x5edf6e[_0x126873]={'$like':'%'+_0x20e614[_0x2e15('0x35')][_0x2e15('0x43')]+'%'};return _0x5edf6e;})});}_0x9cdde0=_['merge']({},_0x9cdde0,_0x20e614[_0x2e15('0x46')]);return _0x21f5fe[_0x2e15('0x83')](_0x9cdde0);}})[_0x2e15('0x29')](function(_0x37b1dd){if(_0x37b1dd){_0x38458d=_0x37b1dd['length'];if(!_0x20e614[_0x2e15('0x35')]['hasOwnProperty'](_0x2e15('0x3e'))){_0x9cdde0[_0x2e15('0x23')]=qs['limit'](_0x20e614[_0x2e15('0x35')][_0x2e15('0x23')]);_0x9cdde0['offset']=qs['offset'](_0x20e614[_0x2e15('0x35')][_0x2e15('0x21')]);}return _0x21f5fe[_0x2e15('0x83')](_0x9cdde0);}})[_0x2e15('0x29')](function(_0x4da48b){if(_0x4da48b){return _0x4da48b?{'count':_0x38458d,'rows':_0x4da48b}:null;}})[_0x2e15('0x29')](respondWithResult(_0x4c26b1,null))[_0x2e15('0x59')](handleError(_0x4c26b1,null));}; \ No newline at end of file +var _0xca23=['DashboardId','DashboardItem','getItems','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','then','destroy','get','UserProfileResource','end','error','name','send','index','map','Dashboard','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','attrUrl','attrs','https://','custom','attrPath','attrHourFormat','value','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify'];(function(_0xf90544,_0x211f7a){var _0x22b0ed=function(_0x1f805e){while(--_0x1f805e){_0xf90544['push'](_0xf90544['shift']());}};_0x22b0ed(++_0x211f7a);}(_0xca23,0x86));var _0x3ca2=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xca23[_0x31ced5];return _0x10d9e5;};'use strict';var emlformat=require(_0x3ca2('0x0'));var rimraf=require(_0x3ca2('0x1'));var zipdir=require(_0x3ca2('0x2'));var jsonpatch=require(_0x3ca2('0x3'));var rp=require(_0x3ca2('0x4'));var moment=require(_0x3ca2('0x5'));var BPromise=require(_0x3ca2('0x6'));var Mustache=require('mustache');var util=require(_0x3ca2('0x7'));var path=require('path');var sox=require(_0x3ca2('0x8'));var csv=require(_0x3ca2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ca2('0xa'));var _=require(_0x3ca2('0xb'));var squel=require(_0x3ca2('0xc'));var crypto=require(_0x3ca2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3ca2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3ca2('0xf'));var Papa=require(_0x3ca2('0x10'));var Redis=require('ioredis');var authService=require(_0x3ca2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ca2('0x12'));var logger=require(_0x3ca2('0x13'))(_0x3ca2('0x14'));var utils=require(_0x3ca2('0x15'));var config=require(_0x3ca2('0x16'));var licenseUtil=require(_0x3ca2('0x17'));var db=require('../../mysqldb')['db'];config[_0x3ca2('0x18')]=_[_0x3ca2('0x19')](config[_0x3ca2('0x18')],{'host':_0x3ca2('0x1a'),'port':0x18eb});var socket=require(_0x3ca2('0x1b'))(new Redis(config[_0x3ca2('0x18')]));require(_0x3ca2('0x1c'))[_0x3ca2('0x1d')](socket);function respondWithStatusCode(_0x401e7a,_0x3a3edb){_0x3a3edb=_0x3a3edb||0xcc;return function(_0x394ea2){if(_0x394ea2){return _0x401e7a[_0x3ca2('0x1e')](_0x3a3edb);}return _0x401e7a[_0x3ca2('0x1f')](_0x3a3edb)['end']();};}function respondWithResult(_0x36c443,_0x2a9e39){_0x2a9e39=_0x2a9e39||0xc8;return function(_0x1bec41){if(_0x1bec41){return _0x36c443[_0x3ca2('0x1f')](_0x2a9e39)[_0x3ca2('0x20')](_0x1bec41);}};}function respondWithFilteredResult(_0x35747b,_0x58e76f){return function(_0x3bb323){if(_0x3bb323){var _0xb193c1=typeof _0x58e76f['offset']===_0x3ca2('0x21')&&typeof _0x58e76f[_0x3ca2('0x22')]==='undefined';var _0xa6ec64=_0x3bb323[_0x3ca2('0x23')];var _0x6a5b04=_0xb193c1?0x0:_0x58e76f[_0x3ca2('0x24')];var _0x58af98=_0xb193c1?_0x3bb323[_0x3ca2('0x23')]:_0x58e76f[_0x3ca2('0x24')]+_0x58e76f[_0x3ca2('0x22')];var _0x6d86b0;if(_0x58af98>=_0xa6ec64){_0x58af98=_0xa6ec64;_0x6d86b0=0xc8;}else{_0x6d86b0=0xce;}_0x35747b[_0x3ca2('0x1f')](_0x6d86b0);return _0x35747b['set'](_0x3ca2('0x25'),_0x6a5b04+'-'+_0x58af98+'/'+_0xa6ec64)[_0x3ca2('0x20')](_0x3bb323);}return null;};}function patchUpdates(_0x103f93){return function(_0x27cbfc){try{jsonpatch['apply'](_0x27cbfc,_0x103f93,!![]);}catch(_0x36b856){return BPromise['reject'](_0x36b856);}return _0x27cbfc['save']();};}function saveUpdates(_0x3daf35,_0x4049e5){return function(_0x3e18b3){if(_0x3e18b3){return _0x3e18b3['update'](_0x3daf35)[_0x3ca2('0x26')](function(_0x3b2caf){return _0x3b2caf;});}return null;};}function removeEntity(_0x5c6180,_0x105cd7){return function(_0x3b1272){if(_0x3b1272){return _0x3b1272[_0x3ca2('0x27')]()[_0x3ca2('0x26')](function(){var _0x544dab=_0x3b1272[_0x3ca2('0x28')]({'plain':!![]});var _0x53facf='CustomDashboards';return db[_0x3ca2('0x29')][_0x3ca2('0x27')]({'where':{'type':_0x53facf,'resourceId':_0x544dab['id']}})[_0x3ca2('0x26')](function(){return _0x3b1272;});})[_0x3ca2('0x26')](function(){_0x5c6180[_0x3ca2('0x1f')](0xcc)[_0x3ca2('0x2a')]();});}};}function handleEntityNotFound(_0x14864b,_0x465250){return function(_0x3f14a1){if(!_0x3f14a1){_0x14864b['sendStatus'](0x194);}return _0x3f14a1;};}function handleError(_0x125ef8,_0x10ee84){_0x10ee84=_0x10ee84||0x1f4;return function(_0x409138){logger[_0x3ca2('0x2b')](_0x409138['stack']);if(_0x409138[_0x3ca2('0x2c')]){delete _0x409138[_0x3ca2('0x2c')];}_0x125ef8['status'](_0x10ee84)[_0x3ca2('0x2d')](_0x409138);};}exports[_0x3ca2('0x2e')]=function(_0x205ffc,_0x26f588){var _0x263f74={},_0x1e588c={},_0x279a2e={'count':0x0,'rows':[]};var _0x4141ec=_[_0x3ca2('0x2f')](db[_0x3ca2('0x30')][_0x3ca2('0x31')],function(_0x1b4546){return{'name':_0x1b4546[_0x3ca2('0x32')],'type':_0x1b4546['type'][_0x3ca2('0x33')]};});_0x1e588c['model']=_[_0x3ca2('0x2f')](_0x4141ec,_0x3ca2('0x2c'));_0x1e588c[_0x3ca2('0x34')]=_[_0x3ca2('0x35')](_0x205ffc[_0x3ca2('0x34')]);_0x1e588c[_0x3ca2('0x36')]=_[_0x3ca2('0x37')](_0x1e588c['model'],_0x1e588c['query']);_0x263f74[_0x3ca2('0x38')]=_[_0x3ca2('0x37')](_0x1e588c[_0x3ca2('0x39')],qs[_0x3ca2('0x3a')](_0x205ffc[_0x3ca2('0x34')][_0x3ca2('0x3a')]));_0x263f74[_0x3ca2('0x38')]=_0x263f74[_0x3ca2('0x38')]['length']?_0x263f74[_0x3ca2('0x38')]:_0x1e588c[_0x3ca2('0x39')];if(!_0x205ffc[_0x3ca2('0x34')][_0x3ca2('0x3b')](_0x3ca2('0x3c'))){_0x263f74[_0x3ca2('0x22')]=qs[_0x3ca2('0x22')](_0x205ffc[_0x3ca2('0x34')][_0x3ca2('0x22')]);_0x263f74[_0x3ca2('0x24')]=qs[_0x3ca2('0x24')](_0x205ffc[_0x3ca2('0x34')][_0x3ca2('0x24')]);}_0x263f74[_0x3ca2('0x3d')]=qs[_0x3ca2('0x3e')](_0x205ffc[_0x3ca2('0x34')]['sort']);_0x263f74[_0x3ca2('0x3f')]=qs[_0x3ca2('0x36')](_['pick'](_0x205ffc[_0x3ca2('0x34')],_0x1e588c['filters']),_0x4141ec);if(_0x205ffc[_0x3ca2('0x34')][_0x3ca2('0x40')]){_0x263f74[_0x3ca2('0x3f')]=_[_0x3ca2('0x41')](_0x263f74['where'],{'$or':_[_0x3ca2('0x2f')](_0x4141ec,function(_0x36d92d){if(_0x36d92d[_0x3ca2('0x42')]!==_0x3ca2('0x43')){var _0x3be4ef={};_0x3be4ef[_0x36d92d[_0x3ca2('0x2c')]]={'$like':'%'+_0x205ffc[_0x3ca2('0x34')][_0x3ca2('0x40')]+'%'};return _0x3be4ef;}})});}_0x263f74=_[_0x3ca2('0x41')]({},_0x263f74,_0x205ffc[_0x3ca2('0x44')]);var _0x39f6f6={'where':_0x263f74['where']};return db[_0x3ca2('0x30')][_0x3ca2('0x23')](_0x39f6f6)[_0x3ca2('0x26')](function(_0x3073a4){_0x279a2e[_0x3ca2('0x23')]=_0x3073a4;if(_0x205ffc['query'][_0x3ca2('0x45')]){_0x263f74[_0x3ca2('0x46')]=[{'all':!![]}];}return db[_0x3ca2('0x30')][_0x3ca2('0x47')](_0x263f74);})[_0x3ca2('0x26')](function(_0xaf1f72){_0x279a2e[_0x3ca2('0x48')]=_0xaf1f72;return _0x279a2e;})[_0x3ca2('0x26')](respondWithFilteredResult(_0x26f588,_0x263f74))['catch'](handleError(_0x26f588,null));};exports['show']=function(_0x40b1aa,_0x150972){var _0x387294={'raw':![],'where':{'id':_0x40b1aa[_0x3ca2('0x49')]['id']}},_0x1e928e={};_0x1e928e['model']=_[_0x3ca2('0x35')](db[_0x3ca2('0x30')][_0x3ca2('0x31')]);_0x1e928e[_0x3ca2('0x34')]=_[_0x3ca2('0x35')](_0x40b1aa[_0x3ca2('0x34')]);_0x1e928e[_0x3ca2('0x36')]=_[_0x3ca2('0x37')](_0x1e928e[_0x3ca2('0x39')],_0x1e928e[_0x3ca2('0x34')]);_0x387294[_0x3ca2('0x38')]=_[_0x3ca2('0x37')](_0x1e928e[_0x3ca2('0x39')],qs[_0x3ca2('0x3a')](_0x40b1aa[_0x3ca2('0x34')]['fields']));_0x387294[_0x3ca2('0x38')]=_0x387294[_0x3ca2('0x38')][_0x3ca2('0x4a')]?_0x387294[_0x3ca2('0x38')]:_0x1e928e[_0x3ca2('0x39')];if(_0x40b1aa[_0x3ca2('0x34')][_0x3ca2('0x45')]){_0x387294[_0x3ca2('0x46')]=[{'all':!![]}];}_0x387294=_[_0x3ca2('0x41')]({},_0x387294,_0x40b1aa[_0x3ca2('0x44')]);return db[_0x3ca2('0x30')][_0x3ca2('0x4b')](_0x387294)[_0x3ca2('0x26')](handleEntityNotFound(_0x150972,null))['then'](respondWithResult(_0x150972,null))[_0x3ca2('0x4c')](handleError(_0x150972,null));};exports[_0x3ca2('0x4d')]=function(_0xac64ff,_0x107dd2){return db[_0x3ca2('0x30')][_0x3ca2('0x4d')](_0xac64ff[_0x3ca2('0x4e')],{})[_0x3ca2('0x26')](function(_0x24a618){var _0x3c69a7=_0xac64ff[_0x3ca2('0x4f')][_0x3ca2('0x28')]({'plain':!![]});if(!_0x3c69a7)throw new Error(_0x3ca2('0x50'));if(_0x3c69a7[_0x3ca2('0x51')]===_0x3ca2('0x4f')){var _0x5a7291=_0x24a618['get']({'plain':!![]});var _0x1daf39=_0x3ca2('0x52');return db[_0x3ca2('0x53')][_0x3ca2('0x4b')]({'where':{'name':_0x1daf39,'userProfileId':_0x3c69a7[_0x3ca2('0x54')]},'raw':!![]})['then'](function(_0x4d6ebd){if(_0x4d6ebd&&_0x4d6ebd['autoAssociation']===0x0){return db[_0x3ca2('0x29')]['create']({'name':_0x5a7291[_0x3ca2('0x2c')],'resourceId':_0x5a7291['id'],'type':_0x4d6ebd[_0x3ca2('0x2c')],'sectionId':_0x4d6ebd['id']},{})['then'](function(){return _0x24a618;});}else{return _0x24a618;}})[_0x3ca2('0x4c')](function(_0x367fc6){logger[_0x3ca2('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x367fc6);throw _0x367fc6;});}return _0x24a618;})['then'](respondWithResult(_0x107dd2,0xc9))[_0x3ca2('0x4c')](handleError(_0x107dd2,null));};exports[_0x3ca2('0x55')]=function(_0x3caeea,_0xd59e9c){var _0x57134f={'where':{'id':_0x3caeea[_0x3ca2('0x49')]['id']}},_0x3e81c2={};_0x3e81c2[_0x3ca2('0x39')]=_[_0x3ca2('0x35')](db[_0x3ca2('0x30')][_0x3ca2('0x31')]);_0x57134f[_0x3ca2('0x38')]=_['intersection'](_0x3e81c2[_0x3ca2('0x39')],qs['fields'](_0x3caeea[_0x3ca2('0x34')][_0x3ca2('0x3a')]));_0x57134f[_0x3ca2('0x38')]=_0x57134f[_0x3ca2('0x38')][_0x3ca2('0x4a')]?_0x57134f[_0x3ca2('0x38')]:_0x3e81c2['model'];if(_0x3caeea[_0x3ca2('0x34')][_0x3ca2('0x45')]){_0x57134f[_0x3ca2('0x46')]=[{'all':!![]}];}_0x57134f=_[_0x3ca2('0x41')]({},_0x57134f,_0x3caeea[_0x3ca2('0x44')]);return db[_0x3ca2('0x30')][_0x3ca2('0x4b')](_0x57134f)[_0x3ca2('0x26')](handleEntityNotFound(_0xd59e9c,null))[_0x3ca2('0x26')](function(_0x590da4){if(_0x590da4){var _0x3b4525=_0x590da4[_0x3ca2('0x28')]({'plain':!![]});_0x3b4525=qs[_0x3ca2('0x56')](_0x3b4525,['id',_0x3ca2('0x57'),_0x3ca2('0x58')]);_0x3caeea[_0x3ca2('0x4e')]=_[_0x3ca2('0x56')](_0x3caeea[_0x3ca2('0x4e')],['id','createdAt',_0x3ca2('0x58')]);return db[_0x3ca2('0x30')][_0x3ca2('0x4d')](_['merge'](_0x3b4525,_0x3caeea['body']),{'include':_0x3caeea['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3ca2('0x26')](function(_0x27dae9){var _0x5ba5a2=_0x3caeea[_0x3ca2('0x4f')][_0x3ca2('0x28')]({'plain':!![]});if(!_0x5ba5a2)throw new Error(_0x3ca2('0x50'));if(_0x5ba5a2[_0x3ca2('0x51')]===_0x3ca2('0x4f')){var _0xaa428d=_0x27dae9[_0x3ca2('0x28')]({'plain':!![]});var _0x1828f8='CustomDashboards';return db['UserProfileSection'][_0x3ca2('0x4b')]({'where':{'name':_0x1828f8,'userProfileId':_0x5ba5a2[_0x3ca2('0x54')]},'raw':!![]})['then'](function(_0x3294a2){if(_0x3294a2&&_0x3294a2[_0x3ca2('0x59')]===0x0){return db[_0x3ca2('0x29')][_0x3ca2('0x4d')]({'name':_0xaa428d['name'],'resourceId':_0xaa428d['id'],'type':_0x3294a2['name'],'sectionId':_0x3294a2['id']},{})[_0x3ca2('0x26')](function(){return _0x27dae9;});}else{return _0x27dae9;}})[_0x3ca2('0x4c')](function(_0x4e5bdb){logger[_0x3ca2('0x2b')](_0x3ca2('0x5a'),_0x4e5bdb);throw _0x4e5bdb;});}return _0x27dae9;});}})['then'](respondWithResult(_0xd59e9c,0xc9))['catch'](handleError(_0xd59e9c,null));};exports[_0x3ca2('0x5b')]=function(_0x1cd043,_0xf97f25){if(_0x1cd043[_0x3ca2('0x4e')]['id']){delete _0x1cd043[_0x3ca2('0x4e')]['id'];}return db[_0x3ca2('0x30')][_0x3ca2('0x4b')]({'where':{'id':_0x1cd043['params']['id']}})['then'](handleEntityNotFound(_0xf97f25,null))['then'](saveUpdates(_0x1cd043[_0x3ca2('0x4e')],null))[_0x3ca2('0x26')](respondWithResult(_0xf97f25,null))['catch'](handleError(_0xf97f25,null));};exports['destroy']=function(_0x5f28d5,_0xc40741){return db['Dashboard'][_0x3ca2('0x4b')]({'where':{'id':_0x5f28d5['params']['id']}})[_0x3ca2('0x26')](handleEntityNotFound(_0xc40741,null))[_0x3ca2('0x26')](removeEntity(_0xc40741,null))['catch'](handleError(_0xc40741,null));};function widgetAttributes(_0x3fad1e){try{switch(_0x3fad1e['type']){case'iframe':return[{'name':_0x3ca2('0x5c'),'value':_0x3fad1e[_0x3ca2('0x5c')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x0]?_0x3fad1e[_0x3ca2('0x5d')][0x0]['value']:undefined)||_0x3ca2('0x5e')}];case _0x3ca2('0x5f'):return[{'name':'attrPath','value':_0x3fad1e[_0x3ca2('0x60')]||(_0x3fad1e['attrs']&&_0x3fad1e['attrs'][0x0]?_0x3fad1e[_0x3ca2('0x5d')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x3ca2('0x61'),'value':_0x3fad1e['attrHourFormat']||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x0]?_0x3fad1e[_0x3ca2('0x5d')][0x0][_0x3ca2('0x62')]:undefined)||_0x3ca2('0x63')},{'name':_0x3ca2('0x64'),'value':_0x3fad1e[_0x3ca2('0x64')]||(_0x3fad1e['attrs']&&_0x3fad1e[_0x3ca2('0x5d')][0x1]?_0x3fad1e[_0x3ca2('0x5d')][0x1][_0x3ca2('0x62')]:undefined)||'0.00'},{'name':_0x3ca2('0x65'),'value':_0x3fad1e['attrFontSize']||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x2]?_0x3fad1e[_0x3ca2('0x5d')][0x2][_0x3ca2('0x62')]:undefined)||0xc}];case _0x3ca2('0x66'):return[{'name':_0x3ca2('0x67'),'value':_0x3fad1e['attrMetric']||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x0]?_0x3fad1e['attrs'][0x0][_0x3ca2('0x62')]:undefined)||_0x3ca2('0x68')},{'name':_0x3ca2('0x69'),'value':_0x3fad1e[_0x3ca2('0x69')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x1]?_0x3fad1e[_0x3ca2('0x5d')][0x1][_0x3ca2('0x62')]:undefined)||[]},{'name':_0x3ca2('0x65'),'value':_0x3fad1e[_0x3ca2('0x65')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x2]?_0x3fad1e[_0x3ca2('0x5d')][0x2][_0x3ca2('0x62')]:undefined)||0x14},{'name':_0x3ca2('0x6a'),'value':_0x3fad1e['attrChannel']||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x3]?_0x3fad1e[_0x3ca2('0x5d')][0x3][_0x3ca2('0x62')]:undefined)||_0x3ca2('0x6b')},{'name':'attrEmailAccounts','value':_0x3fad1e[_0x3ca2('0x6c')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e['attrs'][0x4]?_0x3fad1e[_0x3ca2('0x5d')][0x4][_0x3ca2('0x62')]:undefined)||''},{'name':_0x3ca2('0x6d'),'value':_0x3fad1e['attrFaxAccounts']||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x5]?_0x3fad1e[_0x3ca2('0x5d')][0x5]['value']:undefined)||''},{'name':_0x3ca2('0x6e'),'value':_0x3fad1e[_0x3ca2('0x6e')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x6]?_0x3fad1e[_0x3ca2('0x5d')][0x6][_0x3ca2('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3fad1e[_0x3ca2('0x6f')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e['attrs'][0x7]?_0x3fad1e['attrs'][0x7][_0x3ca2('0x62')]:undefined)||''},{'name':_0x3ca2('0x70'),'value':_0x3fad1e['attrWhatsappAccounts']||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x8]?_0x3fad1e[_0x3ca2('0x5d')][0x8][_0x3ca2('0x62')]:undefined)||''},{'name':_0x3ca2('0x71'),'value':_0x3fad1e[_0x3ca2('0x71')]||(_0x3fad1e['attrs']&&_0x3fad1e['attrs'][0x9]?_0x3fad1e[_0x3ca2('0x5d')][0x9][_0x3ca2('0x62')]:undefined)||''}];case'multibar-chart':case _0x3ca2('0x72'):return[{'name':_0x3ca2('0x73'),'value':_0x3fad1e[_0x3ca2('0x73')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x0]?_0x3fad1e[_0x3ca2('0x5d')][0x0][_0x3ca2('0x62')]:undefined)||'total'},{'name':_0x3ca2('0x74'),'value':_0x3fad1e[_0x3ca2('0x74')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e['attrs'][0x1]?_0x3fad1e[_0x3ca2('0x5d')][0x1][_0x3ca2('0x62')]:undefined)||null},{'name':_0x3ca2('0x75'),'value':_0x3fad1e[_0x3ca2('0x75')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x2]?_0x3fad1e['attrs'][0x2][_0x3ca2('0x62')]:undefined)||null},{'name':_0x3ca2('0x69'),'value':_0x3fad1e[_0x3ca2('0x69')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x3]?_0x3fad1e[_0x3ca2('0x5d')][0x3][_0x3ca2('0x62')]:undefined)||[]},{'name':_0x3ca2('0x6a'),'value':_0x3fad1e[_0x3ca2('0x6a')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x4]?_0x3fad1e[_0x3ca2('0x5d')][0x4][_0x3ca2('0x62')]:undefined)||'voice'},{'name':_0x3ca2('0x6c'),'value':_0x3fad1e[_0x3ca2('0x6c')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x5]?_0x3fad1e['attrs'][0x5][_0x3ca2('0x62')]:undefined)||''},{'name':_0x3ca2('0x6d'),'value':_0x3fad1e[_0x3ca2('0x6d')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e['attrs'][0x6]?_0x3fad1e[_0x3ca2('0x5d')][0x6]['value']:undefined)||''},{'name':_0x3ca2('0x6e'),'value':_0x3fad1e[_0x3ca2('0x6e')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x7]?_0x3fad1e[_0x3ca2('0x5d')][0x7][_0x3ca2('0x62')]:undefined)||''},{'name':_0x3ca2('0x6f'),'value':_0x3fad1e[_0x3ca2('0x6f')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x8]?_0x3fad1e['attrs'][0x8][_0x3ca2('0x62')]:undefined)||''},{'name':_0x3ca2('0x70'),'value':_0x3fad1e['attrWhatsappAccounts']||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x9]?_0x3fad1e[_0x3ca2('0x5d')][0x9][_0x3ca2('0x62')]:undefined)||''},{'name':_0x3ca2('0x71'),'value':_0x3fad1e[_0x3ca2('0x71')]||(_0x3fad1e['attrs']&&_0x3fad1e[_0x3ca2('0x5d')][0xa]?_0x3fad1e[_0x3ca2('0x5d')][0xa][_0x3ca2('0x62')]:undefined)||''}];case _0x3ca2('0x76'):return[{'name':_0x3ca2('0x77'),'type':_0x3fad1e[_0x3ca2('0x78')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e['attrs'][0x0]?_0x3fad1e[_0x3ca2('0x5d')][0x0][_0x3ca2('0x42')]:undefined)||null,'value':_0x3fad1e[_0x3ca2('0x77')]||(_0x3fad1e['attrs']&&_0x3fad1e[_0x3ca2('0x5d')][0x0]?_0x3fad1e[_0x3ca2('0x5d')][0x0][_0x3ca2('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0x3fad1e[_0x3ca2('0x79')]||(_0x3fad1e[_0x3ca2('0x5d')]&&_0x3fad1e[_0x3ca2('0x5d')][0x1]?_0x3fad1e[_0x3ca2('0x5d')][0x1][_0x3ca2('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x54ebe3){logger[_0x3ca2('0x2b')](_0x3ca2('0x7a'),JSON[_0x3ca2('0x7b')](_0x54ebe3));return[];}}exports['addItem']=function(_0x2bf6a9,_0x30406e,_0xfdc192){if(_0x2bf6a9[_0x3ca2('0x4e')]['id']){delete _0x2bf6a9[_0x3ca2('0x4e')]['id'];}return db[_0x3ca2('0x30')][_0x3ca2('0x4b')]({'where':{'id':_0x2bf6a9[_0x3ca2('0x49')]['id']}})[_0x3ca2('0x26')](handleEntityNotFound(_0x30406e,null))[_0x3ca2('0x26')](function(_0x10d2d7){if(_0x10d2d7){_0x2bf6a9[_0x3ca2('0x4e')][_0x3ca2('0x7c')]=_0x10d2d7['id'];_0x2bf6a9[_0x3ca2('0x4e')][_0x3ca2('0x5d')]=widgetAttributes(_0x2bf6a9[_0x3ca2('0x4e')]);return db[_0x3ca2('0x7d')][_0x3ca2('0x4d')](_0x2bf6a9[_0x3ca2('0x4e')]);}})[_0x3ca2('0x26')](respondWithResult(_0x30406e,null))['catch'](handleError(_0x30406e,null));};exports[_0x3ca2('0x7e')]=function(_0xcc2b9d,_0x4963f5,_0x376412){var _0x199b33={};var _0x3b9ff6={};var _0x109972;var _0x366cd6;return db[_0x3ca2('0x30')][_0x3ca2('0x7f')]({'where':{'id':_0xcc2b9d[_0x3ca2('0x49')]['id']}})[_0x3ca2('0x26')](handleEntityNotFound(_0x4963f5,null))[_0x3ca2('0x26')](function(_0x48a299){if(_0x48a299){_0x109972=_0x48a299;_0x3b9ff6[_0x3ca2('0x39')]=_[_0x3ca2('0x35')](db['DashboardItem'][_0x3ca2('0x31')]);_0x3b9ff6[_0x3ca2('0x34')]=_[_0x3ca2('0x35')](_0xcc2b9d[_0x3ca2('0x34')]);_0x3b9ff6['filters']=_['intersection'](_0x3b9ff6[_0x3ca2('0x39')],_0x3b9ff6[_0x3ca2('0x34')]);_0x199b33['attributes']=_['intersection'](_0x3b9ff6[_0x3ca2('0x39')],qs[_0x3ca2('0x3a')](_0xcc2b9d[_0x3ca2('0x34')]['fields']));_0x199b33['attributes']=_0x199b33[_0x3ca2('0x38')][_0x3ca2('0x4a')]?_0x199b33[_0x3ca2('0x38')]:_0x3b9ff6['model'];_0x199b33[_0x3ca2('0x3d')]=qs[_0x3ca2('0x3e')](_0xcc2b9d[_0x3ca2('0x34')][_0x3ca2('0x3e')]);_0x199b33['where']=qs['filters'](_[_0x3ca2('0x80')](_0xcc2b9d[_0x3ca2('0x34')],_0x3b9ff6[_0x3ca2('0x36')]));if(_0xcc2b9d[_0x3ca2('0x34')]['filter']){_0x199b33[_0x3ca2('0x3f')]=_['merge'](_0x199b33[_0x3ca2('0x3f')],{'$or':_[_0x3ca2('0x2f')](_0x199b33[_0x3ca2('0x38')],function(_0xe93c73){var _0x2fbd3c={};_0x2fbd3c[_0xe93c73]={'$like':'%'+_0xcc2b9d[_0x3ca2('0x34')][_0x3ca2('0x40')]+'%'};return _0x2fbd3c;})});}_0x199b33=_[_0x3ca2('0x41')]({},_0x199b33,_0xcc2b9d[_0x3ca2('0x44')]);return _0x109972[_0x3ca2('0x7e')](_0x199b33);}})['then'](function(_0x4a3610){if(_0x4a3610){_0x366cd6=_0x4a3610[_0x3ca2('0x4a')];if(!_0xcc2b9d[_0x3ca2('0x34')][_0x3ca2('0x3b')](_0x3ca2('0x3c'))){_0x199b33[_0x3ca2('0x22')]=qs[_0x3ca2('0x22')](_0xcc2b9d[_0x3ca2('0x34')][_0x3ca2('0x22')]);_0x199b33['offset']=qs[_0x3ca2('0x24')](_0xcc2b9d[_0x3ca2('0x34')][_0x3ca2('0x24')]);}return _0x109972[_0x3ca2('0x7e')](_0x199b33);}})[_0x3ca2('0x26')](function(_0x25dc0b){if(_0x25dc0b){return _0x25dc0b?{'count':_0x366cd6,'rows':_0x25dc0b}:null;}})[_0x3ca2('0x26')](respondWithResult(_0x4963f5,null))[_0x3ca2('0x4c')](handleError(_0x4963f5,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 47d36fe..3e23780 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 _0xa25a=['hook','events','../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa25a,0x133));var _0xaa25=function(_0xfa4e62,_0x41ef79){_0xfa4e62=_0xfa4e62-0x0;var _0x499daa=_0xa25a[_0xfa4e62];return _0x499daa;};'use strict';var EventEmitter=require(_0xaa25('0x0'));var Dashboard=require(_0xaa25('0x1'))['db'][_0xaa25('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xaa25('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa25('0x4'),'afterDestroy':_0xaa25('0x5')};function emitEvent(_0x20e320){return function(_0x37ad68,_0x25711c,_0x432cba){DashboardEvents[_0xaa25('0x6')](_0x20e320+':'+_0x37ad68['id'],_0x37ad68);DashboardEvents[_0xaa25('0x6')](_0x20e320,_0x37ad68);_0x432cba(null);};}for(var e in events){if(events[_0xaa25('0x7')](e)){var event=events[e];Dashboard[_0xaa25('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x14a3=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x39707b,_0x2caf4d){var _0xd9864b=function(_0xb94f2b){while(--_0xb94f2b){_0x39707b['push'](_0x39707b['shift']());}};_0xd9864b(++_0x2caf4d);}(_0x14a3,0x19e));var _0x314a=function(_0x2a332d,_0x3d5865){_0x2a332d=_0x2a332d-0x0;var _0x5d24c4=_0x14a3[_0x2a332d];return _0x5d24c4;};'use strict';var EventEmitter=require(_0x314a('0x0'));var Dashboard=require(_0x314a('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x314a('0x2')](0x0);var events={'afterCreate':_0x314a('0x3'),'afterUpdate':_0x314a('0x4'),'afterDestroy':_0x314a('0x5')};function emitEvent(_0x42816d){return function(_0x36303e,_0x356b0a,_0x474efc){DashboardEvents[_0x314a('0x6')](_0x42816d+':'+_0x36303e['id'],_0x36303e);DashboardEvents[_0x314a('0x6')](_0x42816d,_0x36303e);_0x474efc(null);};}for(var e in events){if(events[_0x314a('0x7')](e)){var event=events[e];Dashboard[_0x314a('0x8')](e,emitEvent(event));}}module[_0x314a('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 06a6f65..bca0458 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 _0x7990=['moment','bluebird','path','../../config/environment','./dashboard.attributes','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x31b350,_0x5be290){var _0x1870dc=function(_0xbae48d){while(--_0xbae48d){_0x31b350['push'](_0x31b350['shift']());}};_0x1870dc(++_0x5be290);}(_0x7990,0xe3));var _0x0799=function(_0xde521,_0x4c385c){_0xde521=_0xde521-0x0;var _0x206d7f=_0x7990[_0xde521];return _0x206d7f;};'use strict';var _=require(_0x0799('0x0'));var util=require(_0x0799('0x1'));var logger=require(_0x0799('0x2'))(_0x0799('0x3'));var moment=require(_0x0799('0x4'));var BPromise=require(_0x0799('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0799('0x6'));var rimraf=require('rimraf');var config=require(_0x0799('0x7'));var attributes=require(_0x0799('0x8'));module['exports']=function(_0x25f287,_0x14bdfc){return _0x25f287['define'](_0x0799('0x9'),attributes,{'tableName':_0x0799('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e5f=['exports','define','Dashboard','lodash','util','api','bluebird','path','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6e5f,0x1bc));var _0xf6e5=function(_0x46c54a,_0x471b35){_0x46c54a=_0x46c54a-0x0;var _0x4118e7=_0x6e5f[_0x46c54a];return _0x4118e7;};'use strict';var _=require(_0xf6e5('0x0'));var util=require(_0xf6e5('0x1'));var logger=require('../../config/logger')(_0xf6e5('0x2'));var moment=require('moment');var BPromise=require(_0xf6e5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6e5('0x4'));var rimraf=require('rimraf');var config=require(_0xf6e5('0x5'));var attributes=require('./dashboard.attributes');module[_0xf6e5('0x6')]=function(_0x4ef585,_0x4088a4){return _0x4ef585[_0xf6e5('0x7')](_0xf6e5('0x8'),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 b0c8467..ba3e197 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 _0xa9b8=['localhost','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x1ef399,_0x54bfff){var _0x666102=function(_0x7039b3){while(--_0x7039b3){_0x1ef399['push'](_0x1ef399['shift']());}};_0x666102(++_0x54bfff);}(_0xa9b8,0x11c));var _0x8a9b=function(_0x160e0c,_0xa8b37f){_0x160e0c=_0x160e0c-0x0;var _0x741663=_0xa9b8[_0x160e0c];return _0x741663;};'use strict';var _=require(_0x8a9b('0x0'));var util=require('util');var moment=require(_0x8a9b('0x1'));var BPromise=require(_0x8a9b('0x2'));var rs=require(_0x8a9b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a9b('0x4'));var logger=require(_0x8a9b('0x5'))(_0x8a9b('0x6'));var config=require(_0x8a9b('0x7'));var jayson=require(_0x8a9b('0x8'));var client=jayson[_0x8a9b('0x9')][_0x8a9b('0xa')]({'port':0x232a});config['redis']=_[_0x8a9b('0xb')](config[_0x8a9b('0xc')],{'host':_0x8a9b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a9b('0xc')]));require(_0x8a9b('0xe'))['register'](socket);function respondWithRpcPromise(_0x4230e0,_0x502ee4,_0x39b5e9){return new BPromise(function(_0x22ea3e,_0x10d912){return client[_0x8a9b('0xf')](_0x4230e0,_0x39b5e9)[_0x8a9b('0x10')](function(_0x592581){logger['info'](_0x8a9b('0x11'),_0x502ee4,_0x8a9b('0x12'));logger[_0x8a9b('0x13')](_0x8a9b('0x14'),_0x502ee4,'request\x20sent',JSON[_0x8a9b('0x15')](_0x592581));if(_0x592581[_0x8a9b('0x16')]){if(_0x592581[_0x8a9b('0x16')][_0x8a9b('0x17')]===0x1f4){logger[_0x8a9b('0x16')](_0x8a9b('0x11'),_0x502ee4,_0x592581[_0x8a9b('0x16')][_0x8a9b('0x18')]);return _0x10d912(_0x592581[_0x8a9b('0x16')][_0x8a9b('0x18')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x502ee4,_0x592581[_0x8a9b('0x16')][_0x8a9b('0x18')]);return _0x22ea3e(_0x592581[_0x8a9b('0x16')][_0x8a9b('0x18')]);}else{logger[_0x8a9b('0x19')](_0x8a9b('0x11'),_0x502ee4,_0x8a9b('0x12'));_0x22ea3e(_0x592581['result']['message']);}})[_0x8a9b('0x1a')](function(_0x470410){logger[_0x8a9b('0x16')](_0x8a9b('0x11'),_0x502ee4,_0x470410);_0x10d912(_0x470410);});});} \ No newline at end of file +var _0x06da=['localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','defaults','redis'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0x06da,0x10a));var _0xa06d=function(_0x4fc7f8,_0x53b6f1){_0x4fc7f8=_0x4fc7f8-0x0;var _0x58d5d9=_0x06da[_0x4fc7f8];return _0x58d5d9;};'use strict';var _=require('lodash');var util=require(_0xa06d('0x0'));var moment=require(_0xa06d('0x1'));var BPromise=require(_0xa06d('0x2'));var rs=require(_0xa06d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa06d('0x4'))(_0xa06d('0x5'));var config=require('../../config/environment');var jayson=require(_0xa06d('0x6'));var client=jayson[_0xa06d('0x7')]['http']({'port':0x232a});config['redis']=_[_0xa06d('0x8')](config[_0xa06d('0x9')],{'host':_0xa06d('0xa'),'port':0x18eb});var socket=require(_0xa06d('0xb'))(new Redis(config[_0xa06d('0x9')]));require(_0xa06d('0xc'))[_0xa06d('0xd')](socket);function respondWithRpcPromise(_0x3c9e62,_0x3acea1,_0x274daf){return new BPromise(function(_0x37d202,_0x53bd3d){return client[_0xa06d('0xe')](_0x3c9e62,_0x274daf)[_0xa06d('0xf')](function(_0x54768b){logger[_0xa06d('0x10')](_0xa06d('0x11'),_0x3acea1,_0xa06d('0x12'));logger['debug'](_0xa06d('0x13'),_0x3acea1,_0xa06d('0x12'),JSON['stringify'](_0x54768b));if(_0x54768b['error']){if(_0x54768b['error']['code']===0x1f4){logger[_0xa06d('0x14')](_0xa06d('0x11'),_0x3acea1,_0x54768b[_0xa06d('0x14')][_0xa06d('0x15')]);return _0x53bd3d(_0x54768b[_0xa06d('0x14')][_0xa06d('0x15')]);}logger[_0xa06d('0x14')]('Dashboard,\x20%s,\x20%s',_0x3acea1,_0x54768b[_0xa06d('0x14')][_0xa06d('0x15')]);return _0x37d202(_0x54768b[_0xa06d('0x14')][_0xa06d('0x15')]);}else{logger['info'](_0xa06d('0x11'),_0x3acea1,_0xa06d('0x12'));_0x37d202(_0x54768b[_0xa06d('0x16')]['message']);}})['catch'](function(_0x4e38c7){logger[_0xa06d('0x14')](_0xa06d('0x11'),_0x3acea1,_0x4e38c7);_0x53bd3d(_0x4e38c7);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1157305..79a023e 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 _0x9b8a=['remove','update','emit','removeListener','register','length','./dashboard.events'];(function(_0x221172,_0x35c9f1){var _0xe3084f=function(_0x452bdc){while(--_0x452bdc){_0x221172['push'](_0x221172['shift']());}};_0xe3084f(++_0x35c9f1);}(_0x9b8a,0xd8));var _0xa9b8=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0x9b8a[_0xdb01a];return _0x107ede;};'use strict';var DashboardEvents=require(_0xa9b8('0x0'));var events=['save',_0xa9b8('0x1'),_0xa9b8('0x2')];function createListener(_0x4196f8,_0x228322){return function(_0x202a2f){_0x228322[_0xa9b8('0x3')](_0x4196f8,_0x202a2f);};}function removeListener(_0x4fb0a0,_0x160c5d){return function(){DashboardEvents[_0xa9b8('0x4')](_0x4fb0a0,_0x160c5d);};}exports[_0xa9b8('0x5')]=function(_0x2be09){for(var _0x3798dc=0x0,_0x3abdbd=events[_0xa9b8('0x6')];_0x3798dc<_0x3abdbd;_0x3798dc++){var _0x79cabc=events[_0x3798dc];var _0x35efd1=createListener('dashboard:'+_0x79cabc,_0x2be09);DashboardEvents['on'](_0x79cabc,_0x35efd1);}}; \ No newline at end of file +var _0x3b3a=['save','remove','update','emit','register','length','./dashboard.events'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3b3a,0x117));var _0xa3b3=function(_0x2e8370,_0x40bb38){_0x2e8370=_0x2e8370-0x0;var _0x8f8028=_0x3b3a[_0x2e8370];return _0x8f8028;};'use strict';var DashboardEvents=require(_0xa3b3('0x0'));var events=[_0xa3b3('0x1'),_0xa3b3('0x2'),_0xa3b3('0x3')];function createListener(_0x5c9df8,_0x310bee){return function(_0x10fbeb){_0x310bee[_0xa3b3('0x4')](_0x5c9df8,_0x10fbeb);};}function removeListener(_0x48e502,_0x1f19d0){return function(){DashboardEvents['removeListener'](_0x48e502,_0x1f19d0);};}exports[_0xa3b3('0x5')]=function(_0x294cc4){for(var _0x28985b=0x0,_0x5c08a4=events[_0xa3b3('0x6')];_0x28985b<_0x5c08a4;_0x28985b++){var _0x3e937c=events[_0x28985b];var _0x2638fc=createListener('dashboard:'+_0x3e937c,_0x294cc4);DashboardEvents['on'](_0x3e937c,_0x2638fc);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d4dea8e..23ab55c 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 _0x3ac0=['put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post','create'];(function(_0x387092,_0x4b6d5f){var _0x5e6261=function(_0x517835){while(--_0x517835){_0x387092['push'](_0x387092['shift']());}};_0x5e6261(++_0x4b6d5f);}(_0x3ac0,0x9f));var _0x03ac=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3ac0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x03ac('0x0'));var util=require(_0x03ac('0x1'));var path=require(_0x03ac('0x2'));var timeout=require(_0x03ac('0x3'));var express=require('express');var router=express[_0x03ac('0x4')]();var fs_extra=require(_0x03ac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x03ac('0x6'));var config=require(_0x03ac('0x7'));var controller=require(_0x03ac('0x8'));router[_0x03ac('0x9')]('/',auth[_0x03ac('0xa')](),controller[_0x03ac('0xb')]);router[_0x03ac('0x9')]('/:id',auth[_0x03ac('0xa')](),controller[_0x03ac('0xc')]);router[_0x03ac('0x9')](_0x03ac('0xd'),auth[_0x03ac('0xa')](),controller[_0x03ac('0xe')]);router[_0x03ac('0xf')]('/',auth['isAuthenticated'](),controller[_0x03ac('0x10')]);router[_0x03ac('0xf')]('/:id/clone',auth[_0x03ac('0xa')](),controller['clone']);router[_0x03ac('0xf')](_0x03ac('0xd'),auth['isAuthenticated'](),controller['addItem']);router[_0x03ac('0x11')](_0x03ac('0x12'),auth['isAuthenticated'](),controller[_0x03ac('0x13')]);router[_0x03ac('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x03ac('0x15')]=router; \ No newline at end of file +var _0x81f6=['isAuthenticated','index','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','/:id','update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81f6,0x77));var _0x681f=function(_0x34499d,_0x55d18a){_0x34499d=_0x34499d-0x0;var _0x45557a=_0x81f6[_0x34499d];return _0x45557a;};'use strict';var multer=require(_0x681f('0x0'));var util=require('util');var path=require(_0x681f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x681f('0x3'));var interaction=require(_0x681f('0x4'));var config=require(_0x681f('0x5'));var controller=require('./dashboard.controller');router[_0x681f('0x6')]('/',auth[_0x681f('0x7')](),controller[_0x681f('0x8')]);router[_0x681f('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x681f('0x9')]);router[_0x681f('0x6')](_0x681f('0xa'),auth['isAuthenticated'](),controller[_0x681f('0xb')]);router[_0x681f('0xc')]('/',auth['isAuthenticated'](),controller[_0x681f('0xd')]);router[_0x681f('0xc')](_0x681f('0xe'),auth['isAuthenticated'](),controller[_0x681f('0xf')]);router[_0x681f('0xc')](_0x681f('0xa'),auth[_0x681f('0x7')](),controller[_0x681f('0x10')]);router['put'](_0x681f('0x11'),auth['isAuthenticated'](),controller[_0x681f('0x12')]);router[_0x681f('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x681f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index d7bb506..255a108 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 _0x2675=['parse','attrs','setDataValue','stringify','INTEGER','sequelize','STRING','long'];(function(_0x360f5b,_0x58cecb){var _0x251f17=function(_0x5552ea){while(--_0x5552ea){_0x360f5b['push'](_0x360f5b['shift']());}};_0x251f17(++_0x58cecb);}(_0x2675,0x75));var _0x5267=function(_0x42c509,_0x729f8a){_0x42c509=_0x42c509-0x0;var _0xba78bb=_0x2675[_0x42c509];return _0xba78bb;};'use strict';var Sequelize=require(_0x5267('0x0'));var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5267('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5267('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5267('0x2')),'get':function(){try{return JSON[_0x5267('0x3')](this['getDataValue'](_0x5267('0x4')));}catch(_0xf2b350){return[];}},'set':function(_0x4bd042){try{this[_0x5267('0x5')](_0x5267('0x4'),JSON[_0x5267('0x6')](_0x4bd042));}catch(_0x527c16){this[_0x5267('0x5')](_0x5267('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5267('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5267('0x7')]},'col':{'type':Sequelize[_0x5267('0x7')]},'background':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5267('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xfcf0=['sequelize','squel','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0xfcf0[_0x3c04ef];return _0x6a3a69;};'use strict';var Sequelize=require(_0x0fcf('0x0'));var squel=require(_0x0fcf('0x1'));var _=require('lodash');module[_0x0fcf('0x2')]={'title':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0fcf('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0fcf('0x4')]('long'),'get':function(){try{return JSON[_0x0fcf('0x5')](this[_0x0fcf('0x6')](_0x0fcf('0x7')));}catch(_0x3af316){return[];}},'set':function(_0x1bace8){try{this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')](_0x1bace8));}catch(_0x50c575){this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0fcf('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0fcf('0xa')]},'col':{'type':Sequelize[_0x0fcf('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0fcf('0x3')]},'titleFontSize':{'type':Sequelize[_0x0fcf('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 2a53645..44af47b 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 _0x66da=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','redis','localhost','./dashboardItem.socket','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','show','params','model','DashboardItem','query','filters','intersection','attributes','fields','length','include','merge','find','catch','destroy','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv'];(function(_0x58ccf4,_0x4130e8){var _0x40d04e=function(_0x2a0281){while(--_0x2a0281){_0x58ccf4['push'](_0x58ccf4['shift']());}};_0x40d04e(++_0x4130e8);}(_0x66da,0x16f));var _0xa66d=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x66da[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require(_0xa66d('0x0'));var rimraf=require(_0xa66d('0x1'));var zipdir=require(_0xa66d('0x2'));var jsonpatch=require(_0xa66d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa66d('0x4'));var util=require(_0xa66d('0x5'));var path=require(_0xa66d('0x6'));var sox=require(_0xa66d('0x7'));var csv=require(_0xa66d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa66d('0x9'));var _=require(_0xa66d('0xa'));var squel=require(_0xa66d('0xb'));var crypto=require(_0xa66d('0xc'));var jsforce=require(_0xa66d('0xd'));var deskjs=require(_0xa66d('0xe'));var toCsv=require(_0xa66d('0x8'));var querystring=require(_0xa66d('0xf'));var Papa=require(_0xa66d('0x10'));var Redis=require(_0xa66d('0x11'));var authService=require(_0xa66d('0x12'));var qs=require(_0xa66d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66d('0x14'));var logger=require(_0xa66d('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa66d('0x16'));var db=require('../../mysqldb')['db'];config[_0xa66d('0x17')]=_['defaults'](config[_0xa66d('0x17')],{'host':_0xa66d('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa66d('0x17')]));require(_0xa66d('0x19'))['register'](socket);function respondWithStatusCode(_0x2a44ad,_0x56d322){_0x56d322=_0x56d322||0xcc;return function(_0x4c1746){if(_0x4c1746){return _0x2a44ad['sendStatus'](_0x56d322);}return _0x2a44ad[_0xa66d('0x1a')](_0x56d322)[_0xa66d('0x1b')]();};}function respondWithResult(_0x53ad6b,_0x331df5){_0x331df5=_0x331df5||0xc8;return function(_0x3bfcec){if(_0x3bfcec){return _0x53ad6b[_0xa66d('0x1a')](_0x331df5)[_0xa66d('0x1c')](_0x3bfcec);}};}function respondWithFilteredResult(_0x1120cb,_0x47d573){return function(_0x109eb4){if(_0x109eb4){var _0x5e1a70=typeof _0x47d573[_0xa66d('0x1d')]===_0xa66d('0x1e')&&typeof _0x47d573['limit']===_0xa66d('0x1e');var _0x15e064=_0x109eb4[_0xa66d('0x1f')];var _0x3d0219=_0x5e1a70?0x0:_0x47d573['offset'];var _0xee7546=_0x5e1a70?_0x109eb4[_0xa66d('0x1f')]:_0x47d573[_0xa66d('0x1d')]+_0x47d573[_0xa66d('0x20')];var _0x18b0c5;if(_0xee7546>=_0x15e064){_0xee7546=_0x15e064;_0x18b0c5=0xc8;}else{_0x18b0c5=0xce;}_0x1120cb[_0xa66d('0x1a')](_0x18b0c5);return _0x1120cb['set'](_0xa66d('0x21'),_0x3d0219+'-'+_0xee7546+'/'+_0x15e064)['json'](_0x109eb4);}return null;};}function patchUpdates(_0xfde811){return function(_0x2e8155){try{jsonpatch[_0xa66d('0x22')](_0x2e8155,_0xfde811,!![]);}catch(_0x1193e1){return BPromise[_0xa66d('0x23')](_0x1193e1);}return _0x2e8155[_0xa66d('0x24')]();};}function saveUpdates(_0x47fd61,_0x42527c){return function(_0x49f869){if(_0x49f869){return _0x49f869[_0xa66d('0x25')](_0x47fd61)[_0xa66d('0x26')](function(_0x78c0dc){return _0x78c0dc;});}return null;};}function removeEntity(_0x1a01fb,_0x353888){return function(_0x5704c6){if(_0x5704c6){return _0x5704c6['destroy']()[_0xa66d('0x26')](function(){_0x1a01fb[_0xa66d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b563,_0x4dd6fa){return function(_0x46e108){if(!_0x46e108){_0x41b563[_0xa66d('0x27')](0x194);}return _0x46e108;};}function handleError(_0x86e964,_0x3ff4a2){_0x3ff4a2=_0x3ff4a2||0x1f4;return function(_0x2d87f1){logger['error'](_0x2d87f1[_0xa66d('0x28')]);if(_0x2d87f1[_0xa66d('0x29')]){delete _0x2d87f1[_0xa66d('0x29')];}_0x86e964[_0xa66d('0x1a')](_0x3ff4a2)[_0xa66d('0x2a')](_0x2d87f1);};}exports[_0xa66d('0x2b')]=function(_0x4037ba,_0x2e13b3){var _0x5c0e0b={'raw':![],'where':{'id':_0x4037ba[_0xa66d('0x2c')]['id']}},_0x1a545e={};_0x1a545e[_0xa66d('0x2d')]=_['keys'](db[_0xa66d('0x2e')]['rawAttributes']);_0x1a545e[_0xa66d('0x2f')]=_['keys'](_0x4037ba[_0xa66d('0x2f')]);_0x1a545e[_0xa66d('0x30')]=_[_0xa66d('0x31')](_0x1a545e[_0xa66d('0x2d')],_0x1a545e[_0xa66d('0x2f')]);_0x5c0e0b[_0xa66d('0x32')]=_[_0xa66d('0x31')](_0x1a545e[_0xa66d('0x2d')],qs['fields'](_0x4037ba[_0xa66d('0x2f')][_0xa66d('0x33')]));_0x5c0e0b[_0xa66d('0x32')]=_0x5c0e0b[_0xa66d('0x32')][_0xa66d('0x34')]?_0x5c0e0b[_0xa66d('0x32')]:_0x1a545e[_0xa66d('0x2d')];if(_0x4037ba[_0xa66d('0x2f')]['includeAll']){_0x5c0e0b[_0xa66d('0x35')]=[{'all':!![]}];}_0x5c0e0b=_[_0xa66d('0x36')]({},_0x5c0e0b,_0x4037ba['options']);return db[_0xa66d('0x2e')][_0xa66d('0x37')](_0x5c0e0b)[_0xa66d('0x26')](handleEntityNotFound(_0x2e13b3,null))[_0xa66d('0x26')](respondWithResult(_0x2e13b3,null))[_0xa66d('0x38')](handleError(_0x2e13b3,null));};exports[_0xa66d('0x39')]=function(_0x5d587f,_0x49a4be){return db['DashboardItem']['find']({'where':{'id':_0x5d587f[_0xa66d('0x2c')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x49a4be,null))[_0xa66d('0x26')](removeEntity(_0x49a4be,null))[_0xa66d('0x38')](handleError(_0x49a4be,null));};function widgetAttributes(_0x128f8d){try{switch(_0x128f8d['type']){case'iframe':return[{'name':'attrUrl','value':_0x128f8d['attrUrl']||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0][_0xa66d('0x3b')]:undefined)||_0xa66d('0x3c')}];case _0xa66d('0x3d'):return[{'name':_0xa66d('0x3e'),'value':_0x128f8d[_0xa66d('0x3e')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d['attrs'][0x0][_0xa66d('0x3b')]:undefined)||''}];case _0xa66d('0x3f'):return[{'name':_0xa66d('0x40'),'value':_0x128f8d[_0xa66d('0x40')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xa66d('0x41'),'value':_0x128f8d[_0xa66d('0x41')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x1]?_0x128f8d[_0xa66d('0x3a')][0x1]['value']:undefined)||_0xa66d('0x42')},{'name':'attrFontSize','value':_0x128f8d[_0xa66d('0x43')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0x2]?_0x128f8d[_0xa66d('0x3a')][0x2]['value']:undefined)||0xc}];case _0xa66d('0x44'):return[{'name':_0xa66d('0x45'),'value':_0x128f8d[_0xa66d('0x45')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0][_0xa66d('0x3b')]:undefined)||'total'},{'name':_0xa66d('0x46'),'value':_0x128f8d[_0xa66d('0x46')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x1]?_0x128f8d['attrs'][0x1][_0xa66d('0x3b')]:undefined)||[]},{'name':_0xa66d('0x43'),'value':_0x128f8d[_0xa66d('0x43')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x2]?_0x128f8d[_0xa66d('0x3a')][0x2][_0xa66d('0x3b')]:undefined)||0x14},{'name':_0xa66d('0x47'),'value':_0x128f8d[_0xa66d('0x47')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x3]?_0x128f8d[_0xa66d('0x3a')][0x3][_0xa66d('0x3b')]:undefined)||'voice'},{'name':_0xa66d('0x48'),'value':_0x128f8d[_0xa66d('0x48')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x4]?_0x128f8d[_0xa66d('0x3a')][0x4][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x49'),'value':_0x128f8d[_0xa66d('0x49')]||(_0x128f8d['attrs']&&_0x128f8d['attrs'][0x5]?_0x128f8d['attrs'][0x5][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4a'),'value':_0x128f8d[_0xa66d('0x4a')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0x6]?_0x128f8d[_0xa66d('0x3a')][0x6][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4b'),'value':_0x128f8d[_0xa66d('0x4b')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x7]?_0x128f8d[_0xa66d('0x3a')][0x7]['value']:undefined)||''},{'name':_0xa66d('0x4c'),'value':_0x128f8d[_0xa66d('0x4c')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x8]?_0x128f8d[_0xa66d('0x3a')][0x8][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4d'),'value':_0x128f8d[_0xa66d('0x4d')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x9]?_0x128f8d[_0xa66d('0x3a')][0x9][_0xa66d('0x3b')]:undefined)||''}];case _0xa66d('0x4e'):case _0xa66d('0x4f'):return[{'name':_0xa66d('0x50'),'value':_0x128f8d['attrSerie1']||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0][_0xa66d('0x3b')]:undefined)||_0xa66d('0x51')},{'name':_0xa66d('0x52'),'value':_0x128f8d[_0xa66d('0x52')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x1]?_0x128f8d['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x128f8d[_0xa66d('0x53')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x2]?_0x128f8d['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x128f8d[_0xa66d('0x46')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x3]?_0x128f8d[_0xa66d('0x3a')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x128f8d[_0xa66d('0x47')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x4]?_0x128f8d[_0xa66d('0x3a')][0x4][_0xa66d('0x3b')]:undefined)||_0xa66d('0x54')},{'name':_0xa66d('0x48'),'value':_0x128f8d[_0xa66d('0x48')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x5]?_0x128f8d[_0xa66d('0x3a')][0x5]['value']:undefined)||''},{'name':_0xa66d('0x49'),'value':_0x128f8d[_0xa66d('0x49')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x6]?_0x128f8d[_0xa66d('0x3a')][0x6][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4a'),'value':_0x128f8d[_0xa66d('0x4a')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x7]?_0x128f8d[_0xa66d('0x3a')][0x7][_0xa66d('0x3b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x128f8d['attrOpenchannelAccounts']||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x8]?_0x128f8d[_0xa66d('0x3a')][0x8][_0xa66d('0x3b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x128f8d[_0xa66d('0x4c')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x9]?_0x128f8d[_0xa66d('0x3a')][0x9][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4d'),'value':_0x128f8d[_0xa66d('0x4d')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0xa]?_0x128f8d[_0xa66d('0x3a')][0xa][_0xa66d('0x3b')]:undefined)||''}];case _0xa66d('0x55'):return[{'name':_0xa66d('0x56'),'type':_0x128f8d[_0xa66d('0x57')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0]['type']:undefined)||null,'value':_0x128f8d[_0xa66d('0x56')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0][_0xa66d('0x3b')]:undefined)||null},{'name':_0xa66d('0x58'),'value':_0x128f8d['attrRefresh']||(_0x128f8d['attrs']&&_0x128f8d['attrs'][0x1]?_0x128f8d[_0xa66d('0x3a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x19bdfe){logger[_0xa66d('0x59')](_0xa66d('0x5a'),JSON[_0xa66d('0x5b')](_0x19bdfe));return[];}}exports[_0xa66d('0x5c')]=function(_0x5cb526,_0x147618){if(_0x5cb526[_0xa66d('0x5d')]){_0x5cb526['body']['attrs']=widgetAttributes(_0x5cb526['body']);}return db[_0xa66d('0x2e')][_0xa66d('0x5c')](_0x5cb526[_0xa66d('0x5d')],{})['then'](respondWithResult(_0x147618,0xc9))[_0xa66d('0x38')](handleError(_0x147618,null));};exports['update']=function(_0x199510,_0x319b96){if(_0x199510['body']['id']){delete _0x199510[_0xa66d('0x5d')]['id'];}_0x199510[_0xa66d('0x5d')][_0xa66d('0x3a')]=widgetAttributes(_0x199510[_0xa66d('0x5d')]);return db['DashboardItem'][_0xa66d('0x37')]({'where':{'id':_0x199510[_0xa66d('0x2c')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x319b96,null))[_0xa66d('0x26')](saveUpdates(_0x199510[_0xa66d('0x5d')],null))[_0xa66d('0x26')](respondWithResult(_0x319b96,null))[_0xa66d('0x38')](handleError(_0x319b96,null));}; \ No newline at end of file +var _0x853e=['attrRefresh','widgetAttributes:\x20%s','stringify','body','create','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','merge','options','find','params','catch','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type'];(function(_0x1deaad,_0x1dd517){var _0x6cb5c1=function(_0x9f7c0c){while(--_0x9f7c0c){_0x1deaad['push'](_0x1deaad['shift']());}};_0x6cb5c1(++_0x1dd517);}(_0x853e,0x1ea));var _0xe853=function(_0x55e45f,_0x52393a){_0x55e45f=_0x55e45f-0x0;var _0xed0d60=_0x853e[_0x55e45f];return _0xed0d60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe853('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe853('0x1'));var rp=require('request-promise');var moment=require(_0xe853('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe853('0x3'));var util=require(_0xe853('0x4'));var path=require(_0xe853('0x5'));var sox=require(_0xe853('0x6'));var csv=require(_0xe853('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe853('0x8'));var _=require(_0xe853('0x9'));var squel=require(_0xe853('0xa'));var crypto=require(_0xe853('0xb'));var jsforce=require(_0xe853('0xc'));var deskjs=require(_0xe853('0xd'));var toCsv=require(_0xe853('0x7'));var querystring=require(_0xe853('0xe'));var Papa=require(_0xe853('0xf'));var Redis=require(_0xe853('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe853('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xe853('0x12'));var config=require(_0xe853('0x13'));var licenseUtil=require(_0xe853('0x14'));var db=require('../../mysqldb')['db'];config[_0xe853('0x15')]=_[_0xe853('0x16')](config[_0xe853('0x15')],{'host':_0xe853('0x17'),'port':0x18eb});var socket=require(_0xe853('0x18'))(new Redis(config[_0xe853('0x15')]));require(_0xe853('0x19'))['register'](socket);function respondWithStatusCode(_0x4b8e2c,_0x5db22d){_0x5db22d=_0x5db22d||0xcc;return function(_0x552812){if(_0x552812){return _0x4b8e2c[_0xe853('0x1a')](_0x5db22d);}return _0x4b8e2c[_0xe853('0x1b')](_0x5db22d)[_0xe853('0x1c')]();};}function respondWithResult(_0x11e4a0,_0x21c5f0){_0x21c5f0=_0x21c5f0||0xc8;return function(_0x9309a5){if(_0x9309a5){return _0x11e4a0[_0xe853('0x1b')](_0x21c5f0)[_0xe853('0x1d')](_0x9309a5);}};}function respondWithFilteredResult(_0x2a98fa,_0x2f7e6e){return function(_0x30d868){if(_0x30d868){var _0x1d2526=typeof _0x2f7e6e[_0xe853('0x1e')]===_0xe853('0x1f')&&typeof _0x2f7e6e[_0xe853('0x20')]===_0xe853('0x1f');var _0x5f45cf=_0x30d868[_0xe853('0x21')];var _0x2e4fd0=_0x1d2526?0x0:_0x2f7e6e[_0xe853('0x1e')];var _0x3ecb11=_0x1d2526?_0x30d868[_0xe853('0x21')]:_0x2f7e6e[_0xe853('0x1e')]+_0x2f7e6e[_0xe853('0x20')];var _0x3d9e77;if(_0x3ecb11>=_0x5f45cf){_0x3ecb11=_0x5f45cf;_0x3d9e77=0xc8;}else{_0x3d9e77=0xce;}_0x2a98fa[_0xe853('0x1b')](_0x3d9e77);return _0x2a98fa[_0xe853('0x22')](_0xe853('0x23'),_0x2e4fd0+'-'+_0x3ecb11+'/'+_0x5f45cf)['json'](_0x30d868);}return null;};}function patchUpdates(_0x110362){return function(_0x3b6a23){try{jsonpatch[_0xe853('0x24')](_0x3b6a23,_0x110362,!![]);}catch(_0x209049){return BPromise[_0xe853('0x25')](_0x209049);}return _0x3b6a23[_0xe853('0x26')]();};}function saveUpdates(_0x3fa0e3,_0x217612){return function(_0x5466d7){if(_0x5466d7){return _0x5466d7[_0xe853('0x27')](_0x3fa0e3)[_0xe853('0x28')](function(_0x198895){return _0x198895;});}return null;};}function removeEntity(_0x2cb2f1,_0x105ce2){return function(_0x58454e){if(_0x58454e){return _0x58454e[_0xe853('0x29')]()[_0xe853('0x28')](function(){_0x2cb2f1['status'](0xcc)[_0xe853('0x1c')]();});}};}function handleEntityNotFound(_0x4d285a,_0x5c8852){return function(_0x545738){if(!_0x545738){_0x4d285a['sendStatus'](0x194);}return _0x545738;};}function handleError(_0x124049,_0x42c14f){_0x42c14f=_0x42c14f||0x1f4;return function(_0x438b5b){logger[_0xe853('0x2a')](_0x438b5b[_0xe853('0x2b')]);if(_0x438b5b[_0xe853('0x2c')]){delete _0x438b5b[_0xe853('0x2c')];}_0x124049[_0xe853('0x1b')](_0x42c14f)[_0xe853('0x2d')](_0x438b5b);};}exports[_0xe853('0x2e')]=function(_0x51fc77,_0x5d4876){var _0x139fa2={'raw':![],'where':{'id':_0x51fc77['params']['id']}},_0x82cb01={};_0x82cb01[_0xe853('0x2f')]=_['keys'](db[_0xe853('0x30')][_0xe853('0x31')]);_0x82cb01[_0xe853('0x32')]=_['keys'](_0x51fc77[_0xe853('0x32')]);_0x82cb01[_0xe853('0x33')]=_[_0xe853('0x34')](_0x82cb01[_0xe853('0x2f')],_0x82cb01[_0xe853('0x32')]);_0x139fa2[_0xe853('0x35')]=_[_0xe853('0x34')](_0x82cb01[_0xe853('0x2f')],qs[_0xe853('0x36')](_0x51fc77[_0xe853('0x32')][_0xe853('0x36')]));_0x139fa2['attributes']=_0x139fa2[_0xe853('0x35')]['length']?_0x139fa2[_0xe853('0x35')]:_0x82cb01[_0xe853('0x2f')];if(_0x51fc77[_0xe853('0x32')][_0xe853('0x37')]){_0x139fa2['include']=[{'all':!![]}];}_0x139fa2=_[_0xe853('0x38')]({},_0x139fa2,_0x51fc77[_0xe853('0x39')]);return db[_0xe853('0x30')][_0xe853('0x3a')](_0x139fa2)[_0xe853('0x28')](handleEntityNotFound(_0x5d4876,null))[_0xe853('0x28')](respondWithResult(_0x5d4876,null))['catch'](handleError(_0x5d4876,null));};exports[_0xe853('0x29')]=function(_0x40c7aa,_0x13bd8d){return db[_0xe853('0x30')][_0xe853('0x3a')]({'where':{'id':_0x40c7aa[_0xe853('0x3b')]['id']}})[_0xe853('0x28')](handleEntityNotFound(_0x13bd8d,null))[_0xe853('0x28')](removeEntity(_0x13bd8d,null))[_0xe853('0x3c')](handleError(_0x13bd8d,null));};function widgetAttributes(_0x5d9735){try{switch(_0x5d9735['type']){case _0xe853('0x3d'):return[{'name':_0xe853('0x3e'),'value':_0x5d9735[_0xe853('0x3e')]||(_0x5d9735['attrs']&&_0x5d9735[_0xe853('0x3f')][0x0]?_0x5d9735['attrs'][0x0]['value']:undefined)||'https://'}];case _0xe853('0x40'):return[{'name':_0xe853('0x41'),'value':_0x5d9735[_0xe853('0x41')]||(_0x5d9735['attrs']&&_0x5d9735[_0xe853('0x3f')][0x0]?_0x5d9735[_0xe853('0x3f')][0x0][_0xe853('0x42')]:undefined)||''}];case _0xe853('0x43'):return[{'name':_0xe853('0x44'),'value':_0x5d9735[_0xe853('0x44')]||(_0x5d9735['attrs']&&_0x5d9735['attrs'][0x0]?_0x5d9735[_0xe853('0x3f')][0x0]['value']:undefined)||_0xe853('0x45')},{'name':_0xe853('0x46'),'value':_0x5d9735[_0xe853('0x46')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x1]?_0x5d9735[_0xe853('0x3f')][0x1][_0xe853('0x42')]:undefined)||'0.00'},{'name':_0xe853('0x47'),'value':_0x5d9735[_0xe853('0x47')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735['attrs'][0x2]?_0x5d9735[_0xe853('0x3f')][0x2][_0xe853('0x42')]:undefined)||0xc}];case'counter':return[{'name':_0xe853('0x48'),'value':_0x5d9735[_0xe853('0x48')]||(_0x5d9735['attrs']&&_0x5d9735[_0xe853('0x3f')][0x0]?_0x5d9735[_0xe853('0x3f')][0x0][_0xe853('0x42')]:undefined)||_0xe853('0x49')},{'name':'attrVoiceQueues','value':_0x5d9735[_0xe853('0x4a')]||(_0x5d9735['attrs']&&_0x5d9735[_0xe853('0x3f')][0x1]?_0x5d9735[_0xe853('0x3f')][0x1][_0xe853('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x5d9735[_0xe853('0x47')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735['attrs'][0x2]?_0x5d9735[_0xe853('0x3f')][0x2]['value']:undefined)||0x14},{'name':_0xe853('0x4b'),'value':_0x5d9735[_0xe853('0x4b')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x3]?_0x5d9735['attrs'][0x3]['value']:undefined)||_0xe853('0x4c')},{'name':_0xe853('0x4d'),'value':_0x5d9735['attrEmailAccounts']||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x4]?_0x5d9735['attrs'][0x4]['value']:undefined)||''},{'name':_0xe853('0x4e'),'value':_0x5d9735[_0xe853('0x4e')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x5]?_0x5d9735[_0xe853('0x3f')][0x5][_0xe853('0x42')]:undefined)||''},{'name':_0xe853('0x4f'),'value':_0x5d9735[_0xe853('0x4f')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x6]?_0x5d9735['attrs'][0x6]['value']:undefined)||''},{'name':_0xe853('0x50'),'value':_0x5d9735[_0xe853('0x50')]||(_0x5d9735['attrs']&&_0x5d9735[_0xe853('0x3f')][0x7]?_0x5d9735[_0xe853('0x3f')][0x7]['value']:undefined)||''},{'name':_0xe853('0x51'),'value':_0x5d9735[_0xe853('0x51')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735['attrs'][0x8]?_0x5d9735[_0xe853('0x3f')][0x8][_0xe853('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5d9735[_0xe853('0x52')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x9]?_0x5d9735[_0xe853('0x3f')][0x9][_0xe853('0x42')]:undefined)||''}];case _0xe853('0x53'):case _0xe853('0x54'):return[{'name':_0xe853('0x55'),'value':_0x5d9735['attrSerie1']||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x0]?_0x5d9735[_0xe853('0x3f')][0x0][_0xe853('0x42')]:undefined)||_0xe853('0x49')},{'name':_0xe853('0x56'),'value':_0x5d9735[_0xe853('0x56')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x1]?_0x5d9735[_0xe853('0x3f')][0x1][_0xe853('0x42')]:undefined)||null},{'name':_0xe853('0x57'),'value':_0x5d9735[_0xe853('0x57')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x2]?_0x5d9735[_0xe853('0x3f')][0x2]['value']:undefined)||null},{'name':_0xe853('0x4a'),'value':_0x5d9735['attrVoiceQueues']||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x3]?_0x5d9735[_0xe853('0x3f')][0x3]['value']:undefined)||[]},{'name':_0xe853('0x4b'),'value':_0x5d9735[_0xe853('0x4b')]||(_0x5d9735['attrs']&&_0x5d9735['attrs'][0x4]?_0x5d9735[_0xe853('0x3f')][0x4][_0xe853('0x42')]:undefined)||'voice'},{'name':_0xe853('0x4d'),'value':_0x5d9735[_0xe853('0x4d')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x5]?_0x5d9735[_0xe853('0x3f')][0x5][_0xe853('0x42')]:undefined)||''},{'name':_0xe853('0x4e'),'value':_0x5d9735['attrFaxAccounts']||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x6]?_0x5d9735[_0xe853('0x3f')][0x6][_0xe853('0x42')]:undefined)||''},{'name':_0xe853('0x4f'),'value':_0x5d9735['attrSmsAccounts']||(_0x5d9735['attrs']&&_0x5d9735[_0xe853('0x3f')][0x7]?_0x5d9735[_0xe853('0x3f')][0x7][_0xe853('0x42')]:undefined)||''},{'name':_0xe853('0x50'),'value':_0x5d9735[_0xe853('0x50')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735['attrs'][0x8]?_0x5d9735[_0xe853('0x3f')][0x8]['value']:undefined)||''},{'name':_0xe853('0x51'),'value':_0x5d9735[_0xe853('0x51')]||(_0x5d9735['attrs']&&_0x5d9735[_0xe853('0x3f')][0x9]?_0x5d9735[_0xe853('0x3f')][0x9]['value']:undefined)||''},{'name':_0xe853('0x52'),'value':_0x5d9735[_0xe853('0x52')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735['attrs'][0xa]?_0x5d9735['attrs'][0xa]['value']:undefined)||''}];case _0xe853('0x58'):return[{'name':_0xe853('0x59'),'type':_0x5d9735[_0xe853('0x5a')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x0]?_0x5d9735[_0xe853('0x3f')][0x0][_0xe853('0x5b')]:undefined)||null,'value':_0x5d9735[_0xe853('0x59')]||(_0x5d9735[_0xe853('0x3f')]&&_0x5d9735[_0xe853('0x3f')][0x0]?_0x5d9735['attrs'][0x0][_0xe853('0x42')]:undefined)||null},{'name':_0xe853('0x5c'),'value':_0x5d9735[_0xe853('0x5c')]||(_0x5d9735['attrs']&&_0x5d9735[_0xe853('0x3f')][0x1]?_0x5d9735[_0xe853('0x3f')][0x1][_0xe853('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x1acc07){logger[_0xe853('0x2a')](_0xe853('0x5d'),JSON[_0xe853('0x5e')](_0x1acc07));return[];}}exports['create']=function(_0x4f8699,_0x215e51){if(_0x4f8699[_0xe853('0x5f')]){_0x4f8699[_0xe853('0x5f')][_0xe853('0x3f')]=widgetAttributes(_0x4f8699[_0xe853('0x5f')]);}return db[_0xe853('0x30')][_0xe853('0x60')](_0x4f8699[_0xe853('0x5f')],{})['then'](respondWithResult(_0x215e51,0xc9))[_0xe853('0x3c')](handleError(_0x215e51,null));};exports[_0xe853('0x27')]=function(_0x49a91e,_0x223475){if(_0x49a91e['body']['id']){delete _0x49a91e[_0xe853('0x5f')]['id'];}_0x49a91e['body']['attrs']=widgetAttributes(_0x49a91e[_0xe853('0x5f')]);return db['DashboardItem'][_0xe853('0x3a')]({'where':{'id':_0x49a91e['params']['id']}})['then'](handleEntityNotFound(_0x223475,null))[_0xe853('0x28')](saveUpdates(_0x49a91e[_0xe853('0x5f')],null))[_0xe853('0x28')](respondWithResult(_0x223475,null))[_0xe853('0x3c')](handleError(_0x223475,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 4eaa1ce..81cccd3 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 _0x3dd7=['../../mysqldb','DashboardItem','setMaxListeners','remove','emit','hook'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x3dd7,0x1f2));var _0x73dd=function(_0x339a1f,_0x2b5fd2){_0x339a1f=_0x339a1f-0x0;var _0xea6184=_0x3dd7[_0x339a1f];return _0xea6184;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x73dd('0x0'))['db'][_0x73dd('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x73dd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x73dd('0x3')};function emitEvent(_0x22494f){return function(_0x3106c0,_0x1b07b6,_0x403f66){DashboardItemEvents[_0x73dd('0x4')](_0x22494f+':'+_0x3106c0['id'],_0x3106c0);DashboardItemEvents[_0x73dd('0x4')](_0x22494f,_0x3106c0);_0x403f66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x73dd('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xa490=['emit','hasOwnProperty','hook','DashboardItem','setMaxListeners','save','update'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa490,0xce));var _0x0a49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa490[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x0a49('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0a49('0x1')](0x0);var events={'afterCreate':_0x0a49('0x2'),'afterUpdate':_0x0a49('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d179c){return function(_0x3d7598,_0x4d4cd2,_0x1afaff){DashboardItemEvents['emit'](_0x2d179c+':'+_0x3d7598['id'],_0x3d7598);DashboardItemEvents[_0x0a49('0x4')](_0x2d179c,_0x3d7598);_0x1afaff(null);};}for(var e in events){if(events[_0x0a49('0x5')](e)){var event=events[e];DashboardItem[_0x0a49('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 13f3510..894f9ca 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 _0x7bae=['./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x2ae071,_0x346bee){var _0x1db8f8=function(_0x3134bf){while(--_0x3134bf){_0x2ae071['push'](_0x2ae071['shift']());}};_0x1db8f8(++_0x346bee);}(_0x7bae,0xaa));var _0xe7ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe7ba('0x0'));var logger=require(_0xe7ba('0x1'))(_0xe7ba('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe7ba('0x3'));var fs=require('fs');var path=require(_0xe7ba('0x4'));var rimraf=require('rimraf');var config=require(_0xe7ba('0x5'));var attributes=require(_0xe7ba('0x6'));module[_0xe7ba('0x7')]=function(_0x3f15c7,_0x3d4d89){return _0x3f15c7[_0xe7ba('0x8')](_0xe7ba('0x9'),attributes,{'tableName':_0xe7ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb661=['DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0xb661,0x1d0));var _0x1b66=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xb661[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x1b66('0x0'));var util=require(_0x1b66('0x1'));var logger=require(_0x1b66('0x2'))(_0x1b66('0x3'));var moment=require(_0x1b66('0x4'));var BPromise=require(_0x1b66('0x5'));var rp=require(_0x1b66('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x1b66('0x7')]=function(_0x1c8498,_0x4ada4c){return _0x1c8498[_0x1b66('0x8')](_0x1b66('0x9'),attributes,{'tableName':_0x1b66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 7afc4b1..e68cb9a 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 _0x62ca=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1daf38,_0x59a0e9){var _0x2531e1=function(_0x1364ea){while(--_0x1364ea){_0x1daf38['push'](_0x1daf38['shift']());}};_0x2531e1(++_0x59a0e9);}(_0x62ca,0x10f));var _0xa62c=function(_0xfe8044,_0xbc1ba9){_0xfe8044=_0xfe8044-0x0;var _0x4ed72e=_0x62ca[_0xfe8044];return _0x4ed72e;};'use strict';var _=require(_0xa62c('0x0'));var util=require('util');var moment=require(_0xa62c('0x1'));var BPromise=require(_0xa62c('0x2'));var rs=require(_0xa62c('0x3'));var fs=require('fs');var Redis=require(_0xa62c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa62c('0x5'))(_0xa62c('0x6'));var config=require(_0xa62c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa62c('0x8')][_0xa62c('0x9')]({'port':0x232a});config[_0xa62c('0xa')]=_[_0xa62c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa62c('0xc'))(new Redis(config[_0xa62c('0xa')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x1b644a,_0x300d74,_0x220ac5){return new BPromise(function(_0x258d87,_0x38fe0f){return client[_0xa62c('0xd')](_0x1b644a,_0x220ac5)['then'](function(_0x475d52){logger[_0xa62c('0xe')](_0xa62c('0xf'),_0x300d74,_0xa62c('0x10'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x300d74,_0xa62c('0x10'),JSON[_0xa62c('0x11')](_0x475d52));if(_0x475d52['error']){if(_0x475d52[_0xa62c('0x12')][_0xa62c('0x13')]===0x1f4){logger[_0xa62c('0x12')](_0xa62c('0xf'),_0x300d74,_0x475d52[_0xa62c('0x12')][_0xa62c('0x14')]);return _0x38fe0f(_0x475d52[_0xa62c('0x12')][_0xa62c('0x14')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x300d74,_0x475d52[_0xa62c('0x12')][_0xa62c('0x14')]);return _0x258d87(_0x475d52[_0xa62c('0x12')][_0xa62c('0x14')]);}else{logger[_0xa62c('0xe')](_0xa62c('0xf'),_0x300d74,_0xa62c('0x10'));_0x258d87(_0x475d52[_0xa62c('0x15')][_0xa62c('0x14')]);}})[_0xa62c('0x16')](function(_0x2d10ef){logger[_0xa62c('0x12')](_0xa62c('0xf'),_0x300d74,_0x2d10ef);_0x38fe0f(_0x2d10ef);});});} \ No newline at end of file +var _0x49ac=['./dashboardItem.socket','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5496f6,_0x53f480){var _0x4ecccf=function(_0x2374ea){while(--_0x2374ea){_0x5496f6['push'](_0x5496f6['shift']());}};_0x4ecccf(++_0x53f480);}(_0x49ac,0x134));var _0xc49a=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x49ac[_0x3a73bc];return _0x32891b;};'use strict';var _=require(_0xc49a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc49a('0x1'));var rs=require(_0xc49a('0x2'));var fs=require('fs');var Redis=require(_0xc49a('0x3'));var db=require(_0xc49a('0x4'))['db'];var utils=require(_0xc49a('0x5'));var logger=require(_0xc49a('0x6'))(_0xc49a('0x7'));var config=require(_0xc49a('0x8'));var jayson=require(_0xc49a('0x9'));var client=jayson[_0xc49a('0xa')][_0xc49a('0xb')]({'port':0x232a});config[_0xc49a('0xc')]=_[_0xc49a('0xd')](config[_0xc49a('0xc')],{'host':_0xc49a('0xe'),'port':0x18eb});var socket=require(_0xc49a('0xf'))(new Redis(config['redis']));require(_0xc49a('0x10'))['register'](socket);function respondWithRpcPromise(_0x16c86a,_0x5627c1,_0x1d2720){return new BPromise(function(_0x3d18d4,_0x1952ac){return client[_0xc49a('0x11')](_0x16c86a,_0x1d2720)['then'](function(_0x335168){logger[_0xc49a('0x12')](_0xc49a('0x13'),_0x5627c1,_0xc49a('0x14'));logger[_0xc49a('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x5627c1,_0xc49a('0x14'),JSON['stringify'](_0x335168));if(_0x335168[_0xc49a('0x16')]){if(_0x335168['error'][_0xc49a('0x17')]===0x1f4){logger[_0xc49a('0x16')]('DashboardItem,\x20%s,\x20%s',_0x5627c1,_0x335168[_0xc49a('0x16')][_0xc49a('0x18')]);return _0x1952ac(_0x335168[_0xc49a('0x16')][_0xc49a('0x18')]);}logger['error'](_0xc49a('0x13'),_0x5627c1,_0x335168[_0xc49a('0x16')]['message']);return _0x3d18d4(_0x335168[_0xc49a('0x16')][_0xc49a('0x18')]);}else{logger['info'](_0xc49a('0x13'),_0x5627c1,_0xc49a('0x14'));_0x3d18d4(_0x335168[_0xc49a('0x19')]['message']);}})[_0xc49a('0x1a')](function(_0x150d8a){logger['error'](_0xc49a('0x13'),_0x5627c1,_0x150d8a);_0x1952ac(_0x150d8a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f56b533..444bacc 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 _0x084a=['update','register','save'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x084a,0xb0));var _0xa084=function(_0x1d36da,_0x49cb9b){_0x1d36da=_0x1d36da-0x0;var _0x26dd56=_0x084a[_0x1d36da];return _0x26dd56;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xa084('0x0'),'remove',_0xa084('0x1')];function createListener(_0x42b00e,_0x3a2769){return function(_0x3e47f2){_0x3a2769['emit'](_0x42b00e,_0x3e47f2);};}function removeListener(_0x5831d2,_0x2d67ed){return function(){DashboardItemEvents['removeListener'](_0x5831d2,_0x2d67ed);};}exports[_0xa084('0x2')]=function(_0x1e5d72){for(var _0x532426=0x0,_0xb349a0=events['length'];_0x532426<_0xb349a0;_0x532426++){var _0x14a4ef=events[_0x532426];var _0x52fc19=createListener('dashboardItem:'+_0x14a4ef,_0x1e5d72);DashboardItemEvents['on'](_0x14a4ef,_0x52fc19);}}; \ No newline at end of file +var _0x1cab=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x27cef4,_0x3a0d3d){var _0x116855=function(_0x212558){while(--_0x212558){_0x27cef4['push'](_0x27cef4['shift']());}};_0x116855(++_0x3a0d3d);}(_0x1cab,0x96));var _0xb1ca=function(_0x1dc2b3,_0x5d4ccb){_0x1dc2b3=_0x1dc2b3-0x0;var _0x51dd4d=_0x1cab[_0x1dc2b3];return _0x51dd4d;};'use strict';var DashboardItemEvents=require(_0xb1ca('0x0'));var events=[_0xb1ca('0x1'),_0xb1ca('0x2'),_0xb1ca('0x3')];function createListener(_0x146259,_0x26be55){return function(_0x30884a){_0x26be55[_0xb1ca('0x4')](_0x146259,_0x30884a);};}function removeListener(_0x15f4b7,_0x17937f){return function(){DashboardItemEvents[_0xb1ca('0x5')](_0x15f4b7,_0x17937f);};}exports[_0xb1ca('0x6')]=function(_0xbb195c){for(var _0xe7489a=0x0,_0x593961=events[_0xb1ca('0x7')];_0xe7489a<_0x593961;_0xe7489a++){var _0x5ade6a=events[_0xe7489a];var _0x332b55=createListener(_0xb1ca('0x8')+_0x5ade6a,_0xbb195c);DashboardItemEvents['on'](_0x5ade6a,_0x332b55);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 57dbccd..f13c3fd 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 _0x1129=['post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x1129,0xd1));var _0x9112=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1129[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9112('0x0'));var util=require(_0x9112('0x1'));var path=require(_0x9112('0x2'));var timeout=require(_0x9112('0x3'));var express=require('express');var router=express[_0x9112('0x4')]();var fs_extra=require(_0x9112('0x5'));var auth=require(_0x9112('0x6'));var interaction=require(_0x9112('0x7'));var config=require(_0x9112('0x8'));var controller=require('./dashboardItem.controller');router['get'](_0x9112('0x9'),auth[_0x9112('0xa')](),controller[_0x9112('0xb')]);router[_0x9112('0xc')]('/',auth[_0x9112('0xa')](),controller[_0x9112('0xd')]);router[_0x9112('0xe')](_0x9112('0x9'),auth[_0x9112('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9112('0xf')]);module[_0x9112('0x10')]=router; \ No newline at end of file +var _0xdb96=['create','/:id','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','show','post'];(function(_0x3511ab,_0x56fa02){var _0x591121=function(_0x49bb16){while(--_0x49bb16){_0x3511ab['push'](_0x3511ab['shift']());}};_0x591121(++_0x56fa02);}(_0xdb96,0x1b5));var _0x6db9=function(_0x5de72a,_0x49c830){_0x5de72a=_0x5de72a-0x0;var _0x31d049=_0xdb96[_0x5de72a];return _0x31d049;};'use strict';var multer=require(_0x6db9('0x0'));var util=require(_0x6db9('0x1'));var path=require(_0x6db9('0x2'));var timeout=require(_0x6db9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6db9('0x4'));var interaction=require(_0x6db9('0x5'));var config=require('../../config/environment');var controller=require(_0x6db9('0x6'));router[_0x6db9('0x7')]('/:id',auth[_0x6db9('0x8')](),controller[_0x6db9('0x9')]);router[_0x6db9('0xa')]('/',auth['isAuthenticated'](),controller[_0x6db9('0xb')]);router['put'](_0x6db9('0xc'),auth[_0x6db9('0x8')](),controller[_0x6db9('0xd')]);router['delete'](_0x6db9('0xc'),auth[_0x6db9('0x8')](),controller[_0x6db9('0xe')]);module[_0x6db9('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 6d50ac6..549b011 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 _0xe3d6=['first','sequelize','exports','STRING','ENUM','third'];(function(_0x49b956,_0x3dbb27){var _0x332928=function(_0x14cb73){while(--_0x14cb73){_0x49b956['push'](_0x49b956['shift']());}};_0x332928(++_0x3dbb27);}(_0xe3d6,0x12d));var _0x6e3d=function(_0x1c7b25,_0x3007be){_0x1c7b25=_0x1c7b25-0x0;var _0x44ab7c=_0xe3d6[_0x1c7b25];return _0x44ab7c;};'use strict';var Sequelize=require(_0x6e3d('0x0'));module[_0x6e3d('0x1')]={'name':{'type':Sequelize[_0x6e3d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x6e3d('0x3')]('first','second',_0x6e3d('0x4')),'allowNull':![],'defaultValue':_0x6e3d('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x99fc=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x99fc,0x124));var _0xc99f=function(_0x415000,_0x2ec2d3){_0x415000=_0x415000-0x0;var _0x3ebd64=_0x99fc[_0x415000];return _0x3ebd64;};'use strict';var Sequelize=require(_0xc99f('0x0'));module[_0xc99f('0x1')]={'name':{'type':Sequelize[_0xc99f('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xc99f('0x3')](_0xc99f('0x4'),_0xc99f('0x5'),_0xc99f('0x6')),'allowNull':![],'defaultValue':_0xc99f('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 9b7504b..abf4863 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 _0x90c5=['where','VIRTUAL','include','rows','catch','show','params','keys','merge','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','then','UserProfileResource','destroy','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters'];(function(_0x258e30,_0x4ca146){var _0x382268=function(_0xa6142a){while(--_0xa6142a){_0x258e30['push'](_0x258e30['shift']());}};_0x382268(++_0x4ca146);}(_0x90c5,0x17e));var _0x590c=function(_0x29aa0d,_0x5cb114){_0x29aa0d=_0x29aa0d-0x0;var _0x2e33fe=_0x90c5[_0x29aa0d];return _0x2e33fe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x590c('0x0'));var jsonpatch=require(_0x590c('0x1'));var rp=require(_0x590c('0x2'));var moment=require(_0x590c('0x3'));var BPromise=require(_0x590c('0x4'));var Mustache=require(_0x590c('0x5'));var util=require(_0x590c('0x6'));var path=require(_0x590c('0x7'));var sox=require(_0x590c('0x8'));var csv=require('to-csv');var ejs=require(_0x590c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x590c('0xa'));var squel=require(_0x590c('0xb'));var crypto=require('crypto');var jsforce=require(_0x590c('0xc'));var deskjs=require(_0x590c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x590c('0xe'));var Redis=require('ioredis');var authService=require(_0x590c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x590c('0x10'));var logger=require('../../config/logger')(_0x590c('0x11'));var utils=require(_0x590c('0x12'));var config=require(_0x590c('0x13'));var licenseUtil=require(_0x590c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31cd51,_0x4d1d35){_0x4d1d35=_0x4d1d35||0xcc;return function(_0x6e23b1){if(_0x6e23b1){return _0x31cd51[_0x590c('0x15')](_0x4d1d35);}return _0x31cd51[_0x590c('0x16')](_0x4d1d35)[_0x590c('0x17')]();};}function respondWithResult(_0x51862a,_0x4eb87f){_0x4eb87f=_0x4eb87f||0xc8;return function(_0x56b3f6){if(_0x56b3f6){return _0x51862a[_0x590c('0x16')](_0x4eb87f)['json'](_0x56b3f6);}};}function respondWithFilteredResult(_0xd35fb,_0x3edd0a){return function(_0x26fb48){if(_0x26fb48){var _0x7fc561=typeof _0x3edd0a[_0x590c('0x18')]===_0x590c('0x19')&&typeof _0x3edd0a['limit']===_0x590c('0x19');var _0x4e1ff1=_0x26fb48[_0x590c('0x1a')];var _0x2ce962=_0x7fc561?0x0:_0x3edd0a[_0x590c('0x18')];var _0x4ad18a=_0x7fc561?_0x26fb48['count']:_0x3edd0a['offset']+_0x3edd0a['limit'];var _0x3930b9;if(_0x4ad18a>=_0x4e1ff1){_0x4ad18a=_0x4e1ff1;_0x3930b9=0xc8;}else{_0x3930b9=0xce;}_0xd35fb[_0x590c('0x16')](_0x3930b9);return _0xd35fb['set'](_0x590c('0x1b'),_0x2ce962+'-'+_0x4ad18a+'/'+_0x4e1ff1)[_0x590c('0x1c')](_0x26fb48);}return null;};}function patchUpdates(_0x7d91d){return function(_0xa60edd){try{jsonpatch[_0x590c('0x1d')](_0xa60edd,_0x7d91d,!![]);}catch(_0x2e9dfa){return BPromise[_0x590c('0x1e')](_0x2e9dfa);}return _0xa60edd['save']();};}function saveUpdates(_0x577d6b,_0xa5e54b){return function(_0x323439){if(_0x323439){return _0x323439[_0x590c('0x1f')](_0x577d6b)[_0x590c('0x20')](function(_0x6ac0f5){return _0x6ac0f5;});}return null;};}function removeEntity(_0x4629f1,_0x1a874d){return function(_0x4c9804){if(_0x4c9804){return _0x4c9804['destroy']()[_0x590c('0x20')](function(){var _0x416752=_0x4c9804['get']({'plain':!![]});var _0x37aca5='Dispositions';return db[_0x590c('0x21')][_0x590c('0x22')]({'where':{'type':_0x37aca5,'resourceId':_0x416752['id']}})[_0x590c('0x20')](function(){return _0x4c9804;});})[_0x590c('0x20')](function(){_0x4629f1['status'](0xcc)[_0x590c('0x17')]();});}};}function handleEntityNotFound(_0x253760,_0x2dad5a){return function(_0x3fce55){if(!_0x3fce55){_0x253760[_0x590c('0x15')](0x194);}return _0x3fce55;};}function handleError(_0x3bbe65,_0xd23eac){_0xd23eac=_0xd23eac||0x1f4;return function(_0x3acf45){logger['error'](_0x3acf45[_0x590c('0x23')]);if(_0x3acf45['name']){delete _0x3acf45[_0x590c('0x24')];}_0x3bbe65['status'](_0xd23eac)[_0x590c('0x25')](_0x3acf45);};}exports[_0x590c('0x26')]=function(_0x32e2f4,_0x28e561){var _0x4e1c04={},_0x12de4f={},_0x1a87f0={'count':0x0,'rows':[]};var _0x2e3208=_[_0x590c('0x27')](db[_0x590c('0x28')][_0x590c('0x29')],function(_0x3d1c40){return{'name':_0x3d1c40['fieldName'],'type':_0x3d1c40[_0x590c('0x2a')][_0x590c('0x2b')]};});_0x12de4f[_0x590c('0x2c')]=_[_0x590c('0x27')](_0x2e3208,_0x590c('0x24'));_0x12de4f[_0x590c('0x2d')]=_['keys'](_0x32e2f4[_0x590c('0x2d')]);_0x12de4f['filters']=_[_0x590c('0x2e')](_0x12de4f[_0x590c('0x2c')],_0x12de4f[_0x590c('0x2d')]);_0x4e1c04[_0x590c('0x2f')]=_[_0x590c('0x2e')](_0x12de4f['model'],qs[_0x590c('0x30')](_0x32e2f4[_0x590c('0x2d')][_0x590c('0x30')]));_0x4e1c04[_0x590c('0x2f')]=_0x4e1c04['attributes'][_0x590c('0x31')]?_0x4e1c04[_0x590c('0x2f')]:_0x12de4f[_0x590c('0x2c')];if(!_0x32e2f4[_0x590c('0x2d')][_0x590c('0x32')](_0x590c('0x33'))){_0x4e1c04['limit']=qs['limit'](_0x32e2f4['query'][_0x590c('0x34')]);_0x4e1c04[_0x590c('0x18')]=qs[_0x590c('0x18')](_0x32e2f4[_0x590c('0x2d')][_0x590c('0x18')]);}_0x4e1c04[_0x590c('0x35')]=qs['sort'](_0x32e2f4['query'][_0x590c('0x36')]);_0x4e1c04['where']=qs[_0x590c('0x37')](_['pick'](_0x32e2f4[_0x590c('0x2d')],_0x12de4f[_0x590c('0x37')]),_0x2e3208);if(_0x32e2f4[_0x590c('0x2d')]['filter']){_0x4e1c04[_0x590c('0x38')]=_['merge'](_0x4e1c04[_0x590c('0x38')],{'$or':_[_0x590c('0x27')](_0x2e3208,function(_0x1e6265){if(_0x1e6265[_0x590c('0x2a')]!==_0x590c('0x39')){var _0x5dfdbf={};_0x5dfdbf[_0x1e6265[_0x590c('0x24')]]={'$like':'%'+_0x32e2f4[_0x590c('0x2d')]['filter']+'%'};return _0x5dfdbf;}})});}_0x4e1c04=_['merge']({},_0x4e1c04,_0x32e2f4['options']);var _0x18f545={'where':_0x4e1c04[_0x590c('0x38')]};return db[_0x590c('0x28')][_0x590c('0x1a')](_0x18f545)['then'](function(_0x4a14fb){_0x1a87f0['count']=_0x4a14fb;if(_0x32e2f4[_0x590c('0x2d')]['includeAll']){_0x4e1c04[_0x590c('0x3a')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4e1c04);})[_0x590c('0x20')](function(_0x3d21ee){_0x1a87f0[_0x590c('0x3b')]=_0x3d21ee;return _0x1a87f0;})['then'](respondWithFilteredResult(_0x28e561,_0x4e1c04))[_0x590c('0x3c')](handleError(_0x28e561,null));};exports[_0x590c('0x3d')]=function(_0x5b5f2a,_0x50956b){var _0x171c21={'raw':!![],'where':{'id':_0x5b5f2a[_0x590c('0x3e')]['id']}},_0x1dc62b={};_0x1dc62b[_0x590c('0x2c')]=_['keys'](db[_0x590c('0x28')][_0x590c('0x29')]);_0x1dc62b[_0x590c('0x2d')]=_[_0x590c('0x3f')](_0x5b5f2a[_0x590c('0x2d')]);_0x1dc62b[_0x590c('0x37')]=_[_0x590c('0x2e')](_0x1dc62b[_0x590c('0x2c')],_0x1dc62b[_0x590c('0x2d')]);_0x171c21[_0x590c('0x2f')]=_[_0x590c('0x2e')](_0x1dc62b['model'],qs[_0x590c('0x30')](_0x5b5f2a[_0x590c('0x2d')]['fields']));_0x171c21[_0x590c('0x2f')]=_0x171c21['attributes'][_0x590c('0x31')]?_0x171c21['attributes']:_0x1dc62b[_0x590c('0x2c')];if(_0x5b5f2a[_0x590c('0x2d')]['includeAll']){_0x171c21[_0x590c('0x3a')]=[{'all':!![]}];}_0x171c21=_[_0x590c('0x40')]({},_0x171c21,_0x5b5f2a['options']);return db[_0x590c('0x28')]['find'](_0x171c21)[_0x590c('0x20')](handleEntityNotFound(_0x50956b,null))[_0x590c('0x20')](respondWithResult(_0x50956b,null))[_0x590c('0x3c')](handleError(_0x50956b,null));};exports[_0x590c('0x41')]=function(_0x4ff920,_0x5f0916){return db['Disposition'][_0x590c('0x41')](_0x4ff920[_0x590c('0x42')],{})[_0x590c('0x20')](function(_0x56f426){var _0x176da0=_0x4ff920['user'][_0x590c('0x43')]({'plain':!![]});if(!_0x176da0)throw new Error(_0x590c('0x44'));if(_0x176da0['role']==='user'){var _0x5d2e65=_0x56f426['get']({'plain':!![]});var _0x3ac480=_0x590c('0x45');return db['UserProfileSection']['find']({'where':{'name':_0x3ac480,'userProfileId':_0x176da0['userProfileId']},'raw':!![]})[_0x590c('0x20')](function(_0x1f5d69){if(_0x1f5d69&&_0x1f5d69['autoAssociation']===0x0){return db[_0x590c('0x21')][_0x590c('0x41')]({'name':_0x5d2e65[_0x590c('0x24')],'resourceId':_0x5d2e65['id'],'type':_0x1f5d69[_0x590c('0x24')],'sectionId':_0x1f5d69['id']},{})[_0x590c('0x20')](function(){return _0x56f426;});}else{return _0x56f426;}})['catch'](function(_0x21031f){logger[_0x590c('0x46')](_0x590c('0x47'),_0x21031f);throw _0x21031f;});}return _0x56f426;})[_0x590c('0x20')](respondWithResult(_0x5f0916,0xc9))[_0x590c('0x3c')](handleError(_0x5f0916,null));};exports['update']=function(_0x1c22b5,_0x56adf2){if(_0x1c22b5['body']['id']){delete _0x1c22b5[_0x590c('0x42')]['id'];}return db[_0x590c('0x28')][_0x590c('0x48')]({'where':{'id':_0x1c22b5[_0x590c('0x3e')]['id']}})[_0x590c('0x20')](handleEntityNotFound(_0x56adf2,null))[_0x590c('0x20')](saveUpdates(_0x1c22b5[_0x590c('0x42')],null))[_0x590c('0x20')](respondWithResult(_0x56adf2,null))[_0x590c('0x3c')](handleError(_0x56adf2,null));};exports[_0x590c('0x22')]=function(_0x1849f0,_0x32ee22){return db[_0x590c('0x28')]['find']({'where':{'id':_0x1849f0['params']['id']}})['then'](handleEntityNotFound(_0x32ee22,null))[_0x590c('0x20')](removeEntity(_0x32ee22,null))[_0x590c('0x3c')](handleError(_0x32ee22,null));}; \ No newline at end of file +var _0xcbef=['name','index','map','Disposition','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','pick','filters','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','get','Dispositions','end','stack'];(function(_0x5b06c5,_0x2f3afe){var _0x247879=function(_0x3a550b){while(--_0x3a550b){_0x5b06c5['push'](_0x5b06c5['shift']());}};_0x247879(++_0x2f3afe);}(_0xcbef,0x11a));var _0xfcbe=function(_0x47a385,_0x5d8781){_0x47a385=_0x47a385-0x0;var _0x31abb9=_0xcbef[_0x47a385];return _0x31abb9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcbe('0x0'));var zipdir=require(_0xfcbe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfcbe('0x2'));var moment=require(_0xfcbe('0x3'));var BPromise=require(_0xfcbe('0x4'));var Mustache=require(_0xfcbe('0x5'));var util=require(_0xfcbe('0x6'));var path=require(_0xfcbe('0x7'));var sox=require(_0xfcbe('0x8'));var csv=require('to-csv');var ejs=require(_0xfcbe('0x9'));var fs=require('fs');var fs_extra=require(_0xfcbe('0xa'));var _=require(_0xfcbe('0xb'));var squel=require(_0xfcbe('0xc'));var crypto=require(_0xfcbe('0xd'));var jsforce=require(_0xfcbe('0xe'));var deskjs=require(_0xfcbe('0xf'));var toCsv=require(_0xfcbe('0x10'));var querystring=require(_0xfcbe('0x11'));var Papa=require(_0xfcbe('0x12'));var Redis=require('ioredis');var authService=require(_0xfcbe('0x13'));var qs=require(_0xfcbe('0x14'));var as=require(_0xfcbe('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcbe('0x16'))(_0xfcbe('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcbe('0x18'))['db'];function respondWithStatusCode(_0x5ad416,_0x3be69b){_0x3be69b=_0x3be69b||0xcc;return function(_0xf53dcc){if(_0xf53dcc){return _0x5ad416[_0xfcbe('0x19')](_0x3be69b);}return _0x5ad416[_0xfcbe('0x1a')](_0x3be69b)['end']();};}function respondWithResult(_0x589fb9,_0x34dfb5){_0x34dfb5=_0x34dfb5||0xc8;return function(_0x41d539){if(_0x41d539){return _0x589fb9['status'](_0x34dfb5)['json'](_0x41d539);}};}function respondWithFilteredResult(_0x187440,_0x2c0361){return function(_0x866e3a){if(_0x866e3a){var _0x4dbe05=typeof _0x2c0361[_0xfcbe('0x1b')]===_0xfcbe('0x1c')&&typeof _0x2c0361[_0xfcbe('0x1d')]===_0xfcbe('0x1c');var _0xee9154=_0x866e3a['count'];var _0x22e6b7=_0x4dbe05?0x0:_0x2c0361[_0xfcbe('0x1b')];var _0x1a099a=_0x4dbe05?_0x866e3a[_0xfcbe('0x1e')]:_0x2c0361[_0xfcbe('0x1b')]+_0x2c0361['limit'];var _0x1cf38c;if(_0x1a099a>=_0xee9154){_0x1a099a=_0xee9154;_0x1cf38c=0xc8;}else{_0x1cf38c=0xce;}_0x187440['status'](_0x1cf38c);return _0x187440['set'](_0xfcbe('0x1f'),_0x22e6b7+'-'+_0x1a099a+'/'+_0xee9154)[_0xfcbe('0x20')](_0x866e3a);}return null;};}function patchUpdates(_0x3f38c6){return function(_0x202800){try{jsonpatch[_0xfcbe('0x21')](_0x202800,_0x3f38c6,!![]);}catch(_0x5e00e7){return BPromise['reject'](_0x5e00e7);}return _0x202800[_0xfcbe('0x22')]();};}function saveUpdates(_0x3e162a,_0x45f4c8){return function(_0x330604){if(_0x330604){return _0x330604[_0xfcbe('0x23')](_0x3e162a)[_0xfcbe('0x24')](function(_0x5d8a3e){return _0x5d8a3e;});}return null;};}function removeEntity(_0x1672d3,_0x531430){return function(_0x55815a){if(_0x55815a){return _0x55815a[_0xfcbe('0x25')]()[_0xfcbe('0x24')](function(){var _0x1ae1cf=_0x55815a[_0xfcbe('0x26')]({'plain':!![]});var _0x3047a0=_0xfcbe('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x3047a0,'resourceId':_0x1ae1cf['id']}})[_0xfcbe('0x24')](function(){return _0x55815a;});})['then'](function(){_0x1672d3[_0xfcbe('0x1a')](0xcc)[_0xfcbe('0x28')]();});}};}function handleEntityNotFound(_0x3172c3,_0xbc89f0){return function(_0x4d4771){if(!_0x4d4771){_0x3172c3['sendStatus'](0x194);}return _0x4d4771;};}function handleError(_0x37043f,_0x878a3c){_0x878a3c=_0x878a3c||0x1f4;return function(_0x40881a){logger['error'](_0x40881a[_0xfcbe('0x29')]);if(_0x40881a[_0xfcbe('0x2a')]){delete _0x40881a[_0xfcbe('0x2a')];}_0x37043f[_0xfcbe('0x1a')](_0x878a3c)['send'](_0x40881a);};}exports[_0xfcbe('0x2b')]=function(_0x18f623,_0x1b7be7){var _0x938ef={},_0x1a9552={},_0x1d9acf={'count':0x0,'rows':[]};var _0x5fdef3=_[_0xfcbe('0x2c')](db[_0xfcbe('0x2d')][_0xfcbe('0x2e')],function(_0x17aa4f){return{'name':_0x17aa4f[_0xfcbe('0x2f')],'type':_0x17aa4f[_0xfcbe('0x30')]['key']};});_0x1a9552[_0xfcbe('0x31')]=_[_0xfcbe('0x2c')](_0x5fdef3,_0xfcbe('0x2a'));_0x1a9552[_0xfcbe('0x32')]=_[_0xfcbe('0x33')](_0x18f623[_0xfcbe('0x32')]);_0x1a9552['filters']=_[_0xfcbe('0x34')](_0x1a9552[_0xfcbe('0x31')],_0x1a9552[_0xfcbe('0x32')]);_0x938ef[_0xfcbe('0x35')]=_[_0xfcbe('0x34')](_0x1a9552[_0xfcbe('0x31')],qs[_0xfcbe('0x36')](_0x18f623[_0xfcbe('0x32')][_0xfcbe('0x36')]));_0x938ef[_0xfcbe('0x35')]=_0x938ef[_0xfcbe('0x35')][_0xfcbe('0x37')]?_0x938ef['attributes']:_0x1a9552[_0xfcbe('0x31')];if(!_0x18f623[_0xfcbe('0x32')]['hasOwnProperty'](_0xfcbe('0x38'))){_0x938ef[_0xfcbe('0x1d')]=qs['limit'](_0x18f623[_0xfcbe('0x32')]['limit']);_0x938ef[_0xfcbe('0x1b')]=qs['offset'](_0x18f623['query'][_0xfcbe('0x1b')]);}_0x938ef['order']=qs[_0xfcbe('0x39')](_0x18f623[_0xfcbe('0x32')][_0xfcbe('0x39')]);_0x938ef['where']=qs['filters'](_[_0xfcbe('0x3a')](_0x18f623[_0xfcbe('0x32')],_0x1a9552[_0xfcbe('0x3b')]),_0x5fdef3);if(_0x18f623['query'][_0xfcbe('0x3c')]){_0x938ef[_0xfcbe('0x3d')]=_[_0xfcbe('0x3e')](_0x938ef['where'],{'$or':_['map'](_0x5fdef3,function(_0x4bda53){if(_0x4bda53[_0xfcbe('0x30')]!=='VIRTUAL'){var _0xa135fb={};_0xa135fb[_0x4bda53[_0xfcbe('0x2a')]]={'$like':'%'+_0x18f623[_0xfcbe('0x32')][_0xfcbe('0x3c')]+'%'};return _0xa135fb;}})});}_0x938ef=_[_0xfcbe('0x3e')]({},_0x938ef,_0x18f623['options']);var _0x3e9b7a={'where':_0x938ef[_0xfcbe('0x3d')]};return db[_0xfcbe('0x2d')][_0xfcbe('0x1e')](_0x3e9b7a)[_0xfcbe('0x24')](function(_0x113a95){_0x1d9acf[_0xfcbe('0x1e')]=_0x113a95;if(_0x18f623['query'][_0xfcbe('0x3f')]){_0x938ef[_0xfcbe('0x40')]=[{'all':!![]}];}return db[_0xfcbe('0x2d')][_0xfcbe('0x41')](_0x938ef);})[_0xfcbe('0x24')](function(_0x1a31ca){_0x1d9acf[_0xfcbe('0x42')]=_0x1a31ca;return _0x1d9acf;})[_0xfcbe('0x24')](respondWithFilteredResult(_0x1b7be7,_0x938ef))[_0xfcbe('0x43')](handleError(_0x1b7be7,null));};exports[_0xfcbe('0x44')]=function(_0x287125,_0x25e81f){var _0x5c5887={'raw':!![],'where':{'id':_0x287125[_0xfcbe('0x45')]['id']}},_0x543fe8={};_0x543fe8['model']=_[_0xfcbe('0x33')](db[_0xfcbe('0x2d')][_0xfcbe('0x2e')]);_0x543fe8['query']=_[_0xfcbe('0x33')](_0x287125[_0xfcbe('0x32')]);_0x543fe8['filters']=_['intersection'](_0x543fe8[_0xfcbe('0x31')],_0x543fe8[_0xfcbe('0x32')]);_0x5c5887[_0xfcbe('0x35')]=_[_0xfcbe('0x34')](_0x543fe8[_0xfcbe('0x31')],qs[_0xfcbe('0x36')](_0x287125['query'][_0xfcbe('0x36')]));_0x5c5887[_0xfcbe('0x35')]=_0x5c5887[_0xfcbe('0x35')][_0xfcbe('0x37')]?_0x5c5887[_0xfcbe('0x35')]:_0x543fe8[_0xfcbe('0x31')];if(_0x287125[_0xfcbe('0x32')][_0xfcbe('0x3f')]){_0x5c5887['include']=[{'all':!![]}];}_0x5c5887=_['merge']({},_0x5c5887,_0x287125['options']);return db['Disposition'][_0xfcbe('0x46')](_0x5c5887)['then'](handleEntityNotFound(_0x25e81f,null))[_0xfcbe('0x24')](respondWithResult(_0x25e81f,null))['catch'](handleError(_0x25e81f,null));};exports[_0xfcbe('0x47')]=function(_0x430b92,_0x104bfb){return db[_0xfcbe('0x2d')][_0xfcbe('0x47')](_0x430b92[_0xfcbe('0x48')],{})[_0xfcbe('0x24')](function(_0xf0521d){var _0x29a526=_0x430b92[_0xfcbe('0x49')][_0xfcbe('0x26')]({'plain':!![]});if(!_0x29a526)throw new Error(_0xfcbe('0x4a'));if(_0x29a526[_0xfcbe('0x4b')]===_0xfcbe('0x49')){var _0x54da80=_0xf0521d[_0xfcbe('0x26')]({'plain':!![]});var _0x167be4=_0xfcbe('0x27');return db[_0xfcbe('0x4c')][_0xfcbe('0x46')]({'where':{'name':_0x167be4,'userProfileId':_0x29a526[_0xfcbe('0x4d')]},'raw':!![]})[_0xfcbe('0x24')](function(_0x2767e0){if(_0x2767e0&&_0x2767e0['autoAssociation']===0x0){return db[_0xfcbe('0x4e')]['create']({'name':_0x54da80[_0xfcbe('0x2a')],'resourceId':_0x54da80['id'],'type':_0x2767e0[_0xfcbe('0x2a')],'sectionId':_0x2767e0['id']},{})['then'](function(){return _0xf0521d;});}else{return _0xf0521d;}})[_0xfcbe('0x43')](function(_0x1d15f8){logger[_0xfcbe('0x4f')](_0xfcbe('0x50'),_0x1d15f8);throw _0x1d15f8;});}return _0xf0521d;})[_0xfcbe('0x24')](respondWithResult(_0x104bfb,0xc9))[_0xfcbe('0x43')](handleError(_0x104bfb,null));};exports['update']=function(_0xee4482,_0x338862){if(_0xee4482[_0xfcbe('0x48')]['id']){delete _0xee4482['body']['id'];}return db[_0xfcbe('0x2d')][_0xfcbe('0x46')]({'where':{'id':_0xee4482[_0xfcbe('0x45')]['id']}})[_0xfcbe('0x24')](handleEntityNotFound(_0x338862,null))['then'](saveUpdates(_0xee4482[_0xfcbe('0x48')],null))['then'](respondWithResult(_0x338862,null))[_0xfcbe('0x43')](handleError(_0x338862,null));};exports['destroy']=function(_0x44c4db,_0x4b9c4e){return db[_0xfcbe('0x2d')][_0xfcbe('0x46')]({'where':{'id':_0x44c4db[_0xfcbe('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b9c4e,null))[_0xfcbe('0x24')](removeEntity(_0x4b9c4e,null))[_0xfcbe('0x43')](handleError(_0x4b9c4e,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1cfef79..643af05 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 _0x45cd=['Disposition','tools_dispositions','name_voice','name','name_chat','name_mail','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x45cd,0xfd));var _0xd45c=function(_0x4764f1,_0x5ed32a){_0x4764f1=_0x4764f1-0x0;var _0x5bae8c=_0x45cd[_0x4764f1];return _0x5bae8c;};'use strict';var _=require(_0xd45c('0x0'));var util=require('util');var logger=require(_0xd45c('0x1'))(_0xd45c('0x2'));var moment=require(_0xd45c('0x3'));var BPromise=require(_0xd45c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd45c('0x5'));var rimraf=require(_0xd45c('0x6'));var config=require(_0xd45c('0x7'));var attributes=require(_0xd45c('0x8'));module[_0xd45c('0x9')]=function(_0x307756,_0x394b98){return _0x307756[_0xd45c('0xa')](_0xd45c('0xb'),attributes,{'tableName':_0xd45c('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xd45c('0xd'),'fields':[_0xd45c('0xe'),'ListId']},{'unique':!![],'name':_0xd45c('0xf'),'fields':[_0xd45c('0xe'),'ChatWebsiteId']},{'unique':!![],'name':_0xd45c('0x10'),'fields':[_0xd45c('0xe'),'MailAccountId']},{'unique':!![],'name':_0xd45c('0x11'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xd45c('0x12'),'fields':[_0xd45c('0xe'),_0xd45c('0x13')]},{'unique':!![],'name':_0xd45c('0x14'),'fields':[_0xd45c('0xe'),_0xd45c('0x15')]},{'unique':!![],'name':_0xd45c('0x16'),'fields':['name',_0xd45c('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x287a=['./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2324bf,_0x4eb2e3){var _0x85ccff=function(_0x5a6b7a){while(--_0x5a6b7a){_0x2324bf['push'](_0x2324bf['shift']());}};_0x85ccff(++_0x4eb2e3);}(_0x287a,0xc8));var _0xa287=function(_0x1f05c9,_0x280580){_0x1f05c9=_0x1f05c9-0x0;var _0x17d61e=_0x287a[_0x1f05c9];return _0x17d61e;};'use strict';var _=require('lodash');var util=require(_0xa287('0x0'));var logger=require(_0xa287('0x1'))(_0xa287('0x2'));var moment=require('moment');var BPromise=require(_0xa287('0x3'));var rp=require(_0xa287('0x4'));var fs=require('fs');var path=require(_0xa287('0x5'));var rimraf=require(_0xa287('0x6'));var config=require(_0xa287('0x7'));var attributes=require(_0xa287('0x8'));module[_0xa287('0x9')]=function(_0x5d3cf2,_0x334340){return _0x5d3cf2[_0xa287('0xa')](_0xa287('0xb'),attributes,{'tableName':_0xa287('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa287('0xd'),'fields':[_0xa287('0xe'),_0xa287('0xf')]},{'unique':!![],'name':_0xa287('0x10'),'fields':['name',_0xa287('0x11')]},{'unique':!![],'name':_0xa287('0x12'),'fields':[_0xa287('0xe'),_0xa287('0x13')]},{'unique':!![],'name':_0xa287('0x14'),'fields':[_0xa287('0xe'),'SmsAccountId']},{'unique':!![],'name':_0xa287('0x15'),'fields':[_0xa287('0xe'),_0xa287('0x16')]},{'unique':!![],'name':_0xa287('0x17'),'fields':[_0xa287('0xe'),_0xa287('0x18')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xa287('0xe'),_0xa287('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a200d67..fdcfffc 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(_0x132487,_0x100c1d){var _0x13c79b=function(_0x103cb7){while(--_0x103cb7){_0x132487['push'](_0x132487['shift']());}};_0x13c79b(++_0x100c1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x14c646,_0x34d081){var _0x1cdd24=function(_0x59626d){while(--_0x59626d){_0x14c646['push'](_0x14c646['shift']());}};_0x1cdd24(++_0x34d081);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 a006b23..80eb0b8 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 _0xf102=['update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x1b4cdf,_0xb74587){var _0x53c9da=function(_0x497f1c){while(--_0x497f1c){_0x1b4cdf['push'](_0x1b4cdf['shift']());}};_0x53c9da(++_0xb74587);}(_0xf102,0x6a));var _0x2f10=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xf102[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x2f10('0x0'));var util=require(_0x2f10('0x1'));var path=require(_0x2f10('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f10('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2f10('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2f10('0x5'));var controller=require(_0x2f10('0x6'));router[_0x2f10('0x7')]('/',auth[_0x2f10('0x8')](),controller[_0x2f10('0x9')]);router['get'](_0x2f10('0xa'),auth[_0x2f10('0x8')](),controller[_0x2f10('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2f10('0xc')]);router['put'](_0x2f10('0xa'),auth['isAuthenticated'](),controller[_0x2f10('0xd')]);router[_0x2f10('0xe')]('/:id',auth[_0x2f10('0x8')](),controller[_0x2f10('0xf')]);module[_0x2f10('0x10')]=router; \ No newline at end of file +var _0x3343=['../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x3343,0x1aa));var _0x3334=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x3343[_0x296809];return _0x18c0d3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3334('0x0'));var timeout=require(_0x3334('0x1'));var express=require(_0x3334('0x2'));var router=express[_0x3334('0x3')]();var fs_extra=require(_0x3334('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3334('0x5'));var config=require(_0x3334('0x6'));var controller=require('./disposition.controller');router[_0x3334('0x7')]('/',auth[_0x3334('0x8')](),controller[_0x3334('0x9')]);router[_0x3334('0x7')](_0x3334('0xa'),auth[_0x3334('0x8')](),controller['show']);router[_0x3334('0xb')]('/',auth[_0x3334('0x8')](),controller[_0x3334('0xc')]);router[_0x3334('0xd')](_0x3334('0xa'),auth['isAuthenticated'](),controller[_0x3334('0xe')]);router['delete'](_0x3334('0xa'),auth[_0x3334('0x8')](),controller[_0x3334('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index b659fbb..90fb157 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 _0x8cad=['mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x225ab4,_0x563dfa){var _0x4be9b8=function(_0x2cae99){while(--_0x2cae99){_0x225ab4['push'](_0x225ab4['shift']());}};_0x4be9b8(++_0x563dfa);}(_0x8cad,0xfe));var _0xd8ca=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x8cad[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0xd8ca('0x0'));module[_0xd8ca('0x1')]={'name':{'type':Sequelize[_0xd8ca('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd8ca('0x2')]},'ecm':{'type':Sequelize[_0xd8ca('0x3')](_0xd8ca('0x4'),'no'),'defaultValue':_0xd8ca('0x4')},'headerinfo':{'type':Sequelize[_0xd8ca('0x2')],'defaultValue':_0xd8ca('0x5')},'localstationid':{'type':Sequelize[_0xd8ca('0x2')],'unique':_0xd8ca('0x6')},'minrate':{'type':Sequelize[_0xd8ca('0x3')](_0xd8ca('0x7'),_0xd8ca('0x8'),'7200',_0xd8ca('0x9'),_0xd8ca('0xa'),_0xd8ca('0xb')),'defaultValue':_0xd8ca('0x8')},'maxrate':{'type':Sequelize[_0xd8ca('0x3')]('2400',_0xd8ca('0x8'),'7200',_0xd8ca('0x9'),_0xd8ca('0xa'),_0xd8ca('0xb')),'defaultValue':_0xd8ca('0xb')},'modem':{'type':Sequelize[_0xd8ca('0x2')],'defaultValue':_0xd8ca('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd8ca('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd8ca('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd8ca('0x3')](_0xd8ca('0xe'),_0xd8ca('0xf'),_0xd8ca('0x10'),_0xd8ca('0x11')),'defaultValue':_0xd8ca('0xe')},'key':{'type':Sequelize[_0xd8ca('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd8ca('0x12');}},'notificationSound':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd8ca('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd8ca('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd8ca('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd8ca('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd8ca('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':![],'comment':_0xd8ca('0x14'),'set':function(_0x2caa1b){if(!_0x2caa1b)this[_0xd8ca('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xd8ca('0x16'),_0x2caa1b);}}}; \ No newline at end of file +var _0xcde7=['v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','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','STRING','ENUM','localstationid','2400','4800','7200','12000','9600','14400'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xcde7,0x65));var _0x7cde=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xcde7[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7cde('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7cde('0x0')]},'ecm':{'type':Sequelize[_0x7cde('0x1')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x7cde('0x0')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x7cde('0x0')],'unique':_0x7cde('0x2')},'minrate':{'type':Sequelize[_0x7cde('0x1')](_0x7cde('0x3'),_0x7cde('0x4'),_0x7cde('0x5'),'9600',_0x7cde('0x6'),'14400'),'defaultValue':_0x7cde('0x4')},'maxrate':{'type':Sequelize[_0x7cde('0x1')](_0x7cde('0x3'),_0x7cde('0x4'),'7200',_0x7cde('0x7'),_0x7cde('0x6'),_0x7cde('0x8')),'defaultValue':_0x7cde('0x8')},'modem':{'type':Sequelize[_0x7cde('0x0')],'defaultValue':_0x7cde('0x9')},'gateway':{'type':Sequelize[_0x7cde('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7cde('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7cde('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7cde('0x1')]('SIP',_0x7cde('0xb'),_0x7cde('0xc'),_0x7cde('0xd')),'defaultValue':_0x7cde('0xe')},'key':{'type':Sequelize[_0x7cde('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7cde('0xf')],'defaultValue':function(){return _0x7cde('0x10');}},'notificationSound':{'type':Sequelize[_0x7cde('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7cde('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7cde('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7cde('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7cde('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7cde('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7cde('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7cde('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0x7cde('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x7cde('0x11')],'defaultValue':![],'comment':_0x7cde('0x13'),'set':function(_0x1d8924){if(!_0x1d8924)this[_0x7cde('0x14')](_0x7cde('0x15'),null);this[_0x7cde('0x14')]('mandatoryDisposition',_0x1d8924);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index b45ffb7..8afab32 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 _0x3b91=['count','offset','Content-Range','apply','reject','update','then','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','params','Disposition','getDispositions','findOne','limit','order','pick','filter','removeDispositions','ids','addAnswer','FaxAccountId','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','finally','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','priority','appdata','Answer','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','minrate','modem','FAXOPT(','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','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined'];(function(_0xb5604f,_0x7f1691){var _0x2486c6=function(_0x1d578d){while(--_0x1d578d){_0xb5604f['push'](_0xb5604f['shift']());}};_0x2486c6(++_0x7f1691);}(_0x3b91,0x15c));var _0x13b9=function(_0x37365a,_0x526806){_0x37365a=_0x37365a-0x0;var _0x19591a=_0x3b91[_0x37365a];return _0x19591a;};'use strict';var emlformat=require(_0x13b9('0x0'));var rimraf=require(_0x13b9('0x1'));var zipdir=require(_0x13b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13b9('0x3'));var moment=require(_0x13b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x13b9('0x5'));var util=require('util');var path=require(_0x13b9('0x6'));var sox=require(_0x13b9('0x7'));var csv=require(_0x13b9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13b9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13b9('0xa'));var jsforce=require(_0x13b9('0xb'));var deskjs=require(_0x13b9('0xc'));var toCsv=require(_0x13b9('0x8'));var querystring=require(_0x13b9('0xd'));var Papa=require('papaparse');var Redis=require(_0x13b9('0xe'));var authService=require(_0x13b9('0xf'));var qs=require(_0x13b9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x13b9('0x11'))(_0x13b9('0x12'));var utils=require(_0x13b9('0x13'));var config=require(_0x13b9('0x14'));var licenseUtil=require(_0x13b9('0x15'));var db=require('../../mysqldb')['db'];config[_0x13b9('0x16')]=_[_0x13b9('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x13b9('0x18'))(new Redis(config[_0x13b9('0x16')]));require(_0x13b9('0x19'))[_0x13b9('0x1a')](socket);var jayson=require(_0x13b9('0x1b'));var client=jayson[_0x13b9('0x1c')][_0x13b9('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x13b9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2072f9,_0x448ee5,_0x144bc4,_0x2d7f5e){return new BPromise(function(_0x4dd630,_0x5832f0){var _0xad8ace=_0x2d7f5e||client;return _0xad8ace[_0x13b9('0x1e')](_0x2072f9,_0x144bc4)['then'](function(_0x4cd991){logger[_0x13b9('0x1f')](_0x13b9('0x20'),_0x448ee5,_0x13b9('0x21'));logger['debug'](_0x13b9('0x22'),_0x448ee5,_0x13b9('0x21'),JSON[_0x13b9('0x23')](_0x4cd991));if(_0x4cd991['error']){if(_0x4cd991[_0x13b9('0x24')][_0x13b9('0x25')]===0x1f4){logger['error'](_0x13b9('0x20'),_0x448ee5,_0x4cd991[_0x13b9('0x24')][_0x13b9('0x26')]);return _0x5832f0(_0x4cd991[_0x13b9('0x24')][_0x13b9('0x26')]);}logger[_0x13b9('0x24')](_0x13b9('0x20'),_0x448ee5,_0x4cd991[_0x13b9('0x24')][_0x13b9('0x26')]);return _0x4dd630(_0x4cd991[_0x13b9('0x24')][_0x13b9('0x26')]);}else{logger[_0x13b9('0x1f')](_0x13b9('0x20'),_0x448ee5,_0x13b9('0x21'));_0x4dd630(_0x4cd991[_0x13b9('0x27')]['message']);}})[_0x13b9('0x28')](function(_0x251a39){logger[_0x13b9('0x24')](_0x13b9('0x20'),_0x448ee5,_0x251a39);_0x5832f0(_0x251a39);});});}function respondWithStatusCode(_0x2fba13,_0x148210){_0x148210=_0x148210||0xcc;return function(_0x33bbc9){if(_0x33bbc9){return _0x2fba13[_0x13b9('0x29')](_0x148210);}return _0x2fba13[_0x13b9('0x2a')](_0x148210)[_0x13b9('0x2b')]();};}function respondWithResult(_0x5b78f3,_0xeb5d28){_0xeb5d28=_0xeb5d28||0xc8;return function(_0x31dd41){if(_0x31dd41){return _0x5b78f3['status'](_0xeb5d28)[_0x13b9('0x2c')](_0x31dd41);}};}function respondWithFilteredResult(_0x58aa9e,_0x17eccd){return function(_0x19c5fc){if(_0x19c5fc){var _0x2915b6=typeof _0x17eccd['offset']==='undefined'&&typeof _0x17eccd['limit']===_0x13b9('0x2d');var _0x248e5e=_0x19c5fc[_0x13b9('0x2e')];var _0x32641c=_0x2915b6?0x0:_0x17eccd['offset'];var _0x62ac57=_0x2915b6?_0x19c5fc[_0x13b9('0x2e')]:_0x17eccd[_0x13b9('0x2f')]+_0x17eccd['limit'];var _0xd55dbc;if(_0x62ac57>=_0x248e5e){_0x62ac57=_0x248e5e;_0xd55dbc=0xc8;}else{_0xd55dbc=0xce;}_0x58aa9e['status'](_0xd55dbc);return _0x58aa9e['set'](_0x13b9('0x30'),_0x32641c+'-'+_0x62ac57+'/'+_0x248e5e)[_0x13b9('0x2c')](_0x19c5fc);}return null;};}function patchUpdates(_0x4fcea2){return function(_0x42e844){try{jsonpatch[_0x13b9('0x31')](_0x42e844,_0x4fcea2,!![]);}catch(_0x2a26c6){return BPromise[_0x13b9('0x32')](_0x2a26c6);}return _0x42e844['save']();};}function saveUpdates(_0x54009f,_0x3d3b5e){return function(_0x270cff){if(_0x270cff){return _0x270cff[_0x13b9('0x33')](_0x54009f)[_0x13b9('0x34')](function(_0x1e8923){return _0x1e8923;});}return null;};}function removeEntity(_0x12fa0b,_0x391867){return function(_0x503fbf){if(_0x503fbf){return _0x503fbf['destroy']()[_0x13b9('0x34')](function(){var _0xe2218=_0x503fbf[_0x13b9('0x35')]({'plain':!![]});var _0x3dc194=_0x13b9('0x36');return db[_0x13b9('0x37')]['destroy']({'where':{'type':_0x3dc194,'resourceId':_0xe2218['id']}})['then'](function(){return _0x503fbf;});})['then'](function(){_0x12fa0b[_0x13b9('0x2a')](0xcc)[_0x13b9('0x2b')]();});}};}function handleEntityNotFound(_0x3e4800,_0x5ae985){return function(_0xfb7b25){if(!_0xfb7b25){_0x3e4800[_0x13b9('0x29')](0x194);}return _0xfb7b25;};}function handleError(_0x14baae,_0x294aed){_0x294aed=_0x294aed||0x1f4;return function(_0x1251b0){logger['error'](_0x1251b0[_0x13b9('0x38')]);if(_0x1251b0[_0x13b9('0x39')]){delete _0x1251b0[_0x13b9('0x39')];}_0x14baae[_0x13b9('0x2a')](_0x294aed)[_0x13b9('0x3a')](_0x1251b0);};}exports['index']=function(_0x28e5d2,_0x372c3f){var _0x18a625={'include':[{'model':db[_0x13b9('0x3b')],'as':_0x13b9('0x3c')}]},_0x36801f={},_0xf9ccb3={'count':0x0,'rows':[]};var _0x8c4243=_[_0x13b9('0x3d')](db[_0x13b9('0x3e')][_0x13b9('0x3f')],function(_0xf2597f){return{'name':_0xf2597f[_0x13b9('0x40')],'type':_0xf2597f[_0x13b9('0x41')]['key']};});_0x36801f[_0x13b9('0x42')]=_[_0x13b9('0x3d')](_0x8c4243,_0x13b9('0x39'));_0x36801f[_0x13b9('0x43')]=_[_0x13b9('0x44')](_0x28e5d2[_0x13b9('0x43')]);_0x36801f['filters']=_[_0x13b9('0x45')](_0x36801f[_0x13b9('0x42')],_0x36801f['query']);_0x18a625[_0x13b9('0x46')]=_['intersection'](_0x36801f[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x28e5d2['query'][_0x13b9('0x47')]));_0x18a625[_0x13b9('0x46')]=_0x18a625[_0x13b9('0x46')][_0x13b9('0x48')]?_0x18a625[_0x13b9('0x46')]:_0x36801f[_0x13b9('0x42')];if(!_0x28e5d2[_0x13b9('0x43')][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x18a625['limit']=qs['limit'](_0x28e5d2[_0x13b9('0x43')]['limit']);_0x18a625[_0x13b9('0x2f')]=qs[_0x13b9('0x2f')](_0x28e5d2[_0x13b9('0x43')]['offset']);}_0x18a625['order']=qs[_0x13b9('0x4b')](_0x28e5d2[_0x13b9('0x43')]['sort']);_0x18a625[_0x13b9('0x4c')]=qs[_0x13b9('0x4d')](_['pick'](_0x28e5d2[_0x13b9('0x43')],_0x36801f[_0x13b9('0x4d')]),_0x8c4243);if(_0x28e5d2[_0x13b9('0x43')]['filter']){_0x18a625[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x18a625[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x8c4243,function(_0x1637a0){if(_0x1637a0[_0x13b9('0x41')]!==_0x13b9('0x4f')){var _0x5a1648={};_0x5a1648[_0x1637a0[_0x13b9('0x39')]]={'$like':'%'+_0x28e5d2[_0x13b9('0x43')]['filter']+'%'};return _0x5a1648;}})});}_0x18a625=_['merge']({},_0x18a625,_0x28e5d2[_0x13b9('0x50')]);var _0x1057a2={'where':_0x18a625[_0x13b9('0x4c')]};return db[_0x13b9('0x3e')]['count'](_0x1057a2)[_0x13b9('0x34')](function(_0x1464dd){_0xf9ccb3[_0x13b9('0x2e')]=_0x1464dd;if(_0x28e5d2[_0x13b9('0x43')][_0x13b9('0x51')]){_0x18a625[_0x13b9('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0x13b9('0x53')](_0x18a625);})[_0x13b9('0x34')](function(_0xca3f86){_0xf9ccb3[_0x13b9('0x54')]=_0xca3f86;return _0xf9ccb3;})[_0x13b9('0x34')](respondWithFilteredResult(_0x372c3f,_0x18a625))[_0x13b9('0x28')](handleError(_0x372c3f,null));};exports[_0x13b9('0x55')]=function(_0x33c194,_0x4587fb){var _0x7af939={'raw':![],'where':{'id':_0x33c194['params']['id']},'include':[{'model':db[_0x13b9('0x3b')],'as':_0x13b9('0x3c')}]},_0x3b46d3={};_0x3b46d3[_0x13b9('0x42')]=_[_0x13b9('0x44')](db[_0x13b9('0x3e')]['rawAttributes']);_0x3b46d3['query']=_[_0x13b9('0x44')](_0x33c194[_0x13b9('0x43')]);_0x3b46d3[_0x13b9('0x4d')]=_[_0x13b9('0x45')](_0x3b46d3[_0x13b9('0x42')],_0x3b46d3[_0x13b9('0x43')]);_0x7af939[_0x13b9('0x46')]=_[_0x13b9('0x45')](_0x3b46d3[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x33c194[_0x13b9('0x43')]['fields']));_0x7af939[_0x13b9('0x46')]=_0x7af939['attributes'][_0x13b9('0x48')]?_0x7af939[_0x13b9('0x46')]:_0x3b46d3[_0x13b9('0x42')];if(_0x33c194[_0x13b9('0x43')][_0x13b9('0x51')]){_0x7af939[_0x13b9('0x52')]=[{'all':!![]}];}_0x7af939=_[_0x13b9('0x4e')]({},_0x7af939,_0x33c194[_0x13b9('0x50')]);return db['FaxAccount'][_0x13b9('0x56')](_0x7af939)['then'](handleEntityNotFound(_0x4587fb,null))[_0x13b9('0x34')](respondWithResult(_0x4587fb,null))[_0x13b9('0x28')](handleError(_0x4587fb,null));};exports[_0x13b9('0x57')]=function(_0x4c2187,_0x22abd2){return db['FaxAccount'][_0x13b9('0x57')](_0x4c2187[_0x13b9('0x58')],{})[_0x13b9('0x34')](function(_0x1bb951){var _0x3207eb=_0x4c2187['user'][_0x13b9('0x35')]({'plain':!![]});if(!_0x3207eb)throw new Error(_0x13b9('0x59'));if(_0x3207eb[_0x13b9('0x5a')]===_0x13b9('0x5b')){var _0x153bae=_0x1bb951['get']({'plain':!![]});var _0x299d24='FaxAccounts';return db['UserProfileSection'][_0x13b9('0x56')]({'where':{'name':_0x299d24,'userProfileId':_0x3207eb['userProfileId']},'raw':!![]})[_0x13b9('0x34')](function(_0x1e4059){if(_0x1e4059&&_0x1e4059[_0x13b9('0x5c')]===0x0){return db['UserProfileResource'][_0x13b9('0x57')]({'name':_0x153bae[_0x13b9('0x39')],'resourceId':_0x153bae['id'],'type':_0x1e4059[_0x13b9('0x39')],'sectionId':_0x1e4059['id']},{})[_0x13b9('0x34')](function(){return _0x1bb951;});}else{return _0x1bb951;}})[_0x13b9('0x28')](function(_0xa2b14c){logger['error'](_0x13b9('0x5d'),_0xa2b14c);throw _0xa2b14c;});}return _0x1bb951;})[_0x13b9('0x34')](respondWithResult(_0x22abd2,0xc9))['catch'](handleError(_0x22abd2,null));};exports[_0x13b9('0x33')]=function(_0x40b5dd,_0x40a948){if(_0x40b5dd['body']['id']){delete _0x40b5dd[_0x13b9('0x58')]['id'];}return db[_0x13b9('0x3e')][_0x13b9('0x56')]({'where':{'id':_0x40b5dd['params']['id']},'include':[{'model':db[_0x13b9('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x13b9('0x34')](handleEntityNotFound(_0x40a948,null))['then'](saveUpdates(_0x40b5dd[_0x13b9('0x58')],null))[_0x13b9('0x34')](respondWithResult(_0x40a948,null))[_0x13b9('0x28')](handleError(_0x40a948,null));};exports[_0x13b9('0x5e')]=function(_0x154ec7,_0x4edf84){return db[_0x13b9('0x3e')][_0x13b9('0x56')]({'where':{'id':_0x154ec7['params']['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x4edf84,null))[_0x13b9('0x34')](removeEntity(_0x4edf84,null))[_0x13b9('0x28')](handleError(_0x4edf84,null));};exports[_0x13b9('0x5f')]=function(_0x3de753,_0x524c52){return db[_0x13b9('0x3e')][_0x13b9('0x5f')]()[_0x13b9('0x34')](respondWithResult(_0x524c52,null))[_0x13b9('0x28')](handleError(_0x524c52,null));};exports[_0x13b9('0x60')]=function(_0x44af05,_0xa73efd,_0x5d9025){if(_0x44af05[_0x13b9('0x58')]['id']){delete _0x44af05['body']['id'];}return db['FaxAccount'][_0x13b9('0x56')]({'where':{'id':_0x44af05[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0xa73efd,null))[_0x13b9('0x34')](function(_0x54796d){if(_0x54796d){_0x44af05[_0x13b9('0x58')]['FaxAccountId']=_0x54796d['id'];return db[_0x13b9('0x62')][_0x13b9('0x57')](_0x44af05[_0x13b9('0x58')]);}})['then'](respondWithResult(_0xa73efd,null))[_0x13b9('0x28')](handleError(_0xa73efd,null));};exports[_0x13b9('0x63')]=function(_0x288cd9,_0x5246cc,_0xb39a60){var _0x230d97={'raw':![],'where':{}};var _0x2bc099={};var _0x30c5aa={'count':0x0,'rows':[]};return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x288cd9[_0x13b9('0x61')]['id']}})['then'](handleEntityNotFound(_0x5246cc,null))[_0x13b9('0x34')](function(_0x4051d1){if(_0x4051d1){_0x2bc099[_0x13b9('0x42')]=_[_0x13b9('0x44')](db['Disposition']['rawAttributes']);_0x2bc099['query']=_[_0x13b9('0x44')](_0x288cd9[_0x13b9('0x43')]);_0x2bc099[_0x13b9('0x4d')]=_['intersection'](_0x2bc099['model'],_0x2bc099[_0x13b9('0x43')]);_0x230d97['attributes']=_[_0x13b9('0x45')](_0x2bc099[_0x13b9('0x42')],qs['fields'](_0x288cd9['query'][_0x13b9('0x47')]));_0x230d97['attributes']=_0x230d97[_0x13b9('0x46')][_0x13b9('0x48')]?_0x230d97['attributes']:_0x2bc099[_0x13b9('0x42')];if(!_0x288cd9['query'][_0x13b9('0x49')]('nolimit')){_0x230d97[_0x13b9('0x65')]=qs[_0x13b9('0x65')](_0x288cd9[_0x13b9('0x43')][_0x13b9('0x65')]);_0x230d97[_0x13b9('0x2f')]=qs[_0x13b9('0x2f')](_0x288cd9['query'][_0x13b9('0x2f')]);}_0x230d97[_0x13b9('0x66')]=qs['sort'](_0x288cd9['query']['sort']);_0x230d97[_0x13b9('0x4c')]=qs[_0x13b9('0x4d')](_[_0x13b9('0x67')](_0x288cd9[_0x13b9('0x43')],_0x2bc099[_0x13b9('0x4d')]));_0x230d97[_0x13b9('0x4c')]['FaxAccountId']=_0x4051d1['id'];if(_0x288cd9[_0x13b9('0x43')][_0x13b9('0x68')]){_0x230d97[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x230d97[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x230d97['attributes'],function(_0x572d89){var _0x27da23={};_0x27da23[_0x572d89]={'$like':'%'+_0x288cd9[_0x13b9('0x43')][_0x13b9('0x68')]+'%'};return _0x27da23;})});}_0x230d97=_[_0x13b9('0x4e')]({},_0x230d97,_0x288cd9['options']);return db[_0x13b9('0x62')][_0x13b9('0x2e')]({'where':_0x230d97['where']})['then'](function(_0x149d89){_0x30c5aa[_0x13b9('0x2e')]=_0x149d89;if(_0x288cd9['query'][_0x13b9('0x51')]){_0x230d97[_0x13b9('0x52')]=[{'all':!![]}];}return db[_0x13b9('0x62')][_0x13b9('0x53')](_0x230d97);})[_0x13b9('0x34')](function(_0x5b8878){_0x30c5aa['rows']=_0x5b8878;return _0x30c5aa;});}})[_0x13b9('0x34')](respondWithFilteredResult(_0x5246cc,_0x230d97))[_0x13b9('0x28')](handleError(_0x5246cc,null));};exports[_0x13b9('0x69')]=function(_0x4832e8,_0x3f7e9b,_0x42174e){return db[_0x13b9('0x3e')][_0x13b9('0x56')]({'where':{'id':_0x4832e8[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x3f7e9b,null))['then'](function(_0x5d12eb){if(_0x5d12eb){return _0x5d12eb[_0x13b9('0x69')](_0x4832e8[_0x13b9('0x43')][_0x13b9('0x6a')]);}})['then'](respondWithStatusCode(_0x3f7e9b,null))[_0x13b9('0x28')](handleError(_0x3f7e9b,null));};exports[_0x13b9('0x6b')]=function(_0x5379e0,_0x1815c8,_0xe22d5f){if(_0x5379e0[_0x13b9('0x58')]['id']){delete _0x5379e0[_0x13b9('0x58')]['id'];}return db[_0x13b9('0x3e')]['find']({'where':{'id':_0x5379e0[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x1815c8,null))[_0x13b9('0x34')](function(_0x2146c7){if(_0x2146c7){_0x5379e0[_0x13b9('0x58')][_0x13b9('0x6c')]=_0x2146c7['id'];return db[_0x13b9('0x6d')][_0x13b9('0x57')](_0x5379e0[_0x13b9('0x58')]);}})[_0x13b9('0x34')](respondWithResult(_0x1815c8,null))['catch'](handleError(_0x1815c8,null));};exports[_0x13b9('0x6e')]=function(_0x1ce1a8,_0x14904f,_0x38f4d4){var _0xffdf9b={'raw':![],'where':{}};var _0x3af299={};var _0x322f2d={'count':0x0,'rows':[]};return db[_0x13b9('0x3e')]['findOne']({'where':{'id':_0x1ce1a8[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x14904f,null))['then'](function(_0x1a1c86){if(_0x1a1c86){_0x3af299[_0x13b9('0x42')]=_[_0x13b9('0x44')](db['CannedAnswer'][_0x13b9('0x3f')]);_0x3af299['query']=_[_0x13b9('0x44')](_0x1ce1a8['query']);_0x3af299['filters']=_['intersection'](_0x3af299['model'],_0x3af299[_0x13b9('0x43')]);_0xffdf9b['attributes']=_[_0x13b9('0x45')](_0x3af299[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x1ce1a8[_0x13b9('0x43')][_0x13b9('0x47')]));_0xffdf9b['attributes']=_0xffdf9b[_0x13b9('0x46')]['length']?_0xffdf9b[_0x13b9('0x46')]:_0x3af299[_0x13b9('0x42')];if(!_0x1ce1a8[_0x13b9('0x43')]['hasOwnProperty'](_0x13b9('0x4a'))){_0xffdf9b[_0x13b9('0x65')]=qs[_0x13b9('0x65')](_0x1ce1a8[_0x13b9('0x43')]['limit']);_0xffdf9b['offset']=qs[_0x13b9('0x2f')](_0x1ce1a8[_0x13b9('0x43')][_0x13b9('0x2f')]);}_0xffdf9b[_0x13b9('0x66')]=qs[_0x13b9('0x4b')](_0x1ce1a8[_0x13b9('0x43')][_0x13b9('0x4b')]);_0xffdf9b[_0x13b9('0x4c')]=qs['filters'](_[_0x13b9('0x67')](_0x1ce1a8['query'],_0x3af299[_0x13b9('0x4d')]));_0xffdf9b['where'][_0x13b9('0x6c')]=_0x1a1c86['id'];if(_0x1ce1a8[_0x13b9('0x43')]['filter']){_0xffdf9b[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0xffdf9b[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0xffdf9b[_0x13b9('0x46')],function(_0x33426b){var _0x112113={};_0x112113[_0x33426b]={'$like':'%'+_0x1ce1a8['query'][_0x13b9('0x68')]+'%'};return _0x112113;})});}_0xffdf9b=_[_0x13b9('0x4e')]({},_0xffdf9b,_0x1ce1a8[_0x13b9('0x50')]);return db[_0x13b9('0x6d')][_0x13b9('0x2e')]({'where':_0xffdf9b[_0x13b9('0x4c')]})[_0x13b9('0x34')](function(_0x5748f4){_0x322f2d[_0x13b9('0x2e')]=_0x5748f4;if(_0x1ce1a8[_0x13b9('0x43')][_0x13b9('0x51')]){_0xffdf9b['include']=[{'all':!![]}];}return db[_0x13b9('0x6d')][_0x13b9('0x53')](_0xffdf9b);})[_0x13b9('0x34')](function(_0x535fd7){_0x322f2d[_0x13b9('0x54')]=_0x535fd7;return _0x322f2d;});}})[_0x13b9('0x34')](respondWithFilteredResult(_0x14904f,_0xffdf9b))[_0x13b9('0x28')](handleError(_0x14904f,null));};exports[_0x13b9('0x6f')]=function(_0x56219e,_0xd5dca8,_0x229829){return db['FaxAccount'][_0x13b9('0x56')]({'where':{'id':_0x56219e[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0xd5dca8,null))[_0x13b9('0x34')](function(_0x4da9ad){if(_0x4da9ad){return _0x4da9ad[_0x13b9('0x6f')](_0x56219e[_0x13b9('0x43')]['ids']);}})['then'](respondWithStatusCode(_0xd5dca8,null))['catch'](handleError(_0xd5dca8,null));};exports[_0x13b9('0x70')]=function(_0x1a6bff,_0x49e3fe,_0x101954){return db[_0x13b9('0x71')][_0x13b9('0x56')]({'where':{'id':_0x1a6bff['params']['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x49e3fe,null))[_0x13b9('0x34')](function(_0x55e3e7){if(_0x55e3e7){return _0x55e3e7['addInteraction'](_0x1a6bff[_0x13b9('0x58')][_0x13b9('0x6a')],_[_0x13b9('0x72')](_0x1a6bff[_0x13b9('0x58')],[_0x13b9('0x6a'),'id'])||{});}})[_0x13b9('0x34')](respondWithResult(_0x49e3fe,null))[_0x13b9('0x28')](handleError(_0x49e3fe,null));};exports[_0x13b9('0x73')]=function(_0x1c63e9,_0x5d1c5c,_0x4173db){var _0x588c8d={'raw':![],'where':{}};var _0x29aeff={};var _0x3d6bb1={'count':0x0,'rows':[]};return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x1c63e9[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x5d1c5c,null))[_0x13b9('0x34')](function(_0x49765f){if(_0x49765f){_0x29aeff[_0x13b9('0x42')]=_[_0x13b9('0x44')](db[_0x13b9('0x71')]['rawAttributes']);_0x29aeff[_0x13b9('0x43')]=_['keys'](_0x1c63e9[_0x13b9('0x43')]);_0x29aeff[_0x13b9('0x4d')]=_[_0x13b9('0x45')](_0x29aeff[_0x13b9('0x42')],_0x29aeff[_0x13b9('0x43')]);_0x588c8d[_0x13b9('0x46')]=_[_0x13b9('0x45')](_0x29aeff[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x47')]));_0x588c8d[_0x13b9('0x46')]=_0x588c8d[_0x13b9('0x46')][_0x13b9('0x48')]?_0x588c8d[_0x13b9('0x46')]:_0x29aeff['model'];if(!_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x588c8d['limit']=qs['limit'](_0x1c63e9['query'][_0x13b9('0x65')]);_0x588c8d['offset']=qs[_0x13b9('0x2f')](_0x1c63e9['query'][_0x13b9('0x2f')]);}_0x588c8d[_0x13b9('0x66')]=qs[_0x13b9('0x4b')](_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x4b')]);_0x588c8d[_0x13b9('0x4c')]=qs[_0x13b9('0x4d')](_['pick'](_0x1c63e9[_0x13b9('0x43')],_0x29aeff[_0x13b9('0x4d')]));_0x588c8d[_0x13b9('0x4c')][_0x13b9('0x6c')]=_0x49765f['id'];if(_0x1c63e9[_0x13b9('0x43')]['filter']){_0x588c8d[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x588c8d[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x588c8d[_0x13b9('0x46')],function(_0x1df2c1){var _0x5dd55a={};_0x5dd55a[_0x1df2c1]={'$like':'%'+_0x1c63e9[_0x13b9('0x43')]['filter']+'%'};return _0x5dd55a;})});}_0x588c8d=_[_0x13b9('0x4e')]({},_0x588c8d,_0x1c63e9[_0x13b9('0x50')]);return db[_0x13b9('0x71')][_0x13b9('0x2e')]({'where':_0x588c8d[_0x13b9('0x4c')]})[_0x13b9('0x34')](function(_0x37eb27){_0x3d6bb1[_0x13b9('0x2e')]=_0x37eb27;if(_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x51')]){_0x588c8d[_0x13b9('0x52')]=[{'model':db[_0x13b9('0x74')],'as':_0x13b9('0x75'),'required':![]},{'model':db[_0x13b9('0x76')],'as':_0x13b9('0x77'),'attributes':[_0x13b9('0x39'),_0x13b9('0x78'),'internal'],'required':![]},{'model':db[_0x13b9('0x79')],'as':_0x13b9('0x7a'),'attributes':['id',_0x13b9('0x39'),_0x13b9('0x7b')],'where':_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x7c')]?{'id':_0x1c63e9['query'][_0x13b9('0x7c')]}:undefined,'required':_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x7c')]?!![]:![]}];}return db[_0x13b9('0x71')]['findAll'](_0x588c8d);})['then'](function(_0x5bd179){_0x3d6bb1[_0x13b9('0x54')]=_0x5bd179;return _0x3d6bb1;});}})[_0x13b9('0x34')](respondWithFilteredResult(_0x5d1c5c,_0x588c8d))['catch'](handleError(_0x5d1c5c,null));};exports[_0x13b9('0x7d')]=function(_0x38d0f5,_0x50883e){var _0x2b6973=_0x38d0f5['params']['id'];var _0xdc7ee8=_0x38d0f5[_0x13b9('0x58')];var _0x5d6a19=0xc8;var _0x529e66=null;return db[_0x13b9('0x7e')][_0x13b9('0x7f')]({'isolationLevel':db[_0x13b9('0x7e')][_0x13b9('0x80')][_0x13b9('0x81')]['READ_COMMITTED']},function(_0x1baf41){return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x2b6973},'transaction':_0x1baf41})[_0x13b9('0x34')](function(_0x1ac3f1){if(_0x1ac3f1){return db[_0x13b9('0x82')][_0x13b9('0x5e')]({'where':{'FaxAccountId':_0x2b6973},'transaction':_0x1baf41})[_0x13b9('0x34')](function(){var _0x5a5b48=_[_0x13b9('0x3d')](_0xdc7ee8,function(_0x19a41a){_0x19a41a['FaxAccountId']=_0x2b6973;return _0x19a41a;});return db[_0x13b9('0x82')][_0x13b9('0x83')](_0x5a5b48,{'transaction':_0x1baf41});});}else{_0x5d6a19=0x194;_0x529e66=[];}});})['then'](function(){if(_0x5d6a19!==0x194){return db[_0x13b9('0x82')]['findAndCountAll']({'where':{'FaxAccountId':_0x2b6973},'order':'priority'})['then'](function(_0x1e5ae2){_0x529e66=_0x1e5ae2;});}})[_0x13b9('0x28')](function(_0x4c6a53){_0x5d6a19=0x1f4;logger[_0x13b9('0x24')](_0x4c6a53['stack']);if(_0x4c6a53[_0x13b9('0x39')]){delete _0x4c6a53[_0x13b9('0x39')];}_0x529e66=_0x4c6a53;})[_0x13b9('0x84')](function(){if(_0x529e66===null){_0x50883e['sendStatus'](_0x5d6a19);}else{if(_0x5d6a19===0x1f4){_0x50883e[_0x13b9('0x2a')](_0x5d6a19)[_0x13b9('0x3a')](_0x529e66);}else{_0x50883e['status'](_0x5d6a19)['json'](_0x529e66);}}});};exports[_0x13b9('0x85')]=function(_0x940a7d,_0x3a8c0c,_0xd66049){var _0x20e4e8={};var _0x1bc436={};var _0x35124d;var _0x2ece4a;return db['FaxAccount'][_0x13b9('0x64')]({'where':{'id':_0x940a7d['params']['id']}})['then'](handleEntityNotFound(_0x3a8c0c,null))['then'](function(_0x3df145){if(_0x3df145){_0x35124d=_0x3df145;_0x1bc436[_0x13b9('0x42')]=_[_0x13b9('0x44')](db[_0x13b9('0x82')][_0x13b9('0x3f')]);_0x1bc436['query']=_[_0x13b9('0x44')](_0x940a7d['query']);_0x1bc436['filters']=_[_0x13b9('0x45')](_0x1bc436[_0x13b9('0x42')],_0x1bc436['query']);_0x20e4e8[_0x13b9('0x46')]=_[_0x13b9('0x45')](_0x1bc436['model'],qs['fields'](_0x940a7d['query'][_0x13b9('0x47')]));_0x20e4e8['attributes']=_0x20e4e8['attributes'][_0x13b9('0x48')]?_0x20e4e8[_0x13b9('0x46')]:_0x1bc436['model'];_0x20e4e8['order']=qs[_0x13b9('0x4b')](_0x940a7d[_0x13b9('0x43')][_0x13b9('0x4b')]);_0x20e4e8[_0x13b9('0x4c')]=qs[_0x13b9('0x4d')](_[_0x13b9('0x67')](_0x940a7d[_0x13b9('0x43')],_0x1bc436[_0x13b9('0x4d')]));if(_0x940a7d[_0x13b9('0x43')][_0x13b9('0x68')]){_0x20e4e8[_0x13b9('0x4c')]=_['merge'](_0x20e4e8[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x20e4e8['attributes'],function(_0x3ac2b8){var _0x3d2fe2={};_0x3d2fe2[_0x3ac2b8]={'$like':'%'+_0x940a7d[_0x13b9('0x43')]['filter']+'%'};return _0x3d2fe2;})});}_0x20e4e8=_['merge']({},_0x20e4e8,_0x940a7d['options']);return _0x35124d['getApplications'](_0x20e4e8);}})[_0x13b9('0x34')](function(_0x502fbd){if(_0x502fbd){_0x2ece4a=_0x502fbd['length'];if(!_0x940a7d['query'][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x20e4e8[_0x13b9('0x65')]=qs['limit'](_0x940a7d[_0x13b9('0x43')][_0x13b9('0x65')]);_0x20e4e8['offset']=qs[_0x13b9('0x2f')](_0x940a7d[_0x13b9('0x43')][_0x13b9('0x2f')]);}return _0x35124d[_0x13b9('0x85')](_0x20e4e8);}})[_0x13b9('0x34')](function(_0x204984){if(_0x204984){return _0x204984?{'count':_0x2ece4a,'rows':_0x204984}:null;}})[_0x13b9('0x34')](respondWithResult(_0x3a8c0c,null))['catch'](handleError(_0x3a8c0c,null));};function Extension(_0x2636eb,_0x342d41,_0x36b3f2,_0x5cbe08){this[_0x13b9('0x86')]=_0x13b9('0x87');this[_0x13b9('0x88')]=_0x2636eb[_0x13b9('0x89')];this[_0x13b9('0x8a')]=_0x5cbe08;this['type']='system';this['description']=_0x13b9('0x8b');this['FaxAccountId']=_0x2636eb['id'];this[_0x13b9('0x8c')]=_0x342d41;this[_0x13b9('0x8d')]=_0x36b3f2;}function createExtensionsReciveFax(_0x333c76){var _0x438f28=0x1;var _0x4648be=[];_0x4648be['push'](new Extension(_0x333c76,_0x438f28,'',_0x13b9('0x8e')));_0x438f28+=0x1;_0x4648be[_0x13b9('0x8f')](new Extension(_0x333c76,_0x438f28,_0x13b9('0x90'),'Set'));_0x438f28+=0x1;for(var _0x353ad8 in _0x333c76){if(_0x333c76['hasOwnProperty'](_0x353ad8)&&(_0x353ad8===_0x13b9('0x91')||_0x353ad8===_0x13b9('0x89')||_0x353ad8===_0x13b9('0x92')||_0x353ad8===_0x13b9('0x93')||_0x353ad8===_0x13b9('0x94')||_0x353ad8==='maxrate'||_0x353ad8===_0x13b9('0x95')||_0x353ad8===_0x13b9('0x96')||_0x353ad8==='t38timeout')){_0x4648be[_0x13b9('0x8f')](new Extension(_0x333c76,_0x438f28,_0x13b9('0x97')+_0x353ad8+')='+_0x333c76[_0x353ad8],_0x13b9('0x98')));_0x438f28+=0x1;}}_0x4648be['push'](new Extension(_0x333c76,_0x438f28,'6',_0x13b9('0x99')));_0x438f28+=0x1;_0x4648be[_0x13b9('0x8f')](new Extension(_0x333c76,_0x438f28,_0x13b9('0x9a'),'ReceiveFax'));_0x438f28=0x0;return _0x4648be;}exports[_0x13b9('0x9b')]=function(_0x14eb0d,_0x2ca7ce,_0x3964aa){var _0x3df681;return db[_0x13b9('0x7e')][_0x13b9('0x7f')](function(_0x4b43a){return db[_0x13b9('0x3e')][_0x13b9('0x57')](_0x14eb0d[_0x13b9('0x58')],{'transaction':_0x4b43a})[_0x13b9('0x34')](function(_0xbb6603){_0x3df681=_0xbb6603[_0x13b9('0x35')]({'plain':!![]});return db[_0x13b9('0x9c')][_0x13b9('0x83')](createExtensionsReciveFax(_0x3df681),{'transaction':_0x4b43a});});})[_0x13b9('0x34')](function(){return _0x3df681;})['then'](respondWithResult(_0x2ca7ce,null))['catch'](handleError(_0x2ca7ce,null));};exports[_0x13b9('0x9d')]=function(_0x460d0b,_0x1665c0,_0x3b8b76){var _0x2c9b86;return db[_0x13b9('0x7e')][_0x13b9('0x7f')](function(_0x2f79b2){return db['FaxAccount']['update'](_0x460d0b['body'],{'where':{'id':_0x460d0b[_0x13b9('0x58')]['id']},'transaction':_0x2f79b2})[_0x13b9('0x34')](function(_0x121c00){return db[_0x13b9('0x9c')][_0x13b9('0x5e')]({'where':{'FaxAccountId':_0x460d0b[_0x13b9('0x58')]['id']},'transaction':_0x2f79b2})[_0x13b9('0x34')](function(_0x272304){return db['VoiceExtension'][_0x13b9('0x83')](createExtensionsReciveFax(_['omit'](_0x460d0b[_0x13b9('0x58')],[_0x13b9('0x9e'),_0x13b9('0x9f'),_0x13b9('0xa0'),_0x13b9('0xa1'),_0x13b9('0xa2'),_0x13b9('0xa3')])),{'transaction':_0x2f79b2});});});})[_0x13b9('0x34')](function(){return db['FaxAccount'][_0x13b9('0xa4')](_0x460d0b['body']['id']);})[_0x13b9('0x34')](respondWithResult(_0x1665c0,null))[_0x13b9('0x28')](handleError(_0x1665c0,null));};exports[_0x13b9('0xa5')]=function(_0x504a25,_0x211dbd,_0x7c78c7){var _0x16e983={'raw':!![],'where':{}};var _0x72d7ce={};var _0x2fb9f6={'count':0x0,'rows':[]};return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x504a25[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x211dbd,null))['then'](function(_0x3af69b){if(_0x3af69b){_0x72d7ce[_0x13b9('0x42')]=_[_0x13b9('0x44')](db['FaxMessage']['rawAttributes']);_0x72d7ce[_0x13b9('0x43')]=_['keys'](_0x504a25['query']);_0x72d7ce[_0x13b9('0x4d')]=_['intersection'](_0x72d7ce[_0x13b9('0x42')],_0x72d7ce['query']);_0x16e983[_0x13b9('0x46')]=_['intersection'](_0x72d7ce[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x504a25[_0x13b9('0x43')][_0x13b9('0x47')]));_0x16e983['attributes']=_0x16e983['attributes']['length']?_0x16e983[_0x13b9('0x46')]:_0x72d7ce[_0x13b9('0x42')];if(!_0x504a25[_0x13b9('0x43')][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x16e983[_0x13b9('0x65')]=qs[_0x13b9('0x65')](_0x504a25[_0x13b9('0x43')][_0x13b9('0x65')]);_0x16e983[_0x13b9('0x2f')]=qs[_0x13b9('0x2f')](_0x504a25[_0x13b9('0x43')][_0x13b9('0x2f')]);}_0x16e983[_0x13b9('0x66')]=qs[_0x13b9('0x4b')](_0x504a25[_0x13b9('0x43')][_0x13b9('0x4b')]);_0x16e983[_0x13b9('0x4c')]=qs['filters'](_[_0x13b9('0x67')](_0x504a25[_0x13b9('0x43')],_0x72d7ce['filters']));_0x16e983[_0x13b9('0x4c')][_0x13b9('0x6c')]=_0x3af69b['id'];if(_0x504a25['query'][_0x13b9('0x68')]){_0x16e983[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x16e983[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x16e983['attributes'],function(_0x3e435a){var _0x487361={};_0x487361[_0x3e435a]={'$like':'%'+_0x504a25['query']['filter']+'%'};return _0x487361;})});}if(_0x504a25[_0x13b9('0x43')]['$gte']){var _0x4a87fb=_0x504a25[_0x13b9('0x43')][_0x13b9('0xa6')][_0x13b9('0xa7')](',');var _0x57cae0={};_0x57cae0[_0x4a87fb[0x0]]={'$gte':moment(_0x4a87fb[0x1])[_0x13b9('0xa8')](_0x13b9('0xa9'))};_0x16e983[_0x13b9('0x4c')]=_['merge'](_0x16e983[_0x13b9('0x4c')],_0x57cae0);}_0x16e983=_[_0x13b9('0x4e')]({},_0x16e983,_0x504a25['options']);return db[_0x13b9('0xaa')][_0x13b9('0x2e')]({'where':_0x16e983[_0x13b9('0x4c')]})[_0x13b9('0x34')](function(_0x144196){_0x2fb9f6[_0x13b9('0x2e')]=_0x144196;if(_0x504a25[_0x13b9('0x43')][_0x13b9('0x51')]){_0x16e983[_0x13b9('0x52')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x16e983);})[_0x13b9('0x34')](function(_0x41d9a3){_0x2fb9f6[_0x13b9('0x54')]=_0x41d9a3;return _0x2fb9f6;});}})['then'](respondWithFilteredResult(_0x211dbd,_0x16e983))[_0x13b9('0x28')](handleError(_0x211dbd,null));};exports[_0x13b9('0x3a')]=function(_0x256f8b,_0x4de275,_0x2db827){var _0x1cc1d2,_0x34fc1f={},_0x22fcd7;if(_0x256f8b[_0x13b9('0x58')]['to']){_0x22fcd7=_0x256f8b[_0x13b9('0x58')]['to'][0x0];}return db[_0x13b9('0x3e')]['find']({'where':{'id':_0x256f8b[_0x13b9('0x61')]['id']},'include':[{'model':db[_0x13b9('0xab')],'as':_0x13b9('0xac'),'include':[{'model':db[_0x13b9('0x74')],'as':_0x13b9('0xad'),'where':{'fax':_0x22fcd7},'limit':0x1,'order':[['updatedAt',_0x13b9('0xae')]]}]}]})['then'](handleEntityNotFound(_0x4de275,null))[_0x13b9('0x34')](function(_0x1e9887){_0x1cc1d2=_0x1e9887;if(_0x256f8b[_0x13b9('0x58')]['attachments']&&_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')]['length']){for(var _0x3d0b4c=0x0;_0x3d0b4c<_0x256f8b[_0x13b9('0x58')]['attachments'][_0x13b9('0x48')];_0x3d0b4c+=0x1){_0x256f8b['body'][_0x13b9('0xaf')][_0x3d0b4c]={'filename':_0x256f8b['body']['attachments'][_0x3d0b4c]['name'],'id':_0x256f8b[_0x13b9('0x58')]['attachments'][_0x3d0b4c]['id'],'path':path['join'](config['root'],_0x13b9('0xb0'),_0x256f8b['body'][_0x13b9('0xaf')][_0x3d0b4c][_0x13b9('0xb1')])};}}return respondWithRpcPromise(_0x13b9('0xb2'),_0x13b9('0xb2'),{'FaxAccountId':_[_0x13b9('0xb3')](_0x256f8b[_0x13b9('0x61')]['id'])?undefined:_0x256f8b[_0x13b9('0x61')]['id'],'path':_[_0x13b9('0xb3')](_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0x6')])?undefined:_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0x6')],'fax':_['isNil'](_0x256f8b[_0x13b9('0x58')]['to'][0x0])?undefined:_0x256f8b[_0x13b9('0x58')]['to'][0x0]},client9002);})[_0x13b9('0x34')](function(){if(_0x1cc1d2){if(_['isNil'](_0x256f8b[_0x13b9('0x58')]['from'])){_0x256f8b['body']['from']=util[_0x13b9('0xa8')]('\x22%s\x22\x20<%s>',_0x1cc1d2[_0x13b9('0x39')],_0x1cc1d2[_0x13b9('0xb4')]);}if(_0x1cc1d2[_0x13b9('0xac')]){if(_0x1cc1d2[_0x13b9('0xac')][_0x13b9('0xad')]['length']){return _0x1cc1d2[_0x13b9('0xac')]['Contacts'][0x0];}else{return db[_0x13b9('0x74')][_0x13b9('0x57')](_[_0x13b9('0x17')](_0x256f8b[_0x13b9('0x58')],{'firstName':_0x256f8b[_0x13b9('0x58')]['to'][0x0],'phone':_0x256f8b[_0x13b9('0x58')]['to'][0x0],'fax':_0x256f8b[_0x13b9('0x58')]['to'][0x0],'ListId':_0x1cc1d2[_0x13b9('0xa3')]}));}}else{throw new Error(_0x13b9('0xb5'));}}else{throw new Error(_0x13b9('0xb6'));}})['then'](function(_0x2c646a){if(_0x2c646a){return db[_0x13b9('0x71')][_0x13b9('0x56')]({'where':{'ContactId':_0x2c646a['id'],'closed':![],'FaxAccountId':_0x1cc1d2['id']}})[_0x13b9('0x34')](function(_0x82656d){if(_0x82656d){return[_0x82656d,![]];}return db['FaxInteraction'][_0x13b9('0x57')]({'UserId':_0x256f8b[_0x13b9('0x5b')]['id'],'ContactId':_0x2c646a['id'],'FaxAccountId':_0x1cc1d2['id'],'fax':_0x256f8b['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x13b9('0x4e')](_0x256f8b[_0x13b9('0x58')],{'read':![],'body':_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0xb7')],'FaxAccountId':_0x1cc1d2['id'],'UserId':_0x256f8b[_0x13b9('0x5b')]['id'],'ContactId':_0x2c646a['id'],'AttachmentId':_0x256f8b['body'][_0x13b9('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0x13b9('0xaa')],'as':_0x13b9('0xb8')}]})[_0x13b9('0x34')](function(_0xb45139){return[_0xb45139,!![]];});});}else{throw new Error(_0x13b9('0xb9'));}})[_0x13b9('0xba')](function(_0x33e3fe,_0x26a5bb){if(_0x26a5bb){return _0x33e3fe;}return db[_0x13b9('0xaa')][_0x13b9('0x57')]({'direction':'out','read':![],'body':_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0xb7')],'FaxAccountId':_0x1cc1d2['id'],'FaxInteractionId':_0x33e3fe['id'],'UserId':_0x256f8b[_0x13b9('0x5b')]['id'],'ContactId':_0x33e3fe['ContactId'],'AttachmentId':_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0]['id']})[_0x13b9('0x34')](function(_0x557d5a){_0x33e3fe[_0x13b9('0xbb')][_0x13b9('0xb8')]=[];_0x33e3fe[_0x13b9('0xbb')][_0x13b9('0xb8')][_0x13b9('0x8f')](_0x557d5a[_0x13b9('0xbb')]);return _0x33e3fe;});})[_0x13b9('0x34')](function(_0x4c180f){respondWithRpcPromise(_0x13b9('0xbc'),_0x13b9('0xbc'),{'FaxAccountId':_['isNil'](_0x256f8b['params']['id'])?undefined:_0x256f8b[_0x13b9('0x61')]['id'],'path':_[_0x13b9('0xb3')](_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0x6')])?undefined:_0x256f8b[_0x13b9('0x58')]['attachments'][0x0][_0x13b9('0x6')],'fax':_[_0x13b9('0xb3')](_0x256f8b['body']['to'][0x0])?undefined:_0x256f8b[_0x13b9('0x58')]['to'][0x0],'AttachmentId':_0x256f8b[_0x13b9('0x58')]['attachments'][0x0]['id']},client9002)[_0x13b9('0x34')](function(_0x5bc637){logger[_0x13b9('0x1f')](_0x13b9('0xbd'),_0x5bc637);})['catch'](function(_0xeb9f2e){logger['info'](_0x13b9('0xbd'),_0xeb9f2e);});return _0x4c180f;})[_0x13b9('0x34')](respondWithResult(_0x4de275,null))[_0x13b9('0x28')](handleError(_0x4de275,null));};exports[_0x13b9('0xbe')]=function(_0x26a427,_0x153ad6,_0x368d91){return db[_0x13b9('0x3e')][_0x13b9('0x56')]({'where':{'id':_0x26a427[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x153ad6,null))[_0x13b9('0x34')](function(_0x365d2a){if(_0x365d2a){return _0x365d2a[_0x13b9('0xbe')](_0x26a427[_0x13b9('0x58')][_0x13b9('0x6a')],_['omit'](_0x26a427['body'],[_0x13b9('0x6a'),'id'])||{})[_0x13b9('0xba')](function(_0x54fed0){for(var _0x10407b=0x0;_0x10407b<_0x26a427[_0x13b9('0x58')][_0x13b9('0x6a')][_0x13b9('0x48')];_0x10407b+=0x1){socket[_0x13b9('0xbf')](_0x13b9('0xc0'),{'UserId':Number(_0x26a427[_0x13b9('0x58')][_0x13b9('0x6a')][_0x10407b]),'FaxAccountId':Number(_0x26a427[_0x13b9('0x61')]['id'])});}return _0x54fed0;});}})[_0x13b9('0x34')](respondWithResult(_0x153ad6,null))[_0x13b9('0x28')](handleError(_0x153ad6,null));};exports[_0x13b9('0xc1')]=function(_0x41cffb,_0x23f05b,_0x9fbd1d){return db['FaxAccount'][_0x13b9('0x56')]({'where':{'id':_0x41cffb[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x23f05b,null))[_0x13b9('0x34')](function(_0x328b89){if(_0x328b89){return _0x328b89[_0x13b9('0xc1')](_0x41cffb[_0x13b9('0x43')][_0x13b9('0x6a')])[_0x13b9('0x34')](function(){if(_[_0x13b9('0xc2')](_0x41cffb[_0x13b9('0x43')][_0x13b9('0x6a')])){for(var _0x214b8e=0x0;_0x214b8e<_0x41cffb['query']['ids'][_0x13b9('0x48')];_0x214b8e+=0x1){socket['emit'](_0x13b9('0xc3'),{'UserId':Number(_0x41cffb[_0x13b9('0x43')][_0x13b9('0x6a')][_0x214b8e]),'FaxAccountId':Number(_0x41cffb[_0x13b9('0x61')]['id'])});}}else{socket[_0x13b9('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x41cffb['query'][_0x13b9('0x6a')]),'FaxAccountId':Number(_0x41cffb['params']['id'])});}});}})[_0x13b9('0x34')](respondWithStatusCode(_0x23f05b,null))[_0x13b9('0x28')](handleError(_0x23f05b,null));};exports[_0x13b9('0xc4')]=function(_0x3aeded,_0x2b81c7,_0xd40338){var _0x324568={};var _0xe1039f={};var _0x299865;var _0x88d266;return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x3aeded[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x2b81c7,null))[_0x13b9('0x34')](function(_0x450bfe){if(_0x450bfe){_0x299865=_0x450bfe;_0xe1039f[_0x13b9('0x42')]=_['keys'](db['User']['rawAttributes']);_0xe1039f['query']=_[_0x13b9('0x44')](_0x3aeded[_0x13b9('0x43')]);_0xe1039f[_0x13b9('0x4d')]=_[_0x13b9('0x45')](_0xe1039f[_0x13b9('0x42')],_0xe1039f[_0x13b9('0x43')]);_0x324568[_0x13b9('0x46')]=_[_0x13b9('0x45')](_0xe1039f[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x3aeded[_0x13b9('0x43')][_0x13b9('0x47')]));_0x324568[_0x13b9('0x46')]=_0x324568[_0x13b9('0x46')][_0x13b9('0x48')]?_0x324568[_0x13b9('0x46')]:_0xe1039f[_0x13b9('0x42')];_0x324568[_0x13b9('0x66')]=qs[_0x13b9('0x4b')](_0x3aeded[_0x13b9('0x43')][_0x13b9('0x4b')]);_0x324568['where']=qs[_0x13b9('0x4d')](_[_0x13b9('0x67')](_0x3aeded[_0x13b9('0x43')],_0xe1039f['filters']));if(_0x3aeded[_0x13b9('0x43')]['filter']){_0x324568[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x324568[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x324568['attributes'],function(_0x480d72){var _0x34aa40={};_0x34aa40[_0x480d72]={'$like':'%'+_0x3aeded[_0x13b9('0x43')][_0x13b9('0x68')]+'%'};return _0x34aa40;})});}_0x324568=_[_0x13b9('0x4e')]({},_0x324568,_0x3aeded[_0x13b9('0x50')]);return _0x299865[_0x13b9('0xc4')](_0x324568);}})[_0x13b9('0x34')](function(_0x620615){if(_0x620615){_0x88d266=_0x620615[_0x13b9('0x48')];if(!_0x3aeded[_0x13b9('0x43')][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x324568[_0x13b9('0x65')]=qs[_0x13b9('0x65')](_0x3aeded[_0x13b9('0x43')][_0x13b9('0x65')]);_0x324568['offset']=qs[_0x13b9('0x2f')](_0x3aeded['query'][_0x13b9('0x2f')]);}return _0x299865[_0x13b9('0xc4')](_0x324568);}})[_0x13b9('0x34')](function(_0x5a616b){if(_0x5a616b){return _0x5a616b?{'count':_0x88d266,'rows':_0x5a616b}:null;}})[_0x13b9('0x34')](respondWithResult(_0x2b81c7,null))[_0x13b9('0x28')](handleError(_0x2b81c7,null));}; \ No newline at end of file +var _0xbdbd=['getInteractions','hasOwnProperty','options','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','minrate','modem','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','findById','getMessages','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','Contacts','ListId','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','isArray','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','include','findAll','show','params','rawAttributes','includeAll','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','describe','addDisposition','FaxAccountId','Disposition','getDispositions','sort','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addInteraction','FaxInteraction'];(function(_0x1452f6,_0x1cbf16){var _0x39292a=function(_0x24d0ff){while(--_0x24d0ff){_0x1452f6['push'](_0x1452f6['shift']());}};_0x39292a(++_0x1cbf16);}(_0xbdbd,0x11d));var _0xdbdb=function(_0x15a252,_0x4414bc){_0x15a252=_0x15a252-0x0;var _0x2b8f4a=_0xbdbd[_0x15a252];return _0x2b8f4a;};'use strict';var emlformat=require(_0xdbdb('0x0'));var rimraf=require(_0xdbdb('0x1'));var zipdir=require(_0xdbdb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdbdb('0x3'));var BPromise=require(_0xdbdb('0x4'));var Mustache=require(_0xdbdb('0x5'));var util=require('util');var path=require(_0xdbdb('0x6'));var sox=require(_0xdbdb('0x7'));var csv=require('to-csv');var ejs=require(_0xdbdb('0x8'));var fs=require('fs');var fs_extra=require(_0xdbdb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdbdb('0xa'));var jsforce=require(_0xdbdb('0xb'));var deskjs=require(_0xdbdb('0xc'));var toCsv=require(_0xdbdb('0xd'));var querystring=require(_0xdbdb('0xe'));var Papa=require(_0xdbdb('0xf'));var Redis=require('ioredis');var authService=require(_0xdbdb('0x10'));var qs=require(_0xdbdb('0x11'));var as=require(_0xdbdb('0x12'));var hardwareService=require(_0xdbdb('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdbdb('0x14'));var config=require(_0xdbdb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbdb('0x16'))['db'];config[_0xdbdb('0x17')]=_['defaults'](config[_0xdbdb('0x17')],{'host':_0xdbdb('0x18'),'port':0x18eb});var socket=require(_0xdbdb('0x19'))(new Redis(config[_0xdbdb('0x17')]));require('./faxAccount.socket')[_0xdbdb('0x1a')](socket);var jayson=require(_0xdbdb('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xdbdb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5e275b,_0x332430,_0x52e5a6,_0x3e1474){return new BPromise(function(_0x14316e,_0x3e467b){var _0x2abd20=_0x3e1474||client;return _0x2abd20[_0xdbdb('0x1d')](_0x5e275b,_0x52e5a6)[_0xdbdb('0x1e')](function(_0xe087ff){logger['info'](_0xdbdb('0x1f'),_0x332430,_0xdbdb('0x20'));logger[_0xdbdb('0x21')](_0xdbdb('0x22'),_0x332430,_0xdbdb('0x20'),JSON[_0xdbdb('0x23')](_0xe087ff));if(_0xe087ff[_0xdbdb('0x24')]){if(_0xe087ff['error'][_0xdbdb('0x25')]===0x1f4){logger[_0xdbdb('0x24')](_0xdbdb('0x1f'),_0x332430,_0xe087ff[_0xdbdb('0x24')]['message']);return _0x3e467b(_0xe087ff[_0xdbdb('0x24')][_0xdbdb('0x26')]);}logger[_0xdbdb('0x24')](_0xdbdb('0x1f'),_0x332430,_0xe087ff[_0xdbdb('0x24')]['message']);return _0x14316e(_0xe087ff[_0xdbdb('0x24')][_0xdbdb('0x26')]);}else{logger[_0xdbdb('0x27')](_0xdbdb('0x1f'),_0x332430,_0xdbdb('0x20'));_0x14316e(_0xe087ff['result']['message']);}})[_0xdbdb('0x28')](function(_0x35b816){logger[_0xdbdb('0x24')]('FaxAccount,\x20%s,\x20%s',_0x332430,_0x35b816);_0x3e467b(_0x35b816);});});}function respondWithStatusCode(_0x4b3ef0,_0x39a345){_0x39a345=_0x39a345||0xcc;return function(_0x42cbe3){if(_0x42cbe3){return _0x4b3ef0['sendStatus'](_0x39a345);}return _0x4b3ef0[_0xdbdb('0x29')](_0x39a345)[_0xdbdb('0x2a')]();};}function respondWithResult(_0x3cde05,_0xbd26e8){_0xbd26e8=_0xbd26e8||0xc8;return function(_0x407678){if(_0x407678){return _0x3cde05[_0xdbdb('0x29')](_0xbd26e8)[_0xdbdb('0x2b')](_0x407678);}};}function respondWithFilteredResult(_0x241ca2,_0x4f6028){return function(_0x1becf0){if(_0x1becf0){var _0x43fec5=typeof _0x4f6028[_0xdbdb('0x2c')]===_0xdbdb('0x2d')&&typeof _0x4f6028[_0xdbdb('0x2e')]===_0xdbdb('0x2d');var _0x69ccf=_0x1becf0[_0xdbdb('0x2f')];var _0x52a3e3=_0x43fec5?0x0:_0x4f6028[_0xdbdb('0x2c')];var _0x520e42=_0x43fec5?_0x1becf0[_0xdbdb('0x2f')]:_0x4f6028[_0xdbdb('0x2c')]+_0x4f6028['limit'];var _0x20673f;if(_0x520e42>=_0x69ccf){_0x520e42=_0x69ccf;_0x20673f=0xc8;}else{_0x20673f=0xce;}_0x241ca2[_0xdbdb('0x29')](_0x20673f);return _0x241ca2[_0xdbdb('0x30')](_0xdbdb('0x31'),_0x52a3e3+'-'+_0x520e42+'/'+_0x69ccf)['json'](_0x1becf0);}return null;};}function patchUpdates(_0x322b6d){return function(_0x5f2b46){try{jsonpatch[_0xdbdb('0x32')](_0x5f2b46,_0x322b6d,!![]);}catch(_0x3337c9){return BPromise[_0xdbdb('0x33')](_0x3337c9);}return _0x5f2b46[_0xdbdb('0x34')]();};}function saveUpdates(_0x1e460b,_0x17ca20){return function(_0x454d73){if(_0x454d73){return _0x454d73[_0xdbdb('0x35')](_0x1e460b)['then'](function(_0x4412e9){return _0x4412e9;});}return null;};}function removeEntity(_0x47b796,_0x549121){return function(_0x85fdf0){if(_0x85fdf0){return _0x85fdf0['destroy']()['then'](function(){var _0x501863=_0x85fdf0[_0xdbdb('0x36')]({'plain':!![]});var _0x13d678=_0xdbdb('0x37');return db[_0xdbdb('0x38')][_0xdbdb('0x39')]({'where':{'type':_0x13d678,'resourceId':_0x501863['id']}})['then'](function(){return _0x85fdf0;});})[_0xdbdb('0x1e')](function(){_0x47b796[_0xdbdb('0x29')](0xcc)[_0xdbdb('0x2a')]();});}};}function handleEntityNotFound(_0xd2aaa2,_0x114aba){return function(_0xc149d9){if(!_0xc149d9){_0xd2aaa2[_0xdbdb('0x3a')](0x194);}return _0xc149d9;};}function handleError(_0x496273,_0x393d20){_0x393d20=_0x393d20||0x1f4;return function(_0x538c19){logger['error'](_0x538c19[_0xdbdb('0x3b')]);if(_0x538c19[_0xdbdb('0x3c')]){delete _0x538c19['name'];}_0x496273['status'](_0x393d20)[_0xdbdb('0x3d')](_0x538c19);};}exports[_0xdbdb('0x3e')]=function(_0x49084a,_0x3f4f96){var _0x3d052f={'include':[{'model':db[_0xdbdb('0x3f')],'as':_0xdbdb('0x40')}]},_0x4c93a2={},_0x209e10={'count':0x0,'rows':[]};var _0x104734=_['map'](db[_0xdbdb('0x41')]['rawAttributes'],function(_0x3cc5e3){return{'name':_0x3cc5e3[_0xdbdb('0x42')],'type':_0x3cc5e3[_0xdbdb('0x43')][_0xdbdb('0x44')]};});_0x4c93a2['model']=_[_0xdbdb('0x45')](_0x104734,'name');_0x4c93a2[_0xdbdb('0x46')]=_[_0xdbdb('0x47')](_0x49084a[_0xdbdb('0x46')]);_0x4c93a2['filters']=_[_0xdbdb('0x48')](_0x4c93a2[_0xdbdb('0x49')],_0x4c93a2[_0xdbdb('0x46')]);_0x3d052f[_0xdbdb('0x4a')]=_[_0xdbdb('0x48')](_0x4c93a2[_0xdbdb('0x49')],qs['fields'](_0x49084a[_0xdbdb('0x46')][_0xdbdb('0x4b')]));_0x3d052f[_0xdbdb('0x4a')]=_0x3d052f['attributes'][_0xdbdb('0x4c')]?_0x3d052f[_0xdbdb('0x4a')]:_0x4c93a2['model'];if(!_0x49084a[_0xdbdb('0x46')]['hasOwnProperty'](_0xdbdb('0x4d'))){_0x3d052f[_0xdbdb('0x2e')]=qs['limit'](_0x49084a[_0xdbdb('0x46')][_0xdbdb('0x2e')]);_0x3d052f['offset']=qs[_0xdbdb('0x2c')](_0x49084a[_0xdbdb('0x46')][_0xdbdb('0x2c')]);}_0x3d052f[_0xdbdb('0x4e')]=qs['sort'](_0x49084a[_0xdbdb('0x46')]['sort']);_0x3d052f[_0xdbdb('0x4f')]=qs[_0xdbdb('0x50')](_[_0xdbdb('0x51')](_0x49084a['query'],_0x4c93a2[_0xdbdb('0x50')]),_0x104734);if(_0x49084a[_0xdbdb('0x46')][_0xdbdb('0x52')]){_0x3d052f['where']=_[_0xdbdb('0x53')](_0x3d052f[_0xdbdb('0x4f')],{'$or':_[_0xdbdb('0x45')](_0x104734,function(_0x8334c4){if(_0x8334c4['type']!==_0xdbdb('0x54')){var _0xc1a355={};_0xc1a355[_0x8334c4[_0xdbdb('0x3c')]]={'$like':'%'+_0x49084a[_0xdbdb('0x46')][_0xdbdb('0x52')]+'%'};return _0xc1a355;}})});}_0x3d052f=_['merge']({},_0x3d052f,_0x49084a['options']);var _0xaf2c8e={'where':_0x3d052f[_0xdbdb('0x4f')]};return db['FaxAccount']['count'](_0xaf2c8e)[_0xdbdb('0x1e')](function(_0x25dae7){_0x209e10['count']=_0x25dae7;if(_0x49084a[_0xdbdb('0x46')]['includeAll']){_0x3d052f[_0xdbdb('0x55')]=[{'all':!![]}];}return db[_0xdbdb('0x41')][_0xdbdb('0x56')](_0x3d052f);})[_0xdbdb('0x1e')](function(_0x238677){_0x209e10['rows']=_0x238677;return _0x209e10;})[_0xdbdb('0x1e')](respondWithFilteredResult(_0x3f4f96,_0x3d052f))[_0xdbdb('0x28')](handleError(_0x3f4f96,null));};exports[_0xdbdb('0x57')]=function(_0x437011,_0x54cb36){var _0x166596={'raw':![],'where':{'id':_0x437011[_0xdbdb('0x58')]['id']},'include':[{'model':db[_0xdbdb('0x3f')],'as':_0xdbdb('0x40')}]},_0x187e60={};_0x187e60[_0xdbdb('0x49')]=_[_0xdbdb('0x47')](db['FaxAccount'][_0xdbdb('0x59')]);_0x187e60[_0xdbdb('0x46')]=_[_0xdbdb('0x47')](_0x437011['query']);_0x187e60[_0xdbdb('0x50')]=_['intersection'](_0x187e60['model'],_0x187e60[_0xdbdb('0x46')]);_0x166596['attributes']=_[_0xdbdb('0x48')](_0x187e60[_0xdbdb('0x49')],qs[_0xdbdb('0x4b')](_0x437011[_0xdbdb('0x46')]['fields']));_0x166596[_0xdbdb('0x4a')]=_0x166596['attributes'][_0xdbdb('0x4c')]?_0x166596[_0xdbdb('0x4a')]:_0x187e60[_0xdbdb('0x49')];if(_0x437011['query'][_0xdbdb('0x5a')]){_0x166596[_0xdbdb('0x55')]=[{'all':!![]}];}_0x166596=_[_0xdbdb('0x53')]({},_0x166596,_0x437011['options']);return db['FaxAccount']['find'](_0x166596)[_0xdbdb('0x1e')](handleEntityNotFound(_0x54cb36,null))[_0xdbdb('0x1e')](respondWithResult(_0x54cb36,null))['catch'](handleError(_0x54cb36,null));};exports[_0xdbdb('0x5b')]=function(_0xc129e,_0x1a2a85){return db[_0xdbdb('0x41')][_0xdbdb('0x5b')](_0xc129e[_0xdbdb('0x5c')],{})[_0xdbdb('0x1e')](function(_0x402469){var _0x9f1900=_0xc129e[_0xdbdb('0x5d')][_0xdbdb('0x36')]({'plain':!![]});if(!_0x9f1900)throw new Error(_0xdbdb('0x5e'));if(_0x9f1900[_0xdbdb('0x5f')]===_0xdbdb('0x5d')){var _0x30c360=_0x402469[_0xdbdb('0x36')]({'plain':!![]});var _0x588f76=_0xdbdb('0x37');return db[_0xdbdb('0x60')][_0xdbdb('0x61')]({'where':{'name':_0x588f76,'userProfileId':_0x9f1900[_0xdbdb('0x62')]},'raw':!![]})[_0xdbdb('0x1e')](function(_0xe3dabf){if(_0xe3dabf&&_0xe3dabf[_0xdbdb('0x63')]===0x0){return db[_0xdbdb('0x38')][_0xdbdb('0x5b')]({'name':_0x30c360[_0xdbdb('0x3c')],'resourceId':_0x30c360['id'],'type':_0xe3dabf['name'],'sectionId':_0xe3dabf['id']},{})[_0xdbdb('0x1e')](function(){return _0x402469;});}else{return _0x402469;}})[_0xdbdb('0x28')](function(_0x2ba964){logger[_0xdbdb('0x24')](_0xdbdb('0x64'),_0x2ba964);throw _0x2ba964;});}return _0x402469;})['then'](respondWithResult(_0x1a2a85,0xc9))['catch'](handleError(_0x1a2a85,null));};exports['update']=function(_0xd46b17,_0x2a3fc6){if(_0xd46b17['body']['id']){delete _0xd46b17[_0xdbdb('0x5c')]['id'];}return db[_0xdbdb('0x41')][_0xdbdb('0x61')]({'where':{'id':_0xd46b17[_0xdbdb('0x58')]['id']},'include':[{'model':db[_0xdbdb('0x3f')],'as':_0xdbdb('0x40')}]})[_0xdbdb('0x1e')](handleEntityNotFound(_0x2a3fc6,null))[_0xdbdb('0x1e')](saveUpdates(_0xd46b17[_0xdbdb('0x5c')],null))[_0xdbdb('0x1e')](respondWithResult(_0x2a3fc6,null))['catch'](handleError(_0x2a3fc6,null));};exports[_0xdbdb('0x39')]=function(_0x343a9e,_0x48a8c6){return db[_0xdbdb('0x41')]['find']({'where':{'id':_0x343a9e[_0xdbdb('0x58')]['id']}})['then'](handleEntityNotFound(_0x48a8c6,null))[_0xdbdb('0x1e')](removeEntity(_0x48a8c6,null))['catch'](handleError(_0x48a8c6,null));};exports[_0xdbdb('0x65')]=function(_0x3b2f9f,_0x4e0d47){return db[_0xdbdb('0x41')]['describe']()[_0xdbdb('0x1e')](respondWithResult(_0x4e0d47,null))[_0xdbdb('0x28')](handleError(_0x4e0d47,null));};exports[_0xdbdb('0x66')]=function(_0x192b15,_0x4e5458,_0x46130d){if(_0x192b15['body']['id']){delete _0x192b15['body']['id'];}return db[_0xdbdb('0x41')]['find']({'where':{'id':_0x192b15[_0xdbdb('0x58')]['id']}})['then'](handleEntityNotFound(_0x4e5458,null))['then'](function(_0x11bfe4){if(_0x11bfe4){_0x192b15[_0xdbdb('0x5c')][_0xdbdb('0x67')]=_0x11bfe4['id'];return db[_0xdbdb('0x68')][_0xdbdb('0x5b')](_0x192b15[_0xdbdb('0x5c')]);}})['then'](respondWithResult(_0x4e5458,null))[_0xdbdb('0x28')](handleError(_0x4e5458,null));};exports[_0xdbdb('0x69')]=function(_0x5c8005,_0x4338cd,_0x3d561d){var _0x52e3ef={'raw':![],'where':{}};var _0x1df956={};var _0xc3c7b4={'count':0x0,'rows':[]};return db[_0xdbdb('0x41')]['findOne']({'where':{'id':_0x5c8005['params']['id']}})['then'](handleEntityNotFound(_0x4338cd,null))[_0xdbdb('0x1e')](function(_0x3062eb){if(_0x3062eb){_0x1df956[_0xdbdb('0x49')]=_[_0xdbdb('0x47')](db[_0xdbdb('0x68')][_0xdbdb('0x59')]);_0x1df956[_0xdbdb('0x46')]=_[_0xdbdb('0x47')](_0x5c8005[_0xdbdb('0x46')]);_0x1df956[_0xdbdb('0x50')]=_[_0xdbdb('0x48')](_0x1df956[_0xdbdb('0x49')],_0x1df956[_0xdbdb('0x46')]);_0x52e3ef[_0xdbdb('0x4a')]=_[_0xdbdb('0x48')](_0x1df956[_0xdbdb('0x49')],qs[_0xdbdb('0x4b')](_0x5c8005[_0xdbdb('0x46')][_0xdbdb('0x4b')]));_0x52e3ef['attributes']=_0x52e3ef[_0xdbdb('0x4a')]['length']?_0x52e3ef[_0xdbdb('0x4a')]:_0x1df956[_0xdbdb('0x49')];if(!_0x5c8005[_0xdbdb('0x46')]['hasOwnProperty']('nolimit')){_0x52e3ef[_0xdbdb('0x2e')]=qs['limit'](_0x5c8005['query'][_0xdbdb('0x2e')]);_0x52e3ef[_0xdbdb('0x2c')]=qs[_0xdbdb('0x2c')](_0x5c8005['query'][_0xdbdb('0x2c')]);}_0x52e3ef[_0xdbdb('0x4e')]=qs['sort'](_0x5c8005['query'][_0xdbdb('0x6a')]);_0x52e3ef['where']=qs[_0xdbdb('0x50')](_[_0xdbdb('0x51')](_0x5c8005['query'],_0x1df956[_0xdbdb('0x50')]));_0x52e3ef['where']['FaxAccountId']=_0x3062eb['id'];if(_0x5c8005[_0xdbdb('0x46')][_0xdbdb('0x52')]){_0x52e3ef['where']=_['merge'](_0x52e3ef[_0xdbdb('0x4f')],{'$or':_[_0xdbdb('0x45')](_0x52e3ef[_0xdbdb('0x4a')],function(_0x18cee9){var _0x2ec687={};_0x2ec687[_0x18cee9]={'$like':'%'+_0x5c8005[_0xdbdb('0x46')][_0xdbdb('0x52')]+'%'};return _0x2ec687;})});}_0x52e3ef=_[_0xdbdb('0x53')]({},_0x52e3ef,_0x5c8005['options']);return db[_0xdbdb('0x68')][_0xdbdb('0x2f')]({'where':_0x52e3ef['where']})[_0xdbdb('0x1e')](function(_0x415d4d){_0xc3c7b4[_0xdbdb('0x2f')]=_0x415d4d;if(_0x5c8005['query'][_0xdbdb('0x5a')]){_0x52e3ef['include']=[{'all':!![]}];}return db[_0xdbdb('0x68')][_0xdbdb('0x56')](_0x52e3ef);})[_0xdbdb('0x1e')](function(_0x4d5f67){_0xc3c7b4[_0xdbdb('0x6b')]=_0x4d5f67;return _0xc3c7b4;});}})[_0xdbdb('0x1e')](respondWithFilteredResult(_0x4338cd,_0x52e3ef))[_0xdbdb('0x28')](handleError(_0x4338cd,null));};exports['removeDispositions']=function(_0x530126,_0x33f7c4,_0x54e96e){return db[_0xdbdb('0x41')][_0xdbdb('0x61')]({'where':{'id':_0x530126['params']['id']}})[_0xdbdb('0x1e')](handleEntityNotFound(_0x33f7c4,null))[_0xdbdb('0x1e')](function(_0x321fe2){if(_0x321fe2){return _0x321fe2[_0xdbdb('0x6c')](_0x530126[_0xdbdb('0x46')][_0xdbdb('0x6d')]);}})[_0xdbdb('0x1e')](respondWithStatusCode(_0x33f7c4,null))[_0xdbdb('0x28')](handleError(_0x33f7c4,null));};exports[_0xdbdb('0x6e')]=function(_0x5d9c8d,_0x6fa7f3,_0x3f0551){if(_0x5d9c8d['body']['id']){delete _0x5d9c8d['body']['id'];}return db[_0xdbdb('0x41')][_0xdbdb('0x61')]({'where':{'id':_0x5d9c8d[_0xdbdb('0x58')]['id']}})[_0xdbdb('0x1e')](handleEntityNotFound(_0x6fa7f3,null))[_0xdbdb('0x1e')](function(_0x54d9af){if(_0x54d9af){_0x5d9c8d[_0xdbdb('0x5c')][_0xdbdb('0x67')]=_0x54d9af['id'];return db['CannedAnswer']['create'](_0x5d9c8d[_0xdbdb('0x5c')]);}})['then'](respondWithResult(_0x6fa7f3,null))['catch'](handleError(_0x6fa7f3,null));};exports[_0xdbdb('0x6f')]=function(_0x25117d,_0x23ae51,_0x40e5fb){var _0x29bfc8={'raw':![],'where':{}};var _0x31eff7={};var _0x6705d6={'count':0x0,'rows':[]};return db['FaxAccount'][_0xdbdb('0x70')]({'where':{'id':_0x25117d[_0xdbdb('0x58')]['id']}})[_0xdbdb('0x1e')](handleEntityNotFound(_0x23ae51,null))[_0xdbdb('0x1e')](function(_0x4b741d){if(_0x4b741d){_0x31eff7['model']=_[_0xdbdb('0x47')](db[_0xdbdb('0x71')][_0xdbdb('0x59')]);_0x31eff7[_0xdbdb('0x46')]=_[_0xdbdb('0x47')](_0x25117d['query']);_0x31eff7[_0xdbdb('0x50')]=_[_0xdbdb('0x48')](_0x31eff7[_0xdbdb('0x49')],_0x31eff7[_0xdbdb('0x46')]);_0x29bfc8['attributes']=_[_0xdbdb('0x48')](_0x31eff7['model'],qs[_0xdbdb('0x4b')](_0x25117d[_0xdbdb('0x46')]['fields']));_0x29bfc8['attributes']=_0x29bfc8[_0xdbdb('0x4a')][_0xdbdb('0x4c')]?_0x29bfc8[_0xdbdb('0x4a')]:_0x31eff7[_0xdbdb('0x49')];if(!_0x25117d[_0xdbdb('0x46')]['hasOwnProperty']('nolimit')){_0x29bfc8[_0xdbdb('0x2e')]=qs[_0xdbdb('0x2e')](_0x25117d[_0xdbdb('0x46')][_0xdbdb('0x2e')]);_0x29bfc8[_0xdbdb('0x2c')]=qs[_0xdbdb('0x2c')](_0x25117d['query'][_0xdbdb('0x2c')]);}_0x29bfc8[_0xdbdb('0x4e')]=qs[_0xdbdb('0x6a')](_0x25117d[_0xdbdb('0x46')][_0xdbdb('0x6a')]);_0x29bfc8['where']=qs['filters'](_['pick'](_0x25117d[_0xdbdb('0x46')],_0x31eff7[_0xdbdb('0x50')]));_0x29bfc8[_0xdbdb('0x4f')][_0xdbdb('0x67')]=_0x4b741d['id'];if(_0x25117d[_0xdbdb('0x46')]['filter']){_0x29bfc8[_0xdbdb('0x4f')]=_[_0xdbdb('0x53')](_0x29bfc8[_0xdbdb('0x4f')],{'$or':_[_0xdbdb('0x45')](_0x29bfc8[_0xdbdb('0x4a')],function(_0x42b618){var _0x423a2f={};_0x423a2f[_0x42b618]={'$like':'%'+_0x25117d[_0xdbdb('0x46')]['filter']+'%'};return _0x423a2f;})});}_0x29bfc8=_[_0xdbdb('0x53')]({},_0x29bfc8,_0x25117d['options']);return db[_0xdbdb('0x71')][_0xdbdb('0x2f')]({'where':_0x29bfc8[_0xdbdb('0x4f')]})[_0xdbdb('0x1e')](function(_0x1da0c0){_0x6705d6[_0xdbdb('0x2f')]=_0x1da0c0;if(_0x25117d[_0xdbdb('0x46')][_0xdbdb('0x5a')]){_0x29bfc8[_0xdbdb('0x55')]=[{'all':!![]}];}return db[_0xdbdb('0x71')][_0xdbdb('0x56')](_0x29bfc8);})[_0xdbdb('0x1e')](function(_0x3851ac){_0x6705d6[_0xdbdb('0x6b')]=_0x3851ac;return _0x6705d6;});}})[_0xdbdb('0x1e')](respondWithFilteredResult(_0x23ae51,_0x29bfc8))[_0xdbdb('0x28')](handleError(_0x23ae51,null));};exports[_0xdbdb('0x72')]=function(_0x1a74b9,_0x2eb04b,_0x49e90e){return db[_0xdbdb('0x41')][_0xdbdb('0x61')]({'where':{'id':_0x1a74b9[_0xdbdb('0x58')]['id']}})[_0xdbdb('0x1e')](handleEntityNotFound(_0x2eb04b,null))[_0xdbdb('0x1e')](function(_0x3f985d){if(_0x3f985d){return _0x3f985d[_0xdbdb('0x72')](_0x1a74b9[_0xdbdb('0x46')][_0xdbdb('0x6d')]);}})['then'](respondWithStatusCode(_0x2eb04b,null))[_0xdbdb('0x28')](handleError(_0x2eb04b,null));};exports[_0xdbdb('0x73')]=function(_0x11a0bd,_0x4e6361,_0x1196ba){return db[_0xdbdb('0x74')][_0xdbdb('0x61')]({'where':{'id':_0x11a0bd[_0xdbdb('0x58')]['id']}})['then'](handleEntityNotFound(_0x4e6361,null))[_0xdbdb('0x1e')](function(_0x58a725){if(_0x58a725){return _0x58a725[_0xdbdb('0x73')](_0x11a0bd[_0xdbdb('0x5c')][_0xdbdb('0x6d')],_['omit'](_0x11a0bd[_0xdbdb('0x5c')],[_0xdbdb('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x4e6361,null))['catch'](handleError(_0x4e6361,null));};exports[_0xdbdb('0x75')]=function(_0x47b723,_0x35f53e,_0x253a51){var _0x4b8cbe={'raw':![],'where':{}};var _0x5be3c9={};var _0x41d62c={'count':0x0,'rows':[]};return db[_0xdbdb('0x41')][_0xdbdb('0x70')]({'where':{'id':_0x47b723[_0xdbdb('0x58')]['id']}})['then'](handleEntityNotFound(_0x35f53e,null))[_0xdbdb('0x1e')](function(_0xb73caa){if(_0xb73caa){_0x5be3c9[_0xdbdb('0x49')]=_['keys'](db['FaxInteraction'][_0xdbdb('0x59')]);_0x5be3c9[_0xdbdb('0x46')]=_['keys'](_0x47b723[_0xdbdb('0x46')]);_0x5be3c9['filters']=_['intersection'](_0x5be3c9[_0xdbdb('0x49')],_0x5be3c9[_0xdbdb('0x46')]);_0x4b8cbe[_0xdbdb('0x4a')]=_[_0xdbdb('0x48')](_0x5be3c9[_0xdbdb('0x49')],qs['fields'](_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x4b')]));_0x4b8cbe[_0xdbdb('0x4a')]=_0x4b8cbe[_0xdbdb('0x4a')][_0xdbdb('0x4c')]?_0x4b8cbe['attributes']:_0x5be3c9[_0xdbdb('0x49')];if(!_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x76')](_0xdbdb('0x4d'))){_0x4b8cbe[_0xdbdb('0x2e')]=qs[_0xdbdb('0x2e')](_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x2e')]);_0x4b8cbe[_0xdbdb('0x2c')]=qs[_0xdbdb('0x2c')](_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x2c')]);}_0x4b8cbe['order']=qs[_0xdbdb('0x6a')](_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x6a')]);_0x4b8cbe[_0xdbdb('0x4f')]=qs[_0xdbdb('0x50')](_[_0xdbdb('0x51')](_0x47b723[_0xdbdb('0x46')],_0x5be3c9[_0xdbdb('0x50')]));_0x4b8cbe[_0xdbdb('0x4f')][_0xdbdb('0x67')]=_0xb73caa['id'];if(_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x52')]){_0x4b8cbe[_0xdbdb('0x4f')]=_['merge'](_0x4b8cbe[_0xdbdb('0x4f')],{'$or':_[_0xdbdb('0x45')](_0x4b8cbe[_0xdbdb('0x4a')],function(_0x1e587b){var _0x48039e={};_0x48039e[_0x1e587b]={'$like':'%'+_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x52')]+'%'};return _0x48039e;})});}_0x4b8cbe=_['merge']({},_0x4b8cbe,_0x47b723[_0xdbdb('0x77')]);return db[_0xdbdb('0x74')][_0xdbdb('0x2f')]({'where':_0x4b8cbe['where']})[_0xdbdb('0x1e')](function(_0x470f03){_0x41d62c['count']=_0x470f03;if(_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x5a')]){_0x4b8cbe[_0xdbdb('0x55')]=[{'model':db[_0xdbdb('0x78')],'as':'Contact','required':![]},{'model':db[_0xdbdb('0x79')],'as':_0xdbdb('0x7a'),'attributes':[_0xdbdb('0x3c'),_0xdbdb('0x7b'),_0xdbdb('0x7c')],'required':![]},{'model':db[_0xdbdb('0x7d')],'as':_0xdbdb('0x7e'),'attributes':['id',_0xdbdb('0x3c'),_0xdbdb('0x7f')],'where':_0x47b723[_0xdbdb('0x46')]['tag']?{'id':_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x80')]}:undefined,'required':_0x47b723[_0xdbdb('0x46')][_0xdbdb('0x80')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x4b8cbe);})[_0xdbdb('0x1e')](function(_0x1d094c){_0x41d62c[_0xdbdb('0x6b')]=_0x1d094c;return _0x41d62c;});}})['then'](respondWithFilteredResult(_0x35f53e,_0x4b8cbe))['catch'](handleError(_0x35f53e,null));};exports['addApplications']=function(_0x353621,_0x484c69){var _0x41579b=_0x353621[_0xdbdb('0x58')]['id'];var _0x2bdfef=_0x353621[_0xdbdb('0x5c')];var _0x5eaea5=0xc8;var _0x159865=null;return db[_0xdbdb('0x81')][_0xdbdb('0x82')]({'isolationLevel':db['sequelize'][_0xdbdb('0x83')][_0xdbdb('0x84')][_0xdbdb('0x85')]},function(_0x2e894c){return db[_0xdbdb('0x41')][_0xdbdb('0x70')]({'where':{'id':_0x41579b},'transaction':_0x2e894c})['then'](function(_0x2e6085){if(_0x2e6085){return db[_0xdbdb('0x86')]['destroy']({'where':{'FaxAccountId':_0x41579b},'transaction':_0x2e894c})[_0xdbdb('0x1e')](function(){var _0x2f7875=_[_0xdbdb('0x45')](_0x2bdfef,function(_0x5809bf){_0x5809bf[_0xdbdb('0x67')]=_0x41579b;return _0x5809bf;});return db[_0xdbdb('0x86')][_0xdbdb('0x87')](_0x2f7875,{'transaction':_0x2e894c});});}else{_0x5eaea5=0x194;_0x159865=[];}});})[_0xdbdb('0x1e')](function(){if(_0x5eaea5!==0x194){return db[_0xdbdb('0x86')][_0xdbdb('0x88')]({'where':{'FaxAccountId':_0x41579b},'order':_0xdbdb('0x89')})[_0xdbdb('0x1e')](function(_0x1c5643){_0x159865=_0x1c5643;});}})[_0xdbdb('0x28')](function(_0x22610e){_0x5eaea5=0x1f4;logger['error'](_0x22610e[_0xdbdb('0x3b')]);if(_0x22610e[_0xdbdb('0x3c')]){delete _0x22610e[_0xdbdb('0x3c')];}_0x159865=_0x22610e;})[_0xdbdb('0x8a')](function(){if(_0x159865===null){_0x484c69[_0xdbdb('0x3a')](_0x5eaea5);}else{if(_0x5eaea5===0x1f4){_0x484c69[_0xdbdb('0x29')](_0x5eaea5)[_0xdbdb('0x3d')](_0x159865);}else{_0x484c69[_0xdbdb('0x29')](_0x5eaea5)[_0xdbdb('0x2b')](_0x159865);}}});};exports[_0xdbdb('0x8b')]=function(_0x5cbc6d,_0x1b1617,_0x39e2a7){var _0x11c329={};var _0x231070={};var _0x35a67a;var _0x274b16;return db[_0xdbdb('0x41')][_0xdbdb('0x70')]({'where':{'id':_0x5cbc6d[_0xdbdb('0x58')]['id']}})[_0xdbdb('0x1e')](handleEntityNotFound(_0x1b1617,null))[_0xdbdb('0x1e')](function(_0x3ba03e){if(_0x3ba03e){_0x35a67a=_0x3ba03e;_0x231070[_0xdbdb('0x49')]=_[_0xdbdb('0x47')](db[_0xdbdb('0x86')][_0xdbdb('0x59')]);_0x231070[_0xdbdb('0x46')]=_[_0xdbdb('0x47')](_0x5cbc6d[_0xdbdb('0x46')]);_0x231070[_0xdbdb('0x50')]=_[_0xdbdb('0x48')](_0x231070[_0xdbdb('0x49')],_0x231070[_0xdbdb('0x46')]);_0x11c329[_0xdbdb('0x4a')]=_[_0xdbdb('0x48')](_0x231070[_0xdbdb('0x49')],qs[_0xdbdb('0x4b')](_0x5cbc6d[_0xdbdb('0x46')]['fields']));_0x11c329[_0xdbdb('0x4a')]=_0x11c329[_0xdbdb('0x4a')][_0xdbdb('0x4c')]?_0x11c329['attributes']:_0x231070['model'];_0x11c329[_0xdbdb('0x4e')]=qs[_0xdbdb('0x6a')](_0x5cbc6d['query'][_0xdbdb('0x6a')]);_0x11c329[_0xdbdb('0x4f')]=qs[_0xdbdb('0x50')](_[_0xdbdb('0x51')](_0x5cbc6d['query'],_0x231070[_0xdbdb('0x50')]));if(_0x5cbc6d[_0xdbdb('0x46')][_0xdbdb('0x52')]){_0x11c329[_0xdbdb('0x4f')]=_[_0xdbdb('0x53')](_0x11c329[_0xdbdb('0x4f')],{'$or':_[_0xdbdb('0x45')](_0x11c329['attributes'],function(_0xd3e82d){var _0x1bddb5={};_0x1bddb5[_0xd3e82d]={'$like':'%'+_0x5cbc6d[_0xdbdb('0x46')]['filter']+'%'};return _0x1bddb5;})});}_0x11c329=_['merge']({},_0x11c329,_0x5cbc6d['options']);return _0x35a67a[_0xdbdb('0x8b')](_0x11c329);}})['then'](function(_0x37f5d0){if(_0x37f5d0){_0x274b16=_0x37f5d0[_0xdbdb('0x4c')];if(!_0x5cbc6d[_0xdbdb('0x46')][_0xdbdb('0x76')](_0xdbdb('0x4d'))){_0x11c329[_0xdbdb('0x2e')]=qs[_0xdbdb('0x2e')](_0x5cbc6d[_0xdbdb('0x46')][_0xdbdb('0x2e')]);_0x11c329['offset']=qs['offset'](_0x5cbc6d[_0xdbdb('0x46')][_0xdbdb('0x2c')]);}return _0x35a67a[_0xdbdb('0x8b')](_0x11c329);}})[_0xdbdb('0x1e')](function(_0x4e55d0){if(_0x4e55d0){return _0x4e55d0?{'count':_0x274b16,'rows':_0x4e55d0}:null;}})[_0xdbdb('0x1e')](respondWithResult(_0x1b1617,null))['catch'](handleError(_0x1b1617,null));};function Extension(_0x3b14a2,_0x2c8bfd,_0x73b355,_0x4ed6ac){this[_0xdbdb('0x8c')]=_0xdbdb('0x8d');this[_0xdbdb('0x8e')]=_0x3b14a2[_0xdbdb('0x8f')];this[_0xdbdb('0x90')]=_0x4ed6ac;this[_0xdbdb('0x43')]='system';this['description']=_0xdbdb('0x91');this[_0xdbdb('0x67')]=_0x3b14a2['id'];this['priority']=_0x2c8bfd;this[_0xdbdb('0x92')]=_0x73b355;}function createExtensionsReciveFax(_0x4c65ca){var _0x1ec8c2=0x1;var _0x11edae=[];_0x11edae[_0xdbdb('0x93')](new Extension(_0x4c65ca,_0x1ec8c2,'',_0xdbdb('0x94')));_0x1ec8c2+=0x1;_0x11edae[_0xdbdb('0x93')](new Extension(_0x4c65ca,_0x1ec8c2,_0xdbdb('0x95'),_0xdbdb('0x96')));_0x1ec8c2+=0x1;for(var _0x234812 in _0x4c65ca){if(_0x4c65ca[_0xdbdb('0x76')](_0x234812)&&(_0x234812===_0xdbdb('0x97')||_0x234812===_0xdbdb('0x8f')||_0x234812===_0xdbdb('0x98')||_0x234812===_0xdbdb('0x99')||_0x234812==='headerinfo'||_0x234812===_0xdbdb('0x9a')||_0x234812===_0xdbdb('0x9b')||_0x234812===_0xdbdb('0x9c')||_0x234812==='t38timeout')){_0x11edae['push'](new Extension(_0x4c65ca,_0x1ec8c2,'FAXOPT('+_0x234812+')='+_0x4c65ca[_0x234812],_0xdbdb('0x96')));_0x1ec8c2+=0x1;}}_0x11edae[_0xdbdb('0x93')](new Extension(_0x4c65ca,_0x1ec8c2,'6',_0xdbdb('0x9d')));_0x1ec8c2+=0x1;_0x11edae[_0xdbdb('0x93')](new Extension(_0x4c65ca,_0x1ec8c2,_0xdbdb('0x9e'),'ReceiveFax'));_0x1ec8c2=0x0;return _0x11edae;}exports[_0xdbdb('0x9f')]=function(_0x402386,_0x42fe25,_0x23096f){var _0x301c46;return db[_0xdbdb('0x81')]['transaction'](function(_0x2359db){return db[_0xdbdb('0x41')][_0xdbdb('0x5b')](_0x402386[_0xdbdb('0x5c')],{'transaction':_0x2359db})[_0xdbdb('0x1e')](function(_0xd38bd2){_0x301c46=_0xd38bd2['get']({'plain':!![]});return db[_0xdbdb('0xa0')]['bulkCreate'](createExtensionsReciveFax(_0x301c46),{'transaction':_0x2359db});});})[_0xdbdb('0x1e')](function(){return _0x301c46;})[_0xdbdb('0x1e')](respondWithResult(_0x42fe25,null))[_0xdbdb('0x28')](handleError(_0x42fe25,null));};exports[_0xdbdb('0xa1')]=function(_0xe3ce6b,_0x21291f,_0x542669){var _0x37fa0c;return db[_0xdbdb('0x81')][_0xdbdb('0x82')](function(_0x15f9f6){return db['FaxAccount'][_0xdbdb('0x35')](_0xe3ce6b[_0xdbdb('0x5c')],{'where':{'id':_0xe3ce6b[_0xdbdb('0x5c')]['id']},'transaction':_0x15f9f6})[_0xdbdb('0x1e')](function(_0x241dfc){return db['VoiceExtension'][_0xdbdb('0x39')]({'where':{'FaxAccountId':_0xe3ce6b[_0xdbdb('0x5c')]['id']},'transaction':_0x15f9f6})[_0xdbdb('0x1e')](function(_0x972474){return db[_0xdbdb('0xa0')]['bulkCreate'](createExtensionsReciveFax(_[_0xdbdb('0xa2')](_0xe3ce6b[_0xdbdb('0x5c')],[_0xdbdb('0xa3'),_0xdbdb('0x44'),_0xdbdb('0xa4'),_0xdbdb('0xa5'),'TrunkId','ListId'])),{'transaction':_0x15f9f6});});});})['then'](function(){return db[_0xdbdb('0x41')][_0xdbdb('0xa6')](_0xe3ce6b[_0xdbdb('0x5c')]['id']);})['then'](respondWithResult(_0x21291f,null))[_0xdbdb('0x28')](handleError(_0x21291f,null));};exports[_0xdbdb('0xa7')]=function(_0x28919d,_0x309aad,_0x5e8082){var _0x32c89b={'raw':!![],'where':{}};var _0x4dd003={};var _0x27ea58={'count':0x0,'rows':[]};return db[_0xdbdb('0x41')][_0xdbdb('0x70')]({'where':{'id':_0x28919d['params']['id']}})[_0xdbdb('0x1e')](handleEntityNotFound(_0x309aad,null))[_0xdbdb('0x1e')](function(_0x2418e9){if(_0x2418e9){_0x4dd003[_0xdbdb('0x49')]=_[_0xdbdb('0x47')](db[_0xdbdb('0xa8')][_0xdbdb('0x59')]);_0x4dd003[_0xdbdb('0x46')]=_[_0xdbdb('0x47')](_0x28919d[_0xdbdb('0x46')]);_0x4dd003['filters']=_['intersection'](_0x4dd003[_0xdbdb('0x49')],_0x4dd003['query']);_0x32c89b[_0xdbdb('0x4a')]=_[_0xdbdb('0x48')](_0x4dd003[_0xdbdb('0x49')],qs[_0xdbdb('0x4b')](_0x28919d[_0xdbdb('0x46')][_0xdbdb('0x4b')]));_0x32c89b['attributes']=_0x32c89b[_0xdbdb('0x4a')][_0xdbdb('0x4c')]?_0x32c89b['attributes']:_0x4dd003[_0xdbdb('0x49')];if(!_0x28919d[_0xdbdb('0x46')][_0xdbdb('0x76')](_0xdbdb('0x4d'))){_0x32c89b[_0xdbdb('0x2e')]=qs[_0xdbdb('0x2e')](_0x28919d[_0xdbdb('0x46')][_0xdbdb('0x2e')]);_0x32c89b[_0xdbdb('0x2c')]=qs['offset'](_0x28919d['query']['offset']);}_0x32c89b[_0xdbdb('0x4e')]=qs[_0xdbdb('0x6a')](_0x28919d['query']['sort']);_0x32c89b[_0xdbdb('0x4f')]=qs['filters'](_['pick'](_0x28919d[_0xdbdb('0x46')],_0x4dd003[_0xdbdb('0x50')]));_0x32c89b[_0xdbdb('0x4f')]['FaxAccountId']=_0x2418e9['id'];if(_0x28919d[_0xdbdb('0x46')][_0xdbdb('0x52')]){_0x32c89b['where']=_[_0xdbdb('0x53')](_0x32c89b[_0xdbdb('0x4f')],{'$or':_[_0xdbdb('0x45')](_0x32c89b['attributes'],function(_0x4f82dc){var _0x37a56c={};_0x37a56c[_0x4f82dc]={'$like':'%'+_0x28919d[_0xdbdb('0x46')][_0xdbdb('0x52')]+'%'};return _0x37a56c;})});}if(_0x28919d[_0xdbdb('0x46')]['$gte']){var _0x5bcd1b=_0x28919d[_0xdbdb('0x46')]['$gte']['split'](',');var _0x1909e8={};_0x1909e8[_0x5bcd1b[0x0]]={'$gte':moment(_0x5bcd1b[0x1])[_0xdbdb('0xa9')](_0xdbdb('0xaa'))};_0x32c89b[_0xdbdb('0x4f')]=_[_0xdbdb('0x53')](_0x32c89b[_0xdbdb('0x4f')],_0x1909e8);}_0x32c89b=_[_0xdbdb('0x53')]({},_0x32c89b,_0x28919d[_0xdbdb('0x77')]);return db[_0xdbdb('0xa8')][_0xdbdb('0x2f')]({'where':_0x32c89b[_0xdbdb('0x4f')]})[_0xdbdb('0x1e')](function(_0x1a1570){_0x27ea58[_0xdbdb('0x2f')]=_0x1a1570;if(_0x28919d[_0xdbdb('0x46')][_0xdbdb('0x5a')]){_0x32c89b[_0xdbdb('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0xdbdb('0x56')](_0x32c89b);})[_0xdbdb('0x1e')](function(_0x3c5ce8){_0x27ea58['rows']=_0x3c5ce8;return _0x27ea58;});}})['then'](respondWithFilteredResult(_0x309aad,_0x32c89b))[_0xdbdb('0x28')](handleError(_0x309aad,null));};exports[_0xdbdb('0x3d')]=function(_0x595b2d,_0x50dc5b,_0x371b3e){var _0xf08b3d,_0x10990a={},_0x4c990e;if(_0x595b2d[_0xdbdb('0x5c')]['to']){_0x4c990e=_0x595b2d[_0xdbdb('0x5c')]['to'][0x0];}return db[_0xdbdb('0x41')][_0xdbdb('0x61')]({'where':{'id':_0x595b2d['params']['id']},'include':[{'model':db[_0xdbdb('0xab')],'as':_0xdbdb('0xac'),'include':[{'model':db[_0xdbdb('0x78')],'as':'Contacts','where':{'fax':_0x4c990e},'limit':0x1,'order':[['updatedAt',_0xdbdb('0xad')]]}]}]})[_0xdbdb('0x1e')](handleEntityNotFound(_0x50dc5b,null))['then'](function(_0x4060a7){_0xf08b3d=_0x4060a7;if(_0x595b2d[_0xdbdb('0x5c')]['attachments']&&_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xae')]['length']){for(var _0x4876ab=0x0;_0x4876ab<_0x595b2d['body']['attachments'][_0xdbdb('0x4c')];_0x4876ab+=0x1){_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xae')][_0x4876ab]={'filename':_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xae')][_0x4876ab][_0xdbdb('0x3c')],'id':_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xae')][_0x4876ab]['id'],'path':path[_0xdbdb('0xaf')](config[_0xdbdb('0xb0')],_0xdbdb('0xb1'),_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xae')][_0x4876ab][_0xdbdb('0xb2')])};}}return respondWithRpcPromise(_0xdbdb('0xb3'),_0xdbdb('0xb3'),{'FaxAccountId':_[_0xdbdb('0xb4')](_0x595b2d[_0xdbdb('0x58')]['id'])?undefined:_0x595b2d[_0xdbdb('0x58')]['id'],'path':_[_0xdbdb('0xb4')](_0x595b2d['body']['attachments'][0x0]['path'])?undefined:_0x595b2d[_0xdbdb('0x5c')]['attachments'][0x0][_0xdbdb('0x6')],'fax':_[_0xdbdb('0xb4')](_0x595b2d[_0xdbdb('0x5c')]['to'][0x0])?undefined:_0x595b2d['body']['to'][0x0]},client9002);})[_0xdbdb('0x1e')](function(){if(_0xf08b3d){if(_[_0xdbdb('0xb4')](_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xb5')])){_0x595b2d[_0xdbdb('0x5c')]['from']=util[_0xdbdb('0xa9')](_0xdbdb('0xb6'),_0xf08b3d[_0xdbdb('0x3c')],_0xf08b3d['fax']);}if(_0xf08b3d['List']){if(_0xf08b3d[_0xdbdb('0xac')][_0xdbdb('0xb7')]['length']){return _0xf08b3d[_0xdbdb('0xac')][_0xdbdb('0xb7')][0x0];}else{return db[_0xdbdb('0x78')][_0xdbdb('0x5b')](_['defaults'](_0x595b2d[_0xdbdb('0x5c')],{'firstName':_0x595b2d[_0xdbdb('0x5c')]['to'][0x0],'phone':_0x595b2d['body']['to'][0x0],'fax':_0x595b2d[_0xdbdb('0x5c')]['to'][0x0],'ListId':_0xf08b3d[_0xdbdb('0xb8')]}));}}else{throw new Error(_0xdbdb('0xb9'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x267080){if(_0x267080){return db[_0xdbdb('0x74')][_0xdbdb('0x61')]({'where':{'ContactId':_0x267080['id'],'closed':![],'FaxAccountId':_0xf08b3d['id']}})['then'](function(_0x1b54c0){if(_0x1b54c0){return[_0x1b54c0,![]];}return db[_0xdbdb('0x74')][_0xdbdb('0x5b')]({'UserId':_0x595b2d[_0xdbdb('0x5d')]['id'],'ContactId':_0x267080['id'],'FaxAccountId':_0xf08b3d['id'],'fax':_0x595b2d[_0xdbdb('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xdbdb('0x53')](_0x595b2d[_0xdbdb('0x5c')],{'read':![],'body':_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xae')][0x0][_0xdbdb('0xba')],'FaxAccountId':_0xf08b3d['id'],'UserId':_0x595b2d[_0xdbdb('0x5d')]['id'],'ContactId':_0x267080['id'],'AttachmentId':_0x595b2d['body'][_0xdbdb('0xae')][0x0]['id']})]},{'include':[{'model':db[_0xdbdb('0xa8')],'as':_0xdbdb('0xbb')}]})[_0xdbdb('0x1e')](function(_0x36b10e){return[_0x36b10e,!![]];});});}else{throw new Error(_0xdbdb('0xbc'));}})[_0xdbdb('0xbd')](function(_0x21feef,_0x3fc971){if(_0x3fc971){return _0x21feef;}return db[_0xdbdb('0xa8')]['create']({'direction':_0xdbdb('0xbe'),'read':![],'body':_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xae')][0x0][_0xdbdb('0xba')],'FaxAccountId':_0xf08b3d['id'],'FaxInteractionId':_0x21feef['id'],'UserId':_0x595b2d[_0xdbdb('0x5d')]['id'],'ContactId':_0x21feef[_0xdbdb('0xbf')],'AttachmentId':_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xae')][0x0]['id']})['then'](function(_0x26285d){_0x21feef[_0xdbdb('0xc0')][_0xdbdb('0xbb')]=[];_0x21feef[_0xdbdb('0xc0')][_0xdbdb('0xbb')][_0xdbdb('0x93')](_0x26285d[_0xdbdb('0xc0')]);return _0x21feef;});})[_0xdbdb('0x1e')](function(_0x4ac11b){respondWithRpcPromise(_0xdbdb('0xc1'),_0xdbdb('0xc1'),{'FaxAccountId':_[_0xdbdb('0xb4')](_0x595b2d[_0xdbdb('0x58')]['id'])?undefined:_0x595b2d[_0xdbdb('0x58')]['id'],'path':_[_0xdbdb('0xb4')](_0x595b2d[_0xdbdb('0x5c')][_0xdbdb('0xae')][0x0][_0xdbdb('0x6')])?undefined:_0x595b2d['body']['attachments'][0x0][_0xdbdb('0x6')],'fax':_[_0xdbdb('0xb4')](_0x595b2d[_0xdbdb('0x5c')]['to'][0x0])?undefined:_0x595b2d[_0xdbdb('0x5c')]['to'][0x0],'AttachmentId':_0x595b2d[_0xdbdb('0x5c')]['attachments'][0x0]['id']},client9002)[_0xdbdb('0x1e')](function(_0x5e4177){logger['info'](_0xdbdb('0xc2'),_0x5e4177);})['catch'](function(_0x21d146){logger[_0xdbdb('0x27')](_0xdbdb('0xc2'),_0x21d146);});return _0x4ac11b;})['then'](respondWithResult(_0x50dc5b,null))[_0xdbdb('0x28')](handleError(_0x50dc5b,null));};exports[_0xdbdb('0xc3')]=function(_0x1df955,_0x4a7184,_0xfd709c){return db[_0xdbdb('0x41')][_0xdbdb('0x61')]({'where':{'id':_0x1df955[_0xdbdb('0x58')]['id']}})[_0xdbdb('0x1e')](handleEntityNotFound(_0x4a7184,null))[_0xdbdb('0x1e')](function(_0x4c3c56){if(_0x4c3c56){return _0x4c3c56[_0xdbdb('0xc3')](_0x1df955[_0xdbdb('0x5c')][_0xdbdb('0x6d')],_[_0xdbdb('0xa2')](_0x1df955[_0xdbdb('0x5c')],[_0xdbdb('0x6d'),'id'])||{})[_0xdbdb('0xbd')](function(_0x2e5b68){for(var _0x3a62f6=0x0;_0x3a62f6<_0x1df955[_0xdbdb('0x5c')]['ids'][_0xdbdb('0x4c')];_0x3a62f6+=0x1){socket['emit'](_0xdbdb('0xc4'),{'UserId':Number(_0x1df955[_0xdbdb('0x5c')][_0xdbdb('0x6d')][_0x3a62f6]),'FaxAccountId':Number(_0x1df955['params']['id'])});}return _0x2e5b68;});}})[_0xdbdb('0x1e')](respondWithResult(_0x4a7184,null))[_0xdbdb('0x28')](handleError(_0x4a7184,null));};exports['removeAgents']=function(_0x3d7e2f,_0x38e817,_0x3890ac){return db['FaxAccount'][_0xdbdb('0x61')]({'where':{'id':_0x3d7e2f[_0xdbdb('0x58')]['id']}})[_0xdbdb('0x1e')](handleEntityNotFound(_0x38e817,null))[_0xdbdb('0x1e')](function(_0x4d6f23){if(_0x4d6f23){return _0x4d6f23['removeAgents'](_0x3d7e2f[_0xdbdb('0x46')][_0xdbdb('0x6d')])[_0xdbdb('0x1e')](function(){if(_[_0xdbdb('0xc5')](_0x3d7e2f[_0xdbdb('0x46')]['ids'])){for(var _0x46c63a=0x0;_0x46c63a<_0x3d7e2f[_0xdbdb('0x46')]['ids'][_0xdbdb('0x4c')];_0x46c63a+=0x1){socket['emit'](_0xdbdb('0xc6'),{'UserId':Number(_0x3d7e2f[_0xdbdb('0x46')][_0xdbdb('0x6d')][_0x46c63a]),'FaxAccountId':Number(_0x3d7e2f[_0xdbdb('0x58')]['id'])});}}else{socket[_0xdbdb('0xc7')](_0xdbdb('0xc6'),{'UserId':Number(_0x3d7e2f['query'][_0xdbdb('0x6d')]),'FaxAccountId':Number(_0x3d7e2f['params']['id'])});}});}})[_0xdbdb('0x1e')](respondWithStatusCode(_0x38e817,null))[_0xdbdb('0x28')](handleError(_0x38e817,null));};exports['getAgents']=function(_0x4d1d76,_0x5e3992,_0x103758){var _0x476b25={};var _0x339c26={};var _0x32c12f;var _0x14f624;return db[_0xdbdb('0x41')][_0xdbdb('0x70')]({'where':{'id':_0x4d1d76[_0xdbdb('0x58')]['id']}})['then'](handleEntityNotFound(_0x5e3992,null))[_0xdbdb('0x1e')](function(_0x5d778f){if(_0x5d778f){_0x32c12f=_0x5d778f;_0x339c26['model']=_[_0xdbdb('0x47')](db[_0xdbdb('0x79')][_0xdbdb('0x59')]);_0x339c26['query']=_[_0xdbdb('0x47')](_0x4d1d76['query']);_0x339c26[_0xdbdb('0x50')]=_[_0xdbdb('0x48')](_0x339c26[_0xdbdb('0x49')],_0x339c26[_0xdbdb('0x46')]);_0x476b25[_0xdbdb('0x4a')]=_[_0xdbdb('0x48')](_0x339c26['model'],qs[_0xdbdb('0x4b')](_0x4d1d76[_0xdbdb('0x46')][_0xdbdb('0x4b')]));_0x476b25[_0xdbdb('0x4a')]=_0x476b25['attributes']['length']?_0x476b25[_0xdbdb('0x4a')]:_0x339c26[_0xdbdb('0x49')];_0x476b25[_0xdbdb('0x4e')]=qs[_0xdbdb('0x6a')](_0x4d1d76[_0xdbdb('0x46')][_0xdbdb('0x6a')]);_0x476b25[_0xdbdb('0x4f')]=qs[_0xdbdb('0x50')](_[_0xdbdb('0x51')](_0x4d1d76[_0xdbdb('0x46')],_0x339c26['filters']));if(_0x4d1d76['query'][_0xdbdb('0x52')]){_0x476b25[_0xdbdb('0x4f')]=_[_0xdbdb('0x53')](_0x476b25[_0xdbdb('0x4f')],{'$or':_[_0xdbdb('0x45')](_0x476b25[_0xdbdb('0x4a')],function(_0x2266ba){var _0x360f18={};_0x360f18[_0x2266ba]={'$like':'%'+_0x4d1d76['query'][_0xdbdb('0x52')]+'%'};return _0x360f18;})});}_0x476b25=_[_0xdbdb('0x53')]({},_0x476b25,_0x4d1d76['options']);return _0x32c12f[_0xdbdb('0xc8')](_0x476b25);}})[_0xdbdb('0x1e')](function(_0x5d9fc8){if(_0x5d9fc8){_0x14f624=_0x5d9fc8[_0xdbdb('0x4c')];if(!_0x4d1d76[_0xdbdb('0x46')]['hasOwnProperty'](_0xdbdb('0x4d'))){_0x476b25['limit']=qs[_0xdbdb('0x2e')](_0x4d1d76[_0xdbdb('0x46')]['limit']);_0x476b25[_0xdbdb('0x2c')]=qs[_0xdbdb('0x2c')](_0x4d1d76[_0xdbdb('0x46')][_0xdbdb('0x2c')]);}return _0x32c12f[_0xdbdb('0xc8')](_0x476b25);}})[_0xdbdb('0x1e')](function(_0x2ab12a){if(_0x2ab12a){return _0x2ab12a?{'count':_0x14f624,'rows':_0x2ab12a}:null;}})['then'](respondWithResult(_0x5e3992,null))[_0xdbdb('0x28')](handleError(_0x5e3992,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9165e0d..989bd1a 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 _0x6201=['FaxAccount','setMaxListeners','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3454f0,_0x31c6c6){var _0x528fdc=function(_0x1a36b6){while(--_0x1a36b6){_0x3454f0['push'](_0x3454f0['shift']());}};_0x528fdc(++_0x31c6c6);}(_0x6201,0xbf));var _0x1620=function(_0x2a5db8,_0x1f3188){_0x2a5db8=_0x2a5db8-0x0;var _0x5ce985=_0x6201[_0x2a5db8];return _0x5ce985;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x1620('0x0'))['db'][_0x1620('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1620('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1620('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4460c6){return function(_0x376842,_0x1fb81d,_0x1d2840){FaxAccountEvents[_0x1620('0x4')](_0x4460c6+':'+_0x376842['id'],_0x376842);FaxAccountEvents[_0x1620('0x4')](_0x4460c6,_0x376842);_0x1d2840(null);};}for(var e in events){if(events[_0x1620('0x5')](e)){var event=events[e];FaxAccount[_0x1620('0x6')](e,emitEvent(event));}}module[_0x1620('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x81df=['remove','emit','hook','../../mysqldb','setMaxListeners','update'];(function(_0x2fbc4f,_0x4d9a30){var _0x22b830=function(_0xaf5d92){while(--_0xaf5d92){_0x2fbc4f['push'](_0x2fbc4f['shift']());}};_0x22b830(++_0x4d9a30);}(_0x81df,0xf9));var _0xf81d=function(_0x111b81,_0x56c6df){_0x111b81=_0x111b81-0x0;var _0x1e9520=_0x81df[_0x111b81];return _0x1e9520;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xf81d('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf81d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf81d('0x2'),'afterDestroy':_0xf81d('0x3')};function emitEvent(_0x36df06){return function(_0x727df6,_0x2053a5,_0x44fcad){FaxAccountEvents[_0xf81d('0x4')](_0x36df06+':'+_0x727df6['id'],_0x727df6);FaxAccountEvents['emit'](_0x36df06,_0x727df6);_0x44fcad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xf81d('0x5')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f654526..285d6cb 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 _0x0cd1=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x409582,_0x1f0415){var _0xc9369d=function(_0x18dddf){while(--_0x18dddf){_0x409582['push'](_0x409582['shift']());}};_0xc9369d(++_0x1f0415);}(_0x0cd1,0xa3));var _0x10cd=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x0cd1[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require(_0x10cd('0x0'));var util=require(_0x10cd('0x1'));var logger=require(_0x10cd('0x2'))(_0x10cd('0x3'));var moment=require(_0x10cd('0x4'));var BPromise=require(_0x10cd('0x5'));var rp=require(_0x10cd('0x6'));var fs=require('fs');var path=require(_0x10cd('0x7'));var rimraf=require(_0x10cd('0x8'));var config=require(_0x10cd('0x9'));var attributes=require('./faxAccount.attributes');module[_0x10cd('0xa')]=function(_0x23a315,_0x26ae95){return _0x23a315[_0x10cd('0xb')](_0x10cd('0xc'),attributes,{'tableName':_0x10cd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cbc=['util','../../config/logger','moment','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x53643d,_0x180b1b){var _0x44ced5=function(_0xd7bd6){while(--_0xd7bd6){_0x53643d['push'](_0x53643d['shift']());}};_0x44ced5(++_0x180b1b);}(_0x0cbc,0x1ee));var _0xc0cb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0cbc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc0cb('0x0'));var util=require(_0xc0cb('0x1'));var logger=require(_0xc0cb('0x2'))('api');var moment=require(_0xc0cb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc0cb('0x4'));var config=require(_0xc0cb('0x5'));var attributes=require(_0xc0cb('0x6'));module[_0xc0cb('0x7')]=function(_0x137c14,_0x3102aa){return _0x137c14[_0xc0cb('0x8')](_0xc0cb('0x9'),attributes,{'tableName':_0xc0cb('0xa'),'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 9ced740..640e4e5 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 _0xfd86=['Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','unshift','agent','queueId','name','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFaxAccount','FaxAccount','raw','options','where','attributes','limit','include','map','model','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','contact','fax','FaxInteraction','find','create'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0xfd86,0x194));var _0x6fd8=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xfd86[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0x6fd8('0x0'));var util=require(_0x6fd8('0x1'));var moment=require(_0x6fd8('0x2'));var BPromise=require(_0x6fd8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6fd8('0x4'));var db=require(_0x6fd8('0x5'))['db'];var utils=require(_0x6fd8('0x6'));var logger=require('../../config/logger')(_0x6fd8('0x7'));var config=require('../../config/environment');var jayson=require(_0x6fd8('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x6fd8('0x9')]=_[_0x6fd8('0xa')](config['redis'],{'host':_0x6fd8('0xb'),'port':0x18eb});var socket=require(_0x6fd8('0xc'))(new Redis(config['redis']));require(_0x6fd8('0xd'))[_0x6fd8('0xe')](socket);function respondWithRpcPromise(_0x5f58a8,_0x53abc2,_0x40be00){return new BPromise(function(_0x135944,_0x5176a8){return client[_0x6fd8('0xf')](_0x5f58a8,_0x40be00)[_0x6fd8('0x10')](function(_0x154ec4){logger[_0x6fd8('0x11')](_0x6fd8('0x12'),_0x53abc2,'request\x20sent');logger[_0x6fd8('0x13')](_0x6fd8('0x14'),_0x53abc2,'request\x20sent',JSON[_0x6fd8('0x15')](_0x154ec4));if(_0x154ec4[_0x6fd8('0x16')]){if(_0x154ec4[_0x6fd8('0x16')][_0x6fd8('0x17')]===0x1f4){logger[_0x6fd8('0x16')](_0x6fd8('0x12'),_0x53abc2,_0x154ec4['error'][_0x6fd8('0x18')]);return _0x5176a8(_0x154ec4[_0x6fd8('0x16')][_0x6fd8('0x18')]);}logger[_0x6fd8('0x16')]('FaxAccount,\x20%s,\x20%s',_0x53abc2,_0x154ec4[_0x6fd8('0x16')][_0x6fd8('0x18')]);return _0x135944(_0x154ec4['error'][_0x6fd8('0x18')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x53abc2,_0x6fd8('0x19'));_0x135944(_0x154ec4[_0x6fd8('0x1a')]['message']);}})[_0x6fd8('0x1b')](function(_0xce1da4){logger[_0x6fd8('0x16')]('FaxAccount,\x20%s,\x20%s',_0x53abc2,_0xce1da4);_0x5176a8(_0xce1da4);});});}exports[_0x6fd8('0x1c')]=function(_0x7a9e72){var _0x503781=this;return new Promise(function(_0x328ca9,_0x3f5166){return db[_0x6fd8('0x1d')]['findAll']({'raw':_0x7a9e72['options']?_0x7a9e72['options'][_0x6fd8('0x1e')]===undefined?!![]:![]:!![],'where':_0x7a9e72['options']?_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x20')]||null:null,'attributes':_0x7a9e72[_0x6fd8('0x1f')]?_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x21')]||null:null,'limit':_0x7a9e72['options']?_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x22')]||null:null,'include':_0x7a9e72[_0x6fd8('0x1f')]?_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x23')]?_[_0x6fd8('0x24')](_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x23')],function(_0x9b758e){return{'model':db[_0x9b758e[_0x6fd8('0x25')]],'as':_0x9b758e['as'],'attributes':_0x9b758e[_0x6fd8('0x21')],'include':_0x9b758e[_0x6fd8('0x23')]?_[_0x6fd8('0x24')](_0x9b758e[_0x6fd8('0x23')],function(_0x5cf478){return{'model':db[_0x5cf478[_0x6fd8('0x25')]],'as':_0x5cf478['as'],'attributes':_0x5cf478[_0x6fd8('0x21')],'include':_0x5cf478[_0x6fd8('0x23')]?_[_0x6fd8('0x24')](_0x5cf478[_0x6fd8('0x23')],function(_0x1cad0a){return{'model':db[_0x1cad0a[_0x6fd8('0x25')]],'as':_0x1cad0a['as'],'attributes':_0x1cad0a[_0x6fd8('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bc437){logger['info'](_0x6fd8('0x1c'),_0x7a9e72);logger[_0x6fd8('0x13')](_0x6fd8('0x1c'),_0x7a9e72,JSON['stringify'](_0x5bc437));_0x328ca9(_0x5bc437);})['catch'](function(_0x187086){logger[_0x6fd8('0x16')]('GetFaxAccount',_0x187086[_0x6fd8('0x18')],_0x7a9e72);_0x3f5166(_0x503781[_0x6fd8('0x16')](0x1f4,_0x187086['message']));});});};exports[_0x6fd8('0x26')]=function(_0x130bed,_0x12e361,_0x3b1900){var _0x323beb=this;return new Promise(function(_0x28d49f,_0x5dfb){var _0x1537df={'body':_0x130bed[_0x6fd8('0x27')],'channel':'fax'};var _0x178350=[];var _0x429b25=[];var _0x59225b={};return db[_0x6fd8('0x28')][_0x6fd8('0x29')]()[_0x6fd8('0x10')](function(_0x26c97d){if(!_0x26c97d){throw new db[(_0x6fd8('0x2a'))][(_0x6fd8('0x2b'))](_0x6fd8('0x2c'));}_0x178350=_[_0x6fd8('0x2d')](_['keys'](_0x26c97d),[_0x6fd8('0x2e'),_0x6fd8('0x2f')]);_0x429b25=_[_0x6fd8('0x2d')](_[_0x6fd8('0x30')](_0x26c97d),[_0x6fd8('0x2e'),'updatedAt',_0x6fd8('0x31'),_0x6fd8('0x32')]);if(_0x130bed[_0x6fd8('0x27')]['id']){delete _0x130bed[_0x6fd8('0x27')]['id'];}if(_[_0x6fd8('0x33')](_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x34')])){throw new db[(_0x6fd8('0x2a'))][(_0x6fd8('0x2b'))](_0x6fd8('0x35'));}if(_['isNil'](_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x27')])||_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x27')]===''){throw new db[(_0x6fd8('0x2a'))][(_0x6fd8('0x2b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6fd8('0x33')](_0x130bed['body'][_0x6fd8('0x36')])){throw new db['Sequelize'][(_0x6fd8('0x2b'))](_0x6fd8('0x37')+_0x429b25);}if(!_['includes'](_0x429b25,_0x130bed[_0x6fd8('0x27')]['mapKey'])){throw new db[(_0x6fd8('0x2a'))][(_0x6fd8('0x2b'))](_0x6fd8('0x38')+_0x429b25);}_0x59225b[_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x36')]]=_0x130bed['body'][_0x6fd8('0x34')];})['then'](function(){return db[_0x6fd8('0x1d')]['find']({'where':{'id':_0x130bed[_0x6fd8('0x39')]['id']},'include':[{'model':db[_0x6fd8('0x3a')],'as':_0x6fd8('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x59225b,'limit':0x1,'order':[[_0x6fd8('0x2f'),_0x6fd8('0x3c')]]}]},{'model':db[_0x6fd8('0x3d')],'as':_0x6fd8('0x3e')}]});})['then'](function(_0x3f7d99){if(_0x3f7d99&&_0x3f7d99[_0x6fd8('0x3b')]){var _0x5e0d2b=_0x3f7d99[_0x6fd8('0x3f')]({'plain':!![]});_0x1537df['account']=_0x5e0d2b;_0x1537df[_0x6fd8('0x40')]=_0x5e0d2b[_0x6fd8('0x3e')];_0x1537df[_0x6fd8('0x41')]=_0x5e0d2b['List'];_0x1537df[_0x6fd8('0x40')]=_[_0x6fd8('0x42')](_0x1537df[_0x6fd8('0x40')],[_0x6fd8('0x43')],[_0x6fd8('0x44')]);if(_0x1537df[_0x6fd8('0x39')]['Applications']){delete _0x1537df[_0x6fd8('0x39')][_0x6fd8('0x3e')];}if(_0x1537df['account'][_0x6fd8('0x3b')]&&_0x1537df['account']['List'][_0x6fd8('0x45')][_0x6fd8('0x46')]){return _0x1537df[_0x6fd8('0x39')][_0x6fd8('0x3b')][_0x6fd8('0x45')][0x0];}var _0x494d54=_[_0x6fd8('0xa')](_0x130bed['body'],{'firstName':_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x34')],'ListId':_0x5e0d2b[_0x6fd8('0x32')]});_0x494d54[_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x36')]]=_0x130bed[_0x6fd8('0x27')]['from'];return db[_0x6fd8('0x28')]['create'](_0x494d54,{'fields':_0x178350,'raw':!![]});}})[_0x6fd8('0x10')](function(_0x3f0ca8){_0x1537df[_0x6fd8('0x47')]=_0x3f0ca8;if(_0x3f0ca8){var _0x3ffaab={'ContactId':_0x3f0ca8['id'],'FaxAccountId':_0x130bed[_0x6fd8('0x39')]['id'],'fax':_0x3f0ca8[_0x6fd8('0x48')]};return db[_0x6fd8('0x49')][_0x6fd8('0x4a')]({'where':{'ContactId':_0x3f0ca8['id'],'closed':![],'FaxAccountId':_0x130bed['account']['id']}})[_0x6fd8('0x10')](function(_0x55aed0){if(_0x55aed0){return[_0x55aed0,![]];}return db['FaxInteraction'][_0x6fd8('0x4b')](_0x3ffaab)[_0x6fd8('0x10')](function(_0x3c16f7){return[_0x3c16f7,!![]];});});}else{throw new Error(_0x6fd8('0x4c'));}})[_0x6fd8('0x4d')](function(_0x3b0949,_0x4a0071){var _0x38660a=_0x3b0949['get']({'plain':!![]});if(_0x4a0071){if(_0x1537df[_0x6fd8('0x39')][_0x6fd8('0x4e')]){_0x1537df[_0x6fd8('0x40')][_0x6fd8('0x4f')]({'id':0x0,'priority':_0x1537df[_0x6fd8('0x40')]['length']+0x1,'app':_0x6fd8('0x50'),'appdata':_0x6fd8('0x51'),'interval':_0x6fd8('0x52')});}_0x38660a[_0x6fd8('0x53')]=!![];}else{_0x38660a[_0x6fd8('0x53')]=![];}_0x1537df[_0x6fd8('0x54')]=_0x38660a;return db['FaxMessage'][_0x6fd8('0x4b')]({'body':_0x130bed[_0x6fd8('0x27')]['body'],'FaxAccountId':_0x130bed[_0x6fd8('0x39')]['id'],'FaxInteractionId':_0x3b0949['id'],'direction':'in','ContactId':_0x3b0949[_0x6fd8('0x55')],'AttachmentId':_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x56')]});})[_0x6fd8('0x10')](function(_0x31e037){_0x1537df['message']=_0x31e037;if(!_0x1537df[_0x6fd8('0x54')][_0x6fd8('0x57')])return;return db[_0x6fd8('0x58')][_0x6fd8('0x4a')]({'attributes':['id','name'],'where':{'id':_0x1537df[_0x6fd8('0x54')][_0x6fd8('0x57')]}});})[_0x6fd8('0x10')](function(_0x458385){if(_0x458385){_0x1537df['applications'][_0x6fd8('0x59')]({'id':0x0,'priority':0x0,'app':_0x6fd8('0x5a'),'appdata':_0x458385['name']+','+(_0x1537df[_0x6fd8('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0x6fd8('0x52')});}if(!_0x1537df['interaction'][_0x6fd8('0x5b')])return;return db['FaxQueue'][_0x6fd8('0x4a')]({'attributes':['id',_0x6fd8('0x5c')],'where':{'id':_0x1537df[_0x6fd8('0x54')][_0x6fd8('0x5b')]}});})[_0x6fd8('0x10')](function(_0x1250cf){if(_0x1250cf){_0x1537df[_0x6fd8('0x40')][_0x6fd8('0x59')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1250cf['name']+','+(_0x1537df[_0x6fd8('0x39')][_0x6fd8('0x5d')]||0x12c),'interval':_0x6fd8('0x52')});}return respondWithRpcPromise(_0x6fd8('0x5e'),_0x6fd8('0x5f'),_0x1537df);})[_0x6fd8('0x10')](function(_0x436cbe){_0x28d49f(_0x436cbe);})[_0x6fd8('0x1b')](function(_0x344c8f){_0x5dfb(_0x323beb[_0x6fd8('0x16')](0x1f4,_0x344c8f[_0x6fd8('0x18')]));});});}; \ No newline at end of file +var _0x4f6d=['DESC','FaxApplication','Applications','get','list','orderBy','applications','asc','contact','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','length','unmanaged','*,*,*,*','created','interaction','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetFaxAccount','FaxAccount','findAll','options','raw','map','include','model','attributes','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','Contacts'];(function(_0x46ca1c,_0x366258){var _0x23875a=function(_0x50f8fb){while(--_0x50f8fb){_0x46ca1c['push'](_0x46ca1c['shift']());}};_0x23875a(++_0x366258);}(_0x4f6d,0x18c));var _0xd4f6=function(_0x58d9ff,_0x1a97f6){_0x58d9ff=_0x58d9ff-0x0;var _0x2c3132=_0x4f6d[_0x58d9ff];return _0x2c3132;};'use strict';var _=require('lodash');var util=require(_0xd4f6('0x0'));var moment=require(_0xd4f6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4f6('0x2'));var db=require(_0xd4f6('0x3'))['db'];var utils=require(_0xd4f6('0x4'));var logger=require(_0xd4f6('0x5'))(_0xd4f6('0x6'));var config=require('../../config/environment');var jayson=require(_0xd4f6('0x7'));var client=jayson[_0xd4f6('0x8')][_0xd4f6('0x9')]({'port':0x232c});config['redis']=_[_0xd4f6('0xa')](config[_0xd4f6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd4f6('0xc'))(new Redis(config['redis']));require(_0xd4f6('0xd'))[_0xd4f6('0xe')](socket);function respondWithRpcPromise(_0x302bd7,_0x741d1b,_0x5486ea){return new BPromise(function(_0x4c6dbe,_0x14aadb){return client[_0xd4f6('0xf')](_0x302bd7,_0x5486ea)[_0xd4f6('0x10')](function(_0x2cd1ba){logger['info'](_0xd4f6('0x11'),_0x741d1b,_0xd4f6('0x12'));logger[_0xd4f6('0x13')](_0xd4f6('0x14'),_0x741d1b,_0xd4f6('0x12'),JSON[_0xd4f6('0x15')](_0x2cd1ba));if(_0x2cd1ba[_0xd4f6('0x16')]){if(_0x2cd1ba['error'][_0xd4f6('0x17')]===0x1f4){logger['error'](_0xd4f6('0x11'),_0x741d1b,_0x2cd1ba[_0xd4f6('0x16')][_0xd4f6('0x18')]);return _0x14aadb(_0x2cd1ba['error'][_0xd4f6('0x18')]);}logger['error'](_0xd4f6('0x11'),_0x741d1b,_0x2cd1ba[_0xd4f6('0x16')][_0xd4f6('0x18')]);return _0x4c6dbe(_0x2cd1ba[_0xd4f6('0x16')][_0xd4f6('0x18')]);}else{logger[_0xd4f6('0x19')](_0xd4f6('0x11'),_0x741d1b,_0xd4f6('0x12'));_0x4c6dbe(_0x2cd1ba['result'][_0xd4f6('0x18')]);}})[_0xd4f6('0x1a')](function(_0x3f7202){logger[_0xd4f6('0x16')](_0xd4f6('0x11'),_0x741d1b,_0x3f7202);_0x14aadb(_0x3f7202);});});}exports[_0xd4f6('0x1b')]=function(_0x1260dc){var _0x1ec432=this;return new Promise(function(_0x28250b,_0x190ddb){return db[_0xd4f6('0x1c')][_0xd4f6('0x1d')]({'raw':_0x1260dc[_0xd4f6('0x1e')]?_0x1260dc[_0xd4f6('0x1e')][_0xd4f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x1260dc[_0xd4f6('0x1e')]?_0x1260dc['options']['where']||null:null,'attributes':_0x1260dc['options']?_0x1260dc[_0xd4f6('0x1e')]['attributes']||null:null,'limit':_0x1260dc[_0xd4f6('0x1e')]?_0x1260dc[_0xd4f6('0x1e')]['limit']||null:null,'include':_0x1260dc[_0xd4f6('0x1e')]?_0x1260dc['options']['include']?_[_0xd4f6('0x20')](_0x1260dc['options'][_0xd4f6('0x21')],function(_0x248068){return{'model':db[_0x248068[_0xd4f6('0x22')]],'as':_0x248068['as'],'attributes':_0x248068['attributes'],'include':_0x248068[_0xd4f6('0x21')]?_['map'](_0x248068['include'],function(_0x5cedef){return{'model':db[_0x5cedef[_0xd4f6('0x22')]],'as':_0x5cedef['as'],'attributes':_0x5cedef['attributes'],'include':_0x5cedef[_0xd4f6('0x21')]?_['map'](_0x5cedef[_0xd4f6('0x21')],function(_0x57eaa1){return{'model':db[_0x57eaa1['model']],'as':_0x57eaa1['as'],'attributes':_0x57eaa1[_0xd4f6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd4f6('0x10')](function(_0x5893bf){logger[_0xd4f6('0x19')](_0xd4f6('0x1b'),_0x1260dc);logger[_0xd4f6('0x13')](_0xd4f6('0x1b'),_0x1260dc,JSON['stringify'](_0x5893bf));_0x28250b(_0x5893bf);})['catch'](function(_0x2b983e){logger['error']('GetFaxAccount',_0x2b983e[_0xd4f6('0x18')],_0x1260dc);_0x190ddb(_0x1ec432[_0xd4f6('0x16')](0x1f4,_0x2b983e[_0xd4f6('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x386461,_0x5f1e92,_0x5904dc){var _0x98c6a4=this;return new Promise(function(_0x46306b,_0x4f81c2){var _0x207396={'body':_0x386461[_0xd4f6('0x24')],'channel':_0xd4f6('0x25')};var _0x5c47dd=[];var _0x2c489e=[];var _0x2816fb={};return db[_0xd4f6('0x26')]['describe']()[_0xd4f6('0x10')](function(_0x372b53){if(!_0x372b53){throw new db[(_0xd4f6('0x27'))][(_0xd4f6('0x28'))](_0xd4f6('0x29'));}_0x5c47dd=_['difference'](_[_0xd4f6('0x2a')](_0x372b53),['createdAt',_0xd4f6('0x2b')]);_0x2c489e=_[_0xd4f6('0x2c')](_['keys'](_0x372b53),['createdAt','updatedAt',_0xd4f6('0x2d'),_0xd4f6('0x2e')]);if(_0x386461[_0xd4f6('0x24')]['id']){delete _0x386461[_0xd4f6('0x24')]['id'];}if(_[_0xd4f6('0x2f')](_0x386461[_0xd4f6('0x24')]['from'])){throw new db[(_0xd4f6('0x27'))][(_0xd4f6('0x28'))](_0xd4f6('0x30'));}if(_[_0xd4f6('0x2f')](_0x386461[_0xd4f6('0x24')][_0xd4f6('0x24')])||_0x386461['body'][_0xd4f6('0x24')]===''){throw new db['Sequelize'][(_0xd4f6('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd4f6('0x2f')](_0x386461[_0xd4f6('0x24')][_0xd4f6('0x31')])){throw new db[(_0xd4f6('0x27'))][(_0xd4f6('0x28'))](_0xd4f6('0x32')+_0x2c489e);}if(!_[_0xd4f6('0x33')](_0x2c489e,_0x386461[_0xd4f6('0x24')][_0xd4f6('0x31')])){throw new db['Sequelize'][(_0xd4f6('0x28'))](_0xd4f6('0x34')+_0x2c489e);}_0x2816fb[_0x386461[_0xd4f6('0x24')][_0xd4f6('0x31')]]=_0x386461['body'][_0xd4f6('0x35')];})[_0xd4f6('0x10')](function(){return db['FaxAccount'][_0xd4f6('0x36')]({'where':{'id':_0x386461[_0xd4f6('0x37')]['id']},'include':[{'model':db[_0xd4f6('0x38')],'as':_0xd4f6('0x39'),'include':[{'model':db[_0xd4f6('0x26')],'as':_0xd4f6('0x3a'),'where':_0x2816fb,'limit':0x1,'order':[[_0xd4f6('0x2b'),_0xd4f6('0x3b')]]}]},{'model':db[_0xd4f6('0x3c')],'as':_0xd4f6('0x3d')}]});})[_0xd4f6('0x10')](function(_0x502e16){if(_0x502e16&&_0x502e16[_0xd4f6('0x39')]){var _0x25f8fb=_0x502e16[_0xd4f6('0x3e')]({'plain':!![]});_0x207396[_0xd4f6('0x37')]=_0x25f8fb;_0x207396['applications']=_0x25f8fb[_0xd4f6('0x3d')];_0x207396[_0xd4f6('0x3f')]=_0x25f8fb[_0xd4f6('0x39')];_0x207396['applications']=_[_0xd4f6('0x40')](_0x207396[_0xd4f6('0x41')],['priority'],[_0xd4f6('0x42')]);if(_0x207396[_0xd4f6('0x37')][_0xd4f6('0x3d')]){delete _0x207396[_0xd4f6('0x37')][_0xd4f6('0x3d')];}if(_0x207396[_0xd4f6('0x37')][_0xd4f6('0x39')]&&_0x207396[_0xd4f6('0x37')][_0xd4f6('0x39')][_0xd4f6('0x3a')]['length']){return _0x207396[_0xd4f6('0x37')][_0xd4f6('0x39')][_0xd4f6('0x3a')][0x0];}var _0x218f45=_[_0xd4f6('0xa')](_0x386461[_0xd4f6('0x24')],{'firstName':_0x386461[_0xd4f6('0x24')]['from'],'ListId':_0x25f8fb['ListId']});_0x218f45[_0x386461[_0xd4f6('0x24')][_0xd4f6('0x31')]]=_0x386461[_0xd4f6('0x24')][_0xd4f6('0x35')];return db[_0xd4f6('0x26')]['create'](_0x218f45,{'fields':_0x5c47dd,'raw':!![]});}})[_0xd4f6('0x10')](function(_0x53abe6){_0x207396[_0xd4f6('0x43')]=_0x53abe6;if(_0x53abe6){var _0x2af531={'ContactId':_0x53abe6['id'],'FaxAccountId':_0x386461[_0xd4f6('0x37')]['id'],'fax':_0x53abe6[_0xd4f6('0x25')]};return db[_0xd4f6('0x44')][_0xd4f6('0x36')]({'where':{'ContactId':_0x53abe6['id'],'closed':![],'FaxAccountId':_0x386461[_0xd4f6('0x37')]['id']}})[_0xd4f6('0x10')](function(_0x2eab71){if(_0x2eab71){return[_0x2eab71,![]];}return db[_0xd4f6('0x44')][_0xd4f6('0x45')](_0x2af531)[_0xd4f6('0x10')](function(_0x1e4c35){return[_0x1e4c35,!![]];});});}else{throw new Error(_0xd4f6('0x46'));}})['spread'](function(_0xc8ca2e,_0x2e6f66){var _0x14e390=_0xc8ca2e[_0xd4f6('0x3e')]({'plain':!![]});if(_0x2e6f66){if(_0x207396[_0xd4f6('0x37')][_0xd4f6('0x47')]){_0x207396[_0xd4f6('0x41')][_0xd4f6('0x48')]({'id':0x0,'priority':_0x207396[_0xd4f6('0x41')][_0xd4f6('0x49')]+0x1,'app':'close','appdata':_0xd4f6('0x4a'),'interval':_0xd4f6('0x4b')});}_0x14e390['created']=!![];}else{_0x14e390[_0xd4f6('0x4c')]=![];}_0x207396[_0xd4f6('0x4d')]=_0x14e390;return db['FaxMessage'][_0xd4f6('0x45')]({'body':_0x386461[_0xd4f6('0x24')][_0xd4f6('0x24')],'FaxAccountId':_0x386461[_0xd4f6('0x37')]['id'],'FaxInteractionId':_0xc8ca2e['id'],'direction':'in','ContactId':_0xc8ca2e['ContactId'],'AttachmentId':_0x386461[_0xd4f6('0x24')][_0xd4f6('0x4e')]});})[_0xd4f6('0x10')](function(_0x416643){_0x207396[_0xd4f6('0x18')]=_0x416643;if(!_0x207396[_0xd4f6('0x4d')][_0xd4f6('0x4f')])return;return db[_0xd4f6('0x50')][_0xd4f6('0x36')]({'attributes':['id',_0xd4f6('0x51')],'where':{'id':_0x207396[_0xd4f6('0x4d')][_0xd4f6('0x4f')]}});})['then'](function(_0xd9ae90){if(_0xd9ae90){_0x207396[_0xd4f6('0x41')][_0xd4f6('0x52')]({'id':0x0,'priority':0x0,'app':_0xd4f6('0x53'),'appdata':_0xd9ae90[_0xd4f6('0x51')]+','+(_0x207396[_0xd4f6('0x37')][_0xd4f6('0x54')]||0xa),'interval':'*,*,*,*'});}if(!_0x207396[_0xd4f6('0x4d')][_0xd4f6('0x55')])return;return db[_0xd4f6('0x56')][_0xd4f6('0x36')]({'attributes':['id',_0xd4f6('0x51')],'where':{'id':_0x207396[_0xd4f6('0x4d')][_0xd4f6('0x55')]}});})[_0xd4f6('0x10')](function(_0x1177f5){if(_0x1177f5){_0x207396[_0xd4f6('0x41')][_0xd4f6('0x52')]({'id':0x0,'priority':0x1,'app':_0xd4f6('0x57'),'appdata':_0x1177f5['name']+','+(_0x207396[_0xd4f6('0x37')][_0xd4f6('0x58')]||0x12c),'interval':_0xd4f6('0x4b')});}return respondWithRpcPromise(_0xd4f6('0x59'),_0xd4f6('0x5a'),_0x207396);})[_0xd4f6('0x10')](function(_0x234783){_0x46306b(_0x234783);})['catch'](function(_0x6a417f){_0x4f81c2(_0x98c6a4['error'](0x1f4,_0x6a417f[_0xd4f6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 12f80ad..4b61880 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 _0xe0b2=['emit','removeListener','length','./faxAccount.events','save','remove','update'];(function(_0x29a134,_0x194c27){var _0x136398=function(_0x1def82){while(--_0x1def82){_0x29a134['push'](_0x29a134['shift']());}};_0x136398(++_0x194c27);}(_0xe0b2,0xff));var _0x2e0b=function(_0x5166cb,_0x32da82){_0x5166cb=_0x5166cb-0x0;var _0x5dd083=_0xe0b2[_0x5166cb];return _0x5dd083;};'use strict';var FaxAccountEvents=require(_0x2e0b('0x0'));var events=[_0x2e0b('0x1'),_0x2e0b('0x2'),_0x2e0b('0x3')];function createListener(_0x669bf0,_0x51bae1){return function(_0x4c7248){_0x51bae1[_0x2e0b('0x4')](_0x669bf0,_0x4c7248);};}function removeListener(_0x59819e,_0x5467f0){return function(){FaxAccountEvents[_0x2e0b('0x5')](_0x59819e,_0x5467f0);};}exports['register']=function(_0x5aac39){for(var _0x59b271=0x0,_0x21e9c4=events[_0x2e0b('0x6')];_0x59b271<_0x21e9c4;_0x59b271++){var _0x48bb7=events[_0x59b271];var _0x5bd8f9=createListener('faxAccount:'+_0x48bb7,_0x5aac39);FaxAccountEvents['on'](_0x48bb7,_0x5bd8f9);}}; \ No newline at end of file +var _0x8203=['register','length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x8203,0x1d7));var _0x3820=function(_0x517f9c,_0x3c0f00){_0x517f9c=_0x517f9c-0x0;var _0x5dc4f7=_0x8203[_0x517f9c];return _0x5dc4f7;};'use strict';var FaxAccountEvents=require(_0x3820('0x0'));var events=[_0x3820('0x1'),_0x3820('0x2'),_0x3820('0x3')];function createListener(_0x5c762c,_0x5698d0){return function(_0x560000){_0x5698d0[_0x3820('0x4')](_0x5c762c,_0x560000);};}function removeListener(_0x9ea798,_0x13ac07){return function(){FaxAccountEvents[_0x3820('0x5')](_0x9ea798,_0x13ac07);};}exports[_0x3820('0x6')]=function(_0x441d2c){for(var _0x1b2c48=0x0,_0x3aa88b=events[_0x3820('0x7')];_0x1b2c48<_0x3aa88b;_0x1b2c48++){var _0x43741e=events[_0x1b2c48];var _0x4b70f1=createListener(_0x3820('0x8')+_0x43741e,_0x441d2c);FaxAccountEvents['on'](_0x43741e,_0x4b70f1);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index fc8438c..8ed226b 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 _0x2856=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','getMessages','/:id/users','getAgents','post','create','addDisposition','addInteraction','/:id/applications','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents'];(function(_0x2d1d2c,_0x23f59a){var _0x3ca6f6=function(_0x2ed0ef){while(--_0x2ed0ef){_0x2d1d2c['push'](_0x2d1d2c['shift']());}};_0x3ca6f6(++_0x23f59a);}(_0x2856,0x1b9));var _0x6285=function(_0x4ad720,_0x5e8523){_0x4ad720=_0x4ad720-0x0;var _0x30f9de=_0x2856[_0x4ad720];return _0x30f9de;};'use strict';var multer=require(_0x6285('0x0'));var util=require(_0x6285('0x1'));var path=require(_0x6285('0x2'));var timeout=require(_0x6285('0x3'));var express=require(_0x6285('0x4'));var router=express[_0x6285('0x5')]();var fs_extra=require(_0x6285('0x6'));var auth=require(_0x6285('0x7'));var interaction=require(_0x6285('0x8'));var config=require('../../config/environment');var controller=require(_0x6285('0x9'));router[_0x6285('0xa')]('/',auth[_0x6285('0xb')](),controller['index']);router[_0x6285('0xa')](_0x6285('0xc'),auth[_0x6285('0xb')](),controller[_0x6285('0xd')]);router[_0x6285('0xa')](_0x6285('0xe'),auth[_0x6285('0xb')](),controller[_0x6285('0xf')]);router[_0x6285('0xa')](_0x6285('0x10'),auth['isAuthenticated'](),controller[_0x6285('0x11')]);router[_0x6285('0xa')](_0x6285('0x12'),auth['isAuthenticated'](),controller[_0x6285('0x13')]);router[_0x6285('0xa')](_0x6285('0x14'),auth[_0x6285('0xb')](),controller[_0x6285('0x15')]);router[_0x6285('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6285('0x16')]);router['get']('/:id/messages',auth[_0x6285('0xb')](),controller[_0x6285('0x17')]);router[_0x6285('0xa')](_0x6285('0x18'),auth[_0x6285('0xb')](),controller[_0x6285('0x19')]);router[_0x6285('0x1a')]('/',auth[_0x6285('0xb')](),controller[_0x6285('0x1b')]);router[_0x6285('0x1a')](_0x6285('0x10'),auth['isAuthenticated'](),controller[_0x6285('0x1c')]);router[_0x6285('0x1a')](_0x6285('0x12'),auth[_0x6285('0xb')](),controller['addAnswer']);router[_0x6285('0x1a')]('/:id/interactions',auth[_0x6285('0xb')](),controller[_0x6285('0x1d')]);router[_0x6285('0x1a')](_0x6285('0x1e'),auth[_0x6285('0xb')](),controller[_0x6285('0x1f')]);router[_0x6285('0x1a')]('/addaccountapplications',auth[_0x6285('0xb')](),controller[_0x6285('0x20')]);router[_0x6285('0x1a')](_0x6285('0x21'),auth[_0x6285('0xb')](),controller[_0x6285('0x22')]);router[_0x6285('0x1a')](_0x6285('0x23'),auth[_0x6285('0xb')](),controller[_0x6285('0x24')]);router['post'](_0x6285('0x18'),auth['isAuthenticated'](),controller['addAgents']);router[_0x6285('0x25')](_0x6285('0xe'),auth[_0x6285('0xb')](),controller[_0x6285('0x26')]);router[_0x6285('0x27')](_0x6285('0xe'),auth[_0x6285('0xb')](),controller[_0x6285('0x28')]);router[_0x6285('0x27')](_0x6285('0x10'),auth[_0x6285('0xb')](),controller['removeDispositions']);router['delete'](_0x6285('0x12'),auth[_0x6285('0xb')](),controller[_0x6285('0x29')]);router[_0x6285('0x27')](_0x6285('0x18'),auth['isAuthenticated'](),controller[_0x6285('0x2a')]);module[_0x6285('0x2b')]=router; \ No newline at end of file +var _0xec38=['send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send'];(function(_0x355ef4,_0x514e9d){var _0x28c2cd=function(_0x57e473){while(--_0x57e473){_0x355ef4['push'](_0x355ef4['shift']());}};_0x28c2cd(++_0x514e9d);}(_0xec38,0xda));var _0x8ec3=function(_0x46e749,_0x9b62a){_0x46e749=_0x46e749-0x0;var _0x1b776f=_0xec38[_0x46e749];return _0x1b776f;};'use strict';var multer=require(_0x8ec3('0x0'));var util=require(_0x8ec3('0x1'));var path=require(_0x8ec3('0x2'));var timeout=require(_0x8ec3('0x3'));var express=require(_0x8ec3('0x4'));var router=express['Router']();var fs_extra=require(_0x8ec3('0x5'));var auth=require(_0x8ec3('0x6'));var interaction=require(_0x8ec3('0x7'));var config=require(_0x8ec3('0x8'));var controller=require('./faxAccount.controller');router[_0x8ec3('0x9')]('/',auth[_0x8ec3('0xa')](),controller[_0x8ec3('0xb')]);router[_0x8ec3('0x9')](_0x8ec3('0xc'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0xd')]);router[_0x8ec3('0x9')](_0x8ec3('0xe'),auth['isAuthenticated'](),controller[_0x8ec3('0xf')]);router['get'](_0x8ec3('0x10'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x11')]);router[_0x8ec3('0x9')](_0x8ec3('0x12'),auth[_0x8ec3('0xa')](),controller['getAnswers']);router[_0x8ec3('0x9')](_0x8ec3('0x13'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x14')]);router[_0x8ec3('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8ec3('0x15')]);router[_0x8ec3('0x9')](_0x8ec3('0x16'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x17')]);router[_0x8ec3('0x9')](_0x8ec3('0x18'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x19')]);router[_0x8ec3('0x1a')]('/',auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x1b')]);router['post'](_0x8ec3('0x10'),auth['isAuthenticated'](),controller[_0x8ec3('0x1c')]);router[_0x8ec3('0x1a')](_0x8ec3('0x12'),auth[_0x8ec3('0xa')](),controller['addAnswer']);router['post'](_0x8ec3('0x13'),auth[_0x8ec3('0xa')](),controller['addInteraction']);router[_0x8ec3('0x1a')]('/:id/applications',auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x1d')]);router[_0x8ec3('0x1a')](_0x8ec3('0x1e'),auth[_0x8ec3('0xa')](),controller['addAccountApplications']);router[_0x8ec3('0x1a')](_0x8ec3('0x1f'),auth['isAuthenticated'](),controller[_0x8ec3('0x20')]);router[_0x8ec3('0x1a')](_0x8ec3('0x21'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x22')]);router[_0x8ec3('0x1a')](_0x8ec3('0x18'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x23')]);router[_0x8ec3('0x24')](_0x8ec3('0xe'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x25')]);router[_0x8ec3('0x26')]('/:id',auth[_0x8ec3('0xa')](),controller['destroy']);router[_0x8ec3('0x26')](_0x8ec3('0x10'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x27')]);router[_0x8ec3('0x26')](_0x8ec3('0x12'),auth[_0x8ec3('0xa')](),controller[_0x8ec3('0x28')]);router[_0x8ec3('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0x8ec3('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 4bda443..759c934 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 _0xba88=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xba88,0xed));var _0x8ba8=function(_0x2518b8,_0x1f7c6b){_0x2518b8=_0x2518b8-0x0;var _0x287276=_0xba88[_0x2518b8];return _0x287276;};'use strict';var Sequelize=require(_0x8ba8('0x0'));module[_0x8ba8('0x1')]={'priority':{'type':Sequelize[_0x8ba8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8ba8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8ba8('0x4')]()},'description':{'type':Sequelize[_0x8ba8('0x3')]},'interval':{'type':Sequelize[_0x8ba8('0x3')],'defaultValue':_0x8ba8('0x5')}}; \ No newline at end of file +var _0x654a=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x4562ba,_0x321b17){var _0x1a5d91=function(_0x3d8f1c){while(--_0x3d8f1c){_0x4562ba['push'](_0x4562ba['shift']());}};_0x1a5d91(++_0x321b17);}(_0x654a,0x1e3));var _0xa654=function(_0x2fc3ae,_0x42da14){_0x2fc3ae=_0x2fc3ae-0x0;var _0x26175b=_0x654a[_0x2fc3ae];return _0x26175b;};'use strict';var Sequelize=require(_0xa654('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa654('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa654('0x2')],'allowNull':![],'defaultValue':_0xa654('0x3')},'appdata':{'type':Sequelize[_0xa654('0x4')]()},'description':{'type':Sequelize[_0xa654('0x2')]},'interval':{'type':Sequelize[_0xa654('0x2')],'defaultValue':_0xa654('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index fdd4880..463f20e 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 _0xb695=['catch','show','keys','rawAttributes','options','create','body','find','params','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','index','map','FaxApplication','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','include','rows'];(function(_0x1cbfc8,_0x533fe9){var _0x18a825=function(_0x2868d6){while(--_0x2868d6){_0x1cbfc8['push'](_0x1cbfc8['shift']());}};_0x18a825(++_0x533fe9);}(_0xb695,0xd8));var _0x5b69=function(_0x5efc23,_0x220d8b){_0x5efc23=_0x5efc23-0x0;var _0xf08559=_0xb695[_0x5efc23];return _0xf08559;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b69('0x0'));var rp=require('request-promise');var moment=require(_0x5b69('0x1'));var BPromise=require(_0x5b69('0x2'));var Mustache=require(_0x5b69('0x3'));var util=require(_0x5b69('0x4'));var path=require(_0x5b69('0x5'));var sox=require('sox');var csv=require(_0x5b69('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b69('0x7'));var _=require(_0x5b69('0x8'));var squel=require(_0x5b69('0x9'));var crypto=require(_0x5b69('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5b69('0xb'));var toCsv=require(_0x5b69('0x6'));var querystring=require(_0x5b69('0xc'));var Papa=require(_0x5b69('0xd'));var Redis=require(_0x5b69('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5b69('0xf'));var hardwareService=require(_0x5b69('0x10'));var logger=require(_0x5b69('0x11'))(_0x5b69('0x12'));var utils=require(_0x5b69('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5b69('0x14'));var db=require(_0x5b69('0x15'))['db'];function respondWithStatusCode(_0x26a3db,_0x45a551){_0x45a551=_0x45a551||0xcc;return function(_0xab2707){if(_0xab2707){return _0x26a3db['sendStatus'](_0x45a551);}return _0x26a3db['status'](_0x45a551)[_0x5b69('0x16')]();};}function respondWithResult(_0x1c2214,_0xf35c){_0xf35c=_0xf35c||0xc8;return function(_0x235da7){if(_0x235da7){return _0x1c2214[_0x5b69('0x17')](_0xf35c)[_0x5b69('0x18')](_0x235da7);}};}function respondWithFilteredResult(_0x5a4e68,_0x78af68){return function(_0x289325){if(_0x289325){var _0x472656=typeof _0x78af68[_0x5b69('0x19')]===_0x5b69('0x1a')&&typeof _0x78af68[_0x5b69('0x1b')]===_0x5b69('0x1a');var _0x32e679=_0x289325['count'];var _0x41724d=_0x472656?0x0:_0x78af68[_0x5b69('0x19')];var _0x3813c0=_0x472656?_0x289325[_0x5b69('0x1c')]:_0x78af68[_0x5b69('0x19')]+_0x78af68[_0x5b69('0x1b')];var _0x2fb05d;if(_0x3813c0>=_0x32e679){_0x3813c0=_0x32e679;_0x2fb05d=0xc8;}else{_0x2fb05d=0xce;}_0x5a4e68[_0x5b69('0x17')](_0x2fb05d);return _0x5a4e68[_0x5b69('0x1d')](_0x5b69('0x1e'),_0x41724d+'-'+_0x3813c0+'/'+_0x32e679)['json'](_0x289325);}return null;};}function patchUpdates(_0x9728af){return function(_0x487cce){try{jsonpatch['apply'](_0x487cce,_0x9728af,!![]);}catch(_0x162cfb){return BPromise['reject'](_0x162cfb);}return _0x487cce[_0x5b69('0x1f')]();};}function saveUpdates(_0x124cb1,_0x3a3e9e){return function(_0x280b4a){if(_0x280b4a){return _0x280b4a[_0x5b69('0x20')](_0x124cb1)['then'](function(_0x5c7cc3){return _0x5c7cc3;});}return null;};}function removeEntity(_0x515aa9,_0x173f06){return function(_0x2197e1){if(_0x2197e1){return _0x2197e1[_0x5b69('0x21')]()[_0x5b69('0x22')](function(){_0x515aa9[_0x5b69('0x17')](0xcc)[_0x5b69('0x16')]();});}};}function handleEntityNotFound(_0x8d24f6,_0xd2a3d){return function(_0x16ce84){if(!_0x16ce84){_0x8d24f6[_0x5b69('0x23')](0x194);}return _0x16ce84;};}function handleError(_0x2b8a3a,_0x237782){_0x237782=_0x237782||0x1f4;return function(_0x3706d6){logger[_0x5b69('0x24')](_0x3706d6[_0x5b69('0x25')]);if(_0x3706d6[_0x5b69('0x26')]){delete _0x3706d6['name'];}_0x2b8a3a[_0x5b69('0x17')](_0x237782)['send'](_0x3706d6);};}exports[_0x5b69('0x27')]=function(_0x4d0d98,_0x2e8d50){var _0x3c1677={},_0xbce8d4={},_0x21f051={'count':0x0,'rows':[]};var _0x3ff5d4=_[_0x5b69('0x28')](db[_0x5b69('0x29')]['rawAttributes'],function(_0x33e13f){return{'name':_0x33e13f[_0x5b69('0x2a')],'type':_0x33e13f['type']['key']};});_0xbce8d4[_0x5b69('0x2b')]=_[_0x5b69('0x28')](_0x3ff5d4,_0x5b69('0x26'));_0xbce8d4[_0x5b69('0x2c')]=_['keys'](_0x4d0d98[_0x5b69('0x2c')]);_0xbce8d4[_0x5b69('0x2d')]=_[_0x5b69('0x2e')](_0xbce8d4[_0x5b69('0x2b')],_0xbce8d4[_0x5b69('0x2c')]);_0x3c1677[_0x5b69('0x2f')]=_[_0x5b69('0x2e')](_0xbce8d4[_0x5b69('0x2b')],qs[_0x5b69('0x30')](_0x4d0d98[_0x5b69('0x2c')][_0x5b69('0x30')]));_0x3c1677[_0x5b69('0x2f')]=_0x3c1677['attributes'][_0x5b69('0x31')]?_0x3c1677[_0x5b69('0x2f')]:_0xbce8d4[_0x5b69('0x2b')];if(!_0x4d0d98[_0x5b69('0x2c')][_0x5b69('0x32')](_0x5b69('0x33'))){_0x3c1677[_0x5b69('0x1b')]=qs['limit'](_0x4d0d98[_0x5b69('0x2c')][_0x5b69('0x1b')]);_0x3c1677[_0x5b69('0x19')]=qs['offset'](_0x4d0d98[_0x5b69('0x2c')][_0x5b69('0x19')]);}_0x3c1677[_0x5b69('0x34')]=qs[_0x5b69('0x35')](_0x4d0d98['query'][_0x5b69('0x35')]);_0x3c1677[_0x5b69('0x36')]=qs[_0x5b69('0x2d')](_[_0x5b69('0x37')](_0x4d0d98[_0x5b69('0x2c')],_0xbce8d4['filters']),_0x3ff5d4);if(_0x4d0d98['query']['filter']){_0x3c1677['where']=_['merge'](_0x3c1677['where'],{'$or':_['map'](_0x3ff5d4,function(_0x25a70a){if(_0x25a70a['type']!==_0x5b69('0x38')){var _0xa43cd0={};_0xa43cd0[_0x25a70a[_0x5b69('0x26')]]={'$like':'%'+_0x4d0d98[_0x5b69('0x2c')]['filter']+'%'};return _0xa43cd0;}})});}_0x3c1677=_[_0x5b69('0x39')]({},_0x3c1677,_0x4d0d98['options']);var _0x302c86={'where':_0x3c1677[_0x5b69('0x36')]};return db[_0x5b69('0x29')][_0x5b69('0x1c')](_0x302c86)[_0x5b69('0x22')](function(_0x2b4f0b){_0x21f051[_0x5b69('0x1c')]=_0x2b4f0b;if(_0x4d0d98[_0x5b69('0x2c')]['includeAll']){_0x3c1677[_0x5b69('0x3a')]=[{'all':!![]}];}return db[_0x5b69('0x29')]['findAll'](_0x3c1677);})['then'](function(_0x576ebf){_0x21f051[_0x5b69('0x3b')]=_0x576ebf;return _0x21f051;})[_0x5b69('0x22')](respondWithFilteredResult(_0x2e8d50,_0x3c1677))[_0x5b69('0x3c')](handleError(_0x2e8d50,null));};exports[_0x5b69('0x3d')]=function(_0x3b19d5,_0x56bc59){var _0x45093a={'raw':!![],'where':{'id':_0x3b19d5['params']['id']}},_0x155b24={};_0x155b24[_0x5b69('0x2b')]=_[_0x5b69('0x3e')](db[_0x5b69('0x29')][_0x5b69('0x3f')]);_0x155b24[_0x5b69('0x2c')]=_[_0x5b69('0x3e')](_0x3b19d5[_0x5b69('0x2c')]);_0x155b24[_0x5b69('0x2d')]=_['intersection'](_0x155b24[_0x5b69('0x2b')],_0x155b24['query']);_0x45093a['attributes']=_['intersection'](_0x155b24[_0x5b69('0x2b')],qs[_0x5b69('0x30')](_0x3b19d5[_0x5b69('0x2c')]['fields']));_0x45093a[_0x5b69('0x2f')]=_0x45093a['attributes']['length']?_0x45093a['attributes']:_0x155b24[_0x5b69('0x2b')];if(_0x3b19d5['query']['includeAll']){_0x45093a[_0x5b69('0x3a')]=[{'all':!![]}];}_0x45093a=_[_0x5b69('0x39')]({},_0x45093a,_0x3b19d5[_0x5b69('0x40')]);return db[_0x5b69('0x29')]['find'](_0x45093a)[_0x5b69('0x22')](handleEntityNotFound(_0x56bc59,null))[_0x5b69('0x22')](respondWithResult(_0x56bc59,null))[_0x5b69('0x3c')](handleError(_0x56bc59,null));};exports[_0x5b69('0x41')]=function(_0x5668dd,_0x1412c7){return db[_0x5b69('0x29')][_0x5b69('0x41')](_0x5668dd['body'],{})[_0x5b69('0x22')](respondWithResult(_0x1412c7,0xc9))[_0x5b69('0x3c')](handleError(_0x1412c7,null));};exports[_0x5b69('0x20')]=function(_0x5a86a7,_0x39cf77){if(_0x5a86a7[_0x5b69('0x42')]['id']){delete _0x5a86a7[_0x5b69('0x42')]['id'];}return db[_0x5b69('0x29')][_0x5b69('0x43')]({'where':{'id':_0x5a86a7['params']['id']}})['then'](handleEntityNotFound(_0x39cf77,null))[_0x5b69('0x22')](saveUpdates(_0x5a86a7[_0x5b69('0x42')],null))[_0x5b69('0x22')](respondWithResult(_0x39cf77,null))[_0x5b69('0x3c')](handleError(_0x39cf77,null));};exports[_0x5b69('0x21')]=function(_0x34c884,_0x2ba472){return db[_0x5b69('0x29')]['find']({'where':{'id':_0x34c884[_0x5b69('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ba472,null))['then'](removeEntity(_0x2ba472,null))[_0x5b69('0x3c')](handleError(_0x2ba472,null));}; \ No newline at end of file +var _0x04e9=['offset','undefined','count','set','apply','reject','save','destroy','then','end','error','name','index','rawAttributes','fieldName','type','key','model','map','keys','intersection','fields','query','attributes','length','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxApplication','findAll','show','params','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x11160d,_0x413adc){var _0x21520a=function(_0x272f3c){while(--_0x272f3c){_0x11160d['push'](_0x11160d['shift']());}};_0x21520a(++_0x413adc);}(_0x04e9,0xff));var _0x904e=function(_0x46c394,_0x167ec5){_0x46c394=_0x46c394-0x0;var _0x426e0c=_0x04e9[_0x46c394];return _0x426e0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x904e('0x0'));var zipdir=require(_0x904e('0x1'));var jsonpatch=require(_0x904e('0x2'));var rp=require('request-promise');var moment=require(_0x904e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x904e('0x4'));var sox=require(_0x904e('0x5'));var csv=require(_0x904e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x904e('0x7'));var _=require('lodash');var squel=require(_0x904e('0x8'));var crypto=require('crypto');var jsforce=require(_0x904e('0x9'));var deskjs=require(_0x904e('0xa'));var toCsv=require('to-csv');var querystring=require(_0x904e('0xb'));var Papa=require('papaparse');var Redis=require(_0x904e('0xc'));var authService=require(_0x904e('0xd'));var qs=require(_0x904e('0xe'));var as=require(_0x904e('0xf'));var hardwareService=require(_0x904e('0x10'));var logger=require(_0x904e('0x11'))(_0x904e('0x12'));var utils=require('../../config/utils');var config=require(_0x904e('0x13'));var licenseUtil=require(_0x904e('0x14'));var db=require(_0x904e('0x15'))['db'];function respondWithStatusCode(_0x34a3d2,_0x325246){_0x325246=_0x325246||0xcc;return function(_0x18c278){if(_0x18c278){return _0x34a3d2[_0x904e('0x16')](_0x325246);}return _0x34a3d2['status'](_0x325246)['end']();};}function respondWithResult(_0x44bfc1,_0x318b2d){_0x318b2d=_0x318b2d||0xc8;return function(_0xa31f1b){if(_0xa31f1b){return _0x44bfc1[_0x904e('0x17')](_0x318b2d)[_0x904e('0x18')](_0xa31f1b);}};}function respondWithFilteredResult(_0x7ccb2,_0x6c3678){return function(_0x3b62e9){if(_0x3b62e9){var _0x1c3ab4=typeof _0x6c3678[_0x904e('0x19')]===_0x904e('0x1a')&&typeof _0x6c3678['limit']===_0x904e('0x1a');var _0x4a8784=_0x3b62e9[_0x904e('0x1b')];var _0x447821=_0x1c3ab4?0x0:_0x6c3678['offset'];var _0xa46abe=_0x1c3ab4?_0x3b62e9['count']:_0x6c3678[_0x904e('0x19')]+_0x6c3678['limit'];var _0x4ed3c1;if(_0xa46abe>=_0x4a8784){_0xa46abe=_0x4a8784;_0x4ed3c1=0xc8;}else{_0x4ed3c1=0xce;}_0x7ccb2['status'](_0x4ed3c1);return _0x7ccb2[_0x904e('0x1c')]('Content-Range',_0x447821+'-'+_0xa46abe+'/'+_0x4a8784)[_0x904e('0x18')](_0x3b62e9);}return null;};}function patchUpdates(_0x59a298){return function(_0x4e2358){try{jsonpatch[_0x904e('0x1d')](_0x4e2358,_0x59a298,!![]);}catch(_0x43f2f6){return BPromise[_0x904e('0x1e')](_0x43f2f6);}return _0x4e2358[_0x904e('0x1f')]();};}function saveUpdates(_0x531921,_0x297063){return function(_0x5b6861){if(_0x5b6861){return _0x5b6861['update'](_0x531921)['then'](function(_0x4a0628){return _0x4a0628;});}return null;};}function removeEntity(_0x54f088,_0xfef002){return function(_0x579738){if(_0x579738){return _0x579738[_0x904e('0x20')]()[_0x904e('0x21')](function(){_0x54f088[_0x904e('0x17')](0xcc)[_0x904e('0x22')]();});}};}function handleEntityNotFound(_0x44d69c,_0x30995c){return function(_0x5ab82){if(!_0x5ab82){_0x44d69c['sendStatus'](0x194);}return _0x5ab82;};}function handleError(_0x1363aa,_0x168b60){_0x168b60=_0x168b60||0x1f4;return function(_0x29bfaa){logger[_0x904e('0x23')](_0x29bfaa['stack']);if(_0x29bfaa[_0x904e('0x24')]){delete _0x29bfaa[_0x904e('0x24')];}_0x1363aa['status'](_0x168b60)['send'](_0x29bfaa);};}exports[_0x904e('0x25')]=function(_0x235e14,_0x5f3b8a){var _0x39fded={},_0x5bd8b3={},_0x15f7bc={'count':0x0,'rows':[]};var _0x249657=_['map'](db['FaxApplication'][_0x904e('0x26')],function(_0x14ea4c){return{'name':_0x14ea4c[_0x904e('0x27')],'type':_0x14ea4c[_0x904e('0x28')][_0x904e('0x29')]};});_0x5bd8b3[_0x904e('0x2a')]=_[_0x904e('0x2b')](_0x249657,_0x904e('0x24'));_0x5bd8b3['query']=_[_0x904e('0x2c')](_0x235e14['query']);_0x5bd8b3['filters']=_[_0x904e('0x2d')](_0x5bd8b3['model'],_0x5bd8b3['query']);_0x39fded['attributes']=_[_0x904e('0x2d')](_0x5bd8b3['model'],qs[_0x904e('0x2e')](_0x235e14[_0x904e('0x2f')][_0x904e('0x2e')]));_0x39fded[_0x904e('0x30')]=_0x39fded[_0x904e('0x30')][_0x904e('0x31')]?_0x39fded[_0x904e('0x30')]:_0x5bd8b3[_0x904e('0x2a')];if(!_0x235e14[_0x904e('0x2f')]['hasOwnProperty']('nolimit')){_0x39fded['limit']=qs[_0x904e('0x32')](_0x235e14[_0x904e('0x2f')][_0x904e('0x32')]);_0x39fded[_0x904e('0x19')]=qs[_0x904e('0x19')](_0x235e14[_0x904e('0x2f')][_0x904e('0x19')]);}_0x39fded['order']=qs['sort'](_0x235e14[_0x904e('0x2f')][_0x904e('0x33')]);_0x39fded[_0x904e('0x34')]=qs[_0x904e('0x35')](_[_0x904e('0x36')](_0x235e14['query'],_0x5bd8b3[_0x904e('0x35')]),_0x249657);if(_0x235e14[_0x904e('0x2f')][_0x904e('0x37')]){_0x39fded[_0x904e('0x34')]=_[_0x904e('0x38')](_0x39fded['where'],{'$or':_[_0x904e('0x2b')](_0x249657,function(_0x41aee0){if(_0x41aee0[_0x904e('0x28')]!==_0x904e('0x39')){var _0x1cfeb2={};_0x1cfeb2[_0x41aee0[_0x904e('0x24')]]={'$like':'%'+_0x235e14[_0x904e('0x2f')][_0x904e('0x37')]+'%'};return _0x1cfeb2;}})});}_0x39fded=_[_0x904e('0x38')]({},_0x39fded,_0x235e14[_0x904e('0x3a')]);var _0x55ee24={'where':_0x39fded[_0x904e('0x34')]};return db['FaxApplication'][_0x904e('0x1b')](_0x55ee24)['then'](function(_0x1a8f28){_0x15f7bc[_0x904e('0x1b')]=_0x1a8f28;if(_0x235e14[_0x904e('0x2f')][_0x904e('0x3b')]){_0x39fded[_0x904e('0x3c')]=[{'all':!![]}];}return db[_0x904e('0x3d')][_0x904e('0x3e')](_0x39fded);})[_0x904e('0x21')](function(_0x300f5b){_0x15f7bc['rows']=_0x300f5b;return _0x15f7bc;})[_0x904e('0x21')](respondWithFilteredResult(_0x5f3b8a,_0x39fded))['catch'](handleError(_0x5f3b8a,null));};exports[_0x904e('0x3f')]=function(_0x33f4d0,_0x110780){var _0x454fc8={'raw':!![],'where':{'id':_0x33f4d0[_0x904e('0x40')]['id']}},_0x5f1779={};_0x5f1779[_0x904e('0x2a')]=_[_0x904e('0x2c')](db[_0x904e('0x3d')]['rawAttributes']);_0x5f1779[_0x904e('0x2f')]=_[_0x904e('0x2c')](_0x33f4d0[_0x904e('0x2f')]);_0x5f1779['filters']=_[_0x904e('0x2d')](_0x5f1779[_0x904e('0x2a')],_0x5f1779['query']);_0x454fc8[_0x904e('0x30')]=_[_0x904e('0x2d')](_0x5f1779[_0x904e('0x2a')],qs[_0x904e('0x2e')](_0x33f4d0[_0x904e('0x2f')][_0x904e('0x2e')]));_0x454fc8['attributes']=_0x454fc8['attributes'][_0x904e('0x31')]?_0x454fc8['attributes']:_0x5f1779['model'];if(_0x33f4d0[_0x904e('0x2f')][_0x904e('0x3b')]){_0x454fc8[_0x904e('0x3c')]=[{'all':!![]}];}_0x454fc8=_[_0x904e('0x38')]({},_0x454fc8,_0x33f4d0[_0x904e('0x3a')]);return db['FaxApplication'][_0x904e('0x41')](_0x454fc8)[_0x904e('0x21')](handleEntityNotFound(_0x110780,null))['then'](respondWithResult(_0x110780,null))[_0x904e('0x42')](handleError(_0x110780,null));};exports['create']=function(_0xc0bb53,_0x4d21b0){return db[_0x904e('0x3d')][_0x904e('0x43')](_0xc0bb53[_0x904e('0x44')],{})[_0x904e('0x21')](respondWithResult(_0x4d21b0,0xc9))[_0x904e('0x42')](handleError(_0x4d21b0,null));};exports[_0x904e('0x45')]=function(_0x1ae89e,_0x200006){if(_0x1ae89e[_0x904e('0x44')]['id']){delete _0x1ae89e[_0x904e('0x44')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x1ae89e[_0x904e('0x40')]['id']}})['then'](handleEntityNotFound(_0x200006,null))[_0x904e('0x21')](saveUpdates(_0x1ae89e['body'],null))[_0x904e('0x21')](respondWithResult(_0x200006,null))[_0x904e('0x42')](handleError(_0x200006,null));};exports[_0x904e('0x20')]=function(_0x5a9885,_0x704ccc){return db[_0x904e('0x3d')][_0x904e('0x41')]({'where':{'id':_0x5a9885['params']['id']}})[_0x904e('0x21')](handleEntityNotFound(_0x704ccc,null))[_0x904e('0x21')](removeEntity(_0x704ccc,null))['catch'](handleError(_0x704ccc,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 0247d12..cd6a152 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 _0x395d=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x395d,0x6b));var _0xd395=function(_0x147556,_0x2a93f6){_0x147556=_0x147556-0x0;var _0x11afdd=_0x395d[_0x147556];return _0x11afdd;};'use strict';var _=require(_0xd395('0x0'));var util=require(_0xd395('0x1'));var logger=require(_0xd395('0x2'))(_0xd395('0x3'));var moment=require(_0xd395('0x4'));var BPromise=require(_0xd395('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd395('0x6'));var rimraf=require('rimraf');var config=require(_0xd395('0x7'));var attributes=require(_0xd395('0x8'));module['exports']=function(_0x1cfb11,_0x31d523){return _0x1cfb11[_0xd395('0x9')](_0xd395('0xa'),attributes,{'tableName':_0xd395('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8d7e=['path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x485c38,_0x1e919e){var _0x44ad68=function(_0x28d666){while(--_0x28d666){_0x485c38['push'](_0x485c38['shift']());}};_0x44ad68(++_0x1e919e);}(_0x8d7e,0xe5));var _0xe8d7=function(_0x216396,_0x7d9e9a){_0x216396=_0x216396-0x0;var _0x330c17=_0x8d7e[_0x216396];return _0x330c17;};'use strict';var _=require(_0xe8d7('0x0'));var util=require('util');var logger=require(_0xe8d7('0x1'))('api');var moment=require(_0xe8d7('0x2'));var BPromise=require(_0xe8d7('0x3'));var rp=require(_0xe8d7('0x4'));var fs=require('fs');var path=require(_0xe8d7('0x5'));var rimraf=require(_0xe8d7('0x6'));var config=require(_0xe8d7('0x7'));var attributes=require(_0xe8d7('0x8'));module['exports']=function(_0x58cb42,_0x487113){return _0x58cb42[_0xe8d7('0x9')](_0xe8d7('0xa'),attributes,{'tableName':_0xe8d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe8d7('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5ad9030..0d9478b 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 _0x4283=['info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxApplication,\x20%s,\x20%s','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request'];(function(_0x22d4b5,_0x15f709){var _0x433423=function(_0x44c82a){while(--_0x44c82a){_0x22d4b5['push'](_0x22d4b5['shift']());}};_0x433423(++_0x15f709);}(_0x4283,0x119));var _0x3428=function(_0x249b61,_0xc7895b){_0x249b61=_0x249b61-0x0;var _0x5bbf8e=_0x4283[_0x249b61];return _0x5bbf8e;};'use strict';var _=require(_0x3428('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3428('0x1'));var rs=require(_0x3428('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3428('0x3'))['db'];var utils=require(_0x3428('0x4'));var logger=require(_0x3428('0x5'))('rpc');var config=require(_0x3428('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3428('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45dd0c,_0x5d1e5e,_0x443d07){return new BPromise(function(_0x28b47d,_0x481239){return client[_0x3428('0x8')](_0x45dd0c,_0x443d07)['then'](function(_0x2b5310){logger[_0x3428('0x9')]('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x3428('0xa'));logger[_0x3428('0xb')](_0x3428('0xc'),_0x5d1e5e,'request\x20sent',JSON[_0x3428('0xd')](_0x2b5310));if(_0x2b5310['error']){if(_0x2b5310[_0x3428('0xe')][_0x3428('0xf')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x2b5310[_0x3428('0xe')][_0x3428('0x10')]);return _0x481239(_0x2b5310['error'][_0x3428('0x10')]);}logger[_0x3428('0xe')]('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x2b5310[_0x3428('0xe')][_0x3428('0x10')]);return _0x28b47d(_0x2b5310[_0x3428('0xe')][_0x3428('0x10')]);}else{logger[_0x3428('0x9')]('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x3428('0xa'));_0x28b47d(_0x2b5310['result']['message']);}})[_0x3428('0x11')](function(_0x1df926){logger['error'](_0x3428('0x12'),_0x5d1e5e,_0x1df926);_0x481239(_0x1df926);});});}exports[_0x3428('0x13')]=function(_0x215bd8){var _0x4b5f74=this;return new Promise(function(_0x2f1538,_0x32758b){return db[_0x3428('0x14')][_0x3428('0x15')](_0x215bd8[_0x3428('0x16')],{'raw':_0x215bd8[_0x3428('0x17')]?_0x215bd8[_0x3428('0x17')][_0x3428('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x215bd8['options']?_0x215bd8[_0x3428('0x17')][_0x3428('0x19')]||null:null,'attributes':_0x215bd8[_0x3428('0x17')]?_0x215bd8[_0x3428('0x17')][_0x3428('0x1a')]||null:null,'limit':_0x215bd8[_0x3428('0x17')]?_0x215bd8['options'][_0x3428('0x1b')]||null:null})[_0x3428('0x1c')](function(_0x26847f){logger['info'](_0x3428('0x13'),_0x215bd8);logger[_0x3428('0xb')](_0x3428('0x13'),_0x215bd8,JSON[_0x3428('0xd')](_0x26847f));_0x2f1538(_0x26847f);})[_0x3428('0x11')](function(_0xf115){logger[_0x3428('0xe')](_0x3428('0x13'),_0xf115[_0x3428('0x10')],_0x215bd8);_0x32758b(_0x4b5f74[_0x3428('0xe')](0x1f4,_0xf115[_0x3428('0x10')]));});});}; \ No newline at end of file +var _0x2b37=['catch','UpdateFaxApplication','FaxApplication','update','body','raw','options','attributes','limit','debug','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0x2b37,0xea));var _0x72b3=function(_0x5abb8e,_0x41268f){_0x5abb8e=_0x5abb8e-0x0;var _0x409e33=_0x2b37[_0x5abb8e];return _0x409e33;};'use strict';var _=require('lodash');var util=require(_0x72b3('0x0'));var moment=require(_0x72b3('0x1'));var BPromise=require('bluebird');var rs=require(_0x72b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72b3('0x3'))['db'];var utils=require(_0x72b3('0x4'));var logger=require(_0x72b3('0x5'))(_0x72b3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x72b3('0x7')][_0x72b3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3428dc,_0x12bc55,_0x53a9ac){return new BPromise(function(_0x4ea3ff,_0x24f55a){return client[_0x72b3('0x9')](_0x3428dc,_0x53a9ac)[_0x72b3('0xa')](function(_0x5b536e){logger['info'](_0x72b3('0xb'),_0x12bc55,_0x72b3('0xc'));logger['debug'](_0x72b3('0xd'),_0x12bc55,_0x72b3('0xc'),JSON[_0x72b3('0xe')](_0x5b536e));if(_0x5b536e[_0x72b3('0xf')]){if(_0x5b536e[_0x72b3('0xf')]['code']===0x1f4){logger['error'](_0x72b3('0xb'),_0x12bc55,_0x5b536e['error'][_0x72b3('0x10')]);return _0x24f55a(_0x5b536e[_0x72b3('0xf')][_0x72b3('0x10')]);}logger[_0x72b3('0xf')]('FaxApplication,\x20%s,\x20%s',_0x12bc55,_0x5b536e[_0x72b3('0xf')][_0x72b3('0x10')]);return _0x4ea3ff(_0x5b536e[_0x72b3('0xf')]['message']);}else{logger[_0x72b3('0x11')](_0x72b3('0xb'),_0x12bc55,_0x72b3('0xc'));_0x4ea3ff(_0x5b536e['result'][_0x72b3('0x10')]);}})[_0x72b3('0x12')](function(_0x27434b){logger[_0x72b3('0xf')](_0x72b3('0xb'),_0x12bc55,_0x27434b);_0x24f55a(_0x27434b);});});}exports[_0x72b3('0x13')]=function(_0x2d9023){var _0x9fec86=this;return new Promise(function(_0x338989,_0x4fdeaa){return db[_0x72b3('0x14')][_0x72b3('0x15')](_0x2d9023[_0x72b3('0x16')],{'raw':_0x2d9023['options']?_0x2d9023['options'][_0x72b3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d9023[_0x72b3('0x18')]?_0x2d9023[_0x72b3('0x18')]['where']||null:null,'attributes':_0x2d9023[_0x72b3('0x18')]?_0x2d9023[_0x72b3('0x18')][_0x72b3('0x19')]||null:null,'limit':_0x2d9023[_0x72b3('0x18')]?_0x2d9023[_0x72b3('0x18')][_0x72b3('0x1a')]||null:null})[_0x72b3('0xa')](function(_0x344624){logger['info']('UpdateFaxApplication',_0x2d9023);logger[_0x72b3('0x1b')](_0x72b3('0x13'),_0x2d9023,JSON[_0x72b3('0xe')](_0x344624));_0x338989(_0x344624);})['catch'](function(_0x22c8c2){logger['error']('UpdateFaxApplication',_0x22c8c2[_0x72b3('0x10')],_0x2d9023);_0x4fdeaa(_0x9fec86['error'](0x1f4,_0x22c8c2[_0x72b3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c6cf628..f56ae19 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 _0x6e6c=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_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('./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 +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxApplication.controller'];(function(_0x390be1,_0x2bb026){var _0x2f7d9c=function(_0x5bd8ae){while(--_0x5bd8ae){_0x390be1['push'](_0x390be1['shift']());}};_0x2f7d9c(++_0x2bb026);}(_0x14a0,0x8e));var _0x014a=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x14a0[_0x546aaf];return _0x1cbf6d;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 92fe35d..281f062 100644 --- a/server/api/faxInteraction/faxInteraction.attributes.js +++ b/server/api/faxInteraction/faxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x583c=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0xd0cd54,_0x613e58){var _0x5f3f4f=function(_0x4fb920){while(--_0x4fb920){_0xd0cd54['push'](_0xd0cd54['shift']());}};_0x5f3f4f(++_0x613e58);}(_0x583c,0x12b));var _0xc583=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x583c[_0x1bfe2b];return _0x1477d4;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'closed':{'type':Sequelize[_0xc583('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc583('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc583('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc583('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xc583('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc583('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc583('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc583('0x5')]('in',_0xc583('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xc583('0x7')]}}; \ No newline at end of file +var _0x0424=['ENUM','out','INTEGER','BOOLEAN','DATE','STRING'];(function(_0xef4b6c,_0x169bc1){var _0x31f2a4=function(_0x1ba28c){while(--_0x1ba28c){_0xef4b6c['push'](_0xef4b6c['shift']());}};_0x31f2a4(++_0x169bc1);}(_0x0424,0x159));var _0x4042=function(_0x1602fd,_0x847115){_0x1602fd=_0x1602fd-0x0;var _0x1eaf42=_0x0424[_0x1602fd];return _0x1eaf42;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x4042('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4042('0x1')]},'disposition':{'type':Sequelize[_0x4042('0x2')]},'secondDisposition':{'type':Sequelize[_0x4042('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4042('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x4042('0x3')]('in',_0x4042('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4042('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x4042('0x3')]('in',_0x4042('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x4042('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9fa63e4..4ff1e35 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 _0x0f07=['update','destroy','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','user','then','catch','model','keys','query','filters','intersection','attributes','fields','include','merge','options','find','create','body','params','describe','addMessage','omit','ids','getMessages','findOne','FaxMessage','length','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','spread','Tag','color','download','unix','join','root','tmp','server','files','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x24cf91,_0x1a2645){var _0x2db5c9=function(_0xfccee9){while(--_0xfccee9){_0x24cf91['push'](_0x24cf91['shift']());}};_0x2db5c9(++_0x1a2645);}(_0x0f07,0x11a));var _0x70f0=function(_0x1663d9,_0x4fc07e){_0x1663d9=_0x1663d9-0x0;var _0xa7d532=_0x0f07[_0x1663d9];return _0xa7d532;};'use strict';var rimraf=require(_0x70f0('0x0'));var zipdir=require(_0x70f0('0x1'));var moment=require(_0x70f0('0x2'));var BPromise=require(_0x70f0('0x3'));var util=require('util');var path=require(_0x70f0('0x4'));var fs=require('fs');var _=require(_0x70f0('0x5'));var Redis=require(_0x70f0('0x6'));var interaction=require(_0x70f0('0x7'));var qs=require(_0x70f0('0x8'));var logger=require(_0x70f0('0x9'))(_0x70f0('0xa'));var config=require(_0x70f0('0xb'));var db=require(_0x70f0('0xc'))['db'];config[_0x70f0('0xd')]=_['defaults'](config['redis'],{'host':_0x70f0('0xe'),'port':0x18eb});var socket=require(_0x70f0('0xf'))(new Redis(config[_0x70f0('0xd')]));require('./faxInteraction.socket')[_0x70f0('0x10')](socket);function respondWithStatusCode(_0xe9d6f2,_0x3d9544){_0x3d9544=_0x3d9544||0xcc;return function(_0x3b5307){if(_0x3b5307){return _0xe9d6f2[_0x70f0('0x11')](_0x3d9544);}return _0xe9d6f2[_0x70f0('0x12')](_0x3d9544)[_0x70f0('0x13')]();};}function respondWithResult(_0x5af282,_0x1515fe){_0x1515fe=_0x1515fe||0xc8;return function(_0x281547){if(_0x281547){return _0x5af282[_0x70f0('0x12')](_0x1515fe)[_0x70f0('0x14')](_0x281547);}};}function respondWithFilteredResult(_0x1774d7,_0x490b63){return function(_0x1a104a){if(_0x1a104a){var _0x35d0c9=typeof _0x490b63[_0x70f0('0x15')]===_0x70f0('0x16')&&typeof _0x490b63['limit']===_0x70f0('0x16');var _0x376a25=_0x1a104a[_0x70f0('0x17')];var _0x48c192=_0x35d0c9?0x0:_0x490b63[_0x70f0('0x15')];var _0x20b938=_0x35d0c9?_0x1a104a[_0x70f0('0x17')]:_0x490b63[_0x70f0('0x15')]+_0x490b63[_0x70f0('0x18')];var _0x323802;if(_0x20b938>=_0x376a25){_0x20b938=_0x376a25;_0x323802=0xc8;}else{_0x323802=0xce;}_0x1774d7[_0x70f0('0x12')](_0x323802);return _0x1774d7[_0x70f0('0x19')](_0x70f0('0x1a'),_0x48c192+'-'+_0x20b938+'/'+_0x376a25)[_0x70f0('0x14')](_0x1a104a);}return null;};}function saveUpdates(_0x4f9824){return function(_0x25d21b){if(_0x25d21b){return _0x25d21b[_0x70f0('0x1b')](_0x4f9824)['then'](function(_0x10d7f8){return _0x10d7f8;});}return null;};}function removeEntity(_0x46face){return function(_0x2955c7){if(_0x2955c7){return _0x2955c7[_0x70f0('0x1c')]()['then'](function(){_0x46face[_0x70f0('0x12')](0xcc)[_0x70f0('0x13')]();});}};}function handleEntityNotFound(_0x481150){return function(_0x274829){if(!_0x274829){_0x481150['sendStatus'](0x194);}return _0x274829;};}function handleError(_0x576814,_0x5de30b){_0x5de30b=_0x5de30b||0x1f4;return function(_0x41d8f8){logger['error'](_0x41d8f8[_0x70f0('0x1d')]);if(_0x41d8f8[_0x70f0('0x1e')]){delete _0x41d8f8['name'];}_0x576814[_0x70f0('0x12')](_0x5de30b)[_0x70f0('0x1f')](_0x41d8f8);};}exports[_0x70f0('0x20')]=function(_0x4bf16e,_0x2e7e20){var _0x332432={};var _0x2321a2=_['map'](db[_0x70f0('0x21')][_0x70f0('0x22')],function(_0x7bce66){return{'name':_0x7bce66[_0x70f0('0x23')],'type':_0x7bce66[_0x70f0('0x24')][_0x70f0('0x25')]};});_0x332432=qs[_0x70f0('0x26')](_0x2321a2,_0x4bf16e);return interaction['findAll']('fax',_0x4bf16e['query'],_0x4bf16e[_0x70f0('0x27')],_0x332432,_0x2321a2)[_0x70f0('0x28')](respondWithFilteredResult(_0x2e7e20,_0x332432))[_0x70f0('0x29')](handleError(_0x2e7e20,null));};exports['show']=function(_0x4c9600,_0x32b1f1){var _0x3fe0b4={'raw':![],'where':{'id':_0x4c9600['params']['id']}},_0x3cde2d={};_0x3cde2d[_0x70f0('0x2a')]=_[_0x70f0('0x2b')](db[_0x70f0('0x21')][_0x70f0('0x22')]);_0x3cde2d['query']=_['keys'](_0x4c9600[_0x70f0('0x2c')]);_0x3cde2d[_0x70f0('0x2d')]=_[_0x70f0('0x2e')](_0x3cde2d[_0x70f0('0x2a')],_0x3cde2d[_0x70f0('0x2c')]);_0x3fe0b4[_0x70f0('0x2f')]=_[_0x70f0('0x2e')](_0x3cde2d[_0x70f0('0x2a')],qs[_0x70f0('0x30')](_0x4c9600[_0x70f0('0x2c')][_0x70f0('0x30')]));_0x3fe0b4['attributes']=_0x3fe0b4[_0x70f0('0x2f')]['length']?_0x3fe0b4['attributes']:_0x3cde2d['model'];if(_0x4c9600[_0x70f0('0x2c')]['includeAll']){_0x3fe0b4[_0x70f0('0x31')]=[{'all':!![]}];}_0x3fe0b4=_[_0x70f0('0x32')]({},_0x3fe0b4,_0x4c9600[_0x70f0('0x33')]);return db[_0x70f0('0x21')][_0x70f0('0x34')](_0x3fe0b4)['then'](handleEntityNotFound(_0x32b1f1,null))[_0x70f0('0x28')](respondWithResult(_0x32b1f1,null))[_0x70f0('0x29')](handleError(_0x32b1f1,null));};exports['create']=function(_0x723ebe,_0x468c5e){return db[_0x70f0('0x21')][_0x70f0('0x35')](_0x723ebe['body'],{})[_0x70f0('0x28')](respondWithResult(_0x468c5e,0xc9))['catch'](handleError(_0x468c5e,null));};exports[_0x70f0('0x1b')]=function(_0x4474b2,_0x761c54){if(_0x4474b2[_0x70f0('0x36')]['id']){delete _0x4474b2[_0x70f0('0x36')]['id'];}return db[_0x70f0('0x21')][_0x70f0('0x34')]({'where':{'id':_0x4474b2[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x761c54,null))[_0x70f0('0x28')](saveUpdates(_0x4474b2['body'],null))[_0x70f0('0x28')](respondWithResult(_0x761c54,null))['catch'](handleError(_0x761c54,null));};exports[_0x70f0('0x1c')]=function(_0x3a447b,_0x327b39){return db[_0x70f0('0x21')][_0x70f0('0x34')]({'where':{'id':_0x3a447b[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x327b39,null))['then'](removeEntity(_0x327b39,null))[_0x70f0('0x29')](handleError(_0x327b39,null));};exports['describe']=function(_0x41377d,_0x17e5fd){return db[_0x70f0('0x21')][_0x70f0('0x38')]()['then'](respondWithResult(_0x17e5fd,null))[_0x70f0('0x29')](handleError(_0x17e5fd,null));};exports[_0x70f0('0x39')]=function(_0x31e32d,_0x3d7334){return db['FaxMessage'][_0x70f0('0x34')]({'where':{'id':_0x31e32d[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x3d7334,null))['then'](function(_0x5bcbad){if(_0x5bcbad){return _0x5bcbad[_0x70f0('0x39')](_0x31e32d['body']['ids'],_[_0x70f0('0x3a')](_0x31e32d[_0x70f0('0x36')],[_0x70f0('0x3b'),'id'])||{});}})[_0x70f0('0x28')](respondWithResult(_0x3d7334,null))['catch'](handleError(_0x3d7334,null));};exports[_0x70f0('0x3c')]=function(_0x525d0b,_0x5b878b){var _0x30fa72={'raw':![],'where':{}};var _0x45a2a0={};var _0x35578d={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x70f0('0x3d')]({'where':{'id':_0x525d0b['params']['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x5b878b,null))[_0x70f0('0x28')](function(_0x5b2dad){if(_0x5b2dad){_0x45a2a0['model']=_[_0x70f0('0x2b')](db[_0x70f0('0x3e')][_0x70f0('0x22')]);_0x45a2a0[_0x70f0('0x2c')]=_['keys'](_0x525d0b[_0x70f0('0x2c')]);_0x45a2a0[_0x70f0('0x2d')]=_[_0x70f0('0x2e')](_0x45a2a0[_0x70f0('0x2a')],_0x45a2a0['query']);_0x30fa72[_0x70f0('0x2f')]=_[_0x70f0('0x2e')](_0x45a2a0[_0x70f0('0x2a')],qs[_0x70f0('0x30')](_0x525d0b['query'][_0x70f0('0x30')]));_0x30fa72[_0x70f0('0x2f')]=_0x30fa72[_0x70f0('0x2f')][_0x70f0('0x3f')]?_0x30fa72[_0x70f0('0x2f')]:_0x45a2a0['model'];if(!_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x40')](_0x70f0('0x41'))){_0x30fa72[_0x70f0('0x18')]=qs['limit'](_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x18')]);_0x30fa72[_0x70f0('0x15')]=qs[_0x70f0('0x15')](_0x525d0b['query'][_0x70f0('0x15')]);}_0x30fa72[_0x70f0('0x42')]=qs[_0x70f0('0x43')](_0x525d0b[_0x70f0('0x2c')]['sort']);_0x30fa72[_0x70f0('0x44')]=qs[_0x70f0('0x2d')](_['pick'](_0x525d0b['query'],_0x45a2a0[_0x70f0('0x2d')]));_0x30fa72[_0x70f0('0x44')][_0x70f0('0x45')]=_0x5b2dad['id'];if(_0x525d0b['query'][_0x70f0('0x46')]){_0x30fa72['where']=_[_0x70f0('0x32')](_0x30fa72['where'],{'$or':_['map'](_0x30fa72[_0x70f0('0x2f')],function(_0x484dfd){var _0x302828={};_0x302828[_0x484dfd]={'$like':'%'+_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x46')]+'%'};return _0x302828;})});}if(_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x47')]){var _0x331f0b=_0x525d0b['query'][_0x70f0('0x47')][_0x70f0('0x48')](',');var _0x2f19e7={};_0x2f19e7[_0x331f0b[0x0]]={'$gte':moment(_0x331f0b[0x1])['format'](_0x70f0('0x49'))};_0x30fa72[_0x70f0('0x44')]=_[_0x70f0('0x32')](_0x30fa72['where'],_0x2f19e7);}_0x30fa72=_[_0x70f0('0x32')]({},_0x30fa72,_0x525d0b['options']);return db[_0x70f0('0x3e')]['count']({'where':_0x30fa72[_0x70f0('0x44')]})[_0x70f0('0x28')](function(_0x2e8291){_0x35578d[_0x70f0('0x17')]=_0x2e8291;if(_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x4a')]){_0x30fa72['include']=[{'all':!![]}];}return db[_0x70f0('0x3e')][_0x70f0('0x4b')](_0x30fa72);})[_0x70f0('0x28')](function(_0x1dceca){_0x35578d[_0x70f0('0x4c')]=_0x1dceca;return _0x35578d;});}})[_0x70f0('0x28')](respondWithFilteredResult(_0x5b878b,_0x30fa72))[_0x70f0('0x29')](handleError(_0x5b878b,null));};exports['addTags']=function(_0x45183a,_0x2cb713){return db[_0x70f0('0x21')][_0x70f0('0x34')]({'where':{'id':_0x45183a[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x2cb713,null))['then'](function(_0x3943bc){if(_0x3943bc){return _0x3943bc['setTags'](_0x45183a[_0x70f0('0x36')][_0x70f0('0x3b')],_[_0x70f0('0x3a')](_0x45183a['body'],[_0x70f0('0x3b'),'id'])||{})[_0x70f0('0x4d')](function(){return db[_0x70f0('0x4e')][_0x70f0('0x4b')]({'attributes':['id',_0x70f0('0x1e'),_0x70f0('0x4f')],'where':{'id':_0x45183a[_0x70f0('0x36')][_0x70f0('0x3b')]}});})['then'](function(_0x487123){socket['emit']('faxInteractionTags:save',{'id':Number(_0x45183a[_0x70f0('0x37')]['id']),'tags':_0x487123||[]});return{'id':Number(_0x45183a[_0x70f0('0x37')]['id']),'tags':_0x487123||[]};});}})[_0x70f0('0x28')](respondWithResult(_0x2cb713,null))['catch'](handleError(_0x2cb713,null));};exports['removeTags']=function(_0x28bb80,_0x2bf031){return db[_0x70f0('0x21')]['find']({'where':{'id':_0x28bb80[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x2bf031,null))['then'](function(_0x2c5773){if(_0x2c5773){return _0x2c5773['removeTags'](_0x28bb80[_0x70f0('0x2c')][_0x70f0('0x3b')]);}})[_0x70f0('0x28')](respondWithStatusCode(_0x2bf031,null))['catch'](handleError(_0x2bf031,null));};exports[_0x70f0('0x50')]=function(_0x263183,_0x4cbdf9){var _0x3332e6=moment()[_0x70f0('0x51')]()['toString']();var _0x5ba929=path[_0x70f0('0x52')](config[_0x70f0('0x53')],'server','files',_0x70f0('0x54'));var _0x43d71a=path[_0x70f0('0x52')](config[_0x70f0('0x53')],_0x70f0('0x55'),_0x70f0('0x56'),_0x70f0('0x57'));var _0x5f9c13=path[_0x70f0('0x52')](_0x5ba929,_0x3332e6);var _0x534baf=util[_0x70f0('0x58')](_0x70f0('0x59'),_0x263183[_0x70f0('0x37')]['id'],_0x3332e6);var _0x429002=path[_0x70f0('0x52')](_0x5ba929,_0x534baf);var _0x2eec6c=[];_0x2eec6c['push']({'model':db[_0x70f0('0x5a')],'as':_0x70f0('0x5a'),'raw':!![]});var _0x224427=[{'model':db[_0x70f0('0x3e')],'as':_0x70f0('0x5b'),'attributes':['id','body',_0x70f0('0x5c')],'include':_0x2eec6c}];return db[_0x70f0('0x21')][_0x70f0('0x34')]({'where':{'id':_0x263183[_0x70f0('0x37')]['id']},'include':_0x224427})[_0x70f0('0x28')](handleEntityNotFound(_0x4cbdf9,null))['then'](function(_0x15145c){if(_0x15145c&&_0x15145c[_0x70f0('0x5b')]){var _0x31983a=_0x15145c[_0x70f0('0x5d')]({'plain':!![]});fs[_0x70f0('0x5e')](_0x5f9c13);for(var _0x10efee=0x0;_0x10efee<_0x31983a[_0x70f0('0x5b')]['length'];_0x10efee++){var _0x303342=_0x31983a['Messages'][_0x10efee][_0x70f0('0x5a')];if(_0x303342){var _0x3e65d5=path['join'](_0x43d71a,_0x303342['basename']);if(fs[_0x70f0('0x5f')](_0x3e65d5)){fs[_0x70f0('0x60')](_0x3e65d5)[_0x70f0('0x61')](fs[_0x70f0('0x62')](path[_0x70f0('0x52')](_0x5f9c13,_0x303342['basename'])));}}}return BPromise[_0x70f0('0x63')]()[_0x70f0('0x28')](function(){return new BPromise(function(_0x5fc7b,_0x24b66f){zipdir(_0x5f9c13,{'saveTo':_0x429002},function(_0xb30b36,_0x50e417){if(_0xb30b36)return _0x24b66f(_0xb30b36);return _0x5fc7b(_0x50e417);});})[_0x70f0('0x28')](function(){return new BPromise(function(_0x4d244d,_0x27fe71){rimraf(_0x5f9c13,function(_0x5a749d){if(_0x5a749d)_0x27fe71(_0x5a749d);return _0x4d244d();});});})[_0x70f0('0x28')](function(){return _0x4cbdf9[_0x70f0('0x50')](_0x429002,_0x534baf,function(_0x212303){if(_0x212303){console[_0x70f0('0x64')](_0x70f0('0x65'),_0x212303);}else{fs[_0x70f0('0x66')](_0x429002);}});});});}else{return _0x4cbdf9[_0x70f0('0x11')](0xc8);}})[_0x70f0('0x29')](handleError(_0x4cbdf9,null));}; \ No newline at end of file +var _0x0643=['model','keys','FaxInteraction','query','intersection','attributes','fields','includeAll','options','body','find','params','describe','addMessage','ids','omit','findOne','FaxMessage','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','include','addTags','spread','Tag','color','faxInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','download','err','rimraf','zip-dir','bluebird','path','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','stack','name','map','rawAttributes','fieldName','key','getOptions','findAll','user','catch','show'];(function(_0x5a335c,_0x1b23e3){var _0xf41e28=function(_0x42478c){while(--_0x42478c){_0x5a335c['push'](_0x5a335c['shift']());}};_0xf41e28(++_0x1b23e3);}(_0x0643,0xa0));var _0x3064=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x0643[_0x21cb7f];return _0x5a079a;};'use strict';var rimraf=require(_0x3064('0x0'));var zipdir=require(_0x3064('0x1'));var moment=require('moment');var BPromise=require(_0x3064('0x2'));var util=require('util');var path=require(_0x3064('0x3'));var fs=require('fs');var _=require(_0x3064('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x3064('0x5'))(_0x3064('0x6'));var config=require(_0x3064('0x7'));var db=require(_0x3064('0x8'))['db'];config[_0x3064('0x9')]=_['defaults'](config[_0x3064('0x9')],{'host':_0x3064('0xa'),'port':0x18eb});var socket=require(_0x3064('0xb'))(new Redis(config[_0x3064('0x9')]));require(_0x3064('0xc'))[_0x3064('0xd')](socket);function respondWithStatusCode(_0x37b3ca,_0x5a4aca){_0x5a4aca=_0x5a4aca||0xcc;return function(_0x3bb607){if(_0x3bb607){return _0x37b3ca[_0x3064('0xe')](_0x5a4aca);}return _0x37b3ca['status'](_0x5a4aca)[_0x3064('0xf')]();};}function respondWithResult(_0x1960cd,_0x253b95){_0x253b95=_0x253b95||0xc8;return function(_0x7067b8){if(_0x7067b8){return _0x1960cd[_0x3064('0x10')](_0x253b95)['json'](_0x7067b8);}};}function respondWithFilteredResult(_0x583e90,_0x2a89e9){return function(_0x4b5d08){if(_0x4b5d08){var _0x5d2fa4=typeof _0x2a89e9['offset']===_0x3064('0x11')&&typeof _0x2a89e9[_0x3064('0x12')]===_0x3064('0x11');var _0x6b0aa9=_0x4b5d08[_0x3064('0x13')];var _0x198d02=_0x5d2fa4?0x0:_0x2a89e9[_0x3064('0x14')];var _0x289ccf=_0x5d2fa4?_0x4b5d08[_0x3064('0x13')]:_0x2a89e9['offset']+_0x2a89e9[_0x3064('0x12')];var _0x399775;if(_0x289ccf>=_0x6b0aa9){_0x289ccf=_0x6b0aa9;_0x399775=0xc8;}else{_0x399775=0xce;}_0x583e90[_0x3064('0x10')](_0x399775);return _0x583e90[_0x3064('0x15')](_0x3064('0x16'),_0x198d02+'-'+_0x289ccf+'/'+_0x6b0aa9)[_0x3064('0x17')](_0x4b5d08);}return null;};}function saveUpdates(_0xa16919){return function(_0x475568){if(_0x475568){return _0x475568[_0x3064('0x18')](_0xa16919)[_0x3064('0x19')](function(_0xc77fbe){return _0xc77fbe;});}return null;};}function removeEntity(_0x5e8d1){return function(_0x3f1ab6){if(_0x3f1ab6){return _0x3f1ab6[_0x3064('0x1a')]()[_0x3064('0x19')](function(){_0x5e8d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1fa25){return function(_0x4df187){if(!_0x4df187){_0xf1fa25['sendStatus'](0x194);}return _0x4df187;};}function handleError(_0x57aa89,_0x1b2a7e){_0x1b2a7e=_0x1b2a7e||0x1f4;return function(_0x2fbac0){logger['error'](_0x2fbac0[_0x3064('0x1b')]);if(_0x2fbac0[_0x3064('0x1c')]){delete _0x2fbac0[_0x3064('0x1c')];}_0x57aa89['status'](_0x1b2a7e)['send'](_0x2fbac0);};}exports['index']=function(_0xa44aae,_0x41d127){var _0x46175d={};var _0x916359=_[_0x3064('0x1d')](db['FaxInteraction'][_0x3064('0x1e')],function(_0xc29c74){return{'name':_0xc29c74[_0x3064('0x1f')],'type':_0xc29c74['type'][_0x3064('0x20')]};});_0x46175d=qs[_0x3064('0x21')](_0x916359,_0xa44aae);return interaction[_0x3064('0x22')]('fax',_0xa44aae['query'],_0xa44aae[_0x3064('0x23')],_0x46175d,_0x916359)[_0x3064('0x19')](respondWithFilteredResult(_0x41d127,_0x46175d))[_0x3064('0x24')](handleError(_0x41d127,null));};exports[_0x3064('0x25')]=function(_0x20ea80,_0x8c4b9c){var _0x4fc969={'raw':![],'where':{'id':_0x20ea80['params']['id']}},_0x483d4c={};_0x483d4c[_0x3064('0x26')]=_[_0x3064('0x27')](db[_0x3064('0x28')][_0x3064('0x1e')]);_0x483d4c[_0x3064('0x29')]=_[_0x3064('0x27')](_0x20ea80[_0x3064('0x29')]);_0x483d4c['filters']=_[_0x3064('0x2a')](_0x483d4c['model'],_0x483d4c['query']);_0x4fc969[_0x3064('0x2b')]=_[_0x3064('0x2a')](_0x483d4c[_0x3064('0x26')],qs[_0x3064('0x2c')](_0x20ea80[_0x3064('0x29')]['fields']));_0x4fc969[_0x3064('0x2b')]=_0x4fc969['attributes']['length']?_0x4fc969[_0x3064('0x2b')]:_0x483d4c[_0x3064('0x26')];if(_0x20ea80[_0x3064('0x29')][_0x3064('0x2d')]){_0x4fc969['include']=[{'all':!![]}];}_0x4fc969=_['merge']({},_0x4fc969,_0x20ea80[_0x3064('0x2e')]);return db[_0x3064('0x28')]['find'](_0x4fc969)['then'](handleEntityNotFound(_0x8c4b9c,null))[_0x3064('0x19')](respondWithResult(_0x8c4b9c,null))[_0x3064('0x24')](handleError(_0x8c4b9c,null));};exports['create']=function(_0x2fe659,_0x5b1f65){return db[_0x3064('0x28')]['create'](_0x2fe659['body'],{})['then'](respondWithResult(_0x5b1f65,0xc9))['catch'](handleError(_0x5b1f65,null));};exports[_0x3064('0x18')]=function(_0x3d6a61,_0x175072){if(_0x3d6a61[_0x3064('0x2f')]['id']){delete _0x3d6a61[_0x3064('0x2f')]['id'];}return db[_0x3064('0x28')][_0x3064('0x30')]({'where':{'id':_0x3d6a61['params']['id']}})['then'](handleEntityNotFound(_0x175072,null))[_0x3064('0x19')](saveUpdates(_0x3d6a61[_0x3064('0x2f')],null))[_0x3064('0x19')](respondWithResult(_0x175072,null))['catch'](handleError(_0x175072,null));};exports[_0x3064('0x1a')]=function(_0x2c8446,_0x89856f){return db[_0x3064('0x28')][_0x3064('0x30')]({'where':{'id':_0x2c8446[_0x3064('0x31')]['id']}})['then'](handleEntityNotFound(_0x89856f,null))[_0x3064('0x19')](removeEntity(_0x89856f,null))[_0x3064('0x24')](handleError(_0x89856f,null));};exports[_0x3064('0x32')]=function(_0x372c9f,_0x455867){return db[_0x3064('0x28')][_0x3064('0x32')]()[_0x3064('0x19')](respondWithResult(_0x455867,null))['catch'](handleError(_0x455867,null));};exports[_0x3064('0x33')]=function(_0x1af375,_0x3738b3){return db['FaxMessage']['find']({'where':{'id':_0x1af375[_0x3064('0x31')]['id']}})[_0x3064('0x19')](handleEntityNotFound(_0x3738b3,null))[_0x3064('0x19')](function(_0x2d880a){if(_0x2d880a){return _0x2d880a[_0x3064('0x33')](_0x1af375[_0x3064('0x2f')][_0x3064('0x34')],_[_0x3064('0x35')](_0x1af375[_0x3064('0x2f')],[_0x3064('0x34'),'id'])||{});}})[_0x3064('0x19')](respondWithResult(_0x3738b3,null))[_0x3064('0x24')](handleError(_0x3738b3,null));};exports['getMessages']=function(_0x158523,_0x38e18c){var _0x8b8c40={'raw':![],'where':{}};var _0x350f38={};var _0x544f03={'count':0x0,'rows':[]};return db[_0x3064('0x28')][_0x3064('0x36')]({'where':{'id':_0x158523[_0x3064('0x31')]['id']}})[_0x3064('0x19')](handleEntityNotFound(_0x38e18c,null))[_0x3064('0x19')](function(_0x15d6ca){if(_0x15d6ca){_0x350f38[_0x3064('0x26')]=_[_0x3064('0x27')](db[_0x3064('0x37')][_0x3064('0x1e')]);_0x350f38[_0x3064('0x29')]=_[_0x3064('0x27')](_0x158523[_0x3064('0x29')]);_0x350f38['filters']=_['intersection'](_0x350f38[_0x3064('0x26')],_0x350f38[_0x3064('0x29')]);_0x8b8c40[_0x3064('0x2b')]=_[_0x3064('0x2a')](_0x350f38[_0x3064('0x26')],qs[_0x3064('0x2c')](_0x158523[_0x3064('0x29')][_0x3064('0x2c')]));_0x8b8c40['attributes']=_0x8b8c40[_0x3064('0x2b')][_0x3064('0x38')]?_0x8b8c40['attributes']:_0x350f38['model'];if(!_0x158523[_0x3064('0x29')][_0x3064('0x39')](_0x3064('0x3a'))){_0x8b8c40[_0x3064('0x12')]=qs[_0x3064('0x12')](_0x158523[_0x3064('0x29')][_0x3064('0x12')]);_0x8b8c40[_0x3064('0x14')]=qs[_0x3064('0x14')](_0x158523['query']['offset']);}_0x8b8c40[_0x3064('0x3b')]=qs['sort'](_0x158523['query'][_0x3064('0x3c')]);_0x8b8c40['where']=qs['filters'](_[_0x3064('0x3d')](_0x158523[_0x3064('0x29')],_0x350f38[_0x3064('0x3e')]));_0x8b8c40[_0x3064('0x3f')][_0x3064('0x40')]=_0x15d6ca['id'];if(_0x158523[_0x3064('0x29')][_0x3064('0x41')]){_0x8b8c40[_0x3064('0x3f')]=_['merge'](_0x8b8c40['where'],{'$or':_[_0x3064('0x1d')](_0x8b8c40['attributes'],function(_0xf3da3b){var _0x524816={};_0x524816[_0xf3da3b]={'$like':'%'+_0x158523[_0x3064('0x29')]['filter']+'%'};return _0x524816;})});}if(_0x158523['query']['$gte']){var _0x58777f=_0x158523['query'][_0x3064('0x42')]['split'](',');var _0x367fd9={};_0x367fd9[_0x58777f[0x0]]={'$gte':moment(_0x58777f[0x1])[_0x3064('0x43')](_0x3064('0x44'))};_0x8b8c40[_0x3064('0x3f')]=_[_0x3064('0x45')](_0x8b8c40['where'],_0x367fd9);}_0x8b8c40=_[_0x3064('0x45')]({},_0x8b8c40,_0x158523[_0x3064('0x2e')]);return db[_0x3064('0x37')][_0x3064('0x13')]({'where':_0x8b8c40['where']})['then'](function(_0x1d7ebc){_0x544f03[_0x3064('0x13')]=_0x1d7ebc;if(_0x158523[_0x3064('0x29')]['includeAll']){_0x8b8c40[_0x3064('0x46')]=[{'all':!![]}];}return db['FaxMessage'][_0x3064('0x22')](_0x8b8c40);})[_0x3064('0x19')](function(_0x196869){_0x544f03['rows']=_0x196869;return _0x544f03;});}})[_0x3064('0x19')](respondWithFilteredResult(_0x38e18c,_0x8b8c40))[_0x3064('0x24')](handleError(_0x38e18c,null));};exports[_0x3064('0x47')]=function(_0x29996e,_0x18659d){return db['FaxInteraction']['find']({'where':{'id':_0x29996e[_0x3064('0x31')]['id']}})[_0x3064('0x19')](handleEntityNotFound(_0x18659d,null))[_0x3064('0x19')](function(_0x5eb94c){if(_0x5eb94c){return _0x5eb94c['setTags'](_0x29996e[_0x3064('0x2f')]['ids'],_[_0x3064('0x35')](_0x29996e[_0x3064('0x2f')],[_0x3064('0x34'),'id'])||{})[_0x3064('0x48')](function(){return db[_0x3064('0x49')][_0x3064('0x22')]({'attributes':['id',_0x3064('0x1c'),_0x3064('0x4a')],'where':{'id':_0x29996e[_0x3064('0x2f')][_0x3064('0x34')]}});})[_0x3064('0x19')](function(_0x2cb83e){socket['emit'](_0x3064('0x4b'),{'id':Number(_0x29996e[_0x3064('0x31')]['id']),'tags':_0x2cb83e||[]});return{'id':Number(_0x29996e[_0x3064('0x31')]['id']),'tags':_0x2cb83e||[]};});}})[_0x3064('0x19')](respondWithResult(_0x18659d,null))[_0x3064('0x24')](handleError(_0x18659d,null));};exports[_0x3064('0x4c')]=function(_0x4424ec,_0x32f80d){return db[_0x3064('0x28')]['find']({'where':{'id':_0x4424ec['params']['id']}})['then'](handleEntityNotFound(_0x32f80d,null))[_0x3064('0x19')](function(_0xe30984){if(_0xe30984){return _0xe30984[_0x3064('0x4c')](_0x4424ec[_0x3064('0x29')][_0x3064('0x34')]);}})[_0x3064('0x19')](respondWithStatusCode(_0x32f80d,null))[_0x3064('0x24')](handleError(_0x32f80d,null));};exports['download']=function(_0x5d9a63,_0x45debc){var _0x1d4f20=moment()[_0x3064('0x4d')]()[_0x3064('0x4e')]();var _0x1711be=path['join'](config[_0x3064('0x4f')],_0x3064('0x50'),_0x3064('0x51'),_0x3064('0x52'));var _0xbe75a0=path['join'](config['root'],'server',_0x3064('0x51'),_0x3064('0x53'));var _0x61ae39=path[_0x3064('0x54')](_0x1711be,_0x1d4f20);var _0x1725c3=util[_0x3064('0x43')](_0x3064('0x55'),_0x5d9a63['params']['id'],_0x1d4f20);var _0x5a0195=path[_0x3064('0x54')](_0x1711be,_0x1725c3);var _0x1ca7bc=[];_0x1ca7bc[_0x3064('0x56')]({'model':db[_0x3064('0x57')],'as':'Attachment','raw':!![]});var _0x7b83c0=[{'model':db[_0x3064('0x37')],'as':_0x3064('0x58'),'attributes':['id',_0x3064('0x2f'),_0x3064('0x59')],'include':_0x1ca7bc}];return db['FaxInteraction'][_0x3064('0x30')]({'where':{'id':_0x5d9a63[_0x3064('0x31')]['id']},'include':_0x7b83c0})['then'](handleEntityNotFound(_0x45debc,null))['then'](function(_0x4fc537){if(_0x4fc537&&_0x4fc537[_0x3064('0x58')]){var _0x5367db=_0x4fc537[_0x3064('0x5a')]({'plain':!![]});fs['mkdirSync'](_0x61ae39);for(var _0x2a10e0=0x0;_0x2a10e0<_0x5367db[_0x3064('0x58')][_0x3064('0x38')];_0x2a10e0++){var _0x3658b2=_0x5367db[_0x3064('0x58')][_0x2a10e0]['Attachment'];if(_0x3658b2){var _0x5ca4cd=path[_0x3064('0x54')](_0xbe75a0,_0x3658b2['basename']);if(fs[_0x3064('0x5b')](_0x5ca4cd)){fs[_0x3064('0x5c')](_0x5ca4cd)[_0x3064('0x5d')](fs[_0x3064('0x5e')](path[_0x3064('0x54')](_0x61ae39,_0x3658b2[_0x3064('0x5f')])));}}}return BPromise[_0x3064('0x60')]()[_0x3064('0x19')](function(){return new BPromise(function(_0x422994,_0x30ee69){zipdir(_0x61ae39,{'saveTo':_0x5a0195},function(_0x16f462,_0x25f173){if(_0x16f462)return _0x30ee69(_0x16f462);return _0x422994(_0x25f173);});})[_0x3064('0x19')](function(){return new BPromise(function(_0x31764d,_0x331ac2){rimraf(_0x61ae39,function(_0x32bca3){if(_0x32bca3)_0x331ac2(_0x32bca3);return _0x31764d();});});})[_0x3064('0x19')](function(){return _0x45debc[_0x3064('0x61')](_0x5a0195,_0x1725c3,function(_0x4ec4b3){if(_0x4ec4b3){console['log'](_0x3064('0x62'),_0x4ec4b3);}else{fs['unlinkSync'](_0x5a0195);}});});});}else{return _0x45debc[_0x3064('0xe')](0xc8);}})[_0x3064('0x24')](handleError(_0x45debc,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 2c164c1..c33f5ea 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 _0xdc79=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage'];(function(_0x33dd25,_0x25f58f){var _0x1bfa6d=function(_0x125e1c){while(--_0x125e1c){_0x33dd25['push'](_0x33dd25['shift']());}};_0x1bfa6d(++_0x25f58f);}(_0xdc79,0x130));var _0x9dc7=function(_0x5022d3,_0x2995fb){_0x5022d3=_0x5022d3-0x0;var _0x35a550=_0xdc79[_0x5022d3];return _0x35a550;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x9dc7('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x9dc7('0x0'))['db'][_0x9dc7('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9dc7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9dc7('0x3'),'afterDestroy':_0x9dc7('0x4')};function emitEvent(_0x367068){return function(_0x58f0b9,_0x1c6633,_0xa44ae1){_0x58f0b9[_0x9dc7('0x5')]({'attributes':['id'],'raw':!![]})[_0x9dc7('0x6')](function(_0x539084){_0x58f0b9[_0x9dc7('0x7')](_0x9dc7('0x8'),_0x539084[_0x9dc7('0x9')](function(_0x2a18a5){return{'id':_0x2a18a5['id']};}));return FaxMessage[_0x9dc7('0xa')]({'where':{'FaxInteractionId':_0x58f0b9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9dc7('0x6')](function(_0x512770){_0x58f0b9['setDataValue'](_0x9dc7('0xb'),_0x512770[_0x9dc7('0xc')]);FaxInteractionEvents[_0x9dc7('0xd')](_0x367068+':'+_0x58f0b9['id'],_0x58f0b9);FaxInteractionEvents[_0x9dc7('0xd')](_0x367068,_0x58f0b9);_0xa44ae1(null);})[_0x9dc7('0xe')](_0xa44ae1(null));};}for(var e in events){if(events[_0x9dc7('0xf')](e)){var event=events[e];FaxInteraction[_0x9dc7('0x10')](e,emitEvent(event));}}module[_0x9dc7('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x7dc6=['map','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','setDataValue'];(function(_0x35693e,_0x127774){var _0x19fb67=function(_0xc459a7){while(--_0xc459a7){_0x35693e['push'](_0x35693e['shift']());}};_0x19fb67(++_0x127774);}(_0x7dc6,0x80));var _0x67dc=function(_0x414376,_0x1d96f4){_0x414376=_0x414376-0x0;var _0x513250=_0x7dc6[_0x414376];return _0x513250;};'use strict';var EventEmitter=require(_0x67dc('0x0'));var FaxInteraction=require(_0x67dc('0x1'))['db'][_0x67dc('0x2')];var FaxMessage=require(_0x67dc('0x1'))['db'][_0x67dc('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x67dc('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x67dc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x400753){return function(_0x5992c3,_0x51c155,_0x598be8){_0x5992c3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x401936){_0x5992c3[_0x67dc('0x6')]('Users',_0x401936[_0x67dc('0x7')](function(_0x3e8bb1){return{'id':_0x3e8bb1['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x5992c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x67dc('0x8')](function(_0x4b61d4){_0x5992c3[_0x67dc('0x6')]('unreadMessages',_0x4b61d4[_0x67dc('0x9')]);FaxInteractionEvents[_0x67dc('0xa')](_0x400753+':'+_0x5992c3['id'],_0x5992c3);FaxInteractionEvents[_0x67dc('0xa')](_0x400753,_0x5992c3);_0x598be8(null);})[_0x67dc('0xb')](_0x598be8(null));};}for(var e in events){if(events[_0x67dc('0xc')](e)){var event=events[e];FaxInteraction[_0x67dc('0xd')](e,emitEvent(event));}}module[_0x67dc('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index cd4dfb3..cbd39bf 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 _0x8e3f=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','fax_interactions','changed','closed','closedAt','format'];(function(_0xdc93dd,_0x579789){var _0x4ad477=function(_0x313a8b){while(--_0x313a8b){_0xdc93dd['push'](_0xdc93dd['shift']());}};_0x4ad477(++_0x579789);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('FaxInteraction',attributes,{'tableName':_0xf8e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e39b7,_0x17f56c,_0x95ad03){if(_0x2e39b7[_0xf8e3('0xb')](_0xf8e3('0xc'))){_0x2e39b7[_0xf8e3('0xd')]=moment()[_0xf8e3('0xe')](_0xf8e3('0xf'));}_0x95ad03(null,_0x2e39b7);}}});}; \ No newline at end of file +var _0xeeb4=['YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format'];(function(_0x4d2443,_0xbecd24){var _0x5b9393=function(_0xcca0ab){while(--_0xcca0ab){_0x4d2443['push'](_0x4d2443['shift']());}};_0x5b9393(++_0xbecd24);}(_0xeeb4,0x1f1));var _0x4eeb=function(_0x32c4dc,_0x5b20f0){_0x32c4dc=_0x32c4dc-0x0;var _0x228fc4=_0xeeb4[_0x32c4dc];return _0x228fc4;};'use strict';var _=require(_0x4eeb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4eeb('0x1'));var moment=require(_0x4eeb('0x2'));var BPromise=require(_0x4eeb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4eeb('0x4'));var rimraf=require(_0x4eeb('0x5'));var config=require(_0x4eeb('0x6'));var attributes=require(_0x4eeb('0x7'));module[_0x4eeb('0x8')]=function(_0x188800,_0x1306b7){return _0x188800['define'](_0x4eeb('0x9'),attributes,{'tableName':_0x4eeb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x37ee5,_0x41a7a4,_0xc71f78){if(_0x37ee5[_0x4eeb('0xb')](_0x4eeb('0xc'))){_0x37ee5[_0x4eeb('0xd')]=moment()[_0x4eeb('0xe')](_0x4eeb('0xf'));}_0xc71f78(null,_0x37ee5);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f3e706a..97490d8 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 _0xfecc=['error','code','message','info','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','find','addTags','ids','omit','spread','AddTags','debug','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0xfecc,0x1cd));var _0xcfec=function(_0x324341,_0x4f23c9){_0x324341=_0x324341-0x0;var _0x451a37=_0xfecc[_0x324341];return _0x451a37;};'use strict';var _=require(_0xcfec('0x0'));var util=require(_0xcfec('0x1'));var moment=require(_0xcfec('0x2'));var BPromise=require(_0xcfec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfec('0x5'));var logger=require(_0xcfec('0x6'))(_0xcfec('0x7'));var config=require(_0xcfec('0x8'));var jayson=require(_0xcfec('0x9'));var client=jayson[_0xcfec('0xa')][_0xcfec('0xb')]({'port':0x232a});config[_0xcfec('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfec('0xc')]));require(_0xcfec('0xd'))['register'](socket);function respondWithRpcPromise(_0x49ff54,_0x577587,_0x114319){return new BPromise(function(_0x4306f8,_0x2ffd66){return client[_0xcfec('0xe')](_0x49ff54,_0x114319)[_0xcfec('0xf')](function(_0xcb87b7){logger['info'](_0xcfec('0x10'),_0x577587,'request\x20sent');logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x577587,_0xcfec('0x11'),JSON[_0xcfec('0x12')](_0xcb87b7));if(_0xcb87b7['error']){if(_0xcb87b7[_0xcfec('0x13')][_0xcfec('0x14')]===0x1f4){logger[_0xcfec('0x13')](_0xcfec('0x10'),_0x577587,_0xcb87b7[_0xcfec('0x13')][_0xcfec('0x15')]);return _0x2ffd66(_0xcb87b7[_0xcfec('0x13')][_0xcfec('0x15')]);}logger[_0xcfec('0x13')](_0xcfec('0x10'),_0x577587,_0xcb87b7['error'][_0xcfec('0x15')]);return _0x4306f8(_0xcb87b7[_0xcfec('0x13')][_0xcfec('0x15')]);}else{logger[_0xcfec('0x16')](_0xcfec('0x10'),_0x577587,_0xcfec('0x11'));_0x4306f8(_0xcb87b7[_0xcfec('0x17')][_0xcfec('0x15')]);}})['catch'](function(_0x4364ce){logger['error'](_0xcfec('0x10'),_0x577587,_0x4364ce);_0x2ffd66(_0x4364ce);});});}exports[_0xcfec('0x18')]=function(_0x4f1f2c){var _0x432e96=this;return new Promise(function(_0x3400c9,_0xcccbe6){return db[_0xcfec('0x19')][_0xcfec('0x1a')](_0x4f1f2c[_0xcfec('0x1b')],{'raw':_0x4f1f2c[_0xcfec('0x1c')]?_0x4f1f2c['options'][_0xcfec('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f1f2c[_0xcfec('0x1c')]?_0x4f1f2c['options']['where']||null:null,'attributes':_0x4f1f2c[_0xcfec('0x1c')]?_0x4f1f2c[_0xcfec('0x1c')][_0xcfec('0x1e')]||null:null,'limit':_0x4f1f2c[_0xcfec('0x1c')]?_0x4f1f2c['options'][_0xcfec('0x1f')]||null:null})[_0xcfec('0xf')](function(_0x31a8c7){logger[_0xcfec('0x16')]('UpdateFaxInteraction',_0x4f1f2c);logger['debug']('UpdateFaxInteraction',_0x4f1f2c,JSON['stringify'](_0x31a8c7));_0x3400c9(_0x31a8c7);})['catch'](function(_0x51ceeb){logger[_0xcfec('0x13')](_0xcfec('0x18'),_0x51ceeb[_0xcfec('0x15')],_0x4f1f2c);_0xcccbe6(_0x432e96[_0xcfec('0x13')](0x1f4,_0x51ceeb[_0xcfec('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x18b178){return new Promise(function(_0x4b0c25,_0x22b5cd){return db[_0xcfec('0x19')][_0xcfec('0x20')]({'where':_0x18b178[_0xcfec('0x1c')]?_0x18b178[_0xcfec('0x1c')]['where']||null:null})[_0xcfec('0xf')](function(_0x114ecf){if(_0x114ecf){return _0x114ecf[_0xcfec('0x21')](_0x18b178[_0xcfec('0x1b')][_0xcfec('0x22')],_[_0xcfec('0x23')](_0x18b178[_0xcfec('0x1b')],[_0xcfec('0x22'),'id'])||{});}})[_0xcfec('0x24')](function(_0x1284e1){logger[_0xcfec('0x16')](_0xcfec('0x25'),_0x18b178);logger[_0xcfec('0x26')]('AddTags',_0x18b178,JSON[_0xcfec('0x12')](_0x1284e1));_0x4b0c25(_0x1284e1);})[_0xcfec('0x27')](function(_0x1d36da){logger[_0xcfec('0x13')](_0xcfec('0x25'),_0x1d36da[_0xcfec('0x15')],_0x18b178);_0x22b5cd(_this[_0xcfec('0x13')](0x1f4,_0x1d36da['message']));});});}; \ No newline at end of file +var _0xaa95=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','stringify','AddTagsToFaxInteraction','find','then','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xaa95,0x192));var _0x5aa9=function(_0x18ae01,_0x166374){_0x18ae01=_0x18ae01-0x0;var _0x4b8f9c=_0xaa95[_0x18ae01];return _0x4b8f9c;};'use strict';var _=require(_0x5aa9('0x0'));var util=require('util');var moment=require(_0x5aa9('0x1'));var BPromise=require(_0x5aa9('0x2'));var rs=require(_0x5aa9('0x3'));var fs=require('fs');var Redis=require(_0x5aa9('0x4'));var db=require(_0x5aa9('0x5'))['db'];var utils=require(_0x5aa9('0x6'));var logger=require(_0x5aa9('0x7'))(_0x5aa9('0x8'));var config=require('../../config/environment');var jayson=require(_0x5aa9('0x9'));var client=jayson[_0x5aa9('0xa')][_0x5aa9('0xb')]({'port':0x232a});config[_0x5aa9('0xc')]=_[_0x5aa9('0xd')](config[_0x5aa9('0xc')],{'host':_0x5aa9('0xe'),'port':0x18eb});var socket=require(_0x5aa9('0xf'))(new Redis(config[_0x5aa9('0xc')]));require(_0x5aa9('0x10'))[_0x5aa9('0x11')](socket);function respondWithRpcPromise(_0x27d565,_0x45670b,_0x58d379){return new BPromise(function(_0x3ec920,_0x2a2477){return client[_0x5aa9('0x12')](_0x27d565,_0x58d379)['then'](function(_0x252020){logger[_0x5aa9('0x13')](_0x5aa9('0x14'),_0x45670b,_0x5aa9('0x15'));logger[_0x5aa9('0x16')](_0x5aa9('0x17'),_0x45670b,_0x5aa9('0x15'),JSON['stringify'](_0x252020));if(_0x252020['error']){if(_0x252020[_0x5aa9('0x18')][_0x5aa9('0x19')]===0x1f4){logger[_0x5aa9('0x18')](_0x5aa9('0x14'),_0x45670b,_0x252020['error'][_0x5aa9('0x1a')]);return _0x2a2477(_0x252020[_0x5aa9('0x18')][_0x5aa9('0x1a')]);}logger[_0x5aa9('0x18')](_0x5aa9('0x14'),_0x45670b,_0x252020[_0x5aa9('0x18')][_0x5aa9('0x1a')]);return _0x3ec920(_0x252020['error']['message']);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x45670b,_0x5aa9('0x15'));_0x3ec920(_0x252020[_0x5aa9('0x1b')][_0x5aa9('0x1a')]);}})[_0x5aa9('0x1c')](function(_0x37cd1a){logger['error'](_0x5aa9('0x14'),_0x45670b,_0x37cd1a);_0x2a2477(_0x37cd1a);});});}exports[_0x5aa9('0x1d')]=function(_0x16374d){var _0x116848=this;return new Promise(function(_0x262f8c,_0x560cc6){return db[_0x5aa9('0x1e')]['update'](_0x16374d['body'],{'raw':_0x16374d['options']?_0x16374d[_0x5aa9('0x1f')][_0x5aa9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16374d[_0x5aa9('0x1f')]?_0x16374d['options'][_0x5aa9('0x21')]||null:null,'attributes':_0x16374d[_0x5aa9('0x1f')]?_0x16374d[_0x5aa9('0x1f')][_0x5aa9('0x22')]||null:null,'limit':_0x16374d['options']?_0x16374d[_0x5aa9('0x1f')]['limit']||null:null})['then'](function(_0x463d1d){logger[_0x5aa9('0x13')]('UpdateFaxInteraction',_0x16374d);logger[_0x5aa9('0x16')](_0x5aa9('0x1d'),_0x16374d,JSON[_0x5aa9('0x23')](_0x463d1d));_0x262f8c(_0x463d1d);})[_0x5aa9('0x1c')](function(_0x4410f4){logger[_0x5aa9('0x18')](_0x5aa9('0x1d'),_0x4410f4[_0x5aa9('0x1a')],_0x16374d);_0x560cc6(_0x116848[_0x5aa9('0x18')](0x1f4,_0x4410f4['message']));});});};exports[_0x5aa9('0x24')]=function(_0x2a31fe){return new Promise(function(_0x1aec47,_0x340894){return db[_0x5aa9('0x1e')][_0x5aa9('0x25')]({'where':_0x2a31fe[_0x5aa9('0x1f')]?_0x2a31fe['options'][_0x5aa9('0x21')]||null:null})[_0x5aa9('0x26')](function(_0x39dd96){if(_0x39dd96){return _0x39dd96[_0x5aa9('0x27')](_0x2a31fe[_0x5aa9('0x28')][_0x5aa9('0x29')],_[_0x5aa9('0x2a')](_0x2a31fe[_0x5aa9('0x28')],[_0x5aa9('0x29'),'id'])||{});}})[_0x5aa9('0x2b')](function(_0xcaaa9d){logger['info'](_0x5aa9('0x2c'),_0x2a31fe);logger[_0x5aa9('0x16')](_0x5aa9('0x2c'),_0x2a31fe,JSON['stringify'](_0xcaaa9d));_0x1aec47(_0xcaaa9d);})[_0x5aa9('0x1c')](function(_0x5a0561){logger[_0x5aa9('0x18')]('AddTags',_0x5a0561[_0x5aa9('0x1a')],_0x2a31fe);_0x340894(_this[_0x5aa9('0x18')](0x1f4,_0x5a0561['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index b3c80b6..ea1a93a 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 _0x9f9c=['emit','removeListener','length','save','remove','update'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0x9f9c,0x87));var _0xc9f9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9f9c[_0x21a9d9];return _0x46adce;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xc9f9('0x0'),_0xc9f9('0x1'),_0xc9f9('0x2')];function createListener(_0x1f6e31,_0x3b18b9){return function(_0x52f668){_0x3b18b9[_0xc9f9('0x3')](_0x1f6e31,_0x52f668);};}function removeListener(_0x1d06c8,_0x130887){return function(){FaxInteractionEvents[_0xc9f9('0x4')](_0x1d06c8,_0x130887);};}exports['register']=function(_0x3f8afb){for(var _0x29e6f6=0x0,_0x411d05=events[_0xc9f9('0x5')];_0x29e6f6<_0x411d05;_0x29e6f6++){var _0x348dcd=events[_0x29e6f6];var _0x573e2b=createListener('faxInteraction:'+_0x348dcd,_0x3f8afb);FaxInteractionEvents['on'](_0x348dcd,_0x573e2b);}}; \ No newline at end of file +var _0x2add=['faxInteraction:','./faxInteraction.events','save','remove','update','register'];(function(_0x15e89b,_0x4381ce){var _0x401d64=function(_0x250c76){while(--_0x250c76){_0x15e89b['push'](_0x15e89b['shift']());}};_0x401d64(++_0x4381ce);}(_0x2add,0x109));var _0xd2ad=function(_0x1ba8ff,_0x19a44b){_0x1ba8ff=_0x1ba8ff-0x0;var _0x8ba836=_0x2add[_0x1ba8ff];return _0x8ba836;};'use strict';var FaxInteractionEvents=require(_0xd2ad('0x0'));var events=[_0xd2ad('0x1'),_0xd2ad('0x2'),_0xd2ad('0x3')];function createListener(_0x2abc60,_0x18ba15){return function(_0x599226){_0x18ba15['emit'](_0x2abc60,_0x599226);};}function removeListener(_0x4c7eb7,_0x49ea5a){return function(){FaxInteractionEvents['removeListener'](_0x4c7eb7,_0x49ea5a);};}exports[_0xd2ad('0x4')]=function(_0x2f1596){for(var _0x345ec3=0x0,_0x647e07=events['length'];_0x345ec3<_0x647e07;_0x345ec3++){var _0x1d3d85=events[_0x345ec3];var _0x5f2396=createListener(_0xd2ad('0x5')+_0x1d3d85,_0x2f1596);FaxInteractionEvents['on'](_0x1d3d85,_0x5f2396);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9a2cfd7..bab7c38 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 _0x705a=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','fax','faxinteraction:addtags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index'];(function(_0x26b9f8,_0x5b915b){var _0x4b268f=function(_0x4e806d){while(--_0x4e806d){_0x26b9f8['push'](_0x26b9f8['shift']());}};_0x4b268f(++_0x5b915b);}(_0x705a,0x7f));var _0xa705=function(_0x1d5401,_0x1dad11){_0x1d5401=_0x1d5401-0x0;var _0x4ee1c3=_0x705a[_0x1d5401];return _0x4ee1c3;};'use strict';var multer=require('multer');var util=require(_0xa705('0x0'));var path=require(_0xa705('0x1'));var timeout=require(_0xa705('0x2'));var express=require(_0xa705('0x3'));var router=express[_0xa705('0x4')]();var fs_extra=require(_0xa705('0x5'));var auth=require(_0xa705('0x6'));var interaction=require(_0xa705('0x7'));var config=require(_0xa705('0x8'));var controller=require(_0xa705('0x9'));router[_0xa705('0xa')]('/',auth[_0xa705('0xb')](),controller[_0xa705('0xc')]);router[_0xa705('0xa')](_0xa705('0xd'),auth['isAuthenticated'](),controller[_0xa705('0xe')]);router['get'](_0xa705('0xf'),auth[_0xa705('0xb')](),controller[_0xa705('0x10')]);router['get'](_0xa705('0x11'),auth[_0xa705('0xb')](),controller[_0xa705('0x12')]);router[_0xa705('0xa')](_0xa705('0x13'),auth[_0xa705('0xb')](),controller['download']);router[_0xa705('0x14')]('/',auth['isAuthenticated'](),controller[_0xa705('0x15')]);router[_0xa705('0x14')](_0xa705('0x11'),auth[_0xa705('0xb')](),controller[_0xa705('0x16')]);router[_0xa705('0x14')]('/:id/tags',auth[_0xa705('0xb')](),interaction['tracked'](_0xa705('0x17'),_0xa705('0x18')),controller['addTags']);router[_0xa705('0x19')]('/:id',auth[_0xa705('0xb')](),interaction[_0xa705('0x1a')](_0xa705('0x17'),_0xa705('0x1b')),controller[_0xa705('0x1c')]);router[_0xa705('0x1d')](_0xa705('0xf'),auth[_0xa705('0xb')](),interaction[_0xa705('0x1a')](_0xa705('0x17'),_0xa705('0x1e')),controller[_0xa705('0x1f')]);router[_0xa705('0x1d')](_0xa705('0x20'),auth['isAuthenticated'](),controller[_0xa705('0x21')]);module[_0xa705('0x22')]=router; \ No newline at end of file +var _0xd8c3=['download','create','post','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd8c3,0xfe));var _0x3d8c=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd8c3[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x3d8c('0x0'));var util=require('util');var path=require(_0x3d8c('0x1'));var timeout=require(_0x3d8c('0x2'));var express=require(_0x3d8c('0x3'));var router=express[_0x3d8c('0x4')]();var fs_extra=require(_0x3d8c('0x5'));var auth=require(_0x3d8c('0x6'));var interaction=require(_0x3d8c('0x7'));var config=require(_0x3d8c('0x8'));var controller=require(_0x3d8c('0x9'));router[_0x3d8c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3d8c('0xa')](_0x3d8c('0xb'),auth[_0x3d8c('0xc')](),controller['describe']);router[_0x3d8c('0xa')](_0x3d8c('0xd'),auth['isAuthenticated'](),controller[_0x3d8c('0xe')]);router[_0x3d8c('0xa')](_0x3d8c('0xf'),auth['isAuthenticated'](),controller[_0x3d8c('0x10')]);router[_0x3d8c('0xa')](_0x3d8c('0x11'),auth[_0x3d8c('0xc')](),controller[_0x3d8c('0x12')]);router['post']('/',auth[_0x3d8c('0xc')](),controller[_0x3d8c('0x13')]);router[_0x3d8c('0x14')](_0x3d8c('0xf'),auth[_0x3d8c('0xc')](),controller['addMessage']);router[_0x3d8c('0x14')](_0x3d8c('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x3d8c('0x16'),_0x3d8c('0x17')),controller[_0x3d8c('0x18')]);router[_0x3d8c('0x19')]('/:id',auth[_0x3d8c('0xc')](),interaction[_0x3d8c('0x1a')](_0x3d8c('0x16'),_0x3d8c('0x1b')),controller[_0x3d8c('0x1c')]);router[_0x3d8c('0x1d')]('/:id',auth[_0x3d8c('0xc')](),interaction[_0x3d8c('0x1a')](_0x3d8c('0x16'),_0x3d8c('0x1e')),controller[_0x3d8c('0x1f')]);router[_0x3d8c('0x1d')]('/:id/tags',auth[_0x3d8c('0xc')](),controller[_0x3d8c('0x20')]);module[_0x3d8c('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 659b208..c2236f4 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 _0x21d1=['ENUM','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0x21d1,0x1c9));var _0x121d=function(_0x1cf0bc,_0xc504a2){_0x1cf0bc=_0x1cf0bc-0x0;var _0x221ea6=_0x21d1[_0x1cf0bc];return _0x221ea6;};'use strict';var Sequelize=require(_0x121d('0x0'));module[_0x121d('0x1')]={'body':{'type':Sequelize[_0x121d('0x2')](_0x121d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x121d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x121d('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x121d('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x121d('0x6')]}}; \ No newline at end of file +var _0xc2cc=['medium','ENUM','out','DATE','exports','TEXT'];(function(_0x3f3bad,_0x193f06){var _0x4f0801=function(_0x5cfd32){while(--_0x5cfd32){_0x3f3bad['push'](_0x3f3bad['shift']());}};_0x4f0801(++_0x193f06);}(_0xc2cc,0x70));var _0xcc2c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc2cc[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xcc2c('0x0')]={'body':{'type':Sequelize[_0xcc2c('0x1')](_0xcc2c('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xcc2c('0x3')]('in','out'),'defaultValue':_0xcc2c('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xcc2c('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index ef8e6c9..99edd36 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 _0x1e16=['util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','fax-interactions','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','end','sendStatus','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','FaxMessage','includeAll','rows','show','keys','length','options','find','update','body','params','describe','accept','sms','fax','reject','UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','get','role','stringify','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','findOne','ContactId','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','download'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x1e16,0x1d8));var _0x61e1=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x1e16[_0x5550b3];return _0x4b8fc4;};'use strict';var util=require(_0x61e1('0x0'));var path=require('path');var _=require(_0x61e1('0x1'));var Redis=require(_0x61e1('0x2'));var interactionService=require(_0x61e1('0x3'));var qs=require(_0x61e1('0x4'));var logger=require(_0x61e1('0x5'))(_0x61e1('0x6'));var config=require(_0x61e1('0x7'));var db=require(_0x61e1('0x8'))['db'];config['redis']=_[_0x61e1('0x9')](config[_0x61e1('0xa')],{'host':_0x61e1('0xb'),'port':0x18eb});var socket=require(_0x61e1('0xc'))(new Redis(config[_0x61e1('0xa')]));require(_0x61e1('0xd'))[_0x61e1('0xe')](socket);var jayson=require(_0x61e1('0xf'));var client=jayson[_0x61e1('0x10')]['http']({'port':0x232c});var client9002=jayson[_0x61e1('0x10')][_0x61e1('0x11')]({'port':0x232a});var interaction_log=require(_0x61e1('0x5'))(_0x61e1('0x12'));function respondWithRpcPromise(_0x251237,_0x32c5dc,_0x166f46,_0x42d58c){return new Promise(function(_0x373773,_0x2736d4){var _0x4641ac=_0x42d58c||client;return _0x4641ac['request'](_0x251237,_0x166f46)['then'](function(_0x17e6f7){logger[_0x61e1('0x13')]('FaxMessage,\x20%s,\x20%s',_0x32c5dc,_0x61e1('0x14'));logger['debug'](_0x61e1('0x15'),_0x32c5dc,_0x61e1('0x14'),JSON['stringify'](_0x17e6f7));if(_0x17e6f7['error']){if(_0x17e6f7[_0x61e1('0x16')][_0x61e1('0x17')]===0x1f4){logger[_0x61e1('0x16')](_0x61e1('0x18'),_0x32c5dc,_0x17e6f7[_0x61e1('0x16')]['message']);return _0x2736d4(_0x17e6f7[_0x61e1('0x16')][_0x61e1('0x19')]);}logger['error'](_0x61e1('0x18'),_0x32c5dc,_0x17e6f7[_0x61e1('0x16')][_0x61e1('0x19')]);return _0x373773(_0x17e6f7[_0x61e1('0x16')][_0x61e1('0x19')]);}else{logger[_0x61e1('0x13')](_0x61e1('0x18'),_0x32c5dc,'request\x20sent');_0x373773(_0x17e6f7[_0x61e1('0x1a')][_0x61e1('0x19')]);}})[_0x61e1('0x1b')](function(_0x583682){logger[_0x61e1('0x16')](_0x61e1('0x18'),_0x32c5dc,_0x583682);_0x2736d4(_0x583682);});});}function respondWithResult(_0x4d785e,_0x435477){_0x435477=_0x435477||0xc8;return function(_0x560105){if(_0x560105){return _0x4d785e[_0x61e1('0x1c')](_0x435477)[_0x61e1('0x1d')](_0x560105);}};}function respondWithFilteredResult(_0x5a4d4b,_0x14efb1){return function(_0x2ab137){if(_0x2ab137){var _0x40f50e=typeof _0x14efb1[_0x61e1('0x1e')]===_0x61e1('0x1f')&&typeof _0x14efb1['limit']==='undefined';var _0x4d22d5=_0x2ab137[_0x61e1('0x20')];var _0x1736eb=_0x40f50e?0x0:_0x14efb1[_0x61e1('0x1e')];var _0x5790b9=_0x40f50e?_0x2ab137['count']:_0x14efb1['offset']+_0x14efb1[_0x61e1('0x21')];var _0x1c2948;if(_0x5790b9>=_0x4d22d5){_0x5790b9=_0x4d22d5;_0x1c2948=0xc8;}else{_0x1c2948=0xce;}_0x5a4d4b[_0x61e1('0x1c')](_0x1c2948);return _0x5a4d4b[_0x61e1('0x22')](_0x61e1('0x23'),_0x1736eb+'-'+_0x5790b9+'/'+_0x4d22d5)[_0x61e1('0x1d')](_0x2ab137);}return null;};}function saveUpdates(_0x30f261){return function(_0x477107){if(_0x477107){return _0x477107['update'](_0x30f261)['then'](function(_0x358c6c){return _0x358c6c;});}return null;};}function removeEntity(_0x16c030){return function(_0x3854e2){if(_0x3854e2){return _0x3854e2[_0x61e1('0x24')]()[_0x61e1('0x25')](function(){_0x16c030[_0x61e1('0x1c')](0xcc)[_0x61e1('0x26')]();});}};}function handleEntityNotFound(_0x1a7275){return function(_0x5d6b00){if(!_0x5d6b00){_0x1a7275[_0x61e1('0x27')](0x194);}return _0x5d6b00;};}function handleError(_0x292928,_0x36270f){_0x36270f=_0x36270f||0x1f4;return function(_0x1df8d2){logger['error'](_0x1df8d2['stack']);if(_0x1df8d2[_0x61e1('0x28')]){delete _0x1df8d2[_0x61e1('0x28')];}_0x292928['status'](_0x36270f)[_0x61e1('0x29')](_0x1df8d2);};}exports[_0x61e1('0x2a')]=function(_0x1b9394,_0x52effe){var _0x35bee8={},_0x15deb6={},_0x588bcf={'count':0x0,'rows':[]};var _0x10ab0c=_[_0x61e1('0x2b')](db['FaxMessage'][_0x61e1('0x2c')],function(_0xac7d79){return{'name':_0xac7d79['fieldName'],'type':_0xac7d79[_0x61e1('0x2d')][_0x61e1('0x2e')]};});_0x15deb6[_0x61e1('0x2f')]=_[_0x61e1('0x2b')](_0x10ab0c,'name');_0x15deb6[_0x61e1('0x30')]=_['keys'](_0x1b9394['query']);_0x15deb6['filters']=_[_0x61e1('0x31')](_0x15deb6[_0x61e1('0x2f')],_0x15deb6[_0x61e1('0x30')]);_0x35bee8['attributes']=_[_0x61e1('0x31')](_0x15deb6['model'],qs[_0x61e1('0x32')](_0x1b9394[_0x61e1('0x30')][_0x61e1('0x32')]));_0x35bee8[_0x61e1('0x33')]=_0x35bee8[_0x61e1('0x33')]['length']?_0x35bee8[_0x61e1('0x33')]:_0x15deb6[_0x61e1('0x2f')];if(!_0x1b9394[_0x61e1('0x30')][_0x61e1('0x34')](_0x61e1('0x35'))){_0x35bee8['limit']=qs[_0x61e1('0x21')](_0x1b9394[_0x61e1('0x30')][_0x61e1('0x21')]);_0x35bee8['offset']=qs[_0x61e1('0x1e')](_0x1b9394[_0x61e1('0x30')][_0x61e1('0x1e')]);}_0x35bee8[_0x61e1('0x36')]=qs['sort'](_0x1b9394[_0x61e1('0x30')]['sort']);_0x35bee8[_0x61e1('0x37')]=qs['filters'](_[_0x61e1('0x38')](_0x1b9394[_0x61e1('0x30')],_0x15deb6[_0x61e1('0x39')]),_0x10ab0c);if(_0x1b9394[_0x61e1('0x30')][_0x61e1('0x3a')]){_0x35bee8[_0x61e1('0x37')]=_[_0x61e1('0x3b')](_0x35bee8[_0x61e1('0x37')],{'$or':_[_0x61e1('0x2b')](_0x10ab0c,function(_0x8555a0){if(_0x8555a0[_0x61e1('0x2d')]!==_0x61e1('0x3c')){var _0x471b86={};_0x471b86[_0x8555a0[_0x61e1('0x28')]]={'$like':'%'+_0x1b9394['query'][_0x61e1('0x3a')]+'%'};return _0x471b86;}})});}_0x35bee8=_[_0x61e1('0x3b')]({},_0x35bee8,_0x1b9394['options']);var _0xe85e9a={'where':_0x35bee8[_0x61e1('0x37')]};return db[_0x61e1('0x3d')][_0x61e1('0x20')](_0xe85e9a)[_0x61e1('0x25')](function(_0x29dbaa){_0x588bcf[_0x61e1('0x20')]=_0x29dbaa;if(_0x1b9394['query'][_0x61e1('0x3e')]){_0x35bee8['include']=[{'all':!![]}];}return db[_0x61e1('0x3d')]['findAll'](_0x35bee8);})[_0x61e1('0x25')](function(_0x55c71f){_0x588bcf[_0x61e1('0x3f')]=_0x55c71f;return _0x588bcf;})['then'](respondWithFilteredResult(_0x52effe,_0x35bee8))[_0x61e1('0x1b')](handleError(_0x52effe,null));};exports[_0x61e1('0x40')]=function(_0x35037f,_0x2f0f41){var _0xf5d2fe={'raw':!![],'where':{'id':_0x35037f['params']['id']}},_0x491805={};_0x491805[_0x61e1('0x2f')]=_[_0x61e1('0x41')](db[_0x61e1('0x3d')][_0x61e1('0x2c')]);_0x491805[_0x61e1('0x30')]=_[_0x61e1('0x41')](_0x35037f[_0x61e1('0x30')]);_0x491805[_0x61e1('0x39')]=_[_0x61e1('0x31')](_0x491805[_0x61e1('0x2f')],_0x491805[_0x61e1('0x30')]);_0xf5d2fe[_0x61e1('0x33')]=_[_0x61e1('0x31')](_0x491805[_0x61e1('0x2f')],qs[_0x61e1('0x32')](_0x35037f[_0x61e1('0x30')][_0x61e1('0x32')]));_0xf5d2fe[_0x61e1('0x33')]=_0xf5d2fe['attributes'][_0x61e1('0x42')]?_0xf5d2fe[_0x61e1('0x33')]:_0x491805['model'];if(_0x35037f[_0x61e1('0x30')][_0x61e1('0x3e')]){_0xf5d2fe['include']=[{'all':!![]}];}_0xf5d2fe=_['merge']({},_0xf5d2fe,_0x35037f[_0x61e1('0x43')]);return db['FaxMessage'][_0x61e1('0x44')](_0xf5d2fe)[_0x61e1('0x25')](handleEntityNotFound(_0x2f0f41,null))[_0x61e1('0x25')](respondWithResult(_0x2f0f41,null))['catch'](handleError(_0x2f0f41,null));};exports[_0x61e1('0x45')]=function(_0x5babaf,_0x1516d9){if(_0x5babaf[_0x61e1('0x46')]['id']){delete _0x5babaf['body']['id'];}return db[_0x61e1('0x3d')]['find']({'where':{'id':_0x5babaf['params']['id']}})[_0x61e1('0x25')](handleEntityNotFound(_0x1516d9,null))[_0x61e1('0x25')](saveUpdates(_0x5babaf[_0x61e1('0x46')],null))[_0x61e1('0x25')](respondWithResult(_0x1516d9,null))[_0x61e1('0x1b')](handleError(_0x1516d9,null));};exports[_0x61e1('0x24')]=function(_0x7b4c5b,_0x498437){return db[_0x61e1('0x3d')]['find']({'where':{'id':_0x7b4c5b[_0x61e1('0x47')]['id']}})[_0x61e1('0x25')](handleEntityNotFound(_0x498437,null))[_0x61e1('0x25')](removeEntity(_0x498437,null))[_0x61e1('0x1b')](handleError(_0x498437,null));};exports[_0x61e1('0x48')]=function(_0x389c7f,_0x126c27){return db[_0x61e1('0x3d')][_0x61e1('0x48')]()[_0x61e1('0x25')](respondWithResult(_0x126c27,null))[_0x61e1('0x1b')](handleError(_0x126c27,null));};exports[_0x61e1('0x49')]=function(_0x1a3152,_0x329e1b){var _0x336b71=_0x61e1('0x4a');return interactionService['acceptMessage'](_0x1a3152,_0x336b71)[_0x61e1('0x25')](respondWithResult(_0x329e1b,null))[_0x61e1('0x1b')](handleError(_0x329e1b,null));};exports['accept']=function(_0x5e4706,_0x519b9a){var _0x2636e9=_0x61e1('0x4b');return interactionService['acceptMessage'](_0x5e4706,_0x2636e9)['then'](respondWithResult(_0x519b9a,null))[_0x61e1('0x1b')](handleError(_0x519b9a,null));};exports[_0x61e1('0x4c')]=function(_0x12b8e2,_0x429302){var _0x21649e={'agent':{},'channel':'fax'};if(_0x12b8e2[_0x61e1('0x46')]['id']){delete _0x12b8e2[_0x61e1('0x46')]['id'];}_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')]=_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')]||_0x12b8e2[_0x61e1('0x4e')]['id'];_0x21649e[_0x61e1('0x4f')]['id']=_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')];return db['FaxMessage'][_0x61e1('0x44')]({'where':{'id':_0x12b8e2[_0x61e1('0x47')]['id'],'UserId':null}})[_0x61e1('0x25')](handleEntityNotFound(_0x429302,null))[_0x61e1('0x25')](function(_0x9e6204){if(_0x9e6204){_0x21649e[_0x61e1('0x19')]=_0x9e6204['get']({'plain':!![]});return db[_0x61e1('0x50')][_0x61e1('0x44')]({'where':{'id':_0x9e6204[_0x61e1('0x51')]}});}return null;})[_0x61e1('0x25')](handleEntityNotFound(_0x429302,null))[_0x61e1('0x25')](function(_0x39f32e){if(_0x39f32e){_0x21649e[_0x61e1('0x52')]=_0x39f32e[_0x61e1('0x53')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12b8e2[_0x61e1('0x4e')]['id'],_0x12b8e2['user'][_0x61e1('0x28')],_0x12b8e2['user'][_0x61e1('0x54')],_0x21649e[_0x61e1('0x52')]['id'],_0x12b8e2[_0x61e1('0x46')]?JSON[_0x61e1('0x55')](_0x12b8e2[_0x61e1('0x46')]):_0x61e1('0x56'));return respondWithRpcPromise('RejectMessage',_0x61e1('0x57'),_0x21649e);}return null;})[_0x61e1('0x25')](function(_0x21da3d){var _0x1a2ed2=_0x61e1('0x58')+_0x21da3d[_0x61e1('0x19')]['ContactId'];return db[_0x61e1('0x59')]['query'](_0x1a2ed2,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x61e1('0x25')](function(_0x2e0d8a){return _0x2e0d8a;});})[_0x61e1('0x25')](function(_0x52716e){if(_0x52716e){_0x21649e['message'][_0x61e1('0x5a')]=_0x52716e[0x0];if(!_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')])return;return db[_0x61e1('0x5b')][_0x61e1('0x44')]({'where':{'id':_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')],'role':_0x61e1('0x4f')},'attributes':['id','name',_0x61e1('0x5c'),_0x61e1('0x5d'),_0x61e1('0x5e')],'raw':!![]});}return null;})['then'](function(_0x429820){if(!_0x429820)return null;_0x21649e[_0x61e1('0x19')]['agent']=_0x429820;return _0x21649e;})[_0x61e1('0x25')](function(_0x2238b9){if(_0x2238b9){_0x2238b9['message'][_0x61e1('0x5f')]=util[_0x61e1('0x60')](_0x61e1('0x61'),_0x12b8e2[_0x61e1('0x4e')][_0x61e1('0x28')]);_0x2238b9['message']['channel']=_0x21649e[_0x61e1('0x62')];_0x2238b9[_0x61e1('0x19')][_0x61e1('0x63')]=_0x21649e[_0x61e1('0x62')];_0x2238b9['message'][_0x61e1('0x64')]=_0x61e1('0x4c');respondWithRpcPromise('EventManager',_0x61e1('0x65'),{'event':_0x61e1('0x66'),'message':_0x2238b9['message']},client9002);return _0x21649e;}return null;})['then'](respondWithResult(_0x429302,null))[_0x61e1('0x1b')](handleError(_0x429302,null));};exports[_0x61e1('0x67')]=function(_0x58a4bc,_0x397fab){var _0x5684ae;return db[_0x61e1('0x3d')][_0x61e1('0x67')](_0x58a4bc['body'],{})[_0x61e1('0x25')](function(_0x20fe53){_0x5684ae=_0x20fe53;return db[_0x61e1('0x68')][_0x61e1('0x69')]({'where':{'id':_0x5684ae[_0x61e1('0x6a')]}});})['then'](function(_0x18534c){if(_[_0x61e1('0x6b')](_0x18534c)){return;}else{_0x5684ae[_0x61e1('0x4b')]=_0x18534c['fax'];return db[_0x61e1('0x6c')]['findOne']({'where':{'id':_0x5684ae[_0x61e1('0x6d')]}});}})[_0x61e1('0x25')](function(_0x48d081){return respondWithRpcPromise('SendFax',_0x61e1('0x6e'),{'FaxAccountId':_['isNil'](_0x58a4bc['body'])?undefined:_0x58a4bc[_0x61e1('0x46')][_0x61e1('0x6f')],'path':_[_0x61e1('0x6b')](_0x48d081)?undefined:util['format'](_0x61e1('0x70'),_0x48d081[_0x61e1('0x71')]),'fax':_['isNil'](_0x5684ae[_0x61e1('0x4b')])?undefined:_0x5684ae['fax'],'AttachmentId':_0x5684ae[_0x61e1('0x6d')]},client9002);})['then'](respondWithResult(_0x397fab,0xc9))['catch'](handleError(_0x397fab,null));};exports['download']=function(_0x23c552,_0x1ae3f6){var _0x49b298=path[_0x61e1('0x72')](config[_0x61e1('0x73')],'server',_0x61e1('0x74'),'attachments');return db[_0x61e1('0x3d')][_0x61e1('0x44')]({'where':{'id':_0x23c552[_0x61e1('0x47')]['id']},'include':[{'model':db[_0x61e1('0x6c')],'as':_0x61e1('0x6c')}]})[_0x61e1('0x25')](handleEntityNotFound(_0x1ae3f6,null))[_0x61e1('0x25')](function(_0x5c5abf){if(_0x5c5abf){return _0x1ae3f6[_0x61e1('0x75')](path[_0x61e1('0x72')](_0x49b298,_0x5c5abf['Attachment']['basename']));}})[_0x61e1('0x1b')](handleError(_0x1ae3f6,null));}; \ No newline at end of file +var _0x8a00=['get','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','join','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','fax-interactions','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','body','describe','accept','acceptMessage','fax','reject','UserId','user','agent'];(function(_0x479541,_0x342724){var _0x26e17d=function(_0x8d35c2){while(--_0x8d35c2){_0x479541['push'](_0x479541['shift']());}};_0x26e17d(++_0x342724);}(_0x8a00,0x182));var _0x08a0=function(_0x4dde64,_0x57151b){_0x4dde64=_0x4dde64-0x0;var _0xacf196=_0x8a00[_0x4dde64];return _0xacf196;};'use strict';var util=require('util');var path=require(_0x08a0('0x0'));var _=require(_0x08a0('0x1'));var Redis=require(_0x08a0('0x2'));var interactionService=require(_0x08a0('0x3'));var qs=require(_0x08a0('0x4'));var logger=require(_0x08a0('0x5'))('api');var config=require(_0x08a0('0x6'));var db=require(_0x08a0('0x7'))['db'];config[_0x08a0('0x8')]=_[_0x08a0('0x9')](config[_0x08a0('0x8')],{'host':_0x08a0('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')[_0x08a0('0xb')](socket);var jayson=require(_0x08a0('0xc'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x08a0('0xd')]['http']({'port':0x232a});var interaction_log=require(_0x08a0('0x5'))(_0x08a0('0xe'));function respondWithRpcPromise(_0x5cc3f4,_0xf7de55,_0x3c4a35,_0x29e373){return new Promise(function(_0x49cf01,_0x521be5){var _0x4f10b7=_0x29e373||client;return _0x4f10b7['request'](_0x5cc3f4,_0x3c4a35)[_0x08a0('0xf')](function(_0x35b529){logger[_0x08a0('0x10')](_0x08a0('0x11'),_0xf7de55,_0x08a0('0x12'));logger[_0x08a0('0x13')](_0x08a0('0x14'),_0xf7de55,_0x08a0('0x12'),JSON['stringify'](_0x35b529));if(_0x35b529[_0x08a0('0x15')]){if(_0x35b529[_0x08a0('0x15')][_0x08a0('0x16')]===0x1f4){logger[_0x08a0('0x15')](_0x08a0('0x11'),_0xf7de55,_0x35b529[_0x08a0('0x15')][_0x08a0('0x17')]);return _0x521be5(_0x35b529[_0x08a0('0x15')][_0x08a0('0x17')]);}logger[_0x08a0('0x15')](_0x08a0('0x11'),_0xf7de55,_0x35b529[_0x08a0('0x15')]['message']);return _0x49cf01(_0x35b529['error'][_0x08a0('0x17')]);}else{logger[_0x08a0('0x10')](_0x08a0('0x11'),_0xf7de55,_0x08a0('0x12'));_0x49cf01(_0x35b529['result'][_0x08a0('0x17')]);}})[_0x08a0('0x18')](function(_0x272529){logger['error'](_0x08a0('0x11'),_0xf7de55,_0x272529);_0x521be5(_0x272529);});});}function respondWithResult(_0x245fb1,_0x5a6e89){_0x5a6e89=_0x5a6e89||0xc8;return function(_0x4dc244){if(_0x4dc244){return _0x245fb1[_0x08a0('0x19')](_0x5a6e89)[_0x08a0('0x1a')](_0x4dc244);}};}function respondWithFilteredResult(_0x5be4aa,_0xa641e0){return function(_0x143d9e){if(_0x143d9e){var _0x203e58=typeof _0xa641e0[_0x08a0('0x1b')]===_0x08a0('0x1c')&&typeof _0xa641e0['limit']===_0x08a0('0x1c');var _0x334e3c=_0x143d9e[_0x08a0('0x1d')];var _0x194160=_0x203e58?0x0:_0xa641e0[_0x08a0('0x1b')];var _0x3d6c14=_0x203e58?_0x143d9e[_0x08a0('0x1d')]:_0xa641e0[_0x08a0('0x1b')]+_0xa641e0[_0x08a0('0x1e')];var _0x527043;if(_0x3d6c14>=_0x334e3c){_0x3d6c14=_0x334e3c;_0x527043=0xc8;}else{_0x527043=0xce;}_0x5be4aa[_0x08a0('0x19')](_0x527043);return _0x5be4aa[_0x08a0('0x1f')](_0x08a0('0x20'),_0x194160+'-'+_0x3d6c14+'/'+_0x334e3c)[_0x08a0('0x1a')](_0x143d9e);}return null;};}function saveUpdates(_0x84b7bd){return function(_0x36482a){if(_0x36482a){return _0x36482a[_0x08a0('0x21')](_0x84b7bd)[_0x08a0('0xf')](function(_0x3fe679){return _0x3fe679;});}return null;};}function removeEntity(_0x1fc7fc){return function(_0x593bfc){if(_0x593bfc){return _0x593bfc[_0x08a0('0x22')]()[_0x08a0('0xf')](function(){_0x1fc7fc[_0x08a0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe7dd9){return function(_0x443c24){if(!_0x443c24){_0xbe7dd9[_0x08a0('0x23')](0x194);}return _0x443c24;};}function handleError(_0x14bee5,_0x4295dc){_0x4295dc=_0x4295dc||0x1f4;return function(_0x2f3988){logger['error'](_0x2f3988[_0x08a0('0x24')]);if(_0x2f3988[_0x08a0('0x25')]){delete _0x2f3988[_0x08a0('0x25')];}_0x14bee5[_0x08a0('0x19')](_0x4295dc)[_0x08a0('0x26')](_0x2f3988);};}exports[_0x08a0('0x27')]=function(_0x5e22c0,_0xdf68e9){var _0x4c37b2={},_0x240cb0={},_0x53b2d3={'count':0x0,'rows':[]};var _0x1a8153=_[_0x08a0('0x28')](db[_0x08a0('0x29')][_0x08a0('0x2a')],function(_0x518af3){return{'name':_0x518af3['fieldName'],'type':_0x518af3[_0x08a0('0x2b')][_0x08a0('0x2c')]};});_0x240cb0[_0x08a0('0x2d')]=_[_0x08a0('0x28')](_0x1a8153,'name');_0x240cb0['query']=_[_0x08a0('0x2e')](_0x5e22c0['query']);_0x240cb0[_0x08a0('0x2f')]=_[_0x08a0('0x30')](_0x240cb0[_0x08a0('0x2d')],_0x240cb0[_0x08a0('0x31')]);_0x4c37b2[_0x08a0('0x32')]=_[_0x08a0('0x30')](_0x240cb0['model'],qs['fields'](_0x5e22c0[_0x08a0('0x31')][_0x08a0('0x33')]));_0x4c37b2[_0x08a0('0x32')]=_0x4c37b2[_0x08a0('0x32')][_0x08a0('0x34')]?_0x4c37b2[_0x08a0('0x32')]:_0x240cb0['model'];if(!_0x5e22c0[_0x08a0('0x31')][_0x08a0('0x35')](_0x08a0('0x36'))){_0x4c37b2[_0x08a0('0x1e')]=qs['limit'](_0x5e22c0[_0x08a0('0x31')][_0x08a0('0x1e')]);_0x4c37b2[_0x08a0('0x1b')]=qs['offset'](_0x5e22c0[_0x08a0('0x31')][_0x08a0('0x1b')]);}_0x4c37b2[_0x08a0('0x37')]=qs[_0x08a0('0x38')](_0x5e22c0[_0x08a0('0x31')][_0x08a0('0x38')]);_0x4c37b2[_0x08a0('0x39')]=qs[_0x08a0('0x2f')](_[_0x08a0('0x3a')](_0x5e22c0[_0x08a0('0x31')],_0x240cb0['filters']),_0x1a8153);if(_0x5e22c0[_0x08a0('0x31')][_0x08a0('0x3b')]){_0x4c37b2[_0x08a0('0x39')]=_['merge'](_0x4c37b2[_0x08a0('0x39')],{'$or':_[_0x08a0('0x28')](_0x1a8153,function(_0x5388f9){if(_0x5388f9[_0x08a0('0x2b')]!=='VIRTUAL'){var _0xa19849={};_0xa19849[_0x5388f9['name']]={'$like':'%'+_0x5e22c0['query'][_0x08a0('0x3b')]+'%'};return _0xa19849;}})});}_0x4c37b2=_[_0x08a0('0x3c')]({},_0x4c37b2,_0x5e22c0['options']);var _0x1735b8={'where':_0x4c37b2[_0x08a0('0x39')]};return db[_0x08a0('0x29')][_0x08a0('0x1d')](_0x1735b8)[_0x08a0('0xf')](function(_0x239498){_0x53b2d3[_0x08a0('0x1d')]=_0x239498;if(_0x5e22c0[_0x08a0('0x31')][_0x08a0('0x3d')]){_0x4c37b2[_0x08a0('0x3e')]=[{'all':!![]}];}return db['FaxMessage'][_0x08a0('0x3f')](_0x4c37b2);})[_0x08a0('0xf')](function(_0x321989){_0x53b2d3[_0x08a0('0x40')]=_0x321989;return _0x53b2d3;})[_0x08a0('0xf')](respondWithFilteredResult(_0xdf68e9,_0x4c37b2))['catch'](handleError(_0xdf68e9,null));};exports[_0x08a0('0x41')]=function(_0x47639b,_0x49e6fb){var _0x449c99={'raw':!![],'where':{'id':_0x47639b[_0x08a0('0x42')]['id']}},_0x4cd1f5={};_0x4cd1f5[_0x08a0('0x2d')]=_[_0x08a0('0x2e')](db[_0x08a0('0x29')][_0x08a0('0x2a')]);_0x4cd1f5[_0x08a0('0x31')]=_[_0x08a0('0x2e')](_0x47639b[_0x08a0('0x31')]);_0x4cd1f5[_0x08a0('0x2f')]=_['intersection'](_0x4cd1f5[_0x08a0('0x2d')],_0x4cd1f5[_0x08a0('0x31')]);_0x449c99[_0x08a0('0x32')]=_[_0x08a0('0x30')](_0x4cd1f5[_0x08a0('0x2d')],qs['fields'](_0x47639b['query'][_0x08a0('0x33')]));_0x449c99[_0x08a0('0x32')]=_0x449c99[_0x08a0('0x32')][_0x08a0('0x34')]?_0x449c99[_0x08a0('0x32')]:_0x4cd1f5[_0x08a0('0x2d')];if(_0x47639b[_0x08a0('0x31')][_0x08a0('0x3d')]){_0x449c99['include']=[{'all':!![]}];}_0x449c99=_[_0x08a0('0x3c')]({},_0x449c99,_0x47639b[_0x08a0('0x43')]);return db[_0x08a0('0x29')][_0x08a0('0x44')](_0x449c99)[_0x08a0('0xf')](handleEntityNotFound(_0x49e6fb,null))[_0x08a0('0xf')](respondWithResult(_0x49e6fb,null))[_0x08a0('0x18')](handleError(_0x49e6fb,null));};exports[_0x08a0('0x21')]=function(_0x5f02ef,_0x1ef831){if(_0x5f02ef[_0x08a0('0x45')]['id']){delete _0x5f02ef[_0x08a0('0x45')]['id'];}return db['FaxMessage'][_0x08a0('0x44')]({'where':{'id':_0x5f02ef[_0x08a0('0x42')]['id']}})[_0x08a0('0xf')](handleEntityNotFound(_0x1ef831,null))[_0x08a0('0xf')](saveUpdates(_0x5f02ef['body'],null))[_0x08a0('0xf')](respondWithResult(_0x1ef831,null))[_0x08a0('0x18')](handleError(_0x1ef831,null));};exports[_0x08a0('0x22')]=function(_0x3fbd93,_0x565d34){return db[_0x08a0('0x29')]['find']({'where':{'id':_0x3fbd93[_0x08a0('0x42')]['id']}})[_0x08a0('0xf')](handleEntityNotFound(_0x565d34,null))[_0x08a0('0xf')](removeEntity(_0x565d34,null))[_0x08a0('0x18')](handleError(_0x565d34,null));};exports[_0x08a0('0x46')]=function(_0x9c9261,_0x3329e2){return db[_0x08a0('0x29')]['describe']()[_0x08a0('0xf')](respondWithResult(_0x3329e2,null))[_0x08a0('0x18')](handleError(_0x3329e2,null));};exports[_0x08a0('0x47')]=function(_0x21d2a7,_0x3c1291){var _0x26b7c6='sms';return interactionService[_0x08a0('0x48')](_0x21d2a7,_0x26b7c6)[_0x08a0('0xf')](respondWithResult(_0x3c1291,null))[_0x08a0('0x18')](handleError(_0x3c1291,null));};exports[_0x08a0('0x47')]=function(_0x54b344,_0x3e6a01){var _0xc1cab9=_0x08a0('0x49');return interactionService[_0x08a0('0x48')](_0x54b344,_0xc1cab9)['then'](respondWithResult(_0x3e6a01,null))['catch'](handleError(_0x3e6a01,null));};exports[_0x08a0('0x4a')]=function(_0x4107f6,_0x52b9e8){var _0x451aca={'agent':{},'channel':_0x08a0('0x49')};if(_0x4107f6[_0x08a0('0x45')]['id']){delete _0x4107f6[_0x08a0('0x45')]['id'];}_0x4107f6['body'][_0x08a0('0x4b')]=_0x4107f6['body'][_0x08a0('0x4b')]||_0x4107f6[_0x08a0('0x4c')]['id'];_0x451aca[_0x08a0('0x4d')]['id']=_0x4107f6[_0x08a0('0x45')][_0x08a0('0x4b')];return db[_0x08a0('0x29')][_0x08a0('0x44')]({'where':{'id':_0x4107f6[_0x08a0('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52b9e8,null))['then'](function(_0x3f88f1){if(_0x3f88f1){_0x451aca[_0x08a0('0x17')]=_0x3f88f1[_0x08a0('0x4e')]({'plain':!![]});return db[_0x08a0('0x4f')][_0x08a0('0x44')]({'where':{'id':_0x3f88f1[_0x08a0('0x50')]}});}return null;})[_0x08a0('0xf')](handleEntityNotFound(_0x52b9e8,null))[_0x08a0('0xf')](function(_0xb0c8aa){if(_0xb0c8aa){_0x451aca['interaction']=_0xb0c8aa['get']({'plain':!![]});interaction_log['info'](_0x08a0('0x51'),_0x4107f6[_0x08a0('0x4c')]['id'],_0x4107f6[_0x08a0('0x4c')][_0x08a0('0x25')],_0x4107f6[_0x08a0('0x4c')][_0x08a0('0x52')],_0x451aca[_0x08a0('0x53')]['id'],_0x4107f6['body']?JSON[_0x08a0('0x54')](_0x4107f6[_0x08a0('0x45')]):'null');return respondWithRpcPromise(_0x08a0('0x55'),'rejectMessage',_0x451aca);}return null;})['then'](function(_0x34ce0d){var _0x552028=_0x08a0('0x56')+_0x34ce0d['message'][_0x08a0('0x57')];return db[_0x08a0('0x58')]['query'](_0x552028,{'type':db[_0x08a0('0x59')][_0x08a0('0x5a')]['SELECT'],'raw':!![]})[_0x08a0('0xf')](function(_0x29fdab){return _0x29fdab;});})[_0x08a0('0xf')](function(_0x5979cf){if(_0x5979cf){_0x451aca['message']['contact']=_0x5979cf[0x0];if(!_0x4107f6[_0x08a0('0x45')]['UserId'])return;return db[_0x08a0('0x5b')][_0x08a0('0x44')]({'where':{'id':_0x4107f6[_0x08a0('0x45')]['UserId'],'role':_0x08a0('0x4d')},'attributes':['id',_0x08a0('0x25'),_0x08a0('0x5c'),_0x08a0('0x5d'),'internal'],'raw':!![]});}return null;})[_0x08a0('0xf')](function(_0x5ee2f8){if(!_0x5ee2f8)return null;_0x451aca['message'][_0x08a0('0x4d')]=_0x5ee2f8;return _0x451aca;})['then'](function(_0x1b2242){if(_0x1b2242){_0x1b2242[_0x08a0('0x17')]['interface']=util[_0x08a0('0x5e')](_0x08a0('0x5f'),_0x4107f6[_0x08a0('0x4c')]['name']);_0x1b2242[_0x08a0('0x17')][_0x08a0('0x60')]=_0x451aca[_0x08a0('0x60')];_0x1b2242[_0x08a0('0x17')][_0x08a0('0x61')]=_0x451aca['channel'];_0x1b2242[_0x08a0('0x17')][_0x08a0('0x62')]=_0x08a0('0x4a');respondWithRpcPromise(_0x08a0('0x63'),_0x08a0('0x63'),{'event':_0x08a0('0x64'),'message':_0x1b2242['message']},client9002);return _0x451aca;}return null;})[_0x08a0('0xf')](respondWithResult(_0x52b9e8,null))['catch'](handleError(_0x52b9e8,null));};exports['create']=function(_0x5bcbfe,_0xc4798c){var _0x5d2ee5;return db[_0x08a0('0x29')][_0x08a0('0x65')](_0x5bcbfe[_0x08a0('0x45')],{})[_0x08a0('0xf')](function(_0x318a9e){_0x5d2ee5=_0x318a9e;return db[_0x08a0('0x66')][_0x08a0('0x67')]({'where':{'id':_0x5d2ee5['ContactId']}});})['then'](function(_0x312bd6){if(_[_0x08a0('0x68')](_0x312bd6)){return;}else{_0x5d2ee5[_0x08a0('0x49')]=_0x312bd6['fax'];return db[_0x08a0('0x69')][_0x08a0('0x67')]({'where':{'id':_0x5d2ee5['AttachmentId']}});}})['then'](function(_0x4e9861){return respondWithRpcPromise(_0x08a0('0x6a'),_0x08a0('0x6a'),{'FaxAccountId':_[_0x08a0('0x68')](_0x5bcbfe[_0x08a0('0x45')])?undefined:_0x5bcbfe['body'][_0x08a0('0x6b')],'path':_['isNil'](_0x4e9861)?undefined:util[_0x08a0('0x5e')](_0x08a0('0x6c'),_0x4e9861[_0x08a0('0x6d')]),'fax':_[_0x08a0('0x68')](_0x5d2ee5[_0x08a0('0x49')])?undefined:_0x5d2ee5[_0x08a0('0x49')],'AttachmentId':_0x5d2ee5[_0x08a0('0x6e')]},client9002);})[_0x08a0('0xf')](respondWithResult(_0xc4798c,0xc9))[_0x08a0('0x18')](handleError(_0xc4798c,null));};exports[_0x08a0('0x6f')]=function(_0x55129b,_0x285939){var _0x9fdc2e=path['join'](config[_0x08a0('0x70')],_0x08a0('0x71'),_0x08a0('0x72'),'attachments');return db[_0x08a0('0x29')][_0x08a0('0x44')]({'where':{'id':_0x55129b['params']['id']},'include':[{'model':db[_0x08a0('0x69')],'as':_0x08a0('0x69')}]})[_0x08a0('0xf')](handleEntityNotFound(_0x285939,null))['then'](function(_0xa6e963){if(_0xa6e963){return _0x285939[_0x08a0('0x6f')](path[_0x08a0('0x73')](_0x9fdc2e,_0xa6e963['Attachment'][_0x08a0('0x6d')]));}})[_0x08a0('0x18')](handleError(_0x285939,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 1fa57e6..5f99e67 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 _0x2b47=['FaxMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x35e6df,_0x4d7818){var _0x22133e=function(_0x5438ef){while(--_0x5438ef){_0x35e6df['push'](_0x35e6df['shift']());}};_0x22133e(++_0x4d7818);}(_0x2b47,0x177));var _0x72b4=function(_0x54384a,_0x1c26bc){_0x54384a=_0x54384a-0x0;var _0x495f12=_0x2b47[_0x54384a];return _0x495f12;};'use strict';var EventEmitter=require(_0x72b4('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x72b4('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x72b4('0x2')](0x0);var events={'afterCreate':_0x72b4('0x3'),'afterUpdate':'update','afterDestroy':_0x72b4('0x4')};function emitEvent(_0x299680){return function(_0x2a3f83,_0x302681,_0x160600){FaxMessageEvents[_0x72b4('0x5')](_0x299680+':'+_0x2a3f83['id'],_0x2a3f83);FaxMessageEvents['emit'](_0x299680,_0x2a3f83);_0x160600(null);};}for(var e in events){if(events[_0x72b4('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x72b4('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xee4a=['setMaxListeners','save','remove','emit','hook','exports','events','FaxMessage'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xee4a,0x9e));var _0xaee4=function(_0x5464fe,_0x2fc333){_0x5464fe=_0x5464fe-0x0;var _0x352d79=_0xee4a[_0x5464fe];return _0x352d79;};'use strict';var EventEmitter=require(_0xaee4('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xaee4('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xaee4('0x2')](0x0);var events={'afterCreate':_0xaee4('0x3'),'afterUpdate':'update','afterDestroy':_0xaee4('0x4')};function emitEvent(_0x53d222){return function(_0x12b88f,_0x5a4a26,_0x150f41){FaxMessageEvents['emit'](_0x53d222+':'+_0x12b88f['id'],_0x12b88f);FaxMessageEvents[_0xaee4('0x5')](_0x53d222,_0x12b88f);_0x150f41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xaee4('0x6')](e,emitEvent(event));}}module[_0xaee4('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 478764a..1a73ba7 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 _0xb14c=['models','direction','toLowerCase','out','secret','isNil','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','FULLTEXT'];(function(_0x4cc588,_0x4a9bc4){var _0x36619d=function(_0x12ee64){while(--_0x12ee64){_0x4cc588['push'](_0x4cc588['shift']());}};_0x36619d(++_0x4a9bc4);}(_0xb14c,0x109));var _0xcb14=function(_0xccd329,_0xc7b4d6){_0xccd329=_0xccd329-0x0;var _0x1f815b=_0xb14c[_0xccd329];return _0x1f815b;};'use strict';var _=require('lodash');var util=require(_0xcb14('0x0'));var logger=require(_0xcb14('0x1'))(_0xcb14('0x2'));var moment=require(_0xcb14('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcb14('0x4'));var config=require(_0xcb14('0x5'));var attributes=require(_0xcb14('0x6'));module[_0xcb14('0x7')]=function(_0x2cdf68,_0x5c3ffc){return _0x2cdf68['define'](_0xcb14('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xcb14('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22d675,_0x5d5fb3,_0x1db505){var _0x344dd9=_0x2cdf68[_0xcb14('0xa')];var _0x7d39b0=_0x22d675['get']({'plain':!![]});if(_0x7d39b0[_0xcb14('0xb')][_0xcb14('0xc')]()==='in'||_0x7d39b0[_0xcb14('0xb')][_0xcb14('0xc')]()===_0xcb14('0xd')&&!_0x7d39b0[_0xcb14('0xe')]&&!_[_0xcb14('0xf')](_0x7d39b0['UserId'])){_0x344dd9['FaxInteraction'][_0xcb14('0x10')]({'where':{'id':_0x7d39b0[_0xcb14('0x11')]}})[_0xcb14('0x12')](function(_0x13f30a){if(_0x13f30a){_0x13f30a[_0xcb14('0x13')]({'lastMsgAt':_0x7d39b0[_0xcb14('0x14')],'lastMsgDirection':_0x7d39b0['direction']['toLowerCase']()});}})[_0xcb14('0x15')](function(_0x4d3135){console[_0xcb14('0x16')](_0x4d3135);});}_0x1db505();}},'charset':_0xcb14('0x17'),'collate':_0xcb14('0x18')});}; \ No newline at end of file +var _0xc4fc=['../../config/environment','exports','define','FaxMessage','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','FaxInteraction','findOne','FaxInteractionId','catch','error','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc4fc,0x119));var _0xcc4f=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xc4fc[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xcc4f('0x0'));var util=require('util');var logger=require(_0xcc4f('0x1'))(_0xcc4f('0x2'));var moment=require(_0xcc4f('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc4f('0x4'));var fs=require('fs');var path=require(_0xcc4f('0x5'));var rimraf=require(_0xcc4f('0x6'));var config=require(_0xcc4f('0x7'));var attributes=require('./faxMessage.attributes');module[_0xcc4f('0x8')]=function(_0x583401,_0x553837){return _0x583401[_0xcc4f('0x9')](_0xcc4f('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xcc4f('0xb')],'type':_0xcc4f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e6af8,_0x97d6ac,_0x6713da){var _0x96b8bb=_0x583401[_0xcc4f('0xd')];var _0x59a0fa=_0x5e6af8[_0xcc4f('0xe')]({'plain':!![]});if(_0x59a0fa['direction'][_0xcc4f('0xf')]()==='in'||_0x59a0fa[_0xcc4f('0x10')][_0xcc4f('0xf')]()===_0xcc4f('0x11')&&!_0x59a0fa[_0xcc4f('0x12')]&&!_['isNil'](_0x59a0fa['UserId'])){_0x96b8bb[_0xcc4f('0x13')][_0xcc4f('0x14')]({'where':{'id':_0x59a0fa[_0xcc4f('0x15')]}})['then'](function(_0x5be837){if(_0x5be837){_0x5be837['update']({'lastMsgAt':_0x59a0fa['createdAt'],'lastMsgDirection':_0x59a0fa[_0xcc4f('0x10')][_0xcc4f('0xf')]()});}})[_0xcc4f('0x16')](function(_0x500c76){console[_0xcc4f('0x17')](_0x500c76);});}_0x6713da();}},'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 9371c2a..bdfa6b7 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 _0x2d17=['create','catch','UpdateFaxMessage','FaxMessage','body','options','where','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxMessage'];(function(_0x40e8b3,_0x14d009){var _0x1f6e27=function(_0x4779d0){while(--_0x4779d0){_0x40e8b3['push'](_0x40e8b3['shift']());}};_0x1f6e27(++_0x14d009);}(_0x2d17,0x17e));var _0x72d1=function(_0x5c6d2a,_0x15c969){_0x5c6d2a=_0x5c6d2a-0x0;var _0x3dd62b=_0x2d17[_0x5c6d2a];return _0x3dd62b;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});config[_0x72d1('0x9')]=_['defaults'](config[_0x72d1('0x9')],{'host':_0x72d1('0xa'),'port':0x18eb});var socket=require(_0x72d1('0xb'))(new Redis(config['redis']));require(_0x72d1('0xc'))[_0x72d1('0xd')](socket);function respondWithRpcPromise(_0x283775,_0x593c91,_0x1d7520){return new BPromise(function(_0x3a35c6,_0x45eb4a){return client[_0x72d1('0xe')](_0x283775,_0x1d7520)[_0x72d1('0xf')](function(_0x3916f2){logger[_0x72d1('0x10')](_0x72d1('0x11'),_0x593c91,_0x72d1('0x12'));logger[_0x72d1('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'),JSON[_0x72d1('0x14')](_0x3916f2));if(_0x3916f2[_0x72d1('0x15')]){if(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x16')]===0x1f4){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);return _0x45eb4a(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);}logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2['error'][_0x72d1('0x17')]);return _0x3a35c6(_0x3916f2['error'][_0x72d1('0x17')]);}else{logger[_0x72d1('0x10')]('FaxMessage,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'));_0x3a35c6(_0x3916f2[_0x72d1('0x18')][_0x72d1('0x17')]);}})['catch'](function(_0x4925f6){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x4925f6);_0x45eb4a(_0x4925f6);});});}exports[_0x72d1('0x19')]=function(_0x1865c1){var _0x8d6890=this;return new Promise(function(_0x2253fd,_0x1e2411){return db['FaxMessage'][_0x72d1('0x1a')](_0x1865c1['body'],{'raw':_0x1865c1['options']?_0x1865c1['options']['raw']===undefined?!![]:![]:!![]})[_0x72d1('0xf')](function(_0x374602){logger['info'](_0x72d1('0x19'),_0x1865c1);logger[_0x72d1('0x13')](_0x72d1('0x19'),_0x1865c1,JSON[_0x72d1('0x14')](_0x374602));_0x2253fd(_0x374602);})[_0x72d1('0x1b')](function(_0x4e6acd){logger['error'](_0x72d1('0x19'),_0x4e6acd[_0x72d1('0x17')],_0x1865c1);_0x1e2411(_0x8d6890[_0x72d1('0x15')](0x1f4,_0x4e6acd[_0x72d1('0x17')]));});});};exports[_0x72d1('0x1c')]=function(_0x33d530){var _0x163bec=this;return new Promise(function(_0x589f7c,_0x57ec9e){return db[_0x72d1('0x1d')]['update'](_0x33d530[_0x72d1('0x1e')],{'raw':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d530[_0x72d1('0x1f')]?_0x33d530['options'][_0x72d1('0x20')]||null:null,'attributes':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')][_0x72d1('0x21')]||null:null,'limit':_0x33d530['options']?_0x33d530[_0x72d1('0x1f')]['limit']||null:null})[_0x72d1('0xf')](function(_0x32dc5e){logger['info'](_0x72d1('0x1c'),_0x33d530);logger[_0x72d1('0x13')](_0x72d1('0x1c'),_0x33d530,JSON[_0x72d1('0x14')](_0x32dc5e));_0x589f7c(_0x32dc5e);})[_0x72d1('0x1b')](function(_0x52511f){logger[_0x72d1('0x15')](_0x72d1('0x1c'),_0x52511f[_0x72d1('0x17')],_0x33d530);_0x57ec9e(_0x163bec['error'](0x1f4,_0x52511f[_0x72d1('0x17')]));});});}; \ No newline at end of file +var _0x4ea3=['message','result','catch','body','options','CreateFaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b54bf,_0xefb6c1){var _0x955030=function(_0x132ae9){while(--_0x132ae9){_0x4b54bf['push'](_0x4b54bf['shift']());}};_0x955030(++_0xefb6c1);}(_0x4ea3,0x70));var _0x34ea=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4ea3[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});config[_0x34ea('0xa')]=_[_0x34ea('0xb')](config[_0x34ea('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x34ea('0xc'))(new Redis(config[_0x34ea('0xa')]));require(_0x34ea('0xd'))['register'](socket);function respondWithRpcPromise(_0x301b98,_0xea1be2,_0x5126de){return new BPromise(function(_0x4a76b1,_0x5bd8b6){return client[_0x34ea('0xe')](_0x301b98,_0x5126de)[_0x34ea('0xf')](function(_0x58bb0d){logger[_0x34ea('0x10')](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));logger[_0x34ea('0x13')](_0x34ea('0x14'),_0xea1be2,_0x34ea('0x12'),JSON[_0x34ea('0x15')](_0x58bb0d));if(_0x58bb0d[_0x34ea('0x16')]){if(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x17')]===0x1f4){logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x5bd8b6(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x4a76b1(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}else{logger['info'](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));_0x4a76b1(_0x58bb0d[_0x34ea('0x19')]['message']);}})[_0x34ea('0x1a')](function(_0x1353de){logger[_0x34ea('0x16')](_0x34ea('0x11'),_0xea1be2,_0x1353de);_0x5bd8b6(_0x1353de);});});}exports['CreateFaxMessage']=function(_0x2eea57){var _0x35328c=this;return new Promise(function(_0x287aaa,_0x247ee7){return db['FaxMessage']['create'](_0x2eea57[_0x34ea('0x1b')],{'raw':_0x2eea57[_0x34ea('0x1c')]?_0x2eea57[_0x34ea('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2eafc6){logger[_0x34ea('0x10')](_0x34ea('0x1d'),_0x2eea57);logger[_0x34ea('0x13')](_0x34ea('0x1d'),_0x2eea57,JSON[_0x34ea('0x15')](_0x2eafc6));_0x287aaa(_0x2eafc6);})['catch'](function(_0xf24962){logger[_0x34ea('0x16')](_0x34ea('0x1d'),_0xf24962[_0x34ea('0x18')],_0x2eea57);_0x247ee7(_0x35328c['error'](0x1f4,_0xf24962['message']));});});};exports['UpdateFaxMessage']=function(_0x142709){var _0x187306=this;return new Promise(function(_0x37c214,_0x4204d7){return db['FaxMessage'][_0x34ea('0x1e')](_0x142709[_0x34ea('0x1b')],{'raw':_0x142709[_0x34ea('0x1c')]?_0x142709['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x142709['options']?_0x142709['options'][_0x34ea('0x1f')]||null:null,'attributes':_0x142709[_0x34ea('0x1c')]?_0x142709[_0x34ea('0x1c')][_0x34ea('0x20')]||null:null,'limit':_0x142709['options']?_0x142709[_0x34ea('0x1c')]['limit']||null:null})[_0x34ea('0xf')](function(_0x4f2b77){logger[_0x34ea('0x10')](_0x34ea('0x21'),_0x142709);logger[_0x34ea('0x13')]('UpdateFaxMessage',_0x142709,JSON[_0x34ea('0x15')](_0x4f2b77));_0x37c214(_0x4f2b77);})[_0x34ea('0x1a')](function(_0x55c8ba){logger[_0x34ea('0x16')]('UpdateFaxMessage',_0x55c8ba[_0x34ea('0x18')],_0x142709);_0x4204d7(_0x187306[_0x34ea('0x16')](0x1f4,_0x55c8ba[_0x34ea('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5b05a06..2c000ee 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 _0x38f5=['length','./faxMessage.events','remove','emit','register'];(function(_0x3c19ee,_0x18472e){var _0x5daa83=function(_0x138404){while(--_0x138404){_0x3c19ee['push'](_0x3c19ee['shift']());}};_0x5daa83(++_0x18472e);}(_0x38f5,0x1b4));var _0x538f=function(_0x1f327e,_0x3f458b){_0x1f327e=_0x1f327e-0x0;var _0x124b2d=_0x38f5[_0x1f327e];return _0x124b2d;};'use strict';var FaxMessageEvents=require(_0x538f('0x0'));var events=['save',_0x538f('0x1'),'update'];function createListener(_0x3e4823,_0xf03ca5){return function(_0x2bda5a){_0xf03ca5[_0x538f('0x2')](_0x3e4823,_0x2bda5a);};}function removeListener(_0x52e5f8,_0x53d0c8){return function(){FaxMessageEvents['removeListener'](_0x52e5f8,_0x53d0c8);};}exports[_0x538f('0x3')]=function(_0x1688a6){for(var _0x2bfdf2=0x0,_0x2a224e=events[_0x538f('0x4')];_0x2bfdf2<_0x2a224e;_0x2bfdf2++){var _0x4b6b5d=events[_0x2bfdf2];var _0x3bc068=createListener('faxMessage:'+_0x4b6b5d,_0x1688a6);FaxMessageEvents['on'](_0x4b6b5d,_0x3bc068);}}; \ No newline at end of file +var _0x4603=['save','remove','update','emit','removeListener','register','length','./faxMessage.events'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x4603,0x19f));var _0x3460=function(_0x40178f,_0x396ac7){_0x40178f=_0x40178f-0x0;var _0x5066bf=_0x4603[_0x40178f];return _0x5066bf;};'use strict';var FaxMessageEvents=require(_0x3460('0x0'));var events=[_0x3460('0x1'),_0x3460('0x2'),_0x3460('0x3')];function createListener(_0x5bffcb,_0x3b9edb){return function(_0x2d963b){_0x3b9edb[_0x3460('0x4')](_0x5bffcb,_0x2d963b);};}function removeListener(_0xdd4d23,_0x1f905d){return function(){FaxMessageEvents[_0x3460('0x5')](_0xdd4d23,_0x1f905d);};}exports[_0x3460('0x6')]=function(_0x48cc69){for(var _0x1f13aa=0x0,_0x3935d0=events[_0x3460('0x7')];_0x1f13aa<_0x3935d0;_0x1f13aa++){var _0x12fa81=events[_0x1f13aa];var _0x1d041a=createListener('faxMessage:'+_0x12fa81,_0x48cc69);FaxMessageEvents['on'](_0x12fa81,_0x1d041a);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 2ae067a..769493c 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 _0xe205=['../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','tracked','fax','faxmessage:create','create','put','update','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x913b85,_0x213182){var _0x1ce434=function(_0x4c9c8b){while(--_0x4c9c8b){_0x913b85['push'](_0x913b85['shift']());}};_0x1ce434(++_0x213182);}(_0xe205,0xa7));var _0x5e20=function(_0x46ca33,_0x1074ec){_0x46ca33=_0x46ca33-0x0;var _0x524108=_0xe205[_0x46ca33];return _0x524108;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/describe',auth[_0x5e20('0xb')](),controller['describe']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['show']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),interaction[_0x5e20('0x10')](_0x5e20('0x11'),_0x5e20('0x12')),controller[_0x5e20('0x13')]);router[_0x5e20('0x14')]('/:id',auth[_0x5e20('0xb')](),controller[_0x5e20('0x15')]);router[_0x5e20('0x14')]('/:id/accept',auth[_0x5e20('0xb')](),controller['accept']);router[_0x5e20('0x14')]('/:id/reject',auth[_0x5e20('0xb')](),controller[_0x5e20('0x16')]);router[_0x5e20('0x17')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['destroy']);module[_0x5e20('0x18')]=router; \ No newline at end of file +var _0x7af2=['/:id/reject','reject','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','show','faxmessage:create','put','update','/:id/accept','accept'];(function(_0x272c31,_0x175190){var _0xbe4b6a=function(_0x46c96a){while(--_0x46c96a){_0x272c31['push'](_0x272c31['shift']());}};_0xbe4b6a(++_0x175190);}(_0x7af2,0x119));var _0x27af=function(_0x5bc040,_0x1654cc){_0x5bc040=_0x5bc040-0x0;var _0xb2205=_0x7af2[_0x5bc040];return _0xb2205;};'use strict';var multer=require('multer');var util=require(_0x27af('0x0'));var path=require(_0x27af('0x1'));var timeout=require(_0x27af('0x2'));var express=require(_0x27af('0x3'));var router=express['Router']();var fs_extra=require(_0x27af('0x4'));var auth=require(_0x27af('0x5'));var interaction=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var controller=require(_0x27af('0x8'));router[_0x27af('0x9')]('/',auth[_0x27af('0xa')](),controller[_0x27af('0xb')]);router[_0x27af('0x9')]('/describe',auth[_0x27af('0xa')](),controller[_0x27af('0xc')]);router[_0x27af('0x9')]('/:id',auth[_0x27af('0xa')](),controller[_0x27af('0xd')]);router[_0x27af('0x9')]('/:id/download',auth[_0x27af('0xa')](),controller['download']);router['post']('/',auth[_0x27af('0xa')](),interaction['tracked']('fax',_0x27af('0xe')),controller['create']);router[_0x27af('0xf')]('/:id',auth[_0x27af('0xa')](),controller[_0x27af('0x10')]);router[_0x27af('0xf')](_0x27af('0x11'),auth[_0x27af('0xa')](),controller[_0x27af('0x12')]);router[_0x27af('0xf')](_0x27af('0x13'),auth[_0x27af('0xa')](),controller[_0x27af('0x14')]);router[_0x27af('0x15')](_0x27af('0x16'),auth[_0x27af('0xa')](),controller[_0x27af('0x17')]);module[_0x27af('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b07b0b1..7464593 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 _0xbff5=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x246573,_0x856eb9){var _0x441c04=function(_0x2a28bb){while(--_0x2a28bb){_0x246573['push'](_0x246573['shift']());}};_0x441c04(++_0x856eb9);}(_0xbff5,0x180));var _0x5bff=function(_0x1ffd9a,_0x1ecad0){_0x1ffd9a=_0x1ffd9a-0x0;var _0x53d2db=_0xbff5[_0x1ffd9a];return _0x53d2db;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5bff('0x0')],'unique':_0x5bff('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5bff('0x0')]},'timeout':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x4'),'beepall',_0x5bff('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaaee=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2680c6,_0x1de557){var _0x4b53d1=function(_0x5e370c){while(--_0x5e370c){_0x2680c6['push'](_0x2680c6['shift']());}};_0x4b53d1(++_0x1de557);}(_0xaaee,0xa9));var _0xeaae=function(_0x34e59d,_0x3a4802){_0x34e59d=_0x34e59d-0x0;var _0x589558=_0xaaee[_0x34e59d];return _0x589558;};'use strict';var Sequelize=require(_0xeaae('0x0'));module['exports']={'name':{'type':Sequelize[_0xeaae('0x1')],'unique':_0xeaae('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xeaae('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeaae('0x4')](_0xeaae('0x5'),_0xeaae('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xeaae('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 a2c6f21..f1ec7cd 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 _0xbff5=['catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','FaxQueueId','filter','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','options','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeAgents','userFaxQueue:remove','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','update','destroy','UserProfileResource','then','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','where','include','query','findAll','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge'];(function(_0x7cfeb4,_0x468021){var _0x604ada=function(_0x79afa4){while(--_0x79afa4){_0x7cfeb4['push'](_0x7cfeb4['shift']());}};_0x604ada(++_0x468021);}(_0xbff5,0x1bc));var _0x5bff=function(_0x28ca90,_0x25b97e){_0x28ca90=_0x28ca90-0x0;var _0x594278=_0xbff5[_0x28ca90];return _0x594278;};'use strict';var BPromise=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var _=require(_0x5bff('0x2'));var squel=require(_0x5bff('0x3'));var Redis=require(_0x5bff('0x4'));var qs=require(_0x5bff('0x5'));var logger=require(_0x5bff('0x6'))('api');var config=require(_0x5bff('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5bff('0x8')](config[_0x5bff('0x9')],{'host':_0x5bff('0xa'),'port':0x18eb});var socket=require(_0x5bff('0xb'))(new Redis(config[_0x5bff('0x9')]));require(_0x5bff('0xc'))[_0x5bff('0xd')](socket);function respondWithStatusCode(_0x139c99,_0x3eb6f9){_0x3eb6f9=_0x3eb6f9||0xcc;return function(_0x4a1be2){if(_0x4a1be2){return _0x139c99[_0x5bff('0xe')](_0x3eb6f9);}return _0x139c99['status'](_0x3eb6f9)[_0x5bff('0xf')]();};}function respondWithResult(_0x40b806,_0x4fc146){_0x4fc146=_0x4fc146||0xc8;return function(_0x3e72e9){if(_0x3e72e9){return _0x40b806['status'](_0x4fc146)[_0x5bff('0x10')](_0x3e72e9);}};}function respondWithFilteredResult(_0x4ff164,_0x207835){return function(_0x135003){if(_0x135003){var _0x4a6903=typeof _0x207835[_0x5bff('0x11')]==='undefined'&&typeof _0x207835[_0x5bff('0x12')]===_0x5bff('0x13');var _0x548128=_0x135003[_0x5bff('0x14')];var _0xa16a3f=_0x4a6903?0x0:_0x207835['offset'];var _0x5f2a55=_0x4a6903?_0x135003[_0x5bff('0x14')]:_0x207835[_0x5bff('0x11')]+_0x207835[_0x5bff('0x12')];var _0x4d883e;if(_0x5f2a55>=_0x548128){_0x5f2a55=_0x548128;_0x4d883e=0xc8;}else{_0x4d883e=0xce;}_0x4ff164[_0x5bff('0x15')](_0x4d883e);return _0x4ff164[_0x5bff('0x16')](_0x5bff('0x17'),_0xa16a3f+'-'+_0x5f2a55+'/'+_0x548128)['json'](_0x135003);}return null;};}function saveUpdates(_0x3ffbbc){return function(_0x40c7f6){if(_0x40c7f6){return _0x40c7f6[_0x5bff('0x18')](_0x3ffbbc)['then'](function(_0xc9fbc3){return _0xc9fbc3;});}return null;};}function removeEntity(_0x279c22){return function(_0x36653b){if(_0x36653b){return _0x36653b[_0x5bff('0x19')]()['then'](function(){var _0x3065c1=_0x36653b['get']({'plain':!![]});var _0x878040='FaxQueues';return db[_0x5bff('0x1a')][_0x5bff('0x19')]({'where':{'type':_0x878040,'resourceId':_0x3065c1['id']}})[_0x5bff('0x1b')](function(){return _0x36653b;});})[_0x5bff('0x1b')](function(){_0x279c22[_0x5bff('0x15')](0xcc)[_0x5bff('0xf')]();});}};}function handleEntityNotFound(_0x3d72ee){return function(_0x13ee8f){if(!_0x13ee8f){_0x3d72ee[_0x5bff('0xe')](0x194);}return _0x13ee8f;};}function handleError(_0x490bc1,_0x5f2593){_0x5f2593=_0x5f2593||0x1f4;return function(_0x263cf5){logger[_0x5bff('0x1c')](_0x263cf5[_0x5bff('0x1d')]);if(_0x263cf5[_0x5bff('0x1e')]){delete _0x263cf5[_0x5bff('0x1e')];}_0x490bc1[_0x5bff('0x15')](_0x5f2593)[_0x5bff('0x1f')](_0x263cf5);};}exports['index']=function(_0x5741d9,_0x9a69de){var _0x53bd97={};var _0x220c8f={'count':0x0,'rows':[]};var _0xcc091d=_[_0x5bff('0x20')](db[_0x5bff('0x21')][_0x5bff('0x22')],function(_0x1140eb){return{'name':_0x1140eb[_0x5bff('0x23')],'type':_0x1140eb[_0x5bff('0x24')]['key']};});_0x53bd97=qs['getOptions'](_0xcc091d,_0x5741d9);var _0x20d750={'where':_0x53bd97[_0x5bff('0x25')]};return db['FaxQueue'][_0x5bff('0x14')](_0x20d750)['then'](function(_0x5470cb){_0x220c8f[_0x5bff('0x14')]=_0x5470cb;_0x53bd97['include']=qs[_0x5bff('0x26')](_0x5741d9[_0x5bff('0x27')]);return db[_0x5bff('0x21')][_0x5bff('0x28')](_0x53bd97);})['then'](function(_0x71783){_0x220c8f['rows']=_0x71783;return _0x220c8f;})[_0x5bff('0x1b')](respondWithFilteredResult(_0x9a69de,_0x53bd97))['catch'](handleError(_0x9a69de,null));};exports[_0x5bff('0x29')]=function(_0x100d0c,_0x293513){var _0x3491e0={'raw':!![],'where':{'id':_0x100d0c[_0x5bff('0x2a')]['id']}},_0x44a970={};_0x44a970['model']=_[_0x5bff('0x2b')](db[_0x5bff('0x21')][_0x5bff('0x22')]);_0x44a970[_0x5bff('0x27')]=_[_0x5bff('0x2b')](_0x100d0c[_0x5bff('0x27')]);_0x44a970[_0x5bff('0x2c')]=_[_0x5bff('0x2d')](_0x44a970['model'],_0x44a970[_0x5bff('0x27')]);_0x3491e0[_0x5bff('0x2e')]=_[_0x5bff('0x2d')](_0x44a970[_0x5bff('0x2f')],qs['fields'](_0x100d0c[_0x5bff('0x27')][_0x5bff('0x30')]));_0x3491e0['attributes']=_0x3491e0[_0x5bff('0x2e')][_0x5bff('0x31')]?_0x3491e0[_0x5bff('0x2e')]:_0x44a970[_0x5bff('0x2f')];if(_0x100d0c['query'][_0x5bff('0x32')]){_0x3491e0[_0x5bff('0x26')]=[{'all':!![]}];}_0x3491e0=_[_0x5bff('0x33')]({},_0x3491e0,_0x100d0c['options']);return db[_0x5bff('0x21')]['find'](_0x3491e0)[_0x5bff('0x1b')](handleEntityNotFound(_0x293513,null))[_0x5bff('0x1b')](respondWithResult(_0x293513,null))[_0x5bff('0x34')](handleError(_0x293513,null));};exports['create']=function(_0x368110,_0x1ec079){return db[_0x5bff('0x21')]['create'](_0x368110[_0x5bff('0x35')],{})[_0x5bff('0x1b')](function(_0x569503){var _0x265cdb=_0x368110[_0x5bff('0x36')][_0x5bff('0x37')]({'plain':!![]});if(!_0x265cdb)throw new Error(_0x5bff('0x38'));if(_0x265cdb[_0x5bff('0x39')]==='user'){var _0x35796f=_0x569503['get']({'plain':!![]});var _0x449c6a=_0x5bff('0x3a');return db[_0x5bff('0x3b')][_0x5bff('0x3c')]({'where':{'name':_0x449c6a,'userProfileId':_0x265cdb[_0x5bff('0x3d')]},'raw':!![]})[_0x5bff('0x1b')](function(_0x1d0346){if(_0x1d0346&&_0x1d0346['autoAssociation']===0x0){return db['UserProfileResource'][_0x5bff('0x3e')]({'name':_0x35796f[_0x5bff('0x1e')],'resourceId':_0x35796f['id'],'type':_0x1d0346[_0x5bff('0x1e')],'sectionId':_0x1d0346['id']},{})[_0x5bff('0x1b')](function(){return _0x569503;});}else{return _0x569503;}})[_0x5bff('0x34')](function(_0xb7b82a){logger[_0x5bff('0x1c')](_0x5bff('0x3f'),_0xb7b82a);throw _0xb7b82a;});}return _0x569503;})['then'](respondWithResult(_0x1ec079,0xc9))[_0x5bff('0x34')](handleError(_0x1ec079,null));};exports['update']=function(_0x3dc13f,_0x1b8c7f){if(_0x3dc13f['body']['id']){delete _0x3dc13f[_0x5bff('0x35')]['id'];}return db[_0x5bff('0x21')]['find']({'where':{'id':_0x3dc13f[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](handleEntityNotFound(_0x1b8c7f,null))[_0x5bff('0x1b')](saveUpdates(_0x3dc13f['body'],null))[_0x5bff('0x1b')](respondWithResult(_0x1b8c7f,null))[_0x5bff('0x34')](handleError(_0x1b8c7f,null));};exports[_0x5bff('0x19')]=function(_0x5c0451,_0x24c92e){return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x5c0451[_0x5bff('0x2a')]['id']}})['then'](handleEntityNotFound(_0x24c92e,null))[_0x5bff('0x1b')](removeEntity(_0x24c92e,null))['catch'](handleError(_0x24c92e,null));};exports['describe']=function(_0x40abd9,_0x95cf00){return db['FaxQueue'][_0x5bff('0x40')]()[_0x5bff('0x1b')](respondWithResult(_0x95cf00,null))['catch'](handleError(_0x95cf00,null));};exports[_0x5bff('0x41')]=function(_0x3e56c3,_0x18f8a5){var _0x39c90f={'raw':!![],'where':{}},_0x4ccf4d={},_0x579a8d;return db[_0x5bff('0x21')][_0x5bff('0x42')]({'where':{'id':_0x3e56c3[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](handleEntityNotFound(_0x18f8a5,null))[_0x5bff('0x1b')](function(_0x599163){if(_0x599163){_0x579a8d=_0x599163[_0x5bff('0x37')]({'plain':!![]});_0x4ccf4d[_0x5bff('0x2f')]=_['keys'](db[_0x5bff('0x43')]['rawAttributes']);_0x4ccf4d['query']=_['keys'](_0x3e56c3[_0x5bff('0x27')]);_0x4ccf4d[_0x5bff('0x2c')]=_['intersection'](_0x4ccf4d[_0x5bff('0x2f')],_0x4ccf4d[_0x5bff('0x27')]);_0x39c90f[_0x5bff('0x2e')]=_[_0x5bff('0x2d')](_0x4ccf4d[_0x5bff('0x2f')],qs['fields'](_0x3e56c3[_0x5bff('0x27')][_0x5bff('0x30')]));_0x39c90f['attributes']=_0x39c90f[_0x5bff('0x2e')]['length']?_0x39c90f[_0x5bff('0x2e')]:_0x4ccf4d[_0x5bff('0x2f')];if(!_0x3e56c3[_0x5bff('0x27')][_0x5bff('0x44')](_0x5bff('0x45'))){_0x39c90f['limit']=qs[_0x5bff('0x12')](_0x3e56c3[_0x5bff('0x27')]['limit']);_0x39c90f[_0x5bff('0x11')]=qs[_0x5bff('0x11')](_0x3e56c3['query'][_0x5bff('0x11')]);}_0x39c90f[_0x5bff('0x46')]=qs[_0x5bff('0x47')](_0x3e56c3[_0x5bff('0x27')][_0x5bff('0x47')]);_0x39c90f[_0x5bff('0x25')]=qs['filters'](_['pick'](_0x3e56c3[_0x5bff('0x27')],_0x4ccf4d['filters']));_0x39c90f[_0x5bff('0x25')][_0x5bff('0x48')]=_0x599163['id'];if(_0x3e56c3[_0x5bff('0x27')][_0x5bff('0x49')]){_0x39c90f[_0x5bff('0x25')]=_[_0x5bff('0x33')](_0x39c90f[_0x5bff('0x25')],{'$or':_[_0x5bff('0x20')](_0x39c90f[_0x5bff('0x2e')],function(_0x7cc921){var _0x4364c7={};_0x4364c7[_0x7cc921]={'$like':'%'+_0x3e56c3['query']['filter']+'%'};return _0x4364c7;})});}_0x39c90f=_[_0x5bff('0x33')]({},_0x39c90f,_0x3e56c3['options']);return db[_0x5bff('0x43')]['findAll'](_0x39c90f);}})[_0x5bff('0x1b')](function(_0xbb7de2){if(_0xbb7de2){return db[_0x5bff('0x4a')][_0x5bff('0x4b')]({'where':{'id':_[_0x5bff('0x20')](_0xbb7de2,_0x5bff('0x4c')),'role':_0x5bff('0x4d')},'attributes':['id',_0x5bff('0x1e'),_0x5bff('0x4e'),_0x5bff('0x4f'),_0x5bff('0x50')]});}})['then'](function(_0x142854){if(_0x142854){return{'count':_0x142854['count'],'rows':_['map'](_0x142854['rows'],function(_0x1720ac){return{'membername':_0x1720ac['name'],'UserId':_0x1720ac['id'],'queue_name':_0x579a8d[_0x5bff('0x1e')],'FaxQueueId':_0x579a8d['id'],'interface':util[_0x5bff('0x51')](_0x5bff('0x52'),_0x5bff('0x53'),_0x1720ac['name']),'penalty':0x0,'paused':_0x1720ac['faxPause'],'createdAt':_0x1720ac['createdAt'],'updatedAt':_0x1720ac[_0x5bff('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5bff('0x1b')](respondWithFilteredResult(_0x18f8a5,_0x39c90f))['catch'](handleError(_0x18f8a5,null));};exports[_0x5bff('0x54')]=function(_0x3bb787,_0x460272){var _0x168935={};var _0x1fec98={};var _0x20ff8a;var _0x134268;return db[_0x5bff('0x21')][_0x5bff('0x42')]({'where':{'id':_0x3bb787[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](handleEntityNotFound(_0x460272,null))[_0x5bff('0x1b')](function(_0x3bbbe1){if(_0x3bbbe1){_0x20ff8a=_0x3bbbe1;_0x1fec98[_0x5bff('0x2f')]=_['keys'](db[_0x5bff('0x55')][_0x5bff('0x22')]);_0x1fec98[_0x5bff('0x27')]=_[_0x5bff('0x2b')](_0x3bb787[_0x5bff('0x27')]);_0x1fec98[_0x5bff('0x2c')]=_[_0x5bff('0x2d')](_0x1fec98[_0x5bff('0x2f')],_0x1fec98[_0x5bff('0x27')]);_0x168935[_0x5bff('0x2e')]=_[_0x5bff('0x2d')](_0x1fec98[_0x5bff('0x2f')],qs[_0x5bff('0x30')](_0x3bb787['query'][_0x5bff('0x30')]));_0x168935[_0x5bff('0x2e')]=_0x168935[_0x5bff('0x2e')][_0x5bff('0x31')]?_0x168935[_0x5bff('0x2e')]:_0x1fec98['model'];_0x168935[_0x5bff('0x46')]=qs[_0x5bff('0x47')](_0x3bb787['query'][_0x5bff('0x47')]);_0x168935[_0x5bff('0x25')]=qs[_0x5bff('0x2c')](_['pick'](_0x3bb787[_0x5bff('0x27')],_0x1fec98[_0x5bff('0x2c')]));if(_0x3bb787[_0x5bff('0x27')][_0x5bff('0x49')]){_0x168935[_0x5bff('0x25')]=_[_0x5bff('0x33')](_0x168935[_0x5bff('0x25')],{'$or':_[_0x5bff('0x20')](_0x168935[_0x5bff('0x2e')],function(_0x834ccd){var _0x10d6a2={};_0x10d6a2[_0x834ccd]={'$like':'%'+_0x3bb787[_0x5bff('0x27')]['filter']+'%'};return _0x10d6a2;})});}_0x168935=_['merge']({},_0x168935,_0x3bb787[_0x5bff('0x56')]);return _0x20ff8a[_0x5bff('0x54')](_0x168935);}})[_0x5bff('0x1b')](function(_0x597eea){if(_0x597eea){_0x134268=_0x597eea[_0x5bff('0x31')];if(!_0x3bb787['query']['hasOwnProperty'](_0x5bff('0x45'))){_0x168935['limit']=qs['limit'](_0x3bb787[_0x5bff('0x27')][_0x5bff('0x12')]);_0x168935['offset']=qs[_0x5bff('0x11')](_0x3bb787[_0x5bff('0x27')][_0x5bff('0x11')]);}return _0x20ff8a[_0x5bff('0x54')](_0x168935);}})[_0x5bff('0x1b')](function(_0x3dcc24){if(_0x3dcc24){return _0x3dcc24?{'count':_0x134268,'rows':_0x3dcc24}:null;}})[_0x5bff('0x1b')](respondWithResult(_0x460272,null))[_0x5bff('0x34')](handleError(_0x460272,null));};exports[_0x5bff('0x57')]=function(_0x29bea4,_0x3d5ef9){var _0x376207=_0x29bea4[_0x5bff('0x35')][_0x5bff('0x58')];return db[_0x5bff('0x55')][_0x5bff('0x28')]({'where':{'id':_0x376207},'attributes':['id'],'include':[{'model':db[_0x5bff('0x4a')],'as':_0x5bff('0x59'),'attributes':['id',_0x5bff('0x1e'),_0x5bff('0x5a'),_0x5bff('0x5b'),'interface'],'raw':!![]}]})[_0x5bff('0x1b')](function(_0x36c26c){if(_0x36c26c){var _0x5c673e=_[_0x5bff('0x5c')](_0x36c26c,function(_0x5143cf){var _0x25b2bc=_0x5143cf[_0x5bff('0x37')]({'plain':!![]});return _0x25b2bc['Agents'];});return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x29bea4[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](function(_0x726832){return db[_0x5bff('0x5d')][_0x5bff('0x5e')](function(_0xc17adc){return _0x726832[_0x5bff('0x57')](_0x376207,{'transaction':_0xc17adc})[_0x5bff('0x1b')](function(){return BPromise[_0x5bff('0x5f')](_0x5c673e,function(_0x498849){return db[_0x5bff('0x43')][_0x5bff('0x60')]({'where':{'UserId':_0x498849['id'],'FaxQueueId':_0x29bea4['params']['id']},'transaction':_0xc17adc});});})[_0x5bff('0x1b')](function(){_0x5c673e[_0x5bff('0x61')](function(_0x3f84e2){socket[_0x5bff('0x62')](_0x5bff('0x63'),{'UserId':_0x3f84e2['id'],'FaxQueueId':_0x726832['id']});});});});});}})[_0x5bff('0x1b')](respondWithStatusCode(_0x3d5ef9,null))[_0x5bff('0x34')](handleError(_0x3d5ef9,null));};exports[_0x5bff('0x64')]=function(_0x57ae4d,_0x4d42bc){return db[_0x5bff('0x55')]['findAll']({'where':{'id':_0x57ae4d[_0x5bff('0x27')][_0x5bff('0x58')]},'attributes':['id'],'include':[{'model':db[_0x5bff('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5bff('0x1b')](handleEntityNotFound(_0x4d42bc,null))[_0x5bff('0x1b')](function(_0x434837){var _0x44456c=_[_0x5bff('0x20')](_0x434837,'id');var _0x4774c2=[];var _0x4b40c5=[];var _0x341e79=squel[_0x5bff('0x65')]();_0x341e79[_0x5bff('0x66')](_0x5bff('0x67'))['from'](_0x5bff('0x68'),'tq')['join'](_0x5bff('0x69'),'ut',_0x5bff('0x6a'))[_0x5bff('0x25')](_0x5bff('0x6b'),_0x57ae4d[_0x5bff('0x2a')]['id']);for(var _0x135200=0x0;_0x135200<_0x434837[_0x5bff('0x31')];_0x135200+=0x1){let _0x52623e=_0x434837[_0x135200];for(var _0x286c4a=0x0;_0x286c4a<_0x52623e['Agents']['length'];_0x286c4a+=0x1){let _0x26290a=_0x52623e[_0x5bff('0x59')][_0x286c4a];var _0x527a96=_0x341e79['clone']();_0x527a96[_0x5bff('0x25')](_0x5bff('0x6c'),_0x26290a['id']);_0x4b40c5[_0x5bff('0x6d')](db[_0x5bff('0x5d')]['query'](_0x527a96[_0x5bff('0x6e')](),{'type':db['sequelize'][_0x5bff('0x6f')][_0x5bff('0x70')]})[_0x5bff('0x1b')](function(_0x4b8771){if(_0x4b8771[_0x5bff('0x31')]===0x1){return _0x26290a['id'];}else{var _0x5a5e97=_[_0x5bff('0x71')](_[_0x5bff('0x20')](_0x4b8771,_0x5bff('0x72')),function(_0x5b2058){return _['includes'](_0x44456c,_0x5b2058);});if(_0x5a5e97){return _0x26290a['id'];}}}));}}return BPromise[_0x5bff('0x73')](_0x4b40c5)[_0x5bff('0x1b')](function(_0x2b8ec5){_0x4774c2=_(_0x4774c2)[_0x5bff('0x74')](_0x2b8ec5)[_0x5bff('0x75')]()[_0x5bff('0x76')]();return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x57ae4d[_0x5bff('0x2a')]['id']}})['then'](function(_0x435076){return db[_0x5bff('0x5d')][_0x5bff('0x5e')](function(_0x4cb550){return _0x435076['removeTeams'](_0x57ae4d[_0x5bff('0x27')][_0x5bff('0x58')],{'transaction':_0x4cb550})['then'](function(){if(!_['isEmpty'](_0x4774c2)){return _0x435076[_0x5bff('0x77')](_0x4774c2,{'transaction':_0x4cb550});}})['then'](function(){_0x4774c2[_0x5bff('0x61')](function(_0xc0fcc2){socket[_0x5bff('0x62')](_0x5bff('0x78'),{'UserId':_0xc0fcc2,'FaxQueueId':_0x435076['id']});});});});});});})['then'](respondWithStatusCode(_0x4d42bc,null))[_0x5bff('0x34')](handleError(_0x4d42bc,null));};exports['addAgents']=function(_0x155bf3,_0x20a5af){return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x155bf3[_0x5bff('0x2a')]['id']}})['then'](handleEntityNotFound(_0x20a5af,null))[_0x5bff('0x1b')](function(_0x320109){if(_0x320109){return _0x320109['addAgents'](_0x155bf3[_0x5bff('0x35')][_0x5bff('0x58')],_[_0x5bff('0x79')](_0x155bf3[_0x5bff('0x35')],[_0x5bff('0x58'),'id'])||{})['spread'](function(_0xe8a343){for(var _0x3033de=0x0;_0x3033de<_0x155bf3[_0x5bff('0x35')][_0x5bff('0x58')][_0x5bff('0x31')];_0x3033de+=0x1){socket[_0x5bff('0x62')]('userFaxQueue:save',{'UserId':Number(_0x155bf3[_0x5bff('0x35')]['ids'][_0x3033de]),'FaxQueueId':Number(_0x155bf3[_0x5bff('0x2a')]['id'])});}return _0xe8a343;});}})[_0x5bff('0x1b')](respondWithResult(_0x20a5af,null))[_0x5bff('0x34')](handleError(_0x20a5af,null));};exports[_0x5bff('0x77')]=function(_0x2efeb0,_0x70fdf2){return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x2efeb0[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](handleEntityNotFound(_0x70fdf2,null))[_0x5bff('0x1b')](function(_0x995f09){if(_0x995f09){return _0x995f09[_0x5bff('0x77')](_0x2efeb0['query']['ids'])[_0x5bff('0x1b')](function(){if(_[_0x5bff('0x7a')](_0x2efeb0[_0x5bff('0x27')][_0x5bff('0x58')])){for(var _0x406b88=0x0;_0x406b88<_0x2efeb0['query'][_0x5bff('0x58')][_0x5bff('0x31')];_0x406b88+=0x1){socket[_0x5bff('0x62')]('userFaxQueue:remove',{'UserId':Number(_0x2efeb0[_0x5bff('0x27')]['ids'][_0x406b88]),'FaxQueueId':Number(_0x2efeb0[_0x5bff('0x2a')]['id'])});}}else{socket['emit'](_0x5bff('0x78'),{'UserId':Number(_0x2efeb0['query'][_0x5bff('0x58')]),'FaxQueueId':Number(_0x2efeb0[_0x5bff('0x2a')]['id'])});}});}})[_0x5bff('0x1b')](respondWithStatusCode(_0x70fdf2,null))['catch'](handleError(_0x70fdf2,null));};exports[_0x5bff('0x7b')]=function(_0x2e5ac0,_0x1b895d){var _0x3dbb53={};var _0x1db44c={};var _0x1bd28a;var _0x2ca82e;return db[_0x5bff('0x21')][_0x5bff('0x42')]({'where':{'id':_0x2e5ac0[_0x5bff('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1b895d,null))[_0x5bff('0x1b')](function(_0xddc173){if(_0xddc173){_0x1bd28a=_0xddc173;_0x1db44c['model']=_[_0x5bff('0x2b')](db['User']['rawAttributes']);_0x1db44c[_0x5bff('0x27')]=_[_0x5bff('0x2b')](_0x2e5ac0[_0x5bff('0x27')]);_0x1db44c[_0x5bff('0x2c')]=_['intersection'](_0x1db44c['model'],_0x1db44c[_0x5bff('0x27')]);_0x3dbb53[_0x5bff('0x2e')]=_[_0x5bff('0x2d')](_0x1db44c['model'],qs[_0x5bff('0x30')](_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x30')]));_0x3dbb53[_0x5bff('0x2e')]=_0x3dbb53[_0x5bff('0x2e')]['length']?_0x3dbb53[_0x5bff('0x2e')]:_0x1db44c[_0x5bff('0x2f')];_0x3dbb53['order']=qs[_0x5bff('0x47')](_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x47')]);_0x3dbb53[_0x5bff('0x25')]=qs['filters'](_['pick'](_0x2e5ac0[_0x5bff('0x27')],_0x1db44c[_0x5bff('0x2c')]));if(_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x49')]){_0x3dbb53[_0x5bff('0x25')]=_[_0x5bff('0x33')](_0x3dbb53[_0x5bff('0x25')],{'$or':_[_0x5bff('0x20')](_0x3dbb53[_0x5bff('0x2e')],function(_0x3b07c6){var _0x4c6a55={};_0x4c6a55[_0x3b07c6]={'$like':'%'+_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x49')]+'%'};return _0x4c6a55;})});}_0x3dbb53=_[_0x5bff('0x33')]({},_0x3dbb53,_0x2e5ac0[_0x5bff('0x56')]);return _0x1bd28a['getAgents'](_0x3dbb53);}})['then'](function(_0x96bbeb){if(_0x96bbeb){_0x2ca82e=_0x96bbeb[_0x5bff('0x31')];if(!_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x44')](_0x5bff('0x45'))){_0x3dbb53[_0x5bff('0x12')]=qs[_0x5bff('0x12')](_0x2e5ac0['query']['limit']);_0x3dbb53['offset']=qs['offset'](_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x11')]);}return _0x1bd28a[_0x5bff('0x7b')](_0x3dbb53);}})[_0x5bff('0x1b')](function(_0x5e9119){if(_0x5e9119){return _0x5e9119?{'count':_0x2ca82e,'rows':_0x5e9119}:null;}})['then'](respondWithResult(_0x1b895d,null))[_0x5bff('0x34')](handleError(_0x1b895d,null));}; \ No newline at end of file +var _0x4489=['socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','FaxQueues','sendStatus','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','getOptions','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserFaxQueue','hasOwnProperty','order','sort','where','pick','filter','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','transaction','findOrCreate','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','sequelize','SELECT','every','includes','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','redis'];(function(_0x4221b2,_0x4db816){var _0x359351=function(_0x2d9e69){while(--_0x2d9e69){_0x4221b2['push'](_0x4221b2['shift']());}};_0x359351(++_0x4db816);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x9448('0x0'));var util=require(_0x9448('0x1'));var _=require('lodash');var squel=require(_0x9448('0x2'));var Redis=require(_0x9448('0x3'));var qs=require(_0x9448('0x4'));var logger=require(_0x9448('0x5'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9448('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x9448('0x7'))(new Redis(config['redis']));require(_0x9448('0x8'))[_0x9448('0x9')](socket);function respondWithStatusCode(_0x26bd97,_0x4b81f9){_0x4b81f9=_0x4b81f9||0xcc;return function(_0x4ff5b9){if(_0x4ff5b9){return _0x26bd97['sendStatus'](_0x4b81f9);}return _0x26bd97[_0x9448('0xa')](_0x4b81f9)[_0x9448('0xb')]();};}function respondWithResult(_0x4640c3,_0x5d20e2){_0x5d20e2=_0x5d20e2||0xc8;return function(_0x20b436){if(_0x20b436){return _0x4640c3['status'](_0x5d20e2)[_0x9448('0xc')](_0x20b436);}};}function respondWithFilteredResult(_0x444830,_0x3a4971){return function(_0x87a6a){if(_0x87a6a){var _0x3485b1=typeof _0x3a4971[_0x9448('0xd')]===_0x9448('0xe')&&typeof _0x3a4971[_0x9448('0xf')]==='undefined';var _0x75cf9c=_0x87a6a['count'];var _0x323fd2=_0x3485b1?0x0:_0x3a4971[_0x9448('0xd')];var _0x50f986=_0x3485b1?_0x87a6a[_0x9448('0x10')]:_0x3a4971[_0x9448('0xd')]+_0x3a4971[_0x9448('0xf')];var _0x8a6745;if(_0x50f986>=_0x75cf9c){_0x50f986=_0x75cf9c;_0x8a6745=0xc8;}else{_0x8a6745=0xce;}_0x444830[_0x9448('0xa')](_0x8a6745);return _0x444830[_0x9448('0x11')](_0x9448('0x12'),_0x323fd2+'-'+_0x50f986+'/'+_0x75cf9c)[_0x9448('0xc')](_0x87a6a);}return null;};}function saveUpdates(_0x5a24de){return function(_0x23a098){if(_0x23a098){return _0x23a098['update'](_0x5a24de)[_0x9448('0x13')](function(_0xc448c6){return _0xc448c6;});}return null;};}function removeEntity(_0x1104f0){return function(_0x24fdf5){if(_0x24fdf5){return _0x24fdf5[_0x9448('0x14')]()[_0x9448('0x13')](function(){var _0x1cd99a=_0x24fdf5[_0x9448('0x15')]({'plain':!![]});var _0x6826cd=_0x9448('0x16');return db['UserProfileResource'][_0x9448('0x14')]({'where':{'type':_0x6826cd,'resourceId':_0x1cd99a['id']}})['then'](function(){return _0x24fdf5;});})['then'](function(){_0x1104f0[_0x9448('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594b6b){return function(_0x5e0a05){if(!_0x5e0a05){_0x594b6b[_0x9448('0x17')](0x194);}return _0x5e0a05;};}function handleError(_0x5befa0,_0x39948a){_0x39948a=_0x39948a||0x1f4;return function(_0xc957ed){logger[_0x9448('0x18')](_0xc957ed['stack']);if(_0xc957ed[_0x9448('0x19')]){delete _0xc957ed[_0x9448('0x19')];}_0x5befa0[_0x9448('0xa')](_0x39948a)[_0x9448('0x1a')](_0xc957ed);};}exports[_0x9448('0x1b')]=function(_0x985d73,_0x4d8a8a){var _0x56676e={};var _0x7cfc8e={'count':0x0,'rows':[]};var _0x124892=_[_0x9448('0x1c')](db[_0x9448('0x1d')][_0x9448('0x1e')],function(_0x5ded37){return{'name':_0x5ded37[_0x9448('0x1f')],'type':_0x5ded37['type'][_0x9448('0x20')]};});_0x56676e=qs[_0x9448('0x21')](_0x124892,_0x985d73);var _0x245ec8={'where':_0x56676e['where']};return db[_0x9448('0x1d')][_0x9448('0x10')](_0x245ec8)[_0x9448('0x13')](function(_0x89bc24){_0x7cfc8e[_0x9448('0x10')]=_0x89bc24;_0x56676e[_0x9448('0x22')]=qs['include'](_0x985d73[_0x9448('0x23')]);return db[_0x9448('0x1d')]['findAll'](_0x56676e);})[_0x9448('0x13')](function(_0x329f36){_0x7cfc8e[_0x9448('0x24')]=_0x329f36;return _0x7cfc8e;})[_0x9448('0x13')](respondWithFilteredResult(_0x4d8a8a,_0x56676e))[_0x9448('0x25')](handleError(_0x4d8a8a,null));};exports[_0x9448('0x26')]=function(_0x5a93f9,_0x4386bc){var _0x515086={'raw':!![],'where':{'id':_0x5a93f9[_0x9448('0x27')]['id']}},_0x258493={};_0x258493[_0x9448('0x28')]=_[_0x9448('0x29')](db[_0x9448('0x1d')][_0x9448('0x1e')]);_0x258493[_0x9448('0x23')]=_[_0x9448('0x29')](_0x5a93f9['query']);_0x258493[_0x9448('0x2a')]=_[_0x9448('0x2b')](_0x258493['model'],_0x258493['query']);_0x515086[_0x9448('0x2c')]=_[_0x9448('0x2b')](_0x258493['model'],qs[_0x9448('0x2d')](_0x5a93f9[_0x9448('0x23')][_0x9448('0x2d')]));_0x515086[_0x9448('0x2c')]=_0x515086[_0x9448('0x2c')][_0x9448('0x2e')]?_0x515086[_0x9448('0x2c')]:_0x258493['model'];if(_0x5a93f9[_0x9448('0x23')][_0x9448('0x2f')]){_0x515086[_0x9448('0x22')]=[{'all':!![]}];}_0x515086=_[_0x9448('0x30')]({},_0x515086,_0x5a93f9[_0x9448('0x31')]);return db[_0x9448('0x1d')][_0x9448('0x32')](_0x515086)[_0x9448('0x13')](handleEntityNotFound(_0x4386bc,null))[_0x9448('0x13')](respondWithResult(_0x4386bc,null))[_0x9448('0x25')](handleError(_0x4386bc,null));};exports[_0x9448('0x33')]=function(_0x4f2084,_0x1b94dc){return db[_0x9448('0x1d')][_0x9448('0x33')](_0x4f2084[_0x9448('0x34')],{})['then'](function(_0x2a1207){var _0x4556ff=_0x4f2084['user'][_0x9448('0x15')]({'plain':!![]});if(!_0x4556ff)throw new Error(_0x9448('0x35'));if(_0x4556ff[_0x9448('0x36')]===_0x9448('0x37')){var _0x4958ae=_0x2a1207[_0x9448('0x15')]({'plain':!![]});var _0x3df27f=_0x9448('0x16');return db[_0x9448('0x38')][_0x9448('0x32')]({'where':{'name':_0x3df27f,'userProfileId':_0x4556ff['userProfileId']},'raw':!![]})[_0x9448('0x13')](function(_0x26a60a){if(_0x26a60a&&_0x26a60a[_0x9448('0x39')]===0x0){return db['UserProfileResource'][_0x9448('0x33')]({'name':_0x4958ae[_0x9448('0x19')],'resourceId':_0x4958ae['id'],'type':_0x26a60a['name'],'sectionId':_0x26a60a['id']},{})['then'](function(){return _0x2a1207;});}else{return _0x2a1207;}})[_0x9448('0x25')](function(_0x3e6448){logger[_0x9448('0x18')](_0x9448('0x3a'),_0x3e6448);throw _0x3e6448;});}return _0x2a1207;})['then'](respondWithResult(_0x1b94dc,0xc9))[_0x9448('0x25')](handleError(_0x1b94dc,null));};exports[_0x9448('0x3b')]=function(_0x19fd7d,_0x28f2fe){if(_0x19fd7d[_0x9448('0x34')]['id']){delete _0x19fd7d[_0x9448('0x34')]['id'];}return db[_0x9448('0x1d')][_0x9448('0x32')]({'where':{'id':_0x19fd7d[_0x9448('0x27')]['id']}})[_0x9448('0x13')](handleEntityNotFound(_0x28f2fe,null))['then'](saveUpdates(_0x19fd7d['body'],null))[_0x9448('0x13')](respondWithResult(_0x28f2fe,null))[_0x9448('0x25')](handleError(_0x28f2fe,null));};exports[_0x9448('0x14')]=function(_0x14fada,_0x691234){return db[_0x9448('0x1d')][_0x9448('0x32')]({'where':{'id':_0x14fada[_0x9448('0x27')]['id']}})['then'](handleEntityNotFound(_0x691234,null))['then'](removeEntity(_0x691234,null))[_0x9448('0x25')](handleError(_0x691234,null));};exports[_0x9448('0x3c')]=function(_0xeb6f95,_0x236e32){return db[_0x9448('0x1d')][_0x9448('0x3c')]()[_0x9448('0x13')](respondWithResult(_0x236e32,null))['catch'](handleError(_0x236e32,null));};exports['getMembers']=function(_0x2c3fc9,_0x6dc894){var _0x411815={'raw':!![],'where':{}},_0x411c3e={},_0x22cc9c;return db['FaxQueue'][_0x9448('0x3d')]({'where':{'id':_0x2c3fc9[_0x9448('0x27')]['id']}})[_0x9448('0x13')](handleEntityNotFound(_0x6dc894,null))['then'](function(_0x20a5b4){if(_0x20a5b4){_0x22cc9c=_0x20a5b4[_0x9448('0x15')]({'plain':!![]});_0x411c3e[_0x9448('0x28')]=_[_0x9448('0x29')](db[_0x9448('0x3e')][_0x9448('0x1e')]);_0x411c3e[_0x9448('0x23')]=_[_0x9448('0x29')](_0x2c3fc9[_0x9448('0x23')]);_0x411c3e[_0x9448('0x2a')]=_[_0x9448('0x2b')](_0x411c3e[_0x9448('0x28')],_0x411c3e[_0x9448('0x23')]);_0x411815[_0x9448('0x2c')]=_['intersection'](_0x411c3e['model'],qs[_0x9448('0x2d')](_0x2c3fc9['query'][_0x9448('0x2d')]));_0x411815[_0x9448('0x2c')]=_0x411815[_0x9448('0x2c')][_0x9448('0x2e')]?_0x411815[_0x9448('0x2c')]:_0x411c3e[_0x9448('0x28')];if(!_0x2c3fc9['query'][_0x9448('0x3f')]('nolimit')){_0x411815[_0x9448('0xf')]=qs[_0x9448('0xf')](_0x2c3fc9['query'][_0x9448('0xf')]);_0x411815[_0x9448('0xd')]=qs[_0x9448('0xd')](_0x2c3fc9['query'][_0x9448('0xd')]);}_0x411815[_0x9448('0x40')]=qs[_0x9448('0x41')](_0x2c3fc9[_0x9448('0x23')][_0x9448('0x41')]);_0x411815[_0x9448('0x42')]=qs[_0x9448('0x2a')](_[_0x9448('0x43')](_0x2c3fc9[_0x9448('0x23')],_0x411c3e[_0x9448('0x2a')]));_0x411815[_0x9448('0x42')]['FaxQueueId']=_0x20a5b4['id'];if(_0x2c3fc9[_0x9448('0x23')][_0x9448('0x44')]){_0x411815[_0x9448('0x42')]=_[_0x9448('0x30')](_0x411815['where'],{'$or':_[_0x9448('0x1c')](_0x411815[_0x9448('0x2c')],function(_0x38ae6d){var _0x573a9f={};_0x573a9f[_0x38ae6d]={'$like':'%'+_0x2c3fc9[_0x9448('0x23')][_0x9448('0x44')]+'%'};return _0x573a9f;})});}_0x411815=_['merge']({},_0x411815,_0x2c3fc9[_0x9448('0x31')]);return db[_0x9448('0x3e')]['findAll'](_0x411815);}})[_0x9448('0x13')](function(_0x3dcca3){if(_0x3dcca3){return db[_0x9448('0x45')][_0x9448('0x46')]({'where':{'id':_[_0x9448('0x1c')](_0x3dcca3,_0x9448('0x47')),'role':_0x9448('0x48')},'attributes':['id',_0x9448('0x19'),_0x9448('0x49'),_0x9448('0x4a'),_0x9448('0x4b')]});}})[_0x9448('0x13')](function(_0x42fc02){if(_0x42fc02){return{'count':_0x42fc02[_0x9448('0x10')],'rows':_[_0x9448('0x1c')](_0x42fc02[_0x9448('0x24')],function(_0x143b51){return{'membername':_0x143b51[_0x9448('0x19')],'UserId':_0x143b51['id'],'queue_name':_0x22cc9c[_0x9448('0x19')],'FaxQueueId':_0x22cc9c['id'],'interface':util[_0x9448('0x4c')](_0x9448('0x4d'),_0x9448('0x4e'),_0x143b51['name']),'penalty':0x0,'paused':_0x143b51['faxPause'],'createdAt':_0x143b51[_0x9448('0x4b')],'updatedAt':_0x143b51['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9448('0x13')](respondWithFilteredResult(_0x6dc894,_0x411815))[_0x9448('0x25')](handleError(_0x6dc894,null));};exports['getTeams']=function(_0x3844b0,_0x5782d3){var _0x113935={};var _0x32a5ec={};var _0x52016c;var _0x3d6ee7;return db['FaxQueue']['findOne']({'where':{'id':_0x3844b0[_0x9448('0x27')]['id']}})[_0x9448('0x13')](handleEntityNotFound(_0x5782d3,null))[_0x9448('0x13')](function(_0x2f9fdd){if(_0x2f9fdd){_0x52016c=_0x2f9fdd;_0x32a5ec['model']=_[_0x9448('0x29')](db[_0x9448('0x4f')][_0x9448('0x1e')]);_0x32a5ec[_0x9448('0x23')]=_[_0x9448('0x29')](_0x3844b0[_0x9448('0x23')]);_0x32a5ec[_0x9448('0x2a')]=_['intersection'](_0x32a5ec[_0x9448('0x28')],_0x32a5ec[_0x9448('0x23')]);_0x113935['attributes']=_[_0x9448('0x2b')](_0x32a5ec['model'],qs['fields'](_0x3844b0['query'][_0x9448('0x2d')]));_0x113935[_0x9448('0x2c')]=_0x113935[_0x9448('0x2c')]['length']?_0x113935['attributes']:_0x32a5ec['model'];_0x113935[_0x9448('0x40')]=qs[_0x9448('0x41')](_0x3844b0['query']['sort']);_0x113935[_0x9448('0x42')]=qs['filters'](_[_0x9448('0x43')](_0x3844b0[_0x9448('0x23')],_0x32a5ec[_0x9448('0x2a')]));if(_0x3844b0[_0x9448('0x23')][_0x9448('0x44')]){_0x113935['where']=_['merge'](_0x113935['where'],{'$or':_['map'](_0x113935['attributes'],function(_0x2640d6){var _0xe9cb98={};_0xe9cb98[_0x2640d6]={'$like':'%'+_0x3844b0['query'][_0x9448('0x44')]+'%'};return _0xe9cb98;})});}_0x113935=_[_0x9448('0x30')]({},_0x113935,_0x3844b0['options']);return _0x52016c[_0x9448('0x50')](_0x113935);}})[_0x9448('0x13')](function(_0x164edb){if(_0x164edb){_0x3d6ee7=_0x164edb[_0x9448('0x2e')];if(!_0x3844b0[_0x9448('0x23')][_0x9448('0x3f')]('nolimit')){_0x113935['limit']=qs[_0x9448('0xf')](_0x3844b0['query']['limit']);_0x113935['offset']=qs[_0x9448('0xd')](_0x3844b0[_0x9448('0x23')][_0x9448('0xd')]);}return _0x52016c[_0x9448('0x50')](_0x113935);}})[_0x9448('0x13')](function(_0xec2758){if(_0xec2758){return _0xec2758?{'count':_0x3d6ee7,'rows':_0xec2758}:null;}})[_0x9448('0x13')](respondWithResult(_0x5782d3,null))[_0x9448('0x25')](handleError(_0x5782d3,null));};exports[_0x9448('0x51')]=function(_0x2c2313,_0x45fb7a){var _0x2ec22c=_0x2c2313['body'][_0x9448('0x52')];return db[_0x9448('0x4f')][_0x9448('0x53')]({'where':{'id':_0x2ec22c},'attributes':['id'],'include':[{'model':db[_0x9448('0x45')],'as':'Agents','attributes':['id','name',_0x9448('0x54'),_0x9448('0x55'),_0x9448('0x56')],'raw':!![]}]})[_0x9448('0x13')](function(_0x377097){if(_0x377097){var _0x3dc86d=_[_0x9448('0x57')](_0x377097,function(_0x7530f3){var _0x501008=_0x7530f3[_0x9448('0x15')]({'plain':!![]});return _0x501008[_0x9448('0x58')];});return db[_0x9448('0x1d')][_0x9448('0x32')]({'where':{'id':_0x2c2313['params']['id']}})[_0x9448('0x13')](function(_0x2f2b56){return db['sequelize'][_0x9448('0x59')](function(_0x5e04f7){return _0x2f2b56[_0x9448('0x51')](_0x2ec22c,{'transaction':_0x5e04f7})[_0x9448('0x13')](function(){return BPromise['each'](_0x3dc86d,function(_0x431870){return db[_0x9448('0x3e')][_0x9448('0x5a')]({'where':{'UserId':_0x431870['id'],'FaxQueueId':_0x2c2313[_0x9448('0x27')]['id']},'transaction':_0x5e04f7});});})[_0x9448('0x13')](function(){_0x3dc86d['forEach'](function(_0x7483cd){socket[_0x9448('0x5b')](_0x9448('0x5c'),{'UserId':_0x7483cd['id'],'FaxQueueId':_0x2f2b56['id']});});});});});}})[_0x9448('0x13')](respondWithStatusCode(_0x45fb7a,null))[_0x9448('0x25')](handleError(_0x45fb7a,null));};exports[_0x9448('0x5d')]=function(_0x411edb,_0x1e1abc){return db[_0x9448('0x4f')]['findAll']({'where':{'id':_0x411edb[_0x9448('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9448('0x45')],'as':_0x9448('0x58'),'attributes':['id'],'raw':!![]}]})[_0x9448('0x13')](handleEntityNotFound(_0x1e1abc,null))[_0x9448('0x13')](function(_0x4c1604){var _0x4d5e6b=_[_0x9448('0x1c')](_0x4c1604,'id');var _0x34c39a=[];var _0x3c005d=[];var _0x215d37=squel[_0x9448('0x5e')]();_0x215d37[_0x9448('0x5f')](_0x9448('0x60'))[_0x9448('0x61')]('team_has_fax_queues','tq')[_0x9448('0x62')](_0x9448('0x63'),'ut',_0x9448('0x64'))['where'](_0x9448('0x65'),_0x411edb[_0x9448('0x27')]['id']);for(var _0x316dc0=0x0;_0x316dc0<_0x4c1604[_0x9448('0x2e')];_0x316dc0+=0x1){let _0x4ea2bd=_0x4c1604[_0x316dc0];for(var _0x3df7bc=0x0;_0x3df7bc<_0x4ea2bd[_0x9448('0x58')][_0x9448('0x2e')];_0x3df7bc+=0x1){let _0x5f542b=_0x4ea2bd['Agents'][_0x3df7bc];var _0x3a9049=_0x215d37[_0x9448('0x66')]();_0x3a9049[_0x9448('0x42')]('ut.UserId\x20=\x20?',_0x5f542b['id']);_0x3c005d[_0x9448('0x67')](db['sequelize']['query'](_0x3a9049[_0x9448('0x68')](),{'type':db[_0x9448('0x69')]['QueryTypes'][_0x9448('0x6a')]})[_0x9448('0x13')](function(_0x2e146d){if(_0x2e146d[_0x9448('0x2e')]===0x1){return _0x5f542b['id'];}else{var _0x56433c=_[_0x9448('0x6b')](_[_0x9448('0x1c')](_0x2e146d,'TeamId'),function(_0x5017de){return _[_0x9448('0x6c')](_0x4d5e6b,_0x5017de);});if(_0x56433c){return _0x5f542b['id'];}}}));}}return BPromise[_0x9448('0x6d')](_0x3c005d)[_0x9448('0x13')](function(_0x2c566c){_0x34c39a=_(_0x34c39a)[_0x9448('0x6e')](_0x2c566c)[_0x9448('0x6f')]()[_0x9448('0x70')]();return db[_0x9448('0x1d')][_0x9448('0x32')]({'where':{'id':_0x411edb[_0x9448('0x27')]['id']}})[_0x9448('0x13')](function(_0x324c2a){return db[_0x9448('0x69')][_0x9448('0x59')](function(_0x4bdb82){return _0x324c2a[_0x9448('0x5d')](_0x411edb[_0x9448('0x23')][_0x9448('0x52')],{'transaction':_0x4bdb82})[_0x9448('0x13')](function(){if(!_[_0x9448('0x71')](_0x34c39a)){return _0x324c2a['removeAgents'](_0x34c39a,{'transaction':_0x4bdb82});}})[_0x9448('0x13')](function(){_0x34c39a['forEach'](function(_0x44b977){socket['emit'](_0x9448('0x72'),{'UserId':_0x44b977,'FaxQueueId':_0x324c2a['id']});});});});});});})[_0x9448('0x13')](respondWithStatusCode(_0x1e1abc,null))[_0x9448('0x25')](handleError(_0x1e1abc,null));};exports['addAgents']=function(_0x30b205,_0x295c6a){return db[_0x9448('0x1d')][_0x9448('0x32')]({'where':{'id':_0x30b205[_0x9448('0x27')]['id']}})[_0x9448('0x13')](handleEntityNotFound(_0x295c6a,null))[_0x9448('0x13')](function(_0x3efcd2){if(_0x3efcd2){return _0x3efcd2[_0x9448('0x73')](_0x30b205['body'][_0x9448('0x52')],_[_0x9448('0x74')](_0x30b205[_0x9448('0x34')],[_0x9448('0x52'),'id'])||{})[_0x9448('0x75')](function(_0x3b8afe){for(var _0x22426e=0x0;_0x22426e<_0x30b205['body']['ids']['length'];_0x22426e+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x30b205[_0x9448('0x34')]['ids'][_0x22426e]),'FaxQueueId':Number(_0x30b205[_0x9448('0x27')]['id'])});}return _0x3b8afe;});}})[_0x9448('0x13')](respondWithResult(_0x295c6a,null))[_0x9448('0x25')](handleError(_0x295c6a,null));};exports[_0x9448('0x76')]=function(_0x35bc6f,_0x324a3c){return db[_0x9448('0x1d')][_0x9448('0x32')]({'where':{'id':_0x35bc6f[_0x9448('0x27')]['id']}})[_0x9448('0x13')](handleEntityNotFound(_0x324a3c,null))[_0x9448('0x13')](function(_0x4fa912){if(_0x4fa912){return _0x4fa912['removeAgents'](_0x35bc6f[_0x9448('0x23')][_0x9448('0x52')])['then'](function(){if(_[_0x9448('0x77')](_0x35bc6f[_0x9448('0x23')]['ids'])){for(var _0x5d18a8=0x0;_0x5d18a8<_0x35bc6f['query'][_0x9448('0x52')][_0x9448('0x2e')];_0x5d18a8+=0x1){socket[_0x9448('0x5b')]('userFaxQueue:remove',{'UserId':Number(_0x35bc6f['query'][_0x9448('0x52')][_0x5d18a8]),'FaxQueueId':Number(_0x35bc6f[_0x9448('0x27')]['id'])});}}else{socket[_0x9448('0x5b')](_0x9448('0x72'),{'UserId':Number(_0x35bc6f['query']['ids']),'FaxQueueId':Number(_0x35bc6f[_0x9448('0x27')]['id'])});}});}})['then'](respondWithStatusCode(_0x324a3c,null))[_0x9448('0x25')](handleError(_0x324a3c,null));};exports[_0x9448('0x78')]=function(_0x457e2e,_0x1a68b3){var _0x43dfc9={};var _0x245ae3={};var _0x202ef2;var _0x137ae6;return db[_0x9448('0x1d')][_0x9448('0x3d')]({'where':{'id':_0x457e2e[_0x9448('0x27')]['id']}})['then'](handleEntityNotFound(_0x1a68b3,null))[_0x9448('0x13')](function(_0x3c79a0){if(_0x3c79a0){_0x202ef2=_0x3c79a0;_0x245ae3[_0x9448('0x28')]=_[_0x9448('0x29')](db[_0x9448('0x45')]['rawAttributes']);_0x245ae3[_0x9448('0x23')]=_['keys'](_0x457e2e['query']);_0x245ae3[_0x9448('0x2a')]=_[_0x9448('0x2b')](_0x245ae3[_0x9448('0x28')],_0x245ae3[_0x9448('0x23')]);_0x43dfc9[_0x9448('0x2c')]=_[_0x9448('0x2b')](_0x245ae3[_0x9448('0x28')],qs[_0x9448('0x2d')](_0x457e2e[_0x9448('0x23')][_0x9448('0x2d')]));_0x43dfc9[_0x9448('0x2c')]=_0x43dfc9['attributes'][_0x9448('0x2e')]?_0x43dfc9[_0x9448('0x2c')]:_0x245ae3[_0x9448('0x28')];_0x43dfc9[_0x9448('0x40')]=qs[_0x9448('0x41')](_0x457e2e['query'][_0x9448('0x41')]);_0x43dfc9['where']=qs['filters'](_[_0x9448('0x43')](_0x457e2e[_0x9448('0x23')],_0x245ae3[_0x9448('0x2a')]));if(_0x457e2e[_0x9448('0x23')][_0x9448('0x44')]){_0x43dfc9[_0x9448('0x42')]=_['merge'](_0x43dfc9[_0x9448('0x42')],{'$or':_[_0x9448('0x1c')](_0x43dfc9[_0x9448('0x2c')],function(_0x2b9998){var _0x2bddbd={};_0x2bddbd[_0x2b9998]={'$like':'%'+_0x457e2e['query'][_0x9448('0x44')]+'%'};return _0x2bddbd;})});}_0x43dfc9=_[_0x9448('0x30')]({},_0x43dfc9,_0x457e2e['options']);return _0x202ef2[_0x9448('0x78')](_0x43dfc9);}})[_0x9448('0x13')](function(_0xfd0905){if(_0xfd0905){_0x137ae6=_0xfd0905[_0x9448('0x2e')];if(!_0x457e2e[_0x9448('0x23')][_0x9448('0x3f')]('nolimit')){_0x43dfc9[_0x9448('0xf')]=qs['limit'](_0x457e2e[_0x9448('0x23')][_0x9448('0xf')]);_0x43dfc9[_0x9448('0xd')]=qs[_0x9448('0xd')](_0x457e2e[_0x9448('0x23')][_0x9448('0xd')]);}return _0x202ef2['getAgents'](_0x43dfc9);}})['then'](function(_0x1eb48c){if(_0x1eb48c){return _0x1eb48c?{'count':_0x137ae6,'rows':_0x1eb48c}:null;}})['then'](respondWithResult(_0x1a68b3,null))[_0x9448('0x25')](handleError(_0x1a68b3,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7274dae..c66e190 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 _0x5788=['FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x5788,0x1ae));var _0x8578=function(_0x5931d5,_0x185e3f){_0x5931d5=_0x5931d5-0x0;var _0x3dcaeb=_0x5788[_0x5931d5];return _0x3dcaeb;};'use strict';var EventEmitter=require(_0x8578('0x0'));var FaxQueue=require(_0x8578('0x1'))['db'][_0x8578('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8578('0x3')](0x0);var events={'afterCreate':_0x8578('0x4'),'afterUpdate':_0x8578('0x5'),'afterDestroy':_0x8578('0x6')};function emitEvent(_0x1dd3f1){return function(_0x1dad6d,_0x27de4f,_0x59f315){FaxQueueEvents[_0x8578('0x7')](_0x1dd3f1+':'+_0x1dad6d['id'],_0x1dad6d);FaxQueueEvents[_0x8578('0x7')](_0x1dd3f1,_0x1dad6d);_0x59f315(null);};}for(var e in events){if(events[_0x8578('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x4d89=['exports','events','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d89,0x14e));var _0x94d8=function(_0x35a926,_0x2a99be){_0x35a926=_0x35a926-0x0;var _0x46ece8=_0x4d89[_0x35a926];return _0x46ece8;};'use strict';var EventEmitter=require(_0x94d8('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x94d8('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x94d8('0x2')](0x0);var events={'afterCreate':_0x94d8('0x3'),'afterUpdate':_0x94d8('0x4'),'afterDestroy':_0x94d8('0x5')};function emitEvent(_0x578e99){return function(_0x35924d,_0x2ed213,_0xacbf00){FaxQueueEvents['emit'](_0x578e99+':'+_0x35924d['id'],_0x35924d);FaxQueueEvents[_0x94d8('0x6')](_0x578e99,_0x35924d);_0xacbf00(null);};}for(var e in events){if(events[_0x94d8('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x94d8('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index bcce8ce..e7f0df6 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 _0xd59b=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','lodash','util','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd59b,0x7b));var _0xbd59=function(_0x5a40b0,_0x4d3d22){_0x5a40b0=_0x5a40b0-0x0;var _0x4d689d=_0xd59b[_0x5a40b0];return _0x4d689d;};'use strict';var _=require(_0xbd59('0x0'));var util=require(_0xbd59('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbd59('0x2'));var fs=require('fs');var path=require(_0xbd59('0x3'));var rimraf=require(_0xbd59('0x4'));var config=require(_0xbd59('0x5'));var attributes=require(_0xbd59('0x6'));module[_0xbd59('0x7')]=function(_0x8c81e7,_0x550bb3){return _0x8c81e7[_0xbd59('0x8')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2f5=['FaxQueue','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define'];(function(_0xd56b4a,_0x3b529e){var _0x1006b8=function(_0x1c3934){while(--_0x1c3934){_0xd56b4a['push'](_0xd56b4a['shift']());}};_0x1006b8(++_0x3b529e);}(_0xf2f5,0x182));var _0x5f2f=function(_0x4357c3,_0x3645d1){_0x4357c3=_0x4357c3-0x0;var _0xb7361b=_0xf2f5[_0x4357c3];return _0xb7361b;};'use strict';var _=require(_0x5f2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f2f('0x1'));var moment=require(_0x5f2f('0x2'));var BPromise=require(_0x5f2f('0x3'));var rp=require(_0x5f2f('0x4'));var fs=require('fs');var path=require(_0x5f2f('0x5'));var rimraf=require(_0x5f2f('0x6'));var config=require(_0x5f2f('0x7'));var attributes=require(_0x5f2f('0x8'));module['exports']=function(_0x97db90,_0x1e7699){return _0x97db90[_0x5f2f('0x9')](_0x5f2f('0xa'),attributes,{'tableName':'fax_queues','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 bc61543..9b976d0 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 _0x9d10=['code','message','result','GetFaxQueue','options','raw','where','attributes','limit','include','map','model','debug','catch','FaxQueue','find','ShowFaxQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0x9d10,0xde));var _0x09d1=function(_0x5b3878,_0x511513){_0x5b3878=_0x5b3878-0x0;var _0x2cf370=_0x9d10[_0x5b3878];return _0x2cf370;};'use strict';var _=require('lodash');var util=require(_0x09d1('0x0'));var moment=require(_0x09d1('0x1'));var BPromise=require(_0x09d1('0x2'));var rs=require(_0x09d1('0x3'));var fs=require('fs');var Redis=require(_0x09d1('0x4'));var db=require(_0x09d1('0x5'))['db'];var utils=require(_0x09d1('0x6'));var logger=require('../../config/logger')(_0x09d1('0x7'));var config=require(_0x09d1('0x8'));var jayson=require(_0x09d1('0x9'));var client=jayson[_0x09d1('0xa')][_0x09d1('0xb')]({'port':0x232a});config[_0x09d1('0xc')]=_['defaults'](config[_0x09d1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x09d1('0xd'))(new Redis(config[_0x09d1('0xc')]));require(_0x09d1('0xe'))[_0x09d1('0xf')](socket);function respondWithRpcPromise(_0x154761,_0x551d8d,_0x4be232){return new BPromise(function(_0x1e3176,_0x4a5a9d){return client[_0x09d1('0x10')](_0x154761,_0x4be232)[_0x09d1('0x11')](function(_0x4c88be){logger[_0x09d1('0x12')](_0x09d1('0x13'),_0x551d8d,_0x09d1('0x14'));logger['debug'](_0x09d1('0x15'),_0x551d8d,_0x09d1('0x14'),JSON[_0x09d1('0x16')](_0x4c88be));if(_0x4c88be[_0x09d1('0x17')]){if(_0x4c88be['error'][_0x09d1('0x18')]===0x1f4){logger[_0x09d1('0x17')](_0x09d1('0x13'),_0x551d8d,_0x4c88be['error'][_0x09d1('0x19')]);return _0x4a5a9d(_0x4c88be[_0x09d1('0x17')][_0x09d1('0x19')]);}logger[_0x09d1('0x17')](_0x09d1('0x13'),_0x551d8d,_0x4c88be[_0x09d1('0x17')][_0x09d1('0x19')]);return _0x1e3176(_0x4c88be['error'][_0x09d1('0x19')]);}else{logger[_0x09d1('0x12')]('FaxQueue,\x20%s,\x20%s',_0x551d8d,_0x09d1('0x14'));_0x1e3176(_0x4c88be[_0x09d1('0x1a')][_0x09d1('0x19')]);}})['catch'](function(_0xd4d0d){logger[_0x09d1('0x17')](_0x09d1('0x13'),_0x551d8d,_0xd4d0d);_0x4a5a9d(_0xd4d0d);});});}exports[_0x09d1('0x1b')]=function(_0xc4c738){var _0xc75b59=this;return new Promise(function(_0x3692c8,_0x1cdcba){return db['FaxQueue']['findAll']({'raw':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x1d')]===undefined?!![]:![]:!![],'where':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x1e')]||null:null,'attributes':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x1f')]||null:null,'limit':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x20')]||null:null,'include':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x21')]?_[_0x09d1('0x22')](_0xc4c738['options'][_0x09d1('0x21')],function(_0xde0836){return{'model':db[_0xde0836['model']],'as':_0xde0836['as'],'attributes':_0xde0836[_0x09d1('0x1f')],'include':_0xde0836[_0x09d1('0x21')]?_['map'](_0xde0836['include'],function(_0x3b286d){return{'model':db[_0x3b286d['model']],'as':_0x3b286d['as'],'attributes':_0x3b286d[_0x09d1('0x1f')],'include':_0x3b286d[_0x09d1('0x21')]?_[_0x09d1('0x22')](_0x3b286d[_0x09d1('0x21')],function(_0x371ca0){return{'model':db[_0x371ca0[_0x09d1('0x23')]],'as':_0x371ca0['as'],'attributes':_0x371ca0[_0x09d1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bc6bc){logger[_0x09d1('0x12')](_0x09d1('0x1b'),_0xc4c738);logger[_0x09d1('0x24')]('GetFaxQueue',_0xc4c738,JSON[_0x09d1('0x16')](_0x3bc6bc));_0x3692c8(_0x3bc6bc);})[_0x09d1('0x25')](function(_0x5820df){logger[_0x09d1('0x17')](_0x09d1('0x1b'),_0x5820df[_0x09d1('0x19')],_0xc4c738);_0x1cdcba(_0xc75b59[_0x09d1('0x17')](0x1f4,_0x5820df[_0x09d1('0x19')]));});});};exports['ShowFaxQueue']=function(_0x22fd7c){var _0x293f6b=this;return new Promise(function(_0x2562c1,_0x245cb5){return db[_0x09d1('0x26')][_0x09d1('0x27')]({'raw':_0x22fd7c[_0x09d1('0x1c')]?_0x22fd7c[_0x09d1('0x1c')][_0x09d1('0x1d')]===undefined?!![]:![]:!![],'where':_0x22fd7c['options']?_0x22fd7c[_0x09d1('0x1c')][_0x09d1('0x1e')]||null:null,'attributes':_0x22fd7c[_0x09d1('0x1c')]?_0x22fd7c[_0x09d1('0x1c')][_0x09d1('0x1f')]||null:null,'include':_0x22fd7c[_0x09d1('0x1c')]?_0x22fd7c[_0x09d1('0x1c')]['include']?_['map'](_0x22fd7c[_0x09d1('0x1c')][_0x09d1('0x21')],function(_0x46ede5){return{'model':db[_0x46ede5[_0x09d1('0x23')]],'as':_0x46ede5['as'],'attributes':_0x46ede5['attributes'],'include':_0x46ede5['include']?_[_0x09d1('0x22')](_0x46ede5['include'],function(_0x12c1ef){return{'model':db[_0x12c1ef[_0x09d1('0x23')]],'as':_0x12c1ef['as'],'attributes':_0x12c1ef['attributes'],'include':_0x12c1ef[_0x09d1('0x21')]?_[_0x09d1('0x22')](_0x12c1ef[_0x09d1('0x21')],function(_0x227d90){return{'model':db[_0x227d90[_0x09d1('0x23')]],'as':_0x227d90['as'],'attributes':_0x227d90[_0x09d1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x09d1('0x11')](function(_0x2d3d4d){logger[_0x09d1('0x12')](_0x09d1('0x28'),_0x22fd7c);logger[_0x09d1('0x24')](_0x09d1('0x28'),_0x22fd7c,JSON[_0x09d1('0x16')](_0x2d3d4d));_0x2562c1(_0x2d3d4d);})[_0x09d1('0x25')](function(_0x2da30a){logger[_0x09d1('0x17')](_0x09d1('0x28'),_0x2da30a['message'],_0x22fd7c);_0x245cb5(_0x293f6b[_0x09d1('0x17')](0x1f4,_0x2da30a['message']));});});}; \ No newline at end of file +var _0x48b0=['options','raw','attributes','limit','include','map','model','stringify','ShowFaxQueue','find','where','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','GetFaxQueue','FaxQueue'];(function(_0x1ec31c,_0x2485d9){var _0x4a96ff=function(_0x5d1b9e){while(--_0x5d1b9e){_0x1ec31c['push'](_0x1ec31c['shift']());}};_0x4a96ff(++_0x2485d9);}(_0x48b0,0x17e));var _0x048b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48b0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x048b('0x0'));var BPromise=require(_0x048b('0x1'));var rs=require(_0x048b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x048b('0x3'))['db'];var utils=require(_0x048b('0x4'));var logger=require(_0x048b('0x5'))(_0x048b('0x6'));var config=require(_0x048b('0x7'));var jayson=require(_0x048b('0x8'));var client=jayson['client'][_0x048b('0x9')]({'port':0x232a});config[_0x048b('0xa')]=_['defaults'](config[_0x048b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x048b('0xb'))(new Redis(config[_0x048b('0xa')]));require(_0x048b('0xc'))[_0x048b('0xd')](socket);function respondWithRpcPromise(_0x519979,_0x1e3da0,_0x1e43e3){return new BPromise(function(_0xc646ae,_0x32a78b){return client[_0x048b('0xe')](_0x519979,_0x1e43e3)[_0x048b('0xf')](function(_0x7f7b42){logger['info'](_0x048b('0x10'),_0x1e3da0,_0x048b('0x11'));logger[_0x048b('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1e3da0,_0x048b('0x11'),JSON['stringify'](_0x7f7b42));if(_0x7f7b42['error']){if(_0x7f7b42[_0x048b('0x13')][_0x048b('0x14')]===0x1f4){logger[_0x048b('0x13')]('FaxQueue,\x20%s,\x20%s',_0x1e3da0,_0x7f7b42[_0x048b('0x13')][_0x048b('0x15')]);return _0x32a78b(_0x7f7b42['error']['message']);}logger[_0x048b('0x13')](_0x048b('0x10'),_0x1e3da0,_0x7f7b42[_0x048b('0x13')][_0x048b('0x15')]);return _0xc646ae(_0x7f7b42[_0x048b('0x13')][_0x048b('0x15')]);}else{logger[_0x048b('0x16')](_0x048b('0x10'),_0x1e3da0,'request\x20sent');_0xc646ae(_0x7f7b42['result'][_0x048b('0x15')]);}})['catch'](function(_0x3bd2b0){logger['error']('FaxQueue,\x20%s,\x20%s',_0x1e3da0,_0x3bd2b0);_0x32a78b(_0x3bd2b0);});});}exports[_0x048b('0x17')]=function(_0x4b2867){var _0x3f6d26=this;return new Promise(function(_0x4f77ea,_0x5989d0){return db[_0x048b('0x18')]['findAll']({'raw':_0x4b2867['options']?_0x4b2867[_0x048b('0x19')][_0x048b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b2867['options']?_0x4b2867[_0x048b('0x19')]['where']||null:null,'attributes':_0x4b2867[_0x048b('0x19')]?_0x4b2867[_0x048b('0x19')][_0x048b('0x1b')]||null:null,'limit':_0x4b2867[_0x048b('0x19')]?_0x4b2867['options'][_0x048b('0x1c')]||null:null,'include':_0x4b2867['options']?_0x4b2867['options'][_0x048b('0x1d')]?_[_0x048b('0x1e')](_0x4b2867[_0x048b('0x19')][_0x048b('0x1d')],function(_0x1f0d97){return{'model':db[_0x1f0d97[_0x048b('0x1f')]],'as':_0x1f0d97['as'],'attributes':_0x1f0d97['attributes'],'include':_0x1f0d97[_0x048b('0x1d')]?_['map'](_0x1f0d97['include'],function(_0x40654f){return{'model':db[_0x40654f[_0x048b('0x1f')]],'as':_0x40654f['as'],'attributes':_0x40654f[_0x048b('0x1b')],'include':_0x40654f[_0x048b('0x1d')]?_[_0x048b('0x1e')](_0x40654f[_0x048b('0x1d')],function(_0x95c75a){return{'model':db[_0x95c75a['model']],'as':_0x95c75a['as'],'attributes':_0x95c75a[_0x048b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x048b('0xf')](function(_0x3a67bf){logger[_0x048b('0x16')](_0x048b('0x17'),_0x4b2867);logger['debug'](_0x048b('0x17'),_0x4b2867,JSON[_0x048b('0x20')](_0x3a67bf));_0x4f77ea(_0x3a67bf);})['catch'](function(_0x451207){logger[_0x048b('0x13')]('GetFaxQueue',_0x451207[_0x048b('0x15')],_0x4b2867);_0x5989d0(_0x3f6d26[_0x048b('0x13')](0x1f4,_0x451207[_0x048b('0x15')]));});});};exports[_0x048b('0x21')]=function(_0x1950f0){var _0x2b4c12=this;return new Promise(function(_0x3d89ff,_0x2ee63d){return db[_0x048b('0x18')][_0x048b('0x22')]({'raw':_0x1950f0[_0x048b('0x19')]?_0x1950f0['options'][_0x048b('0x1a')]===undefined?!![]:![]:!![],'where':_0x1950f0['options']?_0x1950f0['options'][_0x048b('0x23')]||null:null,'attributes':_0x1950f0['options']?_0x1950f0[_0x048b('0x19')][_0x048b('0x1b')]||null:null,'include':_0x1950f0[_0x048b('0x19')]?_0x1950f0[_0x048b('0x19')][_0x048b('0x1d')]?_[_0x048b('0x1e')](_0x1950f0[_0x048b('0x19')][_0x048b('0x1d')],function(_0x5157af){return{'model':db[_0x5157af[_0x048b('0x1f')]],'as':_0x5157af['as'],'attributes':_0x5157af['attributes'],'include':_0x5157af[_0x048b('0x1d')]?_[_0x048b('0x1e')](_0x5157af[_0x048b('0x1d')],function(_0x4a051d){return{'model':db[_0x4a051d[_0x048b('0x1f')]],'as':_0x4a051d['as'],'attributes':_0x4a051d['attributes'],'include':_0x4a051d[_0x048b('0x1d')]?_[_0x048b('0x1e')](_0x4a051d[_0x048b('0x1d')],function(_0x52fa37){return{'model':db[_0x52fa37[_0x048b('0x1f')]],'as':_0x52fa37['as'],'attributes':_0x52fa37[_0x048b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x048b('0xf')](function(_0x5523de){logger[_0x048b('0x16')](_0x048b('0x21'),_0x1950f0);logger[_0x048b('0x12')](_0x048b('0x21'),_0x1950f0,JSON[_0x048b('0x20')](_0x5523de));_0x3d89ff(_0x5523de);})[_0x048b('0x24')](function(_0x40b458){logger[_0x048b('0x13')]('ShowFaxQueue',_0x40b458[_0x048b('0x15')],_0x1950f0);_0x2ee63d(_0x2b4c12[_0x048b('0x13')](0x1f4,_0x40b458[_0x048b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 17fe09a..f7c0edb 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 _0x1eb1=['./faxQueue.events','save','emit','register','length','faxQueue:'];(function(_0x4151be,_0x576cdb){var _0x3e09b2=function(_0x49ec36){while(--_0x49ec36){_0x4151be['push'](_0x4151be['shift']());}};_0x3e09b2(++_0x576cdb);}(_0x1eb1,0xa2));var _0x11eb=function(_0x427733,_0x499453){_0x427733=_0x427733-0x0;var _0x301c2e=_0x1eb1[_0x427733];return _0x301c2e;};'use strict';var FaxQueueEvents=require(_0x11eb('0x0'));var events=[_0x11eb('0x1'),'remove','update'];function createListener(_0x58708b,_0x24b7fb){return function(_0x5edc55){_0x24b7fb[_0x11eb('0x2')](_0x58708b,_0x5edc55);};}function removeListener(_0x224dce,_0x4b6c18){return function(){FaxQueueEvents['removeListener'](_0x224dce,_0x4b6c18);};}exports[_0x11eb('0x3')]=function(_0x5e7d3b){for(var _0x5c7c62=0x0,_0x3c07ec=events[_0x11eb('0x4')];_0x5c7c62<_0x3c07ec;_0x5c7c62++){var _0x4a0676=events[_0x5c7c62];var _0x1b15b7=createListener(_0x11eb('0x5')+_0x4a0676,_0x5e7d3b);FaxQueueEvents['on'](_0x4a0676,_0x1b15b7);}}; \ No newline at end of file +var _0xc46f=['remove','removeListener','register','length','./faxQueue.events'];(function(_0x16c9c5,_0x43f337){var _0x247ab0=function(_0x3225ac){while(--_0x3225ac){_0x16c9c5['push'](_0x16c9c5['shift']());}};_0x247ab0(++_0x43f337);}(_0xc46f,0x158));var _0xfc46=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc46f[_0x8c43de];return _0xa6591b;};'use strict';var FaxQueueEvents=require(_0xfc46('0x0'));var events=['save',_0xfc46('0x1'),'update'];function createListener(_0x506821,_0x9e8ab7){return function(_0x1ccb03){_0x9e8ab7['emit'](_0x506821,_0x1ccb03);};}function removeListener(_0x95d77f,_0x5dd755){return function(){FaxQueueEvents[_0xfc46('0x2')](_0x95d77f,_0x5dd755);};}exports[_0xfc46('0x3')]=function(_0x5603f0){for(var _0x52de96=0x0,_0x5063d8=events[_0xfc46('0x4')];_0x52de96<_0x5063d8;_0x52de96++){var _0x5eae97=events[_0x52de96];var _0x3418e2=createListener('faxQueue:'+_0x5eae97,_0x5603f0);FaxQueueEvents['on'](_0x5eae97,_0x3418e2);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index fe4e744..4aa50d8 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 _0xc6a2=['show','/:id/members','getMembers','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x3f4a71,_0x367d39){var _0xee8f88=function(_0x4b43eb){while(--_0x4b43eb){_0x3f4a71['push'](_0x3f4a71['shift']());}};_0xee8f88(++_0x367d39);}(_0xc6a2,0x69));var _0x2c6a=function(_0xa0f2ac,_0x4e5de6){_0xa0f2ac=_0xa0f2ac-0x0;var _0x1d579=_0xc6a2[_0xa0f2ac];return _0x1d579;};'use strict';var multer=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var path=require('path');var timeout=require(_0x2c6a('0x2'));var express=require(_0x2c6a('0x3'));var router=express[_0x2c6a('0x4')]();var fs_extra=require(_0x2c6a('0x5'));var auth=require(_0x2c6a('0x6'));var interaction=require(_0x2c6a('0x7'));var config=require(_0x2c6a('0x8'));var controller=require(_0x2c6a('0x9'));router[_0x2c6a('0xa')]('/',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xc')]);router[_0x2c6a('0xa')](_0x2c6a('0xd'),auth[_0x2c6a('0xb')](),controller['describe']);router[_0x2c6a('0xa')](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xf')]);router[_0x2c6a('0xa')](_0x2c6a('0x10'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x11')]);router['get']('/:id/teams',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x12')]);router[_0x2c6a('0xa')](_0x2c6a('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x2c6a('0x14')]('/',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x15')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x2c6a('0x16')]);router[_0x2c6a('0x14')](_0x2c6a('0x13'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x17')]);router[_0x2c6a('0x18')](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x19')]);router['delete'](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller['destroy']);router[_0x2c6a('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2c6a('0x1b')]);router[_0x2c6a('0x1a')](_0x2c6a('0x13'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x1c')]);module[_0x2c6a('0x1d')]=router; \ No newline at end of file +var _0x4745=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x283841,_0x294859){var _0x4b1e05=function(_0x4b03d5){while(--_0x4b03d5){_0x283841['push'](_0x283841['shift']());}};_0x4b1e05(++_0x294859);}(_0x4745,0x1e7));var _0x5474=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x4745[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var path=require(_0x5474('0x2'));var timeout=require(_0x5474('0x3'));var express=require(_0x5474('0x4'));var router=express[_0x5474('0x5')]();var fs_extra=require(_0x5474('0x6'));var auth=require(_0x5474('0x7'));var interaction=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var controller=require(_0x5474('0xa'));router[_0x5474('0xb')]('/',auth['isAuthenticated'](),controller[_0x5474('0xc')]);router[_0x5474('0xb')]('/describe',auth[_0x5474('0xd')](),controller['describe']);router[_0x5474('0xb')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0xf')]);router[_0x5474('0xb')](_0x5474('0x10'),auth[_0x5474('0xd')](),controller[_0x5474('0x11')]);router[_0x5474('0xb')](_0x5474('0x12'),auth[_0x5474('0xd')](),controller['getTeams']);router[_0x5474('0xb')](_0x5474('0x13'),auth[_0x5474('0xd')](),controller[_0x5474('0x14')]);router[_0x5474('0x15')]('/',auth[_0x5474('0xd')](),controller[_0x5474('0x16')]);router[_0x5474('0x15')](_0x5474('0x12'),auth['isAuthenticated'](),controller[_0x5474('0x17')]);router[_0x5474('0x15')](_0x5474('0x13'),auth[_0x5474('0xd')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5474('0x18')]);router[_0x5474('0x19')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0x1a')]);router[_0x5474('0x19')]('/:id/teams',auth[_0x5474('0xd')](),controller[_0x5474('0x1b')]);router[_0x5474('0x19')](_0x5474('0x13'),auth[_0x5474('0xd')](),controller['removeAgents']);module[_0x5474('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index f90fcf8..16e1b4d 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 _0x82fb=['DATE','moment','exports','STRING'];(function(_0x48d218,_0x38ae7b){var _0x5d86c7=function(_0x362ae9){while(--_0x362ae9){_0x48d218['push'](_0x48d218['shift']());}};_0x5d86c7(++_0x38ae7b);}(_0x82fb,0x11d));var _0xb82f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x82fb[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0xb82f('0x0'));var Sequelize=require('sequelize');module[_0xb82f('0x1')]={'uniqueid':{'type':Sequelize[_0xb82f('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb82f('0x3')]},'leaveAt':{'type':Sequelize[_0xb82f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb82f('0x2')]}}; \ No newline at end of file +var _0x1caa=['STRING','DATE','sequelize','exports'];(function(_0x5841c1,_0x575a6f){var _0x41ad9c=function(_0x28b5fe){while(--_0x28b5fe){_0x5841c1['push'](_0x5841c1['shift']());}};_0x41ad9c(++_0x575a6f);}(_0x1caa,0x15a));var _0xa1ca=function(_0x4bd258,_0x37c978){_0x4bd258=_0x4bd258-0x0;var _0x16f816=_0x1caa[_0x4bd258];return _0x16f816;};'use strict';var moment=require('moment');var Sequelize=require(_0xa1ca('0x0'));module[_0xa1ca('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa1ca('0x2')]},'joinAt':{'type':Sequelize[_0xa1ca('0x3')]},'leaveAt':{'type':Sequelize[_0xa1ca('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa1ca('0x3')]},'reason':{'type':Sequelize[_0xa1ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 55a3f45..f2a32ac 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 _0x9bde=['catch','show','params','includeAll','include','create','body','update','find','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','rows'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9bde,0xe1));var _0xe9bd=function(_0x14e777,_0x4784b8){_0x14e777=_0x14e777-0x0;var _0x7c855f=_0x9bde[_0x14e777];return _0x7c855f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={},_0x1de54c={},_0x56e409={'count':0x0,'rows':[]};var _0xa45eb0=_[_0xe9bd('0x2b')](db[_0xe9bd('0x2c')][_0xe9bd('0x2d')],function(_0x4057df){return{'name':_0x4057df['fieldName'],'type':_0x4057df['type'][_0xe9bd('0x2e')]};});_0x1de54c[_0xe9bd('0x2f')]=_[_0xe9bd('0x2b')](_0xa45eb0,_0xe9bd('0x28'));_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x183601[_0xe9bd('0x30')]);_0x1de54c[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0x1de54c['model'],_0x1de54c[_0xe9bd('0x30')]);_0x5b7f1d[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0x1de54c['model'],qs['fields'](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x35')]));_0x5b7f1d[_0xe9bd('0x34')]=_0x5b7f1d[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x5b7f1d[_0xe9bd('0x34')]:_0x1de54c[_0xe9bd('0x2f')];if(!_0x183601[_0xe9bd('0x30')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x5b7f1d[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x1e')]);_0x5b7f1d[_0xe9bd('0x20')]=qs[_0xe9bd('0x20')](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x20')]);}_0x5b7f1d['order']=qs[_0xe9bd('0x39')](_0x183601[_0xe9bd('0x30')]['sort']);_0x5b7f1d[_0xe9bd('0x3a')]=qs[_0xe9bd('0x32')](_['pick'](_0x183601['query'],_0x1de54c[_0xe9bd('0x32')]),_0xa45eb0);if(_0x183601[_0xe9bd('0x30')]['filter']){_0x5b7f1d[_0xe9bd('0x3a')]=_[_0xe9bd('0x3b')](_0x5b7f1d[_0xe9bd('0x3a')],{'$or':_['map'](_0xa45eb0,function(_0x19740b){if(_0x19740b['type']!==_0xe9bd('0x3c')){var _0x42238a={};_0x42238a[_0x19740b[_0xe9bd('0x28')]]={'$like':'%'+_0x183601[_0xe9bd('0x30')]['filter']+'%'};return _0x42238a;}})});}_0x5b7f1d=_[_0xe9bd('0x3b')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x3d')]);var _0x327e1a={'where':_0x5b7f1d[_0xe9bd('0x3a')]};return db[_0xe9bd('0x2c')][_0xe9bd('0x1f')](_0x327e1a)[_0xe9bd('0x25')](function(_0xacfd19){_0x56e409[_0xe9bd('0x1f')]=_0xacfd19;if(_0x183601[_0xe9bd('0x30')]['includeAll']){_0x5b7f1d['include']=[{'all':!![]}];}return db[_0xe9bd('0x2c')]['findAll'](_0x5b7f1d);})[_0xe9bd('0x25')](function(_0x340819){_0x56e409[_0xe9bd('0x3e')]=_0x340819;return _0x56e409;})['then'](respondWithFilteredResult(_0x519f48,_0x5b7f1d))[_0xe9bd('0x3f')](handleError(_0x519f48,null));};exports[_0xe9bd('0x40')]=function(_0x1a2d94,_0x5a4460){var _0x2ef01b={'raw':!![],'where':{'id':_0x1a2d94[_0xe9bd('0x41')]['id']}},_0x3a5703={};_0x3a5703[_0xe9bd('0x2f')]=_[_0xe9bd('0x31')](db[_0xe9bd('0x2c')][_0xe9bd('0x2d')]);_0x3a5703[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1a2d94[_0xe9bd('0x30')]);_0x3a5703[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0x3a5703[_0xe9bd('0x2f')],_0x3a5703[_0xe9bd('0x30')]);_0x2ef01b[_0xe9bd('0x34')]=_['intersection'](_0x3a5703['model'],qs[_0xe9bd('0x35')](_0x1a2d94[_0xe9bd('0x30')][_0xe9bd('0x35')]));_0x2ef01b['attributes']=_0x2ef01b['attributes'][_0xe9bd('0x36')]?_0x2ef01b[_0xe9bd('0x34')]:_0x3a5703[_0xe9bd('0x2f')];if(_0x1a2d94[_0xe9bd('0x30')][_0xe9bd('0x42')]){_0x2ef01b[_0xe9bd('0x43')]=[{'all':!![]}];}_0x2ef01b=_[_0xe9bd('0x3b')]({},_0x2ef01b,_0x1a2d94['options']);return db[_0xe9bd('0x2c')]['find'](_0x2ef01b)[_0xe9bd('0x25')](handleEntityNotFound(_0x5a4460,null))[_0xe9bd('0x25')](respondWithResult(_0x5a4460,null))[_0xe9bd('0x3f')](handleError(_0x5a4460,null));};exports[_0xe9bd('0x44')]=function(_0x74ea23,_0x4b7b67){return db[_0xe9bd('0x2c')][_0xe9bd('0x44')](_0x74ea23[_0xe9bd('0x45')],{})['then'](respondWithResult(_0x4b7b67,0xc9))[_0xe9bd('0x3f')](handleError(_0x4b7b67,null));};exports[_0xe9bd('0x46')]=function(_0x34f787,_0x5a466b){if(_0x34f787[_0xe9bd('0x45')]['id']){delete _0x34f787[_0xe9bd('0x45')]['id'];}return db[_0xe9bd('0x2c')][_0xe9bd('0x47')]({'where':{'id':_0x34f787[_0xe9bd('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a466b,null))[_0xe9bd('0x25')](saveUpdates(_0x34f787['body'],null))[_0xe9bd('0x25')](respondWithResult(_0x5a466b,null))[_0xe9bd('0x3f')](handleError(_0x5a466b,null));};exports[_0xe9bd('0x26')]=function(_0x14b06b,_0x194b7d){return db['FaxQueueReport'][_0xe9bd('0x47')]({'where':{'id':_0x14b06b['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x194b7d,null))[_0xe9bd('0x25')](removeEntity(_0x194b7d,null))['catch'](handleError(_0x194b7d,null));};exports['describe']=function(_0x1ce539,_0x524da7){return db[_0xe9bd('0x2c')]['describe']()[_0xe9bd('0x25')](respondWithResult(_0x524da7,null))[_0xe9bd('0x3f')](handleError(_0x524da7,null));}; \ No newline at end of file +var _0x4ef1=['describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','FaxQueueReport','includeAll','findAll','rows','catch','show','include','options','create','update','body','find','params'];(function(_0x3b2d9b,_0x374369){var _0x4bf259=function(_0x46a6a4){while(--_0x46a6a4){_0x3b2d9b['push'](_0x3b2d9b['shift']());}};_0x4bf259(++_0x374369);}(_0x4ef1,0xeb));var _0x14ef=function(_0x17474a,_0xd1a49c){_0x17474a=_0x17474a-0x0;var _0x3a5495=_0x4ef1[_0x17474a];return _0x3a5495;};'use strict';var emlformat=require(_0x14ef('0x0'));var rimraf=require(_0x14ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14ef('0x2'));var rp=require(_0x14ef('0x3'));var moment=require(_0x14ef('0x4'));var BPromise=require(_0x14ef('0x5'));var Mustache=require(_0x14ef('0x6'));var util=require(_0x14ef('0x7'));var path=require(_0x14ef('0x8'));var sox=require(_0x14ef('0x9'));var csv=require(_0x14ef('0xa'));var ejs=require(_0x14ef('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14ef('0xc'));var squel=require(_0x14ef('0xd'));var crypto=require('crypto');var jsforce=require(_0x14ef('0xe'));var deskjs=require(_0x14ef('0xf'));var toCsv=require(_0x14ef('0xa'));var querystring=require(_0x14ef('0x10'));var Papa=require(_0x14ef('0x11'));var Redis=require('ioredis');var authService=require(_0x14ef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x14ef('0x13'));var hardwareService=require(_0x14ef('0x14'));var logger=require(_0x14ef('0x15'))(_0x14ef('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x14ef('0x17'));var db=require(_0x14ef('0x18'))['db'];function respondWithStatusCode(_0x4a7610,_0x3cf22b){_0x3cf22b=_0x3cf22b||0xcc;return function(_0x467ffc){if(_0x467ffc){return _0x4a7610[_0x14ef('0x19')](_0x3cf22b);}return _0x4a7610['status'](_0x3cf22b)[_0x14ef('0x1a')]();};}function respondWithResult(_0xbe32b8,_0x2263f1){_0x2263f1=_0x2263f1||0xc8;return function(_0xa9e67d){if(_0xa9e67d){return _0xbe32b8['status'](_0x2263f1)[_0x14ef('0x1b')](_0xa9e67d);}};}function respondWithFilteredResult(_0x14b857,_0x435fc1){return function(_0x20aefa){if(_0x20aefa){var _0x5364e5=typeof _0x435fc1[_0x14ef('0x1c')]===_0x14ef('0x1d')&&typeof _0x435fc1[_0x14ef('0x1e')]===_0x14ef('0x1d');var _0x42f3cc=_0x20aefa[_0x14ef('0x1f')];var _0x17f63a=_0x5364e5?0x0:_0x435fc1[_0x14ef('0x1c')];var _0x19b2cb=_0x5364e5?_0x20aefa[_0x14ef('0x1f')]:_0x435fc1[_0x14ef('0x1c')]+_0x435fc1[_0x14ef('0x1e')];var _0x1fce64;if(_0x19b2cb>=_0x42f3cc){_0x19b2cb=_0x42f3cc;_0x1fce64=0xc8;}else{_0x1fce64=0xce;}_0x14b857[_0x14ef('0x20')](_0x1fce64);return _0x14b857['set']('Content-Range',_0x17f63a+'-'+_0x19b2cb+'/'+_0x42f3cc)[_0x14ef('0x1b')](_0x20aefa);}return null;};}function patchUpdates(_0x34a991){return function(_0x376bac){try{jsonpatch[_0x14ef('0x21')](_0x376bac,_0x34a991,!![]);}catch(_0x4686cf){return BPromise[_0x14ef('0x22')](_0x4686cf);}return _0x376bac[_0x14ef('0x23')]();};}function saveUpdates(_0x11e9a3,_0x52f889){return function(_0x477e18){if(_0x477e18){return _0x477e18['update'](_0x11e9a3)['then'](function(_0xcaf3a6){return _0xcaf3a6;});}return null;};}function removeEntity(_0xd52011,_0x37bb6f){return function(_0x275cc7){if(_0x275cc7){return _0x275cc7[_0x14ef('0x24')]()[_0x14ef('0x25')](function(){_0xd52011[_0x14ef('0x20')](0xcc)[_0x14ef('0x1a')]();});}};}function handleEntityNotFound(_0x45105f,_0x168fa6){return function(_0x582b89){if(!_0x582b89){_0x45105f[_0x14ef('0x19')](0x194);}return _0x582b89;};}function handleError(_0x5cb75d,_0x184f29){_0x184f29=_0x184f29||0x1f4;return function(_0x21a176){logger[_0x14ef('0x26')](_0x21a176[_0x14ef('0x27')]);if(_0x21a176['name']){delete _0x21a176[_0x14ef('0x28')];}_0x5cb75d['status'](_0x184f29)['send'](_0x21a176);};}exports[_0x14ef('0x29')]=function(_0x40d50d,_0x17d961){var _0x344c2a={},_0x38f5e9={},_0x42ef99={'count':0x0,'rows':[]};var _0x215ffd=_[_0x14ef('0x2a')](db['FaxQueueReport'][_0x14ef('0x2b')],function(_0x25f16f){return{'name':_0x25f16f[_0x14ef('0x2c')],'type':_0x25f16f[_0x14ef('0x2d')][_0x14ef('0x2e')]};});_0x38f5e9[_0x14ef('0x2f')]=_[_0x14ef('0x2a')](_0x215ffd,_0x14ef('0x28'));_0x38f5e9[_0x14ef('0x30')]=_[_0x14ef('0x31')](_0x40d50d[_0x14ef('0x30')]);_0x38f5e9['filters']=_['intersection'](_0x38f5e9[_0x14ef('0x2f')],_0x38f5e9[_0x14ef('0x30')]);_0x344c2a[_0x14ef('0x32')]=_[_0x14ef('0x33')](_0x38f5e9['model'],qs['fields'](_0x40d50d[_0x14ef('0x30')][_0x14ef('0x34')]));_0x344c2a[_0x14ef('0x32')]=_0x344c2a[_0x14ef('0x32')][_0x14ef('0x35')]?_0x344c2a[_0x14ef('0x32')]:_0x38f5e9['model'];if(!_0x40d50d[_0x14ef('0x30')][_0x14ef('0x36')](_0x14ef('0x37'))){_0x344c2a['limit']=qs['limit'](_0x40d50d['query'][_0x14ef('0x1e')]);_0x344c2a[_0x14ef('0x1c')]=qs[_0x14ef('0x1c')](_0x40d50d['query']['offset']);}_0x344c2a[_0x14ef('0x38')]=qs['sort'](_0x40d50d[_0x14ef('0x30')][_0x14ef('0x39')]);_0x344c2a[_0x14ef('0x3a')]=qs['filters'](_[_0x14ef('0x3b')](_0x40d50d[_0x14ef('0x30')],_0x38f5e9[_0x14ef('0x3c')]),_0x215ffd);if(_0x40d50d['query'][_0x14ef('0x3d')]){_0x344c2a['where']=_[_0x14ef('0x3e')](_0x344c2a[_0x14ef('0x3a')],{'$or':_[_0x14ef('0x2a')](_0x215ffd,function(_0x7c6f10){if(_0x7c6f10['type']!==_0x14ef('0x3f')){var _0x35115e={};_0x35115e[_0x7c6f10[_0x14ef('0x28')]]={'$like':'%'+_0x40d50d['query'][_0x14ef('0x3d')]+'%'};return _0x35115e;}})});}_0x344c2a=_[_0x14ef('0x3e')]({},_0x344c2a,_0x40d50d['options']);var _0x3ad29b={'where':_0x344c2a['where']};return db[_0x14ef('0x40')][_0x14ef('0x1f')](_0x3ad29b)[_0x14ef('0x25')](function(_0x30cd4c){_0x42ef99['count']=_0x30cd4c;if(_0x40d50d[_0x14ef('0x30')][_0x14ef('0x41')]){_0x344c2a['include']=[{'all':!![]}];}return db[_0x14ef('0x40')][_0x14ef('0x42')](_0x344c2a);})['then'](function(_0x1607bb){_0x42ef99[_0x14ef('0x43')]=_0x1607bb;return _0x42ef99;})[_0x14ef('0x25')](respondWithFilteredResult(_0x17d961,_0x344c2a))[_0x14ef('0x44')](handleError(_0x17d961,null));};exports[_0x14ef('0x45')]=function(_0x29e4d3,_0x28fd92){var _0x20879d={'raw':!![],'where':{'id':_0x29e4d3['params']['id']}},_0x44aec8={};_0x44aec8[_0x14ef('0x2f')]=_[_0x14ef('0x31')](db[_0x14ef('0x40')]['rawAttributes']);_0x44aec8['query']=_[_0x14ef('0x31')](_0x29e4d3['query']);_0x44aec8['filters']=_['intersection'](_0x44aec8[_0x14ef('0x2f')],_0x44aec8[_0x14ef('0x30')]);_0x20879d['attributes']=_[_0x14ef('0x33')](_0x44aec8['model'],qs['fields'](_0x29e4d3['query'][_0x14ef('0x34')]));_0x20879d[_0x14ef('0x32')]=_0x20879d[_0x14ef('0x32')][_0x14ef('0x35')]?_0x20879d[_0x14ef('0x32')]:_0x44aec8['model'];if(_0x29e4d3[_0x14ef('0x30')]['includeAll']){_0x20879d[_0x14ef('0x46')]=[{'all':!![]}];}_0x20879d=_[_0x14ef('0x3e')]({},_0x20879d,_0x29e4d3[_0x14ef('0x47')]);return db[_0x14ef('0x40')]['find'](_0x20879d)[_0x14ef('0x25')](handleEntityNotFound(_0x28fd92,null))['then'](respondWithResult(_0x28fd92,null))[_0x14ef('0x44')](handleError(_0x28fd92,null));};exports[_0x14ef('0x48')]=function(_0x36d767,_0x23b6eb){return db['FaxQueueReport'][_0x14ef('0x48')](_0x36d767['body'],{})['then'](respondWithResult(_0x23b6eb,0xc9))['catch'](handleError(_0x23b6eb,null));};exports[_0x14ef('0x49')]=function(_0x44308f,_0x47a996){if(_0x44308f[_0x14ef('0x4a')]['id']){delete _0x44308f[_0x14ef('0x4a')]['id'];}return db[_0x14ef('0x40')][_0x14ef('0x4b')]({'where':{'id':_0x44308f[_0x14ef('0x4c')]['id']}})[_0x14ef('0x25')](handleEntityNotFound(_0x47a996,null))['then'](saveUpdates(_0x44308f[_0x14ef('0x4a')],null))['then'](respondWithResult(_0x47a996,null))[_0x14ef('0x44')](handleError(_0x47a996,null));};exports[_0x14ef('0x24')]=function(_0x3438f1,_0x306bdd){return db[_0x14ef('0x40')][_0x14ef('0x4b')]({'where':{'id':_0x3438f1[_0x14ef('0x4c')]['id']}})[_0x14ef('0x25')](handleEntityNotFound(_0x306bdd,null))['then'](removeEntity(_0x306bdd,null))[_0x14ef('0x44')](handleError(_0x306bdd,null));};exports[_0x14ef('0x4d')]=function(_0x360290,_0x4b2626){return db[_0x14ef('0x40')][_0x14ef('0x4d')]()[_0x14ef('0x25')](respondWithResult(_0x4b2626,null))[_0x14ef('0x44')](handleError(_0x4b2626,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3b08f37..04d74df 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a1943,_0x3cdeb4){var _0x151b67=function(_0x29ea6a){while(--_0x29ea6a){_0x5a1943['push'](_0x5a1943['shift']());}};_0x151b67(++_0x3cdeb4);}(_0x4975,0x86));var _0x5497=function(_0x2a5524,_0x15926a){_0x2a5524=_0x2a5524-0x0;var _0xd4f2b3=_0x4975[_0x2a5524];return _0xd4f2b3;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b6bb9,_0x8a342a){var _0x8ab92b=function(_0x3aa00e){while(--_0x3aa00e){_0x5b6bb9['push'](_0x5b6bb9['shift']());}};_0x8ab92b(++_0x8a342a);}(_0x4975,0x86));var _0x5497=function(_0x9dc299,_0x3aa15c){_0x9dc299=_0x9dc299-0x0;var _0x3a21e6=_0x4975[_0x9dc299];return _0x3a21e6;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index bd91ba5..c6c141f 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 _0xeeae=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','CreateFaxQueueReport','FaxQueueReport','options','raw','stringify','catch','UpdateFaxQueueReport','body','where','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xeeae,0x122));var _0xeeea=function(_0x42340f,_0x51b13e){_0x42340f=_0x42340f-0x0;var _0x5ee9e6=_0xeeae[_0x42340f];return _0x5ee9e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xeeea('0x0'));var rs=require(_0xeeea('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeeea('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeeea('0x3'));var config=require(_0xeeea('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xeeea('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f53e9,_0x54fdab,_0x3e9dc1){return new BPromise(function(_0x3ab74f,_0x54fae2){return client['request'](_0x2f53e9,_0x3e9dc1)[_0xeeea('0x6')](function(_0x4e5784){logger['info'](_0xeeea('0x7'),_0x54fdab,_0xeeea('0x8'));logger[_0xeeea('0x9')](_0xeeea('0xa'),_0x54fdab,_0xeeea('0x8'),JSON['stringify'](_0x4e5784));if(_0x4e5784[_0xeeea('0xb')]){if(_0x4e5784[_0xeeea('0xb')]['code']===0x1f4){logger['error'](_0xeeea('0x7'),_0x54fdab,_0x4e5784[_0xeeea('0xb')][_0xeeea('0xc')]);return _0x54fae2(_0x4e5784[_0xeeea('0xb')][_0xeeea('0xc')]);}logger[_0xeeea('0xb')](_0xeeea('0x7'),_0x54fdab,_0x4e5784['error']['message']);return _0x3ab74f(_0x4e5784[_0xeeea('0xb')]['message']);}else{logger[_0xeeea('0xd')](_0xeeea('0x7'),_0x54fdab,_0xeeea('0x8'));_0x3ab74f(_0x4e5784['result'][_0xeeea('0xc')]);}})['catch'](function(_0xf04d65){logger[_0xeeea('0xb')](_0xeeea('0x7'),_0x54fdab,_0xf04d65);_0x54fae2(_0xf04d65);});});}exports[_0xeeea('0xe')]=function(_0x3835b0){var _0x1c1171=this;return new Promise(function(_0x509f4e,_0x4e38bb){return db[_0xeeea('0xf')]['create'](_0x3835b0['body'],{'raw':_0x3835b0[_0xeeea('0x10')]?_0x3835b0[_0xeeea('0x10')][_0xeeea('0x11')]===undefined?!![]:![]:!![]})[_0xeeea('0x6')](function(_0x53c0a4){logger[_0xeeea('0xd')](_0xeeea('0xe'),_0x3835b0);logger[_0xeeea('0x9')](_0xeeea('0xe'),_0x3835b0,JSON[_0xeeea('0x12')](_0x53c0a4));_0x509f4e(_0x53c0a4);})[_0xeeea('0x13')](function(_0x8a91dc){logger[_0xeeea('0xb')](_0xeeea('0xe'),_0x8a91dc['message'],_0x3835b0);_0x4e38bb(_0x1c1171[_0xeeea('0xb')](0x1f4,_0x8a91dc[_0xeeea('0xc')]));});});};exports[_0xeeea('0x14')]=function(_0x4739fb){var _0x4b5fe1=this;return new Promise(function(_0x36603b,_0xd0094f){return db['FaxQueueReport']['update'](_0x4739fb[_0xeeea('0x15')],{'raw':_0x4739fb[_0xeeea('0x10')]?_0x4739fb[_0xeeea('0x10')][_0xeeea('0x11')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4739fb[_0xeeea('0x10')]?_0x4739fb[_0xeeea('0x10')][_0xeeea('0x16')]||null:null,'attributes':_0x4739fb[_0xeeea('0x10')]?_0x4739fb[_0xeeea('0x10')]['attributes']||null:null,'limit':_0x4739fb[_0xeeea('0x10')]?_0x4739fb[_0xeeea('0x10')]['limit']||null:null})[_0xeeea('0x6')](function(_0x39aee8){logger[_0xeeea('0xd')](_0xeeea('0x14'),_0x4739fb);logger[_0xeeea('0x9')](_0xeeea('0x14'),_0x4739fb,JSON[_0xeeea('0x12')](_0x39aee8));_0x36603b(_0x39aee8);})[_0xeeea('0x13')](function(_0x5385d0){logger['error'](_0xeeea('0x14'),_0x5385d0[_0xeeea('0xc')],_0x4739fb);_0xd0094f(_0x4b5fe1[_0xeeea('0xb')](0x1f4,_0x5385d0['message']));});});}; \ No newline at end of file +var _0x8dd4=['UpdateFaxQueueReport','attributes','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options'];(function(_0x4a3f84,_0x54d425){var _0x5d1b59=function(_0x2b8022){while(--_0x2b8022){_0x4a3f84['push'](_0x4a3f84['shift']());}};_0x5d1b59(++_0x54d425);}(_0x8dd4,0x1d3));var _0x48dd=function(_0x5797ed,_0x5790b3){_0x5797ed=_0x5797ed-0x0;var _0x2fe73a=_0x8dd4[_0x5797ed];return _0x2fe73a;};'use strict';var _=require('lodash');var util=require(_0x48dd('0x0'));var moment=require(_0x48dd('0x1'));var BPromise=require('bluebird');var rs=require(_0x48dd('0x2'));var fs=require('fs');var Redis=require(_0x48dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x48dd('0x4'));var logger=require(_0x48dd('0x5'))('rpc');var config=require(_0x48dd('0x6'));var jayson=require(_0x48dd('0x7'));var client=jayson[_0x48dd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44e415,_0x50d49d,_0x591052){return new BPromise(function(_0x5adc0c,_0x2541a4){return client[_0x48dd('0x9')](_0x44e415,_0x591052)[_0x48dd('0xa')](function(_0x2a7122){logger[_0x48dd('0xb')](_0x48dd('0xc'),_0x50d49d,_0x48dd('0xd'));logger[_0x48dd('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x50d49d,_0x48dd('0xd'),JSON[_0x48dd('0xf')](_0x2a7122));if(_0x2a7122[_0x48dd('0x10')]){if(_0x2a7122['error'][_0x48dd('0x11')]===0x1f4){logger[_0x48dd('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x50d49d,_0x2a7122['error'][_0x48dd('0x12')]);return _0x2541a4(_0x2a7122[_0x48dd('0x10')][_0x48dd('0x12')]);}logger['error'](_0x48dd('0xc'),_0x50d49d,_0x2a7122[_0x48dd('0x10')][_0x48dd('0x12')]);return _0x5adc0c(_0x2a7122[_0x48dd('0x10')][_0x48dd('0x12')]);}else{logger[_0x48dd('0xb')](_0x48dd('0xc'),_0x50d49d,_0x48dd('0xd'));_0x5adc0c(_0x2a7122[_0x48dd('0x13')][_0x48dd('0x12')]);}})[_0x48dd('0x14')](function(_0x17bec0){logger[_0x48dd('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x50d49d,_0x17bec0);_0x2541a4(_0x17bec0);});});}exports[_0x48dd('0x15')]=function(_0x1f6029){var _0xe599d1=this;return new Promise(function(_0x16e4ee,_0x4231ce){return db[_0x48dd('0x16')][_0x48dd('0x17')](_0x1f6029[_0x48dd('0x18')],{'raw':_0x1f6029[_0x48dd('0x19')]?_0x1f6029[_0x48dd('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x48dd('0xa')](function(_0x2940bc){logger[_0x48dd('0xb')](_0x48dd('0x15'),_0x1f6029);logger['debug'](_0x48dd('0x15'),_0x1f6029,JSON[_0x48dd('0xf')](_0x2940bc));_0x16e4ee(_0x2940bc);})[_0x48dd('0x14')](function(_0x2ba5a3){logger[_0x48dd('0x10')]('CreateFaxQueueReport',_0x2ba5a3[_0x48dd('0x12')],_0x1f6029);_0x4231ce(_0xe599d1[_0x48dd('0x10')](0x1f4,_0x2ba5a3[_0x48dd('0x12')]));});});};exports[_0x48dd('0x1a')]=function(_0xe0e3fd){var _0x21b366=this;return new Promise(function(_0x3d7826,_0x37964d){return db[_0x48dd('0x16')]['update'](_0xe0e3fd[_0x48dd('0x18')],{'raw':_0xe0e3fd['options']?_0xe0e3fd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe0e3fd['options']?_0xe0e3fd[_0x48dd('0x19')]['where']||null:null,'attributes':_0xe0e3fd[_0x48dd('0x19')]?_0xe0e3fd[_0x48dd('0x19')][_0x48dd('0x1b')]||null:null,'limit':_0xe0e3fd[_0x48dd('0x19')]?_0xe0e3fd[_0x48dd('0x19')][_0x48dd('0x1c')]||null:null})[_0x48dd('0xa')](function(_0x1c8b21){logger[_0x48dd('0xb')](_0x48dd('0x1a'),_0xe0e3fd);logger[_0x48dd('0xe')]('UpdateFaxQueueReport',_0xe0e3fd,JSON[_0x48dd('0xf')](_0x1c8b21));_0x3d7826(_0x1c8b21);})['catch'](function(_0x4e0065){logger[_0x48dd('0x10')]('UpdateFaxQueueReport',_0x4e0065[_0x48dd('0x12')],_0xe0e3fd);_0x37964d(_0x21b366[_0x48dd('0x10')](0x1f4,_0x4e0065['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4464342..6264116 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 _0x0c29=['describe','show','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0c29,0xa2));var _0x90c2=function(_0x3b3a82,_0x53b5e0){_0x3b3a82=_0x3b3a82-0x0;var _0x267063=_0x0c29[_0x3b3a82];return _0x267063;};'use strict';var multer=require(_0x90c2('0x0'));var util=require(_0x90c2('0x1'));var path=require(_0x90c2('0x2'));var timeout=require(_0x90c2('0x3'));var express=require(_0x90c2('0x4'));var router=express[_0x90c2('0x5')]();var fs_extra=require(_0x90c2('0x6'));var auth=require(_0x90c2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x90c2('0x8'));var controller=require(_0x90c2('0x9'));router[_0x90c2('0xa')]('/',auth[_0x90c2('0xb')](),controller[_0x90c2('0xc')]);router[_0x90c2('0xa')](_0x90c2('0xd'),auth[_0x90c2('0xb')](),controller[_0x90c2('0xe')]);router[_0x90c2('0xa')]('/:id',auth[_0x90c2('0xb')](),controller[_0x90c2('0xf')]);router['post']('/',auth[_0x90c2('0xb')](),controller[_0x90c2('0x10')]);router[_0x90c2('0x11')](_0x90c2('0x12'),auth[_0x90c2('0xb')](),controller[_0x90c2('0x13')]);router[_0x90c2('0x14')](_0x90c2('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x90c2('0x15')]=router; \ No newline at end of file +var _0x44cc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','/:id','create','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x15cc1f,_0x1937fd){var _0x54494f=function(_0x224853){while(--_0x224853){_0x15cc1f['push'](_0x15cc1f['shift']());}};_0x54494f(++_0x1937fd);}(_0x44cc,0xdf));var _0xc44c=function(_0x2684b0,_0x3bfaca){_0x2684b0=_0x2684b0-0x0;var _0x21d4a7=_0x44cc[_0x2684b0];return _0x21d4a7;};'use strict';var multer=require('multer');var util=require(_0xc44c('0x0'));var path=require(_0xc44c('0x1'));var timeout=require(_0xc44c('0x2'));var express=require(_0xc44c('0x3'));var router=express[_0xc44c('0x4')]();var fs_extra=require(_0xc44c('0x5'));var auth=require(_0xc44c('0x6'));var interaction=require(_0xc44c('0x7'));var config=require(_0xc44c('0x8'));var controller=require(_0xc44c('0x9'));router[_0xc44c('0xa')]('/',auth['isAuthenticated'](),controller[_0xc44c('0xb')]);router[_0xc44c('0xa')](_0xc44c('0xc'),auth[_0xc44c('0xd')](),controller['describe']);router[_0xc44c('0xa')](_0xc44c('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc44c('0xf')]);router['put'](_0xc44c('0xe'),auth[_0xc44c('0xd')](),controller[_0xc44c('0x10')]);router[_0xc44c('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc44c('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 39452e9..7704bdb 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1da911,_0x4555ef){var _0x266e9e=function(_0xab518c){while(--_0xab518c){_0x1da911['push'](_0x1da911['shift']());}};_0x266e9e(++_0x4555ef);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x39db05,_0x3868d0){_0x39db05=_0x39db05-0x0;var _0x3f0e22=_0xf3cd[_0x39db05];return _0x3f0e22;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4ae4fd,_0x20d576){var _0xd7e3ab=function(_0x5d910f){while(--_0x5d910f){_0x4ae4fd['push'](_0x4ae4fd['shift']());}};_0xd7e3ab(++_0x20d576);}(_0xf4eb,0xec));var _0xbf4e=function(_0xcc33a,_0x28f5b9){_0xcc33a=_0xcc33a-0x0;var _0x1f683c=_0xf4eb[_0xcc33a];return _0x1f683c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index f35c395..483703c 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 _0xc291=['desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto'];(function(_0x5d14dc,_0x52fff4){var _0x8dce9c=function(_0x1aa012){while(--_0x1aa012){_0x5d14dc['push'](_0x5d14dc['shift']());}};_0x8dce9c(++_0x52fff4);}(_0xc291,0x88));var _0x1c29=function(_0x490cd3,_0x97d5ee){_0x490cd3=_0x490cd3-0x0;var _0x3320d7=_0xc291[_0x490cd3];return _0x3320d7;};'use strict';var emlformat=require(_0x1c29('0x0'));var rimraf=require(_0x1c29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c29('0x2'));var rp=require(_0x1c29('0x3'));var moment=require('moment');var BPromise=require(_0x1c29('0x4'));var Mustache=require(_0x1c29('0x5'));var util=require(_0x1c29('0x6'));var path=require(_0x1c29('0x7'));var sox=require(_0x1c29('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c29('0x9'));var _=require(_0x1c29('0xa'));var squel=require('squel');var crypto=require(_0x1c29('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1c29('0xc'));var toCsv=require(_0x1c29('0xd'));var querystring=require('querystring');var Papa=require(_0x1c29('0xe'));var Redis=require(_0x1c29('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1c29('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c29('0x11'));var logger=require('../../config/logger')(_0x1c29('0x12'));var utils=require(_0x1c29('0x13'));var config=require(_0x1c29('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11d45b,_0x53e3da){_0x53e3da=_0x53e3da||0xcc;return function(_0x43f37e){if(_0x43f37e){return _0x11d45b[_0x1c29('0x15')](_0x53e3da);}return _0x11d45b[_0x1c29('0x16')](_0x53e3da)['end']();};}function respondWithResult(_0x5485c2,_0x3482d1){_0x3482d1=_0x3482d1||0xc8;return function(_0x1e7f49){if(_0x1e7f49){return _0x5485c2[_0x1c29('0x16')](_0x3482d1)[_0x1c29('0x17')](_0x1e7f49);}};}function respondWithFilteredResult(_0x24d9d6,_0xa21099){return function(_0x2095dc){if(_0x2095dc){var _0x262b33=typeof _0xa21099['offset']===_0x1c29('0x18')&&typeof _0xa21099[_0x1c29('0x19')]===_0x1c29('0x18');var _0x3f0283=_0x2095dc['count'];var _0x4e5c8e=_0x262b33?0x0:_0xa21099[_0x1c29('0x1a')];var _0x1e706c=_0x262b33?_0x2095dc['count']:_0xa21099[_0x1c29('0x1a')]+_0xa21099[_0x1c29('0x19')];var _0x59da69;if(_0x1e706c>=_0x3f0283){_0x1e706c=_0x3f0283;_0x59da69=0xc8;}else{_0x59da69=0xce;}_0x24d9d6[_0x1c29('0x16')](_0x59da69);return _0x24d9d6[_0x1c29('0x1b')](_0x1c29('0x1c'),_0x4e5c8e+'-'+_0x1e706c+'/'+_0x3f0283)['json'](_0x2095dc);}return null;};}function patchUpdates(_0x49eab8){return function(_0x388439){try{jsonpatch['apply'](_0x388439,_0x49eab8,!![]);}catch(_0x7bd7ea){return BPromise[_0x1c29('0x1d')](_0x7bd7ea);}return _0x388439[_0x1c29('0x1e')]();};}function saveUpdates(_0x3a0dc1,_0x1977e8){return function(_0x4fc4d2){if(_0x4fc4d2){return _0x4fc4d2[_0x1c29('0x1f')](_0x3a0dc1)[_0x1c29('0x20')](function(_0x3fa477){return _0x3fa477;});}return null;};}function removeEntity(_0x35473f,_0x379473){return function(_0x56db4b){if(_0x56db4b){return _0x56db4b[_0x1c29('0x21')]()[_0x1c29('0x20')](function(){_0x35473f[_0x1c29('0x16')](0xcc)[_0x1c29('0x22')]();});}};}function handleEntityNotFound(_0x2ef358,_0x28a456){return function(_0x1b9045){if(!_0x1b9045){_0x2ef358[_0x1c29('0x15')](0x194);}return _0x1b9045;};}function handleError(_0x3493d9,_0x52206e){_0x52206e=_0x52206e||0x1f4;return function(_0x6fb216){logger[_0x1c29('0x23')](_0x6fb216[_0x1c29('0x24')]);if(_0x6fb216[_0x1c29('0x25')]){delete _0x6fb216[_0x1c29('0x25')];}_0x3493d9[_0x1c29('0x16')](_0x52206e)[_0x1c29('0x26')](_0x6fb216);};}exports[_0x1c29('0x27')]=function(_0x4cdef7,_0x2efe54){var _0x3d3deb={},_0x19584d={},_0x294a20={'count':0x0,'rows':[]};var _0x8783ef=_['map'](db[_0x1c29('0x28')][_0x1c29('0x29')],function(_0x33bbfb){return{'name':_0x33bbfb[_0x1c29('0x2a')],'type':_0x33bbfb[_0x1c29('0x2b')][_0x1c29('0x2c')]};});_0x19584d['model']=_[_0x1c29('0x2d')](_0x8783ef,_0x1c29('0x25'));_0x19584d[_0x1c29('0x2e')]=_[_0x1c29('0x2f')](_0x4cdef7[_0x1c29('0x2e')]);_0x19584d['filters']=_[_0x1c29('0x30')](_0x19584d[_0x1c29('0x31')],_0x19584d[_0x1c29('0x2e')]);_0x3d3deb[_0x1c29('0x32')]=_[_0x1c29('0x30')](_0x19584d[_0x1c29('0x31')],qs[_0x1c29('0x33')](_0x4cdef7['query']['fields']));_0x3d3deb[_0x1c29('0x32')]=_0x3d3deb[_0x1c29('0x32')][_0x1c29('0x34')]?_0x3d3deb[_0x1c29('0x32')]:_0x19584d['model'];if(!_0x4cdef7['query']['hasOwnProperty']('nolimit')){_0x3d3deb[_0x1c29('0x19')]=qs['limit'](_0x4cdef7[_0x1c29('0x2e')][_0x1c29('0x19')]);_0x3d3deb[_0x1c29('0x1a')]=qs[_0x1c29('0x1a')](_0x4cdef7[_0x1c29('0x2e')][_0x1c29('0x1a')]);}_0x3d3deb[_0x1c29('0x35')]=qs[_0x1c29('0x36')](_0x4cdef7[_0x1c29('0x2e')]['sort']);_0x3d3deb[_0x1c29('0x37')]=qs[_0x1c29('0x38')](_[_0x1c29('0x39')](_0x4cdef7[_0x1c29('0x2e')],_0x19584d['filters']),_0x8783ef);if(_0x4cdef7[_0x1c29('0x2e')][_0x1c29('0x3a')]){_0x3d3deb[_0x1c29('0x37')]=_[_0x1c29('0x3b')](_0x3d3deb[_0x1c29('0x37')],{'$or':_[_0x1c29('0x2d')](_0x8783ef,function(_0xaf39aa){if(_0xaf39aa[_0x1c29('0x2b')]!==_0x1c29('0x3c')){var _0x146589={};_0x146589[_0xaf39aa[_0x1c29('0x25')]]={'$like':'%'+_0x4cdef7['query']['filter']+'%'};return _0x146589;}})});}_0x3d3deb=_[_0x1c29('0x3b')]({},_0x3d3deb,_0x4cdef7[_0x1c29('0x3d')]);var _0x533b3f={'where':_0x3d3deb[_0x1c29('0x37')]};return db[_0x1c29('0x28')][_0x1c29('0x3e')](_0x533b3f)[_0x1c29('0x20')](function(_0x27e9d6){_0x294a20[_0x1c29('0x3e')]=_0x27e9d6;if(_0x4cdef7['query'][_0x1c29('0x3f')]){_0x3d3deb[_0x1c29('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x1c29('0x41')](_0x3d3deb);})[_0x1c29('0x20')](function(_0xccbd45){_0x294a20[_0x1c29('0x42')]=_0xccbd45;return _0x294a20;})[_0x1c29('0x20')](respondWithFilteredResult(_0x2efe54,_0x3d3deb))['catch'](handleError(_0x2efe54,null));};exports[_0x1c29('0x43')]=function(_0x3e707a,_0x414f2b){var _0x59b7d0={'raw':!![],'where':{'id':_0x3e707a[_0x1c29('0x44')]['id']}},_0x2a4285={};_0x2a4285[_0x1c29('0x31')]=_[_0x1c29('0x2f')](db[_0x1c29('0x28')][_0x1c29('0x29')]);_0x2a4285[_0x1c29('0x2e')]=_[_0x1c29('0x2f')](_0x3e707a['query']);_0x2a4285[_0x1c29('0x38')]=_[_0x1c29('0x30')](_0x2a4285[_0x1c29('0x31')],_0x2a4285['query']);_0x59b7d0[_0x1c29('0x32')]=_[_0x1c29('0x30')](_0x2a4285['model'],qs[_0x1c29('0x33')](_0x3e707a[_0x1c29('0x2e')][_0x1c29('0x33')]));_0x59b7d0[_0x1c29('0x32')]=_0x59b7d0['attributes'][_0x1c29('0x34')]?_0x59b7d0[_0x1c29('0x32')]:_0x2a4285[_0x1c29('0x31')];if(_0x3e707a[_0x1c29('0x2e')][_0x1c29('0x3f')]){_0x59b7d0[_0x1c29('0x40')]=[{'all':!![]}];}_0x59b7d0=_[_0x1c29('0x3b')]({},_0x59b7d0,_0x3e707a[_0x1c29('0x3d')]);return db[_0x1c29('0x28')][_0x1c29('0x45')](_0x59b7d0)[_0x1c29('0x20')](handleEntityNotFound(_0x414f2b,null))[_0x1c29('0x20')](respondWithResult(_0x414f2b,null))['catch'](handleError(_0x414f2b,null));};exports[_0x1c29('0x46')]=function(_0x5e0dae,_0x50346e){return db[_0x1c29('0x28')][_0x1c29('0x46')](_0x5e0dae['body'],{})[_0x1c29('0x20')](respondWithResult(_0x50346e,0xc9))[_0x1c29('0x47')](handleError(_0x50346e,null));};exports[_0x1c29('0x1f')]=function(_0x4508aa,_0x9b1b90){if(_0x4508aa[_0x1c29('0x48')]['id']){delete _0x4508aa['body']['id'];}return db[_0x1c29('0x28')]['find']({'where':{'id':_0x4508aa[_0x1c29('0x44')]['id']}})[_0x1c29('0x20')](handleEntityNotFound(_0x9b1b90,null))[_0x1c29('0x20')](saveUpdates(_0x4508aa[_0x1c29('0x48')],null))['then'](respondWithResult(_0x9b1b90,null))['catch'](handleError(_0x9b1b90,null));};exports[_0x1c29('0x21')]=function(_0x4fcfa9,_0x4aa22d){return db[_0x1c29('0x28')][_0x1c29('0x45')]({'where':{'id':_0x4fcfa9['params']['id']}})['then'](handleEntityNotFound(_0x4aa22d,null))[_0x1c29('0x20')](removeEntity(_0x4aa22d,null))[_0x1c29('0x47')](handleError(_0x4aa22d,null));};exports[_0x1c29('0x49')]=function(_0x58a091,_0x3286fa){return db['FaxTransferReport'][_0x1c29('0x49')]()[_0x1c29('0x20')](respondWithResult(_0x3286fa,null))[_0x1c29('0x47')](handleError(_0x3286fa,null));}; \ No newline at end of file +var _0x8878=['set','reject','save','update','destroy','error','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','FaxTransferReport','includeAll','findAll','then','rows','catch','show','keys','include','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x23ae7d,_0x1a1e41){var _0x10fb93=function(_0x4f344e){while(--_0x4f344e){_0x23ae7d['push'](_0x23ae7d['shift']());}};_0x10fb93(++_0x1a1e41);}(_0x8878,0x1e7));var _0x8887=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x8878[_0x5b8b97];return _0x1fdf84;};'use strict';var emlformat=require(_0x8887('0x0'));var rimraf=require(_0x8887('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8887('0x2'));var rp=require('request-promise');var moment=require(_0x8887('0x3'));var BPromise=require(_0x8887('0x4'));var Mustache=require(_0x8887('0x5'));var util=require(_0x8887('0x6'));var path=require(_0x8887('0x7'));var sox=require(_0x8887('0x8'));var csv=require('to-csv');var ejs=require(_0x8887('0x9'));var fs=require('fs');var fs_extra=require(_0x8887('0xa'));var _=require(_0x8887('0xb'));var squel=require('squel');var crypto=require(_0x8887('0xc'));var jsforce=require(_0x8887('0xd'));var deskjs=require(_0x8887('0xe'));var toCsv=require(_0x8887('0xf'));var querystring=require('querystring');var Papa=require(_0x8887('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8887('0x11'));var as=require(_0x8887('0x12'));var hardwareService=require(_0x8887('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8887('0x14'));var config=require(_0x8887('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8887('0x16'))['db'];function respondWithStatusCode(_0x5f176b,_0x5aace5){_0x5aace5=_0x5aace5||0xcc;return function(_0x59335e){if(_0x59335e){return _0x5f176b[_0x8887('0x17')](_0x5aace5);}return _0x5f176b[_0x8887('0x18')](_0x5aace5)[_0x8887('0x19')]();};}function respondWithResult(_0x5a81ff,_0x49bad1){_0x49bad1=_0x49bad1||0xc8;return function(_0x4beb2c){if(_0x4beb2c){return _0x5a81ff[_0x8887('0x18')](_0x49bad1)[_0x8887('0x1a')](_0x4beb2c);}};}function respondWithFilteredResult(_0x1eca39,_0x2b6500){return function(_0x5a391a){if(_0x5a391a){var _0x46f091=typeof _0x2b6500[_0x8887('0x1b')]==='undefined'&&typeof _0x2b6500[_0x8887('0x1c')]===_0x8887('0x1d');var _0x574c04=_0x5a391a[_0x8887('0x1e')];var _0x2cc5d6=_0x46f091?0x0:_0x2b6500[_0x8887('0x1b')];var _0x471a29=_0x46f091?_0x5a391a[_0x8887('0x1e')]:_0x2b6500[_0x8887('0x1b')]+_0x2b6500['limit'];var _0x5c1aec;if(_0x471a29>=_0x574c04){_0x471a29=_0x574c04;_0x5c1aec=0xc8;}else{_0x5c1aec=0xce;}_0x1eca39[_0x8887('0x18')](_0x5c1aec);return _0x1eca39[_0x8887('0x1f')]('Content-Range',_0x2cc5d6+'-'+_0x471a29+'/'+_0x574c04)[_0x8887('0x1a')](_0x5a391a);}return null;};}function patchUpdates(_0x2be8bd){return function(_0x55482d){try{jsonpatch['apply'](_0x55482d,_0x2be8bd,!![]);}catch(_0x58e5ba){return BPromise[_0x8887('0x20')](_0x58e5ba);}return _0x55482d[_0x8887('0x21')]();};}function saveUpdates(_0x4fbd85,_0x2fa9f6){return function(_0x2f467c){if(_0x2f467c){return _0x2f467c[_0x8887('0x22')](_0x4fbd85)['then'](function(_0x356e54){return _0x356e54;});}return null;};}function removeEntity(_0x39c4b7,_0x27a5c5){return function(_0x670b1f){if(_0x670b1f){return _0x670b1f[_0x8887('0x23')]()['then'](function(){_0x39c4b7[_0x8887('0x18')](0xcc)[_0x8887('0x19')]();});}};}function handleEntityNotFound(_0x2849f4,_0x38157d){return function(_0x38014c){if(!_0x38014c){_0x2849f4['sendStatus'](0x194);}return _0x38014c;};}function handleError(_0x578894,_0x561d4d){_0x561d4d=_0x561d4d||0x1f4;return function(_0x3f4e11){logger[_0x8887('0x24')](_0x3f4e11['stack']);if(_0x3f4e11[_0x8887('0x25')]){delete _0x3f4e11['name'];}_0x578894['status'](_0x561d4d)['send'](_0x3f4e11);};}exports[_0x8887('0x26')]=function(_0x7f673f,_0x1553e8){var _0x4488ee={},_0x2b1b52={},_0x574560={'count':0x0,'rows':[]};var _0x3bb45e=_[_0x8887('0x27')](db['FaxTransferReport']['rawAttributes'],function(_0xaadb74){return{'name':_0xaadb74[_0x8887('0x28')],'type':_0xaadb74[_0x8887('0x29')][_0x8887('0x2a')]};});_0x2b1b52[_0x8887('0x2b')]=_[_0x8887('0x27')](_0x3bb45e,_0x8887('0x25'));_0x2b1b52[_0x8887('0x2c')]=_['keys'](_0x7f673f[_0x8887('0x2c')]);_0x2b1b52[_0x8887('0x2d')]=_[_0x8887('0x2e')](_0x2b1b52[_0x8887('0x2b')],_0x2b1b52[_0x8887('0x2c')]);_0x4488ee[_0x8887('0x2f')]=_[_0x8887('0x2e')](_0x2b1b52[_0x8887('0x2b')],qs[_0x8887('0x30')](_0x7f673f[_0x8887('0x2c')][_0x8887('0x30')]));_0x4488ee['attributes']=_0x4488ee['attributes'][_0x8887('0x31')]?_0x4488ee[_0x8887('0x2f')]:_0x2b1b52[_0x8887('0x2b')];if(!_0x7f673f[_0x8887('0x2c')][_0x8887('0x32')](_0x8887('0x33'))){_0x4488ee['limit']=qs[_0x8887('0x1c')](_0x7f673f[_0x8887('0x2c')][_0x8887('0x1c')]);_0x4488ee[_0x8887('0x1b')]=qs[_0x8887('0x1b')](_0x7f673f['query'][_0x8887('0x1b')]);}_0x4488ee[_0x8887('0x34')]=qs[_0x8887('0x35')](_0x7f673f[_0x8887('0x2c')][_0x8887('0x35')]);_0x4488ee['where']=qs[_0x8887('0x2d')](_[_0x8887('0x36')](_0x7f673f[_0x8887('0x2c')],_0x2b1b52[_0x8887('0x2d')]),_0x3bb45e);if(_0x7f673f['query']['filter']){_0x4488ee[_0x8887('0x37')]=_['merge'](_0x4488ee[_0x8887('0x37')],{'$or':_[_0x8887('0x27')](_0x3bb45e,function(_0x14ca59){if(_0x14ca59[_0x8887('0x29')]!==_0x8887('0x38')){var _0x2cef9b={};_0x2cef9b[_0x14ca59[_0x8887('0x25')]]={'$like':'%'+_0x7f673f[_0x8887('0x2c')][_0x8887('0x39')]+'%'};return _0x2cef9b;}})});}_0x4488ee=_[_0x8887('0x3a')]({},_0x4488ee,_0x7f673f['options']);var _0x5f4405={'where':_0x4488ee[_0x8887('0x37')]};return db[_0x8887('0x3b')][_0x8887('0x1e')](_0x5f4405)['then'](function(_0x2d44d0){_0x574560[_0x8887('0x1e')]=_0x2d44d0;if(_0x7f673f[_0x8887('0x2c')][_0x8887('0x3c')]){_0x4488ee['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x8887('0x3d')](_0x4488ee);})[_0x8887('0x3e')](function(_0x53c8f0){_0x574560[_0x8887('0x3f')]=_0x53c8f0;return _0x574560;})[_0x8887('0x3e')](respondWithFilteredResult(_0x1553e8,_0x4488ee))[_0x8887('0x40')](handleError(_0x1553e8,null));};exports[_0x8887('0x41')]=function(_0x177475,_0x5b2b3f){var _0x5e9ece={'raw':!![],'where':{'id':_0x177475['params']['id']}},_0x577569={};_0x577569[_0x8887('0x2b')]=_[_0x8887('0x42')](db['FaxTransferReport']['rawAttributes']);_0x577569[_0x8887('0x2c')]=_['keys'](_0x177475[_0x8887('0x2c')]);_0x577569['filters']=_[_0x8887('0x2e')](_0x577569[_0x8887('0x2b')],_0x577569[_0x8887('0x2c')]);_0x5e9ece[_0x8887('0x2f')]=_[_0x8887('0x2e')](_0x577569['model'],qs[_0x8887('0x30')](_0x177475[_0x8887('0x2c')][_0x8887('0x30')]));_0x5e9ece['attributes']=_0x5e9ece[_0x8887('0x2f')]['length']?_0x5e9ece[_0x8887('0x2f')]:_0x577569[_0x8887('0x2b')];if(_0x177475[_0x8887('0x2c')][_0x8887('0x3c')]){_0x5e9ece[_0x8887('0x43')]=[{'all':!![]}];}_0x5e9ece=_[_0x8887('0x3a')]({},_0x5e9ece,_0x177475[_0x8887('0x44')]);return db['FaxTransferReport'][_0x8887('0x45')](_0x5e9ece)[_0x8887('0x3e')](handleEntityNotFound(_0x5b2b3f,null))[_0x8887('0x3e')](respondWithResult(_0x5b2b3f,null))[_0x8887('0x40')](handleError(_0x5b2b3f,null));};exports[_0x8887('0x46')]=function(_0x1b2d57,_0x34091f){return db[_0x8887('0x3b')][_0x8887('0x46')](_0x1b2d57[_0x8887('0x47')],{})[_0x8887('0x3e')](respondWithResult(_0x34091f,0xc9))[_0x8887('0x40')](handleError(_0x34091f,null));};exports[_0x8887('0x22')]=function(_0x25ed97,_0x1f5eed){if(_0x25ed97[_0x8887('0x47')]['id']){delete _0x25ed97[_0x8887('0x47')]['id'];}return db[_0x8887('0x3b')][_0x8887('0x45')]({'where':{'id':_0x25ed97[_0x8887('0x48')]['id']}})[_0x8887('0x3e')](handleEntityNotFound(_0x1f5eed,null))[_0x8887('0x3e')](saveUpdates(_0x25ed97[_0x8887('0x47')],null))[_0x8887('0x3e')](respondWithResult(_0x1f5eed,null))[_0x8887('0x40')](handleError(_0x1f5eed,null));};exports[_0x8887('0x23')]=function(_0x4eba1a,_0x3a65c0){return db[_0x8887('0x3b')][_0x8887('0x45')]({'where':{'id':_0x4eba1a[_0x8887('0x48')]['id']}})[_0x8887('0x3e')](handleEntityNotFound(_0x3a65c0,null))['then'](removeEntity(_0x3a65c0,null))[_0x8887('0x40')](handleError(_0x3a65c0,null));};exports['describe']=function(_0x432b41,_0x787cb0){return db['FaxTransferReport'][_0x8887('0x49')]()[_0x8887('0x3e')](respondWithResult(_0x787cb0,null))[_0x8887('0x40')](handleError(_0x787cb0,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 5788255..8f99dd1 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 _0xfdc6=['uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxTransferReport','report_fax_transfer'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xfdc6,0xf3));var _0x6fdc=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xfdc6[_0x186376];return _0x2dbdd9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6fdc('0x0'))(_0x6fdc('0x1'));var moment=require('moment');var BPromise=require(_0x6fdc('0x2'));var rp=require(_0x6fdc('0x3'));var fs=require('fs');var path=require(_0x6fdc('0x4'));var rimraf=require(_0x6fdc('0x5'));var config=require(_0x6fdc('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x6fdc('0x7')]=function(_0x5a651b,_0x5e9de5){return _0x5a651b['define'](_0x6fdc('0x8'),attributes,{'tableName':_0x6fdc('0x9'),'paranoid':![],'indexes':[{'name':_0x6fdc('0xa'),'fields':[_0x6fdc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x75e4=['./faxTransferReport.attributes','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2805d0,_0x47a649){var _0x2d4bf5=function(_0x3be731){while(--_0x3be731){_0x2805d0['push'](_0x2805d0['shift']());}};_0x2d4bf5(++_0x47a649);}(_0x75e4,0x1cb));var _0x475e=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x75e4[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0x475e('0x0'));var util=require(_0x475e('0x1'));var logger=require(_0x475e('0x2'))(_0x475e('0x3'));var moment=require(_0x475e('0x4'));var BPromise=require(_0x475e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x475e('0x6'));var rimraf=require(_0x475e('0x7'));var config=require(_0x475e('0x8'));var attributes=require(_0x475e('0x9'));module['exports']=function(_0x278089,_0x34fc07){return _0x278089['define'](_0x475e('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x475e('0xb'),'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 2161f81..7622c04 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 _0xf6b8=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf6b8,0x121));var _0x8f6b=function(_0x445cb6,_0x57cc15){_0x445cb6=_0x445cb6-0x0;var _0x38c54f=_0xf6b8[_0x445cb6];return _0x38c54f;};'use strict';var _=require(_0x8f6b('0x0'));var util=require(_0x8f6b('0x1'));var moment=require(_0x8f6b('0x2'));var BPromise=require(_0x8f6b('0x3'));var rs=require(_0x8f6b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8f6b('0x5'));var logger=require('../../config/logger')(_0x8f6b('0x6'));var config=require(_0x8f6b('0x7'));var jayson=require(_0x8f6b('0x8'));var client=jayson[_0x8f6b('0x9')][_0x8f6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x452e49,_0x5b0ee9,_0x3a8722){return new BPromise(function(_0x4aa394,_0x30519e){return client['request'](_0x452e49,_0x3a8722)[_0x8f6b('0xb')](function(_0x537dac){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x5b0ee9,_0x8f6b('0xc'));logger[_0x8f6b('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5b0ee9,_0x8f6b('0xc'),JSON[_0x8f6b('0xe')](_0x537dac));if(_0x537dac[_0x8f6b('0xf')]){if(_0x537dac[_0x8f6b('0xf')]['code']===0x1f4){logger[_0x8f6b('0xf')](_0x8f6b('0x10'),_0x5b0ee9,_0x537dac[_0x8f6b('0xf')][_0x8f6b('0x11')]);return _0x30519e(_0x537dac[_0x8f6b('0xf')][_0x8f6b('0x11')]);}logger[_0x8f6b('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x5b0ee9,_0x537dac[_0x8f6b('0xf')]['message']);return _0x4aa394(_0x537dac[_0x8f6b('0xf')][_0x8f6b('0x11')]);}else{logger[_0x8f6b('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5b0ee9,_0x8f6b('0xc'));_0x4aa394(_0x537dac[_0x8f6b('0x13')][_0x8f6b('0x11')]);}})[_0x8f6b('0x14')](function(_0x58ac27){logger[_0x8f6b('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x5b0ee9,_0x58ac27);_0x30519e(_0x58ac27);});});} \ No newline at end of file +var _0xddaa=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0xbdbd15,_0x2da8b6){var _0x14cfd9=function(_0x12b059){while(--_0x12b059){_0xbdbd15['push'](_0xbdbd15['shift']());}};_0x14cfd9(++_0x2da8b6);}(_0xddaa,0xce));var _0xadda=function(_0x25cdd8,_0x4d4ed3){_0x25cdd8=_0x25cdd8-0x0;var _0x5c4818=_0xddaa[_0x25cdd8];return _0x5c4818;};'use strict';var _=require(_0xadda('0x0'));var util=require(_0xadda('0x1'));var moment=require(_0xadda('0x2'));var BPromise=require(_0xadda('0x3'));var rs=require(_0xadda('0x4'));var fs=require('fs');var Redis=require(_0xadda('0x5'));var db=require(_0xadda('0x6'))['db'];var utils=require(_0xadda('0x7'));var logger=require(_0xadda('0x8'))(_0xadda('0x9'));var config=require('../../config/environment');var jayson=require(_0xadda('0xa'));var client=jayson['client'][_0xadda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d860d,_0xd20a8b,_0x58ab1a){return new BPromise(function(_0x2e59b3,_0x310b61){return client[_0xadda('0xc')](_0x3d860d,_0x58ab1a)['then'](function(_0x51837b){logger[_0xadda('0xd')](_0xadda('0xe'),_0xd20a8b,_0xadda('0xf'));logger['debug'](_0xadda('0x10'),_0xd20a8b,_0xadda('0xf'),JSON['stringify'](_0x51837b));if(_0x51837b[_0xadda('0x11')]){if(_0x51837b[_0xadda('0x11')][_0xadda('0x12')]===0x1f4){logger[_0xadda('0x11')](_0xadda('0xe'),_0xd20a8b,_0x51837b[_0xadda('0x11')][_0xadda('0x13')]);return _0x310b61(_0x51837b['error'][_0xadda('0x13')]);}logger[_0xadda('0x11')](_0xadda('0xe'),_0xd20a8b,_0x51837b['error'][_0xadda('0x13')]);return _0x2e59b3(_0x51837b[_0xadda('0x11')][_0xadda('0x13')]);}else{logger[_0xadda('0xd')](_0xadda('0xe'),_0xd20a8b,_0xadda('0xf'));_0x2e59b3(_0x51837b[_0xadda('0x14')][_0xadda('0x13')]);}})['catch'](function(_0x4b48af){logger[_0xadda('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0xd20a8b,_0x4b48af);_0x310b61(_0x4b48af);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ce66dc6..0fde220 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 _0x0277=['fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','exports','multer','connect-timeout','express','Router'];(function(_0x6dc660,_0x5e63fb){var _0x4fa02a=function(_0x3351f3){while(--_0x3351f3){_0x6dc660['push'](_0x6dc660['shift']());}};_0x4fa02a(++_0x5e63fb);}(_0x0277,0x1c7));var _0x7027=function(_0x256b96,_0x160abc){_0x256b96=_0x256b96-0x0;var _0x3b5bb0=_0x0277[_0x256b96];return _0x3b5bb0;};'use strict';var multer=require(_0x7027('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7027('0x1'));var express=require(_0x7027('0x2'));var router=express[_0x7027('0x3')]();var fs_extra=require(_0x7027('0x4'));var auth=require(_0x7027('0x5'));var interaction=require(_0x7027('0x6'));var config=require('../../config/environment');var controller=require(_0x7027('0x7'));router['get']('/',auth[_0x7027('0x8')](),controller[_0x7027('0x9')]);router[_0x7027('0xa')](_0x7027('0xb'),auth[_0x7027('0x8')](),controller['describe']);router[_0x7027('0xa')](_0x7027('0xc'),auth[_0x7027('0x8')](),controller[_0x7027('0xd')]);router['post']('/',auth[_0x7027('0x8')](),controller[_0x7027('0xe')]);router[_0x7027('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x7027('0xc'),auth[_0x7027('0x8')](),controller['destroy']);module[_0x7027('0x10')]=router; \ No newline at end of file +var _0x179c=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete'];(function(_0xbc940b,_0x3db8f3){var _0x4c3044=function(_0x1f28ce){while(--_0x1f28ce){_0xbc940b['push'](_0xbc940b['shift']());}};_0x4c3044(++_0x3db8f3);}(_0x179c,0xf3));var _0xc179=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x179c[_0x45fc6a];return _0x14bcfd;};'use strict';var multer=require(_0xc179('0x0'));var util=require(_0xc179('0x1'));var path=require(_0xc179('0x2'));var timeout=require(_0xc179('0x3'));var express=require(_0xc179('0x4'));var router=express[_0xc179('0x5')]();var fs_extra=require(_0xc179('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc179('0x7'));var config=require(_0xc179('0x8'));var controller=require(_0xc179('0x9'));router[_0xc179('0xa')]('/',auth[_0xc179('0xb')](),controller[_0xc179('0xc')]);router[_0xc179('0xa')](_0xc179('0xd'),auth[_0xc179('0xb')](),controller[_0xc179('0xe')]);router[_0xc179('0xa')](_0xc179('0xf'),auth[_0xc179('0xb')](),controller[_0xc179('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc179('0x11')]);router[_0xc179('0x12')](_0xc179('0xf'),auth[_0xc179('0xb')](),controller[_0xc179('0x13')]);router[_0xc179('0x14')](_0xc179('0xf'),auth['isAuthenticated'](),controller[_0xc179('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c3e41a4..835fa39 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 _0x1509=['isAuthenticated','get','/:id','/:id/configurations','getConfigurations','getFields','create','post','put','update','delete','exports','multer','path','express','fs-extra','./intDeskAccount.controller'];(function(_0xf47556,_0x2dbeb6){var _0x555b95=function(_0x42419a){while(--_0x42419a){_0xf47556['push'](_0xf47556['shift']());}};_0x555b95(++_0x2dbeb6);}(_0x1509,0x1c6));var _0x9150=function(_0x2f700f,_0xd740b3){_0x2f700f=_0x2f700f-0x0;var _0x216e4a=_0x1509[_0x2f700f];return _0x216e4a;};'use strict';var multer=require(_0x9150('0x0'));var util=require('util');var path=require(_0x9150('0x1'));var timeout=require('connect-timeout');var express=require(_0x9150('0x2'));var router=express['Router']();var fs_extra=require(_0x9150('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9150('0x4'));router['get']('/',auth[_0x9150('0x5')](),controller['index']);router[_0x9150('0x6')](_0x9150('0x7'),auth[_0x9150('0x5')](),controller['show']);router[_0x9150('0x6')](_0x9150('0x8'),auth[_0x9150('0x5')](),controller[_0x9150('0x9')]);router[_0x9150('0x6')]('/:id/fields',auth[_0x9150('0x5')](),controller[_0x9150('0xa')]);router['post']('/',auth[_0x9150('0x5')](),controller[_0x9150('0xb')]);router[_0x9150('0xc')](_0x9150('0x8'),auth[_0x9150('0x5')](),controller['addConfiguration']);router[_0x9150('0xd')](_0x9150('0x7'),auth[_0x9150('0x5')](),controller[_0x9150('0xe')]);router[_0x9150('0xf')](_0x9150('0x7'),auth[_0x9150('0x5')](),controller['destroy']);module[_0x9150('0x10')]=router; \ No newline at end of file +var _0xc29a=['index','/:id','/:id/configurations','/:id/fields','post','addConfiguration','update','delete','destroy','exports','multer','path','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x1c9b46,_0x507d41){var _0x2d199c=function(_0x4740a8){while(--_0x4740a8){_0x1c9b46['push'](_0x1c9b46['shift']());}};_0x2d199c(++_0x507d41);}(_0xc29a,0x6a));var _0xac29=function(_0x489ce0,_0x2b0dd9){_0x489ce0=_0x489ce0-0x0;var _0x397189=_0xc29a[_0x489ce0];return _0x397189;};'use strict';var multer=require(_0xac29('0x0'));var util=require('util');var path=require(_0xac29('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xac29('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac29('0x3'));router[_0xac29('0x4')]('/',auth[_0xac29('0x5')](),controller[_0xac29('0x6')]);router[_0xac29('0x4')](_0xac29('0x7'),auth[_0xac29('0x5')](),controller['show']);router[_0xac29('0x4')](_0xac29('0x8'),auth[_0xac29('0x5')](),controller['getConfigurations']);router[_0xac29('0x4')](_0xac29('0x9'),auth[_0xac29('0x5')](),controller['getFields']);router[_0xac29('0xa')]('/',auth[_0xac29('0x5')](),controller['create']);router['post'](_0xac29('0x8'),auth['isAuthenticated'](),controller[_0xac29('0xb')]);router['put'](_0xac29('0x7'),auth[_0xac29('0x5')](),controller[_0xac29('0xc')]);router[_0xac29('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xac29('0xe')]);module[_0xac29('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index d833792..a899297 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 _0x4ede=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x1990e5,_0x2e9bd1){var _0x2c97a6=function(_0x1c5d00){while(--_0x1c5d00){_0x1990e5['push'](_0x1990e5['shift']());}};_0x2c97a6(++_0x2e9bd1);}(_0x4ede,0x1c8));var _0xe4ed=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4ede[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xe4ed('0x0')]={'name':{'type':Sequelize[_0xe4ed('0x1')]},'description':{'type':Sequelize[_0xe4ed('0x1')]},'username':{'type':Sequelize[_0xe4ed('0x1')]},'remoteUri':{'type':Sequelize[_0xe4ed('0x1')]},'authType':{'type':Sequelize[_0xe4ed('0x2')]('basic'),'defaultValue':_0xe4ed('0x3')},'password':{'type':Sequelize[_0xe4ed('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xe4ed('0x1')]},'token':{'type':Sequelize[_0xe4ed('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe4ed('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe4ed('0x2')](_0xe4ed('0x4'),_0xe4ed('0x5')),'defaultValue':_0xe4ed('0x4')}}; \ No newline at end of file +var _0x1669=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x360902,_0x14b396){var _0x4c199f=function(_0xbbf3e7){while(--_0xbbf3e7){_0x360902['push'](_0x360902['shift']());}};_0x4c199f(++_0x14b396);}(_0x1669,0x93));var _0x9166=function(_0x5dcea2,_0x2364cf){_0x5dcea2=_0x5dcea2-0x0;var _0x12f684=_0x1669[_0x5dcea2];return _0x12f684;};'use strict';var Sequelize=require(_0x9166('0x0'));module[_0x9166('0x1')]={'name':{'type':Sequelize[_0x9166('0x2')]},'description':{'type':Sequelize[_0x9166('0x2')]},'username':{'type':Sequelize[_0x9166('0x2')]},'remoteUri':{'type':Sequelize[_0x9166('0x2')]},'authType':{'type':Sequelize[_0x9166('0x3')](_0x9166('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x9166('0x2')]},'consumerSecret':{'type':Sequelize[_0x9166('0x2')]},'token':{'type':Sequelize[_0x9166('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9166('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9166('0x5'),_0x9166('0x6')),'defaultValue':_0x9166('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 9ce4119..160c6ef 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 _0x035d=['Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','create','DeskField','Subjects','getFields','priority','authType','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers'];(function(_0x50697b,_0x56f879){var _0x47703e=function(_0x54689d){while(--_0x54689d){_0x50697b['push'](_0x50697b['shift']());}};_0x47703e(++_0x56f879);}(_0x035d,0x1eb));var _0xd035=function(_0x52b403,_0x2255a9){_0x52b403=_0x52b403-0x0;var _0x11320e=_0x035d[_0x52b403];return _0x11320e;};'use strict';var emlformat=require(_0xd035('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd035('0x1'));var rp=require(_0xd035('0x2'));var moment=require(_0xd035('0x3'));var BPromise=require(_0xd035('0x4'));var Mustache=require(_0xd035('0x5'));var util=require(_0xd035('0x6'));var path=require(_0xd035('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd035('0x8'));var fs=require('fs');var fs_extra=require(_0xd035('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd035('0xa'));var deskjs=require(_0xd035('0xb'));var toCsv=require(_0xd035('0xc'));var querystring=require(_0xd035('0xd'));var Papa=require(_0xd035('0xe'));var Redis=require(_0xd035('0xf'));var authService=require(_0xd035('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd035('0x11'));var hardwareService=require(_0xd035('0x12'));var logger=require('../../config/logger')(_0xd035('0x13'));var utils=require('../../config/utils');var config=require(_0xd035('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd035('0x15'))['db'];var integrations=require(_0xd035('0x16'));function respondWithStatusCode(_0x2944c0,_0x817272){_0x817272=_0x817272||0xcc;return function(_0x3d206d){if(_0x3d206d){return _0x2944c0[_0xd035('0x17')](_0x817272);}return _0x2944c0[_0xd035('0x18')](_0x817272)[_0xd035('0x19')]();};}function respondWithResult(_0x20253d,_0x49aa39){_0x49aa39=_0x49aa39||0xc8;return function(_0x51132d){if(_0x51132d){return _0x20253d[_0xd035('0x18')](_0x49aa39)['json'](_0x51132d);}};}function respondWithFilteredResult(_0x8cc050,_0xeed8ff){return function(_0xe85d9){if(_0xe85d9){var _0x51c357=typeof _0xeed8ff[_0xd035('0x1a')]===_0xd035('0x1b')&&typeof _0xeed8ff[_0xd035('0x1c')]===_0xd035('0x1b');var _0x44d62e=_0xe85d9[_0xd035('0x1d')];var _0x5e6165=_0x51c357?0x0:_0xeed8ff[_0xd035('0x1a')];var _0x10f78c=_0x51c357?_0xe85d9[_0xd035('0x1d')]:_0xeed8ff[_0xd035('0x1a')]+_0xeed8ff['limit'];var _0x12115f;if(_0x10f78c>=_0x44d62e){_0x10f78c=_0x44d62e;_0x12115f=0xc8;}else{_0x12115f=0xce;}_0x8cc050[_0xd035('0x18')](_0x12115f);return _0x8cc050[_0xd035('0x1e')](_0xd035('0x1f'),_0x5e6165+'-'+_0x10f78c+'/'+_0x44d62e)[_0xd035('0x20')](_0xe85d9);}return null;};}function patchUpdates(_0x2c0ca0){return function(_0x1f8b55){try{jsonpatch[_0xd035('0x21')](_0x1f8b55,_0x2c0ca0,!![]);}catch(_0x8666e6){return BPromise[_0xd035('0x22')](_0x8666e6);}return _0x1f8b55[_0xd035('0x23')]();};}function saveUpdates(_0x164347,_0x31ed3a){return function(_0x5dc8c9){if(_0x5dc8c9){return _0x5dc8c9[_0xd035('0x24')](_0x164347)['then'](function(_0x494bb5){return _0x494bb5;});}return null;};}function removeEntity(_0x2a543c,_0x4b365f){return function(_0x2f2049){if(_0x2f2049){return _0x2f2049[_0xd035('0x25')]()[_0xd035('0x26')](function(){_0x2a543c[_0xd035('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa577,_0x1bce60){return function(_0x3f53dd){if(!_0x3f53dd){_0x3aa577[_0xd035('0x17')](0x194);}return _0x3f53dd;};}function handleError(_0x3b3a22,_0x1730c7){_0x1730c7=_0x1730c7||0x1f4;return function(_0x3c13a1){logger['error'](_0x3c13a1[_0xd035('0x27')]);if(_0x3c13a1[_0xd035('0x28')]){delete _0x3c13a1[_0xd035('0x28')];}_0x3b3a22[_0xd035('0x18')](_0x1730c7)[_0xd035('0x29')](_0x3c13a1);};}exports[_0xd035('0x2a')]=function(_0x4d4a5f,_0x334eeb){var _0x24422b={},_0x29b0d4={},_0x5c06df={'count':0x0,'rows':[]};var _0x1e41e7=_['map'](db[_0xd035('0x2b')][_0xd035('0x2c')],function(_0x5b34d3){return{'name':_0x5b34d3[_0xd035('0x2d')],'type':_0x5b34d3[_0xd035('0x2e')]['key']};});_0x29b0d4[_0xd035('0x2f')]=_[_0xd035('0x30')](_0x1e41e7,_0xd035('0x28'));_0x29b0d4[_0xd035('0x31')]=_[_0xd035('0x32')](_0x4d4a5f[_0xd035('0x31')]);_0x29b0d4[_0xd035('0x33')]=_['intersection'](_0x29b0d4[_0xd035('0x2f')],_0x29b0d4[_0xd035('0x31')]);_0x24422b[_0xd035('0x34')]=_[_0xd035('0x35')](_0x29b0d4['model'],qs[_0xd035('0x36')](_0x4d4a5f[_0xd035('0x31')][_0xd035('0x36')]));_0x24422b[_0xd035('0x34')]=_0x24422b[_0xd035('0x34')][_0xd035('0x37')]?_0x24422b[_0xd035('0x34')]:_0x29b0d4[_0xd035('0x2f')];if(!_0x4d4a5f[_0xd035('0x31')][_0xd035('0x38')](_0xd035('0x39'))){_0x24422b[_0xd035('0x1c')]=qs[_0xd035('0x1c')](_0x4d4a5f[_0xd035('0x31')]['limit']);_0x24422b[_0xd035('0x1a')]=qs['offset'](_0x4d4a5f[_0xd035('0x31')][_0xd035('0x1a')]);}_0x24422b[_0xd035('0x3a')]=qs[_0xd035('0x3b')](_0x4d4a5f['query'][_0xd035('0x3b')]);_0x24422b[_0xd035('0x3c')]=qs[_0xd035('0x33')](_[_0xd035('0x3d')](_0x4d4a5f['query'],_0x29b0d4[_0xd035('0x33')]),_0x1e41e7);if(_0x4d4a5f[_0xd035('0x31')][_0xd035('0x3e')]){_0x24422b[_0xd035('0x3c')]=_[_0xd035('0x3f')](_0x24422b[_0xd035('0x3c')],{'$or':_['map'](_0x1e41e7,function(_0x2d81f1){if(_0x2d81f1[_0xd035('0x2e')]!==_0xd035('0x40')){var _0x945e2f={};_0x945e2f[_0x2d81f1[_0xd035('0x28')]]={'$like':'%'+_0x4d4a5f[_0xd035('0x31')][_0xd035('0x3e')]+'%'};return _0x945e2f;}})});}_0x24422b=_[_0xd035('0x3f')]({},_0x24422b,_0x4d4a5f[_0xd035('0x41')]);var _0x2049ee={'where':_0x24422b[_0xd035('0x3c')]};return db['DeskAccount'][_0xd035('0x1d')](_0x2049ee)[_0xd035('0x26')](function(_0x2b5764){_0x5c06df[_0xd035('0x1d')]=_0x2b5764;if(_0x4d4a5f['query'][_0xd035('0x42')]){_0x24422b[_0xd035('0x43')]=[{'all':!![]}];}return db[_0xd035('0x2b')][_0xd035('0x44')](_0x24422b);})[_0xd035('0x26')](function(_0x1c560a){_0x5c06df[_0xd035('0x45')]=_0x1c560a;return _0x5c06df;})[_0xd035('0x26')](respondWithFilteredResult(_0x334eeb,_0x24422b))[_0xd035('0x46')](handleError(_0x334eeb,null));};exports['show']=function(_0x387772,_0x3ed6e1){var _0x27fcc5={'raw':![],'where':{'id':_0x387772[_0xd035('0x47')]['id']}},_0x1b0ad7={};_0x1b0ad7[_0xd035('0x2f')]=_[_0xd035('0x32')](db[_0xd035('0x2b')][_0xd035('0x2c')]);_0x1b0ad7[_0xd035('0x31')]=_[_0xd035('0x32')](_0x387772[_0xd035('0x31')]);_0x1b0ad7[_0xd035('0x33')]=_['intersection'](_0x1b0ad7[_0xd035('0x2f')],_0x1b0ad7[_0xd035('0x31')]);_0x27fcc5[_0xd035('0x34')]=_[_0xd035('0x35')](_0x1b0ad7[_0xd035('0x2f')],qs['fields'](_0x387772[_0xd035('0x31')][_0xd035('0x36')]));_0x27fcc5[_0xd035('0x34')]=_0x27fcc5[_0xd035('0x34')][_0xd035('0x37')]?_0x27fcc5[_0xd035('0x34')]:_0x1b0ad7[_0xd035('0x2f')];if(_0x387772['query'][_0xd035('0x42')]){_0x27fcc5[_0xd035('0x43')]=[{'all':!![]}];}_0x27fcc5=_[_0xd035('0x3f')]({},_0x27fcc5,_0x387772[_0xd035('0x41')]);return db[_0xd035('0x2b')][_0xd035('0x48')](_0x27fcc5)['then'](handleEntityNotFound(_0x3ed6e1,null))[_0xd035('0x26')](respondWithResult(_0x3ed6e1,null))[_0xd035('0x46')](handleError(_0x3ed6e1,null));};exports['create']=function(_0x373532,_0x459c1f){return db['DeskAccount']['create'](_0x373532[_0xd035('0x49')],{})['then'](respondWithResult(_0x459c1f,0xc9))['catch'](handleError(_0x459c1f,null));};exports[_0xd035('0x24')]=function(_0x2a8fb6,_0x3ee74a){if(_0x2a8fb6[_0xd035('0x49')]['id']){delete _0x2a8fb6[_0xd035('0x49')]['id'];}return db[_0xd035('0x2b')][_0xd035('0x48')]({'where':{'id':_0x2a8fb6['params']['id']}})[_0xd035('0x26')](handleEntityNotFound(_0x3ee74a,null))[_0xd035('0x26')](saveUpdates(_0x2a8fb6[_0xd035('0x49')],null))['then'](respondWithResult(_0x3ee74a,null))['catch'](handleError(_0x3ee74a,null));};exports['destroy']=function(_0x186cdc,_0xc3686b){return db[_0xd035('0x2b')][_0xd035('0x48')]({'where':{'id':_0x186cdc[_0xd035('0x47')]['id']}})[_0xd035('0x26')](handleEntityNotFound(_0xc3686b,null))[_0xd035('0x26')](removeEntity(_0xc3686b,null))[_0xd035('0x46')](handleError(_0xc3686b,null));};exports[_0xd035('0x4a')]=function(_0x55007e,_0x5d03cd,_0x40a975){var _0x33b1f0={};var _0x25f075={};var _0x3baabf;var _0x1f1178;return db[_0xd035('0x2b')][_0xd035('0x4b')]({'where':{'id':_0x55007e[_0xd035('0x47')]['id']}})[_0xd035('0x26')](handleEntityNotFound(_0x5d03cd,null))[_0xd035('0x26')](function(_0x2d397a){if(_0x2d397a){_0x3baabf=_0x2d397a;_0x25f075['model']=_[_0xd035('0x32')](db[_0xd035('0x4c')][_0xd035('0x2c')]);_0x25f075[_0xd035('0x31')]=_[_0xd035('0x32')](_0x55007e[_0xd035('0x31')]);_0x25f075[_0xd035('0x33')]=_[_0xd035('0x35')](_0x25f075[_0xd035('0x2f')],_0x25f075[_0xd035('0x31')]);_0x33b1f0[_0xd035('0x34')]=_[_0xd035('0x35')](_0x25f075[_0xd035('0x2f')],qs[_0xd035('0x36')](_0x55007e[_0xd035('0x31')][_0xd035('0x36')]));_0x33b1f0[_0xd035('0x34')]=_0x33b1f0[_0xd035('0x34')][_0xd035('0x37')]?_0x33b1f0[_0xd035('0x34')]:_0x25f075[_0xd035('0x2f')];_0x33b1f0['order']=qs[_0xd035('0x3b')](_0x55007e[_0xd035('0x31')]['sort']);_0x33b1f0[_0xd035('0x3c')]=qs[_0xd035('0x33')](_[_0xd035('0x3d')](_0x55007e[_0xd035('0x31')],_0x25f075[_0xd035('0x33')]));if(_0x55007e[_0xd035('0x31')]['filter']){_0x33b1f0[_0xd035('0x3c')]=_[_0xd035('0x3f')](_0x33b1f0[_0xd035('0x3c')],{'$or':_[_0xd035('0x30')](_0x33b1f0[_0xd035('0x34')],function(_0x27f8cf){var _0x1a42c8={};_0x1a42c8[_0x27f8cf]={'$like':'%'+_0x55007e[_0xd035('0x31')][_0xd035('0x3e')]+'%'};return _0x1a42c8;})});}_0x33b1f0=_['merge']({},_0x33b1f0,_0x55007e[_0xd035('0x41')]);return _0x3baabf[_0xd035('0x4a')](_0x33b1f0);}})[_0xd035('0x26')](function(_0x260827){if(_0x260827){_0x1f1178=_0x260827[_0xd035('0x37')];if(!_0x55007e['query']['hasOwnProperty']('nolimit')){_0x33b1f0[_0xd035('0x1c')]=qs[_0xd035('0x1c')](_0x55007e[_0xd035('0x31')][_0xd035('0x1c')]);_0x33b1f0[_0xd035('0x1a')]=qs[_0xd035('0x1a')](_0x55007e['query'][_0xd035('0x1a')]);}return _0x3baabf[_0xd035('0x4a')](_0x33b1f0);}})[_0xd035('0x26')](function(_0x2c6e0c){if(_0x2c6e0c){return _0x2c6e0c?{'count':_0x1f1178,'rows':_0x2c6e0c}:null;}})['then'](respondWithResult(_0x5d03cd,null))[_0xd035('0x46')](handleError(_0x5d03cd,null));};exports[_0xd035('0x4d')]=function(_0x6bd4c,_0x1636ba,_0x4c2e94){if(_0x6bd4c[_0xd035('0x49')]['id']){delete _0x6bd4c[_0xd035('0x49')]['id'];}return db[_0xd035('0x2b')][_0xd035('0x4b')]({'where':{'id':_0x6bd4c[_0xd035('0x47')]['id']}})[_0xd035('0x26')](handleEntityNotFound(_0x1636ba,null))[_0xd035('0x26')](function(_0x163c54){if(_0x163c54){_0x6bd4c['body'][_0xd035('0x4e')]=_0x163c54['id'];_0x6bd4c['body']['Subjects']=integrations[_0xd035('0x4f')](_0x6bd4c[_0xd035('0x49')][_0xd035('0x50')],_0x6bd4c[_0xd035('0x49')][_0xd035('0x2e')]);_0x6bd4c[_0xd035('0x49')][_0xd035('0x51')]=integrations[_0xd035('0x52')](_0x6bd4c['body'][_0xd035('0x50')],_0x6bd4c[_0xd035('0x49')][_0xd035('0x2e')]);return db[_0xd035('0x4c')][_0xd035('0x53')](_0x6bd4c[_0xd035('0x49')],{'include':[{'model':db[_0xd035('0x54')],'as':_0xd035('0x55')},{'model':db[_0xd035('0x54')],'as':_0xd035('0x51')}]});}return null;})[_0xd035('0x26')](respondWithResult(_0x1636ba,null))['catch'](handleError(_0x1636ba,null));};exports[_0xd035('0x56')]=function(_0x22fd84,_0x2b0160,_0x4e726f){var _0x16363c=[{'name':_0xd035('0x57'),'label':_0xd035('0x57'),'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 _0x5e8346='';return db['DeskAccount']['findOne']({'where':{'id':_0x22fd84[_0xd035('0x47')]['id']},'attributes':['id','remoteUri',_0xd035('0x58'),'username',_0xd035('0x59'),_0xd035('0x5a'),_0xd035('0x5b'),_0xd035('0x5c'),_0xd035('0x5d')]})['then'](handleEntityNotFound(_0x2b0160,null))[_0xd035('0x26')](function(_0xe0aa5b){if(_0xe0aa5b){_0x5e8346=_0xe0aa5b[_0xd035('0x5e')];var _0x8eb4d=_0x5e8346[_0xd035('0x5f')](-0x1);if(_0x8eb4d==='/'){_0x5e8346=_0x5e8346[_0xd035('0x60')](0x0,_0x5e8346[_0xd035('0x61')](_0x8eb4d));}var _0x1f7969={'method':_0xd035('0x62'),'uri':util[_0xd035('0x63')](_0xd035('0x64'),_0x5e8346),'headers':{'Content-Type':_0xd035('0x65'),'Accept':_0xd035('0x65')},'json':!![]};if(_0xe0aa5b['authType']===_0xd035('0x66')){_0x1f7969[_0xd035('0x67')][_0xd035('0x68')]=util[_0xd035('0x63')](_0xd035('0x69'),new Buffer(util[_0xd035('0x63')](_0xd035('0x6a'),_0xe0aa5b[_0xd035('0x6b')],_0xe0aa5b[_0xd035('0x59')]))[_0xd035('0x6c')](_0xd035('0x6d')));}return rp(_0x1f7969)['then'](function(_0x3ff065){return _0x16363c[_0xd035('0x6e')](_[_0xd035('0x30')](_0x3ff065[_0xd035('0x6f')]['entries'],function(_0x4acd8f){return{'id':_0x4acd8f[_0xd035('0x28')],'name':_0x4acd8f[_0xd035('0x28')],'type':_0x4acd8f['type'],'active':_0x4acd8f[_0xd035('0x70')],'label':_0x4acd8f[_0xd035('0x71')],'custom':!![]};}));});}})['then'](function(_0x1e7ee5){return{'count':_0x1e7ee5[_0xd035('0x37')],'rows':_0x1e7ee5};})[_0xd035('0x26')](respondWithResult(_0x2b0160,null))['catch'](function(_0x2ee334){var _0x17763c=_0x22fd84['query'][_0xd035('0x72')]?0x1f4:_0x2ee334[_0xd035('0x73')]||0x1f4;logger['error'](_0xd035('0x74'),_0xd035('0x56'),_0x17763c,JSON[_0xd035('0x75')](_0x2ee334));delete _0x2ee334[_0xd035('0x28')];if(_0x17763c===0x191){_0x17763c=0x190;}_0x2b0160[_0xd035('0x18')](_0x17763c)[_0xd035('0x29')](_0x22fd84[_0xd035('0x31')][_0xd035('0x72')]?{'message':_0xd035('0x76'),'statusCode':_0x2ee334['statusCode']}:_0x2ee334);});}; \ No newline at end of file +var _0xc571=['options','DeskAccount','includeAll','rows','show','params','length','include','find','catch','create','body','destroy','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','consumerKey','token','remoteUri','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','password','toString','base64','_embedded','entries','active','label','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','update','then','error','stack','name','map','rawAttributes','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','type'];(function(_0x116414,_0x9d2adc){var _0x5949d7=function(_0x31cdea){while(--_0x31cdea){_0x116414['push'](_0x116414['shift']());}};_0x5949d7(++_0x9d2adc);}(_0xc571,0x1f4));var _0x1c57=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0xc571[_0x512f81];return _0xa15099;};'use strict';var emlformat=require(_0x1c57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c57('0x1'));var jsonpatch=require(_0x1c57('0x2'));var rp=require(_0x1c57('0x3'));var moment=require('moment');var BPromise=require(_0x1c57('0x4'));var Mustache=require(_0x1c57('0x5'));var util=require(_0x1c57('0x6'));var path=require(_0x1c57('0x7'));var sox=require('sox');var csv=require(_0x1c57('0x8'));var ejs=require(_0x1c57('0x9'));var fs=require('fs');var fs_extra=require(_0x1c57('0xa'));var _=require(_0x1c57('0xb'));var squel=require('squel');var crypto=require(_0x1c57('0xc'));var jsforce=require(_0x1c57('0xd'));var deskjs=require(_0x1c57('0xe'));var toCsv=require(_0x1c57('0x8'));var querystring=require(_0x1c57('0xf'));var Papa=require(_0x1c57('0x10'));var Redis=require('ioredis');var authService=require(_0x1c57('0x11'));var qs=require(_0x1c57('0x12'));var as=require(_0x1c57('0x13'));var hardwareService=require(_0x1c57('0x14'));var logger=require(_0x1c57('0x15'))('api');var utils=require(_0x1c57('0x16'));var config=require(_0x1c57('0x17'));var licenseUtil=require(_0x1c57('0x18'));var db=require(_0x1c57('0x19'))['db'];var integrations=require(_0x1c57('0x1a'));function respondWithStatusCode(_0x2ece73,_0x3cd683){_0x3cd683=_0x3cd683||0xcc;return function(_0x5e0253){if(_0x5e0253){return _0x2ece73[_0x1c57('0x1b')](_0x3cd683);}return _0x2ece73[_0x1c57('0x1c')](_0x3cd683)[_0x1c57('0x1d')]();};}function respondWithResult(_0x1229a8,_0x1a9a6d){_0x1a9a6d=_0x1a9a6d||0xc8;return function(_0x5c4e54){if(_0x5c4e54){return _0x1229a8[_0x1c57('0x1c')](_0x1a9a6d)['json'](_0x5c4e54);}};}function respondWithFilteredResult(_0x339af4,_0x5d54c2){return function(_0x4b0cb4){if(_0x4b0cb4){var _0x26bfaf=typeof _0x5d54c2[_0x1c57('0x1e')]===_0x1c57('0x1f')&&typeof _0x5d54c2['limit']==='undefined';var _0x3a4840=_0x4b0cb4[_0x1c57('0x20')];var _0x31a39a=_0x26bfaf?0x0:_0x5d54c2[_0x1c57('0x1e')];var _0x8b5ec5=_0x26bfaf?_0x4b0cb4[_0x1c57('0x20')]:_0x5d54c2['offset']+_0x5d54c2[_0x1c57('0x21')];var _0x11cbe4;if(_0x8b5ec5>=_0x3a4840){_0x8b5ec5=_0x3a4840;_0x11cbe4=0xc8;}else{_0x11cbe4=0xce;}_0x339af4[_0x1c57('0x1c')](_0x11cbe4);return _0x339af4[_0x1c57('0x22')]('Content-Range',_0x31a39a+'-'+_0x8b5ec5+'/'+_0x3a4840)[_0x1c57('0x23')](_0x4b0cb4);}return null;};}function patchUpdates(_0x30b980){return function(_0x51e9c5){try{jsonpatch['apply'](_0x51e9c5,_0x30b980,!![]);}catch(_0x32faab){return BPromise[_0x1c57('0x24')](_0x32faab);}return _0x51e9c5['save']();};}function saveUpdates(_0x4369b1,_0x5a930f){return function(_0x388568){if(_0x388568){return _0x388568[_0x1c57('0x25')](_0x4369b1)[_0x1c57('0x26')](function(_0x1034c6){return _0x1034c6;});}return null;};}function removeEntity(_0x2e82df,_0x314126){return function(_0x57c00d){if(_0x57c00d){return _0x57c00d['destroy']()[_0x1c57('0x26')](function(){_0x2e82df[_0x1c57('0x1c')](0xcc)[_0x1c57('0x1d')]();});}};}function handleEntityNotFound(_0x1b2887,_0x148c2b){return function(_0x300882){if(!_0x300882){_0x1b2887[_0x1c57('0x1b')](0x194);}return _0x300882;};}function handleError(_0x3b092d,_0x427202){_0x427202=_0x427202||0x1f4;return function(_0x20e416){logger[_0x1c57('0x27')](_0x20e416[_0x1c57('0x28')]);if(_0x20e416[_0x1c57('0x29')]){delete _0x20e416[_0x1c57('0x29')];}_0x3b092d[_0x1c57('0x1c')](_0x427202)['send'](_0x20e416);};}exports['index']=function(_0x33c20a,_0x405a63){var _0xaead93={},_0x2dddc8={},_0xcd9d9f={'count':0x0,'rows':[]};var _0x3068f5=_[_0x1c57('0x2a')](db['DeskAccount'][_0x1c57('0x2b')],function(_0x3401d1){return{'name':_0x3401d1['fieldName'],'type':_0x3401d1['type'][_0x1c57('0x2c')]};});_0x2dddc8[_0x1c57('0x2d')]=_[_0x1c57('0x2a')](_0x3068f5,_0x1c57('0x29'));_0x2dddc8['query']=_[_0x1c57('0x2e')](_0x33c20a[_0x1c57('0x2f')]);_0x2dddc8['filters']=_[_0x1c57('0x30')](_0x2dddc8[_0x1c57('0x2d')],_0x2dddc8[_0x1c57('0x2f')]);_0xaead93[_0x1c57('0x31')]=_[_0x1c57('0x30')](_0x2dddc8[_0x1c57('0x2d')],qs[_0x1c57('0x32')](_0x33c20a[_0x1c57('0x2f')][_0x1c57('0x32')]));_0xaead93['attributes']=_0xaead93[_0x1c57('0x31')]['length']?_0xaead93[_0x1c57('0x31')]:_0x2dddc8[_0x1c57('0x2d')];if(!_0x33c20a[_0x1c57('0x2f')][_0x1c57('0x33')](_0x1c57('0x34'))){_0xaead93[_0x1c57('0x21')]=qs['limit'](_0x33c20a['query']['limit']);_0xaead93[_0x1c57('0x1e')]=qs['offset'](_0x33c20a[_0x1c57('0x2f')][_0x1c57('0x1e')]);}_0xaead93['order']=qs[_0x1c57('0x35')](_0x33c20a[_0x1c57('0x2f')][_0x1c57('0x35')]);_0xaead93['where']=qs[_0x1c57('0x36')](_[_0x1c57('0x37')](_0x33c20a[_0x1c57('0x2f')],_0x2dddc8[_0x1c57('0x36')]),_0x3068f5);if(_0x33c20a[_0x1c57('0x2f')][_0x1c57('0x38')]){_0xaead93['where']=_[_0x1c57('0x39')](_0xaead93[_0x1c57('0x3a')],{'$or':_[_0x1c57('0x2a')](_0x3068f5,function(_0x3288e5){if(_0x3288e5[_0x1c57('0x3b')]!=='VIRTUAL'){var _0x2fe3cb={};_0x2fe3cb[_0x3288e5[_0x1c57('0x29')]]={'$like':'%'+_0x33c20a[_0x1c57('0x2f')]['filter']+'%'};return _0x2fe3cb;}})});}_0xaead93=_['merge']({},_0xaead93,_0x33c20a[_0x1c57('0x3c')]);var _0x3a055b={'where':_0xaead93[_0x1c57('0x3a')]};return db[_0x1c57('0x3d')]['count'](_0x3a055b)[_0x1c57('0x26')](function(_0x32604e){_0xcd9d9f[_0x1c57('0x20')]=_0x32604e;if(_0x33c20a['query'][_0x1c57('0x3e')]){_0xaead93['include']=[{'all':!![]}];}return db[_0x1c57('0x3d')]['findAll'](_0xaead93);})[_0x1c57('0x26')](function(_0xba5541){_0xcd9d9f[_0x1c57('0x3f')]=_0xba5541;return _0xcd9d9f;})[_0x1c57('0x26')](respondWithFilteredResult(_0x405a63,_0xaead93))['catch'](handleError(_0x405a63,null));};exports[_0x1c57('0x40')]=function(_0x2fad5b,_0x4323c4){var _0x59ad35={'raw':![],'where':{'id':_0x2fad5b[_0x1c57('0x41')]['id']}},_0x3bb722={};_0x3bb722[_0x1c57('0x2d')]=_[_0x1c57('0x2e')](db[_0x1c57('0x3d')][_0x1c57('0x2b')]);_0x3bb722[_0x1c57('0x2f')]=_[_0x1c57('0x2e')](_0x2fad5b[_0x1c57('0x2f')]);_0x3bb722[_0x1c57('0x36')]=_[_0x1c57('0x30')](_0x3bb722[_0x1c57('0x2d')],_0x3bb722['query']);_0x59ad35[_0x1c57('0x31')]=_[_0x1c57('0x30')](_0x3bb722['model'],qs[_0x1c57('0x32')](_0x2fad5b[_0x1c57('0x2f')][_0x1c57('0x32')]));_0x59ad35[_0x1c57('0x31')]=_0x59ad35[_0x1c57('0x31')][_0x1c57('0x42')]?_0x59ad35[_0x1c57('0x31')]:_0x3bb722[_0x1c57('0x2d')];if(_0x2fad5b[_0x1c57('0x2f')][_0x1c57('0x3e')]){_0x59ad35[_0x1c57('0x43')]=[{'all':!![]}];}_0x59ad35=_['merge']({},_0x59ad35,_0x2fad5b[_0x1c57('0x3c')]);return db[_0x1c57('0x3d')][_0x1c57('0x44')](_0x59ad35)[_0x1c57('0x26')](handleEntityNotFound(_0x4323c4,null))[_0x1c57('0x26')](respondWithResult(_0x4323c4,null))[_0x1c57('0x45')](handleError(_0x4323c4,null));};exports[_0x1c57('0x46')]=function(_0x569f42,_0x322934){return db[_0x1c57('0x3d')]['create'](_0x569f42[_0x1c57('0x47')],{})[_0x1c57('0x26')](respondWithResult(_0x322934,0xc9))[_0x1c57('0x45')](handleError(_0x322934,null));};exports[_0x1c57('0x25')]=function(_0x2a94b4,_0x29d249){if(_0x2a94b4[_0x1c57('0x47')]['id']){delete _0x2a94b4[_0x1c57('0x47')]['id'];}return db[_0x1c57('0x3d')][_0x1c57('0x44')]({'where':{'id':_0x2a94b4[_0x1c57('0x41')]['id']}})[_0x1c57('0x26')](handleEntityNotFound(_0x29d249,null))[_0x1c57('0x26')](saveUpdates(_0x2a94b4['body'],null))[_0x1c57('0x26')](respondWithResult(_0x29d249,null))[_0x1c57('0x45')](handleError(_0x29d249,null));};exports[_0x1c57('0x48')]=function(_0x56f81a,_0x47fa94){return db[_0x1c57('0x3d')][_0x1c57('0x44')]({'where':{'id':_0x56f81a[_0x1c57('0x41')]['id']}})[_0x1c57('0x26')](handleEntityNotFound(_0x47fa94,null))[_0x1c57('0x26')](removeEntity(_0x47fa94,null))[_0x1c57('0x45')](handleError(_0x47fa94,null));};exports[_0x1c57('0x49')]=function(_0x483c0e,_0x199432,_0x384c0a){var _0x6b444c={};var _0x1a6db7={};var _0x2c5872;var _0x38f43c;return db[_0x1c57('0x3d')][_0x1c57('0x4a')]({'where':{'id':_0x483c0e['params']['id']}})[_0x1c57('0x26')](handleEntityNotFound(_0x199432,null))['then'](function(_0x64628b){if(_0x64628b){_0x2c5872=_0x64628b;_0x1a6db7[_0x1c57('0x2d')]=_[_0x1c57('0x2e')](db[_0x1c57('0x4b')][_0x1c57('0x2b')]);_0x1a6db7[_0x1c57('0x2f')]=_['keys'](_0x483c0e[_0x1c57('0x2f')]);_0x1a6db7[_0x1c57('0x36')]=_[_0x1c57('0x30')](_0x1a6db7[_0x1c57('0x2d')],_0x1a6db7[_0x1c57('0x2f')]);_0x6b444c[_0x1c57('0x31')]=_['intersection'](_0x1a6db7['model'],qs[_0x1c57('0x32')](_0x483c0e[_0x1c57('0x2f')][_0x1c57('0x32')]));_0x6b444c[_0x1c57('0x31')]=_0x6b444c[_0x1c57('0x31')][_0x1c57('0x42')]?_0x6b444c[_0x1c57('0x31')]:_0x1a6db7[_0x1c57('0x2d')];_0x6b444c['order']=qs[_0x1c57('0x35')](_0x483c0e['query']['sort']);_0x6b444c[_0x1c57('0x3a')]=qs['filters'](_[_0x1c57('0x37')](_0x483c0e[_0x1c57('0x2f')],_0x1a6db7[_0x1c57('0x36')]));if(_0x483c0e[_0x1c57('0x2f')][_0x1c57('0x38')]){_0x6b444c[_0x1c57('0x3a')]=_[_0x1c57('0x39')](_0x6b444c[_0x1c57('0x3a')],{'$or':_[_0x1c57('0x2a')](_0x6b444c['attributes'],function(_0x317286){var _0x43c79b={};_0x43c79b[_0x317286]={'$like':'%'+_0x483c0e[_0x1c57('0x2f')][_0x1c57('0x38')]+'%'};return _0x43c79b;})});}_0x6b444c=_[_0x1c57('0x39')]({},_0x6b444c,_0x483c0e[_0x1c57('0x3c')]);return _0x2c5872['getConfigurations'](_0x6b444c);}})[_0x1c57('0x26')](function(_0x3bed86){if(_0x3bed86){_0x38f43c=_0x3bed86[_0x1c57('0x42')];if(!_0x483c0e[_0x1c57('0x2f')][_0x1c57('0x33')](_0x1c57('0x34'))){_0x6b444c[_0x1c57('0x21')]=qs[_0x1c57('0x21')](_0x483c0e['query'][_0x1c57('0x21')]);_0x6b444c[_0x1c57('0x1e')]=qs['offset'](_0x483c0e['query'][_0x1c57('0x1e')]);}return _0x2c5872[_0x1c57('0x49')](_0x6b444c);}})[_0x1c57('0x26')](function(_0x2b4e2d){if(_0x2b4e2d){return _0x2b4e2d?{'count':_0x38f43c,'rows':_0x2b4e2d}:null;}})[_0x1c57('0x26')](respondWithResult(_0x199432,null))['catch'](handleError(_0x199432,null));};exports[_0x1c57('0x4c')]=function(_0x35d928,_0x9055f4,_0x3e484c){if(_0x35d928[_0x1c57('0x47')]['id']){delete _0x35d928[_0x1c57('0x47')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x35d928['params']['id']}})[_0x1c57('0x26')](handleEntityNotFound(_0x9055f4,null))['then'](function(_0x3699b5){if(_0x3699b5){_0x35d928[_0x1c57('0x47')][_0x1c57('0x4d')]=_0x3699b5['id'];_0x35d928[_0x1c57('0x47')][_0x1c57('0x4e')]=integrations[_0x1c57('0x4f')](_0x35d928[_0x1c57('0x47')][_0x1c57('0x50')],_0x35d928[_0x1c57('0x47')]['type']);_0x35d928[_0x1c57('0x47')][_0x1c57('0x51')]=integrations[_0x1c57('0x52')](_0x35d928[_0x1c57('0x47')][_0x1c57('0x50')],_0x35d928[_0x1c57('0x47')][_0x1c57('0x3b')]);return db[_0x1c57('0x4b')][_0x1c57('0x46')](_0x35d928[_0x1c57('0x47')],{'include':[{'model':db[_0x1c57('0x53')],'as':_0x1c57('0x4e')},{'model':db[_0x1c57('0x53')],'as':_0x1c57('0x51')}]});}return null;})['then'](respondWithResult(_0x9055f4,null))[_0x1c57('0x45')](handleError(_0x9055f4,null));};exports[_0x1c57('0x54')]=function(_0x4b7043,_0x28b9a3,_0x4c5877){var _0x78e668=[{'name':_0x1c57('0x55'),'label':_0x1c57('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 _0x5d08c6='';return db[_0x1c57('0x3d')][_0x1c57('0x4a')]({'where':{'id':_0x4b7043['params']['id']},'attributes':['id','remoteUri',_0x1c57('0x56'),'username','password',_0x1c57('0x57'),'consumerSecret',_0x1c57('0x58'),'tokenSecret']})['then'](handleEntityNotFound(_0x28b9a3,null))['then'](function(_0x5beb7b){if(_0x5beb7b){_0x5d08c6=_0x5beb7b[_0x1c57('0x59')];var _0x5f3933=_0x5d08c6['slice'](-0x1);if(_0x5f3933==='/'){_0x5d08c6=_0x5d08c6['substring'](0x0,_0x5d08c6['lastIndexOf'](_0x5f3933));}var _0x3b3930={'method':_0x1c57('0x5a'),'uri':util[_0x1c57('0x5b')](_0x1c57('0x5c'),_0x5d08c6),'headers':{'Content-Type':_0x1c57('0x5d'),'Accept':'application/json'},'json':!![]};if(_0x5beb7b['authType']===_0x1c57('0x5e')){_0x3b3930[_0x1c57('0x5f')][_0x1c57('0x60')]=util[_0x1c57('0x5b')](_0x1c57('0x61'),new Buffer(util['format'](_0x1c57('0x62'),_0x5beb7b[_0x1c57('0x63')],_0x5beb7b[_0x1c57('0x64')]))[_0x1c57('0x65')](_0x1c57('0x66')));}return rp(_0x3b3930)[_0x1c57('0x26')](function(_0x30d977){return _0x78e668['concat'](_['map'](_0x30d977[_0x1c57('0x67')][_0x1c57('0x68')],function(_0x304363){return{'id':_0x304363[_0x1c57('0x29')],'name':_0x304363[_0x1c57('0x29')],'type':_0x304363[_0x1c57('0x3b')],'active':_0x304363[_0x1c57('0x69')],'label':_0x304363[_0x1c57('0x6a')],'custom':!![]};}));});}})[_0x1c57('0x26')](function(_0xc70be5){return{'count':_0xc70be5[_0x1c57('0x42')],'rows':_0xc70be5};})['then'](respondWithResult(_0x28b9a3,null))[_0x1c57('0x45')](function(_0x3eb146){var _0x1e392c=_0x4b7043[_0x1c57('0x2f')][_0x1c57('0x6b')]?0x1f4:_0x3eb146[_0x1c57('0x6c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1e392c,JSON[_0x1c57('0x6d')](_0x3eb146));delete _0x3eb146['name'];if(_0x1e392c===0x191){_0x1e392c=0x190;}_0x28b9a3['status'](_0x1e392c)[_0x1c57('0x6e')](_0x4b7043[_0x1c57('0x2f')][_0x1c57('0x6b')]?{'message':_0x1c57('0x6f'),'statusCode':_0x3eb146[_0x1c57('0x6c')]}:_0x3eb146);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 64c310f..21a59bc 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 _0xcc9c=['../../config/logger','api','moment','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','lodash','util'];(function(_0x2d513f,_0x126f93){var _0x2488c3=function(_0x59599c){while(--_0x59599c){_0x2d513f['push'](_0x2d513f['shift']());}};_0x2488c3(++_0x126f93);}(_0xcc9c,0x148));var _0xccc9=function(_0x3fdef9,_0x260599){_0x3fdef9=_0x3fdef9-0x0;var _0x4b3bfb=_0xcc9c[_0x3fdef9];return _0x4b3bfb;};'use strict';var _=require(_0xccc9('0x0'));var util=require(_0xccc9('0x1'));var logger=require(_0xccc9('0x2'))(_0xccc9('0x3'));var moment=require(_0xccc9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xccc9('0x5'));var config=require(_0xccc9('0x6'));var attributes=require(_0xccc9('0x7'));var integrations=require(_0xccc9('0x8'));module['exports']=function(_0x1f3b3c,_0x41370f){return _0x1f3b3c[_0xccc9('0x9')](_0xccc9('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1725=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x822aaf,_0x3b7c35){var _0x26f302=function(_0xfaa59d){while(--_0xfaa59d){_0x822aaf['push'](_0x822aaf['shift']());}};_0x26f302(++_0x3b7c35);}(_0x1725,0xa5));var _0x5172=function(_0x1e7520,_0x304f6a){_0x1e7520=_0x1e7520-0x0;var _0xab1fb8=_0x1725[_0x1e7520];return _0xab1fb8;};'use strict';var _=require(_0x5172('0x0'));var util=require(_0x5172('0x1'));var logger=require(_0x5172('0x2'))(_0x5172('0x3'));var moment=require(_0x5172('0x4'));var BPromise=require(_0x5172('0x5'));var rp=require(_0x5172('0x6'));var fs=require('fs');var path=require(_0x5172('0x7'));var rimraf=require(_0x5172('0x8'));var config=require(_0x5172('0x9'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x5172('0xa'));module[_0x5172('0xb')]=function(_0x4c2ec3,_0x91c9e3){return _0x4c2ec3[_0x5172('0xc')](_0x5172('0xd'),attributes,{'tableName':_0x5172('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 1bafcb0..096a226 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 _0x52c1=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','options','raw','attributes','limit','include','model','map','ShowDeskAccount','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x27139b,_0x947d93){var _0x369dc3=function(_0x4bcf8a){while(--_0x4bcf8a){_0x27139b['push'](_0x27139b['shift']());}};_0x369dc3(++_0x947d93);}(_0x52c1,0x15e));var _0x152c=function(_0x4cf628,_0x1486bf){_0x4cf628=_0x4cf628-0x0;var _0x29f696=_0x52c1[_0x4cf628];return _0x29f696;};'use strict';var _=require('lodash');var util=require(_0x152c('0x0'));var moment=require(_0x152c('0x1'));var BPromise=require('bluebird');var rs=require(_0x152c('0x2'));var fs=require('fs');var Redis=require(_0x152c('0x3'));var db=require(_0x152c('0x4'))['db'];var utils=require(_0x152c('0x5'));var logger=require(_0x152c('0x6'))(_0x152c('0x7'));var config=require(_0x152c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5629d6,_0x4ff100,_0x5b3b27){return new BPromise(function(_0x6061fa,_0xcfe5aa){return client[_0x152c('0x9')](_0x5629d6,_0x5b3b27)[_0x152c('0xa')](function(_0x117ea2){logger[_0x152c('0xb')](_0x152c('0xc'),_0x4ff100,_0x152c('0xd'));logger[_0x152c('0xe')](_0x152c('0xf'),_0x4ff100,_0x152c('0xd'),JSON[_0x152c('0x10')](_0x117ea2));if(_0x117ea2[_0x152c('0x11')]){if(_0x117ea2[_0x152c('0x11')][_0x152c('0x12')]===0x1f4){logger[_0x152c('0x11')](_0x152c('0xc'),_0x4ff100,_0x117ea2[_0x152c('0x11')][_0x152c('0x13')]);return _0xcfe5aa(_0x117ea2[_0x152c('0x11')]['message']);}logger[_0x152c('0x11')](_0x152c('0xc'),_0x4ff100,_0x117ea2[_0x152c('0x11')][_0x152c('0x13')]);return _0x6061fa(_0x117ea2[_0x152c('0x11')][_0x152c('0x13')]);}else{logger[_0x152c('0xb')](_0x152c('0xc'),_0x4ff100,_0x152c('0xd'));_0x6061fa(_0x117ea2['result'][_0x152c('0x13')]);}})[_0x152c('0x14')](function(_0x1df540){logger[_0x152c('0x11')](_0x152c('0xc'),_0x4ff100,_0x1df540);_0xcfe5aa(_0x1df540);});});}exports[_0x152c('0x15')]=function(_0x4ac03b){var _0x2ae8ee=this;return new Promise(function(_0x4b05ad,_0x69d369){return db[_0x152c('0x16')]['findAll']({'raw':_0x4ac03b[_0x152c('0x17')]?_0x4ac03b['options'][_0x152c('0x18')]===undefined?!![]:![]:!![],'where':_0x4ac03b[_0x152c('0x17')]?_0x4ac03b['options']['where']||null:null,'attributes':_0x4ac03b['options']?_0x4ac03b[_0x152c('0x17')][_0x152c('0x19')]||null:null,'limit':_0x4ac03b[_0x152c('0x17')]?_0x4ac03b['options'][_0x152c('0x1a')]||null:null,'include':_0x4ac03b['options']?_0x4ac03b[_0x152c('0x17')][_0x152c('0x1b')]?_['map'](_0x4ac03b['options']['include'],function(_0x5e1a2a){return{'model':db[_0x5e1a2a[_0x152c('0x1c')]],'as':_0x5e1a2a['as'],'attributes':_0x5e1a2a[_0x152c('0x19')],'include':_0x5e1a2a[_0x152c('0x1b')]?_['map'](_0x5e1a2a[_0x152c('0x1b')],function(_0x48ef83){return{'model':db[_0x48ef83['model']],'as':_0x48ef83['as'],'attributes':_0x48ef83[_0x152c('0x19')],'include':_0x48ef83[_0x152c('0x1b')]?_[_0x152c('0x1d')](_0x48ef83['include'],function(_0x426c27){return{'model':db[_0x426c27['model']],'as':_0x426c27['as'],'attributes':_0x426c27['attributes']};}):[]};}):[]};}):[]:[]})[_0x152c('0xa')](function(_0xade855){logger['info']('GetDeskAccount',_0x4ac03b);logger['debug']('GetDeskAccount',_0x4ac03b,JSON['stringify'](_0xade855));_0x4b05ad(_0xade855);})[_0x152c('0x14')](function(_0x3c6653){logger['error']('GetDeskAccount',_0x3c6653['message'],_0x4ac03b);_0x69d369(_0x2ae8ee[_0x152c('0x11')](0x1f4,_0x3c6653[_0x152c('0x13')]));});});};exports[_0x152c('0x1e')]=function(_0x377908){var _0x17e87d=this;return new Promise(function(_0x15fc8d,_0x57d999){return db[_0x152c('0x16')][_0x152c('0x1f')]({'raw':_0x377908[_0x152c('0x17')]?_0x377908['options']['raw']===undefined?!![]:![]:!![],'where':_0x377908[_0x152c('0x17')]?_0x377908['options'][_0x152c('0x20')]||null:null,'attributes':_0x377908[_0x152c('0x17')]?_0x377908[_0x152c('0x17')]['attributes']||null:null,'include':_0x377908[_0x152c('0x17')]?_0x377908[_0x152c('0x17')][_0x152c('0x1b')]?_[_0x152c('0x1d')](_0x377908['options'][_0x152c('0x1b')],function(_0x2fe6ab){return{'model':db[_0x2fe6ab['model']],'as':_0x2fe6ab['as'],'attributes':_0x2fe6ab[_0x152c('0x19')],'include':_0x2fe6ab[_0x152c('0x1b')]?_[_0x152c('0x1d')](_0x2fe6ab[_0x152c('0x1b')],function(_0x2b2c46){return{'model':db[_0x2b2c46[_0x152c('0x1c')]],'as':_0x2b2c46['as'],'attributes':_0x2b2c46[_0x152c('0x19')],'include':_0x2b2c46[_0x152c('0x1b')]?_[_0x152c('0x1d')](_0x2b2c46['include'],function(_0x4cb110){return{'model':db[_0x4cb110[_0x152c('0x1c')]],'as':_0x4cb110['as'],'attributes':_0x4cb110['attributes']};}):[]};}):[]};}):[]:[]})[_0x152c('0xa')](function(_0x17cec6){logger[_0x152c('0xb')]('ShowDeskAccount',_0x377908);logger['debug'](_0x152c('0x1e'),_0x377908,JSON[_0x152c('0x10')](_0x17cec6));_0x15fc8d(_0x17cec6);})['catch'](function(_0x2151f7){logger[_0x152c('0x11')](_0x152c('0x1e'),_0x2151f7['message'],_0x377908);_0x57d999(_0x17e87d['error'](0x1f4,_0x2151f7['message']));});});}; \ No newline at end of file +var _0x1f55=['../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','GetDeskAccount','DeskAccount','findAll','raw','options','where','attributes','include','model','map','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5d0f83,_0x4238be){var _0x4e0530=function(_0x167a85){while(--_0x167a85){_0x5d0f83['push'](_0x5d0f83['shift']());}};_0x4e0530(++_0x4238be);}(_0x1f55,0x85));var _0x51f5=function(_0x4fbf18,_0x3500cc){_0x4fbf18=_0x4fbf18-0x0;var _0x3b3474=_0x1f55[_0x4fbf18];return _0x3b3474;};'use strict';var _=require(_0x51f5('0x0'));var util=require(_0x51f5('0x1'));var moment=require(_0x51f5('0x2'));var BPromise=require(_0x51f5('0x3'));var rs=require(_0x51f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51f5('0x5'))['db'];var utils=require(_0x51f5('0x6'));var logger=require(_0x51f5('0x7'))(_0x51f5('0x8'));var config=require('../../config/environment');var jayson=require(_0x51f5('0x9'));var client=jayson['client'][_0x51f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15f54d,_0x272319,_0x5daeb5){return new BPromise(function(_0x194b14,_0x6a0997){return client[_0x51f5('0xb')](_0x15f54d,_0x5daeb5)['then'](function(_0x3b3cf0){logger[_0x51f5('0xc')]('DeskAccount,\x20%s,\x20%s',_0x272319,_0x51f5('0xd'));logger[_0x51f5('0xe')](_0x51f5('0xf'),_0x272319,_0x51f5('0xd'),JSON[_0x51f5('0x10')](_0x3b3cf0));if(_0x3b3cf0[_0x51f5('0x11')]){if(_0x3b3cf0[_0x51f5('0x11')][_0x51f5('0x12')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x272319,_0x3b3cf0[_0x51f5('0x11')][_0x51f5('0x13')]);return _0x6a0997(_0x3b3cf0[_0x51f5('0x11')][_0x51f5('0x13')]);}logger[_0x51f5('0x11')](_0x51f5('0x14'),_0x272319,_0x3b3cf0[_0x51f5('0x11')][_0x51f5('0x13')]);return _0x194b14(_0x3b3cf0[_0x51f5('0x11')]['message']);}else{logger[_0x51f5('0xc')]('DeskAccount,\x20%s,\x20%s',_0x272319,'request\x20sent');_0x194b14(_0x3b3cf0[_0x51f5('0x15')][_0x51f5('0x13')]);}})['catch'](function(_0x48884d){logger['error'](_0x51f5('0x14'),_0x272319,_0x48884d);_0x6a0997(_0x48884d);});});}exports[_0x51f5('0x16')]=function(_0x1f29e7){var _0x30b365=this;return new Promise(function(_0x467f98,_0x94a5da){return db[_0x51f5('0x17')][_0x51f5('0x18')]({'raw':_0x1f29e7['options']?_0x1f29e7['options'][_0x51f5('0x19')]===undefined?!![]:![]:!![],'where':_0x1f29e7[_0x51f5('0x1a')]?_0x1f29e7[_0x51f5('0x1a')][_0x51f5('0x1b')]||null:null,'attributes':_0x1f29e7[_0x51f5('0x1a')]?_0x1f29e7['options'][_0x51f5('0x1c')]||null:null,'limit':_0x1f29e7['options']?_0x1f29e7[_0x51f5('0x1a')]['limit']||null:null,'include':_0x1f29e7['options']?_0x1f29e7['options'][_0x51f5('0x1d')]?_['map'](_0x1f29e7[_0x51f5('0x1a')][_0x51f5('0x1d')],function(_0x1994f9){return{'model':db[_0x1994f9[_0x51f5('0x1e')]],'as':_0x1994f9['as'],'attributes':_0x1994f9[_0x51f5('0x1c')],'include':_0x1994f9[_0x51f5('0x1d')]?_['map'](_0x1994f9[_0x51f5('0x1d')],function(_0x170e0f){return{'model':db[_0x170e0f['model']],'as':_0x170e0f['as'],'attributes':_0x170e0f[_0x51f5('0x1c')],'include':_0x170e0f[_0x51f5('0x1d')]?_[_0x51f5('0x1f')](_0x170e0f[_0x51f5('0x1d')],function(_0x25b4b7){return{'model':db[_0x25b4b7[_0x51f5('0x1e')]],'as':_0x25b4b7['as'],'attributes':_0x25b4b7[_0x51f5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x730655){logger[_0x51f5('0xc')]('GetDeskAccount',_0x1f29e7);logger['debug'](_0x51f5('0x16'),_0x1f29e7,JSON[_0x51f5('0x10')](_0x730655));_0x467f98(_0x730655);})[_0x51f5('0x20')](function(_0x5b751a){logger[_0x51f5('0x11')](_0x51f5('0x16'),_0x5b751a[_0x51f5('0x13')],_0x1f29e7);_0x94a5da(_0x30b365['error'](0x1f4,_0x5b751a[_0x51f5('0x13')]));});});};exports[_0x51f5('0x21')]=function(_0x46f935){var _0x3287c9=this;return new Promise(function(_0x119492,_0x4a1618){return db['DeskAccount'][_0x51f5('0x22')]({'raw':_0x46f935[_0x51f5('0x1a')]?_0x46f935[_0x51f5('0x1a')][_0x51f5('0x19')]===undefined?!![]:![]:!![],'where':_0x46f935[_0x51f5('0x1a')]?_0x46f935[_0x51f5('0x1a')]['where']||null:null,'attributes':_0x46f935[_0x51f5('0x1a')]?_0x46f935[_0x51f5('0x1a')][_0x51f5('0x1c')]||null:null,'include':_0x46f935['options']?_0x46f935[_0x51f5('0x1a')][_0x51f5('0x1d')]?_[_0x51f5('0x1f')](_0x46f935['options'][_0x51f5('0x1d')],function(_0x4eee54){return{'model':db[_0x4eee54[_0x51f5('0x1e')]],'as':_0x4eee54['as'],'attributes':_0x4eee54[_0x51f5('0x1c')],'include':_0x4eee54['include']?_[_0x51f5('0x1f')](_0x4eee54[_0x51f5('0x1d')],function(_0x12eb36){return{'model':db[_0x12eb36[_0x51f5('0x1e')]],'as':_0x12eb36['as'],'attributes':_0x12eb36[_0x51f5('0x1c')],'include':_0x12eb36[_0x51f5('0x1d')]?_[_0x51f5('0x1f')](_0x12eb36[_0x51f5('0x1d')],function(_0x452201){return{'model':db[_0x452201['model']],'as':_0x452201['as'],'attributes':_0x452201[_0x51f5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fa263){logger[_0x51f5('0xc')](_0x51f5('0x21'),_0x46f935);logger['debug'](_0x51f5('0x21'),_0x46f935,JSON[_0x51f5('0x10')](_0x4fa263));_0x119492(_0x4fa263);})['catch'](function(_0x505fce){logger['error'](_0x51f5('0x21'),_0x505fce['message'],_0x46f935);_0x4a1618(_0x3287c9[_0x51f5('0x11')](0x1f4,_0x505fce[_0x51f5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c687c4c..9ebfdab 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x48024c,_0x2562ba){var _0x303841=function(_0x52f8f9){while(--_0x52f8f9){_0x48024c['push'](_0x48024c['shift']());}};_0x303841(++_0x2562ba);}(_0x008c,0x188));var _0xc008=function(_0x1c6d44,_0x1b7780){_0x1c6d44=_0x1c6d44-0x0;var _0x49d1a7=_0x008c[_0x1c6d44];return _0x49d1a7;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x1eeab9,_0x6b9596){var _0x2b7532=function(_0x5264f2){while(--_0x5264f2){_0x1eeab9['push'](_0x1eeab9['shift']());}};_0x2b7532(++_0x6b9596);}(_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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 25111da..6712f32 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 _0xce1c=['STRING','sequelize'];(function(_0x11585b,_0x21c906){var _0x2f9a80=function(_0xd2f4e1){while(--_0xd2f4e1){_0x11585b['push'](_0x11585b['shift']());}};_0x2f9a80(++_0x21c906);}(_0xce1c,0x111));var _0xcce1=function(_0x145db1,_0x1724d5){_0x145db1=_0x145db1-0x0;var _0x5eff0a=_0xce1c[_0x145db1];return _0x5eff0a;};'use strict';var Sequelize=require(_0xcce1('0x0'));module['exports']={'name':{'type':Sequelize[_0xcce1('0x1')]},'description':{'type':Sequelize[_0xcce1('0x1')]}}; \ No newline at end of file +var _0x19d4=['STRING','sequelize'];(function(_0x142156,_0x5169f8){var _0x5b1ea3=function(_0x26080b){while(--_0x26080b){_0x142156['push'](_0x142156['shift']());}};_0x5b1ea3(++_0x5169f8);}(_0x19d4,0x13f));var _0x419d=function(_0x166066,_0x44ce71){_0x166066=_0x166066-0x0;var _0x285fec=_0x19d4[_0x166066];return _0x285fec;};'use strict';var Sequelize=require(_0x419d('0x0'));module['exports']={'name':{'type':Sequelize[_0x419d('0x1')]},'description':{'type':Sequelize[_0x419d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 9ebd6da..60d8dce 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 _0xc98b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','name','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','DeskConfiguration','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','DeskField','map','getSubjects','getDescriptions','order','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x2c006b,_0x27334d){var _0xb3b154=function(_0x1956e5){while(--_0x1956e5){_0x2c006b['push'](_0x2c006b['shift']());}};_0xb3b154(++_0x27334d);}(_0xc98b,0x92));var _0xbc98=function(_0x495c87,_0x151384){_0x495c87=_0x495c87-0x0;var _0x31a257=_0xc98b[_0x495c87];return _0x31a257;};'use strict';var emlformat=require(_0xbc98('0x0'));var rimraf=require(_0xbc98('0x1'));var zipdir=require(_0xbc98('0x2'));var jsonpatch=require(_0xbc98('0x3'));var rp=require('request-promise');var moment=require(_0xbc98('0x4'));var BPromise=require(_0xbc98('0x5'));var Mustache=require(_0xbc98('0x6'));var util=require(_0xbc98('0x7'));var path=require(_0xbc98('0x8'));var sox=require('sox');var csv=require(_0xbc98('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc98('0xa'));var _=require(_0xbc98('0xb'));var squel=require(_0xbc98('0xc'));var crypto=require(_0xbc98('0xd'));var jsforce=require(_0xbc98('0xe'));var deskjs=require(_0xbc98('0xf'));var toCsv=require(_0xbc98('0x9'));var querystring=require('querystring');var Papa=require(_0xbc98('0x10'));var Redis=require(_0xbc98('0x11'));var authService=require(_0xbc98('0x12'));var qs=require(_0xbc98('0x13'));var as=require(_0xbc98('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc98('0x15'))('api');var utils=require(_0xbc98('0x16'));var config=require(_0xbc98('0x17'));var licenseUtil=require(_0xbc98('0x18'));var db=require(_0xbc98('0x19'))['db'];function respondWithStatusCode(_0x383ff5,_0xe17de9){_0xe17de9=_0xe17de9||0xcc;return function(_0x912b32){if(_0x912b32){return _0x383ff5[_0xbc98('0x1a')](_0xe17de9);}return _0x383ff5[_0xbc98('0x1b')](_0xe17de9)[_0xbc98('0x1c')]();};}function respondWithResult(_0x5871bb,_0x5e7c42){_0x5e7c42=_0x5e7c42||0xc8;return function(_0x1d3e64){if(_0x1d3e64){return _0x5871bb[_0xbc98('0x1b')](_0x5e7c42)['json'](_0x1d3e64);}};}function respondWithFilteredResult(_0x122d6c,_0x1d0b6e){return function(_0x3ebe15){if(_0x3ebe15){var _0x1e6802=typeof _0x1d0b6e[_0xbc98('0x1d')]===_0xbc98('0x1e')&&typeof _0x1d0b6e[_0xbc98('0x1f')]===_0xbc98('0x1e');var _0xa2f506=_0x3ebe15[_0xbc98('0x20')];var _0x43de7a=_0x1e6802?0x0:_0x1d0b6e[_0xbc98('0x1d')];var _0x4abce4=_0x1e6802?_0x3ebe15[_0xbc98('0x20')]:_0x1d0b6e[_0xbc98('0x1d')]+_0x1d0b6e[_0xbc98('0x1f')];var _0x48aec1;if(_0x4abce4>=_0xa2f506){_0x4abce4=_0xa2f506;_0x48aec1=0xc8;}else{_0x48aec1=0xce;}_0x122d6c[_0xbc98('0x1b')](_0x48aec1);return _0x122d6c[_0xbc98('0x21')](_0xbc98('0x22'),_0x43de7a+'-'+_0x4abce4+'/'+_0xa2f506)[_0xbc98('0x23')](_0x3ebe15);}return null;};}function patchUpdates(_0x34e931){return function(_0xdb5a35){try{jsonpatch['apply'](_0xdb5a35,_0x34e931,!![]);}catch(_0x35bb6e){return BPromise[_0xbc98('0x24')](_0x35bb6e);}return _0xdb5a35[_0xbc98('0x25')]();};}function saveUpdates(_0xac985a,_0xe11a8){return function(_0x4db7ba){if(_0x4db7ba){return _0x4db7ba['update'](_0xac985a)[_0xbc98('0x26')](function(_0x497b8b){return _0x497b8b;});}return null;};}function removeEntity(_0x5e4073,_0x4609ef){return function(_0x5efc44){if(_0x5efc44){return _0x5efc44[_0xbc98('0x27')]()[_0xbc98('0x26')](function(){_0x5e4073['status'](0xcc)[_0xbc98('0x1c')]();});}};}function handleEntityNotFound(_0x499934,_0x52a990){return function(_0x40a0ca){if(!_0x40a0ca){_0x499934[_0xbc98('0x1a')](0x194);}return _0x40a0ca;};}function handleError(_0xd4c217,_0x480795){_0x480795=_0x480795||0x1f4;return function(_0x4c7eda){logger['error'](_0x4c7eda['stack']);if(_0x4c7eda[_0xbc98('0x28')]){delete _0x4c7eda[_0xbc98('0x28')];}_0xd4c217[_0xbc98('0x1b')](_0x480795)['send'](_0x4c7eda);};}exports[_0xbc98('0x29')]=function(_0x25dab7,_0x2c930c){var _0x170534={},_0x5277f4={},_0x170dc1={'count':0x0,'rows':[]};var _0x44ab7a=_['map'](db['DeskConfiguration'][_0xbc98('0x2a')],function(_0x2d0900){return{'name':_0x2d0900[_0xbc98('0x2b')],'type':_0x2d0900['type'][_0xbc98('0x2c')]};});_0x5277f4[_0xbc98('0x2d')]=_['map'](_0x44ab7a,_0xbc98('0x28'));_0x5277f4['query']=_[_0xbc98('0x2e')](_0x25dab7[_0xbc98('0x2f')]);_0x5277f4[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x5277f4[_0xbc98('0x2d')],_0x5277f4[_0xbc98('0x2f')]);_0x170534[_0xbc98('0x32')]=_['intersection'](_0x5277f4['model'],qs[_0xbc98('0x33')](_0x25dab7[_0xbc98('0x2f')][_0xbc98('0x33')]));_0x170534['attributes']=_0x170534[_0xbc98('0x32')][_0xbc98('0x34')]?_0x170534[_0xbc98('0x32')]:_0x5277f4['model'];if(!_0x25dab7['query'][_0xbc98('0x35')](_0xbc98('0x36'))){_0x170534[_0xbc98('0x1f')]=qs[_0xbc98('0x1f')](_0x25dab7[_0xbc98('0x2f')]['limit']);_0x170534[_0xbc98('0x1d')]=qs['offset'](_0x25dab7[_0xbc98('0x2f')][_0xbc98('0x1d')]);}_0x170534['order']=qs['sort'](_0x25dab7['query'][_0xbc98('0x37')]);_0x170534[_0xbc98('0x38')]=qs[_0xbc98('0x30')](_[_0xbc98('0x39')](_0x25dab7[_0xbc98('0x2f')],_0x5277f4['filters']),_0x44ab7a);if(_0x25dab7['query'][_0xbc98('0x3a')]){_0x170534[_0xbc98('0x38')]=_['merge'](_0x170534['where'],{'$or':_['map'](_0x44ab7a,function(_0x1f1df6){if(_0x1f1df6['type']!==_0xbc98('0x3b')){var _0x3b8003={};_0x3b8003[_0x1f1df6[_0xbc98('0x28')]]={'$like':'%'+_0x25dab7[_0xbc98('0x2f')][_0xbc98('0x3a')]+'%'};return _0x3b8003;}})});}_0x170534=_[_0xbc98('0x3c')]({},_0x170534,_0x25dab7[_0xbc98('0x3d')]);var _0x207677={'where':_0x170534[_0xbc98('0x38')]};return db[_0xbc98('0x3e')][_0xbc98('0x20')](_0x207677)[_0xbc98('0x26')](function(_0x21ac2f){_0x170dc1[_0xbc98('0x20')]=_0x21ac2f;if(_0x25dab7[_0xbc98('0x2f')][_0xbc98('0x3f')]){_0x170534[_0xbc98('0x40')]=[{'all':!![]}];}return db[_0xbc98('0x3e')]['findAll'](_0x170534);})['then'](function(_0x506c90){_0x170dc1[_0xbc98('0x41')]=_0x506c90;return _0x170dc1;})['then'](respondWithFilteredResult(_0x2c930c,_0x170534))[_0xbc98('0x42')](handleError(_0x2c930c,null));};exports[_0xbc98('0x43')]=function(_0x2f4800,_0x2ea1d2){var _0x5b2605={'raw':![],'where':{'id':_0x2f4800[_0xbc98('0x44')]['id']}},_0x12906f={};_0x12906f[_0xbc98('0x2d')]=_['keys'](db['DeskConfiguration'][_0xbc98('0x2a')]);_0x12906f[_0xbc98('0x2f')]=_[_0xbc98('0x2e')](_0x2f4800['query']);_0x12906f[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x12906f['model'],_0x12906f['query']);_0x5b2605[_0xbc98('0x32')]=_[_0xbc98('0x31')](_0x12906f[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x2f4800[_0xbc98('0x2f')]['fields']));_0x5b2605[_0xbc98('0x32')]=_0x5b2605[_0xbc98('0x32')][_0xbc98('0x34')]?_0x5b2605[_0xbc98('0x32')]:_0x12906f['model'];if(_0x2f4800[_0xbc98('0x2f')][_0xbc98('0x3f')]){_0x5b2605[_0xbc98('0x40')]=[{'all':!![]}];}_0x5b2605=_[_0xbc98('0x3c')]({},_0x5b2605,_0x2f4800[_0xbc98('0x3d')]);return db[_0xbc98('0x3e')][_0xbc98('0x45')](_0x5b2605)[_0xbc98('0x26')](handleEntityNotFound(_0x2ea1d2,null))[_0xbc98('0x26')](respondWithResult(_0x2ea1d2,null))['catch'](handleError(_0x2ea1d2,null));};exports['create']=function(_0x248099,_0xe1e88e){return db[_0xbc98('0x3e')][_0xbc98('0x46')](_0x248099[_0xbc98('0x47')],{})[_0xbc98('0x26')](respondWithResult(_0xe1e88e,0xc9))['catch'](handleError(_0xe1e88e,null));};exports['update']=function(_0x52c384,_0x1d5acb){if(_0x52c384[_0xbc98('0x47')]['id']){delete _0x52c384['body']['id'];}return db[_0xbc98('0x3e')][_0xbc98('0x45')]({'where':{'id':_0x52c384[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x1d5acb,null))[_0xbc98('0x26')](saveUpdates(_0x52c384[_0xbc98('0x47')],null))[_0xbc98('0x26')](respondWithResult(_0x1d5acb,null))[_0xbc98('0x42')](handleError(_0x1d5acb,null));};exports[_0xbc98('0x27')]=function(_0x532954,_0x4757d8){return db[_0xbc98('0x3e')][_0xbc98('0x45')]({'where':{'id':_0x532954[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x4757d8,null))['then'](removeEntity(_0x4757d8,null))[_0xbc98('0x42')](handleError(_0x4757d8,null));};exports[_0xbc98('0x48')]=function(_0x5522c9,_0x5e81a1,_0x4ea8c8){var _0x3cb1c8={};var _0x1b918d={};var _0x1f71cf;var _0x39b411;return db[_0xbc98('0x3e')][_0xbc98('0x49')]({'where':{'id':_0x5522c9['params']['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x5e81a1,null))[_0xbc98('0x26')](function(_0x40f17a){if(_0x40f17a){_0x1f71cf=_0x40f17a;_0x1b918d['model']=_['keys'](db[_0xbc98('0x4a')]['rawAttributes']);_0x1b918d[_0xbc98('0x2f')]=_[_0xbc98('0x2e')](_0x5522c9[_0xbc98('0x2f')]);_0x1b918d[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x1b918d[_0xbc98('0x2d')],_0x1b918d['query']);_0x3cb1c8[_0xbc98('0x32')]=_[_0xbc98('0x31')](_0x1b918d[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x33')]));_0x3cb1c8['attributes']=_0x3cb1c8[_0xbc98('0x32')][_0xbc98('0x34')]?_0x3cb1c8[_0xbc98('0x32')]:_0x1b918d[_0xbc98('0x2d')];_0x3cb1c8['order']=qs[_0xbc98('0x37')](_0x5522c9[_0xbc98('0x2f')]['sort']);_0x3cb1c8['where']=qs[_0xbc98('0x30')](_['pick'](_0x5522c9[_0xbc98('0x2f')],_0x1b918d[_0xbc98('0x30')]));if(_0x5522c9['query'][_0xbc98('0x3a')]){_0x3cb1c8['where']=_[_0xbc98('0x3c')](_0x3cb1c8[_0xbc98('0x38')],{'$or':_['map'](_0x3cb1c8[_0xbc98('0x32')],function(_0x61b552){var _0x8b00ce={};_0x8b00ce[_0x61b552]={'$like':'%'+_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x3a')]+'%'};return _0x8b00ce;})});}_0x3cb1c8=_[_0xbc98('0x3c')]({},_0x3cb1c8,_0x5522c9[_0xbc98('0x3d')]);return _0x1f71cf['getFields'](_0x3cb1c8);}})['then'](function(_0x6fe6f5){if(_0x6fe6f5){_0x39b411=_0x6fe6f5[_0xbc98('0x34')];if(!_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x35')](_0xbc98('0x36'))){_0x3cb1c8['limit']=qs[_0xbc98('0x1f')](_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x1f')]);_0x3cb1c8['offset']=qs[_0xbc98('0x1d')](_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x1d')]);}return _0x1f71cf['getFields'](_0x3cb1c8);}})[_0xbc98('0x26')](function(_0x575ae7){if(_0x575ae7){return _0x575ae7?{'count':_0x39b411,'rows':_0x575ae7}:null;}})[_0xbc98('0x26')](respondWithResult(_0x5e81a1,null))['catch'](handleError(_0x5e81a1,null));};exports['getSubjects']=function(_0x367036,_0x5ee254,_0x588572){var _0x5179d2={};var _0x2c0373={};var _0x5d58cd;var _0x216b9c;return db[_0xbc98('0x3e')][_0xbc98('0x49')]({'where':{'id':_0x367036[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x5ee254,null))['then'](function(_0x42b71a){if(_0x42b71a){_0x5d58cd=_0x42b71a;_0x2c0373[_0xbc98('0x2d')]=_[_0xbc98('0x2e')](db['DeskField'][_0xbc98('0x2a')]);_0x2c0373[_0xbc98('0x2f')]=_['keys'](_0x367036[_0xbc98('0x2f')]);_0x2c0373[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x2c0373[_0xbc98('0x2d')],_0x2c0373['query']);_0x5179d2[_0xbc98('0x32')]=_[_0xbc98('0x31')](_0x2c0373[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x367036[_0xbc98('0x2f')]['fields']));_0x5179d2['attributes']=_0x5179d2['attributes'][_0xbc98('0x34')]?_0x5179d2[_0xbc98('0x32')]:_0x2c0373[_0xbc98('0x2d')];_0x5179d2['order']=qs[_0xbc98('0x37')](_0x367036[_0xbc98('0x2f')]['sort']);_0x5179d2['where']=qs[_0xbc98('0x30')](_[_0xbc98('0x39')](_0x367036[_0xbc98('0x2f')],_0x2c0373[_0xbc98('0x30')]));if(_0x367036['query'][_0xbc98('0x3a')]){_0x5179d2[_0xbc98('0x38')]=_['merge'](_0x5179d2[_0xbc98('0x38')],{'$or':_[_0xbc98('0x4b')](_0x5179d2[_0xbc98('0x32')],function(_0x2f69b7){var _0x16795d={};_0x16795d[_0x2f69b7]={'$like':'%'+_0x367036[_0xbc98('0x2f')][_0xbc98('0x3a')]+'%'};return _0x16795d;})});}_0x5179d2=_[_0xbc98('0x3c')]({},_0x5179d2,_0x367036[_0xbc98('0x3d')]);return _0x5d58cd[_0xbc98('0x4c')](_0x5179d2);}})['then'](function(_0x334755){if(_0x334755){_0x216b9c=_0x334755[_0xbc98('0x34')];if(!_0x367036[_0xbc98('0x2f')][_0xbc98('0x35')](_0xbc98('0x36'))){_0x5179d2['limit']=qs[_0xbc98('0x1f')](_0x367036[_0xbc98('0x2f')][_0xbc98('0x1f')]);_0x5179d2[_0xbc98('0x1d')]=qs['offset'](_0x367036['query'][_0xbc98('0x1d')]);}return _0x5d58cd[_0xbc98('0x4c')](_0x5179d2);}})[_0xbc98('0x26')](function(_0x377519){if(_0x377519){return _0x377519?{'count':_0x216b9c,'rows':_0x377519}:null;}})[_0xbc98('0x26')](respondWithResult(_0x5ee254,null))[_0xbc98('0x42')](handleError(_0x5ee254,null));};exports[_0xbc98('0x4d')]=function(_0x551af2,_0x49fbbe,_0x5049ed){var _0x51b425={};var _0x5652c0={};var _0x467940;var _0x569e49;return db[_0xbc98('0x3e')]['findOne']({'where':{'id':_0x551af2[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x49fbbe,null))[_0xbc98('0x26')](function(_0x581462){if(_0x581462){_0x467940=_0x581462;_0x5652c0[_0xbc98('0x2d')]=_[_0xbc98('0x2e')](db['DeskField']['rawAttributes']);_0x5652c0[_0xbc98('0x2f')]=_['keys'](_0x551af2[_0xbc98('0x2f')]);_0x5652c0[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x5652c0['model'],_0x5652c0[_0xbc98('0x2f')]);_0x51b425[_0xbc98('0x32')]=_[_0xbc98('0x31')](_0x5652c0[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x551af2['query'][_0xbc98('0x33')]));_0x51b425[_0xbc98('0x32')]=_0x51b425[_0xbc98('0x32')][_0xbc98('0x34')]?_0x51b425[_0xbc98('0x32')]:_0x5652c0['model'];_0x51b425[_0xbc98('0x4e')]=qs['sort'](_0x551af2[_0xbc98('0x2f')][_0xbc98('0x37')]);_0x51b425['where']=qs[_0xbc98('0x30')](_[_0xbc98('0x39')](_0x551af2['query'],_0x5652c0[_0xbc98('0x30')]));if(_0x551af2['query'][_0xbc98('0x3a')]){_0x51b425[_0xbc98('0x38')]=_[_0xbc98('0x3c')](_0x51b425[_0xbc98('0x38')],{'$or':_['map'](_0x51b425[_0xbc98('0x32')],function(_0x2cc59f){var _0x16e509={};_0x16e509[_0x2cc59f]={'$like':'%'+_0x551af2['query']['filter']+'%'};return _0x16e509;})});}_0x51b425=_[_0xbc98('0x3c')]({},_0x51b425,_0x551af2[_0xbc98('0x3d')]);return _0x467940[_0xbc98('0x4d')](_0x51b425);}})[_0xbc98('0x26')](function(_0x8a5e74){if(_0x8a5e74){_0x569e49=_0x8a5e74[_0xbc98('0x34')];if(!_0x551af2[_0xbc98('0x2f')][_0xbc98('0x35')](_0xbc98('0x36'))){_0x51b425[_0xbc98('0x1f')]=qs[_0xbc98('0x1f')](_0x551af2[_0xbc98('0x2f')][_0xbc98('0x1f')]);_0x51b425['offset']=qs[_0xbc98('0x1d')](_0x551af2[_0xbc98('0x2f')][_0xbc98('0x1d')]);}return _0x467940[_0xbc98('0x4d')](_0x51b425);}})[_0xbc98('0x26')](function(_0x2e5f64){if(_0x2e5f64){return _0x2e5f64?{'count':_0x569e49,'rows':_0x2e5f64}:null;}})['then'](respondWithResult(_0x49fbbe,null))['catch'](handleError(_0x49fbbe,null));};exports[_0xbc98('0x4f')]=function(_0x16bc24,_0x3d7c35,_0x13fecc){var _0x51e249={};var _0xe7a98={};var _0x177b43;var _0x41a0ef;return db['DeskConfiguration']['findOne']({'where':{'id':_0x16bc24[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x3d7c35,null))[_0xbc98('0x26')](function(_0x2d8a2b){if(_0x2d8a2b){_0x177b43=_0x2d8a2b;_0xe7a98[_0xbc98('0x2d')]=_[_0xbc98('0x2e')](db['Tag']['rawAttributes']);_0xe7a98[_0xbc98('0x2f')]=_[_0xbc98('0x2e')](_0x16bc24['query']);_0xe7a98[_0xbc98('0x30')]=_['intersection'](_0xe7a98[_0xbc98('0x2d')],_0xe7a98[_0xbc98('0x2f')]);_0x51e249['attributes']=_[_0xbc98('0x31')](_0xe7a98[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x16bc24['query'][_0xbc98('0x33')]));_0x51e249[_0xbc98('0x32')]=_0x51e249[_0xbc98('0x32')][_0xbc98('0x34')]?_0x51e249[_0xbc98('0x32')]:_0xe7a98[_0xbc98('0x2d')];_0x51e249['order']=qs['sort'](_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x37')]);_0x51e249[_0xbc98('0x38')]=qs[_0xbc98('0x30')](_[_0xbc98('0x39')](_0x16bc24[_0xbc98('0x2f')],_0xe7a98[_0xbc98('0x30')]));if(_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x3a')]){_0x51e249[_0xbc98('0x38')]=_[_0xbc98('0x3c')](_0x51e249[_0xbc98('0x38')],{'$or':_['map'](_0x51e249[_0xbc98('0x32')],function(_0x2ebc8e){var _0x177540={};_0x177540[_0x2ebc8e]={'$like':'%'+_0x16bc24['query']['filter']+'%'};return _0x177540;})});}_0x51e249=_[_0xbc98('0x3c')]({},_0x51e249,_0x16bc24[_0xbc98('0x3d')]);return _0x177b43[_0xbc98('0x4f')](_0x51e249);}})[_0xbc98('0x26')](function(_0x30c8b6){if(_0x30c8b6){_0x41a0ef=_0x30c8b6[_0xbc98('0x34')];if(!_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x35')]('nolimit')){_0x51e249[_0xbc98('0x1f')]=qs[_0xbc98('0x1f')](_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x1f')]);_0x51e249[_0xbc98('0x1d')]=qs['offset'](_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x1d')]);}return _0x177b43[_0xbc98('0x4f')](_0x51e249);}})['then'](function(_0x1d24f8){if(_0x1d24f8){return _0x1d24f8?{'count':_0x41a0ef,'rows':_0x1d24f8}:null;}})['then'](respondWithResult(_0x3d7c35,null))['catch'](handleError(_0x3d7c35,null));};exports[_0xbc98('0x50')]=function(_0x5c9e30,_0x3528a6,_0x1996c){if(_0x5c9e30[_0xbc98('0x47')]['id']){delete _0x5c9e30[_0xbc98('0x47')]['id'];}return db['DeskConfiguration'][_0xbc98('0x49')]({'where':{'id':_0x5c9e30['params']['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x3528a6,null))[_0xbc98('0x26')](function(_0x2a64f2){if(_0x2a64f2){return _0x2a64f2[_0xbc98('0x50')](_0x5c9e30['body'][_0xbc98('0x51')]||[]);}return null;})['then'](respondWithResult(_0x3528a6,null))[_0xbc98('0x42')](handleError(_0x3528a6,null));}; \ No newline at end of file +var _0x2c45=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','getFields','DeskField','length','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','findOne','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','DeskConfiguration','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','order'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x2c45,0x1cf));var _0x52c4=function(_0x120271,_0x2c6644){_0x120271=_0x120271-0x0;var _0x175912=_0x2c45[_0x120271];return _0x175912;};'use strict';var emlformat=require(_0x52c4('0x0'));var rimraf=require(_0x52c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52c4('0x2'));var rp=require('request-promise');var moment=require(_0x52c4('0x3'));var BPromise=require(_0x52c4('0x4'));var Mustache=require(_0x52c4('0x5'));var util=require('util');var path=require(_0x52c4('0x6'));var sox=require(_0x52c4('0x7'));var csv=require(_0x52c4('0x8'));var ejs=require(_0x52c4('0x9'));var fs=require('fs');var fs_extra=require(_0x52c4('0xa'));var _=require(_0x52c4('0xb'));var squel=require('squel');var crypto=require(_0x52c4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x52c4('0xd'));var toCsv=require(_0x52c4('0x8'));var querystring=require(_0x52c4('0xe'));var Papa=require(_0x52c4('0xf'));var Redis=require(_0x52c4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x52c4('0x11'));var as=require(_0x52c4('0x12'));var hardwareService=require(_0x52c4('0x13'));var logger=require(_0x52c4('0x14'))(_0x52c4('0x15'));var utils=require(_0x52c4('0x16'));var config=require(_0x52c4('0x17'));var licenseUtil=require(_0x52c4('0x18'));var db=require(_0x52c4('0x19'))['db'];function respondWithStatusCode(_0x34bee3,_0x386377){_0x386377=_0x386377||0xcc;return function(_0x29fa0e){if(_0x29fa0e){return _0x34bee3[_0x52c4('0x1a')](_0x386377);}return _0x34bee3[_0x52c4('0x1b')](_0x386377)[_0x52c4('0x1c')]();};}function respondWithResult(_0x4f911,_0x5b23b0){_0x5b23b0=_0x5b23b0||0xc8;return function(_0x15ecc7){if(_0x15ecc7){return _0x4f911[_0x52c4('0x1b')](_0x5b23b0)[_0x52c4('0x1d')](_0x15ecc7);}};}function respondWithFilteredResult(_0x12d310,_0x5c8b96){return function(_0x47adaa){if(_0x47adaa){var _0x47c182=typeof _0x5c8b96[_0x52c4('0x1e')]===_0x52c4('0x1f')&&typeof _0x5c8b96[_0x52c4('0x20')]===_0x52c4('0x1f');var _0x25bd4e=_0x47adaa[_0x52c4('0x21')];var _0x458deb=_0x47c182?0x0:_0x5c8b96[_0x52c4('0x1e')];var _0x555592=_0x47c182?_0x47adaa[_0x52c4('0x21')]:_0x5c8b96[_0x52c4('0x1e')]+_0x5c8b96[_0x52c4('0x20')];var _0x5ee87c;if(_0x555592>=_0x25bd4e){_0x555592=_0x25bd4e;_0x5ee87c=0xc8;}else{_0x5ee87c=0xce;}_0x12d310['status'](_0x5ee87c);return _0x12d310[_0x52c4('0x22')]('Content-Range',_0x458deb+'-'+_0x555592+'/'+_0x25bd4e)[_0x52c4('0x1d')](_0x47adaa);}return null;};}function patchUpdates(_0x558f19){return function(_0x33ca1d){try{jsonpatch[_0x52c4('0x23')](_0x33ca1d,_0x558f19,!![]);}catch(_0x239fff){return BPromise[_0x52c4('0x24')](_0x239fff);}return _0x33ca1d[_0x52c4('0x25')]();};}function saveUpdates(_0x2c34b4,_0x3ec99d){return function(_0x47e73f){if(_0x47e73f){return _0x47e73f[_0x52c4('0x26')](_0x2c34b4)[_0x52c4('0x27')](function(_0x486e14){return _0x486e14;});}return null;};}function removeEntity(_0x25e319,_0x4b74d3){return function(_0x48bb8f){if(_0x48bb8f){return _0x48bb8f['destroy']()['then'](function(){_0x25e319[_0x52c4('0x1b')](0xcc)[_0x52c4('0x1c')]();});}};}function handleEntityNotFound(_0x51cfac,_0x59a593){return function(_0x36c901){if(!_0x36c901){_0x51cfac['sendStatus'](0x194);}return _0x36c901;};}function handleError(_0x19a3ed,_0x24d7cf){_0x24d7cf=_0x24d7cf||0x1f4;return function(_0x4c3b44){logger[_0x52c4('0x28')](_0x4c3b44[_0x52c4('0x29')]);if(_0x4c3b44[_0x52c4('0x2a')]){delete _0x4c3b44[_0x52c4('0x2a')];}_0x19a3ed[_0x52c4('0x1b')](_0x24d7cf)[_0x52c4('0x2b')](_0x4c3b44);};}exports[_0x52c4('0x2c')]=function(_0xc41f96,_0x2bb01f){var _0xe0ad8d={},_0x2f829c={},_0x15261b={'count':0x0,'rows':[]};var _0x44aeca=_['map'](db[_0x52c4('0x2d')][_0x52c4('0x2e')],function(_0x4c00c2){return{'name':_0x4c00c2['fieldName'],'type':_0x4c00c2[_0x52c4('0x2f')][_0x52c4('0x30')]};});_0x2f829c['model']=_[_0x52c4('0x31')](_0x44aeca,_0x52c4('0x2a'));_0x2f829c[_0x52c4('0x32')]=_[_0x52c4('0x33')](_0xc41f96[_0x52c4('0x32')]);_0x2f829c[_0x52c4('0x34')]=_[_0x52c4('0x35')](_0x2f829c[_0x52c4('0x36')],_0x2f829c[_0x52c4('0x32')]);_0xe0ad8d[_0x52c4('0x37')]=_[_0x52c4('0x35')](_0x2f829c[_0x52c4('0x36')],qs[_0x52c4('0x38')](_0xc41f96[_0x52c4('0x32')][_0x52c4('0x38')]));_0xe0ad8d[_0x52c4('0x37')]=_0xe0ad8d['attributes']['length']?_0xe0ad8d[_0x52c4('0x37')]:_0x2f829c[_0x52c4('0x36')];if(!_0xc41f96[_0x52c4('0x32')]['hasOwnProperty'](_0x52c4('0x39'))){_0xe0ad8d['limit']=qs[_0x52c4('0x20')](_0xc41f96['query'][_0x52c4('0x20')]);_0xe0ad8d['offset']=qs[_0x52c4('0x1e')](_0xc41f96[_0x52c4('0x32')][_0x52c4('0x1e')]);}_0xe0ad8d[_0x52c4('0x3a')]=qs[_0x52c4('0x3b')](_0xc41f96[_0x52c4('0x32')]['sort']);_0xe0ad8d[_0x52c4('0x3c')]=qs[_0x52c4('0x34')](_['pick'](_0xc41f96[_0x52c4('0x32')],_0x2f829c[_0x52c4('0x34')]),_0x44aeca);if(_0xc41f96[_0x52c4('0x32')][_0x52c4('0x3d')]){_0xe0ad8d[_0x52c4('0x3c')]=_[_0x52c4('0x3e')](_0xe0ad8d[_0x52c4('0x3c')],{'$or':_['map'](_0x44aeca,function(_0x15a37a){if(_0x15a37a[_0x52c4('0x2f')]!==_0x52c4('0x3f')){var _0x1c5268={};_0x1c5268[_0x15a37a[_0x52c4('0x2a')]]={'$like':'%'+_0xc41f96[_0x52c4('0x32')][_0x52c4('0x3d')]+'%'};return _0x1c5268;}})});}_0xe0ad8d=_[_0x52c4('0x3e')]({},_0xe0ad8d,_0xc41f96[_0x52c4('0x40')]);var _0x559d3a={'where':_0xe0ad8d[_0x52c4('0x3c')]};return db[_0x52c4('0x2d')][_0x52c4('0x21')](_0x559d3a)[_0x52c4('0x27')](function(_0x42c6c0){_0x15261b[_0x52c4('0x21')]=_0x42c6c0;if(_0xc41f96[_0x52c4('0x32')][_0x52c4('0x41')]){_0xe0ad8d[_0x52c4('0x42')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x52c4('0x43')](_0xe0ad8d);})[_0x52c4('0x27')](function(_0x39ac58){_0x15261b[_0x52c4('0x44')]=_0x39ac58;return _0x15261b;})['then'](respondWithFilteredResult(_0x2bb01f,_0xe0ad8d))[_0x52c4('0x45')](handleError(_0x2bb01f,null));};exports['show']=function(_0x7a7cbe,_0x7c0d1){var _0x20a5a6={'raw':![],'where':{'id':_0x7a7cbe[_0x52c4('0x46')]['id']}},_0x205beb={};_0x205beb[_0x52c4('0x36')]=_[_0x52c4('0x33')](db['DeskConfiguration'][_0x52c4('0x2e')]);_0x205beb[_0x52c4('0x32')]=_[_0x52c4('0x33')](_0x7a7cbe[_0x52c4('0x32')]);_0x205beb['filters']=_[_0x52c4('0x35')](_0x205beb[_0x52c4('0x36')],_0x205beb[_0x52c4('0x32')]);_0x20a5a6['attributes']=_[_0x52c4('0x35')](_0x205beb[_0x52c4('0x36')],qs[_0x52c4('0x38')](_0x7a7cbe[_0x52c4('0x32')][_0x52c4('0x38')]));_0x20a5a6['attributes']=_0x20a5a6['attributes']['length']?_0x20a5a6[_0x52c4('0x37')]:_0x205beb[_0x52c4('0x36')];if(_0x7a7cbe[_0x52c4('0x32')][_0x52c4('0x41')]){_0x20a5a6[_0x52c4('0x42')]=[{'all':!![]}];}_0x20a5a6=_[_0x52c4('0x3e')]({},_0x20a5a6,_0x7a7cbe[_0x52c4('0x40')]);return db[_0x52c4('0x2d')][_0x52c4('0x47')](_0x20a5a6)[_0x52c4('0x27')](handleEntityNotFound(_0x7c0d1,null))['then'](respondWithResult(_0x7c0d1,null))[_0x52c4('0x45')](handleError(_0x7c0d1,null));};exports[_0x52c4('0x48')]=function(_0x421c26,_0x546121){return db[_0x52c4('0x2d')]['create'](_0x421c26[_0x52c4('0x49')],{})['then'](respondWithResult(_0x546121,0xc9))['catch'](handleError(_0x546121,null));};exports[_0x52c4('0x26')]=function(_0x9f7f40,_0xe4c8f3){if(_0x9f7f40[_0x52c4('0x49')]['id']){delete _0x9f7f40[_0x52c4('0x49')]['id'];}return db[_0x52c4('0x2d')][_0x52c4('0x47')]({'where':{'id':_0x9f7f40[_0x52c4('0x46')]['id']}})[_0x52c4('0x27')](handleEntityNotFound(_0xe4c8f3,null))[_0x52c4('0x27')](saveUpdates(_0x9f7f40[_0x52c4('0x49')],null))[_0x52c4('0x27')](respondWithResult(_0xe4c8f3,null))[_0x52c4('0x45')](handleError(_0xe4c8f3,null));};exports[_0x52c4('0x4a')]=function(_0x3d0d71,_0x586ec9){return db[_0x52c4('0x2d')][_0x52c4('0x47')]({'where':{'id':_0x3d0d71[_0x52c4('0x46')]['id']}})[_0x52c4('0x27')](handleEntityNotFound(_0x586ec9,null))[_0x52c4('0x27')](removeEntity(_0x586ec9,null))['catch'](handleError(_0x586ec9,null));};exports[_0x52c4('0x4b')]=function(_0x43accc,_0x519204,_0x44c85d){var _0x457169={};var _0x55aa91={};var _0x95e83;var _0x26600b;return db[_0x52c4('0x2d')]['findOne']({'where':{'id':_0x43accc[_0x52c4('0x46')]['id']}})[_0x52c4('0x27')](handleEntityNotFound(_0x519204,null))['then'](function(_0xb6ffcf){if(_0xb6ffcf){_0x95e83=_0xb6ffcf;_0x55aa91[_0x52c4('0x36')]=_[_0x52c4('0x33')](db[_0x52c4('0x4c')]['rawAttributes']);_0x55aa91['query']=_[_0x52c4('0x33')](_0x43accc[_0x52c4('0x32')]);_0x55aa91[_0x52c4('0x34')]=_['intersection'](_0x55aa91[_0x52c4('0x36')],_0x55aa91[_0x52c4('0x32')]);_0x457169[_0x52c4('0x37')]=_[_0x52c4('0x35')](_0x55aa91[_0x52c4('0x36')],qs[_0x52c4('0x38')](_0x43accc['query'][_0x52c4('0x38')]));_0x457169[_0x52c4('0x37')]=_0x457169['attributes'][_0x52c4('0x4d')]?_0x457169['attributes']:_0x55aa91[_0x52c4('0x36')];_0x457169[_0x52c4('0x3a')]=qs[_0x52c4('0x3b')](_0x43accc[_0x52c4('0x32')]['sort']);_0x457169[_0x52c4('0x3c')]=qs['filters'](_[_0x52c4('0x4e')](_0x43accc[_0x52c4('0x32')],_0x55aa91['filters']));if(_0x43accc[_0x52c4('0x32')]['filter']){_0x457169[_0x52c4('0x3c')]=_['merge'](_0x457169[_0x52c4('0x3c')],{'$or':_[_0x52c4('0x31')](_0x457169[_0x52c4('0x37')],function(_0x518b7e){var _0x125a74={};_0x125a74[_0x518b7e]={'$like':'%'+_0x43accc['query'][_0x52c4('0x3d')]+'%'};return _0x125a74;})});}_0x457169=_[_0x52c4('0x3e')]({},_0x457169,_0x43accc[_0x52c4('0x40')]);return _0x95e83[_0x52c4('0x4b')](_0x457169);}})[_0x52c4('0x27')](function(_0x315a45){if(_0x315a45){_0x26600b=_0x315a45[_0x52c4('0x4d')];if(!_0x43accc[_0x52c4('0x32')][_0x52c4('0x4f')](_0x52c4('0x39'))){_0x457169[_0x52c4('0x20')]=qs[_0x52c4('0x20')](_0x43accc[_0x52c4('0x32')][_0x52c4('0x20')]);_0x457169[_0x52c4('0x1e')]=qs[_0x52c4('0x1e')](_0x43accc[_0x52c4('0x32')][_0x52c4('0x1e')]);}return _0x95e83[_0x52c4('0x4b')](_0x457169);}})[_0x52c4('0x27')](function(_0x24c312){if(_0x24c312){return _0x24c312?{'count':_0x26600b,'rows':_0x24c312}:null;}})[_0x52c4('0x27')](respondWithResult(_0x519204,null))['catch'](handleError(_0x519204,null));};exports[_0x52c4('0x50')]=function(_0x57fcd1,_0x372afb,_0x5a8566){var _0xa80900={};var _0x8751fa={};var _0x329178;var _0x2fc2e6;return db[_0x52c4('0x2d')]['findOne']({'where':{'id':_0x57fcd1[_0x52c4('0x46')]['id']}})[_0x52c4('0x27')](handleEntityNotFound(_0x372afb,null))[_0x52c4('0x27')](function(_0x536b98){if(_0x536b98){_0x329178=_0x536b98;_0x8751fa[_0x52c4('0x36')]=_[_0x52c4('0x33')](db[_0x52c4('0x4c')][_0x52c4('0x2e')]);_0x8751fa[_0x52c4('0x32')]=_[_0x52c4('0x33')](_0x57fcd1['query']);_0x8751fa[_0x52c4('0x34')]=_[_0x52c4('0x35')](_0x8751fa[_0x52c4('0x36')],_0x8751fa[_0x52c4('0x32')]);_0xa80900[_0x52c4('0x37')]=_[_0x52c4('0x35')](_0x8751fa['model'],qs[_0x52c4('0x38')](_0x57fcd1[_0x52c4('0x32')][_0x52c4('0x38')]));_0xa80900['attributes']=_0xa80900[_0x52c4('0x37')][_0x52c4('0x4d')]?_0xa80900[_0x52c4('0x37')]:_0x8751fa[_0x52c4('0x36')];_0xa80900['order']=qs['sort'](_0x57fcd1['query'][_0x52c4('0x3b')]);_0xa80900[_0x52c4('0x3c')]=qs['filters'](_[_0x52c4('0x4e')](_0x57fcd1[_0x52c4('0x32')],_0x8751fa[_0x52c4('0x34')]));if(_0x57fcd1[_0x52c4('0x32')][_0x52c4('0x3d')]){_0xa80900['where']=_[_0x52c4('0x3e')](_0xa80900['where'],{'$or':_[_0x52c4('0x31')](_0xa80900['attributes'],function(_0x478d14){var _0x56edc7={};_0x56edc7[_0x478d14]={'$like':'%'+_0x57fcd1[_0x52c4('0x32')][_0x52c4('0x3d')]+'%'};return _0x56edc7;})});}_0xa80900=_[_0x52c4('0x3e')]({},_0xa80900,_0x57fcd1['options']);return _0x329178[_0x52c4('0x50')](_0xa80900);}})[_0x52c4('0x27')](function(_0x440c43){if(_0x440c43){_0x2fc2e6=_0x440c43[_0x52c4('0x4d')];if(!_0x57fcd1[_0x52c4('0x32')][_0x52c4('0x4f')](_0x52c4('0x39'))){_0xa80900['limit']=qs[_0x52c4('0x20')](_0x57fcd1[_0x52c4('0x32')]['limit']);_0xa80900[_0x52c4('0x1e')]=qs[_0x52c4('0x1e')](_0x57fcd1[_0x52c4('0x32')][_0x52c4('0x1e')]);}return _0x329178['getSubjects'](_0xa80900);}})['then'](function(_0x55a8cb){if(_0x55a8cb){return _0x55a8cb?{'count':_0x2fc2e6,'rows':_0x55a8cb}:null;}})[_0x52c4('0x27')](respondWithResult(_0x372afb,null))[_0x52c4('0x45')](handleError(_0x372afb,null));};exports[_0x52c4('0x51')]=function(_0xf90e40,_0x32c128,_0x3b4e4e){var _0x200187={};var _0xb32547={};var _0x318157;var _0x41652b;return db[_0x52c4('0x2d')]['findOne']({'where':{'id':_0xf90e40[_0x52c4('0x46')]['id']}})[_0x52c4('0x27')](handleEntityNotFound(_0x32c128,null))[_0x52c4('0x27')](function(_0x4d453f){if(_0x4d453f){_0x318157=_0x4d453f;_0xb32547[_0x52c4('0x36')]=_[_0x52c4('0x33')](db['DeskField'][_0x52c4('0x2e')]);_0xb32547[_0x52c4('0x32')]=_[_0x52c4('0x33')](_0xf90e40[_0x52c4('0x32')]);_0xb32547[_0x52c4('0x34')]=_['intersection'](_0xb32547[_0x52c4('0x36')],_0xb32547[_0x52c4('0x32')]);_0x200187[_0x52c4('0x37')]=_[_0x52c4('0x35')](_0xb32547[_0x52c4('0x36')],qs['fields'](_0xf90e40[_0x52c4('0x32')][_0x52c4('0x38')]));_0x200187[_0x52c4('0x37')]=_0x200187[_0x52c4('0x37')][_0x52c4('0x4d')]?_0x200187[_0x52c4('0x37')]:_0xb32547[_0x52c4('0x36')];_0x200187[_0x52c4('0x3a')]=qs[_0x52c4('0x3b')](_0xf90e40[_0x52c4('0x32')][_0x52c4('0x3b')]);_0x200187[_0x52c4('0x3c')]=qs['filters'](_[_0x52c4('0x4e')](_0xf90e40[_0x52c4('0x32')],_0xb32547[_0x52c4('0x34')]));if(_0xf90e40[_0x52c4('0x32')][_0x52c4('0x3d')]){_0x200187[_0x52c4('0x3c')]=_[_0x52c4('0x3e')](_0x200187[_0x52c4('0x3c')],{'$or':_[_0x52c4('0x31')](_0x200187[_0x52c4('0x37')],function(_0x38ed87){var _0x559812={};_0x559812[_0x38ed87]={'$like':'%'+_0xf90e40[_0x52c4('0x32')]['filter']+'%'};return _0x559812;})});}_0x200187=_[_0x52c4('0x3e')]({},_0x200187,_0xf90e40[_0x52c4('0x40')]);return _0x318157['getDescriptions'](_0x200187);}})[_0x52c4('0x27')](function(_0x5936b0){if(_0x5936b0){_0x41652b=_0x5936b0[_0x52c4('0x4d')];if(!_0xf90e40[_0x52c4('0x32')][_0x52c4('0x4f')](_0x52c4('0x39'))){_0x200187[_0x52c4('0x20')]=qs['limit'](_0xf90e40['query'][_0x52c4('0x20')]);_0x200187[_0x52c4('0x1e')]=qs[_0x52c4('0x1e')](_0xf90e40[_0x52c4('0x32')][_0x52c4('0x1e')]);}return _0x318157[_0x52c4('0x51')](_0x200187);}})[_0x52c4('0x27')](function(_0x28a0c9){if(_0x28a0c9){return _0x28a0c9?{'count':_0x41652b,'rows':_0x28a0c9}:null;}})[_0x52c4('0x27')](respondWithResult(_0x32c128,null))['catch'](handleError(_0x32c128,null));};exports[_0x52c4('0x52')]=function(_0x526fc1,_0x4fa92a,_0x1d6fae){var _0x28a011={};var _0x1b125d={};var _0x36236f;var _0x432066;return db['DeskConfiguration'][_0x52c4('0x53')]({'where':{'id':_0x526fc1[_0x52c4('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fa92a,null))[_0x52c4('0x27')](function(_0x5be39a){if(_0x5be39a){_0x36236f=_0x5be39a;_0x1b125d[_0x52c4('0x36')]=_['keys'](db[_0x52c4('0x54')][_0x52c4('0x2e')]);_0x1b125d[_0x52c4('0x32')]=_[_0x52c4('0x33')](_0x526fc1[_0x52c4('0x32')]);_0x1b125d[_0x52c4('0x34')]=_[_0x52c4('0x35')](_0x1b125d[_0x52c4('0x36')],_0x1b125d['query']);_0x28a011['attributes']=_[_0x52c4('0x35')](_0x1b125d[_0x52c4('0x36')],qs[_0x52c4('0x38')](_0x526fc1[_0x52c4('0x32')][_0x52c4('0x38')]));_0x28a011[_0x52c4('0x37')]=_0x28a011['attributes']['length']?_0x28a011[_0x52c4('0x37')]:_0x1b125d[_0x52c4('0x36')];_0x28a011[_0x52c4('0x3a')]=qs[_0x52c4('0x3b')](_0x526fc1[_0x52c4('0x32')][_0x52c4('0x3b')]);_0x28a011[_0x52c4('0x3c')]=qs[_0x52c4('0x34')](_['pick'](_0x526fc1[_0x52c4('0x32')],_0x1b125d[_0x52c4('0x34')]));if(_0x526fc1[_0x52c4('0x32')][_0x52c4('0x3d')]){_0x28a011[_0x52c4('0x3c')]=_[_0x52c4('0x3e')](_0x28a011[_0x52c4('0x3c')],{'$or':_[_0x52c4('0x31')](_0x28a011[_0x52c4('0x37')],function(_0x4ccf6b){var _0x47c9a6={};_0x47c9a6[_0x4ccf6b]={'$like':'%'+_0x526fc1[_0x52c4('0x32')][_0x52c4('0x3d')]+'%'};return _0x47c9a6;})});}_0x28a011=_[_0x52c4('0x3e')]({},_0x28a011,_0x526fc1['options']);return _0x36236f[_0x52c4('0x52')](_0x28a011);}})[_0x52c4('0x27')](function(_0x27e20){if(_0x27e20){_0x432066=_0x27e20['length'];if(!_0x526fc1[_0x52c4('0x32')][_0x52c4('0x4f')](_0x52c4('0x39'))){_0x28a011[_0x52c4('0x20')]=qs[_0x52c4('0x20')](_0x526fc1[_0x52c4('0x32')]['limit']);_0x28a011[_0x52c4('0x1e')]=qs[_0x52c4('0x1e')](_0x526fc1[_0x52c4('0x32')][_0x52c4('0x1e')]);}return _0x36236f[_0x52c4('0x52')](_0x28a011);}})[_0x52c4('0x27')](function(_0x50b9a2){if(_0x50b9a2){return _0x50b9a2?{'count':_0x432066,'rows':_0x50b9a2}:null;}})['then'](respondWithResult(_0x4fa92a,null))[_0x52c4('0x45')](handleError(_0x4fa92a,null));};exports[_0x52c4('0x55')]=function(_0xfc8c3a,_0x323d48,_0x4db3f7){if(_0xfc8c3a['body']['id']){delete _0xfc8c3a[_0x52c4('0x49')]['id'];}return db['DeskConfiguration'][_0x52c4('0x53')]({'where':{'id':_0xfc8c3a[_0x52c4('0x46')]['id']}})[_0x52c4('0x27')](handleEntityNotFound(_0x323d48,null))[_0x52c4('0x27')](function(_0x2aa7fc){if(_0x2aa7fc){return _0x2aa7fc[_0x52c4('0x55')](_0xfc8c3a[_0x52c4('0x49')][_0x52c4('0x56')]||[]);}return null;})[_0x52c4('0x27')](respondWithResult(_0x323d48,null))[_0x52c4('0x45')](handleError(_0x323d48,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 11a4510..606c2ba 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 _0xe815=['define','int_desk_configurations','lodash','util','api','moment','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x1db5f9,_0x33dde1){var _0x3efa84=function(_0x542042){while(--_0x542042){_0x1db5f9['push'](_0x1db5f9['shift']());}};_0x3efa84(++_0x33dde1);}(_0xe815,0x7a));var _0x5e81=function(_0x5690b6,_0x5273b3){_0x5690b6=_0x5690b6-0x0;var _0x2b39cb=_0xe815[_0x5690b6];return _0x2b39cb;};'use strict';var _=require(_0x5e81('0x0'));var util=require(_0x5e81('0x1'));var logger=require('../../config/logger')(_0x5e81('0x2'));var moment=require(_0x5e81('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e81('0x4'));var rimraf=require(_0x5e81('0x5'));var config=require(_0x5e81('0x6'));var attributes=require(_0x5e81('0x7'));module['exports']=function(_0xae5ce,_0x590796){return _0xae5ce[_0x5e81('0x8')]('DeskConfiguration',attributes,{'tableName':_0x5e81('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80c7=['api','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x2ba9e5,_0x227ce1){var _0x5a8634=function(_0x382218){while(--_0x382218){_0x2ba9e5['push'](_0x2ba9e5['shift']());}};_0x5a8634(++_0x227ce1);}(_0x80c7,0x8d));var _0x780c=function(_0x3a2476,_0x44ffa0){_0x3a2476=_0x3a2476-0x0;var _0x508de1=_0x80c7[_0x3a2476];return _0x508de1;};'use strict';var _=require(_0x780c('0x0'));var util=require(_0x780c('0x1'));var logger=require(_0x780c('0x2'))(_0x780c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x780c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x780c('0x5'));var config=require(_0x780c('0x6'));var attributes=require(_0x780c('0x7'));module[_0x780c('0x8')]=function(_0x26db15,_0x93f0bb){return _0x26db15[_0x780c('0x9')](_0x780c('0xa'),attributes,{'tableName':_0x780c('0xb'),'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 8e57284..61b2d0b 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 _0x6f3e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0xcc0b4a,_0x1be954){var _0x23e29d=function(_0x1d97ea){while(--_0x1d97ea){_0xcc0b4a['push'](_0xcc0b4a['shift']());}};_0x23e29d(++_0x1be954);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe6f3('0x0'));var util=require(_0xe6f3('0x1'));var moment=require(_0xe6f3('0x2'));var BPromise=require(_0xe6f3('0x3'));var rs=require(_0xe6f3('0x4'));var fs=require('fs');var Redis=require(_0xe6f3('0x5'));var db=require(_0xe6f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6f3('0x7'))(_0xe6f3('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6f3('0x9'));var client=jayson[_0xe6f3('0xa')][_0xe6f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b59eb,_0x44cedc,_0x17242d){return new BPromise(function(_0x53d62d,_0x4ba888){return client[_0xe6f3('0xc')](_0x5b59eb,_0x17242d)['then'](function(_0x331856){logger[_0xe6f3('0xd')](_0xe6f3('0xe'),_0x44cedc,_0xe6f3('0xf'));logger[_0xe6f3('0x10')](_0xe6f3('0x11'),_0x44cedc,'request\x20sent',JSON[_0xe6f3('0x12')](_0x331856));if(_0x331856['error']){if(_0x331856[_0xe6f3('0x13')][_0xe6f3('0x14')]===0x1f4){logger[_0xe6f3('0x13')](_0xe6f3('0xe'),_0x44cedc,_0x331856['error'][_0xe6f3('0x15')]);return _0x4ba888(_0x331856[_0xe6f3('0x13')][_0xe6f3('0x15')]);}logger[_0xe6f3('0x13')](_0xe6f3('0xe'),_0x44cedc,_0x331856[_0xe6f3('0x13')][_0xe6f3('0x15')]);return _0x53d62d(_0x331856['error'][_0xe6f3('0x15')]);}else{logger[_0xe6f3('0xd')](_0xe6f3('0xe'),_0x44cedc,_0xe6f3('0xf'));_0x53d62d(_0x331856[_0xe6f3('0x16')]['message']);}})['catch'](function(_0x410177){logger[_0xe6f3('0x13')](_0xe6f3('0xe'),_0x44cedc,_0x410177);_0x4ba888(_0x410177);});});} \ No newline at end of file +var _0x5532=['then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request'];(function(_0x3a6d14,_0x5a6381){var _0x18a307=function(_0xf7f902){while(--_0xf7f902){_0x3a6d14['push'](_0x3a6d14['shift']());}};_0x18a307(++_0x5a6381);}(_0x5532,0x19a));var _0x2553=function(_0x3010fb,_0x4504fc){_0x3010fb=_0x3010fb-0x0;var _0x2a153d=_0x5532[_0x3010fb];return _0x2a153d;};'use strict';var _=require(_0x2553('0x0'));var util=require(_0x2553('0x1'));var moment=require(_0x2553('0x2'));var BPromise=require('bluebird');var rs=require(_0x2553('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2553('0x4'))['db'];var utils=require(_0x2553('0x5'));var logger=require(_0x2553('0x6'))('rpc');var config=require(_0x2553('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2553('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d718e,_0x568778,_0x302c6d){return new BPromise(function(_0x40dc15,_0x338583){return client[_0x2553('0x9')](_0x2d718e,_0x302c6d)[_0x2553('0xa')](function(_0x183d20){logger[_0x2553('0xb')](_0x2553('0xc'),_0x568778,_0x2553('0xd'));logger[_0x2553('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x568778,_0x2553('0xd'),JSON[_0x2553('0xf')](_0x183d20));if(_0x183d20[_0x2553('0x10')]){if(_0x183d20['error'][_0x2553('0x11')]===0x1f4){logger[_0x2553('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x568778,_0x183d20['error'][_0x2553('0x12')]);return _0x338583(_0x183d20['error'][_0x2553('0x12')]);}logger[_0x2553('0x10')](_0x2553('0xc'),_0x568778,_0x183d20['error']['message']);return _0x40dc15(_0x183d20[_0x2553('0x10')][_0x2553('0x12')]);}else{logger[_0x2553('0xb')](_0x2553('0xc'),_0x568778,_0x2553('0xd'));_0x40dc15(_0x183d20[_0x2553('0x13')]['message']);}})[_0x2553('0x14')](function(_0x4db92a){logger['error'](_0x2553('0xc'),_0x568778,_0x4db92a);_0x338583(_0x4db92a);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7da08fa..032cc7f 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 _0xafff=['destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update','delete'];(function(_0x166c71,_0x2e0dbe){var _0xadbf32=function(_0x251cc9){while(--_0x251cc9){_0x166c71['push'](_0x166c71['shift']());}};_0xadbf32(++_0x2e0dbe);}(_0xafff,0x16a));var _0xfaff=function(_0x5cabe8,_0x199b71){_0x5cabe8=_0x5cabe8-0x0;var _0x1ed475=_0xafff[_0x5cabe8];return _0x1ed475;};'use strict';var multer=require(_0xfaff('0x0'));var util=require(_0xfaff('0x1'));var path=require(_0xfaff('0x2'));var timeout=require('connect-timeout');var express=require(_0xfaff('0x3'));var router=express['Router']();var fs_extra=require(_0xfaff('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfaff('0x5'));var config=require(_0xfaff('0x6'));var controller=require('./intDeskField.controller');router[_0xfaff('0x7')]('/',auth['isAuthenticated'](),controller[_0xfaff('0x8')]);router[_0xfaff('0x7')](_0xfaff('0x9'),auth[_0xfaff('0xa')](),controller[_0xfaff('0xb')]);router[_0xfaff('0xc')]('/',auth[_0xfaff('0xa')](),controller[_0xfaff('0xd')]);router['put']('/:id',auth[_0xfaff('0xa')](),controller[_0xfaff('0xe')]);router[_0xfaff('0xf')](_0xfaff('0x9'),auth[_0xfaff('0xa')](),controller[_0xfaff('0x10')]);module[_0xfaff('0x11')]=router; \ No newline at end of file +var _0x311a=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','post','create','put','/:id','update','delete'];(function(_0x5a32c4,_0x432245){var _0x4b24a8=function(_0x4d1d0a){while(--_0x4d1d0a){_0x5a32c4['push'](_0x5a32c4['shift']());}};_0x4b24a8(++_0x432245);}(_0x311a,0xf9));var _0xa311=function(_0x5e7f1d,_0x3f0936){_0x5e7f1d=_0x5e7f1d-0x0;var _0x5cd101=_0x311a[_0x5e7f1d];return _0x5cd101;};'use strict';var multer=require(_0xa311('0x0'));var util=require(_0xa311('0x1'));var path=require('path');var timeout=require(_0xa311('0x2'));var express=require(_0xa311('0x3'));var router=express['Router']();var fs_extra=require(_0xa311('0x4'));var auth=require(_0xa311('0x5'));var interaction=require(_0xa311('0x6'));var config=require(_0xa311('0x7'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0xa311('0x8')](),controller['index']);router[_0xa311('0x9')]('/:id',auth[_0xa311('0x8')](),controller[_0xa311('0xa')]);router[_0xa311('0xb')]('/',auth[_0xa311('0x8')](),controller[_0xa311('0xc')]);router[_0xa311('0xd')](_0xa311('0xe'),auth[_0xa311('0x8')](),controller[_0xa311('0xf')]);router[_0xa311('0x10')](_0xa311('0xe'),auth[_0xa311('0x8')](),controller[_0xa311('0x11')]);module[_0xa311('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 c0647cd..149acf3 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 _0xe9a6=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xe9a6,0xe9));var _0x6e9a=function(_0x4d14d3,_0x1c515c){_0x4d14d3=_0x4d14d3-0x0;var _0x2e41e8=_0xe9a6[_0x4d14d3];return _0x2e41e8;};'use strict';var Sequelize=require(_0x6e9a('0x0'));module[_0x6e9a('0x1')]={'type':{'type':Sequelize[_0x6e9a('0x2')](_0x6e9a('0x3'),_0x6e9a('0x4'),_0x6e9a('0x5'),_0x6e9a('0x6'),'picklist'),'defaultValue':_0x6e9a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6e9a('0x7')]},'keyType':{'type':Sequelize[_0x6e9a('0x2')](_0x6e9a('0x3'),_0x6e9a('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x6e9a('0x7')]},'idField':{'type':Sequelize[_0x6e9a('0x7')]},'nameField':{'type':Sequelize[_0x6e9a('0x7')]},'customField':{'type':Sequelize[_0x6e9a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xff79=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x28fc08,_0x18b054){var _0xa6a26b=function(_0x3933b2){while(--_0x3933b2){_0x28fc08['push'](_0x28fc08['shift']());}};_0xa6a26b(++_0x18b054);}(_0xff79,0xcf));var _0x9ff7=function(_0xaeb8b1,_0x35725e){_0xaeb8b1=_0xaeb8b1-0x0;var _0x550611=_0xff79[_0xaeb8b1];return _0x550611;};'use strict';var Sequelize=require(_0x9ff7('0x0'));module[_0x9ff7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9ff7('0x2'),_0x9ff7('0x3'),_0x9ff7('0x4'),_0x9ff7('0x5'),_0x9ff7('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9ff7('0x7')]},'key':{'type':Sequelize[_0x9ff7('0x7')]},'keyType':{'type':Sequelize[_0x9ff7('0x8')](_0x9ff7('0x2'),'variable',_0x9ff7('0x4'))},'keyContent':{'type':Sequelize[_0x9ff7('0x7')]},'idField':{'type':Sequelize[_0x9ff7('0x7')]},'nameField':{'type':Sequelize[_0x9ff7('0x7')]},'customField':{'type':Sequelize[_0x9ff7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 9ac1ef1..fb034e5 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 _0x867e=['show','params','rawAttributes','length','options','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','map','DeskField','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','rows'];(function(_0x433e54,_0x2d6cb2){var _0x17d995=function(_0x105e8a){while(--_0x105e8a){_0x433e54['push'](_0x433e54['shift']());}};_0x17d995(++_0x2d6cb2);}(_0x867e,0x1c5));var _0xe867=function(_0x482b0e,_0x4ca281){_0x482b0e=_0x482b0e-0x0;var _0x4ec637=_0x867e[_0x482b0e];return _0x4ec637;};'use strict';var emlformat=require(_0xe867('0x0'));var rimraf=require(_0xe867('0x1'));var zipdir=require(_0xe867('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe867('0x3'));var moment=require('moment');var BPromise=require(_0xe867('0x4'));var Mustache=require('mustache');var util=require(_0xe867('0x5'));var path=require(_0xe867('0x6'));var sox=require(_0xe867('0x7'));var csv=require(_0xe867('0x8'));var ejs=require(_0xe867('0x9'));var fs=require('fs');var fs_extra=require(_0xe867('0xa'));var _=require(_0xe867('0xb'));var squel=require(_0xe867('0xc'));var crypto=require(_0xe867('0xd'));var jsforce=require(_0xe867('0xe'));var deskjs=require(_0xe867('0xf'));var toCsv=require(_0xe867('0x8'));var querystring=require(_0xe867('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe867('0x11'));var as=require(_0xe867('0x12'));var hardwareService=require(_0xe867('0x13'));var logger=require(_0xe867('0x14'))(_0xe867('0x15'));var utils=require(_0xe867('0x16'));var config=require(_0xe867('0x17'));var licenseUtil=require(_0xe867('0x18'));var db=require(_0xe867('0x19'))['db'];function respondWithStatusCode(_0x7d193,_0x2d0fcf){_0x2d0fcf=_0x2d0fcf||0xcc;return function(_0x3faaf8){if(_0x3faaf8){return _0x7d193[_0xe867('0x1a')](_0x2d0fcf);}return _0x7d193[_0xe867('0x1b')](_0x2d0fcf)['end']();};}function respondWithResult(_0x4faff7,_0x773113){_0x773113=_0x773113||0xc8;return function(_0x321848){if(_0x321848){return _0x4faff7['status'](_0x773113)[_0xe867('0x1c')](_0x321848);}};}function respondWithFilteredResult(_0x92abf0,_0x559881){return function(_0x477147){if(_0x477147){var _0x5a3325=typeof _0x559881[_0xe867('0x1d')]==='undefined'&&typeof _0x559881[_0xe867('0x1e')]===_0xe867('0x1f');var _0x3a45bb=_0x477147[_0xe867('0x20')];var _0x455aae=_0x5a3325?0x0:_0x559881['offset'];var _0x54c971=_0x5a3325?_0x477147['count']:_0x559881[_0xe867('0x1d')]+_0x559881['limit'];var _0x2128f9;if(_0x54c971>=_0x3a45bb){_0x54c971=_0x3a45bb;_0x2128f9=0xc8;}else{_0x2128f9=0xce;}_0x92abf0[_0xe867('0x1b')](_0x2128f9);return _0x92abf0[_0xe867('0x21')](_0xe867('0x22'),_0x455aae+'-'+_0x54c971+'/'+_0x3a45bb)[_0xe867('0x1c')](_0x477147);}return null;};}function patchUpdates(_0x2f9034){return function(_0x3c5d85){try{jsonpatch[_0xe867('0x23')](_0x3c5d85,_0x2f9034,!![]);}catch(_0x5aeda6){return BPromise[_0xe867('0x24')](_0x5aeda6);}return _0x3c5d85['save']();};}function saveUpdates(_0x573993,_0x138dec){return function(_0x120cb7){if(_0x120cb7){return _0x120cb7[_0xe867('0x25')](_0x573993)['then'](function(_0x491dd8){return _0x491dd8;});}return null;};}function removeEntity(_0x537c4d,_0x226e92){return function(_0x870c94){if(_0x870c94){return _0x870c94[_0xe867('0x26')]()[_0xe867('0x27')](function(){_0x537c4d[_0xe867('0x1b')](0xcc)[_0xe867('0x28')]();});}};}function handleEntityNotFound(_0x583c39,_0x21cd0a){return function(_0x110b2c){if(!_0x110b2c){_0x583c39[_0xe867('0x1a')](0x194);}return _0x110b2c;};}function handleError(_0x1674a3,_0x539b49){_0x539b49=_0x539b49||0x1f4;return function(_0x16d570){logger[_0xe867('0x29')](_0x16d570[_0xe867('0x2a')]);if(_0x16d570[_0xe867('0x2b')]){delete _0x16d570[_0xe867('0x2b')];}_0x1674a3[_0xe867('0x1b')](_0x539b49)[_0xe867('0x2c')](_0x16d570);};}exports['index']=function(_0x29c190,_0x41d7ae){var _0x214a80={},_0x3abcee={},_0xe210c={'count':0x0,'rows':[]};var _0xc269eb=_[_0xe867('0x2d')](db[_0xe867('0x2e')]['rawAttributes'],function(_0xe7d7c8){return{'name':_0xe7d7c8[_0xe867('0x2f')],'type':_0xe7d7c8[_0xe867('0x30')]['key']};});_0x3abcee[_0xe867('0x31')]=_[_0xe867('0x2d')](_0xc269eb,'name');_0x3abcee[_0xe867('0x32')]=_['keys'](_0x29c190['query']);_0x3abcee[_0xe867('0x33')]=_['intersection'](_0x3abcee[_0xe867('0x31')],_0x3abcee[_0xe867('0x32')]);_0x214a80['attributes']=_[_0xe867('0x34')](_0x3abcee[_0xe867('0x31')],qs['fields'](_0x29c190[_0xe867('0x32')][_0xe867('0x35')]));_0x214a80[_0xe867('0x36')]=_0x214a80[_0xe867('0x36')]['length']?_0x214a80[_0xe867('0x36')]:_0x3abcee['model'];if(!_0x29c190['query'][_0xe867('0x37')](_0xe867('0x38'))){_0x214a80['limit']=qs[_0xe867('0x1e')](_0x29c190[_0xe867('0x32')]['limit']);_0x214a80[_0xe867('0x1d')]=qs[_0xe867('0x1d')](_0x29c190[_0xe867('0x32')][_0xe867('0x1d')]);}_0x214a80['order']=qs[_0xe867('0x39')](_0x29c190[_0xe867('0x32')][_0xe867('0x39')]);_0x214a80[_0xe867('0x3a')]=qs[_0xe867('0x33')](_[_0xe867('0x3b')](_0x29c190[_0xe867('0x32')],_0x3abcee[_0xe867('0x33')]),_0xc269eb);if(_0x29c190['query']['filter']){_0x214a80[_0xe867('0x3a')]=_[_0xe867('0x3c')](_0x214a80[_0xe867('0x3a')],{'$or':_['map'](_0xc269eb,function(_0x25a06f){if(_0x25a06f[_0xe867('0x30')]!==_0xe867('0x3d')){var _0x71dc31={};_0x71dc31[_0x25a06f[_0xe867('0x2b')]]={'$like':'%'+_0x29c190[_0xe867('0x32')]['filter']+'%'};return _0x71dc31;}})});}_0x214a80=_[_0xe867('0x3c')]({},_0x214a80,_0x29c190['options']);var _0x5406be={'where':_0x214a80[_0xe867('0x3a')]};return db[_0xe867('0x2e')][_0xe867('0x20')](_0x5406be)[_0xe867('0x27')](function(_0x48a61a){_0xe210c['count']=_0x48a61a;if(_0x29c190[_0xe867('0x32')][_0xe867('0x3e')]){_0x214a80[_0xe867('0x3f')]=[{'all':!![]}];}return db[_0xe867('0x2e')]['findAll'](_0x214a80);})['then'](function(_0x15e056){_0xe210c[_0xe867('0x40')]=_0x15e056;return _0xe210c;})[_0xe867('0x27')](respondWithFilteredResult(_0x41d7ae,_0x214a80))['catch'](handleError(_0x41d7ae,null));};exports[_0xe867('0x41')]=function(_0x371f3e,_0x1e2df1){var _0x3a6c93={'raw':!![],'where':{'id':_0x371f3e[_0xe867('0x42')]['id']}},_0x2a4fca={};_0x2a4fca[_0xe867('0x31')]=_['keys'](db[_0xe867('0x2e')][_0xe867('0x43')]);_0x2a4fca[_0xe867('0x32')]=_['keys'](_0x371f3e[_0xe867('0x32')]);_0x2a4fca['filters']=_['intersection'](_0x2a4fca['model'],_0x2a4fca[_0xe867('0x32')]);_0x3a6c93[_0xe867('0x36')]=_[_0xe867('0x34')](_0x2a4fca[_0xe867('0x31')],qs[_0xe867('0x35')](_0x371f3e[_0xe867('0x32')]['fields']));_0x3a6c93[_0xe867('0x36')]=_0x3a6c93[_0xe867('0x36')][_0xe867('0x44')]?_0x3a6c93[_0xe867('0x36')]:_0x2a4fca['model'];if(_0x371f3e[_0xe867('0x32')][_0xe867('0x3e')]){_0x3a6c93[_0xe867('0x3f')]=[{'all':!![]}];}_0x3a6c93=_['merge']({},_0x3a6c93,_0x371f3e[_0xe867('0x45')]);return db['DeskField'][_0xe867('0x46')](_0x3a6c93)[_0xe867('0x27')](handleEntityNotFound(_0x1e2df1,null))['then'](respondWithResult(_0x1e2df1,null))['catch'](handleError(_0x1e2df1,null));};exports[_0xe867('0x47')]=function(_0x43e6fc,_0x3073e5){return db['DeskField']['create'](_0x43e6fc[_0xe867('0x48')],{})[_0xe867('0x27')](respondWithResult(_0x3073e5,0xc9))[_0xe867('0x49')](handleError(_0x3073e5,null));};exports[_0xe867('0x25')]=function(_0x132bb1,_0x50c442){if(_0x132bb1[_0xe867('0x48')]['id']){delete _0x132bb1[_0xe867('0x48')]['id'];}return db['DeskField'][_0xe867('0x46')]({'where':{'id':_0x132bb1[_0xe867('0x42')]['id']}})[_0xe867('0x27')](handleEntityNotFound(_0x50c442,null))[_0xe867('0x27')](saveUpdates(_0x132bb1[_0xe867('0x48')],null))[_0xe867('0x27')](respondWithResult(_0x50c442,null))[_0xe867('0x49')](handleError(_0x50c442,null));};exports['destroy']=function(_0x236fb4,_0x13be21){return db[_0xe867('0x2e')][_0xe867('0x46')]({'where':{'id':_0x236fb4[_0xe867('0x42')]['id']}})[_0xe867('0x27')](handleEntityNotFound(_0x13be21,null))[_0xe867('0x27')](removeEntity(_0x13be21,null))[_0xe867('0x49')](handleError(_0x13be21,null));}; \ No newline at end of file +var _0xc0a4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','DeskField','includeAll','include','rows','catch','show','params','intersection','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x2de63a,_0x51fcef){_0x2de63a=_0x2de63a-0x0;var _0x44ba04=_0xc0a4[_0x2de63a];return _0x44ba04;};'use strict';var emlformat=require(_0x4c0a('0x0'));var rimraf=require(_0x4c0a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c0a('0x2'));var rp=require('request-promise');var moment=require(_0x4c0a('0x3'));var BPromise=require(_0x4c0a('0x4'));var Mustache=require(_0x4c0a('0x5'));var util=require(_0x4c0a('0x6'));var path=require(_0x4c0a('0x7'));var sox=require(_0x4c0a('0x8'));var csv=require(_0x4c0a('0x9'));var ejs=require(_0x4c0a('0xa'));var fs=require('fs');var fs_extra=require(_0x4c0a('0xb'));var _=require(_0x4c0a('0xc'));var squel=require('squel');var crypto=require(_0x4c0a('0xd'));var jsforce=require(_0x4c0a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4c0a('0x9'));var querystring=require(_0x4c0a('0xf'));var Papa=require('papaparse');var Redis=require(_0x4c0a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4c0a('0x11'));var as=require(_0x4c0a('0x12'));var hardwareService=require(_0x4c0a('0x13'));var logger=require(_0x4c0a('0x14'))(_0x4c0a('0x15'));var utils=require(_0x4c0a('0x16'));var config=require(_0x4c0a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c0a('0x18'))['db'];function respondWithStatusCode(_0x5e42bd,_0x556fee){_0x556fee=_0x556fee||0xcc;return function(_0x333bb4){if(_0x333bb4){return _0x5e42bd['sendStatus'](_0x556fee);}return _0x5e42bd['status'](_0x556fee)['end']();};}function respondWithResult(_0x38e904,_0x211424){_0x211424=_0x211424||0xc8;return function(_0x3156e1){if(_0x3156e1){return _0x38e904[_0x4c0a('0x19')](_0x211424)['json'](_0x3156e1);}};}function respondWithFilteredResult(_0x117ac8,_0x80b5be){return function(_0x5117ee){if(_0x5117ee){var _0x1cea0c=typeof _0x80b5be['offset']===_0x4c0a('0x1a')&&typeof _0x80b5be[_0x4c0a('0x1b')]==='undefined';var _0x31e8cf=_0x5117ee[_0x4c0a('0x1c')];var _0x58a419=_0x1cea0c?0x0:_0x80b5be[_0x4c0a('0x1d')];var _0x3fc2c5=_0x1cea0c?_0x5117ee[_0x4c0a('0x1c')]:_0x80b5be['offset']+_0x80b5be[_0x4c0a('0x1b')];var _0xad0b94;if(_0x3fc2c5>=_0x31e8cf){_0x3fc2c5=_0x31e8cf;_0xad0b94=0xc8;}else{_0xad0b94=0xce;}_0x117ac8[_0x4c0a('0x19')](_0xad0b94);return _0x117ac8[_0x4c0a('0x1e')](_0x4c0a('0x1f'),_0x58a419+'-'+_0x3fc2c5+'/'+_0x31e8cf)['json'](_0x5117ee);}return null;};}function patchUpdates(_0x22355c){return function(_0x1f2d2e){try{jsonpatch['apply'](_0x1f2d2e,_0x22355c,!![]);}catch(_0x2d0b41){return BPromise['reject'](_0x2d0b41);}return _0x1f2d2e[_0x4c0a('0x20')]();};}function saveUpdates(_0x4cc3f3,_0x3d5dd8){return function(_0x35bc50){if(_0x35bc50){return _0x35bc50[_0x4c0a('0x21')](_0x4cc3f3)['then'](function(_0x238725){return _0x238725;});}return null;};}function removeEntity(_0x3a83a6,_0xfb4530){return function(_0x1a07cd){if(_0x1a07cd){return _0x1a07cd[_0x4c0a('0x22')]()[_0x4c0a('0x23')](function(){_0x3a83a6[_0x4c0a('0x19')](0xcc)[_0x4c0a('0x24')]();});}};}function handleEntityNotFound(_0x12e49e,_0x400063){return function(_0x2151a8){if(!_0x2151a8){_0x12e49e[_0x4c0a('0x25')](0x194);}return _0x2151a8;};}function handleError(_0x45215b,_0x4bd0bc){_0x4bd0bc=_0x4bd0bc||0x1f4;return function(_0x583c22){logger[_0x4c0a('0x26')](_0x583c22[_0x4c0a('0x27')]);if(_0x583c22[_0x4c0a('0x28')]){delete _0x583c22[_0x4c0a('0x28')];}_0x45215b[_0x4c0a('0x19')](_0x4bd0bc)[_0x4c0a('0x29')](_0x583c22);};}exports[_0x4c0a('0x2a')]=function(_0x2a14f9,_0x5ce007){var _0x41d2de={},_0x3ef6cc={},_0x4276d8={'count':0x0,'rows':[]};var _0x5709ee=_['map'](db['DeskField'][_0x4c0a('0x2b')],function(_0x5858b3){return{'name':_0x5858b3[_0x4c0a('0x2c')],'type':_0x5858b3[_0x4c0a('0x2d')][_0x4c0a('0x2e')]};});_0x3ef6cc[_0x4c0a('0x2f')]=_[_0x4c0a('0x30')](_0x5709ee,_0x4c0a('0x28'));_0x3ef6cc['query']=_[_0x4c0a('0x31')](_0x2a14f9[_0x4c0a('0x32')]);_0x3ef6cc[_0x4c0a('0x33')]=_['intersection'](_0x3ef6cc[_0x4c0a('0x2f')],_0x3ef6cc['query']);_0x41d2de[_0x4c0a('0x34')]=_['intersection'](_0x3ef6cc[_0x4c0a('0x2f')],qs[_0x4c0a('0x35')](_0x2a14f9[_0x4c0a('0x32')]['fields']));_0x41d2de[_0x4c0a('0x34')]=_0x41d2de[_0x4c0a('0x34')]['length']?_0x41d2de[_0x4c0a('0x34')]:_0x3ef6cc['model'];if(!_0x2a14f9['query'][_0x4c0a('0x36')]('nolimit')){_0x41d2de[_0x4c0a('0x1b')]=qs[_0x4c0a('0x1b')](_0x2a14f9[_0x4c0a('0x32')][_0x4c0a('0x1b')]);_0x41d2de[_0x4c0a('0x1d')]=qs[_0x4c0a('0x1d')](_0x2a14f9['query'][_0x4c0a('0x1d')]);}_0x41d2de['order']=qs[_0x4c0a('0x37')](_0x2a14f9['query']['sort']);_0x41d2de[_0x4c0a('0x38')]=qs[_0x4c0a('0x33')](_[_0x4c0a('0x39')](_0x2a14f9[_0x4c0a('0x32')],_0x3ef6cc[_0x4c0a('0x33')]),_0x5709ee);if(_0x2a14f9[_0x4c0a('0x32')][_0x4c0a('0x3a')]){_0x41d2de[_0x4c0a('0x38')]=_[_0x4c0a('0x3b')](_0x41d2de[_0x4c0a('0x38')],{'$or':_[_0x4c0a('0x30')](_0x5709ee,function(_0x35a615){if(_0x35a615['type']!==_0x4c0a('0x3c')){var _0x523fde={};_0x523fde[_0x35a615[_0x4c0a('0x28')]]={'$like':'%'+_0x2a14f9['query'][_0x4c0a('0x3a')]+'%'};return _0x523fde;}})});}_0x41d2de=_[_0x4c0a('0x3b')]({},_0x41d2de,_0x2a14f9[_0x4c0a('0x3d')]);var _0x42b9b7={'where':_0x41d2de['where']};return db[_0x4c0a('0x3e')]['count'](_0x42b9b7)['then'](function(_0x3addaf){_0x4276d8[_0x4c0a('0x1c')]=_0x3addaf;if(_0x2a14f9['query'][_0x4c0a('0x3f')]){_0x41d2de[_0x4c0a('0x40')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x41d2de);})['then'](function(_0x105876){_0x4276d8[_0x4c0a('0x41')]=_0x105876;return _0x4276d8;})[_0x4c0a('0x23')](respondWithFilteredResult(_0x5ce007,_0x41d2de))[_0x4c0a('0x42')](handleError(_0x5ce007,null));};exports[_0x4c0a('0x43')]=function(_0x6411bc,_0x19966e){var _0x2437f1={'raw':!![],'where':{'id':_0x6411bc[_0x4c0a('0x44')]['id']}},_0x47204e={};_0x47204e[_0x4c0a('0x2f')]=_[_0x4c0a('0x31')](db[_0x4c0a('0x3e')][_0x4c0a('0x2b')]);_0x47204e['query']=_[_0x4c0a('0x31')](_0x6411bc[_0x4c0a('0x32')]);_0x47204e[_0x4c0a('0x33')]=_['intersection'](_0x47204e[_0x4c0a('0x2f')],_0x47204e[_0x4c0a('0x32')]);_0x2437f1[_0x4c0a('0x34')]=_[_0x4c0a('0x45')](_0x47204e[_0x4c0a('0x2f')],qs['fields'](_0x6411bc['query'][_0x4c0a('0x35')]));_0x2437f1[_0x4c0a('0x34')]=_0x2437f1['attributes']['length']?_0x2437f1[_0x4c0a('0x34')]:_0x47204e[_0x4c0a('0x2f')];if(_0x6411bc[_0x4c0a('0x32')][_0x4c0a('0x3f')]){_0x2437f1['include']=[{'all':!![]}];}_0x2437f1=_[_0x4c0a('0x3b')]({},_0x2437f1,_0x6411bc[_0x4c0a('0x3d')]);return db[_0x4c0a('0x3e')]['find'](_0x2437f1)[_0x4c0a('0x23')](handleEntityNotFound(_0x19966e,null))['then'](respondWithResult(_0x19966e,null))['catch'](handleError(_0x19966e,null));};exports['create']=function(_0x1d80ef,_0x3e91e6){return db[_0x4c0a('0x3e')]['create'](_0x1d80ef[_0x4c0a('0x46')],{})[_0x4c0a('0x23')](respondWithResult(_0x3e91e6,0xc9))[_0x4c0a('0x42')](handleError(_0x3e91e6,null));};exports[_0x4c0a('0x21')]=function(_0x129edd,_0x22df0f){if(_0x129edd['body']['id']){delete _0x129edd[_0x4c0a('0x46')]['id'];}return db[_0x4c0a('0x3e')][_0x4c0a('0x47')]({'where':{'id':_0x129edd['params']['id']}})[_0x4c0a('0x23')](handleEntityNotFound(_0x22df0f,null))[_0x4c0a('0x23')](saveUpdates(_0x129edd['body'],null))[_0x4c0a('0x23')](respondWithResult(_0x22df0f,null))[_0x4c0a('0x42')](handleError(_0x22df0f,null));};exports[_0x4c0a('0x22')]=function(_0x56bd0f,_0x53d395){return db[_0x4c0a('0x3e')][_0x4c0a('0x47')]({'where':{'id':_0x56bd0f[_0x4c0a('0x44')]['id']}})[_0x4c0a('0x23')](handleEntityNotFound(_0x53d395,null))[_0x4c0a('0x23')](removeEntity(_0x53d395,null))[_0x4c0a('0x42')](handleError(_0x53d395,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index cb30ded..a0c86f6 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 _0x71d6=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x280ccf,_0x2697de){var _0x400051=function(_0xe68a04){while(--_0xe68a04){_0x280ccf['push'](_0x280ccf['shift']());}};_0x400051(++_0x2697de);}(_0x71d6,0x78));var _0x671d=function(_0x41ca2d,_0x409995){_0x41ca2d=_0x41ca2d-0x0;var _0x4b9a7f=_0x71d6[_0x41ca2d];return _0x4b9a7f;};'use strict';var _=require(_0x671d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x671d('0x1'));var BPromise=require(_0x671d('0x2'));var rp=require(_0x671d('0x3'));var fs=require('fs');var path=require(_0x671d('0x4'));var rimraf=require(_0x671d('0x5'));var config=require(_0x671d('0x6'));var attributes=require(_0x671d('0x7'));module[_0x671d('0x8')]=function(_0x538b16,_0x5834db){return _0x538b16[_0x671d('0x9')](_0x671d('0xa'),attributes,{'tableName':_0x671d('0xb'),'paranoid':![],'indexes':[{'name':_0x671d('0xc'),'fields':[_0x671d('0xd'),_0x671d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc35d=['idField','lodash','api','moment','path','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x15f852,_0x530d85){var _0x387460=function(_0x4aa3df){while(--_0x4aa3df){_0x15f852['push'](_0x15f852['shift']());}};_0x387460(++_0x530d85);}(_0xc35d,0x1a5));var _0xdc35=function(_0x48732f,_0x3c0f88){_0x48732f=_0x48732f-0x0;var _0x57a296=_0xc35d[_0x48732f];return _0x57a296;};'use strict';var _=require(_0xdc35('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdc35('0x1'));var moment=require(_0xdc35('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc35('0x3'));var rimraf=require('rimraf');var config=require(_0xdc35('0x4'));var attributes=require(_0xdc35('0x5'));module[_0xdc35('0x6')]=function(_0x3b2500,_0x3cbbe5){return _0x3b2500[_0xdc35('0x7')](_0xdc35('0x8'),attributes,{'tableName':_0xdc35('0x9'),'paranoid':![],'indexes':[{'name':_0xdc35('0xa'),'fields':[_0xdc35('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 479b68e..1050623 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 _0xf239=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x7d9557,_0x2d6000){var _0x207a60=function(_0x489d7c){while(--_0x489d7c){_0x7d9557['push'](_0x7d9557['shift']());}};_0x207a60(++_0x2d6000);}(_0xf239,0x176));var _0x9f23=function(_0x29d351,_0x3a8f7b){_0x29d351=_0x29d351-0x0;var _0x23eba0=_0xf239[_0x29d351];return _0x23eba0;};'use strict';var _=require(_0x9f23('0x0'));var util=require(_0x9f23('0x1'));var moment=require(_0x9f23('0x2'));var BPromise=require(_0x9f23('0x3'));var rs=require(_0x9f23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f23('0x5'))['db'];var utils=require(_0x9f23('0x6'));var logger=require(_0x9f23('0x7'))(_0x9f23('0x8'));var config=require(_0x9f23('0x9'));var jayson=require(_0x9f23('0xa'));var client=jayson[_0x9f23('0xb')][_0x9f23('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46ae17,_0x5151db,_0x5bc703){return new BPromise(function(_0x5c6f71,_0x5a2f4d){return client[_0x9f23('0xd')](_0x46ae17,_0x5bc703)[_0x9f23('0xe')](function(_0x3ef677){logger[_0x9f23('0xf')](_0x9f23('0x10'),_0x5151db,'request\x20sent');logger['debug'](_0x9f23('0x11'),_0x5151db,_0x9f23('0x12'),JSON[_0x9f23('0x13')](_0x3ef677));if(_0x3ef677[_0x9f23('0x14')]){if(_0x3ef677[_0x9f23('0x14')][_0x9f23('0x15')]===0x1f4){logger[_0x9f23('0x14')](_0x9f23('0x10'),_0x5151db,_0x3ef677[_0x9f23('0x14')]['message']);return _0x5a2f4d(_0x3ef677['error']['message']);}logger[_0x9f23('0x14')](_0x9f23('0x10'),_0x5151db,_0x3ef677['error'][_0x9f23('0x16')]);return _0x5c6f71(_0x3ef677['error']['message']);}else{logger[_0x9f23('0xf')](_0x9f23('0x10'),_0x5151db,_0x9f23('0x12'));_0x5c6f71(_0x3ef677[_0x9f23('0x17')][_0x9f23('0x16')]);}})[_0x9f23('0x18')](function(_0x49a439){logger[_0x9f23('0x14')](_0x9f23('0x10'),_0x5151db,_0x49a439);_0x5a2f4d(_0x49a439);});});} \ No newline at end of file +var _0x4bdb=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x4bdb,0x14d));var _0xb4bd=function(_0xa6a7e,_0x4a9242){_0xa6a7e=_0xa6a7e-0x0;var _0x518d25=_0x4bdb[_0xa6a7e];return _0x518d25;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb4bd('0x0'));var BPromise=require(_0xb4bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4bd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4bd('0x3'));var logger=require('../../config/logger')(_0xb4bd('0x4'));var config=require(_0xb4bd('0x5'));var jayson=require(_0xb4bd('0x6'));var client=jayson[_0xb4bd('0x7')][_0xb4bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x485a69,_0x426667,_0x3c2aeb){return new BPromise(function(_0xc27a31,_0x45fff9){return client['request'](_0x485a69,_0x3c2aeb)['then'](function(_0x28ecac){logger['info']('DeskField,\x20%s,\x20%s',_0x426667,_0xb4bd('0x9'));logger[_0xb4bd('0xa')](_0xb4bd('0xb'),_0x426667,_0xb4bd('0x9'),JSON['stringify'](_0x28ecac));if(_0x28ecac['error']){if(_0x28ecac[_0xb4bd('0xc')][_0xb4bd('0xd')]===0x1f4){logger['error'](_0xb4bd('0xe'),_0x426667,_0x28ecac[_0xb4bd('0xc')]['message']);return _0x45fff9(_0x28ecac[_0xb4bd('0xc')][_0xb4bd('0xf')]);}logger[_0xb4bd('0xc')](_0xb4bd('0xe'),_0x426667,_0x28ecac[_0xb4bd('0xc')][_0xb4bd('0xf')]);return _0xc27a31(_0x28ecac[_0xb4bd('0xc')][_0xb4bd('0xf')]);}else{logger[_0xb4bd('0x10')](_0xb4bd('0xe'),_0x426667,_0xb4bd('0x9'));_0xc27a31(_0x28ecac[_0xb4bd('0x11')][_0xb4bd('0xf')]);}})[_0xb4bd('0x12')](function(_0x5d354f){logger['error'](_0xb4bd('0xe'),_0x426667,_0x5d354f);_0x45fff9(_0x5d354f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 599362e..7bc0ef4 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 _0xc956=['delete','destroy','exports','multer','util','path','Router','fs-extra','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','post','create','/:id/configurations','addConfiguration'];(function(_0x5e8c0f,_0x1f20d9){var _0x568dbe=function(_0xdc6797){while(--_0xdc6797){_0x5e8c0f['push'](_0x5e8c0f['shift']());}};_0x568dbe(++_0x1f20d9);}(_0xc956,0xf1));var _0x6c95=function(_0x1f8145,_0x5df757){_0x1f8145=_0x1f8145-0x0;var _0x458be4=_0xc956[_0x1f8145];return _0x458be4;};'use strict';var multer=require(_0x6c95('0x0'));var util=require(_0x6c95('0x1'));var path=require(_0x6c95('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c95('0x3')]();var fs_extra=require(_0x6c95('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6c95('0x5'));router[_0x6c95('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6c95('0x6')](_0x6c95('0x7'),auth[_0x6c95('0x8')](),controller[_0x6c95('0x9')]);router[_0x6c95('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x6c95('0x6')]('/:id/fields',auth[_0x6c95('0x8')](),controller['getFields']);router[_0x6c95('0xa')]('/',auth['isAuthenticated'](),controller[_0x6c95('0xb')]);router['post'](_0x6c95('0xc'),auth[_0x6c95('0x8')](),controller[_0x6c95('0xd')]);router['put'](_0x6c95('0x7'),auth[_0x6c95('0x8')](),controller['update']);router[_0x6c95('0xe')](_0x6c95('0x7'),auth[_0x6c95('0x8')](),controller[_0x6c95('0xf')]);module[_0x6c95('0x10')]=router; \ No newline at end of file +var _0x2dec=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','post','create','/:id/configurations','addConfiguration','update','delete','exports','multer','path'];(function(_0x2c19fb,_0x4955d5){var _0x53fd68=function(_0x4fd3fd){while(--_0x4fd3fd){_0x2c19fb['push'](_0x2c19fb['shift']());}};_0x53fd68(++_0x4955d5);}(_0x2dec,0x8a));var _0xc2de=function(_0x5e08be,_0x9bf344){_0x5e08be=_0x5e08be-0x0;var _0x4db79e=_0x2dec[_0x5e08be];return _0x4db79e;};'use strict';var multer=require(_0xc2de('0x0'));var util=require('util');var path=require(_0xc2de('0x1'));var timeout=require('connect-timeout');var express=require(_0xc2de('0x2'));var router=express['Router']();var fs_extra=require(_0xc2de('0x3'));var auth=require(_0xc2de('0x4'));var interaction=require(_0xc2de('0x5'));var config=require('../../config/environment');var controller=require(_0xc2de('0x6'));router[_0xc2de('0x7')]('/',auth[_0xc2de('0x8')](),controller[_0xc2de('0x9')]);router[_0xc2de('0x7')](_0xc2de('0xa'),auth[_0xc2de('0x8')](),controller[_0xc2de('0xb')]);router[_0xc2de('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc2de('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xc2de('0xd')]('/',auth['isAuthenticated'](),controller[_0xc2de('0xe')]);router[_0xc2de('0xd')](_0xc2de('0xf'),auth['isAuthenticated'](),controller[_0xc2de('0x10')]);router['put'](_0xc2de('0xa'),auth['isAuthenticated'](),controller[_0xc2de('0x11')]);router[_0xc2de('0x12')]('/:id',auth[_0xc2de('0x8')](),controller['destroy']);module[_0xc2de('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 22ad936..a8f8cac 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 _0x38d3=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3f3449,_0x338e75){var _0x35de7d=function(_0x44bd3c){while(--_0x44bd3c){_0x3f3449['push'](_0x3f3449['shift']());}};_0x35de7d(++_0x338e75);}(_0x38d3,0x1a7));var _0x338d=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x38d3[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require(_0x338d('0x0'));module[_0x338d('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x338d('0x2')]},'password':{'type':Sequelize[_0x338d('0x2')]},'remoteUri':{'type':Sequelize[_0x338d('0x2')]},'tenantId':{'type':Sequelize[_0x338d('0x2')]},'clientId':{'type':Sequelize[_0x338d('0x2')]},'clientSecret':{'type':Sequelize[_0x338d('0x2')]},'serverUrl':{'type':Sequelize[_0x338d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x338d('0x2')]},'modernAuthentication':{'type':Sequelize[_0x338d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x71ab=['BOOLEAN','exports','STRING'];(function(_0x4fb683,_0x564879){var _0x3e886a=function(_0x291433){while(--_0x291433){_0x4fb683['push'](_0x4fb683['shift']());}};_0x3e886a(++_0x564879);}(_0x71ab,0x64));var _0xb71a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x71ab[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb71a('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb71a('0x1')]},'tenantId':{'type':Sequelize[_0xb71a('0x1')]},'clientId':{'type':Sequelize[_0xb71a('0x1')]},'clientSecret':{'type':Sequelize[_0xb71a('0x1')]},'serverUrl':{'type':Sequelize[_0xb71a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'modernAuthentication':{'type':Sequelize[_0xb71a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index b9b8e4f..58d9f72 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 _0xe7c3=['ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','clientId','GET','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','all','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','Value','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','api','status','json','offset','undefined','limit','set','Content-Range','then','destroy','sendStatus','error','stack','name','index','Dynamics365Account','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','where','filters','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','find','create','body','update','getConfigurations','findOne','Dynamics365Configuration','order','sort','options','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','incident','Incident','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe7c3,0x1a8));var _0x3e7c=function(_0x1502ea,_0x42d4af){_0x1502ea=_0x1502ea-0x0;var _0x119e70=_0xe7c3[_0x1502ea];return _0x119e70;};'use strict';var rp=require(_0x3e7c('0x0'));var util=require(_0x3e7c('0x1'));var _=require(_0x3e7c('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3e7c('0x3'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x1d01c4,_0x420c60){_0x420c60=_0x420c60||0xc8;return function(_0x2d4f1d){if(_0x2d4f1d){return _0x1d01c4[_0x3e7c('0x4')](_0x420c60)[_0x3e7c('0x5')](_0x2d4f1d);}};}function respondWithFilteredResult(_0x5929bc,_0x4a466c){return function(_0x52f8d0){if(_0x52f8d0){var _0x68b23b=typeof _0x4a466c[_0x3e7c('0x6')]===_0x3e7c('0x7')&&typeof _0x4a466c['limit']===_0x3e7c('0x7');var _0x48c037=_0x52f8d0['count'];var _0x5ad9d5=_0x68b23b?0x0:_0x4a466c[_0x3e7c('0x6')];var _0x4d8769=_0x68b23b?_0x52f8d0['count']:_0x4a466c[_0x3e7c('0x6')]+_0x4a466c[_0x3e7c('0x8')];var _0x572255;if(_0x4d8769>=_0x48c037){_0x4d8769=_0x48c037;_0x572255=0xc8;}else{_0x572255=0xce;}_0x5929bc[_0x3e7c('0x4')](_0x572255);return _0x5929bc[_0x3e7c('0x9')](_0x3e7c('0xa'),_0x5ad9d5+'-'+_0x4d8769+'/'+_0x48c037)[_0x3e7c('0x5')](_0x52f8d0);}return null;};}function saveUpdates(_0x47428f){return function(_0x523da6){if(_0x523da6){return _0x523da6['update'](_0x47428f)[_0x3e7c('0xb')](function(_0x1047f0){return _0x1047f0;});}return null;};}function removeEntity(_0x499e04){return function(_0x5b9c0d){if(_0x5b9c0d){return _0x5b9c0d[_0x3e7c('0xc')]()['then'](function(){_0x499e04['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c802){return function(_0x338764){if(!_0x338764){_0x46c802[_0x3e7c('0xd')](0x194);}return _0x338764;};}function handleError(_0x54b476,_0x419325){_0x419325=_0x419325||0x1f4;return function(_0x24a0df){logger[_0x3e7c('0xe')](_0x24a0df[_0x3e7c('0xf')]);if(_0x24a0df[_0x3e7c('0x10')]){delete _0x24a0df[_0x3e7c('0x10')];}_0x54b476[_0x3e7c('0x4')](_0x419325)['send'](_0x24a0df);};}exports[_0x3e7c('0x11')]=function(_0x2823dd,_0x2f45c0){var _0x1bc057={},_0x12a12b={},_0x22962d={'count':0x0,'rows':[]};var _0x595351=_['map'](db[_0x3e7c('0x12')][_0x3e7c('0x13')],function(_0x1fb43a){return{'name':_0x1fb43a['fieldName'],'type':_0x1fb43a['type'][_0x3e7c('0x14')]};});_0x12a12b[_0x3e7c('0x15')]=_[_0x3e7c('0x16')](_0x595351,'name');_0x12a12b[_0x3e7c('0x17')]=_[_0x3e7c('0x18')](_0x2823dd['query']);_0x12a12b['filters']=_[_0x3e7c('0x19')](_0x12a12b[_0x3e7c('0x15')],_0x12a12b[_0x3e7c('0x17')]);_0x1bc057[_0x3e7c('0x1a')]=_[_0x3e7c('0x19')](_0x12a12b['model'],qs['fields'](_0x2823dd[_0x3e7c('0x17')][_0x3e7c('0x1b')]));_0x1bc057[_0x3e7c('0x1a')]=_0x1bc057[_0x3e7c('0x1a')][_0x3e7c('0x1c')]?_0x1bc057[_0x3e7c('0x1a')]:_0x12a12b['model'];if(!_0x2823dd[_0x3e7c('0x17')][_0x3e7c('0x1d')]('nolimit')){_0x1bc057['limit']=qs[_0x3e7c('0x8')](_0x2823dd[_0x3e7c('0x17')][_0x3e7c('0x8')]);_0x1bc057['offset']=qs['offset'](_0x2823dd['query']['offset']);}_0x1bc057['order']=qs['sort'](_0x2823dd[_0x3e7c('0x17')]['sort']);_0x1bc057[_0x3e7c('0x1e')]=qs[_0x3e7c('0x1f')](_[_0x3e7c('0x20')](_0x2823dd[_0x3e7c('0x17')],_0x12a12b[_0x3e7c('0x1f')]),_0x595351);if(_0x2823dd[_0x3e7c('0x17')][_0x3e7c('0x21')]){_0x1bc057[_0x3e7c('0x1e')]=_[_0x3e7c('0x22')](_0x1bc057[_0x3e7c('0x1e')],{'$or':_[_0x3e7c('0x16')](_0x595351,function(_0x4f87a4){if(_0x4f87a4[_0x3e7c('0x23')]!==_0x3e7c('0x24')){var _0x2be151={};_0x2be151[_0x4f87a4['name']]={'$like':'%'+_0x2823dd[_0x3e7c('0x17')]['filter']+'%'};return _0x2be151;}})});}_0x1bc057=_[_0x3e7c('0x22')]({},_0x1bc057,_0x2823dd['options']);var _0x302a5a={'where':_0x1bc057['where']};return db[_0x3e7c('0x12')][_0x3e7c('0x25')](_0x302a5a)[_0x3e7c('0xb')](function(_0x39ff5b){_0x22962d['count']=_0x39ff5b;if(_0x2823dd['query'][_0x3e7c('0x26')]){_0x1bc057[_0x3e7c('0x27')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3e7c('0x28')](_0x1bc057);})[_0x3e7c('0xb')](function(_0x387dfa){_0x22962d[_0x3e7c('0x29')]=_0x387dfa;return _0x22962d;})['then'](respondWithFilteredResult(_0x2f45c0,_0x1bc057))[_0x3e7c('0x2a')](handleError(_0x2f45c0,null));};exports['show']=function(_0x566286,_0x26c1a4){var _0x5a052b={'raw':![],'where':{'id':_0x566286[_0x3e7c('0x2b')]['id']}},_0x3711be={};_0x3711be[_0x3e7c('0x15')]=_[_0x3e7c('0x18')](db['Dynamics365Account'][_0x3e7c('0x13')]);_0x3711be[_0x3e7c('0x17')]=_[_0x3e7c('0x18')](_0x566286[_0x3e7c('0x17')]);_0x3711be[_0x3e7c('0x1f')]=_[_0x3e7c('0x19')](_0x3711be[_0x3e7c('0x15')],_0x3711be[_0x3e7c('0x17')]);_0x5a052b[_0x3e7c('0x1a')]=_[_0x3e7c('0x19')](_0x3711be[_0x3e7c('0x15')],qs[_0x3e7c('0x1b')](_0x566286[_0x3e7c('0x17')][_0x3e7c('0x1b')]));_0x5a052b[_0x3e7c('0x1a')]=_0x5a052b[_0x3e7c('0x1a')][_0x3e7c('0x1c')]?_0x5a052b[_0x3e7c('0x1a')]:_0x3711be[_0x3e7c('0x15')];if(_0x566286[_0x3e7c('0x17')][_0x3e7c('0x26')]){_0x5a052b['include']=[{'all':!![]}];}_0x5a052b=_['merge']({},_0x5a052b,_0x566286['options']);return db['Dynamics365Account'][_0x3e7c('0x2c')](_0x5a052b)[_0x3e7c('0xb')](handleEntityNotFound(_0x26c1a4,null))[_0x3e7c('0xb')](respondWithResult(_0x26c1a4,null))[_0x3e7c('0x2a')](handleError(_0x26c1a4,null));};exports['create']=function(_0x381c39,_0x12e6ad){return db[_0x3e7c('0x12')][_0x3e7c('0x2d')](_0x381c39[_0x3e7c('0x2e')],{})[_0x3e7c('0xb')](respondWithResult(_0x12e6ad,0xc9))[_0x3e7c('0x2a')](handleError(_0x12e6ad,null));};exports[_0x3e7c('0x2f')]=function(_0x596155,_0x122fb4){if(_0x596155[_0x3e7c('0x2e')]['id']){delete _0x596155['body']['id'];}return db[_0x3e7c('0x12')][_0x3e7c('0x2c')]({'where':{'id':_0x596155['params']['id']}})[_0x3e7c('0xb')](handleEntityNotFound(_0x122fb4,null))[_0x3e7c('0xb')](saveUpdates(_0x596155[_0x3e7c('0x2e')],null))[_0x3e7c('0xb')](respondWithResult(_0x122fb4,null))[_0x3e7c('0x2a')](handleError(_0x122fb4,null));};exports[_0x3e7c('0xc')]=function(_0xddd705,_0x1b9387){return db['Dynamics365Account'][_0x3e7c('0x2c')]({'where':{'id':_0xddd705['params']['id']}})[_0x3e7c('0xb')](handleEntityNotFound(_0x1b9387,null))[_0x3e7c('0xb')](removeEntity(_0x1b9387,null))[_0x3e7c('0x2a')](handleError(_0x1b9387,null));};exports[_0x3e7c('0x30')]=function(_0x25b369,_0x4b8ce8){var _0x4baf84={};var _0xd3715e={};var _0x506cfd;var _0xfee3ff;return db['Dynamics365Account'][_0x3e7c('0x31')]({'where':{'id':_0x25b369[_0x3e7c('0x2b')]['id']}})[_0x3e7c('0xb')](handleEntityNotFound(_0x4b8ce8,null))[_0x3e7c('0xb')](function(_0x2576a1){if(_0x2576a1){_0x506cfd=_0x2576a1;_0xd3715e[_0x3e7c('0x15')]=_['keys'](db[_0x3e7c('0x32')][_0x3e7c('0x13')]);_0xd3715e[_0x3e7c('0x17')]=_[_0x3e7c('0x18')](_0x25b369[_0x3e7c('0x17')]);_0xd3715e[_0x3e7c('0x1f')]=_['intersection'](_0xd3715e[_0x3e7c('0x15')],_0xd3715e[_0x3e7c('0x17')]);_0x4baf84['attributes']=_['intersection'](_0xd3715e[_0x3e7c('0x15')],qs[_0x3e7c('0x1b')](_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x1b')]));_0x4baf84[_0x3e7c('0x1a')]=_0x4baf84[_0x3e7c('0x1a')][_0x3e7c('0x1c')]?_0x4baf84[_0x3e7c('0x1a')]:_0xd3715e[_0x3e7c('0x15')];_0x4baf84[_0x3e7c('0x33')]=qs[_0x3e7c('0x34')](_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x34')]);_0x4baf84['where']=qs[_0x3e7c('0x1f')](_['pick'](_0x25b369['query'],_0xd3715e[_0x3e7c('0x1f')]));if(_0x25b369['query'][_0x3e7c('0x21')]){_0x4baf84[_0x3e7c('0x1e')]=_[_0x3e7c('0x22')](_0x4baf84[_0x3e7c('0x1e')],{'$or':_['map'](_0x4baf84[_0x3e7c('0x1a')],function(_0x4bd5f8){var _0xb9f491={};_0xb9f491[_0x4bd5f8]={'$like':'%'+_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x21')]+'%'};return _0xb9f491;})});}_0x4baf84=_['merge']({},_0x4baf84,_0x25b369[_0x3e7c('0x35')]);return _0x506cfd['getConfigurations'](_0x4baf84);}})[_0x3e7c('0xb')](function(_0x18cc0d){if(_0x18cc0d){_0xfee3ff=_0x18cc0d[_0x3e7c('0x1c')];if(!_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x1d')](_0x3e7c('0x36'))){_0x4baf84[_0x3e7c('0x8')]=qs['limit'](_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x8')]);_0x4baf84[_0x3e7c('0x6')]=qs['offset'](_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x6')]);}return _0x506cfd[_0x3e7c('0x30')](_0x4baf84);}})[_0x3e7c('0xb')](function(_0x33eab6){if(_0x33eab6){return _0x33eab6?{'count':_0xfee3ff,'rows':_0x33eab6}:null;}})[_0x3e7c('0xb')](respondWithResult(_0x4b8ce8,null))['catch'](handleError(_0x4b8ce8,null));};exports[_0x3e7c('0x37')]=function(_0x1afaa1,_0x46d7ac){if(_0x1afaa1['body']['id']){delete _0x1afaa1['body']['id'];}return db[_0x3e7c('0x12')][_0x3e7c('0x31')]({'where':{'id':_0x1afaa1[_0x3e7c('0x2b')]['id']}})[_0x3e7c('0xb')](handleEntityNotFound(_0x46d7ac,null))[_0x3e7c('0xb')](function(_0x36e92d){if(_0x36e92d){_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x38')]=_0x36e92d['id'];_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x39')]=integrations[_0x3e7c('0x3a')](_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x3b')],_0x1afaa1['body']['type']);_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x3c')]=integrations['getDescriptions'](_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x3b')],_0x1afaa1['body']['type']);return db[_0x3e7c('0x32')]['create'](_0x1afaa1['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x3e7c('0x39')},{'model':db[_0x3e7c('0x3d')],'as':_0x3e7c('0x3c')}]});}return null;})[_0x3e7c('0xb')](respondWithResult(_0x46d7ac,null))[_0x3e7c('0x2a')](handleError(_0x46d7ac,null));};function sanitizeRemoteUri(_0x3ecba9){var _0x5a4b94=_0x3ecba9[_0x3e7c('0x3e')](-0x1);if(_0x5a4b94==='/')return _0x3ecba9[_0x3e7c('0x3f')](0x0,_0x3ecba9[_0x3e7c('0x40')](_0x5a4b94));return _0x3ecba9;}function getWebApiUrl(_0x20cb07){return util['format'](_0x3e7c('0x41'),_0x20cb07);}exports['getFields']=function(_0x2457d9,_0xc439d0){var _0x4e6199=_0x2457d9[_0x3e7c('0x17')]['ticketType'];var _0x2a162c=_0x4e6199===_0x3e7c('0x42')?_0x3e7c('0x43'):'PhoneCall';var _0x4ce9fe='';var _0x24063e='';var _0x3545e3='';var _0x20e49a='';var _0x1063cc='';var _0x612b3b='';var _0x5405df='';var _0x3bc424='';var _0x222ca7=['title','description',_0x3e7c('0x44'),_0x3e7c('0x45'),_0x3e7c('0x46'),'subject',_0x3e7c('0x47'),_0x3e7c('0x48'),'directioncode',_0x3e7c('0x49')];var _0x5a01e7=[_0x3e7c('0x4a'),_0x3e7c('0x4b'),_0x3e7c('0x4c'),_0x3e7c('0x4d'),_0x3e7c('0x4e'),_0x3e7c('0x4f'),_0x3e7c('0x50'),'contractidname',_0x3e7c('0x51'),_0x3e7c('0x52'),'createdbyname',_0x3e7c('0x53'),_0x3e7c('0x54'),_0x3e7c('0x55'),_0x3e7c('0x56'),'customeridname',_0x3e7c('0x57'),_0x3e7c('0x58'),_0x3e7c('0x59'),'entitlementidname',_0x3e7c('0x5a'),_0x3e7c('0x5b'),_0x3e7c('0x5c'),_0x3e7c('0x5d'),'firstresponsebykpiidname','followupby',_0x3e7c('0x5e'),_0x3e7c('0x5f'),_0x3e7c('0x60'),'lastonholdtime','masteridname',_0x3e7c('0x61'),_0x3e7c('0x62'),'modifiedbyname',_0x3e7c('0x63'),_0x3e7c('0x64'),_0x3e7c('0x65'),_0x3e7c('0x66'),_0x3e7c('0x67'),'msdyn_iotalertname',_0x3e7c('0x68'),'onholdtime',_0x3e7c('0x69'),_0x3e7c('0x6a'),'owneridtype','owneridyominame',_0x3e7c('0x6b'),_0x3e7c('0x6c'),_0x3e7c('0x6d'),_0x3e7c('0x6e'),'productidname',_0x3e7c('0x6f'),_0x3e7c('0x70'),'resolvebykpiidname',_0x3e7c('0x71'),_0x3e7c('0x72'),_0x3e7c('0x73'),_0x3e7c('0x74'),_0x3e7c('0x75'),_0x3e7c('0x76'),_0x3e7c('0x77'),_0x3e7c('0x78'),'statuscode',_0x3e7c('0x79'),_0x3e7c('0x7a'),_0x3e7c('0x7b'),_0x3e7c('0x7c'),_0x3e7c('0x7d'),'utcconversiontimezonecode',_0x3e7c('0x7e')];var _0x1f1941=_0x222ca7[_0x3e7c('0x7f')](_0x5a01e7);return db[_0x3e7c('0x12')]['findOne']({'where':{'id':_0x2457d9[_0x3e7c('0x2b')]['id']},'attributes':['id',_0x3e7c('0x80'),_0x3e7c('0x81'),_0x3e7c('0x82'),_0x3e7c('0x83'),'clientId',_0x3e7c('0x84'),_0x3e7c('0x85')],'include':[{'model':db[_0x3e7c('0x86')],'as':_0x3e7c('0x86'),'attributes':['id',_0x3e7c('0x87'),'data7']}]})[_0x3e7c('0xb')](handleEntityNotFound(_0xc439d0,null))[_0x3e7c('0xb')](function(_0x2cf812){if(_0x2cf812){if(_0x2cf812[_0x3e7c('0x85')]){_0x2cf812[_0x3e7c('0x88')]=_0x2cf812[_0x3e7c('0x86')][_0x3e7c('0x87')];_0x3bc424=sanitizeRemoteUri(_0x2cf812[_0x3e7c('0x86')][_0x3e7c('0x89')]);_0x5405df=getWebApiUrl(_0x3bc424);return _0x2cf812;}_0x3bc424=sanitizeRemoteUri(_0x2cf812[_0x3e7c('0x82')]);_0x5405df=getWebApiUrl(_0x3bc424);var _0x436bf0={'method':_0x3e7c('0x8a'),'uri':_0x3e7c('0x8b')+_0x2cf812[_0x3e7c('0x83')]+'/oauth2/token','form':{'client_id':_0x2cf812[_0x3e7c('0x8c')],'resource':_0x3bc424,'username':_0x2cf812[_0x3e7c('0x80')],'password':_0x2cf812[_0x3e7c('0x81')],'grant_type':_0x3e7c('0x81'),'client_secret':_0x2cf812[_0x3e7c('0x84')]},'json':!![]};return rp(_0x436bf0);}})[_0x3e7c('0xb')](function(_0x1a10f5){_0x612b3b=_0x1a10f5['access_token'];var _0x12be31={'method':_0x3e7c('0x8d'),'uri':encodeURI(_0x5405df+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2a162c+'\x27'),'headers':{'Authorization':_0x3e7c('0x8e')+_0x612b3b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x12be31);})[_0x3e7c('0xb')](function(_0xb5e78d){var _0x578291=_0xb5e78d[_0x3e7c('0x8f')][0x0];var _0x53a667=_0x578291[_0x3e7c('0x90')];var _0x28d836={'method':_0x3e7c('0x8d'),'uri':_0x5405df+_0x3e7c('0x91')+_0x53a667+_0x3e7c('0x92'),'headers':{'Authorization':_0x3e7c('0x8e')+_0x612b3b,'If-None-Match':null,'OData-Version':_0x3e7c('0x93')},'json':!![]};return rp(_0x28d836);})[_0x3e7c('0xb')](function(_0x113e2b){_0x4ce9fe=_0x113e2b;_0x24063e=_0x4ce9fe['Attributes'];_0x24063e=_[_0x3e7c('0x94')](_0x24063e,function(_0x15aa3b){return!_0x1f1941[_0x3e7c('0x95')](_0x15aa3b['LogicalName']);});var _0x1543df=[];var _0xa40d01=[];_0x24063e[_0x3e7c('0x96')](function(_0x27389f){if(_0x27389f[_0x3e7c('0x97')]){var _0x2e5439=_0x27389f['@odata.type'][_0x3e7c('0x3f')](_0x27389f[_0x3e7c('0x97')]['lastIndexOf']('.')+0x1);if(_0x2e5439===_0x3e7c('0x98')){_0x1543df[_0x3e7c('0x99')](getSelectList(_0x5405df,_0x4e6199,_0xa40d01,_0x4ce9fe[_0x3e7c('0x90')],_0x27389f[_0x3e7c('0x90')],_0x612b3b));}}});return Promise['all'](_0x1543df);})['then'](function(_0x1f371a){_0x3545e3=_0x1f371a[0x0];var _0x2e0f7a=[];var _0x535239=[];_0x24063e[_0x3e7c('0x96')](function(_0x32c488){if(!_['isNil'](_0x32c488['@odata.type'])){var _0x39172b=_0x32c488[_0x3e7c('0x97')][_0x3e7c('0x3f')](_0x32c488[_0x3e7c('0x97')][_0x3e7c('0x40')]('.')+0x1);if(_0x39172b===_0x3e7c('0x9a')){_0x2e0f7a[_0x3e7c('0x99')](getBooleanList(_0x5405df,_0x4e6199,_0x535239,_0x4ce9fe[_0x3e7c('0x90')],_0x32c488[_0x3e7c('0x90')],_0x612b3b));}}});return Promise['all'](_0x2e0f7a);})['then'](function(_0xfd40d1){_0x20e49a=_0xfd40d1[0x0];var _0x1eb60b=[];var _0x5f011d=[];_0x24063e[_0x3e7c('0x96')](function(_0x444715){if(_0x444715[_0x3e7c('0x97')]){var _0x1dcd23=_0x444715[_0x3e7c('0x97')][_0x3e7c('0x3f')](_0x444715[_0x3e7c('0x97')][_0x3e7c('0x40')]('.')+0x1);if(_0x1dcd23===_0x3e7c('0x9b')||_0x1dcd23===_0x3e7c('0x9c')||_0x1dcd23===_0x3e7c('0x9d')||_0x1dcd23==='IntegerAttributeMetadata'||_0x1dcd23===_0x3e7c('0x9e')||_0x1dcd23===_0x3e7c('0x9f')||_0x1dcd23===_0x3e7c('0xa0')||_0x1dcd23===_0x3e7c('0xa1')||_0x1dcd23===_0x3e7c('0xa2')||_0x1dcd23==='DecimalAttributeMetadata'){_0x1eb60b[_0x3e7c('0x99')](getInputList(_0x5405df,_0x4e6199,_0x1dcd23,_0x5f011d,_0x4ce9fe['MetadataId'],_0x444715['MetadataId'],_0x612b3b));}}});return Promise[_0x3e7c('0xa3')](_0x1eb60b);})['then'](function(_0x527ca2){_0x1063cc=_0x527ca2[0x0];var _0x417318=_0x3545e3[_0x3e7c('0x7f')](_0x20e49a)[_0x3e7c('0x7f')](_0x1063cc);var _0x219303={'count':_0x417318[_0x3e7c('0x1c')],'rows':_0x417318};return _0x219303;})[_0x3e7c('0xb')](respondWithResult(_0xc439d0,null))[_0x3e7c('0x2a')](function(_0x2df395){var _0x3e879b=_0x2457d9['query'][_0x3e7c('0xa4')]?0x1f4:_0x2df395[_0x3e7c('0xa5')]||0x1f4;logger[_0x3e7c('0xe')](_0x2df395[_0x3e7c('0xf')]);delete _0x2df395[_0x3e7c('0x10')];if(_0x3e879b===0x191){_0x3e879b=0x190;}_0xc439d0['status'](_0x3e879b)[_0x3e7c('0xa6')](_0x2457d9[_0x3e7c('0x17')][_0x3e7c('0xa4')]?{'message':_0x3e7c('0xa7'),'statusCode':_0x2df395[_0x3e7c('0xa5')]}:_0x2df395);});};function getSelectList(_0x5d9d55,_0x26c6ee,_0x1e2991,_0x456d5d,_0x424df9,_0x3cd277){var _0x52b4cd={'method':_0x3e7c('0x8d'),'uri':_0x5d9d55+_0x3e7c('0x91')+_0x456d5d+_0x3e7c('0xa8')+_0x424df9+_0x3e7c('0xa9')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x3cd277,'If-None-Match':null,'OData-Version':_0x3e7c('0x93')},'json':!![]};return rp(_0x52b4cd)[_0x3e7c('0xb')](function(_0x5070a2){var _0x4e30ed=[];var _0xe62ba9=_0x5070a2[_0x3e7c('0xaa')][_0x3e7c('0xab')];_0xe62ba9['forEach'](function(_0x108aae){_0x4e30ed[_0x3e7c('0x99')]({'name':_0x108aae[_0x3e7c('0xac')]['UserLocalizedLabel'][_0x3e7c('0xac')],'value':String(_0x108aae[_0x3e7c('0xad')])});});var _0x248bef={'id':_0x26c6ee+'_'+_0x5070a2[_0x3e7c('0xae')],'name':_0x5070a2[_0x3e7c('0xaf')][_0x3e7c('0xb0')][_0x3e7c('0xac')],'custom':![],'options':_0x4e30ed};_0x1e2991[_0x3e7c('0x99')](_0x248bef);return _0x1e2991;});}function getBooleanList(_0x369db6,_0x52dac9,_0x1228bb,_0x50588e,_0x1c93bc,_0x1eca38){var _0x2f9c8d={'method':_0x3e7c('0x8d'),'uri':_0x369db6+'EntityDefinitions('+_0x50588e+_0x3e7c('0xa8')+_0x1c93bc+_0x3e7c('0xb1'),'headers':{'Authorization':'Bearer\x20'+_0x1eca38,'If-None-Match':null,'OData-Version':_0x3e7c('0x93')},'json':!![]};return rp(_0x2f9c8d)['then'](function(_0x4cbc92){var _0x1d01f9=[];_0x1d01f9[_0x3e7c('0x99')]({'name':_0x4cbc92[_0x3e7c('0xaa')][_0x3e7c('0xb2')][_0x3e7c('0xac')]['UserLocalizedLabel'][_0x3e7c('0xac')],'value':_0x3e7c('0xb3')},{'name':_0x4cbc92[_0x3e7c('0xaa')][_0x3e7c('0xb4')]['Label'][_0x3e7c('0xb0')][_0x3e7c('0xac')],'value':'false'});var _0x222055={'id':_0x52dac9+'_'+_0x4cbc92[_0x3e7c('0xae')],'name':_0x4cbc92[_0x3e7c('0xaf')]['UserLocalizedLabel'][_0x3e7c('0xac')],'custom':![],'options':_0x1d01f9};_0x1228bb[_0x3e7c('0x99')](_0x222055);return _0x1228bb;});}function getInputList(_0x1767b2,_0x377b93,_0x1d3560,_0x45d802,_0x32ac11,_0x5e8a8b,_0x411d74){var _0x1c4d9f={'method':_0x3e7c('0x8d'),'uri':_0x1767b2+'EntityDefinitions('+_0x32ac11+_0x3e7c('0xa8')+_0x5e8a8b+_0x3e7c('0xb5')+_0x1d3560+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x3e7c('0x8e')+_0x411d74,'If-None-Match':null,'OData-Version':_0x3e7c('0x93')},'json':!![]};return rp(_0x1c4d9f)[_0x3e7c('0xb')](function(_0x185114){var _0x55768f={'id':_0x377b93+'_'+_0x185114['LogicalName'],'name':_0x185114['DisplayName'][_0x3e7c('0xb0')]?_0x185114[_0x3e7c('0xaf')][_0x3e7c('0xb0')]['Label']:_0x185114[_0x3e7c('0xae')],'custom':![],'options':[]};_0x45d802[_0x3e7c('0x99')](_0x55768f);return _0x45d802;});} \ No newline at end of file +var _0x545c=['order','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','access_token','data5','https://login.microsoftonline.com/','/oauth2/token','password','GET','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','send',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Attributes(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','destroy','then','end','sendStatus','stack','name','index','map','Dynamics365Account','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','rows','catch','length','find','create','update','body','params','getConfigurations','Dynamics365Configuration'];(function(_0xfb7c07,_0x4b60f1){var _0x3d80ff=function(_0x15fffa){while(--_0x15fffa){_0xfb7c07['push'](_0xfb7c07['shift']());}};_0x3d80ff(++_0x4b60f1);}(_0x545c,0x89));var _0xc545=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x545c[_0x34c027];return _0x47bff0;};'use strict';var rp=require(_0xc545('0x0'));var util=require('util');var _=require(_0xc545('0x1'));var qs=require(_0xc545('0x2'));var logger=require('../../config/logger')(_0xc545('0x3'));var db=require(_0xc545('0x4'))['db'];var integrations=require(_0xc545('0x5'));function respondWithResult(_0x592f66,_0x4432bd){_0x4432bd=_0x4432bd||0xc8;return function(_0x404592){if(_0x404592){return _0x592f66[_0xc545('0x6')](_0x4432bd)[_0xc545('0x7')](_0x404592);}};}function respondWithFilteredResult(_0x5d2c6c,_0x4b5db1){return function(_0x25655d){if(_0x25655d){var _0x4864a9=typeof _0x4b5db1[_0xc545('0x8')]===_0xc545('0x9')&&typeof _0x4b5db1[_0xc545('0xa')]===_0xc545('0x9');var _0x1e1c2a=_0x25655d[_0xc545('0xb')];var _0x5dc371=_0x4864a9?0x0:_0x4b5db1[_0xc545('0x8')];var _0x439af6=_0x4864a9?_0x25655d[_0xc545('0xb')]:_0x4b5db1[_0xc545('0x8')]+_0x4b5db1['limit'];var _0xebb996;if(_0x439af6>=_0x1e1c2a){_0x439af6=_0x1e1c2a;_0xebb996=0xc8;}else{_0xebb996=0xce;}_0x5d2c6c[_0xc545('0x6')](_0xebb996);return _0x5d2c6c[_0xc545('0xc')]('Content-Range',_0x5dc371+'-'+_0x439af6+'/'+_0x1e1c2a)[_0xc545('0x7')](_0x25655d);}return null;};}function saveUpdates(_0x2fcae7){return function(_0x2d605a){if(_0x2d605a){return _0x2d605a['update'](_0x2fcae7)['then'](function(_0x3ed527){return _0x3ed527;});}return null;};}function removeEntity(_0x46fef6){return function(_0x59984c){if(_0x59984c){return _0x59984c[_0xc545('0xd')]()[_0xc545('0xe')](function(){_0x46fef6[_0xc545('0x6')](0xcc)[_0xc545('0xf')]();});}};}function handleEntityNotFound(_0x2af8be){return function(_0x21e46f){if(!_0x21e46f){_0x2af8be[_0xc545('0x10')](0x194);}return _0x21e46f;};}function handleError(_0x246d56,_0x2aaafe){_0x2aaafe=_0x2aaafe||0x1f4;return function(_0x300b51){logger['error'](_0x300b51[_0xc545('0x11')]);if(_0x300b51[_0xc545('0x12')]){delete _0x300b51['name'];}_0x246d56[_0xc545('0x6')](_0x2aaafe)['send'](_0x300b51);};}exports[_0xc545('0x13')]=function(_0xb58002,_0x319c35){var _0x35641e={},_0x452e9f={},_0x5eb112={'count':0x0,'rows':[]};var _0x2932e5=_[_0xc545('0x14')](db[_0xc545('0x15')][_0xc545('0x16')],function(_0x40e56f){return{'name':_0x40e56f['fieldName'],'type':_0x40e56f['type'][_0xc545('0x17')]};});_0x452e9f[_0xc545('0x18')]=_[_0xc545('0x14')](_0x2932e5,_0xc545('0x12'));_0x452e9f[_0xc545('0x19')]=_[_0xc545('0x1a')](_0xb58002['query']);_0x452e9f[_0xc545('0x1b')]=_['intersection'](_0x452e9f[_0xc545('0x18')],_0x452e9f[_0xc545('0x19')]);_0x35641e['attributes']=_[_0xc545('0x1c')](_0x452e9f[_0xc545('0x18')],qs[_0xc545('0x1d')](_0xb58002[_0xc545('0x19')][_0xc545('0x1d')]));_0x35641e[_0xc545('0x1e')]=_0x35641e[_0xc545('0x1e')]['length']?_0x35641e['attributes']:_0x452e9f[_0xc545('0x18')];if(!_0xb58002['query'][_0xc545('0x1f')](_0xc545('0x20'))){_0x35641e[_0xc545('0xa')]=qs[_0xc545('0xa')](_0xb58002[_0xc545('0x19')]['limit']);_0x35641e[_0xc545('0x8')]=qs[_0xc545('0x8')](_0xb58002[_0xc545('0x19')][_0xc545('0x8')]);}_0x35641e['order']=qs[_0xc545('0x21')](_0xb58002[_0xc545('0x19')][_0xc545('0x21')]);_0x35641e[_0xc545('0x22')]=qs['filters'](_['pick'](_0xb58002['query'],_0x452e9f[_0xc545('0x1b')]),_0x2932e5);if(_0xb58002['query'][_0xc545('0x23')]){_0x35641e[_0xc545('0x22')]=_[_0xc545('0x24')](_0x35641e[_0xc545('0x22')],{'$or':_[_0xc545('0x14')](_0x2932e5,function(_0x43f337){if(_0x43f337[_0xc545('0x25')]!=='VIRTUAL'){var _0x330aca={};_0x330aca[_0x43f337[_0xc545('0x12')]]={'$like':'%'+_0xb58002['query']['filter']+'%'};return _0x330aca;}})});}_0x35641e=_['merge']({},_0x35641e,_0xb58002[_0xc545('0x26')]);var _0x54489b={'where':_0x35641e[_0xc545('0x22')]};return db[_0xc545('0x15')][_0xc545('0xb')](_0x54489b)[_0xc545('0xe')](function(_0x114870){_0x5eb112['count']=_0x114870;if(_0xb58002[_0xc545('0x19')][_0xc545('0x27')]){_0x35641e['include']=[{'all':!![]}];}return db[_0xc545('0x15')]['findAll'](_0x35641e);})[_0xc545('0xe')](function(_0x5a38e2){_0x5eb112[_0xc545('0x28')]=_0x5a38e2;return _0x5eb112;})[_0xc545('0xe')](respondWithFilteredResult(_0x319c35,_0x35641e))[_0xc545('0x29')](handleError(_0x319c35,null));};exports['show']=function(_0x4fa9a3,_0x337be0){var _0x168cee={'raw':![],'where':{'id':_0x4fa9a3['params']['id']}},_0x32cc9a={};_0x32cc9a[_0xc545('0x18')]=_[_0xc545('0x1a')](db[_0xc545('0x15')]['rawAttributes']);_0x32cc9a[_0xc545('0x19')]=_[_0xc545('0x1a')](_0x4fa9a3[_0xc545('0x19')]);_0x32cc9a[_0xc545('0x1b')]=_[_0xc545('0x1c')](_0x32cc9a[_0xc545('0x18')],_0x32cc9a[_0xc545('0x19')]);_0x168cee['attributes']=_[_0xc545('0x1c')](_0x32cc9a[_0xc545('0x18')],qs['fields'](_0x4fa9a3[_0xc545('0x19')][_0xc545('0x1d')]));_0x168cee[_0xc545('0x1e')]=_0x168cee['attributes'][_0xc545('0x2a')]?_0x168cee['attributes']:_0x32cc9a[_0xc545('0x18')];if(_0x4fa9a3[_0xc545('0x19')][_0xc545('0x27')]){_0x168cee['include']=[{'all':!![]}];}_0x168cee=_[_0xc545('0x24')]({},_0x168cee,_0x4fa9a3[_0xc545('0x26')]);return db['Dynamics365Account'][_0xc545('0x2b')](_0x168cee)[_0xc545('0xe')](handleEntityNotFound(_0x337be0,null))[_0xc545('0xe')](respondWithResult(_0x337be0,null))['catch'](handleError(_0x337be0,null));};exports[_0xc545('0x2c')]=function(_0x267295,_0x3a4d18){return db[_0xc545('0x15')][_0xc545('0x2c')](_0x267295['body'],{})[_0xc545('0xe')](respondWithResult(_0x3a4d18,0xc9))['catch'](handleError(_0x3a4d18,null));};exports[_0xc545('0x2d')]=function(_0x4a4580,_0x5de5ce){if(_0x4a4580['body']['id']){delete _0x4a4580[_0xc545('0x2e')]['id'];}return db[_0xc545('0x15')][_0xc545('0x2b')]({'where':{'id':_0x4a4580[_0xc545('0x2f')]['id']}})[_0xc545('0xe')](handleEntityNotFound(_0x5de5ce,null))[_0xc545('0xe')](saveUpdates(_0x4a4580[_0xc545('0x2e')],null))['then'](respondWithResult(_0x5de5ce,null))[_0xc545('0x29')](handleError(_0x5de5ce,null));};exports[_0xc545('0xd')]=function(_0x2053d4,_0x12cafd){return db[_0xc545('0x15')][_0xc545('0x2b')]({'where':{'id':_0x2053d4[_0xc545('0x2f')]['id']}})[_0xc545('0xe')](handleEntityNotFound(_0x12cafd,null))[_0xc545('0xe')](removeEntity(_0x12cafd,null))[_0xc545('0x29')](handleError(_0x12cafd,null));};exports[_0xc545('0x30')]=function(_0xc6bba1,_0x175d8f){var _0x55fbb4={};var _0x69f12f={};var _0x36b2d4;var _0x19513f;return db[_0xc545('0x15')]['findOne']({'where':{'id':_0xc6bba1[_0xc545('0x2f')]['id']}})[_0xc545('0xe')](handleEntityNotFound(_0x175d8f,null))[_0xc545('0xe')](function(_0x47f9be){if(_0x47f9be){_0x36b2d4=_0x47f9be;_0x69f12f[_0xc545('0x18')]=_[_0xc545('0x1a')](db[_0xc545('0x31')]['rawAttributes']);_0x69f12f[_0xc545('0x19')]=_[_0xc545('0x1a')](_0xc6bba1[_0xc545('0x19')]);_0x69f12f['filters']=_[_0xc545('0x1c')](_0x69f12f[_0xc545('0x18')],_0x69f12f['query']);_0x55fbb4[_0xc545('0x1e')]=_[_0xc545('0x1c')](_0x69f12f[_0xc545('0x18')],qs[_0xc545('0x1d')](_0xc6bba1[_0xc545('0x19')]['fields']));_0x55fbb4[_0xc545('0x1e')]=_0x55fbb4['attributes'][_0xc545('0x2a')]?_0x55fbb4[_0xc545('0x1e')]:_0x69f12f[_0xc545('0x18')];_0x55fbb4[_0xc545('0x32')]=qs['sort'](_0xc6bba1[_0xc545('0x19')][_0xc545('0x21')]);_0x55fbb4['where']=qs[_0xc545('0x1b')](_['pick'](_0xc6bba1[_0xc545('0x19')],_0x69f12f[_0xc545('0x1b')]));if(_0xc6bba1[_0xc545('0x19')][_0xc545('0x23')]){_0x55fbb4[_0xc545('0x22')]=_[_0xc545('0x24')](_0x55fbb4['where'],{'$or':_[_0xc545('0x14')](_0x55fbb4[_0xc545('0x1e')],function(_0x4eba35){var _0x2cb98a={};_0x2cb98a[_0x4eba35]={'$like':'%'+_0xc6bba1[_0xc545('0x19')][_0xc545('0x23')]+'%'};return _0x2cb98a;})});}_0x55fbb4=_[_0xc545('0x24')]({},_0x55fbb4,_0xc6bba1['options']);return _0x36b2d4[_0xc545('0x30')](_0x55fbb4);}})[_0xc545('0xe')](function(_0x5ef85c){if(_0x5ef85c){_0x19513f=_0x5ef85c[_0xc545('0x2a')];if(!_0xc6bba1[_0xc545('0x19')][_0xc545('0x1f')](_0xc545('0x20'))){_0x55fbb4[_0xc545('0xa')]=qs['limit'](_0xc6bba1['query'][_0xc545('0xa')]);_0x55fbb4[_0xc545('0x8')]=qs[_0xc545('0x8')](_0xc6bba1[_0xc545('0x19')]['offset']);}return _0x36b2d4[_0xc545('0x30')](_0x55fbb4);}})[_0xc545('0xe')](function(_0x1409f1){if(_0x1409f1){return _0x1409f1?{'count':_0x19513f,'rows':_0x1409f1}:null;}})[_0xc545('0xe')](respondWithResult(_0x175d8f,null))[_0xc545('0x29')](handleError(_0x175d8f,null));};exports[_0xc545('0x33')]=function(_0x5e5196,_0x10c77d){if(_0x5e5196['body']['id']){delete _0x5e5196[_0xc545('0x2e')]['id'];}return db[_0xc545('0x15')][_0xc545('0x34')]({'where':{'id':_0x5e5196['params']['id']}})[_0xc545('0xe')](handleEntityNotFound(_0x10c77d,null))[_0xc545('0xe')](function(_0x241232){if(_0x241232){_0x5e5196[_0xc545('0x2e')]['AccountId']=_0x241232['id'];_0x5e5196['body'][_0xc545('0x35')]=integrations[_0xc545('0x36')](_0x5e5196[_0xc545('0x2e')][_0xc545('0x37')],_0x5e5196['body'][_0xc545('0x25')]);_0x5e5196['body'][_0xc545('0x38')]=integrations['getDescriptions'](_0x5e5196[_0xc545('0x2e')][_0xc545('0x37')],_0x5e5196[_0xc545('0x2e')][_0xc545('0x25')]);return db[_0xc545('0x31')][_0xc545('0x2c')](_0x5e5196['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xc545('0x35')},{'model':db[_0xc545('0x39')],'as':_0xc545('0x38')}]});}return null;})[_0xc545('0xe')](respondWithResult(_0x10c77d,null))['catch'](handleError(_0x10c77d,null));};function sanitizeRemoteUri(_0x59c1d3){var _0x58633d=_0x59c1d3[_0xc545('0x3a')](-0x1);if(_0x58633d==='/')return _0x59c1d3['substring'](0x0,_0x59c1d3[_0xc545('0x3b')](_0x58633d));return _0x59c1d3;}function getWebApiUrl(_0x54a981){return util[_0xc545('0x3c')](_0xc545('0x3d'),_0x54a981);}exports[_0xc545('0x3e')]=function(_0x4a2909,_0x16034a){var _0x5f4d45=_0x4a2909['query'][_0xc545('0x3f')];var _0x1eb74c=_0x5f4d45==='incident'?'Incident':'PhoneCall';var _0x1f20f7='';var _0x30cd8b='';var _0x54bbd2='';var _0x2ec5d9='';var _0x5b5976='';var _0x5ea760='';var _0x13cc33='';var _0x105e04='';var _0x3f2682=[_0xc545('0x40'),_0xc545('0x41'),_0xc545('0x42'),_0xc545('0x43'),_0xc545('0x44'),_0xc545('0x45'),'phonenumber',_0xc545('0x46'),_0xc545('0x47'),_0xc545('0x48')];var _0x43bf5e=[_0xc545('0x49'),'accountidyominame',_0xc545('0x4a'),'billedserviceunits','contactidname','contactidyominame',_0xc545('0x4b'),_0xc545('0x4c'),_0xc545('0x4d'),'createdbyexternalpartyyominame',_0xc545('0x4e'),_0xc545('0x4f'),_0xc545('0x50'),_0xc545('0x51'),_0xc545('0x52'),_0xc545('0x53'),_0xc545('0x54'),'customeridyominame',_0xc545('0x55'),_0xc545('0x56'),'entityimage_timestamp',_0xc545('0x57'),_0xc545('0x58'),_0xc545('0x59'),_0xc545('0x5a'),_0xc545('0x5b'),_0xc545('0x5c'),'influencescore','kbarticleidname',_0xc545('0x5d'),_0xc545('0x5e'),_0xc545('0x5f'),_0xc545('0x60'),_0xc545('0x61'),'modifiedbyyominame',_0xc545('0x62'),_0xc545('0x63'),_0xc545('0x64'),_0xc545('0x65'),_0xc545('0x66'),_0xc545('0x67'),_0xc545('0x68'),_0xc545('0x69'),_0xc545('0x6a'),'owneridtype',_0xc545('0x6b'),_0xc545('0x6c'),_0xc545('0x6d'),_0xc545('0x6e'),_0xc545('0x6f'),_0xc545('0x70'),_0xc545('0x71'),_0xc545('0x72'),_0xc545('0x73'),_0xc545('0x74'),_0xc545('0x75'),_0xc545('0x76'),_0xc545('0x77'),_0xc545('0x78'),_0xc545('0x79'),_0xc545('0x7a'),'statecode',_0xc545('0x7b'),_0xc545('0x7c'),_0xc545('0x7d'),_0xc545('0x7e'),_0xc545('0x7f'),_0xc545('0x80'),_0xc545('0x81'),_0xc545('0x82')];var _0x52aef7=_0x3f2682[_0xc545('0x83')](_0x43bf5e);return db[_0xc545('0x15')]['findOne']({'where':{'id':_0x4a2909[_0xc545('0x2f')]['id']},'attributes':['id',_0xc545('0x84'),'password',_0xc545('0x85'),_0xc545('0x86'),_0xc545('0x87'),_0xc545('0x88'),_0xc545('0x89')],'include':[{'model':db[_0xc545('0x8a')],'as':_0xc545('0x8a'),'attributes':['id','data5','data7']}]})[_0xc545('0xe')](handleEntityNotFound(_0x16034a,null))[_0xc545('0xe')](function(_0x12eebe){if(_0x12eebe){if(_0x12eebe[_0xc545('0x89')]){_0x12eebe[_0xc545('0x8b')]=_0x12eebe[_0xc545('0x8a')][_0xc545('0x8c')];_0x105e04=sanitizeRemoteUri(_0x12eebe[_0xc545('0x8a')]['data7']);_0x13cc33=getWebApiUrl(_0x105e04);return _0x12eebe;}_0x105e04=sanitizeRemoteUri(_0x12eebe['remoteUri']);_0x13cc33=getWebApiUrl(_0x105e04);var _0x3d4cb5={'method':'POST','uri':_0xc545('0x8d')+_0x12eebe[_0xc545('0x86')]+_0xc545('0x8e'),'form':{'client_id':_0x12eebe['clientId'],'resource':_0x105e04,'username':_0x12eebe[_0xc545('0x84')],'password':_0x12eebe[_0xc545('0x8f')],'grant_type':_0xc545('0x8f'),'client_secret':_0x12eebe[_0xc545('0x88')]},'json':!![]};return rp(_0x3d4cb5);}})[_0xc545('0xe')](function(_0x3bfc16){_0x5ea760=_0x3bfc16['access_token'];var _0x27c509={'method':_0xc545('0x90'),'uri':encodeURI(_0x13cc33+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1eb74c+'\x27'),'headers':{'Authorization':_0xc545('0x91')+_0x5ea760,'If-None-Match':null,'OData-Version':_0xc545('0x92')},'json':!![]};return rp(_0x27c509);})['then'](function(_0x5a290e){var _0x1f629a=_0x5a290e['value'][0x0];var _0x4c36d9=_0x1f629a[_0xc545('0x93')];var _0xad51ad={'method':'GET','uri':_0x13cc33+_0xc545('0x94')+_0x4c36d9+_0xc545('0x95'),'headers':{'Authorization':_0xc545('0x91')+_0x5ea760,'If-None-Match':null,'OData-Version':_0xc545('0x92')},'json':!![]};return rp(_0xad51ad);})[_0xc545('0xe')](function(_0x4a05be){_0x1f20f7=_0x4a05be;_0x30cd8b=_0x1f20f7[_0xc545('0x96')];_0x30cd8b=_[_0xc545('0x97')](_0x30cd8b,function(_0x4790fc){return!_0x52aef7[_0xc545('0x98')](_0x4790fc[_0xc545('0x99')]);});var _0x4e0fa7=[];var _0x497357=[];_0x30cd8b[_0xc545('0x9a')](function(_0x429705){if(_0x429705[_0xc545('0x9b')]){var _0x4f2947=_0x429705['@odata.type'][_0xc545('0x9c')](_0x429705['@odata.type'][_0xc545('0x3b')]('.')+0x1);if(_0x4f2947==='PicklistAttributeMetadata'){_0x4e0fa7[_0xc545('0x9d')](getSelectList(_0x13cc33,_0x5f4d45,_0x497357,_0x1f20f7[_0xc545('0x93')],_0x429705[_0xc545('0x93')],_0x5ea760));}}});return Promise[_0xc545('0x9e')](_0x4e0fa7);})[_0xc545('0xe')](function(_0x44c92f){_0x54bbd2=_0x44c92f[0x0];var _0x527406=[];var _0x562ea2=[];_0x30cd8b['forEach'](function(_0x19d1f9){if(!_['isNil'](_0x19d1f9[_0xc545('0x9b')])){var _0x412347=_0x19d1f9[_0xc545('0x9b')][_0xc545('0x9c')](_0x19d1f9['@odata.type'][_0xc545('0x3b')]('.')+0x1);if(_0x412347===_0xc545('0x9f')){_0x527406[_0xc545('0x9d')](getBooleanList(_0x13cc33,_0x5f4d45,_0x562ea2,_0x1f20f7[_0xc545('0x93')],_0x19d1f9[_0xc545('0x93')],_0x5ea760));}}});return Promise[_0xc545('0x9e')](_0x527406);})[_0xc545('0xe')](function(_0x2dbbd5){_0x2ec5d9=_0x2dbbd5[0x0];var _0x45c344=[];var _0x3d585a=[];_0x30cd8b[_0xc545('0x9a')](function(_0x23eb01){if(_0x23eb01['@odata.type']){var _0x5e3d36=_0x23eb01['@odata.type'][_0xc545('0x9c')](_0x23eb01[_0xc545('0x9b')]['lastIndexOf']('.')+0x1);if(_0x5e3d36===_0xc545('0xa0')||_0x5e3d36===_0xc545('0xa1')||_0x5e3d36===_0xc545('0xa2')||_0x5e3d36===_0xc545('0xa3')||_0x5e3d36===_0xc545('0xa4')||_0x5e3d36===_0xc545('0xa5')||_0x5e3d36===_0xc545('0xa6')||_0x5e3d36===_0xc545('0xa7')||_0x5e3d36===_0xc545('0xa8')||_0x5e3d36==='DecimalAttributeMetadata'){_0x45c344['push'](getInputList(_0x13cc33,_0x5f4d45,_0x5e3d36,_0x3d585a,_0x1f20f7[_0xc545('0x93')],_0x23eb01[_0xc545('0x93')],_0x5ea760));}}});return Promise['all'](_0x45c344);})[_0xc545('0xe')](function(_0x471280){_0x5b5976=_0x471280[0x0];var _0x4fd522=_0x54bbd2[_0xc545('0x83')](_0x2ec5d9)[_0xc545('0x83')](_0x5b5976);var _0xceca7f={'count':_0x4fd522['length'],'rows':_0x4fd522};return _0xceca7f;})[_0xc545('0xe')](respondWithResult(_0x16034a,null))[_0xc545('0x29')](function(_0x3dd061){var _0x4f8f2c=_0x4a2909[_0xc545('0x19')][_0xc545('0xa9')]?0x1f4:_0x3dd061[_0xc545('0xaa')]||0x1f4;logger['error'](_0x3dd061['stack']);delete _0x3dd061[_0xc545('0x12')];if(_0x4f8f2c===0x191){_0x4f8f2c=0x190;}_0x16034a[_0xc545('0x6')](_0x4f8f2c)[_0xc545('0xab')](_0x4a2909[_0xc545('0x19')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3dd061[_0xc545('0xaa')]}:_0x3dd061);});};function getSelectList(_0x113d2b,_0x266679,_0x3bff81,_0x1d4fc4,_0x1304d5,_0x3cb3c1){var _0x4a1633={'method':_0xc545('0x90'),'uri':_0x113d2b+_0xc545('0x94')+_0x1d4fc4+')/Attributes('+_0x1304d5+_0xc545('0xac')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xc545('0x91')+_0x3cb3c1,'If-None-Match':null,'OData-Version':_0xc545('0x92')},'json':!![]};return rp(_0x4a1633)['then'](function(_0x244606){var _0xd7439a=[];var _0x3130f9=_0x244606['OptionSet'][_0xc545('0xad')];_0x3130f9[_0xc545('0x9a')](function(_0x5be2bd){_0xd7439a[_0xc545('0x9d')]({'name':_0x5be2bd['Label']['UserLocalizedLabel'][_0xc545('0xae')],'value':String(_0x5be2bd[_0xc545('0xaf')])});});var _0x466c6f={'id':_0x266679+'_'+_0x244606['LogicalName'],'name':_0x244606[_0xc545('0xb0')][_0xc545('0xb1')][_0xc545('0xae')],'custom':![],'options':_0xd7439a};_0x3bff81[_0xc545('0x9d')](_0x466c6f);return _0x3bff81;});}function getBooleanList(_0x42b529,_0x18c490,_0x52a563,_0x5ca825,_0x59f847,_0xc849ff){var _0x5978a6={'method':'GET','uri':_0x42b529+_0xc545('0x94')+_0x5ca825+')/Attributes('+_0x59f847+_0xc545('0xb2'),'headers':{'Authorization':_0xc545('0x91')+_0xc849ff,'If-None-Match':null,'OData-Version':_0xc545('0x92')},'json':!![]};return rp(_0x5978a6)[_0xc545('0xe')](function(_0xa64a01){var _0x5cf2a5=[];_0x5cf2a5[_0xc545('0x9d')]({'name':_0xa64a01[_0xc545('0xb3')][_0xc545('0xb4')][_0xc545('0xae')]['UserLocalizedLabel'][_0xc545('0xae')],'value':_0xc545('0xb5')},{'name':_0xa64a01[_0xc545('0xb3')][_0xc545('0xb6')]['Label']['UserLocalizedLabel'][_0xc545('0xae')],'value':_0xc545('0xb7')});var _0x56af3b={'id':_0x18c490+'_'+_0xa64a01[_0xc545('0x99')],'name':_0xa64a01[_0xc545('0xb0')][_0xc545('0xb1')][_0xc545('0xae')],'custom':![],'options':_0x5cf2a5};_0x52a563[_0xc545('0x9d')](_0x56af3b);return _0x52a563;});}function getInputList(_0x1a34b2,_0x16f768,_0x1ff4a4,_0xc4d5c3,_0x1a22af,_0x3bea3e,_0x572c7f){var _0x3d74eb={'method':_0xc545('0x90'),'uri':_0x1a34b2+_0xc545('0x94')+_0x1a22af+_0xc545('0xb8')+_0x3bea3e+_0xc545('0xb9')+_0x1ff4a4+_0xc545('0xba'),'headers':{'Authorization':_0xc545('0x91')+_0x572c7f,'If-None-Match':null,'OData-Version':_0xc545('0x92')},'json':!![]};return rp(_0x3d74eb)[_0xc545('0xe')](function(_0x156a85){var _0x2c7579={'id':_0x16f768+'_'+_0x156a85[_0xc545('0x99')],'name':_0x156a85[_0xc545('0xb0')][_0xc545('0xb1')]?_0x156a85[_0xc545('0xb0')][_0xc545('0xb1')][_0xc545('0xae')]:_0x156a85[_0xc545('0x99')],'custom':![],'options':[]};_0xc4d5c3[_0xc545('0x9d')](_0x2c7579);return _0xc4d5c3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index bbbd9d0..4225d61 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x4a06e5,_0x20b853){var _0x2d7641=function(_0x2fab4f){while(--_0x2fab4f){_0x4a06e5['push'](_0x4a06e5['shift']());}};_0x2d7641(++_0x20b853);}(_0xe706,0xa3));var _0x6e70=function(_0x2abd03,_0x15bd78){_0x2abd03=_0x2abd03-0x0;var _0x397306=_0xe706[_0x2abd03];return _0x397306;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x5d10e4,_0x4f743f){var _0x4575f5=function(_0x28cd03){while(--_0x28cd03){_0x5d10e4['push'](_0x5d10e4['shift']());}};_0x4575f5(++_0x4f743f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 12af1b8..7850b15 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 _0x8e12=['stringify','ShowDynamics365Account','Dynamics365Account','find','lodash','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','findAll','options','raw','where','limit','include','map','model','attributes','GetDynamics365Account'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x8e12,0x178));var _0x28e1=function(_0x5e61b4,_0x57ef43){_0x5e61b4=_0x5e61b4-0x0;var _0x3bf94b=_0x8e12[_0x5e61b4];return _0x3bf94b;};'use strict';var _=require(_0x28e1('0x0'));var util=require('util');var moment=require(_0x28e1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x28e1('0x2'));var logger=require(_0x28e1('0x3'))(_0x28e1('0x4'));var config=require('../../config/environment');var jayson=require(_0x28e1('0x5'));var client=jayson[_0x28e1('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2695e6,_0x5cdfd2,_0x57ecb2){return new BPromise(function(_0x79d624,_0xb02e2f){return client[_0x28e1('0x7')](_0x2695e6,_0x57ecb2)['then'](function(_0x4e7332){logger[_0x28e1('0x8')](_0x28e1('0x9'),_0x5cdfd2,'request\x20sent');logger[_0x28e1('0xa')](_0x28e1('0xb'),_0x5cdfd2,'request\x20sent',JSON['stringify'](_0x4e7332));if(_0x4e7332['error']){if(_0x4e7332[_0x28e1('0xc')][_0x28e1('0xd')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5cdfd2,_0x4e7332['error']['message']);return _0xb02e2f(_0x4e7332[_0x28e1('0xc')]['message']);}logger[_0x28e1('0xc')](_0x28e1('0x9'),_0x5cdfd2,_0x4e7332['error'][_0x28e1('0xe')]);return _0x79d624(_0x4e7332['error'][_0x28e1('0xe')]);}else{logger[_0x28e1('0x8')](_0x28e1('0x9'),_0x5cdfd2,_0x28e1('0xf'));_0x79d624(_0x4e7332[_0x28e1('0x10')][_0x28e1('0xe')]);}})['catch'](function(_0x1e6335){logger[_0x28e1('0xc')](_0x28e1('0x9'),_0x5cdfd2,_0x1e6335);_0xb02e2f(_0x1e6335);});});}exports['GetDynamics365Account']=function(_0x4c463c){var _0xdbe061=this;return new Promise(function(_0x32508b,_0x4d4afa){return db['Dynamics365Account'][_0x28e1('0x11')]({'raw':_0x4c463c[_0x28e1('0x12')]?_0x4c463c[_0x28e1('0x12')][_0x28e1('0x13')]===undefined?!![]:![]:!![],'where':_0x4c463c[_0x28e1('0x12')]?_0x4c463c['options'][_0x28e1('0x14')]||null:null,'attributes':_0x4c463c[_0x28e1('0x12')]?_0x4c463c[_0x28e1('0x12')]['attributes']||null:null,'limit':_0x4c463c[_0x28e1('0x12')]?_0x4c463c[_0x28e1('0x12')][_0x28e1('0x15')]||null:null,'include':_0x4c463c[_0x28e1('0x12')]?_0x4c463c[_0x28e1('0x12')][_0x28e1('0x16')]?_[_0x28e1('0x17')](_0x4c463c[_0x28e1('0x12')][_0x28e1('0x16')],function(_0x1ff550){return{'model':db[_0x1ff550[_0x28e1('0x18')]],'as':_0x1ff550['as'],'attributes':_0x1ff550[_0x28e1('0x19')],'include':_0x1ff550['include']?_[_0x28e1('0x17')](_0x1ff550[_0x28e1('0x16')],function(_0x5a2a66){return{'model':db[_0x5a2a66[_0x28e1('0x18')]],'as':_0x5a2a66['as'],'attributes':_0x5a2a66['attributes'],'include':_0x5a2a66['include']?_[_0x28e1('0x17')](_0x5a2a66['include'],function(_0x24c57f){return{'model':db[_0x24c57f['model']],'as':_0x24c57f['as'],'attributes':_0x24c57f[_0x28e1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46b213){logger['info'](_0x28e1('0x1a'),_0x4c463c);logger[_0x28e1('0xa')](_0x28e1('0x1a'),_0x4c463c,JSON[_0x28e1('0x1b')](_0x46b213));_0x32508b(_0x46b213);})['catch'](function(_0x545731){logger[_0x28e1('0xc')](_0x28e1('0x1a'),_0x545731[_0x28e1('0xe')],_0x4c463c);_0x4d4afa(_0xdbe061[_0x28e1('0xc')](0x1f4,_0x545731[_0x28e1('0xe')]));});});};exports[_0x28e1('0x1c')]=function(_0x3f7581){var _0x158818=this;return new Promise(function(_0xff664a,_0x250f92){return db[_0x28e1('0x1d')][_0x28e1('0x1e')]({'raw':_0x3f7581['options']?_0x3f7581['options'][_0x28e1('0x13')]===undefined?!![]:![]:!![],'where':_0x3f7581[_0x28e1('0x12')]?_0x3f7581[_0x28e1('0x12')]['where']||null:null,'attributes':_0x3f7581['options']?_0x3f7581[_0x28e1('0x12')][_0x28e1('0x19')]||null:null,'include':_0x3f7581['options']?_0x3f7581[_0x28e1('0x12')][_0x28e1('0x16')]?_['map'](_0x3f7581['options'][_0x28e1('0x16')],function(_0x2a6c1d){return{'model':db[_0x2a6c1d[_0x28e1('0x18')]],'as':_0x2a6c1d['as'],'attributes':_0x2a6c1d[_0x28e1('0x19')],'include':_0x2a6c1d[_0x28e1('0x16')]?_[_0x28e1('0x17')](_0x2a6c1d[_0x28e1('0x16')],function(_0x11e1e7){return{'model':db[_0x11e1e7['model']],'as':_0x11e1e7['as'],'attributes':_0x11e1e7[_0x28e1('0x19')],'include':_0x11e1e7[_0x28e1('0x16')]?_[_0x28e1('0x17')](_0x11e1e7['include'],function(_0x4a0429){return{'model':db[_0x4a0429[_0x28e1('0x18')]],'as':_0x4a0429['as'],'attributes':_0x4a0429[_0x28e1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26b578){logger[_0x28e1('0x8')](_0x28e1('0x1c'),_0x3f7581);logger[_0x28e1('0xa')](_0x28e1('0x1c'),_0x3f7581,JSON[_0x28e1('0x1b')](_0x26b578));_0xff664a(_0x26b578);})['catch'](function(_0x21859a){logger[_0x28e1('0xc')](_0x28e1('0x1c'),_0x21859a[_0x28e1('0xe')],_0x3f7581);_0x250f92(_0x158818[_0x28e1('0xc')](0x1f4,_0x21859a[_0x28e1('0xe')]));});});}; \ No newline at end of file +var _0x8cec=['request\x20sent','error','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','include','map','model','stringify','ShowDynamics365Account','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x25a04e,_0x435456){var _0x195480=function(_0x1e33b7){while(--_0x1e33b7){_0x25a04e['push'](_0x25a04e['shift']());}};_0x195480(++_0x435456);}(_0x8cec,0x1de));var _0xc8ce=function(_0x29548c,_0x21279f){_0x29548c=_0x29548c-0x0;var _0x3f6b63=_0x8cec[_0x29548c];return _0x3f6b63;};'use strict';var _=require(_0xc8ce('0x0'));var util=require(_0xc8ce('0x1'));var moment=require('moment');var BPromise=require(_0xc8ce('0x2'));var rs=require(_0xc8ce('0x3'));var fs=require('fs');var Redis=require(_0xc8ce('0x4'));var db=require(_0xc8ce('0x5'))['db'];var utils=require(_0xc8ce('0x6'));var logger=require(_0xc8ce('0x7'))('rpc');var config=require(_0xc8ce('0x8'));var jayson=require(_0xc8ce('0x9'));var client=jayson[_0xc8ce('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cdd55,_0x624fef,_0xd772ec){return new BPromise(function(_0x26d994,_0x1574a2){return client[_0xc8ce('0xb')](_0x4cdd55,_0xd772ec)[_0xc8ce('0xc')](function(_0x494169){logger[_0xc8ce('0xd')](_0xc8ce('0xe'),_0x624fef,'request\x20sent');logger[_0xc8ce('0xf')](_0xc8ce('0x10'),_0x624fef,_0xc8ce('0x11'),JSON['stringify'](_0x494169));if(_0x494169[_0xc8ce('0x12')]){if(_0x494169[_0xc8ce('0x12')]['code']===0x1f4){logger[_0xc8ce('0x12')](_0xc8ce('0xe'),_0x624fef,_0x494169[_0xc8ce('0x12')]['message']);return _0x1574a2(_0x494169[_0xc8ce('0x12')][_0xc8ce('0x13')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x624fef,_0x494169['error']['message']);return _0x26d994(_0x494169[_0xc8ce('0x12')]['message']);}else{logger[_0xc8ce('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x624fef,_0xc8ce('0x11'));_0x26d994(_0x494169[_0xc8ce('0x14')][_0xc8ce('0x13')]);}})[_0xc8ce('0x15')](function(_0x3bebca){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x624fef,_0x3bebca);_0x1574a2(_0x3bebca);});});}exports[_0xc8ce('0x16')]=function(_0x1f6221){var _0x114dcf=this;return new Promise(function(_0x4d3f55,_0xf65ad9){return db[_0xc8ce('0x17')]['findAll']({'raw':_0x1f6221[_0xc8ce('0x18')]?_0x1f6221[_0xc8ce('0x18')][_0xc8ce('0x19')]===undefined?!![]:![]:!![],'where':_0x1f6221[_0xc8ce('0x18')]?_0x1f6221[_0xc8ce('0x18')][_0xc8ce('0x1a')]||null:null,'attributes':_0x1f6221[_0xc8ce('0x18')]?_0x1f6221[_0xc8ce('0x18')][_0xc8ce('0x1b')]||null:null,'limit':_0x1f6221[_0xc8ce('0x18')]?_0x1f6221[_0xc8ce('0x18')]['limit']||null:null,'include':_0x1f6221[_0xc8ce('0x18')]?_0x1f6221[_0xc8ce('0x18')][_0xc8ce('0x1c')]?_[_0xc8ce('0x1d')](_0x1f6221[_0xc8ce('0x18')][_0xc8ce('0x1c')],function(_0x516f53){return{'model':db[_0x516f53[_0xc8ce('0x1e')]],'as':_0x516f53['as'],'attributes':_0x516f53[_0xc8ce('0x1b')],'include':_0x516f53[_0xc8ce('0x1c')]?_[_0xc8ce('0x1d')](_0x516f53['include'],function(_0x36129b){return{'model':db[_0x36129b[_0xc8ce('0x1e')]],'as':_0x36129b['as'],'attributes':_0x36129b[_0xc8ce('0x1b')],'include':_0x36129b[_0xc8ce('0x1c')]?_[_0xc8ce('0x1d')](_0x36129b['include'],function(_0x5bd1e1){return{'model':db[_0x5bd1e1[_0xc8ce('0x1e')]],'as':_0x5bd1e1['as'],'attributes':_0x5bd1e1[_0xc8ce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8ce('0xc')](function(_0x2891c4){logger[_0xc8ce('0xd')](_0xc8ce('0x16'),_0x1f6221);logger[_0xc8ce('0xf')](_0xc8ce('0x16'),_0x1f6221,JSON[_0xc8ce('0x1f')](_0x2891c4));_0x4d3f55(_0x2891c4);})[_0xc8ce('0x15')](function(_0x1759ea){logger['error']('GetDynamics365Account',_0x1759ea[_0xc8ce('0x13')],_0x1f6221);_0xf65ad9(_0x114dcf[_0xc8ce('0x12')](0x1f4,_0x1759ea[_0xc8ce('0x13')]));});});};exports[_0xc8ce('0x20')]=function(_0x3ed4c6){var _0x42e559=this;return new Promise(function(_0x860ba1,_0x3584a9){return db[_0xc8ce('0x17')]['find']({'raw':_0x3ed4c6[_0xc8ce('0x18')]?_0x3ed4c6[_0xc8ce('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3ed4c6[_0xc8ce('0x18')]?_0x3ed4c6[_0xc8ce('0x18')][_0xc8ce('0x1a')]||null:null,'attributes':_0x3ed4c6[_0xc8ce('0x18')]?_0x3ed4c6[_0xc8ce('0x18')][_0xc8ce('0x1b')]||null:null,'include':_0x3ed4c6[_0xc8ce('0x18')]?_0x3ed4c6[_0xc8ce('0x18')][_0xc8ce('0x1c')]?_[_0xc8ce('0x1d')](_0x3ed4c6[_0xc8ce('0x18')]['include'],function(_0x55757b){return{'model':db[_0x55757b[_0xc8ce('0x1e')]],'as':_0x55757b['as'],'attributes':_0x55757b['attributes'],'include':_0x55757b[_0xc8ce('0x1c')]?_[_0xc8ce('0x1d')](_0x55757b[_0xc8ce('0x1c')],function(_0x1c734f){return{'model':db[_0x1c734f[_0xc8ce('0x1e')]],'as':_0x1c734f['as'],'attributes':_0x1c734f[_0xc8ce('0x1b')],'include':_0x1c734f['include']?_[_0xc8ce('0x1d')](_0x1c734f[_0xc8ce('0x1c')],function(_0x202c29){return{'model':db[_0x202c29[_0xc8ce('0x1e')]],'as':_0x202c29['as'],'attributes':_0x202c29[_0xc8ce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8ce('0xc')](function(_0x585b16){logger[_0xc8ce('0xd')]('ShowDynamics365Account',_0x3ed4c6);logger[_0xc8ce('0xf')](_0xc8ce('0x20'),_0x3ed4c6,JSON['stringify'](_0x585b16));_0x860ba1(_0x585b16);})['catch'](function(_0x4c92c8){logger[_0xc8ce('0x12')](_0xc8ce('0x20'),_0x4c92c8[_0xc8ce('0x13')],_0x3ed4c6);_0x3584a9(_0x42e559[_0xc8ce('0x12')](0x1f4,_0x4c92c8['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b08903f..101c464 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 _0x1dcd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','get','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x463bc5,_0x47a997){var _0x1f20a0=function(_0x5b463d){while(--_0x5b463d){_0x463bc5['push'](_0x463bc5['shift']());}};_0x1f20a0(++_0x47a997);}(_0x1dcd,0x100));var _0xd1dc=function(_0x2b2193,_0x220cf2){_0x2b2193=_0x2b2193-0x0;var _0xd4faf8=_0x1dcd[_0x2b2193];return _0xd4faf8;};'use strict';var multer=require(_0xd1dc('0x0'));var util=require(_0xd1dc('0x1'));var path=require(_0xd1dc('0x2'));var timeout=require(_0xd1dc('0x3'));var express=require(_0xd1dc('0x4'));var router=express[_0xd1dc('0x5')]();var fs_extra=require(_0xd1dc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd1dc('0x7'));var config=require(_0xd1dc('0x8'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd1dc('0x9')]);router['get'](_0xd1dc('0xa'),auth[_0xd1dc('0xb')](),controller[_0xd1dc('0xc')]);router[_0xd1dc('0xd')]('/:id/fields',auth[_0xd1dc('0xb')](),controller[_0xd1dc('0xe')]);router[_0xd1dc('0xd')](_0xd1dc('0xf'),auth[_0xd1dc('0xb')](),controller[_0xd1dc('0x10')]);router[_0xd1dc('0xd')](_0xd1dc('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xd1dc('0x12')]('/',auth['isAuthenticated'](),controller[_0xd1dc('0x13')]);router[_0xd1dc('0x14')](_0xd1dc('0xa'),auth[_0xd1dc('0xb')](),controller[_0xd1dc('0x15')]);router[_0xd1dc('0x16')](_0xd1dc('0xa'),auth['isAuthenticated'](),controller[_0xd1dc('0x17')]);module[_0xd1dc('0x18')]=router; \ No newline at end of file +var _0x96da=['put','update','delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x173092,_0xf3ab29){var _0xb506a4=function(_0xcc48ad){while(--_0xcc48ad){_0x173092['push'](_0x173092['shift']());}};_0xb506a4(++_0xf3ab29);}(_0x96da,0x1d2));var _0xa96d=function(_0x4ccdf4,_0x430467){_0x4ccdf4=_0x4ccdf4-0x0;var _0x477b4c=_0x96da[_0x4ccdf4];return _0x477b4c;};'use strict';var multer=require(_0xa96d('0x0'));var util=require(_0xa96d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa96d('0x2'));var router=express['Router']();var fs_extra=require(_0xa96d('0x3'));var auth=require(_0xa96d('0x4'));var interaction=require(_0xa96d('0x5'));var config=require('../../config/environment');var controller=require(_0xa96d('0x6'));router[_0xa96d('0x7')]('/',auth[_0xa96d('0x8')](),controller[_0xa96d('0x9')]);router[_0xa96d('0x7')](_0xa96d('0xa'),auth[_0xa96d('0x8')](),controller[_0xa96d('0xb')]);router[_0xa96d('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa96d('0xc')]);router['get'](_0xa96d('0xd'),auth[_0xa96d('0x8')](),controller['getSubjects']);router['get'](_0xa96d('0xe'),auth[_0xa96d('0x8')](),controller[_0xa96d('0xf')]);router[_0xa96d('0x10')]('/',auth['isAuthenticated'](),controller[_0xa96d('0x11')]);router[_0xa96d('0x12')](_0xa96d('0xa'),auth[_0xa96d('0x8')](),controller[_0xa96d('0x13')]);router[_0xa96d('0x14')](_0xa96d('0xa'),auth[_0xa96d('0x8')](),controller['destroy']);module[_0xa96d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 3e680df..4c1a49c 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 _0x4da8=['contact','BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4da8,0x1b2));var _0x84da=function(_0x263ee9,_0xc5629){_0x263ee9=_0x263ee9-0x0;var _0x3d4faa=_0x4da8[_0x263ee9];return _0x3d4faa;};'use strict';var Sequelize=require(_0x84da('0x0'));module[_0x84da('0x1')]={'name':{'type':Sequelize[_0x84da('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x84da('0x3'),_0x84da('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x84da('0x5')](_0x84da('0x6'),'nothing'),'defaultValue':_0x84da('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x84da('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x84da('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8d21=['exports','STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN'];(function(_0x4b331e,_0x2681a9){var _0x448fad=function(_0x4a3796){while(--_0x4a3796){_0x4b331e['push'](_0x4b331e['shift']());}};_0x448fad(++_0x2681a9);}(_0x8d21,0x1e8));var _0x18d2=function(_0x225cb1,_0x2465da){_0x225cb1=_0x225cb1-0x0;var _0x341333=_0x8d21[_0x225cb1];return _0x341333;};'use strict';var Sequelize=require('sequelize');module[_0x18d2('0x0')]={'name':{'type':Sequelize[_0x18d2('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x18d2('0x2')](_0x18d2('0x3'),_0x18d2('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x18d2('0x2')](_0x18d2('0x5'),_0x18d2('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x18d2('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 b6ad190..bf2b30f 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 _0x9865=['create','body','update','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','then','destroy','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Dynamics365Configuration','findAll','rows','catch','show','params','find'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x9865,0xec));var _0x5986=function(_0x2f0fa5,_0x154beb){_0x2f0fa5=_0x2f0fa5-0x0;var _0x4ca937=_0x9865[_0x2f0fa5];return _0x4ca937;};'use strict';var emlformat=require(_0x5986('0x0'));var rimraf=require(_0x5986('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5986('0x2'));var rp=require('request-promise');var moment=require(_0x5986('0x3'));var BPromise=require(_0x5986('0x4'));var Mustache=require(_0x5986('0x5'));var util=require(_0x5986('0x6'));var path=require(_0x5986('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5986('0x8'));var _=require(_0x5986('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5986('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5986('0xb'));var Papa=require(_0x5986('0xc'));var Redis=require(_0x5986('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5986('0xe'));var as=require(_0x5986('0xf'));var hardwareService=require(_0x5986('0x10'));var logger=require(_0x5986('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5986('0x12'));var licenseUtil=require(_0x5986('0x13'));var db=require(_0x5986('0x14'))['db'];function respondWithStatusCode(_0x1bdf6d,_0x3d0b6a){_0x3d0b6a=_0x3d0b6a||0xcc;return function(_0x1f78ee){if(_0x1f78ee){return _0x1bdf6d[_0x5986('0x15')](_0x3d0b6a);}return _0x1bdf6d[_0x5986('0x16')](_0x3d0b6a)[_0x5986('0x17')]();};}function respondWithResult(_0x2c1a94,_0x2c4b0f){_0x2c4b0f=_0x2c4b0f||0xc8;return function(_0x1ee660){if(_0x1ee660){return _0x2c1a94[_0x5986('0x16')](_0x2c4b0f)['json'](_0x1ee660);}};}function respondWithFilteredResult(_0x39296e,_0x13bda9){return function(_0x219520){if(_0x219520){var _0x15179b=typeof _0x13bda9['offset']===_0x5986('0x18')&&typeof _0x13bda9[_0x5986('0x19')]===_0x5986('0x18');var _0x329212=_0x219520[_0x5986('0x1a')];var _0x5c0278=_0x15179b?0x0:_0x13bda9[_0x5986('0x1b')];var _0x626184=_0x15179b?_0x219520[_0x5986('0x1a')]:_0x13bda9[_0x5986('0x1b')]+_0x13bda9[_0x5986('0x19')];var _0x439d1c;if(_0x626184>=_0x329212){_0x626184=_0x329212;_0x439d1c=0xc8;}else{_0x439d1c=0xce;}_0x39296e[_0x5986('0x16')](_0x439d1c);return _0x39296e['set'](_0x5986('0x1c'),_0x5c0278+'-'+_0x626184+'/'+_0x329212)[_0x5986('0x1d')](_0x219520);}return null;};}function patchUpdates(_0x12d31a){return function(_0x4721c6){try{jsonpatch[_0x5986('0x1e')](_0x4721c6,_0x12d31a,!![]);}catch(_0x300f65){return BPromise[_0x5986('0x1f')](_0x300f65);}return _0x4721c6['save']();};}function saveUpdates(_0x1b609c,_0x2d4c7e){return function(_0x5555c0){if(_0x5555c0){return _0x5555c0['update'](_0x1b609c)[_0x5986('0x20')](function(_0x466898){return _0x466898;});}return null;};}function removeEntity(_0x16447d,_0x581766){return function(_0xd56b46){if(_0xd56b46){return _0xd56b46[_0x5986('0x21')]()[_0x5986('0x20')](function(){_0x16447d[_0x5986('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8016,_0x1382e8){return function(_0x462657){if(!_0x462657){_0x1d8016['sendStatus'](0x194);}return _0x462657;};}function handleError(_0x2cae14,_0xd21cf9){_0xd21cf9=_0xd21cf9||0x1f4;return function(_0x1cd239){logger['error'](_0x1cd239['stack']);if(_0x1cd239[_0x5986('0x22')]){delete _0x1cd239[_0x5986('0x22')];}_0x2cae14[_0x5986('0x16')](_0xd21cf9)[_0x5986('0x23')](_0x1cd239);};}exports[_0x5986('0x24')]=function(_0xfd91a9,_0x4c9647){var _0x3dd17e={},_0x2449b6={},_0xc3aad4={'count':0x0,'rows':[]};var _0x1e40be=_[_0x5986('0x25')](db['Dynamics365Configuration'][_0x5986('0x26')],function(_0x1ae1aa){return{'name':_0x1ae1aa['fieldName'],'type':_0x1ae1aa[_0x5986('0x27')][_0x5986('0x28')]};});_0x2449b6[_0x5986('0x29')]=_['map'](_0x1e40be,_0x5986('0x22'));_0x2449b6[_0x5986('0x2a')]=_[_0x5986('0x2b')](_0xfd91a9['query']);_0x2449b6[_0x5986('0x2c')]=_[_0x5986('0x2d')](_0x2449b6[_0x5986('0x29')],_0x2449b6['query']);_0x3dd17e[_0x5986('0x2e')]=_[_0x5986('0x2d')](_0x2449b6['model'],qs[_0x5986('0x2f')](_0xfd91a9['query'][_0x5986('0x2f')]));_0x3dd17e['attributes']=_0x3dd17e[_0x5986('0x2e')][_0x5986('0x30')]?_0x3dd17e[_0x5986('0x2e')]:_0x2449b6['model'];if(!_0xfd91a9['query'][_0x5986('0x31')](_0x5986('0x32'))){_0x3dd17e[_0x5986('0x19')]=qs[_0x5986('0x19')](_0xfd91a9['query'][_0x5986('0x19')]);_0x3dd17e[_0x5986('0x1b')]=qs[_0x5986('0x1b')](_0xfd91a9[_0x5986('0x2a')][_0x5986('0x1b')]);}_0x3dd17e[_0x5986('0x33')]=qs[_0x5986('0x34')](_0xfd91a9[_0x5986('0x2a')][_0x5986('0x34')]);_0x3dd17e[_0x5986('0x35')]=qs['filters'](_[_0x5986('0x36')](_0xfd91a9[_0x5986('0x2a')],_0x2449b6['filters']),_0x1e40be);if(_0xfd91a9[_0x5986('0x2a')][_0x5986('0x37')]){_0x3dd17e[_0x5986('0x35')]=_[_0x5986('0x38')](_0x3dd17e['where'],{'$or':_[_0x5986('0x25')](_0x1e40be,function(_0x5022e2){if(_0x5022e2[_0x5986('0x27')]!==_0x5986('0x39')){var _0x20d640={};_0x20d640[_0x5022e2['name']]={'$like':'%'+_0xfd91a9[_0x5986('0x2a')][_0x5986('0x37')]+'%'};return _0x20d640;}})});}_0x3dd17e=_[_0x5986('0x38')]({},_0x3dd17e,_0xfd91a9[_0x5986('0x3a')]);var _0x30a728={'where':_0x3dd17e[_0x5986('0x35')]};return db['Dynamics365Configuration'][_0x5986('0x1a')](_0x30a728)[_0x5986('0x20')](function(_0x5ddfd1){_0xc3aad4[_0x5986('0x1a')]=_0x5ddfd1;if(_0xfd91a9[_0x5986('0x2a')][_0x5986('0x3b')]){_0x3dd17e[_0x5986('0x3c')]=[{'all':!![]}];}return db[_0x5986('0x3d')][_0x5986('0x3e')](_0x3dd17e);})[_0x5986('0x20')](function(_0x249ba0){_0xc3aad4[_0x5986('0x3f')]=_0x249ba0;return _0xc3aad4;})[_0x5986('0x20')](respondWithFilteredResult(_0x4c9647,_0x3dd17e))[_0x5986('0x40')](handleError(_0x4c9647,null));};exports[_0x5986('0x41')]=function(_0x235b55,_0x3b1454){var _0x1e8a2b={'raw':![],'where':{'id':_0x235b55[_0x5986('0x42')]['id']}},_0x10239e={};_0x10239e['model']=_['keys'](db[_0x5986('0x3d')][_0x5986('0x26')]);_0x10239e[_0x5986('0x2a')]=_['keys'](_0x235b55[_0x5986('0x2a')]);_0x10239e[_0x5986('0x2c')]=_[_0x5986('0x2d')](_0x10239e['model'],_0x10239e[_0x5986('0x2a')]);_0x1e8a2b['attributes']=_[_0x5986('0x2d')](_0x10239e[_0x5986('0x29')],qs['fields'](_0x235b55[_0x5986('0x2a')][_0x5986('0x2f')]));_0x1e8a2b[_0x5986('0x2e')]=_0x1e8a2b[_0x5986('0x2e')][_0x5986('0x30')]?_0x1e8a2b[_0x5986('0x2e')]:_0x10239e[_0x5986('0x29')];if(_0x235b55['query'][_0x5986('0x3b')]){_0x1e8a2b[_0x5986('0x3c')]=[{'all':!![]}];}_0x1e8a2b=_[_0x5986('0x38')]({},_0x1e8a2b,_0x235b55[_0x5986('0x3a')]);return db[_0x5986('0x3d')][_0x5986('0x43')](_0x1e8a2b)[_0x5986('0x20')](handleEntityNotFound(_0x3b1454,null))[_0x5986('0x20')](respondWithResult(_0x3b1454,null))['catch'](handleError(_0x3b1454,null));};exports[_0x5986('0x44')]=function(_0x46ca57,_0x520f30){return db['Dynamics365Configuration'][_0x5986('0x44')](_0x46ca57[_0x5986('0x45')],{})[_0x5986('0x20')](respondWithResult(_0x520f30,0xc9))[_0x5986('0x40')](handleError(_0x520f30,null));};exports[_0x5986('0x46')]=function(_0x27cfd4,_0x81846){if(_0x27cfd4[_0x5986('0x45')]['id']){delete _0x27cfd4[_0x5986('0x45')]['id'];}return db[_0x5986('0x3d')][_0x5986('0x43')]({'where':{'id':_0x27cfd4[_0x5986('0x42')]['id']}})[_0x5986('0x20')](handleEntityNotFound(_0x81846,null))['then'](saveUpdates(_0x27cfd4[_0x5986('0x45')],null))['then'](respondWithResult(_0x81846,null))[_0x5986('0x40')](handleError(_0x81846,null));};exports[_0x5986('0x21')]=function(_0x262060,_0x35f16a){return db[_0x5986('0x3d')][_0x5986('0x43')]({'where':{'id':_0x262060[_0x5986('0x42')]['id']}})[_0x5986('0x20')](handleEntityNotFound(_0x35f16a,null))[_0x5986('0x20')](removeEntity(_0x35f16a,null))[_0x5986('0x40')](handleError(_0x35f16a,null));};exports[_0x5986('0x47')]=function(_0x5300f1,_0xb2a99,_0xf38e53){var _0x20ecd7={};var _0x54a57b={};var _0x318bbe;var _0x103122;return db[_0x5986('0x3d')]['findOne']({'where':{'id':_0x5300f1['params']['id']}})[_0x5986('0x20')](handleEntityNotFound(_0xb2a99,null))[_0x5986('0x20')](function(_0x2bd560){if(_0x2bd560){_0x318bbe=_0x2bd560;_0x54a57b['model']=_[_0x5986('0x2b')](db[_0x5986('0x48')][_0x5986('0x26')]);_0x54a57b[_0x5986('0x2a')]=_[_0x5986('0x2b')](_0x5300f1[_0x5986('0x2a')]);_0x54a57b[_0x5986('0x2c')]=_[_0x5986('0x2d')](_0x54a57b[_0x5986('0x29')],_0x54a57b[_0x5986('0x2a')]);_0x20ecd7['attributes']=_['intersection'](_0x54a57b[_0x5986('0x29')],qs[_0x5986('0x2f')](_0x5300f1[_0x5986('0x2a')]['fields']));_0x20ecd7['attributes']=_0x20ecd7[_0x5986('0x2e')][_0x5986('0x30')]?_0x20ecd7[_0x5986('0x2e')]:_0x54a57b[_0x5986('0x29')];_0x20ecd7[_0x5986('0x33')]=qs[_0x5986('0x34')](_0x5300f1['query'][_0x5986('0x34')]);_0x20ecd7[_0x5986('0x35')]=qs[_0x5986('0x2c')](_[_0x5986('0x36')](_0x5300f1[_0x5986('0x2a')],_0x54a57b[_0x5986('0x2c')]));if(_0x5300f1[_0x5986('0x2a')][_0x5986('0x37')]){_0x20ecd7[_0x5986('0x35')]=_[_0x5986('0x38')](_0x20ecd7[_0x5986('0x35')],{'$or':_[_0x5986('0x25')](_0x20ecd7[_0x5986('0x2e')],function(_0x506277){var _0x244faa={};_0x244faa[_0x506277]={'$like':'%'+_0x5300f1['query'][_0x5986('0x37')]+'%'};return _0x244faa;})});}_0x20ecd7=_['merge']({},_0x20ecd7,_0x5300f1[_0x5986('0x3a')]);return _0x318bbe[_0x5986('0x47')](_0x20ecd7);}})[_0x5986('0x20')](function(_0x34422e){if(_0x34422e){_0x103122=_0x34422e[_0x5986('0x30')];if(!_0x5300f1[_0x5986('0x2a')][_0x5986('0x31')]('nolimit')){_0x20ecd7[_0x5986('0x19')]=qs['limit'](_0x5300f1[_0x5986('0x2a')][_0x5986('0x19')]);_0x20ecd7['offset']=qs[_0x5986('0x1b')](_0x5300f1[_0x5986('0x2a')][_0x5986('0x1b')]);}return _0x318bbe[_0x5986('0x47')](_0x20ecd7);}})['then'](function(_0xec5660){if(_0xec5660){return _0xec5660?{'count':_0x103122,'rows':_0xec5660}:null;}})[_0x5986('0x20')](respondWithResult(_0xb2a99,null))[_0x5986('0x40')](handleError(_0xb2a99,null));};exports[_0x5986('0x49')]=function(_0x5c4448,_0x3cb50b,_0x1525d0){var _0x2fc314={};var _0x12a87a={};var _0x5f2924;var _0xc4d11a;return db[_0x5986('0x3d')][_0x5986('0x4a')]({'where':{'id':_0x5c4448[_0x5986('0x42')]['id']}})[_0x5986('0x20')](handleEntityNotFound(_0x3cb50b,null))[_0x5986('0x20')](function(_0x1bef4c){if(_0x1bef4c){_0x5f2924=_0x1bef4c;_0x12a87a[_0x5986('0x29')]=_[_0x5986('0x2b')](db['Dynamics365Field'][_0x5986('0x26')]);_0x12a87a[_0x5986('0x2a')]=_['keys'](_0x5c4448[_0x5986('0x2a')]);_0x12a87a['filters']=_['intersection'](_0x12a87a[_0x5986('0x29')],_0x12a87a['query']);_0x2fc314[_0x5986('0x2e')]=_['intersection'](_0x12a87a['model'],qs[_0x5986('0x2f')](_0x5c4448[_0x5986('0x2a')][_0x5986('0x2f')]));_0x2fc314[_0x5986('0x2e')]=_0x2fc314[_0x5986('0x2e')][_0x5986('0x30')]?_0x2fc314[_0x5986('0x2e')]:_0x12a87a[_0x5986('0x29')];_0x2fc314[_0x5986('0x33')]=qs['sort'](_0x5c4448[_0x5986('0x2a')]['sort']);_0x2fc314[_0x5986('0x35')]=qs[_0x5986('0x2c')](_[_0x5986('0x36')](_0x5c4448[_0x5986('0x2a')],_0x12a87a[_0x5986('0x2c')]));if(_0x5c4448[_0x5986('0x2a')][_0x5986('0x37')]){_0x2fc314[_0x5986('0x35')]=_[_0x5986('0x38')](_0x2fc314['where'],{'$or':_[_0x5986('0x25')](_0x2fc314[_0x5986('0x2e')],function(_0x31061c){var _0x253539={};_0x253539[_0x31061c]={'$like':'%'+_0x5c4448['query'][_0x5986('0x37')]+'%'};return _0x253539;})});}_0x2fc314=_[_0x5986('0x38')]({},_0x2fc314,_0x5c4448[_0x5986('0x3a')]);return _0x5f2924['getSubjects'](_0x2fc314);}})[_0x5986('0x20')](function(_0x415a6b){if(_0x415a6b){_0xc4d11a=_0x415a6b[_0x5986('0x30')];if(!_0x5c4448[_0x5986('0x2a')][_0x5986('0x31')](_0x5986('0x32'))){_0x2fc314[_0x5986('0x19')]=qs[_0x5986('0x19')](_0x5c4448['query'][_0x5986('0x19')]);_0x2fc314[_0x5986('0x1b')]=qs[_0x5986('0x1b')](_0x5c4448[_0x5986('0x2a')]['offset']);}return _0x5f2924[_0x5986('0x49')](_0x2fc314);}})[_0x5986('0x20')](function(_0x121c2c){if(_0x121c2c){return _0x121c2c?{'count':_0xc4d11a,'rows':_0x121c2c}:null;}})['then'](respondWithResult(_0x3cb50b,null))[_0x5986('0x40')](handleError(_0x3cb50b,null));};exports[_0x5986('0x4b')]=function(_0x37012d,_0x331f58,_0x4a522e){var _0x171088={};var _0x417bf9={};var _0x2a1d57;var _0x53068f;return db[_0x5986('0x3d')][_0x5986('0x4a')]({'where':{'id':_0x37012d['params']['id']}})['then'](handleEntityNotFound(_0x331f58,null))[_0x5986('0x20')](function(_0x249a41){if(_0x249a41){_0x2a1d57=_0x249a41;_0x417bf9['model']=_[_0x5986('0x2b')](db[_0x5986('0x48')]['rawAttributes']);_0x417bf9[_0x5986('0x2a')]=_['keys'](_0x37012d[_0x5986('0x2a')]);_0x417bf9[_0x5986('0x2c')]=_['intersection'](_0x417bf9[_0x5986('0x29')],_0x417bf9[_0x5986('0x2a')]);_0x171088[_0x5986('0x2e')]=_[_0x5986('0x2d')](_0x417bf9[_0x5986('0x29')],qs['fields'](_0x37012d[_0x5986('0x2a')]['fields']));_0x171088['attributes']=_0x171088[_0x5986('0x2e')][_0x5986('0x30')]?_0x171088[_0x5986('0x2e')]:_0x417bf9[_0x5986('0x29')];_0x171088['order']=qs[_0x5986('0x34')](_0x37012d[_0x5986('0x2a')][_0x5986('0x34')]);_0x171088[_0x5986('0x35')]=qs[_0x5986('0x2c')](_[_0x5986('0x36')](_0x37012d['query'],_0x417bf9[_0x5986('0x2c')]));if(_0x37012d[_0x5986('0x2a')][_0x5986('0x37')]){_0x171088[_0x5986('0x35')]=_[_0x5986('0x38')](_0x171088[_0x5986('0x35')],{'$or':_[_0x5986('0x25')](_0x171088[_0x5986('0x2e')],function(_0x179f2e){var _0x182c96={};_0x182c96[_0x179f2e]={'$like':'%'+_0x37012d[_0x5986('0x2a')][_0x5986('0x37')]+'%'};return _0x182c96;})});}_0x171088=_[_0x5986('0x38')]({},_0x171088,_0x37012d[_0x5986('0x3a')]);return _0x2a1d57[_0x5986('0x4b')](_0x171088);}})[_0x5986('0x20')](function(_0x1c6fb8){if(_0x1c6fb8){_0x53068f=_0x1c6fb8[_0x5986('0x30')];if(!_0x37012d[_0x5986('0x2a')]['hasOwnProperty'](_0x5986('0x32'))){_0x171088[_0x5986('0x19')]=qs[_0x5986('0x19')](_0x37012d['query']['limit']);_0x171088['offset']=qs[_0x5986('0x1b')](_0x37012d[_0x5986('0x2a')][_0x5986('0x1b')]);}return _0x2a1d57[_0x5986('0x4b')](_0x171088);}})[_0x5986('0x20')](function(_0x142907){if(_0x142907){return _0x142907?{'count':_0x53068f,'rows':_0x142907}:null;}})[_0x5986('0x20')](respondWithResult(_0x331f58,null))[_0x5986('0x40')](handleError(_0x331f58,null));}; \ No newline at end of file +var _0x6ebf=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','Dynamics365Configuration','include','findAll','show','includeAll','find','create','body','catch','params','pick','filter','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','options','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path'];(function(_0x42f402,_0x2155ac){var _0x3bf339=function(_0x23ef15){while(--_0x23ef15){_0x42f402['push'](_0x42f402['shift']());}};_0x3bf339(++_0x2155ac);}(_0x6ebf,0x1e5));var _0xf6eb=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x6ebf[_0x33032e];return _0x13316b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6eb('0x0'));var zipdir=require(_0xf6eb('0x1'));var jsonpatch=require(_0xf6eb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6eb('0x3'));var Mustache=require(_0xf6eb('0x4'));var util=require(_0xf6eb('0x5'));var path=require(_0xf6eb('0x6'));var sox=require('sox');var csv=require(_0xf6eb('0x7'));var ejs=require(_0xf6eb('0x8'));var fs=require('fs');var fs_extra=require(_0xf6eb('0x9'));var _=require(_0xf6eb('0xa'));var squel=require(_0xf6eb('0xb'));var crypto=require(_0xf6eb('0xc'));var jsforce=require(_0xf6eb('0xd'));var deskjs=require(_0xf6eb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf6eb('0xf'));var Papa=require(_0xf6eb('0x10'));var Redis=require(_0xf6eb('0x11'));var authService=require(_0xf6eb('0x12'));var qs=require(_0xf6eb('0x13'));var as=require(_0xf6eb('0x14'));var hardwareService=require(_0xf6eb('0x15'));var logger=require(_0xf6eb('0x16'))(_0xf6eb('0x17'));var utils=require('../../config/utils');var config=require(_0xf6eb('0x18'));var licenseUtil=require(_0xf6eb('0x19'));var db=require(_0xf6eb('0x1a'))['db'];function respondWithStatusCode(_0x3f4664,_0x2712a2){_0x2712a2=_0x2712a2||0xcc;return function(_0xcfb845){if(_0xcfb845){return _0x3f4664[_0xf6eb('0x1b')](_0x2712a2);}return _0x3f4664['status'](_0x2712a2)[_0xf6eb('0x1c')]();};}function respondWithResult(_0x362e12,_0x12b159){_0x12b159=_0x12b159||0xc8;return function(_0x2552a8){if(_0x2552a8){return _0x362e12[_0xf6eb('0x1d')](_0x12b159)[_0xf6eb('0x1e')](_0x2552a8);}};}function respondWithFilteredResult(_0x66172d,_0x232cd4){return function(_0x2d6cfb){if(_0x2d6cfb){var _0x3c2395=typeof _0x232cd4[_0xf6eb('0x1f')]===_0xf6eb('0x20')&&typeof _0x232cd4[_0xf6eb('0x21')]===_0xf6eb('0x20');var _0x1af65b=_0x2d6cfb[_0xf6eb('0x22')];var _0x551006=_0x3c2395?0x0:_0x232cd4[_0xf6eb('0x1f')];var _0xb8dd2e=_0x3c2395?_0x2d6cfb['count']:_0x232cd4[_0xf6eb('0x1f')]+_0x232cd4[_0xf6eb('0x21')];var _0x49d747;if(_0xb8dd2e>=_0x1af65b){_0xb8dd2e=_0x1af65b;_0x49d747=0xc8;}else{_0x49d747=0xce;}_0x66172d[_0xf6eb('0x1d')](_0x49d747);return _0x66172d[_0xf6eb('0x23')](_0xf6eb('0x24'),_0x551006+'-'+_0xb8dd2e+'/'+_0x1af65b)[_0xf6eb('0x1e')](_0x2d6cfb);}return null;};}function patchUpdates(_0x240ae0){return function(_0x425eae){try{jsonpatch[_0xf6eb('0x25')](_0x425eae,_0x240ae0,!![]);}catch(_0x5b7932){return BPromise[_0xf6eb('0x26')](_0x5b7932);}return _0x425eae['save']();};}function saveUpdates(_0x388ace,_0x93618f){return function(_0x3ae84f){if(_0x3ae84f){return _0x3ae84f[_0xf6eb('0x27')](_0x388ace)[_0xf6eb('0x28')](function(_0x1da8f3){return _0x1da8f3;});}return null;};}function removeEntity(_0x3c310e,_0x481189){return function(_0x6282ca){if(_0x6282ca){return _0x6282ca[_0xf6eb('0x29')]()[_0xf6eb('0x28')](function(){_0x3c310e[_0xf6eb('0x1d')](0xcc)[_0xf6eb('0x1c')]();});}};}function handleEntityNotFound(_0x438d13,_0x4bdbf7){return function(_0x287aa5){if(!_0x287aa5){_0x438d13['sendStatus'](0x194);}return _0x287aa5;};}function handleError(_0x1b4cbd,_0x2df870){_0x2df870=_0x2df870||0x1f4;return function(_0x1c0f3a){logger['error'](_0x1c0f3a[_0xf6eb('0x2a')]);if(_0x1c0f3a['name']){delete _0x1c0f3a[_0xf6eb('0x2b')];}_0x1b4cbd[_0xf6eb('0x1d')](_0x2df870)[_0xf6eb('0x2c')](_0x1c0f3a);};}exports[_0xf6eb('0x2d')]=function(_0x1d87d6,_0x27b0b3){var _0x2ba310={},_0x3ec2bf={},_0x1dc0d2={'count':0x0,'rows':[]};var _0xd3fc28=_['map'](db['Dynamics365Configuration'][_0xf6eb('0x2e')],function(_0x3f1f55){return{'name':_0x3f1f55[_0xf6eb('0x2f')],'type':_0x3f1f55[_0xf6eb('0x30')]['key']};});_0x3ec2bf[_0xf6eb('0x31')]=_[_0xf6eb('0x32')](_0xd3fc28,_0xf6eb('0x2b'));_0x3ec2bf[_0xf6eb('0x33')]=_[_0xf6eb('0x34')](_0x1d87d6[_0xf6eb('0x33')]);_0x3ec2bf['filters']=_[_0xf6eb('0x35')](_0x3ec2bf[_0xf6eb('0x31')],_0x3ec2bf[_0xf6eb('0x33')]);_0x2ba310[_0xf6eb('0x36')]=_['intersection'](_0x3ec2bf[_0xf6eb('0x31')],qs[_0xf6eb('0x37')](_0x1d87d6[_0xf6eb('0x33')][_0xf6eb('0x37')]));_0x2ba310[_0xf6eb('0x36')]=_0x2ba310[_0xf6eb('0x36')][_0xf6eb('0x38')]?_0x2ba310[_0xf6eb('0x36')]:_0x3ec2bf[_0xf6eb('0x31')];if(!_0x1d87d6[_0xf6eb('0x33')]['hasOwnProperty'](_0xf6eb('0x39'))){_0x2ba310[_0xf6eb('0x21')]=qs['limit'](_0x1d87d6[_0xf6eb('0x33')][_0xf6eb('0x21')]);_0x2ba310[_0xf6eb('0x1f')]=qs[_0xf6eb('0x1f')](_0x1d87d6[_0xf6eb('0x33')][_0xf6eb('0x1f')]);}_0x2ba310[_0xf6eb('0x3a')]=qs[_0xf6eb('0x3b')](_0x1d87d6[_0xf6eb('0x33')][_0xf6eb('0x3b')]);_0x2ba310[_0xf6eb('0x3c')]=qs[_0xf6eb('0x3d')](_['pick'](_0x1d87d6[_0xf6eb('0x33')],_0x3ec2bf[_0xf6eb('0x3d')]),_0xd3fc28);if(_0x1d87d6[_0xf6eb('0x33')]['filter']){_0x2ba310[_0xf6eb('0x3c')]=_['merge'](_0x2ba310[_0xf6eb('0x3c')],{'$or':_[_0xf6eb('0x32')](_0xd3fc28,function(_0x59f996){if(_0x59f996[_0xf6eb('0x30')]!=='VIRTUAL'){var _0x33c5c2={};_0x33c5c2[_0x59f996['name']]={'$like':'%'+_0x1d87d6[_0xf6eb('0x33')]['filter']+'%'};return _0x33c5c2;}})});}_0x2ba310=_[_0xf6eb('0x3e')]({},_0x2ba310,_0x1d87d6['options']);var _0x14b9a5={'where':_0x2ba310['where']};return db[_0xf6eb('0x3f')][_0xf6eb('0x22')](_0x14b9a5)[_0xf6eb('0x28')](function(_0x1a222f){_0x1dc0d2[_0xf6eb('0x22')]=_0x1a222f;if(_0x1d87d6[_0xf6eb('0x33')]['includeAll']){_0x2ba310[_0xf6eb('0x40')]=[{'all':!![]}];}return db[_0xf6eb('0x3f')][_0xf6eb('0x41')](_0x2ba310);})['then'](function(_0x3ae2f5){_0x1dc0d2['rows']=_0x3ae2f5;return _0x1dc0d2;})[_0xf6eb('0x28')](respondWithFilteredResult(_0x27b0b3,_0x2ba310))['catch'](handleError(_0x27b0b3,null));};exports[_0xf6eb('0x42')]=function(_0x3f427a,_0x11863e){var _0x28c684={'raw':![],'where':{'id':_0x3f427a['params']['id']}},_0x2d7fb0={};_0x2d7fb0[_0xf6eb('0x31')]=_[_0xf6eb('0x34')](db[_0xf6eb('0x3f')][_0xf6eb('0x2e')]);_0x2d7fb0[_0xf6eb('0x33')]=_['keys'](_0x3f427a[_0xf6eb('0x33')]);_0x2d7fb0['filters']=_[_0xf6eb('0x35')](_0x2d7fb0['model'],_0x2d7fb0[_0xf6eb('0x33')]);_0x28c684['attributes']=_[_0xf6eb('0x35')](_0x2d7fb0[_0xf6eb('0x31')],qs[_0xf6eb('0x37')](_0x3f427a[_0xf6eb('0x33')][_0xf6eb('0x37')]));_0x28c684['attributes']=_0x28c684[_0xf6eb('0x36')][_0xf6eb('0x38')]?_0x28c684[_0xf6eb('0x36')]:_0x2d7fb0['model'];if(_0x3f427a[_0xf6eb('0x33')][_0xf6eb('0x43')]){_0x28c684[_0xf6eb('0x40')]=[{'all':!![]}];}_0x28c684=_[_0xf6eb('0x3e')]({},_0x28c684,_0x3f427a['options']);return db['Dynamics365Configuration'][_0xf6eb('0x44')](_0x28c684)[_0xf6eb('0x28')](handleEntityNotFound(_0x11863e,null))['then'](respondWithResult(_0x11863e,null))['catch'](handleError(_0x11863e,null));};exports['create']=function(_0x30e26f,_0xd556e8){return db[_0xf6eb('0x3f')][_0xf6eb('0x45')](_0x30e26f[_0xf6eb('0x46')],{})[_0xf6eb('0x28')](respondWithResult(_0xd556e8,0xc9))['catch'](handleError(_0xd556e8,null));};exports['update']=function(_0x4c1977,_0x14a3af){if(_0x4c1977['body']['id']){delete _0x4c1977[_0xf6eb('0x46')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x4c1977['params']['id']}})[_0xf6eb('0x28')](handleEntityNotFound(_0x14a3af,null))['then'](saveUpdates(_0x4c1977[_0xf6eb('0x46')],null))[_0xf6eb('0x28')](respondWithResult(_0x14a3af,null))[_0xf6eb('0x47')](handleError(_0x14a3af,null));};exports['destroy']=function(_0x188d81,_0x4b0374){return db[_0xf6eb('0x3f')][_0xf6eb('0x44')]({'where':{'id':_0x188d81[_0xf6eb('0x48')]['id']}})[_0xf6eb('0x28')](handleEntityNotFound(_0x4b0374,null))['then'](removeEntity(_0x4b0374,null))[_0xf6eb('0x47')](handleError(_0x4b0374,null));};exports['getFields']=function(_0x3d2ab7,_0x23b8c0,_0x1f9b9a){var _0x2aed92={};var _0x52f841={};var _0x177290;var _0x10eef8;return db[_0xf6eb('0x3f')]['findOne']({'where':{'id':_0x3d2ab7[_0xf6eb('0x48')]['id']}})[_0xf6eb('0x28')](handleEntityNotFound(_0x23b8c0,null))[_0xf6eb('0x28')](function(_0x1135d5){if(_0x1135d5){_0x177290=_0x1135d5;_0x52f841[_0xf6eb('0x31')]=_[_0xf6eb('0x34')](db['Dynamics365Field']['rawAttributes']);_0x52f841[_0xf6eb('0x33')]=_[_0xf6eb('0x34')](_0x3d2ab7[_0xf6eb('0x33')]);_0x52f841['filters']=_[_0xf6eb('0x35')](_0x52f841[_0xf6eb('0x31')],_0x52f841[_0xf6eb('0x33')]);_0x2aed92[_0xf6eb('0x36')]=_['intersection'](_0x52f841[_0xf6eb('0x31')],qs[_0xf6eb('0x37')](_0x3d2ab7['query'][_0xf6eb('0x37')]));_0x2aed92[_0xf6eb('0x36')]=_0x2aed92[_0xf6eb('0x36')][_0xf6eb('0x38')]?_0x2aed92[_0xf6eb('0x36')]:_0x52f841[_0xf6eb('0x31')];_0x2aed92[_0xf6eb('0x3a')]=qs[_0xf6eb('0x3b')](_0x3d2ab7[_0xf6eb('0x33')][_0xf6eb('0x3b')]);_0x2aed92[_0xf6eb('0x3c')]=qs['filters'](_[_0xf6eb('0x49')](_0x3d2ab7[_0xf6eb('0x33')],_0x52f841['filters']));if(_0x3d2ab7[_0xf6eb('0x33')][_0xf6eb('0x4a')]){_0x2aed92[_0xf6eb('0x3c')]=_[_0xf6eb('0x3e')](_0x2aed92[_0xf6eb('0x3c')],{'$or':_[_0xf6eb('0x32')](_0x2aed92[_0xf6eb('0x36')],function(_0x5b54e1){var _0x45abad={};_0x45abad[_0x5b54e1]={'$like':'%'+_0x3d2ab7['query'][_0xf6eb('0x4a')]+'%'};return _0x45abad;})});}_0x2aed92=_[_0xf6eb('0x3e')]({},_0x2aed92,_0x3d2ab7['options']);return _0x177290[_0xf6eb('0x4b')](_0x2aed92);}})[_0xf6eb('0x28')](function(_0x40abac){if(_0x40abac){_0x10eef8=_0x40abac[_0xf6eb('0x38')];if(!_0x3d2ab7[_0xf6eb('0x33')]['hasOwnProperty']('nolimit')){_0x2aed92[_0xf6eb('0x21')]=qs['limit'](_0x3d2ab7[_0xf6eb('0x33')][_0xf6eb('0x21')]);_0x2aed92[_0xf6eb('0x1f')]=qs[_0xf6eb('0x1f')](_0x3d2ab7[_0xf6eb('0x33')][_0xf6eb('0x1f')]);}return _0x177290[_0xf6eb('0x4b')](_0x2aed92);}})['then'](function(_0x245db8){if(_0x245db8){return _0x245db8?{'count':_0x10eef8,'rows':_0x245db8}:null;}})[_0xf6eb('0x28')](respondWithResult(_0x23b8c0,null))[_0xf6eb('0x47')](handleError(_0x23b8c0,null));};exports['getSubjects']=function(_0x21742a,_0x30ff7a,_0x33f7f5){var _0x5c8ac2={};var _0x46de87={};var _0x5ab874;var _0x190447;return db['Dynamics365Configuration'][_0xf6eb('0x4c')]({'where':{'id':_0x21742a[_0xf6eb('0x48')]['id']}})[_0xf6eb('0x28')](handleEntityNotFound(_0x30ff7a,null))[_0xf6eb('0x28')](function(_0x495292){if(_0x495292){_0x5ab874=_0x495292;_0x46de87[_0xf6eb('0x31')]=_['keys'](db[_0xf6eb('0x4d')][_0xf6eb('0x2e')]);_0x46de87[_0xf6eb('0x33')]=_[_0xf6eb('0x34')](_0x21742a[_0xf6eb('0x33')]);_0x46de87[_0xf6eb('0x3d')]=_['intersection'](_0x46de87[_0xf6eb('0x31')],_0x46de87['query']);_0x5c8ac2[_0xf6eb('0x36')]=_[_0xf6eb('0x35')](_0x46de87['model'],qs[_0xf6eb('0x37')](_0x21742a['query'][_0xf6eb('0x37')]));_0x5c8ac2[_0xf6eb('0x36')]=_0x5c8ac2[_0xf6eb('0x36')][_0xf6eb('0x38')]?_0x5c8ac2[_0xf6eb('0x36')]:_0x46de87[_0xf6eb('0x31')];_0x5c8ac2['order']=qs['sort'](_0x21742a[_0xf6eb('0x33')][_0xf6eb('0x3b')]);_0x5c8ac2[_0xf6eb('0x3c')]=qs['filters'](_[_0xf6eb('0x49')](_0x21742a[_0xf6eb('0x33')],_0x46de87['filters']));if(_0x21742a['query'][_0xf6eb('0x4a')]){_0x5c8ac2[_0xf6eb('0x3c')]=_['merge'](_0x5c8ac2[_0xf6eb('0x3c')],{'$or':_[_0xf6eb('0x32')](_0x5c8ac2[_0xf6eb('0x36')],function(_0x5e4458){var _0x5ca98c={};_0x5ca98c[_0x5e4458]={'$like':'%'+_0x21742a[_0xf6eb('0x33')]['filter']+'%'};return _0x5ca98c;})});}_0x5c8ac2=_[_0xf6eb('0x3e')]({},_0x5c8ac2,_0x21742a['options']);return _0x5ab874['getSubjects'](_0x5c8ac2);}})[_0xf6eb('0x28')](function(_0x518b7b){if(_0x518b7b){_0x190447=_0x518b7b['length'];if(!_0x21742a[_0xf6eb('0x33')][_0xf6eb('0x4e')](_0xf6eb('0x39'))){_0x5c8ac2[_0xf6eb('0x21')]=qs[_0xf6eb('0x21')](_0x21742a['query'][_0xf6eb('0x21')]);_0x5c8ac2[_0xf6eb('0x1f')]=qs[_0xf6eb('0x1f')](_0x21742a[_0xf6eb('0x33')][_0xf6eb('0x1f')]);}return _0x5ab874[_0xf6eb('0x4f')](_0x5c8ac2);}})[_0xf6eb('0x28')](function(_0x43243d){if(_0x43243d){return _0x43243d?{'count':_0x190447,'rows':_0x43243d}:null;}})[_0xf6eb('0x28')](respondWithResult(_0x30ff7a,null))['catch'](handleError(_0x30ff7a,null));};exports[_0xf6eb('0x50')]=function(_0x42b06d,_0x59b8cf,_0x4c0ec2){var _0x252435={};var _0x38fc7f={};var _0xc53a36;var _0xd3b17f;return db[_0xf6eb('0x3f')][_0xf6eb('0x4c')]({'where':{'id':_0x42b06d[_0xf6eb('0x48')]['id']}})[_0xf6eb('0x28')](handleEntityNotFound(_0x59b8cf,null))[_0xf6eb('0x28')](function(_0x2931b3){if(_0x2931b3){_0xc53a36=_0x2931b3;_0x38fc7f[_0xf6eb('0x31')]=_[_0xf6eb('0x34')](db['Dynamics365Field'][_0xf6eb('0x2e')]);_0x38fc7f['query']=_['keys'](_0x42b06d[_0xf6eb('0x33')]);_0x38fc7f[_0xf6eb('0x3d')]=_[_0xf6eb('0x35')](_0x38fc7f[_0xf6eb('0x31')],_0x38fc7f[_0xf6eb('0x33')]);_0x252435[_0xf6eb('0x36')]=_[_0xf6eb('0x35')](_0x38fc7f[_0xf6eb('0x31')],qs[_0xf6eb('0x37')](_0x42b06d[_0xf6eb('0x33')]['fields']));_0x252435[_0xf6eb('0x36')]=_0x252435[_0xf6eb('0x36')][_0xf6eb('0x38')]?_0x252435[_0xf6eb('0x36')]:_0x38fc7f[_0xf6eb('0x31')];_0x252435[_0xf6eb('0x3a')]=qs[_0xf6eb('0x3b')](_0x42b06d[_0xf6eb('0x33')][_0xf6eb('0x3b')]);_0x252435[_0xf6eb('0x3c')]=qs[_0xf6eb('0x3d')](_[_0xf6eb('0x49')](_0x42b06d[_0xf6eb('0x33')],_0x38fc7f['filters']));if(_0x42b06d[_0xf6eb('0x33')][_0xf6eb('0x4a')]){_0x252435[_0xf6eb('0x3c')]=_['merge'](_0x252435[_0xf6eb('0x3c')],{'$or':_['map'](_0x252435['attributes'],function(_0x203197){var _0x2f43c7={};_0x2f43c7[_0x203197]={'$like':'%'+_0x42b06d[_0xf6eb('0x33')][_0xf6eb('0x4a')]+'%'};return _0x2f43c7;})});}_0x252435=_[_0xf6eb('0x3e')]({},_0x252435,_0x42b06d[_0xf6eb('0x51')]);return _0xc53a36[_0xf6eb('0x50')](_0x252435);}})[_0xf6eb('0x28')](function(_0x4487e0){if(_0x4487e0){_0xd3b17f=_0x4487e0[_0xf6eb('0x38')];if(!_0x42b06d['query'][_0xf6eb('0x4e')](_0xf6eb('0x39'))){_0x252435[_0xf6eb('0x21')]=qs[_0xf6eb('0x21')](_0x42b06d[_0xf6eb('0x33')][_0xf6eb('0x21')]);_0x252435['offset']=qs[_0xf6eb('0x1f')](_0x42b06d[_0xf6eb('0x33')][_0xf6eb('0x1f')]);}return _0xc53a36[_0xf6eb('0x50')](_0x252435);}})['then'](function(_0x113747){if(_0x113747){return _0x113747?{'count':_0xd3b17f,'rows':_0x113747}:null;}})['then'](respondWithResult(_0x59b8cf,null))[_0xf6eb('0x47')](handleError(_0x59b8cf,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 3a1b966..1c50284 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 _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x2d8808,_0x331af0){var _0xc506b8=function(_0x639c6){while(--_0x639c6){_0x2d8808['push'](_0x2d8808['shift']());}};_0xc506b8(++_0x331af0);}(_0x9f62,0x154));var _0x29f6=function(_0x1b64eb,_0x58b40e){_0x1b64eb=_0x1b64eb-0x0;var _0x468175=_0x9f62[_0x1b64eb];return _0x468175;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x55806d,_0xb67a74){var _0x1c581e=function(_0x3bcf2b){while(--_0x3bcf2b){_0x55806d['push'](_0x55806d['shift']());}};_0x1c581e(++_0xb67a74);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xb4e6[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','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 b95d075..9c501f7 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 _0xd57d=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird'];(function(_0x8c8577,_0x445e4b){var _0x23a126=function(_0x5df004){while(--_0x5df004){_0x8c8577['push'](_0x8c8577['shift']());}};_0x23a126(++_0x445e4b);}(_0xd57d,0x66));var _0xdd57=function(_0x2fd506,_0x3c8662){_0x2fd506=_0x2fd506-0x0;var _0x2a8b09=_0xd57d[_0x2fd506];return _0x2a8b09;};'use strict';var _=require(_0xdd57('0x0'));var util=require(_0xdd57('0x1'));var moment=require('moment');var BPromise=require(_0xdd57('0x2'));var rs=require(_0xdd57('0x3'));var fs=require('fs');var Redis=require(_0xdd57('0x4'));var db=require(_0xdd57('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd57('0x6'))(_0xdd57('0x7'));var config=require(_0xdd57('0x8'));var jayson=require(_0xdd57('0x9'));var client=jayson[_0xdd57('0xa')][_0xdd57('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x304924,_0x400c17,_0x430c1c){return new BPromise(function(_0x57ccc0,_0x592724){return client[_0xdd57('0xc')](_0x304924,_0x430c1c)[_0xdd57('0xd')](function(_0x5a305b){logger[_0xdd57('0xe')](_0xdd57('0xf'),_0x400c17,_0xdd57('0x10'));logger['debug'](_0xdd57('0x11'),_0x400c17,_0xdd57('0x10'),JSON['stringify'](_0x5a305b));if(_0x5a305b[_0xdd57('0x12')]){if(_0x5a305b['error']['code']===0x1f4){logger[_0xdd57('0x12')](_0xdd57('0xf'),_0x400c17,_0x5a305b[_0xdd57('0x12')][_0xdd57('0x13')]);return _0x592724(_0x5a305b[_0xdd57('0x12')][_0xdd57('0x13')]);}logger[_0xdd57('0x12')](_0xdd57('0xf'),_0x400c17,_0x5a305b[_0xdd57('0x12')][_0xdd57('0x13')]);return _0x57ccc0(_0x5a305b[_0xdd57('0x12')][_0xdd57('0x13')]);}else{logger['info'](_0xdd57('0xf'),_0x400c17,_0xdd57('0x10'));_0x57ccc0(_0x5a305b['result'][_0xdd57('0x13')]);}})[_0xdd57('0x14')](function(_0x2ca61c){logger['error'](_0xdd57('0xf'),_0x400c17,_0x2ca61c);_0x592724(_0x2ca61c);});});} \ No newline at end of file +var _0xf502=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0xb0d7b4,_0x2790d1){var _0x190ac6=function(_0x380a15){while(--_0x380a15){_0xb0d7b4['push'](_0xb0d7b4['shift']());}};_0x190ac6(++_0x2790d1);}(_0xf502,0x15a));var _0x2f50=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0xf502[_0x49e584];return _0x58b1be;};'use strict';var _=require(_0x2f50('0x0'));var util=require(_0x2f50('0x1'));var moment=require(_0x2f50('0x2'));var BPromise=require(_0x2f50('0x3'));var rs=require(_0x2f50('0x4'));var fs=require('fs');var Redis=require(_0x2f50('0x5'));var db=require(_0x2f50('0x6'))['db'];var utils=require(_0x2f50('0x7'));var logger=require(_0x2f50('0x8'))('rpc');var config=require(_0x2f50('0x9'));var jayson=require(_0x2f50('0xa'));var client=jayson[_0x2f50('0xb')][_0x2f50('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f64bc,_0x4c0d1b,_0x140350){return new BPromise(function(_0x13e8c8,_0x31e2b4){return client[_0x2f50('0xd')](_0x4f64bc,_0x140350)['then'](function(_0x1f771c){logger['info'](_0x2f50('0xe'),_0x4c0d1b,_0x2f50('0xf'));logger[_0x2f50('0x10')](_0x2f50('0x11'),_0x4c0d1b,_0x2f50('0xf'),JSON[_0x2f50('0x12')](_0x1f771c));if(_0x1f771c['error']){if(_0x1f771c['error']['code']===0x1f4){logger[_0x2f50('0x13')](_0x2f50('0xe'),_0x4c0d1b,_0x1f771c[_0x2f50('0x13')][_0x2f50('0x14')]);return _0x31e2b4(_0x1f771c[_0x2f50('0x13')]['message']);}logger['error'](_0x2f50('0xe'),_0x4c0d1b,_0x1f771c[_0x2f50('0x13')][_0x2f50('0x14')]);return _0x13e8c8(_0x1f771c[_0x2f50('0x13')]['message']);}else{logger[_0x2f50('0x15')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4c0d1b,'request\x20sent');_0x13e8c8(_0x1f771c['result']['message']);}})[_0x2f50('0x16')](function(_0x35f528){logger[_0x2f50('0x13')](_0x2f50('0xe'),_0x4c0d1b,_0x35f528);_0x31e2b4(_0x35f528);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 034aa7c..f72e978 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 _0xe80d=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0xe80d,0xe6));var _0xde80=function(_0x20f08b,_0x646ea0){_0x20f08b=_0x20f08b-0x0;var _0x675062=_0xe80d[_0x20f08b];return _0x675062;};'use strict';var multer=require(_0xde80('0x0'));var util=require(_0xde80('0x1'));var path=require(_0xde80('0x2'));var timeout=require(_0xde80('0x3'));var express=require(_0xde80('0x4'));var router=express[_0xde80('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xde80('0x6'));var interaction=require(_0xde80('0x7'));var config=require('../../config/environment');var controller=require(_0xde80('0x8'));router[_0xde80('0x9')]('/',auth[_0xde80('0xa')](),controller[_0xde80('0xb')]);router[_0xde80('0x9')](_0xde80('0xc'),auth[_0xde80('0xa')](),controller[_0xde80('0xd')]);router[_0xde80('0xe')]('/',auth['isAuthenticated'](),controller[_0xde80('0xf')]);router[_0xde80('0x10')](_0xde80('0xc'),auth[_0xde80('0xa')](),controller['update']);router[_0xde80('0x11')](_0xde80('0xc'),auth[_0xde80('0xa')](),controller[_0xde80('0x12')]);module[_0xde80('0x13')]=router; \ No newline at end of file +var _0x9515=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy'];(function(_0x20dd2d,_0x235aaa){var _0x4005fc=function(_0x58fdee){while(--_0x58fdee){_0x20dd2d['push'](_0x20dd2d['shift']());}};_0x4005fc(++_0x235aaa);}(_0x9515,0x16a));var _0x5951=function(_0x5436b8,_0x15b216){_0x5436b8=_0x5436b8-0x0;var _0x1bd76a=_0x9515[_0x5436b8];return _0x1bd76a;};'use strict';var multer=require(_0x5951('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5951('0x1'));var express=require(_0x5951('0x2'));var router=express[_0x5951('0x3')]();var fs_extra=require(_0x5951('0x4'));var auth=require(_0x5951('0x5'));var interaction=require(_0x5951('0x6'));var config=require(_0x5951('0x7'));var controller=require(_0x5951('0x8'));router[_0x5951('0x9')]('/',auth[_0x5951('0xa')](),controller[_0x5951('0xb')]);router[_0x5951('0x9')](_0x5951('0xc'),auth[_0x5951('0xa')](),controller[_0x5951('0xd')]);router[_0x5951('0xe')]('/',auth[_0x5951('0xa')](),controller['create']);router[_0x5951('0xf')](_0x5951('0xc'),auth[_0x5951('0xa')](),controller[_0x5951('0x10')]);router['delete'](_0x5951('0xc'),auth[_0x5951('0xa')](),controller[_0x5951('0x11')]);module[_0x5951('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 1161213..5e77f9f 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 _0xcead=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0xcead,0x15f));var _0xdcea=function(_0x2c796a,_0x1b7360){_0x2c796a=_0x2c796a-0x0;var _0x434192=_0xcead[_0x2c796a];return _0x434192;};'use strict';var Sequelize=require(_0xdcea('0x0'));module['exports']={'type':{'type':Sequelize[_0xdcea('0x1')](_0xdcea('0x2'),_0xdcea('0x3'),_0xdcea('0x4'),_0xdcea('0x5'),_0xdcea('0x6')),'defaultValue':_0xdcea('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdcea('0x1')]('string',_0xdcea('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xdcea('0x7')]},'idField':{'type':Sequelize[_0xdcea('0x7')]},'nameField':{'type':Sequelize[_0xdcea('0x7')]},'customField':{'type':Sequelize[_0xdcea('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdcea('0x7')]}}; \ No newline at end of file +var _0x99a8=['customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x2d1cf8,_0x21146f){var _0x417b3e=function(_0x179109){while(--_0x179109){_0x2d1cf8['push'](_0x2d1cf8['shift']());}};_0x417b3e(++_0x21146f);}(_0x99a8,0xa7));var _0x899a=function(_0x1a95a7,_0x295e79){_0x1a95a7=_0x1a95a7-0x0;var _0x3ff342=_0x99a8[_0x1a95a7];return _0x3ff342;};'use strict';var Sequelize=require(_0x899a('0x0'));module[_0x899a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x899a('0x2'),_0x899a('0x3'),_0x899a('0x4'),'keyValue',_0x899a('0x5')),'defaultValue':_0x899a('0x2')},'content':{'type':Sequelize[_0x899a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x899a('0x7')](_0x899a('0x2'),_0x899a('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x899a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x899a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x899a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 02d6e96..b274aef 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 _0xd8dc=['rawAttributes','fieldName','key','model','map','query','filters','attributes','fields','length','nolimit','order','sort','where','type','filter','merge','options','then','includeAll','findAll','show','params','keys','intersection','include','create','body','find','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','destroy','stack','name','send','Dynamics365Field'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8dc,0x163));var _0xcd8d=function(_0x430a36,_0x3ede38){_0x430a36=_0x430a36-0x0;var _0x6e4889=_0xd8dc[_0x430a36];return _0x6e4889;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd8d('0x0'));var zipdir=require(_0xcd8d('0x1'));var jsonpatch=require(_0xcd8d('0x2'));var rp=require('request-promise');var moment=require(_0xcd8d('0x3'));var BPromise=require(_0xcd8d('0x4'));var Mustache=require('mustache');var util=require(_0xcd8d('0x5'));var path=require(_0xcd8d('0x6'));var sox=require(_0xcd8d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd8d('0x8'));var _=require('lodash');var squel=require(_0xcd8d('0x9'));var crypto=require(_0xcd8d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcd8d('0xb'));var toCsv=require(_0xcd8d('0xc'));var querystring=require('querystring');var Papa=require(_0xcd8d('0xd'));var Redis=require(_0xcd8d('0xe'));var authService=require(_0xcd8d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcd8d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd8d('0x11'))(_0xcd8d('0x12'));var utils=require('../../config/utils');var config=require(_0xcd8d('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcbd1ae,_0x49874a){_0x49874a=_0x49874a||0xcc;return function(_0x3ddca3){if(_0x3ddca3){return _0xcbd1ae[_0xcd8d('0x14')](_0x49874a);}return _0xcbd1ae[_0xcd8d('0x15')](_0x49874a)['end']();};}function respondWithResult(_0x8477a7,_0xeb8b56){_0xeb8b56=_0xeb8b56||0xc8;return function(_0x435e0e){if(_0x435e0e){return _0x8477a7[_0xcd8d('0x15')](_0xeb8b56)[_0xcd8d('0x16')](_0x435e0e);}};}function respondWithFilteredResult(_0x4b95cf,_0x5e10ae){return function(_0x344824){if(_0x344824){var _0x4e3c2d=typeof _0x5e10ae[_0xcd8d('0x17')]===_0xcd8d('0x18')&&typeof _0x5e10ae[_0xcd8d('0x19')]===_0xcd8d('0x18');var _0xeed85d=_0x344824[_0xcd8d('0x1a')];var _0x1b8abf=_0x4e3c2d?0x0:_0x5e10ae[_0xcd8d('0x17')];var _0x107456=_0x4e3c2d?_0x344824[_0xcd8d('0x1a')]:_0x5e10ae[_0xcd8d('0x17')]+_0x5e10ae[_0xcd8d('0x19')];var _0x53f32a;if(_0x107456>=_0xeed85d){_0x107456=_0xeed85d;_0x53f32a=0xc8;}else{_0x53f32a=0xce;}_0x4b95cf[_0xcd8d('0x15')](_0x53f32a);return _0x4b95cf['set']('Content-Range',_0x1b8abf+'-'+_0x107456+'/'+_0xeed85d)[_0xcd8d('0x16')](_0x344824);}return null;};}function patchUpdates(_0x27bcd6){return function(_0x1461b2){try{jsonpatch['apply'](_0x1461b2,_0x27bcd6,!![]);}catch(_0x3859d8){return BPromise[_0xcd8d('0x1b')](_0x3859d8);}return _0x1461b2[_0xcd8d('0x1c')]();};}function saveUpdates(_0x40a673,_0x30bad2){return function(_0x66718a){if(_0x66718a){return _0x66718a[_0xcd8d('0x1d')](_0x40a673)['then'](function(_0x543531){return _0x543531;});}return null;};}function removeEntity(_0x54a235,_0xec79c2){return function(_0x248497){if(_0x248497){return _0x248497[_0xcd8d('0x1e')]()['then'](function(){_0x54a235[_0xcd8d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x153467,_0x800ce0){return function(_0x5bfee0){if(!_0x5bfee0){_0x153467[_0xcd8d('0x14')](0x194);}return _0x5bfee0;};}function handleError(_0x541734,_0x5602e9){_0x5602e9=_0x5602e9||0x1f4;return function(_0x43cddc){logger['error'](_0x43cddc[_0xcd8d('0x1f')]);if(_0x43cddc[_0xcd8d('0x20')]){delete _0x43cddc['name'];}_0x541734[_0xcd8d('0x15')](_0x5602e9)[_0xcd8d('0x21')](_0x43cddc);};}exports['index']=function(_0x10870f,_0x505585){var _0x1b2221={},_0xc82418={},_0x3d2d56={'count':0x0,'rows':[]};var _0x4618c4=_['map'](db[_0xcd8d('0x22')][_0xcd8d('0x23')],function(_0x23ef1d){return{'name':_0x23ef1d[_0xcd8d('0x24')],'type':_0x23ef1d['type'][_0xcd8d('0x25')]};});_0xc82418[_0xcd8d('0x26')]=_[_0xcd8d('0x27')](_0x4618c4,_0xcd8d('0x20'));_0xc82418[_0xcd8d('0x28')]=_['keys'](_0x10870f[_0xcd8d('0x28')]);_0xc82418[_0xcd8d('0x29')]=_['intersection'](_0xc82418[_0xcd8d('0x26')],_0xc82418[_0xcd8d('0x28')]);_0x1b2221[_0xcd8d('0x2a')]=_['intersection'](_0xc82418[_0xcd8d('0x26')],qs[_0xcd8d('0x2b')](_0x10870f['query'][_0xcd8d('0x2b')]));_0x1b2221[_0xcd8d('0x2a')]=_0x1b2221[_0xcd8d('0x2a')][_0xcd8d('0x2c')]?_0x1b2221['attributes']:_0xc82418[_0xcd8d('0x26')];if(!_0x10870f['query']['hasOwnProperty'](_0xcd8d('0x2d'))){_0x1b2221[_0xcd8d('0x19')]=qs['limit'](_0x10870f[_0xcd8d('0x28')][_0xcd8d('0x19')]);_0x1b2221[_0xcd8d('0x17')]=qs['offset'](_0x10870f['query'][_0xcd8d('0x17')]);}_0x1b2221[_0xcd8d('0x2e')]=qs[_0xcd8d('0x2f')](_0x10870f[_0xcd8d('0x28')][_0xcd8d('0x2f')]);_0x1b2221['where']=qs[_0xcd8d('0x29')](_['pick'](_0x10870f['query'],_0xc82418[_0xcd8d('0x29')]),_0x4618c4);if(_0x10870f[_0xcd8d('0x28')]['filter']){_0x1b2221[_0xcd8d('0x30')]=_['merge'](_0x1b2221['where'],{'$or':_[_0xcd8d('0x27')](_0x4618c4,function(_0x4193af){if(_0x4193af[_0xcd8d('0x31')]!=='VIRTUAL'){var _0x38a167={};_0x38a167[_0x4193af[_0xcd8d('0x20')]]={'$like':'%'+_0x10870f[_0xcd8d('0x28')][_0xcd8d('0x32')]+'%'};return _0x38a167;}})});}_0x1b2221=_[_0xcd8d('0x33')]({},_0x1b2221,_0x10870f[_0xcd8d('0x34')]);var _0x3f8154={'where':_0x1b2221['where']};return db[_0xcd8d('0x22')][_0xcd8d('0x1a')](_0x3f8154)[_0xcd8d('0x35')](function(_0x3e8621){_0x3d2d56['count']=_0x3e8621;if(_0x10870f[_0xcd8d('0x28')][_0xcd8d('0x36')]){_0x1b2221['include']=[{'all':!![]}];}return db[_0xcd8d('0x22')][_0xcd8d('0x37')](_0x1b2221);})[_0xcd8d('0x35')](function(_0x5792bf){_0x3d2d56['rows']=_0x5792bf;return _0x3d2d56;})['then'](respondWithFilteredResult(_0x505585,_0x1b2221))['catch'](handleError(_0x505585,null));};exports[_0xcd8d('0x38')]=function(_0xd6aea4,_0x4ede02){var _0xee9143={'raw':!![],'where':{'id':_0xd6aea4[_0xcd8d('0x39')]['id']}},_0x3babe1={};_0x3babe1[_0xcd8d('0x26')]=_[_0xcd8d('0x3a')](db[_0xcd8d('0x22')][_0xcd8d('0x23')]);_0x3babe1['query']=_[_0xcd8d('0x3a')](_0xd6aea4['query']);_0x3babe1[_0xcd8d('0x29')]=_[_0xcd8d('0x3b')](_0x3babe1[_0xcd8d('0x26')],_0x3babe1[_0xcd8d('0x28')]);_0xee9143[_0xcd8d('0x2a')]=_[_0xcd8d('0x3b')](_0x3babe1[_0xcd8d('0x26')],qs[_0xcd8d('0x2b')](_0xd6aea4[_0xcd8d('0x28')]['fields']));_0xee9143[_0xcd8d('0x2a')]=_0xee9143['attributes'][_0xcd8d('0x2c')]?_0xee9143[_0xcd8d('0x2a')]:_0x3babe1['model'];if(_0xd6aea4['query']['includeAll']){_0xee9143[_0xcd8d('0x3c')]=[{'all':!![]}];}_0xee9143=_[_0xcd8d('0x33')]({},_0xee9143,_0xd6aea4[_0xcd8d('0x34')]);return db['Dynamics365Field']['find'](_0xee9143)[_0xcd8d('0x35')](handleEntityNotFound(_0x4ede02,null))[_0xcd8d('0x35')](respondWithResult(_0x4ede02,null))['catch'](handleError(_0x4ede02,null));};exports['create']=function(_0x263c55,_0xfd15a8){return db[_0xcd8d('0x22')][_0xcd8d('0x3d')](_0x263c55[_0xcd8d('0x3e')],{})[_0xcd8d('0x35')](respondWithResult(_0xfd15a8,0xc9))['catch'](handleError(_0xfd15a8,null));};exports['update']=function(_0x3dc886,_0x9d066b){if(_0x3dc886[_0xcd8d('0x3e')]['id']){delete _0x3dc886['body']['id'];}return db[_0xcd8d('0x22')][_0xcd8d('0x3f')]({'where':{'id':_0x3dc886[_0xcd8d('0x39')]['id']}})[_0xcd8d('0x35')](handleEntityNotFound(_0x9d066b,null))[_0xcd8d('0x35')](saveUpdates(_0x3dc886[_0xcd8d('0x3e')],null))['then'](respondWithResult(_0x9d066b,null))[_0xcd8d('0x40')](handleError(_0x9d066b,null));};exports['destroy']=function(_0x370927,_0x93ec06){return db[_0xcd8d('0x22')][_0xcd8d('0x3f')]({'where':{'id':_0x370927[_0xcd8d('0x39')]['id']}})[_0xcd8d('0x35')](handleEntityNotFound(_0x93ec06,null))[_0xcd8d('0x35')](removeEntity(_0x93ec06,null))[_0xcd8d('0x40')](handleError(_0x93ec06,null));}; \ No newline at end of file +var _0xb99c=['status','offset','undefined','count','json','apply','reject','save','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','Dynamics365Field','findAll','rows','catch','params','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x3b3750,_0x28f3b8){var _0x1b9e8b=function(_0xaf75c3){while(--_0xaf75c3){_0x3b3750['push'](_0x3b3750['shift']());}};_0x1b9e8b(++_0x28f3b8);}(_0xb99c,0x154));var _0xcb99=function(_0x276c9f,_0x22be0e){_0x276c9f=_0x276c9f-0x0;var _0x398fc6=_0xb99c[_0x276c9f];return _0x398fc6;};'use strict';var emlformat=require(_0xcb99('0x0'));var rimraf=require(_0xcb99('0x1'));var zipdir=require(_0xcb99('0x2'));var jsonpatch=require(_0xcb99('0x3'));var rp=require(_0xcb99('0x4'));var moment=require(_0xcb99('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb99('0x6'));var util=require(_0xcb99('0x7'));var path=require('path');var sox=require(_0xcb99('0x8'));var csv=require(_0xcb99('0x9'));var ejs=require(_0xcb99('0xa'));var fs=require('fs');var fs_extra=require(_0xcb99('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcb99('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcb99('0xd'));var toCsv=require(_0xcb99('0x9'));var querystring=require(_0xcb99('0xe'));var Papa=require('papaparse');var Redis=require(_0xcb99('0xf'));var authService=require(_0xcb99('0x10'));var qs=require(_0xcb99('0x11'));var as=require(_0xcb99('0x12'));var hardwareService=require(_0xcb99('0x13'));var logger=require(_0xcb99('0x14'))(_0xcb99('0x15'));var utils=require(_0xcb99('0x16'));var config=require(_0xcb99('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x578563,_0x12f8e5){_0x12f8e5=_0x12f8e5||0xcc;return function(_0x24c341){if(_0x24c341){return _0x578563[_0xcb99('0x18')](_0x12f8e5);}return _0x578563['status'](_0x12f8e5)['end']();};}function respondWithResult(_0x3e8351,_0x2a58e9){_0x2a58e9=_0x2a58e9||0xc8;return function(_0x5b4897){if(_0x5b4897){return _0x3e8351[_0xcb99('0x19')](_0x2a58e9)['json'](_0x5b4897);}};}function respondWithFilteredResult(_0x1a9f1c,_0x2ea94c){return function(_0x46b061){if(_0x46b061){var _0x53ad54=typeof _0x2ea94c[_0xcb99('0x1a')]===_0xcb99('0x1b')&&typeof _0x2ea94c['limit']==='undefined';var _0x5636cc=_0x46b061[_0xcb99('0x1c')];var _0x26f497=_0x53ad54?0x0:_0x2ea94c[_0xcb99('0x1a')];var _0x38a3c4=_0x53ad54?_0x46b061['count']:_0x2ea94c[_0xcb99('0x1a')]+_0x2ea94c['limit'];var _0xe92176;if(_0x38a3c4>=_0x5636cc){_0x38a3c4=_0x5636cc;_0xe92176=0xc8;}else{_0xe92176=0xce;}_0x1a9f1c[_0xcb99('0x19')](_0xe92176);return _0x1a9f1c['set']('Content-Range',_0x26f497+'-'+_0x38a3c4+'/'+_0x5636cc)[_0xcb99('0x1d')](_0x46b061);}return null;};}function patchUpdates(_0x583e1a){return function(_0x18e79d){try{jsonpatch[_0xcb99('0x1e')](_0x18e79d,_0x583e1a,!![]);}catch(_0x250440){return BPromise[_0xcb99('0x1f')](_0x250440);}return _0x18e79d[_0xcb99('0x20')]();};}function saveUpdates(_0x4118e7,_0x53c541){return function(_0x1355a3){if(_0x1355a3){return _0x1355a3[_0xcb99('0x21')](_0x4118e7)[_0xcb99('0x22')](function(_0x188fa4){return _0x188fa4;});}return null;};}function removeEntity(_0x40fc29,_0x46864a){return function(_0x2b0f02){if(_0x2b0f02){return _0x2b0f02['destroy']()[_0xcb99('0x22')](function(){_0x40fc29[_0xcb99('0x19')](0xcc)[_0xcb99('0x23')]();});}};}function handleEntityNotFound(_0x580c35,_0xea1423){return function(_0x2f86a6){if(!_0x2f86a6){_0x580c35[_0xcb99('0x18')](0x194);}return _0x2f86a6;};}function handleError(_0x39aca1,_0x3215ec){_0x3215ec=_0x3215ec||0x1f4;return function(_0x260b82){logger[_0xcb99('0x24')](_0x260b82[_0xcb99('0x25')]);if(_0x260b82[_0xcb99('0x26')]){delete _0x260b82[_0xcb99('0x26')];}_0x39aca1[_0xcb99('0x19')](_0x3215ec)['send'](_0x260b82);};}exports[_0xcb99('0x27')]=function(_0x2e0566,_0x2e17bd){var _0x2c07a5={},_0x1adcba={},_0x55b1d9={'count':0x0,'rows':[]};var _0x5614a3=_[_0xcb99('0x28')](db['Dynamics365Field'][_0xcb99('0x29')],function(_0x5e2f5c){return{'name':_0x5e2f5c[_0xcb99('0x2a')],'type':_0x5e2f5c[_0xcb99('0x2b')][_0xcb99('0x2c')]};});_0x1adcba[_0xcb99('0x2d')]=_['map'](_0x5614a3,'name');_0x1adcba[_0xcb99('0x2e')]=_[_0xcb99('0x2f')](_0x2e0566[_0xcb99('0x2e')]);_0x1adcba[_0xcb99('0x30')]=_[_0xcb99('0x31')](_0x1adcba['model'],_0x1adcba['query']);_0x2c07a5[_0xcb99('0x32')]=_['intersection'](_0x1adcba['model'],qs[_0xcb99('0x33')](_0x2e0566[_0xcb99('0x2e')][_0xcb99('0x33')]));_0x2c07a5[_0xcb99('0x32')]=_0x2c07a5['attributes'][_0xcb99('0x34')]?_0x2c07a5['attributes']:_0x1adcba[_0xcb99('0x2d')];if(!_0x2e0566[_0xcb99('0x2e')][_0xcb99('0x35')]('nolimit')){_0x2c07a5[_0xcb99('0x36')]=qs[_0xcb99('0x36')](_0x2e0566[_0xcb99('0x2e')][_0xcb99('0x36')]);_0x2c07a5['offset']=qs['offset'](_0x2e0566['query'][_0xcb99('0x1a')]);}_0x2c07a5['order']=qs[_0xcb99('0x37')](_0x2e0566[_0xcb99('0x2e')][_0xcb99('0x37')]);_0x2c07a5[_0xcb99('0x38')]=qs[_0xcb99('0x30')](_[_0xcb99('0x39')](_0x2e0566[_0xcb99('0x2e')],_0x1adcba['filters']),_0x5614a3);if(_0x2e0566[_0xcb99('0x2e')][_0xcb99('0x3a')]){_0x2c07a5['where']=_[_0xcb99('0x3b')](_0x2c07a5[_0xcb99('0x38')],{'$or':_[_0xcb99('0x28')](_0x5614a3,function(_0x187a28){if(_0x187a28[_0xcb99('0x2b')]!==_0xcb99('0x3c')){var _0x1f3c4b={};_0x1f3c4b[_0x187a28['name']]={'$like':'%'+_0x2e0566['query']['filter']+'%'};return _0x1f3c4b;}})});}_0x2c07a5=_[_0xcb99('0x3b')]({},_0x2c07a5,_0x2e0566[_0xcb99('0x3d')]);var _0x19d017={'where':_0x2c07a5['where']};return db['Dynamics365Field'][_0xcb99('0x1c')](_0x19d017)[_0xcb99('0x22')](function(_0x19356a){_0x55b1d9[_0xcb99('0x1c')]=_0x19356a;if(_0x2e0566['query'][_0xcb99('0x3e')]){_0x2c07a5['include']=[{'all':!![]}];}return db[_0xcb99('0x3f')][_0xcb99('0x40')](_0x2c07a5);})[_0xcb99('0x22')](function(_0x12579f){_0x55b1d9[_0xcb99('0x41')]=_0x12579f;return _0x55b1d9;})[_0xcb99('0x22')](respondWithFilteredResult(_0x2e17bd,_0x2c07a5))[_0xcb99('0x42')](handleError(_0x2e17bd,null));};exports['show']=function(_0x219870,_0x1abcf3){var _0xe505f8={'raw':!![],'where':{'id':_0x219870[_0xcb99('0x43')]['id']}},_0x183a40={};_0x183a40['model']=_[_0xcb99('0x2f')](db[_0xcb99('0x3f')][_0xcb99('0x29')]);_0x183a40[_0xcb99('0x2e')]=_[_0xcb99('0x2f')](_0x219870['query']);_0x183a40[_0xcb99('0x30')]=_[_0xcb99('0x31')](_0x183a40[_0xcb99('0x2d')],_0x183a40[_0xcb99('0x2e')]);_0xe505f8[_0xcb99('0x32')]=_[_0xcb99('0x31')](_0x183a40[_0xcb99('0x2d')],qs['fields'](_0x219870['query'][_0xcb99('0x33')]));_0xe505f8[_0xcb99('0x32')]=_0xe505f8[_0xcb99('0x32')][_0xcb99('0x34')]?_0xe505f8[_0xcb99('0x32')]:_0x183a40[_0xcb99('0x2d')];if(_0x219870[_0xcb99('0x2e')][_0xcb99('0x3e')]){_0xe505f8[_0xcb99('0x44')]=[{'all':!![]}];}_0xe505f8=_[_0xcb99('0x3b')]({},_0xe505f8,_0x219870['options']);return db['Dynamics365Field'][_0xcb99('0x45')](_0xe505f8)['then'](handleEntityNotFound(_0x1abcf3,null))['then'](respondWithResult(_0x1abcf3,null))[_0xcb99('0x42')](handleError(_0x1abcf3,null));};exports['create']=function(_0x5cbd25,_0x56b484){return db['Dynamics365Field'][_0xcb99('0x46')](_0x5cbd25[_0xcb99('0x47')],{})[_0xcb99('0x22')](respondWithResult(_0x56b484,0xc9))[_0xcb99('0x42')](handleError(_0x56b484,null));};exports['update']=function(_0x114452,_0x777f06){if(_0x114452[_0xcb99('0x47')]['id']){delete _0x114452[_0xcb99('0x47')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x114452[_0xcb99('0x43')]['id']}})[_0xcb99('0x22')](handleEntityNotFound(_0x777f06,null))[_0xcb99('0x22')](saveUpdates(_0x114452[_0xcb99('0x47')],null))[_0xcb99('0x22')](respondWithResult(_0x777f06,null))[_0xcb99('0x42')](handleError(_0x777f06,null));};exports[_0xcb99('0x48')]=function(_0xf5777a,_0x270874){return db['Dynamics365Field']['find']({'where':{'id':_0xf5777a[_0xcb99('0x43')]['id']}})['then'](handleEntityNotFound(_0x270874,null))['then'](removeEntity(_0x270874,null))[_0xcb99('0x42')](handleError(_0x270874,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 191aff8..79e39da 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 _0x1784=['bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x4f02da,_0x2e24b7){var _0x235548=function(_0x32ded2){while(--_0x32ded2){_0x4f02da['push'](_0x4f02da['shift']());}};_0x235548(++_0x2e24b7);}(_0x1784,0x1bb));var _0x4178=function(_0x1501e2,_0x271210){_0x1501e2=_0x1501e2-0x0;var _0xfce8c5=_0x1784[_0x1501e2];return _0xfce8c5;};'use strict';var _=require(_0x4178('0x0'));var util=require(_0x4178('0x1'));var logger=require(_0x4178('0x2'))(_0x4178('0x3'));var moment=require(_0x4178('0x4'));var BPromise=require(_0x4178('0x5'));var rp=require(_0x4178('0x6'));var fs=require('fs');var path=require(_0x4178('0x7'));var rimraf=require(_0x4178('0x8'));var config=require(_0x4178('0x9'));var attributes=require(_0x4178('0xa'));module['exports']=function(_0x5821e2,_0x21041e){return _0x5821e2[_0x4178('0xb')](_0x4178('0xc'),attributes,{'tableName':_0x4178('0xd'),'paranoid':![],'indexes':[{'name':_0x4178('0xe'),'fields':['idField',_0x4178('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab48=['Dynamics365Field','int_dynamics365_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x1ff6d1,_0x52f903){var _0x1554cd=function(_0x233f9d){while(--_0x233f9d){_0x1ff6d1['push'](_0x1ff6d1['shift']());}};_0x1554cd(++_0x52f903);}(_0xab48,0xe2));var _0x8ab4=function(_0x2c022d,_0x53e9c5){_0x2c022d=_0x2c022d-0x0;var _0x1b835f=_0xab48[_0x2c022d];return _0x1b835f;};'use strict';var _=require(_0x8ab4('0x0'));var util=require(_0x8ab4('0x1'));var logger=require(_0x8ab4('0x2'))(_0x8ab4('0x3'));var moment=require('moment');var BPromise=require(_0x8ab4('0x4'));var rp=require(_0x8ab4('0x5'));var fs=require('fs');var path=require(_0x8ab4('0x6'));var rimraf=require(_0x8ab4('0x7'));var config=require(_0x8ab4('0x8'));var attributes=require(_0x8ab4('0x9'));module[_0x8ab4('0xa')]=function(_0x297d4c,_0x163cbc){return _0x297d4c[_0x8ab4('0xb')](_0x8ab4('0xc'),attributes,{'tableName':_0x8ab4('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index b27fa90..251afc2 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 _0x7253=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x46ba50,_0x440caa){var _0xb13d2f=function(_0x42b18e){while(--_0x42b18e){_0x46ba50['push'](_0x46ba50['shift']());}};_0xb13d2f(++_0x440caa);}(_0x7253,0x12f));var _0x3725=function(_0x307037,_0x3ec264){_0x307037=_0x307037-0x0;var _0x1abcf0=_0x7253[_0x307037];return _0x1abcf0;};'use strict';var _=require(_0x3725('0x0'));var util=require(_0x3725('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3725('0x2'));var db=require(_0x3725('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3725('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3725('0x5'));var client=jayson[_0x3725('0x6')][_0x3725('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4bc3b5,_0x130398,_0x4557c0){return new BPromise(function(_0x26587,_0x103ec5){return client[_0x3725('0x8')](_0x4bc3b5,_0x4557c0)[_0x3725('0x9')](function(_0x5302ae){logger[_0x3725('0xa')](_0x3725('0xb'),_0x130398,'request\x20sent');logger[_0x3725('0xc')](_0x3725('0xd'),_0x130398,_0x3725('0xe'),JSON[_0x3725('0xf')](_0x5302ae));if(_0x5302ae['error']){if(_0x5302ae[_0x3725('0x10')][_0x3725('0x11')]===0x1f4){logger[_0x3725('0x10')](_0x3725('0xb'),_0x130398,_0x5302ae[_0x3725('0x10')]['message']);return _0x103ec5(_0x5302ae[_0x3725('0x10')][_0x3725('0x12')]);}logger[_0x3725('0x10')](_0x3725('0xb'),_0x130398,_0x5302ae['error']['message']);return _0x26587(_0x5302ae[_0x3725('0x10')][_0x3725('0x12')]);}else{logger[_0x3725('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x130398,_0x3725('0xe'));_0x26587(_0x5302ae[_0x3725('0x13')]['message']);}})[_0x3725('0x14')](function(_0x68abb2){logger[_0x3725('0x10')](_0x3725('0xb'),_0x130398,_0x68abb2);_0x103ec5(_0x68abb2);});});} \ No newline at end of file +var _0xee86=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51ebb3,_0x52ce46){var _0x36dc3c=function(_0x1ca64c){while(--_0x1ca64c){_0x51ebb3['push'](_0x51ebb3['shift']());}};_0x36dc3c(++_0x52ce46);}(_0xee86,0xc2));var _0x6ee8=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xee86[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x6ee8('0x0'));var util=require(_0x6ee8('0x1'));var moment=require('moment');var BPromise=require(_0x6ee8('0x2'));var rs=require(_0x6ee8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ee8('0x4'));var logger=require(_0x6ee8('0x5'))(_0x6ee8('0x6'));var config=require(_0x6ee8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6ee8('0x8')][_0x6ee8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ec82,_0x3c1017,_0x4e380e){return new BPromise(function(_0x4ab78d,_0x2d567e){return client[_0x6ee8('0xa')](_0x40ec82,_0x4e380e)[_0x6ee8('0xb')](function(_0x22c640){logger[_0x6ee8('0xc')](_0x6ee8('0xd'),_0x3c1017,_0x6ee8('0xe'));logger[_0x6ee8('0xf')](_0x6ee8('0x10'),_0x3c1017,_0x6ee8('0xe'),JSON[_0x6ee8('0x11')](_0x22c640));if(_0x22c640['error']){if(_0x22c640[_0x6ee8('0x12')]['code']===0x1f4){logger[_0x6ee8('0x12')](_0x6ee8('0xd'),_0x3c1017,_0x22c640[_0x6ee8('0x12')][_0x6ee8('0x13')]);return _0x2d567e(_0x22c640[_0x6ee8('0x12')][_0x6ee8('0x13')]);}logger[_0x6ee8('0x12')](_0x6ee8('0xd'),_0x3c1017,_0x22c640[_0x6ee8('0x12')]['message']);return _0x4ab78d(_0x22c640[_0x6ee8('0x12')][_0x6ee8('0x13')]);}else{logger[_0x6ee8('0xc')](_0x6ee8('0xd'),_0x3c1017,'request\x20sent');_0x4ab78d(_0x22c640[_0x6ee8('0x14')][_0x6ee8('0x13')]);}})['catch'](function(_0xad480a){logger[_0x6ee8('0x12')](_0x6ee8('0xd'),_0x3c1017,_0xad480a);_0x2d567e(_0xad480a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 307f1d6..de1ce05 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 _0xad6c=['../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xad6c,0x11a));var _0xcad6=function(_0x147b21,_0xa7bba5){_0x147b21=_0x147b21-0x0;var _0x1410ef=_0xad6c[_0x147b21];return _0x1410ef;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcad6('0x0'));var express=require(_0xcad6('0x1'));var router=express[_0xcad6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcad6('0x3'));var interaction=require(_0xcad6('0x4'));var config=require('../../config/environment');var controller=require(_0xcad6('0x5'));router[_0xcad6('0x6')]('/',auth[_0xcad6('0x7')](),controller[_0xcad6('0x8')]);router[_0xcad6('0x6')](_0xcad6('0x9'),auth[_0xcad6('0x7')](),controller[_0xcad6('0xa')]);router['get'](_0xcad6('0xb'),auth[_0xcad6('0x7')](),controller[_0xcad6('0xc')]);router[_0xcad6('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xcad6('0xd')]);router[_0xcad6('0xe')]('/',auth[_0xcad6('0x7')](),controller[_0xcad6('0xf')]);router[_0xcad6('0xe')](_0xcad6('0xb'),auth[_0xcad6('0x7')](),controller[_0xcad6('0x10')]);router[_0xcad6('0x11')]('/:id',auth[_0xcad6('0x7')](),controller[_0xcad6('0x12')]);router[_0xcad6('0x13')](_0xcad6('0x9'),auth[_0xcad6('0x7')](),controller[_0xcad6('0x14')]);module[_0xcad6('0x15')]=router; \ No newline at end of file +var _0x0c31=['update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put'];(function(_0x493e2c,_0x4ba39c){var _0x5ec0d8=function(_0x465107){while(--_0x465107){_0x493e2c['push'](_0x493e2c['shift']());}};_0x5ec0d8(++_0x4ba39c);}(_0x0c31,0x153));var _0x10c3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0c31[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x10c3('0x0'));var timeout=require(_0x10c3('0x1'));var express=require(_0x10c3('0x2'));var router=express[_0x10c3('0x3')]();var fs_extra=require(_0x10c3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x10c3('0x5'));var controller=require(_0x10c3('0x6'));router['get']('/',auth[_0x10c3('0x7')](),controller['index']);router[_0x10c3('0x8')](_0x10c3('0x9'),auth['isAuthenticated'](),controller[_0x10c3('0xa')]);router['get'](_0x10c3('0xb'),auth[_0x10c3('0x7')](),controller[_0x10c3('0xc')]);router['get'](_0x10c3('0xd'),auth[_0x10c3('0x7')](),controller[_0x10c3('0xe')]);router[_0x10c3('0xf')]('/',auth[_0x10c3('0x7')](),controller[_0x10c3('0x10')]);router[_0x10c3('0xf')]('/:id/configurations',auth[_0x10c3('0x7')](),controller['addConfiguration']);router[_0x10c3('0x11')](_0x10c3('0x9'),auth['isAuthenticated'](),controller[_0x10c3('0x12')]);router[_0x10c3('0x13')](_0x10c3('0x9'),auth[_0x10c3('0x7')](),controller[_0x10c3('0x14')]);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 8f394fc..1963b45 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 _0x33af=['exports','STRING','username','remoteUri'];(function(_0x2e4293,_0x21aeb0){var _0x11a5ff=function(_0x166719){while(--_0x166719){_0x2e4293['push'](_0x2e4293['shift']());}};_0x11a5ff(++_0x21aeb0);}(_0x33af,0xec));var _0xf33a=function(_0xff659d,_0x2283a1){_0xff659d=_0xff659d-0x0;var _0x19c170=_0x33af[_0xff659d];return _0x19c170;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf33a('0x1')]},'username':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x2')},'apiKey':{'type':Sequelize[_0xf33a('0x1')]},'remoteUri':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5430=['STRING','username','remoteUri','sequelize','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5430,0x10c));var _0x0543=function(_0x56bcb9,_0x11a64b){_0x56bcb9=_0x56bcb9-0x0;var _0xc038ed=_0x5430[_0x56bcb9];return _0xc038ed;};'use strict';var Sequelize=require(_0x0543('0x0'));module[_0x0543('0x1')]={'name':{'type':Sequelize[_0x0543('0x2')]},'description':{'type':Sequelize[_0x0543('0x2')]},'username':{'type':Sequelize[_0x0543('0x2')],'unique':_0x0543('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0543('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d87ef7e..70164f3 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 _0xbc8b=['base64','requester','subject','agent','group','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','FreshdeskConfiguration','pick','getConfigurations','findOne','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString'];(function(_0x548b33,_0x532f9a){var _0x17a608=function(_0x40e511){while(--_0x40e511){_0x548b33['push'](_0x548b33['shift']());}};_0x17a608(++_0x532f9a);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0xbc8b[_0x14476b];return _0x24e2e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbc8('0x1'));var rp=require(_0xbbc8('0x2'));var moment=require(_0xbbc8('0x3'));var BPromise=require(_0xbbc8('0x4'));var Mustache=require(_0xbbc8('0x5'));var util=require(_0xbbc8('0x6'));var path=require('path');var sox=require(_0xbbc8('0x7'));var csv=require(_0xbbc8('0x8'));var ejs=require(_0xbbc8('0x9'));var fs=require('fs');var fs_extra=require(_0xbbc8('0xa'));var _=require(_0xbbc8('0xb'));var squel=require('squel');var crypto=require(_0xbbc8('0xc'));var jsforce=require(_0xbbc8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbbc8('0x8'));var querystring=require(_0xbbc8('0xe'));var Papa=require(_0xbbc8('0xf'));var Redis=require(_0xbbc8('0x10'));var authService=require(_0xbbc8('0x11'));var qs=require(_0xbbc8('0x12'));var as=require(_0xbbc8('0x13'));var hardwareService=require(_0xbbc8('0x14'));var logger=require(_0xbbc8('0x15'))(_0xbbc8('0x16'));var utils=require(_0xbbc8('0x17'));var config=require(_0xbbc8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbc8('0x19'))['db'];var integrations=require(_0xbbc8('0x1a'));function respondWithStatusCode(_0x1c4b00,_0x55b386){_0x55b386=_0x55b386||0xcc;return function(_0x5b4b1b){if(_0x5b4b1b){return _0x1c4b00[_0xbbc8('0x1b')](_0x55b386);}return _0x1c4b00['status'](_0x55b386)[_0xbbc8('0x1c')]();};}function respondWithResult(_0x2add43,_0x1c76df){_0x1c76df=_0x1c76df||0xc8;return function(_0x1126c7){if(_0x1126c7){return _0x2add43[_0xbbc8('0x1d')](_0x1c76df)[_0xbbc8('0x1e')](_0x1126c7);}};}function respondWithFilteredResult(_0x292cc2,_0x1cd58e){return function(_0x38bf2f){if(_0x38bf2f){var _0x20e656=typeof _0x1cd58e[_0xbbc8('0x1f')]===_0xbbc8('0x20')&&typeof _0x1cd58e[_0xbbc8('0x21')]===_0xbbc8('0x20');var _0x5b070e=_0x38bf2f[_0xbbc8('0x22')];var _0x218cae=_0x20e656?0x0:_0x1cd58e[_0xbbc8('0x1f')];var _0x291abf=_0x20e656?_0x38bf2f['count']:_0x1cd58e[_0xbbc8('0x1f')]+_0x1cd58e['limit'];var _0xc5ea1e;if(_0x291abf>=_0x5b070e){_0x291abf=_0x5b070e;_0xc5ea1e=0xc8;}else{_0xc5ea1e=0xce;}_0x292cc2[_0xbbc8('0x1d')](_0xc5ea1e);return _0x292cc2['set'](_0xbbc8('0x23'),_0x218cae+'-'+_0x291abf+'/'+_0x5b070e)[_0xbbc8('0x1e')](_0x38bf2f);}return null;};}function patchUpdates(_0x14b069){return function(_0x283526){try{jsonpatch[_0xbbc8('0x24')](_0x283526,_0x14b069,!![]);}catch(_0x35391d){return BPromise[_0xbbc8('0x25')](_0x35391d);}return _0x283526['save']();};}function saveUpdates(_0x14af5b,_0x5a1e00){return function(_0x80fb90){if(_0x80fb90){return _0x80fb90[_0xbbc8('0x26')](_0x14af5b)[_0xbbc8('0x27')](function(_0x37acb1){return _0x37acb1;});}return null;};}function removeEntity(_0x354312,_0x521c11){return function(_0xd3200c){if(_0xd3200c){return _0xd3200c[_0xbbc8('0x28')]()['then'](function(){_0x354312['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ee2dd,_0x31fc9b){return function(_0xe6be9d){if(!_0xe6be9d){_0x2ee2dd[_0xbbc8('0x1b')](0x194);}return _0xe6be9d;};}function handleError(_0x1a0129,_0x15fd05){_0x15fd05=_0x15fd05||0x1f4;return function(_0x407acd){logger[_0xbbc8('0x29')](_0x407acd['stack']);if(_0x407acd[_0xbbc8('0x2a')]){delete _0x407acd[_0xbbc8('0x2a')];}_0x1a0129[_0xbbc8('0x1d')](_0x15fd05)['send'](_0x407acd);};}exports[_0xbbc8('0x2b')]=function(_0x239e64,_0x4b0e0c){var _0x130758={},_0x56ce6b={},_0x57cc7e={'count':0x0,'rows':[]};var _0x2939f8=_[_0xbbc8('0x2c')](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')],function(_0x24ec93){return{'name':_0x24ec93[_0xbbc8('0x2f')],'type':_0x24ec93['type']['key']};});_0x56ce6b[_0xbbc8('0x30')]=_[_0xbbc8('0x2c')](_0x2939f8,_0xbbc8('0x2a'));_0x56ce6b['query']=_[_0xbbc8('0x31')](_0x239e64[_0xbbc8('0x32')]);_0x56ce6b[_0xbbc8('0x33')]=_[_0xbbc8('0x34')](_0x56ce6b[_0xbbc8('0x30')],_0x56ce6b[_0xbbc8('0x32')]);_0x130758[_0xbbc8('0x35')]=_[_0xbbc8('0x34')](_0x56ce6b[_0xbbc8('0x30')],qs[_0xbbc8('0x36')](_0x239e64[_0xbbc8('0x32')]['fields']));_0x130758[_0xbbc8('0x35')]=_0x130758[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x130758[_0xbbc8('0x35')]:_0x56ce6b[_0xbbc8('0x30')];if(!_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x38')](_0xbbc8('0x39'))){_0x130758[_0xbbc8('0x21')]=qs[_0xbbc8('0x21')](_0x239e64['query'][_0xbbc8('0x21')]);_0x130758[_0xbbc8('0x1f')]=qs[_0xbbc8('0x1f')](_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x1f')]);}_0x130758[_0xbbc8('0x3a')]=qs['sort'](_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x3b')]);_0x130758[_0xbbc8('0x3c')]=qs[_0xbbc8('0x33')](_['pick'](_0x239e64[_0xbbc8('0x32')],_0x56ce6b[_0xbbc8('0x33')]),_0x2939f8);if(_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x3d')]){_0x130758[_0xbbc8('0x3c')]=_['merge'](_0x130758[_0xbbc8('0x3c')],{'$or':_[_0xbbc8('0x2c')](_0x2939f8,function(_0x2a2d68){if(_0x2a2d68[_0xbbc8('0x3e')]!=='VIRTUAL'){var _0x545bc3={};_0x545bc3[_0x2a2d68[_0xbbc8('0x2a')]]={'$like':'%'+_0x239e64['query'][_0xbbc8('0x3d')]+'%'};return _0x545bc3;}})});}_0x130758=_[_0xbbc8('0x3f')]({},_0x130758,_0x239e64[_0xbbc8('0x40')]);var _0x5ed5d2={'where':_0x130758[_0xbbc8('0x3c')]};return db['FreshdeskAccount']['count'](_0x5ed5d2)[_0xbbc8('0x27')](function(_0x37e803){_0x57cc7e['count']=_0x37e803;if(_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x41')]){_0x130758['include']=[{'all':!![]}];}return db[_0xbbc8('0x2d')][_0xbbc8('0x42')](_0x130758);})[_0xbbc8('0x27')](function(_0x52c836){_0x57cc7e[_0xbbc8('0x43')]=_0x52c836;return _0x57cc7e;})[_0xbbc8('0x27')](respondWithFilteredResult(_0x4b0e0c,_0x130758))[_0xbbc8('0x44')](handleError(_0x4b0e0c,null));};exports['show']=function(_0x3e7e54,_0x1dfbce){var _0x3dd5f6={'raw':![],'where':{'id':_0x3e7e54[_0xbbc8('0x45')]['id']}},_0x3d6405={};_0x3d6405[_0xbbc8('0x30')]=_['keys'](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')]);_0x3d6405['query']=_[_0xbbc8('0x31')](_0x3e7e54[_0xbbc8('0x32')]);_0x3d6405[_0xbbc8('0x33')]=_['intersection'](_0x3d6405[_0xbbc8('0x30')],_0x3d6405[_0xbbc8('0x32')]);_0x3dd5f6[_0xbbc8('0x35')]=_['intersection'](_0x3d6405[_0xbbc8('0x30')],qs['fields'](_0x3e7e54[_0xbbc8('0x32')][_0xbbc8('0x36')]));_0x3dd5f6[_0xbbc8('0x35')]=_0x3dd5f6['attributes'][_0xbbc8('0x37')]?_0x3dd5f6[_0xbbc8('0x35')]:_0x3d6405[_0xbbc8('0x30')];if(_0x3e7e54['query'][_0xbbc8('0x41')]){_0x3dd5f6[_0xbbc8('0x46')]=[{'all':!![]}];}_0x3dd5f6=_[_0xbbc8('0x3f')]({},_0x3dd5f6,_0x3e7e54[_0xbbc8('0x40')]);return db[_0xbbc8('0x2d')]['find'](_0x3dd5f6)[_0xbbc8('0x27')](handleEntityNotFound(_0x1dfbce,null))['then'](respondWithResult(_0x1dfbce,null))[_0xbbc8('0x44')](handleError(_0x1dfbce,null));};exports[_0xbbc8('0x47')]=function(_0x528b53,_0x4f3133){return db[_0xbbc8('0x2d')]['create'](_0x528b53[_0xbbc8('0x48')],{})[_0xbbc8('0x27')](respondWithResult(_0x4f3133,0xc9))[_0xbbc8('0x44')](handleError(_0x4f3133,null));};exports[_0xbbc8('0x26')]=function(_0x387dbf,_0x3d3a3a){if(_0x387dbf[_0xbbc8('0x48')]['id']){delete _0x387dbf['body']['id'];}return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0x387dbf['params']['id']}})['then'](handleEntityNotFound(_0x3d3a3a,null))[_0xbbc8('0x27')](saveUpdates(_0x387dbf['body'],null))[_0xbbc8('0x27')](respondWithResult(_0x3d3a3a,null))[_0xbbc8('0x44')](handleError(_0x3d3a3a,null));};exports[_0xbbc8('0x28')]=function(_0x45262e,_0x228502){return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0x45262e[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0x228502,null))[_0xbbc8('0x27')](removeEntity(_0x228502,null))[_0xbbc8('0x44')](handleError(_0x228502,null));};exports['getConfigurations']=function(_0x44510b,_0x46fa8d,_0x241b89){var _0x11414f={};var _0x40ac43={};var _0x219e4d;var _0x8fa10a;return db[_0xbbc8('0x2d')]['findOne']({'where':{'id':_0x44510b[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0x46fa8d,null))[_0xbbc8('0x27')](function(_0x2ebdf9){if(_0x2ebdf9){_0x219e4d=_0x2ebdf9;_0x40ac43[_0xbbc8('0x30')]=_['keys'](db[_0xbbc8('0x4a')]['rawAttributes']);_0x40ac43[_0xbbc8('0x32')]=_[_0xbbc8('0x31')](_0x44510b[_0xbbc8('0x32')]);_0x40ac43['filters']=_[_0xbbc8('0x34')](_0x40ac43['model'],_0x40ac43[_0xbbc8('0x32')]);_0x11414f['attributes']=_[_0xbbc8('0x34')](_0x40ac43[_0xbbc8('0x30')],qs[_0xbbc8('0x36')](_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x36')]));_0x11414f[_0xbbc8('0x35')]=_0x11414f[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x11414f[_0xbbc8('0x35')]:_0x40ac43[_0xbbc8('0x30')];_0x11414f['order']=qs[_0xbbc8('0x3b')](_0x44510b['query']['sort']);_0x11414f[_0xbbc8('0x3c')]=qs[_0xbbc8('0x33')](_[_0xbbc8('0x4b')](_0x44510b[_0xbbc8('0x32')],_0x40ac43[_0xbbc8('0x33')]));if(_0x44510b[_0xbbc8('0x32')]['filter']){_0x11414f[_0xbbc8('0x3c')]=_[_0xbbc8('0x3f')](_0x11414f['where'],{'$or':_[_0xbbc8('0x2c')](_0x11414f['attributes'],function(_0x45066b){var _0x20485c={};_0x20485c[_0x45066b]={'$like':'%'+_0x44510b[_0xbbc8('0x32')]['filter']+'%'};return _0x20485c;})});}_0x11414f=_['merge']({},_0x11414f,_0x44510b[_0xbbc8('0x40')]);return _0x219e4d[_0xbbc8('0x4c')](_0x11414f);}})[_0xbbc8('0x27')](function(_0x1419ba){if(_0x1419ba){_0x8fa10a=_0x1419ba[_0xbbc8('0x37')];if(!_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x38')]('nolimit')){_0x11414f[_0xbbc8('0x21')]=qs[_0xbbc8('0x21')](_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x21')]);_0x11414f['offset']=qs[_0xbbc8('0x1f')](_0x44510b['query']['offset']);}return _0x219e4d[_0xbbc8('0x4c')](_0x11414f);}})[_0xbbc8('0x27')](function(_0x107727){if(_0x107727){return _0x107727?{'count':_0x8fa10a,'rows':_0x107727}:null;}})[_0xbbc8('0x27')](respondWithResult(_0x46fa8d,null))[_0xbbc8('0x44')](handleError(_0x46fa8d,null));};exports['addConfiguration']=function(_0x113a4a,_0xd1b4af,_0x392184){if(_0x113a4a[_0xbbc8('0x48')]['id']){delete _0x113a4a['body']['id'];}return db[_0xbbc8('0x2d')][_0xbbc8('0x4d')]({'where':{'id':_0x113a4a[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0xd1b4af,null))[_0xbbc8('0x27')](function(_0xabda07){if(_0xabda07){_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x4e')]=_0xabda07['id'];_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x4f')]=integrations[_0xbbc8('0x50')](_0x113a4a[_0xbbc8('0x48')]['channel'],_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x3e')]);_0x113a4a['body']['Descriptions']=integrations[_0xbbc8('0x51')](_0x113a4a[_0xbbc8('0x48')]['channel'],_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x3e')]);return db[_0xbbc8('0x4a')][_0xbbc8('0x47')](_0x113a4a[_0xbbc8('0x48')],{'include':[{'model':db[_0xbbc8('0x52')],'as':_0xbbc8('0x4f')},{'model':db[_0xbbc8('0x52')],'as':_0xbbc8('0x53')}]});}return null;})[_0xbbc8('0x27')](respondWithResult(_0xd1b4af,null))['catch'](handleError(_0xd1b4af,null));};exports[_0xbbc8('0x54')]=function(_0x2a7747,_0x295393,_0x393039){var _0x3a2c0e='';return db[_0xbbc8('0x2d')][_0xbbc8('0x4d')]({'where':{'id':_0x2a7747['params']['id']},'attributes':['id',_0xbbc8('0x55'),_0xbbc8('0x56')]})['then'](handleEntityNotFound(_0x295393,null))[_0xbbc8('0x27')](function(_0x350007){if(_0x350007){_0x3a2c0e=_0x350007[_0xbbc8('0x55')];var _0x4184a0=_0x3a2c0e[_0xbbc8('0x57')](-0x1);if(_0x4184a0==='/'){_0x3a2c0e=_0x3a2c0e[_0xbbc8('0x58')](0x0,_0x3a2c0e[_0xbbc8('0x59')](_0x4184a0));}return rp({'method':_0xbbc8('0x5a'),'uri':util[_0xbbc8('0x5b')](_0xbbc8('0x5c'),_0x3a2c0e,_0xbbc8('0x5d')),'headers':{'Authorization':util[_0xbbc8('0x5b')](_0xbbc8('0x5e'),new Buffer(util[_0xbbc8('0x5b')](_0xbbc8('0x5f'),_0x350007['apiKey']))[_0xbbc8('0x60')](_0xbbc8('0x61')))},'json':!![]});}})[_0xbbc8('0x27')](function(_0x7e96db){if(_0x7e96db){var _0x42b954=[_0xbbc8('0x62'),_0xbbc8('0x63'),_0xbbc8('0x64'),'description',_0xbbc8('0x1d'),'priority','group','source','ticket_type',_0xbbc8('0x65'),'company'];_[_0xbbc8('0x66')](_0x7e96db,function(_0x35d6a6){return _0x42b954[_0xbbc8('0x67')](_0x35d6a6[_0xbbc8('0x2a')])||!_0x35d6a6['default']&&_0x35d6a6['type']!==_0xbbc8('0x68')&&_0x35d6a6[_0xbbc8('0x3e')]!==_0xbbc8('0x69');});return{'count':_0x7e96db[_0xbbc8('0x37')],'rows':_['map'](_0x7e96db,function(_0x596c70){return{'id':_0x596c70[_0xbbc8('0x2a')],'name':_0x596c70['label'],'custom':!_0x596c70[_0xbbc8('0x6a')],'options':_0x596c70[_0xbbc8('0x6b')]?_['map'](_0x596c70['choices'],function(_0x33ad43){return{'name':_[_0xbbc8('0x6c')](_0x33ad43),'value':_0x33ad43};}):[]};})};}})[_0xbbc8('0x27')](respondWithResult(_0x295393,null))[_0xbbc8('0x44')](function(_0x284d81){var _0x1014cc=_0x2a7747['query']['test']?0x1f4:_0x284d81[_0xbbc8('0x6d')]||0x1f4;logger[_0xbbc8('0x29')](_0xbbc8('0x6e'),'getFields',_0x1014cc,JSON[_0xbbc8('0x6f')](_0x284d81));delete _0x284d81[_0xbbc8('0x2a')];if(_0x1014cc===0x191){_0x1014cc=0x190;}_0x295393['status'](_0x1014cc)[_0xbbc8('0x70')](_0x2a7747[_0xbbc8('0x32')][_0xbbc8('0x71')]?{'message':_0xbbc8('0x72'),'statusCode':_0x284d81['statusCode']}:_0x284d81);});}; \ No newline at end of file +var _0x049e=['Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','agent','description','status','group','ticket_type','company','remove','includes','default','custom_text','label','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','undefined','limit','offset','set','Content-Range','reject','then','destroy','error','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','catch','params','keys','includeAll','create','body','update','find','getConfigurations','findOne','FreshdeskConfiguration','options','nolimit','addConfiguration','Subjects','getSubjects','channel'];(function(_0x3d2838,_0x1253ee){var _0x368687=function(_0x3671be){while(--_0x3671be){_0x3d2838['push'](_0x3d2838['shift']());}};_0x368687(++_0x1253ee);}(_0x049e,0x16a));var _0xe049=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0x049e[_0x215e65];return _0xa85842;};'use strict';var emlformat=require(_0xe049('0x0'));var rimraf=require(_0xe049('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe049('0x2'));var rp=require('request-promise');var moment=require(_0xe049('0x3'));var BPromise=require(_0xe049('0x4'));var Mustache=require(_0xe049('0x5'));var util=require(_0xe049('0x6'));var path=require(_0xe049('0x7'));var sox=require('sox');var csv=require(_0xe049('0x8'));var ejs=require(_0xe049('0x9'));var fs=require('fs');var fs_extra=require(_0xe049('0xa'));var _=require(_0xe049('0xb'));var squel=require(_0xe049('0xc'));var crypto=require(_0xe049('0xd'));var jsforce=require(_0xe049('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe049('0x8'));var querystring=require(_0xe049('0xf'));var Papa=require(_0xe049('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe049('0x11'));var as=require(_0xe049('0x12'));var hardwareService=require(_0xe049('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe049('0x14'));var licenseUtil=require(_0xe049('0x15'));var db=require(_0xe049('0x16'))['db'];var integrations=require(_0xe049('0x17'));function respondWithStatusCode(_0x301c7e,_0x1021e7){_0x1021e7=_0x1021e7||0xcc;return function(_0xdd1814){if(_0xdd1814){return _0x301c7e[_0xe049('0x18')](_0x1021e7);}return _0x301c7e['status'](_0x1021e7)[_0xe049('0x19')]();};}function respondWithResult(_0x3f4a57,_0x3924a4){_0x3924a4=_0x3924a4||0xc8;return function(_0x35fd0d){if(_0x35fd0d){return _0x3f4a57['status'](_0x3924a4)[_0xe049('0x1a')](_0x35fd0d);}};}function respondWithFilteredResult(_0xcc35b6,_0x5c90fd){return function(_0x388be0){if(_0x388be0){var _0x26b40c=typeof _0x5c90fd['offset']===_0xe049('0x1b')&&typeof _0x5c90fd[_0xe049('0x1c')]==='undefined';var _0x400a88=_0x388be0['count'];var _0x520dd9=_0x26b40c?0x0:_0x5c90fd[_0xe049('0x1d')];var _0x5e617b=_0x26b40c?_0x388be0['count']:_0x5c90fd[_0xe049('0x1d')]+_0x5c90fd[_0xe049('0x1c')];var _0x5ae414;if(_0x5e617b>=_0x400a88){_0x5e617b=_0x400a88;_0x5ae414=0xc8;}else{_0x5ae414=0xce;}_0xcc35b6['status'](_0x5ae414);return _0xcc35b6[_0xe049('0x1e')](_0xe049('0x1f'),_0x520dd9+'-'+_0x5e617b+'/'+_0x400a88)[_0xe049('0x1a')](_0x388be0);}return null;};}function patchUpdates(_0x430421){return function(_0x517aea){try{jsonpatch['apply'](_0x517aea,_0x430421,!![]);}catch(_0x11ceaa){return BPromise[_0xe049('0x20')](_0x11ceaa);}return _0x517aea['save']();};}function saveUpdates(_0x36a03b,_0x3f14eb){return function(_0x10cb90){if(_0x10cb90){return _0x10cb90['update'](_0x36a03b)[_0xe049('0x21')](function(_0x3b0f54){return _0x3b0f54;});}return null;};}function removeEntity(_0x4c7492,_0x4848c9){return function(_0x5663ec){if(_0x5663ec){return _0x5663ec[_0xe049('0x22')]()['then'](function(){_0x4c7492['status'](0xcc)[_0xe049('0x19')]();});}};}function handleEntityNotFound(_0x1efbbe,_0x53620b){return function(_0x1f5233){if(!_0x1f5233){_0x1efbbe[_0xe049('0x18')](0x194);}return _0x1f5233;};}function handleError(_0x3e5c7f,_0x423ba4){_0x423ba4=_0x423ba4||0x1f4;return function(_0x293dd2){logger[_0xe049('0x23')](_0x293dd2['stack']);if(_0x293dd2['name']){delete _0x293dd2[_0xe049('0x24')];}_0x3e5c7f['status'](_0x423ba4)[_0xe049('0x25')](_0x293dd2);};}exports['index']=function(_0x3c50c3,_0x2b79dc){var _0x5adcd6={},_0x432a6e={},_0x364630={'count':0x0,'rows':[]};var _0xb64700=_[_0xe049('0x26')](db[_0xe049('0x27')][_0xe049('0x28')],function(_0x123d2e){return{'name':_0x123d2e[_0xe049('0x29')],'type':_0x123d2e[_0xe049('0x2a')][_0xe049('0x2b')]};});_0x432a6e[_0xe049('0x2c')]=_['map'](_0xb64700,_0xe049('0x24'));_0x432a6e[_0xe049('0x2d')]=_['keys'](_0x3c50c3['query']);_0x432a6e['filters']=_['intersection'](_0x432a6e[_0xe049('0x2c')],_0x432a6e[_0xe049('0x2d')]);_0x5adcd6[_0xe049('0x2e')]=_[_0xe049('0x2f')](_0x432a6e[_0xe049('0x2c')],qs['fields'](_0x3c50c3[_0xe049('0x2d')][_0xe049('0x30')]));_0x5adcd6[_0xe049('0x2e')]=_0x5adcd6[_0xe049('0x2e')][_0xe049('0x31')]?_0x5adcd6['attributes']:_0x432a6e[_0xe049('0x2c')];if(!_0x3c50c3['query'][_0xe049('0x32')]('nolimit')){_0x5adcd6[_0xe049('0x1c')]=qs[_0xe049('0x1c')](_0x3c50c3[_0xe049('0x2d')][_0xe049('0x1c')]);_0x5adcd6[_0xe049('0x1d')]=qs[_0xe049('0x1d')](_0x3c50c3[_0xe049('0x2d')][_0xe049('0x1d')]);}_0x5adcd6[_0xe049('0x33')]=qs[_0xe049('0x34')](_0x3c50c3[_0xe049('0x2d')]['sort']);_0x5adcd6[_0xe049('0x35')]=qs[_0xe049('0x36')](_[_0xe049('0x37')](_0x3c50c3[_0xe049('0x2d')],_0x432a6e[_0xe049('0x36')]),_0xb64700);if(_0x3c50c3[_0xe049('0x2d')][_0xe049('0x38')]){_0x5adcd6[_0xe049('0x35')]=_['merge'](_0x5adcd6[_0xe049('0x35')],{'$or':_[_0xe049('0x26')](_0xb64700,function(_0x3ba5e5){if(_0x3ba5e5[_0xe049('0x2a')]!==_0xe049('0x39')){var _0xe17673={};_0xe17673[_0x3ba5e5[_0xe049('0x24')]]={'$like':'%'+_0x3c50c3[_0xe049('0x2d')][_0xe049('0x38')]+'%'};return _0xe17673;}})});}_0x5adcd6=_[_0xe049('0x3a')]({},_0x5adcd6,_0x3c50c3['options']);var _0x245f86={'where':_0x5adcd6[_0xe049('0x35')]};return db[_0xe049('0x27')]['count'](_0x245f86)[_0xe049('0x21')](function(_0x4fb4e1){_0x364630['count']=_0x4fb4e1;if(_0x3c50c3[_0xe049('0x2d')]['includeAll']){_0x5adcd6[_0xe049('0x3b')]=[{'all':!![]}];}return db[_0xe049('0x27')][_0xe049('0x3c')](_0x5adcd6);})[_0xe049('0x21')](function(_0xa6e336){_0x364630['rows']=_0xa6e336;return _0x364630;})[_0xe049('0x21')](respondWithFilteredResult(_0x2b79dc,_0x5adcd6))[_0xe049('0x3d')](handleError(_0x2b79dc,null));};exports['show']=function(_0x546137,_0x29915f){var _0x20d264={'raw':![],'where':{'id':_0x546137[_0xe049('0x3e')]['id']}},_0x482072={};_0x482072[_0xe049('0x2c')]=_[_0xe049('0x3f')](db['FreshdeskAccount'][_0xe049('0x28')]);_0x482072[_0xe049('0x2d')]=_['keys'](_0x546137[_0xe049('0x2d')]);_0x482072[_0xe049('0x36')]=_[_0xe049('0x2f')](_0x482072[_0xe049('0x2c')],_0x482072[_0xe049('0x2d')]);_0x20d264['attributes']=_['intersection'](_0x482072[_0xe049('0x2c')],qs[_0xe049('0x30')](_0x546137[_0xe049('0x2d')][_0xe049('0x30')]));_0x20d264[_0xe049('0x2e')]=_0x20d264[_0xe049('0x2e')]['length']?_0x20d264[_0xe049('0x2e')]:_0x482072[_0xe049('0x2c')];if(_0x546137['query'][_0xe049('0x40')]){_0x20d264['include']=[{'all':!![]}];}_0x20d264=_[_0xe049('0x3a')]({},_0x20d264,_0x546137['options']);return db[_0xe049('0x27')]['find'](_0x20d264)[_0xe049('0x21')](handleEntityNotFound(_0x29915f,null))[_0xe049('0x21')](respondWithResult(_0x29915f,null))[_0xe049('0x3d')](handleError(_0x29915f,null));};exports[_0xe049('0x41')]=function(_0x22eeb1,_0x4e9761){return db[_0xe049('0x27')][_0xe049('0x41')](_0x22eeb1[_0xe049('0x42')],{})[_0xe049('0x21')](respondWithResult(_0x4e9761,0xc9))[_0xe049('0x3d')](handleError(_0x4e9761,null));};exports[_0xe049('0x43')]=function(_0x12f9b8,_0x1b94b5){if(_0x12f9b8[_0xe049('0x42')]['id']){delete _0x12f9b8['body']['id'];}return db['FreshdeskAccount'][_0xe049('0x44')]({'where':{'id':_0x12f9b8[_0xe049('0x3e')]['id']}})[_0xe049('0x21')](handleEntityNotFound(_0x1b94b5,null))[_0xe049('0x21')](saveUpdates(_0x12f9b8[_0xe049('0x42')],null))[_0xe049('0x21')](respondWithResult(_0x1b94b5,null))[_0xe049('0x3d')](handleError(_0x1b94b5,null));};exports[_0xe049('0x22')]=function(_0x23692f,_0x23da27){return db[_0xe049('0x27')]['find']({'where':{'id':_0x23692f[_0xe049('0x3e')]['id']}})[_0xe049('0x21')](handleEntityNotFound(_0x23da27,null))[_0xe049('0x21')](removeEntity(_0x23da27,null))[_0xe049('0x3d')](handleError(_0x23da27,null));};exports[_0xe049('0x45')]=function(_0x3779c6,_0x373a49,_0x4e5293){var _0x4e34da={};var _0x57b3ff={};var _0x147d90;var _0x2e508e;return db['FreshdeskAccount'][_0xe049('0x46')]({'where':{'id':_0x3779c6[_0xe049('0x3e')]['id']}})[_0xe049('0x21')](handleEntityNotFound(_0x373a49,null))[_0xe049('0x21')](function(_0x4c3ba3){if(_0x4c3ba3){_0x147d90=_0x4c3ba3;_0x57b3ff['model']=_[_0xe049('0x3f')](db[_0xe049('0x47')]['rawAttributes']);_0x57b3ff['query']=_[_0xe049('0x3f')](_0x3779c6['query']);_0x57b3ff[_0xe049('0x36')]=_[_0xe049('0x2f')](_0x57b3ff['model'],_0x57b3ff[_0xe049('0x2d')]);_0x4e34da['attributes']=_[_0xe049('0x2f')](_0x57b3ff[_0xe049('0x2c')],qs['fields'](_0x3779c6[_0xe049('0x2d')][_0xe049('0x30')]));_0x4e34da[_0xe049('0x2e')]=_0x4e34da[_0xe049('0x2e')][_0xe049('0x31')]?_0x4e34da[_0xe049('0x2e')]:_0x57b3ff[_0xe049('0x2c')];_0x4e34da[_0xe049('0x33')]=qs[_0xe049('0x34')](_0x3779c6[_0xe049('0x2d')]['sort']);_0x4e34da[_0xe049('0x35')]=qs[_0xe049('0x36')](_[_0xe049('0x37')](_0x3779c6['query'],_0x57b3ff[_0xe049('0x36')]));if(_0x3779c6[_0xe049('0x2d')][_0xe049('0x38')]){_0x4e34da[_0xe049('0x35')]=_[_0xe049('0x3a')](_0x4e34da[_0xe049('0x35')],{'$or':_[_0xe049('0x26')](_0x4e34da['attributes'],function(_0x33f971){var _0x56e942={};_0x56e942[_0x33f971]={'$like':'%'+_0x3779c6[_0xe049('0x2d')]['filter']+'%'};return _0x56e942;})});}_0x4e34da=_[_0xe049('0x3a')]({},_0x4e34da,_0x3779c6[_0xe049('0x48')]);return _0x147d90[_0xe049('0x45')](_0x4e34da);}})[_0xe049('0x21')](function(_0x23db25){if(_0x23db25){_0x2e508e=_0x23db25['length'];if(!_0x3779c6[_0xe049('0x2d')][_0xe049('0x32')](_0xe049('0x49'))){_0x4e34da[_0xe049('0x1c')]=qs[_0xe049('0x1c')](_0x3779c6[_0xe049('0x2d')][_0xe049('0x1c')]);_0x4e34da[_0xe049('0x1d')]=qs['offset'](_0x3779c6['query'][_0xe049('0x1d')]);}return _0x147d90[_0xe049('0x45')](_0x4e34da);}})['then'](function(_0x2db0c1){if(_0x2db0c1){return _0x2db0c1?{'count':_0x2e508e,'rows':_0x2db0c1}:null;}})[_0xe049('0x21')](respondWithResult(_0x373a49,null))[_0xe049('0x3d')](handleError(_0x373a49,null));};exports[_0xe049('0x4a')]=function(_0x503f09,_0x485b0b,_0x191b60){if(_0x503f09['body']['id']){delete _0x503f09[_0xe049('0x42')]['id'];}return db[_0xe049('0x27')][_0xe049('0x46')]({'where':{'id':_0x503f09[_0xe049('0x3e')]['id']}})[_0xe049('0x21')](handleEntityNotFound(_0x485b0b,null))[_0xe049('0x21')](function(_0x3f514f){if(_0x3f514f){_0x503f09[_0xe049('0x42')]['AccountId']=_0x3f514f['id'];_0x503f09[_0xe049('0x42')][_0xe049('0x4b')]=integrations[_0xe049('0x4c')](_0x503f09[_0xe049('0x42')][_0xe049('0x4d')],_0x503f09['body'][_0xe049('0x2a')]);_0x503f09[_0xe049('0x42')][_0xe049('0x4e')]=integrations[_0xe049('0x4f')](_0x503f09['body']['channel'],_0x503f09[_0xe049('0x42')][_0xe049('0x2a')]);return db[_0xe049('0x47')][_0xe049('0x41')](_0x503f09[_0xe049('0x42')],{'include':[{'model':db[_0xe049('0x50')],'as':_0xe049('0x4b')},{'model':db[_0xe049('0x50')],'as':_0xe049('0x4e')}]});}return null;})[_0xe049('0x21')](respondWithResult(_0x485b0b,null))[_0xe049('0x3d')](handleError(_0x485b0b,null));};exports[_0xe049('0x51')]=function(_0x41ca25,_0x4025e9,_0x11f2c2){var _0x73c789='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x41ca25[_0xe049('0x3e')]['id']},'attributes':['id',_0xe049('0x52'),_0xe049('0x53')]})['then'](handleEntityNotFound(_0x4025e9,null))[_0xe049('0x21')](function(_0x432c16){if(_0x432c16){_0x73c789=_0x432c16['remoteUri'];var _0x475cd2=_0x73c789[_0xe049('0x54')](-0x1);if(_0x475cd2==='/'){_0x73c789=_0x73c789['substring'](0x0,_0x73c789[_0xe049('0x55')](_0x475cd2));}return rp({'method':_0xe049('0x56'),'uri':util[_0xe049('0x57')](_0xe049('0x58'),_0x73c789,_0xe049('0x59')),'headers':{'Authorization':util[_0xe049('0x57')](_0xe049('0x5a'),new Buffer(util[_0xe049('0x57')](_0xe049('0x5b'),_0x432c16[_0xe049('0x53')]))[_0xe049('0x5c')](_0xe049('0x5d')))},'json':!![]});}})[_0xe049('0x21')](function(_0x53c951){if(_0x53c951){var _0x2725cf=['requester','subject',_0xe049('0x5e'),_0xe049('0x5f'),_0xe049('0x60'),'priority',_0xe049('0x61'),'source',_0xe049('0x62'),'group',_0xe049('0x63')];_[_0xe049('0x64')](_0x53c951,function(_0xabc652){return _0x2725cf[_0xe049('0x65')](_0xabc652[_0xe049('0x24')])||!_0xabc652[_0xe049('0x66')]&&_0xabc652[_0xe049('0x2a')]!==_0xe049('0x67')&&_0xabc652['type']!=='custom_dropdown';});return{'count':_0x53c951[_0xe049('0x31')],'rows':_[_0xe049('0x26')](_0x53c951,function(_0x23d253){return{'id':_0x23d253[_0xe049('0x24')],'name':_0x23d253[_0xe049('0x68')],'custom':!_0x23d253[_0xe049('0x66')],'options':_0x23d253['choices']?_[_0xe049('0x26')](_0x23d253['choices'],function(_0x584d9d){return{'name':_[_0xe049('0x69')](_0x584d9d),'value':_0x584d9d};}):[]};})};}})[_0xe049('0x21')](respondWithResult(_0x4025e9,null))[_0xe049('0x3d')](function(_0x4cfe63){var _0x1ce42c=_0x41ca25['query']['test']?0x1f4:_0x4cfe63[_0xe049('0x6a')]||0x1f4;logger[_0xe049('0x23')](_0xe049('0x6b'),'getFields',_0x1ce42c,JSON['stringify'](_0x4cfe63));delete _0x4cfe63[_0xe049('0x24')];if(_0x1ce42c===0x191){_0x1ce42c=0x190;}_0x4025e9[_0xe049('0x60')](_0x1ce42c)['send'](_0x41ca25[_0xe049('0x2d')][_0xe049('0x6c')]?{'message':_0xe049('0x6d'),'statusCode':_0x4cfe63[_0xe049('0x6a')]}:_0x4cfe63);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 3ab8021..868d79c 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 _0x73ec=['path','../../config/environment','./intFreshdeskAccount.attributes','define','int_freshdesk_accounts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x73ec,0xf5));var _0xc73e=function(_0x1b2c7a,_0x224027){_0x1b2c7a=_0x1b2c7a-0x0;var _0x2d4873=_0x73ec[_0x1b2c7a];return _0x2d4873;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc73e('0x0'))(_0xc73e('0x1'));var moment=require(_0xc73e('0x2'));var BPromise=require(_0xc73e('0x3'));var rp=require(_0xc73e('0x4'));var fs=require('fs');var path=require(_0xc73e('0x5'));var rimraf=require('rimraf');var config=require(_0xc73e('0x6'));var attributes=require(_0xc73e('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5aecc7,_0x4f3b05){return _0x5aecc7[_0xc73e('0x8')]('FreshdeskAccount',attributes,{'tableName':_0xc73e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb26=['define','lodash','../../config/logger','api','moment','bluebird','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb26,0x151));var _0x6fb2=function(_0x3b1e6f,_0x17e752){_0x3b1e6f=_0x3b1e6f-0x0;var _0x5760a2=_0xfb26[_0x3b1e6f];return _0x5760a2;};'use strict';var _=require(_0x6fb2('0x0'));var util=require('util');var logger=require(_0x6fb2('0x1'))(_0x6fb2('0x2'));var moment=require(_0x6fb2('0x3'));var BPromise=require(_0x6fb2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6fb2('0x5'));var integrations=require(_0x6fb2('0x6'));module['exports']=function(_0x38a992,_0x1f87b3){return _0x38a992[_0x6fb2('0x7')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 61609d8..af89e05 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 _0xb05c=['stringify','error','code','message','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x114886,_0x3b1b95){var _0x57bd9b=function(_0x27715f){while(--_0x27715f){_0x114886['push'](_0x114886['shift']());}};_0x57bd9b(++_0x3b1b95);}(_0xb05c,0x1cc));var _0xcb05=function(_0x2a9ec5,_0xed23b){_0x2a9ec5=_0x2a9ec5-0x0;var _0x52c7c0=_0xb05c[_0x2a9ec5];return _0x52c7c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcb05('0x0'));var BPromise=require(_0xcb05('0x1'));var rs=require(_0xcb05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb05('0x4'))(_0xcb05('0x5'));var config=require(_0xcb05('0x6'));var jayson=require(_0xcb05('0x7'));var client=jayson[_0xcb05('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x579ade,_0x4c5fbf,_0xb4e403){return new BPromise(function(_0x72103d,_0x3b3e8f){return client[_0xcb05('0x9')](_0x579ade,_0xb4e403)[_0xcb05('0xa')](function(_0x3d806f){logger[_0xcb05('0xb')](_0xcb05('0xc'),_0x4c5fbf,_0xcb05('0xd'));logger[_0xcb05('0xe')](_0xcb05('0xf'),_0x4c5fbf,_0xcb05('0xd'),JSON[_0xcb05('0x10')](_0x3d806f));if(_0x3d806f['error']){if(_0x3d806f[_0xcb05('0x11')][_0xcb05('0x12')]===0x1f4){logger['error'](_0xcb05('0xc'),_0x4c5fbf,_0x3d806f['error'][_0xcb05('0x13')]);return _0x3b3e8f(_0x3d806f[_0xcb05('0x11')][_0xcb05('0x13')]);}logger[_0xcb05('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x4c5fbf,_0x3d806f['error'][_0xcb05('0x13')]);return _0x72103d(_0x3d806f[_0xcb05('0x11')][_0xcb05('0x13')]);}else{logger[_0xcb05('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x4c5fbf,_0xcb05('0xd'));_0x72103d(_0x3d806f['result'][_0xcb05('0x13')]);}})[_0xcb05('0x14')](function(_0x1b7b8f){logger[_0xcb05('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x4c5fbf,_0x1b7b8f);_0x3b3e8f(_0x1b7b8f);});});}exports['GetFreshdeskAccount']=function(_0x5e1049){var _0x48731a=this;return new Promise(function(_0x5348f6,_0x2c2ac0){return db[_0xcb05('0x15')][_0xcb05('0x16')]({'raw':_0x5e1049['options']?_0x5e1049[_0xcb05('0x17')][_0xcb05('0x18')]===undefined?!![]:![]:!![],'where':_0x5e1049[_0xcb05('0x17')]?_0x5e1049[_0xcb05('0x17')][_0xcb05('0x19')]||null:null,'attributes':_0x5e1049['options']?_0x5e1049['options'][_0xcb05('0x1a')]||null:null,'limit':_0x5e1049[_0xcb05('0x17')]?_0x5e1049[_0xcb05('0x17')][_0xcb05('0x1b')]||null:null,'include':_0x5e1049[_0xcb05('0x17')]?_0x5e1049[_0xcb05('0x17')][_0xcb05('0x1c')]?_[_0xcb05('0x1d')](_0x5e1049[_0xcb05('0x17')]['include'],function(_0x3d2313){return{'model':db[_0x3d2313[_0xcb05('0x1e')]],'as':_0x3d2313['as'],'attributes':_0x3d2313[_0xcb05('0x1a')],'include':_0x3d2313[_0xcb05('0x1c')]?_['map'](_0x3d2313['include'],function(_0x22eb3c){return{'model':db[_0x22eb3c['model']],'as':_0x22eb3c['as'],'attributes':_0x22eb3c['attributes'],'include':_0x22eb3c[_0xcb05('0x1c')]?_['map'](_0x22eb3c[_0xcb05('0x1c')],function(_0xcc6755){return{'model':db[_0xcc6755['model']],'as':_0xcc6755['as'],'attributes':_0xcc6755[_0xcb05('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcb05('0xa')](function(_0x536b3a){logger['info'](_0xcb05('0x1f'),_0x5e1049);logger[_0xcb05('0xe')]('GetFreshdeskAccount',_0x5e1049,JSON[_0xcb05('0x10')](_0x536b3a));_0x5348f6(_0x536b3a);})[_0xcb05('0x14')](function(_0x370495){logger['error'](_0xcb05('0x1f'),_0x370495[_0xcb05('0x13')],_0x5e1049);_0x2c2ac0(_0x48731a[_0xcb05('0x11')](0x1f4,_0x370495[_0xcb05('0x13')]));});});};exports[_0xcb05('0x20')]=function(_0x3fb1d7){var _0x3bea36=this;return new Promise(function(_0x2a31a0,_0xd42e48){return db['FreshdeskAccount'][_0xcb05('0x21')]({'raw':_0x3fb1d7['options']?_0x3fb1d7[_0xcb05('0x17')][_0xcb05('0x18')]===undefined?!![]:![]:!![],'where':_0x3fb1d7['options']?_0x3fb1d7[_0xcb05('0x17')][_0xcb05('0x19')]||null:null,'attributes':_0x3fb1d7[_0xcb05('0x17')]?_0x3fb1d7[_0xcb05('0x17')]['attributes']||null:null,'include':_0x3fb1d7[_0xcb05('0x17')]?_0x3fb1d7[_0xcb05('0x17')][_0xcb05('0x1c')]?_['map'](_0x3fb1d7[_0xcb05('0x17')]['include'],function(_0x4cfb06){return{'model':db[_0x4cfb06[_0xcb05('0x1e')]],'as':_0x4cfb06['as'],'attributes':_0x4cfb06['attributes'],'include':_0x4cfb06[_0xcb05('0x1c')]?_['map'](_0x4cfb06[_0xcb05('0x1c')],function(_0x2151c3){return{'model':db[_0x2151c3['model']],'as':_0x2151c3['as'],'attributes':_0x2151c3['attributes'],'include':_0x2151c3['include']?_[_0xcb05('0x1d')](_0x2151c3[_0xcb05('0x1c')],function(_0x37fcb9){return{'model':db[_0x37fcb9[_0xcb05('0x1e')]],'as':_0x37fcb9['as'],'attributes':_0x37fcb9['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb05('0xa')](function(_0x275ac2){logger['info'](_0xcb05('0x20'),_0x3fb1d7);logger['debug'](_0xcb05('0x20'),_0x3fb1d7,JSON[_0xcb05('0x10')](_0x275ac2));_0x2a31a0(_0x275ac2);})[_0xcb05('0x14')](function(_0x411a3c){logger[_0xcb05('0x11')]('ShowFreshdeskAccount',_0x411a3c['message'],_0x3fb1d7);_0xd42e48(_0x3bea36['error'](0x1f4,_0x411a3c[_0xcb05('0x13')]));});});}; \ No newline at end of file +var _0xbe22=['stringify','error','code','message','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowFreshdeskAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x292893,_0x3cd21e){var _0x5a55ac=function(_0x420f8d){while(--_0x420f8d){_0x292893['push'](_0x292893['shift']());}};_0x5a55ac(++_0x3cd21e);}(_0xbe22,0x1c1));var _0x2be2=function(_0x14650d,_0x2ccaa3){_0x14650d=_0x14650d-0x0;var _0x4eff3f=_0xbe22[_0x14650d];return _0x4eff3f;};'use strict';var _=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2be2('0x2'));var fs=require('fs');var Redis=require(_0x2be2('0x3'));var db=require(_0x2be2('0x4'))['db'];var utils=require(_0x2be2('0x5'));var logger=require(_0x2be2('0x6'))(_0x2be2('0x7'));var config=require(_0x2be2('0x8'));var jayson=require(_0x2be2('0x9'));var client=jayson[_0x2be2('0xa')][_0x2be2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59740c,_0x1fd9fc,_0x27e1a9){return new BPromise(function(_0x12d9b4,_0x4855fa){return client[_0x2be2('0xc')](_0x59740c,_0x27e1a9)[_0x2be2('0xd')](function(_0x1d20f1){logger[_0x2be2('0xe')](_0x2be2('0xf'),_0x1fd9fc,_0x2be2('0x10'));logger[_0x2be2('0x11')](_0x2be2('0x12'),_0x1fd9fc,'request\x20sent',JSON[_0x2be2('0x13')](_0x1d20f1));if(_0x1d20f1[_0x2be2('0x14')]){if(_0x1d20f1['error'][_0x2be2('0x15')]===0x1f4){logger[_0x2be2('0x14')](_0x2be2('0xf'),_0x1fd9fc,_0x1d20f1['error'][_0x2be2('0x16')]);return _0x4855fa(_0x1d20f1[_0x2be2('0x14')]['message']);}logger[_0x2be2('0x14')](_0x2be2('0xf'),_0x1fd9fc,_0x1d20f1[_0x2be2('0x14')]['message']);return _0x12d9b4(_0x1d20f1[_0x2be2('0x14')][_0x2be2('0x16')]);}else{logger['info'](_0x2be2('0xf'),_0x1fd9fc,_0x2be2('0x10'));_0x12d9b4(_0x1d20f1['result'][_0x2be2('0x16')]);}})['catch'](function(_0x435664){logger[_0x2be2('0x14')](_0x2be2('0xf'),_0x1fd9fc,_0x435664);_0x4855fa(_0x435664);});});}exports[_0x2be2('0x17')]=function(_0x20c5fa){var _0x387408=this;return new Promise(function(_0x504b07,_0x11ae5b){return db[_0x2be2('0x18')][_0x2be2('0x19')]({'raw':_0x20c5fa[_0x2be2('0x1a')]?_0x20c5fa['options'][_0x2be2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20c5fa['options']?_0x20c5fa[_0x2be2('0x1a')][_0x2be2('0x1c')]||null:null,'attributes':_0x20c5fa[_0x2be2('0x1a')]?_0x20c5fa[_0x2be2('0x1a')][_0x2be2('0x1d')]||null:null,'limit':_0x20c5fa['options']?_0x20c5fa['options']['limit']||null:null,'include':_0x20c5fa[_0x2be2('0x1a')]?_0x20c5fa[_0x2be2('0x1a')][_0x2be2('0x1e')]?_[_0x2be2('0x1f')](_0x20c5fa[_0x2be2('0x1a')][_0x2be2('0x1e')],function(_0x4d68ef){return{'model':db[_0x4d68ef[_0x2be2('0x20')]],'as':_0x4d68ef['as'],'attributes':_0x4d68ef['attributes'],'include':_0x4d68ef[_0x2be2('0x1e')]?_[_0x2be2('0x1f')](_0x4d68ef['include'],function(_0x36057c){return{'model':db[_0x36057c[_0x2be2('0x20')]],'as':_0x36057c['as'],'attributes':_0x36057c[_0x2be2('0x1d')],'include':_0x36057c['include']?_['map'](_0x36057c[_0x2be2('0x1e')],function(_0x47618d){return{'model':db[_0x47618d['model']],'as':_0x47618d['as'],'attributes':_0x47618d['attributes']};}):[]};}):[]};}):[]:[]})[_0x2be2('0xd')](function(_0x1e37ca){logger['info'](_0x2be2('0x17'),_0x20c5fa);logger[_0x2be2('0x11')](_0x2be2('0x17'),_0x20c5fa,JSON[_0x2be2('0x13')](_0x1e37ca));_0x504b07(_0x1e37ca);})[_0x2be2('0x21')](function(_0x156de8){logger[_0x2be2('0x14')](_0x2be2('0x17'),_0x156de8['message'],_0x20c5fa);_0x11ae5b(_0x387408[_0x2be2('0x14')](0x1f4,_0x156de8[_0x2be2('0x16')]));});});};exports[_0x2be2('0x22')]=function(_0x5b333b){var _0x373c37=this;return new Promise(function(_0x4fb592,_0x25c01c){return db[_0x2be2('0x18')][_0x2be2('0x23')]({'raw':_0x5b333b[_0x2be2('0x1a')]?_0x5b333b[_0x2be2('0x1a')][_0x2be2('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b333b[_0x2be2('0x1a')]?_0x5b333b[_0x2be2('0x1a')][_0x2be2('0x1c')]||null:null,'attributes':_0x5b333b[_0x2be2('0x1a')]?_0x5b333b['options'][_0x2be2('0x1d')]||null:null,'include':_0x5b333b[_0x2be2('0x1a')]?_0x5b333b['options'][_0x2be2('0x1e')]?_['map'](_0x5b333b[_0x2be2('0x1a')][_0x2be2('0x1e')],function(_0x11debc){return{'model':db[_0x11debc['model']],'as':_0x11debc['as'],'attributes':_0x11debc[_0x2be2('0x1d')],'include':_0x11debc[_0x2be2('0x1e')]?_[_0x2be2('0x1f')](_0x11debc['include'],function(_0x9f1d43){return{'model':db[_0x9f1d43[_0x2be2('0x20')]],'as':_0x9f1d43['as'],'attributes':_0x9f1d43[_0x2be2('0x1d')],'include':_0x9f1d43[_0x2be2('0x1e')]?_[_0x2be2('0x1f')](_0x9f1d43[_0x2be2('0x1e')],function(_0xf3c402){return{'model':db[_0xf3c402[_0x2be2('0x20')]],'as':_0xf3c402['as'],'attributes':_0xf3c402[_0x2be2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2be2('0xd')](function(_0x108199){logger[_0x2be2('0xe')]('ShowFreshdeskAccount',_0x5b333b);logger[_0x2be2('0x11')](_0x2be2('0x22'),_0x5b333b,JSON[_0x2be2('0x13')](_0x108199));_0x4fb592(_0x108199);})['catch'](function(_0x4baf9a){logger[_0x2be2('0x14')](_0x2be2('0x22'),_0x4baf9a[_0x2be2('0x16')],_0x5b333b);_0x25c01c(_0x373c37['error'](0x1f4,_0x4baf9a[_0x2be2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 533d115..af1a46d 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 _0x1cd2=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cd2,0x19f));var _0x21cd=function(_0x5210f9,_0x279eb8){_0x5210f9=_0x5210f9-0x0;var _0x5c9f67=_0x1cd2[_0x5210f9];return _0x5c9f67;};'use strict';var multer=require(_0x21cd('0x0'));var util=require(_0x21cd('0x1'));var path=require(_0x21cd('0x2'));var timeout=require(_0x21cd('0x3'));var express=require(_0x21cd('0x4'));var router=express[_0x21cd('0x5')]();var fs_extra=require(_0x21cd('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x21cd('0x7'));var controller=require(_0x21cd('0x8'));router[_0x21cd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x21cd('0x9')](_0x21cd('0xa'),auth['isAuthenticated'](),controller[_0x21cd('0xb')]);router[_0x21cd('0x9')](_0x21cd('0xc'),auth[_0x21cd('0xd')](),controller['getFields']);router[_0x21cd('0x9')](_0x21cd('0xe'),auth['isAuthenticated'](),controller[_0x21cd('0xf')]);router[_0x21cd('0x9')](_0x21cd('0x10'),auth['isAuthenticated'](),controller[_0x21cd('0x11')]);router[_0x21cd('0x9')]('/:id/tags',auth[_0x21cd('0xd')](),controller[_0x21cd('0x12')]);router[_0x21cd('0x13')]('/',auth[_0x21cd('0xd')](),controller['create']);router[_0x21cd('0x13')](_0x21cd('0x14'),auth[_0x21cd('0xd')](),controller['setTags']);router[_0x21cd('0x15')](_0x21cd('0xa'),auth[_0x21cd('0xd')](),controller[_0x21cd('0x16')]);router[_0x21cd('0x17')](_0x21cd('0xa'),auth['isAuthenticated'](),controller[_0x21cd('0x18')]);module[_0x21cd('0x19')]=router; \ No newline at end of file +var _0x8e11=['delete','exports','multer','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put'];(function(_0x5a53da,_0x235474){var _0x4e8c6d=function(_0x3bbeea){while(--_0x3bbeea){_0x5a53da['push'](_0x5a53da['shift']());}};_0x4e8c6d(++_0x235474);}(_0x8e11,0xfe));var _0x18e1=function(_0x2e3f96,_0x48c3c4){_0x2e3f96=_0x2e3f96-0x0;var _0x242631=_0x8e11[_0x2e3f96];return _0x242631;};'use strict';var multer=require(_0x18e1('0x0'));var util=require(_0x18e1('0x1'));var path=require('path');var timeout=require(_0x18e1('0x2'));var express=require(_0x18e1('0x3'));var router=express[_0x18e1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x18e1('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x18e1('0x6')]('/',auth[_0x18e1('0x7')](),controller[_0x18e1('0x8')]);router[_0x18e1('0x6')](_0x18e1('0x9'),auth[_0x18e1('0x7')](),controller[_0x18e1('0xa')]);router['get']('/:id/fields',auth[_0x18e1('0x7')](),controller['getFields']);router['get'](_0x18e1('0xb'),auth[_0x18e1('0x7')](),controller[_0x18e1('0xc')]);router[_0x18e1('0x6')](_0x18e1('0xd'),auth['isAuthenticated'](),controller[_0x18e1('0xe')]);router[_0x18e1('0x6')](_0x18e1('0xf'),auth[_0x18e1('0x7')](),controller['getTags']);router[_0x18e1('0x10')]('/',auth[_0x18e1('0x7')](),controller[_0x18e1('0x11')]);router[_0x18e1('0x10')](_0x18e1('0xf'),auth[_0x18e1('0x7')](),controller['setTags']);router[_0x18e1('0x12')](_0x18e1('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x18e1('0x13')](_0x18e1('0x9'),auth[_0x18e1('0x7')](),controller['destroy']);module[_0x18e1('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 b11a181..ecb19fc 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 _0x559b=['sequelize','exports','STRING'];(function(_0x34c0bf,_0x3b8460){var _0x315559=function(_0x42f409){while(--_0x42f409){_0x34c0bf['push'](_0x34c0bf['shift']());}};_0x315559(++_0x3b8460);}(_0x559b,0x8a));var _0xb559=function(_0x3ff92a,_0x486eaf){_0x3ff92a=_0x3ff92a-0x0;var _0x2ad80f=_0x559b[_0x3ff92a];return _0x2ad80f;};'use strict';var Sequelize=require(_0xb559('0x0'));module[_0xb559('0x1')]={'name':{'type':Sequelize[_0xb559('0x2')]},'description':{'type':Sequelize[_0xb559('0x2')]}}; \ No newline at end of file +var _0xc1d8=['exports','STRING','sequelize'];(function(_0x14f53d,_0xd6db59){var _0x3cea5b=function(_0x55e12d){while(--_0x55e12d){_0x14f53d['push'](_0x14f53d['shift']());}};_0x3cea5b(++_0xd6db59);}(_0xc1d8,0xbf));var _0x8c1d=function(_0x4e280c,_0x2503c0){_0x4e280c=_0x4e280c-0x0;var _0x40ed1c=_0xc1d8[_0x4e280c];return _0x40ed1c;};'use strict';var Sequelize=require(_0x8c1d('0x0'));module[_0x8c1d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c1d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 472a34b..e97e21c 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 _0x8050=['filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','update','findOne','getFields','hasOwnProperty','getSubjects','getDescriptions','FreshdeskField','getTags','ids','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','then','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys'];(function(_0x1beab5,_0x575a40){var _0x4b1093=function(_0x1b7c87){while(--_0x1b7c87){_0x1beab5['push'](_0x1beab5['shift']());}};_0x4b1093(++_0x575a40);}(_0x8050,0xbd));var _0x0805=function(_0x10cee2,_0x34ae8a){_0x10cee2=_0x10cee2-0x0;var _0x54ace4=_0x8050[_0x10cee2];return _0x54ace4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0805('0x0'));var zipdir=require(_0x0805('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0805('0x2'));var moment=require(_0x0805('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0805('0x4'));var util=require(_0x0805('0x5'));var path=require(_0x0805('0x6'));var sox=require('sox');var csv=require(_0x0805('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0805('0x8'));var _=require(_0x0805('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0805('0xa'));var toCsv=require(_0x0805('0x7'));var querystring=require('querystring');var Papa=require(_0x0805('0xb'));var Redis=require(_0x0805('0xc'));var authService=require(_0x0805('0xd'));var qs=require(_0x0805('0xe'));var as=require(_0x0805('0xf'));var hardwareService=require(_0x0805('0x10'));var logger=require(_0x0805('0x11'))(_0x0805('0x12'));var utils=require('../../config/utils');var config=require(_0x0805('0x13'));var licenseUtil=require(_0x0805('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ec15e,_0x4ab677){_0x4ab677=_0x4ab677||0xcc;return function(_0x5cf5d5){if(_0x5cf5d5){return _0x2ec15e[_0x0805('0x15')](_0x4ab677);}return _0x2ec15e[_0x0805('0x16')](_0x4ab677)[_0x0805('0x17')]();};}function respondWithResult(_0x5bbc3e,_0x5c1023){_0x5c1023=_0x5c1023||0xc8;return function(_0x56c80b){if(_0x56c80b){return _0x5bbc3e['status'](_0x5c1023)[_0x0805('0x18')](_0x56c80b);}};}function respondWithFilteredResult(_0x528e6a,_0x405bf6){return function(_0x425851){if(_0x425851){var _0x114d31=typeof _0x405bf6['offset']==='undefined'&&typeof _0x405bf6[_0x0805('0x19')]===_0x0805('0x1a');var _0x1d3549=_0x425851[_0x0805('0x1b')];var _0x4f6ab0=_0x114d31?0x0:_0x405bf6[_0x0805('0x1c')];var _0xfd3c03=_0x114d31?_0x425851[_0x0805('0x1b')]:_0x405bf6[_0x0805('0x1c')]+_0x405bf6[_0x0805('0x19')];var _0x111dc5;if(_0xfd3c03>=_0x1d3549){_0xfd3c03=_0x1d3549;_0x111dc5=0xc8;}else{_0x111dc5=0xce;}_0x528e6a['status'](_0x111dc5);return _0x528e6a[_0x0805('0x1d')](_0x0805('0x1e'),_0x4f6ab0+'-'+_0xfd3c03+'/'+_0x1d3549)['json'](_0x425851);}return null;};}function patchUpdates(_0x4698d0){return function(_0x409729){try{jsonpatch[_0x0805('0x1f')](_0x409729,_0x4698d0,!![]);}catch(_0x58f430){return BPromise[_0x0805('0x20')](_0x58f430);}return _0x409729[_0x0805('0x21')]();};}function saveUpdates(_0x3e8054,_0x5d0d90){return function(_0x485612){if(_0x485612){return _0x485612['update'](_0x3e8054)['then'](function(_0x5d4db5){return _0x5d4db5;});}return null;};}function removeEntity(_0x17e439,_0x59a9ec){return function(_0x42865c){if(_0x42865c){return _0x42865c[_0x0805('0x22')]()[_0x0805('0x23')](function(){_0x17e439[_0x0805('0x16')](0xcc)[_0x0805('0x17')]();});}};}function handleEntityNotFound(_0x5a6762,_0x21f6c3){return function(_0x278baf){if(!_0x278baf){_0x5a6762[_0x0805('0x15')](0x194);}return _0x278baf;};}function handleError(_0x42d872,_0x3768bd){_0x3768bd=_0x3768bd||0x1f4;return function(_0x2e4a5b){logger['error'](_0x2e4a5b['stack']);if(_0x2e4a5b['name']){delete _0x2e4a5b['name'];}_0x42d872['status'](_0x3768bd)[_0x0805('0x24')](_0x2e4a5b);};}exports[_0x0805('0x25')]=function(_0x40b3f5,_0x1354c6){var _0x35b61d={},_0x3e0da6={},_0x3a8a33={'count':0x0,'rows':[]};var _0x4cf02e=_[_0x0805('0x26')](db[_0x0805('0x27')][_0x0805('0x28')],function(_0x409de6){return{'name':_0x409de6[_0x0805('0x29')],'type':_0x409de6[_0x0805('0x2a')][_0x0805('0x2b')]};});_0x3e0da6[_0x0805('0x2c')]=_[_0x0805('0x26')](_0x4cf02e,_0x0805('0x2d'));_0x3e0da6[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x40b3f5['query']);_0x3e0da6[_0x0805('0x30')]=_[_0x0805('0x31')](_0x3e0da6[_0x0805('0x2c')],_0x3e0da6[_0x0805('0x2e')]);_0x35b61d[_0x0805('0x32')]=_[_0x0805('0x31')](_0x3e0da6['model'],qs[_0x0805('0x33')](_0x40b3f5['query']['fields']));_0x35b61d[_0x0805('0x32')]=_0x35b61d[_0x0805('0x32')][_0x0805('0x34')]?_0x35b61d[_0x0805('0x32')]:_0x3e0da6[_0x0805('0x2c')];if(!_0x40b3f5[_0x0805('0x2e')]['hasOwnProperty'](_0x0805('0x35'))){_0x35b61d[_0x0805('0x19')]=qs[_0x0805('0x19')](_0x40b3f5['query'][_0x0805('0x19')]);_0x35b61d[_0x0805('0x1c')]=qs['offset'](_0x40b3f5[_0x0805('0x2e')]['offset']);}_0x35b61d[_0x0805('0x36')]=qs['sort'](_0x40b3f5[_0x0805('0x2e')][_0x0805('0x37')]);_0x35b61d['where']=qs[_0x0805('0x30')](_[_0x0805('0x38')](_0x40b3f5['query'],_0x3e0da6[_0x0805('0x30')]),_0x4cf02e);if(_0x40b3f5[_0x0805('0x2e')][_0x0805('0x39')]){_0x35b61d[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x35b61d[_0x0805('0x3a')],{'$or':_[_0x0805('0x26')](_0x4cf02e,function(_0x297baf){if(_0x297baf[_0x0805('0x2a')]!==_0x0805('0x3c')){var _0x5767f4={};_0x5767f4[_0x297baf[_0x0805('0x2d')]]={'$like':'%'+_0x40b3f5['query'][_0x0805('0x39')]+'%'};return _0x5767f4;}})});}_0x35b61d=_[_0x0805('0x3b')]({},_0x35b61d,_0x40b3f5[_0x0805('0x3d')]);var _0x2cc2e4={'where':_0x35b61d[_0x0805('0x3a')]};return db[_0x0805('0x27')][_0x0805('0x1b')](_0x2cc2e4)[_0x0805('0x23')](function(_0xa603a4){_0x3a8a33[_0x0805('0x1b')]=_0xa603a4;if(_0x40b3f5[_0x0805('0x2e')][_0x0805('0x3e')]){_0x35b61d['include']=[{'all':!![]}];}return db[_0x0805('0x27')]['findAll'](_0x35b61d);})[_0x0805('0x23')](function(_0x4b49ea){_0x3a8a33[_0x0805('0x3f')]=_0x4b49ea;return _0x3a8a33;})['then'](respondWithFilteredResult(_0x1354c6,_0x35b61d))[_0x0805('0x40')](handleError(_0x1354c6,null));};exports['show']=function(_0x4d3988,_0x46abbb){var _0x555d92={'raw':![],'where':{'id':_0x4d3988[_0x0805('0x41')]['id']}},_0x20c852={};_0x20c852['model']=_[_0x0805('0x2f')](db[_0x0805('0x27')][_0x0805('0x28')]);_0x20c852[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x4d3988[_0x0805('0x2e')]);_0x20c852[_0x0805('0x30')]=_['intersection'](_0x20c852[_0x0805('0x2c')],_0x20c852[_0x0805('0x2e')]);_0x555d92[_0x0805('0x32')]=_[_0x0805('0x31')](_0x20c852[_0x0805('0x2c')],qs[_0x0805('0x33')](_0x4d3988[_0x0805('0x2e')][_0x0805('0x33')]));_0x555d92[_0x0805('0x32')]=_0x555d92[_0x0805('0x32')]['length']?_0x555d92[_0x0805('0x32')]:_0x20c852[_0x0805('0x2c')];if(_0x4d3988[_0x0805('0x2e')][_0x0805('0x3e')]){_0x555d92[_0x0805('0x42')]=[{'all':!![]}];}_0x555d92=_[_0x0805('0x3b')]({},_0x555d92,_0x4d3988['options']);return db[_0x0805('0x27')][_0x0805('0x43')](_0x555d92)['then'](handleEntityNotFound(_0x46abbb,null))[_0x0805('0x23')](respondWithResult(_0x46abbb,null))[_0x0805('0x40')](handleError(_0x46abbb,null));};exports[_0x0805('0x44')]=function(_0x96d3,_0x48ecfb){return db['FreshdeskConfiguration'][_0x0805('0x44')](_0x96d3[_0x0805('0x45')],{})[_0x0805('0x23')](respondWithResult(_0x48ecfb,0xc9))[_0x0805('0x40')](handleError(_0x48ecfb,null));};exports[_0x0805('0x46')]=function(_0xd2871b,_0x3df003){if(_0xd2871b[_0x0805('0x45')]['id']){delete _0xd2871b[_0x0805('0x45')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0xd2871b[_0x0805('0x41')]['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x3df003,null))[_0x0805('0x23')](saveUpdates(_0xd2871b[_0x0805('0x45')],null))[_0x0805('0x23')](respondWithResult(_0x3df003,null))[_0x0805('0x40')](handleError(_0x3df003,null));};exports[_0x0805('0x22')]=function(_0x1e8840,_0x2a6b09){return db['FreshdeskConfiguration'][_0x0805('0x43')]({'where':{'id':_0x1e8840['params']['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x2a6b09,null))[_0x0805('0x23')](removeEntity(_0x2a6b09,null))[_0x0805('0x40')](handleError(_0x2a6b09,null));};exports['getFields']=function(_0x5c5441,_0x5b5859,_0x2fbceb){var _0x2fea2a={};var _0x470b76={};var _0x382a17;var _0x4472b7;return db['FreshdeskConfiguration'][_0x0805('0x47')]({'where':{'id':_0x5c5441['params']['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x5b5859,null))[_0x0805('0x23')](function(_0x454fc7){if(_0x454fc7){_0x382a17=_0x454fc7;_0x470b76[_0x0805('0x2c')]=_[_0x0805('0x2f')](db['FreshdeskField'][_0x0805('0x28')]);_0x470b76[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x5c5441[_0x0805('0x2e')]);_0x470b76[_0x0805('0x30')]=_[_0x0805('0x31')](_0x470b76[_0x0805('0x2c')],_0x470b76['query']);_0x2fea2a[_0x0805('0x32')]=_[_0x0805('0x31')](_0x470b76[_0x0805('0x2c')],qs[_0x0805('0x33')](_0x5c5441[_0x0805('0x2e')]['fields']));_0x2fea2a[_0x0805('0x32')]=_0x2fea2a['attributes'][_0x0805('0x34')]?_0x2fea2a[_0x0805('0x32')]:_0x470b76[_0x0805('0x2c')];_0x2fea2a[_0x0805('0x36')]=qs[_0x0805('0x37')](_0x5c5441[_0x0805('0x2e')][_0x0805('0x37')]);_0x2fea2a[_0x0805('0x3a')]=qs[_0x0805('0x30')](_[_0x0805('0x38')](_0x5c5441['query'],_0x470b76[_0x0805('0x30')]));if(_0x5c5441[_0x0805('0x2e')][_0x0805('0x39')]){_0x2fea2a[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x2fea2a[_0x0805('0x3a')],{'$or':_[_0x0805('0x26')](_0x2fea2a['attributes'],function(_0x35f324){var _0x4c40f2={};_0x4c40f2[_0x35f324]={'$like':'%'+_0x5c5441[_0x0805('0x2e')][_0x0805('0x39')]+'%'};return _0x4c40f2;})});}_0x2fea2a=_[_0x0805('0x3b')]({},_0x2fea2a,_0x5c5441[_0x0805('0x3d')]);return _0x382a17[_0x0805('0x48')](_0x2fea2a);}})[_0x0805('0x23')](function(_0x42017b){if(_0x42017b){_0x4472b7=_0x42017b[_0x0805('0x34')];if(!_0x5c5441[_0x0805('0x2e')][_0x0805('0x49')]('nolimit')){_0x2fea2a[_0x0805('0x19')]=qs['limit'](_0x5c5441['query']['limit']);_0x2fea2a[_0x0805('0x1c')]=qs[_0x0805('0x1c')](_0x5c5441[_0x0805('0x2e')]['offset']);}return _0x382a17[_0x0805('0x48')](_0x2fea2a);}})[_0x0805('0x23')](function(_0x3577cf){if(_0x3577cf){return _0x3577cf?{'count':_0x4472b7,'rows':_0x3577cf}:null;}})[_0x0805('0x23')](respondWithResult(_0x5b5859,null))[_0x0805('0x40')](handleError(_0x5b5859,null));};exports[_0x0805('0x4a')]=function(_0x343ecf,_0xd3c4a2,_0x54e9ba){var _0x12914f={};var _0x1a9fd7={};var _0x4237bc;var _0x1a69f3;return db[_0x0805('0x27')][_0x0805('0x47')]({'where':{'id':_0x343ecf[_0x0805('0x41')]['id']}})[_0x0805('0x23')](handleEntityNotFound(_0xd3c4a2,null))['then'](function(_0x278f4f){if(_0x278f4f){_0x4237bc=_0x278f4f;_0x1a9fd7[_0x0805('0x2c')]=_['keys'](db['FreshdeskField'][_0x0805('0x28')]);_0x1a9fd7[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x343ecf['query']);_0x1a9fd7[_0x0805('0x30')]=_[_0x0805('0x31')](_0x1a9fd7[_0x0805('0x2c')],_0x1a9fd7[_0x0805('0x2e')]);_0x12914f[_0x0805('0x32')]=_[_0x0805('0x31')](_0x1a9fd7[_0x0805('0x2c')],qs['fields'](_0x343ecf[_0x0805('0x2e')][_0x0805('0x33')]));_0x12914f[_0x0805('0x32')]=_0x12914f[_0x0805('0x32')][_0x0805('0x34')]?_0x12914f[_0x0805('0x32')]:_0x1a9fd7[_0x0805('0x2c')];_0x12914f[_0x0805('0x36')]=qs['sort'](_0x343ecf[_0x0805('0x2e')]['sort']);_0x12914f[_0x0805('0x3a')]=qs['filters'](_[_0x0805('0x38')](_0x343ecf['query'],_0x1a9fd7[_0x0805('0x30')]));if(_0x343ecf[_0x0805('0x2e')]['filter']){_0x12914f[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x12914f[_0x0805('0x3a')],{'$or':_[_0x0805('0x26')](_0x12914f['attributes'],function(_0x5c52d6){var _0x5b27e3={};_0x5b27e3[_0x5c52d6]={'$like':'%'+_0x343ecf[_0x0805('0x2e')][_0x0805('0x39')]+'%'};return _0x5b27e3;})});}_0x12914f=_['merge']({},_0x12914f,_0x343ecf[_0x0805('0x3d')]);return _0x4237bc[_0x0805('0x4a')](_0x12914f);}})['then'](function(_0x164995){if(_0x164995){_0x1a69f3=_0x164995[_0x0805('0x34')];if(!_0x343ecf[_0x0805('0x2e')][_0x0805('0x49')](_0x0805('0x35'))){_0x12914f[_0x0805('0x19')]=qs[_0x0805('0x19')](_0x343ecf[_0x0805('0x2e')]['limit']);_0x12914f[_0x0805('0x1c')]=qs['offset'](_0x343ecf[_0x0805('0x2e')][_0x0805('0x1c')]);}return _0x4237bc[_0x0805('0x4a')](_0x12914f);}})[_0x0805('0x23')](function(_0x2ee166){if(_0x2ee166){return _0x2ee166?{'count':_0x1a69f3,'rows':_0x2ee166}:null;}})[_0x0805('0x23')](respondWithResult(_0xd3c4a2,null))[_0x0805('0x40')](handleError(_0xd3c4a2,null));};exports[_0x0805('0x4b')]=function(_0x5b2e5f,_0x2bc903,_0x2e2f00){var _0x68da45={};var _0x1ebcf6={};var _0x3d89e5;var _0x3d1c43;return db[_0x0805('0x27')]['findOne']({'where':{'id':_0x5b2e5f[_0x0805('0x41')]['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x2bc903,null))[_0x0805('0x23')](function(_0x43cdb1){if(_0x43cdb1){_0x3d89e5=_0x43cdb1;_0x1ebcf6[_0x0805('0x2c')]=_[_0x0805('0x2f')](db[_0x0805('0x4c')][_0x0805('0x28')]);_0x1ebcf6[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x5b2e5f[_0x0805('0x2e')]);_0x1ebcf6[_0x0805('0x30')]=_[_0x0805('0x31')](_0x1ebcf6['model'],_0x1ebcf6[_0x0805('0x2e')]);_0x68da45[_0x0805('0x32')]=_[_0x0805('0x31')](_0x1ebcf6[_0x0805('0x2c')],qs['fields'](_0x5b2e5f[_0x0805('0x2e')]['fields']));_0x68da45[_0x0805('0x32')]=_0x68da45[_0x0805('0x32')][_0x0805('0x34')]?_0x68da45[_0x0805('0x32')]:_0x1ebcf6[_0x0805('0x2c')];_0x68da45[_0x0805('0x36')]=qs['sort'](_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x37')]);_0x68da45[_0x0805('0x3a')]=qs[_0x0805('0x30')](_[_0x0805('0x38')](_0x5b2e5f['query'],_0x1ebcf6[_0x0805('0x30')]));if(_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x39')]){_0x68da45[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x68da45['where'],{'$or':_[_0x0805('0x26')](_0x68da45[_0x0805('0x32')],function(_0x199bcf){var _0x5356ce={};_0x5356ce[_0x199bcf]={'$like':'%'+_0x5b2e5f['query'][_0x0805('0x39')]+'%'};return _0x5356ce;})});}_0x68da45=_[_0x0805('0x3b')]({},_0x68da45,_0x5b2e5f['options']);return _0x3d89e5[_0x0805('0x4b')](_0x68da45);}})[_0x0805('0x23')](function(_0x1e3393){if(_0x1e3393){_0x3d1c43=_0x1e3393[_0x0805('0x34')];if(!_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x49')](_0x0805('0x35'))){_0x68da45[_0x0805('0x19')]=qs['limit'](_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x19')]);_0x68da45[_0x0805('0x1c')]=qs[_0x0805('0x1c')](_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x1c')]);}return _0x3d89e5[_0x0805('0x4b')](_0x68da45);}})[_0x0805('0x23')](function(_0x3b44a4){if(_0x3b44a4){return _0x3b44a4?{'count':_0x3d1c43,'rows':_0x3b44a4}:null;}})[_0x0805('0x23')](respondWithResult(_0x2bc903,null))[_0x0805('0x40')](handleError(_0x2bc903,null));};exports[_0x0805('0x4d')]=function(_0x39fc55,_0x2c4ec0,_0x38c67a){var _0x172aaa={};var _0x5429ed={};var _0x1204b1;var _0x320182;return db['FreshdeskConfiguration'][_0x0805('0x47')]({'where':{'id':_0x39fc55['params']['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x2c4ec0,null))[_0x0805('0x23')](function(_0x27e256){if(_0x27e256){_0x1204b1=_0x27e256;_0x5429ed[_0x0805('0x2c')]=_['keys'](db['Tag']['rawAttributes']);_0x5429ed[_0x0805('0x2e')]=_['keys'](_0x39fc55[_0x0805('0x2e')]);_0x5429ed[_0x0805('0x30')]=_[_0x0805('0x31')](_0x5429ed[_0x0805('0x2c')],_0x5429ed[_0x0805('0x2e')]);_0x172aaa[_0x0805('0x32')]=_[_0x0805('0x31')](_0x5429ed['model'],qs[_0x0805('0x33')](_0x39fc55[_0x0805('0x2e')][_0x0805('0x33')]));_0x172aaa[_0x0805('0x32')]=_0x172aaa[_0x0805('0x32')][_0x0805('0x34')]?_0x172aaa['attributes']:_0x5429ed[_0x0805('0x2c')];_0x172aaa['order']=qs['sort'](_0x39fc55[_0x0805('0x2e')][_0x0805('0x37')]);_0x172aaa['where']=qs[_0x0805('0x30')](_[_0x0805('0x38')](_0x39fc55[_0x0805('0x2e')],_0x5429ed['filters']));if(_0x39fc55[_0x0805('0x2e')]['filter']){_0x172aaa[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x172aaa['where'],{'$or':_[_0x0805('0x26')](_0x172aaa[_0x0805('0x32')],function(_0x1ede38){var _0x3d2723={};_0x3d2723[_0x1ede38]={'$like':'%'+_0x39fc55[_0x0805('0x2e')][_0x0805('0x39')]+'%'};return _0x3d2723;})});}_0x172aaa=_[_0x0805('0x3b')]({},_0x172aaa,_0x39fc55[_0x0805('0x3d')]);return _0x1204b1['getTags'](_0x172aaa);}})['then'](function(_0x4d5ccf){if(_0x4d5ccf){_0x320182=_0x4d5ccf[_0x0805('0x34')];if(!_0x39fc55['query'][_0x0805('0x49')](_0x0805('0x35'))){_0x172aaa[_0x0805('0x19')]=qs['limit'](_0x39fc55[_0x0805('0x2e')][_0x0805('0x19')]);_0x172aaa['offset']=qs[_0x0805('0x1c')](_0x39fc55[_0x0805('0x2e')][_0x0805('0x1c')]);}return _0x1204b1[_0x0805('0x4d')](_0x172aaa);}})[_0x0805('0x23')](function(_0x45ff8c){if(_0x45ff8c){return _0x45ff8c?{'count':_0x320182,'rows':_0x45ff8c}:null;}})[_0x0805('0x23')](respondWithResult(_0x2c4ec0,null))[_0x0805('0x40')](handleError(_0x2c4ec0,null));};exports['setTags']=function(_0x45acf3,_0x2acde1,_0x3e23e7){if(_0x45acf3['body']['id']){delete _0x45acf3[_0x0805('0x45')]['id'];}return db[_0x0805('0x27')]['findOne']({'where':{'id':_0x45acf3[_0x0805('0x41')]['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x2acde1,null))['then'](function(_0x431261){if(_0x431261){return _0x431261['setTags'](_0x45acf3[_0x0805('0x45')][_0x0805('0x4e')]||[]);}return null;})['then'](respondWithResult(_0x2acde1,null))[_0x0805('0x40')](handleError(_0x2acde1,null));}; \ No newline at end of file +var _0x86b4=['getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body'];(function(_0x334c58,_0x363d7e){var _0x16fe10=function(_0x551256){while(--_0x551256){_0x334c58['push'](_0x334c58['shift']());}};_0x16fe10(++_0x363d7e);}(_0x86b4,0x1cc));var _0x486b=function(_0x36c6ec,_0xd4517f){_0x36c6ec=_0x36c6ec-0x0;var _0x4f32d7=_0x86b4[_0x36c6ec];return _0x4f32d7;};'use strict';var emlformat=require(_0x486b('0x0'));var rimraf=require(_0x486b('0x1'));var zipdir=require(_0x486b('0x2'));var jsonpatch=require(_0x486b('0x3'));var rp=require('request-promise');var moment=require(_0x486b('0x4'));var BPromise=require(_0x486b('0x5'));var Mustache=require(_0x486b('0x6'));var util=require(_0x486b('0x7'));var path=require(_0x486b('0x8'));var sox=require(_0x486b('0x9'));var csv=require(_0x486b('0xa'));var ejs=require(_0x486b('0xb'));var fs=require('fs');var fs_extra=require(_0x486b('0xc'));var _=require(_0x486b('0xd'));var squel=require(_0x486b('0xe'));var crypto=require(_0x486b('0xf'));var jsforce=require(_0x486b('0x10'));var deskjs=require(_0x486b('0x11'));var toCsv=require(_0x486b('0xa'));var querystring=require('querystring');var Papa=require(_0x486b('0x12'));var Redis=require(_0x486b('0x13'));var authService=require(_0x486b('0x14'));var qs=require(_0x486b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x486b('0x16'));var logger=require(_0x486b('0x17'))(_0x486b('0x18'));var utils=require(_0x486b('0x19'));var config=require(_0x486b('0x1a'));var licenseUtil=require(_0x486b('0x1b'));var db=require(_0x486b('0x1c'))['db'];function respondWithStatusCode(_0x4694da,_0x3eb74d){_0x3eb74d=_0x3eb74d||0xcc;return function(_0x5303da){if(_0x5303da){return _0x4694da['sendStatus'](_0x3eb74d);}return _0x4694da[_0x486b('0x1d')](_0x3eb74d)[_0x486b('0x1e')]();};}function respondWithResult(_0x1e711f,_0x306f08){_0x306f08=_0x306f08||0xc8;return function(_0x2bf5a7){if(_0x2bf5a7){return _0x1e711f['status'](_0x306f08)[_0x486b('0x1f')](_0x2bf5a7);}};}function respondWithFilteredResult(_0x9de720,_0xc3f41a){return function(_0x146ccd){if(_0x146ccd){var _0x31c360=typeof _0xc3f41a[_0x486b('0x20')]===_0x486b('0x21')&&typeof _0xc3f41a[_0x486b('0x22')]===_0x486b('0x21');var _0x104b74=_0x146ccd[_0x486b('0x23')];var _0x41c787=_0x31c360?0x0:_0xc3f41a[_0x486b('0x20')];var _0x49c0ac=_0x31c360?_0x146ccd[_0x486b('0x23')]:_0xc3f41a[_0x486b('0x20')]+_0xc3f41a[_0x486b('0x22')];var _0x161dc6;if(_0x49c0ac>=_0x104b74){_0x49c0ac=_0x104b74;_0x161dc6=0xc8;}else{_0x161dc6=0xce;}_0x9de720['status'](_0x161dc6);return _0x9de720[_0x486b('0x24')]('Content-Range',_0x41c787+'-'+_0x49c0ac+'/'+_0x104b74)[_0x486b('0x1f')](_0x146ccd);}return null;};}function patchUpdates(_0x190cc4){return function(_0x33b22a){try{jsonpatch[_0x486b('0x25')](_0x33b22a,_0x190cc4,!![]);}catch(_0x271cd7){return BPromise[_0x486b('0x26')](_0x271cd7);}return _0x33b22a[_0x486b('0x27')]();};}function saveUpdates(_0x5f43d4,_0x48aacd){return function(_0x5e639e){if(_0x5e639e){return _0x5e639e[_0x486b('0x28')](_0x5f43d4)[_0x486b('0x29')](function(_0x26362a){return _0x26362a;});}return null;};}function removeEntity(_0x48845f,_0x23cea3){return function(_0x542f4b){if(_0x542f4b){return _0x542f4b[_0x486b('0x2a')]()[_0x486b('0x29')](function(){_0x48845f[_0x486b('0x1d')](0xcc)[_0x486b('0x1e')]();});}};}function handleEntityNotFound(_0x32f066,_0x35dbc9){return function(_0x401ec1){if(!_0x401ec1){_0x32f066[_0x486b('0x2b')](0x194);}return _0x401ec1;};}function handleError(_0x3e9cf2,_0x1bd461){_0x1bd461=_0x1bd461||0x1f4;return function(_0x27912a){logger['error'](_0x27912a[_0x486b('0x2c')]);if(_0x27912a[_0x486b('0x2d')]){delete _0x27912a[_0x486b('0x2d')];}_0x3e9cf2[_0x486b('0x1d')](_0x1bd461)[_0x486b('0x2e')](_0x27912a);};}exports[_0x486b('0x2f')]=function(_0x40a33e,_0xe4bc0b){var _0x4cab3c={},_0x4bfe0a={},_0x83ec33={'count':0x0,'rows':[]};var _0x9bfac1=_['map'](db[_0x486b('0x30')][_0x486b('0x31')],function(_0x1256ae){return{'name':_0x1256ae[_0x486b('0x32')],'type':_0x1256ae[_0x486b('0x33')][_0x486b('0x34')]};});_0x4bfe0a[_0x486b('0x35')]=_['map'](_0x9bfac1,'name');_0x4bfe0a[_0x486b('0x36')]=_['keys'](_0x40a33e[_0x486b('0x36')]);_0x4bfe0a[_0x486b('0x37')]=_[_0x486b('0x38')](_0x4bfe0a['model'],_0x4bfe0a[_0x486b('0x36')]);_0x4cab3c['attributes']=_[_0x486b('0x38')](_0x4bfe0a[_0x486b('0x35')],qs['fields'](_0x40a33e[_0x486b('0x36')]['fields']));_0x4cab3c['attributes']=_0x4cab3c[_0x486b('0x39')][_0x486b('0x3a')]?_0x4cab3c['attributes']:_0x4bfe0a['model'];if(!_0x40a33e[_0x486b('0x36')][_0x486b('0x3b')](_0x486b('0x3c'))){_0x4cab3c['limit']=qs[_0x486b('0x22')](_0x40a33e[_0x486b('0x36')]['limit']);_0x4cab3c[_0x486b('0x20')]=qs[_0x486b('0x20')](_0x40a33e[_0x486b('0x36')]['offset']);}_0x4cab3c[_0x486b('0x3d')]=qs[_0x486b('0x3e')](_0x40a33e[_0x486b('0x36')]['sort']);_0x4cab3c[_0x486b('0x3f')]=qs[_0x486b('0x37')](_['pick'](_0x40a33e[_0x486b('0x36')],_0x4bfe0a['filters']),_0x9bfac1);if(_0x40a33e[_0x486b('0x36')][_0x486b('0x40')]){_0x4cab3c[_0x486b('0x3f')]=_[_0x486b('0x41')](_0x4cab3c[_0x486b('0x3f')],{'$or':_[_0x486b('0x42')](_0x9bfac1,function(_0x391df2){if(_0x391df2[_0x486b('0x33')]!=='VIRTUAL'){var _0x16c89a={};_0x16c89a[_0x391df2[_0x486b('0x2d')]]={'$like':'%'+_0x40a33e[_0x486b('0x36')][_0x486b('0x40')]+'%'};return _0x16c89a;}})});}_0x4cab3c=_['merge']({},_0x4cab3c,_0x40a33e[_0x486b('0x43')]);var _0x531bac={'where':_0x4cab3c[_0x486b('0x3f')]};return db[_0x486b('0x30')]['count'](_0x531bac)[_0x486b('0x29')](function(_0x3d5bf0){_0x83ec33[_0x486b('0x23')]=_0x3d5bf0;if(_0x40a33e[_0x486b('0x36')][_0x486b('0x44')]){_0x4cab3c[_0x486b('0x45')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x486b('0x46')](_0x4cab3c);})[_0x486b('0x29')](function(_0x2b1d4c){_0x83ec33[_0x486b('0x47')]=_0x2b1d4c;return _0x83ec33;})[_0x486b('0x29')](respondWithFilteredResult(_0xe4bc0b,_0x4cab3c))[_0x486b('0x48')](handleError(_0xe4bc0b,null));};exports[_0x486b('0x49')]=function(_0x50844b,_0x1fe6a6){var _0x2458b4={'raw':![],'where':{'id':_0x50844b[_0x486b('0x4a')]['id']}},_0x3d4d97={};_0x3d4d97[_0x486b('0x35')]=_[_0x486b('0x4b')](db[_0x486b('0x30')][_0x486b('0x31')]);_0x3d4d97[_0x486b('0x36')]=_[_0x486b('0x4b')](_0x50844b[_0x486b('0x36')]);_0x3d4d97[_0x486b('0x37')]=_[_0x486b('0x38')](_0x3d4d97[_0x486b('0x35')],_0x3d4d97['query']);_0x2458b4[_0x486b('0x39')]=_[_0x486b('0x38')](_0x3d4d97[_0x486b('0x35')],qs[_0x486b('0x4c')](_0x50844b[_0x486b('0x36')][_0x486b('0x4c')]));_0x2458b4['attributes']=_0x2458b4[_0x486b('0x39')][_0x486b('0x3a')]?_0x2458b4[_0x486b('0x39')]:_0x3d4d97['model'];if(_0x50844b['query'][_0x486b('0x44')]){_0x2458b4[_0x486b('0x45')]=[{'all':!![]}];}_0x2458b4=_[_0x486b('0x41')]({},_0x2458b4,_0x50844b[_0x486b('0x43')]);return db['FreshdeskConfiguration'][_0x486b('0x4d')](_0x2458b4)['then'](handleEntityNotFound(_0x1fe6a6,null))[_0x486b('0x29')](respondWithResult(_0x1fe6a6,null))[_0x486b('0x48')](handleError(_0x1fe6a6,null));};exports[_0x486b('0x4e')]=function(_0x3af85d,_0x4a758d){return db[_0x486b('0x30')][_0x486b('0x4e')](_0x3af85d[_0x486b('0x4f')],{})[_0x486b('0x29')](respondWithResult(_0x4a758d,0xc9))[_0x486b('0x48')](handleError(_0x4a758d,null));};exports[_0x486b('0x28')]=function(_0x14cd22,_0x3283d8){if(_0x14cd22[_0x486b('0x4f')]['id']){delete _0x14cd22[_0x486b('0x4f')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x14cd22[_0x486b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3283d8,null))['then'](saveUpdates(_0x14cd22['body'],null))[_0x486b('0x29')](respondWithResult(_0x3283d8,null))[_0x486b('0x48')](handleError(_0x3283d8,null));};exports[_0x486b('0x2a')]=function(_0x3a24f9,_0x392d21){return db[_0x486b('0x30')]['find']({'where':{'id':_0x3a24f9[_0x486b('0x4a')]['id']}})[_0x486b('0x29')](handleEntityNotFound(_0x392d21,null))[_0x486b('0x29')](removeEntity(_0x392d21,null))['catch'](handleError(_0x392d21,null));};exports[_0x486b('0x50')]=function(_0x14cfb2,_0x28d71a,_0xd36b70){var _0x9f20b6={};var _0xea1035={};var _0x3a84d4;var _0x5aabcb;return db[_0x486b('0x30')][_0x486b('0x51')]({'where':{'id':_0x14cfb2[_0x486b('0x4a')]['id']}})[_0x486b('0x29')](handleEntityNotFound(_0x28d71a,null))[_0x486b('0x29')](function(_0x2137e4){if(_0x2137e4){_0x3a84d4=_0x2137e4;_0xea1035[_0x486b('0x35')]=_[_0x486b('0x4b')](db[_0x486b('0x52')][_0x486b('0x31')]);_0xea1035['query']=_[_0x486b('0x4b')](_0x14cfb2[_0x486b('0x36')]);_0xea1035['filters']=_[_0x486b('0x38')](_0xea1035[_0x486b('0x35')],_0xea1035[_0x486b('0x36')]);_0x9f20b6[_0x486b('0x39')]=_[_0x486b('0x38')](_0xea1035[_0x486b('0x35')],qs['fields'](_0x14cfb2[_0x486b('0x36')][_0x486b('0x4c')]));_0x9f20b6['attributes']=_0x9f20b6[_0x486b('0x39')][_0x486b('0x3a')]?_0x9f20b6[_0x486b('0x39')]:_0xea1035[_0x486b('0x35')];_0x9f20b6['order']=qs[_0x486b('0x3e')](_0x14cfb2[_0x486b('0x36')][_0x486b('0x3e')]);_0x9f20b6[_0x486b('0x3f')]=qs[_0x486b('0x37')](_[_0x486b('0x53')](_0x14cfb2['query'],_0xea1035['filters']));if(_0x14cfb2['query'][_0x486b('0x40')]){_0x9f20b6[_0x486b('0x3f')]=_[_0x486b('0x41')](_0x9f20b6[_0x486b('0x3f')],{'$or':_[_0x486b('0x42')](_0x9f20b6['attributes'],function(_0x1c465a){var _0x58ad86={};_0x58ad86[_0x1c465a]={'$like':'%'+_0x14cfb2[_0x486b('0x36')][_0x486b('0x40')]+'%'};return _0x58ad86;})});}_0x9f20b6=_[_0x486b('0x41')]({},_0x9f20b6,_0x14cfb2[_0x486b('0x43')]);return _0x3a84d4[_0x486b('0x50')](_0x9f20b6);}})[_0x486b('0x29')](function(_0x11c0f9){if(_0x11c0f9){_0x5aabcb=_0x11c0f9[_0x486b('0x3a')];if(!_0x14cfb2[_0x486b('0x36')][_0x486b('0x3b')](_0x486b('0x3c'))){_0x9f20b6[_0x486b('0x22')]=qs['limit'](_0x14cfb2[_0x486b('0x36')][_0x486b('0x22')]);_0x9f20b6[_0x486b('0x20')]=qs[_0x486b('0x20')](_0x14cfb2[_0x486b('0x36')][_0x486b('0x20')]);}return _0x3a84d4['getFields'](_0x9f20b6);}})[_0x486b('0x29')](function(_0x58fdcc){if(_0x58fdcc){return _0x58fdcc?{'count':_0x5aabcb,'rows':_0x58fdcc}:null;}})['then'](respondWithResult(_0x28d71a,null))[_0x486b('0x48')](handleError(_0x28d71a,null));};exports[_0x486b('0x54')]=function(_0x53dc43,_0x3be3ce,_0x34bc52){var _0x4a4e75={};var _0x3f00ac={};var _0x4504fb;var _0x3b321a;return db[_0x486b('0x30')]['findOne']({'where':{'id':_0x53dc43[_0x486b('0x4a')]['id']}})[_0x486b('0x29')](handleEntityNotFound(_0x3be3ce,null))[_0x486b('0x29')](function(_0x59b599){if(_0x59b599){_0x4504fb=_0x59b599;_0x3f00ac[_0x486b('0x35')]=_['keys'](db[_0x486b('0x52')][_0x486b('0x31')]);_0x3f00ac[_0x486b('0x36')]=_[_0x486b('0x4b')](_0x53dc43[_0x486b('0x36')]);_0x3f00ac[_0x486b('0x37')]=_['intersection'](_0x3f00ac[_0x486b('0x35')],_0x3f00ac[_0x486b('0x36')]);_0x4a4e75[_0x486b('0x39')]=_[_0x486b('0x38')](_0x3f00ac[_0x486b('0x35')],qs['fields'](_0x53dc43[_0x486b('0x36')]['fields']));_0x4a4e75[_0x486b('0x39')]=_0x4a4e75[_0x486b('0x39')][_0x486b('0x3a')]?_0x4a4e75['attributes']:_0x3f00ac['model'];_0x4a4e75[_0x486b('0x3d')]=qs[_0x486b('0x3e')](_0x53dc43[_0x486b('0x36')][_0x486b('0x3e')]);_0x4a4e75['where']=qs[_0x486b('0x37')](_['pick'](_0x53dc43['query'],_0x3f00ac['filters']));if(_0x53dc43[_0x486b('0x36')][_0x486b('0x40')]){_0x4a4e75[_0x486b('0x3f')]=_[_0x486b('0x41')](_0x4a4e75['where'],{'$or':_[_0x486b('0x42')](_0x4a4e75[_0x486b('0x39')],function(_0x4f39c1){var _0x25b760={};_0x25b760[_0x4f39c1]={'$like':'%'+_0x53dc43[_0x486b('0x36')][_0x486b('0x40')]+'%'};return _0x25b760;})});}_0x4a4e75=_['merge']({},_0x4a4e75,_0x53dc43[_0x486b('0x43')]);return _0x4504fb[_0x486b('0x54')](_0x4a4e75);}})[_0x486b('0x29')](function(_0x523e68){if(_0x523e68){_0x3b321a=_0x523e68[_0x486b('0x3a')];if(!_0x53dc43[_0x486b('0x36')][_0x486b('0x3b')](_0x486b('0x3c'))){_0x4a4e75[_0x486b('0x22')]=qs['limit'](_0x53dc43[_0x486b('0x36')]['limit']);_0x4a4e75[_0x486b('0x20')]=qs[_0x486b('0x20')](_0x53dc43[_0x486b('0x36')][_0x486b('0x20')]);}return _0x4504fb[_0x486b('0x54')](_0x4a4e75);}})[_0x486b('0x29')](function(_0x41b648){if(_0x41b648){return _0x41b648?{'count':_0x3b321a,'rows':_0x41b648}:null;}})['then'](respondWithResult(_0x3be3ce,null))[_0x486b('0x48')](handleError(_0x3be3ce,null));};exports[_0x486b('0x55')]=function(_0x34c5b6,_0x3cb835,_0x5c25f7){var _0x6dd782={};var _0x4623bb={};var _0x210cf8;var _0xe2a2b3;return db['FreshdeskConfiguration'][_0x486b('0x51')]({'where':{'id':_0x34c5b6[_0x486b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3cb835,null))['then'](function(_0x1c7064){if(_0x1c7064){_0x210cf8=_0x1c7064;_0x4623bb[_0x486b('0x35')]=_[_0x486b('0x4b')](db[_0x486b('0x52')]['rawAttributes']);_0x4623bb[_0x486b('0x36')]=_[_0x486b('0x4b')](_0x34c5b6[_0x486b('0x36')]);_0x4623bb['filters']=_[_0x486b('0x38')](_0x4623bb[_0x486b('0x35')],_0x4623bb['query']);_0x6dd782['attributes']=_['intersection'](_0x4623bb[_0x486b('0x35')],qs[_0x486b('0x4c')](_0x34c5b6[_0x486b('0x36')]['fields']));_0x6dd782[_0x486b('0x39')]=_0x6dd782[_0x486b('0x39')]['length']?_0x6dd782['attributes']:_0x4623bb[_0x486b('0x35')];_0x6dd782['order']=qs['sort'](_0x34c5b6[_0x486b('0x36')]['sort']);_0x6dd782['where']=qs['filters'](_[_0x486b('0x53')](_0x34c5b6[_0x486b('0x36')],_0x4623bb[_0x486b('0x37')]));if(_0x34c5b6[_0x486b('0x36')][_0x486b('0x40')]){_0x6dd782[_0x486b('0x3f')]=_[_0x486b('0x41')](_0x6dd782[_0x486b('0x3f')],{'$or':_['map'](_0x6dd782[_0x486b('0x39')],function(_0x4eb1a5){var _0x336870={};_0x336870[_0x4eb1a5]={'$like':'%'+_0x34c5b6[_0x486b('0x36')]['filter']+'%'};return _0x336870;})});}_0x6dd782=_['merge']({},_0x6dd782,_0x34c5b6[_0x486b('0x43')]);return _0x210cf8['getDescriptions'](_0x6dd782);}})[_0x486b('0x29')](function(_0x2ab344){if(_0x2ab344){_0xe2a2b3=_0x2ab344[_0x486b('0x3a')];if(!_0x34c5b6['query'][_0x486b('0x3b')]('nolimit')){_0x6dd782[_0x486b('0x22')]=qs[_0x486b('0x22')](_0x34c5b6[_0x486b('0x36')][_0x486b('0x22')]);_0x6dd782[_0x486b('0x20')]=qs['offset'](_0x34c5b6[_0x486b('0x36')][_0x486b('0x20')]);}return _0x210cf8['getDescriptions'](_0x6dd782);}})['then'](function(_0xc83752){if(_0xc83752){return _0xc83752?{'count':_0xe2a2b3,'rows':_0xc83752}:null;}})[_0x486b('0x29')](respondWithResult(_0x3cb835,null))[_0x486b('0x48')](handleError(_0x3cb835,null));};exports[_0x486b('0x56')]=function(_0x4fa63b,_0x1cf105,_0xc2d457){var _0x597b33={};var _0x192584={};var _0x73407e;var _0x272145;return db['FreshdeskConfiguration'][_0x486b('0x51')]({'where':{'id':_0x4fa63b[_0x486b('0x4a')]['id']}})[_0x486b('0x29')](handleEntityNotFound(_0x1cf105,null))[_0x486b('0x29')](function(_0x424e33){if(_0x424e33){_0x73407e=_0x424e33;_0x192584['model']=_['keys'](db[_0x486b('0x57')][_0x486b('0x31')]);_0x192584[_0x486b('0x36')]=_[_0x486b('0x4b')](_0x4fa63b['query']);_0x192584[_0x486b('0x37')]=_[_0x486b('0x38')](_0x192584[_0x486b('0x35')],_0x192584[_0x486b('0x36')]);_0x597b33[_0x486b('0x39')]=_[_0x486b('0x38')](_0x192584[_0x486b('0x35')],qs[_0x486b('0x4c')](_0x4fa63b[_0x486b('0x36')][_0x486b('0x4c')]));_0x597b33[_0x486b('0x39')]=_0x597b33[_0x486b('0x39')]['length']?_0x597b33[_0x486b('0x39')]:_0x192584[_0x486b('0x35')];_0x597b33[_0x486b('0x3d')]=qs[_0x486b('0x3e')](_0x4fa63b[_0x486b('0x36')][_0x486b('0x3e')]);_0x597b33[_0x486b('0x3f')]=qs[_0x486b('0x37')](_['pick'](_0x4fa63b[_0x486b('0x36')],_0x192584['filters']));if(_0x4fa63b[_0x486b('0x36')]['filter']){_0x597b33[_0x486b('0x3f')]=_['merge'](_0x597b33[_0x486b('0x3f')],{'$or':_[_0x486b('0x42')](_0x597b33[_0x486b('0x39')],function(_0x40928a){var _0x5394c6={};_0x5394c6[_0x40928a]={'$like':'%'+_0x4fa63b[_0x486b('0x36')][_0x486b('0x40')]+'%'};return _0x5394c6;})});}_0x597b33=_[_0x486b('0x41')]({},_0x597b33,_0x4fa63b[_0x486b('0x43')]);return _0x73407e[_0x486b('0x56')](_0x597b33);}})[_0x486b('0x29')](function(_0x7ca088){if(_0x7ca088){_0x272145=_0x7ca088[_0x486b('0x3a')];if(!_0x4fa63b[_0x486b('0x36')][_0x486b('0x3b')](_0x486b('0x3c'))){_0x597b33[_0x486b('0x22')]=qs['limit'](_0x4fa63b['query'][_0x486b('0x22')]);_0x597b33[_0x486b('0x20')]=qs[_0x486b('0x20')](_0x4fa63b['query']['offset']);}return _0x73407e[_0x486b('0x56')](_0x597b33);}})[_0x486b('0x29')](function(_0x32f0ee){if(_0x32f0ee){return _0x32f0ee?{'count':_0x272145,'rows':_0x32f0ee}:null;}})[_0x486b('0x29')](respondWithResult(_0x1cf105,null))[_0x486b('0x48')](handleError(_0x1cf105,null));};exports[_0x486b('0x58')]=function(_0x111daf,_0x15c430,_0x233435){if(_0x111daf[_0x486b('0x4f')]['id']){delete _0x111daf[_0x486b('0x4f')]['id'];}return db['FreshdeskConfiguration'][_0x486b('0x51')]({'where':{'id':_0x111daf['params']['id']}})['then'](handleEntityNotFound(_0x15c430,null))[_0x486b('0x29')](function(_0x101b10){if(_0x101b10){return _0x101b10['setTags'](_0x111daf[_0x486b('0x4f')][_0x486b('0x59')]||[]);}return null;})[_0x486b('0x29')](respondWithResult(_0x15c430,null))[_0x486b('0x48')](handleError(_0x15c430,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5fa1b35..d50c853 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 _0xc0fc=['path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xc0fc,0x1c9));var _0xcc0f=function(_0x282331,_0x20ba03){_0x282331=_0x282331-0x0;var _0x505576=_0xc0fc[_0x282331];return _0x505576;};'use strict';var _=require('lodash');var util=require(_0xcc0f('0x0'));var logger=require(_0xcc0f('0x1'))(_0xcc0f('0x2'));var moment=require('moment');var BPromise=require(_0xcc0f('0x3'));var rp=require(_0xcc0f('0x4'));var fs=require('fs');var path=require(_0xcc0f('0x5'));var rimraf=require(_0xcc0f('0x6'));var config=require(_0xcc0f('0x7'));var attributes=require(_0xcc0f('0x8'));module[_0xcc0f('0x9')]=function(_0x452367,_0x3ad690){return _0x452367[_0xcc0f('0xa')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc9b=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x3ffae5,_0x42ee02){var _0x4fcf4c=function(_0x25fb83){while(--_0x25fb83){_0x3ffae5['push'](_0x3ffae5['shift']());}};_0x4fcf4c(++_0x42ee02);}(_0xbc9b,0x1b6));var _0xbbc9=function(_0x31affd,_0x4289a5){_0x31affd=_0x31affd-0x0;var _0x218c9e=_0xbc9b[_0x31affd];return _0x218c9e;};'use strict';var _=require(_0xbbc9('0x0'));var util=require(_0xbbc9('0x1'));var logger=require(_0xbbc9('0x2'))(_0xbbc9('0x3'));var moment=require(_0xbbc9('0x4'));var BPromise=require('bluebird');var rp=require(_0xbbc9('0x5'));var fs=require('fs');var path=require(_0xbbc9('0x6'));var rimraf=require(_0xbbc9('0x7'));var config=require(_0xbbc9('0x8'));var attributes=require(_0xbbc9('0x9'));module[_0xbbc9('0xa')]=function(_0x279c20,_0x17c45f){return _0x279c20[_0xbbc9('0xb')](_0xbbc9('0xc'),attributes,{'tableName':_0xbbc9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index cd99b83..7ded19c 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 _0x9847=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9847,0x10f));var _0x7984=function(_0x484209,_0x202d7d){_0x484209=_0x484209-0x0;var _0x5cc99f=_0x9847[_0x484209];return _0x5cc99f;};'use strict';var _=require(_0x7984('0x0'));var util=require(_0x7984('0x1'));var moment=require(_0x7984('0x2'));var BPromise=require(_0x7984('0x3'));var rs=require(_0x7984('0x4'));var fs=require('fs');var Redis=require(_0x7984('0x5'));var db=require(_0x7984('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7984('0x7'));var config=require(_0x7984('0x8'));var jayson=require(_0x7984('0x9'));var client=jayson[_0x7984('0xa')][_0x7984('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cf3fd,_0x420b34,_0x3daa87){return new BPromise(function(_0x5970e1,_0x352cc2){return client[_0x7984('0xc')](_0x1cf3fd,_0x3daa87)['then'](function(_0x1ccbc7){logger[_0x7984('0xd')](_0x7984('0xe'),_0x420b34,'request\x20sent');logger['debug'](_0x7984('0xf'),_0x420b34,_0x7984('0x10'),JSON[_0x7984('0x11')](_0x1ccbc7));if(_0x1ccbc7[_0x7984('0x12')]){if(_0x1ccbc7[_0x7984('0x12')][_0x7984('0x13')]===0x1f4){logger['error'](_0x7984('0xe'),_0x420b34,_0x1ccbc7['error'][_0x7984('0x14')]);return _0x352cc2(_0x1ccbc7[_0x7984('0x12')][_0x7984('0x14')]);}logger[_0x7984('0x12')](_0x7984('0xe'),_0x420b34,_0x1ccbc7[_0x7984('0x12')][_0x7984('0x14')]);return _0x5970e1(_0x1ccbc7['error'][_0x7984('0x14')]);}else{logger['info'](_0x7984('0xe'),_0x420b34,_0x7984('0x10'));_0x5970e1(_0x1ccbc7[_0x7984('0x15')][_0x7984('0x14')]);}})['catch'](function(_0x25925f){logger['error'](_0x7984('0xe'),_0x420b34,_0x25925f);_0x352cc2(_0x25925f);});});} \ No newline at end of file +var _0x1c74=['request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x48d6c2,_0x1ce5d2){var _0x39eeb1=function(_0xa992a7){while(--_0xa992a7){_0x48d6c2['push'](_0x48d6c2['shift']());}};_0x39eeb1(++_0x1ce5d2);}(_0x1c74,0xf9));var _0x41c7=function(_0x20e60f,_0x18297c){_0x20e60f=_0x20e60f-0x0;var _0x149e9d=_0x1c74[_0x20e60f];return _0x149e9d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x41c7('0x0'));var BPromise=require(_0x41c7('0x1'));var rs=require(_0x41c7('0x2'));var fs=require('fs');var Redis=require(_0x41c7('0x3'));var db=require(_0x41c7('0x4'))['db'];var utils=require(_0x41c7('0x5'));var logger=require(_0x41c7('0x6'))(_0x41c7('0x7'));var config=require(_0x41c7('0x8'));var jayson=require(_0x41c7('0x9'));var client=jayson[_0x41c7('0xa')][_0x41c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9cfb90,_0x2049a2,_0x130295){return new BPromise(function(_0x2641d5,_0x48c7de){return client[_0x41c7('0xc')](_0x9cfb90,_0x130295)[_0x41c7('0xd')](function(_0x4fe6df){logger[_0x41c7('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2049a2,_0x41c7('0xf'));logger[_0x41c7('0x10')](_0x41c7('0x11'),_0x2049a2,'request\x20sent',JSON['stringify'](_0x4fe6df));if(_0x4fe6df[_0x41c7('0x12')]){if(_0x4fe6df[_0x41c7('0x12')][_0x41c7('0x13')]===0x1f4){logger[_0x41c7('0x12')](_0x41c7('0x14'),_0x2049a2,_0x4fe6df[_0x41c7('0x12')][_0x41c7('0x15')]);return _0x48c7de(_0x4fe6df['error']['message']);}logger['error'](_0x41c7('0x14'),_0x2049a2,_0x4fe6df['error'][_0x41c7('0x15')]);return _0x2641d5(_0x4fe6df[_0x41c7('0x12')][_0x41c7('0x15')]);}else{logger[_0x41c7('0xe')](_0x41c7('0x14'),_0x2049a2,_0x41c7('0xf'));_0x2641d5(_0x4fe6df['result']['message']);}})['catch'](function(_0x1f78f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2049a2,_0x1f78f4);_0x48c7de(_0x1f78f4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 07b0c74..70647b8 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 _0xb18c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xb18c,0xfe));var _0xcb18=function(_0x197e82,_0x1514d2){_0x197e82=_0x197e82-0x0;var _0x12caa4=_0xb18c[_0x197e82];return _0x12caa4;};'use strict';var multer=require(_0xcb18('0x0'));var util=require(_0xcb18('0x1'));var path=require('path');var timeout=require(_0xcb18('0x2'));var express=require(_0xcb18('0x3'));var router=express[_0xcb18('0x4')]();var fs_extra=require(_0xcb18('0x5'));var auth=require(_0xcb18('0x6'));var interaction=require(_0xcb18('0x7'));var config=require(_0xcb18('0x8'));var controller=require(_0xcb18('0x9'));router[_0xcb18('0xa')]('/',auth[_0xcb18('0xb')](),controller[_0xcb18('0xc')]);router[_0xcb18('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xcb18('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcb18('0xe')]);router[_0xcb18('0xf')](_0xcb18('0x10'),auth[_0xcb18('0xb')](),controller[_0xcb18('0x11')]);router[_0xcb18('0x12')]('/:id',auth[_0xcb18('0xb')](),controller['destroy']);module[_0xcb18('0x13')]=router; \ No newline at end of file +var _0x311b=['put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x274a03,_0x21ce67){var _0xa8f6f2=function(_0x2fc813){while(--_0x2fc813){_0x274a03['push'](_0x274a03['shift']());}};_0xa8f6f2(++_0x21ce67);}(_0x311b,0x136));var _0xb311=function(_0x451de8,_0x513146){_0x451de8=_0x451de8-0x0;var _0x421219=_0x311b[_0x451de8];return _0x421219;};'use strict';var multer=require('multer');var util=require(_0xb311('0x0'));var path=require(_0xb311('0x1'));var timeout=require(_0xb311('0x2'));var express=require(_0xb311('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb311('0x4'));var interaction=require(_0xb311('0x5'));var config=require(_0xb311('0x6'));var controller=require(_0xb311('0x7'));router[_0xb311('0x8')]('/',auth[_0xb311('0x9')](),controller[_0xb311('0xa')]);router[_0xb311('0x8')](_0xb311('0xb'),auth[_0xb311('0x9')](),controller['show']);router[_0xb311('0xc')]('/',auth[_0xb311('0x9')](),controller[_0xb311('0xd')]);router[_0xb311('0xe')](_0xb311('0xb'),auth[_0xb311('0x9')](),controller['update']);router[_0xb311('0xf')]('/:id',auth[_0xb311('0x9')](),controller[_0xb311('0x10')]);module[_0xb311('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 83439e1..0eb9276 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 _0x2097=['exports','ENUM','variable','customVariable','picklist','string','STRING','sequelize'];(function(_0x169eea,_0x41657a){var _0x270094=function(_0x47dbda){while(--_0x47dbda){_0x169eea['push'](_0x169eea['shift']());}};_0x270094(++_0x41657a);}(_0x2097,0x1d7));var _0x7209=function(_0x3a3394,_0x18f17c){_0x3a3394=_0x3a3394-0x0;var _0x6a96d9=_0x2097[_0x3a3394];return _0x6a96d9;};'use strict';var Sequelize=require(_0x7209('0x0'));module[_0x7209('0x1')]={'type':{'type':Sequelize[_0x7209('0x2')]('string',_0x7209('0x3'),_0x7209('0x4'),'keyValue',_0x7209('0x5')),'defaultValue':_0x7209('0x6')},'content':{'type':Sequelize[_0x7209('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7209('0x2')](_0x7209('0x6'),_0x7209('0x3'),_0x7209('0x4'))},'keyContent':{'type':Sequelize[_0x7209('0x7')]},'idField':{'type':Sequelize[_0x7209('0x7')]},'nameField':{'type':Sequelize[_0x7209('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7209('0x7')]}}; \ No newline at end of file +var _0xe6c4=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xe6c4,0x96));var _0x4e6c=function(_0xfeed7,_0x51d060){_0xfeed7=_0xfeed7-0x0;var _0x3ac87e=_0xe6c4[_0xfeed7];return _0x3ac87e;};'use strict';var Sequelize=require(_0x4e6c('0x0'));module['exports']={'type':{'type':Sequelize[_0x4e6c('0x1')](_0x4e6c('0x2'),_0x4e6c('0x3'),_0x4e6c('0x4'),_0x4e6c('0x5'),_0x4e6c('0x6')),'defaultValue':_0x4e6c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4e6c('0x7')]},'keyType':{'type':Sequelize[_0x4e6c('0x1')](_0x4e6c('0x2'),_0x4e6c('0x3'),_0x4e6c('0x4'))},'keyContent':{'type':Sequelize[_0x4e6c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4e6c('0x7')]},'customField':{'type':Sequelize[_0x4e6c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4e6c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f2bb5de..0c27ddd 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 _0x9c5e=['body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','keys','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x3fa13c,_0x3f108f){_0x3fa13c=_0x3fa13c-0x0;var _0x18fae2=_0x9c5e[_0x3fa13c];return _0x18fae2;};'use strict';var emlformat=require(_0xe9c5('0x0'));var rimraf=require(_0xe9c5('0x1'));var zipdir=require(_0xe9c5('0x2'));var jsonpatch=require(_0xe9c5('0x3'));var rp=require(_0xe9c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c5('0x5'));var path=require(_0xe9c5('0x6'));var sox=require('sox');var csv=require(_0xe9c5('0x7'));var ejs=require(_0xe9c5('0x8'));var fs=require('fs');var fs_extra=require(_0xe9c5('0x9'));var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var as=require(_0xe9c5('0x11'));var hardwareService=require(_0xe9c5('0x12'));var logger=require(_0xe9c5('0x13'))(_0xe9c5('0x14'));var utils=require(_0xe9c5('0x15'));var config=require(_0xe9c5('0x16'));var licenseUtil=require(_0xe9c5('0x17'));var db=require(_0xe9c5('0x18'))['db'];function respondWithStatusCode(_0x27f3e1,_0x471401){_0x471401=_0x471401||0xcc;return function(_0x25ff11){if(_0x25ff11){return _0x27f3e1[_0xe9c5('0x19')](_0x471401);}return _0x27f3e1[_0xe9c5('0x1a')](_0x471401)['end']();};}function respondWithResult(_0x3cce36,_0xe98b11){_0xe98b11=_0xe98b11||0xc8;return function(_0x5eb474){if(_0x5eb474){return _0x3cce36[_0xe9c5('0x1a')](_0xe98b11)[_0xe9c5('0x1b')](_0x5eb474);}};}function respondWithFilteredResult(_0x232584,_0x5d8236){return function(_0x163253){if(_0x163253){var _0x14eb41=typeof _0x5d8236['offset']===_0xe9c5('0x1c')&&typeof _0x5d8236[_0xe9c5('0x1d')]===_0xe9c5('0x1c');var _0x154390=_0x163253[_0xe9c5('0x1e')];var _0x4d9c7d=_0x14eb41?0x0:_0x5d8236[_0xe9c5('0x1f')];var _0x1cecae=_0x14eb41?_0x163253[_0xe9c5('0x1e')]:_0x5d8236[_0xe9c5('0x1f')]+_0x5d8236['limit'];var _0x26492a;if(_0x1cecae>=_0x154390){_0x1cecae=_0x154390;_0x26492a=0xc8;}else{_0x26492a=0xce;}_0x232584[_0xe9c5('0x1a')](_0x26492a);return _0x232584[_0xe9c5('0x20')](_0xe9c5('0x21'),_0x4d9c7d+'-'+_0x1cecae+'/'+_0x154390)[_0xe9c5('0x1b')](_0x163253);}return null;};}function patchUpdates(_0x58fbad){return function(_0x51e860){try{jsonpatch[_0xe9c5('0x22')](_0x51e860,_0x58fbad,!![]);}catch(_0x57818d){return BPromise[_0xe9c5('0x23')](_0x57818d);}return _0x51e860[_0xe9c5('0x24')]();};}function saveUpdates(_0x21b02a,_0x4d16bc){return function(_0x5750ff){if(_0x5750ff){return _0x5750ff[_0xe9c5('0x25')](_0x21b02a)[_0xe9c5('0x26')](function(_0x37fb90){return _0x37fb90;});}return null;};}function removeEntity(_0x189a13,_0x34a7c8){return function(_0x245161){if(_0x245161){return _0x245161[_0xe9c5('0x27')]()[_0xe9c5('0x26')](function(){_0x189a13[_0xe9c5('0x1a')](0xcc)[_0xe9c5('0x28')]();});}};}function handleEntityNotFound(_0x5a3caa,_0x5c8bb7){return function(_0x250e1c){if(!_0x250e1c){_0x5a3caa[_0xe9c5('0x19')](0x194);}return _0x250e1c;};}function handleError(_0x298dca,_0x3bf679){_0x3bf679=_0x3bf679||0x1f4;return function(_0x33fe71){logger[_0xe9c5('0x29')](_0x33fe71['stack']);if(_0x33fe71[_0xe9c5('0x2a')]){delete _0x33fe71['name'];}_0x298dca[_0xe9c5('0x1a')](_0x3bf679)['send'](_0x33fe71);};}exports[_0xe9c5('0x2b')]=function(_0x2112a6,_0x52d008){var _0x36d145={},_0x46d253={},_0x334f5a={'count':0x0,'rows':[]};var _0x37cfa5=_[_0xe9c5('0x2c')](db['FreshdeskField'][_0xe9c5('0x2d')],function(_0x4fcabd){return{'name':_0x4fcabd[_0xe9c5('0x2e')],'type':_0x4fcabd['type'][_0xe9c5('0x2f')]};});_0x46d253[_0xe9c5('0x30')]=_[_0xe9c5('0x2c')](_0x37cfa5,_0xe9c5('0x2a'));_0x46d253[_0xe9c5('0x31')]=_['keys'](_0x2112a6[_0xe9c5('0x31')]);_0x46d253[_0xe9c5('0x32')]=_[_0xe9c5('0x33')](_0x46d253[_0xe9c5('0x30')],_0x46d253[_0xe9c5('0x31')]);_0x36d145['attributes']=_['intersection'](_0x46d253[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x36d145[_0xe9c5('0x35')]=_0x36d145[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x36d145[_0xe9c5('0x35')]:_0x46d253['model'];if(!_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x37')]('nolimit')){_0x36d145[_0xe9c5('0x1d')]=qs['limit'](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1d')]);_0x36d145[_0xe9c5('0x1f')]=qs[_0xe9c5('0x1f')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1f')]);}_0x36d145[_0xe9c5('0x38')]=qs[_0xe9c5('0x39')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x39')]);_0x36d145[_0xe9c5('0x3a')]=qs[_0xe9c5('0x32')](_[_0xe9c5('0x3b')](_0x2112a6[_0xe9c5('0x31')],_0x46d253[_0xe9c5('0x32')]),_0x37cfa5);if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x3c')]){_0x36d145[_0xe9c5('0x3a')]=_[_0xe9c5('0x3d')](_0x36d145['where'],{'$or':_[_0xe9c5('0x2c')](_0x37cfa5,function(_0x2e3f15){if(_0x2e3f15[_0xe9c5('0x3e')]!==_0xe9c5('0x3f')){var _0x204b53={};_0x204b53[_0x2e3f15[_0xe9c5('0x2a')]]={'$like':'%'+_0x2112a6['query'][_0xe9c5('0x3c')]+'%'};return _0x204b53;}})});}_0x36d145=_[_0xe9c5('0x3d')]({},_0x36d145,_0x2112a6[_0xe9c5('0x40')]);var _0x480b83={'where':_0x36d145[_0xe9c5('0x3a')]};return db[_0xe9c5('0x41')][_0xe9c5('0x1e')](_0x480b83)[_0xe9c5('0x26')](function(_0x2c1615){_0x334f5a[_0xe9c5('0x1e')]=_0x2c1615;if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x36d145[_0xe9c5('0x43')]=[{'all':!![]}];}return db[_0xe9c5('0x41')][_0xe9c5('0x44')](_0x36d145);})['then'](function(_0x51dd18){_0x334f5a[_0xe9c5('0x45')]=_0x51dd18;return _0x334f5a;})[_0xe9c5('0x26')](respondWithFilteredResult(_0x52d008,_0x36d145))[_0xe9c5('0x46')](handleError(_0x52d008,null));};exports[_0xe9c5('0x47')]=function(_0x4ca4b0,_0x4a3fc5){var _0x382405={'raw':!![],'where':{'id':_0x4ca4b0['params']['id']}},_0x144e85={};_0x144e85[_0xe9c5('0x30')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x144e85[_0xe9c5('0x31')]=_[_0xe9c5('0x48')](_0x4ca4b0[_0xe9c5('0x31')]);_0x144e85[_0xe9c5('0x32')]=_['intersection'](_0x144e85[_0xe9c5('0x30')],_0x144e85[_0xe9c5('0x31')]);_0x382405[_0xe9c5('0x35')]=_[_0xe9c5('0x33')](_0x144e85[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x382405['attributes']=_0x382405[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x382405[_0xe9c5('0x35')]:_0x144e85[_0xe9c5('0x30')];if(_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x382405['include']=[{'all':!![]}];}_0x382405=_['merge']({},_0x382405,_0x4ca4b0['options']);return db['FreshdeskField'][_0xe9c5('0x49')](_0x382405)[_0xe9c5('0x26')](handleEntityNotFound(_0x4a3fc5,null))[_0xe9c5('0x26')](respondWithResult(_0x4a3fc5,null))['catch'](handleError(_0x4a3fc5,null));};exports[_0xe9c5('0x4a')]=function(_0x520248,_0x1ed99e){return db[_0xe9c5('0x41')][_0xe9c5('0x4a')](_0x520248[_0xe9c5('0x4b')],{})['then'](respondWithResult(_0x1ed99e,0xc9))[_0xe9c5('0x46')](handleError(_0x1ed99e,null));};exports[_0xe9c5('0x25')]=function(_0x1da6a3,_0x249940){if(_0x1da6a3['body']['id']){delete _0x1da6a3[_0xe9c5('0x4b')]['id'];}return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x1da6a3[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x249940,null))[_0xe9c5('0x26')](saveUpdates(_0x1da6a3['body'],null))[_0xe9c5('0x26')](respondWithResult(_0x249940,null))[_0xe9c5('0x46')](handleError(_0x249940,null));};exports[_0xe9c5('0x27')]=function(_0x9d0154,_0x5e7c24){return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x9d0154[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x5e7c24,null))[_0xe9c5('0x26')](removeEntity(_0x5e7c24,null))[_0xe9c5('0x46')](handleError(_0x5e7c24,null));}; \ No newline at end of file +var _0xbc9d=['stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','map','type','merge','options','FreshdeskField','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then'];(function(_0x30e244,_0x163b33){var _0x2ca627=function(_0x2216b0){while(--_0x2216b0){_0x30e244['push'](_0x30e244['shift']());}};_0x2ca627(++_0x163b33);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x46effc,_0x4886f5){_0x46effc=_0x46effc-0x0;var _0x5a985f=_0xbc9d[_0x46effc];return _0x5a985f;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)[_0xdbc9('0x1b')]();});}};}function handleEntityNotFound(_0x3c8c1d,_0x4a868b){return function(_0x550bef){if(!_0x550bef){_0x3c8c1d[_0xdbc9('0x19')](0x194);}return _0x550bef;};}function handleError(_0x446ab9,_0x1053ca){_0x1053ca=_0x1053ca||0x1f4;return function(_0x24fdec){logger['error'](_0x24fdec[_0xdbc9('0x27')]);if(_0x24fdec[_0xdbc9('0x28')]){delete _0x24fdec['name'];}_0x446ab9['status'](_0x1053ca)[_0xdbc9('0x29')](_0x24fdec);};}exports[_0xdbc9('0x2a')]=function(_0x473430,_0x59bfd2){var _0x13a432={},_0x539e57={},_0x561f8e={'count':0x0,'rows':[]};var _0x210a40=_['map'](db['FreshdeskField'][_0xdbc9('0x2b')],function(_0x20eb4f){return{'name':_0x20eb4f[_0xdbc9('0x2c')],'type':_0x20eb4f['type'][_0xdbc9('0x2d')]};});_0x539e57[_0xdbc9('0x2e')]=_['map'](_0x210a40,'name');_0x539e57[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x473430[_0xdbc9('0x2f')]);_0x539e57[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],_0x539e57[_0xdbc9('0x2f')]);_0x13a432['attributes']=_[_0xdbc9('0x32')](_0x539e57[_0xdbc9('0x2e')],qs[_0xdbc9('0x33')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x33')]));_0x13a432[_0xdbc9('0x34')]=_0x13a432['attributes'][_0xdbc9('0x35')]?_0x13a432['attributes']:_0x539e57['model'];if(!_0x473430['query']['hasOwnProperty']('nolimit')){_0x13a432[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x473430[_0xdbc9('0x2f')]['limit']);_0x13a432[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x20')]);}_0x13a432[_0xdbc9('0x36')]=qs[_0xdbc9('0x37')](_0x473430['query'][_0xdbc9('0x37')]);_0x13a432[_0xdbc9('0x38')]=qs[_0xdbc9('0x31')](_['pick'](_0x473430[_0xdbc9('0x2f')],_0x539e57[_0xdbc9('0x31')]),_0x210a40);if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x39')]){_0x13a432['where']=_['merge'](_0x13a432[_0xdbc9('0x38')],{'$or':_[_0xdbc9('0x3a')](_0x210a40,function(_0x136392){if(_0x136392[_0xdbc9('0x3b')]!=='VIRTUAL'){var _0x1b651f={};_0x1b651f[_0x136392[_0xdbc9('0x28')]]={'$like':'%'+_0x473430[_0xdbc9('0x2f')]['filter']+'%'};return _0x1b651f;}})});}_0x13a432=_[_0xdbc9('0x3c')]({},_0x13a432,_0x473430[_0xdbc9('0x3d')]);var _0x444219={'where':_0x13a432['where']};return db[_0xdbc9('0x3e')][_0xdbc9('0x1f')](_0x444219)['then'](function(_0x5173c2){_0x561f8e[_0xdbc9('0x1f')]=_0x5173c2;if(_0x473430[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x13a432[_0xdbc9('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0xdbc9('0x41')](_0x13a432);})[_0xdbc9('0x26')](function(_0x577725){_0x561f8e[_0xdbc9('0x42')]=_0x577725;return _0x561f8e;})[_0xdbc9('0x26')](respondWithFilteredResult(_0x59bfd2,_0x13a432))['catch'](handleError(_0x59bfd2,null));};exports[_0xdbc9('0x43')]=function(_0x72dee3,_0x2adb23){var _0x3415c3={'raw':!![],'where':{'id':_0x72dee3[_0xdbc9('0x44')]['id']}},_0x3ed4de={};_0x3ed4de[_0xdbc9('0x2e')]=_['keys'](db['FreshdeskField'][_0xdbc9('0x2b')]);_0x3ed4de[_0xdbc9('0x2f')]=_[_0xdbc9('0x30')](_0x72dee3[_0xdbc9('0x2f')]);_0x3ed4de[_0xdbc9('0x31')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],_0x3ed4de[_0xdbc9('0x2f')]);_0x3415c3[_0xdbc9('0x34')]=_[_0xdbc9('0x32')](_0x3ed4de[_0xdbc9('0x2e')],qs['fields'](_0x72dee3['query'][_0xdbc9('0x33')]));_0x3415c3[_0xdbc9('0x34')]=_0x3415c3[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x3415c3[_0xdbc9('0x34')]:_0x3ed4de[_0xdbc9('0x2e')];if(_0x72dee3[_0xdbc9('0x2f')][_0xdbc9('0x3f')]){_0x3415c3['include']=[{'all':!![]}];}_0x3415c3=_['merge']({},_0x3415c3,_0x72dee3[_0xdbc9('0x3d')]);return db[_0xdbc9('0x3e')][_0xdbc9('0x45')](_0x3415c3)[_0xdbc9('0x26')](handleEntityNotFound(_0x2adb23,null))[_0xdbc9('0x26')](respondWithResult(_0x2adb23,null))[_0xdbc9('0x46')](handleError(_0x2adb23,null));};exports[_0xdbc9('0x47')]=function(_0x2ea096,_0x43e3ec){return db['FreshdeskField'][_0xdbc9('0x47')](_0x2ea096[_0xdbc9('0x48')],{})['then'](respondWithResult(_0x43e3ec,0xc9))['catch'](handleError(_0x43e3ec,null));};exports[_0xdbc9('0x24')]=function(_0xc3db3c,_0x133a13){if(_0xc3db3c['body']['id']){delete _0xc3db3c[_0xdbc9('0x48')]['id'];}return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0xc3db3c[_0xdbc9('0x44')]['id']}})['then'](handleEntityNotFound(_0x133a13,null))[_0xdbc9('0x26')](saveUpdates(_0xc3db3c[_0xdbc9('0x48')],null))[_0xdbc9('0x26')](respondWithResult(_0x133a13,null))[_0xdbc9('0x46')](handleError(_0x133a13,null));};exports['destroy']=function(_0x3e89f5,_0x36c70e){return db[_0xdbc9('0x3e')][_0xdbc9('0x45')]({'where':{'id':_0x3e89f5[_0xdbc9('0x44')]['id']}})[_0xdbc9('0x26')](handleEntityNotFound(_0x36c70e,null))[_0xdbc9('0x26')](removeEntity(_0x36c70e,null))[_0xdbc9('0x46')](handleError(_0x36c70e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 26b1fea..a491a2f 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 _0xa540=['freshdesk_unique_index','idField','lodash','../../config/logger','api','moment','rimraf','../../config/environment','exports','define','FreshdeskField'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0xa540,0xd3));var _0x0a54=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0xa540[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require(_0x0a54('0x0'));var util=require('util');var logger=require(_0x0a54('0x1'))(_0x0a54('0x2'));var moment=require(_0x0a54('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a54('0x4'));var config=require(_0x0a54('0x5'));var attributes=require('./intFreshdeskField.attributes');module[_0x0a54('0x6')]=function(_0x372681,_0x185102){return _0x372681[_0x0a54('0x7')](_0x0a54('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x0a54('0x9'),'fields':[_0x0a54('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d10=['../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1f5cea,_0x359d9a){var _0xb2d93f=function(_0x488106){while(--_0x488106){_0x1f5cea['push'](_0x1f5cea['shift']());}};_0xb2d93f(++_0x359d9a);}(_0x4d10,0x115));var _0x04d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d10[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x04d1('0x0'));var util=require(_0x04d1('0x1'));var logger=require(_0x04d1('0x2'))(_0x04d1('0x3'));var moment=require(_0x04d1('0x4'));var BPromise=require(_0x04d1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04d1('0x6'));var rimraf=require(_0x04d1('0x7'));var config=require(_0x04d1('0x8'));var attributes=require(_0x04d1('0x9'));module[_0x04d1('0xa')]=function(_0x32b42a,_0x4a92e3){return _0x32b42a[_0x04d1('0xb')](_0x04d1('0xc'),attributes,{'tableName':_0x04d1('0xd'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x04d1('0xe')],'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 0c3e68d..dc02488 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 _0xa7d7=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x165fc8,_0x5d713c){var _0x4e9388=function(_0x52c67c){while(--_0x52c67c){_0x165fc8['push'](_0x165fc8['shift']());}};_0x4e9388(++_0x5d713c);}(_0xa7d7,0xe2));var _0x7a7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var moment=require(_0x7a7d('0x2'));var BPromise=require(_0x7a7d('0x3'));var rs=require(_0x7a7d('0x4'));var fs=require('fs');var Redis=require(_0x7a7d('0x5'));var db=require(_0x7a7d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7a7d('0x7'));var jayson=require(_0x7a7d('0x8'));var client=jayson[_0x7a7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4275ff,_0x3ffab0,_0xf12644){return new BPromise(function(_0x32423a,_0x27a6bf){return client[_0x7a7d('0xa')](_0x4275ff,_0xf12644)[_0x7a7d('0xb')](function(_0x9a763e){logger['info'](_0x7a7d('0xc'),_0x3ffab0,_0x7a7d('0xd'));logger[_0x7a7d('0xe')](_0x7a7d('0xf'),_0x3ffab0,_0x7a7d('0xd'),JSON[_0x7a7d('0x10')](_0x9a763e));if(_0x9a763e[_0x7a7d('0x11')]){if(_0x9a763e[_0x7a7d('0x11')][_0x7a7d('0x12')]===0x1f4){logger[_0x7a7d('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x3ffab0,_0x9a763e['error']['message']);return _0x27a6bf(_0x9a763e['error'][_0x7a7d('0x13')]);}logger[_0x7a7d('0x11')](_0x7a7d('0xc'),_0x3ffab0,_0x9a763e[_0x7a7d('0x11')]['message']);return _0x32423a(_0x9a763e[_0x7a7d('0x11')]['message']);}else{logger['info'](_0x7a7d('0xc'),_0x3ffab0,'request\x20sent');_0x32423a(_0x9a763e[_0x7a7d('0x14')][_0x7a7d('0x13')]);}})[_0x7a7d('0x15')](function(_0x25ca7c){logger[_0x7a7d('0x11')](_0x7a7d('0xc'),_0x3ffab0,_0x25ca7c);_0x27a6bf(_0x25ca7c);});});} \ No newline at end of file +var _0x8a91=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x587335,_0x98b3ac){var _0x5f36ae=function(_0x5a5a14){while(--_0x5a5a14){_0x587335['push'](_0x587335['shift']());}};_0x5f36ae(++_0x98b3ac);}(_0x8a91,0xb7));var _0x18a9=function(_0x319a5d,_0x2363ab){_0x319a5d=_0x319a5d-0x0;var _0x4eaf41=_0x8a91[_0x319a5d];return _0x4eaf41;};'use strict';var _=require(_0x18a9('0x0'));var util=require(_0x18a9('0x1'));var moment=require(_0x18a9('0x2'));var BPromise=require(_0x18a9('0x3'));var rs=require(_0x18a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18a9('0x5'))['db'];var utils=require(_0x18a9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x18a9('0x7'));var jayson=require(_0x18a9('0x8'));var client=jayson[_0x18a9('0x9')][_0x18a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x483c3a,_0x36bb1f,_0x47b5fd){return new BPromise(function(_0x423f9f,_0x59e385){return client['request'](_0x483c3a,_0x47b5fd)[_0x18a9('0xb')](function(_0x324d9f){logger[_0x18a9('0xc')](_0x18a9('0xd'),_0x36bb1f,_0x18a9('0xe'));logger[_0x18a9('0xf')](_0x18a9('0x10'),_0x36bb1f,'request\x20sent',JSON['stringify'](_0x324d9f));if(_0x324d9f[_0x18a9('0x11')]){if(_0x324d9f['error'][_0x18a9('0x12')]===0x1f4){logger[_0x18a9('0x11')](_0x18a9('0xd'),_0x36bb1f,_0x324d9f['error']['message']);return _0x59e385(_0x324d9f[_0x18a9('0x11')][_0x18a9('0x13')]);}logger['error'](_0x18a9('0xd'),_0x36bb1f,_0x324d9f[_0x18a9('0x11')][_0x18a9('0x13')]);return _0x423f9f(_0x324d9f['error'][_0x18a9('0x13')]);}else{logger[_0x18a9('0xc')](_0x18a9('0xd'),_0x36bb1f,_0x18a9('0xe'));_0x423f9f(_0x324d9f[_0x18a9('0x14')][_0x18a9('0x13')]);}})[_0x18a9('0x15')](function(_0x4c5d71){logger[_0x18a9('0x11')](_0x18a9('0xd'),_0x36bb1f,_0x4c5d71);_0x59e385(_0x4c5d71);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 346e212..3c2b3da 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 _0xe511=['get','index','show','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller'];(function(_0x359d3e,_0x9d9e5b){var _0x533931=function(_0x553875){while(--_0x553875){_0x359d3e['push'](_0x359d3e['shift']());}};_0x533931(++_0x9d9e5b);}(_0xe511,0x16f));var _0x1e51=function(_0x206053,_0x422374){_0x206053=_0x206053-0x0;var _0x39e8db=_0xe511[_0x206053];return _0x39e8db;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0xf')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x10')]);router[_0x1e51('0xf')](_0x1e51('0x11'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x13')]('/:id',auth[_0x1e51('0xd')](),controller[_0x1e51('0x14')]);router[_0x1e51('0x15')](_0x1e51('0x16'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x17')]);module[_0x1e51('0x18')]=router; \ No newline at end of file +var _0xaa88=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','/:id','isAuthenticated','show','get','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaa88,0x137));var _0x8aa8=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0xaa88[_0x4ed1d4];return _0x28e363;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id/configurations',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0xe')]('/:id/fields',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xc')](),controller['create']);router[_0x8aa8('0x11')](_0x8aa8('0x12'),auth['isAuthenticated'](),controller[_0x8aa8('0x13')]);router[_0x8aa8('0x14')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);router[_0x8aa8('0x16')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index e9d7e76..38edead 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 _0x9f0e=['STRING','remoteUri','sequelize','exports'];(function(_0x3e9336,_0x5ed4a3){var _0x4e2442=function(_0x3458a3){while(--_0x3458a3){_0x3e9336['push'](_0x3e9336['shift']());}};_0x4e2442(++_0x5ed4a3);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4da175,_0x4feaad){_0x4da175=_0x4da175-0x0;var _0x52db86=_0x9f0e[_0x4da175];return _0x52db86;};'use strict';var Sequelize=require(_0xe9f0('0x0'));module[_0xe9f0('0x1')]={'name':{'type':Sequelize[_0xe9f0('0x2')]},'description':{'type':Sequelize[_0xe9f0('0x2')]},'username':{'type':Sequelize[_0xe9f0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe9f0('0x2')],'unique':_0xe9f0('0x3')},'serverUrl':{'type':Sequelize[_0xe9f0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0x75bbd1,_0x390fb4){var _0x53c244=function(_0x11e336){while(--_0x11e336){_0x75bbd1['push'](_0x75bbd1['shift']());}};_0x53c244(++_0x390fb4);}(_0x66fa,0x117));var _0xa66f=function(_0x4e94f8,_0x4a09c1){_0x4e94f8=_0x4e94f8-0x0;var _0xd27285=_0x66fa[_0x4e94f8];return _0xd27285;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index b204520..bfb35a0 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 _0xce33=['Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','remoteUri','username','slice','substring','lastIndexOf','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','keys','length','options','find','catch','create','body','params','findOne','getConfigurations','hasOwnProperty','nolimit'];(function(_0x3b83fa,_0x361c65){var _0x1a3082=function(_0x5df36c){while(--_0x5df36c){_0x3b83fa['push'](_0x3b83fa['shift']());}};_0x1a3082(++_0x361c65);}(_0xce33,0x83));var _0x3ce3=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xce33[_0x4cfc1d];return _0x1c01a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ce3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ce3('0x1'));var rp=require(_0x3ce3('0x2'));var moment=require('moment');var BPromise=require(_0x3ce3('0x3'));var Mustache=require(_0x3ce3('0x4'));var util=require(_0x3ce3('0x5'));var path=require('path');var sox=require(_0x3ce3('0x6'));var csv=require(_0x3ce3('0x7'));var ejs=require(_0x3ce3('0x8'));var fs=require('fs');var fs_extra=require(_0x3ce3('0x9'));var _=require('lodash');var squel=require(_0x3ce3('0xa'));var crypto=require('crypto');var jsforce=require(_0x3ce3('0xb'));var deskjs=require(_0x3ce3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3ce3('0xd'));var Papa=require(_0x3ce3('0xe'));var Redis=require(_0x3ce3('0xf'));var authService=require(_0x3ce3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3ce3('0x11'));var hardwareService=require(_0x3ce3('0x12'));var logger=require(_0x3ce3('0x13'))(_0x3ce3('0x14'));var utils=require(_0x3ce3('0x15'));var config=require(_0x3ce3('0x16'));var licenseUtil=require(_0x3ce3('0x17'));var db=require(_0x3ce3('0x18'))['db'];var integrations=require(_0x3ce3('0x19'));function respondWithStatusCode(_0x443b86,_0x593b1d){_0x593b1d=_0x593b1d||0xcc;return function(_0x136ad5){if(_0x136ad5){return _0x443b86[_0x3ce3('0x1a')](_0x593b1d);}return _0x443b86[_0x3ce3('0x1b')](_0x593b1d)[_0x3ce3('0x1c')]();};}function respondWithResult(_0xd2484,_0x180db5){_0x180db5=_0x180db5||0xc8;return function(_0x325420){if(_0x325420){return _0xd2484[_0x3ce3('0x1b')](_0x180db5)['json'](_0x325420);}};}function respondWithFilteredResult(_0x443a35,_0x3c2b19){return function(_0x3171be){if(_0x3171be){var _0x4393dd=typeof _0x3c2b19[_0x3ce3('0x1d')]===_0x3ce3('0x1e')&&typeof _0x3c2b19['limit']===_0x3ce3('0x1e');var _0x305525=_0x3171be[_0x3ce3('0x1f')];var _0x8b8f94=_0x4393dd?0x0:_0x3c2b19[_0x3ce3('0x1d')];var _0x21d848=_0x4393dd?_0x3171be[_0x3ce3('0x1f')]:_0x3c2b19[_0x3ce3('0x1d')]+_0x3c2b19[_0x3ce3('0x20')];var _0x540a8f;if(_0x21d848>=_0x305525){_0x21d848=_0x305525;_0x540a8f=0xc8;}else{_0x540a8f=0xce;}_0x443a35['status'](_0x540a8f);return _0x443a35[_0x3ce3('0x21')]('Content-Range',_0x8b8f94+'-'+_0x21d848+'/'+_0x305525)[_0x3ce3('0x22')](_0x3171be);}return null;};}function patchUpdates(_0x3af2fc){return function(_0x5d6fc3){try{jsonpatch[_0x3ce3('0x23')](_0x5d6fc3,_0x3af2fc,!![]);}catch(_0x1a4804){return BPromise[_0x3ce3('0x24')](_0x1a4804);}return _0x5d6fc3[_0x3ce3('0x25')]();};}function saveUpdates(_0x4c2aad,_0x8f6cb6){return function(_0x15d69f){if(_0x15d69f){return _0x15d69f[_0x3ce3('0x26')](_0x4c2aad)[_0x3ce3('0x27')](function(_0x43e615){return _0x43e615;});}return null;};}function removeEntity(_0x18a8dd,_0x30945e){return function(_0x27226d){if(_0x27226d){return _0x27226d[_0x3ce3('0x28')]()[_0x3ce3('0x27')](function(){_0x18a8dd['status'](0xcc)[_0x3ce3('0x1c')]();});}};}function handleEntityNotFound(_0x1f38c5,_0x48928a){return function(_0x4085ce){if(!_0x4085ce){_0x1f38c5[_0x3ce3('0x1a')](0x194);}return _0x4085ce;};}function handleError(_0x51a93e,_0x4d9cf1){_0x4d9cf1=_0x4d9cf1||0x1f4;return function(_0x2d1129){logger[_0x3ce3('0x29')](_0x2d1129[_0x3ce3('0x2a')]);if(_0x2d1129['name']){delete _0x2d1129[_0x3ce3('0x2b')];}_0x51a93e['status'](_0x4d9cf1)[_0x3ce3('0x2c')](_0x2d1129);};}exports[_0x3ce3('0x2d')]=function(_0x36d0da,_0x23f11a){var _0x3eb3e6={},_0x2b432d={},_0x144fd7={'count':0x0,'rows':[]};var _0x4741ca=_[_0x3ce3('0x2e')](db[_0x3ce3('0x2f')][_0x3ce3('0x30')],function(_0x5077c9){return{'name':_0x5077c9[_0x3ce3('0x31')],'type':_0x5077c9['type'][_0x3ce3('0x32')]};});_0x2b432d['model']=_[_0x3ce3('0x2e')](_0x4741ca,'name');_0x2b432d[_0x3ce3('0x33')]=_['keys'](_0x36d0da[_0x3ce3('0x33')]);_0x2b432d['filters']=_[_0x3ce3('0x34')](_0x2b432d[_0x3ce3('0x35')],_0x2b432d[_0x3ce3('0x33')]);_0x3eb3e6[_0x3ce3('0x36')]=_[_0x3ce3('0x34')](_0x2b432d['model'],qs['fields'](_0x36d0da[_0x3ce3('0x33')][_0x3ce3('0x37')]));_0x3eb3e6[_0x3ce3('0x36')]=_0x3eb3e6[_0x3ce3('0x36')]['length']?_0x3eb3e6['attributes']:_0x2b432d['model'];if(!_0x36d0da[_0x3ce3('0x33')]['hasOwnProperty']('nolimit')){_0x3eb3e6['limit']=qs[_0x3ce3('0x20')](_0x36d0da[_0x3ce3('0x33')][_0x3ce3('0x20')]);_0x3eb3e6[_0x3ce3('0x1d')]=qs[_0x3ce3('0x1d')](_0x36d0da[_0x3ce3('0x33')]['offset']);}_0x3eb3e6[_0x3ce3('0x38')]=qs[_0x3ce3('0x39')](_0x36d0da['query'][_0x3ce3('0x39')]);_0x3eb3e6[_0x3ce3('0x3a')]=qs[_0x3ce3('0x3b')](_[_0x3ce3('0x3c')](_0x36d0da[_0x3ce3('0x33')],_0x2b432d[_0x3ce3('0x3b')]),_0x4741ca);if(_0x36d0da[_0x3ce3('0x33')]['filter']){_0x3eb3e6[_0x3ce3('0x3a')]=_['merge'](_0x3eb3e6[_0x3ce3('0x3a')],{'$or':_[_0x3ce3('0x2e')](_0x4741ca,function(_0x39669d){if(_0x39669d[_0x3ce3('0x3d')]!==_0x3ce3('0x3e')){var _0x8d8eb={};_0x8d8eb[_0x39669d[_0x3ce3('0x2b')]]={'$like':'%'+_0x36d0da[_0x3ce3('0x33')][_0x3ce3('0x3f')]+'%'};return _0x8d8eb;}})});}_0x3eb3e6=_[_0x3ce3('0x40')]({},_0x3eb3e6,_0x36d0da['options']);var _0x1afb16={'where':_0x3eb3e6['where']};return db[_0x3ce3('0x2f')][_0x3ce3('0x1f')](_0x1afb16)[_0x3ce3('0x27')](function(_0xdf1f8e){_0x144fd7[_0x3ce3('0x1f')]=_0xdf1f8e;if(_0x36d0da[_0x3ce3('0x33')][_0x3ce3('0x41')]){_0x3eb3e6[_0x3ce3('0x42')]=[{'all':!![]}];}return db[_0x3ce3('0x2f')][_0x3ce3('0x43')](_0x3eb3e6);})[_0x3ce3('0x27')](function(_0x557777){_0x144fd7[_0x3ce3('0x44')]=_0x557777;return _0x144fd7;})[_0x3ce3('0x27')](respondWithFilteredResult(_0x23f11a,_0x3eb3e6))['catch'](handleError(_0x23f11a,null));};exports['show']=function(_0x3371b1,_0x3cde14){var _0x186e8d={'raw':![],'where':{'id':_0x3371b1['params']['id']}},_0x7da197={};_0x7da197['model']=_[_0x3ce3('0x45')](db[_0x3ce3('0x2f')][_0x3ce3('0x30')]);_0x7da197[_0x3ce3('0x33')]=_['keys'](_0x3371b1['query']);_0x7da197[_0x3ce3('0x3b')]=_[_0x3ce3('0x34')](_0x7da197['model'],_0x7da197[_0x3ce3('0x33')]);_0x186e8d[_0x3ce3('0x36')]=_['intersection'](_0x7da197[_0x3ce3('0x35')],qs[_0x3ce3('0x37')](_0x3371b1[_0x3ce3('0x33')][_0x3ce3('0x37')]));_0x186e8d['attributes']=_0x186e8d['attributes'][_0x3ce3('0x46')]?_0x186e8d[_0x3ce3('0x36')]:_0x7da197[_0x3ce3('0x35')];if(_0x3371b1[_0x3ce3('0x33')][_0x3ce3('0x41')]){_0x186e8d[_0x3ce3('0x42')]=[{'all':!![]}];}_0x186e8d=_['merge']({},_0x186e8d,_0x3371b1[_0x3ce3('0x47')]);return db[_0x3ce3('0x2f')][_0x3ce3('0x48')](_0x186e8d)[_0x3ce3('0x27')](handleEntityNotFound(_0x3cde14,null))['then'](respondWithResult(_0x3cde14,null))[_0x3ce3('0x49')](handleError(_0x3cde14,null));};exports[_0x3ce3('0x4a')]=function(_0x2df47c,_0x58a522){return db[_0x3ce3('0x2f')]['create'](_0x2df47c['body'],{})[_0x3ce3('0x27')](respondWithResult(_0x58a522,0xc9))[_0x3ce3('0x49')](handleError(_0x58a522,null));};exports[_0x3ce3('0x26')]=function(_0x21214e,_0x551a3e){if(_0x21214e[_0x3ce3('0x4b')]['id']){delete _0x21214e[_0x3ce3('0x4b')]['id'];}return db[_0x3ce3('0x2f')]['find']({'where':{'id':_0x21214e[_0x3ce3('0x4c')]['id']}})[_0x3ce3('0x27')](handleEntityNotFound(_0x551a3e,null))[_0x3ce3('0x27')](saveUpdates(_0x21214e[_0x3ce3('0x4b')],null))[_0x3ce3('0x27')](respondWithResult(_0x551a3e,null))['catch'](handleError(_0x551a3e,null));};exports[_0x3ce3('0x28')]=function(_0x15e859,_0x5453ce){return db[_0x3ce3('0x2f')][_0x3ce3('0x48')]({'where':{'id':_0x15e859[_0x3ce3('0x4c')]['id']}})[_0x3ce3('0x27')](handleEntityNotFound(_0x5453ce,null))['then'](removeEntity(_0x5453ce,null))[_0x3ce3('0x49')](handleError(_0x5453ce,null));};exports['getConfigurations']=function(_0x5193e0,_0x3143c8,_0x54133d){var _0x275d9e={};var _0x596451={};var _0x5ca9dd;var _0x3f2f53;return db[_0x3ce3('0x2f')][_0x3ce3('0x4d')]({'where':{'id':_0x5193e0[_0x3ce3('0x4c')]['id']}})[_0x3ce3('0x27')](handleEntityNotFound(_0x3143c8,null))[_0x3ce3('0x27')](function(_0x4f7254){if(_0x4f7254){_0x5ca9dd=_0x4f7254;_0x596451['model']=_[_0x3ce3('0x45')](db['FreshsalesConfiguration']['rawAttributes']);_0x596451[_0x3ce3('0x33')]=_['keys'](_0x5193e0['query']);_0x596451[_0x3ce3('0x3b')]=_['intersection'](_0x596451[_0x3ce3('0x35')],_0x596451[_0x3ce3('0x33')]);_0x275d9e[_0x3ce3('0x36')]=_[_0x3ce3('0x34')](_0x596451[_0x3ce3('0x35')],qs[_0x3ce3('0x37')](_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x37')]));_0x275d9e[_0x3ce3('0x36')]=_0x275d9e['attributes'][_0x3ce3('0x46')]?_0x275d9e[_0x3ce3('0x36')]:_0x596451['model'];_0x275d9e['order']=qs[_0x3ce3('0x39')](_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x39')]);_0x275d9e[_0x3ce3('0x3a')]=qs[_0x3ce3('0x3b')](_['pick'](_0x5193e0[_0x3ce3('0x33')],_0x596451[_0x3ce3('0x3b')]));if(_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x3f')]){_0x275d9e['where']=_[_0x3ce3('0x40')](_0x275d9e[_0x3ce3('0x3a')],{'$or':_[_0x3ce3('0x2e')](_0x275d9e[_0x3ce3('0x36')],function(_0x3194e5){var _0x597816={};_0x597816[_0x3194e5]={'$like':'%'+_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x3f')]+'%'};return _0x597816;})});}_0x275d9e=_['merge']({},_0x275d9e,_0x5193e0[_0x3ce3('0x47')]);return _0x5ca9dd[_0x3ce3('0x4e')](_0x275d9e);}})['then'](function(_0x10ea5b){if(_0x10ea5b){_0x3f2f53=_0x10ea5b[_0x3ce3('0x46')];if(!_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x4f')](_0x3ce3('0x50'))){_0x275d9e['limit']=qs['limit'](_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x20')]);_0x275d9e[_0x3ce3('0x1d')]=qs[_0x3ce3('0x1d')](_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x1d')]);}return _0x5ca9dd[_0x3ce3('0x4e')](_0x275d9e);}})[_0x3ce3('0x27')](function(_0x4e31c7){if(_0x4e31c7){return _0x4e31c7?{'count':_0x3f2f53,'rows':_0x4e31c7}:null;}})[_0x3ce3('0x27')](respondWithResult(_0x3143c8,null))[_0x3ce3('0x49')](handleError(_0x3143c8,null));};exports['addConfiguration']=function(_0x1ea71d,_0x259571,_0x39cdfa){if(_0x1ea71d[_0x3ce3('0x4b')]['id']){delete _0x1ea71d[_0x3ce3('0x4b')]['id'];}return db['FreshsalesAccount'][_0x3ce3('0x4d')]({'where':{'id':_0x1ea71d[_0x3ce3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x259571,null))[_0x3ce3('0x27')](function(_0x52c53b){if(_0x52c53b){_0x1ea71d['body']['AccountId']=_0x52c53b['id'];_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x51')]=integrations[_0x3ce3('0x52')](_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x53')],_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x3d')]);_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x54')]=integrations[_0x3ce3('0x55')](_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x53')],_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x3d')]);return db[_0x3ce3('0x56')][_0x3ce3('0x4a')](_0x1ea71d[_0x3ce3('0x4b')],{'include':[{'model':db[_0x3ce3('0x57')],'as':_0x3ce3('0x51')},{'model':db[_0x3ce3('0x57')],'as':_0x3ce3('0x54')}]});}return null;})[_0x3ce3('0x27')](respondWithResult(_0x259571,null))['catch'](handleError(_0x259571,null));};exports[_0x3ce3('0x58')]=function(_0xb6693f,_0x2f3625,_0x5db250){var _0x5a1b44='';var _0x463499='';return db['FreshsalesAccount'][_0x3ce3('0x4d')]({'where':{'id':_0xb6693f[_0x3ce3('0x4c')]['id']},'attributes':['id','username',_0x3ce3('0x59'),'apiKey']})['then'](handleEntityNotFound(_0x2f3625,null))[_0x3ce3('0x27')](function(_0x5b368e){if(_0x5b368e){_0x463499=_0x5b368e[_0x3ce3('0x5a')];_0x5a1b44=_0x5b368e['remoteUri'];var _0x3f9eac=_0x5b368e[_0x3ce3('0x59')][_0x3ce3('0x5b')](-0x1);if(_0x3f9eac==='/'){_0x5a1b44=_0x5a1b44[_0x3ce3('0x5c')](0x0,_0x5a1b44[_0x3ce3('0x5d')](_0x3f9eac));}return rp({'method':'GET','uri':util['format'](_0x3ce3('0x5e'),_0x5a1b44,_0x3ce3('0x5f')),'headers':{'Authorization':_0x3ce3('0x60')+_0x5b368e[_0x3ce3('0x61')]},'json':!![]});}})[_0x3ce3('0x27')](function(_0x4b1625){if(_0x4b1625){var _0x4abde4=_0x4b1625[_0x3ce3('0x62')];var _0x115c3b=![];var _0x1d537c=null;for(_0x1d537c=0x0;_0x1d537c<_0x4abde4[_0x3ce3('0x46')];_0x1d537c++){if(_0x4abde4[_0x1d537c][_0x3ce3('0x63')]===_0x463499){_0x115c3b=!![];}}if(_0x115c3b){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3ce3('0x64')});}}})['then'](respondWithResult(_0x2f3625,null))['catch'](function(_0x7f3171){var _0x71f550=_0xb6693f[_0x3ce3('0x33')][_0x3ce3('0x65')]?0x1f4:_0x7f3171[_0x3ce3('0x66')]||0x1f4;logger[_0x3ce3('0x29')](_0x3ce3('0x67'),'getFields',_0x71f550,JSON[_0x3ce3('0x68')](_0x7f3171));delete _0x7f3171[_0x3ce3('0x2b')];if(_0x71f550===0x191){_0x71f550=0x190;}_0x2f3625['status'](_0x71f550)[_0x3ce3('0x2c')](_0xb6693f[_0x3ce3('0x33')]['test']?{'message':_0x3ce3('0x69'),'statusCode':_0x7f3171[_0x3ce3('0x66')]}:_0x7f3171);});}; \ No newline at end of file +var _0x6544=['getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','findOne','order','options','nolimit','addConfiguration','AccountId','channel','getDescriptions','FreshsalesConfiguration','Subjects','FreshsalesField','Descriptions'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x6544,0x151));var _0x4654=function(_0x11a84d,_0x4dbd0e){_0x11a84d=_0x11a84d-0x0;var _0x1e6b48=_0x6544[_0x11a84d];return _0x1e6b48;};'use strict';var emlformat=require(_0x4654('0x0'));var rimraf=require(_0x4654('0x1'));var zipdir=require(_0x4654('0x2'));var jsonpatch=require(_0x4654('0x3'));var rp=require(_0x4654('0x4'));var moment=require(_0x4654('0x5'));var BPromise=require(_0x4654('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4654('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4654('0x8'));var _=require(_0x4654('0x9'));var squel=require(_0x4654('0xa'));var crypto=require(_0x4654('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4654('0xc'));var toCsv=require(_0x4654('0xd'));var querystring=require(_0x4654('0xe'));var Papa=require(_0x4654('0xf'));var Redis=require(_0x4654('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4654('0x11'));var as=require(_0x4654('0x12'));var hardwareService=require(_0x4654('0x13'));var logger=require(_0x4654('0x14'))('api');var utils=require(_0x4654('0x15'));var config=require(_0x4654('0x16'));var licenseUtil=require(_0x4654('0x17'));var db=require(_0x4654('0x18'))['db'];var integrations=require(_0x4654('0x19'));function respondWithStatusCode(_0x49d503,_0x28dacc){_0x28dacc=_0x28dacc||0xcc;return function(_0x30898a){if(_0x30898a){return _0x49d503[_0x4654('0x1a')](_0x28dacc);}return _0x49d503['status'](_0x28dacc)[_0x4654('0x1b')]();};}function respondWithResult(_0x47d4ef,_0x371208){_0x371208=_0x371208||0xc8;return function(_0x3593fc){if(_0x3593fc){return _0x47d4ef[_0x4654('0x1c')](_0x371208)['json'](_0x3593fc);}};}function respondWithFilteredResult(_0x191f0b,_0x4786cf){return function(_0x2e863a){if(_0x2e863a){var _0x1f948c=typeof _0x4786cf[_0x4654('0x1d')]===_0x4654('0x1e')&&typeof _0x4786cf[_0x4654('0x1f')]===_0x4654('0x1e');var _0x5d407c=_0x2e863a[_0x4654('0x20')];var _0xde235f=_0x1f948c?0x0:_0x4786cf[_0x4654('0x1d')];var _0x433111=_0x1f948c?_0x2e863a['count']:_0x4786cf['offset']+_0x4786cf['limit'];var _0x4a9cd7;if(_0x433111>=_0x5d407c){_0x433111=_0x5d407c;_0x4a9cd7=0xc8;}else{_0x4a9cd7=0xce;}_0x191f0b[_0x4654('0x1c')](_0x4a9cd7);return _0x191f0b[_0x4654('0x21')]('Content-Range',_0xde235f+'-'+_0x433111+'/'+_0x5d407c)[_0x4654('0x22')](_0x2e863a);}return null;};}function patchUpdates(_0x5e5640){return function(_0x34a7fe){try{jsonpatch['apply'](_0x34a7fe,_0x5e5640,!![]);}catch(_0x4f135f){return BPromise[_0x4654('0x23')](_0x4f135f);}return _0x34a7fe[_0x4654('0x24')]();};}function saveUpdates(_0x25c9df,_0x59007f){return function(_0x410738){if(_0x410738){return _0x410738[_0x4654('0x25')](_0x25c9df)[_0x4654('0x26')](function(_0xebc3fa){return _0xebc3fa;});}return null;};}function removeEntity(_0x2742b7,_0x3d459a){return function(_0x362fcc){if(_0x362fcc){return _0x362fcc[_0x4654('0x27')]()[_0x4654('0x26')](function(){_0x2742b7[_0x4654('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54fa8b,_0x38405f){return function(_0x5b312e){if(!_0x5b312e){_0x54fa8b[_0x4654('0x1a')](0x194);}return _0x5b312e;};}function handleError(_0x3d1f80,_0x3b0259){_0x3b0259=_0x3b0259||0x1f4;return function(_0x12ded6){logger[_0x4654('0x28')](_0x12ded6[_0x4654('0x29')]);if(_0x12ded6[_0x4654('0x2a')]){delete _0x12ded6[_0x4654('0x2a')];}_0x3d1f80[_0x4654('0x1c')](_0x3b0259)[_0x4654('0x2b')](_0x12ded6);};}exports[_0x4654('0x2c')]=function(_0x4bb0b3,_0x55661d){var _0x587d4c={},_0x39e471={},_0x4adb76={'count':0x0,'rows':[]};var _0x586164=_[_0x4654('0x2d')](db[_0x4654('0x2e')][_0x4654('0x2f')],function(_0x4ba356){return{'name':_0x4ba356[_0x4654('0x30')],'type':_0x4ba356[_0x4654('0x31')][_0x4654('0x32')]};});_0x39e471[_0x4654('0x33')]=_[_0x4654('0x2d')](_0x586164,_0x4654('0x2a'));_0x39e471[_0x4654('0x34')]=_[_0x4654('0x35')](_0x4bb0b3[_0x4654('0x34')]);_0x39e471[_0x4654('0x36')]=_[_0x4654('0x37')](_0x39e471[_0x4654('0x33')],_0x39e471['query']);_0x587d4c['attributes']=_[_0x4654('0x37')](_0x39e471['model'],qs['fields'](_0x4bb0b3['query']['fields']));_0x587d4c['attributes']=_0x587d4c[_0x4654('0x38')][_0x4654('0x39')]?_0x587d4c[_0x4654('0x38')]:_0x39e471['model'];if(!_0x4bb0b3[_0x4654('0x34')]['hasOwnProperty']('nolimit')){_0x587d4c[_0x4654('0x1f')]=qs[_0x4654('0x1f')](_0x4bb0b3[_0x4654('0x34')]['limit']);_0x587d4c[_0x4654('0x1d')]=qs[_0x4654('0x1d')](_0x4bb0b3['query'][_0x4654('0x1d')]);}_0x587d4c['order']=qs[_0x4654('0x3a')](_0x4bb0b3[_0x4654('0x34')][_0x4654('0x3a')]);_0x587d4c[_0x4654('0x3b')]=qs[_0x4654('0x36')](_[_0x4654('0x3c')](_0x4bb0b3[_0x4654('0x34')],_0x39e471[_0x4654('0x36')]),_0x586164);if(_0x4bb0b3['query'][_0x4654('0x3d')]){_0x587d4c['where']=_['merge'](_0x587d4c[_0x4654('0x3b')],{'$or':_['map'](_0x586164,function(_0x1664ba){if(_0x1664ba[_0x4654('0x31')]!==_0x4654('0x3e')){var _0x2a92eb={};_0x2a92eb[_0x1664ba['name']]={'$like':'%'+_0x4bb0b3[_0x4654('0x34')][_0x4654('0x3d')]+'%'};return _0x2a92eb;}})});}_0x587d4c=_[_0x4654('0x3f')]({},_0x587d4c,_0x4bb0b3['options']);var _0x4b2eb4={'where':_0x587d4c['where']};return db[_0x4654('0x2e')][_0x4654('0x20')](_0x4b2eb4)['then'](function(_0x108d98){_0x4adb76[_0x4654('0x20')]=_0x108d98;if(_0x4bb0b3['query'][_0x4654('0x40')]){_0x587d4c[_0x4654('0x41')]=[{'all':!![]}];}return db[_0x4654('0x2e')][_0x4654('0x42')](_0x587d4c);})['then'](function(_0x560d2d){_0x4adb76[_0x4654('0x43')]=_0x560d2d;return _0x4adb76;})[_0x4654('0x26')](respondWithFilteredResult(_0x55661d,_0x587d4c))[_0x4654('0x44')](handleError(_0x55661d,null));};exports[_0x4654('0x45')]=function(_0x49cac0,_0x201945){var _0xbf22bf={'raw':![],'where':{'id':_0x49cac0[_0x4654('0x46')]['id']}},_0x5119c0={};_0x5119c0[_0x4654('0x33')]=_[_0x4654('0x35')](db[_0x4654('0x2e')][_0x4654('0x2f')]);_0x5119c0[_0x4654('0x34')]=_[_0x4654('0x35')](_0x49cac0[_0x4654('0x34')]);_0x5119c0[_0x4654('0x36')]=_[_0x4654('0x37')](_0x5119c0[_0x4654('0x33')],_0x5119c0['query']);_0xbf22bf[_0x4654('0x38')]=_[_0x4654('0x37')](_0x5119c0['model'],qs[_0x4654('0x47')](_0x49cac0['query'][_0x4654('0x47')]));_0xbf22bf[_0x4654('0x38')]=_0xbf22bf[_0x4654('0x38')]['length']?_0xbf22bf[_0x4654('0x38')]:_0x5119c0['model'];if(_0x49cac0[_0x4654('0x34')][_0x4654('0x40')]){_0xbf22bf[_0x4654('0x41')]=[{'all':!![]}];}_0xbf22bf=_[_0x4654('0x3f')]({},_0xbf22bf,_0x49cac0['options']);return db['FreshsalesAccount'][_0x4654('0x48')](_0xbf22bf)[_0x4654('0x26')](handleEntityNotFound(_0x201945,null))[_0x4654('0x26')](respondWithResult(_0x201945,null))[_0x4654('0x44')](handleError(_0x201945,null));};exports[_0x4654('0x49')]=function(_0x10d0e9,_0xef657){return db[_0x4654('0x2e')][_0x4654('0x49')](_0x10d0e9[_0x4654('0x4a')],{})[_0x4654('0x26')](respondWithResult(_0xef657,0xc9))[_0x4654('0x44')](handleError(_0xef657,null));};exports['update']=function(_0x403b23,_0x73d0d3){if(_0x403b23[_0x4654('0x4a')]['id']){delete _0x403b23['body']['id'];}return db[_0x4654('0x2e')]['find']({'where':{'id':_0x403b23[_0x4654('0x46')]['id']}})[_0x4654('0x26')](handleEntityNotFound(_0x73d0d3,null))[_0x4654('0x26')](saveUpdates(_0x403b23[_0x4654('0x4a')],null))['then'](respondWithResult(_0x73d0d3,null))[_0x4654('0x44')](handleError(_0x73d0d3,null));};exports[_0x4654('0x27')]=function(_0x1a776f,_0x1ef32c){return db[_0x4654('0x2e')]['find']({'where':{'id':_0x1a776f[_0x4654('0x46')]['id']}})[_0x4654('0x26')](handleEntityNotFound(_0x1ef32c,null))[_0x4654('0x26')](removeEntity(_0x1ef32c,null))[_0x4654('0x44')](handleError(_0x1ef32c,null));};exports['getConfigurations']=function(_0x428c4b,_0x765143,_0x37c38c){var _0x35475a={};var _0xca0ddb={};var _0x5e8de8;var _0x1ebb82;return db[_0x4654('0x2e')][_0x4654('0x4b')]({'where':{'id':_0x428c4b[_0x4654('0x46')]['id']}})['then'](handleEntityNotFound(_0x765143,null))['then'](function(_0x1e8b15){if(_0x1e8b15){_0x5e8de8=_0x1e8b15;_0xca0ddb[_0x4654('0x33')]=_[_0x4654('0x35')](db['FreshsalesConfiguration'][_0x4654('0x2f')]);_0xca0ddb[_0x4654('0x34')]=_[_0x4654('0x35')](_0x428c4b[_0x4654('0x34')]);_0xca0ddb[_0x4654('0x36')]=_[_0x4654('0x37')](_0xca0ddb[_0x4654('0x33')],_0xca0ddb['query']);_0x35475a[_0x4654('0x38')]=_[_0x4654('0x37')](_0xca0ddb['model'],qs[_0x4654('0x47')](_0x428c4b[_0x4654('0x34')][_0x4654('0x47')]));_0x35475a[_0x4654('0x38')]=_0x35475a[_0x4654('0x38')]['length']?_0x35475a['attributes']:_0xca0ddb[_0x4654('0x33')];_0x35475a[_0x4654('0x4c')]=qs[_0x4654('0x3a')](_0x428c4b[_0x4654('0x34')][_0x4654('0x3a')]);_0x35475a[_0x4654('0x3b')]=qs[_0x4654('0x36')](_['pick'](_0x428c4b[_0x4654('0x34')],_0xca0ddb[_0x4654('0x36')]));if(_0x428c4b['query']['filter']){_0x35475a[_0x4654('0x3b')]=_[_0x4654('0x3f')](_0x35475a[_0x4654('0x3b')],{'$or':_['map'](_0x35475a['attributes'],function(_0x396456){var _0x2e8527={};_0x2e8527[_0x396456]={'$like':'%'+_0x428c4b[_0x4654('0x34')][_0x4654('0x3d')]+'%'};return _0x2e8527;})});}_0x35475a=_[_0x4654('0x3f')]({},_0x35475a,_0x428c4b[_0x4654('0x4d')]);return _0x5e8de8['getConfigurations'](_0x35475a);}})[_0x4654('0x26')](function(_0x5c57c1){if(_0x5c57c1){_0x1ebb82=_0x5c57c1[_0x4654('0x39')];if(!_0x428c4b[_0x4654('0x34')]['hasOwnProperty'](_0x4654('0x4e'))){_0x35475a[_0x4654('0x1f')]=qs['limit'](_0x428c4b[_0x4654('0x34')][_0x4654('0x1f')]);_0x35475a[_0x4654('0x1d')]=qs[_0x4654('0x1d')](_0x428c4b[_0x4654('0x34')]['offset']);}return _0x5e8de8['getConfigurations'](_0x35475a);}})[_0x4654('0x26')](function(_0x39eb45){if(_0x39eb45){return _0x39eb45?{'count':_0x1ebb82,'rows':_0x39eb45}:null;}})[_0x4654('0x26')](respondWithResult(_0x765143,null))[_0x4654('0x44')](handleError(_0x765143,null));};exports[_0x4654('0x4f')]=function(_0x423f02,_0x522f5a,_0x6c7ebc){if(_0x423f02['body']['id']){delete _0x423f02['body']['id'];}return db[_0x4654('0x2e')][_0x4654('0x4b')]({'where':{'id':_0x423f02[_0x4654('0x46')]['id']}})[_0x4654('0x26')](handleEntityNotFound(_0x522f5a,null))[_0x4654('0x26')](function(_0x5be1d8){if(_0x5be1d8){_0x423f02[_0x4654('0x4a')][_0x4654('0x50')]=_0x5be1d8['id'];_0x423f02['body']['Subjects']=integrations['getSubjects'](_0x423f02[_0x4654('0x4a')][_0x4654('0x51')],_0x423f02[_0x4654('0x4a')]['type']);_0x423f02[_0x4654('0x4a')]['Descriptions']=integrations[_0x4654('0x52')](_0x423f02[_0x4654('0x4a')][_0x4654('0x51')],_0x423f02[_0x4654('0x4a')][_0x4654('0x31')]);return db[_0x4654('0x53')][_0x4654('0x49')](_0x423f02[_0x4654('0x4a')],{'include':[{'model':db['FreshsalesField'],'as':_0x4654('0x54')},{'model':db[_0x4654('0x55')],'as':_0x4654('0x56')}]});}return null;})[_0x4654('0x26')](respondWithResult(_0x522f5a,null))[_0x4654('0x44')](handleError(_0x522f5a,null));};exports[_0x4654('0x57')]=function(_0x22f18b,_0x5ced92,_0x352090){var _0x39d26d='';var _0x47e4d0='';return db[_0x4654('0x2e')][_0x4654('0x4b')]({'where':{'id':_0x22f18b['params']['id']},'attributes':['id',_0x4654('0x58'),_0x4654('0x59'),_0x4654('0x5a')]})[_0x4654('0x26')](handleEntityNotFound(_0x5ced92,null))[_0x4654('0x26')](function(_0x4971c8){if(_0x4971c8){_0x47e4d0=_0x4971c8[_0x4654('0x58')];_0x39d26d=_0x4971c8['remoteUri'];var _0x424dc8=_0x4971c8['remoteUri'][_0x4654('0x5b')](-0x1);if(_0x424dc8==='/'){_0x39d26d=_0x39d26d[_0x4654('0x5c')](0x0,_0x39d26d[_0x4654('0x5d')](_0x424dc8));}return rp({'method':_0x4654('0x5e'),'uri':util[_0x4654('0x5f')](_0x4654('0x60'),_0x39d26d,_0x4654('0x61')),'headers':{'Authorization':_0x4654('0x62')+_0x4971c8['apiKey']},'json':!![]});}})['then'](function(_0xfa2a2){if(_0xfa2a2){var _0xec03e9=_0xfa2a2[_0x4654('0x63')];var _0x339a77=![];var _0x14e86f=null;for(_0x14e86f=0x0;_0x14e86f<_0xec03e9[_0x4654('0x39')];_0x14e86f++){if(_0xec03e9[_0x14e86f]['email']===_0x47e4d0){_0x339a77=!![];}}if(_0x339a77){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4654('0x64')});}}})[_0x4654('0x26')](respondWithResult(_0x5ced92,null))[_0x4654('0x44')](function(_0x25b7b){var _0x50c976=_0x22f18b[_0x4654('0x34')][_0x4654('0x65')]?0x1f4:_0x25b7b[_0x4654('0x66')]||0x1f4;logger[_0x4654('0x28')](_0x4654('0x67'),_0x4654('0x57'),_0x50c976,JSON[_0x4654('0x68')](_0x25b7b));delete _0x25b7b['name'];if(_0x50c976===0x191){_0x50c976=0x190;}_0x5ced92['status'](_0x50c976)[_0x4654('0x2b')](_0x22f18b['query'][_0x4654('0x65')]?{'message':_0x4654('0x69'),'statusCode':_0x25b7b[_0x4654('0x66')]}:_0x25b7b);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f004ae5..993f9a0 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 _0x53ec=['path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x53ec,0x192));var _0xc53e=function(_0x1442bb,_0x1f994e){_0x1442bb=_0x1442bb-0x0;var _0x1d9b35=_0x53ec[_0x1442bb];return _0x1d9b35;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xc53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a85=['moment','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','../../config/logger','api'];(function(_0x22b9d2,_0x2715bb){var _0x489a8e=function(_0x5934c0){while(--_0x5934c0){_0x22b9d2['push'](_0x22b9d2['shift']());}};_0x489a8e(++_0x2715bb);}(_0x1a85,0x178));var _0x51a8=function(_0x4b043b,_0x598b17){_0x4b043b=_0x4b043b-0x0;var _0x398f5a=_0x1a85[_0x4b043b];return _0x398f5a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x51a8('0x6'));module['exports']=function(_0x2c1180,_0x5cf430){return _0x2c1180[_0x51a8('0x7')](_0x51a8('0x8'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 315203e..1872bd9 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 _0xacf4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowFreshsalesAccount'];(function(_0x4aea1c,_0x3a6980){var _0x4b7ae5=function(_0xb7770f){while(--_0xb7770f){_0x4aea1c['push'](_0x4aea1c['shift']());}};_0x4b7ae5(++_0x3a6980);}(_0xacf4,0xe7));var _0x4acf=function(_0x2e9155,_0x32eb3f){_0x2e9155=_0x2e9155-0x0;var _0x45092a=_0xacf4[_0x2e9155];return _0x45092a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});}exports[_0x4acf('0x13')]=function(_0x240c00){var _0x4b1d93=this;return new Promise(function(_0x2a678b,_0x137302){return db[_0x4acf('0x14')][_0x4acf('0x15')]({'raw':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'where':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x18')]||null:null,'attributes':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x19')]||null:null,'limit':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1a')]||null:null,'include':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x240c00[_0x4acf('0x16')][_0x4acf('0x1b')],function(_0x53885f){return{'model':db[_0x53885f[_0x4acf('0x1d')]],'as':_0x53885f['as'],'attributes':_0x53885f[_0x4acf('0x19')],'include':_0x53885f['include']?_[_0x4acf('0x1c')](_0x53885f[_0x4acf('0x1b')],function(_0x52a84a){return{'model':db[_0x52a84a[_0x4acf('0x1d')]],'as':_0x52a84a['as'],'attributes':_0x52a84a[_0x4acf('0x19')],'include':_0x52a84a[_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x52a84a['include'],function(_0x50236d){return{'model':db[_0x50236d[_0x4acf('0x1d')]],'as':_0x50236d['as'],'attributes':_0x50236d[_0x4acf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4acf('0xa')](function(_0x42c90c){logger[_0x4acf('0xb')](_0x4acf('0x13'),_0x240c00);logger[_0x4acf('0x1e')](_0x4acf('0x13'),_0x240c00,JSON[_0x4acf('0x1f')](_0x42c90c));_0x2a678b(_0x42c90c);})[_0x4acf('0x12')](function(_0x57989e){logger[_0x4acf('0xf')](_0x4acf('0x13'),_0x57989e[_0x4acf('0x10')],_0x240c00);_0x137302(_0x4b1d93[_0x4acf('0xf')](0x1f4,_0x57989e[_0x4acf('0x10')]));});});};exports[_0x4acf('0x20')]=function(_0x27384c){var _0x5d862f=this;return new Promise(function(_0x337b3c,_0x1d221b){return db[_0x4acf('0x14')]['find']({'raw':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'where':_0x27384c[_0x4acf('0x16')]?_0x27384c['options'][_0x4acf('0x18')]||null:null,'attributes':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')]['attributes']||null:null,'include':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')][_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x27384c[_0x4acf('0x16')][_0x4acf('0x1b')],function(_0x490880){return{'model':db[_0x490880[_0x4acf('0x1d')]],'as':_0x490880['as'],'attributes':_0x490880[_0x4acf('0x19')],'include':_0x490880['include']?_[_0x4acf('0x1c')](_0x490880['include'],function(_0x4cd020){return{'model':db[_0x4cd020['model']],'as':_0x4cd020['as'],'attributes':_0x4cd020['attributes'],'include':_0x4cd020['include']?_['map'](_0x4cd020['include'],function(_0x3364dd){return{'model':db[_0x3364dd[_0x4acf('0x1d')]],'as':_0x3364dd['as'],'attributes':_0x3364dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x4acf('0xa')](function(_0xbd0f92){logger[_0x4acf('0xb')](_0x4acf('0x20'),_0x27384c);logger[_0x4acf('0x1e')](_0x4acf('0x20'),_0x27384c,JSON[_0x4acf('0x1f')](_0xbd0f92));_0x337b3c(_0xbd0f92);})[_0x4acf('0x12')](function(_0x24465b){logger[_0x4acf('0xf')]('ShowFreshsalesAccount',_0x24465b['message'],_0x27384c);_0x1d221b(_0x5d862f[_0x4acf('0xf')](0x1f4,_0x24465b[_0x4acf('0x10')]));});});}; \ No newline at end of file +var _0x82c4=['findAll','options','raw','attributes','include','map','model','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x82c4,0x1ca));var _0x482c=function(_0x43f084,_0xb48804){_0x43f084=_0x43f084-0x0;var _0x2a6dde=_0x82c4[_0x43f084];return _0x2a6dde;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['FreshsalesAccount'][_0x482c('0x16')]({'raw':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['where']||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x19')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['limit']||null:null,'include':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x5b6f7e['options'][_0x482c('0x1a')],function(_0x579d2f){return{'model':db[_0x579d2f[_0x482c('0x1c')]],'as':_0x579d2f['as'],'attributes':_0x579d2f[_0x482c('0x19')],'include':_0x579d2f['include']?_[_0x482c('0x1b')](_0x579d2f['include'],function(_0x589bc6){return{'model':db[_0x589bc6[_0x482c('0x1c')]],'as':_0x589bc6['as'],'attributes':_0x589bc6[_0x482c('0x19')],'include':_0x589bc6[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x589bc6[_0x482c('0x1a')],function(_0x215826){return{'model':db[_0x215826[_0x482c('0x1c')]],'as':_0x215826['as'],'attributes':_0x215826['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0xa')](function(_0x255417){logger['info'](_0x482c('0x15'),_0x5b6f7e);logger['debug']('GetFreshsalesAccount',_0x5b6f7e,JSON[_0x482c('0xf')](_0x255417));_0x258148(_0x255417);})['catch'](function(_0x1ac1c4){logger[_0x482c('0x10')](_0x482c('0x15'),_0x1ac1c4[_0x482c('0x12')],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x1ac1c4[_0x482c('0x12')]));});});};exports[_0x482c('0x1d')]=function(_0x3e9b22){var _0x24b4df=this;return new Promise(function(_0x2d3800,_0x3135a7){return db[_0x482c('0x1e')][_0x482c('0x1f')]({'raw':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')]['where']||null:null,'attributes':_0x3e9b22['options']?_0x3e9b22['options'][_0x482c('0x19')]||null:null,'include':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x1a')]?_['map'](_0x3e9b22[_0x482c('0x17')]['include'],function(_0x31428c){return{'model':db[_0x31428c[_0x482c('0x1c')]],'as':_0x31428c['as'],'attributes':_0x31428c[_0x482c('0x19')],'include':_0x31428c[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x31428c[_0x482c('0x1a')],function(_0x129a31){return{'model':db[_0x129a31[_0x482c('0x1c')]],'as':_0x129a31['as'],'attributes':_0x129a31['attributes'],'include':_0x129a31['include']?_[_0x482c('0x1b')](_0x129a31['include'],function(_0xe62a02){return{'model':db[_0xe62a02[_0x482c('0x1c')]],'as':_0xe62a02['as'],'attributes':_0xe62a02[_0x482c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cbaa){logger[_0x482c('0xb')](_0x482c('0x1d'),_0x3e9b22);logger[_0x482c('0xe')]('ShowFreshsalesAccount',_0x3e9b22,JSON[_0x482c('0xf')](_0x29cbaa));_0x2d3800(_0x29cbaa);})['catch'](function(_0x1de7f4){logger['error'](_0x482c('0x1d'),_0x1de7f4['message'],_0x3e9b22);_0x3135a7(_0x24b4df[_0x482c('0x10')](0x1f4,_0x1de7f4[_0x482c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index d841fae..667f0c2 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 _0x0a1d=['./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20c80f,_0x4b54c9){var _0x2b62e1=function(_0x3f4f42){while(--_0x3f4f42){_0x20c80f['push'](_0x20c80f['shift']());}};_0x2b62e1(++_0x4b54c9);}(_0x0a1d,0x1dc));var _0xd0a1=function(_0x2ce9b3,_0xcc5a79){_0x2ce9b3=_0x2ce9b3-0x0;var _0x796a07=_0x0a1d[_0x2ce9b3];return _0x796a07;};'use strict';var multer=require('multer');var util=require(_0xd0a1('0x0'));var path=require(_0xd0a1('0x1'));var timeout=require(_0xd0a1('0x2'));var express=require('express');var router=express[_0xd0a1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd0a1('0x4'));var interaction=require(_0xd0a1('0x5'));var config=require(_0xd0a1('0x6'));var controller=require(_0xd0a1('0x7'));router[_0xd0a1('0x8')]('/',auth['isAuthenticated'](),controller[_0xd0a1('0x9')]);router[_0xd0a1('0x8')](_0xd0a1('0xa'),auth[_0xd0a1('0xb')](),controller[_0xd0a1('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd0a1('0xd')]);router[_0xd0a1('0x8')]('/:id/descriptions',auth[_0xd0a1('0xb')](),controller[_0xd0a1('0xe')]);router[_0xd0a1('0x8')](_0xd0a1('0xf'),auth['isAuthenticated'](),controller[_0xd0a1('0x10')]);router[_0xd0a1('0x11')]('/',auth['isAuthenticated'](),controller[_0xd0a1('0x12')]);router[_0xd0a1('0x13')](_0xd0a1('0xa'),auth[_0xd0a1('0xb')](),controller['update']);router[_0xd0a1('0x14')](_0xd0a1('0xa'),auth[_0xd0a1('0xb')](),controller[_0xd0a1('0x15')]);module[_0xd0a1('0x16')]=router; \ No newline at end of file +var _0x6852=['./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x52395d,_0x4d477b){var _0x4c11ea=function(_0x41ea8d){while(--_0x41ea8d){_0x52395d['push'](_0x52395d['shift']());}};_0x4c11ea(++_0x4d477b);}(_0x6852,0x1d9));var _0x2685=function(_0x4a36d0,_0x104693){_0x4a36d0=_0x4a36d0-0x0;var _0x1d6da8=_0x6852[_0x4a36d0];return _0x1d6da8;};'use strict';var multer=require(_0x2685('0x0'));var util=require(_0x2685('0x1'));var path=require(_0x2685('0x2'));var timeout=require(_0x2685('0x3'));var express=require('express');var router=express[_0x2685('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2685('0x5'));var interaction=require(_0x2685('0x6'));var config=require('../../config/environment');var controller=require(_0x2685('0x7'));router[_0x2685('0x8')]('/',auth[_0x2685('0x9')](),controller[_0x2685('0xa')]);router[_0x2685('0x8')](_0x2685('0xb'),auth[_0x2685('0x9')](),controller[_0x2685('0xc')]);router[_0x2685('0x8')](_0x2685('0xd'),auth[_0x2685('0x9')](),controller[_0x2685('0xe')]);router[_0x2685('0x8')](_0x2685('0xf'),auth[_0x2685('0x9')](),controller[_0x2685('0x10')]);router[_0x2685('0x8')](_0x2685('0x11'),auth['isAuthenticated'](),controller[_0x2685('0x12')]);router[_0x2685('0x13')]('/',auth[_0x2685('0x9')](),controller['create']);router[_0x2685('0x14')](_0x2685('0xb'),auth[_0x2685('0x9')](),controller[_0x2685('0x15')]);router[_0x2685('0x16')](_0x2685('0xb'),auth[_0x2685('0x9')](),controller['destroy']);module[_0x2685('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 5104509..bc093e0 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 _0x719b=['sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x719b,0xde));var _0xb719=function(_0x1d590a,_0x41916a){_0x1d590a=_0x1d590a-0x0;var _0x4bd1dd=_0x719b[_0x1d590a];return _0x4bd1dd;};'use strict';var Sequelize=require(_0xb719('0x0'));module[_0xb719('0x1')]={'name':{'type':Sequelize[_0xb719('0x2')]},'description':{'type':Sequelize[_0xb719('0x2')]}}; \ No newline at end of file +var _0x55c9=['exports','STRING','sequelize'];(function(_0x5eb219,_0x4558cd){var _0x4c625a=function(_0x456a44){while(--_0x456a44){_0x5eb219['push'](_0x5eb219['shift']());}};_0x4c625a(++_0x4558cd);}(_0x55c9,0x19d));var _0x955c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x55c9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x955c('0x0'));module[_0x955c('0x1')]={'name':{'type':Sequelize[_0x955c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a1cdbbf..a8c2ce3 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 _0xc1b6=['includeAll','find','create','body','params','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','map','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesConfiguration','include','findAll','rows','catch','show'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc1b6,0x1de));var _0x6c1b=function(_0x50478e,_0x404854){_0x50478e=_0x50478e-0x0;var _0x190c0e=_0xc1b6[_0x50478e];return _0x190c0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c1b('0x0'));var zipdir=require(_0x6c1b('0x1'));var jsonpatch=require(_0x6c1b('0x2'));var rp=require(_0x6c1b('0x3'));var moment=require(_0x6c1b('0x4'));var BPromise=require(_0x6c1b('0x5'));var Mustache=require(_0x6c1b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6c1b('0x7'));var csv=require(_0x6c1b('0x8'));var ejs=require(_0x6c1b('0x9'));var fs=require('fs');var fs_extra=require(_0x6c1b('0xa'));var _=require(_0x6c1b('0xb'));var squel=require(_0x6c1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x6c1b('0xd'));var deskjs=require(_0x6c1b('0xe'));var toCsv=require(_0x6c1b('0x8'));var querystring=require('querystring');var Papa=require(_0x6c1b('0xf'));var Redis=require(_0x6c1b('0x10'));var authService=require(_0x6c1b('0x11'));var qs=require(_0x6c1b('0x12'));var as=require(_0x6c1b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c1b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6c1b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1b('0x16'))['db'];function respondWithStatusCode(_0x44f2b3,_0x10edd4){_0x10edd4=_0x10edd4||0xcc;return function(_0x5c67db){if(_0x5c67db){return _0x44f2b3[_0x6c1b('0x17')](_0x10edd4);}return _0x44f2b3['status'](_0x10edd4)[_0x6c1b('0x18')]();};}function respondWithResult(_0xd7d7c6,_0x2555a3){_0x2555a3=_0x2555a3||0xc8;return function(_0x6d842e){if(_0x6d842e){return _0xd7d7c6[_0x6c1b('0x19')](_0x2555a3)[_0x6c1b('0x1a')](_0x6d842e);}};}function respondWithFilteredResult(_0x1a3727,_0x41176d){return function(_0x2adba4){if(_0x2adba4){var _0x208d6c=typeof _0x41176d[_0x6c1b('0x1b')]==='undefined'&&typeof _0x41176d['limit']===_0x6c1b('0x1c');var _0x5f0c87=_0x2adba4[_0x6c1b('0x1d')];var _0x5b8d4e=_0x208d6c?0x0:_0x41176d[_0x6c1b('0x1b')];var _0x3cd8f5=_0x208d6c?_0x2adba4[_0x6c1b('0x1d')]:_0x41176d['offset']+_0x41176d[_0x6c1b('0x1e')];var _0x18c3fc;if(_0x3cd8f5>=_0x5f0c87){_0x3cd8f5=_0x5f0c87;_0x18c3fc=0xc8;}else{_0x18c3fc=0xce;}_0x1a3727[_0x6c1b('0x19')](_0x18c3fc);return _0x1a3727[_0x6c1b('0x1f')](_0x6c1b('0x20'),_0x5b8d4e+'-'+_0x3cd8f5+'/'+_0x5f0c87)[_0x6c1b('0x1a')](_0x2adba4);}return null;};}function patchUpdates(_0x53a966){return function(_0x8fdd67){try{jsonpatch[_0x6c1b('0x21')](_0x8fdd67,_0x53a966,!![]);}catch(_0x282d4e){return BPromise[_0x6c1b('0x22')](_0x282d4e);}return _0x8fdd67[_0x6c1b('0x23')]();};}function saveUpdates(_0x430172,_0x43df6d){return function(_0x47100b){if(_0x47100b){return _0x47100b[_0x6c1b('0x24')](_0x430172)[_0x6c1b('0x25')](function(_0xa367a0){return _0xa367a0;});}return null;};}function removeEntity(_0x906d24,_0x286dc3){return function(_0x188dca){if(_0x188dca){return _0x188dca['destroy']()['then'](function(){_0x906d24[_0x6c1b('0x19')](0xcc)[_0x6c1b('0x18')]();});}};}function handleEntityNotFound(_0x3d3663,_0x4f230d){return function(_0x7152f){if(!_0x7152f){_0x3d3663[_0x6c1b('0x17')](0x194);}return _0x7152f;};}function handleError(_0x119c15,_0x719b37){_0x719b37=_0x719b37||0x1f4;return function(_0x2a4c2e){logger[_0x6c1b('0x26')](_0x2a4c2e['stack']);if(_0x2a4c2e[_0x6c1b('0x27')]){delete _0x2a4c2e[_0x6c1b('0x27')];}_0x119c15['status'](_0x719b37)['send'](_0x2a4c2e);};}exports[_0x6c1b('0x28')]=function(_0x5ed1ff,_0x2bca99){var _0x43d437={},_0xd45a72={},_0x186649={'count':0x0,'rows':[]};var _0x260e42=_[_0x6c1b('0x29')](db['FreshsalesConfiguration'][_0x6c1b('0x2a')],function(_0x55a02c){return{'name':_0x55a02c['fieldName'],'type':_0x55a02c[_0x6c1b('0x2b')][_0x6c1b('0x2c')]};});_0xd45a72[_0x6c1b('0x2d')]=_['map'](_0x260e42,'name');_0xd45a72['query']=_[_0x6c1b('0x2e')](_0x5ed1ff[_0x6c1b('0x2f')]);_0xd45a72[_0x6c1b('0x30')]=_['intersection'](_0xd45a72[_0x6c1b('0x2d')],_0xd45a72['query']);_0x43d437[_0x6c1b('0x31')]=_[_0x6c1b('0x32')](_0xd45a72[_0x6c1b('0x2d')],qs['fields'](_0x5ed1ff[_0x6c1b('0x2f')][_0x6c1b('0x33')]));_0x43d437[_0x6c1b('0x31')]=_0x43d437[_0x6c1b('0x31')][_0x6c1b('0x34')]?_0x43d437['attributes']:_0xd45a72[_0x6c1b('0x2d')];if(!_0x5ed1ff['query'][_0x6c1b('0x35')](_0x6c1b('0x36'))){_0x43d437[_0x6c1b('0x1e')]=qs[_0x6c1b('0x1e')](_0x5ed1ff['query']['limit']);_0x43d437[_0x6c1b('0x1b')]=qs['offset'](_0x5ed1ff['query'][_0x6c1b('0x1b')]);}_0x43d437[_0x6c1b('0x37')]=qs[_0x6c1b('0x38')](_0x5ed1ff[_0x6c1b('0x2f')][_0x6c1b('0x38')]);_0x43d437[_0x6c1b('0x39')]=qs[_0x6c1b('0x30')](_[_0x6c1b('0x3a')](_0x5ed1ff['query'],_0xd45a72['filters']),_0x260e42);if(_0x5ed1ff[_0x6c1b('0x2f')][_0x6c1b('0x3b')]){_0x43d437[_0x6c1b('0x39')]=_['merge'](_0x43d437['where'],{'$or':_['map'](_0x260e42,function(_0x13d325){if(_0x13d325['type']!=='VIRTUAL'){var _0x801b2b={};_0x801b2b[_0x13d325[_0x6c1b('0x27')]]={'$like':'%'+_0x5ed1ff[_0x6c1b('0x2f')][_0x6c1b('0x3b')]+'%'};return _0x801b2b;}})});}_0x43d437=_[_0x6c1b('0x3c')]({},_0x43d437,_0x5ed1ff[_0x6c1b('0x3d')]);var _0x4136ef={'where':_0x43d437[_0x6c1b('0x39')]};return db[_0x6c1b('0x3e')][_0x6c1b('0x1d')](_0x4136ef)['then'](function(_0x2bd5a1){_0x186649[_0x6c1b('0x1d')]=_0x2bd5a1;if(_0x5ed1ff[_0x6c1b('0x2f')]['includeAll']){_0x43d437[_0x6c1b('0x3f')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x6c1b('0x40')](_0x43d437);})['then'](function(_0xed80de){_0x186649[_0x6c1b('0x41')]=_0xed80de;return _0x186649;})[_0x6c1b('0x25')](respondWithFilteredResult(_0x2bca99,_0x43d437))[_0x6c1b('0x42')](handleError(_0x2bca99,null));};exports[_0x6c1b('0x43')]=function(_0x476775,_0x5a1ac){var _0x462dcc={'raw':![],'where':{'id':_0x476775['params']['id']}},_0xc3aa04={};_0xc3aa04['model']=_[_0x6c1b('0x2e')](db[_0x6c1b('0x3e')][_0x6c1b('0x2a')]);_0xc3aa04[_0x6c1b('0x2f')]=_['keys'](_0x476775[_0x6c1b('0x2f')]);_0xc3aa04['filters']=_['intersection'](_0xc3aa04[_0x6c1b('0x2d')],_0xc3aa04['query']);_0x462dcc['attributes']=_[_0x6c1b('0x32')](_0xc3aa04[_0x6c1b('0x2d')],qs[_0x6c1b('0x33')](_0x476775[_0x6c1b('0x2f')]['fields']));_0x462dcc[_0x6c1b('0x31')]=_0x462dcc[_0x6c1b('0x31')]['length']?_0x462dcc[_0x6c1b('0x31')]:_0xc3aa04['model'];if(_0x476775[_0x6c1b('0x2f')][_0x6c1b('0x44')]){_0x462dcc['include']=[{'all':!![]}];}_0x462dcc=_['merge']({},_0x462dcc,_0x476775[_0x6c1b('0x3d')]);return db[_0x6c1b('0x3e')][_0x6c1b('0x45')](_0x462dcc)[_0x6c1b('0x25')](handleEntityNotFound(_0x5a1ac,null))[_0x6c1b('0x25')](respondWithResult(_0x5a1ac,null))[_0x6c1b('0x42')](handleError(_0x5a1ac,null));};exports[_0x6c1b('0x46')]=function(_0x1fcd8c,_0x5f2642){return db[_0x6c1b('0x3e')][_0x6c1b('0x46')](_0x1fcd8c[_0x6c1b('0x47')],{})[_0x6c1b('0x25')](respondWithResult(_0x5f2642,0xc9))['catch'](handleError(_0x5f2642,null));};exports[_0x6c1b('0x24')]=function(_0x4a66f5,_0x48e756){if(_0x4a66f5[_0x6c1b('0x47')]['id']){delete _0x4a66f5[_0x6c1b('0x47')]['id'];}return db[_0x6c1b('0x3e')][_0x6c1b('0x45')]({'where':{'id':_0x4a66f5['params']['id']}})[_0x6c1b('0x25')](handleEntityNotFound(_0x48e756,null))[_0x6c1b('0x25')](saveUpdates(_0x4a66f5[_0x6c1b('0x47')],null))[_0x6c1b('0x25')](respondWithResult(_0x48e756,null))[_0x6c1b('0x42')](handleError(_0x48e756,null));};exports['destroy']=function(_0x1f5d6d,_0x1c1749){return db[_0x6c1b('0x3e')][_0x6c1b('0x45')]({'where':{'id':_0x1f5d6d[_0x6c1b('0x48')]['id']}})[_0x6c1b('0x25')](handleEntityNotFound(_0x1c1749,null))[_0x6c1b('0x25')](removeEntity(_0x1c1749,null))[_0x6c1b('0x42')](handleError(_0x1c1749,null));};exports[_0x6c1b('0x49')]=function(_0x64dc52,_0x2331c6,_0x26aa76){var _0xc5662e={};var _0x27ff27={};var _0x19f0d4;var _0x5bb44b;return db[_0x6c1b('0x3e')]['findOne']({'where':{'id':_0x64dc52['params']['id']}})[_0x6c1b('0x25')](handleEntityNotFound(_0x2331c6,null))[_0x6c1b('0x25')](function(_0x24a3bc){if(_0x24a3bc){_0x19f0d4=_0x24a3bc;_0x27ff27[_0x6c1b('0x2d')]=_[_0x6c1b('0x2e')](db[_0x6c1b('0x4a')][_0x6c1b('0x2a')]);_0x27ff27[_0x6c1b('0x2f')]=_['keys'](_0x64dc52['query']);_0x27ff27[_0x6c1b('0x30')]=_[_0x6c1b('0x32')](_0x27ff27[_0x6c1b('0x2d')],_0x27ff27[_0x6c1b('0x2f')]);_0xc5662e[_0x6c1b('0x31')]=_[_0x6c1b('0x32')](_0x27ff27[_0x6c1b('0x2d')],qs[_0x6c1b('0x33')](_0x64dc52[_0x6c1b('0x2f')][_0x6c1b('0x33')]));_0xc5662e['attributes']=_0xc5662e[_0x6c1b('0x31')][_0x6c1b('0x34')]?_0xc5662e[_0x6c1b('0x31')]:_0x27ff27['model'];_0xc5662e[_0x6c1b('0x37')]=qs['sort'](_0x64dc52[_0x6c1b('0x2f')][_0x6c1b('0x38')]);_0xc5662e[_0x6c1b('0x39')]=qs[_0x6c1b('0x30')](_[_0x6c1b('0x3a')](_0x64dc52[_0x6c1b('0x2f')],_0x27ff27[_0x6c1b('0x30')]));if(_0x64dc52[_0x6c1b('0x2f')]['filter']){_0xc5662e[_0x6c1b('0x39')]=_[_0x6c1b('0x3c')](_0xc5662e[_0x6c1b('0x39')],{'$or':_[_0x6c1b('0x29')](_0xc5662e[_0x6c1b('0x31')],function(_0x27eb3c){var _0x2c608a={};_0x2c608a[_0x27eb3c]={'$like':'%'+_0x64dc52[_0x6c1b('0x2f')][_0x6c1b('0x3b')]+'%'};return _0x2c608a;})});}_0xc5662e=_[_0x6c1b('0x3c')]({},_0xc5662e,_0x64dc52[_0x6c1b('0x3d')]);return _0x19f0d4[_0x6c1b('0x49')](_0xc5662e);}})[_0x6c1b('0x25')](function(_0x43ac12){if(_0x43ac12){_0x5bb44b=_0x43ac12['length'];if(!_0x64dc52['query']['hasOwnProperty'](_0x6c1b('0x36'))){_0xc5662e[_0x6c1b('0x1e')]=qs[_0x6c1b('0x1e')](_0x64dc52[_0x6c1b('0x2f')][_0x6c1b('0x1e')]);_0xc5662e[_0x6c1b('0x1b')]=qs['offset'](_0x64dc52[_0x6c1b('0x2f')]['offset']);}return _0x19f0d4[_0x6c1b('0x49')](_0xc5662e);}})['then'](function(_0x1b5b4b){if(_0x1b5b4b){return _0x1b5b4b?{'count':_0x5bb44b,'rows':_0x1b5b4b}:null;}})['then'](respondWithResult(_0x2331c6,null))[_0x6c1b('0x42')](handleError(_0x2331c6,null));};exports[_0x6c1b('0x4b')]=function(_0x38f013,_0x35e845,_0xe50445){var _0xa56488={};var _0x1e6737={};var _0x51f603;var _0x416924;return db[_0x6c1b('0x3e')][_0x6c1b('0x4c')]({'where':{'id':_0x38f013[_0x6c1b('0x48')]['id']}})[_0x6c1b('0x25')](handleEntityNotFound(_0x35e845,null))[_0x6c1b('0x25')](function(_0x1abee2){if(_0x1abee2){_0x51f603=_0x1abee2;_0x1e6737[_0x6c1b('0x2d')]=_[_0x6c1b('0x2e')](db['FreshsalesField'][_0x6c1b('0x2a')]);_0x1e6737[_0x6c1b('0x2f')]=_['keys'](_0x38f013[_0x6c1b('0x2f')]);_0x1e6737[_0x6c1b('0x30')]=_[_0x6c1b('0x32')](_0x1e6737[_0x6c1b('0x2d')],_0x1e6737[_0x6c1b('0x2f')]);_0xa56488[_0x6c1b('0x31')]=_['intersection'](_0x1e6737[_0x6c1b('0x2d')],qs[_0x6c1b('0x33')](_0x38f013[_0x6c1b('0x2f')][_0x6c1b('0x33')]));_0xa56488['attributes']=_0xa56488['attributes']['length']?_0xa56488[_0x6c1b('0x31')]:_0x1e6737[_0x6c1b('0x2d')];_0xa56488['order']=qs[_0x6c1b('0x38')](_0x38f013['query'][_0x6c1b('0x38')]);_0xa56488[_0x6c1b('0x39')]=qs[_0x6c1b('0x30')](_[_0x6c1b('0x3a')](_0x38f013[_0x6c1b('0x2f')],_0x1e6737[_0x6c1b('0x30')]));if(_0x38f013[_0x6c1b('0x2f')][_0x6c1b('0x3b')]){_0xa56488[_0x6c1b('0x39')]=_[_0x6c1b('0x3c')](_0xa56488[_0x6c1b('0x39')],{'$or':_[_0x6c1b('0x29')](_0xa56488[_0x6c1b('0x31')],function(_0x1597d6){var _0x4401b7={};_0x4401b7[_0x1597d6]={'$like':'%'+_0x38f013[_0x6c1b('0x2f')][_0x6c1b('0x3b')]+'%'};return _0x4401b7;})});}_0xa56488=_[_0x6c1b('0x3c')]({},_0xa56488,_0x38f013[_0x6c1b('0x3d')]);return _0x51f603['getDescriptions'](_0xa56488);}})[_0x6c1b('0x25')](function(_0x450f1f){if(_0x450f1f){_0x416924=_0x450f1f['length'];if(!_0x38f013['query'][_0x6c1b('0x35')]('nolimit')){_0xa56488[_0x6c1b('0x1e')]=qs['limit'](_0x38f013[_0x6c1b('0x2f')]['limit']);_0xa56488[_0x6c1b('0x1b')]=qs[_0x6c1b('0x1b')](_0x38f013['query'][_0x6c1b('0x1b')]);}return _0x51f603[_0x6c1b('0x4b')](_0xa56488);}})['then'](function(_0x5aa980){if(_0x5aa980){return _0x5aa980?{'count':_0x416924,'rows':_0x5aa980}:null;}})[_0x6c1b('0x25')](respondWithResult(_0x35e845,null))[_0x6c1b('0x42')](handleError(_0x35e845,null));};exports['getFields']=function(_0x738299,_0x5cf436,_0x286093){var _0x59b777={};var _0x257704={};var _0x2ab410;var _0x59e34e;return db[_0x6c1b('0x3e')][_0x6c1b('0x4c')]({'where':{'id':_0x738299[_0x6c1b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5cf436,null))[_0x6c1b('0x25')](function(_0x578740){if(_0x578740){_0x2ab410=_0x578740;_0x257704['model']=_[_0x6c1b('0x2e')](db[_0x6c1b('0x4a')][_0x6c1b('0x2a')]);_0x257704['query']=_[_0x6c1b('0x2e')](_0x738299[_0x6c1b('0x2f')]);_0x257704['filters']=_[_0x6c1b('0x32')](_0x257704[_0x6c1b('0x2d')],_0x257704['query']);_0x59b777[_0x6c1b('0x31')]=_[_0x6c1b('0x32')](_0x257704['model'],qs[_0x6c1b('0x33')](_0x738299['query'][_0x6c1b('0x33')]));_0x59b777[_0x6c1b('0x31')]=_0x59b777['attributes'][_0x6c1b('0x34')]?_0x59b777[_0x6c1b('0x31')]:_0x257704[_0x6c1b('0x2d')];_0x59b777[_0x6c1b('0x37')]=qs[_0x6c1b('0x38')](_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x38')]);_0x59b777[_0x6c1b('0x39')]=qs[_0x6c1b('0x30')](_['pick'](_0x738299[_0x6c1b('0x2f')],_0x257704[_0x6c1b('0x30')]));if(_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x3b')]){_0x59b777[_0x6c1b('0x39')]=_[_0x6c1b('0x3c')](_0x59b777[_0x6c1b('0x39')],{'$or':_[_0x6c1b('0x29')](_0x59b777[_0x6c1b('0x31')],function(_0x46f107){var _0x41918e={};_0x41918e[_0x46f107]={'$like':'%'+_0x738299['query']['filter']+'%'};return _0x41918e;})});}_0x59b777=_['merge']({},_0x59b777,_0x738299['options']);return _0x2ab410['getFields'](_0x59b777);}})[_0x6c1b('0x25')](function(_0x501246){if(_0x501246){_0x59e34e=_0x501246[_0x6c1b('0x34')];if(!_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x35')](_0x6c1b('0x36'))){_0x59b777['limit']=qs['limit'](_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x1e')]);_0x59b777[_0x6c1b('0x1b')]=qs[_0x6c1b('0x1b')](_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x1b')]);}return _0x2ab410[_0x6c1b('0x4d')](_0x59b777);}})[_0x6c1b('0x25')](function(_0x4b7d56){if(_0x4b7d56){return _0x4b7d56?{'count':_0x59e34e,'rows':_0x4b7d56}:null;}})['then'](respondWithResult(_0x5cf436,null))[_0x6c1b('0x42')](handleError(_0x5cf436,null));}; \ No newline at end of file +var _0x2c8f=['request-promise','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','FreshsalesConfiguration','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','catch','getSubjects','getDescriptions','findOne','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch'];(function(_0xc4b321,_0x31091f){var _0x651f2e=function(_0x3ccb26){while(--_0x3ccb26){_0xc4b321['push'](_0xc4b321['shift']());}};_0x651f2e(++_0x31091f);}(_0x2c8f,0x1dd));var _0xf2c8=function(_0x2c61a2,_0x40fe37){_0x2c61a2=_0x2c61a2-0x0;var _0x28bf7c=_0x2c8f[_0x2c61a2];return _0x28bf7c;};'use strict';var emlformat=require(_0xf2c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2c8('0x1'));var jsonpatch=require(_0xf2c8('0x2'));var rp=require(_0xf2c8('0x3'));var moment=require('moment');var BPromise=require(_0xf2c8('0x4'));var Mustache=require(_0xf2c8('0x5'));var util=require(_0xf2c8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf2c8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2c8('0x8'));var squel=require(_0xf2c8('0x9'));var crypto=require(_0xf2c8('0xa'));var jsforce=require(_0xf2c8('0xb'));var deskjs=require(_0xf2c8('0xc'));var toCsv=require(_0xf2c8('0x7'));var querystring=require(_0xf2c8('0xd'));var Papa=require(_0xf2c8('0xe'));var Redis=require(_0xf2c8('0xf'));var authService=require(_0xf2c8('0x10'));var qs=require(_0xf2c8('0x11'));var as=require(_0xf2c8('0x12'));var hardwareService=require(_0xf2c8('0x13'));var logger=require(_0xf2c8('0x14'))(_0xf2c8('0x15'));var utils=require('../../config/utils');var config=require(_0xf2c8('0x16'));var licenseUtil=require(_0xf2c8('0x17'));var db=require(_0xf2c8('0x18'))['db'];function respondWithStatusCode(_0x5c9f74,_0x127d1f){_0x127d1f=_0x127d1f||0xcc;return function(_0x52c377){if(_0x52c377){return _0x5c9f74['sendStatus'](_0x127d1f);}return _0x5c9f74['status'](_0x127d1f)[_0xf2c8('0x19')]();};}function respondWithResult(_0x304b24,_0xbafc86){_0xbafc86=_0xbafc86||0xc8;return function(_0xa9837c){if(_0xa9837c){return _0x304b24[_0xf2c8('0x1a')](_0xbafc86)[_0xf2c8('0x1b')](_0xa9837c);}};}function respondWithFilteredResult(_0x223924,_0x42df3e){return function(_0x5a87e8){if(_0x5a87e8){var _0x1b5a1a=typeof _0x42df3e[_0xf2c8('0x1c')]===_0xf2c8('0x1d')&&typeof _0x42df3e[_0xf2c8('0x1e')]===_0xf2c8('0x1d');var _0x42a348=_0x5a87e8[_0xf2c8('0x1f')];var _0x1b7caf=_0x1b5a1a?0x0:_0x42df3e[_0xf2c8('0x1c')];var _0x4a1e32=_0x1b5a1a?_0x5a87e8[_0xf2c8('0x1f')]:_0x42df3e[_0xf2c8('0x1c')]+_0x42df3e['limit'];var _0x5155f8;if(_0x4a1e32>=_0x42a348){_0x4a1e32=_0x42a348;_0x5155f8=0xc8;}else{_0x5155f8=0xce;}_0x223924[_0xf2c8('0x1a')](_0x5155f8);return _0x223924[_0xf2c8('0x20')](_0xf2c8('0x21'),_0x1b7caf+'-'+_0x4a1e32+'/'+_0x42a348)['json'](_0x5a87e8);}return null;};}function patchUpdates(_0x3afb2e){return function(_0x394be1){try{jsonpatch[_0xf2c8('0x22')](_0x394be1,_0x3afb2e,!![]);}catch(_0x435747){return BPromise[_0xf2c8('0x23')](_0x435747);}return _0x394be1['save']();};}function saveUpdates(_0x5735f2,_0x20c224){return function(_0x37bbda){if(_0x37bbda){return _0x37bbda[_0xf2c8('0x24')](_0x5735f2)[_0xf2c8('0x25')](function(_0x2b2edb){return _0x2b2edb;});}return null;};}function removeEntity(_0x39abc0,_0x1bd999){return function(_0x574ad9){if(_0x574ad9){return _0x574ad9[_0xf2c8('0x26')]()['then'](function(){_0x39abc0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3d41,_0x35d06d){return function(_0x570a92){if(!_0x570a92){_0x1c3d41[_0xf2c8('0x27')](0x194);}return _0x570a92;};}function handleError(_0x32198d,_0x142221){_0x142221=_0x142221||0x1f4;return function(_0x37311b){logger['error'](_0x37311b[_0xf2c8('0x28')]);if(_0x37311b[_0xf2c8('0x29')]){delete _0x37311b[_0xf2c8('0x29')];}_0x32198d['status'](_0x142221)[_0xf2c8('0x2a')](_0x37311b);};}exports[_0xf2c8('0x2b')]=function(_0x8909f6,_0x464846){var _0x3346ec={},_0x7ab0f6={},_0x18840e={'count':0x0,'rows':[]};var _0x148ba4=_['map'](db[_0xf2c8('0x2c')][_0xf2c8('0x2d')],function(_0x2eb9fd){return{'name':_0x2eb9fd['fieldName'],'type':_0x2eb9fd[_0xf2c8('0x2e')]['key']};});_0x7ab0f6[_0xf2c8('0x2f')]=_[_0xf2c8('0x30')](_0x148ba4,_0xf2c8('0x29'));_0x7ab0f6[_0xf2c8('0x31')]=_[_0xf2c8('0x32')](_0x8909f6[_0xf2c8('0x31')]);_0x7ab0f6[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0x7ab0f6[_0xf2c8('0x2f')],_0x7ab0f6['query']);_0x3346ec[_0xf2c8('0x35')]=_[_0xf2c8('0x34')](_0x7ab0f6[_0xf2c8('0x2f')],qs[_0xf2c8('0x36')](_0x8909f6[_0xf2c8('0x31')][_0xf2c8('0x36')]));_0x3346ec[_0xf2c8('0x35')]=_0x3346ec[_0xf2c8('0x35')][_0xf2c8('0x37')]?_0x3346ec[_0xf2c8('0x35')]:_0x7ab0f6[_0xf2c8('0x2f')];if(!_0x8909f6['query'][_0xf2c8('0x38')](_0xf2c8('0x39'))){_0x3346ec[_0xf2c8('0x1e')]=qs['limit'](_0x8909f6[_0xf2c8('0x31')][_0xf2c8('0x1e')]);_0x3346ec[_0xf2c8('0x1c')]=qs[_0xf2c8('0x1c')](_0x8909f6[_0xf2c8('0x31')][_0xf2c8('0x1c')]);}_0x3346ec[_0xf2c8('0x3a')]=qs[_0xf2c8('0x3b')](_0x8909f6['query'][_0xf2c8('0x3b')]);_0x3346ec[_0xf2c8('0x3c')]=qs[_0xf2c8('0x33')](_[_0xf2c8('0x3d')](_0x8909f6[_0xf2c8('0x31')],_0x7ab0f6[_0xf2c8('0x33')]),_0x148ba4);if(_0x8909f6[_0xf2c8('0x31')][_0xf2c8('0x3e')]){_0x3346ec['where']=_[_0xf2c8('0x3f')](_0x3346ec[_0xf2c8('0x3c')],{'$or':_[_0xf2c8('0x30')](_0x148ba4,function(_0x23be89){if(_0x23be89[_0xf2c8('0x2e')]!==_0xf2c8('0x40')){var _0x126b0f={};_0x126b0f[_0x23be89[_0xf2c8('0x29')]]={'$like':'%'+_0x8909f6[_0xf2c8('0x31')][_0xf2c8('0x3e')]+'%'};return _0x126b0f;}})});}_0x3346ec=_['merge']({},_0x3346ec,_0x8909f6[_0xf2c8('0x41')]);var _0x216804={'where':_0x3346ec['where']};return db[_0xf2c8('0x2c')]['count'](_0x216804)[_0xf2c8('0x25')](function(_0x560b76){_0x18840e['count']=_0x560b76;if(_0x8909f6['query'][_0xf2c8('0x42')]){_0x3346ec[_0xf2c8('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xf2c8('0x44')](_0x3346ec);})['then'](function(_0x12aafa){_0x18840e[_0xf2c8('0x45')]=_0x12aafa;return _0x18840e;})[_0xf2c8('0x25')](respondWithFilteredResult(_0x464846,_0x3346ec))['catch'](handleError(_0x464846,null));};exports['show']=function(_0x3b71e4,_0x2994b2){var _0x23a5c3={'raw':![],'where':{'id':_0x3b71e4[_0xf2c8('0x46')]['id']}},_0x22edb5={};_0x22edb5[_0xf2c8('0x2f')]=_[_0xf2c8('0x32')](db[_0xf2c8('0x2c')]['rawAttributes']);_0x22edb5[_0xf2c8('0x31')]=_[_0xf2c8('0x32')](_0x3b71e4[_0xf2c8('0x31')]);_0x22edb5[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0x22edb5[_0xf2c8('0x2f')],_0x22edb5[_0xf2c8('0x31')]);_0x23a5c3['attributes']=_[_0xf2c8('0x34')](_0x22edb5[_0xf2c8('0x2f')],qs[_0xf2c8('0x36')](_0x3b71e4['query'][_0xf2c8('0x36')]));_0x23a5c3[_0xf2c8('0x35')]=_0x23a5c3[_0xf2c8('0x35')]['length']?_0x23a5c3[_0xf2c8('0x35')]:_0x22edb5[_0xf2c8('0x2f')];if(_0x3b71e4[_0xf2c8('0x31')][_0xf2c8('0x42')]){_0x23a5c3[_0xf2c8('0x43')]=[{'all':!![]}];}_0x23a5c3=_[_0xf2c8('0x3f')]({},_0x23a5c3,_0x3b71e4[_0xf2c8('0x41')]);return db[_0xf2c8('0x2c')][_0xf2c8('0x47')](_0x23a5c3)['then'](handleEntityNotFound(_0x2994b2,null))[_0xf2c8('0x25')](respondWithResult(_0x2994b2,null))['catch'](handleError(_0x2994b2,null));};exports[_0xf2c8('0x48')]=function(_0x508671,_0x12e11b){return db[_0xf2c8('0x2c')][_0xf2c8('0x48')](_0x508671[_0xf2c8('0x49')],{})[_0xf2c8('0x25')](respondWithResult(_0x12e11b,0xc9))[_0xf2c8('0x4a')](handleError(_0x12e11b,null));};exports['update']=function(_0x5dd423,_0x2b4551){if(_0x5dd423[_0xf2c8('0x49')]['id']){delete _0x5dd423[_0xf2c8('0x49')]['id'];}return db[_0xf2c8('0x2c')][_0xf2c8('0x47')]({'where':{'id':_0x5dd423['params']['id']}})[_0xf2c8('0x25')](handleEntityNotFound(_0x2b4551,null))['then'](saveUpdates(_0x5dd423[_0xf2c8('0x49')],null))[_0xf2c8('0x25')](respondWithResult(_0x2b4551,null))[_0xf2c8('0x4a')](handleError(_0x2b4551,null));};exports[_0xf2c8('0x26')]=function(_0x1e7ce4,_0xf97608){return db['FreshsalesConfiguration'][_0xf2c8('0x47')]({'where':{'id':_0x1e7ce4[_0xf2c8('0x46')]['id']}})['then'](handleEntityNotFound(_0xf97608,null))[_0xf2c8('0x25')](removeEntity(_0xf97608,null))[_0xf2c8('0x4a')](handleError(_0xf97608,null));};exports[_0xf2c8('0x4b')]=function(_0x144fe0,_0x1e96ee,_0x10aff2){var _0x355858={};var _0xaebae3={};var _0x4ef47f;var _0x37f16b;return db[_0xf2c8('0x2c')]['findOne']({'where':{'id':_0x144fe0['params']['id']}})[_0xf2c8('0x25')](handleEntityNotFound(_0x1e96ee,null))[_0xf2c8('0x25')](function(_0x443b9a){if(_0x443b9a){_0x4ef47f=_0x443b9a;_0xaebae3[_0xf2c8('0x2f')]=_['keys'](db['FreshsalesField'][_0xf2c8('0x2d')]);_0xaebae3['query']=_[_0xf2c8('0x32')](_0x144fe0['query']);_0xaebae3[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0xaebae3['model'],_0xaebae3[_0xf2c8('0x31')]);_0x355858[_0xf2c8('0x35')]=_[_0xf2c8('0x34')](_0xaebae3[_0xf2c8('0x2f')],qs[_0xf2c8('0x36')](_0x144fe0['query'][_0xf2c8('0x36')]));_0x355858[_0xf2c8('0x35')]=_0x355858[_0xf2c8('0x35')][_0xf2c8('0x37')]?_0x355858[_0xf2c8('0x35')]:_0xaebae3['model'];_0x355858[_0xf2c8('0x3a')]=qs[_0xf2c8('0x3b')](_0x144fe0['query'][_0xf2c8('0x3b')]);_0x355858[_0xf2c8('0x3c')]=qs['filters'](_['pick'](_0x144fe0['query'],_0xaebae3[_0xf2c8('0x33')]));if(_0x144fe0[_0xf2c8('0x31')][_0xf2c8('0x3e')]){_0x355858[_0xf2c8('0x3c')]=_[_0xf2c8('0x3f')](_0x355858['where'],{'$or':_[_0xf2c8('0x30')](_0x355858[_0xf2c8('0x35')],function(_0x291910){var _0xd669f={};_0xd669f[_0x291910]={'$like':'%'+_0x144fe0[_0xf2c8('0x31')]['filter']+'%'};return _0xd669f;})});}_0x355858=_[_0xf2c8('0x3f')]({},_0x355858,_0x144fe0[_0xf2c8('0x41')]);return _0x4ef47f['getSubjects'](_0x355858);}})['then'](function(_0x508b7c){if(_0x508b7c){_0x37f16b=_0x508b7c[_0xf2c8('0x37')];if(!_0x144fe0['query'][_0xf2c8('0x38')](_0xf2c8('0x39'))){_0x355858[_0xf2c8('0x1e')]=qs[_0xf2c8('0x1e')](_0x144fe0[_0xf2c8('0x31')][_0xf2c8('0x1e')]);_0x355858[_0xf2c8('0x1c')]=qs[_0xf2c8('0x1c')](_0x144fe0[_0xf2c8('0x31')][_0xf2c8('0x1c')]);}return _0x4ef47f[_0xf2c8('0x4b')](_0x355858);}})[_0xf2c8('0x25')](function(_0x189904){if(_0x189904){return _0x189904?{'count':_0x37f16b,'rows':_0x189904}:null;}})['then'](respondWithResult(_0x1e96ee,null))['catch'](handleError(_0x1e96ee,null));};exports[_0xf2c8('0x4c')]=function(_0x2855e5,_0x26d416,_0x5b2a35){var _0x475bd9={};var _0x4061b5={};var _0x36afd2;var _0x1fda40;return db[_0xf2c8('0x2c')][_0xf2c8('0x4d')]({'where':{'id':_0x2855e5[_0xf2c8('0x46')]['id']}})[_0xf2c8('0x25')](handleEntityNotFound(_0x26d416,null))[_0xf2c8('0x25')](function(_0x1f0a5c){if(_0x1f0a5c){_0x36afd2=_0x1f0a5c;_0x4061b5[_0xf2c8('0x2f')]=_[_0xf2c8('0x32')](db[_0xf2c8('0x4e')]['rawAttributes']);_0x4061b5[_0xf2c8('0x31')]=_['keys'](_0x2855e5['query']);_0x4061b5['filters']=_[_0xf2c8('0x34')](_0x4061b5[_0xf2c8('0x2f')],_0x4061b5[_0xf2c8('0x31')]);_0x475bd9['attributes']=_[_0xf2c8('0x34')](_0x4061b5[_0xf2c8('0x2f')],qs['fields'](_0x2855e5[_0xf2c8('0x31')]['fields']));_0x475bd9[_0xf2c8('0x35')]=_0x475bd9[_0xf2c8('0x35')][_0xf2c8('0x37')]?_0x475bd9['attributes']:_0x4061b5['model'];_0x475bd9['order']=qs[_0xf2c8('0x3b')](_0x2855e5[_0xf2c8('0x31')][_0xf2c8('0x3b')]);_0x475bd9[_0xf2c8('0x3c')]=qs[_0xf2c8('0x33')](_[_0xf2c8('0x3d')](_0x2855e5[_0xf2c8('0x31')],_0x4061b5[_0xf2c8('0x33')]));if(_0x2855e5['query'][_0xf2c8('0x3e')]){_0x475bd9[_0xf2c8('0x3c')]=_[_0xf2c8('0x3f')](_0x475bd9[_0xf2c8('0x3c')],{'$or':_[_0xf2c8('0x30')](_0x475bd9['attributes'],function(_0x4c3942){var _0x40e64e={};_0x40e64e[_0x4c3942]={'$like':'%'+_0x2855e5[_0xf2c8('0x31')][_0xf2c8('0x3e')]+'%'};return _0x40e64e;})});}_0x475bd9=_[_0xf2c8('0x3f')]({},_0x475bd9,_0x2855e5[_0xf2c8('0x41')]);return _0x36afd2[_0xf2c8('0x4c')](_0x475bd9);}})[_0xf2c8('0x25')](function(_0x6b5841){if(_0x6b5841){_0x1fda40=_0x6b5841[_0xf2c8('0x37')];if(!_0x2855e5[_0xf2c8('0x31')][_0xf2c8('0x38')](_0xf2c8('0x39'))){_0x475bd9[_0xf2c8('0x1e')]=qs['limit'](_0x2855e5[_0xf2c8('0x31')][_0xf2c8('0x1e')]);_0x475bd9[_0xf2c8('0x1c')]=qs[_0xf2c8('0x1c')](_0x2855e5[_0xf2c8('0x31')][_0xf2c8('0x1c')]);}return _0x36afd2[_0xf2c8('0x4c')](_0x475bd9);}})[_0xf2c8('0x25')](function(_0x5199e6){if(_0x5199e6){return _0x5199e6?{'count':_0x1fda40,'rows':_0x5199e6}:null;}})[_0xf2c8('0x25')](respondWithResult(_0x26d416,null))['catch'](handleError(_0x26d416,null));};exports[_0xf2c8('0x4f')]=function(_0x3a3b6a,_0x22b8da,_0x3c9d20){var _0x3a6932={};var _0x555ba9={};var _0x51188a;var _0x28f87f;return db[_0xf2c8('0x2c')]['findOne']({'where':{'id':_0x3a3b6a['params']['id']}})[_0xf2c8('0x25')](handleEntityNotFound(_0x22b8da,null))['then'](function(_0x557c16){if(_0x557c16){_0x51188a=_0x557c16;_0x555ba9[_0xf2c8('0x2f')]=_['keys'](db[_0xf2c8('0x4e')][_0xf2c8('0x2d')]);_0x555ba9[_0xf2c8('0x31')]=_['keys'](_0x3a3b6a[_0xf2c8('0x31')]);_0x555ba9[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0x555ba9['model'],_0x555ba9[_0xf2c8('0x31')]);_0x3a6932[_0xf2c8('0x35')]=_[_0xf2c8('0x34')](_0x555ba9['model'],qs[_0xf2c8('0x36')](_0x3a3b6a['query']['fields']));_0x3a6932['attributes']=_0x3a6932[_0xf2c8('0x35')][_0xf2c8('0x37')]?_0x3a6932['attributes']:_0x555ba9['model'];_0x3a6932['order']=qs[_0xf2c8('0x3b')](_0x3a3b6a[_0xf2c8('0x31')][_0xf2c8('0x3b')]);_0x3a6932['where']=qs[_0xf2c8('0x33')](_[_0xf2c8('0x3d')](_0x3a3b6a[_0xf2c8('0x31')],_0x555ba9[_0xf2c8('0x33')]));if(_0x3a3b6a['query'][_0xf2c8('0x3e')]){_0x3a6932[_0xf2c8('0x3c')]=_[_0xf2c8('0x3f')](_0x3a6932[_0xf2c8('0x3c')],{'$or':_[_0xf2c8('0x30')](_0x3a6932[_0xf2c8('0x35')],function(_0x44fe99){var _0x352a8c={};_0x352a8c[_0x44fe99]={'$like':'%'+_0x3a3b6a[_0xf2c8('0x31')][_0xf2c8('0x3e')]+'%'};return _0x352a8c;})});}_0x3a6932=_[_0xf2c8('0x3f')]({},_0x3a6932,_0x3a3b6a[_0xf2c8('0x41')]);return _0x51188a[_0xf2c8('0x4f')](_0x3a6932);}})[_0xf2c8('0x25')](function(_0x23beda){if(_0x23beda){_0x28f87f=_0x23beda[_0xf2c8('0x37')];if(!_0x3a3b6a[_0xf2c8('0x31')][_0xf2c8('0x38')](_0xf2c8('0x39'))){_0x3a6932['limit']=qs['limit'](_0x3a3b6a[_0xf2c8('0x31')][_0xf2c8('0x1e')]);_0x3a6932[_0xf2c8('0x1c')]=qs[_0xf2c8('0x1c')](_0x3a3b6a[_0xf2c8('0x31')][_0xf2c8('0x1c')]);}return _0x51188a[_0xf2c8('0x4f')](_0x3a6932);}})['then'](function(_0x48d513){if(_0x48d513){return _0x48d513?{'count':_0x28f87f,'rows':_0x48d513}:null;}})[_0xf2c8('0x25')](respondWithResult(_0x22b8da,null))[_0xf2c8('0x4a')](handleError(_0x22b8da,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7158d9e..9260eb1 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 _0xe4e0=['api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xe4e0,0xa5));var _0x0e4e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe4e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0e4e('0x0'));var util=require(_0x0e4e('0x1'));var logger=require(_0x0e4e('0x2'))(_0x0e4e('0x3'));var moment=require(_0x0e4e('0x4'));var BPromise=require(_0x0e4e('0x5'));var rp=require(_0x0e4e('0x6'));var fs=require('fs');var path=require(_0x0e4e('0x7'));var rimraf=require('rimraf');var config=require(_0x0e4e('0x8'));var attributes=require(_0x0e4e('0x9'));module['exports']=function(_0x3cf573,_0x2685e6){return _0x3cf573[_0x0e4e('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x0e4e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15d9=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define'];(function(_0x1fa43a,_0xe4fd9){var _0xae54c0=function(_0x131a3e){while(--_0x131a3e){_0x1fa43a['push'](_0x1fa43a['shift']());}};_0xae54c0(++_0xe4fd9);}(_0x15d9,0xfd));var _0x915d=function(_0x3eb2ea,_0x401c21){_0x3eb2ea=_0x3eb2ea-0x0;var _0x516fe4=_0x15d9[_0x3eb2ea];return _0x516fe4;};'use strict';var _=require(_0x915d('0x0'));var util=require(_0x915d('0x1'));var logger=require(_0x915d('0x2'))(_0x915d('0x3'));var moment=require('moment');var BPromise=require(_0x915d('0x4'));var rp=require(_0x915d('0x5'));var fs=require('fs');var path=require(_0x915d('0x6'));var rimraf=require(_0x915d('0x7'));var config=require(_0x915d('0x8'));var attributes=require(_0x915d('0x9'));module['exports']=function(_0x2f9599,_0xaa7c88){return _0x2f9599[_0x915d('0xa')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 4f64544..17efca1 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 _0xae46=['request','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34a281,_0xce2d5a){var _0x42a062=function(_0x6cb5bf){while(--_0x6cb5bf){_0x34a281['push'](_0x34a281['shift']());}};_0x42a062(++_0xce2d5a);}(_0xae46,0xbe));var _0x6ae4=function(_0x4fed8b,_0x490bd1){_0x4fed8b=_0x4fed8b-0x0;var _0x343d09=_0xae46[_0x4fed8b];return _0x343d09;};'use strict';var _=require('lodash');var util=require(_0x6ae4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6ae4('0x1'));var fs=require('fs');var Redis=require(_0x6ae4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ae4('0x3'));var logger=require(_0x6ae4('0x4'))(_0x6ae4('0x5'));var config=require(_0x6ae4('0x6'));var jayson=require(_0x6ae4('0x7'));var client=jayson[_0x6ae4('0x8')][_0x6ae4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f135e,_0x26af5f,_0x6195ce){return new BPromise(function(_0x39c0b1,_0x4bd13a){return client[_0x6ae4('0xa')](_0x2f135e,_0x6195ce)['then'](function(_0x11431d){logger[_0x6ae4('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x26af5f,_0x6ae4('0xc'));logger[_0x6ae4('0xd')](_0x6ae4('0xe'),_0x26af5f,_0x6ae4('0xc'),JSON['stringify'](_0x11431d));if(_0x11431d['error']){if(_0x11431d[_0x6ae4('0xf')][_0x6ae4('0x10')]===0x1f4){logger[_0x6ae4('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x26af5f,_0x11431d[_0x6ae4('0xf')][_0x6ae4('0x11')]);return _0x4bd13a(_0x11431d['error'][_0x6ae4('0x11')]);}logger['error'](_0x6ae4('0x12'),_0x26af5f,_0x11431d[_0x6ae4('0xf')][_0x6ae4('0x11')]);return _0x39c0b1(_0x11431d[_0x6ae4('0xf')][_0x6ae4('0x11')]);}else{logger[_0x6ae4('0xb')](_0x6ae4('0x12'),_0x26af5f,'request\x20sent');_0x39c0b1(_0x11431d[_0x6ae4('0x13')]['message']);}})['catch'](function(_0x1017ab){logger[_0x6ae4('0xf')](_0x6ae4('0x12'),_0x26af5f,_0x1017ab);_0x4bd13a(_0x1017ab);});});} \ No newline at end of file +var _0xf62b=['rpc','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x428774,_0x383962){var _0x53a01c=function(_0x2d62da){while(--_0x2d62da){_0x428774['push'](_0x428774['shift']());}};_0x53a01c(++_0x383962);}(_0xf62b,0x91));var _0xbf62=function(_0x1fd3e2,_0x1a6772){_0x1fd3e2=_0x1fd3e2-0x0;var _0x5a9210=_0xf62b[_0x1fd3e2];return _0x5a9210;};'use strict';var _=require(_0xbf62('0x0'));var util=require(_0xbf62('0x1'));var moment=require(_0xbf62('0x2'));var BPromise=require(_0xbf62('0x3'));var rs=require(_0xbf62('0x4'));var fs=require('fs');var Redis=require(_0xbf62('0x5'));var db=require(_0xbf62('0x6'))['db'];var utils=require(_0xbf62('0x7'));var logger=require(_0xbf62('0x8'))(_0xbf62('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbf62('0xa')][_0xbf62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39043c,_0x39e6bf,_0x257720){return new BPromise(function(_0x55e674,_0x23ef19){return client[_0xbf62('0xc')](_0x39043c,_0x257720)[_0xbf62('0xd')](function(_0x28bdad){logger[_0xbf62('0xe')](_0xbf62('0xf'),_0x39e6bf,_0xbf62('0x10'));logger[_0xbf62('0x11')](_0xbf62('0x12'),_0x39e6bf,_0xbf62('0x10'),JSON[_0xbf62('0x13')](_0x28bdad));if(_0x28bdad[_0xbf62('0x14')]){if(_0x28bdad[_0xbf62('0x14')]['code']===0x1f4){logger[_0xbf62('0x14')](_0xbf62('0xf'),_0x39e6bf,_0x28bdad[_0xbf62('0x14')]['message']);return _0x23ef19(_0x28bdad[_0xbf62('0x14')]['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x39e6bf,_0x28bdad['error'][_0xbf62('0x15')]);return _0x55e674(_0x28bdad[_0xbf62('0x14')][_0xbf62('0x15')]);}else{logger['info'](_0xbf62('0xf'),_0x39e6bf,'request\x20sent');_0x55e674(_0x28bdad['result'][_0xbf62('0x15')]);}})['catch'](function(_0x3860ca){logger['error'](_0xbf62('0xf'),_0x39e6bf,_0x3860ca);_0x23ef19(_0x3860ca);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 400a64c..fab1cdf 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 _0x3a25=['get','isAuthenticated','index','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0xd591a2,_0x595561){var _0x63ff46=function(_0xddcca0){while(--_0xddcca0){_0xd591a2['push'](_0xd591a2['shift']());}};_0x63ff46(++_0x595561);}(_0x3a25,0x15d));var _0x53a2=function(_0x4c74b3,_0x4def82){_0x4c74b3=_0x4c74b3-0x0;var _0x488539=_0x3a25[_0x4c74b3];return _0x488539;};'use strict';var multer=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var path=require(_0x53a2('0x2'));var timeout=require(_0x53a2('0x3'));var express=require(_0x53a2('0x4'));var router=express[_0x53a2('0x5')]();var fs_extra=require(_0x53a2('0x6'));var auth=require(_0x53a2('0x7'));var interaction=require(_0x53a2('0x8'));var config=require(_0x53a2('0x9'));var controller=require(_0x53a2('0xa'));router[_0x53a2('0xb')]('/',auth[_0x53a2('0xc')](),controller[_0x53a2('0xd')]);router[_0x53a2('0xb')]('/:id',auth[_0x53a2('0xc')](),controller['show']);router[_0x53a2('0xe')]('/',auth[_0x53a2('0xc')](),controller[_0x53a2('0xf')]);router[_0x53a2('0x10')](_0x53a2('0x11'),auth[_0x53a2('0xc')](),controller[_0x53a2('0x12')]);router[_0x53a2('0x13')](_0x53a2('0x11'),auth[_0x53a2('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdb4b=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','util'];(function(_0x4bf42a,_0x195efd){var _0x4fcd82=function(_0x1eeb8b){while(--_0x1eeb8b){_0x4bf42a['push'](_0x4bf42a['shift']());}};_0x4fcd82(++_0x195efd);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x2c50a6,_0x2a9854){_0x2c50a6=_0x2c50a6-0x0;var _0x3e6556=_0xdb4b[_0x2c50a6];return _0x3e6556;};'use strict';var multer=require('multer');var util=require(_0xbdb4('0x0'));var path=require('path');var timeout=require(_0xbdb4('0x1'));var express=require(_0xbdb4('0x2'));var router=express[_0xbdb4('0x3')]();var fs_extra=require(_0xbdb4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb4('0x5'));var config=require(_0xbdb4('0x6'));var controller=require(_0xbdb4('0x7'));router[_0xbdb4('0x8')]('/',auth[_0xbdb4('0x9')](),controller[_0xbdb4('0xa')]);router[_0xbdb4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbdb4('0xb')]);router[_0xbdb4('0xc')]('/',auth[_0xbdb4('0x9')](),controller[_0xbdb4('0xd')]);router['put'](_0xbdb4('0xe'),auth['isAuthenticated'](),controller[_0xbdb4('0xf')]);router[_0xbdb4('0x10')](_0xbdb4('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xbdb4('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index a618057..9746645 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 _0x76e1=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x373b6e,_0x8e7aa2){var _0x50f8cc=function(_0x2d8fb7){while(--_0x2d8fb7){_0x373b6e['push'](_0x373b6e['shift']());}};_0x50f8cc(++_0x8e7aa2);}(_0x76e1,0xc7));var _0x176e=function(_0x13e8e5,_0x1db23c){_0x13e8e5=_0x13e8e5-0x0;var _0x59acfb=_0x76e1[_0x13e8e5];return _0x59acfb;};'use strict';var Sequelize=require(_0x176e('0x0'));module[_0x176e('0x1')]={'type':{'type':Sequelize[_0x176e('0x2')](_0x176e('0x3'),'variable',_0x176e('0x4'),_0x176e('0x5'),_0x176e('0x6')),'defaultValue':_0x176e('0x3')},'content':{'type':Sequelize[_0x176e('0x7')]},'key':{'type':Sequelize[_0x176e('0x7')]},'keyType':{'type':Sequelize[_0x176e('0x2')](_0x176e('0x3'),_0x176e('0x8'),_0x176e('0x4'))},'keyContent':{'type':Sequelize[_0x176e('0x7')]},'idField':{'type':Sequelize[_0x176e('0x7')]},'nameField':{'type':Sequelize[_0x176e('0x7')]},'customField':{'type':Sequelize[_0x176e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x176e('0x7')]}}; \ No newline at end of file +var _0x9529=['STRING','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x56cb32,_0x1db836){var _0x375122=function(_0x3d6b19){while(--_0x3d6b19){_0x56cb32['push'](_0x56cb32['shift']());}};_0x375122(++_0x1db836);}(_0x9529,0xf1));var _0x9952=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9529[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x9952('0x0'));module[_0x9952('0x1')]={'type':{'type':Sequelize[_0x9952('0x2')](_0x9952('0x3'),'variable',_0x9952('0x4'),_0x9952('0x5'),_0x9952('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9952('0x7')]},'key':{'type':Sequelize[_0x9952('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9952('0x3'),'variable',_0x9952('0x4'))},'keyContent':{'type':Sequelize[_0x9952('0x7')]},'idField':{'type':Sequelize[_0x9952('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 633f872..6da4fa2 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 _0x8e13=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x299cd5,_0x2e2b04){var _0x334e0f=function(_0x1ba1fa){while(--_0x1ba1fa){_0x299cd5['push'](_0x299cd5['shift']());}};_0x334e0f(++_0x2e2b04);}(_0x8e13,0xd4));var _0x38e1=function(_0x37da5d,_0x2506d2){_0x37da5d=_0x37da5d-0x0;var _0x9b4dd3=_0x8e13[_0x37da5d];return _0x9b4dd3;};'use strict';var emlformat=require(_0x38e1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x38e1('0x1'));var rp=require(_0x38e1('0x2'));var moment=require(_0x38e1('0x3'));var BPromise=require(_0x38e1('0x4'));var Mustache=require(_0x38e1('0x5'));var util=require(_0x38e1('0x6'));var path=require('path');var sox=require(_0x38e1('0x7'));var csv=require(_0x38e1('0x8'));var ejs=require(_0x38e1('0x9'));var fs=require('fs');var fs_extra=require(_0x38e1('0xa'));var _=require(_0x38e1('0xb'));var squel=require(_0x38e1('0xc'));var crypto=require(_0x38e1('0xd'));var jsforce=require(_0x38e1('0xe'));var deskjs=require(_0x38e1('0xf'));var toCsv=require(_0x38e1('0x8'));var querystring=require(_0x38e1('0x10'));var Papa=require(_0x38e1('0x11'));var Redis=require(_0x38e1('0x12'));var authService=require(_0x38e1('0x13'));var qs=require(_0x38e1('0x14'));var as=require(_0x38e1('0x15'));var hardwareService=require(_0x38e1('0x16'));var logger=require(_0x38e1('0x17'))(_0x38e1('0x18'));var utils=require(_0x38e1('0x19'));var config=require(_0x38e1('0x1a'));var licenseUtil=require(_0x38e1('0x1b'));var db=require(_0x38e1('0x1c'))['db'];function respondWithStatusCode(_0x4b9466,_0x33860){_0x33860=_0x33860||0xcc;return function(_0x179784){if(_0x179784){return _0x4b9466[_0x38e1('0x1d')](_0x33860);}return _0x4b9466[_0x38e1('0x1e')](_0x33860)[_0x38e1('0x1f')]();};}function respondWithResult(_0x207260,_0x4b9c20){_0x4b9c20=_0x4b9c20||0xc8;return function(_0x172425){if(_0x172425){return _0x207260[_0x38e1('0x1e')](_0x4b9c20)[_0x38e1('0x20')](_0x172425);}};}function respondWithFilteredResult(_0x479c71,_0x1278d5){return function(_0x196d6e){if(_0x196d6e){var _0x4651b1=typeof _0x1278d5['offset']==='undefined'&&typeof _0x1278d5[_0x38e1('0x21')]===_0x38e1('0x22');var _0x2a57c9=_0x196d6e[_0x38e1('0x23')];var _0x174cef=_0x4651b1?0x0:_0x1278d5['offset'];var _0x203f20=_0x4651b1?_0x196d6e['count']:_0x1278d5[_0x38e1('0x24')]+_0x1278d5[_0x38e1('0x21')];var _0x566e9f;if(_0x203f20>=_0x2a57c9){_0x203f20=_0x2a57c9;_0x566e9f=0xc8;}else{_0x566e9f=0xce;}_0x479c71[_0x38e1('0x1e')](_0x566e9f);return _0x479c71[_0x38e1('0x25')](_0x38e1('0x26'),_0x174cef+'-'+_0x203f20+'/'+_0x2a57c9)[_0x38e1('0x20')](_0x196d6e);}return null;};}function patchUpdates(_0x165494){return function(_0x1c928b){try{jsonpatch[_0x38e1('0x27')](_0x1c928b,_0x165494,!![]);}catch(_0x140f73){return BPromise['reject'](_0x140f73);}return _0x1c928b[_0x38e1('0x28')]();};}function saveUpdates(_0xb4d05e,_0x29f21e){return function(_0x2fc4b4){if(_0x2fc4b4){return _0x2fc4b4[_0x38e1('0x29')](_0xb4d05e)[_0x38e1('0x2a')](function(_0x4ba56b){return _0x4ba56b;});}return null;};}function removeEntity(_0x1562a8,_0x2ad5ed){return function(_0x45575d){if(_0x45575d){return _0x45575d['destroy']()[_0x38e1('0x2a')](function(){_0x1562a8['status'](0xcc)[_0x38e1('0x1f')]();});}};}function handleEntityNotFound(_0x3a6310,_0x2f6e19){return function(_0x4176b8){if(!_0x4176b8){_0x3a6310[_0x38e1('0x1d')](0x194);}return _0x4176b8;};}function handleError(_0x2d70c7,_0x4c3615){_0x4c3615=_0x4c3615||0x1f4;return function(_0x5397e3){logger[_0x38e1('0x2b')](_0x5397e3[_0x38e1('0x2c')]);if(_0x5397e3[_0x38e1('0x2d')]){delete _0x5397e3[_0x38e1('0x2d')];}_0x2d70c7['status'](_0x4c3615)['send'](_0x5397e3);};}exports[_0x38e1('0x2e')]=function(_0x565847,_0x32884e){var _0x1bd594={},_0x289b57={},_0x248cd4={'count':0x0,'rows':[]};var _0x129cf3=_[_0x38e1('0x2f')](db['FreshsalesField'][_0x38e1('0x30')],function(_0x560fdf){return{'name':_0x560fdf[_0x38e1('0x31')],'type':_0x560fdf[_0x38e1('0x32')]['key']};});_0x289b57[_0x38e1('0x33')]=_[_0x38e1('0x2f')](_0x129cf3,_0x38e1('0x2d'));_0x289b57[_0x38e1('0x34')]=_[_0x38e1('0x35')](_0x565847[_0x38e1('0x34')]);_0x289b57[_0x38e1('0x36')]=_[_0x38e1('0x37')](_0x289b57[_0x38e1('0x33')],_0x289b57[_0x38e1('0x34')]);_0x1bd594[_0x38e1('0x38')]=_[_0x38e1('0x37')](_0x289b57[_0x38e1('0x33')],qs[_0x38e1('0x39')](_0x565847[_0x38e1('0x34')][_0x38e1('0x39')]));_0x1bd594[_0x38e1('0x38')]=_0x1bd594[_0x38e1('0x38')][_0x38e1('0x3a')]?_0x1bd594[_0x38e1('0x38')]:_0x289b57[_0x38e1('0x33')];if(!_0x565847['query'][_0x38e1('0x3b')](_0x38e1('0x3c'))){_0x1bd594['limit']=qs['limit'](_0x565847[_0x38e1('0x34')][_0x38e1('0x21')]);_0x1bd594[_0x38e1('0x24')]=qs[_0x38e1('0x24')](_0x565847[_0x38e1('0x34')][_0x38e1('0x24')]);}_0x1bd594[_0x38e1('0x3d')]=qs[_0x38e1('0x3e')](_0x565847[_0x38e1('0x34')]['sort']);_0x1bd594[_0x38e1('0x3f')]=qs[_0x38e1('0x36')](_[_0x38e1('0x40')](_0x565847[_0x38e1('0x34')],_0x289b57[_0x38e1('0x36')]),_0x129cf3);if(_0x565847['query'][_0x38e1('0x41')]){_0x1bd594[_0x38e1('0x3f')]=_[_0x38e1('0x42')](_0x1bd594[_0x38e1('0x3f')],{'$or':_[_0x38e1('0x2f')](_0x129cf3,function(_0x363491){if(_0x363491[_0x38e1('0x32')]!==_0x38e1('0x43')){var _0x565e07={};_0x565e07[_0x363491[_0x38e1('0x2d')]]={'$like':'%'+_0x565847[_0x38e1('0x34')]['filter']+'%'};return _0x565e07;}})});}_0x1bd594=_[_0x38e1('0x42')]({},_0x1bd594,_0x565847[_0x38e1('0x44')]);var _0x126a84={'where':_0x1bd594[_0x38e1('0x3f')]};return db[_0x38e1('0x45')]['count'](_0x126a84)[_0x38e1('0x2a')](function(_0x4c2107){_0x248cd4['count']=_0x4c2107;if(_0x565847[_0x38e1('0x34')][_0x38e1('0x46')]){_0x1bd594[_0x38e1('0x47')]=[{'all':!![]}];}return db[_0x38e1('0x45')][_0x38e1('0x48')](_0x1bd594);})['then'](function(_0x42c526){_0x248cd4[_0x38e1('0x49')]=_0x42c526;return _0x248cd4;})[_0x38e1('0x2a')](respondWithFilteredResult(_0x32884e,_0x1bd594))[_0x38e1('0x4a')](handleError(_0x32884e,null));};exports['show']=function(_0x1058fe,_0x2d8f9a){var _0x4c438c={'raw':!![],'where':{'id':_0x1058fe['params']['id']}},_0x4b2b37={};_0x4b2b37[_0x38e1('0x33')]=_[_0x38e1('0x35')](db['FreshsalesField'][_0x38e1('0x30')]);_0x4b2b37[_0x38e1('0x34')]=_['keys'](_0x1058fe[_0x38e1('0x34')]);_0x4b2b37['filters']=_[_0x38e1('0x37')](_0x4b2b37['model'],_0x4b2b37[_0x38e1('0x34')]);_0x4c438c[_0x38e1('0x38')]=_[_0x38e1('0x37')](_0x4b2b37['model'],qs['fields'](_0x1058fe['query'][_0x38e1('0x39')]));_0x4c438c[_0x38e1('0x38')]=_0x4c438c[_0x38e1('0x38')]['length']?_0x4c438c[_0x38e1('0x38')]:_0x4b2b37['model'];if(_0x1058fe[_0x38e1('0x34')][_0x38e1('0x46')]){_0x4c438c[_0x38e1('0x47')]=[{'all':!![]}];}_0x4c438c=_[_0x38e1('0x42')]({},_0x4c438c,_0x1058fe[_0x38e1('0x44')]);return db[_0x38e1('0x45')][_0x38e1('0x4b')](_0x4c438c)[_0x38e1('0x2a')](handleEntityNotFound(_0x2d8f9a,null))[_0x38e1('0x2a')](respondWithResult(_0x2d8f9a,null))[_0x38e1('0x4a')](handleError(_0x2d8f9a,null));};exports[_0x38e1('0x4c')]=function(_0x3903c7,_0x4a59ed){return db[_0x38e1('0x45')][_0x38e1('0x4c')](_0x3903c7['body'],{})['then'](respondWithResult(_0x4a59ed,0xc9))[_0x38e1('0x4a')](handleError(_0x4a59ed,null));};exports[_0x38e1('0x29')]=function(_0x8e4a1,_0x5a31e2){if(_0x8e4a1['body']['id']){delete _0x8e4a1[_0x38e1('0x4d')]['id'];}return db[_0x38e1('0x45')][_0x38e1('0x4b')]({'where':{'id':_0x8e4a1[_0x38e1('0x4e')]['id']}})[_0x38e1('0x2a')](handleEntityNotFound(_0x5a31e2,null))[_0x38e1('0x2a')](saveUpdates(_0x8e4a1[_0x38e1('0x4d')],null))[_0x38e1('0x2a')](respondWithResult(_0x5a31e2,null))['catch'](handleError(_0x5a31e2,null));};exports[_0x38e1('0x4f')]=function(_0x3ebb52,_0x4e36ee){return db[_0x38e1('0x45')][_0x38e1('0x4b')]({'where':{'id':_0x3ebb52[_0x38e1('0x4e')]['id']}})[_0x38e1('0x2a')](handleEntityNotFound(_0x4e36ee,null))['then'](removeEntity(_0x4e36ee,null))[_0x38e1('0x4a')](handleError(_0x4e36ee,null));}; \ No newline at end of file +var _0x8ca6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','end','error','name','send','index','map','FreshsalesField','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','includeAll','include','rows','catch','show','params','rawAttributes','find','create','update','body','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4074d5,_0xa57194){var _0x502cfe=function(_0x345efa){while(--_0x345efa){_0x4074d5['push'](_0x4074d5['shift']());}};_0x502cfe(++_0xa57194);}(_0x8ca6,0x1d4));var _0x68ca=function(_0xed1937,_0x15081b){_0xed1937=_0xed1937-0x0;var _0x18e266=_0x8ca6[_0xed1937];return _0x18e266;};'use strict';var emlformat=require(_0x68ca('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x68ca('0x1'));var rp=require('request-promise');var moment=require(_0x68ca('0x2'));var BPromise=require(_0x68ca('0x3'));var Mustache=require('mustache');var util=require(_0x68ca('0x4'));var path=require(_0x68ca('0x5'));var sox=require(_0x68ca('0x6'));var csv=require(_0x68ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68ca('0x8'));var _=require(_0x68ca('0x9'));var squel=require('squel');var crypto=require(_0x68ca('0xa'));var jsforce=require(_0x68ca('0xb'));var deskjs=require(_0x68ca('0xc'));var toCsv=require(_0x68ca('0x7'));var querystring=require(_0x68ca('0xd'));var Papa=require(_0x68ca('0xe'));var Redis=require(_0x68ca('0xf'));var authService=require(_0x68ca('0x10'));var qs=require(_0x68ca('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68ca('0x12'));var logger=require(_0x68ca('0x13'))('api');var utils=require(_0x68ca('0x14'));var config=require(_0x68ca('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x68ca('0x16'))['db'];function respondWithStatusCode(_0x34aaea,_0x41dc0d){_0x41dc0d=_0x41dc0d||0xcc;return function(_0x39daae){if(_0x39daae){return _0x34aaea['sendStatus'](_0x41dc0d);}return _0x34aaea[_0x68ca('0x17')](_0x41dc0d)['end']();};}function respondWithResult(_0x160c0e,_0x527476){_0x527476=_0x527476||0xc8;return function(_0x131919){if(_0x131919){return _0x160c0e[_0x68ca('0x17')](_0x527476)[_0x68ca('0x18')](_0x131919);}};}function respondWithFilteredResult(_0x48ae18,_0x372ddf){return function(_0x56667f){if(_0x56667f){var _0x59c819=typeof _0x372ddf[_0x68ca('0x19')]===_0x68ca('0x1a')&&typeof _0x372ddf['limit']===_0x68ca('0x1a');var _0x4947aa=_0x56667f[_0x68ca('0x1b')];var _0x3fc5e9=_0x59c819?0x0:_0x372ddf[_0x68ca('0x19')];var _0x8e761a=_0x59c819?_0x56667f[_0x68ca('0x1b')]:_0x372ddf['offset']+_0x372ddf[_0x68ca('0x1c')];var _0x5112b6;if(_0x8e761a>=_0x4947aa){_0x8e761a=_0x4947aa;_0x5112b6=0xc8;}else{_0x5112b6=0xce;}_0x48ae18[_0x68ca('0x17')](_0x5112b6);return _0x48ae18[_0x68ca('0x1d')](_0x68ca('0x1e'),_0x3fc5e9+'-'+_0x8e761a+'/'+_0x4947aa)[_0x68ca('0x18')](_0x56667f);}return null;};}function patchUpdates(_0x2a9b93){return function(_0x37f384){try{jsonpatch[_0x68ca('0x1f')](_0x37f384,_0x2a9b93,!![]);}catch(_0x5f2457){return BPromise['reject'](_0x5f2457);}return _0x37f384['save']();};}function saveUpdates(_0x2ea6f2,_0x4b5f98){return function(_0x1e7953){if(_0x1e7953){return _0x1e7953['update'](_0x2ea6f2)['then'](function(_0x4771fe){return _0x4771fe;});}return null;};}function removeEntity(_0x44f56f,_0x271fed){return function(_0x105f6a){if(_0x105f6a){return _0x105f6a[_0x68ca('0x20')]()[_0x68ca('0x21')](function(){_0x44f56f[_0x68ca('0x17')](0xcc)[_0x68ca('0x22')]();});}};}function handleEntityNotFound(_0x31b7e,_0xb43906){return function(_0x2f803b){if(!_0x2f803b){_0x31b7e['sendStatus'](0x194);}return _0x2f803b;};}function handleError(_0x3fb670,_0x3cf593){_0x3cf593=_0x3cf593||0x1f4;return function(_0x18033b){logger[_0x68ca('0x23')](_0x18033b['stack']);if(_0x18033b[_0x68ca('0x24')]){delete _0x18033b['name'];}_0x3fb670[_0x68ca('0x17')](_0x3cf593)[_0x68ca('0x25')](_0x18033b);};}exports[_0x68ca('0x26')]=function(_0x5498df,_0xeb7d07){var _0x270040={},_0x3dd556={},_0x496a0a={'count':0x0,'rows':[]};var _0x27bb8a=_[_0x68ca('0x27')](db[_0x68ca('0x28')]['rawAttributes'],function(_0xb6c8e6){return{'name':_0xb6c8e6['fieldName'],'type':_0xb6c8e6['type'][_0x68ca('0x29')]};});_0x3dd556['model']=_[_0x68ca('0x27')](_0x27bb8a,'name');_0x3dd556[_0x68ca('0x2a')]=_[_0x68ca('0x2b')](_0x5498df[_0x68ca('0x2a')]);_0x3dd556[_0x68ca('0x2c')]=_['intersection'](_0x3dd556[_0x68ca('0x2d')],_0x3dd556[_0x68ca('0x2a')]);_0x270040[_0x68ca('0x2e')]=_[_0x68ca('0x2f')](_0x3dd556[_0x68ca('0x2d')],qs['fields'](_0x5498df[_0x68ca('0x2a')][_0x68ca('0x30')]));_0x270040[_0x68ca('0x2e')]=_0x270040[_0x68ca('0x2e')][_0x68ca('0x31')]?_0x270040[_0x68ca('0x2e')]:_0x3dd556[_0x68ca('0x2d')];if(!_0x5498df['query'][_0x68ca('0x32')](_0x68ca('0x33'))){_0x270040[_0x68ca('0x1c')]=qs[_0x68ca('0x1c')](_0x5498df[_0x68ca('0x2a')]['limit']);_0x270040['offset']=qs[_0x68ca('0x19')](_0x5498df[_0x68ca('0x2a')][_0x68ca('0x19')]);}_0x270040['order']=qs[_0x68ca('0x34')](_0x5498df[_0x68ca('0x2a')]['sort']);_0x270040['where']=qs[_0x68ca('0x2c')](_[_0x68ca('0x35')](_0x5498df['query'],_0x3dd556[_0x68ca('0x2c')]),_0x27bb8a);if(_0x5498df[_0x68ca('0x2a')][_0x68ca('0x36')]){_0x270040[_0x68ca('0x37')]=_[_0x68ca('0x38')](_0x270040[_0x68ca('0x37')],{'$or':_[_0x68ca('0x27')](_0x27bb8a,function(_0x36c3da){if(_0x36c3da[_0x68ca('0x39')]!=='VIRTUAL'){var _0x2f2429={};_0x2f2429[_0x36c3da[_0x68ca('0x24')]]={'$like':'%'+_0x5498df[_0x68ca('0x2a')][_0x68ca('0x36')]+'%'};return _0x2f2429;}})});}_0x270040=_[_0x68ca('0x38')]({},_0x270040,_0x5498df['options']);var _0x25ba6d={'where':_0x270040['where']};return db[_0x68ca('0x28')][_0x68ca('0x1b')](_0x25ba6d)[_0x68ca('0x21')](function(_0x52b3d8){_0x496a0a[_0x68ca('0x1b')]=_0x52b3d8;if(_0x5498df[_0x68ca('0x2a')][_0x68ca('0x3a')]){_0x270040[_0x68ca('0x3b')]=[{'all':!![]}];}return db[_0x68ca('0x28')]['findAll'](_0x270040);})[_0x68ca('0x21')](function(_0x1652b5){_0x496a0a[_0x68ca('0x3c')]=_0x1652b5;return _0x496a0a;})[_0x68ca('0x21')](respondWithFilteredResult(_0xeb7d07,_0x270040))[_0x68ca('0x3d')](handleError(_0xeb7d07,null));};exports[_0x68ca('0x3e')]=function(_0x29ceeb,_0x1eaf3f){var _0x11bf06={'raw':!![],'where':{'id':_0x29ceeb[_0x68ca('0x3f')]['id']}},_0x4bea8f={};_0x4bea8f[_0x68ca('0x2d')]=_[_0x68ca('0x2b')](db[_0x68ca('0x28')][_0x68ca('0x40')]);_0x4bea8f[_0x68ca('0x2a')]=_['keys'](_0x29ceeb[_0x68ca('0x2a')]);_0x4bea8f[_0x68ca('0x2c')]=_['intersection'](_0x4bea8f['model'],_0x4bea8f[_0x68ca('0x2a')]);_0x11bf06[_0x68ca('0x2e')]=_['intersection'](_0x4bea8f[_0x68ca('0x2d')],qs[_0x68ca('0x30')](_0x29ceeb[_0x68ca('0x2a')][_0x68ca('0x30')]));_0x11bf06[_0x68ca('0x2e')]=_0x11bf06['attributes'][_0x68ca('0x31')]?_0x11bf06[_0x68ca('0x2e')]:_0x4bea8f[_0x68ca('0x2d')];if(_0x29ceeb['query'][_0x68ca('0x3a')]){_0x11bf06[_0x68ca('0x3b')]=[{'all':!![]}];}_0x11bf06=_[_0x68ca('0x38')]({},_0x11bf06,_0x29ceeb['options']);return db[_0x68ca('0x28')][_0x68ca('0x41')](_0x11bf06)['then'](handleEntityNotFound(_0x1eaf3f,null))[_0x68ca('0x21')](respondWithResult(_0x1eaf3f,null))[_0x68ca('0x3d')](handleError(_0x1eaf3f,null));};exports[_0x68ca('0x42')]=function(_0x3dc58a,_0x5b4450){return db[_0x68ca('0x28')][_0x68ca('0x42')](_0x3dc58a['body'],{})[_0x68ca('0x21')](respondWithResult(_0x5b4450,0xc9))[_0x68ca('0x3d')](handleError(_0x5b4450,null));};exports[_0x68ca('0x43')]=function(_0x68655d,_0x3c20ec){if(_0x68655d[_0x68ca('0x44')]['id']){delete _0x68655d[_0x68ca('0x44')]['id'];}return db[_0x68ca('0x28')]['find']({'where':{'id':_0x68655d['params']['id']}})['then'](handleEntityNotFound(_0x3c20ec,null))[_0x68ca('0x21')](saveUpdates(_0x68655d[_0x68ca('0x44')],null))[_0x68ca('0x21')](respondWithResult(_0x3c20ec,null))[_0x68ca('0x3d')](handleError(_0x3c20ec,null));};exports['destroy']=function(_0x30943e,_0xdd335b){return db[_0x68ca('0x28')][_0x68ca('0x41')]({'where':{'id':_0x30943e['params']['id']}})[_0x68ca('0x21')](handleEntityNotFound(_0xdd335b,null))[_0x68ca('0x21')](removeEntity(_0xdd335b,null))[_0x68ca('0x3d')](handleError(_0xdd335b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index fd2a1d0..067d513 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 _0xbb8d=['rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','FieldId','lodash','../../config/logger','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb8d,0x146));var _0xdbb8=function(_0x18eb3f,_0x3a1cd9){_0x18eb3f=_0x18eb3f-0x0;var _0x6abc41=_0xbb8d[_0x18eb3f];return _0x6abc41;};'use strict';var _=require(_0xdbb8('0x0'));var util=require('util');var logger=require(_0xdbb8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdbb8('0x2'));var fs=require('fs');var path=require(_0xdbb8('0x3'));var rimraf=require(_0xdbb8('0x4'));var config=require(_0xdbb8('0x5'));var attributes=require(_0xdbb8('0x6'));module['exports']=function(_0x6a6db3,_0x149c99){return _0x6a6db3[_0xdbb8('0x7')](_0xdbb8('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xdbb8('0x9'),'fields':['idField',_0xdbb8('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde1e=['int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x187480,_0x45bd73){var _0x298b2c=function(_0x1c3dca){while(--_0x1c3dca){_0x187480['push'](_0x187480['shift']());}};_0x298b2c(++_0x45bd73);}(_0xde1e,0x9d));var _0xede1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde1e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xede1('0x0'));var util=require(_0xede1('0x1'));var logger=require(_0xede1('0x2'))(_0xede1('0x3'));var moment=require(_0xede1('0x4'));var BPromise=require(_0xede1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xede1('0x6'));var rimraf=require(_0xede1('0x7'));var config=require(_0xede1('0x8'));var attributes=require(_0xede1('0x9'));module[_0xede1('0xa')]=function(_0x3b760f,_0x4e9527){return _0x3b760f[_0xede1('0xb')](_0xede1('0xc'),attributes,{'tableName':_0xede1('0xd'),'paranoid':![],'indexes':[{'name':_0xede1('0xe'),'fields':[_0xede1('0xf'),_0xede1('0x10')],'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 40e2cfc..e1cef85 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 _0x814b=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x814b,0x1a2));var _0xb814=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x814b[_0x5180c3];return _0x55c975;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x486268,_0x30d5bf){var _0x20a834=function(_0x32fc69){while(--_0x32fc69){_0x486268['push'](_0x486268['shift']());}};_0x20a834(++_0x30d5bf);}(_0x90b1,0x1bb));var _0x190b=function(_0x4a248b,_0x29e290){_0x4a248b=_0x4a248b-0x0;var _0x565f8c=_0x90b1[_0x4a248b];return _0x565f8c;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 25ef684..df7c8d1 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(_0x154728,_0x2b865a){var _0x4351e0=function(_0x323f29){while(--_0x323f29){_0x154728['push'](_0x154728['shift']());}};_0x4351e0(++_0x2b865a);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5cae07,_0x14687c){var _0x5de9c6=function(_0x401183){while(--_0x401183){_0x5cae07['push'](_0x5cae07['shift']());}};_0x5de9c6(++_0x14687c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 04f5271..2d74432 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 _0xa868=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa868,0x1b8));var _0x8a86=function(_0x208f80,_0x2522c6){_0x208f80=_0x208f80-0x0;var _0x71c40c=_0xa868[_0x208f80];return _0x71c40c;};'use strict';var Sequelize=require(_0x8a86('0x0'));module[_0x8a86('0x1')]={'name':{'type':Sequelize[_0x8a86('0x2')]},'description':{'type':Sequelize[_0x8a86('0x2')]},'username':{'type':Sequelize[_0x8a86('0x2')],'unique':_0x8a86('0x3')},'remoteUri':{'type':Sequelize[_0x8a86('0x2')]},'password':{'type':Sequelize[_0x8a86('0x2')]},'clientId':{'type':Sequelize[_0x8a86('0x2')]},'clientSecret':{'type':Sequelize[_0x8a86('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8a86('0x4')](_0x8a86('0x5'),_0x8a86('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x73a8=['username','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x5a422b,_0x419b43){var _0xe64ff2=function(_0x2cff57){while(--_0x2cff57){_0x5a422b['push'](_0x5a422b['shift']());}};_0xe64ff2(++_0x419b43);}(_0x73a8,0x12a));var _0x873a=function(_0x5c0b04,_0x1f3899){_0x5c0b04=_0x5c0b04-0x0;var _0x5df17c=_0x73a8[_0x5c0b04];return _0x5df17c;};'use strict';var Sequelize=require('sequelize');module[_0x873a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x873a('0x1')]},'username':{'type':Sequelize[_0x873a('0x1')],'unique':_0x873a('0x2')},'remoteUri':{'type':Sequelize[_0x873a('0x1')]},'password':{'type':Sequelize[_0x873a('0x1')]},'clientId':{'type':Sequelize[_0x873a('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x873a('0x1')]},'serverUrl':{'type':Sequelize[_0x873a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x873a('0x3')](_0x873a('0x4'),_0x873a('0x5')),'defaultValue':_0x873a('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d49b2d0..b7c78ad 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 _0x64d0=['params','fields','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','merge','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','substring','Connection','login','concat','ticketType','sobject','describe','ActivityDate','IsRecurrence','Subject','Description','int','picklist','boolean','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x64d0,0x1a8));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x064d('0x0'));var zipdir=require(_0x064d('0x1'));var jsonpatch=require(_0x064d('0x2'));var rp=require(_0x064d('0x3'));var moment=require('moment');var BPromise=require(_0x064d('0x4'));var Mustache=require(_0x064d('0x5'));var util=require(_0x064d('0x6'));var path=require(_0x064d('0x7'));var sox=require('sox');var csv=require(_0x064d('0x8'));var ejs=require(_0x064d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x064d('0xa'));var squel=require(_0x064d('0xb'));var crypto=require(_0x064d('0xc'));var jsforce=require(_0x064d('0xd'));var deskjs=require(_0x064d('0xe'));var toCsv=require(_0x064d('0x8'));var querystring=require(_0x064d('0xf'));var Papa=require('papaparse');var Redis=require(_0x064d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x064d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x064d('0x12'))(_0x064d('0x13'));var utils=require(_0x064d('0x14'));var config=require(_0x064d('0x15'));var licenseUtil=require(_0x064d('0x16'));var db=require(_0x064d('0x17'))['db'];var integrations=require(_0x064d('0x18'));function respondWithStatusCode(_0x27c97f,_0x104c50){_0x104c50=_0x104c50||0xcc;return function(_0x11d95b){if(_0x11d95b){return _0x27c97f[_0x064d('0x19')](_0x104c50);}return _0x27c97f[_0x064d('0x1a')](_0x104c50)[_0x064d('0x1b')]();};}function respondWithResult(_0x4c4233,_0x3d13a0){_0x3d13a0=_0x3d13a0||0xc8;return function(_0x14acc6){if(_0x14acc6){return _0x4c4233[_0x064d('0x1a')](_0x3d13a0)['json'](_0x14acc6);}};}function respondWithFilteredResult(_0x58e616,_0x19e796){return function(_0x5bcc96){if(_0x5bcc96){var _0x26ebf7=typeof _0x19e796['offset']===_0x064d('0x1c')&&typeof _0x19e796['limit']===_0x064d('0x1c');var _0x5ddcfb=_0x5bcc96[_0x064d('0x1d')];var _0x18c079=_0x26ebf7?0x0:_0x19e796['offset'];var _0x21f015=_0x26ebf7?_0x5bcc96[_0x064d('0x1d')]:_0x19e796[_0x064d('0x1e')]+_0x19e796[_0x064d('0x1f')];var _0x399405;if(_0x21f015>=_0x5ddcfb){_0x21f015=_0x5ddcfb;_0x399405=0xc8;}else{_0x399405=0xce;}_0x58e616[_0x064d('0x1a')](_0x399405);return _0x58e616[_0x064d('0x20')](_0x064d('0x21'),_0x18c079+'-'+_0x21f015+'/'+_0x5ddcfb)['json'](_0x5bcc96);}return null;};}function patchUpdates(_0x5cb9e9){return function(_0x5e30b1){try{jsonpatch[_0x064d('0x22')](_0x5e30b1,_0x5cb9e9,!![]);}catch(_0x4a8a6c){return BPromise[_0x064d('0x23')](_0x4a8a6c);}return _0x5e30b1[_0x064d('0x24')]();};}function saveUpdates(_0x156a30,_0x39760e){return function(_0x370b79){if(_0x370b79){return _0x370b79[_0x064d('0x25')](_0x156a30)[_0x064d('0x26')](function(_0x572d9d){return _0x572d9d;});}return null;};}function removeEntity(_0x1dd2dd,_0x4fba61){return function(_0x232478){if(_0x232478){return _0x232478[_0x064d('0x27')]()['then'](function(){_0x1dd2dd[_0x064d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c659,_0x236f7a){return function(_0x33483e){if(!_0x33483e){_0x45c659['sendStatus'](0x194);}return _0x33483e;};}function handleError(_0x1da064,_0x2a799c){_0x2a799c=_0x2a799c||0x1f4;return function(_0x27bc11){logger['error'](_0x27bc11['stack']);if(_0x27bc11[_0x064d('0x28')]){delete _0x27bc11['name'];}_0x1da064[_0x064d('0x1a')](_0x2a799c)[_0x064d('0x29')](_0x27bc11);};}exports[_0x064d('0x2a')]=function(_0x4fe7c8,_0x35c97a){var _0x3d0ad0={},_0x1a139b={},_0x43e8c5={'count':0x0,'rows':[]};var _0x1fa918=_[_0x064d('0x2b')](db[_0x064d('0x2c')][_0x064d('0x2d')],function(_0x15df75){return{'name':_0x15df75[_0x064d('0x2e')],'type':_0x15df75[_0x064d('0x2f')]['key']};});_0x1a139b['model']=_[_0x064d('0x2b')](_0x1fa918,'name');_0x1a139b[_0x064d('0x30')]=_[_0x064d('0x31')](_0x4fe7c8[_0x064d('0x30')]);_0x1a139b['filters']=_[_0x064d('0x32')](_0x1a139b['model'],_0x1a139b['query']);_0x3d0ad0[_0x064d('0x33')]=_['intersection'](_0x1a139b[_0x064d('0x34')],qs['fields'](_0x4fe7c8['query']['fields']));_0x3d0ad0[_0x064d('0x33')]=_0x3d0ad0['attributes'][_0x064d('0x35')]?_0x3d0ad0[_0x064d('0x33')]:_0x1a139b[_0x064d('0x34')];if(!_0x4fe7c8[_0x064d('0x30')][_0x064d('0x36')]('nolimit')){_0x3d0ad0[_0x064d('0x1f')]=qs[_0x064d('0x1f')](_0x4fe7c8[_0x064d('0x30')]['limit']);_0x3d0ad0[_0x064d('0x1e')]=qs[_0x064d('0x1e')](_0x4fe7c8[_0x064d('0x30')][_0x064d('0x1e')]);}_0x3d0ad0[_0x064d('0x37')]=qs[_0x064d('0x38')](_0x4fe7c8['query'][_0x064d('0x38')]);_0x3d0ad0[_0x064d('0x39')]=qs['filters'](_['pick'](_0x4fe7c8[_0x064d('0x30')],_0x1a139b[_0x064d('0x3a')]),_0x1fa918);if(_0x4fe7c8['query'][_0x064d('0x3b')]){_0x3d0ad0[_0x064d('0x39')]=_['merge'](_0x3d0ad0[_0x064d('0x39')],{'$or':_[_0x064d('0x2b')](_0x1fa918,function(_0xac7d41){if(_0xac7d41[_0x064d('0x2f')]!==_0x064d('0x3c')){var _0x58f9f8={};_0x58f9f8[_0xac7d41[_0x064d('0x28')]]={'$like':'%'+_0x4fe7c8[_0x064d('0x30')][_0x064d('0x3b')]+'%'};return _0x58f9f8;}})});}_0x3d0ad0=_['merge']({},_0x3d0ad0,_0x4fe7c8[_0x064d('0x3d')]);var _0x2a0378={'where':_0x3d0ad0[_0x064d('0x39')]};return db['SalesforceAccount'][_0x064d('0x1d')](_0x2a0378)[_0x064d('0x26')](function(_0x22dd9c){_0x43e8c5[_0x064d('0x1d')]=_0x22dd9c;if(_0x4fe7c8[_0x064d('0x30')][_0x064d('0x3e')]){_0x3d0ad0[_0x064d('0x3f')]=[{'all':!![]}];}return db[_0x064d('0x2c')][_0x064d('0x40')](_0x3d0ad0);})[_0x064d('0x26')](function(_0x20ab08){_0x43e8c5[_0x064d('0x41')]=_0x20ab08;return _0x43e8c5;})[_0x064d('0x26')](respondWithFilteredResult(_0x35c97a,_0x3d0ad0))[_0x064d('0x42')](handleError(_0x35c97a,null));};exports[_0x064d('0x43')]=function(_0x1af99e,_0x484836){var _0x3d4d2c={'raw':![],'where':{'id':_0x1af99e[_0x064d('0x44')]['id']}},_0x4bce3a={};_0x4bce3a[_0x064d('0x34')]=_['keys'](db[_0x064d('0x2c')][_0x064d('0x2d')]);_0x4bce3a[_0x064d('0x30')]=_[_0x064d('0x31')](_0x1af99e[_0x064d('0x30')]);_0x4bce3a[_0x064d('0x3a')]=_[_0x064d('0x32')](_0x4bce3a[_0x064d('0x34')],_0x4bce3a['query']);_0x3d4d2c[_0x064d('0x33')]=_[_0x064d('0x32')](_0x4bce3a[_0x064d('0x34')],qs['fields'](_0x1af99e['query'][_0x064d('0x45')]));_0x3d4d2c[_0x064d('0x33')]=_0x3d4d2c[_0x064d('0x33')]['length']?_0x3d4d2c[_0x064d('0x33')]:_0x4bce3a[_0x064d('0x34')];if(_0x1af99e['query']['includeAll']){_0x3d4d2c['include']=[{'all':!![]}];}_0x3d4d2c=_['merge']({},_0x3d4d2c,_0x1af99e[_0x064d('0x3d')]);return db[_0x064d('0x2c')][_0x064d('0x46')](_0x3d4d2c)[_0x064d('0x26')](handleEntityNotFound(_0x484836,null))[_0x064d('0x26')](respondWithResult(_0x484836,null))[_0x064d('0x42')](handleError(_0x484836,null));};exports['create']=function(_0x3b691a,_0x1e7abf){return db[_0x064d('0x2c')][_0x064d('0x47')](_0x3b691a[_0x064d('0x48')],{})[_0x064d('0x26')](respondWithResult(_0x1e7abf,0xc9))[_0x064d('0x42')](handleError(_0x1e7abf,null));};exports[_0x064d('0x25')]=function(_0x43470a,_0x5122d3){if(_0x43470a['body']['id']){delete _0x43470a['body']['id'];}return db['SalesforceAccount'][_0x064d('0x46')]({'where':{'id':_0x43470a[_0x064d('0x44')]['id']}})[_0x064d('0x26')](handleEntityNotFound(_0x5122d3,null))[_0x064d('0x26')](saveUpdates(_0x43470a['body'],null))['then'](respondWithResult(_0x5122d3,null))[_0x064d('0x42')](handleError(_0x5122d3,null));};exports[_0x064d('0x27')]=function(_0x1f0928,_0x16eb4d){return db[_0x064d('0x2c')][_0x064d('0x46')]({'where':{'id':_0x1f0928[_0x064d('0x44')]['id']}})[_0x064d('0x26')](handleEntityNotFound(_0x16eb4d,null))[_0x064d('0x26')](removeEntity(_0x16eb4d,null))[_0x064d('0x42')](handleError(_0x16eb4d,null));};exports[_0x064d('0x49')]=function(_0xa76d00,_0x1dddaa,_0x3a33b3){var _0x14b8b0={};var _0x5d6e16={};var _0x38b821;var _0x5d230f;return db['SalesforceAccount'][_0x064d('0x4a')]({'where':{'id':_0xa76d00[_0x064d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1dddaa,null))[_0x064d('0x26')](function(_0x36cef5){if(_0x36cef5){_0x38b821=_0x36cef5;_0x5d6e16[_0x064d('0x34')]=_[_0x064d('0x31')](db[_0x064d('0x4b')]['rawAttributes']);_0x5d6e16[_0x064d('0x30')]=_[_0x064d('0x31')](_0xa76d00[_0x064d('0x30')]);_0x5d6e16[_0x064d('0x3a')]=_[_0x064d('0x32')](_0x5d6e16[_0x064d('0x34')],_0x5d6e16[_0x064d('0x30')]);_0x14b8b0['attributes']=_[_0x064d('0x32')](_0x5d6e16['model'],qs['fields'](_0xa76d00[_0x064d('0x30')][_0x064d('0x45')]));_0x14b8b0[_0x064d('0x33')]=_0x14b8b0[_0x064d('0x33')][_0x064d('0x35')]?_0x14b8b0[_0x064d('0x33')]:_0x5d6e16[_0x064d('0x34')];_0x14b8b0[_0x064d('0x37')]=qs['sort'](_0xa76d00[_0x064d('0x30')]['sort']);_0x14b8b0['where']=qs[_0x064d('0x3a')](_[_0x064d('0x4c')](_0xa76d00[_0x064d('0x30')],_0x5d6e16['filters']));if(_0xa76d00[_0x064d('0x30')][_0x064d('0x3b')]){_0x14b8b0[_0x064d('0x39')]=_['merge'](_0x14b8b0[_0x064d('0x39')],{'$or':_[_0x064d('0x2b')](_0x14b8b0[_0x064d('0x33')],function(_0x1f034e){var _0x3b985={};_0x3b985[_0x1f034e]={'$like':'%'+_0xa76d00[_0x064d('0x30')][_0x064d('0x3b')]+'%'};return _0x3b985;})});}_0x14b8b0=_[_0x064d('0x4d')]({},_0x14b8b0,_0xa76d00[_0x064d('0x3d')]);return _0x38b821['getConfigurations'](_0x14b8b0);}})[_0x064d('0x26')](function(_0x5def26){if(_0x5def26){_0x5d230f=_0x5def26['length'];if(!_0xa76d00[_0x064d('0x30')]['hasOwnProperty'](_0x064d('0x4e'))){_0x14b8b0[_0x064d('0x1f')]=qs[_0x064d('0x1f')](_0xa76d00[_0x064d('0x30')][_0x064d('0x1f')]);_0x14b8b0[_0x064d('0x1e')]=qs[_0x064d('0x1e')](_0xa76d00[_0x064d('0x30')][_0x064d('0x1e')]);}return _0x38b821[_0x064d('0x49')](_0x14b8b0);}})[_0x064d('0x26')](function(_0x19a296){if(_0x19a296){return _0x19a296?{'count':_0x5d230f,'rows':_0x19a296}:null;}})[_0x064d('0x26')](respondWithResult(_0x1dddaa,null))['catch'](handleError(_0x1dddaa,null));};exports[_0x064d('0x4f')]=function(_0x14b483,_0x451606,_0x21b740){if(_0x14b483[_0x064d('0x48')]['id']){delete _0x14b483['body']['id'];}return db[_0x064d('0x2c')][_0x064d('0x4a')]({'where':{'id':_0x14b483['params']['id']}})[_0x064d('0x26')](handleEntityNotFound(_0x451606,null))[_0x064d('0x26')](function(_0x35d397){if(_0x35d397){_0x14b483[_0x064d('0x48')][_0x064d('0x50')]=_0x35d397['id'];_0x14b483[_0x064d('0x48')][_0x064d('0x51')]=integrations[_0x064d('0x52')](_0x14b483[_0x064d('0x48')]['channel'],_0x14b483[_0x064d('0x48')][_0x064d('0x2f')]);_0x14b483[_0x064d('0x48')][_0x064d('0x53')]=integrations[_0x064d('0x54')](_0x14b483['body'][_0x064d('0x55')],_0x14b483[_0x064d('0x48')][_0x064d('0x2f')]);return db[_0x064d('0x4b')]['create'](_0x14b483[_0x064d('0x48')],{'include':[{'model':db[_0x064d('0x56')],'as':'Subjects'},{'model':db[_0x064d('0x56')],'as':_0x064d('0x53')}]});}return null;})['then'](respondWithResult(_0x451606,null))['catch'](handleError(_0x451606,null));};exports[_0x064d('0x57')]=function(_0x16d229,_0x58ca0b,_0x443dbd){var _0x1b25a1;var _0x456cf4='';var _0x1a993f='Task';return db['SalesforceAccount'][_0x064d('0x4a')]({'where':{'id':_0x16d229[_0x064d('0x44')]['id']},'attributes':['id',_0x064d('0x58'),_0x064d('0x59'),_0x064d('0x5a'),_0x064d('0x5b'),_0x064d('0x5c'),_0x064d('0x5d')]})[_0x064d('0x26')](handleEntityNotFound(_0x58ca0b,null))[_0x064d('0x26')](function(_0xd390cc){if(_0xd390cc){_0x456cf4=_0xd390cc[_0x064d('0x58')];var _0xaa11e5=_0x456cf4['slice'](-0x1);if(_0xaa11e5==='/'){_0x456cf4=_0x456cf4[_0x064d('0x5e')](0x0,_0x456cf4['lastIndexOf'](_0xaa11e5));}_0x1b25a1=new jsforce[(_0x064d('0x5f'))]({'oauth2':{'loginUrl':_0x456cf4,'clientId':_0xd390cc[_0x064d('0x59')],'clientSecret':_0xd390cc[_0x064d('0x5a')]}});return _0x1b25a1[_0x064d('0x60')](_0xd390cc['username'],_0xd390cc[_0x064d('0x5c')][_0x064d('0x61')](_0xd390cc[_0x064d('0x5d')]));}})[_0x064d('0x26')](function(_0x2af533){if(_0x2af533){if(!_['isNil'](_0x16d229[_0x064d('0x30')][_0x064d('0x62')])){_0x1a993f=_0x16d229[_0x064d('0x30')][_0x064d('0x62')];}return _0x1b25a1[_0x064d('0x63')](_0x1a993f)[_0x064d('0x64')]();}})[_0x064d('0x26')](function(_0x391b17){var _0x2667a0=['OwnerId',_0x064d('0x65'),'IsReminderSet',_0x064d('0x66'),_0x064d('0x67'),_0x064d('0x68')];var _0xc1b180=['string',_0x064d('0x69'),_0x064d('0x6a'),_0x064d('0x6b'),'email',_0x064d('0x6c'),_0x064d('0x6d')];if(_0x391b17){_[_0x064d('0x6e')](_0x391b17[_0x064d('0x45')],function(_0x21b4f4){return _0x2667a0[_0x064d('0x6f')](_0x21b4f4[_0x064d('0x28')])||!_0xc1b180[_0x064d('0x6f')](_0x21b4f4[_0x064d('0x2f')]);});return{'count':_0x391b17[_0x064d('0x45')][_0x064d('0x35')],'rows':_[_0x064d('0x2b')](_0x391b17[_0x064d('0x45')],function(_0xe77c71){return{'id':_0xe77c71['name'],'name':_0xe77c71[_0x064d('0x70')],'custom':_0xe77c71[_0x064d('0x71')],'options':_0xe77c71[_0x064d('0x72')][_0x064d('0x35')]>0x0?_[_0x064d('0x2b')](_0xe77c71[_0x064d('0x72')],function(_0x55608a){return{'name':_0x55608a[_0x064d('0x70')],'value':_0x55608a[_0x064d('0x73')]};}):_0xe77c71[_0x064d('0x2f')]==_0x064d('0x6b')?[{'name':_0x064d('0x74'),'value':_0x064d('0x75')},{'name':_0x064d('0x76'),'value':'false'}]:[]};})};}})[_0x064d('0x26')](respondWithResult(_0x58ca0b,null))[_0x064d('0x42')](function(_0x533c59){var _0x40fb62=_0x16d229[_0x064d('0x30')]['test']?0x1f4:_0x533c59[_0x064d('0x77')]||0x1f4;logger['error'](_0x064d('0x78'),'getFields',_0x40fb62,JSON[_0x064d('0x79')](_0x533c59));delete _0x533c59[_0x064d('0x28')];if(_0x40fb62===0x191){_0x40fb62=0x190;}_0x58ca0b['status'](_0x40fb62)[_0x064d('0x29')](_0x16d229[_0x064d('0x30')]['test']?{'message':_0x064d('0x7a'),'statusCode':_0x533c59[_0x064d('0x77')]}:_0x533c59);});}; \ No newline at end of file +var _0x6c2c=['../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','SalesforceAccount','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','include','options','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','Task','clientId','password','securityToken','remoteUri','slice','substring','clientSecret','login','username','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','boolean','textarea','remove','includes','label','custom','value','True','true','False','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1755eb,_0x184f1e){var _0x26230e=function(_0x1d29ba){while(--_0x1d29ba){_0x1755eb['push'](_0x1755eb['shift']());}};_0x26230e(++_0x184f1e);}(_0x6c2c,0x1d4));var _0xc6c2=function(_0x2dba2f,_0x22e3f6){_0x2dba2f=_0x2dba2f-0x0;var _0x22a126=_0x6c2c[_0x2dba2f];return _0x22a126;};'use strict';var emlformat=require(_0xc6c2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc6c2('0x1'));var moment=require('moment');var BPromise=require(_0xc6c2('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc6c2('0x3'));var sox=require(_0xc6c2('0x4'));var csv=require(_0xc6c2('0x5'));var ejs=require(_0xc6c2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6c2('0x7'));var squel=require('squel');var crypto=require(_0xc6c2('0x8'));var jsforce=require(_0xc6c2('0x9'));var deskjs=require(_0xc6c2('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc6c2('0xb'));var Papa=require(_0xc6c2('0xc'));var Redis=require(_0xc6c2('0xd'));var authService=require(_0xc6c2('0xe'));var qs=require(_0xc6c2('0xf'));var as=require(_0xc6c2('0x10'));var hardwareService=require(_0xc6c2('0x11'));var logger=require(_0xc6c2('0x12'))(_0xc6c2('0x13'));var utils=require(_0xc6c2('0x14'));var config=require(_0xc6c2('0x15'));var licenseUtil=require(_0xc6c2('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5875e5,_0x5a3d97){_0x5a3d97=_0x5a3d97||0xcc;return function(_0x13cfb1){if(_0x13cfb1){return _0x5875e5['sendStatus'](_0x5a3d97);}return _0x5875e5[_0xc6c2('0x17')](_0x5a3d97)[_0xc6c2('0x18')]();};}function respondWithResult(_0x236dfd,_0x2d5a99){_0x2d5a99=_0x2d5a99||0xc8;return function(_0x2df941){if(_0x2df941){return _0x236dfd[_0xc6c2('0x17')](_0x2d5a99)['json'](_0x2df941);}};}function respondWithFilteredResult(_0xfb3f21,_0x405073){return function(_0x3b7723){if(_0x3b7723){var _0x1d3be5=typeof _0x405073[_0xc6c2('0x19')]===_0xc6c2('0x1a')&&typeof _0x405073[_0xc6c2('0x1b')]===_0xc6c2('0x1a');var _0xefb9ea=_0x3b7723[_0xc6c2('0x1c')];var _0xf8234d=_0x1d3be5?0x0:_0x405073[_0xc6c2('0x19')];var _0x18f85c=_0x1d3be5?_0x3b7723[_0xc6c2('0x1c')]:_0x405073[_0xc6c2('0x19')]+_0x405073[_0xc6c2('0x1b')];var _0x1d5127;if(_0x18f85c>=_0xefb9ea){_0x18f85c=_0xefb9ea;_0x1d5127=0xc8;}else{_0x1d5127=0xce;}_0xfb3f21['status'](_0x1d5127);return _0xfb3f21[_0xc6c2('0x1d')]('Content-Range',_0xf8234d+'-'+_0x18f85c+'/'+_0xefb9ea)[_0xc6c2('0x1e')](_0x3b7723);}return null;};}function patchUpdates(_0x17f902){return function(_0x2f8244){try{jsonpatch[_0xc6c2('0x1f')](_0x2f8244,_0x17f902,!![]);}catch(_0x506585){return BPromise[_0xc6c2('0x20')](_0x506585);}return _0x2f8244[_0xc6c2('0x21')]();};}function saveUpdates(_0x2efe55,_0x4bad9a){return function(_0x48c808){if(_0x48c808){return _0x48c808['update'](_0x2efe55)[_0xc6c2('0x22')](function(_0x5e23ef){return _0x5e23ef;});}return null;};}function removeEntity(_0x27b3dd,_0x195e11){return function(_0x42b7ed){if(_0x42b7ed){return _0x42b7ed[_0xc6c2('0x23')]()['then'](function(){_0x27b3dd[_0xc6c2('0x17')](0xcc)[_0xc6c2('0x18')]();});}};}function handleEntityNotFound(_0x3c4fe6,_0x51c2fb){return function(_0x209f39){if(!_0x209f39){_0x3c4fe6[_0xc6c2('0x24')](0x194);}return _0x209f39;};}function handleError(_0x7539a4,_0x4f547f){_0x4f547f=_0x4f547f||0x1f4;return function(_0x33c7c6){logger[_0xc6c2('0x25')](_0x33c7c6[_0xc6c2('0x26')]);if(_0x33c7c6[_0xc6c2('0x27')]){delete _0x33c7c6[_0xc6c2('0x27')];}_0x7539a4['status'](_0x4f547f)[_0xc6c2('0x28')](_0x33c7c6);};}exports[_0xc6c2('0x29')]=function(_0x3d399c,_0x421f3b){var _0x24ea54={},_0x1f081c={},_0x23cbaa={'count':0x0,'rows':[]};var _0x4592b2=_['map'](db[_0xc6c2('0x2a')]['rawAttributes'],function(_0x558565){return{'name':_0x558565[_0xc6c2('0x2b')],'type':_0x558565[_0xc6c2('0x2c')][_0xc6c2('0x2d')]};});_0x1f081c[_0xc6c2('0x2e')]=_[_0xc6c2('0x2f')](_0x4592b2,_0xc6c2('0x27'));_0x1f081c['query']=_['keys'](_0x3d399c[_0xc6c2('0x30')]);_0x1f081c[_0xc6c2('0x31')]=_[_0xc6c2('0x32')](_0x1f081c[_0xc6c2('0x2e')],_0x1f081c[_0xc6c2('0x30')]);_0x24ea54['attributes']=_[_0xc6c2('0x32')](_0x1f081c['model'],qs[_0xc6c2('0x33')](_0x3d399c[_0xc6c2('0x30')][_0xc6c2('0x33')]));_0x24ea54[_0xc6c2('0x34')]=_0x24ea54['attributes'][_0xc6c2('0x35')]?_0x24ea54['attributes']:_0x1f081c['model'];if(!_0x3d399c['query'][_0xc6c2('0x36')](_0xc6c2('0x37'))){_0x24ea54[_0xc6c2('0x1b')]=qs[_0xc6c2('0x1b')](_0x3d399c[_0xc6c2('0x30')][_0xc6c2('0x1b')]);_0x24ea54[_0xc6c2('0x19')]=qs[_0xc6c2('0x19')](_0x3d399c['query'][_0xc6c2('0x19')]);}_0x24ea54[_0xc6c2('0x38')]=qs[_0xc6c2('0x39')](_0x3d399c[_0xc6c2('0x30')][_0xc6c2('0x39')]);_0x24ea54[_0xc6c2('0x3a')]=qs[_0xc6c2('0x31')](_[_0xc6c2('0x3b')](_0x3d399c[_0xc6c2('0x30')],_0x1f081c[_0xc6c2('0x31')]),_0x4592b2);if(_0x3d399c[_0xc6c2('0x30')][_0xc6c2('0x3c')]){_0x24ea54['where']=_[_0xc6c2('0x3d')](_0x24ea54[_0xc6c2('0x3a')],{'$or':_['map'](_0x4592b2,function(_0x28a098){if(_0x28a098[_0xc6c2('0x2c')]!==_0xc6c2('0x3e')){var _0x32c396={};_0x32c396[_0x28a098[_0xc6c2('0x27')]]={'$like':'%'+_0x3d399c[_0xc6c2('0x30')][_0xc6c2('0x3c')]+'%'};return _0x32c396;}})});}_0x24ea54=_[_0xc6c2('0x3d')]({},_0x24ea54,_0x3d399c['options']);var _0x24a022={'where':_0x24ea54['where']};return db['SalesforceAccount'][_0xc6c2('0x1c')](_0x24a022)[_0xc6c2('0x22')](function(_0x3dfded){_0x23cbaa[_0xc6c2('0x1c')]=_0x3dfded;if(_0x3d399c[_0xc6c2('0x30')][_0xc6c2('0x3f')]){_0x24ea54['include']=[{'all':!![]}];}return db[_0xc6c2('0x2a')]['findAll'](_0x24ea54);})[_0xc6c2('0x22')](function(_0x5055e5){_0x23cbaa[_0xc6c2('0x40')]=_0x5055e5;return _0x23cbaa;})[_0xc6c2('0x22')](respondWithFilteredResult(_0x421f3b,_0x24ea54))[_0xc6c2('0x41')](handleError(_0x421f3b,null));};exports[_0xc6c2('0x42')]=function(_0x4b4d85,_0x196f66){var _0x3aeda1={'raw':![],'where':{'id':_0x4b4d85[_0xc6c2('0x43')]['id']}},_0x33dd32={};_0x33dd32[_0xc6c2('0x2e')]=_[_0xc6c2('0x44')](db[_0xc6c2('0x2a')]['rawAttributes']);_0x33dd32[_0xc6c2('0x30')]=_[_0xc6c2('0x44')](_0x4b4d85['query']);_0x33dd32[_0xc6c2('0x31')]=_['intersection'](_0x33dd32[_0xc6c2('0x2e')],_0x33dd32[_0xc6c2('0x30')]);_0x3aeda1[_0xc6c2('0x34')]=_[_0xc6c2('0x32')](_0x33dd32[_0xc6c2('0x2e')],qs[_0xc6c2('0x33')](_0x4b4d85['query']['fields']));_0x3aeda1[_0xc6c2('0x34')]=_0x3aeda1[_0xc6c2('0x34')]['length']?_0x3aeda1[_0xc6c2('0x34')]:_0x33dd32['model'];if(_0x4b4d85['query'][_0xc6c2('0x3f')]){_0x3aeda1[_0xc6c2('0x45')]=[{'all':!![]}];}_0x3aeda1=_[_0xc6c2('0x3d')]({},_0x3aeda1,_0x4b4d85[_0xc6c2('0x46')]);return db[_0xc6c2('0x2a')][_0xc6c2('0x47')](_0x3aeda1)[_0xc6c2('0x22')](handleEntityNotFound(_0x196f66,null))[_0xc6c2('0x22')](respondWithResult(_0x196f66,null))[_0xc6c2('0x41')](handleError(_0x196f66,null));};exports[_0xc6c2('0x48')]=function(_0x4064ab,_0x580768){return db['SalesforceAccount']['create'](_0x4064ab[_0xc6c2('0x49')],{})['then'](respondWithResult(_0x580768,0xc9))['catch'](handleError(_0x580768,null));};exports[_0xc6c2('0x4a')]=function(_0x162dbe,_0x3449d2){if(_0x162dbe['body']['id']){delete _0x162dbe[_0xc6c2('0x49')]['id'];}return db[_0xc6c2('0x2a')]['find']({'where':{'id':_0x162dbe[_0xc6c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x3449d2,null))[_0xc6c2('0x22')](saveUpdates(_0x162dbe[_0xc6c2('0x49')],null))[_0xc6c2('0x22')](respondWithResult(_0x3449d2,null))['catch'](handleError(_0x3449d2,null));};exports[_0xc6c2('0x23')]=function(_0x39eeae,_0x1a0aed){return db[_0xc6c2('0x2a')][_0xc6c2('0x47')]({'where':{'id':_0x39eeae[_0xc6c2('0x43')]['id']}})[_0xc6c2('0x22')](handleEntityNotFound(_0x1a0aed,null))[_0xc6c2('0x22')](removeEntity(_0x1a0aed,null))[_0xc6c2('0x41')](handleError(_0x1a0aed,null));};exports[_0xc6c2('0x4b')]=function(_0x33bcf5,_0x4109ac,_0x5808a2){var _0x1921fa={};var _0x33ceb3={};var _0x52d96c;var _0x3235dc;return db[_0xc6c2('0x2a')][_0xc6c2('0x4c')]({'where':{'id':_0x33bcf5['params']['id']}})['then'](handleEntityNotFound(_0x4109ac,null))[_0xc6c2('0x22')](function(_0x4227cf){if(_0x4227cf){_0x52d96c=_0x4227cf;_0x33ceb3['model']=_['keys'](db[_0xc6c2('0x4d')]['rawAttributes']);_0x33ceb3[_0xc6c2('0x30')]=_['keys'](_0x33bcf5[_0xc6c2('0x30')]);_0x33ceb3['filters']=_['intersection'](_0x33ceb3[_0xc6c2('0x2e')],_0x33ceb3[_0xc6c2('0x30')]);_0x1921fa[_0xc6c2('0x34')]=_[_0xc6c2('0x32')](_0x33ceb3[_0xc6c2('0x2e')],qs[_0xc6c2('0x33')](_0x33bcf5[_0xc6c2('0x30')]['fields']));_0x1921fa[_0xc6c2('0x34')]=_0x1921fa[_0xc6c2('0x34')][_0xc6c2('0x35')]?_0x1921fa['attributes']:_0x33ceb3[_0xc6c2('0x2e')];_0x1921fa['order']=qs[_0xc6c2('0x39')](_0x33bcf5[_0xc6c2('0x30')]['sort']);_0x1921fa[_0xc6c2('0x3a')]=qs[_0xc6c2('0x31')](_[_0xc6c2('0x3b')](_0x33bcf5[_0xc6c2('0x30')],_0x33ceb3['filters']));if(_0x33bcf5['query'][_0xc6c2('0x3c')]){_0x1921fa[_0xc6c2('0x3a')]=_[_0xc6c2('0x3d')](_0x1921fa['where'],{'$or':_[_0xc6c2('0x2f')](_0x1921fa[_0xc6c2('0x34')],function(_0x264bb9){var _0x15a560={};_0x15a560[_0x264bb9]={'$like':'%'+_0x33bcf5[_0xc6c2('0x30')][_0xc6c2('0x3c')]+'%'};return _0x15a560;})});}_0x1921fa=_[_0xc6c2('0x3d')]({},_0x1921fa,_0x33bcf5[_0xc6c2('0x46')]);return _0x52d96c['getConfigurations'](_0x1921fa);}})[_0xc6c2('0x22')](function(_0xde80fe){if(_0xde80fe){_0x3235dc=_0xde80fe['length'];if(!_0x33bcf5['query'][_0xc6c2('0x36')](_0xc6c2('0x37'))){_0x1921fa[_0xc6c2('0x1b')]=qs[_0xc6c2('0x1b')](_0x33bcf5['query'][_0xc6c2('0x1b')]);_0x1921fa[_0xc6c2('0x19')]=qs[_0xc6c2('0x19')](_0x33bcf5[_0xc6c2('0x30')][_0xc6c2('0x19')]);}return _0x52d96c[_0xc6c2('0x4b')](_0x1921fa);}})[_0xc6c2('0x22')](function(_0x3ef175){if(_0x3ef175){return _0x3ef175?{'count':_0x3235dc,'rows':_0x3ef175}:null;}})['then'](respondWithResult(_0x4109ac,null))[_0xc6c2('0x41')](handleError(_0x4109ac,null));};exports[_0xc6c2('0x4e')]=function(_0x15cfcd,_0xed27d8,_0x27aab0){if(_0x15cfcd['body']['id']){delete _0x15cfcd[_0xc6c2('0x49')]['id'];}return db[_0xc6c2('0x2a')][_0xc6c2('0x4c')]({'where':{'id':_0x15cfcd[_0xc6c2('0x43')]['id']}})[_0xc6c2('0x22')](handleEntityNotFound(_0xed27d8,null))[_0xc6c2('0x22')](function(_0x54b3cb){if(_0x54b3cb){_0x15cfcd[_0xc6c2('0x49')][_0xc6c2('0x4f')]=_0x54b3cb['id'];_0x15cfcd['body'][_0xc6c2('0x50')]=integrations['getSubjects'](_0x15cfcd[_0xc6c2('0x49')][_0xc6c2('0x51')],_0x15cfcd[_0xc6c2('0x49')][_0xc6c2('0x2c')]);_0x15cfcd['body'][_0xc6c2('0x52')]=integrations[_0xc6c2('0x53')](_0x15cfcd[_0xc6c2('0x49')][_0xc6c2('0x51')],_0x15cfcd[_0xc6c2('0x49')][_0xc6c2('0x2c')]);return db[_0xc6c2('0x4d')]['create'](_0x15cfcd[_0xc6c2('0x49')],{'include':[{'model':db['SalesforceField'],'as':_0xc6c2('0x50')},{'model':db[_0xc6c2('0x54')],'as':_0xc6c2('0x52')}]});}return null;})[_0xc6c2('0x22')](respondWithResult(_0xed27d8,null))[_0xc6c2('0x41')](handleError(_0xed27d8,null));};exports['getFields']=function(_0x25d109,_0x866dd6,_0xa83e10){var _0x257e5f;var _0x4d93fc='';var _0x33159c=_0xc6c2('0x55');return db[_0xc6c2('0x2a')][_0xc6c2('0x4c')]({'where':{'id':_0x25d109['params']['id']},'attributes':['id','remoteUri',_0xc6c2('0x56'),'clientSecret','username',_0xc6c2('0x57'),_0xc6c2('0x58')]})[_0xc6c2('0x22')](handleEntityNotFound(_0x866dd6,null))['then'](function(_0x28f7d0){if(_0x28f7d0){_0x4d93fc=_0x28f7d0[_0xc6c2('0x59')];var _0x242940=_0x4d93fc[_0xc6c2('0x5a')](-0x1);if(_0x242940==='/'){_0x4d93fc=_0x4d93fc[_0xc6c2('0x5b')](0x0,_0x4d93fc['lastIndexOf'](_0x242940));}_0x257e5f=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4d93fc,'clientId':_0x28f7d0['clientId'],'clientSecret':_0x28f7d0[_0xc6c2('0x5c')]}});return _0x257e5f[_0xc6c2('0x5d')](_0x28f7d0[_0xc6c2('0x5e')],_0x28f7d0[_0xc6c2('0x57')]['concat'](_0x28f7d0[_0xc6c2('0x58')]));}})[_0xc6c2('0x22')](function(_0x57089b){if(_0x57089b){if(!_[_0xc6c2('0x5f')](_0x25d109[_0xc6c2('0x30')][_0xc6c2('0x60')])){_0x33159c=_0x25d109[_0xc6c2('0x30')]['ticketType'];}return _0x257e5f['sobject'](_0x33159c)[_0xc6c2('0x61')]();}})[_0xc6c2('0x22')](function(_0x1df81e){var _0x1967f8=[_0xc6c2('0x62'),_0xc6c2('0x63'),_0xc6c2('0x64'),'IsRecurrence',_0xc6c2('0x65'),_0xc6c2('0x66')];var _0x4138dc=[_0xc6c2('0x67'),_0xc6c2('0x68'),_0xc6c2('0x69'),_0xc6c2('0x6a'),'email',_0xc6c2('0x6b'),'phone'];if(_0x1df81e){_[_0xc6c2('0x6c')](_0x1df81e['fields'],function(_0x3ab3b6){return _0x1967f8['includes'](_0x3ab3b6[_0xc6c2('0x27')])||!_0x4138dc[_0xc6c2('0x6d')](_0x3ab3b6[_0xc6c2('0x2c')]);});return{'count':_0x1df81e['fields'][_0xc6c2('0x35')],'rows':_[_0xc6c2('0x2f')](_0x1df81e[_0xc6c2('0x33')],function(_0x1e21df){return{'id':_0x1e21df[_0xc6c2('0x27')],'name':_0x1e21df[_0xc6c2('0x6e')],'custom':_0x1e21df[_0xc6c2('0x6f')],'options':_0x1e21df['picklistValues'][_0xc6c2('0x35')]>0x0?_[_0xc6c2('0x2f')](_0x1e21df['picklistValues'],function(_0x448602){return{'name':_0x448602[_0xc6c2('0x6e')],'value':_0x448602[_0xc6c2('0x70')]};}):_0x1e21df[_0xc6c2('0x2c')]==_0xc6c2('0x6a')?[{'name':_0xc6c2('0x71'),'value':_0xc6c2('0x72')},{'name':_0xc6c2('0x73'),'value':'false'}]:[]};})};}})[_0xc6c2('0x22')](respondWithResult(_0x866dd6,null))[_0xc6c2('0x41')](function(_0x142ae9){var _0x31816e=_0x25d109['query']['test']?0x1f4:_0x142ae9['statusCode']||0x1f4;logger[_0xc6c2('0x25')](_0xc6c2('0x74'),_0xc6c2('0x75'),_0x31816e,JSON[_0xc6c2('0x76')](_0x142ae9));delete _0x142ae9[_0xc6c2('0x27')];if(_0x31816e===0x191){_0x31816e=0x190;}_0x866dd6[_0xc6c2('0x17')](_0x31816e)[_0xc6c2('0x28')](_0x25d109[_0xc6c2('0x30')][_0xc6c2('0x77')]?{'message':_0xc6c2('0x78'),'statusCode':_0x142ae9[_0xc6c2('0x79')]}:_0x142ae9);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index bc8b619..5e4a83c 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 _0xef60=['../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceAccount.attributes'];(function(_0x5d3a49,_0x192e91){var _0x440441=function(_0x4b43da){while(--_0x4b43da){_0x5d3a49['push'](_0x5d3a49['shift']());}};_0x440441(++_0x192e91);}(_0xef60,0xa0));var _0x0ef6=function(_0x5ec897,_0x55b065){_0x5ec897=_0x5ec897-0x0;var _0x1bb659=_0xef60[_0x5ec897];return _0x1bb659;};'use strict';var _=require(_0x0ef6('0x0'));var util=require(_0x0ef6('0x1'));var logger=require(_0x0ef6('0x2'))(_0x0ef6('0x3'));var moment=require(_0x0ef6('0x4'));var BPromise=require(_0x0ef6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ef6('0x6'));var rimraf=require(_0x0ef6('0x7'));var config=require('../../config/environment');var attributes=require(_0x0ef6('0x8'));var integrations=require(_0x0ef6('0x9'));module['exports']=function(_0x1d664b,_0x45cf86){return _0x1d664b[_0x0ef6('0xa')](_0x0ef6('0xb'),attributes,{'tableName':_0x0ef6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89f3=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util'];(function(_0x5361e7,_0x2e901d){var _0x27cccd=function(_0x5bbdfe){while(--_0x5bbdfe){_0x5361e7['push'](_0x5361e7['shift']());}};_0x27cccd(++_0x2e901d);}(_0x89f3,0x1ac));var _0x389f=function(_0x5d9b0c,_0x2f488a){_0x5d9b0c=_0x5d9b0c-0x0;var _0x21f6ec=_0x89f3[_0x5d9b0c];return _0x21f6ec;};'use strict';var _=require('lodash');var util=require(_0x389f('0x0'));var logger=require(_0x389f('0x1'))(_0x389f('0x2'));var moment=require(_0x389f('0x3'));var BPromise=require(_0x389f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x389f('0x5'));var rimraf=require(_0x389f('0x6'));var config=require(_0x389f('0x7'));var attributes=require(_0x389f('0x8'));var integrations=require(_0x389f('0x9'));module['exports']=function(_0x21ab75,_0x56882e){return _0x21ab75[_0x389f('0xa')](_0x389f('0xb'),attributes,{'tableName':_0x389f('0xc'),'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 f7e0605..cf68b82 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 _0x2d8c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','then','stringify','find','raw','ShowSalesforceAccount','lodash','util'];(function(_0x3cfc01,_0x4ea6b9){var _0x52d02c=function(_0x375398){while(--_0x375398){_0x3cfc01['push'](_0x3cfc01['shift']());}};_0x52d02c(++_0x4ea6b9);}(_0x2d8c,0x14b));var _0xc2d8=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x2d8c[_0x519c88];return _0x4668d7;};'use strict';var _=require(_0xc2d8('0x0'));var util=require(_0xc2d8('0x1'));var moment=require(_0xc2d8('0x2'));var BPromise=require(_0xc2d8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2d8('0x4'));var db=require(_0xc2d8('0x5'))['db'];var utils=require(_0xc2d8('0x6'));var logger=require(_0xc2d8('0x7'))(_0xc2d8('0x8'));var config=require(_0xc2d8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc2d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38275a,_0x5041af,_0xd4c6db){return new BPromise(function(_0x15deae,_0x35cca2){return client[_0xc2d8('0xb')](_0x38275a,_0xd4c6db)['then'](function(_0x414aad){logger['info'](_0xc2d8('0xc'),_0x5041af,_0xc2d8('0xd'));logger[_0xc2d8('0xe')](_0xc2d8('0xf'),_0x5041af,_0xc2d8('0xd'),JSON['stringify'](_0x414aad));if(_0x414aad[_0xc2d8('0x10')]){if(_0x414aad['error'][_0xc2d8('0x11')]===0x1f4){logger[_0xc2d8('0x10')](_0xc2d8('0xc'),_0x5041af,_0x414aad[_0xc2d8('0x10')][_0xc2d8('0x12')]);return _0x35cca2(_0x414aad[_0xc2d8('0x10')][_0xc2d8('0x12')]);}logger[_0xc2d8('0x10')](_0xc2d8('0xc'),_0x5041af,_0x414aad[_0xc2d8('0x10')][_0xc2d8('0x12')]);return _0x15deae(_0x414aad['error'][_0xc2d8('0x12')]);}else{logger[_0xc2d8('0x13')](_0xc2d8('0xc'),_0x5041af,_0xc2d8('0xd'));_0x15deae(_0x414aad[_0xc2d8('0x14')][_0xc2d8('0x12')]);}})[_0xc2d8('0x15')](function(_0x3504f2){logger[_0xc2d8('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x5041af,_0x3504f2);_0x35cca2(_0x3504f2);});});}exports[_0xc2d8('0x16')]=function(_0x334b7a){var _0x75b29a=this;return new Promise(function(_0x1ccfab,_0x360c8c){return db[_0xc2d8('0x17')][_0xc2d8('0x18')]({'raw':_0x334b7a[_0xc2d8('0x19')]?_0x334b7a[_0xc2d8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x334b7a[_0xc2d8('0x19')]?_0x334b7a[_0xc2d8('0x19')][_0xc2d8('0x1a')]||null:null,'attributes':_0x334b7a[_0xc2d8('0x19')]?_0x334b7a[_0xc2d8('0x19')][_0xc2d8('0x1b')]||null:null,'limit':_0x334b7a[_0xc2d8('0x19')]?_0x334b7a[_0xc2d8('0x19')][_0xc2d8('0x1c')]||null:null,'include':_0x334b7a['options']?_0x334b7a[_0xc2d8('0x19')][_0xc2d8('0x1d')]?_[_0xc2d8('0x1e')](_0x334b7a['options']['include'],function(_0x30aabe){return{'model':db[_0x30aabe[_0xc2d8('0x1f')]],'as':_0x30aabe['as'],'attributes':_0x30aabe['attributes'],'include':_0x30aabe['include']?_['map'](_0x30aabe[_0xc2d8('0x1d')],function(_0x1ddd04){return{'model':db[_0x1ddd04[_0xc2d8('0x1f')]],'as':_0x1ddd04['as'],'attributes':_0x1ddd04[_0xc2d8('0x1b')],'include':_0x1ddd04[_0xc2d8('0x1d')]?_['map'](_0x1ddd04[_0xc2d8('0x1d')],function(_0x5e1da4){return{'model':db[_0x5e1da4[_0xc2d8('0x1f')]],'as':_0x5e1da4['as'],'attributes':_0x5e1da4[_0xc2d8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc2d8('0x20')](function(_0x142db3){logger[_0xc2d8('0x13')](_0xc2d8('0x16'),_0x334b7a);logger[_0xc2d8('0xe')](_0xc2d8('0x16'),_0x334b7a,JSON[_0xc2d8('0x21')](_0x142db3));_0x1ccfab(_0x142db3);})[_0xc2d8('0x15')](function(_0x9a0705){logger[_0xc2d8('0x10')](_0xc2d8('0x16'),_0x9a0705[_0xc2d8('0x12')],_0x334b7a);_0x360c8c(_0x75b29a[_0xc2d8('0x10')](0x1f4,_0x9a0705['message']));});});};exports['ShowSalesforceAccount']=function(_0x40b0f9){var _0x530b02=this;return new Promise(function(_0x57e406,_0x4aa560){return db['SalesforceAccount'][_0xc2d8('0x22')]({'raw':_0x40b0f9['options']?_0x40b0f9[_0xc2d8('0x19')][_0xc2d8('0x23')]===undefined?!![]:![]:!![],'where':_0x40b0f9['options']?_0x40b0f9[_0xc2d8('0x19')][_0xc2d8('0x1a')]||null:null,'attributes':_0x40b0f9[_0xc2d8('0x19')]?_0x40b0f9[_0xc2d8('0x19')]['attributes']||null:null,'include':_0x40b0f9['options']?_0x40b0f9['options'][_0xc2d8('0x1d')]?_[_0xc2d8('0x1e')](_0x40b0f9['options']['include'],function(_0x42c086){return{'model':db[_0x42c086['model']],'as':_0x42c086['as'],'attributes':_0x42c086[_0xc2d8('0x1b')],'include':_0x42c086[_0xc2d8('0x1d')]?_[_0xc2d8('0x1e')](_0x42c086['include'],function(_0x4b46ae){return{'model':db[_0x4b46ae[_0xc2d8('0x1f')]],'as':_0x4b46ae['as'],'attributes':_0x4b46ae[_0xc2d8('0x1b')],'include':_0x4b46ae[_0xc2d8('0x1d')]?_[_0xc2d8('0x1e')](_0x4b46ae[_0xc2d8('0x1d')],function(_0x4d79d5){return{'model':db[_0x4d79d5[_0xc2d8('0x1f')]],'as':_0x4d79d5['as'],'attributes':_0x4d79d5[_0xc2d8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc2d8('0x20')](function(_0x3b7109){logger[_0xc2d8('0x13')]('ShowSalesforceAccount',_0x40b0f9);logger[_0xc2d8('0xe')](_0xc2d8('0x24'),_0x40b0f9,JSON[_0xc2d8('0x21')](_0x3b7109));_0x57e406(_0x3b7109);})[_0xc2d8('0x15')](function(_0x218772){logger['error']('ShowSalesforceAccount',_0x218772['message'],_0x40b0f9);_0x4aa560(_0x530b02[_0xc2d8('0x10')](0x1f4,_0x218772['message']));});});}; \ No newline at end of file +var _0x2081=['raw','where','attributes','include','map','model','then','stringify','ShowSalesforceAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetSalesforceAccount','SalesforceAccount','options'];(function(_0x22c07a,_0x313704){var _0x25d03c=function(_0x76e94c){while(--_0x76e94c){_0x22c07a['push'](_0x22c07a['shift']());}};_0x25d03c(++_0x313704);}(_0x2081,0xaf));var _0x1208=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x2081[_0x23e6bb];return _0x1e3b4c;};'use strict';var _=require(_0x1208('0x0'));var util=require(_0x1208('0x1'));var moment=require(_0x1208('0x2'));var BPromise=require(_0x1208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1208('0x4'));var db=require(_0x1208('0x5'))['db'];var utils=require(_0x1208('0x6'));var logger=require(_0x1208('0x7'))(_0x1208('0x8'));var config=require(_0x1208('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1208('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x355e72,_0x5292e9,_0x1cfd71){return new BPromise(function(_0x10ebfc,_0x155adb){return client[_0x1208('0xb')](_0x355e72,_0x1cfd71)['then'](function(_0x446eb7){logger[_0x1208('0xc')](_0x1208('0xd'),_0x5292e9,_0x1208('0xe'));logger[_0x1208('0xf')](_0x1208('0x10'),_0x5292e9,'request\x20sent',JSON['stringify'](_0x446eb7));if(_0x446eb7[_0x1208('0x11')]){if(_0x446eb7['error']['code']===0x1f4){logger[_0x1208('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x5292e9,_0x446eb7[_0x1208('0x11')][_0x1208('0x12')]);return _0x155adb(_0x446eb7[_0x1208('0x11')][_0x1208('0x12')]);}logger[_0x1208('0x11')](_0x1208('0xd'),_0x5292e9,_0x446eb7[_0x1208('0x11')]['message']);return _0x10ebfc(_0x446eb7[_0x1208('0x11')][_0x1208('0x12')]);}else{logger['info'](_0x1208('0xd'),_0x5292e9,_0x1208('0xe'));_0x10ebfc(_0x446eb7['result'][_0x1208('0x12')]);}})[_0x1208('0x13')](function(_0x2bd95a){logger[_0x1208('0x11')](_0x1208('0xd'),_0x5292e9,_0x2bd95a);_0x155adb(_0x2bd95a);});});}exports[_0x1208('0x14')]=function(_0x2df2eb){var _0x3e6d17=this;return new Promise(function(_0x42067e,_0x83abc3){return db[_0x1208('0x15')]['findAll']({'raw':_0x2df2eb['options']?_0x2df2eb[_0x1208('0x16')][_0x1208('0x17')]===undefined?!![]:![]:!![],'where':_0x2df2eb['options']?_0x2df2eb[_0x1208('0x16')][_0x1208('0x18')]||null:null,'attributes':_0x2df2eb[_0x1208('0x16')]?_0x2df2eb['options'][_0x1208('0x19')]||null:null,'limit':_0x2df2eb[_0x1208('0x16')]?_0x2df2eb[_0x1208('0x16')]['limit']||null:null,'include':_0x2df2eb['options']?_0x2df2eb[_0x1208('0x16')][_0x1208('0x1a')]?_[_0x1208('0x1b')](_0x2df2eb['options']['include'],function(_0x586ab6){return{'model':db[_0x586ab6[_0x1208('0x1c')]],'as':_0x586ab6['as'],'attributes':_0x586ab6[_0x1208('0x19')],'include':_0x586ab6[_0x1208('0x1a')]?_[_0x1208('0x1b')](_0x586ab6[_0x1208('0x1a')],function(_0x2c3c47){return{'model':db[_0x2c3c47['model']],'as':_0x2c3c47['as'],'attributes':_0x2c3c47[_0x1208('0x19')],'include':_0x2c3c47[_0x1208('0x1a')]?_[_0x1208('0x1b')](_0x2c3c47[_0x1208('0x1a')],function(_0x5346ac){return{'model':db[_0x5346ac[_0x1208('0x1c')]],'as':_0x5346ac['as'],'attributes':_0x5346ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x1208('0x1d')](function(_0x308103){logger['info'](_0x1208('0x14'),_0x2df2eb);logger['debug'](_0x1208('0x14'),_0x2df2eb,JSON[_0x1208('0x1e')](_0x308103));_0x42067e(_0x308103);})['catch'](function(_0xeff167){logger[_0x1208('0x11')]('GetSalesforceAccount',_0xeff167[_0x1208('0x12')],_0x2df2eb);_0x83abc3(_0x3e6d17[_0x1208('0x11')](0x1f4,_0xeff167[_0x1208('0x12')]));});});};exports[_0x1208('0x1f')]=function(_0x359f10){var _0x5c65b2=this;return new Promise(function(_0x398c09,_0x5512f8){return db['SalesforceAccount'][_0x1208('0x20')]({'raw':_0x359f10['options']?_0x359f10[_0x1208('0x16')][_0x1208('0x17')]===undefined?!![]:![]:!![],'where':_0x359f10[_0x1208('0x16')]?_0x359f10[_0x1208('0x16')][_0x1208('0x18')]||null:null,'attributes':_0x359f10[_0x1208('0x16')]?_0x359f10['options'][_0x1208('0x19')]||null:null,'include':_0x359f10[_0x1208('0x16')]?_0x359f10['options'][_0x1208('0x1a')]?_['map'](_0x359f10[_0x1208('0x16')][_0x1208('0x1a')],function(_0x9eaa76){return{'model':db[_0x9eaa76[_0x1208('0x1c')]],'as':_0x9eaa76['as'],'attributes':_0x9eaa76['attributes'],'include':_0x9eaa76['include']?_['map'](_0x9eaa76[_0x1208('0x1a')],function(_0x3ca04f){return{'model':db[_0x3ca04f[_0x1208('0x1c')]],'as':_0x3ca04f['as'],'attributes':_0x3ca04f['attributes'],'include':_0x3ca04f[_0x1208('0x1a')]?_[_0x1208('0x1b')](_0x3ca04f[_0x1208('0x1a')],function(_0x38171d){return{'model':db[_0x38171d[_0x1208('0x1c')]],'as':_0x38171d['as'],'attributes':_0x38171d[_0x1208('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1208('0x1d')](function(_0x2bf4da){logger['info']('ShowSalesforceAccount',_0x359f10);logger[_0x1208('0xf')]('ShowSalesforceAccount',_0x359f10,JSON['stringify'](_0x2bf4da));_0x398c09(_0x2bf4da);})[_0x1208('0x13')](function(_0x5659b0){logger[_0x1208('0x11')](_0x1208('0x1f'),_0x5659b0[_0x1208('0x12')],_0x359f10);_0x5512f8(_0x5c65b2[_0x1208('0x11')](0x1f4,_0x5659b0['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 65f9918..9eb8c2b 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x53050d,_0x2078fc){var _0xc353b4=function(_0x4b1bdf){while(--_0x4b1bdf){_0x53050d['push'](_0x53050d['shift']());}};_0xc353b4(++_0x2078fc);}(_0xadb5,0xad));var _0x5adb=function(_0x20be63,_0x117003){_0x20be63=_0x20be63-0x0;var _0x28c14c=_0xadb5[_0x20be63];return _0x28c14c;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x108657,_0x36b66d){var _0x5302a0=function(_0x2c998e){while(--_0x2c998e){_0x108657['push'](_0x108657['shift']());}};_0x5302a0(++_0x36b66d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x53445c,_0x2cbd11){_0x53445c=_0x53445c-0x0;var _0x1e9b83=_0x5f2f[_0x53445c];return _0x1e9b83;};'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('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index c63e8f0..37d9041 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 _0x6bb0=['ENUM','Task','Case','contact_lead','account_contact_lead','account','nothing','lead','sequelize','STRING'];(function(_0x346c14,_0x1a8ce7){var _0x72bdbf=function(_0x3e6a67){while(--_0x3e6a67){_0x346c14['push'](_0x346c14['shift']());}};_0x72bdbf(++_0x1a8ce7);}(_0x6bb0,0x10c));var _0x06bb=function(_0x2d4c59,_0xc7dea0){_0x2d4c59=_0x2d4c59-0x0;var _0x134b9b=_0x6bb0[_0x2d4c59];return _0x134b9b;};'use strict';var Sequelize=require(_0x06bb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x06bb('0x1')]},'ticketType':{'type':Sequelize[_0x06bb('0x2')](_0x06bb('0x3'),_0x06bb('0x4')),'defaultValue':_0x06bb('0x3')},'moduleSearch':{'type':Sequelize[_0x06bb('0x2')](_0x06bb('0x5'),'contact','lead',_0x06bb('0x6'),_0x06bb('0x7')),'defaultValue':_0x06bb('0x5')},'moduleCreate':{'type':Sequelize[_0x06bb('0x2')](_0x06bb('0x8'),'contact',_0x06bb('0x9'),'account'),'defaultValue':_0x06bb('0x9')},'leadId':{'type':Sequelize[_0x06bb('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x06bb('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x06bb('0x1')]}}; \ No newline at end of file +var _0x1a78=['account','contact_lead','nothing','contact','STRING','ENUM','Task','Case','lead'];(function(_0x5e0662,_0x16e372){var _0x299869=function(_0x444b24){while(--_0x444b24){_0x5e0662['push'](_0x5e0662['shift']());}};_0x299869(++_0x16e372);}(_0x1a78,0x190));var _0x81a7=function(_0x1b8a52,_0x5c3cd0){_0x1b8a52=_0x1b8a52-0x0;var _0x5c9412=_0x1a78[_0x1b8a52];return _0x5c9412;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x81a7('0x0')]},'description':{'type':Sequelize[_0x81a7('0x0')]},'ticketType':{'type':Sequelize[_0x81a7('0x1')](_0x81a7('0x2'),_0x81a7('0x3')),'defaultValue':_0x81a7('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0x81a7('0x4'),'account_contact_lead',_0x81a7('0x5')),'defaultValue':_0x81a7('0x6')},'moduleCreate':{'type':Sequelize[_0x81a7('0x1')](_0x81a7('0x7'),_0x81a7('0x8'),_0x81a7('0x4'),_0x81a7('0x5')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x81a7('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x81a7('0x0')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x81a7('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 26390b0..b64d434 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 _0xb55e=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','rows','catch','show','keys','create','body','find','params','getFields','SalesforceField','rawAttributes','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb55e,0x106));var _0xeb55=function(_0x3b70e0,_0x163dc6){_0x3b70e0=_0x3b70e0-0x0;var _0x342050=_0xb55e[_0x3b70e0];return _0x342050;};'use strict';var emlformat=require(_0xeb55('0x0'));var rimraf=require(_0xeb55('0x1'));var zipdir=require(_0xeb55('0x2'));var jsonpatch=require(_0xeb55('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeb55('0x4'));var Mustache=require(_0xeb55('0x5'));var util=require('util');var path=require(_0xeb55('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb55('0x7'));var _=require(_0xeb55('0x8'));var squel=require(_0xeb55('0x9'));var crypto=require(_0xeb55('0xa'));var jsforce=require(_0xeb55('0xb'));var deskjs=require(_0xeb55('0xc'));var toCsv=require(_0xeb55('0xd'));var querystring=require(_0xeb55('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeb55('0xf'));var qs=require(_0xeb55('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb55('0x11'));var logger=require('../../config/logger')(_0xeb55('0x12'));var utils=require(_0xeb55('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xeb55('0x14'));var db=require(_0xeb55('0x15'))['db'];function respondWithStatusCode(_0x2ae056,_0x1f3430){_0x1f3430=_0x1f3430||0xcc;return function(_0x14ae46){if(_0x14ae46){return _0x2ae056[_0xeb55('0x16')](_0x1f3430);}return _0x2ae056[_0xeb55('0x17')](_0x1f3430)[_0xeb55('0x18')]();};}function respondWithResult(_0xd44b18,_0x3c4626){_0x3c4626=_0x3c4626||0xc8;return function(_0x264f36){if(_0x264f36){return _0xd44b18[_0xeb55('0x17')](_0x3c4626)[_0xeb55('0x19')](_0x264f36);}};}function respondWithFilteredResult(_0x4462d4,_0x2d555b){return function(_0x2bbf7b){if(_0x2bbf7b){var _0x901091=typeof _0x2d555b[_0xeb55('0x1a')]===_0xeb55('0x1b')&&typeof _0x2d555b['limit']===_0xeb55('0x1b');var _0x177baf=_0x2bbf7b[_0xeb55('0x1c')];var _0xb2b680=_0x901091?0x0:_0x2d555b[_0xeb55('0x1a')];var _0x4cfb7e=_0x901091?_0x2bbf7b[_0xeb55('0x1c')]:_0x2d555b[_0xeb55('0x1a')]+_0x2d555b[_0xeb55('0x1d')];var _0x513b81;if(_0x4cfb7e>=_0x177baf){_0x4cfb7e=_0x177baf;_0x513b81=0xc8;}else{_0x513b81=0xce;}_0x4462d4[_0xeb55('0x17')](_0x513b81);return _0x4462d4[_0xeb55('0x1e')]('Content-Range',_0xb2b680+'-'+_0x4cfb7e+'/'+_0x177baf)[_0xeb55('0x19')](_0x2bbf7b);}return null;};}function patchUpdates(_0x377fbb){return function(_0x33c5be){try{jsonpatch[_0xeb55('0x1f')](_0x33c5be,_0x377fbb,!![]);}catch(_0x424a83){return BPromise['reject'](_0x424a83);}return _0x33c5be[_0xeb55('0x20')]();};}function saveUpdates(_0x557a05,_0x44f9b7){return function(_0x44bddf){if(_0x44bddf){return _0x44bddf[_0xeb55('0x21')](_0x557a05)[_0xeb55('0x22')](function(_0x41cf84){return _0x41cf84;});}return null;};}function removeEntity(_0x4cae05,_0x487622){return function(_0x634301){if(_0x634301){return _0x634301['destroy']()[_0xeb55('0x22')](function(){_0x4cae05[_0xeb55('0x17')](0xcc)[_0xeb55('0x18')]();});}};}function handleEntityNotFound(_0x42ed19,_0x5e6bec){return function(_0x3283a4){if(!_0x3283a4){_0x42ed19[_0xeb55('0x16')](0x194);}return _0x3283a4;};}function handleError(_0x467433,_0x2457d9){_0x2457d9=_0x2457d9||0x1f4;return function(_0x50264f){logger[_0xeb55('0x23')](_0x50264f[_0xeb55('0x24')]);if(_0x50264f[_0xeb55('0x25')]){delete _0x50264f[_0xeb55('0x25')];}_0x467433[_0xeb55('0x17')](_0x2457d9)[_0xeb55('0x26')](_0x50264f);};}exports[_0xeb55('0x27')]=function(_0x16d323,_0x27f7c2){var _0x379fba={},_0x5a40d2={},_0x55c4d9={'count':0x0,'rows':[]};var _0x547e6e=_[_0xeb55('0x28')](db['SalesforceConfiguration']['rawAttributes'],function(_0x31ca6c){return{'name':_0x31ca6c[_0xeb55('0x29')],'type':_0x31ca6c[_0xeb55('0x2a')][_0xeb55('0x2b')]};});_0x5a40d2[_0xeb55('0x2c')]=_[_0xeb55('0x28')](_0x547e6e,_0xeb55('0x25'));_0x5a40d2['query']=_['keys'](_0x16d323[_0xeb55('0x2d')]);_0x5a40d2[_0xeb55('0x2e')]=_[_0xeb55('0x2f')](_0x5a40d2[_0xeb55('0x2c')],_0x5a40d2[_0xeb55('0x2d')]);_0x379fba[_0xeb55('0x30')]=_[_0xeb55('0x2f')](_0x5a40d2['model'],qs[_0xeb55('0x31')](_0x16d323['query'][_0xeb55('0x31')]));_0x379fba[_0xeb55('0x30')]=_0x379fba['attributes'][_0xeb55('0x32')]?_0x379fba[_0xeb55('0x30')]:_0x5a40d2[_0xeb55('0x2c')];if(!_0x16d323['query'][_0xeb55('0x33')](_0xeb55('0x34'))){_0x379fba[_0xeb55('0x1d')]=qs[_0xeb55('0x1d')](_0x16d323[_0xeb55('0x2d')]['limit']);_0x379fba['offset']=qs['offset'](_0x16d323[_0xeb55('0x2d')][_0xeb55('0x1a')]);}_0x379fba['order']=qs[_0xeb55('0x35')](_0x16d323[_0xeb55('0x2d')][_0xeb55('0x35')]);_0x379fba['where']=qs[_0xeb55('0x2e')](_[_0xeb55('0x36')](_0x16d323[_0xeb55('0x2d')],_0x5a40d2[_0xeb55('0x2e')]),_0x547e6e);if(_0x16d323['query'][_0xeb55('0x37')]){_0x379fba[_0xeb55('0x38')]=_[_0xeb55('0x39')](_0x379fba[_0xeb55('0x38')],{'$or':_[_0xeb55('0x28')](_0x547e6e,function(_0x38ab13){if(_0x38ab13[_0xeb55('0x2a')]!==_0xeb55('0x3a')){var _0x3697ff={};_0x3697ff[_0x38ab13[_0xeb55('0x25')]]={'$like':'%'+_0x16d323[_0xeb55('0x2d')][_0xeb55('0x37')]+'%'};return _0x3697ff;}})});}_0x379fba=_[_0xeb55('0x39')]({},_0x379fba,_0x16d323[_0xeb55('0x3b')]);var _0x2b9bd8={'where':_0x379fba['where']};return db['SalesforceConfiguration'][_0xeb55('0x1c')](_0x2b9bd8)[_0xeb55('0x22')](function(_0x1fdf5a){_0x55c4d9[_0xeb55('0x1c')]=_0x1fdf5a;if(_0x16d323[_0xeb55('0x2d')][_0xeb55('0x3c')]){_0x379fba[_0xeb55('0x3d')]=[{'all':!![]}];}return db[_0xeb55('0x3e')][_0xeb55('0x3f')](_0x379fba);})[_0xeb55('0x22')](function(_0x425b4d){_0x55c4d9[_0xeb55('0x40')]=_0x425b4d;return _0x55c4d9;})[_0xeb55('0x22')](respondWithFilteredResult(_0x27f7c2,_0x379fba))[_0xeb55('0x41')](handleError(_0x27f7c2,null));};exports[_0xeb55('0x42')]=function(_0x1362b6,_0x2d5222){var _0x5b4f10={'raw':![],'where':{'id':_0x1362b6['params']['id']}},_0x404272={};_0x404272['model']=_[_0xeb55('0x43')](db[_0xeb55('0x3e')]['rawAttributes']);_0x404272[_0xeb55('0x2d')]=_[_0xeb55('0x43')](_0x1362b6[_0xeb55('0x2d')]);_0x404272[_0xeb55('0x2e')]=_[_0xeb55('0x2f')](_0x404272['model'],_0x404272[_0xeb55('0x2d')]);_0x5b4f10[_0xeb55('0x30')]=_['intersection'](_0x404272[_0xeb55('0x2c')],qs[_0xeb55('0x31')](_0x1362b6[_0xeb55('0x2d')][_0xeb55('0x31')]));_0x5b4f10['attributes']=_0x5b4f10[_0xeb55('0x30')][_0xeb55('0x32')]?_0x5b4f10[_0xeb55('0x30')]:_0x404272[_0xeb55('0x2c')];if(_0x1362b6[_0xeb55('0x2d')]['includeAll']){_0x5b4f10[_0xeb55('0x3d')]=[{'all':!![]}];}_0x5b4f10=_[_0xeb55('0x39')]({},_0x5b4f10,_0x1362b6[_0xeb55('0x3b')]);return db['SalesforceConfiguration']['find'](_0x5b4f10)['then'](handleEntityNotFound(_0x2d5222,null))[_0xeb55('0x22')](respondWithResult(_0x2d5222,null))[_0xeb55('0x41')](handleError(_0x2d5222,null));};exports[_0xeb55('0x44')]=function(_0x5065c1,_0x483b24){return db[_0xeb55('0x3e')]['create'](_0x5065c1[_0xeb55('0x45')],{})[_0xeb55('0x22')](respondWithResult(_0x483b24,0xc9))['catch'](handleError(_0x483b24,null));};exports['update']=function(_0x33956e,_0x186280){if(_0x33956e[_0xeb55('0x45')]['id']){delete _0x33956e[_0xeb55('0x45')]['id'];}return db[_0xeb55('0x3e')][_0xeb55('0x46')]({'where':{'id':_0x33956e[_0xeb55('0x47')]['id']}})[_0xeb55('0x22')](handleEntityNotFound(_0x186280,null))['then'](saveUpdates(_0x33956e[_0xeb55('0x45')],null))[_0xeb55('0x22')](respondWithResult(_0x186280,null))[_0xeb55('0x41')](handleError(_0x186280,null));};exports['destroy']=function(_0x387573,_0x2d2c6b){return db['SalesforceConfiguration']['find']({'where':{'id':_0x387573['params']['id']}})[_0xeb55('0x22')](handleEntityNotFound(_0x2d2c6b,null))[_0xeb55('0x22')](removeEntity(_0x2d2c6b,null))['catch'](handleError(_0x2d2c6b,null));};exports[_0xeb55('0x48')]=function(_0x10f333,_0x5f03c5,_0x5be631){var _0x123043={};var _0x2d3973={};var _0x43975d;var _0x4fc68a;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x10f333['params']['id']}})['then'](handleEntityNotFound(_0x5f03c5,null))[_0xeb55('0x22')](function(_0x279ae9){if(_0x279ae9){_0x43975d=_0x279ae9;_0x2d3973['model']=_[_0xeb55('0x43')](db[_0xeb55('0x49')][_0xeb55('0x4a')]);_0x2d3973[_0xeb55('0x2d')]=_['keys'](_0x10f333[_0xeb55('0x2d')]);_0x2d3973[_0xeb55('0x2e')]=_[_0xeb55('0x2f')](_0x2d3973[_0xeb55('0x2c')],_0x2d3973['query']);_0x123043[_0xeb55('0x30')]=_[_0xeb55('0x2f')](_0x2d3973[_0xeb55('0x2c')],qs[_0xeb55('0x31')](_0x10f333[_0xeb55('0x2d')][_0xeb55('0x31')]));_0x123043[_0xeb55('0x30')]=_0x123043[_0xeb55('0x30')][_0xeb55('0x32')]?_0x123043[_0xeb55('0x30')]:_0x2d3973[_0xeb55('0x2c')];_0x123043[_0xeb55('0x4b')]=qs[_0xeb55('0x35')](_0x10f333[_0xeb55('0x2d')]['sort']);_0x123043[_0xeb55('0x38')]=qs[_0xeb55('0x2e')](_[_0xeb55('0x36')](_0x10f333[_0xeb55('0x2d')],_0x2d3973[_0xeb55('0x2e')]));if(_0x10f333['query']['filter']){_0x123043[_0xeb55('0x38')]=_['merge'](_0x123043[_0xeb55('0x38')],{'$or':_[_0xeb55('0x28')](_0x123043['attributes'],function(_0x321cd0){var _0x21a570={};_0x21a570[_0x321cd0]={'$like':'%'+_0x10f333[_0xeb55('0x2d')]['filter']+'%'};return _0x21a570;})});}_0x123043=_[_0xeb55('0x39')]({},_0x123043,_0x10f333[_0xeb55('0x3b')]);return _0x43975d[_0xeb55('0x48')](_0x123043);}})['then'](function(_0x24d950){if(_0x24d950){_0x4fc68a=_0x24d950[_0xeb55('0x32')];if(!_0x10f333[_0xeb55('0x2d')][_0xeb55('0x33')](_0xeb55('0x34'))){_0x123043['limit']=qs[_0xeb55('0x1d')](_0x10f333[_0xeb55('0x2d')][_0xeb55('0x1d')]);_0x123043[_0xeb55('0x1a')]=qs['offset'](_0x10f333[_0xeb55('0x2d')][_0xeb55('0x1a')]);}return _0x43975d[_0xeb55('0x48')](_0x123043);}})[_0xeb55('0x22')](function(_0x175844){if(_0x175844){return _0x175844?{'count':_0x4fc68a,'rows':_0x175844}:null;}})[_0xeb55('0x22')](respondWithResult(_0x5f03c5,null))[_0xeb55('0x41')](handleError(_0x5f03c5,null));};exports[_0xeb55('0x4c')]=function(_0x3b9839,_0x86ae00,_0x310332){var _0x459599={};var _0x36137b={};var _0x379fef;var _0x500907;return db[_0xeb55('0x3e')][_0xeb55('0x4d')]({'where':{'id':_0x3b9839['params']['id']}})[_0xeb55('0x22')](handleEntityNotFound(_0x86ae00,null))[_0xeb55('0x22')](function(_0x16787e){if(_0x16787e){_0x379fef=_0x16787e;_0x36137b['model']=_[_0xeb55('0x43')](db[_0xeb55('0x49')][_0xeb55('0x4a')]);_0x36137b[_0xeb55('0x2d')]=_[_0xeb55('0x43')](_0x3b9839['query']);_0x36137b[_0xeb55('0x2e')]=_['intersection'](_0x36137b[_0xeb55('0x2c')],_0x36137b['query']);_0x459599[_0xeb55('0x30')]=_[_0xeb55('0x2f')](_0x36137b[_0xeb55('0x2c')],qs['fields'](_0x3b9839['query']['fields']));_0x459599[_0xeb55('0x30')]=_0x459599['attributes']['length']?_0x459599[_0xeb55('0x30')]:_0x36137b[_0xeb55('0x2c')];_0x459599['order']=qs[_0xeb55('0x35')](_0x3b9839[_0xeb55('0x2d')]['sort']);_0x459599['where']=qs[_0xeb55('0x2e')](_['pick'](_0x3b9839[_0xeb55('0x2d')],_0x36137b[_0xeb55('0x2e')]));if(_0x3b9839[_0xeb55('0x2d')]['filter']){_0x459599['where']=_[_0xeb55('0x39')](_0x459599[_0xeb55('0x38')],{'$or':_[_0xeb55('0x28')](_0x459599['attributes'],function(_0x3d295e){var _0xbbfa35={};_0xbbfa35[_0x3d295e]={'$like':'%'+_0x3b9839[_0xeb55('0x2d')][_0xeb55('0x37')]+'%'};return _0xbbfa35;})});}_0x459599=_[_0xeb55('0x39')]({},_0x459599,_0x3b9839[_0xeb55('0x3b')]);return _0x379fef[_0xeb55('0x4c')](_0x459599);}})['then'](function(_0x6bce17){if(_0x6bce17){_0x500907=_0x6bce17[_0xeb55('0x32')];if(!_0x3b9839['query'][_0xeb55('0x33')](_0xeb55('0x34'))){_0x459599['limit']=qs['limit'](_0x3b9839[_0xeb55('0x2d')]['limit']);_0x459599[_0xeb55('0x1a')]=qs['offset'](_0x3b9839[_0xeb55('0x2d')]['offset']);}return _0x379fef[_0xeb55('0x4c')](_0x459599);}})['then'](function(_0x1f1c07){if(_0x1f1c07){return _0x1f1c07?{'count':_0x500907,'rows':_0x1f1c07}:null;}})[_0xeb55('0x22')](respondWithResult(_0x86ae00,null))[_0xeb55('0x41')](handleError(_0x86ae00,null));};exports[_0xeb55('0x4e')]=function(_0xe23b70,_0x21019d,_0x440d0c){var _0x1164b4={};var _0x1c3052={};var _0x102ed5;var _0x21cd76;return db[_0xeb55('0x3e')][_0xeb55('0x4d')]({'where':{'id':_0xe23b70[_0xeb55('0x47')]['id']}})[_0xeb55('0x22')](handleEntityNotFound(_0x21019d,null))[_0xeb55('0x22')](function(_0x296d31){if(_0x296d31){_0x102ed5=_0x296d31;_0x1c3052[_0xeb55('0x2c')]=_[_0xeb55('0x43')](db[_0xeb55('0x49')]['rawAttributes']);_0x1c3052['query']=_['keys'](_0xe23b70[_0xeb55('0x2d')]);_0x1c3052[_0xeb55('0x2e')]=_[_0xeb55('0x2f')](_0x1c3052[_0xeb55('0x2c')],_0x1c3052[_0xeb55('0x2d')]);_0x1164b4['attributes']=_['intersection'](_0x1c3052[_0xeb55('0x2c')],qs[_0xeb55('0x31')](_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x31')]));_0x1164b4[_0xeb55('0x30')]=_0x1164b4['attributes'][_0xeb55('0x32')]?_0x1164b4[_0xeb55('0x30')]:_0x1c3052[_0xeb55('0x2c')];_0x1164b4[_0xeb55('0x4b')]=qs[_0xeb55('0x35')](_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x35')]);_0x1164b4[_0xeb55('0x38')]=qs['filters'](_['pick'](_0xe23b70[_0xeb55('0x2d')],_0x1c3052[_0xeb55('0x2e')]));if(_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x37')]){_0x1164b4['where']=_[_0xeb55('0x39')](_0x1164b4[_0xeb55('0x38')],{'$or':_[_0xeb55('0x28')](_0x1164b4[_0xeb55('0x30')],function(_0xd06b2b){var _0x1772a1={};_0x1772a1[_0xd06b2b]={'$like':'%'+_0xe23b70['query'][_0xeb55('0x37')]+'%'};return _0x1772a1;})});}_0x1164b4=_[_0xeb55('0x39')]({},_0x1164b4,_0xe23b70['options']);return _0x102ed5[_0xeb55('0x4e')](_0x1164b4);}})['then'](function(_0x3739e4){if(_0x3739e4){_0x21cd76=_0x3739e4[_0xeb55('0x32')];if(!_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x33')](_0xeb55('0x34'))){_0x1164b4[_0xeb55('0x1d')]=qs[_0xeb55('0x1d')](_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x1d')]);_0x1164b4[_0xeb55('0x1a')]=qs[_0xeb55('0x1a')](_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x1a')]);}return _0x102ed5[_0xeb55('0x4e')](_0x1164b4);}})[_0xeb55('0x22')](function(_0x1c228d){if(_0x1c228d){return _0x1c228d?{'count':_0x21cd76,'rows':_0x1c228d}:null;}})['then'](respondWithResult(_0x21019d,null))['catch'](handleError(_0x21019d,null));}; \ No newline at end of file +var _0xcf58=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','SalesforceConfiguration','includeAll','include','findAll','catch','show','params','find','create','body','update','getFields','findOne','SalesforceField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5632df,_0x541910){var _0x4fc112=function(_0x2fd60e){while(--_0x2fd60e){_0x5632df['push'](_0x5632df['shift']());}};_0x4fc112(++_0x541910);}(_0xcf58,0x193));var _0x8cf5=function(_0x40a8d4,_0x39571c){_0x40a8d4=_0x40a8d4-0x0;var _0x9023c5=_0xcf58[_0x40a8d4];return _0x9023c5;};'use strict';var emlformat=require(_0x8cf5('0x0'));var rimraf=require(_0x8cf5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cf5('0x2'));var rp=require(_0x8cf5('0x3'));var moment=require(_0x8cf5('0x4'));var BPromise=require(_0x8cf5('0x5'));var Mustache=require(_0x8cf5('0x6'));var util=require(_0x8cf5('0x7'));var path=require(_0x8cf5('0x8'));var sox=require(_0x8cf5('0x9'));var csv=require(_0x8cf5('0xa'));var ejs=require(_0x8cf5('0xb'));var fs=require('fs');var fs_extra=require(_0x8cf5('0xc'));var _=require(_0x8cf5('0xd'));var squel=require('squel');var crypto=require(_0x8cf5('0xe'));var jsforce=require(_0x8cf5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8cf5('0xa'));var querystring=require(_0x8cf5('0x10'));var Papa=require(_0x8cf5('0x11'));var Redis=require(_0x8cf5('0x12'));var authService=require(_0x8cf5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cf5('0x14'))(_0x8cf5('0x15'));var utils=require(_0x8cf5('0x16'));var config=require(_0x8cf5('0x17'));var licenseUtil=require(_0x8cf5('0x18'));var db=require(_0x8cf5('0x19'))['db'];function respondWithStatusCode(_0x2f5748,_0x1eb938){_0x1eb938=_0x1eb938||0xcc;return function(_0x2aa15c){if(_0x2aa15c){return _0x2f5748['sendStatus'](_0x1eb938);}return _0x2f5748[_0x8cf5('0x1a')](_0x1eb938)['end']();};}function respondWithResult(_0x54928b,_0x231786){_0x231786=_0x231786||0xc8;return function(_0x3ea893){if(_0x3ea893){return _0x54928b['status'](_0x231786)[_0x8cf5('0x1b')](_0x3ea893);}};}function respondWithFilteredResult(_0x1e5dae,_0x236de3){return function(_0x132426){if(_0x132426){var _0x8bac8=typeof _0x236de3['offset']===_0x8cf5('0x1c')&&typeof _0x236de3[_0x8cf5('0x1d')]===_0x8cf5('0x1c');var _0x226537=_0x132426[_0x8cf5('0x1e')];var _0x54c9f9=_0x8bac8?0x0:_0x236de3[_0x8cf5('0x1f')];var _0x4eafc7=_0x8bac8?_0x132426[_0x8cf5('0x1e')]:_0x236de3[_0x8cf5('0x1f')]+_0x236de3[_0x8cf5('0x1d')];var _0x2d478e;if(_0x4eafc7>=_0x226537){_0x4eafc7=_0x226537;_0x2d478e=0xc8;}else{_0x2d478e=0xce;}_0x1e5dae[_0x8cf5('0x1a')](_0x2d478e);return _0x1e5dae[_0x8cf5('0x20')](_0x8cf5('0x21'),_0x54c9f9+'-'+_0x4eafc7+'/'+_0x226537)[_0x8cf5('0x1b')](_0x132426);}return null;};}function patchUpdates(_0x34aec5){return function(_0x14eae2){try{jsonpatch[_0x8cf5('0x22')](_0x14eae2,_0x34aec5,!![]);}catch(_0x389eee){return BPromise['reject'](_0x389eee);}return _0x14eae2[_0x8cf5('0x23')]();};}function saveUpdates(_0x239201,_0x8a91cd){return function(_0x203d61){if(_0x203d61){return _0x203d61['update'](_0x239201)[_0x8cf5('0x24')](function(_0x198584){return _0x198584;});}return null;};}function removeEntity(_0x2634ea,_0x459451){return function(_0x3b5cd1){if(_0x3b5cd1){return _0x3b5cd1[_0x8cf5('0x25')]()[_0x8cf5('0x24')](function(){_0x2634ea[_0x8cf5('0x1a')](0xcc)[_0x8cf5('0x26')]();});}};}function handleEntityNotFound(_0x5b7198,_0x1b2333){return function(_0xcadee){if(!_0xcadee){_0x5b7198[_0x8cf5('0x27')](0x194);}return _0xcadee;};}function handleError(_0x23466d,_0x46665f){_0x46665f=_0x46665f||0x1f4;return function(_0x13c56b){logger[_0x8cf5('0x28')](_0x13c56b[_0x8cf5('0x29')]);if(_0x13c56b['name']){delete _0x13c56b[_0x8cf5('0x2a')];}_0x23466d[_0x8cf5('0x1a')](_0x46665f)[_0x8cf5('0x2b')](_0x13c56b);};}exports[_0x8cf5('0x2c')]=function(_0x51aacd,_0x3ef4a6){var _0x366b68={},_0xc6b123={},_0x445666={'count':0x0,'rows':[]};var _0x1554cf=_['map'](db['SalesforceConfiguration'][_0x8cf5('0x2d')],function(_0x3f41ca){return{'name':_0x3f41ca[_0x8cf5('0x2e')],'type':_0x3f41ca[_0x8cf5('0x2f')]['key']};});_0xc6b123[_0x8cf5('0x30')]=_[_0x8cf5('0x31')](_0x1554cf,_0x8cf5('0x2a'));_0xc6b123[_0x8cf5('0x32')]=_[_0x8cf5('0x33')](_0x51aacd['query']);_0xc6b123[_0x8cf5('0x34')]=_['intersection'](_0xc6b123[_0x8cf5('0x30')],_0xc6b123['query']);_0x366b68[_0x8cf5('0x35')]=_[_0x8cf5('0x36')](_0xc6b123[_0x8cf5('0x30')],qs[_0x8cf5('0x37')](_0x51aacd[_0x8cf5('0x32')][_0x8cf5('0x37')]));_0x366b68[_0x8cf5('0x35')]=_0x366b68[_0x8cf5('0x35')][_0x8cf5('0x38')]?_0x366b68['attributes']:_0xc6b123[_0x8cf5('0x30')];if(!_0x51aacd[_0x8cf5('0x32')]['hasOwnProperty'](_0x8cf5('0x39'))){_0x366b68[_0x8cf5('0x1d')]=qs['limit'](_0x51aacd[_0x8cf5('0x32')][_0x8cf5('0x1d')]);_0x366b68[_0x8cf5('0x1f')]=qs[_0x8cf5('0x1f')](_0x51aacd[_0x8cf5('0x32')][_0x8cf5('0x1f')]);}_0x366b68['order']=qs[_0x8cf5('0x3a')](_0x51aacd[_0x8cf5('0x32')][_0x8cf5('0x3a')]);_0x366b68[_0x8cf5('0x3b')]=qs['filters'](_[_0x8cf5('0x3c')](_0x51aacd[_0x8cf5('0x32')],_0xc6b123['filters']),_0x1554cf);if(_0x51aacd[_0x8cf5('0x32')]['filter']){_0x366b68[_0x8cf5('0x3b')]=_['merge'](_0x366b68[_0x8cf5('0x3b')],{'$or':_['map'](_0x1554cf,function(_0x31d90c){if(_0x31d90c['type']!=='VIRTUAL'){var _0x4c6e1c={};_0x4c6e1c[_0x31d90c['name']]={'$like':'%'+_0x51aacd[_0x8cf5('0x32')][_0x8cf5('0x3d')]+'%'};return _0x4c6e1c;}})});}_0x366b68=_[_0x8cf5('0x3e')]({},_0x366b68,_0x51aacd[_0x8cf5('0x3f')]);var _0x317b3d={'where':_0x366b68['where']};return db[_0x8cf5('0x40')][_0x8cf5('0x1e')](_0x317b3d)[_0x8cf5('0x24')](function(_0x1ef871){_0x445666[_0x8cf5('0x1e')]=_0x1ef871;if(_0x51aacd[_0x8cf5('0x32')][_0x8cf5('0x41')]){_0x366b68[_0x8cf5('0x42')]=[{'all':!![]}];}return db[_0x8cf5('0x40')][_0x8cf5('0x43')](_0x366b68);})[_0x8cf5('0x24')](function(_0x5a99f5){_0x445666['rows']=_0x5a99f5;return _0x445666;})[_0x8cf5('0x24')](respondWithFilteredResult(_0x3ef4a6,_0x366b68))[_0x8cf5('0x44')](handleError(_0x3ef4a6,null));};exports[_0x8cf5('0x45')]=function(_0x29d9f5,_0xab2fe0){var _0x58cb12={'raw':![],'where':{'id':_0x29d9f5[_0x8cf5('0x46')]['id']}},_0x428605={};_0x428605[_0x8cf5('0x30')]=_[_0x8cf5('0x33')](db[_0x8cf5('0x40')][_0x8cf5('0x2d')]);_0x428605[_0x8cf5('0x32')]=_[_0x8cf5('0x33')](_0x29d9f5['query']);_0x428605[_0x8cf5('0x34')]=_['intersection'](_0x428605[_0x8cf5('0x30')],_0x428605[_0x8cf5('0x32')]);_0x58cb12[_0x8cf5('0x35')]=_[_0x8cf5('0x36')](_0x428605['model'],qs[_0x8cf5('0x37')](_0x29d9f5[_0x8cf5('0x32')][_0x8cf5('0x37')]));_0x58cb12['attributes']=_0x58cb12['attributes'][_0x8cf5('0x38')]?_0x58cb12[_0x8cf5('0x35')]:_0x428605[_0x8cf5('0x30')];if(_0x29d9f5[_0x8cf5('0x32')][_0x8cf5('0x41')]){_0x58cb12[_0x8cf5('0x42')]=[{'all':!![]}];}_0x58cb12=_[_0x8cf5('0x3e')]({},_0x58cb12,_0x29d9f5['options']);return db[_0x8cf5('0x40')][_0x8cf5('0x47')](_0x58cb12)[_0x8cf5('0x24')](handleEntityNotFound(_0xab2fe0,null))[_0x8cf5('0x24')](respondWithResult(_0xab2fe0,null))[_0x8cf5('0x44')](handleError(_0xab2fe0,null));};exports['create']=function(_0xc1b7c1,_0x6560c3){return db[_0x8cf5('0x40')][_0x8cf5('0x48')](_0xc1b7c1[_0x8cf5('0x49')],{})[_0x8cf5('0x24')](respondWithResult(_0x6560c3,0xc9))[_0x8cf5('0x44')](handleError(_0x6560c3,null));};exports[_0x8cf5('0x4a')]=function(_0x5056ad,_0x5727e6){if(_0x5056ad[_0x8cf5('0x49')]['id']){delete _0x5056ad[_0x8cf5('0x49')]['id'];}return db['SalesforceConfiguration'][_0x8cf5('0x47')]({'where':{'id':_0x5056ad['params']['id']}})[_0x8cf5('0x24')](handleEntityNotFound(_0x5727e6,null))[_0x8cf5('0x24')](saveUpdates(_0x5056ad[_0x8cf5('0x49')],null))['then'](respondWithResult(_0x5727e6,null))[_0x8cf5('0x44')](handleError(_0x5727e6,null));};exports[_0x8cf5('0x25')]=function(_0x3018b7,_0x3a410e){return db[_0x8cf5('0x40')][_0x8cf5('0x47')]({'where':{'id':_0x3018b7[_0x8cf5('0x46')]['id']}})[_0x8cf5('0x24')](handleEntityNotFound(_0x3a410e,null))[_0x8cf5('0x24')](removeEntity(_0x3a410e,null))[_0x8cf5('0x44')](handleError(_0x3a410e,null));};exports[_0x8cf5('0x4b')]=function(_0x13632b,_0x464ef4,_0x1d2c20){var _0x3b65b9={};var _0x1e842d={};var _0x337a4c;var _0x5c33ed;return db['SalesforceConfiguration'][_0x8cf5('0x4c')]({'where':{'id':_0x13632b[_0x8cf5('0x46')]['id']}})[_0x8cf5('0x24')](handleEntityNotFound(_0x464ef4,null))[_0x8cf5('0x24')](function(_0x3e829f){if(_0x3e829f){_0x337a4c=_0x3e829f;_0x1e842d[_0x8cf5('0x30')]=_[_0x8cf5('0x33')](db[_0x8cf5('0x4d')][_0x8cf5('0x2d')]);_0x1e842d[_0x8cf5('0x32')]=_[_0x8cf5('0x33')](_0x13632b[_0x8cf5('0x32')]);_0x1e842d['filters']=_['intersection'](_0x1e842d[_0x8cf5('0x30')],_0x1e842d[_0x8cf5('0x32')]);_0x3b65b9[_0x8cf5('0x35')]=_['intersection'](_0x1e842d['model'],qs[_0x8cf5('0x37')](_0x13632b[_0x8cf5('0x32')]['fields']));_0x3b65b9[_0x8cf5('0x35')]=_0x3b65b9[_0x8cf5('0x35')]['length']?_0x3b65b9['attributes']:_0x1e842d[_0x8cf5('0x30')];_0x3b65b9[_0x8cf5('0x4e')]=qs[_0x8cf5('0x3a')](_0x13632b[_0x8cf5('0x32')][_0x8cf5('0x3a')]);_0x3b65b9[_0x8cf5('0x3b')]=qs[_0x8cf5('0x34')](_[_0x8cf5('0x3c')](_0x13632b[_0x8cf5('0x32')],_0x1e842d['filters']));if(_0x13632b[_0x8cf5('0x32')][_0x8cf5('0x3d')]){_0x3b65b9['where']=_[_0x8cf5('0x3e')](_0x3b65b9[_0x8cf5('0x3b')],{'$or':_[_0x8cf5('0x31')](_0x3b65b9[_0x8cf5('0x35')],function(_0x471aa1){var _0xbb104c={};_0xbb104c[_0x471aa1]={'$like':'%'+_0x13632b[_0x8cf5('0x32')][_0x8cf5('0x3d')]+'%'};return _0xbb104c;})});}_0x3b65b9=_['merge']({},_0x3b65b9,_0x13632b['options']);return _0x337a4c[_0x8cf5('0x4b')](_0x3b65b9);}})['then'](function(_0x3b0285){if(_0x3b0285){_0x5c33ed=_0x3b0285[_0x8cf5('0x38')];if(!_0x13632b[_0x8cf5('0x32')][_0x8cf5('0x4f')](_0x8cf5('0x39'))){_0x3b65b9['limit']=qs['limit'](_0x13632b[_0x8cf5('0x32')][_0x8cf5('0x1d')]);_0x3b65b9[_0x8cf5('0x1f')]=qs[_0x8cf5('0x1f')](_0x13632b['query'][_0x8cf5('0x1f')]);}return _0x337a4c[_0x8cf5('0x4b')](_0x3b65b9);}})['then'](function(_0x460c2e){if(_0x460c2e){return _0x460c2e?{'count':_0x5c33ed,'rows':_0x460c2e}:null;}})['then'](respondWithResult(_0x464ef4,null))[_0x8cf5('0x44')](handleError(_0x464ef4,null));};exports['getSubjects']=function(_0x33fa7b,_0x19e625,_0x5ae26f){var _0x255e6b={};var _0x40e2e2={};var _0x3dfce4;var _0x444ea9;return db[_0x8cf5('0x40')]['findOne']({'where':{'id':_0x33fa7b[_0x8cf5('0x46')]['id']}})['then'](handleEntityNotFound(_0x19e625,null))[_0x8cf5('0x24')](function(_0x412444){if(_0x412444){_0x3dfce4=_0x412444;_0x40e2e2[_0x8cf5('0x30')]=_[_0x8cf5('0x33')](db[_0x8cf5('0x4d')][_0x8cf5('0x2d')]);_0x40e2e2['query']=_[_0x8cf5('0x33')](_0x33fa7b['query']);_0x40e2e2[_0x8cf5('0x34')]=_[_0x8cf5('0x36')](_0x40e2e2['model'],_0x40e2e2[_0x8cf5('0x32')]);_0x255e6b[_0x8cf5('0x35')]=_[_0x8cf5('0x36')](_0x40e2e2[_0x8cf5('0x30')],qs['fields'](_0x33fa7b[_0x8cf5('0x32')][_0x8cf5('0x37')]));_0x255e6b[_0x8cf5('0x35')]=_0x255e6b[_0x8cf5('0x35')]['length']?_0x255e6b[_0x8cf5('0x35')]:_0x40e2e2[_0x8cf5('0x30')];_0x255e6b[_0x8cf5('0x4e')]=qs[_0x8cf5('0x3a')](_0x33fa7b[_0x8cf5('0x32')][_0x8cf5('0x3a')]);_0x255e6b[_0x8cf5('0x3b')]=qs[_0x8cf5('0x34')](_[_0x8cf5('0x3c')](_0x33fa7b[_0x8cf5('0x32')],_0x40e2e2[_0x8cf5('0x34')]));if(_0x33fa7b[_0x8cf5('0x32')][_0x8cf5('0x3d')]){_0x255e6b[_0x8cf5('0x3b')]=_[_0x8cf5('0x3e')](_0x255e6b[_0x8cf5('0x3b')],{'$or':_[_0x8cf5('0x31')](_0x255e6b[_0x8cf5('0x35')],function(_0x2819bd){var _0xef543e={};_0xef543e[_0x2819bd]={'$like':'%'+_0x33fa7b[_0x8cf5('0x32')]['filter']+'%'};return _0xef543e;})});}_0x255e6b=_[_0x8cf5('0x3e')]({},_0x255e6b,_0x33fa7b[_0x8cf5('0x3f')]);return _0x3dfce4[_0x8cf5('0x50')](_0x255e6b);}})[_0x8cf5('0x24')](function(_0x292b8b){if(_0x292b8b){_0x444ea9=_0x292b8b[_0x8cf5('0x38')];if(!_0x33fa7b['query'][_0x8cf5('0x4f')](_0x8cf5('0x39'))){_0x255e6b[_0x8cf5('0x1d')]=qs['limit'](_0x33fa7b['query']['limit']);_0x255e6b[_0x8cf5('0x1f')]=qs['offset'](_0x33fa7b['query'][_0x8cf5('0x1f')]);}return _0x3dfce4['getSubjects'](_0x255e6b);}})[_0x8cf5('0x24')](function(_0x1d56ec){if(_0x1d56ec){return _0x1d56ec?{'count':_0x444ea9,'rows':_0x1d56ec}:null;}})['then'](respondWithResult(_0x19e625,null))[_0x8cf5('0x44')](handleError(_0x19e625,null));};exports['getDescriptions']=function(_0x26df96,_0x4d1a13,_0x5b0984){var _0x21c138={};var _0x41b311={};var _0xcee616;var _0x169ab1;return db[_0x8cf5('0x40')][_0x8cf5('0x4c')]({'where':{'id':_0x26df96[_0x8cf5('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d1a13,null))[_0x8cf5('0x24')](function(_0x2eb284){if(_0x2eb284){_0xcee616=_0x2eb284;_0x41b311[_0x8cf5('0x30')]=_['keys'](db[_0x8cf5('0x4d')][_0x8cf5('0x2d')]);_0x41b311[_0x8cf5('0x32')]=_['keys'](_0x26df96[_0x8cf5('0x32')]);_0x41b311[_0x8cf5('0x34')]=_[_0x8cf5('0x36')](_0x41b311['model'],_0x41b311[_0x8cf5('0x32')]);_0x21c138[_0x8cf5('0x35')]=_['intersection'](_0x41b311[_0x8cf5('0x30')],qs[_0x8cf5('0x37')](_0x26df96[_0x8cf5('0x32')][_0x8cf5('0x37')]));_0x21c138['attributes']=_0x21c138[_0x8cf5('0x35')][_0x8cf5('0x38')]?_0x21c138[_0x8cf5('0x35')]:_0x41b311[_0x8cf5('0x30')];_0x21c138[_0x8cf5('0x4e')]=qs[_0x8cf5('0x3a')](_0x26df96[_0x8cf5('0x32')][_0x8cf5('0x3a')]);_0x21c138[_0x8cf5('0x3b')]=qs['filters'](_[_0x8cf5('0x3c')](_0x26df96[_0x8cf5('0x32')],_0x41b311[_0x8cf5('0x34')]));if(_0x26df96[_0x8cf5('0x32')][_0x8cf5('0x3d')]){_0x21c138[_0x8cf5('0x3b')]=_['merge'](_0x21c138['where'],{'$or':_['map'](_0x21c138['attributes'],function(_0xcdf04){var _0x3d5340={};_0x3d5340[_0xcdf04]={'$like':'%'+_0x26df96['query'][_0x8cf5('0x3d')]+'%'};return _0x3d5340;})});}_0x21c138=_[_0x8cf5('0x3e')]({},_0x21c138,_0x26df96['options']);return _0xcee616[_0x8cf5('0x51')](_0x21c138);}})[_0x8cf5('0x24')](function(_0x3b3b0e){if(_0x3b3b0e){_0x169ab1=_0x3b3b0e[_0x8cf5('0x38')];if(!_0x26df96['query'][_0x8cf5('0x4f')](_0x8cf5('0x39'))){_0x21c138['limit']=qs[_0x8cf5('0x1d')](_0x26df96[_0x8cf5('0x32')][_0x8cf5('0x1d')]);_0x21c138[_0x8cf5('0x1f')]=qs['offset'](_0x26df96[_0x8cf5('0x32')][_0x8cf5('0x1f')]);}return _0xcee616[_0x8cf5('0x51')](_0x21c138);}})[_0x8cf5('0x24')](function(_0x2b9e75){if(_0x2b9e75){return _0x2b9e75?{'count':_0x169ab1,'rows':_0x2b9e75}:null;}})[_0x8cf5('0x24')](respondWithResult(_0x4d1a13,null))[_0x8cf5('0x44')](handleError(_0x4d1a13,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f91c311..3419ef3 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 _0xcc00=['moment','request-promise','./intSalesforceConfiguration.attributes','exports','define','lodash','../../config/logger','api'];(function(_0xbc835a,_0x4f2231){var _0xc708b6=function(_0x5ac732){while(--_0x5ac732){_0xbc835a['push'](_0xbc835a['shift']());}};_0xc708b6(++_0x4f2231);}(_0xcc00,0x12d));var _0x0cc0=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xcc00[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0x0cc0('0x0'));var util=require('util');var logger=require(_0x0cc0('0x1'))(_0x0cc0('0x2'));var moment=require(_0x0cc0('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cc0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0cc0('0x5'));module[_0x0cc0('0x6')]=function(_0x3b5b16,_0x379cf4){return _0x3b5b16[_0x0cc0('0x7')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3100=['bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x2a54ba,_0x3d6db4){var _0x2a35fa=function(_0xf2be1f){while(--_0xf2be1f){_0x2a54ba['push'](_0x2a54ba['shift']());}};_0x2a35fa(++_0x3d6db4);}(_0x3100,0xcb));var _0x0310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3100[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0310('0x0'));var util=require(_0x0310('0x1'));var logger=require(_0x0310('0x2'))(_0x0310('0x3'));var moment=require(_0x0310('0x4'));var BPromise=require(_0x0310('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0310('0x6'));var rimraf=require(_0x0310('0x7'));var config=require(_0x0310('0x8'));var attributes=require(_0x0310('0x9'));module['exports']=function(_0x2beae5,_0x1d74c8){return _0x2beae5[_0x0310('0xa')](_0x0310('0xb'),attributes,{'tableName':_0x0310('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 145e15b..036bb76 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 _0xf99b=['debug','request\x20sent','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x5b3788,_0x189ea5){var _0x206cbc=function(_0x3659ee){while(--_0x3659ee){_0x5b3788['push'](_0x5b3788['shift']());}};_0x206cbc(++_0x189ea5);}(_0xf99b,0xd1));var _0xbf99=function(_0x3c1258,_0x12136d){_0x3c1258=_0x3c1258-0x0;var _0x36dc8e=_0xf99b[_0x3c1258];return _0x36dc8e;};'use strict';var _=require(_0xbf99('0x0'));var util=require('util');var moment=require(_0xbf99('0x1'));var BPromise=require(_0xbf99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf99('0x3'));var db=require(_0xbf99('0x4'))['db'];var utils=require(_0xbf99('0x5'));var logger=require('../../config/logger')(_0xbf99('0x6'));var config=require('../../config/environment');var jayson=require(_0xbf99('0x7'));var client=jayson['client'][_0xbf99('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e04fa,_0x3ea804,_0x242ee8){return new BPromise(function(_0x2e770c,_0x3105ab){return client[_0xbf99('0x9')](_0x1e04fa,_0x242ee8)['then'](function(_0x535f00){logger[_0xbf99('0xa')](_0xbf99('0xb'),_0x3ea804,'request\x20sent');logger[_0xbf99('0xc')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3ea804,_0xbf99('0xd'),JSON['stringify'](_0x535f00));if(_0x535f00[_0xbf99('0xe')]){if(_0x535f00[_0xbf99('0xe')]['code']===0x1f4){logger[_0xbf99('0xe')](_0xbf99('0xb'),_0x3ea804,_0x535f00[_0xbf99('0xe')][_0xbf99('0xf')]);return _0x3105ab(_0x535f00['error'][_0xbf99('0xf')]);}logger[_0xbf99('0xe')](_0xbf99('0xb'),_0x3ea804,_0x535f00[_0xbf99('0xe')][_0xbf99('0xf')]);return _0x2e770c(_0x535f00['error'][_0xbf99('0xf')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x3ea804,_0xbf99('0xd'));_0x2e770c(_0x535f00[_0xbf99('0x10')][_0xbf99('0xf')]);}})['catch'](function(_0x17f3c7){logger[_0xbf99('0xe')](_0xbf99('0xb'),_0x3ea804,_0x17f3c7);_0x3105ab(_0x17f3c7);});});} \ No newline at end of file +var _0x6dbe=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6dbe,0x148));var _0xe6db=function(_0xdf9bfb,_0x12a758){_0xdf9bfb=_0xdf9bfb-0x0;var _0x41f35a=_0x6dbe[_0xdf9bfb];return _0x41f35a;};'use strict';var _=require(_0xe6db('0x0'));var util=require(_0xe6db('0x1'));var moment=require('moment');var BPromise=require(_0xe6db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6db('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6db('0x4'));var logger=require(_0xe6db('0x5'))(_0xe6db('0x6'));var config=require(_0xe6db('0x7'));var jayson=require(_0xe6db('0x8'));var client=jayson['client'][_0xe6db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3710f0,_0x1eed3c,_0x469764){return new BPromise(function(_0x25f26d,_0x24f743){return client['request'](_0x3710f0,_0x469764)[_0xe6db('0xa')](function(_0x235d34){logger[_0xe6db('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1eed3c,_0xe6db('0xc'));logger[_0xe6db('0xd')](_0xe6db('0xe'),_0x1eed3c,_0xe6db('0xc'),JSON[_0xe6db('0xf')](_0x235d34));if(_0x235d34[_0xe6db('0x10')]){if(_0x235d34[_0xe6db('0x10')][_0xe6db('0x11')]===0x1f4){logger[_0xe6db('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1eed3c,_0x235d34[_0xe6db('0x10')][_0xe6db('0x12')]);return _0x24f743(_0x235d34[_0xe6db('0x10')]['message']);}logger['error'](_0xe6db('0x13'),_0x1eed3c,_0x235d34[_0xe6db('0x10')]['message']);return _0x25f26d(_0x235d34[_0xe6db('0x10')][_0xe6db('0x12')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x1eed3c,'request\x20sent');_0x25f26d(_0x235d34[_0xe6db('0x14')][_0xe6db('0x12')]);}})[_0xe6db('0x15')](function(_0x5b8e98){logger['error'](_0xe6db('0x13'),_0x1eed3c,_0x5b8e98);_0x24f743(_0x5b8e98);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index cd28606..164c033 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 _0x6e59=['connect-timeout','express','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer'];(function(_0x1b3704,_0x404580){var _0x5ed872=function(_0x5d9779){while(--_0x5d9779){_0x1b3704['push'](_0x1b3704['shift']());}};_0x5ed872(++_0x404580);}(_0x6e59,0xed));var _0x96e5=function(_0x222583,_0x5dd35){_0x222583=_0x222583-0x0;var _0x46ca38=_0x6e59[_0x222583];return _0x46ca38;};'use strict';var multer=require(_0x96e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x96e5('0x1'));var express=require(_0x96e5('0x2'));var router=express[_0x96e5('0x3')]();var fs_extra=require(_0x96e5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96e5('0x5'));var controller=require(_0x96e5('0x6'));router[_0x96e5('0x7')]('/',auth['isAuthenticated'](),controller[_0x96e5('0x8')]);router[_0x96e5('0x7')](_0x96e5('0x9'),auth[_0x96e5('0xa')](),controller['show']);router[_0x96e5('0xb')]('/',auth['isAuthenticated'](),controller[_0x96e5('0xc')]);router[_0x96e5('0xd')]('/:id',auth[_0x96e5('0xa')](),controller['update']);router[_0x96e5('0xe')](_0x96e5('0x9'),auth[_0x96e5('0xa')](),controller[_0x96e5('0xf')]);module[_0x96e5('0x10')]=router; \ No newline at end of file +var _0xc638=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x5d67be,_0x73cb7){var _0x4ce27a=function(_0x25c565){while(--_0x25c565){_0x5d67be['push'](_0x5d67be['shift']());}};_0x4ce27a(++_0x73cb7);}(_0xc638,0x11d));var _0x8c63=function(_0x5cc61d,_0x4fe17b){_0x5cc61d=_0x5cc61d-0x0;var _0x2e25d0=_0xc638[_0x5cc61d];return _0x2e25d0;};'use strict';var multer=require(_0x8c63('0x0'));var util=require('util');var path=require(_0x8c63('0x1'));var timeout=require(_0x8c63('0x2'));var express=require(_0x8c63('0x3'));var router=express['Router']();var fs_extra=require(_0x8c63('0x4'));var auth=require(_0x8c63('0x5'));var interaction=require(_0x8c63('0x6'));var config=require('../../config/environment');var controller=require(_0x8c63('0x7'));router[_0x8c63('0x8')]('/',auth[_0x8c63('0x9')](),controller[_0x8c63('0xa')]);router[_0x8c63('0x8')](_0x8c63('0xb'),auth[_0x8c63('0x9')](),controller[_0x8c63('0xc')]);router[_0x8c63('0xd')]('/',auth[_0x8c63('0x9')](),controller[_0x8c63('0xe')]);router[_0x8c63('0xf')]('/:id',auth[_0x8c63('0x9')](),controller[_0x8c63('0x10')]);router[_0x8c63('0x11')](_0x8c63('0xb'),auth['isAuthenticated'](),controller[_0x8c63('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 357ca33..5629a9c 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 _0x8451=['STRING','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x18b0a1,_0x535aac){var _0x55005a=function(_0xf42695){while(--_0xf42695){_0x18b0a1['push'](_0x18b0a1['shift']());}};_0x55005a(++_0x535aac);}(_0x8451,0xe8));var _0x1845=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x8451[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x1845('0x0'));module[_0x1845('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1845('0x2'),_0x1845('0x3'),_0x1845('0x4'),'keyValue',_0x1845('0x5')),'defaultValue':_0x1845('0x2')},'content':{'type':Sequelize[_0x1845('0x6')]},'key':{'type':Sequelize[_0x1845('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1845('0x2'),_0x1845('0x3'),_0x1845('0x4'))},'keyContent':{'type':Sequelize[_0x1845('0x6')]},'idField':{'type':Sequelize[_0x1845('0x6')]},'variableName':{'type':Sequelize[_0x1845('0x6')]}}; \ No newline at end of file +var _0x8cf1=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2e68db,_0x275d04){var _0x12df4c=function(_0x1b6701){while(--_0x1b6701){_0x2e68db['push'](_0x2e68db['shift']());}};_0x12df4c(++_0x275d04);}(_0x8cf1,0x110));var _0x18cf=function(_0x3669f6,_0x29ec30){_0x3669f6=_0x3669f6-0x0;var _0x20ad0c=_0x8cf1[_0x3669f6];return _0x20ad0c;};'use strict';var Sequelize=require('sequelize');module[_0x18cf('0x0')]={'type':{'type':Sequelize[_0x18cf('0x1')](_0x18cf('0x2'),_0x18cf('0x3'),_0x18cf('0x4'),_0x18cf('0x5'),_0x18cf('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x18cf('0x7')]},'key':{'type':Sequelize[_0x18cf('0x7')]},'keyType':{'type':Sequelize[_0x18cf('0x1')](_0x18cf('0x2'),'variable',_0x18cf('0x4'))},'keyContent':{'type':Sequelize[_0x18cf('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x18cf('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index cca04dd..664838c 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 _0xbde1=['sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','send','index','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SalesforceField','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x2ca5a8,_0x4bf2d1){var _0x138e5f=function(_0x3d13ea){while(--_0x3d13ea){_0x2ca5a8['push'](_0x2ca5a8['shift']());}};_0x138e5f(++_0x4bf2d1);}(_0xbde1,0x7c));var _0x1bde=function(_0x1e2072,_0xe3cc90){_0x1e2072=_0x1e2072-0x0;var _0x22956b=_0xbde1[_0x1e2072];return _0x22956b;};'use strict';var emlformat=require(_0x1bde('0x0'));var rimraf=require(_0x1bde('0x1'));var zipdir=require(_0x1bde('0x2'));var jsonpatch=require(_0x1bde('0x3'));var rp=require(_0x1bde('0x4'));var moment=require('moment');var BPromise=require(_0x1bde('0x5'));var Mustache=require(_0x1bde('0x6'));var util=require(_0x1bde('0x7'));var path=require(_0x1bde('0x8'));var sox=require(_0x1bde('0x9'));var csv=require(_0x1bde('0xa'));var ejs=require(_0x1bde('0xb'));var fs=require('fs');var fs_extra=require(_0x1bde('0xc'));var _=require(_0x1bde('0xd'));var squel=require(_0x1bde('0xe'));var crypto=require(_0x1bde('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1bde('0x10'));var Papa=require('papaparse');var Redis=require(_0x1bde('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1bde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bde('0x13'))(_0x1bde('0x14'));var utils=require(_0x1bde('0x15'));var config=require(_0x1bde('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1bde('0x17'))['db'];function respondWithStatusCode(_0x2d801b,_0x3140b8){_0x3140b8=_0x3140b8||0xcc;return function(_0x2e8c6f){if(_0x2e8c6f){return _0x2d801b[_0x1bde('0x18')](_0x3140b8);}return _0x2d801b[_0x1bde('0x19')](_0x3140b8)['end']();};}function respondWithResult(_0xb4e36d,_0x36057d){_0x36057d=_0x36057d||0xc8;return function(_0x377a11){if(_0x377a11){return _0xb4e36d['status'](_0x36057d)['json'](_0x377a11);}};}function respondWithFilteredResult(_0x59ad5b,_0x157f47){return function(_0x460909){if(_0x460909){var _0x54822d=typeof _0x157f47['offset']===_0x1bde('0x1a')&&typeof _0x157f47[_0x1bde('0x1b')]==='undefined';var _0x5085cc=_0x460909[_0x1bde('0x1c')];var _0x5287f7=_0x54822d?0x0:_0x157f47[_0x1bde('0x1d')];var _0x16175b=_0x54822d?_0x460909[_0x1bde('0x1c')]:_0x157f47[_0x1bde('0x1d')]+_0x157f47['limit'];var _0x4fd8f7;if(_0x16175b>=_0x5085cc){_0x16175b=_0x5085cc;_0x4fd8f7=0xc8;}else{_0x4fd8f7=0xce;}_0x59ad5b[_0x1bde('0x19')](_0x4fd8f7);return _0x59ad5b[_0x1bde('0x1e')](_0x1bde('0x1f'),_0x5287f7+'-'+_0x16175b+'/'+_0x5085cc)['json'](_0x460909);}return null;};}function patchUpdates(_0x7485a){return function(_0x5a1248){try{jsonpatch[_0x1bde('0x20')](_0x5a1248,_0x7485a,!![]);}catch(_0x1eec71){return BPromise[_0x1bde('0x21')](_0x1eec71);}return _0x5a1248[_0x1bde('0x22')]();};}function saveUpdates(_0x226aa3,_0x25e273){return function(_0x40ba03){if(_0x40ba03){return _0x40ba03[_0x1bde('0x23')](_0x226aa3)[_0x1bde('0x24')](function(_0x11a4a6){return _0x11a4a6;});}return null;};}function removeEntity(_0x452d9f,_0x51662c){return function(_0x4691f9){if(_0x4691f9){return _0x4691f9['destroy']()['then'](function(){_0x452d9f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59df1f,_0x4f9695){return function(_0x43895e){if(!_0x43895e){_0x59df1f[_0x1bde('0x18')](0x194);}return _0x43895e;};}function handleError(_0x3bfb39,_0xf5d69f){_0xf5d69f=_0xf5d69f||0x1f4;return function(_0x37e66f){logger['error'](_0x37e66f[_0x1bde('0x25')]);if(_0x37e66f['name']){delete _0x37e66f['name'];}_0x3bfb39[_0x1bde('0x19')](_0xf5d69f)[_0x1bde('0x26')](_0x37e66f);};}exports[_0x1bde('0x27')]=function(_0x1eada6,_0x29b81b){var _0x558871={},_0x529f9f={},_0x1284a9={'count':0x0,'rows':[]};var _0x17cdb8=_['map'](db['SalesforceField'][_0x1bde('0x28')],function(_0x3b0fbd){return{'name':_0x3b0fbd[_0x1bde('0x29')],'type':_0x3b0fbd[_0x1bde('0x2a')][_0x1bde('0x2b')]};});_0x529f9f['model']=_['map'](_0x17cdb8,_0x1bde('0x2c'));_0x529f9f[_0x1bde('0x2d')]=_[_0x1bde('0x2e')](_0x1eada6['query']);_0x529f9f[_0x1bde('0x2f')]=_[_0x1bde('0x30')](_0x529f9f[_0x1bde('0x31')],_0x529f9f[_0x1bde('0x2d')]);_0x558871[_0x1bde('0x32')]=_[_0x1bde('0x30')](_0x529f9f['model'],qs[_0x1bde('0x33')](_0x1eada6[_0x1bde('0x2d')][_0x1bde('0x33')]));_0x558871[_0x1bde('0x32')]=_0x558871['attributes'][_0x1bde('0x34')]?_0x558871['attributes']:_0x529f9f[_0x1bde('0x31')];if(!_0x1eada6[_0x1bde('0x2d')][_0x1bde('0x35')](_0x1bde('0x36'))){_0x558871['limit']=qs['limit'](_0x1eada6['query'][_0x1bde('0x1b')]);_0x558871['offset']=qs[_0x1bde('0x1d')](_0x1eada6[_0x1bde('0x2d')]['offset']);}_0x558871[_0x1bde('0x37')]=qs[_0x1bde('0x38')](_0x1eada6[_0x1bde('0x2d')]['sort']);_0x558871[_0x1bde('0x39')]=qs['filters'](_[_0x1bde('0x3a')](_0x1eada6['query'],_0x529f9f['filters']),_0x17cdb8);if(_0x1eada6[_0x1bde('0x2d')][_0x1bde('0x3b')]){_0x558871[_0x1bde('0x39')]=_['merge'](_0x558871['where'],{'$or':_['map'](_0x17cdb8,function(_0x3599ce){if(_0x3599ce[_0x1bde('0x2a')]!=='VIRTUAL'){var _0x896757={};_0x896757[_0x3599ce['name']]={'$like':'%'+_0x1eada6[_0x1bde('0x2d')][_0x1bde('0x3b')]+'%'};return _0x896757;}})});}_0x558871=_[_0x1bde('0x3c')]({},_0x558871,_0x1eada6['options']);var _0x1ce347={'where':_0x558871[_0x1bde('0x39')]};return db[_0x1bde('0x3d')]['count'](_0x1ce347)[_0x1bde('0x24')](function(_0x44b81c){_0x1284a9[_0x1bde('0x1c')]=_0x44b81c;if(_0x1eada6[_0x1bde('0x2d')]['includeAll']){_0x558871[_0x1bde('0x3e')]=[{'all':!![]}];}return db[_0x1bde('0x3d')][_0x1bde('0x3f')](_0x558871);})[_0x1bde('0x24')](function(_0x34c7b2){_0x1284a9[_0x1bde('0x40')]=_0x34c7b2;return _0x1284a9;})[_0x1bde('0x24')](respondWithFilteredResult(_0x29b81b,_0x558871))[_0x1bde('0x41')](handleError(_0x29b81b,null));};exports[_0x1bde('0x42')]=function(_0x1c7782,_0x195f77){var _0x4ab729={'raw':!![],'where':{'id':_0x1c7782[_0x1bde('0x43')]['id']}},_0x235a81={};_0x235a81[_0x1bde('0x31')]=_['keys'](db[_0x1bde('0x3d')][_0x1bde('0x28')]);_0x235a81['query']=_[_0x1bde('0x2e')](_0x1c7782[_0x1bde('0x2d')]);_0x235a81[_0x1bde('0x2f')]=_[_0x1bde('0x30')](_0x235a81[_0x1bde('0x31')],_0x235a81[_0x1bde('0x2d')]);_0x4ab729[_0x1bde('0x32')]=_[_0x1bde('0x30')](_0x235a81['model'],qs[_0x1bde('0x33')](_0x1c7782[_0x1bde('0x2d')][_0x1bde('0x33')]));_0x4ab729['attributes']=_0x4ab729[_0x1bde('0x32')][_0x1bde('0x34')]?_0x4ab729[_0x1bde('0x32')]:_0x235a81[_0x1bde('0x31')];if(_0x1c7782[_0x1bde('0x2d')][_0x1bde('0x44')]){_0x4ab729[_0x1bde('0x3e')]=[{'all':!![]}];}_0x4ab729=_[_0x1bde('0x3c')]({},_0x4ab729,_0x1c7782[_0x1bde('0x45')]);return db['SalesforceField'][_0x1bde('0x46')](_0x4ab729)[_0x1bde('0x24')](handleEntityNotFound(_0x195f77,null))[_0x1bde('0x24')](respondWithResult(_0x195f77,null))['catch'](handleError(_0x195f77,null));};exports[_0x1bde('0x47')]=function(_0x358c3e,_0x46695){return db[_0x1bde('0x3d')]['create'](_0x358c3e['body'],{})[_0x1bde('0x24')](respondWithResult(_0x46695,0xc9))['catch'](handleError(_0x46695,null));};exports['update']=function(_0x4653ef,_0x5f034a){if(_0x4653ef[_0x1bde('0x48')]['id']){delete _0x4653ef['body']['id'];}return db['SalesforceField']['find']({'where':{'id':_0x4653ef[_0x1bde('0x43')]['id']}})[_0x1bde('0x24')](handleEntityNotFound(_0x5f034a,null))[_0x1bde('0x24')](saveUpdates(_0x4653ef[_0x1bde('0x48')],null))[_0x1bde('0x24')](respondWithResult(_0x5f034a,null))['catch'](handleError(_0x5f034a,null));};exports[_0x1bde('0x49')]=function(_0x4cd459,_0x3653aa){return db['SalesforceField'][_0x1bde('0x46')]({'where':{'id':_0x4cd459[_0x1bde('0x43')]['id']}})[_0x1bde('0x24')](handleEntityNotFound(_0x3653aa,null))[_0x1bde('0x24')](removeEntity(_0x3653aa,null))[_0x1bde('0x41')](handleError(_0x3653aa,null));}; \ No newline at end of file +var _0xc0a4=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','SalesforceField','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x112c73,_0x1fe55c){var _0x5e3964=function(_0x600393){while(--_0x600393){_0x112c73['push'](_0x112c73['shift']());}};_0x5e3964(++_0x1fe55c);}(_0xc0a4,0xde));var _0x4c0a=function(_0x3ee92c,_0x3d082b){_0x3ee92c=_0x3ee92c-0x0;var _0x4d3df2=_0xc0a4[_0x3ee92c];return _0x4d3df2;};'use strict';var emlformat=require(_0x4c0a('0x0'));var rimraf=require(_0x4c0a('0x1'));var zipdir=require(_0x4c0a('0x2'));var jsonpatch=require(_0x4c0a('0x3'));var rp=require(_0x4c0a('0x4'));var moment=require(_0x4c0a('0x5'));var BPromise=require(_0x4c0a('0x6'));var Mustache=require(_0x4c0a('0x7'));var util=require('util');var path=require(_0x4c0a('0x8'));var sox=require('sox');var csv=require(_0x4c0a('0x9'));var ejs=require(_0x4c0a('0xa'));var fs=require('fs');var fs_extra=require(_0x4c0a('0xb'));var _=require(_0x4c0a('0xc'));var squel=require(_0x4c0a('0xd'));var crypto=require(_0x4c0a('0xe'));var jsforce=require(_0x4c0a('0xf'));var deskjs=require(_0x4c0a('0x10'));var toCsv=require(_0x4c0a('0x9'));var querystring=require(_0x4c0a('0x11'));var Papa=require(_0x4c0a('0x12'));var Redis=require(_0x4c0a('0x13'));var authService=require(_0x4c0a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4c0a('0x15'));var hardwareService=require(_0x4c0a('0x16'));var logger=require(_0x4c0a('0x17'))(_0x4c0a('0x18'));var utils=require(_0x4c0a('0x19'));var config=require(_0x4c0a('0x1a'));var licenseUtil=require(_0x4c0a('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e8396,_0x528e98){_0x528e98=_0x528e98||0xcc;return function(_0x43423a){if(_0x43423a){return _0x1e8396['sendStatus'](_0x528e98);}return _0x1e8396[_0x4c0a('0x1c')](_0x528e98)[_0x4c0a('0x1d')]();};}function respondWithResult(_0x344a5a,_0x2bfd66){_0x2bfd66=_0x2bfd66||0xc8;return function(_0xe93f26){if(_0xe93f26){return _0x344a5a['status'](_0x2bfd66)['json'](_0xe93f26);}};}function respondWithFilteredResult(_0x3e4e60,_0x46b2a0){return function(_0x226503){if(_0x226503){var _0xdcde56=typeof _0x46b2a0['offset']===_0x4c0a('0x1e')&&typeof _0x46b2a0[_0x4c0a('0x1f')]===_0x4c0a('0x1e');var _0x213930=_0x226503['count'];var _0x469596=_0xdcde56?0x0:_0x46b2a0[_0x4c0a('0x20')];var _0x46693c=_0xdcde56?_0x226503[_0x4c0a('0x21')]:_0x46b2a0['offset']+_0x46b2a0[_0x4c0a('0x1f')];var _0xc1916a;if(_0x46693c>=_0x213930){_0x46693c=_0x213930;_0xc1916a=0xc8;}else{_0xc1916a=0xce;}_0x3e4e60[_0x4c0a('0x1c')](_0xc1916a);return _0x3e4e60[_0x4c0a('0x22')](_0x4c0a('0x23'),_0x469596+'-'+_0x46693c+'/'+_0x213930)[_0x4c0a('0x24')](_0x226503);}return null;};}function patchUpdates(_0x592cd7){return function(_0x4440bb){try{jsonpatch[_0x4c0a('0x25')](_0x4440bb,_0x592cd7,!![]);}catch(_0x1f94e3){return BPromise[_0x4c0a('0x26')](_0x1f94e3);}return _0x4440bb[_0x4c0a('0x27')]();};}function saveUpdates(_0x302c52,_0x3a8ec0){return function(_0x24b6a2){if(_0x24b6a2){return _0x24b6a2[_0x4c0a('0x28')](_0x302c52)[_0x4c0a('0x29')](function(_0x4141a3){return _0x4141a3;});}return null;};}function removeEntity(_0x26d6b7,_0x124b47){return function(_0x385a99){if(_0x385a99){return _0x385a99[_0x4c0a('0x2a')]()[_0x4c0a('0x29')](function(){_0x26d6b7['status'](0xcc)[_0x4c0a('0x1d')]();});}};}function handleEntityNotFound(_0x37e4ba,_0x3f4509){return function(_0x4cdbc9){if(!_0x4cdbc9){_0x37e4ba[_0x4c0a('0x2b')](0x194);}return _0x4cdbc9;};}function handleError(_0x3cf440,_0x203b5d){_0x203b5d=_0x203b5d||0x1f4;return function(_0x2c0b54){logger['error'](_0x2c0b54[_0x4c0a('0x2c')]);if(_0x2c0b54[_0x4c0a('0x2d')]){delete _0x2c0b54['name'];}_0x3cf440[_0x4c0a('0x1c')](_0x203b5d)['send'](_0x2c0b54);};}exports[_0x4c0a('0x2e')]=function(_0x2f8398,_0x25efd7){var _0x19cd9c={},_0x555935={},_0x53da5e={'count':0x0,'rows':[]};var _0x91204a=_[_0x4c0a('0x2f')](db[_0x4c0a('0x30')][_0x4c0a('0x31')],function(_0x2b884b){return{'name':_0x2b884b['fieldName'],'type':_0x2b884b[_0x4c0a('0x32')][_0x4c0a('0x33')]};});_0x555935[_0x4c0a('0x34')]=_['map'](_0x91204a,_0x4c0a('0x2d'));_0x555935[_0x4c0a('0x35')]=_[_0x4c0a('0x36')](_0x2f8398[_0x4c0a('0x35')]);_0x555935['filters']=_['intersection'](_0x555935[_0x4c0a('0x34')],_0x555935[_0x4c0a('0x35')]);_0x19cd9c['attributes']=_[_0x4c0a('0x37')](_0x555935[_0x4c0a('0x34')],qs['fields'](_0x2f8398['query'][_0x4c0a('0x38')]));_0x19cd9c[_0x4c0a('0x39')]=_0x19cd9c[_0x4c0a('0x39')]['length']?_0x19cd9c['attributes']:_0x555935['model'];if(!_0x2f8398[_0x4c0a('0x35')][_0x4c0a('0x3a')]('nolimit')){_0x19cd9c[_0x4c0a('0x1f')]=qs[_0x4c0a('0x1f')](_0x2f8398[_0x4c0a('0x35')][_0x4c0a('0x1f')]);_0x19cd9c['offset']=qs['offset'](_0x2f8398['query'][_0x4c0a('0x20')]);}_0x19cd9c[_0x4c0a('0x3b')]=qs['sort'](_0x2f8398[_0x4c0a('0x35')]['sort']);_0x19cd9c[_0x4c0a('0x3c')]=qs[_0x4c0a('0x3d')](_[_0x4c0a('0x3e')](_0x2f8398[_0x4c0a('0x35')],_0x555935[_0x4c0a('0x3d')]),_0x91204a);if(_0x2f8398[_0x4c0a('0x35')][_0x4c0a('0x3f')]){_0x19cd9c['where']=_['merge'](_0x19cd9c[_0x4c0a('0x3c')],{'$or':_['map'](_0x91204a,function(_0x22c72a){if(_0x22c72a[_0x4c0a('0x32')]!==_0x4c0a('0x40')){var _0x3c886d={};_0x3c886d[_0x22c72a[_0x4c0a('0x2d')]]={'$like':'%'+_0x2f8398['query'][_0x4c0a('0x3f')]+'%'};return _0x3c886d;}})});}_0x19cd9c=_[_0x4c0a('0x41')]({},_0x19cd9c,_0x2f8398['options']);var _0x47dcce={'where':_0x19cd9c[_0x4c0a('0x3c')]};return db[_0x4c0a('0x30')][_0x4c0a('0x21')](_0x47dcce)[_0x4c0a('0x29')](function(_0x51a61d){_0x53da5e[_0x4c0a('0x21')]=_0x51a61d;if(_0x2f8398[_0x4c0a('0x35')][_0x4c0a('0x42')]){_0x19cd9c[_0x4c0a('0x43')]=[{'all':!![]}];}return db[_0x4c0a('0x30')]['findAll'](_0x19cd9c);})[_0x4c0a('0x29')](function(_0x5a1002){_0x53da5e[_0x4c0a('0x44')]=_0x5a1002;return _0x53da5e;})[_0x4c0a('0x29')](respondWithFilteredResult(_0x25efd7,_0x19cd9c))[_0x4c0a('0x45')](handleError(_0x25efd7,null));};exports[_0x4c0a('0x46')]=function(_0x4d144c,_0x4bb3db){var _0x50b95a={'raw':!![],'where':{'id':_0x4d144c[_0x4c0a('0x47')]['id']}},_0x3bd3ae={};_0x3bd3ae[_0x4c0a('0x34')]=_[_0x4c0a('0x36')](db[_0x4c0a('0x30')][_0x4c0a('0x31')]);_0x3bd3ae[_0x4c0a('0x35')]=_['keys'](_0x4d144c[_0x4c0a('0x35')]);_0x3bd3ae[_0x4c0a('0x3d')]=_[_0x4c0a('0x37')](_0x3bd3ae[_0x4c0a('0x34')],_0x3bd3ae[_0x4c0a('0x35')]);_0x50b95a[_0x4c0a('0x39')]=_[_0x4c0a('0x37')](_0x3bd3ae[_0x4c0a('0x34')],qs[_0x4c0a('0x38')](_0x4d144c['query'][_0x4c0a('0x38')]));_0x50b95a[_0x4c0a('0x39')]=_0x50b95a[_0x4c0a('0x39')][_0x4c0a('0x48')]?_0x50b95a[_0x4c0a('0x39')]:_0x3bd3ae['model'];if(_0x4d144c[_0x4c0a('0x35')][_0x4c0a('0x42')]){_0x50b95a['include']=[{'all':!![]}];}_0x50b95a=_[_0x4c0a('0x41')]({},_0x50b95a,_0x4d144c[_0x4c0a('0x49')]);return db[_0x4c0a('0x30')][_0x4c0a('0x4a')](_0x50b95a)[_0x4c0a('0x29')](handleEntityNotFound(_0x4bb3db,null))['then'](respondWithResult(_0x4bb3db,null))[_0x4c0a('0x45')](handleError(_0x4bb3db,null));};exports[_0x4c0a('0x4b')]=function(_0xb9d573,_0x2f1e13){return db[_0x4c0a('0x30')]['create'](_0xb9d573[_0x4c0a('0x4c')],{})['then'](respondWithResult(_0x2f1e13,0xc9))[_0x4c0a('0x45')](handleError(_0x2f1e13,null));};exports['update']=function(_0x209c25,_0x3875fa){if(_0x209c25[_0x4c0a('0x4c')]['id']){delete _0x209c25['body']['id'];}return db[_0x4c0a('0x30')][_0x4c0a('0x4a')]({'where':{'id':_0x209c25[_0x4c0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3875fa,null))[_0x4c0a('0x29')](saveUpdates(_0x209c25[_0x4c0a('0x4c')],null))[_0x4c0a('0x29')](respondWithResult(_0x3875fa,null))[_0x4c0a('0x45')](handleError(_0x3875fa,null));};exports['destroy']=function(_0x46427,_0x54e661){return db[_0x4c0a('0x30')][_0x4c0a('0x4a')]({'where':{'id':_0x46427[_0x4c0a('0x47')]['id']}})[_0x4c0a('0x29')](handleEntityNotFound(_0x54e661,null))[_0x4c0a('0x29')](removeEntity(_0x54e661,null))[_0x4c0a('0x45')](handleError(_0x54e661,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b577758..bcf1144 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 _0x2108=['lodash','util','api','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x50ce71,_0x14d5e2){var _0x17d729=function(_0x39591f){while(--_0x39591f){_0x50ce71['push'](_0x50ce71['shift']());}};_0x17d729(++_0x14d5e2);}(_0x2108,0x1a4));var _0x8210=function(_0x281524,_0x5b457a){_0x281524=_0x281524-0x0;var _0x1116ec=_0x2108[_0x281524];return _0x1116ec;};'use strict';var _=require(_0x8210('0x0'));var util=require(_0x8210('0x1'));var logger=require('../../config/logger')(_0x8210('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8210('0x3'));var fs=require('fs');var path=require(_0x8210('0x4'));var rimraf=require(_0x8210('0x5'));var config=require(_0x8210('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0x8210('0x7')]=function(_0x3a3328,_0x25574b){return _0x3a3328[_0x8210('0x8')](_0x8210('0x9'),attributes,{'tableName':_0x8210('0xa'),'paranoid':![],'indexes':[{'name':_0x8210('0xb'),'fields':[_0x8210('0xc'),_0x8210('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x025e=['rimraf','../../config/environment','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','moment','path'];(function(_0x44839b,_0x3f266d){var _0x3056e3=function(_0x2e0dfb){while(--_0x2e0dfb){_0x44839b['push'](_0x44839b['shift']());}};_0x3056e3(++_0x3f266d);}(_0x025e,0x13f));var _0xe025=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x025e[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xe025('0x0'));var util=require(_0xe025('0x1'));var logger=require(_0xe025('0x2'))('api');var moment=require(_0xe025('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe025('0x4'));var rimraf=require(_0xe025('0x5'));var config=require(_0xe025('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0xe025('0x7')]=function(_0x462599,_0x4c61e9){return _0x462599['define'](_0xe025('0x8'),attributes,{'tableName':_0xe025('0x9'),'paranoid':![],'indexes':[{'name':_0xe025('0xa'),'fields':['idField',_0xe025('0xb')],'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 788a9a3..2575bf8 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 _0x1610=['error','code','SalesforceField,\x20%s,\x20%s','message','lodash','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x36d92b,_0x3236e7){var _0x330b9f=function(_0x43c168){while(--_0x43c168){_0x36d92b['push'](_0x36d92b['shift']());}};_0x330b9f(++_0x3236e7);}(_0x1610,0xe4));var _0x0161=function(_0x5cbdd6,_0x87e26c){_0x5cbdd6=_0x5cbdd6-0x0;var _0x7c28ae=_0x1610[_0x5cbdd6];return _0x7c28ae;};'use strict';var _=require(_0x0161('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0161('0x1'));var db=require(_0x0161('0x2'))['db'];var utils=require(_0x0161('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0161('0x4'));var client=jayson[_0x0161('0x5')][_0x0161('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x435ae4,_0x3df4c0,_0x51c9f0){return new BPromise(function(_0x447d62,_0x30d1e6){return client['request'](_0x435ae4,_0x51c9f0)[_0x0161('0x7')](function(_0x48b26b){logger[_0x0161('0x8')]('SalesforceField,\x20%s,\x20%s',_0x3df4c0,_0x0161('0x9'));logger['debug'](_0x0161('0xa'),_0x3df4c0,'request\x20sent',JSON[_0x0161('0xb')](_0x48b26b));if(_0x48b26b[_0x0161('0xc')]){if(_0x48b26b['error'][_0x0161('0xd')]===0x1f4){logger[_0x0161('0xc')](_0x0161('0xe'),_0x3df4c0,_0x48b26b['error'][_0x0161('0xf')]);return _0x30d1e6(_0x48b26b[_0x0161('0xc')][_0x0161('0xf')]);}logger[_0x0161('0xc')]('SalesforceField,\x20%s,\x20%s',_0x3df4c0,_0x48b26b['error'][_0x0161('0xf')]);return _0x447d62(_0x48b26b['error'][_0x0161('0xf')]);}else{logger[_0x0161('0x8')](_0x0161('0xe'),_0x3df4c0,_0x0161('0x9'));_0x447d62(_0x48b26b['result'][_0x0161('0xf')]);}})['catch'](function(_0x4b44b2){logger[_0x0161('0xc')](_0x0161('0xe'),_0x3df4c0,_0x4b44b2);_0x30d1e6(_0x4b44b2);});});} \ No newline at end of file +var _0xf830=['debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf830,0x194));var _0x0f83=function(_0x5aafe2,_0x557ee6){_0x5aafe2=_0x5aafe2-0x0;var _0x4ebf83=_0xf830[_0x5aafe2];return _0x4ebf83;};'use strict';var _=require('lodash');var util=require(_0x0f83('0x0'));var moment=require(_0x0f83('0x1'));var BPromise=require(_0x0f83('0x2'));var rs=require(_0x0f83('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f83('0x4'))['db'];var utils=require(_0x0f83('0x5'));var logger=require('../../config/logger')(_0x0f83('0x6'));var config=require(_0x0f83('0x7'));var jayson=require(_0x0f83('0x8'));var client=jayson[_0x0f83('0x9')][_0x0f83('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35b888,_0x541fb9,_0x435488){return new BPromise(function(_0x4c8224,_0x2a0b31){return client[_0x0f83('0xb')](_0x35b888,_0x435488)['then'](function(_0x249255){logger[_0x0f83('0xc')]('SalesforceField,\x20%s,\x20%s',_0x541fb9,_0x0f83('0xd'));logger[_0x0f83('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x541fb9,'request\x20sent',JSON[_0x0f83('0xf')](_0x249255));if(_0x249255['error']){if(_0x249255[_0x0f83('0x10')][_0x0f83('0x11')]===0x1f4){logger[_0x0f83('0x10')](_0x0f83('0x12'),_0x541fb9,_0x249255['error'][_0x0f83('0x13')]);return _0x2a0b31(_0x249255[_0x0f83('0x10')]['message']);}logger[_0x0f83('0x10')](_0x0f83('0x12'),_0x541fb9,_0x249255['error']['message']);return _0x4c8224(_0x249255[_0x0f83('0x10')]['message']);}else{logger['info'](_0x0f83('0x12'),_0x541fb9,'request\x20sent');_0x4c8224(_0x249255[_0x0f83('0x14')][_0x0f83('0x13')]);}})[_0x0f83('0x15')](function(_0x550616){logger[_0x0f83('0x10')](_0x0f83('0x12'),_0x541fb9,_0x550616);_0x2a0b31(_0x550616);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index c2516f0..d3de759 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 _0xef38=['/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index'];(function(_0x314166,_0x2dc838){var _0xdb4f1f=function(_0x38361d){while(--_0x38361d){_0x314166['push'](_0x314166['shift']());}};_0xdb4f1f(++_0x2dc838);}(_0xef38,0x122));var _0x8ef3=function(_0x1f7b24,_0x3466f7){_0x1f7b24=_0x1f7b24-0x0;var _0x522873=_0xef38[_0x1f7b24];return _0x522873;};'use strict';var multer=require('multer');var util=require(_0x8ef3('0x0'));var path=require(_0x8ef3('0x1'));var timeout=require(_0x8ef3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ef3('0x3'));var auth=require(_0x8ef3('0x4'));var interaction=require(_0x8ef3('0x5'));var config=require(_0x8ef3('0x6'));var controller=require(_0x8ef3('0x7'));router['get']('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x9')]);router['get'](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xb')]);router[_0x8ef3('0xc')](_0x8ef3('0xd'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xe')]);router['get'](_0x8ef3('0xf'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x10')]);router[_0x8ef3('0x11')]('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x12')]);router[_0x8ef3('0x11')](_0x8ef3('0xd'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x13')]);router[_0x8ef3('0x14')](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x15')]);router[_0x8ef3('0x16')](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x17')]);module[_0x8ef3('0x18')]=router; \ No newline at end of file +var _0x2fc7=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','util'];(function(_0x320a38,_0xc6a350){var _0x59785e=function(_0x2bcc98){while(--_0x2bcc98){_0x320a38['push'](_0x320a38['shift']());}};_0x59785e(++_0xc6a350);}(_0x2fc7,0x19d));var _0x72fc=function(_0x1d66d4,_0x4551db){_0x1d66d4=_0x1d66d4-0x0;var _0x21a88=_0x2fc7[_0x1d66d4];return _0x21a88;};'use strict';var multer=require('multer');var util=require(_0x72fc('0x0'));var path=require('path');var timeout=require(_0x72fc('0x1'));var express=require('express');var router=express[_0x72fc('0x2')]();var fs_extra=require(_0x72fc('0x3'));var auth=require(_0x72fc('0x4'));var interaction=require(_0x72fc('0x5'));var config=require(_0x72fc('0x6'));var controller=require(_0x72fc('0x7'));router[_0x72fc('0x8')]('/',auth[_0x72fc('0x9')](),controller[_0x72fc('0xa')]);router[_0x72fc('0x8')](_0x72fc('0xb'),auth[_0x72fc('0x9')](),controller['show']);router[_0x72fc('0x8')](_0x72fc('0xc'),auth[_0x72fc('0x9')](),controller[_0x72fc('0xd')]);router[_0x72fc('0x8')](_0x72fc('0xe'),auth['isAuthenticated'](),controller[_0x72fc('0xf')]);router[_0x72fc('0x10')]('/',auth[_0x72fc('0x9')](),controller[_0x72fc('0x11')]);router[_0x72fc('0x10')](_0x72fc('0xc'),auth[_0x72fc('0x9')](),controller[_0x72fc('0x12')]);router['put']('/:id',auth[_0x72fc('0x9')](),controller[_0x72fc('0x13')]);router[_0x72fc('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x72fc('0x15')]);module[_0x72fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 179c936..7ebba9b 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 _0x1cd2=['username','remoteUri','sequelize','STRING'];(function(_0x46c1e2,_0x71356b){var _0x177701=function(_0x442604){while(--_0x442604){_0x46c1e2['push'](_0x46c1e2['shift']());}};_0x177701(++_0x71356b);}(_0x1cd2,0x176));var _0x21cd=function(_0x1e5431,_0x29ae00){_0x1e5431=_0x1e5431-0x0;var _0xce8f5c=_0x1cd2[_0x1e5431];return _0xce8f5c;};'use strict';var Sequelize=require(_0x21cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x21cd('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x21cd('0x1')],'unique':_0x21cd('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x21cd('0x1')]},'remoteUri':{'type':Sequelize[_0x21cd('0x1')],'unique':_0x21cd('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9695=['remoteUri','exports','STRING','username'];(function(_0x7c95e1,_0x373a2d){var _0x42819d=function(_0x31d165){while(--_0x31d165){_0x7c95e1['push'](_0x7c95e1['shift']());}};_0x42819d(++_0x373a2d);}(_0x9695,0x145));var _0x5969=function(_0x1ce3aa,_0x3489a5){_0x1ce3aa=_0x1ce3aa-0x0;var _0x5258cd=_0x9695[_0x1ce3aa];return _0x5258cd;};'use strict';var Sequelize=require('sequelize');module[_0x5969('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5969('0x1')]},'username':{'type':Sequelize[_0x5969('0x1')],'unique':_0x5969('0x2')},'password':{'type':Sequelize[_0x5969('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5969('0x1')],'unique':_0x5969('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index e082f1c..a8326e4 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 _0x28cf=['sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','error','stack','name','send','ServicenowAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','map','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','getConfigurations','findOne','pick','addConfiguration','getSubjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','close_code','severity','category','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','calendar_stc','cmdb_ci','delivery_plan','business_service','sys_domain_path','rfc','time_worked','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','delivery_task','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','sys_id','reopened_by','urgency','problem_id','assigned_to','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','correlation_id','username','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','label','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','False','false'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x28cf,0x155));var _0xf28c=function(_0xb775ad,_0xbd08e5){_0xb775ad=_0xb775ad-0x0;var _0x177404=_0x28cf[_0xb775ad];return _0x177404;};'use strict';var emlformat=require(_0xf28c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf28c('0x1'));var jsonpatch=require(_0xf28c('0x2'));var rp=require(_0xf28c('0x3'));var moment=require(_0xf28c('0x4'));var BPromise=require(_0xf28c('0x5'));var Mustache=require(_0xf28c('0x6'));var util=require(_0xf28c('0x7'));var path=require(_0xf28c('0x8'));var sox=require(_0xf28c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf28c('0xa'));var squel=require(_0xf28c('0xb'));var crypto=require(_0xf28c('0xc'));var jsforce=require(_0xf28c('0xd'));var deskjs=require(_0xf28c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf28c('0xf'));var Papa=require(_0xf28c('0x10'));var Redis=require(_0xf28c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf28c('0x12'));var as=require(_0xf28c('0x13'));var hardwareService=require(_0xf28c('0x14'));var logger=require(_0xf28c('0x15'))(_0xf28c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf28c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf28c('0x18'));function respondWithStatusCode(_0x4268fa,_0x581415){_0x581415=_0x581415||0xcc;return function(_0x19e4bd){if(_0x19e4bd){return _0x4268fa[_0xf28c('0x19')](_0x581415);}return _0x4268fa[_0xf28c('0x1a')](_0x581415)[_0xf28c('0x1b')]();};}function respondWithResult(_0x242213,_0x218455){_0x218455=_0x218455||0xc8;return function(_0x373b47){if(_0x373b47){return _0x242213[_0xf28c('0x1a')](_0x218455)['json'](_0x373b47);}};}function respondWithFilteredResult(_0x3bb3cd,_0x9a5d58){return function(_0x4e0b13){if(_0x4e0b13){var _0xa9cc3a=typeof _0x9a5d58[_0xf28c('0x1c')]===_0xf28c('0x1d')&&typeof _0x9a5d58[_0xf28c('0x1e')]===_0xf28c('0x1d');var _0x55fa55=_0x4e0b13[_0xf28c('0x1f')];var _0x61ed59=_0xa9cc3a?0x0:_0x9a5d58[_0xf28c('0x1c')];var _0x26e8a8=_0xa9cc3a?_0x4e0b13[_0xf28c('0x1f')]:_0x9a5d58['offset']+_0x9a5d58['limit'];var _0x447220;if(_0x26e8a8>=_0x55fa55){_0x26e8a8=_0x55fa55;_0x447220=0xc8;}else{_0x447220=0xce;}_0x3bb3cd['status'](_0x447220);return _0x3bb3cd['set'](_0xf28c('0x20'),_0x61ed59+'-'+_0x26e8a8+'/'+_0x55fa55)[_0xf28c('0x21')](_0x4e0b13);}return null;};}function patchUpdates(_0x589381){return function(_0x37e3a0){try{jsonpatch[_0xf28c('0x22')](_0x37e3a0,_0x589381,!![]);}catch(_0x31eed1){return BPromise[_0xf28c('0x23')](_0x31eed1);}return _0x37e3a0['save']();};}function saveUpdates(_0x24097a,_0x370618){return function(_0x5d7451){if(_0x5d7451){return _0x5d7451['update'](_0x24097a)[_0xf28c('0x24')](function(_0xbc9211){return _0xbc9211;});}return null;};}function removeEntity(_0x52a4fb,_0x150ef5){return function(_0x3b1541){if(_0x3b1541){return _0x3b1541['destroy']()[_0xf28c('0x24')](function(){_0x52a4fb[_0xf28c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59bf42,_0x239478){return function(_0x273eec){if(!_0x273eec){_0x59bf42[_0xf28c('0x19')](0x194);}return _0x273eec;};}function handleError(_0x21c6b9,_0x3f943f){_0x3f943f=_0x3f943f||0x1f4;return function(_0x5de864){logger[_0xf28c('0x25')](_0x5de864[_0xf28c('0x26')]);if(_0x5de864[_0xf28c('0x27')]){delete _0x5de864['name'];}_0x21c6b9[_0xf28c('0x1a')](_0x3f943f)[_0xf28c('0x28')](_0x5de864);};}exports['index']=function(_0x5d47d5,_0x1712d8){var _0x53080b={},_0x36a152={},_0x1059a5={'count':0x0,'rows':[]};var _0x171fb6=_['map'](db[_0xf28c('0x29')]['rawAttributes'],function(_0x41eaa6){return{'name':_0x41eaa6[_0xf28c('0x2a')],'type':_0x41eaa6[_0xf28c('0x2b')]['key']};});_0x36a152[_0xf28c('0x2c')]=_['map'](_0x171fb6,_0xf28c('0x27'));_0x36a152[_0xf28c('0x2d')]=_[_0xf28c('0x2e')](_0x5d47d5[_0xf28c('0x2d')]);_0x36a152[_0xf28c('0x2f')]=_[_0xf28c('0x30')](_0x36a152[_0xf28c('0x2c')],_0x36a152[_0xf28c('0x2d')]);_0x53080b['attributes']=_[_0xf28c('0x30')](_0x36a152['model'],qs[_0xf28c('0x31')](_0x5d47d5['query']['fields']));_0x53080b[_0xf28c('0x32')]=_0x53080b[_0xf28c('0x32')][_0xf28c('0x33')]?_0x53080b['attributes']:_0x36a152[_0xf28c('0x2c')];if(!_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x34')](_0xf28c('0x35'))){_0x53080b[_0xf28c('0x1e')]=qs['limit'](_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x1e')]);_0x53080b[_0xf28c('0x1c')]=qs[_0xf28c('0x1c')](_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x1c')]);}_0x53080b[_0xf28c('0x36')]=qs[_0xf28c('0x37')](_0x5d47d5[_0xf28c('0x2d')]['sort']);_0x53080b['where']=qs['filters'](_['pick'](_0x5d47d5[_0xf28c('0x2d')],_0x36a152[_0xf28c('0x2f')]),_0x171fb6);if(_0x5d47d5['query'][_0xf28c('0x38')]){_0x53080b[_0xf28c('0x39')]=_['merge'](_0x53080b[_0xf28c('0x39')],{'$or':_[_0xf28c('0x3a')](_0x171fb6,function(_0x5da3f5){if(_0x5da3f5[_0xf28c('0x2b')]!=='VIRTUAL'){var _0xd08d71={};_0xd08d71[_0x5da3f5['name']]={'$like':'%'+_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x38')]+'%'};return _0xd08d71;}})});}_0x53080b=_[_0xf28c('0x3b')]({},_0x53080b,_0x5d47d5[_0xf28c('0x3c')]);var _0x2e78f2={'where':_0x53080b[_0xf28c('0x39')]};return db['ServicenowAccount'][_0xf28c('0x1f')](_0x2e78f2)[_0xf28c('0x24')](function(_0x454614){_0x1059a5[_0xf28c('0x1f')]=_0x454614;if(_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x3d')]){_0x53080b[_0xf28c('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xf28c('0x3f')](_0x53080b);})[_0xf28c('0x24')](function(_0x592bd6){_0x1059a5['rows']=_0x592bd6;return _0x1059a5;})[_0xf28c('0x24')](respondWithFilteredResult(_0x1712d8,_0x53080b))[_0xf28c('0x40')](handleError(_0x1712d8,null));};exports[_0xf28c('0x41')]=function(_0x2eb072,_0x5a3df6){var _0x1f1601={'raw':![],'where':{'id':_0x2eb072[_0xf28c('0x42')]['id']}},_0x32b838={};_0x32b838[_0xf28c('0x2c')]=_[_0xf28c('0x2e')](db[_0xf28c('0x29')][_0xf28c('0x43')]);_0x32b838['query']=_[_0xf28c('0x2e')](_0x2eb072[_0xf28c('0x2d')]);_0x32b838[_0xf28c('0x2f')]=_['intersection'](_0x32b838['model'],_0x32b838[_0xf28c('0x2d')]);_0x1f1601['attributes']=_[_0xf28c('0x30')](_0x32b838[_0xf28c('0x2c')],qs[_0xf28c('0x31')](_0x2eb072[_0xf28c('0x2d')][_0xf28c('0x31')]));_0x1f1601[_0xf28c('0x32')]=_0x1f1601[_0xf28c('0x32')][_0xf28c('0x33')]?_0x1f1601[_0xf28c('0x32')]:_0x32b838[_0xf28c('0x2c')];if(_0x2eb072[_0xf28c('0x2d')][_0xf28c('0x3d')]){_0x1f1601[_0xf28c('0x3e')]=[{'all':!![]}];}_0x1f1601=_['merge']({},_0x1f1601,_0x2eb072[_0xf28c('0x3c')]);return db['ServicenowAccount']['find'](_0x1f1601)[_0xf28c('0x24')](handleEntityNotFound(_0x5a3df6,null))[_0xf28c('0x24')](respondWithResult(_0x5a3df6,null))[_0xf28c('0x40')](handleError(_0x5a3df6,null));};exports[_0xf28c('0x44')]=function(_0x16e0af,_0x23dc4c){return db[_0xf28c('0x29')][_0xf28c('0x44')](_0x16e0af['body'],{})['then'](respondWithResult(_0x23dc4c,0xc9))[_0xf28c('0x40')](handleError(_0x23dc4c,null));};exports['update']=function(_0x209c58,_0xf23844){if(_0x209c58[_0xf28c('0x45')]['id']){delete _0x209c58[_0xf28c('0x45')]['id'];}return db[_0xf28c('0x29')][_0xf28c('0x46')]({'where':{'id':_0x209c58[_0xf28c('0x42')]['id']}})[_0xf28c('0x24')](handleEntityNotFound(_0xf23844,null))['then'](saveUpdates(_0x209c58[_0xf28c('0x45')],null))[_0xf28c('0x24')](respondWithResult(_0xf23844,null))[_0xf28c('0x40')](handleError(_0xf23844,null));};exports[_0xf28c('0x47')]=function(_0x4eb70a,_0x21fdb6){return db[_0xf28c('0x29')]['find']({'where':{'id':_0x4eb70a[_0xf28c('0x42')]['id']}})[_0xf28c('0x24')](handleEntityNotFound(_0x21fdb6,null))['then'](removeEntity(_0x21fdb6,null))['catch'](handleError(_0x21fdb6,null));};exports[_0xf28c('0x48')]=function(_0x4e1b8d,_0x2eba74,_0x1d3b7f){var _0x3edbe9={};var _0xb10282={};var _0x2c276e;var _0x58a055;return db[_0xf28c('0x29')][_0xf28c('0x49')]({'where':{'id':_0x4e1b8d['params']['id']}})[_0xf28c('0x24')](handleEntityNotFound(_0x2eba74,null))[_0xf28c('0x24')](function(_0x6d170c){if(_0x6d170c){_0x2c276e=_0x6d170c;_0xb10282[_0xf28c('0x2c')]=_[_0xf28c('0x2e')](db['ServicenowConfiguration']['rawAttributes']);_0xb10282[_0xf28c('0x2d')]=_[_0xf28c('0x2e')](_0x4e1b8d[_0xf28c('0x2d')]);_0xb10282[_0xf28c('0x2f')]=_['intersection'](_0xb10282[_0xf28c('0x2c')],_0xb10282[_0xf28c('0x2d')]);_0x3edbe9['attributes']=_[_0xf28c('0x30')](_0xb10282[_0xf28c('0x2c')],qs[_0xf28c('0x31')](_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x31')]));_0x3edbe9[_0xf28c('0x32')]=_0x3edbe9[_0xf28c('0x32')][_0xf28c('0x33')]?_0x3edbe9[_0xf28c('0x32')]:_0xb10282[_0xf28c('0x2c')];_0x3edbe9[_0xf28c('0x36')]=qs[_0xf28c('0x37')](_0x4e1b8d[_0xf28c('0x2d')]['sort']);_0x3edbe9[_0xf28c('0x39')]=qs[_0xf28c('0x2f')](_[_0xf28c('0x4a')](_0x4e1b8d[_0xf28c('0x2d')],_0xb10282[_0xf28c('0x2f')]));if(_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x38')]){_0x3edbe9[_0xf28c('0x39')]=_['merge'](_0x3edbe9['where'],{'$or':_['map'](_0x3edbe9['attributes'],function(_0x2aa2e5){var _0x414c5d={};_0x414c5d[_0x2aa2e5]={'$like':'%'+_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x38')]+'%'};return _0x414c5d;})});}_0x3edbe9=_[_0xf28c('0x3b')]({},_0x3edbe9,_0x4e1b8d[_0xf28c('0x3c')]);return _0x2c276e['getConfigurations'](_0x3edbe9);}})[_0xf28c('0x24')](function(_0x372b1b){if(_0x372b1b){_0x58a055=_0x372b1b['length'];if(!_0x4e1b8d[_0xf28c('0x2d')]['hasOwnProperty'](_0xf28c('0x35'))){_0x3edbe9[_0xf28c('0x1e')]=qs['limit'](_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x1e')]);_0x3edbe9[_0xf28c('0x1c')]=qs['offset'](_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x1c')]);}return _0x2c276e[_0xf28c('0x48')](_0x3edbe9);}})[_0xf28c('0x24')](function(_0x24c341){if(_0x24c341){return _0x24c341?{'count':_0x58a055,'rows':_0x24c341}:null;}})[_0xf28c('0x24')](respondWithResult(_0x2eba74,null))[_0xf28c('0x40')](handleError(_0x2eba74,null));};exports[_0xf28c('0x4b')]=function(_0x5a962c,_0x58de1a,_0x786a0e){if(_0x5a962c[_0xf28c('0x45')]['id']){delete _0x5a962c[_0xf28c('0x45')]['id'];}return db['ServicenowAccount'][_0xf28c('0x49')]({'where':{'id':_0x5a962c['params']['id']}})[_0xf28c('0x24')](handleEntityNotFound(_0x58de1a,null))[_0xf28c('0x24')](function(_0x38fbf1){if(_0x38fbf1){_0x5a962c[_0xf28c('0x45')]['AccountId']=_0x38fbf1['id'];_0x5a962c['body']['Subjects']=integrations[_0xf28c('0x4c')](_0x5a962c[_0xf28c('0x45')][_0xf28c('0x4d')],_0x5a962c[_0xf28c('0x45')][_0xf28c('0x2b')]);_0x5a962c[_0xf28c('0x45')][_0xf28c('0x4e')]=integrations['getDescriptions'](_0x5a962c[_0xf28c('0x45')]['channel'],_0x5a962c[_0xf28c('0x45')][_0xf28c('0x2b')]);return db[_0xf28c('0x4f')][_0xf28c('0x44')](_0x5a962c[_0xf28c('0x45')],{'include':[{'model':db[_0xf28c('0x50')],'as':'Subjects'},{'model':db[_0xf28c('0x50')],'as':_0xf28c('0x4e')}]});}return null;})[_0xf28c('0x24')](respondWithResult(_0x58de1a,null))[_0xf28c('0x40')](handleError(_0x58de1a,null));};exports[_0xf28c('0x51')]=function(_0x42af51,_0x10c810,_0x6cb8f5){var _0x1460b4=['made_sla',_0xf28c('0x52'),_0xf28c('0x53'),'subcategory',_0xf28c('0x54'),'notify','incident_state',_0xf28c('0x55'),_0xf28c('0x56')];var _0x48291d=[_0xf28c('0x57'),_0xf28c('0x58'),_0xf28c('0x59'),_0xf28c('0x5a'),'upon_reject',_0xf28c('0x5b'),_0xf28c('0x5c'),'hold_reason',_0xf28c('0x5d'),_0xf28c('0x5e'),_0xf28c('0x5f'),'sys_updated_by',_0xf28c('0x60'),_0xf28c('0x61'),_0xf28c('0x62'),_0xf28c('0x63'),'state','sys_created_by',_0xf28c('0x53'),_0xf28c('0x36'),_0xf28c('0x64'),'closed_at',_0xf28c('0x65'),_0xf28c('0x66'),'impact','active','work_notes_list',_0xf28c('0x67'),'priority',_0xf28c('0x68'),_0xf28c('0x69'),_0xf28c('0x6a'),'expected_start','opened_at','business_duration',_0xf28c('0x6b'),'work_end',_0xf28c('0x6c'),_0xf28c('0x6d'),_0xf28c('0x6e'),_0xf28c('0x6f'),_0xf28c('0x70'),_0xf28c('0x71'),_0xf28c('0x72'),_0xf28c('0x54'),'correlation_display',_0xf28c('0x73'),'work_start','assignment_group','business_stc','additional_assignee_list',_0xf28c('0x74'),_0xf28c('0x75'),_0xf28c('0x76'),_0xf28c('0x77'),_0xf28c('0x78'),_0xf28c('0x79'),_0xf28c('0x7a'),'parent_incident',_0xf28c('0x7b'),'contact_type',_0xf28c('0x7c'),'incident_state',_0xf28c('0x7d'),_0xf28c('0x7e'),'company','reassignment_count','activity_due',_0xf28c('0x7f'),_0xf28c('0x55'),_0xf28c('0x80'),'sla_due',_0xf28c('0x81'),_0xf28c('0x82'),_0xf28c('0x83'),'sys_mod_count',_0xf28c('0x84'),_0xf28c('0x85'),'escalation','upon_approval',_0xf28c('0x86'),'location',_0xf28c('0x56')];var _0x1f476a='';var _0x1a395b='';var _0x414d01=[];var _0x309c9d='';var _0x3a7b84='';var _0x5f3ad6=[];var _0xa1e4e9='';var _0x287fe9='';var _0x450d9f={};var _0x3056d8='';return db[_0xf28c('0x29')]['findOne']({'where':{'id':_0x42af51['params']['id']},'attributes':['id',_0xf28c('0x87'),'password',_0xf28c('0x88'),_0xf28c('0x89'),_0xf28c('0x8a')]})[_0xf28c('0x24')](handleEntityNotFound(_0x10c810,null))[_0xf28c('0x24')](function(_0x5d3f19){if(_0x5d3f19){_0x3056d8=_0x5d3f19[_0xf28c('0x89')];var _0xcd1269=_0x3056d8['slice'](-0x1);if(_0xcd1269==='/'){_0x3056d8=_0x3056d8[_0xf28c('0x8b')](0x0,_0x3056d8[_0xf28c('0x8c')](_0xcd1269));}_0x287fe9=util[_0xf28c('0x8d')](_0xf28c('0x8e'),_0x3056d8);_0xa1e4e9=util[_0xf28c('0x8d')](_0xf28c('0x8f'),_0x3056d8);_0x450d9f={'user':_0x5d3f19[_0xf28c('0x87')],'pass':_0x5d3f19[_0xf28c('0x90')]};var _0x5c654b={'method':_0xf28c('0x91'),'uri':_0x287fe9+_0xf28c('0x92'),'auth':_0x450d9f,'json':!![]};return rp(_0x5c654b);}})[_0xf28c('0x24')](function(_0x2b9bff){if(_0x2b9bff[_0xf28c('0x93')][_0xf28c('0x33')]>0x0){_0x1f476a=_0x2b9bff[_0xf28c('0x93')];}console[_0xf28c('0x94')](_0xf28c('0x95'),_0x1f476a);_0x5f3ad6=[];_0x1a395b=Object[_0xf28c('0x96')]([],_0x1f476a);_['remove'](_0x1a395b,function(_0x3179d7){return!_0x1460b4[_0xf28c('0x97')](_0x3179d7[_0xf28c('0x27')]);});_0x1a395b[_0xf28c('0x98')](function(_0x347b65){var _0x1db345=createFieldObject(_0xa1e4e9,_0x450d9f,_0x347b65['internalType'],_0x347b65[_0xf28c('0x27')],_0x347b65[_0xf28c('0x99')],![]);_0x5f3ad6['push'](_0x1db345);});return Promise[_0xf28c('0x9a')](_0x5f3ad6);})['then'](function(_0x379318){_0x414d01=_0x379318;_0x309c9d=Object['assign']([],_0x1f476a);console[_0xf28c('0x94')](_0xf28c('0x9b'),_0x1f476a);_[_0xf28c('0x9c')](_0x309c9d,function(_0xa9e77){return _0x48291d[_0xf28c('0x97')](_0xa9e77[_0xf28c('0x27')]);});console[_0xf28c('0x94')](_0xf28c('0x9d'),_0x309c9d);_0x5f3ad6=[];_0x309c9d['forEach'](function(_0x5423b9){var _0x29f1bb=createFieldObject(_0xa1e4e9,_0x450d9f,_0x5423b9['internalType'],_0x5423b9[_0xf28c('0x27')],_0x5423b9[_0xf28c('0x99')],!![]);_0x5f3ad6[_0xf28c('0x9e')](_0x29f1bb);});return Promise[_0xf28c('0x9a')](_0x5f3ad6);})[_0xf28c('0x24')](function(_0x5f3adb){_0x3a7b84=_0x5f3adb;var _0x30d4c3=_0x414d01[_0xf28c('0x9f')](_0x3a7b84);return{'count':_0x30d4c3[_0xf28c('0x33')],'rows':_0x30d4c3};})[_0xf28c('0x24')](respondWithResult(_0x10c810,null))[_0xf28c('0x40')](function(_0x330086){console['log'](_0xf28c('0xa0')+_0x330086);var _0x45c348=_0x42af51['query'][_0xf28c('0xa1')]?0x1f4:_0x330086[_0xf28c('0xa2')]||0x1f4;logger[_0xf28c('0x25')](_0x330086[_0xf28c('0x26')]);delete _0x330086[_0xf28c('0x27')];if(_0x45c348===0x191){_0x45c348=0x190;}_0x10c810[_0xf28c('0x1a')](_0x45c348)[_0xf28c('0x28')](_0x42af51[_0xf28c('0x2d')][_0xf28c('0xa1')]?{'message':'Wrong\x20credentials','statusCode':_0x330086[_0xf28c('0xa2')]}:_0x330086);});};function createFieldObject(_0x31f092,_0x5eed15,_0x349488,_0x32670b,_0x100712,_0x445359){return new Promise(function(_0x450b3f,_0x39eb63){var _0x4336b2={'id':_0x32670b,'name':_0x100712,'custom':_0x445359};if(_0x349488===_0xf28c('0xa3')){_0x4336b2[_0xf28c('0x3c')]=[{'name':'True','value':'true'},{'name':_0xf28c('0xa4'),'value':_0xf28c('0xa5')}];_0x450b3f(_0x4336b2);}else{var _0x252a71={'method':_0xf28c('0x91'),'uri':_0x31f092+_0xf28c('0xa6')+_0x32670b,'auth':_0x5eed15,'json':!![]};return rp(_0x252a71)[_0xf28c('0x24')](function(_0x43051c){var _0x1871eb=[];if(_0x43051c['result'][_0xf28c('0x33')]>0x0){_0x43051c[_0xf28c('0x93')]['forEach'](function(_0x33547b){if(_0x33547b[_0xf28c('0xa7')]===_0xf28c('0xa5')){var _0x1b807b={'name':_0x33547b[_0xf28c('0x99')],'value':_0x33547b[_0xf28c('0xa8')]};_0x1871eb[_0xf28c('0x9e')](_0x1b807b);}});}_0x4336b2[_0xf28c('0x3c')]=_0x1871eb;if(_0x4336b2['options'][_0xf28c('0x33')]>0x0){_0x450b3f(_0x4336b2);}else{if(_0x445359==![]){_0x450b3f();}else{_0x450b3f(_0x4336b2);}}});}});} \ No newline at end of file +var _0x5d0b=['cmdb_ci','active','business_service','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','description','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_tags','escalation','correlation_id','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ServicenowAccount','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','find','create','update','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','made_sla','caused_by','watch_list','child_incidents','approval_history','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc'];(function(_0x3491e3,_0x281362){var _0x396cc6=function(_0xc00c83){while(--_0xc00c83){_0x3491e3['push'](_0x3491e3['shift']());}};_0x396cc6(++_0x281362);}(_0x5d0b,0x1b5));var _0xb5d0=function(_0x53d2d4,_0x1f63eb){_0x53d2d4=_0x53d2d4-0x0;var _0x2128d2=_0x5d0b[_0x53d2d4];return _0x2128d2;};'use strict';var emlformat=require(_0xb5d0('0x0'));var rimraf=require(_0xb5d0('0x1'));var zipdir=require(_0xb5d0('0x2'));var jsonpatch=require(_0xb5d0('0x3'));var rp=require(_0xb5d0('0x4'));var moment=require(_0xb5d0('0x5'));var BPromise=require(_0xb5d0('0x6'));var Mustache=require(_0xb5d0('0x7'));var util=require(_0xb5d0('0x8'));var path=require('path');var sox=require(_0xb5d0('0x9'));var csv=require('to-csv');var ejs=require(_0xb5d0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb5d0('0xb'));var squel=require('squel');var crypto=require(_0xb5d0('0xc'));var jsforce=require(_0xb5d0('0xd'));var deskjs=require(_0xb5d0('0xe'));var toCsv=require(_0xb5d0('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb5d0('0x10'));var authService=require(_0xb5d0('0x11'));var qs=require(_0xb5d0('0x12'));var as=require(_0xb5d0('0x13'));var hardwareService=require(_0xb5d0('0x14'));var logger=require(_0xb5d0('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb5d0('0x16'));var licenseUtil=require(_0xb5d0('0x17'));var db=require(_0xb5d0('0x18'))['db'];var integrations=require(_0xb5d0('0x19'));function respondWithStatusCode(_0x1a9de6,_0x2fead7){_0x2fead7=_0x2fead7||0xcc;return function(_0x52fb44){if(_0x52fb44){return _0x1a9de6[_0xb5d0('0x1a')](_0x2fead7);}return _0x1a9de6[_0xb5d0('0x1b')](_0x2fead7)[_0xb5d0('0x1c')]();};}function respondWithResult(_0x19add4,_0x31ca29){_0x31ca29=_0x31ca29||0xc8;return function(_0x39ebb2){if(_0x39ebb2){return _0x19add4['status'](_0x31ca29)[_0xb5d0('0x1d')](_0x39ebb2);}};}function respondWithFilteredResult(_0x32d430,_0x3d899d){return function(_0x4e20d2){if(_0x4e20d2){var _0x1e05ae=typeof _0x3d899d[_0xb5d0('0x1e')]===_0xb5d0('0x1f')&&typeof _0x3d899d[_0xb5d0('0x20')]==='undefined';var _0x26ed83=_0x4e20d2[_0xb5d0('0x21')];var _0x5bba49=_0x1e05ae?0x0:_0x3d899d[_0xb5d0('0x1e')];var _0x22c1c6=_0x1e05ae?_0x4e20d2[_0xb5d0('0x21')]:_0x3d899d['offset']+_0x3d899d[_0xb5d0('0x20')];var _0x184b6d;if(_0x22c1c6>=_0x26ed83){_0x22c1c6=_0x26ed83;_0x184b6d=0xc8;}else{_0x184b6d=0xce;}_0x32d430[_0xb5d0('0x1b')](_0x184b6d);return _0x32d430[_0xb5d0('0x22')](_0xb5d0('0x23'),_0x5bba49+'-'+_0x22c1c6+'/'+_0x26ed83)[_0xb5d0('0x1d')](_0x4e20d2);}return null;};}function patchUpdates(_0xeeb26c){return function(_0x418d75){try{jsonpatch[_0xb5d0('0x24')](_0x418d75,_0xeeb26c,!![]);}catch(_0x462381){return BPromise[_0xb5d0('0x25')](_0x462381);}return _0x418d75[_0xb5d0('0x26')]();};}function saveUpdates(_0xd8584a,_0x5030c0){return function(_0x322c93){if(_0x322c93){return _0x322c93['update'](_0xd8584a)[_0xb5d0('0x27')](function(_0x130b90){return _0x130b90;});}return null;};}function removeEntity(_0x2f0787,_0x1c894f){return function(_0x1e9c1b){if(_0x1e9c1b){return _0x1e9c1b[_0xb5d0('0x28')]()[_0xb5d0('0x27')](function(){_0x2f0787[_0xb5d0('0x1b')](0xcc)[_0xb5d0('0x1c')]();});}};}function handleEntityNotFound(_0x338d10,_0x555e0c){return function(_0x4eeb2f){if(!_0x4eeb2f){_0x338d10['sendStatus'](0x194);}return _0x4eeb2f;};}function handleError(_0x3caed7,_0x19fac9){_0x19fac9=_0x19fac9||0x1f4;return function(_0x33ad6a){logger[_0xb5d0('0x29')](_0x33ad6a[_0xb5d0('0x2a')]);if(_0x33ad6a[_0xb5d0('0x2b')]){delete _0x33ad6a['name'];}_0x3caed7[_0xb5d0('0x1b')](_0x19fac9)[_0xb5d0('0x2c')](_0x33ad6a);};}exports[_0xb5d0('0x2d')]=function(_0x1d5a33,_0x3f67d8){var _0x40b346={},_0x407515={},_0x3294a9={'count':0x0,'rows':[]};var _0x56eb7e=_[_0xb5d0('0x2e')](db[_0xb5d0('0x2f')]['rawAttributes'],function(_0x194390){return{'name':_0x194390['fieldName'],'type':_0x194390[_0xb5d0('0x30')]['key']};});_0x407515['model']=_['map'](_0x56eb7e,_0xb5d0('0x2b'));_0x407515['query']=_['keys'](_0x1d5a33[_0xb5d0('0x31')]);_0x407515[_0xb5d0('0x32')]=_[_0xb5d0('0x33')](_0x407515[_0xb5d0('0x34')],_0x407515[_0xb5d0('0x31')]);_0x40b346['attributes']=_[_0xb5d0('0x33')](_0x407515['model'],qs[_0xb5d0('0x35')](_0x1d5a33['query'][_0xb5d0('0x35')]));_0x40b346[_0xb5d0('0x36')]=_0x40b346[_0xb5d0('0x36')][_0xb5d0('0x37')]?_0x40b346[_0xb5d0('0x36')]:_0x407515['model'];if(!_0x1d5a33[_0xb5d0('0x31')][_0xb5d0('0x38')](_0xb5d0('0x39'))){_0x40b346['limit']=qs[_0xb5d0('0x20')](_0x1d5a33['query'][_0xb5d0('0x20')]);_0x40b346[_0xb5d0('0x1e')]=qs[_0xb5d0('0x1e')](_0x1d5a33[_0xb5d0('0x31')]['offset']);}_0x40b346['order']=qs[_0xb5d0('0x3a')](_0x1d5a33[_0xb5d0('0x31')][_0xb5d0('0x3a')]);_0x40b346[_0xb5d0('0x3b')]=qs[_0xb5d0('0x32')](_[_0xb5d0('0x3c')](_0x1d5a33[_0xb5d0('0x31')],_0x407515[_0xb5d0('0x32')]),_0x56eb7e);if(_0x1d5a33[_0xb5d0('0x31')][_0xb5d0('0x3d')]){_0x40b346[_0xb5d0('0x3b')]=_[_0xb5d0('0x3e')](_0x40b346[_0xb5d0('0x3b')],{'$or':_['map'](_0x56eb7e,function(_0x17769d){if(_0x17769d[_0xb5d0('0x30')]!=='VIRTUAL'){var _0x2ec649={};_0x2ec649[_0x17769d[_0xb5d0('0x2b')]]={'$like':'%'+_0x1d5a33[_0xb5d0('0x31')][_0xb5d0('0x3d')]+'%'};return _0x2ec649;}})});}_0x40b346=_['merge']({},_0x40b346,_0x1d5a33[_0xb5d0('0x3f')]);var _0x517bcb={'where':_0x40b346['where']};return db[_0xb5d0('0x2f')][_0xb5d0('0x21')](_0x517bcb)[_0xb5d0('0x27')](function(_0xfc2653){_0x3294a9[_0xb5d0('0x21')]=_0xfc2653;if(_0x1d5a33[_0xb5d0('0x31')]['includeAll']){_0x40b346[_0xb5d0('0x40')]=[{'all':!![]}];}return db[_0xb5d0('0x2f')][_0xb5d0('0x41')](_0x40b346);})[_0xb5d0('0x27')](function(_0x51a24e){_0x3294a9[_0xb5d0('0x42')]=_0x51a24e;return _0x3294a9;})[_0xb5d0('0x27')](respondWithFilteredResult(_0x3f67d8,_0x40b346))[_0xb5d0('0x43')](handleError(_0x3f67d8,null));};exports['show']=function(_0x10be85,_0x470678){var _0x168748={'raw':![],'where':{'id':_0x10be85[_0xb5d0('0x44')]['id']}},_0xba303a={};_0xba303a[_0xb5d0('0x34')]=_[_0xb5d0('0x45')](db[_0xb5d0('0x2f')][_0xb5d0('0x46')]);_0xba303a['query']=_[_0xb5d0('0x45')](_0x10be85[_0xb5d0('0x31')]);_0xba303a['filters']=_[_0xb5d0('0x33')](_0xba303a[_0xb5d0('0x34')],_0xba303a['query']);_0x168748[_0xb5d0('0x36')]=_[_0xb5d0('0x33')](_0xba303a[_0xb5d0('0x34')],qs[_0xb5d0('0x35')](_0x10be85[_0xb5d0('0x31')][_0xb5d0('0x35')]));_0x168748[_0xb5d0('0x36')]=_0x168748['attributes'][_0xb5d0('0x37')]?_0x168748[_0xb5d0('0x36')]:_0xba303a[_0xb5d0('0x34')];if(_0x10be85[_0xb5d0('0x31')][_0xb5d0('0x47')]){_0x168748[_0xb5d0('0x40')]=[{'all':!![]}];}_0x168748=_[_0xb5d0('0x3e')]({},_0x168748,_0x10be85[_0xb5d0('0x3f')]);return db['ServicenowAccount'][_0xb5d0('0x48')](_0x168748)[_0xb5d0('0x27')](handleEntityNotFound(_0x470678,null))[_0xb5d0('0x27')](respondWithResult(_0x470678,null))[_0xb5d0('0x43')](handleError(_0x470678,null));};exports['create']=function(_0x3cb66c,_0x2b01f2){return db[_0xb5d0('0x2f')][_0xb5d0('0x49')](_0x3cb66c['body'],{})[_0xb5d0('0x27')](respondWithResult(_0x2b01f2,0xc9))[_0xb5d0('0x43')](handleError(_0x2b01f2,null));};exports[_0xb5d0('0x4a')]=function(_0x5b6d0c,_0x207b02){if(_0x5b6d0c[_0xb5d0('0x4b')]['id']){delete _0x5b6d0c[_0xb5d0('0x4b')]['id'];}return db[_0xb5d0('0x2f')][_0xb5d0('0x48')]({'where':{'id':_0x5b6d0c[_0xb5d0('0x44')]['id']}})[_0xb5d0('0x27')](handleEntityNotFound(_0x207b02,null))['then'](saveUpdates(_0x5b6d0c[_0xb5d0('0x4b')],null))[_0xb5d0('0x27')](respondWithResult(_0x207b02,null))[_0xb5d0('0x43')](handleError(_0x207b02,null));};exports[_0xb5d0('0x28')]=function(_0x341f27,_0x404346){return db[_0xb5d0('0x2f')][_0xb5d0('0x48')]({'where':{'id':_0x341f27[_0xb5d0('0x44')]['id']}})[_0xb5d0('0x27')](handleEntityNotFound(_0x404346,null))['then'](removeEntity(_0x404346,null))[_0xb5d0('0x43')](handleError(_0x404346,null));};exports[_0xb5d0('0x4c')]=function(_0x4a392f,_0x532847,_0x954700){var _0x39e7fc={};var _0x101e33={};var _0x3b5fc2;var _0x782e9f;return db[_0xb5d0('0x2f')][_0xb5d0('0x4d')]({'where':{'id':_0x4a392f[_0xb5d0('0x44')]['id']}})[_0xb5d0('0x27')](handleEntityNotFound(_0x532847,null))[_0xb5d0('0x27')](function(_0x4c3764){if(_0x4c3764){_0x3b5fc2=_0x4c3764;_0x101e33[_0xb5d0('0x34')]=_[_0xb5d0('0x45')](db[_0xb5d0('0x4e')][_0xb5d0('0x46')]);_0x101e33[_0xb5d0('0x31')]=_[_0xb5d0('0x45')](_0x4a392f[_0xb5d0('0x31')]);_0x101e33[_0xb5d0('0x32')]=_[_0xb5d0('0x33')](_0x101e33[_0xb5d0('0x34')],_0x101e33['query']);_0x39e7fc[_0xb5d0('0x36')]=_['intersection'](_0x101e33[_0xb5d0('0x34')],qs[_0xb5d0('0x35')](_0x4a392f[_0xb5d0('0x31')]['fields']));_0x39e7fc['attributes']=_0x39e7fc[_0xb5d0('0x36')][_0xb5d0('0x37')]?_0x39e7fc[_0xb5d0('0x36')]:_0x101e33[_0xb5d0('0x34')];_0x39e7fc[_0xb5d0('0x4f')]=qs['sort'](_0x4a392f[_0xb5d0('0x31')][_0xb5d0('0x3a')]);_0x39e7fc[_0xb5d0('0x3b')]=qs['filters'](_[_0xb5d0('0x3c')](_0x4a392f[_0xb5d0('0x31')],_0x101e33['filters']));if(_0x4a392f[_0xb5d0('0x31')][_0xb5d0('0x3d')]){_0x39e7fc[_0xb5d0('0x3b')]=_[_0xb5d0('0x3e')](_0x39e7fc[_0xb5d0('0x3b')],{'$or':_['map'](_0x39e7fc[_0xb5d0('0x36')],function(_0x48605e){var _0x1c9f1f={};_0x1c9f1f[_0x48605e]={'$like':'%'+_0x4a392f['query'][_0xb5d0('0x3d')]+'%'};return _0x1c9f1f;})});}_0x39e7fc=_[_0xb5d0('0x3e')]({},_0x39e7fc,_0x4a392f['options']);return _0x3b5fc2['getConfigurations'](_0x39e7fc);}})['then'](function(_0x2448bc){if(_0x2448bc){_0x782e9f=_0x2448bc[_0xb5d0('0x37')];if(!_0x4a392f['query']['hasOwnProperty'](_0xb5d0('0x39'))){_0x39e7fc[_0xb5d0('0x20')]=qs[_0xb5d0('0x20')](_0x4a392f[_0xb5d0('0x31')][_0xb5d0('0x20')]);_0x39e7fc[_0xb5d0('0x1e')]=qs[_0xb5d0('0x1e')](_0x4a392f[_0xb5d0('0x31')][_0xb5d0('0x1e')]);}return _0x3b5fc2[_0xb5d0('0x4c')](_0x39e7fc);}})[_0xb5d0('0x27')](function(_0x8412f7){if(_0x8412f7){return _0x8412f7?{'count':_0x782e9f,'rows':_0x8412f7}:null;}})[_0xb5d0('0x27')](respondWithResult(_0x532847,null))['catch'](handleError(_0x532847,null));};exports[_0xb5d0('0x50')]=function(_0x3a9f1f,_0x5b0fdb,_0x5f2c4b){if(_0x3a9f1f[_0xb5d0('0x4b')]['id']){delete _0x3a9f1f[_0xb5d0('0x4b')]['id'];}return db[_0xb5d0('0x2f')][_0xb5d0('0x4d')]({'where':{'id':_0x3a9f1f[_0xb5d0('0x44')]['id']}})[_0xb5d0('0x27')](handleEntityNotFound(_0x5b0fdb,null))[_0xb5d0('0x27')](function(_0x2b4688){if(_0x2b4688){_0x3a9f1f[_0xb5d0('0x4b')][_0xb5d0('0x51')]=_0x2b4688['id'];_0x3a9f1f['body'][_0xb5d0('0x52')]=integrations[_0xb5d0('0x53')](_0x3a9f1f[_0xb5d0('0x4b')][_0xb5d0('0x54')],_0x3a9f1f[_0xb5d0('0x4b')][_0xb5d0('0x30')]);_0x3a9f1f[_0xb5d0('0x4b')]['Descriptions']=integrations[_0xb5d0('0x55')](_0x3a9f1f[_0xb5d0('0x4b')][_0xb5d0('0x54')],_0x3a9f1f[_0xb5d0('0x4b')][_0xb5d0('0x30')]);return db[_0xb5d0('0x4e')][_0xb5d0('0x49')](_0x3a9f1f[_0xb5d0('0x4b')],{'include':[{'model':db[_0xb5d0('0x56')],'as':_0xb5d0('0x52')},{'model':db['ServicenowField'],'as':_0xb5d0('0x57')}]});}return null;})['then'](respondWithResult(_0x5b0fdb,null))['catch'](handleError(_0x5b0fdb,null));};exports[_0xb5d0('0x58')]=function(_0x21e694,_0x11e3fd,_0x430253){var _0x3c6855=['made_sla',_0xb5d0('0x59'),_0xb5d0('0x5a'),_0xb5d0('0x5b'),_0xb5d0('0x5c'),_0xb5d0('0x5d'),_0xb5d0('0x5e'),'severity',_0xb5d0('0x5f')];var _0x24141b=[_0xb5d0('0x60'),_0xb5d0('0x61'),_0xb5d0('0x62'),_0xb5d0('0x63'),'upon_reject','sys_updated_on',_0xb5d0('0x64'),'hold_reason',_0xb5d0('0x65'),'number',_0xb5d0('0x66'),'sys_updated_by',_0xb5d0('0x67'),_0xb5d0('0x68'),_0xb5d0('0x69'),'sys_domain',_0xb5d0('0x6a'),_0xb5d0('0x6b'),_0xb5d0('0x5a'),_0xb5d0('0x4f'),_0xb5d0('0x6c'),'closed_at',_0xb5d0('0x6d'),'delivery_plan','impact',_0xb5d0('0x6e'),'work_notes_list',_0xb5d0('0x6f'),'priority','sys_domain_path',_0xb5d0('0x70'),_0xb5d0('0x71'),_0xb5d0('0x72'),_0xb5d0('0x73'),'business_duration',_0xb5d0('0x74'),_0xb5d0('0x75'),_0xb5d0('0x76'),'resolved_at','caller_id',_0xb5d0('0x77'),_0xb5d0('0x5b'),_0xb5d0('0x78'),_0xb5d0('0x79'),_0xb5d0('0x5c'),'correlation_display',_0xb5d0('0x7a'),_0xb5d0('0x7b'),_0xb5d0('0x7c'),_0xb5d0('0x7d'),'additional_assignee_list',_0xb5d0('0x7e'),'calendar_duration',_0xb5d0('0x5d'),_0xb5d0('0x7f'),_0xb5d0('0x80'),'closed_by',_0xb5d0('0x81'),_0xb5d0('0x82'),_0xb5d0('0x83'),_0xb5d0('0x84'),'reopened_by',_0xb5d0('0x5e'),_0xb5d0('0x85'),_0xb5d0('0x86'),_0xb5d0('0x87'),_0xb5d0('0x88'),_0xb5d0('0x89'),_0xb5d0('0x8a'),_0xb5d0('0x8b'),_0xb5d0('0x8c'),_0xb5d0('0x8d'),_0xb5d0('0x8e'),_0xb5d0('0x8f'),_0xb5d0('0x90'),'sys_mod_count','reopen_count',_0xb5d0('0x91'),_0xb5d0('0x92'),'upon_approval',_0xb5d0('0x93'),'location',_0xb5d0('0x5f')];var _0x47e9c9='';var _0x99903='';var _0x4dd95e=[];var _0x5c5507='';var _0x340053='';var _0x1b0305=[];var _0x1c73a8='';var _0xc9530b='';var _0x36ce14={};var _0x4302e1='';return db['ServicenowAccount'][_0xb5d0('0x4d')]({'where':{'id':_0x21e694['params']['id']},'attributes':['id','username',_0xb5d0('0x94'),_0xb5d0('0x95'),_0xb5d0('0x96'),_0xb5d0('0x97')]})[_0xb5d0('0x27')](handleEntityNotFound(_0x11e3fd,null))[_0xb5d0('0x27')](function(_0x3e3584){if(_0x3e3584){_0x4302e1=_0x3e3584[_0xb5d0('0x96')];var _0x4f5202=_0x4302e1[_0xb5d0('0x98')](-0x1);if(_0x4f5202==='/'){_0x4302e1=_0x4302e1[_0xb5d0('0x99')](0x0,_0x4302e1[_0xb5d0('0x9a')](_0x4f5202));}_0xc9530b=util[_0xb5d0('0x9b')](_0xb5d0('0x9c'),_0x4302e1);_0x1c73a8=util[_0xb5d0('0x9b')](_0xb5d0('0x9d'),_0x4302e1);_0x36ce14={'user':_0x3e3584[_0xb5d0('0x9e')],'pass':_0x3e3584['password']};var _0x3d8dbd={'method':_0xb5d0('0x9f'),'uri':_0xc9530b+_0xb5d0('0xa0'),'auth':_0x36ce14,'json':!![]};return rp(_0x3d8dbd);}})[_0xb5d0('0x27')](function(_0x7230e0){if(_0x7230e0[_0xb5d0('0xa1')][_0xb5d0('0x37')]>0x0){_0x47e9c9=_0x7230e0[_0xb5d0('0xa1')];}console['log'](_0xb5d0('0xa2'),_0x47e9c9);_0x1b0305=[];_0x99903=Object[_0xb5d0('0xa3')]([],_0x47e9c9);_[_0xb5d0('0xa4')](_0x99903,function(_0x4be495){return!_0x3c6855[_0xb5d0('0xa5')](_0x4be495[_0xb5d0('0x2b')]);});_0x99903[_0xb5d0('0xa6')](function(_0x823598){var _0xae3a72=createFieldObject(_0x1c73a8,_0x36ce14,_0x823598[_0xb5d0('0xa7')],_0x823598[_0xb5d0('0x2b')],_0x823598[_0xb5d0('0xa8')],![]);_0x1b0305['push'](_0xae3a72);});return Promise[_0xb5d0('0xa9')](_0x1b0305);})[_0xb5d0('0x27')](function(_0x401beb){_0x4dd95e=_0x401beb;_0x5c5507=Object[_0xb5d0('0xa3')]([],_0x47e9c9);console[_0xb5d0('0xaa')](_0xb5d0('0xab'),_0x47e9c9);_['remove'](_0x5c5507,function(_0x144913){return _0x24141b[_0xb5d0('0xa5')](_0x144913[_0xb5d0('0x2b')]);});console[_0xb5d0('0xaa')](_0xb5d0('0xac'),_0x5c5507);_0x1b0305=[];_0x5c5507[_0xb5d0('0xa6')](function(_0x2dcf9f){var _0x24094c=createFieldObject(_0x1c73a8,_0x36ce14,_0x2dcf9f['internalType'],_0x2dcf9f[_0xb5d0('0x2b')],_0x2dcf9f[_0xb5d0('0xa8')],!![]);_0x1b0305[_0xb5d0('0xad')](_0x24094c);});return Promise['all'](_0x1b0305);})['then'](function(_0x583cb0){_0x340053=_0x583cb0;var _0x3058d4=_0x4dd95e['concat'](_0x340053);return{'count':_0x3058d4[_0xb5d0('0x37')],'rows':_0x3058d4};})[_0xb5d0('0x27')](respondWithResult(_0x11e3fd,null))[_0xb5d0('0x43')](function(_0x4b5082){console[_0xb5d0('0xaa')](_0xb5d0('0xae')+_0x4b5082);var _0x49ddaf=_0x21e694['query'][_0xb5d0('0xaf')]?0x1f4:_0x4b5082[_0xb5d0('0xb0')]||0x1f4;logger[_0xb5d0('0x29')](_0x4b5082[_0xb5d0('0x2a')]);delete _0x4b5082[_0xb5d0('0x2b')];if(_0x49ddaf===0x191){_0x49ddaf=0x190;}_0x11e3fd['status'](_0x49ddaf)['send'](_0x21e694[_0xb5d0('0x31')][_0xb5d0('0xaf')]?{'message':_0xb5d0('0xb1'),'statusCode':_0x4b5082[_0xb5d0('0xb0')]}:_0x4b5082);});};function createFieldObject(_0x449a6f,_0x5b3bbf,_0x47322c,_0x32df79,_0x370f69,_0x467f86){return new Promise(function(_0x2581fb,_0xdb3e4b){var _0x18f800={'id':_0x32df79,'name':_0x370f69,'custom':_0x467f86};if(_0x47322c==='boolean'){_0x18f800['options']=[{'name':'True','value':'true'},{'name':'False','value':_0xb5d0('0xb2')}];_0x2581fb(_0x18f800);}else{var _0x2cb7ba={'method':'GET','uri':_0x449a6f+_0xb5d0('0xb3')+_0x32df79,'auth':_0x5b3bbf,'json':!![]};return rp(_0x2cb7ba)[_0xb5d0('0x27')](function(_0x368c44){var _0x348585=[];if(_0x368c44[_0xb5d0('0xa1')]['length']>0x0){_0x368c44[_0xb5d0('0xa1')][_0xb5d0('0xa6')](function(_0x468561){if(_0x468561[_0xb5d0('0xb4')]===_0xb5d0('0xb2')){var _0x5fd15b={'name':_0x468561[_0xb5d0('0xa8')],'value':_0x468561[_0xb5d0('0xb5')]};_0x348585[_0xb5d0('0xad')](_0x5fd15b);}});}_0x18f800[_0xb5d0('0x3f')]=_0x348585;if(_0x18f800[_0xb5d0('0x3f')][_0xb5d0('0x37')]>0x0){_0x2581fb(_0x18f800);}else{if(_0x467f86==![]){_0x2581fb();}else{_0x2581fb(_0x18f800);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e54976b..e5d3f1e 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 _0x038b=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','util','../../config/logger','api','bluebird'];(function(_0x3cf88d,_0x360188){var _0x1cb0b1=function(_0x1e01d5){while(--_0x1e01d5){_0x3cf88d['push'](_0x3cf88d['shift']());}};_0x1cb0b1(++_0x360188);}(_0x038b,0x114));var _0xb038=function(_0x44bd5,_0x46e7c1){_0x44bd5=_0x44bd5-0x0;var _0x4d244b=_0x038b[_0x44bd5];return _0x4d244b;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));var integrations=require(_0xb038('0x7'));module['exports']=function(_0x54e1e7,_0x2e3e64){return _0x54e1e7[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x40b8a4,_0xec5e67){var _0x1316e9=function(_0x54a49b){while(--_0x54a49b){_0x40b8a4['push'](_0x40b8a4['shift']());}};_0x1316e9(++_0xec5e67);}(_0x31f0,0xb7));var _0x031f=function(_0x1827c3,_0x541cdd){_0x1827c3=_0x1827c3-0x0;var _0x519e31=_0x31f0[_0x1827c3];return _0x519e31;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'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 806cb92..d2685c4 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 _0xa0b3=['ServicenowAccount','findAll','options','raw','attributes','limit','map','include','model','GetServicenowAccount','ShowServicenowAccount','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3fb41c,_0x5d8db7){var _0x4b0169=function(_0x3a829f){while(--_0x3a829f){_0x3fb41c['push'](_0x3fb41c['shift']());}};_0x4b0169(++_0x5d8db7);}(_0xa0b3,0x6b));var _0x3a0b=function(_0x47bd7c,_0x3358ee){_0x47bd7c=_0x47bd7c-0x0;var _0x4aa095=_0xa0b3[_0x47bd7c];return _0x4aa095;};'use strict';var _=require(_0x3a0b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a0b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a0b('0x2'));var db=require(_0x3a0b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a0b('0x4'))(_0x3a0b('0x5'));var config=require(_0x3a0b('0x6'));var jayson=require(_0x3a0b('0x7'));var client=jayson['client'][_0x3a0b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d3aa6,_0x2ce591,_0x21dbb6){return new BPromise(function(_0x4ee83c,_0x31b7d6){return client['request'](_0x2d3aa6,_0x21dbb6)[_0x3a0b('0x9')](function(_0x3bd837){logger[_0x3a0b('0xa')](_0x3a0b('0xb'),_0x2ce591,_0x3a0b('0xc'));logger[_0x3a0b('0xd')](_0x3a0b('0xe'),_0x2ce591,_0x3a0b('0xc'),JSON[_0x3a0b('0xf')](_0x3bd837));if(_0x3bd837[_0x3a0b('0x10')]){if(_0x3bd837[_0x3a0b('0x10')][_0x3a0b('0x11')]===0x1f4){logger[_0x3a0b('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2ce591,_0x3bd837[_0x3a0b('0x10')]['message']);return _0x31b7d6(_0x3bd837[_0x3a0b('0x10')][_0x3a0b('0x12')]);}logger[_0x3a0b('0x10')](_0x3a0b('0xb'),_0x2ce591,_0x3bd837['error']['message']);return _0x4ee83c(_0x3bd837[_0x3a0b('0x10')]['message']);}else{logger[_0x3a0b('0xa')](_0x3a0b('0xb'),_0x2ce591,_0x3a0b('0xc'));_0x4ee83c(_0x3bd837[_0x3a0b('0x13')][_0x3a0b('0x12')]);}})[_0x3a0b('0x14')](function(_0x530dae){logger['error'](_0x3a0b('0xb'),_0x2ce591,_0x530dae);_0x31b7d6(_0x530dae);});});}exports['GetServicenowAccount']=function(_0x3487a5){var _0x55a68c=this;return new Promise(function(_0x421cef,_0x426406){return db[_0x3a0b('0x15')][_0x3a0b('0x16')]({'raw':_0x3487a5[_0x3a0b('0x17')]?_0x3487a5[_0x3a0b('0x17')][_0x3a0b('0x18')]===undefined?!![]:![]:!![],'where':_0x3487a5[_0x3a0b('0x17')]?_0x3487a5[_0x3a0b('0x17')]['where']||null:null,'attributes':_0x3487a5[_0x3a0b('0x17')]?_0x3487a5[_0x3a0b('0x17')][_0x3a0b('0x19')]||null:null,'limit':_0x3487a5[_0x3a0b('0x17')]?_0x3487a5[_0x3a0b('0x17')][_0x3a0b('0x1a')]||null:null,'include':_0x3487a5['options']?_0x3487a5['options']['include']?_[_0x3a0b('0x1b')](_0x3487a5['options'][_0x3a0b('0x1c')],function(_0x1ffa7f){return{'model':db[_0x1ffa7f[_0x3a0b('0x1d')]],'as':_0x1ffa7f['as'],'attributes':_0x1ffa7f[_0x3a0b('0x19')],'include':_0x1ffa7f['include']?_['map'](_0x1ffa7f[_0x3a0b('0x1c')],function(_0x356f79){return{'model':db[_0x356f79[_0x3a0b('0x1d')]],'as':_0x356f79['as'],'attributes':_0x356f79[_0x3a0b('0x19')],'include':_0x356f79[_0x3a0b('0x1c')]?_[_0x3a0b('0x1b')](_0x356f79['include'],function(_0x2bc867){return{'model':db[_0x2bc867[_0x3a0b('0x1d')]],'as':_0x2bc867['as'],'attributes':_0x2bc867[_0x3a0b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x181f73){logger['info'](_0x3a0b('0x1e'),_0x3487a5);logger[_0x3a0b('0xd')](_0x3a0b('0x1e'),_0x3487a5,JSON['stringify'](_0x181f73));_0x421cef(_0x181f73);})[_0x3a0b('0x14')](function(_0x1c2bfc){logger[_0x3a0b('0x10')]('GetServicenowAccount',_0x1c2bfc[_0x3a0b('0x12')],_0x3487a5);_0x426406(_0x55a68c[_0x3a0b('0x10')](0x1f4,_0x1c2bfc[_0x3a0b('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x317690){var _0x547e37=this;return new Promise(function(_0x852047,_0x4da52b){return db['ServicenowAccount']['find']({'raw':_0x317690['options']?_0x317690[_0x3a0b('0x17')][_0x3a0b('0x18')]===undefined?!![]:![]:!![],'where':_0x317690['options']?_0x317690['options']['where']||null:null,'attributes':_0x317690[_0x3a0b('0x17')]?_0x317690[_0x3a0b('0x17')][_0x3a0b('0x19')]||null:null,'include':_0x317690[_0x3a0b('0x17')]?_0x317690[_0x3a0b('0x17')][_0x3a0b('0x1c')]?_[_0x3a0b('0x1b')](_0x317690[_0x3a0b('0x17')]['include'],function(_0xde6ec8){return{'model':db[_0xde6ec8[_0x3a0b('0x1d')]],'as':_0xde6ec8['as'],'attributes':_0xde6ec8[_0x3a0b('0x19')],'include':_0xde6ec8[_0x3a0b('0x1c')]?_['map'](_0xde6ec8['include'],function(_0x512b75){return{'model':db[_0x512b75['model']],'as':_0x512b75['as'],'attributes':_0x512b75[_0x3a0b('0x19')],'include':_0x512b75['include']?_[_0x3a0b('0x1b')](_0x512b75[_0x3a0b('0x1c')],function(_0xfcdba1){return{'model':db[_0xfcdba1[_0x3a0b('0x1d')]],'as':_0xfcdba1['as'],'attributes':_0xfcdba1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a0b('0x9')](function(_0x187517){logger['info']('ShowServicenowAccount',_0x317690);logger[_0x3a0b('0xd')](_0x3a0b('0x1f'),_0x317690,JSON[_0x3a0b('0xf')](_0x187517));_0x852047(_0x187517);})[_0x3a0b('0x14')](function(_0x43962e){logger['error'](_0x3a0b('0x1f'),_0x43962e['message'],_0x317690);_0x4da52b(_0x547e37[_0x3a0b('0x10')](0x1f4,_0x43962e[_0x3a0b('0x12')]));});});}; \ No newline at end of file +var _0x33b1=['catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','model','include','ShowServicenowAccount','find','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5a2e40,_0x31545f){var _0x24b638=function(_0xe6f282){while(--_0xe6f282){_0x5a2e40['push'](_0x5a2e40['shift']());}};_0x24b638(++_0x31545f);}(_0x33b1,0xb3));var _0x133b=function(_0x28a0c7,_0x6202d3){_0x28a0c7=_0x28a0c7-0x0;var _0x55d1dc=_0x33b1[_0x28a0c7];return _0x55d1dc;};'use strict';var _=require('lodash');var util=require(_0x133b('0x0'));var moment=require('moment');var BPromise=require(_0x133b('0x1'));var rs=require(_0x133b('0x2'));var fs=require('fs');var Redis=require(_0x133b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x133b('0x4'));var logger=require(_0x133b('0x5'))('rpc');var config=require(_0x133b('0x6'));var jayson=require(_0x133b('0x7'));var client=jayson[_0x133b('0x8')][_0x133b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15a1ea,_0x39803b,_0x3ab7e4){return new BPromise(function(_0x5ca5bc,_0x5cd7a0){return client[_0x133b('0xa')](_0x15a1ea,_0x3ab7e4)['then'](function(_0x263c40){logger[_0x133b('0xb')](_0x133b('0xc'),_0x39803b,'request\x20sent');logger[_0x133b('0xd')](_0x133b('0xe'),_0x39803b,_0x133b('0xf'),JSON['stringify'](_0x263c40));if(_0x263c40[_0x133b('0x10')]){if(_0x263c40[_0x133b('0x10')][_0x133b('0x11')]===0x1f4){logger[_0x133b('0x10')](_0x133b('0xc'),_0x39803b,_0x263c40[_0x133b('0x10')]['message']);return _0x5cd7a0(_0x263c40[_0x133b('0x10')][_0x133b('0x12')]);}logger[_0x133b('0x10')](_0x133b('0xc'),_0x39803b,_0x263c40['error'][_0x133b('0x12')]);return _0x5ca5bc(_0x263c40[_0x133b('0x10')]['message']);}else{logger[_0x133b('0xb')](_0x133b('0xc'),_0x39803b,_0x133b('0xf'));_0x5ca5bc(_0x263c40['result'][_0x133b('0x12')]);}})[_0x133b('0x13')](function(_0x34c53f){logger[_0x133b('0x10')](_0x133b('0xc'),_0x39803b,_0x34c53f);_0x5cd7a0(_0x34c53f);});});}exports[_0x133b('0x14')]=function(_0x4b129a){var _0x3e18dc=this;return new Promise(function(_0x209f37,_0x11162c){return db[_0x133b('0x15')][_0x133b('0x16')]({'raw':_0x4b129a['options']?_0x4b129a[_0x133b('0x17')][_0x133b('0x18')]===undefined?!![]:![]:!![],'where':_0x4b129a['options']?_0x4b129a[_0x133b('0x17')][_0x133b('0x19')]||null:null,'attributes':_0x4b129a[_0x133b('0x17')]?_0x4b129a[_0x133b('0x17')][_0x133b('0x1a')]||null:null,'limit':_0x4b129a[_0x133b('0x17')]?_0x4b129a[_0x133b('0x17')][_0x133b('0x1b')]||null:null,'include':_0x4b129a['options']?_0x4b129a[_0x133b('0x17')]['include']?_[_0x133b('0x1c')](_0x4b129a['options']['include'],function(_0xaf1c0b){return{'model':db[_0xaf1c0b[_0x133b('0x1d')]],'as':_0xaf1c0b['as'],'attributes':_0xaf1c0b[_0x133b('0x1a')],'include':_0xaf1c0b[_0x133b('0x1e')]?_[_0x133b('0x1c')](_0xaf1c0b[_0x133b('0x1e')],function(_0x195e22){return{'model':db[_0x195e22[_0x133b('0x1d')]],'as':_0x195e22['as'],'attributes':_0x195e22[_0x133b('0x1a')],'include':_0x195e22[_0x133b('0x1e')]?_['map'](_0x195e22[_0x133b('0x1e')],function(_0xbb382a){return{'model':db[_0xbb382a['model']],'as':_0xbb382a['as'],'attributes':_0xbb382a[_0x133b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57a2bb){logger['info'](_0x133b('0x14'),_0x4b129a);logger[_0x133b('0xd')]('GetServicenowAccount',_0x4b129a,JSON['stringify'](_0x57a2bb));_0x209f37(_0x57a2bb);})[_0x133b('0x13')](function(_0x427873){logger[_0x133b('0x10')]('GetServicenowAccount',_0x427873[_0x133b('0x12')],_0x4b129a);_0x11162c(_0x3e18dc[_0x133b('0x10')](0x1f4,_0x427873[_0x133b('0x12')]));});});};exports[_0x133b('0x1f')]=function(_0x42c486){var _0x466516=this;return new Promise(function(_0x58e087,_0xb588e8){return db['ServicenowAccount'][_0x133b('0x20')]({'raw':_0x42c486[_0x133b('0x17')]?_0x42c486[_0x133b('0x17')][_0x133b('0x18')]===undefined?!![]:![]:!![],'where':_0x42c486[_0x133b('0x17')]?_0x42c486['options'][_0x133b('0x19')]||null:null,'attributes':_0x42c486[_0x133b('0x17')]?_0x42c486[_0x133b('0x17')][_0x133b('0x1a')]||null:null,'include':_0x42c486[_0x133b('0x17')]?_0x42c486['options'][_0x133b('0x1e')]?_[_0x133b('0x1c')](_0x42c486['options'][_0x133b('0x1e')],function(_0x1e9b43){return{'model':db[_0x1e9b43[_0x133b('0x1d')]],'as':_0x1e9b43['as'],'attributes':_0x1e9b43['attributes'],'include':_0x1e9b43[_0x133b('0x1e')]?_[_0x133b('0x1c')](_0x1e9b43['include'],function(_0xe1bc53){return{'model':db[_0xe1bc53['model']],'as':_0xe1bc53['as'],'attributes':_0xe1bc53[_0x133b('0x1a')],'include':_0xe1bc53['include']?_[_0x133b('0x1c')](_0xe1bc53['include'],function(_0x1f1d1e){return{'model':db[_0x1f1d1e[_0x133b('0x1d')]],'as':_0x1f1d1e['as'],'attributes':_0x1f1d1e[_0x133b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7438b1){logger[_0x133b('0xb')](_0x133b('0x1f'),_0x42c486);logger[_0x133b('0xd')](_0x133b('0x1f'),_0x42c486,JSON['stringify'](_0x7438b1));_0x58e087(_0x7438b1);})[_0x133b('0x13')](function(_0x6cd9ce){logger[_0x133b('0x10')](_0x133b('0x1f'),_0x6cd9ce[_0x133b('0x12')],_0x42c486);_0xb588e8(_0x466516[_0x133b('0x10')](0x1f4,_0x6cd9ce[_0x133b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index f808898..1e0090a 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 _0x9287=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields'];(function(_0x1a699c,_0x36be4e){var _0x478204=function(_0x56c426){while(--_0x56c426){_0x1a699c['push'](_0x1a699c['shift']());}};_0x478204(++_0x36be4e);}(_0x9287,0x12a));var _0x7928=function(_0x21ba7d,_0x3721f1){_0x21ba7d=_0x21ba7d-0x0;var _0x1445b6=_0x9287[_0x21ba7d];return _0x1445b6;};'use strict';var multer=require(_0x7928('0x0'));var util=require(_0x7928('0x1'));var path=require(_0x7928('0x2'));var timeout=require('connect-timeout');var express=require(_0x7928('0x3'));var router=express[_0x7928('0x4')]();var fs_extra=require(_0x7928('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7928('0x6'));var config=require('../../config/environment');var controller=require(_0x7928('0x7'));router['get']('/',auth[_0x7928('0x8')](),controller[_0x7928('0x9')]);router[_0x7928('0xa')](_0x7928('0xb'),auth['isAuthenticated'](),controller[_0x7928('0xc')]);router['get'](_0x7928('0xd'),auth[_0x7928('0x8')](),controller[_0x7928('0xe')]);router[_0x7928('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x7928('0xf')]);router[_0x7928('0xa')](_0x7928('0x10'),auth[_0x7928('0x8')](),controller[_0x7928('0x11')]);router[_0x7928('0x12')]('/',auth[_0x7928('0x8')](),controller['create']);router[_0x7928('0x13')](_0x7928('0xb'),auth[_0x7928('0x8')](),controller[_0x7928('0x14')]);router[_0x7928('0x15')]('/:id',auth[_0x7928('0x8')](),controller[_0x7928('0x16')]);module[_0x7928('0x17')]=router; \ No newline at end of file +var _0x586e=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','get','show','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x54106a,_0x2a8752){var _0x29ace5=function(_0x432c92){while(--_0x432c92){_0x54106a['push'](_0x54106a['shift']());}};_0x29ace5(++_0x2a8752);}(_0x586e,0x65));var _0xe586=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x586e[_0x4709c8];return _0x478cdd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe586('0x0'));var express=require('express');var router=express[_0xe586('0x1')]();var fs_extra=require(_0xe586('0x2'));var auth=require(_0xe586('0x3'));var interaction=require(_0xe586('0x4'));var config=require(_0xe586('0x5'));var controller=require(_0xe586('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe586('0x7')]);router[_0xe586('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe586('0x9')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xe586('0x8')](_0xe586('0xa'),auth[_0xe586('0xb')](),controller[_0xe586('0xc')]);router[_0xe586('0x8')](_0xe586('0xd'),auth['isAuthenticated'](),controller[_0xe586('0xe')]);router[_0xe586('0xf')]('/',auth['isAuthenticated'](),controller[_0xe586('0x10')]);router[_0xe586('0x11')]('/:id',auth[_0xe586('0xb')](),controller['update']);router['delete'](_0xe586('0x12'),auth[_0xe586('0xb')](),controller[_0xe586('0x13')]);module[_0xe586('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 3b45967..f7c9334 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 _0x9cb2=['STRING','sequelize'];(function(_0x31e0d7,_0x2713e8){var _0x3750af=function(_0x46f2ff){while(--_0x46f2ff){_0x31e0d7['push'](_0x31e0d7['shift']());}};_0x3750af(++_0x2713e8);}(_0x9cb2,0x127));var _0x29cb=function(_0x59d546,_0x34bb80){_0x59d546=_0x59d546-0x0;var _0x563d77=_0x9cb2[_0x59d546];return _0x563d77;};'use strict';var Sequelize=require(_0x29cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x29cb('0x1')]},'description':{'type':Sequelize[_0x29cb('0x1')]}}; \ No newline at end of file +var _0x9a5b=['sequelize','exports','STRING'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9a5b,0xea));var _0xb9a5=function(_0x53e158,_0x429e72){_0x53e158=_0x53e158-0x0;var _0x5b72dd=_0x9a5b[_0x53e158];return _0x5b72dd;};'use strict';var Sequelize=require(_0xb9a5('0x0'));module[_0xb9a5('0x1')]={'name':{'type':Sequelize[_0xb9a5('0x2')]},'description':{'type':Sequelize[_0xb9a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e492cb2..f952132 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 _0x007d=['create','catch','body','find','params','getFields','ServicenowField','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','length'];(function(_0x48fd8f,_0x24c54d){var _0x46f545=function(_0x48069a){while(--_0x48069a){_0x48fd8f['push'](_0x48fd8f['shift']());}};_0x46f545(++_0x24c54d);}(_0x007d,0x104));var _0xd007=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x007d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd007('0x0'));var zipdir=require(_0xd007('0x1'));var jsonpatch=require(_0xd007('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd007('0x3'));var util=require(_0xd007('0x4'));var path=require(_0xd007('0x5'));var sox=require(_0xd007('0x6'));var csv=require(_0xd007('0x7'));var ejs=require(_0xd007('0x8'));var fs=require('fs');var fs_extra=require(_0xd007('0x9'));var _=require(_0xd007('0xa'));var squel=require(_0xd007('0xb'));var crypto=require(_0xd007('0xc'));var jsforce=require(_0xd007('0xd'));var deskjs=require(_0xd007('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd007('0xf'));var Papa=require('papaparse');var Redis=require(_0xd007('0x10'));var authService=require(_0xd007('0x11'));var qs=require(_0xd007('0x12'));var as=require(_0xd007('0x13'));var hardwareService=require(_0xd007('0x14'));var logger=require(_0xd007('0x15'))(_0xd007('0x16'));var utils=require(_0xd007('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd007('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b6463,_0x298952){_0x298952=_0x298952||0xcc;return function(_0x5919fa){if(_0x5919fa){return _0x4b6463[_0xd007('0x19')](_0x298952);}return _0x4b6463[_0xd007('0x1a')](_0x298952)[_0xd007('0x1b')]();};}function respondWithResult(_0x5cd26e,_0x446e1f){_0x446e1f=_0x446e1f||0xc8;return function(_0x5d02a8){if(_0x5d02a8){return _0x5cd26e['status'](_0x446e1f)[_0xd007('0x1c')](_0x5d02a8);}};}function respondWithFilteredResult(_0x30aa37,_0x3173d1){return function(_0x4aab85){if(_0x4aab85){var _0x18c395=typeof _0x3173d1[_0xd007('0x1d')]===_0xd007('0x1e')&&typeof _0x3173d1[_0xd007('0x1f')]==='undefined';var _0x1b3d1c=_0x4aab85[_0xd007('0x20')];var _0x21528a=_0x18c395?0x0:_0x3173d1[_0xd007('0x1d')];var _0x3af196=_0x18c395?_0x4aab85[_0xd007('0x20')]:_0x3173d1[_0xd007('0x1d')]+_0x3173d1[_0xd007('0x1f')];var _0xd3b138;if(_0x3af196>=_0x1b3d1c){_0x3af196=_0x1b3d1c;_0xd3b138=0xc8;}else{_0xd3b138=0xce;}_0x30aa37[_0xd007('0x1a')](_0xd3b138);return _0x30aa37[_0xd007('0x21')](_0xd007('0x22'),_0x21528a+'-'+_0x3af196+'/'+_0x1b3d1c)['json'](_0x4aab85);}return null;};}function patchUpdates(_0x312f71){return function(_0x92e881){try{jsonpatch['apply'](_0x92e881,_0x312f71,!![]);}catch(_0x4760c7){return BPromise[_0xd007('0x23')](_0x4760c7);}return _0x92e881[_0xd007('0x24')]();};}function saveUpdates(_0x3ec08a,_0x4160df){return function(_0x4b3cc9){if(_0x4b3cc9){return _0x4b3cc9[_0xd007('0x25')](_0x3ec08a)[_0xd007('0x26')](function(_0xbfaf2a){return _0xbfaf2a;});}return null;};}function removeEntity(_0x318167,_0x2688c2){return function(_0x185f28){if(_0x185f28){return _0x185f28[_0xd007('0x27')]()[_0xd007('0x26')](function(){_0x318167['status'](0xcc)[_0xd007('0x1b')]();});}};}function handleEntityNotFound(_0x5acccf,_0x58b126){return function(_0x575e6d){if(!_0x575e6d){_0x5acccf[_0xd007('0x19')](0x194);}return _0x575e6d;};}function handleError(_0x534239,_0x42c62c){_0x42c62c=_0x42c62c||0x1f4;return function(_0x4d618b){logger[_0xd007('0x28')](_0x4d618b[_0xd007('0x29')]);if(_0x4d618b[_0xd007('0x2a')]){delete _0x4d618b[_0xd007('0x2a')];}_0x534239['status'](_0x42c62c)[_0xd007('0x2b')](_0x4d618b);};}exports['index']=function(_0x133dab,_0x5a78de){var _0x171bda={},_0x3f5a6f={},_0x51d9b8={'count':0x0,'rows':[]};var _0x926970=_['map'](db[_0xd007('0x2c')][_0xd007('0x2d')],function(_0x3d3b80){return{'name':_0x3d3b80[_0xd007('0x2e')],'type':_0x3d3b80['type'][_0xd007('0x2f')]};});_0x3f5a6f[_0xd007('0x30')]=_[_0xd007('0x31')](_0x926970,'name');_0x3f5a6f[_0xd007('0x32')]=_['keys'](_0x133dab[_0xd007('0x32')]);_0x3f5a6f[_0xd007('0x33')]=_['intersection'](_0x3f5a6f[_0xd007('0x30')],_0x3f5a6f[_0xd007('0x32')]);_0x171bda[_0xd007('0x34')]=_[_0xd007('0x35')](_0x3f5a6f[_0xd007('0x30')],qs['fields'](_0x133dab[_0xd007('0x32')][_0xd007('0x36')]));_0x171bda[_0xd007('0x34')]=_0x171bda[_0xd007('0x34')]['length']?_0x171bda['attributes']:_0x3f5a6f[_0xd007('0x30')];if(!_0x133dab['query'][_0xd007('0x37')]('nolimit')){_0x171bda[_0xd007('0x1f')]=qs[_0xd007('0x1f')](_0x133dab[_0xd007('0x32')][_0xd007('0x1f')]);_0x171bda[_0xd007('0x1d')]=qs[_0xd007('0x1d')](_0x133dab[_0xd007('0x32')][_0xd007('0x1d')]);}_0x171bda[_0xd007('0x38')]=qs[_0xd007('0x39')](_0x133dab['query'][_0xd007('0x39')]);_0x171bda[_0xd007('0x3a')]=qs[_0xd007('0x33')](_[_0xd007('0x3b')](_0x133dab[_0xd007('0x32')],_0x3f5a6f[_0xd007('0x33')]),_0x926970);if(_0x133dab[_0xd007('0x32')]['filter']){_0x171bda[_0xd007('0x3a')]=_[_0xd007('0x3c')](_0x171bda['where'],{'$or':_[_0xd007('0x31')](_0x926970,function(_0x41e7b1){if(_0x41e7b1[_0xd007('0x3d')]!==_0xd007('0x3e')){var _0x236247={};_0x236247[_0x41e7b1[_0xd007('0x2a')]]={'$like':'%'+_0x133dab['query'][_0xd007('0x3f')]+'%'};return _0x236247;}})});}_0x171bda=_[_0xd007('0x3c')]({},_0x171bda,_0x133dab[_0xd007('0x40')]);var _0x26c7e8={'where':_0x171bda[_0xd007('0x3a')]};return db['ServicenowConfiguration'][_0xd007('0x20')](_0x26c7e8)[_0xd007('0x26')](function(_0x589ec4){_0x51d9b8[_0xd007('0x20')]=_0x589ec4;if(_0x133dab['query'][_0xd007('0x41')]){_0x171bda[_0xd007('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xd007('0x43')](_0x171bda);})['then'](function(_0x1d809e){_0x51d9b8[_0xd007('0x44')]=_0x1d809e;return _0x51d9b8;})[_0xd007('0x26')](respondWithFilteredResult(_0x5a78de,_0x171bda))['catch'](handleError(_0x5a78de,null));};exports[_0xd007('0x45')]=function(_0x200e68,_0x484a1d){var _0x1fc0a8={'raw':![],'where':{'id':_0x200e68['params']['id']}},_0x623c4b={};_0x623c4b[_0xd007('0x30')]=_[_0xd007('0x46')](db[_0xd007('0x2c')][_0xd007('0x2d')]);_0x623c4b[_0xd007('0x32')]=_[_0xd007('0x46')](_0x200e68[_0xd007('0x32')]);_0x623c4b[_0xd007('0x33')]=_[_0xd007('0x35')](_0x623c4b[_0xd007('0x30')],_0x623c4b[_0xd007('0x32')]);_0x1fc0a8['attributes']=_[_0xd007('0x35')](_0x623c4b[_0xd007('0x30')],qs[_0xd007('0x36')](_0x200e68[_0xd007('0x32')]['fields']));_0x1fc0a8[_0xd007('0x34')]=_0x1fc0a8[_0xd007('0x34')][_0xd007('0x47')]?_0x1fc0a8['attributes']:_0x623c4b[_0xd007('0x30')];if(_0x200e68[_0xd007('0x32')][_0xd007('0x41')]){_0x1fc0a8['include']=[{'all':!![]}];}_0x1fc0a8=_[_0xd007('0x3c')]({},_0x1fc0a8,_0x200e68['options']);return db['ServicenowConfiguration']['find'](_0x1fc0a8)[_0xd007('0x26')](handleEntityNotFound(_0x484a1d,null))[_0xd007('0x26')](respondWithResult(_0x484a1d,null))['catch'](handleError(_0x484a1d,null));};exports[_0xd007('0x48')]=function(_0x28224e,_0x4a5616){return db[_0xd007('0x2c')]['create'](_0x28224e['body'],{})[_0xd007('0x26')](respondWithResult(_0x4a5616,0xc9))[_0xd007('0x49')](handleError(_0x4a5616,null));};exports['update']=function(_0x47f69b,_0x38abae){if(_0x47f69b[_0xd007('0x4a')]['id']){delete _0x47f69b[_0xd007('0x4a')]['id'];}return db['ServicenowConfiguration'][_0xd007('0x4b')]({'where':{'id':_0x47f69b[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x38abae,null))[_0xd007('0x26')](saveUpdates(_0x47f69b[_0xd007('0x4a')],null))['then'](respondWithResult(_0x38abae,null))[_0xd007('0x49')](handleError(_0x38abae,null));};exports['destroy']=function(_0x5015f0,_0x27d20d){return db['ServicenowConfiguration']['find']({'where':{'id':_0x5015f0[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x27d20d,null))[_0xd007('0x26')](removeEntity(_0x27d20d,null))[_0xd007('0x49')](handleError(_0x27d20d,null));};exports[_0xd007('0x4d')]=function(_0x12c66f,_0x427d2b,_0x45e4b5){var _0x3fd35d={};var _0x551fb1={};var _0xa834f4;var _0x4b5f9a;return db[_0xd007('0x2c')]['findOne']({'where':{'id':_0x12c66f[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x427d2b,null))[_0xd007('0x26')](function(_0x512ac9){if(_0x512ac9){_0xa834f4=_0x512ac9;_0x551fb1[_0xd007('0x30')]=_[_0xd007('0x46')](db[_0xd007('0x4e')]['rawAttributes']);_0x551fb1[_0xd007('0x32')]=_['keys'](_0x12c66f[_0xd007('0x32')]);_0x551fb1['filters']=_['intersection'](_0x551fb1[_0xd007('0x30')],_0x551fb1[_0xd007('0x32')]);_0x3fd35d['attributes']=_['intersection'](_0x551fb1[_0xd007('0x30')],qs[_0xd007('0x36')](_0x12c66f[_0xd007('0x32')][_0xd007('0x36')]));_0x3fd35d[_0xd007('0x34')]=_0x3fd35d[_0xd007('0x34')][_0xd007('0x47')]?_0x3fd35d[_0xd007('0x34')]:_0x551fb1[_0xd007('0x30')];_0x3fd35d[_0xd007('0x38')]=qs[_0xd007('0x39')](_0x12c66f[_0xd007('0x32')][_0xd007('0x39')]);_0x3fd35d[_0xd007('0x3a')]=qs['filters'](_['pick'](_0x12c66f[_0xd007('0x32')],_0x551fb1['filters']));if(_0x12c66f[_0xd007('0x32')]['filter']){_0x3fd35d[_0xd007('0x3a')]=_[_0xd007('0x3c')](_0x3fd35d['where'],{'$or':_[_0xd007('0x31')](_0x3fd35d[_0xd007('0x34')],function(_0x4a6de8){var _0x2cbda7={};_0x2cbda7[_0x4a6de8]={'$like':'%'+_0x12c66f[_0xd007('0x32')][_0xd007('0x3f')]+'%'};return _0x2cbda7;})});}_0x3fd35d=_[_0xd007('0x3c')]({},_0x3fd35d,_0x12c66f[_0xd007('0x40')]);return _0xa834f4[_0xd007('0x4d')](_0x3fd35d);}})[_0xd007('0x26')](function(_0x30f49b){if(_0x30f49b){_0x4b5f9a=_0x30f49b[_0xd007('0x47')];if(!_0x12c66f[_0xd007('0x32')]['hasOwnProperty'](_0xd007('0x4f'))){_0x3fd35d['limit']=qs[_0xd007('0x1f')](_0x12c66f[_0xd007('0x32')][_0xd007('0x1f')]);_0x3fd35d[_0xd007('0x1d')]=qs[_0xd007('0x1d')](_0x12c66f[_0xd007('0x32')][_0xd007('0x1d')]);}return _0xa834f4[_0xd007('0x4d')](_0x3fd35d);}})[_0xd007('0x26')](function(_0x4bd1a6){if(_0x4bd1a6){return _0x4bd1a6?{'count':_0x4b5f9a,'rows':_0x4bd1a6}:null;}})[_0xd007('0x26')](respondWithResult(_0x427d2b,null))[_0xd007('0x49')](handleError(_0x427d2b,null));};exports[_0xd007('0x50')]=function(_0x144285,_0x1c388d,_0x4ce3ea){var _0x3ff914={};var _0x32223e={};var _0x5b221b;var _0xd69306;return db[_0xd007('0x2c')][_0xd007('0x51')]({'where':{'id':_0x144285[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x1c388d,null))['then'](function(_0x32bb00){if(_0x32bb00){_0x5b221b=_0x32bb00;_0x32223e[_0xd007('0x30')]=_[_0xd007('0x46')](db[_0xd007('0x4e')][_0xd007('0x2d')]);_0x32223e['query']=_[_0xd007('0x46')](_0x144285['query']);_0x32223e['filters']=_[_0xd007('0x35')](_0x32223e['model'],_0x32223e[_0xd007('0x32')]);_0x3ff914['attributes']=_[_0xd007('0x35')](_0x32223e[_0xd007('0x30')],qs['fields'](_0x144285[_0xd007('0x32')]['fields']));_0x3ff914[_0xd007('0x34')]=_0x3ff914[_0xd007('0x34')][_0xd007('0x47')]?_0x3ff914['attributes']:_0x32223e[_0xd007('0x30')];_0x3ff914[_0xd007('0x38')]=qs[_0xd007('0x39')](_0x144285[_0xd007('0x32')][_0xd007('0x39')]);_0x3ff914[_0xd007('0x3a')]=qs[_0xd007('0x33')](_[_0xd007('0x3b')](_0x144285['query'],_0x32223e[_0xd007('0x33')]));if(_0x144285['query'][_0xd007('0x3f')]){_0x3ff914['where']=_[_0xd007('0x3c')](_0x3ff914[_0xd007('0x3a')],{'$or':_[_0xd007('0x31')](_0x3ff914['attributes'],function(_0x73f633){var _0x3e9271={};_0x3e9271[_0x73f633]={'$like':'%'+_0x144285[_0xd007('0x32')][_0xd007('0x3f')]+'%'};return _0x3e9271;})});}_0x3ff914=_['merge']({},_0x3ff914,_0x144285[_0xd007('0x40')]);return _0x5b221b[_0xd007('0x50')](_0x3ff914);}})[_0xd007('0x26')](function(_0x6b829b){if(_0x6b829b){_0xd69306=_0x6b829b[_0xd007('0x47')];if(!_0x144285[_0xd007('0x32')][_0xd007('0x37')]('nolimit')){_0x3ff914[_0xd007('0x1f')]=qs[_0xd007('0x1f')](_0x144285[_0xd007('0x32')][_0xd007('0x1f')]);_0x3ff914['offset']=qs[_0xd007('0x1d')](_0x144285['query'][_0xd007('0x1d')]);}return _0x5b221b[_0xd007('0x50')](_0x3ff914);}})[_0xd007('0x26')](function(_0x1fd9fd){if(_0x1fd9fd){return _0x1fd9fd?{'count':_0xd69306,'rows':_0x1fd9fd}:null;}})['then'](respondWithResult(_0x1c388d,null))['catch'](handleError(_0x1c388d,null));};exports[_0xd007('0x52')]=function(_0x50ee0c,_0x33278f,_0x4d811d){var _0x2bfab2={};var _0x5ad6de={};var _0x30b35e;var _0x51612f;return db['ServicenowConfiguration'][_0xd007('0x51')]({'where':{'id':_0x50ee0c[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x33278f,null))['then'](function(_0x4a0395){if(_0x4a0395){_0x30b35e=_0x4a0395;_0x5ad6de[_0xd007('0x30')]=_[_0xd007('0x46')](db[_0xd007('0x4e')][_0xd007('0x2d')]);_0x5ad6de[_0xd007('0x32')]=_[_0xd007('0x46')](_0x50ee0c['query']);_0x5ad6de['filters']=_[_0xd007('0x35')](_0x5ad6de[_0xd007('0x30')],_0x5ad6de[_0xd007('0x32')]);_0x2bfab2['attributes']=_[_0xd007('0x35')](_0x5ad6de['model'],qs[_0xd007('0x36')](_0x50ee0c[_0xd007('0x32')][_0xd007('0x36')]));_0x2bfab2[_0xd007('0x34')]=_0x2bfab2[_0xd007('0x34')][_0xd007('0x47')]?_0x2bfab2[_0xd007('0x34')]:_0x5ad6de[_0xd007('0x30')];_0x2bfab2['order']=qs['sort'](_0x50ee0c[_0xd007('0x32')][_0xd007('0x39')]);_0x2bfab2[_0xd007('0x3a')]=qs['filters'](_[_0xd007('0x3b')](_0x50ee0c[_0xd007('0x32')],_0x5ad6de[_0xd007('0x33')]));if(_0x50ee0c['query'][_0xd007('0x3f')]){_0x2bfab2[_0xd007('0x3a')]=_['merge'](_0x2bfab2[_0xd007('0x3a')],{'$or':_[_0xd007('0x31')](_0x2bfab2[_0xd007('0x34')],function(_0xff1984){var _0x338069={};_0x338069[_0xff1984]={'$like':'%'+_0x50ee0c[_0xd007('0x32')][_0xd007('0x3f')]+'%'};return _0x338069;})});}_0x2bfab2=_[_0xd007('0x3c')]({},_0x2bfab2,_0x50ee0c[_0xd007('0x40')]);return _0x30b35e['getDescriptions'](_0x2bfab2);}})[_0xd007('0x26')](function(_0x1f2aaf){if(_0x1f2aaf){_0x51612f=_0x1f2aaf[_0xd007('0x47')];if(!_0x50ee0c[_0xd007('0x32')]['hasOwnProperty'](_0xd007('0x4f'))){_0x2bfab2[_0xd007('0x1f')]=qs[_0xd007('0x1f')](_0x50ee0c['query']['limit']);_0x2bfab2[_0xd007('0x1d')]=qs[_0xd007('0x1d')](_0x50ee0c[_0xd007('0x32')]['offset']);}return _0x30b35e[_0xd007('0x52')](_0x2bfab2);}})[_0xd007('0x26')](function(_0x15912b){if(_0x15912b){return _0x15912b?{'count':_0x51612f,'rows':_0x15912b}:null;}})[_0xd007('0x26')](respondWithResult(_0x33278f,null))[_0xd007('0x49')](handleError(_0x33278f,null));}; \ No newline at end of file +var _0xef6e=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','then','includeAll','include','rows','catch','params','options','find','create','body','destroy','ServicenowField','length','getFields','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','sendStatus','stack','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query'];(function(_0x30f551,_0x5cdf10){var _0x47fc6f=function(_0x569eec){while(--_0x569eec){_0x30f551['push'](_0x30f551['shift']());}};_0x47fc6f(++_0x5cdf10);}(_0xef6e,0x163));var _0xeef6=function(_0x2bfecf,_0x559042){_0x2bfecf=_0x2bfecf-0x0;var _0x38c7cd=_0xef6e[_0x2bfecf];return _0x38c7cd;};'use strict';var emlformat=require(_0xeef6('0x0'));var rimraf=require(_0xeef6('0x1'));var zipdir=require(_0xeef6('0x2'));var jsonpatch=require(_0xeef6('0x3'));var rp=require(_0xeef6('0x4'));var moment=require(_0xeef6('0x5'));var BPromise=require(_0xeef6('0x6'));var Mustache=require(_0xeef6('0x7'));var util=require('util');var path=require(_0xeef6('0x8'));var sox=require(_0xeef6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeef6('0xa'));var _=require(_0xeef6('0xb'));var squel=require(_0xeef6('0xc'));var crypto=require(_0xeef6('0xd'));var jsforce=require(_0xeef6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeef6('0xf'));var querystring=require(_0xeef6('0x10'));var Papa=require(_0xeef6('0x11'));var Redis=require(_0xeef6('0x12'));var authService=require(_0xeef6('0x13'));var qs=require(_0xeef6('0x14'));var as=require(_0xeef6('0x15'));var hardwareService=require(_0xeef6('0x16'));var logger=require(_0xeef6('0x17'))('api');var utils=require(_0xeef6('0x18'));var config=require(_0xeef6('0x19'));var licenseUtil=require(_0xeef6('0x1a'));var db=require(_0xeef6('0x1b'))['db'];function respondWithStatusCode(_0x25f0b2,_0x503b64){_0x503b64=_0x503b64||0xcc;return function(_0x2c678c){if(_0x2c678c){return _0x25f0b2['sendStatus'](_0x503b64);}return _0x25f0b2['status'](_0x503b64)[_0xeef6('0x1c')]();};}function respondWithResult(_0x13d75f,_0x9ac5ba){_0x9ac5ba=_0x9ac5ba||0xc8;return function(_0x3b995a){if(_0x3b995a){return _0x13d75f[_0xeef6('0x1d')](_0x9ac5ba)['json'](_0x3b995a);}};}function respondWithFilteredResult(_0x454790,_0x5541c4){return function(_0x41483b){if(_0x41483b){var _0x3bee8a=typeof _0x5541c4[_0xeef6('0x1e')]===_0xeef6('0x1f')&&typeof _0x5541c4[_0xeef6('0x20')]===_0xeef6('0x1f');var _0x25719e=_0x41483b[_0xeef6('0x21')];var _0x3bae63=_0x3bee8a?0x0:_0x5541c4[_0xeef6('0x1e')];var _0x5ee142=_0x3bee8a?_0x41483b['count']:_0x5541c4[_0xeef6('0x1e')]+_0x5541c4['limit'];var _0x3e0477;if(_0x5ee142>=_0x25719e){_0x5ee142=_0x25719e;_0x3e0477=0xc8;}else{_0x3e0477=0xce;}_0x454790[_0xeef6('0x1d')](_0x3e0477);return _0x454790[_0xeef6('0x22')]('Content-Range',_0x3bae63+'-'+_0x5ee142+'/'+_0x25719e)[_0xeef6('0x23')](_0x41483b);}return null;};}function patchUpdates(_0x44ba40){return function(_0x443f1a){try{jsonpatch[_0xeef6('0x24')](_0x443f1a,_0x44ba40,!![]);}catch(_0x3c9cf3){return BPromise[_0xeef6('0x25')](_0x3c9cf3);}return _0x443f1a[_0xeef6('0x26')]();};}function saveUpdates(_0x6e4a1a,_0x164928){return function(_0x22a1af){if(_0x22a1af){return _0x22a1af[_0xeef6('0x27')](_0x6e4a1a)['then'](function(_0x1fc3ad){return _0x1fc3ad;});}return null;};}function removeEntity(_0x19d4e6,_0x1df2ca){return function(_0x2b8fae){if(_0x2b8fae){return _0x2b8fae['destroy']()['then'](function(){_0x19d4e6[_0xeef6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48fe87,_0x1d2fa7){return function(_0x242118){if(!_0x242118){_0x48fe87[_0xeef6('0x28')](0x194);}return _0x242118;};}function handleError(_0x2298c1,_0x4d227e){_0x4d227e=_0x4d227e||0x1f4;return function(_0x2a2bcb){logger['error'](_0x2a2bcb[_0xeef6('0x29')]);if(_0x2a2bcb['name']){delete _0x2a2bcb['name'];}_0x2298c1[_0xeef6('0x1d')](_0x4d227e)[_0xeef6('0x2a')](_0x2a2bcb);};}exports['index']=function(_0x21a75c,_0x595fe6){var _0x38717c={},_0x132076={},_0x268ea4={'count':0x0,'rows':[]};var _0x468381=_[_0xeef6('0x2b')](db[_0xeef6('0x2c')][_0xeef6('0x2d')],function(_0x24c372){return{'name':_0x24c372[_0xeef6('0x2e')],'type':_0x24c372[_0xeef6('0x2f')]['key']};});_0x132076[_0xeef6('0x30')]=_['map'](_0x468381,'name');_0x132076[_0xeef6('0x31')]=_[_0xeef6('0x32')](_0x21a75c[_0xeef6('0x31')]);_0x132076[_0xeef6('0x33')]=_[_0xeef6('0x34')](_0x132076[_0xeef6('0x30')],_0x132076[_0xeef6('0x31')]);_0x38717c['attributes']=_[_0xeef6('0x34')](_0x132076[_0xeef6('0x30')],qs[_0xeef6('0x35')](_0x21a75c['query'][_0xeef6('0x35')]));_0x38717c['attributes']=_0x38717c[_0xeef6('0x36')]['length']?_0x38717c[_0xeef6('0x36')]:_0x132076[_0xeef6('0x30')];if(!_0x21a75c[_0xeef6('0x31')][_0xeef6('0x37')](_0xeef6('0x38'))){_0x38717c[_0xeef6('0x20')]=qs['limit'](_0x21a75c[_0xeef6('0x31')][_0xeef6('0x20')]);_0x38717c[_0xeef6('0x1e')]=qs[_0xeef6('0x1e')](_0x21a75c[_0xeef6('0x31')][_0xeef6('0x1e')]);}_0x38717c[_0xeef6('0x39')]=qs[_0xeef6('0x3a')](_0x21a75c[_0xeef6('0x31')][_0xeef6('0x3a')]);_0x38717c[_0xeef6('0x3b')]=qs['filters'](_[_0xeef6('0x3c')](_0x21a75c[_0xeef6('0x31')],_0x132076['filters']),_0x468381);if(_0x21a75c[_0xeef6('0x31')][_0xeef6('0x3d')]){_0x38717c['where']=_[_0xeef6('0x3e')](_0x38717c[_0xeef6('0x3b')],{'$or':_['map'](_0x468381,function(_0x2246fc){if(_0x2246fc[_0xeef6('0x2f')]!=='VIRTUAL'){var _0x587890={};_0x587890[_0x2246fc[_0xeef6('0x3f')]]={'$like':'%'+_0x21a75c['query'][_0xeef6('0x3d')]+'%'};return _0x587890;}})});}_0x38717c=_[_0xeef6('0x3e')]({},_0x38717c,_0x21a75c['options']);var _0x498d46={'where':_0x38717c[_0xeef6('0x3b')]};return db[_0xeef6('0x2c')][_0xeef6('0x21')](_0x498d46)[_0xeef6('0x40')](function(_0x5a30d1){_0x268ea4[_0xeef6('0x21')]=_0x5a30d1;if(_0x21a75c[_0xeef6('0x31')][_0xeef6('0x41')]){_0x38717c[_0xeef6('0x42')]=[{'all':!![]}];}return db[_0xeef6('0x2c')]['findAll'](_0x38717c);})['then'](function(_0x136bef){_0x268ea4[_0xeef6('0x43')]=_0x136bef;return _0x268ea4;})[_0xeef6('0x40')](respondWithFilteredResult(_0x595fe6,_0x38717c))[_0xeef6('0x44')](handleError(_0x595fe6,null));};exports['show']=function(_0x5bb17b,_0x3d8780){var _0x37b72e={'raw':![],'where':{'id':_0x5bb17b[_0xeef6('0x45')]['id']}},_0x499395={};_0x499395[_0xeef6('0x30')]=_[_0xeef6('0x32')](db['ServicenowConfiguration'][_0xeef6('0x2d')]);_0x499395[_0xeef6('0x31')]=_[_0xeef6('0x32')](_0x5bb17b[_0xeef6('0x31')]);_0x499395[_0xeef6('0x33')]=_[_0xeef6('0x34')](_0x499395['model'],_0x499395['query']);_0x37b72e[_0xeef6('0x36')]=_['intersection'](_0x499395['model'],qs[_0xeef6('0x35')](_0x5bb17b[_0xeef6('0x31')]['fields']));_0x37b72e[_0xeef6('0x36')]=_0x37b72e[_0xeef6('0x36')]['length']?_0x37b72e[_0xeef6('0x36')]:_0x499395['model'];if(_0x5bb17b['query'][_0xeef6('0x41')]){_0x37b72e[_0xeef6('0x42')]=[{'all':!![]}];}_0x37b72e=_[_0xeef6('0x3e')]({},_0x37b72e,_0x5bb17b[_0xeef6('0x46')]);return db[_0xeef6('0x2c')][_0xeef6('0x47')](_0x37b72e)[_0xeef6('0x40')](handleEntityNotFound(_0x3d8780,null))[_0xeef6('0x40')](respondWithResult(_0x3d8780,null))[_0xeef6('0x44')](handleError(_0x3d8780,null));};exports['create']=function(_0x34fff8,_0x2f00a9){return db[_0xeef6('0x2c')][_0xeef6('0x48')](_0x34fff8[_0xeef6('0x49')],{})[_0xeef6('0x40')](respondWithResult(_0x2f00a9,0xc9))[_0xeef6('0x44')](handleError(_0x2f00a9,null));};exports[_0xeef6('0x27')]=function(_0x5d948d,_0x2b5b1a){if(_0x5d948d[_0xeef6('0x49')]['id']){delete _0x5d948d[_0xeef6('0x49')]['id'];}return db['ServicenowConfiguration'][_0xeef6('0x47')]({'where':{'id':_0x5d948d[_0xeef6('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b5b1a,null))[_0xeef6('0x40')](saveUpdates(_0x5d948d[_0xeef6('0x49')],null))[_0xeef6('0x40')](respondWithResult(_0x2b5b1a,null))[_0xeef6('0x44')](handleError(_0x2b5b1a,null));};exports[_0xeef6('0x4a')]=function(_0x2ae5f1,_0x5a175a){return db[_0xeef6('0x2c')][_0xeef6('0x47')]({'where':{'id':_0x2ae5f1[_0xeef6('0x45')]['id']}})[_0xeef6('0x40')](handleEntityNotFound(_0x5a175a,null))[_0xeef6('0x40')](removeEntity(_0x5a175a,null))[_0xeef6('0x44')](handleError(_0x5a175a,null));};exports['getFields']=function(_0x1ab481,_0x513aa5,_0x41a554){var _0x479d92={};var _0x127260={};var _0x1d35ba;var _0x17fd47;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x1ab481[_0xeef6('0x45')]['id']}})['then'](handleEntityNotFound(_0x513aa5,null))['then'](function(_0x1a4b3e){if(_0x1a4b3e){_0x1d35ba=_0x1a4b3e;_0x127260[_0xeef6('0x30')]=_['keys'](db[_0xeef6('0x4b')][_0xeef6('0x2d')]);_0x127260[_0xeef6('0x31')]=_[_0xeef6('0x32')](_0x1ab481[_0xeef6('0x31')]);_0x127260[_0xeef6('0x33')]=_[_0xeef6('0x34')](_0x127260[_0xeef6('0x30')],_0x127260[_0xeef6('0x31')]);_0x479d92['attributes']=_[_0xeef6('0x34')](_0x127260[_0xeef6('0x30')],qs['fields'](_0x1ab481['query'][_0xeef6('0x35')]));_0x479d92[_0xeef6('0x36')]=_0x479d92[_0xeef6('0x36')][_0xeef6('0x4c')]?_0x479d92[_0xeef6('0x36')]:_0x127260[_0xeef6('0x30')];_0x479d92[_0xeef6('0x39')]=qs['sort'](_0x1ab481[_0xeef6('0x31')][_0xeef6('0x3a')]);_0x479d92[_0xeef6('0x3b')]=qs[_0xeef6('0x33')](_[_0xeef6('0x3c')](_0x1ab481[_0xeef6('0x31')],_0x127260['filters']));if(_0x1ab481[_0xeef6('0x31')][_0xeef6('0x3d')]){_0x479d92[_0xeef6('0x3b')]=_[_0xeef6('0x3e')](_0x479d92['where'],{'$or':_['map'](_0x479d92[_0xeef6('0x36')],function(_0x2c9061){var _0x25b488={};_0x25b488[_0x2c9061]={'$like':'%'+_0x1ab481[_0xeef6('0x31')]['filter']+'%'};return _0x25b488;})});}_0x479d92=_['merge']({},_0x479d92,_0x1ab481[_0xeef6('0x46')]);return _0x1d35ba[_0xeef6('0x4d')](_0x479d92);}})[_0xeef6('0x40')](function(_0x11ceb9){if(_0x11ceb9){_0x17fd47=_0x11ceb9[_0xeef6('0x4c')];if(!_0x1ab481[_0xeef6('0x31')]['hasOwnProperty'](_0xeef6('0x38'))){_0x479d92[_0xeef6('0x20')]=qs[_0xeef6('0x20')](_0x1ab481[_0xeef6('0x31')]['limit']);_0x479d92['offset']=qs[_0xeef6('0x1e')](_0x1ab481[_0xeef6('0x31')]['offset']);}return _0x1d35ba[_0xeef6('0x4d')](_0x479d92);}})[_0xeef6('0x40')](function(_0x326bed){if(_0x326bed){return _0x326bed?{'count':_0x17fd47,'rows':_0x326bed}:null;}})[_0xeef6('0x40')](respondWithResult(_0x513aa5,null))[_0xeef6('0x44')](handleError(_0x513aa5,null));};exports[_0xeef6('0x4e')]=function(_0x648d8,_0x332a5d,_0x31e252){var _0x53106e={};var _0x40f5e1={};var _0x799943;var _0x49c3b5;return db[_0xeef6('0x2c')]['findOne']({'where':{'id':_0x648d8[_0xeef6('0x45')]['id']}})['then'](handleEntityNotFound(_0x332a5d,null))[_0xeef6('0x40')](function(_0x564e7f){if(_0x564e7f){_0x799943=_0x564e7f;_0x40f5e1[_0xeef6('0x30')]=_[_0xeef6('0x32')](db['ServicenowField'][_0xeef6('0x2d')]);_0x40f5e1[_0xeef6('0x31')]=_['keys'](_0x648d8['query']);_0x40f5e1[_0xeef6('0x33')]=_[_0xeef6('0x34')](_0x40f5e1[_0xeef6('0x30')],_0x40f5e1['query']);_0x53106e[_0xeef6('0x36')]=_[_0xeef6('0x34')](_0x40f5e1[_0xeef6('0x30')],qs[_0xeef6('0x35')](_0x648d8['query']['fields']));_0x53106e['attributes']=_0x53106e[_0xeef6('0x36')][_0xeef6('0x4c')]?_0x53106e[_0xeef6('0x36')]:_0x40f5e1[_0xeef6('0x30')];_0x53106e[_0xeef6('0x39')]=qs[_0xeef6('0x3a')](_0x648d8[_0xeef6('0x31')][_0xeef6('0x3a')]);_0x53106e[_0xeef6('0x3b')]=qs[_0xeef6('0x33')](_[_0xeef6('0x3c')](_0x648d8[_0xeef6('0x31')],_0x40f5e1['filters']));if(_0x648d8[_0xeef6('0x31')][_0xeef6('0x3d')]){_0x53106e[_0xeef6('0x3b')]=_['merge'](_0x53106e['where'],{'$or':_['map'](_0x53106e[_0xeef6('0x36')],function(_0x884f9e){var _0x153c9e={};_0x153c9e[_0x884f9e]={'$like':'%'+_0x648d8['query'][_0xeef6('0x3d')]+'%'};return _0x153c9e;})});}_0x53106e=_[_0xeef6('0x3e')]({},_0x53106e,_0x648d8[_0xeef6('0x46')]);return _0x799943[_0xeef6('0x4e')](_0x53106e);}})[_0xeef6('0x40')](function(_0x45c9e0){if(_0x45c9e0){_0x49c3b5=_0x45c9e0[_0xeef6('0x4c')];if(!_0x648d8[_0xeef6('0x31')][_0xeef6('0x37')](_0xeef6('0x38'))){_0x53106e[_0xeef6('0x20')]=qs['limit'](_0x648d8[_0xeef6('0x31')][_0xeef6('0x20')]);_0x53106e[_0xeef6('0x1e')]=qs[_0xeef6('0x1e')](_0x648d8[_0xeef6('0x31')][_0xeef6('0x1e')]);}return _0x799943[_0xeef6('0x4e')](_0x53106e);}})[_0xeef6('0x40')](function(_0x18f44c){if(_0x18f44c){return _0x18f44c?{'count':_0x49c3b5,'rows':_0x18f44c}:null;}})['then'](respondWithResult(_0x332a5d,null))[_0xeef6('0x44')](handleError(_0x332a5d,null));};exports[_0xeef6('0x4f')]=function(_0x2a032e,_0x33ce2c,_0x1cdea6){var _0x39c3a4={};var _0x1bcf9e={};var _0x4f471c;var _0x44a7db;return db[_0xeef6('0x2c')][_0xeef6('0x50')]({'where':{'id':_0x2a032e[_0xeef6('0x45')]['id']}})[_0xeef6('0x40')](handleEntityNotFound(_0x33ce2c,null))[_0xeef6('0x40')](function(_0x1c4b03){if(_0x1c4b03){_0x4f471c=_0x1c4b03;_0x1bcf9e[_0xeef6('0x30')]=_[_0xeef6('0x32')](db[_0xeef6('0x4b')][_0xeef6('0x2d')]);_0x1bcf9e[_0xeef6('0x31')]=_['keys'](_0x2a032e[_0xeef6('0x31')]);_0x1bcf9e[_0xeef6('0x33')]=_['intersection'](_0x1bcf9e[_0xeef6('0x30')],_0x1bcf9e[_0xeef6('0x31')]);_0x39c3a4[_0xeef6('0x36')]=_[_0xeef6('0x34')](_0x1bcf9e[_0xeef6('0x30')],qs[_0xeef6('0x35')](_0x2a032e[_0xeef6('0x31')][_0xeef6('0x35')]));_0x39c3a4[_0xeef6('0x36')]=_0x39c3a4[_0xeef6('0x36')][_0xeef6('0x4c')]?_0x39c3a4[_0xeef6('0x36')]:_0x1bcf9e[_0xeef6('0x30')];_0x39c3a4[_0xeef6('0x39')]=qs[_0xeef6('0x3a')](_0x2a032e[_0xeef6('0x31')][_0xeef6('0x3a')]);_0x39c3a4[_0xeef6('0x3b')]=qs[_0xeef6('0x33')](_[_0xeef6('0x3c')](_0x2a032e[_0xeef6('0x31')],_0x1bcf9e[_0xeef6('0x33')]));if(_0x2a032e[_0xeef6('0x31')][_0xeef6('0x3d')]){_0x39c3a4[_0xeef6('0x3b')]=_[_0xeef6('0x3e')](_0x39c3a4[_0xeef6('0x3b')],{'$or':_[_0xeef6('0x2b')](_0x39c3a4[_0xeef6('0x36')],function(_0x2d1449){var _0x5dacd5={};_0x5dacd5[_0x2d1449]={'$like':'%'+_0x2a032e[_0xeef6('0x31')][_0xeef6('0x3d')]+'%'};return _0x5dacd5;})});}_0x39c3a4=_[_0xeef6('0x3e')]({},_0x39c3a4,_0x2a032e[_0xeef6('0x46')]);return _0x4f471c[_0xeef6('0x4f')](_0x39c3a4);}})[_0xeef6('0x40')](function(_0x5312ff){if(_0x5312ff){_0x44a7db=_0x5312ff['length'];if(!_0x2a032e['query'][_0xeef6('0x37')](_0xeef6('0x38'))){_0x39c3a4[_0xeef6('0x20')]=qs[_0xeef6('0x20')](_0x2a032e[_0xeef6('0x31')][_0xeef6('0x20')]);_0x39c3a4[_0xeef6('0x1e')]=qs[_0xeef6('0x1e')](_0x2a032e[_0xeef6('0x31')][_0xeef6('0x1e')]);}return _0x4f471c['getDescriptions'](_0x39c3a4);}})['then'](function(_0x1e064c){if(_0x1e064c){return _0x1e064c?{'count':_0x44a7db,'rows':_0x1e064c}:null;}})['then'](respondWithResult(_0x33ce2c,null))[_0xeef6('0x44')](handleError(_0x33ce2c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e630d74..af60aac 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6947=['./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0xc0f436,_0x21631f){var _0x51bddf=function(_0xc28b7f){while(--_0xc28b7f){_0xc0f436['push'](_0xc0f436['shift']());}};_0x51bddf(++_0x21631f);}(_0x6947,0x72));var _0x7694=function(_0x118e3b,_0x30f6ba){_0x118e3b=_0x118e3b-0x0;var _0x23f353=_0x6947[_0x118e3b];return _0x23f353;};'use strict';var _=require('lodash');var util=require(_0x7694('0x0'));var logger=require('../../config/logger')(_0x7694('0x1'));var moment=require(_0x7694('0x2'));var BPromise=require(_0x7694('0x3'));var rp=require(_0x7694('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7694('0x5'));var attributes=require(_0x7694('0x6'));module[_0x7694('0x7')]=function(_0x5730,_0x36776b){return _0x5730[_0x7694('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x7694('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3176=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','api'];(function(_0x26f84f,_0x1c6414){var _0x2f5967=function(_0x596cdc){while(--_0x596cdc){_0x26f84f['push'](_0x26f84f['shift']());}};_0x2f5967(++_0x1c6414);}(_0x3176,0x1d8));var _0x6317=function(_0x4b8165,_0x44f3a4){_0x4b8165=_0x4b8165-0x0;var _0x35cc5c=_0x3176[_0x4b8165];return _0x35cc5c;};'use strict';var _=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var logger=require(_0x6317('0x2'))(_0x6317('0x3'));var moment=require(_0x6317('0x4'));var BPromise=require(_0x6317('0x5'));var rp=require(_0x6317('0x6'));var fs=require('fs');var path=require(_0x6317('0x7'));var rimraf=require(_0x6317('0x8'));var config=require(_0x6317('0x9'));var attributes=require(_0x6317('0xa'));module[_0x6317('0xb')]=function(_0x46f4c9,_0x354521){return _0x46f4c9[_0x6317('0xc')](_0x6317('0xd'),attributes,{'tableName':'int_servicenow_configurations','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 1d273b8..de6854c 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 _0x3e94=['rpc','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x372469,_0x2c19d5){var _0x53c16f=function(_0x3f1417){while(--_0x3f1417){_0x372469['push'](_0x372469['shift']());}};_0x53c16f(++_0x2c19d5);}(_0x3e94,0x67));var _0x43e9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3e94[_0x432682];return _0x463d05;};'use strict';var _=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var moment=require('moment');var BPromise=require(_0x43e9('0x2'));var rs=require(_0x43e9('0x3'));var fs=require('fs');var Redis=require(_0x43e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e9('0x5'));var logger=require(_0x43e9('0x6'))(_0x43e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x43e9('0x8'));var client=jayson['client'][_0x43e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b35f1,_0x1183a0,_0x2989fe){return new BPromise(function(_0x287aaf,_0x510ee7){return client[_0x43e9('0xa')](_0x4b35f1,_0x2989fe)[_0x43e9('0xb')](function(_0x43d6e8){logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));logger[_0x43e9('0xf')](_0x43e9('0x10'),_0x1183a0,_0x43e9('0xe'),JSON['stringify'](_0x43d6e8));if(_0x43d6e8[_0x43e9('0x11')]){if(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x12')]===0x1f4){logger['error'](_0x43e9('0xd'),_0x1183a0,_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);return _0x510ee7(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1183a0,_0x43d6e8[_0x43e9('0x11')]['message']);return _0x287aaf(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}else{logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));_0x287aaf(_0x43d6e8[_0x43e9('0x14')][_0x43e9('0x13')]);}})[_0x43e9('0x15')](function(_0x3f7164){logger[_0x43e9('0x11')](_0x43e9('0xd'),_0x1183a0,_0x3f7164);_0x510ee7(_0x3f7164);});});} \ No newline at end of file +var _0x3ddc=['stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x1c36b3,_0x26d4cd){var _0x329667=function(_0x1a233d){while(--_0x1a233d){_0x1c36b3['push'](_0x1c36b3['shift']());}};_0x329667(++_0x26d4cd);}(_0x3ddc,0x196));var _0xc3dd=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3ddc[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xc3dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc3dd('0x1'));var rs=require(_0xc3dd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3dd('0x3'))['db'];var utils=require(_0xc3dd('0x4'));var logger=require(_0xc3dd('0x5'))(_0xc3dd('0x6'));var config=require(_0xc3dd('0x7'));var jayson=require(_0xc3dd('0x8'));var client=jayson['client'][_0xc3dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ffdb7,_0x15a827,_0x4eb746){return new BPromise(function(_0x30921e,_0xae8358){return client[_0xc3dd('0xa')](_0x1ffdb7,_0x4eb746)[_0xc3dd('0xb')](function(_0x823574){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x15a827,_0xc3dd('0xc'));logger[_0xc3dd('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x15a827,_0xc3dd('0xc'),JSON[_0xc3dd('0xe')](_0x823574));if(_0x823574[_0xc3dd('0xf')]){if(_0x823574['error'][_0xc3dd('0x10')]===0x1f4){logger[_0xc3dd('0xf')](_0xc3dd('0x11'),_0x15a827,_0x823574['error'][_0xc3dd('0x12')]);return _0xae8358(_0x823574['error'][_0xc3dd('0x12')]);}logger[_0xc3dd('0xf')](_0xc3dd('0x11'),_0x15a827,_0x823574['error'][_0xc3dd('0x12')]);return _0x30921e(_0x823574[_0xc3dd('0xf')]['message']);}else{logger['info'](_0xc3dd('0x11'),_0x15a827,_0xc3dd('0xc'));_0x30921e(_0x823574[_0xc3dd('0x13')][_0xc3dd('0x12')]);}})[_0xc3dd('0x14')](function(_0x51b0af){logger[_0xc3dd('0xf')](_0xc3dd('0x11'),_0x15a827,_0x51b0af);_0xae8358(_0x51b0af);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index ce21606..4f0fbf4 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 _0x1209=['/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x397004,_0x7949f){var _0xa7a10=function(_0x377854){while(--_0x377854){_0x397004['push'](_0x397004['shift']());}};_0xa7a10(++_0x7949f);}(_0x1209,0x1bf));var _0x9120=function(_0x41062b,_0x308726){_0x41062b=_0x41062b-0x0;var _0x148fb4=_0x1209[_0x41062b];return _0x148fb4;};'use strict';var multer=require(_0x9120('0x0'));var util=require(_0x9120('0x1'));var path=require('path');var timeout=require(_0x9120('0x2'));var express=require(_0x9120('0x3'));var router=express[_0x9120('0x4')]();var fs_extra=require(_0x9120('0x5'));var auth=require(_0x9120('0x6'));var interaction=require(_0x9120('0x7'));var config=require(_0x9120('0x8'));var controller=require(_0x9120('0x9'));router[_0x9120('0xa')]('/',auth[_0x9120('0xb')](),controller[_0x9120('0xc')]);router['get'](_0x9120('0xd'),auth['isAuthenticated'](),controller[_0x9120('0xe')]);router[_0x9120('0xf')]('/',auth[_0x9120('0xb')](),controller['create']);router[_0x9120('0x10')](_0x9120('0xd'),auth[_0x9120('0xb')](),controller[_0x9120('0x11')]);router['delete'](_0x9120('0xd'),auth['isAuthenticated'](),controller[_0x9120('0x12')]);module[_0x9120('0x13')]=router; \ No newline at end of file +var _0xdfae=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfae,0x1cf));var _0xedfa=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xdfae[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xedfa('0x0'));var util=require(_0xedfa('0x1'));var path=require(_0xedfa('0x2'));var timeout=require('connect-timeout');var express=require(_0xedfa('0x3'));var router=express[_0xedfa('0x4')]();var fs_extra=require(_0xedfa('0x5'));var auth=require(_0xedfa('0x6'));var interaction=require(_0xedfa('0x7'));var config=require(_0xedfa('0x8'));var controller=require(_0xedfa('0x9'));router[_0xedfa('0xa')]('/',auth[_0xedfa('0xb')](),controller['index']);router[_0xedfa('0xa')]('/:id',auth[_0xedfa('0xb')](),controller[_0xedfa('0xc')]);router[_0xedfa('0xd')]('/',auth[_0xedfa('0xb')](),controller[_0xedfa('0xe')]);router[_0xedfa('0xf')]('/:id',auth[_0xedfa('0xb')](),controller[_0xedfa('0x10')]);router[_0xedfa('0x11')](_0xedfa('0x12'),auth[_0xedfa('0xb')](),controller[_0xedfa('0x13')]);module[_0xedfa('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index fa5650d..5b8f893 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 _0x47ca=['STRING','variable','BOOLEAN','exports','ENUM','customVariable','string'];(function(_0x59842e,_0x2f6e2b){var _0x3e2605=function(_0x3c53d5){while(--_0x3c53d5){_0x59842e['push'](_0x59842e['shift']());}};_0x3e2605(++_0x2f6e2b);}(_0x47ca,0x16f));var _0xa47c=function(_0x441d1e,_0x53d0ed){_0x441d1e=_0x441d1e-0x0;var _0x27e8ea=_0x47ca[_0x441d1e];return _0x27e8ea;};'use strict';var Sequelize=require('sequelize');module[_0xa47c('0x0')]={'type':{'type':Sequelize[_0xa47c('0x1')]('string','variable',_0xa47c('0x2'),'keyValue','picklist'),'defaultValue':_0xa47c('0x3')},'content':{'type':Sequelize[_0xa47c('0x4')]},'key':{'type':Sequelize[_0xa47c('0x4')]},'keyType':{'type':Sequelize[_0xa47c('0x1')]('string',_0xa47c('0x5'),_0xa47c('0x2'))},'keyContent':{'type':Sequelize[_0xa47c('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa47c('0x4')]},'customField':{'type':Sequelize[_0xa47c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa47c('0x4')]}}; \ No newline at end of file +var _0xeb25=['ENUM','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN','exports'];(function(_0x5a2f3a,_0x4de4f2){var _0xa430f=function(_0x385508){while(--_0x385508){_0x5a2f3a['push'](_0x5a2f3a['shift']());}};_0xa430f(++_0x4de4f2);}(_0xeb25,0x1dc));var _0x5eb2=function(_0x5f16ad,_0x235dd4){_0x5f16ad=_0x5f16ad-0x0;var _0x10af24=_0xeb25[_0x5f16ad];return _0x10af24;};'use strict';var Sequelize=require('sequelize');module[_0x5eb2('0x0')]={'type':{'type':Sequelize[_0x5eb2('0x1')]('string',_0x5eb2('0x2'),_0x5eb2('0x3'),_0x5eb2('0x4'),_0x5eb2('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5eb2('0x6')]},'keyType':{'type':Sequelize[_0x5eb2('0x1')](_0x5eb2('0x7'),_0x5eb2('0x2'),_0x5eb2('0x3'))},'keyContent':{'type':Sequelize[_0x5eb2('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5eb2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 196ff73..0f64f5a 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 _0xe348=['show','length','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','map','ServicenowField','key','model','keys','filters','intersection','attributes','query','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe348,0xcd));var _0x8e34=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xe348[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e34('0x0'));var zipdir=require(_0x8e34('0x1'));var jsonpatch=require(_0x8e34('0x2'));var rp=require(_0x8e34('0x3'));var moment=require('moment');var BPromise=require(_0x8e34('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8e34('0x5'));var sox=require(_0x8e34('0x6'));var csv=require(_0x8e34('0x7'));var ejs=require(_0x8e34('0x8'));var fs=require('fs');var fs_extra=require(_0x8e34('0x9'));var _=require(_0x8e34('0xa'));var squel=require(_0x8e34('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e34('0x7'));var querystring=require(_0x8e34('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e34('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e34('0xe'));var logger=require(_0x8e34('0xf'))(_0x8e34('0x10'));var utils=require('../../config/utils');var config=require(_0x8e34('0x11'));var licenseUtil=require(_0x8e34('0x12'));var db=require(_0x8e34('0x13'))['db'];function respondWithStatusCode(_0x3b6d12,_0x2870cc){_0x2870cc=_0x2870cc||0xcc;return function(_0x5bdb32){if(_0x5bdb32){return _0x3b6d12[_0x8e34('0x14')](_0x2870cc);}return _0x3b6d12['status'](_0x2870cc)[_0x8e34('0x15')]();};}function respondWithResult(_0x105da,_0x5922fc){_0x5922fc=_0x5922fc||0xc8;return function(_0x572df9){if(_0x572df9){return _0x105da[_0x8e34('0x16')](_0x5922fc)['json'](_0x572df9);}};}function respondWithFilteredResult(_0x1f593f,_0x393807){return function(_0x54c9a3){if(_0x54c9a3){var _0x49e865=typeof _0x393807[_0x8e34('0x17')]===_0x8e34('0x18')&&typeof _0x393807[_0x8e34('0x19')]===_0x8e34('0x18');var _0x149074=_0x54c9a3['count'];var _0x56a5f7=_0x49e865?0x0:_0x393807[_0x8e34('0x17')];var _0x3e553d=_0x49e865?_0x54c9a3[_0x8e34('0x1a')]:_0x393807[_0x8e34('0x17')]+_0x393807[_0x8e34('0x19')];var _0x43d7e1;if(_0x3e553d>=_0x149074){_0x3e553d=_0x149074;_0x43d7e1=0xc8;}else{_0x43d7e1=0xce;}_0x1f593f[_0x8e34('0x16')](_0x43d7e1);return _0x1f593f['set'](_0x8e34('0x1b'),_0x56a5f7+'-'+_0x3e553d+'/'+_0x149074)['json'](_0x54c9a3);}return null;};}function patchUpdates(_0x48e781){return function(_0x24cd1c){try{jsonpatch['apply'](_0x24cd1c,_0x48e781,!![]);}catch(_0x2883ba){return BPromise['reject'](_0x2883ba);}return _0x24cd1c[_0x8e34('0x1c')]();};}function saveUpdates(_0x19814a,_0x51cfb0){return function(_0x26ae79){if(_0x26ae79){return _0x26ae79[_0x8e34('0x1d')](_0x19814a)[_0x8e34('0x1e')](function(_0x180fdb){return _0x180fdb;});}return null;};}function removeEntity(_0x1ef2aa,_0xefa564){return function(_0x336470){if(_0x336470){return _0x336470[_0x8e34('0x1f')]()[_0x8e34('0x1e')](function(){_0x1ef2aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d25c7,_0x2f460a){return function(_0x11c50f){if(!_0x11c50f){_0x2d25c7[_0x8e34('0x14')](0x194);}return _0x11c50f;};}function handleError(_0x3009af,_0x85c907){_0x85c907=_0x85c907||0x1f4;return function(_0xe0613){logger[_0x8e34('0x20')](_0xe0613[_0x8e34('0x21')]);if(_0xe0613[_0x8e34('0x22')]){delete _0xe0613[_0x8e34('0x22')];}_0x3009af['status'](_0x85c907)[_0x8e34('0x23')](_0xe0613);};}exports['index']=function(_0x3c64dd,_0x1e035e){var _0x2568de={},_0x812d60={},_0x5d752c={'count':0x0,'rows':[]};var _0x404eca=_[_0x8e34('0x24')](db[_0x8e34('0x25')]['rawAttributes'],function(_0x2aa315){return{'name':_0x2aa315['fieldName'],'type':_0x2aa315['type'][_0x8e34('0x26')]};});_0x812d60[_0x8e34('0x27')]=_[_0x8e34('0x24')](_0x404eca,'name');_0x812d60['query']=_[_0x8e34('0x28')](_0x3c64dd['query']);_0x812d60[_0x8e34('0x29')]=_[_0x8e34('0x2a')](_0x812d60['model'],_0x812d60['query']);_0x2568de[_0x8e34('0x2b')]=_[_0x8e34('0x2a')](_0x812d60['model'],qs['fields'](_0x3c64dd[_0x8e34('0x2c')][_0x8e34('0x2d')]));_0x2568de[_0x8e34('0x2b')]=_0x2568de[_0x8e34('0x2b')]['length']?_0x2568de[_0x8e34('0x2b')]:_0x812d60[_0x8e34('0x27')];if(!_0x3c64dd[_0x8e34('0x2c')][_0x8e34('0x2e')](_0x8e34('0x2f'))){_0x2568de[_0x8e34('0x19')]=qs['limit'](_0x3c64dd[_0x8e34('0x2c')]['limit']);_0x2568de[_0x8e34('0x17')]=qs[_0x8e34('0x17')](_0x3c64dd[_0x8e34('0x2c')][_0x8e34('0x17')]);}_0x2568de['order']=qs[_0x8e34('0x30')](_0x3c64dd['query'][_0x8e34('0x30')]);_0x2568de['where']=qs[_0x8e34('0x29')](_[_0x8e34('0x31')](_0x3c64dd['query'],_0x812d60[_0x8e34('0x29')]),_0x404eca);if(_0x3c64dd[_0x8e34('0x2c')]['filter']){_0x2568de[_0x8e34('0x32')]=_[_0x8e34('0x33')](_0x2568de[_0x8e34('0x32')],{'$or':_['map'](_0x404eca,function(_0x58985e){if(_0x58985e['type']!==_0x8e34('0x34')){var _0x1e930f={};_0x1e930f[_0x58985e[_0x8e34('0x22')]]={'$like':'%'+_0x3c64dd[_0x8e34('0x2c')][_0x8e34('0x35')]+'%'};return _0x1e930f;}})});}_0x2568de=_['merge']({},_0x2568de,_0x3c64dd[_0x8e34('0x36')]);var _0x44c303={'where':_0x2568de[_0x8e34('0x32')]};return db[_0x8e34('0x25')][_0x8e34('0x1a')](_0x44c303)[_0x8e34('0x1e')](function(_0x37093e){_0x5d752c['count']=_0x37093e;if(_0x3c64dd[_0x8e34('0x2c')]['includeAll']){_0x2568de[_0x8e34('0x37')]=[{'all':!![]}];}return db['ServicenowField'][_0x8e34('0x38')](_0x2568de);})['then'](function(_0x2a2a47){_0x5d752c[_0x8e34('0x39')]=_0x2a2a47;return _0x5d752c;})['then'](respondWithFilteredResult(_0x1e035e,_0x2568de))[_0x8e34('0x3a')](handleError(_0x1e035e,null));};exports[_0x8e34('0x3b')]=function(_0x57f032,_0xed95a){var _0x3215e1={'raw':!![],'where':{'id':_0x57f032['params']['id']}},_0x3c4b17={};_0x3c4b17['model']=_[_0x8e34('0x28')](db['ServicenowField']['rawAttributes']);_0x3c4b17['query']=_[_0x8e34('0x28')](_0x57f032[_0x8e34('0x2c')]);_0x3c4b17['filters']=_[_0x8e34('0x2a')](_0x3c4b17[_0x8e34('0x27')],_0x3c4b17[_0x8e34('0x2c')]);_0x3215e1[_0x8e34('0x2b')]=_[_0x8e34('0x2a')](_0x3c4b17[_0x8e34('0x27')],qs[_0x8e34('0x2d')](_0x57f032[_0x8e34('0x2c')][_0x8e34('0x2d')]));_0x3215e1[_0x8e34('0x2b')]=_0x3215e1[_0x8e34('0x2b')][_0x8e34('0x3c')]?_0x3215e1['attributes']:_0x3c4b17[_0x8e34('0x27')];if(_0x57f032[_0x8e34('0x2c')][_0x8e34('0x3d')]){_0x3215e1[_0x8e34('0x37')]=[{'all':!![]}];}_0x3215e1=_[_0x8e34('0x33')]({},_0x3215e1,_0x57f032[_0x8e34('0x36')]);return db[_0x8e34('0x25')][_0x8e34('0x3e')](_0x3215e1)[_0x8e34('0x1e')](handleEntityNotFound(_0xed95a,null))[_0x8e34('0x1e')](respondWithResult(_0xed95a,null))[_0x8e34('0x3a')](handleError(_0xed95a,null));};exports[_0x8e34('0x3f')]=function(_0x4294de,_0x5a1fb4){return db[_0x8e34('0x25')][_0x8e34('0x3f')](_0x4294de[_0x8e34('0x40')],{})[_0x8e34('0x1e')](respondWithResult(_0x5a1fb4,0xc9))[_0x8e34('0x3a')](handleError(_0x5a1fb4,null));};exports[_0x8e34('0x1d')]=function(_0x413668,_0x491f4){if(_0x413668[_0x8e34('0x40')]['id']){delete _0x413668[_0x8e34('0x40')]['id'];}return db[_0x8e34('0x25')][_0x8e34('0x3e')]({'where':{'id':_0x413668[_0x8e34('0x41')]['id']}})[_0x8e34('0x1e')](handleEntityNotFound(_0x491f4,null))['then'](saveUpdates(_0x413668[_0x8e34('0x40')],null))[_0x8e34('0x1e')](respondWithResult(_0x491f4,null))['catch'](handleError(_0x491f4,null));};exports[_0x8e34('0x1f')]=function(_0x215b24,_0x598e83){return db[_0x8e34('0x25')][_0x8e34('0x3e')]({'where':{'id':_0x215b24[_0x8e34('0x41')]['id']}})[_0x8e34('0x1e')](handleEntityNotFound(_0x598e83,null))[_0x8e34('0x1e')](removeEntity(_0x598e83,null))[_0x8e34('0x3a')](handleError(_0x598e83,null));}; \ No newline at end of file +var _0x07fb=['zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ServicenowField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','eml-format'];(function(_0x4aa6f3,_0x447f86){var _0x394df5=function(_0x55796b){while(--_0x55796b){_0x4aa6f3['push'](_0x4aa6f3['shift']());}};_0x394df5(++_0x447f86);}(_0x07fb,0x1bb));var _0xb07f=function(_0x76dd6e,_0x14dd80){_0x76dd6e=_0x76dd6e-0x0;var _0x35fb11=_0x07fb[_0x76dd6e];return _0x35fb11;};'use strict';var emlformat=require(_0xb07f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb07f('0x1'));var jsonpatch=require(_0xb07f('0x2'));var rp=require(_0xb07f('0x3'));var moment=require('moment');var BPromise=require(_0xb07f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb07f('0x5'));var sox=require(_0xb07f('0x6'));var csv=require(_0xb07f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb07f('0x8'));var squel=require(_0xb07f('0x9'));var crypto=require(_0xb07f('0xa'));var jsforce=require(_0xb07f('0xb'));var deskjs=require(_0xb07f('0xc'));var toCsv=require(_0xb07f('0x7'));var querystring=require(_0xb07f('0xd'));var Papa=require(_0xb07f('0xe'));var Redis=require(_0xb07f('0xf'));var authService=require(_0xb07f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb07f('0x11'));var hardwareService=require(_0xb07f('0x12'));var logger=require(_0xb07f('0x13'))('api');var utils=require(_0xb07f('0x14'));var config=require(_0xb07f('0x15'));var licenseUtil=require(_0xb07f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe768aa,_0x25192f){_0x25192f=_0x25192f||0xcc;return function(_0x527c54){if(_0x527c54){return _0xe768aa[_0xb07f('0x17')](_0x25192f);}return _0xe768aa[_0xb07f('0x18')](_0x25192f)[_0xb07f('0x19')]();};}function respondWithResult(_0x42e82e,_0x19b8df){_0x19b8df=_0x19b8df||0xc8;return function(_0x81d194){if(_0x81d194){return _0x42e82e['status'](_0x19b8df)[_0xb07f('0x1a')](_0x81d194);}};}function respondWithFilteredResult(_0x26dc93,_0x140ec9){return function(_0x1a1722){if(_0x1a1722){var _0x2bf2a8=typeof _0x140ec9[_0xb07f('0x1b')]===_0xb07f('0x1c')&&typeof _0x140ec9[_0xb07f('0x1d')]===_0xb07f('0x1c');var _0x1f24e7=_0x1a1722[_0xb07f('0x1e')];var _0x5e0eaa=_0x2bf2a8?0x0:_0x140ec9[_0xb07f('0x1b')];var _0x39e7f9=_0x2bf2a8?_0x1a1722[_0xb07f('0x1e')]:_0x140ec9[_0xb07f('0x1b')]+_0x140ec9['limit'];var _0x563ef3;if(_0x39e7f9>=_0x1f24e7){_0x39e7f9=_0x1f24e7;_0x563ef3=0xc8;}else{_0x563ef3=0xce;}_0x26dc93[_0xb07f('0x18')](_0x563ef3);return _0x26dc93[_0xb07f('0x1f')](_0xb07f('0x20'),_0x5e0eaa+'-'+_0x39e7f9+'/'+_0x1f24e7)[_0xb07f('0x1a')](_0x1a1722);}return null;};}function patchUpdates(_0x235178){return function(_0x56f3fb){try{jsonpatch[_0xb07f('0x21')](_0x56f3fb,_0x235178,!![]);}catch(_0x34e2e9){return BPromise[_0xb07f('0x22')](_0x34e2e9);}return _0x56f3fb[_0xb07f('0x23')]();};}function saveUpdates(_0x1f6a8c,_0x29dd26){return function(_0x5e51c7){if(_0x5e51c7){return _0x5e51c7[_0xb07f('0x24')](_0x1f6a8c)[_0xb07f('0x25')](function(_0x55d452){return _0x55d452;});}return null;};}function removeEntity(_0xc090fa,_0x4ed193){return function(_0x265a5f){if(_0x265a5f){return _0x265a5f[_0xb07f('0x26')]()[_0xb07f('0x25')](function(){_0xc090fa[_0xb07f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bd24e,_0x2a3fa2){return function(_0x4631b0){if(!_0x4631b0){_0x3bd24e[_0xb07f('0x17')](0x194);}return _0x4631b0;};}function handleError(_0x305090,_0x3d97c2){_0x3d97c2=_0x3d97c2||0x1f4;return function(_0x2ee5cb){logger['error'](_0x2ee5cb['stack']);if(_0x2ee5cb['name']){delete _0x2ee5cb[_0xb07f('0x27')];}_0x305090[_0xb07f('0x18')](_0x3d97c2)[_0xb07f('0x28')](_0x2ee5cb);};}exports[_0xb07f('0x29')]=function(_0x4c4c3d,_0x2bcad1){var _0x5ec54f={},_0x5652fc={},_0x4fcbca={'count':0x0,'rows':[]};var _0x3ee1ba=_[_0xb07f('0x2a')](db[_0xb07f('0x2b')]['rawAttributes'],function(_0x3086be){return{'name':_0x3086be[_0xb07f('0x2c')],'type':_0x3086be[_0xb07f('0x2d')]['key']};});_0x5652fc[_0xb07f('0x2e')]=_[_0xb07f('0x2a')](_0x3ee1ba,_0xb07f('0x27'));_0x5652fc[_0xb07f('0x2f')]=_[_0xb07f('0x30')](_0x4c4c3d[_0xb07f('0x2f')]);_0x5652fc[_0xb07f('0x31')]=_[_0xb07f('0x32')](_0x5652fc[_0xb07f('0x2e')],_0x5652fc[_0xb07f('0x2f')]);_0x5ec54f[_0xb07f('0x33')]=_['intersection'](_0x5652fc[_0xb07f('0x2e')],qs[_0xb07f('0x34')](_0x4c4c3d[_0xb07f('0x2f')][_0xb07f('0x34')]));_0x5ec54f[_0xb07f('0x33')]=_0x5ec54f['attributes'][_0xb07f('0x35')]?_0x5ec54f[_0xb07f('0x33')]:_0x5652fc[_0xb07f('0x2e')];if(!_0x4c4c3d['query'][_0xb07f('0x36')](_0xb07f('0x37'))){_0x5ec54f[_0xb07f('0x1d')]=qs[_0xb07f('0x1d')](_0x4c4c3d[_0xb07f('0x2f')][_0xb07f('0x1d')]);_0x5ec54f[_0xb07f('0x1b')]=qs[_0xb07f('0x1b')](_0x4c4c3d[_0xb07f('0x2f')][_0xb07f('0x1b')]);}_0x5ec54f[_0xb07f('0x38')]=qs[_0xb07f('0x39')](_0x4c4c3d[_0xb07f('0x2f')]['sort']);_0x5ec54f[_0xb07f('0x3a')]=qs[_0xb07f('0x31')](_[_0xb07f('0x3b')](_0x4c4c3d[_0xb07f('0x2f')],_0x5652fc[_0xb07f('0x31')]),_0x3ee1ba);if(_0x4c4c3d[_0xb07f('0x2f')][_0xb07f('0x3c')]){_0x5ec54f[_0xb07f('0x3a')]=_[_0xb07f('0x3d')](_0x5ec54f[_0xb07f('0x3a')],{'$or':_['map'](_0x3ee1ba,function(_0x14347d){if(_0x14347d[_0xb07f('0x2d')]!==_0xb07f('0x3e')){var _0x94d3c1={};_0x94d3c1[_0x14347d['name']]={'$like':'%'+_0x4c4c3d[_0xb07f('0x2f')][_0xb07f('0x3c')]+'%'};return _0x94d3c1;}})});}_0x5ec54f=_[_0xb07f('0x3d')]({},_0x5ec54f,_0x4c4c3d[_0xb07f('0x3f')]);var _0x52f7ac={'where':_0x5ec54f[_0xb07f('0x3a')]};return db[_0xb07f('0x2b')][_0xb07f('0x1e')](_0x52f7ac)[_0xb07f('0x25')](function(_0x431794){_0x4fcbca[_0xb07f('0x1e')]=_0x431794;if(_0x4c4c3d[_0xb07f('0x2f')][_0xb07f('0x40')]){_0x5ec54f[_0xb07f('0x41')]=[{'all':!![]}];}return db[_0xb07f('0x2b')][_0xb07f('0x42')](_0x5ec54f);})[_0xb07f('0x25')](function(_0x1220e6){_0x4fcbca[_0xb07f('0x43')]=_0x1220e6;return _0x4fcbca;})['then'](respondWithFilteredResult(_0x2bcad1,_0x5ec54f))[_0xb07f('0x44')](handleError(_0x2bcad1,null));};exports[_0xb07f('0x45')]=function(_0x1cef04,_0xb262e5){var _0x59f658={'raw':!![],'where':{'id':_0x1cef04[_0xb07f('0x46')]['id']}},_0xd02468={};_0xd02468[_0xb07f('0x2e')]=_[_0xb07f('0x30')](db[_0xb07f('0x2b')][_0xb07f('0x47')]);_0xd02468['query']=_[_0xb07f('0x30')](_0x1cef04[_0xb07f('0x2f')]);_0xd02468[_0xb07f('0x31')]=_[_0xb07f('0x32')](_0xd02468[_0xb07f('0x2e')],_0xd02468[_0xb07f('0x2f')]);_0x59f658[_0xb07f('0x33')]=_['intersection'](_0xd02468['model'],qs[_0xb07f('0x34')](_0x1cef04[_0xb07f('0x2f')]['fields']));_0x59f658['attributes']=_0x59f658['attributes'][_0xb07f('0x35')]?_0x59f658[_0xb07f('0x33')]:_0xd02468['model'];if(_0x1cef04[_0xb07f('0x2f')][_0xb07f('0x40')]){_0x59f658['include']=[{'all':!![]}];}_0x59f658=_[_0xb07f('0x3d')]({},_0x59f658,_0x1cef04[_0xb07f('0x3f')]);return db[_0xb07f('0x2b')][_0xb07f('0x48')](_0x59f658)['then'](handleEntityNotFound(_0xb262e5,null))[_0xb07f('0x25')](respondWithResult(_0xb262e5,null))[_0xb07f('0x44')](handleError(_0xb262e5,null));};exports['create']=function(_0x163f46,_0x2a7147){return db['ServicenowField']['create'](_0x163f46['body'],{})[_0xb07f('0x25')](respondWithResult(_0x2a7147,0xc9))[_0xb07f('0x44')](handleError(_0x2a7147,null));};exports[_0xb07f('0x24')]=function(_0x44a038,_0xb76b77){if(_0x44a038[_0xb07f('0x49')]['id']){delete _0x44a038['body']['id'];}return db[_0xb07f('0x2b')][_0xb07f('0x48')]({'where':{'id':_0x44a038[_0xb07f('0x46')]['id']}})['then'](handleEntityNotFound(_0xb76b77,null))[_0xb07f('0x25')](saveUpdates(_0x44a038[_0xb07f('0x49')],null))[_0xb07f('0x25')](respondWithResult(_0xb76b77,null))[_0xb07f('0x44')](handleError(_0xb76b77,null));};exports[_0xb07f('0x26')]=function(_0x418924,_0xbeb608){return db[_0xb07f('0x2b')][_0xb07f('0x48')]({'where':{'id':_0x418924['params']['id']}})['then'](handleEntityNotFound(_0xbeb608,null))['then'](removeEntity(_0xbeb608,null))[_0xb07f('0x44')](handleError(_0xbeb608,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 3317e05..efc279f 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 _0xc004=['path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField','FieldId','util','api','moment','bluebird','request-promise'];(function(_0xf93e7a,_0x19aca8){var _0x13877f=function(_0x15de2e){while(--_0x15de2e){_0xf93e7a['push'](_0xf93e7a['shift']());}};_0x13877f(++_0x19aca8);}(_0xc004,0xe9));var _0x4c00=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0xc004[_0x4b4638];return _0x59e92b;};'use strict';var _=require('lodash');var util=require(_0x4c00('0x0'));var logger=require('../../config/logger')(_0x4c00('0x1'));var moment=require(_0x4c00('0x2'));var BPromise=require(_0x4c00('0x3'));var rp=require(_0x4c00('0x4'));var fs=require('fs');var path=require(_0x4c00('0x5'));var rimraf=require(_0x4c00('0x6'));var config=require(_0x4c00('0x7'));var attributes=require(_0x4c00('0x8'));module[_0x4c00('0x9')]=function(_0x140352,_0x161d44){return _0x140352[_0x4c00('0xa')]('ServicenowField',attributes,{'tableName':_0x4c00('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x4c00('0xc'),_0x4c00('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc05f=['ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3fbf15,_0x364a50){var _0x3cb23a=function(_0x3b534b){while(--_0x3b534b){_0x3fbf15['push'](_0x3fbf15['shift']());}};_0x3cb23a(++_0x364a50);}(_0xc05f,0x7c));var _0xfc05=function(_0x5f8618,_0x410143){_0x5f8618=_0x5f8618-0x0;var _0x13218b=_0xc05f[_0x5f8618];return _0x13218b;};'use strict';var _=require(_0xfc05('0x0'));var util=require(_0xfc05('0x1'));var logger=require('../../config/logger')(_0xfc05('0x2'));var moment=require(_0xfc05('0x3'));var BPromise=require(_0xfc05('0x4'));var rp=require(_0xfc05('0x5'));var fs=require('fs');var path=require(_0xfc05('0x6'));var rimraf=require('rimraf');var config=require(_0xfc05('0x7'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x386343,_0x262732){return _0x386343['define'](_0xfc05('0x8'),attributes,{'tableName':_0xfc05('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xfc05('0xa'),_0xfc05('0xb')],'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 6e0c74a..7f9dc76 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xda3f,0xec));var _0xfda3=function(_0x34a904,_0x49e7cd){_0x34a904=_0x34a904-0x0;var _0x3376a1=_0xda3f[_0x34a904];return _0x3376a1;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x402f88,_0xaa6ea3){var _0x4a7acc=function(_0x141a3d){while(--_0x141a3d){_0x402f88['push'](_0x402f88['shift']());}};_0x4a7acc(++_0xaa6ea3);}(_0xaa88,0x137));var _0x8aa8=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xaa88[_0x2a56ad];return _0x425175;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index d35f6f7..368b0fb 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4e0706,_0x43ba34){var _0x4e1bd3=function(_0x6d561e){while(--_0x6d561e){_0x4e0706['push'](_0x4e0706['shift']());}};_0x4e1bd3(++_0x43ba34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x31f747,_0x15369d){var _0x46048b=function(_0x4b6014){while(--_0x4b6014){_0x31f747['push'](_0x31f747['shift']());}};_0x46048b(++_0x15369d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index ff58a0d..d1cdee2 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(_0x4d10a6,_0x50dc1d){var _0x3b6a84=function(_0x19d31e){while(--_0x19d31e){_0x4d10a6['push'](_0x4d10a6['shift']());}};_0x3b6a84(++_0x50dc1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x3a33ac,_0x5515df){var _0x3d2924=function(_0x215fb6){while(--_0x215fb6){_0x3a33ac['push'](_0x3a33ac['shift']());}};_0x3d2924(++_0x5515df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 149e7f4..5af0fed 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 _0x6930=['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/license/util','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','sort','pick','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','stringify','values','remove','includes','label','endsWith','value','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x6930,0x1e9));var _0x0693=function(_0x2a3120,_0x40847c){_0x2a3120=_0x2a3120-0x0;var _0x26030e=_0x6930[_0x2a3120];return _0x26030e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0693('0x0'));var zipdir=require(_0x0693('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0693('0x2'));var moment=require(_0x0693('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0693('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0693('0x5'));var csv=require(_0x0693('0x6'));var ejs=require(_0x0693('0x7'));var fs=require('fs');var fs_extra=require(_0x0693('0x8'));var _=require(_0x0693('0x9'));var squel=require(_0x0693('0xa'));var crypto=require('crypto');var jsforce=require(_0x0693('0xb'));var deskjs=require(_0x0693('0xc'));var toCsv=require(_0x0693('0x6'));var querystring=require(_0x0693('0xd'));var Papa=require(_0x0693('0xe'));var Redis=require(_0x0693('0xf'));var authService=require(_0x0693('0x10'));var qs=require(_0x0693('0x11'));var as=require(_0x0693('0x12'));var hardwareService=require(_0x0693('0x13'));var logger=require(_0x0693('0x14'))(_0x0693('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0693('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0693('0x17'));function respondWithStatusCode(_0x3b1da3,_0x563842){_0x563842=_0x563842||0xcc;return function(_0x5c6831){if(_0x5c6831){return _0x3b1da3['sendStatus'](_0x563842);}return _0x3b1da3['status'](_0x563842)[_0x0693('0x18')]();};}function respondWithResult(_0x3b57c5,_0x2890d5){_0x2890d5=_0x2890d5||0xc8;return function(_0xdb404f){if(_0xdb404f){return _0x3b57c5[_0x0693('0x19')](_0x2890d5)['json'](_0xdb404f);}};}function respondWithFilteredResult(_0x1c0ca1,_0x2bdf3c){return function(_0x4aef1f){if(_0x4aef1f){var _0x406126=typeof _0x2bdf3c[_0x0693('0x1a')]===_0x0693('0x1b')&&typeof _0x2bdf3c[_0x0693('0x1c')]==='undefined';var _0x419000=_0x4aef1f[_0x0693('0x1d')];var _0x4c2f79=_0x406126?0x0:_0x2bdf3c[_0x0693('0x1a')];var _0x1616f8=_0x406126?_0x4aef1f[_0x0693('0x1d')]:_0x2bdf3c[_0x0693('0x1a')]+_0x2bdf3c['limit'];var _0x833703;if(_0x1616f8>=_0x419000){_0x1616f8=_0x419000;_0x833703=0xc8;}else{_0x833703=0xce;}_0x1c0ca1['status'](_0x833703);return _0x1c0ca1[_0x0693('0x1e')](_0x0693('0x1f'),_0x4c2f79+'-'+_0x1616f8+'/'+_0x419000)[_0x0693('0x20')](_0x4aef1f);}return null;};}function patchUpdates(_0xaf0a69){return function(_0x2637bf){try{jsonpatch['apply'](_0x2637bf,_0xaf0a69,!![]);}catch(_0x215fed){return BPromise[_0x0693('0x21')](_0x215fed);}return _0x2637bf[_0x0693('0x22')]();};}function saveUpdates(_0xf77233,_0x2a748f){return function(_0x2ee7eb){if(_0x2ee7eb){return _0x2ee7eb['update'](_0xf77233)[_0x0693('0x23')](function(_0x3b2ce7){return _0x3b2ce7;});}return null;};}function removeEntity(_0x59628d,_0x4219f4){return function(_0x54404b){if(_0x54404b){return _0x54404b[_0x0693('0x24')]()['then'](function(){_0x59628d[_0x0693('0x19')](0xcc)[_0x0693('0x18')]();});}};}function handleEntityNotFound(_0x3d8dff,_0x134e2f){return function(_0x52938a){if(!_0x52938a){_0x3d8dff[_0x0693('0x25')](0x194);}return _0x52938a;};}function handleError(_0x3ec592,_0x5e511b){_0x5e511b=_0x5e511b||0x1f4;return function(_0x18f71c){logger['error'](_0x18f71c[_0x0693('0x26')]);if(_0x18f71c[_0x0693('0x27')]){delete _0x18f71c['name'];}_0x3ec592['status'](_0x5e511b)[_0x0693('0x28')](_0x18f71c);};}exports[_0x0693('0x29')]=function(_0x459e95,_0xfad12c){var _0x29fe38={},_0x1f5ac6={},_0x4369bc={'count':0x0,'rows':[]};var _0x3e2515=_[_0x0693('0x2a')](db[_0x0693('0x2b')][_0x0693('0x2c')],function(_0x204065){return{'name':_0x204065[_0x0693('0x2d')],'type':_0x204065[_0x0693('0x2e')]['key']};});_0x1f5ac6['model']=_[_0x0693('0x2a')](_0x3e2515,_0x0693('0x27'));_0x1f5ac6['query']=_[_0x0693('0x2f')](_0x459e95[_0x0693('0x30')]);_0x1f5ac6['filters']=_[_0x0693('0x31')](_0x1f5ac6[_0x0693('0x32')],_0x1f5ac6[_0x0693('0x30')]);_0x29fe38[_0x0693('0x33')]=_[_0x0693('0x31')](_0x1f5ac6['model'],qs[_0x0693('0x34')](_0x459e95[_0x0693('0x30')][_0x0693('0x34')]));_0x29fe38[_0x0693('0x33')]=_0x29fe38[_0x0693('0x33')][_0x0693('0x35')]?_0x29fe38[_0x0693('0x33')]:_0x1f5ac6[_0x0693('0x32')];if(!_0x459e95['query']['hasOwnProperty'](_0x0693('0x36'))){_0x29fe38['limit']=qs[_0x0693('0x1c')](_0x459e95[_0x0693('0x30')][_0x0693('0x1c')]);_0x29fe38[_0x0693('0x1a')]=qs[_0x0693('0x1a')](_0x459e95[_0x0693('0x30')][_0x0693('0x1a')]);}_0x29fe38[_0x0693('0x37')]=qs['sort'](_0x459e95[_0x0693('0x30')]['sort']);_0x29fe38[_0x0693('0x38')]=qs[_0x0693('0x39')](_['pick'](_0x459e95[_0x0693('0x30')],_0x1f5ac6['filters']),_0x3e2515);if(_0x459e95[_0x0693('0x30')][_0x0693('0x3a')]){_0x29fe38[_0x0693('0x38')]=_[_0x0693('0x3b')](_0x29fe38['where'],{'$or':_[_0x0693('0x2a')](_0x3e2515,function(_0x2d773e){if(_0x2d773e['type']!==_0x0693('0x3c')){var _0x4f90b4={};_0x4f90b4[_0x2d773e[_0x0693('0x27')]]={'$like':'%'+_0x459e95['query'][_0x0693('0x3a')]+'%'};return _0x4f90b4;}})});}_0x29fe38=_[_0x0693('0x3b')]({},_0x29fe38,_0x459e95[_0x0693('0x3d')]);var _0x1aee04={'where':_0x29fe38[_0x0693('0x38')]};return db[_0x0693('0x2b')][_0x0693('0x1d')](_0x1aee04)[_0x0693('0x23')](function(_0x21c2ea){_0x4369bc[_0x0693('0x1d')]=_0x21c2ea;if(_0x459e95['query'][_0x0693('0x3e')]){_0x29fe38[_0x0693('0x3f')]=[{'all':!![]}];}return db[_0x0693('0x2b')][_0x0693('0x40')](_0x29fe38);})[_0x0693('0x23')](function(_0x41ce24){_0x4369bc[_0x0693('0x41')]=_0x41ce24;return _0x4369bc;})[_0x0693('0x23')](respondWithFilteredResult(_0xfad12c,_0x29fe38))['catch'](handleError(_0xfad12c,null));};exports[_0x0693('0x42')]=function(_0xec1966,_0x2cb1ae){var _0xb7b998={'raw':![],'where':{'id':_0xec1966[_0x0693('0x43')]['id']}},_0x4332c9={};_0x4332c9['model']=_[_0x0693('0x2f')](db[_0x0693('0x2b')][_0x0693('0x2c')]);_0x4332c9[_0x0693('0x30')]=_[_0x0693('0x2f')](_0xec1966[_0x0693('0x30')]);_0x4332c9[_0x0693('0x39')]=_[_0x0693('0x31')](_0x4332c9['model'],_0x4332c9[_0x0693('0x30')]);_0xb7b998[_0x0693('0x33')]=_[_0x0693('0x31')](_0x4332c9[_0x0693('0x32')],qs[_0x0693('0x34')](_0xec1966[_0x0693('0x30')][_0x0693('0x34')]));_0xb7b998[_0x0693('0x33')]=_0xb7b998[_0x0693('0x33')][_0x0693('0x35')]?_0xb7b998[_0x0693('0x33')]:_0x4332c9[_0x0693('0x32')];if(_0xec1966[_0x0693('0x30')]['includeAll']){_0xb7b998[_0x0693('0x3f')]=[{'all':!![]}];}_0xb7b998=_['merge']({},_0xb7b998,_0xec1966[_0x0693('0x3d')]);return db[_0x0693('0x2b')][_0x0693('0x44')](_0xb7b998)['then'](handleEntityNotFound(_0x2cb1ae,null))[_0x0693('0x23')](respondWithResult(_0x2cb1ae,null))[_0x0693('0x45')](handleError(_0x2cb1ae,null));};exports[_0x0693('0x46')]=function(_0x1b13c5,_0x3fbb68){return db[_0x0693('0x2b')][_0x0693('0x46')](_0x1b13c5[_0x0693('0x47')],{})[_0x0693('0x23')](respondWithResult(_0x3fbb68,0xc9))['catch'](handleError(_0x3fbb68,null));};exports[_0x0693('0x48')]=function(_0x15aedc,_0x1863b2){if(_0x15aedc[_0x0693('0x47')]['id']){delete _0x15aedc[_0x0693('0x47')]['id'];}return db['SugarcrmAccount'][_0x0693('0x44')]({'where':{'id':_0x15aedc[_0x0693('0x43')]['id']}})['then'](handleEntityNotFound(_0x1863b2,null))[_0x0693('0x23')](saveUpdates(_0x15aedc[_0x0693('0x47')],null))['then'](respondWithResult(_0x1863b2,null))['catch'](handleError(_0x1863b2,null));};exports[_0x0693('0x24')]=function(_0x3b2108,_0x3ca0cb){return db[_0x0693('0x2b')]['find']({'where':{'id':_0x3b2108[_0x0693('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ca0cb,null))[_0x0693('0x23')](removeEntity(_0x3ca0cb,null))[_0x0693('0x45')](handleError(_0x3ca0cb,null));};exports[_0x0693('0x49')]=function(_0x1c3317,_0x35488e,_0x11db39){var _0x204230={};var _0x46b49f={};var _0x2c7f81;var _0x546ca4;return db['SugarcrmAccount'][_0x0693('0x4a')]({'where':{'id':_0x1c3317['params']['id']}})[_0x0693('0x23')](handleEntityNotFound(_0x35488e,null))[_0x0693('0x23')](function(_0x29a27d){if(_0x29a27d){_0x2c7f81=_0x29a27d;_0x46b49f['model']=_[_0x0693('0x2f')](db[_0x0693('0x4b')][_0x0693('0x2c')]);_0x46b49f['query']=_[_0x0693('0x2f')](_0x1c3317[_0x0693('0x30')]);_0x46b49f['filters']=_[_0x0693('0x31')](_0x46b49f[_0x0693('0x32')],_0x46b49f[_0x0693('0x30')]);_0x204230[_0x0693('0x33')]=_[_0x0693('0x31')](_0x46b49f['model'],qs[_0x0693('0x34')](_0x1c3317[_0x0693('0x30')]['fields']));_0x204230[_0x0693('0x33')]=_0x204230[_0x0693('0x33')][_0x0693('0x35')]?_0x204230[_0x0693('0x33')]:_0x46b49f['model'];_0x204230['order']=qs[_0x0693('0x4c')](_0x1c3317[_0x0693('0x30')][_0x0693('0x4c')]);_0x204230[_0x0693('0x38')]=qs[_0x0693('0x39')](_[_0x0693('0x4d')](_0x1c3317[_0x0693('0x30')],_0x46b49f[_0x0693('0x39')]));if(_0x1c3317[_0x0693('0x30')][_0x0693('0x3a')]){_0x204230[_0x0693('0x38')]=_[_0x0693('0x3b')](_0x204230[_0x0693('0x38')],{'$or':_[_0x0693('0x2a')](_0x204230[_0x0693('0x33')],function(_0x56e47f){var _0x4ff6a5={};_0x4ff6a5[_0x56e47f]={'$like':'%'+_0x1c3317['query'][_0x0693('0x3a')]+'%'};return _0x4ff6a5;})});}_0x204230=_['merge']({},_0x204230,_0x1c3317['options']);return _0x2c7f81['getConfigurations'](_0x204230);}})[_0x0693('0x23')](function(_0xf148c2){if(_0xf148c2){_0x546ca4=_0xf148c2[_0x0693('0x35')];if(!_0x1c3317[_0x0693('0x30')][_0x0693('0x4e')](_0x0693('0x36'))){_0x204230['limit']=qs[_0x0693('0x1c')](_0x1c3317[_0x0693('0x30')][_0x0693('0x1c')]);_0x204230[_0x0693('0x1a')]=qs[_0x0693('0x1a')](_0x1c3317['query'][_0x0693('0x1a')]);}return _0x2c7f81[_0x0693('0x49')](_0x204230);}})[_0x0693('0x23')](function(_0x597375){if(_0x597375){return _0x597375?{'count':_0x546ca4,'rows':_0x597375}:null;}})[_0x0693('0x23')](respondWithResult(_0x35488e,null))[_0x0693('0x45')](handleError(_0x35488e,null));};exports[_0x0693('0x4f')]=function(_0x3fa012,_0x50972c,_0x1504b5){if(_0x3fa012['body']['id']){delete _0x3fa012[_0x0693('0x47')]['id'];}return db[_0x0693('0x2b')][_0x0693('0x4a')]({'where':{'id':_0x3fa012[_0x0693('0x43')]['id']}})['then'](handleEntityNotFound(_0x50972c,null))['then'](function(_0x2dd612){if(_0x2dd612){_0x3fa012['body']['AccountId']=_0x2dd612['id'];_0x3fa012[_0x0693('0x47')]['Subjects']=integrations[_0x0693('0x50')](_0x3fa012[_0x0693('0x47')][_0x0693('0x51')],_0x3fa012['body'][_0x0693('0x2e')]);_0x3fa012[_0x0693('0x47')][_0x0693('0x52')]=integrations[_0x0693('0x53')](_0x3fa012[_0x0693('0x47')]['channel'],_0x3fa012[_0x0693('0x47')][_0x0693('0x2e')]);return db[_0x0693('0x4b')][_0x0693('0x46')](_0x3fa012[_0x0693('0x47')],{'include':[{'model':db[_0x0693('0x54')],'as':_0x0693('0x55')},{'model':db[_0x0693('0x54')],'as':_0x0693('0x52')}]});}return null;})[_0x0693('0x23')](respondWithResult(_0x50972c,null))[_0x0693('0x45')](handleError(_0x50972c,null));};exports['getFields']=function(_0x41f344,_0x43d193,_0x308f0f){var _0x298b26='';var _0x463ade=['id',_0x0693('0x27'),_0x0693('0x56'),_0x0693('0x57'),_0x0693('0x58'),_0x0693('0x59'),_0x0693('0x5a'),_0x0693('0x5b'),_0x0693('0x5c'),_0x0693('0x5d'),_0x0693('0x5e'),_0x0693('0x5f')];return db[_0x0693('0x2b')][_0x0693('0x4a')]({'where':{'id':_0x41f344[_0x0693('0x43')]['id']},'attributes':['id',_0x0693('0x60'),'password',_0x0693('0x61')]})['then'](handleEntityNotFound(_0x43d193,null))['then'](function(_0x899ed3){if(_0x899ed3){_0x298b26=_0x899ed3[_0x0693('0x61')];var _0x330990=_0x298b26[_0x0693('0x62')](-0x1);if(_0x330990==='/'){_0x298b26=_0x298b26[_0x0693('0x63')](0x0,_0x298b26[_0x0693('0x64')](_0x330990));}return rp({'method':_0x0693('0x65'),'uri':util[_0x0693('0x66')]('%s%s',_0x298b26,_0x0693('0x67')),'json':!![],'form':{'method':_0x0693('0x68'),'input_type':_0x0693('0x69'),'response_type':_0x0693('0x69'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x899ed3[_0x0693('0x60')],'password':_0x899ed3[_0x0693('0x6a')],'encryption':_0x0693('0x6b')},'application':_0x0693('0x6c')})}});}})[_0x0693('0x23')](function(_0x102e59){if(_0x102e59&&_0x102e59[_0x0693('0x27')]!==_0x0693('0x6d')&&_0x102e59[_0x0693('0x27')]!==_0x0693('0x6e')){return rp({'method':_0x0693('0x65'),'uri':util[_0x0693('0x66')](_0x0693('0x6f'),_0x298b26,_0x0693('0x67')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x0693('0x69'),'response_type':'JSON','rest_data':JSON[_0x0693('0x70')]({'session':_0x102e59['id'],'module_name':'Calls'})}})[_0x0693('0x23')](function(_0x2e24dd){if(_0x2e24dd){var _0x24e3d4=_[_0x0693('0x71')](_0x2e24dd['module_fields']);_[_0x0693('0x72')](_0x24e3d4,function(_0x1dbee7){return _0x463ade[_0x0693('0x73')](_0x1dbee7[_0x0693('0x27')]);});return{'count':_0x24e3d4['length'],'rows':_[_0x0693('0x2a')](_0x24e3d4,function(_0x3b7548){return{'id':_0x3b7548[_0x0693('0x27')],'name':_0x3b7548[_0x0693('0x74')],'custom':_[_0x0693('0x75')](_0x3b7548[_0x0693('0x27')],'_c')?!![]:![],'options':_0x3b7548[_0x0693('0x3d')]?_[_0x0693('0x2a')](_[_0x0693('0x71')](_0x3b7548[_0x0693('0x3d')]),function(_0x12711d){return{'name':_0x12711d[_0x0693('0x76')],'value':_0x12711d[_0x0693('0x27')]};}):[]};})};}})[_0x0693('0x23')](respondWithResult(_0x43d193,null))[_0x0693('0x45')](function(_0x3b6748){var _0x3eec4b=_0x41f344[_0x0693('0x30')]['test']?0x1f4:_0x3b6748[_0x0693('0x77')]||0x1f4;logger[_0x0693('0x78')](_0x0693('0x79'),'getFields',_0x3eec4b,JSON[_0x0693('0x70')](_0x3b6748));delete _0x3b6748['name'];if(_0x3eec4b===0x191){_0x3eec4b=0x190;}_0x43d193['status'](_0x3eec4b)['send'](_0x41f344['query'][_0x0693('0x7a')]?{'message':_0x0693('0x7b'),'statusCode':_0x3b6748[_0x0693('0x77')]}:_0x3b6748);});}else{var _0xe834d6=0x1f4;_0x43d193[_0x0693('0x19')](_0xe834d6)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x9c91=['attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','find','create','update','params','body','getConfigurations','findOne','SugarcrmConfiguration','order','addConfiguration','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','substring','lastIndexOf','POST','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','stringify','Calls','values','module_fields','includes','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x266291,_0x4d9132){var _0xcc8135=function(_0x4ed449){while(--_0x4ed449){_0x266291['push'](_0x266291['shift']());}};_0xcc8135(++_0x4d9132);}(_0x9c91,0x1a7));var _0x19c9=function(_0x1d85f9,_0x15973e){_0x1d85f9=_0x1d85f9-0x0;var _0x3803d0=_0x9c91[_0x1d85f9];return _0x3803d0;};'use strict';var emlformat=require(_0x19c9('0x0'));var rimraf=require(_0x19c9('0x1'));var zipdir=require(_0x19c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19c9('0x3'));var moment=require('moment');var BPromise=require(_0x19c9('0x4'));var Mustache=require(_0x19c9('0x5'));var util=require('util');var path=require(_0x19c9('0x6'));var sox=require(_0x19c9('0x7'));var csv=require(_0x19c9('0x8'));var ejs=require(_0x19c9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x19c9('0xa'));var squel=require(_0x19c9('0xb'));var crypto=require(_0x19c9('0xc'));var jsforce=require(_0x19c9('0xd'));var deskjs=require(_0x19c9('0xe'));var toCsv=require(_0x19c9('0x8'));var querystring=require(_0x19c9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x19c9('0x10'));var qs=require(_0x19c9('0x11'));var as=require(_0x19c9('0x12'));var hardwareService=require(_0x19c9('0x13'));var logger=require(_0x19c9('0x14'))(_0x19c9('0x15'));var utils=require('../../config/utils');var config=require(_0x19c9('0x16'));var licenseUtil=require(_0x19c9('0x17'));var db=require(_0x19c9('0x18'))['db'];var integrations=require(_0x19c9('0x19'));function respondWithStatusCode(_0x116f1c,_0x118159){_0x118159=_0x118159||0xcc;return function(_0x34f31a){if(_0x34f31a){return _0x116f1c[_0x19c9('0x1a')](_0x118159);}return _0x116f1c['status'](_0x118159)['end']();};}function respondWithResult(_0x5b7bcb,_0x1bb37e){_0x1bb37e=_0x1bb37e||0xc8;return function(_0x39f56d){if(_0x39f56d){return _0x5b7bcb[_0x19c9('0x1b')](_0x1bb37e)['json'](_0x39f56d);}};}function respondWithFilteredResult(_0x5446e8,_0xb1dec5){return function(_0x2f1650){if(_0x2f1650){var _0x1c46b0=typeof _0xb1dec5[_0x19c9('0x1c')]===_0x19c9('0x1d')&&typeof _0xb1dec5[_0x19c9('0x1e')]===_0x19c9('0x1d');var _0x53660c=_0x2f1650[_0x19c9('0x1f')];var _0x1481d9=_0x1c46b0?0x0:_0xb1dec5[_0x19c9('0x1c')];var _0x123c69=_0x1c46b0?_0x2f1650['count']:_0xb1dec5[_0x19c9('0x1c')]+_0xb1dec5['limit'];var _0x30d721;if(_0x123c69>=_0x53660c){_0x123c69=_0x53660c;_0x30d721=0xc8;}else{_0x30d721=0xce;}_0x5446e8[_0x19c9('0x1b')](_0x30d721);return _0x5446e8[_0x19c9('0x20')](_0x19c9('0x21'),_0x1481d9+'-'+_0x123c69+'/'+_0x53660c)[_0x19c9('0x22')](_0x2f1650);}return null;};}function patchUpdates(_0x42e5eb){return function(_0x423e5a){try{jsonpatch[_0x19c9('0x23')](_0x423e5a,_0x42e5eb,!![]);}catch(_0x2f82a1){return BPromise[_0x19c9('0x24')](_0x2f82a1);}return _0x423e5a[_0x19c9('0x25')]();};}function saveUpdates(_0xad6ce,_0x50b62d){return function(_0x1ffb2e){if(_0x1ffb2e){return _0x1ffb2e['update'](_0xad6ce)[_0x19c9('0x26')](function(_0xb244f8){return _0xb244f8;});}return null;};}function removeEntity(_0x119691,_0x38b07c){return function(_0x2b9913){if(_0x2b9913){return _0x2b9913[_0x19c9('0x27')]()[_0x19c9('0x26')](function(){_0x119691[_0x19c9('0x1b')](0xcc)[_0x19c9('0x28')]();});}};}function handleEntityNotFound(_0x7af83b,_0x40aa28){return function(_0x4b5a09){if(!_0x4b5a09){_0x7af83b[_0x19c9('0x1a')](0x194);}return _0x4b5a09;};}function handleError(_0x141a18,_0x3e03fa){_0x3e03fa=_0x3e03fa||0x1f4;return function(_0x1cc8f7){logger[_0x19c9('0x29')](_0x1cc8f7['stack']);if(_0x1cc8f7[_0x19c9('0x2a')]){delete _0x1cc8f7[_0x19c9('0x2a')];}_0x141a18[_0x19c9('0x1b')](_0x3e03fa)[_0x19c9('0x2b')](_0x1cc8f7);};}exports[_0x19c9('0x2c')]=function(_0x4c532a,_0x1c2b94){var _0x387518={},_0x5e9b76={},_0x1d3c78={'count':0x0,'rows':[]};var _0xf816f=_[_0x19c9('0x2d')](db[_0x19c9('0x2e')][_0x19c9('0x2f')],function(_0x26647b){return{'name':_0x26647b[_0x19c9('0x30')],'type':_0x26647b[_0x19c9('0x31')][_0x19c9('0x32')]};});_0x5e9b76[_0x19c9('0x33')]=_[_0x19c9('0x2d')](_0xf816f,_0x19c9('0x2a'));_0x5e9b76[_0x19c9('0x34')]=_[_0x19c9('0x35')](_0x4c532a['query']);_0x5e9b76[_0x19c9('0x36')]=_[_0x19c9('0x37')](_0x5e9b76[_0x19c9('0x33')],_0x5e9b76['query']);_0x387518['attributes']=_[_0x19c9('0x37')](_0x5e9b76[_0x19c9('0x33')],qs[_0x19c9('0x38')](_0x4c532a[_0x19c9('0x34')]['fields']));_0x387518[_0x19c9('0x39')]=_0x387518[_0x19c9('0x39')][_0x19c9('0x3a')]?_0x387518['attributes']:_0x5e9b76[_0x19c9('0x33')];if(!_0x4c532a[_0x19c9('0x34')][_0x19c9('0x3b')]('nolimit')){_0x387518['limit']=qs[_0x19c9('0x1e')](_0x4c532a[_0x19c9('0x34')]['limit']);_0x387518[_0x19c9('0x1c')]=qs[_0x19c9('0x1c')](_0x4c532a[_0x19c9('0x34')][_0x19c9('0x1c')]);}_0x387518['order']=qs[_0x19c9('0x3c')](_0x4c532a['query']['sort']);_0x387518[_0x19c9('0x3d')]=qs[_0x19c9('0x36')](_['pick'](_0x4c532a[_0x19c9('0x34')],_0x5e9b76[_0x19c9('0x36')]),_0xf816f);if(_0x4c532a[_0x19c9('0x34')][_0x19c9('0x3e')]){_0x387518[_0x19c9('0x3d')]=_[_0x19c9('0x3f')](_0x387518[_0x19c9('0x3d')],{'$or':_['map'](_0xf816f,function(_0x5efbb8){if(_0x5efbb8['type']!==_0x19c9('0x40')){var _0x50ee6b={};_0x50ee6b[_0x5efbb8[_0x19c9('0x2a')]]={'$like':'%'+_0x4c532a[_0x19c9('0x34')]['filter']+'%'};return _0x50ee6b;}})});}_0x387518=_['merge']({},_0x387518,_0x4c532a[_0x19c9('0x41')]);var _0x489c6c={'where':_0x387518[_0x19c9('0x3d')]};return db[_0x19c9('0x2e')]['count'](_0x489c6c)['then'](function(_0xbc342e){_0x1d3c78[_0x19c9('0x1f')]=_0xbc342e;if(_0x4c532a[_0x19c9('0x34')][_0x19c9('0x42')]){_0x387518['include']=[{'all':!![]}];}return db[_0x19c9('0x2e')][_0x19c9('0x43')](_0x387518);})[_0x19c9('0x26')](function(_0x759aa){_0x1d3c78[_0x19c9('0x44')]=_0x759aa;return _0x1d3c78;})[_0x19c9('0x26')](respondWithFilteredResult(_0x1c2b94,_0x387518))[_0x19c9('0x45')](handleError(_0x1c2b94,null));};exports[_0x19c9('0x46')]=function(_0x319640,_0x58f18d){var _0x46d7f9={'raw':![],'where':{'id':_0x319640['params']['id']}},_0x41d44f={};_0x41d44f[_0x19c9('0x33')]=_[_0x19c9('0x35')](db[_0x19c9('0x2e')][_0x19c9('0x2f')]);_0x41d44f[_0x19c9('0x34')]=_[_0x19c9('0x35')](_0x319640[_0x19c9('0x34')]);_0x41d44f['filters']=_[_0x19c9('0x37')](_0x41d44f[_0x19c9('0x33')],_0x41d44f[_0x19c9('0x34')]);_0x46d7f9[_0x19c9('0x39')]=_[_0x19c9('0x37')](_0x41d44f[_0x19c9('0x33')],qs['fields'](_0x319640['query']['fields']));_0x46d7f9[_0x19c9('0x39')]=_0x46d7f9[_0x19c9('0x39')]['length']?_0x46d7f9[_0x19c9('0x39')]:_0x41d44f['model'];if(_0x319640[_0x19c9('0x34')][_0x19c9('0x42')]){_0x46d7f9['include']=[{'all':!![]}];}_0x46d7f9=_['merge']({},_0x46d7f9,_0x319640['options']);return db[_0x19c9('0x2e')][_0x19c9('0x47')](_0x46d7f9)[_0x19c9('0x26')](handleEntityNotFound(_0x58f18d,null))[_0x19c9('0x26')](respondWithResult(_0x58f18d,null))['catch'](handleError(_0x58f18d,null));};exports[_0x19c9('0x48')]=function(_0x186109,_0x161c05){return db[_0x19c9('0x2e')][_0x19c9('0x48')](_0x186109['body'],{})[_0x19c9('0x26')](respondWithResult(_0x161c05,0xc9))[_0x19c9('0x45')](handleError(_0x161c05,null));};exports[_0x19c9('0x49')]=function(_0x55ead8,_0x3e1463){if(_0x55ead8['body']['id']){delete _0x55ead8['body']['id'];}return db[_0x19c9('0x2e')]['find']({'where':{'id':_0x55ead8[_0x19c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e1463,null))[_0x19c9('0x26')](saveUpdates(_0x55ead8[_0x19c9('0x4b')],null))['then'](respondWithResult(_0x3e1463,null))[_0x19c9('0x45')](handleError(_0x3e1463,null));};exports[_0x19c9('0x27')]=function(_0x8b2c9c,_0x5d29c6){return db[_0x19c9('0x2e')][_0x19c9('0x47')]({'where':{'id':_0x8b2c9c[_0x19c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d29c6,null))['then'](removeEntity(_0x5d29c6,null))[_0x19c9('0x45')](handleError(_0x5d29c6,null));};exports[_0x19c9('0x4c')]=function(_0x48bd03,_0x12f3de,_0x47d99a){var _0x3f0b13={};var _0x409bb3={};var _0x232fe6;var _0x12cc98;return db[_0x19c9('0x2e')][_0x19c9('0x4d')]({'where':{'id':_0x48bd03[_0x19c9('0x4a')]['id']}})[_0x19c9('0x26')](handleEntityNotFound(_0x12f3de,null))['then'](function(_0x23bbbe){if(_0x23bbbe){_0x232fe6=_0x23bbbe;_0x409bb3[_0x19c9('0x33')]=_['keys'](db[_0x19c9('0x4e')][_0x19c9('0x2f')]);_0x409bb3['query']=_['keys'](_0x48bd03[_0x19c9('0x34')]);_0x409bb3[_0x19c9('0x36')]=_[_0x19c9('0x37')](_0x409bb3['model'],_0x409bb3[_0x19c9('0x34')]);_0x3f0b13[_0x19c9('0x39')]=_[_0x19c9('0x37')](_0x409bb3[_0x19c9('0x33')],qs[_0x19c9('0x38')](_0x48bd03[_0x19c9('0x34')]['fields']));_0x3f0b13[_0x19c9('0x39')]=_0x3f0b13[_0x19c9('0x39')]['length']?_0x3f0b13[_0x19c9('0x39')]:_0x409bb3[_0x19c9('0x33')];_0x3f0b13[_0x19c9('0x4f')]=qs['sort'](_0x48bd03[_0x19c9('0x34')][_0x19c9('0x3c')]);_0x3f0b13[_0x19c9('0x3d')]=qs[_0x19c9('0x36')](_['pick'](_0x48bd03[_0x19c9('0x34')],_0x409bb3[_0x19c9('0x36')]));if(_0x48bd03[_0x19c9('0x34')][_0x19c9('0x3e')]){_0x3f0b13[_0x19c9('0x3d')]=_['merge'](_0x3f0b13[_0x19c9('0x3d')],{'$or':_[_0x19c9('0x2d')](_0x3f0b13[_0x19c9('0x39')],function(_0x480b60){var _0x51d710={};_0x51d710[_0x480b60]={'$like':'%'+_0x48bd03['query'][_0x19c9('0x3e')]+'%'};return _0x51d710;})});}_0x3f0b13=_[_0x19c9('0x3f')]({},_0x3f0b13,_0x48bd03[_0x19c9('0x41')]);return _0x232fe6[_0x19c9('0x4c')](_0x3f0b13);}})['then'](function(_0x421b1e){if(_0x421b1e){_0x12cc98=_0x421b1e[_0x19c9('0x3a')];if(!_0x48bd03['query'][_0x19c9('0x3b')]('nolimit')){_0x3f0b13['limit']=qs[_0x19c9('0x1e')](_0x48bd03[_0x19c9('0x34')][_0x19c9('0x1e')]);_0x3f0b13[_0x19c9('0x1c')]=qs['offset'](_0x48bd03['query'][_0x19c9('0x1c')]);}return _0x232fe6[_0x19c9('0x4c')](_0x3f0b13);}})[_0x19c9('0x26')](function(_0x2c257f){if(_0x2c257f){return _0x2c257f?{'count':_0x12cc98,'rows':_0x2c257f}:null;}})['then'](respondWithResult(_0x12f3de,null))['catch'](handleError(_0x12f3de,null));};exports[_0x19c9('0x50')]=function(_0x1090fe,_0x52cae1,_0xa0b72f){if(_0x1090fe[_0x19c9('0x4b')]['id']){delete _0x1090fe[_0x19c9('0x4b')]['id'];}return db['SugarcrmAccount'][_0x19c9('0x4d')]({'where':{'id':_0x1090fe['params']['id']}})[_0x19c9('0x26')](handleEntityNotFound(_0x52cae1,null))[_0x19c9('0x26')](function(_0x128f72){if(_0x128f72){_0x1090fe['body']['AccountId']=_0x128f72['id'];_0x1090fe['body'][_0x19c9('0x51')]=integrations['getSubjects'](_0x1090fe[_0x19c9('0x4b')][_0x19c9('0x52')],_0x1090fe[_0x19c9('0x4b')][_0x19c9('0x31')]);_0x1090fe[_0x19c9('0x4b')][_0x19c9('0x53')]=integrations[_0x19c9('0x54')](_0x1090fe[_0x19c9('0x4b')][_0x19c9('0x52')],_0x1090fe[_0x19c9('0x4b')][_0x19c9('0x31')]);return db['SugarcrmConfiguration'][_0x19c9('0x48')](_0x1090fe[_0x19c9('0x4b')],{'include':[{'model':db[_0x19c9('0x55')],'as':_0x19c9('0x51')},{'model':db[_0x19c9('0x55')],'as':'Descriptions'}]});}return null;})[_0x19c9('0x26')](respondWithResult(_0x52cae1,null))[_0x19c9('0x45')](handleError(_0x52cae1,null));};exports['getFields']=function(_0x23e26a,_0x387c5f,_0x6f5163){var _0x71bb78='';var _0x20e0f6=['id',_0x19c9('0x2a'),_0x19c9('0x56'),_0x19c9('0x57'),_0x19c9('0x58'),'date_start',_0x19c9('0x59'),_0x19c9('0x5a'),_0x19c9('0x5b'),_0x19c9('0x5c'),'parent_name',_0x19c9('0x5d')];return db[_0x19c9('0x2e')]['findOne']({'where':{'id':_0x23e26a['params']['id']},'attributes':['id',_0x19c9('0x5e'),_0x19c9('0x5f'),_0x19c9('0x60')]})[_0x19c9('0x26')](handleEntityNotFound(_0x387c5f,null))['then'](function(_0x1e03cf){if(_0x1e03cf){_0x71bb78=_0x1e03cf[_0x19c9('0x60')];var _0x1719b6=_0x71bb78['slice'](-0x1);if(_0x1719b6==='/'){_0x71bb78=_0x71bb78[_0x19c9('0x61')](0x0,_0x71bb78[_0x19c9('0x62')](_0x1719b6));}return rp({'method':_0x19c9('0x63'),'uri':util['format']('%s%s',_0x71bb78,_0x19c9('0x64')),'json':!![],'form':{'method':_0x19c9('0x65'),'input_type':_0x19c9('0x66'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1e03cf[_0x19c9('0x5e')],'password':_0x1e03cf[_0x19c9('0x5f')],'encryption':_0x19c9('0x67')},'application':_0x19c9('0x68')})}});}})[_0x19c9('0x26')](function(_0x150cc8){if(_0x150cc8&&_0x150cc8['name']!==_0x19c9('0x69')&&_0x150cc8['name']!==_0x19c9('0x6a')){return rp({'method':_0x19c9('0x63'),'uri':util['format'](_0x19c9('0x6b'),_0x71bb78,_0x19c9('0x64')),'json':!![],'form':{'method':_0x19c9('0x6c'),'input_type':_0x19c9('0x66'),'response_type':_0x19c9('0x66'),'rest_data':JSON[_0x19c9('0x6d')]({'session':_0x150cc8['id'],'module_name':_0x19c9('0x6e')})}})[_0x19c9('0x26')](function(_0x514ea5){if(_0x514ea5){var _0x294979=_[_0x19c9('0x6f')](_0x514ea5[_0x19c9('0x70')]);_['remove'](_0x294979,function(_0x16d1e2){return _0x20e0f6[_0x19c9('0x71')](_0x16d1e2[_0x19c9('0x2a')]);});return{'count':_0x294979['length'],'rows':_['map'](_0x294979,function(_0x396949){return{'id':_0x396949[_0x19c9('0x2a')],'name':_0x396949['label'],'custom':_[_0x19c9('0x72')](_0x396949[_0x19c9('0x2a')],'_c')?!![]:![],'options':_0x396949['options']?_[_0x19c9('0x2d')](_['values'](_0x396949[_0x19c9('0x41')]),function(_0x2ef217){return{'name':_0x2ef217[_0x19c9('0x73')],'value':_0x2ef217[_0x19c9('0x2a')]};}):[]};})};}})[_0x19c9('0x26')](respondWithResult(_0x387c5f,null))[_0x19c9('0x45')](function(_0x11e378){var _0x14a20c=_0x23e26a[_0x19c9('0x34')][_0x19c9('0x74')]?0x1f4:_0x11e378['statusCode']||0x1f4;logger[_0x19c9('0x29')](_0x19c9('0x75'),'getFields',_0x14a20c,JSON[_0x19c9('0x6d')](_0x11e378));delete _0x11e378[_0x19c9('0x2a')];if(_0x14a20c===0x191){_0x14a20c=0x190;}_0x387c5f[_0x19c9('0x1b')](_0x14a20c)[_0x19c9('0x2b')](_0x23e26a[_0x19c9('0x34')][_0x19c9('0x74')]?{'message':_0x19c9('0x76'),'statusCode':_0x11e378[_0x19c9('0x77')]}:_0x11e378);});}else{var _0x48242d=0x1f4;_0x387c5f['status'](_0x48242d)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 863e32f..016ea30 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 _0x6606=['moment','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','lodash','util','../../config/logger','api'];(function(_0x55cf05,_0x5c0dae){var _0x553ed1=function(_0xd75d12){while(--_0xd75d12){_0x55cf05['push'](_0x55cf05['shift']());}};_0x553ed1(++_0x5c0dae);}(_0x6606,0x6a));var _0x6660=function(_0x5611b6,_0x2fac5f){_0x5611b6=_0x5611b6-0x0;var _0x34754a=_0x6606[_0x5611b6];return _0x34754a;};'use strict';var _=require(_0x6660('0x0'));var util=require(_0x6660('0x1'));var logger=require(_0x6660('0x2'))(_0x6660('0x3'));var moment=require(_0x6660('0x4'));var BPromise=require(_0x6660('0x5'));var rp=require(_0x6660('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6660('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x6660('0x8'));module[_0x6660('0x9')]=function(_0x416f45,_0x1f00b1){return _0x416f45['define'](_0x6660('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x188f=['define','SugarcrmAccount','util','../../config/logger','api','request-promise','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x188f,0xc8));var _0xf188=function(_0x5e9f11,_0x40d2e3){_0x5e9f11=_0x5e9f11-0x0;var _0x55c8f=_0x188f[_0x5e9f11];return _0x55c8f;};'use strict';var _=require('lodash');var util=require(_0xf188('0x0'));var logger=require(_0xf188('0x1'))(_0xf188('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf188('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf188('0x4'));var config=require('../../config/environment');var attributes=require(_0xf188('0x5'));var integrations=require(_0xf188('0x6'));module['exports']=function(_0x3c2817,_0x18a31f){return _0x3c2817[_0xf188('0x7')](_0xf188('0x8'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index fb6f2a6..41951e0 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 _0x29d8=['where','attributes','include','map','model','then','raw','ShowSugarcrmAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x4d9799,_0x136a37){var _0x5abd14=function(_0x65ae56){while(--_0x65ae56){_0x4d9799['push'](_0x4d9799['shift']());}};_0x5abd14(++_0x136a37);}(_0x29d8,0x1b9));var _0x829d=function(_0x234c59,_0x45874c){_0x234c59=_0x234c59-0x0;var _0x4fe3a2=_0x29d8[_0x234c59];return _0x4fe3a2;};'use strict';var _=require(_0x829d('0x0'));var util=require(_0x829d('0x1'));var moment=require(_0x829d('0x2'));var BPromise=require(_0x829d('0x3'));var rs=require(_0x829d('0x4'));var fs=require('fs');var Redis=require(_0x829d('0x5'));var db=require(_0x829d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x829d('0x7'))(_0x829d('0x8'));var config=require(_0x829d('0x9'));var jayson=require(_0x829d('0xa'));var client=jayson[_0x829d('0xb')][_0x829d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x436600,_0x4afc0a,_0x2e51a7){return new BPromise(function(_0x30bf3d,_0x37c419){return client['request'](_0x436600,_0x2e51a7)['then'](function(_0x218f0a){logger[_0x829d('0xd')](_0x829d('0xe'),_0x4afc0a,_0x829d('0xf'));logger[_0x829d('0x10')](_0x829d('0x11'),_0x4afc0a,_0x829d('0xf'),JSON[_0x829d('0x12')](_0x218f0a));if(_0x218f0a[_0x829d('0x13')]){if(_0x218f0a['error'][_0x829d('0x14')]===0x1f4){logger['error'](_0x829d('0xe'),_0x4afc0a,_0x218f0a[_0x829d('0x13')][_0x829d('0x15')]);return _0x37c419(_0x218f0a[_0x829d('0x13')][_0x829d('0x15')]);}logger[_0x829d('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x4afc0a,_0x218f0a[_0x829d('0x13')][_0x829d('0x15')]);return _0x30bf3d(_0x218f0a['error'][_0x829d('0x15')]);}else{logger['info'](_0x829d('0xe'),_0x4afc0a,'request\x20sent');_0x30bf3d(_0x218f0a[_0x829d('0x16')][_0x829d('0x15')]);}})['catch'](function(_0x2d248c){logger[_0x829d('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x4afc0a,_0x2d248c);_0x37c419(_0x2d248c);});});}exports[_0x829d('0x17')]=function(_0x59cd33){var _0x3af7dc=this;return new Promise(function(_0x2c4937,_0x4954a0){return db[_0x829d('0x18')][_0x829d('0x19')]({'raw':_0x59cd33['options']?_0x59cd33[_0x829d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x59cd33[_0x829d('0x1a')]?_0x59cd33[_0x829d('0x1a')][_0x829d('0x1b')]||null:null,'attributes':_0x59cd33['options']?_0x59cd33[_0x829d('0x1a')][_0x829d('0x1c')]||null:null,'limit':_0x59cd33[_0x829d('0x1a')]?_0x59cd33['options']['limit']||null:null,'include':_0x59cd33[_0x829d('0x1a')]?_0x59cd33[_0x829d('0x1a')][_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x59cd33['options'][_0x829d('0x1d')],function(_0x16e6d3){return{'model':db[_0x16e6d3[_0x829d('0x1f')]],'as':_0x16e6d3['as'],'attributes':_0x16e6d3[_0x829d('0x1c')],'include':_0x16e6d3[_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x16e6d3['include'],function(_0x569b9c){return{'model':db[_0x569b9c[_0x829d('0x1f')]],'as':_0x569b9c['as'],'attributes':_0x569b9c[_0x829d('0x1c')],'include':_0x569b9c['include']?_[_0x829d('0x1e')](_0x569b9c[_0x829d('0x1d')],function(_0x4aeec9){return{'model':db[_0x4aeec9[_0x829d('0x1f')]],'as':_0x4aeec9['as'],'attributes':_0x4aeec9[_0x829d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x829d('0x20')](function(_0x6bbd4c){logger[_0x829d('0xd')](_0x829d('0x17'),_0x59cd33);logger[_0x829d('0x10')](_0x829d('0x17'),_0x59cd33,JSON[_0x829d('0x12')](_0x6bbd4c));_0x2c4937(_0x6bbd4c);})['catch'](function(_0x4f4291){logger[_0x829d('0x13')]('GetSugarcrmAccount',_0x4f4291[_0x829d('0x15')],_0x59cd33);_0x4954a0(_0x3af7dc[_0x829d('0x13')](0x1f4,_0x4f4291[_0x829d('0x15')]));});});};exports['ShowSugarcrmAccount']=function(_0x334690){var _0x3f07c6=this;return new Promise(function(_0x3ff7e3,_0x1f0b61){return db[_0x829d('0x18')]['find']({'raw':_0x334690[_0x829d('0x1a')]?_0x334690[_0x829d('0x1a')][_0x829d('0x21')]===undefined?!![]:![]:!![],'where':_0x334690[_0x829d('0x1a')]?_0x334690['options']['where']||null:null,'attributes':_0x334690['options']?_0x334690[_0x829d('0x1a')][_0x829d('0x1c')]||null:null,'include':_0x334690[_0x829d('0x1a')]?_0x334690[_0x829d('0x1a')][_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x334690[_0x829d('0x1a')][_0x829d('0x1d')],function(_0x25f625){return{'model':db[_0x25f625[_0x829d('0x1f')]],'as':_0x25f625['as'],'attributes':_0x25f625['attributes'],'include':_0x25f625[_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x25f625[_0x829d('0x1d')],function(_0x111e10){return{'model':db[_0x111e10[_0x829d('0x1f')]],'as':_0x111e10['as'],'attributes':_0x111e10[_0x829d('0x1c')],'include':_0x111e10[_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x111e10['include'],function(_0x4c69b3){return{'model':db[_0x4c69b3[_0x829d('0x1f')]],'as':_0x4c69b3['as'],'attributes':_0x4c69b3[_0x829d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x829d('0x20')](function(_0x28842a){logger['info'](_0x829d('0x22'),_0x334690);logger[_0x829d('0x10')](_0x829d('0x22'),_0x334690,JSON[_0x829d('0x12')](_0x28842a));_0x3ff7e3(_0x28842a);})[_0x829d('0x23')](function(_0x1f63e8){logger[_0x829d('0x13')](_0x829d('0x22'),_0x1f63e8['message'],_0x334690);_0x1f0b61(_0x3f07c6[_0x829d('0x13')](0x1f4,_0x1f63e8[_0x829d('0x15')]));});});}; \ No newline at end of file +var _0x9f83=['message','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetSugarcrmAccount','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x23758f,_0x23c4f0){var _0x5534f0=function(_0x40c011){while(--_0x40c011){_0x23758f['push'](_0x23758f['shift']());}};_0x5534f0(++_0x23c4f0);}(_0x9f83,0x12e));var _0x39f8=function(_0x3eb6d5,_0x130a5e){_0x3eb6d5=_0x3eb6d5-0x0;var _0x4ca11a=_0x9f83[_0x3eb6d5];return _0x4ca11a;};'use strict';var _=require(_0x39f8('0x0'));var util=require(_0x39f8('0x1'));var moment=require(_0x39f8('0x2'));var BPromise=require(_0x39f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39f8('0x4'));var db=require(_0x39f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x39f8('0x6'));var config=require(_0x39f8('0x7'));var jayson=require(_0x39f8('0x8'));var client=jayson[_0x39f8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27f4a9,_0x490dde,_0x1314e6){return new BPromise(function(_0x40280b,_0x5beff1){return client[_0x39f8('0xa')](_0x27f4a9,_0x1314e6)['then'](function(_0x1351d2){logger[_0x39f8('0xb')](_0x39f8('0xc'),_0x490dde,'request\x20sent');logger[_0x39f8('0xd')](_0x39f8('0xe'),_0x490dde,_0x39f8('0xf'),JSON[_0x39f8('0x10')](_0x1351d2));if(_0x1351d2[_0x39f8('0x11')]){if(_0x1351d2['error']['code']===0x1f4){logger[_0x39f8('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x490dde,_0x1351d2[_0x39f8('0x11')][_0x39f8('0x12')]);return _0x5beff1(_0x1351d2[_0x39f8('0x11')][_0x39f8('0x12')]);}logger[_0x39f8('0x11')](_0x39f8('0xc'),_0x490dde,_0x1351d2[_0x39f8('0x11')][_0x39f8('0x12')]);return _0x40280b(_0x1351d2[_0x39f8('0x11')][_0x39f8('0x12')]);}else{logger[_0x39f8('0xb')](_0x39f8('0xc'),_0x490dde,'request\x20sent');_0x40280b(_0x1351d2['result']['message']);}})[_0x39f8('0x13')](function(_0x457fdd){logger['error'](_0x39f8('0xc'),_0x490dde,_0x457fdd);_0x5beff1(_0x457fdd);});});}exports['GetSugarcrmAccount']=function(_0x2adb9d){var _0x113ad0=this;return new Promise(function(_0x4f18be,_0x1b47b9){return db['SugarcrmAccount'][_0x39f8('0x14')]({'raw':_0x2adb9d[_0x39f8('0x15')]?_0x2adb9d[_0x39f8('0x15')][_0x39f8('0x16')]===undefined?!![]:![]:!![],'where':_0x2adb9d[_0x39f8('0x15')]?_0x2adb9d[_0x39f8('0x15')][_0x39f8('0x17')]||null:null,'attributes':_0x2adb9d[_0x39f8('0x15')]?_0x2adb9d[_0x39f8('0x15')][_0x39f8('0x18')]||null:null,'limit':_0x2adb9d['options']?_0x2adb9d[_0x39f8('0x15')][_0x39f8('0x19')]||null:null,'include':_0x2adb9d[_0x39f8('0x15')]?_0x2adb9d[_0x39f8('0x15')][_0x39f8('0x1a')]?_[_0x39f8('0x1b')](_0x2adb9d['options']['include'],function(_0x1b1f67){return{'model':db[_0x1b1f67[_0x39f8('0x1c')]],'as':_0x1b1f67['as'],'attributes':_0x1b1f67['attributes'],'include':_0x1b1f67[_0x39f8('0x1a')]?_['map'](_0x1b1f67[_0x39f8('0x1a')],function(_0x375b64){return{'model':db[_0x375b64[_0x39f8('0x1c')]],'as':_0x375b64['as'],'attributes':_0x375b64[_0x39f8('0x18')],'include':_0x375b64[_0x39f8('0x1a')]?_['map'](_0x375b64[_0x39f8('0x1a')],function(_0x4dbdae){return{'model':db[_0x4dbdae[_0x39f8('0x1c')]],'as':_0x4dbdae['as'],'attributes':_0x4dbdae[_0x39f8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x39f8('0x1d')](function(_0xcd71f){logger[_0x39f8('0xb')](_0x39f8('0x1e'),_0x2adb9d);logger[_0x39f8('0xd')]('GetSugarcrmAccount',_0x2adb9d,JSON['stringify'](_0xcd71f));_0x4f18be(_0xcd71f);})[_0x39f8('0x13')](function(_0x2df12c){logger[_0x39f8('0x11')]('GetSugarcrmAccount',_0x2df12c['message'],_0x2adb9d);_0x1b47b9(_0x113ad0[_0x39f8('0x11')](0x1f4,_0x2df12c[_0x39f8('0x12')]));});});};exports[_0x39f8('0x1f')]=function(_0x304c13){var _0xdbf8e7=this;return new Promise(function(_0x58b1ea,_0x158784){return db['SugarcrmAccount']['find']({'raw':_0x304c13[_0x39f8('0x15')]?_0x304c13[_0x39f8('0x15')][_0x39f8('0x16')]===undefined?!![]:![]:!![],'where':_0x304c13[_0x39f8('0x15')]?_0x304c13[_0x39f8('0x15')]['where']||null:null,'attributes':_0x304c13['options']?_0x304c13[_0x39f8('0x15')][_0x39f8('0x18')]||null:null,'include':_0x304c13[_0x39f8('0x15')]?_0x304c13[_0x39f8('0x15')][_0x39f8('0x1a')]?_[_0x39f8('0x1b')](_0x304c13[_0x39f8('0x15')]['include'],function(_0x20e9f3){return{'model':db[_0x20e9f3[_0x39f8('0x1c')]],'as':_0x20e9f3['as'],'attributes':_0x20e9f3['attributes'],'include':_0x20e9f3[_0x39f8('0x1a')]?_[_0x39f8('0x1b')](_0x20e9f3[_0x39f8('0x1a')],function(_0x2a2da3){return{'model':db[_0x2a2da3[_0x39f8('0x1c')]],'as':_0x2a2da3['as'],'attributes':_0x2a2da3[_0x39f8('0x18')],'include':_0x2a2da3[_0x39f8('0x1a')]?_[_0x39f8('0x1b')](_0x2a2da3[_0x39f8('0x1a')],function(_0x3dd6bd){return{'model':db[_0x3dd6bd[_0x39f8('0x1c')]],'as':_0x3dd6bd['as'],'attributes':_0x3dd6bd[_0x39f8('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42d8c0){logger[_0x39f8('0xb')]('ShowSugarcrmAccount',_0x304c13);logger[_0x39f8('0xd')](_0x39f8('0x1f'),_0x304c13,JSON[_0x39f8('0x10')](_0x42d8c0));_0x58b1ea(_0x42d8c0);})[_0x39f8('0x13')](function(_0x5f23fc){logger['error'](_0x39f8('0x1f'),_0x5f23fc['message'],_0x304c13);_0x158784(_0xdbf8e7[_0x39f8('0x11')](0x1f4,_0x5f23fc['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index cda5de7..d7d639a 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 _0xa5fd=['/:id','isAuthenticated','show','getFields','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmConfiguration.controller','get'];(function(_0x5525a7,_0x3437c2){var _0x3503dc=function(_0x1cebca){while(--_0x1cebca){_0x5525a7['push'](_0x5525a7['shift']());}};_0x3503dc(++_0x3437c2);}(_0xa5fd,0x186));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xda5f('0x0'));var util=require('util');var path=require(_0xda5f('0x1'));var timeout=require(_0xda5f('0x2'));var express=require(_0xda5f('0x3'));var router=express[_0xda5f('0x4')]();var fs_extra=require(_0xda5f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xda5f('0x6'));var config=require('../../config/environment');var controller=require(_0xda5f('0x7'));router[_0xda5f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda5f('0x8')](_0xda5f('0x9'),auth[_0xda5f('0xa')](),controller[_0xda5f('0xb')]);router[_0xda5f('0x8')]('/:id/fields',auth[_0xda5f('0xa')](),controller[_0xda5f('0xc')]);router[_0xda5f('0x8')]('/:id/subjects',auth[_0xda5f('0xa')](),controller[_0xda5f('0xd')]);router[_0xda5f('0x8')]('/:id/descriptions',auth[_0xda5f('0xa')](),controller[_0xda5f('0xe')]);router[_0xda5f('0xf')]('/',auth[_0xda5f('0xa')](),controller[_0xda5f('0x10')]);router['put']('/:id',auth[_0xda5f('0xa')](),controller[_0xda5f('0x11')]);router[_0xda5f('0x12')](_0xda5f('0x9'),auth[_0xda5f('0xa')](),controller[_0xda5f('0x13')]);module[_0xda5f('0x14')]=router; \ No newline at end of file +var _0x0b4b=['/:id/fields','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x0b4b,0x171));var _0xb0b4=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x0b4b[_0x492535];return _0x256620;};'use strict';var multer=require(_0xb0b4('0x0'));var util=require(_0xb0b4('0x1'));var path=require(_0xb0b4('0x2'));var timeout=require(_0xb0b4('0x3'));var express=require(_0xb0b4('0x4'));var router=express[_0xb0b4('0x5')]();var fs_extra=require(_0xb0b4('0x6'));var auth=require(_0xb0b4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb0b4('0x8'));var controller=require(_0xb0b4('0x9'));router[_0xb0b4('0xa')]('/',auth[_0xb0b4('0xb')](),controller[_0xb0b4('0xc')]);router['get'](_0xb0b4('0xd'),auth['isAuthenticated'](),controller[_0xb0b4('0xe')]);router[_0xb0b4('0xa')](_0xb0b4('0xf'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0xb0b4('0xb')](),controller['getSubjects']);router[_0xb0b4('0xa')]('/:id/descriptions',auth[_0xb0b4('0xb')](),controller[_0xb0b4('0x10')]);router[_0xb0b4('0x11')]('/',auth['isAuthenticated'](),controller[_0xb0b4('0x12')]);router[_0xb0b4('0x13')]('/:id',auth[_0xb0b4('0xb')](),controller[_0xb0b4('0x14')]);router[_0xb0b4('0x15')]('/:id',auth[_0xb0b4('0xb')](),controller[_0xb0b4('0x16')]);module[_0xb0b4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index fa3555a..4954a22 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 _0x642d=['sequelize','exports','STRING'];(function(_0x489806,_0x3cee0f){var _0x126746=function(_0x2edc62){while(--_0x2edc62){_0x489806['push'](_0x489806['shift']());}};_0x126746(++_0x3cee0f);}(_0x642d,0x1b3));var _0xd642=function(_0x129621,_0x1e4291){_0x129621=_0x129621-0x0;var _0xa472d2=_0x642d[_0x129621];return _0xa472d2;};'use strict';var Sequelize=require(_0xd642('0x0'));module[_0xd642('0x1')]={'name':{'type':Sequelize[_0xd642('0x2')]},'description':{'type':Sequelize[_0xd642('0x2')]}}; \ No newline at end of file +var _0x492e=['sequelize','exports','STRING'];(function(_0x28103d,_0x421f1b){var _0xe84b14=function(_0xc1a8c7){while(--_0xc1a8c7){_0x28103d['push'](_0x28103d['shift']());}};_0xe84b14(++_0x421f1b);}(_0x492e,0x141));var _0xe492=function(_0x384399,_0x4f5223){_0x384399=_0x384399-0x0;var _0x4f0439=_0x492e[_0x384399];return _0x4f0439;};'use strict';var Sequelize=require(_0xe492('0x0'));module[_0xe492('0x1')]={'name':{'type':Sequelize[_0xe492('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 73005f0..b747a4f 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 _0x759c=['where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','findOne','SugarcrmField','getFields','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0xbece55,_0x5761e4){var _0x376eae=function(_0x5986bf){while(--_0x5986bf){_0xbece55['push'](_0xbece55['shift']());}};_0x376eae(++_0x5761e4);}(_0x759c,0x1b8));var _0xc759=function(_0x33dfe3,_0x1d0201){_0x33dfe3=_0x33dfe3-0x0;var _0xbd12e8=_0x759c[_0x33dfe3];return _0xbd12e8;};'use strict';var emlformat=require(_0xc759('0x0'));var rimraf=require(_0xc759('0x1'));var zipdir=require(_0xc759('0x2'));var jsonpatch=require(_0xc759('0x3'));var rp=require(_0xc759('0x4'));var moment=require(_0xc759('0x5'));var BPromise=require(_0xc759('0x6'));var Mustache=require(_0xc759('0x7'));var util=require(_0xc759('0x8'));var path=require('path');var sox=require(_0xc759('0x9'));var csv=require(_0xc759('0xa'));var ejs=require(_0xc759('0xb'));var fs=require('fs');var fs_extra=require(_0xc759('0xc'));var _=require('lodash');var squel=require(_0xc759('0xd'));var crypto=require(_0xc759('0xe'));var jsforce=require(_0xc759('0xf'));var deskjs=require(_0xc759('0x10'));var toCsv=require(_0xc759('0xa'));var querystring=require(_0xc759('0x11'));var Papa=require(_0xc759('0x12'));var Redis=require(_0xc759('0x13'));var authService=require(_0xc759('0x14'));var qs=require(_0xc759('0x15'));var as=require(_0xc759('0x16'));var hardwareService=require(_0xc759('0x17'));var logger=require(_0xc759('0x18'))(_0xc759('0x19'));var utils=require(_0xc759('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc759('0x1b'))['db'];function respondWithStatusCode(_0xb6b3bd,_0x34fedc){_0x34fedc=_0x34fedc||0xcc;return function(_0x321967){if(_0x321967){return _0xb6b3bd['sendStatus'](_0x34fedc);}return _0xb6b3bd[_0xc759('0x1c')](_0x34fedc)[_0xc759('0x1d')]();};}function respondWithResult(_0x475635,_0x3b2bba){_0x3b2bba=_0x3b2bba||0xc8;return function(_0x514ec6){if(_0x514ec6){return _0x475635[_0xc759('0x1c')](_0x3b2bba)['json'](_0x514ec6);}};}function respondWithFilteredResult(_0x50855e,_0x3d4eaf){return function(_0x441c12){if(_0x441c12){var _0x4d7ac5=typeof _0x3d4eaf['offset']==='undefined'&&typeof _0x3d4eaf[_0xc759('0x1e')]==='undefined';var _0x59cc90=_0x441c12[_0xc759('0x1f')];var _0x457c68=_0x4d7ac5?0x0:_0x3d4eaf['offset'];var _0x55a8ae=_0x4d7ac5?_0x441c12['count']:_0x3d4eaf[_0xc759('0x20')]+_0x3d4eaf[_0xc759('0x1e')];var _0x24f903;if(_0x55a8ae>=_0x59cc90){_0x55a8ae=_0x59cc90;_0x24f903=0xc8;}else{_0x24f903=0xce;}_0x50855e[_0xc759('0x1c')](_0x24f903);return _0x50855e['set'](_0xc759('0x21'),_0x457c68+'-'+_0x55a8ae+'/'+_0x59cc90)[_0xc759('0x22')](_0x441c12);}return null;};}function patchUpdates(_0x180f02){return function(_0x5a057e){try{jsonpatch[_0xc759('0x23')](_0x5a057e,_0x180f02,!![]);}catch(_0x46de0e){return BPromise[_0xc759('0x24')](_0x46de0e);}return _0x5a057e[_0xc759('0x25')]();};}function saveUpdates(_0x6b7500,_0x5eb855){return function(_0x5f2706){if(_0x5f2706){return _0x5f2706[_0xc759('0x26')](_0x6b7500)[_0xc759('0x27')](function(_0x3eeb5a){return _0x3eeb5a;});}return null;};}function removeEntity(_0x572040,_0xee6d3e){return function(_0x127329){if(_0x127329){return _0x127329[_0xc759('0x28')]()[_0xc759('0x27')](function(){_0x572040[_0xc759('0x1c')](0xcc)[_0xc759('0x1d')]();});}};}function handleEntityNotFound(_0x13465e,_0x255437){return function(_0x2f2cff){if(!_0x2f2cff){_0x13465e[_0xc759('0x29')](0x194);}return _0x2f2cff;};}function handleError(_0xb70aa1,_0x1bcca8){_0x1bcca8=_0x1bcca8||0x1f4;return function(_0x4bd7a0){logger[_0xc759('0x2a')](_0x4bd7a0[_0xc759('0x2b')]);if(_0x4bd7a0[_0xc759('0x2c')]){delete _0x4bd7a0['name'];}_0xb70aa1[_0xc759('0x1c')](_0x1bcca8)[_0xc759('0x2d')](_0x4bd7a0);};}exports[_0xc759('0x2e')]=function(_0x304db1,_0x595058){var _0x219a15={},_0x19c9d1={},_0x2a4714={'count':0x0,'rows':[]};var _0x8cd3c0=_[_0xc759('0x2f')](db[_0xc759('0x30')][_0xc759('0x31')],function(_0x35c015){return{'name':_0x35c015[_0xc759('0x32')],'type':_0x35c015[_0xc759('0x33')][_0xc759('0x34')]};});_0x19c9d1[_0xc759('0x35')]=_['map'](_0x8cd3c0,_0xc759('0x2c'));_0x19c9d1[_0xc759('0x36')]=_[_0xc759('0x37')](_0x304db1[_0xc759('0x36')]);_0x19c9d1[_0xc759('0x38')]=_[_0xc759('0x39')](_0x19c9d1['model'],_0x19c9d1[_0xc759('0x36')]);_0x219a15[_0xc759('0x3a')]=_[_0xc759('0x39')](_0x19c9d1[_0xc759('0x35')],qs[_0xc759('0x3b')](_0x304db1[_0xc759('0x36')]['fields']));_0x219a15[_0xc759('0x3a')]=_0x219a15['attributes'][_0xc759('0x3c')]?_0x219a15['attributes']:_0x19c9d1[_0xc759('0x35')];if(!_0x304db1[_0xc759('0x36')][_0xc759('0x3d')](_0xc759('0x3e'))){_0x219a15[_0xc759('0x1e')]=qs['limit'](_0x304db1['query'][_0xc759('0x1e')]);_0x219a15['offset']=qs['offset'](_0x304db1[_0xc759('0x36')]['offset']);}_0x219a15['order']=qs[_0xc759('0x3f')](_0x304db1[_0xc759('0x36')][_0xc759('0x3f')]);_0x219a15[_0xc759('0x40')]=qs[_0xc759('0x38')](_[_0xc759('0x41')](_0x304db1[_0xc759('0x36')],_0x19c9d1[_0xc759('0x38')]),_0x8cd3c0);if(_0x304db1[_0xc759('0x36')][_0xc759('0x42')]){_0x219a15[_0xc759('0x40')]=_[_0xc759('0x43')](_0x219a15[_0xc759('0x40')],{'$or':_[_0xc759('0x2f')](_0x8cd3c0,function(_0x170944){if(_0x170944[_0xc759('0x33')]!==_0xc759('0x44')){var _0xe36c1e={};_0xe36c1e[_0x170944[_0xc759('0x2c')]]={'$like':'%'+_0x304db1[_0xc759('0x36')]['filter']+'%'};return _0xe36c1e;}})});}_0x219a15=_[_0xc759('0x43')]({},_0x219a15,_0x304db1[_0xc759('0x45')]);var _0x5a3368={'where':_0x219a15[_0xc759('0x40')]};return db[_0xc759('0x30')]['count'](_0x5a3368)[_0xc759('0x27')](function(_0x1e5e61){_0x2a4714[_0xc759('0x1f')]=_0x1e5e61;if(_0x304db1[_0xc759('0x36')][_0xc759('0x46')]){_0x219a15['include']=[{'all':!![]}];}return db[_0xc759('0x30')][_0xc759('0x47')](_0x219a15);})[_0xc759('0x27')](function(_0x4b6216){_0x2a4714[_0xc759('0x48')]=_0x4b6216;return _0x2a4714;})[_0xc759('0x27')](respondWithFilteredResult(_0x595058,_0x219a15))[_0xc759('0x49')](handleError(_0x595058,null));};exports['show']=function(_0x3c483b,_0x1e0e03){var _0x10f481={'raw':![],'where':{'id':_0x3c483b[_0xc759('0x4a')]['id']}},_0x5b6f94={};_0x5b6f94['model']=_['keys'](db[_0xc759('0x30')][_0xc759('0x31')]);_0x5b6f94[_0xc759('0x36')]=_[_0xc759('0x37')](_0x3c483b[_0xc759('0x36')]);_0x5b6f94[_0xc759('0x38')]=_['intersection'](_0x5b6f94['model'],_0x5b6f94[_0xc759('0x36')]);_0x10f481[_0xc759('0x3a')]=_[_0xc759('0x39')](_0x5b6f94[_0xc759('0x35')],qs['fields'](_0x3c483b[_0xc759('0x36')]['fields']));_0x10f481[_0xc759('0x3a')]=_0x10f481[_0xc759('0x3a')][_0xc759('0x3c')]?_0x10f481[_0xc759('0x3a')]:_0x5b6f94['model'];if(_0x3c483b['query'][_0xc759('0x46')]){_0x10f481['include']=[{'all':!![]}];}_0x10f481=_['merge']({},_0x10f481,_0x3c483b[_0xc759('0x45')]);return db['SugarcrmConfiguration'][_0xc759('0x4b')](_0x10f481)[_0xc759('0x27')](handleEntityNotFound(_0x1e0e03,null))[_0xc759('0x27')](respondWithResult(_0x1e0e03,null))['catch'](handleError(_0x1e0e03,null));};exports['create']=function(_0x271bef,_0x263482){return db[_0xc759('0x30')][_0xc759('0x4c')](_0x271bef['body'],{})[_0xc759('0x27')](respondWithResult(_0x263482,0xc9))[_0xc759('0x49')](handleError(_0x263482,null));};exports[_0xc759('0x26')]=function(_0x234084,_0x243ba8){if(_0x234084[_0xc759('0x4d')]['id']){delete _0x234084['body']['id'];}return db[_0xc759('0x30')]['find']({'where':{'id':_0x234084[_0xc759('0x4a')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x243ba8,null))[_0xc759('0x27')](saveUpdates(_0x234084[_0xc759('0x4d')],null))[_0xc759('0x27')](respondWithResult(_0x243ba8,null))['catch'](handleError(_0x243ba8,null));};exports[_0xc759('0x28')]=function(_0x56d10e,_0x5a3419){return db['SugarcrmConfiguration'][_0xc759('0x4b')]({'where':{'id':_0x56d10e[_0xc759('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5a3419,null))[_0xc759('0x27')](removeEntity(_0x5a3419,null))[_0xc759('0x49')](handleError(_0x5a3419,null));};exports['getFields']=function(_0x4ae829,_0x5d5f53,_0x35d723){var _0x3b6760={};var _0x46f3d7={};var _0x161cee;var _0x58bc4a;return db['SugarcrmConfiguration'][_0xc759('0x4e')]({'where':{'id':_0x4ae829[_0xc759('0x4a')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x5d5f53,null))[_0xc759('0x27')](function(_0x434429){if(_0x434429){_0x161cee=_0x434429;_0x46f3d7[_0xc759('0x35')]=_[_0xc759('0x37')](db[_0xc759('0x4f')][_0xc759('0x31')]);_0x46f3d7['query']=_['keys'](_0x4ae829[_0xc759('0x36')]);_0x46f3d7[_0xc759('0x38')]=_[_0xc759('0x39')](_0x46f3d7['model'],_0x46f3d7[_0xc759('0x36')]);_0x3b6760[_0xc759('0x3a')]=_[_0xc759('0x39')](_0x46f3d7['model'],qs[_0xc759('0x3b')](_0x4ae829['query']['fields']));_0x3b6760['attributes']=_0x3b6760[_0xc759('0x3a')][_0xc759('0x3c')]?_0x3b6760[_0xc759('0x3a')]:_0x46f3d7[_0xc759('0x35')];_0x3b6760['order']=qs['sort'](_0x4ae829[_0xc759('0x36')][_0xc759('0x3f')]);_0x3b6760['where']=qs[_0xc759('0x38')](_[_0xc759('0x41')](_0x4ae829[_0xc759('0x36')],_0x46f3d7[_0xc759('0x38')]));if(_0x4ae829[_0xc759('0x36')]['filter']){_0x3b6760[_0xc759('0x40')]=_[_0xc759('0x43')](_0x3b6760[_0xc759('0x40')],{'$or':_['map'](_0x3b6760[_0xc759('0x3a')],function(_0x2b9df3){var _0x8a1488={};_0x8a1488[_0x2b9df3]={'$like':'%'+_0x4ae829[_0xc759('0x36')][_0xc759('0x42')]+'%'};return _0x8a1488;})});}_0x3b6760=_[_0xc759('0x43')]({},_0x3b6760,_0x4ae829[_0xc759('0x45')]);return _0x161cee[_0xc759('0x50')](_0x3b6760);}})[_0xc759('0x27')](function(_0x33b8af){if(_0x33b8af){_0x58bc4a=_0x33b8af['length'];if(!_0x4ae829['query'][_0xc759('0x3d')](_0xc759('0x3e'))){_0x3b6760['limit']=qs[_0xc759('0x1e')](_0x4ae829[_0xc759('0x36')][_0xc759('0x1e')]);_0x3b6760[_0xc759('0x20')]=qs[_0xc759('0x20')](_0x4ae829[_0xc759('0x36')]['offset']);}return _0x161cee[_0xc759('0x50')](_0x3b6760);}})[_0xc759('0x27')](function(_0x3a0b02){if(_0x3a0b02){return _0x3a0b02?{'count':_0x58bc4a,'rows':_0x3a0b02}:null;}})[_0xc759('0x27')](respondWithResult(_0x5d5f53,null))[_0xc759('0x49')](handleError(_0x5d5f53,null));};exports[_0xc759('0x51')]=function(_0x1dd46f,_0x27dc56,_0x6f0410){var _0x4c4fea={};var _0xcf83de={};var _0x28d04f;var _0x4510c2;return db[_0xc759('0x30')][_0xc759('0x4e')]({'where':{'id':_0x1dd46f[_0xc759('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27dc56,null))['then'](function(_0x5b5cee){if(_0x5b5cee){_0x28d04f=_0x5b5cee;_0xcf83de[_0xc759('0x35')]=_[_0xc759('0x37')](db[_0xc759('0x4f')][_0xc759('0x31')]);_0xcf83de[_0xc759('0x36')]=_['keys'](_0x1dd46f[_0xc759('0x36')]);_0xcf83de[_0xc759('0x38')]=_['intersection'](_0xcf83de['model'],_0xcf83de[_0xc759('0x36')]);_0x4c4fea['attributes']=_['intersection'](_0xcf83de[_0xc759('0x35')],qs[_0xc759('0x3b')](_0x1dd46f[_0xc759('0x36')][_0xc759('0x3b')]));_0x4c4fea[_0xc759('0x3a')]=_0x4c4fea[_0xc759('0x3a')][_0xc759('0x3c')]?_0x4c4fea[_0xc759('0x3a')]:_0xcf83de[_0xc759('0x35')];_0x4c4fea[_0xc759('0x52')]=qs['sort'](_0x1dd46f[_0xc759('0x36')][_0xc759('0x3f')]);_0x4c4fea[_0xc759('0x40')]=qs['filters'](_[_0xc759('0x41')](_0x1dd46f['query'],_0xcf83de[_0xc759('0x38')]));if(_0x1dd46f[_0xc759('0x36')][_0xc759('0x42')]){_0x4c4fea[_0xc759('0x40')]=_[_0xc759('0x43')](_0x4c4fea[_0xc759('0x40')],{'$or':_['map'](_0x4c4fea[_0xc759('0x3a')],function(_0x1e8eed){var _0x4d44fc={};_0x4d44fc[_0x1e8eed]={'$like':'%'+_0x1dd46f[_0xc759('0x36')]['filter']+'%'};return _0x4d44fc;})});}_0x4c4fea=_['merge']({},_0x4c4fea,_0x1dd46f['options']);return _0x28d04f[_0xc759('0x51')](_0x4c4fea);}})[_0xc759('0x27')](function(_0x1107a0){if(_0x1107a0){_0x4510c2=_0x1107a0['length'];if(!_0x1dd46f['query']['hasOwnProperty']('nolimit')){_0x4c4fea['limit']=qs['limit'](_0x1dd46f['query']['limit']);_0x4c4fea[_0xc759('0x20')]=qs[_0xc759('0x20')](_0x1dd46f[_0xc759('0x36')][_0xc759('0x20')]);}return _0x28d04f['getSubjects'](_0x4c4fea);}})[_0xc759('0x27')](function(_0x24a0a0){if(_0x24a0a0){return _0x24a0a0?{'count':_0x4510c2,'rows':_0x24a0a0}:null;}})[_0xc759('0x27')](respondWithResult(_0x27dc56,null))[_0xc759('0x49')](handleError(_0x27dc56,null));};exports['getDescriptions']=function(_0x264dc0,_0x4ff229,_0x6defc7){var _0x9ff316={};var _0xde1862={};var _0x442bb1;var _0x20d94b;return db['SugarcrmConfiguration'][_0xc759('0x4e')]({'where':{'id':_0x264dc0['params']['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x4ff229,null))['then'](function(_0x4fc07e){if(_0x4fc07e){_0x442bb1=_0x4fc07e;_0xde1862[_0xc759('0x35')]=_[_0xc759('0x37')](db[_0xc759('0x4f')]['rawAttributes']);_0xde1862[_0xc759('0x36')]=_[_0xc759('0x37')](_0x264dc0[_0xc759('0x36')]);_0xde1862['filters']=_[_0xc759('0x39')](_0xde1862[_0xc759('0x35')],_0xde1862[_0xc759('0x36')]);_0x9ff316[_0xc759('0x3a')]=_[_0xc759('0x39')](_0xde1862['model'],qs['fields'](_0x264dc0[_0xc759('0x36')][_0xc759('0x3b')]));_0x9ff316[_0xc759('0x3a')]=_0x9ff316[_0xc759('0x3a')][_0xc759('0x3c')]?_0x9ff316[_0xc759('0x3a')]:_0xde1862[_0xc759('0x35')];_0x9ff316[_0xc759('0x52')]=qs[_0xc759('0x3f')](_0x264dc0[_0xc759('0x36')]['sort']);_0x9ff316[_0xc759('0x40')]=qs[_0xc759('0x38')](_[_0xc759('0x41')](_0x264dc0['query'],_0xde1862[_0xc759('0x38')]));if(_0x264dc0['query'][_0xc759('0x42')]){_0x9ff316['where']=_[_0xc759('0x43')](_0x9ff316[_0xc759('0x40')],{'$or':_[_0xc759('0x2f')](_0x9ff316[_0xc759('0x3a')],function(_0x5c4100){var _0x4159e3={};_0x4159e3[_0x5c4100]={'$like':'%'+_0x264dc0[_0xc759('0x36')][_0xc759('0x42')]+'%'};return _0x4159e3;})});}_0x9ff316=_[_0xc759('0x43')]({},_0x9ff316,_0x264dc0['options']);return _0x442bb1[_0xc759('0x53')](_0x9ff316);}})[_0xc759('0x27')](function(_0x3226f6){if(_0x3226f6){_0x20d94b=_0x3226f6['length'];if(!_0x264dc0[_0xc759('0x36')][_0xc759('0x3d')]('nolimit')){_0x9ff316[_0xc759('0x1e')]=qs['limit'](_0x264dc0[_0xc759('0x36')]['limit']);_0x9ff316['offset']=qs[_0xc759('0x20')](_0x264dc0[_0xc759('0x36')]['offset']);}return _0x442bb1[_0xc759('0x53')](_0x9ff316);}})[_0xc759('0x27')](function(_0x1d1920){if(_0x1d1920){return _0x1d1920?{'count':_0x20d94b,'rows':_0x1d1920}:null;}})['then'](respondWithResult(_0x4ff229,null))[_0xc759('0x49')](handleError(_0x4ff229,null));}; \ No newline at end of file +var _0xc87f=['VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','SugarcrmField','order','findOne','getSubjects','getDescriptions','nolimit','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','SugarcrmConfiguration','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','merge','map'];(function(_0x21ea37,_0x1fb05e){var _0x48bd01=function(_0x132983){while(--_0x132983){_0x21ea37['push'](_0x21ea37['shift']());}};_0x48bd01(++_0x1fb05e);}(_0xc87f,0x164));var _0xfc87=function(_0x43d725,_0x7cf037){_0x43d725=_0x43d725-0x0;var _0x5b05f5=_0xc87f[_0x43d725];return _0x5b05f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc87('0x0'));var zipdir=require(_0xfc87('0x1'));var jsonpatch=require(_0xfc87('0x2'));var rp=require('request-promise');var moment=require(_0xfc87('0x3'));var BPromise=require(_0xfc87('0x4'));var Mustache=require('mustache');var util=require(_0xfc87('0x5'));var path=require(_0xfc87('0x6'));var sox=require(_0xfc87('0x7'));var csv=require(_0xfc87('0x8'));var ejs=require(_0xfc87('0x9'));var fs=require('fs');var fs_extra=require(_0xfc87('0xa'));var _=require(_0xfc87('0xb'));var squel=require(_0xfc87('0xc'));var crypto=require(_0xfc87('0xd'));var jsforce=require(_0xfc87('0xe'));var deskjs=require(_0xfc87('0xf'));var toCsv=require(_0xfc87('0x8'));var querystring=require(_0xfc87('0x10'));var Papa=require(_0xfc87('0x11'));var Redis=require(_0xfc87('0x12'));var authService=require(_0xfc87('0x13'));var qs=require(_0xfc87('0x14'));var as=require(_0xfc87('0x15'));var hardwareService=require(_0xfc87('0x16'));var logger=require('../../config/logger')(_0xfc87('0x17'));var utils=require(_0xfc87('0x18'));var config=require(_0xfc87('0x19'));var licenseUtil=require(_0xfc87('0x1a'));var db=require(_0xfc87('0x1b'))['db'];function respondWithStatusCode(_0x343851,_0x592890){_0x592890=_0x592890||0xcc;return function(_0x4efd2e){if(_0x4efd2e){return _0x343851['sendStatus'](_0x592890);}return _0x343851['status'](_0x592890)[_0xfc87('0x1c')]();};}function respondWithResult(_0x201ed8,_0xd2bec6){_0xd2bec6=_0xd2bec6||0xc8;return function(_0x559614){if(_0x559614){return _0x201ed8[_0xfc87('0x1d')](_0xd2bec6)[_0xfc87('0x1e')](_0x559614);}};}function respondWithFilteredResult(_0x5bbb31,_0x26ff82){return function(_0x176b09){if(_0x176b09){var _0x3826b2=typeof _0x26ff82[_0xfc87('0x1f')]===_0xfc87('0x20')&&typeof _0x26ff82['limit']===_0xfc87('0x20');var _0x37c482=_0x176b09[_0xfc87('0x21')];var _0x4b231b=_0x3826b2?0x0:_0x26ff82[_0xfc87('0x1f')];var _0x183c4b=_0x3826b2?_0x176b09[_0xfc87('0x21')]:_0x26ff82['offset']+_0x26ff82[_0xfc87('0x22')];var _0x423d3f;if(_0x183c4b>=_0x37c482){_0x183c4b=_0x37c482;_0x423d3f=0xc8;}else{_0x423d3f=0xce;}_0x5bbb31[_0xfc87('0x1d')](_0x423d3f);return _0x5bbb31['set'](_0xfc87('0x23'),_0x4b231b+'-'+_0x183c4b+'/'+_0x37c482)[_0xfc87('0x1e')](_0x176b09);}return null;};}function patchUpdates(_0x4d4073){return function(_0x234439){try{jsonpatch[_0xfc87('0x24')](_0x234439,_0x4d4073,!![]);}catch(_0x20172f){return BPromise[_0xfc87('0x25')](_0x20172f);}return _0x234439['save']();};}function saveUpdates(_0x228c81,_0x197d1f){return function(_0x21d303){if(_0x21d303){return _0x21d303[_0xfc87('0x26')](_0x228c81)[_0xfc87('0x27')](function(_0x16b1f7){return _0x16b1f7;});}return null;};}function removeEntity(_0xa6a696,_0x57a9eb){return function(_0xf660e5){if(_0xf660e5){return _0xf660e5[_0xfc87('0x28')]()[_0xfc87('0x27')](function(){_0xa6a696['status'](0xcc)[_0xfc87('0x1c')]();});}};}function handleEntityNotFound(_0x265164,_0x4aea0a){return function(_0x255986){if(!_0x255986){_0x265164[_0xfc87('0x29')](0x194);}return _0x255986;};}function handleError(_0x5c6519,_0x13a48e){_0x13a48e=_0x13a48e||0x1f4;return function(_0x52541c){logger[_0xfc87('0x2a')](_0x52541c['stack']);if(_0x52541c[_0xfc87('0x2b')]){delete _0x52541c[_0xfc87('0x2b')];}_0x5c6519['status'](_0x13a48e)[_0xfc87('0x2c')](_0x52541c);};}exports[_0xfc87('0x2d')]=function(_0x57f746,_0x553f06){var _0x49a082={},_0x46e265={},_0x53f4bb={'count':0x0,'rows':[]};var _0x1f6aac=_['map'](db[_0xfc87('0x2e')]['rawAttributes'],function(_0x434714){return{'name':_0x434714[_0xfc87('0x2f')],'type':_0x434714[_0xfc87('0x30')]['key']};});_0x46e265[_0xfc87('0x31')]=_['map'](_0x1f6aac,_0xfc87('0x2b'));_0x46e265['query']=_[_0xfc87('0x32')](_0x57f746[_0xfc87('0x33')]);_0x46e265['filters']=_[_0xfc87('0x34')](_0x46e265[_0xfc87('0x31')],_0x46e265[_0xfc87('0x33')]);_0x49a082['attributes']=_[_0xfc87('0x34')](_0x46e265[_0xfc87('0x31')],qs[_0xfc87('0x35')](_0x57f746[_0xfc87('0x33')][_0xfc87('0x35')]));_0x49a082[_0xfc87('0x36')]=_0x49a082[_0xfc87('0x36')][_0xfc87('0x37')]?_0x49a082[_0xfc87('0x36')]:_0x46e265[_0xfc87('0x31')];if(!_0x57f746['query'][_0xfc87('0x38')]('nolimit')){_0x49a082[_0xfc87('0x22')]=qs['limit'](_0x57f746['query'][_0xfc87('0x22')]);_0x49a082[_0xfc87('0x1f')]=qs[_0xfc87('0x1f')](_0x57f746['query'][_0xfc87('0x1f')]);}_0x49a082['order']=qs['sort'](_0x57f746[_0xfc87('0x33')][_0xfc87('0x39')]);_0x49a082['where']=qs[_0xfc87('0x3a')](_[_0xfc87('0x3b')](_0x57f746[_0xfc87('0x33')],_0x46e265[_0xfc87('0x3a')]),_0x1f6aac);if(_0x57f746[_0xfc87('0x33')][_0xfc87('0x3c')]){_0x49a082[_0xfc87('0x3d')]=_[_0xfc87('0x3e')](_0x49a082[_0xfc87('0x3d')],{'$or':_[_0xfc87('0x3f')](_0x1f6aac,function(_0x10f39c){if(_0x10f39c[_0xfc87('0x30')]!==_0xfc87('0x40')){var _0x1ae564={};_0x1ae564[_0x10f39c[_0xfc87('0x2b')]]={'$like':'%'+_0x57f746[_0xfc87('0x33')]['filter']+'%'};return _0x1ae564;}})});}_0x49a082=_[_0xfc87('0x3e')]({},_0x49a082,_0x57f746[_0xfc87('0x41')]);var _0x1ac613={'where':_0x49a082['where']};return db[_0xfc87('0x2e')][_0xfc87('0x21')](_0x1ac613)['then'](function(_0x481603){_0x53f4bb[_0xfc87('0x21')]=_0x481603;if(_0x57f746[_0xfc87('0x33')]['includeAll']){_0x49a082[_0xfc87('0x42')]=[{'all':!![]}];}return db[_0xfc87('0x2e')][_0xfc87('0x43')](_0x49a082);})[_0xfc87('0x27')](function(_0x43f0ed){_0x53f4bb[_0xfc87('0x44')]=_0x43f0ed;return _0x53f4bb;})[_0xfc87('0x27')](respondWithFilteredResult(_0x553f06,_0x49a082))[_0xfc87('0x45')](handleError(_0x553f06,null));};exports[_0xfc87('0x46')]=function(_0x11d2d2,_0x32c6ad){var _0x168696={'raw':![],'where':{'id':_0x11d2d2[_0xfc87('0x47')]['id']}},_0x4345d0={};_0x4345d0[_0xfc87('0x31')]=_[_0xfc87('0x32')](db[_0xfc87('0x2e')][_0xfc87('0x48')]);_0x4345d0[_0xfc87('0x33')]=_[_0xfc87('0x32')](_0x11d2d2['query']);_0x4345d0[_0xfc87('0x3a')]=_[_0xfc87('0x34')](_0x4345d0[_0xfc87('0x31')],_0x4345d0[_0xfc87('0x33')]);_0x168696[_0xfc87('0x36')]=_[_0xfc87('0x34')](_0x4345d0[_0xfc87('0x31')],qs[_0xfc87('0x35')](_0x11d2d2[_0xfc87('0x33')][_0xfc87('0x35')]));_0x168696['attributes']=_0x168696[_0xfc87('0x36')]['length']?_0x168696[_0xfc87('0x36')]:_0x4345d0[_0xfc87('0x31')];if(_0x11d2d2[_0xfc87('0x33')][_0xfc87('0x49')]){_0x168696[_0xfc87('0x42')]=[{'all':!![]}];}_0x168696=_[_0xfc87('0x3e')]({},_0x168696,_0x11d2d2[_0xfc87('0x41')]);return db[_0xfc87('0x2e')][_0xfc87('0x4a')](_0x168696)[_0xfc87('0x27')](handleEntityNotFound(_0x32c6ad,null))[_0xfc87('0x27')](respondWithResult(_0x32c6ad,null))[_0xfc87('0x45')](handleError(_0x32c6ad,null));};exports[_0xfc87('0x4b')]=function(_0x138235,_0x261b3a){return db['SugarcrmConfiguration'][_0xfc87('0x4b')](_0x138235[_0xfc87('0x4c')],{})[_0xfc87('0x27')](respondWithResult(_0x261b3a,0xc9))[_0xfc87('0x45')](handleError(_0x261b3a,null));};exports['update']=function(_0xacab86,_0x2eb753){if(_0xacab86['body']['id']){delete _0xacab86['body']['id'];}return db[_0xfc87('0x2e')][_0xfc87('0x4a')]({'where':{'id':_0xacab86[_0xfc87('0x47')]['id']}})[_0xfc87('0x27')](handleEntityNotFound(_0x2eb753,null))['then'](saveUpdates(_0xacab86[_0xfc87('0x4c')],null))[_0xfc87('0x27')](respondWithResult(_0x2eb753,null))[_0xfc87('0x45')](handleError(_0x2eb753,null));};exports[_0xfc87('0x28')]=function(_0x33244c,_0x1a2d78){return db[_0xfc87('0x2e')][_0xfc87('0x4a')]({'where':{'id':_0x33244c[_0xfc87('0x47')]['id']}})[_0xfc87('0x27')](handleEntityNotFound(_0x1a2d78,null))['then'](removeEntity(_0x1a2d78,null))[_0xfc87('0x45')](handleError(_0x1a2d78,null));};exports[_0xfc87('0x4d')]=function(_0x396dc0,_0x194609,_0x58c84e){var _0x2647a9={};var _0x2bde00={};var _0x44e7d9;var _0x3e2141;return db[_0xfc87('0x2e')]['findOne']({'where':{'id':_0x396dc0[_0xfc87('0x47')]['id']}})['then'](handleEntityNotFound(_0x194609,null))['then'](function(_0x1d06cc){if(_0x1d06cc){_0x44e7d9=_0x1d06cc;_0x2bde00[_0xfc87('0x31')]=_[_0xfc87('0x32')](db[_0xfc87('0x4e')]['rawAttributes']);_0x2bde00['query']=_['keys'](_0x396dc0[_0xfc87('0x33')]);_0x2bde00[_0xfc87('0x3a')]=_['intersection'](_0x2bde00[_0xfc87('0x31')],_0x2bde00[_0xfc87('0x33')]);_0x2647a9[_0xfc87('0x36')]=_['intersection'](_0x2bde00[_0xfc87('0x31')],qs[_0xfc87('0x35')](_0x396dc0['query'][_0xfc87('0x35')]));_0x2647a9[_0xfc87('0x36')]=_0x2647a9['attributes']['length']?_0x2647a9[_0xfc87('0x36')]:_0x2bde00[_0xfc87('0x31')];_0x2647a9[_0xfc87('0x4f')]=qs[_0xfc87('0x39')](_0x396dc0[_0xfc87('0x33')][_0xfc87('0x39')]);_0x2647a9[_0xfc87('0x3d')]=qs[_0xfc87('0x3a')](_[_0xfc87('0x3b')](_0x396dc0[_0xfc87('0x33')],_0x2bde00[_0xfc87('0x3a')]));if(_0x396dc0['query'][_0xfc87('0x3c')]){_0x2647a9[_0xfc87('0x3d')]=_['merge'](_0x2647a9[_0xfc87('0x3d')],{'$or':_[_0xfc87('0x3f')](_0x2647a9[_0xfc87('0x36')],function(_0x5f4b94){var _0x19b6d7={};_0x19b6d7[_0x5f4b94]={'$like':'%'+_0x396dc0[_0xfc87('0x33')][_0xfc87('0x3c')]+'%'};return _0x19b6d7;})});}_0x2647a9=_[_0xfc87('0x3e')]({},_0x2647a9,_0x396dc0[_0xfc87('0x41')]);return _0x44e7d9['getFields'](_0x2647a9);}})[_0xfc87('0x27')](function(_0x1c3b93){if(_0x1c3b93){_0x3e2141=_0x1c3b93[_0xfc87('0x37')];if(!_0x396dc0[_0xfc87('0x33')]['hasOwnProperty']('nolimit')){_0x2647a9['limit']=qs[_0xfc87('0x22')](_0x396dc0['query']['limit']);_0x2647a9['offset']=qs[_0xfc87('0x1f')](_0x396dc0[_0xfc87('0x33')]['offset']);}return _0x44e7d9[_0xfc87('0x4d')](_0x2647a9);}})['then'](function(_0xdfac69){if(_0xdfac69){return _0xdfac69?{'count':_0x3e2141,'rows':_0xdfac69}:null;}})[_0xfc87('0x27')](respondWithResult(_0x194609,null))[_0xfc87('0x45')](handleError(_0x194609,null));};exports['getSubjects']=function(_0x3090ad,_0x2a3e7b,_0x5b42bf){var _0x280340={};var _0x6250b7={};var _0x1696e3;var _0x2f00cf;return db[_0xfc87('0x2e')][_0xfc87('0x50')]({'where':{'id':_0x3090ad['params']['id']}})[_0xfc87('0x27')](handleEntityNotFound(_0x2a3e7b,null))[_0xfc87('0x27')](function(_0xf2035e){if(_0xf2035e){_0x1696e3=_0xf2035e;_0x6250b7['model']=_[_0xfc87('0x32')](db[_0xfc87('0x4e')][_0xfc87('0x48')]);_0x6250b7[_0xfc87('0x33')]=_[_0xfc87('0x32')](_0x3090ad['query']);_0x6250b7[_0xfc87('0x3a')]=_[_0xfc87('0x34')](_0x6250b7[_0xfc87('0x31')],_0x6250b7[_0xfc87('0x33')]);_0x280340['attributes']=_['intersection'](_0x6250b7[_0xfc87('0x31')],qs[_0xfc87('0x35')](_0x3090ad[_0xfc87('0x33')][_0xfc87('0x35')]));_0x280340[_0xfc87('0x36')]=_0x280340[_0xfc87('0x36')][_0xfc87('0x37')]?_0x280340[_0xfc87('0x36')]:_0x6250b7[_0xfc87('0x31')];_0x280340['order']=qs[_0xfc87('0x39')](_0x3090ad['query'][_0xfc87('0x39')]);_0x280340[_0xfc87('0x3d')]=qs[_0xfc87('0x3a')](_[_0xfc87('0x3b')](_0x3090ad[_0xfc87('0x33')],_0x6250b7[_0xfc87('0x3a')]));if(_0x3090ad[_0xfc87('0x33')]['filter']){_0x280340[_0xfc87('0x3d')]=_[_0xfc87('0x3e')](_0x280340['where'],{'$or':_[_0xfc87('0x3f')](_0x280340[_0xfc87('0x36')],function(_0x11b77f){var _0x160a51={};_0x160a51[_0x11b77f]={'$like':'%'+_0x3090ad['query'][_0xfc87('0x3c')]+'%'};return _0x160a51;})});}_0x280340=_[_0xfc87('0x3e')]({},_0x280340,_0x3090ad[_0xfc87('0x41')]);return _0x1696e3[_0xfc87('0x51')](_0x280340);}})[_0xfc87('0x27')](function(_0x199497){if(_0x199497){_0x2f00cf=_0x199497[_0xfc87('0x37')];if(!_0x3090ad[_0xfc87('0x33')][_0xfc87('0x38')]('nolimit')){_0x280340[_0xfc87('0x22')]=qs[_0xfc87('0x22')](_0x3090ad[_0xfc87('0x33')]['limit']);_0x280340['offset']=qs[_0xfc87('0x1f')](_0x3090ad[_0xfc87('0x33')][_0xfc87('0x1f')]);}return _0x1696e3['getSubjects'](_0x280340);}})[_0xfc87('0x27')](function(_0x297f71){if(_0x297f71){return _0x297f71?{'count':_0x2f00cf,'rows':_0x297f71}:null;}})[_0xfc87('0x27')](respondWithResult(_0x2a3e7b,null))['catch'](handleError(_0x2a3e7b,null));};exports[_0xfc87('0x52')]=function(_0x5a261f,_0x3462c9,_0x476475){var _0x2d9f00={};var _0xf67014={};var _0x2975ab;var _0xb11dca;return db[_0xfc87('0x2e')][_0xfc87('0x50')]({'where':{'id':_0x5a261f['params']['id']}})[_0xfc87('0x27')](handleEntityNotFound(_0x3462c9,null))[_0xfc87('0x27')](function(_0x428cb3){if(_0x428cb3){_0x2975ab=_0x428cb3;_0xf67014['model']=_[_0xfc87('0x32')](db[_0xfc87('0x4e')][_0xfc87('0x48')]);_0xf67014['query']=_[_0xfc87('0x32')](_0x5a261f[_0xfc87('0x33')]);_0xf67014[_0xfc87('0x3a')]=_[_0xfc87('0x34')](_0xf67014[_0xfc87('0x31')],_0xf67014[_0xfc87('0x33')]);_0x2d9f00[_0xfc87('0x36')]=_[_0xfc87('0x34')](_0xf67014[_0xfc87('0x31')],qs[_0xfc87('0x35')](_0x5a261f[_0xfc87('0x33')][_0xfc87('0x35')]));_0x2d9f00[_0xfc87('0x36')]=_0x2d9f00[_0xfc87('0x36')][_0xfc87('0x37')]?_0x2d9f00[_0xfc87('0x36')]:_0xf67014[_0xfc87('0x31')];_0x2d9f00[_0xfc87('0x4f')]=qs[_0xfc87('0x39')](_0x5a261f['query'][_0xfc87('0x39')]);_0x2d9f00['where']=qs[_0xfc87('0x3a')](_[_0xfc87('0x3b')](_0x5a261f[_0xfc87('0x33')],_0xf67014[_0xfc87('0x3a')]));if(_0x5a261f[_0xfc87('0x33')]['filter']){_0x2d9f00[_0xfc87('0x3d')]=_['merge'](_0x2d9f00[_0xfc87('0x3d')],{'$or':_['map'](_0x2d9f00['attributes'],function(_0x46e613){var _0x2e23ff={};_0x2e23ff[_0x46e613]={'$like':'%'+_0x5a261f[_0xfc87('0x33')][_0xfc87('0x3c')]+'%'};return _0x2e23ff;})});}_0x2d9f00=_['merge']({},_0x2d9f00,_0x5a261f[_0xfc87('0x41')]);return _0x2975ab[_0xfc87('0x52')](_0x2d9f00);}})[_0xfc87('0x27')](function(_0x34ae96){if(_0x34ae96){_0xb11dca=_0x34ae96[_0xfc87('0x37')];if(!_0x5a261f[_0xfc87('0x33')][_0xfc87('0x38')](_0xfc87('0x53'))){_0x2d9f00[_0xfc87('0x22')]=qs['limit'](_0x5a261f['query'][_0xfc87('0x22')]);_0x2d9f00[_0xfc87('0x1f')]=qs[_0xfc87('0x1f')](_0x5a261f[_0xfc87('0x33')][_0xfc87('0x1f')]);}return _0x2975ab[_0xfc87('0x52')](_0x2d9f00);}})[_0xfc87('0x27')](function(_0x581a08){if(_0x581a08){return _0x581a08?{'count':_0xb11dca,'rows':_0x581a08}:null;}})[_0xfc87('0x27')](respondWithResult(_0x3462c9,null))['catch'](handleError(_0x3462c9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 220574c..b253d59 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 _0x9237=['int_sugarcrm_configurations','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration'];(function(_0x46f980,_0x32898b){var _0x478956=function(_0x4c39ae){while(--_0x4c39ae){_0x46f980['push'](_0x46f980['shift']());}};_0x478956(++_0x32898b);}(_0x9237,0x9d));var _0x7923=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0x9237[_0xb83ec2];return _0x4d2fbf;};'use strict';var _=require(_0x7923('0x0'));var util=require(_0x7923('0x1'));var logger=require('../../config/logger')(_0x7923('0x2'));var moment=require(_0x7923('0x3'));var BPromise=require('bluebird');var rp=require(_0x7923('0x4'));var fs=require('fs');var path=require(_0x7923('0x5'));var rimraf=require(_0x7923('0x6'));var config=require(_0x7923('0x7'));var attributes=require(_0x7923('0x8'));module['exports']=function(_0x3b891b,_0x1d49c6){return _0x3b891b[_0x7923('0x9')](_0x7923('0xa'),attributes,{'tableName':_0x7923('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93e5=['../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x463152,_0x3c4a87){var _0x137be7=function(_0x4e4732){while(--_0x4e4732){_0x463152['push'](_0x463152['shift']());}};_0x137be7(++_0x3c4a87);}(_0x93e5,0x7e));var _0x593e=function(_0x4b2885,_0x184ca5){_0x4b2885=_0x4b2885-0x0;var _0x8e89cd=_0x93e5[_0x4b2885];return _0x8e89cd;};'use strict';var _=require(_0x593e('0x0'));var util=require(_0x593e('0x1'));var logger=require(_0x593e('0x2'))(_0x593e('0x3'));var moment=require(_0x593e('0x4'));var BPromise=require(_0x593e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x593e('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x593e('0x7')]=function(_0x4b8273,_0x4e2226){return _0x4b8273[_0x593e('0x8')](_0x593e('0x9'),attributes,{'tableName':_0x593e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 48eb3d0..202e8d1 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 _0x5ad2=['moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x545841,_0x55b657){var _0x20dc7c=function(_0x3a361d){while(--_0x3a361d){_0x545841['push'](_0x545841['shift']());}};_0x20dc7c(++_0x55b657);}(_0x5ad2,0x139));var _0x25ad=function(_0x6bb1ac,_0x53d84d){_0x6bb1ac=_0x6bb1ac-0x0;var _0xc35c19=_0x5ad2[_0x6bb1ac];return _0xc35c19;};'use strict';var _=require(_0x25ad('0x0'));var util=require(_0x25ad('0x1'));var moment=require(_0x25ad('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x25ad('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x25ad('0x5'));var jayson=require(_0x25ad('0x6'));var client=jayson[_0x25ad('0x7')][_0x25ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c7170,_0x3ea1c4,_0x1e994e){return new BPromise(function(_0x1caf70,_0x31a4a0){return client[_0x25ad('0x9')](_0x2c7170,_0x1e994e)[_0x25ad('0xa')](function(_0x2e4d5d){logger[_0x25ad('0xb')](_0x25ad('0xc'),_0x3ea1c4,_0x25ad('0xd'));logger[_0x25ad('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3ea1c4,'request\x20sent',JSON[_0x25ad('0xf')](_0x2e4d5d));if(_0x2e4d5d['error']){if(_0x2e4d5d[_0x25ad('0x10')][_0x25ad('0x11')]===0x1f4){logger[_0x25ad('0x10')](_0x25ad('0xc'),_0x3ea1c4,_0x2e4d5d[_0x25ad('0x10')]['message']);return _0x31a4a0(_0x2e4d5d['error'][_0x25ad('0x12')]);}logger[_0x25ad('0x10')](_0x25ad('0xc'),_0x3ea1c4,_0x2e4d5d['error'][_0x25ad('0x12')]);return _0x1caf70(_0x2e4d5d[_0x25ad('0x10')][_0x25ad('0x12')]);}else{logger[_0x25ad('0xb')](_0x25ad('0xc'),_0x3ea1c4,'request\x20sent');_0x1caf70(_0x2e4d5d[_0x25ad('0x13')][_0x25ad('0x12')]);}})[_0x25ad('0x14')](function(_0x55b25c){logger[_0x25ad('0x10')](_0x25ad('0xc'),_0x3ea1c4,_0x55b25c);_0x31a4a0(_0x55b25c);});});} \ No newline at end of file +var _0xc0e4=['then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3abb4a,_0x1d4c6c){var _0x35d1ff=function(_0x37c8a2){while(--_0x37c8a2){_0x3abb4a['push'](_0x3abb4a['shift']());}};_0x35d1ff(++_0x1d4c6c);}(_0xc0e4,0x7b));var _0x4c0e=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xc0e4[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c0e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c0e('0x1'));var db=require(_0x4c0e('0x2'))['db'];var utils=require(_0x4c0e('0x3'));var logger=require(_0x4c0e('0x4'))(_0x4c0e('0x5'));var config=require(_0x4c0e('0x6'));var jayson=require(_0x4c0e('0x7'));var client=jayson[_0x4c0e('0x8')][_0x4c0e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ffd6d,_0x2ae253,_0x3388f7){return new BPromise(function(_0x38afbd,_0x64bc3e){return client['request'](_0x3ffd6d,_0x3388f7)[_0x4c0e('0xa')](function(_0x2f1ff1){logger['info'](_0x4c0e('0xb'),_0x2ae253,_0x4c0e('0xc'));logger[_0x4c0e('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2ae253,'request\x20sent',JSON[_0x4c0e('0xe')](_0x2f1ff1));if(_0x2f1ff1[_0x4c0e('0xf')]){if(_0x2f1ff1[_0x4c0e('0xf')][_0x4c0e('0x10')]===0x1f4){logger[_0x4c0e('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ae253,_0x2f1ff1[_0x4c0e('0xf')]['message']);return _0x64bc3e(_0x2f1ff1[_0x4c0e('0xf')]['message']);}logger[_0x4c0e('0xf')](_0x4c0e('0xb'),_0x2ae253,_0x2f1ff1[_0x4c0e('0xf')][_0x4c0e('0x11')]);return _0x38afbd(_0x2f1ff1[_0x4c0e('0xf')][_0x4c0e('0x11')]);}else{logger['info'](_0x4c0e('0xb'),_0x2ae253,_0x4c0e('0xc'));_0x38afbd(_0x2f1ff1['result'][_0x4c0e('0x11')]);}})[_0x4c0e('0x12')](function(_0x21ad09){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ae253,_0x21ad09);_0x64bc3e(_0x21ad09);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 17d1f9b..4b70514 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 _0xa1d9=['get','isAuthenticated','post','put','/:id','update','destroy','exports','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x34adf8,_0x4fe747){var _0x7490f8=function(_0x172635){while(--_0x172635){_0x34adf8['push'](_0x34adf8['shift']());}};_0x7490f8(++_0x4fe747);}(_0xa1d9,0x6a));var _0x9a1d=function(_0x1fa3a6,_0x11a327){_0x1fa3a6=_0x1fa3a6-0x0;var _0x33fb38=_0xa1d9[_0x1fa3a6];return _0x33fb38;};'use strict';var multer=require(_0x9a1d('0x0'));var util=require(_0x9a1d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9a1d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x9a1d('0x3'));var config=require(_0x9a1d('0x4'));var controller=require(_0x9a1d('0x5'));router[_0x9a1d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9a1d('0x6')]('/:id',auth[_0x9a1d('0x7')](),controller['show']);router[_0x9a1d('0x8')]('/',auth[_0x9a1d('0x7')](),controller['create']);router[_0x9a1d('0x9')](_0x9a1d('0xa'),auth[_0x9a1d('0x7')](),controller[_0x9a1d('0xb')]);router['delete'](_0x9a1d('0xa'),auth['isAuthenticated'](),controller[_0x9a1d('0xc')]);module[_0x9a1d('0xd')]=router; \ No newline at end of file +var _0xd3cd=['index','/:id','show','post','create','put','update','delete','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xd3cd,0x189));var _0xdd3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3cd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xdd3c('0x0'));var path=require(_0xdd3c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd3c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdd3c('0x3'));var interaction=require(_0xdd3c('0x4'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0xdd3c('0x5')]('/',auth[_0xdd3c('0x6')](),controller[_0xdd3c('0x7')]);router['get'](_0xdd3c('0x8'),auth[_0xdd3c('0x6')](),controller[_0xdd3c('0x9')]);router[_0xdd3c('0xa')]('/',auth[_0xdd3c('0x6')](),controller[_0xdd3c('0xb')]);router[_0xdd3c('0xc')]('/:id',auth[_0xdd3c('0x6')](),controller[_0xdd3c('0xd')]);router[_0xdd3c('0xe')](_0xdd3c('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xdd3c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 2ed84b0..d6c2432 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 _0x636b=['customVariable','keyValue','picklist','STRING','variable','ENUM','string'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x636b,0xd7));var _0xb636=function(_0x20326f,_0x168251){_0x20326f=_0x20326f-0x0;var _0x464dc8=_0x636b[_0x20326f];return _0x464dc8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb636('0x0')](_0xb636('0x1'),'variable',_0xb636('0x2'),_0xb636('0x3'),_0xb636('0x4')),'defaultValue':_0xb636('0x1')},'content':{'type':Sequelize[_0xb636('0x5')]},'key':{'type':Sequelize[_0xb636('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xb636('0x6'),_0xb636('0x2'))},'keyContent':{'type':Sequelize[_0xb636('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e2a=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x3b45fb,_0x9ac712){var _0x5aabc4=function(_0xee7091){while(--_0xee7091){_0x3b45fb['push'](_0x3b45fb['shift']());}};_0x5aabc4(++_0x9ac712);}(_0x4e2a,0x1ce));var _0xa4e2=function(_0x42816e,_0x4d4e12){_0x42816e=_0x42816e-0x0;var _0x4d7c35=_0x4e2a[_0x42816e];return _0x4d7c35;};'use strict';var Sequelize=require(_0xa4e2('0x0'));module[_0xa4e2('0x1')]={'type':{'type':Sequelize[_0xa4e2('0x2')](_0xa4e2('0x3'),_0xa4e2('0x4'),_0xa4e2('0x5'),'keyValue',_0xa4e2('0x6')),'defaultValue':_0xa4e2('0x3')},'content':{'type':Sequelize[_0xa4e2('0x7')]},'key':{'type':Sequelize[_0xa4e2('0x7')]},'keyType':{'type':Sequelize[_0xa4e2('0x2')](_0xa4e2('0x3'),_0xa4e2('0x4'),_0xa4e2('0x5'))},'keyContent':{'type':Sequelize[_0xa4e2('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa4e2('0x7')]},'customField':{'type':Sequelize[_0xa4e2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 293bb4a..f52b777 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 _0xfc1e=['include','find','create','body','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','sendStatus','stack','name','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','rows','params'];(function(_0x454816,_0x5c014f){var _0x4996f2=function(_0x5887a7){while(--_0x5887a7){_0x454816['push'](_0x454816['shift']());}};_0x4996f2(++_0x5c014f);}(_0xfc1e,0x19d));var _0xefc1=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xfc1e[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0xefc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefc1('0x1'));var jsonpatch=require(_0xefc1('0x2'));var rp=require('request-promise');var moment=require(_0xefc1('0x3'));var BPromise=require(_0xefc1('0x4'));var Mustache=require('mustache');var util=require(_0xefc1('0x5'));var path=require(_0xefc1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefc1('0x7'));var fs=require('fs');var fs_extra=require(_0xefc1('0x8'));var _=require(_0xefc1('0x9'));var squel=require(_0xefc1('0xa'));var crypto=require(_0xefc1('0xb'));var jsforce=require(_0xefc1('0xc'));var deskjs=require(_0xefc1('0xd'));var toCsv=require(_0xefc1('0xe'));var querystring=require(_0xefc1('0xf'));var Papa=require('papaparse');var Redis=require(_0xefc1('0x10'));var authService=require(_0xefc1('0x11'));var qs=require(_0xefc1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefc1('0x13'));var logger=require('../../config/logger')(_0xefc1('0x14'));var utils=require(_0xefc1('0x15'));var config=require(_0xefc1('0x16'));var licenseUtil=require(_0xefc1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e6495,_0x4e52ac){_0x4e52ac=_0x4e52ac||0xcc;return function(_0x257e27){if(_0x257e27){return _0x5e6495['sendStatus'](_0x4e52ac);}return _0x5e6495[_0xefc1('0x18')](_0x4e52ac)[_0xefc1('0x19')]();};}function respondWithResult(_0xc2096c,_0x10bf8e){_0x10bf8e=_0x10bf8e||0xc8;return function(_0x1bf654){if(_0x1bf654){return _0xc2096c[_0xefc1('0x18')](_0x10bf8e)[_0xefc1('0x1a')](_0x1bf654);}};}function respondWithFilteredResult(_0x52acc1,_0x3a9430){return function(_0x517dfe){if(_0x517dfe){var _0x32fc9f=typeof _0x3a9430[_0xefc1('0x1b')]==='undefined'&&typeof _0x3a9430[_0xefc1('0x1c')]===_0xefc1('0x1d');var _0x5d73a0=_0x517dfe[_0xefc1('0x1e')];var _0x2849e5=_0x32fc9f?0x0:_0x3a9430['offset'];var _0x17758f=_0x32fc9f?_0x517dfe['count']:_0x3a9430['offset']+_0x3a9430[_0xefc1('0x1c')];var _0x25fe6c;if(_0x17758f>=_0x5d73a0){_0x17758f=_0x5d73a0;_0x25fe6c=0xc8;}else{_0x25fe6c=0xce;}_0x52acc1[_0xefc1('0x18')](_0x25fe6c);return _0x52acc1[_0xefc1('0x1f')]('Content-Range',_0x2849e5+'-'+_0x17758f+'/'+_0x5d73a0)[_0xefc1('0x1a')](_0x517dfe);}return null;};}function patchUpdates(_0x8e053b){return function(_0x230e3f){try{jsonpatch[_0xefc1('0x20')](_0x230e3f,_0x8e053b,!![]);}catch(_0x3cb900){return BPromise['reject'](_0x3cb900);}return _0x230e3f[_0xefc1('0x21')]();};}function saveUpdates(_0x4cb842,_0x4a05b6){return function(_0x99c650){if(_0x99c650){return _0x99c650[_0xefc1('0x22')](_0x4cb842)[_0xefc1('0x23')](function(_0x27bd8c){return _0x27bd8c;});}return null;};}function removeEntity(_0x5edbf4,_0x32cfef){return function(_0x56d950){if(_0x56d950){return _0x56d950[_0xefc1('0x24')]()[_0xefc1('0x23')](function(){_0x5edbf4[_0xefc1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e030a,_0x3e70ec){return function(_0x56f4da){if(!_0x56f4da){_0x5e030a[_0xefc1('0x25')](0x194);}return _0x56f4da;};}function handleError(_0xdd3d07,_0x12429e){_0x12429e=_0x12429e||0x1f4;return function(_0x54f9d8){logger['error'](_0x54f9d8[_0xefc1('0x26')]);if(_0x54f9d8[_0xefc1('0x27')]){delete _0x54f9d8[_0xefc1('0x27')];}_0xdd3d07[_0xefc1('0x18')](_0x12429e)['send'](_0x54f9d8);};}exports['index']=function(_0x1269a0,_0x2c0946){var _0xde9e04={},_0x2e7261={},_0x188aa1={'count':0x0,'rows':[]};var _0x5e6543=_['map'](db[_0xefc1('0x28')][_0xefc1('0x29')],function(_0x168d01){return{'name':_0x168d01[_0xefc1('0x2a')],'type':_0x168d01[_0xefc1('0x2b')][_0xefc1('0x2c')]};});_0x2e7261[_0xefc1('0x2d')]=_[_0xefc1('0x2e')](_0x5e6543,_0xefc1('0x27'));_0x2e7261[_0xefc1('0x2f')]=_[_0xefc1('0x30')](_0x1269a0[_0xefc1('0x2f')]);_0x2e7261[_0xefc1('0x31')]=_[_0xefc1('0x32')](_0x2e7261['model'],_0x2e7261[_0xefc1('0x2f')]);_0xde9e04[_0xefc1('0x33')]=_['intersection'](_0x2e7261[_0xefc1('0x2d')],qs[_0xefc1('0x34')](_0x1269a0[_0xefc1('0x2f')]['fields']));_0xde9e04[_0xefc1('0x33')]=_0xde9e04[_0xefc1('0x33')][_0xefc1('0x35')]?_0xde9e04[_0xefc1('0x33')]:_0x2e7261['model'];if(!_0x1269a0[_0xefc1('0x2f')]['hasOwnProperty']('nolimit')){_0xde9e04['limit']=qs[_0xefc1('0x1c')](_0x1269a0[_0xefc1('0x2f')][_0xefc1('0x1c')]);_0xde9e04[_0xefc1('0x1b')]=qs[_0xefc1('0x1b')](_0x1269a0['query'][_0xefc1('0x1b')]);}_0xde9e04['order']=qs['sort'](_0x1269a0['query'][_0xefc1('0x36')]);_0xde9e04[_0xefc1('0x37')]=qs[_0xefc1('0x31')](_[_0xefc1('0x38')](_0x1269a0[_0xefc1('0x2f')],_0x2e7261[_0xefc1('0x31')]),_0x5e6543);if(_0x1269a0[_0xefc1('0x2f')][_0xefc1('0x39')]){_0xde9e04['where']=_['merge'](_0xde9e04['where'],{'$or':_[_0xefc1('0x2e')](_0x5e6543,function(_0x58a344){if(_0x58a344[_0xefc1('0x2b')]!=='VIRTUAL'){var _0x50fb0f={};_0x50fb0f[_0x58a344['name']]={'$like':'%'+_0x1269a0[_0xefc1('0x2f')][_0xefc1('0x39')]+'%'};return _0x50fb0f;}})});}_0xde9e04=_[_0xefc1('0x3a')]({},_0xde9e04,_0x1269a0[_0xefc1('0x3b')]);var _0x514d57={'where':_0xde9e04[_0xefc1('0x37')]};return db[_0xefc1('0x28')][_0xefc1('0x1e')](_0x514d57)[_0xefc1('0x23')](function(_0x3bd61d){_0x188aa1['count']=_0x3bd61d;if(_0x1269a0[_0xefc1('0x2f')][_0xefc1('0x3c')]){_0xde9e04['include']=[{'all':!![]}];}return db[_0xefc1('0x28')]['findAll'](_0xde9e04);})[_0xefc1('0x23')](function(_0x17fa09){_0x188aa1[_0xefc1('0x3d')]=_0x17fa09;return _0x188aa1;})['then'](respondWithFilteredResult(_0x2c0946,_0xde9e04))['catch'](handleError(_0x2c0946,null));};exports['show']=function(_0x341d75,_0xe2caae){var _0x56650b={'raw':!![],'where':{'id':_0x341d75[_0xefc1('0x3e')]['id']}},_0x3b43ae={};_0x3b43ae[_0xefc1('0x2d')]=_['keys'](db[_0xefc1('0x28')]['rawAttributes']);_0x3b43ae[_0xefc1('0x2f')]=_['keys'](_0x341d75[_0xefc1('0x2f')]);_0x3b43ae['filters']=_[_0xefc1('0x32')](_0x3b43ae['model'],_0x3b43ae[_0xefc1('0x2f')]);_0x56650b[_0xefc1('0x33')]=_[_0xefc1('0x32')](_0x3b43ae[_0xefc1('0x2d')],qs[_0xefc1('0x34')](_0x341d75[_0xefc1('0x2f')][_0xefc1('0x34')]));_0x56650b[_0xefc1('0x33')]=_0x56650b['attributes'][_0xefc1('0x35')]?_0x56650b[_0xefc1('0x33')]:_0x3b43ae[_0xefc1('0x2d')];if(_0x341d75['query'][_0xefc1('0x3c')]){_0x56650b[_0xefc1('0x3f')]=[{'all':!![]}];}_0x56650b=_[_0xefc1('0x3a')]({},_0x56650b,_0x341d75['options']);return db[_0xefc1('0x28')][_0xefc1('0x40')](_0x56650b)[_0xefc1('0x23')](handleEntityNotFound(_0xe2caae,null))[_0xefc1('0x23')](respondWithResult(_0xe2caae,null))['catch'](handleError(_0xe2caae,null));};exports[_0xefc1('0x41')]=function(_0x1bf7e4,_0x4e7013){return db[_0xefc1('0x28')]['create'](_0x1bf7e4['body'],{})[_0xefc1('0x23')](respondWithResult(_0x4e7013,0xc9))['catch'](handleError(_0x4e7013,null));};exports[_0xefc1('0x22')]=function(_0x3e1647,_0x19f83f){if(_0x3e1647[_0xefc1('0x42')]['id']){delete _0x3e1647['body']['id'];}return db[_0xefc1('0x28')][_0xefc1('0x40')]({'where':{'id':_0x3e1647[_0xefc1('0x3e')]['id']}})[_0xefc1('0x23')](handleEntityNotFound(_0x19f83f,null))[_0xefc1('0x23')](saveUpdates(_0x3e1647['body'],null))[_0xefc1('0x23')](respondWithResult(_0x19f83f,null))[_0xefc1('0x43')](handleError(_0x19f83f,null));};exports[_0xefc1('0x24')]=function(_0x45b0fd,_0x2caea3){return db['SugarcrmField'][_0xefc1('0x40')]({'where':{'id':_0x45b0fd['params']['id']}})[_0xefc1('0x23')](handleEntityNotFound(_0x2caea3,null))[_0xefc1('0x23')](removeEntity(_0x2caea3,null))[_0xefc1('0x43')](handleError(_0x2caea3,null));}; \ No newline at end of file +var _0x44f1=['pick','filter','merge','type','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','rows','params','find','create','body','catch','eml-format','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','then','stack','name','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters'];(function(_0x131e5c,_0x36888b){var _0x4f120a=function(_0xe71c69){while(--_0xe71c69){_0x131e5c['push'](_0x131e5c['shift']());}};_0x4f120a(++_0x36888b);}(_0x44f1,0x120));var _0x144f=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x44f1[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0x144f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x144f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x144f('0x2'));var util=require(_0x144f('0x3'));var path=require(_0x144f('0x4'));var sox=require(_0x144f('0x5'));var csv=require(_0x144f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x144f('0x7'));var _=require(_0x144f('0x8'));var squel=require('squel');var crypto=require(_0x144f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x144f('0xa'));var toCsv=require(_0x144f('0x6'));var querystring=require(_0x144f('0xb'));var Papa=require('papaparse');var Redis=require(_0x144f('0xc'));var authService=require(_0x144f('0xd'));var qs=require(_0x144f('0xe'));var as=require(_0x144f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x144f('0x10'))(_0x144f('0x11'));var utils=require(_0x144f('0x12'));var config=require(_0x144f('0x13'));var licenseUtil=require(_0x144f('0x14'));var db=require(_0x144f('0x15'))['db'];function respondWithStatusCode(_0x26b6ed,_0x140740){_0x140740=_0x140740||0xcc;return function(_0x22027d){if(_0x22027d){return _0x26b6ed[_0x144f('0x16')](_0x140740);}return _0x26b6ed[_0x144f('0x17')](_0x140740)[_0x144f('0x18')]();};}function respondWithResult(_0x549605,_0x451160){_0x451160=_0x451160||0xc8;return function(_0x4cfd47){if(_0x4cfd47){return _0x549605[_0x144f('0x17')](_0x451160)[_0x144f('0x19')](_0x4cfd47);}};}function respondWithFilteredResult(_0x2be73a,_0x4bc2da){return function(_0x5777cd){if(_0x5777cd){var _0x17f6e6=typeof _0x4bc2da['offset']===_0x144f('0x1a')&&typeof _0x4bc2da[_0x144f('0x1b')]===_0x144f('0x1a');var _0x9b1327=_0x5777cd[_0x144f('0x1c')];var _0x4d095d=_0x17f6e6?0x0:_0x4bc2da['offset'];var _0x3aad86=_0x17f6e6?_0x5777cd[_0x144f('0x1c')]:_0x4bc2da[_0x144f('0x1d')]+_0x4bc2da[_0x144f('0x1b')];var _0x1a67ad;if(_0x3aad86>=_0x9b1327){_0x3aad86=_0x9b1327;_0x1a67ad=0xc8;}else{_0x1a67ad=0xce;}_0x2be73a[_0x144f('0x17')](_0x1a67ad);return _0x2be73a['set']('Content-Range',_0x4d095d+'-'+_0x3aad86+'/'+_0x9b1327)[_0x144f('0x19')](_0x5777cd);}return null;};}function patchUpdates(_0x8a5851){return function(_0x38a63f){try{jsonpatch[_0x144f('0x1e')](_0x38a63f,_0x8a5851,!![]);}catch(_0x32ce4b){return BPromise[_0x144f('0x1f')](_0x32ce4b);}return _0x38a63f['save']();};}function saveUpdates(_0x261950,_0x4c172c){return function(_0x58e69e){if(_0x58e69e){return _0x58e69e[_0x144f('0x20')](_0x261950)[_0x144f('0x21')](function(_0x49d2c1){return _0x49d2c1;});}return null;};}function removeEntity(_0x4b89ea,_0x378f7e){return function(_0x5def5f){if(_0x5def5f){return _0x5def5f['destroy']()[_0x144f('0x21')](function(){_0x4b89ea['status'](0xcc)[_0x144f('0x18')]();});}};}function handleEntityNotFound(_0x3407b2,_0xe20097){return function(_0x233b66){if(!_0x233b66){_0x3407b2[_0x144f('0x16')](0x194);}return _0x233b66;};}function handleError(_0x114478,_0x1ed3fa){_0x1ed3fa=_0x1ed3fa||0x1f4;return function(_0x291159){logger['error'](_0x291159[_0x144f('0x22')]);if(_0x291159[_0x144f('0x23')]){delete _0x291159[_0x144f('0x23')];}_0x114478[_0x144f('0x17')](_0x1ed3fa)['send'](_0x291159);};}exports['index']=function(_0x532c5a,_0xaa60e0){var _0x5e4a63={},_0x8d5c5c={},_0x41635c={'count':0x0,'rows':[]};var _0x37c55e=_[_0x144f('0x24')](db['SugarcrmField'][_0x144f('0x25')],function(_0x4c0796){return{'name':_0x4c0796[_0x144f('0x26')],'type':_0x4c0796['type'][_0x144f('0x27')]};});_0x8d5c5c[_0x144f('0x28')]=_[_0x144f('0x24')](_0x37c55e,'name');_0x8d5c5c[_0x144f('0x29')]=_[_0x144f('0x2a')](_0x532c5a[_0x144f('0x29')]);_0x8d5c5c['filters']=_['intersection'](_0x8d5c5c['model'],_0x8d5c5c['query']);_0x5e4a63[_0x144f('0x2b')]=_[_0x144f('0x2c')](_0x8d5c5c['model'],qs[_0x144f('0x2d')](_0x532c5a['query']['fields']));_0x5e4a63[_0x144f('0x2b')]=_0x5e4a63[_0x144f('0x2b')][_0x144f('0x2e')]?_0x5e4a63[_0x144f('0x2b')]:_0x8d5c5c['model'];if(!_0x532c5a[_0x144f('0x29')][_0x144f('0x2f')]('nolimit')){_0x5e4a63[_0x144f('0x1b')]=qs['limit'](_0x532c5a[_0x144f('0x29')][_0x144f('0x1b')]);_0x5e4a63[_0x144f('0x1d')]=qs['offset'](_0x532c5a[_0x144f('0x29')][_0x144f('0x1d')]);}_0x5e4a63[_0x144f('0x30')]=qs['sort'](_0x532c5a[_0x144f('0x29')][_0x144f('0x31')]);_0x5e4a63[_0x144f('0x32')]=qs[_0x144f('0x33')](_[_0x144f('0x34')](_0x532c5a[_0x144f('0x29')],_0x8d5c5c[_0x144f('0x33')]),_0x37c55e);if(_0x532c5a[_0x144f('0x29')][_0x144f('0x35')]){_0x5e4a63['where']=_[_0x144f('0x36')](_0x5e4a63['where'],{'$or':_[_0x144f('0x24')](_0x37c55e,function(_0xa8c739){if(_0xa8c739[_0x144f('0x37')]!==_0x144f('0x38')){var _0x199466={};_0x199466[_0xa8c739[_0x144f('0x23')]]={'$like':'%'+_0x532c5a[_0x144f('0x29')][_0x144f('0x35')]+'%'};return _0x199466;}})});}_0x5e4a63=_['merge']({},_0x5e4a63,_0x532c5a[_0x144f('0x39')]);var _0x166e84={'where':_0x5e4a63[_0x144f('0x32')]};return db[_0x144f('0x3a')][_0x144f('0x1c')](_0x166e84)[_0x144f('0x21')](function(_0x304efe){_0x41635c['count']=_0x304efe;if(_0x532c5a[_0x144f('0x29')][_0x144f('0x3b')]){_0x5e4a63[_0x144f('0x3c')]=[{'all':!![]}];}return db['SugarcrmField'][_0x144f('0x3d')](_0x5e4a63);})[_0x144f('0x21')](function(_0x2a5bee){_0x41635c[_0x144f('0x3e')]=_0x2a5bee;return _0x41635c;})[_0x144f('0x21')](respondWithFilteredResult(_0xaa60e0,_0x5e4a63))['catch'](handleError(_0xaa60e0,null));};exports['show']=function(_0x45f01b,_0x55e63d){var _0x39efa7={'raw':!![],'where':{'id':_0x45f01b[_0x144f('0x3f')]['id']}},_0x21ae7b={};_0x21ae7b[_0x144f('0x28')]=_[_0x144f('0x2a')](db[_0x144f('0x3a')][_0x144f('0x25')]);_0x21ae7b[_0x144f('0x29')]=_[_0x144f('0x2a')](_0x45f01b[_0x144f('0x29')]);_0x21ae7b[_0x144f('0x33')]=_[_0x144f('0x2c')](_0x21ae7b[_0x144f('0x28')],_0x21ae7b['query']);_0x39efa7[_0x144f('0x2b')]=_[_0x144f('0x2c')](_0x21ae7b['model'],qs[_0x144f('0x2d')](_0x45f01b[_0x144f('0x29')]['fields']));_0x39efa7[_0x144f('0x2b')]=_0x39efa7[_0x144f('0x2b')]['length']?_0x39efa7[_0x144f('0x2b')]:_0x21ae7b[_0x144f('0x28')];if(_0x45f01b['query'][_0x144f('0x3b')]){_0x39efa7['include']=[{'all':!![]}];}_0x39efa7=_[_0x144f('0x36')]({},_0x39efa7,_0x45f01b[_0x144f('0x39')]);return db[_0x144f('0x3a')][_0x144f('0x40')](_0x39efa7)['then'](handleEntityNotFound(_0x55e63d,null))['then'](respondWithResult(_0x55e63d,null))['catch'](handleError(_0x55e63d,null));};exports[_0x144f('0x41')]=function(_0x279701,_0x2ea1bb){return db[_0x144f('0x3a')][_0x144f('0x41')](_0x279701[_0x144f('0x42')],{})['then'](respondWithResult(_0x2ea1bb,0xc9))[_0x144f('0x43')](handleError(_0x2ea1bb,null));};exports[_0x144f('0x20')]=function(_0x2d61cb,_0x2cd396){if(_0x2d61cb['body']['id']){delete _0x2d61cb['body']['id'];}return db[_0x144f('0x3a')]['find']({'where':{'id':_0x2d61cb['params']['id']}})[_0x144f('0x21')](handleEntityNotFound(_0x2cd396,null))['then'](saveUpdates(_0x2d61cb[_0x144f('0x42')],null))['then'](respondWithResult(_0x2cd396,null))[_0x144f('0x43')](handleError(_0x2cd396,null));};exports['destroy']=function(_0x2f76d2,_0x7770bb){return db[_0x144f('0x3a')][_0x144f('0x40')]({'where':{'id':_0x2f76d2[_0x144f('0x3f')]['id']}})[_0x144f('0x21')](handleEntityNotFound(_0x7770bb,null))[_0x144f('0x21')](removeEntity(_0x7770bb,null))[_0x144f('0x43')](handleError(_0x7770bb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 771cf90..f234452 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 _0x824c=['request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x502ccd,_0x36f01c){var _0x5331e5=function(_0x5719c7){while(--_0x5719c7){_0x502ccd['push'](_0x502ccd['shift']());}};_0x5331e5(++_0x36f01c);}(_0x824c,0x109));var _0xc824=function(_0x1bb7e9,_0xc548b9){_0x1bb7e9=_0x1bb7e9-0x0;var _0x16ac2f=_0x824c[_0x1bb7e9];return _0x16ac2f;};'use strict';var _=require(_0xc824('0x0'));var util=require(_0xc824('0x1'));var logger=require(_0xc824('0x2'))(_0xc824('0x3'));var moment=require('moment');var BPromise=require(_0xc824('0x4'));var rp=require(_0xc824('0x5'));var fs=require('fs');var path=require(_0xc824('0x6'));var rimraf=require(_0xc824('0x7'));var config=require(_0xc824('0x8'));var attributes=require(_0xc824('0x9'));module['exports']=function(_0x374ae9,_0x2a2f0f){return _0x374ae9[_0xc824('0xa')]('SugarcrmField',attributes,{'tableName':_0xc824('0xb'),'paranoid':![],'indexes':[{'name':_0xc824('0xc'),'fields':[_0xc824('0xd'),_0xc824('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f4f=['int_sugarcrm_fields','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x6f4f,0x9c));var _0xf6f4=function(_0xe15851,_0x3b9348){_0xe15851=_0xe15851-0x0;var _0x4c97c0=_0x6f4f[_0xe15851];return _0x4c97c0;};'use strict';var _=require(_0xf6f4('0x0'));var util=require(_0xf6f4('0x1'));var logger=require(_0xf6f4('0x2'))(_0xf6f4('0x3'));var moment=require(_0xf6f4('0x4'));var BPromise=require('bluebird');var rp=require(_0xf6f4('0x5'));var fs=require('fs');var path=require(_0xf6f4('0x6'));var rimraf=require(_0xf6f4('0x7'));var config=require(_0xf6f4('0x8'));var attributes=require(_0xf6f4('0x9'));module[_0xf6f4('0xa')]=function(_0xcbfc8a,_0x5ae3ad){return _0xcbfc8a['define'](_0xf6f4('0xb'),attributes,{'tableName':_0xf6f4('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xf6f4('0xd'),'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 95f2940..73738e2 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 _0x0c72=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x22dbdd,_0x2c43eb){var _0x239aa4=function(_0x36d181){while(--_0x36d181){_0x22dbdd['push'](_0x22dbdd['shift']());}};_0x239aa4(++_0x2c43eb);}(_0x0c72,0xac));var _0x20c7=function(_0x2aaae0,_0x4f0fe2){_0x2aaae0=_0x2aaae0-0x0;var _0x25787e=_0x0c72[_0x2aaae0];return _0x25787e;};'use strict';var _=require(_0x20c7('0x0'));var util=require('util');var moment=require(_0x20c7('0x1'));var BPromise=require('bluebird');var rs=require(_0x20c7('0x2'));var fs=require('fs');var Redis=require(_0x20c7('0x3'));var db=require(_0x20c7('0x4'))['db'];var utils=require(_0x20c7('0x5'));var logger=require(_0x20c7('0x6'))(_0x20c7('0x7'));var config=require('../../config/environment');var jayson=require(_0x20c7('0x8'));var client=jayson[_0x20c7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x536e67,_0x3ab060,_0x50a6b4){return new BPromise(function(_0x7a6dd3,_0x38d31b){return client['request'](_0x536e67,_0x50a6b4)[_0x20c7('0xa')](function(_0x1b0ef7){logger[_0x20c7('0xb')](_0x20c7('0xc'),_0x3ab060,_0x20c7('0xd'));logger[_0x20c7('0xe')](_0x20c7('0xf'),_0x3ab060,'request\x20sent',JSON['stringify'](_0x1b0ef7));if(_0x1b0ef7['error']){if(_0x1b0ef7[_0x20c7('0x10')][_0x20c7('0x11')]===0x1f4){logger[_0x20c7('0x10')](_0x20c7('0xc'),_0x3ab060,_0x1b0ef7[_0x20c7('0x10')][_0x20c7('0x12')]);return _0x38d31b(_0x1b0ef7['error'][_0x20c7('0x12')]);}logger[_0x20c7('0x10')](_0x20c7('0xc'),_0x3ab060,_0x1b0ef7['error'][_0x20c7('0x12')]);return _0x7a6dd3(_0x1b0ef7[_0x20c7('0x10')][_0x20c7('0x12')]);}else{logger[_0x20c7('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x3ab060,_0x20c7('0xd'));_0x7a6dd3(_0x1b0ef7[_0x20c7('0x13')]['message']);}})[_0x20c7('0x14')](function(_0x2bc8e9){logger[_0x20c7('0x10')](_0x20c7('0xc'),_0x3ab060,_0x2bc8e9);_0x38d31b(_0x2bc8e9);});});} \ No newline at end of file +var _0x36d2=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x2a7082,_0x362c5e){var _0x39c954=function(_0xcfed44){while(--_0xcfed44){_0x2a7082['push'](_0x2a7082['shift']());}};_0x39c954(++_0x362c5e);}(_0x36d2,0x6d));var _0x236d=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x36d2[_0x3b19ea];return _0x40ece9;};'use strict';var _=require(_0x236d('0x0'));var util=require(_0x236d('0x1'));var moment=require(_0x236d('0x2'));var BPromise=require('bluebird');var rs=require(_0x236d('0x3'));var fs=require('fs');var Redis=require(_0x236d('0x4'));var db=require(_0x236d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x236d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x236d('0x7'));var client=jayson['client'][_0x236d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5471f4,_0x5cca60,_0x3a688f){return new BPromise(function(_0x349f3f,_0x4b054f){return client[_0x236d('0x9')](_0x5471f4,_0x3a688f)[_0x236d('0xa')](function(_0x2eb9d9){logger[_0x236d('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x5cca60,_0x236d('0xc'));logger[_0x236d('0xd')](_0x236d('0xe'),_0x5cca60,_0x236d('0xc'),JSON[_0x236d('0xf')](_0x2eb9d9));if(_0x2eb9d9[_0x236d('0x10')]){if(_0x2eb9d9[_0x236d('0x10')][_0x236d('0x11')]===0x1f4){logger['error'](_0x236d('0x12'),_0x5cca60,_0x2eb9d9[_0x236d('0x10')][_0x236d('0x13')]);return _0x4b054f(_0x2eb9d9['error'][_0x236d('0x13')]);}logger['error'](_0x236d('0x12'),_0x5cca60,_0x2eb9d9[_0x236d('0x10')][_0x236d('0x13')]);return _0x349f3f(_0x2eb9d9[_0x236d('0x10')][_0x236d('0x13')]);}else{logger[_0x236d('0xb')](_0x236d('0x12'),_0x5cca60,_0x236d('0xc'));_0x349f3f(_0x2eb9d9[_0x236d('0x14')][_0x236d('0x13')]);}})[_0x236d('0x15')](function(_0x2cb20b){logger[_0x236d('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x5cca60,_0x2cb20b);_0x4b054f(_0x2cb20b);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 330d535..ccde1e7 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 _0xb492=['index','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0xd975dd,_0x58a63b){var _0x967a80=function(_0x2cd389){while(--_0x2cd389){_0xd975dd['push'](_0xd975dd['shift']());}};_0x967a80(++_0x58a63b);}(_0xb492,0x172));var _0x2b49=function(_0x444683,_0x27c302){_0x444683=_0x444683-0x0;var _0x16bd4b=_0xb492[_0x444683];return _0x16bd4b;};'use strict';var multer=require('multer');var util=require(_0x2b49('0x0'));var path=require(_0x2b49('0x1'));var timeout=require(_0x2b49('0x2'));var express=require(_0x2b49('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b49('0x4'));var interaction=require(_0x2b49('0x5'));var config=require(_0x2b49('0x6'));var controller=require(_0x2b49('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2b49('0x8')]);router[_0x2b49('0x9')](_0x2b49('0xa'),auth[_0x2b49('0xb')](),controller[_0x2b49('0xc')]);router[_0x2b49('0x9')](_0x2b49('0xd'),auth[_0x2b49('0xb')](),controller['getConfigurations']);router[_0x2b49('0x9')](_0x2b49('0xe'),auth['isAuthenticated'](),controller[_0x2b49('0xf')]);router[_0x2b49('0x10')]('/',auth[_0x2b49('0xb')](),controller['create']);router[_0x2b49('0x10')](_0x2b49('0xd'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x11')]);router[_0x2b49('0x12')](_0x2b49('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2b49('0x13')](_0x2b49('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2b49('0x14')]=router; \ No newline at end of file +var _0xb43b=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1ae9ee,_0xef5f26){var _0x435c7e=function(_0x5a8a65){while(--_0x5a8a65){_0x1ae9ee['push'](_0x1ae9ee['shift']());}};_0x435c7e(++_0xef5f26);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2c3214,_0x25ceba){_0x2c3214=_0x2c3214-0x0;var _0xacf9be=_0xb43b[_0x2c3214];return _0xacf9be;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0xd')]('/:id/fields',auth[_0xbb43('0xb')](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')]('/',auth[_0xbb43('0xb')](),controller[_0xbb43('0x12')]);router[_0xbb43('0x11')]('/:id/configurations',auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router['put']('/:id',auth[_0xbb43('0xb')](),controller['update']);router['delete'](_0xbb43('0xa'),auth['isAuthenticated'](),controller[_0xbb43('0x14')]);module[_0xbb43('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 383cfd4..838182e 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 _0xc598=['sequelize','exports','STRING','HelpDesk'];(function(_0x5e5ef6,_0x28fed9){var _0x4961d4=function(_0x22cbc0){while(--_0x22cbc0){_0x5e5ef6['push'](_0x5e5ef6['shift']());}};_0x4961d4(++_0x28fed9);}(_0xc598,0x144));var _0x8c59=function(_0x19cf81,_0x3332c3){_0x19cf81=_0x19cf81-0x0;var _0x4dce2c=_0xc598[_0x19cf81];return _0x4dce2c;};'use strict';var Sequelize=require(_0x8c59('0x0'));module[_0x8c59('0x1')]={'name':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![],'defaultValue':_0x8c59('0x3')},'remoteUri':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0053=['HelpDesk','exports','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0053,0xa0));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3005('0x0')]={'name':{'type':Sequelize[_0x3005('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3005('0x1')]},'username':{'type':Sequelize[_0x3005('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3005('0x2')},'remoteUri':{'type':Sequelize[_0x3005('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3005('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index bb8efc3..32ef859 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 _0x263a=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','VtigerAccount','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','description','serverUrl','accessKey','username','moduleName','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','sessionName','owner','remove','includes','editable','label','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x278d8d,_0x458be8){var _0x8a6be7=function(_0xbefe2b){while(--_0xbefe2b){_0x278d8d['push'](_0x278d8d['shift']());}};_0x8a6be7(++_0x458be8);}(_0x263a,0x147));var _0xa263=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x263a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa263('0x0'));var rimraf=require(_0xa263('0x1'));var zipdir=require(_0xa263('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa263('0x3'));var moment=require('moment');var BPromise=require(_0xa263('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa263('0x5'));var csv=require(_0xa263('0x6'));var ejs=require(_0xa263('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa263('0x8'));var squel=require(_0xa263('0x9'));var crypto=require(_0xa263('0xa'));var jsforce=require(_0xa263('0xb'));var deskjs=require(_0xa263('0xc'));var toCsv=require(_0xa263('0x6'));var querystring=require(_0xa263('0xd'));var Papa=require('papaparse');var Redis=require(_0xa263('0xe'));var authService=require(_0xa263('0xf'));var qs=require(_0xa263('0x10'));var as=require(_0xa263('0x11'));var hardwareService=require(_0xa263('0x12'));var logger=require(_0xa263('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa263('0x14'));var licenseUtil=require(_0xa263('0x15'));var db=require(_0xa263('0x16'))['db'];var integrations=require(_0xa263('0x17'));function respondWithStatusCode(_0x5033bb,_0x1f0b86){_0x1f0b86=_0x1f0b86||0xcc;return function(_0x2e9c01){if(_0x2e9c01){return _0x5033bb[_0xa263('0x18')](_0x1f0b86);}return _0x5033bb[_0xa263('0x19')](_0x1f0b86)[_0xa263('0x1a')]();};}function respondWithResult(_0x17ac8a,_0x307b73){_0x307b73=_0x307b73||0xc8;return function(_0x1eb90f){if(_0x1eb90f){return _0x17ac8a[_0xa263('0x19')](_0x307b73)[_0xa263('0x1b')](_0x1eb90f);}};}function respondWithFilteredResult(_0x141bce,_0x1d684d){return function(_0x5b0426){if(_0x5b0426){var _0x1016d4=typeof _0x1d684d['offset']===_0xa263('0x1c')&&typeof _0x1d684d[_0xa263('0x1d')]===_0xa263('0x1c');var _0x93d27c=_0x5b0426[_0xa263('0x1e')];var _0x63d373=_0x1016d4?0x0:_0x1d684d['offset'];var _0x4afe40=_0x1016d4?_0x5b0426[_0xa263('0x1e')]:_0x1d684d[_0xa263('0x1f')]+_0x1d684d['limit'];var _0x557275;if(_0x4afe40>=_0x93d27c){_0x4afe40=_0x93d27c;_0x557275=0xc8;}else{_0x557275=0xce;}_0x141bce['status'](_0x557275);return _0x141bce['set']('Content-Range',_0x63d373+'-'+_0x4afe40+'/'+_0x93d27c)[_0xa263('0x1b')](_0x5b0426);}return null;};}function patchUpdates(_0x461c36){return function(_0x273738){try{jsonpatch[_0xa263('0x20')](_0x273738,_0x461c36,!![]);}catch(_0x4477bd){return BPromise[_0xa263('0x21')](_0x4477bd);}return _0x273738['save']();};}function saveUpdates(_0x166567,_0x4333f2){return function(_0x25c9de){if(_0x25c9de){return _0x25c9de[_0xa263('0x22')](_0x166567)['then'](function(_0x66bb23){return _0x66bb23;});}return null;};}function removeEntity(_0x2cce7,_0x6c32a0){return function(_0x34c597){if(_0x34c597){return _0x34c597['destroy']()[_0xa263('0x23')](function(){_0x2cce7[_0xa263('0x19')](0xcc)[_0xa263('0x1a')]();});}};}function handleEntityNotFound(_0x28e243,_0x3d7eaf){return function(_0x3f4756){if(!_0x3f4756){_0x28e243['sendStatus'](0x194);}return _0x3f4756;};}function handleError(_0x3c907e,_0x23c96f){_0x23c96f=_0x23c96f||0x1f4;return function(_0x20d954){logger[_0xa263('0x24')](_0x20d954['stack']);if(_0x20d954[_0xa263('0x25')]){delete _0x20d954['name'];}_0x3c907e['status'](_0x23c96f)[_0xa263('0x26')](_0x20d954);};}exports['index']=function(_0x31fcc4,_0x5c5113){var _0x7acbaa={},_0x1ba301={},_0x151f88={'count':0x0,'rows':[]};var _0x3699de=_[_0xa263('0x27')](db['VtigerAccount'][_0xa263('0x28')],function(_0x2f342b){return{'name':_0x2f342b[_0xa263('0x29')],'type':_0x2f342b[_0xa263('0x2a')][_0xa263('0x2b')]};});_0x1ba301[_0xa263('0x2c')]=_[_0xa263('0x27')](_0x3699de,'name');_0x1ba301[_0xa263('0x2d')]=_[_0xa263('0x2e')](_0x31fcc4[_0xa263('0x2d')]);_0x1ba301[_0xa263('0x2f')]=_[_0xa263('0x30')](_0x1ba301['model'],_0x1ba301[_0xa263('0x2d')]);_0x7acbaa[_0xa263('0x31')]=_[_0xa263('0x30')](_0x1ba301[_0xa263('0x2c')],qs[_0xa263('0x32')](_0x31fcc4[_0xa263('0x2d')][_0xa263('0x32')]));_0x7acbaa[_0xa263('0x31')]=_0x7acbaa[_0xa263('0x31')]['length']?_0x7acbaa[_0xa263('0x31')]:_0x1ba301['model'];if(!_0x31fcc4['query'][_0xa263('0x33')](_0xa263('0x34'))){_0x7acbaa[_0xa263('0x1d')]=qs[_0xa263('0x1d')](_0x31fcc4[_0xa263('0x2d')][_0xa263('0x1d')]);_0x7acbaa[_0xa263('0x1f')]=qs['offset'](_0x31fcc4[_0xa263('0x2d')][_0xa263('0x1f')]);}_0x7acbaa['order']=qs['sort'](_0x31fcc4['query'][_0xa263('0x35')]);_0x7acbaa['where']=qs[_0xa263('0x2f')](_[_0xa263('0x36')](_0x31fcc4[_0xa263('0x2d')],_0x1ba301[_0xa263('0x2f')]),_0x3699de);if(_0x31fcc4[_0xa263('0x2d')][_0xa263('0x37')]){_0x7acbaa['where']=_[_0xa263('0x38')](_0x7acbaa[_0xa263('0x39')],{'$or':_['map'](_0x3699de,function(_0x2527a1){if(_0x2527a1[_0xa263('0x2a')]!=='VIRTUAL'){var _0x35e012={};_0x35e012[_0x2527a1['name']]={'$like':'%'+_0x31fcc4[_0xa263('0x2d')][_0xa263('0x37')]+'%'};return _0x35e012;}})});}_0x7acbaa=_['merge']({},_0x7acbaa,_0x31fcc4[_0xa263('0x3a')]);var _0x5c6e94={'where':_0x7acbaa[_0xa263('0x39')]};return db[_0xa263('0x3b')][_0xa263('0x1e')](_0x5c6e94)['then'](function(_0x14f81d){_0x151f88['count']=_0x14f81d;if(_0x31fcc4[_0xa263('0x2d')][_0xa263('0x3c')]){_0x7acbaa['include']=[{'all':!![]}];}return db[_0xa263('0x3b')][_0xa263('0x3d')](_0x7acbaa);})[_0xa263('0x23')](function(_0x2b02cf){_0x151f88[_0xa263('0x3e')]=_0x2b02cf;return _0x151f88;})[_0xa263('0x23')](respondWithFilteredResult(_0x5c5113,_0x7acbaa))[_0xa263('0x3f')](handleError(_0x5c5113,null));};exports[_0xa263('0x40')]=function(_0xf01e3f,_0x48c841){var _0x5dc375={'raw':![],'where':{'id':_0xf01e3f[_0xa263('0x41')]['id']}},_0xc8e1b8={};_0xc8e1b8[_0xa263('0x2c')]=_[_0xa263('0x2e')](db[_0xa263('0x3b')]['rawAttributes']);_0xc8e1b8[_0xa263('0x2d')]=_['keys'](_0xf01e3f[_0xa263('0x2d')]);_0xc8e1b8['filters']=_[_0xa263('0x30')](_0xc8e1b8[_0xa263('0x2c')],_0xc8e1b8['query']);_0x5dc375[_0xa263('0x31')]=_[_0xa263('0x30')](_0xc8e1b8[_0xa263('0x2c')],qs[_0xa263('0x32')](_0xf01e3f[_0xa263('0x2d')][_0xa263('0x32')]));_0x5dc375['attributes']=_0x5dc375[_0xa263('0x31')][_0xa263('0x42')]?_0x5dc375[_0xa263('0x31')]:_0xc8e1b8['model'];if(_0xf01e3f['query'][_0xa263('0x3c')]){_0x5dc375[_0xa263('0x43')]=[{'all':!![]}];}_0x5dc375=_[_0xa263('0x38')]({},_0x5dc375,_0xf01e3f[_0xa263('0x3a')]);return db['VtigerAccount'][_0xa263('0x44')](_0x5dc375)['then'](handleEntityNotFound(_0x48c841,null))['then'](respondWithResult(_0x48c841,null))['catch'](handleError(_0x48c841,null));};exports[_0xa263('0x45')]=function(_0x5d6854,_0x39eee9){return db[_0xa263('0x3b')][_0xa263('0x45')](_0x5d6854['body'],{})[_0xa263('0x23')](respondWithResult(_0x39eee9,0xc9))[_0xa263('0x3f')](handleError(_0x39eee9,null));};exports[_0xa263('0x22')]=function(_0x114244,_0x5cdefa){if(_0x114244[_0xa263('0x46')]['id']){delete _0x114244[_0xa263('0x46')]['id'];}return db[_0xa263('0x3b')][_0xa263('0x44')]({'where':{'id':_0x114244[_0xa263('0x41')]['id']}})[_0xa263('0x23')](handleEntityNotFound(_0x5cdefa,null))[_0xa263('0x23')](saveUpdates(_0x114244['body'],null))[_0xa263('0x23')](respondWithResult(_0x5cdefa,null))[_0xa263('0x3f')](handleError(_0x5cdefa,null));};exports['destroy']=function(_0x3625c9,_0x24ecf0){return db[_0xa263('0x3b')][_0xa263('0x44')]({'where':{'id':_0x3625c9['params']['id']}})[_0xa263('0x23')](handleEntityNotFound(_0x24ecf0,null))[_0xa263('0x23')](removeEntity(_0x24ecf0,null))['catch'](handleError(_0x24ecf0,null));};exports[_0xa263('0x47')]=function(_0x376a9e,_0x2c9538,_0x39324d){var _0x244cec={};var _0x281bfa={};var _0x50c162;var _0x1b55db;return db[_0xa263('0x3b')][_0xa263('0x48')]({'where':{'id':_0x376a9e[_0xa263('0x41')]['id']}})[_0xa263('0x23')](handleEntityNotFound(_0x2c9538,null))[_0xa263('0x23')](function(_0x5e02a4){if(_0x5e02a4){_0x50c162=_0x5e02a4;_0x281bfa[_0xa263('0x2c')]=_[_0xa263('0x2e')](db[_0xa263('0x49')][_0xa263('0x28')]);_0x281bfa[_0xa263('0x2d')]=_[_0xa263('0x2e')](_0x376a9e[_0xa263('0x2d')]);_0x281bfa['filters']=_[_0xa263('0x30')](_0x281bfa[_0xa263('0x2c')],_0x281bfa['query']);_0x244cec['attributes']=_['intersection'](_0x281bfa['model'],qs['fields'](_0x376a9e['query']['fields']));_0x244cec['attributes']=_0x244cec['attributes'][_0xa263('0x42')]?_0x244cec['attributes']:_0x281bfa[_0xa263('0x2c')];_0x244cec['order']=qs[_0xa263('0x35')](_0x376a9e[_0xa263('0x2d')]['sort']);_0x244cec['where']=qs[_0xa263('0x2f')](_[_0xa263('0x36')](_0x376a9e[_0xa263('0x2d')],_0x281bfa[_0xa263('0x2f')]));if(_0x376a9e[_0xa263('0x2d')][_0xa263('0x37')]){_0x244cec['where']=_[_0xa263('0x38')](_0x244cec[_0xa263('0x39')],{'$or':_['map'](_0x244cec['attributes'],function(_0xe068e9){var _0x42b017={};_0x42b017[_0xe068e9]={'$like':'%'+_0x376a9e[_0xa263('0x2d')][_0xa263('0x37')]+'%'};return _0x42b017;})});}_0x244cec=_['merge']({},_0x244cec,_0x376a9e['options']);return _0x50c162[_0xa263('0x47')](_0x244cec);}})['then'](function(_0x26371b){if(_0x26371b){_0x1b55db=_0x26371b[_0xa263('0x42')];if(!_0x376a9e[_0xa263('0x2d')][_0xa263('0x33')]('nolimit')){_0x244cec['limit']=qs[_0xa263('0x1d')](_0x376a9e[_0xa263('0x2d')][_0xa263('0x1d')]);_0x244cec['offset']=qs[_0xa263('0x1f')](_0x376a9e['query'][_0xa263('0x1f')]);}return _0x50c162['getConfigurations'](_0x244cec);}})[_0xa263('0x23')](function(_0x4f24ee){if(_0x4f24ee){return _0x4f24ee?{'count':_0x1b55db,'rows':_0x4f24ee}:null;}})['then'](respondWithResult(_0x2c9538,null))[_0xa263('0x3f')](handleError(_0x2c9538,null));};exports[_0xa263('0x4a')]=function(_0x520314,_0x35f819,_0x554668){if(_0x520314[_0xa263('0x46')]['id']){delete _0x520314['body']['id'];}return db['VtigerAccount'][_0xa263('0x48')]({'where':{'id':_0x520314[_0xa263('0x41')]['id']}})[_0xa263('0x23')](handleEntityNotFound(_0x35f819,null))[_0xa263('0x23')](function(_0x310bb2){if(_0x310bb2){_0x520314[_0xa263('0x46')][_0xa263('0x4b')]=_0x310bb2['id'];_0x520314[_0xa263('0x46')][_0xa263('0x4c')]=integrations['getSubjects'](_0x520314[_0xa263('0x46')]['channel'],_0x520314['body'][_0xa263('0x2a')]);_0x520314['body'][_0xa263('0x4d')]=integrations[_0xa263('0x4e')](_0x520314['body'][_0xa263('0x4f')],_0x520314[_0xa263('0x46')]['type']);return db[_0xa263('0x49')][_0xa263('0x45')](_0x520314[_0xa263('0x46')],{'include':[{'model':db[_0xa263('0x50')],'as':_0xa263('0x4c')},{'model':db['VtigerField'],'as':_0xa263('0x4d')}]});}return null;})[_0xa263('0x23')](respondWithResult(_0x35f819,null))['catch'](handleError(_0x35f819,null));};var md5=require(_0xa263('0x51'));exports[_0xa263('0x52')]=function(_0x4ce221,_0x16314b,_0x39e1b4){var _0x293a9d=null;var _0x20b161=null;var _0x596c0f=null;var _0x511c00=null;var _0x52f4b4='';return db[_0xa263('0x3b')][_0xa263('0x48')]({'where':{'id':_0x4ce221[_0xa263('0x41')]['id']},'attributes':['id','name','username',_0xa263('0x53'),'moduleName','remoteUri',_0xa263('0x54'),_0xa263('0x55')]})[_0xa263('0x23')](handleEntityNotFound(_0x16314b,null))['then'](function(_0x54e78a){if(_0x54e78a){_0x293a9d=_0x54e78a[_0xa263('0x56')];_0x20b161=_0x54e78a['accessKey'];_0x596c0f=_0x54e78a[_0xa263('0x57')];_0x52f4b4=_0x54e78a[_0xa263('0x58')];var _0x40bad5=_0x52f4b4[_0xa263('0x59')](-0x1);if(_0x40bad5==='/'){_0x52f4b4=_0x52f4b4[_0xa263('0x5a')](0x0,_0x52f4b4[_0xa263('0x5b')](_0x40bad5));}_0x511c00=util[_0xa263('0x5c')](_0xa263('0x5d'),_0x52f4b4);var _0x5d4c90={'method':'GET','uri':_0x511c00,'qs':{'operation':_0xa263('0x5e'),'username':_0x54e78a[_0xa263('0x56')]},'json':!![]};return rp(_0x5d4c90);}})['then'](function(_0x4ab5f4){if(_0x4ab5f4[_0xa263('0x5f')]){var _0x1dcb0b={'method':_0xa263('0x60'),'uri':_0x511c00,'form':{'operation':_0xa263('0x61'),'username':_0x293a9d,'accessKey':md5(_0x4ab5f4[_0xa263('0x62')][_0xa263('0x63')]+_0x20b161)},'json':!![]};return rp(_0x1dcb0b);}})[_0xa263('0x23')](function(_0x23cf4a){if(_0x23cf4a[_0xa263('0x5f')]){var _0x1dd40f={'method':'GET','uri':_0x511c00,'qs':{'operation':'describe','username':_0x293a9d,'sessionName':_0x23cf4a[_0xa263('0x62')][_0xa263('0x64')],'elementType':_0x596c0f},'json':!![]};return rp(_0x1dd40f);}})[_0xa263('0x23')](function(_0xb5d8a2){if(_0xb5d8a2[_0xa263('0x5f')]){var _0x375dc0=['autogenerated','reference',_0xa263('0x65')];_[_0xa263('0x66')](_0xb5d8a2['result'][_0xa263('0x32')],function(_0x42c64e){return _0x375dc0[_0xa263('0x67')](_0x42c64e['type'][_0xa263('0x25')]);});_[_0xa263('0x66')](_0xb5d8a2[_0xa263('0x62')][_0xa263('0x32')],function(_0x1ba2ac){return _0x1ba2ac[_0xa263('0x68')]==='false';});return{'count':_0xb5d8a2[_0xa263('0x62')][_0xa263('0x32')][_0xa263('0x42')],'rows':_[_0xa263('0x27')](_0xb5d8a2[_0xa263('0x62')][_0xa263('0x32')],function(_0x5ee57d){return{'id':_0x5ee57d[_0xa263('0x25')],'name':_0x5ee57d[_0xa263('0x69')],'custom':_['startsWith'](_0x5ee57d['name'],'cf_')?!![]:![],'options':_0x5ee57d[_0xa263('0x2a')][_0xa263('0x25')]===_0xa263('0x6a')&&_0x5ee57d[_0xa263('0x2a')][_0xa263('0x6b')][_0xa263('0x42')]>0x0?_[_0xa263('0x27')](_0x5ee57d[_0xa263('0x2a')][_0xa263('0x6b')],function(_0x2852e7){return{'name':_0x2852e7[_0xa263('0x69')],'value':_0x2852e7['value']};}):[]};})};}})[_0xa263('0x23')](respondWithResult(_0x16314b,null))[_0xa263('0x3f')](function(_0x514500){console[_0xa263('0x6c')](_0xa263('0x6d')+_0x514500);var _0x5ef1f8=_0x4ce221['query'][_0xa263('0x6e')]?0x1f4:_0x514500[_0xa263('0x6f')]||0x1f4;logger['error'](_0xa263('0x70'),_0xa263('0x52'),_0x5ef1f8,JSON[_0xa263('0x71')](_0x514500));delete _0x514500[_0xa263('0x25')];if(_0x5ef1f8===0x191){_0x5ef1f8=0x190;}_0x16314b[_0xa263('0x19')](_0x5ef1f8)[_0xa263('0x26')](_0x4ce221['query'][_0xa263('0x6e')]?{'message':_0xa263('0x72'),'statusCode':_0x514500['statusCode']}:_0x514500);});}; \ No newline at end of file +var _0x72aa=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','update','find','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','POST','login','token','describe','result','success','autogenerated','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x44f353,_0x5b6c2f){var _0x26a635=function(_0x32726e){while(--_0x32726e){_0x44f353['push'](_0x44f353['shift']());}};_0x26a635(++_0x5b6c2f);}(_0x72aa,0x136));var _0xa72a=function(_0xe1a8f1,_0x5e755c){_0xe1a8f1=_0xe1a8f1-0x0;var _0x5a0aa0=_0x72aa[_0xe1a8f1];return _0x5a0aa0;};'use strict';var emlformat=require(_0xa72a('0x0'));var rimraf=require(_0xa72a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa72a('0x2'));var rp=require(_0xa72a('0x3'));var moment=require(_0xa72a('0x4'));var BPromise=require(_0xa72a('0x5'));var Mustache=require('mustache');var util=require(_0xa72a('0x6'));var path=require(_0xa72a('0x7'));var sox=require(_0xa72a('0x8'));var csv=require(_0xa72a('0x9'));var ejs=require(_0xa72a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa72a('0xb'));var squel=require('squel');var crypto=require(_0xa72a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa72a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa72a('0xe'));var Papa=require('papaparse');var Redis=require(_0xa72a('0xf'));var authService=require(_0xa72a('0x10'));var qs=require(_0xa72a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa72a('0x12'));var logger=require(_0xa72a('0x13'))(_0xa72a('0x14'));var utils=require(_0xa72a('0x15'));var config=require(_0xa72a('0x16'));var licenseUtil=require(_0xa72a('0x17'));var db=require(_0xa72a('0x18'))['db'];var integrations=require(_0xa72a('0x19'));function respondWithStatusCode(_0x59c246,_0x4b9ca2){_0x4b9ca2=_0x4b9ca2||0xcc;return function(_0x33e485){if(_0x33e485){return _0x59c246[_0xa72a('0x1a')](_0x4b9ca2);}return _0x59c246['status'](_0x4b9ca2)['end']();};}function respondWithResult(_0x54876b,_0xc41b8c){_0xc41b8c=_0xc41b8c||0xc8;return function(_0x585259){if(_0x585259){return _0x54876b[_0xa72a('0x1b')](_0xc41b8c)[_0xa72a('0x1c')](_0x585259);}};}function respondWithFilteredResult(_0xd38265,_0x1d49a6){return function(_0x3e177c){if(_0x3e177c){var _0x46a964=typeof _0x1d49a6['offset']==='undefined'&&typeof _0x1d49a6[_0xa72a('0x1d')]===_0xa72a('0x1e');var _0x48eb34=_0x3e177c['count'];var _0x410e51=_0x46a964?0x0:_0x1d49a6[_0xa72a('0x1f')];var _0x5c6f7c=_0x46a964?_0x3e177c[_0xa72a('0x20')]:_0x1d49a6[_0xa72a('0x1f')]+_0x1d49a6[_0xa72a('0x1d')];var _0x8a6f7e;if(_0x5c6f7c>=_0x48eb34){_0x5c6f7c=_0x48eb34;_0x8a6f7e=0xc8;}else{_0x8a6f7e=0xce;}_0xd38265[_0xa72a('0x1b')](_0x8a6f7e);return _0xd38265[_0xa72a('0x21')](_0xa72a('0x22'),_0x410e51+'-'+_0x5c6f7c+'/'+_0x48eb34)[_0xa72a('0x1c')](_0x3e177c);}return null;};}function patchUpdates(_0x33dfa){return function(_0x1e2f73){try{jsonpatch[_0xa72a('0x23')](_0x1e2f73,_0x33dfa,!![]);}catch(_0x2dc6c8){return BPromise[_0xa72a('0x24')](_0x2dc6c8);}return _0x1e2f73[_0xa72a('0x25')]();};}function saveUpdates(_0x13a354,_0x5d561e){return function(_0xf4dd7d){if(_0xf4dd7d){return _0xf4dd7d['update'](_0x13a354)[_0xa72a('0x26')](function(_0x3fe572){return _0x3fe572;});}return null;};}function removeEntity(_0x2fa33c,_0x4354b5){return function(_0x339795){if(_0x339795){return _0x339795[_0xa72a('0x27')]()[_0xa72a('0x26')](function(){_0x2fa33c[_0xa72a('0x1b')](0xcc)[_0xa72a('0x28')]();});}};}function handleEntityNotFound(_0x16f241,_0x1eff16){return function(_0x2ad130){if(!_0x2ad130){_0x16f241[_0xa72a('0x1a')](0x194);}return _0x2ad130;};}function handleError(_0x84601,_0x1dd95){_0x1dd95=_0x1dd95||0x1f4;return function(_0xf9646b){logger[_0xa72a('0x29')](_0xf9646b[_0xa72a('0x2a')]);if(_0xf9646b[_0xa72a('0x2b')]){delete _0xf9646b[_0xa72a('0x2b')];}_0x84601[_0xa72a('0x1b')](_0x1dd95)[_0xa72a('0x2c')](_0xf9646b);};}exports[_0xa72a('0x2d')]=function(_0xac7f9c,_0x6c3eca){var _0xa2085d={},_0x422f98={},_0x591cff={'count':0x0,'rows':[]};var _0x212df8=_[_0xa72a('0x2e')](db[_0xa72a('0x2f')][_0xa72a('0x30')],function(_0x469ece){return{'name':_0x469ece[_0xa72a('0x31')],'type':_0x469ece[_0xa72a('0x32')][_0xa72a('0x33')]};});_0x422f98[_0xa72a('0x34')]=_[_0xa72a('0x2e')](_0x212df8,_0xa72a('0x2b'));_0x422f98[_0xa72a('0x35')]=_['keys'](_0xac7f9c['query']);_0x422f98[_0xa72a('0x36')]=_[_0xa72a('0x37')](_0x422f98[_0xa72a('0x34')],_0x422f98['query']);_0xa2085d[_0xa72a('0x38')]=_[_0xa72a('0x37')](_0x422f98[_0xa72a('0x34')],qs[_0xa72a('0x39')](_0xac7f9c[_0xa72a('0x35')][_0xa72a('0x39')]));_0xa2085d[_0xa72a('0x38')]=_0xa2085d[_0xa72a('0x38')][_0xa72a('0x3a')]?_0xa2085d[_0xa72a('0x38')]:_0x422f98[_0xa72a('0x34')];if(!_0xac7f9c[_0xa72a('0x35')][_0xa72a('0x3b')]('nolimit')){_0xa2085d[_0xa72a('0x1d')]=qs[_0xa72a('0x1d')](_0xac7f9c[_0xa72a('0x35')]['limit']);_0xa2085d[_0xa72a('0x1f')]=qs[_0xa72a('0x1f')](_0xac7f9c['query'][_0xa72a('0x1f')]);}_0xa2085d[_0xa72a('0x3c')]=qs['sort'](_0xac7f9c[_0xa72a('0x35')][_0xa72a('0x3d')]);_0xa2085d[_0xa72a('0x3e')]=qs[_0xa72a('0x36')](_[_0xa72a('0x3f')](_0xac7f9c[_0xa72a('0x35')],_0x422f98['filters']),_0x212df8);if(_0xac7f9c[_0xa72a('0x35')][_0xa72a('0x40')]){_0xa2085d[_0xa72a('0x3e')]=_[_0xa72a('0x41')](_0xa2085d[_0xa72a('0x3e')],{'$or':_['map'](_0x212df8,function(_0x4c8a93){if(_0x4c8a93[_0xa72a('0x32')]!==_0xa72a('0x42')){var _0x467421={};_0x467421[_0x4c8a93[_0xa72a('0x2b')]]={'$like':'%'+_0xac7f9c[_0xa72a('0x35')]['filter']+'%'};return _0x467421;}})});}_0xa2085d=_[_0xa72a('0x41')]({},_0xa2085d,_0xac7f9c[_0xa72a('0x43')]);var _0x421e99={'where':_0xa2085d[_0xa72a('0x3e')]};return db[_0xa72a('0x2f')]['count'](_0x421e99)[_0xa72a('0x26')](function(_0x488b88){_0x591cff['count']=_0x488b88;if(_0xac7f9c[_0xa72a('0x35')]['includeAll']){_0xa2085d[_0xa72a('0x44')]=[{'all':!![]}];}return db['VtigerAccount'][_0xa72a('0x45')](_0xa2085d);})[_0xa72a('0x26')](function(_0x2b11ee){_0x591cff[_0xa72a('0x46')]=_0x2b11ee;return _0x591cff;})[_0xa72a('0x26')](respondWithFilteredResult(_0x6c3eca,_0xa2085d))[_0xa72a('0x47')](handleError(_0x6c3eca,null));};exports[_0xa72a('0x48')]=function(_0xe6d17e,_0x535d3b){var _0x6cf350={'raw':![],'where':{'id':_0xe6d17e[_0xa72a('0x49')]['id']}},_0x21cb8a={};_0x21cb8a[_0xa72a('0x34')]=_['keys'](db[_0xa72a('0x2f')]['rawAttributes']);_0x21cb8a['query']=_[_0xa72a('0x4a')](_0xe6d17e[_0xa72a('0x35')]);_0x21cb8a[_0xa72a('0x36')]=_[_0xa72a('0x37')](_0x21cb8a[_0xa72a('0x34')],_0x21cb8a[_0xa72a('0x35')]);_0x6cf350[_0xa72a('0x38')]=_[_0xa72a('0x37')](_0x21cb8a['model'],qs[_0xa72a('0x39')](_0xe6d17e[_0xa72a('0x35')][_0xa72a('0x39')]));_0x6cf350[_0xa72a('0x38')]=_0x6cf350[_0xa72a('0x38')]['length']?_0x6cf350[_0xa72a('0x38')]:_0x21cb8a[_0xa72a('0x34')];if(_0xe6d17e[_0xa72a('0x35')][_0xa72a('0x4b')]){_0x6cf350['include']=[{'all':!![]}];}_0x6cf350=_[_0xa72a('0x41')]({},_0x6cf350,_0xe6d17e[_0xa72a('0x43')]);return db[_0xa72a('0x2f')]['find'](_0x6cf350)[_0xa72a('0x26')](handleEntityNotFound(_0x535d3b,null))[_0xa72a('0x26')](respondWithResult(_0x535d3b,null))[_0xa72a('0x47')](handleError(_0x535d3b,null));};exports[_0xa72a('0x4c')]=function(_0x1820ab,_0xcaac7f){return db[_0xa72a('0x2f')][_0xa72a('0x4c')](_0x1820ab[_0xa72a('0x4d')],{})[_0xa72a('0x26')](respondWithResult(_0xcaac7f,0xc9))[_0xa72a('0x47')](handleError(_0xcaac7f,null));};exports[_0xa72a('0x4e')]=function(_0x164ada,_0x2f92ed){if(_0x164ada[_0xa72a('0x4d')]['id']){delete _0x164ada[_0xa72a('0x4d')]['id'];}return db[_0xa72a('0x2f')]['find']({'where':{'id':_0x164ada['params']['id']}})[_0xa72a('0x26')](handleEntityNotFound(_0x2f92ed,null))[_0xa72a('0x26')](saveUpdates(_0x164ada[_0xa72a('0x4d')],null))[_0xa72a('0x26')](respondWithResult(_0x2f92ed,null))[_0xa72a('0x47')](handleError(_0x2f92ed,null));};exports[_0xa72a('0x27')]=function(_0x351a9e,_0x3833b3){return db[_0xa72a('0x2f')][_0xa72a('0x4f')]({'where':{'id':_0x351a9e[_0xa72a('0x49')]['id']}})[_0xa72a('0x26')](handleEntityNotFound(_0x3833b3,null))['then'](removeEntity(_0x3833b3,null))[_0xa72a('0x47')](handleError(_0x3833b3,null));};exports[_0xa72a('0x50')]=function(_0x1281ab,_0x3262f9,_0xf6d15b){var _0x3709f2={};var _0x309d27={};var _0x465f82;var _0x2c0ee5;return db[_0xa72a('0x2f')]['findOne']({'where':{'id':_0x1281ab[_0xa72a('0x49')]['id']}})[_0xa72a('0x26')](handleEntityNotFound(_0x3262f9,null))['then'](function(_0x30dc35){if(_0x30dc35){_0x465f82=_0x30dc35;_0x309d27[_0xa72a('0x34')]=_[_0xa72a('0x4a')](db['VtigerConfiguration'][_0xa72a('0x30')]);_0x309d27['query']=_[_0xa72a('0x4a')](_0x1281ab['query']);_0x309d27['filters']=_[_0xa72a('0x37')](_0x309d27[_0xa72a('0x34')],_0x309d27[_0xa72a('0x35')]);_0x3709f2[_0xa72a('0x38')]=_[_0xa72a('0x37')](_0x309d27[_0xa72a('0x34')],qs[_0xa72a('0x39')](_0x1281ab[_0xa72a('0x35')][_0xa72a('0x39')]));_0x3709f2[_0xa72a('0x38')]=_0x3709f2['attributes'][_0xa72a('0x3a')]?_0x3709f2[_0xa72a('0x38')]:_0x309d27[_0xa72a('0x34')];_0x3709f2[_0xa72a('0x3c')]=qs[_0xa72a('0x3d')](_0x1281ab[_0xa72a('0x35')][_0xa72a('0x3d')]);_0x3709f2[_0xa72a('0x3e')]=qs['filters'](_['pick'](_0x1281ab[_0xa72a('0x35')],_0x309d27[_0xa72a('0x36')]));if(_0x1281ab[_0xa72a('0x35')]['filter']){_0x3709f2[_0xa72a('0x3e')]=_[_0xa72a('0x41')](_0x3709f2[_0xa72a('0x3e')],{'$or':_[_0xa72a('0x2e')](_0x3709f2[_0xa72a('0x38')],function(_0x52d311){var _0x4b074e={};_0x4b074e[_0x52d311]={'$like':'%'+_0x1281ab[_0xa72a('0x35')]['filter']+'%'};return _0x4b074e;})});}_0x3709f2=_[_0xa72a('0x41')]({},_0x3709f2,_0x1281ab[_0xa72a('0x43')]);return _0x465f82[_0xa72a('0x50')](_0x3709f2);}})[_0xa72a('0x26')](function(_0x419050){if(_0x419050){_0x2c0ee5=_0x419050[_0xa72a('0x3a')];if(!_0x1281ab[_0xa72a('0x35')]['hasOwnProperty']('nolimit')){_0x3709f2[_0xa72a('0x1d')]=qs[_0xa72a('0x1d')](_0x1281ab[_0xa72a('0x35')][_0xa72a('0x1d')]);_0x3709f2['offset']=qs[_0xa72a('0x1f')](_0x1281ab[_0xa72a('0x35')][_0xa72a('0x1f')]);}return _0x465f82[_0xa72a('0x50')](_0x3709f2);}})['then'](function(_0x13975f){if(_0x13975f){return _0x13975f?{'count':_0x2c0ee5,'rows':_0x13975f}:null;}})['then'](respondWithResult(_0x3262f9,null))[_0xa72a('0x47')](handleError(_0x3262f9,null));};exports[_0xa72a('0x51')]=function(_0x26b6ed,_0x35b472,_0x43f950){if(_0x26b6ed[_0xa72a('0x4d')]['id']){delete _0x26b6ed[_0xa72a('0x4d')]['id'];}return db[_0xa72a('0x2f')][_0xa72a('0x52')]({'where':{'id':_0x26b6ed['params']['id']}})[_0xa72a('0x26')](handleEntityNotFound(_0x35b472,null))[_0xa72a('0x26')](function(_0x55ee76){if(_0x55ee76){_0x26b6ed[_0xa72a('0x4d')][_0xa72a('0x53')]=_0x55ee76['id'];_0x26b6ed['body']['Subjects']=integrations[_0xa72a('0x54')](_0x26b6ed[_0xa72a('0x4d')][_0xa72a('0x55')],_0x26b6ed[_0xa72a('0x4d')][_0xa72a('0x32')]);_0x26b6ed[_0xa72a('0x4d')][_0xa72a('0x56')]=integrations[_0xa72a('0x57')](_0x26b6ed[_0xa72a('0x4d')][_0xa72a('0x55')],_0x26b6ed['body'][_0xa72a('0x32')]);return db['VtigerConfiguration'][_0xa72a('0x4c')](_0x26b6ed['body'],{'include':[{'model':db['VtigerField'],'as':_0xa72a('0x58')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0xa72a('0x26')](respondWithResult(_0x35b472,null))[_0xa72a('0x47')](handleError(_0x35b472,null));};var md5=require(_0xa72a('0x59'));exports[_0xa72a('0x5a')]=function(_0x28f38d,_0x26b6d5,_0x4bbbe2){var _0xc6270b=null;var _0x5a2c90=null;var _0xf60a79=null;var _0x364fb0=null;var _0x5aa434='';return db[_0xa72a('0x2f')]['findOne']({'where':{'id':_0x28f38d[_0xa72a('0x49')]['id']},'attributes':['id',_0xa72a('0x2b'),_0xa72a('0x5b'),'description',_0xa72a('0x5c'),_0xa72a('0x5d'),_0xa72a('0x5e'),_0xa72a('0x5f')]})[_0xa72a('0x26')](handleEntityNotFound(_0x26b6d5,null))[_0xa72a('0x26')](function(_0x3141c7){if(_0x3141c7){_0xc6270b=_0x3141c7[_0xa72a('0x5b')];_0x5a2c90=_0x3141c7[_0xa72a('0x5f')];_0xf60a79=_0x3141c7[_0xa72a('0x5c')];_0x5aa434=_0x3141c7[_0xa72a('0x5d')];var _0x48b1f7=_0x5aa434[_0xa72a('0x60')](-0x1);if(_0x48b1f7==='/'){_0x5aa434=_0x5aa434[_0xa72a('0x61')](0x0,_0x5aa434[_0xa72a('0x62')](_0x48b1f7));}_0x364fb0=util[_0xa72a('0x63')](_0xa72a('0x64'),_0x5aa434);var _0x59ba47={'method':_0xa72a('0x65'),'uri':_0x364fb0,'qs':{'operation':'getchallenge','username':_0x3141c7[_0xa72a('0x5b')]},'json':!![]};return rp(_0x59ba47);}})['then'](function(_0x41dc4f){if(_0x41dc4f['success']){var _0x15d4de={'method':_0xa72a('0x66'),'uri':_0x364fb0,'form':{'operation':_0xa72a('0x67'),'username':_0xc6270b,'accessKey':md5(_0x41dc4f['result'][_0xa72a('0x68')]+_0x5a2c90)},'json':!![]};return rp(_0x15d4de);}})[_0xa72a('0x26')](function(_0x5e01cb){if(_0x5e01cb['success']){var _0x3579fd={'method':_0xa72a('0x65'),'uri':_0x364fb0,'qs':{'operation':_0xa72a('0x69'),'username':_0xc6270b,'sessionName':_0x5e01cb[_0xa72a('0x6a')]['sessionName'],'elementType':_0xf60a79},'json':!![]};return rp(_0x3579fd);}})[_0xa72a('0x26')](function(_0x5c5b4f){if(_0x5c5b4f[_0xa72a('0x6b')]){var _0x4fe520=[_0xa72a('0x6c'),'reference','owner'];_['remove'](_0x5c5b4f['result'][_0xa72a('0x39')],function(_0x3175e5){return _0x4fe520[_0xa72a('0x6d')](_0x3175e5[_0xa72a('0x32')][_0xa72a('0x2b')]);});_['remove'](_0x5c5b4f[_0xa72a('0x6a')][_0xa72a('0x39')],function(_0x139abd){return _0x139abd[_0xa72a('0x6e')]===_0xa72a('0x6f');});return{'count':_0x5c5b4f[_0xa72a('0x6a')]['fields']['length'],'rows':_[_0xa72a('0x2e')](_0x5c5b4f[_0xa72a('0x6a')][_0xa72a('0x39')],function(_0x4851d3){return{'id':_0x4851d3[_0xa72a('0x2b')],'name':_0x4851d3['label'],'custom':_[_0xa72a('0x70')](_0x4851d3[_0xa72a('0x2b')],_0xa72a('0x71'))?!![]:![],'options':_0x4851d3[_0xa72a('0x32')][_0xa72a('0x2b')]===_0xa72a('0x72')&&_0x4851d3[_0xa72a('0x32')]['picklistValues']['length']>0x0?_[_0xa72a('0x2e')](_0x4851d3[_0xa72a('0x32')][_0xa72a('0x73')],function(_0x27fec5){return{'name':_0x27fec5[_0xa72a('0x74')],'value':_0x27fec5[_0xa72a('0x75')]};}):[]};})};}})['then'](respondWithResult(_0x26b6d5,null))[_0xa72a('0x47')](function(_0x124199){console['log']('vTiger\x20error:\x20'+_0x124199);var _0x1fe0e4=_0x28f38d[_0xa72a('0x35')][_0xa72a('0x76')]?0x1f4:_0x124199[_0xa72a('0x77')]||0x1f4;logger[_0xa72a('0x29')](_0xa72a('0x78'),'getFields',_0x1fe0e4,JSON[_0xa72a('0x79')](_0x124199));delete _0x124199[_0xa72a('0x2b')];if(_0x1fe0e4===0x191){_0x1fe0e4=0x190;}_0x26b6d5['status'](_0x1fe0e4)[_0xa72a('0x2c')](_0x28f38d[_0xa72a('0x35')][_0xa72a('0x76')]?{'message':_0xa72a('0x7a'),'statusCode':_0x124199['statusCode']}:_0x124199);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 7a61590..45db662 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 _0x1b50=['lodash','util','../../config/logger','api','moment','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x2075ca,_0x38a103){var _0xc9b8e0=function(_0x11dd90){while(--_0x11dd90){_0x2075ca['push'](_0x2075ca['shift']());}};_0xc9b8e0(++_0x38a103);}(_0x1b50,0xea));var _0x01b5=function(_0x29d32b,_0x1bc829){_0x29d32b=_0x29d32b-0x0;var _0x27e2e1=_0x1b50[_0x29d32b];return _0x27e2e1;};'use strict';var _=require(_0x01b5('0x0'));var util=require(_0x01b5('0x1'));var logger=require(_0x01b5('0x2'))(_0x01b5('0x3'));var moment=require(_0x01b5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x01b5('0x5'));var rimraf=require(_0x01b5('0x6'));var config=require('../../config/environment');var attributes=require(_0x01b5('0x7'));var integrations=require(_0x01b5('0x8'));module[_0x01b5('0x9')]=function(_0x1e984a,_0x453867){return _0x1e984a[_0x01b5('0xa')](_0x01b5('0xb'),attributes,{'tableName':_0x01b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5882=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x5882,0xe9));var _0x2588=function(_0x4979f6,_0x3027ee){_0x4979f6=_0x4979f6-0x0;var _0x788bdf=_0x5882[_0x4979f6];return _0x788bdf;};'use strict';var _=require('lodash');var util=require(_0x2588('0x0'));var logger=require(_0x2588('0x1'))(_0x2588('0x2'));var moment=require(_0x2588('0x3'));var BPromise=require(_0x2588('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2588('0x5'));var rimraf=require(_0x2588('0x6'));var config=require(_0x2588('0x7'));var attributes=require(_0x2588('0x8'));var integrations=require(_0x2588('0x9'));module['exports']=function(_0x4b3c70,_0x3d240c){return _0x4b3c70['define']('VtigerAccount',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 661c9bb..bd8a5f7 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 _0x351d=['findAll','options','attributes','include','map','model','then','catch','ShowVtigerAccount','find','raw','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount'];(function(_0x54f507,_0x4769c0){var _0x4297aa=function(_0x5e1a33){while(--_0x5e1a33){_0x54f507['push'](_0x54f507['shift']());}};_0x4297aa(++_0x4769c0);}(_0x351d,0x90));var _0xd351=function(_0x5432fa,_0x58f953){_0x5432fa=_0x5432fa-0x0;var _0x217c3d=_0x351d[_0x5432fa];return _0x217c3d;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5318b2,_0x16b3f7,_0x235aa0){return new BPromise(function(_0x4e1b06,_0x2e9a2a){return client[_0xd351('0xa')](_0x5318b2,_0x235aa0)['then'](function(_0x586c60){logger[_0xd351('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'));logger[_0xd351('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'),JSON[_0xd351('0xe')](_0x586c60));if(_0x586c60['error']){if(_0x586c60[_0xd351('0xf')]['code']===0x1f4){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);return _0x2e9a2a(_0x586c60[_0xd351('0xf')]['message']);}logger[_0xd351('0xf')](_0xd351('0x10'),_0x16b3f7,_0x586c60['error'][_0xd351('0x11')]);return _0x4e1b06(_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);}else{logger[_0xd351('0xb')](_0xd351('0x10'),_0x16b3f7,'request\x20sent');_0x4e1b06(_0x586c60[_0xd351('0x12')]['message']);}})['catch'](function(_0x2c6708){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x2c6708);_0x2e9a2a(_0x2c6708);});});}exports[_0xd351('0x13')]=function(_0x4e0164){var _0x4c6693=this;return new Promise(function(_0x1e1a3c,_0x2bfc53){return db[_0xd351('0x14')][_0xd351('0x15')]({'raw':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['where']||null:null,'attributes':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x17')]||null:null,'limit':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')]['limit']||null:null,'include':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x4e0164[_0xd351('0x16')][_0xd351('0x18')],function(_0x365bbc){return{'model':db[_0x365bbc['model']],'as':_0x365bbc['as'],'attributes':_0x365bbc[_0xd351('0x17')],'include':_0x365bbc[_0xd351('0x18')]?_[_0xd351('0x19')](_0x365bbc[_0xd351('0x18')],function(_0x489c9a){return{'model':db[_0x489c9a[_0xd351('0x1a')]],'as':_0x489c9a['as'],'attributes':_0x489c9a['attributes'],'include':_0x489c9a[_0xd351('0x18')]?_[_0xd351('0x19')](_0x489c9a['include'],function(_0x2648d0){return{'model':db[_0x2648d0['model']],'as':_0x2648d0['as'],'attributes':_0x2648d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd351('0x1b')](function(_0x560be9){logger['info'](_0xd351('0x13'),_0x4e0164);logger['debug'](_0xd351('0x13'),_0x4e0164,JSON[_0xd351('0xe')](_0x560be9));_0x1e1a3c(_0x560be9);})[_0xd351('0x1c')](function(_0x4d3f48){logger[_0xd351('0xf')]('GetVtigerAccount',_0x4d3f48[_0xd351('0x11')],_0x4e0164);_0x2bfc53(_0x4c6693['error'](0x1f4,_0x4d3f48['message']));});});};exports[_0xd351('0x1d')]=function(_0x38c82f){var _0x3f9ef3=this;return new Promise(function(_0x33b43d,_0x48aa96){return db[_0xd351('0x14')][_0xd351('0x1e')]({'raw':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x1f')]===undefined?!![]:![]:!![],'where':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x20')]||null:null,'attributes':_0x38c82f[_0xd351('0x16')]?_0x38c82f['options'][_0xd351('0x17')]||null:null,'include':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x38c82f[_0xd351('0x16')][_0xd351('0x18')],function(_0x3d5b7f){return{'model':db[_0x3d5b7f[_0xd351('0x1a')]],'as':_0x3d5b7f['as'],'attributes':_0x3d5b7f[_0xd351('0x17')],'include':_0x3d5b7f[_0xd351('0x18')]?_[_0xd351('0x19')](_0x3d5b7f[_0xd351('0x18')],function(_0x238663){return{'model':db[_0x238663['model']],'as':_0x238663['as'],'attributes':_0x238663['attributes'],'include':_0x238663[_0xd351('0x18')]?_[_0xd351('0x19')](_0x238663[_0xd351('0x18')],function(_0x2907b7){return{'model':db[_0x2907b7[_0xd351('0x1a')]],'as':_0x2907b7['as'],'attributes':_0x2907b7[_0xd351('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47e2fa){logger[_0xd351('0xb')]('ShowVtigerAccount',_0x38c82f);logger[_0xd351('0xd')](_0xd351('0x1d'),_0x38c82f,JSON[_0xd351('0xe')](_0x47e2fa));_0x33b43d(_0x47e2fa);})[_0xd351('0x1c')](function(_0x33307){logger[_0xd351('0xf')](_0xd351('0x1d'),_0x33307[_0xd351('0x11')],_0x38c82f);_0x48aa96(_0x3f9ef3[_0xd351('0xf')](0x1f4,_0x33307[_0xd351('0x11')]));});});}; \ No newline at end of file +var _0x0fd9=['../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowVtigerAccount','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x0fd9,0xa3));var _0x90fd=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x0fd9[_0x695b76];return _0x1dc21f;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});}exports[_0x90fd('0x15')]=function(_0x1fcc87){var _0x4d8f3b=this;return new Promise(function(_0x3f9c76,_0x16e9e3){return db[_0x90fd('0x16')][_0x90fd('0x17')]({'raw':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'limit':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')]['limit']||null:null,'include':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x30f67e){return{'model':db[_0x30f67e[_0x90fd('0x1e')]],'as':_0x30f67e['as'],'attributes':_0x30f67e['attributes'],'include':_0x30f67e[_0x90fd('0x1c')]?_['map'](_0x30f67e[_0x90fd('0x1c')],function(_0x18d5b3){return{'model':db[_0x18d5b3[_0x90fd('0x1e')]],'as':_0x18d5b3['as'],'attributes':_0x18d5b3[_0x90fd('0x1b')],'include':_0x18d5b3[_0x90fd('0x1c')]?_['map'](_0x18d5b3[_0x90fd('0x1c')],function(_0xe333f0){return{'model':db[_0xe333f0[_0x90fd('0x1e')]],'as':_0xe333f0['as'],'attributes':_0xe333f0[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x428bc2){logger['info']('GetVtigerAccount',_0x1fcc87);logger[_0x90fd('0xe')](_0x90fd('0x15'),_0x1fcc87,JSON[_0x90fd('0x10')](_0x428bc2));_0x3f9c76(_0x428bc2);})[_0x90fd('0x14')](function(_0x397aaf){logger['error']('GetVtigerAccount',_0x397aaf[_0x90fd('0x13')],_0x1fcc87);_0x16e9e3(_0x4d8f3b[_0x90fd('0x11')](0x1f4,_0x397aaf[_0x90fd('0x13')]));});});};exports[_0x90fd('0x20')]=function(_0x4a3ae4){var _0x59aede=this;return new Promise(function(_0x12dea4,_0x21a9cf){return db[_0x90fd('0x16')][_0x90fd('0x21')]({'raw':_0x4a3ae4['options']?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'include':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x209e5c){return{'model':db[_0x209e5c[_0x90fd('0x1e')]],'as':_0x209e5c['as'],'attributes':_0x209e5c['attributes'],'include':_0x209e5c[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x209e5c[_0x90fd('0x1c')],function(_0x3aee5){return{'model':db[_0x3aee5[_0x90fd('0x1e')]],'as':_0x3aee5['as'],'attributes':_0x3aee5[_0x90fd('0x1b')],'include':_0x3aee5[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x3aee5[_0x90fd('0x1c')],function(_0x186f4f){return{'model':db[_0x186f4f[_0x90fd('0x1e')]],'as':_0x186f4f['as'],'attributes':_0x186f4f[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x4c20b0){logger[_0x90fd('0xb')](_0x90fd('0x20'),_0x4a3ae4);logger[_0x90fd('0xe')](_0x90fd('0x20'),_0x4a3ae4,JSON['stringify'](_0x4c20b0));_0x12dea4(_0x4c20b0);})[_0x90fd('0x14')](function(_0x2c4f37){logger[_0x90fd('0x11')]('ShowVtigerAccount',_0x2c4f37['message'],_0x4a3ae4);_0x21a9cf(_0x59aede[_0x90fd('0x11')](0x1f4,_0x2c4f37[_0x90fd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 16b781a..0846e49 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 _0x2a4f=['put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields','get','/:id/subjects','/:id/descriptions','getDescriptions','create'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x2a4f,0xf7));var _0xf2a4=function(_0x1b361c,_0x1e904a){_0x1b361c=_0x1b361c-0x0;var _0x4440a1=_0x2a4f[_0x1b361c];return _0x4440a1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf2a4('0x0'));var timeout=require(_0xf2a4('0x1'));var express=require(_0xf2a4('0x2'));var router=express['Router']();var fs_extra=require(_0xf2a4('0x3'));var auth=require(_0xf2a4('0x4'));var interaction=require(_0xf2a4('0x5'));var config=require('../../config/environment');var controller=require(_0xf2a4('0x6'));router['get']('/',auth[_0xf2a4('0x7')](),controller[_0xf2a4('0x8')]);router['get'](_0xf2a4('0x9'),auth[_0xf2a4('0x7')](),controller[_0xf2a4('0xa')]);router['get'](_0xf2a4('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0xf2a4('0xc')](_0xf2a4('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf2a4('0xc')](_0xf2a4('0xe'),auth['isAuthenticated'](),controller[_0xf2a4('0xf')]);router['post']('/',auth[_0xf2a4('0x7')](),controller[_0xf2a4('0x10')]);router[_0xf2a4('0x11')](_0xf2a4('0x9'),auth[_0xf2a4('0x7')](),controller[_0xf2a4('0x12')]);router[_0xf2a4('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf2a4('0x14')]);module[_0xf2a4('0x15')]=router; \ No newline at end of file +var _0x3a3d=['/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','delete','exports','multer','util','path','express','Router','../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x284a15,_0x100920){var _0x7607da=function(_0x5503a7){while(--_0x5503a7){_0x284a15['push'](_0x284a15['shift']());}};_0x7607da(++_0x100920);}(_0x3a3d,0x138));var _0xd3a3=function(_0x1e8b50,_0x305f34){_0x1e8b50=_0x1e8b50-0x0;var _0xf63283=_0x3a3d[_0x1e8b50];return _0xf63283;};'use strict';var multer=require(_0xd3a3('0x0'));var util=require(_0xd3a3('0x1'));var path=require(_0xd3a3('0x2'));var timeout=require('connect-timeout');var express=require(_0xd3a3('0x3'));var router=express[_0xd3a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd3a3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3a3('0x6'));router[_0xd3a3('0x7')]('/',auth[_0xd3a3('0x8')](),controller[_0xd3a3('0x9')]);router[_0xd3a3('0x7')](_0xd3a3('0xa'),auth[_0xd3a3('0x8')](),controller['show']);router[_0xd3a3('0x7')](_0xd3a3('0xb'),auth[_0xd3a3('0x8')](),controller[_0xd3a3('0xc')]);router[_0xd3a3('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xd3a3('0xd')]);router['get'](_0xd3a3('0xe'),auth[_0xd3a3('0x8')](),controller[_0xd3a3('0xf')]);router['post']('/',auth[_0xd3a3('0x8')](),controller[_0xd3a3('0x10')]);router['put']('/:id',auth[_0xd3a3('0x8')](),controller['update']);router[_0xd3a3('0x11')](_0xd3a3('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd3a3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5aa3cff..bfe4085 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 _0x0ba5=['exports','STRING','sequelize'];(function(_0xa1b3fc,_0x4f934a){var _0x248941=function(_0x22a6ff){while(--_0x22a6ff){_0xa1b3fc['push'](_0xa1b3fc['shift']());}};_0x248941(++_0x4f934a);}(_0x0ba5,0xdd));var _0x50ba=function(_0x3477c4,_0x309176){_0x3477c4=_0x3477c4-0x0;var _0xb1b1b5=_0x0ba5[_0x3477c4];return _0xb1b1b5;};'use strict';var Sequelize=require(_0x50ba('0x0'));module[_0x50ba('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x50ba('0x2')]}}; \ No newline at end of file +var _0x1ce2=['sequelize'];(function(_0x3a3031,_0x4b81ef){var _0x26e513=function(_0x34f76c){while(--_0x34f76c){_0x3a3031['push'](_0x3a3031['shift']());}};_0x26e513(++_0x4b81ef);}(_0x1ce2,0x18f));var _0x21ce=function(_0x220282,_0x34bed0){_0x220282=_0x220282-0x0;var _0x2b7483=_0x1ce2[_0x220282];return _0x2b7483;};'use strict';var Sequelize=require(_0x21ce('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index db3d1d1..51bdc35 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 _0xd8fd=['filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','VtigerConfiguration','findAll','rows','catch','show','params','includeAll','include','options','create','body','find','findOne','VtigerField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys'];(function(_0x38ea24,_0x4b3303){var _0x3a9f67=function(_0x35c0e2){while(--_0x35c0e2){_0x38ea24['push'](_0x38ea24['shift']());}};_0x3a9f67(++_0x4b3303);}(_0xd8fd,0x16c));var _0xdd8f=function(_0x79ebc5,_0x2df5d1){_0x79ebc5=_0x79ebc5-0x0;var _0x3813b6=_0xd8fd[_0x79ebc5];return _0x3813b6;};'use strict';var emlformat=require(_0xdd8f('0x0'));var rimraf=require(_0xdd8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd8f('0x2'));var rp=require(_0xdd8f('0x3'));var moment=require(_0xdd8f('0x4'));var BPromise=require(_0xdd8f('0x5'));var Mustache=require(_0xdd8f('0x6'));var util=require(_0xdd8f('0x7'));var path=require(_0xdd8f('0x8'));var sox=require(_0xdd8f('0x9'));var csv=require(_0xdd8f('0xa'));var ejs=require(_0xdd8f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd8f('0xc'));var squel=require(_0xdd8f('0xd'));var crypto=require('crypto');var jsforce=require(_0xdd8f('0xe'));var deskjs=require(_0xdd8f('0xf'));var toCsv=require(_0xdd8f('0xa'));var querystring=require(_0xdd8f('0x10'));var Papa=require(_0xdd8f('0x11'));var Redis=require('ioredis');var authService=require(_0xdd8f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdd8f('0x13'));var hardwareService=require(_0xdd8f('0x14'));var logger=require(_0xdd8f('0x15'))('api');var utils=require(_0xdd8f('0x16'));var config=require(_0xdd8f('0x17'));var licenseUtil=require(_0xdd8f('0x18'));var db=require(_0xdd8f('0x19'))['db'];function respondWithStatusCode(_0x513742,_0x4ace5a){_0x4ace5a=_0x4ace5a||0xcc;return function(_0x3390c4){if(_0x3390c4){return _0x513742[_0xdd8f('0x1a')](_0x4ace5a);}return _0x513742['status'](_0x4ace5a)['end']();};}function respondWithResult(_0x4e478c,_0xdd974e){_0xdd974e=_0xdd974e||0xc8;return function(_0x13b6b8){if(_0x13b6b8){return _0x4e478c[_0xdd8f('0x1b')](_0xdd974e)[_0xdd8f('0x1c')](_0x13b6b8);}};}function respondWithFilteredResult(_0x8f7507,_0x4d195b){return function(_0x33e29b){if(_0x33e29b){var _0x4eb342=typeof _0x4d195b[_0xdd8f('0x1d')]===_0xdd8f('0x1e')&&typeof _0x4d195b[_0xdd8f('0x1f')]==='undefined';var _0x3cc75a=_0x33e29b['count'];var _0x31c0a0=_0x4eb342?0x0:_0x4d195b[_0xdd8f('0x1d')];var _0x53323d=_0x4eb342?_0x33e29b[_0xdd8f('0x20')]:_0x4d195b['offset']+_0x4d195b[_0xdd8f('0x1f')];var _0x2abfdc;if(_0x53323d>=_0x3cc75a){_0x53323d=_0x3cc75a;_0x2abfdc=0xc8;}else{_0x2abfdc=0xce;}_0x8f7507[_0xdd8f('0x1b')](_0x2abfdc);return _0x8f7507[_0xdd8f('0x21')]('Content-Range',_0x31c0a0+'-'+_0x53323d+'/'+_0x3cc75a)[_0xdd8f('0x1c')](_0x33e29b);}return null;};}function patchUpdates(_0x3c2bb3){return function(_0x44ac94){try{jsonpatch[_0xdd8f('0x22')](_0x44ac94,_0x3c2bb3,!![]);}catch(_0x34b2bc){return BPromise[_0xdd8f('0x23')](_0x34b2bc);}return _0x44ac94[_0xdd8f('0x24')]();};}function saveUpdates(_0x428c54,_0x4c7b5b){return function(_0x21511f){if(_0x21511f){return _0x21511f[_0xdd8f('0x25')](_0x428c54)[_0xdd8f('0x26')](function(_0xe6d656){return _0xe6d656;});}return null;};}function removeEntity(_0x4b5382,_0xb9a33c){return function(_0x330ed7){if(_0x330ed7){return _0x330ed7[_0xdd8f('0x27')]()[_0xdd8f('0x26')](function(){_0x4b5382['status'](0xcc)[_0xdd8f('0x28')]();});}};}function handleEntityNotFound(_0x4862c2,_0x5d09de){return function(_0x3d0be7){if(!_0x3d0be7){_0x4862c2['sendStatus'](0x194);}return _0x3d0be7;};}function handleError(_0x10ac74,_0x59b8d6){_0x59b8d6=_0x59b8d6||0x1f4;return function(_0xdf3192){logger['error'](_0xdf3192[_0xdd8f('0x29')]);if(_0xdf3192[_0xdd8f('0x2a')]){delete _0xdf3192[_0xdd8f('0x2a')];}_0x10ac74[_0xdd8f('0x1b')](_0x59b8d6)[_0xdd8f('0x2b')](_0xdf3192);};}exports['index']=function(_0x254b03,_0x46896e){var _0x53c105={},_0x1ef359={},_0x4c7eec={'count':0x0,'rows':[]};var _0x3586ca=_[_0xdd8f('0x2c')](db['VtigerConfiguration'][_0xdd8f('0x2d')],function(_0x34aecb){return{'name':_0x34aecb[_0xdd8f('0x2e')],'type':_0x34aecb[_0xdd8f('0x2f')][_0xdd8f('0x30')]};});_0x1ef359['model']=_[_0xdd8f('0x2c')](_0x3586ca,_0xdd8f('0x2a'));_0x1ef359[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x254b03[_0xdd8f('0x31')]);_0x1ef359[_0xdd8f('0x33')]=_['intersection'](_0x1ef359['model'],_0x1ef359[_0xdd8f('0x31')]);_0x53c105[_0xdd8f('0x34')]=_[_0xdd8f('0x35')](_0x1ef359['model'],qs[_0xdd8f('0x36')](_0x254b03['query'][_0xdd8f('0x36')]));_0x53c105['attributes']=_0x53c105[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x53c105['attributes']:_0x1ef359[_0xdd8f('0x38')];if(!_0x254b03[_0xdd8f('0x31')][_0xdd8f('0x39')](_0xdd8f('0x3a'))){_0x53c105[_0xdd8f('0x1f')]=qs[_0xdd8f('0x1f')](_0x254b03[_0xdd8f('0x31')]['limit']);_0x53c105[_0xdd8f('0x1d')]=qs[_0xdd8f('0x1d')](_0x254b03[_0xdd8f('0x31')][_0xdd8f('0x1d')]);}_0x53c105['order']=qs[_0xdd8f('0x3b')](_0x254b03[_0xdd8f('0x31')][_0xdd8f('0x3b')]);_0x53c105['where']=qs['filters'](_[_0xdd8f('0x3c')](_0x254b03['query'],_0x1ef359[_0xdd8f('0x33')]),_0x3586ca);if(_0x254b03[_0xdd8f('0x31')][_0xdd8f('0x3d')]){_0x53c105[_0xdd8f('0x3e')]=_['merge'](_0x53c105[_0xdd8f('0x3e')],{'$or':_[_0xdd8f('0x2c')](_0x3586ca,function(_0x18ed30){if(_0x18ed30[_0xdd8f('0x2f')]!==_0xdd8f('0x3f')){var _0x37fcb4={};_0x37fcb4[_0x18ed30[_0xdd8f('0x2a')]]={'$like':'%'+_0x254b03[_0xdd8f('0x31')]['filter']+'%'};return _0x37fcb4;}})});}_0x53c105=_[_0xdd8f('0x40')]({},_0x53c105,_0x254b03['options']);var _0x42d63f={'where':_0x53c105['where']};return db['VtigerConfiguration'][_0xdd8f('0x20')](_0x42d63f)[_0xdd8f('0x26')](function(_0x28fab2){_0x4c7eec[_0xdd8f('0x20')]=_0x28fab2;if(_0x254b03['query']['includeAll']){_0x53c105['include']=[{'all':!![]}];}return db[_0xdd8f('0x41')][_0xdd8f('0x42')](_0x53c105);})['then'](function(_0x3df864){_0x4c7eec[_0xdd8f('0x43')]=_0x3df864;return _0x4c7eec;})[_0xdd8f('0x26')](respondWithFilteredResult(_0x46896e,_0x53c105))[_0xdd8f('0x44')](handleError(_0x46896e,null));};exports[_0xdd8f('0x45')]=function(_0x255365,_0x4981e0){var _0x386c5b={'raw':![],'where':{'id':_0x255365[_0xdd8f('0x46')]['id']}},_0x1d3f3c={};_0x1d3f3c[_0xdd8f('0x38')]=_[_0xdd8f('0x32')](db['VtigerConfiguration']['rawAttributes']);_0x1d3f3c[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x255365[_0xdd8f('0x31')]);_0x1d3f3c[_0xdd8f('0x33')]=_[_0xdd8f('0x35')](_0x1d3f3c[_0xdd8f('0x38')],_0x1d3f3c['query']);_0x386c5b[_0xdd8f('0x34')]=_[_0xdd8f('0x35')](_0x1d3f3c[_0xdd8f('0x38')],qs[_0xdd8f('0x36')](_0x255365['query'][_0xdd8f('0x36')]));_0x386c5b[_0xdd8f('0x34')]=_0x386c5b[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x386c5b[_0xdd8f('0x34')]:_0x1d3f3c[_0xdd8f('0x38')];if(_0x255365[_0xdd8f('0x31')][_0xdd8f('0x47')]){_0x386c5b[_0xdd8f('0x48')]=[{'all':!![]}];}_0x386c5b=_[_0xdd8f('0x40')]({},_0x386c5b,_0x255365[_0xdd8f('0x49')]);return db['VtigerConfiguration']['find'](_0x386c5b)[_0xdd8f('0x26')](handleEntityNotFound(_0x4981e0,null))[_0xdd8f('0x26')](respondWithResult(_0x4981e0,null))[_0xdd8f('0x44')](handleError(_0x4981e0,null));};exports[_0xdd8f('0x4a')]=function(_0x55b821,_0x3531e9){return db[_0xdd8f('0x41')][_0xdd8f('0x4a')](_0x55b821[_0xdd8f('0x4b')],{})['then'](respondWithResult(_0x3531e9,0xc9))[_0xdd8f('0x44')](handleError(_0x3531e9,null));};exports[_0xdd8f('0x25')]=function(_0x4f8ee5,_0x5f36ed){if(_0x4f8ee5[_0xdd8f('0x4b')]['id']){delete _0x4f8ee5[_0xdd8f('0x4b')]['id'];}return db[_0xdd8f('0x41')][_0xdd8f('0x4c')]({'where':{'id':_0x4f8ee5['params']['id']}})[_0xdd8f('0x26')](handleEntityNotFound(_0x5f36ed,null))[_0xdd8f('0x26')](saveUpdates(_0x4f8ee5[_0xdd8f('0x4b')],null))[_0xdd8f('0x26')](respondWithResult(_0x5f36ed,null))['catch'](handleError(_0x5f36ed,null));};exports['destroy']=function(_0x1e9b9d,_0xe7e825){return db[_0xdd8f('0x41')][_0xdd8f('0x4c')]({'where':{'id':_0x1e9b9d[_0xdd8f('0x46')]['id']}})[_0xdd8f('0x26')](handleEntityNotFound(_0xe7e825,null))[_0xdd8f('0x26')](removeEntity(_0xe7e825,null))[_0xdd8f('0x44')](handleError(_0xe7e825,null));};exports['getFields']=function(_0x3657dc,_0x55e5fe,_0x1b1b4e){var _0x5d94bd={};var _0x47ab01={};var _0x272576;var _0x3d436d;return db['VtigerConfiguration'][_0xdd8f('0x4d')]({'where':{'id':_0x3657dc[_0xdd8f('0x46')]['id']}})['then'](handleEntityNotFound(_0x55e5fe,null))[_0xdd8f('0x26')](function(_0x1a06c0){if(_0x1a06c0){_0x272576=_0x1a06c0;_0x47ab01['model']=_['keys'](db[_0xdd8f('0x4e')][_0xdd8f('0x2d')]);_0x47ab01[_0xdd8f('0x31')]=_['keys'](_0x3657dc[_0xdd8f('0x31')]);_0x47ab01[_0xdd8f('0x33')]=_['intersection'](_0x47ab01[_0xdd8f('0x38')],_0x47ab01[_0xdd8f('0x31')]);_0x5d94bd[_0xdd8f('0x34')]=_['intersection'](_0x47ab01['model'],qs[_0xdd8f('0x36')](_0x3657dc[_0xdd8f('0x31')][_0xdd8f('0x36')]));_0x5d94bd['attributes']=_0x5d94bd[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x5d94bd[_0xdd8f('0x34')]:_0x47ab01[_0xdd8f('0x38')];_0x5d94bd[_0xdd8f('0x4f')]=qs[_0xdd8f('0x3b')](_0x3657dc[_0xdd8f('0x31')]['sort']);_0x5d94bd['where']=qs[_0xdd8f('0x33')](_[_0xdd8f('0x3c')](_0x3657dc[_0xdd8f('0x31')],_0x47ab01[_0xdd8f('0x33')]));if(_0x3657dc['query'][_0xdd8f('0x3d')]){_0x5d94bd[_0xdd8f('0x3e')]=_[_0xdd8f('0x40')](_0x5d94bd[_0xdd8f('0x3e')],{'$or':_[_0xdd8f('0x2c')](_0x5d94bd[_0xdd8f('0x34')],function(_0xc611d7){var _0x31665a={};_0x31665a[_0xc611d7]={'$like':'%'+_0x3657dc['query'][_0xdd8f('0x3d')]+'%'};return _0x31665a;})});}_0x5d94bd=_[_0xdd8f('0x40')]({},_0x5d94bd,_0x3657dc[_0xdd8f('0x49')]);return _0x272576[_0xdd8f('0x50')](_0x5d94bd);}})['then'](function(_0x1cec44){if(_0x1cec44){_0x3d436d=_0x1cec44[_0xdd8f('0x37')];if(!_0x3657dc[_0xdd8f('0x31')]['hasOwnProperty'](_0xdd8f('0x3a'))){_0x5d94bd[_0xdd8f('0x1f')]=qs[_0xdd8f('0x1f')](_0x3657dc[_0xdd8f('0x31')]['limit']);_0x5d94bd[_0xdd8f('0x1d')]=qs[_0xdd8f('0x1d')](_0x3657dc[_0xdd8f('0x31')][_0xdd8f('0x1d')]);}return _0x272576[_0xdd8f('0x50')](_0x5d94bd);}})[_0xdd8f('0x26')](function(_0x2275a8){if(_0x2275a8){return _0x2275a8?{'count':_0x3d436d,'rows':_0x2275a8}:null;}})['then'](respondWithResult(_0x55e5fe,null))[_0xdd8f('0x44')](handleError(_0x55e5fe,null));};exports[_0xdd8f('0x51')]=function(_0x1d13ce,_0x374bd7,_0x4ed142){var _0x23b7bb={};var _0x45b533={};var _0x5f2767;var _0x52e6cb;return db['VtigerConfiguration'][_0xdd8f('0x4d')]({'where':{'id':_0x1d13ce[_0xdd8f('0x46')]['id']}})[_0xdd8f('0x26')](handleEntityNotFound(_0x374bd7,null))['then'](function(_0xfa0778){if(_0xfa0778){_0x5f2767=_0xfa0778;_0x45b533[_0xdd8f('0x38')]=_[_0xdd8f('0x32')](db['VtigerField'][_0xdd8f('0x2d')]);_0x45b533[_0xdd8f('0x31')]=_['keys'](_0x1d13ce[_0xdd8f('0x31')]);_0x45b533[_0xdd8f('0x33')]=_[_0xdd8f('0x35')](_0x45b533[_0xdd8f('0x38')],_0x45b533[_0xdd8f('0x31')]);_0x23b7bb[_0xdd8f('0x34')]=_[_0xdd8f('0x35')](_0x45b533[_0xdd8f('0x38')],qs[_0xdd8f('0x36')](_0x1d13ce[_0xdd8f('0x31')][_0xdd8f('0x36')]));_0x23b7bb['attributes']=_0x23b7bb[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x23b7bb[_0xdd8f('0x34')]:_0x45b533[_0xdd8f('0x38')];_0x23b7bb[_0xdd8f('0x4f')]=qs[_0xdd8f('0x3b')](_0x1d13ce['query'][_0xdd8f('0x3b')]);_0x23b7bb[_0xdd8f('0x3e')]=qs[_0xdd8f('0x33')](_['pick'](_0x1d13ce[_0xdd8f('0x31')],_0x45b533['filters']));if(_0x1d13ce['query'][_0xdd8f('0x3d')]){_0x23b7bb[_0xdd8f('0x3e')]=_['merge'](_0x23b7bb[_0xdd8f('0x3e')],{'$or':_[_0xdd8f('0x2c')](_0x23b7bb['attributes'],function(_0x29eae5){var _0x4fdf7d={};_0x4fdf7d[_0x29eae5]={'$like':'%'+_0x1d13ce[_0xdd8f('0x31')][_0xdd8f('0x3d')]+'%'};return _0x4fdf7d;})});}_0x23b7bb=_[_0xdd8f('0x40')]({},_0x23b7bb,_0x1d13ce[_0xdd8f('0x49')]);return _0x5f2767['getSubjects'](_0x23b7bb);}})[_0xdd8f('0x26')](function(_0x2c1265){if(_0x2c1265){_0x52e6cb=_0x2c1265[_0xdd8f('0x37')];if(!_0x1d13ce[_0xdd8f('0x31')]['hasOwnProperty'](_0xdd8f('0x3a'))){_0x23b7bb[_0xdd8f('0x1f')]=qs[_0xdd8f('0x1f')](_0x1d13ce['query']['limit']);_0x23b7bb['offset']=qs[_0xdd8f('0x1d')](_0x1d13ce[_0xdd8f('0x31')]['offset']);}return _0x5f2767['getSubjects'](_0x23b7bb);}})['then'](function(_0x290a1b){if(_0x290a1b){return _0x290a1b?{'count':_0x52e6cb,'rows':_0x290a1b}:null;}})['then'](respondWithResult(_0x374bd7,null))[_0xdd8f('0x44')](handleError(_0x374bd7,null));};exports[_0xdd8f('0x52')]=function(_0x1c17f3,_0x5b3e3e,_0x3c7d2b){var _0x19cdad={};var _0x14b5d3={};var _0x5185b8;var _0x279750;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1c17f3[_0xdd8f('0x46')]['id']}})[_0xdd8f('0x26')](handleEntityNotFound(_0x5b3e3e,null))[_0xdd8f('0x26')](function(_0x53ab3a){if(_0x53ab3a){_0x5185b8=_0x53ab3a;_0x14b5d3[_0xdd8f('0x38')]=_[_0xdd8f('0x32')](db[_0xdd8f('0x4e')][_0xdd8f('0x2d')]);_0x14b5d3[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x1c17f3['query']);_0x14b5d3[_0xdd8f('0x33')]=_['intersection'](_0x14b5d3[_0xdd8f('0x38')],_0x14b5d3[_0xdd8f('0x31')]);_0x19cdad['attributes']=_[_0xdd8f('0x35')](_0x14b5d3[_0xdd8f('0x38')],qs[_0xdd8f('0x36')](_0x1c17f3['query'][_0xdd8f('0x36')]));_0x19cdad[_0xdd8f('0x34')]=_0x19cdad[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x19cdad[_0xdd8f('0x34')]:_0x14b5d3[_0xdd8f('0x38')];_0x19cdad[_0xdd8f('0x4f')]=qs[_0xdd8f('0x3b')](_0x1c17f3['query'][_0xdd8f('0x3b')]);_0x19cdad['where']=qs[_0xdd8f('0x33')](_[_0xdd8f('0x3c')](_0x1c17f3[_0xdd8f('0x31')],_0x14b5d3[_0xdd8f('0x33')]));if(_0x1c17f3[_0xdd8f('0x31')][_0xdd8f('0x3d')]){_0x19cdad[_0xdd8f('0x3e')]=_['merge'](_0x19cdad[_0xdd8f('0x3e')],{'$or':_[_0xdd8f('0x2c')](_0x19cdad[_0xdd8f('0x34')],function(_0x6fab67){var _0x44b305={};_0x44b305[_0x6fab67]={'$like':'%'+_0x1c17f3[_0xdd8f('0x31')][_0xdd8f('0x3d')]+'%'};return _0x44b305;})});}_0x19cdad=_[_0xdd8f('0x40')]({},_0x19cdad,_0x1c17f3[_0xdd8f('0x49')]);return _0x5185b8[_0xdd8f('0x52')](_0x19cdad);}})[_0xdd8f('0x26')](function(_0x21c619){if(_0x21c619){_0x279750=_0x21c619[_0xdd8f('0x37')];if(!_0x1c17f3[_0xdd8f('0x31')][_0xdd8f('0x39')](_0xdd8f('0x3a'))){_0x19cdad[_0xdd8f('0x1f')]=qs[_0xdd8f('0x1f')](_0x1c17f3[_0xdd8f('0x31')]['limit']);_0x19cdad[_0xdd8f('0x1d')]=qs['offset'](_0x1c17f3[_0xdd8f('0x31')]['offset']);}return _0x5185b8[_0xdd8f('0x52')](_0x19cdad);}})['then'](function(_0x3b9dfc){if(_0x3b9dfc){return _0x3b9dfc?{'count':_0x279750,'rows':_0x3b9dfc}:null;}})[_0xdd8f('0x26')](respondWithResult(_0x5b3e3e,null))[_0xdd8f('0x44')](handleError(_0x5b3e3e,null));}; \ No newline at end of file +var _0xba33=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','VtigerConfiguration','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','VtigerField','options','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0xba33,0xf1));var _0x3ba3=function(_0x532178,_0xc1e212){_0x532178=_0x532178-0x0;var _0x3075fd=_0xba33[_0x532178];return _0x3075fd;};'use strict';var emlformat=require(_0x3ba3('0x0'));var rimraf=require(_0x3ba3('0x1'));var zipdir=require(_0x3ba3('0x2'));var jsonpatch=require(_0x3ba3('0x3'));var rp=require('request-promise');var moment=require(_0x3ba3('0x4'));var BPromise=require(_0x3ba3('0x5'));var Mustache=require(_0x3ba3('0x6'));var util=require(_0x3ba3('0x7'));var path=require(_0x3ba3('0x8'));var sox=require(_0x3ba3('0x9'));var csv=require(_0x3ba3('0xa'));var ejs=require(_0x3ba3('0xb'));var fs=require('fs');var fs_extra=require(_0x3ba3('0xc'));var _=require(_0x3ba3('0xd'));var squel=require(_0x3ba3('0xe'));var crypto=require('crypto');var jsforce=require(_0x3ba3('0xf'));var deskjs=require(_0x3ba3('0x10'));var toCsv=require(_0x3ba3('0xa'));var querystring=require(_0x3ba3('0x11'));var Papa=require(_0x3ba3('0x12'));var Redis=require('ioredis');var authService=require(_0x3ba3('0x13'));var qs=require(_0x3ba3('0x14'));var as=require(_0x3ba3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3ba3('0x16'));var config=require(_0x3ba3('0x17'));var licenseUtil=require(_0x3ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3bd8,_0x3d27b0){_0x3d27b0=_0x3d27b0||0xcc;return function(_0x4f0516){if(_0x4f0516){return _0x2b3bd8[_0x3ba3('0x19')](_0x3d27b0);}return _0x2b3bd8[_0x3ba3('0x1a')](_0x3d27b0)[_0x3ba3('0x1b')]();};}function respondWithResult(_0x2eb8ec,_0x3a3728){_0x3a3728=_0x3a3728||0xc8;return function(_0x32a195){if(_0x32a195){return _0x2eb8ec[_0x3ba3('0x1a')](_0x3a3728)[_0x3ba3('0x1c')](_0x32a195);}};}function respondWithFilteredResult(_0x162bcb,_0x262c86){return function(_0x43025d){if(_0x43025d){var _0x5dbc84=typeof _0x262c86['offset']==='undefined'&&typeof _0x262c86[_0x3ba3('0x1d')]==='undefined';var _0x2f8436=_0x43025d['count'];var _0x399cc3=_0x5dbc84?0x0:_0x262c86[_0x3ba3('0x1e')];var _0x1d446b=_0x5dbc84?_0x43025d[_0x3ba3('0x1f')]:_0x262c86[_0x3ba3('0x1e')]+_0x262c86[_0x3ba3('0x1d')];var _0x81e0a;if(_0x1d446b>=_0x2f8436){_0x1d446b=_0x2f8436;_0x81e0a=0xc8;}else{_0x81e0a=0xce;}_0x162bcb[_0x3ba3('0x1a')](_0x81e0a);return _0x162bcb[_0x3ba3('0x20')](_0x3ba3('0x21'),_0x399cc3+'-'+_0x1d446b+'/'+_0x2f8436)[_0x3ba3('0x1c')](_0x43025d);}return null;};}function patchUpdates(_0x1a3711){return function(_0x23056e){try{jsonpatch[_0x3ba3('0x22')](_0x23056e,_0x1a3711,!![]);}catch(_0x268216){return BPromise[_0x3ba3('0x23')](_0x268216);}return _0x23056e[_0x3ba3('0x24')]();};}function saveUpdates(_0x5eb7bf,_0x5c47f3){return function(_0x3555d8){if(_0x3555d8){return _0x3555d8[_0x3ba3('0x25')](_0x5eb7bf)[_0x3ba3('0x26')](function(_0xf88867){return _0xf88867;});}return null;};}function removeEntity(_0x4caa7e,_0x1a1de4){return function(_0x283a96){if(_0x283a96){return _0x283a96[_0x3ba3('0x27')]()[_0x3ba3('0x26')](function(){_0x4caa7e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd8f1,_0x269686){return function(_0x10c27f){if(!_0x10c27f){_0x2cd8f1[_0x3ba3('0x19')](0x194);}return _0x10c27f;};}function handleError(_0x951c23,_0x28a908){_0x28a908=_0x28a908||0x1f4;return function(_0x3f831b){logger[_0x3ba3('0x28')](_0x3f831b[_0x3ba3('0x29')]);if(_0x3f831b['name']){delete _0x3f831b['name'];}_0x951c23[_0x3ba3('0x1a')](_0x28a908)[_0x3ba3('0x2a')](_0x3f831b);};}exports[_0x3ba3('0x2b')]=function(_0x5ddb25,_0x217562){var _0x31296c={},_0x3623a4={},_0x3e0d9e={'count':0x0,'rows':[]};var _0x30b870=_[_0x3ba3('0x2c')](db['VtigerConfiguration']['rawAttributes'],function(_0x4a4c6c){return{'name':_0x4a4c6c[_0x3ba3('0x2d')],'type':_0x4a4c6c[_0x3ba3('0x2e')][_0x3ba3('0x2f')]};});_0x3623a4[_0x3ba3('0x30')]=_[_0x3ba3('0x2c')](_0x30b870,_0x3ba3('0x31'));_0x3623a4[_0x3ba3('0x32')]=_[_0x3ba3('0x33')](_0x5ddb25[_0x3ba3('0x32')]);_0x3623a4[_0x3ba3('0x34')]=_[_0x3ba3('0x35')](_0x3623a4[_0x3ba3('0x30')],_0x3623a4[_0x3ba3('0x32')]);_0x31296c[_0x3ba3('0x36')]=_[_0x3ba3('0x35')](_0x3623a4[_0x3ba3('0x30')],qs[_0x3ba3('0x37')](_0x5ddb25[_0x3ba3('0x32')]['fields']));_0x31296c[_0x3ba3('0x36')]=_0x31296c['attributes'][_0x3ba3('0x38')]?_0x31296c[_0x3ba3('0x36')]:_0x3623a4['model'];if(!_0x5ddb25[_0x3ba3('0x32')][_0x3ba3('0x39')](_0x3ba3('0x3a'))){_0x31296c[_0x3ba3('0x1d')]=qs[_0x3ba3('0x1d')](_0x5ddb25[_0x3ba3('0x32')][_0x3ba3('0x1d')]);_0x31296c[_0x3ba3('0x1e')]=qs['offset'](_0x5ddb25['query'][_0x3ba3('0x1e')]);}_0x31296c[_0x3ba3('0x3b')]=qs['sort'](_0x5ddb25[_0x3ba3('0x32')][_0x3ba3('0x3c')]);_0x31296c[_0x3ba3('0x3d')]=qs[_0x3ba3('0x34')](_[_0x3ba3('0x3e')](_0x5ddb25[_0x3ba3('0x32')],_0x3623a4[_0x3ba3('0x34')]),_0x30b870);if(_0x5ddb25[_0x3ba3('0x32')]['filter']){_0x31296c[_0x3ba3('0x3d')]=_[_0x3ba3('0x3f')](_0x31296c[_0x3ba3('0x3d')],{'$or':_[_0x3ba3('0x2c')](_0x30b870,function(_0x345f44){if(_0x345f44['type']!==_0x3ba3('0x40')){var _0x246fb4={};_0x246fb4[_0x345f44[_0x3ba3('0x31')]]={'$like':'%'+_0x5ddb25['query'][_0x3ba3('0x41')]+'%'};return _0x246fb4;}})});}_0x31296c=_[_0x3ba3('0x3f')]({},_0x31296c,_0x5ddb25['options']);var _0x40896e={'where':_0x31296c['where']};return db[_0x3ba3('0x42')]['count'](_0x40896e)[_0x3ba3('0x26')](function(_0x5ca1bf){_0x3e0d9e[_0x3ba3('0x1f')]=_0x5ca1bf;if(_0x5ddb25[_0x3ba3('0x32')]['includeAll']){_0x31296c[_0x3ba3('0x43')]=[{'all':!![]}];}return db[_0x3ba3('0x42')][_0x3ba3('0x44')](_0x31296c);})[_0x3ba3('0x26')](function(_0x3af4d2){_0x3e0d9e[_0x3ba3('0x45')]=_0x3af4d2;return _0x3e0d9e;})['then'](respondWithFilteredResult(_0x217562,_0x31296c))[_0x3ba3('0x46')](handleError(_0x217562,null));};exports[_0x3ba3('0x47')]=function(_0x23934e,_0x56b82f){var _0x4e23e1={'raw':![],'where':{'id':_0x23934e[_0x3ba3('0x48')]['id']}},_0x14f76f={};_0x14f76f[_0x3ba3('0x30')]=_[_0x3ba3('0x33')](db[_0x3ba3('0x42')][_0x3ba3('0x49')]);_0x14f76f[_0x3ba3('0x32')]=_[_0x3ba3('0x33')](_0x23934e[_0x3ba3('0x32')]);_0x14f76f[_0x3ba3('0x34')]=_[_0x3ba3('0x35')](_0x14f76f[_0x3ba3('0x30')],_0x14f76f[_0x3ba3('0x32')]);_0x4e23e1[_0x3ba3('0x36')]=_[_0x3ba3('0x35')](_0x14f76f[_0x3ba3('0x30')],qs[_0x3ba3('0x37')](_0x23934e['query']['fields']));_0x4e23e1[_0x3ba3('0x36')]=_0x4e23e1[_0x3ba3('0x36')][_0x3ba3('0x38')]?_0x4e23e1[_0x3ba3('0x36')]:_0x14f76f[_0x3ba3('0x30')];if(_0x23934e[_0x3ba3('0x32')]['includeAll']){_0x4e23e1[_0x3ba3('0x43')]=[{'all':!![]}];}_0x4e23e1=_['merge']({},_0x4e23e1,_0x23934e['options']);return db[_0x3ba3('0x42')][_0x3ba3('0x4a')](_0x4e23e1)[_0x3ba3('0x26')](handleEntityNotFound(_0x56b82f,null))[_0x3ba3('0x26')](respondWithResult(_0x56b82f,null))[_0x3ba3('0x46')](handleError(_0x56b82f,null));};exports['create']=function(_0x8998df,_0x25ee17){return db[_0x3ba3('0x42')][_0x3ba3('0x4b')](_0x8998df[_0x3ba3('0x4c')],{})['then'](respondWithResult(_0x25ee17,0xc9))[_0x3ba3('0x46')](handleError(_0x25ee17,null));};exports[_0x3ba3('0x25')]=function(_0x417d5c,_0x386259){if(_0x417d5c['body']['id']){delete _0x417d5c[_0x3ba3('0x4c')]['id'];}return db[_0x3ba3('0x42')][_0x3ba3('0x4a')]({'where':{'id':_0x417d5c['params']['id']}})[_0x3ba3('0x26')](handleEntityNotFound(_0x386259,null))[_0x3ba3('0x26')](saveUpdates(_0x417d5c[_0x3ba3('0x4c')],null))['then'](respondWithResult(_0x386259,null))['catch'](handleError(_0x386259,null));};exports[_0x3ba3('0x27')]=function(_0x34943b,_0x302b5e){return db[_0x3ba3('0x42')][_0x3ba3('0x4a')]({'where':{'id':_0x34943b[_0x3ba3('0x48')]['id']}})['then'](handleEntityNotFound(_0x302b5e,null))['then'](removeEntity(_0x302b5e,null))[_0x3ba3('0x46')](handleError(_0x302b5e,null));};exports[_0x3ba3('0x4d')]=function(_0x56549a,_0x5f19c2,_0x2609c3){var _0x419029={};var _0x1dd34f={};var _0x318424;var _0x549c94;return db[_0x3ba3('0x42')][_0x3ba3('0x4e')]({'where':{'id':_0x56549a['params']['id']}})['then'](handleEntityNotFound(_0x5f19c2,null))[_0x3ba3('0x26')](function(_0x3495e6){if(_0x3495e6){_0x318424=_0x3495e6;_0x1dd34f['model']=_[_0x3ba3('0x33')](db[_0x3ba3('0x4f')][_0x3ba3('0x49')]);_0x1dd34f[_0x3ba3('0x32')]=_[_0x3ba3('0x33')](_0x56549a['query']);_0x1dd34f[_0x3ba3('0x34')]=_[_0x3ba3('0x35')](_0x1dd34f['model'],_0x1dd34f['query']);_0x419029[_0x3ba3('0x36')]=_[_0x3ba3('0x35')](_0x1dd34f[_0x3ba3('0x30')],qs['fields'](_0x56549a['query']['fields']));_0x419029[_0x3ba3('0x36')]=_0x419029['attributes'][_0x3ba3('0x38')]?_0x419029[_0x3ba3('0x36')]:_0x1dd34f['model'];_0x419029[_0x3ba3('0x3b')]=qs['sort'](_0x56549a[_0x3ba3('0x32')]['sort']);_0x419029[_0x3ba3('0x3d')]=qs[_0x3ba3('0x34')](_[_0x3ba3('0x3e')](_0x56549a[_0x3ba3('0x32')],_0x1dd34f[_0x3ba3('0x34')]));if(_0x56549a[_0x3ba3('0x32')][_0x3ba3('0x41')]){_0x419029[_0x3ba3('0x3d')]=_[_0x3ba3('0x3f')](_0x419029[_0x3ba3('0x3d')],{'$or':_[_0x3ba3('0x2c')](_0x419029[_0x3ba3('0x36')],function(_0x36a3d9){var _0x2b910a={};_0x2b910a[_0x36a3d9]={'$like':'%'+_0x56549a[_0x3ba3('0x32')]['filter']+'%'};return _0x2b910a;})});}_0x419029=_[_0x3ba3('0x3f')]({},_0x419029,_0x56549a[_0x3ba3('0x50')]);return _0x318424[_0x3ba3('0x4d')](_0x419029);}})[_0x3ba3('0x26')](function(_0x4db714){if(_0x4db714){_0x549c94=_0x4db714[_0x3ba3('0x38')];if(!_0x56549a[_0x3ba3('0x32')][_0x3ba3('0x39')]('nolimit')){_0x419029[_0x3ba3('0x1d')]=qs[_0x3ba3('0x1d')](_0x56549a[_0x3ba3('0x32')][_0x3ba3('0x1d')]);_0x419029[_0x3ba3('0x1e')]=qs[_0x3ba3('0x1e')](_0x56549a[_0x3ba3('0x32')]['offset']);}return _0x318424['getFields'](_0x419029);}})[_0x3ba3('0x26')](function(_0x1113cb){if(_0x1113cb){return _0x1113cb?{'count':_0x549c94,'rows':_0x1113cb}:null;}})[_0x3ba3('0x26')](respondWithResult(_0x5f19c2,null))[_0x3ba3('0x46')](handleError(_0x5f19c2,null));};exports[_0x3ba3('0x51')]=function(_0x4093da,_0x464674,_0x21f55b){var _0xf00b83={};var _0x313ef8={};var _0x547c59;var _0x30f805;return db[_0x3ba3('0x42')][_0x3ba3('0x4e')]({'where':{'id':_0x4093da[_0x3ba3('0x48')]['id']}})[_0x3ba3('0x26')](handleEntityNotFound(_0x464674,null))[_0x3ba3('0x26')](function(_0x34f8a3){if(_0x34f8a3){_0x547c59=_0x34f8a3;_0x313ef8['model']=_[_0x3ba3('0x33')](db['VtigerField'][_0x3ba3('0x49')]);_0x313ef8[_0x3ba3('0x32')]=_[_0x3ba3('0x33')](_0x4093da['query']);_0x313ef8[_0x3ba3('0x34')]=_['intersection'](_0x313ef8[_0x3ba3('0x30')],_0x313ef8['query']);_0xf00b83['attributes']=_[_0x3ba3('0x35')](_0x313ef8[_0x3ba3('0x30')],qs[_0x3ba3('0x37')](_0x4093da[_0x3ba3('0x32')][_0x3ba3('0x37')]));_0xf00b83[_0x3ba3('0x36')]=_0xf00b83['attributes'][_0x3ba3('0x38')]?_0xf00b83[_0x3ba3('0x36')]:_0x313ef8[_0x3ba3('0x30')];_0xf00b83[_0x3ba3('0x3b')]=qs['sort'](_0x4093da['query'][_0x3ba3('0x3c')]);_0xf00b83[_0x3ba3('0x3d')]=qs[_0x3ba3('0x34')](_[_0x3ba3('0x3e')](_0x4093da[_0x3ba3('0x32')],_0x313ef8[_0x3ba3('0x34')]));if(_0x4093da['query']['filter']){_0xf00b83['where']=_['merge'](_0xf00b83[_0x3ba3('0x3d')],{'$or':_[_0x3ba3('0x2c')](_0xf00b83[_0x3ba3('0x36')],function(_0x189a7d){var _0x3632b4={};_0x3632b4[_0x189a7d]={'$like':'%'+_0x4093da['query'][_0x3ba3('0x41')]+'%'};return _0x3632b4;})});}_0xf00b83=_[_0x3ba3('0x3f')]({},_0xf00b83,_0x4093da[_0x3ba3('0x50')]);return _0x547c59[_0x3ba3('0x51')](_0xf00b83);}})[_0x3ba3('0x26')](function(_0x49f1f7){if(_0x49f1f7){_0x30f805=_0x49f1f7[_0x3ba3('0x38')];if(!_0x4093da['query']['hasOwnProperty'](_0x3ba3('0x3a'))){_0xf00b83['limit']=qs['limit'](_0x4093da[_0x3ba3('0x32')][_0x3ba3('0x1d')]);_0xf00b83[_0x3ba3('0x1e')]=qs['offset'](_0x4093da[_0x3ba3('0x32')][_0x3ba3('0x1e')]);}return _0x547c59[_0x3ba3('0x51')](_0xf00b83);}})[_0x3ba3('0x26')](function(_0x16ae8a){if(_0x16ae8a){return _0x16ae8a?{'count':_0x30f805,'rows':_0x16ae8a}:null;}})[_0x3ba3('0x26')](respondWithResult(_0x464674,null))[_0x3ba3('0x46')](handleError(_0x464674,null));};exports['getDescriptions']=function(_0x55bfd8,_0x654b1c,_0x4aa565){var _0x1964e5={};var _0x25a8d4={};var _0x491aaf;var _0xe94da8;return db['VtigerConfiguration'][_0x3ba3('0x4e')]({'where':{'id':_0x55bfd8[_0x3ba3('0x48')]['id']}})[_0x3ba3('0x26')](handleEntityNotFound(_0x654b1c,null))['then'](function(_0x561f3c){if(_0x561f3c){_0x491aaf=_0x561f3c;_0x25a8d4[_0x3ba3('0x30')]=_[_0x3ba3('0x33')](db['VtigerField'][_0x3ba3('0x49')]);_0x25a8d4[_0x3ba3('0x32')]=_[_0x3ba3('0x33')](_0x55bfd8['query']);_0x25a8d4['filters']=_[_0x3ba3('0x35')](_0x25a8d4['model'],_0x25a8d4[_0x3ba3('0x32')]);_0x1964e5['attributes']=_[_0x3ba3('0x35')](_0x25a8d4[_0x3ba3('0x30')],qs[_0x3ba3('0x37')](_0x55bfd8['query'][_0x3ba3('0x37')]));_0x1964e5[_0x3ba3('0x36')]=_0x1964e5['attributes'][_0x3ba3('0x38')]?_0x1964e5[_0x3ba3('0x36')]:_0x25a8d4[_0x3ba3('0x30')];_0x1964e5[_0x3ba3('0x3b')]=qs[_0x3ba3('0x3c')](_0x55bfd8['query'][_0x3ba3('0x3c')]);_0x1964e5[_0x3ba3('0x3d')]=qs[_0x3ba3('0x34')](_[_0x3ba3('0x3e')](_0x55bfd8[_0x3ba3('0x32')],_0x25a8d4[_0x3ba3('0x34')]));if(_0x55bfd8[_0x3ba3('0x32')][_0x3ba3('0x41')]){_0x1964e5[_0x3ba3('0x3d')]=_['merge'](_0x1964e5[_0x3ba3('0x3d')],{'$or':_[_0x3ba3('0x2c')](_0x1964e5[_0x3ba3('0x36')],function(_0x52293d){var _0x1b5f3f={};_0x1b5f3f[_0x52293d]={'$like':'%'+_0x55bfd8[_0x3ba3('0x32')][_0x3ba3('0x41')]+'%'};return _0x1b5f3f;})});}_0x1964e5=_[_0x3ba3('0x3f')]({},_0x1964e5,_0x55bfd8['options']);return _0x491aaf[_0x3ba3('0x52')](_0x1964e5);}})['then'](function(_0x162671){if(_0x162671){_0xe94da8=_0x162671['length'];if(!_0x55bfd8['query']['hasOwnProperty'](_0x3ba3('0x3a'))){_0x1964e5['limit']=qs['limit'](_0x55bfd8[_0x3ba3('0x32')][_0x3ba3('0x1d')]);_0x1964e5[_0x3ba3('0x1e')]=qs[_0x3ba3('0x1e')](_0x55bfd8['query'][_0x3ba3('0x1e')]);}return _0x491aaf['getDescriptions'](_0x1964e5);}})['then'](function(_0x386eb6){if(_0x386eb6){return _0x386eb6?{'count':_0xe94da8,'rows':_0x386eb6}:null;}})[_0x3ba3('0x26')](respondWithResult(_0x654b1c,null))[_0x3ba3('0x46')](handleError(_0x654b1c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 0320826..5a24a96 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 _0xadf1=['int_vtiger_configurations','../../config/logger','api','moment','bluebird','path','../../config/environment','define'];(function(_0x1408bf,_0x516ced){var _0x4b658d=function(_0x594303){while(--_0x594303){_0x1408bf['push'](_0x1408bf['shift']());}};_0x4b658d(++_0x516ced);}(_0xadf1,0x1a9));var _0x1adf=function(_0x1d0b12,_0x2cea7a){_0x1d0b12=_0x1d0b12-0x0;var _0x4fea7c=_0xadf1[_0x1d0b12];return _0x4fea7c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1adf('0x0'))(_0x1adf('0x1'));var moment=require(_0x1adf('0x2'));var BPromise=require(_0x1adf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1adf('0x4'));var rimraf=require('rimraf');var config=require(_0x1adf('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x5d513d,_0x32d681){return _0x5d513d[_0x1adf('0x6')]('VtigerConfiguration',attributes,{'tableName':_0x1adf('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5944=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x5944,0x1e9));var _0x4594=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x5944[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x4594('0x0'));var util=require(_0x4594('0x1'));var logger=require(_0x4594('0x2'))(_0x4594('0x3'));var moment=require(_0x4594('0x4'));var BPromise=require(_0x4594('0x5'));var rp=require(_0x4594('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4594('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x507b11,_0x4eaaa3){return _0x507b11['define'](_0x4594('0x8'),attributes,{'tableName':_0x4594('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 448c457..1413013 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 _0x5ee1=['message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x280c4b,_0xfe785d){var _0x2a5e90=function(_0x37db79){while(--_0x37db79){_0x280c4b['push'](_0x280c4b['shift']());}};_0x2a5e90(++_0xfe785d);}(_0x5ee1,0xdc));var _0x15ee=function(_0x3b4fd2,_0x4c6337){_0x3b4fd2=_0x3b4fd2-0x0;var _0x494ff2=_0x5ee1[_0x3b4fd2];return _0x494ff2;};'use strict';var _=require(_0x15ee('0x0'));var util=require(_0x15ee('0x1'));var moment=require(_0x15ee('0x2'));var BPromise=require(_0x15ee('0x3'));var rs=require(_0x15ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15ee('0x5'))['db'];var utils=require(_0x15ee('0x6'));var logger=require('../../config/logger')(_0x15ee('0x7'));var config=require(_0x15ee('0x8'));var jayson=require(_0x15ee('0x9'));var client=jayson[_0x15ee('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd907d3,_0x216ce1,_0x3b6399){return new BPromise(function(_0x14fc13,_0x39f82e){return client[_0x15ee('0xb')](_0xd907d3,_0x3b6399)[_0x15ee('0xc')](function(_0x5d18d5){logger[_0x15ee('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x216ce1,_0x15ee('0xe'));logger[_0x15ee('0xf')](_0x15ee('0x10'),_0x216ce1,'request\x20sent',JSON[_0x15ee('0x11')](_0x5d18d5));if(_0x5d18d5[_0x15ee('0x12')]){if(_0x5d18d5[_0x15ee('0x12')][_0x15ee('0x13')]===0x1f4){logger[_0x15ee('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x216ce1,_0x5d18d5[_0x15ee('0x12')]['message']);return _0x39f82e(_0x5d18d5[_0x15ee('0x12')][_0x15ee('0x14')]);}logger[_0x15ee('0x12')](_0x15ee('0x15'),_0x216ce1,_0x5d18d5[_0x15ee('0x12')][_0x15ee('0x14')]);return _0x14fc13(_0x5d18d5[_0x15ee('0x12')][_0x15ee('0x14')]);}else{logger['info'](_0x15ee('0x15'),_0x216ce1,_0x15ee('0xe'));_0x14fc13(_0x5d18d5[_0x15ee('0x16')][_0x15ee('0x14')]);}})[_0x15ee('0x17')](function(_0x1a653b){logger[_0x15ee('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x216ce1,_0x1a653b);_0x39f82e(_0x1a653b);});});} \ No newline at end of file +var _0x6a69=['jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x6a69,0xf6));var _0x96a6=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x6a69[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x96a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x96a6('0x1'));var rs=require(_0x96a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96a6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x96a6('0x4'))(_0x96a6('0x5'));var config=require('../../config/environment');var jayson=require(_0x96a6('0x6'));var client=jayson[_0x96a6('0x7')][_0x96a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa50ddf,_0x18e4c9,_0x2f563e){return new BPromise(function(_0x546469,_0x55afad){return client[_0x96a6('0x9')](_0xa50ddf,_0x2f563e)[_0x96a6('0xa')](function(_0xf6dad2){logger[_0x96a6('0xb')](_0x96a6('0xc'),_0x18e4c9,'request\x20sent');logger[_0x96a6('0xd')](_0x96a6('0xe'),_0x18e4c9,_0x96a6('0xf'),JSON[_0x96a6('0x10')](_0xf6dad2));if(_0xf6dad2[_0x96a6('0x11')]){if(_0xf6dad2['error'][_0x96a6('0x12')]===0x1f4){logger[_0x96a6('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x18e4c9,_0xf6dad2[_0x96a6('0x11')][_0x96a6('0x13')]);return _0x55afad(_0xf6dad2['error']['message']);}logger[_0x96a6('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x18e4c9,_0xf6dad2[_0x96a6('0x11')][_0x96a6('0x13')]);return _0x546469(_0xf6dad2[_0x96a6('0x11')][_0x96a6('0x13')]);}else{logger[_0x96a6('0xb')](_0x96a6('0xc'),_0x18e4c9,_0x96a6('0xf'));_0x546469(_0xf6dad2['result'][_0x96a6('0x13')]);}})[_0x96a6('0x14')](function(_0x21a49d){logger['error'](_0x96a6('0xc'),_0x18e4c9,_0x21a49d);_0x55afad(_0x21a49d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 090faf8..a658097 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 _0x95bb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','show','post','create','update','delete','/:id','exports','multer','util','path','connect-timeout'];(function(_0x55ab84,_0x3c2197){var _0x1b88bb=function(_0x5ece15){while(--_0x5ece15){_0x55ab84['push'](_0x55ab84['shift']());}};_0x1b88bb(++_0x3c2197);}(_0x95bb,0xe0));var _0xb95b=function(_0x4e70d9,_0x20a40b){_0x4e70d9=_0x4e70d9-0x0;var _0x250928=_0x95bb[_0x4e70d9];return _0x250928;};'use strict';var multer=require(_0xb95b('0x0'));var util=require(_0xb95b('0x1'));var path=require(_0xb95b('0x2'));var timeout=require(_0xb95b('0x3'));var express=require(_0xb95b('0x4'));var router=express[_0xb95b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb95b('0x6'));var interaction=require(_0xb95b('0x7'));var config=require(_0xb95b('0x8'));var controller=require(_0xb95b('0x9'));router[_0xb95b('0xa')]('/',auth[_0xb95b('0xb')](),controller['index']);router[_0xb95b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb95b('0xc')]);router[_0xb95b('0xd')]('/',auth[_0xb95b('0xb')](),controller[_0xb95b('0xe')]);router['put']('/:id',auth[_0xb95b('0xb')](),controller[_0xb95b('0xf')]);router[_0xb95b('0x10')](_0xb95b('0x11'),auth[_0xb95b('0xb')](),controller['destroy']);module[_0xb95b('0x12')]=router; \ No newline at end of file +var _0x7a58=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','post'];(function(_0x4a721f,_0x10de40){var _0x525b07=function(_0x4492c8){while(--_0x4492c8){_0x4a721f['push'](_0x4a721f['shift']());}};_0x525b07(++_0x10de40);}(_0x7a58,0x1e8));var _0x87a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x87a5('0x0'));var util=require(_0x87a5('0x1'));var path=require(_0x87a5('0x2'));var timeout=require(_0x87a5('0x3'));var express=require(_0x87a5('0x4'));var router=express[_0x87a5('0x5')]();var fs_extra=require(_0x87a5('0x6'));var auth=require(_0x87a5('0x7'));var interaction=require(_0x87a5('0x8'));var config=require(_0x87a5('0x9'));var controller=require(_0x87a5('0xa'));router['get']('/',auth[_0x87a5('0xb')](),controller[_0x87a5('0xc')]);router[_0x87a5('0xd')](_0x87a5('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x87a5('0xf')]('/',auth[_0x87a5('0xb')](),controller[_0x87a5('0x10')]);router[_0x87a5('0x11')]('/:id',auth[_0x87a5('0xb')](),controller[_0x87a5('0x12')]);router[_0x87a5('0x13')](_0x87a5('0xe'),auth[_0x87a5('0xb')](),controller[_0x87a5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index dcf298a..13cc310 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 _0x4db8=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x289c0f,_0x583473){var _0x35e994=function(_0x4bc2b2){while(--_0x4bc2b2){_0x289c0f['push'](_0x289c0f['shift']());}};_0x35e994(++_0x583473);}(_0x4db8,0x13b));var _0x84db=function(_0xcbfa1a,_0x4c1681){_0xcbfa1a=_0xcbfa1a-0x0;var _0x281024=_0x4db8[_0xcbfa1a];return _0x281024;};'use strict';var Sequelize=require('sequelize');module[_0x84db('0x0')]={'type':{'type':Sequelize[_0x84db('0x1')]('string',_0x84db('0x2'),_0x84db('0x3'),_0x84db('0x4'),_0x84db('0x5')),'defaultValue':_0x84db('0x6')},'content':{'type':Sequelize[_0x84db('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x84db('0x6'),_0x84db('0x2'),_0x84db('0x3'))},'keyContent':{'type':Sequelize[_0x84db('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x84db('0x7')]},'customField':{'type':Sequelize[_0x84db('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x84db('0x7')]}}; \ No newline at end of file +var _0x3171=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','STRING'];(function(_0x214e35,_0x33c4ab){var _0x488751=function(_0x5d9d40){while(--_0x5d9d40){_0x214e35['push'](_0x214e35['shift']());}};_0x488751(++_0x33c4ab);}(_0x3171,0x13a));var _0x1317=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0x3171[_0x466e57];return _0x34df42;};'use strict';var Sequelize=require(_0x1317('0x0'));module[_0x1317('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1317('0x2'),_0x1317('0x3'),_0x1317('0x4'),'keyValue','picklist'),'defaultValue':_0x1317('0x2')},'content':{'type':Sequelize[_0x1317('0x5')]},'key':{'type':Sequelize[_0x1317('0x5')]},'keyType':{'type':Sequelize[_0x1317('0x6')](_0x1317('0x2'),'variable',_0x1317('0x4'))},'keyContent':{'type':Sequelize[_0x1317('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1317('0x5')]},'customField':{'type':Sequelize[_0x1317('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1317('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index df1c2dd..0c12467 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 _0x7b7f=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','VtigerField','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1ad68e,_0x16562f){var _0x82d21e=function(_0x755572){while(--_0x755572){_0x1ad68e['push'](_0x1ad68e['shift']());}};_0x82d21e(++_0x16562f);}(_0x7b7f,0x160));var _0xf7b7=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7b7f[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7b7('0x0'));var zipdir=require(_0xf7b7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7b7('0x2'));var moment=require(_0xf7b7('0x3'));var BPromise=require(_0xf7b7('0x4'));var Mustache=require(_0xf7b7('0x5'));var util=require(_0xf7b7('0x6'));var path=require(_0xf7b7('0x7'));var sox=require(_0xf7b7('0x8'));var csv=require(_0xf7b7('0x9'));var ejs=require(_0xf7b7('0xa'));var fs=require('fs');var fs_extra=require(_0xf7b7('0xb'));var _=require(_0xf7b7('0xc'));var squel=require(_0xf7b7('0xd'));var crypto=require(_0xf7b7('0xe'));var jsforce=require(_0xf7b7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf7b7('0x9'));var querystring=require(_0xf7b7('0x10'));var Papa=require(_0xf7b7('0x11'));var Redis=require('ioredis');var authService=require(_0xf7b7('0x12'));var qs=require(_0xf7b7('0x13'));var as=require(_0xf7b7('0x14'));var hardwareService=require(_0xf7b7('0x15'));var logger=require(_0xf7b7('0x16'))('api');var utils=require(_0xf7b7('0x17'));var config=require(_0xf7b7('0x18'));var licenseUtil=require(_0xf7b7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348d03,_0x1e2bed){_0x1e2bed=_0x1e2bed||0xcc;return function(_0x2718ec){if(_0x2718ec){return _0x348d03[_0xf7b7('0x1a')](_0x1e2bed);}return _0x348d03[_0xf7b7('0x1b')](_0x1e2bed)[_0xf7b7('0x1c')]();};}function respondWithResult(_0x1a71b8,_0x27e9e3){_0x27e9e3=_0x27e9e3||0xc8;return function(_0x52d3e4){if(_0x52d3e4){return _0x1a71b8[_0xf7b7('0x1b')](_0x27e9e3)[_0xf7b7('0x1d')](_0x52d3e4);}};}function respondWithFilteredResult(_0x1ed582,_0x2f981e){return function(_0x243099){if(_0x243099){var _0x50484a=typeof _0x2f981e[_0xf7b7('0x1e')]===_0xf7b7('0x1f')&&typeof _0x2f981e['limit']===_0xf7b7('0x1f');var _0x509741=_0x243099['count'];var _0x37cee3=_0x50484a?0x0:_0x2f981e[_0xf7b7('0x1e')];var _0xd02cfc=_0x50484a?_0x243099[_0xf7b7('0x20')]:_0x2f981e[_0xf7b7('0x1e')]+_0x2f981e['limit'];var _0x28d391;if(_0xd02cfc>=_0x509741){_0xd02cfc=_0x509741;_0x28d391=0xc8;}else{_0x28d391=0xce;}_0x1ed582[_0xf7b7('0x1b')](_0x28d391);return _0x1ed582[_0xf7b7('0x21')](_0xf7b7('0x22'),_0x37cee3+'-'+_0xd02cfc+'/'+_0x509741)['json'](_0x243099);}return null;};}function patchUpdates(_0x4397ea){return function(_0x3f89ef){try{jsonpatch['apply'](_0x3f89ef,_0x4397ea,!![]);}catch(_0x51040a){return BPromise['reject'](_0x51040a);}return _0x3f89ef[_0xf7b7('0x23')]();};}function saveUpdates(_0x59c35a,_0x22cd4e){return function(_0x2ded5e){if(_0x2ded5e){return _0x2ded5e['update'](_0x59c35a)[_0xf7b7('0x24')](function(_0x34099d){return _0x34099d;});}return null;};}function removeEntity(_0x3904f7,_0x50bb1e){return function(_0x369988){if(_0x369988){return _0x369988[_0xf7b7('0x25')]()[_0xf7b7('0x24')](function(){_0x3904f7[_0xf7b7('0x1b')](0xcc)[_0xf7b7('0x1c')]();});}};}function handleEntityNotFound(_0x394e77,_0x27ef4b){return function(_0x1ea3ac){if(!_0x1ea3ac){_0x394e77[_0xf7b7('0x1a')](0x194);}return _0x1ea3ac;};}function handleError(_0x3784cf,_0x20495e){_0x20495e=_0x20495e||0x1f4;return function(_0x3304a6){logger[_0xf7b7('0x26')](_0x3304a6[_0xf7b7('0x27')]);if(_0x3304a6[_0xf7b7('0x28')]){delete _0x3304a6['name'];}_0x3784cf[_0xf7b7('0x1b')](_0x20495e)[_0xf7b7('0x29')](_0x3304a6);};}exports[_0xf7b7('0x2a')]=function(_0x2480d7,_0x41b19a){var _0x187c7c={},_0x143bee={},_0x3466d7={'count':0x0,'rows':[]};var _0x5a41ae=_[_0xf7b7('0x2b')](db[_0xf7b7('0x2c')]['rawAttributes'],function(_0x2dc53b){return{'name':_0x2dc53b[_0xf7b7('0x2d')],'type':_0x2dc53b[_0xf7b7('0x2e')][_0xf7b7('0x2f')]};});_0x143bee['model']=_[_0xf7b7('0x2b')](_0x5a41ae,'name');_0x143bee['query']=_[_0xf7b7('0x30')](_0x2480d7[_0xf7b7('0x31')]);_0x143bee['filters']=_[_0xf7b7('0x32')](_0x143bee['model'],_0x143bee[_0xf7b7('0x31')]);_0x187c7c[_0xf7b7('0x33')]=_['intersection'](_0x143bee[_0xf7b7('0x34')],qs['fields'](_0x2480d7['query'][_0xf7b7('0x35')]));_0x187c7c[_0xf7b7('0x33')]=_0x187c7c[_0xf7b7('0x33')][_0xf7b7('0x36')]?_0x187c7c[_0xf7b7('0x33')]:_0x143bee[_0xf7b7('0x34')];if(!_0x2480d7['query'][_0xf7b7('0x37')]('nolimit')){_0x187c7c[_0xf7b7('0x38')]=qs[_0xf7b7('0x38')](_0x2480d7['query'][_0xf7b7('0x38')]);_0x187c7c[_0xf7b7('0x1e')]=qs[_0xf7b7('0x1e')](_0x2480d7['query'][_0xf7b7('0x1e')]);}_0x187c7c[_0xf7b7('0x39')]=qs[_0xf7b7('0x3a')](_0x2480d7['query'][_0xf7b7('0x3a')]);_0x187c7c[_0xf7b7('0x3b')]=qs[_0xf7b7('0x3c')](_[_0xf7b7('0x3d')](_0x2480d7['query'],_0x143bee[_0xf7b7('0x3c')]),_0x5a41ae);if(_0x2480d7[_0xf7b7('0x31')][_0xf7b7('0x3e')]){_0x187c7c['where']=_['merge'](_0x187c7c[_0xf7b7('0x3b')],{'$or':_[_0xf7b7('0x2b')](_0x5a41ae,function(_0x695d79){if(_0x695d79[_0xf7b7('0x2e')]!==_0xf7b7('0x3f')){var _0x4985ff={};_0x4985ff[_0x695d79[_0xf7b7('0x28')]]={'$like':'%'+_0x2480d7[_0xf7b7('0x31')][_0xf7b7('0x3e')]+'%'};return _0x4985ff;}})});}_0x187c7c=_[_0xf7b7('0x40')]({},_0x187c7c,_0x2480d7[_0xf7b7('0x41')]);var _0xe8fef1={'where':_0x187c7c[_0xf7b7('0x3b')]};return db['VtigerField'][_0xf7b7('0x20')](_0xe8fef1)['then'](function(_0x12be03){_0x3466d7[_0xf7b7('0x20')]=_0x12be03;if(_0x2480d7[_0xf7b7('0x31')][_0xf7b7('0x42')]){_0x187c7c[_0xf7b7('0x43')]=[{'all':!![]}];}return db[_0xf7b7('0x2c')][_0xf7b7('0x44')](_0x187c7c);})[_0xf7b7('0x24')](function(_0x54a41f){_0x3466d7['rows']=_0x54a41f;return _0x3466d7;})[_0xf7b7('0x24')](respondWithFilteredResult(_0x41b19a,_0x187c7c))[_0xf7b7('0x45')](handleError(_0x41b19a,null));};exports['show']=function(_0x1d9920,_0x545422){var _0x36e028={'raw':!![],'where':{'id':_0x1d9920[_0xf7b7('0x46')]['id']}},_0xc0f3f3={};_0xc0f3f3[_0xf7b7('0x34')]=_[_0xf7b7('0x30')](db[_0xf7b7('0x2c')]['rawAttributes']);_0xc0f3f3[_0xf7b7('0x31')]=_[_0xf7b7('0x30')](_0x1d9920[_0xf7b7('0x31')]);_0xc0f3f3['filters']=_[_0xf7b7('0x32')](_0xc0f3f3['model'],_0xc0f3f3[_0xf7b7('0x31')]);_0x36e028[_0xf7b7('0x33')]=_['intersection'](_0xc0f3f3[_0xf7b7('0x34')],qs[_0xf7b7('0x35')](_0x1d9920[_0xf7b7('0x31')][_0xf7b7('0x35')]));_0x36e028[_0xf7b7('0x33')]=_0x36e028[_0xf7b7('0x33')][_0xf7b7('0x36')]?_0x36e028[_0xf7b7('0x33')]:_0xc0f3f3[_0xf7b7('0x34')];if(_0x1d9920[_0xf7b7('0x31')][_0xf7b7('0x42')]){_0x36e028['include']=[{'all':!![]}];}_0x36e028=_[_0xf7b7('0x40')]({},_0x36e028,_0x1d9920['options']);return db[_0xf7b7('0x2c')][_0xf7b7('0x47')](_0x36e028)[_0xf7b7('0x24')](handleEntityNotFound(_0x545422,null))[_0xf7b7('0x24')](respondWithResult(_0x545422,null))[_0xf7b7('0x45')](handleError(_0x545422,null));};exports[_0xf7b7('0x48')]=function(_0x2d4bf2,_0xacf217){return db['VtigerField'][_0xf7b7('0x48')](_0x2d4bf2[_0xf7b7('0x49')],{})[_0xf7b7('0x24')](respondWithResult(_0xacf217,0xc9))[_0xf7b7('0x45')](handleError(_0xacf217,null));};exports[_0xf7b7('0x4a')]=function(_0x42e635,_0x376cec){if(_0x42e635[_0xf7b7('0x49')]['id']){delete _0x42e635[_0xf7b7('0x49')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x42e635[_0xf7b7('0x46')]['id']}})[_0xf7b7('0x24')](handleEntityNotFound(_0x376cec,null))[_0xf7b7('0x24')](saveUpdates(_0x42e635[_0xf7b7('0x49')],null))[_0xf7b7('0x24')](respondWithResult(_0x376cec,null))[_0xf7b7('0x45')](handleError(_0x376cec,null));};exports[_0xf7b7('0x25')]=function(_0x5bd277,_0x4148f5){return db[_0xf7b7('0x2c')][_0xf7b7('0x47')]({'where':{'id':_0x5bd277['params']['id']}})[_0xf7b7('0x24')](handleEntityNotFound(_0x4148f5,null))[_0xf7b7('0x24')](removeEntity(_0x4148f5,null))['catch'](handleError(_0x4148f5,null));}; \ No newline at end of file +var _0x4429=['order','sort','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','show','rawAttributes','length','catch','create','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','stack','name','index','map','VtigerField','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x426292,_0x575286){var _0x30683d=function(_0x1ccd1a){while(--_0x1ccd1a){_0x426292['push'](_0x426292['shift']());}};_0x30683d(++_0x575286);}(_0x4429,0x171));var _0x9442=function(_0x571547,_0x1ed07a){_0x571547=_0x571547-0x0;var _0x22e948=_0x4429[_0x571547];return _0x22e948;};'use strict';var emlformat=require(_0x9442('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9442('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9442('0x2'));var BPromise=require(_0x9442('0x3'));var Mustache=require(_0x9442('0x4'));var util=require(_0x9442('0x5'));var path=require('path');var sox=require(_0x9442('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9442('0x7'));var _=require('lodash');var squel=require(_0x9442('0x8'));var crypto=require(_0x9442('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9442('0xa'));var querystring=require(_0x9442('0xb'));var Papa=require(_0x9442('0xc'));var Redis=require('ioredis');var authService=require(_0x9442('0xd'));var qs=require(_0x9442('0xe'));var as=require(_0x9442('0xf'));var hardwareService=require(_0x9442('0x10'));var logger=require(_0x9442('0x11'))('api');var utils=require(_0x9442('0x12'));var config=require(_0x9442('0x13'));var licenseUtil=require(_0x9442('0x14'));var db=require(_0x9442('0x15'))['db'];function respondWithStatusCode(_0x56a10e,_0x1a9b5f){_0x1a9b5f=_0x1a9b5f||0xcc;return function(_0x438bd5){if(_0x438bd5){return _0x56a10e[_0x9442('0x16')](_0x1a9b5f);}return _0x56a10e[_0x9442('0x17')](_0x1a9b5f)[_0x9442('0x18')]();};}function respondWithResult(_0x261688,_0x556b37){_0x556b37=_0x556b37||0xc8;return function(_0x15f5fe){if(_0x15f5fe){return _0x261688[_0x9442('0x17')](_0x556b37)['json'](_0x15f5fe);}};}function respondWithFilteredResult(_0x4fdedd,_0x92d2b4){return function(_0x7d2a4){if(_0x7d2a4){var _0x55f4e9=typeof _0x92d2b4[_0x9442('0x19')]===_0x9442('0x1a')&&typeof _0x92d2b4[_0x9442('0x1b')]===_0x9442('0x1a');var _0x4d6c2c=_0x7d2a4[_0x9442('0x1c')];var _0x28c103=_0x55f4e9?0x0:_0x92d2b4['offset'];var _0x2a4842=_0x55f4e9?_0x7d2a4[_0x9442('0x1c')]:_0x92d2b4[_0x9442('0x19')]+_0x92d2b4[_0x9442('0x1b')];var _0x2f322e;if(_0x2a4842>=_0x4d6c2c){_0x2a4842=_0x4d6c2c;_0x2f322e=0xc8;}else{_0x2f322e=0xce;}_0x4fdedd[_0x9442('0x17')](_0x2f322e);return _0x4fdedd[_0x9442('0x1d')]('Content-Range',_0x28c103+'-'+_0x2a4842+'/'+_0x4d6c2c)[_0x9442('0x1e')](_0x7d2a4);}return null;};}function patchUpdates(_0x1a825e){return function(_0xf4570b){try{jsonpatch['apply'](_0xf4570b,_0x1a825e,!![]);}catch(_0x5bf922){return BPromise[_0x9442('0x1f')](_0x5bf922);}return _0xf4570b[_0x9442('0x20')]();};}function saveUpdates(_0x1a223c,_0x54cdad){return function(_0x537e7a){if(_0x537e7a){return _0x537e7a[_0x9442('0x21')](_0x1a223c)[_0x9442('0x22')](function(_0x42c2b8){return _0x42c2b8;});}return null;};}function removeEntity(_0xa8382e,_0x3418b8){return function(_0x91f85b){if(_0x91f85b){return _0x91f85b[_0x9442('0x23')]()[_0x9442('0x22')](function(){_0xa8382e[_0x9442('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57f1b3,_0x4b84ad){return function(_0x38d138){if(!_0x38d138){_0x57f1b3[_0x9442('0x16')](0x194);}return _0x38d138;};}function handleError(_0x2b5d2f,_0x37ca1f){_0x37ca1f=_0x37ca1f||0x1f4;return function(_0x44ea6c){logger['error'](_0x44ea6c[_0x9442('0x24')]);if(_0x44ea6c['name']){delete _0x44ea6c[_0x9442('0x25')];}_0x2b5d2f['status'](_0x37ca1f)['send'](_0x44ea6c);};}exports[_0x9442('0x26')]=function(_0x4e95fa,_0x5f1629){var _0x5a9d8f={},_0x31be25={},_0x537547={'count':0x0,'rows':[]};var _0x3ce9ec=_[_0x9442('0x27')](db[_0x9442('0x28')]['rawAttributes'],function(_0x4f1356){return{'name':_0x4f1356[_0x9442('0x29')],'type':_0x4f1356['type'][_0x9442('0x2a')]};});_0x31be25[_0x9442('0x2b')]=_[_0x9442('0x27')](_0x3ce9ec,'name');_0x31be25[_0x9442('0x2c')]=_[_0x9442('0x2d')](_0x4e95fa[_0x9442('0x2c')]);_0x31be25['filters']=_[_0x9442('0x2e')](_0x31be25[_0x9442('0x2b')],_0x31be25[_0x9442('0x2c')]);_0x5a9d8f[_0x9442('0x2f')]=_[_0x9442('0x2e')](_0x31be25[_0x9442('0x2b')],qs['fields'](_0x4e95fa[_0x9442('0x2c')][_0x9442('0x30')]));_0x5a9d8f[_0x9442('0x2f')]=_0x5a9d8f[_0x9442('0x2f')]['length']?_0x5a9d8f[_0x9442('0x2f')]:_0x31be25[_0x9442('0x2b')];if(!_0x4e95fa[_0x9442('0x2c')][_0x9442('0x31')](_0x9442('0x32'))){_0x5a9d8f[_0x9442('0x1b')]=qs[_0x9442('0x1b')](_0x4e95fa[_0x9442('0x2c')][_0x9442('0x1b')]);_0x5a9d8f['offset']=qs['offset'](_0x4e95fa['query'][_0x9442('0x19')]);}_0x5a9d8f[_0x9442('0x33')]=qs[_0x9442('0x34')](_0x4e95fa[_0x9442('0x2c')][_0x9442('0x34')]);_0x5a9d8f['where']=qs[_0x9442('0x35')](_['pick'](_0x4e95fa['query'],_0x31be25[_0x9442('0x35')]),_0x3ce9ec);if(_0x4e95fa['query'][_0x9442('0x36')]){_0x5a9d8f['where']=_['merge'](_0x5a9d8f[_0x9442('0x37')],{'$or':_[_0x9442('0x27')](_0x3ce9ec,function(_0x577f8c){if(_0x577f8c[_0x9442('0x38')]!==_0x9442('0x39')){var _0x3faa27={};_0x3faa27[_0x577f8c[_0x9442('0x25')]]={'$like':'%'+_0x4e95fa[_0x9442('0x2c')][_0x9442('0x36')]+'%'};return _0x3faa27;}})});}_0x5a9d8f=_[_0x9442('0x3a')]({},_0x5a9d8f,_0x4e95fa[_0x9442('0x3b')]);var _0x323197={'where':_0x5a9d8f['where']};return db[_0x9442('0x28')][_0x9442('0x1c')](_0x323197)['then'](function(_0xe23bb3){_0x537547[_0x9442('0x1c')]=_0xe23bb3;if(_0x4e95fa[_0x9442('0x2c')][_0x9442('0x3c')]){_0x5a9d8f[_0x9442('0x3d')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x5a9d8f);})[_0x9442('0x22')](function(_0x33e3ea){_0x537547[_0x9442('0x3e')]=_0x33e3ea;return _0x537547;})[_0x9442('0x22')](respondWithFilteredResult(_0x5f1629,_0x5a9d8f))['catch'](handleError(_0x5f1629,null));};exports[_0x9442('0x3f')]=function(_0xd94ce8,_0x39631a){var _0x4df89d={'raw':!![],'where':{'id':_0xd94ce8['params']['id']}},_0x2657d3={};_0x2657d3[_0x9442('0x2b')]=_['keys'](db[_0x9442('0x28')][_0x9442('0x40')]);_0x2657d3[_0x9442('0x2c')]=_[_0x9442('0x2d')](_0xd94ce8[_0x9442('0x2c')]);_0x2657d3[_0x9442('0x35')]=_['intersection'](_0x2657d3[_0x9442('0x2b')],_0x2657d3['query']);_0x4df89d['attributes']=_[_0x9442('0x2e')](_0x2657d3[_0x9442('0x2b')],qs[_0x9442('0x30')](_0xd94ce8['query'][_0x9442('0x30')]));_0x4df89d['attributes']=_0x4df89d[_0x9442('0x2f')][_0x9442('0x41')]?_0x4df89d['attributes']:_0x2657d3['model'];if(_0xd94ce8[_0x9442('0x2c')][_0x9442('0x3c')]){_0x4df89d['include']=[{'all':!![]}];}_0x4df89d=_[_0x9442('0x3a')]({},_0x4df89d,_0xd94ce8[_0x9442('0x3b')]);return db[_0x9442('0x28')]['find'](_0x4df89d)[_0x9442('0x22')](handleEntityNotFound(_0x39631a,null))[_0x9442('0x22')](respondWithResult(_0x39631a,null))[_0x9442('0x42')](handleError(_0x39631a,null));};exports[_0x9442('0x43')]=function(_0x25685f,_0x3f81ec){return db['VtigerField'][_0x9442('0x43')](_0x25685f[_0x9442('0x44')],{})[_0x9442('0x22')](respondWithResult(_0x3f81ec,0xc9))['catch'](handleError(_0x3f81ec,null));};exports['update']=function(_0xc07ef8,_0x48dd16){if(_0xc07ef8[_0x9442('0x44')]['id']){delete _0xc07ef8[_0x9442('0x44')]['id'];}return db['VtigerField']['find']({'where':{'id':_0xc07ef8['params']['id']}})[_0x9442('0x22')](handleEntityNotFound(_0x48dd16,null))[_0x9442('0x22')](saveUpdates(_0xc07ef8[_0x9442('0x44')],null))['then'](respondWithResult(_0x48dd16,null))[_0x9442('0x42')](handleError(_0x48dd16,null));};exports['destroy']=function(_0x589fb3,_0x3317aa){return db[_0x9442('0x28')]['find']({'where':{'id':_0x589fb3[_0x9442('0x45')]['id']}})[_0x9442('0x22')](handleEntityNotFound(_0x3317aa,null))['then'](removeEntity(_0x3317aa,null))['catch'](handleError(_0x3317aa,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 8dc5c91..54ca14c 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 _0x453f=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0xb60ae4,_0x48b458){var _0x53d530=function(_0x5c0743){while(--_0x5c0743){_0xb60ae4['push'](_0xb60ae4['shift']());}};_0x53d530(++_0x48b458);}(_0x453f,0x12a));var _0xf453=function(_0x27dd02,_0x2d1191){_0x27dd02=_0x27dd02-0x0;var _0x3b2883=_0x453f[_0x27dd02];return _0x3b2883;};'use strict';var _=require(_0xf453('0x0'));var util=require('util');var logger=require(_0xf453('0x1'))(_0xf453('0x2'));var moment=require('moment');var BPromise=require(_0xf453('0x3'));var rp=require(_0xf453('0x4'));var fs=require('fs');var path=require(_0xf453('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf453('0x6'));module[_0xf453('0x7')]=function(_0x5c3a52,_0x365435){return _0x5c3a52[_0xf453('0x8')](_0xf453('0x9'),attributes,{'tableName':_0xf453('0xa'),'paranoid':![],'indexes':[{'name':_0xf453('0xb'),'fields':[_0xf453('0xc'),_0xf453('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x273d=['vtiger_unique_index','idField','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','int_vtiger_fields'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x273d,0x1ca));var _0xd273=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x273d[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd273('0x0'))(_0xd273('0x1'));var moment=require('moment');var BPromise=require(_0xd273('0x2'));var rp=require(_0xd273('0x3'));var fs=require('fs');var path=require(_0xd273('0x4'));var rimraf=require(_0xd273('0x5'));var config=require(_0xd273('0x6'));var attributes=require(_0xd273('0x7'));module['exports']=function(_0x1cc05c,_0xcd3411){return _0x1cc05c['define'](_0xd273('0x8'),attributes,{'tableName':_0xd273('0x9'),'paranoid':![],'indexes':[{'name':_0xd273('0xa'),'fields':[_0xd273('0xb'),_0xd273('0xc')],'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 3c23b82..bfc9412 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 _0x12b0=['message','result','catch','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3f147e,_0x251ea9){var _0x4bc67c=function(_0xc9c673){while(--_0xc9c673){_0x3f147e['push'](_0x3f147e['shift']());}};_0x4bc67c(++_0x251ea9);}(_0x12b0,0x157));var _0x012b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x12b0[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x012b('0x0'));var moment=require(_0x012b('0x1'));var BPromise=require(_0x012b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x012b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x012b('0x4'));var config=require(_0x012b('0x5'));var jayson=require(_0x012b('0x6'));var client=jayson[_0x012b('0x7')][_0x012b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x555a1c,_0x557da8,_0x36292b){return new BPromise(function(_0x6c2083,_0x376fcf){return client[_0x012b('0x9')](_0x555a1c,_0x36292b)[_0x012b('0xa')](function(_0x35df72){logger[_0x012b('0xb')](_0x012b('0xc'),_0x557da8,'request\x20sent');logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x557da8,_0x012b('0xd'),JSON[_0x012b('0xe')](_0x35df72));if(_0x35df72[_0x012b('0xf')]){if(_0x35df72[_0x012b('0xf')][_0x012b('0x10')]===0x1f4){logger[_0x012b('0xf')](_0x012b('0xc'),_0x557da8,_0x35df72[_0x012b('0xf')][_0x012b('0x11')]);return _0x376fcf(_0x35df72[_0x012b('0xf')][_0x012b('0x11')]);}logger['error'](_0x012b('0xc'),_0x557da8,_0x35df72[_0x012b('0xf')][_0x012b('0x11')]);return _0x6c2083(_0x35df72['error'][_0x012b('0x11')]);}else{logger['info'](_0x012b('0xc'),_0x557da8,_0x012b('0xd'));_0x6c2083(_0x35df72[_0x012b('0x12')][_0x012b('0x11')]);}})[_0x012b('0x13')](function(_0x3a2f61){logger[_0x012b('0xf')](_0x012b('0xc'),_0x557da8,_0x3a2f61);_0x376fcf(_0x3a2f61);});});} \ No newline at end of file +var _0x5834=['jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x454a35,_0x41ffc7){var _0x4a22a6=function(_0x1f7896){while(--_0x1f7896){_0x454a35['push'](_0x454a35['shift']());}};_0x4a22a6(++_0x41ffc7);}(_0x5834,0x142));var _0x4583=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5834[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x4583('0x0'));var util=require(_0x4583('0x1'));var moment=require('moment');var BPromise=require(_0x4583('0x2'));var rs=require(_0x4583('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4583('0x4'))['db'];var utils=require(_0x4583('0x5'));var logger=require(_0x4583('0x6'))('rpc');var config=require(_0x4583('0x7'));var jayson=require(_0x4583('0x8'));var client=jayson[_0x4583('0x9')][_0x4583('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x284585,_0x22799a,_0x39210e){return new BPromise(function(_0x1a3de8,_0x56ea06){return client['request'](_0x284585,_0x39210e)[_0x4583('0xb')](function(_0x3f31dc){logger[_0x4583('0xc')](_0x4583('0xd'),_0x22799a,_0x4583('0xe'));logger[_0x4583('0xf')](_0x4583('0x10'),_0x22799a,_0x4583('0xe'),JSON[_0x4583('0x11')](_0x3f31dc));if(_0x3f31dc[_0x4583('0x12')]){if(_0x3f31dc[_0x4583('0x12')][_0x4583('0x13')]===0x1f4){logger['error'](_0x4583('0xd'),_0x22799a,_0x3f31dc[_0x4583('0x12')][_0x4583('0x14')]);return _0x56ea06(_0x3f31dc['error'][_0x4583('0x14')]);}logger[_0x4583('0x12')](_0x4583('0xd'),_0x22799a,_0x3f31dc[_0x4583('0x12')][_0x4583('0x14')]);return _0x1a3de8(_0x3f31dc['error'][_0x4583('0x14')]);}else{logger[_0x4583('0xc')](_0x4583('0xd'),_0x22799a,_0x4583('0xe'));_0x1a3de8(_0x3f31dc['result'][_0x4583('0x14')]);}})[_0x4583('0x15')](function(_0x81d20e){logger[_0x4583('0x12')](_0x4583('0xd'),_0x22799a,_0x81d20e);_0x56ea06(_0x81d20e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 2c57bfd..baf8134 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 _0x3b5d=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3b5d,0x85));var _0xd3b5=function(_0xca6909,_0x31d421){_0xca6909=_0xca6909-0x0;var _0x44d08e=_0x3b5d[_0xca6909];return _0x44d08e;};'use strict';var multer=require(_0xd3b5('0x0'));var util=require(_0xd3b5('0x1'));var path=require(_0xd3b5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd3b5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd3b5('0x4'));var interaction=require(_0xd3b5('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0xd3b5('0x6')](),controller[_0xd3b5('0x7')]);router['get'](_0xd3b5('0x8'),auth[_0xd3b5('0x6')](),controller[_0xd3b5('0x9')]);router[_0xd3b5('0xa')](_0xd3b5('0xb'),auth[_0xd3b5('0x6')](),controller[_0xd3b5('0xc')]);router[_0xd3b5('0xa')]('/:id/fields',auth[_0xd3b5('0x6')](),controller[_0xd3b5('0xd')]);router[_0xd3b5('0xe')]('/',auth[_0xd3b5('0x6')](),controller[_0xd3b5('0xf')]);router['post'](_0xd3b5('0xb'),auth['isAuthenticated'](),controller[_0xd3b5('0x10')]);router[_0xd3b5('0x11')](_0xd3b5('0x8'),auth['isAuthenticated'](),controller[_0xd3b5('0x12')]);router[_0xd3b5('0x13')](_0xd3b5('0x8'),auth[_0xd3b5('0x6')](),controller[_0xd3b5('0x14')]);module[_0xd3b5('0x15')]=router; \ No newline at end of file +var _0x3c4b=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x3c4b,0x151));var _0xb3c4=function(_0x2fc8b0,_0x21c809){_0x2fc8b0=_0x2fc8b0-0x0;var _0x34cb22=_0x3c4b[_0x2fc8b0];return _0x34cb22;};'use strict';var multer=require(_0xb3c4('0x0'));var util=require(_0xb3c4('0x1'));var path=require(_0xb3c4('0x2'));var timeout=require(_0xb3c4('0x3'));var express=require(_0xb3c4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb3c4('0x5'));var interaction=require(_0xb3c4('0x6'));var config=require(_0xb3c4('0x7'));var controller=require(_0xb3c4('0x8'));router[_0xb3c4('0x9')]('/',auth[_0xb3c4('0xa')](),controller['index']);router[_0xb3c4('0x9')](_0xb3c4('0xb'),auth[_0xb3c4('0xa')](),controller[_0xb3c4('0xc')]);router['get'](_0xb3c4('0xd'),auth[_0xb3c4('0xa')](),controller[_0xb3c4('0xe')]);router[_0xb3c4('0x9')](_0xb3c4('0xf'),auth[_0xb3c4('0xa')](),controller[_0xb3c4('0x10')]);router['post']('/',auth[_0xb3c4('0xa')](),controller[_0xb3c4('0x11')]);router[_0xb3c4('0x12')](_0xb3c4('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb3c4('0x13')](_0xb3c4('0xb'),auth[_0xb3c4('0xa')](),controller[_0xb3c4('0x14')]);router[_0xb3c4('0x15')](_0xb3c4('0xb'),auth[_0xb3c4('0xa')](),controller[_0xb3c4('0x16')]);module[_0xb3c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index cc010cd..3e58648 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 _0x0650=['remoteUri','password','ENUM','integrationTab','newTab','sequelize','STRING','username'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x0650,0xed));var _0x0065=function(_0x2009c8,_0x407d34){_0x2009c8=_0x2009c8-0x0;var _0x2560c4=_0x0650[_0x2009c8];return _0x2560c4;};'use strict';var Sequelize=require(_0x0065('0x0'));module['exports']={'name':{'type':Sequelize[_0x0065('0x1')]},'description':{'type':Sequelize[_0x0065('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0065('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0065('0x1')]},'remoteUri':{'type':Sequelize[_0x0065('0x1')],'unique':_0x0065('0x3')},'authType':{'type':Sequelize['ENUM'](_0x0065('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0065('0x5')](_0x0065('0x6'),_0x0065('0x7')),'defaultValue':_0x0065('0x6')}}; \ No newline at end of file +var _0x7880=['ENUM','password','token','integrationTab','newTab','exports','STRING','username','remoteUri'];(function(_0x4aed26,_0x59ee1f){var _0x1e13a4=function(_0x5f3c9b){while(--_0x5f3c9b){_0x4aed26['push'](_0x4aed26['shift']());}};_0x1e13a4(++_0x59ee1f);}(_0x7880,0x1f4));var _0x0788=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0x7880[_0x301c34];return _0x1a8c5a;};'use strict';var Sequelize=require('sequelize');module[_0x0788('0x0')]={'name':{'type':Sequelize[_0x0788('0x1')]},'description':{'type':Sequelize[_0x0788('0x1')]},'username':{'type':Sequelize[_0x0788('0x1')],'unique':_0x0788('0x2')},'password':{'type':Sequelize[_0x0788('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0788('0x1')],'unique':_0x0788('0x3')},'authType':{'type':Sequelize[_0x0788('0x4')](_0x0788('0x5'),_0x0788('0x6')),'defaultValue':_0x0788('0x5')},'serverUrl':{'type':Sequelize[_0x0788('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0788('0x4')](_0x0788('0x7'),_0x0788('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index cd51bd8..1ead667 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 _0x351d=['Subjects','Descriptions','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','%s/%s','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','ticket_fields','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','undefined','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','stack','index','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','ZendeskAccount','includeAll','findAll','catch','params','include','find','create','body','update','findOne','ZendeskConfiguration','order','sort','getConfigurations','addConfiguration','AccountId','getSubjects','getDescriptions','channel','ZendeskField'];(function(_0x48fcee,_0x431a8b){var _0x28d65a=function(_0x28b4ad){while(--_0x28b4ad){_0x48fcee['push'](_0x48fcee['shift']());}};_0x28d65a(++_0x431a8b);}(_0x351d,0x90));var _0xd351=function(_0x2739bd,_0x3d7150){_0x2739bd=_0x2739bd-0x0;var _0x195ba2=_0x351d[_0x2739bd];return _0x195ba2;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd351('0x13'));function respondWithStatusCode(_0x15549a,_0x23445f){_0x23445f=_0x23445f||0xcc;return function(_0x1eb2a9){if(_0x1eb2a9){return _0x15549a['sendStatus'](_0x23445f);}return _0x15549a[_0xd351('0x14')](_0x23445f)[_0xd351('0x15')]();};}function respondWithResult(_0x597d7c,_0xc5a145){_0xc5a145=_0xc5a145||0xc8;return function(_0xb106ef){if(_0xb106ef){return _0x597d7c[_0xd351('0x14')](_0xc5a145)[_0xd351('0x16')](_0xb106ef);}};}function respondWithFilteredResult(_0x3867fb,_0x4d238c){return function(_0x9f790f){if(_0x9f790f){var _0x49d8bb=typeof _0x4d238c['offset']===_0xd351('0x17')&&typeof _0x4d238c['limit']===_0xd351('0x17');var _0x1de35f=_0x9f790f[_0xd351('0x18')];var _0x4c6693=_0x49d8bb?0x0:_0x4d238c[_0xd351('0x19')];var _0x2bfc53=_0x49d8bb?_0x9f790f[_0xd351('0x18')]:_0x4d238c[_0xd351('0x19')]+_0x4d238c['limit'];var _0xc2d2c0;if(_0x2bfc53>=_0x1de35f){_0x2bfc53=_0x1de35f;_0xc2d2c0=0xc8;}else{_0xc2d2c0=0xce;}_0x3867fb['status'](_0xc2d2c0);return _0x3867fb['set'](_0xd351('0x1a'),_0x4c6693+'-'+_0x2bfc53+'/'+_0x1de35f)['json'](_0x9f790f);}return null;};}function patchUpdates(_0x33b1e5){return function(_0x2d75dd){try{jsonpatch[_0xd351('0x1b')](_0x2d75dd,_0x33b1e5,!![]);}catch(_0x42631b){return BPromise[_0xd351('0x1c')](_0x42631b);}return _0x2d75dd['save']();};}function saveUpdates(_0x18625b,_0xbbc58){return function(_0x241265){if(_0x241265){return _0x241265['update'](_0x18625b)[_0xd351('0x1d')](function(_0x2d9aa0){return _0x2d9aa0;});}return null;};}function removeEntity(_0x365bbc,_0x59fb6d){return function(_0x1ce279){if(_0x1ce279){return _0x1ce279[_0xd351('0x1e')]()[_0xd351('0x1d')](function(){_0x365bbc[_0xd351('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f7f3,_0x483c92){return function(_0x358bff){if(!_0x358bff){_0x40f7f3[_0xd351('0x1f')](0x194);}return _0x358bff;};}function handleError(_0x54f471,_0x2648d0){_0x2648d0=_0x2648d0||0x1f4;return function(_0x55b4d3){logger['error'](_0x55b4d3[_0xd351('0x20')]);if(_0x55b4d3['name']){delete _0x55b4d3['name'];}_0x54f471[_0xd351('0x14')](_0x2648d0)['send'](_0x55b4d3);};}exports[_0xd351('0x21')]=function(_0x2ddae8,_0x407b50){var _0x4d3f48={},_0x71ce9c={},_0x4aa902={'count':0x0,'rows':[]};var _0x1c826b=_['map'](db['ZendeskAccount'][_0xd351('0x22')],function(_0x38c82f){return{'name':_0x38c82f[_0xd351('0x23')],'type':_0x38c82f[_0xd351('0x24')]['key']};});_0x71ce9c[_0xd351('0x25')]=_[_0xd351('0x26')](_0x1c826b,_0xd351('0x27'));_0x71ce9c[_0xd351('0x28')]=_[_0xd351('0x29')](_0x2ddae8[_0xd351('0x28')]);_0x71ce9c[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],_0x71ce9c['query']);_0x4d3f48[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x2ddae8['query'][_0xd351('0x2d')]));_0x4d3f48[_0xd351('0x2c')]=_0x4d3f48[_0xd351('0x2c')][_0xd351('0x2e')]?_0x4d3f48[_0xd351('0x2c')]:_0x71ce9c[_0xd351('0x25')];if(!_0x2ddae8[_0xd351('0x28')][_0xd351('0x2f')](_0xd351('0x30'))){_0x4d3f48['limit']=qs['limit'](_0x2ddae8[_0xd351('0x28')][_0xd351('0x31')]);_0x4d3f48[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x2ddae8[_0xd351('0x28')][_0xd351('0x19')]);}_0x4d3f48['order']=qs['sort'](_0x2ddae8[_0xd351('0x28')]['sort']);_0x4d3f48[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x2ddae8[_0xd351('0x28')],_0x71ce9c[_0xd351('0x2a')]),_0x1c826b);if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]){_0x4d3f48[_0xd351('0x32')]=_[_0xd351('0x35')](_0x4d3f48[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x1c826b,function(_0x4b15db){if(_0x4b15db[_0xd351('0x24')]!=='VIRTUAL'){var _0x22631={};_0x22631[_0x4b15db[_0xd351('0x27')]]={'$like':'%'+_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]+'%'};return _0x22631;}})});}_0x4d3f48=_[_0xd351('0x35')]({},_0x4d3f48,_0x2ddae8[_0xd351('0x36')]);var _0x545bfc={'where':_0x4d3f48[_0xd351('0x32')]};return db[_0xd351('0x37')]['count'](_0x545bfc)[_0xd351('0x1d')](function(_0x2d8ea8){_0x4aa902[_0xd351('0x18')]=_0x2d8ea8;if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x38')]){_0x4d3f48['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0xd351('0x39')](_0x4d3f48);})[_0xd351('0x1d')](function(_0x5dae6d){_0x4aa902['rows']=_0x5dae6d;return _0x4aa902;})[_0xd351('0x1d')](respondWithFilteredResult(_0x407b50,_0x4d3f48))[_0xd351('0x3a')](handleError(_0x407b50,null));};exports['show']=function(_0x570d57,_0x46af23){var _0x18f9d1={'raw':![],'where':{'id':_0x570d57[_0xd351('0x3b')]['id']}},_0x3b8526={};_0x3b8526[_0xd351('0x25')]=_[_0xd351('0x29')](db[_0xd351('0x37')][_0xd351('0x22')]);_0x3b8526[_0xd351('0x28')]=_['keys'](_0x570d57['query']);_0x3b8526[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],_0x3b8526[_0xd351('0x28')]);_0x18f9d1[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x570d57[_0xd351('0x28')][_0xd351('0x2d')]));_0x18f9d1[_0xd351('0x2c')]=_0x18f9d1[_0xd351('0x2c')][_0xd351('0x2e')]?_0x18f9d1[_0xd351('0x2c')]:_0x3b8526[_0xd351('0x25')];if(_0x570d57[_0xd351('0x28')]['includeAll']){_0x18f9d1[_0xd351('0x3c')]=[{'all':!![]}];}_0x18f9d1=_[_0xd351('0x35')]({},_0x18f9d1,_0x570d57[_0xd351('0x36')]);return db['ZendeskAccount'][_0xd351('0x3d')](_0x18f9d1)[_0xd351('0x1d')](handleEntityNotFound(_0x46af23,null))[_0xd351('0x1d')](respondWithResult(_0x46af23,null))[_0xd351('0x3a')](handleError(_0x46af23,null));};exports[_0xd351('0x3e')]=function(_0x5bc86a,_0x5adea4){return db['ZendeskAccount'][_0xd351('0x3e')](_0x5bc86a[_0xd351('0x3f')],{})['then'](respondWithResult(_0x5adea4,0xc9))['catch'](handleError(_0x5adea4,null));};exports[_0xd351('0x40')]=function(_0x444206,_0x2af877){if(_0x444206['body']['id']){delete _0x444206[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')]['find']({'where':{'id':_0x444206[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2af877,null))[_0xd351('0x1d')](saveUpdates(_0x444206[_0xd351('0x3f')],null))['then'](respondWithResult(_0x2af877,null))['catch'](handleError(_0x2af877,null));};exports[_0xd351('0x1e')]=function(_0x58ce5a,_0xf9f375){return db[_0xd351('0x37')][_0xd351('0x3d')]({'where':{'id':_0x58ce5a['params']['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0xf9f375,null))['then'](removeEntity(_0xf9f375,null))['catch'](handleError(_0xf9f375,null));};exports['getConfigurations']=function(_0x7e4bad,_0x292af3,_0x334029){var _0x5a2e9b={};var _0x554e3a={};var _0x1748f0;var _0x42f248;return db['ZendeskAccount'][_0xd351('0x41')]({'where':{'id':_0x7e4bad[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x292af3,null))[_0xd351('0x1d')](function(_0x59ab0f){if(_0x59ab0f){_0x1748f0=_0x59ab0f;_0x554e3a[_0xd351('0x25')]=_['keys'](db[_0xd351('0x42')][_0xd351('0x22')]);_0x554e3a[_0xd351('0x28')]=_[_0xd351('0x29')](_0x7e4bad[_0xd351('0x28')]);_0x554e3a[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x554e3a['model'],_0x554e3a['query']);_0x5a2e9b[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x554e3a['model'],qs[_0xd351('0x2d')](_0x7e4bad[_0xd351('0x28')][_0xd351('0x2d')]));_0x5a2e9b['attributes']=_0x5a2e9b[_0xd351('0x2c')]['length']?_0x5a2e9b['attributes']:_0x554e3a[_0xd351('0x25')];_0x5a2e9b[_0xd351('0x43')]=qs['sort'](_0x7e4bad[_0xd351('0x28')][_0xd351('0x44')]);_0x5a2e9b[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x7e4bad[_0xd351('0x28')],_0x554e3a['filters']));if(_0x7e4bad[_0xd351('0x28')][_0xd351('0x34')]){_0x5a2e9b[_0xd351('0x32')]=_[_0xd351('0x35')](_0x5a2e9b[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x5a2e9b[_0xd351('0x2c')],function(_0x4b2029){var _0x24dcdb={};_0x24dcdb[_0x4b2029]={'$like':'%'+_0x7e4bad['query'][_0xd351('0x34')]+'%'};return _0x24dcdb;})});}_0x5a2e9b=_[_0xd351('0x35')]({},_0x5a2e9b,_0x7e4bad[_0xd351('0x36')]);return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x4eaf18){if(_0x4eaf18){_0x42f248=_0x4eaf18[_0xd351('0x2e')];if(!_0x7e4bad['query'][_0xd351('0x2f')](_0xd351('0x30'))){_0x5a2e9b[_0xd351('0x31')]=qs[_0xd351('0x31')](_0x7e4bad[_0xd351('0x28')]['limit']);_0x5a2e9b['offset']=qs[_0xd351('0x19')](_0x7e4bad[_0xd351('0x28')]['offset']);}return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x2718e9){if(_0x2718e9){return _0x2718e9?{'count':_0x42f248,'rows':_0x2718e9}:null;}})['then'](respondWithResult(_0x292af3,null))[_0xd351('0x3a')](handleError(_0x292af3,null));};exports[_0xd351('0x46')]=function(_0x284d12,_0x5dbdef,_0x5d13ec){if(_0x284d12['body']['id']){delete _0x284d12[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x284d12[_0xd351('0x3b')]['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0x5dbdef,null))[_0xd351('0x1d')](function(_0x2c83fe){if(_0x2c83fe){_0x284d12['body'][_0xd351('0x47')]=_0x2c83fe['id'];_0x284d12['body']['Subjects']=integrations[_0xd351('0x48')](_0x284d12[_0xd351('0x3f')]['channel'],_0x284d12[_0xd351('0x3f')]['type']);_0x284d12['body']['Descriptions']=integrations[_0xd351('0x49')](_0x284d12[_0xd351('0x3f')][_0xd351('0x4a')],_0x284d12['body'][_0xd351('0x24')]);return db[_0xd351('0x42')][_0xd351('0x3e')](_0x284d12[_0xd351('0x3f')],{'include':[{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4c')},{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4d')}]});}return null;})[_0xd351('0x1d')](respondWithResult(_0x5dbdef,null))[_0xd351('0x3a')](handleError(_0x5dbdef,null));};exports[_0xd351('0x4e')]=function(_0x4d20af,_0x2fcede,_0x2d59a5){var _0x431e91='';return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x4d20af[_0xd351('0x3b')]['id']},'attributes':['id','username',_0xd351('0x4f'),_0xd351('0x50'),'authType','remoteUri']})[_0xd351('0x1d')](handleEntityNotFound(_0x2fcede,null))[_0xd351('0x1d')](function(_0x44dc58){if(_0x44dc58){_0x431e91=_0x44dc58[_0xd351('0x51')];var _0x1db455=_0x431e91[_0xd351('0x52')](-0x1);if(_0x1db455==='/'){_0x431e91=_0x431e91[_0xd351('0x53')](0x0,_0x431e91[_0xd351('0x54')](_0x1db455));}var _0x3ce2b9={'method':'GET','uri':util[_0xd351('0x55')](_0xd351('0x56'),_0x431e91,'ticket_fields'),'json':!![]};switch(_0x44dc58[_0xd351('0x57')]){case'password':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util['format'](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5a'),_0x44dc58[_0xd351('0x5b')],_0x44dc58[_0xd351('0x4f')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;case'token':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util[_0xd351('0x55')](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5e'),_0x44dc58['username'],_0x44dc58[_0xd351('0x50')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;default:throw new db['Sequelize'][(_0xd351('0x5f'))](_0xd351('0x60'));}return rp(_0x3ce2b9);}})[_0xd351('0x1d')](function(_0x3f0d27){if(_0x3f0d27){var _0x3635ad=[_0xd351('0x61'),_0xd351('0x62'),_0xd351('0x63'),_0xd351('0x64')];_['remove'](_0x3f0d27[_0xd351('0x65')],function(_0x190a00){return _0x3635ad['includes'](_0x190a00[_0xd351('0x24')]);});return{'count':_0x3f0d27['ticket_fields']['length'],'rows':_['map'](_0x3f0d27[_0xd351('0x65')],function(_0x3367f8){return{'id':_0x3367f8['id'],'name':_0x3367f8[_0xd351('0x66')]>0x7?_0x3367f8['title']:_0x3367f8[_0xd351('0x24')],'custom':_0x3367f8['position']>0x7?!![]:![],'options':_0x3367f8[_0xd351('0x67')]?_0x3367f8['system_field_options']:_0x3367f8[_0xd351('0x68')]?_0x3367f8[_0xd351('0x68')]:[]};})};}})[_0xd351('0x1d')](respondWithResult(_0x2fcede,null))[_0xd351('0x3a')](function(_0x35b148){var _0x1bb955=_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?0x1f4:_0x35b148[_0xd351('0x6a')]||0x1f4;logger[_0xd351('0x6b')](_0xd351('0x6c'),_0xd351('0x4e'),_0x1bb955,JSON['stringify'](_0x35b148));delete _0x35b148[_0xd351('0x27')];if(_0x1bb955===0x191){_0x1bb955=0x190;}_0x2fcede[_0xd351('0x14')](_0x1bb955)[_0xd351('0x6d')](_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x35b148[_0xd351('0x6a')]}:_0x35b148);});}; \ No newline at end of file +var _0x6324=['error','name','send','index','ZendeskAccount','key','model','map','keys','query','intersection','fields','attributes','length','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','assignee','remove','includes','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end'];(function(_0x7a9436,_0xbe1907){var _0x219638=function(_0x5a2f65){while(--_0x5a2f65){_0x7a9436['push'](_0x7a9436['shift']());}};_0x219638(++_0xbe1907);}(_0x6324,0x142));var _0x4632=function(_0x444e8b,_0x3524cc){_0x444e8b=_0x444e8b-0x0;var _0x35eb37=_0x6324[_0x444e8b];return _0x35eb37;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4632('0x18'));function respondWithStatusCode(_0x499d88,_0x4719f7){_0x4719f7=_0x4719f7||0xcc;return function(_0x299073){if(_0x299073){return _0x499d88[_0x4632('0x19')](_0x4719f7);}return _0x499d88[_0x4632('0x1a')](_0x4719f7)['end']();};}function respondWithResult(_0x3ba361,_0x255882){_0x255882=_0x255882||0xc8;return function(_0x3b9901){if(_0x3b9901){return _0x3ba361[_0x4632('0x1a')](_0x255882)[_0x4632('0x1b')](_0x3b9901);}};}function respondWithFilteredResult(_0x5438ab,_0x47b349){return function(_0x2fd7ae){if(_0x2fd7ae){var _0x38bedd=typeof _0x47b349[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x47b349['limit']===_0x4632('0x1d');var _0x113872=_0x2fd7ae[_0x4632('0x1e')];var _0x5b28b7=_0x38bedd?0x0:_0x47b349[_0x4632('0x1c')];var _0x1894bb=_0x38bedd?_0x2fd7ae['count']:_0x47b349['offset']+_0x47b349[_0x4632('0x1f')];var _0x3cf2bd;if(_0x1894bb>=_0x113872){_0x1894bb=_0x113872;_0x3cf2bd=0xc8;}else{_0x3cf2bd=0xce;}_0x5438ab[_0x4632('0x1a')](_0x3cf2bd);return _0x5438ab[_0x4632('0x20')](_0x4632('0x21'),_0x5b28b7+'-'+_0x1894bb+'/'+_0x113872)[_0x4632('0x1b')](_0x2fd7ae);}return null;};}function patchUpdates(_0x9ab826){return function(_0x468ccb){try{jsonpatch[_0x4632('0x22')](_0x468ccb,_0x9ab826,!![]);}catch(_0x3ea0d1){return BPromise[_0x4632('0x23')](_0x3ea0d1);}return _0x468ccb[_0x4632('0x24')]();};}function saveUpdates(_0x2ca6a5,_0x263907){return function(_0x4cfebc){if(_0x4cfebc){return _0x4cfebc[_0x4632('0x25')](_0x2ca6a5)[_0x4632('0x26')](function(_0x3537ed){return _0x3537ed;});}return null;};}function removeEntity(_0x380a9f,_0x1e1b86){return function(_0x38cbbc){if(_0x38cbbc){return _0x38cbbc[_0x4632('0x27')]()[_0x4632('0x26')](function(){_0x380a9f[_0x4632('0x1a')](0xcc)[_0x4632('0x28')]();});}};}function handleEntityNotFound(_0x1b8de0,_0x4af026){return function(_0x2e3428){if(!_0x2e3428){_0x1b8de0[_0x4632('0x19')](0x194);}return _0x2e3428;};}function handleError(_0x372679,_0x22d0f5){_0x22d0f5=_0x22d0f5||0x1f4;return function(_0x2a0b11){logger[_0x4632('0x29')](_0x2a0b11['stack']);if(_0x2a0b11['name']){delete _0x2a0b11[_0x4632('0x2a')];}_0x372679[_0x4632('0x1a')](_0x22d0f5)[_0x4632('0x2b')](_0x2a0b11);};}exports[_0x4632('0x2c')]=function(_0x34079f,_0x119d1b){var _0x3570b2={},_0x5e2ee4={},_0x42d505={'count':0x0,'rows':[]};var _0x135fd2=_['map'](db[_0x4632('0x2d')]['rawAttributes'],function(_0x6599ad){return{'name':_0x6599ad['fieldName'],'type':_0x6599ad['type'][_0x4632('0x2e')]};});_0x5e2ee4[_0x4632('0x2f')]=_[_0x4632('0x30')](_0x135fd2,'name');_0x5e2ee4['query']=_[_0x4632('0x31')](_0x34079f[_0x4632('0x32')]);_0x5e2ee4['filters']=_['intersection'](_0x5e2ee4[_0x4632('0x2f')],_0x5e2ee4[_0x4632('0x32')]);_0x3570b2['attributes']=_[_0x4632('0x33')](_0x5e2ee4[_0x4632('0x2f')],qs[_0x4632('0x34')](_0x34079f[_0x4632('0x32')][_0x4632('0x34')]));_0x3570b2['attributes']=_0x3570b2[_0x4632('0x35')][_0x4632('0x36')]?_0x3570b2['attributes']:_0x5e2ee4['model'];if(!_0x34079f[_0x4632('0x32')]['hasOwnProperty']('nolimit')){_0x3570b2[_0x4632('0x1f')]=qs['limit'](_0x34079f[_0x4632('0x32')][_0x4632('0x1f')]);_0x3570b2[_0x4632('0x1c')]=qs['offset'](_0x34079f[_0x4632('0x32')][_0x4632('0x1c')]);}_0x3570b2[_0x4632('0x37')]=qs[_0x4632('0x38')](_0x34079f[_0x4632('0x32')]['sort']);_0x3570b2['where']=qs[_0x4632('0x39')](_[_0x4632('0x3a')](_0x34079f[_0x4632('0x32')],_0x5e2ee4['filters']),_0x135fd2);if(_0x34079f['query']['filter']){_0x3570b2[_0x4632('0x3b')]=_[_0x4632('0x3c')](_0x3570b2['where'],{'$or':_[_0x4632('0x30')](_0x135fd2,function(_0x20a700){if(_0x20a700[_0x4632('0x3d')]!==_0x4632('0x3e')){var _0x2309f1={};_0x2309f1[_0x20a700[_0x4632('0x2a')]]={'$like':'%'+_0x34079f[_0x4632('0x32')][_0x4632('0x3f')]+'%'};return _0x2309f1;}})});}_0x3570b2=_[_0x4632('0x3c')]({},_0x3570b2,_0x34079f[_0x4632('0x40')]);var _0x1fd3f1={'where':_0x3570b2[_0x4632('0x3b')]};return db['ZendeskAccount'][_0x4632('0x1e')](_0x1fd3f1)[_0x4632('0x26')](function(_0x4c0e13){_0x42d505[_0x4632('0x1e')]=_0x4c0e13;if(_0x34079f[_0x4632('0x32')]['includeAll']){_0x3570b2[_0x4632('0x41')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4632('0x42')](_0x3570b2);})[_0x4632('0x26')](function(_0x1bfb36){_0x42d505[_0x4632('0x43')]=_0x1bfb36;return _0x42d505;})['then'](respondWithFilteredResult(_0x119d1b,_0x3570b2))[_0x4632('0x44')](handleError(_0x119d1b,null));};exports[_0x4632('0x45')]=function(_0x23ef38,_0x279298){var _0x5cc716={'raw':![],'where':{'id':_0x23ef38[_0x4632('0x46')]['id']}},_0x5b3fa9={};_0x5b3fa9[_0x4632('0x2f')]=_[_0x4632('0x31')](db['ZendeskAccount'][_0x4632('0x47')]);_0x5b3fa9[_0x4632('0x32')]=_[_0x4632('0x31')](_0x23ef38[_0x4632('0x32')]);_0x5b3fa9[_0x4632('0x39')]=_[_0x4632('0x33')](_0x5b3fa9[_0x4632('0x2f')],_0x5b3fa9['query']);_0x5cc716[_0x4632('0x35')]=_[_0x4632('0x33')](_0x5b3fa9[_0x4632('0x2f')],qs[_0x4632('0x34')](_0x23ef38[_0x4632('0x32')]['fields']));_0x5cc716['attributes']=_0x5cc716[_0x4632('0x35')][_0x4632('0x36')]?_0x5cc716[_0x4632('0x35')]:_0x5b3fa9[_0x4632('0x2f')];if(_0x23ef38['query'][_0x4632('0x48')]){_0x5cc716[_0x4632('0x41')]=[{'all':!![]}];}_0x5cc716=_[_0x4632('0x3c')]({},_0x5cc716,_0x23ef38[_0x4632('0x40')]);return db[_0x4632('0x2d')]['find'](_0x5cc716)[_0x4632('0x26')](handleEntityNotFound(_0x279298,null))[_0x4632('0x26')](respondWithResult(_0x279298,null))[_0x4632('0x44')](handleError(_0x279298,null));};exports[_0x4632('0x49')]=function(_0x3676fa,_0x2eb8b0){return db[_0x4632('0x2d')][_0x4632('0x49')](_0x3676fa[_0x4632('0x4a')],{})[_0x4632('0x26')](respondWithResult(_0x2eb8b0,0xc9))[_0x4632('0x44')](handleError(_0x2eb8b0,null));};exports['update']=function(_0xc3ffd0,_0x1ccadb){if(_0xc3ffd0[_0x4632('0x4a')]['id']){delete _0xc3ffd0['body']['id'];}return db[_0x4632('0x2d')][_0x4632('0x4b')]({'where':{'id':_0xc3ffd0[_0x4632('0x46')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x1ccadb,null))[_0x4632('0x26')](saveUpdates(_0xc3ffd0[_0x4632('0x4a')],null))[_0x4632('0x26')](respondWithResult(_0x1ccadb,null))[_0x4632('0x44')](handleError(_0x1ccadb,null));};exports[_0x4632('0x27')]=function(_0x1aa831,_0x4e89e3){return db[_0x4632('0x2d')][_0x4632('0x4b')]({'where':{'id':_0x1aa831['params']['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x4e89e3,null))[_0x4632('0x26')](removeEntity(_0x4e89e3,null))[_0x4632('0x44')](handleError(_0x4e89e3,null));};exports[_0x4632('0x4c')]=function(_0x2c59f5,_0xfeeac0,_0x248dcf){var _0xf4880f={};var _0x31b42d={};var _0x1b66e0;var _0x3e66d8;return db[_0x4632('0x2d')][_0x4632('0x4d')]({'where':{'id':_0x2c59f5[_0x4632('0x46')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0xfeeac0,null))[_0x4632('0x26')](function(_0x32cd35){if(_0x32cd35){_0x1b66e0=_0x32cd35;_0x31b42d[_0x4632('0x2f')]=_[_0x4632('0x31')](db[_0x4632('0x4e')]['rawAttributes']);_0x31b42d[_0x4632('0x32')]=_[_0x4632('0x31')](_0x2c59f5[_0x4632('0x32')]);_0x31b42d[_0x4632('0x39')]=_[_0x4632('0x33')](_0x31b42d[_0x4632('0x2f')],_0x31b42d['query']);_0xf4880f[_0x4632('0x35')]=_[_0x4632('0x33')](_0x31b42d[_0x4632('0x2f')],qs['fields'](_0x2c59f5[_0x4632('0x32')][_0x4632('0x34')]));_0xf4880f['attributes']=_0xf4880f[_0x4632('0x35')][_0x4632('0x36')]?_0xf4880f[_0x4632('0x35')]:_0x31b42d['model'];_0xf4880f[_0x4632('0x37')]=qs[_0x4632('0x38')](_0x2c59f5[_0x4632('0x32')][_0x4632('0x38')]);_0xf4880f[_0x4632('0x3b')]=qs[_0x4632('0x39')](_[_0x4632('0x3a')](_0x2c59f5[_0x4632('0x32')],_0x31b42d[_0x4632('0x39')]));if(_0x2c59f5[_0x4632('0x32')]['filter']){_0xf4880f[_0x4632('0x3b')]=_[_0x4632('0x3c')](_0xf4880f['where'],{'$or':_[_0x4632('0x30')](_0xf4880f['attributes'],function(_0x48e942){var _0xa55d76={};_0xa55d76[_0x48e942]={'$like':'%'+_0x2c59f5[_0x4632('0x32')][_0x4632('0x3f')]+'%'};return _0xa55d76;})});}_0xf4880f=_[_0x4632('0x3c')]({},_0xf4880f,_0x2c59f5[_0x4632('0x40')]);return _0x1b66e0[_0x4632('0x4c')](_0xf4880f);}})[_0x4632('0x26')](function(_0x3e2849){if(_0x3e2849){_0x3e66d8=_0x3e2849[_0x4632('0x36')];if(!_0x2c59f5[_0x4632('0x32')][_0x4632('0x4f')](_0x4632('0x50'))){_0xf4880f[_0x4632('0x1f')]=qs[_0x4632('0x1f')](_0x2c59f5['query']['limit']);_0xf4880f[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x2c59f5[_0x4632('0x32')][_0x4632('0x1c')]);}return _0x1b66e0[_0x4632('0x4c')](_0xf4880f);}})[_0x4632('0x26')](function(_0x5b66ee){if(_0x5b66ee){return _0x5b66ee?{'count':_0x3e66d8,'rows':_0x5b66ee}:null;}})[_0x4632('0x26')](respondWithResult(_0xfeeac0,null))[_0x4632('0x44')](handleError(_0xfeeac0,null));};exports[_0x4632('0x51')]=function(_0x2e4d57,_0x5d1994,_0x529be1){if(_0x2e4d57[_0x4632('0x4a')]['id']){delete _0x2e4d57['body']['id'];}return db[_0x4632('0x2d')][_0x4632('0x4d')]({'where':{'id':_0x2e4d57[_0x4632('0x46')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x5d1994,null))[_0x4632('0x26')](function(_0x5e5669){if(_0x5e5669){_0x2e4d57[_0x4632('0x4a')][_0x4632('0x52')]=_0x5e5669['id'];_0x2e4d57['body']['Subjects']=integrations[_0x4632('0x53')](_0x2e4d57[_0x4632('0x4a')][_0x4632('0x54')],_0x2e4d57[_0x4632('0x4a')]['type']);_0x2e4d57['body']['Descriptions']=integrations[_0x4632('0x55')](_0x2e4d57['body'][_0x4632('0x54')],_0x2e4d57[_0x4632('0x4a')][_0x4632('0x3d')]);return db[_0x4632('0x4e')][_0x4632('0x49')](_0x2e4d57[_0x4632('0x4a')],{'include':[{'model':db[_0x4632('0x56')],'as':_0x4632('0x57')},{'model':db[_0x4632('0x56')],'as':_0x4632('0x58')}]});}return null;})[_0x4632('0x26')](respondWithResult(_0x5d1994,null))[_0x4632('0x44')](handleError(_0x5d1994,null));};exports[_0x4632('0x59')]=function(_0x3d5e65,_0x461700,_0x1b2905){var _0x550c4d='';return db[_0x4632('0x2d')][_0x4632('0x4d')]({'where':{'id':_0x3d5e65[_0x4632('0x46')]['id']},'attributes':['id',_0x4632('0x5a'),_0x4632('0x5b'),_0x4632('0x5c'),_0x4632('0x5d'),_0x4632('0x5e')]})[_0x4632('0x26')](handleEntityNotFound(_0x461700,null))[_0x4632('0x26')](function(_0x16ed40){if(_0x16ed40){_0x550c4d=_0x16ed40[_0x4632('0x5e')];var _0x27e2a6=_0x550c4d['slice'](-0x1);if(_0x27e2a6==='/'){_0x550c4d=_0x550c4d[_0x4632('0x5f')](0x0,_0x550c4d[_0x4632('0x60')](_0x27e2a6));}var _0x348af1={'method':_0x4632('0x61'),'uri':util[_0x4632('0x62')](_0x4632('0x63'),_0x550c4d,'ticket_fields'),'json':!![]};switch(_0x16ed40[_0x4632('0x5d')]){case _0x4632('0x5b'):_0x348af1['headers']={'Authorization':util[_0x4632('0x62')](_0x4632('0x64'),new Buffer(util[_0x4632('0x62')](_0x4632('0x65'),_0x16ed40[_0x4632('0x5a')],_0x16ed40['password']))[_0x4632('0x66')](_0x4632('0x67')))};break;case _0x4632('0x5c'):_0x348af1['headers']={'Authorization':util[_0x4632('0x62')](_0x4632('0x64'),new Buffer(util[_0x4632('0x62')](_0x4632('0x68'),_0x16ed40[_0x4632('0x5a')],_0x16ed40[_0x4632('0x5c')]))[_0x4632('0x66')](_0x4632('0x67')))};break;default:throw new db['Sequelize'][(_0x4632('0x69'))](_0x4632('0x6a'));}return rp(_0x348af1);}})[_0x4632('0x26')](function(_0x525bf9){if(_0x525bf9){var _0xfc48bd=[_0x4632('0x6b'),'description','group',_0x4632('0x6c')];_[_0x4632('0x6d')](_0x525bf9['ticket_fields'],function(_0x63d3e1){return _0xfc48bd[_0x4632('0x6e')](_0x63d3e1[_0x4632('0x3d')]);});return{'count':_0x525bf9[_0x4632('0x6f')][_0x4632('0x36')],'rows':_[_0x4632('0x30')](_0x525bf9[_0x4632('0x6f')],function(_0x130b52){return{'id':_0x130b52['id'],'name':_0x130b52['position']>0x7?_0x130b52[_0x4632('0x70')]:_0x130b52[_0x4632('0x3d')],'custom':_0x130b52[_0x4632('0x71')]>0x7?!![]:![],'options':_0x130b52[_0x4632('0x72')]?_0x130b52['system_field_options']:_0x130b52[_0x4632('0x73')]?_0x130b52[_0x4632('0x73')]:[]};})};}})[_0x4632('0x26')](respondWithResult(_0x461700,null))[_0x4632('0x44')](function(_0x3cee1d){var _0x4ca8a8=_0x3d5e65[_0x4632('0x32')][_0x4632('0x74')]?0x1f4:_0x3cee1d[_0x4632('0x75')]||0x1f4;logger[_0x4632('0x29')](_0x4632('0x76'),_0x4632('0x59'),_0x4ca8a8,JSON[_0x4632('0x77')](_0x3cee1d));delete _0x3cee1d[_0x4632('0x2a')];if(_0x4ca8a8===0x191){_0x4ca8a8=0x190;}_0x461700['status'](_0x4ca8a8)[_0x4632('0x2b')](_0x3d5e65[_0x4632('0x32')][_0x4632('0x74')]?{'message':_0x4632('0x78'),'statusCode':_0x3cee1d[_0x4632('0x75')]}:_0x3cee1d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index fa0d501..a67cd0b 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 _0xd08f=['moment','bluebird','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x3baaf2,_0x894e3d){var _0x50e8b0=function(_0x35dd6f){while(--_0x35dd6f){_0x3baaf2['push'](_0x3baaf2['shift']());}};_0x50e8b0(++_0x894e3d);}(_0xd08f,0x1b6));var _0xfd08=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0xd08f[_0x324012];return _0x435cf2;};'use strict';var _=require(_0xfd08('0x0'));var util=require(_0xfd08('0x1'));var logger=require(_0xfd08('0x2'))(_0xfd08('0x3'));var moment=require(_0xfd08('0x4'));var BPromise=require(_0xfd08('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd08('0x6'));var rimraf=require(_0xfd08('0x7'));var config=require('../../config/environment');var attributes=require(_0xfd08('0x8'));var integrations=require(_0xfd08('0x9'));module[_0xfd08('0xa')]=function(_0x5bf851,_0x15a1b4){return _0x5bf851[_0xfd08('0xb')]('ZendeskAccount',attributes,{'tableName':_0xfd08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6227=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','api','moment','bluebird'];(function(_0x5b6ac1,_0x34356e){var _0x1ad4a1=function(_0x40904f){while(--_0x40904f){_0x5b6ac1['push'](_0x5b6ac1['shift']());}};_0x1ad4a1(++_0x34356e);}(_0x6227,0x1ca));var _0x7622=function(_0x17efda,_0x6cbecd){_0x17efda=_0x17efda-0x0;var _0x24b55f=_0x6227[_0x17efda];return _0x24b55f;};'use strict';var _=require(_0x7622('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7622('0x1'));var moment=require(_0x7622('0x2'));var BPromise=require(_0x7622('0x3'));var rp=require(_0x7622('0x4'));var fs=require('fs');var path=require(_0x7622('0x5'));var rimraf=require(_0x7622('0x6'));var config=require(_0x7622('0x7'));var attributes=require(_0x7622('0x8'));var integrations=require(_0x7622('0x9'));module[_0x7622('0xa')]=function(_0x784fed,_0x4be9d7){return _0x784fed[_0x7622('0xb')](_0x7622('0xc'),attributes,{'tableName':_0x7622('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index e8876a7..8e89f1e 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 _0x5520=['map','model','debug','GetZendeskAccount','find','raw','ShowZendeskAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ZendeskAccount','findAll','options','where','attributes','limit','include'];(function(_0xabb00f,_0x4ef9bb){var _0x587cbb=function(_0x1471e3){while(--_0x1471e3){_0xabb00f['push'](_0xabb00f['shift']());}};_0x587cbb(++_0x4ef9bb);}(_0x5520,0x165));var _0x0552=function(_0x3d35e5,_0x44b351){_0x3d35e5=_0x3d35e5-0x0;var _0xf9e901=_0x5520[_0x3d35e5];return _0xf9e901;};'use strict';var _=require(_0x0552('0x0'));var util=require(_0x0552('0x1'));var moment=require('moment');var BPromise=require(_0x0552('0x2'));var rs=require(_0x0552('0x3'));var fs=require('fs');var Redis=require(_0x0552('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0552('0x5'));var logger=require(_0x0552('0x6'))(_0x0552('0x7'));var config=require('../../config/environment');var jayson=require(_0x0552('0x8'));var client=jayson[_0x0552('0x9')][_0x0552('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x370f0e,_0x28584a,_0x48381f){return new BPromise(function(_0x49ebfd,_0x2e1eb1){return client[_0x0552('0xb')](_0x370f0e,_0x48381f)[_0x0552('0xc')](function(_0x530f0d){logger[_0x0552('0xd')](_0x0552('0xe'),_0x28584a,_0x0552('0xf'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x28584a,'request\x20sent',JSON[_0x0552('0x10')](_0x530f0d));if(_0x530f0d[_0x0552('0x11')]){if(_0x530f0d[_0x0552('0x11')][_0x0552('0x12')]===0x1f4){logger[_0x0552('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x28584a,_0x530f0d[_0x0552('0x11')][_0x0552('0x13')]);return _0x2e1eb1(_0x530f0d[_0x0552('0x11')]['message']);}logger[_0x0552('0x11')](_0x0552('0xe'),_0x28584a,_0x530f0d[_0x0552('0x11')][_0x0552('0x13')]);return _0x49ebfd(_0x530f0d[_0x0552('0x11')][_0x0552('0x13')]);}else{logger['info'](_0x0552('0xe'),_0x28584a,'request\x20sent');_0x49ebfd(_0x530f0d['result'][_0x0552('0x13')]);}})[_0x0552('0x14')](function(_0x1ceb36){logger[_0x0552('0x11')](_0x0552('0xe'),_0x28584a,_0x1ceb36);_0x2e1eb1(_0x1ceb36);});});}exports['GetZendeskAccount']=function(_0x26df09){var _0x389bb7=this;return new Promise(function(_0x18003e,_0x57b719){return db[_0x0552('0x15')][_0x0552('0x16')]({'raw':_0x26df09['options']?_0x26df09[_0x0552('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x26df09['options']?_0x26df09[_0x0552('0x17')][_0x0552('0x18')]||null:null,'attributes':_0x26df09['options']?_0x26df09[_0x0552('0x17')][_0x0552('0x19')]||null:null,'limit':_0x26df09[_0x0552('0x17')]?_0x26df09[_0x0552('0x17')][_0x0552('0x1a')]||null:null,'include':_0x26df09[_0x0552('0x17')]?_0x26df09[_0x0552('0x17')][_0x0552('0x1b')]?_[_0x0552('0x1c')](_0x26df09[_0x0552('0x17')][_0x0552('0x1b')],function(_0x2a5fd2){return{'model':db[_0x2a5fd2[_0x0552('0x1d')]],'as':_0x2a5fd2['as'],'attributes':_0x2a5fd2[_0x0552('0x19')],'include':_0x2a5fd2[_0x0552('0x1b')]?_[_0x0552('0x1c')](_0x2a5fd2[_0x0552('0x1b')],function(_0x4dde4d){return{'model':db[_0x4dde4d[_0x0552('0x1d')]],'as':_0x4dde4d['as'],'attributes':_0x4dde4d[_0x0552('0x19')],'include':_0x4dde4d[_0x0552('0x1b')]?_['map'](_0x4dde4d[_0x0552('0x1b')],function(_0x6728b4){return{'model':db[_0x6728b4[_0x0552('0x1d')]],'as':_0x6728b4['as'],'attributes':_0x6728b4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e6a6b){logger[_0x0552('0xd')]('GetZendeskAccount',_0x26df09);logger[_0x0552('0x1e')](_0x0552('0x1f'),_0x26df09,JSON[_0x0552('0x10')](_0x5e6a6b));_0x18003e(_0x5e6a6b);})[_0x0552('0x14')](function(_0x560747){logger[_0x0552('0x11')](_0x0552('0x1f'),_0x560747[_0x0552('0x13')],_0x26df09);_0x57b719(_0x389bb7['error'](0x1f4,_0x560747[_0x0552('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x1edb24){var _0x51e45f=this;return new Promise(function(_0x146ffb,_0x4c797a){return db['ZendeskAccount'][_0x0552('0x20')]({'raw':_0x1edb24[_0x0552('0x17')]?_0x1edb24['options'][_0x0552('0x21')]===undefined?!![]:![]:!![],'where':_0x1edb24['options']?_0x1edb24[_0x0552('0x17')]['where']||null:null,'attributes':_0x1edb24[_0x0552('0x17')]?_0x1edb24[_0x0552('0x17')][_0x0552('0x19')]||null:null,'include':_0x1edb24['options']?_0x1edb24[_0x0552('0x17')][_0x0552('0x1b')]?_[_0x0552('0x1c')](_0x1edb24[_0x0552('0x17')]['include'],function(_0x250b4e){return{'model':db[_0x250b4e[_0x0552('0x1d')]],'as':_0x250b4e['as'],'attributes':_0x250b4e['attributes'],'include':_0x250b4e['include']?_[_0x0552('0x1c')](_0x250b4e[_0x0552('0x1b')],function(_0x4c84a5){return{'model':db[_0x4c84a5[_0x0552('0x1d')]],'as':_0x4c84a5['as'],'attributes':_0x4c84a5[_0x0552('0x19')],'include':_0x4c84a5[_0x0552('0x1b')]?_['map'](_0x4c84a5[_0x0552('0x1b')],function(_0x18bdee){return{'model':db[_0x18bdee['model']],'as':_0x18bdee['as'],'attributes':_0x18bdee[_0x0552('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0552('0xc')](function(_0x1f7187){logger[_0x0552('0xd')](_0x0552('0x22'),_0x1edb24);logger['debug'](_0x0552('0x22'),_0x1edb24,JSON['stringify'](_0x1f7187));_0x146ffb(_0x1f7187);})[_0x0552('0x14')](function(_0x59c807){logger[_0x0552('0x11')](_0x0552('0x22'),_0x59c807[_0x0552('0x13')],_0x1edb24);_0x4c797a(_0x51e45f[_0x0552('0x11')](0x1f4,_0x59c807[_0x0552('0x13')]));});});}; \ No newline at end of file +var _0xbe22=['request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xbe22,0x86));var _0x2be2=function(_0x25c7c5,_0x39a482){_0x25c7c5=_0x25c7c5-0x0;var _0x2f08bd=_0xbe22[_0x25c7c5];return _0x2f08bd;};'use strict';var _=require('lodash');var util=require(_0x2be2('0x0'));var moment=require(_0x2be2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2be2('0x2'));var db=require(_0x2be2('0x3'))['db'];var utils=require(_0x2be2('0x4'));var logger=require(_0x2be2('0x5'))(_0x2be2('0x6'));var config=require('../../config/environment');var jayson=require(_0x2be2('0x7'));var client=jayson[_0x2be2('0x8')][_0x2be2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d290b,_0x1039ce,_0x53eefe){return new BPromise(function(_0x57aa67,_0x4e8c8a){return client[_0x2be2('0xa')](_0x3d290b,_0x53eefe)[_0x2be2('0xb')](function(_0x187d3b){logger[_0x2be2('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x1039ce,_0x2be2('0xd'));logger[_0x2be2('0xe')](_0x2be2('0xf'),_0x1039ce,'request\x20sent',JSON['stringify'](_0x187d3b));if(_0x187d3b[_0x2be2('0x10')]){if(_0x187d3b['error'][_0x2be2('0x11')]===0x1f4){logger[_0x2be2('0x10')](_0x2be2('0x12'),_0x1039ce,_0x187d3b['error'][_0x2be2('0x13')]);return _0x4e8c8a(_0x187d3b[_0x2be2('0x10')][_0x2be2('0x13')]);}logger['error'](_0x2be2('0x12'),_0x1039ce,_0x187d3b[_0x2be2('0x10')][_0x2be2('0x13')]);return _0x57aa67(_0x187d3b[_0x2be2('0x10')][_0x2be2('0x13')]);}else{logger[_0x2be2('0xc')](_0x2be2('0x12'),_0x1039ce,_0x2be2('0xd'));_0x57aa67(_0x187d3b[_0x2be2('0x14')][_0x2be2('0x13')]);}})[_0x2be2('0x15')](function(_0x1e157c){logger[_0x2be2('0x10')](_0x2be2('0x12'),_0x1039ce,_0x1e157c);_0x4e8c8a(_0x1e157c);});});}exports[_0x2be2('0x16')]=function(_0x3a778f){var _0x58f4bf=this;return new Promise(function(_0x32c30f,_0x5adb87){return db[_0x2be2('0x17')][_0x2be2('0x18')]({'raw':_0x3a778f[_0x2be2('0x19')]?_0x3a778f[_0x2be2('0x19')][_0x2be2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a778f['options']?_0x3a778f[_0x2be2('0x19')][_0x2be2('0x1b')]||null:null,'attributes':_0x3a778f[_0x2be2('0x19')]?_0x3a778f[_0x2be2('0x19')][_0x2be2('0x1c')]||null:null,'limit':_0x3a778f[_0x2be2('0x19')]?_0x3a778f[_0x2be2('0x19')][_0x2be2('0x1d')]||null:null,'include':_0x3a778f[_0x2be2('0x19')]?_0x3a778f[_0x2be2('0x19')][_0x2be2('0x1e')]?_[_0x2be2('0x1f')](_0x3a778f['options'][_0x2be2('0x1e')],function(_0x542a53){return{'model':db[_0x542a53[_0x2be2('0x20')]],'as':_0x542a53['as'],'attributes':_0x542a53[_0x2be2('0x1c')],'include':_0x542a53[_0x2be2('0x1e')]?_[_0x2be2('0x1f')](_0x542a53[_0x2be2('0x1e')],function(_0x42edef){return{'model':db[_0x42edef[_0x2be2('0x20')]],'as':_0x42edef['as'],'attributes':_0x42edef[_0x2be2('0x1c')],'include':_0x42edef[_0x2be2('0x1e')]?_['map'](_0x42edef[_0x2be2('0x1e')],function(_0x7fe763){return{'model':db[_0x7fe763[_0x2be2('0x20')]],'as':_0x7fe763['as'],'attributes':_0x7fe763[_0x2be2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x565d47){logger[_0x2be2('0xc')](_0x2be2('0x16'),_0x3a778f);logger[_0x2be2('0xe')](_0x2be2('0x16'),_0x3a778f,JSON[_0x2be2('0x21')](_0x565d47));_0x32c30f(_0x565d47);})[_0x2be2('0x15')](function(_0x31b0d6){logger[_0x2be2('0x10')](_0x2be2('0x16'),_0x31b0d6['message'],_0x3a778f);_0x5adb87(_0x58f4bf['error'](0x1f4,_0x31b0d6[_0x2be2('0x13')]));});});};exports[_0x2be2('0x22')]=function(_0x56658f){var _0x25ceb4=this;return new Promise(function(_0x4b5145,_0x2ba652){return db[_0x2be2('0x17')][_0x2be2('0x23')]({'raw':_0x56658f[_0x2be2('0x19')]?_0x56658f[_0x2be2('0x19')][_0x2be2('0x1a')]===undefined?!![]:![]:!![],'where':_0x56658f[_0x2be2('0x19')]?_0x56658f[_0x2be2('0x19')]['where']||null:null,'attributes':_0x56658f[_0x2be2('0x19')]?_0x56658f[_0x2be2('0x19')][_0x2be2('0x1c')]||null:null,'include':_0x56658f['options']?_0x56658f[_0x2be2('0x19')][_0x2be2('0x1e')]?_[_0x2be2('0x1f')](_0x56658f[_0x2be2('0x19')][_0x2be2('0x1e')],function(_0x13ab76){return{'model':db[_0x13ab76['model']],'as':_0x13ab76['as'],'attributes':_0x13ab76[_0x2be2('0x1c')],'include':_0x13ab76[_0x2be2('0x1e')]?_['map'](_0x13ab76[_0x2be2('0x1e')],function(_0x197232){return{'model':db[_0x197232['model']],'as':_0x197232['as'],'attributes':_0x197232['attributes'],'include':_0x197232[_0x2be2('0x1e')]?_[_0x2be2('0x1f')](_0x197232['include'],function(_0x119821){return{'model':db[_0x119821[_0x2be2('0x20')]],'as':_0x119821['as'],'attributes':_0x119821[_0x2be2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2be2('0xb')](function(_0xcd8a07){logger['info'](_0x2be2('0x22'),_0x56658f);logger[_0x2be2('0xe')](_0x2be2('0x22'),_0x56658f,JSON['stringify'](_0xcd8a07));_0x4b5145(_0xcd8a07);})[_0x2be2('0x15')](function(_0x495331){logger[_0x2be2('0x10')](_0x2be2('0x22'),_0x495331[_0x2be2('0x13')],_0x56658f);_0x2ba652(_0x25ceb4[_0x2be2('0x10')](0x1f4,_0x495331[_0x2be2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 5ccce56..ef5d67e 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 _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x4024,0x89));var _0x4402=function(_0x177370,_0x57637b){_0x177370=_0x177370-0x0;var _0x13caed=_0x4024[_0x177370];return _0x13caed;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file +var _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x33e5e2,_0x10d7a8){var _0x21e5af=function(_0x4b4103){while(--_0x4b4103){_0x33e5e2['push'](_0x33e5e2['shift']());}};_0x21e5af(++_0x10d7a8);}(_0xea28,0x13a));var _0x8ea2=function(_0x5137ce,_0x172fdd){_0x5137ce=_0x5137ce-0x0;var _0x1d280c=_0xea28[_0x5137ce];return _0x1d280c;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 8ea4150..95dab0f 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 _0x4efe=['exports','STRING','sequelize'];(function(_0x3df1f2,_0xdef69a){var _0x5d06e0=function(_0x170c48){while(--_0x170c48){_0x3df1f2['push'](_0x3df1f2['shift']());}};_0x5d06e0(++_0xdef69a);}(_0x4efe,0x1a0));var _0xe4ef=function(_0x802997,_0x5534a2){_0x802997=_0x802997-0x0;var _0x35c641=_0x4efe[_0x802997];return _0x35c641;};'use strict';var Sequelize=require(_0xe4ef('0x0'));module[_0xe4ef('0x1')]={'name':{'type':Sequelize[_0xe4ef('0x2')]},'description':{'type':Sequelize[_0xe4ef('0x2')]}}; \ No newline at end of file +var _0xa433=['sequelize','STRING'];(function(_0x3624f2,_0xc5b541){var _0x388060=function(_0x2c5c7d){while(--_0x2c5c7d){_0x3624f2['push'](_0x3624f2['shift']());}};_0x388060(++_0xc5b541);}(_0xa433,0x92));var _0x3a43=function(_0x5ed543,_0x25e719){_0x5ed543=_0x5ed543-0x0;var _0x89ba6e=_0xa433[_0x5ed543];return _0x89ba6e;};'use strict';var Sequelize=require(_0x3a43('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3a43('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 03a4cda..9d6d240 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 _0xad94=['attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','ZendeskConfiguration','findAll','catch','show','params','length','options','find','create','update','body','destroy','getFields','findOne','order','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','count','set','Content-Range','json','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x4898b2,_0x3cbd90){var _0x2a89d9=function(_0x56a69f){while(--_0x56a69f){_0x4898b2['push'](_0x4898b2['shift']());}};_0x2a89d9(++_0x3cbd90);}(_0xad94,0x1ad));var _0x4ad9=function(_0x45fee0,_0x2d0ca4){_0x45fee0=_0x45fee0-0x0;var _0x166bb3=_0xad94[_0x45fee0];return _0x166bb3;};'use strict';var emlformat=require(_0x4ad9('0x0'));var rimraf=require(_0x4ad9('0x1'));var zipdir=require(_0x4ad9('0x2'));var jsonpatch=require(_0x4ad9('0x3'));var rp=require(_0x4ad9('0x4'));var moment=require(_0x4ad9('0x5'));var BPromise=require(_0x4ad9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ad9('0x7'));var sox=require(_0x4ad9('0x8'));var csv=require(_0x4ad9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ad9('0xa'));var _=require(_0x4ad9('0xb'));var squel=require(_0x4ad9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4ad9('0xd'));var Papa=require(_0x4ad9('0xe'));var Redis=require(_0x4ad9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4ad9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ad9('0x11'))('api');var utils=require(_0x4ad9('0x12'));var config=require(_0x4ad9('0x13'));var licenseUtil=require(_0x4ad9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14487c,_0x3ad6a6){_0x3ad6a6=_0x3ad6a6||0xcc;return function(_0x52ea5e){if(_0x52ea5e){return _0x14487c['sendStatus'](_0x3ad6a6);}return _0x14487c[_0x4ad9('0x15')](_0x3ad6a6)[_0x4ad9('0x16')]();};}function respondWithResult(_0x1b3379,_0xf66af6){_0xf66af6=_0xf66af6||0xc8;return function(_0xc19586){if(_0xc19586){return _0x1b3379['status'](_0xf66af6)['json'](_0xc19586);}};}function respondWithFilteredResult(_0xba3f1e,_0x26412e){return function(_0x198129){if(_0x198129){var _0x24813a=typeof _0x26412e[_0x4ad9('0x17')]==='undefined'&&typeof _0x26412e[_0x4ad9('0x18')]==='undefined';var _0xb5d846=_0x198129[_0x4ad9('0x19')];var _0x5532a3=_0x24813a?0x0:_0x26412e['offset'];var _0x3d7666=_0x24813a?_0x198129[_0x4ad9('0x19')]:_0x26412e[_0x4ad9('0x17')]+_0x26412e[_0x4ad9('0x18')];var _0x57bb5e;if(_0x3d7666>=_0xb5d846){_0x3d7666=_0xb5d846;_0x57bb5e=0xc8;}else{_0x57bb5e=0xce;}_0xba3f1e[_0x4ad9('0x15')](_0x57bb5e);return _0xba3f1e[_0x4ad9('0x1a')](_0x4ad9('0x1b'),_0x5532a3+'-'+_0x3d7666+'/'+_0xb5d846)[_0x4ad9('0x1c')](_0x198129);}return null;};}function patchUpdates(_0x58d1e6){return function(_0x229fce){try{jsonpatch['apply'](_0x229fce,_0x58d1e6,!![]);}catch(_0x5e3afa){return BPromise['reject'](_0x5e3afa);}return _0x229fce[_0x4ad9('0x1d')]();};}function saveUpdates(_0xdd1bc8,_0x261a7d){return function(_0x1cad67){if(_0x1cad67){return _0x1cad67['update'](_0xdd1bc8)[_0x4ad9('0x1e')](function(_0x17b639){return _0x17b639;});}return null;};}function removeEntity(_0x360a42,_0x562de3){return function(_0x42bf0e){if(_0x42bf0e){return _0x42bf0e['destroy']()[_0x4ad9('0x1e')](function(){_0x360a42[_0x4ad9('0x15')](0xcc)[_0x4ad9('0x16')]();});}};}function handleEntityNotFound(_0x55f500,_0x2235b6){return function(_0x7f0b10){if(!_0x7f0b10){_0x55f500['sendStatus'](0x194);}return _0x7f0b10;};}function handleError(_0x560789,_0x1eb78c){_0x1eb78c=_0x1eb78c||0x1f4;return function(_0x4ef83f){logger[_0x4ad9('0x1f')](_0x4ef83f[_0x4ad9('0x20')]);if(_0x4ef83f['name']){delete _0x4ef83f[_0x4ad9('0x21')];}_0x560789['status'](_0x1eb78c)[_0x4ad9('0x22')](_0x4ef83f);};}exports[_0x4ad9('0x23')]=function(_0x14dc48,_0x11e836){var _0x48351f={},_0xcacf02={},_0x591996={'count':0x0,'rows':[]};var _0x4aa660=_['map'](db['ZendeskConfiguration'][_0x4ad9('0x24')],function(_0x2e507d){return{'name':_0x2e507d[_0x4ad9('0x25')],'type':_0x2e507d[_0x4ad9('0x26')][_0x4ad9('0x27')]};});_0xcacf02[_0x4ad9('0x28')]=_[_0x4ad9('0x29')](_0x4aa660,_0x4ad9('0x21'));_0xcacf02[_0x4ad9('0x2a')]=_[_0x4ad9('0x2b')](_0x14dc48[_0x4ad9('0x2a')]);_0xcacf02[_0x4ad9('0x2c')]=_['intersection'](_0xcacf02[_0x4ad9('0x28')],_0xcacf02[_0x4ad9('0x2a')]);_0x48351f[_0x4ad9('0x2d')]=_[_0x4ad9('0x2e')](_0xcacf02['model'],qs['fields'](_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x48351f['attributes']=_0x48351f[_0x4ad9('0x2d')]['length']?_0x48351f[_0x4ad9('0x2d')]:_0xcacf02[_0x4ad9('0x28')];if(!_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x30')](_0x4ad9('0x31'))){_0x48351f['limit']=qs['limit'](_0x14dc48[_0x4ad9('0x2a')]['limit']);_0x48351f['offset']=qs[_0x4ad9('0x17')](_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x17')]);}_0x48351f['order']=qs['sort'](_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x32')]);_0x48351f[_0x4ad9('0x33')]=qs[_0x4ad9('0x2c')](_[_0x4ad9('0x34')](_0x14dc48[_0x4ad9('0x2a')],_0xcacf02[_0x4ad9('0x2c')]),_0x4aa660);if(_0x14dc48[_0x4ad9('0x2a')]['filter']){_0x48351f[_0x4ad9('0x33')]=_[_0x4ad9('0x35')](_0x48351f[_0x4ad9('0x33')],{'$or':_[_0x4ad9('0x29')](_0x4aa660,function(_0x499aef){if(_0x499aef[_0x4ad9('0x26')]!=='VIRTUAL'){var _0x15122e={};_0x15122e[_0x499aef['name']]={'$like':'%'+_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x36')]+'%'};return _0x15122e;}})});}_0x48351f=_['merge']({},_0x48351f,_0x14dc48['options']);var _0xf52df7={'where':_0x48351f['where']};return db['ZendeskConfiguration'][_0x4ad9('0x19')](_0xf52df7)[_0x4ad9('0x1e')](function(_0x55e9e1){_0x591996[_0x4ad9('0x19')]=_0x55e9e1;if(_0x14dc48['query'][_0x4ad9('0x37')]){_0x48351f[_0x4ad9('0x38')]=[{'all':!![]}];}return db[_0x4ad9('0x39')][_0x4ad9('0x3a')](_0x48351f);})[_0x4ad9('0x1e')](function(_0xde59a9){_0x591996['rows']=_0xde59a9;return _0x591996;})['then'](respondWithFilteredResult(_0x11e836,_0x48351f))[_0x4ad9('0x3b')](handleError(_0x11e836,null));};exports[_0x4ad9('0x3c')]=function(_0x5e0244,_0x2a2908){var _0x45e344={'raw':![],'where':{'id':_0x5e0244[_0x4ad9('0x3d')]['id']}},_0x1becab={};_0x1becab[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db[_0x4ad9('0x39')][_0x4ad9('0x24')]);_0x1becab[_0x4ad9('0x2a')]=_[_0x4ad9('0x2b')](_0x5e0244['query']);_0x1becab[_0x4ad9('0x2c')]=_[_0x4ad9('0x2e')](_0x1becab[_0x4ad9('0x28')],_0x1becab['query']);_0x45e344[_0x4ad9('0x2d')]=_[_0x4ad9('0x2e')](_0x1becab[_0x4ad9('0x28')],qs[_0x4ad9('0x2f')](_0x5e0244['query'][_0x4ad9('0x2f')]));_0x45e344[_0x4ad9('0x2d')]=_0x45e344[_0x4ad9('0x2d')][_0x4ad9('0x3e')]?_0x45e344[_0x4ad9('0x2d')]:_0x1becab[_0x4ad9('0x28')];if(_0x5e0244[_0x4ad9('0x2a')][_0x4ad9('0x37')]){_0x45e344['include']=[{'all':!![]}];}_0x45e344=_[_0x4ad9('0x35')]({},_0x45e344,_0x5e0244[_0x4ad9('0x3f')]);return db[_0x4ad9('0x39')][_0x4ad9('0x40')](_0x45e344)[_0x4ad9('0x1e')](handleEntityNotFound(_0x2a2908,null))[_0x4ad9('0x1e')](respondWithResult(_0x2a2908,null))[_0x4ad9('0x3b')](handleError(_0x2a2908,null));};exports[_0x4ad9('0x41')]=function(_0x134129,_0xcc9f61){return db['ZendeskConfiguration'][_0x4ad9('0x41')](_0x134129['body'],{})[_0x4ad9('0x1e')](respondWithResult(_0xcc9f61,0xc9))[_0x4ad9('0x3b')](handleError(_0xcc9f61,null));};exports[_0x4ad9('0x42')]=function(_0x2a83ad,_0x5378c2){if(_0x2a83ad[_0x4ad9('0x43')]['id']){delete _0x2a83ad[_0x4ad9('0x43')]['id'];}return db[_0x4ad9('0x39')][_0x4ad9('0x40')]({'where':{'id':_0x2a83ad[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x5378c2,null))[_0x4ad9('0x1e')](saveUpdates(_0x2a83ad[_0x4ad9('0x43')],null))[_0x4ad9('0x1e')](respondWithResult(_0x5378c2,null))[_0x4ad9('0x3b')](handleError(_0x5378c2,null));};exports[_0x4ad9('0x44')]=function(_0x57a52a,_0x157f53){return db[_0x4ad9('0x39')]['find']({'where':{'id':_0x57a52a[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x157f53,null))[_0x4ad9('0x1e')](removeEntity(_0x157f53,null))[_0x4ad9('0x3b')](handleError(_0x157f53,null));};exports[_0x4ad9('0x45')]=function(_0x3fe2fa,_0x288b67,_0x376929){var _0x18a22b={};var _0x5cc7fe={};var _0x44a6c1;var _0x56344b;return db[_0x4ad9('0x39')][_0x4ad9('0x46')]({'where':{'id':_0x3fe2fa[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x288b67,null))[_0x4ad9('0x1e')](function(_0x3739a2){if(_0x3739a2){_0x44a6c1=_0x3739a2;_0x5cc7fe[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db['ZendeskField'][_0x4ad9('0x24')]);_0x5cc7fe['query']=_[_0x4ad9('0x2b')](_0x3fe2fa[_0x4ad9('0x2a')]);_0x5cc7fe[_0x4ad9('0x2c')]=_[_0x4ad9('0x2e')](_0x5cc7fe[_0x4ad9('0x28')],_0x5cc7fe['query']);_0x18a22b['attributes']=_[_0x4ad9('0x2e')](_0x5cc7fe[_0x4ad9('0x28')],qs['fields'](_0x3fe2fa[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x18a22b[_0x4ad9('0x2d')]=_0x18a22b[_0x4ad9('0x2d')]['length']?_0x18a22b[_0x4ad9('0x2d')]:_0x5cc7fe[_0x4ad9('0x28')];_0x18a22b[_0x4ad9('0x47')]=qs['sort'](_0x3fe2fa[_0x4ad9('0x2a')][_0x4ad9('0x32')]);_0x18a22b[_0x4ad9('0x33')]=qs[_0x4ad9('0x2c')](_[_0x4ad9('0x34')](_0x3fe2fa[_0x4ad9('0x2a')],_0x5cc7fe['filters']));if(_0x3fe2fa[_0x4ad9('0x2a')]['filter']){_0x18a22b[_0x4ad9('0x33')]=_['merge'](_0x18a22b['where'],{'$or':_['map'](_0x18a22b[_0x4ad9('0x2d')],function(_0x44ad0b){var _0x2d452d={};_0x2d452d[_0x44ad0b]={'$like':'%'+_0x3fe2fa[_0x4ad9('0x2a')]['filter']+'%'};return _0x2d452d;})});}_0x18a22b=_['merge']({},_0x18a22b,_0x3fe2fa['options']);return _0x44a6c1[_0x4ad9('0x45')](_0x18a22b);}})[_0x4ad9('0x1e')](function(_0x196966){if(_0x196966){_0x56344b=_0x196966[_0x4ad9('0x3e')];if(!_0x3fe2fa[_0x4ad9('0x2a')][_0x4ad9('0x30')](_0x4ad9('0x31'))){_0x18a22b[_0x4ad9('0x18')]=qs[_0x4ad9('0x18')](_0x3fe2fa[_0x4ad9('0x2a')][_0x4ad9('0x18')]);_0x18a22b[_0x4ad9('0x17')]=qs[_0x4ad9('0x17')](_0x3fe2fa['query'][_0x4ad9('0x17')]);}return _0x44a6c1[_0x4ad9('0x45')](_0x18a22b);}})[_0x4ad9('0x1e')](function(_0x4ed8cb){if(_0x4ed8cb){return _0x4ed8cb?{'count':_0x56344b,'rows':_0x4ed8cb}:null;}})[_0x4ad9('0x1e')](respondWithResult(_0x288b67,null))['catch'](handleError(_0x288b67,null));};exports[_0x4ad9('0x48')]=function(_0x10cfa0,_0x2e6f14,_0x443f56){var _0x5c935d={};var _0x41af4b={};var _0xa17ab4;var _0x258636;return db[_0x4ad9('0x39')][_0x4ad9('0x46')]({'where':{'id':_0x10cfa0[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x2e6f14,null))[_0x4ad9('0x1e')](function(_0x494414){if(_0x494414){_0xa17ab4=_0x494414;_0x41af4b[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db[_0x4ad9('0x49')]['rawAttributes']);_0x41af4b['query']=_[_0x4ad9('0x2b')](_0x10cfa0[_0x4ad9('0x2a')]);_0x41af4b[_0x4ad9('0x2c')]=_[_0x4ad9('0x2e')](_0x41af4b['model'],_0x41af4b[_0x4ad9('0x2a')]);_0x5c935d[_0x4ad9('0x2d')]=_['intersection'](_0x41af4b[_0x4ad9('0x28')],qs[_0x4ad9('0x2f')](_0x10cfa0[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x5c935d['attributes']=_0x5c935d['attributes'][_0x4ad9('0x3e')]?_0x5c935d[_0x4ad9('0x2d')]:_0x41af4b[_0x4ad9('0x28')];_0x5c935d['order']=qs[_0x4ad9('0x32')](_0x10cfa0[_0x4ad9('0x2a')][_0x4ad9('0x32')]);_0x5c935d[_0x4ad9('0x33')]=qs['filters'](_[_0x4ad9('0x34')](_0x10cfa0[_0x4ad9('0x2a')],_0x41af4b['filters']));if(_0x10cfa0[_0x4ad9('0x2a')][_0x4ad9('0x36')]){_0x5c935d[_0x4ad9('0x33')]=_['merge'](_0x5c935d[_0x4ad9('0x33')],{'$or':_[_0x4ad9('0x29')](_0x5c935d['attributes'],function(_0x803309){var _0x24762a={};_0x24762a[_0x803309]={'$like':'%'+_0x10cfa0['query'][_0x4ad9('0x36')]+'%'};return _0x24762a;})});}_0x5c935d=_['merge']({},_0x5c935d,_0x10cfa0[_0x4ad9('0x3f')]);return _0xa17ab4[_0x4ad9('0x48')](_0x5c935d);}})[_0x4ad9('0x1e')](function(_0xa1c71c){if(_0xa1c71c){_0x258636=_0xa1c71c[_0x4ad9('0x3e')];if(!_0x10cfa0['query'][_0x4ad9('0x30')]('nolimit')){_0x5c935d[_0x4ad9('0x18')]=qs['limit'](_0x10cfa0[_0x4ad9('0x2a')][_0x4ad9('0x18')]);_0x5c935d[_0x4ad9('0x17')]=qs['offset'](_0x10cfa0['query'][_0x4ad9('0x17')]);}return _0xa17ab4[_0x4ad9('0x48')](_0x5c935d);}})['then'](function(_0x3668e9){if(_0x3668e9){return _0x3668e9?{'count':_0x258636,'rows':_0x3668e9}:null;}})[_0x4ad9('0x1e')](respondWithResult(_0x2e6f14,null))[_0x4ad9('0x3b')](handleError(_0x2e6f14,null));};exports['getDescriptions']=function(_0x36f583,_0x2d005a,_0x21ec0e){var _0x42629f={};var _0x4330d7={};var _0x1c4a06;var _0x5502af;return db[_0x4ad9('0x39')][_0x4ad9('0x46')]({'where':{'id':_0x36f583[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x2d005a,null))[_0x4ad9('0x1e')](function(_0x1d6182){if(_0x1d6182){_0x1c4a06=_0x1d6182;_0x4330d7[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db[_0x4ad9('0x49')][_0x4ad9('0x24')]);_0x4330d7[_0x4ad9('0x2a')]=_['keys'](_0x36f583[_0x4ad9('0x2a')]);_0x4330d7[_0x4ad9('0x2c')]=_['intersection'](_0x4330d7[_0x4ad9('0x28')],_0x4330d7['query']);_0x42629f[_0x4ad9('0x2d')]=_['intersection'](_0x4330d7[_0x4ad9('0x28')],qs['fields'](_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x42629f[_0x4ad9('0x2d')]=_0x42629f[_0x4ad9('0x2d')][_0x4ad9('0x3e')]?_0x42629f[_0x4ad9('0x2d')]:_0x4330d7[_0x4ad9('0x28')];_0x42629f[_0x4ad9('0x47')]=qs[_0x4ad9('0x32')](_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x32')]);_0x42629f[_0x4ad9('0x33')]=qs[_0x4ad9('0x2c')](_[_0x4ad9('0x34')](_0x36f583[_0x4ad9('0x2a')],_0x4330d7[_0x4ad9('0x2c')]));if(_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x36')]){_0x42629f['where']=_['merge'](_0x42629f[_0x4ad9('0x33')],{'$or':_[_0x4ad9('0x29')](_0x42629f[_0x4ad9('0x2d')],function(_0xb102e7){var _0x22f4fc={};_0x22f4fc[_0xb102e7]={'$like':'%'+_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x36')]+'%'};return _0x22f4fc;})});}_0x42629f=_[_0x4ad9('0x35')]({},_0x42629f,_0x36f583[_0x4ad9('0x3f')]);return _0x1c4a06[_0x4ad9('0x4a')](_0x42629f);}})[_0x4ad9('0x1e')](function(_0x13d35d){if(_0x13d35d){_0x5502af=_0x13d35d[_0x4ad9('0x3e')];if(!_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x30')]('nolimit')){_0x42629f[_0x4ad9('0x18')]=qs[_0x4ad9('0x18')](_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x18')]);_0x42629f[_0x4ad9('0x17')]=qs[_0x4ad9('0x17')](_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x17')]);}return _0x1c4a06[_0x4ad9('0x4a')](_0x42629f);}})['then'](function(_0x33c6c6){if(_0x33c6c6){return _0x33c6c6?{'count':_0x5502af,'rows':_0x33c6c6}:null;}})['then'](respondWithResult(_0x2d005a,null))[_0x4ad9('0x3b')](handleError(_0x2d005a,null));};exports['getTags']=function(_0x155718,_0x9d760d,_0xae54d6){var _0x522bb1={};var _0x59640d={};var _0x1bcd6f;var _0x7ef880;return db[_0x4ad9('0x39')][_0x4ad9('0x46')]({'where':{'id':_0x155718[_0x4ad9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x9d760d,null))[_0x4ad9('0x1e')](function(_0x3693b6){if(_0x3693b6){_0x1bcd6f=_0x3693b6;_0x59640d[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db[_0x4ad9('0x4b')]['rawAttributes']);_0x59640d[_0x4ad9('0x2a')]=_[_0x4ad9('0x2b')](_0x155718[_0x4ad9('0x2a')]);_0x59640d[_0x4ad9('0x2c')]=_['intersection'](_0x59640d['model'],_0x59640d[_0x4ad9('0x2a')]);_0x522bb1[_0x4ad9('0x2d')]=_['intersection'](_0x59640d[_0x4ad9('0x28')],qs['fields'](_0x155718[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x522bb1[_0x4ad9('0x2d')]=_0x522bb1[_0x4ad9('0x2d')][_0x4ad9('0x3e')]?_0x522bb1[_0x4ad9('0x2d')]:_0x59640d[_0x4ad9('0x28')];_0x522bb1['order']=qs['sort'](_0x155718[_0x4ad9('0x2a')]['sort']);_0x522bb1['where']=qs[_0x4ad9('0x2c')](_[_0x4ad9('0x34')](_0x155718[_0x4ad9('0x2a')],_0x59640d[_0x4ad9('0x2c')]));if(_0x155718[_0x4ad9('0x2a')][_0x4ad9('0x36')]){_0x522bb1[_0x4ad9('0x33')]=_[_0x4ad9('0x35')](_0x522bb1[_0x4ad9('0x33')],{'$or':_['map'](_0x522bb1[_0x4ad9('0x2d')],function(_0x43c5c2){var _0x30b807={};_0x30b807[_0x43c5c2]={'$like':'%'+_0x155718[_0x4ad9('0x2a')]['filter']+'%'};return _0x30b807;})});}_0x522bb1=_['merge']({},_0x522bb1,_0x155718[_0x4ad9('0x3f')]);return _0x1bcd6f[_0x4ad9('0x4c')](_0x522bb1);}})[_0x4ad9('0x1e')](function(_0xb423c4){if(_0xb423c4){_0x7ef880=_0xb423c4['length'];if(!_0x155718['query'][_0x4ad9('0x30')](_0x4ad9('0x31'))){_0x522bb1[_0x4ad9('0x18')]=qs[_0x4ad9('0x18')](_0x155718[_0x4ad9('0x2a')][_0x4ad9('0x18')]);_0x522bb1['offset']=qs[_0x4ad9('0x17')](_0x155718[_0x4ad9('0x2a')][_0x4ad9('0x17')]);}return _0x1bcd6f[_0x4ad9('0x4c')](_0x522bb1);}})['then'](function(_0x1143e8){if(_0x1143e8){return _0x1143e8?{'count':_0x7ef880,'rows':_0x1143e8}:null;}})[_0x4ad9('0x1e')](respondWithResult(_0x9d760d,null))[_0x4ad9('0x3b')](handleError(_0x9d760d,null));};exports['setTags']=function(_0x1e6fe7,_0x2459bc,_0x204f8c){if(_0x1e6fe7[_0x4ad9('0x43')]['id']){delete _0x1e6fe7[_0x4ad9('0x43')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1e6fe7[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x2459bc,null))['then'](function(_0x3f3a6a){if(_0x3f3a6a){return _0x3f3a6a[_0x4ad9('0x4d')](_0x1e6fe7[_0x4ad9('0x43')][_0x4ad9('0x4e')]||[]);}return null;})[_0x4ad9('0x1e')](respondWithResult(_0x2459bc,null))[_0x4ad9('0x3b')](handleError(_0x2459bc,null));}; \ No newline at end of file +var _0x57f3=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','getFields','ZendeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x20e88e,_0x204982){var _0x88f10e=function(_0x5d6f66){while(--_0x5d6f66){_0x20e88e['push'](_0x20e88e['shift']());}};_0x88f10e(++_0x204982);}(_0x57f3,0x1e7));var _0x357f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x57f3[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x357f('0x0'));var rimraf=require(_0x357f('0x1'));var zipdir=require(_0x357f('0x2'));var jsonpatch=require(_0x357f('0x3'));var rp=require(_0x357f('0x4'));var moment=require(_0x357f('0x5'));var BPromise=require(_0x357f('0x6'));var Mustache=require(_0x357f('0x7'));var util=require('util');var path=require(_0x357f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x357f('0x9'));var fs=require('fs');var fs_extra=require(_0x357f('0xa'));var _=require(_0x357f('0xb'));var squel=require(_0x357f('0xc'));var crypto=require(_0x357f('0xd'));var jsforce=require(_0x357f('0xe'));var deskjs=require(_0x357f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x357f('0x10'));var Redis=require('ioredis');var authService=require(_0x357f('0x11'));var qs=require(_0x357f('0x12'));var as=require(_0x357f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x357f('0x14'));var utils=require('../../config/utils');var config=require(_0x357f('0x15'));var licenseUtil=require(_0x357f('0x16'));var db=require(_0x357f('0x17'))['db'];function respondWithStatusCode(_0x2e08c7,_0x355876){_0x355876=_0x355876||0xcc;return function(_0x5ab97b){if(_0x5ab97b){return _0x2e08c7['sendStatus'](_0x355876);}return _0x2e08c7[_0x357f('0x18')](_0x355876)[_0x357f('0x19')]();};}function respondWithResult(_0x381ea9,_0x615b8a){_0x615b8a=_0x615b8a||0xc8;return function(_0x2fa3fc){if(_0x2fa3fc){return _0x381ea9[_0x357f('0x18')](_0x615b8a)['json'](_0x2fa3fc);}};}function respondWithFilteredResult(_0x42d489,_0x3e6f68){return function(_0x30053a){if(_0x30053a){var _0x405530=typeof _0x3e6f68[_0x357f('0x1a')]===_0x357f('0x1b')&&typeof _0x3e6f68[_0x357f('0x1c')]===_0x357f('0x1b');var _0x1a99b4=_0x30053a['count'];var _0x205564=_0x405530?0x0:_0x3e6f68[_0x357f('0x1a')];var _0x38c10d=_0x405530?_0x30053a[_0x357f('0x1d')]:_0x3e6f68[_0x357f('0x1a')]+_0x3e6f68[_0x357f('0x1c')];var _0xc0897c;if(_0x38c10d>=_0x1a99b4){_0x38c10d=_0x1a99b4;_0xc0897c=0xc8;}else{_0xc0897c=0xce;}_0x42d489[_0x357f('0x18')](_0xc0897c);return _0x42d489[_0x357f('0x1e')]('Content-Range',_0x205564+'-'+_0x38c10d+'/'+_0x1a99b4)[_0x357f('0x1f')](_0x30053a);}return null;};}function patchUpdates(_0x4dc275){return function(_0x26d349){try{jsonpatch[_0x357f('0x20')](_0x26d349,_0x4dc275,!![]);}catch(_0x600e55){return BPromise[_0x357f('0x21')](_0x600e55);}return _0x26d349['save']();};}function saveUpdates(_0x2ef4a3,_0x5d63ed){return function(_0x597cff){if(_0x597cff){return _0x597cff[_0x357f('0x22')](_0x2ef4a3)['then'](function(_0x10d557){return _0x10d557;});}return null;};}function removeEntity(_0x5af17e,_0x355f42){return function(_0x2a8a7b){if(_0x2a8a7b){return _0x2a8a7b[_0x357f('0x23')]()[_0x357f('0x24')](function(){_0x5af17e[_0x357f('0x18')](0xcc)[_0x357f('0x19')]();});}};}function handleEntityNotFound(_0x3d90b4,_0x2e28ec){return function(_0x5bd1d1){if(!_0x5bd1d1){_0x3d90b4[_0x357f('0x25')](0x194);}return _0x5bd1d1;};}function handleError(_0x292450,_0x39ec3c){_0x39ec3c=_0x39ec3c||0x1f4;return function(_0x64da05){logger[_0x357f('0x26')](_0x64da05[_0x357f('0x27')]);if(_0x64da05[_0x357f('0x28')]){delete _0x64da05[_0x357f('0x28')];}_0x292450[_0x357f('0x18')](_0x39ec3c)[_0x357f('0x29')](_0x64da05);};}exports[_0x357f('0x2a')]=function(_0x141152,_0xf93501){var _0x2c86b4={},_0x28f666={},_0x9e01d={'count':0x0,'rows':[]};var _0x426c61=_[_0x357f('0x2b')](db[_0x357f('0x2c')]['rawAttributes'],function(_0x103019){return{'name':_0x103019['fieldName'],'type':_0x103019[_0x357f('0x2d')][_0x357f('0x2e')]};});_0x28f666[_0x357f('0x2f')]=_['map'](_0x426c61,_0x357f('0x28'));_0x28f666[_0x357f('0x30')]=_[_0x357f('0x31')](_0x141152[_0x357f('0x30')]);_0x28f666[_0x357f('0x32')]=_[_0x357f('0x33')](_0x28f666[_0x357f('0x2f')],_0x28f666[_0x357f('0x30')]);_0x2c86b4[_0x357f('0x34')]=_[_0x357f('0x33')](_0x28f666[_0x357f('0x2f')],qs[_0x357f('0x35')](_0x141152[_0x357f('0x30')][_0x357f('0x35')]));_0x2c86b4[_0x357f('0x34')]=_0x2c86b4[_0x357f('0x34')][_0x357f('0x36')]?_0x2c86b4[_0x357f('0x34')]:_0x28f666[_0x357f('0x2f')];if(!_0x141152[_0x357f('0x30')]['hasOwnProperty'](_0x357f('0x37'))){_0x2c86b4['limit']=qs['limit'](_0x141152[_0x357f('0x30')]['limit']);_0x2c86b4[_0x357f('0x1a')]=qs['offset'](_0x141152[_0x357f('0x30')][_0x357f('0x1a')]);}_0x2c86b4[_0x357f('0x38')]=qs[_0x357f('0x39')](_0x141152['query'][_0x357f('0x39')]);_0x2c86b4[_0x357f('0x3a')]=qs[_0x357f('0x32')](_[_0x357f('0x3b')](_0x141152[_0x357f('0x30')],_0x28f666['filters']),_0x426c61);if(_0x141152[_0x357f('0x30')][_0x357f('0x3c')]){_0x2c86b4[_0x357f('0x3a')]=_[_0x357f('0x3d')](_0x2c86b4[_0x357f('0x3a')],{'$or':_[_0x357f('0x2b')](_0x426c61,function(_0xecf4a4){if(_0xecf4a4[_0x357f('0x2d')]!==_0x357f('0x3e')){var _0x2536a9={};_0x2536a9[_0xecf4a4[_0x357f('0x28')]]={'$like':'%'+_0x141152[_0x357f('0x30')][_0x357f('0x3c')]+'%'};return _0x2536a9;}})});}_0x2c86b4=_[_0x357f('0x3d')]({},_0x2c86b4,_0x141152[_0x357f('0x3f')]);var _0x472b44={'where':_0x2c86b4['where']};return db['ZendeskConfiguration'][_0x357f('0x1d')](_0x472b44)[_0x357f('0x24')](function(_0x51366b){_0x9e01d[_0x357f('0x1d')]=_0x51366b;if(_0x141152[_0x357f('0x30')][_0x357f('0x40')]){_0x2c86b4[_0x357f('0x41')]=[{'all':!![]}];}return db[_0x357f('0x2c')][_0x357f('0x42')](_0x2c86b4);})[_0x357f('0x24')](function(_0x3e4668){_0x9e01d[_0x357f('0x43')]=_0x3e4668;return _0x9e01d;})[_0x357f('0x24')](respondWithFilteredResult(_0xf93501,_0x2c86b4))[_0x357f('0x44')](handleError(_0xf93501,null));};exports[_0x357f('0x45')]=function(_0x514382,_0x2e9573){var _0xa7d318={'raw':![],'where':{'id':_0x514382['params']['id']}},_0xfb449c={};_0xfb449c['model']=_['keys'](db['ZendeskConfiguration'][_0x357f('0x46')]);_0xfb449c[_0x357f('0x30')]=_[_0x357f('0x31')](_0x514382[_0x357f('0x30')]);_0xfb449c['filters']=_[_0x357f('0x33')](_0xfb449c[_0x357f('0x2f')],_0xfb449c[_0x357f('0x30')]);_0xa7d318[_0x357f('0x34')]=_[_0x357f('0x33')](_0xfb449c[_0x357f('0x2f')],qs['fields'](_0x514382[_0x357f('0x30')]['fields']));_0xa7d318[_0x357f('0x34')]=_0xa7d318['attributes']['length']?_0xa7d318[_0x357f('0x34')]:_0xfb449c[_0x357f('0x2f')];if(_0x514382[_0x357f('0x30')][_0x357f('0x40')]){_0xa7d318['include']=[{'all':!![]}];}_0xa7d318=_[_0x357f('0x3d')]({},_0xa7d318,_0x514382[_0x357f('0x3f')]);return db[_0x357f('0x2c')][_0x357f('0x47')](_0xa7d318)['then'](handleEntityNotFound(_0x2e9573,null))[_0x357f('0x24')](respondWithResult(_0x2e9573,null))[_0x357f('0x44')](handleError(_0x2e9573,null));};exports[_0x357f('0x48')]=function(_0x4828d2,_0x5df238){return db[_0x357f('0x2c')][_0x357f('0x48')](_0x4828d2[_0x357f('0x49')],{})[_0x357f('0x24')](respondWithResult(_0x5df238,0xc9))[_0x357f('0x44')](handleError(_0x5df238,null));};exports['update']=function(_0x4f1768,_0x3ea86d){if(_0x4f1768[_0x357f('0x49')]['id']){delete _0x4f1768[_0x357f('0x49')]['id'];}return db[_0x357f('0x2c')][_0x357f('0x47')]({'where':{'id':_0x4f1768[_0x357f('0x4a')]['id']}})[_0x357f('0x24')](handleEntityNotFound(_0x3ea86d,null))['then'](saveUpdates(_0x4f1768[_0x357f('0x49')],null))[_0x357f('0x24')](respondWithResult(_0x3ea86d,null))[_0x357f('0x44')](handleError(_0x3ea86d,null));};exports[_0x357f('0x23')]=function(_0x134af0,_0x2cfe90){return db[_0x357f('0x2c')][_0x357f('0x47')]({'where':{'id':_0x134af0[_0x357f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2cfe90,null))[_0x357f('0x24')](removeEntity(_0x2cfe90,null))[_0x357f('0x44')](handleError(_0x2cfe90,null));};exports[_0x357f('0x4b')]=function(_0x385880,_0x39dce1,_0x1ef4ef){var _0x29b99b={};var _0x3f3ce2={};var _0x3f3ece;var _0x30db56;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x385880['params']['id']}})['then'](handleEntityNotFound(_0x39dce1,null))[_0x357f('0x24')](function(_0x1d9baf){if(_0x1d9baf){_0x3f3ece=_0x1d9baf;_0x3f3ce2['model']=_[_0x357f('0x31')](db[_0x357f('0x4c')][_0x357f('0x46')]);_0x3f3ce2[_0x357f('0x30')]=_[_0x357f('0x31')](_0x385880[_0x357f('0x30')]);_0x3f3ce2['filters']=_[_0x357f('0x33')](_0x3f3ce2['model'],_0x3f3ce2['query']);_0x29b99b[_0x357f('0x34')]=_[_0x357f('0x33')](_0x3f3ce2[_0x357f('0x2f')],qs[_0x357f('0x35')](_0x385880['query'][_0x357f('0x35')]));_0x29b99b['attributes']=_0x29b99b[_0x357f('0x34')][_0x357f('0x36')]?_0x29b99b['attributes']:_0x3f3ce2[_0x357f('0x2f')];_0x29b99b['order']=qs[_0x357f('0x39')](_0x385880[_0x357f('0x30')][_0x357f('0x39')]);_0x29b99b['where']=qs[_0x357f('0x32')](_[_0x357f('0x3b')](_0x385880[_0x357f('0x30')],_0x3f3ce2[_0x357f('0x32')]));if(_0x385880[_0x357f('0x30')]['filter']){_0x29b99b[_0x357f('0x3a')]=_[_0x357f('0x3d')](_0x29b99b[_0x357f('0x3a')],{'$or':_['map'](_0x29b99b[_0x357f('0x34')],function(_0x33f3d9){var _0x28db88={};_0x28db88[_0x33f3d9]={'$like':'%'+_0x385880[_0x357f('0x30')][_0x357f('0x3c')]+'%'};return _0x28db88;})});}_0x29b99b=_['merge']({},_0x29b99b,_0x385880['options']);return _0x3f3ece['getFields'](_0x29b99b);}})[_0x357f('0x24')](function(_0x489951){if(_0x489951){_0x30db56=_0x489951['length'];if(!_0x385880[_0x357f('0x30')][_0x357f('0x4d')](_0x357f('0x37'))){_0x29b99b[_0x357f('0x1c')]=qs[_0x357f('0x1c')](_0x385880[_0x357f('0x30')][_0x357f('0x1c')]);_0x29b99b[_0x357f('0x1a')]=qs[_0x357f('0x1a')](_0x385880['query'][_0x357f('0x1a')]);}return _0x3f3ece[_0x357f('0x4b')](_0x29b99b);}})[_0x357f('0x24')](function(_0x29a0a7){if(_0x29a0a7){return _0x29a0a7?{'count':_0x30db56,'rows':_0x29a0a7}:null;}})[_0x357f('0x24')](respondWithResult(_0x39dce1,null))[_0x357f('0x44')](handleError(_0x39dce1,null));};exports[_0x357f('0x4e')]=function(_0xa9ec7e,_0x44a36f,_0x5a931e){var _0x380936={};var _0x57aefc={};var _0x485235;var _0x5c719a;return db[_0x357f('0x2c')][_0x357f('0x4f')]({'where':{'id':_0xa9ec7e[_0x357f('0x4a')]['id']}})[_0x357f('0x24')](handleEntityNotFound(_0x44a36f,null))[_0x357f('0x24')](function(_0x20a188){if(_0x20a188){_0x485235=_0x20a188;_0x57aefc[_0x357f('0x2f')]=_['keys'](db[_0x357f('0x4c')]['rawAttributes']);_0x57aefc[_0x357f('0x30')]=_['keys'](_0xa9ec7e[_0x357f('0x30')]);_0x57aefc[_0x357f('0x32')]=_[_0x357f('0x33')](_0x57aefc[_0x357f('0x2f')],_0x57aefc[_0x357f('0x30')]);_0x380936[_0x357f('0x34')]=_[_0x357f('0x33')](_0x57aefc[_0x357f('0x2f')],qs[_0x357f('0x35')](_0xa9ec7e['query'][_0x357f('0x35')]));_0x380936[_0x357f('0x34')]=_0x380936[_0x357f('0x34')][_0x357f('0x36')]?_0x380936[_0x357f('0x34')]:_0x57aefc['model'];_0x380936[_0x357f('0x38')]=qs['sort'](_0xa9ec7e[_0x357f('0x30')][_0x357f('0x39')]);_0x380936[_0x357f('0x3a')]=qs[_0x357f('0x32')](_[_0x357f('0x3b')](_0xa9ec7e[_0x357f('0x30')],_0x57aefc['filters']));if(_0xa9ec7e[_0x357f('0x30')]['filter']){_0x380936[_0x357f('0x3a')]=_['merge'](_0x380936['where'],{'$or':_[_0x357f('0x2b')](_0x380936[_0x357f('0x34')],function(_0x2424c2){var _0x3a7e52={};_0x3a7e52[_0x2424c2]={'$like':'%'+_0xa9ec7e['query'][_0x357f('0x3c')]+'%'};return _0x3a7e52;})});}_0x380936=_['merge']({},_0x380936,_0xa9ec7e[_0x357f('0x3f')]);return _0x485235[_0x357f('0x4e')](_0x380936);}})['then'](function(_0x249fbd){if(_0x249fbd){_0x5c719a=_0x249fbd[_0x357f('0x36')];if(!_0xa9ec7e[_0x357f('0x30')][_0x357f('0x4d')](_0x357f('0x37'))){_0x380936[_0x357f('0x1c')]=qs['limit'](_0xa9ec7e['query'][_0x357f('0x1c')]);_0x380936[_0x357f('0x1a')]=qs[_0x357f('0x1a')](_0xa9ec7e['query'][_0x357f('0x1a')]);}return _0x485235['getSubjects'](_0x380936);}})[_0x357f('0x24')](function(_0x2e0ed0){if(_0x2e0ed0){return _0x2e0ed0?{'count':_0x5c719a,'rows':_0x2e0ed0}:null;}})[_0x357f('0x24')](respondWithResult(_0x44a36f,null))[_0x357f('0x44')](handleError(_0x44a36f,null));};exports[_0x357f('0x50')]=function(_0x3d53d0,_0x564002,_0x102a73){var _0x455f36={};var _0x912d1e={};var _0x34a964;var _0x3d5f62;return db[_0x357f('0x2c')][_0x357f('0x4f')]({'where':{'id':_0x3d53d0[_0x357f('0x4a')]['id']}})[_0x357f('0x24')](handleEntityNotFound(_0x564002,null))['then'](function(_0x5e0396){if(_0x5e0396){_0x34a964=_0x5e0396;_0x912d1e['model']=_['keys'](db[_0x357f('0x4c')][_0x357f('0x46')]);_0x912d1e[_0x357f('0x30')]=_[_0x357f('0x31')](_0x3d53d0[_0x357f('0x30')]);_0x912d1e[_0x357f('0x32')]=_[_0x357f('0x33')](_0x912d1e['model'],_0x912d1e[_0x357f('0x30')]);_0x455f36[_0x357f('0x34')]=_['intersection'](_0x912d1e[_0x357f('0x2f')],qs[_0x357f('0x35')](_0x3d53d0[_0x357f('0x30')][_0x357f('0x35')]));_0x455f36[_0x357f('0x34')]=_0x455f36[_0x357f('0x34')][_0x357f('0x36')]?_0x455f36['attributes']:_0x912d1e[_0x357f('0x2f')];_0x455f36['order']=qs[_0x357f('0x39')](_0x3d53d0[_0x357f('0x30')][_0x357f('0x39')]);_0x455f36['where']=qs[_0x357f('0x32')](_[_0x357f('0x3b')](_0x3d53d0[_0x357f('0x30')],_0x912d1e['filters']));if(_0x3d53d0[_0x357f('0x30')]['filter']){_0x455f36[_0x357f('0x3a')]=_[_0x357f('0x3d')](_0x455f36['where'],{'$or':_[_0x357f('0x2b')](_0x455f36[_0x357f('0x34')],function(_0x3c3dbf){var _0x460169={};_0x460169[_0x3c3dbf]={'$like':'%'+_0x3d53d0[_0x357f('0x30')][_0x357f('0x3c')]+'%'};return _0x460169;})});}_0x455f36=_['merge']({},_0x455f36,_0x3d53d0[_0x357f('0x3f')]);return _0x34a964[_0x357f('0x50')](_0x455f36);}})[_0x357f('0x24')](function(_0x3999ab){if(_0x3999ab){_0x3d5f62=_0x3999ab['length'];if(!_0x3d53d0[_0x357f('0x30')][_0x357f('0x4d')](_0x357f('0x37'))){_0x455f36[_0x357f('0x1c')]=qs[_0x357f('0x1c')](_0x3d53d0[_0x357f('0x30')]['limit']);_0x455f36['offset']=qs[_0x357f('0x1a')](_0x3d53d0[_0x357f('0x30')][_0x357f('0x1a')]);}return _0x34a964[_0x357f('0x50')](_0x455f36);}})[_0x357f('0x24')](function(_0x23fc24){if(_0x23fc24){return _0x23fc24?{'count':_0x3d5f62,'rows':_0x23fc24}:null;}})[_0x357f('0x24')](respondWithResult(_0x564002,null))[_0x357f('0x44')](handleError(_0x564002,null));};exports[_0x357f('0x51')]=function(_0x4f7600,_0x1d5a62,_0x1922ff){var _0x246302={};var _0x36e76d={};var _0x5c51e0;var _0x1a8c98;return db[_0x357f('0x2c')][_0x357f('0x4f')]({'where':{'id':_0x4f7600[_0x357f('0x4a')]['id']}})[_0x357f('0x24')](handleEntityNotFound(_0x1d5a62,null))['then'](function(_0x233bb9){if(_0x233bb9){_0x5c51e0=_0x233bb9;_0x36e76d[_0x357f('0x2f')]=_[_0x357f('0x31')](db['Tag'][_0x357f('0x46')]);_0x36e76d[_0x357f('0x30')]=_[_0x357f('0x31')](_0x4f7600[_0x357f('0x30')]);_0x36e76d['filters']=_[_0x357f('0x33')](_0x36e76d[_0x357f('0x2f')],_0x36e76d[_0x357f('0x30')]);_0x246302[_0x357f('0x34')]=_[_0x357f('0x33')](_0x36e76d[_0x357f('0x2f')],qs[_0x357f('0x35')](_0x4f7600[_0x357f('0x30')]['fields']));_0x246302[_0x357f('0x34')]=_0x246302[_0x357f('0x34')][_0x357f('0x36')]?_0x246302[_0x357f('0x34')]:_0x36e76d['model'];_0x246302[_0x357f('0x38')]=qs[_0x357f('0x39')](_0x4f7600[_0x357f('0x30')][_0x357f('0x39')]);_0x246302['where']=qs[_0x357f('0x32')](_[_0x357f('0x3b')](_0x4f7600[_0x357f('0x30')],_0x36e76d[_0x357f('0x32')]));if(_0x4f7600[_0x357f('0x30')][_0x357f('0x3c')]){_0x246302[_0x357f('0x3a')]=_['merge'](_0x246302[_0x357f('0x3a')],{'$or':_[_0x357f('0x2b')](_0x246302['attributes'],function(_0x5d3b59){var _0x30643b={};_0x30643b[_0x5d3b59]={'$like':'%'+_0x4f7600['query'][_0x357f('0x3c')]+'%'};return _0x30643b;})});}_0x246302=_[_0x357f('0x3d')]({},_0x246302,_0x4f7600[_0x357f('0x3f')]);return _0x5c51e0[_0x357f('0x51')](_0x246302);}})['then'](function(_0xe1670b){if(_0xe1670b){_0x1a8c98=_0xe1670b[_0x357f('0x36')];if(!_0x4f7600['query']['hasOwnProperty'](_0x357f('0x37'))){_0x246302['limit']=qs[_0x357f('0x1c')](_0x4f7600['query']['limit']);_0x246302['offset']=qs[_0x357f('0x1a')](_0x4f7600[_0x357f('0x30')][_0x357f('0x1a')]);}return _0x5c51e0[_0x357f('0x51')](_0x246302);}})[_0x357f('0x24')](function(_0x6da285){if(_0x6da285){return _0x6da285?{'count':_0x1a8c98,'rows':_0x6da285}:null;}})['then'](respondWithResult(_0x1d5a62,null))['catch'](handleError(_0x1d5a62,null));};exports[_0x357f('0x52')]=function(_0x20e2fe,_0x2c5a3e,_0xb650c8){if(_0x20e2fe[_0x357f('0x49')]['id']){delete _0x20e2fe['body']['id'];}return db[_0x357f('0x2c')]['findOne']({'where':{'id':_0x20e2fe[_0x357f('0x4a')]['id']}})[_0x357f('0x24')](handleEntityNotFound(_0x2c5a3e,null))[_0x357f('0x24')](function(_0x3dbc64){if(_0x3dbc64){return _0x3dbc64[_0x357f('0x52')](_0x20e2fe[_0x357f('0x49')][_0x357f('0x53')]||[]);}return null;})[_0x357f('0x24')](respondWithResult(_0x2c5a3e,null))[_0x357f('0x44')](handleError(_0x2c5a3e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a6630f2..6db04cc 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 _0x4e2e=['exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0xaabaa6,_0x4993c8){_0xaabaa6=_0xaabaa6-0x0;var _0x3a8e90=_0x4e2e[_0xaabaa6];return _0x3a8e90;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var logger=require(_0xe4e2('0x1'))(_0xe4e2('0x2'));var moment=require(_0xe4e2('0x3'));var BPromise=require(_0xe4e2('0x4'));var rp=require(_0xe4e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4e2('0x6'));var config=require(_0xe4e2('0x7'));var attributes=require(_0xe4e2('0x8'));module[_0xe4e2('0x9')]=function(_0x48e83d,_0x322295){return _0x48e83d[_0xe4e2('0xa')](_0xe4e2('0xb'),attributes,{'tableName':_0xe4e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe820=['exports','define','ZendeskConfiguration','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x512b4c,_0x1cd898){var _0x2e5535=function(_0x36cf83){while(--_0x36cf83){_0x512b4c['push'](_0x512b4c['shift']());}};_0x2e5535(++_0x1cd898);}(_0xe820,0xd2));var _0x0e82=function(_0x52ec18,_0x1153b3){_0x52ec18=_0x52ec18-0x0;var _0x47eb51=_0xe820[_0x52ec18];return _0x47eb51;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('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 5894af3..ebe8f9c 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 _0x8260=['then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x56e7b8,_0x37cd52){var _0x564c8e=function(_0x30a352){while(--_0x30a352){_0x56e7b8['push'](_0x56e7b8['shift']());}};_0x564c8e(++_0x37cd52);}(_0x8260,0x129));var _0x0826=function(_0x319855,_0x55a20d){_0x319855=_0x319855-0x0;var _0xfb7f50=_0x8260[_0x319855];return _0xfb7f50;};'use strict';var _=require(_0x0826('0x0'));var util=require(_0x0826('0x1'));var moment=require(_0x0826('0x2'));var BPromise=require(_0x0826('0x3'));var rs=require(_0x0826('0x4'));var fs=require('fs');var Redis=require(_0x0826('0x5'));var db=require(_0x0826('0x6'))['db'];var utils=require(_0x0826('0x7'));var logger=require(_0x0826('0x8'))(_0x0826('0x9'));var config=require(_0x0826('0xa'));var jayson=require(_0x0826('0xb'));var client=jayson[_0x0826('0xc')][_0x0826('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x55c6a4,_0x40b30c,_0x151f2e){return new BPromise(function(_0x3690bb,_0x1b4036){return client[_0x0826('0xe')](_0x55c6a4,_0x151f2e)[_0x0826('0xf')](function(_0x5c0d70){logger[_0x0826('0x10')](_0x0826('0x11'),_0x40b30c,'request\x20sent');logger[_0x0826('0x12')](_0x0826('0x13'),_0x40b30c,_0x0826('0x14'),JSON[_0x0826('0x15')](_0x5c0d70));if(_0x5c0d70['error']){if(_0x5c0d70[_0x0826('0x16')][_0x0826('0x17')]===0x1f4){logger[_0x0826('0x16')](_0x0826('0x11'),_0x40b30c,_0x5c0d70[_0x0826('0x16')]['message']);return _0x1b4036(_0x5c0d70['error'][_0x0826('0x18')]);}logger['error'](_0x0826('0x11'),_0x40b30c,_0x5c0d70[_0x0826('0x16')][_0x0826('0x18')]);return _0x3690bb(_0x5c0d70[_0x0826('0x16')]['message']);}else{logger['info'](_0x0826('0x11'),_0x40b30c,_0x0826('0x14'));_0x3690bb(_0x5c0d70['result']['message']);}})[_0x0826('0x19')](function(_0x2c458f){logger['error'](_0x0826('0x11'),_0x40b30c,_0x2c458f);_0x1b4036(_0x2c458f);});});} \ No newline at end of file +var _0xc575=['request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','client'];(function(_0x1b9e3f,_0x5ea90b){var _0x27b608=function(_0x3a6ad4){while(--_0x3a6ad4){_0x1b9e3f['push'](_0x1b9e3f['shift']());}};_0x27b608(++_0x5ea90b);}(_0xc575,0x13e));var _0x5c57=function(_0xa37892,_0x40cf01){_0xa37892=_0xa37892-0x0;var _0x45e007=_0xc575[_0xa37892];return _0x45e007;};'use strict';var _=require('lodash');var util=require(_0x5c57('0x0'));var moment=require(_0x5c57('0x1'));var BPromise=require(_0x5c57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c57('0x3'))['db'];var utils=require(_0x5c57('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5c57('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8e3610,_0x15515b,_0x3c920e){return new BPromise(function(_0x4c610a,_0x5b098f){return client[_0x5c57('0x6')](_0x8e3610,_0x3c920e)['then'](function(_0x189cbe){logger[_0x5c57('0x7')](_0x5c57('0x8'),_0x15515b,_0x5c57('0x9'));logger[_0x5c57('0xa')](_0x5c57('0xb'),_0x15515b,_0x5c57('0x9'),JSON[_0x5c57('0xc')](_0x189cbe));if(_0x189cbe[_0x5c57('0xd')]){if(_0x189cbe['error'][_0x5c57('0xe')]===0x1f4){logger[_0x5c57('0xd')](_0x5c57('0x8'),_0x15515b,_0x189cbe[_0x5c57('0xd')][_0x5c57('0xf')]);return _0x5b098f(_0x189cbe['error'][_0x5c57('0xf')]);}logger['error'](_0x5c57('0x8'),_0x15515b,_0x189cbe[_0x5c57('0xd')][_0x5c57('0xf')]);return _0x4c610a(_0x189cbe[_0x5c57('0xd')][_0x5c57('0xf')]);}else{logger[_0x5c57('0x7')](_0x5c57('0x8'),_0x15515b,_0x5c57('0x9'));_0x4c610a(_0x189cbe[_0x5c57('0x10')]['message']);}})[_0x5c57('0x11')](function(_0x51e48){logger[_0x5c57('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x15515b,_0x51e48);_0x5b098f(_0x51e48);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c2b08b2..5eb6980 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 _0x0102=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports'];(function(_0x3a2c0f,_0x5764f4){var _0x3f1d27=function(_0x5b0f6f){while(--_0x5b0f6f){_0x3a2c0f['push'](_0x3a2c0f['shift']());}};_0x3f1d27(++_0x5764f4);}(_0x0102,0xd1));var _0x2010=function(_0x36b874,_0x3486cc){_0x36b874=_0x36b874-0x0;var _0x150eea=_0x0102[_0x36b874];return _0x150eea;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require('path');var timeout=require(_0x2010('0x1'));var express=require(_0x2010('0x2'));var router=express[_0x2010('0x3')]();var fs_extra=require(_0x2010('0x4'));var auth=require(_0x2010('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2010('0x6'));var controller=require(_0x2010('0x7'));router[_0x2010('0x8')]('/',auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x8')](_0x2010('0xa'),auth[_0x2010('0xb')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2010('0xe')](_0x2010('0xa'),auth[_0x2010('0xb')](),controller[_0x2010('0xf')]);router[_0x2010('0x10')](_0x2010('0xa'),auth[_0x2010('0xb')](),controller[_0x2010('0x11')]);module[_0x2010('0x12')]=router; \ No newline at end of file +var _0x23db=['isAuthenticated','/:id','show','post','create','put','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0x23db,0xd4));var _0xb23d=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x23db[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0xb23d('0x0'));var util=require(_0xb23d('0x1'));var path=require(_0xb23d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb23d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb23d('0x4'));var interaction=require(_0xb23d('0x5'));var config=require(_0xb23d('0x6'));var controller=require(_0xb23d('0x7'));router[_0xb23d('0x8')]('/',auth[_0xb23d('0x9')](),controller['index']);router[_0xb23d('0x8')](_0xb23d('0xa'),auth[_0xb23d('0x9')](),controller[_0xb23d('0xb')]);router[_0xb23d('0xc')]('/',auth['isAuthenticated'](),controller[_0xb23d('0xd')]);router[_0xb23d('0xe')]('/:id',auth[_0xb23d('0x9')](),controller[_0xb23d('0xf')]);router[_0xb23d('0x10')](_0xb23d('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index aebadc5..8082666 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 _0xdbde=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x5b8df6,_0x3afca6){var _0x234e78=function(_0x25fc14){while(--_0x25fc14){_0x5b8df6['push'](_0x5b8df6['shift']());}};_0x234e78(++_0x3afca6);}(_0xdbde,0xc1));var _0xedbd=function(_0x339c6f,_0x1b76ed){_0x339c6f=_0x339c6f-0x0;var _0x6c356d=_0xdbde[_0x339c6f];return _0x6c356d;};'use strict';var Sequelize=require('sequelize');module[_0xedbd('0x0')]={'type':{'type':Sequelize[_0xedbd('0x1')](_0xedbd('0x2'),_0xedbd('0x3'),_0xedbd('0x4'),_0xedbd('0x5'),_0xedbd('0x6')),'defaultValue':_0xedbd('0x2')},'content':{'type':Sequelize[_0xedbd('0x7')]},'key':{'type':Sequelize[_0xedbd('0x7')]},'keyType':{'type':Sequelize[_0xedbd('0x1')](_0xedbd('0x2'),_0xedbd('0x3'),_0xedbd('0x4'))},'keyContent':{'type':Sequelize[_0xedbd('0x7')]},'idField':{'type':Sequelize[_0xedbd('0x7')]},'nameField':{'type':Sequelize[_0xedbd('0x7')]},'customField':{'type':Sequelize[_0xedbd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xedbd('0x7')]}}; \ No newline at end of file +var _0xa1bb=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports'];(function(_0x31bba5,_0x255cdc){var _0x528637=function(_0x3832ab){while(--_0x3832ab){_0x31bba5['push'](_0x31bba5['shift']());}};_0x528637(++_0x255cdc);}(_0xa1bb,0x167));var _0xba1b=function(_0x505226,_0x261cec){_0x505226=_0x505226-0x0;var _0x15b0ea=_0xa1bb[_0x505226];return _0x15b0ea;};'use strict';var Sequelize=require('sequelize');module[_0xba1b('0x0')]={'type':{'type':Sequelize[_0xba1b('0x1')]('string',_0xba1b('0x2'),_0xba1b('0x3'),_0xba1b('0x4'),_0xba1b('0x5')),'defaultValue':_0xba1b('0x6')},'content':{'type':Sequelize[_0xba1b('0x7')]},'key':{'type':Sequelize[_0xba1b('0x7')]},'keyType':{'type':Sequelize[_0xba1b('0x1')](_0xba1b('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xba1b('0x7')]},'idField':{'type':Sequelize[_0xba1b('0x7')]},'nameField':{'type':Sequelize[_0xba1b('0x7')]},'customField':{'type':Sequelize[_0xba1b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba1b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 7150e41..66fcca9 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 _0x1edd=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','params','catch','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x3f992b,_0x366452){var _0x592572=function(_0x50a215){while(--_0x50a215){_0x3f992b['push'](_0x3f992b['shift']());}};_0x592572(++_0x366452);}(_0x1edd,0xcd));var _0xd1ed=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x1edd[_0x46d0c9];return _0x174506;};'use strict';var emlformat=require(_0xd1ed('0x0'));var rimraf=require(_0xd1ed('0x1'));var zipdir=require(_0xd1ed('0x2'));var jsonpatch=require(_0xd1ed('0x3'));var rp=require(_0xd1ed('0x4'));var moment=require(_0xd1ed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd1ed('0x6'));var util=require(_0xd1ed('0x7'));var path=require('path');var sox=require(_0xd1ed('0x8'));var csv=require(_0xd1ed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1ed('0xa'));var squel=require(_0xd1ed('0xb'));var crypto=require(_0xd1ed('0xc'));var jsforce=require(_0xd1ed('0xd'));var deskjs=require(_0xd1ed('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd1ed('0xf'));var Papa=require(_0xd1ed('0x10'));var Redis=require(_0xd1ed('0x11'));var authService=require(_0xd1ed('0x12'));var qs=require(_0xd1ed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1ed('0x14'))('api');var utils=require(_0xd1ed('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd1ed('0x16'));var db=require(_0xd1ed('0x17'))['db'];function respondWithStatusCode(_0x5245d3,_0x830708){_0x830708=_0x830708||0xcc;return function(_0x1fcb38){if(_0x1fcb38){return _0x5245d3[_0xd1ed('0x18')](_0x830708);}return _0x5245d3[_0xd1ed('0x19')](_0x830708)[_0xd1ed('0x1a')]();};}function respondWithResult(_0x297a92,_0x58101c){_0x58101c=_0x58101c||0xc8;return function(_0x3303c7){if(_0x3303c7){return _0x297a92['status'](_0x58101c)[_0xd1ed('0x1b')](_0x3303c7);}};}function respondWithFilteredResult(_0x180d67,_0x474ba4){return function(_0x58f0b1){if(_0x58f0b1){var _0x2464f5=typeof _0x474ba4[_0xd1ed('0x1c')]==='undefined'&&typeof _0x474ba4[_0xd1ed('0x1d')]===_0xd1ed('0x1e');var _0x509cba=_0x58f0b1['count'];var _0x310d6a=_0x2464f5?0x0:_0x474ba4[_0xd1ed('0x1c')];var _0x13d7b9=_0x2464f5?_0x58f0b1[_0xd1ed('0x1f')]:_0x474ba4['offset']+_0x474ba4[_0xd1ed('0x1d')];var _0x445e57;if(_0x13d7b9>=_0x509cba){_0x13d7b9=_0x509cba;_0x445e57=0xc8;}else{_0x445e57=0xce;}_0x180d67[_0xd1ed('0x19')](_0x445e57);return _0x180d67[_0xd1ed('0x20')](_0xd1ed('0x21'),_0x310d6a+'-'+_0x13d7b9+'/'+_0x509cba)['json'](_0x58f0b1);}return null;};}function patchUpdates(_0x4b5a5e){return function(_0x643fed){try{jsonpatch[_0xd1ed('0x22')](_0x643fed,_0x4b5a5e,!![]);}catch(_0x321717){return BPromise['reject'](_0x321717);}return _0x643fed[_0xd1ed('0x23')]();};}function saveUpdates(_0x289010,_0x12e3ea){return function(_0x27161e){if(_0x27161e){return _0x27161e['update'](_0x289010)[_0xd1ed('0x24')](function(_0x1b5f5a){return _0x1b5f5a;});}return null;};}function removeEntity(_0x8981d2,_0x5d2f3e){return function(_0xc246d4){if(_0xc246d4){return _0xc246d4[_0xd1ed('0x25')]()[_0xd1ed('0x24')](function(){_0x8981d2[_0xd1ed('0x19')](0xcc)[_0xd1ed('0x1a')]();});}};}function handleEntityNotFound(_0xafe250,_0x249d34){return function(_0x1472a8){if(!_0x1472a8){_0xafe250['sendStatus'](0x194);}return _0x1472a8;};}function handleError(_0x157438,_0x3b9c18){_0x3b9c18=_0x3b9c18||0x1f4;return function(_0x4797cc){logger[_0xd1ed('0x26')](_0x4797cc[_0xd1ed('0x27')]);if(_0x4797cc[_0xd1ed('0x28')]){delete _0x4797cc[_0xd1ed('0x28')];}_0x157438[_0xd1ed('0x19')](_0x3b9c18)['send'](_0x4797cc);};}exports[_0xd1ed('0x29')]=function(_0x6c544d,_0x5d7574){var _0x4e0df4={},_0x2d701f={},_0x2f6dc1={'count':0x0,'rows':[]};var _0x4e7b75=_[_0xd1ed('0x2a')](db[_0xd1ed('0x2b')][_0xd1ed('0x2c')],function(_0x3bc06d){return{'name':_0x3bc06d[_0xd1ed('0x2d')],'type':_0x3bc06d[_0xd1ed('0x2e')][_0xd1ed('0x2f')]};});_0x2d701f[_0xd1ed('0x30')]=_[_0xd1ed('0x2a')](_0x4e7b75,'name');_0x2d701f[_0xd1ed('0x31')]=_[_0xd1ed('0x32')](_0x6c544d[_0xd1ed('0x31')]);_0x2d701f[_0xd1ed('0x33')]=_['intersection'](_0x2d701f[_0xd1ed('0x30')],_0x2d701f['query']);_0x4e0df4[_0xd1ed('0x34')]=_[_0xd1ed('0x35')](_0x2d701f['model'],qs[_0xd1ed('0x36')](_0x6c544d['query'][_0xd1ed('0x36')]));_0x4e0df4[_0xd1ed('0x34')]=_0x4e0df4['attributes'][_0xd1ed('0x37')]?_0x4e0df4[_0xd1ed('0x34')]:_0x2d701f[_0xd1ed('0x30')];if(!_0x6c544d[_0xd1ed('0x31')]['hasOwnProperty'](_0xd1ed('0x38'))){_0x4e0df4[_0xd1ed('0x1d')]=qs[_0xd1ed('0x1d')](_0x6c544d[_0xd1ed('0x31')]['limit']);_0x4e0df4[_0xd1ed('0x1c')]=qs['offset'](_0x6c544d['query'][_0xd1ed('0x1c')]);}_0x4e0df4[_0xd1ed('0x39')]=qs[_0xd1ed('0x3a')](_0x6c544d[_0xd1ed('0x31')][_0xd1ed('0x3a')]);_0x4e0df4[_0xd1ed('0x3b')]=qs['filters'](_['pick'](_0x6c544d['query'],_0x2d701f['filters']),_0x4e7b75);if(_0x6c544d[_0xd1ed('0x31')][_0xd1ed('0x3c')]){_0x4e0df4['where']=_[_0xd1ed('0x3d')](_0x4e0df4['where'],{'$or':_[_0xd1ed('0x2a')](_0x4e7b75,function(_0x6e3383){if(_0x6e3383[_0xd1ed('0x2e')]!==_0xd1ed('0x3e')){var _0x28f84a={};_0x28f84a[_0x6e3383[_0xd1ed('0x28')]]={'$like':'%'+_0x6c544d['query'][_0xd1ed('0x3c')]+'%'};return _0x28f84a;}})});}_0x4e0df4=_[_0xd1ed('0x3d')]({},_0x4e0df4,_0x6c544d['options']);var _0x54149a={'where':_0x4e0df4['where']};return db[_0xd1ed('0x2b')][_0xd1ed('0x1f')](_0x54149a)['then'](function(_0x573296){_0x2f6dc1[_0xd1ed('0x1f')]=_0x573296;if(_0x6c544d['query'][_0xd1ed('0x3f')]){_0x4e0df4[_0xd1ed('0x40')]=[{'all':!![]}];}return db[_0xd1ed('0x2b')][_0xd1ed('0x41')](_0x4e0df4);})[_0xd1ed('0x24')](function(_0x1b2bc1){_0x2f6dc1['rows']=_0x1b2bc1;return _0x2f6dc1;})[_0xd1ed('0x24')](respondWithFilteredResult(_0x5d7574,_0x4e0df4))['catch'](handleError(_0x5d7574,null));};exports['show']=function(_0x149999,_0x7c959d){var _0x3c4cf2={'raw':!![],'where':{'id':_0x149999[_0xd1ed('0x42')]['id']}},_0xb3e263={};_0xb3e263['model']=_[_0xd1ed('0x32')](db['ZendeskField'][_0xd1ed('0x2c')]);_0xb3e263[_0xd1ed('0x31')]=_[_0xd1ed('0x32')](_0x149999[_0xd1ed('0x31')]);_0xb3e263[_0xd1ed('0x33')]=_[_0xd1ed('0x35')](_0xb3e263[_0xd1ed('0x30')],_0xb3e263[_0xd1ed('0x31')]);_0x3c4cf2[_0xd1ed('0x34')]=_['intersection'](_0xb3e263[_0xd1ed('0x30')],qs[_0xd1ed('0x36')](_0x149999[_0xd1ed('0x31')][_0xd1ed('0x36')]));_0x3c4cf2[_0xd1ed('0x34')]=_0x3c4cf2[_0xd1ed('0x34')][_0xd1ed('0x37')]?_0x3c4cf2[_0xd1ed('0x34')]:_0xb3e263[_0xd1ed('0x30')];if(_0x149999['query'][_0xd1ed('0x3f')]){_0x3c4cf2[_0xd1ed('0x40')]=[{'all':!![]}];}_0x3c4cf2=_[_0xd1ed('0x3d')]({},_0x3c4cf2,_0x149999['options']);return db[_0xd1ed('0x2b')]['find'](_0x3c4cf2)['then'](handleEntityNotFound(_0x7c959d,null))[_0xd1ed('0x24')](respondWithResult(_0x7c959d,null))[_0xd1ed('0x43')](handleError(_0x7c959d,null));};exports['create']=function(_0x328068,_0x479076){return db[_0xd1ed('0x2b')]['create'](_0x328068['body'],{})[_0xd1ed('0x24')](respondWithResult(_0x479076,0xc9))[_0xd1ed('0x43')](handleError(_0x479076,null));};exports[_0xd1ed('0x44')]=function(_0xa2f036,_0xfdbc58){if(_0xa2f036['body']['id']){delete _0xa2f036[_0xd1ed('0x45')]['id'];}return db[_0xd1ed('0x2b')][_0xd1ed('0x46')]({'where':{'id':_0xa2f036[_0xd1ed('0x42')]['id']}})['then'](handleEntityNotFound(_0xfdbc58,null))['then'](saveUpdates(_0xa2f036['body'],null))[_0xd1ed('0x24')](respondWithResult(_0xfdbc58,null))[_0xd1ed('0x43')](handleError(_0xfdbc58,null));};exports[_0xd1ed('0x25')]=function(_0x1a85fa,_0x4378b8){return db[_0xd1ed('0x2b')][_0xd1ed('0x46')]({'where':{'id':_0x1a85fa[_0xd1ed('0x42')]['id']}})['then'](handleEntityNotFound(_0x4378b8,null))[_0xd1ed('0x24')](removeEntity(_0x4378b8,null))[_0xd1ed('0x43')](handleError(_0x4378b8,null));}; \ No newline at end of file +var _0x4ca3=['VIRTUAL','options','ZendeskField','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','name','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x323ae4,_0x198036){var _0x851110=function(_0x1669e0){while(--_0x1669e0){_0x323ae4['push'](_0x323ae4['shift']());}};_0x851110(++_0x198036);}(_0x4ca3,0x9f));var _0x34ca=function(_0x11b51f,_0x56a2b0){_0x11b51f=_0x11b51f-0x0;var _0x3c368c=_0x4ca3[_0x11b51f];return _0x3c368c;};'use strict';var emlformat=require(_0x34ca('0x0'));var rimraf=require(_0x34ca('0x1'));var zipdir=require(_0x34ca('0x2'));var jsonpatch=require(_0x34ca('0x3'));var rp=require(_0x34ca('0x4'));var moment=require(_0x34ca('0x5'));var BPromise=require(_0x34ca('0x6'));var Mustache=require('mustache');var util=require(_0x34ca('0x7'));var path=require('path');var sox=require(_0x34ca('0x8'));var csv=require('to-csv');var ejs=require(_0x34ca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34ca('0xa'));var squel=require('squel');var crypto=require(_0x34ca('0xb'));var jsforce=require(_0x34ca('0xc'));var deskjs=require(_0x34ca('0xd'));var toCsv=require(_0x34ca('0xe'));var querystring=require(_0x34ca('0xf'));var Papa=require(_0x34ca('0x10'));var Redis=require(_0x34ca('0x11'));var authService=require(_0x34ca('0x12'));var qs=require(_0x34ca('0x13'));var as=require(_0x34ca('0x14'));var hardwareService=require(_0x34ca('0x15'));var logger=require(_0x34ca('0x16'))(_0x34ca('0x17'));var utils=require('../../config/utils');var config=require(_0x34ca('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x34ca('0x19'))['db'];function respondWithStatusCode(_0xfb30b8,_0x1cab79){_0x1cab79=_0x1cab79||0xcc;return function(_0x35081a){if(_0x35081a){return _0xfb30b8[_0x34ca('0x1a')](_0x1cab79);}return _0xfb30b8['status'](_0x1cab79)[_0x34ca('0x1b')]();};}function respondWithResult(_0x434fd8,_0x3ac458){_0x3ac458=_0x3ac458||0xc8;return function(_0x612acd){if(_0x612acd){return _0x434fd8[_0x34ca('0x1c')](_0x3ac458)[_0x34ca('0x1d')](_0x612acd);}};}function respondWithFilteredResult(_0x173266,_0x5387a5){return function(_0x5e9dc2){if(_0x5e9dc2){var _0x527a1c=typeof _0x5387a5[_0x34ca('0x1e')]===_0x34ca('0x1f')&&typeof _0x5387a5[_0x34ca('0x20')]===_0x34ca('0x1f');var _0x4d94eb=_0x5e9dc2[_0x34ca('0x21')];var _0x3da5a0=_0x527a1c?0x0:_0x5387a5['offset'];var _0x3fba14=_0x527a1c?_0x5e9dc2[_0x34ca('0x21')]:_0x5387a5[_0x34ca('0x1e')]+_0x5387a5[_0x34ca('0x20')];var _0x218e24;if(_0x3fba14>=_0x4d94eb){_0x3fba14=_0x4d94eb;_0x218e24=0xc8;}else{_0x218e24=0xce;}_0x173266[_0x34ca('0x1c')](_0x218e24);return _0x173266[_0x34ca('0x22')](_0x34ca('0x23'),_0x3da5a0+'-'+_0x3fba14+'/'+_0x4d94eb)['json'](_0x5e9dc2);}return null;};}function patchUpdates(_0x4f9366){return function(_0x51294b){try{jsonpatch[_0x34ca('0x24')](_0x51294b,_0x4f9366,!![]);}catch(_0x50e991){return BPromise['reject'](_0x50e991);}return _0x51294b[_0x34ca('0x25')]();};}function saveUpdates(_0x5de054,_0x2a37a6){return function(_0x531001){if(_0x531001){return _0x531001[_0x34ca('0x26')](_0x5de054)[_0x34ca('0x27')](function(_0x5b1077){return _0x5b1077;});}return null;};}function removeEntity(_0x4f79e8,_0x200ab7){return function(_0x15c32e){if(_0x15c32e){return _0x15c32e[_0x34ca('0x28')]()[_0x34ca('0x27')](function(){_0x4f79e8[_0x34ca('0x1c')](0xcc)[_0x34ca('0x1b')]();});}};}function handleEntityNotFound(_0x3ddbdc,_0x405f0c){return function(_0x239983){if(!_0x239983){_0x3ddbdc[_0x34ca('0x1a')](0x194);}return _0x239983;};}function handleError(_0x89bc2f,_0x57474a){_0x57474a=_0x57474a||0x1f4;return function(_0x76d9f0){logger['error'](_0x76d9f0['stack']);if(_0x76d9f0[_0x34ca('0x29')]){delete _0x76d9f0[_0x34ca('0x29')];}_0x89bc2f[_0x34ca('0x1c')](_0x57474a)['send'](_0x76d9f0);};}exports['index']=function(_0x2c27cf,_0xdbe38d){var _0x152bd9={},_0x446748={},_0x45eef8={'count':0x0,'rows':[]};var _0x3bd449=_[_0x34ca('0x2a')](db['ZendeskField'][_0x34ca('0x2b')],function(_0x38eb45){return{'name':_0x38eb45[_0x34ca('0x2c')],'type':_0x38eb45[_0x34ca('0x2d')]['key']};});_0x446748[_0x34ca('0x2e')]=_['map'](_0x3bd449,'name');_0x446748[_0x34ca('0x2f')]=_['keys'](_0x2c27cf[_0x34ca('0x2f')]);_0x446748[_0x34ca('0x30')]=_['intersection'](_0x446748['model'],_0x446748[_0x34ca('0x2f')]);_0x152bd9[_0x34ca('0x31')]=_[_0x34ca('0x32')](_0x446748[_0x34ca('0x2e')],qs[_0x34ca('0x33')](_0x2c27cf['query'][_0x34ca('0x33')]));_0x152bd9[_0x34ca('0x31')]=_0x152bd9['attributes'][_0x34ca('0x34')]?_0x152bd9[_0x34ca('0x31')]:_0x446748[_0x34ca('0x2e')];if(!_0x2c27cf[_0x34ca('0x2f')][_0x34ca('0x35')](_0x34ca('0x36'))){_0x152bd9[_0x34ca('0x20')]=qs[_0x34ca('0x20')](_0x2c27cf[_0x34ca('0x2f')][_0x34ca('0x20')]);_0x152bd9['offset']=qs[_0x34ca('0x1e')](_0x2c27cf[_0x34ca('0x2f')][_0x34ca('0x1e')]);}_0x152bd9[_0x34ca('0x37')]=qs['sort'](_0x2c27cf[_0x34ca('0x2f')][_0x34ca('0x38')]);_0x152bd9[_0x34ca('0x39')]=qs[_0x34ca('0x30')](_[_0x34ca('0x3a')](_0x2c27cf['query'],_0x446748[_0x34ca('0x30')]),_0x3bd449);if(_0x2c27cf[_0x34ca('0x2f')]['filter']){_0x152bd9[_0x34ca('0x39')]=_[_0x34ca('0x3b')](_0x152bd9[_0x34ca('0x39')],{'$or':_[_0x34ca('0x2a')](_0x3bd449,function(_0x19fdea){if(_0x19fdea[_0x34ca('0x2d')]!==_0x34ca('0x3c')){var _0x89d662={};_0x89d662[_0x19fdea[_0x34ca('0x29')]]={'$like':'%'+_0x2c27cf[_0x34ca('0x2f')]['filter']+'%'};return _0x89d662;}})});}_0x152bd9=_[_0x34ca('0x3b')]({},_0x152bd9,_0x2c27cf[_0x34ca('0x3d')]);var _0x249a36={'where':_0x152bd9[_0x34ca('0x39')]};return db[_0x34ca('0x3e')][_0x34ca('0x21')](_0x249a36)[_0x34ca('0x27')](function(_0x47aa2f){_0x45eef8[_0x34ca('0x21')]=_0x47aa2f;if(_0x2c27cf[_0x34ca('0x2f')]['includeAll']){_0x152bd9[_0x34ca('0x3f')]=[{'all':!![]}];}return db[_0x34ca('0x3e')][_0x34ca('0x40')](_0x152bd9);})[_0x34ca('0x27')](function(_0x2ad5ff){_0x45eef8[_0x34ca('0x41')]=_0x2ad5ff;return _0x45eef8;})[_0x34ca('0x27')](respondWithFilteredResult(_0xdbe38d,_0x152bd9))[_0x34ca('0x42')](handleError(_0xdbe38d,null));};exports[_0x34ca('0x43')]=function(_0x2fabe5,_0x1e9fea){var _0x4ecddd={'raw':!![],'where':{'id':_0x2fabe5[_0x34ca('0x44')]['id']}},_0x310d35={};_0x310d35[_0x34ca('0x2e')]=_[_0x34ca('0x45')](db['ZendeskField'][_0x34ca('0x2b')]);_0x310d35[_0x34ca('0x2f')]=_[_0x34ca('0x45')](_0x2fabe5['query']);_0x310d35[_0x34ca('0x30')]=_[_0x34ca('0x32')](_0x310d35[_0x34ca('0x2e')],_0x310d35[_0x34ca('0x2f')]);_0x4ecddd[_0x34ca('0x31')]=_[_0x34ca('0x32')](_0x310d35[_0x34ca('0x2e')],qs[_0x34ca('0x33')](_0x2fabe5[_0x34ca('0x2f')][_0x34ca('0x33')]));_0x4ecddd[_0x34ca('0x31')]=_0x4ecddd[_0x34ca('0x31')][_0x34ca('0x34')]?_0x4ecddd[_0x34ca('0x31')]:_0x310d35['model'];if(_0x2fabe5[_0x34ca('0x2f')]['includeAll']){_0x4ecddd['include']=[{'all':!![]}];}_0x4ecddd=_[_0x34ca('0x3b')]({},_0x4ecddd,_0x2fabe5[_0x34ca('0x3d')]);return db[_0x34ca('0x3e')][_0x34ca('0x46')](_0x4ecddd)[_0x34ca('0x27')](handleEntityNotFound(_0x1e9fea,null))[_0x34ca('0x27')](respondWithResult(_0x1e9fea,null))[_0x34ca('0x42')](handleError(_0x1e9fea,null));};exports[_0x34ca('0x47')]=function(_0x4a6cbf,_0x16a322){return db[_0x34ca('0x3e')][_0x34ca('0x47')](_0x4a6cbf[_0x34ca('0x48')],{})[_0x34ca('0x27')](respondWithResult(_0x16a322,0xc9))['catch'](handleError(_0x16a322,null));};exports[_0x34ca('0x26')]=function(_0x518334,_0x4d2a7a){if(_0x518334[_0x34ca('0x48')]['id']){delete _0x518334['body']['id'];}return db[_0x34ca('0x3e')][_0x34ca('0x46')]({'where':{'id':_0x518334[_0x34ca('0x44')]['id']}})[_0x34ca('0x27')](handleEntityNotFound(_0x4d2a7a,null))[_0x34ca('0x27')](saveUpdates(_0x518334[_0x34ca('0x48')],null))[_0x34ca('0x27')](respondWithResult(_0x4d2a7a,null))['catch'](handleError(_0x4d2a7a,null));};exports['destroy']=function(_0x52f75c,_0x55c1cc){return db[_0x34ca('0x3e')][_0x34ca('0x46')]({'where':{'id':_0x52f75c['params']['id']}})[_0x34ca('0x27')](handleEntityNotFound(_0x55c1cc,null))[_0x34ca('0x27')](removeEntity(_0x55c1cc,null))['catch'](handleError(_0x55c1cc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 8fe8295..293c66c 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 _0xfb68=['./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','moment','rimraf'];(function(_0x54afac,_0x18c538){var _0x109416=function(_0x1b8631){while(--_0x1b8631){_0x54afac['push'](_0x54afac['shift']());}};_0x109416(++_0x18c538);}(_0xfb68,0xab));var _0x8fb6=function(_0x58084a,_0x4eeea3){_0x58084a=_0x58084a-0x0;var _0x4736ae=_0xfb68[_0x58084a];return _0x4736ae;};'use strict';var _=require(_0x8fb6('0x0'));var util=require(_0x8fb6('0x1'));var logger=require(_0x8fb6('0x2'))('api');var moment=require(_0x8fb6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8fb6('0x4'));var config=require('../../config/environment');var attributes=require(_0x8fb6('0x5'));module[_0x8fb6('0x6')]=function(_0x370720,_0x2f5505){return _0x370720['define'](_0x8fb6('0x7'),attributes,{'tableName':_0x8fb6('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x8fb6('0x9'),_0x8fb6('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3d6=['rimraf','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc8d65f,_0x2fdf36){var _0x3f732b=function(_0x31a925){while(--_0x31a925){_0xc8d65f['push'](_0xc8d65f['shift']());}};_0x3f732b(++_0x2fdf36);}(_0xd3d6,0x86));var _0x6d3d=function(_0x48653a,_0x102d74){_0x48653a=_0x48653a-0x0;var _0x3c52de=_0xd3d6[_0x48653a];return _0x3c52de;};'use strict';var _=require(_0x6d3d('0x0'));var util=require('util');var logger=require(_0x6d3d('0x1'))(_0x6d3d('0x2'));var moment=require(_0x6d3d('0x3'));var BPromise=require(_0x6d3d('0x4'));var rp=require(_0x6d3d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d3d('0x6'));var config=require('../../config/environment');var attributes=require(_0x6d3d('0x7'));module[_0x6d3d('0x8')]=function(_0x764aa7,_0x2b6535){return _0x764aa7['define'](_0x6d3d('0x9'),attributes,{'tableName':_0x6d3d('0xa'),'paranoid':![],'indexes':[{'name':_0x6d3d('0xb'),'fields':[_0x6d3d('0xc'),_0x6d3d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 4f0b90c..97197c5 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 _0x568c=['info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x2aa253,_0x269305){var _0xb4ee18=function(_0x4a20c1){while(--_0x4a20c1){_0x2aa253['push'](_0x2aa253['shift']());}};_0xb4ee18(++_0x269305);}(_0x568c,0xc8));var _0xc568=function(_0xecc71a,_0x180805){_0xecc71a=_0xecc71a-0x0;var _0x51fd43=_0x568c[_0xecc71a];return _0x51fd43;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc568('0x0'));var BPromise=require(_0xc568('0x1'));var rs=require(_0xc568('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc568('0x3'))['db'];var utils=require(_0xc568('0x4'));var logger=require(_0xc568('0x5'))(_0xc568('0x6'));var config=require('../../config/environment');var jayson=require(_0xc568('0x7'));var client=jayson[_0xc568('0x8')][_0xc568('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf7a16c,_0x4261bc,_0x1d66d7){return new BPromise(function(_0xf091bc,_0x52bb44){return client[_0xc568('0xa')](_0xf7a16c,_0x1d66d7)['then'](function(_0x5debb0){logger['info'](_0xc568('0xb'),_0x4261bc,'request\x20sent');logger['debug'](_0xc568('0xc'),_0x4261bc,_0xc568('0xd'),JSON['stringify'](_0x5debb0));if(_0x5debb0[_0xc568('0xe')]){if(_0x5debb0[_0xc568('0xe')]['code']===0x1f4){logger['error'](_0xc568('0xb'),_0x4261bc,_0x5debb0[_0xc568('0xe')][_0xc568('0xf')]);return _0x52bb44(_0x5debb0[_0xc568('0xe')][_0xc568('0xf')]);}logger[_0xc568('0xe')](_0xc568('0xb'),_0x4261bc,_0x5debb0['error'][_0xc568('0xf')]);return _0xf091bc(_0x5debb0[_0xc568('0xe')][_0xc568('0xf')]);}else{logger[_0xc568('0x10')](_0xc568('0xb'),_0x4261bc,_0xc568('0xd'));_0xf091bc(_0x5debb0[_0xc568('0x11')][_0xc568('0xf')]);}})['catch'](function(_0x445931){logger[_0xc568('0xe')](_0xc568('0xb'),_0x4261bc,_0x445931);_0x52bb44(_0x445931);});});} \ No newline at end of file +var _0x4b4f=['message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','ZendeskField,\x20%s,\x20%s'];(function(_0x5c2355,_0xf5854f){var _0x25b406=function(_0x5e8d74){while(--_0x5e8d74){_0x5c2355['push'](_0x5c2355['shift']());}};_0x25b406(++_0xf5854f);}(_0x4b4f,0x1b7));var _0xf4b4=function(_0x5944e3,_0x155234){_0x5944e3=_0x5944e3-0x0;var _0x1cfb0a=_0x4b4f[_0x5944e3];return _0x1cfb0a;};'use strict';var _=require(_0xf4b4('0x0'));var util=require(_0xf4b4('0x1'));var moment=require(_0xf4b4('0x2'));var BPromise=require(_0xf4b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4b4('0x4'));var db=require(_0xf4b4('0x5'))['db'];var utils=require(_0xf4b4('0x6'));var logger=require(_0xf4b4('0x7'))(_0xf4b4('0x8'));var config=require(_0xf4b4('0x9'));var jayson=require(_0xf4b4('0xa'));var client=jayson[_0xf4b4('0xb')][_0xf4b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cbc4d,_0x31fa4b,_0x4f8c3f){return new BPromise(function(_0x5aa571,_0x270da4){return client[_0xf4b4('0xd')](_0x5cbc4d,_0x4f8c3f)[_0xf4b4('0xe')](function(_0x33959c){logger[_0xf4b4('0xf')]('ZendeskField,\x20%s,\x20%s',_0x31fa4b,_0xf4b4('0x10'));logger[_0xf4b4('0x11')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x31fa4b,'request\x20sent',JSON[_0xf4b4('0x12')](_0x33959c));if(_0x33959c['error']){if(_0x33959c[_0xf4b4('0x13')]['code']===0x1f4){logger[_0xf4b4('0x13')](_0xf4b4('0x14'),_0x31fa4b,_0x33959c['error'][_0xf4b4('0x15')]);return _0x270da4(_0x33959c['error']['message']);}logger['error'](_0xf4b4('0x14'),_0x31fa4b,_0x33959c[_0xf4b4('0x13')][_0xf4b4('0x15')]);return _0x5aa571(_0x33959c[_0xf4b4('0x13')][_0xf4b4('0x15')]);}else{logger['info'](_0xf4b4('0x14'),_0x31fa4b,_0xf4b4('0x10'));_0x5aa571(_0x33959c['result'][_0xf4b4('0x15')]);}})[_0xf4b4('0x16')](function(_0x1b0219){logger['error'](_0xf4b4('0x14'),_0x31fa4b,_0x1b0219);_0x270da4(_0x1b0219);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index bf42d3d..dc1416f 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 _0x1d15=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x57eff3,_0x481834){var _0x23de11=function(_0xe67e4){while(--_0xe67e4){_0x57eff3['push'](_0x57eff3['shift']());}};_0x23de11(++_0x481834);}(_0x1d15,0xe7));var _0x51d1=function(_0x148a18,_0x4972b3){_0x148a18=_0x148a18-0x0;var _0x3723b0=_0x1d15[_0x148a18];return _0x3723b0;};'use strict';var multer=require(_0x51d1('0x0'));var util=require(_0x51d1('0x1'));var path=require(_0x51d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x51d1('0x3'));var router=express[_0x51d1('0x4')]();var fs_extra=require(_0x51d1('0x5'));var auth=require(_0x51d1('0x6'));var interaction=require(_0x51d1('0x7'));var config=require(_0x51d1('0x8'));var controller=require(_0x51d1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x51d1('0xa')]);router['get'](_0x51d1('0xb'),auth[_0x51d1('0xc')](),controller[_0x51d1('0xd')]);router[_0x51d1('0xe')](_0x51d1('0xf'),auth[_0x51d1('0xc')](),controller[_0x51d1('0x10')]);router[_0x51d1('0xe')](_0x51d1('0x11'),auth['isAuthenticated'](),controller[_0x51d1('0x12')]);router[_0x51d1('0x13')]('/',auth[_0x51d1('0xc')](),controller[_0x51d1('0x14')]);router[_0x51d1('0x13')]('/:id/configurations',auth[_0x51d1('0xc')](),controller[_0x51d1('0x15')]);router[_0x51d1('0x16')]('/:id',auth[_0x51d1('0xc')](),controller[_0x51d1('0x17')]);router['delete'](_0x51d1('0xb'),auth[_0x51d1('0xc')](),controller[_0x51d1('0x18')]);module[_0x51d1('0x19')]=router; \ No newline at end of file +var _0x6d37=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0x6d37,0xe7));var _0x76d3=function(_0x31f93f,_0x48a692){_0x31f93f=_0x31f93f-0x0;var _0x26ae05=_0x6d37[_0x31f93f];return _0x26ae05;};'use strict';var multer=require(_0x76d3('0x0'));var util=require(_0x76d3('0x1'));var path=require(_0x76d3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x76d3('0x3')]();var fs_extra=require(_0x76d3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x76d3('0x5'));var config=require(_0x76d3('0x6'));var controller=require(_0x76d3('0x7'));router['get']('/',auth[_0x76d3('0x8')](),controller[_0x76d3('0x9')]);router[_0x76d3('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x76d3('0xb')]);router['get'](_0x76d3('0xc'),auth[_0x76d3('0x8')](),controller[_0x76d3('0xd')]);router[_0x76d3('0xa')](_0x76d3('0xe'),auth[_0x76d3('0x8')](),controller[_0x76d3('0xf')]);router[_0x76d3('0x10')]('/',auth[_0x76d3('0x8')](),controller['create']);router[_0x76d3('0x10')](_0x76d3('0xc'),auth[_0x76d3('0x8')](),controller[_0x76d3('0x11')]);router['put'](_0x76d3('0x12'),auth[_0x76d3('0x8')](),controller[_0x76d3('0x13')]);router[_0x76d3('0x14')]('/:id',auth[_0x76d3('0x8')](),controller[_0x76d3('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 46a3c19..7549b21 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 _0x1be1=['STRING'];(function(_0x1ee442,_0x2d8baa){var _0x316ad6=function(_0x3af4d6){while(--_0x3af4d6){_0x1ee442['push'](_0x1ee442['shift']());}};_0x316ad6(++_0x2d8baa);}(_0x1be1,0x192));var _0x11be=function(_0x2d39f2,_0x19e65){_0x2d39f2=_0x2d39f2-0x0;var _0x589f9d=_0x1be1[_0x2d39f2];return _0x589f9d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x11be('0x0')]},'description':{'type':Sequelize[_0x11be('0x0')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x11be('0x0')]},'clientId':{'type':Sequelize[_0x11be('0x0')]},'clientSecret':{'type':Sequelize[_0x11be('0x0')]},'serverUrl':{'type':Sequelize[_0x11be('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x11be('0x0')]}}; \ No newline at end of file +var _0x750a=['exports','STRING'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x750a,0x140));var _0xa750=function(_0x1d9762,_0x3a432c){_0x1d9762=_0x1d9762-0x0;var _0x203315=_0x750a[_0x1d9762];return _0x203315;};'use strict';var Sequelize=require('sequelize');module[_0xa750('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa750('0x1')]},'zone':{'type':Sequelize[_0xa750('0x1')]},'clientId':{'type':Sequelize[_0xa750('0x1')]},'clientSecret':{'type':Sequelize[_0xa750('0x1')]},'serverUrl':{'type':Sequelize[_0xa750('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xa750('0x1')]},'refreshToken':{'type':Sequelize[_0xa750('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 418c32b..9c63ba3 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 _0xdd0f=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','map','ZohoAccount','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','keys','includeAll','include','find','body','params','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','channel','getDescriptions','create','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','lodash'];(function(_0x4fe328,_0x5e456d){var _0x11a53b=function(_0x42f8cb){while(--_0x42f8cb){_0x4fe328['push'](_0x4fe328['shift']());}};_0x11a53b(++_0x5e456d);}(_0xdd0f,0x180));var _0xfdd0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd0f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfdd0('0x0'));var rimraf=require(_0xfdd0('0x1'));var zipdir=require(_0xfdd0('0x2'));var jsonpatch=require(_0xfdd0('0x3'));var rp=require(_0xfdd0('0x4'));var moment=require('moment');var BPromise=require(_0xfdd0('0x5'));var Mustache=require(_0xfdd0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfdd0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfdd0('0x8'));var squel=require(_0xfdd0('0x9'));var crypto=require(_0xfdd0('0xa'));var jsforce=require(_0xfdd0('0xb'));var deskjs=require(_0xfdd0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfdd0('0xd'));var Papa=require(_0xfdd0('0xe'));var Redis=require(_0xfdd0('0xf'));var authService=require(_0xfdd0('0x10'));var qs=require(_0xfdd0('0x11'));var as=require(_0xfdd0('0x12'));var hardwareService=require(_0xfdd0('0x13'));var logger=require('../../config/logger')(_0xfdd0('0x14'));var utils=require(_0xfdd0('0x15'));var config=require(_0xfdd0('0x16'));var licenseUtil=require(_0xfdd0('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfdd0('0x18'));function respondWithStatusCode(_0x41ad88,_0x36d728){_0x36d728=_0x36d728||0xcc;return function(_0xb71f87){if(_0xb71f87){return _0x41ad88['sendStatus'](_0x36d728);}return _0x41ad88['status'](_0x36d728)[_0xfdd0('0x19')]();};}function respondWithResult(_0x35e351,_0x1773fd){_0x1773fd=_0x1773fd||0xc8;return function(_0x5d2eec){if(_0x5d2eec){return _0x35e351[_0xfdd0('0x1a')](_0x1773fd)[_0xfdd0('0x1b')](_0x5d2eec);}};}function respondWithFilteredResult(_0x26912f,_0x652ab){return function(_0x2416e0){if(_0x2416e0){var _0x353192=typeof _0x652ab[_0xfdd0('0x1c')]===_0xfdd0('0x1d')&&typeof _0x652ab[_0xfdd0('0x1e')]===_0xfdd0('0x1d');var _0x179bf0=_0x2416e0[_0xfdd0('0x1f')];var _0x2d5356=_0x353192?0x0:_0x652ab[_0xfdd0('0x1c')];var _0x33b096=_0x353192?_0x2416e0['count']:_0x652ab[_0xfdd0('0x1c')]+_0x652ab[_0xfdd0('0x1e')];var _0xf99095;if(_0x33b096>=_0x179bf0){_0x33b096=_0x179bf0;_0xf99095=0xc8;}else{_0xf99095=0xce;}_0x26912f[_0xfdd0('0x1a')](_0xf99095);return _0x26912f[_0xfdd0('0x20')]('Content-Range',_0x2d5356+'-'+_0x33b096+'/'+_0x179bf0)['json'](_0x2416e0);}return null;};}function patchUpdates(_0x743090){return function(_0x10a99b){try{jsonpatch['apply'](_0x10a99b,_0x743090,!![]);}catch(_0x470e53){return BPromise[_0xfdd0('0x21')](_0x470e53);}return _0x10a99b[_0xfdd0('0x22')]();};}function saveUpdates(_0x2ec7c0,_0x81ff7){return function(_0x2ab64){if(_0x2ab64){return _0x2ab64[_0xfdd0('0x23')](_0x2ec7c0)[_0xfdd0('0x24')](function(_0x5439ce){return _0x5439ce;});}return null;};}function removeEntity(_0x561df7,_0xa9cfeb){return function(_0x387f5f){if(_0x387f5f){return _0x387f5f['destroy']()['then'](function(){_0x561df7[_0xfdd0('0x1a')](0xcc)[_0xfdd0('0x19')]();});}};}function handleEntityNotFound(_0x3be01b,_0x26edd7){return function(_0x28d3e0){if(!_0x28d3e0){_0x3be01b['sendStatus'](0x194);}return _0x28d3e0;};}function handleError(_0xa7ddf4,_0x9f16e7){_0x9f16e7=_0x9f16e7||0x1f4;return function(_0x508d97){logger[_0xfdd0('0x25')](_0x508d97[_0xfdd0('0x26')]);if(_0x508d97[_0xfdd0('0x27')]){delete _0x508d97[_0xfdd0('0x27')];}_0xa7ddf4[_0xfdd0('0x1a')](_0x9f16e7)[_0xfdd0('0x28')](_0x508d97);};}exports[_0xfdd0('0x29')]=function(_0x5f4673,_0x5476eb){var _0x3fc957={},_0x45781d={},_0x2503da={'count':0x0,'rows':[]};var _0x582710=_[_0xfdd0('0x2a')](db[_0xfdd0('0x2b')]['rawAttributes'],function(_0x163847){return{'name':_0x163847['fieldName'],'type':_0x163847[_0xfdd0('0x2c')][_0xfdd0('0x2d')]};});_0x45781d[_0xfdd0('0x2e')]=_[_0xfdd0('0x2a')](_0x582710,'name');_0x45781d[_0xfdd0('0x2f')]=_['keys'](_0x5f4673[_0xfdd0('0x2f')]);_0x45781d[_0xfdd0('0x30')]=_[_0xfdd0('0x31')](_0x45781d[_0xfdd0('0x2e')],_0x45781d[_0xfdd0('0x2f')]);_0x3fc957[_0xfdd0('0x32')]=_[_0xfdd0('0x31')](_0x45781d[_0xfdd0('0x2e')],qs['fields'](_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x33')]));_0x3fc957[_0xfdd0('0x32')]=_0x3fc957[_0xfdd0('0x32')][_0xfdd0('0x34')]?_0x3fc957[_0xfdd0('0x32')]:_0x45781d[_0xfdd0('0x2e')];if(!_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x35')](_0xfdd0('0x36'))){_0x3fc957[_0xfdd0('0x1e')]=qs[_0xfdd0('0x1e')](_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x1e')]);_0x3fc957[_0xfdd0('0x1c')]=qs[_0xfdd0('0x1c')](_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x1c')]);}_0x3fc957[_0xfdd0('0x37')]=qs['sort'](_0x5f4673['query'][_0xfdd0('0x38')]);_0x3fc957['where']=qs[_0xfdd0('0x30')](_['pick'](_0x5f4673[_0xfdd0('0x2f')],_0x45781d['filters']),_0x582710);if(_0x5f4673['query'][_0xfdd0('0x39')]){_0x3fc957[_0xfdd0('0x3a')]=_[_0xfdd0('0x3b')](_0x3fc957[_0xfdd0('0x3a')],{'$or':_[_0xfdd0('0x2a')](_0x582710,function(_0x327b8c){if(_0x327b8c[_0xfdd0('0x2c')]!==_0xfdd0('0x3c')){var _0x2c2a53={};_0x2c2a53[_0x327b8c[_0xfdd0('0x27')]]={'$like':'%'+_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x39')]+'%'};return _0x2c2a53;}})});}_0x3fc957=_['merge']({},_0x3fc957,_0x5f4673[_0xfdd0('0x3d')]);var _0x35cac5={'where':_0x3fc957['where']};return db['ZohoAccount'][_0xfdd0('0x1f')](_0x35cac5)[_0xfdd0('0x24')](function(_0x54972d){_0x2503da[_0xfdd0('0x1f')]=_0x54972d;if(_0x5f4673[_0xfdd0('0x2f')]['includeAll']){_0x3fc957['include']=[{'all':!![]}];}return db[_0xfdd0('0x2b')][_0xfdd0('0x3e')](_0x3fc957);})[_0xfdd0('0x24')](function(_0x22d0e8){_0x2503da[_0xfdd0('0x3f')]=_0x22d0e8;return _0x2503da;})[_0xfdd0('0x24')](respondWithFilteredResult(_0x5476eb,_0x3fc957))[_0xfdd0('0x40')](handleError(_0x5476eb,null));};exports[_0xfdd0('0x41')]=function(_0x1e6aad,_0xa5c60a){var _0x4078a7={'raw':![],'where':{'id':_0x1e6aad['params']['id']}},_0x3c6add={};_0x3c6add[_0xfdd0('0x2e')]=_['keys'](db[_0xfdd0('0x2b')][_0xfdd0('0x42')]);_0x3c6add[_0xfdd0('0x2f')]=_[_0xfdd0('0x43')](_0x1e6aad[_0xfdd0('0x2f')]);_0x3c6add[_0xfdd0('0x30')]=_[_0xfdd0('0x31')](_0x3c6add[_0xfdd0('0x2e')],_0x3c6add['query']);_0x4078a7[_0xfdd0('0x32')]=_['intersection'](_0x3c6add[_0xfdd0('0x2e')],qs[_0xfdd0('0x33')](_0x1e6aad[_0xfdd0('0x2f')][_0xfdd0('0x33')]));_0x4078a7['attributes']=_0x4078a7[_0xfdd0('0x32')][_0xfdd0('0x34')]?_0x4078a7[_0xfdd0('0x32')]:_0x3c6add[_0xfdd0('0x2e')];if(_0x1e6aad['query'][_0xfdd0('0x44')]){_0x4078a7[_0xfdd0('0x45')]=[{'all':!![]}];}_0x4078a7=_['merge']({},_0x4078a7,_0x1e6aad['options']);return db[_0xfdd0('0x2b')][_0xfdd0('0x46')](_0x4078a7)['then'](handleEntityNotFound(_0xa5c60a,null))[_0xfdd0('0x24')](respondWithResult(_0xa5c60a,null))[_0xfdd0('0x40')](handleError(_0xa5c60a,null));};exports['create']=function(_0x5f1f19,_0xee7a95){return db[_0xfdd0('0x2b')]['create'](_0x5f1f19[_0xfdd0('0x47')],{})[_0xfdd0('0x24')](respondWithResult(_0xee7a95,0xc9))['catch'](handleError(_0xee7a95,null));};exports[_0xfdd0('0x23')]=function(_0xcf2eb6,_0x565271){if(_0xcf2eb6[_0xfdd0('0x47')]['id']){delete _0xcf2eb6[_0xfdd0('0x47')]['id'];}return db[_0xfdd0('0x2b')][_0xfdd0('0x46')]({'where':{'id':_0xcf2eb6[_0xfdd0('0x48')]['id']}})[_0xfdd0('0x24')](handleEntityNotFound(_0x565271,null))[_0xfdd0('0x24')](saveUpdates(_0xcf2eb6[_0xfdd0('0x47')],null))[_0xfdd0('0x24')](respondWithResult(_0x565271,null))['catch'](handleError(_0x565271,null));};exports['destroy']=function(_0x1e935e,_0xb7d730){return db[_0xfdd0('0x2b')][_0xfdd0('0x46')]({'where':{'id':_0x1e935e[_0xfdd0('0x48')]['id']}})[_0xfdd0('0x24')](handleEntityNotFound(_0xb7d730,null))[_0xfdd0('0x24')](removeEntity(_0xb7d730,null))['catch'](handleError(_0xb7d730,null));};exports['getConfigurations']=function(_0x13d786,_0x52f527,_0x56c9f1){var _0x591fde={};var _0x4e79d0={};var _0x24392e;var _0x55cd80;return db['ZohoAccount'][_0xfdd0('0x49')]({'where':{'id':_0x13d786['params']['id']}})['then'](handleEntityNotFound(_0x52f527,null))['then'](function(_0xc679ce){if(_0xc679ce){_0x24392e=_0xc679ce;_0x4e79d0[_0xfdd0('0x2e')]=_['keys'](db[_0xfdd0('0x4a')][_0xfdd0('0x42')]);_0x4e79d0[_0xfdd0('0x2f')]=_['keys'](_0x13d786[_0xfdd0('0x2f')]);_0x4e79d0[_0xfdd0('0x30')]=_['intersection'](_0x4e79d0[_0xfdd0('0x2e')],_0x4e79d0[_0xfdd0('0x2f')]);_0x591fde['attributes']=_[_0xfdd0('0x31')](_0x4e79d0[_0xfdd0('0x2e')],qs[_0xfdd0('0x33')](_0x13d786[_0xfdd0('0x2f')][_0xfdd0('0x33')]));_0x591fde['attributes']=_0x591fde[_0xfdd0('0x32')][_0xfdd0('0x34')]?_0x591fde[_0xfdd0('0x32')]:_0x4e79d0['model'];_0x591fde['order']=qs[_0xfdd0('0x38')](_0x13d786[_0xfdd0('0x2f')]['sort']);_0x591fde['where']=qs[_0xfdd0('0x30')](_['pick'](_0x13d786['query'],_0x4e79d0[_0xfdd0('0x30')]));if(_0x13d786['query'][_0xfdd0('0x39')]){_0x591fde[_0xfdd0('0x3a')]=_[_0xfdd0('0x3b')](_0x591fde[_0xfdd0('0x3a')],{'$or':_[_0xfdd0('0x2a')](_0x591fde[_0xfdd0('0x32')],function(_0x12e2fb){var _0x5427e6={};_0x5427e6[_0x12e2fb]={'$like':'%'+_0x13d786[_0xfdd0('0x2f')][_0xfdd0('0x39')]+'%'};return _0x5427e6;})});}_0x591fde=_['merge']({},_0x591fde,_0x13d786[_0xfdd0('0x3d')]);return _0x24392e[_0xfdd0('0x4b')](_0x591fde);}})[_0xfdd0('0x24')](function(_0x36fba9){if(_0x36fba9){_0x55cd80=_0x36fba9[_0xfdd0('0x34')];if(!_0x13d786['query'][_0xfdd0('0x35')](_0xfdd0('0x36'))){_0x591fde[_0xfdd0('0x1e')]=qs[_0xfdd0('0x1e')](_0x13d786[_0xfdd0('0x2f')][_0xfdd0('0x1e')]);_0x591fde[_0xfdd0('0x1c')]=qs['offset'](_0x13d786[_0xfdd0('0x2f')][_0xfdd0('0x1c')]);}return _0x24392e[_0xfdd0('0x4b')](_0x591fde);}})['then'](function(_0x1814b4){if(_0x1814b4){return _0x1814b4?{'count':_0x55cd80,'rows':_0x1814b4}:null;}})[_0xfdd0('0x24')](respondWithResult(_0x52f527,null))[_0xfdd0('0x40')](handleError(_0x52f527,null));};exports[_0xfdd0('0x4c')]=function(_0x80f8c9,_0x1e8101,_0x3fb766){if(_0x80f8c9[_0xfdd0('0x47')]['id']){delete _0x80f8c9[_0xfdd0('0x47')]['id'];}return db['ZohoAccount'][_0xfdd0('0x49')]({'where':{'id':_0x80f8c9[_0xfdd0('0x48')]['id']}})[_0xfdd0('0x24')](handleEntityNotFound(_0x1e8101,null))[_0xfdd0('0x24')](function(_0x1eb0fb){if(_0x1eb0fb){_0x80f8c9[_0xfdd0('0x47')][_0xfdd0('0x4d')]=_0x1eb0fb['id'];_0x80f8c9[_0xfdd0('0x47')]['Subjects']=integrations['getSubjects'](_0x80f8c9[_0xfdd0('0x47')][_0xfdd0('0x4e')],_0x80f8c9[_0xfdd0('0x47')][_0xfdd0('0x2c')]);_0x80f8c9[_0xfdd0('0x47')]['Descriptions']=integrations[_0xfdd0('0x4f')](_0x80f8c9[_0xfdd0('0x47')]['channel'],_0x80f8c9[_0xfdd0('0x47')][_0xfdd0('0x2c')]);return db[_0xfdd0('0x4a')][_0xfdd0('0x50')](_0x80f8c9['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xfdd0('0x51')],'as':_0xfdd0('0x52')}]});}return null;})[_0xfdd0('0x24')](respondWithResult(_0x1e8101,null))['catch'](handleError(_0x1e8101,null));};function getAccessToken(_0x47bcfd){return new Promise(function(_0x426ab5,_0x426631){var _0x306317;switch(_0x47bcfd[_0xfdd0('0x53')]){case'US':_0x306317=_0xfdd0('0x54');break;case'AU':_0x306317=_0xfdd0('0x55');break;case'EU':_0x306317=_0xfdd0('0x56');break;case'IN':_0x306317=_0xfdd0('0x57');break;case'CN':_0x306317=_0xfdd0('0x58');break;default:_0x306317=_0xfdd0('0x56');break;}var _0x3b29a9={'method':'POST','uri':_0x306317+_0xfdd0('0x59'),'qs':{'refresh_token':_0x47bcfd[_0xfdd0('0x5a')],'client_id':_0x47bcfd['clientId'],'client_secret':_0x47bcfd[_0xfdd0('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3b29a9)[_0xfdd0('0x24')](function(_0x4fcf0e){if(_0x4fcf0e[_0xfdd0('0x5c')]){_0x426ab5(_0x4fcf0e[_0xfdd0('0x5c')]);}else{_0x426631(_0xfdd0('0x5d'));}})['catch'](function(_0x16125a){_0x426631(_0x16125a);});});}exports[_0xfdd0('0x5e')]=function(_0x1f6477,_0x52f96c,_0xd48a2c){var _0x579d44,_0x402692,_0x2a8fb5,_0x1fb1be,_0x37fd36;return db[_0xfdd0('0x2b')][_0xfdd0('0x49')]({'where':{'id':_0x1f6477[_0xfdd0('0x48')]['id']},'attributes':['id',_0xfdd0('0x5f'),'zone',_0xfdd0('0x60'),_0xfdd0('0x5b'),_0xfdd0('0x61'),_0xfdd0('0x62'),_0xfdd0('0x5a')]})['then'](handleEntityNotFound(_0x52f96c,null))[_0xfdd0('0x24')](function(_0x32aa20){_0x37fd36=_0x32aa20;_0x579d44=_0x37fd36[_0xfdd0('0x5f')];_0x402692=_0x579d44===_0xfdd0('0x63')?'eu':_0xfdd0('0x64');_0x2a8fb5=_0x37fd36[_0xfdd0('0x61')];var _0x806812=_0x2a8fb5[_0xfdd0('0x65')](-0x1);if(_0x806812==='/'||_0x806812==='\x5c'||_0x806812===':'){_0x2a8fb5=_0x2a8fb5[_0xfdd0('0x66')](0x0,_0x2a8fb5[_0xfdd0('0x67')](_0x806812));}if(!_0x37fd36[_0xfdd0('0x5a')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x37fd36);})[_0xfdd0('0x24')](function(_0x3a536f){if(_0x3a536f){return rp({'method':'GET','uri':util[_0xfdd0('0x68')](_0xfdd0('0x69'),_0x402692),'qs':{'module':_0xfdd0('0x6a')},'headers':{'Authorization':_0xfdd0('0x6b')+_0x3a536f},'json':!![]});}})[_0xfdd0('0x24')](function(_0x5dc0c6){if(_0x5dc0c6){if(_0x5dc0c6[_0xfdd0('0x6c')]&&_0x5dc0c6['response']['error']){throw new Error(_0x5dc0c6['response']['error'][_0xfdd0('0x6d')]);}var _0x4a32cb=[];var _0x1822f0=[];var _0x18837b=[_0xfdd0('0x6e'),_0xfdd0('0x6f'),_0xfdd0('0x70'),_0xfdd0('0x71'),_0xfdd0('0x72'),_0xfdd0('0x73'),_0xfdd0('0x74'),_0xfdd0('0x75')];_0x1822f0=_[_0xfdd0('0x76')](_0x5dc0c6[_0xfdd0('0x33')],function(_0x32f675){return _0x18837b[_0xfdd0('0x77')](_0x32f675[_0xfdd0('0x78')]);});for(var _0x2ee689=0x0;_0x2ee689<_0x1822f0[_0xfdd0('0x34')];_0x2ee689++){if(_0x1822f0[_0x2ee689][_0xfdd0('0x79')]===![]){_0x4a32cb[_0xfdd0('0x7a')]({'id':_0x1822f0[_0x2ee689]['id'],'name':_0x1822f0[_0x2ee689][_0xfdd0('0x7b')],'custom':_0x1822f0[_0x2ee689]['custom_field'],'options':_0x1822f0[_0x2ee689]['data_type']===_0xfdd0('0x7c')&&_0x1822f0[_0x2ee689][_0xfdd0('0x7d')][_0xfdd0('0x34')]>-0x1?_[_0xfdd0('0x2a')](_0x1822f0[_0x2ee689]['pick_list_values'],function(_0x249e00){return{'name':_0x249e00,'value':_0x249e00};}):[]});}}return{'count':_0x4a32cb[_0xfdd0('0x34')],'rows':_0x4a32cb};}else{return{'count':0x0,'rows':[]};}})[_0xfdd0('0x24')](respondWithResult(_0x52f96c,null))[_0xfdd0('0x40')](function(_0x50493f){var _0x2ac70e=_0x1f6477[_0xfdd0('0x2f')][_0xfdd0('0x7e')]?0x1f4:_0x50493f['statusCode']||0x1f4;logger['error'](_0xfdd0('0x7f'),_0xfdd0('0x5e'),_0x2ac70e,JSON[_0xfdd0('0x80')](_0x50493f));delete _0x50493f['name'];if(_0x2ac70e===0x191){_0x2ac70e=0x190;}_0x52f96c[_0xfdd0('0x1a')](_0x2ac70e)[_0xfdd0('0x28')](_0x1f6477[_0xfdd0('0x2f')][_0xfdd0('0x7e')]?{'message':_0xfdd0('0x81'),'statusCode':_0x50493f[_0xfdd0('0x82')]}:_0x50493f);});}; \ No newline at end of file +var _0xe584=['reject','save','update','destroy','then','sendStatus','error','stack','name','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','findOne','ZohoConfiguration','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','zoho.eu','substring','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Call_Duration','Call_Type','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x27bae5,_0x5e1e07){var _0x5e390d=function(_0x2cb51a){while(--_0x2cb51a){_0x27bae5['push'](_0x27bae5['shift']());}};_0x5e390d(++_0x5e1e07);}(_0xe584,0x1db));var _0x4e58=function(_0x2c6fd3,_0x4ad940){_0x2c6fd3=_0x2c6fd3-0x0;var _0x57d735=_0xe584[_0x2c6fd3];return _0x57d735;};'use strict';var emlformat=require(_0x4e58('0x0'));var rimraf=require(_0x4e58('0x1'));var zipdir=require(_0x4e58('0x2'));var jsonpatch=require(_0x4e58('0x3'));var rp=require(_0x4e58('0x4'));var moment=require(_0x4e58('0x5'));var BPromise=require(_0x4e58('0x6'));var Mustache=require(_0x4e58('0x7'));var util=require('util');var path=require(_0x4e58('0x8'));var sox=require(_0x4e58('0x9'));var csv=require(_0x4e58('0xa'));var ejs=require(_0x4e58('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4e58('0xc'));var crypto=require(_0x4e58('0xd'));var jsforce=require(_0x4e58('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4e58('0xa'));var querystring=require(_0x4e58('0xf'));var Papa=require(_0x4e58('0x10'));var Redis=require(_0x4e58('0x11'));var authService=require(_0x4e58('0x12'));var qs=require(_0x4e58('0x13'));var as=require(_0x4e58('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4e58('0x15'));var licenseUtil=require(_0x4e58('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4e58('0x17'));function respondWithStatusCode(_0x263f38,_0x4db2aa){_0x4db2aa=_0x4db2aa||0xcc;return function(_0x32e246){if(_0x32e246){return _0x263f38['sendStatus'](_0x4db2aa);}return _0x263f38[_0x4e58('0x18')](_0x4db2aa)[_0x4e58('0x19')]();};}function respondWithResult(_0x26da1a,_0x525eb6){_0x525eb6=_0x525eb6||0xc8;return function(_0x4d514d){if(_0x4d514d){return _0x26da1a[_0x4e58('0x18')](_0x525eb6)[_0x4e58('0x1a')](_0x4d514d);}};}function respondWithFilteredResult(_0xaef9e,_0x52563c){return function(_0x50482c){if(_0x50482c){var _0x2f8e03=typeof _0x52563c[_0x4e58('0x1b')]===_0x4e58('0x1c')&&typeof _0x52563c[_0x4e58('0x1d')]===_0x4e58('0x1c');var _0x3fdc36=_0x50482c[_0x4e58('0x1e')];var _0x3beda0=_0x2f8e03?0x0:_0x52563c['offset'];var _0xf313a8=_0x2f8e03?_0x50482c[_0x4e58('0x1e')]:_0x52563c[_0x4e58('0x1b')]+_0x52563c['limit'];var _0x44c703;if(_0xf313a8>=_0x3fdc36){_0xf313a8=_0x3fdc36;_0x44c703=0xc8;}else{_0x44c703=0xce;}_0xaef9e[_0x4e58('0x18')](_0x44c703);return _0xaef9e[_0x4e58('0x1f')]('Content-Range',_0x3beda0+'-'+_0xf313a8+'/'+_0x3fdc36)[_0x4e58('0x1a')](_0x50482c);}return null;};}function patchUpdates(_0x5bb4c4){return function(_0x39ce27){try{jsonpatch[_0x4e58('0x20')](_0x39ce27,_0x5bb4c4,!![]);}catch(_0x2b75bc){return BPromise[_0x4e58('0x21')](_0x2b75bc);}return _0x39ce27[_0x4e58('0x22')]();};}function saveUpdates(_0x2b7bbf,_0x28f3d5){return function(_0x34b326){if(_0x34b326){return _0x34b326[_0x4e58('0x23')](_0x2b7bbf)['then'](function(_0xd3b6c8){return _0xd3b6c8;});}return null;};}function removeEntity(_0x46e91d,_0x3c9b47){return function(_0x13ca4a){if(_0x13ca4a){return _0x13ca4a[_0x4e58('0x24')]()[_0x4e58('0x25')](function(){_0x46e91d[_0x4e58('0x18')](0xcc)[_0x4e58('0x19')]();});}};}function handleEntityNotFound(_0xad5f30,_0x37165b){return function(_0x3231f3){if(!_0x3231f3){_0xad5f30[_0x4e58('0x26')](0x194);}return _0x3231f3;};}function handleError(_0x14bea6,_0x18c4ac){_0x18c4ac=_0x18c4ac||0x1f4;return function(_0x414981){logger[_0x4e58('0x27')](_0x414981[_0x4e58('0x28')]);if(_0x414981[_0x4e58('0x29')]){delete _0x414981[_0x4e58('0x29')];}_0x14bea6[_0x4e58('0x18')](_0x18c4ac)['send'](_0x414981);};}exports['index']=function(_0x49541c,_0x4a4e09){var _0x59bf2c={},_0xd0cfb={},_0x2ffd9e={'count':0x0,'rows':[]};var _0x7dbb07=_[_0x4e58('0x2a')](db[_0x4e58('0x2b')][_0x4e58('0x2c')],function(_0x39d952){return{'name':_0x39d952[_0x4e58('0x2d')],'type':_0x39d952['type'][_0x4e58('0x2e')]};});_0xd0cfb[_0x4e58('0x2f')]=_[_0x4e58('0x2a')](_0x7dbb07,'name');_0xd0cfb[_0x4e58('0x30')]=_[_0x4e58('0x31')](_0x49541c[_0x4e58('0x30')]);_0xd0cfb[_0x4e58('0x32')]=_[_0x4e58('0x33')](_0xd0cfb[_0x4e58('0x2f')],_0xd0cfb['query']);_0x59bf2c[_0x4e58('0x34')]=_[_0x4e58('0x33')](_0xd0cfb[_0x4e58('0x2f')],qs[_0x4e58('0x35')](_0x49541c['query'][_0x4e58('0x35')]));_0x59bf2c[_0x4e58('0x34')]=_0x59bf2c[_0x4e58('0x34')]['length']?_0x59bf2c[_0x4e58('0x34')]:_0xd0cfb[_0x4e58('0x2f')];if(!_0x49541c[_0x4e58('0x30')][_0x4e58('0x36')](_0x4e58('0x37'))){_0x59bf2c[_0x4e58('0x1d')]=qs[_0x4e58('0x1d')](_0x49541c[_0x4e58('0x30')][_0x4e58('0x1d')]);_0x59bf2c['offset']=qs['offset'](_0x49541c[_0x4e58('0x30')]['offset']);}_0x59bf2c[_0x4e58('0x38')]=qs[_0x4e58('0x39')](_0x49541c[_0x4e58('0x30')][_0x4e58('0x39')]);_0x59bf2c[_0x4e58('0x3a')]=qs[_0x4e58('0x32')](_['pick'](_0x49541c['query'],_0xd0cfb['filters']),_0x7dbb07);if(_0x49541c['query'][_0x4e58('0x3b')]){_0x59bf2c[_0x4e58('0x3a')]=_[_0x4e58('0x3c')](_0x59bf2c[_0x4e58('0x3a')],{'$or':_['map'](_0x7dbb07,function(_0x3658a3){if(_0x3658a3[_0x4e58('0x3d')]!==_0x4e58('0x3e')){var _0x407e36={};_0x407e36[_0x3658a3[_0x4e58('0x29')]]={'$like':'%'+_0x49541c[_0x4e58('0x30')][_0x4e58('0x3b')]+'%'};return _0x407e36;}})});}_0x59bf2c=_[_0x4e58('0x3c')]({},_0x59bf2c,_0x49541c[_0x4e58('0x3f')]);var _0x287dc8={'where':_0x59bf2c[_0x4e58('0x3a')]};return db[_0x4e58('0x2b')][_0x4e58('0x1e')](_0x287dc8)['then'](function(_0x42620b){_0x2ffd9e[_0x4e58('0x1e')]=_0x42620b;if(_0x49541c[_0x4e58('0x30')][_0x4e58('0x40')]){_0x59bf2c[_0x4e58('0x41')]=[{'all':!![]}];}return db[_0x4e58('0x2b')][_0x4e58('0x42')](_0x59bf2c);})[_0x4e58('0x25')](function(_0x2396af){_0x2ffd9e[_0x4e58('0x43')]=_0x2396af;return _0x2ffd9e;})['then'](respondWithFilteredResult(_0x4a4e09,_0x59bf2c))[_0x4e58('0x44')](handleError(_0x4a4e09,null));};exports[_0x4e58('0x45')]=function(_0x50c88b,_0x1d5c16){var _0x45987f={'raw':![],'where':{'id':_0x50c88b[_0x4e58('0x46')]['id']}},_0x2afcc1={};_0x2afcc1['model']=_[_0x4e58('0x31')](db[_0x4e58('0x2b')]['rawAttributes']);_0x2afcc1[_0x4e58('0x30')]=_['keys'](_0x50c88b[_0x4e58('0x30')]);_0x2afcc1[_0x4e58('0x32')]=_['intersection'](_0x2afcc1[_0x4e58('0x2f')],_0x2afcc1['query']);_0x45987f[_0x4e58('0x34')]=_[_0x4e58('0x33')](_0x2afcc1['model'],qs[_0x4e58('0x35')](_0x50c88b[_0x4e58('0x30')][_0x4e58('0x35')]));_0x45987f[_0x4e58('0x34')]=_0x45987f['attributes'][_0x4e58('0x47')]?_0x45987f['attributes']:_0x2afcc1[_0x4e58('0x2f')];if(_0x50c88b[_0x4e58('0x30')][_0x4e58('0x40')]){_0x45987f[_0x4e58('0x41')]=[{'all':!![]}];}_0x45987f=_[_0x4e58('0x3c')]({},_0x45987f,_0x50c88b[_0x4e58('0x3f')]);return db[_0x4e58('0x2b')][_0x4e58('0x48')](_0x45987f)['then'](handleEntityNotFound(_0x1d5c16,null))[_0x4e58('0x25')](respondWithResult(_0x1d5c16,null))[_0x4e58('0x44')](handleError(_0x1d5c16,null));};exports['create']=function(_0x599a4c,_0x4b6b9a){return db[_0x4e58('0x2b')]['create'](_0x599a4c[_0x4e58('0x49')],{})['then'](respondWithResult(_0x4b6b9a,0xc9))[_0x4e58('0x44')](handleError(_0x4b6b9a,null));};exports[_0x4e58('0x23')]=function(_0x51f0bd,_0x1ea86d){if(_0x51f0bd[_0x4e58('0x49')]['id']){delete _0x51f0bd[_0x4e58('0x49')]['id'];}return db['ZohoAccount'][_0x4e58('0x48')]({'where':{'id':_0x51f0bd[_0x4e58('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ea86d,null))[_0x4e58('0x25')](saveUpdates(_0x51f0bd['body'],null))[_0x4e58('0x25')](respondWithResult(_0x1ea86d,null))[_0x4e58('0x44')](handleError(_0x1ea86d,null));};exports[_0x4e58('0x24')]=function(_0x57bd96,_0x54317c){return db['ZohoAccount']['find']({'where':{'id':_0x57bd96[_0x4e58('0x46')]['id']}})['then'](handleEntityNotFound(_0x54317c,null))['then'](removeEntity(_0x54317c,null))[_0x4e58('0x44')](handleError(_0x54317c,null));};exports['getConfigurations']=function(_0x16d31b,_0x42bce3,_0x1a6de3){var _0x3141ae={};var _0x39ba70={};var _0x461c8f;var _0x5338d0;return db['ZohoAccount'][_0x4e58('0x4a')]({'where':{'id':_0x16d31b[_0x4e58('0x46')]['id']}})[_0x4e58('0x25')](handleEntityNotFound(_0x42bce3,null))['then'](function(_0x1dc64d){if(_0x1dc64d){_0x461c8f=_0x1dc64d;_0x39ba70[_0x4e58('0x2f')]=_[_0x4e58('0x31')](db[_0x4e58('0x4b')][_0x4e58('0x2c')]);_0x39ba70['query']=_['keys'](_0x16d31b[_0x4e58('0x30')]);_0x39ba70[_0x4e58('0x32')]=_['intersection'](_0x39ba70[_0x4e58('0x2f')],_0x39ba70[_0x4e58('0x30')]);_0x3141ae[_0x4e58('0x34')]=_['intersection'](_0x39ba70[_0x4e58('0x2f')],qs[_0x4e58('0x35')](_0x16d31b[_0x4e58('0x30')][_0x4e58('0x35')]));_0x3141ae[_0x4e58('0x34')]=_0x3141ae[_0x4e58('0x34')][_0x4e58('0x47')]?_0x3141ae[_0x4e58('0x34')]:_0x39ba70[_0x4e58('0x2f')];_0x3141ae[_0x4e58('0x38')]=qs[_0x4e58('0x39')](_0x16d31b['query'][_0x4e58('0x39')]);_0x3141ae[_0x4e58('0x3a')]=qs[_0x4e58('0x32')](_[_0x4e58('0x4c')](_0x16d31b[_0x4e58('0x30')],_0x39ba70[_0x4e58('0x32')]));if(_0x16d31b['query'][_0x4e58('0x3b')]){_0x3141ae[_0x4e58('0x3a')]=_['merge'](_0x3141ae[_0x4e58('0x3a')],{'$or':_[_0x4e58('0x2a')](_0x3141ae[_0x4e58('0x34')],function(_0x32db56){var _0x4aa781={};_0x4aa781[_0x32db56]={'$like':'%'+_0x16d31b[_0x4e58('0x30')][_0x4e58('0x3b')]+'%'};return _0x4aa781;})});}_0x3141ae=_[_0x4e58('0x3c')]({},_0x3141ae,_0x16d31b[_0x4e58('0x3f')]);return _0x461c8f[_0x4e58('0x4d')](_0x3141ae);}})[_0x4e58('0x25')](function(_0x1c2cac){if(_0x1c2cac){_0x5338d0=_0x1c2cac[_0x4e58('0x47')];if(!_0x16d31b[_0x4e58('0x30')]['hasOwnProperty'](_0x4e58('0x37'))){_0x3141ae[_0x4e58('0x1d')]=qs[_0x4e58('0x1d')](_0x16d31b[_0x4e58('0x30')][_0x4e58('0x1d')]);_0x3141ae[_0x4e58('0x1b')]=qs['offset'](_0x16d31b[_0x4e58('0x30')][_0x4e58('0x1b')]);}return _0x461c8f[_0x4e58('0x4d')](_0x3141ae);}})[_0x4e58('0x25')](function(_0x2131df){if(_0x2131df){return _0x2131df?{'count':_0x5338d0,'rows':_0x2131df}:null;}})[_0x4e58('0x25')](respondWithResult(_0x42bce3,null))['catch'](handleError(_0x42bce3,null));};exports['addConfiguration']=function(_0x3476f2,_0x925ed1,_0x4e5742){if(_0x3476f2[_0x4e58('0x49')]['id']){delete _0x3476f2['body']['id'];}return db[_0x4e58('0x2b')][_0x4e58('0x4a')]({'where':{'id':_0x3476f2[_0x4e58('0x46')]['id']}})[_0x4e58('0x25')](handleEntityNotFound(_0x925ed1,null))[_0x4e58('0x25')](function(_0x15ad7a){if(_0x15ad7a){_0x3476f2[_0x4e58('0x49')][_0x4e58('0x4e')]=_0x15ad7a['id'];_0x3476f2[_0x4e58('0x49')][_0x4e58('0x4f')]=integrations[_0x4e58('0x50')](_0x3476f2[_0x4e58('0x49')][_0x4e58('0x51')],_0x3476f2[_0x4e58('0x49')][_0x4e58('0x3d')]);_0x3476f2[_0x4e58('0x49')][_0x4e58('0x52')]=integrations['getDescriptions'](_0x3476f2[_0x4e58('0x49')][_0x4e58('0x51')],_0x3476f2[_0x4e58('0x49')][_0x4e58('0x3d')]);return db[_0x4e58('0x4b')]['create'](_0x3476f2['body'],{'include':[{'model':db[_0x4e58('0x53')],'as':_0x4e58('0x4f')},{'model':db[_0x4e58('0x53')],'as':_0x4e58('0x52')}]});}return null;})['then'](respondWithResult(_0x925ed1,null))['catch'](handleError(_0x925ed1,null));};function getAccessToken(_0x56726d){return new Promise(function(_0x23d827,_0xc7d59c){var _0x29ca4f;switch(_0x56726d[_0x4e58('0x54')]){case'US':_0x29ca4f=_0x4e58('0x55');break;case'AU':_0x29ca4f=_0x4e58('0x56');break;case'EU':_0x29ca4f=_0x4e58('0x57');break;case'IN':_0x29ca4f=_0x4e58('0x58');break;case'CN':_0x29ca4f='https://accounts.zoho.com.cn';break;default:_0x29ca4f='https://accounts.zoho.eu';break;}var _0x124676={'method':_0x4e58('0x59'),'uri':_0x29ca4f+_0x4e58('0x5a'),'qs':{'refresh_token':_0x56726d['refreshToken'],'client_id':_0x56726d[_0x4e58('0x5b')],'client_secret':_0x56726d[_0x4e58('0x5c')],'grant_type':_0x4e58('0x5d')},'json':!![]};return rp(_0x124676)[_0x4e58('0x25')](function(_0x364c33){if(_0x364c33[_0x4e58('0x5e')]){_0x23d827(_0x364c33[_0x4e58('0x5e')]);}else{_0xc7d59c(_0x4e58('0x5f'));}})['catch'](function(_0x557b8b){_0xc7d59c(_0x557b8b);});});}exports[_0x4e58('0x60')]=function(_0x5026c1,_0x284c91,_0x4fee3b){var _0x40b88c,_0x2fe5d5,_0x309ab4,_0x267551,_0x390929;return db[_0x4e58('0x2b')][_0x4e58('0x4a')]({'where':{'id':_0x5026c1['params']['id']},'attributes':['id','host',_0x4e58('0x54'),'clientId',_0x4e58('0x5c'),_0x4e58('0x61'),_0x4e58('0x62'),'refreshToken']})[_0x4e58('0x25')](handleEntityNotFound(_0x284c91,null))[_0x4e58('0x25')](function(_0x40b338){_0x390929=_0x40b338;_0x40b88c=_0x390929['host'];_0x2fe5d5=_0x40b88c===_0x4e58('0x63')?'eu':'com';_0x309ab4=_0x390929[_0x4e58('0x61')];var _0xe5061e=_0x309ab4['slice'](-0x1);if(_0xe5061e==='/'||_0xe5061e==='\x5c'||_0xe5061e===':'){_0x309ab4=_0x309ab4[_0x4e58('0x64')](0x0,_0x309ab4[_0x4e58('0x65')](_0xe5061e));}if(!_0x390929[_0x4e58('0x66')]){throw new Error(_0x4e58('0x67'));}return getAccessToken(_0x390929);})[_0x4e58('0x25')](function(_0x5c063b){if(_0x5c063b){return rp({'method':_0x4e58('0x68'),'uri':util[_0x4e58('0x69')](_0x4e58('0x6a'),_0x2fe5d5),'qs':{'module':_0x4e58('0x6b')},'headers':{'Authorization':_0x4e58('0x6c')+_0x5c063b},'json':!![]});}})[_0x4e58('0x25')](function(_0x3de8a9){if(_0x3de8a9){if(_0x3de8a9[_0x4e58('0x6d')]&&_0x3de8a9['response'][_0x4e58('0x27')]){throw new Error(_0x3de8a9[_0x4e58('0x6d')][_0x4e58('0x27')]['message']);}var _0x12f2e6=[];var _0x426109=[];var _0x1e747c=[_0x4e58('0x6e'),_0x4e58('0x6f'),'Description','WhoId',_0x4e58('0x70'),'Call_Result','Call_Start_Time',_0x4e58('0x71')];_0x426109=_['remove'](_0x3de8a9[_0x4e58('0x35')],function(_0x4fefee){return _0x1e747c[_0x4e58('0x72')](_0x4fefee[_0x4e58('0x73')]);});for(var _0x4c8cea=0x0;_0x4c8cea<_0x426109[_0x4e58('0x47')];_0x4c8cea++){if(_0x426109[_0x4c8cea]['system_mandatory']===![]){_0x12f2e6[_0x4e58('0x74')]({'id':_0x426109[_0x4c8cea]['id'],'name':_0x426109[_0x4c8cea][_0x4e58('0x75')],'custom':_0x426109[_0x4c8cea][_0x4e58('0x76')],'options':_0x426109[_0x4c8cea][_0x4e58('0x77')]===_0x4e58('0x78')&&_0x426109[_0x4c8cea][_0x4e58('0x79')]['length']>-0x1?_[_0x4e58('0x2a')](_0x426109[_0x4c8cea][_0x4e58('0x79')],function(_0x25fd58){return{'name':_0x25fd58,'value':_0x25fd58};}):[]});}}return{'count':_0x12f2e6[_0x4e58('0x47')],'rows':_0x12f2e6};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x284c91,null))['catch'](function(_0x3bac46){var _0x1a0c9f=_0x5026c1['query'][_0x4e58('0x7a')]?0x1f4:_0x3bac46[_0x4e58('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1a0c9f,JSON[_0x4e58('0x7c')](_0x3bac46));delete _0x3bac46[_0x4e58('0x29')];if(_0x1a0c9f===0x191){_0x1a0c9f=0x190;}_0x284c91[_0x4e58('0x18')](_0x1a0c9f)[_0x4e58('0x7d')](_0x5026c1['query'][_0x4e58('0x7a')]?{'message':_0x4e58('0x7e'),'statusCode':_0x3bac46[_0x4e58('0x7b')]}:_0x3bac46);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ea02003..b0e8214 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 _0xda04=['info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','error','lastIndexOf','https://accounts.zoho.com.cn','then','catch','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','parse','refresh_token','refreshToken'];(function(_0x311c98,_0x42aee0){var _0x27b9d4=function(_0x3074cd){while(--_0x3074cd){_0x311c98['push'](_0x311c98['shift']());}};_0x27b9d4(++_0x42aee0);}(_0xda04,0x185));var _0x4da0=function(_0x3f670b,_0x10f414){_0x3f670b=_0x3f670b-0x0;var _0x1c0978=_0xda04[_0x3f670b];return _0x1c0978;};'use strict';var _=require(_0x4da0('0x0'));var util=require(_0x4da0('0x1'));var logger=require('../../config/logger')(_0x4da0('0x2'));var moment=require(_0x4da0('0x3'));var BPromise=require(_0x4da0('0x4'));var rp=require(_0x4da0('0x5'));var fs=require('fs');var path=require(_0x4da0('0x6'));var rimraf=require(_0x4da0('0x7'));var config=require(_0x4da0('0x8'));var attributes=require(_0x4da0('0x9'));var integrations=require(_0x4da0('0xa'));module[_0x4da0('0xb')]=function(_0x440428,_0x38b09f){return _0x440428['define'](_0x4da0('0xc'),attributes,{'tableName':_0x4da0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a933e,_0x406252,_0x5dacfa){if(_0x3a933e[_0x4da0('0xe')](_0x4da0('0xf'))||_0x3a933e[_0x4da0('0xe')](_0x4da0('0x10'))||_0x3a933e[_0x4da0('0xe')](_0x4da0('0x11'))||_0x3a933e[_0x4da0('0xe')](_0x4da0('0x12'))||_0x3a933e[_0x4da0('0xe')](_0x4da0('0x13'))||_0x3a933e['changed']('host')){var _0x199424,_0x28918e;_0x199424=_0x3a933e[_0x4da0('0x10')];var _0x109d6b=_0x199424[_0x4da0('0x14')](-0x1);if(_0x109d6b==='/'||_0x109d6b==='\x5c'||_0x109d6b===':'){_0x199424=_0x199424[_0x4da0('0x15')](0x0,_0x199424['lastIndexOf'](_0x109d6b));}switch(_0x3a933e[_0x4da0('0xf')]){case'US':_0x28918e=_0x4da0('0x16');break;case'AU':_0x28918e=_0x4da0('0x17');break;case'IN':_0x28918e=_0x4da0('0x18');break;case'CN':_0x28918e='https://accounts.zoho.com.cn';break;default:_0x28918e=_0x4da0('0x19');break;}var _0x5a59e6={'method':_0x4da0('0x1a'),'uri':_0x28918e+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3a933e['clientId'],'client_secret':_0x3a933e[_0x4da0('0x12')],'redirect_uri':_0x3a933e[_0x4da0('0x10')],'code':_0x3a933e['code']},'headers':{'Content-Type':_0x4da0('0x1b')}};return rp(_0x5a59e6)['then'](function(_0x229aed){var _0x3a9808=JSON[_0x4da0('0x1c')](_0x229aed);if(_0x3a9808[_0x4da0('0x1d')]){_0x3a933e[_0x4da0('0x1e')]=_0x3a9808[_0x4da0('0x1d')];logger[_0x4da0('0x1f')](util[_0x4da0('0x20')](_0x4da0('0x21'),_0x3a933e[_0x4da0('0x22')],_0x3a933e['id']));}else{logger['error'](util[_0x4da0('0x20')](_0x4da0('0x23'),_0x3a933e['name'],_0x3a933e['id']),util[_0x4da0('0x24')](_0x3a9808,{'showHidden':![],'depth':null}));}return _0x5dacfa(null,_0x406252);})['catch'](function(_0x54d373){logger[_0x4da0('0x25')](util[_0x4da0('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3a933e[_0x4da0('0x22')],_0x3a933e['id']),util[_0x4da0('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5dacfa(_0x54d373);});}else{return _0x5dacfa(null,_0x406252);}},'beforeUpdate':function(_0x1fae49,_0x173bec,_0xc09bca){if(_0x1fae49[_0x4da0('0xe')](_0x4da0('0xf'))||_0x1fae49[_0x4da0('0xe')](_0x4da0('0x10'))||_0x1fae49[_0x4da0('0xe')]('clientId')||_0x1fae49['changed']('clientSecret')||_0x1fae49['changed'](_0x4da0('0x13'))||_0x1fae49[_0x4da0('0xe')]('host')){var _0x477c62,_0x2d1393;_0x477c62=_0x1fae49['serverUrl'];var _0x195148=_0x477c62[_0x4da0('0x14')](-0x1);if(_0x195148==='/'||_0x195148==='\x5c'||_0x195148===':'){_0x477c62=_0x477c62['substring'](0x0,_0x477c62[_0x4da0('0x26')](_0x195148));}switch(_0x1fae49['zone']){case'US':_0x2d1393=_0x4da0('0x16');break;case'AU':_0x2d1393=_0x4da0('0x17');break;case'IN':_0x2d1393=_0x4da0('0x18');break;case'CN':_0x2d1393=_0x4da0('0x27');break;default:_0x2d1393=_0x4da0('0x19');break;}var _0x463f34={'method':_0x4da0('0x1a'),'uri':_0x2d1393+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x1fae49[_0x4da0('0x11')],'client_secret':_0x1fae49[_0x4da0('0x12')],'redirect_uri':_0x1fae49[_0x4da0('0x10')],'code':_0x1fae49[_0x4da0('0x13')]},'headers':{'Content-Type':_0x4da0('0x1b')}};return rp(_0x463f34)[_0x4da0('0x28')](function(_0x4aea9c){var _0x30fea0=JSON['parse'](_0x4aea9c);if(_0x30fea0['refresh_token']){_0x1fae49['refreshToken']=_0x30fea0[_0x4da0('0x1d')];logger['info'](util[_0x4da0('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1fae49[_0x4da0('0x22')],_0x1fae49['id']));}else{logger[_0x4da0('0x25')](util[_0x4da0('0x20')](_0x4da0('0x23'),_0x1fae49[_0x4da0('0x22')],_0x1fae49['id']),util['inspect'](_0x30fea0,{'showHidden':![],'depth':null}));}return _0xc09bca(null,_0x173bec);})[_0x4da0('0x29')](function(_0x3c353a){logger[_0x4da0('0x25')](util[_0x4da0('0x20')](_0x4da0('0x23'),_0x1fae49[_0x4da0('0x22')],_0x1fae49['id']),util[_0x4da0('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0xc09bca(_0x3c353a);});}else{return _0xc09bca(null,_0x173bec);}}}});}; \ No newline at end of file +var _0x553e=['https://accounts.zoho.in','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x239aca,_0x568845){var _0xde5a01=function(_0x60222){while(--_0x60222){_0x239aca['push'](_0x239aca['shift']());}};_0xde5a01(++_0x568845);}(_0x553e,0x1d6));var _0xe553=function(_0xb4dafc,_0x1d1e6f){_0xb4dafc=_0xb4dafc-0x0;var _0xa71a53=_0x553e[_0xb4dafc];return _0xa71a53;};'use strict';var _=require(_0xe553('0x0'));var util=require(_0xe553('0x1'));var logger=require(_0xe553('0x2'))(_0xe553('0x3'));var moment=require('moment');var BPromise=require(_0xe553('0x4'));var rp=require(_0xe553('0x5'));var fs=require('fs');var path=require(_0xe553('0x6'));var rimraf=require(_0xe553('0x7'));var config=require(_0xe553('0x8'));var attributes=require(_0xe553('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xe553('0xa')]=function(_0x578a54,_0x39dbfa){return _0x578a54[_0xe553('0xb')](_0xe553('0xc'),attributes,{'tableName':_0xe553('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2abce3,_0x2b8637,_0x992edd){if(_0x2abce3[_0xe553('0xe')]('zone')||_0x2abce3['changed'](_0xe553('0xf'))||_0x2abce3['changed'](_0xe553('0x10'))||_0x2abce3[_0xe553('0xe')](_0xe553('0x11'))||_0x2abce3[_0xe553('0xe')](_0xe553('0x12'))||_0x2abce3[_0xe553('0xe')](_0xe553('0x13'))){var _0x5b18dd,_0xe3387;_0x5b18dd=_0x2abce3[_0xe553('0xf')];var _0x382277=_0x5b18dd[_0xe553('0x14')](-0x1);if(_0x382277==='/'||_0x382277==='\x5c'||_0x382277===':'){_0x5b18dd=_0x5b18dd[_0xe553('0x15')](0x0,_0x5b18dd['lastIndexOf'](_0x382277));}switch(_0x2abce3[_0xe553('0x16')]){case'US':_0xe3387=_0xe553('0x17');break;case'AU':_0xe3387=_0xe553('0x18');break;case'IN':_0xe3387=_0xe553('0x19');break;case'CN':_0xe3387='https://accounts.zoho.com.cn';break;default:_0xe3387='https://accounts.zoho.eu';break;}var _0x2a1b93={'method':_0xe553('0x1a'),'uri':_0xe3387+'/oauth/v2/token','form':{'grant_type':_0xe553('0x1b'),'client_id':_0x2abce3[_0xe553('0x10')],'client_secret':_0x2abce3[_0xe553('0x11')],'redirect_uri':_0x2abce3[_0xe553('0xf')],'code':_0x2abce3[_0xe553('0x12')]},'headers':{'Content-Type':_0xe553('0x1c')}};return rp(_0x2a1b93)[_0xe553('0x1d')](function(_0x4c223c){var _0x4a49ac=JSON[_0xe553('0x1e')](_0x4c223c);if(_0x4a49ac[_0xe553('0x1f')]){_0x2abce3[_0xe553('0x20')]=_0x4a49ac[_0xe553('0x1f')];logger[_0xe553('0x21')](util[_0xe553('0x22')](_0xe553('0x23'),_0x2abce3[_0xe553('0x24')],_0x2abce3['id']));}else{logger[_0xe553('0x25')](util[_0xe553('0x22')](_0xe553('0x26'),_0x2abce3['name'],_0x2abce3['id']),util[_0xe553('0x27')](_0x4a49ac,{'showHidden':![],'depth':null}));}return _0x992edd(null,_0x2b8637);})[_0xe553('0x28')](function(_0x35e895){logger[_0xe553('0x25')](util[_0xe553('0x22')](_0xe553('0x26'),_0x2abce3[_0xe553('0x24')],_0x2abce3['id']),util[_0xe553('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x992edd(_0x35e895);});}else{return _0x992edd(null,_0x2b8637);}},'beforeUpdate':function(_0x3969fd,_0x13da75,_0x587288){if(_0x3969fd[_0xe553('0xe')](_0xe553('0x16'))||_0x3969fd[_0xe553('0xe')](_0xe553('0xf'))||_0x3969fd['changed']('clientId')||_0x3969fd[_0xe553('0xe')](_0xe553('0x11'))||_0x3969fd[_0xe553('0xe')]('code')||_0x3969fd[_0xe553('0xe')]('host')){var _0x1cb325,_0x3c4469;_0x1cb325=_0x3969fd[_0xe553('0xf')];var _0x590320=_0x1cb325[_0xe553('0x14')](-0x1);if(_0x590320==='/'||_0x590320==='\x5c'||_0x590320===':'){_0x1cb325=_0x1cb325[_0xe553('0x15')](0x0,_0x1cb325[_0xe553('0x29')](_0x590320));}switch(_0x3969fd[_0xe553('0x16')]){case'US':_0x3c4469=_0xe553('0x17');break;case'AU':_0x3c4469=_0xe553('0x18');break;case'IN':_0x3c4469=_0xe553('0x19');break;case'CN':_0x3c4469=_0xe553('0x2a');break;default:_0x3c4469=_0xe553('0x2b');break;}var _0x15a232={'method':'POST','uri':_0x3c4469+_0xe553('0x2c'),'form':{'grant_type':_0xe553('0x1b'),'client_id':_0x3969fd[_0xe553('0x10')],'client_secret':_0x3969fd['clientSecret'],'redirect_uri':_0x3969fd[_0xe553('0xf')],'code':_0x3969fd[_0xe553('0x12')]},'headers':{'Content-Type':_0xe553('0x1c')}};return rp(_0x15a232)['then'](function(_0x124425){var _0xadf994=JSON[_0xe553('0x1e')](_0x124425);if(_0xadf994[_0xe553('0x1f')]){_0x3969fd['refreshToken']=_0xadf994[_0xe553('0x1f')];logger[_0xe553('0x21')](util[_0xe553('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3969fd[_0xe553('0x24')],_0x3969fd['id']));}else{logger['error'](util[_0xe553('0x22')](_0xe553('0x26'),_0x3969fd[_0xe553('0x24')],_0x3969fd['id']),util['inspect'](_0xadf994,{'showHidden':![],'depth':null}));}return _0x587288(null,_0x13da75);})[_0xe553('0x28')](function(_0x29265f){logger[_0xe553('0x25')](util[_0xe553('0x22')](_0xe553('0x26'),_0x3969fd[_0xe553('0x24')],_0x3969fd['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x587288(_0x29265f);});}else{return _0x587288(null,_0x13da75);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index c4e0fc1..05c031b 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 _0xa3eb=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','map','model','attributes','catch','ShowZohoAccount','find','lodash'];(function(_0x2ff756,_0x44d619){var _0x186ae0=function(_0x303db3){while(--_0x303db3){_0x2ff756['push'](_0x2ff756['shift']());}};_0x186ae0(++_0x44d619);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa3eb[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var moment=require(_0xba3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xba3e('0x3'));var fs=require('fs');var Redis=require(_0xba3e('0x4'));var db=require(_0xba3e('0x5'))['db'];var utils=require(_0xba3e('0x6'));var logger=require(_0xba3e('0x7'))(_0xba3e('0x8'));var config=require(_0xba3e('0x9'));var jayson=require(_0xba3e('0xa'));var client=jayson[_0xba3e('0xb')][_0xba3e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf24b63,_0x426127,_0x3d1403){return new BPromise(function(_0xd7ea8d,_0x2e8339){return client[_0xba3e('0xd')](_0xf24b63,_0x3d1403)[_0xba3e('0xe')](function(_0x1722bc){logger[_0xba3e('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x426127,_0xba3e('0x10'));logger[_0xba3e('0x11')](_0xba3e('0x12'),_0x426127,'request\x20sent',JSON[_0xba3e('0x13')](_0x1722bc));if(_0x1722bc[_0xba3e('0x14')]){if(_0x1722bc[_0xba3e('0x14')][_0xba3e('0x15')]===0x1f4){logger[_0xba3e('0x14')](_0xba3e('0x16'),_0x426127,_0x1722bc[_0xba3e('0x14')][_0xba3e('0x17')]);return _0x2e8339(_0x1722bc['error']['message']);}logger[_0xba3e('0x14')](_0xba3e('0x16'),_0x426127,_0x1722bc[_0xba3e('0x14')]['message']);return _0xd7ea8d(_0x1722bc[_0xba3e('0x14')][_0xba3e('0x17')]);}else{logger['info'](_0xba3e('0x16'),_0x426127,_0xba3e('0x10'));_0xd7ea8d(_0x1722bc[_0xba3e('0x18')]['message']);}})['catch'](function(_0x3e0b33){logger['error'](_0xba3e('0x16'),_0x426127,_0x3e0b33);_0x2e8339(_0x3e0b33);});});}exports[_0xba3e('0x19')]=function(_0x37c8c9){var _0x37b74b=this;return new Promise(function(_0x241606,_0xca50ea){return db[_0xba3e('0x1a')][_0xba3e('0x1b')]({'raw':_0x37c8c9['options']?_0x37c8c9[_0xba3e('0x1c')][_0xba3e('0x1d')]===undefined?!![]:![]:!![],'where':_0x37c8c9[_0xba3e('0x1c')]?_0x37c8c9[_0xba3e('0x1c')][_0xba3e('0x1e')]||null:null,'attributes':_0x37c8c9[_0xba3e('0x1c')]?_0x37c8c9[_0xba3e('0x1c')]['attributes']||null:null,'limit':_0x37c8c9[_0xba3e('0x1c')]?_0x37c8c9[_0xba3e('0x1c')]['limit']||null:null,'include':_0x37c8c9['options']?_0x37c8c9['options'][_0xba3e('0x1f')]?_[_0xba3e('0x20')](_0x37c8c9['options'][_0xba3e('0x1f')],function(_0x570fc9){return{'model':db[_0x570fc9[_0xba3e('0x21')]],'as':_0x570fc9['as'],'attributes':_0x570fc9[_0xba3e('0x22')],'include':_0x570fc9[_0xba3e('0x1f')]?_[_0xba3e('0x20')](_0x570fc9[_0xba3e('0x1f')],function(_0x4190ab){return{'model':db[_0x4190ab[_0xba3e('0x21')]],'as':_0x4190ab['as'],'attributes':_0x4190ab[_0xba3e('0x22')],'include':_0x4190ab[_0xba3e('0x1f')]?_[_0xba3e('0x20')](_0x4190ab[_0xba3e('0x1f')],function(_0xbb2a3c){return{'model':db[_0xbb2a3c['model']],'as':_0xbb2a3c['as'],'attributes':_0xbb2a3c[_0xba3e('0x22')]};}):[]};}):[]};}):[]:[]})[_0xba3e('0xe')](function(_0x303e30){logger['info'](_0xba3e('0x19'),_0x37c8c9);logger['debug']('GetZohoAccount',_0x37c8c9,JSON[_0xba3e('0x13')](_0x303e30));_0x241606(_0x303e30);})[_0xba3e('0x23')](function(_0x26a025){logger['error'](_0xba3e('0x19'),_0x26a025[_0xba3e('0x17')],_0x37c8c9);_0xca50ea(_0x37b74b[_0xba3e('0x14')](0x1f4,_0x26a025[_0xba3e('0x17')]));});});};exports[_0xba3e('0x24')]=function(_0x21055e){var _0x1cef69=this;return new Promise(function(_0x6f0abb,_0x266041){return db[_0xba3e('0x1a')][_0xba3e('0x25')]({'raw':_0x21055e[_0xba3e('0x1c')]?_0x21055e[_0xba3e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x21055e[_0xba3e('0x1c')]?_0x21055e[_0xba3e('0x1c')][_0xba3e('0x1e')]||null:null,'attributes':_0x21055e['options']?_0x21055e[_0xba3e('0x1c')]['attributes']||null:null,'include':_0x21055e[_0xba3e('0x1c')]?_0x21055e[_0xba3e('0x1c')]['include']?_[_0xba3e('0x20')](_0x21055e[_0xba3e('0x1c')][_0xba3e('0x1f')],function(_0x11d5f5){return{'model':db[_0x11d5f5['model']],'as':_0x11d5f5['as'],'attributes':_0x11d5f5[_0xba3e('0x22')],'include':_0x11d5f5['include']?_['map'](_0x11d5f5['include'],function(_0x2ff97f){return{'model':db[_0x2ff97f['model']],'as':_0x2ff97f['as'],'attributes':_0x2ff97f[_0xba3e('0x22')],'include':_0x2ff97f['include']?_['map'](_0x2ff97f['include'],function(_0x273eb8){return{'model':db[_0x273eb8['model']],'as':_0x273eb8['as'],'attributes':_0x273eb8['attributes']};}):[]};}):[]};}):[]:[]})[_0xba3e('0xe')](function(_0x68fe9){logger[_0xba3e('0xf')]('ShowZohoAccount',_0x21055e);logger[_0xba3e('0x11')](_0xba3e('0x24'),_0x21055e,JSON['stringify'](_0x68fe9));_0x6f0abb(_0x68fe9);})[_0xba3e('0x23')](function(_0x32c49a){logger[_0xba3e('0x14')](_0xba3e('0x24'),_0x32c49a[_0xba3e('0x17')],_0x21055e);_0x266041(_0x1cef69[_0xba3e('0x14')](0x1f4,_0x32c49a[_0xba3e('0x17')]));});});}; \ No newline at end of file +var _0x543b=['client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','then','find','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3f266d,_0x6a450f){var _0xb5cbed=function(_0x4f14ad){while(--_0x4f14ad){_0x3f266d['push'](_0x3f266d['shift']());}};_0xb5cbed(++_0x6a450f);}(_0x543b,0x18d));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require('bluebird');var rs=require(_0xb543('0x3'));var fs=require('fs');var Redis=require(_0xb543('0x4'));var db=require(_0xb543('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb543('0x6'))(_0xb543('0x7'));var config=require(_0xb543('0x8'));var jayson=require(_0xb543('0x9'));var client=jayson[_0xb543('0xa')][_0xb543('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x208c95,_0x338142,_0x21bb48){return new BPromise(function(_0x307a74,_0x2a2c1f){return client[_0xb543('0xc')](_0x208c95,_0x21bb48)['then'](function(_0xa94776){logger['info'](_0xb543('0xd'),_0x338142,_0xb543('0xe'));logger[_0xb543('0xf')](_0xb543('0x10'),_0x338142,_0xb543('0xe'),JSON[_0xb543('0x11')](_0xa94776));if(_0xa94776['error']){if(_0xa94776[_0xb543('0x12')][_0xb543('0x13')]===0x1f4){logger[_0xb543('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x338142,_0xa94776[_0xb543('0x12')][_0xb543('0x14')]);return _0x2a2c1f(_0xa94776[_0xb543('0x12')]['message']);}logger['error'](_0xb543('0xd'),_0x338142,_0xa94776[_0xb543('0x12')][_0xb543('0x14')]);return _0x307a74(_0xa94776[_0xb543('0x12')]['message']);}else{logger[_0xb543('0x15')](_0xb543('0xd'),_0x338142,_0xb543('0xe'));_0x307a74(_0xa94776[_0xb543('0x16')]['message']);}})[_0xb543('0x17')](function(_0x5230df){logger[_0xb543('0x12')](_0xb543('0xd'),_0x338142,_0x5230df);_0x2a2c1f(_0x5230df);});});}exports[_0xb543('0x18')]=function(_0x13e268){var _0x595818=this;return new Promise(function(_0x399ce8,_0x403bea){return db[_0xb543('0x19')]['findAll']({'raw':_0x13e268['options']?_0x13e268[_0xb543('0x1a')][_0xb543('0x1b')]===undefined?!![]:![]:!![],'where':_0x13e268[_0xb543('0x1a')]?_0x13e268[_0xb543('0x1a')][_0xb543('0x1c')]||null:null,'attributes':_0x13e268[_0xb543('0x1a')]?_0x13e268[_0xb543('0x1a')][_0xb543('0x1d')]||null:null,'limit':_0x13e268['options']?_0x13e268[_0xb543('0x1a')][_0xb543('0x1e')]||null:null,'include':_0x13e268[_0xb543('0x1a')]?_0x13e268[_0xb543('0x1a')][_0xb543('0x1f')]?_[_0xb543('0x20')](_0x13e268['options']['include'],function(_0x5d4ac2){return{'model':db[_0x5d4ac2['model']],'as':_0x5d4ac2['as'],'attributes':_0x5d4ac2[_0xb543('0x1d')],'include':_0x5d4ac2[_0xb543('0x1f')]?_['map'](_0x5d4ac2['include'],function(_0x426969){return{'model':db[_0x426969[_0xb543('0x21')]],'as':_0x426969['as'],'attributes':_0x426969[_0xb543('0x1d')],'include':_0x426969['include']?_[_0xb543('0x20')](_0x426969['include'],function(_0x2ee119){return{'model':db[_0x2ee119[_0xb543('0x21')]],'as':_0x2ee119['as'],'attributes':_0x2ee119[_0xb543('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb543('0x22')](function(_0x27f68f){logger['info'](_0xb543('0x18'),_0x13e268);logger['debug']('GetZohoAccount',_0x13e268,JSON[_0xb543('0x11')](_0x27f68f));_0x399ce8(_0x27f68f);})[_0xb543('0x17')](function(_0x3cb2ed){logger[_0xb543('0x12')](_0xb543('0x18'),_0x3cb2ed[_0xb543('0x14')],_0x13e268);_0x403bea(_0x595818['error'](0x1f4,_0x3cb2ed[_0xb543('0x14')]));});});};exports['ShowZohoAccount']=function(_0x376fb6){var _0xf47fe4=this;return new Promise(function(_0x2830a8,_0x44f62c){return db['ZohoAccount'][_0xb543('0x23')]({'raw':_0x376fb6['options']?_0x376fb6[_0xb543('0x1a')][_0xb543('0x1b')]===undefined?!![]:![]:!![],'where':_0x376fb6[_0xb543('0x1a')]?_0x376fb6[_0xb543('0x1a')]['where']||null:null,'attributes':_0x376fb6[_0xb543('0x1a')]?_0x376fb6[_0xb543('0x1a')][_0xb543('0x1d')]||null:null,'include':_0x376fb6[_0xb543('0x1a')]?_0x376fb6[_0xb543('0x1a')][_0xb543('0x1f')]?_['map'](_0x376fb6[_0xb543('0x1a')][_0xb543('0x1f')],function(_0xbe3807){return{'model':db[_0xbe3807['model']],'as':_0xbe3807['as'],'attributes':_0xbe3807['attributes'],'include':_0xbe3807[_0xb543('0x1f')]?_[_0xb543('0x20')](_0xbe3807[_0xb543('0x1f')],function(_0x2ff717){return{'model':db[_0x2ff717[_0xb543('0x21')]],'as':_0x2ff717['as'],'attributes':_0x2ff717[_0xb543('0x1d')],'include':_0x2ff717[_0xb543('0x1f')]?_[_0xb543('0x20')](_0x2ff717[_0xb543('0x1f')],function(_0x5c4ad0){return{'model':db[_0x5c4ad0[_0xb543('0x21')]],'as':_0x5c4ad0['as'],'attributes':_0x5c4ad0[_0xb543('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fb62e){logger[_0xb543('0x15')](_0xb543('0x24'),_0x376fb6);logger['debug'](_0xb543('0x24'),_0x376fb6,JSON[_0xb543('0x11')](_0x2fb62e));_0x2830a8(_0x2fb62e);})['catch'](function(_0xcc59d9){logger[_0xb543('0x12')](_0xb543('0x24'),_0xcc59d9['message'],_0x376fb6);_0x44f62c(_0xf47fe4['error'](0x1f4,_0xcc59d9[_0xb543('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index b16e7bb..c39014c 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 _0xaaf4=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id/fields'];(function(_0x488a2b,_0x184543){var _0x257c60=function(_0x1ee98c){while(--_0x1ee98c){_0x488a2b['push'](_0x488a2b['shift']());}};_0x257c60(++_0x184543);}(_0xaaf4,0x8f));var _0x4aaf=function(_0x12f4dd,_0x4533fd){_0x12f4dd=_0x12f4dd-0x0;var _0x326e5b=_0xaaf4[_0x12f4dd];return _0x326e5b;};'use strict';var multer=require(_0x4aaf('0x0'));var util=require('util');var path=require(_0x4aaf('0x1'));var timeout=require('connect-timeout');var express=require(_0x4aaf('0x2'));var router=express[_0x4aaf('0x3')]();var fs_extra=require(_0x4aaf('0x4'));var auth=require(_0x4aaf('0x5'));var interaction=require(_0x4aaf('0x6'));var config=require('../../config/environment');var controller=require(_0x4aaf('0x7'));router[_0x4aaf('0x8')]('/',auth[_0x4aaf('0x9')](),controller['index']);router[_0x4aaf('0x8')]('/:id',auth[_0x4aaf('0x9')](),controller['show']);router[_0x4aaf('0x8')](_0x4aaf('0xa'),auth[_0x4aaf('0x9')](),controller[_0x4aaf('0xb')]);router[_0x4aaf('0x8')](_0x4aaf('0xc'),auth['isAuthenticated'](),controller[_0x4aaf('0xd')]);router['get'](_0x4aaf('0xe'),auth[_0x4aaf('0x9')](),controller[_0x4aaf('0xf')]);router[_0x4aaf('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4aaf('0x11')](_0x4aaf('0x12'),auth[_0x4aaf('0x9')](),controller[_0x4aaf('0x13')]);router['delete'](_0x4aaf('0x12'),auth[_0x4aaf('0x9')](),controller[_0x4aaf('0x14')]);module[_0x4aaf('0x15')]=router; \ No newline at end of file +var _0x43a9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x42182d,_0x125b1a){var _0x26459b=function(_0x1b88ab){while(--_0x1b88ab){_0x42182d['push'](_0x42182d['shift']());}};_0x26459b(++_0x125b1a);}(_0x43a9,0x95));var _0x943a=function(_0x5d8883,_0x42405){_0x5d8883=_0x5d8883-0x0;var _0x3488fe=_0x43a9[_0x5d8883];return _0x3488fe;};'use strict';var multer=require(_0x943a('0x0'));var util=require(_0x943a('0x1'));var path=require(_0x943a('0x2'));var timeout=require(_0x943a('0x3'));var express=require(_0x943a('0x4'));var router=express[_0x943a('0x5')]();var fs_extra=require(_0x943a('0x6'));var auth=require(_0x943a('0x7'));var interaction=require(_0x943a('0x8'));var config=require(_0x943a('0x9'));var controller=require(_0x943a('0xa'));router[_0x943a('0xb')]('/',auth[_0x943a('0xc')](),controller[_0x943a('0xd')]);router['get'](_0x943a('0xe'),auth[_0x943a('0xc')](),controller[_0x943a('0xf')]);router[_0x943a('0xb')]('/:id/fields',auth[_0x943a('0xc')](),controller[_0x943a('0x10')]);router['get']('/:id/subjects',auth[_0x943a('0xc')](),controller[_0x943a('0x11')]);router[_0x943a('0xb')](_0x943a('0x12'),auth[_0x943a('0xc')](),controller['getDescriptions']);router[_0x943a('0x13')]('/',auth['isAuthenticated'](),controller[_0x943a('0x14')]);router[_0x943a('0x15')](_0x943a('0xe'),auth[_0x943a('0xc')](),controller[_0x943a('0x16')]);router[_0x943a('0x17')](_0x943a('0xe'),auth[_0x943a('0xc')](),controller[_0x943a('0x18')]);module[_0x943a('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 98ddb0b..98ecfca 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 _0xa1f7=['contact','sequelize','STRING','ENUM','lead','nothing','contact_lead'];(function(_0x20778c,_0x9c81a0){var _0x32d193=function(_0x43ece6){while(--_0x43ece6){_0x20778c['push'](_0x20778c['shift']());}};_0x32d193(++_0x9c81a0);}(_0xa1f7,0xda));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7a1f('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a1f('0x1')]},'moduleCreate':{'type':Sequelize[_0x7a1f('0x2')](_0x7a1f('0x3'),'contact',_0x7a1f('0x4')),'defaultValue':_0x7a1f('0x3')},'moduleSearch':{'type':Sequelize[_0x7a1f('0x2')](_0x7a1f('0x5'),_0x7a1f('0x6'),_0x7a1f('0x3')),'defaultValue':_0x7a1f('0x5')},'description':{'type':Sequelize[_0x7a1f('0x1')]}}; \ No newline at end of file +var _0xf71d=['contact','sequelize','STRING','ENUM','lead','nothing','contact_lead'];(function(_0x4e1cb4,_0x142964){var _0x5813b3=function(_0x577efc){while(--_0x577efc){_0x4e1cb4['push'](_0x4e1cb4['shift']());}};_0x5813b3(++_0x142964);}(_0xf71d,0xda));var _0xdf71=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xf71d[_0x57add2];return _0x4e3670;};'use strict';var Sequelize=require(_0xdf71('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf71('0x1')]},'moduleCreate':{'type':Sequelize[_0xdf71('0x2')](_0xdf71('0x3'),'contact',_0xdf71('0x4')),'defaultValue':_0xdf71('0x3')},'moduleSearch':{'type':Sequelize[_0xdf71('0x2')](_0xdf71('0x5'),_0xdf71('0x6'),_0xdf71('0x3')),'defaultValue':_0xdf71('0x5')},'description':{'type':Sequelize[_0xdf71('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5742739..7f837d1 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 _0xfbf3=['findAll','rows','catch','show','params','keys','options','find','create','body','destroy','getFields','findOne','length','sort','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','ZohoField','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','order','where','filter','merge','VIRTUAL','includeAll'];(function(_0x158d17,_0x46bc33){var _0x5a0ffd=function(_0x454345){while(--_0x454345){_0x158d17['push'](_0x158d17['shift']());}};_0x5a0ffd(++_0x46bc33);}(_0xfbf3,0x1ef));var _0x3fbf=function(_0x18d833,_0x554ddc){_0x18d833=_0x18d833-0x0;var _0xed0c80=_0xfbf3[_0x18d833];return _0xed0c80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fbf('0x0'));var zipdir=require(_0x3fbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fbf('0x2'));var moment=require('moment');var BPromise=require(_0x3fbf('0x3'));var Mustache=require(_0x3fbf('0x4'));var util=require(_0x3fbf('0x5'));var path=require(_0x3fbf('0x6'));var sox=require(_0x3fbf('0x7'));var csv=require(_0x3fbf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fbf('0x9'));var squel=require(_0x3fbf('0xa'));var crypto=require(_0x3fbf('0xb'));var jsforce=require(_0x3fbf('0xc'));var deskjs=require(_0x3fbf('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3fbf('0xe'));var Redis=require('ioredis');var authService=require(_0x3fbf('0xf'));var qs=require(_0x3fbf('0x10'));var as=require(_0x3fbf('0x11'));var hardwareService=require(_0x3fbf('0x12'));var logger=require(_0x3fbf('0x13'))(_0x3fbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3fbf('0x15'));var db=require(_0x3fbf('0x16'))['db'];function respondWithStatusCode(_0x373e3a,_0x1fefa1){_0x1fefa1=_0x1fefa1||0xcc;return function(_0x5cdfdd){if(_0x5cdfdd){return _0x373e3a[_0x3fbf('0x17')](_0x1fefa1);}return _0x373e3a[_0x3fbf('0x18')](_0x1fefa1)[_0x3fbf('0x19')]();};}function respondWithResult(_0x5791b7,_0x57fe8a){_0x57fe8a=_0x57fe8a||0xc8;return function(_0xf8d092){if(_0xf8d092){return _0x5791b7[_0x3fbf('0x18')](_0x57fe8a)[_0x3fbf('0x1a')](_0xf8d092);}};}function respondWithFilteredResult(_0x1c7675,_0x1f1501){return function(_0x4a59ab){if(_0x4a59ab){var _0x3a577c=typeof _0x1f1501[_0x3fbf('0x1b')]===_0x3fbf('0x1c')&&typeof _0x1f1501[_0x3fbf('0x1d')]===_0x3fbf('0x1c');var _0x34cfdb=_0x4a59ab['count'];var _0x5d06f4=_0x3a577c?0x0:_0x1f1501[_0x3fbf('0x1b')];var _0x15b627=_0x3a577c?_0x4a59ab[_0x3fbf('0x1e')]:_0x1f1501['offset']+_0x1f1501[_0x3fbf('0x1d')];var _0x5f3221;if(_0x15b627>=_0x34cfdb){_0x15b627=_0x34cfdb;_0x5f3221=0xc8;}else{_0x5f3221=0xce;}_0x1c7675[_0x3fbf('0x18')](_0x5f3221);return _0x1c7675[_0x3fbf('0x1f')](_0x3fbf('0x20'),_0x5d06f4+'-'+_0x15b627+'/'+_0x34cfdb)[_0x3fbf('0x1a')](_0x4a59ab);}return null;};}function patchUpdates(_0x354b0d){return function(_0x26c0b1){try{jsonpatch[_0x3fbf('0x21')](_0x26c0b1,_0x354b0d,!![]);}catch(_0x4dc720){return BPromise[_0x3fbf('0x22')](_0x4dc720);}return _0x26c0b1[_0x3fbf('0x23')]();};}function saveUpdates(_0x58ca83,_0x622c97){return function(_0x2b4f03){if(_0x2b4f03){return _0x2b4f03[_0x3fbf('0x24')](_0x58ca83)[_0x3fbf('0x25')](function(_0x4369a0){return _0x4369a0;});}return null;};}function removeEntity(_0x1c4ee7,_0x28bec1){return function(_0x347148){if(_0x347148){return _0x347148['destroy']()[_0x3fbf('0x25')](function(){_0x1c4ee7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31ff72,_0x4f9fcc){return function(_0x33f89a){if(!_0x33f89a){_0x31ff72[_0x3fbf('0x17')](0x194);}return _0x33f89a;};}function handleError(_0x5d83d3,_0x30b3d2){_0x30b3d2=_0x30b3d2||0x1f4;return function(_0x1a00b1){logger['error'](_0x1a00b1[_0x3fbf('0x26')]);if(_0x1a00b1[_0x3fbf('0x27')]){delete _0x1a00b1['name'];}_0x5d83d3['status'](_0x30b3d2)['send'](_0x1a00b1);};}exports[_0x3fbf('0x28')]=function(_0x184b0c,_0x483089){var _0x2cb1b3={},_0xb36ca={},_0x25423b={'count':0x0,'rows':[]};var _0x2cae8=_[_0x3fbf('0x29')](db[_0x3fbf('0x2a')][_0x3fbf('0x2b')],function(_0x562d56){return{'name':_0x562d56[_0x3fbf('0x2c')],'type':_0x562d56['type'][_0x3fbf('0x2d')]};});_0xb36ca['model']=_['map'](_0x2cae8,_0x3fbf('0x27'));_0xb36ca[_0x3fbf('0x2e')]=_['keys'](_0x184b0c[_0x3fbf('0x2e')]);_0xb36ca[_0x3fbf('0x2f')]=_[_0x3fbf('0x30')](_0xb36ca[_0x3fbf('0x31')],_0xb36ca[_0x3fbf('0x2e')]);_0x2cb1b3['attributes']=_[_0x3fbf('0x30')](_0xb36ca['model'],qs['fields'](_0x184b0c[_0x3fbf('0x2e')][_0x3fbf('0x32')]));_0x2cb1b3[_0x3fbf('0x33')]=_0x2cb1b3[_0x3fbf('0x33')]['length']?_0x2cb1b3[_0x3fbf('0x33')]:_0xb36ca[_0x3fbf('0x31')];if(!_0x184b0c[_0x3fbf('0x2e')]['hasOwnProperty']('nolimit')){_0x2cb1b3[_0x3fbf('0x1d')]=qs[_0x3fbf('0x1d')](_0x184b0c['query'][_0x3fbf('0x1d')]);_0x2cb1b3['offset']=qs[_0x3fbf('0x1b')](_0x184b0c[_0x3fbf('0x2e')][_0x3fbf('0x1b')]);}_0x2cb1b3[_0x3fbf('0x34')]=qs['sort'](_0x184b0c[_0x3fbf('0x2e')]['sort']);_0x2cb1b3[_0x3fbf('0x35')]=qs[_0x3fbf('0x2f')](_['pick'](_0x184b0c['query'],_0xb36ca[_0x3fbf('0x2f')]),_0x2cae8);if(_0x184b0c[_0x3fbf('0x2e')][_0x3fbf('0x36')]){_0x2cb1b3['where']=_[_0x3fbf('0x37')](_0x2cb1b3[_0x3fbf('0x35')],{'$or':_[_0x3fbf('0x29')](_0x2cae8,function(_0x2f39e6){if(_0x2f39e6['type']!==_0x3fbf('0x38')){var _0x5cd28f={};_0x5cd28f[_0x2f39e6[_0x3fbf('0x27')]]={'$like':'%'+_0x184b0c['query'][_0x3fbf('0x36')]+'%'};return _0x5cd28f;}})});}_0x2cb1b3=_['merge']({},_0x2cb1b3,_0x184b0c['options']);var _0x52c80e={'where':_0x2cb1b3[_0x3fbf('0x35')]};return db[_0x3fbf('0x2a')][_0x3fbf('0x1e')](_0x52c80e)['then'](function(_0x46f5b4){_0x25423b[_0x3fbf('0x1e')]=_0x46f5b4;if(_0x184b0c[_0x3fbf('0x2e')][_0x3fbf('0x39')]){_0x2cb1b3['include']=[{'all':!![]}];}return db[_0x3fbf('0x2a')][_0x3fbf('0x3a')](_0x2cb1b3);})[_0x3fbf('0x25')](function(_0xaf6eb){_0x25423b[_0x3fbf('0x3b')]=_0xaf6eb;return _0x25423b;})[_0x3fbf('0x25')](respondWithFilteredResult(_0x483089,_0x2cb1b3))[_0x3fbf('0x3c')](handleError(_0x483089,null));};exports[_0x3fbf('0x3d')]=function(_0x21dc1f,_0x1408e7){var _0xd755f9={'raw':![],'where':{'id':_0x21dc1f[_0x3fbf('0x3e')]['id']}},_0x1dbe67={};_0x1dbe67[_0x3fbf('0x31')]=_[_0x3fbf('0x3f')](db[_0x3fbf('0x2a')][_0x3fbf('0x2b')]);_0x1dbe67['query']=_[_0x3fbf('0x3f')](_0x21dc1f[_0x3fbf('0x2e')]);_0x1dbe67[_0x3fbf('0x2f')]=_[_0x3fbf('0x30')](_0x1dbe67['model'],_0x1dbe67[_0x3fbf('0x2e')]);_0xd755f9['attributes']=_['intersection'](_0x1dbe67[_0x3fbf('0x31')],qs[_0x3fbf('0x32')](_0x21dc1f[_0x3fbf('0x2e')]['fields']));_0xd755f9[_0x3fbf('0x33')]=_0xd755f9[_0x3fbf('0x33')]['length']?_0xd755f9[_0x3fbf('0x33')]:_0x1dbe67[_0x3fbf('0x31')];if(_0x21dc1f[_0x3fbf('0x2e')][_0x3fbf('0x39')]){_0xd755f9['include']=[{'all':!![]}];}_0xd755f9=_[_0x3fbf('0x37')]({},_0xd755f9,_0x21dc1f[_0x3fbf('0x40')]);return db[_0x3fbf('0x2a')][_0x3fbf('0x41')](_0xd755f9)['then'](handleEntityNotFound(_0x1408e7,null))[_0x3fbf('0x25')](respondWithResult(_0x1408e7,null))[_0x3fbf('0x3c')](handleError(_0x1408e7,null));};exports['create']=function(_0x385866,_0x18644b){return db[_0x3fbf('0x2a')][_0x3fbf('0x42')](_0x385866[_0x3fbf('0x43')],{})[_0x3fbf('0x25')](respondWithResult(_0x18644b,0xc9))[_0x3fbf('0x3c')](handleError(_0x18644b,null));};exports[_0x3fbf('0x24')]=function(_0x1bc56c,_0x2a22a5){if(_0x1bc56c[_0x3fbf('0x43')]['id']){delete _0x1bc56c[_0x3fbf('0x43')]['id'];}return db[_0x3fbf('0x2a')]['find']({'where':{'id':_0x1bc56c[_0x3fbf('0x3e')]['id']}})[_0x3fbf('0x25')](handleEntityNotFound(_0x2a22a5,null))[_0x3fbf('0x25')](saveUpdates(_0x1bc56c[_0x3fbf('0x43')],null))[_0x3fbf('0x25')](respondWithResult(_0x2a22a5,null))[_0x3fbf('0x3c')](handleError(_0x2a22a5,null));};exports[_0x3fbf('0x44')]=function(_0x3dafe0,_0x5a4299){return db['ZohoConfiguration'][_0x3fbf('0x41')]({'where':{'id':_0x3dafe0[_0x3fbf('0x3e')]['id']}})[_0x3fbf('0x25')](handleEntityNotFound(_0x5a4299,null))[_0x3fbf('0x25')](removeEntity(_0x5a4299,null))[_0x3fbf('0x3c')](handleError(_0x5a4299,null));};exports[_0x3fbf('0x45')]=function(_0x194247,_0x1451c5,_0x3ad986){var _0x1f5df2={};var _0x3761e3={};var _0x4c6502;var _0x99f7b2;return db['ZohoConfiguration'][_0x3fbf('0x46')]({'where':{'id':_0x194247[_0x3fbf('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1451c5,null))[_0x3fbf('0x25')](function(_0x1afbed){if(_0x1afbed){_0x4c6502=_0x1afbed;_0x3761e3[_0x3fbf('0x31')]=_['keys'](db['ZohoField']['rawAttributes']);_0x3761e3[_0x3fbf('0x2e')]=_['keys'](_0x194247[_0x3fbf('0x2e')]);_0x3761e3[_0x3fbf('0x2f')]=_[_0x3fbf('0x30')](_0x3761e3[_0x3fbf('0x31')],_0x3761e3[_0x3fbf('0x2e')]);_0x1f5df2[_0x3fbf('0x33')]=_[_0x3fbf('0x30')](_0x3761e3[_0x3fbf('0x31')],qs['fields'](_0x194247['query'][_0x3fbf('0x32')]));_0x1f5df2[_0x3fbf('0x33')]=_0x1f5df2[_0x3fbf('0x33')][_0x3fbf('0x47')]?_0x1f5df2[_0x3fbf('0x33')]:_0x3761e3['model'];_0x1f5df2[_0x3fbf('0x34')]=qs[_0x3fbf('0x48')](_0x194247[_0x3fbf('0x2e')][_0x3fbf('0x48')]);_0x1f5df2[_0x3fbf('0x35')]=qs[_0x3fbf('0x2f')](_[_0x3fbf('0x49')](_0x194247[_0x3fbf('0x2e')],_0x3761e3[_0x3fbf('0x2f')]));if(_0x194247[_0x3fbf('0x2e')]['filter']){_0x1f5df2[_0x3fbf('0x35')]=_[_0x3fbf('0x37')](_0x1f5df2['where'],{'$or':_[_0x3fbf('0x29')](_0x1f5df2[_0x3fbf('0x33')],function(_0x1d7a13){var _0x56399d={};_0x56399d[_0x1d7a13]={'$like':'%'+_0x194247['query'][_0x3fbf('0x36')]+'%'};return _0x56399d;})});}_0x1f5df2=_[_0x3fbf('0x37')]({},_0x1f5df2,_0x194247['options']);return _0x4c6502['getFields'](_0x1f5df2);}})[_0x3fbf('0x25')](function(_0x503b33){if(_0x503b33){_0x99f7b2=_0x503b33['length'];if(!_0x194247[_0x3fbf('0x2e')][_0x3fbf('0x4a')](_0x3fbf('0x4b'))){_0x1f5df2[_0x3fbf('0x1d')]=qs[_0x3fbf('0x1d')](_0x194247['query'][_0x3fbf('0x1d')]);_0x1f5df2[_0x3fbf('0x1b')]=qs[_0x3fbf('0x1b')](_0x194247[_0x3fbf('0x2e')][_0x3fbf('0x1b')]);}return _0x4c6502[_0x3fbf('0x45')](_0x1f5df2);}})[_0x3fbf('0x25')](function(_0x603e3a){if(_0x603e3a){return _0x603e3a?{'count':_0x99f7b2,'rows':_0x603e3a}:null;}})[_0x3fbf('0x25')](respondWithResult(_0x1451c5,null))[_0x3fbf('0x3c')](handleError(_0x1451c5,null));};exports[_0x3fbf('0x4c')]=function(_0x2d86e2,_0x1e8e11,_0x2e8e32){var _0x19a876={};var _0x49c3c4={};var _0x3d6528;var _0x2dfcce;return db[_0x3fbf('0x2a')][_0x3fbf('0x46')]({'where':{'id':_0x2d86e2['params']['id']}})[_0x3fbf('0x25')](handleEntityNotFound(_0x1e8e11,null))['then'](function(_0x9b5e4){if(_0x9b5e4){_0x3d6528=_0x9b5e4;_0x49c3c4[_0x3fbf('0x31')]=_[_0x3fbf('0x3f')](db['ZohoField']['rawAttributes']);_0x49c3c4[_0x3fbf('0x2e')]=_['keys'](_0x2d86e2[_0x3fbf('0x2e')]);_0x49c3c4['filters']=_['intersection'](_0x49c3c4['model'],_0x49c3c4[_0x3fbf('0x2e')]);_0x19a876[_0x3fbf('0x33')]=_[_0x3fbf('0x30')](_0x49c3c4['model'],qs['fields'](_0x2d86e2['query']['fields']));_0x19a876['attributes']=_0x19a876[_0x3fbf('0x33')][_0x3fbf('0x47')]?_0x19a876[_0x3fbf('0x33')]:_0x49c3c4[_0x3fbf('0x31')];_0x19a876[_0x3fbf('0x34')]=qs[_0x3fbf('0x48')](_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x48')]);_0x19a876[_0x3fbf('0x35')]=qs['filters'](_[_0x3fbf('0x49')](_0x2d86e2[_0x3fbf('0x2e')],_0x49c3c4[_0x3fbf('0x2f')]));if(_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x36')]){_0x19a876[_0x3fbf('0x35')]=_[_0x3fbf('0x37')](_0x19a876[_0x3fbf('0x35')],{'$or':_[_0x3fbf('0x29')](_0x19a876[_0x3fbf('0x33')],function(_0x20a26d){var _0x4ca7aa={};_0x4ca7aa[_0x20a26d]={'$like':'%'+_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x36')]+'%'};return _0x4ca7aa;})});}_0x19a876=_[_0x3fbf('0x37')]({},_0x19a876,_0x2d86e2[_0x3fbf('0x40')]);return _0x3d6528['getSubjects'](_0x19a876);}})[_0x3fbf('0x25')](function(_0x2bc4ac){if(_0x2bc4ac){_0x2dfcce=_0x2bc4ac[_0x3fbf('0x47')];if(!_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x4a')](_0x3fbf('0x4b'))){_0x19a876[_0x3fbf('0x1d')]=qs[_0x3fbf('0x1d')](_0x2d86e2[_0x3fbf('0x2e')]['limit']);_0x19a876[_0x3fbf('0x1b')]=qs[_0x3fbf('0x1b')](_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x1b')]);}return _0x3d6528[_0x3fbf('0x4c')](_0x19a876);}})[_0x3fbf('0x25')](function(_0x539809){if(_0x539809){return _0x539809?{'count':_0x2dfcce,'rows':_0x539809}:null;}})[_0x3fbf('0x25')](respondWithResult(_0x1e8e11,null))[_0x3fbf('0x3c')](handleError(_0x1e8e11,null));};exports[_0x3fbf('0x4d')]=function(_0x2b4954,_0x350e8e,_0x25cebe){var _0xb830c9={};var _0xeaf6ea={};var _0x29c93a;var _0x1076f5;return db[_0x3fbf('0x2a')][_0x3fbf('0x46')]({'where':{'id':_0x2b4954['params']['id']}})['then'](handleEntityNotFound(_0x350e8e,null))[_0x3fbf('0x25')](function(_0x3908bb){if(_0x3908bb){_0x29c93a=_0x3908bb;_0xeaf6ea['model']=_['keys'](db[_0x3fbf('0x4e')][_0x3fbf('0x2b')]);_0xeaf6ea[_0x3fbf('0x2e')]=_[_0x3fbf('0x3f')](_0x2b4954[_0x3fbf('0x2e')]);_0xeaf6ea[_0x3fbf('0x2f')]=_[_0x3fbf('0x30')](_0xeaf6ea[_0x3fbf('0x31')],_0xeaf6ea[_0x3fbf('0x2e')]);_0xb830c9['attributes']=_[_0x3fbf('0x30')](_0xeaf6ea[_0x3fbf('0x31')],qs['fields'](_0x2b4954[_0x3fbf('0x2e')][_0x3fbf('0x32')]));_0xb830c9[_0x3fbf('0x33')]=_0xb830c9[_0x3fbf('0x33')][_0x3fbf('0x47')]?_0xb830c9[_0x3fbf('0x33')]:_0xeaf6ea[_0x3fbf('0x31')];_0xb830c9[_0x3fbf('0x34')]=qs[_0x3fbf('0x48')](_0x2b4954[_0x3fbf('0x2e')]['sort']);_0xb830c9[_0x3fbf('0x35')]=qs['filters'](_['pick'](_0x2b4954['query'],_0xeaf6ea[_0x3fbf('0x2f')]));if(_0x2b4954[_0x3fbf('0x2e')][_0x3fbf('0x36')]){_0xb830c9['where']=_[_0x3fbf('0x37')](_0xb830c9[_0x3fbf('0x35')],{'$or':_[_0x3fbf('0x29')](_0xb830c9[_0x3fbf('0x33')],function(_0xe4c571){var _0x52234e={};_0x52234e[_0xe4c571]={'$like':'%'+_0x2b4954[_0x3fbf('0x2e')]['filter']+'%'};return _0x52234e;})});}_0xb830c9=_[_0x3fbf('0x37')]({},_0xb830c9,_0x2b4954['options']);return _0x29c93a[_0x3fbf('0x4d')](_0xb830c9);}})['then'](function(_0x4435c2){if(_0x4435c2){_0x1076f5=_0x4435c2[_0x3fbf('0x47')];if(!_0x2b4954[_0x3fbf('0x2e')][_0x3fbf('0x4a')]('nolimit')){_0xb830c9['limit']=qs[_0x3fbf('0x1d')](_0x2b4954['query'][_0x3fbf('0x1d')]);_0xb830c9['offset']=qs[_0x3fbf('0x1b')](_0x2b4954[_0x3fbf('0x2e')]['offset']);}return _0x29c93a[_0x3fbf('0x4d')](_0xb830c9);}})['then'](function(_0x528806){if(_0x528806){return _0x528806?{'count':_0x1076f5,'rows':_0x528806}:null;}})[_0x3fbf('0x25')](respondWithResult(_0x350e8e,null))['catch'](handleError(_0x350e8e,null));}; \ No newline at end of file +var _0xf9d3=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','ZohoConfiguration','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','destroy','getFields','findOne','pick','nolimit','getSubjects','ZohoField','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x3bee2a,_0x534863){var _0x2dbdfb=function(_0x2d0d11){while(--_0x2d0d11){_0x3bee2a['push'](_0x3bee2a['shift']());}};_0x2dbdfb(++_0x534863);}(_0xf9d3,0x129));var _0x3f9d=function(_0x3149d2,_0x4a08f9){_0x3149d2=_0x3149d2-0x0;var _0x54e6a9=_0xf9d3[_0x3149d2];return _0x54e6a9;};'use strict';var emlformat=require(_0x3f9d('0x0'));var rimraf=require(_0x3f9d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f9d('0x2'));var rp=require(_0x3f9d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3f9d('0x4'));var util=require('util');var path=require(_0x3f9d('0x5'));var sox=require('sox');var csv=require(_0x3f9d('0x6'));var ejs=require(_0x3f9d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f9d('0x8'));var squel=require(_0x3f9d('0x9'));var crypto=require(_0x3f9d('0xa'));var jsforce=require(_0x3f9d('0xb'));var deskjs=require(_0x3f9d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f9d('0xd'));var Papa=require(_0x3f9d('0xe'));var Redis=require('ioredis');var authService=require(_0x3f9d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3f9d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f9d('0x11'))(_0x3f9d('0x12'));var utils=require(_0x3f9d('0x13'));var config=require(_0x3f9d('0x14'));var licenseUtil=require(_0x3f9d('0x15'));var db=require(_0x3f9d('0x16'))['db'];function respondWithStatusCode(_0x193eba,_0x2e0c72){_0x2e0c72=_0x2e0c72||0xcc;return function(_0x5d362a){if(_0x5d362a){return _0x193eba[_0x3f9d('0x17')](_0x2e0c72);}return _0x193eba['status'](_0x2e0c72)[_0x3f9d('0x18')]();};}function respondWithResult(_0xf680bf,_0x5e961e){_0x5e961e=_0x5e961e||0xc8;return function(_0x562f51){if(_0x562f51){return _0xf680bf[_0x3f9d('0x19')](_0x5e961e)[_0x3f9d('0x1a')](_0x562f51);}};}function respondWithFilteredResult(_0x190d1a,_0x59f5ae){return function(_0x1078d4){if(_0x1078d4){var _0x3a525c=typeof _0x59f5ae['offset']==='undefined'&&typeof _0x59f5ae['limit']==='undefined';var _0x4e425e=_0x1078d4[_0x3f9d('0x1b')];var _0x4eb940=_0x3a525c?0x0:_0x59f5ae[_0x3f9d('0x1c')];var _0x379c56=_0x3a525c?_0x1078d4[_0x3f9d('0x1b')]:_0x59f5ae['offset']+_0x59f5ae[_0x3f9d('0x1d')];var _0x4878e1;if(_0x379c56>=_0x4e425e){_0x379c56=_0x4e425e;_0x4878e1=0xc8;}else{_0x4878e1=0xce;}_0x190d1a['status'](_0x4878e1);return _0x190d1a[_0x3f9d('0x1e')](_0x3f9d('0x1f'),_0x4eb940+'-'+_0x379c56+'/'+_0x4e425e)[_0x3f9d('0x1a')](_0x1078d4);}return null;};}function patchUpdates(_0x57ac41){return function(_0x4f18b1){try{jsonpatch[_0x3f9d('0x20')](_0x4f18b1,_0x57ac41,!![]);}catch(_0x524c95){return BPromise[_0x3f9d('0x21')](_0x524c95);}return _0x4f18b1[_0x3f9d('0x22')]();};}function saveUpdates(_0xf3c9d9,_0x46deb2){return function(_0x2aef0c){if(_0x2aef0c){return _0x2aef0c[_0x3f9d('0x23')](_0xf3c9d9)[_0x3f9d('0x24')](function(_0x261602){return _0x261602;});}return null;};}function removeEntity(_0x3b9b5e,_0x47e89b){return function(_0x50bc8e){if(_0x50bc8e){return _0x50bc8e['destroy']()[_0x3f9d('0x24')](function(){_0x3b9b5e[_0x3f9d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x575149,_0x312e62){return function(_0x33b249){if(!_0x33b249){_0x575149[_0x3f9d('0x17')](0x194);}return _0x33b249;};}function handleError(_0x2380de,_0x52063b){_0x52063b=_0x52063b||0x1f4;return function(_0x58a785){logger['error'](_0x58a785['stack']);if(_0x58a785[_0x3f9d('0x25')]){delete _0x58a785[_0x3f9d('0x25')];}_0x2380de[_0x3f9d('0x19')](_0x52063b)[_0x3f9d('0x26')](_0x58a785);};}exports[_0x3f9d('0x27')]=function(_0x1bf6ac,_0x30bf74){var _0x231dc7={},_0xdc8d5b={},_0x36f7c9={'count':0x0,'rows':[]};var _0x5244cf=_['map'](db[_0x3f9d('0x28')][_0x3f9d('0x29')],function(_0x2954e1){return{'name':_0x2954e1[_0x3f9d('0x2a')],'type':_0x2954e1['type'][_0x3f9d('0x2b')]};});_0xdc8d5b[_0x3f9d('0x2c')]=_[_0x3f9d('0x2d')](_0x5244cf,'name');_0xdc8d5b[_0x3f9d('0x2e')]=_[_0x3f9d('0x2f')](_0x1bf6ac['query']);_0xdc8d5b['filters']=_[_0x3f9d('0x30')](_0xdc8d5b[_0x3f9d('0x2c')],_0xdc8d5b[_0x3f9d('0x2e')]);_0x231dc7[_0x3f9d('0x31')]=_['intersection'](_0xdc8d5b[_0x3f9d('0x2c')],qs[_0x3f9d('0x32')](_0x1bf6ac[_0x3f9d('0x2e')][_0x3f9d('0x32')]));_0x231dc7['attributes']=_0x231dc7[_0x3f9d('0x31')][_0x3f9d('0x33')]?_0x231dc7[_0x3f9d('0x31')]:_0xdc8d5b['model'];if(!_0x1bf6ac[_0x3f9d('0x2e')][_0x3f9d('0x34')]('nolimit')){_0x231dc7[_0x3f9d('0x1d')]=qs[_0x3f9d('0x1d')](_0x1bf6ac[_0x3f9d('0x2e')][_0x3f9d('0x1d')]);_0x231dc7[_0x3f9d('0x1c')]=qs['offset'](_0x1bf6ac[_0x3f9d('0x2e')]['offset']);}_0x231dc7[_0x3f9d('0x35')]=qs[_0x3f9d('0x36')](_0x1bf6ac[_0x3f9d('0x2e')][_0x3f9d('0x36')]);_0x231dc7['where']=qs['filters'](_['pick'](_0x1bf6ac['query'],_0xdc8d5b[_0x3f9d('0x37')]),_0x5244cf);if(_0x1bf6ac[_0x3f9d('0x2e')][_0x3f9d('0x38')]){_0x231dc7[_0x3f9d('0x39')]=_['merge'](_0x231dc7['where'],{'$or':_[_0x3f9d('0x2d')](_0x5244cf,function(_0x582122){if(_0x582122[_0x3f9d('0x3a')]!==_0x3f9d('0x3b')){var _0x12a643={};_0x12a643[_0x582122['name']]={'$like':'%'+_0x1bf6ac[_0x3f9d('0x2e')][_0x3f9d('0x38')]+'%'};return _0x12a643;}})});}_0x231dc7=_[_0x3f9d('0x3c')]({},_0x231dc7,_0x1bf6ac[_0x3f9d('0x3d')]);var _0x4463a6={'where':_0x231dc7[_0x3f9d('0x39')]};return db[_0x3f9d('0x28')][_0x3f9d('0x1b')](_0x4463a6)['then'](function(_0x1e12bb){_0x36f7c9[_0x3f9d('0x1b')]=_0x1e12bb;if(_0x1bf6ac[_0x3f9d('0x2e')][_0x3f9d('0x3e')]){_0x231dc7[_0x3f9d('0x3f')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x231dc7);})[_0x3f9d('0x24')](function(_0x31fdbb){_0x36f7c9[_0x3f9d('0x40')]=_0x31fdbb;return _0x36f7c9;})[_0x3f9d('0x24')](respondWithFilteredResult(_0x30bf74,_0x231dc7))[_0x3f9d('0x41')](handleError(_0x30bf74,null));};exports['show']=function(_0x463ae5,_0x2ff280){var _0x214e9d={'raw':![],'where':{'id':_0x463ae5[_0x3f9d('0x42')]['id']}},_0x4bf133={};_0x4bf133[_0x3f9d('0x2c')]=_[_0x3f9d('0x2f')](db[_0x3f9d('0x28')][_0x3f9d('0x29')]);_0x4bf133[_0x3f9d('0x2e')]=_['keys'](_0x463ae5[_0x3f9d('0x2e')]);_0x4bf133['filters']=_[_0x3f9d('0x30')](_0x4bf133[_0x3f9d('0x2c')],_0x4bf133[_0x3f9d('0x2e')]);_0x214e9d[_0x3f9d('0x31')]=_['intersection'](_0x4bf133['model'],qs[_0x3f9d('0x32')](_0x463ae5[_0x3f9d('0x2e')]['fields']));_0x214e9d[_0x3f9d('0x31')]=_0x214e9d[_0x3f9d('0x31')][_0x3f9d('0x33')]?_0x214e9d[_0x3f9d('0x31')]:_0x4bf133[_0x3f9d('0x2c')];if(_0x463ae5[_0x3f9d('0x2e')][_0x3f9d('0x3e')]){_0x214e9d[_0x3f9d('0x3f')]=[{'all':!![]}];}_0x214e9d=_[_0x3f9d('0x3c')]({},_0x214e9d,_0x463ae5[_0x3f9d('0x3d')]);return db[_0x3f9d('0x28')][_0x3f9d('0x43')](_0x214e9d)[_0x3f9d('0x24')](handleEntityNotFound(_0x2ff280,null))[_0x3f9d('0x24')](respondWithResult(_0x2ff280,null))[_0x3f9d('0x41')](handleError(_0x2ff280,null));};exports[_0x3f9d('0x44')]=function(_0x3374c6,_0xa818c7){return db['ZohoConfiguration'][_0x3f9d('0x44')](_0x3374c6[_0x3f9d('0x45')],{})[_0x3f9d('0x24')](respondWithResult(_0xa818c7,0xc9))[_0x3f9d('0x41')](handleError(_0xa818c7,null));};exports[_0x3f9d('0x23')]=function(_0x464ea3,_0xdbba3a){if(_0x464ea3['body']['id']){delete _0x464ea3['body']['id'];}return db['ZohoConfiguration'][_0x3f9d('0x43')]({'where':{'id':_0x464ea3[_0x3f9d('0x42')]['id']}})[_0x3f9d('0x24')](handleEntityNotFound(_0xdbba3a,null))[_0x3f9d('0x24')](saveUpdates(_0x464ea3[_0x3f9d('0x45')],null))['then'](respondWithResult(_0xdbba3a,null))[_0x3f9d('0x41')](handleError(_0xdbba3a,null));};exports[_0x3f9d('0x46')]=function(_0x66d548,_0x27b326){return db[_0x3f9d('0x28')][_0x3f9d('0x43')]({'where':{'id':_0x66d548[_0x3f9d('0x42')]['id']}})[_0x3f9d('0x24')](handleEntityNotFound(_0x27b326,null))['then'](removeEntity(_0x27b326,null))[_0x3f9d('0x41')](handleError(_0x27b326,null));};exports[_0x3f9d('0x47')]=function(_0x7ca046,_0x720184,_0x11247b){var _0x47dc22={};var _0x2602d4={};var _0x2b6fcb;var _0xa5e32b;return db['ZohoConfiguration'][_0x3f9d('0x48')]({'where':{'id':_0x7ca046[_0x3f9d('0x42')]['id']}})['then'](handleEntityNotFound(_0x720184,null))[_0x3f9d('0x24')](function(_0x26ed83){if(_0x26ed83){_0x2b6fcb=_0x26ed83;_0x2602d4[_0x3f9d('0x2c')]=_[_0x3f9d('0x2f')](db['ZohoField']['rawAttributes']);_0x2602d4[_0x3f9d('0x2e')]=_['keys'](_0x7ca046[_0x3f9d('0x2e')]);_0x2602d4[_0x3f9d('0x37')]=_[_0x3f9d('0x30')](_0x2602d4[_0x3f9d('0x2c')],_0x2602d4[_0x3f9d('0x2e')]);_0x47dc22[_0x3f9d('0x31')]=_['intersection'](_0x2602d4[_0x3f9d('0x2c')],qs[_0x3f9d('0x32')](_0x7ca046['query'][_0x3f9d('0x32')]));_0x47dc22['attributes']=_0x47dc22[_0x3f9d('0x31')][_0x3f9d('0x33')]?_0x47dc22['attributes']:_0x2602d4[_0x3f9d('0x2c')];_0x47dc22[_0x3f9d('0x35')]=qs[_0x3f9d('0x36')](_0x7ca046[_0x3f9d('0x2e')][_0x3f9d('0x36')]);_0x47dc22[_0x3f9d('0x39')]=qs[_0x3f9d('0x37')](_[_0x3f9d('0x49')](_0x7ca046[_0x3f9d('0x2e')],_0x2602d4[_0x3f9d('0x37')]));if(_0x7ca046[_0x3f9d('0x2e')][_0x3f9d('0x38')]){_0x47dc22[_0x3f9d('0x39')]=_[_0x3f9d('0x3c')](_0x47dc22['where'],{'$or':_[_0x3f9d('0x2d')](_0x47dc22[_0x3f9d('0x31')],function(_0x4a8ba4){var _0xf8a18b={};_0xf8a18b[_0x4a8ba4]={'$like':'%'+_0x7ca046[_0x3f9d('0x2e')][_0x3f9d('0x38')]+'%'};return _0xf8a18b;})});}_0x47dc22=_[_0x3f9d('0x3c')]({},_0x47dc22,_0x7ca046[_0x3f9d('0x3d')]);return _0x2b6fcb[_0x3f9d('0x47')](_0x47dc22);}})['then'](function(_0x3a5ffa){if(_0x3a5ffa){_0xa5e32b=_0x3a5ffa[_0x3f9d('0x33')];if(!_0x7ca046[_0x3f9d('0x2e')][_0x3f9d('0x34')](_0x3f9d('0x4a'))){_0x47dc22[_0x3f9d('0x1d')]=qs['limit'](_0x7ca046[_0x3f9d('0x2e')][_0x3f9d('0x1d')]);_0x47dc22[_0x3f9d('0x1c')]=qs[_0x3f9d('0x1c')](_0x7ca046[_0x3f9d('0x2e')][_0x3f9d('0x1c')]);}return _0x2b6fcb[_0x3f9d('0x47')](_0x47dc22);}})['then'](function(_0x5184ab){if(_0x5184ab){return _0x5184ab?{'count':_0xa5e32b,'rows':_0x5184ab}:null;}})[_0x3f9d('0x24')](respondWithResult(_0x720184,null))[_0x3f9d('0x41')](handleError(_0x720184,null));};exports[_0x3f9d('0x4b')]=function(_0x4a87f4,_0x199169,_0xcb9797){var _0x17c0de={};var _0xb03317={};var _0x508cb0;var _0x5efd9c;return db['ZohoConfiguration'][_0x3f9d('0x48')]({'where':{'id':_0x4a87f4[_0x3f9d('0x42')]['id']}})['then'](handleEntityNotFound(_0x199169,null))[_0x3f9d('0x24')](function(_0x3ab1fa){if(_0x3ab1fa){_0x508cb0=_0x3ab1fa;_0xb03317[_0x3f9d('0x2c')]=_[_0x3f9d('0x2f')](db[_0x3f9d('0x4c')][_0x3f9d('0x29')]);_0xb03317[_0x3f9d('0x2e')]=_[_0x3f9d('0x2f')](_0x4a87f4[_0x3f9d('0x2e')]);_0xb03317[_0x3f9d('0x37')]=_[_0x3f9d('0x30')](_0xb03317['model'],_0xb03317[_0x3f9d('0x2e')]);_0x17c0de[_0x3f9d('0x31')]=_[_0x3f9d('0x30')](_0xb03317['model'],qs[_0x3f9d('0x32')](_0x4a87f4[_0x3f9d('0x2e')][_0x3f9d('0x32')]));_0x17c0de[_0x3f9d('0x31')]=_0x17c0de[_0x3f9d('0x31')]['length']?_0x17c0de[_0x3f9d('0x31')]:_0xb03317[_0x3f9d('0x2c')];_0x17c0de[_0x3f9d('0x35')]=qs[_0x3f9d('0x36')](_0x4a87f4[_0x3f9d('0x2e')]['sort']);_0x17c0de[_0x3f9d('0x39')]=qs[_0x3f9d('0x37')](_[_0x3f9d('0x49')](_0x4a87f4['query'],_0xb03317[_0x3f9d('0x37')]));if(_0x4a87f4[_0x3f9d('0x2e')][_0x3f9d('0x38')]){_0x17c0de['where']=_['merge'](_0x17c0de['where'],{'$or':_[_0x3f9d('0x2d')](_0x17c0de[_0x3f9d('0x31')],function(_0x259816){var _0x20b7f8={};_0x20b7f8[_0x259816]={'$like':'%'+_0x4a87f4[_0x3f9d('0x2e')]['filter']+'%'};return _0x20b7f8;})});}_0x17c0de=_['merge']({},_0x17c0de,_0x4a87f4[_0x3f9d('0x3d')]);return _0x508cb0[_0x3f9d('0x4b')](_0x17c0de);}})['then'](function(_0x437c16){if(_0x437c16){_0x5efd9c=_0x437c16['length'];if(!_0x4a87f4[_0x3f9d('0x2e')][_0x3f9d('0x34')]('nolimit')){_0x17c0de[_0x3f9d('0x1d')]=qs[_0x3f9d('0x1d')](_0x4a87f4[_0x3f9d('0x2e')][_0x3f9d('0x1d')]);_0x17c0de['offset']=qs[_0x3f9d('0x1c')](_0x4a87f4[_0x3f9d('0x2e')]['offset']);}return _0x508cb0['getSubjects'](_0x17c0de);}})['then'](function(_0x3ada2b){if(_0x3ada2b){return _0x3ada2b?{'count':_0x5efd9c,'rows':_0x3ada2b}:null;}})['then'](respondWithResult(_0x199169,null))[_0x3f9d('0x41')](handleError(_0x199169,null));};exports['getDescriptions']=function(_0x249274,_0x44462f,_0xd679c4){var _0x36e85={};var _0x394a80={};var _0x194cdc;var _0x4b2368;return db['ZohoConfiguration'][_0x3f9d('0x48')]({'where':{'id':_0x249274['params']['id']}})['then'](handleEntityNotFound(_0x44462f,null))[_0x3f9d('0x24')](function(_0x3d4949){if(_0x3d4949){_0x194cdc=_0x3d4949;_0x394a80['model']=_[_0x3f9d('0x2f')](db[_0x3f9d('0x4c')][_0x3f9d('0x29')]);_0x394a80[_0x3f9d('0x2e')]=_[_0x3f9d('0x2f')](_0x249274[_0x3f9d('0x2e')]);_0x394a80[_0x3f9d('0x37')]=_[_0x3f9d('0x30')](_0x394a80[_0x3f9d('0x2c')],_0x394a80[_0x3f9d('0x2e')]);_0x36e85[_0x3f9d('0x31')]=_[_0x3f9d('0x30')](_0x394a80[_0x3f9d('0x2c')],qs[_0x3f9d('0x32')](_0x249274[_0x3f9d('0x2e')]['fields']));_0x36e85[_0x3f9d('0x31')]=_0x36e85[_0x3f9d('0x31')][_0x3f9d('0x33')]?_0x36e85[_0x3f9d('0x31')]:_0x394a80[_0x3f9d('0x2c')];_0x36e85[_0x3f9d('0x35')]=qs[_0x3f9d('0x36')](_0x249274[_0x3f9d('0x2e')][_0x3f9d('0x36')]);_0x36e85[_0x3f9d('0x39')]=qs[_0x3f9d('0x37')](_[_0x3f9d('0x49')](_0x249274[_0x3f9d('0x2e')],_0x394a80[_0x3f9d('0x37')]));if(_0x249274[_0x3f9d('0x2e')]['filter']){_0x36e85[_0x3f9d('0x39')]=_[_0x3f9d('0x3c')](_0x36e85[_0x3f9d('0x39')],{'$or':_[_0x3f9d('0x2d')](_0x36e85[_0x3f9d('0x31')],function(_0x459922){var _0x46db39={};_0x46db39[_0x459922]={'$like':'%'+_0x249274[_0x3f9d('0x2e')][_0x3f9d('0x38')]+'%'};return _0x46db39;})});}_0x36e85=_[_0x3f9d('0x3c')]({},_0x36e85,_0x249274['options']);return _0x194cdc['getDescriptions'](_0x36e85);}})['then'](function(_0xaa770e){if(_0xaa770e){_0x4b2368=_0xaa770e['length'];if(!_0x249274['query']['hasOwnProperty'](_0x3f9d('0x4a'))){_0x36e85[_0x3f9d('0x1d')]=qs['limit'](_0x249274[_0x3f9d('0x2e')][_0x3f9d('0x1d')]);_0x36e85[_0x3f9d('0x1c')]=qs['offset'](_0x249274[_0x3f9d('0x2e')]['offset']);}return _0x194cdc['getDescriptions'](_0x36e85);}})[_0x3f9d('0x24')](function(_0x1d330d){if(_0x1d330d){return _0x1d330d?{'count':_0x4b2368,'rows':_0x1d330d}:null;}})[_0x3f9d('0x24')](respondWithResult(_0x44462f,null))['catch'](handleError(_0x44462f,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 7d1dac7..772296d 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 _0xa387=['int_zoho_configurations','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','ZohoConfiguration'];(function(_0x5336af,_0x3d1cb2){var _0x59b64f=function(_0x204fa6){while(--_0x204fa6){_0x5336af['push'](_0x5336af['shift']());}};_0x59b64f(++_0x3d1cb2);}(_0xa387,0xd2));var _0x7a38=function(_0x5c2829,_0x2e1482){_0x5c2829=_0x5c2829-0x0;var _0x4d6544=_0xa387[_0x5c2829];return _0x4d6544;};'use strict';var _=require(_0x7a38('0x0'));var util=require(_0x7a38('0x1'));var logger=require('../../config/logger')(_0x7a38('0x2'));var moment=require(_0x7a38('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a38('0x4'));var fs=require('fs');var path=require(_0x7a38('0x5'));var rimraf=require('rimraf');var config=require(_0x7a38('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x7a38('0x7')]=function(_0x2abcb0,_0x35b37d){return _0x2abcb0[_0x7a38('0x8')](_0x7a38('0x9'),attributes,{'tableName':_0x7a38('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde88=['lodash','util','api','moment','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xde88,0x1bc));var _0x8de8=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xde88[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0x8de8('0x0'));var util=require(_0x8de8('0x1'));var logger=require('../../config/logger')(_0x8de8('0x2'));var moment=require(_0x8de8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8de8('0x4'));var rimraf=require(_0x8de8('0x5'));var config=require(_0x8de8('0x6'));var attributes=require(_0x8de8('0x7'));module[_0x8de8('0x8')]=function(_0x40d277,_0x25e798){return _0x40d277[_0x8de8('0x9')](_0x8de8('0xa'),attributes,{'tableName':_0x8de8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 5b66696..17b5ccb 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 _0x15ba=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x15ba,0x120));var _0xa15b=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x15ba[_0xc55d64];return _0x4194f6;};'use strict';var _=require(_0xa15b('0x0'));var util=require(_0xa15b('0x1'));var moment=require(_0xa15b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa15b('0x3'));var db=require(_0xa15b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa15b('0x5'));var config=require(_0xa15b('0x6'));var jayson=require(_0xa15b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53e29d,_0x5889f3,_0x1823d){return new BPromise(function(_0x184c90,_0x4c2e6e){return client[_0xa15b('0x8')](_0x53e29d,_0x1823d)[_0xa15b('0x9')](function(_0x360382){logger[_0xa15b('0xa')](_0xa15b('0xb'),_0x5889f3,_0xa15b('0xc'));logger['debug'](_0xa15b('0xd'),_0x5889f3,_0xa15b('0xc'),JSON[_0xa15b('0xe')](_0x360382));if(_0x360382[_0xa15b('0xf')]){if(_0x360382['error']['code']===0x1f4){logger[_0xa15b('0xf')](_0xa15b('0xb'),_0x5889f3,_0x360382['error']['message']);return _0x4c2e6e(_0x360382[_0xa15b('0xf')][_0xa15b('0x10')]);}logger[_0xa15b('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5889f3,_0x360382[_0xa15b('0xf')]['message']);return _0x184c90(_0x360382[_0xa15b('0xf')][_0xa15b('0x10')]);}else{logger[_0xa15b('0xa')](_0xa15b('0xb'),_0x5889f3,_0xa15b('0xc'));_0x184c90(_0x360382[_0xa15b('0x11')]['message']);}})[_0xa15b('0x12')](function(_0x5903c2){logger['error'](_0xa15b('0xb'),_0x5889f3,_0x5903c2);_0x4c2e6e(_0x5903c2);});});} \ No newline at end of file +var _0x072d=['request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s'];(function(_0xddb06f,_0x2f8d4b){var _0x7b567c=function(_0x29d22a){while(--_0x29d22a){_0xddb06f['push'](_0xddb06f['shift']());}};_0x7b567c(++_0x2f8d4b);}(_0x072d,0x123));var _0xd072=function(_0x44a491,_0x1d70b1){_0x44a491=_0x44a491-0x0;var _0x294023=_0x072d[_0x44a491];return _0x294023;};'use strict';var _=require(_0xd072('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd072('0x1'));var rs=require(_0xd072('0x2'));var fs=require('fs');var Redis=require(_0xd072('0x3'));var db=require(_0xd072('0x4'))['db'];var utils=require(_0xd072('0x5'));var logger=require('../../config/logger')(_0xd072('0x6'));var config=require('../../config/environment');var jayson=require(_0xd072('0x7'));var client=jayson[_0xd072('0x8')][_0xd072('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f8d06,_0x1b1e53,_0x2ac8c6){return new BPromise(function(_0x5600ba,_0x3e0536){return client[_0xd072('0xa')](_0x4f8d06,_0x2ac8c6)['then'](function(_0x22dd8e){logger[_0xd072('0xb')](_0xd072('0xc'),_0x1b1e53,_0xd072('0xd'));logger['debug'](_0xd072('0xe'),_0x1b1e53,_0xd072('0xd'),JSON[_0xd072('0xf')](_0x22dd8e));if(_0x22dd8e['error']){if(_0x22dd8e[_0xd072('0x10')]['code']===0x1f4){logger[_0xd072('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x1b1e53,_0x22dd8e[_0xd072('0x10')][_0xd072('0x11')]);return _0x3e0536(_0x22dd8e[_0xd072('0x10')][_0xd072('0x11')]);}logger[_0xd072('0x10')](_0xd072('0xc'),_0x1b1e53,_0x22dd8e[_0xd072('0x10')]['message']);return _0x5600ba(_0x22dd8e[_0xd072('0x10')][_0xd072('0x11')]);}else{logger[_0xd072('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x1b1e53,_0xd072('0xd'));_0x5600ba(_0x22dd8e['result'][_0xd072('0x11')]);}})[_0xd072('0x12')](function(_0x50f2e0){logger[_0xd072('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x1b1e53,_0x50f2e0);_0x3e0536(_0x50f2e0);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 4195b8a..6c72aa6 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 _0xace4=['isAuthenticated','index','/:id','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xace4,0x184));var _0x4ace=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0xace4[_0x5d88c0];return _0x1b40f0;};'use strict';var multer=require(_0x4ace('0x0'));var util=require(_0x4ace('0x1'));var path=require(_0x4ace('0x2'));var timeout=require(_0x4ace('0x3'));var express=require('express');var router=express[_0x4ace('0x4')]();var fs_extra=require(_0x4ace('0x5'));var auth=require(_0x4ace('0x6'));var interaction=require(_0x4ace('0x7'));var config=require(_0x4ace('0x8'));var controller=require(_0x4ace('0x9'));router[_0x4ace('0xa')]('/',auth[_0x4ace('0xb')](),controller[_0x4ace('0xc')]);router[_0x4ace('0xa')](_0x4ace('0xd'),auth[_0x4ace('0xb')](),controller['show']);router['post']('/',auth[_0x4ace('0xb')](),controller[_0x4ace('0xe')]);router[_0x4ace('0xf')](_0x4ace('0xd'),auth[_0x4ace('0xb')](),controller[_0x4ace('0x10')]);router[_0x4ace('0x11')]('/:id',auth[_0x4ace('0xb')](),controller[_0x4ace('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf853=['./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3e5980,_0x424b8b){var _0x3d6e95=function(_0x4931b5){while(--_0x4931b5){_0x3e5980['push'](_0x3e5980['shift']());}};_0x3d6e95(++_0x424b8b);}(_0xf853,0x1cd));var _0x3f85=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0xf853[_0x2714ec];return _0x2608e5;};'use strict';var multer=require(_0x3f85('0x0'));var util=require(_0x3f85('0x1'));var path=require('path');var timeout=require(_0x3f85('0x2'));var express=require(_0x3f85('0x3'));var router=express[_0x3f85('0x4')]();var fs_extra=require(_0x3f85('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3f85('0x6'));var config=require('../../config/environment');var controller=require(_0x3f85('0x7'));router[_0x3f85('0x8')]('/',auth[_0x3f85('0x9')](),controller[_0x3f85('0xa')]);router[_0x3f85('0x8')](_0x3f85('0xb'),auth[_0x3f85('0x9')](),controller[_0x3f85('0xc')]);router[_0x3f85('0xd')]('/',auth[_0x3f85('0x9')](),controller[_0x3f85('0xe')]);router['put'](_0x3f85('0xb'),auth[_0x3f85('0x9')](),controller[_0x3f85('0xf')]);router[_0x3f85('0x10')]('/:id',auth[_0x3f85('0x9')](),controller[_0x3f85('0x11')]);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 7072cbd..0c3b8a6 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 _0x12fd=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','picklist','STRING'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x12fd,0x77));var _0xd12f=function(_0x19a4ae,_0x354c05){_0x19a4ae=_0x19a4ae-0x0;var _0x26a831=_0x12fd[_0x19a4ae];return _0x26a831;};'use strict';var Sequelize=require(_0xd12f('0x0'));module[_0xd12f('0x1')]={'type':{'type':Sequelize[_0xd12f('0x2')](_0xd12f('0x3'),_0xd12f('0x4'),'customVariable','keyValue',_0xd12f('0x5')),'defaultValue':_0xd12f('0x3')},'content':{'type':Sequelize[_0xd12f('0x6')]},'key':{'type':Sequelize[_0xd12f('0x6')]},'keyType':{'type':Sequelize[_0xd12f('0x2')](_0xd12f('0x3'),_0xd12f('0x4'),_0xd12f('0x7'))},'keyContent':{'type':Sequelize[_0xd12f('0x6')]},'idField':{'type':Sequelize[_0xd12f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd12f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1ba8=['sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','customVariable'];(function(_0x2bc324,_0x40d64d){var _0x312c10=function(_0x3e1684){while(--_0x3e1684){_0x2bc324['push'](_0x2bc324['shift']());}};_0x312c10(++_0x40d64d);}(_0x1ba8,0x132));var _0x81ba=function(_0x3384bf,_0x4773c3){_0x3384bf=_0x3384bf-0x0;var _0x21b6f2=_0x1ba8[_0x3384bf];return _0x21b6f2;};'use strict';var Sequelize=require(_0x81ba('0x0'));module[_0x81ba('0x1')]={'type':{'type':Sequelize[_0x81ba('0x2')](_0x81ba('0x3'),'variable','customVariable',_0x81ba('0x4'),_0x81ba('0x5')),'defaultValue':_0x81ba('0x3')},'content':{'type':Sequelize[_0x81ba('0x6')]},'key':{'type':Sequelize[_0x81ba('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x81ba('0x3'),_0x81ba('0x7'),_0x81ba('0x8'))},'keyContent':{'type':Sequelize[_0x81ba('0x6')]},'idField':{'type':Sequelize[_0x81ba('0x6')]},'nameField':{'type':Sequelize[_0x81ba('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x81ba('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 39a098f..f184497 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 _0x59ef=['find','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0x59ef,0x12b));var _0xf59e=function(_0x4894c7,_0x1bf03f){_0x4894c7=_0x4894c7-0x0;var _0x4d7467=_0x59ef[_0x4894c7];return _0x4d7467;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf59e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf59e('0x1'));var rp=require(_0xf59e('0x2'));var moment=require(_0xf59e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf59e('0x4'));var util=require('util');var path=require(_0xf59e('0x5'));var sox=require(_0xf59e('0x6'));var csv=require(_0xf59e('0x7'));var ejs=require(_0xf59e('0x8'));var fs=require('fs');var fs_extra=require(_0xf59e('0x9'));var _=require(_0xf59e('0xa'));var squel=require(_0xf59e('0xb'));var crypto=require(_0xf59e('0xc'));var jsforce=require(_0xf59e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf59e('0xe'));var Papa=require(_0xf59e('0xf'));var Redis=require(_0xf59e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf59e('0x11'));var hardwareService=require(_0xf59e('0x12'));var logger=require(_0xf59e('0x13'))(_0xf59e('0x14'));var utils=require(_0xf59e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf59e('0x16'));var db=require(_0xf59e('0x17'))['db'];function respondWithStatusCode(_0x17f0e6,_0x2013a5){_0x2013a5=_0x2013a5||0xcc;return function(_0x5ce341){if(_0x5ce341){return _0x17f0e6['sendStatus'](_0x2013a5);}return _0x17f0e6[_0xf59e('0x18')](_0x2013a5)[_0xf59e('0x19')]();};}function respondWithResult(_0x483a62,_0x4c1458){_0x4c1458=_0x4c1458||0xc8;return function(_0x5c038a){if(_0x5c038a){return _0x483a62[_0xf59e('0x18')](_0x4c1458)[_0xf59e('0x1a')](_0x5c038a);}};}function respondWithFilteredResult(_0x220b2c,_0x922e7a){return function(_0x29b634){if(_0x29b634){var _0x147d47=typeof _0x922e7a[_0xf59e('0x1b')]===_0xf59e('0x1c')&&typeof _0x922e7a[_0xf59e('0x1d')]===_0xf59e('0x1c');var _0x512a92=_0x29b634[_0xf59e('0x1e')];var _0x1ef305=_0x147d47?0x0:_0x922e7a[_0xf59e('0x1b')];var _0x11c627=_0x147d47?_0x29b634[_0xf59e('0x1e')]:_0x922e7a[_0xf59e('0x1b')]+_0x922e7a[_0xf59e('0x1d')];var _0x28a37a;if(_0x11c627>=_0x512a92){_0x11c627=_0x512a92;_0x28a37a=0xc8;}else{_0x28a37a=0xce;}_0x220b2c[_0xf59e('0x18')](_0x28a37a);return _0x220b2c[_0xf59e('0x1f')](_0xf59e('0x20'),_0x1ef305+'-'+_0x11c627+'/'+_0x512a92)[_0xf59e('0x1a')](_0x29b634);}return null;};}function patchUpdates(_0xfd2a71){return function(_0x3dc645){try{jsonpatch[_0xf59e('0x21')](_0x3dc645,_0xfd2a71,!![]);}catch(_0x4d3918){return BPromise[_0xf59e('0x22')](_0x4d3918);}return _0x3dc645['save']();};}function saveUpdates(_0x4d5acf,_0x33fb45){return function(_0x3108e5){if(_0x3108e5){return _0x3108e5[_0xf59e('0x23')](_0x4d5acf)[_0xf59e('0x24')](function(_0x5c3ea1){return _0x5c3ea1;});}return null;};}function removeEntity(_0x451c0a,_0x3a30ad){return function(_0x470d26){if(_0x470d26){return _0x470d26['destroy']()['then'](function(){_0x451c0a[_0xf59e('0x18')](0xcc)[_0xf59e('0x19')]();});}};}function handleEntityNotFound(_0x4d846c,_0x4afda7){return function(_0x4acf69){if(!_0x4acf69){_0x4d846c[_0xf59e('0x25')](0x194);}return _0x4acf69;};}function handleError(_0x536635,_0x592205){_0x592205=_0x592205||0x1f4;return function(_0x201f92){logger['error'](_0x201f92[_0xf59e('0x26')]);if(_0x201f92[_0xf59e('0x27')]){delete _0x201f92[_0xf59e('0x27')];}_0x536635[_0xf59e('0x18')](_0x592205)[_0xf59e('0x28')](_0x201f92);};}exports['index']=function(_0x59fc37,_0x2b00a4){var _0x40016f={},_0x4099cb={},_0x50beb2={'count':0x0,'rows':[]};var _0x542297=_[_0xf59e('0x29')](db[_0xf59e('0x2a')][_0xf59e('0x2b')],function(_0x2967b4){return{'name':_0x2967b4[_0xf59e('0x2c')],'type':_0x2967b4[_0xf59e('0x2d')][_0xf59e('0x2e')]};});_0x4099cb[_0xf59e('0x2f')]=_['map'](_0x542297,_0xf59e('0x27'));_0x4099cb['query']=_[_0xf59e('0x30')](_0x59fc37['query']);_0x4099cb[_0xf59e('0x31')]=_[_0xf59e('0x32')](_0x4099cb[_0xf59e('0x2f')],_0x4099cb[_0xf59e('0x33')]);_0x40016f[_0xf59e('0x34')]=_[_0xf59e('0x32')](_0x4099cb[_0xf59e('0x2f')],qs['fields'](_0x59fc37['query'][_0xf59e('0x35')]));_0x40016f[_0xf59e('0x34')]=_0x40016f[_0xf59e('0x34')]['length']?_0x40016f[_0xf59e('0x34')]:_0x4099cb[_0xf59e('0x2f')];if(!_0x59fc37[_0xf59e('0x33')][_0xf59e('0x36')](_0xf59e('0x37'))){_0x40016f[_0xf59e('0x1d')]=qs[_0xf59e('0x1d')](_0x59fc37[_0xf59e('0x33')]['limit']);_0x40016f[_0xf59e('0x1b')]=qs[_0xf59e('0x1b')](_0x59fc37[_0xf59e('0x33')]['offset']);}_0x40016f[_0xf59e('0x38')]=qs[_0xf59e('0x39')](_0x59fc37[_0xf59e('0x33')][_0xf59e('0x39')]);_0x40016f[_0xf59e('0x3a')]=qs[_0xf59e('0x31')](_[_0xf59e('0x3b')](_0x59fc37[_0xf59e('0x33')],_0x4099cb['filters']),_0x542297);if(_0x59fc37['query'][_0xf59e('0x3c')]){_0x40016f[_0xf59e('0x3a')]=_[_0xf59e('0x3d')](_0x40016f[_0xf59e('0x3a')],{'$or':_[_0xf59e('0x29')](_0x542297,function(_0x1c702b){if(_0x1c702b['type']!==_0xf59e('0x3e')){var _0x8bf004={};_0x8bf004[_0x1c702b[_0xf59e('0x27')]]={'$like':'%'+_0x59fc37[_0xf59e('0x33')][_0xf59e('0x3c')]+'%'};return _0x8bf004;}})});}_0x40016f=_[_0xf59e('0x3d')]({},_0x40016f,_0x59fc37[_0xf59e('0x3f')]);var _0x4d6b20={'where':_0x40016f[_0xf59e('0x3a')]};return db[_0xf59e('0x2a')][_0xf59e('0x1e')](_0x4d6b20)[_0xf59e('0x24')](function(_0x2b4a69){_0x50beb2['count']=_0x2b4a69;if(_0x59fc37[_0xf59e('0x33')][_0xf59e('0x40')]){_0x40016f[_0xf59e('0x41')]=[{'all':!![]}];}return db[_0xf59e('0x2a')]['findAll'](_0x40016f);})['then'](function(_0x7952db){_0x50beb2[_0xf59e('0x42')]=_0x7952db;return _0x50beb2;})[_0xf59e('0x24')](respondWithFilteredResult(_0x2b00a4,_0x40016f))[_0xf59e('0x43')](handleError(_0x2b00a4,null));};exports[_0xf59e('0x44')]=function(_0x177863,_0xa07349){var _0x406647={'raw':!![],'where':{'id':_0x177863[_0xf59e('0x45')]['id']}},_0x127445={};_0x127445[_0xf59e('0x2f')]=_[_0xf59e('0x30')](db['ZohoField'][_0xf59e('0x2b')]);_0x127445['query']=_[_0xf59e('0x30')](_0x177863[_0xf59e('0x33')]);_0x127445['filters']=_[_0xf59e('0x32')](_0x127445[_0xf59e('0x2f')],_0x127445[_0xf59e('0x33')]);_0x406647['attributes']=_[_0xf59e('0x32')](_0x127445['model'],qs[_0xf59e('0x35')](_0x177863[_0xf59e('0x33')][_0xf59e('0x35')]));_0x406647['attributes']=_0x406647[_0xf59e('0x34')][_0xf59e('0x46')]?_0x406647[_0xf59e('0x34')]:_0x127445[_0xf59e('0x2f')];if(_0x177863[_0xf59e('0x33')][_0xf59e('0x40')]){_0x406647['include']=[{'all':!![]}];}_0x406647=_[_0xf59e('0x3d')]({},_0x406647,_0x177863[_0xf59e('0x3f')]);return db[_0xf59e('0x2a')][_0xf59e('0x47')](_0x406647)[_0xf59e('0x24')](handleEntityNotFound(_0xa07349,null))[_0xf59e('0x24')](respondWithResult(_0xa07349,null))[_0xf59e('0x43')](handleError(_0xa07349,null));};exports[_0xf59e('0x48')]=function(_0x6175c9,_0x26b2b8){return db[_0xf59e('0x2a')][_0xf59e('0x48')](_0x6175c9['body'],{})['then'](respondWithResult(_0x26b2b8,0xc9))[_0xf59e('0x43')](handleError(_0x26b2b8,null));};exports[_0xf59e('0x23')]=function(_0x1c1d5c,_0x2dcb06){if(_0x1c1d5c[_0xf59e('0x49')]['id']){delete _0x1c1d5c['body']['id'];}return db[_0xf59e('0x2a')]['find']({'where':{'id':_0x1c1d5c[_0xf59e('0x45')]['id']}})[_0xf59e('0x24')](handleEntityNotFound(_0x2dcb06,null))['then'](saveUpdates(_0x1c1d5c[_0xf59e('0x49')],null))[_0xf59e('0x24')](respondWithResult(_0x2dcb06,null))[_0xf59e('0x43')](handleError(_0x2dcb06,null));};exports['destroy']=function(_0x2730b3,_0x408570){return db[_0xf59e('0x2a')][_0xf59e('0x47')]({'where':{'id':_0x2730b3[_0xf59e('0x45')]['id']}})[_0xf59e('0x24')](handleEntityNotFound(_0x408570,null))[_0xf59e('0x24')](removeEntity(_0x408570,null))[_0xf59e('0x43')](handleError(_0x408570,null));}; \ No newline at end of file +var _0xb584=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','destroy','then','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x16b9fd,_0x25e056){var _0x22d9f8=function(_0x1255d2){while(--_0x1255d2){_0x16b9fd['push'](_0x16b9fd['shift']());}};_0x22d9f8(++_0x25e056);}(_0xb584,0x8c));var _0x4b58=function(_0x3f182c,_0x595909){_0x3f182c=_0x3f182c-0x0;var _0x16628d=_0xb584[_0x3f182c];return _0x16628d;};'use strict';var emlformat=require(_0x4b58('0x0'));var rimraf=require(_0x4b58('0x1'));var zipdir=require(_0x4b58('0x2'));var jsonpatch=require(_0x4b58('0x3'));var rp=require('request-promise');var moment=require(_0x4b58('0x4'));var BPromise=require(_0x4b58('0x5'));var Mustache=require(_0x4b58('0x6'));var util=require(_0x4b58('0x7'));var path=require(_0x4b58('0x8'));var sox=require(_0x4b58('0x9'));var csv=require('to-csv');var ejs=require(_0x4b58('0xa'));var fs=require('fs');var fs_extra=require(_0x4b58('0xb'));var _=require(_0x4b58('0xc'));var squel=require(_0x4b58('0xd'));var crypto=require(_0x4b58('0xe'));var jsforce=require(_0x4b58('0xf'));var deskjs=require(_0x4b58('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4b58('0x11'));var Papa=require(_0x4b58('0x12'));var Redis=require('ioredis');var authService=require(_0x4b58('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4b58('0x14'));var hardwareService=require(_0x4b58('0x15'));var logger=require('../../config/logger')(_0x4b58('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4b58('0x17'));var db=require(_0x4b58('0x18'))['db'];function respondWithStatusCode(_0x1fcc0f,_0x491af0){_0x491af0=_0x491af0||0xcc;return function(_0x3b590e){if(_0x3b590e){return _0x1fcc0f[_0x4b58('0x19')](_0x491af0);}return _0x1fcc0f[_0x4b58('0x1a')](_0x491af0)[_0x4b58('0x1b')]();};}function respondWithResult(_0x165286,_0x4b94d9){_0x4b94d9=_0x4b94d9||0xc8;return function(_0x179406){if(_0x179406){return _0x165286[_0x4b58('0x1a')](_0x4b94d9)['json'](_0x179406);}};}function respondWithFilteredResult(_0x4d2080,_0x2c4226){return function(_0xecb824){if(_0xecb824){var _0x2c2237=typeof _0x2c4226[_0x4b58('0x1c')]===_0x4b58('0x1d')&&typeof _0x2c4226[_0x4b58('0x1e')]===_0x4b58('0x1d');var _0x3fa072=_0xecb824[_0x4b58('0x1f')];var _0x1daa7f=_0x2c2237?0x0:_0x2c4226[_0x4b58('0x1c')];var _0x1d516c=_0x2c2237?_0xecb824['count']:_0x2c4226[_0x4b58('0x1c')]+_0x2c4226[_0x4b58('0x1e')];var _0x5e1ffd;if(_0x1d516c>=_0x3fa072){_0x1d516c=_0x3fa072;_0x5e1ffd=0xc8;}else{_0x5e1ffd=0xce;}_0x4d2080['status'](_0x5e1ffd);return _0x4d2080['set'](_0x4b58('0x20'),_0x1daa7f+'-'+_0x1d516c+'/'+_0x3fa072)[_0x4b58('0x21')](_0xecb824);}return null;};}function patchUpdates(_0x256fee){return function(_0x1092f){try{jsonpatch['apply'](_0x1092f,_0x256fee,!![]);}catch(_0x53a837){return BPromise['reject'](_0x53a837);}return _0x1092f[_0x4b58('0x22')]();};}function saveUpdates(_0x3b5814,_0x20366b){return function(_0x41befe){if(_0x41befe){return _0x41befe[_0x4b58('0x23')](_0x3b5814)['then'](function(_0x102411){return _0x102411;});}return null;};}function removeEntity(_0x1fd6ac,_0x264fa2){return function(_0x4a7dcc){if(_0x4a7dcc){return _0x4a7dcc[_0x4b58('0x24')]()[_0x4b58('0x25')](function(){_0x1fd6ac[_0x4b58('0x1a')](0xcc)[_0x4b58('0x1b')]();});}};}function handleEntityNotFound(_0x1a47b9,_0x137af5){return function(_0x2ca6aa){if(!_0x2ca6aa){_0x1a47b9[_0x4b58('0x19')](0x194);}return _0x2ca6aa;};}function handleError(_0x1e0e68,_0x249dff){_0x249dff=_0x249dff||0x1f4;return function(_0x27520f){logger['error'](_0x27520f[_0x4b58('0x26')]);if(_0x27520f[_0x4b58('0x27')]){delete _0x27520f[_0x4b58('0x27')];}_0x1e0e68['status'](_0x249dff)['send'](_0x27520f);};}exports[_0x4b58('0x28')]=function(_0x246703,_0x5b61b2){var _0x1afca9={},_0x25b368={},_0x52cf31={'count':0x0,'rows':[]};var _0x372fff=_[_0x4b58('0x29')](db[_0x4b58('0x2a')][_0x4b58('0x2b')],function(_0x2528a1){return{'name':_0x2528a1[_0x4b58('0x2c')],'type':_0x2528a1[_0x4b58('0x2d')]['key']};});_0x25b368[_0x4b58('0x2e')]=_['map'](_0x372fff,_0x4b58('0x27'));_0x25b368['query']=_['keys'](_0x246703[_0x4b58('0x2f')]);_0x25b368[_0x4b58('0x30')]=_['intersection'](_0x25b368[_0x4b58('0x2e')],_0x25b368[_0x4b58('0x2f')]);_0x1afca9[_0x4b58('0x31')]=_[_0x4b58('0x32')](_0x25b368['model'],qs[_0x4b58('0x33')](_0x246703[_0x4b58('0x2f')]['fields']));_0x1afca9[_0x4b58('0x31')]=_0x1afca9['attributes']['length']?_0x1afca9['attributes']:_0x25b368['model'];if(!_0x246703[_0x4b58('0x2f')][_0x4b58('0x34')](_0x4b58('0x35'))){_0x1afca9[_0x4b58('0x1e')]=qs[_0x4b58('0x1e')](_0x246703[_0x4b58('0x2f')][_0x4b58('0x1e')]);_0x1afca9['offset']=qs['offset'](_0x246703[_0x4b58('0x2f')]['offset']);}_0x1afca9[_0x4b58('0x36')]=qs[_0x4b58('0x37')](_0x246703[_0x4b58('0x2f')][_0x4b58('0x37')]);_0x1afca9[_0x4b58('0x38')]=qs[_0x4b58('0x30')](_[_0x4b58('0x39')](_0x246703[_0x4b58('0x2f')],_0x25b368[_0x4b58('0x30')]),_0x372fff);if(_0x246703[_0x4b58('0x2f')]['filter']){_0x1afca9[_0x4b58('0x38')]=_['merge'](_0x1afca9[_0x4b58('0x38')],{'$or':_[_0x4b58('0x29')](_0x372fff,function(_0x54b36b){if(_0x54b36b['type']!==_0x4b58('0x3a')){var _0x2e256d={};_0x2e256d[_0x54b36b[_0x4b58('0x27')]]={'$like':'%'+_0x246703[_0x4b58('0x2f')][_0x4b58('0x3b')]+'%'};return _0x2e256d;}})});}_0x1afca9=_['merge']({},_0x1afca9,_0x246703[_0x4b58('0x3c')]);var _0x3d8bc7={'where':_0x1afca9[_0x4b58('0x38')]};return db['ZohoField']['count'](_0x3d8bc7)['then'](function(_0x1774cc){_0x52cf31[_0x4b58('0x1f')]=_0x1774cc;if(_0x246703[_0x4b58('0x2f')][_0x4b58('0x3d')]){_0x1afca9[_0x4b58('0x3e')]=[{'all':!![]}];}return db[_0x4b58('0x2a')][_0x4b58('0x3f')](_0x1afca9);})[_0x4b58('0x25')](function(_0x109d26){_0x52cf31[_0x4b58('0x40')]=_0x109d26;return _0x52cf31;})[_0x4b58('0x25')](respondWithFilteredResult(_0x5b61b2,_0x1afca9))[_0x4b58('0x41')](handleError(_0x5b61b2,null));};exports[_0x4b58('0x42')]=function(_0x2dc903,_0x515554){var _0x46ac0f={'raw':!![],'where':{'id':_0x2dc903[_0x4b58('0x43')]['id']}},_0x4b8f07={};_0x4b8f07[_0x4b58('0x2e')]=_[_0x4b58('0x44')](db['ZohoField'][_0x4b58('0x2b')]);_0x4b8f07['query']=_[_0x4b58('0x44')](_0x2dc903[_0x4b58('0x2f')]);_0x4b8f07[_0x4b58('0x30')]=_[_0x4b58('0x32')](_0x4b8f07[_0x4b58('0x2e')],_0x4b8f07[_0x4b58('0x2f')]);_0x46ac0f[_0x4b58('0x31')]=_[_0x4b58('0x32')](_0x4b8f07[_0x4b58('0x2e')],qs['fields'](_0x2dc903[_0x4b58('0x2f')][_0x4b58('0x33')]));_0x46ac0f[_0x4b58('0x31')]=_0x46ac0f[_0x4b58('0x31')][_0x4b58('0x45')]?_0x46ac0f['attributes']:_0x4b8f07[_0x4b58('0x2e')];if(_0x2dc903['query']['includeAll']){_0x46ac0f[_0x4b58('0x3e')]=[{'all':!![]}];}_0x46ac0f=_[_0x4b58('0x46')]({},_0x46ac0f,_0x2dc903[_0x4b58('0x3c')]);return db['ZohoField'][_0x4b58('0x47')](_0x46ac0f)[_0x4b58('0x25')](handleEntityNotFound(_0x515554,null))[_0x4b58('0x25')](respondWithResult(_0x515554,null))[_0x4b58('0x41')](handleError(_0x515554,null));};exports[_0x4b58('0x48')]=function(_0xb68a68,_0x301689){return db[_0x4b58('0x2a')][_0x4b58('0x48')](_0xb68a68[_0x4b58('0x49')],{})['then'](respondWithResult(_0x301689,0xc9))[_0x4b58('0x41')](handleError(_0x301689,null));};exports[_0x4b58('0x23')]=function(_0x2e95f5,_0x2a4eb9){if(_0x2e95f5[_0x4b58('0x49')]['id']){delete _0x2e95f5['body']['id'];}return db[_0x4b58('0x2a')][_0x4b58('0x47')]({'where':{'id':_0x2e95f5[_0x4b58('0x43')]['id']}})[_0x4b58('0x25')](handleEntityNotFound(_0x2a4eb9,null))[_0x4b58('0x25')](saveUpdates(_0x2e95f5[_0x4b58('0x49')],null))[_0x4b58('0x25')](respondWithResult(_0x2a4eb9,null))['catch'](handleError(_0x2a4eb9,null));};exports[_0x4b58('0x24')]=function(_0x4ebc3a,_0x5e6c90){return db['ZohoField'][_0x4b58('0x47')]({'where':{'id':_0x4ebc3a[_0x4b58('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e6c90,null))[_0x4b58('0x25')](removeEntity(_0x5e6c90,null))[_0x4b58('0x41')](handleError(_0x5e6c90,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 5d895a3..9cf811f 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 _0xd943=['api','bluebird','request-promise','path','rimraf','../../config/environment','int_zoho_fields','zoho_unique_index','lodash','util','../../config/logger'];(function(_0xdccb0d,_0x5e4ed5){var _0x162c1b=function(_0x3c913f){while(--_0x3c913f){_0xdccb0d['push'](_0xdccb0d['shift']());}};_0x162c1b(++_0x5e4ed5);}(_0xd943,0x15d));var _0x3d94=function(_0x4f07ae,_0x3fe295){_0x4f07ae=_0x4f07ae-0x0;var _0x3a0e90=_0xd943[_0x4f07ae];return _0x3a0e90;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('ZohoField',attributes,{'tableName':_0x3d94('0x9'),'paranoid':![],'indexes':[{'name':_0x3d94('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','idField','FieldId'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x6d38[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x86d3('0x9'),_0x86d3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 3a848ae..a95d5bb 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 _0x6d2f=['info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x6d2f,0x190));var _0xf6d2=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x6d2f[_0x218972];return _0x1bb1a8;};'use strict';var _=require(_0xf6d2('0x0'));var util=require(_0xf6d2('0x1'));var moment=require(_0xf6d2('0x2'));var BPromise=require(_0xf6d2('0x3'));var rs=require(_0xf6d2('0x4'));var fs=require('fs');var Redis=require(_0xf6d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6d2('0x6'));var logger=require(_0xf6d2('0x7'))('rpc');var config=require(_0xf6d2('0x8'));var jayson=require(_0xf6d2('0x9'));var client=jayson[_0xf6d2('0xa')][_0xf6d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a5c08,_0x1cb74c,_0x389144){return new BPromise(function(_0x42ec23,_0x4a1675){return client[_0xf6d2('0xc')](_0x3a5c08,_0x389144)[_0xf6d2('0xd')](function(_0x42cdbf){logger[_0xf6d2('0xe')](_0xf6d2('0xf'),_0x1cb74c,_0xf6d2('0x10'));logger[_0xf6d2('0x11')](_0xf6d2('0x12'),_0x1cb74c,_0xf6d2('0x10'),JSON[_0xf6d2('0x13')](_0x42cdbf));if(_0x42cdbf[_0xf6d2('0x14')]){if(_0x42cdbf[_0xf6d2('0x14')]['code']===0x1f4){logger[_0xf6d2('0x14')]('ZohoField,\x20%s,\x20%s',_0x1cb74c,_0x42cdbf[_0xf6d2('0x14')][_0xf6d2('0x15')]);return _0x4a1675(_0x42cdbf[_0xf6d2('0x14')]['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x1cb74c,_0x42cdbf[_0xf6d2('0x14')]['message']);return _0x42ec23(_0x42cdbf['error'][_0xf6d2('0x15')]);}else{logger[_0xf6d2('0xe')](_0xf6d2('0xf'),_0x1cb74c,_0xf6d2('0x10'));_0x42ec23(_0x42cdbf['result'][_0xf6d2('0x15')]);}})[_0xf6d2('0x16')](function(_0x3a669d){logger[_0xf6d2('0x14')](_0xf6d2('0xf'),_0x1cb74c,_0x3a669d);_0x4a1675(_0x3a669d);});});} \ No newline at end of file +var _0xf68a=['info','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1136c4,_0x5e38b1){var _0x314e2d=function(_0x5a5297){while(--_0x5a5297){_0x1136c4['push'](_0x1136c4['shift']());}};_0x314e2d(++_0x5e38b1);}(_0xf68a,0x162));var _0xaf68=function(_0x220739,_0x1ebab8){_0x220739=_0x220739-0x0;var _0x4dbc98=_0xf68a[_0x220739];return _0x4dbc98;};'use strict';var _=require(_0xaf68('0x0'));var util=require(_0xaf68('0x1'));var moment=require(_0xaf68('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaf68('0x4'));var logger=require(_0xaf68('0x5'))(_0xaf68('0x6'));var config=require(_0xaf68('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaf68('0x8')][_0xaf68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c77de,_0x539b04,_0x3417c3){return new BPromise(function(_0x4b15d,_0x58c1b7){return client[_0xaf68('0xa')](_0x1c77de,_0x3417c3)[_0xaf68('0xb')](function(_0x2e0843){logger['info'](_0xaf68('0xc'),_0x539b04,'request\x20sent');logger[_0xaf68('0xd')](_0xaf68('0xe'),_0x539b04,_0xaf68('0xf'),JSON[_0xaf68('0x10')](_0x2e0843));if(_0x2e0843['error']){if(_0x2e0843[_0xaf68('0x11')][_0xaf68('0x12')]===0x1f4){logger['error'](_0xaf68('0xc'),_0x539b04,_0x2e0843[_0xaf68('0x11')][_0xaf68('0x13')]);return _0x58c1b7(_0x2e0843[_0xaf68('0x11')][_0xaf68('0x13')]);}logger[_0xaf68('0x11')](_0xaf68('0xc'),_0x539b04,_0x2e0843[_0xaf68('0x11')][_0xaf68('0x13')]);return _0x4b15d(_0x2e0843[_0xaf68('0x11')][_0xaf68('0x13')]);}else{logger[_0xaf68('0x14')](_0xaf68('0xc'),_0x539b04,_0xaf68('0xf'));_0x4b15d(_0x2e0843[_0xaf68('0x15')][_0xaf68('0x13')]);}})['catch'](function(_0x315f69){logger['error']('ZohoField,\x20%s,\x20%s',_0x539b04,_0x315f69);_0x58c1b7(_0x315f69);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 3571daa..b885cf5 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41b38b,_0x6ee394){var _0x2cb8a6=function(_0x51e798){while(--_0x51e798){_0x41b38b['push'](_0x41b38b['shift']());}};_0x2cb8a6(++_0x6ee394);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3e82b5,_0x89b524){var _0x3e3dea=function(_0x3d624c){while(--_0x3d624c){_0x3e82b5['push'](_0x3e82b5['shift']());}};_0x3e3dea(++_0x89b524);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 73eb1d4..f7ee7b3 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 _0xaecf=['exports','STRING','app.js','INTEGER','BOOLEAN','sequelize'];(function(_0x5f40d3,_0x480260){var _0x4aa444=function(_0x1b7b2a){while(--_0x1b7b2a){_0x5f40d3['push'](_0x5f40d3['shift']());}};_0x4aa444(++_0x480260);}(_0xaecf,0x149));var _0xfaec=function(_0x5ae06d,_0x44a73d){_0x5ae06d=_0x5ae06d-0x0;var _0x10af06=_0xaecf[_0x5ae06d];return _0x10af06;};'use strict';var Sequelize=require(_0xfaec('0x0'));module[_0xfaec('0x1')]={'name':{'type':Sequelize[_0xfaec('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xfaec('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xfaec('0x2')],'defaultValue':_0xfaec('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfaec('0x2')]},'size':{'type':Sequelize[_0xfaec('0x4')]},'active':{'type':Sequelize[_0xfaec('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xfaec('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xfaec('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xfaec('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfaec('0x2')]},'link':{'type':Sequelize[_0xfaec('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x0bb2=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0xeeb6dd,_0x3e5f7b){var _0x95d347=function(_0x48de04){while(--_0x48de04){_0xeeb6dd['push'](_0xeeb6dd['shift']());}};_0x95d347(++_0x3e5f7b);}(_0x0bb2,0x72));var _0x20bb=function(_0x33ba96,_0x48da07){_0x33ba96=_0x33ba96-0x0;var _0x1a66ef=_0x0bb2[_0x33ba96];return _0x1a66ef;};'use strict';var Sequelize=require(_0x20bb('0x0'));module[_0x20bb('0x1')]={'name':{'type':Sequelize[_0x20bb('0x2')],'allowNull':![],'unique':_0x20bb('0x3')},'version':{'type':Sequelize[_0x20bb('0x2')],'allowNull':![],'unique':_0x20bb('0x3')},'main':{'type':Sequelize[_0x20bb('0x2')],'defaultValue':_0x20bb('0x4')},'filename':{'type':Sequelize[_0x20bb('0x2')]},'path':{'type':Sequelize[_0x20bb('0x2')]},'type':{'type':Sequelize[_0x20bb('0x2')]},'size':{'type':Sequelize[_0x20bb('0x5')]},'active':{'type':Sequelize[_0x20bb('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x20bb('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x20bb('0x2')],'unique':_0x20bb('0x7')},'description':{'type':Sequelize[_0x20bb('0x2')]},'title':{'type':Sequelize[_0x20bb('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x20bb('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 32effa0..b0208ad 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 _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x440269,_0x5a4ffd){var _0x2dcbfe=function(_0x3a64f2){while(--_0x3a64f2){_0x440269['push'](_0x440269['shift']());}};_0x2dcbfe(++_0x5a4ffd);}(_0x7096,0x10c));var _0x6709=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7096[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file +var _0x47c5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','Integration'];(function(_0x4752f2,_0x21c338){var _0x512b69=function(_0x46e6be){while(--_0x46e6be){_0x4752f2['push'](_0x4752f2['shift']());}};_0x512b69(++_0x21c338);}(_0x47c5,0x165));var _0x547c=function(_0x38b744,_0x218c46){_0x38b744=_0x38b744-0x0;var _0x3028d4=_0x47c5[_0x38b744];return _0x3028d4;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['Integration'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['Integration']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['Integration'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['Integration'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2fde5fe..b2ac07d 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 _0xd9d7=['./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xd9d7,0x9a));var _0x7d9d=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0xd9d7[_0x2c96f6];return _0x6d4808;};'use strict';var _=require(_0x7d9d('0x0'));var util=require(_0x7d9d('0x1'));var logger=require(_0x7d9d('0x2'))('api');var moment=require(_0x7d9d('0x3'));var BPromise=require(_0x7d9d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d9d('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d9d('0x6'));module['exports']=function(_0x35fd5c,_0x247b68){return _0x35fd5c[_0x7d9d('0x7')](_0x7d9d('0x8'),attributes,{'tableName':_0x7d9d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b03=['exports','util','api','request-promise','path','rimraf','../../config/environment','./integration.attributes'];(function(_0xdcb46f,_0x8f628e){var _0x1382d8=function(_0x381441){while(--_0x381441){_0xdcb46f['push'](_0xdcb46f['shift']());}};_0x1382d8(++_0x8f628e);}(_0x8b03,0xe1));var _0x38b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b03[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x38b0('0x0'));var logger=require('../../config/logger')(_0x38b0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x38b0('0x2'));var fs=require('fs');var path=require(_0x38b0('0x3'));var rimraf=require(_0x38b0('0x4'));var config=require(_0x38b0('0x5'));var attributes=require(_0x38b0('0x6'));module[_0x38b0('0x7')]=function(_0x4e19f2,_0x5beb31){return _0x4e19f2['define']('Integration',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 0493853..9ae0823 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 _0x955f=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3ae6a3,_0x509eb4){var _0x414586=function(_0x578703){while(--_0x578703){_0x3ae6a3['push'](_0x3ae6a3['shift']());}};_0x414586(++_0x509eb4);}(_0x955f,0x1eb));var _0xf955=function(_0x59cdf6,_0x4dfc78){_0x59cdf6=_0x59cdf6-0x0;var _0x1ae776=_0x955f[_0x59cdf6];return _0x1ae776;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('Integration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x150972,_0x54fa9c){var _0x44db0d=function(_0x168762){while(--_0x168762){_0x150972['push'](_0x150972['shift']());}};_0x44db0d(++_0x54fa9c);}(_0x66fa,0x117));var _0xa66f=function(_0x4654c5,_0x3bbc98){_0x4654c5=_0x4654c5-0x0;var _0x53a8fc=_0x66fa[_0x4654c5];return _0x53a8fc;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index ebddc22..8da10d9 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 _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x272400,_0x501dfd){var _0x322c4e=function(_0x5578f0){while(--_0x5578f0){_0x272400['push'](_0x272400['shift']());}};_0x322c4e(++_0x501dfd);}(_0xba34,0x119));var _0x4ba3=function(_0xc238d7,_0x65ea11){_0xc238d7=_0xc238d7-0x0;var _0x5311a6=_0xba34[_0xc238d7];return _0x5311a6;};'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')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2e856e,_0x553b8b){var _0xbff148=function(_0x8dc88a){while(--_0x8dc88a){_0x2e856e['push'](_0x2e856e['shift']());}};_0xbff148(++_0x553b8b);}(_0x2ef3,0xba));var _0x32ef=function(_0x324c8d,_0x516f38){_0x324c8d=_0x324c8d-0x0;var _0x251535=_0x2ef3[_0x324c8d];return _0x251535;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1acbcf8..45e8239 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 _0x7fc2=['INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','sequelize','STRING'];(function(_0x387123,_0x54b6d1){var _0x109fba=function(_0xf89948){while(--_0xf89948){_0x387123['push'](_0x387123['shift']());}};_0x109fba(++_0x54b6d1);}(_0x7fc2,0x85));var _0x27fc=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7fc2[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x27fc('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x27fc('0x1')]},'exitStatus':{'type':Sequelize[_0x27fc('0x1')]},'ticketId':{'type':Sequelize[_0x27fc('0x1')]},'integrationId':{'type':Sequelize[_0x27fc('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x27fc('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x27fc('0x1')]},'interface':{'type':Sequelize[_0x27fc('0x1')]},'membername':{'type':Sequelize[_0x27fc('0x1')]},'agentcalledAt':{'type':Sequelize[_0x27fc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x27fc('0x3')]},'holdtime':{'type':Sequelize[_0x27fc('0x2')]},'agentcomplete':{'type':Sequelize[_0x27fc('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x27fc('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x27fc('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x27fc('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x27fc('0x3')]},'agentdump':{'type':Sequelize[_0x27fc('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x27fc('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x27fc('0x1')]},'channelstate':{'type':Sequelize[_0x27fc('0x2')]},'channelstatedesc':{'type':Sequelize[_0x27fc('0x1')]},'connectedlinenum':{'type':Sequelize[_0x27fc('0x1')]},'connectedlinename':{'type':Sequelize[_0x27fc('0x1')]},'language':{'type':Sequelize[_0x27fc('0x1')]},'accountcode':{'type':Sequelize[_0x27fc('0x1')]},'context':{'type':Sequelize[_0x27fc('0x1')]},'exten':{'type':Sequelize[_0x27fc('0x1')]},'priority':{'type':Sequelize[_0x27fc('0x1')]},'destchannel':{'type':Sequelize[_0x27fc('0x1')]},'destchannelstate':{'type':Sequelize[_0x27fc('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x27fc('0x1')]},'destcalleridnum':{'type':Sequelize[_0x27fc('0x1')]},'destcalleridname':{'type':Sequelize[_0x27fc('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x27fc('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x27fc('0x1')]},'destlanguage':{'type':Sequelize[_0x27fc('0x1')]},'destaccountcode':{'type':Sequelize[_0x27fc('0x1')]},'destcontext':{'type':Sequelize[_0x27fc('0x1')]},'destexten':{'type':Sequelize[_0x27fc('0x1')]},'destpriority':{'type':Sequelize[_0x27fc('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x27fc('0x1')]},'inReplyTo':{'type':Sequelize[_0x27fc('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x27fc('0x1')]},'cc':{'type':Sequelize[_0x27fc('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x27fc('0x5')]},'text':{'type':Sequelize[_0x27fc('0x5')]},'status':{'type':Sequelize['ENUM'](_0x27fc('0x6'),_0x27fc('0x7'),_0x27fc('0x8'),'FAILED')},'url':{'type':Sequelize[_0x27fc('0x1')]},'app':{'type':Sequelize[_0x27fc('0x1')]},'appdata':{'type':Sequelize[_0x27fc('0x1')]},'projectId':{'type':Sequelize[_0x27fc('0x2')]}}; \ No newline at end of file +var _0x7cf5=['SENT','SENDING','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7cf5,0x12a));var _0x57cf=function(_0x83a911,_0x1300bb){_0x83a911=_0x83a911-0x0;var _0x2e6bb3=_0x7cf5[_0x83a911];return _0x2e6bb3;};'use strict';var Sequelize=require('sequelize');module[_0x57cf('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x57cf('0x1')]},'exitStatus':{'type':Sequelize[_0x57cf('0x1')]},'ticketId':{'type':Sequelize[_0x57cf('0x1')]},'integrationId':{'type':Sequelize[_0x57cf('0x2')]},'contacts':{'type':Sequelize[_0x57cf('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x57cf('0x1')]},'queue':{'type':Sequelize[_0x57cf('0x1')]},'interface':{'type':Sequelize[_0x57cf('0x1')]},'membername':{'type':Sequelize[_0x57cf('0x1')]},'agentcalledAt':{'type':Sequelize[_0x57cf('0x3')]},'agentconnectAt':{'type':Sequelize[_0x57cf('0x3')]},'holdtime':{'type':Sequelize[_0x57cf('0x2')]},'agentcomplete':{'type':Sequelize[_0x57cf('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x57cf('0x3')]},'talktime':{'type':Sequelize[_0x57cf('0x2')]},'agentacw':{'type':Sequelize[_0x57cf('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x57cf('0x2')]},'reason':{'type':Sequelize[_0x57cf('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x57cf('0x3')]},'agentdump':{'type':Sequelize[_0x57cf('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x57cf('0x1')]},'channel':{'type':Sequelize[_0x57cf('0x1')]},'channelstate':{'type':Sequelize[_0x57cf('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x57cf('0x1')]},'connectedlinename':{'type':Sequelize[_0x57cf('0x1')]},'language':{'type':Sequelize[_0x57cf('0x1')]},'accountcode':{'type':Sequelize[_0x57cf('0x1')]},'context':{'type':Sequelize[_0x57cf('0x1')]},'exten':{'type':Sequelize[_0x57cf('0x1')]},'priority':{'type':Sequelize[_0x57cf('0x1')]},'destchannel':{'type':Sequelize[_0x57cf('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x57cf('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x57cf('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x57cf('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x57cf('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x57cf('0x1')]},'destpriority':{'type':Sequelize[_0x57cf('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x57cf('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x57cf('0x1')]},'from':{'type':Sequelize[_0x57cf('0x1')]},'to':{'type':Sequelize[_0x57cf('0x1')]},'cc':{'type':Sequelize[_0x57cf('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x57cf('0x5')]},'text':{'type':Sequelize[_0x57cf('0x5')]},'status':{'type':Sequelize['ENUM'](_0x57cf('0x6'),_0x57cf('0x7'),'RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x57cf('0x1')]},'appdata':{'type':Sequelize[_0x57cf('0x1')]},'projectId':{'type':Sequelize[_0x57cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 5b05e44..31d6c43 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 _0x935c=['undefined','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','destroy','describe','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x935c,0x108));var _0xc935=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x935c[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc935('0x0'));var zipdir=require(_0xc935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc935('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc935('0x3'));var util=require(_0xc935('0x4'));var path=require(_0xc935('0x5'));var sox=require(_0xc935('0x6'));var csv=require(_0xc935('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc935('0x8'));var squel=require(_0xc935('0x9'));var crypto=require('crypto');var jsforce=require(_0xc935('0xa'));var deskjs=require(_0xc935('0xb'));var toCsv=require(_0xc935('0x7'));var querystring=require(_0xc935('0xc'));var Papa=require(_0xc935('0xd'));var Redis=require(_0xc935('0xe'));var authService=require(_0xc935('0xf'));var qs=require(_0xc935('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc935('0x11'))(_0xc935('0x12'));var utils=require(_0xc935('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc935('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe27465,_0xd41541){_0xd41541=_0xd41541||0xcc;return function(_0x1c5588){if(_0x1c5588){return _0xe27465['sendStatus'](_0xd41541);}return _0xe27465[_0xc935('0x15')](_0xd41541)[_0xc935('0x16')]();};}function respondWithResult(_0x2af1cf,_0x354f8e){_0x354f8e=_0x354f8e||0xc8;return function(_0x5f2960){if(_0x5f2960){return _0x2af1cf['status'](_0x354f8e)['json'](_0x5f2960);}};}function respondWithFilteredResult(_0x1d2697,_0x4636a9){return function(_0x354ebb){if(_0x354ebb){var _0x5481bf=typeof _0x4636a9[_0xc935('0x17')]===_0xc935('0x18')&&typeof _0x4636a9[_0xc935('0x19')]===_0xc935('0x18');var _0x3e3b9c=_0x354ebb['count'];var _0x19abaa=_0x5481bf?0x0:_0x4636a9[_0xc935('0x17')];var _0x982a4c=_0x5481bf?_0x354ebb['count']:_0x4636a9[_0xc935('0x17')]+_0x4636a9['limit'];var _0x472013;if(_0x982a4c>=_0x3e3b9c){_0x982a4c=_0x3e3b9c;_0x472013=0xc8;}else{_0x472013=0xce;}_0x1d2697['status'](_0x472013);return _0x1d2697[_0xc935('0x1a')](_0xc935('0x1b'),_0x19abaa+'-'+_0x982a4c+'/'+_0x3e3b9c)['json'](_0x354ebb);}return null;};}function patchUpdates(_0x13c62d){return function(_0x23e52e){try{jsonpatch[_0xc935('0x1c')](_0x23e52e,_0x13c62d,!![]);}catch(_0xfdf13){return BPromise[_0xc935('0x1d')](_0xfdf13);}return _0x23e52e[_0xc935('0x1e')]();};}function saveUpdates(_0x71219e,_0x32af46){return function(_0x3b4083){if(_0x3b4083){return _0x3b4083[_0xc935('0x1f')](_0x71219e)[_0xc935('0x20')](function(_0x8b665){return _0x8b665;});}return null;};}function removeEntity(_0xfa5135,_0x387a08){return function(_0x37aad3){if(_0x37aad3){return _0x37aad3['destroy']()[_0xc935('0x20')](function(){_0xfa5135[_0xc935('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x274fc0,_0x2b1bb2){return function(_0x4ec613){if(!_0x4ec613){_0x274fc0[_0xc935('0x21')](0x194);}return _0x4ec613;};}function handleError(_0x506617,_0x5b5461){_0x5b5461=_0x5b5461||0x1f4;return function(_0x23f2af){logger[_0xc935('0x22')](_0x23f2af[_0xc935('0x23')]);if(_0x23f2af[_0xc935('0x24')]){delete _0x23f2af[_0xc935('0x24')];}_0x506617[_0xc935('0x15')](_0x5b5461)[_0xc935('0x25')](_0x23f2af);};}exports['index']=function(_0x5929af,_0x49c4ae){var _0xa59785={},_0x507a21={},_0x368e65={'count':0x0,'rows':[]};var _0x3ed1fb=_['map'](db[_0xc935('0x26')][_0xc935('0x27')],function(_0xa55f5f){return{'name':_0xa55f5f[_0xc935('0x28')],'type':_0xa55f5f['type'][_0xc935('0x29')]};});_0x507a21[_0xc935('0x2a')]=_['map'](_0x3ed1fb,'name');_0x507a21[_0xc935('0x2b')]=_[_0xc935('0x2c')](_0x5929af[_0xc935('0x2b')]);_0x507a21[_0xc935('0x2d')]=_[_0xc935('0x2e')](_0x507a21[_0xc935('0x2a')],_0x507a21[_0xc935('0x2b')]);_0xa59785['attributes']=_['intersection'](_0x507a21[_0xc935('0x2a')],qs[_0xc935('0x2f')](_0x5929af[_0xc935('0x2b')][_0xc935('0x2f')]));_0xa59785[_0xc935('0x30')]=_0xa59785[_0xc935('0x30')][_0xc935('0x31')]?_0xa59785[_0xc935('0x30')]:_0x507a21[_0xc935('0x2a')];if(!_0x5929af['query'][_0xc935('0x32')](_0xc935('0x33'))){_0xa59785[_0xc935('0x19')]=qs[_0xc935('0x19')](_0x5929af[_0xc935('0x2b')][_0xc935('0x19')]);_0xa59785[_0xc935('0x17')]=qs['offset'](_0x5929af[_0xc935('0x2b')]['offset']);}_0xa59785['order']=qs[_0xc935('0x34')](_0x5929af['query'][_0xc935('0x34')]);_0xa59785[_0xc935('0x35')]=qs[_0xc935('0x2d')](_[_0xc935('0x36')](_0x5929af[_0xc935('0x2b')],_0x507a21[_0xc935('0x2d')]),_0x3ed1fb);if(_0x5929af[_0xc935('0x2b')][_0xc935('0x37')]){_0xa59785[_0xc935('0x35')]=_[_0xc935('0x38')](_0xa59785['where'],{'$or':_['map'](_0x3ed1fb,function(_0xd4936){if(_0xd4936[_0xc935('0x39')]!==_0xc935('0x3a')){var _0x108f4f={};_0x108f4f[_0xd4936[_0xc935('0x24')]]={'$like':'%'+_0x5929af[_0xc935('0x2b')][_0xc935('0x37')]+'%'};return _0x108f4f;}})});}_0xa59785=_[_0xc935('0x38')]({},_0xa59785,_0x5929af[_0xc935('0x3b')]);var _0x20bd31={'where':_0xa59785[_0xc935('0x35')]};return db['IntegrationReport'][_0xc935('0x3c')](_0x20bd31)[_0xc935('0x20')](function(_0x45bf2b){_0x368e65['count']=_0x45bf2b;if(_0x5929af[_0xc935('0x2b')][_0xc935('0x3d')]){_0xa59785[_0xc935('0x3e')]=[{'all':!![]}];}return db[_0xc935('0x26')][_0xc935('0x3f')](_0xa59785);})[_0xc935('0x20')](function(_0x52f794){_0x368e65[_0xc935('0x40')]=_0x52f794;return _0x368e65;})[_0xc935('0x20')](respondWithFilteredResult(_0x49c4ae,_0xa59785))[_0xc935('0x41')](handleError(_0x49c4ae,null));};exports[_0xc935('0x42')]=function(_0x228d7b,_0x1e1ed7){var _0x44dd69={'raw':![],'where':{'id':_0x228d7b[_0xc935('0x43')]['id']}},_0x686ca8={};_0x686ca8[_0xc935('0x2a')]=_[_0xc935('0x2c')](db[_0xc935('0x26')]['rawAttributes']);_0x686ca8['query']=_[_0xc935('0x2c')](_0x228d7b[_0xc935('0x2b')]);_0x686ca8[_0xc935('0x2d')]=_[_0xc935('0x2e')](_0x686ca8[_0xc935('0x2a')],_0x686ca8[_0xc935('0x2b')]);_0x44dd69[_0xc935('0x30')]=_[_0xc935('0x2e')](_0x686ca8[_0xc935('0x2a')],qs[_0xc935('0x2f')](_0x228d7b['query'][_0xc935('0x2f')]));_0x44dd69[_0xc935('0x30')]=_0x44dd69[_0xc935('0x30')]['length']?_0x44dd69[_0xc935('0x30')]:_0x686ca8[_0xc935('0x2a')];if(_0x228d7b[_0xc935('0x2b')][_0xc935('0x3d')]){_0x44dd69['include']=[{'all':!![]}];}_0x44dd69=_['merge']({},_0x44dd69,_0x228d7b[_0xc935('0x3b')]);return db['IntegrationReport'][_0xc935('0x44')](_0x44dd69)[_0xc935('0x20')](handleEntityNotFound(_0x1e1ed7,null))[_0xc935('0x20')](respondWithResult(_0x1e1ed7,null))[_0xc935('0x41')](handleError(_0x1e1ed7,null));};exports[_0xc935('0x45')]=function(_0x13c0f3,_0x34aec3){return db[_0xc935('0x26')][_0xc935('0x45')](_0x13c0f3['body'],{})[_0xc935('0x20')](respondWithResult(_0x34aec3,0xc9))[_0xc935('0x41')](handleError(_0x34aec3,null));};exports['update']=function(_0x29f18a,_0x2e4bed){if(_0x29f18a['body']['id']){delete _0x29f18a['body']['id'];}return db[_0xc935('0x26')]['find']({'where':{'id':_0x29f18a['params']['id']}})['then'](handleEntityNotFound(_0x2e4bed,null))[_0xc935('0x20')](saveUpdates(_0x29f18a['body'],null))[_0xc935('0x20')](respondWithResult(_0x2e4bed,null))[_0xc935('0x41')](handleError(_0x2e4bed,null));};exports[_0xc935('0x46')]=function(_0x3cb0f7,_0x29d528){return db['IntegrationReport'][_0xc935('0x44')]({'where':{'id':_0x3cb0f7[_0xc935('0x43')]['id']}})['then'](handleEntityNotFound(_0x29d528,null))['then'](removeEntity(_0x29d528,null))['catch'](handleError(_0x29d528,null));};exports[_0xc935('0x47')]=function(_0x4df8b0,_0x17125b){return db['IntegrationReport'][_0xc935('0x47')]()[_0xc935('0x20')](respondWithResult(_0x17125b,null))[_0xc935('0x41')](handleError(_0x17125b,null));}; \ No newline at end of file +var _0xbc0b=['key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','type','options','where','IntegrationReport','includeAll','include','rows','catch','show','params','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','then','destroy','name','send','index','map','fieldName'];(function(_0x19e57f,_0x4ae750){var _0x469556=function(_0xf6968b){while(--_0xf6968b){_0x19e57f['push'](_0x19e57f['shift']());}};_0x469556(++_0x4ae750);}(_0xbc0b,0xfd));var _0xbbc0=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xbc0b[_0xda464c];return _0x19e222;};'use strict';var emlformat=require(_0xbbc0('0x0'));var rimraf=require(_0xbbc0('0x1'));var zipdir=require(_0xbbc0('0x2'));var jsonpatch=require(_0xbbc0('0x3'));var rp=require(_0xbbc0('0x4'));var moment=require('moment');var BPromise=require(_0xbbc0('0x5'));var Mustache=require(_0xbbc0('0x6'));var util=require(_0xbbc0('0x7'));var path=require(_0xbbc0('0x8'));var sox=require(_0xbbc0('0x9'));var csv=require(_0xbbc0('0xa'));var ejs=require(_0xbbc0('0xb'));var fs=require('fs');var fs_extra=require(_0xbbc0('0xc'));var _=require('lodash');var squel=require(_0xbbc0('0xd'));var crypto=require(_0xbbc0('0xe'));var jsforce=require(_0xbbc0('0xf'));var deskjs=require(_0xbbc0('0x10'));var toCsv=require(_0xbbc0('0xa'));var querystring=require('querystring');var Papa=require(_0xbbc0('0x11'));var Redis=require(_0xbbc0('0x12'));var authService=require(_0xbbc0('0x13'));var qs=require(_0xbbc0('0x14'));var as=require(_0xbbc0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbc0('0x16'))(_0xbbc0('0x17'));var utils=require(_0xbbc0('0x18'));var config=require(_0xbbc0('0x19'));var licenseUtil=require(_0xbbc0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ad623,_0x4573af){_0x4573af=_0x4573af||0xcc;return function(_0x180e2f){if(_0x180e2f){return _0x4ad623[_0xbbc0('0x1b')](_0x4573af);}return _0x4ad623[_0xbbc0('0x1c')](_0x4573af)[_0xbbc0('0x1d')]();};}function respondWithResult(_0x156e6d,_0x429f2b){_0x429f2b=_0x429f2b||0xc8;return function(_0xb3d704){if(_0xb3d704){return _0x156e6d[_0xbbc0('0x1c')](_0x429f2b)[_0xbbc0('0x1e')](_0xb3d704);}};}function respondWithFilteredResult(_0x3c3738,_0x4ebbe1){return function(_0x24c429){if(_0x24c429){var _0x7e97ad=typeof _0x4ebbe1['offset']===_0xbbc0('0x1f')&&typeof _0x4ebbe1[_0xbbc0('0x20')]===_0xbbc0('0x1f');var _0x42f0ee=_0x24c429[_0xbbc0('0x21')];var _0x1c7eb9=_0x7e97ad?0x0:_0x4ebbe1[_0xbbc0('0x22')];var _0x50cb24=_0x7e97ad?_0x24c429[_0xbbc0('0x21')]:_0x4ebbe1[_0xbbc0('0x22')]+_0x4ebbe1[_0xbbc0('0x20')];var _0x1e52fa;if(_0x50cb24>=_0x42f0ee){_0x50cb24=_0x42f0ee;_0x1e52fa=0xc8;}else{_0x1e52fa=0xce;}_0x3c3738['status'](_0x1e52fa);return _0x3c3738['set']('Content-Range',_0x1c7eb9+'-'+_0x50cb24+'/'+_0x42f0ee)[_0xbbc0('0x1e')](_0x24c429);}return null;};}function patchUpdates(_0x3eb3c1){return function(_0x8615f3){try{jsonpatch[_0xbbc0('0x23')](_0x8615f3,_0x3eb3c1,!![]);}catch(_0x3311b6){return BPromise['reject'](_0x3311b6);}return _0x8615f3['save']();};}function saveUpdates(_0x2dfed4,_0x40c5ef){return function(_0xb57f44){if(_0xb57f44){return _0xb57f44['update'](_0x2dfed4)[_0xbbc0('0x24')](function(_0x4becac){return _0x4becac;});}return null;};}function removeEntity(_0x270134,_0x4d2ad2){return function(_0xe7d014){if(_0xe7d014){return _0xe7d014[_0xbbc0('0x25')]()['then'](function(){_0x270134['status'](0xcc)[_0xbbc0('0x1d')]();});}};}function handleEntityNotFound(_0x280963,_0x535d7f){return function(_0x192f53){if(!_0x192f53){_0x280963[_0xbbc0('0x1b')](0x194);}return _0x192f53;};}function handleError(_0xe35191,_0x5baf52){_0x5baf52=_0x5baf52||0x1f4;return function(_0x2e54e6){logger['error'](_0x2e54e6['stack']);if(_0x2e54e6[_0xbbc0('0x26')]){delete _0x2e54e6['name'];}_0xe35191[_0xbbc0('0x1c')](_0x5baf52)[_0xbbc0('0x27')](_0x2e54e6);};}exports[_0xbbc0('0x28')]=function(_0xac379f,_0x47f474){var _0x21ee80={},_0x438e3e={},_0x26240c={'count':0x0,'rows':[]};var _0x16f4ee=_[_0xbbc0('0x29')](db['IntegrationReport']['rawAttributes'],function(_0x3c44b3){return{'name':_0x3c44b3[_0xbbc0('0x2a')],'type':_0x3c44b3['type'][_0xbbc0('0x2b')]};});_0x438e3e[_0xbbc0('0x2c')]=_[_0xbbc0('0x29')](_0x16f4ee,_0xbbc0('0x26'));_0x438e3e['query']=_[_0xbbc0('0x2d')](_0xac379f['query']);_0x438e3e['filters']=_[_0xbbc0('0x2e')](_0x438e3e[_0xbbc0('0x2c')],_0x438e3e[_0xbbc0('0x2f')]);_0x21ee80[_0xbbc0('0x30')]=_[_0xbbc0('0x2e')](_0x438e3e[_0xbbc0('0x2c')],qs['fields'](_0xac379f[_0xbbc0('0x2f')][_0xbbc0('0x31')]));_0x21ee80[_0xbbc0('0x30')]=_0x21ee80[_0xbbc0('0x30')][_0xbbc0('0x32')]?_0x21ee80[_0xbbc0('0x30')]:_0x438e3e['model'];if(!_0xac379f[_0xbbc0('0x2f')][_0xbbc0('0x33')](_0xbbc0('0x34'))){_0x21ee80[_0xbbc0('0x20')]=qs[_0xbbc0('0x20')](_0xac379f[_0xbbc0('0x2f')][_0xbbc0('0x20')]);_0x21ee80[_0xbbc0('0x22')]=qs[_0xbbc0('0x22')](_0xac379f[_0xbbc0('0x2f')][_0xbbc0('0x22')]);}_0x21ee80[_0xbbc0('0x35')]=qs[_0xbbc0('0x36')](_0xac379f[_0xbbc0('0x2f')][_0xbbc0('0x36')]);_0x21ee80['where']=qs[_0xbbc0('0x37')](_[_0xbbc0('0x38')](_0xac379f[_0xbbc0('0x2f')],_0x438e3e['filters']),_0x16f4ee);if(_0xac379f[_0xbbc0('0x2f')][_0xbbc0('0x39')]){_0x21ee80['where']=_[_0xbbc0('0x3a')](_0x21ee80['where'],{'$or':_[_0xbbc0('0x29')](_0x16f4ee,function(_0x527f06){if(_0x527f06[_0xbbc0('0x3b')]!=='VIRTUAL'){var _0x1cbd36={};_0x1cbd36[_0x527f06[_0xbbc0('0x26')]]={'$like':'%'+_0xac379f[_0xbbc0('0x2f')][_0xbbc0('0x39')]+'%'};return _0x1cbd36;}})});}_0x21ee80=_[_0xbbc0('0x3a')]({},_0x21ee80,_0xac379f[_0xbbc0('0x3c')]);var _0x4f2575={'where':_0x21ee80[_0xbbc0('0x3d')]};return db[_0xbbc0('0x3e')][_0xbbc0('0x21')](_0x4f2575)[_0xbbc0('0x24')](function(_0x3fccd5){_0x26240c[_0xbbc0('0x21')]=_0x3fccd5;if(_0xac379f[_0xbbc0('0x2f')][_0xbbc0('0x3f')]){_0x21ee80[_0xbbc0('0x40')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x21ee80);})['then'](function(_0x1f44d6){_0x26240c[_0xbbc0('0x41')]=_0x1f44d6;return _0x26240c;})['then'](respondWithFilteredResult(_0x47f474,_0x21ee80))[_0xbbc0('0x42')](handleError(_0x47f474,null));};exports[_0xbbc0('0x43')]=function(_0x1e3a12,_0x5051b2){var _0x33ef86={'raw':![],'where':{'id':_0x1e3a12[_0xbbc0('0x44')]['id']}},_0x44fb6f={};_0x44fb6f['model']=_[_0xbbc0('0x2d')](db[_0xbbc0('0x3e')]['rawAttributes']);_0x44fb6f[_0xbbc0('0x2f')]=_['keys'](_0x1e3a12[_0xbbc0('0x2f')]);_0x44fb6f[_0xbbc0('0x37')]=_[_0xbbc0('0x2e')](_0x44fb6f['model'],_0x44fb6f['query']);_0x33ef86[_0xbbc0('0x30')]=_[_0xbbc0('0x2e')](_0x44fb6f[_0xbbc0('0x2c')],qs[_0xbbc0('0x31')](_0x1e3a12[_0xbbc0('0x2f')][_0xbbc0('0x31')]));_0x33ef86[_0xbbc0('0x30')]=_0x33ef86['attributes'][_0xbbc0('0x32')]?_0x33ef86[_0xbbc0('0x30')]:_0x44fb6f[_0xbbc0('0x2c')];if(_0x1e3a12['query']['includeAll']){_0x33ef86['include']=[{'all':!![]}];}_0x33ef86=_['merge']({},_0x33ef86,_0x1e3a12[_0xbbc0('0x3c')]);return db['IntegrationReport']['find'](_0x33ef86)[_0xbbc0('0x24')](handleEntityNotFound(_0x5051b2,null))[_0xbbc0('0x24')](respondWithResult(_0x5051b2,null))[_0xbbc0('0x42')](handleError(_0x5051b2,null));};exports['create']=function(_0x1c5aac,_0x5ae4e3){return db['IntegrationReport'][_0xbbc0('0x45')](_0x1c5aac['body'],{})[_0xbbc0('0x24')](respondWithResult(_0x5ae4e3,0xc9))[_0xbbc0('0x42')](handleError(_0x5ae4e3,null));};exports[_0xbbc0('0x46')]=function(_0x5e6a42,_0x40dcb0){if(_0x5e6a42[_0xbbc0('0x47')]['id']){delete _0x5e6a42[_0xbbc0('0x47')]['id'];}return db[_0xbbc0('0x3e')][_0xbbc0('0x48')]({'where':{'id':_0x5e6a42[_0xbbc0('0x44')]['id']}})[_0xbbc0('0x24')](handleEntityNotFound(_0x40dcb0,null))[_0xbbc0('0x24')](saveUpdates(_0x5e6a42['body'],null))[_0xbbc0('0x24')](respondWithResult(_0x40dcb0,null))[_0xbbc0('0x42')](handleError(_0x40dcb0,null));};exports['destroy']=function(_0x4c958b,_0x5acc5d){return db[_0xbbc0('0x3e')][_0xbbc0('0x48')]({'where':{'id':_0x4c958b['params']['id']}})[_0xbbc0('0x24')](handleEntityNotFound(_0x5acc5d,null))[_0xbbc0('0x24')](removeEntity(_0x5acc5d,null))[_0xbbc0('0x42')](handleError(_0x5acc5d,null));};exports['describe']=function(_0x1d002e,_0x7ef709){return db['IntegrationReport'][_0xbbc0('0x49')]()['then'](respondWithResult(_0x7ef709,null))[_0xbbc0('0x42')](handleError(_0x7ef709,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7c1baff..8cee8b2 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 _0x8798=['./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8798,0x130));var _0x8879=function(_0x309dfa,_0x2555d0){_0x309dfa=_0x309dfa-0x0;var _0x7462c8=_0x8798[_0x309dfa];return _0x7462c8;};'use strict';var _=require(_0x8879('0x0'));var util=require(_0x8879('0x1'));var logger=require(_0x8879('0x2'))(_0x8879('0x3'));var moment=require('moment');var BPromise=require(_0x8879('0x4'));var rp=require(_0x8879('0x5'));var fs=require('fs');var path=require(_0x8879('0x6'));var rimraf=require('rimraf');var config=require(_0x8879('0x7'));var attributes=require(_0x8879('0x8'));module[_0x8879('0x9')]=function(_0x438b9b,_0x316b8){return _0x438b9b[_0x8879('0xa')]('IntegrationReport',attributes,{'tableName':_0x8879('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1dc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','report_integration'];(function(_0x1ec31c,_0x10644e){var _0x558afa=function(_0xe0033d){while(--_0xe0033d){_0x1ec31c['push'](_0x1ec31c['shift']());}};_0x558afa(++_0x10644e);}(_0xe1dc,0x1a2));var _0xce1d=function(_0x5cf5b3,_0x238b18){_0x5cf5b3=_0x5cf5b3-0x0;var _0x2b5a70=_0xe1dc[_0x5cf5b3];return _0x2b5a70;};'use strict';var _=require(_0xce1d('0x0'));var util=require(_0xce1d('0x1'));var logger=require(_0xce1d('0x2'))(_0xce1d('0x3'));var moment=require(_0xce1d('0x4'));var BPromise=require(_0xce1d('0x5'));var rp=require(_0xce1d('0x6'));var fs=require('fs');var path=require(_0xce1d('0x7'));var rimraf=require('rimraf');var config=require(_0xce1d('0x8'));var attributes=require('./integrationReport.attributes');module[_0xce1d('0x9')]=function(_0x17523e,_0x145e78){return _0x17523e['define']('IntegrationReport',attributes,{'tableName':_0xce1d('0xa'),'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 ad96d63..8e73e80 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 _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(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc2c7,0x134));var _0x7c2c=function(_0x38c43d,_0x46c1b3){_0x38c43d=_0x38c43d-0x0;var _0x3a36ba=_0xc2c7[_0x38c43d];return _0x3a36ba;};'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 +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x53ec,0x192));var _0xc53e=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0x53ec[_0x18776a];return _0x484e4a;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c61a1ca..3b37ee8 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 _0xc57c=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','multer','express','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post'];(function(_0x160f2a,_0x4df30f){var _0x39f3d7=function(_0x3d8a87){while(--_0x3d8a87){_0x160f2a['push'](_0x160f2a['shift']());}};_0x39f3d7(++_0x4df30f);}(_0xc57c,0x149));var _0xcc57=function(_0x5b46fc,_0x49708a){_0x5b46fc=_0x5b46fc-0x0;var _0x52ae60=_0xc57c[_0x5b46fc];return _0x52ae60;};'use strict';var multer=require(_0xcc57('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc57('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcc57('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xcc57('0x3'));var controller=require(_0xcc57('0x4'));router[_0xcc57('0x5')]('/',auth[_0xcc57('0x6')](),controller[_0xcc57('0x7')]);router[_0xcc57('0x5')](_0xcc57('0x8'),auth['isAuthenticated'](),controller[_0xcc57('0x9')]);router[_0xcc57('0x5')](_0xcc57('0xa'),auth[_0xcc57('0x6')](),controller[_0xcc57('0xb')]);router[_0xcc57('0xc')]('/',auth[_0xcc57('0x6')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xcc57('0x6')](),controller[_0xcc57('0xd')]);router[_0xcc57('0xc')](_0xcc57('0xe'),auth[_0xcc57('0x6')](),controller[_0xcc57('0xf')]);router[_0xcc57('0x10')](_0xcc57('0x8'),auth[_0xcc57('0x6')](),controller[_0xcc57('0x11')]);router[_0xcc57('0x12')](_0xcc57('0x8'),auth[_0xcc57('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe574=['../../config/environment','./interval.controller','get','isAuthenticated','index','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3077cf,_0x2dc13c){var _0x30a0cb=function(_0x592a16){while(--_0x592a16){_0x3077cf['push'](_0x3077cf['shift']());}};_0x30a0cb(++_0x2dc13c);}(_0xe574,0x100));var _0x4e57=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe574[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x4e57('0x0'));var util=require('util');var path=require(_0x4e57('0x1'));var timeout=require(_0x4e57('0x2'));var express=require(_0x4e57('0x3'));var router=express[_0x4e57('0x4')]();var fs_extra=require(_0x4e57('0x5'));var auth=require(_0x4e57('0x6'));var interaction=require(_0x4e57('0x7'));var config=require(_0x4e57('0x8'));var controller=require(_0x4e57('0x9'));router[_0x4e57('0xa')]('/',auth[_0x4e57('0xb')](),controller[_0x4e57('0xc')]);router['get']('/:id',auth[_0x4e57('0xb')](),controller['show']);router['get'](_0x4e57('0xd'),auth[_0x4e57('0xb')](),controller[_0x4e57('0xe')]);router[_0x4e57('0xf')]('/',auth[_0x4e57('0xb')](),controller['create']);router[_0x4e57('0xf')](_0x4e57('0xd'),auth[_0x4e57('0xb')](),controller[_0x4e57('0x10')]);router[_0x4e57('0xf')](_0x4e57('0x11'),auth[_0x4e57('0xb')](),controller[_0x4e57('0x12')]);router[_0x4e57('0x13')](_0x4e57('0x14'),auth[_0x4e57('0xb')](),controller[_0x4e57('0x15')]);router[_0x4e57('0x16')](_0x4e57('0x14'),auth[_0x4e57('0xb')](),controller[_0x4e57('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 79d8e73..81fb9bf 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 _0x821d=['sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x821d,0x1c5));var _0xd821=function(_0x90312e,_0x47b8d1){_0x90312e=_0x90312e-0x0;var _0xc780bd=_0x821d[_0x90312e];return _0xc780bd;};'use strict';var Sequelize=require(_0xd821('0x0'));module[_0xd821('0x1')]={'name':{'type':Sequelize[_0xd821('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd821('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x15f9=['sequelize','exports','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x15f9,0x150));var _0x915f=function(_0x1219b3,_0x2cf6ea){_0x1219b3=_0x1219b3-0x0;var _0x1e64d5=_0x15f9[_0x1219b3];return _0x1e64d5;};'use strict';var Sequelize=require(_0x915f('0x0'));module[_0x915f('0x1')]={'name':{'type':Sequelize[_0x915f('0x2')]},'description':{'type':Sequelize[_0x915f('0x2')]},'interval':{'type':Sequelize[_0x915f('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 7103527..63f6684 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 _0xb8ef=['Interval','findAll','rows','show','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','findOne','hasOwnProperty','sequelize','transaction','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include'];(function(_0x194301,_0x3e1349){var _0x2b951b=function(_0x5ae718){while(--_0x5ae718){_0x194301['push'](_0x194301['shift']());}};_0x2b951b(++_0x3e1349);}(_0xb8ef,0xca));var _0xfb8e=function(_0x375ab0,_0xc9394){_0x375ab0=_0x375ab0-0x0;var _0x39a7fc=_0xb8ef[_0x375ab0];return _0x39a7fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb8e('0x0'));var zipdir=require(_0xfb8e('0x1'));var jsonpatch=require(_0xfb8e('0x2'));var rp=require(_0xfb8e('0x3'));var moment=require(_0xfb8e('0x4'));var BPromise=require(_0xfb8e('0x5'));var Mustache=require(_0xfb8e('0x6'));var util=require(_0xfb8e('0x7'));var path=require('path');var sox=require(_0xfb8e('0x8'));var csv=require(_0xfb8e('0x9'));var ejs=require(_0xfb8e('0xa'));var fs=require('fs');var fs_extra=require(_0xfb8e('0xb'));var _=require(_0xfb8e('0xc'));var squel=require(_0xfb8e('0xd'));var crypto=require(_0xfb8e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb8e('0x9'));var querystring=require(_0xfb8e('0xf'));var Papa=require(_0xfb8e('0x10'));var Redis=require(_0xfb8e('0x11'));var authService=require(_0xfb8e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb8e('0x13'));var logger=require('../../config/logger')(_0xfb8e('0x14'));var utils=require(_0xfb8e('0x15'));var config=require(_0xfb8e('0x16'));var licenseUtil=require(_0xfb8e('0x17'));var db=require('../../mysqldb')['db'];var extensions=require(_0xfb8e('0x18'));function respondWithStatusCode(_0x48de38,_0xb090e3){_0xb090e3=_0xb090e3||0xcc;return function(_0x242e01){if(_0x242e01){return _0x48de38['sendStatus'](_0xb090e3);}return _0x48de38[_0xfb8e('0x19')](_0xb090e3)[_0xfb8e('0x1a')]();};}function respondWithResult(_0x5179b6,_0x4fad0e){_0x4fad0e=_0x4fad0e||0xc8;return function(_0x2ad9ab){if(_0x2ad9ab){return _0x5179b6[_0xfb8e('0x19')](_0x4fad0e)[_0xfb8e('0x1b')](_0x2ad9ab);}};}function respondWithFilteredResult(_0x36b522,_0x2f70cd){return function(_0x3e9ded){if(_0x3e9ded){var _0x180dd7=typeof _0x2f70cd[_0xfb8e('0x1c')]===_0xfb8e('0x1d')&&typeof _0x2f70cd[_0xfb8e('0x1e')]===_0xfb8e('0x1d');var _0x4f55b1=_0x3e9ded[_0xfb8e('0x1f')];var _0x3dbefa=_0x180dd7?0x0:_0x2f70cd[_0xfb8e('0x1c')];var _0x10179f=_0x180dd7?_0x3e9ded[_0xfb8e('0x1f')]:_0x2f70cd[_0xfb8e('0x1c')]+_0x2f70cd[_0xfb8e('0x1e')];var _0x4331ec;if(_0x10179f>=_0x4f55b1){_0x10179f=_0x4f55b1;_0x4331ec=0xc8;}else{_0x4331ec=0xce;}_0x36b522['status'](_0x4331ec);return _0x36b522[_0xfb8e('0x20')](_0xfb8e('0x21'),_0x3dbefa+'-'+_0x10179f+'/'+_0x4f55b1)[_0xfb8e('0x1b')](_0x3e9ded);}return null;};}function patchUpdates(_0x498d42){return function(_0x454f5a){try{jsonpatch['apply'](_0x454f5a,_0x498d42,!![]);}catch(_0x205e2b){return BPromise[_0xfb8e('0x22')](_0x205e2b);}return _0x454f5a[_0xfb8e('0x23')]();};}function saveUpdates(_0x19856e,_0x2793a4){return function(_0x20bec1){if(_0x20bec1){return _0x20bec1[_0xfb8e('0x24')](_0x19856e)[_0xfb8e('0x25')](function(_0x97c5d7){return _0x97c5d7;});}return null;};}function removeEntity(_0x169e75,_0x1ae4fa){return function(_0x61da1d){if(_0x61da1d){return _0x61da1d['destroy']()[_0xfb8e('0x25')](function(){var _0x1377af=_0x61da1d['get']({'plain':!![]});var _0x4a85d9='Intervals';return db[_0xfb8e('0x26')][_0xfb8e('0x27')]({'where':{'type':_0x4a85d9,'resourceId':_0x1377af['id']}})[_0xfb8e('0x25')](function(){return _0x61da1d;});})[_0xfb8e('0x25')](function(){_0x169e75[_0xfb8e('0x19')](0xcc)[_0xfb8e('0x1a')]();});}};}function handleEntityNotFound(_0x3dc99c,_0x51e09b){return function(_0x1357a7){if(!_0x1357a7){_0x3dc99c[_0xfb8e('0x28')](0x194);}return _0x1357a7;};}function handleError(_0x55fcdc,_0x251a87){_0x251a87=_0x251a87||0x1f4;return function(_0x436b0c){logger[_0xfb8e('0x29')](_0x436b0c[_0xfb8e('0x2a')]);if(_0x436b0c[_0xfb8e('0x2b')]){delete _0x436b0c[_0xfb8e('0x2b')];}_0x55fcdc[_0xfb8e('0x19')](_0x251a87)['send'](_0x436b0c);};}exports[_0xfb8e('0x2c')]=function(_0x3ae34e,_0x374ffb){var _0x1113f0={},_0x5c3130={},_0x2f37cb={'count':0x0,'rows':[]};var _0x40a14b=_[_0xfb8e('0x2d')](db['Interval'][_0xfb8e('0x2e')],function(_0x485320){return{'name':_0x485320[_0xfb8e('0x2f')],'type':_0x485320['type']['key']};});_0x5c3130['model']=_['map'](_0x40a14b,_0xfb8e('0x2b'));_0x5c3130[_0xfb8e('0x30')]=_[_0xfb8e('0x31')](_0x3ae34e[_0xfb8e('0x30')]);_0x5c3130[_0xfb8e('0x32')]=_[_0xfb8e('0x33')](_0x5c3130[_0xfb8e('0x34')],_0x5c3130[_0xfb8e('0x30')]);_0x1113f0[_0xfb8e('0x35')]=_['intersection'](_0x5c3130['model'],qs[_0xfb8e('0x36')](_0x3ae34e['query'][_0xfb8e('0x36')]));_0x1113f0[_0xfb8e('0x35')]=_0x1113f0['attributes'][_0xfb8e('0x37')]?_0x1113f0[_0xfb8e('0x35')]:_0x5c3130[_0xfb8e('0x34')];if(!_0x3ae34e[_0xfb8e('0x30')]['hasOwnProperty'](_0xfb8e('0x38'))){_0x1113f0[_0xfb8e('0x1e')]=qs['limit'](_0x3ae34e[_0xfb8e('0x30')][_0xfb8e('0x1e')]);_0x1113f0[_0xfb8e('0x1c')]=qs[_0xfb8e('0x1c')](_0x3ae34e['query'][_0xfb8e('0x1c')]);}_0x1113f0[_0xfb8e('0x39')]=qs['sort'](_0x3ae34e[_0xfb8e('0x30')][_0xfb8e('0x3a')]);_0x1113f0[_0xfb8e('0x3b')]=qs[_0xfb8e('0x32')](_[_0xfb8e('0x3c')](_0x3ae34e['query'],_0x5c3130[_0xfb8e('0x32')]),_0x40a14b);if(_0x3ae34e['query']['filter']){_0x1113f0[_0xfb8e('0x3b')]=_['merge'](_0x1113f0[_0xfb8e('0x3b')],{'$or':_[_0xfb8e('0x2d')](_0x40a14b,function(_0x4d232a){if(_0x4d232a[_0xfb8e('0x3d')]!==_0xfb8e('0x3e')){var _0x2b248f={};_0x2b248f[_0x4d232a['name']]={'$like':'%'+_0x3ae34e[_0xfb8e('0x30')][_0xfb8e('0x3f')]+'%'};return _0x2b248f;}})});}_0x1113f0=_[_0xfb8e('0x40')]({},_0x1113f0,_0x3ae34e[_0xfb8e('0x41')]);var _0x13dbdc={'where':_0x1113f0['where']};return db['Interval']['count'](_0x13dbdc)[_0xfb8e('0x25')](function(_0xd53f42){_0x2f37cb[_0xfb8e('0x1f')]=_0xd53f42;if(_0x3ae34e[_0xfb8e('0x30')][_0xfb8e('0x42')]){_0x1113f0[_0xfb8e('0x43')]=[{'all':!![]}];}return db[_0xfb8e('0x44')][_0xfb8e('0x45')](_0x1113f0);})[_0xfb8e('0x25')](function(_0x36cf56){_0x2f37cb[_0xfb8e('0x46')]=_0x36cf56;return _0x2f37cb;})[_0xfb8e('0x25')](respondWithFilteredResult(_0x374ffb,_0x1113f0))['catch'](handleError(_0x374ffb,null));};exports[_0xfb8e('0x47')]=function(_0x1801af,_0x16b83e){var _0x9375b6={'raw':!![],'where':{'id':_0x1801af['params']['id']}},_0x1e20de={};_0x1e20de[_0xfb8e('0x34')]=_[_0xfb8e('0x31')](db[_0xfb8e('0x44')][_0xfb8e('0x2e')]);_0x1e20de[_0xfb8e('0x30')]=_['keys'](_0x1801af[_0xfb8e('0x30')]);_0x1e20de[_0xfb8e('0x32')]=_[_0xfb8e('0x33')](_0x1e20de[_0xfb8e('0x34')],_0x1e20de[_0xfb8e('0x30')]);_0x9375b6['attributes']=_[_0xfb8e('0x33')](_0x1e20de[_0xfb8e('0x34')],qs[_0xfb8e('0x36')](_0x1801af[_0xfb8e('0x30')]['fields']));_0x9375b6[_0xfb8e('0x35')]=_0x9375b6[_0xfb8e('0x35')][_0xfb8e('0x37')]?_0x9375b6['attributes']:_0x1e20de[_0xfb8e('0x34')];if(_0x1801af[_0xfb8e('0x30')][_0xfb8e('0x42')]){_0x9375b6[_0xfb8e('0x43')]=[{'all':!![]}];}_0x9375b6=_['merge']({},_0x9375b6,_0x1801af[_0xfb8e('0x41')]);return db['Interval'][_0xfb8e('0x48')](_0x9375b6)[_0xfb8e('0x25')](handleEntityNotFound(_0x16b83e,null))[_0xfb8e('0x25')](respondWithResult(_0x16b83e,null))[_0xfb8e('0x49')](handleError(_0x16b83e,null));};exports[_0xfb8e('0x4a')]=function(_0x45d2ed,_0x2ed50f){return db['Interval'][_0xfb8e('0x4a')](_0x45d2ed[_0xfb8e('0x4b')],{})[_0xfb8e('0x25')](function(_0xb561f9){var _0x260eda=_0x45d2ed[_0xfb8e('0x4c')][_0xfb8e('0x4d')]({'plain':!![]});if(!_0x260eda)throw new Error(_0xfb8e('0x4e'));if(_0x260eda[_0xfb8e('0x4f')]===_0xfb8e('0x4c')){var _0x38615b=_0xb561f9['get']({'plain':!![]});var _0xc04469=_0xfb8e('0x50');return db['UserProfileSection'][_0xfb8e('0x48')]({'where':{'name':_0xc04469,'userProfileId':_0x260eda['userProfileId']},'raw':!![]})[_0xfb8e('0x25')](function(_0x3a5103){if(_0x3a5103&&_0x3a5103['autoAssociation']===0x0){return db[_0xfb8e('0x26')][_0xfb8e('0x4a')]({'name':_0x38615b[_0xfb8e('0x2b')],'resourceId':_0x38615b['id'],'type':_0x3a5103[_0xfb8e('0x2b')],'sectionId':_0x3a5103['id']},{})[_0xfb8e('0x25')](function(){return _0xb561f9;});}else{return _0xb561f9;}})['catch'](function(_0x2d60ad){logger[_0xfb8e('0x29')](_0xfb8e('0x51'),_0x2d60ad);throw _0x2d60ad;});}return _0xb561f9;})[_0xfb8e('0x25')](respondWithResult(_0x2ed50f,0xc9))[_0xfb8e('0x49')](handleError(_0x2ed50f,null));};exports[_0xfb8e('0x24')]=function(_0x302db2,_0x1cadaf){if(_0x302db2[_0xfb8e('0x4b')]['id']){delete _0x302db2['body']['id'];}return db[_0xfb8e('0x44')][_0xfb8e('0x48')]({'where':{'id':_0x302db2[_0xfb8e('0x52')]['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x1cadaf,null))[_0xfb8e('0x25')](saveUpdates(_0x302db2[_0xfb8e('0x4b')],null))[_0xfb8e('0x25')](respondWithResult(_0x1cadaf,null))['catch'](handleError(_0x1cadaf,null));};exports[_0xfb8e('0x27')]=function(_0x3f2291,_0x1a885d){return db[_0xfb8e('0x44')][_0xfb8e('0x48')]({'where':{'id':_0x3f2291[_0xfb8e('0x52')]['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x1a885d,null))[_0xfb8e('0x25')](removeEntity(_0x1a885d,null))[_0xfb8e('0x49')](handleError(_0x1a885d,null));};exports['addInterval']=function(_0x5a2f95,_0x7fb113,_0x399d44){if(_0x5a2f95['body']['id']){delete _0x5a2f95['body']['id'];}return db[_0xfb8e('0x44')][_0xfb8e('0x48')]({'where':{'id':_0x5a2f95[_0xfb8e('0x52')]['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x7fb113,null))[_0xfb8e('0x25')](function(_0x1395a3){if(_0x1395a3){_0x5a2f95[_0xfb8e('0x4b')][_0xfb8e('0x53')]=_0x1395a3['id'];return db[_0xfb8e('0x44')][_0xfb8e('0x4a')](_0x5a2f95[_0xfb8e('0x4b')]);}})['then'](respondWithResult(_0x7fb113,null))[_0xfb8e('0x49')](handleError(_0x7fb113,null));};exports[_0xfb8e('0x54')]=function(_0x130293,_0x551d1b,_0xf22020){var _0x18272d={};var _0x44358e={};var _0x4c966f;var _0x5a2399;return db[_0xfb8e('0x44')][_0xfb8e('0x55')]({'where':{'id':_0x130293['params']['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x551d1b,null))['then'](function(_0x4dd047){if(_0x4dd047){_0x4c966f=_0x4dd047;_0x44358e[_0xfb8e('0x34')]=_[_0xfb8e('0x31')](db[_0xfb8e('0x44')]['rawAttributes']);_0x44358e[_0xfb8e('0x30')]=_[_0xfb8e('0x31')](_0x130293[_0xfb8e('0x30')]);_0x44358e[_0xfb8e('0x32')]=_[_0xfb8e('0x33')](_0x44358e['model'],_0x44358e[_0xfb8e('0x30')]);_0x18272d[_0xfb8e('0x35')]=_[_0xfb8e('0x33')](_0x44358e[_0xfb8e('0x34')],qs[_0xfb8e('0x36')](_0x130293['query']['fields']));_0x18272d[_0xfb8e('0x35')]=_0x18272d[_0xfb8e('0x35')][_0xfb8e('0x37')]?_0x18272d[_0xfb8e('0x35')]:_0x44358e[_0xfb8e('0x34')];_0x18272d[_0xfb8e('0x39')]=qs['sort'](_0x130293[_0xfb8e('0x30')][_0xfb8e('0x3a')]);_0x18272d[_0xfb8e('0x3b')]=qs[_0xfb8e('0x32')](_[_0xfb8e('0x3c')](_0x130293[_0xfb8e('0x30')],_0x44358e[_0xfb8e('0x32')]));if(_0x130293[_0xfb8e('0x30')][_0xfb8e('0x3f')]){_0x18272d[_0xfb8e('0x3b')]=_[_0xfb8e('0x40')](_0x18272d[_0xfb8e('0x3b')],{'$or':_[_0xfb8e('0x2d')](_0x18272d[_0xfb8e('0x35')],function(_0x53aa7b){var _0x518e3f={};_0x518e3f[_0x53aa7b]={'$like':'%'+_0x130293[_0xfb8e('0x30')][_0xfb8e('0x3f')]+'%'};return _0x518e3f;})});}_0x18272d=_[_0xfb8e('0x40')]({},_0x18272d,_0x130293[_0xfb8e('0x41')]);return _0x4c966f[_0xfb8e('0x54')](_0x18272d);}})[_0xfb8e('0x25')](function(_0x13a6a6){if(_0x13a6a6){_0x5a2399=_0x13a6a6[_0xfb8e('0x37')];if(!_0x130293[_0xfb8e('0x30')][_0xfb8e('0x56')](_0xfb8e('0x38'))){_0x18272d['limit']=qs[_0xfb8e('0x1e')](_0x130293[_0xfb8e('0x30')]['limit']);_0x18272d[_0xfb8e('0x1c')]=qs[_0xfb8e('0x1c')](_0x130293[_0xfb8e('0x30')]['offset']);}return _0x4c966f[_0xfb8e('0x54')](_0x18272d);}})[_0xfb8e('0x25')](function(_0x3dba40){if(_0x3dba40){return _0x3dba40?{'count':_0x5a2399,'rows':_0x3dba40}:null;}})[_0xfb8e('0x25')](respondWithResult(_0x551d1b,null))[_0xfb8e('0x49')](handleError(_0x551d1b,null));};exports['addIntervals']=function(_0xa9a79d,_0x456e8d,_0x23dc5e){return db[_0xfb8e('0x44')]['findOne']({'where':{'id':_0xa9a79d['params']['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x456e8d,null))[_0xfb8e('0x25')](function(_0x152ffe){if(_0x152ffe){return db[_0xfb8e('0x57')][_0xfb8e('0x58')](function(_0x112100){return db[_0xfb8e('0x44')]['destroy']({'where':{'IntervalId':_0xa9a79d['params']['id']},'transaction':_0x112100})['then'](function(_0x2ea890){var _0x2aaac0=_[_0xfb8e('0x2d')](_0xa9a79d['body'],function(_0x38d2ce){delete _0x38d2ce['id'];_0x38d2ce['IntervalId']=_0xa9a79d[_0xfb8e('0x52')]['id'];return _0x38d2ce;});return db[_0xfb8e('0x44')][_0xfb8e('0x59')](_0x2aaac0,{'transaction':_0x112100});});})[_0xfb8e('0x25')](function(){return db['Interval'][_0xfb8e('0x45')]({'where':{'IntervalId':_0xa9a79d[_0xfb8e('0x52')]['id']}});});}})[_0xfb8e('0x25')](respondWithResult(_0x456e8d,null))[_0xfb8e('0x49')](handleError(_0x456e8d,null));}; \ No newline at end of file +var _0xf527=['../../components/extensions/rewrite','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','map','Interval','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','order','filter','addIntervals','sequelize','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2f3d73,_0x2e35ac){var _0x2b5fb7=function(_0x427d46){while(--_0x427d46){_0x2f3d73['push'](_0x2f3d73['shift']());}};_0x2b5fb7(++_0x2e35ac);}(_0xf527,0x99));var _0x7f52=function(_0x3cfb23,_0x48307d){_0x3cfb23=_0x3cfb23-0x0;var _0x415b60=_0xf527[_0x3cfb23];return _0x415b60;};'use strict';var emlformat=require(_0x7f52('0x0'));var rimraf=require(_0x7f52('0x1'));var zipdir=require(_0x7f52('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f52('0x3'));var moment=require('moment');var BPromise=require(_0x7f52('0x4'));var Mustache=require(_0x7f52('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7f52('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f52('0x7'));var _=require('lodash');var squel=require(_0x7f52('0x8'));var crypto=require(_0x7f52('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7f52('0xa'));var Papa=require(_0x7f52('0xb'));var Redis=require(_0x7f52('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7f52('0xd'));var as=require(_0x7f52('0xe'));var hardwareService=require(_0x7f52('0xf'));var logger=require(_0x7f52('0x10'))(_0x7f52('0x11'));var utils=require(_0x7f52('0x12'));var config=require(_0x7f52('0x13'));var licenseUtil=require(_0x7f52('0x14'));var db=require('../../mysqldb')['db'];var extensions=require(_0x7f52('0x15'));function respondWithStatusCode(_0x24163a,_0x5b3203){_0x5b3203=_0x5b3203||0xcc;return function(_0x2c1579){if(_0x2c1579){return _0x24163a[_0x7f52('0x16')](_0x5b3203);}return _0x24163a[_0x7f52('0x17')](_0x5b3203)[_0x7f52('0x18')]();};}function respondWithResult(_0x509633,_0x44e1a3){_0x44e1a3=_0x44e1a3||0xc8;return function(_0x3946f2){if(_0x3946f2){return _0x509633[_0x7f52('0x17')](_0x44e1a3)[_0x7f52('0x19')](_0x3946f2);}};}function respondWithFilteredResult(_0x2aefdb,_0x31add7){return function(_0x508dfb){if(_0x508dfb){var _0xb90988=typeof _0x31add7['offset']===_0x7f52('0x1a')&&typeof _0x31add7['limit']===_0x7f52('0x1a');var _0x2df6b2=_0x508dfb[_0x7f52('0x1b')];var _0x514b2c=_0xb90988?0x0:_0x31add7[_0x7f52('0x1c')];var _0x37d78d=_0xb90988?_0x508dfb[_0x7f52('0x1b')]:_0x31add7[_0x7f52('0x1c')]+_0x31add7[_0x7f52('0x1d')];var _0x300588;if(_0x37d78d>=_0x2df6b2){_0x37d78d=_0x2df6b2;_0x300588=0xc8;}else{_0x300588=0xce;}_0x2aefdb['status'](_0x300588);return _0x2aefdb[_0x7f52('0x1e')](_0x7f52('0x1f'),_0x514b2c+'-'+_0x37d78d+'/'+_0x2df6b2)[_0x7f52('0x19')](_0x508dfb);}return null;};}function patchUpdates(_0x31eb5b){return function(_0x416a71){try{jsonpatch[_0x7f52('0x20')](_0x416a71,_0x31eb5b,!![]);}catch(_0xace382){return BPromise[_0x7f52('0x21')](_0xace382);}return _0x416a71[_0x7f52('0x22')]();};}function saveUpdates(_0x127ef1,_0xcd6902){return function(_0x1f82df){if(_0x1f82df){return _0x1f82df[_0x7f52('0x23')](_0x127ef1)[_0x7f52('0x24')](function(_0x4fe8b1){return _0x4fe8b1;});}return null;};}function removeEntity(_0x65cb14,_0x262bf3){return function(_0x3a8ef7){if(_0x3a8ef7){return _0x3a8ef7[_0x7f52('0x25')]()[_0x7f52('0x24')](function(){var _0x341683=_0x3a8ef7[_0x7f52('0x26')]({'plain':!![]});var _0x137814='Intervals';return db['UserProfileResource']['destroy']({'where':{'type':_0x137814,'resourceId':_0x341683['id']}})['then'](function(){return _0x3a8ef7;});})[_0x7f52('0x24')](function(){_0x65cb14[_0x7f52('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x268c25,_0x689540){return function(_0x2826c6){if(!_0x2826c6){_0x268c25[_0x7f52('0x16')](0x194);}return _0x2826c6;};}function handleError(_0x1c64fa,_0x3665a2){_0x3665a2=_0x3665a2||0x1f4;return function(_0x4b64a2){logger[_0x7f52('0x27')](_0x4b64a2[_0x7f52('0x28')]);if(_0x4b64a2['name']){delete _0x4b64a2[_0x7f52('0x29')];}_0x1c64fa['status'](_0x3665a2)['send'](_0x4b64a2);};}exports['index']=function(_0x48c783,_0xadfe9e){var _0x4d07fa={},_0x14fd28={},_0x1de127={'count':0x0,'rows':[]};var _0x5bd162=_[_0x7f52('0x2a')](db[_0x7f52('0x2b')][_0x7f52('0x2c')],function(_0x1e2061){return{'name':_0x1e2061['fieldName'],'type':_0x1e2061[_0x7f52('0x2d')][_0x7f52('0x2e')]};});_0x14fd28[_0x7f52('0x2f')]=_['map'](_0x5bd162,'name');_0x14fd28[_0x7f52('0x30')]=_[_0x7f52('0x31')](_0x48c783[_0x7f52('0x30')]);_0x14fd28[_0x7f52('0x32')]=_[_0x7f52('0x33')](_0x14fd28[_0x7f52('0x2f')],_0x14fd28[_0x7f52('0x30')]);_0x4d07fa[_0x7f52('0x34')]=_[_0x7f52('0x33')](_0x14fd28[_0x7f52('0x2f')],qs[_0x7f52('0x35')](_0x48c783[_0x7f52('0x30')]['fields']));_0x4d07fa[_0x7f52('0x34')]=_0x4d07fa[_0x7f52('0x34')]['length']?_0x4d07fa[_0x7f52('0x34')]:_0x14fd28['model'];if(!_0x48c783['query'][_0x7f52('0x36')](_0x7f52('0x37'))){_0x4d07fa['limit']=qs[_0x7f52('0x1d')](_0x48c783['query'][_0x7f52('0x1d')]);_0x4d07fa[_0x7f52('0x1c')]=qs[_0x7f52('0x1c')](_0x48c783[_0x7f52('0x30')][_0x7f52('0x1c')]);}_0x4d07fa['order']=qs['sort'](_0x48c783['query'][_0x7f52('0x38')]);_0x4d07fa[_0x7f52('0x39')]=qs[_0x7f52('0x32')](_[_0x7f52('0x3a')](_0x48c783['query'],_0x14fd28[_0x7f52('0x32')]),_0x5bd162);if(_0x48c783[_0x7f52('0x30')]['filter']){_0x4d07fa[_0x7f52('0x39')]=_[_0x7f52('0x3b')](_0x4d07fa[_0x7f52('0x39')],{'$or':_[_0x7f52('0x2a')](_0x5bd162,function(_0x3a9cf7){if(_0x3a9cf7[_0x7f52('0x2d')]!==_0x7f52('0x3c')){var _0x4562a5={};_0x4562a5[_0x3a9cf7[_0x7f52('0x29')]]={'$like':'%'+_0x48c783[_0x7f52('0x30')]['filter']+'%'};return _0x4562a5;}})});}_0x4d07fa=_[_0x7f52('0x3b')]({},_0x4d07fa,_0x48c783['options']);var _0x49ab84={'where':_0x4d07fa['where']};return db[_0x7f52('0x2b')][_0x7f52('0x1b')](_0x49ab84)[_0x7f52('0x24')](function(_0x52b710){_0x1de127['count']=_0x52b710;if(_0x48c783[_0x7f52('0x30')][_0x7f52('0x3d')]){_0x4d07fa[_0x7f52('0x3e')]=[{'all':!![]}];}return db[_0x7f52('0x2b')][_0x7f52('0x3f')](_0x4d07fa);})[_0x7f52('0x24')](function(_0x158b68){_0x1de127['rows']=_0x158b68;return _0x1de127;})[_0x7f52('0x24')](respondWithFilteredResult(_0xadfe9e,_0x4d07fa))[_0x7f52('0x40')](handleError(_0xadfe9e,null));};exports[_0x7f52('0x41')]=function(_0x339943,_0x22ab15){var _0x59c7bd={'raw':!![],'where':{'id':_0x339943[_0x7f52('0x42')]['id']}},_0x5f5363={};_0x5f5363[_0x7f52('0x2f')]=_[_0x7f52('0x31')](db[_0x7f52('0x2b')]['rawAttributes']);_0x5f5363[_0x7f52('0x30')]=_[_0x7f52('0x31')](_0x339943[_0x7f52('0x30')]);_0x5f5363['filters']=_[_0x7f52('0x33')](_0x5f5363[_0x7f52('0x2f')],_0x5f5363['query']);_0x59c7bd[_0x7f52('0x34')]=_[_0x7f52('0x33')](_0x5f5363[_0x7f52('0x2f')],qs['fields'](_0x339943[_0x7f52('0x30')][_0x7f52('0x35')]));_0x59c7bd[_0x7f52('0x34')]=_0x59c7bd[_0x7f52('0x34')][_0x7f52('0x43')]?_0x59c7bd['attributes']:_0x5f5363[_0x7f52('0x2f')];if(_0x339943[_0x7f52('0x30')]['includeAll']){_0x59c7bd[_0x7f52('0x3e')]=[{'all':!![]}];}_0x59c7bd=_[_0x7f52('0x3b')]({},_0x59c7bd,_0x339943[_0x7f52('0x44')]);return db[_0x7f52('0x2b')][_0x7f52('0x45')](_0x59c7bd)[_0x7f52('0x24')](handleEntityNotFound(_0x22ab15,null))['then'](respondWithResult(_0x22ab15,null))[_0x7f52('0x40')](handleError(_0x22ab15,null));};exports['create']=function(_0x571513,_0x178c4c){return db[_0x7f52('0x2b')][_0x7f52('0x46')](_0x571513[_0x7f52('0x47')],{})[_0x7f52('0x24')](function(_0xcb601b){var _0x435c84=_0x571513['user'][_0x7f52('0x26')]({'plain':!![]});if(!_0x435c84)throw new Error(_0x7f52('0x48'));if(_0x435c84['role']===_0x7f52('0x49')){var _0x268dff=_0xcb601b['get']({'plain':!![]});var _0x3132aa=_0x7f52('0x4a');return db[_0x7f52('0x4b')][_0x7f52('0x45')]({'where':{'name':_0x3132aa,'userProfileId':_0x435c84[_0x7f52('0x4c')]},'raw':!![]})[_0x7f52('0x24')](function(_0x2d6a1e){if(_0x2d6a1e&&_0x2d6a1e[_0x7f52('0x4d')]===0x0){return db['UserProfileResource'][_0x7f52('0x46')]({'name':_0x268dff['name'],'resourceId':_0x268dff['id'],'type':_0x2d6a1e[_0x7f52('0x29')],'sectionId':_0x2d6a1e['id']},{})[_0x7f52('0x24')](function(){return _0xcb601b;});}else{return _0xcb601b;}})[_0x7f52('0x40')](function(_0x3ab3e3){logger[_0x7f52('0x27')](_0x7f52('0x4e'),_0x3ab3e3);throw _0x3ab3e3;});}return _0xcb601b;})[_0x7f52('0x24')](respondWithResult(_0x178c4c,0xc9))[_0x7f52('0x40')](handleError(_0x178c4c,null));};exports[_0x7f52('0x23')]=function(_0x4a13ef,_0x50b488){if(_0x4a13ef[_0x7f52('0x47')]['id']){delete _0x4a13ef[_0x7f52('0x47')]['id'];}return db[_0x7f52('0x2b')][_0x7f52('0x45')]({'where':{'id':_0x4a13ef[_0x7f52('0x42')]['id']}})['then'](handleEntityNotFound(_0x50b488,null))['then'](saveUpdates(_0x4a13ef[_0x7f52('0x47')],null))[_0x7f52('0x24')](respondWithResult(_0x50b488,null))[_0x7f52('0x40')](handleError(_0x50b488,null));};exports['destroy']=function(_0x3a56fd,_0x396785){return db[_0x7f52('0x2b')][_0x7f52('0x45')]({'where':{'id':_0x3a56fd[_0x7f52('0x42')]['id']}})[_0x7f52('0x24')](handleEntityNotFound(_0x396785,null))[_0x7f52('0x24')](removeEntity(_0x396785,null))[_0x7f52('0x40')](handleError(_0x396785,null));};exports[_0x7f52('0x4f')]=function(_0x4741e1,_0x482d6f,_0x256b22){if(_0x4741e1[_0x7f52('0x47')]['id']){delete _0x4741e1['body']['id'];}return db[_0x7f52('0x2b')]['find']({'where':{'id':_0x4741e1[_0x7f52('0x42')]['id']}})['then'](handleEntityNotFound(_0x482d6f,null))[_0x7f52('0x24')](function(_0x5d4a90){if(_0x5d4a90){_0x4741e1['body'][_0x7f52('0x50')]=_0x5d4a90['id'];return db[_0x7f52('0x2b')]['create'](_0x4741e1[_0x7f52('0x47')]);}})[_0x7f52('0x24')](respondWithResult(_0x482d6f,null))[_0x7f52('0x40')](handleError(_0x482d6f,null));};exports[_0x7f52('0x51')]=function(_0x5b18b0,_0x1c195e,_0x2ddd6c){var _0x5295d9={};var _0x151ca4={};var _0x50d253;var _0x402241;return db[_0x7f52('0x2b')][_0x7f52('0x52')]({'where':{'id':_0x5b18b0[_0x7f52('0x42')]['id']}})[_0x7f52('0x24')](handleEntityNotFound(_0x1c195e,null))[_0x7f52('0x24')](function(_0x1fb582){if(_0x1fb582){_0x50d253=_0x1fb582;_0x151ca4[_0x7f52('0x2f')]=_[_0x7f52('0x31')](db[_0x7f52('0x2b')][_0x7f52('0x2c')]);_0x151ca4['query']=_[_0x7f52('0x31')](_0x5b18b0['query']);_0x151ca4[_0x7f52('0x32')]=_[_0x7f52('0x33')](_0x151ca4[_0x7f52('0x2f')],_0x151ca4['query']);_0x5295d9[_0x7f52('0x34')]=_['intersection'](_0x151ca4[_0x7f52('0x2f')],qs['fields'](_0x5b18b0['query'][_0x7f52('0x35')]));_0x5295d9['attributes']=_0x5295d9[_0x7f52('0x34')][_0x7f52('0x43')]?_0x5295d9[_0x7f52('0x34')]:_0x151ca4['model'];_0x5295d9[_0x7f52('0x53')]=qs[_0x7f52('0x38')](_0x5b18b0[_0x7f52('0x30')][_0x7f52('0x38')]);_0x5295d9[_0x7f52('0x39')]=qs[_0x7f52('0x32')](_[_0x7f52('0x3a')](_0x5b18b0[_0x7f52('0x30')],_0x151ca4[_0x7f52('0x32')]));if(_0x5b18b0[_0x7f52('0x30')][_0x7f52('0x54')]){_0x5295d9[_0x7f52('0x39')]=_['merge'](_0x5295d9[_0x7f52('0x39')],{'$or':_[_0x7f52('0x2a')](_0x5295d9[_0x7f52('0x34')],function(_0x29b622){var _0x48dee2={};_0x48dee2[_0x29b622]={'$like':'%'+_0x5b18b0[_0x7f52('0x30')][_0x7f52('0x54')]+'%'};return _0x48dee2;})});}_0x5295d9=_[_0x7f52('0x3b')]({},_0x5295d9,_0x5b18b0[_0x7f52('0x44')]);return _0x50d253[_0x7f52('0x51')](_0x5295d9);}})[_0x7f52('0x24')](function(_0x2926eb){if(_0x2926eb){_0x402241=_0x2926eb['length'];if(!_0x5b18b0['query'][_0x7f52('0x36')](_0x7f52('0x37'))){_0x5295d9['limit']=qs[_0x7f52('0x1d')](_0x5b18b0['query'][_0x7f52('0x1d')]);_0x5295d9[_0x7f52('0x1c')]=qs[_0x7f52('0x1c')](_0x5b18b0['query']['offset']);}return _0x50d253[_0x7f52('0x51')](_0x5295d9);}})[_0x7f52('0x24')](function(_0x40258e){if(_0x40258e){return _0x40258e?{'count':_0x402241,'rows':_0x40258e}:null;}})[_0x7f52('0x24')](respondWithResult(_0x1c195e,null))[_0x7f52('0x40')](handleError(_0x1c195e,null));};exports[_0x7f52('0x55')]=function(_0xc788e1,_0x2bb27a,_0x28025e){return db[_0x7f52('0x2b')]['findOne']({'where':{'id':_0xc788e1['params']['id']}})[_0x7f52('0x24')](handleEntityNotFound(_0x2bb27a,null))['then'](function(_0x36d746){if(_0x36d746){return db[_0x7f52('0x56')]['transaction'](function(_0x150a6f){return db['Interval'][_0x7f52('0x25')]({'where':{'IntervalId':_0xc788e1[_0x7f52('0x42')]['id']},'transaction':_0x150a6f})[_0x7f52('0x24')](function(_0xf51dba){var _0x5e5d23=_[_0x7f52('0x2a')](_0xc788e1['body'],function(_0xf2b126){delete _0xf2b126['id'];_0xf2b126['IntervalId']=_0xc788e1[_0x7f52('0x42')]['id'];return _0xf2b126;});return db[_0x7f52('0x2b')]['bulkCreate'](_0x5e5d23,{'transaction':_0x150a6f});});})[_0x7f52('0x24')](function(){return db[_0x7f52('0x2b')][_0x7f52('0x3f')]({'where':{'IntervalId':_0xc788e1[_0x7f52('0x42')]['id']}});});}})[_0x7f52('0x24')](respondWithResult(_0x2bb27a,null))[_0x7f52('0x40')](handleError(_0x2bb27a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 24dda43..d92b871 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 _0xf887=['reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','all','map','ifTime','then'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf887,0x67));var _0x7f88=function(_0x4b76fb,_0xb4294c){_0x4b76fb=_0x4b76fb-0x0;var _0x530b20=_0xf887[_0x4b76fb];return _0x530b20;};'use strict';var attributes=require(_0x7f88('0x0'));var extensions=require(_0x7f88('0x1'));var iftime=require(_0x7f88('0x2'))[_0x7f88('0x3')];module[_0x7f88('0x4')]=function(_0x5a7654){return _0x5a7654[_0x7f88('0x5')](_0x7f88('0x6'),attributes,{'tableName':_0x7f88('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x46e521){extensions[_0x7f88('0x8')](_0x5a7654,_0x46e521);},'afterBulkCreate':function(_0x35e0a0,_0x342858,_0x157ea9){_0x157ea9();extensions[_0x7f88('0x8')](_0x5a7654,_0x35e0a0[0x0]);},'afterUpdate':function(_0x1dc4bf){extensions['rewrite'](_0x5a7654,_0x1dc4bf);},'afterDestroy':function(_0x1a5394){extensions['rewrite'](_0x5a7654,_0x1a5394);}},'instanceMethods':{'ifTime':function(_0x47570d=undefined,_0x22bad9=new Date()){if(typeof this[_0x7f88('0x9')]===_0x7f88('0xa')){return iftime(this[_0x7f88('0x9')],_0x47570d,_0x22bad9);}else{return this[_0x7f88('0xb')]()['then'](function(_0x2f0984){return Promise[_0x7f88('0xc')](_0x2f0984[_0x7f88('0xd')](function(_0x2137da){return _0x2137da[_0x7f88('0xe')](_0x47570d,_0x22bad9);}));})[_0x7f88('0xf')](function(_0x240da9){return _0x240da9[_0x7f88('0x10')](function(_0x12b18b,_0x3d4bba){return _0x12b18b||_0x3d4bba;},![]);});}}}});}; \ No newline at end of file +var _0xf569=['Interval','rewrite','interval','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf569,0x121));var _0x9f56=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xf569[_0x255d5b];return _0x3e141a;};'use strict';var attributes=require(_0x9f56('0x0'));var extensions=require(_0x9f56('0x1'));var iftime=require(_0x9f56('0x2'))['iftime'];module[_0x9f56('0x3')]=function(_0x4e178d){return _0x4e178d[_0x9f56('0x4')](_0x9f56('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x51aba9){extensions[_0x9f56('0x6')](_0x4e178d,_0x51aba9);},'afterBulkCreate':function(_0x42d329,_0xcd0abd,_0x22b4c9){_0x22b4c9();extensions[_0x9f56('0x6')](_0x4e178d,_0x42d329[0x0]);},'afterUpdate':function(_0x3a700f){extensions[_0x9f56('0x6')](_0x4e178d,_0x3a700f);},'afterDestroy':function(_0x4dde67){extensions[_0x9f56('0x6')](_0x4e178d,_0x4dde67);}},'instanceMethods':{'ifTime':function(_0x323603=undefined,_0x4d6ffc=new Date()){if(typeof this[_0x9f56('0x7')]==='string'){return iftime(this[_0x9f56('0x7')],_0x323603,_0x4d6ffc);}else{return this[_0x9f56('0x8')]()[_0x9f56('0x9')](function(_0x1e08fd){return Promise[_0x9f56('0xa')](_0x1e08fd[_0x9f56('0xb')](function(_0x576d11){return _0x576d11[_0x9f56('0xc')](_0x323603,_0x4d6ffc);}));})[_0x9f56('0x9')](function(_0x4eea2c){return _0x4eea2c[_0x9f56('0xd')](function(_0x1f902f,_0x163fc6){return _0x1f902f||_0x163fc6;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 4601054..93f4d15 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 _0x202f=['reduce','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','raw','where','attributes','include','map','model','then','info','stringify','catch','message','error','find','ShowInterval','debug','all','ifTime'];(function(_0x22fee8,_0x8ffddc){var _0x1ba12d=function(_0x1383a9){while(--_0x1383a9){_0x22fee8['push'](_0x22fee8['shift']());}};_0x1ba12d(++_0x8ffddc);}(_0x202f,0xe9));var _0xf202=function(_0xb72c8c,_0x391661){_0xb72c8c=_0xb72c8c-0x0;var _0x26fd07=_0x202f[_0xb72c8c];return _0x26fd07;};'use strict';var _=require(_0xf202('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0xf202('0x1'))[_0xf202('0x2')];var logger=require(_0xf202('0x3'))('rpc');exports[_0xf202('0x4')]=function(_0x51aef1){var _0x369ae7=this;return new Promise(function(_0x2bb30b,_0x5788d6){return db[_0xf202('0x5')][_0xf202('0x6')]({'raw':_0x51aef1[_0xf202('0x7')]?_0x51aef1[_0xf202('0x7')][_0xf202('0x8')]===undefined?!![]:![]:!![],'where':_0x51aef1[_0xf202('0x7')]?_0x51aef1[_0xf202('0x7')][_0xf202('0x9')]||null:null,'attributes':_0x51aef1[_0xf202('0x7')]?_0x51aef1[_0xf202('0x7')][_0xf202('0xa')]||null:null,'limit':_0x51aef1[_0xf202('0x7')]?_0x51aef1[_0xf202('0x7')]['limit']||null:null,'include':_0x51aef1['options']?_0x51aef1[_0xf202('0x7')][_0xf202('0xb')]?_[_0xf202('0xc')](_0x51aef1[_0xf202('0x7')][_0xf202('0xb')],function(_0x3021e5){return{'model':db[_0x3021e5[_0xf202('0xd')]],'as':_0x3021e5['as'],'attributes':_0x3021e5['attributes'],'include':_0x3021e5['include']?_[_0xf202('0xc')](_0x3021e5[_0xf202('0xb')],function(_0x1bf038){return{'model':db[_0x1bf038[_0xf202('0xd')]],'as':_0x1bf038['as'],'attributes':_0x1bf038['attributes'],'include':_0x1bf038[_0xf202('0xb')]?_['map'](_0x1bf038['include'],function(_0x35ed9a){return{'model':db[_0x35ed9a['model']],'as':_0x35ed9a['as'],'attributes':_0x35ed9a[_0xf202('0xa')]};}):[]};}):[]};}):[]:[]})[_0xf202('0xe')](function(_0x45025b){logger[_0xf202('0xf')](_0xf202('0x4'),_0x51aef1);logger['debug'](_0xf202('0x4'),_0x51aef1,JSON[_0xf202('0x10')](_0x45025b));_0x2bb30b(_0x45025b);})[_0xf202('0x11')](function(_0x329056){logger['error'](_0xf202('0x4'),_0x329056[_0xf202('0x12')],_0x51aef1);_0x5788d6(_0x369ae7[_0xf202('0x13')](0x1f4,_0x329056[_0xf202('0x12')]));});});};exports['ShowInterval']=function(_0x3427ee){var _0x51136e=this;return new Promise(function(_0x4e27ec,_0x3a01f8){return db[_0xf202('0x5')][_0xf202('0x14')]({'raw':_0x3427ee[_0xf202('0x7')]?_0x3427ee[_0xf202('0x7')][_0xf202('0x8')]===undefined?!![]:![]:!![],'where':_0x3427ee[_0xf202('0x7')]?_0x3427ee[_0xf202('0x7')][_0xf202('0x9')]||null:null,'attributes':_0x3427ee[_0xf202('0x7')]?_0x3427ee[_0xf202('0x7')][_0xf202('0xa')]||null:null,'include':_0x3427ee['options']?_0x3427ee['options'][_0xf202('0xb')]?_[_0xf202('0xc')](_0x3427ee[_0xf202('0x7')]['include'],function(_0xa62d8a){return{'model':db[_0xa62d8a[_0xf202('0xd')]],'as':_0xa62d8a['as'],'attributes':_0xa62d8a[_0xf202('0xa')],'include':_0xa62d8a['include']?_['map'](_0xa62d8a['include'],function(_0x1e5c4a){return{'model':db[_0x1e5c4a['model']],'as':_0x1e5c4a['as'],'attributes':_0x1e5c4a[_0xf202('0xa')],'include':_0x1e5c4a['include']?_['map'](_0x1e5c4a[_0xf202('0xb')],function(_0x5a3a37){return{'model':db[_0x5a3a37[_0xf202('0xd')]],'as':_0x5a3a37['as'],'attributes':_0x5a3a37[_0xf202('0xa')]};}):[]};}):[]};}):[]:[]})[_0xf202('0xe')](function(_0x2004ad){logger[_0xf202('0xf')](_0xf202('0x15'),_0x3427ee);logger[_0xf202('0x16')]('ShowInterval',_0x3427ee,JSON[_0xf202('0x10')](_0x2004ad));_0x4e27ec(_0x2004ad);})[_0xf202('0x11')](function(_0x13cc5a){logger[_0xf202('0x13')](_0xf202('0x15'),_0x13cc5a[_0xf202('0x12')],_0x3427ee);_0x3a01f8(_0x51136e['error'](0x1f4,_0x13cc5a[_0xf202('0x12')]));});});};function checkArrayOfIntervals(_0x3dde49,_0xc4c88b){var _0x243f76=[];return db[_0xf202('0x5')][_0xf202('0x6')]({'where':{'id':_0x3dde49}})[_0xf202('0xe')](function(_0x54e568){_0x243f76=_0x54e568;return Promise[_0xf202('0x17')](_0x243f76['map'](function(_0x5af510){return _0x5af510[_0xf202('0x18')](_0xc4c88b);}));})[_0xf202('0xe')](function(_0x7c67c1){var _0x5155c7=_0x7c67c1[_0xf202('0x19')](function(_0x4bf93b,_0x5db2e3){return _0x4bf93b||_0x5db2e3;},![]);logger[_0xf202('0xf')](util[_0xf202('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x243f76['map'](function(_0xdbc508){return _0xdbc508[_0xf202('0x1b')];})[_0xf202('0x1c')](',\x20'),_0x243f76[_0xf202('0xc')](function(_0x2acdcc){return _0x2acdcc['id'];})[_0xf202('0x1c')](',\x20')));return _0x5155c7;});}function checkSingleInterval(_0x50bc6e,_0x45b739){return db['Interval'][_0xf202('0x1d')](_0x50bc6e)[_0xf202('0xe')](function(_0xb2cacf){if(_0xb2cacf){logger['info'](util[_0xf202('0x1a')](_0xf202('0x1e'),_0xb2cacf[_0xf202('0x1b')],_0xb2cacf['id']));return _0xb2cacf[_0xf202('0x18')](_0x45b739);}});}exports['IntervalIftime']=function(_0xdc88c7){var _0x14fe09=_0xdc88c7[_0xf202('0x1f')];var _0x1d2f64=Array[_0xf202('0x20')](_0xdc88c7[_0xf202('0x21')])?_0xdc88c7[_0xf202('0x21')]:typeof _0xdc88c7[_0xf202('0x21')]===_0xf202('0x22')?[_0xdc88c7[_0xf202('0x21')]]:[];var _0x4939f7=_0xdc88c7[_0xf202('0x23')]||undefined;var _0x17d87f=![];if(_0x1d2f64[_0xf202('0x24')]){logger[_0xf202('0xf')](util[_0xf202('0x1a')](_0xf202('0x25'),_0x1d2f64['join'](';\x20')));}if(_0x4939f7){logger['info'](util[_0xf202('0x1a')](_0xf202('0x26'),_0x4939f7));}logger[_0xf202('0x16')](_0xf202('0x27'),_0x17d87f);logger[_0xf202('0x28')](_0xf202('0x29'),_0xdc88c7);return Promise[_0xf202('0x2a')]()['then'](function(){if(Array[_0xf202('0x20')](_0x14fe09)){return checkArrayOfIntervals(_0x14fe09,_0x4939f7);}else if(_0x14fe09){return checkSingleInterval(_0x14fe09,_0x4939f7);}})[_0xf202('0xe')](function(_0x318ca5){var _0x2137a9=_0x1d2f64[_0xf202('0x19')](function(_0x2680d4,_0x2e88e7){return _0x2680d4||iftime(_0x2e88e7,_0x4939f7);},![]);_0x17d87f=_0x318ca5||_0x2137a9;return _0x17d87f;})[_0xf202('0x11')](function(_0x9eb5e4){logger[_0xf202('0x13')](_0xf202('0x29'),_0xdc88c7,_0x9eb5e4);throw this[_0xf202('0x13')](0x1f4,_0x9eb5e4['message']);});}; \ No newline at end of file +var _0x183e=['message','ShowInterval','info','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','intervals','string','Iftime','resolve','isArray','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','attributes','include','map','model','then','debug','stringify','catch','error'];(function(_0xd70344,_0x304eac){var _0x338d4b=function(_0x4d42a8){while(--_0x4d42a8){_0xd70344['push'](_0xd70344['shift']());}};_0x338d4b(++_0x304eac);}(_0x183e,0xef));var _0xe183=function(_0x19564e,_0x1a6a6b){_0x19564e=_0x19564e-0x0;var _0x4a80ed=_0x183e[_0x19564e];return _0x4a80ed;};'use strict';var _=require(_0xe183('0x0'));var util=require(_0xe183('0x1'));var db=require(_0xe183('0x2'))['db'];var iftime=require('../../utils/iftime')[_0xe183('0x3')];var logger=require(_0xe183('0x4'))(_0xe183('0x5'));exports[_0xe183('0x6')]=function(_0x5de9e8){var _0xcbb32=this;return new Promise(function(_0x49ae24,_0x14ae63){return db[_0xe183('0x7')][_0xe183('0x8')]({'raw':_0x5de9e8[_0xe183('0x9')]?_0x5de9e8[_0xe183('0x9')][_0xe183('0xa')]===undefined?!![]:![]:!![],'where':_0x5de9e8[_0xe183('0x9')]?_0x5de9e8['options']['where']||null:null,'attributes':_0x5de9e8['options']?_0x5de9e8[_0xe183('0x9')][_0xe183('0xb')]||null:null,'limit':_0x5de9e8[_0xe183('0x9')]?_0x5de9e8[_0xe183('0x9')]['limit']||null:null,'include':_0x5de9e8[_0xe183('0x9')]?_0x5de9e8['options'][_0xe183('0xc')]?_[_0xe183('0xd')](_0x5de9e8[_0xe183('0x9')][_0xe183('0xc')],function(_0x2870f2){return{'model':db[_0x2870f2['model']],'as':_0x2870f2['as'],'attributes':_0x2870f2[_0xe183('0xb')],'include':_0x2870f2[_0xe183('0xc')]?_[_0xe183('0xd')](_0x2870f2[_0xe183('0xc')],function(_0x5d9b67){return{'model':db[_0x5d9b67[_0xe183('0xe')]],'as':_0x5d9b67['as'],'attributes':_0x5d9b67[_0xe183('0xb')],'include':_0x5d9b67[_0xe183('0xc')]?_[_0xe183('0xd')](_0x5d9b67['include'],function(_0x4e5ca3){return{'model':db[_0x4e5ca3[_0xe183('0xe')]],'as':_0x4e5ca3['as'],'attributes':_0x4e5ca3[_0xe183('0xb')]};}):[]};}):[]};}):[]:[]})[_0xe183('0xf')](function(_0x59013d){logger['info'](_0xe183('0x6'),_0x5de9e8);logger[_0xe183('0x10')](_0xe183('0x6'),_0x5de9e8,JSON[_0xe183('0x11')](_0x59013d));_0x49ae24(_0x59013d);})[_0xe183('0x12')](function(_0x43d341){logger[_0xe183('0x13')](_0xe183('0x6'),_0x43d341[_0xe183('0x14')],_0x5de9e8);_0x14ae63(_0xcbb32[_0xe183('0x13')](0x1f4,_0x43d341[_0xe183('0x14')]));});});};exports[_0xe183('0x15')]=function(_0x2d8dbb){var _0x4988d1=this;return new Promise(function(_0x15d8cf,_0x44e145){return db[_0xe183('0x7')]['find']({'raw':_0x2d8dbb[_0xe183('0x9')]?_0x2d8dbb[_0xe183('0x9')][_0xe183('0xa')]===undefined?!![]:![]:!![],'where':_0x2d8dbb[_0xe183('0x9')]?_0x2d8dbb[_0xe183('0x9')]['where']||null:null,'attributes':_0x2d8dbb[_0xe183('0x9')]?_0x2d8dbb[_0xe183('0x9')][_0xe183('0xb')]||null:null,'include':_0x2d8dbb[_0xe183('0x9')]?_0x2d8dbb[_0xe183('0x9')][_0xe183('0xc')]?_['map'](_0x2d8dbb['options'][_0xe183('0xc')],function(_0x5753a8){return{'model':db[_0x5753a8[_0xe183('0xe')]],'as':_0x5753a8['as'],'attributes':_0x5753a8[_0xe183('0xb')],'include':_0x5753a8[_0xe183('0xc')]?_[_0xe183('0xd')](_0x5753a8[_0xe183('0xc')],function(_0x25d886){return{'model':db[_0x25d886[_0xe183('0xe')]],'as':_0x25d886['as'],'attributes':_0x25d886['attributes'],'include':_0x25d886['include']?_[_0xe183('0xd')](_0x25d886[_0xe183('0xc')],function(_0x5069f8){return{'model':db[_0x5069f8['model']],'as':_0x5069f8['as'],'attributes':_0x5069f8[_0xe183('0xb')]};}):[]};}):[]};}):[]:[]})[_0xe183('0xf')](function(_0x3157c3){logger[_0xe183('0x16')](_0xe183('0x15'),_0x2d8dbb);logger[_0xe183('0x10')](_0xe183('0x15'),_0x2d8dbb,JSON[_0xe183('0x11')](_0x3157c3));_0x15d8cf(_0x3157c3);})[_0xe183('0x12')](function(_0x1b8345){logger['error'](_0xe183('0x15'),_0x1b8345[_0xe183('0x14')],_0x2d8dbb);_0x44e145(_0x4988d1[_0xe183('0x13')](0x1f4,_0x1b8345['message']));});});};function checkArrayOfIntervals(_0x45af5f,_0x21f4c3){var _0x266211=[];return db['Interval']['findAll']({'where':{'id':_0x45af5f}})[_0xe183('0xf')](function(_0x5c2d24){_0x266211=_0x5c2d24;return Promise['all'](_0x266211['map'](function(_0x28f638){return _0x28f638[_0xe183('0x17')](_0x21f4c3);}));})[_0xe183('0xf')](function(_0x5efa85){var _0x46d494=_0x5efa85[_0xe183('0x18')](function(_0x2011de,_0x5822cc){return _0x2011de||_0x5822cc;},![]);logger['info'](util[_0xe183('0x19')](_0xe183('0x1a'),_0x266211[_0xe183('0xd')](function(_0x48f82f){return _0x48f82f['name'];})[_0xe183('0x1b')](',\x20'),_0x266211[_0xe183('0xd')](function(_0x1b7031){return _0x1b7031['id'];})[_0xe183('0x1b')](',\x20')));return _0x46d494;});}function checkSingleInterval(_0x4668be,_0x12f05f){return db[_0xe183('0x7')][_0xe183('0x1c')](_0x4668be)['then'](function(_0x39e31e){if(_0x39e31e){logger['info'](util[_0xe183('0x19')](_0xe183('0x1d'),_0x39e31e[_0xe183('0x1e')],_0x39e31e['id']));return _0x39e31e[_0xe183('0x17')](_0x12f05f);}});}exports[_0xe183('0x1f')]=function(_0x603a82){var _0x3ec8cc=_0x603a82['intervalIds'];var _0x187df4=Array['isArray'](_0x603a82[_0xe183('0x20')])?_0x603a82[_0xe183('0x20')]:typeof _0x603a82['intervals']===_0xe183('0x21')?[_0x603a82[_0xe183('0x20')]]:[];var _0xcbf02e=_0x603a82['timezone']||undefined;var _0x78a676=![];if(_0x187df4['length']){logger['info'](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x187df4[_0xe183('0x1b')](';\x20')));}if(_0xcbf02e){logger['info'](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0xcbf02e));}logger[_0xe183('0x10')](_0xe183('0x22'),_0x78a676);logger['silly']('IntervalIftime',_0x603a82);return Promise[_0xe183('0x23')]()[_0xe183('0xf')](function(){if(Array[_0xe183('0x24')](_0x3ec8cc)){return checkArrayOfIntervals(_0x3ec8cc,_0xcbf02e);}else if(_0x3ec8cc){return checkSingleInterval(_0x3ec8cc,_0xcbf02e);}})[_0xe183('0xf')](function(_0x32c746){var _0x4ae4f1=_0x187df4[_0xe183('0x18')](function(_0x26e8f4,_0x472c32){return _0x26e8f4||iftime(_0x472c32,_0xcbf02e);},![]);_0x78a676=_0x32c746||_0x4ae4f1;return _0x78a676;})[_0xe183('0x12')](function(_0x550983){logger[_0xe183('0x13')](_0xe183('0x1f'),_0x603a82,_0x550983);throw this[_0xe183('0x13')](0x1f4,_0x550983['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d6c6cd3..19a24e2 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0b0e,0x187));var _0xe0b0=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x0b0e[_0xbf8ebe];return _0x1e25e8;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x2c3705,_0x3d68e6){var _0x53b0e2=function(_0x1ada42){while(--_0x1ada42){_0x2c3705['push'](_0x2c3705['shift']());}};_0x53b0e2(++_0x3d68e6);}(_0x2032,0xd9));var _0x2203=function(_0x4081a8,_0x1071c6){_0x4081a8=_0x4081a8-0x0;var _0x4d42c0=_0x2032[_0x4081a8];return _0x4d42c0;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 5d8212a..8d1b9f2 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 _0xb9b1=['status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','key','Report','\x20from\x20','description','issuetype','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','setEncoding','utf8','data','end'];(function(_0x257385,_0x5e8325){var _0x42e4d6=function(_0x26199d){while(--_0x26199d){_0x257385['push'](_0x257385['shift']());}};_0x42e4d6(++_0x5e8325);}(_0xb9b1,0x1e4));var _0x1b9b=function(_0x54f430,_0x1b41fe){_0x54f430=_0x54f430-0x0;var _0x3e0e80=_0xb9b1[_0x54f430];return _0x3e0e80;};'use strict';var BPromise=require(_0x1b9b('0x0'));var https=require(_0x1b9b('0x1'));var logger=require(_0x1b9b('0x2'))(_0x1b9b('0x3'));var USERNAME=_0x1b9b('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x31866e,_0x59f073){var _0x386b9d={'fields':{'project':{'key':_0x31866e[_0x1b9b('0x5')]||'MOTGUI'},'summary':(_0x31866e['summary']||_0x1b9b('0x6'))+_0x1b9b('0x7')+_0x31866e['ip'],'description':_0x31866e[_0x1b9b('0x8')]||JSON['stringify'](_0x31866e),'issuetype':{'name':_0x31866e[_0x1b9b('0x9')]||'Bug'}}};_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0xb')]=_0x31866e['email'];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0xc')]=_0x31866e[_0x1b9b('0xd')];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0xe')]=_0x31866e[_0x1b9b('0xf')];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0x10')]=_0x31866e[_0x1b9b('0x11')];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0x12')]=_0x31866e[_0x1b9b('0x13')];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0x14')]=_0x31866e['ip'];var _0x16ae95={'host':_0x1b9b('0x15'),'port':0x1bb,'path':_0x1b9b('0x16'),'method':_0x1b9b('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x1b9b('0x18'),'Authorization':_0x1b9b('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x1b9b('0x1a')](_0x1b9b('0x1b'))}};var _0x49711e=JSON[_0x1b9b('0x1c')](_0x386b9d);var _0x50843b=https['request'](_0x16ae95,function(_0x59b828){_0x59b828[_0x1b9b('0x1d')](_0x1b9b('0x1e'));var _0x3f9bcc='';_0x59b828['on'](_0x1b9b('0x1f'),function(_0x3d9b2f){_0x3f9bcc+=_0x3d9b2f;});_0x59b828['on'](_0x1b9b('0x20'),function(){if(_0x59f073){return _0x59f073[_0x1b9b('0x21')](_0x59b828[_0x1b9b('0x22')])[_0x1b9b('0x23')](JSON[_0x1b9b('0x24')](_0x3f9bcc));}});});_0x50843b['on']('error',function(_0x399e23){if(_0x59f073){return _0x59f073[_0x1b9b('0x21')](0x1f4)[_0x1b9b('0x23')]({'errors':[{'message':_0x1b9b('0x25'),'type':'api.jira'}]});}});_0x50843b[_0x1b9b('0x26')](_0x49711e);_0x50843b[_0x1b9b('0x20')]();}exports[_0x1b9b('0x27')]=openIssue;exports[_0x1b9b('0x28')]=function(_0xaab630,_0x5acd57){_0xaab630[_0x1b9b('0x29')]['ip']=_0xaab630[_0x1b9b('0x2a')][_0x1b9b('0x2b')]||_0xaab630[_0x1b9b('0x2c')]['remoteAddress']||_0xaab630['socket']['remoteAddress']||_0xaab630['connection'][_0x1b9b('0x2d')][_0x1b9b('0x2e')];return openIssue(_0xaab630[_0x1b9b('0x29')],_0x5acd57);}; \ No newline at end of file +var _0x459e=['data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','setEncoding'];(function(_0x595e6a,_0x470428){var _0x1ab357=function(_0x13be26){while(--_0x13be26){_0x595e6a['push'](_0x595e6a['shift']());}};_0x1ab357(++_0x470428);}(_0x459e,0x70));var _0xe459=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x459e[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0xe459('0x0'));var https=require(_0xe459('0x1'));var logger=require(_0xe459('0x2'))(_0xe459('0x3'));var USERNAME=_0xe459('0x4');var PASSWORD=_0xe459('0x5');function openIssue(_0x5a138a,_0x110f16){var _0x4e1d41={'fields':{'project':{'key':_0x5a138a[_0xe459('0x6')]||_0xe459('0x7')},'summary':(_0x5a138a[_0xe459('0x8')]||_0xe459('0x9'))+_0xe459('0xa')+_0x5a138a['ip'],'description':_0x5a138a[_0xe459('0xb')]||JSON[_0xe459('0xc')](_0x5a138a),'issuetype':{'name':_0x5a138a['issuetype']||_0xe459('0xd')}}};_0x4e1d41[_0xe459('0xe')][_0xe459('0xf')]=_0x5a138a[_0xe459('0x10')];_0x4e1d41[_0xe459('0xe')][_0xe459('0x11')]=_0x5a138a['oldToken'];_0x4e1d41[_0xe459('0xe')][_0xe459('0x12')]=_0x5a138a[_0xe459('0x13')];_0x4e1d41[_0xe459('0xe')][_0xe459('0x14')]=_0x5a138a[_0xe459('0x15')];_0x4e1d41['fields'][_0xe459('0x16')]=_0x5a138a[_0xe459('0x17')];_0x4e1d41[_0xe459('0xe')][_0xe459('0x18')]=_0x5a138a['ip'];var _0x592e85={'host':_0xe459('0x19'),'port':0x1bb,'path':_0xe459('0x1a'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xe459('0x1b'),'Authorization':_0xe459('0x1c')+new Buffer(USERNAME+':'+PASSWORD)[_0xe459('0x1d')](_0xe459('0x1e'))}};var _0x48a0e1=JSON[_0xe459('0xc')](_0x4e1d41);var _0x59785d=https['request'](_0x592e85,function(_0x375f59){_0x375f59[_0xe459('0x1f')]('utf8');var _0x51e6f7='';_0x375f59['on'](_0xe459('0x20'),function(_0x21ee23){_0x51e6f7+=_0x21ee23;});_0x375f59['on'](_0xe459('0x21'),function(){if(_0x110f16){return _0x110f16[_0xe459('0x22')](_0x375f59[_0xe459('0x23')])[_0xe459('0x24')](JSON[_0xe459('0x25')](_0x51e6f7));}});});_0x59785d['on'](_0xe459('0x26'),function(_0x4ca301){if(_0x110f16){return _0x110f16[_0xe459('0x22')](0x1f4)[_0xe459('0x24')]({'errors':[{'message':_0xe459('0x27'),'type':'api.jira'}]});}});_0x59785d[_0xe459('0x28')](_0x48a0e1);_0x59785d['end']();}exports[_0xe459('0x29')]=openIssue;exports['send']=function(_0x5d7689,_0xf1a494){_0x5d7689[_0xe459('0x2a')]['ip']=_0x5d7689[_0xe459('0x2b')][_0xe459('0x2c')]||_0x5d7689['connection'][_0xe459('0x2d')]||_0x5d7689['socket'][_0xe459('0x2d')]||_0x5d7689[_0xe459('0x2e')][_0xe459('0x2f')][_0xe459('0x2d')];return openIssue(_0x5d7689[_0xe459('0x2a')],_0xf1a494);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 228cc89..e0cd895 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(_0x946bb2,_0xbdde84){var _0x40d752=function(_0x895db2){while(--_0x895db2){_0x946bb2['push'](_0x946bb2['shift']());}};_0x40d752(++_0xbdde84);}(_0x878f,0x173));var _0xf878=function(_0x3dea25,_0x1aab61){_0x3dea25=_0x3dea25-0x0;var _0x1c9d5f=_0x878f[_0x3dea25];return _0x1c9d5f;};'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 _0xfd28=['show','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xfd28,0x148));var _0x8fd2=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xfd28[_0x1bf809];return _0x1caa4e;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xd')]('/:id',auth[_0x8fd2('0x8')](),controller['update']);router[_0x8fd2('0xe')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0xf')]);module[_0x8fd2('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 20d531a..01014d2 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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x205f41,_0x3d6e7b){_0x205f41=_0x205f41-0x0;var _0x231d50=_0x7a54[_0x205f41];return _0x231d50;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x37df3d,_0x9d15d0){_0x37df3d=_0x37df3d-0x0;var _0x560a10=_0x7a54[_0x37df3d];return _0x560a10;};'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 451350c..fe6a2de 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 _0x078c=['lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','JscriptyAnswerReport','count','include','rows','catch','intersection','includeAll','options','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x506396,_0x265b57){var _0x4c5443=function(_0x283f1d){while(--_0x283f1d){_0x506396['push'](_0x506396['shift']());}};_0x4c5443(++_0x265b57);}(_0x078c,0x19f));var _0xc078=function(_0x481af3,_0x483fac){_0x481af3=_0x481af3-0x0;var _0x3354ea=_0x078c[_0x481af3];return _0x3354ea;};'use strict';var emlformat=require(_0xc078('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc078('0x1'));var jsonpatch=require(_0xc078('0x2'));var rp=require('request-promise');var moment=require(_0xc078('0x3'));var BPromise=require(_0xc078('0x4'));var Mustache=require(_0xc078('0x5'));var util=require(_0xc078('0x6'));var path=require('path');var sox=require(_0xc078('0x7'));var csv=require(_0xc078('0x8'));var ejs=require(_0xc078('0x9'));var fs=require('fs');var fs_extra=require(_0xc078('0xa'));var _=require(_0xc078('0xb'));var squel=require(_0xc078('0xc'));var crypto=require(_0xc078('0xd'));var jsforce=require(_0xc078('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc078('0xf'));var Redis=require(_0xc078('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc078('0x11'));var as=require(_0xc078('0x12'));var hardwareService=require(_0xc078('0x13'));var logger=require(_0xc078('0x14'))(_0xc078('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc078('0x16'));var db=require(_0xc078('0x17'))['db'];function respondWithStatusCode(_0x3fa2be,_0x25e95d){_0x25e95d=_0x25e95d||0xcc;return function(_0x3e27c7){if(_0x3e27c7){return _0x3fa2be[_0xc078('0x18')](_0x25e95d);}return _0x3fa2be[_0xc078('0x19')](_0x25e95d)[_0xc078('0x1a')]();};}function respondWithResult(_0x11a3c3,_0x393225){_0x393225=_0x393225||0xc8;return function(_0x256d7b){if(_0x256d7b){return _0x11a3c3[_0xc078('0x19')](_0x393225)[_0xc078('0x1b')](_0x256d7b);}};}function respondWithFilteredResult(_0x36b6b1,_0x404ab0){return function(_0x5a1cbc){if(_0x5a1cbc){var _0x39e242=typeof _0x404ab0[_0xc078('0x1c')]===_0xc078('0x1d')&&typeof _0x404ab0['limit']===_0xc078('0x1d');var _0x5ab33a=_0x5a1cbc['count'];var _0xfd361b=_0x39e242?0x0:_0x404ab0['offset'];var _0x2ec2d5=_0x39e242?_0x5a1cbc['count']:_0x404ab0[_0xc078('0x1c')]+_0x404ab0[_0xc078('0x1e')];var _0x25fb75;if(_0x2ec2d5>=_0x5ab33a){_0x2ec2d5=_0x5ab33a;_0x25fb75=0xc8;}else{_0x25fb75=0xce;}_0x36b6b1['status'](_0x25fb75);return _0x36b6b1[_0xc078('0x1f')]('Content-Range',_0xfd361b+'-'+_0x2ec2d5+'/'+_0x5ab33a)[_0xc078('0x1b')](_0x5a1cbc);}return null;};}function patchUpdates(_0x2a9bbf){return function(_0x19b29b){try{jsonpatch[_0xc078('0x20')](_0x19b29b,_0x2a9bbf,!![]);}catch(_0x3f68ca){return BPromise['reject'](_0x3f68ca);}return _0x19b29b[_0xc078('0x21')]();};}function saveUpdates(_0x36efa2,_0x2e56fa){return function(_0x275cbc){if(_0x275cbc){return _0x275cbc['update'](_0x36efa2)[_0xc078('0x22')](function(_0xa4cd22){return _0xa4cd22;});}return null;};}function removeEntity(_0x3bde7a,_0x1cb7cb){return function(_0x41fac6){if(_0x41fac6){return _0x41fac6[_0xc078('0x23')]()[_0xc078('0x22')](function(){_0x3bde7a[_0xc078('0x19')](0xcc)[_0xc078('0x1a')]();});}};}function handleEntityNotFound(_0x3017a3,_0x14f677){return function(_0x531945){if(!_0x531945){_0x3017a3['sendStatus'](0x194);}return _0x531945;};}function handleError(_0x29525b,_0x5c7fc9){_0x5c7fc9=_0x5c7fc9||0x1f4;return function(_0x4a022a){logger['error'](_0x4a022a[_0xc078('0x24')]);if(_0x4a022a['name']){delete _0x4a022a[_0xc078('0x25')];}_0x29525b[_0xc078('0x19')](_0x5c7fc9)[_0xc078('0x26')](_0x4a022a);};}exports[_0xc078('0x27')]=function(_0xd43338,_0x2b257c){var _0x7c965e={},_0x3c481f={},_0x50e5d={'count':0x0,'rows':[]};var _0x43c377=_[_0xc078('0x28')](db['JscriptyAnswerReport'][_0xc078('0x29')],function(_0x560cbb){return{'name':_0x560cbb[_0xc078('0x2a')],'type':_0x560cbb[_0xc078('0x2b')][_0xc078('0x2c')]};});_0x3c481f[_0xc078('0x2d')]=_['map'](_0x43c377,_0xc078('0x25'));_0x3c481f['query']=_['keys'](_0xd43338[_0xc078('0x2e')]);_0x3c481f[_0xc078('0x2f')]=_['intersection'](_0x3c481f[_0xc078('0x2d')],_0x3c481f[_0xc078('0x2e')]);_0x7c965e[_0xc078('0x30')]=_['intersection'](_0x3c481f['model'],qs[_0xc078('0x31')](_0xd43338['query'][_0xc078('0x31')]));_0x7c965e[_0xc078('0x30')]=_0x7c965e['attributes'][_0xc078('0x32')]?_0x7c965e[_0xc078('0x30')]:_0x3c481f[_0xc078('0x2d')];if(!_0xd43338['query'][_0xc078('0x33')](_0xc078('0x34'))){_0x7c965e[_0xc078('0x1e')]=qs['limit'](_0xd43338['query'][_0xc078('0x1e')]);_0x7c965e[_0xc078('0x1c')]=qs['offset'](_0xd43338['query']['offset']);}_0x7c965e['order']=qs['sort'](_0xd43338[_0xc078('0x2e')][_0xc078('0x35')]);_0x7c965e[_0xc078('0x36')]=qs[_0xc078('0x2f')](_['pick'](_0xd43338[_0xc078('0x2e')],_0x3c481f['filters']),_0x43c377);if(_0xd43338['query'][_0xc078('0x37')]){_0x7c965e[_0xc078('0x36')]=_[_0xc078('0x38')](_0x7c965e[_0xc078('0x36')],{'$or':_[_0xc078('0x28')](_0x43c377,function(_0x2d5558){if(_0x2d5558[_0xc078('0x2b')]!==_0xc078('0x39')){var _0x534def={};_0x534def[_0x2d5558['name']]={'$like':'%'+_0xd43338['query']['filter']+'%'};return _0x534def;}})});}_0x7c965e=_[_0xc078('0x38')]({},_0x7c965e,_0xd43338['options']);var _0x122555={'where':_0x7c965e['where']};return db[_0xc078('0x3a')]['count'](_0x122555)['then'](function(_0x13e765){_0x50e5d[_0xc078('0x3b')]=_0x13e765;if(_0xd43338[_0xc078('0x2e')]['includeAll']){_0x7c965e[_0xc078('0x3c')]=[{'all':!![]}];}return db[_0xc078('0x3a')]['findAll'](_0x7c965e);})[_0xc078('0x22')](function(_0x3c2bc9){_0x50e5d[_0xc078('0x3d')]=_0x3c2bc9;return _0x50e5d;})[_0xc078('0x22')](respondWithFilteredResult(_0x2b257c,_0x7c965e))[_0xc078('0x3e')](handleError(_0x2b257c,null));};exports['show']=function(_0x3ffd96,_0x1d8e5b){var _0x3710b6={'raw':!![],'where':{'id':_0x3ffd96['params']['id']}},_0x548507={};_0x548507[_0xc078('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0xc078('0x29')]);_0x548507[_0xc078('0x2e')]=_['keys'](_0x3ffd96[_0xc078('0x2e')]);_0x548507['filters']=_[_0xc078('0x3f')](_0x548507['model'],_0x548507[_0xc078('0x2e')]);_0x3710b6[_0xc078('0x30')]=_[_0xc078('0x3f')](_0x548507[_0xc078('0x2d')],qs['fields'](_0x3ffd96[_0xc078('0x2e')][_0xc078('0x31')]));_0x3710b6[_0xc078('0x30')]=_0x3710b6[_0xc078('0x30')]['length']?_0x3710b6[_0xc078('0x30')]:_0x548507[_0xc078('0x2d')];if(_0x3ffd96[_0xc078('0x2e')][_0xc078('0x40')]){_0x3710b6[_0xc078('0x3c')]=[{'all':!![]}];}_0x3710b6=_['merge']({},_0x3710b6,_0x3ffd96[_0xc078('0x41')]);return db['JscriptyAnswerReport']['find'](_0x3710b6)['then'](handleEntityNotFound(_0x1d8e5b,null))[_0xc078('0x22')](respondWithResult(_0x1d8e5b,null))[_0xc078('0x3e')](handleError(_0x1d8e5b,null));};exports[_0xc078('0x42')]=function(_0x4c3041,_0x57abc6){return db[_0xc078('0x3a')][_0xc078('0x42')](_0x4c3041['body'],{})[_0xc078('0x22')](respondWithResult(_0x57abc6,0xc9))[_0xc078('0x3e')](handleError(_0x57abc6,null));};exports['update']=function(_0x2a846f,_0x57889b){if(_0x2a846f[_0xc078('0x43')]['id']){delete _0x2a846f[_0xc078('0x43')]['id'];}return db[_0xc078('0x3a')][_0xc078('0x44')]({'where':{'id':_0x2a846f[_0xc078('0x45')]['id']}})[_0xc078('0x22')](handleEntityNotFound(_0x57889b,null))['then'](saveUpdates(_0x2a846f[_0xc078('0x43')],null))[_0xc078('0x22')](respondWithResult(_0x57889b,null))[_0xc078('0x3e')](handleError(_0x57889b,null));};exports[_0xc078('0x23')]=function(_0x71ae97,_0x4c82c6){return db[_0xc078('0x3a')][_0xc078('0x44')]({'where':{'id':_0x71ae97['params']['id']}})[_0xc078('0x22')](handleEntityNotFound(_0x4c82c6,null))[_0xc078('0x22')](removeEntity(_0x4c82c6,null))[_0xc078('0x3e')](handleError(_0x4c82c6,null));};exports['describe']=function(_0x36456e,_0x5e3021){return db[_0xc078('0x3a')][_0xc078('0x46')]()[_0xc078('0x22')](respondWithResult(_0x5e3021,null))[_0xc078('0x3e')](handleError(_0x5e3021,null));}; \ No newline at end of file +var _0xf3be=['then','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','query','keys','intersection','attributes','fields','model','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','catch','rawAttributes','length','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x8eb274,_0x4fd852){var _0x4a53e8=function(_0x488885){while(--_0x488885){_0x8eb274['push'](_0x8eb274['shift']());}};_0x4a53e8(++_0x4fd852);}(_0xf3be,0x1e1));var _0xef3b=function(_0x4e0d4a,_0x499a26){_0x4e0d4a=_0x4e0d4a-0x0;var _0x130ec4=_0xf3be[_0x4e0d4a];return _0x130ec4;};'use strict';var emlformat=require(_0xef3b('0x0'));var rimraf=require(_0xef3b('0x1'));var zipdir=require(_0xef3b('0x2'));var jsonpatch=require(_0xef3b('0x3'));var rp=require('request-promise');var moment=require(_0xef3b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xef3b('0x5'));var csv=require(_0xef3b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef3b('0x7'));var _=require(_0xef3b('0x8'));var squel=require(_0xef3b('0x9'));var crypto=require(_0xef3b('0xa'));var jsforce=require(_0xef3b('0xb'));var deskjs=require(_0xef3b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef3b('0xd'));var Redis=require('ioredis');var authService=require(_0xef3b('0xe'));var qs=require(_0xef3b('0xf'));var as=require(_0xef3b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef3b('0x11'))('api');var utils=require(_0xef3b('0x12'));var config=require(_0xef3b('0x13'));var licenseUtil=require(_0xef3b('0x14'));var db=require(_0xef3b('0x15'))['db'];function respondWithStatusCode(_0x2a2a27,_0x3aef79){_0x3aef79=_0x3aef79||0xcc;return function(_0x169b2c){if(_0x169b2c){return _0x2a2a27[_0xef3b('0x16')](_0x3aef79);}return _0x2a2a27[_0xef3b('0x17')](_0x3aef79)[_0xef3b('0x18')]();};}function respondWithResult(_0x510cc3,_0x5a53b9){_0x5a53b9=_0x5a53b9||0xc8;return function(_0x138ea5){if(_0x138ea5){return _0x510cc3[_0xef3b('0x17')](_0x5a53b9)[_0xef3b('0x19')](_0x138ea5);}};}function respondWithFilteredResult(_0x118a31,_0x416801){return function(_0x529e89){if(_0x529e89){var _0x169803=typeof _0x416801[_0xef3b('0x1a')]===_0xef3b('0x1b')&&typeof _0x416801[_0xef3b('0x1c')]===_0xef3b('0x1b');var _0x5908cb=_0x529e89[_0xef3b('0x1d')];var _0x406eb7=_0x169803?0x0:_0x416801['offset'];var _0x280ccf=_0x169803?_0x529e89['count']:_0x416801[_0xef3b('0x1a')]+_0x416801['limit'];var _0x278de3;if(_0x280ccf>=_0x5908cb){_0x280ccf=_0x5908cb;_0x278de3=0xc8;}else{_0x278de3=0xce;}_0x118a31[_0xef3b('0x17')](_0x278de3);return _0x118a31[_0xef3b('0x1e')](_0xef3b('0x1f'),_0x406eb7+'-'+_0x280ccf+'/'+_0x5908cb)[_0xef3b('0x19')](_0x529e89);}return null;};}function patchUpdates(_0x3d18ef){return function(_0x19d4b5){try{jsonpatch[_0xef3b('0x20')](_0x19d4b5,_0x3d18ef,!![]);}catch(_0x4a3fbf){return BPromise[_0xef3b('0x21')](_0x4a3fbf);}return _0x19d4b5[_0xef3b('0x22')]();};}function saveUpdates(_0x214b53,_0xfe39a4){return function(_0x93a080){if(_0x93a080){return _0x93a080[_0xef3b('0x23')](_0x214b53)['then'](function(_0x27cc47){return _0x27cc47;});}return null;};}function removeEntity(_0x574042,_0x57b14a){return function(_0xc68cb2){if(_0xc68cb2){return _0xc68cb2[_0xef3b('0x24')]()[_0xef3b('0x25')](function(){_0x574042[_0xef3b('0x17')](0xcc)[_0xef3b('0x18')]();});}};}function handleEntityNotFound(_0x179338,_0x4ecb5e){return function(_0x487ae6){if(!_0x487ae6){_0x179338[_0xef3b('0x16')](0x194);}return _0x487ae6;};}function handleError(_0x4b6ee7,_0x4d5449){_0x4d5449=_0x4d5449||0x1f4;return function(_0x13dd47){logger[_0xef3b('0x26')](_0x13dd47[_0xef3b('0x27')]);if(_0x13dd47[_0xef3b('0x28')]){delete _0x13dd47[_0xef3b('0x28')];}_0x4b6ee7[_0xef3b('0x17')](_0x4d5449)[_0xef3b('0x29')](_0x13dd47);};}exports[_0xef3b('0x2a')]=function(_0x556c5c,_0xded00b){var _0x2b073b={},_0x634a45={},_0x187d1b={'count':0x0,'rows':[]};var _0x27ab13=_[_0xef3b('0x2b')](db[_0xef3b('0x2c')]['rawAttributes'],function(_0x4c9a84){return{'name':_0x4c9a84[_0xef3b('0x2d')],'type':_0x4c9a84[_0xef3b('0x2e')][_0xef3b('0x2f')]};});_0x634a45['model']=_[_0xef3b('0x2b')](_0x27ab13,_0xef3b('0x28'));_0x634a45[_0xef3b('0x30')]=_[_0xef3b('0x31')](_0x556c5c[_0xef3b('0x30')]);_0x634a45['filters']=_[_0xef3b('0x32')](_0x634a45['model'],_0x634a45[_0xef3b('0x30')]);_0x2b073b[_0xef3b('0x33')]=_[_0xef3b('0x32')](_0x634a45['model'],qs[_0xef3b('0x34')](_0x556c5c[_0xef3b('0x30')][_0xef3b('0x34')]));_0x2b073b['attributes']=_0x2b073b[_0xef3b('0x33')]['length']?_0x2b073b[_0xef3b('0x33')]:_0x634a45[_0xef3b('0x35')];if(!_0x556c5c['query']['hasOwnProperty'](_0xef3b('0x36'))){_0x2b073b[_0xef3b('0x1c')]=qs[_0xef3b('0x1c')](_0x556c5c['query'][_0xef3b('0x1c')]);_0x2b073b[_0xef3b('0x1a')]=qs[_0xef3b('0x1a')](_0x556c5c[_0xef3b('0x30')][_0xef3b('0x1a')]);}_0x2b073b[_0xef3b('0x37')]=qs['sort'](_0x556c5c['query'][_0xef3b('0x38')]);_0x2b073b[_0xef3b('0x39')]=qs[_0xef3b('0x3a')](_[_0xef3b('0x3b')](_0x556c5c[_0xef3b('0x30')],_0x634a45[_0xef3b('0x3a')]),_0x27ab13);if(_0x556c5c['query'][_0xef3b('0x3c')]){_0x2b073b[_0xef3b('0x39')]=_[_0xef3b('0x3d')](_0x2b073b['where'],{'$or':_[_0xef3b('0x2b')](_0x27ab13,function(_0x5ab5eb){if(_0x5ab5eb[_0xef3b('0x2e')]!=='VIRTUAL'){var _0x3a361f={};_0x3a361f[_0x5ab5eb['name']]={'$like':'%'+_0x556c5c[_0xef3b('0x30')]['filter']+'%'};return _0x3a361f;}})});}_0x2b073b=_[_0xef3b('0x3d')]({},_0x2b073b,_0x556c5c[_0xef3b('0x3e')]);var _0x1108e1={'where':_0x2b073b[_0xef3b('0x39')]};return db[_0xef3b('0x2c')][_0xef3b('0x1d')](_0x1108e1)[_0xef3b('0x25')](function(_0x219cfc){_0x187d1b['count']=_0x219cfc;if(_0x556c5c[_0xef3b('0x30')]['includeAll']){_0x2b073b[_0xef3b('0x3f')]=[{'all':!![]}];}return db[_0xef3b('0x2c')]['findAll'](_0x2b073b);})['then'](function(_0x51fb51){_0x187d1b[_0xef3b('0x40')]=_0x51fb51;return _0x187d1b;})['then'](respondWithFilteredResult(_0xded00b,_0x2b073b))[_0xef3b('0x41')](handleError(_0xded00b,null));};exports['show']=function(_0x4b2230,_0x516d08){var _0x5cec25={'raw':!![],'where':{'id':_0x4b2230['params']['id']}},_0x48699a={};_0x48699a['model']=_[_0xef3b('0x31')](db[_0xef3b('0x2c')][_0xef3b('0x42')]);_0x48699a['query']=_['keys'](_0x4b2230[_0xef3b('0x30')]);_0x48699a[_0xef3b('0x3a')]=_[_0xef3b('0x32')](_0x48699a[_0xef3b('0x35')],_0x48699a['query']);_0x5cec25[_0xef3b('0x33')]=_['intersection'](_0x48699a[_0xef3b('0x35')],qs[_0xef3b('0x34')](_0x4b2230[_0xef3b('0x30')][_0xef3b('0x34')]));_0x5cec25[_0xef3b('0x33')]=_0x5cec25['attributes'][_0xef3b('0x43')]?_0x5cec25[_0xef3b('0x33')]:_0x48699a[_0xef3b('0x35')];if(_0x4b2230[_0xef3b('0x30')][_0xef3b('0x44')]){_0x5cec25[_0xef3b('0x3f')]=[{'all':!![]}];}_0x5cec25=_[_0xef3b('0x3d')]({},_0x5cec25,_0x4b2230[_0xef3b('0x3e')]);return db[_0xef3b('0x2c')]['find'](_0x5cec25)[_0xef3b('0x25')](handleEntityNotFound(_0x516d08,null))[_0xef3b('0x25')](respondWithResult(_0x516d08,null))[_0xef3b('0x41')](handleError(_0x516d08,null));};exports['create']=function(_0x3f3e8b,_0x5d48c8){return db[_0xef3b('0x2c')][_0xef3b('0x45')](_0x3f3e8b[_0xef3b('0x46')],{})['then'](respondWithResult(_0x5d48c8,0xc9))['catch'](handleError(_0x5d48c8,null));};exports[_0xef3b('0x23')]=function(_0x38ee41,_0x4b368c){if(_0x38ee41[_0xef3b('0x46')]['id']){delete _0x38ee41[_0xef3b('0x46')]['id'];}return db[_0xef3b('0x2c')][_0xef3b('0x47')]({'where':{'id':_0x38ee41['params']['id']}})[_0xef3b('0x25')](handleEntityNotFound(_0x4b368c,null))[_0xef3b('0x25')](saveUpdates(_0x38ee41[_0xef3b('0x46')],null))[_0xef3b('0x25')](respondWithResult(_0x4b368c,null))[_0xef3b('0x41')](handleError(_0x4b368c,null));};exports[_0xef3b('0x24')]=function(_0x5e66fe,_0x2f45b1){return db[_0xef3b('0x2c')][_0xef3b('0x47')]({'where':{'id':_0x5e66fe[_0xef3b('0x48')]['id']}})[_0xef3b('0x25')](handleEntityNotFound(_0x2f45b1,null))[_0xef3b('0x25')](removeEntity(_0x2f45b1,null))[_0xef3b('0x41')](handleError(_0x2f45b1,null));};exports[_0xef3b('0x49')]=function(_0x3995b9,_0xf30f16){return db[_0xef3b('0x2c')][_0xef3b('0x49')]()[_0xef3b('0x25')](respondWithResult(_0xf30f16,null))['catch'](handleError(_0xf30f16,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index cbacc7e..8a14210 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 _0x4ab9=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x283502,_0x28f79a){var _0x12818f=function(_0x217e0f){while(--_0x217e0f){_0x283502['push'](_0x283502['shift']());}};_0x12818f(++_0x28f79a);}(_0x4ab9,0x12c));var _0x94ab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4ab9[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x94ab('0x0'));var util=require('util');var logger=require(_0x94ab('0x1'))('api');var moment=require('moment');var BPromise=require(_0x94ab('0x2'));var rp=require(_0x94ab('0x3'));var fs=require('fs');var path=require(_0x94ab('0x4'));var rimraf=require(_0x94ab('0x5'));var config=require(_0x94ab('0x6'));var attributes=require(_0x94ab('0x7'));module['exports']=function(_0x19df49,_0x36c042){return _0x19df49[_0x94ab('0x8')](_0x94ab('0x9'),attributes,{'tableName':_0x94ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4877=['path','rimraf','../../config/environment','exports','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x113939,_0x39e012){var _0x570e64=function(_0x117b68){while(--_0x117b68){_0x113939['push'](_0x113939['shift']());}};_0x570e64(++_0x39e012);}(_0x4877,0x1f2));var _0x7487=function(_0x318ed2,_0x240a50){_0x318ed2=_0x318ed2-0x0;var _0x385cfc=_0x4877[_0x318ed2];return _0x385cfc;};'use strict';var _=require('lodash');var util=require(_0x7487('0x0'));var logger=require(_0x7487('0x1'))(_0x7487('0x2'));var moment=require(_0x7487('0x3'));var BPromise=require(_0x7487('0x4'));var rp=require(_0x7487('0x5'));var fs=require('fs');var path=require(_0x7487('0x6'));var rimraf=require(_0x7487('0x7'));var config=require(_0x7487('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x7487('0x9')]=function(_0x4a467d,_0x49d14c){return _0x4a467d['define'](_0x7487('0xa'),attributes,{'tableName':_0x7487('0xb'),'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 8f7d43a..a80a80c 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 _0x0581=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring'];(function(_0x225255,_0x2b579d){var _0x387265=function(_0x21d797){while(--_0x21d797){_0x225255['push'](_0x225255['shift']());}};_0x387265(++_0x2b579d);}(_0x0581,0x14c));var _0x1058=function(_0x2bbd2d,_0x37c3c4){_0x2bbd2d=_0x2bbd2d-0x0;var _0x257dc9=_0x0581[_0x2bbd2d];return _0x257dc9;};'use strict';var _=require(_0x1058('0x0'));var util=require(_0x1058('0x1'));var moment=require('moment');var BPromise=require(_0x1058('0x2'));var rs=require(_0x1058('0x3'));var fs=require('fs');var Redis=require(_0x1058('0x4'));var db=require(_0x1058('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1058('0x6'))(_0x1058('0x7'));var config=require(_0x1058('0x8'));var jayson=require(_0x1058('0x9'));var client=jayson[_0x1058('0xa')][_0x1058('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437808,_0x513f86,_0x22b7ca){return new BPromise(function(_0x362de9,_0x364aa8){return client[_0x1058('0xc')](_0x437808,_0x22b7ca)['then'](function(_0x491757){logger[_0x1058('0xd')](_0x1058('0xe'),_0x513f86,_0x1058('0xf'));logger[_0x1058('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x513f86,'request\x20sent',JSON[_0x1058('0x11')](_0x491757));if(_0x491757[_0x1058('0x12')]){if(_0x491757[_0x1058('0x12')][_0x1058('0x13')]===0x1f4){logger[_0x1058('0x12')](_0x1058('0xe'),_0x513f86,_0x491757['error'][_0x1058('0x14')]);return _0x364aa8(_0x491757[_0x1058('0x12')]['message']);}logger['error'](_0x1058('0xe'),_0x513f86,_0x491757[_0x1058('0x12')][_0x1058('0x14')]);return _0x362de9(_0x491757[_0x1058('0x12')][_0x1058('0x14')]);}else{logger[_0x1058('0xd')](_0x1058('0xe'),_0x513f86,_0x1058('0xf'));_0x362de9(_0x491757['result'][_0x1058('0x14')]);}})['catch'](function(_0x19334c){logger['error'](_0x1058('0xe'),_0x513f86,_0x19334c);_0x364aa8(_0x19334c);});});} \ No newline at end of file +var _0xfbe1=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbe1,0xb1));var _0x1fbe=function(_0x10c1b3,_0x124328){_0x10c1b3=_0x10c1b3-0x0;var _0x27a62b=_0xfbe1[_0x10c1b3];return _0x27a62b;};'use strict';var _=require(_0x1fbe('0x0'));var util=require(_0x1fbe('0x1'));var moment=require('moment');var BPromise=require(_0x1fbe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fbe('0x3'));var db=require(_0x1fbe('0x4'))['db'];var utils=require(_0x1fbe('0x5'));var logger=require(_0x1fbe('0x6'))('rpc');var config=require(_0x1fbe('0x7'));var jayson=require(_0x1fbe('0x8'));var client=jayson[_0x1fbe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x436fc7,_0xf9614c,_0x111520){return new BPromise(function(_0x4dba86,_0x46cd9a){return client[_0x1fbe('0xa')](_0x436fc7,_0x111520)[_0x1fbe('0xb')](function(_0x471e41){logger['info'](_0x1fbe('0xc'),_0xf9614c,'request\x20sent');logger[_0x1fbe('0xd')](_0x1fbe('0xe'),_0xf9614c,_0x1fbe('0xf'),JSON[_0x1fbe('0x10')](_0x471e41));if(_0x471e41[_0x1fbe('0x11')]){if(_0x471e41[_0x1fbe('0x11')][_0x1fbe('0x12')]===0x1f4){logger[_0x1fbe('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf9614c,_0x471e41[_0x1fbe('0x11')][_0x1fbe('0x13')]);return _0x46cd9a(_0x471e41['error'][_0x1fbe('0x13')]);}logger[_0x1fbe('0x11')](_0x1fbe('0xc'),_0xf9614c,_0x471e41['error'][_0x1fbe('0x13')]);return _0x4dba86(_0x471e41['error'][_0x1fbe('0x13')]);}else{logger[_0x1fbe('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf9614c,_0x1fbe('0xf'));_0x4dba86(_0x471e41['result'][_0x1fbe('0x13')]);}})[_0x1fbe('0x15')](function(_0x2865b0){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0xf9614c,_0x2865b0);_0x46cd9a(_0x2865b0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5dcf5a7..3eb7710 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 _0x6f67=['index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','/:id/clone','clone','put','update','delete','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x6f67,0x16f));var _0x76f6=function(_0x5afedb,_0x121641){_0x5afedb=_0x5afedb-0x0;var _0x39cdc6=_0x6f67[_0x5afedb];return _0x39cdc6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x76f6('0x0'));var timeout=require(_0x76f6('0x1'));var express=require('express');var router=express[_0x76f6('0x2')]();var fs_extra=require(_0x76f6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f6('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0x76f6('0x5')]('/',auth[_0x76f6('0x6')](),controller[_0x76f6('0x7')]);router[_0x76f6('0x5')](_0x76f6('0x8'),auth[_0x76f6('0x6')](),controller[_0x76f6('0x9')]);router[_0x76f6('0x5')](_0x76f6('0xa'),auth[_0x76f6('0x6')](),controller[_0x76f6('0xb')]);router['get'](_0x76f6('0xc'),auth[_0x76f6('0x6')](),controller[_0x76f6('0xd')]);router['get'](_0x76f6('0xe'),auth[_0x76f6('0x6')](),timeout(_0x76f6('0xf')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller[_0x76f6('0x10')]);router['post'](_0x76f6('0x11'),auth[_0x76f6('0x6')](),controller[_0x76f6('0x12')]);router[_0x76f6('0x13')](_0x76f6('0x8'),auth[_0x76f6('0x6')](),controller[_0x76f6('0x14')]);router[_0x76f6('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf711=['put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone'];(function(_0x49ae70,_0x476fda){var _0x579731=function(_0x50f6ac){while(--_0x50f6ac){_0x49ae70['push'](_0x49ae70['shift']());}};_0x579731(++_0x476fda);}(_0xf711,0x1e3));var _0x1f71=function(_0x301801,_0x33788b){_0x301801=_0x301801-0x0;var _0x26cf6f=_0xf711[_0x301801];return _0x26cf6f;};'use strict';var multer=require('multer');var util=require(_0x1f71('0x0'));var path=require(_0x1f71('0x1'));var timeout=require(_0x1f71('0x2'));var express=require(_0x1f71('0x3'));var router=express[_0x1f71('0x4')]();var fs_extra=require(_0x1f71('0x5'));var auth=require(_0x1f71('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1f71('0x7'));router[_0x1f71('0x8')]('/',auth[_0x1f71('0x9')](),controller[_0x1f71('0xa')]);router[_0x1f71('0x8')](_0x1f71('0xb'),auth['isAuthenticated'](),controller[_0x1f71('0xc')]);router[_0x1f71('0x8')]('/:id/sessions',auth['isAuthenticated'](),controller['getSessions']);router['get'](_0x1f71('0xd'),auth[_0x1f71('0x9')](),controller[_0x1f71('0xe')]);router[_0x1f71('0x8')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x1f71('0xf')),controller[_0x1f71('0x10')]);router[_0x1f71('0x11')]('/',auth[_0x1f71('0x9')](),controller[_0x1f71('0x12')]);router['post'](_0x1f71('0x13'),auth[_0x1f71('0x9')](),controller[_0x1f71('0x14')]);router[_0x1f71('0x15')](_0x1f71('0xb'),auth[_0x1f71('0x9')](),controller[_0x1f71('0x16')]);router['delete'](_0x1f71('0xb'),auth['isAuthenticated'](),controller[_0x1f71('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f1ee97d..4e3152b 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 _0x507c=['BOOLEAN','lodash','util','exports','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x43242c,_0x1471d3){var _0x316b30=function(_0x20c20d){while(--_0x20c20d){_0x43242c['push'](_0x43242c['shift']());}};_0x316b30(++_0x1471d3);}(_0x507c,0x1a5));var _0xc507=function(_0x122b1d,_0x28ffdf){_0x122b1d=_0x122b1d-0x0;var _0x3d0ab2=_0x507c[_0x122b1d];return _0x3d0ab2;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc507('0x0'));var util=require(_0xc507('0x1'));module[_0xc507('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xc507('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xc507('0x4')](_0xc507('0x5')),'set':function(_0x147a69){if(_[_0xc507('0x6')](_0x147a69)){this[_0xc507('0x7')]('formData',JSON[_0xc507('0x8')](_0x147a69));}else if(_[_0xc507('0x9')](_0x147a69)){this[_0xc507('0x7')](_0xc507('0xa'),_0x147a69);}else{this[_0xc507('0x7')](_0xc507('0xa'),util[_0xc507('0xb')](_0xc507('0xc'),this[_0xc507('0xd')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc507('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc507('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x17d8=['long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','exports','STRING','name'];(function(_0x2a0755,_0xdf6bac){var _0x3eaf4f=function(_0x7a9a84){while(--_0x7a9a84){_0x2a0755['push'](_0x2a0755['shift']());}};_0x3eaf4f(++_0xdf6bac);}(_0x17d8,0xbe));var _0x817d=function(_0x580916,_0x3ee315){_0x580916=_0x580916-0x0;var _0x3b9f57=_0x17d8[_0x580916];return _0x3b9f57;};'use strict';var Sequelize=require(_0x817d('0x0'));var _=require(_0x817d('0x1'));var util=require('util');module[_0x817d('0x2')]={'name':{'type':Sequelize[_0x817d('0x3')],'unique':_0x817d('0x4')},'description':{'type':Sequelize[_0x817d('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x817d('0x5')),'set':function(_0x47e79f){if(_[_0x817d('0x6')](_0x47e79f)){this[_0x817d('0x7')](_0x817d('0x8'),JSON[_0x817d('0x9')](_0x47e79f));}else if(_[_0x817d('0xa')](_0x47e79f)){this[_0x817d('0x7')](_0x817d('0x8'),_0x47e79f);}else{this[_0x817d('0x7')](_0x817d('0x8'),util['format'](_0x817d('0xb'),this[_0x817d('0xc')](_0x817d('0x4'))||'',this[_0x817d('0xc')](_0x817d('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x817d('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x817d('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c60cb32..e8e0a1e 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 _0x936d=['indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','SessionId','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','Projects','UserProfileResource','destroy','error','stack','name','send','index','JscriptyProject','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','userProfileId','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','apply','toString'];(function(_0x546f2f,_0x371be9){var _0x3eb416=function(_0x161a2b){while(--_0x161a2b){_0x546f2f['push'](_0x546f2f['shift']());}};_0x3eb416(++_0x371be9);}(_0x936d,0x183));var _0xd936=function(_0x4f4716,_0x915f74){_0x4f4716=_0x4f4716-0x0;var _0x452a6f=_0x936d[_0x4f4716];return _0x452a6f;};'use strict';var emlformat=require(_0xd936('0x0'));var rimraf=require(_0xd936('0x1'));var zipdir=require(_0xd936('0x2'));var jsonpatch=require(_0xd936('0x3'));var rp=require('request-promise');var moment=require(_0xd936('0x4'));var BPromise=require(_0xd936('0x5'));var Mustache=require(_0xd936('0x6'));var util=require(_0xd936('0x7'));var path=require(_0xd936('0x8'));var sox=require(_0xd936('0x9'));var csv=require(_0xd936('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd936('0xb'));var _=require(_0xd936('0xc'));var squel=require(_0xd936('0xd'));var crypto=require(_0xd936('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd936('0xf'));var toCsv=require(_0xd936('0xa'));var querystring=require('querystring');var Papa=require(_0xd936('0x10'));var Redis=require(_0xd936('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd936('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd936('0x13'));var logger=require(_0xd936('0x14'))(_0xd936('0x15'));var utils=require(_0xd936('0x16'));var config=require(_0xd936('0x17'));var licenseUtil=require(_0xd936('0x18'));var db=require(_0xd936('0x19'))['db'];function respondWithStatusCode(_0x434d80,_0x309978){_0x309978=_0x309978||0xcc;return function(_0x884e08){if(_0x884e08){return _0x434d80[_0xd936('0x1a')](_0x309978);}return _0x434d80[_0xd936('0x1b')](_0x309978)['end']();};}function respondWithResult(_0x39153f,_0x1feab7){_0x1feab7=_0x1feab7||0xc8;return function(_0xae89f4){if(_0xae89f4){return _0x39153f['status'](_0x1feab7)['json'](_0xae89f4);}};}function respondWithFilteredResult(_0x520168,_0x39627b){return function(_0x38a890){if(_0x38a890){var _0x26d441=typeof _0x39627b[_0xd936('0x1c')]===_0xd936('0x1d')&&typeof _0x39627b[_0xd936('0x1e')]===_0xd936('0x1d');var _0x262eb8=_0x38a890[_0xd936('0x1f')];var _0x1d5805=_0x26d441?0x0:_0x39627b['offset'];var _0x35011a=_0x26d441?_0x38a890[_0xd936('0x1f')]:_0x39627b['offset']+_0x39627b[_0xd936('0x1e')];var _0x48d37b;if(_0x35011a>=_0x262eb8){_0x35011a=_0x262eb8;_0x48d37b=0xc8;}else{_0x48d37b=0xce;}_0x520168[_0xd936('0x1b')](_0x48d37b);return _0x520168['set'](_0xd936('0x20'),_0x1d5805+'-'+_0x35011a+'/'+_0x262eb8)[_0xd936('0x21')](_0x38a890);}return null;};}function patchUpdates(_0x10c05d){return function(_0x2568dd){try{jsonpatch['apply'](_0x2568dd,_0x10c05d,!![]);}catch(_0x160927){return BPromise[_0xd936('0x22')](_0x160927);}return _0x2568dd[_0xd936('0x23')]();};}function saveUpdates(_0x382585,_0x310e5a){return function(_0x4a7f3a){if(_0x4a7f3a){return _0x4a7f3a[_0xd936('0x24')](_0x382585)[_0xd936('0x25')](function(_0x44e631){return _0x44e631;});}return null;};}function removeEntity(_0x29f419,_0x22b726){return function(_0x17f4c9){if(_0x17f4c9){return _0x17f4c9['destroy']()[_0xd936('0x25')](function(){var _0x2a96c3=_0x17f4c9['get']({'plain':!![]});var _0x39d5c3=_0xd936('0x26');return db[_0xd936('0x27')][_0xd936('0x28')]({'where':{'type':_0x39d5c3,'resourceId':_0x2a96c3['id']}})['then'](function(){return _0x17f4c9;});})[_0xd936('0x25')](function(){_0x29f419['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2de3fa,_0x1df51c){return function(_0x33b3b7){if(!_0x33b3b7){_0x2de3fa[_0xd936('0x1a')](0x194);}return _0x33b3b7;};}function handleError(_0x441c0f,_0x3f0f9e){_0x3f0f9e=_0x3f0f9e||0x1f4;return function(_0x3c8d92){logger[_0xd936('0x29')](_0x3c8d92[_0xd936('0x2a')]);if(_0x3c8d92['name']){delete _0x3c8d92[_0xd936('0x2b')];}_0x441c0f[_0xd936('0x1b')](_0x3f0f9e)[_0xd936('0x2c')](_0x3c8d92);};}exports[_0xd936('0x2d')]=function(_0x4c416a,_0x41b003){var _0x99d672={},_0x4872ca={},_0x11ea10={'count':0x0,'rows':[]};var _0x4087a2=_['map'](db[_0xd936('0x2e')]['rawAttributes'],function(_0x301202){return{'name':_0x301202[_0xd936('0x2f')],'type':_0x301202[_0xd936('0x30')][_0xd936('0x31')]};});_0x4872ca['model']=_['map'](_0x4087a2,_0xd936('0x2b'));_0x4872ca[_0xd936('0x32')]=_[_0xd936('0x33')](_0x4c416a[_0xd936('0x32')]);_0x4872ca[_0xd936('0x34')]=_[_0xd936('0x35')](_0x4872ca[_0xd936('0x36')],_0x4872ca[_0xd936('0x32')]);_0x99d672[_0xd936('0x37')]=_[_0xd936('0x35')](_0x4872ca[_0xd936('0x36')],qs['fields'](_0x4c416a['query'][_0xd936('0x38')]));_0x99d672['attributes']=_0x99d672[_0xd936('0x37')]['length']?_0x99d672[_0xd936('0x37')]:_0x4872ca[_0xd936('0x36')];if(!_0x4c416a[_0xd936('0x32')][_0xd936('0x39')](_0xd936('0x3a'))){_0x99d672[_0xd936('0x1e')]=qs[_0xd936('0x1e')](_0x4c416a[_0xd936('0x32')][_0xd936('0x1e')]);_0x99d672['offset']=qs[_0xd936('0x1c')](_0x4c416a['query']['offset']);}_0x99d672[_0xd936('0x3b')]=qs['sort'](_0x4c416a['query'][_0xd936('0x3c')]);_0x99d672[_0xd936('0x3d')]=qs[_0xd936('0x34')](_[_0xd936('0x3e')](_0x4c416a[_0xd936('0x32')],_0x4872ca[_0xd936('0x34')]),_0x4087a2);if(_0x4c416a['query'][_0xd936('0x3f')]){_0x99d672[_0xd936('0x3d')]=_[_0xd936('0x40')](_0x99d672[_0xd936('0x3d')],{'$or':_[_0xd936('0x41')](_0x4087a2,function(_0x364f5f){if(_0x364f5f['type']!==_0xd936('0x42')){var _0x203d6e={};_0x203d6e[_0x364f5f[_0xd936('0x2b')]]={'$like':'%'+_0x4c416a[_0xd936('0x32')]['filter']+'%'};return _0x203d6e;}})});}_0x99d672=_[_0xd936('0x40')]({},_0x99d672,_0x4c416a[_0xd936('0x43')]);var _0x5b21bf={'where':_0x99d672[_0xd936('0x3d')]};return db[_0xd936('0x2e')][_0xd936('0x1f')](_0x5b21bf)[_0xd936('0x25')](function(_0x33ad69){_0x11ea10[_0xd936('0x1f')]=_0x33ad69;if(_0x4c416a[_0xd936('0x32')][_0xd936('0x44')]){_0x99d672['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xd936('0x45')](_0x99d672);})['then'](function(_0x16fd53){_0x11ea10[_0xd936('0x46')]=_0x16fd53;return _0x11ea10;})[_0xd936('0x25')](respondWithFilteredResult(_0x41b003,_0x99d672))[_0xd936('0x47')](handleError(_0x41b003,null));};exports[_0xd936('0x48')]=function(_0xb4d47b,_0x1d9c4c){var _0x24a141={'raw':![],'where':{'id':_0xb4d47b['params']['id']}},_0x391c33={};_0x391c33[_0xd936('0x36')]=_['keys'](db[_0xd936('0x2e')][_0xd936('0x49')]);_0x391c33[_0xd936('0x32')]=_[_0xd936('0x33')](_0xb4d47b[_0xd936('0x32')]);_0x391c33['filters']=_[_0xd936('0x35')](_0x391c33['model'],_0x391c33[_0xd936('0x32')]);_0x24a141['attributes']=_['intersection'](_0x391c33[_0xd936('0x36')],qs['fields'](_0xb4d47b[_0xd936('0x32')]['fields']));_0x24a141[_0xd936('0x37')]=_0x24a141['attributes'][_0xd936('0x4a')]?_0x24a141['attributes']:_0x391c33['model'];if(_0xb4d47b[_0xd936('0x32')][_0xd936('0x44')]){_0x24a141[_0xd936('0x4b')]=[{'all':!![]}];}_0x24a141=_[_0xd936('0x40')]({},_0x24a141,_0xb4d47b[_0xd936('0x43')]);return db[_0xd936('0x2e')][_0xd936('0x4c')](_0x24a141)[_0xd936('0x25')](handleEntityNotFound(_0x1d9c4c,null))[_0xd936('0x25')](respondWithResult(_0x1d9c4c,null))['catch'](handleError(_0x1d9c4c,null));};exports['create']=function(_0x1762f0,_0x1e7ace){return db[_0xd936('0x2e')][_0xd936('0x4d')](_0x1762f0[_0xd936('0x4e')],{})[_0xd936('0x25')](function(_0x4c9e5d){var _0x47f932=_0x1762f0['user'][_0xd936('0x4f')]({'plain':!![]});if(!_0x47f932)throw new Error(_0xd936('0x50'));if(_0x47f932[_0xd936('0x51')]===_0xd936('0x52')){var _0x4bdb1c=_0x4c9e5d[_0xd936('0x4f')]({'plain':!![]});var _0x42631e='Projects';return db[_0xd936('0x53')][_0xd936('0x4c')]({'where':{'name':_0x42631e,'userProfileId':_0x47f932['userProfileId']},'raw':!![]})[_0xd936('0x25')](function(_0x27887c){if(_0x27887c&&_0x27887c[_0xd936('0x54')]===0x0){return db[_0xd936('0x27')][_0xd936('0x4d')]({'name':_0x4bdb1c['name'],'resourceId':_0x4bdb1c['id'],'type':_0x27887c[_0xd936('0x2b')],'sectionId':_0x27887c['id']},{})[_0xd936('0x25')](function(){return _0x4c9e5d;});}else{return _0x4c9e5d;}})[_0xd936('0x47')](function(_0x427972){logger[_0xd936('0x29')](_0xd936('0x55'),_0x427972);throw _0x427972;});}return _0x4c9e5d;})['then'](respondWithResult(_0x1e7ace,0xc9))['catch'](handleError(_0x1e7ace,null));};exports['clone']=function(_0x1a3a80,_0x5140a2){var _0xa5c81f={'where':{'id':_0x1a3a80[_0xd936('0x56')]['id']}},_0x3860ab={};_0x3860ab[_0xd936('0x36')]=_[_0xd936('0x33')](db[_0xd936('0x2e')][_0xd936('0x49')]);_0xa5c81f[_0xd936('0x37')]=_['intersection'](_0x3860ab[_0xd936('0x36')],qs[_0xd936('0x38')](_0x1a3a80[_0xd936('0x32')][_0xd936('0x38')]));_0xa5c81f[_0xd936('0x37')]=_0xa5c81f['attributes'][_0xd936('0x4a')]?_0xa5c81f['attributes']:_0x3860ab[_0xd936('0x36')];if(_0x1a3a80[_0xd936('0x32')][_0xd936('0x44')]){_0xa5c81f['include']=[{'all':!![]}];}_0xa5c81f=_[_0xd936('0x40')]({},_0xa5c81f,_0x1a3a80['options']);return db[_0xd936('0x2e')][_0xd936('0x4c')](_0xa5c81f)[_0xd936('0x25')](handleEntityNotFound(_0x5140a2,null))['then'](function(_0x332342){if(_0x332342){var _0x55f0b7=_0x332342[_0xd936('0x4f')]({'plain':!![]});_0x55f0b7=qs[_0xd936('0x57')](_0x55f0b7,['id',_0xd936('0x58'),_0xd936('0x59')]);_0x1a3a80['body']=_[_0xd936('0x57')](_0x1a3a80[_0xd936('0x4e')],['id',_0xd936('0x58'),_0xd936('0x59')]);return db[_0xd936('0x2e')][_0xd936('0x4d')](_[_0xd936('0x40')](_0x55f0b7,_0x1a3a80[_0xd936('0x4e')]),{'include':_0x1a3a80['query'][_0xd936('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x5c2129){var _0x49bebb=_0x1a3a80[_0xd936('0x52')]['get']({'plain':!![]});if(!_0x49bebb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49bebb['role']==='user'){var _0x1838fb=_0x5c2129[_0xd936('0x4f')]({'plain':!![]});var _0x4b50a0=_0xd936('0x26');return db[_0xd936('0x53')]['find']({'where':{'name':_0x4b50a0,'userProfileId':_0x49bebb[_0xd936('0x5a')]},'raw':!![]})[_0xd936('0x25')](function(_0x41a12e){if(_0x41a12e&&_0x41a12e[_0xd936('0x54')]===0x0){return db[_0xd936('0x27')][_0xd936('0x4d')]({'name':_0x1838fb['name'],'resourceId':_0x1838fb['id'],'type':_0x41a12e['name'],'sectionId':_0x41a12e['id']},{})['then'](function(){return _0x5c2129;});}else{return _0x5c2129;}})[_0xd936('0x47')](function(_0x269260){logger[_0xd936('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x269260);throw _0x269260;});}return _0x5c2129;});}})[_0xd936('0x25')](respondWithResult(_0x5140a2,0xc9))[_0xd936('0x47')](handleError(_0x5140a2,null));};exports[_0xd936('0x24')]=function(_0x55030d,_0x4aeac0){if(_0x55030d[_0xd936('0x4e')]['id']){delete _0x55030d['body']['id'];}return db[_0xd936('0x2e')][_0xd936('0x4c')]({'where':{'id':_0x55030d[_0xd936('0x56')]['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x4aeac0,null))[_0xd936('0x25')](saveUpdates(_0x55030d['body'],null))[_0xd936('0x25')](respondWithResult(_0x4aeac0,null))[_0xd936('0x47')](handleError(_0x4aeac0,null));};exports[_0xd936('0x28')]=function(_0x302529,_0x1da5c8){return db[_0xd936('0x2e')][_0xd936('0x4c')]({'where':{'id':_0x302529['params']['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x1da5c8,null))[_0xd936('0x25')](removeEntity(_0x1da5c8,null))[_0xd936('0x47')](handleError(_0x1da5c8,null));};exports[_0xd936('0x5b')]=function(_0x237aac,_0x3b56b3,_0x549b6b){var _0x5ec004={'raw':!![],'where':{}};var _0x4f2baf={};var _0xdea2bd={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd936('0x5c')]({'where':{'id':_0x237aac[_0xd936('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b56b3,null))['then'](function(_0x6e7684){if(_0x6e7684){_0x4f2baf['model']=_[_0xd936('0x33')](db[_0xd936('0x5d')][_0xd936('0x49')]);_0x4f2baf['query']=_[_0xd936('0x33')](_0x237aac[_0xd936('0x32')]);_0x4f2baf[_0xd936('0x34')]=_['intersection'](_0x4f2baf['model'],_0x4f2baf[_0xd936('0x32')]);_0x5ec004[_0xd936('0x37')]=_[_0xd936('0x35')](_0x4f2baf['model'],qs[_0xd936('0x38')](_0x237aac[_0xd936('0x32')][_0xd936('0x38')]));_0x5ec004[_0xd936('0x37')]=_0x5ec004[_0xd936('0x37')]['length']?_0x5ec004['attributes']:_0x4f2baf[_0xd936('0x36')];if(!_0x237aac[_0xd936('0x32')][_0xd936('0x39')]('nolimit')){_0x5ec004[_0xd936('0x1e')]=qs['limit'](_0x237aac[_0xd936('0x32')]['limit']);_0x5ec004[_0xd936('0x1c')]=qs[_0xd936('0x1c')](_0x237aac[_0xd936('0x32')]['offset']);}_0x5ec004[_0xd936('0x3b')]=qs[_0xd936('0x3c')](_0x237aac[_0xd936('0x32')][_0xd936('0x3c')]);_0x5ec004['where']=qs[_0xd936('0x34')](_[_0xd936('0x3e')](_0x237aac['query'],_0x4f2baf[_0xd936('0x34')]));_0x5ec004[_0xd936('0x3d')]['ProjectId']=_0x6e7684['id'];if(_0x237aac[_0xd936('0x32')][_0xd936('0x3f')]){_0x5ec004[_0xd936('0x3d')]=_[_0xd936('0x40')](_0x5ec004[_0xd936('0x3d')],{'$or':_[_0xd936('0x41')](_0x5ec004[_0xd936('0x37')],function(_0x365ae1){var _0x10601f={};_0x10601f[_0x365ae1]={'$like':'%'+_0x237aac[_0xd936('0x32')][_0xd936('0x3f')]+'%'};return _0x10601f;})});}_0x5ec004=_[_0xd936('0x40')]({},_0x5ec004,_0x237aac[_0xd936('0x43')]);return db['JscriptySessionReport']['count']({'where':_0x5ec004[_0xd936('0x3d')]})[_0xd936('0x25')](function(_0x1e410d){_0xdea2bd[_0xd936('0x1f')]=_0x1e410d;if(_0x237aac[_0xd936('0x32')][_0xd936('0x44')]){_0x5ec004[_0xd936('0x4b')]=[{'all':!![]}];}return db[_0xd936('0x5d')]['findAll'](_0x5ec004);})['then'](function(_0x2cb900){_0xdea2bd['rows']=_0x2cb900;return _0xdea2bd;});}})['then'](respondWithFilteredResult(_0x3b56b3,_0x5ec004))[_0xd936('0x47')](handleError(_0x3b56b3,null));};exports[_0xd936('0x5e')]=function(_0xd8a27,_0x536000,_0xd77cad){var _0x478a5c={'raw':!![],'where':{}};var _0x534959={};var _0x45ca8f={'count':0x0,'rows':[]};return db[_0xd936('0x2e')]['findOne']({'where':{'id':_0xd8a27['params']['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x536000,null))['then'](function(_0x2881e1){if(_0x2881e1){_0x534959['model']=_[_0xd936('0x33')](db[_0xd936('0x5f')]['rawAttributes']);_0x534959[_0xd936('0x32')]=_[_0xd936('0x33')](_0xd8a27[_0xd936('0x32')]);_0x534959[_0xd936('0x34')]=_[_0xd936('0x35')](_0x534959['model'],_0x534959[_0xd936('0x32')]);_0x478a5c[_0xd936('0x37')]=_[_0xd936('0x35')](_0x534959[_0xd936('0x36')],qs[_0xd936('0x38')](_0xd8a27[_0xd936('0x32')][_0xd936('0x38')]));_0x478a5c[_0xd936('0x37')]=_0x478a5c[_0xd936('0x37')][_0xd936('0x4a')]?_0x478a5c[_0xd936('0x37')]:_0x534959['model'];if(!_0xd8a27[_0xd936('0x32')][_0xd936('0x39')](_0xd936('0x3a'))){_0x478a5c[_0xd936('0x1e')]=qs[_0xd936('0x1e')](_0xd8a27[_0xd936('0x32')][_0xd936('0x1e')]);_0x478a5c[_0xd936('0x1c')]=qs[_0xd936('0x1c')](_0xd8a27['query'][_0xd936('0x1c')]);}_0x478a5c['order']=qs['sort'](_0xd8a27['query'][_0xd936('0x3c')]);_0x478a5c['where']=qs[_0xd936('0x34')](_[_0xd936('0x3e')](_0xd8a27[_0xd936('0x32')],_0x534959[_0xd936('0x34')]));_0x478a5c[_0xd936('0x3d')][_0xd936('0x60')]=_0x2881e1['id'];if(_0xd8a27['query']['filter']){_0x478a5c[_0xd936('0x3d')]=_[_0xd936('0x40')](_0x478a5c[_0xd936('0x3d')],{'$or':_['map'](_0x478a5c[_0xd936('0x37')],function(_0x13b096){var _0x126e60={};_0x126e60[_0x13b096]={'$like':'%'+_0xd8a27[_0xd936('0x32')][_0xd936('0x3f')]+'%'};return _0x126e60;})});}_0x478a5c=_[_0xd936('0x40')]({},_0x478a5c,_0xd8a27[_0xd936('0x43')]);return db[_0xd936('0x5f')]['count']({'where':_0x478a5c['where']})[_0xd936('0x25')](function(_0x1cc3d7){_0x45ca8f[_0xd936('0x1f')]=_0x1cc3d7;if(_0xd8a27[_0xd936('0x32')][_0xd936('0x44')]){_0x478a5c[_0xd936('0x4b')]=[{'all':!![]}];}return db[_0xd936('0x5f')]['findAll'](_0x478a5c);})[_0xd936('0x25')](function(_0x3d1b78){_0x45ca8f[_0xd936('0x46')]=_0x3d1b78;return _0x45ca8f;});}})[_0xd936('0x25')](respondWithFilteredResult(_0x536000,_0x478a5c))[_0xd936('0x47')](handleError(_0x536000,null));};function char(_0x3b94a2){return _0xd936('0x61')===typeof _0x3b94a2?String[_0xd936('0x62')][_0xd936('0x63')](null,arguments):_0x3b94a2;}function needsEncapsulation(_0x3faafa){return!!_0x3faafa&&(_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0xd))>=0x0||_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0xa))>=0x0||_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0x2c))>=0x0||_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0x22))>=0x0);}function encapsulate(_0x685a12){var _0x30ea1b=char(0x22),_0x474a3e='\x5c'+char(0x22),_0x7dc026=_0x685a12[_0xd936('0x64')]()[_0xd936('0x66')](new RegExp(_0x30ea1b,'g'),_0x474a3e);return _0x30ea1b+_0x7dc026+_0x30ea1b;}exports[_0xd936('0x67')]=function(_0x3ce5f1,_0x18b5e1,_0x1e072a){var _0x552c76,_0x2188c1;var _0x1f2d29={'where':{'ProjectId':_0x3ce5f1[_0xd936('0x56')]['id']}};if(_0x3ce5f1[_0xd936('0x32')][_0xd936('0x68')]){_0x1f2d29[_0xd936('0x3d')]['starttime']=JSON[_0xd936('0x69')](_0x3ce5f1[_0xd936('0x32')]['startTime']);}return db[_0xd936('0x5d')][_0xd936('0x45')](_0x1f2d29)[_0xd936('0x25')](handleEntityNotFound(_0x18b5e1,null))[_0xd936('0x25')](function(_0x15a1f3){if(_0x15a1f3){_0x552c76=_0x15a1f3;return db['JscriptyQuestionReport'][_0xd936('0x45')]({'where':{'SessionId':{'$in':_[_0xd936('0x41')](_0x552c76,'id')},'ProjectId':_0x3ce5f1['params']['id']},'order':_0xd936('0x6a')});}})[_0xd936('0x25')](handleEntityNotFound(_0x18b5e1,null))[_0xd936('0x25')](function(_0x5046c5){if(_0x5046c5){_0x2188c1=_0x5046c5;var _0x38f3e7={};for(var _0x1699dc=0x0,_0x274cfa=_0x2188c1[_0xd936('0x4a')];_0x1699dc<_0x274cfa;_0x1699dc++){if(!_0x38f3e7[_0xd936('0x39')](_0x2188c1[_0x1699dc][_0xd936('0x6b')])){_0x38f3e7[_0x2188c1[_0x1699dc][_0xd936('0x6b')]]=needsEncapsulation(_0x2188c1[_0x1699dc][_0xd936('0x6c')])?encapsulate(_0x2188c1[_0x1699dc][_0xd936('0x6c')]):_0x2188c1[_0x1699dc]['question'];}}var _0x575cd4=[],_0x290492={};for(var _0x41c65e=0x0,_0x1d8f12=_0x552c76[_0xd936('0x4a')];_0x41c65e<_0x1d8f12;_0x41c65e++){_0x290492={'ProjectId':_0x3ce5f1[_0xd936('0x56')]['id'],'SessionId':_0x552c76[_0x41c65e]['id'],'StartTime':moment(_0x552c76[_0x41c65e][_0xd936('0x6d')])[_0xd936('0x6e')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x302f24=0x0,_0x25f353=_0x2188c1[_0xd936('0x4a')];_0x302f24<_0x25f353;_0x302f24++){if(_0x2188c1[_0x302f24][_0xd936('0x6f')]==_0x552c76[_0x41c65e]['id']&&_0x38f3e7['hasOwnProperty'](_0x2188c1[_0x302f24][_0xd936('0x6b')])){_0x290492[_0x38f3e7[_0x2188c1[_0x302f24]['questionId']]]=_0x2188c1[_0x302f24]['answer'];}}for(var _0x4a6786 in _0x38f3e7){if(!_0x290492['hasOwnProperty'](_0x38f3e7[_0x4a6786])){_0x290492[_0x38f3e7[_0x4a6786]]=null;}}_0x575cd4[_0xd936('0x70')](_0x290492);}return _0x575cd4;}})[_0xd936('0x25')](function(_0x2e0a91){if(!_[_0xd936('0x71')](_0x2e0a91)){var _0x5be4dc=toCsv(_0x2e0a91);var _0xca355=Date[_0xd936('0x72')]();fs['writeFileSync'](util[_0xd936('0x6e')](_0xd936('0x73'),_0x3ce5f1[_0xd936('0x56')]['id'],_0xca355),_0x5be4dc);_0x18b5e1['setHeader'](_0xd936('0x74'),_0xd936('0x75')+util[_0xd936('0x6e')]('Jscripty_Project_%d_Summary_%s.csv',_0x3ce5f1['params']['id'],_0xca355));_0x18b5e1[_0xd936('0x76')](_0xd936('0x77'),_0xd936('0x78'));return _0x18b5e1[_0xd936('0x79')](util[_0xd936('0x6e')](_0xd936('0x73'),_0x3ce5f1['params']['id'],_0xca355));}else{return _0x18b5e1['sendStatus'](0xcc);}})[_0xd936('0x47')](handleError(_0x18b5e1,null));}; \ No newline at end of file +var _0x73f5=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Projects','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','show','params','model','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','autoAssociation','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','order','findAll','number','toString','indexOf','replace','getSummary','starttime','parse','startTime','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','offset'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x73f5,0x1cb));var _0x573f=function(_0x413c45,_0x3000c7){_0x413c45=_0x413c45-0x0;var _0x5764d6=_0x73f5[_0x413c45];return _0x5764d6;};'use strict';var emlformat=require(_0x573f('0x0'));var rimraf=require(_0x573f('0x1'));var zipdir=require(_0x573f('0x2'));var jsonpatch=require(_0x573f('0x3'));var rp=require('request-promise');var moment=require(_0x573f('0x4'));var BPromise=require(_0x573f('0x5'));var Mustache=require(_0x573f('0x6'));var util=require(_0x573f('0x7'));var path=require(_0x573f('0x8'));var sox=require(_0x573f('0x9'));var csv=require(_0x573f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x573f('0xb'));var _=require('lodash');var squel=require(_0x573f('0xc'));var crypto=require('crypto');var jsforce=require(_0x573f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x573f('0xa'));var querystring=require(_0x573f('0xe'));var Papa=require(_0x573f('0xf'));var Redis=require('ioredis');var authService=require(_0x573f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x573f('0x11'));var hardwareService=require(_0x573f('0x12'));var logger=require(_0x573f('0x13'))(_0x573f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x573f('0x15'))['db'];function respondWithStatusCode(_0x2493f3,_0x11ea43){_0x11ea43=_0x11ea43||0xcc;return function(_0x322304){if(_0x322304){return _0x2493f3[_0x573f('0x16')](_0x11ea43);}return _0x2493f3['status'](_0x11ea43)['end']();};}function respondWithResult(_0x57290c,_0x2718bd){_0x2718bd=_0x2718bd||0xc8;return function(_0x149144){if(_0x149144){return _0x57290c[_0x573f('0x17')](_0x2718bd)['json'](_0x149144);}};}function respondWithFilteredResult(_0x3550bf,_0x544e9f){return function(_0x55d73f){if(_0x55d73f){var _0x51c32d=typeof _0x544e9f[_0x573f('0x18')]===_0x573f('0x19')&&typeof _0x544e9f[_0x573f('0x1a')]===_0x573f('0x19');var _0x3c1584=_0x55d73f['count'];var _0x4de5ef=_0x51c32d?0x0:_0x544e9f[_0x573f('0x18')];var _0x1202c8=_0x51c32d?_0x55d73f[_0x573f('0x1b')]:_0x544e9f['offset']+_0x544e9f[_0x573f('0x1a')];var _0x3d4253;if(_0x1202c8>=_0x3c1584){_0x1202c8=_0x3c1584;_0x3d4253=0xc8;}else{_0x3d4253=0xce;}_0x3550bf[_0x573f('0x17')](_0x3d4253);return _0x3550bf[_0x573f('0x1c')](_0x573f('0x1d'),_0x4de5ef+'-'+_0x1202c8+'/'+_0x3c1584)[_0x573f('0x1e')](_0x55d73f);}return null;};}function patchUpdates(_0x5c4308){return function(_0x77ba9f){try{jsonpatch[_0x573f('0x1f')](_0x77ba9f,_0x5c4308,!![]);}catch(_0x3eebba){return BPromise[_0x573f('0x20')](_0x3eebba);}return _0x77ba9f[_0x573f('0x21')]();};}function saveUpdates(_0x1fd5e4,_0x5f5f48){return function(_0x206e5d){if(_0x206e5d){return _0x206e5d[_0x573f('0x22')](_0x1fd5e4)[_0x573f('0x23')](function(_0x3da73b){return _0x3da73b;});}return null;};}function removeEntity(_0x31dfe8,_0x429f2b){return function(_0x10eda6){if(_0x10eda6){return _0x10eda6[_0x573f('0x24')]()[_0x573f('0x23')](function(){var _0x3acd35=_0x10eda6['get']({'plain':!![]});var _0x50139c=_0x573f('0x25');return db[_0x573f('0x26')]['destroy']({'where':{'type':_0x50139c,'resourceId':_0x3acd35['id']}})['then'](function(){return _0x10eda6;});})[_0x573f('0x23')](function(){_0x31dfe8[_0x573f('0x17')](0xcc)[_0x573f('0x27')]();});}};}function handleEntityNotFound(_0x54ae1a,_0x32c273){return function(_0x146975){if(!_0x146975){_0x54ae1a[_0x573f('0x16')](0x194);}return _0x146975;};}function handleError(_0x253e2c,_0x343296){_0x343296=_0x343296||0x1f4;return function(_0x54eef1){logger[_0x573f('0x28')](_0x54eef1[_0x573f('0x29')]);if(_0x54eef1[_0x573f('0x2a')]){delete _0x54eef1[_0x573f('0x2a')];}_0x253e2c['status'](_0x343296)['send'](_0x54eef1);};}exports[_0x573f('0x2b')]=function(_0x3eb44a,_0x1b2582){var _0x164a4e={},_0x30c1b4={},_0x17ba36={'count':0x0,'rows':[]};var _0x1a43a2=_[_0x573f('0x2c')](db['JscriptyProject'][_0x573f('0x2d')],function(_0x2169aa){return{'name':_0x2169aa[_0x573f('0x2e')],'type':_0x2169aa[_0x573f('0x2f')][_0x573f('0x30')]};});_0x30c1b4['model']=_[_0x573f('0x2c')](_0x1a43a2,_0x573f('0x2a'));_0x30c1b4[_0x573f('0x31')]=_['keys'](_0x3eb44a[_0x573f('0x31')]);_0x30c1b4[_0x573f('0x32')]=_[_0x573f('0x33')](_0x30c1b4['model'],_0x30c1b4[_0x573f('0x31')]);_0x164a4e[_0x573f('0x34')]=_[_0x573f('0x33')](_0x30c1b4['model'],qs['fields'](_0x3eb44a['query'][_0x573f('0x35')]));_0x164a4e['attributes']=_0x164a4e[_0x573f('0x34')]['length']?_0x164a4e[_0x573f('0x34')]:_0x30c1b4['model'];if(!_0x3eb44a[_0x573f('0x31')][_0x573f('0x36')](_0x573f('0x37'))){_0x164a4e[_0x573f('0x1a')]=qs[_0x573f('0x1a')](_0x3eb44a[_0x573f('0x31')][_0x573f('0x1a')]);_0x164a4e[_0x573f('0x18')]=qs[_0x573f('0x18')](_0x3eb44a[_0x573f('0x31')][_0x573f('0x18')]);}_0x164a4e['order']=qs[_0x573f('0x38')](_0x3eb44a[_0x573f('0x31')]['sort']);_0x164a4e[_0x573f('0x39')]=qs[_0x573f('0x32')](_[_0x573f('0x3a')](_0x3eb44a[_0x573f('0x31')],_0x30c1b4['filters']),_0x1a43a2);if(_0x3eb44a[_0x573f('0x31')][_0x573f('0x3b')]){_0x164a4e[_0x573f('0x39')]=_[_0x573f('0x3c')](_0x164a4e['where'],{'$or':_['map'](_0x1a43a2,function(_0x29e5a4){if(_0x29e5a4[_0x573f('0x2f')]!==_0x573f('0x3d')){var _0x52d508={};_0x52d508[_0x29e5a4[_0x573f('0x2a')]]={'$like':'%'+_0x3eb44a[_0x573f('0x31')][_0x573f('0x3b')]+'%'};return _0x52d508;}})});}_0x164a4e=_[_0x573f('0x3c')]({},_0x164a4e,_0x3eb44a[_0x573f('0x3e')]);var _0x2b3419={'where':_0x164a4e[_0x573f('0x39')]};return db[_0x573f('0x3f')][_0x573f('0x1b')](_0x2b3419)['then'](function(_0x427126){_0x17ba36['count']=_0x427126;if(_0x3eb44a[_0x573f('0x31')][_0x573f('0x40')]){_0x164a4e[_0x573f('0x41')]=[{'all':!![]}];}return db[_0x573f('0x3f')]['findAll'](_0x164a4e);})['then'](function(_0x2660dc){_0x17ba36[_0x573f('0x42')]=_0x2660dc;return _0x17ba36;})['then'](respondWithFilteredResult(_0x1b2582,_0x164a4e))[_0x573f('0x43')](handleError(_0x1b2582,null));};exports[_0x573f('0x44')]=function(_0xff317f,_0x7537c){var _0xc755c4={'raw':![],'where':{'id':_0xff317f[_0x573f('0x45')]['id']}},_0x38ee04={};_0x38ee04[_0x573f('0x46')]=_[_0x573f('0x47')](db[_0x573f('0x3f')][_0x573f('0x2d')]);_0x38ee04['query']=_[_0x573f('0x47')](_0xff317f['query']);_0x38ee04[_0x573f('0x32')]=_['intersection'](_0x38ee04[_0x573f('0x46')],_0x38ee04['query']);_0xc755c4[_0x573f('0x34')]=_[_0x573f('0x33')](_0x38ee04[_0x573f('0x46')],qs['fields'](_0xff317f[_0x573f('0x31')][_0x573f('0x35')]));_0xc755c4[_0x573f('0x34')]=_0xc755c4[_0x573f('0x34')][_0x573f('0x48')]?_0xc755c4[_0x573f('0x34')]:_0x38ee04[_0x573f('0x46')];if(_0xff317f[_0x573f('0x31')][_0x573f('0x40')]){_0xc755c4[_0x573f('0x41')]=[{'all':!![]}];}_0xc755c4=_['merge']({},_0xc755c4,_0xff317f[_0x573f('0x3e')]);return db[_0x573f('0x3f')]['find'](_0xc755c4)['then'](handleEntityNotFound(_0x7537c,null))['then'](respondWithResult(_0x7537c,null))['catch'](handleError(_0x7537c,null));};exports[_0x573f('0x49')]=function(_0x2ccde3,_0x354a83){return db[_0x573f('0x3f')][_0x573f('0x49')](_0x2ccde3['body'],{})['then'](function(_0x5ccbf9){var _0xbf5d44=_0x2ccde3[_0x573f('0x4a')]['get']({'plain':!![]});if(!_0xbf5d44)throw new Error(_0x573f('0x4b'));if(_0xbf5d44[_0x573f('0x4c')]==='user'){var _0x5d2d97=_0x5ccbf9[_0x573f('0x4d')]({'plain':!![]});var _0x4d2ceb=_0x573f('0x25');return db[_0x573f('0x4e')][_0x573f('0x4f')]({'where':{'name':_0x4d2ceb,'userProfileId':_0xbf5d44[_0x573f('0x50')]},'raw':!![]})['then'](function(_0x2851e2){if(_0x2851e2&&_0x2851e2['autoAssociation']===0x0){return db[_0x573f('0x26')]['create']({'name':_0x5d2d97[_0x573f('0x2a')],'resourceId':_0x5d2d97['id'],'type':_0x2851e2[_0x573f('0x2a')],'sectionId':_0x2851e2['id']},{})[_0x573f('0x23')](function(){return _0x5ccbf9;});}else{return _0x5ccbf9;}})['catch'](function(_0x3ffb02){logger[_0x573f('0x28')](_0x573f('0x51'),_0x3ffb02);throw _0x3ffb02;});}return _0x5ccbf9;})['then'](respondWithResult(_0x354a83,0xc9))['catch'](handleError(_0x354a83,null));};exports[_0x573f('0x52')]=function(_0x35cea3,_0x3a70b1){var _0x1e8162={'where':{'id':_0x35cea3[_0x573f('0x45')]['id']}},_0x1d7c2a={};_0x1d7c2a[_0x573f('0x46')]=_[_0x573f('0x47')](db[_0x573f('0x3f')]['rawAttributes']);_0x1e8162['attributes']=_['intersection'](_0x1d7c2a[_0x573f('0x46')],qs[_0x573f('0x35')](_0x35cea3['query'][_0x573f('0x35')]));_0x1e8162[_0x573f('0x34')]=_0x1e8162[_0x573f('0x34')]['length']?_0x1e8162['attributes']:_0x1d7c2a['model'];if(_0x35cea3[_0x573f('0x31')][_0x573f('0x40')]){_0x1e8162[_0x573f('0x41')]=[{'all':!![]}];}_0x1e8162=_['merge']({},_0x1e8162,_0x35cea3[_0x573f('0x3e')]);return db[_0x573f('0x3f')]['find'](_0x1e8162)[_0x573f('0x23')](handleEntityNotFound(_0x3a70b1,null))[_0x573f('0x23')](function(_0x3da2d6){if(_0x3da2d6){var _0x78b369=_0x3da2d6[_0x573f('0x4d')]({'plain':!![]});_0x78b369=qs[_0x573f('0x53')](_0x78b369,['id',_0x573f('0x54'),_0x573f('0x55')]);_0x35cea3['body']=_[_0x573f('0x53')](_0x35cea3[_0x573f('0x56')],['id',_0x573f('0x54'),_0x573f('0x55')]);return db['JscriptyProject'][_0x573f('0x49')](_[_0x573f('0x3c')](_0x78b369,_0x35cea3[_0x573f('0x56')]),{'include':_0x35cea3['query'][_0x573f('0x40')]?[{'all':!![]}]:undefined})[_0x573f('0x23')](function(_0x24bab6){var _0x298ca8=_0x35cea3[_0x573f('0x4a')]['get']({'plain':!![]});if(!_0x298ca8)throw new Error(_0x573f('0x4b'));if(_0x298ca8[_0x573f('0x4c')]===_0x573f('0x4a')){var _0x52b8f8=_0x24bab6[_0x573f('0x4d')]({'plain':!![]});var _0x17192b=_0x573f('0x25');return db[_0x573f('0x4e')][_0x573f('0x4f')]({'where':{'name':_0x17192b,'userProfileId':_0x298ca8[_0x573f('0x50')]},'raw':!![]})[_0x573f('0x23')](function(_0x17c120){if(_0x17c120&&_0x17c120[_0x573f('0x57')]===0x0){return db[_0x573f('0x26')][_0x573f('0x49')]({'name':_0x52b8f8[_0x573f('0x2a')],'resourceId':_0x52b8f8['id'],'type':_0x17c120['name'],'sectionId':_0x17c120['id']},{})[_0x573f('0x23')](function(){return _0x24bab6;});}else{return _0x24bab6;}})[_0x573f('0x43')](function(_0x481a78){logger[_0x573f('0x28')](_0x573f('0x51'),_0x481a78);throw _0x481a78;});}return _0x24bab6;});}})[_0x573f('0x23')](respondWithResult(_0x3a70b1,0xc9))['catch'](handleError(_0x3a70b1,null));};exports['update']=function(_0xa94d6a,_0x479e91){if(_0xa94d6a[_0x573f('0x56')]['id']){delete _0xa94d6a[_0x573f('0x56')]['id'];}return db[_0x573f('0x3f')][_0x573f('0x4f')]({'where':{'id':_0xa94d6a[_0x573f('0x45')]['id']}})[_0x573f('0x23')](handleEntityNotFound(_0x479e91,null))[_0x573f('0x23')](saveUpdates(_0xa94d6a[_0x573f('0x56')],null))[_0x573f('0x23')](respondWithResult(_0x479e91,null))[_0x573f('0x43')](handleError(_0x479e91,null));};exports[_0x573f('0x24')]=function(_0x56510d,_0x29f6cf){return db[_0x573f('0x3f')]['find']({'where':{'id':_0x56510d[_0x573f('0x45')]['id']}})['then'](handleEntityNotFound(_0x29f6cf,null))[_0x573f('0x23')](removeEntity(_0x29f6cf,null))[_0x573f('0x43')](handleError(_0x29f6cf,null));};exports['getSessions']=function(_0x1b79c3,_0x3d0895,_0x165c06){var _0x563c07={'raw':!![],'where':{}};var _0x490af5={};var _0x5e78c7={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x573f('0x58')]({'where':{'id':_0x1b79c3[_0x573f('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d0895,null))[_0x573f('0x23')](function(_0x3bb905){if(_0x3bb905){_0x490af5[_0x573f('0x46')]=_[_0x573f('0x47')](db[_0x573f('0x59')][_0x573f('0x2d')]);_0x490af5['query']=_['keys'](_0x1b79c3[_0x573f('0x31')]);_0x490af5['filters']=_[_0x573f('0x33')](_0x490af5[_0x573f('0x46')],_0x490af5[_0x573f('0x31')]);_0x563c07[_0x573f('0x34')]=_[_0x573f('0x33')](_0x490af5[_0x573f('0x46')],qs[_0x573f('0x35')](_0x1b79c3[_0x573f('0x31')]['fields']));_0x563c07[_0x573f('0x34')]=_0x563c07[_0x573f('0x34')][_0x573f('0x48')]?_0x563c07['attributes']:_0x490af5[_0x573f('0x46')];if(!_0x1b79c3[_0x573f('0x31')]['hasOwnProperty'](_0x573f('0x37'))){_0x563c07[_0x573f('0x1a')]=qs[_0x573f('0x1a')](_0x1b79c3[_0x573f('0x31')]['limit']);_0x563c07[_0x573f('0x18')]=qs[_0x573f('0x18')](_0x1b79c3[_0x573f('0x31')][_0x573f('0x18')]);}_0x563c07['order']=qs[_0x573f('0x38')](_0x1b79c3[_0x573f('0x31')][_0x573f('0x38')]);_0x563c07['where']=qs[_0x573f('0x32')](_['pick'](_0x1b79c3['query'],_0x490af5['filters']));_0x563c07[_0x573f('0x39')][_0x573f('0x5a')]=_0x3bb905['id'];if(_0x1b79c3[_0x573f('0x31')][_0x573f('0x3b')]){_0x563c07[_0x573f('0x39')]=_[_0x573f('0x3c')](_0x563c07[_0x573f('0x39')],{'$or':_[_0x573f('0x2c')](_0x563c07[_0x573f('0x34')],function(_0x36008){var _0x2f79ac={};_0x2f79ac[_0x36008]={'$like':'%'+_0x1b79c3[_0x573f('0x31')][_0x573f('0x3b')]+'%'};return _0x2f79ac;})});}_0x563c07=_['merge']({},_0x563c07,_0x1b79c3[_0x573f('0x3e')]);return db[_0x573f('0x59')]['count']({'where':_0x563c07['where']})[_0x573f('0x23')](function(_0x370837){_0x5e78c7[_0x573f('0x1b')]=_0x370837;if(_0x1b79c3[_0x573f('0x31')]['includeAll']){_0x563c07['include']=[{'all':!![]}];}return db[_0x573f('0x59')]['findAll'](_0x563c07);})[_0x573f('0x23')](function(_0x3918c6){_0x5e78c7[_0x573f('0x42')]=_0x3918c6;return _0x5e78c7;});}})[_0x573f('0x23')](respondWithFilteredResult(_0x3d0895,_0x563c07))['catch'](handleError(_0x3d0895,null));};exports[_0x573f('0x5b')]=function(_0x2dd5ea,_0x536f8c,_0x464d41){var _0x290511={'raw':!![],'where':{}};var _0x4121b5={};var _0x5af3da={'count':0x0,'rows':[]};return db[_0x573f('0x3f')][_0x573f('0x58')]({'where':{'id':_0x2dd5ea[_0x573f('0x45')]['id']}})[_0x573f('0x23')](handleEntityNotFound(_0x536f8c,null))[_0x573f('0x23')](function(_0x126d7d){if(_0x126d7d){_0x4121b5[_0x573f('0x46')]=_[_0x573f('0x47')](db[_0x573f('0x5c')][_0x573f('0x2d')]);_0x4121b5[_0x573f('0x31')]=_[_0x573f('0x47')](_0x2dd5ea[_0x573f('0x31')]);_0x4121b5[_0x573f('0x32')]=_[_0x573f('0x33')](_0x4121b5[_0x573f('0x46')],_0x4121b5['query']);_0x290511[_0x573f('0x34')]=_['intersection'](_0x4121b5[_0x573f('0x46')],qs[_0x573f('0x35')](_0x2dd5ea[_0x573f('0x31')]['fields']));_0x290511[_0x573f('0x34')]=_0x290511[_0x573f('0x34')][_0x573f('0x48')]?_0x290511[_0x573f('0x34')]:_0x4121b5[_0x573f('0x46')];if(!_0x2dd5ea['query']['hasOwnProperty']('nolimit')){_0x290511[_0x573f('0x1a')]=qs['limit'](_0x2dd5ea[_0x573f('0x31')][_0x573f('0x1a')]);_0x290511[_0x573f('0x18')]=qs['offset'](_0x2dd5ea[_0x573f('0x31')][_0x573f('0x18')]);}_0x290511[_0x573f('0x5d')]=qs[_0x573f('0x38')](_0x2dd5ea[_0x573f('0x31')][_0x573f('0x38')]);_0x290511[_0x573f('0x39')]=qs['filters'](_[_0x573f('0x3a')](_0x2dd5ea[_0x573f('0x31')],_0x4121b5[_0x573f('0x32')]));_0x290511['where'][_0x573f('0x5a')]=_0x126d7d['id'];if(_0x2dd5ea[_0x573f('0x31')][_0x573f('0x3b')]){_0x290511[_0x573f('0x39')]=_[_0x573f('0x3c')](_0x290511['where'],{'$or':_['map'](_0x290511[_0x573f('0x34')],function(_0x3724a0){var _0x37915e={};_0x37915e[_0x3724a0]={'$like':'%'+_0x2dd5ea[_0x573f('0x31')]['filter']+'%'};return _0x37915e;})});}_0x290511=_[_0x573f('0x3c')]({},_0x290511,_0x2dd5ea[_0x573f('0x3e')]);return db['JscriptyAnswerReport'][_0x573f('0x1b')]({'where':_0x290511['where']})[_0x573f('0x23')](function(_0x58010e){_0x5af3da['count']=_0x58010e;if(_0x2dd5ea[_0x573f('0x31')][_0x573f('0x40')]){_0x290511['include']=[{'all':!![]}];}return db[_0x573f('0x5c')][_0x573f('0x5e')](_0x290511);})[_0x573f('0x23')](function(_0x134a12){_0x5af3da[_0x573f('0x42')]=_0x134a12;return _0x5af3da;});}})[_0x573f('0x23')](respondWithFilteredResult(_0x536f8c,_0x290511))[_0x573f('0x43')](handleError(_0x536f8c,null));};function char(_0x2f14fa){return _0x573f('0x5f')===typeof _0x2f14fa?String['fromCharCode'][_0x573f('0x1f')](null,arguments):_0x2f14fa;}function needsEncapsulation(_0x3c4326){return!!_0x3c4326&&(_0x3c4326[_0x573f('0x60')]()[_0x573f('0x61')](char(0xd))>=0x0||_0x3c4326[_0x573f('0x60')]()[_0x573f('0x61')](char(0xa))>=0x0||_0x3c4326[_0x573f('0x60')]()[_0x573f('0x61')](char(0x2c))>=0x0||_0x3c4326[_0x573f('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4a53fa){var _0x23c51b=char(0x22),_0x3bfb8a='\x5c'+char(0x22),_0x450de8=_0x4a53fa[_0x573f('0x60')]()[_0x573f('0x62')](new RegExp(_0x23c51b,'g'),_0x3bfb8a);return _0x23c51b+_0x450de8+_0x23c51b;}exports[_0x573f('0x63')]=function(_0x11ae8f,_0x3678b4,_0x19186b){var _0x2afa6a,_0x2d5f6c;var _0x36fa54={'where':{'ProjectId':_0x11ae8f['params']['id']}};if(_0x11ae8f[_0x573f('0x31')]['startTime']){_0x36fa54['where'][_0x573f('0x64')]=JSON[_0x573f('0x65')](_0x11ae8f['query'][_0x573f('0x66')]);}return db[_0x573f('0x59')][_0x573f('0x5e')](_0x36fa54)[_0x573f('0x23')](handleEntityNotFound(_0x3678b4,null))['then'](function(_0x401167){if(_0x401167){_0x2afa6a=_0x401167;return db['JscriptyQuestionReport'][_0x573f('0x5e')]({'where':{'SessionId':{'$in':_[_0x573f('0x2c')](_0x2afa6a,'id')},'ProjectId':_0x11ae8f[_0x573f('0x45')]['id']},'order':_0x573f('0x67')});}})[_0x573f('0x23')](handleEntityNotFound(_0x3678b4,null))['then'](function(_0x37c282){if(_0x37c282){_0x2d5f6c=_0x37c282;var _0x2751fc={};for(var _0x40bc50=0x0,_0x4b6092=_0x2d5f6c[_0x573f('0x48')];_0x40bc50<_0x4b6092;_0x40bc50++){if(!_0x2751fc[_0x573f('0x36')](_0x2d5f6c[_0x40bc50][_0x573f('0x68')])){_0x2751fc[_0x2d5f6c[_0x40bc50][_0x573f('0x68')]]=needsEncapsulation(_0x2d5f6c[_0x40bc50][_0x573f('0x69')])?encapsulate(_0x2d5f6c[_0x40bc50][_0x573f('0x69')]):_0x2d5f6c[_0x40bc50][_0x573f('0x69')];}}var _0x163d96=[],_0x3c3cf2={};for(var _0x386864=0x0,_0x27cc4c=_0x2afa6a[_0x573f('0x48')];_0x386864<_0x27cc4c;_0x386864++){_0x3c3cf2={'ProjectId':_0x11ae8f[_0x573f('0x45')]['id'],'SessionId':_0x2afa6a[_0x386864]['id'],'StartTime':moment(_0x2afa6a[_0x386864][_0x573f('0x64')])['format'](_0x573f('0x6a'))};for(var _0x1c0e8a=0x0,_0x1cedd8=_0x2d5f6c[_0x573f('0x48')];_0x1c0e8a<_0x1cedd8;_0x1c0e8a++){if(_0x2d5f6c[_0x1c0e8a][_0x573f('0x6b')]==_0x2afa6a[_0x386864]['id']&&_0x2751fc[_0x573f('0x36')](_0x2d5f6c[_0x1c0e8a]['questionId'])){_0x3c3cf2[_0x2751fc[_0x2d5f6c[_0x1c0e8a][_0x573f('0x68')]]]=_0x2d5f6c[_0x1c0e8a][_0x573f('0x6c')];}}for(var _0x32b05c in _0x2751fc){if(!_0x3c3cf2['hasOwnProperty'](_0x2751fc[_0x32b05c])){_0x3c3cf2[_0x2751fc[_0x32b05c]]=null;}}_0x163d96['push'](_0x3c3cf2);}return _0x163d96;}})[_0x573f('0x23')](function(_0x4f0061){if(!_[_0x573f('0x6d')](_0x4f0061)){var _0x2ff370=toCsv(_0x4f0061);var _0x3d9eaf=Date[_0x573f('0x6e')]();fs[_0x573f('0x6f')](util[_0x573f('0x70')](_0x573f('0x71'),_0x11ae8f['params']['id'],_0x3d9eaf),_0x2ff370);_0x3678b4[_0x573f('0x72')](_0x573f('0x73'),_0x573f('0x74')+util[_0x573f('0x70')](_0x573f('0x75'),_0x11ae8f[_0x573f('0x45')]['id'],_0x3d9eaf));_0x3678b4[_0x573f('0x72')](_0x573f('0x76'),_0x573f('0x77'));return _0x3678b4[_0x573f('0x78')](util[_0x573f('0x70')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x11ae8f[_0x573f('0x45')]['id'],_0x3d9eaf));}else{return _0x3678b4[_0x573f('0x16')](0xcc);}})[_0x573f('0x43')](handleError(_0x3678b4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b191a59..41673e8 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 _0xe953=['JscriptyProject','jscripty_projects','bluebird','request-promise','rimraf','./jscriptyProject.attributes','define'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0xe953,0x1d0));var _0x3e95=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xe953[_0xf2628e];return _0x13863a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3e95('0x0'));var rp=require(_0x3e95('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e95('0x2'));var config=require('../../config/environment');var attributes=require(_0x3e95('0x3'));module['exports']=function(_0x30637c,_0x3faa2b){return _0x30637c[_0x3e95('0x4')](_0x3e95('0x5'),attributes,{'tableName':_0x3e95('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dee=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','JscriptyProject','jscripty_projects'];(function(_0x43bc3c,_0xad35c7){var _0x121b7a=function(_0x46e46c){while(--_0x46e46c){_0x43bc3c['push'](_0x43bc3c['shift']());}};_0x121b7a(++_0xad35c7);}(_0x7dee,0xb0));var _0xe7de=function(_0x4eed72,_0xeae1b6){_0x4eed72=_0x4eed72-0x0;var _0x3ab264=_0x7dee[_0x4eed72];return _0x3ab264;};'use strict';var _=require(_0xe7de('0x0'));var util=require('util');var logger=require(_0xe7de('0x1'))('api');var moment=require(_0xe7de('0x2'));var BPromise=require(_0xe7de('0x3'));var rp=require(_0xe7de('0x4'));var fs=require('fs');var path=require(_0xe7de('0x5'));var rimraf=require('rimraf');var config=require(_0xe7de('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xe7de('0x7')]=function(_0x19f79d,_0x26a524){return _0x19f79d[_0xe7de('0x8')](_0xe7de('0x9'),attributes,{'tableName':_0xe7de('0xa'),'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 d6922f6..d3b7e50 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 _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xc94e68,_0x55f2c2){var _0x2c3938=function(_0x2c897d){while(--_0x2c897d){_0xc94e68['push'](_0xc94e68['shift']());}};_0x2c3938(++_0x55f2c2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xb7e7[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x23e190,_0x4aa98d){var _0x2eef75=function(_0x38b5a7){while(--_0x38b5a7){_0x23e190['push'](_0x23e190['shift']());}};_0x2eef75(++_0x4aa98d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 131041c..d3923fc 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 _0x50f3=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','describe','get','/:id','create'];(function(_0x3a6468,_0x59ff97){var _0x185910=function(_0xfac5b2){while(--_0xfac5b2){_0x3a6468['push'](_0x3a6468['shift']());}};_0x185910(++_0x59ff97);}(_0x50f3,0x146));var _0x350f=function(_0x5cce81,_0x418807){_0x5cce81=_0x5cce81-0x0;var _0x4d622e=_0x50f3[_0x5cce81];return _0x4d622e;};'use strict';var multer=require(_0x350f('0x0'));var util=require(_0x350f('0x1'));var path=require(_0x350f('0x2'));var timeout=require(_0x350f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x350f('0x4'));var auth=require(_0x350f('0x5'));var interaction=require(_0x350f('0x6'));var config=require(_0x350f('0x7'));var controller=require(_0x350f('0x8'));router['get']('/',auth[_0x350f('0x9')](),controller[_0x350f('0xa')]);router['get'](_0x350f('0xb'),auth[_0x350f('0x9')](),controller[_0x350f('0xc')]);router[_0x350f('0xd')](_0x350f('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x350f('0xf')]);router['put'](_0x350f('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x350f('0xe'),auth[_0x350f('0x9')](),controller[_0x350f('0x10')]);module[_0x350f('0x11')]=router; \ No newline at end of file +var _0xcdb1=['/describe','/:id','post','create','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated'];(function(_0x4db617,_0x207890){var _0x5ebb32=function(_0x55e800){while(--_0x55e800){_0x4db617['push'](_0x4db617['shift']());}};_0x5ebb32(++_0x207890);}(_0xcdb1,0x112));var _0x1cdb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcdb1[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x1cdb('0x0'));var util=require(_0x1cdb('0x1'));var path=require(_0x1cdb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1cdb('0x3')]();var fs_extra=require(_0x1cdb('0x4'));var auth=require(_0x1cdb('0x5'));var interaction=require(_0x1cdb('0x6'));var config=require(_0x1cdb('0x7'));var controller=require(_0x1cdb('0x8'));router[_0x1cdb('0x9')]('/',auth[_0x1cdb('0xa')](),controller['index']);router[_0x1cdb('0x9')](_0x1cdb('0xb'),auth[_0x1cdb('0xa')](),controller['describe']);router['get'](_0x1cdb('0xc'),auth[_0x1cdb('0xa')](),controller['show']);router[_0x1cdb('0xd')]('/',auth[_0x1cdb('0xa')](),controller[_0x1cdb('0xe')]);router[_0x1cdb('0xf')](_0x1cdb('0xc'),auth[_0x1cdb('0xa')](),controller[_0x1cdb('0x10')]);router[_0x1cdb('0x11')](_0x1cdb('0xc'),auth[_0x1cdb('0xa')](),controller[_0x1cdb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4908f24..8d21876 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0xb99f3d,_0x3584ea){_0xb99f3d=_0xb99f3d-0x0;var _0x315b6c=_0x7a54[_0xb99f3d];return _0x315b6c;};'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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x4361d1,_0x133f93){_0x4361d1=_0x4361d1-0x0;var _0x33ce4f=_0x7a54[_0x4361d1];return _0x33ce4f;};'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 671f24b..d020554 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 _0x9c14=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','set','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','offset','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x20cf95,_0x221ec8){var _0x64e1a1=function(_0x2193bd){while(--_0x2193bd){_0x20cf95['push'](_0x20cf95['shift']());}};_0x64e1a1(++_0x221ec8);}(_0x9c14,0xd9));var _0x49c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c14[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x49c1('0x0'));var rimraf=require(_0x49c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49c1('0x2'));var rp=require(_0x49c1('0x3'));var moment=require(_0x49c1('0x4'));var BPromise=require(_0x49c1('0x5'));var Mustache=require('mustache');var util=require(_0x49c1('0x6'));var path=require(_0x49c1('0x7'));var sox=require(_0x49c1('0x8'));var csv=require(_0x49c1('0x9'));var ejs=require(_0x49c1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49c1('0xb'));var squel=require(_0x49c1('0xc'));var crypto=require(_0x49c1('0xd'));var jsforce=require(_0x49c1('0xe'));var deskjs=require(_0x49c1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x49c1('0x10'));var Papa=require('papaparse');var Redis=require(_0x49c1('0x11'));var authService=require(_0x49c1('0x12'));var qs=require(_0x49c1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c1('0x14'))(_0x49c1('0x15'));var utils=require('../../config/utils');var config=require(_0x49c1('0x16'));var licenseUtil=require(_0x49c1('0x17'));var db=require(_0x49c1('0x18'))['db'];function respondWithStatusCode(_0x15bec5,_0x294151){_0x294151=_0x294151||0xcc;return function(_0x391b90){if(_0x391b90){return _0x15bec5[_0x49c1('0x19')](_0x294151);}return _0x15bec5['status'](_0x294151)[_0x49c1('0x1a')]();};}function respondWithResult(_0x32d0c9,_0x513a74){_0x513a74=_0x513a74||0xc8;return function(_0x550e25){if(_0x550e25){return _0x32d0c9['status'](_0x513a74)[_0x49c1('0x1b')](_0x550e25);}};}function respondWithFilteredResult(_0x51c3a7,_0x581951){return function(_0x5ce5ac){if(_0x5ce5ac){var _0x5ab712=typeof _0x581951['offset']===_0x49c1('0x1c')&&typeof _0x581951[_0x49c1('0x1d')]===_0x49c1('0x1c');var _0x3a7a85=_0x5ce5ac[_0x49c1('0x1e')];var _0x527280=_0x5ab712?0x0:_0x581951['offset'];var _0x5a5afc=_0x5ab712?_0x5ce5ac[_0x49c1('0x1e')]:_0x581951['offset']+_0x581951['limit'];var _0x5b65e6;if(_0x5a5afc>=_0x3a7a85){_0x5a5afc=_0x3a7a85;_0x5b65e6=0xc8;}else{_0x5b65e6=0xce;}_0x51c3a7['status'](_0x5b65e6);return _0x51c3a7[_0x49c1('0x1f')]('Content-Range',_0x527280+'-'+_0x5a5afc+'/'+_0x3a7a85)[_0x49c1('0x1b')](_0x5ce5ac);}return null;};}function patchUpdates(_0x5d381f){return function(_0x59d39a){try{jsonpatch[_0x49c1('0x20')](_0x59d39a,_0x5d381f,!![]);}catch(_0x5eddea){return BPromise[_0x49c1('0x21')](_0x5eddea);}return _0x59d39a[_0x49c1('0x22')]();};}function saveUpdates(_0x1db39c,_0x39cf24){return function(_0x315566){if(_0x315566){return _0x315566[_0x49c1('0x23')](_0x1db39c)[_0x49c1('0x24')](function(_0x5da32b){return _0x5da32b;});}return null;};}function removeEntity(_0x409afe,_0x251c3c){return function(_0x37aae7){if(_0x37aae7){return _0x37aae7[_0x49c1('0x25')]()['then'](function(){_0x409afe[_0x49c1('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x241ed3,_0x3af94e){return function(_0x1cae3a){if(!_0x1cae3a){_0x241ed3[_0x49c1('0x19')](0x194);}return _0x1cae3a;};}function handleError(_0x1f053f,_0x3c4d93){_0x3c4d93=_0x3c4d93||0x1f4;return function(_0x4b5e5d){logger[_0x49c1('0x27')](_0x4b5e5d[_0x49c1('0x28')]);if(_0x4b5e5d[_0x49c1('0x29')]){delete _0x4b5e5d[_0x49c1('0x29')];}_0x1f053f[_0x49c1('0x26')](_0x3c4d93)[_0x49c1('0x2a')](_0x4b5e5d);};}exports[_0x49c1('0x2b')]=function(_0x20465b,_0x5c34da){var _0xbc62f3={},_0x1db2d3={},_0x371dc1={'count':0x0,'rows':[]};var _0x5ee8fd=_[_0x49c1('0x2c')](db[_0x49c1('0x2d')][_0x49c1('0x2e')],function(_0x248cfc){return{'name':_0x248cfc[_0x49c1('0x2f')],'type':_0x248cfc[_0x49c1('0x30')][_0x49c1('0x31')]};});_0x1db2d3['model']=_['map'](_0x5ee8fd,_0x49c1('0x29'));_0x1db2d3[_0x49c1('0x32')]=_['keys'](_0x20465b[_0x49c1('0x32')]);_0x1db2d3[_0x49c1('0x33')]=_[_0x49c1('0x34')](_0x1db2d3['model'],_0x1db2d3[_0x49c1('0x32')]);_0xbc62f3[_0x49c1('0x35')]=_[_0x49c1('0x34')](_0x1db2d3[_0x49c1('0x36')],qs['fields'](_0x20465b[_0x49c1('0x32')][_0x49c1('0x37')]));_0xbc62f3[_0x49c1('0x35')]=_0xbc62f3['attributes'][_0x49c1('0x38')]?_0xbc62f3['attributes']:_0x1db2d3[_0x49c1('0x36')];if(!_0x20465b[_0x49c1('0x32')]['hasOwnProperty'](_0x49c1('0x39'))){_0xbc62f3[_0x49c1('0x1d')]=qs[_0x49c1('0x1d')](_0x20465b[_0x49c1('0x32')][_0x49c1('0x1d')]);_0xbc62f3[_0x49c1('0x3a')]=qs[_0x49c1('0x3a')](_0x20465b['query'][_0x49c1('0x3a')]);}_0xbc62f3['order']=qs[_0x49c1('0x3b')](_0x20465b[_0x49c1('0x32')][_0x49c1('0x3b')]);_0xbc62f3[_0x49c1('0x3c')]=qs[_0x49c1('0x33')](_['pick'](_0x20465b['query'],_0x1db2d3[_0x49c1('0x33')]),_0x5ee8fd);if(_0x20465b[_0x49c1('0x32')]['filter']){_0xbc62f3[_0x49c1('0x3c')]=_[_0x49c1('0x3d')](_0xbc62f3[_0x49c1('0x3c')],{'$or':_[_0x49c1('0x2c')](_0x5ee8fd,function(_0x8484fd){if(_0x8484fd[_0x49c1('0x30')]!==_0x49c1('0x3e')){var _0x5a9859={};_0x5a9859[_0x8484fd[_0x49c1('0x29')]]={'$like':'%'+_0x20465b['query']['filter']+'%'};return _0x5a9859;}})});}_0xbc62f3=_[_0x49c1('0x3d')]({},_0xbc62f3,_0x20465b[_0x49c1('0x3f')]);var _0x418e91={'where':_0xbc62f3[_0x49c1('0x3c')]};return db['JscriptyQuestionReport'][_0x49c1('0x1e')](_0x418e91)[_0x49c1('0x24')](function(_0x47bbd7){_0x371dc1['count']=_0x47bbd7;if(_0x20465b[_0x49c1('0x32')][_0x49c1('0x40')]){_0xbc62f3[_0x49c1('0x41')]=[{'all':!![]}];}return db[_0x49c1('0x2d')][_0x49c1('0x42')](_0xbc62f3);})[_0x49c1('0x24')](function(_0x5582c8){_0x371dc1[_0x49c1('0x43')]=_0x5582c8;return _0x371dc1;})[_0x49c1('0x24')](respondWithFilteredResult(_0x5c34da,_0xbc62f3))['catch'](handleError(_0x5c34da,null));};exports[_0x49c1('0x44')]=function(_0x53bfa4,_0x53dfa3){var _0x5fbf2={'raw':!![],'where':{'id':_0x53bfa4[_0x49c1('0x45')]['id']}},_0x358435={};_0x358435['model']=_[_0x49c1('0x46')](db['JscriptyQuestionReport'][_0x49c1('0x2e')]);_0x358435[_0x49c1('0x32')]=_['keys'](_0x53bfa4[_0x49c1('0x32')]);_0x358435[_0x49c1('0x33')]=_[_0x49c1('0x34')](_0x358435[_0x49c1('0x36')],_0x358435[_0x49c1('0x32')]);_0x5fbf2[_0x49c1('0x35')]=_[_0x49c1('0x34')](_0x358435[_0x49c1('0x36')],qs['fields'](_0x53bfa4['query'][_0x49c1('0x37')]));_0x5fbf2[_0x49c1('0x35')]=_0x5fbf2['attributes'][_0x49c1('0x38')]?_0x5fbf2[_0x49c1('0x35')]:_0x358435[_0x49c1('0x36')];if(_0x53bfa4[_0x49c1('0x32')][_0x49c1('0x40')]){_0x5fbf2[_0x49c1('0x41')]=[{'all':!![]}];}_0x5fbf2=_[_0x49c1('0x3d')]({},_0x5fbf2,_0x53bfa4[_0x49c1('0x3f')]);return db[_0x49c1('0x2d')]['find'](_0x5fbf2)[_0x49c1('0x24')](handleEntityNotFound(_0x53dfa3,null))[_0x49c1('0x24')](respondWithResult(_0x53dfa3,null))[_0x49c1('0x47')](handleError(_0x53dfa3,null));};exports['create']=function(_0x3240b8,_0x2bd5e0){return db['JscriptyQuestionReport'][_0x49c1('0x48')](_0x3240b8[_0x49c1('0x49')],{})['then'](respondWithResult(_0x2bd5e0,0xc9))['catch'](handleError(_0x2bd5e0,null));};exports[_0x49c1('0x23')]=function(_0x5c812e,_0x313ffb){if(_0x5c812e[_0x49c1('0x49')]['id']){delete _0x5c812e['body']['id'];}return db[_0x49c1('0x2d')][_0x49c1('0x4a')]({'where':{'id':_0x5c812e[_0x49c1('0x45')]['id']}})[_0x49c1('0x24')](handleEntityNotFound(_0x313ffb,null))[_0x49c1('0x24')](saveUpdates(_0x5c812e[_0x49c1('0x49')],null))['then'](respondWithResult(_0x313ffb,null))[_0x49c1('0x47')](handleError(_0x313ffb,null));};exports[_0x49c1('0x25')]=function(_0x5b6a17,_0x2a57fa){return db[_0x49c1('0x2d')][_0x49c1('0x4a')]({'where':{'id':_0x5b6a17[_0x49c1('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a57fa,null))[_0x49c1('0x24')](removeEntity(_0x2a57fa,null))['catch'](handleError(_0x2a57fa,null));};exports[_0x49c1('0x4b')]=function(_0x5ad924,_0x29177){return db['JscriptyQuestionReport'][_0x49c1('0x4b')]()[_0x49c1('0x24')](respondWithResult(_0x29177,null))[_0x49c1('0x47')](handleError(_0x29177,null));}; \ No newline at end of file +var _0xb2a3=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','then','destroy','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb2a3,0xc1));var _0x3b2a=function(_0x35a61f,_0x500a06){_0x35a61f=_0x35a61f-0x0;var _0x2096cc=_0xb2a3[_0x35a61f];return _0x2096cc;};'use strict';var emlformat=require(_0x3b2a('0x0'));var rimraf=require(_0x3b2a('0x1'));var zipdir=require(_0x3b2a('0x2'));var jsonpatch=require(_0x3b2a('0x3'));var rp=require(_0x3b2a('0x4'));var moment=require(_0x3b2a('0x5'));var BPromise=require(_0x3b2a('0x6'));var Mustache=require(_0x3b2a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3b2a('0x8'));var csv=require('to-csv');var ejs=require(_0x3b2a('0x9'));var fs=require('fs');var fs_extra=require(_0x3b2a('0xa'));var _=require('lodash');var squel=require(_0x3b2a('0xb'));var crypto=require(_0x3b2a('0xc'));var jsforce=require(_0x3b2a('0xd'));var deskjs=require(_0x3b2a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3b2a('0xf'));var Papa=require(_0x3b2a('0x10'));var Redis=require(_0x3b2a('0x11'));var authService=require(_0x3b2a('0x12'));var qs=require(_0x3b2a('0x13'));var as=require(_0x3b2a('0x14'));var hardwareService=require(_0x3b2a('0x15'));var logger=require('../../config/logger')(_0x3b2a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3b2a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x412c15,_0x4abe24){_0x4abe24=_0x4abe24||0xcc;return function(_0x16c8bb){if(_0x16c8bb){return _0x412c15[_0x3b2a('0x18')](_0x4abe24);}return _0x412c15['status'](_0x4abe24)[_0x3b2a('0x19')]();};}function respondWithResult(_0x55ed5d,_0x38db6a){_0x38db6a=_0x38db6a||0xc8;return function(_0x59744a){if(_0x59744a){return _0x55ed5d[_0x3b2a('0x1a')](_0x38db6a)[_0x3b2a('0x1b')](_0x59744a);}};}function respondWithFilteredResult(_0x791b1a,_0x3a2a87){return function(_0xf648a2){if(_0xf648a2){var _0x17dff2=typeof _0x3a2a87[_0x3b2a('0x1c')]===_0x3b2a('0x1d')&&typeof _0x3a2a87[_0x3b2a('0x1e')]===_0x3b2a('0x1d');var _0x58b3b6=_0xf648a2[_0x3b2a('0x1f')];var _0xb0f06d=_0x17dff2?0x0:_0x3a2a87[_0x3b2a('0x1c')];var _0x5cf6e0=_0x17dff2?_0xf648a2[_0x3b2a('0x1f')]:_0x3a2a87[_0x3b2a('0x1c')]+_0x3a2a87[_0x3b2a('0x1e')];var _0x3a56a5;if(_0x5cf6e0>=_0x58b3b6){_0x5cf6e0=_0x58b3b6;_0x3a56a5=0xc8;}else{_0x3a56a5=0xce;}_0x791b1a[_0x3b2a('0x1a')](_0x3a56a5);return _0x791b1a['set']('Content-Range',_0xb0f06d+'-'+_0x5cf6e0+'/'+_0x58b3b6)['json'](_0xf648a2);}return null;};}function patchUpdates(_0x417c4e){return function(_0x325b81){try{jsonpatch['apply'](_0x325b81,_0x417c4e,!![]);}catch(_0x3680fb){return BPromise[_0x3b2a('0x20')](_0x3680fb);}return _0x325b81[_0x3b2a('0x21')]();};}function saveUpdates(_0x98816b,_0x3c74c8){return function(_0x1667f1){if(_0x1667f1){return _0x1667f1['update'](_0x98816b)[_0x3b2a('0x22')](function(_0x48e657){return _0x48e657;});}return null;};}function removeEntity(_0x376c20,_0x1a4fd){return function(_0x57e311){if(_0x57e311){return _0x57e311[_0x3b2a('0x23')]()[_0x3b2a('0x22')](function(){_0x376c20[_0x3b2a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4035d1,_0x2ff93c){return function(_0x460130){if(!_0x460130){_0x4035d1[_0x3b2a('0x18')](0x194);}return _0x460130;};}function handleError(_0x9f9a95,_0x118e1b){_0x118e1b=_0x118e1b||0x1f4;return function(_0x1ef5c4){logger['error'](_0x1ef5c4['stack']);if(_0x1ef5c4[_0x3b2a('0x24')]){delete _0x1ef5c4[_0x3b2a('0x24')];}_0x9f9a95[_0x3b2a('0x1a')](_0x118e1b)[_0x3b2a('0x25')](_0x1ef5c4);};}exports[_0x3b2a('0x26')]=function(_0x55f520,_0x2202f0){var _0x53172a={},_0x3046dc={},_0x2d955e={'count':0x0,'rows':[]};var _0x2e0623=_[_0x3b2a('0x27')](db[_0x3b2a('0x28')][_0x3b2a('0x29')],function(_0x34d7f0){return{'name':_0x34d7f0[_0x3b2a('0x2a')],'type':_0x34d7f0['type'][_0x3b2a('0x2b')]};});_0x3046dc[_0x3b2a('0x2c')]=_['map'](_0x2e0623,'name');_0x3046dc[_0x3b2a('0x2d')]=_[_0x3b2a('0x2e')](_0x55f520[_0x3b2a('0x2d')]);_0x3046dc[_0x3b2a('0x2f')]=_['intersection'](_0x3046dc[_0x3b2a('0x2c')],_0x3046dc[_0x3b2a('0x2d')]);_0x53172a[_0x3b2a('0x30')]=_['intersection'](_0x3046dc['model'],qs[_0x3b2a('0x31')](_0x55f520['query'][_0x3b2a('0x31')]));_0x53172a[_0x3b2a('0x30')]=_0x53172a['attributes'][_0x3b2a('0x32')]?_0x53172a[_0x3b2a('0x30')]:_0x3046dc[_0x3b2a('0x2c')];if(!_0x55f520[_0x3b2a('0x2d')]['hasOwnProperty']('nolimit')){_0x53172a[_0x3b2a('0x1e')]=qs[_0x3b2a('0x1e')](_0x55f520[_0x3b2a('0x2d')][_0x3b2a('0x1e')]);_0x53172a[_0x3b2a('0x1c')]=qs[_0x3b2a('0x1c')](_0x55f520['query'][_0x3b2a('0x1c')]);}_0x53172a[_0x3b2a('0x33')]=qs[_0x3b2a('0x34')](_0x55f520['query']['sort']);_0x53172a[_0x3b2a('0x35')]=qs['filters'](_[_0x3b2a('0x36')](_0x55f520['query'],_0x3046dc['filters']),_0x2e0623);if(_0x55f520[_0x3b2a('0x2d')][_0x3b2a('0x37')]){_0x53172a[_0x3b2a('0x35')]=_[_0x3b2a('0x38')](_0x53172a[_0x3b2a('0x35')],{'$or':_[_0x3b2a('0x27')](_0x2e0623,function(_0x44a9d2){if(_0x44a9d2[_0x3b2a('0x39')]!==_0x3b2a('0x3a')){var _0x4bda89={};_0x4bda89[_0x44a9d2[_0x3b2a('0x24')]]={'$like':'%'+_0x55f520['query'][_0x3b2a('0x37')]+'%'};return _0x4bda89;}})});}_0x53172a=_['merge']({},_0x53172a,_0x55f520['options']);var _0x28c356={'where':_0x53172a[_0x3b2a('0x35')]};return db[_0x3b2a('0x28')][_0x3b2a('0x1f')](_0x28c356)[_0x3b2a('0x22')](function(_0x42c5fd){_0x2d955e[_0x3b2a('0x1f')]=_0x42c5fd;if(_0x55f520[_0x3b2a('0x2d')][_0x3b2a('0x3b')]){_0x53172a[_0x3b2a('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3b2a('0x3d')](_0x53172a);})[_0x3b2a('0x22')](function(_0x171b2e){_0x2d955e[_0x3b2a('0x3e')]=_0x171b2e;return _0x2d955e;})[_0x3b2a('0x22')](respondWithFilteredResult(_0x2202f0,_0x53172a))[_0x3b2a('0x3f')](handleError(_0x2202f0,null));};exports['show']=function(_0xe3e44f,_0x28d4c3){var _0x4cd6cb={'raw':!![],'where':{'id':_0xe3e44f[_0x3b2a('0x40')]['id']}},_0x382111={};_0x382111[_0x3b2a('0x2c')]=_['keys'](db[_0x3b2a('0x28')][_0x3b2a('0x29')]);_0x382111[_0x3b2a('0x2d')]=_[_0x3b2a('0x2e')](_0xe3e44f[_0x3b2a('0x2d')]);_0x382111[_0x3b2a('0x2f')]=_[_0x3b2a('0x41')](_0x382111['model'],_0x382111[_0x3b2a('0x2d')]);_0x4cd6cb['attributes']=_[_0x3b2a('0x41')](_0x382111[_0x3b2a('0x2c')],qs['fields'](_0xe3e44f[_0x3b2a('0x2d')][_0x3b2a('0x31')]));_0x4cd6cb[_0x3b2a('0x30')]=_0x4cd6cb[_0x3b2a('0x30')]['length']?_0x4cd6cb[_0x3b2a('0x30')]:_0x382111[_0x3b2a('0x2c')];if(_0xe3e44f[_0x3b2a('0x2d')][_0x3b2a('0x3b')]){_0x4cd6cb[_0x3b2a('0x3c')]=[{'all':!![]}];}_0x4cd6cb=_['merge']({},_0x4cd6cb,_0xe3e44f[_0x3b2a('0x42')]);return db[_0x3b2a('0x28')][_0x3b2a('0x43')](_0x4cd6cb)[_0x3b2a('0x22')](handleEntityNotFound(_0x28d4c3,null))[_0x3b2a('0x22')](respondWithResult(_0x28d4c3,null))[_0x3b2a('0x3f')](handleError(_0x28d4c3,null));};exports[_0x3b2a('0x44')]=function(_0x2d47ca,_0xee7c9c){return db['JscriptyQuestionReport']['create'](_0x2d47ca['body'],{})['then'](respondWithResult(_0xee7c9c,0xc9))[_0x3b2a('0x3f')](handleError(_0xee7c9c,null));};exports['update']=function(_0x4f9d32,_0x183b79){if(_0x4f9d32[_0x3b2a('0x45')]['id']){delete _0x4f9d32[_0x3b2a('0x45')]['id'];}return db[_0x3b2a('0x28')][_0x3b2a('0x43')]({'where':{'id':_0x4f9d32['params']['id']}})[_0x3b2a('0x22')](handleEntityNotFound(_0x183b79,null))[_0x3b2a('0x22')](saveUpdates(_0x4f9d32[_0x3b2a('0x45')],null))[_0x3b2a('0x22')](respondWithResult(_0x183b79,null))[_0x3b2a('0x3f')](handleError(_0x183b79,null));};exports[_0x3b2a('0x23')]=function(_0x4abeff,_0x170647){return db[_0x3b2a('0x28')][_0x3b2a('0x43')]({'where':{'id':_0x4abeff[_0x3b2a('0x40')]['id']}})[_0x3b2a('0x22')](handleEntityNotFound(_0x170647,null))[_0x3b2a('0x22')](removeEntity(_0x170647,null))[_0x3b2a('0x3f')](handleError(_0x170647,null));};exports[_0x3b2a('0x46')]=function(_0x416e55,_0x5447bb){return db['JscriptyQuestionReport'][_0x3b2a('0x46')]()[_0x3b2a('0x22')](respondWithResult(_0x5447bb,null))[_0x3b2a('0x3f')](handleError(_0x5447bb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 2673869..c91da71 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 _0x326b=['report_jscripty_questions','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x326b,0x109));var _0xb326=function(_0x290a56,_0x5c540a){_0x290a56=_0x290a56-0x0;var _0x89610=_0x326b[_0x290a56];return _0x89610;};'use strict';var _=require(_0xb326('0x0'));var util=require(_0xb326('0x1'));var logger=require(_0xb326('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb326('0x3'));var rp=require(_0xb326('0x4'));var fs=require('fs');var path=require(_0xb326('0x5'));var rimraf=require('rimraf');var config=require(_0xb326('0x6'));var attributes=require(_0xb326('0x7'));module[_0xb326('0x8')]=function(_0x377757,_0x8060ed){return _0x377757[_0xb326('0x9')](_0xb326('0xa'),attributes,{'tableName':_0xb326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c89=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x1ce4b8,_0x541b1d){var _0x432fb2=function(_0x257b0f){while(--_0x257b0f){_0x1ce4b8['push'](_0x1ce4b8['shift']());}};_0x432fb2(++_0x541b1d);}(_0x4c89,0x8e));var _0x94c8=function(_0x2f8ff8,_0x498dde){_0x2f8ff8=_0x2f8ff8-0x0;var _0x42a1f2=_0x4c89[_0x2f8ff8];return _0x42a1f2;};'use strict';var _=require(_0x94c8('0x0'));var util=require('util');var logger=require(_0x94c8('0x1'))(_0x94c8('0x2'));var moment=require(_0x94c8('0x3'));var BPromise=require(_0x94c8('0x4'));var rp=require(_0x94c8('0x5'));var fs=require('fs');var path=require(_0x94c8('0x6'));var rimraf=require('rimraf');var config=require(_0x94c8('0x7'));var attributes=require(_0x94c8('0x8'));module[_0x94c8('0x9')]=function(_0x3a6a58,_0x44c925){return _0x3a6a58[_0x94c8('0xa')](_0x94c8('0xb'),attributes,{'tableName':_0x94c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index a49f6db..240bee8 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 _0x370d=['../../config/environment','jayson/promise','client','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','randomstring','../../config/utils','rpc'];(function(_0x50974b,_0x2ef9d1){var _0x4842e4=function(_0x41efdc){while(--_0x41efdc){_0x50974b['push'](_0x50974b['shift']());}};_0x4842e4(++_0x2ef9d1);}(_0x370d,0x14f));var _0xd370=function(_0x1e152d,_0x892f35){_0x1e152d=_0x1e152d-0x0;var _0x4114d0=_0x370d[_0x1e152d];return _0x4114d0;};'use strict';var _=require(_0xd370('0x0'));var util=require(_0xd370('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd370('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd370('0x3'));var logger=require('../../config/logger')(_0xd370('0x4'));var config=require(_0xd370('0x5'));var jayson=require(_0xd370('0x6'));var client=jayson[_0xd370('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37c5aa,_0x2949fc,_0x3057ef){return new BPromise(function(_0x58b9ac,_0x3c66fa){return client['request'](_0x37c5aa,_0x3057ef)[_0xd370('0x8')](function(_0x300c16){logger[_0xd370('0x9')](_0xd370('0xa'),_0x2949fc,_0xd370('0xb'));logger[_0xd370('0xc')](_0xd370('0xd'),_0x2949fc,_0xd370('0xb'),JSON['stringify'](_0x300c16));if(_0x300c16[_0xd370('0xe')]){if(_0x300c16[_0xd370('0xe')][_0xd370('0xf')]===0x1f4){logger[_0xd370('0xe')](_0xd370('0xa'),_0x2949fc,_0x300c16[_0xd370('0xe')]['message']);return _0x3c66fa(_0x300c16[_0xd370('0xe')][_0xd370('0x10')]);}logger['error'](_0xd370('0xa'),_0x2949fc,_0x300c16[_0xd370('0xe')][_0xd370('0x10')]);return _0x58b9ac(_0x300c16[_0xd370('0xe')][_0xd370('0x10')]);}else{logger[_0xd370('0x9')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2949fc,_0xd370('0xb'));_0x58b9ac(_0x300c16['result'][_0xd370('0x10')]);}})['catch'](function(_0x3df039){logger[_0xd370('0xe')](_0xd370('0xa'),_0x2949fc,_0x3df039);_0x3c66fa(_0x3df039);});});} \ No newline at end of file +var _0x6517=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','JscriptyQuestionReport,\x20%s,\x20%s','lodash','moment'];(function(_0x5976ba,_0x3533ac){var _0xfe89d5=function(_0x5423e9){while(--_0x5423e9){_0x5976ba['push'](_0x5976ba['shift']());}};_0xfe89d5(++_0x3533ac);}(_0x6517,0x1ae));var _0x7651=function(_0x59ce32,_0x35a6ed){_0x59ce32=_0x59ce32-0x0;var _0x16b9f4=_0x6517[_0x59ce32];return _0x16b9f4;};'use strict';var _=require(_0x7651('0x0'));var util=require('util');var moment=require(_0x7651('0x1'));var BPromise=require(_0x7651('0x2'));var rs=require(_0x7651('0x3'));var fs=require('fs');var Redis=require(_0x7651('0x4'));var db=require(_0x7651('0x5'))['db'];var utils=require(_0x7651('0x6'));var logger=require('../../config/logger')(_0x7651('0x7'));var config=require(_0x7651('0x8'));var jayson=require(_0x7651('0x9'));var client=jayson[_0x7651('0xa')][_0x7651('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19a2c6,_0x4aad33,_0x32f0c9){return new BPromise(function(_0x50a727,_0x32a05f){return client[_0x7651('0xc')](_0x19a2c6,_0x32f0c9)[_0x7651('0xd')](function(_0x1ab089){logger[_0x7651('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4aad33,_0x7651('0xf'));logger[_0x7651('0x10')](_0x7651('0x11'),_0x4aad33,_0x7651('0xf'),JSON[_0x7651('0x12')](_0x1ab089));if(_0x1ab089[_0x7651('0x13')]){if(_0x1ab089[_0x7651('0x13')][_0x7651('0x14')]===0x1f4){logger[_0x7651('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4aad33,_0x1ab089[_0x7651('0x13')][_0x7651('0x15')]);return _0x32a05f(_0x1ab089[_0x7651('0x13')]['message']);}logger[_0x7651('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4aad33,_0x1ab089['error'][_0x7651('0x15')]);return _0x50a727(_0x1ab089[_0x7651('0x13')][_0x7651('0x15')]);}else{logger[_0x7651('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4aad33,_0x7651('0xf'));_0x50a727(_0x1ab089[_0x7651('0x16')][_0x7651('0x15')]);}})['catch'](function(_0x218a85){logger[_0x7651('0x13')](_0x7651('0x17'),_0x4aad33,_0x218a85);_0x32a05f(_0x218a85);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 47563cb..ed2aded 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 _0xe874=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe874,0x1f3));var _0x4e87=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0xe874[_0x542d80];return _0x1f4492;};'use strict';var multer=require(_0x4e87('0x0'));var util=require(_0x4e87('0x1'));var path=require(_0x4e87('0x2'));var timeout=require(_0x4e87('0x3'));var express=require('express');var router=express[_0x4e87('0x4')]();var fs_extra=require(_0x4e87('0x5'));var auth=require(_0x4e87('0x6'));var interaction=require(_0x4e87('0x7'));var config=require(_0x4e87('0x8'));var controller=require(_0x4e87('0x9'));router[_0x4e87('0xa')]('/',auth[_0x4e87('0xb')](),controller[_0x4e87('0xc')]);router[_0x4e87('0xa')](_0x4e87('0xd'),auth[_0x4e87('0xb')](),controller['describe']);router[_0x4e87('0xa')](_0x4e87('0xe'),auth['isAuthenticated'](),controller[_0x4e87('0xf')]);router[_0x4e87('0xa')](_0x4e87('0x10'),auth[_0x4e87('0xb')](),controller['getQuestions']);router[_0x4e87('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4e87('0x12')](_0x4e87('0xe'),auth[_0x4e87('0xb')](),controller[_0x4e87('0x13')]);router['delete'](_0x4e87('0xe'),auth[_0x4e87('0xb')](),controller[_0x4e87('0x14')]);module[_0x4e87('0x15')]=router; \ No newline at end of file +var _0xdb81=['isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0xdb81,0x1f1));var _0x1db8=function(_0x4a04e3,_0x104919){_0x4a04e3=_0x4a04e3-0x0;var _0x18fb20=_0xdb81[_0x4a04e3];return _0x18fb20;};'use strict';var multer=require(_0x1db8('0x0'));var util=require(_0x1db8('0x1'));var path=require(_0x1db8('0x2'));var timeout=require('connect-timeout');var express=require(_0x1db8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1db8('0x4'));var interaction=require(_0x1db8('0x5'));var config=require(_0x1db8('0x6'));var controller=require(_0x1db8('0x7'));router[_0x1db8('0x8')]('/',auth[_0x1db8('0x9')](),controller[_0x1db8('0xa')]);router[_0x1db8('0x8')](_0x1db8('0xb'),auth[_0x1db8('0x9')](),controller[_0x1db8('0xc')]);router[_0x1db8('0x8')](_0x1db8('0xd'),auth[_0x1db8('0x9')](),controller[_0x1db8('0xe')]);router[_0x1db8('0x8')](_0x1db8('0xf'),auth[_0x1db8('0x9')](),controller[_0x1db8('0x10')]);router['post']('/',auth[_0x1db8('0x9')](),controller[_0x1db8('0x11')]);router[_0x1db8('0x12')](_0x1db8('0xd'),auth[_0x1db8('0x9')](),controller[_0x1db8('0x13')]);router[_0x1db8('0x14')](_0x1db8('0xd'),auth[_0x1db8('0x9')](),controller[_0x1db8('0x15')]);module[_0x1db8('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 02332bf..54236ba 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 _0x2bbc=['moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2bbc,0xa5));var _0xc2bb=function(_0x3bf68a,_0x33695f){_0x3bf68a=_0x3bf68a-0x0;var _0x49f047=_0x2bbc[_0x3bf68a];return _0x49f047;};'use strict';var moment=require(_0xc2bb('0x0'));var Sequelize=require(_0xc2bb('0x1'));module[_0xc2bb('0x2')]={'starttime':{'type':Sequelize[_0xc2bb('0x3')],'set':function(_0xbced50){this[_0xc2bb('0x4')](_0xc2bb('0x5'),_0xbced50);this[_0xc2bb('0x4')](_0xc2bb('0x6'),moment()[_0xc2bb('0x7')](_0xc2bb('0x8')));}},'endtime':{'type':Sequelize[_0xc2bb('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xc2bb('0x9')]},'queue':{'type':Sequelize[_0xc2bb('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc2bb('0x9')]},'completed':{'type':Sequelize[_0xc2bb('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x3067=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x3067,0x7e));var _0x7306=function(_0x77f28d,_0x3617b3){_0x77f28d=_0x77f28d-0x0;var _0x4836dd=_0x3067[_0x77f28d];return _0x4836dd;};'use strict';var moment=require(_0x7306('0x0'));var Sequelize=require(_0x7306('0x1'));module[_0x7306('0x2')]={'starttime':{'type':Sequelize[_0x7306('0x3')],'set':function(_0x133e5a){this[_0x7306('0x4')](_0x7306('0x5'),_0x133e5a);this[_0x7306('0x4')](_0x7306('0x6'),moment()[_0x7306('0x7')](_0x7306('0x8')));}},'endtime':{'type':Sequelize[_0x7306('0x3')]},'membername':{'type':Sequelize[_0x7306('0x9')]},'projectname':{'type':Sequelize[_0x7306('0x9')]},'queue':{'type':Sequelize[_0x7306('0x9')]},'uniqueid':{'type':Sequelize[_0x7306('0x9')]},'calleridname':{'type':Sequelize[_0x7306('0x9')]},'calleridnum':{'type':Sequelize[_0x7306('0x9')]},'completed':{'type':Sequelize[_0x7306('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 5c17bd2..089d866 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 _0xf6bb=['getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','pick','SessionId','options','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','end','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','body','find','destroy','describe'];(function(_0xbf5006,_0x42b5da){var _0x22119d=function(_0x15d220){while(--_0x15d220){_0xbf5006['push'](_0xbf5006['shift']());}};_0x22119d(++_0x42b5da);}(_0xf6bb,0x100));var _0xbf6b=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0xf6bb[_0xc87d08];return _0x30a714;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf6b('0x0'));var zipdir=require(_0xbf6b('0x1'));var jsonpatch=require(_0xbf6b('0x2'));var rp=require(_0xbf6b('0x3'));var moment=require(_0xbf6b('0x4'));var BPromise=require(_0xbf6b('0x5'));var Mustache=require(_0xbf6b('0x6'));var util=require(_0xbf6b('0x7'));var path=require(_0xbf6b('0x8'));var sox=require('sox');var csv=require(_0xbf6b('0x9'));var ejs=require(_0xbf6b('0xa'));var fs=require('fs');var fs_extra=require(_0xbf6b('0xb'));var _=require(_0xbf6b('0xc'));var squel=require('squel');var crypto=require(_0xbf6b('0xd'));var jsforce=require(_0xbf6b('0xe'));var deskjs=require(_0xbf6b('0xf'));var toCsv=require(_0xbf6b('0x9'));var querystring=require(_0xbf6b('0x10'));var Papa=require(_0xbf6b('0x11'));var Redis=require(_0xbf6b('0x12'));var authService=require(_0xbf6b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbf6b('0x14'));var hardwareService=require(_0xbf6b('0x15'));var logger=require(_0xbf6b('0x16'))(_0xbf6b('0x17'));var utils=require(_0xbf6b('0x18'));var config=require(_0xbf6b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf6b('0x1a'))['db'];function respondWithStatusCode(_0x14ef5e,_0xabf5ec){_0xabf5ec=_0xabf5ec||0xcc;return function(_0x3220ba){if(_0x3220ba){return _0x14ef5e[_0xbf6b('0x1b')](_0xabf5ec);}return _0x14ef5e['status'](_0xabf5ec)['end']();};}function respondWithResult(_0xdf7d4c,_0xb679){_0xb679=_0xb679||0xc8;return function(_0x44312b){if(_0x44312b){return _0xdf7d4c[_0xbf6b('0x1c')](_0xb679)['json'](_0x44312b);}};}function respondWithFilteredResult(_0x101070,_0x57b2b1){return function(_0x8fc6e5){if(_0x8fc6e5){var _0x3847a0=typeof _0x57b2b1[_0xbf6b('0x1d')]==='undefined'&&typeof _0x57b2b1[_0xbf6b('0x1e')]===_0xbf6b('0x1f');var _0x25993b=_0x8fc6e5['count'];var _0x122d36=_0x3847a0?0x0:_0x57b2b1['offset'];var _0x5da753=_0x3847a0?_0x8fc6e5[_0xbf6b('0x20')]:_0x57b2b1[_0xbf6b('0x1d')]+_0x57b2b1[_0xbf6b('0x1e')];var _0x2c3d99;if(_0x5da753>=_0x25993b){_0x5da753=_0x25993b;_0x2c3d99=0xc8;}else{_0x2c3d99=0xce;}_0x101070['status'](_0x2c3d99);return _0x101070[_0xbf6b('0x21')](_0xbf6b('0x22'),_0x122d36+'-'+_0x5da753+'/'+_0x25993b)[_0xbf6b('0x23')](_0x8fc6e5);}return null;};}function patchUpdates(_0x1f4a44){return function(_0x371880){try{jsonpatch['apply'](_0x371880,_0x1f4a44,!![]);}catch(_0x307486){return BPromise[_0xbf6b('0x24')](_0x307486);}return _0x371880[_0xbf6b('0x25')]();};}function saveUpdates(_0x40469b,_0x55bfb3){return function(_0x6d22bc){if(_0x6d22bc){return _0x6d22bc[_0xbf6b('0x26')](_0x40469b)[_0xbf6b('0x27')](function(_0x1084bf){return _0x1084bf;});}return null;};}function removeEntity(_0x3bf0f9,_0x4f1458){return function(_0x566580){if(_0x566580){return _0x566580['destroy']()[_0xbf6b('0x27')](function(){_0x3bf0f9[_0xbf6b('0x1c')](0xcc)[_0xbf6b('0x28')]();});}};}function handleEntityNotFound(_0x5cefa0,_0x5e81f0){return function(_0x123361){if(!_0x123361){_0x5cefa0[_0xbf6b('0x1b')](0x194);}return _0x123361;};}function handleError(_0x1465b9,_0x2af574){_0x2af574=_0x2af574||0x1f4;return function(_0x650f9){logger['error'](_0x650f9[_0xbf6b('0x29')]);if(_0x650f9[_0xbf6b('0x2a')]){delete _0x650f9[_0xbf6b('0x2a')];}_0x1465b9['status'](_0x2af574)[_0xbf6b('0x2b')](_0x650f9);};}exports['index']=function(_0x54a405,_0x147798){var _0x4d8a65={},_0x48855d={},_0x2dfc42={'count':0x0,'rows':[]};var _0x49a981=_[_0xbf6b('0x2c')](db[_0xbf6b('0x2d')][_0xbf6b('0x2e')],function(_0x3653cb){return{'name':_0x3653cb[_0xbf6b('0x2f')],'type':_0x3653cb[_0xbf6b('0x30')][_0xbf6b('0x31')]};});_0x48855d['model']=_[_0xbf6b('0x2c')](_0x49a981,'name');_0x48855d[_0xbf6b('0x32')]=_[_0xbf6b('0x33')](_0x54a405[_0xbf6b('0x32')]);_0x48855d[_0xbf6b('0x34')]=_['intersection'](_0x48855d['model'],_0x48855d['query']);_0x4d8a65[_0xbf6b('0x35')]=_[_0xbf6b('0x36')](_0x48855d[_0xbf6b('0x37')],qs[_0xbf6b('0x38')](_0x54a405['query'][_0xbf6b('0x38')]));_0x4d8a65[_0xbf6b('0x35')]=_0x4d8a65[_0xbf6b('0x35')][_0xbf6b('0x39')]?_0x4d8a65[_0xbf6b('0x35')]:_0x48855d[_0xbf6b('0x37')];if(!_0x54a405[_0xbf6b('0x32')]['hasOwnProperty'](_0xbf6b('0x3a'))){_0x4d8a65[_0xbf6b('0x1e')]=qs[_0xbf6b('0x1e')](_0x54a405['query'][_0xbf6b('0x1e')]);_0x4d8a65[_0xbf6b('0x1d')]=qs[_0xbf6b('0x1d')](_0x54a405[_0xbf6b('0x32')][_0xbf6b('0x1d')]);}_0x4d8a65[_0xbf6b('0x3b')]=qs[_0xbf6b('0x3c')](_0x54a405[_0xbf6b('0x32')][_0xbf6b('0x3c')]);_0x4d8a65['where']=qs[_0xbf6b('0x34')](_['pick'](_0x54a405['query'],_0x48855d[_0xbf6b('0x34')]),_0x49a981);if(_0x54a405[_0xbf6b('0x32')][_0xbf6b('0x3d')]){_0x4d8a65[_0xbf6b('0x3e')]=_[_0xbf6b('0x3f')](_0x4d8a65[_0xbf6b('0x3e')],{'$or':_[_0xbf6b('0x2c')](_0x49a981,function(_0x5cbb06){if(_0x5cbb06[_0xbf6b('0x30')]!==_0xbf6b('0x40')){var _0x240ed9={};_0x240ed9[_0x5cbb06['name']]={'$like':'%'+_0x54a405['query']['filter']+'%'};return _0x240ed9;}})});}_0x4d8a65=_[_0xbf6b('0x3f')]({},_0x4d8a65,_0x54a405['options']);var _0x4daafc={'where':_0x4d8a65[_0xbf6b('0x3e')]};return db['JscriptySessionReport'][_0xbf6b('0x20')](_0x4daafc)[_0xbf6b('0x27')](function(_0x19d056){_0x2dfc42['count']=_0x19d056;if(_0x54a405[_0xbf6b('0x32')][_0xbf6b('0x41')]){_0x4d8a65[_0xbf6b('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xbf6b('0x43')](_0x4d8a65);})[_0xbf6b('0x27')](function(_0x187e30){_0x2dfc42[_0xbf6b('0x44')]=_0x187e30;return _0x2dfc42;})[_0xbf6b('0x27')](respondWithFilteredResult(_0x147798,_0x4d8a65))[_0xbf6b('0x45')](handleError(_0x147798,null));};exports[_0xbf6b('0x46')]=function(_0x28bfca,_0xb9726b){var _0xeb7ef2={'raw':!![],'where':{'id':_0x28bfca[_0xbf6b('0x47')]['id']}},_0xc219f8={};_0xc219f8['model']=_[_0xbf6b('0x33')](db[_0xbf6b('0x2d')][_0xbf6b('0x2e')]);_0xc219f8[_0xbf6b('0x32')]=_[_0xbf6b('0x33')](_0x28bfca[_0xbf6b('0x32')]);_0xc219f8['filters']=_['intersection'](_0xc219f8[_0xbf6b('0x37')],_0xc219f8[_0xbf6b('0x32')]);_0xeb7ef2[_0xbf6b('0x35')]=_[_0xbf6b('0x36')](_0xc219f8[_0xbf6b('0x37')],qs[_0xbf6b('0x38')](_0x28bfca[_0xbf6b('0x32')][_0xbf6b('0x38')]));_0xeb7ef2['attributes']=_0xeb7ef2[_0xbf6b('0x35')][_0xbf6b('0x39')]?_0xeb7ef2[_0xbf6b('0x35')]:_0xc219f8[_0xbf6b('0x37')];if(_0x28bfca[_0xbf6b('0x32')][_0xbf6b('0x41')]){_0xeb7ef2['include']=[{'all':!![]}];}_0xeb7ef2=_[_0xbf6b('0x3f')]({},_0xeb7ef2,_0x28bfca['options']);return db['JscriptySessionReport']['find'](_0xeb7ef2)[_0xbf6b('0x27')](handleEntityNotFound(_0xb9726b,null))[_0xbf6b('0x27')](respondWithResult(_0xb9726b,null))[_0xbf6b('0x45')](handleError(_0xb9726b,null));};exports['create']=function(_0x7c9be4,_0x424872){return db[_0xbf6b('0x2d')]['create'](_0x7c9be4[_0xbf6b('0x48')],{})[_0xbf6b('0x27')](respondWithResult(_0x424872,0xc9))[_0xbf6b('0x45')](handleError(_0x424872,null));};exports['update']=function(_0x2fa857,_0x5f0b45){if(_0x2fa857[_0xbf6b('0x48')]['id']){delete _0x2fa857[_0xbf6b('0x48')]['id'];}return db[_0xbf6b('0x2d')][_0xbf6b('0x49')]({'where':{'id':_0x2fa857[_0xbf6b('0x47')]['id']}})[_0xbf6b('0x27')](handleEntityNotFound(_0x5f0b45,null))[_0xbf6b('0x27')](saveUpdates(_0x2fa857[_0xbf6b('0x48')],null))[_0xbf6b('0x27')](respondWithResult(_0x5f0b45,null))[_0xbf6b('0x45')](handleError(_0x5f0b45,null));};exports[_0xbf6b('0x4a')]=function(_0x248fa7,_0x5b0d69){return db[_0xbf6b('0x2d')]['find']({'where':{'id':_0x248fa7[_0xbf6b('0x47')]['id']}})[_0xbf6b('0x27')](handleEntityNotFound(_0x5b0d69,null))[_0xbf6b('0x27')](removeEntity(_0x5b0d69,null))['catch'](handleError(_0x5b0d69,null));};exports['describe']=function(_0x30fc58,_0x1e224d){return db[_0xbf6b('0x2d')][_0xbf6b('0x4b')]()['then'](respondWithResult(_0x1e224d,null))[_0xbf6b('0x45')](handleError(_0x1e224d,null));};exports[_0xbf6b('0x4c')]=function(_0xb2dce9,_0x5d1ae7,_0x38b14e){var _0x37bccb={'raw':!![],'where':{}};var _0x4ac812={};var _0x122d08={'count':0x0,'rows':[]};return db[_0xbf6b('0x2d')][_0xbf6b('0x4d')]({'where':{'id':_0xb2dce9[_0xbf6b('0x47')]['id']}})[_0xbf6b('0x27')](handleEntityNotFound(_0x5d1ae7,null))[_0xbf6b('0x27')](function(_0x7c9f68){if(_0x7c9f68){_0x4ac812['model']=_[_0xbf6b('0x33')](db[_0xbf6b('0x4e')][_0xbf6b('0x2e')]);_0x4ac812[_0xbf6b('0x32')]=_[_0xbf6b('0x33')](_0xb2dce9[_0xbf6b('0x32')]);_0x4ac812[_0xbf6b('0x34')]=_[_0xbf6b('0x36')](_0x4ac812[_0xbf6b('0x37')],_0x4ac812[_0xbf6b('0x32')]);_0x37bccb[_0xbf6b('0x35')]=_[_0xbf6b('0x36')](_0x4ac812['model'],qs[_0xbf6b('0x38')](_0xb2dce9[_0xbf6b('0x32')][_0xbf6b('0x38')]));_0x37bccb[_0xbf6b('0x35')]=_0x37bccb[_0xbf6b('0x35')][_0xbf6b('0x39')]?_0x37bccb['attributes']:_0x4ac812[_0xbf6b('0x37')];if(!_0xb2dce9[_0xbf6b('0x32')][_0xbf6b('0x4f')]('nolimit')){_0x37bccb['limit']=qs['limit'](_0xb2dce9['query'][_0xbf6b('0x1e')]);_0x37bccb[_0xbf6b('0x1d')]=qs[_0xbf6b('0x1d')](_0xb2dce9[_0xbf6b('0x32')][_0xbf6b('0x1d')]);}_0x37bccb[_0xbf6b('0x3b')]=qs[_0xbf6b('0x3c')](_0xb2dce9['query'][_0xbf6b('0x3c')]);_0x37bccb[_0xbf6b('0x3e')]=qs[_0xbf6b('0x34')](_[_0xbf6b('0x50')](_0xb2dce9[_0xbf6b('0x32')],_0x4ac812['filters']));_0x37bccb[_0xbf6b('0x3e')][_0xbf6b('0x51')]=_0x7c9f68['id'];if(_0xb2dce9[_0xbf6b('0x32')]['filter']){_0x37bccb[_0xbf6b('0x3e')]=_[_0xbf6b('0x3f')](_0x37bccb[_0xbf6b('0x3e')],{'$or':_[_0xbf6b('0x2c')](_0x37bccb[_0xbf6b('0x35')],function(_0x241474){var _0x306212={};_0x306212[_0x241474]={'$like':'%'+_0xb2dce9['query'][_0xbf6b('0x3d')]+'%'};return _0x306212;})});}_0x37bccb=_[_0xbf6b('0x3f')]({},_0x37bccb,_0xb2dce9[_0xbf6b('0x52')]);return db[_0xbf6b('0x4e')][_0xbf6b('0x20')]({'where':_0x37bccb['where']})[_0xbf6b('0x27')](function(_0x312c91){_0x122d08['count']=_0x312c91;if(_0xb2dce9['query'][_0xbf6b('0x41')]){_0x37bccb[_0xbf6b('0x42')]=[{'all':!![]}];}return db[_0xbf6b('0x4e')][_0xbf6b('0x43')](_0x37bccb);})[_0xbf6b('0x27')](function(_0xe35bff){_0x122d08[_0xbf6b('0x44')]=_0xe35bff;return _0x122d08;});}})['then'](respondWithFilteredResult(_0x5d1ae7,_0x37bccb))[_0xbf6b('0x45')](handleError(_0x5d1ae7,null));}; \ No newline at end of file +var _0x291e=['JscriptySessionReport','rawAttributes','fieldName','key','map','query','filters','attributes','intersection','model','fields','nolimit','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','catch','params','keys','includeAll','include','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','order','pick','eml-format','rimraf','zip-dir','request-promise','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','index'];(function(_0x2fe2aa,_0x5d7481){var _0x215e08=function(_0x589397){while(--_0x589397){_0x2fe2aa['push'](_0x2fe2aa['shift']());}};_0x215e08(++_0x5d7481);}(_0x291e,0x1aa));var _0xe291=function(_0x9bc791,_0xc98e68){_0x9bc791=_0x9bc791-0x0;var _0x7e0b05=_0x291e[_0x9bc791];return _0x7e0b05;};'use strict';var emlformat=require(_0xe291('0x0'));var rimraf=require(_0xe291('0x1'));var zipdir=require(_0xe291('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe291('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe291('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe291('0x5'));var csv=require('to-csv');var ejs=require(_0xe291('0x6'));var fs=require('fs');var fs_extra=require(_0xe291('0x7'));var _=require(_0xe291('0x8'));var squel=require(_0xe291('0x9'));var crypto=require(_0xe291('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe291('0xb'));var toCsv=require(_0xe291('0xc'));var querystring=require(_0xe291('0xd'));var Papa=require(_0xe291('0xe'));var Redis=require(_0xe291('0xf'));var authService=require(_0xe291('0x10'));var qs=require(_0xe291('0x11'));var as=require(_0xe291('0x12'));var hardwareService=require(_0xe291('0x13'));var logger=require(_0xe291('0x14'))('api');var utils=require(_0xe291('0x15'));var config=require(_0xe291('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe291('0x17'))['db'];function respondWithStatusCode(_0x4aeabb,_0x47c739){_0x47c739=_0x47c739||0xcc;return function(_0x41de65){if(_0x41de65){return _0x4aeabb[_0xe291('0x18')](_0x47c739);}return _0x4aeabb[_0xe291('0x19')](_0x47c739)[_0xe291('0x1a')]();};}function respondWithResult(_0x3aaff1,_0x3aeb9a){_0x3aeb9a=_0x3aeb9a||0xc8;return function(_0x53efe5){if(_0x53efe5){return _0x3aaff1[_0xe291('0x19')](_0x3aeb9a)[_0xe291('0x1b')](_0x53efe5);}};}function respondWithFilteredResult(_0x2fa1c4,_0x1a81e3){return function(_0x1f4a5c){if(_0x1f4a5c){var _0x1b65d8=typeof _0x1a81e3['offset']===_0xe291('0x1c')&&typeof _0x1a81e3[_0xe291('0x1d')]===_0xe291('0x1c');var _0x437fc0=_0x1f4a5c[_0xe291('0x1e')];var _0x42d081=_0x1b65d8?0x0:_0x1a81e3[_0xe291('0x1f')];var _0x42f5b3=_0x1b65d8?_0x1f4a5c[_0xe291('0x1e')]:_0x1a81e3[_0xe291('0x1f')]+_0x1a81e3[_0xe291('0x1d')];var _0x3b2100;if(_0x42f5b3>=_0x437fc0){_0x42f5b3=_0x437fc0;_0x3b2100=0xc8;}else{_0x3b2100=0xce;}_0x2fa1c4[_0xe291('0x19')](_0x3b2100);return _0x2fa1c4[_0xe291('0x20')](_0xe291('0x21'),_0x42d081+'-'+_0x42f5b3+'/'+_0x437fc0)[_0xe291('0x1b')](_0x1f4a5c);}return null;};}function patchUpdates(_0x240832){return function(_0x39ffe7){try{jsonpatch[_0xe291('0x22')](_0x39ffe7,_0x240832,!![]);}catch(_0x3e4846){return BPromise[_0xe291('0x23')](_0x3e4846);}return _0x39ffe7['save']();};}function saveUpdates(_0x5387a8,_0x30f726){return function(_0x49981f){if(_0x49981f){return _0x49981f[_0xe291('0x24')](_0x5387a8)[_0xe291('0x25')](function(_0x157b51){return _0x157b51;});}return null;};}function removeEntity(_0x416d17,_0x275c16){return function(_0x59563b){if(_0x59563b){return _0x59563b[_0xe291('0x26')]()['then'](function(){_0x416d17['status'](0xcc)[_0xe291('0x1a')]();});}};}function handleEntityNotFound(_0x3aba7b,_0x567d99){return function(_0x337ba6){if(!_0x337ba6){_0x3aba7b['sendStatus'](0x194);}return _0x337ba6;};}function handleError(_0x38857c,_0x2e26cc){_0x2e26cc=_0x2e26cc||0x1f4;return function(_0x4de8a9){logger[_0xe291('0x27')](_0x4de8a9['stack']);if(_0x4de8a9[_0xe291('0x28')]){delete _0x4de8a9[_0xe291('0x28')];}_0x38857c['status'](_0x2e26cc)['send'](_0x4de8a9);};}exports[_0xe291('0x29')]=function(_0x55cdc1,_0x3c67a6){var _0x2d1bce={},_0x1e3ffb={},_0x3ed598={'count':0x0,'rows':[]};var _0x86b7a1=_['map'](db[_0xe291('0x2a')][_0xe291('0x2b')],function(_0x202ee1){return{'name':_0x202ee1[_0xe291('0x2c')],'type':_0x202ee1['type'][_0xe291('0x2d')]};});_0x1e3ffb['model']=_[_0xe291('0x2e')](_0x86b7a1,_0xe291('0x28'));_0x1e3ffb[_0xe291('0x2f')]=_['keys'](_0x55cdc1[_0xe291('0x2f')]);_0x1e3ffb[_0xe291('0x30')]=_['intersection'](_0x1e3ffb['model'],_0x1e3ffb[_0xe291('0x2f')]);_0x2d1bce[_0xe291('0x31')]=_[_0xe291('0x32')](_0x1e3ffb[_0xe291('0x33')],qs[_0xe291('0x34')](_0x55cdc1[_0xe291('0x2f')][_0xe291('0x34')]));_0x2d1bce[_0xe291('0x31')]=_0x2d1bce[_0xe291('0x31')]['length']?_0x2d1bce[_0xe291('0x31')]:_0x1e3ffb['model'];if(!_0x55cdc1[_0xe291('0x2f')]['hasOwnProperty'](_0xe291('0x35'))){_0x2d1bce['limit']=qs[_0xe291('0x1d')](_0x55cdc1[_0xe291('0x2f')][_0xe291('0x1d')]);_0x2d1bce['offset']=qs[_0xe291('0x1f')](_0x55cdc1[_0xe291('0x2f')][_0xe291('0x1f')]);}_0x2d1bce['order']=qs[_0xe291('0x36')](_0x55cdc1['query'][_0xe291('0x36')]);_0x2d1bce[_0xe291('0x37')]=qs[_0xe291('0x30')](_['pick'](_0x55cdc1[_0xe291('0x2f')],_0x1e3ffb[_0xe291('0x30')]),_0x86b7a1);if(_0x55cdc1[_0xe291('0x2f')][_0xe291('0x38')]){_0x2d1bce[_0xe291('0x37')]=_[_0xe291('0x39')](_0x2d1bce[_0xe291('0x37')],{'$or':_[_0xe291('0x2e')](_0x86b7a1,function(_0x3c1782){if(_0x3c1782[_0xe291('0x3a')]!==_0xe291('0x3b')){var _0x76a30={};_0x76a30[_0x3c1782[_0xe291('0x28')]]={'$like':'%'+_0x55cdc1[_0xe291('0x2f')][_0xe291('0x38')]+'%'};return _0x76a30;}})});}_0x2d1bce=_[_0xe291('0x39')]({},_0x2d1bce,_0x55cdc1[_0xe291('0x3c')]);var _0x2d8920={'where':_0x2d1bce[_0xe291('0x37')]};return db[_0xe291('0x2a')][_0xe291('0x1e')](_0x2d8920)['then'](function(_0x2eedf2){_0x3ed598[_0xe291('0x1e')]=_0x2eedf2;if(_0x55cdc1[_0xe291('0x2f')]['includeAll']){_0x2d1bce['include']=[{'all':!![]}];}return db[_0xe291('0x2a')][_0xe291('0x3d')](_0x2d1bce);})[_0xe291('0x25')](function(_0x40584f){_0x3ed598[_0xe291('0x3e')]=_0x40584f;return _0x3ed598;})[_0xe291('0x25')](respondWithFilteredResult(_0x3c67a6,_0x2d1bce))[_0xe291('0x3f')](handleError(_0x3c67a6,null));};exports['show']=function(_0x27093a,_0x4806f2){var _0x54a4e0={'raw':!![],'where':{'id':_0x27093a[_0xe291('0x40')]['id']}},_0x5d93a6={};_0x5d93a6[_0xe291('0x33')]=_[_0xe291('0x41')](db[_0xe291('0x2a')][_0xe291('0x2b')]);_0x5d93a6[_0xe291('0x2f')]=_[_0xe291('0x41')](_0x27093a[_0xe291('0x2f')]);_0x5d93a6[_0xe291('0x30')]=_[_0xe291('0x32')](_0x5d93a6[_0xe291('0x33')],_0x5d93a6[_0xe291('0x2f')]);_0x54a4e0[_0xe291('0x31')]=_[_0xe291('0x32')](_0x5d93a6['model'],qs[_0xe291('0x34')](_0x27093a[_0xe291('0x2f')]['fields']));_0x54a4e0['attributes']=_0x54a4e0[_0xe291('0x31')]['length']?_0x54a4e0[_0xe291('0x31')]:_0x5d93a6[_0xe291('0x33')];if(_0x27093a[_0xe291('0x2f')][_0xe291('0x42')]){_0x54a4e0[_0xe291('0x43')]=[{'all':!![]}];}_0x54a4e0=_[_0xe291('0x39')]({},_0x54a4e0,_0x27093a['options']);return db[_0xe291('0x2a')]['find'](_0x54a4e0)[_0xe291('0x25')](handleEntityNotFound(_0x4806f2,null))['then'](respondWithResult(_0x4806f2,null))[_0xe291('0x3f')](handleError(_0x4806f2,null));};exports[_0xe291('0x44')]=function(_0x519a26,_0x221e6e){return db[_0xe291('0x2a')][_0xe291('0x44')](_0x519a26[_0xe291('0x45')],{})[_0xe291('0x25')](respondWithResult(_0x221e6e,0xc9))[_0xe291('0x3f')](handleError(_0x221e6e,null));};exports[_0xe291('0x24')]=function(_0x54621a,_0x34ef11){if(_0x54621a['body']['id']){delete _0x54621a[_0xe291('0x45')]['id'];}return db[_0xe291('0x2a')][_0xe291('0x46')]({'where':{'id':_0x54621a[_0xe291('0x40')]['id']}})[_0xe291('0x25')](handleEntityNotFound(_0x34ef11,null))[_0xe291('0x25')](saveUpdates(_0x54621a[_0xe291('0x45')],null))[_0xe291('0x25')](respondWithResult(_0x34ef11,null))['catch'](handleError(_0x34ef11,null));};exports['destroy']=function(_0x1165df,_0x1159f8){return db[_0xe291('0x2a')][_0xe291('0x46')]({'where':{'id':_0x1165df['params']['id']}})[_0xe291('0x25')](handleEntityNotFound(_0x1159f8,null))[_0xe291('0x25')](removeEntity(_0x1159f8,null))['catch'](handleError(_0x1159f8,null));};exports[_0xe291('0x47')]=function(_0x2f79c3,_0x3be862){return db[_0xe291('0x2a')][_0xe291('0x47')]()['then'](respondWithResult(_0x3be862,null))[_0xe291('0x3f')](handleError(_0x3be862,null));};exports[_0xe291('0x48')]=function(_0x10191f,_0x1a46f2,_0x57b1a3){var _0x338283={'raw':!![],'where':{}};var _0xf651cc={};var _0x3798a2={'count':0x0,'rows':[]};return db[_0xe291('0x2a')][_0xe291('0x49')]({'where':{'id':_0x10191f[_0xe291('0x40')]['id']}})[_0xe291('0x25')](handleEntityNotFound(_0x1a46f2,null))['then'](function(_0x25c52d){if(_0x25c52d){_0xf651cc[_0xe291('0x33')]=_[_0xe291('0x41')](db[_0xe291('0x4a')]['rawAttributes']);_0xf651cc[_0xe291('0x2f')]=_[_0xe291('0x41')](_0x10191f[_0xe291('0x2f')]);_0xf651cc[_0xe291('0x30')]=_['intersection'](_0xf651cc[_0xe291('0x33')],_0xf651cc[_0xe291('0x2f')]);_0x338283['attributes']=_['intersection'](_0xf651cc['model'],qs['fields'](_0x10191f['query'][_0xe291('0x34')]));_0x338283[_0xe291('0x31')]=_0x338283[_0xe291('0x31')]['length']?_0x338283[_0xe291('0x31')]:_0xf651cc['model'];if(!_0x10191f[_0xe291('0x2f')][_0xe291('0x4b')](_0xe291('0x35'))){_0x338283[_0xe291('0x1d')]=qs[_0xe291('0x1d')](_0x10191f[_0xe291('0x2f')]['limit']);_0x338283[_0xe291('0x1f')]=qs[_0xe291('0x1f')](_0x10191f[_0xe291('0x2f')][_0xe291('0x1f')]);}_0x338283[_0xe291('0x4c')]=qs[_0xe291('0x36')](_0x10191f[_0xe291('0x2f')][_0xe291('0x36')]);_0x338283[_0xe291('0x37')]=qs['filters'](_[_0xe291('0x4d')](_0x10191f[_0xe291('0x2f')],_0xf651cc[_0xe291('0x30')]));_0x338283[_0xe291('0x37')]['SessionId']=_0x25c52d['id'];if(_0x10191f['query'][_0xe291('0x38')]){_0x338283[_0xe291('0x37')]=_[_0xe291('0x39')](_0x338283[_0xe291('0x37')],{'$or':_[_0xe291('0x2e')](_0x338283['attributes'],function(_0x3c95a0){var _0x47e9eb={};_0x47e9eb[_0x3c95a0]={'$like':'%'+_0x10191f[_0xe291('0x2f')]['filter']+'%'};return _0x47e9eb;})});}_0x338283=_[_0xe291('0x39')]({},_0x338283,_0x10191f[_0xe291('0x3c')]);return db[_0xe291('0x4a')][_0xe291('0x1e')]({'where':_0x338283[_0xe291('0x37')]})[_0xe291('0x25')](function(_0xe1d1f7){_0x3798a2[_0xe291('0x1e')]=_0xe1d1f7;if(_0x10191f[_0xe291('0x2f')][_0xe291('0x42')]){_0x338283[_0xe291('0x43')]=[{'all':!![]}];}return db[_0xe291('0x4a')][_0xe291('0x3d')](_0x338283);})[_0xe291('0x25')](function(_0x52003c){_0x3798a2[_0xe291('0x3e')]=_0x52003c;return _0x3798a2;});}})[_0xe291('0x25')](respondWithFilteredResult(_0x1a46f2,_0x338283))[_0xe291('0x3f')](handleError(_0x1a46f2,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 049e564..2c3bf43 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 _0x6c7b=['path','rimraf','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','moment','request-promise'];(function(_0x4fb32f,_0x39f177){var _0x2fd978=function(_0x516ff9){while(--_0x516ff9){_0x4fb32f['push'](_0x4fb32f['shift']());}};_0x2fd978(++_0x39f177);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x376c87,_0x259f10){_0x376c87=_0x376c87-0x0;var _0x265832=_0x6c7b[_0x376c87];return _0x265832;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('JscriptySessionReport',attributes,{'tableName':_0xb6c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd4=['rimraf','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x5c0dfb,_0x29fe5e){_0x5c0dfb=_0x5c0dfb-0x0;var _0x49be35=_0x9fd4[_0x5c0dfb];return _0x49be35;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x49fd('0xb'),'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 ca405a2..2425b4b 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 _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0xae507b,_0x57ded3){var _0x50d288=function(_0xbb891d){while(--_0xbb891d){_0xae507b['push'](_0xae507b['shift']());}};_0x50d288(++_0x57ded3);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2ffe72,_0x58ade9){_0x2ffe72=_0x2ffe72-0x0;var _0x2711a3=_0xc1c6[_0x2ffe72];return _0x2711a3;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file +var _0xb145=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message'];(function(_0x3dfa76,_0x10b0f7){var _0x3e7a7b=function(_0x3c2c1f){while(--_0x3c2c1f){_0x3dfa76['push'](_0x3dfa76['shift']());}};_0x3e7a7b(++_0x10b0f7);}(_0xb145,0xa3));var _0x5b14=function(_0x24b9b6,_0x4d7edf){_0x24b9b6=_0x24b9b6-0x0;var _0x5b7af5=_0xb145[_0x24b9b6];return _0x5b7af5;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d6917fd..1962782 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 _0x9f19=['get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x47f0cd,_0x6ea560){var _0x50bd1d=function(_0x2913c8){while(--_0x2913c8){_0x47f0cd['push'](_0x47f0cd['shift']());}};_0x50bd1d(++_0x6ea560);}(_0x9f19,0xa7));var _0x99f1=function(_0x100f66,_0x1959ad){_0x100f66=_0x100f66-0x0;var _0x4ec96d=_0x9f19[_0x100f66];return _0x4ec96d;};'use strict';var multer=require(_0x99f1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x99f1('0x1'));var express=require(_0x99f1('0x2'));var router=express[_0x99f1('0x3')]();var fs_extra=require(_0x99f1('0x4'));var auth=require(_0x99f1('0x5'));var interaction=require(_0x99f1('0x6'));var config=require(_0x99f1('0x7'));var controller=require(_0x99f1('0x8'));router[_0x99f1('0x9')]('/',controller[_0x99f1('0xa')]);router['put'](_0x99f1('0xb'),auth[_0x99f1('0xc')](),controller[_0x99f1('0xd')]);router[_0x99f1('0x9')](_0x99f1('0xe'),auth[_0x99f1('0xc')](),controller[_0x99f1('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5d30=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','/:id','isAuthenticated','/download_log_file','downloadLogFile','exports','multer','util','path','express'];(function(_0x4b176a,_0x536664){var _0x2fe64a=function(_0x4363cb){while(--_0x4363cb){_0x4b176a['push'](_0x4b176a['shift']());}};_0x2fe64a(++_0x536664);}(_0x5d30,0x10c));var _0x05d3=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x5d30[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0x05d3('0x0'));var util=require(_0x05d3('0x1'));var path=require(_0x05d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x05d3('0x3'));var router=express[_0x05d3('0x4')]();var fs_extra=require(_0x05d3('0x5'));var auth=require(_0x05d3('0x6'));var interaction=require(_0x05d3('0x7'));var config=require(_0x05d3('0x8'));var controller=require(_0x05d3('0x9'));router['get']('/',controller[_0x05d3('0xa')]);router[_0x05d3('0xb')](_0x05d3('0xc'),auth[_0x05d3('0xd')](),controller['update']);router['get'](_0x05d3('0xe'),auth[_0x05d3('0xd')](),controller[_0x05d3('0xf')]);module[_0x05d3('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 3926226..40d22c4 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 _0x2859=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x24b710,_0x2d5dcf){var _0x2722d4=function(_0x188173){while(--_0x188173){_0x24b710['push'](_0x24b710['shift']());}};_0x2722d4(++_0x2d5dcf);}(_0x2859,0x14e));var _0x9285=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x2859[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x9285('0x0'));module[_0x9285('0x1')]={'license':{'type':Sequelize[_0x9285('0x2')]},'data1':{'type':Sequelize[_0x9285('0x3')]},'data2':{'type':Sequelize[_0x9285('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x9285('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x857c=['INTEGER','exports','TEXT','STRING'];(function(_0x4bf573,_0x1c4817){var _0xd82606=function(_0x371941){while(--_0x371941){_0x4bf573['push'](_0x4bf573['shift']());}};_0xd82606(++_0x1c4817);}(_0x857c,0x121));var _0xc857=function(_0x52d574,_0x31d1f6){_0x52d574=_0x52d574-0x0;var _0x54ea97=_0x857c[_0x52d574];return _0x54ea97;};'use strict';var Sequelize=require('sequelize');module[_0xc857('0x0')]={'license':{'type':Sequelize[_0xc857('0x1')]},'data1':{'type':Sequelize[_0xc857('0x2')]},'data2':{'type':Sequelize[_0xc857('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xc857('0x3')],'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 76cdf59..b5bed43 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 _0xed2a=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','apply','reject','update','then','stack','send','../../config/license/util','index','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes','length','merge','options','getLicense','body','find','params','checkLicense','key','catch','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','download','eml-format','rimraf'];(function(_0xcafb2b,_0x2cc85e){var _0x539f9a=function(_0x9a96e6){while(--_0x9a96e6){_0xcafb2b['push'](_0xcafb2b['shift']());}};_0x539f9a(++_0x2cc85e);}(_0xed2a,0x1e8));var _0xaed2=function(_0x52cc9,_0xe92438){_0x52cc9=_0x52cc9-0x0;var _0xc87a2e=_0xed2a[_0x52cc9];return _0xc87a2e;};'use strict';var emlformat=require(_0xaed2('0x0'));var rimraf=require(_0xaed2('0x1'));var zipdir=require(_0xaed2('0x2'));var jsonpatch=require(_0xaed2('0x3'));var rp=require(_0xaed2('0x4'));var moment=require(_0xaed2('0x5'));var BPromise=require(_0xaed2('0x6'));var Mustache=require(_0xaed2('0x7'));var util=require(_0xaed2('0x8'));var path=require(_0xaed2('0x9'));var sox=require(_0xaed2('0xa'));var csv=require(_0xaed2('0xb'));var ejs=require(_0xaed2('0xc'));var fs=require('fs');var fs_extra=require(_0xaed2('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaed2('0xe'));var jsforce=require(_0xaed2('0xf'));var deskjs=require(_0xaed2('0x10'));var toCsv=require(_0xaed2('0xb'));var querystring=require('querystring');var Papa=require(_0xaed2('0x11'));var Redis=require('ioredis');var authService=require(_0xaed2('0x12'));var qs=require(_0xaed2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaed2('0x14'))(_0xaed2('0x15'));var utils=require(_0xaed2('0x16'));var config=require(_0xaed2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaed2('0x18'))['db'];function respondWithStatusCode(_0x295cb6,_0x310033){_0x310033=_0x310033||0xcc;return function(_0x12f6c9){if(_0x12f6c9){return _0x295cb6[_0xaed2('0x19')](_0x310033);}return _0x295cb6[_0xaed2('0x1a')](_0x310033)[_0xaed2('0x1b')]();};}function respondWithResult(_0x337344,_0x4d9c2a){_0x4d9c2a=_0x4d9c2a||0xc8;return function(_0x4e525e){if(_0x4e525e){return _0x337344[_0xaed2('0x1a')](_0x4d9c2a)['json'](_0x4e525e);}};}function respondWithFilteredResult(_0x14e57c,_0x5f099a){return function(_0x330c0e){if(_0x330c0e){var _0x101d63=typeof _0x5f099a[_0xaed2('0x1c')]===_0xaed2('0x1d')&&typeof _0x5f099a['limit']==='undefined';var _0x22a315=_0x330c0e[_0xaed2('0x1e')];var _0x135a0e=_0x101d63?0x0:_0x5f099a[_0xaed2('0x1c')];var _0x28b4b2=_0x101d63?_0x330c0e['count']:_0x5f099a[_0xaed2('0x1c')]+_0x5f099a['limit'];var _0x5cf7ba;if(_0x28b4b2>=_0x22a315){_0x28b4b2=_0x22a315;_0x5cf7ba=0xc8;}else{_0x5cf7ba=0xce;}_0x14e57c['status'](_0x5cf7ba);return _0x14e57c['set'](_0xaed2('0x1f'),_0x135a0e+'-'+_0x28b4b2+'/'+_0x22a315)['json'](_0x330c0e);}return null;};}function patchUpdates(_0x44309a){return function(_0x569dc){try{jsonpatch[_0xaed2('0x20')](_0x569dc,_0x44309a,!![]);}catch(_0x2547f9){return BPromise[_0xaed2('0x21')](_0x2547f9);}return _0x569dc['save']();};}function saveUpdates(_0x26db14,_0x5af0b0){return function(_0x159b90){if(_0x159b90){return _0x159b90[_0xaed2('0x22')](_0x26db14)[_0xaed2('0x23')](function(_0x24597e){return _0x24597e;});}return null;};}function removeEntity(_0x404321,_0x332ae6){return function(_0x423dda){if(_0x423dda){return _0x423dda['destroy']()[_0xaed2('0x23')](function(){_0x404321[_0xaed2('0x1a')](0xcc)[_0xaed2('0x1b')]();});}};}function handleEntityNotFound(_0x241252,_0x40a4be){return function(_0x3b805a){if(!_0x3b805a){_0x241252['sendStatus'](0x194);}return _0x3b805a;};}function handleError(_0x1b5e68,_0x36e5f3){_0x36e5f3=_0x36e5f3||0x1f4;return function(_0x1ba7f9){logger['error'](_0x1ba7f9[_0xaed2('0x24')]);if(_0x1ba7f9['name']){delete _0x1ba7f9['name'];}_0x1b5e68['status'](_0x36e5f3)[_0xaed2('0x25')](_0x1ba7f9);};}var utilLicense=require(_0xaed2('0x26'));exports[_0xaed2('0x27')]=function(_0x254a78,_0x13828a){var _0x3ef99a={'raw':!![],'where':{'id':0x1}},_0x238572={};_0x238572['model']=_[_0xaed2('0x28')](db[_0xaed2('0x29')][_0xaed2('0x2a')]);_0x238572[_0xaed2('0x2b')]=_[_0xaed2('0x28')](_0x254a78['query']);_0x238572[_0xaed2('0x2c')]=_[_0xaed2('0x2d')](_0x238572[_0xaed2('0x2e')],_0x238572['query']);_0x3ef99a['attributes']=_[_0xaed2('0x2d')](_0x238572['model'],qs[_0xaed2('0x2f')](_0x254a78[_0xaed2('0x2b')]['fields']));_0x3ef99a[_0xaed2('0x30')]=_0x3ef99a[_0xaed2('0x30')][_0xaed2('0x31')]?_0x3ef99a[_0xaed2('0x30')]:_0x238572[_0xaed2('0x2e')];_0x3ef99a=_[_0xaed2('0x32')]({},_0x3ef99a,_0x254a78[_0xaed2('0x33')]);return utilLicense[_0xaed2('0x34')](_0x3ef99a)[_0xaed2('0x23')](respondWithResult(_0x13828a,null))['catch'](handleError(_0x13828a,null));};exports['update']=function(_0x2bd4f2,_0x1124f8){if(_0x2bd4f2['body']['id']){delete _0x2bd4f2[_0xaed2('0x35')]['id'];}return db['License'][_0xaed2('0x36')]({'where':{'id':_0x2bd4f2[_0xaed2('0x37')]['id']}})[_0xaed2('0x23')](handleEntityNotFound(_0x1124f8,null))[_0xaed2('0x23')](function(_0x146f16){var _0x14414c=_0x146f16['get']({'plain':!![]});return utilLicense[_0xaed2('0x38')](_0x14414c,_0x2bd4f2[_0xaed2('0x35')][_0xaed2('0x39')]);})[_0xaed2('0x23')](function(_0x545099){if(!_0x545099['demo']){return saveUpdates(_0x2bd4f2[_0xaed2('0x35')],null);}return _0x545099;})[_0xaed2('0x23')](respondWithResult(_0x1124f8,null))[_0xaed2('0x3a')](handleError(_0x1124f8,null));};exports[_0xaed2('0x3b')]=function(_0x126e07,_0x4e17d9){var _0x3b82e5=_0xaed2('0x3c');var _0xdc8655=path[_0xaed2('0x3d')](_0xaed2('0x3e'),_0xaed2('0x3f'),_0xaed2('0x40'),_0x3b82e5);_0x4e17d9[_0xaed2('0x41')](_0xaed2('0x42'),_0xaed2('0x43')+_0x3b82e5);_0x4e17d9[_0xaed2('0x44')]('Content-Type','text/plain');_0x4e17d9[_0xaed2('0x45')](_0xdc8655);}; \ No newline at end of file +var _0x2511=['keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','merge','catch','params','get','body','key','demo','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','name','send','index','model'];(function(_0x25a212,_0x9fcdee){var _0x6427c1=function(_0x5b7728){while(--_0x5b7728){_0x25a212['push'](_0x25a212['shift']());}};_0x6427c1(++_0x9fcdee);}(_0x2511,0x1e0));var _0x1251=function(_0x5a77fb,_0x2d2d59){_0x5a77fb=_0x5a77fb-0x0;var _0x6ca4fb=_0x2511[_0x5a77fb];return _0x6ca4fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1251('0x0'));var jsonpatch=require(_0x1251('0x1'));var rp=require(_0x1251('0x2'));var moment=require(_0x1251('0x3'));var BPromise=require(_0x1251('0x4'));var Mustache=require(_0x1251('0x5'));var util=require(_0x1251('0x6'));var path=require(_0x1251('0x7'));var sox=require(_0x1251('0x8'));var csv=require(_0x1251('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1251('0xa'));var jsforce=require(_0x1251('0xb'));var deskjs=require(_0x1251('0xc'));var toCsv=require(_0x1251('0x9'));var querystring=require(_0x1251('0xd'));var Papa=require(_0x1251('0xe'));var Redis=require(_0x1251('0xf'));var authService=require(_0x1251('0x10'));var qs=require(_0x1251('0x11'));var as=require(_0x1251('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1251('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1251('0x14'));var db=require(_0x1251('0x15'))['db'];function respondWithStatusCode(_0x51f54c,_0x2de1dc){_0x2de1dc=_0x2de1dc||0xcc;return function(_0x4196e9){if(_0x4196e9){return _0x51f54c['sendStatus'](_0x2de1dc);}return _0x51f54c[_0x1251('0x16')](_0x2de1dc)[_0x1251('0x17')]();};}function respondWithResult(_0x3ca480,_0x58ad21){_0x58ad21=_0x58ad21||0xc8;return function(_0x3b2814){if(_0x3b2814){return _0x3ca480[_0x1251('0x16')](_0x58ad21)[_0x1251('0x18')](_0x3b2814);}};}function respondWithFilteredResult(_0x47ef2d,_0x379be1){return function(_0x1a3b48){if(_0x1a3b48){var _0x554efc=typeof _0x379be1[_0x1251('0x19')]==='undefined'&&typeof _0x379be1[_0x1251('0x1a')]===_0x1251('0x1b');var _0x47ff2a=_0x1a3b48[_0x1251('0x1c')];var _0xd12e4f=_0x554efc?0x0:_0x379be1[_0x1251('0x19')];var _0x2aacdf=_0x554efc?_0x1a3b48[_0x1251('0x1c')]:_0x379be1['offset']+_0x379be1['limit'];var _0x423e83;if(_0x2aacdf>=_0x47ff2a){_0x2aacdf=_0x47ff2a;_0x423e83=0xc8;}else{_0x423e83=0xce;}_0x47ef2d['status'](_0x423e83);return _0x47ef2d[_0x1251('0x1d')]('Content-Range',_0xd12e4f+'-'+_0x2aacdf+'/'+_0x47ff2a)[_0x1251('0x18')](_0x1a3b48);}return null;};}function patchUpdates(_0x1e17f9){return function(_0x2ae8bc){try{jsonpatch[_0x1251('0x1e')](_0x2ae8bc,_0x1e17f9,!![]);}catch(_0x4d4589){return BPromise[_0x1251('0x1f')](_0x4d4589);}return _0x2ae8bc[_0x1251('0x20')]();};}function saveUpdates(_0x525b19,_0x5aa64d){return function(_0x568885){if(_0x568885){return _0x568885[_0x1251('0x21')](_0x525b19)[_0x1251('0x22')](function(_0x3b42ca){return _0x3b42ca;});}return null;};}function removeEntity(_0x16b5fd,_0x14a2de){return function(_0x415158){if(_0x415158){return _0x415158['destroy']()[_0x1251('0x22')](function(){_0x16b5fd[_0x1251('0x16')](0xcc)[_0x1251('0x17')]();});}};}function handleEntityNotFound(_0x5f35ab,_0x69c17e){return function(_0xc4f13f){if(!_0xc4f13f){_0x5f35ab[_0x1251('0x23')](0x194);}return _0xc4f13f;};}function handleError(_0x42b4d9,_0x477ad2){_0x477ad2=_0x477ad2||0x1f4;return function(_0x44b4c9){logger['error'](_0x44b4c9['stack']);if(_0x44b4c9[_0x1251('0x24')]){delete _0x44b4c9[_0x1251('0x24')];}_0x42b4d9[_0x1251('0x16')](_0x477ad2)[_0x1251('0x25')](_0x44b4c9);};}var utilLicense=require(_0x1251('0x14'));exports[_0x1251('0x26')]=function(_0x17c8ea,_0x147402){var _0xcfa112={'raw':!![],'where':{'id':0x1}},_0x37feac={};_0x37feac[_0x1251('0x27')]=_[_0x1251('0x28')](db[_0x1251('0x29')][_0x1251('0x2a')]);_0x37feac[_0x1251('0x2b')]=_[_0x1251('0x28')](_0x17c8ea[_0x1251('0x2b')]);_0x37feac[_0x1251('0x2c')]=_['intersection'](_0x37feac[_0x1251('0x27')],_0x37feac[_0x1251('0x2b')]);_0xcfa112[_0x1251('0x2d')]=_[_0x1251('0x2e')](_0x37feac[_0x1251('0x27')],qs[_0x1251('0x2f')](_0x17c8ea[_0x1251('0x2b')][_0x1251('0x2f')]));_0xcfa112[_0x1251('0x2d')]=_0xcfa112[_0x1251('0x2d')][_0x1251('0x30')]?_0xcfa112[_0x1251('0x2d')]:_0x37feac['model'];_0xcfa112=_[_0x1251('0x31')]({},_0xcfa112,_0x17c8ea['options']);return utilLicense['getLicense'](_0xcfa112)[_0x1251('0x22')](respondWithResult(_0x147402,null))[_0x1251('0x32')](handleError(_0x147402,null));};exports[_0x1251('0x21')]=function(_0x2d85a5,_0x5ef8f6){if(_0x2d85a5['body']['id']){delete _0x2d85a5['body']['id'];}return db[_0x1251('0x29')]['find']({'where':{'id':_0x2d85a5[_0x1251('0x33')]['id']}})[_0x1251('0x22')](handleEntityNotFound(_0x5ef8f6,null))[_0x1251('0x22')](function(_0x3a0432){var _0x4e33b1=_0x3a0432[_0x1251('0x34')]({'plain':!![]});return utilLicense['checkLicense'](_0x4e33b1,_0x2d85a5[_0x1251('0x35')][_0x1251('0x36')]);})[_0x1251('0x22')](function(_0x40a89e){if(!_0x40a89e[_0x1251('0x37')]){return saveUpdates(_0x2d85a5[_0x1251('0x35')],null);}return _0x40a89e;})[_0x1251('0x22')](respondWithResult(_0x5ef8f6,null))[_0x1251('0x32')](handleError(_0x5ef8f6,null));};exports[_0x1251('0x38')]=function(_0xd0713c,_0x60af4b){var _0x48a6ec='license-info.log';var _0x3dbb6e=path[_0x1251('0x39')](_0x1251('0x3a'),_0x1251('0x3b'),_0x1251('0x3c'),_0x48a6ec);_0x60af4b[_0x1251('0x3d')](_0x1251('0x3e'),_0x1251('0x3f')+_0x48a6ec);_0x60af4b[_0x1251('0x1d')]('Content-Type','text/plain');_0x60af4b[_0x1251('0x40')](_0x3dbb6e);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1faf487..6b499f8 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 _0x7f23=['path','../../config/environment','./license.attributes','exports','license','lodash','util','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f23,0x131));var _0x37f2=function(_0x4dc32f,_0x32437a){_0x4dc32f=_0x4dc32f-0x0;var _0x23bf25=_0x7f23[_0x4dc32f];return _0x23bf25;};'use strict';var _=require(_0x37f2('0x0'));var util=require(_0x37f2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x37f2('0x2'));var BPromise=require(_0x37f2('0x3'));var rp=require(_0x37f2('0x4'));var fs=require('fs');var path=require(_0x37f2('0x5'));var rimraf=require('rimraf');var config=require(_0x37f2('0x6'));var attributes=require(_0x37f2('0x7'));module[_0x37f2('0x8')]=function(_0x2f7bf,_0xdac558){return _0x2f7bf['define']('License',attributes,{'tableName':_0x37f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e9a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','lodash'];(function(_0x5767e3,_0x4b6121){var _0x433a07=function(_0x1a73ae){while(--_0x1a73ae){_0x5767e3['push'](_0x5767e3['shift']());}};_0x433a07(++_0x4b6121);}(_0x7e9a,0xdc));var _0xa7e9=function(_0x293d19,_0xd733c0){_0x293d19=_0x293d19-0x0;var _0x3c27b3=_0x7e9a[_0x293d19];return _0x3c27b3;};'use strict';var _=require(_0xa7e9('0x0'));var util=require(_0xa7e9('0x1'));var logger=require(_0xa7e9('0x2'))(_0xa7e9('0x3'));var moment=require(_0xa7e9('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7e9('0x5'));var fs=require('fs');var path=require(_0xa7e9('0x6'));var rimraf=require(_0xa7e9('0x7'));var config=require(_0xa7e9('0x8'));var attributes=require(_0xa7e9('0x9'));module[_0xa7e9('0xa')]=function(_0x131c88,_0x166a3a){return _0x131c88[_0xa7e9('0xb')](_0xa7e9('0xc'),attributes,{'tableName':'license','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 1e9e571..35ed7b8 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 _0xd822=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x53b76e,_0x209fe3){var _0x311645=function(_0x314846){while(--_0x314846){_0x53b76e['push'](_0x53b76e['shift']());}};_0x311645(++_0x209fe3);}(_0xd822,0xd1));var _0x2d82=function(_0x5b0c60,_0x10f29b){_0x5b0c60=_0x5b0c60-0x0;var _0x5683a6=_0xd822[_0x5b0c60];return _0x5683a6;};'use strict';var _=require(_0x2d82('0x0'));var util=require(_0x2d82('0x1'));var moment=require('moment');var BPromise=require(_0x2d82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d82('0x3'));var db=require(_0x2d82('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d82('0x5'))(_0x2d82('0x6'));var config=require(_0x2d82('0x7'));var jayson=require(_0x2d82('0x8'));var client=jayson[_0x2d82('0x9')][_0x2d82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b6a79,_0x179091,_0x1432b8){return new BPromise(function(_0x38b37b,_0x210ef6){return client['request'](_0x1b6a79,_0x1432b8)[_0x2d82('0xb')](function(_0x329171){logger[_0x2d82('0xc')](_0x2d82('0xd'),_0x179091,'request\x20sent');logger[_0x2d82('0xe')](_0x2d82('0xf'),_0x179091,_0x2d82('0x10'),JSON[_0x2d82('0x11')](_0x329171));if(_0x329171[_0x2d82('0x12')]){if(_0x329171[_0x2d82('0x12')][_0x2d82('0x13')]===0x1f4){logger[_0x2d82('0x12')](_0x2d82('0xd'),_0x179091,_0x329171[_0x2d82('0x12')]['message']);return _0x210ef6(_0x329171['error'][_0x2d82('0x14')]);}logger['error'](_0x2d82('0xd'),_0x179091,_0x329171[_0x2d82('0x12')][_0x2d82('0x14')]);return _0x38b37b(_0x329171[_0x2d82('0x12')]['message']);}else{logger[_0x2d82('0xc')](_0x2d82('0xd'),_0x179091,_0x2d82('0x10'));_0x38b37b(_0x329171[_0x2d82('0x15')]['message']);}})[_0x2d82('0x16')](function(_0x367e0a){logger[_0x2d82('0x12')]('License,\x20%s,\x20%s',_0x179091,_0x367e0a);_0x210ef6(_0x367e0a);});});} \ No newline at end of file +var _0x7714=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','License,\x20%s,\x20%s','info'];(function(_0x2ebb18,_0x2ca54c){var _0x3bb7b4=function(_0x2adc14){while(--_0x2adc14){_0x2ebb18['push'](_0x2ebb18['shift']());}};_0x3bb7b4(++_0x2ca54c);}(_0x7714,0x7a));var _0x4771=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7714[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x4771('0x0'));var util=require(_0x4771('0x1'));var moment=require(_0x4771('0x2'));var BPromise=require(_0x4771('0x3'));var rs=require(_0x4771('0x4'));var fs=require('fs');var Redis=require(_0x4771('0x5'));var db=require(_0x4771('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4771('0x7'))(_0x4771('0x8'));var config=require(_0x4771('0x9'));var jayson=require(_0x4771('0xa'));var client=jayson['client'][_0x4771('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f87ac,_0x26c024,_0x36597f){return new BPromise(function(_0x254c1d,_0x3cdd5c){return client['request'](_0x3f87ac,_0x36597f)[_0x4771('0xc')](function(_0x141fc1){logger['info']('License,\x20%s,\x20%s',_0x26c024,_0x4771('0xd'));logger[_0x4771('0xe')](_0x4771('0xf'),_0x26c024,'request\x20sent',JSON[_0x4771('0x10')](_0x141fc1));if(_0x141fc1[_0x4771('0x11')]){if(_0x141fc1[_0x4771('0x11')][_0x4771('0x12')]===0x1f4){logger[_0x4771('0x11')]('License,\x20%s,\x20%s',_0x26c024,_0x141fc1[_0x4771('0x11')]['message']);return _0x3cdd5c(_0x141fc1[_0x4771('0x11')][_0x4771('0x13')]);}logger['error'](_0x4771('0x14'),_0x26c024,_0x141fc1['error'][_0x4771('0x13')]);return _0x254c1d(_0x141fc1[_0x4771('0x11')][_0x4771('0x13')]);}else{logger[_0x4771('0x15')](_0x4771('0x14'),_0x26c024,_0x4771('0xd'));_0x254c1d(_0x141fc1[_0x4771('0x16')]['message']);}})[_0x4771('0x17')](function(_0x48935f){logger[_0x4771('0x11')]('License,\x20%s,\x20%s',_0x26c024,_0x48935f);_0x3cdd5c(_0x48935f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 63731ea..06925e1 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 _0x3716=['addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','send'];(function(_0x296c75,_0x2909e8){var _0x131aa5=function(_0x11be3f){while(--_0x11be3f){_0x296c75['push'](_0x296c75['shift']());}};_0x131aa5(++_0x2909e8);}(_0x3716,0xc6));var _0x6371=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x3716[_0x279d37];return _0x530173;};'use strict';var multer=require(_0x6371('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6371('0x1'));var express=require(_0x6371('0x2'));var router=express[_0x6371('0x3')]();var fs_extra=require(_0x6371('0x4'));var auth=require(_0x6371('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6371('0x6'));var controller=require(_0x6371('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6371('0x8')]);router[_0x6371('0x9')](_0x6371('0xa'),auth[_0x6371('0xb')](),controller['describe']);router[_0x6371('0x9')](_0x6371('0xc'),auth[_0x6371('0xb')](),controller[_0x6371('0xd')]);router[_0x6371('0x9')](_0x6371('0xe'),auth[_0x6371('0xb')](),controller['getDispositions']);router['get'](_0x6371('0xf'),auth[_0x6371('0xb')](),controller[_0x6371('0x10')]);router[_0x6371('0x9')](_0x6371('0x11'),auth['isAuthenticated'](),controller[_0x6371('0x12')]);router[_0x6371('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0x6371('0x9')](_0x6371('0x13'),auth[_0x6371('0xb')](),controller[_0x6371('0x14')]);router[_0x6371('0x9')](_0x6371('0x15'),auth[_0x6371('0xb')](),controller['getApplications']);router[_0x6371('0x9')](_0x6371('0x16'),auth[_0x6371('0xb')](),controller[_0x6371('0x17')]);router[_0x6371('0x9')](_0x6371('0x18'),auth['isAuthenticated'](),controller[_0x6371('0x19')]);router[_0x6371('0x9')](_0x6371('0x1a'),auth['isAuthenticated'](),controller[_0x6371('0x1b')]);router[_0x6371('0x1c')](_0x6371('0xe'),auth['isAuthenticated'](),controller[_0x6371('0x1d')]);router[_0x6371('0x1c')]('/:id/canned_answers',auth[_0x6371('0xb')](),controller[_0x6371('0x1e')]);router[_0x6371('0x1c')]('/',auth[_0x6371('0xb')](),controller['create']);router[_0x6371('0x1c')](_0x6371('0x11'),auth[_0x6371('0xb')](),controller[_0x6371('0x1f')]);router[_0x6371('0x1c')](_0x6371('0x20'),auth[_0x6371('0xb')](),controller['addSmtp']);router[_0x6371('0x1c')](_0x6371('0x13'),auth[_0x6371('0xb')](),controller[_0x6371('0x21')]);router['post'](_0x6371('0x15'),auth['isAuthenticated'](),controller[_0x6371('0x22')]);router[_0x6371('0x1c')](_0x6371('0x23'),auth['isAuthenticated'](),controller[_0x6371('0x24')]);router[_0x6371('0x1c')](_0x6371('0x1a'),auth['isAuthenticated'](),controller[_0x6371('0x25')]);router[_0x6371('0x26')]('/:id',auth[_0x6371('0xb')](),controller[_0x6371('0x27')]);router[_0x6371('0x28')]('/:id/dispositions',auth[_0x6371('0xb')](),controller['removeDispositions']);router[_0x6371('0x28')]('/:id/canned_answers',auth[_0x6371('0xb')](),controller[_0x6371('0x29')]);router[_0x6371('0x28')](_0x6371('0x11'),auth['isAuthenticated'](),controller[_0x6371('0x2a')]);router[_0x6371('0x28')](_0x6371('0x20'),auth['isAuthenticated'](),controller[_0x6371('0x2b')]);router['delete']('/:id',auth[_0x6371('0xb')](),controller[_0x6371('0x2c')]);router[_0x6371('0x28')](_0x6371('0x1a'),auth[_0x6371('0xb')](),controller[_0x6371('0x2d')]);module[_0x6371('0x2e')]=router; \ No newline at end of file +var _0x825a=['getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','/:id/users','post','addAnswer','addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','/:id/dispositions','/:id/canned_answers','/:id/in_servers','getSmtp','/:id/interactions'];(function(_0x4e88d9,_0x463dac){var _0x52611a=function(_0x574d22){while(--_0x574d22){_0x4e88d9['push'](_0x4e88d9['shift']());}};_0x52611a(++_0x463dac);}(_0x825a,0x10c));var _0xa825=function(_0x3ef8f7,_0x35359a){_0x3ef8f7=_0x3ef8f7-0x0;var _0x3b097e=_0x825a[_0x3ef8f7];return _0x3b097e;};'use strict';var multer=require(_0xa825('0x0'));var util=require('util');var path=require(_0xa825('0x1'));var timeout=require(_0xa825('0x2'));var express=require(_0xa825('0x3'));var router=express['Router']();var fs_extra=require(_0xa825('0x4'));var auth=require(_0xa825('0x5'));var interaction=require(_0xa825('0x6'));var config=require(_0xa825('0x7'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0xa825('0x8')](),controller[_0xa825('0x9')]);router['get'](_0xa825('0xa'),auth[_0xa825('0x8')](),controller[_0xa825('0xb')]);router[_0xa825('0xc')](_0xa825('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa825('0xc')](_0xa825('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xa825('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xa825('0xc')](_0xa825('0x10'),auth['isAuthenticated'](),controller['getImap']);router['get']('/:id/out_servers',auth[_0xa825('0x8')](),controller[_0xa825('0x11')]);router[_0xa825('0xc')](_0xa825('0x12'),auth[_0xa825('0x8')](),controller[_0xa825('0x13')]);router['get'](_0xa825('0x14'),auth[_0xa825('0x8')](),controller[_0xa825('0x15')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xa825('0x16')]);router[_0xa825('0xc')](_0xa825('0x17'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0xa825('0xc')](_0xa825('0x18'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa825('0x19')](_0xa825('0xe'),auth[_0xa825('0x8')](),controller['addDisposition']);router[_0xa825('0x19')]('/:id/canned_answers',auth[_0xa825('0x8')](),controller[_0xa825('0x1a')]);router['post']('/',auth[_0xa825('0x8')](),controller['create']);router[_0xa825('0x19')](_0xa825('0x10'),auth[_0xa825('0x8')](),controller[_0xa825('0x1b')]);router['post'](_0xa825('0x1c'),auth['isAuthenticated'](),controller['addSmtp']);router['post'](_0xa825('0x12'),auth['isAuthenticated'](),controller[_0xa825('0x1d')]);router[_0xa825('0x19')](_0xa825('0x14'),auth['isAuthenticated'](),controller[_0xa825('0x1e')]);router['post'](_0xa825('0x1f'),auth[_0xa825('0x8')](),controller[_0xa825('0x20')]);router[_0xa825('0x19')](_0xa825('0x18'),auth['isAuthenticated'](),controller[_0xa825('0x21')]);router[_0xa825('0x22')](_0xa825('0xd'),auth[_0xa825('0x8')](),controller['update']);router[_0xa825('0x23')](_0xa825('0xe'),auth[_0xa825('0x8')](),controller[_0xa825('0x24')]);router[_0xa825('0x23')](_0xa825('0xf'),auth[_0xa825('0x8')](),controller['removeAnswers']);router[_0xa825('0x23')](_0xa825('0x10'),auth[_0xa825('0x8')](),controller[_0xa825('0x25')]);router['delete'](_0xa825('0x1c'),auth[_0xa825('0x8')](),controller[_0xa825('0x26')]);router[_0xa825('0x23')](_0xa825('0xd'),auth[_0xa825('0x8')](),controller['destroy']);router[_0xa825('0x23')](_0xa825('0x18'),auth[_0xa825('0x8')](),controller[_0xa825('0x27')]);module[_0xa825('0x28')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a43e232..b7546b0 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 _0x771b=['provider','custom','sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','yahoo','outlook365','getDataValue'];(function(_0x4510dc,_0x5431ac){var _0x319934=function(_0x57fcb1){while(--_0x57fcb1){_0x4510dc['push'](_0x4510dc['shift']());}};_0x319934(++_0x5431ac);}(_0x771b,0x1ab));var _0xb771=function(_0x3b5e9d,_0x5970dc){_0x3b5e9d=_0x3b5e9d-0x0;var _0x44681d=_0x771b[_0x3b5e9d];return _0x44681d;};'use strict';var Sequelize=require(_0xb771('0x0'));module[_0xb771('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb771('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xb771('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0xb771('0x4')]},'markAsUnread':{'type':Sequelize[_0xb771('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb771('0x3')],'allowNull':![],'defaultValue':_0xb771('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb771('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xb771('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb771('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb771('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb771('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb771('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb771('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x693a37){if(!_0x693a37)this[_0xb771('0x8')](_0xb771('0x9'),null);this['setDataValue'](_0xb771('0xa'),_0x693a37);}},'provider':{'type':Sequelize['ENUM'](_0xb771('0xb'),'hotmail',_0xb771('0xc'),_0xb771('0xd')),'defaultValue':null,'get':function(){var _0x25b7a1=this[_0xb771('0xe')](_0xb771('0xf'));return _0x25b7a1||_0xb771('0x10');},'set':function(_0x1656ea){if(_0x1656ea===_0xb771('0x10')){_0x1656ea=null;}return this[_0xb771('0x8')](_0xb771('0xf'),_0x1656ea);}}}; \ No newline at end of file +var _0x36be=['Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x34109c,_0x40e4b8){var _0x540d2d=function(_0x1e4d34){while(--_0x1e4d34){_0x34109c['push'](_0x34109c['shift']());}};_0x540d2d(++_0x40e4b8);}(_0x36be,0xab));var _0xe36b=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x36be[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xe36b('0x0'));module[_0xe36b('0x1')]={'description':{'type':Sequelize[_0xe36b('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xe36b('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe36b('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xe36b('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe36b('0x2')],'allowNull':![],'defaultValue':_0xe36b('0x5')},'fontSize':{'type':Sequelize[_0xe36b('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe36b('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe36b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe36b('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe36b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe36b('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe36b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe36b('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xe36b('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xe36b('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b0fac){if(!_0x1b0fac)this[_0xe36b('0x8')]('mandatoryDispositionPauseId',null);this[_0xe36b('0x8')]('mandatoryDisposition',_0x1b0fac);}},'provider':{'type':Sequelize['ENUM'](_0xe36b('0x9'),_0xe36b('0xa'),_0xe36b('0xb'),_0xe36b('0xc')),'defaultValue':null,'get':function(){var _0x40660b=this[_0xe36b('0xd')](_0xe36b('0xe'));return _0x40660b||'custom';},'set':function(_0x3cc787){if(_0x3cc787===_0xe36b('0xf')){_0x3cc787=null;}return this['setDataValue'](_0xe36b('0xe'),_0x3cc787);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 76ee461..aac5131 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 _0x128e=['destroy','get','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','MailAccount','findAll','rows','show','params','mandatoryDispositionPause','find','catch','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','removeAnswers','create','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','messageId','from','subject','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','moment','bluebird','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','update'];(function(_0xab8465,_0x3c5ebd){var _0x5551ac=function(_0x2150fd){while(--_0x2150fd){_0xab8465['push'](_0xab8465['shift']());}};_0x5551ac(++_0x3c5ebd);}(_0x128e,0x15d));var _0xe128=function(_0x19bd67,_0x36a677){_0x19bd67=_0x19bd67-0x0;var _0x46f227=_0x128e[_0x19bd67];return _0x46f227;};'use strict';var moment=require(_0xe128('0x0'));var BPromise=require(_0xe128('0x1'));var util=require('util');var path=require('path');var _=require(_0xe128('0x2'));var juice=require(_0xe128('0x3'));var Redis=require('ioredis');var qs=require(_0xe128('0x4'));var logger=require(_0xe128('0x5'))(_0xe128('0x6'));var config=require('../../config/environment');var db=require(_0xe128('0x7'))['db'];config[_0xe128('0x8')]=_[_0xe128('0x9')](config[_0xe128('0x8')],{'host':_0xe128('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe128('0xb'))['register'](socket);var jayson=require(_0xe128('0xc'));var client=jayson[_0xe128('0xd')]['http']({'port':0x232b});function respondWithRpcPromise(_0xb3a3d6,_0x2e2261,_0x2cd119,_0x286833){return new BPromise(function(_0x4da0fd,_0x420872){var _0x3325fa=_0x286833||client;return _0x3325fa[_0xe128('0xe')](_0xb3a3d6,_0x2cd119)[_0xe128('0xf')](function(_0x3e2ec5){logger[_0xe128('0x10')](_0xe128('0x11'),_0x2e2261,'request\x20sent');logger[_0xe128('0x12')](_0xe128('0x13'),_0x2e2261,_0xe128('0x14'),JSON['stringify'](_0x3e2ec5));if(_0x3e2ec5[_0xe128('0x15')]){if(_0x3e2ec5[_0xe128('0x15')][_0xe128('0x16')]===0x1f4){logger['error'](_0xe128('0x11'),_0x2e2261,_0x3e2ec5[_0xe128('0x15')][_0xe128('0x17')]);return _0x420872(_0x3e2ec5[_0xe128('0x15')][_0xe128('0x17')]);}logger[_0xe128('0x15')](_0xe128('0x11'),_0x2e2261,_0x3e2ec5['error']['message']);return _0x4da0fd(_0x3e2ec5[_0xe128('0x15')][_0xe128('0x17')]);}else{logger[_0xe128('0x10')]('MailAccount,\x20%s,\x20%s',_0x2e2261,_0xe128('0x14'));_0x4da0fd(_0x3e2ec5[_0xe128('0x18')][_0xe128('0x17')]);}})['catch'](function(_0x15a2ec){logger[_0xe128('0x15')](_0xe128('0x11'),_0x2e2261,_0x15a2ec);_0x420872(_0x15a2ec);});});}function respondWithStatusCode(_0x49a6d5,_0x459034){_0x459034=_0x459034||0xcc;return function(_0x5d86e3){if(_0x5d86e3){return _0x49a6d5[_0xe128('0x19')](_0x459034);}return _0x49a6d5[_0xe128('0x1a')](_0x459034)[_0xe128('0x1b')]();};}function respondWithResult(_0x4fda6f,_0x14aee1){_0x14aee1=_0x14aee1||0xc8;return function(_0x1243da){if(_0x1243da){return _0x4fda6f['status'](_0x14aee1)[_0xe128('0x1c')](_0x1243da);}};}function respondWithFilteredResult(_0x2ec255,_0x48053f){return function(_0x522c45){if(_0x522c45){var _0x194d3b=typeof _0x48053f[_0xe128('0x1d')]===_0xe128('0x1e')&&typeof _0x48053f[_0xe128('0x1f')]===_0xe128('0x1e');var _0x321944=_0x522c45[_0xe128('0x20')];var _0xe670ca=_0x194d3b?0x0:_0x48053f[_0xe128('0x1d')];var _0x394ca6=_0x194d3b?_0x522c45[_0xe128('0x20')]:_0x48053f[_0xe128('0x1d')]+_0x48053f[_0xe128('0x1f')];var _0x2e13c3;if(_0x394ca6>=_0x321944){_0x394ca6=_0x321944;_0x2e13c3=0xc8;}else{_0x2e13c3=0xce;}_0x2ec255[_0xe128('0x1a')](_0x2e13c3);return _0x2ec255[_0xe128('0x21')]('Content-Range',_0xe670ca+'-'+_0x394ca6+'/'+_0x321944)[_0xe128('0x1c')](_0x522c45);}return null;};}function saveUpdates(_0x210ddf){return function(_0x20bf9b){if(_0x20bf9b){return _0x20bf9b[_0xe128('0x22')](_0x210ddf)['then'](function(_0x165bef){return _0x165bef;});}return null;};}function removeEntity(_0x260002){return function(_0xc4b4d6){if(_0xc4b4d6){return _0xc4b4d6[_0xe128('0x23')]()[_0xe128('0xf')](function(){var _0x52366e=_0xc4b4d6[_0xe128('0x24')]({'plain':!![]});var _0x5b40f6=_0xe128('0x25');return db[_0xe128('0x26')]['destroy']({'where':{'type':_0x5b40f6,'resourceId':_0x52366e['id']}})[_0xe128('0xf')](function(){return _0xc4b4d6;});})[_0xe128('0xf')](function(){_0x260002[_0xe128('0x1a')](0xcc)[_0xe128('0x1b')]();});}};}function handleEntityNotFound(_0x50e00a){return function(_0x407317){if(!_0x407317){_0x50e00a[_0xe128('0x19')](0x194);}return _0x407317;};}function handleError(_0x51240b,_0x42d043){_0x42d043=_0x42d043||0x1f4;return function(_0x1df891){logger['error'](_0x1df891['stack']);if(_0x1df891['name']){delete _0x1df891[_0xe128('0x27')];}_0x51240b[_0xe128('0x1a')](_0x42d043)[_0xe128('0x28')](_0x1df891);};}function getImapHost(_0x39417a){switch(_0x39417a){case _0xe128('0x29'):return _0xe128('0x2a');case _0xe128('0x2b'):return _0xe128('0x2c');case _0xe128('0x2d'):return _0xe128('0x2e');case _0xe128('0x2f'):return'outlook.office365.com';}throw new Error(_0xe128('0x30'),_0x39417a);}function getSmtpHost(_0x12047a){switch(_0x12047a){case _0xe128('0x29'):return _0xe128('0x31');case'yahoo':return _0xe128('0x32');case _0xe128('0x2d'):return _0xe128('0x33');case'outlook365':return'smtp.office365.com';}throw new Error(_0xe128('0x30'),_0x12047a);}function getAuthenticationOptions(_0x5ec983,_0x2b201d){var _0x24e1e9={};var _0x6ca82={};if(_0x5ec983){_0x24e1e9[_0xe128('0x34')]=_0x6ca82[_0xe128('0x34')]=_0x2b201d[_0xe128('0x35')];_0x24e1e9[_0xe128('0x36')]=_0x6ca82[_0xe128('0x37')]=_0x2b201d[_0xe128('0x36')];if(_0x2b201d[_0xe128('0x38')]){_0x24e1e9[_0xe128('0x38')]=_0x6ca82[_0xe128('0x38')]=!![];_0x24e1e9[_0xe128('0x39')]=_0x6ca82[_0xe128('0x39')]=_0x2b201d[_0xe128('0x39')];_0x24e1e9[_0xe128('0x36')]=_0x6ca82['pass']=null;}else{_0x24e1e9[_0xe128('0x39')]=_0x6ca82[_0xe128('0x39')]=null;}_0x24e1e9[_0xe128('0x3a')]=getImapHost(_0x5ec983);_0x24e1e9[_0xe128('0x3b')]=0x3e1;_0x6ca82[_0xe128('0x3a')]=getSmtpHost(_0x5ec983);_0x6ca82[_0xe128('0x3b')]=0x24b;_0x6ca82[_0xe128('0x3c')]=![];_0x24e1e9[_0xe128('0x3d')]=_0x6ca82['service']=null;}else{if(_0x2b201d[_0xe128('0x3e')]){_0x24e1e9['user']=_0x6ca82['user']=_0x2b201d[_0xe128('0x35')];_0x24e1e9[_0xe128('0x36')]=_0x6ca82[_0xe128('0x37')]=_0x2b201d['password'];}else{_0x24e1e9[_0xe128('0x3e')]=_0x6ca82['authentication']=![];_0x24e1e9['user']=_0x6ca82[_0xe128('0x34')]=null;_0x24e1e9['password']=_0x6ca82[_0xe128('0x37')]=null;}_0x24e1e9[_0xe128('0x3a')]=_0x2b201d['Imap'][_0xe128('0x3a')];_0x24e1e9[_0xe128('0x3b')]=_0x2b201d[_0xe128('0x3f')][_0xe128('0x3b')];_0x6ca82[_0xe128('0x3a')]=_0x2b201d[_0xe128('0x40')][_0xe128('0x3a')];_0x6ca82[_0xe128('0x3b')]=_0x2b201d[_0xe128('0x40')][_0xe128('0x3b')];}return{'Imap':_0x24e1e9,'Smtp':_0x6ca82};}exports['index']=function(_0x310709,_0xe29b3f){var _0x142b12={'include':[{'model':db[_0xe128('0x41')],'as':_0xe128('0x3f')},{'model':db[_0xe128('0x42')],'as':_0xe128('0x40')},{'model':db[_0xe128('0x43')],'as':'mandatoryDispositionPause'}]},_0x3cccba={},_0x5294d5={'count':0x0,'rows':[]};var _0x1b87d8=_[_0xe128('0x44')](db['MailAccount'][_0xe128('0x45')],function(_0xa4ae6d){return{'name':_0xa4ae6d[_0xe128('0x46')],'type':_0xa4ae6d[_0xe128('0x47')][_0xe128('0x48')]};});_0x3cccba['model']=_[_0xe128('0x44')](_0x1b87d8,_0xe128('0x27'));_0x3cccba[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x310709['query']);_0x3cccba['filters']=_[_0xe128('0x4b')](_0x3cccba['model'],_0x3cccba[_0xe128('0x49')]);_0x142b12[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x3cccba[_0xe128('0x4d')],qs[_0xe128('0x4e')](_0x310709[_0xe128('0x49')][_0xe128('0x4e')]));_0x142b12[_0xe128('0x4c')]=_0x142b12[_0xe128('0x4c')][_0xe128('0x4f')]?_0x142b12['attributes']:_0x3cccba[_0xe128('0x4d')];if(!_0x310709['query'][_0xe128('0x50')](_0xe128('0x51'))){_0x142b12[_0xe128('0x1f')]=qs[_0xe128('0x1f')](_0x310709[_0xe128('0x49')][_0xe128('0x1f')]);_0x142b12[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0x310709['query']['offset']);}_0x142b12[_0xe128('0x52')]=qs['sort'](_0x310709[_0xe128('0x49')][_0xe128('0x53')]);_0x142b12[_0xe128('0x54')]=qs[_0xe128('0x55')](_['pick'](_0x310709[_0xe128('0x49')],_0x3cccba['filters']),_0x1b87d8);if(_0x310709[_0xe128('0x49')]['filter']){_0x142b12[_0xe128('0x54')]=_['merge'](_0x142b12[_0xe128('0x54')],{'$or':_['map'](_0x1b87d8,function(_0x5b2e19){if(_0x5b2e19['type']!=='VIRTUAL'){var _0x517ed5={};_0x517ed5[_0x5b2e19[_0xe128('0x27')]]={'$like':'%'+_0x310709[_0xe128('0x49')][_0xe128('0x56')]+'%'};return _0x517ed5;}})});}_0x142b12=_[_0xe128('0x57')]({},_0x142b12,_0x310709[_0xe128('0x58')]);var _0x3718db={'where':_0x142b12[_0xe128('0x54')]};return db['MailAccount'][_0xe128('0x20')](_0x3718db)[_0xe128('0xf')](function(_0x2ba924){_0x5294d5[_0xe128('0x20')]=_0x2ba924;if(_0x310709['query'][_0xe128('0x59')]){_0x142b12[_0xe128('0x5a')]=[{'all':!![]}];}return db[_0xe128('0x5b')][_0xe128('0x5c')](_0x142b12);})[_0xe128('0xf')](function(_0xd2815c){_0x5294d5[_0xe128('0x5d')]=_0xd2815c;return _0x5294d5;})['then'](respondWithFilteredResult(_0xe29b3f,_0x142b12))['catch'](handleError(_0xe29b3f,null));};exports[_0xe128('0x5e')]=function(_0x4d1a4e,_0x4fa480){var _0xf8a883={'raw':![],'where':{'id':_0x4d1a4e[_0xe128('0x5f')]['id']},'include':[{'model':db[_0xe128('0x41')],'as':_0xe128('0x3f')},{'model':db['MailServerOut'],'as':_0xe128('0x40')},{'model':db['Pause'],'as':_0xe128('0x60')}]},_0x5e1bbb={};_0x5e1bbb[_0xe128('0x4d')]=_[_0xe128('0x4a')](db['MailAccount'][_0xe128('0x45')]);_0x5e1bbb[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x4d1a4e[_0xe128('0x49')]);_0x5e1bbb['filters']=_['intersection'](_0x5e1bbb[_0xe128('0x4d')],_0x5e1bbb[_0xe128('0x49')]);_0xf8a883[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x5e1bbb[_0xe128('0x4d')],qs[_0xe128('0x4e')](_0x4d1a4e[_0xe128('0x49')][_0xe128('0x4e')]));_0xf8a883['attributes']=_0xf8a883[_0xe128('0x4c')][_0xe128('0x4f')]?_0xf8a883[_0xe128('0x4c')]:_0x5e1bbb[_0xe128('0x4d')];if(_0x4d1a4e['query']['includeAll']){_0xf8a883[_0xe128('0x5a')]=[{'all':!![]}];}_0xf8a883=_['merge']({},_0xf8a883,_0x4d1a4e['options']);return db[_0xe128('0x5b')][_0xe128('0x61')](_0xf8a883)[_0xe128('0xf')](handleEntityNotFound(_0x4fa480,null))[_0xe128('0xf')](respondWithResult(_0x4fa480,null))[_0xe128('0x62')](handleError(_0x4fa480,null));};exports[_0xe128('0x22')]=function(_0x5cce68,_0x5a16d8){if(_0x5cce68[_0xe128('0x63')]['id']){delete _0x5cce68['body']['id'];}var _0x2ac64f=_0x5cce68['body'][_0xe128('0x64')]===_0xe128('0x65')?null:_0x5cce68[_0xe128('0x63')]['provider'];var _0x48e95d=_0x5cce68['body'][_0xe128('0x3f')]||{};var _0x2916d8=_0x5cce68[_0xe128('0x63')][_0xe128('0x40')]||{};if(_0x2ac64f){_0x48e95d[_0xe128('0x3a')]=getImapHost(_0x2ac64f);_0x48e95d[_0xe128('0x3b')]=0x3e1;_0x2916d8[_0xe128('0x3a')]=getSmtpHost(_0x2ac64f);_0x2916d8['port']=0x24b;_0x2916d8[_0xe128('0x3c')]=![];}if(_0x2916d8['modernAuthentication']){_0x2916d8[_0xe128('0x3c')]=![];}else{_0x2916d8['CloudProviderId']=null;}if(!_0x48e95d[_0xe128('0x38')])_0x48e95d[_0xe128('0x39')]=null;_0x5cce68[_0xe128('0x63')][_0xe128('0x3f')]=_0x48e95d;_0x5cce68[_0xe128('0x63')][_0xe128('0x40')]=_0x2916d8;return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x5cce68['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xe128('0x3f')},{'model':db[_0xe128('0x42')],'as':'Smtp'},{'model':db[_0xe128('0x43')],'as':_0xe128('0x60')}]})['then'](handleEntityNotFound(_0x5a16d8,null))[_0xe128('0xf')](function(_0x5b6f87){if(!_0x5b6f87)throw new Error(_0xe128('0x66'));if(_0x5b6f87[_0xe128('0x3d')])delete _0x5cce68[_0xe128('0x63')][_0xe128('0x3f')];return _0x5b6f87;})[_0xe128('0xf')](saveUpdates(_0x5cce68[_0xe128('0x63')],null))['then'](function(_0x199d74){if(!_0x5cce68[_0xe128('0x63')][_0xe128('0x3f')])return _0x199d74;return db[_0xe128('0x41')][_0xe128('0x22')](_0x5cce68[_0xe128('0x63')][_0xe128('0x3f')],{'where':{'MailAccountId':_0x199d74['id']}})[_0xe128('0xf')](function(){return _0x199d74;});})[_0xe128('0xf')](function(_0x3a2122){if(!_0x5cce68[_0xe128('0x63')][_0xe128('0x40')])return _0x3a2122;return db[_0xe128('0x42')][_0xe128('0x22')](_0x5cce68['body'][_0xe128('0x40')],{'where':{'MailAccountId':_0x3a2122['id']}})[_0xe128('0xf')](function(){return _0x3a2122;});})[_0xe128('0xf')](respondWithResult(_0x5a16d8,null))[_0xe128('0x62')](handleError(_0x5a16d8,null));};exports[_0xe128('0x67')]=function(_0x1bc3a2,_0x2867c2){return db[_0xe128('0x5b')][_0xe128('0x67')]()[_0xe128('0xf')](respondWithResult(_0x2867c2,null))[_0xe128('0x62')](handleError(_0x2867c2,null));};exports[_0xe128('0x68')]=function(_0x159b88,_0x4fa9d9){if(_0x159b88[_0xe128('0x63')]['id']){delete _0x159b88['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x159b88[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x4fa9d9,null))['then'](function(_0x5f1564){if(_0x5f1564){_0x159b88[_0xe128('0x63')]['MailAccountId']=_0x5f1564['id'];return db[_0xe128('0x69')]['create'](_0x159b88['body']);}})[_0xe128('0xf')](respondWithResult(_0x4fa9d9,null))[_0xe128('0x62')](handleError(_0x4fa9d9,null));};exports[_0xe128('0x6a')]=function(_0x243378,_0x3df590){var _0x3c8da4={'raw':![],'where':{}};var _0xb1498a={};var _0x5e93fb={'count':0x0,'rows':[]};return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0x243378[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x3df590,null))[_0xe128('0xf')](function(_0x3ce85d){if(_0x3ce85d){_0xb1498a['model']=_['keys'](db[_0xe128('0x69')][_0xe128('0x45')]);_0xb1498a[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x243378['query']);_0xb1498a[_0xe128('0x55')]=_[_0xe128('0x4b')](_0xb1498a['model'],_0xb1498a[_0xe128('0x49')]);_0x3c8da4[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0xb1498a['model'],qs[_0xe128('0x4e')](_0x243378[_0xe128('0x49')][_0xe128('0x4e')]));_0x3c8da4[_0xe128('0x4c')]=_0x3c8da4[_0xe128('0x4c')][_0xe128('0x4f')]?_0x3c8da4['attributes']:_0xb1498a['model'];if(!_0x243378[_0xe128('0x49')][_0xe128('0x50')]('nolimit')){_0x3c8da4[_0xe128('0x1f')]=qs[_0xe128('0x1f')](_0x243378['query'][_0xe128('0x1f')]);_0x3c8da4[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0x243378['query'][_0xe128('0x1d')]);}_0x3c8da4[_0xe128('0x52')]=qs[_0xe128('0x53')](_0x243378[_0xe128('0x49')][_0xe128('0x53')]);_0x3c8da4[_0xe128('0x54')]=qs['filters'](_[_0xe128('0x6c')](_0x243378[_0xe128('0x49')],_0xb1498a[_0xe128('0x55')]));_0x3c8da4[_0xe128('0x54')]['MailAccountId']=_0x3ce85d['id'];if(_0x243378['query']['filter']){_0x3c8da4[_0xe128('0x54')]=_[_0xe128('0x57')](_0x3c8da4[_0xe128('0x54')],{'$or':_['map'](_0x3c8da4[_0xe128('0x4c')],function(_0x4de7e2){var _0x10619e={};_0x10619e[_0x4de7e2]={'$like':'%'+_0x243378['query']['filter']+'%'};return _0x10619e;})});}_0x3c8da4=_[_0xe128('0x57')]({},_0x3c8da4,_0x243378[_0xe128('0x58')]);return db[_0xe128('0x69')]['count']({'where':_0x3c8da4[_0xe128('0x54')]})[_0xe128('0xf')](function(_0x3587ab){_0x5e93fb[_0xe128('0x20')]=_0x3587ab;if(_0x243378[_0xe128('0x49')][_0xe128('0x59')]){_0x3c8da4[_0xe128('0x5a')]=[{'all':!![]}];}return db[_0xe128('0x69')][_0xe128('0x5c')](_0x3c8da4);})[_0xe128('0xf')](function(_0x6628b8){_0x5e93fb['rows']=_0x6628b8;return _0x5e93fb;});}})[_0xe128('0xf')](respondWithFilteredResult(_0x3df590,_0x3c8da4))[_0xe128('0x62')](handleError(_0x3df590,null));};exports[_0xe128('0x6d')]=function(_0x40884a,_0x273b68){return db[_0xe128('0x5b')]['find']({'where':{'id':_0x40884a[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x273b68,null))['then'](function(_0x136dbd){if(_0x136dbd){return _0x136dbd[_0xe128('0x6d')](_0x40884a[_0xe128('0x49')][_0xe128('0x6e')]);}})[_0xe128('0xf')](respondWithStatusCode(_0x273b68,null))['catch'](handleError(_0x273b68,null));};exports[_0xe128('0x6f')]=function(_0x431f3c,_0x189d07){if(_0x431f3c[_0xe128('0x63')]['id']){delete _0x431f3c[_0xe128('0x63')]['id'];}return db[_0xe128('0x5b')]['find']({'where':{'id':_0x431f3c[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x189d07,null))[_0xe128('0xf')](function(_0x1a1282){if(_0x1a1282){_0x431f3c[_0xe128('0x63')][_0xe128('0x70')]=_0x1a1282['id'];return db[_0xe128('0x71')]['create'](_0x431f3c['body']);}})[_0xe128('0xf')](respondWithResult(_0x189d07,null))[_0xe128('0x62')](handleError(_0x189d07,null));};exports[_0xe128('0x72')]=function(_0xa84dfd,_0x189ef5){var _0x186b42={'raw':![],'where':{}};var _0x4687cc={};var _0x59136f={'count':0x0,'rows':[]};return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0xa84dfd['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x189ef5,null))[_0xe128('0xf')](function(_0x21552f){if(_0x21552f){_0x4687cc[_0xe128('0x4d')]=_[_0xe128('0x4a')](db['CannedAnswer'][_0xe128('0x45')]);_0x4687cc[_0xe128('0x49')]=_['keys'](_0xa84dfd[_0xe128('0x49')]);_0x4687cc[_0xe128('0x55')]=_[_0xe128('0x4b')](_0x4687cc[_0xe128('0x4d')],_0x4687cc[_0xe128('0x49')]);_0x186b42['attributes']=_['intersection'](_0x4687cc['model'],qs['fields'](_0xa84dfd[_0xe128('0x49')][_0xe128('0x4e')]));_0x186b42[_0xe128('0x4c')]=_0x186b42[_0xe128('0x4c')][_0xe128('0x4f')]?_0x186b42[_0xe128('0x4c')]:_0x4687cc[_0xe128('0x4d')];if(!_0xa84dfd[_0xe128('0x49')][_0xe128('0x50')](_0xe128('0x51'))){_0x186b42[_0xe128('0x1f')]=qs[_0xe128('0x1f')](_0xa84dfd[_0xe128('0x49')][_0xe128('0x1f')]);_0x186b42['offset']=qs[_0xe128('0x1d')](_0xa84dfd[_0xe128('0x49')][_0xe128('0x1d')]);}_0x186b42['order']=qs[_0xe128('0x53')](_0xa84dfd[_0xe128('0x49')]['sort']);_0x186b42[_0xe128('0x54')]=qs[_0xe128('0x55')](_[_0xe128('0x6c')](_0xa84dfd['query'],_0x4687cc[_0xe128('0x55')]));_0x186b42['where'][_0xe128('0x70')]=_0x21552f['id'];if(_0xa84dfd['query'][_0xe128('0x56')]){_0x186b42[_0xe128('0x54')]=_[_0xe128('0x57')](_0x186b42[_0xe128('0x54')],{'$or':_[_0xe128('0x44')](_0x186b42['attributes'],function(_0x51ffe2){var _0x39afea={};_0x39afea[_0x51ffe2]={'$like':'%'+_0xa84dfd[_0xe128('0x49')]['filter']+'%'};return _0x39afea;})});}_0x186b42=_['merge']({},_0x186b42,_0xa84dfd['options']);return db[_0xe128('0x71')][_0xe128('0x20')]({'where':_0x186b42[_0xe128('0x54')]})[_0xe128('0xf')](function(_0x55ea16){_0x59136f['count']=_0x55ea16;if(_0xa84dfd[_0xe128('0x49')][_0xe128('0x59')]){_0x186b42[_0xe128('0x5a')]=[{'all':!![]}];}return db[_0xe128('0x71')][_0xe128('0x5c')](_0x186b42);})[_0xe128('0xf')](function(_0x1ad6a6){_0x59136f[_0xe128('0x5d')]=_0x1ad6a6;return _0x59136f;});}})[_0xe128('0xf')](respondWithFilteredResult(_0x189ef5,_0x186b42))['catch'](handleError(_0x189ef5,null));};exports[_0xe128('0x73')]=function(_0x36e97a,_0x30533f){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x36e97a[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x30533f,null))[_0xe128('0xf')](function(_0x3be720){if(_0x3be720){return _0x3be720['removeAnswers'](_0x36e97a['query'][_0xe128('0x6e')]);}})['then'](respondWithStatusCode(_0x30533f,null))[_0xe128('0x62')](handleError(_0x30533f,null));};exports[_0xe128('0x74')]=function(_0x479d65,_0x5da536){var _0x404b43={'name':_0x479d65[_0xe128('0x63')]['name'],'key':_0x479d65[_0xe128('0x63')][_0xe128('0x48')],'provider':_0x479d65['body'][_0xe128('0x64')]===_0xe128('0x65')?null:_0x479d65['body'][_0xe128('0x64')],'email':_0x479d65[_0xe128('0x63')][_0xe128('0x75')],'ListId':_0x479d65['body'][_0xe128('0x76')],'active':!_[_0xe128('0x77')](_0x479d65[_0xe128('0x63')][_0xe128('0x78')])?_0x479d65[_0xe128('0x63')][_0xe128('0x78')]:!![],'description':_0x479d65[_0xe128('0x63')][_0xe128('0x79')]||null};var _0xe588aa=getAuthenticationOptions(_0x404b43['provider'],_0x479d65['body']);_0x404b43[_0xe128('0x3f')]=_0xe588aa[_0xe128('0x3f')];_0x404b43['Smtp']=_0xe588aa['Smtp'];return db[_0xe128('0x5b')]['create'](_0x404b43,{'include':[{'model':db['MailServerOut'],'as':_0xe128('0x40')},{'model':db['MailServerIn'],'as':_0xe128('0x3f')}]})[_0xe128('0xf')](function(_0x2decb2){var _0x2944ba=_0x479d65[_0xe128('0x34')][_0xe128('0x24')]({'plain':!![]});if(!_0x2944ba)throw new Error(_0xe128('0x7a'));if(_0x2944ba[_0xe128('0x7b')]==='user'){var _0x5503fc=_0x2decb2[_0xe128('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xe128('0x61')]({'where':{'name':_0xe128('0x25'),'userProfileId':_0x2944ba[_0xe128('0x7c')]},'raw':!![]})[_0xe128('0xf')](function(_0x1ea0ee){if(_0x1ea0ee&&_0x1ea0ee[_0xe128('0x7d')]===0x0){return db[_0xe128('0x26')][_0xe128('0x74')]({'name':_0x5503fc[_0xe128('0x27')],'resourceId':_0x5503fc['id'],'type':_0x1ea0ee[_0xe128('0x27')],'sectionId':_0x1ea0ee['id']},{})[_0xe128('0xf')](function(){return _0x2decb2;});}else{return _0x2decb2;}})['catch'](function(_0x592595){logger[_0xe128('0x15')](_0xe128('0x7e'),_0x592595);throw _0x592595;});}return _0x2decb2;})[_0xe128('0xf')](respondWithResult(_0x5da536,0xc9))['catch'](handleError(_0x5da536,null));};exports[_0xe128('0x7f')]=function(_0x214513,_0x2a77fc){return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0x214513['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x2a77fc,null))[_0xe128('0xf')](function(_0x11aa33){if(_0x11aa33){return _0x11aa33[_0xe128('0x7f')]();}return null;})[_0xe128('0xf')](respondWithResult(_0x2a77fc,null))[_0xe128('0x62')](handleError(_0x2a77fc,null));};exports['addImap']=function(_0x2fbfc1,_0x12682a){if(_0x2fbfc1[_0xe128('0x63')]['id']){delete _0x2fbfc1[_0xe128('0x63')]['id'];}return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x2fbfc1[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x12682a,null))[_0xe128('0xf')](function(_0xcd3575){if(_0xcd3575){_0x2fbfc1[_0xe128('0x63')]['MailAccountId']=_0xcd3575['id'];return db[_0xe128('0x41')][_0xe128('0x74')](_0x2fbfc1[_0xe128('0x63')]);}})[_0xe128('0xf')](respondWithResult(_0x12682a,null))['catch'](handleError(_0x12682a,null));};exports[_0xe128('0x80')]=function(_0x40b45c,_0x487808){return db[_0xe128('0x5b')]['findOne']({'where':{'id':_0x40b45c['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x487808,null))[_0xe128('0xf')](function(_0x3d8fb6){if(_0x3d8fb6){return _0x3d8fb6[_0xe128('0x81')](null);}return null;})[_0xe128('0xf')](respondWithStatusCode(_0x487808,null))[_0xe128('0x62')](handleError(_0x487808,null));};exports[_0xe128('0x82')]=function(_0x2ba45c,_0x45af67){return db['MailAccount'][_0xe128('0x6b')]({'where':{'id':_0x2ba45c['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x45af67,null))[_0xe128('0xf')](function(_0x4f6b67){if(_0x4f6b67){return _0x4f6b67['getSmtp']();}return null;})[_0xe128('0xf')](respondWithResult(_0x45af67,null))['catch'](handleError(_0x45af67,null));};exports[_0xe128('0x83')]=function(_0x5e359c,_0x47c57e){if(_0x5e359c[_0xe128('0x63')]['id']){delete _0x5e359c[_0xe128('0x63')]['id'];}return db[_0xe128('0x5b')]['find']({'where':{'id':_0x5e359c[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x47c57e,null))[_0xe128('0xf')](function(_0x47ab62){if(_0x47ab62){_0x5e359c[_0xe128('0x63')][_0xe128('0x70')]=_0x47ab62['id'];return db[_0xe128('0x42')]['create'](_0x5e359c[_0xe128('0x63')]);}})[_0xe128('0xf')](respondWithResult(_0x47c57e,null))[_0xe128('0x62')](handleError(_0x47c57e,null));};exports['removeSmtp']=function(_0x5705a8,_0x260e37){return db[_0xe128('0x5b')]['findOne']({'where':{'id':_0x5705a8[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x260e37,null))[_0xe128('0xf')](function(_0x22da3b){if(_0x22da3b){return _0x22da3b['setSmtp'](null);}return null;})[_0xe128('0xf')](respondWithStatusCode(_0x260e37,null))[_0xe128('0x62')](handleError(_0x260e37,null));};exports[_0xe128('0x84')]=function(_0x467bb4,_0x1d3c19){return db[_0xe128('0x85')][_0xe128('0x61')]({'where':{'id':_0x467bb4[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x1d3c19,null))[_0xe128('0xf')](function(_0x28e99c){if(_0x28e99c){return _0x28e99c[_0xe128('0x84')](_0x467bb4['body'][_0xe128('0x6e')],_[_0xe128('0x86')](_0x467bb4['body'],[_0xe128('0x6e'),'id'])||{});}})[_0xe128('0xf')](respondWithResult(_0x1d3c19,null))[_0xe128('0x62')](handleError(_0x1d3c19,null));};exports[_0xe128('0x87')]=function(_0xc26221,_0x46facc){var _0x14cd69={'raw':![],'where':{}};var _0x25ccfc={};var _0x53f9c0={'count':0x0,'rows':[]};return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0xc26221[_0xe128('0x5f')]['id']}})['then'](handleEntityNotFound(_0x46facc,null))['then'](function(_0x1d5afd){if(_0x1d5afd){_0x25ccfc[_0xe128('0x4d')]=_[_0xe128('0x4a')](db['MailInteraction'][_0xe128('0x45')]);_0x25ccfc[_0xe128('0x49')]=_['keys'](_0xc26221[_0xe128('0x49')]);_0x25ccfc['filters']=_[_0xe128('0x4b')](_0x25ccfc[_0xe128('0x4d')],_0x25ccfc[_0xe128('0x49')]);_0x14cd69[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x25ccfc[_0xe128('0x4d')],qs[_0xe128('0x4e')](_0xc26221[_0xe128('0x49')][_0xe128('0x4e')]));_0x14cd69[_0xe128('0x4c')]=_0x14cd69[_0xe128('0x4c')]['length']?_0x14cd69[_0xe128('0x4c')]:_0x25ccfc[_0xe128('0x4d')];if(!_0xc26221[_0xe128('0x49')][_0xe128('0x50')](_0xe128('0x51'))){_0x14cd69[_0xe128('0x1f')]=qs['limit'](_0xc26221['query']['limit']);_0x14cd69[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0xc26221[_0xe128('0x49')][_0xe128('0x1d')]);}_0x14cd69[_0xe128('0x52')]=qs[_0xe128('0x53')](_0xc26221['query'][_0xe128('0x53')]);_0x14cd69['where']=qs['filters'](_['pick'](_0xc26221[_0xe128('0x49')],_0x25ccfc[_0xe128('0x55')]));_0x14cd69[_0xe128('0x54')][_0xe128('0x70')]=_0x1d5afd['id'];if(_0xc26221[_0xe128('0x49')][_0xe128('0x56')]){_0x14cd69['where']=_['merge'](_0x14cd69[_0xe128('0x54')],{'$or':_[_0xe128('0x44')](_0x14cd69[_0xe128('0x4c')],function(_0x393949){var _0x887837={};_0x887837[_0x393949]={'$like':'%'+_0xc26221['query'][_0xe128('0x56')]+'%'};return _0x887837;})});}_0x14cd69=_[_0xe128('0x57')]({},_0x14cd69,_0xc26221[_0xe128('0x58')]);return db[_0xe128('0x85')]['count']({'where':_0x14cd69[_0xe128('0x54')]})[_0xe128('0xf')](function(_0x203011){_0x53f9c0[_0xe128('0x20')]=_0x203011;if(_0xc26221[_0xe128('0x49')][_0xe128('0x59')]){_0x14cd69[_0xe128('0x5a')]=[{'model':db[_0xe128('0x88')],'as':_0xe128('0x89'),'required':![]},{'model':db[_0xe128('0x8a')],'as':_0xe128('0x8b'),'attributes':[_0xe128('0x27'),_0xe128('0x8c'),'internal'],'required':![]},{'model':db[_0xe128('0x8d')],'as':_0xe128('0x8e'),'attributes':['id',_0xe128('0x27'),_0xe128('0x8f')],'where':_0xc26221['query']['tag']?{'id':_0xc26221[_0xe128('0x49')][_0xe128('0x90')]}:undefined,'required':_0xc26221[_0xe128('0x49')]['tag']?!![]:![]}];}return db[_0xe128('0x85')][_0xe128('0x5c')](_0x14cd69);})['then'](function(_0x1b01ac){_0x53f9c0[_0xe128('0x5d')]=_0x1b01ac;return _0x53f9c0;});}})[_0xe128('0xf')](respondWithFilteredResult(_0x46facc,_0x14cd69))[_0xe128('0x62')](handleError(_0x46facc,null));};exports[_0xe128('0x91')]=function addApplications(_0x3069e7,_0x4d8414){var _0x177e8e=_0x3069e7['params']['id'];var _0x267553=_0x3069e7['body'];var _0x4fcb18=0xc8;var _0x290fb6=null;return db[_0xe128('0x92')][_0xe128('0x93')]({'isolationLevel':db['sequelize']['Transaction'][_0xe128('0x94')][_0xe128('0x95')]},function(_0x42a7aa){return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0x177e8e},'transaction':_0x42a7aa})[_0xe128('0xf')](function(_0x2b2600){if(_0x2b2600){return db[_0xe128('0x96')][_0xe128('0x23')]({'where':{'MailAccountId':_0x177e8e},'transaction':_0x42a7aa})[_0xe128('0xf')](function(){var _0x17b6fb=_[_0xe128('0x44')](_0x267553,function(_0x3d52c7){_0x3d52c7[_0xe128('0x70')]=_0x177e8e;return _0x3d52c7;});return db[_0xe128('0x96')][_0xe128('0x97')](_0x17b6fb,{'transaction':_0x42a7aa});});}else{_0x4fcb18=0x194;_0x290fb6=[];}});})[_0xe128('0xf')](function(){if(_0x4fcb18!==0x194){return db[_0xe128('0x96')][_0xe128('0x98')]({'where':{'MailAccountId':_0x177e8e},'order':_0xe128('0x99')})['then'](function(_0x32103a){_0x290fb6=_0x32103a;});}})['catch'](function(_0x34b753){_0x4fcb18=0x1f4;logger[_0xe128('0x15')](_0x34b753['stack']);if(_0x34b753[_0xe128('0x27')]){delete _0x34b753[_0xe128('0x27')];}_0x290fb6=_0x34b753;})[_0xe128('0x9a')](function(){if(_0x290fb6===null){_0x4d8414[_0xe128('0x19')](_0x4fcb18);}else{if(_0x4fcb18===0x1f4){_0x4d8414[_0xe128('0x1a')](_0x4fcb18)['send'](_0x290fb6);}else{_0x4d8414['status'](_0x4fcb18)[_0xe128('0x1c')](_0x290fb6);}}});};exports[_0xe128('0x9b')]=function(_0x1921fa,_0x40d1db){var _0x52f42a={};var _0x373f73={};var _0x1caf2b;var _0x2e9f24;return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0x1921fa[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x40d1db,null))[_0xe128('0xf')](function(_0x36391c){if(_0x36391c){_0x1caf2b=_0x36391c;_0x373f73['model']=_[_0xe128('0x4a')](db[_0xe128('0x96')][_0xe128('0x45')]);_0x373f73[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x1921fa[_0xe128('0x49')]);_0x373f73['filters']=_[_0xe128('0x4b')](_0x373f73['model'],_0x373f73[_0xe128('0x49')]);_0x52f42a['attributes']=_[_0xe128('0x4b')](_0x373f73[_0xe128('0x4d')],qs['fields'](_0x1921fa['query']['fields']));_0x52f42a[_0xe128('0x4c')]=_0x52f42a[_0xe128('0x4c')][_0xe128('0x4f')]?_0x52f42a[_0xe128('0x4c')]:_0x373f73[_0xe128('0x4d')];_0x52f42a['order']=qs[_0xe128('0x53')](_0x1921fa['query'][_0xe128('0x53')]);_0x52f42a[_0xe128('0x54')]=qs[_0xe128('0x55')](_[_0xe128('0x6c')](_0x1921fa[_0xe128('0x49')],_0x373f73[_0xe128('0x55')]));if(_0x1921fa[_0xe128('0x49')]['filter']){_0x52f42a[_0xe128('0x54')]=_[_0xe128('0x57')](_0x52f42a[_0xe128('0x54')],{'$or':_['map'](_0x52f42a[_0xe128('0x4c')],function(_0x189db0){var _0x25a76e={};_0x25a76e[_0x189db0]={'$like':'%'+_0x1921fa[_0xe128('0x49')][_0xe128('0x56')]+'%'};return _0x25a76e;})});}_0x52f42a=_[_0xe128('0x57')]({},_0x52f42a,_0x1921fa[_0xe128('0x58')]);return _0x1caf2b[_0xe128('0x9b')](_0x52f42a);}})[_0xe128('0xf')](function(_0x4a2c61){if(_0x4a2c61){_0x2e9f24=_0x4a2c61[_0xe128('0x4f')];if(!_0x1921fa[_0xe128('0x49')][_0xe128('0x50')]('nolimit')){_0x52f42a[_0xe128('0x1f')]=qs[_0xe128('0x1f')](_0x1921fa['query'][_0xe128('0x1f')]);_0x52f42a[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0x1921fa[_0xe128('0x49')]['offset']);}return _0x1caf2b[_0xe128('0x9b')](_0x52f42a);}})[_0xe128('0xf')](function(_0xd9ee41){if(_0xd9ee41){return _0xd9ee41?{'count':_0x2e9f24,'rows':_0xd9ee41}:null;}})[_0xe128('0xf')](respondWithResult(_0x40d1db,null))[_0xe128('0x62')](handleError(_0x40d1db,null));};exports[_0xe128('0x9c')]=function(_0xf0c925,_0x408d19){var _0x8ba4d9={'raw':!![],'where':{}};var _0x4efc0b={};var _0x4c2e90={'count':0x0,'rows':[]};return db['MailAccount'][_0xe128('0x6b')]({'where':{'id':_0xf0c925['params']['id']}})['then'](handleEntityNotFound(_0x408d19,null))[_0xe128('0xf')](function(_0x4f781f){if(_0x4f781f){_0x4efc0b[_0xe128('0x4d')]=_[_0xe128('0x4a')](db[_0xe128('0x9d')][_0xe128('0x45')]);_0x4efc0b['query']=_[_0xe128('0x4a')](_0xf0c925[_0xe128('0x49')]);_0x4efc0b[_0xe128('0x55')]=_[_0xe128('0x4b')](_0x4efc0b[_0xe128('0x4d')],_0x4efc0b['query']);_0x8ba4d9[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x4efc0b['model'],qs['fields'](_0xf0c925['query']['fields']));_0x8ba4d9[_0xe128('0x4c')]=_0x8ba4d9[_0xe128('0x4c')][_0xe128('0x4f')]?_0x8ba4d9[_0xe128('0x4c')]:_0x4efc0b[_0xe128('0x4d')];if(!_0xf0c925[_0xe128('0x49')][_0xe128('0x50')]('nolimit')){_0x8ba4d9['limit']=qs[_0xe128('0x1f')](_0xf0c925[_0xe128('0x49')][_0xe128('0x1f')]);_0x8ba4d9[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0xf0c925[_0xe128('0x49')]['offset']);}_0x8ba4d9[_0xe128('0x52')]=qs[_0xe128('0x53')](_0xf0c925[_0xe128('0x49')][_0xe128('0x53')]);_0x8ba4d9[_0xe128('0x54')]=qs[_0xe128('0x55')](_['pick'](_0xf0c925[_0xe128('0x49')],_0x4efc0b['filters']));_0x8ba4d9[_0xe128('0x54')][_0xe128('0x70')]=_0x4f781f['id'];if(_0xf0c925['query']['filter']){_0x8ba4d9[_0xe128('0x54')]=_[_0xe128('0x57')](_0x8ba4d9[_0xe128('0x54')],{'$or':_[_0xe128('0x44')](_0x8ba4d9[_0xe128('0x4c')],function(_0x2f2577){var _0x1155f4={};_0x1155f4[_0x2f2577]={'$like':'%'+_0xf0c925['query'][_0xe128('0x56')]+'%'};return _0x1155f4;})});}if(_0xf0c925[_0xe128('0x49')][_0xe128('0x9e')]){var _0x2b49d8=_0xf0c925['query'][_0xe128('0x9e')][_0xe128('0x9f')](',');var _0x4bed7d={};_0x4bed7d[_0x2b49d8[0x0]]={'$gte':moment(_0x2b49d8[0x1])[_0xe128('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x8ba4d9['where']=_[_0xe128('0x57')](_0x8ba4d9[_0xe128('0x54')],_0x4bed7d);}_0x8ba4d9=_[_0xe128('0x57')]({},_0x8ba4d9,_0xf0c925[_0xe128('0x58')]);return db[_0xe128('0x9d')]['count']({'where':_0x8ba4d9[_0xe128('0x54')]})[_0xe128('0xf')](function(_0x1460a9){_0x4c2e90[_0xe128('0x20')]=_0x1460a9;if(_0xf0c925['query']['includeAll']){_0x8ba4d9[_0xe128('0x5a')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x8ba4d9);})[_0xe128('0xf')](function(_0x184406){if(_0xf0c925[_0xe128('0x49')]['inlineCss']==='true'){for(var _0x341a1f=0x0;_0x341a1f<_0x184406['length'];_0x341a1f++){_0x184406[_0x341a1f]['body']=juice(_0x184406[_0x341a1f][_0xe128('0x63')]);}}_0x4c2e90[_0xe128('0x5d')]=_0x184406;return _0x4c2e90;});}})[_0xe128('0xf')](respondWithFilteredResult(_0x408d19,_0x8ba4d9))[_0xe128('0x62')](handleError(_0x408d19,null));};exports['send']=function(_0x29950f,_0xb1b774){var _0x237a0a,_0x2e2e1b={},_0x1a5d42;if(_0x29950f['body']['to']){_0x1a5d42=_0x29950f['body']['to'][_0xe128('0x9f')](',')[0x0];}return db[_0xe128('0x5b')]['find']({'where':{'id':_0x29950f[_0xe128('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0xe128('0xa1'),'include':[{'model':db['CmContact'],'as':_0xe128('0xa2'),'where':{'email':_0x1a5d42},'limit':0x1,'order':[[_0xe128('0xa3'),_0xe128('0xa4')]]}]},{'model':db['MailServerOut'],'as':_0xe128('0x40'),'raw':!![],'include':[{'model':db[_0xe128('0xa5')],'as':_0xe128('0xa5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xb1b774,null))[_0xe128('0xf')](function(_0x433e9d){if(!_0x433e9d)return;_0x237a0a=_0x433e9d;if(!_0x433e9d[_0xe128('0x40')])throw new Error(_0xe128('0xa6'));if(_[_0xe128('0x77')](_0x29950f[_0xe128('0x63')]['from'])){_0x29950f[_0xe128('0x63')]['from']=util[_0xe128('0xa0')](_0xe128('0xa7'),_0x433e9d['name'],_0x433e9d['email']||_0x433e9d[_0xe128('0x40')][_0xe128('0x34')]);}if(_0x29950f[_0xe128('0x63')]['attachments']&&_0x29950f[_0xe128('0x63')][_0xe128('0xa8')]['length']){for(var _0x4dfeb6=0x0;_0x4dfeb6<_0x29950f[_0xe128('0x63')]['attachments']['length'];_0x4dfeb6+=0x1){_0x29950f[_0xe128('0x63')][_0xe128('0xa8')][_0x4dfeb6]={'filename':_0x29950f[_0xe128('0x63')][_0xe128('0xa8')][_0x4dfeb6]['name'],'path':path['join'](config[_0xe128('0xa9')],_0xe128('0xaa'),_0x29950f[_0xe128('0x63')][_0xe128('0xa8')][_0x4dfeb6]['basename'])};}}var _0x502a8c=_0x433e9d[_0xe128('0xab')]();return respondWithRpcPromise(_0xe128('0xac'),_0xe128('0xad'),{'account':_0x502a8c,'message':_0x29950f[_0xe128('0x63')]});})[_0xe128('0xf')](function(_0x877e2b){if(!_0x877e2b)return;_0x2e2e1b=_0x877e2b;if(!_0x237a0a[_0xe128('0xa1')])throw new Error('List\x20not\x20found');if(_0x237a0a['List'][_0xe128('0xa2')][_0xe128('0x4f')])return _0x237a0a[_0xe128('0xa1')]['Contacts'][0x0];return db[_0xe128('0x88')][_0xe128('0x74')](_[_0xe128('0x9')](_0x29950f[_0xe128('0x63')],{'firstName':_0x29950f['body']['to'],'email':_0x29950f[_0xe128('0x63')]['to'],'phone':_0x29950f[_0xe128('0x63')]['to'],'ListId':_0x237a0a[_0xe128('0x76')]}));})[_0xe128('0xf')](function(_0x55b795){if(!_0x55b795)return;var _0x5e7fae={'UserId':_0x29950f[_0xe128('0x34')]['id'],'ContactId':_0x55b795['id'],'MailAccountId':_0x237a0a['id'],'inReplyTo':_0x2e2e1b[_0xe128('0xae')],'to':_0x29950f['body'][_0xe128('0xaf')],'cc':_0x29950f['body']['cc'],'subject':_0x29950f[_0xe128('0x63')][_0xe128('0xb0')],'attach':_0x29950f[_0xe128('0x63')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xe128('0xb1')),'lastMsgDirection':_0xe128('0xb2'),'Messages':[_[_0xe128('0x57')](_0x29950f[_0xe128('0x63')],{'messageId':_0x2e2e1b[_0xe128('0xae')],'sentAt':moment()['format'](_0xe128('0xb1')),'read':!![],'MailAccountId':_0x237a0a['id'],'UserId':_0x29950f[_0xe128('0x34')]['id'],'ContactId':_0x55b795['id']})]};if(_0x29950f['body'][_0xe128('0xb3')]){_0x5e7fae=_[_0xe128('0x57')](_0x5e7fae,_0x29950f[_0xe128('0x63')][_0xe128('0xb3')]);}return db[_0xe128('0x85')]['create'](_0x5e7fae,{'include':[{'model':db[_0xe128('0x9d')],'as':'Messages'}]});})[_0xe128('0xf')](respondWithResult(_0xb1b774,null))[_0xe128('0x62')](handleError(_0xb1b774,null));};exports['verifySmtp']=function(_0x44bdde,_0x5737d6){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x44bdde['params']['id']},'include':[{'model':db[_0xe128('0x42')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe128('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0xe128('0xf')](handleEntityNotFound(_0x5737d6,null))[_0xe128('0xf')](function(_0x4c109e){if(!_0x4c109e[_0xe128('0x40')])return;var _0x1dd46e=_0x4c109e[_0xe128('0xab')]();return respondWithRpcPromise(_0xe128('0xb4'),_0xe128('0xb5'),{'account':_0x1dd46e});})['then'](respondWithResult(_0x5737d6,null))[_0xe128('0x62')](handleError(_0x5737d6,null));};exports['destroy']=function(_0x5c1cd8,_0x51f692){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x5c1cd8[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x51f692,null))[_0xe128('0xf')](function(_0xc8f05){if(_0xc8f05&&_0xc8f05[_0xe128('0x3d')]){throw new db[(_0xe128('0xb6'))][(_0xe128('0xb7'))](_0xe128('0xb8'));}return _0xc8f05;})[_0xe128('0xf')](removeEntity(_0x51f692,null))[_0xe128('0x62')](handleError(_0x51f692,null));};exports[_0xe128('0xb9')]=function(_0x1c9808,_0x1f5fd4){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x1c9808[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x1f5fd4,null))[_0xe128('0xf')](function(_0x44523e){if(_0x44523e){return _0x44523e[_0xe128('0xb9')](_0x1c9808[_0xe128('0x63')]['ids'],_[_0xe128('0x86')](_0x1c9808['body'],['ids','id'])||{})[_0xe128('0xba')](function(_0x224f60){for(var _0x55134e=0x0;_0x55134e<_0x1c9808[_0xe128('0x63')]['ids']['length'];_0x55134e+=0x1){socket[_0xe128('0xbb')](_0xe128('0xbc'),{'UserId':Number(_0x1c9808[_0xe128('0x63')]['ids'][_0x55134e]),'MailAccountId':Number(_0x1c9808[_0xe128('0x5f')]['id'])});}return _0x224f60;});}})[_0xe128('0xf')](respondWithResult(_0x1f5fd4,null))[_0xe128('0x62')](handleError(_0x1f5fd4,null));};exports['removeAgents']=function(_0x2721df,_0x41850f){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x2721df[_0xe128('0x5f')]['id']}})['then'](handleEntityNotFound(_0x41850f,null))[_0xe128('0xf')](function(_0x268494){if(_0x268494){return _0x268494['removeAgents'](_0x2721df[_0xe128('0x49')][_0xe128('0x6e')])[_0xe128('0xf')](function(){if(_[_0xe128('0xbd')](_0x2721df[_0xe128('0x49')]['ids'])){for(var _0x331894=0x0;_0x331894<_0x2721df[_0xe128('0x49')][_0xe128('0x6e')][_0xe128('0x4f')];_0x331894+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x2721df[_0xe128('0x49')][_0xe128('0x6e')][_0x331894]),'MailAccountId':Number(_0x2721df['params']['id'])});}}else{socket['emit'](_0xe128('0xbe'),{'UserId':Number(_0x2721df[_0xe128('0x49')][_0xe128('0x6e')]),'MailAccountId':Number(_0x2721df[_0xe128('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x41850f,null))['catch'](handleError(_0x41850f,null));};exports[_0xe128('0xbf')]=function(_0x1b9ee6,_0x4d04ba){var _0x26dc19={};var _0x23e46e={};var _0x18855;var _0x5c491a;return db['MailAccount'][_0xe128('0x6b')]({'where':{'id':_0x1b9ee6['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x4d04ba,null))['then'](function(_0x5741b6){if(_0x5741b6){_0x18855=_0x5741b6;_0x23e46e[_0xe128('0x4d')]=_[_0xe128('0x4a')](db[_0xe128('0x8a')][_0xe128('0x45')]);_0x23e46e[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x1b9ee6[_0xe128('0x49')]);_0x23e46e[_0xe128('0x55')]=_['intersection'](_0x23e46e[_0xe128('0x4d')],_0x23e46e['query']);_0x26dc19[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x23e46e[_0xe128('0x4d')],qs[_0xe128('0x4e')](_0x1b9ee6['query'][_0xe128('0x4e')]));_0x26dc19[_0xe128('0x4c')]=_0x26dc19[_0xe128('0x4c')][_0xe128('0x4f')]?_0x26dc19[_0xe128('0x4c')]:_0x23e46e[_0xe128('0x4d')];_0x26dc19['order']=qs['sort'](_0x1b9ee6[_0xe128('0x49')][_0xe128('0x53')]);_0x26dc19[_0xe128('0x54')]=qs[_0xe128('0x55')](_['pick'](_0x1b9ee6['query'],_0x23e46e['filters']));if(_0x1b9ee6[_0xe128('0x49')]['filter']){_0x26dc19[_0xe128('0x54')]=_[_0xe128('0x57')](_0x26dc19[_0xe128('0x54')],{'$or':_[_0xe128('0x44')](_0x26dc19[_0xe128('0x4c')],function(_0x3b8a6e){var _0x2c1dd8={};_0x2c1dd8[_0x3b8a6e]={'$like':'%'+_0x1b9ee6[_0xe128('0x49')]['filter']+'%'};return _0x2c1dd8;})});}_0x26dc19=_[_0xe128('0x57')]({},_0x26dc19,_0x1b9ee6[_0xe128('0x58')]);return _0x18855['getAgents'](_0x26dc19);}})[_0xe128('0xf')](function(_0x39eb50){if(_0x39eb50){_0x5c491a=_0x39eb50[_0xe128('0x4f')];if(!_0x1b9ee6[_0xe128('0x49')][_0xe128('0x50')]('nolimit')){_0x26dc19[_0xe128('0x1f')]=qs['limit'](_0x1b9ee6[_0xe128('0x49')][_0xe128('0x1f')]);_0x26dc19[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0x1b9ee6['query']['offset']);}return _0x18855[_0xe128('0xbf')](_0x26dc19);}})['then'](function(_0x171b55){if(_0x171b55){return _0x171b55?{'count':_0x5c491a,'rows':_0x171b55}:null;}})['then'](respondWithResult(_0x4d04ba,null))[_0xe128('0x62')](handleError(_0x4d04ba,null));}; \ No newline at end of file +var _0x1e28=['CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','get','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','MailAccount','includeAll','include','findAll','rows','show','body','provider','custom','secure','find','Mail\x20Account\x20not\x20found','describe','addDisposition','params','MailAccountId','getDispositions','Disposition','removeDispositions','create','getAnswers','findOne','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','setImap','removeSmtp','setSmtp','addInteraction','ids','omit','getInteractions','MailInteraction','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','DESC'];(function(_0x5df7f5,_0x14a312){var _0x245076=function(_0x48b982){while(--_0x48b982){_0x5df7f5['push'](_0x5df7f5['shift']());}};_0x245076(++_0x14a312);}(_0x1e28,0xe3));var _0x81e2=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x1e28[_0x237da8];return _0x558825;};'use strict';var moment=require(_0x81e2('0x0'));var BPromise=require(_0x81e2('0x1'));var util=require(_0x81e2('0x2'));var path=require(_0x81e2('0x3'));var _=require(_0x81e2('0x4'));var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x81e2('0x5'));var config=require(_0x81e2('0x6'));var db=require(_0x81e2('0x7'))['db'];config[_0x81e2('0x8')]=_[_0x81e2('0x9')](config[_0x81e2('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x81e2('0xa'))(new Redis(config[_0x81e2('0x8')]));require(_0x81e2('0xb'))[_0x81e2('0xc')](socket);var jayson=require(_0x81e2('0xd'));var client=jayson[_0x81e2('0xe')][_0x81e2('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x431fdb,_0x25f357,_0x565273,_0x5a5007){return new BPromise(function(_0x230a86,_0x4903fa){var _0x58b86a=_0x5a5007||client;return _0x58b86a['request'](_0x431fdb,_0x565273)[_0x81e2('0x10')](function(_0x4b1bf1){logger[_0x81e2('0x11')](_0x81e2('0x12'),_0x25f357,_0x81e2('0x13'));logger[_0x81e2('0x14')](_0x81e2('0x15'),_0x25f357,_0x81e2('0x13'),JSON[_0x81e2('0x16')](_0x4b1bf1));if(_0x4b1bf1['error']){if(_0x4b1bf1[_0x81e2('0x17')][_0x81e2('0x18')]===0x1f4){logger[_0x81e2('0x17')](_0x81e2('0x12'),_0x25f357,_0x4b1bf1[_0x81e2('0x17')][_0x81e2('0x19')]);return _0x4903fa(_0x4b1bf1[_0x81e2('0x17')][_0x81e2('0x19')]);}logger[_0x81e2('0x17')]('MailAccount,\x20%s,\x20%s',_0x25f357,_0x4b1bf1[_0x81e2('0x17')][_0x81e2('0x19')]);return _0x230a86(_0x4b1bf1[_0x81e2('0x17')][_0x81e2('0x19')]);}else{logger[_0x81e2('0x11')](_0x81e2('0x12'),_0x25f357,_0x81e2('0x13'));_0x230a86(_0x4b1bf1[_0x81e2('0x1a')][_0x81e2('0x19')]);}})[_0x81e2('0x1b')](function(_0x1f1bd7){logger[_0x81e2('0x17')](_0x81e2('0x12'),_0x25f357,_0x1f1bd7);_0x4903fa(_0x1f1bd7);});});}function respondWithStatusCode(_0x3a05f0,_0x8451a){_0x8451a=_0x8451a||0xcc;return function(_0x56d7a3){if(_0x56d7a3){return _0x3a05f0[_0x81e2('0x1c')](_0x8451a);}return _0x3a05f0[_0x81e2('0x1d')](_0x8451a)['end']();};}function respondWithResult(_0x59b44c,_0x1c2eff){_0x1c2eff=_0x1c2eff||0xc8;return function(_0x459378){if(_0x459378){return _0x59b44c[_0x81e2('0x1d')](_0x1c2eff)[_0x81e2('0x1e')](_0x459378);}};}function respondWithFilteredResult(_0x22cb05,_0x48cb9e){return function(_0x401156){if(_0x401156){var _0x34128f=typeof _0x48cb9e[_0x81e2('0x1f')]===_0x81e2('0x20')&&typeof _0x48cb9e[_0x81e2('0x21')]===_0x81e2('0x20');var _0x707372=_0x401156[_0x81e2('0x22')];var _0xa3e7db=_0x34128f?0x0:_0x48cb9e[_0x81e2('0x1f')];var _0x2b756f=_0x34128f?_0x401156['count']:_0x48cb9e[_0x81e2('0x1f')]+_0x48cb9e[_0x81e2('0x21')];var _0x2bf900;if(_0x2b756f>=_0x707372){_0x2b756f=_0x707372;_0x2bf900=0xc8;}else{_0x2bf900=0xce;}_0x22cb05['status'](_0x2bf900);return _0x22cb05[_0x81e2('0x23')]('Content-Range',_0xa3e7db+'-'+_0x2b756f+'/'+_0x707372)['json'](_0x401156);}return null;};}function saveUpdates(_0x5d2a8a){return function(_0x4b9fc8){if(_0x4b9fc8){return _0x4b9fc8[_0x81e2('0x24')](_0x5d2a8a)[_0x81e2('0x10')](function(_0x516f31){return _0x516f31;});}return null;};}function removeEntity(_0x1ef0b6){return function(_0x1f7a15){if(_0x1f7a15){return _0x1f7a15[_0x81e2('0x25')]()[_0x81e2('0x10')](function(){var _0x106b87=_0x1f7a15[_0x81e2('0x26')]({'plain':!![]});var _0x39ae35=_0x81e2('0x27');return db[_0x81e2('0x28')]['destroy']({'where':{'type':_0x39ae35,'resourceId':_0x106b87['id']}})[_0x81e2('0x10')](function(){return _0x1f7a15;});})[_0x81e2('0x10')](function(){_0x1ef0b6[_0x81e2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c601){return function(_0x2afe39){if(!_0x2afe39){_0x43c601[_0x81e2('0x1c')](0x194);}return _0x2afe39;};}function handleError(_0x754e33,_0x4445bc){_0x4445bc=_0x4445bc||0x1f4;return function(_0x53cea1){logger[_0x81e2('0x17')](_0x53cea1['stack']);if(_0x53cea1['name']){delete _0x53cea1[_0x81e2('0x29')];}_0x754e33[_0x81e2('0x1d')](_0x4445bc)[_0x81e2('0x2a')](_0x53cea1);};}function getImapHost(_0x7f398e){switch(_0x7f398e){case _0x81e2('0x2b'):return _0x81e2('0x2c');case _0x81e2('0x2d'):return _0x81e2('0x2e');case _0x81e2('0x2f'):return _0x81e2('0x30');case _0x81e2('0x31'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x7f398e);}function getSmtpHost(_0x403965){switch(_0x403965){case _0x81e2('0x2b'):return _0x81e2('0x32');case'yahoo':return _0x81e2('0x33');case _0x81e2('0x2f'):return _0x81e2('0x34');case _0x81e2('0x31'):return _0x81e2('0x35');}throw new Error(_0x81e2('0x36'),_0x403965);}function getAuthenticationOptions(_0x54f6fa,_0x5cd262){var _0x4c508d={};var _0x4d8091={};if(_0x54f6fa){_0x4c508d[_0x81e2('0x37')]=_0x4d8091[_0x81e2('0x37')]=_0x5cd262[_0x81e2('0x38')];_0x4c508d['password']=_0x4d8091[_0x81e2('0x39')]=_0x5cd262[_0x81e2('0x3a')];if(_0x5cd262[_0x81e2('0x3b')]){_0x4c508d[_0x81e2('0x3b')]=_0x4d8091[_0x81e2('0x3b')]=!![];_0x4c508d[_0x81e2('0x3c')]=_0x4d8091[_0x81e2('0x3c')]=_0x5cd262['CloudProviderId'];_0x4c508d[_0x81e2('0x3a')]=_0x4d8091['pass']=null;}else{_0x4c508d[_0x81e2('0x3c')]=_0x4d8091['CloudProviderId']=null;}_0x4c508d[_0x81e2('0x3d')]=getImapHost(_0x54f6fa);_0x4c508d[_0x81e2('0x3e')]=0x3e1;_0x4d8091[_0x81e2('0x3d')]=getSmtpHost(_0x54f6fa);_0x4d8091[_0x81e2('0x3e')]=0x24b;_0x4d8091['secure']=![];_0x4c508d[_0x81e2('0x3f')]=_0x4d8091[_0x81e2('0x3f')]=null;}else{if(_0x5cd262['authentication']){_0x4c508d[_0x81e2('0x37')]=_0x4d8091[_0x81e2('0x37')]=_0x5cd262[_0x81e2('0x38')];_0x4c508d['password']=_0x4d8091[_0x81e2('0x39')]=_0x5cd262['password'];}else{_0x4c508d[_0x81e2('0x40')]=_0x4d8091[_0x81e2('0x40')]=![];_0x4c508d['user']=_0x4d8091[_0x81e2('0x37')]=null;_0x4c508d[_0x81e2('0x3a')]=_0x4d8091[_0x81e2('0x39')]=null;}_0x4c508d[_0x81e2('0x3d')]=_0x5cd262[_0x81e2('0x41')][_0x81e2('0x3d')];_0x4c508d[_0x81e2('0x3e')]=_0x5cd262[_0x81e2('0x41')][_0x81e2('0x3e')];_0x4d8091[_0x81e2('0x3d')]=_0x5cd262[_0x81e2('0x42')]['host'];_0x4d8091[_0x81e2('0x3e')]=_0x5cd262[_0x81e2('0x42')][_0x81e2('0x3e')];}return{'Imap':_0x4c508d,'Smtp':_0x4d8091};}exports[_0x81e2('0x43')]=function(_0x6575df,_0x36f9ce){var _0x1bae68={'include':[{'model':db[_0x81e2('0x44')],'as':_0x81e2('0x41')},{'model':db[_0x81e2('0x45')],'as':_0x81e2('0x42')},{'model':db[_0x81e2('0x46')],'as':_0x81e2('0x47')}]},_0x165681={},_0x5e980f={'count':0x0,'rows':[]};var _0xb3ed27=_[_0x81e2('0x48')](db['MailAccount'][_0x81e2('0x49')],function(_0x339b11){return{'name':_0x339b11[_0x81e2('0x4a')],'type':_0x339b11['type'][_0x81e2('0x4b')]};});_0x165681[_0x81e2('0x4c')]=_[_0x81e2('0x48')](_0xb3ed27,_0x81e2('0x29'));_0x165681[_0x81e2('0x4d')]=_[_0x81e2('0x4e')](_0x6575df[_0x81e2('0x4d')]);_0x165681[_0x81e2('0x4f')]=_['intersection'](_0x165681[_0x81e2('0x4c')],_0x165681[_0x81e2('0x4d')]);_0x1bae68['attributes']=_[_0x81e2('0x50')](_0x165681[_0x81e2('0x4c')],qs[_0x81e2('0x51')](_0x6575df[_0x81e2('0x4d')][_0x81e2('0x51')]));_0x1bae68[_0x81e2('0x52')]=_0x1bae68['attributes'][_0x81e2('0x53')]?_0x1bae68['attributes']:_0x165681[_0x81e2('0x4c')];if(!_0x6575df[_0x81e2('0x4d')][_0x81e2('0x54')](_0x81e2('0x55'))){_0x1bae68[_0x81e2('0x21')]=qs[_0x81e2('0x21')](_0x6575df['query']['limit']);_0x1bae68[_0x81e2('0x1f')]=qs['offset'](_0x6575df['query'][_0x81e2('0x1f')]);}_0x1bae68[_0x81e2('0x56')]=qs[_0x81e2('0x57')](_0x6575df[_0x81e2('0x4d')][_0x81e2('0x57')]);_0x1bae68[_0x81e2('0x58')]=qs[_0x81e2('0x4f')](_[_0x81e2('0x59')](_0x6575df[_0x81e2('0x4d')],_0x165681[_0x81e2('0x4f')]),_0xb3ed27);if(_0x6575df[_0x81e2('0x4d')][_0x81e2('0x5a')]){_0x1bae68[_0x81e2('0x58')]=_['merge'](_0x1bae68[_0x81e2('0x58')],{'$or':_[_0x81e2('0x48')](_0xb3ed27,function(_0x92cb07){if(_0x92cb07[_0x81e2('0x5b')]!==_0x81e2('0x5c')){var _0x4dff94={};_0x4dff94[_0x92cb07[_0x81e2('0x29')]]={'$like':'%'+_0x6575df[_0x81e2('0x4d')]['filter']+'%'};return _0x4dff94;}})});}_0x1bae68=_[_0x81e2('0x5d')]({},_0x1bae68,_0x6575df[_0x81e2('0x5e')]);var _0x30e0a0={'where':_0x1bae68[_0x81e2('0x58')]};return db[_0x81e2('0x5f')]['count'](_0x30e0a0)[_0x81e2('0x10')](function(_0x4f6fec){_0x5e980f['count']=_0x4f6fec;if(_0x6575df['query'][_0x81e2('0x60')]){_0x1bae68[_0x81e2('0x61')]=[{'all':!![]}];}return db[_0x81e2('0x5f')][_0x81e2('0x62')](_0x1bae68);})[_0x81e2('0x10')](function(_0x531d15){_0x5e980f[_0x81e2('0x63')]=_0x531d15;return _0x5e980f;})['then'](respondWithFilteredResult(_0x36f9ce,_0x1bae68))[_0x81e2('0x1b')](handleError(_0x36f9ce,null));};exports[_0x81e2('0x64')]=function(_0x3c6e0a,_0x23cea6){var _0x42a1b4={'raw':![],'where':{'id':_0x3c6e0a['params']['id']},'include':[{'model':db[_0x81e2('0x44')],'as':_0x81e2('0x41')},{'model':db['MailServerOut'],'as':_0x81e2('0x42')},{'model':db[_0x81e2('0x46')],'as':_0x81e2('0x47')}]},_0x12cc7e={};_0x12cc7e[_0x81e2('0x4c')]=_[_0x81e2('0x4e')](db[_0x81e2('0x5f')][_0x81e2('0x49')]);_0x12cc7e[_0x81e2('0x4d')]=_['keys'](_0x3c6e0a[_0x81e2('0x4d')]);_0x12cc7e['filters']=_[_0x81e2('0x50')](_0x12cc7e[_0x81e2('0x4c')],_0x12cc7e[_0x81e2('0x4d')]);_0x42a1b4['attributes']=_[_0x81e2('0x50')](_0x12cc7e[_0x81e2('0x4c')],qs[_0x81e2('0x51')](_0x3c6e0a[_0x81e2('0x4d')][_0x81e2('0x51')]));_0x42a1b4[_0x81e2('0x52')]=_0x42a1b4[_0x81e2('0x52')][_0x81e2('0x53')]?_0x42a1b4[_0x81e2('0x52')]:_0x12cc7e[_0x81e2('0x4c')];if(_0x3c6e0a[_0x81e2('0x4d')][_0x81e2('0x60')]){_0x42a1b4[_0x81e2('0x61')]=[{'all':!![]}];}_0x42a1b4=_[_0x81e2('0x5d')]({},_0x42a1b4,_0x3c6e0a[_0x81e2('0x5e')]);return db[_0x81e2('0x5f')]['find'](_0x42a1b4)['then'](handleEntityNotFound(_0x23cea6,null))[_0x81e2('0x10')](respondWithResult(_0x23cea6,null))[_0x81e2('0x1b')](handleError(_0x23cea6,null));};exports[_0x81e2('0x24')]=function(_0xbb54a5,_0x491c3d){if(_0xbb54a5[_0x81e2('0x65')]['id']){delete _0xbb54a5[_0x81e2('0x65')]['id'];}var _0x5c1b12=_0xbb54a5[_0x81e2('0x65')][_0x81e2('0x66')]===_0x81e2('0x67')?null:_0xbb54a5['body']['provider'];var _0x81414b=_0xbb54a5[_0x81e2('0x65')][_0x81e2('0x41')]||{};var _0x2dde2a=_0xbb54a5['body'][_0x81e2('0x42')]||{};if(_0x5c1b12){_0x81414b[_0x81e2('0x3d')]=getImapHost(_0x5c1b12);_0x81414b[_0x81e2('0x3e')]=0x3e1;_0x2dde2a[_0x81e2('0x3d')]=getSmtpHost(_0x5c1b12);_0x2dde2a[_0x81e2('0x3e')]=0x24b;_0x2dde2a[_0x81e2('0x68')]=![];}if(_0x2dde2a[_0x81e2('0x3b')]){_0x2dde2a[_0x81e2('0x68')]=![];}else{_0x2dde2a['CloudProviderId']=null;}if(!_0x81414b[_0x81e2('0x3b')])_0x81414b[_0x81e2('0x3c')]=null;_0xbb54a5[_0x81e2('0x65')][_0x81e2('0x41')]=_0x81414b;_0xbb54a5[_0x81e2('0x65')]['Smtp']=_0x2dde2a;return db[_0x81e2('0x5f')][_0x81e2('0x69')]({'where':{'id':_0xbb54a5['params']['id']},'include':[{'model':db[_0x81e2('0x44')],'as':_0x81e2('0x41')},{'model':db[_0x81e2('0x45')],'as':_0x81e2('0x42')},{'model':db[_0x81e2('0x46')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x491c3d,null))['then'](function(_0x1cb80b){if(!_0x1cb80b)throw new Error(_0x81e2('0x6a'));if(_0x1cb80b['service'])delete _0xbb54a5[_0x81e2('0x65')][_0x81e2('0x41')];return _0x1cb80b;})['then'](saveUpdates(_0xbb54a5[_0x81e2('0x65')],null))[_0x81e2('0x10')](function(_0x1c23c0){if(!_0xbb54a5[_0x81e2('0x65')][_0x81e2('0x41')])return _0x1c23c0;return db[_0x81e2('0x44')]['update'](_0xbb54a5['body'][_0x81e2('0x41')],{'where':{'MailAccountId':_0x1c23c0['id']}})[_0x81e2('0x10')](function(){return _0x1c23c0;});})[_0x81e2('0x10')](function(_0x2834da){if(!_0xbb54a5[_0x81e2('0x65')]['Smtp'])return _0x2834da;return db[_0x81e2('0x45')][_0x81e2('0x24')](_0xbb54a5[_0x81e2('0x65')][_0x81e2('0x42')],{'where':{'MailAccountId':_0x2834da['id']}})[_0x81e2('0x10')](function(){return _0x2834da;});})[_0x81e2('0x10')](respondWithResult(_0x491c3d,null))[_0x81e2('0x1b')](handleError(_0x491c3d,null));};exports['describe']=function(_0x236e28,_0x1f8cb6){return db[_0x81e2('0x5f')][_0x81e2('0x6b')]()[_0x81e2('0x10')](respondWithResult(_0x1f8cb6,null))['catch'](handleError(_0x1f8cb6,null));};exports[_0x81e2('0x6c')]=function(_0x4772d7,_0x219b2e){if(_0x4772d7[_0x81e2('0x65')]['id']){delete _0x4772d7[_0x81e2('0x65')]['id'];}return db[_0x81e2('0x5f')][_0x81e2('0x69')]({'where':{'id':_0x4772d7[_0x81e2('0x6d')]['id']}})['then'](handleEntityNotFound(_0x219b2e,null))[_0x81e2('0x10')](function(_0x22c531){if(_0x22c531){_0x4772d7[_0x81e2('0x65')][_0x81e2('0x6e')]=_0x22c531['id'];return db['Disposition']['create'](_0x4772d7[_0x81e2('0x65')]);}})[_0x81e2('0x10')](respondWithResult(_0x219b2e,null))['catch'](handleError(_0x219b2e,null));};exports[_0x81e2('0x6f')]=function(_0x271fec,_0x20b3f5){var _0x5197d4={'raw':![],'where':{}};var _0x8e264a={};var _0x15b3f6={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x271fec[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x20b3f5,null))[_0x81e2('0x10')](function(_0x19680b){if(_0x19680b){_0x8e264a[_0x81e2('0x4c')]=_['keys'](db['Disposition'][_0x81e2('0x49')]);_0x8e264a['query']=_['keys'](_0x271fec[_0x81e2('0x4d')]);_0x8e264a[_0x81e2('0x4f')]=_['intersection'](_0x8e264a['model'],_0x8e264a[_0x81e2('0x4d')]);_0x5197d4[_0x81e2('0x52')]=_[_0x81e2('0x50')](_0x8e264a[_0x81e2('0x4c')],qs[_0x81e2('0x51')](_0x271fec['query'][_0x81e2('0x51')]));_0x5197d4[_0x81e2('0x52')]=_0x5197d4['attributes'][_0x81e2('0x53')]?_0x5197d4[_0x81e2('0x52')]:_0x8e264a['model'];if(!_0x271fec['query'][_0x81e2('0x54')](_0x81e2('0x55'))){_0x5197d4[_0x81e2('0x21')]=qs[_0x81e2('0x21')](_0x271fec[_0x81e2('0x4d')][_0x81e2('0x21')]);_0x5197d4[_0x81e2('0x1f')]=qs[_0x81e2('0x1f')](_0x271fec[_0x81e2('0x4d')][_0x81e2('0x1f')]);}_0x5197d4[_0x81e2('0x56')]=qs[_0x81e2('0x57')](_0x271fec[_0x81e2('0x4d')][_0x81e2('0x57')]);_0x5197d4['where']=qs[_0x81e2('0x4f')](_[_0x81e2('0x59')](_0x271fec[_0x81e2('0x4d')],_0x8e264a[_0x81e2('0x4f')]));_0x5197d4[_0x81e2('0x58')]['MailAccountId']=_0x19680b['id'];if(_0x271fec[_0x81e2('0x4d')]['filter']){_0x5197d4['where']=_['merge'](_0x5197d4[_0x81e2('0x58')],{'$or':_[_0x81e2('0x48')](_0x5197d4[_0x81e2('0x52')],function(_0x366ade){var _0x48c753={};_0x48c753[_0x366ade]={'$like':'%'+_0x271fec[_0x81e2('0x4d')]['filter']+'%'};return _0x48c753;})});}_0x5197d4=_['merge']({},_0x5197d4,_0x271fec['options']);return db[_0x81e2('0x70')][_0x81e2('0x22')]({'where':_0x5197d4['where']})[_0x81e2('0x10')](function(_0x53672d){_0x15b3f6[_0x81e2('0x22')]=_0x53672d;if(_0x271fec['query'][_0x81e2('0x60')]){_0x5197d4[_0x81e2('0x61')]=[{'all':!![]}];}return db[_0x81e2('0x70')]['findAll'](_0x5197d4);})[_0x81e2('0x10')](function(_0x17f9a5){_0x15b3f6[_0x81e2('0x63')]=_0x17f9a5;return _0x15b3f6;});}})[_0x81e2('0x10')](respondWithFilteredResult(_0x20b3f5,_0x5197d4))[_0x81e2('0x1b')](handleError(_0x20b3f5,null));};exports[_0x81e2('0x71')]=function(_0x3837e8,_0x1e0009){return db['MailAccount'][_0x81e2('0x69')]({'where':{'id':_0x3837e8[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x1e0009,null))[_0x81e2('0x10')](function(_0x45a2bd){if(_0x45a2bd){return _0x45a2bd[_0x81e2('0x71')](_0x3837e8[_0x81e2('0x4d')]['ids']);}})[_0x81e2('0x10')](respondWithStatusCode(_0x1e0009,null))['catch'](handleError(_0x1e0009,null));};exports['addAnswer']=function(_0x39fed6,_0x1571fe){if(_0x39fed6[_0x81e2('0x65')]['id']){delete _0x39fed6[_0x81e2('0x65')]['id'];}return db[_0x81e2('0x5f')][_0x81e2('0x69')]({'where':{'id':_0x39fed6[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x1571fe,null))[_0x81e2('0x10')](function(_0x32e0f7){if(_0x32e0f7){_0x39fed6[_0x81e2('0x65')]['MailAccountId']=_0x32e0f7['id'];return db['CannedAnswer'][_0x81e2('0x72')](_0x39fed6[_0x81e2('0x65')]);}})[_0x81e2('0x10')](respondWithResult(_0x1571fe,null))[_0x81e2('0x1b')](handleError(_0x1571fe,null));};exports[_0x81e2('0x73')]=function(_0x29f27d,_0x5e99c2){var _0xd9191b={'raw':![],'where':{}};var _0x171605={};var _0x57d1f4={'count':0x0,'rows':[]};return db[_0x81e2('0x5f')][_0x81e2('0x74')]({'where':{'id':_0x29f27d[_0x81e2('0x6d')]['id']}})['then'](handleEntityNotFound(_0x5e99c2,null))[_0x81e2('0x10')](function(_0x50060c){if(_0x50060c){_0x171605['model']=_[_0x81e2('0x4e')](db['CannedAnswer'][_0x81e2('0x49')]);_0x171605[_0x81e2('0x4d')]=_['keys'](_0x29f27d[_0x81e2('0x4d')]);_0x171605[_0x81e2('0x4f')]=_[_0x81e2('0x50')](_0x171605['model'],_0x171605[_0x81e2('0x4d')]);_0xd9191b[_0x81e2('0x52')]=_['intersection'](_0x171605[_0x81e2('0x4c')],qs[_0x81e2('0x51')](_0x29f27d['query'][_0x81e2('0x51')]));_0xd9191b[_0x81e2('0x52')]=_0xd9191b[_0x81e2('0x52')][_0x81e2('0x53')]?_0xd9191b[_0x81e2('0x52')]:_0x171605[_0x81e2('0x4c')];if(!_0x29f27d[_0x81e2('0x4d')][_0x81e2('0x54')](_0x81e2('0x55'))){_0xd9191b['limit']=qs['limit'](_0x29f27d[_0x81e2('0x4d')][_0x81e2('0x21')]);_0xd9191b[_0x81e2('0x1f')]=qs[_0x81e2('0x1f')](_0x29f27d[_0x81e2('0x4d')]['offset']);}_0xd9191b['order']=qs[_0x81e2('0x57')](_0x29f27d[_0x81e2('0x4d')][_0x81e2('0x57')]);_0xd9191b[_0x81e2('0x58')]=qs[_0x81e2('0x4f')](_[_0x81e2('0x59')](_0x29f27d[_0x81e2('0x4d')],_0x171605[_0x81e2('0x4f')]));_0xd9191b[_0x81e2('0x58')]['MailAccountId']=_0x50060c['id'];if(_0x29f27d[_0x81e2('0x4d')][_0x81e2('0x5a')]){_0xd9191b[_0x81e2('0x58')]=_[_0x81e2('0x5d')](_0xd9191b[_0x81e2('0x58')],{'$or':_[_0x81e2('0x48')](_0xd9191b['attributes'],function(_0x52052e){var _0x4115bf={};_0x4115bf[_0x52052e]={'$like':'%'+_0x29f27d[_0x81e2('0x4d')][_0x81e2('0x5a')]+'%'};return _0x4115bf;})});}_0xd9191b=_[_0x81e2('0x5d')]({},_0xd9191b,_0x29f27d[_0x81e2('0x5e')]);return db[_0x81e2('0x75')][_0x81e2('0x22')]({'where':_0xd9191b[_0x81e2('0x58')]})[_0x81e2('0x10')](function(_0x7bd1ea){_0x57d1f4['count']=_0x7bd1ea;if(_0x29f27d[_0x81e2('0x4d')]['includeAll']){_0xd9191b[_0x81e2('0x61')]=[{'all':!![]}];}return db['CannedAnswer'][_0x81e2('0x62')](_0xd9191b);})[_0x81e2('0x10')](function(_0x15a63d){_0x57d1f4[_0x81e2('0x63')]=_0x15a63d;return _0x57d1f4;});}})['then'](respondWithFilteredResult(_0x5e99c2,_0xd9191b))['catch'](handleError(_0x5e99c2,null));};exports[_0x81e2('0x76')]=function(_0x333cd6,_0x1b1fdc){return db['MailAccount'][_0x81e2('0x69')]({'where':{'id':_0x333cd6[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x1b1fdc,null))[_0x81e2('0x10')](function(_0x42c8af){if(_0x42c8af){return _0x42c8af['removeAnswers'](_0x333cd6[_0x81e2('0x4d')]['ids']);}})[_0x81e2('0x10')](respondWithStatusCode(_0x1b1fdc,null))[_0x81e2('0x1b')](handleError(_0x1b1fdc,null));};exports['create']=function(_0x2fe1c7,_0x1cf630){var _0x4e9d34={'name':_0x2fe1c7[_0x81e2('0x65')][_0x81e2('0x29')],'key':_0x2fe1c7['body'][_0x81e2('0x4b')],'provider':_0x2fe1c7[_0x81e2('0x65')][_0x81e2('0x66')]==='custom'?null:_0x2fe1c7['body'][_0x81e2('0x66')],'email':_0x2fe1c7[_0x81e2('0x65')][_0x81e2('0x77')],'ListId':_0x2fe1c7[_0x81e2('0x65')][_0x81e2('0x78')],'active':!_[_0x81e2('0x79')](_0x2fe1c7[_0x81e2('0x65')]['active'])?_0x2fe1c7[_0x81e2('0x65')][_0x81e2('0x7a')]:!![],'description':_0x2fe1c7[_0x81e2('0x65')][_0x81e2('0x7b')]||null};var _0x3e00c4=getAuthenticationOptions(_0x4e9d34[_0x81e2('0x66')],_0x2fe1c7[_0x81e2('0x65')]);_0x4e9d34['Imap']=_0x3e00c4[_0x81e2('0x41')];_0x4e9d34[_0x81e2('0x42')]=_0x3e00c4[_0x81e2('0x42')];return db['MailAccount'][_0x81e2('0x72')](_0x4e9d34,{'include':[{'model':db[_0x81e2('0x45')],'as':_0x81e2('0x42')},{'model':db[_0x81e2('0x44')],'as':_0x81e2('0x41')}]})['then'](function(_0x930311){var _0x384215=_0x2fe1c7[_0x81e2('0x37')][_0x81e2('0x26')]({'plain':!![]});if(!_0x384215)throw new Error(_0x81e2('0x7c'));if(_0x384215[_0x81e2('0x7d')]===_0x81e2('0x37')){var _0x3efed3=_0x930311['get']({'plain':!![]});return db[_0x81e2('0x7e')][_0x81e2('0x69')]({'where':{'name':_0x81e2('0x27'),'userProfileId':_0x384215[_0x81e2('0x7f')]},'raw':!![]})[_0x81e2('0x10')](function(_0x5a7c3b){if(_0x5a7c3b&&_0x5a7c3b[_0x81e2('0x80')]===0x0){return db[_0x81e2('0x28')]['create']({'name':_0x3efed3[_0x81e2('0x29')],'resourceId':_0x3efed3['id'],'type':_0x5a7c3b[_0x81e2('0x29')],'sectionId':_0x5a7c3b['id']},{})[_0x81e2('0x10')](function(){return _0x930311;});}else{return _0x930311;}})[_0x81e2('0x1b')](function(_0x5a7df6){logger[_0x81e2('0x17')](_0x81e2('0x81'),_0x5a7df6);throw _0x5a7df6;});}return _0x930311;})[_0x81e2('0x10')](respondWithResult(_0x1cf630,0xc9))[_0x81e2('0x1b')](handleError(_0x1cf630,null));};exports['getImap']=function(_0x233fe6,_0x53e530){return db[_0x81e2('0x5f')][_0x81e2('0x74')]({'where':{'id':_0x233fe6[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x53e530,null))['then'](function(_0x22edee){if(_0x22edee){return _0x22edee['getImap']();}return null;})['then'](respondWithResult(_0x53e530,null))[_0x81e2('0x1b')](handleError(_0x53e530,null));};exports[_0x81e2('0x82')]=function(_0x40adab,_0x3ef986){if(_0x40adab[_0x81e2('0x65')]['id']){delete _0x40adab[_0x81e2('0x65')]['id'];}return db['MailAccount'][_0x81e2('0x69')]({'where':{'id':_0x40adab[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x3ef986,null))[_0x81e2('0x10')](function(_0x1887b0){if(_0x1887b0){_0x40adab[_0x81e2('0x65')][_0x81e2('0x6e')]=_0x1887b0['id'];return db[_0x81e2('0x44')]['create'](_0x40adab[_0x81e2('0x65')]);}})[_0x81e2('0x10')](respondWithResult(_0x3ef986,null))[_0x81e2('0x1b')](handleError(_0x3ef986,null));};exports['removeImap']=function(_0x3f7f67,_0x55738f){return db[_0x81e2('0x5f')]['findOne']({'where':{'id':_0x3f7f67[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x55738f,null))[_0x81e2('0x10')](function(_0x5bdc42){if(_0x5bdc42){return _0x5bdc42[_0x81e2('0x83')](null);}return null;})[_0x81e2('0x10')](respondWithStatusCode(_0x55738f,null))[_0x81e2('0x1b')](handleError(_0x55738f,null));};exports['getSmtp']=function(_0x2cd808,_0x79573d){return db[_0x81e2('0x5f')][_0x81e2('0x74')]({'where':{'id':_0x2cd808[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x79573d,null))[_0x81e2('0x10')](function(_0x373b8){if(_0x373b8){return _0x373b8['getSmtp']();}return null;})[_0x81e2('0x10')](respondWithResult(_0x79573d,null))[_0x81e2('0x1b')](handleError(_0x79573d,null));};exports['addSmtp']=function(_0x40c831,_0x367743){if(_0x40c831['body']['id']){delete _0x40c831[_0x81e2('0x65')]['id'];}return db[_0x81e2('0x5f')][_0x81e2('0x69')]({'where':{'id':_0x40c831[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x367743,null))[_0x81e2('0x10')](function(_0x18f1b3){if(_0x18f1b3){_0x40c831[_0x81e2('0x65')][_0x81e2('0x6e')]=_0x18f1b3['id'];return db[_0x81e2('0x45')]['create'](_0x40c831[_0x81e2('0x65')]);}})['then'](respondWithResult(_0x367743,null))[_0x81e2('0x1b')](handleError(_0x367743,null));};exports[_0x81e2('0x84')]=function(_0x1fdf69,_0x1cc97f){return db['MailAccount'][_0x81e2('0x74')]({'where':{'id':_0x1fdf69[_0x81e2('0x6d')]['id']}})['then'](handleEntityNotFound(_0x1cc97f,null))['then'](function(_0x2557fe){if(_0x2557fe){return _0x2557fe[_0x81e2('0x85')](null);}return null;})[_0x81e2('0x10')](respondWithStatusCode(_0x1cc97f,null))[_0x81e2('0x1b')](handleError(_0x1cc97f,null));};exports['addInteraction']=function(_0x2ccb0b,_0x478f26){return db['MailInteraction'][_0x81e2('0x69')]({'where':{'id':_0x2ccb0b[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x478f26,null))[_0x81e2('0x10')](function(_0x1731b4){if(_0x1731b4){return _0x1731b4[_0x81e2('0x86')](_0x2ccb0b[_0x81e2('0x65')][_0x81e2('0x87')],_[_0x81e2('0x88')](_0x2ccb0b[_0x81e2('0x65')],[_0x81e2('0x87'),'id'])||{});}})['then'](respondWithResult(_0x478f26,null))[_0x81e2('0x1b')](handleError(_0x478f26,null));};exports[_0x81e2('0x89')]=function(_0x492fc8,_0x1ac167){var _0x4daffa={'raw':![],'where':{}};var _0x1c947b={};var _0x5cbbc9={'count':0x0,'rows':[]};return db[_0x81e2('0x5f')][_0x81e2('0x74')]({'where':{'id':_0x492fc8[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x1ac167,null))[_0x81e2('0x10')](function(_0x343b1b){if(_0x343b1b){_0x1c947b[_0x81e2('0x4c')]=_[_0x81e2('0x4e')](db['MailInteraction'][_0x81e2('0x49')]);_0x1c947b[_0x81e2('0x4d')]=_[_0x81e2('0x4e')](_0x492fc8[_0x81e2('0x4d')]);_0x1c947b['filters']=_[_0x81e2('0x50')](_0x1c947b[_0x81e2('0x4c')],_0x1c947b['query']);_0x4daffa['attributes']=_[_0x81e2('0x50')](_0x1c947b[_0x81e2('0x4c')],qs[_0x81e2('0x51')](_0x492fc8[_0x81e2('0x4d')][_0x81e2('0x51')]));_0x4daffa[_0x81e2('0x52')]=_0x4daffa[_0x81e2('0x52')][_0x81e2('0x53')]?_0x4daffa['attributes']:_0x1c947b[_0x81e2('0x4c')];if(!_0x492fc8[_0x81e2('0x4d')]['hasOwnProperty']('nolimit')){_0x4daffa[_0x81e2('0x21')]=qs['limit'](_0x492fc8[_0x81e2('0x4d')][_0x81e2('0x21')]);_0x4daffa[_0x81e2('0x1f')]=qs[_0x81e2('0x1f')](_0x492fc8[_0x81e2('0x4d')]['offset']);}_0x4daffa[_0x81e2('0x56')]=qs['sort'](_0x492fc8[_0x81e2('0x4d')]['sort']);_0x4daffa[_0x81e2('0x58')]=qs[_0x81e2('0x4f')](_[_0x81e2('0x59')](_0x492fc8[_0x81e2('0x4d')],_0x1c947b[_0x81e2('0x4f')]));_0x4daffa[_0x81e2('0x58')][_0x81e2('0x6e')]=_0x343b1b['id'];if(_0x492fc8[_0x81e2('0x4d')][_0x81e2('0x5a')]){_0x4daffa[_0x81e2('0x58')]=_[_0x81e2('0x5d')](_0x4daffa[_0x81e2('0x58')],{'$or':_['map'](_0x4daffa[_0x81e2('0x52')],function(_0x5c14dd){var _0xc7c659={};_0xc7c659[_0x5c14dd]={'$like':'%'+_0x492fc8[_0x81e2('0x4d')][_0x81e2('0x5a')]+'%'};return _0xc7c659;})});}_0x4daffa=_[_0x81e2('0x5d')]({},_0x4daffa,_0x492fc8[_0x81e2('0x5e')]);return db[_0x81e2('0x8a')][_0x81e2('0x22')]({'where':_0x4daffa[_0x81e2('0x58')]})[_0x81e2('0x10')](function(_0x45d9b0){_0x5cbbc9[_0x81e2('0x22')]=_0x45d9b0;if(_0x492fc8[_0x81e2('0x4d')][_0x81e2('0x60')]){_0x4daffa['include']=[{'model':db[_0x81e2('0x8b')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x81e2('0x8c'),'attributes':[_0x81e2('0x29'),_0x81e2('0x8d'),_0x81e2('0x8e')],'required':![]},{'model':db[_0x81e2('0x8f')],'as':_0x81e2('0x90'),'attributes':['id',_0x81e2('0x29'),_0x81e2('0x91')],'where':_0x492fc8['query']['tag']?{'id':_0x492fc8[_0x81e2('0x4d')][_0x81e2('0x92')]}:undefined,'required':_0x492fc8[_0x81e2('0x4d')][_0x81e2('0x92')]?!![]:![]}];}return db['MailInteraction'][_0x81e2('0x62')](_0x4daffa);})[_0x81e2('0x10')](function(_0x41b26a){_0x5cbbc9[_0x81e2('0x63')]=_0x41b26a;return _0x5cbbc9;});}})[_0x81e2('0x10')](respondWithFilteredResult(_0x1ac167,_0x4daffa))[_0x81e2('0x1b')](handleError(_0x1ac167,null));};exports[_0x81e2('0x93')]=function addApplications(_0x49080a,_0x2ab549){var _0x4341ee=_0x49080a[_0x81e2('0x6d')]['id'];var _0x4072b3=_0x49080a[_0x81e2('0x65')];var _0x6040c8=0xc8;var _0x56fff8=null;return db[_0x81e2('0x94')][_0x81e2('0x95')]({'isolationLevel':db['sequelize']['Transaction'][_0x81e2('0x96')][_0x81e2('0x97')]},function(_0x5ad50c){return db[_0x81e2('0x5f')][_0x81e2('0x74')]({'where':{'id':_0x4341ee},'transaction':_0x5ad50c})['then'](function(_0x202649){if(_0x202649){return db[_0x81e2('0x98')][_0x81e2('0x25')]({'where':{'MailAccountId':_0x4341ee},'transaction':_0x5ad50c})['then'](function(){var _0x3baef4=_[_0x81e2('0x48')](_0x4072b3,function(_0x4ac96c){_0x4ac96c['MailAccountId']=_0x4341ee;return _0x4ac96c;});return db[_0x81e2('0x98')][_0x81e2('0x99')](_0x3baef4,{'transaction':_0x5ad50c});});}else{_0x6040c8=0x194;_0x56fff8=[];}});})[_0x81e2('0x10')](function(){if(_0x6040c8!==0x194){return db[_0x81e2('0x98')][_0x81e2('0x9a')]({'where':{'MailAccountId':_0x4341ee},'order':_0x81e2('0x9b')})[_0x81e2('0x10')](function(_0xaa3f67){_0x56fff8=_0xaa3f67;});}})['catch'](function(_0x4818a9){_0x6040c8=0x1f4;logger['error'](_0x4818a9[_0x81e2('0x9c')]);if(_0x4818a9[_0x81e2('0x29')]){delete _0x4818a9[_0x81e2('0x29')];}_0x56fff8=_0x4818a9;})[_0x81e2('0x9d')](function(){if(_0x56fff8===null){_0x2ab549[_0x81e2('0x1c')](_0x6040c8);}else{if(_0x6040c8===0x1f4){_0x2ab549[_0x81e2('0x1d')](_0x6040c8)[_0x81e2('0x2a')](_0x56fff8);}else{_0x2ab549[_0x81e2('0x1d')](_0x6040c8)[_0x81e2('0x1e')](_0x56fff8);}}});};exports[_0x81e2('0x9e')]=function(_0x317a35,_0x5d1d03){var _0x134556={};var _0x42d8fd={};var _0x9f58c3;var _0x11f02b;return db[_0x81e2('0x5f')][_0x81e2('0x74')]({'where':{'id':_0x317a35[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x5d1d03,null))[_0x81e2('0x10')](function(_0xb7d3b6){if(_0xb7d3b6){_0x9f58c3=_0xb7d3b6;_0x42d8fd['model']=_[_0x81e2('0x4e')](db[_0x81e2('0x98')][_0x81e2('0x49')]);_0x42d8fd[_0x81e2('0x4d')]=_[_0x81e2('0x4e')](_0x317a35['query']);_0x42d8fd['filters']=_[_0x81e2('0x50')](_0x42d8fd[_0x81e2('0x4c')],_0x42d8fd[_0x81e2('0x4d')]);_0x134556[_0x81e2('0x52')]=_[_0x81e2('0x50')](_0x42d8fd[_0x81e2('0x4c')],qs[_0x81e2('0x51')](_0x317a35[_0x81e2('0x4d')][_0x81e2('0x51')]));_0x134556['attributes']=_0x134556[_0x81e2('0x52')]['length']?_0x134556[_0x81e2('0x52')]:_0x42d8fd[_0x81e2('0x4c')];_0x134556['order']=qs[_0x81e2('0x57')](_0x317a35[_0x81e2('0x4d')][_0x81e2('0x57')]);_0x134556['where']=qs[_0x81e2('0x4f')](_[_0x81e2('0x59')](_0x317a35[_0x81e2('0x4d')],_0x42d8fd['filters']));if(_0x317a35[_0x81e2('0x4d')][_0x81e2('0x5a')]){_0x134556['where']=_['merge'](_0x134556[_0x81e2('0x58')],{'$or':_[_0x81e2('0x48')](_0x134556[_0x81e2('0x52')],function(_0x12c16f){var _0x48b729={};_0x48b729[_0x12c16f]={'$like':'%'+_0x317a35[_0x81e2('0x4d')]['filter']+'%'};return _0x48b729;})});}_0x134556=_[_0x81e2('0x5d')]({},_0x134556,_0x317a35['options']);return _0x9f58c3[_0x81e2('0x9e')](_0x134556);}})[_0x81e2('0x10')](function(_0x1bbe2f){if(_0x1bbe2f){_0x11f02b=_0x1bbe2f[_0x81e2('0x53')];if(!_0x317a35['query'][_0x81e2('0x54')](_0x81e2('0x55'))){_0x134556['limit']=qs['limit'](_0x317a35[_0x81e2('0x4d')][_0x81e2('0x21')]);_0x134556[_0x81e2('0x1f')]=qs[_0x81e2('0x1f')](_0x317a35['query'][_0x81e2('0x1f')]);}return _0x9f58c3['getApplications'](_0x134556);}})[_0x81e2('0x10')](function(_0x2aa8fd){if(_0x2aa8fd){return _0x2aa8fd?{'count':_0x11f02b,'rows':_0x2aa8fd}:null;}})[_0x81e2('0x10')](respondWithResult(_0x5d1d03,null))[_0x81e2('0x1b')](handleError(_0x5d1d03,null));};exports[_0x81e2('0x9f')]=function(_0x3816c9,_0x385c9d){var _0x5720d6={'raw':!![],'where':{}};var _0x27cfd={};var _0x29eba5={'count':0x0,'rows':[]};return db[_0x81e2('0x5f')]['findOne']({'where':{'id':_0x3816c9[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x385c9d,null))['then'](function(_0x19c40c){if(_0x19c40c){_0x27cfd['model']=_['keys'](db[_0x81e2('0xa0')][_0x81e2('0x49')]);_0x27cfd[_0x81e2('0x4d')]=_[_0x81e2('0x4e')](_0x3816c9[_0x81e2('0x4d')]);_0x27cfd[_0x81e2('0x4f')]=_[_0x81e2('0x50')](_0x27cfd[_0x81e2('0x4c')],_0x27cfd[_0x81e2('0x4d')]);_0x5720d6[_0x81e2('0x52')]=_[_0x81e2('0x50')](_0x27cfd[_0x81e2('0x4c')],qs['fields'](_0x3816c9[_0x81e2('0x4d')][_0x81e2('0x51')]));_0x5720d6[_0x81e2('0x52')]=_0x5720d6[_0x81e2('0x52')][_0x81e2('0x53')]?_0x5720d6[_0x81e2('0x52')]:_0x27cfd[_0x81e2('0x4c')];if(!_0x3816c9[_0x81e2('0x4d')][_0x81e2('0x54')](_0x81e2('0x55'))){_0x5720d6[_0x81e2('0x21')]=qs[_0x81e2('0x21')](_0x3816c9[_0x81e2('0x4d')][_0x81e2('0x21')]);_0x5720d6[_0x81e2('0x1f')]=qs['offset'](_0x3816c9['query'][_0x81e2('0x1f')]);}_0x5720d6['order']=qs[_0x81e2('0x57')](_0x3816c9['query'][_0x81e2('0x57')]);_0x5720d6[_0x81e2('0x58')]=qs['filters'](_[_0x81e2('0x59')](_0x3816c9[_0x81e2('0x4d')],_0x27cfd[_0x81e2('0x4f')]));_0x5720d6['where']['MailAccountId']=_0x19c40c['id'];if(_0x3816c9[_0x81e2('0x4d')][_0x81e2('0x5a')]){_0x5720d6['where']=_[_0x81e2('0x5d')](_0x5720d6[_0x81e2('0x58')],{'$or':_[_0x81e2('0x48')](_0x5720d6[_0x81e2('0x52')],function(_0x47397e){var _0x2c6a17={};_0x2c6a17[_0x47397e]={'$like':'%'+_0x3816c9[_0x81e2('0x4d')][_0x81e2('0x5a')]+'%'};return _0x2c6a17;})});}if(_0x3816c9[_0x81e2('0x4d')][_0x81e2('0xa1')]){var _0x2246e6=_0x3816c9['query'][_0x81e2('0xa1')][_0x81e2('0xa2')](',');var _0x54061a={};_0x54061a[_0x2246e6[0x0]]={'$gte':moment(_0x2246e6[0x1])[_0x81e2('0xa3')](_0x81e2('0xa4'))};_0x5720d6[_0x81e2('0x58')]=_[_0x81e2('0x5d')](_0x5720d6[_0x81e2('0x58')],_0x54061a);}_0x5720d6=_[_0x81e2('0x5d')]({},_0x5720d6,_0x3816c9[_0x81e2('0x5e')]);return db['MailMessage']['count']({'where':_0x5720d6[_0x81e2('0x58')]})[_0x81e2('0x10')](function(_0x1f916b){_0x29eba5['count']=_0x1f916b;if(_0x3816c9[_0x81e2('0x4d')][_0x81e2('0x60')]){_0x5720d6[_0x81e2('0x61')]=[{'all':!![]}];}return db[_0x81e2('0xa0')]['findAll'](_0x5720d6);})[_0x81e2('0x10')](function(_0x5a10c7){if(_0x3816c9[_0x81e2('0x4d')][_0x81e2('0xa5')]===_0x81e2('0xa6')){for(var _0x234896=0x0;_0x234896<_0x5a10c7[_0x81e2('0x53')];_0x234896++){_0x5a10c7[_0x234896][_0x81e2('0x65')]=juice(_0x5a10c7[_0x234896][_0x81e2('0x65')]);}}_0x29eba5[_0x81e2('0x63')]=_0x5a10c7;return _0x29eba5;});}})['then'](respondWithFilteredResult(_0x385c9d,_0x5720d6))[_0x81e2('0x1b')](handleError(_0x385c9d,null));};exports[_0x81e2('0x2a')]=function(_0x48f156,_0x42571d){var _0x3eeb73,_0x2e4af7={},_0x30a101;if(_0x48f156[_0x81e2('0x65')]['to']){_0x30a101=_0x48f156[_0x81e2('0x65')]['to'][_0x81e2('0xa2')](',')[0x0];}return db['MailAccount'][_0x81e2('0x69')]({'where':{'id':_0x48f156[_0x81e2('0x6d')]['id']},'include':[{'model':db[_0x81e2('0xa7')],'as':'List','include':[{'model':db[_0x81e2('0x8b')],'as':_0x81e2('0xa8'),'where':{'email':_0x30a101},'limit':0x1,'order':[[_0x81e2('0xa9'),_0x81e2('0xaa')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x81e2('0xab')],'as':_0x81e2('0xab'),'raw':!![]}]}]})[_0x81e2('0x10')](handleEntityNotFound(_0x42571d,null))[_0x81e2('0x10')](function(_0x5b4a66){if(!_0x5b4a66)return;_0x3eeb73=_0x5b4a66;if(!_0x5b4a66[_0x81e2('0x42')])throw new Error(_0x81e2('0xac'));if(_[_0x81e2('0x79')](_0x48f156[_0x81e2('0x65')][_0x81e2('0xad')])){_0x48f156[_0x81e2('0x65')][_0x81e2('0xad')]=util['format'](_0x81e2('0xae'),_0x5b4a66[_0x81e2('0x29')],_0x5b4a66['email']||_0x5b4a66[_0x81e2('0x42')][_0x81e2('0x37')]);}if(_0x48f156[_0x81e2('0x65')][_0x81e2('0xaf')]&&_0x48f156['body'][_0x81e2('0xaf')][_0x81e2('0x53')]){for(var _0x3bb5c6=0x0;_0x3bb5c6<_0x48f156['body'][_0x81e2('0xaf')][_0x81e2('0x53')];_0x3bb5c6+=0x1){_0x48f156[_0x81e2('0x65')][_0x81e2('0xaf')][_0x3bb5c6]={'filename':_0x48f156[_0x81e2('0x65')][_0x81e2('0xaf')][_0x3bb5c6][_0x81e2('0x29')],'path':path[_0x81e2('0xb0')](config[_0x81e2('0xb1')],_0x81e2('0xb2'),_0x48f156[_0x81e2('0x65')][_0x81e2('0xaf')][_0x3bb5c6][_0x81e2('0xb3')])};}}var _0x50e0aa=_0x5b4a66[_0x81e2('0xb4')]();return respondWithRpcPromise(_0x81e2('0xb5'),_0x81e2('0xb6'),{'account':_0x50e0aa,'message':_0x48f156[_0x81e2('0x65')]});})[_0x81e2('0x10')](function(_0x504457){if(!_0x504457)return;_0x2e4af7=_0x504457;if(!_0x3eeb73[_0x81e2('0xb7')])throw new Error('List\x20not\x20found');if(_0x3eeb73[_0x81e2('0xb7')][_0x81e2('0xa8')][_0x81e2('0x53')])return _0x3eeb73[_0x81e2('0xb7')][_0x81e2('0xa8')][0x0];return db[_0x81e2('0x8b')]['create'](_[_0x81e2('0x9')](_0x48f156[_0x81e2('0x65')],{'firstName':_0x48f156[_0x81e2('0x65')]['to'],'email':_0x48f156[_0x81e2('0x65')]['to'],'phone':_0x48f156['body']['to'],'ListId':_0x3eeb73[_0x81e2('0x78')]}));})['then'](function(_0x5677ad){if(!_0x5677ad)return;var _0x2be015={'UserId':_0x48f156[_0x81e2('0x37')]['id'],'ContactId':_0x5677ad['id'],'MailAccountId':_0x3eeb73['id'],'inReplyTo':_0x2e4af7[_0x81e2('0xb8')],'to':_0x48f156[_0x81e2('0x65')][_0x81e2('0xad')],'cc':_0x48f156['body']['cc'],'subject':_0x48f156[_0x81e2('0x65')][_0x81e2('0xb9')],'attach':_0x48f156[_0x81e2('0x65')][_0x81e2('0xba')],'firstMsgDirection':_0x81e2('0xbb'),'lastMsgAt':moment()[_0x81e2('0xa3')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x81e2('0x5d')](_0x48f156['body'],{'messageId':_0x2e4af7[_0x81e2('0xb8')],'sentAt':moment()['format'](_0x81e2('0xa4')),'read':!![],'MailAccountId':_0x3eeb73['id'],'UserId':_0x48f156['user']['id'],'ContactId':_0x5677ad['id']})]};if(_0x48f156['body'][_0x81e2('0xbc')]){_0x2be015=_[_0x81e2('0x5d')](_0x2be015,_0x48f156[_0x81e2('0x65')]['Interaction']);}return db['MailInteraction'][_0x81e2('0x72')](_0x2be015,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x81e2('0x10')](respondWithResult(_0x42571d,null))[_0x81e2('0x1b')](handleError(_0x42571d,null));};exports[_0x81e2('0xbd')]=function(_0x1bdf0f,_0x543d29){return db[_0x81e2('0x5f')]['find']({'where':{'id':_0x1bdf0f[_0x81e2('0x6d')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x81e2('0xab')],'as':_0x81e2('0xab'),'raw':!![]}]}]})[_0x81e2('0x10')](handleEntityNotFound(_0x543d29,null))[_0x81e2('0x10')](function(_0x3d1dfd){if(!_0x3d1dfd[_0x81e2('0x42')])return;var _0x4e3a2=_0x3d1dfd[_0x81e2('0xb4')]();return respondWithRpcPromise(_0x81e2('0xbe'),_0x81e2('0xbd'),{'account':_0x4e3a2});})[_0x81e2('0x10')](respondWithResult(_0x543d29,null))[_0x81e2('0x1b')](handleError(_0x543d29,null));};exports[_0x81e2('0x25')]=function(_0x21ca55,_0x38c871){return db[_0x81e2('0x5f')]['find']({'where':{'id':_0x21ca55[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x38c871,null))['then'](function(_0x13225d){if(_0x13225d&&_0x13225d[_0x81e2('0x3f')]){throw new db['Sequelize']['ValidationError'](_0x81e2('0xbf'));}return _0x13225d;})[_0x81e2('0x10')](removeEntity(_0x38c871,null))[_0x81e2('0x1b')](handleError(_0x38c871,null));};exports[_0x81e2('0xc0')]=function(_0x40f003,_0x51de85){return db['MailAccount']['find']({'where':{'id':_0x40f003[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0x51de85,null))['then'](function(_0x22a929){if(_0x22a929){return _0x22a929[_0x81e2('0xc0')](_0x40f003[_0x81e2('0x65')][_0x81e2('0x87')],_[_0x81e2('0x88')](_0x40f003['body'],['ids','id'])||{})[_0x81e2('0xc1')](function(_0x593d7f){for(var _0x412eab=0x0;_0x412eab<_0x40f003['body'][_0x81e2('0x87')][_0x81e2('0x53')];_0x412eab+=0x1){socket[_0x81e2('0xc2')]('userMailAccount:save',{'UserId':Number(_0x40f003[_0x81e2('0x65')]['ids'][_0x412eab]),'MailAccountId':Number(_0x40f003['params']['id'])});}return _0x593d7f;});}})['then'](respondWithResult(_0x51de85,null))[_0x81e2('0x1b')](handleError(_0x51de85,null));};exports[_0x81e2('0xc3')]=function(_0x10e9c8,_0xedd778){return db['MailAccount'][_0x81e2('0x69')]({'where':{'id':_0x10e9c8[_0x81e2('0x6d')]['id']}})[_0x81e2('0x10')](handleEntityNotFound(_0xedd778,null))['then'](function(_0x20945c){if(_0x20945c){return _0x20945c[_0x81e2('0xc3')](_0x10e9c8[_0x81e2('0x4d')]['ids'])['then'](function(){if(_['isArray'](_0x10e9c8[_0x81e2('0x4d')][_0x81e2('0x87')])){for(var _0x474ab9=0x0;_0x474ab9<_0x10e9c8[_0x81e2('0x4d')][_0x81e2('0x87')]['length'];_0x474ab9+=0x1){socket[_0x81e2('0xc2')](_0x81e2('0xc4'),{'UserId':Number(_0x10e9c8[_0x81e2('0x4d')][_0x81e2('0x87')][_0x474ab9]),'MailAccountId':Number(_0x10e9c8[_0x81e2('0x6d')]['id'])});}}else{socket['emit'](_0x81e2('0xc4'),{'UserId':Number(_0x10e9c8[_0x81e2('0x4d')][_0x81e2('0x87')]),'MailAccountId':Number(_0x10e9c8[_0x81e2('0x6d')]['id'])});}});}})[_0x81e2('0x10')](respondWithStatusCode(_0xedd778,null))[_0x81e2('0x1b')](handleError(_0xedd778,null));};exports[_0x81e2('0xc5')]=function(_0x2721b9,_0x357337){var _0x3ead45={};var _0x3547d0={};var _0x457c63;var _0x42a77f;return db['MailAccount'][_0x81e2('0x74')]({'where':{'id':_0x2721b9[_0x81e2('0x6d')]['id']}})['then'](handleEntityNotFound(_0x357337,null))[_0x81e2('0x10')](function(_0x4c533c){if(_0x4c533c){_0x457c63=_0x4c533c;_0x3547d0[_0x81e2('0x4c')]=_[_0x81e2('0x4e')](db[_0x81e2('0xc6')]['rawAttributes']);_0x3547d0[_0x81e2('0x4d')]=_[_0x81e2('0x4e')](_0x2721b9[_0x81e2('0x4d')]);_0x3547d0[_0x81e2('0x4f')]=_[_0x81e2('0x50')](_0x3547d0[_0x81e2('0x4c')],_0x3547d0['query']);_0x3ead45[_0x81e2('0x52')]=_[_0x81e2('0x50')](_0x3547d0[_0x81e2('0x4c')],qs[_0x81e2('0x51')](_0x2721b9[_0x81e2('0x4d')][_0x81e2('0x51')]));_0x3ead45[_0x81e2('0x52')]=_0x3ead45[_0x81e2('0x52')][_0x81e2('0x53')]?_0x3ead45[_0x81e2('0x52')]:_0x3547d0[_0x81e2('0x4c')];_0x3ead45[_0x81e2('0x56')]=qs[_0x81e2('0x57')](_0x2721b9[_0x81e2('0x4d')][_0x81e2('0x57')]);_0x3ead45['where']=qs[_0x81e2('0x4f')](_[_0x81e2('0x59')](_0x2721b9[_0x81e2('0x4d')],_0x3547d0[_0x81e2('0x4f')]));if(_0x2721b9['query'][_0x81e2('0x5a')]){_0x3ead45['where']=_[_0x81e2('0x5d')](_0x3ead45[_0x81e2('0x58')],{'$or':_[_0x81e2('0x48')](_0x3ead45[_0x81e2('0x52')],function(_0x1bb7e4){var _0x51c8e6={};_0x51c8e6[_0x1bb7e4]={'$like':'%'+_0x2721b9[_0x81e2('0x4d')]['filter']+'%'};return _0x51c8e6;})});}_0x3ead45=_['merge']({},_0x3ead45,_0x2721b9[_0x81e2('0x5e')]);return _0x457c63['getAgents'](_0x3ead45);}})[_0x81e2('0x10')](function(_0x774690){if(_0x774690){_0x42a77f=_0x774690[_0x81e2('0x53')];if(!_0x2721b9[_0x81e2('0x4d')][_0x81e2('0x54')](_0x81e2('0x55'))){_0x3ead45[_0x81e2('0x21')]=qs[_0x81e2('0x21')](_0x2721b9[_0x81e2('0x4d')][_0x81e2('0x21')]);_0x3ead45[_0x81e2('0x1f')]=qs[_0x81e2('0x1f')](_0x2721b9[_0x81e2('0x4d')][_0x81e2('0x1f')]);}return _0x457c63['getAgents'](_0x3ead45);}})[_0x81e2('0x10')](function(_0xc22f94){if(_0xc22f94){return _0xc22f94?{'count':_0x42a77f,'rows':_0xc22f94}:null;}})[_0x81e2('0x10')](respondWithResult(_0x357337,null))[_0x81e2('0x1b')](handleError(_0x357337,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1db867f..1fd02ec 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 _0xb296=['MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x35fa5a,_0x4af32b){var _0x43a05b=function(_0x3fed9b){while(--_0x3fed9b){_0x35fa5a['push'](_0x35fa5a['shift']());}};_0x43a05b(++_0x4af32b);}(_0xb296,0xa3));var _0x6b29=function(_0x47fd89,_0xd35aab){_0x47fd89=_0x47fd89-0x0;var _0x52d995=_0xb296[_0x47fd89];return _0x52d995;};'use strict';var EventEmitter=require(_0x6b29('0x0'));var MailAccount=require(_0x6b29('0x1'))['db'][_0x6b29('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6b29('0x3')](0x0);var events={'afterCreate':_0x6b29('0x4'),'afterUpdate':_0x6b29('0x5'),'afterDestroy':_0x6b29('0x6')};function emitEvent(_0x48e967){return function(_0x3ff65c,_0x5c1cf5,_0x50a1ba){MailAccountEvents[_0x6b29('0x7')](_0x48e967+':'+_0x3ff65c['id'],_0x3ff65c);MailAccountEvents['emit'](_0x48e967,_0x3ff65c);_0x50a1ba(null);};}for(var e in events){if(events[_0x6b29('0x8')](e)){var event=events[e];MailAccount[_0x6b29('0x9')](e,emitEvent(event));}}module[_0x6b29('0xa')]=MailAccountEvents; \ No newline at end of file +var _0xd3c8=['hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0xd3c8,0x161));var _0x8d3c=function(_0x5081d0,_0x25fadf){_0x5081d0=_0x5081d0-0x0;var _0x2869d1=_0xd3c8[_0x5081d0];return _0x2869d1;};'use strict';var EventEmitter=require(_0x8d3c('0x0'));var MailAccount=require(_0x8d3c('0x1'))['db'][_0x8d3c('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8d3c('0x3')](0x0);var events={'afterCreate':_0x8d3c('0x4'),'afterUpdate':'update','afterDestroy':_0x8d3c('0x5')};function emitEvent(_0x80b4f1){return function(_0x5508fc,_0x11aff7,_0x5480ea){MailAccountEvents[_0x8d3c('0x6')](_0x80b4f1+':'+_0x5508fc['id'],_0x5508fc);MailAccountEvents[_0x8d3c('0x6')](_0x80b4f1,_0x5508fc);_0x5480ea(null);};}for(var e in events){if(events[_0x8d3c('0x7')](e)){var event=events[e];MailAccount[_0x8d3c('0x8')](e,emitEvent(event));}}module[_0x8d3c('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index affe603..e973ee7 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 _0x0083=['custom','host','Smtp','port','authentication','modernAuthentication','CloudProvider','auth','user','data5','pass','./mailAccount.attributes','define','MailAccount','provider'];(function(_0x2d56c0,_0x3a6681){var _0x5c87fe=function(_0x539196){while(--_0x539196){_0x2d56c0['push'](_0x2d56c0['shift']());}};_0x5c87fe(++_0x3a6681);}(_0x0083,0x83));var _0x3008=function(_0x559ed8,_0x4d98b7){_0x559ed8=_0x559ed8-0x0;var _0x12cc24=_0x0083[_0x559ed8];return _0x12cc24;};'use strict';var attributes=require(_0x3008('0x0'));module['exports']=function(_0x28b828){return _0x28b828[_0x3008('0x1')](_0x3008('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3392f5=this;var _0xefccb9={'id':_0x3392f5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3392f5[_0x3008('0x3')]!==_0x3008('0x4')){_0xefccb9['service']=_0x3392f5[_0x3008('0x3')];}else{_0xefccb9[_0x3008('0x5')]=_0x3392f5[_0x3008('0x6')][_0x3008('0x5')];_0xefccb9['port']=_0x3392f5['Smtp'][_0x3008('0x7')];_0xefccb9['secure']=_0x3392f5['Smtp']['secure'];}if(_0x3392f5[_0x3008('0x6')][_0x3008('0x8')]){if(_0x3392f5[_0x3008('0x6')][_0x3008('0x9')]){if(!_0x3392f5[_0x3008('0x6')][_0x3008('0xa')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0xefccb9[_0x3008('0xb')]={'type':'OAuth2','user':_0x3392f5['Smtp'][_0x3008('0xc')],'accessToken':_0x3392f5[_0x3008('0x6')]['CloudProvider'][_0x3008('0xd')]};}else{_0xefccb9['auth']={'user':_0x3392f5[_0x3008('0x6')][_0x3008('0xc')],'pass':_0x3392f5[_0x3008('0x6')][_0x3008('0xe')]};}}return _0xefccb9;}}});}; \ No newline at end of file +var _0x0f11=['./mailAccount.attributes','MailAccount','mail_accounts','provider','service','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5'];(function(_0x5ae072,_0xa2c79c){var _0x47372c=function(_0x4a98a2){while(--_0x4a98a2){_0x5ae072['push'](_0x5ae072['shift']());}};_0x47372c(++_0xa2c79c);}(_0x0f11,0x14a));var _0x10f1=function(_0x43cbf9,_0x43bfde){_0x43cbf9=_0x43cbf9-0x0;var _0x1ff0d3=_0x0f11[_0x43cbf9];return _0x1ff0d3;};'use strict';var attributes=require(_0x10f1('0x0'));module['exports']=function(_0x83f46c){return _0x83f46c['define'](_0x10f1('0x1'),attributes,{'tableName':_0x10f1('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5e1a2c=this;var _0x52758c={'id':_0x5e1a2c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5e1a2c[_0x10f1('0x3')]!=='custom'){_0x52758c[_0x10f1('0x4')]=_0x5e1a2c[_0x10f1('0x3')];}else{_0x52758c['host']=_0x5e1a2c[_0x10f1('0x5')]['host'];_0x52758c[_0x10f1('0x6')]=_0x5e1a2c['Smtp'][_0x10f1('0x6')];_0x52758c[_0x10f1('0x7')]=_0x5e1a2c[_0x10f1('0x5')][_0x10f1('0x7')];}if(_0x5e1a2c['Smtp'][_0x10f1('0x8')]){if(_0x5e1a2c['Smtp'][_0x10f1('0x9')]){if(!_0x5e1a2c[_0x10f1('0x5')][_0x10f1('0xa')])throw new Error(_0x10f1('0xb'));_0x52758c[_0x10f1('0xc')]={'type':_0x10f1('0xd'),'user':_0x5e1a2c[_0x10f1('0x5')]['user'],'accessToken':_0x5e1a2c['Smtp']['CloudProvider'][_0x10f1('0xe')]};}else{_0x52758c[_0x10f1('0xc')]={'user':_0x5e1a2c[_0x10f1('0x5')]['user'],'pass':_0x5e1a2c['Smtp']['pass']};}}return _0x52758c;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 5f92d13..7bdf5d7 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 _0x07e8=['Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','list','applications','orderBy','priority','asc','autoclose','close','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','format','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','get','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','unshift','name','queueId','MailQueue','queue','Start','startRouting','lodash','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x07e8,0x10f));var _0x807e=function(_0xc5aa42,_0x1bdaa2){_0xc5aa42=_0xc5aa42-0x0;var _0x221d83=_0x07e8[_0xc5aa42];return _0x221d83;};'use strict';var _=require(_0x807e('0x0'));var moment=require(_0x807e('0x1'));var BPromise=require(_0x807e('0x2'));var rs=require('randomstring');var Redis=require(_0x807e('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x807e('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x807e('0x5'));var client=jayson[_0x807e('0x6')][_0x807e('0x7')]({'port':0x232c});config['redis']=_[_0x807e('0x8')](config[_0x807e('0x9')],{'host':_0x807e('0xa'),'port':0x18eb});var socket=require(_0x807e('0xb'))(new Redis(config[_0x807e('0x9')]));require('./mailAccount.socket')[_0x807e('0xc')](socket);function respondWithRpcPromise(_0x348133,_0x400374,_0x3c6c7a){return new BPromise(function(_0x1c2fdd,_0x45e953){return client[_0x807e('0xd')](_0x348133,_0x3c6c7a)[_0x807e('0xe')](function(_0x2521da){logger[_0x807e('0xf')](_0x807e('0x10'),_0x400374,_0x807e('0x11'));logger[_0x807e('0x12')](_0x807e('0x13'),_0x400374,'request\x20sent',JSON[_0x807e('0x14')](_0x2521da));if(_0x2521da[_0x807e('0x15')]){if(_0x2521da[_0x807e('0x15')][_0x807e('0x16')]===0x1f4){logger[_0x807e('0x15')](_0x807e('0x10'),_0x400374,_0x2521da[_0x807e('0x15')]['message']);return _0x45e953(_0x2521da['error'][_0x807e('0x17')]);}logger[_0x807e('0x15')](_0x807e('0x10'),_0x400374,_0x2521da[_0x807e('0x15')]['message']);return _0x1c2fdd(_0x2521da[_0x807e('0x15')][_0x807e('0x17')]);}else{logger[_0x807e('0xf')](_0x807e('0x10'),_0x400374,_0x807e('0x11'));_0x1c2fdd(_0x2521da[_0x807e('0x18')]['message']);}})[_0x807e('0x19')](function(_0x57af7a){logger[_0x807e('0x15')](_0x807e('0x10'),_0x400374,_0x57af7a);_0x45e953(_0x57af7a);});});}exports[_0x807e('0x1a')]=function(_0x45d67d){var _0x3fba0b=this;return new Promise(function(_0xad3e35,_0x1e39ef){return db[_0x807e('0x1b')][_0x807e('0x1c')]({'raw':_0x45d67d['options']?_0x45d67d['options'][_0x807e('0x1d')]===undefined?!![]:![]:!![],'where':_0x45d67d[_0x807e('0x1e')]?_0x45d67d[_0x807e('0x1e')][_0x807e('0x1f')]||null:null,'attributes':_0x45d67d[_0x807e('0x1e')]?_0x45d67d[_0x807e('0x1e')][_0x807e('0x20')]||null:null,'limit':_0x45d67d[_0x807e('0x1e')]?_0x45d67d['options'][_0x807e('0x21')]||null:null,'include':_0x45d67d[_0x807e('0x1e')]?_0x45d67d[_0x807e('0x1e')][_0x807e('0x22')]?_[_0x807e('0x23')](_0x45d67d[_0x807e('0x1e')]['include'],function(_0x277560){return{'model':db[_0x277560['model']],'as':_0x277560['as'],'attributes':_0x277560[_0x807e('0x20')],'include':_0x277560[_0x807e('0x22')]?_[_0x807e('0x23')](_0x277560['include'],function(_0x36bb30){return{'model':db[_0x36bb30[_0x807e('0x24')]],'as':_0x36bb30['as'],'attributes':_0x36bb30[_0x807e('0x20')],'include':_0x36bb30[_0x807e('0x22')]?_[_0x807e('0x23')](_0x36bb30[_0x807e('0x22')],function(_0x4cc948){return{'model':db[_0x4cc948[_0x807e('0x24')]],'as':_0x4cc948['as'],'attributes':_0x4cc948['attributes']};}):[]};}):[]};}):[]:[]})[_0x807e('0xe')](function(_0x285e27){logger[_0x807e('0xf')]('GetMailAccount',_0x45d67d);logger[_0x807e('0x12')](_0x807e('0x1a'),_0x45d67d,JSON['stringify'](_0x285e27));_0xad3e35(_0x285e27);})[_0x807e('0x19')](function(_0x11fc8d){logger['error'](_0x807e('0x1a'),_0x11fc8d[_0x807e('0x17')],_0x45d67d);_0x1e39ef(_0x3fba0b[_0x807e('0x15')](0x1f4,_0x11fc8d[_0x807e('0x17')]));});});};exports[_0x807e('0x25')]=function(_0x2a45d8){var _0x493c2a=this;return new Promise(function(_0x50a728,_0xc7c64c){return db[_0x807e('0x1b')][_0x807e('0x26')]({'raw':_0x2a45d8[_0x807e('0x1e')]?_0x2a45d8[_0x807e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2a45d8['options']?_0x2a45d8[_0x807e('0x1e')][_0x807e('0x1f')]||null:null,'attributes':_0x2a45d8['options']?_0x2a45d8[_0x807e('0x1e')][_0x807e('0x20')]||null:null,'include':_0x2a45d8[_0x807e('0x1e')]?_0x2a45d8[_0x807e('0x1e')][_0x807e('0x22')]?_[_0x807e('0x23')](_0x2a45d8[_0x807e('0x1e')][_0x807e('0x22')],function(_0x1632a7){return{'model':db[_0x1632a7[_0x807e('0x24')]],'as':_0x1632a7['as'],'attributes':_0x1632a7['attributes'],'include':_0x1632a7[_0x807e('0x22')]?_[_0x807e('0x23')](_0x1632a7[_0x807e('0x22')],function(_0x498301){return{'model':db[_0x498301[_0x807e('0x24')]],'as':_0x498301['as'],'attributes':_0x498301[_0x807e('0x20')],'include':_0x498301[_0x807e('0x22')]?_['map'](_0x498301['include'],function(_0x266017){return{'model':db[_0x266017['model']],'as':_0x266017['as'],'attributes':_0x266017['attributes']};}):[]};}):[]};}):[]:[]})[_0x807e('0xe')](function(_0x703909){if(_0x2a45d8[_0x807e('0x1e')][_0x807e('0x27')]===!![])_0x703909[_0x807e('0x28')](_0x807e('0x29'),_0x703909[_0x807e('0x2a')]());logger[_0x807e('0xf')](_0x807e('0x25'),_0x2a45d8);logger['debug']('ShowMailAccount',_0x2a45d8,JSON[_0x807e('0x14')](_0x703909));_0x50a728(_0x703909);})['catch'](function(_0x2e3eb4){logger[_0x807e('0x15')](_0x807e('0x25'),_0x2e3eb4['message'],_0x2a45d8);_0xc7c64c(_0x493c2a[_0x807e('0x15')](0x1f4,_0x2e3eb4[_0x807e('0x17')]));});});};exports[_0x807e('0x2b')]=function(_0x160a5c){var _0x56d88b=this;return new Promise(function(_0x53a3d0,_0x3a8eae){var _0x4da2b5={'body':_0x160a5c[_0x807e('0x2c')],'channel':_0x807e('0x2d')};var _0x47d331=_['difference'](_[_0x807e('0x2e')](db[_0x807e('0x2f')][_0x807e('0x30')]),[_0x807e('0x31'),_0x807e('0x32'),_0x807e('0x33'),_0x807e('0x34')]);var _0x904874=![];if(_0x160a5c[_0x807e('0x2c')]['id']){delete _0x160a5c[_0x807e('0x2c')]['id'];}if(_[_0x807e('0x35')](_0x160a5c[_0x807e('0x2c')][_0x807e('0x36')])){return _0x3a8eae(_0x56d88b['error'](0x1f4,_0x807e('0x37')));}if(_['isNil'](_0x160a5c[_0x807e('0x2c')][_0x807e('0x2c')])||_0x160a5c['body'][_0x807e('0x2c')]===''){return _0x3a8eae(_0x56d88b[_0x807e('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x160a5c['body']['mapKey'])){return _0x3a8eae(_0x56d88b[_0x807e('0x15')](0x1f4,_0x807e('0x38')+_0x47d331));}if(!_[_0x807e('0x39')](_0x47d331,_0x160a5c[_0x807e('0x2c')][_0x807e('0x3a')])){return _0x3a8eae(_0x56d88b[_0x807e('0x15')](0x1f4,_0x807e('0x3b')+_0x47d331));}var _0x58185a={};_0x58185a[_0x160a5c['body']['mapKey']]=_0x160a5c[_0x807e('0x2c')][_0x807e('0x36')];return db[_0x807e('0x1b')][_0x807e('0x26')]({'where':{'id':_0x160a5c[_0x807e('0x3c')]['id']},'include':[{'model':db[_0x807e('0x3d')],'as':'List','include':[{'model':db[_0x807e('0x2f')],'as':_0x807e('0x3e'),'where':_0x58185a,'limit':0x1,'order':[[_0x807e('0x32'),_0x807e('0x3f')]]}]},{'model':db[_0x807e('0x40')],'as':_0x807e('0x41')},{'model':db[_0x807e('0x42')],'as':_0x807e('0x43'),'include':[{'model':db[_0x807e('0x44')],'as':_0x807e('0x44')}]}]})[_0x807e('0xe')](function(_0x5b41ac){if(_0x5b41ac&&_0x5b41ac['List']){var _0x2a353f=_0x5b41ac['get']({'plain':!![]});_0x4da2b5['account']=_['omit'](_0x2a353f,['Applications',_0x807e('0x45')]);_0x4da2b5['account'][_0x807e('0x29')]=_0x5b41ac[_0x807e('0x2a')]();_0x4da2b5['applications']=_0x2a353f[_0x807e('0x41')];_0x4da2b5[_0x807e('0x46')]=_0x2a353f[_0x807e('0x45')];_0x4da2b5[_0x807e('0x47')]=_[_0x807e('0x48')](_0x4da2b5[_0x807e('0x47')],[_0x807e('0x49')],[_0x807e('0x4a')]);if(_0x4da2b5[_0x807e('0x3c')]&&_0x4da2b5[_0x807e('0x3c')][_0x807e('0x4b')]){_0x4da2b5[_0x807e('0x47')]['push']({'id':0x0,'priority':_0x4da2b5['applications']['length']+0x1,'app':_0x807e('0x4c'),'appdata':_0x807e('0x4b'),'interval':_0x807e('0x4d')});}if(_0x4da2b5[_0x807e('0x3c')][_0x807e('0x41')]){delete _0x4da2b5[_0x807e('0x3c')][_0x807e('0x41')];}if(_0x4da2b5[_0x807e('0x3c')][_0x807e('0x45')]){delete _0x4da2b5[_0x807e('0x3c')][_0x807e('0x45')];}if(_0x2a353f['List'][_0x807e('0x3e')][_0x807e('0x4e')]){return _0x2a353f[_0x807e('0x45')]['Contacts'][0x0];}var _0x2f585d=_[_0x807e('0x8')](_0x160a5c[_0x807e('0x2c')],{'firstName':_0x160a5c[_0x807e('0x2c')]['from'],'ListId':_0x2a353f['ListId']});_0x2f585d[_0x160a5c[_0x807e('0x2c')]['mapKey']]=_0x160a5c[_0x807e('0x2c')]['from'];return db[_0x807e('0x2f')][_0x807e('0x4f')](_0x2f585d);}else{throw new Error(_0x807e('0x50'));}})[_0x807e('0xe')](function(_0x469c0e){_0x4da2b5[_0x807e('0x51')]=_0x469c0e;if(_0x469c0e){if(!_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x52')]){_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x52')]=rs[_0x807e('0x53')]()+'\x20'+_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x36')];}var _0x1532de={'ContactId':_0x469c0e['id'],'MailAccountId':_0x160a5c['account']['id'],'inReplyTo':_0x160a5c['body'][_0x807e('0x17')][_0x807e('0x52')],'to':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x36')],'cc':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['cc'],'subject':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x54')],'attach':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['attach'],'lastMsgAt':moment()[_0x807e('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x807e('0x56')][_0x807e('0x26')]({'where':{'closed':![],'MailAccountId':_0x160a5c[_0x807e('0x3c')]['id']},'include':[{'model':db[_0x807e('0x57')],'as':_0x807e('0x58'),'attributes':[_0x807e('0x52')],'where':{'messageId':_0x160a5c['body'][_0x807e('0x17')]['inReplyTo']}}]})[_0x807e('0xe')](function(_0x4b2ab2){if(_0x4b2ab2){return[_0x4b2ab2,![]];}return db[_0x807e('0x56')][_0x807e('0x4f')](_0x1532de)['then'](function(_0x4bc144){return[_0x4bc144,!![]];});});}else{throw new Error(_0x807e('0x59'));}})[_0x807e('0x5a')](function(_0x545cdc,_0x11918b){if(_0x545cdc){_0x904874=_0x11918b;if(!_0x11918b){return _0x545cdc[_0x807e('0x5b')]({'inReplyTo':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['messageId'],'to':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x36')],'cc':_0x160a5c[_0x807e('0x2c')]['message']['cc'],'subject':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x54')],'attach':_0x545cdc[_0x807e('0x5c')]?_0x545cdc[_0x807e('0x5c')]:_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x5c')],'substatus':null,'substatusAt':moment()['format'](_0x807e('0x5d')),'lastMsgAt':moment()[_0x807e('0x55')](_0x807e('0x5d')),'lastMsgDirection':'in'});}else{return _0x545cdc;}}})[_0x807e('0xe')](function(_0x4207a3){_0x4da2b5[_0x807e('0x5e')]=_0x4207a3[_0x807e('0x5f')]({'plain':!![]});_0x4da2b5[_0x807e('0x5e')]['created']=_0x904874;return db[_0x807e('0x57')]['create']({'body':_0x160a5c[_0x807e('0x2c')]['body'],'MailAccountId':_0x160a5c['account']['id'],'MailInteractionId':_0x4207a3['id'],'direction':'in','ContactId':_0x4da2b5['contact']['id'],'messageId':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['messageId'],'from':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x36')],'to':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['to'],'cc':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['cc'],'subject':_0x160a5c['body'][_0x807e('0x17')]['subject'],'attach':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x5c')],'Attachments':_0x160a5c['body']['message'][_0x807e('0x60')],'originTo':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x61')],'originCc':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x62')],'bcc':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['bcc'],'ChatWebsiteId':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x63')]||null,'originChannel':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x64')]||_0x807e('0x65'),'ChatOfflineMessageId':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x807e('0x66')],'as':'Attachments'}]});})[_0x807e('0xe')](function(_0xd00729){_0x4da2b5[_0x807e('0x17')]=_0xd00729;if(!_0x4da2b5[_0x807e('0x5e')][_0x807e('0x67')]){return;}return db['User'][_0x807e('0x26')]({'attributes':['id','name'],'where':{'id':_0x4da2b5[_0x807e('0x5e')][_0x807e('0x67')]}});})['then'](function(_0x1ddf23){if(_0x1ddf23){_0x4da2b5[_0x807e('0x47')][_0x807e('0x68')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1ddf23[_0x807e('0x69')]+','+(_0x4da2b5[_0x807e('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0x807e('0x4d')});}if(!_0x4da2b5[_0x807e('0x5e')][_0x807e('0x6a')]){return;}return db[_0x807e('0x6b')]['find']({'attributes':['id',_0x807e('0x69')],'where':{'id':_0x4da2b5[_0x807e('0x5e')][_0x807e('0x6a')]}});})[_0x807e('0xe')](function(_0x5ee542){if(_0x5ee542){_0x4da2b5[_0x807e('0x47')][_0x807e('0x68')]({'id':0x0,'priority':0x1,'app':_0x807e('0x6c'),'appdata':_0x5ee542[_0x807e('0x69')]+','+(_0x4da2b5['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x807e('0x4d')});}return respondWithRpcPromise(_0x807e('0x6d'),_0x807e('0x6e'),_0x4da2b5);})[_0x807e('0xe')](function(_0x4463b6){_0x53a3d0(_0x4463b6);})[_0x807e('0x19')](function(_0x4e6968){_0x3a8eae(_0x56d88b[_0x807e('0x15')](0x1f4,_0x4e6968['message']));});});}; \ No newline at end of file +var _0x9fd4=['generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','inReplyTo','create','spread','update','attach','interaction','created','MailMessage','contact','attachments','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./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','catch','MailAccount','options','where','attributes','limit','include','map','model','GetMailAccount','ShowMailAccount','find','raw','smtp','setDataValue','smtpOptions','getSmtpOptions','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','List','get','omit','Applications','applications','list','priority','asc','autoclose','close','length','List\x20not\x20found','messageId'];(function(_0x74c392,_0x29cc28){var _0x306791=function(_0x677d58){while(--_0x677d58){_0x74c392['push'](_0x74c392['shift']());}};_0x306791(++_0x29cc28);}(_0x9fd4,0x16c));var _0x49fd=function(_0x257544,_0x524c55){_0x257544=_0x257544-0x0;var _0x589d7d=_0x9fd4[_0x257544];return _0x589d7d;};'use strict';var _=require(_0x49fd('0x0'));var moment=require(_0x49fd('0x1'));var BPromise=require(_0x49fd('0x2'));var rs=require(_0x49fd('0x3'));var Redis=require(_0x49fd('0x4'));var db=require(_0x49fd('0x5'))['db'];var logger=require(_0x49fd('0x6'))(_0x49fd('0x7'));var config=require(_0x49fd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x49fd('0x9')]({'port':0x232c});config[_0x49fd('0xa')]=_[_0x49fd('0xb')](config[_0x49fd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x49fd('0xc'))(new Redis(config[_0x49fd('0xa')]));require(_0x49fd('0xd'))[_0x49fd('0xe')](socket);function respondWithRpcPromise(_0x190807,_0x4a1c47,_0x35034c){return new BPromise(function(_0x130c9b,_0x3e1c71){return client[_0x49fd('0xf')](_0x190807,_0x35034c)[_0x49fd('0x10')](function(_0x2c6d77){logger[_0x49fd('0x11')]('MailAccount,\x20%s,\x20%s',_0x4a1c47,_0x49fd('0x12'));logger[_0x49fd('0x13')](_0x49fd('0x14'),_0x4a1c47,_0x49fd('0x12'),JSON[_0x49fd('0x15')](_0x2c6d77));if(_0x2c6d77[_0x49fd('0x16')]){if(_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x17')]===0x1f4){logger[_0x49fd('0x16')](_0x49fd('0x18'),_0x4a1c47,_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x19')]);return _0x3e1c71(_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x19')]);}logger[_0x49fd('0x16')](_0x49fd('0x18'),_0x4a1c47,_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x19')]);return _0x130c9b(_0x2c6d77[_0x49fd('0x16')][_0x49fd('0x19')]);}else{logger[_0x49fd('0x11')](_0x49fd('0x18'),_0x4a1c47,_0x49fd('0x12'));_0x130c9b(_0x2c6d77[_0x49fd('0x1a')][_0x49fd('0x19')]);}})[_0x49fd('0x1b')](function(_0x598793){logger[_0x49fd('0x16')](_0x49fd('0x18'),_0x4a1c47,_0x598793);_0x3e1c71(_0x598793);});});}exports['GetMailAccount']=function(_0x5c323a){var _0x449c9a=this;return new Promise(function(_0x53cbd1,_0x316e7c){return db[_0x49fd('0x1c')]['findAll']({'raw':_0x5c323a[_0x49fd('0x1d')]?_0x5c323a[_0x49fd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c323a[_0x49fd('0x1d')]?_0x5c323a[_0x49fd('0x1d')][_0x49fd('0x1e')]||null:null,'attributes':_0x5c323a[_0x49fd('0x1d')]?_0x5c323a[_0x49fd('0x1d')][_0x49fd('0x1f')]||null:null,'limit':_0x5c323a['options']?_0x5c323a[_0x49fd('0x1d')][_0x49fd('0x20')]||null:null,'include':_0x5c323a[_0x49fd('0x1d')]?_0x5c323a['options'][_0x49fd('0x21')]?_[_0x49fd('0x22')](_0x5c323a[_0x49fd('0x1d')]['include'],function(_0x597161){return{'model':db[_0x597161['model']],'as':_0x597161['as'],'attributes':_0x597161[_0x49fd('0x1f')],'include':_0x597161[_0x49fd('0x21')]?_[_0x49fd('0x22')](_0x597161[_0x49fd('0x21')],function(_0x9587b9){return{'model':db[_0x9587b9[_0x49fd('0x23')]],'as':_0x9587b9['as'],'attributes':_0x9587b9[_0x49fd('0x1f')],'include':_0x9587b9[_0x49fd('0x21')]?_['map'](_0x9587b9[_0x49fd('0x21')],function(_0x52b35d){return{'model':db[_0x52b35d[_0x49fd('0x23')]],'as':_0x52b35d['as'],'attributes':_0x52b35d[_0x49fd('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x203038){logger[_0x49fd('0x11')](_0x49fd('0x24'),_0x5c323a);logger[_0x49fd('0x13')](_0x49fd('0x24'),_0x5c323a,JSON[_0x49fd('0x15')](_0x203038));_0x53cbd1(_0x203038);})[_0x49fd('0x1b')](function(_0x242203){logger['error'](_0x49fd('0x24'),_0x242203['message'],_0x5c323a);_0x316e7c(_0x449c9a[_0x49fd('0x16')](0x1f4,_0x242203['message']));});});};exports[_0x49fd('0x25')]=function(_0x3c082c){var _0x390788=this;return new Promise(function(_0x492622,_0x50d304){return db['MailAccount'][_0x49fd('0x26')]({'raw':_0x3c082c[_0x49fd('0x1d')]?_0x3c082c['options'][_0x49fd('0x27')]===undefined?!![]:![]:!![],'where':_0x3c082c['options']?_0x3c082c['options'][_0x49fd('0x1e')]||null:null,'attributes':_0x3c082c[_0x49fd('0x1d')]?_0x3c082c[_0x49fd('0x1d')][_0x49fd('0x1f')]||null:null,'include':_0x3c082c[_0x49fd('0x1d')]?_0x3c082c['options']['include']?_[_0x49fd('0x22')](_0x3c082c[_0x49fd('0x1d')][_0x49fd('0x21')],function(_0x28f88f){return{'model':db[_0x28f88f['model']],'as':_0x28f88f['as'],'attributes':_0x28f88f[_0x49fd('0x1f')],'include':_0x28f88f[_0x49fd('0x21')]?_[_0x49fd('0x22')](_0x28f88f[_0x49fd('0x21')],function(_0x4363b5){return{'model':db[_0x4363b5[_0x49fd('0x23')]],'as':_0x4363b5['as'],'attributes':_0x4363b5[_0x49fd('0x1f')],'include':_0x4363b5[_0x49fd('0x21')]?_[_0x49fd('0x22')](_0x4363b5[_0x49fd('0x21')],function(_0x3762c7){return{'model':db[_0x3762c7['model']],'as':_0x3762c7['as'],'attributes':_0x3762c7[_0x49fd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x49fd('0x10')](function(_0x8dc5b3){if(_0x3c082c[_0x49fd('0x1d')][_0x49fd('0x28')]===!![])_0x8dc5b3[_0x49fd('0x29')](_0x49fd('0x2a'),_0x8dc5b3[_0x49fd('0x2b')]());logger[_0x49fd('0x11')]('ShowMailAccount',_0x3c082c);logger[_0x49fd('0x13')]('ShowMailAccount',_0x3c082c,JSON[_0x49fd('0x15')](_0x8dc5b3));_0x492622(_0x8dc5b3);})[_0x49fd('0x1b')](function(_0x523ddf){logger[_0x49fd('0x16')](_0x49fd('0x25'),_0x523ddf['message'],_0x3c082c);_0x50d304(_0x390788[_0x49fd('0x16')](0x1f4,_0x523ddf['message']));});});};exports['NotifyMailAccount']=function(_0x5f56f8){var _0x10057b=this;return new Promise(function(_0x32982e,_0x36739b){var _0x3f73d3={'body':_0x5f56f8['body'],'channel':_0x49fd('0x2c')};var _0x2c3b7d=_[_0x49fd('0x2d')](_[_0x49fd('0x2e')](db[_0x49fd('0x2f')][_0x49fd('0x30')]),[_0x49fd('0x31'),_0x49fd('0x32'),'CompanyId',_0x49fd('0x33')]);var _0x2c8ab1=![];if(_0x5f56f8['body']['id']){delete _0x5f56f8[_0x49fd('0x34')]['id'];}if(_[_0x49fd('0x35')](_0x5f56f8['body'][_0x49fd('0x36')])){return _0x36739b(_0x10057b['error'](0x1f4,_0x49fd('0x37')));}if(_[_0x49fd('0x35')](_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x34')])||_0x5f56f8['body']['body']===''){return _0x36739b(_0x10057b[_0x49fd('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x49fd('0x35')](_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x38')])){return _0x36739b(_0x10057b[_0x49fd('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c3b7d));}if(!_[_0x49fd('0x39')](_0x2c3b7d,_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x38')])){return _0x36739b(_0x10057b[_0x49fd('0x16')](0x1f4,_0x49fd('0x3a')+_0x2c3b7d));}var _0x30937f={};_0x30937f[_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x38')]]=_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x36')];return db[_0x49fd('0x1c')][_0x49fd('0x26')]({'where':{'id':_0x5f56f8[_0x49fd('0x3b')]['id']},'include':[{'model':db[_0x49fd('0x3c')],'as':'List','include':[{'model':db['CmContact'],'as':_0x49fd('0x3d'),'where':_0x30937f,'limit':0x1,'order':[[_0x49fd('0x32'),_0x49fd('0x3e')]]}]},{'model':db[_0x49fd('0x3f')],'as':'Applications'},{'model':db[_0x49fd('0x40')],'as':_0x49fd('0x41'),'include':[{'model':db['CloudProvider'],'as':_0x49fd('0x42')}]}]})[_0x49fd('0x10')](function(_0xaac56f){if(_0xaac56f&&_0xaac56f[_0x49fd('0x43')]){var _0x1316cb=_0xaac56f[_0x49fd('0x44')]({'plain':!![]});_0x3f73d3[_0x49fd('0x3b')]=_[_0x49fd('0x45')](_0x1316cb,[_0x49fd('0x46'),_0x49fd('0x43')]);_0x3f73d3[_0x49fd('0x3b')]['smtpOptions']=_0xaac56f[_0x49fd('0x2b')]();_0x3f73d3[_0x49fd('0x47')]=_0x1316cb[_0x49fd('0x46')];_0x3f73d3[_0x49fd('0x48')]=_0x1316cb[_0x49fd('0x43')];_0x3f73d3[_0x49fd('0x47')]=_['orderBy'](_0x3f73d3['applications'],[_0x49fd('0x49')],[_0x49fd('0x4a')]);if(_0x3f73d3[_0x49fd('0x3b')]&&_0x3f73d3['account'][_0x49fd('0x4b')]){_0x3f73d3[_0x49fd('0x47')]['push']({'id':0x0,'priority':_0x3f73d3['applications']['length']+0x1,'app':_0x49fd('0x4c'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x3f73d3['account'][_0x49fd('0x46')]){delete _0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x46')];}if(_0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x43')]){delete _0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x43')];}if(_0x1316cb[_0x49fd('0x43')][_0x49fd('0x3d')][_0x49fd('0x4d')]){return _0x1316cb['List'][_0x49fd('0x3d')][0x0];}var _0x202a86=_[_0x49fd('0xb')](_0x5f56f8[_0x49fd('0x34')],{'firstName':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x36')],'ListId':_0x1316cb['ListId']});_0x202a86[_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x38')]]=_0x5f56f8['body']['from'];return db[_0x49fd('0x2f')]['create'](_0x202a86);}else{throw new Error(_0x49fd('0x4e'));}})['then'](function(_0x24b5a3){_0x3f73d3['contact']=_0x24b5a3;if(_0x24b5a3){if(!_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['messageId']){_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x4f')]=rs[_0x49fd('0x50')]()+'\x20'+_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x36')];}var _0x138dcc={'ContactId':_0x24b5a3['id'],'MailAccountId':_0x5f56f8['account']['id'],'inReplyTo':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x4f')],'to':_0x5f56f8['body'][_0x49fd('0x19')][_0x49fd('0x36')],'cc':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['cc'],'subject':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x51')],'attach':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['attach'],'lastMsgAt':moment()[_0x49fd('0x52')](_0x49fd('0x53')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x49fd('0x26')]({'where':{'closed':![],'MailAccountId':_0x5f56f8[_0x49fd('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x54')]}}]})[_0x49fd('0x10')](function(_0xb1e0f3){if(_0xb1e0f3){return[_0xb1e0f3,![]];}return db['MailInteraction'][_0x49fd('0x55')](_0x138dcc)['then'](function(_0x418673){return[_0x418673,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x49fd('0x56')](function(_0x1a8da2,_0x234e2a){if(_0x1a8da2){_0x2c8ab1=_0x234e2a;if(!_0x234e2a){return _0x1a8da2[_0x49fd('0x57')]({'inReplyTo':_0x5f56f8['body'][_0x49fd('0x19')][_0x49fd('0x4f')],'to':_0x5f56f8['body'][_0x49fd('0x19')][_0x49fd('0x36')],'cc':_0x5f56f8[_0x49fd('0x34')]['message']['cc'],'subject':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x51')],'attach':_0x1a8da2[_0x49fd('0x58')]?_0x1a8da2[_0x49fd('0x58')]:_0x5f56f8[_0x49fd('0x34')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x49fd('0x52')](_0x49fd('0x53')),'lastMsgAt':moment()[_0x49fd('0x52')](_0x49fd('0x53')),'lastMsgDirection':'in'});}else{return _0x1a8da2;}}})[_0x49fd('0x10')](function(_0xdc81cf){_0x3f73d3[_0x49fd('0x59')]=_0xdc81cf[_0x49fd('0x44')]({'plain':!![]});_0x3f73d3[_0x49fd('0x59')][_0x49fd('0x5a')]=_0x2c8ab1;return db[_0x49fd('0x5b')][_0x49fd('0x55')]({'body':_0x5f56f8[_0x49fd('0x34')]['body'],'MailAccountId':_0x5f56f8[_0x49fd('0x3b')]['id'],'MailInteractionId':_0xdc81cf['id'],'direction':'in','ContactId':_0x3f73d3[_0x49fd('0x5c')]['id'],'messageId':_0x5f56f8[_0x49fd('0x34')]['message']['messageId'],'from':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x36')],'to':_0x5f56f8['body'][_0x49fd('0x19')]['to'],'cc':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['cc'],'subject':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')][_0x49fd('0x51')],'attach':_0x5f56f8[_0x49fd('0x34')]['message']['attach'],'Attachments':_0x5f56f8[_0x49fd('0x34')]['message'][_0x49fd('0x5d')],'originTo':_0x5f56f8['body']['message']['originTo'],'originCc':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['originCc'],'bcc':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['bcc'],'ChatWebsiteId':_0x5f56f8[_0x49fd('0x34')][_0x49fd('0x19')]['ChatWebsiteId']||null,'originChannel':_0x5f56f8[_0x49fd('0x34')]['message'][_0x49fd('0x5e')]||_0x49fd('0x5f'),'ChatOfflineMessageId':_0x5f56f8['body'][_0x49fd('0x19')][_0x49fd('0x60')]||null},{'include':[{'model':db['Attachment'],'as':_0x49fd('0x61')}]});})[_0x49fd('0x10')](function(_0x2e4f40){_0x3f73d3[_0x49fd('0x19')]=_0x2e4f40;if(!_0x3f73d3[_0x49fd('0x59')][_0x49fd('0x62')]){return;}return db[_0x49fd('0x63')][_0x49fd('0x26')]({'attributes':['id','name'],'where':{'id':_0x3f73d3['interaction'][_0x49fd('0x62')]}});})[_0x49fd('0x10')](function(_0x555a87){if(_0x555a87){_0x3f73d3[_0x49fd('0x47')][_0x49fd('0x64')]({'id':0x0,'priority':0x0,'app':_0x49fd('0x65'),'appdata':_0x555a87[_0x49fd('0x66')]+','+(_0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x67')]||0xa),'interval':_0x49fd('0x68')});}if(!_0x3f73d3['interaction'][_0x49fd('0x69')]){return;}return db[_0x49fd('0x6a')][_0x49fd('0x26')]({'attributes':['id',_0x49fd('0x66')],'where':{'id':_0x3f73d3[_0x49fd('0x59')][_0x49fd('0x69')]}});})[_0x49fd('0x10')](function(_0x545740){if(_0x545740){_0x3f73d3[_0x49fd('0x47')][_0x49fd('0x64')]({'id':0x0,'priority':0x1,'app':_0x49fd('0x6b'),'appdata':_0x545740[_0x49fd('0x66')]+','+(_0x3f73d3[_0x49fd('0x3b')][_0x49fd('0x6c')]||0x12c),'interval':_0x49fd('0x68')});}return respondWithRpcPromise(_0x49fd('0x6d'),_0x49fd('0x6e'),_0x3f73d3);})[_0x49fd('0x10')](function(_0x41342e){_0x32982e(_0x41342e);})[_0x49fd('0x1b')](function(_0x23a779){_0x36739b(_0x10057b[_0x49fd('0x16')](0x1f4,_0x23a779[_0x49fd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index bb36481..9a30284 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 _0x226b=['mailAccount:','./mailAccount.events','save','remove','update','removeListener','register','length'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x226b,0x161));var _0xb226=function(_0x29036f,_0x3271bf){_0x29036f=_0x29036f-0x0;var _0x3afb87=_0x226b[_0x29036f];return _0x3afb87;};'use strict';var MailAccountEvents=require(_0xb226('0x0'));var events=[_0xb226('0x1'),_0xb226('0x2'),_0xb226('0x3')];function createListener(_0x5e61be,_0x420263){return function(_0x30304e){_0x420263['emit'](_0x5e61be,_0x30304e);};}function removeListener(_0x34db55,_0x3e6a8c){return function(){MailAccountEvents[_0xb226('0x4')](_0x34db55,_0x3e6a8c);};}exports[_0xb226('0x5')]=function(_0x1db1ba){for(var _0x34fd11=0x0,_0x3fd6bc=events[_0xb226('0x6')];_0x34fd11<_0x3fd6bc;_0x34fd11++){var _0x450420=events[_0x34fd11];var _0x5ee216=createListener(_0xb226('0x7')+_0x450420,_0x1db1ba);MailAccountEvents['on'](_0x450420,_0x5ee216);}}; \ No newline at end of file +var _0x9007=['register','length','mailAccount:','./mailAccount.events','save','remove','emit','removeListener'];(function(_0x282f68,_0x239640){var _0x1aba38=function(_0x5955c8){while(--_0x5955c8){_0x282f68['push'](_0x282f68['shift']());}};_0x1aba38(++_0x239640);}(_0x9007,0x1db));var _0x7900=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x9007[_0x31bab3];return _0x4fd382;};'use strict';var MailAccountEvents=require(_0x7900('0x0'));var events=[_0x7900('0x1'),_0x7900('0x2'),'update'];function createListener(_0x368cd0,_0x2eb8a4){return function(_0x12659f){_0x2eb8a4[_0x7900('0x3')](_0x368cd0,_0x12659f);};}function removeListener(_0x46a55b,_0x299a77){return function(){MailAccountEvents[_0x7900('0x4')](_0x46a55b,_0x299a77);};}exports[_0x7900('0x5')]=function(_0x4e908b){for(var _0x13c1d2=0x0,_0x537274=events[_0x7900('0x6')];_0x13c1d2<_0x537274;_0x13c1d2++){var _0x5a75ab=events[_0x13c1d2];var _0x39508a=createListener(_0x7900('0x7')+_0x5a75ab,_0x4e908b);MailAccountEvents['on'](_0x5a75ab,_0x39508a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8f56c8e..8505b06 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 _0xe144=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','put','/:id','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x3119e7,_0x1d1253){var _0x49640d=function(_0xac293d){while(--_0xac293d){_0x3119e7['push'](_0x3119e7['shift']());}};_0x49640d(++_0x1d1253);}(_0xe144,0x1ec));var _0x4e14=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0xe144[_0x4ef734];return _0x33a7cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4e14('0x0'));var timeout=require(_0x4e14('0x1'));var express=require(_0x4e14('0x2'));var router=express[_0x4e14('0x3')]();var fs_extra=require(_0x4e14('0x4'));var auth=require(_0x4e14('0x5'));var interaction=require(_0x4e14('0x6'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x4e14('0x7')]('/:id',auth[_0x4e14('0x8')](),controller['show']);router[_0x4e14('0x9')](_0x4e14('0xa'),auth['isAuthenticated'](),controller[_0x4e14('0xb')]);router[_0x4e14('0xc')]('/:id',auth[_0x4e14('0x8')](),controller[_0x4e14('0xd')]);module[_0x4e14('0xe')]=router; \ No newline at end of file +var _0xabb0=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','update','delete'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xabb0,0x1a2));var _0x0abb=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xabb0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0abb('0x0'));var util=require(_0x0abb('0x1'));var path=require('path');var timeout=require(_0x0abb('0x2'));var express=require(_0x0abb('0x3'));var router=express['Router']();var fs_extra=require(_0x0abb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0abb('0x5'));var config=require(_0x0abb('0x6'));var controller=require(_0x0abb('0x7'));router[_0x0abb('0x8')](_0x0abb('0x9'),auth[_0x0abb('0xa')](),controller['show']);router[_0x0abb('0xb')](_0x0abb('0x9'),auth[_0x0abb('0xa')](),controller[_0x0abb('0xc')]);router[_0x0abb('0xd')](_0x0abb('0x9'),auth[_0x0abb('0xa')](),controller[_0x0abb('0xe')]);module[_0x0abb('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 58915ea..d5b99f6 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 _0x6299=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x32c154,_0xfd915b){var _0x43a11a=function(_0x4e170c){while(--_0x4e170c){_0x32c154['push'](_0x32c154['shift']());}};_0x43a11a(++_0xfd915b);}(_0x6299,0x1d7));var _0x9629=function(_0x551f37,_0x5273ae){_0x551f37=_0x551f37-0x0;var _0x1cd90e=_0x6299[_0x551f37];return _0x1cd90e;};'use strict';var Sequelize=require(_0x9629('0x0'));module[_0x9629('0x1')]={'priority':{'type':Sequelize[_0x9629('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9629('0x3')],'allowNull':![],'defaultValue':_0x9629('0x4')},'appdata':{'type':Sequelize[_0x9629('0x5')]()},'description':{'type':Sequelize[_0x9629('0x3')]},'interval':{'type':Sequelize[_0x9629('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x801a=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x483e4a,_0x32aa45){var _0x31fba5=function(_0x345bc9){while(--_0x345bc9){_0x483e4a['push'](_0x483e4a['shift']());}};_0x31fba5(++_0x32aa45);}(_0x801a,0x150));var _0xa801=function(_0x159cb9,_0x380b99){_0x159cb9=_0x159cb9-0x0;var _0x572fd3=_0x801a[_0x159cb9];return _0x572fd3;};'use strict';var Sequelize=require(_0xa801('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa801('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa801('0x2')],'allowNull':![],'defaultValue':_0xa801('0x3')},'appdata':{'type':Sequelize[_0xa801('0x4')]()},'description':{'type':Sequelize[_0xa801('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa801('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index aa81a17..81beb7b 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 _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x300c89,_0x25fcad){_0x300c89=_0x300c89-0x0;var _0x41762e=_0xbdb7[_0x300c89];return _0x41762e;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5dde711..6381256 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 _0x6bc9=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes','exports'];(function(_0x494315,_0x2d42bd){var _0x49cc18=function(_0x419de9){while(--_0x419de9){_0x494315['push'](_0x494315['shift']());}};_0x49cc18(++_0x2d42bd);}(_0x6bc9,0xf3));var _0x96bc=function(_0x5a9017,_0x4312fc){_0x5a9017=_0x5a9017-0x0;var _0x596e52=_0x6bc9[_0x5a9017];return _0x596e52;};'use strict';var _=require('lodash');var util=require(_0x96bc('0x0'));var logger=require(_0x96bc('0x1'))('api');var moment=require(_0x96bc('0x2'));var BPromise=require(_0x96bc('0x3'));var rp=require(_0x96bc('0x4'));var fs=require('fs');var path=require(_0x96bc('0x5'));var rimraf=require(_0x96bc('0x6'));var config=require('../../config/environment');var attributes=require(_0x96bc('0x7'));module[_0x96bc('0x8')]=function(_0x293b8c,_0x1bead4){return _0x293b8c[_0x96bc('0x9')](_0x96bc('0xa'),attributes,{'tableName':_0x96bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96bc('0xc'),'collate':_0x96bc('0xd')});}; \ No newline at end of file +var _0xb913=['path','rimraf','./mailApplication.attributes','exports','define','mail_applications','lodash','../../config/logger','api','bluebird'];(function(_0xd3883a,_0x3f96fe){var _0x11db0a=function(_0x288b0d){while(--_0x288b0d){_0xd3883a['push'](_0xd3883a['shift']());}};_0x11db0a(++_0x3f96fe);}(_0xb913,0x1e6));var _0x3b91=function(_0x10a0f3,_0x50328f){_0x10a0f3=_0x10a0f3-0x0;var _0x17e8cf=_0xb913[_0x10a0f3];return _0x17e8cf;};'use strict';var _=require(_0x3b91('0x0'));var util=require('util');var logger=require(_0x3b91('0x1'))(_0x3b91('0x2'));var moment=require('moment');var BPromise=require(_0x3b91('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b91('0x4'));var rimraf=require(_0x3b91('0x5'));var config=require('../../config/environment');var attributes=require(_0x3b91('0x6'));module[_0x3b91('0x7')]=function(_0x5e7324,_0x582c01){return _0x5e7324[_0x3b91('0x8')]('MailApplication',attributes,{'tableName':_0x3b91('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index b7ed7ce..721b014 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 _0x85d6=['../../config/logger','rpc','jayson/promise','client','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateMailApplication','MailApplication','update','body','options','where','info','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x85d6,0xed));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x685d('0x0'));var moment=require(_0x685d('0x1'));var BPromise=require(_0x685d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x685d('0x3'));var db=require(_0x685d('0x4'))['db'];var utils=require(_0x685d('0x5'));var logger=require(_0x685d('0x6'))(_0x685d('0x7'));var config=require('../../config/environment');var jayson=require(_0x685d('0x8'));var client=jayson[_0x685d('0x9')][_0x685d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2062fc,_0x416e38,_0x20bf51){return new BPromise(function(_0x116f97,_0x81a9dd){return client['request'](_0x2062fc,_0x20bf51)[_0x685d('0xb')](function(_0x47fa36){logger['info'](_0x685d('0xc'),_0x416e38,_0x685d('0xd'));logger[_0x685d('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x416e38,'request\x20sent',JSON['stringify'](_0x47fa36));if(_0x47fa36['error']){if(_0x47fa36[_0x685d('0xf')][_0x685d('0x10')]===0x1f4){logger[_0x685d('0xf')]('MailApplication,\x20%s,\x20%s',_0x416e38,_0x47fa36[_0x685d('0xf')][_0x685d('0x11')]);return _0x81a9dd(_0x47fa36[_0x685d('0xf')][_0x685d('0x11')]);}logger[_0x685d('0xf')]('MailApplication,\x20%s,\x20%s',_0x416e38,_0x47fa36[_0x685d('0xf')][_0x685d('0x11')]);return _0x116f97(_0x47fa36[_0x685d('0xf')][_0x685d('0x11')]);}else{logger['info'](_0x685d('0xc'),_0x416e38,_0x685d('0xd'));_0x116f97(_0x47fa36[_0x685d('0x12')][_0x685d('0x11')]);}})['catch'](function(_0x22f333){logger[_0x685d('0xf')]('MailApplication,\x20%s,\x20%s',_0x416e38,_0x22f333);_0x81a9dd(_0x22f333);});});}exports[_0x685d('0x13')]=function(_0x4289ab){var _0x528f5a=this;return new Promise(function(_0x409374,_0x113ed2){return db[_0x685d('0x14')][_0x685d('0x15')](_0x4289ab[_0x685d('0x16')],{'raw':_0x4289ab['options']?_0x4289ab[_0x685d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4289ab[_0x685d('0x17')]?_0x4289ab[_0x685d('0x17')][_0x685d('0x18')]||null:null,'attributes':_0x4289ab[_0x685d('0x17')]?_0x4289ab[_0x685d('0x17')]['attributes']||null:null,'limit':_0x4289ab[_0x685d('0x17')]?_0x4289ab[_0x685d('0x17')]['limit']||null:null})[_0x685d('0xb')](function(_0xa6cce0){logger[_0x685d('0x19')](_0x685d('0x13'),_0x4289ab);logger[_0x685d('0xe')](_0x685d('0x13'),_0x4289ab,JSON['stringify'](_0xa6cce0));_0x409374(_0xa6cce0);})[_0x685d('0x1a')](function(_0x1ccf43){logger['error'](_0x685d('0x13'),_0x1ccf43[_0x685d('0x11')],_0x4289ab);_0x113ed2(_0x528f5a[_0x685d('0xf')](0x1f4,_0x1ccf43[_0x685d('0x11')]));});});}; \ No newline at end of file +var _0xa693=['result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','limit','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xa693,0xf1));var _0x3a69=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0xa693[_0x5e9d35];return _0x3beb2e;};'use strict';var _=require(_0x3a69('0x0'));var util=require(_0x3a69('0x1'));var moment=require(_0x3a69('0x2'));var BPromise=require(_0x3a69('0x3'));var rs=require(_0x3a69('0x4'));var fs=require('fs');var Redis=require(_0x3a69('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a69('0x6'));var config=require(_0x3a69('0x7'));var jayson=require(_0x3a69('0x8'));var client=jayson[_0x3a69('0x9')][_0x3a69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x125226,_0x290e84,_0x5e7d90){return new BPromise(function(_0x1d564b,_0x2b8e2e){return client['request'](_0x125226,_0x5e7d90)['then'](function(_0x4e65a5){logger[_0x3a69('0xb')]('MailApplication,\x20%s,\x20%s',_0x290e84,_0x3a69('0xc'));logger[_0x3a69('0xd')](_0x3a69('0xe'),_0x290e84,_0x3a69('0xc'),JSON[_0x3a69('0xf')](_0x4e65a5));if(_0x4e65a5['error']){if(_0x4e65a5[_0x3a69('0x10')][_0x3a69('0x11')]===0x1f4){logger['error'](_0x3a69('0x12'),_0x290e84,_0x4e65a5[_0x3a69('0x10')][_0x3a69('0x13')]);return _0x2b8e2e(_0x4e65a5[_0x3a69('0x10')][_0x3a69('0x13')]);}logger[_0x3a69('0x10')](_0x3a69('0x12'),_0x290e84,_0x4e65a5[_0x3a69('0x10')][_0x3a69('0x13')]);return _0x1d564b(_0x4e65a5[_0x3a69('0x10')][_0x3a69('0x13')]);}else{logger[_0x3a69('0xb')]('MailApplication,\x20%s,\x20%s',_0x290e84,'request\x20sent');_0x1d564b(_0x4e65a5[_0x3a69('0x14')][_0x3a69('0x13')]);}})[_0x3a69('0x15')](function(_0x24fb29){logger[_0x3a69('0x10')](_0x3a69('0x12'),_0x290e84,_0x24fb29);_0x2b8e2e(_0x24fb29);});});}exports[_0x3a69('0x16')]=function(_0x224c7c){var _0xeb9c93=this;return new Promise(function(_0xff2a8a,_0x5ebc15){return db[_0x3a69('0x17')][_0x3a69('0x18')](_0x224c7c[_0x3a69('0x19')],{'raw':_0x224c7c['options']?_0x224c7c[_0x3a69('0x1a')][_0x3a69('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x224c7c['options']?_0x224c7c['options']['where']||null:null,'attributes':_0x224c7c[_0x3a69('0x1a')]?_0x224c7c[_0x3a69('0x1a')]['attributes']||null:null,'limit':_0x224c7c[_0x3a69('0x1a')]?_0x224c7c['options'][_0x3a69('0x1c')]||null:null})['then'](function(_0x73f3ef){logger[_0x3a69('0xb')](_0x3a69('0x16'),_0x224c7c);logger['debug'](_0x3a69('0x16'),_0x224c7c,JSON[_0x3a69('0xf')](_0x73f3ef));_0xff2a8a(_0x73f3ef);})[_0x3a69('0x15')](function(_0x5321b0){logger['error']('UpdateMailApplication',_0x5321b0[_0x3a69('0x13')],_0x224c7c);_0x5ebc15(_0xeb9c93[_0x3a69('0x10')](0x1f4,_0x5321b0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 6d2c802..c109e0a 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 _0x0b92=['update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','show','/:id/messages','/:id/download','post','create','addMessage','tracked','mail','mailinteraction:addtags','put','/:id','mailinteraction:update'];(function(_0x1cd126,_0x217049){var _0x29d149=function(_0x63a1e){while(--_0x63a1e){_0x1cd126['push'](_0x1cd126['shift']());}};_0x29d149(++_0x217049);}(_0x0b92,0xf0));var _0x20b9=function(_0x52095b,_0x27ff9f){_0x52095b=_0x52095b-0x0;var _0x34d7ac=_0x0b92[_0x52095b];return _0x34d7ac;};'use strict';var express=require(_0x20b9('0x0'));var router=express[_0x20b9('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x20b9('0x2'));var controller=require(_0x20b9('0x3'));router[_0x20b9('0x4')]('/',auth['isAuthenticated'](),controller[_0x20b9('0x5')]);router[_0x20b9('0x4')](_0x20b9('0x6'),auth[_0x20b9('0x7')](),controller['describe']);router[_0x20b9('0x4')]('/:id',auth[_0x20b9('0x7')](),controller[_0x20b9('0x8')]);router['get'](_0x20b9('0x9'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x20b9('0xa'),auth[_0x20b9('0x7')](),controller['download']);router[_0x20b9('0xb')]('/',auth['isAuthenticated'](),controller[_0x20b9('0xc')]);router[_0x20b9('0xb')]('/:id/messages',auth[_0x20b9('0x7')](),controller[_0x20b9('0xd')]);router[_0x20b9('0xb')]('/:id/tags',auth[_0x20b9('0x7')](),interaction[_0x20b9('0xe')](_0x20b9('0xf'),_0x20b9('0x10')),controller['addTags']);router[_0x20b9('0x11')](_0x20b9('0x12'),auth['isAuthenticated'](),interaction[_0x20b9('0xe')](_0x20b9('0xf'),_0x20b9('0x13')),controller[_0x20b9('0x14')]);router[_0x20b9('0x15')]('/:id',auth[_0x20b9('0x7')](),interaction[_0x20b9('0xe')](_0x20b9('0xf'),_0x20b9('0x16')),controller['destroy']);router[_0x20b9('0x15')](_0x20b9('0x17'),auth[_0x20b9('0x7')](),controller[_0x20b9('0x18')]);module[_0x20b9('0x19')]=router; \ No newline at end of file +var _0x2d11=['addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','tracked','mailinteraction:update','update','delete','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create'];(function(_0x33ccaf,_0x192235){var _0x30abf6=function(_0x2dff32){while(--_0x2dff32){_0x33ccaf['push'](_0x33ccaf['shift']());}};_0x30abf6(++_0x192235);}(_0x2d11,0xe3));var _0x12d1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2d11[_0x40a045];return _0x1a687c;};'use strict';var express=require(_0x12d1('0x0'));var router=express[_0x12d1('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x12d1('0x2'));var controller=require(_0x12d1('0x3'));router[_0x12d1('0x4')]('/',auth[_0x12d1('0x5')](),controller[_0x12d1('0x6')]);router['get'](_0x12d1('0x7'),auth[_0x12d1('0x5')](),controller[_0x12d1('0x8')]);router[_0x12d1('0x4')](_0x12d1('0x9'),auth[_0x12d1('0x5')](),controller[_0x12d1('0xa')]);router[_0x12d1('0x4')](_0x12d1('0xb'),auth[_0x12d1('0x5')](),controller[_0x12d1('0xc')]);router[_0x12d1('0x4')]('/:id/download',auth[_0x12d1('0x5')](),controller[_0x12d1('0xd')]);router[_0x12d1('0xe')]('/',auth[_0x12d1('0x5')](),controller[_0x12d1('0xf')]);router[_0x12d1('0xe')](_0x12d1('0xb'),auth[_0x12d1('0x5')](),controller[_0x12d1('0x10')]);router[_0x12d1('0xe')](_0x12d1('0x11'),auth[_0x12d1('0x5')](),interaction['tracked'](_0x12d1('0x12'),_0x12d1('0x13')),controller[_0x12d1('0x14')]);router['put'](_0x12d1('0x9'),auth[_0x12d1('0x5')](),interaction[_0x12d1('0x15')](_0x12d1('0x12'),_0x12d1('0x16')),controller[_0x12d1('0x17')]);router[_0x12d1('0x18')](_0x12d1('0x9'),auth[_0x12d1('0x5')](),interaction['tracked'](_0x12d1('0x12'),'mailinteraction:destroy'),controller['destroy']);router[_0x12d1('0x18')](_0x12d1('0x11'),auth['isAuthenticated'](),controller[_0x12d1('0x19')]);module[_0x12d1('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 8c7f82c..a910133 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 _0xc9a0=['TEXT','long','DATE','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9a0,0x1b3));var _0x0c9a=function(_0x4a17de,_0x5d896f){_0x4a17de=_0x4a17de-0x0;var _0xb7b08a=_0xc9a0[_0x4a17de];return _0xb7b08a;};'use strict';var Sequelize=require(_0x0c9a('0x0'));var iconv=require(_0x0c9a('0x1'));module[_0x0c9a('0x2')]={'closed':{'type':Sequelize[_0x0c9a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0c9a('0x4')]},'secondDisposition':{'type':Sequelize[_0x0c9a('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x0c9a('0x4')](0x1fe)},'to':{'type':Sequelize[_0x0c9a('0x4')]},'cc':{'type':Sequelize[_0x0c9a('0x5')](_0x0c9a('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x0c9a('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0c9a('0x7')]},'substatus':{'type':Sequelize[_0x0c9a('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x0c9a('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x0c9a('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0c9a('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x0c9a('0x8')]('in',_0x0c9a('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0c9a('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0c9a('0xa')]}}; \ No newline at end of file +var _0x1629=['BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','INTEGER','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1629,0x14c));var _0x9162=function(_0x4b802f,_0x34ff17){_0x4b802f=_0x4b802f-0x0;var _0x22ca4f=_0x1629[_0x4b802f];return _0x22ca4f;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x9162('0x0')]={'closed':{'type':Sequelize[_0x9162('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9162('0x2')]},'disposition':{'type':Sequelize[_0x9162('0x3')]},'secondDisposition':{'type':Sequelize[_0x9162('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9162('0x3')]},'note':{'type':Sequelize[_0x9162('0x3')]},'inReplyTo':{'type':Sequelize[_0x9162('0x3')](0x1fe)},'to':{'type':Sequelize[_0x9162('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x9162('0x4'))},'subject':{'type':Sequelize[_0x9162('0x5')]()},'attach':{'type':Sequelize[_0x9162('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9162('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x9162('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x9162('0x6')]('in',_0x9162('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9162('0x6')]('in',_0x9162('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9162('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9162('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e2fb3ee..e9698d6 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 _0x08d7=['ids','getMessages','hasOwnProperty','nolimit','order','sort','MailInteractionId','where','merge','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','root','files','tmp','format','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','bcc','createdAt','get','each','from','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','bluebird','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','register','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','update','then','stack','name','index','map','rawAttributes','fieldName','type','findAll','mail','query','user','catch','show','params','keys','MailInteraction','filters','intersection','model','attributes','fields','length','includeAll','include','options','find','create','body','destroy','describe','MailMessage','addMessage','omit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08d7,0x1f4));var _0x708d=function(_0xdc9b83,_0x446c70){_0xdc9b83=_0xdc9b83-0x0;var _0x52cd13=_0x08d7[_0xdc9b83];return _0x52cd13;};'use strict';var emlformat=require(_0x708d('0x0'));var rimraf=require(_0x708d('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x708d('0x2'));var util=require(_0x708d('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x708d('0x4'));var juice=require(_0x708d('0x5'));var Redis=require(_0x708d('0x6'));var interaction=require(_0x708d('0x7'));var qs=require(_0x708d('0x8'));var logger=require(_0x708d('0x9'))(_0x708d('0xa'));var config=require(_0x708d('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x708d('0xc')]=_['defaults'](config[_0x708d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x708d('0xd'))(new Redis(config[_0x708d('0xc')]));require('./mailInteraction.socket')[_0x708d('0xe')](socket);function respondWithStatusCode(_0x2dcfe5,_0x44b5c7){_0x44b5c7=_0x44b5c7||0xcc;return function(_0x46b198){if(_0x46b198){return _0x2dcfe5[_0x708d('0xf')](_0x44b5c7);}return _0x2dcfe5['status'](_0x44b5c7)[_0x708d('0x10')]();};}function respondWithResult(_0x1c58a0,_0x156a65){_0x156a65=_0x156a65||0xc8;return function(_0x3d83c5){if(_0x3d83c5){return _0x1c58a0['status'](_0x156a65)[_0x708d('0x11')](_0x3d83c5);}};}function respondWithFilteredResult(_0x4e7422,_0x7c032d){return function(_0x5aa220){if(_0x5aa220){var _0x2e0c67=typeof _0x7c032d['offset']===_0x708d('0x12')&&typeof _0x7c032d[_0x708d('0x13')]===_0x708d('0x12');var _0x5eb4c5=_0x5aa220[_0x708d('0x14')];var _0x3d1803=_0x2e0c67?0x0:_0x7c032d[_0x708d('0x15')];var _0x280ee9=_0x2e0c67?_0x5aa220['count']:_0x7c032d[_0x708d('0x15')]+_0x7c032d[_0x708d('0x13')];var _0x28bca3;if(_0x280ee9>=_0x5eb4c5){_0x280ee9=_0x5eb4c5;_0x28bca3=0xc8;}else{_0x28bca3=0xce;}_0x4e7422[_0x708d('0x16')](_0x28bca3);return _0x4e7422[_0x708d('0x17')](_0x708d('0x18'),_0x3d1803+'-'+_0x280ee9+'/'+_0x5eb4c5)[_0x708d('0x11')](_0x5aa220);}return null;};}function saveUpdates(_0x20377c){return function(_0x4ac651){if(_0x4ac651){return _0x4ac651[_0x708d('0x19')](_0x20377c)[_0x708d('0x1a')](function(_0x2126a4){return _0x2126a4;});}return null;};}function removeEntity(_0x523814){return function(_0x3f9975){if(_0x3f9975){return _0x3f9975['destroy']()[_0x708d('0x1a')](function(){_0x523814[_0x708d('0x16')](0xcc)[_0x708d('0x10')]();});}};}function handleEntityNotFound(_0x1c092a){return function(_0x1e04ee){if(!_0x1e04ee){_0x1c092a[_0x708d('0xf')](0x194);}return _0x1e04ee;};}function handleError(_0x49ce0f,_0x3525ec){_0x3525ec=_0x3525ec||0x1f4;return function(_0x15f6a6){logger['error'](_0x15f6a6[_0x708d('0x1b')]);if(_0x15f6a6[_0x708d('0x1c')]){delete _0x15f6a6[_0x708d('0x1c')];}_0x49ce0f['status'](_0x3525ec)['send'](_0x15f6a6);};}exports[_0x708d('0x1d')]=function(_0x4f3c03,_0x2b5473){var _0x2959bc={};var _0x231b54=_[_0x708d('0x1e')](db['MailInteraction'][_0x708d('0x1f')],function(_0x5089a5){return{'name':_0x5089a5[_0x708d('0x20')],'type':_0x5089a5[_0x708d('0x21')]['key']};});_0x2959bc=qs['getOptions'](_0x231b54,_0x4f3c03);return interaction[_0x708d('0x22')](_0x708d('0x23'),_0x4f3c03[_0x708d('0x24')],_0x4f3c03[_0x708d('0x25')],_0x2959bc,_0x231b54)[_0x708d('0x1a')](respondWithFilteredResult(_0x2b5473,_0x2959bc))[_0x708d('0x26')](handleError(_0x2b5473,null));};exports[_0x708d('0x27')]=function(_0x28f98c,_0x5be554){var _0x1ac2c5={'raw':![],'where':{'id':_0x28f98c[_0x708d('0x28')]['id']}},_0x6769c5={};_0x6769c5['model']=_[_0x708d('0x29')](db[_0x708d('0x2a')][_0x708d('0x1f')]);_0x6769c5[_0x708d('0x24')]=_[_0x708d('0x29')](_0x28f98c[_0x708d('0x24')]);_0x6769c5[_0x708d('0x2b')]=_[_0x708d('0x2c')](_0x6769c5[_0x708d('0x2d')],_0x6769c5[_0x708d('0x24')]);_0x1ac2c5[_0x708d('0x2e')]=_[_0x708d('0x2c')](_0x6769c5['model'],qs[_0x708d('0x2f')](_0x28f98c['query']['fields']));_0x1ac2c5[_0x708d('0x2e')]=_0x1ac2c5[_0x708d('0x2e')][_0x708d('0x30')]?_0x1ac2c5[_0x708d('0x2e')]:_0x6769c5[_0x708d('0x2d')];if(_0x28f98c['query'][_0x708d('0x31')]){_0x1ac2c5[_0x708d('0x32')]=[{'all':!![]}];}_0x1ac2c5=_['merge']({},_0x1ac2c5,_0x28f98c[_0x708d('0x33')]);return db['MailInteraction'][_0x708d('0x34')](_0x1ac2c5)[_0x708d('0x1a')](handleEntityNotFound(_0x5be554,null))['then'](respondWithResult(_0x5be554,null))[_0x708d('0x26')](handleError(_0x5be554,null));};exports[_0x708d('0x35')]=function(_0x28928d,_0x322faa){return db[_0x708d('0x2a')][_0x708d('0x35')](_0x28928d[_0x708d('0x36')],{})['then'](respondWithResult(_0x322faa,0xc9))[_0x708d('0x26')](handleError(_0x322faa,null));};exports[_0x708d('0x19')]=function(_0x4fc801,_0x5b45e0){if(_0x4fc801[_0x708d('0x36')]['id']){delete _0x4fc801[_0x708d('0x36')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x4fc801['params']['id']}})[_0x708d('0x1a')](handleEntityNotFound(_0x5b45e0,null))[_0x708d('0x1a')](saveUpdates(_0x4fc801['body'],null))[_0x708d('0x1a')](respondWithResult(_0x5b45e0,null))[_0x708d('0x26')](handleError(_0x5b45e0,null));};exports[_0x708d('0x37')]=function(_0x465c73,_0x234eb6){return db['MailInteraction'][_0x708d('0x34')]({'where':{'id':_0x465c73[_0x708d('0x28')]['id']}})[_0x708d('0x1a')](handleEntityNotFound(_0x234eb6,null))[_0x708d('0x1a')](removeEntity(_0x234eb6,null))[_0x708d('0x26')](handleError(_0x234eb6,null));};exports[_0x708d('0x38')]=function(_0x3d925a,_0x56b7ae){return db[_0x708d('0x2a')]['describe']()[_0x708d('0x1a')](respondWithResult(_0x56b7ae,null))[_0x708d('0x26')](handleError(_0x56b7ae,null));};exports['addMessage']=function(_0x365764,_0xa4cb00){return db[_0x708d('0x39')][_0x708d('0x34')]({'where':{'id':_0x365764['params']['id']}})['then'](handleEntityNotFound(_0xa4cb00,null))[_0x708d('0x1a')](function(_0x44e467){if(_0x44e467){return _0x44e467[_0x708d('0x3a')](_0x365764[_0x708d('0x36')]['ids'],_[_0x708d('0x3b')](_0x365764[_0x708d('0x36')],[_0x708d('0x3c'),'id'])||{});}})[_0x708d('0x1a')](respondWithResult(_0xa4cb00,null))['catch'](handleError(_0xa4cb00,null));};exports[_0x708d('0x3d')]=function(_0x4c6e5a,_0x4574e9){var _0x285a8c={'raw':![],'where':{}};var _0xc7ddb0={};var _0x2a2ec8={'count':0x0,'rows':[]};return db[_0x708d('0x2a')]['findOne']({'where':{'id':_0x4c6e5a[_0x708d('0x28')]['id']}})['then'](handleEntityNotFound(_0x4574e9,null))[_0x708d('0x1a')](function(_0x43568f){if(_0x43568f){_0xc7ddb0[_0x708d('0x2d')]=_[_0x708d('0x29')](db[_0x708d('0x39')][_0x708d('0x1f')]);_0xc7ddb0['query']=_[_0x708d('0x29')](_0x4c6e5a[_0x708d('0x24')]);_0xc7ddb0[_0x708d('0x2b')]=_[_0x708d('0x2c')](_0xc7ddb0[_0x708d('0x2d')],_0xc7ddb0[_0x708d('0x24')]);_0x285a8c['attributes']=_[_0x708d('0x2c')](_0xc7ddb0[_0x708d('0x2d')],qs[_0x708d('0x2f')](_0x4c6e5a[_0x708d('0x24')][_0x708d('0x2f')]));_0x285a8c[_0x708d('0x2e')]=_0x285a8c[_0x708d('0x2e')][_0x708d('0x30')]?_0x285a8c[_0x708d('0x2e')]:_0xc7ddb0[_0x708d('0x2d')];if(!_0x4c6e5a['query'][_0x708d('0x3e')](_0x708d('0x3f'))){_0x285a8c[_0x708d('0x13')]=qs[_0x708d('0x13')](_0x4c6e5a[_0x708d('0x24')][_0x708d('0x13')]);_0x285a8c[_0x708d('0x15')]=qs[_0x708d('0x15')](_0x4c6e5a[_0x708d('0x24')][_0x708d('0x15')]);}_0x285a8c[_0x708d('0x40')]=qs[_0x708d('0x41')](_0x4c6e5a[_0x708d('0x24')][_0x708d('0x41')]);_0x285a8c['where']=qs[_0x708d('0x2b')](_['pick'](_0x4c6e5a[_0x708d('0x24')],_0xc7ddb0[_0x708d('0x2b')]));_0x285a8c['where'][_0x708d('0x42')]=_0x43568f['id'];if(_0x4c6e5a[_0x708d('0x24')]['filter']){_0x285a8c[_0x708d('0x43')]=_[_0x708d('0x44')](_0x285a8c[_0x708d('0x43')],{'$or':_[_0x708d('0x1e')](_0x285a8c['attributes'],function(_0x4d6559){var _0xd8f76c={};_0xd8f76c[_0x4d6559]={'$like':'%'+_0x4c6e5a[_0x708d('0x24')][_0x708d('0x45')]+'%'};return _0xd8f76c;})});}if(_0x4c6e5a[_0x708d('0x24')]['$gte']){var _0x4fc972=_0x4c6e5a[_0x708d('0x24')][_0x708d('0x46')][_0x708d('0x47')](',');var _0x545b60={};_0x545b60[_0x4fc972[0x0]]={'$gte':moment(_0x4fc972[0x1])['format'](_0x708d('0x48'))};_0x285a8c[_0x708d('0x43')]=_['merge'](_0x285a8c[_0x708d('0x43')],_0x545b60);}_0x285a8c=_[_0x708d('0x44')]({},_0x285a8c,_0x4c6e5a[_0x708d('0x33')]);return db[_0x708d('0x39')][_0x708d('0x14')]({'where':_0x285a8c[_0x708d('0x43')]})[_0x708d('0x1a')](function(_0x56d6d4){_0x2a2ec8[_0x708d('0x14')]=_0x56d6d4;if(_0x4c6e5a[_0x708d('0x24')]['includeAll']){_0x285a8c[_0x708d('0x32')]=[{'all':!![]}];}return db[_0x708d('0x39')][_0x708d('0x22')](_0x285a8c);})[_0x708d('0x1a')](function(_0x23bd1d){if(_0x4c6e5a['query'][_0x708d('0x49')]===_0x708d('0x4a')){for(var _0x4169d8=0x0;_0x4169d8<_0x23bd1d['length'];_0x4169d8++){_0x23bd1d[_0x4169d8]['body']=juice(_0x23bd1d[_0x4169d8]['body']);}}_0x2a2ec8[_0x708d('0x4b')]=_0x23bd1d;return _0x2a2ec8;});}})['then'](respondWithFilteredResult(_0x4574e9,_0x285a8c))[_0x708d('0x26')](handleError(_0x4574e9,null));};exports[_0x708d('0x4c')]=function(_0x322187,_0x4d8fae){return db[_0x708d('0x2a')][_0x708d('0x34')]({'where':{'id':_0x322187[_0x708d('0x28')]['id']}})[_0x708d('0x1a')](handleEntityNotFound(_0x4d8fae,null))[_0x708d('0x1a')](function(_0x55b1a8){if(_0x55b1a8){return _0x55b1a8[_0x708d('0x4d')](_0x322187['body'][_0x708d('0x3c')],_[_0x708d('0x3b')](_0x322187[_0x708d('0x36')],['ids','id'])||{})[_0x708d('0x4e')](function(){return db[_0x708d('0x4f')][_0x708d('0x22')]({'attributes':['id',_0x708d('0x1c'),_0x708d('0x50')],'where':{'id':_0x322187[_0x708d('0x36')]['ids']}});})[_0x708d('0x1a')](function(_0x3cb517){socket[_0x708d('0x51')](_0x708d('0x52'),{'id':Number(_0x322187[_0x708d('0x28')]['id']),'tags':_0x3cb517||[]});return{'id':Number(_0x322187[_0x708d('0x28')]['id']),'tags':_0x3cb517||[]};});}})[_0x708d('0x1a')](respondWithResult(_0x4d8fae,null))[_0x708d('0x26')](handleError(_0x4d8fae,null));};exports[_0x708d('0x53')]=function(_0x24333c,_0x492913){return db[_0x708d('0x2a')][_0x708d('0x34')]({'where':{'id':_0x24333c['params']['id']}})[_0x708d('0x1a')](handleEntityNotFound(_0x492913,null))['then'](function(_0x56d10f){if(_0x56d10f){return _0x56d10f['removeTags'](_0x24333c[_0x708d('0x24')][_0x708d('0x3c')]);}})['then'](respondWithStatusCode(_0x492913,null))[_0x708d('0x26')](handleError(_0x492913,null));};exports['download']=function(_0x541c95,_0x2c500b){var _0x34d7d6=moment()[_0x708d('0x54')]()[_0x708d('0x55')]();var _0x52e008=path[_0x708d('0x56')](config[_0x708d('0x57')],'server',_0x708d('0x58'),_0x708d('0x59'));var _0x3d3f18=path[_0x708d('0x56')](config[_0x708d('0x57')],'server',_0x708d('0x58'),'attachments');var _0x4e85ea=path[_0x708d('0x56')](_0x52e008,_0x34d7d6);var _0x4af72b=util[_0x708d('0x5a')](_0x708d('0x5b'),_0x541c95[_0x708d('0x28')]['id'],_0x34d7d6);var _0x4ed857=path[_0x708d('0x56')](_0x52e008,_0x4af72b);var _0x3bc8a0=[];if(_0x541c95[_0x708d('0x24')][_0x708d('0x5c')]){_0x3bc8a0[_0x708d('0x5d')]({'model':db[_0x708d('0x5e')],'as':_0x708d('0x5f'),'raw':!![]});}var _0x20ea3c=[{'model':db[_0x708d('0x39')],'as':_0x708d('0x60'),'attributes':['id',_0x708d('0x36'),'from','to','cc',_0x708d('0x61'),'subject',_0x708d('0x62')],'where':{'secret':![]},'order':qs[_0x708d('0x41')]('id'),'include':_0x3bc8a0}];return db[_0x708d('0x2a')][_0x708d('0x34')]({'where':{'id':_0x541c95[_0x708d('0x28')]['id']},'include':_0x20ea3c})['then'](handleEntityNotFound(_0x2c500b,null))[_0x708d('0x1a')](function(_0x496c01){if(_0x496c01&&_0x496c01[_0x708d('0x60')]){var _0x3995ad=_0x496c01[_0x708d('0x63')]({'plain':!![]});fs['mkdirSync'](_0x4e85ea);return BPromise[_0x708d('0x64')](_0x3995ad[_0x708d('0x60')],function(_0x55727b,_0x4bda6a){var _0x437e4a={'from':_0x55727b[_0x708d('0x65')],'to':_0x55727b['to']||_0x708d('0x66'),'subject':_0x55727b['subject'],'html':htmlEntities['decode'](_0x55727b[_0x708d('0x36')]),'headers':{'Date':moment(_0x55727b[_0x708d('0x62')])[_0x708d('0x5a')](_0x708d('0x67'))},'attachments':[]};if(_0x55727b['cc']){_0x437e4a[_0x708d('0x68')]['Cc']=_0x55727b['cc'];}if(_0x55727b[_0x708d('0x61')]){_0x437e4a[_0x708d('0x68')]['Bcc']=_0x55727b[_0x708d('0x61')];}return new BPromise(function(_0x20cdec,_0x191f88){if(_0x55727b[_0x708d('0x5f')]){for(var _0x45c009=0x0;_0x45c009<_0x55727b[_0x708d('0x5f')][_0x708d('0x30')];_0x45c009++){var _0x15f16b=_0x55727b['Attachments'][_0x45c009];var _0x4f7366=path['join'](_0x3d3f18,_0x15f16b[_0x708d('0x69')]);if(fs[_0x708d('0x6a')](_0x4f7366)){_0x437e4a[_0x708d('0x5c')][_0x708d('0x5d')]({'name':_0x15f16b[_0x708d('0x1c')],'contentType':_0x15f16b['type'],'data':fs[_0x708d('0x6b')](_0x4f7366)});}}}emlformat[_0x708d('0x6c')](_0x437e4a,function(_0xc1718d,_0x4e9f8b){if(_0xc1718d)return _0x191f88(_0xc1718d);fs['writeFileSync'](path['join'](_0x4e85ea,util['format'](_0x708d('0x6d'),_0x4bda6a)),_0x4e9f8b);return _0x20cdec(_0x4e9f8b);});});})['then'](function(){return new BPromise(function(_0x36ab56,_0x581851){zipdir(_0x4e85ea,{'saveTo':_0x4ed857},function(_0x152da4,_0x179dec){if(_0x152da4)return _0x581851(_0x152da4);return _0x36ab56(_0x179dec);});})[_0x708d('0x1a')](function(){return new BPromise(function(_0x526641,_0x568bd8){rimraf(_0x4e85ea,function(_0x2c8511){if(_0x2c8511)_0x568bd8(_0x2c8511);return _0x526641();});});})[_0x708d('0x1a')](function(){return _0x2c500b[_0x708d('0x6e')](_0x4ed857,_0x4af72b,function(_0x52dc2d){if(!_0x52dc2d)fs[_0x708d('0x6f')](_0x4ed857);});});});}else{return _0x2c500b[_0x708d('0xf')](0xc8);}})['catch'](handleError(_0x2c500b,null));}; \ No newline at end of file +var _0x8e0a=['createdAt','get','mkdirSync','headers','bcc','Bcc','existsSync','type','build','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','util','path','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','then','destroy','end','name','send','index','map','fieldName','key','findAll','mail','query','show','params','model','MailInteraction','rawAttributes','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','update','body','describe','addMessage','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','ids','omit','spread','Tag','color','removeTags','toString','join','server','files','tmp','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','subject'];(function(_0xe6fedd,_0x3c1278){var _0x3a6beb=function(_0xdbba8e){while(--_0xdbba8e){_0xe6fedd['push'](_0xe6fedd['shift']());}};_0x3a6beb(++_0x3c1278);}(_0x8e0a,0x153));var _0xa8e0=function(_0x11a330,_0x31120e){_0x11a330=_0x11a330-0x0;var _0x5bc2c5=_0x8e0a[_0x11a330];return _0x5bc2c5;};'use strict';var emlformat=require(_0xa8e0('0x0'));var rimraf=require(_0xa8e0('0x1'));var zipdir=require('zip-dir');var moment=require(_0xa8e0('0x2'));var BPromise=require('bluebird');var util=require(_0xa8e0('0x3'));var path=require(_0xa8e0('0x4'));var fs=require('fs');var _=require(_0xa8e0('0x5'));var juice=require(_0xa8e0('0x6'));var Redis=require(_0xa8e0('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa8e0('0x8'));var config=require(_0xa8e0('0x9'));var db=require(_0xa8e0('0xa'))['db'];var htmlEntities=require(_0xa8e0('0xb'));config[_0xa8e0('0xc')]=_['defaults'](config[_0xa8e0('0xc')],{'host':_0xa8e0('0xd'),'port':0x18eb});var socket=require(_0xa8e0('0xe'))(new Redis(config['redis']));require(_0xa8e0('0xf'))[_0xa8e0('0x10')](socket);function respondWithStatusCode(_0x254db7,_0x217b29){_0x217b29=_0x217b29||0xcc;return function(_0x19deef){if(_0x19deef){return _0x254db7[_0xa8e0('0x11')](_0x217b29);}return _0x254db7[_0xa8e0('0x12')](_0x217b29)['end']();};}function respondWithResult(_0xa6055b,_0x677c61){_0x677c61=_0x677c61||0xc8;return function(_0x5a161f){if(_0x5a161f){return _0xa6055b['status'](_0x677c61)[_0xa8e0('0x13')](_0x5a161f);}};}function respondWithFilteredResult(_0x3bc635,_0x3c0666){return function(_0x5cd2fe){if(_0x5cd2fe){var _0x2df664=typeof _0x3c0666[_0xa8e0('0x14')]===_0xa8e0('0x15')&&typeof _0x3c0666[_0xa8e0('0x16')]===_0xa8e0('0x15');var _0x3b98d2=_0x5cd2fe[_0xa8e0('0x17')];var _0x526142=_0x2df664?0x0:_0x3c0666['offset'];var _0x338c3e=_0x2df664?_0x5cd2fe[_0xa8e0('0x17')]:_0x3c0666[_0xa8e0('0x14')]+_0x3c0666[_0xa8e0('0x16')];var _0x479f16;if(_0x338c3e>=_0x3b98d2){_0x338c3e=_0x3b98d2;_0x479f16=0xc8;}else{_0x479f16=0xce;}_0x3bc635[_0xa8e0('0x12')](_0x479f16);return _0x3bc635['set'](_0xa8e0('0x18'),_0x526142+'-'+_0x338c3e+'/'+_0x3b98d2)[_0xa8e0('0x13')](_0x5cd2fe);}return null;};}function saveUpdates(_0x54602d){return function(_0x22cb78){if(_0x22cb78){return _0x22cb78['update'](_0x54602d)[_0xa8e0('0x19')](function(_0x5b1751){return _0x5b1751;});}return null;};}function removeEntity(_0x45e33e){return function(_0x35ba47){if(_0x35ba47){return _0x35ba47[_0xa8e0('0x1a')]()[_0xa8e0('0x19')](function(){_0x45e33e[_0xa8e0('0x12')](0xcc)[_0xa8e0('0x1b')]();});}};}function handleEntityNotFound(_0x32ef4b){return function(_0x1d4554){if(!_0x1d4554){_0x32ef4b['sendStatus'](0x194);}return _0x1d4554;};}function handleError(_0x4141d1,_0x5894bb){_0x5894bb=_0x5894bb||0x1f4;return function(_0x1c252a){logger['error'](_0x1c252a['stack']);if(_0x1c252a[_0xa8e0('0x1c')]){delete _0x1c252a[_0xa8e0('0x1c')];}_0x4141d1[_0xa8e0('0x12')](_0x5894bb)[_0xa8e0('0x1d')](_0x1c252a);};}exports[_0xa8e0('0x1e')]=function(_0x4827cb,_0x5ca4a1){var _0x41ca3b={};var _0x47d17d=_[_0xa8e0('0x1f')](db['MailInteraction']['rawAttributes'],function(_0x1e5981){return{'name':_0x1e5981[_0xa8e0('0x20')],'type':_0x1e5981['type'][_0xa8e0('0x21')]};});_0x41ca3b=qs['getOptions'](_0x47d17d,_0x4827cb);return interaction[_0xa8e0('0x22')](_0xa8e0('0x23'),_0x4827cb[_0xa8e0('0x24')],_0x4827cb['user'],_0x41ca3b,_0x47d17d)[_0xa8e0('0x19')](respondWithFilteredResult(_0x5ca4a1,_0x41ca3b))['catch'](handleError(_0x5ca4a1,null));};exports[_0xa8e0('0x25')]=function(_0x2e9dcf,_0x3e8804){var _0x21f1e3={'raw':![],'where':{'id':_0x2e9dcf[_0xa8e0('0x26')]['id']}},_0x3750cc={};_0x3750cc[_0xa8e0('0x27')]=_['keys'](db[_0xa8e0('0x28')][_0xa8e0('0x29')]);_0x3750cc['query']=_[_0xa8e0('0x2a')](_0x2e9dcf['query']);_0x3750cc[_0xa8e0('0x2b')]=_[_0xa8e0('0x2c')](_0x3750cc[_0xa8e0('0x27')],_0x3750cc[_0xa8e0('0x24')]);_0x21f1e3[_0xa8e0('0x2d')]=_[_0xa8e0('0x2c')](_0x3750cc[_0xa8e0('0x27')],qs[_0xa8e0('0x2e')](_0x2e9dcf['query'][_0xa8e0('0x2e')]));_0x21f1e3[_0xa8e0('0x2d')]=_0x21f1e3['attributes'][_0xa8e0('0x2f')]?_0x21f1e3['attributes']:_0x3750cc[_0xa8e0('0x27')];if(_0x2e9dcf[_0xa8e0('0x24')][_0xa8e0('0x30')]){_0x21f1e3[_0xa8e0('0x31')]=[{'all':!![]}];}_0x21f1e3=_[_0xa8e0('0x32')]({},_0x21f1e3,_0x2e9dcf[_0xa8e0('0x33')]);return db[_0xa8e0('0x28')][_0xa8e0('0x34')](_0x21f1e3)[_0xa8e0('0x19')](handleEntityNotFound(_0x3e8804,null))[_0xa8e0('0x19')](respondWithResult(_0x3e8804,null))[_0xa8e0('0x35')](handleError(_0x3e8804,null));};exports[_0xa8e0('0x36')]=function(_0x39abf3,_0x160c6b){return db[_0xa8e0('0x28')]['create'](_0x39abf3['body'],{})[_0xa8e0('0x19')](respondWithResult(_0x160c6b,0xc9))['catch'](handleError(_0x160c6b,null));};exports[_0xa8e0('0x37')]=function(_0xc381a2,_0xad932e){if(_0xc381a2['body']['id']){delete _0xc381a2[_0xa8e0('0x38')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0xc381a2[_0xa8e0('0x26')]['id']}})[_0xa8e0('0x19')](handleEntityNotFound(_0xad932e,null))[_0xa8e0('0x19')](saveUpdates(_0xc381a2[_0xa8e0('0x38')],null))[_0xa8e0('0x19')](respondWithResult(_0xad932e,null))[_0xa8e0('0x35')](handleError(_0xad932e,null));};exports[_0xa8e0('0x1a')]=function(_0x26f849,_0x23a854){return db[_0xa8e0('0x28')][_0xa8e0('0x34')]({'where':{'id':_0x26f849[_0xa8e0('0x26')]['id']}})['then'](handleEntityNotFound(_0x23a854,null))['then'](removeEntity(_0x23a854,null))[_0xa8e0('0x35')](handleError(_0x23a854,null));};exports[_0xa8e0('0x39')]=function(_0x4cc31f,_0x43dd7c){return db[_0xa8e0('0x28')]['describe']()[_0xa8e0('0x19')](respondWithResult(_0x43dd7c,null))[_0xa8e0('0x35')](handleError(_0x43dd7c,null));};exports[_0xa8e0('0x3a')]=function(_0x31ab20,_0x13b957){return db['MailMessage'][_0xa8e0('0x34')]({'where':{'id':_0x31ab20[_0xa8e0('0x26')]['id']}})[_0xa8e0('0x19')](handleEntityNotFound(_0x13b957,null))['then'](function(_0xdcfb9b){if(_0xdcfb9b){return _0xdcfb9b[_0xa8e0('0x3a')](_0x31ab20[_0xa8e0('0x38')]['ids'],_['omit'](_0x31ab20[_0xa8e0('0x38')],['ids','id'])||{});}})[_0xa8e0('0x19')](respondWithResult(_0x13b957,null))[_0xa8e0('0x35')](handleError(_0x13b957,null));};exports[_0xa8e0('0x3b')]=function(_0x2fc295,_0x11e0d9){var _0x364de5={'raw':![],'where':{}};var _0x1d0a94={};var _0x2e6b77={'count':0x0,'rows':[]};return db[_0xa8e0('0x28')][_0xa8e0('0x3c')]({'where':{'id':_0x2fc295[_0xa8e0('0x26')]['id']}})['then'](handleEntityNotFound(_0x11e0d9,null))[_0xa8e0('0x19')](function(_0xbeb1d4){if(_0xbeb1d4){_0x1d0a94[_0xa8e0('0x27')]=_[_0xa8e0('0x2a')](db[_0xa8e0('0x3d')][_0xa8e0('0x29')]);_0x1d0a94[_0xa8e0('0x24')]=_[_0xa8e0('0x2a')](_0x2fc295['query']);_0x1d0a94['filters']=_[_0xa8e0('0x2c')](_0x1d0a94[_0xa8e0('0x27')],_0x1d0a94[_0xa8e0('0x24')]);_0x364de5[_0xa8e0('0x2d')]=_[_0xa8e0('0x2c')](_0x1d0a94[_0xa8e0('0x27')],qs[_0xa8e0('0x2e')](_0x2fc295['query'][_0xa8e0('0x2e')]));_0x364de5[_0xa8e0('0x2d')]=_0x364de5[_0xa8e0('0x2d')][_0xa8e0('0x2f')]?_0x364de5['attributes']:_0x1d0a94[_0xa8e0('0x27')];if(!_0x2fc295[_0xa8e0('0x24')][_0xa8e0('0x3e')](_0xa8e0('0x3f'))){_0x364de5[_0xa8e0('0x16')]=qs[_0xa8e0('0x16')](_0x2fc295[_0xa8e0('0x24')][_0xa8e0('0x16')]);_0x364de5[_0xa8e0('0x14')]=qs['offset'](_0x2fc295[_0xa8e0('0x24')][_0xa8e0('0x14')]);}_0x364de5[_0xa8e0('0x40')]=qs[_0xa8e0('0x41')](_0x2fc295['query'][_0xa8e0('0x41')]);_0x364de5[_0xa8e0('0x42')]=qs[_0xa8e0('0x2b')](_[_0xa8e0('0x43')](_0x2fc295[_0xa8e0('0x24')],_0x1d0a94['filters']));_0x364de5['where'][_0xa8e0('0x44')]=_0xbeb1d4['id'];if(_0x2fc295[_0xa8e0('0x24')][_0xa8e0('0x45')]){_0x364de5['where']=_[_0xa8e0('0x32')](_0x364de5['where'],{'$or':_['map'](_0x364de5[_0xa8e0('0x2d')],function(_0x55d5dd){var _0x1d5520={};_0x1d5520[_0x55d5dd]={'$like':'%'+_0x2fc295['query'][_0xa8e0('0x45')]+'%'};return _0x1d5520;})});}if(_0x2fc295[_0xa8e0('0x24')][_0xa8e0('0x46')]){var _0x4b3276=_0x2fc295[_0xa8e0('0x24')][_0xa8e0('0x46')][_0xa8e0('0x47')](',');var _0x5c41ef={};_0x5c41ef[_0x4b3276[0x0]]={'$gte':moment(_0x4b3276[0x1])[_0xa8e0('0x48')](_0xa8e0('0x49'))};_0x364de5['where']=_[_0xa8e0('0x32')](_0x364de5[_0xa8e0('0x42')],_0x5c41ef);}_0x364de5=_[_0xa8e0('0x32')]({},_0x364de5,_0x2fc295[_0xa8e0('0x33')]);return db[_0xa8e0('0x3d')][_0xa8e0('0x17')]({'where':_0x364de5[_0xa8e0('0x42')]})[_0xa8e0('0x19')](function(_0x3148bc){_0x2e6b77[_0xa8e0('0x17')]=_0x3148bc;if(_0x2fc295[_0xa8e0('0x24')][_0xa8e0('0x30')]){_0x364de5[_0xa8e0('0x31')]=[{'all':!![]}];}return db[_0xa8e0('0x3d')][_0xa8e0('0x22')](_0x364de5);})[_0xa8e0('0x19')](function(_0x4e7ef3){if(_0x2fc295['query'][_0xa8e0('0x4a')]===_0xa8e0('0x4b')){for(var _0x121fba=0x0;_0x121fba<_0x4e7ef3[_0xa8e0('0x2f')];_0x121fba++){_0x4e7ef3[_0x121fba]['body']=juice(_0x4e7ef3[_0x121fba]['body']);}}_0x2e6b77[_0xa8e0('0x4c')]=_0x4e7ef3;return _0x2e6b77;});}})['then'](respondWithFilteredResult(_0x11e0d9,_0x364de5))[_0xa8e0('0x35')](handleError(_0x11e0d9,null));};exports[_0xa8e0('0x4d')]=function(_0x3e3f40,_0x8dcd63){return db['MailInteraction'][_0xa8e0('0x34')]({'where':{'id':_0x3e3f40['params']['id']}})[_0xa8e0('0x19')](handleEntityNotFound(_0x8dcd63,null))[_0xa8e0('0x19')](function(_0x399086){if(_0x399086){return _0x399086[_0xa8e0('0x4e')](_0x3e3f40[_0xa8e0('0x38')][_0xa8e0('0x4f')],_[_0xa8e0('0x50')](_0x3e3f40['body'],[_0xa8e0('0x4f'),'id'])||{})[_0xa8e0('0x51')](function(){return db[_0xa8e0('0x52')][_0xa8e0('0x22')]({'attributes':['id',_0xa8e0('0x1c'),_0xa8e0('0x53')],'where':{'id':_0x3e3f40[_0xa8e0('0x38')]['ids']}});})[_0xa8e0('0x19')](function(_0x5e9255){socket['emit']('mailInteractionTags:save',{'id':Number(_0x3e3f40['params']['id']),'tags':_0x5e9255||[]});return{'id':Number(_0x3e3f40[_0xa8e0('0x26')]['id']),'tags':_0x5e9255||[]};});}})['then'](respondWithResult(_0x8dcd63,null))[_0xa8e0('0x35')](handleError(_0x8dcd63,null));};exports[_0xa8e0('0x54')]=function(_0x3a05ec,_0x38a4e8){return db[_0xa8e0('0x28')][_0xa8e0('0x34')]({'where':{'id':_0x3a05ec[_0xa8e0('0x26')]['id']}})['then'](handleEntityNotFound(_0x38a4e8,null))['then'](function(_0x3fae81){if(_0x3fae81){return _0x3fae81[_0xa8e0('0x54')](_0x3a05ec['query'][_0xa8e0('0x4f')]);}})[_0xa8e0('0x19')](respondWithStatusCode(_0x38a4e8,null))[_0xa8e0('0x35')](handleError(_0x38a4e8,null));};exports['download']=function(_0x254ec5,_0x19b3d7){var _0x731314=moment()['unix']()[_0xa8e0('0x55')]();var _0x23f00a=path[_0xa8e0('0x56')](config['root'],_0xa8e0('0x57'),_0xa8e0('0x58'),_0xa8e0('0x59'));var _0x404e32=path['join'](config['root'],_0xa8e0('0x57'),_0xa8e0('0x58'),'attachments');var _0x489a52=path[_0xa8e0('0x56')](_0x23f00a,_0x731314);var _0x21e42c=util[_0xa8e0('0x48')](_0xa8e0('0x5a'),_0x254ec5[_0xa8e0('0x26')]['id'],_0x731314);var _0x450e63=path[_0xa8e0('0x56')](_0x23f00a,_0x21e42c);var _0x408a9b=[];if(_0x254ec5['query']['attachments']){_0x408a9b[_0xa8e0('0x5b')]({'model':db[_0xa8e0('0x5c')],'as':_0xa8e0('0x5d'),'raw':!![]});}var _0x3df6d9=[{'model':db[_0xa8e0('0x3d')],'as':_0xa8e0('0x5e'),'attributes':['id',_0xa8e0('0x38'),_0xa8e0('0x5f'),'to','cc','bcc',_0xa8e0('0x60'),_0xa8e0('0x61')],'where':{'secret':![]},'order':qs[_0xa8e0('0x41')]('id'),'include':_0x408a9b}];return db[_0xa8e0('0x28')][_0xa8e0('0x34')]({'where':{'id':_0x254ec5[_0xa8e0('0x26')]['id']},'include':_0x3df6d9})[_0xa8e0('0x19')](handleEntityNotFound(_0x19b3d7,null))['then'](function(_0x1416ca){if(_0x1416ca&&_0x1416ca[_0xa8e0('0x5e')]){var _0x1cfe56=_0x1416ca[_0xa8e0('0x62')]({'plain':!![]});fs[_0xa8e0('0x63')](_0x489a52);return BPromise['each'](_0x1cfe56[_0xa8e0('0x5e')],function(_0x22652d,_0x9873a9){var _0x3fd171={'from':_0x22652d[_0xa8e0('0x5f')],'to':_0x22652d['to']||'missing.recipient@your.company.com','subject':_0x22652d[_0xa8e0('0x60')],'html':htmlEntities['decode'](_0x22652d['body']),'headers':{'Date':moment(_0x22652d[_0xa8e0('0x61')])[_0xa8e0('0x48')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x22652d['cc']){_0x3fd171[_0xa8e0('0x64')]['Cc']=_0x22652d['cc'];}if(_0x22652d[_0xa8e0('0x65')]){_0x3fd171[_0xa8e0('0x64')][_0xa8e0('0x66')]=_0x22652d['bcc'];}return new BPromise(function(_0x475335,_0x45c618){if(_0x22652d[_0xa8e0('0x5d')]){for(var _0x742b90=0x0;_0x742b90<_0x22652d[_0xa8e0('0x5d')][_0xa8e0('0x2f')];_0x742b90++){var _0x191d3d=_0x22652d[_0xa8e0('0x5d')][_0x742b90];var _0x369339=path['join'](_0x404e32,_0x191d3d['basename']);if(fs[_0xa8e0('0x67')](_0x369339)){_0x3fd171['attachments']['push']({'name':_0x191d3d[_0xa8e0('0x1c')],'contentType':_0x191d3d[_0xa8e0('0x68')],'data':fs['readFileSync'](_0x369339)});}}}emlformat[_0xa8e0('0x69')](_0x3fd171,function(_0x359781,_0x2734c6){if(_0x359781)return _0x45c618(_0x359781);fs['writeFileSync'](path[_0xa8e0('0x56')](_0x489a52,util[_0xa8e0('0x48')](_0xa8e0('0x6a'),_0x9873a9)),_0x2734c6);return _0x475335(_0x2734c6);});});})[_0xa8e0('0x19')](function(){return new BPromise(function(_0x357161,_0x1beaec){zipdir(_0x489a52,{'saveTo':_0x450e63},function(_0x5179a8,_0x1c40af){if(_0x5179a8)return _0x1beaec(_0x5179a8);return _0x357161(_0x1c40af);});})[_0xa8e0('0x19')](function(){return new BPromise(function(_0x5ab7d2,_0x36686a){rimraf(_0x489a52,function(_0x5efe32){if(_0x5efe32)_0x36686a(_0x5efe32);return _0x5ab7d2();});});})['then'](function(){return _0x19b3d7[_0xa8e0('0x6b')](_0x450e63,_0x21e42c,function(_0x28d12e){if(!_0x28d12e)fs[_0xa8e0('0x6c')](_0x450e63);});});});}else{return _0x19b3d7[_0xa8e0('0x11')](0xc8);}})[_0xa8e0('0x35')](handleError(_0x19b3d7,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c44160a..0e7ae77 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 _0xd894=['catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit'];(function(_0x472356,_0x1f4629){var _0x2a5194=function(_0x153861){while(--_0x153861){_0x472356['push'](_0x472356['shift']());}};_0x2a5194(++_0x1f4629);}(_0xd894,0x16c));var _0x4d89=function(_0x52fbd8,_0x23925a){_0x52fbd8=_0x52fbd8-0x0;var _0x452193=_0xd894[_0x52fbd8];return _0x452193;};'use strict';var EventEmitter=require(_0x4d89('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x4d89('0x1')];var MailMessage=require(_0x4d89('0x2'))['db'][_0x4d89('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4d89('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d89('0x5'),'afterDestroy':_0x4d89('0x6')};function emitEvent(_0x89fafd){return function(_0xcbad04,_0x5095e4,_0x1ceecd){_0xcbad04[_0x4d89('0x7')]({'attributes':['id'],'raw':!![]})[_0x4d89('0x8')](function(_0x4e6dda){_0xcbad04[_0x4d89('0x9')]('Users',_0x4e6dda['map'](function(_0x3fc6ad){return{'id':_0x3fc6ad['id']};}));return MailMessage[_0x4d89('0xa')]({'where':{'MailInteractionId':_0xcbad04['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xa0de3c){_0xcbad04[_0x4d89('0x9')](_0x4d89('0xb'),_0xa0de3c[_0x4d89('0xc')]);MailInteractionEvents[_0x4d89('0xd')](_0x89fafd+':'+_0xcbad04['id'],_0xcbad04);MailInteractionEvents[_0x4d89('0xd')](_0x89fafd,_0xcbad04);_0x1ceecd(null);})[_0x4d89('0xe')](_0x1ceecd(null));};}for(var e in events){if(events[_0x4d89('0xf')](e)){var event=events[e];MailInteraction[_0x4d89('0x10')](e,emitEvent(event));}}module[_0x4d89('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xdf18=['events','../../mysqldb','MailInteraction','setMaxListeners','update','getUsers','then','findAll','setDataValue','unreadMessages','length','emit','catch','hook','exports'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xdf18,0x10e));var _0x8df1=function(_0x466ed9,_0x286a12){_0x466ed9=_0x466ed9-0x0;var _0xdac0f6=_0xdf18[_0x466ed9];return _0xdac0f6;};'use strict';var EventEmitter=require(_0x8df1('0x0'));var MailInteraction=require(_0x8df1('0x1'))['db'][_0x8df1('0x2')];var MailMessage=require(_0x8df1('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8df1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8df1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4388ce){return function(_0x444984,_0x319f75,_0xc09d35){_0x444984[_0x8df1('0x5')]({'attributes':['id'],'raw':!![]})[_0x8df1('0x6')](function(_0x2c2908){_0x444984['setDataValue']('Users',_0x2c2908['map'](function(_0x9cbce0){return{'id':_0x9cbce0['id']};}));return MailMessage[_0x8df1('0x7')]({'where':{'MailInteractionId':_0x444984['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8df1('0x6')](function(_0x779e3b){_0x444984[_0x8df1('0x8')](_0x8df1('0x9'),_0x779e3b[_0x8df1('0xa')]);MailInteractionEvents[_0x8df1('0xb')](_0x4388ce+':'+_0x444984['id'],_0x444984);MailInteractionEvents[_0x8df1('0xb')](_0x4388ce,_0x444984);_0xc09d35(null);})[_0x8df1('0xc')](_0xc09d35(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x8df1('0xd')](e,emitEvent(event));}}module[_0x8df1('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 ec54ed6..35cce4f 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 _0xca4f=['path','rimraf','./mailInteraction.attributes','define','mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','substatus','closedAt','models','get','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0xc2dacc,_0x121118){var _0x117498=function(_0x235c1d){while(--_0x235c1d){_0xc2dacc['push'](_0xc2dacc['shift']());}};_0x117498(++_0x121118);}(_0xca4f,0x127));var _0xfca4=function(_0x17830c,_0xee03){_0x17830c=_0x17830c-0x0;var _0x3d5357=_0xca4f[_0x17830c];return _0x3d5357;};'use strict';var _=require(_0xfca4('0x0'));var util=require('util');var logger=require(_0xfca4('0x1'))(_0xfca4('0x2'));var moment=require('moment');var BPromise=require(_0xfca4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfca4('0x4'));var rimraf=require(_0xfca4('0x5'));var config=require('../../config/environment');var attributes=require(_0xfca4('0x6'));module['exports']=function(_0xb979c2,_0x5ea0f6){return _0xb979c2[_0xfca4('0x7')]('MailInteraction',attributes,{'tableName':_0xfca4('0x8'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xfca4('0x9'),'to'],'type':_0xfca4('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x21253a,_0xda6acd,_0x2ea27d){if(_0x21253a['substatus']){_0x21253a[_0xfca4('0xb')]=moment()[_0xfca4('0xc')](_0xfca4('0xd'));}if(_0x21253a[_0xfca4('0xe')]){_0x21253a['closedAt']=moment()[_0xfca4('0xc')](_0xfca4('0xd'));}_0x2ea27d(null,_0xda6acd);},'beforeUpdate':function(_0x42f5fd,_0xb5a26f,_0x3ecced){if(_0x42f5fd['changed'](_0xfca4('0xf'))){_0x42f5fd[_0xfca4('0xb')]=_0x42f5fd[_0xfca4('0xf')]?moment()[_0xfca4('0xc')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x42f5fd['changed'](_0xfca4('0xe'))){_0x42f5fd[_0xfca4('0x10')]=moment()[_0xfca4('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x42f5fd['substatus']=null;_0x42f5fd[_0xfca4('0xb')]=null;}_0x3ecced(null,_0x42f5fd);},'afterUpdate':function(_0x24923a,_0x1e209c,_0x16daf0){var _0x3f8514=_0xb979c2[_0xfca4('0x11')];var _0x595dc1=_0x24923a[_0xfca4('0x12')]({'plain':!![]});if(_0x595dc1[_0xfca4('0xe')]){return _0x3f8514[_0xfca4('0x13')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x595dc1['id']}})['then'](function(){_0x16daf0();})[_0xfca4('0x14')](function(_0xf2a410){_0x16daf0(_0xf2a410);});}else{_0x16daf0();}}},'charset':_0xfca4('0x15'),'collate':_0xfca4('0x16')});}; \ No newline at end of file +var _0x1d24=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','closed','closedAt','format','changed','YYYY-MM-DD\x20HH:mm:ss','models','get','MailMessage','update'];(function(_0xc2c2af,_0x480c44){var _0x29cfba=function(_0x4da4f9){while(--_0x4da4f9){_0xc2c2af['push'](_0xc2c2af['shift']());}};_0x29cfba(++_0x480c44);}(_0x1d24,0x1a3));var _0x41d2=function(_0x1da289,_0x417651){_0x1da289=_0x1da289-0x0;var _0x41c889=_0x1d24[_0x1da289];return _0x41c889;};'use strict';var _=require(_0x41d2('0x0'));var util=require(_0x41d2('0x1'));var logger=require('../../config/logger')(_0x41d2('0x2'));var moment=require(_0x41d2('0x3'));var BPromise=require(_0x41d2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41d2('0x5'));var rimraf=require(_0x41d2('0x6'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x41d2('0x7')]=function(_0x215397,_0x352b8a){return _0x215397['define'](_0x41d2('0x8'),attributes,{'tableName':_0x41d2('0x9'),'paranoid':![],'indexes':[{'name':_0x41d2('0xa'),'fields':[_0x41d2('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3894e3,_0x549ef1,_0xea3143){if(_0x3894e3[_0x41d2('0xc')]){_0x3894e3[_0x41d2('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3894e3[_0x41d2('0xe')]){_0x3894e3[_0x41d2('0xf')]=moment()[_0x41d2('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0xea3143(null,_0x549ef1);},'beforeUpdate':function(_0x172035,_0x128b86,_0x480e96){if(_0x172035[_0x41d2('0x11')](_0x41d2('0xc'))){_0x172035[_0x41d2('0xd')]=_0x172035[_0x41d2('0xc')]?moment()[_0x41d2('0x10')](_0x41d2('0x12')):null;}if(_0x172035[_0x41d2('0x11')]('closed')){_0x172035[_0x41d2('0xf')]=moment()[_0x41d2('0x10')](_0x41d2('0x12'));_0x172035[_0x41d2('0xc')]=null;_0x172035[_0x41d2('0xd')]=null;}_0x480e96(null,_0x172035);},'afterUpdate':function(_0x43ac34,_0x492141,_0x37997d){var _0x2b9643=_0x215397[_0x41d2('0x13')];var _0x5b5aa8=_0x43ac34[_0x41d2('0x14')]({'plain':!![]});if(_0x5b5aa8[_0x41d2('0xe')]){return _0x2b9643[_0x41d2('0x15')][_0x41d2('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x5b5aa8['id']}})['then'](function(){_0x37997d();})[_0x41d2('0x17')](function(_0x37f233){_0x37997d(_0x37f233);});}else{_0x37997d();}}},'charset':_0x41d2('0x18'),'collate':_0x41d2('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4e64d52..58ef98f 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 _0xa8bf=['result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','then','debug','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','MailInteraction,\x20%s,\x20%s'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0xa8bf,0x1c2));var _0xfa8b=function(_0x5e1eae,_0x2d2a56){_0x5e1eae=_0x5e1eae-0x0;var _0x3217c5=_0xa8bf[_0x5e1eae];return _0x3217c5;};'use strict';var _=require(_0xfa8b('0x0'));var util=require(_0xfa8b('0x1'));var moment=require(_0xfa8b('0x2'));var BPromise=require(_0xfa8b('0x3'));var rs=require(_0xfa8b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa8b('0x6'))(_0xfa8b('0x7'));var config=require('../../config/environment');var jayson=require(_0xfa8b('0x8'));var client=jayson[_0xfa8b('0x9')][_0xfa8b('0xa')]({'port':0x232a});config[_0xfa8b('0xb')]=_['defaults'](config['redis'],{'host':_0xfa8b('0xc'),'port':0x18eb});var socket=require(_0xfa8b('0xd'))(new Redis(config[_0xfa8b('0xb')]));require(_0xfa8b('0xe'))['register'](socket);function respondWithRpcPromise(_0x19ec1b,_0x32f805,_0x5aaa70){return new BPromise(function(_0x113639,_0x2e7ae7){return client[_0xfa8b('0xf')](_0x19ec1b,_0x5aaa70)['then'](function(_0x4862cd){logger[_0xfa8b('0x10')]('MailInteraction,\x20%s,\x20%s',_0x32f805,_0xfa8b('0x11'));logger['debug'](_0xfa8b('0x12'),_0x32f805,'request\x20sent',JSON['stringify'](_0x4862cd));if(_0x4862cd[_0xfa8b('0x13')]){if(_0x4862cd['error'][_0xfa8b('0x14')]===0x1f4){logger[_0xfa8b('0x13')]('MailInteraction,\x20%s,\x20%s',_0x32f805,_0x4862cd[_0xfa8b('0x13')][_0xfa8b('0x15')]);return _0x2e7ae7(_0x4862cd['error']['message']);}logger['error'](_0xfa8b('0x16'),_0x32f805,_0x4862cd[_0xfa8b('0x13')][_0xfa8b('0x15')]);return _0x113639(_0x4862cd['error'][_0xfa8b('0x15')]);}else{logger[_0xfa8b('0x10')](_0xfa8b('0x16'),_0x32f805,_0xfa8b('0x11'));_0x113639(_0x4862cd[_0xfa8b('0x17')]['message']);}})[_0xfa8b('0x18')](function(_0x96a6a){logger[_0xfa8b('0x13')](_0xfa8b('0x16'),_0x32f805,_0x96a6a);_0x2e7ae7(_0x96a6a);});});}exports[_0xfa8b('0x19')]=function(_0x4cda66){var _0x138c3e=this;return new Promise(function(_0x1cfe4d,_0x34d284){return db['MailInteraction'][_0xfa8b('0x1a')](_0x4cda66[_0xfa8b('0x1b')],{'raw':_0x4cda66[_0xfa8b('0x1c')]?_0x4cda66['options'][_0xfa8b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cda66[_0xfa8b('0x1c')]?_0x4cda66[_0xfa8b('0x1c')][_0xfa8b('0x1e')]||null:null,'attributes':_0x4cda66['options']?_0x4cda66[_0xfa8b('0x1c')][_0xfa8b('0x1f')]||null:null,'limit':_0x4cda66[_0xfa8b('0x1c')]?_0x4cda66['options'][_0xfa8b('0x20')]||null:null})[_0xfa8b('0x21')](function(_0x370cae){logger[_0xfa8b('0x10')](_0xfa8b('0x19'),_0x4cda66);logger[_0xfa8b('0x22')](_0xfa8b('0x19'),_0x4cda66,JSON[_0xfa8b('0x23')](_0x370cae));_0x1cfe4d(_0x370cae);})[_0xfa8b('0x18')](function(_0x237d6b){logger['error'](_0xfa8b('0x19'),_0x237d6b[_0xfa8b('0x15')],_0x4cda66);_0x34d284(_0x138c3e[_0xfa8b('0x13')](0x1f4,_0x237d6b[_0xfa8b('0x15')]));});});};exports[_0xfa8b('0x24')]=function(_0x55b3e3){return new Promise(function(_0x1659fa,_0x1e08c9){return db['MailInteraction'][_0xfa8b('0x25')]({'where':_0x55b3e3[_0xfa8b('0x1c')]?_0x55b3e3['options'][_0xfa8b('0x1e')]||null:null})[_0xfa8b('0x21')](function(_0x268356){if(_0x268356){return _0x268356[_0xfa8b('0x26')](_0x55b3e3[_0xfa8b('0x1b')][_0xfa8b('0x27')],_[_0xfa8b('0x28')](_0x55b3e3[_0xfa8b('0x1b')],[_0xfa8b('0x27'),'id'])||{});}})[_0xfa8b('0x29')](function(_0x27f158){logger['info']('AddTags',_0x55b3e3);logger['debug'](_0xfa8b('0x2a'),_0x55b3e3,JSON[_0xfa8b('0x23')](_0x27f158));_0x1659fa(_0x27f158);})[_0xfa8b('0x18')](function(_0x3a00ea){logger[_0xfa8b('0x13')](_0xfa8b('0x2a'),_0x3a00ea['message'],_0x55b3e3);_0x1e08c9(_this[_0xfa8b('0x13')](0x1f4,_0x3a00ea['message']));});});}; \ No newline at end of file +var _0x2bbc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailInteraction','body','options','where','limit','then','UpdateMailInteraction','AddTagsToMailInteraction','addTags','omit','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x1477ae,_0x32e6c2){var _0x54c012=function(_0x3c4614){while(--_0x3c4614){_0x1477ae['push'](_0x1477ae['shift']());}};_0x54c012(++_0x32e6c2);}(_0x2bbc,0x1ea));var _0xc2bb=function(_0x1554a5,_0x14da18){_0x1554a5=_0x1554a5-0x0;var _0x4dc055=_0x2bbc[_0x1554a5];return _0x4dc055;};'use strict';var _=require(_0xc2bb('0x0'));var util=require(_0xc2bb('0x1'));var moment=require(_0xc2bb('0x2'));var BPromise=require(_0xc2bb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2bb('0x4'));var db=require(_0xc2bb('0x5'))['db'];var utils=require(_0xc2bb('0x6'));var logger=require(_0xc2bb('0x7'))(_0xc2bb('0x8'));var config=require(_0xc2bb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc2bb('0xa')][_0xc2bb('0xb')]({'port':0x232a});config[_0xc2bb('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc2bb('0xc')]));require(_0xc2bb('0xd'))[_0xc2bb('0xe')](socket);function respondWithRpcPromise(_0x4af6f1,_0xddbb8b,_0x1280a7){return new BPromise(function(_0x31bfec,_0x16b832){return client['request'](_0x4af6f1,_0x1280a7)['then'](function(_0x174e1d){logger[_0xc2bb('0xf')](_0xc2bb('0x10'),_0xddbb8b,'request\x20sent');logger[_0xc2bb('0x11')](_0xc2bb('0x12'),_0xddbb8b,_0xc2bb('0x13'),JSON[_0xc2bb('0x14')](_0x174e1d));if(_0x174e1d[_0xc2bb('0x15')]){if(_0x174e1d['error'][_0xc2bb('0x16')]===0x1f4){logger[_0xc2bb('0x15')]('MailInteraction,\x20%s,\x20%s',_0xddbb8b,_0x174e1d['error'][_0xc2bb('0x17')]);return _0x16b832(_0x174e1d[_0xc2bb('0x15')][_0xc2bb('0x17')]);}logger['error'](_0xc2bb('0x10'),_0xddbb8b,_0x174e1d['error']['message']);return _0x31bfec(_0x174e1d['error']['message']);}else{logger[_0xc2bb('0xf')](_0xc2bb('0x10'),_0xddbb8b,_0xc2bb('0x13'));_0x31bfec(_0x174e1d[_0xc2bb('0x18')][_0xc2bb('0x17')]);}})[_0xc2bb('0x19')](function(_0x4f256e){logger[_0xc2bb('0x15')](_0xc2bb('0x10'),_0xddbb8b,_0x4f256e);_0x16b832(_0x4f256e);});});}exports['UpdateMailInteraction']=function(_0x1570f9){var _0x1ad3fe=this;return new Promise(function(_0x4591aa,_0x381a9d){return db[_0xc2bb('0x1a')]['update'](_0x1570f9[_0xc2bb('0x1b')],{'raw':_0x1570f9['options']?_0x1570f9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1570f9[_0xc2bb('0x1c')]?_0x1570f9[_0xc2bb('0x1c')][_0xc2bb('0x1d')]||null:null,'attributes':_0x1570f9[_0xc2bb('0x1c')]?_0x1570f9['options']['attributes']||null:null,'limit':_0x1570f9['options']?_0x1570f9[_0xc2bb('0x1c')][_0xc2bb('0x1e')]||null:null})[_0xc2bb('0x1f')](function(_0x11492f){logger['info'](_0xc2bb('0x20'),_0x1570f9);logger[_0xc2bb('0x11')](_0xc2bb('0x20'),_0x1570f9,JSON[_0xc2bb('0x14')](_0x11492f));_0x4591aa(_0x11492f);})[_0xc2bb('0x19')](function(_0x261d02){logger['error'](_0xc2bb('0x20'),_0x261d02['message'],_0x1570f9);_0x381a9d(_0x1ad3fe[_0xc2bb('0x15')](0x1f4,_0x261d02['message']));});});};exports[_0xc2bb('0x21')]=function(_0x3cb193){return new Promise(function(_0x2d2bf3,_0x51a04f){return db[_0xc2bb('0x1a')]['find']({'where':_0x3cb193[_0xc2bb('0x1c')]?_0x3cb193[_0xc2bb('0x1c')]['where']||null:null})[_0xc2bb('0x1f')](function(_0x568b80){if(_0x568b80){return _0x568b80[_0xc2bb('0x22')](_0x3cb193['body']['ids'],_[_0xc2bb('0x23')](_0x3cb193[_0xc2bb('0x1b')],['ids','id'])||{});}})[_0xc2bb('0x24')](function(_0x5df36a){logger[_0xc2bb('0xf')](_0xc2bb('0x25'),_0x3cb193);logger['debug'](_0xc2bb('0x25'),_0x3cb193,JSON[_0xc2bb('0x14')](_0x5df36a));_0x2d2bf3(_0x5df36a);})['catch'](function(_0x193992){logger[_0xc2bb('0x15')](_0xc2bb('0x25'),_0x193992[_0xc2bb('0x17')],_0x3cb193);_0x51a04f(_this['error'](0x1f4,_0x193992['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b34f217..1065bd4 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 _0x74e1=['register','length','mailInteraction:','./mailInteraction.events','save','remove','update','removeListener'];(function(_0x411d16,_0x3547ff){var _0x181975=function(_0x49300d){while(--_0x49300d){_0x411d16['push'](_0x411d16['shift']());}};_0x181975(++_0x3547ff);}(_0x74e1,0x7b));var _0x174e=function(_0x4c3c85,_0x49530b){_0x4c3c85=_0x4c3c85-0x0;var _0x6b69ea=_0x74e1[_0x4c3c85];return _0x6b69ea;};'use strict';var MailInteractionEvents=require(_0x174e('0x0'));var events=[_0x174e('0x1'),_0x174e('0x2'),_0x174e('0x3')];function createListener(_0x2b9e23,_0x429744){return function(_0x4382fa){_0x429744['emit'](_0x2b9e23,_0x4382fa);};}function removeListener(_0x31401a,_0x107fbb){return function(){MailInteractionEvents[_0x174e('0x4')](_0x31401a,_0x107fbb);};}exports[_0x174e('0x5')]=function(_0x45a6ef){for(var _0x495d1a=0x0,_0x441fc9=events[_0x174e('0x6')];_0x495d1a<_0x441fc9;_0x495d1a++){var _0x2caf73=events[_0x495d1a];var _0x4833fb=createListener(_0x174e('0x7')+_0x2caf73,_0x45a6ef);MailInteractionEvents['on'](_0x2caf73,_0x4833fb);}}; \ No newline at end of file +var _0x4c4a=['mailInteraction:','./mailInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x4c4a,0x1b9));var _0xa4c4=function(_0x1d3d54,_0x4ea200){_0x1d3d54=_0x1d3d54-0x0;var _0x133826=_0x4c4a[_0x1d3d54];return _0x133826;};'use strict';var MailInteractionEvents=require(_0xa4c4('0x0'));var events=[_0xa4c4('0x1'),_0xa4c4('0x2'),_0xa4c4('0x3')];function createListener(_0x17022e,_0x4b7bde){return function(_0x5d9260){_0x4b7bde['emit'](_0x17022e,_0x5d9260);};}function removeListener(_0x5bd2ea,_0x3560da){return function(){MailInteractionEvents[_0xa4c4('0x4')](_0x5bd2ea,_0x3560da);};}exports[_0xa4c4('0x5')]=function(_0x5bfa72){for(var _0xcbea00=0x0,_0x58b0f6=events[_0xa4c4('0x6')];_0xcbea00<_0x58b0f6;_0xcbea00++){var _0x4d0da1=events[_0xcbea00];var _0x1a4d90=createListener(_0xa4c4('0x7')+_0x4d0da1,_0x5bfa72);MailInteractionEvents['on'](_0x4d0da1,_0x1a4d90);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index c2820c0..1998fd8 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 _0x4c9c=['/describe','isAuthenticated','describe','exports','express','Router','./mailInteractionHasTag.controller','get'];(function(_0x2bc081,_0x15f9de){var _0x8b3bdf=function(_0x1cf44d){while(--_0x1cf44d){_0x2bc081['push'](_0x2bc081['shift']());}};_0x8b3bdf(++_0x15f9de);}(_0x4c9c,0x1ac));var _0xc4c9=function(_0x58779c,_0xe8471b){_0x58779c=_0x58779c-0x0;var _0x5e1897=_0x4c9c[_0x58779c];return _0x5e1897;};'use strict';var express=require(_0xc4c9('0x0'));var router=express[_0xc4c9('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc4c9('0x2'));router[_0xc4c9('0x3')](_0xc4c9('0x4'),auth[_0xc4c9('0x5')](),controller[_0xc4c9('0x6')]);module[_0xc4c9('0x7')]=router; \ No newline at end of file +var _0x22c9=['exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','/describe','isAuthenticated','describe'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x22c9,0x151));var _0x922c=function(_0x33cb35,_0x6240ef){_0x33cb35=_0x33cb35-0x0;var _0x50a2ac=_0x22c9[_0x33cb35];return _0x50a2ac;};'use strict';var express=require(_0x922c('0x0'));var router=express[_0x922c('0x1')]();var auth=require(_0x922c('0x2'));var controller=require(_0x922c('0x3'));router['get'](_0x922c('0x4'),auth[_0x922c('0x5')](),controller[_0x922c('0x6')]);module[_0x922c('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 2d4e06b..8260abc 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(_0x3add92,_0x41a20d){var _0x3e37af=function(_0x2b7d3e){while(--_0x2b7d3e){_0x3add92['push'](_0x3add92['shift']());}};_0x3e37af(++_0x41a20d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x5c16b9,_0x2e85fc){var _0x3b80f6=function(_0x307164){while(--_0x307164){_0x5c16b9['push'](_0x5c16b9['shift']());}};_0x3b80f6(++_0x2e85fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 3cb2cbd..d5c0a00 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 _0x5be3=['sequelize','exports'];(function(_0x51c883,_0x4f8500){var _0xb1175a=function(_0x5e104b){while(--_0x5e104b){_0x51c883['push'](_0x51c883['shift']());}};_0xb1175a(++_0x4f8500);}(_0x5be3,0x15c));var _0x35be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5be3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x35be('0x0'));module[_0x35be('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0xd83c=['exports','INTEGER','sequelize'];(function(_0x12939d,_0x232386){var _0x3c60c8=function(_0x3558c4){while(--_0x3558c4){_0x12939d['push'](_0x12939d['shift']());}};_0x3c60c8(++_0x232386);}(_0xd83c,0xfe));var _0xcd83=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0xd83c[_0x2a3c4d];return _0x55c390;};'use strict';var Sequelize=require(_0xcd83('0x0'));module[_0xcd83('0x1')]={'MailInteractionId':{'type':Sequelize[_0xcd83('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xcd83('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 348643d..0a277f0 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 _0x34a9=['exports','define','MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x34a9,0x13f));var _0x934a=function(_0x4effbe,_0x39beb3){_0x4effbe=_0x4effbe-0x0;var _0x26d43e=_0x34a9[_0x4effbe];return _0x26d43e;};'use strict';var attributes=require(_0x934a('0x0'));module[_0x934a('0x1')]=function(_0x4201ce){return _0x4201ce[_0x934a('0x2')](_0x934a('0x3'),attributes,{'tableName':_0x934a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ae=['./mailInteractionHasTag','exports','MailInteractionHasTag'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x54ae,0x135));var _0xe54a=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x54ae[_0x2caaef];return _0xd011f8;};'use strict';var attributes=require(_0xe54a('0x0'));module[_0xe54a('0x1')]=function(_0x118e7b){return _0x118e7b['define'](_0xe54a('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a3be96f..6abb56c 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 _0xe9ad=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xe9ad,0x82));var _0xde9a=function(_0x5bf840,_0x9fc2ab){_0x5bf840=_0x5bf840-0x0;var _0x4f4355=_0xe9ad[_0x5bf840];return _0x4f4355;};'use strict';var multer=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var path=require(_0xde9a('0x2'));var timeout=require(_0xde9a('0x3'));var express=require(_0xde9a('0x4'));var router=express[_0xde9a('0x5')]();var fs_extra=require(_0xde9a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xde9a('0x7'));var config=require(_0xde9a('0x8'));var controller=require(_0xde9a('0x9'));router[_0xde9a('0xa')]('/',auth['isAuthenticated'](),controller[_0xde9a('0xb')]);router[_0xde9a('0xa')](_0xde9a('0xc'),auth['isAuthenticated'](),controller[_0xde9a('0xd')]);router[_0xde9a('0xa')](_0xde9a('0xe'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x10')]);router[_0xde9a('0xa')](_0xde9a('0x11'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x12')]);router['post']('/',auth[_0xde9a('0xf')](),interaction[_0xde9a('0x13')](_0xde9a('0x14'),_0xde9a('0x15')),controller[_0xde9a('0x16')]);router[_0xde9a('0x17')](_0xde9a('0xe'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x18')]);router['put'](_0xde9a('0x19'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x1a')]);router[_0xde9a('0x17')](_0xde9a('0x1b'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x1c')]);router[_0xde9a('0x1d')](_0xde9a('0xe'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x1e')]);module[_0xde9a('0x1f')]=router; \ No newline at end of file +var _0x1730=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','tracked','mailmessage:create','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xa41d87,_0xdaebef){var _0x1a6ad7=function(_0x2de8cd){while(--_0x2de8cd){_0xa41d87['push'](_0xa41d87['shift']());}};_0x1a6ad7(++_0xdaebef);}(_0x1730,0xda));var _0x0173=function(_0x57137d,_0x2981af){_0x57137d=_0x57137d-0x0;var _0x1bf3e5=_0x1730[_0x57137d];return _0x1bf3e5;};'use strict';var multer=require('multer');var util=require(_0x0173('0x0'));var path=require(_0x0173('0x1'));var timeout=require(_0x0173('0x2'));var express=require(_0x0173('0x3'));var router=express[_0x0173('0x4')]();var fs_extra=require(_0x0173('0x5'));var auth=require(_0x0173('0x6'));var interaction=require(_0x0173('0x7'));var config=require(_0x0173('0x8'));var controller=require(_0x0173('0x9'));router[_0x0173('0xa')]('/',auth[_0x0173('0xb')](),controller[_0x0173('0xc')]);router[_0x0173('0xa')](_0x0173('0xd'),auth[_0x0173('0xb')](),controller[_0x0173('0xe')]);router[_0x0173('0xa')]('/:id',auth[_0x0173('0xb')](),controller[_0x0173('0xf')]);router[_0x0173('0xa')]('/:id/download',auth[_0x0173('0xb')](),controller[_0x0173('0x10')]);router[_0x0173('0x11')]('/',auth[_0x0173('0xb')](),interaction[_0x0173('0x12')]('mail',_0x0173('0x13')),controller['create']);router[_0x0173('0x14')](_0x0173('0x15'),auth[_0x0173('0xb')](),controller['update']);router[_0x0173('0x14')](_0x0173('0x16'),auth[_0x0173('0xb')](),controller[_0x0173('0x17')]);router[_0x0173('0x14')](_0x0173('0x18'),auth[_0x0173('0xb')](),controller[_0x0173('0x19')]);router[_0x0173('0x1a')](_0x0173('0x15'),auth[_0x0173('0xb')](),controller['destroy']);module[_0x0173('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c851af6..0773b39 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 _0x1fcf=['lodash','exports','long','medium','BOOLEAN','STRING','TEXT','INTEGER','DATE','ENUM','Email','Chat','sequelize'];(function(_0x190ceb,_0x2345b2){var _0x5ce806=function(_0x432853){while(--_0x432853){_0x190ceb['push'](_0x190ceb['shift']());}};_0x5ce806(++_0x2345b2);}(_0x1fcf,0x144));var _0xf1fc=function(_0x276232,_0x20b6b8){_0x276232=_0x276232-0x0;var _0x427024=_0x1fcf[_0x276232];return _0x427024;};'use strict';var Sequelize=require(_0xf1fc('0x0'));var _=require(_0xf1fc('0x1'));module[_0xf1fc('0x2')]={'body':{'type':Sequelize['TEXT'](_0xf1fc('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xf1fc('0x4'))},'read':{'type':Sequelize[_0xf1fc('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf1fc('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf1fc('0x7')](_0xf1fc('0x3'))},'cc':{'type':Sequelize[_0xf1fc('0x7')](_0xf1fc('0x3'))},'bcc':{'type':Sequelize[_0xf1fc('0x7')]('long')},'subject':{'type':Sequelize[_0xf1fc('0x7')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xf1fc('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf1fc('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf1fc('0x9')]},'originTo':{'type':Sequelize[_0xf1fc('0x7')](_0xf1fc('0x3'))},'originCc':{'type':Sequelize[_0xf1fc('0x7')](_0xf1fc('0x3'))},'originChannel':{'type':Sequelize[_0xf1fc('0xa')](_0xf1fc('0xb'),_0xf1fc('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x0f03=['BOOLEAN','ENUM','out','STRING','Email','sequelize','exports','TEXT','long','medium'];(function(_0x5a971c,_0x2375e8){var _0x558e0d=function(_0x4f7035){while(--_0x4f7035){_0x5a971c['push'](_0x5a971c['shift']());}};_0x558e0d(++_0x2375e8);}(_0x0f03,0x113));var _0x30f0=function(_0x4831be,_0x1e7954){_0x4831be=_0x4831be-0x0;var _0x2be46a=_0x0f03[_0x4831be];return _0x2be46a;};'use strict';var Sequelize=require(_0x30f0('0x0'));var _=require('lodash');module[_0x30f0('0x1')]={'body':{'type':Sequelize[_0x30f0('0x2')](_0x30f0('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x30f0('0x2')](_0x30f0('0x4'))},'read':{'type':Sequelize[_0x30f0('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x30f0('0x6')]('in','out'),'defaultValue':_0x30f0('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x30f0('0x8')](0x1fe)},'from':{'type':Sequelize[_0x30f0('0x8')]},'to':{'type':Sequelize['TEXT'](_0x30f0('0x3'))},'cc':{'type':Sequelize[_0x30f0('0x2')](_0x30f0('0x3'))},'bcc':{'type':Sequelize[_0x30f0('0x2')](_0x30f0('0x3'))},'subject':{'type':Sequelize[_0x30f0('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x30f0('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x30f0('0x2')](_0x30f0('0x3'))},'originCc':{'type':Sequelize[_0x30f0('0x2')](_0x30f0('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0x30f0('0x9'),'Chat'),'defaultValue':_0x30f0('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 9993c8e..9863db7 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 _0xab26=['secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','ListId','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','acceptMessage','reject','UserId','agent','get','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','SIP/%s','motionChannel','channel','fromString','EventManager','unix','toString','tmp','join','files','format','message-%s.eml','from','bcc','subject','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','MailMessage,\x20%s,\x20%s','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','end','sendStatus','stack','name','map','MailMessage','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','describe','create','direction','out'];(function(_0x6b2c5c,_0x3f6949){var _0x18e3ce=function(_0x1a143f){while(--_0x1a143f){_0x6b2c5c['push'](_0x6b2c5c['shift']());}};_0x18e3ce(++_0x3f6949);}(_0xab26,0xe4));var _0x6ab2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xab26[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x6ab2('0x0'));var moment=require(_0x6ab2('0x1'));var util=require(_0x6ab2('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x6ab2('0x3'));var Redis=require(_0x6ab2('0x4'));var htmlToText=require('html-to-text');var interactionService=require(_0x6ab2('0x5'));var qs=require(_0x6ab2('0x6'));var logger=require(_0x6ab2('0x7'))(_0x6ab2('0x8'));var interaction_log=require(_0x6ab2('0x7'))(_0x6ab2('0x9'));var config=require(_0x6ab2('0xa'));var db=require(_0x6ab2('0xb'))['db'];config[_0x6ab2('0xc')]=_[_0x6ab2('0xd')](config[_0x6ab2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ab2('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0x6ab2('0xf'));require(_0x6ab2('0x10'))[_0x6ab2('0x11')](socket);var jayson=require(_0x6ab2('0x12'));var client=jayson[_0x6ab2('0x13')][_0x6ab2('0x14')]({'port':0x232c});var client9003=jayson[_0x6ab2('0x13')][_0x6ab2('0x14')]({'port':0x232b});var client9002=jayson[_0x6ab2('0x13')][_0x6ab2('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x140cb4,_0x133c1c,_0x693aed,_0x51f386){return new Promise(function(_0xd61890,_0x3cf1c7){var _0x32740d=_0x51f386||client;return _0x32740d[_0x6ab2('0x15')](_0x140cb4,_0x693aed)['then'](function(_0x41ef37){logger[_0x6ab2('0x16')]('MailMessage,\x20%s,\x20%s',_0x133c1c,_0x6ab2('0x17'));logger[_0x6ab2('0x18')](_0x6ab2('0x19'),_0x133c1c,_0x6ab2('0x17'),JSON['stringify'](_0x41ef37));if(_0x41ef37['error']){if(_0x41ef37[_0x6ab2('0x1a')][_0x6ab2('0x1b')]===0x1f4){logger[_0x6ab2('0x1a')]('MailMessage,\x20%s,\x20%s',_0x133c1c,_0x41ef37[_0x6ab2('0x1a')]['message']);return _0x3cf1c7(_0x41ef37[_0x6ab2('0x1a')][_0x6ab2('0x1c')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x133c1c,_0x41ef37['error'][_0x6ab2('0x1c')]);return _0xd61890(_0x41ef37[_0x6ab2('0x1a')][_0x6ab2('0x1c')]);}else{logger[_0x6ab2('0x16')](_0x6ab2('0x1d'),_0x133c1c,'request\x20sent');_0xd61890(_0x41ef37['result'][_0x6ab2('0x1c')]);}})['catch'](function(_0x9ed256){logger[_0x6ab2('0x1a')](_0x6ab2('0x1d'),_0x133c1c,_0x9ed256);_0x3cf1c7(_0x9ed256);});});}function respondWithResult(_0x32b0b5,_0x52afe3){_0x52afe3=_0x52afe3||0xc8;return function(_0x239eeb){if(_0x239eeb){return _0x32b0b5[_0x6ab2('0x1e')](_0x52afe3)[_0x6ab2('0x1f')](_0x239eeb);}};}function respondWithFilteredResult(_0x5775c0,_0x46dd25){return function(_0x78b647){if(_0x78b647){var _0x31c867=typeof _0x46dd25[_0x6ab2('0x20')]===_0x6ab2('0x21')&&typeof _0x46dd25['limit']===_0x6ab2('0x21');var _0x538f01=_0x78b647['count'];var _0x17c045=_0x31c867?0x0:_0x46dd25[_0x6ab2('0x20')];var _0x33a09b=_0x31c867?_0x78b647[_0x6ab2('0x22')]:_0x46dd25['offset']+_0x46dd25[_0x6ab2('0x23')];var _0x4c6c2a;if(_0x33a09b>=_0x538f01){_0x33a09b=_0x538f01;_0x4c6c2a=0xc8;}else{_0x4c6c2a=0xce;}_0x5775c0['status'](_0x4c6c2a);return _0x5775c0[_0x6ab2('0x24')](_0x6ab2('0x25'),_0x17c045+'-'+_0x33a09b+'/'+_0x538f01)[_0x6ab2('0x1f')](_0x78b647);}return null;};}function saveUpdates(_0x135bfb){return function(_0xf54109){if(_0xf54109){return _0xf54109['update'](_0x135bfb)[_0x6ab2('0x26')](function(_0x285c76){return _0x285c76;});}return null;};}function removeEntity(_0x28fac9){return function(_0x52209d){if(_0x52209d){return _0x52209d[_0x6ab2('0x27')]()[_0x6ab2('0x26')](function(){_0x28fac9[_0x6ab2('0x1e')](0xcc)[_0x6ab2('0x28')]();});}};}function handleEntityNotFound(_0x39ffe0){return function(_0x27bdf2){if(!_0x27bdf2){_0x39ffe0[_0x6ab2('0x29')](0x194);}return _0x27bdf2;};}function handleError(_0x128f9a,_0x2ebe16){_0x2ebe16=_0x2ebe16||0x1f4;return function(_0x29e10a){logger['error'](_0x29e10a[_0x6ab2('0x2a')]);if(_0x29e10a['name']){delete _0x29e10a[_0x6ab2('0x2b')];}_0x128f9a[_0x6ab2('0x1e')](_0x2ebe16)['send'](_0x29e10a);};}exports['index']=function(_0x286e72,_0x4dcee7){var _0x9cedb5={},_0x171df5={},_0x5f3522={'count':0x0,'rows':[]};var _0x2c7881=_[_0x6ab2('0x2c')](db[_0x6ab2('0x2d')]['rawAttributes'],function(_0x3c2e41){return{'name':_0x3c2e41['fieldName'],'type':_0x3c2e41[_0x6ab2('0x2e')][_0x6ab2('0x2f')]};});_0x171df5[_0x6ab2('0x30')]=_[_0x6ab2('0x2c')](_0x2c7881,_0x6ab2('0x2b'));_0x171df5[_0x6ab2('0x31')]=_[_0x6ab2('0x32')](_0x286e72['query']);_0x171df5['filters']=_[_0x6ab2('0x33')](_0x171df5[_0x6ab2('0x30')],_0x171df5[_0x6ab2('0x31')]);_0x9cedb5['attributes']=_['intersection'](_0x171df5[_0x6ab2('0x30')],qs[_0x6ab2('0x34')](_0x286e72[_0x6ab2('0x31')]['fields']));_0x9cedb5[_0x6ab2('0x35')]=_0x9cedb5[_0x6ab2('0x35')][_0x6ab2('0x36')]?_0x9cedb5[_0x6ab2('0x35')]:_0x171df5['model'];if(!_0x286e72[_0x6ab2('0x31')]['hasOwnProperty']('nolimit')){_0x9cedb5[_0x6ab2('0x23')]=qs['limit'](_0x286e72['query'][_0x6ab2('0x23')]);_0x9cedb5[_0x6ab2('0x20')]=qs[_0x6ab2('0x20')](_0x286e72[_0x6ab2('0x31')][_0x6ab2('0x20')]);}_0x9cedb5[_0x6ab2('0x37')]=qs[_0x6ab2('0x38')](_0x286e72[_0x6ab2('0x31')][_0x6ab2('0x38')]);_0x9cedb5[_0x6ab2('0x39')]=qs[_0x6ab2('0x3a')](_[_0x6ab2('0x3b')](_0x286e72[_0x6ab2('0x31')],_0x171df5[_0x6ab2('0x3a')]),_0x2c7881);if(_0x286e72[_0x6ab2('0x31')][_0x6ab2('0x3c')]){_0x9cedb5[_0x6ab2('0x39')]=_[_0x6ab2('0x3d')](_0x9cedb5['where'],{'$or':_[_0x6ab2('0x2c')](_0x2c7881,function(_0x248355){if(_0x248355[_0x6ab2('0x2e')]!==_0x6ab2('0x3e')){var _0x4b055c={};_0x4b055c[_0x248355[_0x6ab2('0x2b')]]={'$like':'%'+_0x286e72[_0x6ab2('0x31')]['filter']+'%'};return _0x4b055c;}})});}_0x9cedb5=_[_0x6ab2('0x3d')]({},_0x9cedb5,_0x286e72[_0x6ab2('0x3f')]);var _0x28f77a={'where':_0x9cedb5[_0x6ab2('0x39')]};return db[_0x6ab2('0x2d')][_0x6ab2('0x22')](_0x28f77a)[_0x6ab2('0x26')](function(_0x4d87fc){_0x5f3522['count']=_0x4d87fc;if(_0x286e72[_0x6ab2('0x31')]['includeAll']){_0x9cedb5[_0x6ab2('0x40')]=[{'all':!![]}];}return db[_0x6ab2('0x2d')][_0x6ab2('0x41')](_0x9cedb5);})[_0x6ab2('0x26')](function(_0xbdcff2){_0x5f3522[_0x6ab2('0x42')]=_0xbdcff2;return _0x5f3522;})[_0x6ab2('0x26')](respondWithFilteredResult(_0x4dcee7,_0x9cedb5))[_0x6ab2('0x43')](handleError(_0x4dcee7,null));};exports[_0x6ab2('0x44')]=function(_0x518253,_0xcc05e9){var _0x5d5ec6={'raw':!![],'where':{'id':_0x518253[_0x6ab2('0x45')]['id']}},_0x131259={};_0x131259[_0x6ab2('0x30')]=_[_0x6ab2('0x32')](db['MailMessage'][_0x6ab2('0x46')]);_0x131259[_0x6ab2('0x31')]=_[_0x6ab2('0x32')](_0x518253[_0x6ab2('0x31')]);_0x131259[_0x6ab2('0x3a')]=_[_0x6ab2('0x33')](_0x131259[_0x6ab2('0x30')],_0x131259[_0x6ab2('0x31')]);_0x5d5ec6[_0x6ab2('0x35')]=_['intersection'](_0x131259['model'],qs[_0x6ab2('0x34')](_0x518253[_0x6ab2('0x31')][_0x6ab2('0x34')]));_0x5d5ec6[_0x6ab2('0x35')]=_0x5d5ec6[_0x6ab2('0x35')][_0x6ab2('0x36')]?_0x5d5ec6['attributes']:_0x131259[_0x6ab2('0x30')];if(_0x518253[_0x6ab2('0x31')][_0x6ab2('0x47')]){_0x5d5ec6[_0x6ab2('0x40')]=[{'all':!![]}];}_0x5d5ec6=_[_0x6ab2('0x3d')]({},_0x5d5ec6,_0x518253['options']);return db['MailMessage'][_0x6ab2('0x48')](_0x5d5ec6)['then'](handleEntityNotFound(_0xcc05e9,null))[_0x6ab2('0x26')](respondWithResult(_0xcc05e9,null))[_0x6ab2('0x43')](handleError(_0xcc05e9,null));};exports['update']=function(_0x5e663a,_0x565562){if(_0x5e663a[_0x6ab2('0x49')]['id']){delete _0x5e663a[_0x6ab2('0x49')]['id'];}return db[_0x6ab2('0x2d')][_0x6ab2('0x48')]({'where':{'id':_0x5e663a['params']['id']}})[_0x6ab2('0x26')](handleEntityNotFound(_0x565562,null))[_0x6ab2('0x26')](saveUpdates(_0x5e663a['body'],null))[_0x6ab2('0x26')](respondWithResult(_0x565562,null))[_0x6ab2('0x43')](handleError(_0x565562,null));};exports['destroy']=function(_0x3408d8,_0x3fd966){return db[_0x6ab2('0x2d')]['find']({'where':{'id':_0x3408d8[_0x6ab2('0x45')]['id']}})[_0x6ab2('0x26')](handleEntityNotFound(_0x3fd966,null))[_0x6ab2('0x26')](removeEntity(_0x3fd966,null))['catch'](handleError(_0x3fd966,null));};exports[_0x6ab2('0x4a')]=function(_0x369978,_0x4e826b){return db[_0x6ab2('0x2d')][_0x6ab2('0x4a')]()[_0x6ab2('0x26')](respondWithResult(_0x4e826b,null))['catch'](handleError(_0x4e826b,null));};exports[_0x6ab2('0x4b')]=function(_0x3aa429,_0x2f9b4d){return db[_0x6ab2('0x2d')][_0x6ab2('0x4b')](_0x3aa429[_0x6ab2('0x49')])[_0x6ab2('0x26')](function(_0x45f608){if(_0x45f608){if(_0x45f608[_0x6ab2('0x4c')]===_0x6ab2('0x4d')&&!_0x45f608[_0x6ab2('0x4e')]){var _0x3a853c,_0x22cc81,_0x562960;if(_0x3aa429[_0x6ab2('0x49')]['to']){_0x22cc81=_0x3aa429[_0x6ab2('0x49')]['to'][_0x6ab2('0x4f')](',')[0x0];}return db[_0x6ab2('0x50')][_0x6ab2('0x51')]({'where':{'id':_0x45f608[_0x6ab2('0x52')]},'include':[{'model':db['CmList'],'as':_0x6ab2('0x53'),'include':[{'model':db[_0x6ab2('0x54')],'as':_0x6ab2('0x55'),'where':{'email':_0x22cc81},'limit':0x1,'order':[[_0x6ab2('0x56'),_0x6ab2('0x57')]]}]},{'model':db[_0x6ab2('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6ab2('0x59'),'raw':!![]}]}]})[_0x6ab2('0x26')](function(_0x1e65d3){_0x3a853c=_0x1e65d3;if(!_0x3a853c||!_0x3a853c['Smtp'])return;var _0x1cd753=_0x3a853c[_0x6ab2('0x5a')]();if(_0x3aa429[_0x6ab2('0x49')]['attachments']&&_0x3aa429['body'][_0x6ab2('0x5b')]['length']){for(var _0x3a2b4f=0x0;_0x3a2b4f<_0x3aa429[_0x6ab2('0x49')]['attachments'][_0x6ab2('0x36')];_0x3a2b4f+=0x1){_0x3aa429[_0x6ab2('0x49')][_0x6ab2('0x5b')][_0x3a2b4f]={'filename':_0x3aa429[_0x6ab2('0x49')][_0x6ab2('0x5b')][_0x3a2b4f][_0x6ab2('0x2b')],'path':path['join'](config[_0x6ab2('0x5c')],_0x6ab2('0x5d'),_0x3aa429[_0x6ab2('0x49')][_0x6ab2('0x5b')][_0x3a2b4f]['basename'])};}}_0x562960={'account':_0x1cd753,'message':_0x3aa429[_0x6ab2('0x49')]};return;})[_0x6ab2('0x26')](function(){if(_0x3a853c['List']){if(_0x3a853c[_0x6ab2('0x53')][_0x6ab2('0x55')][_0x6ab2('0x36')]){return _0x3a853c['List']['Contacts'][0x0];}else{return db[_0x6ab2('0x54')][_0x6ab2('0x4b')](_['defaults'](_0x3aa429['body'],{'firstName':_0x3aa429[_0x6ab2('0x49')]['to'],'email':_0x3aa429['body']['to'],'phone':_0x3aa429[_0x6ab2('0x49')]['to'],'ListId':_0x3a853c[_0x6ab2('0x5e')]}));}}else{throw new Error(_0x6ab2('0x5f'));}})[_0x6ab2('0x26')](function(){if(_0x562960){return respondWithRpcPromise(_0x6ab2('0x60'),'sendMail',_0x562960,client9003)['then'](function(_0x5137ab){return _0x45f608['update']({'read':!![],'messageId':_0x5137ab[_0x6ab2('0x61')],'sentAt':moment()['format'](_0x6ab2('0x62'))});})['catch'](function(_0x47dbfd){logger['error']('%s',JSON[_0x6ab2('0x63')](_0x47dbfd));return _0x45f608;});}return _0x45f608;});}return _0x45f608;}})[_0x6ab2('0x26')](respondWithResult(_0x2f9b4d,0xc9))[_0x6ab2('0x43')](handleError(_0x2f9b4d,null));};exports[_0x6ab2('0x64')]=function(_0x5748ff,_0x5ade6a){var _0x33ced1=_0x6ab2('0x65');return interactionService[_0x6ab2('0x66')](_0x5748ff,_0x33ced1)[_0x6ab2('0x26')](respondWithResult(_0x5ade6a,null))[_0x6ab2('0x43')](handleError(_0x5ade6a,null));};exports[_0x6ab2('0x67')]=function(_0xc0bd43,_0x2d5e27){var _0xd6ee18={'agent':{},'channel':'mail'};if(_0xc0bd43['body']['id']){delete _0xc0bd43['body']['id'];}_0xc0bd43[_0x6ab2('0x49')][_0x6ab2('0x68')]=_0xc0bd43[_0x6ab2('0x49')][_0x6ab2('0x68')]||_0xc0bd43['user']['id'];_0xd6ee18[_0x6ab2('0x69')]['id']=_0xc0bd43[_0x6ab2('0x49')][_0x6ab2('0x68')];return db[_0x6ab2('0x2d')][_0x6ab2('0x48')]({'where':{'id':_0xc0bd43[_0x6ab2('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d5e27,null))[_0x6ab2('0x26')](function(_0x3df78a){if(_0x3df78a){_0xd6ee18[_0x6ab2('0x1c')]=_0x3df78a[_0x6ab2('0x6a')]({'plain':!![]});return db['MailInteraction'][_0x6ab2('0x48')]({'where':{'id':_0x3df78a[_0x6ab2('0x6b')]}});}return null;})[_0x6ab2('0x26')](handleEntityNotFound(_0x2d5e27,null))[_0x6ab2('0x26')](function(_0x484dcf){if(_0x484dcf){_0xd6ee18[_0x6ab2('0x6c')]=_0x484dcf['get']({'plain':!![]});interaction_log[_0x6ab2('0x16')](_0x6ab2('0x6d'),_0xc0bd43[_0x6ab2('0x6e')]['id'],_0xc0bd43[_0x6ab2('0x6e')][_0x6ab2('0x2b')],_0xc0bd43[_0x6ab2('0x6e')][_0x6ab2('0x6f')],_0xd6ee18[_0x6ab2('0x6c')]['id'],_0xc0bd43[_0x6ab2('0x49')]?JSON[_0x6ab2('0x63')](_0xc0bd43[_0x6ab2('0x49')]):_0x6ab2('0x70'));return respondWithRpcPromise(_0x6ab2('0x71'),_0x6ab2('0x72'),_0xd6ee18);}return null;})['then'](function(_0x126b0b){var _0x2e151e=_0x6ab2('0x73')+_0x126b0b[_0x6ab2('0x1c')][_0x6ab2('0x74')];return db[_0x6ab2('0x75')][_0x6ab2('0x31')](_0x2e151e,{'type':db[_0x6ab2('0x76')][_0x6ab2('0x77')][_0x6ab2('0x78')],'raw':!![]})[_0x6ab2('0x26')](function(_0x4ca1e1){return _0x4ca1e1;});})[_0x6ab2('0x26')](function(_0x557e5b){if(_0x557e5b){_0xd6ee18['message'][_0x6ab2('0x79')]=_0x557e5b[0x0];if(!_0xc0bd43['body'][_0x6ab2('0x68')])return;return db['User']['find']({'where':{'id':_0xc0bd43[_0x6ab2('0x49')]['UserId'],'role':_0x6ab2('0x69')},'attributes':['id',_0x6ab2('0x2b'),_0x6ab2('0x7a'),'email',_0x6ab2('0x7b')],'raw':!![]});}return null;})[_0x6ab2('0x26')](function(_0x130322){if(!_0x130322)return null;_0xd6ee18['message'][_0x6ab2('0x69')]=_0x130322;return _0xd6ee18;})[_0x6ab2('0x26')](function(_0x12308d){if(_0x12308d){_0x12308d[_0x6ab2('0x1c')][_0x6ab2('0x7c')]=util['format'](_0x6ab2('0x7d'),_0xc0bd43[_0x6ab2('0x6e')][_0x6ab2('0x2b')]);_0x12308d[_0x6ab2('0x1c')]['channel']=_0xd6ee18['channel'];_0x12308d[_0x6ab2('0x1c')][_0x6ab2('0x7e')]=_0xd6ee18[_0x6ab2('0x7f')];_0x12308d[_0x6ab2('0x1c')]['event']=_0x6ab2('0x67');_0x12308d['message'][_0x6ab2('0x49')]=htmlToText[_0x6ab2('0x80')](_0xd6ee18[_0x6ab2('0x1c')][_0x6ab2('0x49')]);respondWithRpcPromise(_0x6ab2('0x81'),_0x6ab2('0x81'),{'event':'rejectmessage','message':_0x12308d[_0x6ab2('0x1c')]},client9002);return _0xd6ee18;}return null;})['then'](respondWithResult(_0x2d5e27,null))['catch'](handleError(_0x2d5e27,null));};exports['download']=function(_0x1000c9,_0x38207f){var _0x4a1bf8=moment()[_0x6ab2('0x82')]()[_0x6ab2('0x83')]();var _0x34df09=path['join'](config[_0x6ab2('0x5c')],'server','files',_0x6ab2('0x84'));var _0x43b220=path[_0x6ab2('0x85')](config[_0x6ab2('0x5c')],'server',_0x6ab2('0x86'),_0x6ab2('0x5b'));var _0x446a19=util[_0x6ab2('0x87')](_0x6ab2('0x88'),_0x4a1bf8);return db[_0x6ab2('0x2d')]['find']({'where':{'id':_0x1000c9[_0x6ab2('0x45')]['id']},'attributes':['id',_0x6ab2('0x49'),_0x6ab2('0x89'),'to','cc',_0x6ab2('0x8a'),_0x6ab2('0x8b'),'createdAt'],'include':_0x1000c9['query'][_0x6ab2('0x5b')]?[{'model':db[_0x6ab2('0x8c')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x38207f,null))[_0x6ab2('0x26')](function(_0x18768a){if(_0x18768a){var _0x25f9ae=_0x18768a;var _0xe5c567={'from':_0x25f9ae['from'],'to':_0x25f9ae['to'],'subject':_0x25f9ae[_0x6ab2('0x8b')],'html':htmlEntities[_0x6ab2('0x8d')](_0x25f9ae[_0x6ab2('0x49')]),'headers':{'Date':moment(_0x25f9ae['createdAt'])[_0x6ab2('0x87')](_0x6ab2('0x8e'))},'attachments':[]};if(_0x18768a['cc']){_0xe5c567[_0x6ab2('0x8f')]['Cc']=_0x18768a['cc'];}if(_0x18768a['bcc']){_0xe5c567['headers'][_0x6ab2('0x90')]=_0x18768a[_0x6ab2('0x8a')];}return new Promise(function(_0x2fa59e,_0x212fe2){if(_0x18768a['Attachments']){for(var _0x37f3d1=0x0;_0x37f3d1<_0x18768a[_0x6ab2('0x91')][_0x6ab2('0x36')];_0x37f3d1++){var _0xa3ef5=_0x18768a[_0x6ab2('0x91')][_0x37f3d1];var _0x5f5a09=path[_0x6ab2('0x85')](_0x43b220,_0xa3ef5[_0x6ab2('0x92')]);if(fs['existsSync'](_0x5f5a09)){_0xe5c567[_0x6ab2('0x5b')][_0x6ab2('0x93')]({'name':_0xa3ef5['name'],'contentType':_0xa3ef5[_0x6ab2('0x2e')],'data':fs[_0x6ab2('0x94')](_0x5f5a09)});}}}emlformat[_0x6ab2('0x95')](_0xe5c567,function(_0x4d6289,_0x2da3a9){if(_0x4d6289)return _0x212fe2(_0x4d6289);fs[_0x6ab2('0x96')](path[_0x6ab2('0x85')](_0x34df09,_0x446a19),_0x2da3a9);return _0x2fa59e(_0x2da3a9);});});}})[_0x6ab2('0x26')](function(_0x27414e){if(_0x27414e){return _0x38207f[_0x6ab2('0x97')](path[_0x6ab2('0x85')](_0x34df09,_0x446a19),_0x446a19,function(_0xffa4e4){if(!_0xffa4e4)fs[_0x6ab2('0x98')](path[_0x6ab2('0x85')](_0x34df09,_0x446a19));});}})[_0x6ab2('0x43')](handleError(_0x38207f,null));}; \ No newline at end of file +var _0x9284=['existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','type','key','keys','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','fields','find','params','body','destroy','create','secret','MailAccount','findOne','CmList','List','CmContact','Contacts','DESC','CloudProvider','attachments','join','root','defaults','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','acceptMessage','reject','UserId','user','agent','MailInteraction','MailInteractionId','interaction','get','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','fromString','EventManager','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename'];(function(_0x572284,_0x52e2fb){var _0x93207c=function(_0x4eaeff){while(--_0x4eaeff){_0x572284['push'](_0x572284['shift']());}};_0x93207c(++_0x52e2fb);}(_0x9284,0x99));var _0x4928=function(_0x559227,_0x5b39ca){_0x559227=_0x559227-0x0;var _0x494f19=_0x9284[_0x559227];return _0x494f19;};'use strict';var emlformat=require(_0x4928('0x0'));var moment=require('moment');var util=require('util');var path=require(_0x4928('0x1'));var fs=require('fs');var _=require(_0x4928('0x2'));var Redis=require(_0x4928('0x3'));var htmlToText=require(_0x4928('0x4'));var interactionService=require('../../components/interaction/service');var qs=require(_0x4928('0x5'));var logger=require('../../config/logger')('api');var interaction_log=require(_0x4928('0x6'))(_0x4928('0x7'));var config=require(_0x4928('0x8'));var db=require('../../mysqldb')['db'];config[_0x4928('0x9')]=_['defaults'](config[_0x4928('0x9')],{'host':_0x4928('0xa'),'port':0x18eb});var socket=require(_0x4928('0xb'))(new Redis(config[_0x4928('0x9')]));var htmlEntities=require('html-entities');require(_0x4928('0xc'))[_0x4928('0xd')](socket);var jayson=require(_0x4928('0xe'));var client=jayson[_0x4928('0xf')][_0x4928('0x10')]({'port':0x232c});var client9003=jayson['client'][_0x4928('0x10')]({'port':0x232b});var client9002=jayson[_0x4928('0xf')][_0x4928('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x1a6c20,_0x1d11e6,_0x3bbd2f,_0x1da487){return new Promise(function(_0x503296,_0x28e01f){var _0x71bfb6=_0x1da487||client;return _0x71bfb6[_0x4928('0x11')](_0x1a6c20,_0x3bbd2f)[_0x4928('0x12')](function(_0x393fd3){logger[_0x4928('0x13')](_0x4928('0x14'),_0x1d11e6,_0x4928('0x15'));logger[_0x4928('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1d11e6,'request\x20sent',JSON['stringify'](_0x393fd3));if(_0x393fd3[_0x4928('0x17')]){if(_0x393fd3['error'][_0x4928('0x18')]===0x1f4){logger[_0x4928('0x17')](_0x4928('0x14'),_0x1d11e6,_0x393fd3[_0x4928('0x17')]['message']);return _0x28e01f(_0x393fd3[_0x4928('0x17')][_0x4928('0x19')]);}logger[_0x4928('0x17')](_0x4928('0x14'),_0x1d11e6,_0x393fd3['error']['message']);return _0x503296(_0x393fd3[_0x4928('0x17')]['message']);}else{logger[_0x4928('0x13')](_0x4928('0x14'),_0x1d11e6,'request\x20sent');_0x503296(_0x393fd3['result'][_0x4928('0x19')]);}})[_0x4928('0x1a')](function(_0x1e5bbe){logger[_0x4928('0x17')](_0x4928('0x14'),_0x1d11e6,_0x1e5bbe);_0x28e01f(_0x1e5bbe);});});}function respondWithResult(_0x141c31,_0x408824){_0x408824=_0x408824||0xc8;return function(_0x2b4747){if(_0x2b4747){return _0x141c31[_0x4928('0x1b')](_0x408824)[_0x4928('0x1c')](_0x2b4747);}};}function respondWithFilteredResult(_0x3dde8a,_0x23755f){return function(_0x22575f){if(_0x22575f){var _0x4897ef=typeof _0x23755f[_0x4928('0x1d')]===_0x4928('0x1e')&&typeof _0x23755f[_0x4928('0x1f')]==='undefined';var _0x1d3096=_0x22575f[_0x4928('0x20')];var _0x657d64=_0x4897ef?0x0:_0x23755f[_0x4928('0x1d')];var _0xf0eea9=_0x4897ef?_0x22575f[_0x4928('0x20')]:_0x23755f[_0x4928('0x1d')]+_0x23755f[_0x4928('0x1f')];var _0x2352a7;if(_0xf0eea9>=_0x1d3096){_0xf0eea9=_0x1d3096;_0x2352a7=0xc8;}else{_0x2352a7=0xce;}_0x3dde8a['status'](_0x2352a7);return _0x3dde8a[_0x4928('0x21')](_0x4928('0x22'),_0x657d64+'-'+_0xf0eea9+'/'+_0x1d3096)[_0x4928('0x1c')](_0x22575f);}return null;};}function saveUpdates(_0xb9860c){return function(_0x4683c2){if(_0x4683c2){return _0x4683c2[_0x4928('0x23')](_0xb9860c)[_0x4928('0x12')](function(_0x2a508e){return _0x2a508e;});}return null;};}function removeEntity(_0x2f277f){return function(_0x3231b1){if(_0x3231b1){return _0x3231b1['destroy']()[_0x4928('0x12')](function(){_0x2f277f[_0x4928('0x1b')](0xcc)[_0x4928('0x24')]();});}};}function handleEntityNotFound(_0x2ab2f){return function(_0x505b26){if(!_0x505b26){_0x2ab2f[_0x4928('0x25')](0x194);}return _0x505b26;};}function handleError(_0x13f18f,_0x26c6d6){_0x26c6d6=_0x26c6d6||0x1f4;return function(_0x1da3d4){logger[_0x4928('0x17')](_0x1da3d4[_0x4928('0x26')]);if(_0x1da3d4[_0x4928('0x27')]){delete _0x1da3d4[_0x4928('0x27')];}_0x13f18f[_0x4928('0x1b')](_0x26c6d6)[_0x4928('0x28')](_0x1da3d4);};}exports['index']=function(_0xab6136,_0x2b5049){var _0x6e37ff={},_0x5bb8d4={},_0x507cb4={'count':0x0,'rows':[]};var _0x47048a=_[_0x4928('0x29')](db[_0x4928('0x2a')][_0x4928('0x2b')],function(_0x43f0e1){return{'name':_0x43f0e1['fieldName'],'type':_0x43f0e1[_0x4928('0x2c')][_0x4928('0x2d')]};});_0x5bb8d4['model']=_[_0x4928('0x29')](_0x47048a,_0x4928('0x27'));_0x5bb8d4['query']=_[_0x4928('0x2e')](_0xab6136[_0x4928('0x2f')]);_0x5bb8d4['filters']=_[_0x4928('0x30')](_0x5bb8d4[_0x4928('0x31')],_0x5bb8d4[_0x4928('0x2f')]);_0x6e37ff[_0x4928('0x32')]=_['intersection'](_0x5bb8d4['model'],qs['fields'](_0xab6136[_0x4928('0x2f')]['fields']));_0x6e37ff['attributes']=_0x6e37ff[_0x4928('0x32')][_0x4928('0x33')]?_0x6e37ff[_0x4928('0x32')]:_0x5bb8d4['model'];if(!_0xab6136['query'][_0x4928('0x34')](_0x4928('0x35'))){_0x6e37ff['limit']=qs[_0x4928('0x1f')](_0xab6136[_0x4928('0x2f')][_0x4928('0x1f')]);_0x6e37ff[_0x4928('0x1d')]=qs[_0x4928('0x1d')](_0xab6136[_0x4928('0x2f')][_0x4928('0x1d')]);}_0x6e37ff[_0x4928('0x36')]=qs[_0x4928('0x37')](_0xab6136[_0x4928('0x2f')][_0x4928('0x37')]);_0x6e37ff['where']=qs[_0x4928('0x38')](_[_0x4928('0x39')](_0xab6136[_0x4928('0x2f')],_0x5bb8d4[_0x4928('0x38')]),_0x47048a);if(_0xab6136['query'][_0x4928('0x3a')]){_0x6e37ff['where']=_['merge'](_0x6e37ff[_0x4928('0x3b')],{'$or':_['map'](_0x47048a,function(_0x1fa561){if(_0x1fa561[_0x4928('0x2c')]!==_0x4928('0x3c')){var _0x4154e7={};_0x4154e7[_0x1fa561['name']]={'$like':'%'+_0xab6136[_0x4928('0x2f')]['filter']+'%'};return _0x4154e7;}})});}_0x6e37ff=_[_0x4928('0x3d')]({},_0x6e37ff,_0xab6136[_0x4928('0x3e')]);var _0x4135d6={'where':_0x6e37ff['where']};return db['MailMessage'][_0x4928('0x20')](_0x4135d6)[_0x4928('0x12')](function(_0x517fba){_0x507cb4[_0x4928('0x20')]=_0x517fba;if(_0xab6136[_0x4928('0x2f')][_0x4928('0x3f')]){_0x6e37ff[_0x4928('0x40')]=[{'all':!![]}];}return db['MailMessage'][_0x4928('0x41')](_0x6e37ff);})[_0x4928('0x12')](function(_0x5b1ea1){_0x507cb4[_0x4928('0x42')]=_0x5b1ea1;return _0x507cb4;})[_0x4928('0x12')](respondWithFilteredResult(_0x2b5049,_0x6e37ff))[_0x4928('0x1a')](handleError(_0x2b5049,null));};exports[_0x4928('0x43')]=function(_0x4d1683,_0x10e2cd){var _0x8d3e3a={'raw':!![],'where':{'id':_0x4d1683['params']['id']}},_0x3f223e={};_0x3f223e[_0x4928('0x31')]=_[_0x4928('0x2e')](db[_0x4928('0x2a')][_0x4928('0x2b')]);_0x3f223e[_0x4928('0x2f')]=_[_0x4928('0x2e')](_0x4d1683[_0x4928('0x2f')]);_0x3f223e[_0x4928('0x38')]=_['intersection'](_0x3f223e[_0x4928('0x31')],_0x3f223e['query']);_0x8d3e3a[_0x4928('0x32')]=_[_0x4928('0x30')](_0x3f223e['model'],qs[_0x4928('0x44')](_0x4d1683[_0x4928('0x2f')][_0x4928('0x44')]));_0x8d3e3a[_0x4928('0x32')]=_0x8d3e3a[_0x4928('0x32')][_0x4928('0x33')]?_0x8d3e3a[_0x4928('0x32')]:_0x3f223e['model'];if(_0x4d1683[_0x4928('0x2f')][_0x4928('0x3f')]){_0x8d3e3a[_0x4928('0x40')]=[{'all':!![]}];}_0x8d3e3a=_[_0x4928('0x3d')]({},_0x8d3e3a,_0x4d1683[_0x4928('0x3e')]);return db['MailMessage'][_0x4928('0x45')](_0x8d3e3a)[_0x4928('0x12')](handleEntityNotFound(_0x10e2cd,null))[_0x4928('0x12')](respondWithResult(_0x10e2cd,null))['catch'](handleError(_0x10e2cd,null));};exports[_0x4928('0x23')]=function(_0x43dad4,_0x9776d4){if(_0x43dad4['body']['id']){delete _0x43dad4['body']['id'];}return db[_0x4928('0x2a')][_0x4928('0x45')]({'where':{'id':_0x43dad4[_0x4928('0x46')]['id']}})[_0x4928('0x12')](handleEntityNotFound(_0x9776d4,null))[_0x4928('0x12')](saveUpdates(_0x43dad4[_0x4928('0x47')],null))['then'](respondWithResult(_0x9776d4,null))[_0x4928('0x1a')](handleError(_0x9776d4,null));};exports[_0x4928('0x48')]=function(_0x42368b,_0x5e848f){return db[_0x4928('0x2a')][_0x4928('0x45')]({'where':{'id':_0x42368b['params']['id']}})[_0x4928('0x12')](handleEntityNotFound(_0x5e848f,null))[_0x4928('0x12')](removeEntity(_0x5e848f,null))[_0x4928('0x1a')](handleError(_0x5e848f,null));};exports['describe']=function(_0x2033b5,_0x4d8d1f){return db[_0x4928('0x2a')]['describe']()['then'](respondWithResult(_0x4d8d1f,null))['catch'](handleError(_0x4d8d1f,null));};exports[_0x4928('0x49')]=function(_0x29fd1e,_0x4f55bb){return db['MailMessage'][_0x4928('0x49')](_0x29fd1e[_0x4928('0x47')])['then'](function(_0xe19811){if(_0xe19811){if(_0xe19811['direction']==='out'&&!_0xe19811[_0x4928('0x4a')]){var _0x5b78f4,_0x1f7daf,_0x3fd3bf;if(_0x29fd1e['body']['to']){_0x1f7daf=_0x29fd1e[_0x4928('0x47')]['to']['split'](',')[0x0];}return db[_0x4928('0x4b')][_0x4928('0x4c')]({'where':{'id':_0xe19811['MailAccountId']},'include':[{'model':db[_0x4928('0x4d')],'as':_0x4928('0x4e'),'include':[{'model':db[_0x4928('0x4f')],'as':_0x4928('0x50'),'where':{'email':_0x1f7daf},'limit':0x1,'order':[['updatedAt',_0x4928('0x51')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4928('0x52')],'as':_0x4928('0x52'),'raw':!![]}]}]})[_0x4928('0x12')](function(_0x26714f){_0x5b78f4=_0x26714f;if(!_0x5b78f4||!_0x5b78f4['Smtp'])return;var _0x53349c=_0x5b78f4['getSmtpOptions']();if(_0x29fd1e[_0x4928('0x47')][_0x4928('0x53')]&&_0x29fd1e[_0x4928('0x47')][_0x4928('0x53')][_0x4928('0x33')]){for(var _0x1a672a=0x0;_0x1a672a<_0x29fd1e['body'][_0x4928('0x53')][_0x4928('0x33')];_0x1a672a+=0x1){_0x29fd1e[_0x4928('0x47')][_0x4928('0x53')][_0x1a672a]={'filename':_0x29fd1e['body'][_0x4928('0x53')][_0x1a672a][_0x4928('0x27')],'path':path[_0x4928('0x54')](config[_0x4928('0x55')],'server/files/attachments',_0x29fd1e['body'][_0x4928('0x53')][_0x1a672a]['basename'])};}}_0x3fd3bf={'account':_0x53349c,'message':_0x29fd1e[_0x4928('0x47')]};return;})['then'](function(){if(_0x5b78f4[_0x4928('0x4e')]){if(_0x5b78f4[_0x4928('0x4e')][_0x4928('0x50')][_0x4928('0x33')]){return _0x5b78f4['List']['Contacts'][0x0];}else{return db[_0x4928('0x4f')][_0x4928('0x49')](_[_0x4928('0x56')](_0x29fd1e[_0x4928('0x47')],{'firstName':_0x29fd1e[_0x4928('0x47')]['to'],'email':_0x29fd1e[_0x4928('0x47')]['to'],'phone':_0x29fd1e[_0x4928('0x47')]['to'],'ListId':_0x5b78f4[_0x4928('0x57')]}));}}else{throw new Error(_0x4928('0x58'));}})[_0x4928('0x12')](function(){if(_0x3fd3bf){return respondWithRpcPromise('SendMail',_0x4928('0x59'),_0x3fd3bf,client9003)['then'](function(_0x58be1b){return _0xe19811['update']({'read':!![],'messageId':_0x58be1b[_0x4928('0x5a')],'sentAt':moment()[_0x4928('0x5b')](_0x4928('0x5c'))});})[_0x4928('0x1a')](function(_0x249013){logger[_0x4928('0x17')]('%s',JSON[_0x4928('0x5d')](_0x249013));return _0xe19811;});}return _0xe19811;});}return _0xe19811;}})[_0x4928('0x12')](respondWithResult(_0x4f55bb,0xc9))[_0x4928('0x1a')](handleError(_0x4f55bb,null));};exports[_0x4928('0x5e')]=function(_0x3b9a4f,_0x43a97f){var _0xa10d7d=_0x4928('0x5f');return interactionService[_0x4928('0x60')](_0x3b9a4f,_0xa10d7d)[_0x4928('0x12')](respondWithResult(_0x43a97f,null))[_0x4928('0x1a')](handleError(_0x43a97f,null));};exports[_0x4928('0x61')]=function(_0x29acee,_0x1d2451){var _0x2cfa6a={'agent':{},'channel':_0x4928('0x5f')};if(_0x29acee[_0x4928('0x47')]['id']){delete _0x29acee[_0x4928('0x47')]['id'];}_0x29acee[_0x4928('0x47')]['UserId']=_0x29acee[_0x4928('0x47')][_0x4928('0x62')]||_0x29acee[_0x4928('0x63')]['id'];_0x2cfa6a[_0x4928('0x64')]['id']=_0x29acee['body'][_0x4928('0x62')];return db[_0x4928('0x2a')][_0x4928('0x45')]({'where':{'id':_0x29acee[_0x4928('0x46')]['id'],'UserId':null}})[_0x4928('0x12')](handleEntityNotFound(_0x1d2451,null))[_0x4928('0x12')](function(_0x3fafaf){if(_0x3fafaf){_0x2cfa6a[_0x4928('0x19')]=_0x3fafaf['get']({'plain':!![]});return db[_0x4928('0x65')][_0x4928('0x45')]({'where':{'id':_0x3fafaf[_0x4928('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x1d2451,null))[_0x4928('0x12')](function(_0x4928c2){if(_0x4928c2){_0x2cfa6a[_0x4928('0x67')]=_0x4928c2[_0x4928('0x68')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x29acee[_0x4928('0x63')]['id'],_0x29acee['user']['name'],_0x29acee[_0x4928('0x63')][_0x4928('0x69')],_0x2cfa6a['interaction']['id'],_0x29acee[_0x4928('0x47')]?JSON[_0x4928('0x5d')](_0x29acee[_0x4928('0x47')]):_0x4928('0x6a'));return respondWithRpcPromise(_0x4928('0x6b'),_0x4928('0x6c'),_0x2cfa6a);}return null;})[_0x4928('0x12')](function(_0x102f77){var _0x6d5dd3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x102f77[_0x4928('0x19')][_0x4928('0x6d')];return db[_0x4928('0x6e')][_0x4928('0x2f')](_0x6d5dd3,{'type':db[_0x4928('0x6f')][_0x4928('0x70')][_0x4928('0x71')],'raw':!![]})[_0x4928('0x12')](function(_0x12e39c){return _0x12e39c;});})['then'](function(_0x56bf54){if(_0x56bf54){_0x2cfa6a['message'][_0x4928('0x72')]=_0x56bf54[0x0];if(!_0x29acee[_0x4928('0x47')][_0x4928('0x62')])return;return db[_0x4928('0x73')][_0x4928('0x45')]({'where':{'id':_0x29acee[_0x4928('0x47')][_0x4928('0x62')],'role':_0x4928('0x64')},'attributes':['id',_0x4928('0x27'),_0x4928('0x74'),_0x4928('0x75'),_0x4928('0x76')],'raw':!![]});}return null;})[_0x4928('0x12')](function(_0x1ed6d1){if(!_0x1ed6d1)return null;_0x2cfa6a[_0x4928('0x19')][_0x4928('0x64')]=_0x1ed6d1;return _0x2cfa6a;})[_0x4928('0x12')](function(_0x32761b){if(_0x32761b){_0x32761b[_0x4928('0x19')]['interface']=util[_0x4928('0x5b')](_0x4928('0x77'),_0x29acee[_0x4928('0x63')]['name']);_0x32761b[_0x4928('0x19')][_0x4928('0x78')]=_0x2cfa6a[_0x4928('0x78')];_0x32761b[_0x4928('0x19')][_0x4928('0x79')]=_0x2cfa6a[_0x4928('0x78')];_0x32761b[_0x4928('0x19')][_0x4928('0x7a')]=_0x4928('0x61');_0x32761b['message'][_0x4928('0x47')]=htmlToText[_0x4928('0x7b')](_0x2cfa6a['message']['body']);respondWithRpcPromise('EventManager',_0x4928('0x7c'),{'event':'rejectmessage','message':_0x32761b[_0x4928('0x19')]},client9002);return _0x2cfa6a;}return null;})[_0x4928('0x12')](respondWithResult(_0x1d2451,null))[_0x4928('0x1a')](handleError(_0x1d2451,null));};exports[_0x4928('0x7d')]=function(_0x4f39d9,_0x3c8071){var _0x4b4847=moment()[_0x4928('0x7e')]()[_0x4928('0x7f')]();var _0x190399=path[_0x4928('0x54')](config[_0x4928('0x55')],_0x4928('0x80'),_0x4928('0x81'),_0x4928('0x82'));var _0x515706=path[_0x4928('0x54')](config[_0x4928('0x55')],'server',_0x4928('0x81'),_0x4928('0x53'));var _0x486798=util[_0x4928('0x5b')](_0x4928('0x83'),_0x4b4847);return db[_0x4928('0x2a')]['find']({'where':{'id':_0x4f39d9[_0x4928('0x46')]['id']},'attributes':['id','body',_0x4928('0x84'),'to','cc',_0x4928('0x85'),_0x4928('0x86'),_0x4928('0x87')],'include':_0x4f39d9[_0x4928('0x2f')][_0x4928('0x53')]?[{'model':db['Attachment'],'as':_0x4928('0x88')}]:undefined})[_0x4928('0x12')](handleEntityNotFound(_0x3c8071,null))[_0x4928('0x12')](function(_0x1b58b6){if(_0x1b58b6){var _0x169f58=_0x1b58b6;var _0x312f65={'from':_0x169f58[_0x4928('0x84')],'to':_0x169f58['to'],'subject':_0x169f58[_0x4928('0x86')],'html':htmlEntities[_0x4928('0x89')](_0x169f58[_0x4928('0x47')]),'headers':{'Date':moment(_0x169f58[_0x4928('0x87')])[_0x4928('0x5b')](_0x4928('0x8a'))},'attachments':[]};if(_0x1b58b6['cc']){_0x312f65[_0x4928('0x8b')]['Cc']=_0x1b58b6['cc'];}if(_0x1b58b6[_0x4928('0x85')]){_0x312f65['headers']['Bcc']=_0x1b58b6[_0x4928('0x85')];}return new Promise(function(_0x5b2aae,_0x52f105){if(_0x1b58b6['Attachments']){for(var _0x276335=0x0;_0x276335<_0x1b58b6[_0x4928('0x88')][_0x4928('0x33')];_0x276335++){var _0x118ab3=_0x1b58b6[_0x4928('0x88')][_0x276335];var _0x28b13e=path[_0x4928('0x54')](_0x515706,_0x118ab3[_0x4928('0x8c')]);if(fs[_0x4928('0x8d')](_0x28b13e)){_0x312f65['attachments'][_0x4928('0x8e')]({'name':_0x118ab3[_0x4928('0x27')],'contentType':_0x118ab3['type'],'data':fs[_0x4928('0x8f')](_0x28b13e)});}}}emlformat[_0x4928('0x90')](_0x312f65,function(_0x1a66f5,_0x32c512){if(_0x1a66f5)return _0x52f105(_0x1a66f5);fs[_0x4928('0x91')](path[_0x4928('0x54')](_0x190399,_0x486798),_0x32c512);return _0x5b2aae(_0x32c512);});});}})['then'](function(_0x41ded6){if(_0x41ded6){return _0x3c8071[_0x4928('0x7d')](path[_0x4928('0x54')](_0x190399,_0x486798),_0x486798,function(_0x4da1e3){if(!_0x4da1e3)fs[_0x4928('0x92')](path[_0x4928('0x54')](_0x190399,_0x486798));});}})[_0x4928('0x1a')](handleError(_0x3c8071,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 880f061..278d3c2 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 _0xbaa1=['hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x26a8ea,_0x3e92ec){var _0x124afa=function(_0x47306a){while(--_0x47306a){_0x26a8ea['push'](_0x26a8ea['shift']());}};_0x124afa(++_0x3e92ec);}(_0xbaa1,0x85));var _0x1baa=function(_0x5b47a8,_0x63735d){_0x5b47a8=_0x5b47a8-0x0;var _0x567ebf=_0xbaa1[_0x5b47a8];return _0x567ebf;};'use strict';var EventEmitter=require(_0x1baa('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x1baa('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1baa('0x2')](0x0);var events={'afterCreate':_0x1baa('0x3'),'afterUpdate':_0x1baa('0x4'),'afterDestroy':_0x1baa('0x5')};function emitEvent(_0x42d334){return function(_0x360712,_0x98bcd4,_0x46b996){MailMessageEvents['emit'](_0x42d334+':'+_0x360712['id'],_0x360712);MailMessageEvents[_0x1baa('0x6')](_0x42d334,_0x360712);_0x46b996(null);};}for(var e in events){if(events[_0x1baa('0x7')](e)){var event=events[e];MailMessage[_0x1baa('0x8')](e,emitEvent(event));}}module[_0x1baa('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xa958=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4d01f3,_0x51b822){var _0x4f2752=function(_0x4f36ff){while(--_0x4f36ff){_0x4d01f3['push'](_0x4d01f3['shift']());}};_0x4f2752(++_0x51b822);}(_0xa958,0x169));var _0x8a95=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa958[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x8a95('0x0'));var MailMessage=require(_0x8a95('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8a95('0x2')](0x0);var events={'afterCreate':_0x8a95('0x3'),'afterUpdate':_0x8a95('0x4'),'afterDestroy':'remove'};function emitEvent(_0x16a2ff){return function(_0x1ca83c,_0x2c9bf7,_0x5c23c3){MailMessageEvents['emit'](_0x16a2ff+':'+_0x1ca83c['id'],_0x1ca83c);MailMessageEvents[_0x8a95('0x5')](_0x16a2ff,_0x1ca83c);_0x5c23c3(null);};}for(var e in events){if(events[_0x8a95('0x6')](e)){var event=events[e];MailMessage[_0x8a95('0x7')](e,emitEvent(event));}}module[_0x8a95('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 3c6ff42..0bf4f79 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 _0xa19a=['FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4','lodash','../../config/logger','api','bluebird','html-to-text','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa19a,0x1e1));var _0xaa19=function(_0x963de3,_0x4afa2d){_0x963de3=_0x963de3-0x0;var _0x4f7d3e=_0xa19a[_0x963de3];return _0x4f7d3e;};'use strict';var _=require(_0xaa19('0x0'));var util=require('util');var logger=require(_0xaa19('0x1'))(_0xaa19('0x2'));var moment=require('moment');var BPromise=require(_0xaa19('0x3'));var rp=require('request-promise');var htmlToText=require(_0xaa19('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa19('0x5'));module['exports']=function(_0x5ecbca,_0x1e7311){return _0x5ecbca[_0xaa19('0x6')](_0xaa19('0x7'),attributes,{'tableName':_0xaa19('0x8'),'paranoid':![],'indexes':[{'name':_0xaa19('0x9'),'fields':['messageId']},{'name':_0xaa19('0xa'),'fields':[_0xaa19('0xb'),'subject'],'type':_0xaa19('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x173c18,_0x56acf0,_0x4c8415){if(_0x173c18[_0xaa19('0xd')]){_0x173c18[_0xaa19('0xb')]=htmlToText[_0xaa19('0xe')](_0x173c18[_0xaa19('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4c8415(null,_0x56acf0);},'afterCreate':function(_0x9efbe4,_0x5949bc,_0x3dcdd3){var _0xed8ec4=_0x5ecbca[_0xaa19('0xf')];var _0xe0cc65=_0x9efbe4[_0xaa19('0x10')]({'plain':!![]});if(_0xe0cc65['direction'][_0xaa19('0x11')]()==='in'||_0xe0cc65[_0xaa19('0x12')][_0xaa19('0x11')]()===_0xaa19('0x13')&&!_0xe0cc65['secret']&&!_[_0xaa19('0x14')](_0xe0cc65[_0xaa19('0x15')])){_0xed8ec4[_0xaa19('0x16')][_0xaa19('0x17')]({'where':{'id':_0xe0cc65[_0xaa19('0x18')]}})[_0xaa19('0x19')](function(_0x1d90dc){if(_0x1d90dc){_0x1d90dc['update']({'lastMsgAt':_0xe0cc65[_0xaa19('0x1a')],'lastMsgDirection':_0xe0cc65['direction'][_0xaa19('0x11')]()});}})['catch'](function(_0x198ab8){console[_0xaa19('0x1b')](_0x198ab8);});}_0x3dcdd3();}},'charset':_0xaa19('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd347=['moment','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd347,0x12f));var _0x7d34=function(_0x116ef0,_0x1337aa){_0x116ef0=_0x116ef0-0x0;var _0x1d6eac=_0xd347[_0x116ef0];return _0x1d6eac;};'use strict';var _=require(_0x7d34('0x0'));var util=require(_0x7d34('0x1'));var logger=require(_0x7d34('0x2'))('api');var moment=require(_0x7d34('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d34('0x4'));var htmlToText=require(_0x7d34('0x5'));var fs=require('fs');var path=require(_0x7d34('0x6'));var rimraf=require(_0x7d34('0x7'));var config=require('../../config/environment');var attributes=require(_0x7d34('0x8'));module[_0x7d34('0x9')]=function(_0x301692,_0x30c31d){return _0x301692['define'](_0x7d34('0xa'),attributes,{'tableName':_0x7d34('0xb'),'paranoid':![],'indexes':[{'name':_0x7d34('0xc'),'fields':[_0x7d34('0xc')]},{'name':_0x7d34('0xd'),'fields':[_0x7d34('0xe'),_0x7d34('0xf')],'type':_0x7d34('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x284cfc,_0x5cba4f,_0x4e001a){if(_0x284cfc['body']){_0x284cfc[_0x7d34('0xe')]=htmlToText[_0x7d34('0x11')](_0x284cfc[_0x7d34('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4e001a(null,_0x5cba4f);},'afterCreate':function(_0x48b00b,_0xb0eb78,_0x593032){var _0x51e5fb=_0x301692[_0x7d34('0x13')];var _0x58d2b4=_0x48b00b['get']({'plain':!![]});if(_0x58d2b4[_0x7d34('0x14')][_0x7d34('0x15')]()==='in'||_0x58d2b4[_0x7d34('0x14')][_0x7d34('0x15')]()===_0x7d34('0x16')&&!_0x58d2b4[_0x7d34('0x17')]&&!_[_0x7d34('0x18')](_0x58d2b4[_0x7d34('0x19')])){_0x51e5fb[_0x7d34('0x1a')][_0x7d34('0x1b')]({'where':{'id':_0x58d2b4[_0x7d34('0x1c')]}})[_0x7d34('0x1d')](function(_0x16b0a0){if(_0x16b0a0){_0x16b0a0[_0x7d34('0x1e')]({'lastMsgAt':_0x58d2b4[_0x7d34('0x1f')],'lastMsgDirection':_0x58d2b4[_0x7d34('0x14')]['toLowerCase']()});}})['catch'](function(_0xe63d24){console[_0x7d34('0x20')](_0xe63d24);});}_0x593032();}},'charset':'utf8mb4','collate':_0x7d34('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9abebcc..e871377 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 _0xbaf0=['request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x2cbc1e,_0x297280){var _0x3df1b7=function(_0x31bac0){while(--_0x31bac0){_0x2cbc1e['push'](_0x2cbc1e['shift']());}};_0x3df1b7(++_0x297280);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});config[_0x0baf('0xc')]=_[_0x0baf('0xd')](config[_0x0baf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0xe'))(new Redis(config['redis']));require(_0x0baf('0xf'))[_0x0baf('0x10')](socket);function respondWithRpcPromise(_0x465528,_0x2f46e8,_0x7f54d4){return new BPromise(function(_0xf4c8ac,_0x41cead){return client[_0x0baf('0x11')](_0x465528,_0x7f54d4)[_0x0baf('0x12')](function(_0x1d60a2){logger[_0x0baf('0x13')]('MailMessage,\x20%s,\x20%s',_0x2f46e8,'request\x20sent');logger[_0x0baf('0x14')](_0x0baf('0x15'),_0x2f46e8,_0x0baf('0x16'),JSON[_0x0baf('0x17')](_0x1d60a2));if(_0x1d60a2['error']){if(_0x1d60a2[_0x0baf('0x18')]['code']===0x1f4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0x41cead(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0xf4c8ac(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}else{logger[_0x0baf('0x13')](_0x0baf('0x19'),_0x2f46e8,'request\x20sent');_0xf4c8ac(_0x1d60a2[_0x0baf('0x1b')][_0x0baf('0x1a')]);}})[_0x0baf('0x1c')](function(_0x3e9cb4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x3e9cb4);_0x41cead(_0x3e9cb4);});});}exports['CreateMailMessage']=function(_0x5cff5d){var _0x1410ec=this;return new Promise(function(_0x154f48,_0x32e839){return db[_0x0baf('0x1d')][_0x0baf('0x1e')](_0x5cff5d[_0x0baf('0x1f')],{'raw':_0x5cff5d[_0x0baf('0x20')]?_0x5cff5d[_0x0baf('0x20')][_0x0baf('0x21')]===undefined?!![]:![]:!![]})[_0x0baf('0x12')](function(_0x54f2fa){logger[_0x0baf('0x13')]('CreateMailMessage',_0x5cff5d);logger[_0x0baf('0x14')]('CreateMailMessage',_0x5cff5d,JSON['stringify'](_0x54f2fa));_0x154f48(_0x54f2fa);})[_0x0baf('0x1c')](function(_0x48a0e9){logger['error'](_0x0baf('0x22'),_0x48a0e9[_0x0baf('0x1a')],_0x5cff5d);_0x32e839(_0x1410ec[_0x0baf('0x18')](0x1f4,_0x48a0e9[_0x0baf('0x1a')]));});});}; \ No newline at end of file +var _0x430c=['ioredis','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','body','raw','CreateMailMessage','lodash','bluebird','randomstring'];(function(_0x20cb5d,_0x5b6ec7){var _0x33dd23=function(_0x5918a9){while(--_0x5918a9){_0x20cb5d['push'](_0x20cb5d['shift']());}};_0x33dd23(++_0x5b6ec7);}(_0x430c,0x1a1));var _0xc430=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x430c[_0xd511d];return _0x3f148e;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});config['redis']=_[_0xc430('0x7')](config[_0xc430('0x8')],{'host':_0xc430('0x9'),'port':0x18eb});var socket=require(_0xc430('0xa'))(new Redis(config[_0xc430('0x8')]));require(_0xc430('0xb'))[_0xc430('0xc')](socket);function respondWithRpcPromise(_0x115814,_0x24737a,_0x5bbdf9){return new BPromise(function(_0x97fa5b,_0x2b47d6){return client['request'](_0x115814,_0x5bbdf9)[_0xc430('0xd')](function(_0x5aeed9){logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,_0xc430('0xf'));logger[_0xc430('0x10')](_0xc430('0x11'),_0x24737a,_0xc430('0xf'),JSON[_0xc430('0x12')](_0x5aeed9));if(_0x5aeed9[_0xc430('0x13')]){if(_0x5aeed9[_0xc430('0x13')]['code']===0x1f4){logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);return _0x2b47d6(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}logger['error'](_0xc430('0x14'),_0x24737a,_0x5aeed9['error']['message']);return _0x97fa5b(_0x5aeed9[_0xc430('0x13')][_0xc430('0x15')]);}else{logger[_0xc430('0xe')]('MailMessage,\x20%s,\x20%s',_0x24737a,'request\x20sent');_0x97fa5b(_0x5aeed9[_0xc430('0x16')]['message']);}})[_0xc430('0x17')](function(_0x4f7094){logger['error'](_0xc430('0x14'),_0x24737a,_0x4f7094);_0x2b47d6(_0x4f7094);});});}exports['CreateMailMessage']=function(_0x302926){var _0x1eae3b=this;return new Promise(function(_0x3eb888,_0x1f90bb){return db[_0xc430('0x18')]['create'](_0x302926[_0xc430('0x19')],{'raw':_0x302926['options']?_0x302926['options'][_0xc430('0x1a')]===undefined?!![]:![]:!![]})[_0xc430('0xd')](function(_0x3c7afa){logger['info'](_0xc430('0x1b'),_0x302926);logger['debug'](_0xc430('0x1b'),_0x302926,JSON[_0xc430('0x12')](_0x3c7afa));_0x3eb888(_0x3c7afa);})['catch'](function(_0x31b4f1){logger[_0xc430('0x13')]('CreateMailMessage',_0x31b4f1[_0xc430('0x15')],_0x302926);_0x1f90bb(_0x1eae3b['error'](0x1f4,_0x31b4f1[_0xc430('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index d8967ed..58a736c 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 _0x2911=['./mailMessage.events','save','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x3695d5,_0x1b8740){var _0x599a61=function(_0x5f2e74){while(--_0x5f2e74){_0x3695d5['push'](_0x3695d5['shift']());}};_0x599a61(++_0x1b8740);}(_0x2911,0x90));var _0x1291=function(_0x43a89e,_0xdfaddb){_0x43a89e=_0x43a89e-0x0;var _0x3ddb80=_0x2911[_0x43a89e];return _0x3ddb80;};'use strict';var MailMessageEvents=require(_0x1291('0x0'));var events=[_0x1291('0x1'),_0x1291('0x2'),_0x1291('0x3')];function createListener(_0x8711c2,_0x2833de){return function(_0x232ebe){_0x2833de[_0x1291('0x4')](_0x8711c2,_0x232ebe);};}function removeListener(_0x38ab01,_0x5155f7){return function(){MailMessageEvents[_0x1291('0x5')](_0x38ab01,_0x5155f7);};}exports[_0x1291('0x6')]=function(_0x78646e){for(var _0x1115dd=0x0,_0x4672f8=events[_0x1291('0x7')];_0x1115dd<_0x4672f8;_0x1115dd++){var _0x67dc43=events[_0x1115dd];var _0x2151ea=createListener(_0x1291('0x8')+_0x67dc43,_0x78646e);MailMessageEvents['on'](_0x67dc43,_0x2151ea);}}; \ No newline at end of file +var _0x4428=['register','length','./mailMessage.events','save','remove','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4428,0x170));var _0x8442=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4428[_0x4565bf];return _0x5610ba;};'use strict';var MailMessageEvents=require(_0x8442('0x0'));var events=[_0x8442('0x1'),_0x8442('0x2'),_0x8442('0x3')];function createListener(_0xabd815,_0x53cd88){return function(_0x2624bb){_0x53cd88['emit'](_0xabd815,_0x2624bb);};}function removeListener(_0x43d2e7,_0x440058){return function(){MailMessageEvents['removeListener'](_0x43d2e7,_0x440058);};}exports[_0x8442('0x4')]=function(_0x3f2c27){for(var _0x101a13=0x0,_0x1b798a=events[_0x8442('0x5')];_0x101a13<_0x1b798a;_0x101a13++){var _0x253ff3=events[_0x101a13];var _0x354cc7=createListener('mailMessage:'+_0x253ff3,_0x3f2c27);MailMessageEvents['on'](_0x253ff3,_0x354cc7);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b8bd093..913033f 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 _0x9682=['destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','/:id','delete'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9682,0x109));var _0x2968=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9682[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x2968('0x0'));var util=require(_0x2968('0x1'));var path=require('path');var timeout=require(_0x2968('0x2'));var express=require(_0x2968('0x3'));var router=express['Router']();var fs_extra=require(_0x2968('0x4'));var auth=require(_0x2968('0x5'));var interaction=require(_0x2968('0x6'));var config=require('../../config/environment');var controller=require(_0x2968('0x7'));router[_0x2968('0x8')]('/',auth[_0x2968('0x9')](),controller[_0x2968('0xa')]);router[_0x2968('0x8')]('/describe',auth[_0x2968('0x9')](),controller[_0x2968('0xb')]);router[_0x2968('0x8')]('/:id',auth[_0x2968('0x9')](),controller[_0x2968('0xc')]);router[_0x2968('0x8')](_0x2968('0xd'),auth[_0x2968('0x9')](),controller[_0x2968('0xe')]);router['get'](_0x2968('0xf'),auth[_0x2968('0x9')](),controller[_0x2968('0x10')]);router[_0x2968('0x8')](_0x2968('0x11'),auth[_0x2968('0x9')](),controller['getAgents']);router[_0x2968('0x12')]('/',auth['isAuthenticated'](),controller[_0x2968('0x13')]);router[_0x2968('0x12')](_0x2968('0xf'),auth[_0x2968('0x9')](),controller[_0x2968('0x14')]);router['post'](_0x2968('0x11'),auth['isAuthenticated'](),controller[_0x2968('0x15')]);router[_0x2968('0x16')](_0x2968('0x17'),auth[_0x2968('0x9')](),controller['update']);router[_0x2968('0x18')]('/:id',auth[_0x2968('0x9')](),controller[_0x2968('0x19')]);router[_0x2968('0x18')](_0x2968('0xf'),auth[_0x2968('0x9')](),controller[_0x2968('0x1a')]);router[_0x2968('0x18')](_0x2968('0x11'),auth['isAuthenticated'](),controller[_0x2968('0x1b')]);module[_0x2968('0x1c')]=router; \ No newline at end of file +var _0x4f61=['addAgents','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f61,0xef));var _0x14f6=function(_0x23150c,_0x4197bd){_0x23150c=_0x23150c-0x0;var _0x4a655b=_0x4f61[_0x23150c];return _0x4a655b;};'use strict';var multer=require(_0x14f6('0x0'));var util=require(_0x14f6('0x1'));var path=require(_0x14f6('0x2'));var timeout=require('connect-timeout');var express=require(_0x14f6('0x3'));var router=express[_0x14f6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x14f6('0x5'));var interaction=require(_0x14f6('0x6'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth[_0x14f6('0x7')](),controller['index']);router[_0x14f6('0x8')]('/describe',auth[_0x14f6('0x7')](),controller[_0x14f6('0x9')]);router[_0x14f6('0x8')](_0x14f6('0xa'),auth['isAuthenticated'](),controller[_0x14f6('0xb')]);router['get'](_0x14f6('0xc'),auth[_0x14f6('0x7')](),controller[_0x14f6('0xd')]);router[_0x14f6('0x8')](_0x14f6('0xe'),auth[_0x14f6('0x7')](),controller[_0x14f6('0xf')]);router[_0x14f6('0x8')](_0x14f6('0x10'),auth[_0x14f6('0x7')](),controller[_0x14f6('0x11')]);router[_0x14f6('0x12')]('/',auth[_0x14f6('0x7')](),controller[_0x14f6('0x13')]);router['post']('/:id/teams',auth[_0x14f6('0x7')](),controller[_0x14f6('0x14')]);router['post'](_0x14f6('0x10'),auth[_0x14f6('0x7')](),controller[_0x14f6('0x15')]);router[_0x14f6('0x16')](_0x14f6('0xa'),auth['isAuthenticated'](),controller[_0x14f6('0x17')]);router[_0x14f6('0x18')]('/:id',auth[_0x14f6('0x7')](),controller[_0x14f6('0x19')]);router[_0x14f6('0x18')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x14f6('0x18')](_0x14f6('0x10'),auth[_0x14f6('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index abc3819..19329bd 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 _0x5c4f=['ENUM'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5c4f,0x9d));var _0xf5c4=function(_0x593655,_0x5f272b){_0x593655=_0x593655-0x0;var _0x3852f4=_0x5c4f[_0x593655];return _0x3852f4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf5c4('0x0')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x1d2d=['roundrobin','sequelize','exports','ENUM','rrmemory','beepall'];(function(_0x20960b,_0x364d16){var _0x49356d=function(_0x2b1eb5){while(--_0x2b1eb5){_0x20960b['push'](_0x20960b['shift']());}};_0x49356d(++_0x364d16);}(_0x1d2d,0x199));var _0xd1d2=function(_0x59ca3e,_0x9a9d3f){_0x59ca3e=_0x59ca3e-0x0;var _0x4650b2=_0x1d2d[_0x59ca3e];return _0x4650b2;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module[_0xd1d2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd1d2('0x2')](_0xd1d2('0x3'),_0xd1d2('0x4'),_0xd1d2('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ac02718..6df5dee 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 _0x0ace=['send','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','keys','filters','intersection','model','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','removeTeams','User','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','userMailQueue:save','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','offset','undefined','limit','count','set','then','destroy','get','UserProfileResource','end','sendStatus','stack','name'];(function(_0x558951,_0x41fe79){var _0x3244fb=function(_0x19c16c){while(--_0x19c16c){_0x558951['push'](_0x558951['shift']());}};_0x3244fb(++_0x41fe79);}(_0x0ace,0x1c6));var _0xe0ac=function(_0x136e17,_0x4cc300){_0x136e17=_0x136e17-0x0;var _0x5099c9=_0x0ace[_0x136e17];return _0x5099c9;};'use strict';var BPromise=require(_0xe0ac('0x0'));var util=require(_0xe0ac('0x1'));var _=require(_0xe0ac('0x2'));var squel=require('squel');var Redis=require(_0xe0ac('0x3'));var qs=require(_0xe0ac('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe0ac('0x5')]=_[_0xe0ac('0x6')](config[_0xe0ac('0x5')],{'host':_0xe0ac('0x7'),'port':0x18eb});var socket=require(_0xe0ac('0x8'))(new Redis(config[_0xe0ac('0x5')]));require(_0xe0ac('0x9'))[_0xe0ac('0xa')](socket);function respondWithStatusCode(_0x12fad2,_0x4d0475){_0x4d0475=_0x4d0475||0xcc;return function(_0xb06525){if(_0xb06525){return _0x12fad2['sendStatus'](_0x4d0475);}return _0x12fad2[_0xe0ac('0xb')](_0x4d0475)['end']();};}function respondWithResult(_0x21c98e,_0x54c190){_0x54c190=_0x54c190||0xc8;return function(_0x3bc477){if(_0x3bc477){return _0x21c98e[_0xe0ac('0xb')](_0x54c190)[_0xe0ac('0xc')](_0x3bc477);}};}function respondWithFilteredResult(_0xa183ac,_0xbc330e){return function(_0x573cb2){if(_0x573cb2){var _0x26e326=typeof _0xbc330e[_0xe0ac('0xd')]===_0xe0ac('0xe')&&typeof _0xbc330e[_0xe0ac('0xf')]==='undefined';var _0x15021c=_0x573cb2[_0xe0ac('0x10')];var _0x12a41c=_0x26e326?0x0:_0xbc330e['offset'];var _0x8eff1d=_0x26e326?_0x573cb2[_0xe0ac('0x10')]:_0xbc330e[_0xe0ac('0xd')]+_0xbc330e['limit'];var _0x34ed17;if(_0x8eff1d>=_0x15021c){_0x8eff1d=_0x15021c;_0x34ed17=0xc8;}else{_0x34ed17=0xce;}_0xa183ac['status'](_0x34ed17);return _0xa183ac[_0xe0ac('0x11')]('Content-Range',_0x12a41c+'-'+_0x8eff1d+'/'+_0x15021c)[_0xe0ac('0xc')](_0x573cb2);}return null;};}function saveUpdates(_0x327adf){return function(_0x14b04a){if(_0x14b04a){return _0x14b04a['update'](_0x327adf)[_0xe0ac('0x12')](function(_0x2f471a){return _0x2f471a;});}return null;};}function removeEntity(_0x1158f1){return function(_0x4fc656){if(_0x4fc656){return _0x4fc656[_0xe0ac('0x13')]()[_0xe0ac('0x12')](function(){var _0x379942=_0x4fc656[_0xe0ac('0x14')]({'plain':!![]});var _0x1a8987='MailQueues';return db[_0xe0ac('0x15')][_0xe0ac('0x13')]({'where':{'type':_0x1a8987,'resourceId':_0x379942['id']}})[_0xe0ac('0x12')](function(){return _0x4fc656;});})[_0xe0ac('0x12')](function(){_0x1158f1[_0xe0ac('0xb')](0xcc)[_0xe0ac('0x16')]();});}};}function handleEntityNotFound(_0x23bc8b){return function(_0x5ad0ce){if(!_0x5ad0ce){_0x23bc8b[_0xe0ac('0x17')](0x194);}return _0x5ad0ce;};}function handleError(_0x47e3be,_0x2f0112){_0x2f0112=_0x2f0112||0x1f4;return function(_0x5ea3e9){logger['error'](_0x5ea3e9[_0xe0ac('0x18')]);if(_0x5ea3e9[_0xe0ac('0x19')]){delete _0x5ea3e9[_0xe0ac('0x19')];}_0x47e3be[_0xe0ac('0xb')](_0x2f0112)[_0xe0ac('0x1a')](_0x5ea3e9);};}exports['index']=function(_0x2f1d8d,_0x2a4375){var _0x2f1062={};var _0x4f2649={'count':0x0,'rows':[]};var _0x7f3329=_[_0xe0ac('0x1b')](db[_0xe0ac('0x1c')][_0xe0ac('0x1d')],function(_0x5ea905){return{'name':_0x5ea905[_0xe0ac('0x1e')],'type':_0x5ea905[_0xe0ac('0x1f')][_0xe0ac('0x20')]};});_0x2f1062=qs[_0xe0ac('0x21')](_0x7f3329,_0x2f1d8d);var _0x335050={'where':_0x2f1062[_0xe0ac('0x22')]};return db[_0xe0ac('0x1c')][_0xe0ac('0x10')](_0x335050)[_0xe0ac('0x12')](function(_0x260311){_0x4f2649[_0xe0ac('0x10')]=_0x260311;_0x2f1062['include']=qs[_0xe0ac('0x23')](_0x2f1d8d[_0xe0ac('0x24')]);return db[_0xe0ac('0x1c')][_0xe0ac('0x25')](_0x2f1062);})['then'](function(_0x4d96cf){_0x4f2649[_0xe0ac('0x26')]=_0x4d96cf;return _0x4f2649;})['then'](respondWithFilteredResult(_0x2a4375,_0x2f1062))[_0xe0ac('0x27')](handleError(_0x2a4375,null));};exports[_0xe0ac('0x28')]=function(_0xcc0068,_0x44e2c4){var _0x1e293f={'raw':!![],'where':{'id':_0xcc0068['params']['id']}},_0x29bd8d={};_0x29bd8d['model']=_[_0xe0ac('0x29')](db[_0xe0ac('0x1c')]['rawAttributes']);_0x29bd8d[_0xe0ac('0x24')]=_[_0xe0ac('0x29')](_0xcc0068[_0xe0ac('0x24')]);_0x29bd8d[_0xe0ac('0x2a')]=_[_0xe0ac('0x2b')](_0x29bd8d[_0xe0ac('0x2c')],_0x29bd8d[_0xe0ac('0x24')]);_0x1e293f[_0xe0ac('0x2d')]=_[_0xe0ac('0x2b')](_0x29bd8d[_0xe0ac('0x2c')],qs[_0xe0ac('0x2e')](_0xcc0068[_0xe0ac('0x24')][_0xe0ac('0x2e')]));_0x1e293f['attributes']=_0x1e293f[_0xe0ac('0x2d')][_0xe0ac('0x2f')]?_0x1e293f[_0xe0ac('0x2d')]:_0x29bd8d['model'];if(_0xcc0068[_0xe0ac('0x24')]['includeAll']){_0x1e293f[_0xe0ac('0x23')]=[{'all':!![]}];}_0x1e293f=_[_0xe0ac('0x30')]({},_0x1e293f,_0xcc0068[_0xe0ac('0x31')]);return db[_0xe0ac('0x1c')][_0xe0ac('0x32')](_0x1e293f)[_0xe0ac('0x12')](handleEntityNotFound(_0x44e2c4,null))[_0xe0ac('0x12')](respondWithResult(_0x44e2c4,null))[_0xe0ac('0x27')](handleError(_0x44e2c4,null));};exports[_0xe0ac('0x33')]=function(_0x292c69,_0x56c995){return db[_0xe0ac('0x1c')][_0xe0ac('0x33')](_0x292c69[_0xe0ac('0x34')],{})[_0xe0ac('0x12')](function(_0x18d7c3){var _0x570895=_0x292c69[_0xe0ac('0x35')][_0xe0ac('0x14')]({'plain':!![]});if(!_0x570895)throw new Error(_0xe0ac('0x36'));if(_0x570895['role']===_0xe0ac('0x35')){var _0x50009e=_0x18d7c3[_0xe0ac('0x14')]({'plain':!![]});var _0x43d95f=_0xe0ac('0x37');return db[_0xe0ac('0x38')][_0xe0ac('0x32')]({'where':{'name':_0x43d95f,'userProfileId':_0x570895[_0xe0ac('0x39')]},'raw':!![]})[_0xe0ac('0x12')](function(_0x17cd39){if(_0x17cd39&&_0x17cd39[_0xe0ac('0x3a')]===0x0){return db['UserProfileResource']['create']({'name':_0x50009e['name'],'resourceId':_0x50009e['id'],'type':_0x17cd39[_0xe0ac('0x19')],'sectionId':_0x17cd39['id']},{})['then'](function(){return _0x18d7c3;});}else{return _0x18d7c3;}})[_0xe0ac('0x27')](function(_0x944be1){logger['error'](_0xe0ac('0x3b'),_0x944be1);throw _0x944be1;});}return _0x18d7c3;})[_0xe0ac('0x12')](respondWithResult(_0x56c995,0xc9))[_0xe0ac('0x27')](handleError(_0x56c995,null));};exports[_0xe0ac('0x3c')]=function(_0x292936,_0x3edc38){if(_0x292936[_0xe0ac('0x34')]['id']){delete _0x292936['body']['id'];}return db['MailQueue'][_0xe0ac('0x32')]({'where':{'id':_0x292936[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x3edc38,null))[_0xe0ac('0x12')](saveUpdates(_0x292936[_0xe0ac('0x34')],null))[_0xe0ac('0x12')](respondWithResult(_0x3edc38,null))[_0xe0ac('0x27')](handleError(_0x3edc38,null));};exports[_0xe0ac('0x13')]=function(_0x4ea59b,_0x5a3878){return db['MailQueue'][_0xe0ac('0x32')]({'where':{'id':_0x4ea59b[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x5a3878,null))['then'](removeEntity(_0x5a3878,null))[_0xe0ac('0x27')](handleError(_0x5a3878,null));};exports[_0xe0ac('0x3e')]=function(_0x106861,_0x30234f){return db[_0xe0ac('0x1c')][_0xe0ac('0x3e')]()[_0xe0ac('0x12')](respondWithResult(_0x30234f,null))[_0xe0ac('0x27')](handleError(_0x30234f,null));};exports[_0xe0ac('0x3f')]=function(_0x46054d,_0x46048d){var _0x396051={'raw':!![],'where':{}},_0x3a9122={},_0x5e3b0e;return db[_0xe0ac('0x1c')]['findOne']({'where':{'id':_0x46054d['params']['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x46048d,null))[_0xe0ac('0x12')](function(_0x2ea188){if(_0x2ea188){_0x5e3b0e=_0x2ea188[_0xe0ac('0x14')]({'plain':!![]});_0x3a9122[_0xe0ac('0x2c')]=_[_0xe0ac('0x29')](db['UserMailQueue'][_0xe0ac('0x1d')]);_0x3a9122[_0xe0ac('0x24')]=_[_0xe0ac('0x29')](_0x46054d[_0xe0ac('0x24')]);_0x3a9122['filters']=_['intersection'](_0x3a9122[_0xe0ac('0x2c')],_0x3a9122[_0xe0ac('0x24')]);_0x396051[_0xe0ac('0x2d')]=_[_0xe0ac('0x2b')](_0x3a9122['model'],qs[_0xe0ac('0x2e')](_0x46054d[_0xe0ac('0x24')][_0xe0ac('0x2e')]));_0x396051[_0xe0ac('0x2d')]=_0x396051[_0xe0ac('0x2d')][_0xe0ac('0x2f')]?_0x396051[_0xe0ac('0x2d')]:_0x3a9122['model'];if(!_0x46054d[_0xe0ac('0x24')][_0xe0ac('0x40')](_0xe0ac('0x41'))){_0x396051[_0xe0ac('0xf')]=qs[_0xe0ac('0xf')](_0x46054d[_0xe0ac('0x24')][_0xe0ac('0xf')]);_0x396051[_0xe0ac('0xd')]=qs[_0xe0ac('0xd')](_0x46054d[_0xe0ac('0x24')][_0xe0ac('0xd')]);}_0x396051[_0xe0ac('0x42')]=qs[_0xe0ac('0x43')](_0x46054d['query']['sort']);_0x396051['where']=qs[_0xe0ac('0x2a')](_[_0xe0ac('0x44')](_0x46054d[_0xe0ac('0x24')],_0x3a9122['filters']));_0x396051[_0xe0ac('0x22')][_0xe0ac('0x45')]=_0x2ea188['id'];if(_0x46054d['query'][_0xe0ac('0x46')]){_0x396051['where']=_[_0xe0ac('0x30')](_0x396051[_0xe0ac('0x22')],{'$or':_[_0xe0ac('0x1b')](_0x396051[_0xe0ac('0x2d')],function(_0x11090c){var _0x54afe5={};_0x54afe5[_0x11090c]={'$like':'%'+_0x46054d[_0xe0ac('0x24')][_0xe0ac('0x46')]+'%'};return _0x54afe5;})});}_0x396051=_[_0xe0ac('0x30')]({},_0x396051,_0x46054d[_0xe0ac('0x31')]);return db['UserMailQueue'][_0xe0ac('0x25')](_0x396051);}})[_0xe0ac('0x12')](function(_0x14d1ca){if(_0x14d1ca){return db['User'][_0xe0ac('0x47')]({'where':{'id':_[_0xe0ac('0x1b')](_0x14d1ca,_0xe0ac('0x48')),'role':'agent'},'attributes':['id',_0xe0ac('0x19'),_0xe0ac('0x49'),_0xe0ac('0x4a'),_0xe0ac('0x4b')]});}})['then'](function(_0x21c796){if(_0x21c796){return{'count':_0x21c796[_0xe0ac('0x10')],'rows':_[_0xe0ac('0x1b')](_0x21c796['rows'],function(_0x361761){return{'membername':_0x361761[_0xe0ac('0x19')],'UserId':_0x361761['id'],'queue_name':_0x5e3b0e[_0xe0ac('0x19')],'MailQueueId':_0x5e3b0e['id'],'interface':util[_0xe0ac('0x4c')]('%s/%s',_0xe0ac('0x4d'),_0x361761[_0xe0ac('0x19')]),'penalty':0x0,'paused':_0x361761[_0xe0ac('0x49')],'createdAt':_0x361761['createdAt'],'updatedAt':_0x361761[_0xe0ac('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0ac('0x12')](respondWithFilteredResult(_0x46048d,_0x396051))[_0xe0ac('0x27')](handleError(_0x46048d,null));};exports[_0xe0ac('0x4e')]=function(_0x30c3e0,_0x5b21ad){var _0x6b4643={};var _0x57b7d5={};var _0x240714;var _0x3c6232;return db['MailQueue'][_0xe0ac('0x4f')]({'where':{'id':_0x30c3e0[_0xe0ac('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5b21ad,null))['then'](function(_0x351866){if(_0x351866){_0x240714=_0x351866;_0x57b7d5['model']=_['keys'](db[_0xe0ac('0x50')]['rawAttributes']);_0x57b7d5[_0xe0ac('0x24')]=_['keys'](_0x30c3e0[_0xe0ac('0x24')]);_0x57b7d5[_0xe0ac('0x2a')]=_[_0xe0ac('0x2b')](_0x57b7d5['model'],_0x57b7d5[_0xe0ac('0x24')]);_0x6b4643[_0xe0ac('0x2d')]=_[_0xe0ac('0x2b')](_0x57b7d5[_0xe0ac('0x2c')],qs[_0xe0ac('0x2e')](_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0x2e')]));_0x6b4643[_0xe0ac('0x2d')]=_0x6b4643[_0xe0ac('0x2d')][_0xe0ac('0x2f')]?_0x6b4643[_0xe0ac('0x2d')]:_0x57b7d5[_0xe0ac('0x2c')];_0x6b4643[_0xe0ac('0x42')]=qs['sort'](_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0x43')]);_0x6b4643[_0xe0ac('0x22')]=qs[_0xe0ac('0x2a')](_['pick'](_0x30c3e0['query'],_0x57b7d5[_0xe0ac('0x2a')]));if(_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0x46')]){_0x6b4643[_0xe0ac('0x22')]=_[_0xe0ac('0x30')](_0x6b4643['where'],{'$or':_['map'](_0x6b4643[_0xe0ac('0x2d')],function(_0x3486f5){var _0x5b61d0={};_0x5b61d0[_0x3486f5]={'$like':'%'+_0x30c3e0['query'][_0xe0ac('0x46')]+'%'};return _0x5b61d0;})});}_0x6b4643=_[_0xe0ac('0x30')]({},_0x6b4643,_0x30c3e0[_0xe0ac('0x31')]);return _0x240714[_0xe0ac('0x4e')](_0x6b4643);}})[_0xe0ac('0x12')](function(_0x4fbe80){if(_0x4fbe80){_0x3c6232=_0x4fbe80['length'];if(!_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0x40')](_0xe0ac('0x41'))){_0x6b4643[_0xe0ac('0xf')]=qs[_0xe0ac('0xf')](_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0xf')]);_0x6b4643['offset']=qs[_0xe0ac('0xd')](_0x30c3e0[_0xe0ac('0x24')]['offset']);}return _0x240714['getTeams'](_0x6b4643);}})[_0xe0ac('0x12')](function(_0x24b0ed){if(_0x24b0ed){return _0x24b0ed?{'count':_0x3c6232,'rows':_0x24b0ed}:null;}})['then'](respondWithResult(_0x5b21ad,null))[_0xe0ac('0x27')](handleError(_0x5b21ad,null));};exports[_0xe0ac('0x51')]=function(_0x27ffcb,_0x30e410){var _0x3eacd7=_0x27ffcb[_0xe0ac('0x34')][_0xe0ac('0x52')];return db['Team'][_0xe0ac('0x25')]({'where':{'id':_0x3eacd7},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0ac('0x53'),'attributes':['id',_0xe0ac('0x19'),'online',_0xe0ac('0x54'),_0xe0ac('0x55')],'raw':!![]}]})[_0xe0ac('0x12')](function(_0x33c4ae){if(_0x33c4ae){var _0x3764c2=_[_0xe0ac('0x56')](_0x33c4ae,function(_0x183fcf){var _0x27d9c8=_0x183fcf['get']({'plain':!![]});return _0x27d9c8['Agents'];});return db[_0xe0ac('0x1c')]['find']({'where':{'id':_0x27ffcb[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](function(_0x37cafc){return db['sequelize'][_0xe0ac('0x57')](function(_0x1e5434){return _0x37cafc['addTeams'](_0x3eacd7,{'transaction':_0x1e5434})['then'](function(){return BPromise[_0xe0ac('0x58')](_0x3764c2,function(_0x488f4f){return db['UserMailQueue'][_0xe0ac('0x59')]({'where':{'UserId':_0x488f4f['id'],'MailQueueId':_0x27ffcb[_0xe0ac('0x3d')]['id']},'transaction':_0x1e5434});});})[_0xe0ac('0x12')](function(){_0x3764c2[_0xe0ac('0x5a')](function(_0xfa985d){socket['emit']('userMailQueue:save',{'UserId':_0xfa985d['id'],'MailQueueId':_0x37cafc['id']});});});});});}})[_0xe0ac('0x12')](respondWithStatusCode(_0x30e410,null))[_0xe0ac('0x27')](handleError(_0x30e410,null));};exports[_0xe0ac('0x5b')]=function(_0x4cd52b,_0x2d5dda){return db['Team']['findAll']({'where':{'id':_0x4cd52b[_0xe0ac('0x24')][_0xe0ac('0x52')]},'attributes':['id'],'include':[{'model':db[_0xe0ac('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe0ac('0x12')](handleEntityNotFound(_0x2d5dda,null))[_0xe0ac('0x12')](function(_0x2b9a37){var _0x4fbff1=_[_0xe0ac('0x1b')](_0x2b9a37,'id');var _0x549411=[];var _0x39bacd=[];var _0x324ef0=squel[_0xe0ac('0x5d')]();_0x324ef0[_0xe0ac('0x5e')]('tq.TeamId')['from'](_0xe0ac('0x5f'),'tq')[_0xe0ac('0x60')](_0xe0ac('0x61'),'ut',_0xe0ac('0x62'))['where'](_0xe0ac('0x63'),_0x4cd52b['params']['id']);for(var _0x452bd0=0x0;_0x452bd0<_0x2b9a37[_0xe0ac('0x2f')];_0x452bd0+=0x1){let _0x57b210=_0x2b9a37[_0x452bd0];for(var _0xce312d=0x0;_0xce312d<_0x57b210[_0xe0ac('0x53')][_0xe0ac('0x2f')];_0xce312d+=0x1){let _0x146a79=_0x57b210[_0xe0ac('0x53')][_0xce312d];var _0x5292f3=_0x324ef0['clone']();_0x5292f3[_0xe0ac('0x22')](_0xe0ac('0x64'),_0x146a79['id']);_0x39bacd[_0xe0ac('0x65')](db[_0xe0ac('0x66')]['query'](_0x5292f3[_0xe0ac('0x67')](),{'type':db[_0xe0ac('0x66')][_0xe0ac('0x68')][_0xe0ac('0x69')]})[_0xe0ac('0x12')](function(_0x44bcd5){if(_0x44bcd5[_0xe0ac('0x2f')]===0x1){return _0x146a79['id'];}else{var _0x215539=_[_0xe0ac('0x6a')](_['map'](_0x44bcd5,'TeamId'),function(_0x4e9b0a){return _[_0xe0ac('0x6b')](_0x4fbff1,_0x4e9b0a);});if(_0x215539){return _0x146a79['id'];}}}));}}return BPromise[_0xe0ac('0x6c')](_0x39bacd)[_0xe0ac('0x12')](function(_0x27f3b7){_0x549411=_(_0x549411)[_0xe0ac('0x6d')](_0x27f3b7)['compact']()['value']();return db[_0xe0ac('0x1c')][_0xe0ac('0x32')]({'where':{'id':_0x4cd52b[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](function(_0x4eabad){return db[_0xe0ac('0x66')][_0xe0ac('0x57')](function(_0x2f75ab){return _0x4eabad[_0xe0ac('0x5b')](_0x4cd52b[_0xe0ac('0x24')][_0xe0ac('0x52')],{'transaction':_0x2f75ab})['then'](function(){if(!_[_0xe0ac('0x6e')](_0x549411)){return _0x4eabad[_0xe0ac('0x6f')](_0x549411,{'transaction':_0x2f75ab});}})['then'](function(){_0x549411['forEach'](function(_0x7f4e51){socket['emit'](_0xe0ac('0x70'),{'UserId':_0x7f4e51,'MailQueueId':_0x4eabad['id']});});});});});});})['then'](respondWithStatusCode(_0x2d5dda,null))[_0xe0ac('0x27')](handleError(_0x2d5dda,null));};exports[_0xe0ac('0x71')]=function(_0x455a65,_0x4d2a2d){return db[_0xe0ac('0x1c')][_0xe0ac('0x32')]({'where':{'id':_0x455a65[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x4d2a2d,null))[_0xe0ac('0x12')](function(_0x233bfe){if(_0x233bfe){return _0x233bfe[_0xe0ac('0x71')](_0x455a65['body']['ids'],_[_0xe0ac('0x72')](_0x455a65['body'],[_0xe0ac('0x52'),'id'])||{})[_0xe0ac('0x73')](function(_0x2fc65e){for(var _0x821eec=0x0;_0x821eec<_0x455a65[_0xe0ac('0x34')][_0xe0ac('0x52')][_0xe0ac('0x2f')];_0x821eec+=0x1){socket[_0xe0ac('0x74')](_0xe0ac('0x75'),{'UserId':Number(_0x455a65[_0xe0ac('0x34')][_0xe0ac('0x52')][_0x821eec]),'MailQueueId':Number(_0x455a65[_0xe0ac('0x3d')]['id'])});}return _0x2fc65e;});}})['then'](respondWithResult(_0x4d2a2d,null))[_0xe0ac('0x27')](handleError(_0x4d2a2d,null));};exports[_0xe0ac('0x6f')]=function(_0x4f24b1,_0x9006ad){return db['MailQueue'][_0xe0ac('0x32')]({'where':{'id':_0x4f24b1[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x9006ad,null))[_0xe0ac('0x12')](function(_0x588889){if(_0x588889){return _0x588889[_0xe0ac('0x6f')](_0x4f24b1[_0xe0ac('0x24')][_0xe0ac('0x52')])[_0xe0ac('0x12')](function(){if(_[_0xe0ac('0x76')](_0x4f24b1[_0xe0ac('0x24')][_0xe0ac('0x52')])){for(var _0x2eb748=0x0;_0x2eb748<_0x4f24b1[_0xe0ac('0x24')][_0xe0ac('0x52')][_0xe0ac('0x2f')];_0x2eb748+=0x1){socket['emit'](_0xe0ac('0x70'),{'UserId':Number(_0x4f24b1[_0xe0ac('0x24')][_0xe0ac('0x52')][_0x2eb748]),'MailQueueId':Number(_0x4f24b1[_0xe0ac('0x3d')]['id'])});}}else{socket['emit'](_0xe0ac('0x70'),{'UserId':Number(_0x4f24b1['query']['ids']),'MailQueueId':Number(_0x4f24b1[_0xe0ac('0x3d')]['id'])});}});}})[_0xe0ac('0x12')](respondWithStatusCode(_0x9006ad,null))['catch'](handleError(_0x9006ad,null));};exports[_0xe0ac('0x77')]=function(_0x5ed9d6,_0x2d763f){var _0x2db91d={};var _0x42ae6d={};var _0x3dd251;var _0x5f7d4f;return db['MailQueue'][_0xe0ac('0x4f')]({'where':{'id':_0x5ed9d6[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x2d763f,null))[_0xe0ac('0x12')](function(_0x447702){if(_0x447702){_0x3dd251=_0x447702;_0x42ae6d[_0xe0ac('0x2c')]=_['keys'](db[_0xe0ac('0x5c')][_0xe0ac('0x1d')]);_0x42ae6d['query']=_[_0xe0ac('0x29')](_0x5ed9d6[_0xe0ac('0x24')]);_0x42ae6d['filters']=_[_0xe0ac('0x2b')](_0x42ae6d['model'],_0x42ae6d[_0xe0ac('0x24')]);_0x2db91d[_0xe0ac('0x2d')]=_[_0xe0ac('0x2b')](_0x42ae6d[_0xe0ac('0x2c')],qs[_0xe0ac('0x2e')](_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0x2e')]));_0x2db91d[_0xe0ac('0x2d')]=_0x2db91d[_0xe0ac('0x2d')][_0xe0ac('0x2f')]?_0x2db91d[_0xe0ac('0x2d')]:_0x42ae6d['model'];_0x2db91d[_0xe0ac('0x42')]=qs[_0xe0ac('0x43')](_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0x43')]);_0x2db91d['where']=qs[_0xe0ac('0x2a')](_[_0xe0ac('0x44')](_0x5ed9d6[_0xe0ac('0x24')],_0x42ae6d[_0xe0ac('0x2a')]));if(_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0x46')]){_0x2db91d[_0xe0ac('0x22')]=_[_0xe0ac('0x30')](_0x2db91d[_0xe0ac('0x22')],{'$or':_[_0xe0ac('0x1b')](_0x2db91d['attributes'],function(_0x16c280){var _0xbfba5={};_0xbfba5[_0x16c280]={'$like':'%'+_0x5ed9d6['query'][_0xe0ac('0x46')]+'%'};return _0xbfba5;})});}_0x2db91d=_['merge']({},_0x2db91d,_0x5ed9d6['options']);return _0x3dd251[_0xe0ac('0x77')](_0x2db91d);}})[_0xe0ac('0x12')](function(_0x25972a){if(_0x25972a){_0x5f7d4f=_0x25972a['length'];if(!_0x5ed9d6[_0xe0ac('0x24')]['hasOwnProperty'](_0xe0ac('0x41'))){_0x2db91d[_0xe0ac('0xf')]=qs[_0xe0ac('0xf')](_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0xf')]);_0x2db91d[_0xe0ac('0xd')]=qs[_0xe0ac('0xd')](_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0xd')]);}return _0x3dd251[_0xe0ac('0x77')](_0x2db91d);}})[_0xe0ac('0x12')](function(_0x2f56eb){if(_0x2f56eb){return _0x2f56eb?{'count':_0x5f7d4f,'rows':_0x2f56eb}:null;}})[_0xe0ac('0x12')](respondWithResult(_0x2d763f,null))[_0xe0ac('0x27')](handleError(_0x2d763f,null));}; \ No newline at end of file +var _0xc90f=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','then','get','MailQueues','UserProfileResource','end','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','getOptions','where','include','query','findAll','catch','show','model','keys','filters','intersection','attributes','fields','length','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','sort','pick','filter','User','findAndCountAll','UserId','mailPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','nolimit','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','select','field','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment'];(function(_0x5083da,_0x174589){var _0x5c3887=function(_0x571048){while(--_0x571048){_0x5083da['push'](_0x5083da['shift']());}};_0x5c3887(++_0x174589);}(_0xc90f,0xea));var _0xfc90=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xc90f[_0x4c12ec];return _0x3ae42c;};'use strict';var BPromise=require(_0xfc90('0x0'));var util=require(_0xfc90('0x1'));var _=require(_0xfc90('0x2'));var squel=require(_0xfc90('0x3'));var Redis=require(_0xfc90('0x4'));var qs=require(_0xfc90('0x5'));var logger=require('../../config/logger')(_0xfc90('0x6'));var config=require(_0xfc90('0x7'));var db=require(_0xfc90('0x8'))['db'];config[_0xfc90('0x9')]=_[_0xfc90('0xa')](config[_0xfc90('0x9')],{'host':_0xfc90('0xb'),'port':0x18eb});var socket=require(_0xfc90('0xc'))(new Redis(config[_0xfc90('0x9')]));require(_0xfc90('0xd'))['register'](socket);function respondWithStatusCode(_0x10be87,_0x581a6e){_0x581a6e=_0x581a6e||0xcc;return function(_0x1eebc7){if(_0x1eebc7){return _0x10be87[_0xfc90('0xe')](_0x581a6e);}return _0x10be87['status'](_0x581a6e)['end']();};}function respondWithResult(_0x1be89d,_0x51b5a0){_0x51b5a0=_0x51b5a0||0xc8;return function(_0x4b48f3){if(_0x4b48f3){return _0x1be89d[_0xfc90('0xf')](_0x51b5a0)['json'](_0x4b48f3);}};}function respondWithFilteredResult(_0x40c295,_0x5ab13b){return function(_0x26f74f){if(_0x26f74f){var _0x273afd=typeof _0x5ab13b[_0xfc90('0x10')]==='undefined'&&typeof _0x5ab13b[_0xfc90('0x11')]===_0xfc90('0x12');var _0x18cf6f=_0x26f74f['count'];var _0x154683=_0x273afd?0x0:_0x5ab13b[_0xfc90('0x10')];var _0x12b25a=_0x273afd?_0x26f74f[_0xfc90('0x13')]:_0x5ab13b[_0xfc90('0x10')]+_0x5ab13b[_0xfc90('0x11')];var _0x35dc42;if(_0x12b25a>=_0x18cf6f){_0x12b25a=_0x18cf6f;_0x35dc42=0xc8;}else{_0x35dc42=0xce;}_0x40c295['status'](_0x35dc42);return _0x40c295[_0xfc90('0x14')](_0xfc90('0x15'),_0x154683+'-'+_0x12b25a+'/'+_0x18cf6f)[_0xfc90('0x16')](_0x26f74f);}return null;};}function saveUpdates(_0x2bde95){return function(_0x353bd4){if(_0x353bd4){return _0x353bd4[_0xfc90('0x17')](_0x2bde95)['then'](function(_0x29f19d){return _0x29f19d;});}return null;};}function removeEntity(_0x57aa49){return function(_0x5e46cc){if(_0x5e46cc){return _0x5e46cc[_0xfc90('0x18')]()[_0xfc90('0x19')](function(){var _0x110df0=_0x5e46cc[_0xfc90('0x1a')]({'plain':!![]});var _0x1d3b95=_0xfc90('0x1b');return db[_0xfc90('0x1c')][_0xfc90('0x18')]({'where':{'type':_0x1d3b95,'resourceId':_0x110df0['id']}})['then'](function(){return _0x5e46cc;});})[_0xfc90('0x19')](function(){_0x57aa49[_0xfc90('0xf')](0xcc)[_0xfc90('0x1d')]();});}};}function handleEntityNotFound(_0x36a8a6){return function(_0x27277){if(!_0x27277){_0x36a8a6[_0xfc90('0xe')](0x194);}return _0x27277;};}function handleError(_0x40374b,_0x442a4f){_0x442a4f=_0x442a4f||0x1f4;return function(_0x3af31b){logger['error'](_0x3af31b[_0xfc90('0x1e')]);if(_0x3af31b['name']){delete _0x3af31b[_0xfc90('0x1f')];}_0x40374b['status'](_0x442a4f)['send'](_0x3af31b);};}exports[_0xfc90('0x20')]=function(_0x44af1d,_0x50d758){var _0x4a789a={};var _0x2530c3={'count':0x0,'rows':[]};var _0x5df95f=_[_0xfc90('0x21')](db[_0xfc90('0x22')][_0xfc90('0x23')],function(_0x27a6c2){return{'name':_0x27a6c2[_0xfc90('0x24')],'type':_0x27a6c2[_0xfc90('0x25')]['key']};});_0x4a789a=qs[_0xfc90('0x26')](_0x5df95f,_0x44af1d);var _0x44e170={'where':_0x4a789a[_0xfc90('0x27')]};return db[_0xfc90('0x22')][_0xfc90('0x13')](_0x44e170)[_0xfc90('0x19')](function(_0xae65ed){_0x2530c3[_0xfc90('0x13')]=_0xae65ed;_0x4a789a[_0xfc90('0x28')]=qs[_0xfc90('0x28')](_0x44af1d[_0xfc90('0x29')]);return db[_0xfc90('0x22')][_0xfc90('0x2a')](_0x4a789a);})[_0xfc90('0x19')](function(_0x1aecc2){_0x2530c3['rows']=_0x1aecc2;return _0x2530c3;})[_0xfc90('0x19')](respondWithFilteredResult(_0x50d758,_0x4a789a))[_0xfc90('0x2b')](handleError(_0x50d758,null));};exports[_0xfc90('0x2c')]=function(_0x38a252,_0x502970){var _0x4801c5={'raw':!![],'where':{'id':_0x38a252['params']['id']}},_0xf5b811={};_0xf5b811[_0xfc90('0x2d')]=_[_0xfc90('0x2e')](db[_0xfc90('0x22')][_0xfc90('0x23')]);_0xf5b811[_0xfc90('0x29')]=_[_0xfc90('0x2e')](_0x38a252['query']);_0xf5b811[_0xfc90('0x2f')]=_[_0xfc90('0x30')](_0xf5b811[_0xfc90('0x2d')],_0xf5b811[_0xfc90('0x29')]);_0x4801c5[_0xfc90('0x31')]=_[_0xfc90('0x30')](_0xf5b811[_0xfc90('0x2d')],qs[_0xfc90('0x32')](_0x38a252[_0xfc90('0x29')][_0xfc90('0x32')]));_0x4801c5[_0xfc90('0x31')]=_0x4801c5[_0xfc90('0x31')][_0xfc90('0x33')]?_0x4801c5[_0xfc90('0x31')]:_0xf5b811[_0xfc90('0x2d')];if(_0x38a252['query']['includeAll']){_0x4801c5[_0xfc90('0x28')]=[{'all':!![]}];}_0x4801c5=_[_0xfc90('0x34')]({},_0x4801c5,_0x38a252[_0xfc90('0x35')]);return db[_0xfc90('0x22')][_0xfc90('0x36')](_0x4801c5)[_0xfc90('0x19')](handleEntityNotFound(_0x502970,null))[_0xfc90('0x19')](respondWithResult(_0x502970,null))[_0xfc90('0x2b')](handleError(_0x502970,null));};exports[_0xfc90('0x37')]=function(_0x5716cf,_0x5a30f9){return db[_0xfc90('0x22')][_0xfc90('0x37')](_0x5716cf['body'],{})[_0xfc90('0x19')](function(_0x9cc0a3){var _0x43f9ba=_0x5716cf['user'][_0xfc90('0x1a')]({'plain':!![]});if(!_0x43f9ba)throw new Error(_0xfc90('0x38'));if(_0x43f9ba[_0xfc90('0x39')]===_0xfc90('0x3a')){var _0x18bb40=_0x9cc0a3[_0xfc90('0x1a')]({'plain':!![]});var _0x9fe9d9=_0xfc90('0x1b');return db[_0xfc90('0x3b')][_0xfc90('0x36')]({'where':{'name':_0x9fe9d9,'userProfileId':_0x43f9ba[_0xfc90('0x3c')]},'raw':!![]})[_0xfc90('0x19')](function(_0x1e68b4){if(_0x1e68b4&&_0x1e68b4['autoAssociation']===0x0){return db[_0xfc90('0x1c')]['create']({'name':_0x18bb40['name'],'resourceId':_0x18bb40['id'],'type':_0x1e68b4['name'],'sectionId':_0x1e68b4['id']},{})['then'](function(){return _0x9cc0a3;});}else{return _0x9cc0a3;}})['catch'](function(_0x1d9dd6){logger['error'](_0xfc90('0x3d'),_0x1d9dd6);throw _0x1d9dd6;});}return _0x9cc0a3;})[_0xfc90('0x19')](respondWithResult(_0x5a30f9,0xc9))[_0xfc90('0x2b')](handleError(_0x5a30f9,null));};exports[_0xfc90('0x17')]=function(_0x1d0b59,_0x50cddd){if(_0x1d0b59[_0xfc90('0x3e')]['id']){delete _0x1d0b59[_0xfc90('0x3e')]['id'];}return db[_0xfc90('0x22')]['find']({'where':{'id':_0x1d0b59[_0xfc90('0x3f')]['id']}})['then'](handleEntityNotFound(_0x50cddd,null))[_0xfc90('0x19')](saveUpdates(_0x1d0b59[_0xfc90('0x3e')],null))[_0xfc90('0x19')](respondWithResult(_0x50cddd,null))[_0xfc90('0x2b')](handleError(_0x50cddd,null));};exports['destroy']=function(_0x29b40c,_0x3893c8){return db[_0xfc90('0x22')][_0xfc90('0x36')]({'where':{'id':_0x29b40c[_0xfc90('0x3f')]['id']}})[_0xfc90('0x19')](handleEntityNotFound(_0x3893c8,null))[_0xfc90('0x19')](removeEntity(_0x3893c8,null))[_0xfc90('0x2b')](handleError(_0x3893c8,null));};exports[_0xfc90('0x40')]=function(_0x1969da,_0x3ae614){return db['MailQueue'][_0xfc90('0x40')]()['then'](respondWithResult(_0x3ae614,null))[_0xfc90('0x2b')](handleError(_0x3ae614,null));};exports[_0xfc90('0x41')]=function(_0x15208b,_0x34cff5){var _0x5325ff={'raw':!![],'where':{}},_0x3fdf00={},_0x190b4e;return db['MailQueue'][_0xfc90('0x42')]({'where':{'id':_0x15208b[_0xfc90('0x3f')]['id']}})[_0xfc90('0x19')](handleEntityNotFound(_0x34cff5,null))[_0xfc90('0x19')](function(_0x1f598e){if(_0x1f598e){_0x190b4e=_0x1f598e[_0xfc90('0x1a')]({'plain':!![]});_0x3fdf00[_0xfc90('0x2d')]=_[_0xfc90('0x2e')](db[_0xfc90('0x43')][_0xfc90('0x23')]);_0x3fdf00[_0xfc90('0x29')]=_[_0xfc90('0x2e')](_0x15208b[_0xfc90('0x29')]);_0x3fdf00[_0xfc90('0x2f')]=_[_0xfc90('0x30')](_0x3fdf00['model'],_0x3fdf00[_0xfc90('0x29')]);_0x5325ff[_0xfc90('0x31')]=_[_0xfc90('0x30')](_0x3fdf00[_0xfc90('0x2d')],qs[_0xfc90('0x32')](_0x15208b[_0xfc90('0x29')]['fields']));_0x5325ff[_0xfc90('0x31')]=_0x5325ff[_0xfc90('0x31')][_0xfc90('0x33')]?_0x5325ff[_0xfc90('0x31')]:_0x3fdf00[_0xfc90('0x2d')];if(!_0x15208b[_0xfc90('0x29')][_0xfc90('0x44')]('nolimit')){_0x5325ff[_0xfc90('0x11')]=qs[_0xfc90('0x11')](_0x15208b[_0xfc90('0x29')]['limit']);_0x5325ff['offset']=qs[_0xfc90('0x10')](_0x15208b[_0xfc90('0x29')][_0xfc90('0x10')]);}_0x5325ff[_0xfc90('0x45')]=qs[_0xfc90('0x46')](_0x15208b[_0xfc90('0x29')][_0xfc90('0x46')]);_0x5325ff['where']=qs[_0xfc90('0x2f')](_[_0xfc90('0x47')](_0x15208b[_0xfc90('0x29')],_0x3fdf00[_0xfc90('0x2f')]));_0x5325ff[_0xfc90('0x27')]['MailQueueId']=_0x1f598e['id'];if(_0x15208b[_0xfc90('0x29')][_0xfc90('0x48')]){_0x5325ff[_0xfc90('0x27')]=_[_0xfc90('0x34')](_0x5325ff[_0xfc90('0x27')],{'$or':_[_0xfc90('0x21')](_0x5325ff['attributes'],function(_0x63ba76){var _0x2fec89={};_0x2fec89[_0x63ba76]={'$like':'%'+_0x15208b[_0xfc90('0x29')][_0xfc90('0x48')]+'%'};return _0x2fec89;})});}_0x5325ff=_[_0xfc90('0x34')]({},_0x5325ff,_0x15208b[_0xfc90('0x35')]);return db[_0xfc90('0x43')][_0xfc90('0x2a')](_0x5325ff);}})['then'](function(_0x10ace5){if(_0x10ace5){return db[_0xfc90('0x49')][_0xfc90('0x4a')]({'where':{'id':_['map'](_0x10ace5,_0xfc90('0x4b')),'role':'agent'},'attributes':['id',_0xfc90('0x1f'),_0xfc90('0x4c'),'updatedAt',_0xfc90('0x4d')]});}})[_0xfc90('0x19')](function(_0x466fe8){if(_0x466fe8){return{'count':_0x466fe8[_0xfc90('0x13')],'rows':_['map'](_0x466fe8[_0xfc90('0x4e')],function(_0x7a6082){return{'membername':_0x7a6082['name'],'UserId':_0x7a6082['id'],'queue_name':_0x190b4e[_0xfc90('0x1f')],'MailQueueId':_0x190b4e['id'],'interface':util[_0xfc90('0x4f')](_0xfc90('0x50'),_0xfc90('0x51'),_0x7a6082[_0xfc90('0x1f')]),'penalty':0x0,'paused':_0x7a6082[_0xfc90('0x4c')],'createdAt':_0x7a6082[_0xfc90('0x4d')],'updatedAt':_0x7a6082[_0xfc90('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfc90('0x19')](respondWithFilteredResult(_0x34cff5,_0x5325ff))[_0xfc90('0x2b')](handleError(_0x34cff5,null));};exports[_0xfc90('0x53')]=function(_0x4c7473,_0x39e4fb){var _0x3afdac={};var _0x59c774={};var _0x2adbda;var _0x274393;return db[_0xfc90('0x22')][_0xfc90('0x42')]({'where':{'id':_0x4c7473[_0xfc90('0x3f')]['id']}})[_0xfc90('0x19')](handleEntityNotFound(_0x39e4fb,null))[_0xfc90('0x19')](function(_0x500c93){if(_0x500c93){_0x2adbda=_0x500c93;_0x59c774[_0xfc90('0x2d')]=_['keys'](db[_0xfc90('0x54')][_0xfc90('0x23')]);_0x59c774['query']=_['keys'](_0x4c7473[_0xfc90('0x29')]);_0x59c774[_0xfc90('0x2f')]=_['intersection'](_0x59c774[_0xfc90('0x2d')],_0x59c774[_0xfc90('0x29')]);_0x3afdac[_0xfc90('0x31')]=_[_0xfc90('0x30')](_0x59c774[_0xfc90('0x2d')],qs['fields'](_0x4c7473[_0xfc90('0x29')][_0xfc90('0x32')]));_0x3afdac['attributes']=_0x3afdac[_0xfc90('0x31')][_0xfc90('0x33')]?_0x3afdac[_0xfc90('0x31')]:_0x59c774['model'];_0x3afdac[_0xfc90('0x45')]=qs[_0xfc90('0x46')](_0x4c7473[_0xfc90('0x29')][_0xfc90('0x46')]);_0x3afdac[_0xfc90('0x27')]=qs['filters'](_[_0xfc90('0x47')](_0x4c7473[_0xfc90('0x29')],_0x59c774[_0xfc90('0x2f')]));if(_0x4c7473['query']['filter']){_0x3afdac[_0xfc90('0x27')]=_[_0xfc90('0x34')](_0x3afdac[_0xfc90('0x27')],{'$or':_[_0xfc90('0x21')](_0x3afdac[_0xfc90('0x31')],function(_0x4e6d18){var _0x2ed314={};_0x2ed314[_0x4e6d18]={'$like':'%'+_0x4c7473['query'][_0xfc90('0x48')]+'%'};return _0x2ed314;})});}_0x3afdac=_[_0xfc90('0x34')]({},_0x3afdac,_0x4c7473[_0xfc90('0x35')]);return _0x2adbda['getTeams'](_0x3afdac);}})[_0xfc90('0x19')](function(_0x1915b1){if(_0x1915b1){_0x274393=_0x1915b1['length'];if(!_0x4c7473[_0xfc90('0x29')]['hasOwnProperty'](_0xfc90('0x55'))){_0x3afdac['limit']=qs[_0xfc90('0x11')](_0x4c7473['query'][_0xfc90('0x11')]);_0x3afdac['offset']=qs['offset'](_0x4c7473[_0xfc90('0x29')][_0xfc90('0x10')]);}return _0x2adbda[_0xfc90('0x53')](_0x3afdac);}})[_0xfc90('0x19')](function(_0xf27f85){if(_0xf27f85){return _0xf27f85?{'count':_0x274393,'rows':_0xf27f85}:null;}})[_0xfc90('0x19')](respondWithResult(_0x39e4fb,null))[_0xfc90('0x2b')](handleError(_0x39e4fb,null));};exports[_0xfc90('0x56')]=function(_0x13847a,_0x5bef67){var _0x1634bd=_0x13847a[_0xfc90('0x3e')][_0xfc90('0x57')];return db[_0xfc90('0x54')]['findAll']({'where':{'id':_0x1634bd},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfc90('0x58'),'attributes':['id',_0xfc90('0x1f'),_0xfc90('0x59'),_0xfc90('0x5a'),_0xfc90('0x5b')],'raw':!![]}]})[_0xfc90('0x19')](function(_0x361864){if(_0x361864){var _0x531acd=_['flatMap'](_0x361864,function(_0x2f4712){var _0x140da6=_0x2f4712['get']({'plain':!![]});return _0x140da6[_0xfc90('0x58')];});return db[_0xfc90('0x22')][_0xfc90('0x36')]({'where':{'id':_0x13847a[_0xfc90('0x3f')]['id']}})[_0xfc90('0x19')](function(_0x6f2260){return db[_0xfc90('0x5c')][_0xfc90('0x5d')](function(_0x3b9723){return _0x6f2260[_0xfc90('0x56')](_0x1634bd,{'transaction':_0x3b9723})[_0xfc90('0x19')](function(){return BPromise['each'](_0x531acd,function(_0x268c90){return db['UserMailQueue'][_0xfc90('0x5e')]({'where':{'UserId':_0x268c90['id'],'MailQueueId':_0x13847a['params']['id']},'transaction':_0x3b9723});});})[_0xfc90('0x19')](function(){_0x531acd[_0xfc90('0x5f')](function(_0x4b3248){socket[_0xfc90('0x60')](_0xfc90('0x61'),{'UserId':_0x4b3248['id'],'MailQueueId':_0x6f2260['id']});});});});});}})[_0xfc90('0x19')](respondWithStatusCode(_0x5bef67,null))[_0xfc90('0x2b')](handleError(_0x5bef67,null));};exports['removeTeams']=function(_0x5b696b,_0x4e1346){return db[_0xfc90('0x54')]['findAll']({'where':{'id':_0x5b696b[_0xfc90('0x29')][_0xfc90('0x57')]},'attributes':['id'],'include':[{'model':db[_0xfc90('0x49')],'as':_0xfc90('0x58'),'attributes':['id'],'raw':!![]}]})[_0xfc90('0x19')](handleEntityNotFound(_0x4e1346,null))[_0xfc90('0x19')](function(_0x5aa470){var _0x2ad2c5=_['map'](_0x5aa470,'id');var _0x5b4dd8=[];var _0x3dda04=[];var _0x462779=squel[_0xfc90('0x62')]();_0x462779[_0xfc90('0x63')]('tq.TeamId')['from'](_0xfc90('0x64'),'tq')[_0xfc90('0x65')]('user_has_teams','ut',_0xfc90('0x66'))[_0xfc90('0x27')](_0xfc90('0x67'),_0x5b696b[_0xfc90('0x3f')]['id']);for(var _0x3ac5e6=0x0;_0x3ac5e6<_0x5aa470['length'];_0x3ac5e6+=0x1){let _0x51010a=_0x5aa470[_0x3ac5e6];for(var _0x4cfdd2=0x0;_0x4cfdd2<_0x51010a[_0xfc90('0x58')][_0xfc90('0x33')];_0x4cfdd2+=0x1){let _0x288b41=_0x51010a[_0xfc90('0x58')][_0x4cfdd2];var _0xfb972b=_0x462779[_0xfc90('0x68')]();_0xfb972b['where'](_0xfc90('0x69'),_0x288b41['id']);_0x3dda04['push'](db[_0xfc90('0x5c')][_0xfc90('0x29')](_0xfb972b[_0xfc90('0x6a')](),{'type':db['sequelize'][_0xfc90('0x6b')][_0xfc90('0x6c')]})['then'](function(_0x4c0850){if(_0x4c0850[_0xfc90('0x33')]===0x1){return _0x288b41['id'];}else{var _0x3a5bb3=_[_0xfc90('0x6d')](_[_0xfc90('0x21')](_0x4c0850,'TeamId'),function(_0x5cf8a3){return _[_0xfc90('0x6e')](_0x2ad2c5,_0x5cf8a3);});if(_0x3a5bb3){return _0x288b41['id'];}}}));}}return BPromise[_0xfc90('0x6f')](_0x3dda04)['then'](function(_0x4911f2){_0x5b4dd8=_(_0x5b4dd8)[_0xfc90('0x70')](_0x4911f2)[_0xfc90('0x71')]()['value']();return db[_0xfc90('0x22')]['find']({'where':{'id':_0x5b696b['params']['id']}})[_0xfc90('0x19')](function(_0x1beca0){return db[_0xfc90('0x5c')][_0xfc90('0x5d')](function(_0xcdead0){return _0x1beca0[_0xfc90('0x72')](_0x5b696b[_0xfc90('0x29')][_0xfc90('0x57')],{'transaction':_0xcdead0})['then'](function(){if(!_[_0xfc90('0x73')](_0x5b4dd8)){return _0x1beca0[_0xfc90('0x74')](_0x5b4dd8,{'transaction':_0xcdead0});}})[_0xfc90('0x19')](function(){_0x5b4dd8[_0xfc90('0x5f')](function(_0x3689eb){socket[_0xfc90('0x60')](_0xfc90('0x75'),{'UserId':_0x3689eb,'MailQueueId':_0x1beca0['id']});});});});});});})['then'](respondWithStatusCode(_0x4e1346,null))[_0xfc90('0x2b')](handleError(_0x4e1346,null));};exports[_0xfc90('0x76')]=function(_0x5a53b5,_0xc7983f){return db[_0xfc90('0x22')][_0xfc90('0x36')]({'where':{'id':_0x5a53b5['params']['id']}})[_0xfc90('0x19')](handleEntityNotFound(_0xc7983f,null))[_0xfc90('0x19')](function(_0x20def1){if(_0x20def1){return _0x20def1[_0xfc90('0x76')](_0x5a53b5[_0xfc90('0x3e')][_0xfc90('0x57')],_['omit'](_0x5a53b5[_0xfc90('0x3e')],[_0xfc90('0x57'),'id'])||{})[_0xfc90('0x77')](function(_0xee95a2){for(var _0x510f79=0x0;_0x510f79<_0x5a53b5[_0xfc90('0x3e')][_0xfc90('0x57')]['length'];_0x510f79+=0x1){socket['emit'](_0xfc90('0x61'),{'UserId':Number(_0x5a53b5[_0xfc90('0x3e')][_0xfc90('0x57')][_0x510f79]),'MailQueueId':Number(_0x5a53b5[_0xfc90('0x3f')]['id'])});}return _0xee95a2;});}})[_0xfc90('0x19')](respondWithResult(_0xc7983f,null))[_0xfc90('0x2b')](handleError(_0xc7983f,null));};exports['removeAgents']=function(_0x43540d,_0x54adef){return db[_0xfc90('0x22')][_0xfc90('0x36')]({'where':{'id':_0x43540d['params']['id']}})[_0xfc90('0x19')](handleEntityNotFound(_0x54adef,null))[_0xfc90('0x19')](function(_0x3cf5ae){if(_0x3cf5ae){return _0x3cf5ae[_0xfc90('0x74')](_0x43540d[_0xfc90('0x29')][_0xfc90('0x57')])[_0xfc90('0x19')](function(){if(_['isArray'](_0x43540d[_0xfc90('0x29')][_0xfc90('0x57')])){for(var _0x26de7=0x0;_0x26de7<_0x43540d['query'][_0xfc90('0x57')][_0xfc90('0x33')];_0x26de7+=0x1){socket[_0xfc90('0x60')]('userMailQueue:remove',{'UserId':Number(_0x43540d[_0xfc90('0x29')]['ids'][_0x26de7]),'MailQueueId':Number(_0x43540d[_0xfc90('0x3f')]['id'])});}}else{socket['emit'](_0xfc90('0x75'),{'UserId':Number(_0x43540d['query']['ids']),'MailQueueId':Number(_0x43540d[_0xfc90('0x3f')]['id'])});}});}})[_0xfc90('0x19')](respondWithStatusCode(_0x54adef,null))[_0xfc90('0x2b')](handleError(_0x54adef,null));};exports[_0xfc90('0x78')]=function(_0x729bc2,_0x11fd82){var _0x30691f={};var _0x22a0d9={};var _0x1e82de;var _0x4179ad;return db[_0xfc90('0x22')][_0xfc90('0x42')]({'where':{'id':_0x729bc2[_0xfc90('0x3f')]['id']}})[_0xfc90('0x19')](handleEntityNotFound(_0x11fd82,null))[_0xfc90('0x19')](function(_0x236d06){if(_0x236d06){_0x1e82de=_0x236d06;_0x22a0d9[_0xfc90('0x2d')]=_[_0xfc90('0x2e')](db[_0xfc90('0x49')][_0xfc90('0x23')]);_0x22a0d9['query']=_[_0xfc90('0x2e')](_0x729bc2[_0xfc90('0x29')]);_0x22a0d9['filters']=_[_0xfc90('0x30')](_0x22a0d9[_0xfc90('0x2d')],_0x22a0d9[_0xfc90('0x29')]);_0x30691f['attributes']=_['intersection'](_0x22a0d9[_0xfc90('0x2d')],qs[_0xfc90('0x32')](_0x729bc2[_0xfc90('0x29')][_0xfc90('0x32')]));_0x30691f[_0xfc90('0x31')]=_0x30691f['attributes'][_0xfc90('0x33')]?_0x30691f['attributes']:_0x22a0d9[_0xfc90('0x2d')];_0x30691f['order']=qs[_0xfc90('0x46')](_0x729bc2[_0xfc90('0x29')]['sort']);_0x30691f[_0xfc90('0x27')]=qs[_0xfc90('0x2f')](_[_0xfc90('0x47')](_0x729bc2[_0xfc90('0x29')],_0x22a0d9[_0xfc90('0x2f')]));if(_0x729bc2[_0xfc90('0x29')][_0xfc90('0x48')]){_0x30691f['where']=_['merge'](_0x30691f[_0xfc90('0x27')],{'$or':_[_0xfc90('0x21')](_0x30691f[_0xfc90('0x31')],function(_0x385383){var _0x4cea5b={};_0x4cea5b[_0x385383]={'$like':'%'+_0x729bc2[_0xfc90('0x29')][_0xfc90('0x48')]+'%'};return _0x4cea5b;})});}_0x30691f=_['merge']({},_0x30691f,_0x729bc2[_0xfc90('0x35')]);return _0x1e82de[_0xfc90('0x78')](_0x30691f);}})['then'](function(_0x2fe5ba){if(_0x2fe5ba){_0x4179ad=_0x2fe5ba[_0xfc90('0x33')];if(!_0x729bc2[_0xfc90('0x29')][_0xfc90('0x44')](_0xfc90('0x55'))){_0x30691f[_0xfc90('0x11')]=qs[_0xfc90('0x11')](_0x729bc2[_0xfc90('0x29')]['limit']);_0x30691f[_0xfc90('0x10')]=qs[_0xfc90('0x10')](_0x729bc2['query'][_0xfc90('0x10')]);}return _0x1e82de[_0xfc90('0x78')](_0x30691f);}})[_0xfc90('0x19')](function(_0x280b22){if(_0x280b22){return _0x280b22?{'count':_0x4179ad,'rows':_0x280b22}:null;}})[_0xfc90('0x19')](respondWithResult(_0x11fd82,null))['catch'](handleError(_0x11fd82,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7736620..cf3373e 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 _0xd78f=['save','remove','emit','hook','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x573e08,_0x185b22){var _0x1730bb=function(_0x34b0cc){while(--_0x34b0cc){_0x573e08['push'](_0x573e08['shift']());}};_0x1730bb(++_0x185b22);}(_0xd78f,0x1ad));var _0xfd78=function(_0x20668b,_0x2b7c6f){_0x20668b=_0x20668b-0x0;var _0x3e9a1c=_0xd78f[_0x20668b];return _0x3e9a1c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xfd78('0x0'))['db'][_0xfd78('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xfd78('0x2')](0x0);var events={'afterCreate':_0xfd78('0x3'),'afterUpdate':'update','afterDestroy':_0xfd78('0x4')};function emitEvent(_0x358120){return function(_0x103943,_0x3621aa,_0x218005){MailQueueEvents[_0xfd78('0x5')](_0x358120+':'+_0x103943['id'],_0x103943);MailQueueEvents[_0xfd78('0x5')](_0x358120,_0x103943);_0x218005(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xfd78('0x6')](e,emitEvent(event));}}module[_0xfd78('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xc354=['remove','emit','hasOwnProperty','hook','exports','MailQueue','setMaxListeners','save','update'];(function(_0x403b93,_0x7a6063){var _0x1497d2=function(_0x121886){while(--_0x121886){_0x403b93['push'](_0x403b93['shift']());}};_0x1497d2(++_0x7a6063);}(_0xc354,0x71));var _0x4c35=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc354[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x4c35('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4c35('0x1')](0x0);var events={'afterCreate':_0x4c35('0x2'),'afterUpdate':_0x4c35('0x3'),'afterDestroy':_0x4c35('0x4')};function emitEvent(_0x56873c){return function(_0xf9992f,_0x46768b,_0x12182c){MailQueueEvents['emit'](_0x56873c+':'+_0xf9992f['id'],_0xf9992f);MailQueueEvents[_0x4c35('0x5')](_0x56873c,_0xf9992f);_0x12182c(null);};}for(var e in events){if(events[_0x4c35('0x6')](e)){var event=events[e];MailQueue[_0x4c35('0x7')](e,emitEvent(event));}}module[_0x4c35('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 4138bc8..f11827c 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 _0x71fa=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2460e9,_0x1a481b){var _0x598bfc=function(_0x1fb944){while(--_0x1fb944){_0x2460e9['push'](_0x2460e9['shift']());}};_0x598bfc(++_0x1a481b);}(_0x71fa,0x17b));var _0xa71f=function(_0x3ab70f,_0x198fdc){_0x3ab70f=_0x3ab70f-0x0;var _0x5ef3b3=_0x71fa[_0x3ab70f];return _0x5ef3b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa71f('0x0'))(_0xa71f('0x1'));var moment=require('moment');var BPromise=require(_0xa71f('0x2'));var rp=require(_0xa71f('0x3'));var fs=require('fs');var path=require(_0xa71f('0x4'));var rimraf=require(_0xa71f('0x5'));var config=require(_0xa71f('0x6'));var attributes=require(_0xa71f('0x7'));module[_0xa71f('0x8')]=function(_0x23189d,_0x1e0765){return _0x23189d[_0xa71f('0x9')](_0xa71f('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfd2=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','MailQueue','lodash','util','api','moment','bluebird'];(function(_0xca733,_0x4dcff1){var _0x3e5b2d=function(_0x3e75c6){while(--_0x3e75c6){_0xca733['push'](_0xca733['shift']());}};_0x3e5b2d(++_0x4dcff1);}(_0xbfd2,0x1a8));var _0x2bfd=function(_0x202a2a,_0x4cfe75){_0x202a2a=_0x202a2a-0x0;var _0x321a0f=_0xbfd2[_0x202a2a];return _0x321a0f;};'use strict';var _=require(_0x2bfd('0x0'));var util=require(_0x2bfd('0x1'));var logger=require('../../config/logger')(_0x2bfd('0x2'));var moment=require(_0x2bfd('0x3'));var BPromise=require(_0x2bfd('0x4'));var rp=require(_0x2bfd('0x5'));var fs=require('fs');var path=require(_0x2bfd('0x6'));var rimraf=require(_0x2bfd('0x7'));var config=require(_0x2bfd('0x8'));var attributes=require(_0x2bfd('0x9'));module['exports']=function(_0x5ae48f,_0x1a5706){return _0x5ae48f['define'](_0x2bfd('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 1b2fcbe..21da786 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 _0x4bab=['limit','map','include','model','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./mailQueue.socket','request','then','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes'];(function(_0x53c7a7,_0x2923bd){var _0x1016df=function(_0x3267fa){while(--_0x3267fa){_0x53c7a7['push'](_0x53c7a7['shift']());}};_0x1016df(++_0x2923bd);}(_0x4bab,0x1d4));var _0xb4ba=function(_0x5922d0,_0x419c85){_0x5922d0=_0x5922d0-0x0;var _0x5fbf0f=_0x4bab[_0x5922d0];return _0x5fbf0f;};'use strict';var _=require(_0xb4ba('0x0'));var util=require(_0xb4ba('0x1'));var moment=require(_0xb4ba('0x2'));var BPromise=require(_0xb4ba('0x3'));var rs=require(_0xb4ba('0x4'));var fs=require('fs');var Redis=require(_0xb4ba('0x5'));var db=require(_0xb4ba('0x6'))['db'];var utils=require(_0xb4ba('0x7'));var logger=require(_0xb4ba('0x8'))('rpc');var config=require(_0xb4ba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb4ba('0xa')][_0xb4ba('0xb')]({'port':0x232a});config[_0xb4ba('0xc')]=_[_0xb4ba('0xd')](config[_0xb4ba('0xc')],{'host':_0xb4ba('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4ba('0xc')]));require(_0xb4ba('0xf'))['register'](socket);function respondWithRpcPromise(_0x15fd1c,_0x1ae584,_0x5e3874){return new BPromise(function(_0x3d3e8e,_0x4528f9){return client[_0xb4ba('0x10')](_0x15fd1c,_0x5e3874)[_0xb4ba('0x11')](function(_0x1671ae){logger['info']('MailQueue,\x20%s,\x20%s',_0x1ae584,_0xb4ba('0x12'));logger[_0xb4ba('0x13')](_0xb4ba('0x14'),_0x1ae584,_0xb4ba('0x12'),JSON[_0xb4ba('0x15')](_0x1671ae));if(_0x1671ae[_0xb4ba('0x16')]){if(_0x1671ae[_0xb4ba('0x16')][_0xb4ba('0x17')]===0x1f4){logger[_0xb4ba('0x16')](_0xb4ba('0x18'),_0x1ae584,_0x1671ae[_0xb4ba('0x16')]['message']);return _0x4528f9(_0x1671ae[_0xb4ba('0x16')][_0xb4ba('0x19')]);}logger[_0xb4ba('0x16')](_0xb4ba('0x18'),_0x1ae584,_0x1671ae[_0xb4ba('0x16')]['message']);return _0x3d3e8e(_0x1671ae['error'][_0xb4ba('0x19')]);}else{logger[_0xb4ba('0x1a')](_0xb4ba('0x18'),_0x1ae584,'request\x20sent');_0x3d3e8e(_0x1671ae[_0xb4ba('0x1b')][_0xb4ba('0x19')]);}})[_0xb4ba('0x1c')](function(_0x16ec34){logger['error'](_0xb4ba('0x18'),_0x1ae584,_0x16ec34);_0x4528f9(_0x16ec34);});});}exports[_0xb4ba('0x1d')]=function(_0x2785af){var _0x27a791=this;return new Promise(function(_0x379213,_0x5a17f9){return db[_0xb4ba('0x1e')][_0xb4ba('0x1f')]({'raw':_0x2785af['options']?_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x21')]===undefined?!![]:![]:!![],'where':_0x2785af[_0xb4ba('0x20')]?_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x22')]||null:null,'attributes':_0x2785af[_0xb4ba('0x20')]?_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x23')]||null:null,'limit':_0x2785af[_0xb4ba('0x20')]?_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x24')]||null:null,'include':_0x2785af[_0xb4ba('0x20')]?_0x2785af[_0xb4ba('0x20')]['include']?_[_0xb4ba('0x25')](_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x26')],function(_0x294b85){return{'model':db[_0x294b85[_0xb4ba('0x27')]],'as':_0x294b85['as'],'attributes':_0x294b85[_0xb4ba('0x23')],'include':_0x294b85['include']?_[_0xb4ba('0x25')](_0x294b85[_0xb4ba('0x26')],function(_0x1de550){return{'model':db[_0x1de550[_0xb4ba('0x27')]],'as':_0x1de550['as'],'attributes':_0x1de550[_0xb4ba('0x23')],'include':_0x1de550[_0xb4ba('0x26')]?_[_0xb4ba('0x25')](_0x1de550['include'],function(_0x4ecb53){return{'model':db[_0x4ecb53[_0xb4ba('0x27')]],'as':_0x4ecb53['as'],'attributes':_0x4ecb53[_0xb4ba('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4866d8){logger[_0xb4ba('0x1a')](_0xb4ba('0x1d'),_0x2785af);logger[_0xb4ba('0x13')](_0xb4ba('0x1d'),_0x2785af,JSON[_0xb4ba('0x15')](_0x4866d8));_0x379213(_0x4866d8);})['catch'](function(_0x2a3e5b){logger[_0xb4ba('0x16')]('GetMailQueue',_0x2a3e5b[_0xb4ba('0x19')],_0x2785af);_0x5a17f9(_0x27a791['error'](0x1f4,_0x2a3e5b[_0xb4ba('0x19')]));});});};exports[_0xb4ba('0x28')]=function(_0x3a8027){var _0x5bfc81=this;return new Promise(function(_0x5abcb0,_0x1420a0){return db[_0xb4ba('0x1e')][_0xb4ba('0x29')]({'raw':_0x3a8027[_0xb4ba('0x20')]?_0x3a8027[_0xb4ba('0x20')][_0xb4ba('0x21')]===undefined?!![]:![]:!![],'where':_0x3a8027[_0xb4ba('0x20')]?_0x3a8027[_0xb4ba('0x20')][_0xb4ba('0x22')]||null:null,'attributes':_0x3a8027[_0xb4ba('0x20')]?_0x3a8027[_0xb4ba('0x20')]['attributes']||null:null,'include':_0x3a8027[_0xb4ba('0x20')]?_0x3a8027['options']['include']?_['map'](_0x3a8027[_0xb4ba('0x20')]['include'],function(_0x3d9db3){return{'model':db[_0x3d9db3['model']],'as':_0x3d9db3['as'],'attributes':_0x3d9db3[_0xb4ba('0x23')],'include':_0x3d9db3[_0xb4ba('0x26')]?_[_0xb4ba('0x25')](_0x3d9db3[_0xb4ba('0x26')],function(_0x27321f){return{'model':db[_0x27321f[_0xb4ba('0x27')]],'as':_0x27321f['as'],'attributes':_0x27321f[_0xb4ba('0x23')],'include':_0x27321f[_0xb4ba('0x26')]?_[_0xb4ba('0x25')](_0x27321f[_0xb4ba('0x26')],function(_0x26558c){return{'model':db[_0x26558c[_0xb4ba('0x27')]],'as':_0x26558c['as'],'attributes':_0x26558c[_0xb4ba('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb4ba('0x11')](function(_0x36bab1){logger[_0xb4ba('0x1a')](_0xb4ba('0x28'),_0x3a8027);logger[_0xb4ba('0x13')](_0xb4ba('0x28'),_0x3a8027,JSON[_0xb4ba('0x15')](_0x36bab1));_0x5abcb0(_0x36bab1);})[_0xb4ba('0x1c')](function(_0x269eee){logger[_0xb4ba('0x16')](_0xb4ba('0x28'),_0x269eee[_0xb4ba('0x19')],_0x3a8027);_0x1420a0(_0x5bfc81['error'](0x1f4,_0x269eee[_0xb4ba('0x19')]));});});}; \ No newline at end of file +var _0xea2a=['map','model','then','catch','find','ShowMailQueue','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xea2a,0x13e));var _0xaea2=function(_0xa4a9b3,_0x3b271c){_0xa4a9b3=_0xa4a9b3-0x0;var _0xb7a49e=_0xea2a[_0xa4a9b3];return _0xb7a49e;};'use strict';var _=require('lodash');var util=require(_0xaea2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaea2('0x1'));var db=require(_0xaea2('0x2'))['db'];var utils=require(_0xaea2('0x3'));var logger=require(_0xaea2('0x4'))('rpc');var config=require(_0xaea2('0x5'));var jayson=require(_0xaea2('0x6'));var client=jayson[_0xaea2('0x7')][_0xaea2('0x8')]({'port':0x232a});config[_0xaea2('0x9')]=_[_0xaea2('0xa')](config[_0xaea2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xaea2('0xb'))(new Redis(config[_0xaea2('0x9')]));require('./mailQueue.socket')[_0xaea2('0xc')](socket);function respondWithRpcPromise(_0x438fce,_0x213f59,_0x38f58c){return new BPromise(function(_0x238d0b,_0xc3f8c7){return client[_0xaea2('0xd')](_0x438fce,_0x38f58c)['then'](function(_0x27539a){logger[_0xaea2('0xe')]('MailQueue,\x20%s,\x20%s',_0x213f59,_0xaea2('0xf'));logger[_0xaea2('0x10')](_0xaea2('0x11'),_0x213f59,'request\x20sent',JSON[_0xaea2('0x12')](_0x27539a));if(_0x27539a[_0xaea2('0x13')]){if(_0x27539a['error'][_0xaea2('0x14')]===0x1f4){logger[_0xaea2('0x13')](_0xaea2('0x15'),_0x213f59,_0x27539a[_0xaea2('0x13')][_0xaea2('0x16')]);return _0xc3f8c7(_0x27539a['error'][_0xaea2('0x16')]);}logger[_0xaea2('0x13')]('MailQueue,\x20%s,\x20%s',_0x213f59,_0x27539a[_0xaea2('0x13')]['message']);return _0x238d0b(_0x27539a['error'][_0xaea2('0x16')]);}else{logger[_0xaea2('0xe')](_0xaea2('0x15'),_0x213f59,'request\x20sent');_0x238d0b(_0x27539a[_0xaea2('0x17')]['message']);}})['catch'](function(_0x42aa7a){logger[_0xaea2('0x13')]('MailQueue,\x20%s,\x20%s',_0x213f59,_0x42aa7a);_0xc3f8c7(_0x42aa7a);});});}exports[_0xaea2('0x18')]=function(_0x5849cd){var _0xb22dd0=this;return new Promise(function(_0x30d572,_0x340917){return db[_0xaea2('0x19')][_0xaea2('0x1a')]({'raw':_0x5849cd['options']?_0x5849cd[_0xaea2('0x1b')][_0xaea2('0x1c')]===undefined?!![]:![]:!![],'where':_0x5849cd[_0xaea2('0x1b')]?_0x5849cd[_0xaea2('0x1b')][_0xaea2('0x1d')]||null:null,'attributes':_0x5849cd[_0xaea2('0x1b')]?_0x5849cd['options'][_0xaea2('0x1e')]||null:null,'limit':_0x5849cd['options']?_0x5849cd['options'][_0xaea2('0x1f')]||null:null,'include':_0x5849cd[_0xaea2('0x1b')]?_0x5849cd[_0xaea2('0x1b')][_0xaea2('0x20')]?_[_0xaea2('0x21')](_0x5849cd[_0xaea2('0x1b')][_0xaea2('0x20')],function(_0x4a1f96){return{'model':db[_0x4a1f96[_0xaea2('0x22')]],'as':_0x4a1f96['as'],'attributes':_0x4a1f96['attributes'],'include':_0x4a1f96['include']?_[_0xaea2('0x21')](_0x4a1f96['include'],function(_0x337092){return{'model':db[_0x337092[_0xaea2('0x22')]],'as':_0x337092['as'],'attributes':_0x337092['attributes'],'include':_0x337092[_0xaea2('0x20')]?_[_0xaea2('0x21')](_0x337092[_0xaea2('0x20')],function(_0x122238){return{'model':db[_0x122238[_0xaea2('0x22')]],'as':_0x122238['as'],'attributes':_0x122238['attributes']};}):[]};}):[]};}):[]:[]})[_0xaea2('0x23')](function(_0x3ee496){logger[_0xaea2('0xe')](_0xaea2('0x18'),_0x5849cd);logger['debug'](_0xaea2('0x18'),_0x5849cd,JSON[_0xaea2('0x12')](_0x3ee496));_0x30d572(_0x3ee496);})[_0xaea2('0x24')](function(_0x226571){logger[_0xaea2('0x13')]('GetMailQueue',_0x226571[_0xaea2('0x16')],_0x5849cd);_0x340917(_0xb22dd0[_0xaea2('0x13')](0x1f4,_0x226571[_0xaea2('0x16')]));});});};exports['ShowMailQueue']=function(_0xa4c2db){var _0x2867df=this;return new Promise(function(_0x10cdec,_0x2dc7b7){return db[_0xaea2('0x19')][_0xaea2('0x25')]({'raw':_0xa4c2db[_0xaea2('0x1b')]?_0xa4c2db['options'][_0xaea2('0x1c')]===undefined?!![]:![]:!![],'where':_0xa4c2db[_0xaea2('0x1b')]?_0xa4c2db[_0xaea2('0x1b')]['where']||null:null,'attributes':_0xa4c2db[_0xaea2('0x1b')]?_0xa4c2db[_0xaea2('0x1b')]['attributes']||null:null,'include':_0xa4c2db[_0xaea2('0x1b')]?_0xa4c2db[_0xaea2('0x1b')]['include']?_['map'](_0xa4c2db[_0xaea2('0x1b')]['include'],function(_0x2ab97c){return{'model':db[_0x2ab97c[_0xaea2('0x22')]],'as':_0x2ab97c['as'],'attributes':_0x2ab97c['attributes'],'include':_0x2ab97c[_0xaea2('0x20')]?_[_0xaea2('0x21')](_0x2ab97c[_0xaea2('0x20')],function(_0x8579e9){return{'model':db[_0x8579e9['model']],'as':_0x8579e9['as'],'attributes':_0x8579e9[_0xaea2('0x1e')],'include':_0x8579e9['include']?_['map'](_0x8579e9['include'],function(_0x4c749f){return{'model':db[_0x4c749f[_0xaea2('0x22')]],'as':_0x4c749f['as'],'attributes':_0x4c749f[_0xaea2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc14f12){logger[_0xaea2('0xe')](_0xaea2('0x26'),_0xa4c2db);logger['debug'](_0xaea2('0x26'),_0xa4c2db,JSON[_0xaea2('0x12')](_0xc14f12));_0x10cdec(_0xc14f12);})[_0xaea2('0x24')](function(_0x416273){logger[_0xaea2('0x13')](_0xaea2('0x26'),_0x416273[_0xaea2('0x16')],_0xa4c2db);_0x2dc7b7(_0x2867df[_0xaea2('0x13')](0x1f4,_0x416273[_0xaea2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7cf341f..1efc88e 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 _0xe9ee=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x3bb12c,_0xb8b0ea){var _0x306928=function(_0x414a15){while(--_0x414a15){_0x3bb12c['push'](_0x3bb12c['shift']());}};_0x306928(++_0xb8b0ea);}(_0xe9ee,0x1e8));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0xee9e('0x0'));var events=[_0xee9e('0x1'),_0xee9e('0x2'),_0xee9e('0x3')];function createListener(_0x1385ea,_0x530785){return function(_0x530190){_0x530785[_0xee9e('0x4')](_0x1385ea,_0x530190);};}function removeListener(_0xf9edb7,_0x989bd4){return function(){MailQueueEvents[_0xee9e('0x5')](_0xf9edb7,_0x989bd4);};}exports[_0xee9e('0x6')]=function(_0x33fc84){for(var _0x4820c5=0x0,_0x3c6837=events[_0xee9e('0x7')];_0x4820c5<_0x3c6837;_0x4820c5++){var _0x54ac3d=events[_0x4820c5];var _0x2718e9=createListener(_0xee9e('0x8')+_0x54ac3d,_0x33fc84);MailQueueEvents['on'](_0x54ac3d,_0x2718e9);}}; \ No newline at end of file +var _0x11e7=['removeListener','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x11e7,0x1d8));var _0x711e=function(_0xec90e9,_0x103db6){_0xec90e9=_0xec90e9-0x0;var _0x53d04a=_0x11e7[_0xec90e9];return _0x53d04a;};'use strict';var MailQueueEvents=require(_0x711e('0x0'));var events=[_0x711e('0x1'),_0x711e('0x2'),_0x711e('0x3')];function createListener(_0x584e86,_0x503745){return function(_0x62c1d1){_0x503745['emit'](_0x584e86,_0x62c1d1);};}function removeListener(_0x4be38c,_0x2e69dc){return function(){MailQueueEvents[_0x711e('0x4')](_0x4be38c,_0x2e69dc);};}exports['register']=function(_0x60f3f6){for(var _0xc997ff=0x0,_0x15efa7=events[_0x711e('0x5')];_0xc997ff<_0x15efa7;_0xc997ff++){var _0x47f32b=events[_0xc997ff];var _0x51b812=createListener(_0x711e('0x6')+_0x47f32b,_0x60f3f6);MailQueueEvents['on'](_0x47f32b,_0x51b812);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6b0fb3c..80e5f4d 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 _0xf620=['delete','destroy','exports','express','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put'];(function(_0x16a132,_0x46022a){var _0x291c01=function(_0x424c67){while(--_0x424c67){_0x16a132['push'](_0x16a132['shift']());}};_0x291c01(++_0x46022a);}(_0xf620,0x16b));var _0x0f62=function(_0x16fa90,_0xce4a45){_0x16fa90=_0x16fa90-0x0;var _0x4a3050=_0xf620[_0x16fa90];return _0x4a3050;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0f62('0x0'));var router=express[_0x0f62('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f62('0x2'));var config=require(_0x0f62('0x3'));var controller=require(_0x0f62('0x4'));router[_0x0f62('0x5')]('/',auth[_0x0f62('0x6')](),controller['index']);router[_0x0f62('0x5')]('/describe',auth[_0x0f62('0x6')](),controller[_0x0f62('0x7')]);router[_0x0f62('0x5')](_0x0f62('0x8'),auth[_0x0f62('0x6')](),controller['show']);router[_0x0f62('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f62('0xa')]);router[_0x0f62('0xb')](_0x0f62('0x8'),auth[_0x0f62('0x6')](),controller['update']);router[_0x0f62('0xc')]('/:id',auth[_0x0f62('0x6')](),controller[_0x0f62('0xd')]);module[_0x0f62('0xe')]=router; \ No newline at end of file +var _0x43b6=['show','post','create','put','/:id','update','exports','path','express','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x43b6,0x18d));var _0x643b=function(_0x42f687,_0x558724){_0x42f687=_0x42f687-0x0;var _0x108838=_0x43b6[_0x42f687];return _0x108838;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x643b('0x0'));var timeout=require('connect-timeout');var express=require(_0x643b('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x643b('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x643b('0x3'));var controller=require('./mailQueueReport.controller');router[_0x643b('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x643b('0x4')](_0x643b('0x5'),auth[_0x643b('0x6')](),controller[_0x643b('0x7')]);router[_0x643b('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x643b('0x8')]);router[_0x643b('0x9')]('/',auth['isAuthenticated'](),controller[_0x643b('0xa')]);router[_0x643b('0xb')](_0x643b('0xc'),auth['isAuthenticated'](),controller[_0x643b('0xd')]);router['delete'](_0x643b('0xc'),auth[_0x643b('0x6')](),controller['destroy']);module[_0x643b('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 530b5da..f2c574b 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 _0x41ed=['STRING','DATE','moment','exports'];(function(_0x656c05,_0x1d4b18){var _0x28475a=function(_0x21ef6a){while(--_0x21ef6a){_0x656c05['push'](_0x656c05['shift']());}};_0x28475a(++_0x1d4b18);}(_0x41ed,0xa6));var _0xd41e=function(_0x20f191,_0x43ab4b){_0x20f191=_0x20f191-0x0;var _0x3f5153=_0x41ed[_0x20f191];return _0x3f5153;};'use strict';var moment=require(_0xd41e('0x0'));var Sequelize=require('sequelize');module[_0xd41e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd41e('0x2')]},'joinAt':{'type':Sequelize[_0xd41e('0x3')]},'leaveAt':{'type':Sequelize[_0xd41e('0x3')]},'acceptAt':{'type':Sequelize[_0xd41e('0x3')]},'exitAt':{'type':Sequelize[_0xd41e('0x3')]},'reason':{'type':Sequelize[_0xd41e('0x2')]}}; \ No newline at end of file +var _0x7421=['moment','exports','STRING','DATE'];(function(_0x2a1aa2,_0x11ca3d){var _0x55847a=function(_0xfa003){while(--_0xfa003){_0x2a1aa2['push'](_0x2a1aa2['shift']());}};_0x55847a(++_0x11ca3d);}(_0x7421,0x1ec));var _0x1742=function(_0x44e4a1,_0x3d053a){_0x44e4a1=_0x44e4a1-0x0;var _0x546ad3=_0x7421[_0x44e4a1];return _0x546ad3;};'use strict';var moment=require(_0x1742('0x0'));var Sequelize=require('sequelize');module[_0x1742('0x1')]={'uniqueid':{'type':Sequelize[_0x1742('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1742('0x2')]},'joinAt':{'type':Sequelize[_0x1742('0x3')]},'leaveAt':{'type':Sequelize[_0x1742('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1742('0x3')]},'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 547ee74..9c3dda9 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(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0xa456,0x142));var _0x6a45=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa456[_0x20a584];return _0x4b41a8;};'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 _0x4e2e=['name','send','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','stack'];(function(_0x466ac7,_0x578ee8){var _0x2a9538=function(_0x2e48d0){while(--_0x2e48d0){_0x466ac7['push'](_0x466ac7['shift']());}};_0x2a9538(++_0x578ee8);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x8e90a2,_0x26313e){_0x8e90a2=_0x8e90a2-0x0;var _0x2d6146=_0x4e2e[_0x8e90a2];return _0x2d6146;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e2('0x0'));var zipdir=require(_0xe4e2('0x1'));var jsonpatch=require(_0xe4e2('0x2'));var rp=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var BPromise=require(_0xe4e2('0x5'));var Mustache=require('mustache');var util=require(_0xe4e2('0x6'));var path=require(_0xe4e2('0x7'));var sox=require(_0xe4e2('0x8'));var csv=require(_0xe4e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e2('0xa'));var _=require(_0xe4e2('0xb'));var squel=require(_0xe4e2('0xc'));var crypto=require(_0xe4e2('0xd'));var jsforce=require(_0xe4e2('0xe'));var deskjs=require(_0xe4e2('0xf'));var toCsv=require(_0xe4e2('0x9'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require(_0xe4e2('0x12'));var qs=require(_0xe4e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e2('0x14'));var logger=require(_0xe4e2('0x15'))(_0xe4e2('0x16'));var utils=require(_0xe4e2('0x17'));var config=require(_0xe4e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e2('0x19'))['db'];function respondWithStatusCode(_0x20d34e,_0x19c6ef){_0x19c6ef=_0x19c6ef||0xcc;return function(_0x13657c){if(_0x13657c){return _0x20d34e['sendStatus'](_0x19c6ef);}return _0x20d34e[_0xe4e2('0x1a')](_0x19c6ef)[_0xe4e2('0x1b')]();};}function respondWithResult(_0xb45217,_0x4e0bc2){_0x4e0bc2=_0x4e0bc2||0xc8;return function(_0x202486){if(_0x202486){return _0xb45217['status'](_0x4e0bc2)['json'](_0x202486);}};}function respondWithFilteredResult(_0x117a2a,_0x2d2018){return function(_0x1f9b2d){if(_0x1f9b2d){var _0x28ee12=typeof _0x2d2018[_0xe4e2('0x1c')]==='undefined'&&typeof _0x2d2018[_0xe4e2('0x1d')]===_0xe4e2('0x1e');var _0x340935=_0x1f9b2d['count'];var _0x196f16=_0x28ee12?0x0:_0x2d2018['offset'];var _0x1d5e9d=_0x28ee12?_0x1f9b2d[_0xe4e2('0x1f')]:_0x2d2018[_0xe4e2('0x1c')]+_0x2d2018[_0xe4e2('0x1d')];var _0x3dfbdf;if(_0x1d5e9d>=_0x340935){_0x1d5e9d=_0x340935;_0x3dfbdf=0xc8;}else{_0x3dfbdf=0xce;}_0x117a2a[_0xe4e2('0x1a')](_0x3dfbdf);return _0x117a2a[_0xe4e2('0x20')](_0xe4e2('0x21'),_0x196f16+'-'+_0x1d5e9d+'/'+_0x340935)[_0xe4e2('0x22')](_0x1f9b2d);}return null;};}function patchUpdates(_0x362741){return function(_0x5a84c5){try{jsonpatch[_0xe4e2('0x23')](_0x5a84c5,_0x362741,!![]);}catch(_0x2e7ecd){return BPromise[_0xe4e2('0x24')](_0x2e7ecd);}return _0x5a84c5[_0xe4e2('0x25')]();};}function saveUpdates(_0xbdf1ad,_0x23b466){return function(_0x16f14b){if(_0x16f14b){return _0x16f14b['update'](_0xbdf1ad)[_0xe4e2('0x26')](function(_0x2ab435){return _0x2ab435;});}return null;};}function removeEntity(_0x2088b9,_0x5373c0){return function(_0x353030){if(_0x353030){return _0x353030[_0xe4e2('0x27')]()['then'](function(){_0x2088b9[_0xe4e2('0x1a')](0xcc)[_0xe4e2('0x1b')]();});}};}function handleEntityNotFound(_0x29143c,_0x3f5265){return function(_0x249b7e){if(!_0x249b7e){_0x29143c['sendStatus'](0x194);}return _0x249b7e;};}function handleError(_0x166610,_0x357903){_0x357903=_0x357903||0x1f4;return function(_0x1f6d1f){logger['error'](_0x1f6d1f[_0xe4e2('0x28')]);if(_0x1f6d1f[_0xe4e2('0x29')]){delete _0x1f6d1f[_0xe4e2('0x29')];}_0x166610['status'](_0x357903)[_0xe4e2('0x2a')](_0x1f6d1f);};}exports['index']=function(_0x477b5c,_0x1e21c0){var _0x52c849={},_0x46926a={},_0x18e2e5={'count':0x0,'rows':[]};var _0x135116=_[_0xe4e2('0x2b')](db[_0xe4e2('0x2c')]['rawAttributes'],function(_0x5f30dc){return{'name':_0x5f30dc[_0xe4e2('0x2d')],'type':_0x5f30dc[_0xe4e2('0x2e')][_0xe4e2('0x2f')]};});_0x46926a[_0xe4e2('0x30')]=_[_0xe4e2('0x2b')](_0x135116,_0xe4e2('0x29'));_0x46926a[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x477b5c[_0xe4e2('0x31')]);_0x46926a[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],_0x46926a['query']);_0x52c849[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x46926a[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x52c849['attributes']=_0x52c849[_0xe4e2('0x35')][_0xe4e2('0x37')]?_0x52c849[_0xe4e2('0x35')]:_0x46926a[_0xe4e2('0x30')];if(!_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x38')](_0xe4e2('0x39'))){_0x52c849[_0xe4e2('0x1d')]=qs[_0xe4e2('0x1d')](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x1d')]);_0x52c849['offset']=qs[_0xe4e2('0x1c')](_0x477b5c['query'][_0xe4e2('0x1c')]);}_0x52c849[_0xe4e2('0x3a')]=qs['sort'](_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3b')]);_0x52c849[_0xe4e2('0x3c')]=qs[_0xe4e2('0x33')](_['pick'](_0x477b5c[_0xe4e2('0x31')],_0x46926a['filters']),_0x135116);if(_0x477b5c[_0xe4e2('0x31')]['filter']){_0x52c849[_0xe4e2('0x3c')]=_[_0xe4e2('0x3d')](_0x52c849[_0xe4e2('0x3c')],{'$or':_['map'](_0x135116,function(_0x2f5576){if(_0x2f5576[_0xe4e2('0x2e')]!=='VIRTUAL'){var _0x2b0f61={};_0x2b0f61[_0x2f5576[_0xe4e2('0x29')]]={'$like':'%'+_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x3e')]+'%'};return _0x2b0f61;}})});}_0x52c849=_[_0xe4e2('0x3d')]({},_0x52c849,_0x477b5c[_0xe4e2('0x3f')]);var _0x18fa94={'where':_0x52c849[_0xe4e2('0x3c')]};return db[_0xe4e2('0x2c')]['count'](_0x18fa94)['then'](function(_0xf4f15f){_0x18e2e5[_0xe4e2('0x1f')]=_0xf4f15f;if(_0x477b5c[_0xe4e2('0x31')][_0xe4e2('0x40')]){_0x52c849['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xe4e2('0x41')](_0x52c849);})[_0xe4e2('0x26')](function(_0x3080d5){_0x18e2e5[_0xe4e2('0x42')]=_0x3080d5;return _0x18e2e5;})['then'](respondWithFilteredResult(_0x1e21c0,_0x52c849))[_0xe4e2('0x43')](handleError(_0x1e21c0,null));};exports[_0xe4e2('0x44')]=function(_0x385572,_0x577d4c){var _0x1b54f6={'raw':!![],'where':{'id':_0x385572[_0xe4e2('0x45')]['id']}},_0x4789cf={};_0x4789cf[_0xe4e2('0x30')]=_['keys'](db['MailQueueReport'][_0xe4e2('0x46')]);_0x4789cf[_0xe4e2('0x31')]=_[_0xe4e2('0x32')](_0x385572['query']);_0x4789cf[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x4789cf['model'],_0x4789cf[_0xe4e2('0x31')]);_0x1b54f6[_0xe4e2('0x35')]=_[_0xe4e2('0x34')](_0x4789cf[_0xe4e2('0x30')],qs[_0xe4e2('0x36')](_0x385572[_0xe4e2('0x31')][_0xe4e2('0x36')]));_0x1b54f6[_0xe4e2('0x35')]=_0x1b54f6['attributes'][_0xe4e2('0x37')]?_0x1b54f6[_0xe4e2('0x35')]:_0x4789cf['model'];if(_0x385572['query'][_0xe4e2('0x40')]){_0x1b54f6[_0xe4e2('0x47')]=[{'all':!![]}];}_0x1b54f6=_[_0xe4e2('0x3d')]({},_0x1b54f6,_0x385572['options']);return db[_0xe4e2('0x2c')][_0xe4e2('0x48')](_0x1b54f6)[_0xe4e2('0x26')](handleEntityNotFound(_0x577d4c,null))[_0xe4e2('0x26')](respondWithResult(_0x577d4c,null))['catch'](handleError(_0x577d4c,null));};exports[_0xe4e2('0x49')]=function(_0x918c17,_0x32a7c6){return db[_0xe4e2('0x2c')]['create'](_0x918c17[_0xe4e2('0x4a')],{})[_0xe4e2('0x26')](respondWithResult(_0x32a7c6,0xc9))['catch'](handleError(_0x32a7c6,null));};exports[_0xe4e2('0x4b')]=function(_0xedcd86,_0x21e5d7){if(_0xedcd86['body']['id']){delete _0xedcd86[_0xe4e2('0x4a')]['id'];}return db[_0xe4e2('0x2c')][_0xe4e2('0x48')]({'where':{'id':_0xedcd86['params']['id']}})['then'](handleEntityNotFound(_0x21e5d7,null))[_0xe4e2('0x26')](saveUpdates(_0xedcd86['body'],null))[_0xe4e2('0x26')](respondWithResult(_0x21e5d7,null))['catch'](handleError(_0x21e5d7,null));};exports[_0xe4e2('0x27')]=function(_0x2125df,_0x2a2e76){return db['MailQueueReport'][_0xe4e2('0x48')]({'where':{'id':_0x2125df['params']['id']}})[_0xe4e2('0x26')](handleEntityNotFound(_0x2a2e76,null))[_0xe4e2('0x26')](removeEntity(_0x2a2e76,null))['catch'](handleError(_0x2a2e76,null));};exports[_0xe4e2('0x4c')]=function(_0x582674,_0x169251){return db[_0xe4e2('0x2c')]['describe']()[_0xe4e2('0x26')](respondWithResult(_0x169251,null))[_0xe4e2('0x43')](handleError(_0x169251,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2a53575..1b18af2 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 _0x2f61=['path','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x38784f,_0x8b4b6b){var _0x63895f=function(_0x1b5260){while(--_0x1b5260){_0x38784f['push'](_0x38784f['shift']());}};_0x63895f(++_0x8b4b6b);}(_0x2f61,0x7e));var _0x12f6=function(_0xfee47a,_0x448287){_0xfee47a=_0xfee47a-0x0;var _0x9820c=_0x2f61[_0xfee47a];return _0x9820c;};'use strict';var _=require(_0x12f6('0x0'));var util=require(_0x12f6('0x1'));var logger=require(_0x12f6('0x2'))(_0x12f6('0x3'));var moment=require('moment');var BPromise=require(_0x12f6('0x4'));var rp=require(_0x12f6('0x5'));var fs=require('fs');var path=require(_0x12f6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x12f6('0x7'));module['exports']=function(_0x17bbcb,_0x50a925){return _0x17bbcb[_0x12f6('0x8')](_0x12f6('0x9'),attributes,{'tableName':_0x12f6('0xa'),'paranoid':![],'indexes':[{'name':_0x12f6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb53b=['rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x181395,_0x7936e6){var _0x58787d=function(_0x24a8aa){while(--_0x24a8aa){_0x181395['push'](_0x181395['shift']());}};_0x58787d(++_0x7936e6);}(_0xb53b,0xd7));var _0xbb53=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xb53b[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0xbb53('0x0'));var util=require(_0xbb53('0x1'));var logger=require(_0xbb53('0x2'))(_0xbb53('0x3'));var moment=require('moment');var BPromise=require(_0xbb53('0x4'));var rp=require(_0xbb53('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb53('0x6'));var config=require(_0xbb53('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0xbb53('0x8')]=function(_0x80fc19,_0x23f220){return _0x80fc19[_0xbb53('0x9')](_0xbb53('0xa'),attributes,{'tableName':_0xbb53('0xb'),'paranoid':![],'indexes':[{'name':_0xbb53('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8673125..231210f 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x2c503c,_0xd88a2a){var _0x39dce7=function(_0x4b01a5){while(--_0x4b01a5){_0x2c503c['push'](_0x2c503c['shift']());}};_0x39dce7(++_0xd88a2a);}(_0xdb28,0x106));var _0x8db2=function(_0x577a93,_0x379a44){_0x577a93=_0x577a93-0x0;var _0x31f87d=_0xdb28[_0x577a93];return _0x31f87d;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0xf51bd4,_0x267fbc){var _0x4c5828=function(_0x5511ac){while(--_0x5511ac){_0xf51bd4['push'](_0xf51bd4['shift']());}};_0x4c5828(++_0x267fbc);}(_0xadb5,0xad));var _0x5adb=function(_0x10fc9e,_0x1b09e0){_0x10fc9e=_0x10fc9e-0x0;var _0x3b5459=_0xadb5[_0x10fc9e];return _0x3b5459;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 487e670..a6d398f 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2160d4,_0x2fcdd2){var _0x329777=function(_0x19bc18){while(--_0x19bc18){_0x2160d4['push'](_0x2160d4['shift']());}};_0x329777(++_0x2fcdd2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xcb91[_0x39106e];return _0x892aec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5d7b04,_0x13dec9){var _0x24d8db=function(_0x561c63){while(--_0x561c63){_0x5d7b04['push'](_0x5d7b04['shift']());}};_0x24d8db(++_0x13dec9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index c41689c..6aa2345 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 _0x62d7=['sequelize','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x31bdb0,_0x5c0fe9){var _0x5e1e23=function(_0x53a17a){while(--_0x53a17a){_0x31bdb0['push'](_0x31bdb0['shift']());}};_0x5e1e23(++_0x5c0fe9);}(_0x62d7,0x172));var _0x762d=function(_0x476c36,_0x2aeadd){_0x476c36=_0x476c36-0x0;var _0x331fe0=_0x62d7[_0x476c36];return _0x331fe0;};'use strict';var Sequelize=require(_0x762d('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x762d('0x1')]},'authentication':{'type':Sequelize[_0x762d('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x762d('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x762d('0x1')],'defaultValue':_0x762d('0x4')},'connTimeout':{'type':Sequelize[_0x762d('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x762d('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x762d('0x1')]},'modernAuthentication':{'type':Sequelize[_0x762d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x84ae=['INBOX','sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x29c2d2,_0x3ce37d){var _0xa995c5=function(_0x3fd19d){while(--_0x3fd19d){_0x29c2d2['push'](_0x29c2d2['shift']());}};_0xa995c5(++_0x3ce37d);}(_0x84ae,0x1cd));var _0xe84a=function(_0x32a8a8,_0x340cd5){_0x32a8a8=_0x32a8a8-0x0;var _0x25837c=_0x84ae[_0x32a8a8];return _0x25837c;};'use strict';var Sequelize=require(_0xe84a('0x0'));module['exports']={'description':{'type':Sequelize[_0xe84a('0x1')]},'host':{'type':Sequelize[_0xe84a('0x1')]},'authentication':{'type':Sequelize[_0xe84a('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe84a('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe84a('0x3')]},'tls':{'type':Sequelize[_0xe84a('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe84a('0x1')],'defaultValue':_0xe84a('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe84a('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe84a('0x1')]},'modernAuthentication':{'type':Sequelize[_0xe84a('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index d50c0c1..7d1666d 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 _0xc203=['path','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2698b5,_0x2faad4){var _0x5375c1=function(_0x5d5348){while(--_0x5d5348){_0x2698b5['push'](_0x2698b5['shift']());}};_0x5375c1(++_0x2faad4);}(_0xc203,0x165));var _0x3c20=function(_0x1f0464,_0x74c830){_0x1f0464=_0x1f0464-0x0;var _0x3b8414=_0xc203[_0x1f0464];return _0x3b8414;};'use strict';var _=require(_0x3c20('0x0'));var util=require(_0x3c20('0x1'));var logger=require(_0x3c20('0x2'))(_0x3c20('0x3'));var moment=require('moment');var BPromise=require(_0x3c20('0x4'));var rp=require(_0x3c20('0x5'));var fs=require('fs');var path=require(_0x3c20('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c20('0x7'));module[_0x3c20('0x8')]=function(_0x4aa0e7,_0x503066){return _0x4aa0e7[_0x3c20('0x9')]('MailServerIn',attributes,{'tableName':_0x3c20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ce=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in'];(function(_0x386e27,_0x1124fc){var _0x1539b6=function(_0x5427a5){while(--_0x5427a5){_0x386e27['push'](_0x386e27['shift']());}};_0x1539b6(++_0x1124fc);}(_0xb2ce,0xa8));var _0xeb2c=function(_0x5e9ad1,_0x3fe30e){_0x5e9ad1=_0x5e9ad1-0x0;var _0x1e2566=_0xb2ce[_0x5e9ad1];return _0x1e2566;};'use strict';var _=require(_0xeb2c('0x0'));var util=require(_0xeb2c('0x1'));var logger=require(_0xeb2c('0x2'))('api');var moment=require(_0xeb2c('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb2c('0x4'));var fs=require('fs');var path=require(_0xeb2c('0x5'));var rimraf=require(_0xeb2c('0x6'));var config=require(_0xeb2c('0x7'));var attributes=require(_0xeb2c('0x8'));module[_0xeb2c('0x9')]=function(_0x550eea,_0xe9da0e){return _0x550eea[_0xeb2c('0xa')]('MailServerIn',attributes,{'tableName':_0xeb2c('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 141bca0..5bcc045 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 _0x561f=['where','attributes','limit','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','GetMailServerIn','MailServerIn','options','raw'];(function(_0x3e6698,_0xba1360){var _0x53d4c0=function(_0x5a2393){while(--_0x5a2393){_0x3e6698['push'](_0x3e6698['shift']());}};_0x53d4c0(++_0xba1360);}(_0x561f,0x15b));var _0xf561=function(_0x1a154f,_0x392be5){_0x1a154f=_0x1a154f-0x0;var _0x307e96=_0x561f[_0x1a154f];return _0x307e96;};'use strict';var _=require(_0xf561('0x0'));var util=require(_0xf561('0x1'));var moment=require(_0xf561('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf561('0x3'));var db=require(_0xf561('0x4'))['db'];var utils=require(_0xf561('0x5'));var logger=require(_0xf561('0x6'))(_0xf561('0x7'));var config=require('../../config/environment');var jayson=require(_0xf561('0x8'));var client=jayson['client'][_0xf561('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5afdb3,_0x46afd3,_0x35f017){return new BPromise(function(_0xae92ad,_0x332c2c){return client['request'](_0x5afdb3,_0x35f017)[_0xf561('0xa')](function(_0x1cd734){logger['info'](_0xf561('0xb'),_0x46afd3,'request\x20sent');logger[_0xf561('0xc')](_0xf561('0xd'),_0x46afd3,'request\x20sent',JSON[_0xf561('0xe')](_0x1cd734));if(_0x1cd734['error']){if(_0x1cd734[_0xf561('0xf')][_0xf561('0x10')]===0x1f4){logger[_0xf561('0xf')](_0xf561('0xb'),_0x46afd3,_0x1cd734[_0xf561('0xf')][_0xf561('0x11')]);return _0x332c2c(_0x1cd734[_0xf561('0xf')][_0xf561('0x11')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x46afd3,_0x1cd734[_0xf561('0xf')][_0xf561('0x11')]);return _0xae92ad(_0x1cd734[_0xf561('0xf')][_0xf561('0x11')]);}else{logger[_0xf561('0x12')](_0xf561('0xb'),_0x46afd3,_0xf561('0x13'));_0xae92ad(_0x1cd734['result'][_0xf561('0x11')]);}})[_0xf561('0x14')](function(_0x251b01){logger[_0xf561('0xf')]('MailServerIn,\x20%s,\x20%s',_0x46afd3,_0x251b01);_0x332c2c(_0x251b01);});});}exports[_0xf561('0x15')]=function(_0x591e89){var _0x3c6cae=this;return new Promise(function(_0x2a9bf1,_0x156d3c){return db[_0xf561('0x16')]['findAll']({'raw':_0x591e89[_0xf561('0x17')]?_0x591e89[_0xf561('0x17')][_0xf561('0x18')]===undefined?!![]:![]:!![],'where':_0x591e89[_0xf561('0x17')]?_0x591e89['options'][_0xf561('0x19')]||null:null,'attributes':_0x591e89[_0xf561('0x17')]?_0x591e89[_0xf561('0x17')][_0xf561('0x1a')]||null:null,'limit':_0x591e89[_0xf561('0x17')]?_0x591e89[_0xf561('0x17')][_0xf561('0x1b')]||null:null,'include':_0x591e89['options']?_0x591e89[_0xf561('0x17')][_0xf561('0x1c')]?_['map'](_0x591e89[_0xf561('0x17')][_0xf561('0x1c')],function(_0x5c3291){return{'model':db[_0x5c3291['model']],'as':_0x5c3291['as'],'attributes':_0x5c3291['attributes'],'include':_0x5c3291[_0xf561('0x1c')]?_[_0xf561('0x1d')](_0x5c3291[_0xf561('0x1c')],function(_0x4675c3){return{'model':db[_0x4675c3[_0xf561('0x1e')]],'as':_0x4675c3['as'],'attributes':_0x4675c3[_0xf561('0x1a')],'include':_0x4675c3[_0xf561('0x1c')]?_[_0xf561('0x1d')](_0x4675c3[_0xf561('0x1c')],function(_0x1afa6c){return{'model':db[_0x1afa6c[_0xf561('0x1e')]],'as':_0x1afa6c['as'],'attributes':_0x1afa6c[_0xf561('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x473c0f){logger[_0xf561('0x12')](_0xf561('0x15'),_0x591e89);logger[_0xf561('0xc')](_0xf561('0x15'),_0x591e89,JSON[_0xf561('0xe')](_0x473c0f));_0x2a9bf1(_0x473c0f);})[_0xf561('0x14')](function(_0x1f3d16){logger[_0xf561('0xf')](_0xf561('0x15'),_0x1f3d16[_0xf561('0x11')],_0x591e89);_0x156d3c(_0x3c6cae[_0xf561('0xf')](0x1f4,_0x1f3d16[_0xf561('0x11')]));});});}; \ No newline at end of file +var _0x26bc=['message','result','catch','MailServerIn','findAll','options','raw','where','limit','include','model','map','attributes','GetMailServerIn','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26bc,0x162));var _0xc26b=function(_0x1fa8b5,_0x24a279){_0x1fa8b5=_0x1fa8b5-0x0;var _0x25530e=_0x26bc[_0x1fa8b5];return _0x25530e;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require(_0xc26b('0x2'));var BPromise=require(_0xc26b('0x3'));var rs=require(_0xc26b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc26b('0x5'))['db'];var utils=require(_0xc26b('0x6'));var logger=require(_0xc26b('0x7'))('rpc');var config=require(_0xc26b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x9')][_0xc26b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d90e,_0x5c2f6f,_0x11c6f5){return new BPromise(function(_0x453491,_0x465c89){return client[_0xc26b('0xb')](_0x13d90e,_0x11c6f5)[_0xc26b('0xc')](function(_0x1fb2b5){logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));logger[_0xc26b('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5c2f6f,_0xc26b('0xf'),JSON[_0xc26b('0x11')](_0x1fb2b5));if(_0x1fb2b5[_0xc26b('0x12')]){if(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x13')]===0x1f4){logger[_0xc26b('0x12')]('MailServerIn,\x20%s,\x20%s',_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x465c89(_0x1fb2b5['error'][_0xc26b('0x14')]);}logger[_0xc26b('0x12')](_0xc26b('0xe'),_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x453491(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x14')]);}else{logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));_0x453491(_0x1fb2b5[_0xc26b('0x15')]['message']);}})[_0xc26b('0x16')](function(_0x2713f6){logger['error'](_0xc26b('0xe'),_0x5c2f6f,_0x2713f6);_0x465c89(_0x2713f6);});});}exports['GetMailServerIn']=function(_0x4802c7){var _0x7e6ed0=this;return new Promise(function(_0x47e75b,_0x47104f){return db[_0xc26b('0x17')][_0xc26b('0x18')]({'raw':_0x4802c7[_0xc26b('0x19')]?_0x4802c7['options'][_0xc26b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4802c7[_0xc26b('0x19')]?_0x4802c7[_0xc26b('0x19')][_0xc26b('0x1b')]||null:null,'attributes':_0x4802c7[_0xc26b('0x19')]?_0x4802c7[_0xc26b('0x19')]['attributes']||null:null,'limit':_0x4802c7[_0xc26b('0x19')]?_0x4802c7['options'][_0xc26b('0x1c')]||null:null,'include':_0x4802c7[_0xc26b('0x19')]?_0x4802c7[_0xc26b('0x19')][_0xc26b('0x1d')]?_['map'](_0x4802c7[_0xc26b('0x19')][_0xc26b('0x1d')],function(_0x176f29){return{'model':db[_0x176f29[_0xc26b('0x1e')]],'as':_0x176f29['as'],'attributes':_0x176f29['attributes'],'include':_0x176f29[_0xc26b('0x1d')]?_[_0xc26b('0x1f')](_0x176f29['include'],function(_0x4c0095){return{'model':db[_0x4c0095[_0xc26b('0x1e')]],'as':_0x4c0095['as'],'attributes':_0x4c0095[_0xc26b('0x20')],'include':_0x4c0095[_0xc26b('0x1d')]?_[_0xc26b('0x1f')](_0x4c0095[_0xc26b('0x1d')],function(_0x20a84f){return{'model':db[_0x20a84f['model']],'as':_0x20a84f['as'],'attributes':_0x20a84f[_0xc26b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e44e2){logger[_0xc26b('0xd')](_0xc26b('0x21'),_0x4802c7);logger['debug'](_0xc26b('0x21'),_0x4802c7,JSON[_0xc26b('0x11')](_0x3e44e2));_0x47e75b(_0x3e44e2);})[_0xc26b('0x16')](function(_0x1dd5d4){logger[_0xc26b('0x12')](_0xc26b('0x21'),_0x1dd5d4['message'],_0x4802c7);_0x47104f(_0x7e6ed0[_0xc26b('0x12')](0x1f4,_0x1dd5d4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9138b3d..477fe80 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(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x3516a4,_0x2388de){_0x3516a4=_0x3516a4-0x0;var _0x3d485a=_0x7a54[_0x3516a4];return _0x3d485a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index d4cf950..ac39cb8 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 _0xbfcc=['sequelize','STRING','INTEGER'];(function(_0x55b5fd,_0x42412a){var _0x5459a3=function(_0x190a15){while(--_0x190a15){_0x55b5fd['push'](_0x55b5fd['shift']());}};_0x5459a3(++_0x42412a);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0xbfcc[_0x148c09];return _0x18e613;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcbfc('0x1')]},'user':{'type':Sequelize[_0xcbfc('0x1')]},'pass':{'type':Sequelize[_0xcbfc('0x1')]},'port':{'type':Sequelize[_0xcbfc('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa5fa=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x4f775f,_0x1a7c25){var _0x38e624=function(_0x3e4b9e){while(--_0x3e4b9e){_0x4f775f['push'](_0x4f775f['shift']());}};_0x38e624(++_0x1a7c25);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0xa5fa[_0x1fc82b];return _0x4c6679;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'description':{'type':Sequelize[_0xaa5f('0x1')]},'host':{'type':Sequelize[_0xaa5f('0x1')]},'user':{'type':Sequelize[_0xaa5f('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaa5f('0x2')]},'secure':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaa5f('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 fce5b36..d6045da 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 _0x7afd=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','map','MailServerOut','rawAttributes','type','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x4d282a,_0x3204e4){var _0x4fce00=function(_0x2bb779){while(--_0x2bb779){_0x4d282a['push'](_0x4d282a['shift']());}};_0x4fce00(++_0x3204e4);}(_0x7afd,0x116));var _0xd7af=function(_0x4bcb3c,_0x192122){_0x4bcb3c=_0x4bcb3c-0x0;var _0xfe09bb=_0x7afd[_0x4bcb3c];return _0xfe09bb;};'use strict';var emlformat=require(_0xd7af('0x0'));var rimraf=require(_0xd7af('0x1'));var zipdir=require(_0xd7af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7af('0x3'));var moment=require(_0xd7af('0x4'));var BPromise=require(_0xd7af('0x5'));var Mustache=require(_0xd7af('0x6'));var util=require(_0xd7af('0x7'));var path=require(_0xd7af('0x8'));var sox=require(_0xd7af('0x9'));var csv=require(_0xd7af('0xa'));var ejs=require(_0xd7af('0xb'));var fs=require('fs');var fs_extra=require(_0xd7af('0xc'));var _=require('lodash');var squel=require(_0xd7af('0xd'));var crypto=require('crypto');var jsforce=require(_0xd7af('0xe'));var deskjs=require(_0xd7af('0xf'));var toCsv=require(_0xd7af('0xa'));var querystring=require(_0xd7af('0x10'));var Papa=require(_0xd7af('0x11'));var Redis=require(_0xd7af('0x12'));var authService=require(_0xd7af('0x13'));var qs=require(_0xd7af('0x14'));var as=require(_0xd7af('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd7af('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7af('0x17'))['db'];function respondWithStatusCode(_0x21acc9,_0x133838){_0x133838=_0x133838||0xcc;return function(_0x4e2a87){if(_0x4e2a87){return _0x21acc9['sendStatus'](_0x133838);}return _0x21acc9['status'](_0x133838)['end']();};}function respondWithResult(_0x2f81d9,_0x4ff3b9){_0x4ff3b9=_0x4ff3b9||0xc8;return function(_0x317306){if(_0x317306){return _0x2f81d9[_0xd7af('0x18')](_0x4ff3b9)[_0xd7af('0x19')](_0x317306);}};}function respondWithFilteredResult(_0x2abdc3,_0x3a8737){return function(_0x50ca29){if(_0x50ca29){var _0x451920=typeof _0x3a8737[_0xd7af('0x1a')]===_0xd7af('0x1b')&&typeof _0x3a8737[_0xd7af('0x1c')]===_0xd7af('0x1b');var _0x4901d2=_0x50ca29[_0xd7af('0x1d')];var _0x117604=_0x451920?0x0:_0x3a8737[_0xd7af('0x1a')];var _0x38b298=_0x451920?_0x50ca29[_0xd7af('0x1d')]:_0x3a8737[_0xd7af('0x1a')]+_0x3a8737[_0xd7af('0x1c')];var _0x482573;if(_0x38b298>=_0x4901d2){_0x38b298=_0x4901d2;_0x482573=0xc8;}else{_0x482573=0xce;}_0x2abdc3['status'](_0x482573);return _0x2abdc3[_0xd7af('0x1e')](_0xd7af('0x1f'),_0x117604+'-'+_0x38b298+'/'+_0x4901d2)[_0xd7af('0x19')](_0x50ca29);}return null;};}function patchUpdates(_0x1a9923){return function(_0x1a5111){try{jsonpatch[_0xd7af('0x20')](_0x1a5111,_0x1a9923,!![]);}catch(_0x25a1e5){return BPromise[_0xd7af('0x21')](_0x25a1e5);}return _0x1a5111[_0xd7af('0x22')]();};}function saveUpdates(_0x16352c,_0x13ef86){return function(_0x125f9d){if(_0x125f9d){return _0x125f9d[_0xd7af('0x23')](_0x16352c)[_0xd7af('0x24')](function(_0x1087f5){return _0x1087f5;});}return null;};}function removeEntity(_0x5103d0,_0x3d81f2){return function(_0x17c3e7){if(_0x17c3e7){return _0x17c3e7['destroy']()[_0xd7af('0x24')](function(){_0x5103d0[_0xd7af('0x18')](0xcc)[_0xd7af('0x25')]();});}};}function handleEntityNotFound(_0x404182,_0x1765c0){return function(_0x4b016d){if(!_0x4b016d){_0x404182[_0xd7af('0x26')](0x194);}return _0x4b016d;};}function handleError(_0x31126d,_0x32e0d1){_0x32e0d1=_0x32e0d1||0x1f4;return function(_0x5cd926){logger[_0xd7af('0x27')](_0x5cd926[_0xd7af('0x28')]);if(_0x5cd926[_0xd7af('0x29')]){delete _0x5cd926[_0xd7af('0x29')];}_0x31126d[_0xd7af('0x18')](_0x32e0d1)[_0xd7af('0x2a')](_0x5cd926);};}exports['index']=function(_0x87c410,_0x3dfd4e){var _0x5c8bec={},_0x794d52={},_0x1b6b10={'count':0x0,'rows':[]};var _0x491872=_[_0xd7af('0x2b')](db[_0xd7af('0x2c')][_0xd7af('0x2d')],function(_0x492cb0){return{'name':_0x492cb0['fieldName'],'type':_0x492cb0[_0xd7af('0x2e')]['key']};});_0x794d52['model']=_[_0xd7af('0x2b')](_0x491872,_0xd7af('0x29'));_0x794d52[_0xd7af('0x2f')]=_[_0xd7af('0x30')](_0x87c410['query']);_0x794d52[_0xd7af('0x31')]=_['intersection'](_0x794d52[_0xd7af('0x32')],_0x794d52[_0xd7af('0x2f')]);_0x5c8bec['attributes']=_[_0xd7af('0x33')](_0x794d52[_0xd7af('0x32')],qs['fields'](_0x87c410[_0xd7af('0x2f')][_0xd7af('0x34')]));_0x5c8bec[_0xd7af('0x35')]=_0x5c8bec[_0xd7af('0x35')]['length']?_0x5c8bec[_0xd7af('0x35')]:_0x794d52[_0xd7af('0x32')];if(!_0x87c410[_0xd7af('0x2f')][_0xd7af('0x36')](_0xd7af('0x37'))){_0x5c8bec['limit']=qs['limit'](_0x87c410[_0xd7af('0x2f')][_0xd7af('0x1c')]);_0x5c8bec['offset']=qs[_0xd7af('0x1a')](_0x87c410[_0xd7af('0x2f')][_0xd7af('0x1a')]);}_0x5c8bec[_0xd7af('0x38')]=qs[_0xd7af('0x39')](_0x87c410[_0xd7af('0x2f')]['sort']);_0x5c8bec[_0xd7af('0x3a')]=qs[_0xd7af('0x31')](_[_0xd7af('0x3b')](_0x87c410['query'],_0x794d52['filters']),_0x491872);if(_0x87c410[_0xd7af('0x2f')][_0xd7af('0x3c')]){_0x5c8bec['where']=_[_0xd7af('0x3d')](_0x5c8bec[_0xd7af('0x3a')],{'$or':_[_0xd7af('0x2b')](_0x491872,function(_0x11b001){if(_0x11b001[_0xd7af('0x2e')]!==_0xd7af('0x3e')){var _0x52e78d={};_0x52e78d[_0x11b001[_0xd7af('0x29')]]={'$like':'%'+_0x87c410['query'][_0xd7af('0x3c')]+'%'};return _0x52e78d;}})});}_0x5c8bec=_[_0xd7af('0x3d')]({},_0x5c8bec,_0x87c410['options']);var _0x151971={'where':_0x5c8bec[_0xd7af('0x3a')]};return db['MailServerOut'][_0xd7af('0x1d')](_0x151971)['then'](function(_0x3af5d6){_0x1b6b10['count']=_0x3af5d6;if(_0x87c410[_0xd7af('0x2f')][_0xd7af('0x3f')]){_0x5c8bec[_0xd7af('0x40')]=[{'all':!![]}];}return db[_0xd7af('0x2c')][_0xd7af('0x41')](_0x5c8bec);})[_0xd7af('0x24')](function(_0x3e6b7b){_0x1b6b10['rows']=_0x3e6b7b;return _0x1b6b10;})[_0xd7af('0x24')](respondWithFilteredResult(_0x3dfd4e,_0x5c8bec))[_0xd7af('0x42')](handleError(_0x3dfd4e,null));};exports[_0xd7af('0x43')]=function(_0x22d66a,_0x143894){var _0x7674b0={'raw':!![],'where':{'id':_0x22d66a['params']['id']}},_0x2a7f0d={};_0x2a7f0d[_0xd7af('0x32')]=_['keys'](db[_0xd7af('0x2c')][_0xd7af('0x2d')]);_0x2a7f0d[_0xd7af('0x2f')]=_[_0xd7af('0x30')](_0x22d66a[_0xd7af('0x2f')]);_0x2a7f0d['filters']=_['intersection'](_0x2a7f0d[_0xd7af('0x32')],_0x2a7f0d[_0xd7af('0x2f')]);_0x7674b0[_0xd7af('0x35')]=_[_0xd7af('0x33')](_0x2a7f0d[_0xd7af('0x32')],qs[_0xd7af('0x34')](_0x22d66a[_0xd7af('0x2f')][_0xd7af('0x34')]));_0x7674b0[_0xd7af('0x35')]=_0x7674b0[_0xd7af('0x35')]['length']?_0x7674b0[_0xd7af('0x35')]:_0x2a7f0d[_0xd7af('0x32')];if(_0x22d66a['query']['includeAll']){_0x7674b0[_0xd7af('0x40')]=[{'all':!![]}];}_0x7674b0=_[_0xd7af('0x3d')]({},_0x7674b0,_0x22d66a[_0xd7af('0x44')]);return db[_0xd7af('0x2c')][_0xd7af('0x45')](_0x7674b0)[_0xd7af('0x24')](handleEntityNotFound(_0x143894,null))[_0xd7af('0x24')](respondWithResult(_0x143894,null))[_0xd7af('0x42')](handleError(_0x143894,null));};exports[_0xd7af('0x46')]=function(_0xa46feb,_0x20a241){return db['MailServerOut'][_0xd7af('0x46')](_0xa46feb[_0xd7af('0x47')],{})['then'](respondWithResult(_0x20a241,0xc9))[_0xd7af('0x42')](handleError(_0x20a241,null));};exports[_0xd7af('0x23')]=function(_0x441a5a,_0x2ebd40){if(_0x441a5a[_0xd7af('0x47')]['id']){delete _0x441a5a['body']['id'];}return db[_0xd7af('0x2c')][_0xd7af('0x45')]({'where':{'id':_0x441a5a[_0xd7af('0x48')]['id']}})[_0xd7af('0x24')](handleEntityNotFound(_0x2ebd40,null))['then'](saveUpdates(_0x441a5a[_0xd7af('0x47')],null))[_0xd7af('0x24')](respondWithResult(_0x2ebd40,null))[_0xd7af('0x42')](handleError(_0x2ebd40,null));};exports['destroy']=function(_0x294f47,_0x2d604f){return db[_0xd7af('0x2c')][_0xd7af('0x45')]({'where':{'id':_0x294f47[_0xd7af('0x48')]['id']}})[_0xd7af('0x24')](handleEntityNotFound(_0x2d604f,null))[_0xd7af('0x24')](removeEntity(_0x2d604f,null))[_0xd7af('0x42')](handleError(_0x2d604f,null));}; \ No newline at end of file +var _0xdf6d=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','name','send','map','MailServerOut','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x371b11,_0x16bd7a){var _0x4a5e14=function(_0x58fe57){while(--_0x58fe57){_0x371b11['push'](_0x371b11['shift']());}};_0x4a5e14(++_0x16bd7a);}(_0xdf6d,0x1a0));var _0xddf6=function(_0x45ace2,_0x328295){_0x45ace2=_0x45ace2-0x0;var _0x1af566=_0xdf6d[_0x45ace2];return _0x1af566;};'use strict';var emlformat=require(_0xddf6('0x0'));var rimraf=require(_0xddf6('0x1'));var zipdir=require(_0xddf6('0x2'));var jsonpatch=require(_0xddf6('0x3'));var rp=require(_0xddf6('0x4'));var moment=require(_0xddf6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddf6('0x6'));var util=require(_0xddf6('0x7'));var path=require(_0xddf6('0x8'));var sox=require(_0xddf6('0x9'));var csv=require(_0xddf6('0xa'));var ejs=require(_0xddf6('0xb'));var fs=require('fs');var fs_extra=require(_0xddf6('0xc'));var _=require('lodash');var squel=require(_0xddf6('0xd'));var crypto=require(_0xddf6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xddf6('0xf'));var toCsv=require(_0xddf6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddf6('0x10'));var qs=require(_0xddf6('0x11'));var as=require(_0xddf6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddf6('0x13'))(_0xddf6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xddf6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc6ca2d,_0x543871){_0x543871=_0x543871||0xcc;return function(_0x1e5e24){if(_0x1e5e24){return _0xc6ca2d[_0xddf6('0x16')](_0x543871);}return _0xc6ca2d['status'](_0x543871)[_0xddf6('0x17')]();};}function respondWithResult(_0x2149f9,_0x3939ba){_0x3939ba=_0x3939ba||0xc8;return function(_0x1cd186){if(_0x1cd186){return _0x2149f9[_0xddf6('0x18')](_0x3939ba)[_0xddf6('0x19')](_0x1cd186);}};}function respondWithFilteredResult(_0x3f1502,_0xf4e0a5){return function(_0x91fed3){if(_0x91fed3){var _0x2da0a1=typeof _0xf4e0a5['offset']==='undefined'&&typeof _0xf4e0a5[_0xddf6('0x1a')]===_0xddf6('0x1b');var _0x30ecf7=_0x91fed3[_0xddf6('0x1c')];var _0x3e7097=_0x2da0a1?0x0:_0xf4e0a5['offset'];var _0x118cf2=_0x2da0a1?_0x91fed3[_0xddf6('0x1c')]:_0xf4e0a5[_0xddf6('0x1d')]+_0xf4e0a5[_0xddf6('0x1a')];var _0x4bf5c8;if(_0x118cf2>=_0x30ecf7){_0x118cf2=_0x30ecf7;_0x4bf5c8=0xc8;}else{_0x4bf5c8=0xce;}_0x3f1502[_0xddf6('0x18')](_0x4bf5c8);return _0x3f1502[_0xddf6('0x1e')](_0xddf6('0x1f'),_0x3e7097+'-'+_0x118cf2+'/'+_0x30ecf7)[_0xddf6('0x19')](_0x91fed3);}return null;};}function patchUpdates(_0x3950fb){return function(_0x5d2d4d){try{jsonpatch['apply'](_0x5d2d4d,_0x3950fb,!![]);}catch(_0x3a3f81){return BPromise[_0xddf6('0x20')](_0x3a3f81);}return _0x5d2d4d[_0xddf6('0x21')]();};}function saveUpdates(_0x4637f1,_0x419194){return function(_0x5781c1){if(_0x5781c1){return _0x5781c1[_0xddf6('0x22')](_0x4637f1)['then'](function(_0x52f24c){return _0x52f24c;});}return null;};}function removeEntity(_0x10f745,_0x1dba2e){return function(_0x7832d3){if(_0x7832d3){return _0x7832d3[_0xddf6('0x23')]()[_0xddf6('0x24')](function(){_0x10f745['status'](0xcc)[_0xddf6('0x17')]();});}};}function handleEntityNotFound(_0x18c74a,_0x487c27){return function(_0x214573){if(!_0x214573){_0x18c74a[_0xddf6('0x16')](0x194);}return _0x214573;};}function handleError(_0x226408,_0x36709a){_0x36709a=_0x36709a||0x1f4;return function(_0x24a6f9){logger[_0xddf6('0x25')](_0x24a6f9['stack']);if(_0x24a6f9[_0xddf6('0x26')]){delete _0x24a6f9[_0xddf6('0x26')];}_0x226408[_0xddf6('0x18')](_0x36709a)[_0xddf6('0x27')](_0x24a6f9);};}exports['index']=function(_0x4f3d87,_0x40f3d7){var _0xd7734c={},_0x1eb08b={},_0x8ab7a6={'count':0x0,'rows':[]};var _0x373fdb=_[_0xddf6('0x28')](db[_0xddf6('0x29')][_0xddf6('0x2a')],function(_0x2a4594){return{'name':_0x2a4594['fieldName'],'type':_0x2a4594['type'][_0xddf6('0x2b')]};});_0x1eb08b[_0xddf6('0x2c')]=_['map'](_0x373fdb,'name');_0x1eb08b['query']=_['keys'](_0x4f3d87[_0xddf6('0x2d')]);_0x1eb08b[_0xddf6('0x2e')]=_[_0xddf6('0x2f')](_0x1eb08b[_0xddf6('0x2c')],_0x1eb08b[_0xddf6('0x2d')]);_0xd7734c['attributes']=_[_0xddf6('0x2f')](_0x1eb08b[_0xddf6('0x2c')],qs[_0xddf6('0x30')](_0x4f3d87['query']['fields']));_0xd7734c['attributes']=_0xd7734c[_0xddf6('0x31')][_0xddf6('0x32')]?_0xd7734c[_0xddf6('0x31')]:_0x1eb08b[_0xddf6('0x2c')];if(!_0x4f3d87['query'][_0xddf6('0x33')]('nolimit')){_0xd7734c['limit']=qs['limit'](_0x4f3d87['query'][_0xddf6('0x1a')]);_0xd7734c[_0xddf6('0x1d')]=qs['offset'](_0x4f3d87['query'][_0xddf6('0x1d')]);}_0xd7734c[_0xddf6('0x34')]=qs[_0xddf6('0x35')](_0x4f3d87[_0xddf6('0x2d')][_0xddf6('0x35')]);_0xd7734c[_0xddf6('0x36')]=qs[_0xddf6('0x2e')](_[_0xddf6('0x37')](_0x4f3d87['query'],_0x1eb08b[_0xddf6('0x2e')]),_0x373fdb);if(_0x4f3d87['query']['filter']){_0xd7734c[_0xddf6('0x36')]=_[_0xddf6('0x38')](_0xd7734c[_0xddf6('0x36')],{'$or':_[_0xddf6('0x28')](_0x373fdb,function(_0x2b080b){if(_0x2b080b[_0xddf6('0x39')]!==_0xddf6('0x3a')){var _0x1d2c48={};_0x1d2c48[_0x2b080b[_0xddf6('0x26')]]={'$like':'%'+_0x4f3d87['query']['filter']+'%'};return _0x1d2c48;}})});}_0xd7734c=_['merge']({},_0xd7734c,_0x4f3d87[_0xddf6('0x3b')]);var _0xd886e={'where':_0xd7734c[_0xddf6('0x36')]};return db[_0xddf6('0x29')][_0xddf6('0x1c')](_0xd886e)[_0xddf6('0x24')](function(_0x5bfd7b){_0x8ab7a6[_0xddf6('0x1c')]=_0x5bfd7b;if(_0x4f3d87[_0xddf6('0x2d')][_0xddf6('0x3c')]){_0xd7734c[_0xddf6('0x3d')]=[{'all':!![]}];}return db[_0xddf6('0x29')][_0xddf6('0x3e')](_0xd7734c);})['then'](function(_0x205259){_0x8ab7a6[_0xddf6('0x3f')]=_0x205259;return _0x8ab7a6;})[_0xddf6('0x24')](respondWithFilteredResult(_0x40f3d7,_0xd7734c))[_0xddf6('0x40')](handleError(_0x40f3d7,null));};exports['show']=function(_0xf27b50,_0x40f681){var _0x3207c6={'raw':!![],'where':{'id':_0xf27b50[_0xddf6('0x41')]['id']}},_0x2f5536={};_0x2f5536['model']=_[_0xddf6('0x42')](db[_0xddf6('0x29')]['rawAttributes']);_0x2f5536['query']=_[_0xddf6('0x42')](_0xf27b50[_0xddf6('0x2d')]);_0x2f5536[_0xddf6('0x2e')]=_[_0xddf6('0x2f')](_0x2f5536['model'],_0x2f5536[_0xddf6('0x2d')]);_0x3207c6['attributes']=_[_0xddf6('0x2f')](_0x2f5536[_0xddf6('0x2c')],qs[_0xddf6('0x30')](_0xf27b50[_0xddf6('0x2d')][_0xddf6('0x30')]));_0x3207c6['attributes']=_0x3207c6[_0xddf6('0x31')]['length']?_0x3207c6[_0xddf6('0x31')]:_0x2f5536['model'];if(_0xf27b50[_0xddf6('0x2d')][_0xddf6('0x3c')]){_0x3207c6[_0xddf6('0x3d')]=[{'all':!![]}];}_0x3207c6=_['merge']({},_0x3207c6,_0xf27b50[_0xddf6('0x3b')]);return db[_0xddf6('0x29')][_0xddf6('0x43')](_0x3207c6)[_0xddf6('0x24')](handleEntityNotFound(_0x40f681,null))['then'](respondWithResult(_0x40f681,null))[_0xddf6('0x40')](handleError(_0x40f681,null));};exports[_0xddf6('0x44')]=function(_0x2d6245,_0x4c60ab){return db['MailServerOut']['create'](_0x2d6245[_0xddf6('0x45')],{})[_0xddf6('0x24')](respondWithResult(_0x4c60ab,0xc9))[_0xddf6('0x40')](handleError(_0x4c60ab,null));};exports[_0xddf6('0x22')]=function(_0x20fab1,_0x3714bb){if(_0x20fab1[_0xddf6('0x45')]['id']){delete _0x20fab1[_0xddf6('0x45')]['id'];}return db['MailServerOut'][_0xddf6('0x43')]({'where':{'id':_0x20fab1[_0xddf6('0x41')]['id']}})[_0xddf6('0x24')](handleEntityNotFound(_0x3714bb,null))['then'](saveUpdates(_0x20fab1[_0xddf6('0x45')],null))[_0xddf6('0x24')](respondWithResult(_0x3714bb,null))[_0xddf6('0x40')](handleError(_0x3714bb,null));};exports[_0xddf6('0x23')]=function(_0x17efd6,_0x32a75e){return db[_0xddf6('0x29')]['find']({'where':{'id':_0x17efd6[_0xddf6('0x41')]['id']}})[_0xddf6('0x24')](handleEntityNotFound(_0x32a75e,null))[_0xddf6('0x24')](removeEntity(_0x32a75e,null))[_0xddf6('0x40')](handleError(_0x32a75e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 311d217..1060a88 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 _0x4331=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4331,0x1c1));var _0x1433=function(_0x480fc2,_0x482fba){_0x480fc2=_0x480fc2-0x0;var _0x540a95=_0x4331[_0x480fc2];return _0x540a95;};'use strict';var _=require(_0x1433('0x0'));var util=require(_0x1433('0x1'));var logger=require(_0x1433('0x2'))(_0x1433('0x3'));var moment=require('moment');var BPromise=require(_0x1433('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1433('0x5'));var rimraf=require(_0x1433('0x6'));var config=require(_0x1433('0x7'));var attributes=require(_0x1433('0x8'));module[_0x1433('0x9')]=function(_0x43a410,_0x119e93){return _0x43a410[_0x1433('0xa')](_0x1433('0xb'),attributes,{'tableName':_0x1433('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1ac=['mail_servers_out','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd1ac,0x11f));var _0xcd1a=function(_0x2ee6d1,_0xfad422){_0x2ee6d1=_0x2ee6d1-0x0;var _0x4752c1=_0xd1ac[_0x2ee6d1];return _0x4752c1;};'use strict';var _=require(_0xcd1a('0x0'));var util=require(_0xcd1a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcd1a('0x2'));var BPromise=require(_0xcd1a('0x3'));var rp=require(_0xcd1a('0x4'));var fs=require('fs');var path=require(_0xcd1a('0x5'));var rimraf=require(_0xcd1a('0x6'));var config=require(_0xcd1a('0x7'));var attributes=require(_0xcd1a('0x8'));module[_0xcd1a('0x9')]=function(_0x25c65d,_0x15ef86){return _0x25c65d[_0xcd1a('0xa')](_0xcd1a('0xb'),attributes,{'tableName':_0xcd1a('0xc'),'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 602a030..d64bf8d 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x296d1b,_0x1f0bf0){var _0x3c747f=function(_0x1d5096){while(--_0x1d5096){_0x296d1b['push'](_0x296d1b['shift']());}};_0x3c747f(++_0x1f0bf0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'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')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x1261=['then','info','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(_0x3880e3,_0xe460ce){var _0x4e8909=function(_0x1f1982){while(--_0x1f1982){_0x3880e3['push'](_0x3880e3['shift']());}};_0x4e8909(++_0xe460ce);}(_0x1261,0x144));var _0x1126=function(_0x42572b,_0x259433){_0x42572b=_0x42572b-0x0;var _0x4d50b3=_0x1261[_0x42572b];return _0x4d50b3;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 73fe0bd..7b328e1 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 _0x2b6e=['path','express','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x2b6e,0x11f));var _0xe2b6=function(_0x32024f,_0x8c3d41){_0x32024f=_0x32024f-0x0;var _0x3dba3f=_0x2b6e[_0x32024f];return _0x3dba3f;};'use strict';var multer=require('multer');var util=require(_0xe2b6('0x0'));var path=require(_0xe2b6('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2b6('0x2'));var router=express[_0xe2b6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe2b6('0x4'));var config=require(_0xe2b6('0x5'));var controller=require('./mailSubstatus.controller');router[_0xe2b6('0x6')]('/',auth['isAuthenticated'](),controller[_0xe2b6('0x7')]);router['get']('/describe',auth[_0xe2b6('0x8')](),controller['describe']);router[_0xe2b6('0x6')](_0xe2b6('0x9'),auth['isAuthenticated'](),controller[_0xe2b6('0xa')]);router[_0xe2b6('0xb')]('/',auth[_0xe2b6('0x8')](),controller[_0xe2b6('0xc')]);router[_0xe2b6('0xd')](_0xe2b6('0x9'),auth[_0xe2b6('0x8')](),controller[_0xe2b6('0xe')]);router[_0xe2b6('0xf')](_0xe2b6('0x9'),auth['isAuthenticated'](),controller[_0xe2b6('0x10')]);module[_0xe2b6('0x11')]=router; \ No newline at end of file +var _0x3edc=['exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','/:id','post','create','put','update','delete','destroy'];(function(_0x5d0207,_0x4000c4){var _0xf3e249=function(_0x1a1fd9){while(--_0x1a1fd9){_0x5d0207['push'](_0x5d0207['shift']());}};_0xf3e249(++_0x4000c4);}(_0x3edc,0x105));var _0xc3ed=function(_0x4bc7dd,_0x4a6aa2){_0x4bc7dd=_0x4bc7dd-0x0;var _0x8a71a0=_0x3edc[_0x4bc7dd];return _0x8a71a0;};'use strict';var multer=require('multer');var util=require(_0xc3ed('0x0'));var path=require(_0xc3ed('0x1'));var timeout=require(_0xc3ed('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc3ed('0x3'));var auth=require(_0xc3ed('0x4'));var interaction=require(_0xc3ed('0x5'));var config=require(_0xc3ed('0x6'));var controller=require(_0xc3ed('0x7'));router[_0xc3ed('0x8')]('/',auth['isAuthenticated'](),controller[_0xc3ed('0x9')]);router[_0xc3ed('0x8')](_0xc3ed('0xa'),auth[_0xc3ed('0xb')](),controller['describe']);router[_0xc3ed('0x8')](_0xc3ed('0xc'),auth[_0xc3ed('0xb')](),controller['show']);router[_0xc3ed('0xd')]('/',auth['isAuthenticated'](),controller[_0xc3ed('0xe')]);router[_0xc3ed('0xf')](_0xc3ed('0xc'),auth[_0xc3ed('0xb')](),controller[_0xc3ed('0x10')]);router[_0xc3ed('0x11')](_0xc3ed('0xc'),auth[_0xc3ed('0xb')](),controller[_0xc3ed('0x12')]);module[_0xc3ed('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index adc28c4..d5d3100 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 _0x1dcc=['STRING','name','sequelize','exports'];(function(_0x1f4d78,_0xa5f88b){var _0x51b14c=function(_0xc2386d){while(--_0xc2386d){_0x1f4d78['push'](_0x1f4d78['shift']());}};_0x51b14c(++_0xa5f88b);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x3ebf84,_0x5d0b52){_0x3ebf84=_0x3ebf84-0x0;var _0x1f1f9d=_0x1dcc[_0x3ebf84];return _0x1f1f9d;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'name':{'type':Sequelize[_0xc1dc('0x2')],'unique':_0xc1dc('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8958=['exports'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x8958,0x93));var _0x8895=function(_0x245546,_0x2d5269){_0x245546=_0x245546-0x0;var _0x1ebb5a=_0x8958[_0x245546];return _0x1ebb5a;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 4310072..886122a 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 _0x89f0=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','pick','filter','where','merge','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x89f0,0x1af));var _0x089f=function(_0x5970d7,_0x1d87a0){_0x5970d7=_0x5970d7-0x0;var _0x53691e=_0x89f0[_0x5970d7];return _0x53691e;};'use strict';var emlformat=require(_0x089f('0x0'));var rimraf=require(_0x089f('0x1'));var zipdir=require(_0x089f('0x2'));var jsonpatch=require(_0x089f('0x3'));var rp=require(_0x089f('0x4'));var moment=require(_0x089f('0x5'));var BPromise=require(_0x089f('0x6'));var Mustache=require('mustache');var util=require(_0x089f('0x7'));var path=require(_0x089f('0x8'));var sox=require(_0x089f('0x9'));var csv=require(_0x089f('0xa'));var ejs=require(_0x089f('0xb'));var fs=require('fs');var fs_extra=require(_0x089f('0xc'));var _=require(_0x089f('0xd'));var squel=require(_0x089f('0xe'));var crypto=require(_0x089f('0xf'));var jsforce=require(_0x089f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x089f('0xa'));var querystring=require(_0x089f('0x11'));var Papa=require('papaparse');var Redis=require(_0x089f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x089f('0x13'));var hardwareService=require(_0x089f('0x14'));var logger=require(_0x089f('0x15'))(_0x089f('0x16'));var utils=require('../../config/utils');var config=require(_0x089f('0x17'));var licenseUtil=require(_0x089f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9b52c0,_0x1ca921){_0x1ca921=_0x1ca921||0xcc;return function(_0x2fe961){if(_0x2fe961){return _0x9b52c0['sendStatus'](_0x1ca921);}return _0x9b52c0[_0x089f('0x19')](_0x1ca921)[_0x089f('0x1a')]();};}function respondWithResult(_0x1f8d8c,_0x51dce5){_0x51dce5=_0x51dce5||0xc8;return function(_0x1026ee){if(_0x1026ee){return _0x1f8d8c[_0x089f('0x19')](_0x51dce5)[_0x089f('0x1b')](_0x1026ee);}};}function respondWithFilteredResult(_0x4a062c,_0x2ec329){return function(_0x1ad76e){if(_0x1ad76e){var _0x1e1115=typeof _0x2ec329[_0x089f('0x1c')]===_0x089f('0x1d')&&typeof _0x2ec329['limit']==='undefined';var _0x19a08d=_0x1ad76e[_0x089f('0x1e')];var _0x1c9369=_0x1e1115?0x0:_0x2ec329['offset'];var _0x162984=_0x1e1115?_0x1ad76e[_0x089f('0x1e')]:_0x2ec329[_0x089f('0x1c')]+_0x2ec329['limit'];var _0x48e917;if(_0x162984>=_0x19a08d){_0x162984=_0x19a08d;_0x48e917=0xc8;}else{_0x48e917=0xce;}_0x4a062c[_0x089f('0x19')](_0x48e917);return _0x4a062c[_0x089f('0x1f')]('Content-Range',_0x1c9369+'-'+_0x162984+'/'+_0x19a08d)[_0x089f('0x1b')](_0x1ad76e);}return null;};}function patchUpdates(_0x949a80){return function(_0x58c42a){try{jsonpatch[_0x089f('0x20')](_0x58c42a,_0x949a80,!![]);}catch(_0x57113c){return BPromise['reject'](_0x57113c);}return _0x58c42a[_0x089f('0x21')]();};}function saveUpdates(_0x20422a,_0x25a694){return function(_0x33eb90){if(_0x33eb90){return _0x33eb90[_0x089f('0x22')](_0x20422a)[_0x089f('0x23')](function(_0x232fdf){return _0x232fdf;});}return null;};}function removeEntity(_0x28bb2a,_0x136506){return function(_0x3318f8){if(_0x3318f8){return _0x3318f8[_0x089f('0x24')]()[_0x089f('0x23')](function(){_0x28bb2a[_0x089f('0x19')](0xcc)[_0x089f('0x1a')]();});}};}function handleEntityNotFound(_0x17c70b,_0xf298c7){return function(_0xc51950){if(!_0xc51950){_0x17c70b['sendStatus'](0x194);}return _0xc51950;};}function handleError(_0x17cd59,_0x443362){_0x443362=_0x443362||0x1f4;return function(_0x435187){logger['error'](_0x435187[_0x089f('0x25')]);if(_0x435187[_0x089f('0x26')]){delete _0x435187[_0x089f('0x26')];}_0x17cd59[_0x089f('0x19')](_0x443362)[_0x089f('0x27')](_0x435187);};}exports[_0x089f('0x28')]=function(_0x5eb8fd,_0x3cfe8f){var _0x58d644={},_0x2978f4={},_0x488c7d={'count':0x0,'rows':[]};var _0x480043=_[_0x089f('0x29')](db[_0x089f('0x2a')][_0x089f('0x2b')],function(_0x92b166){return{'name':_0x92b166[_0x089f('0x2c')],'type':_0x92b166[_0x089f('0x2d')][_0x089f('0x2e')]};});_0x2978f4[_0x089f('0x2f')]=_[_0x089f('0x29')](_0x480043,'name');_0x2978f4['query']=_[_0x089f('0x30')](_0x5eb8fd[_0x089f('0x31')]);_0x2978f4[_0x089f('0x32')]=_['intersection'](_0x2978f4[_0x089f('0x2f')],_0x2978f4['query']);_0x58d644[_0x089f('0x33')]=_[_0x089f('0x34')](_0x2978f4[_0x089f('0x2f')],qs[_0x089f('0x35')](_0x5eb8fd[_0x089f('0x31')][_0x089f('0x35')]));_0x58d644[_0x089f('0x33')]=_0x58d644[_0x089f('0x33')][_0x089f('0x36')]?_0x58d644[_0x089f('0x33')]:_0x2978f4[_0x089f('0x2f')];if(!_0x5eb8fd[_0x089f('0x31')][_0x089f('0x37')]('nolimit')){_0x58d644[_0x089f('0x38')]=qs['limit'](_0x5eb8fd[_0x089f('0x31')][_0x089f('0x38')]);_0x58d644['offset']=qs[_0x089f('0x1c')](_0x5eb8fd[_0x089f('0x31')][_0x089f('0x1c')]);}_0x58d644[_0x089f('0x39')]=qs['sort'](_0x5eb8fd[_0x089f('0x31')]['sort']);_0x58d644['where']=qs['filters'](_[_0x089f('0x3a')](_0x5eb8fd[_0x089f('0x31')],_0x2978f4['filters']),_0x480043);if(_0x5eb8fd[_0x089f('0x31')][_0x089f('0x3b')]){_0x58d644[_0x089f('0x3c')]=_[_0x089f('0x3d')](_0x58d644[_0x089f('0x3c')],{'$or':_[_0x089f('0x29')](_0x480043,function(_0x5769a1){if(_0x5769a1[_0x089f('0x2d')]!=='VIRTUAL'){var _0x4e5429={};_0x4e5429[_0x5769a1['name']]={'$like':'%'+_0x5eb8fd[_0x089f('0x31')]['filter']+'%'};return _0x4e5429;}})});}_0x58d644=_[_0x089f('0x3d')]({},_0x58d644,_0x5eb8fd['options']);var _0x508f9f={'where':_0x58d644['where']};return db[_0x089f('0x2a')][_0x089f('0x1e')](_0x508f9f)[_0x089f('0x23')](function(_0x2ba2f1){_0x488c7d['count']=_0x2ba2f1;if(_0x5eb8fd[_0x089f('0x31')][_0x089f('0x3e')]){_0x58d644[_0x089f('0x3f')]=[{'all':!![]}];}return db[_0x089f('0x2a')][_0x089f('0x40')](_0x58d644);})['then'](function(_0x315ee6){_0x488c7d['rows']=_0x315ee6;return _0x488c7d;})[_0x089f('0x23')](respondWithFilteredResult(_0x3cfe8f,_0x58d644))['catch'](handleError(_0x3cfe8f,null));};exports[_0x089f('0x41')]=function(_0x328c70,_0x36c13b){var _0x177849={'raw':!![],'where':{'id':_0x328c70[_0x089f('0x42')]['id']}},_0x4ff22b={};_0x4ff22b[_0x089f('0x2f')]=_[_0x089f('0x30')](db[_0x089f('0x2a')][_0x089f('0x2b')]);_0x4ff22b[_0x089f('0x31')]=_[_0x089f('0x30')](_0x328c70[_0x089f('0x31')]);_0x4ff22b[_0x089f('0x32')]=_[_0x089f('0x34')](_0x4ff22b[_0x089f('0x2f')],_0x4ff22b[_0x089f('0x31')]);_0x177849[_0x089f('0x33')]=_[_0x089f('0x34')](_0x4ff22b[_0x089f('0x2f')],qs[_0x089f('0x35')](_0x328c70[_0x089f('0x31')][_0x089f('0x35')]));_0x177849[_0x089f('0x33')]=_0x177849[_0x089f('0x33')][_0x089f('0x36')]?_0x177849['attributes']:_0x4ff22b[_0x089f('0x2f')];if(_0x328c70[_0x089f('0x31')][_0x089f('0x3e')]){_0x177849[_0x089f('0x3f')]=[{'all':!![]}];}_0x177849=_[_0x089f('0x3d')]({},_0x177849,_0x328c70[_0x089f('0x43')]);return db[_0x089f('0x2a')][_0x089f('0x44')](_0x177849)['then'](handleEntityNotFound(_0x36c13b,null))[_0x089f('0x23')](respondWithResult(_0x36c13b,null))[_0x089f('0x45')](handleError(_0x36c13b,null));};exports[_0x089f('0x46')]=function(_0x440d4b,_0x4e1090){return db[_0x089f('0x2a')]['create'](_0x440d4b[_0x089f('0x47')],{})[_0x089f('0x23')](respondWithResult(_0x4e1090,0xc9))[_0x089f('0x45')](handleError(_0x4e1090,null));};exports[_0x089f('0x22')]=function(_0x1c0e90,_0xa01067){if(_0x1c0e90['body']['id']){delete _0x1c0e90[_0x089f('0x47')]['id'];}return db[_0x089f('0x2a')][_0x089f('0x44')]({'where':{'id':_0x1c0e90['params']['id']}})['then'](handleEntityNotFound(_0xa01067,null))[_0x089f('0x23')](saveUpdates(_0x1c0e90[_0x089f('0x47')],null))['then'](respondWithResult(_0xa01067,null))[_0x089f('0x45')](handleError(_0xa01067,null));};exports[_0x089f('0x24')]=function(_0x291570,_0x19c290){return db['MailSubstatus'][_0x089f('0x44')]({'where':{'id':_0x291570[_0x089f('0x42')]['id']}})[_0x089f('0x23')](handleEntityNotFound(_0x19c290,null))[_0x089f('0x23')](removeEntity(_0x19c290,null))[_0x089f('0x45')](handleError(_0x19c290,null));};exports[_0x089f('0x48')]=function(_0x1170ce,_0x771421){return db[_0x089f('0x2a')][_0x089f('0x48')]()[_0x089f('0x23')](respondWithResult(_0x771421,null))[_0x089f('0x45')](handleError(_0x771421,null));}; \ No newline at end of file +var _0xc7fa=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','undefined','limit','offset','status','set','apply','reject','save','then','destroy','error','stack','name','send','map','MailSubstatus','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','filter','where','merge','options','count','includeAll','include','findAll','catch','show','keys','find','create','body','update','params'];(function(_0x3f1b36,_0x205b14){var _0x56a704=function(_0x3fc084){while(--_0x3fc084){_0x3f1b36['push'](_0x3f1b36['shift']());}};_0x56a704(++_0x205b14);}(_0xc7fa,0xd9));var _0xac7f=function(_0x4fff3a,_0x2d48e8){_0x4fff3a=_0x4fff3a-0x0;var _0x28113c=_0xc7fa[_0x4fff3a];return _0x28113c;};'use strict';var emlformat=require(_0xac7f('0x0'));var rimraf=require(_0xac7f('0x1'));var zipdir=require(_0xac7f('0x2'));var jsonpatch=require(_0xac7f('0x3'));var rp=require(_0xac7f('0x4'));var moment=require('moment');var BPromise=require(_0xac7f('0x5'));var Mustache=require(_0xac7f('0x6'));var util=require(_0xac7f('0x7'));var path=require(_0xac7f('0x8'));var sox=require('sox');var csv=require(_0xac7f('0x9'));var ejs=require(_0xac7f('0xa'));var fs=require('fs');var fs_extra=require(_0xac7f('0xb'));var _=require('lodash');var squel=require(_0xac7f('0xc'));var crypto=require(_0xac7f('0xd'));var jsforce=require(_0xac7f('0xe'));var deskjs=require(_0xac7f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xac7f('0x10'));var Papa=require(_0xac7f('0x11'));var Redis=require('ioredis');var authService=require(_0xac7f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac7f('0x13'));var logger=require(_0xac7f('0x14'))(_0xac7f('0x15'));var utils=require(_0xac7f('0x16'));var config=require(_0xac7f('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a2b7c,_0x2d5566){_0x2d5566=_0x2d5566||0xcc;return function(_0x305186){if(_0x305186){return _0x3a2b7c[_0xac7f('0x18')](_0x2d5566);}return _0x3a2b7c['status'](_0x2d5566)[_0xac7f('0x19')]();};}function respondWithResult(_0x4dc47d,_0x50062f){_0x50062f=_0x50062f||0xc8;return function(_0x18d238){if(_0x18d238){return _0x4dc47d['status'](_0x50062f)[_0xac7f('0x1a')](_0x18d238);}};}function respondWithFilteredResult(_0x326a46,_0x84effd){return function(_0x5b8173){if(_0x5b8173){var _0x37fbe0=typeof _0x84effd['offset']===_0xac7f('0x1b')&&typeof _0x84effd[_0xac7f('0x1c')]==='undefined';var _0x5a7045=_0x5b8173['count'];var _0x5f0a42=_0x37fbe0?0x0:_0x84effd[_0xac7f('0x1d')];var _0x496eb2=_0x37fbe0?_0x5b8173['count']:_0x84effd[_0xac7f('0x1d')]+_0x84effd[_0xac7f('0x1c')];var _0x84daca;if(_0x496eb2>=_0x5a7045){_0x496eb2=_0x5a7045;_0x84daca=0xc8;}else{_0x84daca=0xce;}_0x326a46[_0xac7f('0x1e')](_0x84daca);return _0x326a46[_0xac7f('0x1f')]('Content-Range',_0x5f0a42+'-'+_0x496eb2+'/'+_0x5a7045)['json'](_0x5b8173);}return null;};}function patchUpdates(_0x482216){return function(_0x3a8ce5){try{jsonpatch[_0xac7f('0x20')](_0x3a8ce5,_0x482216,!![]);}catch(_0x3ebc52){return BPromise[_0xac7f('0x21')](_0x3ebc52);}return _0x3a8ce5[_0xac7f('0x22')]();};}function saveUpdates(_0x3af6e1,_0x34c654){return function(_0x150465){if(_0x150465){return _0x150465['update'](_0x3af6e1)[_0xac7f('0x23')](function(_0x230c85){return _0x230c85;});}return null;};}function removeEntity(_0x39b6ec,_0x8be888){return function(_0x4e596c){if(_0x4e596c){return _0x4e596c[_0xac7f('0x24')]()[_0xac7f('0x23')](function(){_0x39b6ec[_0xac7f('0x1e')](0xcc)[_0xac7f('0x19')]();});}};}function handleEntityNotFound(_0x1f0c5b,_0x30b4e4){return function(_0x55bc2c){if(!_0x55bc2c){_0x1f0c5b[_0xac7f('0x18')](0x194);}return _0x55bc2c;};}function handleError(_0x2acbff,_0x8f1936){_0x8f1936=_0x8f1936||0x1f4;return function(_0x2a8319){logger[_0xac7f('0x25')](_0x2a8319[_0xac7f('0x26')]);if(_0x2a8319[_0xac7f('0x27')]){delete _0x2a8319[_0xac7f('0x27')];}_0x2acbff[_0xac7f('0x1e')](_0x8f1936)[_0xac7f('0x28')](_0x2a8319);};}exports['index']=function(_0x494b4f,_0x5860e5){var _0x43e327={},_0x3438be={},_0x7551be={'count':0x0,'rows':[]};var _0x2eeb2=_[_0xac7f('0x29')](db[_0xac7f('0x2a')]['rawAttributes'],function(_0x61cc47){return{'name':_0x61cc47[_0xac7f('0x2b')],'type':_0x61cc47[_0xac7f('0x2c')]['key']};});_0x3438be['model']=_[_0xac7f('0x29')](_0x2eeb2,_0xac7f('0x27'));_0x3438be[_0xac7f('0x2d')]=_['keys'](_0x494b4f['query']);_0x3438be[_0xac7f('0x2e')]=_[_0xac7f('0x2f')](_0x3438be[_0xac7f('0x30')],_0x3438be[_0xac7f('0x2d')]);_0x43e327['attributes']=_[_0xac7f('0x2f')](_0x3438be['model'],qs[_0xac7f('0x31')](_0x494b4f['query']['fields']));_0x43e327[_0xac7f('0x32')]=_0x43e327[_0xac7f('0x32')][_0xac7f('0x33')]?_0x43e327['attributes']:_0x3438be['model'];if(!_0x494b4f['query']['hasOwnProperty'](_0xac7f('0x34'))){_0x43e327['limit']=qs[_0xac7f('0x1c')](_0x494b4f[_0xac7f('0x2d')]['limit']);_0x43e327[_0xac7f('0x1d')]=qs[_0xac7f('0x1d')](_0x494b4f[_0xac7f('0x2d')][_0xac7f('0x1d')]);}_0x43e327[_0xac7f('0x35')]=qs[_0xac7f('0x36')](_0x494b4f[_0xac7f('0x2d')][_0xac7f('0x36')]);_0x43e327['where']=qs['filters'](_['pick'](_0x494b4f['query'],_0x3438be[_0xac7f('0x2e')]),_0x2eeb2);if(_0x494b4f[_0xac7f('0x2d')][_0xac7f('0x37')]){_0x43e327[_0xac7f('0x38')]=_[_0xac7f('0x39')](_0x43e327[_0xac7f('0x38')],{'$or':_[_0xac7f('0x29')](_0x2eeb2,function(_0x4b1191){if(_0x4b1191[_0xac7f('0x2c')]!=='VIRTUAL'){var _0x5dabb7={};_0x5dabb7[_0x4b1191[_0xac7f('0x27')]]={'$like':'%'+_0x494b4f[_0xac7f('0x2d')][_0xac7f('0x37')]+'%'};return _0x5dabb7;}})});}_0x43e327=_[_0xac7f('0x39')]({},_0x43e327,_0x494b4f[_0xac7f('0x3a')]);var _0x55a2f4={'where':_0x43e327[_0xac7f('0x38')]};return db['MailSubstatus'][_0xac7f('0x3b')](_0x55a2f4)[_0xac7f('0x23')](function(_0x4bd69f){_0x7551be[_0xac7f('0x3b')]=_0x4bd69f;if(_0x494b4f[_0xac7f('0x2d')][_0xac7f('0x3c')]){_0x43e327[_0xac7f('0x3d')]=[{'all':!![]}];}return db[_0xac7f('0x2a')][_0xac7f('0x3e')](_0x43e327);})[_0xac7f('0x23')](function(_0x281339){_0x7551be['rows']=_0x281339;return _0x7551be;})[_0xac7f('0x23')](respondWithFilteredResult(_0x5860e5,_0x43e327))[_0xac7f('0x3f')](handleError(_0x5860e5,null));};exports[_0xac7f('0x40')]=function(_0x9a3a7b,_0xa8e73f){var _0x5b728a={'raw':!![],'where':{'id':_0x9a3a7b['params']['id']}},_0x48536c={};_0x48536c['model']=_[_0xac7f('0x41')](db[_0xac7f('0x2a')]['rawAttributes']);_0x48536c[_0xac7f('0x2d')]=_['keys'](_0x9a3a7b[_0xac7f('0x2d')]);_0x48536c[_0xac7f('0x2e')]=_[_0xac7f('0x2f')](_0x48536c['model'],_0x48536c['query']);_0x5b728a['attributes']=_[_0xac7f('0x2f')](_0x48536c['model'],qs[_0xac7f('0x31')](_0x9a3a7b[_0xac7f('0x2d')][_0xac7f('0x31')]));_0x5b728a['attributes']=_0x5b728a['attributes'][_0xac7f('0x33')]?_0x5b728a[_0xac7f('0x32')]:_0x48536c[_0xac7f('0x30')];if(_0x9a3a7b[_0xac7f('0x2d')][_0xac7f('0x3c')]){_0x5b728a[_0xac7f('0x3d')]=[{'all':!![]}];}_0x5b728a=_[_0xac7f('0x39')]({},_0x5b728a,_0x9a3a7b[_0xac7f('0x3a')]);return db['MailSubstatus'][_0xac7f('0x42')](_0x5b728a)[_0xac7f('0x23')](handleEntityNotFound(_0xa8e73f,null))[_0xac7f('0x23')](respondWithResult(_0xa8e73f,null))['catch'](handleError(_0xa8e73f,null));};exports['create']=function(_0x30a565,_0x436a44){return db[_0xac7f('0x2a')][_0xac7f('0x43')](_0x30a565[_0xac7f('0x44')],{})[_0xac7f('0x23')](respondWithResult(_0x436a44,0xc9))[_0xac7f('0x3f')](handleError(_0x436a44,null));};exports[_0xac7f('0x45')]=function(_0x59486c,_0x5c5607){if(_0x59486c[_0xac7f('0x44')]['id']){delete _0x59486c[_0xac7f('0x44')]['id'];}return db[_0xac7f('0x2a')][_0xac7f('0x42')]({'where':{'id':_0x59486c[_0xac7f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c5607,null))[_0xac7f('0x23')](saveUpdates(_0x59486c[_0xac7f('0x44')],null))[_0xac7f('0x23')](respondWithResult(_0x5c5607,null))[_0xac7f('0x3f')](handleError(_0x5c5607,null));};exports[_0xac7f('0x24')]=function(_0x27e198,_0x575b84){return db[_0xac7f('0x2a')][_0xac7f('0x42')]({'where':{'id':_0x27e198[_0xac7f('0x46')]['id']}})[_0xac7f('0x23')](handleEntityNotFound(_0x575b84,null))[_0xac7f('0x23')](removeEntity(_0x575b84,null))[_0xac7f('0x3f')](handleError(_0x575b84,null));};exports['describe']=function(_0x32bc45,_0x4e14ca){return db[_0xac7f('0x2a')][_0xac7f('0x47')]()[_0xac7f('0x23')](respondWithResult(_0x4e14ca,null))[_0xac7f('0x3f')](handleError(_0x4e14ca,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index cf94760..2e60b79 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 _0x89f5=['hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x58c049,_0x166018){var _0x54671e=function(_0x3f8465){while(--_0x3f8465){_0x58c049['push'](_0x58c049['shift']());}};_0x54671e(++_0x166018);}(_0x89f5,0x1b2));var _0x589f=function(_0x263271,_0x402519){_0x263271=_0x263271-0x0;var _0x49e2ac=_0x89f5[_0x263271];return _0x49e2ac;};'use strict';var EventEmitter=require(_0x589f('0x0'));var MailSubstatus=require(_0x589f('0x1'))['db'][_0x589f('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x589f('0x3')](0x0);var events={'afterUpdate':_0x589f('0x4')};function emitEvent(_0x2ed42a){return function(_0x52576a,_0x495c8c,_0x4f2771){MailSubstatusEvents[_0x589f('0x5')](_0x2ed42a+':'+_0x52576a['id'],_0x52576a);MailSubstatusEvents[_0x589f('0x5')](_0x2ed42a,_0x52576a);_0x4f2771(null);};}for(var e in events){if(events[_0x589f('0x6')](e)){var event=events[e];MailSubstatus[_0x589f('0x7')](e,emitEvent(event));}}module[_0x589f('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x59d6=['hasOwnProperty','exports','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x59d6,0x152));var _0x659d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x59d6[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x659d('0x0'))['db'][_0x659d('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x659d('0x2')](0x0);var events={'afterUpdate':_0x659d('0x3')};function emitEvent(_0xab3102){return function(_0x543e90,_0x28f7ff,_0x55962b){MailSubstatusEvents['emit'](_0xab3102+':'+_0x543e90['id'],_0x543e90);MailSubstatusEvents['emit'](_0xab3102,_0x543e90);_0x55962b(null);};}for(var e in events){if(events[_0x659d('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x659d('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 51fd173..4d5c829 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 _0xd488=['Condition','update','name','catch','exports','define','MailSubstatus','mail_substatuses'];(function(_0xcb8fde,_0x24399c){var _0x16dd77=function(_0x27cab4){while(--_0x27cab4){_0xcb8fde['push'](_0xcb8fde['shift']());}};_0x16dd77(++_0x24399c);}(_0xd488,0x104));var _0x8d48=function(_0x1a7e4b,_0x2fbd40){_0x1a7e4b=_0x1a7e4b-0x0;var _0x37a8fd=_0xd488[_0x1a7e4b];return _0x37a8fd;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x8d48('0x0')]=function(_0x4e11b6){var _0x5c7c8e=_0x4e11b6['models'];return _0x4e11b6[_0x8d48('0x1')](_0x8d48('0x2'),attributes,{'tableName':_0x8d48('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5d4217,_0x252d86,_0x41c590){return _0x5c7c8e[_0x8d48('0x4')][_0x8d48('0x5')]({'value':_0x5d4217['name']},{'where':{'field':'mailSubstatus','value':_0x5d4217['_previousDataValues'][_0x8d48('0x6')]}})['then'](function(){_0x41c590();})[_0x8d48('0x7')](function(_0x16c856){_0x41c590(_0x16c856);});}}});}; \ No newline at end of file +var _0x980f=['update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses'];(function(_0x4ac144,_0x3d83ea){var _0x162b18=function(_0x542f40){while(--_0x542f40){_0x4ac144['push'](_0x4ac144['shift']());}};_0x162b18(++_0x3d83ea);}(_0x980f,0x1de));var _0xf980=function(_0xc5cd18,_0x251c74){_0xc5cd18=_0xc5cd18-0x0;var _0x37a5cb=_0x980f[_0xc5cd18];return _0x37a5cb;};'use strict';var attributes=require(_0xf980('0x0'));module[_0xf980('0x1')]=function(_0x9989d8){var _0x40f15e=_0x9989d8[_0xf980('0x2')];return _0x9989d8[_0xf980('0x3')](_0xf980('0x4'),attributes,{'tableName':_0xf980('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1528e7,_0xb8f198,_0x4bb2f9){return _0x40f15e['Condition'][_0xf980('0x6')]({'value':_0x1528e7[_0xf980('0x7')]},{'where':{'field':_0xf980('0x8'),'value':_0x1528e7[_0xf980('0x9')]['name']}})[_0xf980('0xa')](function(){_0x4bb2f9();})['catch'](function(_0x5a9bee){_0x4bb2f9(_0x5a9bee);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 8789910..cec52c0 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 _0x0edf=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x445f32,_0x2a3234){var _0x12e86a=function(_0x477b65){while(--_0x477b65){_0x445f32['push'](_0x445f32['shift']());}};_0x12e86a(++_0x2a3234);}(_0x0edf,0x83));var _0xf0ed=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x0edf[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0xf0ed('0x0'));var util=require(_0xf0ed('0x1'));var moment=require(_0xf0ed('0x2'));var BPromise=require(_0xf0ed('0x3'));var rs=require(_0xf0ed('0x4'));var fs=require('fs');var Redis=require(_0xf0ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf0ed('0x6'))(_0xf0ed('0x7'));var config=require(_0xf0ed('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x193467,_0x121068,_0x48c5d5){return new BPromise(function(_0x2db0eb,_0x25fe37){return client['request'](_0x193467,_0x48c5d5)['then'](function(_0x41c751){logger[_0xf0ed('0x9')](_0xf0ed('0xa'),_0x121068,_0xf0ed('0xb'));logger[_0xf0ed('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x121068,_0xf0ed('0xb'),JSON[_0xf0ed('0xd')](_0x41c751));if(_0x41c751[_0xf0ed('0xe')]){if(_0x41c751['error'][_0xf0ed('0xf')]===0x1f4){logger[_0xf0ed('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x121068,_0x41c751[_0xf0ed('0xe')][_0xf0ed('0x10')]);return _0x25fe37(_0x41c751[_0xf0ed('0xe')][_0xf0ed('0x10')]);}logger[_0xf0ed('0xe')](_0xf0ed('0xa'),_0x121068,_0x41c751[_0xf0ed('0xe')]['message']);return _0x2db0eb(_0x41c751[_0xf0ed('0xe')]['message']);}else{logger[_0xf0ed('0x9')](_0xf0ed('0xa'),_0x121068,_0xf0ed('0xb'));_0x2db0eb(_0x41c751[_0xf0ed('0x11')][_0xf0ed('0x10')]);}})['catch'](function(_0x1f603d){logger[_0xf0ed('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x121068,_0x1f603d);_0x25fe37(_0x1f603d);});});} \ No newline at end of file +var _0x2f46=['error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x55e724,_0x8f22f1){var _0x1b317c=function(_0x21d4dd){while(--_0x21d4dd){_0x55e724['push'](_0x55e724['shift']());}};_0x1b317c(++_0x8f22f1);}(_0x2f46,0x15f));var _0x62f4=function(_0x477a28,_0x4ea33c){_0x477a28=_0x477a28-0x0;var _0x396eb0=_0x2f46[_0x477a28];return _0x396eb0;};'use strict';var _=require('lodash');var util=require(_0x62f4('0x0'));var moment=require(_0x62f4('0x1'));var BPromise=require(_0x62f4('0x2'));var rs=require(_0x62f4('0x3'));var fs=require('fs');var Redis=require(_0x62f4('0x4'));var db=require(_0x62f4('0x5'))['db'];var utils=require(_0x62f4('0x6'));var logger=require('../../config/logger')(_0x62f4('0x7'));var config=require(_0x62f4('0x8'));var jayson=require(_0x62f4('0x9'));var client=jayson[_0x62f4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d9a81,_0x35ccc3,_0x21df0f){return new BPromise(function(_0x5a069f,_0x35afb4){return client[_0x62f4('0xb')](_0x1d9a81,_0x21df0f)[_0x62f4('0xc')](function(_0x5f25e1){logger[_0x62f4('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x35ccc3,'request\x20sent');logger[_0x62f4('0xe')](_0x62f4('0xf'),_0x35ccc3,_0x62f4('0x10'),JSON['stringify'](_0x5f25e1));if(_0x5f25e1[_0x62f4('0x11')]){if(_0x5f25e1['error'][_0x62f4('0x12')]===0x1f4){logger['error'](_0x62f4('0x13'),_0x35ccc3,_0x5f25e1[_0x62f4('0x11')][_0x62f4('0x14')]);return _0x35afb4(_0x5f25e1['error'][_0x62f4('0x14')]);}logger[_0x62f4('0x11')](_0x62f4('0x13'),_0x35ccc3,_0x5f25e1[_0x62f4('0x11')][_0x62f4('0x14')]);return _0x5a069f(_0x5f25e1[_0x62f4('0x11')][_0x62f4('0x14')]);}else{logger[_0x62f4('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x35ccc3,_0x62f4('0x10'));_0x5a069f(_0x5f25e1[_0x62f4('0x15')]['message']);}})[_0x62f4('0x16')](function(_0x479c64){logger[_0x62f4('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x35ccc3,_0x479c64);_0x35afb4(_0x479c64);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 06d004e..fd08dcd 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 _0x6b6a=['describe','/:id','isAuthenticated','show','put','update','delete','exports','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','/describe'];(function(_0x4c2195,_0x41dd48){var _0x36d211=function(_0x399eeb){while(--_0x399eeb){_0x4c2195['push'](_0x4c2195['shift']());}};_0x36d211(++_0x41dd48);}(_0x6b6a,0x158));var _0xa6b6=function(_0x4dbc76,_0x9a8d25){_0x4dbc76=_0x4dbc76-0x0;var _0x3f3d8f=_0x6b6a[_0x4dbc76];return _0x3f3d8f;};'use strict';var multer=require('multer');var util=require(_0xa6b6('0x0'));var path=require('path');var timeout=require(_0xa6b6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa6b6('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xa6b6('0x3'));var config=require(_0xa6b6('0x4'));var controller=require(_0xa6b6('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa6b6('0x6')](_0xa6b6('0x7'),auth['isAuthenticated'](),controller[_0xa6b6('0x8')]);router[_0xa6b6('0x6')](_0xa6b6('0x9'),auth[_0xa6b6('0xa')](),controller[_0xa6b6('0xb')]);router['post']('/',auth[_0xa6b6('0xa')](),controller['create']);router[_0xa6b6('0xc')](_0xa6b6('0x9'),auth[_0xa6b6('0xa')](),controller[_0xa6b6('0xd')]);router[_0xa6b6('0xe')](_0xa6b6('0x9'),auth[_0xa6b6('0xa')](),controller['destroy']);module[_0xa6b6('0xf')]=router; \ No newline at end of file +var _0x951a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','isAuthenticated','describe','/:id','post','create','put','exports','util','path','connect-timeout'];(function(_0x4c1f72,_0x1cef55){var _0xd740bd=function(_0x295cbc){while(--_0x295cbc){_0x4c1f72['push'](_0x4c1f72['shift']());}};_0xd740bd(++_0x1cef55);}(_0x951a,0xce));var _0xa951=function(_0x5ac4ab,_0x4f9ba0){_0x5ac4ab=_0x5ac4ab-0x0;var _0x58a280=_0x951a[_0x5ac4ab];return _0x58a280;};'use strict';var multer=require('multer');var util=require(_0xa951('0x0'));var path=require(_0xa951('0x1'));var timeout=require(_0xa951('0x2'));var express=require(_0xa951('0x3'));var router=express[_0xa951('0x4')]();var fs_extra=require(_0xa951('0x5'));var auth=require(_0xa951('0x6'));var interaction=require(_0xa951('0x7'));var config=require(_0xa951('0x8'));var controller=require(_0xa951('0x9'));router[_0xa951('0xa')]('/',auth['isAuthenticated'](),controller[_0xa951('0xb')]);router[_0xa951('0xa')]('/describe',auth[_0xa951('0xc')](),controller[_0xa951('0xd')]);router[_0xa951('0xa')](_0xa951('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xa951('0xf')]('/',auth[_0xa951('0xc')](),controller[_0xa951('0x10')]);router[_0xa951('0x11')](_0xa951('0xe'),auth[_0xa951('0xc')](),controller['update']);router['delete'](_0xa951('0xe'),auth[_0xa951('0xc')](),controller['destroy']);module[_0xa951('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 051a53d..cad6fef 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xb43b,0x1b2));var _0xbb43=function(_0x141631,_0x5133e9){_0x141631=_0x141631-0x0;var _0x3863b4=_0xb43b[_0x141631];return _0x3863b4;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0xb43b,0x1b2));var _0xbb43=function(_0xf2a8a8,_0x4975ed){_0xf2a8a8=_0xf2a8a8-0x0;var _0x53567a=_0xb43b[_0xf2a8a8];return _0x53567a;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index fb76895..abb77e1 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 _0xe099=['name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x3612d5,_0xba7292){var _0x2febbf=function(_0x15a004){while(--_0x15a004){_0x3612d5['push'](_0x3612d5['shift']());}};_0x2febbf(++_0xba7292);}(_0xe099,0xbd));var _0x9e09=function(_0x4e01e5,_0x300dec){_0x4e01e5=_0x4e01e5-0x0;var _0x3572fc=_0xe099[_0x4e01e5];return _0x3572fc;};'use strict';var emlformat=require(_0x9e09('0x0'));var rimraf=require(_0x9e09('0x1'));var zipdir=require(_0x9e09('0x2'));var jsonpatch=require(_0x9e09('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e09('0x4'));var Mustache=require('mustache');var util=require(_0x9e09('0x5'));var path=require(_0x9e09('0x6'));var sox=require('sox');var csv=require(_0x9e09('0x7'));var ejs=require(_0x9e09('0x8'));var fs=require('fs');var fs_extra=require(_0x9e09('0x9'));var _=require(_0x9e09('0xa'));var squel=require(_0x9e09('0xb'));var crypto=require(_0x9e09('0xc'));var jsforce=require(_0x9e09('0xd'));var deskjs=require(_0x9e09('0xe'));var toCsv=require(_0x9e09('0x7'));var querystring=require('querystring');var Papa=require(_0x9e09('0xf'));var Redis=require(_0x9e09('0x10'));var authService=require(_0x9e09('0x11'));var qs=require(_0x9e09('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e09('0x13'))('api');var utils=require(_0x9e09('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9e09('0x15'));var db=require(_0x9e09('0x16'))['db'];function respondWithStatusCode(_0x212e21,_0x1a64b8){_0x1a64b8=_0x1a64b8||0xcc;return function(_0x96fa34){if(_0x96fa34){return _0x212e21[_0x9e09('0x17')](_0x1a64b8);}return _0x212e21[_0x9e09('0x18')](_0x1a64b8)[_0x9e09('0x19')]();};}function respondWithResult(_0x4f1d50,_0x2c8a71){_0x2c8a71=_0x2c8a71||0xc8;return function(_0x487465){if(_0x487465){return _0x4f1d50[_0x9e09('0x18')](_0x2c8a71)[_0x9e09('0x1a')](_0x487465);}};}function respondWithFilteredResult(_0x47f813,_0x24ca1f){return function(_0x436740){if(_0x436740){var _0x29d26c=typeof _0x24ca1f[_0x9e09('0x1b')]==='undefined'&&typeof _0x24ca1f[_0x9e09('0x1c')]==='undefined';var _0x534a2a=_0x436740[_0x9e09('0x1d')];var _0x58a91f=_0x29d26c?0x0:_0x24ca1f[_0x9e09('0x1b')];var _0x29baf9=_0x29d26c?_0x436740[_0x9e09('0x1d')]:_0x24ca1f['offset']+_0x24ca1f[_0x9e09('0x1c')];var _0x4ce8a1;if(_0x29baf9>=_0x534a2a){_0x29baf9=_0x534a2a;_0x4ce8a1=0xc8;}else{_0x4ce8a1=0xce;}_0x47f813[_0x9e09('0x18')](_0x4ce8a1);return _0x47f813[_0x9e09('0x1e')](_0x9e09('0x1f'),_0x58a91f+'-'+_0x29baf9+'/'+_0x534a2a)['json'](_0x436740);}return null;};}function patchUpdates(_0x548f96){return function(_0x3cc84c){try{jsonpatch[_0x9e09('0x20')](_0x3cc84c,_0x548f96,!![]);}catch(_0x1d19c9){return BPromise[_0x9e09('0x21')](_0x1d19c9);}return _0x3cc84c[_0x9e09('0x22')]();};}function saveUpdates(_0x1fffe4,_0x1d7072){return function(_0x34ec31){if(_0x34ec31){return _0x34ec31[_0x9e09('0x23')](_0x1fffe4)[_0x9e09('0x24')](function(_0x28b2c7){return _0x28b2c7;});}return null;};}function removeEntity(_0x794258,_0x28773c){return function(_0xf50689){if(_0xf50689){return _0xf50689['destroy']()[_0x9e09('0x24')](function(){_0x794258['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x239b6e,_0x3ca938){return function(_0x434081){if(!_0x434081){_0x239b6e['sendStatus'](0x194);}return _0x434081;};}function handleError(_0x1f4b66,_0x44c715){_0x44c715=_0x44c715||0x1f4;return function(_0x4aac48){logger[_0x9e09('0x25')](_0x4aac48[_0x9e09('0x26')]);if(_0x4aac48['name']){delete _0x4aac48[_0x9e09('0x27')];}_0x1f4b66[_0x9e09('0x18')](_0x44c715)[_0x9e09('0x28')](_0x4aac48);};}exports[_0x9e09('0x29')]=function(_0x594341,_0x347fcb){var _0xaa4381={},_0x55ba0d={},_0x406cd4={'count':0x0,'rows':[]};var _0x2e3774=_[_0x9e09('0x2a')](db[_0x9e09('0x2b')][_0x9e09('0x2c')],function(_0x38b215){return{'name':_0x38b215[_0x9e09('0x2d')],'type':_0x38b215[_0x9e09('0x2e')][_0x9e09('0x2f')]};});_0x55ba0d[_0x9e09('0x30')]=_['map'](_0x2e3774,'name');_0x55ba0d[_0x9e09('0x31')]=_[_0x9e09('0x32')](_0x594341[_0x9e09('0x31')]);_0x55ba0d[_0x9e09('0x33')]=_[_0x9e09('0x34')](_0x55ba0d[_0x9e09('0x30')],_0x55ba0d[_0x9e09('0x31')]);_0xaa4381[_0x9e09('0x35')]=_['intersection'](_0x55ba0d[_0x9e09('0x30')],qs['fields'](_0x594341[_0x9e09('0x31')][_0x9e09('0x36')]));_0xaa4381[_0x9e09('0x35')]=_0xaa4381[_0x9e09('0x35')][_0x9e09('0x37')]?_0xaa4381['attributes']:_0x55ba0d[_0x9e09('0x30')];if(!_0x594341[_0x9e09('0x31')][_0x9e09('0x38')](_0x9e09('0x39'))){_0xaa4381[_0x9e09('0x1c')]=qs[_0x9e09('0x1c')](_0x594341['query'][_0x9e09('0x1c')]);_0xaa4381[_0x9e09('0x1b')]=qs[_0x9e09('0x1b')](_0x594341['query'][_0x9e09('0x1b')]);}_0xaa4381[_0x9e09('0x3a')]=qs[_0x9e09('0x3b')](_0x594341[_0x9e09('0x31')][_0x9e09('0x3b')]);_0xaa4381[_0x9e09('0x3c')]=qs['filters'](_['pick'](_0x594341[_0x9e09('0x31')],_0x55ba0d[_0x9e09('0x33')]),_0x2e3774);if(_0x594341[_0x9e09('0x31')]['filter']){_0xaa4381[_0x9e09('0x3c')]=_[_0x9e09('0x3d')](_0xaa4381[_0x9e09('0x3c')],{'$or':_[_0x9e09('0x2a')](_0x2e3774,function(_0x4d082a){if(_0x4d082a[_0x9e09('0x2e')]!==_0x9e09('0x3e')){var _0x137990={};_0x137990[_0x4d082a[_0x9e09('0x27')]]={'$like':'%'+_0x594341[_0x9e09('0x31')]['filter']+'%'};return _0x137990;}})});}_0xaa4381=_[_0x9e09('0x3d')]({},_0xaa4381,_0x594341[_0x9e09('0x3f')]);var _0x206abd={'where':_0xaa4381[_0x9e09('0x3c')]};return db[_0x9e09('0x2b')][_0x9e09('0x1d')](_0x206abd)[_0x9e09('0x24')](function(_0x3557d0){_0x406cd4[_0x9e09('0x1d')]=_0x3557d0;if(_0x594341[_0x9e09('0x31')][_0x9e09('0x40')]){_0xaa4381[_0x9e09('0x41')]=[{'all':!![]}];}return db[_0x9e09('0x2b')][_0x9e09('0x42')](_0xaa4381);})[_0x9e09('0x24')](function(_0x5b3563){_0x406cd4[_0x9e09('0x43')]=_0x5b3563;return _0x406cd4;})['then'](respondWithFilteredResult(_0x347fcb,_0xaa4381))[_0x9e09('0x44')](handleError(_0x347fcb,null));};exports[_0x9e09('0x45')]=function(_0x26a54d,_0x4afcd1){var _0xb99733={'raw':!![],'where':{'id':_0x26a54d[_0x9e09('0x46')]['id']}},_0x5e708b={};_0x5e708b['model']=_[_0x9e09('0x32')](db[_0x9e09('0x2b')][_0x9e09('0x2c')]);_0x5e708b[_0x9e09('0x31')]=_[_0x9e09('0x32')](_0x26a54d[_0x9e09('0x31')]);_0x5e708b[_0x9e09('0x33')]=_[_0x9e09('0x34')](_0x5e708b[_0x9e09('0x30')],_0x5e708b[_0x9e09('0x31')]);_0xb99733[_0x9e09('0x35')]=_[_0x9e09('0x34')](_0x5e708b[_0x9e09('0x30')],qs['fields'](_0x26a54d['query'][_0x9e09('0x36')]));_0xb99733[_0x9e09('0x35')]=_0xb99733['attributes'][_0x9e09('0x37')]?_0xb99733[_0x9e09('0x35')]:_0x5e708b[_0x9e09('0x30')];if(_0x26a54d['query']['includeAll']){_0xb99733[_0x9e09('0x41')]=[{'all':!![]}];}_0xb99733=_['merge']({},_0xb99733,_0x26a54d[_0x9e09('0x3f')]);return db[_0x9e09('0x2b')][_0x9e09('0x47')](_0xb99733)[_0x9e09('0x24')](handleEntityNotFound(_0x4afcd1,null))['then'](respondWithResult(_0x4afcd1,null))[_0x9e09('0x44')](handleError(_0x4afcd1,null));};exports[_0x9e09('0x48')]=function(_0x41ef06,_0x5e5f09){return db[_0x9e09('0x2b')][_0x9e09('0x48')](_0x41ef06['body'],{})[_0x9e09('0x24')](respondWithResult(_0x5e5f09,0xc9))[_0x9e09('0x44')](handleError(_0x5e5f09,null));};exports[_0x9e09('0x23')]=function(_0x28dac7,_0x422128){if(_0x28dac7[_0x9e09('0x49')]['id']){delete _0x28dac7['body']['id'];}return db[_0x9e09('0x2b')][_0x9e09('0x47')]({'where':{'id':_0x28dac7[_0x9e09('0x46')]['id']}})[_0x9e09('0x24')](handleEntityNotFound(_0x422128,null))[_0x9e09('0x24')](saveUpdates(_0x28dac7['body'],null))[_0x9e09('0x24')](respondWithResult(_0x422128,null))[_0x9e09('0x44')](handleError(_0x422128,null));};exports[_0x9e09('0x4a')]=function(_0x2f878a,_0x88c645){return db[_0x9e09('0x2b')][_0x9e09('0x47')]({'where':{'id':_0x2f878a[_0x9e09('0x46')]['id']}})[_0x9e09('0x24')](handleEntityNotFound(_0x88c645,null))['then'](removeEntity(_0x88c645,null))[_0x9e09('0x44')](handleError(_0x88c645,null));};exports[_0x9e09('0x4b')]=function(_0x430640,_0x1bb9ed){return db[_0x9e09('0x2b')]['describe']()['then'](respondWithResult(_0x1bb9ed,null))[_0x9e09('0x44')](handleError(_0x1bb9ed,null));}; \ No newline at end of file +var _0x3e19=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3e19,0x1ec));var _0x93e1=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0x3e19[_0x4067ac];return _0x53d74d;};'use strict';var emlformat=require(_0x93e1('0x0'));var rimraf=require(_0x93e1('0x1'));var zipdir=require(_0x93e1('0x2'));var jsonpatch=require(_0x93e1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x93e1('0x4'));var Mustache=require(_0x93e1('0x5'));var util=require(_0x93e1('0x6'));var path=require(_0x93e1('0x7'));var sox=require(_0x93e1('0x8'));var csv=require(_0x93e1('0x9'));var ejs=require(_0x93e1('0xa'));var fs=require('fs');var fs_extra=require(_0x93e1('0xb'));var _=require(_0x93e1('0xc'));var squel=require(_0x93e1('0xd'));var crypto=require(_0x93e1('0xe'));var jsforce=require(_0x93e1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x93e1('0x9'));var querystring=require('querystring');var Papa=require(_0x93e1('0x10'));var Redis=require(_0x93e1('0x11'));var authService=require(_0x93e1('0x12'));var qs=require(_0x93e1('0x13'));var as=require(_0x93e1('0x14'));var hardwareService=require(_0x93e1('0x15'));var logger=require('../../config/logger')(_0x93e1('0x16'));var utils=require('../../config/utils');var config=require(_0x93e1('0x17'));var licenseUtil=require(_0x93e1('0x18'));var db=require(_0x93e1('0x19'))['db'];function respondWithStatusCode(_0x137d8f,_0x4cfadb){_0x4cfadb=_0x4cfadb||0xcc;return function(_0x30ad08){if(_0x30ad08){return _0x137d8f[_0x93e1('0x1a')](_0x4cfadb);}return _0x137d8f[_0x93e1('0x1b')](_0x4cfadb)['end']();};}function respondWithResult(_0x44b8db,_0x25dc76){_0x25dc76=_0x25dc76||0xc8;return function(_0x49e116){if(_0x49e116){return _0x44b8db[_0x93e1('0x1b')](_0x25dc76)[_0x93e1('0x1c')](_0x49e116);}};}function respondWithFilteredResult(_0x508a25,_0x1048c6){return function(_0x267c68){if(_0x267c68){var _0x1ff787=typeof _0x1048c6[_0x93e1('0x1d')]==='undefined'&&typeof _0x1048c6[_0x93e1('0x1e')]==='undefined';var _0x17bd28=_0x267c68[_0x93e1('0x1f')];var _0x27306c=_0x1ff787?0x0:_0x1048c6['offset'];var _0x397527=_0x1ff787?_0x267c68['count']:_0x1048c6['offset']+_0x1048c6[_0x93e1('0x1e')];var _0x49bbef;if(_0x397527>=_0x17bd28){_0x397527=_0x17bd28;_0x49bbef=0xc8;}else{_0x49bbef=0xce;}_0x508a25[_0x93e1('0x1b')](_0x49bbef);return _0x508a25[_0x93e1('0x20')](_0x93e1('0x21'),_0x27306c+'-'+_0x397527+'/'+_0x17bd28)[_0x93e1('0x1c')](_0x267c68);}return null;};}function patchUpdates(_0x79a90d){return function(_0x58e5e4){try{jsonpatch['apply'](_0x58e5e4,_0x79a90d,!![]);}catch(_0x284e6a){return BPromise[_0x93e1('0x22')](_0x284e6a);}return _0x58e5e4[_0x93e1('0x23')]();};}function saveUpdates(_0x1fa08a,_0x71e481){return function(_0x403678){if(_0x403678){return _0x403678['update'](_0x1fa08a)[_0x93e1('0x24')](function(_0x38a0b4){return _0x38a0b4;});}return null;};}function removeEntity(_0x56898f,_0x1a2a0e){return function(_0x524055){if(_0x524055){return _0x524055[_0x93e1('0x25')]()[_0x93e1('0x24')](function(){_0x56898f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x217f5c,_0x3ebbab){return function(_0x5ec4ce){if(!_0x5ec4ce){_0x217f5c['sendStatus'](0x194);}return _0x5ec4ce;};}function handleError(_0x1f18f5,_0x1afd44){_0x1afd44=_0x1afd44||0x1f4;return function(_0x21ea90){logger[_0x93e1('0x26')](_0x21ea90[_0x93e1('0x27')]);if(_0x21ea90['name']){delete _0x21ea90[_0x93e1('0x28')];}_0x1f18f5[_0x93e1('0x1b')](_0x1afd44)['send'](_0x21ea90);};}exports[_0x93e1('0x29')]=function(_0x308650,_0x4497c0){var _0x1935c3={},_0x5863d9={},_0x51a011={'count':0x0,'rows':[]};var _0x5d6e68=_['map'](db['MailTransferReport'][_0x93e1('0x2a')],function(_0x31cbcc){return{'name':_0x31cbcc[_0x93e1('0x2b')],'type':_0x31cbcc[_0x93e1('0x2c')][_0x93e1('0x2d')]};});_0x5863d9[_0x93e1('0x2e')]=_['map'](_0x5d6e68,'name');_0x5863d9[_0x93e1('0x2f')]=_[_0x93e1('0x30')](_0x308650['query']);_0x5863d9[_0x93e1('0x31')]=_[_0x93e1('0x32')](_0x5863d9['model'],_0x5863d9[_0x93e1('0x2f')]);_0x1935c3['attributes']=_[_0x93e1('0x32')](_0x5863d9[_0x93e1('0x2e')],qs['fields'](_0x308650[_0x93e1('0x2f')][_0x93e1('0x33')]));_0x1935c3['attributes']=_0x1935c3['attributes'][_0x93e1('0x34')]?_0x1935c3[_0x93e1('0x35')]:_0x5863d9[_0x93e1('0x2e')];if(!_0x308650[_0x93e1('0x2f')][_0x93e1('0x36')](_0x93e1('0x37'))){_0x1935c3[_0x93e1('0x1e')]=qs[_0x93e1('0x1e')](_0x308650[_0x93e1('0x2f')][_0x93e1('0x1e')]);_0x1935c3[_0x93e1('0x1d')]=qs[_0x93e1('0x1d')](_0x308650[_0x93e1('0x2f')][_0x93e1('0x1d')]);}_0x1935c3[_0x93e1('0x38')]=qs[_0x93e1('0x39')](_0x308650['query']['sort']);_0x1935c3['where']=qs['filters'](_[_0x93e1('0x3a')](_0x308650[_0x93e1('0x2f')],_0x5863d9[_0x93e1('0x31')]),_0x5d6e68);if(_0x308650[_0x93e1('0x2f')][_0x93e1('0x3b')]){_0x1935c3[_0x93e1('0x3c')]=_[_0x93e1('0x3d')](_0x1935c3[_0x93e1('0x3c')],{'$or':_[_0x93e1('0x3e')](_0x5d6e68,function(_0x3eda49){if(_0x3eda49[_0x93e1('0x2c')]!==_0x93e1('0x3f')){var _0x2fd574={};_0x2fd574[_0x3eda49['name']]={'$like':'%'+_0x308650['query'][_0x93e1('0x3b')]+'%'};return _0x2fd574;}})});}_0x1935c3=_[_0x93e1('0x3d')]({},_0x1935c3,_0x308650[_0x93e1('0x40')]);var _0x37b8b1={'where':_0x1935c3[_0x93e1('0x3c')]};return db[_0x93e1('0x41')][_0x93e1('0x1f')](_0x37b8b1)[_0x93e1('0x24')](function(_0x54db2b){_0x51a011['count']=_0x54db2b;if(_0x308650[_0x93e1('0x2f')][_0x93e1('0x42')]){_0x1935c3[_0x93e1('0x43')]=[{'all':!![]}];}return db[_0x93e1('0x41')][_0x93e1('0x44')](_0x1935c3);})['then'](function(_0x574982){_0x51a011[_0x93e1('0x45')]=_0x574982;return _0x51a011;})['then'](respondWithFilteredResult(_0x4497c0,_0x1935c3))[_0x93e1('0x46')](handleError(_0x4497c0,null));};exports[_0x93e1('0x47')]=function(_0x159dca,_0x2fb988){var _0x51295a={'raw':!![],'where':{'id':_0x159dca['params']['id']}},_0x7a2f0d={};_0x7a2f0d[_0x93e1('0x2e')]=_['keys'](db[_0x93e1('0x41')]['rawAttributes']);_0x7a2f0d[_0x93e1('0x2f')]=_['keys'](_0x159dca[_0x93e1('0x2f')]);_0x7a2f0d['filters']=_[_0x93e1('0x32')](_0x7a2f0d[_0x93e1('0x2e')],_0x7a2f0d['query']);_0x51295a[_0x93e1('0x35')]=_[_0x93e1('0x32')](_0x7a2f0d[_0x93e1('0x2e')],qs[_0x93e1('0x33')](_0x159dca['query']['fields']));_0x51295a['attributes']=_0x51295a[_0x93e1('0x35')][_0x93e1('0x34')]?_0x51295a[_0x93e1('0x35')]:_0x7a2f0d['model'];if(_0x159dca[_0x93e1('0x2f')]['includeAll']){_0x51295a[_0x93e1('0x43')]=[{'all':!![]}];}_0x51295a=_[_0x93e1('0x3d')]({},_0x51295a,_0x159dca[_0x93e1('0x40')]);return db['MailTransferReport']['find'](_0x51295a)[_0x93e1('0x24')](handleEntityNotFound(_0x2fb988,null))['then'](respondWithResult(_0x2fb988,null))[_0x93e1('0x46')](handleError(_0x2fb988,null));};exports['create']=function(_0x435ec1,_0x41644d){return db[_0x93e1('0x41')][_0x93e1('0x48')](_0x435ec1[_0x93e1('0x49')],{})['then'](respondWithResult(_0x41644d,0xc9))[_0x93e1('0x46')](handleError(_0x41644d,null));};exports[_0x93e1('0x4a')]=function(_0x123e45,_0xe81004){if(_0x123e45[_0x93e1('0x49')]['id']){delete _0x123e45[_0x93e1('0x49')]['id'];}return db[_0x93e1('0x41')][_0x93e1('0x4b')]({'where':{'id':_0x123e45[_0x93e1('0x4c')]['id']}})[_0x93e1('0x24')](handleEntityNotFound(_0xe81004,null))[_0x93e1('0x24')](saveUpdates(_0x123e45[_0x93e1('0x49')],null))['then'](respondWithResult(_0xe81004,null))[_0x93e1('0x46')](handleError(_0xe81004,null));};exports[_0x93e1('0x25')]=function(_0x1fb009,_0x125387){return db[_0x93e1('0x41')]['find']({'where':{'id':_0x1fb009[_0x93e1('0x4c')]['id']}})[_0x93e1('0x24')](handleEntityNotFound(_0x125387,null))['then'](removeEntity(_0x125387,null))[_0x93e1('0x46')](handleError(_0x125387,null));};exports[_0x93e1('0x4d')]=function(_0x23ed4d,_0x3adf14){return db['MailTransferReport'][_0x93e1('0x4d')]()[_0x93e1('0x24')](respondWithResult(_0x3adf14,null))[_0x93e1('0x46')](handleError(_0x3adf14,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 7b6a8c0..25e8e13 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 _0x80d9=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0xdb3813,_0x3af352){var _0x47e29f=function(_0x4077fa){while(--_0x4077fa){_0xdb3813['push'](_0xdb3813['shift']());}};_0x47e29f(++_0x3af352);}(_0x80d9,0x15c));var _0x980d=function(_0x278bfa,_0xd3eb7f){_0x278bfa=_0x278bfa-0x0;var _0x819e56=_0x80d9[_0x278bfa];return _0x819e56;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('MailTransferReport',attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[{'name':_0x980d('0xa'),'fields':[_0x980d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xadb8=['path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','../../config/logger','moment','bluebird','request-promise'];(function(_0x3513a0,_0x3bdc88){var _0x2bdeb9=function(_0x37f06d){while(--_0x37f06d){_0x3513a0['push'](_0x3513a0['shift']());}};_0x2bdeb9(++_0x3bdc88);}(_0xadb8,0x1d0));var _0x8adb=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xadb8[_0x5e42a7];return _0x36d21b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));module['exports']=function(_0x15bc63,_0x1a5f36){return _0x15bc63[_0x8adb('0x8')](_0x8adb('0x9'),attributes,{'tableName':_0x8adb('0xa'),'paranoid':![],'indexes':[{'name':_0x8adb('0xb'),'fields':[_0x8adb('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 bea7421..0b9cb04 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 _0x719b=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\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','jayson/promise','client','request'];(function(_0x44737b,_0x116026){var _0x139a9a=function(_0x9bedbf){while(--_0x9bedbf){_0x44737b['push'](_0x44737b['shift']());}};_0x139a9a(++_0x116026);}(_0x719b,0x173));var _0xb719=function(_0x5dde61,_0x48d7d1){_0x5dde61=_0x5dde61-0x0;var _0x283467=_0x719b[_0x5dde61];return _0x283467;};'use strict';var _=require(_0xb719('0x0'));var util=require(_0xb719('0x1'));var moment=require(_0xb719('0x2'));var BPromise=require(_0xb719('0x3'));var rs=require(_0xb719('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb719('0x5'))['db'];var utils=require(_0xb719('0x6'));var logger=require(_0xb719('0x7'))(_0xb719('0x8'));var config=require(_0xb719('0x9'));var jayson=require(_0xb719('0xa'));var client=jayson[_0xb719('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc9d774,_0xb2fe74,_0x21b3f1){return new BPromise(function(_0x1b1c03,_0x48f7cc){return client[_0xb719('0xc')](_0xc9d774,_0x21b3f1)['then'](function(_0x50927b){logger[_0xb719('0xd')](_0xb719('0xe'),_0xb2fe74,_0xb719('0xf'));logger[_0xb719('0x10')](_0xb719('0x11'),_0xb2fe74,_0xb719('0xf'),JSON[_0xb719('0x12')](_0x50927b));if(_0x50927b['error']){if(_0x50927b['error'][_0xb719('0x13')]===0x1f4){logger[_0xb719('0x14')](_0xb719('0xe'),_0xb2fe74,_0x50927b[_0xb719('0x14')]['message']);return _0x48f7cc(_0x50927b[_0xb719('0x14')][_0xb719('0x15')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0xb2fe74,_0x50927b[_0xb719('0x14')][_0xb719('0x15')]);return _0x1b1c03(_0x50927b[_0xb719('0x14')][_0xb719('0x15')]);}else{logger['info'](_0xb719('0xe'),_0xb2fe74,'request\x20sent');_0x1b1c03(_0x50927b[_0xb719('0x16')][_0xb719('0x15')]);}})[_0xb719('0x17')](function(_0x1e8635){logger[_0xb719('0x14')]('MailTransferReport,\x20%s,\x20%s',_0xb2fe74,_0x1e8635);_0x48f7cc(_0x1e8635);});});} \ No newline at end of file +var _0xf2fe=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailTransferReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x32e2c1,_0xea6557){var _0x229608=function(_0x176872){while(--_0x176872){_0x32e2c1['push'](_0x32e2c1['shift']());}};_0x229608(++_0xea6557);}(_0xf2fe,0x117));var _0xef2f=function(_0xb59f03,_0x33df92){_0xb59f03=_0xb59f03-0x0;var _0x4069e9=_0xf2fe[_0xb59f03];return _0x4069e9;};'use strict';var _=require(_0xef2f('0x0'));var util=require(_0xef2f('0x1'));var moment=require('moment');var BPromise=require(_0xef2f('0x2'));var rs=require(_0xef2f('0x3'));var fs=require('fs');var Redis=require(_0xef2f('0x4'));var db=require(_0xef2f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xef2f('0x6'));var config=require(_0xef2f('0x7'));var jayson=require(_0xef2f('0x8'));var client=jayson[_0xef2f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58590b,_0x293049,_0x385e32){return new BPromise(function(_0x4637f6,_0x5afa27){return client[_0xef2f('0xa')](_0x58590b,_0x385e32)[_0xef2f('0xb')](function(_0x51deba){logger[_0xef2f('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x293049,_0xef2f('0xd'));logger['debug'](_0xef2f('0xe'),_0x293049,_0xef2f('0xd'),JSON[_0xef2f('0xf')](_0x51deba));if(_0x51deba[_0xef2f('0x10')]){if(_0x51deba[_0xef2f('0x10')][_0xef2f('0x11')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x293049,_0x51deba[_0xef2f('0x10')][_0xef2f('0x12')]);return _0x5afa27(_0x51deba[_0xef2f('0x10')][_0xef2f('0x12')]);}logger[_0xef2f('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x293049,_0x51deba[_0xef2f('0x10')][_0xef2f('0x12')]);return _0x4637f6(_0x51deba[_0xef2f('0x10')][_0xef2f('0x12')]);}else{logger[_0xef2f('0xc')](_0xef2f('0x13'),_0x293049,_0xef2f('0xd'));_0x4637f6(_0x51deba[_0xef2f('0x14')][_0xef2f('0x12')]);}})[_0xef2f('0x15')](function(_0x30b3ef){logger[_0xef2f('0x10')](_0xef2f('0x13'),_0x293049,_0x30b3ef);_0x5afa27(_0x30b3ef);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 846a14a..ae75943 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 _0x6dae=['delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x2ec86d,_0x20bf38){var _0xdc538e=function(_0x34035e){while(--_0x34035e){_0x2ec86d['push'](_0x2ec86d['shift']());}};_0xdc538e(++_0x20bf38);}(_0x6dae,0x1e1));var _0xe6da=function(_0x36a3af,_0x13b630){_0x36a3af=_0x36a3af-0x0;var _0xa65201=_0x6dae[_0x36a3af];return _0xa65201;};'use strict';var multer=require(_0xe6da('0x0'));var util=require('util');var path=require(_0xe6da('0x1'));var timeout=require(_0xe6da('0x2'));var express=require(_0xe6da('0x3'));var router=express[_0xe6da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe6da('0x5'));var interaction=require(_0xe6da('0x6'));var config=require(_0xe6da('0x7'));var controller=require(_0xe6da('0x8'));router[_0xe6da('0x9')]('/',auth[_0xe6da('0xa')](),controller[_0xe6da('0xb')]);router[_0xe6da('0x9')](_0xe6da('0xc'),auth[_0xe6da('0xa')](),controller[_0xe6da('0xd')]);router[_0xe6da('0x9')](_0xe6da('0xe'),auth[_0xe6da('0xa')](),controller['show']);router[_0xe6da('0xf')]('/',auth[_0xe6da('0xa')](),controller[_0xe6da('0x10')]);router[_0xe6da('0x11')](_0xe6da('0xe'),auth[_0xe6da('0xa')](),controller[_0xe6da('0x12')]);router[_0xe6da('0x13')](_0xe6da('0xe'),auth[_0xe6da('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd99f=['fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','connect-timeout','Router'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0xd99f,0x176));var _0xfd99=function(_0x4d48ed,_0x14f6ee){_0x4d48ed=_0x4d48ed-0x0;var _0x2115f4=_0xd99f[_0x4d48ed];return _0x2115f4;};'use strict';var multer=require(_0xfd99('0x0'));var util=require(_0xfd99('0x1'));var path=require('path');var timeout=require(_0xfd99('0x2'));var express=require('express');var router=express[_0xfd99('0x3')]();var fs_extra=require(_0xfd99('0x4'));var auth=require(_0xfd99('0x5'));var interaction=require(_0xfd99('0x6'));var config=require('../../config/environment');var controller=require(_0xfd99('0x7'));router[_0xfd99('0x8')]('/',auth[_0xfd99('0x9')](),controller[_0xfd99('0xa')]);router[_0xfd99('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xfd99('0xb'),auth[_0xfd99('0x9')](),controller[_0xfd99('0xc')]);router[_0xfd99('0xd')]('/',auth['isAuthenticated'](),controller[_0xfd99('0xe')]);router[_0xfd99('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xfd99('0x10')]);router['delete'](_0xfd99('0xb'),auth['isAuthenticated'](),controller[_0xfd99('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9b6a989..33beea1 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 _0x9fa6=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9fa6,0x158));var _0x69fa=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x9fa6[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x69fa('0x0'));module[_0x69fa('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x69fa('0x2')]},'interface':{'type':Sequelize[_0x69fa('0x2')]},'type':{'type':Sequelize[_0x69fa('0x2')],'defaultValue':_0x69fa('0x3'),'comment':_0x69fa('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x69fa('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x429de7){var _0x6036e3=moment(_0x429de7);var _0x1721b4=moment(this[_0x69fa('0x6')](_0x69fa('0x7')));var _0x485ebb=_0x6036e3[_0x69fa('0x8')](_0x1721b4,_0x69fa('0x9'));this[_0x69fa('0xa')](_0x69fa('0xb'),_0x429de7);this[_0x69fa('0xa')](_0x69fa('0xc'),_0x485ebb>=0x0?_0x485ebb:null);}},'data1':{'type':Sequelize[_0x69fa('0x2')],'comment':_0x69fa('0xd')},'data2':{'type':Sequelize[_0x69fa('0x2')],'comment':_0x69fa('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0x69fa('0xf')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x69fa('0x2')],'comment':_0x69fa('0x10')},'role':{'type':Sequelize[_0x69fa('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x69fa('0x2')]}}; \ No newline at end of file +var _0xa59f=['DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xa59f,0xcb));var _0xfa59=function(_0x1e4883,_0x4e5f9e){_0x1e4883=_0x1e4883-0x0;var _0x369b8a=_0xa59f[_0x1e4883];return _0x369b8a;};'use strict';var Sequelize=require(_0xfa59('0x0'));var moment=require(_0xfa59('0x1'));module[_0xfa59('0x2')]={'channel':{'type':Sequelize[_0xfa59('0x3')]},'membername':{'type':Sequelize[_0xfa59('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xfa59('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xfa59('0x5')]},'enterAt':{'type':Sequelize[_0xfa59('0x6')]},'exitAt':{'type':Sequelize[_0xfa59('0x6')],'set':function(_0x278859){var _0xbe423c=moment(_0x278859);var _0x5c3ad4=moment(this[_0xfa59('0x7')](_0xfa59('0x8')));var _0x1b2659=_0xbe423c[_0xfa59('0x9')](_0x5c3ad4,_0xfa59('0xa'));this[_0xfa59('0xb')](_0xfa59('0xc'),_0x278859);this['setDataValue'](_0xfa59('0xd'),_0x1b2659>=0x0?_0x1b2659:null);}},'data1':{'type':Sequelize[_0xfa59('0x3')],'comment':_0xfa59('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xfa59('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0xfa59('0x10')},'data4':{'type':Sequelize[_0xfa59('0x3')],'comment':_0xfa59('0x11')},'data5':{'type':Sequelize[_0xfa59('0x3')],'comment':_0xfa59('0x12')},'role':{'type':Sequelize[_0xfa59('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xfa59('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0adecde..cee8941 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x18f661,_0x2ae691){var _0x1a198b=function(_0x92bad8){while(--_0x92bad8){_0x18f661['push'](_0x18f661['shift']());}};_0x1a198b(++_0x2ae691);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x100ee3,_0x7acbd2){var _0x539cbe=function(_0x26f733){while(--_0x26f733){_0x100ee3['push'](_0x100ee3['shift']());}};_0x539cbe(++_0x7acbd2);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 909dde2..88736a2 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 _0x47b3=['report_member','membername_interface','interface','util','../../config/logger','bluebird','path','rimraf','./memberReport.attributes','exports','define','MemberReport'];(function(_0x5214b0,_0x546abd){var _0x58af72=function(_0x3ef9ca){while(--_0x3ef9ca){_0x5214b0['push'](_0x5214b0['shift']());}};_0x58af72(++_0x546abd);}(_0x47b3,0x153));var _0x347b=function(_0x1d3e81,_0x290745){_0x1d3e81=_0x1d3e81-0x0;var _0x26b05b=_0x47b3[_0x1d3e81];return _0x26b05b;};'use strict';var _=require('lodash');var util=require(_0x347b('0x0'));var logger=require(_0x347b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x347b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x347b('0x3'));var rimraf=require(_0x347b('0x4'));var config=require('../../config/environment');var attributes=require(_0x347b('0x5'));module[_0x347b('0x6')]=function(_0x2b9d8e,_0x1b4b63){return _0x2b9d8e[_0x347b('0x7')](_0x347b('0x8'),attributes,{'tableName':_0x347b('0x9'),'paranoid':![],'indexes':[{'name':_0x347b('0xa'),'fields':['membername',_0x347b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7019=['interface','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','MemberReport','report_member','membername_interface','membername'];(function(_0x53cf5a,_0x4fe8b7){var _0x9fbde2=function(_0x74eba1){while(--_0x74eba1){_0x53cf5a['push'](_0x53cf5a['shift']());}};_0x9fbde2(++_0x4fe8b7);}(_0x7019,0x16d));var _0x9701=function(_0x16cf0e,_0x10ca47){_0x16cf0e=_0x16cf0e-0x0;var _0x4657f5=_0x7019[_0x16cf0e];return _0x4657f5;};'use strict';var _=require(_0x9701('0x0'));var util=require('util');var logger=require(_0x9701('0x1'))(_0x9701('0x2'));var moment=require('moment');var BPromise=require(_0x9701('0x3'));var rp=require(_0x9701('0x4'));var fs=require('fs');var path=require(_0x9701('0x5'));var rimraf=require(_0x9701('0x6'));var config=require(_0x9701('0x7'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x5dc3e4,_0x3ac395){return _0x5dc3e4[_0x9701('0x8')](_0x9701('0x9'),attributes,{'tableName':_0x9701('0xa'),'paranoid':![],'indexes':[{'name':_0x9701('0xb'),'fields':[_0x9701('0xc'),_0x9701('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 947ac18..194230d 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 _0x34f2=['GetMemberReport','MemberReport','findAll','options','raw','where','include','map','model','attributes','info','stringify','CreateMemberReport','create','body','UpdateMemberReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x358a65,_0x4f8b73){var _0xeacb3a=function(_0x10be33){while(--_0x10be33){_0x358a65['push'](_0x358a65['shift']());}};_0xeacb3a(++_0x4f8b73);}(_0x34f2,0x15a));var _0x234f=function(_0x4545fd,_0x493068){_0x4545fd=_0x4545fd-0x0;var _0x162cab=_0x34f2[_0x4545fd];return _0x162cab;};'use strict';var _=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var moment=require('moment');var BPromise=require(_0x234f('0x2'));var rs=require(_0x234f('0x3'));var fs=require('fs');var Redis=require(_0x234f('0x4'));var db=require(_0x234f('0x5'))['db'];var utils=require(_0x234f('0x6'));var logger=require(_0x234f('0x7'))(_0x234f('0x8'));var config=require(_0x234f('0x9'));var jayson=require(_0x234f('0xa'));var client=jayson[_0x234f('0xb')][_0x234f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x254f37,_0x3aaf6c,_0x477918){return new BPromise(function(_0x691793,_0x514588){return client[_0x234f('0xd')](_0x254f37,_0x477918)[_0x234f('0xe')](function(_0x5d9661){logger['info'](_0x234f('0xf'),_0x3aaf6c,_0x234f('0x10'));logger[_0x234f('0x11')](_0x234f('0x12'),_0x3aaf6c,_0x234f('0x10'),JSON['stringify'](_0x5d9661));if(_0x5d9661[_0x234f('0x13')]){if(_0x5d9661[_0x234f('0x13')][_0x234f('0x14')]===0x1f4){logger[_0x234f('0x13')]('MemberReport,\x20%s,\x20%s',_0x3aaf6c,_0x5d9661[_0x234f('0x13')]['message']);return _0x514588(_0x5d9661[_0x234f('0x13')][_0x234f('0x15')]);}logger[_0x234f('0x13')](_0x234f('0xf'),_0x3aaf6c,_0x5d9661[_0x234f('0x13')][_0x234f('0x15')]);return _0x691793(_0x5d9661[_0x234f('0x13')]['message']);}else{logger['info'](_0x234f('0xf'),_0x3aaf6c,_0x234f('0x10'));_0x691793(_0x5d9661['result'][_0x234f('0x15')]);}})[_0x234f('0x16')](function(_0x228dcc){logger[_0x234f('0x13')](_0x234f('0xf'),_0x3aaf6c,_0x228dcc);_0x514588(_0x228dcc);});});}exports[_0x234f('0x17')]=function(_0x144ea0){var _0x2ce5e1=this;return new Promise(function(_0x77399f,_0x5892e0){return db[_0x234f('0x18')][_0x234f('0x19')]({'raw':_0x144ea0[_0x234f('0x1a')]?_0x144ea0[_0x234f('0x1a')][_0x234f('0x1b')]===undefined?!![]:![]:!![],'where':_0x144ea0[_0x234f('0x1a')]?_0x144ea0[_0x234f('0x1a')][_0x234f('0x1c')]||null:null,'attributes':_0x144ea0[_0x234f('0x1a')]?_0x144ea0['options']['attributes']||null:null,'limit':_0x144ea0[_0x234f('0x1a')]?_0x144ea0[_0x234f('0x1a')]['limit']||null:null,'include':_0x144ea0[_0x234f('0x1a')]?_0x144ea0['options'][_0x234f('0x1d')]?_[_0x234f('0x1e')](_0x144ea0[_0x234f('0x1a')][_0x234f('0x1d')],function(_0x34cc19){return{'model':db[_0x34cc19[_0x234f('0x1f')]],'as':_0x34cc19['as'],'attributes':_0x34cc19[_0x234f('0x20')],'include':_0x34cc19[_0x234f('0x1d')]?_[_0x234f('0x1e')](_0x34cc19[_0x234f('0x1d')],function(_0x758e8d){return{'model':db[_0x758e8d[_0x234f('0x1f')]],'as':_0x758e8d['as'],'attributes':_0x758e8d[_0x234f('0x20')],'include':_0x758e8d[_0x234f('0x1d')]?_[_0x234f('0x1e')](_0x758e8d[_0x234f('0x1d')],function(_0x2b6641){return{'model':db[_0x2b6641[_0x234f('0x1f')]],'as':_0x2b6641['as'],'attributes':_0x2b6641[_0x234f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x234f('0xe')](function(_0xf16a84){logger[_0x234f('0x21')](_0x234f('0x17'),_0x144ea0);logger['debug'](_0x234f('0x17'),_0x144ea0,JSON[_0x234f('0x22')](_0xf16a84));_0x77399f(_0xf16a84);})[_0x234f('0x16')](function(_0x2522b1){logger[_0x234f('0x13')](_0x234f('0x17'),_0x2522b1[_0x234f('0x15')],_0x144ea0);_0x5892e0(_0x2ce5e1[_0x234f('0x13')](0x1f4,_0x2522b1[_0x234f('0x15')]));});});};exports[_0x234f('0x23')]=function(_0x5ecf4e){var _0x3eb02e=this;return new Promise(function(_0x5e6013,_0x193dc9){return db[_0x234f('0x18')][_0x234f('0x24')](_0x5ecf4e[_0x234f('0x25')],{'raw':_0x5ecf4e['options']?_0x5ecf4e[_0x234f('0x1a')][_0x234f('0x1b')]===undefined?!![]:![]:!![]})[_0x234f('0xe')](function(_0x4b1198){logger['info'](_0x234f('0x23'),_0x5ecf4e);logger[_0x234f('0x11')]('CreateMemberReport',_0x5ecf4e,JSON['stringify'](_0x4b1198));_0x5e6013(_0x4b1198);})[_0x234f('0x16')](function(_0x4bad3e){logger['error'](_0x234f('0x23'),_0x4bad3e['message'],_0x5ecf4e);_0x193dc9(_0x3eb02e[_0x234f('0x13')](0x1f4,_0x4bad3e[_0x234f('0x15')]));});});};exports[_0x234f('0x26')]=function(_0x1b1a56){var _0x266d62=this;return new Promise(function(_0x36c893,_0x8590f2){return db[_0x234f('0x18')][_0x234f('0x27')](_0x1b1a56['body'],{'raw':_0x1b1a56[_0x234f('0x1a')]?_0x1b1a56[_0x234f('0x1a')][_0x234f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b1a56[_0x234f('0x1a')]?_0x1b1a56[_0x234f('0x1a')][_0x234f('0x1c')]||null:null,'attributes':_0x1b1a56[_0x234f('0x1a')]?_0x1b1a56[_0x234f('0x1a')]['attributes']||null:null,'limit':_0x1b1a56[_0x234f('0x1a')]?_0x1b1a56[_0x234f('0x1a')][_0x234f('0x28')]||null:null})[_0x234f('0xe')](function(_0x5c125c){logger['info']('UpdateMemberReport',_0x1b1a56);logger[_0x234f('0x11')]('UpdateMemberReport',_0x1b1a56,JSON[_0x234f('0x22')](_0x5c125c));_0x36c893(_0x5c125c);})[_0x234f('0x16')](function(_0x348aad){logger[_0x234f('0x13')](_0x234f('0x26'),_0x348aad[_0x234f('0x15')],_0x1b1a56);_0x8590f2(_0x266d62[_0x234f('0x13')](0x1f4,_0x348aad[_0x234f('0x15')]));});});}; \ No newline at end of file +var _0x1a61=['http','request','then','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','request\x20sent','result','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','info','catch','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x14b7fd,_0x3dbae7){var _0x4ee25d=function(_0x4877ae){while(--_0x4877ae){_0x14b7fd['push'](_0x14b7fd['shift']());}};_0x4ee25d(++_0x3dbae7);}(_0x1a61,0x1e6));var _0x11a6=function(_0x52d311,_0x31dc70){_0x52d311=_0x52d311-0x0;var _0x26aee8=_0x1a61[_0x52d311];return _0x26aee8;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var moment=require(_0x11a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x11a6('0x2'));var fs=require('fs');var Redis=require(_0x11a6('0x3'));var db=require(_0x11a6('0x4'))['db'];var utils=require(_0x11a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x11a6('0x6'));var jayson=require(_0x11a6('0x7'));var client=jayson['client'][_0x11a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c4b31,_0x124855,_0x333ec2){return new BPromise(function(_0x1c67ce,_0x33b9b4){return client[_0x11a6('0x9')](_0x1c4b31,_0x333ec2)[_0x11a6('0xa')](function(_0x1a7d57){logger['info']('MemberReport,\x20%s,\x20%s',_0x124855,'request\x20sent');logger[_0x11a6('0xb')](_0x11a6('0xc'),_0x124855,'request\x20sent',JSON[_0x11a6('0xd')](_0x1a7d57));if(_0x1a7d57[_0x11a6('0xe')]){if(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0xf')]===0x1f4){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x1a7d57['error']['message']);return _0x33b9b4(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}logger['error'](_0x11a6('0x10'),_0x124855,_0x1a7d57[_0x11a6('0xe')]['message']);return _0x1c67ce(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}else{logger['info'](_0x11a6('0x10'),_0x124855,_0x11a6('0x12'));_0x1c67ce(_0x1a7d57[_0x11a6('0x13')][_0x11a6('0x11')]);}})['catch'](function(_0x3d6457){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x3d6457);_0x33b9b4(_0x3d6457);});});}exports[_0x11a6('0x14')]=function(_0x1a9d43){var _0x1e3cdd=this;return new Promise(function(_0x2449bf,_0x2d9721){return db[_0x11a6('0x15')][_0x11a6('0x16')]({'raw':_0x1a9d43[_0x11a6('0x17')]?_0x1a9d43[_0x11a6('0x17')][_0x11a6('0x18')]===undefined?!![]:![]:!![],'where':_0x1a9d43[_0x11a6('0x17')]?_0x1a9d43['options'][_0x11a6('0x19')]||null:null,'attributes':_0x1a9d43[_0x11a6('0x17')]?_0x1a9d43[_0x11a6('0x17')][_0x11a6('0x1a')]||null:null,'limit':_0x1a9d43['options']?_0x1a9d43['options'][_0x11a6('0x1b')]||null:null,'include':_0x1a9d43['options']?_0x1a9d43[_0x11a6('0x17')]['include']?_['map'](_0x1a9d43['options']['include'],function(_0x111a63){return{'model':db[_0x111a63['model']],'as':_0x111a63['as'],'attributes':_0x111a63[_0x11a6('0x1a')],'include':_0x111a63[_0x11a6('0x1c')]?_['map'](_0x111a63['include'],function(_0x2ffd7f){return{'model':db[_0x2ffd7f[_0x11a6('0x1d')]],'as':_0x2ffd7f['as'],'attributes':_0x2ffd7f[_0x11a6('0x1a')],'include':_0x2ffd7f[_0x11a6('0x1c')]?_[_0x11a6('0x1e')](_0x2ffd7f[_0x11a6('0x1c')],function(_0x40e3b4){return{'model':db[_0x40e3b4[_0x11a6('0x1d')]],'as':_0x40e3b4['as'],'attributes':_0x40e3b4[_0x11a6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x11a6('0xa')](function(_0x1ceb50){logger[_0x11a6('0x1f')](_0x11a6('0x14'),_0x1a9d43);logger[_0x11a6('0xb')](_0x11a6('0x14'),_0x1a9d43,JSON[_0x11a6('0xd')](_0x1ceb50));_0x2449bf(_0x1ceb50);})[_0x11a6('0x20')](function(_0x1b7f4e){logger[_0x11a6('0xe')](_0x11a6('0x14'),_0x1b7f4e[_0x11a6('0x11')],_0x1a9d43);_0x2d9721(_0x1e3cdd[_0x11a6('0xe')](0x1f4,_0x1b7f4e[_0x11a6('0x11')]));});});};exports[_0x11a6('0x21')]=function(_0x3827e3){var _0x56f74d=this;return new Promise(function(_0x3ff058,_0x56f3e9){return db[_0x11a6('0x15')][_0x11a6('0x22')](_0x3827e3[_0x11a6('0x23')],{'raw':_0x3827e3[_0x11a6('0x17')]?_0x3827e3[_0x11a6('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x11a6('0xa')](function(_0x3bc3d2){logger['info']('CreateMemberReport',_0x3827e3);logger['debug'](_0x11a6('0x21'),_0x3827e3,JSON[_0x11a6('0xd')](_0x3bc3d2));_0x3ff058(_0x3bc3d2);})['catch'](function(_0x3c24f3){logger[_0x11a6('0xe')](_0x11a6('0x21'),_0x3c24f3[_0x11a6('0x11')],_0x3827e3);_0x56f3e9(_0x56f74d[_0x11a6('0xe')](0x1f4,_0x3c24f3['message']));});});};exports[_0x11a6('0x24')]=function(_0x226546){var _0x46d825=this;return new Promise(function(_0x2449fb,_0x36c352){return db[_0x11a6('0x15')][_0x11a6('0x25')](_0x226546[_0x11a6('0x23')],{'raw':_0x226546[_0x11a6('0x17')]?_0x226546[_0x11a6('0x17')][_0x11a6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226546[_0x11a6('0x17')]?_0x226546[_0x11a6('0x17')]['where']||null:null,'attributes':_0x226546[_0x11a6('0x17')]?_0x226546[_0x11a6('0x17')][_0x11a6('0x1a')]||null:null,'limit':_0x226546[_0x11a6('0x17')]?_0x226546[_0x11a6('0x17')][_0x11a6('0x1b')]||null:null})[_0x11a6('0xa')](function(_0x3a89b8){logger[_0x11a6('0x1f')]('UpdateMemberReport',_0x226546);logger[_0x11a6('0xb')](_0x11a6('0x24'),_0x226546,JSON['stringify'](_0x3a89b8));_0x2449fb(_0x3a89b8);})[_0x11a6('0x20')](function(_0x745617){logger[_0x11a6('0xe')]('UpdateMemberReport',_0x745617[_0x11a6('0x11')],_0x226546);_0x36c352(_0x46d825[_0x11a6('0xe')](0x1f4,_0x745617['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1c32d56..605c655 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 _0xf098=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','util','path'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xf098,0x194));var _0x8f09=function(_0x21b475,_0x518fdb){_0x21b475=_0x21b475-0x0;var _0x5ac52c=_0xf098[_0x21b475];return _0x5ac52c;};'use strict';var multer=require(_0x8f09('0x0'));var util=require(_0x8f09('0x1'));var path=require(_0x8f09('0x2'));var timeout=require(_0x8f09('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8f09('0x4'));var auth=require(_0x8f09('0x5'));var interaction=require(_0x8f09('0x6'));var config=require('../../config/environment');var controller=require(_0x8f09('0x7'));router[_0x8f09('0x8')]('/',controller[_0x8f09('0x9')]);module[_0x8f09('0xa')]=router; \ No newline at end of file +var _0xd819=['get','index','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./migration.controller'];(function(_0x52e4bb,_0x5366ef){var _0x102a52=function(_0x462974){while(--_0x462974){_0x52e4bb['push'](_0x52e4bb['shift']());}};_0x102a52(++_0x5366ef);}(_0xd819,0x1d1));var _0x9d81=function(_0x294c1c,_0x567301){_0x294c1c=_0x294c1c-0x0;var _0x1e7943=_0xd819[_0x294c1c];return _0x1e7943;};'use strict';var multer=require(_0x9d81('0x0'));var util=require(_0x9d81('0x1'));var path=require(_0x9d81('0x2'));var timeout=require(_0x9d81('0x3'));var express=require('express');var router=express[_0x9d81('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d81('0x5'));var interaction=require(_0x9d81('0x6'));var config=require('../../config/environment');var controller=require(_0x9d81('0x7'));router[_0x9d81('0x8')]('/',controller[_0x9d81('0x9')]);module[_0x9d81('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 a80903e..87a01b6 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 _0x0e8a=['STRING','version','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0e8a,0x1de));var _0xa0e8=function(_0x18959e,_0x24e830){_0x18959e=_0x18959e-0x0;var _0x308aba=_0x0e8a[_0x18959e];return _0x308aba;};'use strict';var Sequelize=require(_0xa0e8('0x0'));module[_0xa0e8('0x1')]={'version':{'type':Sequelize[_0xa0e8('0x2')],'unique':_0xa0e8('0x3')}}; \ No newline at end of file +var _0x3ba7=['version','sequelize','exports','STRING'];(function(_0x1bd6be,_0x376584){var _0xd6e19a=function(_0x3225ea){while(--_0x3225ea){_0x1bd6be['push'](_0x1bd6be['shift']());}};_0xd6e19a(++_0x376584);}(_0x3ba7,0xb9));var _0x73ba=function(_0x3d4291,_0x1b9c51){_0x3d4291=_0x3d4291-0x0;var _0x2c0a3b=_0x3ba7[_0x3d4291];return _0x2c0a3b;};'use strict';var Sequelize=require(_0x73ba('0x0'));module[_0x73ba('0x1')]={'version':{'type':Sequelize[_0x73ba('0x2')],'unique':_0x73ba('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 0159d64..f79169c 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 _0xaf7e=['filter','merge','includeAll','findAll','rows','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','nolimit','sort','where','filters','pick','VIRTUAL'];(function(_0x5b5bed,_0xd9474c){var _0x57255f=function(_0x3b077b){while(--_0x3b077b){_0x5b5bed['push'](_0x5b5bed['shift']());}};_0x57255f(++_0xd9474c);}(_0xaf7e,0xb9));var _0xeaf7=function(_0x1e4977,_0x14aad9){_0x1e4977=_0x1e4977-0x0;var _0x18afd8=_0xaf7e[_0x1e4977];return _0x18afd8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeaf7('0x0'));var moment=require('moment');var BPromise=require(_0xeaf7('0x1'));var Mustache=require(_0xeaf7('0x2'));var util=require('util');var path=require(_0xeaf7('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeaf7('0x4'));var _=require(_0xeaf7('0x5'));var squel=require(_0xeaf7('0x6'));var crypto=require('crypto');var jsforce=require(_0xeaf7('0x7'));var deskjs=require(_0xeaf7('0x8'));var toCsv=require(_0xeaf7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeaf7('0xa'));var authService=require(_0xeaf7('0xb'));var qs=require(_0xeaf7('0xc'));var as=require(_0xeaf7('0xd'));var hardwareService=require(_0xeaf7('0xe'));var logger=require(_0xeaf7('0xf'))(_0xeaf7('0x10'));var utils=require(_0xeaf7('0x11'));var config=require(_0xeaf7('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xeaf7('0x13'))['db'];function respondWithStatusCode(_0x348c67,_0x3d02f0){_0x3d02f0=_0x3d02f0||0xcc;return function(_0x2cc185){if(_0x2cc185){return _0x348c67['sendStatus'](_0x3d02f0);}return _0x348c67[_0xeaf7('0x14')](_0x3d02f0)[_0xeaf7('0x15')]();};}function respondWithResult(_0x2e3678,_0x413caf){_0x413caf=_0x413caf||0xc8;return function(_0x546802){if(_0x546802){return _0x2e3678[_0xeaf7('0x14')](_0x413caf)['json'](_0x546802);}};}function respondWithFilteredResult(_0x18cbe2,_0xe64eaa){return function(_0x2fc5f7){if(_0x2fc5f7){var _0x369453=typeof _0xe64eaa[_0xeaf7('0x16')]==='undefined'&&typeof _0xe64eaa[_0xeaf7('0x17')]===_0xeaf7('0x18');var _0x2ae3c3=_0x2fc5f7['count'];var _0x4ef5c5=_0x369453?0x0:_0xe64eaa['offset'];var _0x36c4b8=_0x369453?_0x2fc5f7[_0xeaf7('0x19')]:_0xe64eaa[_0xeaf7('0x16')]+_0xe64eaa['limit'];var _0x218ba6;if(_0x36c4b8>=_0x2ae3c3){_0x36c4b8=_0x2ae3c3;_0x218ba6=0xc8;}else{_0x218ba6=0xce;}_0x18cbe2[_0xeaf7('0x14')](_0x218ba6);return _0x18cbe2[_0xeaf7('0x1a')](_0xeaf7('0x1b'),_0x4ef5c5+'-'+_0x36c4b8+'/'+_0x2ae3c3)[_0xeaf7('0x1c')](_0x2fc5f7);}return null;};}function patchUpdates(_0x17327d){return function(_0x1c3359){try{jsonpatch[_0xeaf7('0x1d')](_0x1c3359,_0x17327d,!![]);}catch(_0x50d770){return BPromise[_0xeaf7('0x1e')](_0x50d770);}return _0x1c3359[_0xeaf7('0x1f')]();};}function saveUpdates(_0x168649,_0xb05a0f){return function(_0xe06502){if(_0xe06502){return _0xe06502[_0xeaf7('0x20')](_0x168649)['then'](function(_0x5cbb44){return _0x5cbb44;});}return null;};}function removeEntity(_0x36d44d,_0x4ab839){return function(_0x5dd70f){if(_0x5dd70f){return _0x5dd70f[_0xeaf7('0x21')]()[_0xeaf7('0x22')](function(){_0x36d44d[_0xeaf7('0x14')](0xcc)[_0xeaf7('0x15')]();});}};}function handleEntityNotFound(_0x59b970,_0x284546){return function(_0x107d04){if(!_0x107d04){_0x59b970[_0xeaf7('0x23')](0x194);}return _0x107d04;};}function handleError(_0x118369,_0x255b24){_0x255b24=_0x255b24||0x1f4;return function(_0x59b804){logger[_0xeaf7('0x24')](_0x59b804[_0xeaf7('0x25')]);if(_0x59b804[_0xeaf7('0x26')]){delete _0x59b804['name'];}_0x118369['status'](_0x255b24)[_0xeaf7('0x27')](_0x59b804);};}exports['index']=function(_0x12af31,_0x2f0add){var _0x56f82={},_0x5ed605={},_0x36f6b9={'count':0x0,'rows':[]};var _0x358d27=_[_0xeaf7('0x28')](db['Migration']['rawAttributes'],function(_0x1c5e21){return{'name':_0x1c5e21[_0xeaf7('0x29')],'type':_0x1c5e21[_0xeaf7('0x2a')][_0xeaf7('0x2b')]};});_0x5ed605[_0xeaf7('0x2c')]=_[_0xeaf7('0x28')](_0x358d27,'name');_0x5ed605[_0xeaf7('0x2d')]=_[_0xeaf7('0x2e')](_0x12af31[_0xeaf7('0x2d')]);_0x5ed605['filters']=_[_0xeaf7('0x2f')](_0x5ed605[_0xeaf7('0x2c')],_0x5ed605[_0xeaf7('0x2d')]);_0x56f82[_0xeaf7('0x30')]=_[_0xeaf7('0x2f')](_0x5ed605[_0xeaf7('0x2c')],qs['fields'](_0x12af31['query']['fields']));_0x56f82[_0xeaf7('0x30')]=_0x56f82[_0xeaf7('0x30')]['length']?_0x56f82['attributes']:_0x5ed605['model'];if(!_0x12af31[_0xeaf7('0x2d')]['hasOwnProperty'](_0xeaf7('0x31'))){_0x56f82['limit']=qs['limit'](_0x12af31[_0xeaf7('0x2d')][_0xeaf7('0x17')]);_0x56f82[_0xeaf7('0x16')]=qs['offset'](_0x12af31[_0xeaf7('0x2d')]['offset']);}_0x56f82['order']=qs['sort'](_0x12af31['query'][_0xeaf7('0x32')]);_0x56f82[_0xeaf7('0x33')]=qs[_0xeaf7('0x34')](_[_0xeaf7('0x35')](_0x12af31[_0xeaf7('0x2d')],_0x5ed605[_0xeaf7('0x34')]),_0x358d27);if(_0x12af31['query']['filter']){_0x56f82['where']=_['merge'](_0x56f82[_0xeaf7('0x33')],{'$or':_[_0xeaf7('0x28')](_0x358d27,function(_0x16fe1d){if(_0x16fe1d['type']!==_0xeaf7('0x36')){var _0x157134={};_0x157134[_0x16fe1d[_0xeaf7('0x26')]]={'$like':'%'+_0x12af31['query'][_0xeaf7('0x37')]+'%'};return _0x157134;}})});}_0x56f82=_[_0xeaf7('0x38')]({},_0x56f82,_0x12af31['options']);var _0xa6c417={'where':_0x56f82['where']};return db['Migration']['count'](_0xa6c417)[_0xeaf7('0x22')](function(_0x6a78f0){_0x36f6b9[_0xeaf7('0x19')]=_0x6a78f0;if(_0x12af31['query'][_0xeaf7('0x39')]){_0x56f82['include']=[{'all':!![]}];}return db['Migration'][_0xeaf7('0x3a')](_0x56f82);})[_0xeaf7('0x22')](function(_0x475746){_0x36f6b9[_0xeaf7('0x3b')]=_0x475746;return _0x36f6b9;})[_0xeaf7('0x22')](respondWithFilteredResult(_0x2f0add,_0x56f82))['catch'](handleError(_0x2f0add,null));}; \ No newline at end of file +var _0x457f=['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','limit','count','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Migration','includeAll','findAll','rows','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x5a9826,_0x575e9d){var _0x23cbf0=function(_0x49ab18){while(--_0x49ab18){_0x5a9826['push'](_0x5a9826['shift']());}};_0x23cbf0(++_0x575e9d);}(_0x457f,0x10a));var _0xf457=function(_0x153ede,_0x378153){_0x153ede=_0x153ede-0x0;var _0x50498b=_0x457f[_0x153ede];return _0x50498b;};'use strict';var emlformat=require(_0xf457('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf457('0x1'));var jsonpatch=require(_0xf457('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf457('0x3'));var util=require(_0xf457('0x4'));var path=require(_0xf457('0x5'));var sox=require('sox');var csv=require(_0xf457('0x6'));var ejs=require(_0xf457('0x7'));var fs=require('fs');var fs_extra=require(_0xf457('0x8'));var _=require(_0xf457('0x9'));var squel=require(_0xf457('0xa'));var crypto=require(_0xf457('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf457('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf457('0xd'));var Papa=require(_0xf457('0xe'));var Redis=require(_0xf457('0xf'));var authService=require(_0xf457('0x10'));var qs=require(_0xf457('0x11'));var as=require(_0xf457('0x12'));var hardwareService=require(_0xf457('0x13'));var logger=require(_0xf457('0x14'))(_0xf457('0x15'));var utils=require(_0xf457('0x16'));var config=require(_0xf457('0x17'));var licenseUtil=require(_0xf457('0x18'));var db=require(_0xf457('0x19'))['db'];function respondWithStatusCode(_0x188f7d,_0x5767b6){_0x5767b6=_0x5767b6||0xcc;return function(_0x1014e2){if(_0x1014e2){return _0x188f7d[_0xf457('0x1a')](_0x5767b6);}return _0x188f7d[_0xf457('0x1b')](_0x5767b6)[_0xf457('0x1c')]();};}function respondWithResult(_0x1242da,_0xf18c05){_0xf18c05=_0xf18c05||0xc8;return function(_0x20de6c){if(_0x20de6c){return _0x1242da[_0xf457('0x1b')](_0xf18c05)['json'](_0x20de6c);}};}function respondWithFilteredResult(_0xf2ddc,_0x16c608){return function(_0x5ace7c){if(_0x5ace7c){var _0x131f25=typeof _0x16c608[_0xf457('0x1d')]==='undefined'&&typeof _0x16c608[_0xf457('0x1e')]==='undefined';var _0x579add=_0x5ace7c['count'];var _0x3231ee=_0x131f25?0x0:_0x16c608[_0xf457('0x1d')];var _0x44b5f2=_0x131f25?_0x5ace7c[_0xf457('0x1f')]:_0x16c608['offset']+_0x16c608[_0xf457('0x1e')];var _0x485de9;if(_0x44b5f2>=_0x579add){_0x44b5f2=_0x579add;_0x485de9=0xc8;}else{_0x485de9=0xce;}_0xf2ddc[_0xf457('0x1b')](_0x485de9);return _0xf2ddc['set'](_0xf457('0x20'),_0x3231ee+'-'+_0x44b5f2+'/'+_0x579add)['json'](_0x5ace7c);}return null;};}function patchUpdates(_0x10e601){return function(_0x43a597){try{jsonpatch[_0xf457('0x21')](_0x43a597,_0x10e601,!![]);}catch(_0x1e37a9){return BPromise[_0xf457('0x22')](_0x1e37a9);}return _0x43a597[_0xf457('0x23')]();};}function saveUpdates(_0x4b9fe7,_0x285e20){return function(_0x1b7e95){if(_0x1b7e95){return _0x1b7e95[_0xf457('0x24')](_0x4b9fe7)['then'](function(_0x192d9b){return _0x192d9b;});}return null;};}function removeEntity(_0x4616ca,_0x37fc1f){return function(_0x1ff395){if(_0x1ff395){return _0x1ff395[_0xf457('0x25')]()[_0xf457('0x26')](function(){_0x4616ca[_0xf457('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113d2f,_0x306e09){return function(_0x51e536){if(!_0x51e536){_0x113d2f['sendStatus'](0x194);}return _0x51e536;};}function handleError(_0xb684e8,_0x9294e6){_0x9294e6=_0x9294e6||0x1f4;return function(_0x199864){logger['error'](_0x199864[_0xf457('0x27')]);if(_0x199864[_0xf457('0x28')]){delete _0x199864[_0xf457('0x28')];}_0xb684e8[_0xf457('0x1b')](_0x9294e6)[_0xf457('0x29')](_0x199864);};}exports[_0xf457('0x2a')]=function(_0x4b7576,_0x1d1f1c){var _0x321cab={},_0x1d89e8={},_0x51fa7b={'count':0x0,'rows':[]};var _0x34c878=_[_0xf457('0x2b')](db['Migration'][_0xf457('0x2c')],function(_0x27c007){return{'name':_0x27c007[_0xf457('0x2d')],'type':_0x27c007[_0xf457('0x2e')][_0xf457('0x2f')]};});_0x1d89e8[_0xf457('0x30')]=_[_0xf457('0x2b')](_0x34c878,_0xf457('0x28'));_0x1d89e8['query']=_[_0xf457('0x31')](_0x4b7576[_0xf457('0x32')]);_0x1d89e8[_0xf457('0x33')]=_[_0xf457('0x34')](_0x1d89e8[_0xf457('0x30')],_0x1d89e8[_0xf457('0x32')]);_0x321cab[_0xf457('0x35')]=_['intersection'](_0x1d89e8[_0xf457('0x30')],qs['fields'](_0x4b7576[_0xf457('0x32')][_0xf457('0x36')]));_0x321cab[_0xf457('0x35')]=_0x321cab['attributes'][_0xf457('0x37')]?_0x321cab[_0xf457('0x35')]:_0x1d89e8[_0xf457('0x30')];if(!_0x4b7576[_0xf457('0x32')][_0xf457('0x38')](_0xf457('0x39'))){_0x321cab[_0xf457('0x1e')]=qs['limit'](_0x4b7576[_0xf457('0x32')][_0xf457('0x1e')]);_0x321cab[_0xf457('0x1d')]=qs[_0xf457('0x1d')](_0x4b7576['query'][_0xf457('0x1d')]);}_0x321cab['order']=qs[_0xf457('0x3a')](_0x4b7576['query'][_0xf457('0x3a')]);_0x321cab['where']=qs[_0xf457('0x33')](_[_0xf457('0x3b')](_0x4b7576[_0xf457('0x32')],_0x1d89e8[_0xf457('0x33')]),_0x34c878);if(_0x4b7576['query'][_0xf457('0x3c')]){_0x321cab[_0xf457('0x3d')]=_[_0xf457('0x3e')](_0x321cab[_0xf457('0x3d')],{'$or':_[_0xf457('0x2b')](_0x34c878,function(_0x254836){if(_0x254836[_0xf457('0x2e')]!==_0xf457('0x3f')){var _0x38a0e8={};_0x38a0e8[_0x254836[_0xf457('0x28')]]={'$like':'%'+_0x4b7576['query'][_0xf457('0x3c')]+'%'};return _0x38a0e8;}})});}_0x321cab=_[_0xf457('0x3e')]({},_0x321cab,_0x4b7576[_0xf457('0x40')]);var _0x127917={'where':_0x321cab['where']};return db[_0xf457('0x41')]['count'](_0x127917)[_0xf457('0x26')](function(_0x5b4236){_0x51fa7b[_0xf457('0x1f')]=_0x5b4236;if(_0x4b7576[_0xf457('0x32')][_0xf457('0x42')]){_0x321cab['include']=[{'all':!![]}];}return db['Migration'][_0xf457('0x43')](_0x321cab);})[_0xf457('0x26')](function(_0x4ac007){_0x51fa7b[_0xf457('0x44')]=_0x4ac007;return _0x51fa7b;})[_0xf457('0x26')](respondWithFilteredResult(_0x1d1f1c,_0x321cab))['catch'](handleError(_0x1d1f1c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 2a7bace..45d207a 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 _0xce89=['exports','define','Migration','util','moment','path','rimraf'];(function(_0x241119,_0x426e1e){var _0x417add=function(_0x45530a){while(--_0x45530a){_0x241119['push'](_0x241119['shift']());}};_0x417add(++_0x426e1e);}(_0xce89,0xb2));var _0x9ce8=function(_0x1dd907,_0x49e59f){_0x1dd907=_0x1dd907-0x0;var _0x33c1ef=_0xce89[_0x1dd907];return _0x33c1ef;};'use strict';var _=require('lodash');var util=require(_0x9ce8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9ce8('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ce8('0x2'));var rimraf=require(_0x9ce8('0x3'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x9ce8('0x4')]=function(_0x458c29,_0x5955e3){return _0x458c29[_0x9ce8('0x5')](_0x9ce8('0x6'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed07=['api','moment','bluebird','path','rimraf','../../config/environment','./migration.attributes','define','Migration','util','../../config/logger'];(function(_0x5893f7,_0x2e1524){var _0x55a8ac=function(_0x390259){while(--_0x390259){_0x5893f7['push'](_0x5893f7['shift']());}};_0x55a8ac(++_0x2e1524);}(_0xed07,0x1c1));var _0x7ed0=function(_0xeb9dec,_0x4aaa31){_0xeb9dec=_0xeb9dec-0x0;var _0x3aea81=_0xed07[_0xeb9dec];return _0x3aea81;};'use strict';var _=require('lodash');var util=require(_0x7ed0('0x0'));var logger=require(_0x7ed0('0x1'))(_0x7ed0('0x2'));var moment=require(_0x7ed0('0x3'));var BPromise=require(_0x7ed0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ed0('0x5'));var rimraf=require(_0x7ed0('0x6'));var config=require(_0x7ed0('0x7'));var attributes=require(_0x7ed0('0x8'));module['exports']=function(_0x3d6dae,_0x5dc3e6){return _0x3d6dae[_0x7ed0('0x9')](_0x7ed0('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index a6d7c68..24c671e 100644 --- a/server/api/migration/migration.rpc.js +++ b/server/api/migration/migration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a79=['rpc','../../config/environment','client','request','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a6963,_0x23a275){var _0x23948b=function(_0x5899a7){while(--_0x5899a7){_0x5a6963['push'](_0x5a6963['shift']());}};_0x23948b(++_0x23a275);}(_0x3a79,0xca));var _0x93a7=function(_0x4d2560,_0x399901){_0x4d2560=_0x4d2560-0x0;var _0x40b9da=_0x3a79[_0x4d2560];return _0x40b9da;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var moment=require(_0x93a7('0x1'));var BPromise=require('bluebird');var rs=require(_0x93a7('0x2'));var fs=require('fs');var Redis=require(_0x93a7('0x3'));var db=require(_0x93a7('0x4'))['db'];var utils=require(_0x93a7('0x5'));var logger=require(_0x93a7('0x6'))(_0x93a7('0x7'));var config=require(_0x93a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x93a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2579e5,_0x4690bb,_0x1b59d1){return new BPromise(function(_0x2417da,_0x3a512b){return client[_0x93a7('0xa')](_0x2579e5,_0x1b59d1)['then'](function(_0x2996db){logger['info']('Migration,\x20%s,\x20%s',_0x4690bb,_0x93a7('0xb'));logger[_0x93a7('0xc')](_0x93a7('0xd'),_0x4690bb,'request\x20sent',JSON['stringify'](_0x2996db));if(_0x2996db[_0x93a7('0xe')]){if(_0x2996db[_0x93a7('0xe')][_0x93a7('0xf')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x4690bb,_0x2996db[_0x93a7('0xe')]['message']);return _0x3a512b(_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);}logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);return _0x2417da(_0x2996db[_0x93a7('0xe')]['message']);}else{logger[_0x93a7('0x12')](_0x93a7('0x11'),_0x4690bb,'request\x20sent');_0x2417da(_0x2996db['result'][_0x93a7('0x10')]);}})['catch'](function(_0xfac49d){logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0xfac49d);_0x3a512b(_0xfac49d);});});} \ No newline at end of file +var _0x6c76=['request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','Migration,\x20%s,\x20%s'];(function(_0x44976e,_0x311385){var _0x4852b2=function(_0xd57529){while(--_0xd57529){_0x44976e['push'](_0x44976e['shift']());}};_0x4852b2(++_0x311385);}(_0x6c76,0x184));var _0x66c7=function(_0x538a7b,_0x359e5a){_0x538a7b=_0x538a7b-0x0;var _0x304a7f=_0x6c76[_0x538a7b];return _0x304a7f;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('Migration,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('Migration,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('Migration,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 961a2f9..83e1ddc 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 _0xf5e2=['/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf5e2,0xa7));var _0x2f5e=function(_0x53ad80,_0x59bc4a){_0x53ad80=_0x53ad80-0x0;var _0x53cf73=_0xf5e2[_0x53ad80];return _0x53cf73;};'use strict';var multer=require(_0x2f5e('0x0'));var util=require(_0x2f5e('0x1'));var path=require(_0x2f5e('0x2'));var timeout=require(_0x2f5e('0x3'));var express=require(_0x2f5e('0x4'));var router=express['Router']();var fs_extra=require(_0x2f5e('0x5'));var auth=require(_0x2f5e('0x6'));var interaction=require(_0x2f5e('0x7'));var config=require(_0x2f5e('0x8'));var controller=require(_0x2f5e('0x9'));router[_0x2f5e('0xa')]('/',auth[_0x2f5e('0xb')](),controller[_0x2f5e('0xc')]);router[_0x2f5e('0xa')](_0x2f5e('0xd'),auth[_0x2f5e('0xb')](),controller[_0x2f5e('0xe')]);router[_0x2f5e('0xf')]('/',auth[_0x2f5e('0xb')](),controller['create']);router[_0x2f5e('0x10')](_0x2f5e('0xd'),auth[_0x2f5e('0xb')](),controller['update']);router[_0x2f5e('0x11')](_0x2f5e('0xd'),auth[_0x2f5e('0xb')](),controller[_0x2f5e('0x12')]);module[_0x2f5e('0x13')]=router; \ No newline at end of file +var _0xd7ac=['./network.controller','get','isAuthenticated','/:id','show','create','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x49298a,_0x3a9b0f){var _0x31691e=function(_0x2e919e){while(--_0x2e919e){_0x49298a['push'](_0x49298a['shift']());}};_0x31691e(++_0x3a9b0f);}(_0xd7ac,0x167));var _0xcd7a=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xd7ac[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0xcd7a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcd7a('0x1'));var express=require(_0xcd7a('0x2'));var router=express['Router']();var fs_extra=require(_0xcd7a('0x3'));var auth=require(_0xcd7a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd7a('0x5'));router[_0xcd7a('0x6')]('/',auth[_0xcd7a('0x7')](),controller['index']);router[_0xcd7a('0x6')](_0xcd7a('0x8'),auth[_0xcd7a('0x7')](),controller[_0xcd7a('0x9')]);router['post']('/',auth[_0xcd7a('0x7')](),controller[_0xcd7a('0xa')]);router['put'](_0xcd7a('0x8'),auth[_0xcd7a('0x7')](),controller[_0xcd7a('0xb')]);router[_0xcd7a('0xc')](_0xcd7a('0x8'),auth[_0xcd7a('0x7')](),controller['destroy']);module[_0xcd7a('0xd')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index a8120b0..390bae3 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 _0x3d6d=['sequelize','ENUM','localnet','stun','STRING'];(function(_0x1db420,_0xe50b67){var _0x136363=function(_0x3f4697){while(--_0x3f4697){_0x1db420['push'](_0x1db420['shift']());}};_0x136363(++_0xe50b67);}(_0x3d6d,0x96));var _0xd3d6=function(_0xf72786,_0x1a0ddd){_0xf72786=_0xf72786-0x0;var _0x113f3e=_0x3d6d[_0xf72786];return _0x113f3e;};'use strict';var Sequelize=require(_0xd3d6('0x0'));module['exports']={'type':{'type':Sequelize[_0xd3d6('0x1')](_0xd3d6('0x2'),'externip',_0xd3d6('0x3'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd3d6('0x4')]},'password':{'type':Sequelize[_0xd3d6('0x4')]}}; \ No newline at end of file +var _0x37d3=['turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0x37d3,0x92));var _0x337d=function(_0x41cc3f,_0x2678a2){_0x41cc3f=_0x41cc3f-0x0;var _0x47ff58=_0x37d3[_0x41cc3f];return _0x47ff58;};'use strict';var Sequelize=require(_0x337d('0x0'));module[_0x337d('0x1')]={'type':{'type':Sequelize[_0x337d('0x2')](_0x337d('0x3'),'externip','stun',_0x337d('0x4'))},'value':{'type':Sequelize[_0x337d('0x5')]},'username':{'type':Sequelize[_0x337d('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index d2a5992..13aaefd 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 _0x3041=['server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','server/files/templates/stun_multiple.ejs','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','undefined','count','set','Content-Range','update','destroy','sendStatus','stack','name','Network','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','show','params','rawAttributes','keys','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root'];(function(_0x4e5ef0,_0x1370b1){var _0x2a198a=function(_0x358fdd){while(--_0x358fdd){_0x4e5ef0['push'](_0x4e5ef0['shift']());}};_0x2a198a(++_0x1370b1);}(_0x3041,0xab));var _0x1304=function(_0x110596,_0x1faae7){_0x110596=_0x110596-0x0;var _0x51fef2=_0x3041[_0x110596];return _0x51fef2;};'use strict';var util=require(_0x1304('0x0'));var path=require(_0x1304('0x1'));var ejs=require(_0x1304('0x2'));var fs=require('fs');var _=require(_0x1304('0x3'));var qs=require(_0x1304('0x4'));var logger=require(_0x1304('0x5'))('api');var config=require(_0x1304('0x6'));var db=require(_0x1304('0x7'))['db'];var jayson=require(_0x1304('0x8'));var client=jayson[_0x1304('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc8125e,_0x3286b4,_0x43b3f3,_0x79f3f){return new Promise(function(_0x21d1a0,_0x4b9bdc){var _0x272602=_0x79f3f||client;return _0x272602[_0x1304('0xa')](_0xc8125e,_0x43b3f3)[_0x1304('0xb')](function(_0x3393d7){logger[_0x1304('0xc')](_0x1304('0xd'),_0x3286b4,_0x1304('0xe'));logger[_0x1304('0xf')](_0x1304('0x10'),_0x3286b4,'request\x20sent',JSON['stringify'](_0x3393d7));if(_0x3393d7[_0x1304('0x11')]){if(_0x3393d7[_0x1304('0x11')][_0x1304('0x12')]===0x1f4){logger[_0x1304('0x11')](_0x1304('0xd'),_0x3286b4,_0x3393d7[_0x1304('0x11')]['message']);return _0x4b9bdc(_0x3393d7[_0x1304('0x11')][_0x1304('0x13')]);}logger[_0x1304('0x11')](_0x1304('0xd'),_0x3286b4,_0x3393d7[_0x1304('0x11')]['message']);return _0x21d1a0(_0x3393d7[_0x1304('0x11')][_0x1304('0x13')]);}else{logger[_0x1304('0xc')](_0x1304('0xd'),_0x3286b4,_0x1304('0xe'));_0x21d1a0(_0x3393d7[_0x1304('0x14')][_0x1304('0x13')]);}})[_0x1304('0x15')](function(_0x217332){logger['error'](_0x1304('0xd'),_0x3286b4,_0x217332);_0x4b9bdc(_0x217332);});});}function respondWithResult(_0x53e963,_0x4c2032){_0x4c2032=_0x4c2032||0xc8;return function(_0x4b8091){if(_0x4b8091){return _0x53e963[_0x1304('0x16')](_0x4c2032)[_0x1304('0x17')](_0x4b8091);}};}function respondWithFilteredResult(_0x506bb2,_0x80de76){return function(_0xe365c8){if(_0xe365c8){var _0x3f897a=typeof _0x80de76[_0x1304('0x18')]==='undefined'&&typeof _0x80de76['limit']===_0x1304('0x19');var _0x287123=_0xe365c8[_0x1304('0x1a')];var _0x4794e1=_0x3f897a?0x0:_0x80de76[_0x1304('0x18')];var _0x552161=_0x3f897a?_0xe365c8[_0x1304('0x1a')]:_0x80de76[_0x1304('0x18')]+_0x80de76['limit'];var _0x182e79;if(_0x552161>=_0x287123){_0x552161=_0x287123;_0x182e79=0xc8;}else{_0x182e79=0xce;}_0x506bb2[_0x1304('0x16')](_0x182e79);return _0x506bb2[_0x1304('0x1b')](_0x1304('0x1c'),_0x4794e1+'-'+_0x552161+'/'+_0x287123)[_0x1304('0x17')](_0xe365c8);}return null;};}function saveUpdates(_0x22fe2f){return function(_0x3059c0){if(_0x3059c0){return _0x3059c0[_0x1304('0x1d')](_0x22fe2f)['then'](function(_0x1764ef){return _0x1764ef;});}return null;};}function removeEntity(_0x2836e8){return function(_0x420ee6){if(_0x420ee6){return _0x420ee6[_0x1304('0x1e')]()[_0x1304('0xb')](function(){_0x2836e8[_0x1304('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x235a02){return function(_0x1f06d3){if(!_0x1f06d3){_0x235a02[_0x1304('0x1f')](0x194);}return _0x1f06d3;};}function handleError(_0x28a234,_0x274c6e){_0x274c6e=_0x274c6e||0x1f4;return function(_0x4ddb27){logger['error'](_0x4ddb27[_0x1304('0x20')]);if(_0x4ddb27[_0x1304('0x21')]){delete _0x4ddb27[_0x1304('0x21')];}_0x28a234['status'](_0x274c6e)['send'](_0x4ddb27);};}exports['index']=function(_0x1d0577,_0x2271b7){var _0x593fdb={},_0x108a9f={},_0x1d5788={'count':0x0,'rows':[]};var _0x2362ff=_['map'](db[_0x1304('0x22')]['rawAttributes'],function(_0x283d16){return{'name':_0x283d16[_0x1304('0x23')],'type':_0x283d16[_0x1304('0x24')]['key']};});_0x108a9f[_0x1304('0x25')]=_['map'](_0x2362ff,'name');_0x108a9f[_0x1304('0x26')]=_['keys'](_0x1d0577[_0x1304('0x26')]);_0x108a9f[_0x1304('0x27')]=_[_0x1304('0x28')](_0x108a9f['model'],_0x108a9f['query']);_0x593fdb['attributes']=_[_0x1304('0x28')](_0x108a9f[_0x1304('0x25')],qs[_0x1304('0x29')](_0x1d0577['query']['fields']));_0x593fdb[_0x1304('0x2a')]=_0x593fdb[_0x1304('0x2a')][_0x1304('0x2b')]?_0x593fdb[_0x1304('0x2a')]:_0x108a9f[_0x1304('0x25')];if(!_0x1d0577[_0x1304('0x26')][_0x1304('0x2c')](_0x1304('0x2d'))){_0x593fdb[_0x1304('0x2e')]=qs[_0x1304('0x2e')](_0x1d0577['query'][_0x1304('0x2e')]);_0x593fdb[_0x1304('0x18')]=qs[_0x1304('0x18')](_0x1d0577['query'][_0x1304('0x18')]);}_0x593fdb[_0x1304('0x2f')]=qs[_0x1304('0x30')](_0x1d0577[_0x1304('0x26')]['sort']);_0x593fdb[_0x1304('0x31')]=qs[_0x1304('0x27')](_['pick'](_0x1d0577[_0x1304('0x26')],_0x108a9f[_0x1304('0x27')]),_0x2362ff);if(_0x1d0577[_0x1304('0x26')][_0x1304('0x32')]){_0x593fdb['where']=_[_0x1304('0x33')](_0x593fdb[_0x1304('0x31')],{'$or':_['map'](_0x2362ff,function(_0x47e794){if(_0x47e794[_0x1304('0x24')]!=='VIRTUAL'){var _0x492d63={};_0x492d63[_0x47e794[_0x1304('0x21')]]={'$like':'%'+_0x1d0577['query'][_0x1304('0x32')]+'%'};return _0x492d63;}})});}_0x593fdb=_[_0x1304('0x33')]({},_0x593fdb,_0x1d0577[_0x1304('0x34')]);var _0x21f862={'where':_0x593fdb[_0x1304('0x31')]};return db[_0x1304('0x22')][_0x1304('0x1a')](_0x21f862)[_0x1304('0xb')](function(_0x37ede4){_0x1d5788[_0x1304('0x1a')]=_0x37ede4;if(_0x1d0577['query'][_0x1304('0x35')]){_0x593fdb[_0x1304('0x36')]=[{'all':!![]}];}return db['Network']['findAll'](_0x593fdb);})[_0x1304('0xb')](function(_0x4e7c70){_0x1d5788['rows']=_0x4e7c70;return _0x1d5788;})['then'](respondWithFilteredResult(_0x2271b7,_0x593fdb))[_0x1304('0x15')](handleError(_0x2271b7,null));};exports[_0x1304('0x37')]=function(_0x317339,_0x91814f){var _0x22c365={'raw':!![],'where':{'id':_0x317339[_0x1304('0x38')]['id']}},_0xd232cc={};_0xd232cc['model']=_['keys'](db['Network'][_0x1304('0x39')]);_0xd232cc[_0x1304('0x26')]=_[_0x1304('0x3a')](_0x317339[_0x1304('0x26')]);_0xd232cc[_0x1304('0x27')]=_[_0x1304('0x28')](_0xd232cc[_0x1304('0x25')],_0xd232cc[_0x1304('0x26')]);_0x22c365[_0x1304('0x2a')]=_[_0x1304('0x28')](_0xd232cc['model'],qs[_0x1304('0x29')](_0x317339[_0x1304('0x26')][_0x1304('0x29')]));_0x22c365['attributes']=_0x22c365[_0x1304('0x2a')][_0x1304('0x2b')]?_0x22c365[_0x1304('0x2a')]:_0xd232cc[_0x1304('0x25')];if(_0x317339[_0x1304('0x26')][_0x1304('0x35')]){_0x22c365[_0x1304('0x36')]=[{'all':!![]}];}_0x22c365=_[_0x1304('0x33')]({},_0x22c365,_0x317339[_0x1304('0x34')]);return db['Network'][_0x1304('0x3b')](_0x22c365)['then'](handleEntityNotFound(_0x91814f,null))[_0x1304('0xb')](respondWithResult(_0x91814f,null))[_0x1304('0x15')](handleError(_0x91814f,null));};exports[_0x1304('0x3c')]=function(_0x3941d6,_0x1c88b7){var _0x224ee4;return db['Network'][_0x1304('0x3c')](_0x3941d6[_0x1304('0x3d')],{'raw':!![]})[_0x1304('0xb')](function(_0x363cb2){_0x224ee4=_0x363cb2;return db[_0x1304('0x22')][_0x1304('0x3e')]({'where':{'type':_0x3941d6[_0x1304('0x3d')]['type']},'raw':!![]});})[_0x1304('0xb')](function(_0x58106a){if(_0x224ee4['type'][_0x1304('0x3f')]()==_0x1304('0x40')){var _0x47f71e=fs[_0x1304('0x41')](path[_0x1304('0x42')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x1304('0x43'));var _0x57e832=ejs[_0x1304('0x44')](_0x47f71e,{'networks':_0x58106a||[]});fs[_0x1304('0x45')](_0x1304('0x46'),_0x57e832);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x3c'),{'module':_0x1304('0x48')});}else if(_0x224ee4[_0x1304('0x24')][_0x1304('0x3f')]()==_0x1304('0x49')){var _0x35cbe1=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],_0x1304('0x4b')),_0x1304('0x43'));var _0x22c0e7=ejs[_0x1304('0x44')](_0x35cbe1,{'networks':_0x58106a||[]});fs[_0x1304('0x45')]('/etc/asterisk/turn_xcally.conf',_0x22c0e7);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x594d67=fs['readFileSync'](path['join'](config['root'],_0x1304('0x4c')),_0x1304('0x43'));var _0x181cf7=ejs[_0x1304('0x44')](_0x594d67,{'networks':_0x58106a||[]});fs[_0x1304('0x45')](util[_0x1304('0x4d')](_0x1304('0x4e'),_0x3941d6['body'][_0x1304('0x24')]['toLowerCase']()),_0x181cf7);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x3c'),{'module':_0x1304('0x4f')});}})['then'](function(){return _0x224ee4;})[_0x1304('0xb')](respondWithResult(_0x1c88b7,0xc9))['catch'](handleError(_0x1c88b7,null));};exports[_0x1304('0x1d')]=function(_0x2d3984,_0x1f3be2){var _0x106503;return db['Network'][_0x1304('0x3b')]({'where':{'id':_0x2d3984['params']['id']}})['then'](handleEntityNotFound(_0x1f3be2,null))[_0x1304('0xb')](saveUpdates(_0x2d3984[_0x1304('0x3d')],null))[_0x1304('0xb')](function(_0x10b383){if(_0x10b383){_0x106503=_0x10b383;return db[_0x1304('0x22')][_0x1304('0x3e')]({'where':{'type':_0x106503[_0x1304('0x24')]},'raw':!![]});}return null;})[_0x1304('0xb')](function(_0xf3daec){if(_0x106503[_0x1304('0x24')][_0x1304('0x3f')]()=='STUN'){var _0x55241a=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],_0x1304('0x50')),'utf8');var _0x119cc3=ejs[_0x1304('0x44')](_0x55241a,{'networks':_0xf3daec||[]});fs[_0x1304('0x45')](_0x1304('0x46'),_0x119cc3);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1d'),{'module':_0x1304('0x48')});}else if(_0x106503[_0x1304('0x24')][_0x1304('0x3f')]()==_0x1304('0x49')){var _0x116175=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],'server/files/templates/turn_multiple.ejs'),_0x1304('0x43'));var _0x342079=ejs['render'](_0x116175,{'networks':_0xf3daec||[]});fs[_0x1304('0x45')]('/etc/asterisk/turn_xcally.conf',_0x342079);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x2c7d19=fs[_0x1304('0x41')](path['join'](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x5555e9=ejs[_0x1304('0x44')](_0x2c7d19,{'networks':_0xf3daec||[]});fs[_0x1304('0x45')](util[_0x1304('0x4d')](_0x1304('0x4e'),_0x2d3984[_0x1304('0x3d')][_0x1304('0x24')][_0x1304('0x51')]()),_0x5555e9);return respondWithRpcPromise(_0x1304('0x47'),'update',{'module':_0x1304('0x4f')});}})[_0x1304('0xb')](function(_0x5d761c){if(_0x5d761c){return _0x106503;}return null;})[_0x1304('0xb')](respondWithResult(_0x1f3be2,null))[_0x1304('0x15')](handleError(_0x1f3be2,null));};exports[_0x1304('0x1e')]=function(_0x180144,_0x4a8648){var _0x2cc6f5;return db['Network'][_0x1304('0x3b')]({'where':{'id':_0x180144['params']['id']}})[_0x1304('0xb')](function(_0xc2af7d){_0x2cc6f5=_0xc2af7d;return _0xc2af7d;})[_0x1304('0xb')](handleEntityNotFound(_0x4a8648,null))[_0x1304('0xb')](removeEntity(_0x4a8648,null))[_0x1304('0xb')](function(){if(_0x2cc6f5){return db[_0x1304('0x22')][_0x1304('0x3e')]({'where':{'type':_0x2cc6f5[_0x1304('0x24')]},'raw':!![]});}})[_0x1304('0xb')](function(_0x548c24){if(_0x2cc6f5[_0x1304('0x24')][_0x1304('0x3f')]()=='STUN'){var _0x41aa00=fs['readFileSync'](path[_0x1304('0x42')](config[_0x1304('0x4a')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x756594=ejs[_0x1304('0x44')](_0x41aa00,{'networks':_0x548c24||[]});fs[_0x1304('0x45')]('/etc/asterisk/stun_xcally.conf',_0x756594);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1e'),{'module':_0x1304('0x48')});}else if(_0x2cc6f5[_0x1304('0x24')][_0x1304('0x3f')]()==_0x1304('0x49')){var _0x4fca54=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],_0x1304('0x4b')),_0x1304('0x43'));var _0x15dcdb=ejs['render'](_0x4fca54,{'networks':_0x548c24||[]});fs[_0x1304('0x45')]('/etc/asterisk/turn_xcally.conf',_0x15dcdb);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1e'),{'module':'res_stun_monitor.so'});}else{var _0x3ec7c3=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],_0x1304('0x4c')),'utf8');var _0x2313a7=ejs['render'](_0x3ec7c3,{'networks':_0x548c24||[]});fs['writeFileSync'](util[_0x1304('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x2cc6f5['type'][_0x1304('0x51')]()),_0x2313a7);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1e'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x4a8648,null));}; \ No newline at end of file +var _0x9e12=['server/files/templates/turn_multiple.ejs','chan_sip.so','TURN','toLowerCase','path','lodash','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','Network','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','params','find','create','body','findAll','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','join','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toUpperCase','STUN'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x9e12,0x1b2));var _0x29e1=function(_0x5d73b2,_0x1ea5cd){_0x5d73b2=_0x5d73b2-0x0;var _0x1e4551=_0x9e12[_0x5d73b2];return _0x1e4551;};'use strict';var util=require('util');var path=require(_0x29e1('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x29e1('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x29e1('0x2'))(_0x29e1('0x3'));var config=require('../../config/environment');var db=require(_0x29e1('0x4'))['db'];var jayson=require(_0x29e1('0x5'));var client=jayson[_0x29e1('0x6')][_0x29e1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf16e37,_0xb705c7,_0x2260b1,_0x1f1fa5){return new Promise(function(_0x484c70,_0x330d35){var _0xc93c88=_0x1f1fa5||client;return _0xc93c88[_0x29e1('0x8')](_0xf16e37,_0x2260b1)['then'](function(_0x359b25){logger[_0x29e1('0x9')]('Network,\x20%s,\x20%s',_0xb705c7,_0x29e1('0xa'));logger[_0x29e1('0xb')]('Network,\x20%s,\x20%s,\x20%s',_0xb705c7,_0x29e1('0xa'),JSON[_0x29e1('0xc')](_0x359b25));if(_0x359b25[_0x29e1('0xd')]){if(_0x359b25['error'][_0x29e1('0xe')]===0x1f4){logger[_0x29e1('0xd')](_0x29e1('0xf'),_0xb705c7,_0x359b25[_0x29e1('0xd')][_0x29e1('0x10')]);return _0x330d35(_0x359b25[_0x29e1('0xd')][_0x29e1('0x10')]);}logger['error']('Network,\x20%s,\x20%s',_0xb705c7,_0x359b25[_0x29e1('0xd')][_0x29e1('0x10')]);return _0x484c70(_0x359b25[_0x29e1('0xd')][_0x29e1('0x10')]);}else{logger[_0x29e1('0x9')](_0x29e1('0xf'),_0xb705c7,_0x29e1('0xa'));_0x484c70(_0x359b25[_0x29e1('0x11')][_0x29e1('0x10')]);}})[_0x29e1('0x12')](function(_0x2fb397){logger[_0x29e1('0xd')](_0x29e1('0xf'),_0xb705c7,_0x2fb397);_0x330d35(_0x2fb397);});});}function respondWithResult(_0x2f7191,_0x45b1f2){_0x45b1f2=_0x45b1f2||0xc8;return function(_0xbc4f17){if(_0xbc4f17){return _0x2f7191[_0x29e1('0x13')](_0x45b1f2)[_0x29e1('0x14')](_0xbc4f17);}};}function respondWithFilteredResult(_0x35d421,_0x5fcc4){return function(_0x29835e){if(_0x29835e){var _0x3d47df=typeof _0x5fcc4[_0x29e1('0x15')]==='undefined'&&typeof _0x5fcc4['limit']===_0x29e1('0x16');var _0x4db941=_0x29835e['count'];var _0x130b6e=_0x3d47df?0x0:_0x5fcc4[_0x29e1('0x15')];var _0x323760=_0x3d47df?_0x29835e[_0x29e1('0x17')]:_0x5fcc4['offset']+_0x5fcc4[_0x29e1('0x18')];var _0x39497d;if(_0x323760>=_0x4db941){_0x323760=_0x4db941;_0x39497d=0xc8;}else{_0x39497d=0xce;}_0x35d421[_0x29e1('0x13')](_0x39497d);return _0x35d421[_0x29e1('0x19')](_0x29e1('0x1a'),_0x130b6e+'-'+_0x323760+'/'+_0x4db941)[_0x29e1('0x14')](_0x29835e);}return null;};}function saveUpdates(_0x53a00b){return function(_0x45414c){if(_0x45414c){return _0x45414c[_0x29e1('0x1b')](_0x53a00b)[_0x29e1('0x1c')](function(_0x2a1418){return _0x2a1418;});}return null;};}function removeEntity(_0x33e271){return function(_0x32643b){if(_0x32643b){return _0x32643b[_0x29e1('0x1d')]()[_0x29e1('0x1c')](function(){_0x33e271[_0x29e1('0x13')](0xcc)[_0x29e1('0x1e')]();});}};}function handleEntityNotFound(_0x2a80a1){return function(_0x3bed66){if(!_0x3bed66){_0x2a80a1[_0x29e1('0x1f')](0x194);}return _0x3bed66;};}function handleError(_0x190583,_0xfeb88b){_0xfeb88b=_0xfeb88b||0x1f4;return function(_0x18ba8d){logger[_0x29e1('0xd')](_0x18ba8d[_0x29e1('0x20')]);if(_0x18ba8d[_0x29e1('0x21')]){delete _0x18ba8d['name'];}_0x190583[_0x29e1('0x13')](_0xfeb88b)[_0x29e1('0x22')](_0x18ba8d);};}exports[_0x29e1('0x23')]=function(_0x40f6d3,_0x56ec03){var _0x26c445={},_0x380092={},_0x517aa8={'count':0x0,'rows':[]};var _0x24b128=_['map'](db[_0x29e1('0x24')][_0x29e1('0x25')],function(_0x2fbed8){return{'name':_0x2fbed8[_0x29e1('0x26')],'type':_0x2fbed8['type'][_0x29e1('0x27')]};});_0x380092[_0x29e1('0x28')]=_[_0x29e1('0x29')](_0x24b128,'name');_0x380092[_0x29e1('0x2a')]=_[_0x29e1('0x2b')](_0x40f6d3['query']);_0x380092[_0x29e1('0x2c')]=_[_0x29e1('0x2d')](_0x380092[_0x29e1('0x28')],_0x380092[_0x29e1('0x2a')]);_0x26c445[_0x29e1('0x2e')]=_[_0x29e1('0x2d')](_0x380092[_0x29e1('0x28')],qs[_0x29e1('0x2f')](_0x40f6d3[_0x29e1('0x2a')][_0x29e1('0x2f')]));_0x26c445['attributes']=_0x26c445[_0x29e1('0x2e')][_0x29e1('0x30')]?_0x26c445[_0x29e1('0x2e')]:_0x380092['model'];if(!_0x40f6d3[_0x29e1('0x2a')][_0x29e1('0x31')](_0x29e1('0x32'))){_0x26c445['limit']=qs['limit'](_0x40f6d3[_0x29e1('0x2a')]['limit']);_0x26c445[_0x29e1('0x15')]=qs[_0x29e1('0x15')](_0x40f6d3[_0x29e1('0x2a')][_0x29e1('0x15')]);}_0x26c445[_0x29e1('0x33')]=qs[_0x29e1('0x34')](_0x40f6d3['query'][_0x29e1('0x34')]);_0x26c445[_0x29e1('0x35')]=qs[_0x29e1('0x2c')](_[_0x29e1('0x36')](_0x40f6d3[_0x29e1('0x2a')],_0x380092[_0x29e1('0x2c')]),_0x24b128);if(_0x40f6d3[_0x29e1('0x2a')][_0x29e1('0x37')]){_0x26c445[_0x29e1('0x35')]=_[_0x29e1('0x38')](_0x26c445[_0x29e1('0x35')],{'$or':_[_0x29e1('0x29')](_0x24b128,function(_0x2f3d23){if(_0x2f3d23[_0x29e1('0x39')]!=='VIRTUAL'){var _0x35392d={};_0x35392d[_0x2f3d23[_0x29e1('0x21')]]={'$like':'%'+_0x40f6d3['query'][_0x29e1('0x37')]+'%'};return _0x35392d;}})});}_0x26c445=_[_0x29e1('0x38')]({},_0x26c445,_0x40f6d3[_0x29e1('0x3a')]);var _0x4e6b8a={'where':_0x26c445[_0x29e1('0x35')]};return db[_0x29e1('0x24')]['count'](_0x4e6b8a)[_0x29e1('0x1c')](function(_0x386843){_0x517aa8[_0x29e1('0x17')]=_0x386843;if(_0x40f6d3[_0x29e1('0x2a')][_0x29e1('0x3b')]){_0x26c445[_0x29e1('0x3c')]=[{'all':!![]}];}return db[_0x29e1('0x24')]['findAll'](_0x26c445);})[_0x29e1('0x1c')](function(_0x1c4d25){_0x517aa8['rows']=_0x1c4d25;return _0x517aa8;})[_0x29e1('0x1c')](respondWithFilteredResult(_0x56ec03,_0x26c445))['catch'](handleError(_0x56ec03,null));};exports['show']=function(_0x2af502,_0x282649){var _0x410239={'raw':!![],'where':{'id':_0x2af502[_0x29e1('0x3d')]['id']}},_0x50ba65={};_0x50ba65['model']=_[_0x29e1('0x2b')](db[_0x29e1('0x24')]['rawAttributes']);_0x50ba65[_0x29e1('0x2a')]=_[_0x29e1('0x2b')](_0x2af502[_0x29e1('0x2a')]);_0x50ba65[_0x29e1('0x2c')]=_['intersection'](_0x50ba65[_0x29e1('0x28')],_0x50ba65[_0x29e1('0x2a')]);_0x410239['attributes']=_['intersection'](_0x50ba65['model'],qs['fields'](_0x2af502[_0x29e1('0x2a')][_0x29e1('0x2f')]));_0x410239[_0x29e1('0x2e')]=_0x410239[_0x29e1('0x2e')]['length']?_0x410239[_0x29e1('0x2e')]:_0x50ba65[_0x29e1('0x28')];if(_0x2af502[_0x29e1('0x2a')][_0x29e1('0x3b')]){_0x410239[_0x29e1('0x3c')]=[{'all':!![]}];}_0x410239=_[_0x29e1('0x38')]({},_0x410239,_0x2af502['options']);return db[_0x29e1('0x24')][_0x29e1('0x3e')](_0x410239)['then'](handleEntityNotFound(_0x282649,null))[_0x29e1('0x1c')](respondWithResult(_0x282649,null))[_0x29e1('0x12')](handleError(_0x282649,null));};exports['create']=function(_0x45e5fb,_0x26c44d){var _0x5a42e6;return db['Network'][_0x29e1('0x3f')](_0x45e5fb[_0x29e1('0x40')],{'raw':!![]})[_0x29e1('0x1c')](function(_0x85f804){_0x5a42e6=_0x85f804;return db[_0x29e1('0x24')][_0x29e1('0x41')]({'where':{'type':_0x45e5fb[_0x29e1('0x40')][_0x29e1('0x39')]},'raw':!![]});})[_0x29e1('0x1c')](function(_0x28d090){if(_0x5a42e6[_0x29e1('0x39')]['toUpperCase']()=='STUN'){var _0x490df7=fs[_0x29e1('0x42')](path['join'](config[_0x29e1('0x43')],_0x29e1('0x44')),_0x29e1('0x45'));var _0x428814=ejs[_0x29e1('0x46')](_0x490df7,{'networks':_0x28d090||[]});fs[_0x29e1('0x47')](_0x29e1('0x48'),_0x428814);return respondWithRpcPromise(_0x29e1('0x49'),_0x29e1('0x3f'),{'module':_0x29e1('0x4a')});}else if(_0x5a42e6[_0x29e1('0x39')]['toUpperCase']()=='TURN'){var _0x269026=fs[_0x29e1('0x42')](path[_0x29e1('0x4b')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x29e1('0x45'));var _0x4148eb=ejs[_0x29e1('0x46')](_0x269026,{'networks':_0x28d090||[]});fs[_0x29e1('0x47')](_0x29e1('0x4c'),_0x4148eb);return respondWithRpcPromise(_0x29e1('0x49'),_0x29e1('0x3f'),{'module':'res_stun_monitor.so'});}else{var _0x467bbf=fs[_0x29e1('0x42')](path['join'](config[_0x29e1('0x43')],_0x29e1('0x4d')),_0x29e1('0x45'));var _0x4efbaf=ejs[_0x29e1('0x46')](_0x467bbf,{'networks':_0x28d090||[]});fs[_0x29e1('0x47')](util[_0x29e1('0x4e')](_0x29e1('0x4f'),_0x45e5fb[_0x29e1('0x40')][_0x29e1('0x39')]['toLowerCase']()),_0x4efbaf);return respondWithRpcPromise(_0x29e1('0x49'),_0x29e1('0x3f'),{'module':'chan_sip.so'});}})['then'](function(){return _0x5a42e6;})[_0x29e1('0x1c')](respondWithResult(_0x26c44d,0xc9))[_0x29e1('0x12')](handleError(_0x26c44d,null));};exports[_0x29e1('0x1b')]=function(_0x51abcf,_0x5a1aea){var _0x5604b2;return db['Network']['find']({'where':{'id':_0x51abcf['params']['id']}})[_0x29e1('0x1c')](handleEntityNotFound(_0x5a1aea,null))[_0x29e1('0x1c')](saveUpdates(_0x51abcf['body'],null))[_0x29e1('0x1c')](function(_0x111a26){if(_0x111a26){_0x5604b2=_0x111a26;return db[_0x29e1('0x24')]['findAll']({'where':{'type':_0x5604b2[_0x29e1('0x39')]},'raw':!![]});}return null;})[_0x29e1('0x1c')](function(_0x508a23){if(_0x5604b2[_0x29e1('0x39')][_0x29e1('0x50')]()==_0x29e1('0x51')){var _0x513b56=fs[_0x29e1('0x42')](path[_0x29e1('0x4b')](config[_0x29e1('0x43')],_0x29e1('0x44')),_0x29e1('0x45'));var _0x900cbf=ejs[_0x29e1('0x46')](_0x513b56,{'networks':_0x508a23||[]});fs[_0x29e1('0x47')](_0x29e1('0x48'),_0x900cbf);return respondWithRpcPromise(_0x29e1('0x49'),_0x29e1('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x5604b2[_0x29e1('0x39')][_0x29e1('0x50')]()=='TURN'){var _0x57e64e=fs['readFileSync'](path[_0x29e1('0x4b')](config['root'],_0x29e1('0x52')),_0x29e1('0x45'));var _0x5952ef=ejs[_0x29e1('0x46')](_0x57e64e,{'networks':_0x508a23||[]});fs['writeFileSync'](_0x29e1('0x4c'),_0x5952ef);return respondWithRpcPromise(_0x29e1('0x49'),_0x29e1('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x1d743d=fs['readFileSync'](path[_0x29e1('0x4b')](config[_0x29e1('0x43')],'server/files/templates/network.ejs'),_0x29e1('0x45'));var _0x31301c=ejs[_0x29e1('0x46')](_0x1d743d,{'networks':_0x508a23||[]});fs[_0x29e1('0x47')](util[_0x29e1('0x4e')](_0x29e1('0x4f'),_0x51abcf[_0x29e1('0x40')]['type']['toLowerCase']()),_0x31301c);return respondWithRpcPromise('Reload','update',{'module':_0x29e1('0x53')});}})[_0x29e1('0x1c')](function(_0x34bd91){if(_0x34bd91){return _0x5604b2;}return null;})['then'](respondWithResult(_0x5a1aea,null))['catch'](handleError(_0x5a1aea,null));};exports[_0x29e1('0x1d')]=function(_0x11d40b,_0x3b40b6){var _0x1cffe6;return db[_0x29e1('0x24')][_0x29e1('0x3e')]({'where':{'id':_0x11d40b['params']['id']}})['then'](function(_0x3ef07c){_0x1cffe6=_0x3ef07c;return _0x3ef07c;})[_0x29e1('0x1c')](handleEntityNotFound(_0x3b40b6,null))['then'](removeEntity(_0x3b40b6,null))[_0x29e1('0x1c')](function(){if(_0x1cffe6){return db[_0x29e1('0x24')][_0x29e1('0x41')]({'where':{'type':_0x1cffe6[_0x29e1('0x39')]},'raw':!![]});}})[_0x29e1('0x1c')](function(_0x4d0966){if(_0x1cffe6[_0x29e1('0x39')][_0x29e1('0x50')]()==_0x29e1('0x51')){var _0x316538=fs[_0x29e1('0x42')](path['join'](config[_0x29e1('0x43')],'server/files/templates/stun_multiple.ejs'),_0x29e1('0x45'));var _0x19c1c2=ejs[_0x29e1('0x46')](_0x316538,{'networks':_0x4d0966||[]});fs[_0x29e1('0x47')](_0x29e1('0x48'),_0x19c1c2);return respondWithRpcPromise('Reload',_0x29e1('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x1cffe6['type']['toUpperCase']()==_0x29e1('0x54')){var _0x1c75c0=fs[_0x29e1('0x42')](path[_0x29e1('0x4b')](config[_0x29e1('0x43')],_0x29e1('0x52')),_0x29e1('0x45'));var _0x5c39ed=ejs[_0x29e1('0x46')](_0x1c75c0,{'networks':_0x4d0966||[]});fs[_0x29e1('0x47')](_0x29e1('0x4c'),_0x5c39ed);return respondWithRpcPromise(_0x29e1('0x49'),_0x29e1('0x1d'),{'module':_0x29e1('0x4a')});}else{var _0x151daf=fs[_0x29e1('0x42')](path[_0x29e1('0x4b')](config[_0x29e1('0x43')],'server/files/templates/network.ejs'),_0x29e1('0x45'));var _0x3662f9=ejs['render'](_0x151daf,{'networks':_0x4d0966||[]});fs['writeFileSync'](util['format'](_0x29e1('0x4f'),_0x1cffe6['type'][_0x29e1('0x55')]()),_0x3662f9);return respondWithRpcPromise('Reload',_0x29e1('0x1d'),{'module':_0x29e1('0x53')});}})[_0x29e1('0x12')](handleError(_0x3b40b6,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8970815..30d046a 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 _0xa45c=['request-promise','rimraf','exports','define','network','lodash','util','moment'];(function(_0x6f2f43,_0x3c223a){var _0x3d6334=function(_0x5f3894){while(--_0x5f3894){_0x6f2f43['push'](_0x6f2f43['shift']());}};_0x3d6334(++_0x3c223a);}(_0xa45c,0x6d));var _0xca45=function(_0x31eb02,_0x471e95){_0x31eb02=_0x31eb02-0x0;var _0x1c617d=_0xa45c[_0x31eb02];return _0x1c617d;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca45('0x2'));var BPromise=require('bluebird');var rp=require(_0xca45('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca45('0x4'));var config=require('../../config/environment');var attributes=require('./network.attributes');module[_0xca45('0x5')]=function(_0x3803d6,_0x18d789){return _0x3803d6[_0xca45('0x6')]('Network',attributes,{'tableName':_0xca45('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c2c=['bluebird','path','rimraf','exports','define','Network','network','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9c2('0x0'));var util=require(_0xc9c2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc9c2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9c2('0x3'));var rimraf=require(_0xc9c2('0x4'));var config=require('../../config/environment');var attributes=require('./network.attributes');module[_0xc9c2('0x5')]=function(_0x5140a8,_0x30f3d6){return _0x5140a8[_0xc9c2('0x6')](_0xc9c2('0x7'),attributes,{'tableName':_0xc9c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 7f31f57..881ca48 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x10e5e8,_0x57fb63){_0x10e5e8=_0x10e5e8-0x0;var _0xd3f7cc=_0x7a54[_0x10e5e8];return _0xd3f7cc;};'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(_0x547bd4,_0x1e400c){_0x547bd4=_0x547bd4-0x0;var _0x2f6559=_0x7a54[_0x547bd4];return _0x2f6559;};'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 a1a5852..6632391 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 _0x4213=['/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','put','update','delete','destroy','/:id/dispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions'];(function(_0x4a103,_0x45dc99){var _0x4680d2=function(_0x58e6a8){while(--_0x58e6a8){_0x4a103['push'](_0x4a103['shift']());}};_0x4680d2(++_0x45dc99);}(_0x4213,0x77));var _0x3421=function(_0x282160,_0x2b7f23){_0x282160=_0x282160-0x0;var _0x1b9077=_0x4213[_0x282160];return _0x1b9077;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/dispositions',auth[_0x3421('0xa')](),controller['getDispositions']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x9')](_0x3421('0x12'),auth[_0x3421('0xa')](),controller['getApplications']);router[_0x3421('0x9')](_0x3421('0x13'),auth[_0x3421('0xa')](),controller[_0x3421('0x14')]);router[_0x3421('0x9')](_0x3421('0x15'),auth[_0x3421('0xa')](),controller['getAgents']);router[_0x3421('0x16')]('/',auth['isAuthenticated'](),controller[_0x3421('0x17')]);router[_0x3421('0x16')]('/:id/dispositions',auth[_0x3421('0xa')](),controller['addDisposition']);router[_0x3421('0x16')](_0x3421('0x10'),auth['isAuthenticated'](),controller[_0x3421('0x18')]);router[_0x3421('0x16')](_0x3421('0x19'),controller[_0x3421('0x1a')]);router[_0x3421('0x16')](_0x3421('0x12'),auth[_0x3421('0xa')](),controller[_0x3421('0x1b')]);router[_0x3421('0x16')](_0x3421('0x15'),auth[_0x3421('0xa')](),controller['addAgents']);router[_0x3421('0x16')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x3421('0x1c')](_0x3421('0xe'),auth[_0x3421('0xa')](),controller[_0x3421('0x1d')]);router[_0x3421('0x1e')](_0x3421('0xe'),auth[_0x3421('0xa')](),controller[_0x3421('0x1f')]);router[_0x3421('0x1e')](_0x3421('0x20'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x21')]);router['delete']('/:id/users',auth[_0x3421('0xa')](),controller['removeAgents']);module[_0x3421('0x22')]=router; \ No newline at end of file +var _0xeb3b=['getAnswers','/:id/applications','getApplications','getInteractions','getAgents','post','create','/:id/notify','notify','addApplications','addAgents','/:id/send','put','delete','destroy','removeDispositions','removeAnswers','/:id/users','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers'];(function(_0x602242,_0x3ecec6){var _0x37e751=function(_0x421285){while(--_0x421285){_0x602242['push'](_0x602242['shift']());}};_0x37e751(++_0x3ecec6);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0xeb3b[_0x412342];return _0x3e62cb;};'use strict';var multer=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var path=require(_0xbeb3('0x2'));var timeout=require(_0xbeb3('0x3'));var express=require(_0xbeb3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbeb3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbeb3('0x6'));var controller=require('./openchannelAccount.controller');router[_0xbeb3('0x7')]('/',auth[_0xbeb3('0x8')](),controller[_0xbeb3('0x9')]);router[_0xbeb3('0x7')](_0xbeb3('0xa'),auth[_0xbeb3('0x8')](),controller['describe']);router[_0xbeb3('0x7')](_0xbeb3('0xb'),auth[_0xbeb3('0x8')](),controller[_0xbeb3('0xc')]);router[_0xbeb3('0x7')](_0xbeb3('0xd'),auth[_0xbeb3('0x8')](),controller['getDispositions']);router[_0xbeb3('0x7')](_0xbeb3('0xe'),auth['isAuthenticated'](),controller[_0xbeb3('0xf')]);router[_0xbeb3('0x7')](_0xbeb3('0x10'),auth[_0xbeb3('0x8')](),controller[_0xbeb3('0x11')]);router[_0xbeb3('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xbeb3('0x12')]);router[_0xbeb3('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xbeb3('0x13')]);router[_0xbeb3('0x14')]('/',auth[_0xbeb3('0x8')](),controller[_0xbeb3('0x15')]);router[_0xbeb3('0x14')]('/:id/dispositions',auth[_0xbeb3('0x8')](),controller['addDisposition']);router[_0xbeb3('0x14')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0xbeb3('0x14')](_0xbeb3('0x16'),controller[_0xbeb3('0x17')]);router[_0xbeb3('0x14')]('/:id/applications',auth[_0xbeb3('0x8')](),controller[_0xbeb3('0x18')]);router[_0xbeb3('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xbeb3('0x19')]);router['post'](_0xbeb3('0x1a'),auth['isAuthenticated'](),controller['send']);router[_0xbeb3('0x1b')](_0xbeb3('0xb'),auth[_0xbeb3('0x8')](),controller['update']);router[_0xbeb3('0x1c')](_0xbeb3('0xb'),auth['isAuthenticated'](),controller[_0xbeb3('0x1d')]);router[_0xbeb3('0x1c')]('/:id/dispositions',auth[_0xbeb3('0x8')](),controller[_0xbeb3('0x1e')]);router[_0xbeb3('0x1c')](_0xbeb3('0xe'),auth[_0xbeb3('0x8')](),controller[_0xbeb3('0x1f')]);router[_0xbeb3('0x1c')](_0xbeb3('0x20'),auth[_0xbeb3('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 34ac878..d614e16 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 _0x9d4e=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name'];(function(_0x4b7a31,_0x54b8f8){var _0x5c2c6e=function(_0x141904){while(--_0x141904){_0x4b7a31['push'](_0x4b7a31['shift']());}};_0x5c2c6e(++_0x54b8f8);}(_0x9d4e,0x140));var _0xe9d4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9d4e[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe9d4('0x0'));module[_0xe9d4('0x1')]={'name':{'type':Sequelize[_0xe9d4('0x2')],'unique':_0xe9d4('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe9d4('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xe9d4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe9d4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe9d4('0x4')],'defaultValue':function(){return _0xe9d4('0x5');}},'notificationSound':{'type':Sequelize[_0xe9d4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe9d4('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xe9d4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe9d4('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xe9d4('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe9d4('0x6')],'defaultValue':![],'comment':_0xe9d4('0x9'),'set':function(_0x2e2795){if(!_0x2e2795)this[_0xe9d4('0xa')](_0xe9d4('0xb'),null);this[_0xe9d4('0xa')]('mandatoryDisposition',_0x2e2795);}}}; \ No newline at end of file +var _0xc7c6=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1e3585,_0x2a2894){var _0xd7019d=function(_0x83c9ea){while(--_0x83c9ea){_0x1e3585['push'](_0x1e3585['shift']());}};_0xd7019d(++_0x2a2894);}(_0xc7c6,0xae));var _0x6c7c=function(_0x1e8856,_0x3c42f6){_0x1e8856=_0x1e8856-0x0;var _0x303758=_0xc7c6[_0x1e8856];return _0x303758;};'use strict';var Sequelize=require(_0x6c7c('0x0'));var rs=require(_0x6c7c('0x1'));module[_0x6c7c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6c7c('0x3')],'defaultValue':function(){return rs[_0x6c7c('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6c7c('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6c7c('0x5')],'defaultValue':function(){return _0x6c7c('0x6');}},'notificationSound':{'type':Sequelize[_0x6c7c('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c7c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6c7c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6c7c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6c7c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c7c('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x6c7c('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x6c7c('0x7')],'defaultValue':![],'comment':_0x6c7c('0xa'),'set':function(_0x16f192){if(!_0x16f192)this['setDataValue'](_0x6c7c('0xb'),null);this[_0x6c7c('0xc')](_0x6c7c('0xd'),_0x16f192);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 2471e36..dd53b1f 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 _0x6ec2=['filters','pick','filter','VIRTUAL','include','rows','show','params','Pause','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','applications','orderBy','priority','account','ListId','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','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','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','catch','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x12df3c,_0xf0ae04){var _0x4f208c=function(_0x55e709){while(--_0x55e709){_0x12df3c['push'](_0x12df3c['shift']());}};_0x4f208c(++_0xf0ae04);}(_0x6ec2,0x78));var _0x26ec=function(_0x140c7a,_0x22d388){_0x140c7a=_0x140c7a-0x0;var _0x4a4a38=_0x6ec2[_0x140c7a];return _0x4a4a38;};'use strict';var emlformat=require(_0x26ec('0x0'));var rimraf=require(_0x26ec('0x1'));var zipdir=require(_0x26ec('0x2'));var jsonpatch=require(_0x26ec('0x3'));var rp=require(_0x26ec('0x4'));var moment=require(_0x26ec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x26ec('0x6'));var util=require(_0x26ec('0x7'));var path=require(_0x26ec('0x8'));var sox=require(_0x26ec('0x9'));var csv=require(_0x26ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26ec('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x26ec('0xc'));var jsforce=require(_0x26ec('0xd'));var deskjs=require(_0x26ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x26ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x26ec('0x10'));var authService=require(_0x26ec('0x11'));var qs=require(_0x26ec('0x12'));var as=require(_0x26ec('0x13'));var hardwareService=require(_0x26ec('0x14'));var logger=require(_0x26ec('0x15'))(_0x26ec('0x16'));var utils=require(_0x26ec('0x17'));var config=require(_0x26ec('0x18'));var licenseUtil=require(_0x26ec('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x26ec('0x1a')](config[_0x26ec('0x1b')],{'host':_0x26ec('0x1c'),'port':0x18eb});var socket=require(_0x26ec('0x1d'))(new Redis(config[_0x26ec('0x1b')]));require(_0x26ec('0x1e'))[_0x26ec('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x26ec('0x20')][_0x26ec('0x21')]({'port':0x232c});var client9002=jayson[_0x26ec('0x20')][_0x26ec('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4f9950,_0x4d366c,_0x438985,_0x127385){return new BPromise(function(_0x4bdced,_0x20c407){var _0x49dc68=_0x127385||client;return _0x49dc68[_0x26ec('0x22')](_0x4f9950,_0x438985)[_0x26ec('0x23')](function(_0x50c9de){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4d366c,_0x26ec('0x24'));logger[_0x26ec('0x25')](_0x26ec('0x26'),_0x4d366c,'request\x20sent',JSON['stringify'](_0x50c9de));if(_0x50c9de[_0x26ec('0x27')]){if(_0x50c9de[_0x26ec('0x27')][_0x26ec('0x28')]===0x1f4){logger[_0x26ec('0x27')](_0x26ec('0x29'),_0x4d366c,_0x50c9de[_0x26ec('0x27')]['message']);return _0x20c407(_0x50c9de[_0x26ec('0x27')][_0x26ec('0x2a')]);}logger[_0x26ec('0x27')](_0x26ec('0x29'),_0x4d366c,_0x50c9de[_0x26ec('0x27')]['message']);return _0x4bdced(_0x50c9de['error'][_0x26ec('0x2a')]);}else{logger[_0x26ec('0x2b')](_0x26ec('0x29'),_0x4d366c,'request\x20sent');_0x4bdced(_0x50c9de['result'][_0x26ec('0x2a')]);}})[_0x26ec('0x2c')](function(_0x16aba4){logger[_0x26ec('0x27')](_0x26ec('0x29'),_0x4d366c,_0x16aba4);_0x20c407(_0x16aba4);});});}function respondWithStatusCode(_0x89bd5f,_0x439f78){_0x439f78=_0x439f78||0xcc;return function(_0x4e9cf8){if(_0x4e9cf8){return _0x89bd5f['sendStatus'](_0x439f78);}return _0x89bd5f['status'](_0x439f78)[_0x26ec('0x2d')]();};}function respondWithResult(_0xddd5fc,_0x352bef){_0x352bef=_0x352bef||0xc8;return function(_0x3fd842){if(_0x3fd842){return _0xddd5fc[_0x26ec('0x2e')](_0x352bef)[_0x26ec('0x2f')](_0x3fd842);}};}function respondWithFilteredResult(_0x3268e9,_0x4a1371){return function(_0x30231e){if(_0x30231e){var _0x5d10ba=typeof _0x4a1371[_0x26ec('0x30')]===_0x26ec('0x31')&&typeof _0x4a1371['limit']===_0x26ec('0x31');var _0x2d30e6=_0x30231e[_0x26ec('0x32')];var _0x18999a=_0x5d10ba?0x0:_0x4a1371[_0x26ec('0x30')];var _0x24d390=_0x5d10ba?_0x30231e['count']:_0x4a1371[_0x26ec('0x30')]+_0x4a1371['limit'];var _0x3d8b89;if(_0x24d390>=_0x2d30e6){_0x24d390=_0x2d30e6;_0x3d8b89=0xc8;}else{_0x3d8b89=0xce;}_0x3268e9['status'](_0x3d8b89);return _0x3268e9[_0x26ec('0x33')](_0x26ec('0x34'),_0x18999a+'-'+_0x24d390+'/'+_0x2d30e6)['json'](_0x30231e);}return null;};}function patchUpdates(_0x4555ea){return function(_0x13c4c3){try{jsonpatch[_0x26ec('0x35')](_0x13c4c3,_0x4555ea,!![]);}catch(_0x5fe57f){return BPromise[_0x26ec('0x36')](_0x5fe57f);}return _0x13c4c3[_0x26ec('0x37')]();};}function saveUpdates(_0x4f1806,_0x5bf0b8){return function(_0x56e03c){if(_0x56e03c){return _0x56e03c['update'](_0x4f1806)['then'](function(_0x187e7d){return _0x187e7d;});}return null;};}function removeEntity(_0x2543a6,_0x2737c6){return function(_0x27652d){if(_0x27652d){return _0x27652d[_0x26ec('0x38')]()['then'](function(){var _0xfdd95=_0x27652d[_0x26ec('0x39')]({'plain':!![]});var _0x35a745=_0x26ec('0x3a');return db[_0x26ec('0x3b')]['destroy']({'where':{'type':_0x35a745,'resourceId':_0xfdd95['id']}})[_0x26ec('0x23')](function(){return _0x27652d;});})[_0x26ec('0x23')](function(){_0x2543a6[_0x26ec('0x2e')](0xcc)[_0x26ec('0x2d')]();});}};}function handleEntityNotFound(_0x6b217f,_0x171118){return function(_0x39c514){if(!_0x39c514){_0x6b217f[_0x26ec('0x3c')](0x194);}return _0x39c514;};}function handleError(_0x354adf,_0x16c0ee){_0x16c0ee=_0x16c0ee||0x1f4;return function(_0x48d7cf){logger['error'](_0x48d7cf[_0x26ec('0x3d')]);if(_0x48d7cf[_0x26ec('0x3e')]){delete _0x48d7cf['name'];}_0x354adf[_0x26ec('0x2e')](_0x16c0ee)['send'](_0x48d7cf);};}exports[_0x26ec('0x3f')]=function(_0x1244aa,_0x11fc8c){var _0xb4942e={'include':[{'model':db['Pause'],'as':_0x26ec('0x40')}]},_0x2a0c92={},_0xfb68c9={'count':0x0,'rows':[]};var _0x3441f4=_[_0x26ec('0x41')](db[_0x26ec('0x42')][_0x26ec('0x43')],function(_0x304194){return{'name':_0x304194[_0x26ec('0x44')],'type':_0x304194[_0x26ec('0x45')][_0x26ec('0x46')]};});_0x2a0c92[_0x26ec('0x47')]=_[_0x26ec('0x41')](_0x3441f4,_0x26ec('0x3e'));_0x2a0c92[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x1244aa[_0x26ec('0x48')]);_0x2a0c92['filters']=_[_0x26ec('0x4a')](_0x2a0c92[_0x26ec('0x47')],_0x2a0c92[_0x26ec('0x48')]);_0xb4942e[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x2a0c92[_0x26ec('0x47')],qs['fields'](_0x1244aa['query'][_0x26ec('0x4c')]));_0xb4942e['attributes']=_0xb4942e[_0x26ec('0x4b')][_0x26ec('0x4d')]?_0xb4942e[_0x26ec('0x4b')]:_0x2a0c92[_0x26ec('0x47')];if(!_0x1244aa[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0xb4942e[_0x26ec('0x50')]=qs['limit'](_0x1244aa[_0x26ec('0x48')][_0x26ec('0x50')]);_0xb4942e[_0x26ec('0x30')]=qs['offset'](_0x1244aa[_0x26ec('0x48')][_0x26ec('0x30')]);}_0xb4942e[_0x26ec('0x51')]=qs[_0x26ec('0x52')](_0x1244aa[_0x26ec('0x48')][_0x26ec('0x52')]);_0xb4942e[_0x26ec('0x53')]=qs[_0x26ec('0x54')](_[_0x26ec('0x55')](_0x1244aa[_0x26ec('0x48')],_0x2a0c92[_0x26ec('0x54')]),_0x3441f4);if(_0x1244aa[_0x26ec('0x48')][_0x26ec('0x56')]){_0xb4942e[_0x26ec('0x53')]=_['merge'](_0xb4942e['where'],{'$or':_[_0x26ec('0x41')](_0x3441f4,function(_0x5be55c){if(_0x5be55c['type']!==_0x26ec('0x57')){var _0xc9eda3={};_0xc9eda3[_0x5be55c[_0x26ec('0x3e')]]={'$like':'%'+_0x1244aa['query']['filter']+'%'};return _0xc9eda3;}})});}_0xb4942e=_['merge']({},_0xb4942e,_0x1244aa['options']);var _0x3faf2b={'where':_0xb4942e['where']};return db[_0x26ec('0x42')][_0x26ec('0x32')](_0x3faf2b)['then'](function(_0x4c1355){_0xfb68c9[_0x26ec('0x32')]=_0x4c1355;if(_0x1244aa[_0x26ec('0x48')]['includeAll']){_0xb4942e[_0x26ec('0x58')]=[{'all':!![]}];}return db[_0x26ec('0x42')]['findAll'](_0xb4942e);})['then'](function(_0x34ee55){_0xfb68c9[_0x26ec('0x59')]=_0x34ee55;return _0xfb68c9;})[_0x26ec('0x23')](respondWithFilteredResult(_0x11fc8c,_0xb4942e))['catch'](handleError(_0x11fc8c,null));};exports[_0x26ec('0x5a')]=function(_0x584c35,_0x3c743a){var _0x179f9f={'raw':![],'where':{'id':_0x584c35[_0x26ec('0x5b')]['id']},'include':[{'model':db[_0x26ec('0x5c')],'as':_0x26ec('0x40')}]},_0x2af53a={};_0x2af53a['model']=_[_0x26ec('0x49')](db[_0x26ec('0x42')]['rawAttributes']);_0x2af53a[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x584c35['query']);_0x2af53a[_0x26ec('0x54')]=_['intersection'](_0x2af53a['model'],_0x2af53a[_0x26ec('0x48')]);_0x179f9f[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x2af53a['model'],qs['fields'](_0x584c35[_0x26ec('0x48')][_0x26ec('0x4c')]));_0x179f9f[_0x26ec('0x4b')]=_0x179f9f['attributes'][_0x26ec('0x4d')]?_0x179f9f[_0x26ec('0x4b')]:_0x2af53a['model'];if(_0x584c35['query'][_0x26ec('0x5d')]){_0x179f9f['include']=[{'all':!![]}];}_0x179f9f=_[_0x26ec('0x5e')]({},_0x179f9f,_0x584c35[_0x26ec('0x5f')]);return db[_0x26ec('0x42')][_0x26ec('0x60')](_0x179f9f)['then'](handleEntityNotFound(_0x3c743a,null))['then'](respondWithResult(_0x3c743a,null))[_0x26ec('0x2c')](handleError(_0x3c743a,null));};exports[_0x26ec('0x61')]=function(_0x2e1eec,_0x11440c){return db[_0x26ec('0x42')][_0x26ec('0x61')](_0x2e1eec[_0x26ec('0x62')],{})['then'](function(_0x92dd6f){var _0x4a67e4=_0x2e1eec[_0x26ec('0x63')][_0x26ec('0x39')]({'plain':!![]});if(!_0x4a67e4)throw new Error(_0x26ec('0x64'));if(_0x4a67e4[_0x26ec('0x65')]===_0x26ec('0x63')){var _0x5f599c=_0x92dd6f[_0x26ec('0x39')]({'plain':!![]});var _0xefa3aa=_0x26ec('0x3a');return db[_0x26ec('0x66')]['find']({'where':{'name':_0xefa3aa,'userProfileId':_0x4a67e4[_0x26ec('0x67')]},'raw':!![]})[_0x26ec('0x23')](function(_0x4bd26b){if(_0x4bd26b&&_0x4bd26b[_0x26ec('0x68')]===0x0){return db[_0x26ec('0x3b')][_0x26ec('0x61')]({'name':_0x5f599c[_0x26ec('0x3e')],'resourceId':_0x5f599c['id'],'type':_0x4bd26b[_0x26ec('0x3e')],'sectionId':_0x4bd26b['id']},{})[_0x26ec('0x23')](function(){return _0x92dd6f;});}else{return _0x92dd6f;}})[_0x26ec('0x2c')](function(_0x4a9218){logger[_0x26ec('0x27')](_0x26ec('0x69'),_0x4a9218);throw _0x4a9218;});}return _0x92dd6f;})['then'](respondWithResult(_0x11440c,0xc9))[_0x26ec('0x2c')](handleError(_0x11440c,null));};exports[_0x26ec('0x6a')]=function(_0x329899,_0x2d93e9){if(_0x329899[_0x26ec('0x62')]['id']){delete _0x329899[_0x26ec('0x62')]['id'];}return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x329899[_0x26ec('0x5b')]['id']},'include':[{'model':db[_0x26ec('0x5c')],'as':_0x26ec('0x40')}]})[_0x26ec('0x23')](handleEntityNotFound(_0x2d93e9,null))[_0x26ec('0x23')](saveUpdates(_0x329899[_0x26ec('0x62')],null))[_0x26ec('0x23')](respondWithResult(_0x2d93e9,null))['catch'](handleError(_0x2d93e9,null));};exports['destroy']=function(_0x4b3718,_0x57144c){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x4b3718[_0x26ec('0x5b')]['id']}})['then'](handleEntityNotFound(_0x57144c,null))[_0x26ec('0x23')](removeEntity(_0x57144c,null))['catch'](handleError(_0x57144c,null));};exports[_0x26ec('0x6b')]=function(_0x80a521,_0x364d24){return db['OpenchannelAccount'][_0x26ec('0x6b')]()[_0x26ec('0x23')](respondWithResult(_0x364d24,null))[_0x26ec('0x2c')](handleError(_0x364d24,null));};exports[_0x26ec('0x6c')]=function(_0x1c0c79,_0x48de36,_0x169a12){if(_0x1c0c79[_0x26ec('0x62')]['id']){delete _0x1c0c79['body']['id'];}return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x1c0c79[_0x26ec('0x5b')]['id']}})['then'](handleEntityNotFound(_0x48de36,null))[_0x26ec('0x23')](function(_0xb64f7a){if(_0xb64f7a){_0x1c0c79[_0x26ec('0x62')][_0x26ec('0x6d')]=_0xb64f7a['id'];return db[_0x26ec('0x6e')][_0x26ec('0x61')](_0x1c0c79[_0x26ec('0x62')]);}})[_0x26ec('0x23')](respondWithResult(_0x48de36,null))[_0x26ec('0x2c')](handleError(_0x48de36,null));};exports[_0x26ec('0x6f')]=function(_0x1ab092,_0x6ab7d4,_0x1f5fc4){var _0x2ad951={'raw':![],'where':{}};var _0x20d69e={};var _0x463cba={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1ab092[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x6ab7d4,null))[_0x26ec('0x23')](function(_0x3ca5ce){if(_0x3ca5ce){_0x20d69e[_0x26ec('0x47')]=_[_0x26ec('0x49')](db['Disposition'][_0x26ec('0x43')]);_0x20d69e[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x1ab092[_0x26ec('0x48')]);_0x20d69e[_0x26ec('0x54')]=_[_0x26ec('0x4a')](_0x20d69e[_0x26ec('0x47')],_0x20d69e[_0x26ec('0x48')]);_0x2ad951[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x20d69e[_0x26ec('0x47')],qs['fields'](_0x1ab092[_0x26ec('0x48')][_0x26ec('0x4c')]));_0x2ad951[_0x26ec('0x4b')]=_0x2ad951['attributes'][_0x26ec('0x4d')]?_0x2ad951[_0x26ec('0x4b')]:_0x20d69e['model'];if(!_0x1ab092[_0x26ec('0x48')]['hasOwnProperty'](_0x26ec('0x4f'))){_0x2ad951[_0x26ec('0x50')]=qs[_0x26ec('0x50')](_0x1ab092[_0x26ec('0x48')][_0x26ec('0x50')]);_0x2ad951[_0x26ec('0x30')]=qs['offset'](_0x1ab092[_0x26ec('0x48')][_0x26ec('0x30')]);}_0x2ad951['order']=qs[_0x26ec('0x52')](_0x1ab092[_0x26ec('0x48')]['sort']);_0x2ad951[_0x26ec('0x53')]=qs['filters'](_[_0x26ec('0x55')](_0x1ab092[_0x26ec('0x48')],_0x20d69e['filters']));_0x2ad951[_0x26ec('0x53')][_0x26ec('0x6d')]=_0x3ca5ce['id'];if(_0x1ab092['query'][_0x26ec('0x56')]){_0x2ad951[_0x26ec('0x53')]=_[_0x26ec('0x5e')](_0x2ad951[_0x26ec('0x53')],{'$or':_[_0x26ec('0x41')](_0x2ad951[_0x26ec('0x4b')],function(_0x2765bc){var _0x5e46c8={};_0x5e46c8[_0x2765bc]={'$like':'%'+_0x1ab092[_0x26ec('0x48')][_0x26ec('0x56')]+'%'};return _0x5e46c8;})});}_0x2ad951=_['merge']({},_0x2ad951,_0x1ab092['options']);return db['Disposition'][_0x26ec('0x32')]({'where':_0x2ad951[_0x26ec('0x53')]})[_0x26ec('0x23')](function(_0x51cf47){_0x463cba[_0x26ec('0x32')]=_0x51cf47;if(_0x1ab092[_0x26ec('0x48')][_0x26ec('0x5d')]){_0x2ad951[_0x26ec('0x58')]=[{'all':!![]}];}return db[_0x26ec('0x6e')][_0x26ec('0x70')](_0x2ad951);})[_0x26ec('0x23')](function(_0x597c97){_0x463cba[_0x26ec('0x59')]=_0x597c97;return _0x463cba;});}})[_0x26ec('0x23')](respondWithFilteredResult(_0x6ab7d4,_0x2ad951))[_0x26ec('0x2c')](handleError(_0x6ab7d4,null));};exports[_0x26ec('0x71')]=function(_0x18a155,_0x457b03,_0x3bbd9c){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x18a155[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x457b03,null))[_0x26ec('0x23')](function(_0x260436){if(_0x260436){return _0x260436[_0x26ec('0x71')](_0x18a155[_0x26ec('0x48')][_0x26ec('0x72')]);}})[_0x26ec('0x23')](respondWithStatusCode(_0x457b03,null))[_0x26ec('0x2c')](handleError(_0x457b03,null));};exports[_0x26ec('0x73')]=function(_0x289ca2,_0x3d197f,_0x15d5dd){if(_0x289ca2[_0x26ec('0x62')]['id']){delete _0x289ca2[_0x26ec('0x62')]['id'];}return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x289ca2['params']['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x3d197f,null))[_0x26ec('0x23')](function(_0x42ae13){if(_0x42ae13){_0x289ca2[_0x26ec('0x62')][_0x26ec('0x6d')]=_0x42ae13['id'];return db[_0x26ec('0x74')][_0x26ec('0x61')](_0x289ca2[_0x26ec('0x62')]);}})[_0x26ec('0x23')](respondWithResult(_0x3d197f,null))['catch'](handleError(_0x3d197f,null));};exports[_0x26ec('0x75')]=function(_0x3ce8eb,_0x248ca0,_0xa43ab5){var _0x101cfc={'raw':![],'where':{}};var _0x9eaa77={};var _0x13ca0b={'count':0x0,'rows':[]};return db[_0x26ec('0x42')]['findOne']({'where':{'id':_0x3ce8eb[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x248ca0,null))['then'](function(_0x2b14c8){if(_0x2b14c8){_0x9eaa77[_0x26ec('0x47')]=_['keys'](db['CannedAnswer'][_0x26ec('0x43')]);_0x9eaa77[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x3ce8eb[_0x26ec('0x48')]);_0x9eaa77[_0x26ec('0x54')]=_[_0x26ec('0x4a')](_0x9eaa77[_0x26ec('0x47')],_0x9eaa77[_0x26ec('0x48')]);_0x101cfc[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x9eaa77[_0x26ec('0x47')],qs[_0x26ec('0x4c')](_0x3ce8eb['query'][_0x26ec('0x4c')]));_0x101cfc['attributes']=_0x101cfc['attributes']['length']?_0x101cfc['attributes']:_0x9eaa77[_0x26ec('0x47')];if(!_0x3ce8eb[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0x101cfc[_0x26ec('0x50')]=qs['limit'](_0x3ce8eb['query']['limit']);_0x101cfc[_0x26ec('0x30')]=qs[_0x26ec('0x30')](_0x3ce8eb[_0x26ec('0x48')][_0x26ec('0x30')]);}_0x101cfc['order']=qs[_0x26ec('0x52')](_0x3ce8eb['query'][_0x26ec('0x52')]);_0x101cfc[_0x26ec('0x53')]=qs[_0x26ec('0x54')](_[_0x26ec('0x55')](_0x3ce8eb[_0x26ec('0x48')],_0x9eaa77['filters']));_0x101cfc[_0x26ec('0x53')]['OpenchannelAccountId']=_0x2b14c8['id'];if(_0x3ce8eb[_0x26ec('0x48')][_0x26ec('0x56')]){_0x101cfc[_0x26ec('0x53')]=_[_0x26ec('0x5e')](_0x101cfc[_0x26ec('0x53')],{'$or':_['map'](_0x101cfc[_0x26ec('0x4b')],function(_0x5c9f1f){var _0x19ac76={};_0x19ac76[_0x5c9f1f]={'$like':'%'+_0x3ce8eb[_0x26ec('0x48')][_0x26ec('0x56')]+'%'};return _0x19ac76;})});}_0x101cfc=_[_0x26ec('0x5e')]({},_0x101cfc,_0x3ce8eb['options']);return db[_0x26ec('0x74')]['count']({'where':_0x101cfc[_0x26ec('0x53')]})[_0x26ec('0x23')](function(_0x1f3972){_0x13ca0b['count']=_0x1f3972;if(_0x3ce8eb['query'][_0x26ec('0x5d')]){_0x101cfc[_0x26ec('0x58')]=[{'all':!![]}];}return db[_0x26ec('0x74')][_0x26ec('0x70')](_0x101cfc);})['then'](function(_0x53471c){_0x13ca0b[_0x26ec('0x59')]=_0x53471c;return _0x13ca0b;});}})['then'](respondWithFilteredResult(_0x248ca0,_0x101cfc))[_0x26ec('0x2c')](handleError(_0x248ca0,null));};exports['removeAnswers']=function(_0x430bb4,_0x4da032,_0x136140){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x430bb4[_0x26ec('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4da032,null))[_0x26ec('0x23')](function(_0x24f3b8){if(_0x24f3b8){return _0x24f3b8[_0x26ec('0x76')](_0x430bb4['query'][_0x26ec('0x72')]);}})['then'](respondWithStatusCode(_0x4da032,null))[_0x26ec('0x2c')](handleError(_0x4da032,null));};exports[_0x26ec('0x77')]=function(_0x2a6c21,_0x48d67c,_0x1c885f){var _0x6cd0f6={'body':_0x2a6c21[_0x26ec('0x62')],'channel':_0x26ec('0x78')};var _0x44de7e=[];var _0x594632=[];var _0x13ef95={};var _0x14dd26=![];return db[_0x26ec('0x79')]['describe']()[_0x26ec('0x23')](function(_0x4b5cf8){if(!_0x4b5cf8){throw new db['Sequelize'][(_0x26ec('0x7a'))](_0x26ec('0x7b'));}_0x44de7e=_['difference'](_['keys'](_0x4b5cf8),[_0x26ec('0x7c'),_0x26ec('0x7d')]);_0x594632=_[_0x26ec('0x7e')](_['keys'](_0x4b5cf8),[_0x26ec('0x7c'),_0x26ec('0x7d'),_0x26ec('0x7f'),'ListId']);if(_0x2a6c21[_0x26ec('0x62')]['id']){delete _0x2a6c21['body']['id'];}if(_[_0x26ec('0x80')](_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x81')])){throw new db['Sequelize'][(_0x26ec('0x7a'))](_0x26ec('0x82'));}if(_[_0x26ec('0x80')](_0x2a6c21[_0x26ec('0x62')]['body'])||_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x62')]===''){throw new db[(_0x26ec('0x83'))]['ValidationError'](_0x26ec('0x84'));}if(_[_0x26ec('0x80')](_0x2a6c21[_0x26ec('0x62')]['mapKey'])){throw new db[(_0x26ec('0x83'))][(_0x26ec('0x7a'))](_0x26ec('0x85')+_0x594632);}if(!_[_0x26ec('0x86')](_0x594632,_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x87')])){throw new db[(_0x26ec('0x83'))][(_0x26ec('0x7a'))](_0x26ec('0x88')+_0x594632);}_0x13ef95[_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x87')]]=_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x81')];})['then'](function(){return db[_0x26ec('0x42')]['find']({'where':{'id':_0x2a6c21[_0x26ec('0x5b')]['id']},'include':[{'model':db[_0x26ec('0x89')],'as':'List','include':[{'model':db[_0x26ec('0x79')],'as':_0x26ec('0x8a'),'where':_0x13ef95,'limit':0x1,'order':[[_0x26ec('0x7d'),_0x26ec('0x8b')]]}]},{'model':db[_0x26ec('0x8c')],'as':_0x26ec('0x8d')}]});})[_0x26ec('0x23')](handleEntityNotFound(_0x48d67c,null))[_0x26ec('0x23')](function(_0x4978d0){if(_0x4978d0&&_0x4978d0[_0x26ec('0x8e')]){_0x6cd0f6['account']=_0x4978d0;_0x6cd0f6['applications']=_0x4978d0[_0x26ec('0x8d')];_0x6cd0f6['list']=_0x4978d0[_0x26ec('0x8e')];_0x6cd0f6[_0x26ec('0x8f')]=_[_0x26ec('0x90')](_0x6cd0f6[_0x26ec('0x8f')],[_0x26ec('0x91')],['asc']);if(_0x6cd0f6['account']['Applications']){delete _0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x8d')];}if(_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x8e')]&&_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x8e')][_0x26ec('0x8a')][_0x26ec('0x4d')]){return _0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x8e')]['Contacts'][0x0];}var _0x486a4e=_[_0x26ec('0x1a')](_0x2a6c21[_0x26ec('0x62')],{'firstName':_0x2a6c21['body']['from'],'ListId':_0x4978d0[_0x26ec('0x93')]});_0x486a4e[_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x87')]]=_0x2a6c21[_0x26ec('0x62')]['from'];return db[_0x26ec('0x79')]['create'](_0x486a4e,{'fields':_0x44de7e,'raw':!![]});}})[_0x26ec('0x23')](handleEntityNotFound(_0x48d67c,null))[_0x26ec('0x23')](function(_0x33a744){_0x6cd0f6[_0x26ec('0x94')]=_0x33a744;if(_0x33a744){var _0x5574c9={'ContactId':_0x33a744['id'],'OpenchannelAccountId':_0x2a6c21['params']['id'],'from':(_0x33a744['firstName']||'')+'\x20'+(_0x33a744['lastName']||'')};var _0x1373ce={'OpenchannelAccountId':_0x2a6c21['params']['id'],'closed':![]};if(_0x2a6c21[_0x26ec('0x62')]['threadId']){_0x1373ce[_0x26ec('0x95')]=_0x2a6c21[_0x26ec('0x62')]['threadId'];return db[_0x26ec('0x96')][_0x26ec('0x60')]({'where':_0x1373ce})[_0x26ec('0x23')](function(_0x18f802){if(_0x18f802){return[_0x18f802,![]];}_0x5574c9[_0x26ec('0x95')]=_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x95')];_0x5574c9[_0x26ec('0x97')]=_0x2a6c21['body'][_0x26ec('0x97')];return db[_0x26ec('0x96')]['create'](_0x5574c9)['then'](function(_0x2b0b3e){return[_0x2b0b3e,!![]];});});}else{_0x1373ce[_0x26ec('0x95')]=null;}_0x1373ce[_0x26ec('0x98')]=_0x33a744['id'];return db['OpenchannelInteraction']['find']({'where':_0x1373ce})['then'](function(_0x50e1ab){if(_0x50e1ab){return[_0x50e1ab,![]];}return db['OpenchannelInteraction'][_0x26ec('0x61')](_0x5574c9)[_0x26ec('0x23')](function(_0x2f8396){return[_0x2f8396,!![]];});});}})[_0x26ec('0x99')](function(_0x1c9101,_0x3f6943){if(_0x1c9101){_0x14dd26=_0x3f6943;if(!_0x3f6943){var _0x207ea5={'from':(_0x6cd0f6['contact'][_0x26ec('0x9a')]||'')+'\x20'+(_0x6cd0f6[_0x26ec('0x94')][_0x26ec('0x9b')]||'')};if(_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x95')]&&_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x9c')]&&_0x2a6c21['body']['threadId']!=_0x2a6c21['body']['messageId']){_0x207ea5[_0x26ec('0x95')]=_0x2a6c21[_0x26ec('0x62')]['messageId'];}return _0x1c9101[_0x26ec('0x6a')](_0x207ea5);}else{return _0x1c9101;}}})['then'](function(_0x1b0f41){_0x6cd0f6['interaction']=_0x1b0f41[_0x26ec('0x39')]({'plain':!![]});_0x6cd0f6[_0x26ec('0x9d')][_0x26ec('0x9e')]=_0x14dd26;if(_0x6cd0f6['interaction'][_0x26ec('0x9e')]){if(_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x9f')]){_0x6cd0f6[_0x26ec('0x8f')][_0x26ec('0xa0')]({'id':0x0,'priority':_0x6cd0f6['applications']['length']+0x1,'app':_0x26ec('0xa1'),'appdata':_0x26ec('0xa2'),'interval':_0x26ec('0xa3')});}}return db[_0x26ec('0xa4')][_0x26ec('0x61')]({'body':_0x2a6c21['body']['body'],'OpenchannelAccountId':_0x2a6c21[_0x26ec('0x5b')]['id'],'OpenchannelInteractionId':_0x1b0f41['id'],'direction':'in','ContactId':_0x6cd0f6[_0x26ec('0x94')]['id'],'AttachmentId':_0x2a6c21[_0x26ec('0x62')][_0x26ec('0xa5')]});})[_0x26ec('0x23')](function(_0x2ee8e7){_0x6cd0f6[_0x26ec('0x2a')]=_0x2ee8e7;if(!_0x6cd0f6['interaction'][_0x26ec('0xa6')])return;return db['User'][_0x26ec('0x60')]({'attributes':['id',_0x26ec('0x3e')],'where':{'id':_0x6cd0f6[_0x26ec('0x9d')]['UserId']}});})[_0x26ec('0x23')](function(_0x143591){if(_0x143591){_0x6cd0f6[_0x26ec('0x8f')][_0x26ec('0xa7')]({'id':0x0,'priority':0x0,'app':_0x26ec('0xa8'),'appdata':_0x143591['name']+','+(_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0xa9')]||0xa),'interval':_0x26ec('0xa3')});}if(!_0x6cd0f6[_0x26ec('0x9d')][_0x26ec('0xaa')])return;return db[_0x26ec('0xab')]['find']({'attributes':['id',_0x26ec('0x3e')],'where':{'id':_0x6cd0f6[_0x26ec('0x9d')][_0x26ec('0xaa')]}});})[_0x26ec('0x23')](function(_0xdef8cd){if(_0xdef8cd){_0x6cd0f6['applications'][_0x26ec('0xa7')]({'id':0x0,'priority':0x1,'app':_0x26ec('0xac'),'appdata':_0xdef8cd[_0x26ec('0x3e')]+','+(_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0xad')]||0x12c),'interval':_0x26ec('0xa3')});}return respondWithRpcPromise(_0x26ec('0xae'),'startRouting',_0x6cd0f6);})[_0x26ec('0x23')](function(_0x21b8e7){respondWithRpcPromise(_0x26ec('0xaf'),_0x26ec('0xaf'),{'event':'notify','message':_0x21b8e7},client9002);return _0x21b8e7;})[_0x26ec('0x23')](respondWithResult(_0x48d67c,null))[_0x26ec('0x2c')](handleError(_0x48d67c,null));};exports[_0x26ec('0xb0')]=function(_0xd7195f,_0x1debd5){var _0x3c0ed1=_0xd7195f['params']['id'];var _0x4d439d=_0xd7195f[_0x26ec('0x62')];var _0x4abd0e=0xc8;var _0x46d2b3=null;return db[_0x26ec('0xb1')]['transaction']({'isolationLevel':db['sequelize'][_0x26ec('0xb2')][_0x26ec('0xb3')][_0x26ec('0xb4')]},function(_0x17a503){return db['OpenchannelAccount'][_0x26ec('0xb5')]({'where':{'id':_0x3c0ed1},'transaction':_0x17a503})[_0x26ec('0x23')](function(_0x229948){if(_0x229948){return db[_0x26ec('0x8c')][_0x26ec('0x38')]({'where':{'OpenchannelAccountId':_0x3c0ed1},'transaction':_0x17a503})[_0x26ec('0x23')](function(){var _0x243a65=_[_0x26ec('0x41')](_0x4d439d,function(_0x4af2f4){_0x4af2f4[_0x26ec('0x6d')]=_0x3c0ed1;return _0x4af2f4;});return db[_0x26ec('0x8c')]['bulkCreate'](_0x243a65,{'transaction':_0x17a503});});}else{_0x4abd0e=0x194;_0x46d2b3=[];}});})[_0x26ec('0x23')](function(){if(_0x4abd0e!==0x194){return db[_0x26ec('0x8c')][_0x26ec('0xb6')]({'where':{'OpenchannelAccountId':_0x3c0ed1},'order':'priority'})[_0x26ec('0x23')](function(_0x4ee48e){_0x46d2b3=_0x4ee48e;});}})[_0x26ec('0x2c')](function(_0x2de290){_0x4abd0e=0x1f4;logger[_0x26ec('0x27')](_0x2de290['stack']);if(_0x2de290['name']){delete _0x2de290['name'];}_0x46d2b3=_0x2de290;})['finally'](function(){if(_0x46d2b3===null){_0x1debd5[_0x26ec('0x3c')](_0x4abd0e);}else{if(_0x4abd0e===0x1f4){_0x1debd5[_0x26ec('0x2e')](_0x4abd0e)['send'](_0x46d2b3);}else{_0x1debd5[_0x26ec('0x2e')](_0x4abd0e)[_0x26ec('0x2f')](_0x46d2b3);}}});};exports[_0x26ec('0xb7')]=function(_0x10513b,_0x27492d,_0x43b770){var _0x33f661={};var _0x4968a5={};var _0x40c72b;var _0x1c28b4;return db[_0x26ec('0x42')][_0x26ec('0xb5')]({'where':{'id':_0x10513b[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x27492d,null))['then'](function(_0x3faae3){if(_0x3faae3){_0x40c72b=_0x3faae3;_0x4968a5[_0x26ec('0x47')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x4968a5[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x10513b[_0x26ec('0x48')]);_0x4968a5[_0x26ec('0x54')]=_[_0x26ec('0x4a')](_0x4968a5[_0x26ec('0x47')],_0x4968a5[_0x26ec('0x48')]);_0x33f661[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x4968a5['model'],qs[_0x26ec('0x4c')](_0x10513b[_0x26ec('0x48')][_0x26ec('0x4c')]));_0x33f661[_0x26ec('0x4b')]=_0x33f661[_0x26ec('0x4b')]['length']?_0x33f661[_0x26ec('0x4b')]:_0x4968a5[_0x26ec('0x47')];_0x33f661[_0x26ec('0x51')]=qs[_0x26ec('0x52')](_0x10513b[_0x26ec('0x48')][_0x26ec('0x52')]);_0x33f661['where']=qs[_0x26ec('0x54')](_['pick'](_0x10513b[_0x26ec('0x48')],_0x4968a5['filters']));if(_0x10513b[_0x26ec('0x48')]['filter']){_0x33f661[_0x26ec('0x53')]=_[_0x26ec('0x5e')](_0x33f661['where'],{'$or':_['map'](_0x33f661[_0x26ec('0x4b')],function(_0x3730dd){var _0x550ef1={};_0x550ef1[_0x3730dd]={'$like':'%'+_0x10513b[_0x26ec('0x48')][_0x26ec('0x56')]+'%'};return _0x550ef1;})});}_0x33f661=_['merge']({},_0x33f661,_0x10513b['options']);return _0x40c72b[_0x26ec('0xb7')](_0x33f661);}})['then'](function(_0x21089c){if(_0x21089c){_0x1c28b4=_0x21089c['length'];if(!_0x10513b[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0x33f661['limit']=qs['limit'](_0x10513b[_0x26ec('0x48')][_0x26ec('0x50')]);_0x33f661[_0x26ec('0x30')]=qs[_0x26ec('0x30')](_0x10513b['query'][_0x26ec('0x30')]);}return _0x40c72b[_0x26ec('0xb7')](_0x33f661);}})[_0x26ec('0x23')](function(_0x18db24){if(_0x18db24){return _0x18db24?{'count':_0x1c28b4,'rows':_0x18db24}:null;}})[_0x26ec('0x23')](respondWithResult(_0x27492d,null))[_0x26ec('0x2c')](handleError(_0x27492d,null));};exports[_0x26ec('0xb8')]=function(_0x44416b,_0x344173,_0x46cfd4){var _0x4fdf95={'raw':![],'where':{}};var _0xa8a550={};var _0x1768e3={'count':0x0,'rows':[]};return db[_0x26ec('0x42')]['findOne']({'where':{'id':_0x44416b[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x344173,null))[_0x26ec('0x23')](function(_0x4e5a0d){if(_0x4e5a0d){_0xa8a550[_0x26ec('0x47')]=_['keys'](db['OpenchannelInteraction'][_0x26ec('0x43')]);_0xa8a550['query']=_[_0x26ec('0x49')](_0x44416b[_0x26ec('0x48')]);_0xa8a550[_0x26ec('0x54')]=_[_0x26ec('0x4a')](_0xa8a550[_0x26ec('0x47')],_0xa8a550[_0x26ec('0x48')]);_0x4fdf95[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0xa8a550[_0x26ec('0x47')],qs[_0x26ec('0x4c')](_0x44416b[_0x26ec('0x48')][_0x26ec('0x4c')]));_0x4fdf95['attributes']=_0x4fdf95[_0x26ec('0x4b')][_0x26ec('0x4d')]?_0x4fdf95[_0x26ec('0x4b')]:_0xa8a550[_0x26ec('0x47')];if(!_0x44416b[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0x4fdf95[_0x26ec('0x50')]=qs['limit'](_0x44416b['query'][_0x26ec('0x50')]);_0x4fdf95['offset']=qs[_0x26ec('0x30')](_0x44416b['query'][_0x26ec('0x30')]);}_0x4fdf95[_0x26ec('0x51')]=qs[_0x26ec('0x52')](_0x44416b['query'][_0x26ec('0x52')]);_0x4fdf95[_0x26ec('0x53')]=qs[_0x26ec('0x54')](_[_0x26ec('0x55')](_0x44416b[_0x26ec('0x48')],_0xa8a550[_0x26ec('0x54')]));_0x4fdf95[_0x26ec('0x53')][_0x26ec('0x6d')]=_0x4e5a0d['id'];if(_0x44416b['query'][_0x26ec('0x56')]){_0x4fdf95['where']=_[_0x26ec('0x5e')](_0x4fdf95['where'],{'$or':_[_0x26ec('0x41')](_0x4fdf95[_0x26ec('0x4b')],function(_0x438af7){var _0x306a80={};_0x306a80[_0x438af7]={'$like':'%'+_0x44416b['query'][_0x26ec('0x56')]+'%'};return _0x306a80;})});}_0x4fdf95=_[_0x26ec('0x5e')]({},_0x4fdf95,_0x44416b['options']);return db[_0x26ec('0x96')][_0x26ec('0x32')]({'where':_0x4fdf95[_0x26ec('0x53')]})['then'](function(_0xed753d){_0x1768e3['count']=_0xed753d;if(_0x44416b[_0x26ec('0x48')]['includeAll']){_0x4fdf95[_0x26ec('0x58')]=[{'model':db[_0x26ec('0x79')],'as':_0x26ec('0xb9'),'required':![]},{'model':db['User'],'as':_0x26ec('0xba'),'attributes':[_0x26ec('0x3e'),_0x26ec('0xbb'),_0x26ec('0xbc')],'required':![]},{'model':db[_0x26ec('0xbd')],'as':_0x26ec('0xbe'),'attributes':['id','name',_0x26ec('0xbf')],'where':_0x44416b[_0x26ec('0x48')][_0x26ec('0xc0')]?{'id':_0x44416b[_0x26ec('0x48')]['tag']}:undefined,'required':_0x44416b[_0x26ec('0x48')][_0x26ec('0xc0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x26ec('0x70')](_0x4fdf95);})[_0x26ec('0x23')](function(_0x4e3431){_0x1768e3[_0x26ec('0x59')]=_0x4e3431;return _0x1768e3;});}})['then'](respondWithFilteredResult(_0x344173,_0x4fdf95))['catch'](handleError(_0x344173,null));};exports[_0x26ec('0xc1')]=function(_0x18dbcf,_0xda0a78,_0x2e9dd2){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x18dbcf['params']['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0xda0a78,null))[_0x26ec('0x23')](function(_0xcda910){if(_0xcda910){return _0xcda910[_0x26ec('0xc1')](_0x18dbcf[_0x26ec('0x62')][_0x26ec('0x72')],_[_0x26ec('0xc2')](_0x18dbcf['body'],[_0x26ec('0x72'),'id'])||{})[_0x26ec('0x99')](function(_0x55747d){for(var _0x50ef82=0x0;_0x50ef82<_0x18dbcf[_0x26ec('0x62')]['ids']['length'];_0x50ef82+=0x1){socket[_0x26ec('0xc3')]('userOpenchannelAccount:save',{'UserId':Number(_0x18dbcf[_0x26ec('0x62')][_0x26ec('0x72')][_0x50ef82]),'OpenchannelAccountId':Number(_0x18dbcf[_0x26ec('0x5b')]['id'])});}return _0x55747d;});}})[_0x26ec('0x23')](respondWithResult(_0xda0a78,null))[_0x26ec('0x2c')](handleError(_0xda0a78,null));};exports['removeAgents']=function(_0x5cec80,_0x203b3a,_0x62297e){return db[_0x26ec('0x42')]['find']({'where':{'id':_0x5cec80[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x203b3a,null))[_0x26ec('0x23')](function(_0x3f616b){if(_0x3f616b){return _0x3f616b[_0x26ec('0xc4')](_0x5cec80[_0x26ec('0x48')][_0x26ec('0x72')])[_0x26ec('0x23')](function(){if(_[_0x26ec('0xc5')](_0x5cec80[_0x26ec('0x48')][_0x26ec('0x72')])){for(var _0x4b6e33=0x0;_0x4b6e33<_0x5cec80[_0x26ec('0x48')]['ids']['length'];_0x4b6e33+=0x1){socket['emit'](_0x26ec('0xc6'),{'UserId':Number(_0x5cec80[_0x26ec('0x48')][_0x26ec('0x72')][_0x4b6e33]),'OpenchannelAccountId':Number(_0x5cec80[_0x26ec('0x5b')]['id'])});}}else{socket['emit'](_0x26ec('0xc6'),{'UserId':Number(_0x5cec80['query']['ids']),'OpenchannelAccountId':Number(_0x5cec80[_0x26ec('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x203b3a,null))['catch'](handleError(_0x203b3a,null));};exports[_0x26ec('0xc7')]=function(_0x4c0f82,_0x2d060e,_0xa31d01){var _0x1ab6f9={};var _0x4a823e={};var _0x3b92d9;var _0x564c00;return db['OpenchannelAccount'][_0x26ec('0xb5')]({'where':{'id':_0x4c0f82['params']['id']}})['then'](handleEntityNotFound(_0x2d060e,null))[_0x26ec('0x23')](function(_0x1a7b51){if(_0x1a7b51){_0x3b92d9=_0x1a7b51;_0x4a823e[_0x26ec('0x47')]=_['keys'](db[_0x26ec('0xc8')][_0x26ec('0x43')]);_0x4a823e[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x4c0f82[_0x26ec('0x48')]);_0x4a823e[_0x26ec('0x54')]=_['intersection'](_0x4a823e[_0x26ec('0x47')],_0x4a823e[_0x26ec('0x48')]);_0x1ab6f9['attributes']=_[_0x26ec('0x4a')](_0x4a823e[_0x26ec('0x47')],qs[_0x26ec('0x4c')](_0x4c0f82[_0x26ec('0x48')]['fields']));_0x1ab6f9[_0x26ec('0x4b')]=_0x1ab6f9['attributes']['length']?_0x1ab6f9['attributes']:_0x4a823e[_0x26ec('0x47')];_0x1ab6f9[_0x26ec('0x51')]=qs[_0x26ec('0x52')](_0x4c0f82['query'][_0x26ec('0x52')]);_0x1ab6f9[_0x26ec('0x53')]=qs[_0x26ec('0x54')](_['pick'](_0x4c0f82['query'],_0x4a823e[_0x26ec('0x54')]));if(_0x4c0f82['query'][_0x26ec('0x56')]){_0x1ab6f9[_0x26ec('0x53')]=_[_0x26ec('0x5e')](_0x1ab6f9[_0x26ec('0x53')],{'$or':_[_0x26ec('0x41')](_0x1ab6f9[_0x26ec('0x4b')],function(_0x106f13){var _0x210cc5={};_0x210cc5[_0x106f13]={'$like':'%'+_0x4c0f82['query']['filter']+'%'};return _0x210cc5;})});}_0x1ab6f9=_[_0x26ec('0x5e')]({},_0x1ab6f9,_0x4c0f82['options']);return _0x3b92d9[_0x26ec('0xc7')](_0x1ab6f9);}})[_0x26ec('0x23')](function(_0x4697c6){if(_0x4697c6){_0x564c00=_0x4697c6[_0x26ec('0x4d')];if(!_0x4c0f82[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0x1ab6f9['limit']=qs[_0x26ec('0x50')](_0x4c0f82['query'][_0x26ec('0x50')]);_0x1ab6f9[_0x26ec('0x30')]=qs[_0x26ec('0x30')](_0x4c0f82[_0x26ec('0x48')][_0x26ec('0x30')]);}return _0x3b92d9['getAgents'](_0x1ab6f9);}})[_0x26ec('0x23')](function(_0x4e383b){if(_0x4e383b){return _0x4e383b?{'count':_0x564c00,'rows':_0x4e383b}:null;}})[_0x26ec('0x23')](respondWithResult(_0x2d060e,null))[_0x26ec('0x2c')](handleError(_0x2d060e,null));};exports['send']=function(_0x5cce32,_0x5a9be4,_0x4cad1f){var _0x425a36,_0x1ac026,_0xbdc050;if(_[_0x26ec('0x80')](_0x5cce32[_0x26ec('0x62')]['body'])||_0x5cce32[_0x26ec('0x62')]['body']===''){throw new db[(_0x26ec('0x83'))][(_0x26ec('0x7a'))](_0x26ec('0x84'));}if(_['isNil'](_0x5cce32[_0x26ec('0x62')]['to'])){}_0x425a36=_0x5cce32[_0x26ec('0x62')]['to'];return db[_0x26ec('0x42')][_0x26ec('0xb5')]({'where':{'id':_0x5cce32[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x5a9be4,null))[_0x26ec('0x23')](function(_0x2bca8c){if(_0x2bca8c){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x2bca8c['id']},'include':[{'model':db[_0x26ec('0x89')],'as':_0x26ec('0x8e'),'include':[{'model':db[_0x26ec('0x79')],'as':'Contacts','where':{[_0x2bca8c[_0x26ec('0x87')]]:_0x425a36},'limit':0x1,'order':[[_0x26ec('0x7d'),_0x26ec('0x8b')]]}]}]})[_0x26ec('0x23')](handleEntityNotFound(_0x5a9be4,null))['then'](function(_0x182b74){if(_0x182b74&&_0x182b74[_0x26ec('0x8e')]){_0x1ac026=_0x182b74[_0x26ec('0x39')]({'plain':!![]});if(_0x1ac026[_0x26ec('0x8e')]&&_0x1ac026[_0x26ec('0x8e')][_0x26ec('0x8a')]['length']){return _0x1ac026['List'][_0x26ec('0x8a')][0x0];}return db[_0x26ec('0x79')][_0x26ec('0x61')](_[_0x26ec('0x1a')](_0x5cce32['body'],{'firstName':_0x425a36,[_0x182b74[_0x26ec('0x87')]]:_0x425a36,'phone':_0x425a36,'ListId':_0x1ac026[_0x26ec('0x93')]}));}})['then'](handleEntityNotFound(_0x5a9be4,null))[_0x26ec('0x23')](function(_0x56df70){if(_0x56df70){_0xbdc050=_0x56df70;return db[_0x26ec('0x96')][_0x26ec('0x60')]({'where':{'ContactId':_0xbdc050['id'],'closed':![],'OpenchannelAccountId':_0x1ac026['id']}})[_0x26ec('0x23')](function(_0x322847){if(_0x322847){return[_0x322847,![]];}return db[_0x26ec('0x96')][_0x26ec('0x61')]({'UserId':_0x5cce32[_0x26ec('0x63')]['id'],'ContactId':_0xbdc050['id'],'OpenchannelAccountId':_0x1ac026['id'],'lastMsgDirection':_0x26ec('0xc9'),'firstMsgDirection':_0x26ec('0xc9'),'Messages':[_[_0x26ec('0x5e')](_0x5cce32[_0x26ec('0x62')],{'read':![],'body':_0x5cce32[_0x26ec('0x62')][_0x26ec('0x62')],'OpenchannelAccountId':_0x1ac026['id'],'UserId':_0x5cce32[_0x26ec('0x63')]['id'],'ContactId':_0xbdc050['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x26ec('0xca')}]})[_0x26ec('0x23')](function(_0xfe2b1c){return[_0xfe2b1c,!![]];});});}})[_0x26ec('0x99')](function(_0x34b736,_0x5a2220){if(_0x5a2220){return _0x34b736;}return db[_0x26ec('0xa4')]['create'](_[_0x26ec('0x5e')](_0x5cce32[_0x26ec('0x62')],{'read':![],'body':_0x5cce32['body'][_0x26ec('0x62')],'OpenchannelAccountId':_0x1ac026['id'],'OpenchannelInteractionId':_0x34b736['id'],'UserId':_0x5cce32['user']['id'],'ContactId':_0xbdc050['id']}))[_0x26ec('0x23')](function(_0x5c04d8){_0x34b736[_0x26ec('0xcb')][_0x26ec('0xca')]=[];_0x34b736[_0x26ec('0xcb')][_0x26ec('0xca')]['push'](_0x5c04d8[_0x26ec('0xcb')]);return _0x34b736;});});}})[_0x26ec('0x23')](respondWithResult(_0x5a9be4,null))[_0x26ec('0x2c')](handleError(_0x5a9be4,null));}; \ No newline at end of file +var _0x720b=['updatedAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','List','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','addApplications','sequelize','READ_COMMITTED','bulkCreate','priority','finally','getApplications','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','count','limit','set','reject','update','destroy','get','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','mandatoryDispositionPause','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','order','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','openchannel','Sequelize','no\x20available\x20attributes','difference','createdAt'];(function(_0x5e3b50,_0x142cc7){var _0x30f989=function(_0x11eff3){while(--_0x11eff3){_0x5e3b50['push'](_0x5e3b50['shift']());}};_0x30f989(++_0x142cc7);}(_0x720b,0x1d8));var _0xb720=function(_0x3bbb38,_0x3054df){_0x3bbb38=_0x3bbb38-0x0;var _0x34e7be=_0x720b[_0x3bbb38];return _0x34e7be;};'use strict';var emlformat=require(_0xb720('0x0'));var rimraf=require(_0xb720('0x1'));var zipdir=require(_0xb720('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb720('0x3'));var moment=require(_0xb720('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb720('0x5'));var util=require(_0xb720('0x6'));var path=require(_0xb720('0x7'));var sox=require('sox');var csv=require(_0xb720('0x8'));var ejs=require(_0xb720('0x9'));var fs=require('fs');var fs_extra=require(_0xb720('0xa'));var _=require(_0xb720('0xb'));var squel=require(_0xb720('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb720('0xd'));var toCsv=require(_0xb720('0x8'));var querystring=require(_0xb720('0xe'));var Papa=require(_0xb720('0xf'));var Redis=require(_0xb720('0x10'));var authService=require(_0xb720('0x11'));var qs=require(_0xb720('0x12'));var as=require(_0xb720('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb720('0x14'))(_0xb720('0x15'));var utils=require('../../config/utils');var config=require(_0xb720('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb720('0x17'))['db'];config['redis']=_[_0xb720('0x18')](config[_0xb720('0x19')],{'host':_0xb720('0x1a'),'port':0x18eb});var socket=require(_0xb720('0x1b'))(new Redis(config[_0xb720('0x19')]));require(_0xb720('0x1c'))[_0xb720('0x1d')](socket);var jayson=require(_0xb720('0x1e'));var client=jayson['client'][_0xb720('0x1f')]({'port':0x232c});var client9002=jayson[_0xb720('0x20')][_0xb720('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5a675d,_0x4edde2,_0xc890b,_0x39df81){return new BPromise(function(_0x373303,_0x5bba74){var _0x1bda26=_0x39df81||client;return _0x1bda26[_0xb720('0x21')](_0x5a675d,_0xc890b)[_0xb720('0x22')](function(_0x2cf456){logger[_0xb720('0x23')](_0xb720('0x24'),_0x4edde2,_0xb720('0x25'));logger[_0xb720('0x26')](_0xb720('0x27'),_0x4edde2,_0xb720('0x25'),JSON[_0xb720('0x28')](_0x2cf456));if(_0x2cf456[_0xb720('0x29')]){if(_0x2cf456[_0xb720('0x29')][_0xb720('0x2a')]===0x1f4){logger[_0xb720('0x29')](_0xb720('0x24'),_0x4edde2,_0x2cf456[_0xb720('0x29')][_0xb720('0x2b')]);return _0x5bba74(_0x2cf456[_0xb720('0x29')][_0xb720('0x2b')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4edde2,_0x2cf456['error'][_0xb720('0x2b')]);return _0x373303(_0x2cf456['error'][_0xb720('0x2b')]);}else{logger[_0xb720('0x23')](_0xb720('0x24'),_0x4edde2,_0xb720('0x25'));_0x373303(_0x2cf456[_0xb720('0x2c')][_0xb720('0x2b')]);}})['catch'](function(_0x498860){logger['error'](_0xb720('0x24'),_0x4edde2,_0x498860);_0x5bba74(_0x498860);});});}function respondWithStatusCode(_0x408256,_0x5f1e03){_0x5f1e03=_0x5f1e03||0xcc;return function(_0x508eb8){if(_0x508eb8){return _0x408256[_0xb720('0x2d')](_0x5f1e03);}return _0x408256['status'](_0x5f1e03)[_0xb720('0x2e')]();};}function respondWithResult(_0x564e28,_0x4e436f){_0x4e436f=_0x4e436f||0xc8;return function(_0x215548){if(_0x215548){return _0x564e28[_0xb720('0x2f')](_0x4e436f)[_0xb720('0x30')](_0x215548);}};}function respondWithFilteredResult(_0x416161,_0x466405){return function(_0xd25825){if(_0xd25825){var _0x732423=typeof _0x466405[_0xb720('0x31')]==='undefined'&&typeof _0x466405['limit']==='undefined';var _0x3e0b6a=_0xd25825[_0xb720('0x32')];var _0x49b6ae=_0x732423?0x0:_0x466405[_0xb720('0x31')];var _0x558bbe=_0x732423?_0xd25825[_0xb720('0x32')]:_0x466405[_0xb720('0x31')]+_0x466405[_0xb720('0x33')];var _0x31927d;if(_0x558bbe>=_0x3e0b6a){_0x558bbe=_0x3e0b6a;_0x31927d=0xc8;}else{_0x31927d=0xce;}_0x416161[_0xb720('0x2f')](_0x31927d);return _0x416161[_0xb720('0x34')]('Content-Range',_0x49b6ae+'-'+_0x558bbe+'/'+_0x3e0b6a)[_0xb720('0x30')](_0xd25825);}return null;};}function patchUpdates(_0x40752a){return function(_0x26d0fb){try{jsonpatch['apply'](_0x26d0fb,_0x40752a,!![]);}catch(_0x346837){return BPromise[_0xb720('0x35')](_0x346837);}return _0x26d0fb['save']();};}function saveUpdates(_0x5d8dd6,_0x29e540){return function(_0x52aeaa){if(_0x52aeaa){return _0x52aeaa[_0xb720('0x36')](_0x5d8dd6)[_0xb720('0x22')](function(_0x351fa3){return _0x351fa3;});}return null;};}function removeEntity(_0x395afa,_0x510550){return function(_0x591b0e){if(_0x591b0e){return _0x591b0e[_0xb720('0x37')]()[_0xb720('0x22')](function(){var _0x21e561=_0x591b0e[_0xb720('0x38')]({'plain':!![]});var _0x2883e3='OpenchannelAccounts';return db['UserProfileResource'][_0xb720('0x37')]({'where':{'type':_0x2883e3,'resourceId':_0x21e561['id']}})[_0xb720('0x22')](function(){return _0x591b0e;});})[_0xb720('0x22')](function(){_0x395afa[_0xb720('0x2f')](0xcc)[_0xb720('0x2e')]();});}};}function handleEntityNotFound(_0x210fc6,_0x36c53d){return function(_0x3fe6ce){if(!_0x3fe6ce){_0x210fc6[_0xb720('0x2d')](0x194);}return _0x3fe6ce;};}function handleError(_0x4f25b1,_0x57c61e){_0x57c61e=_0x57c61e||0x1f4;return function(_0x37c6c0){logger[_0xb720('0x29')](_0x37c6c0[_0xb720('0x39')]);if(_0x37c6c0[_0xb720('0x3a')]){delete _0x37c6c0[_0xb720('0x3a')];}_0x4f25b1[_0xb720('0x2f')](_0x57c61e)[_0xb720('0x3b')](_0x37c6c0);};}exports[_0xb720('0x3c')]=function(_0xad5038,_0x4aaa5f){var _0x199b6c={'include':[{'model':db[_0xb720('0x3d')],'as':'mandatoryDispositionPause'}]},_0x3e1ee0={},_0x3709e7={'count':0x0,'rows':[]};var _0xb50cec=_[_0xb720('0x3e')](db[_0xb720('0x3f')][_0xb720('0x40')],function(_0x1ad4e0){return{'name':_0x1ad4e0[_0xb720('0x41')],'type':_0x1ad4e0[_0xb720('0x42')][_0xb720('0x43')]};});_0x3e1ee0[_0xb720('0x44')]=_[_0xb720('0x3e')](_0xb50cec,_0xb720('0x3a'));_0x3e1ee0[_0xb720('0x45')]=_[_0xb720('0x46')](_0xad5038['query']);_0x3e1ee0[_0xb720('0x47')]=_[_0xb720('0x48')](_0x3e1ee0[_0xb720('0x44')],_0x3e1ee0['query']);_0x199b6c[_0xb720('0x49')]=_['intersection'](_0x3e1ee0['model'],qs[_0xb720('0x4a')](_0xad5038[_0xb720('0x45')][_0xb720('0x4a')]));_0x199b6c[_0xb720('0x49')]=_0x199b6c['attributes'][_0xb720('0x4b')]?_0x199b6c[_0xb720('0x49')]:_0x3e1ee0['model'];if(!_0xad5038[_0xb720('0x45')][_0xb720('0x4c')](_0xb720('0x4d'))){_0x199b6c[_0xb720('0x33')]=qs[_0xb720('0x33')](_0xad5038[_0xb720('0x45')][_0xb720('0x33')]);_0x199b6c[_0xb720('0x31')]=qs['offset'](_0xad5038[_0xb720('0x45')][_0xb720('0x31')]);}_0x199b6c['order']=qs[_0xb720('0x4e')](_0xad5038['query'][_0xb720('0x4e')]);_0x199b6c[_0xb720('0x4f')]=qs[_0xb720('0x47')](_[_0xb720('0x50')](_0xad5038[_0xb720('0x45')],_0x3e1ee0[_0xb720('0x47')]),_0xb50cec);if(_0xad5038[_0xb720('0x45')]['filter']){_0x199b6c[_0xb720('0x4f')]=_['merge'](_0x199b6c[_0xb720('0x4f')],{'$or':_['map'](_0xb50cec,function(_0x32c59f){if(_0x32c59f[_0xb720('0x42')]!==_0xb720('0x51')){var _0x23f427={};_0x23f427[_0x32c59f[_0xb720('0x3a')]]={'$like':'%'+_0xad5038[_0xb720('0x45')][_0xb720('0x52')]+'%'};return _0x23f427;}})});}_0x199b6c=_[_0xb720('0x53')]({},_0x199b6c,_0xad5038[_0xb720('0x54')]);var _0x4bd743={'where':_0x199b6c['where']};return db[_0xb720('0x3f')][_0xb720('0x32')](_0x4bd743)[_0xb720('0x22')](function(_0xa736f9){_0x3709e7['count']=_0xa736f9;if(_0xad5038[_0xb720('0x45')][_0xb720('0x55')]){_0x199b6c['include']=[{'all':!![]}];}return db[_0xb720('0x3f')][_0xb720('0x56')](_0x199b6c);})['then'](function(_0x3652ef){_0x3709e7['rows']=_0x3652ef;return _0x3709e7;})['then'](respondWithFilteredResult(_0x4aaa5f,_0x199b6c))[_0xb720('0x57')](handleError(_0x4aaa5f,null));};exports[_0xb720('0x58')]=function(_0xc2cdd0,_0x3a51f9){var _0x17e0fd={'raw':![],'where':{'id':_0xc2cdd0[_0xb720('0x59')]['id']},'include':[{'model':db[_0xb720('0x3d')],'as':_0xb720('0x5a')}]},_0x1f79dc={};_0x1f79dc[_0xb720('0x44')]=_[_0xb720('0x46')](db[_0xb720('0x3f')]['rawAttributes']);_0x1f79dc[_0xb720('0x45')]=_[_0xb720('0x46')](_0xc2cdd0[_0xb720('0x45')]);_0x1f79dc['filters']=_['intersection'](_0x1f79dc[_0xb720('0x44')],_0x1f79dc[_0xb720('0x45')]);_0x17e0fd[_0xb720('0x49')]=_[_0xb720('0x48')](_0x1f79dc[_0xb720('0x44')],qs['fields'](_0xc2cdd0['query']['fields']));_0x17e0fd[_0xb720('0x49')]=_0x17e0fd['attributes'][_0xb720('0x4b')]?_0x17e0fd['attributes']:_0x1f79dc[_0xb720('0x44')];if(_0xc2cdd0[_0xb720('0x45')][_0xb720('0x55')]){_0x17e0fd[_0xb720('0x5b')]=[{'all':!![]}];}_0x17e0fd=_['merge']({},_0x17e0fd,_0xc2cdd0[_0xb720('0x54')]);return db[_0xb720('0x3f')][_0xb720('0x5c')](_0x17e0fd)[_0xb720('0x22')](handleEntityNotFound(_0x3a51f9,null))['then'](respondWithResult(_0x3a51f9,null))['catch'](handleError(_0x3a51f9,null));};exports[_0xb720('0x5d')]=function(_0x353828,_0xed2a58){return db[_0xb720('0x3f')][_0xb720('0x5d')](_0x353828[_0xb720('0x5e')],{})[_0xb720('0x22')](function(_0x54cf05){var _0x3291ce=_0x353828[_0xb720('0x5f')][_0xb720('0x38')]({'plain':!![]});if(!_0x3291ce)throw new Error(_0xb720('0x60'));if(_0x3291ce[_0xb720('0x61')]===_0xb720('0x5f')){var _0x3395c3=_0x54cf05[_0xb720('0x38')]({'plain':!![]});var _0x4aae58=_0xb720('0x62');return db[_0xb720('0x63')][_0xb720('0x5c')]({'where':{'name':_0x4aae58,'userProfileId':_0x3291ce[_0xb720('0x64')]},'raw':!![]})[_0xb720('0x22')](function(_0x10b64){if(_0x10b64&&_0x10b64[_0xb720('0x65')]===0x0){return db[_0xb720('0x66')][_0xb720('0x5d')]({'name':_0x3395c3[_0xb720('0x3a')],'resourceId':_0x3395c3['id'],'type':_0x10b64['name'],'sectionId':_0x10b64['id']},{})['then'](function(){return _0x54cf05;});}else{return _0x54cf05;}})[_0xb720('0x57')](function(_0x4fa789){logger[_0xb720('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fa789);throw _0x4fa789;});}return _0x54cf05;})[_0xb720('0x22')](respondWithResult(_0xed2a58,0xc9))[_0xb720('0x57')](handleError(_0xed2a58,null));};exports[_0xb720('0x36')]=function(_0x27c0ad,_0xbb6594){if(_0x27c0ad[_0xb720('0x5e')]['id']){delete _0x27c0ad['body']['id'];}return db[_0xb720('0x3f')][_0xb720('0x5c')]({'where':{'id':_0x27c0ad[_0xb720('0x59')]['id']},'include':[{'model':db[_0xb720('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xb720('0x22')](handleEntityNotFound(_0xbb6594,null))[_0xb720('0x22')](saveUpdates(_0x27c0ad['body'],null))['then'](respondWithResult(_0xbb6594,null))['catch'](handleError(_0xbb6594,null));};exports['destroy']=function(_0x12ceae,_0x4d8c2a){return db[_0xb720('0x3f')][_0xb720('0x5c')]({'where':{'id':_0x12ceae['params']['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x4d8c2a,null))[_0xb720('0x22')](removeEntity(_0x4d8c2a,null))['catch'](handleError(_0x4d8c2a,null));};exports['describe']=function(_0x5c5c8a,_0x6911ef){return db[_0xb720('0x3f')][_0xb720('0x67')]()[_0xb720('0x22')](respondWithResult(_0x6911ef,null))[_0xb720('0x57')](handleError(_0x6911ef,null));};exports[_0xb720('0x68')]=function(_0x57c5a9,_0x1d5318,_0x359a9c){if(_0x57c5a9[_0xb720('0x5e')]['id']){delete _0x57c5a9['body']['id'];}return db[_0xb720('0x3f')][_0xb720('0x5c')]({'where':{'id':_0x57c5a9[_0xb720('0x59')]['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x1d5318,null))[_0xb720('0x22')](function(_0x2d5867){if(_0x2d5867){_0x57c5a9[_0xb720('0x5e')][_0xb720('0x69')]=_0x2d5867['id'];return db['Disposition'][_0xb720('0x5d')](_0x57c5a9['body']);}})[_0xb720('0x22')](respondWithResult(_0x1d5318,null))[_0xb720('0x57')](handleError(_0x1d5318,null));};exports[_0xb720('0x6a')]=function(_0x5ec790,_0x56f32e,_0x409bb3){var _0xffb387={'raw':![],'where':{}};var _0x62986a={};var _0x37b253={'count':0x0,'rows':[]};return db[_0xb720('0x3f')]['findOne']({'where':{'id':_0x5ec790[_0xb720('0x59')]['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x56f32e,null))[_0xb720('0x22')](function(_0x195507){if(_0x195507){_0x62986a[_0xb720('0x44')]=_['keys'](db[_0xb720('0x6b')][_0xb720('0x40')]);_0x62986a[_0xb720('0x45')]=_['keys'](_0x5ec790['query']);_0x62986a[_0xb720('0x47')]=_['intersection'](_0x62986a[_0xb720('0x44')],_0x62986a[_0xb720('0x45')]);_0xffb387[_0xb720('0x49')]=_[_0xb720('0x48')](_0x62986a[_0xb720('0x44')],qs[_0xb720('0x4a')](_0x5ec790[_0xb720('0x45')][_0xb720('0x4a')]));_0xffb387[_0xb720('0x49')]=_0xffb387[_0xb720('0x49')][_0xb720('0x4b')]?_0xffb387[_0xb720('0x49')]:_0x62986a['model'];if(!_0x5ec790['query'][_0xb720('0x4c')](_0xb720('0x4d'))){_0xffb387[_0xb720('0x33')]=qs['limit'](_0x5ec790[_0xb720('0x45')][_0xb720('0x33')]);_0xffb387[_0xb720('0x31')]=qs[_0xb720('0x31')](_0x5ec790[_0xb720('0x45')][_0xb720('0x31')]);}_0xffb387[_0xb720('0x6c')]=qs['sort'](_0x5ec790['query'][_0xb720('0x4e')]);_0xffb387[_0xb720('0x4f')]=qs[_0xb720('0x47')](_['pick'](_0x5ec790['query'],_0x62986a[_0xb720('0x47')]));_0xffb387['where'][_0xb720('0x69')]=_0x195507['id'];if(_0x5ec790[_0xb720('0x45')][_0xb720('0x52')]){_0xffb387[_0xb720('0x4f')]=_[_0xb720('0x53')](_0xffb387[_0xb720('0x4f')],{'$or':_[_0xb720('0x3e')](_0xffb387[_0xb720('0x49')],function(_0x5501f2){var _0x107bfa={};_0x107bfa[_0x5501f2]={'$like':'%'+_0x5ec790[_0xb720('0x45')]['filter']+'%'};return _0x107bfa;})});}_0xffb387=_[_0xb720('0x53')]({},_0xffb387,_0x5ec790['options']);return db['Disposition']['count']({'where':_0xffb387[_0xb720('0x4f')]})[_0xb720('0x22')](function(_0x15266b){_0x37b253[_0xb720('0x32')]=_0x15266b;if(_0x5ec790['query'][_0xb720('0x55')]){_0xffb387[_0xb720('0x5b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xffb387);})[_0xb720('0x22')](function(_0x5c5013){_0x37b253[_0xb720('0x6d')]=_0x5c5013;return _0x37b253;});}})[_0xb720('0x22')](respondWithFilteredResult(_0x56f32e,_0xffb387))[_0xb720('0x57')](handleError(_0x56f32e,null));};exports[_0xb720('0x6e')]=function(_0x23c119,_0x3c475d,_0x14d0fb){return db[_0xb720('0x3f')]['find']({'where':{'id':_0x23c119[_0xb720('0x59')]['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x3c475d,null))[_0xb720('0x22')](function(_0xd57a42){if(_0xd57a42){return _0xd57a42[_0xb720('0x6e')](_0x23c119[_0xb720('0x45')][_0xb720('0x6f')]);}})[_0xb720('0x22')](respondWithStatusCode(_0x3c475d,null))['catch'](handleError(_0x3c475d,null));};exports[_0xb720('0x70')]=function(_0xfae8ef,_0x15edfa,_0x38f26c){if(_0xfae8ef[_0xb720('0x5e')]['id']){delete _0xfae8ef[_0xb720('0x5e')]['id'];}return db[_0xb720('0x3f')][_0xb720('0x5c')]({'where':{'id':_0xfae8ef[_0xb720('0x59')]['id']}})['then'](handleEntityNotFound(_0x15edfa,null))[_0xb720('0x22')](function(_0x53ada5){if(_0x53ada5){_0xfae8ef[_0xb720('0x5e')][_0xb720('0x69')]=_0x53ada5['id'];return db['CannedAnswer']['create'](_0xfae8ef[_0xb720('0x5e')]);}})[_0xb720('0x22')](respondWithResult(_0x15edfa,null))[_0xb720('0x57')](handleError(_0x15edfa,null));};exports[_0xb720('0x71')]=function(_0x5cb223,_0x571065,_0x15c056){var _0x1e0993={'raw':![],'where':{}};var _0x41c1e7={};var _0x469188={'count':0x0,'rows':[]};return db[_0xb720('0x3f')][_0xb720('0x72')]({'where':{'id':_0x5cb223['params']['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x571065,null))['then'](function(_0x48aef0){if(_0x48aef0){_0x41c1e7[_0xb720('0x44')]=_['keys'](db['CannedAnswer'][_0xb720('0x40')]);_0x41c1e7['query']=_['keys'](_0x5cb223[_0xb720('0x45')]);_0x41c1e7[_0xb720('0x47')]=_[_0xb720('0x48')](_0x41c1e7['model'],_0x41c1e7['query']);_0x1e0993[_0xb720('0x49')]=_[_0xb720('0x48')](_0x41c1e7[_0xb720('0x44')],qs[_0xb720('0x4a')](_0x5cb223[_0xb720('0x45')][_0xb720('0x4a')]));_0x1e0993[_0xb720('0x49')]=_0x1e0993['attributes'][_0xb720('0x4b')]?_0x1e0993[_0xb720('0x49')]:_0x41c1e7['model'];if(!_0x5cb223[_0xb720('0x45')]['hasOwnProperty'](_0xb720('0x4d'))){_0x1e0993['limit']=qs['limit'](_0x5cb223[_0xb720('0x45')][_0xb720('0x33')]);_0x1e0993[_0xb720('0x31')]=qs[_0xb720('0x31')](_0x5cb223[_0xb720('0x45')][_0xb720('0x31')]);}_0x1e0993[_0xb720('0x6c')]=qs[_0xb720('0x4e')](_0x5cb223[_0xb720('0x45')][_0xb720('0x4e')]);_0x1e0993[_0xb720('0x4f')]=qs['filters'](_[_0xb720('0x50')](_0x5cb223['query'],_0x41c1e7['filters']));_0x1e0993['where'][_0xb720('0x69')]=_0x48aef0['id'];if(_0x5cb223[_0xb720('0x45')][_0xb720('0x52')]){_0x1e0993['where']=_[_0xb720('0x53')](_0x1e0993['where'],{'$or':_[_0xb720('0x3e')](_0x1e0993[_0xb720('0x49')],function(_0x31b4ef){var _0x394ea1={};_0x394ea1[_0x31b4ef]={'$like':'%'+_0x5cb223[_0xb720('0x45')][_0xb720('0x52')]+'%'};return _0x394ea1;})});}_0x1e0993=_[_0xb720('0x53')]({},_0x1e0993,_0x5cb223[_0xb720('0x54')]);return db[_0xb720('0x73')][_0xb720('0x32')]({'where':_0x1e0993[_0xb720('0x4f')]})[_0xb720('0x22')](function(_0x541bcc){_0x469188[_0xb720('0x32')]=_0x541bcc;if(_0x5cb223[_0xb720('0x45')][_0xb720('0x55')]){_0x1e0993[_0xb720('0x5b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1e0993);})['then'](function(_0x4cf9e8){_0x469188[_0xb720('0x6d')]=_0x4cf9e8;return _0x469188;});}})[_0xb720('0x22')](respondWithFilteredResult(_0x571065,_0x1e0993))[_0xb720('0x57')](handleError(_0x571065,null));};exports['removeAnswers']=function(_0x2f43af,_0xb40555,_0x5c6f1a){return db['OpenchannelAccount'][_0xb720('0x5c')]({'where':{'id':_0x2f43af[_0xb720('0x59')]['id']}})['then'](handleEntityNotFound(_0xb40555,null))[_0xb720('0x22')](function(_0x3ff129){if(_0x3ff129){return _0x3ff129[_0xb720('0x74')](_0x2f43af[_0xb720('0x45')]['ids']);}})['then'](respondWithStatusCode(_0xb40555,null))[_0xb720('0x57')](handleError(_0xb40555,null));};exports['notify']=function(_0x1fda1a,_0x23ab8a,_0x561d1d){var _0x35a39b={'body':_0x1fda1a[_0xb720('0x5e')],'channel':_0xb720('0x75')};var _0x31ae50=[];var _0x4870d0=[];var _0x5348ec={};var _0x4c1b0c=![];return db['CmContact'][_0xb720('0x67')]()[_0xb720('0x22')](function(_0x3dc4ea){if(!_0x3dc4ea){throw new db[(_0xb720('0x76'))]['ValidationError'](_0xb720('0x77'));}_0x31ae50=_[_0xb720('0x78')](_['keys'](_0x3dc4ea),[_0xb720('0x79'),_0xb720('0x7a')]);_0x4870d0=_[_0xb720('0x78')](_[_0xb720('0x46')](_0x3dc4ea),[_0xb720('0x79'),_0xb720('0x7a'),_0xb720('0x7b'),_0xb720('0x7c')]);if(_0x1fda1a[_0xb720('0x5e')]['id']){delete _0x1fda1a[_0xb720('0x5e')]['id'];}if(_[_0xb720('0x7d')](_0x1fda1a[_0xb720('0x5e')][_0xb720('0x7e')])){throw new db[(_0xb720('0x76'))][(_0xb720('0x7f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1fda1a['body'][_0xb720('0x5e')])||_0x1fda1a[_0xb720('0x5e')][_0xb720('0x5e')]===''){throw new db[(_0xb720('0x76'))][(_0xb720('0x7f'))](_0xb720('0x80'));}if(_[_0xb720('0x7d')](_0x1fda1a['body'][_0xb720('0x81')])){throw new db[(_0xb720('0x76'))][(_0xb720('0x7f'))](_0xb720('0x82')+_0x4870d0);}if(!_[_0xb720('0x83')](_0x4870d0,_0x1fda1a[_0xb720('0x5e')][_0xb720('0x81')])){throw new db['Sequelize']['ValidationError'](_0xb720('0x84')+_0x4870d0);}_0x5348ec[_0x1fda1a[_0xb720('0x5e')]['mapKey']]=_0x1fda1a[_0xb720('0x5e')][_0xb720('0x7e')];})[_0xb720('0x22')](function(){return db['OpenchannelAccount'][_0xb720('0x5c')]({'where':{'id':_0x1fda1a['params']['id']},'include':[{'model':db[_0xb720('0x85')],'as':'List','include':[{'model':db[_0xb720('0x86')],'as':_0xb720('0x87'),'where':_0x5348ec,'limit':0x1,'order':[[_0xb720('0x7a'),_0xb720('0x88')]]}]},{'model':db[_0xb720('0x89')],'as':_0xb720('0x8a')}]});})['then'](handleEntityNotFound(_0x23ab8a,null))[_0xb720('0x22')](function(_0x5d9259){if(_0x5d9259&&_0x5d9259['List']){_0x35a39b[_0xb720('0x8b')]=_0x5d9259;_0x35a39b[_0xb720('0x8c')]=_0x5d9259[_0xb720('0x8a')];_0x35a39b[_0xb720('0x8d')]=_0x5d9259['List'];_0x35a39b[_0xb720('0x8c')]=_[_0xb720('0x8e')](_0x35a39b['applications'],['priority'],['asc']);if(_0x35a39b[_0xb720('0x8b')][_0xb720('0x8a')]){delete _0x35a39b[_0xb720('0x8b')]['Applications'];}if(_0x35a39b[_0xb720('0x8b')][_0xb720('0x8f')]&&_0x35a39b[_0xb720('0x8b')][_0xb720('0x8f')][_0xb720('0x87')][_0xb720('0x4b')]){return _0x35a39b[_0xb720('0x8b')][_0xb720('0x8f')][_0xb720('0x87')][0x0];}var _0x314681=_[_0xb720('0x18')](_0x1fda1a[_0xb720('0x5e')],{'firstName':_0x1fda1a[_0xb720('0x5e')][_0xb720('0x7e')],'ListId':_0x5d9259[_0xb720('0x7c')]});_0x314681[_0x1fda1a['body'][_0xb720('0x81')]]=_0x1fda1a['body'][_0xb720('0x7e')];return db[_0xb720('0x86')][_0xb720('0x5d')](_0x314681,{'fields':_0x31ae50,'raw':!![]});}})[_0xb720('0x22')](handleEntityNotFound(_0x23ab8a,null))[_0xb720('0x22')](function(_0x1209de){_0x35a39b[_0xb720('0x90')]=_0x1209de;if(_0x1209de){var _0x3fc65d={'ContactId':_0x1209de['id'],'OpenchannelAccountId':_0x1fda1a['params']['id'],'from':(_0x1209de[_0xb720('0x91')]||'')+'\x20'+(_0x1209de[_0xb720('0x92')]||'')};var _0x4e272c={'OpenchannelAccountId':_0x1fda1a['params']['id'],'closed':![]};if(_0x1fda1a['body'][_0xb720('0x93')]){_0x4e272c[_0xb720('0x93')]=_0x1fda1a['body'][_0xb720('0x93')];return db[_0xb720('0x94')][_0xb720('0x5c')]({'where':_0x4e272c})[_0xb720('0x22')](function(_0x58b2c2){if(_0x58b2c2){return[_0x58b2c2,![]];}_0x3fc65d[_0xb720('0x93')]=_0x1fda1a['body']['threadId'];_0x3fc65d['externalUrl']=_0x1fda1a[_0xb720('0x5e')][_0xb720('0x95')];return db[_0xb720('0x94')][_0xb720('0x5d')](_0x3fc65d)[_0xb720('0x22')](function(_0x253578){return[_0x253578,!![]];});});}else{_0x4e272c[_0xb720('0x93')]=null;}_0x4e272c[_0xb720('0x96')]=_0x1209de['id'];return db['OpenchannelInteraction']['find']({'where':_0x4e272c})[_0xb720('0x22')](function(_0x535f09){if(_0x535f09){return[_0x535f09,![]];}return db[_0xb720('0x94')][_0xb720('0x5d')](_0x3fc65d)[_0xb720('0x22')](function(_0xdd1de4){return[_0xdd1de4,!![]];});});}})[_0xb720('0x97')](function(_0x4181bc,_0x355d5b){if(_0x4181bc){_0x4c1b0c=_0x355d5b;if(!_0x355d5b){var _0x20c4c6={'from':(_0x35a39b[_0xb720('0x90')][_0xb720('0x91')]||'')+'\x20'+(_0x35a39b[_0xb720('0x90')][_0xb720('0x92')]||'')};if(_0x1fda1a[_0xb720('0x5e')]['threadId']&&_0x1fda1a[_0xb720('0x5e')][_0xb720('0x98')]&&_0x1fda1a[_0xb720('0x5e')]['threadId']!=_0x1fda1a[_0xb720('0x5e')][_0xb720('0x98')]){_0x20c4c6[_0xb720('0x93')]=_0x1fda1a[_0xb720('0x5e')][_0xb720('0x98')];}return _0x4181bc[_0xb720('0x36')](_0x20c4c6);}else{return _0x4181bc;}}})[_0xb720('0x22')](function(_0x491009){_0x35a39b[_0xb720('0x99')]=_0x491009[_0xb720('0x38')]({'plain':!![]});_0x35a39b['interaction'][_0xb720('0x9a')]=_0x4c1b0c;if(_0x35a39b[_0xb720('0x99')]['created']){if(_0x35a39b[_0xb720('0x8b')][_0xb720('0x9b')]){_0x35a39b[_0xb720('0x8c')]['push']({'id':0x0,'priority':_0x35a39b[_0xb720('0x8c')][_0xb720('0x4b')]+0x1,'app':_0xb720('0x9c'),'appdata':_0xb720('0x9d'),'interval':_0xb720('0x9e')});}}return db['OpenchannelMessage'][_0xb720('0x5d')]({'body':_0x1fda1a[_0xb720('0x5e')]['body'],'OpenchannelAccountId':_0x1fda1a['params']['id'],'OpenchannelInteractionId':_0x491009['id'],'direction':'in','ContactId':_0x35a39b[_0xb720('0x90')]['id'],'AttachmentId':_0x1fda1a[_0xb720('0x5e')][_0xb720('0x9f')]});})['then'](function(_0x3e070f){_0x35a39b['message']=_0x3e070f;if(!_0x35a39b[_0xb720('0x99')][_0xb720('0xa0')])return;return db['User'][_0xb720('0x5c')]({'attributes':['id','name'],'where':{'id':_0x35a39b['interaction']['UserId']}});})['then'](function(_0x51b9b){if(_0x51b9b){_0x35a39b[_0xb720('0x8c')][_0xb720('0xa1')]({'id':0x0,'priority':0x0,'app':_0xb720('0xa2'),'appdata':_0x51b9b['name']+','+(_0x35a39b[_0xb720('0x8b')][_0xb720('0xa3')]||0xa),'interval':_0xb720('0x9e')});}if(!_0x35a39b[_0xb720('0x99')]['queueId'])return;return db[_0xb720('0xa4')][_0xb720('0x5c')]({'attributes':['id',_0xb720('0x3a')],'where':{'id':_0x35a39b[_0xb720('0x99')][_0xb720('0xa5')]}});})[_0xb720('0x22')](function(_0x548fa5){if(_0x548fa5){_0x35a39b[_0xb720('0x8c')][_0xb720('0xa1')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x548fa5[_0xb720('0x3a')]+','+(_0x35a39b[_0xb720('0x8b')][_0xb720('0xa6')]||0x12c),'interval':_0xb720('0x9e')});}return respondWithRpcPromise(_0xb720('0xa7'),_0xb720('0xa8'),_0x35a39b);})[_0xb720('0x22')](function(_0x313ad8){respondWithRpcPromise(_0xb720('0xa9'),_0xb720('0xa9'),{'event':_0xb720('0xaa'),'message':_0x313ad8},client9002);return _0x313ad8;})[_0xb720('0x22')](respondWithResult(_0x23ab8a,null))[_0xb720('0x57')](handleError(_0x23ab8a,null));};exports[_0xb720('0xab')]=function(_0x1b8b2b,_0x49332e){var _0x4dc3af=_0x1b8b2b[_0xb720('0x59')]['id'];var _0x3fa196=_0x1b8b2b[_0xb720('0x5e')];var _0x464fab=0xc8;var _0x10b00b=null;return db[_0xb720('0xac')]['transaction']({'isolationLevel':db[_0xb720('0xac')]['Transaction']['ISOLATION_LEVELS'][_0xb720('0xad')]},function(_0x57bf49){return db[_0xb720('0x3f')]['findOne']({'where':{'id':_0x4dc3af},'transaction':_0x57bf49})['then'](function(_0x5c518e){if(_0x5c518e){return db[_0xb720('0x89')]['destroy']({'where':{'OpenchannelAccountId':_0x4dc3af},'transaction':_0x57bf49})['then'](function(){var _0x545bef=_[_0xb720('0x3e')](_0x3fa196,function(_0x3bb272){_0x3bb272['OpenchannelAccountId']=_0x4dc3af;return _0x3bb272;});return db[_0xb720('0x89')][_0xb720('0xae')](_0x545bef,{'transaction':_0x57bf49});});}else{_0x464fab=0x194;_0x10b00b=[];}});})[_0xb720('0x22')](function(){if(_0x464fab!==0x194){return db[_0xb720('0x89')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x4dc3af},'order':_0xb720('0xaf')})[_0xb720('0x22')](function(_0x2c709a){_0x10b00b=_0x2c709a;});}})['catch'](function(_0x314eed){_0x464fab=0x1f4;logger[_0xb720('0x29')](_0x314eed[_0xb720('0x39')]);if(_0x314eed[_0xb720('0x3a')]){delete _0x314eed[_0xb720('0x3a')];}_0x10b00b=_0x314eed;})[_0xb720('0xb0')](function(){if(_0x10b00b===null){_0x49332e[_0xb720('0x2d')](_0x464fab);}else{if(_0x464fab===0x1f4){_0x49332e['status'](_0x464fab)[_0xb720('0x3b')](_0x10b00b);}else{_0x49332e[_0xb720('0x2f')](_0x464fab)[_0xb720('0x30')](_0x10b00b);}}});};exports[_0xb720('0xb1')]=function(_0x289719,_0x67442e,_0x3f2afb){var _0x4136d4={};var _0x3ca5c5={};var _0x22974f;var _0x355693;return db[_0xb720('0x3f')][_0xb720('0x72')]({'where':{'id':_0x289719[_0xb720('0x59')]['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x67442e,null))[_0xb720('0x22')](function(_0x4e722a){if(_0x4e722a){_0x22974f=_0x4e722a;_0x3ca5c5['model']=_['keys'](db[_0xb720('0x89')][_0xb720('0x40')]);_0x3ca5c5[_0xb720('0x45')]=_[_0xb720('0x46')](_0x289719[_0xb720('0x45')]);_0x3ca5c5[_0xb720('0x47')]=_[_0xb720('0x48')](_0x3ca5c5[_0xb720('0x44')],_0x3ca5c5[_0xb720('0x45')]);_0x4136d4[_0xb720('0x49')]=_[_0xb720('0x48')](_0x3ca5c5['model'],qs[_0xb720('0x4a')](_0x289719[_0xb720('0x45')]['fields']));_0x4136d4[_0xb720('0x49')]=_0x4136d4[_0xb720('0x49')][_0xb720('0x4b')]?_0x4136d4[_0xb720('0x49')]:_0x3ca5c5[_0xb720('0x44')];_0x4136d4[_0xb720('0x6c')]=qs[_0xb720('0x4e')](_0x289719['query'][_0xb720('0x4e')]);_0x4136d4['where']=qs[_0xb720('0x47')](_[_0xb720('0x50')](_0x289719['query'],_0x3ca5c5[_0xb720('0x47')]));if(_0x289719['query']['filter']){_0x4136d4[_0xb720('0x4f')]=_[_0xb720('0x53')](_0x4136d4[_0xb720('0x4f')],{'$or':_[_0xb720('0x3e')](_0x4136d4[_0xb720('0x49')],function(_0x3987f4){var _0x1ff1a1={};_0x1ff1a1[_0x3987f4]={'$like':'%'+_0x289719[_0xb720('0x45')][_0xb720('0x52')]+'%'};return _0x1ff1a1;})});}_0x4136d4=_[_0xb720('0x53')]({},_0x4136d4,_0x289719[_0xb720('0x54')]);return _0x22974f[_0xb720('0xb1')](_0x4136d4);}})[_0xb720('0x22')](function(_0x2cdc36){if(_0x2cdc36){_0x355693=_0x2cdc36[_0xb720('0x4b')];if(!_0x289719[_0xb720('0x45')][_0xb720('0x4c')]('nolimit')){_0x4136d4['limit']=qs[_0xb720('0x33')](_0x289719['query'][_0xb720('0x33')]);_0x4136d4[_0xb720('0x31')]=qs[_0xb720('0x31')](_0x289719[_0xb720('0x45')][_0xb720('0x31')]);}return _0x22974f[_0xb720('0xb1')](_0x4136d4);}})[_0xb720('0x22')](function(_0x32d542){if(_0x32d542){return _0x32d542?{'count':_0x355693,'rows':_0x32d542}:null;}})[_0xb720('0x22')](respondWithResult(_0x67442e,null))[_0xb720('0x57')](handleError(_0x67442e,null));};exports['getInteractions']=function(_0x4fe6ab,_0x3fdc94,_0x195ca3){var _0x3d1588={'raw':![],'where':{}};var _0x4b754c={};var _0x3bd164={'count':0x0,'rows':[]};return db[_0xb720('0x3f')]['findOne']({'where':{'id':_0x4fe6ab[_0xb720('0x59')]['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x3fdc94,null))['then'](function(_0x592e9e){if(_0x592e9e){_0x4b754c['model']=_[_0xb720('0x46')](db[_0xb720('0x94')][_0xb720('0x40')]);_0x4b754c[_0xb720('0x45')]=_[_0xb720('0x46')](_0x4fe6ab[_0xb720('0x45')]);_0x4b754c['filters']=_[_0xb720('0x48')](_0x4b754c[_0xb720('0x44')],_0x4b754c['query']);_0x3d1588[_0xb720('0x49')]=_[_0xb720('0x48')](_0x4b754c[_0xb720('0x44')],qs['fields'](_0x4fe6ab[_0xb720('0x45')][_0xb720('0x4a')]));_0x3d1588[_0xb720('0x49')]=_0x3d1588['attributes'][_0xb720('0x4b')]?_0x3d1588[_0xb720('0x49')]:_0x4b754c[_0xb720('0x44')];if(!_0x4fe6ab[_0xb720('0x45')][_0xb720('0x4c')](_0xb720('0x4d'))){_0x3d1588[_0xb720('0x33')]=qs[_0xb720('0x33')](_0x4fe6ab[_0xb720('0x45')][_0xb720('0x33')]);_0x3d1588[_0xb720('0x31')]=qs[_0xb720('0x31')](_0x4fe6ab[_0xb720('0x45')]['offset']);}_0x3d1588[_0xb720('0x6c')]=qs[_0xb720('0x4e')](_0x4fe6ab[_0xb720('0x45')][_0xb720('0x4e')]);_0x3d1588[_0xb720('0x4f')]=qs[_0xb720('0x47')](_[_0xb720('0x50')](_0x4fe6ab['query'],_0x4b754c[_0xb720('0x47')]));_0x3d1588[_0xb720('0x4f')]['OpenchannelAccountId']=_0x592e9e['id'];if(_0x4fe6ab[_0xb720('0x45')]['filter']){_0x3d1588[_0xb720('0x4f')]=_[_0xb720('0x53')](_0x3d1588[_0xb720('0x4f')],{'$or':_[_0xb720('0x3e')](_0x3d1588[_0xb720('0x49')],function(_0x4e0e1b){var _0xaa51b2={};_0xaa51b2[_0x4e0e1b]={'$like':'%'+_0x4fe6ab[_0xb720('0x45')][_0xb720('0x52')]+'%'};return _0xaa51b2;})});}_0x3d1588=_[_0xb720('0x53')]({},_0x3d1588,_0x4fe6ab[_0xb720('0x54')]);return db[_0xb720('0x94')]['count']({'where':_0x3d1588[_0xb720('0x4f')]})[_0xb720('0x22')](function(_0x30a3e9){_0x3bd164[_0xb720('0x32')]=_0x30a3e9;if(_0x4fe6ab[_0xb720('0x45')][_0xb720('0x55')]){_0x3d1588[_0xb720('0x5b')]=[{'model':db[_0xb720('0x86')],'as':_0xb720('0xb2'),'required':![]},{'model':db[_0xb720('0xb3')],'as':_0xb720('0xb4'),'attributes':['name',_0xb720('0xb5'),_0xb720('0xb6')],'required':![]},{'model':db[_0xb720('0xb7')],'as':_0xb720('0xb8'),'attributes':['id','name','color'],'where':_0x4fe6ab[_0xb720('0x45')][_0xb720('0xb9')]?{'id':_0x4fe6ab[_0xb720('0x45')][_0xb720('0xb9')]}:undefined,'required':_0x4fe6ab[_0xb720('0x45')][_0xb720('0xb9')]?!![]:![]}];}return db[_0xb720('0x94')]['findAll'](_0x3d1588);})['then'](function(_0x363b14){_0x3bd164[_0xb720('0x6d')]=_0x363b14;return _0x3bd164;});}})['then'](respondWithFilteredResult(_0x3fdc94,_0x3d1588))[_0xb720('0x57')](handleError(_0x3fdc94,null));};exports['addAgents']=function(_0x5c9c00,_0x12c0ff,_0x20b833){return db[_0xb720('0x3f')]['find']({'where':{'id':_0x5c9c00['params']['id']}})['then'](handleEntityNotFound(_0x12c0ff,null))[_0xb720('0x22')](function(_0x3ffe58){if(_0x3ffe58){return _0x3ffe58[_0xb720('0xba')](_0x5c9c00['body']['ids'],_[_0xb720('0xbb')](_0x5c9c00[_0xb720('0x5e')],[_0xb720('0x6f'),'id'])||{})[_0xb720('0x97')](function(_0x2459b8){for(var _0x42262d=0x0;_0x42262d<_0x5c9c00[_0xb720('0x5e')][_0xb720('0x6f')][_0xb720('0x4b')];_0x42262d+=0x1){socket[_0xb720('0xbc')]('userOpenchannelAccount:save',{'UserId':Number(_0x5c9c00['body'][_0xb720('0x6f')][_0x42262d]),'OpenchannelAccountId':Number(_0x5c9c00['params']['id'])});}return _0x2459b8;});}})[_0xb720('0x22')](respondWithResult(_0x12c0ff,null))['catch'](handleError(_0x12c0ff,null));};exports[_0xb720('0xbd')]=function(_0xc25a1f,_0x3d74ad,_0x4169ba){return db[_0xb720('0x3f')][_0xb720('0x5c')]({'where':{'id':_0xc25a1f[_0xb720('0x59')]['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x3d74ad,null))[_0xb720('0x22')](function(_0xc46da8){if(_0xc46da8){return _0xc46da8[_0xb720('0xbd')](_0xc25a1f[_0xb720('0x45')][_0xb720('0x6f')])['then'](function(){if(_[_0xb720('0xbe')](_0xc25a1f[_0xb720('0x45')]['ids'])){for(var _0x5b2105=0x0;_0x5b2105<_0xc25a1f[_0xb720('0x45')]['ids'][_0xb720('0x4b')];_0x5b2105+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0xc25a1f['query'][_0xb720('0x6f')][_0x5b2105]),'OpenchannelAccountId':Number(_0xc25a1f[_0xb720('0x59')]['id'])});}}else{socket[_0xb720('0xbc')](_0xb720('0xbf'),{'UserId':Number(_0xc25a1f['query']['ids']),'OpenchannelAccountId':Number(_0xc25a1f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3d74ad,null))[_0xb720('0x57')](handleError(_0x3d74ad,null));};exports[_0xb720('0xc0')]=function(_0x97dc5b,_0x54b350,_0x527ba2){var _0x184294={};var _0x3e4eb2={};var _0x7ad276;var _0xc2ad5d;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x97dc5b[_0xb720('0x59')]['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x54b350,null))['then'](function(_0x149964){if(_0x149964){_0x7ad276=_0x149964;_0x3e4eb2[_0xb720('0x44')]=_[_0xb720('0x46')](db[_0xb720('0xb3')][_0xb720('0x40')]);_0x3e4eb2[_0xb720('0x45')]=_[_0xb720('0x46')](_0x97dc5b[_0xb720('0x45')]);_0x3e4eb2[_0xb720('0x47')]=_[_0xb720('0x48')](_0x3e4eb2[_0xb720('0x44')],_0x3e4eb2['query']);_0x184294[_0xb720('0x49')]=_[_0xb720('0x48')](_0x3e4eb2[_0xb720('0x44')],qs[_0xb720('0x4a')](_0x97dc5b[_0xb720('0x45')][_0xb720('0x4a')]));_0x184294['attributes']=_0x184294['attributes'][_0xb720('0x4b')]?_0x184294[_0xb720('0x49')]:_0x3e4eb2[_0xb720('0x44')];_0x184294[_0xb720('0x6c')]=qs[_0xb720('0x4e')](_0x97dc5b['query']['sort']);_0x184294[_0xb720('0x4f')]=qs[_0xb720('0x47')](_[_0xb720('0x50')](_0x97dc5b[_0xb720('0x45')],_0x3e4eb2[_0xb720('0x47')]));if(_0x97dc5b[_0xb720('0x45')][_0xb720('0x52')]){_0x184294[_0xb720('0x4f')]=_[_0xb720('0x53')](_0x184294[_0xb720('0x4f')],{'$or':_['map'](_0x184294['attributes'],function(_0x102779){var _0x3ef778={};_0x3ef778[_0x102779]={'$like':'%'+_0x97dc5b[_0xb720('0x45')]['filter']+'%'};return _0x3ef778;})});}_0x184294=_[_0xb720('0x53')]({},_0x184294,_0x97dc5b[_0xb720('0x54')]);return _0x7ad276[_0xb720('0xc0')](_0x184294);}})[_0xb720('0x22')](function(_0xf968b6){if(_0xf968b6){_0xc2ad5d=_0xf968b6[_0xb720('0x4b')];if(!_0x97dc5b[_0xb720('0x45')][_0xb720('0x4c')]('nolimit')){_0x184294['limit']=qs[_0xb720('0x33')](_0x97dc5b['query'][_0xb720('0x33')]);_0x184294[_0xb720('0x31')]=qs['offset'](_0x97dc5b[_0xb720('0x45')][_0xb720('0x31')]);}return _0x7ad276[_0xb720('0xc0')](_0x184294);}})['then'](function(_0x1b0f3e){if(_0x1b0f3e){return _0x1b0f3e?{'count':_0xc2ad5d,'rows':_0x1b0f3e}:null;}})[_0xb720('0x22')](respondWithResult(_0x54b350,null))[_0xb720('0x57')](handleError(_0x54b350,null));};exports['send']=function(_0x1fc2df,_0x365c99,_0x142f79){var _0x84cc39,_0x9b4ad5,_0x492d17;if(_[_0xb720('0x7d')](_0x1fc2df[_0xb720('0x5e')]['body'])||_0x1fc2df['body']['body']===''){throw new db[(_0xb720('0x76'))][(_0xb720('0x7f'))](_0xb720('0x80'));}if(_[_0xb720('0x7d')](_0x1fc2df[_0xb720('0x5e')]['to'])){}_0x84cc39=_0x1fc2df[_0xb720('0x5e')]['to'];return db[_0xb720('0x3f')]['findOne']({'where':{'id':_0x1fc2df[_0xb720('0x59')]['id']}})[_0xb720('0x22')](handleEntityNotFound(_0x365c99,null))[_0xb720('0x22')](function(_0xa64b38){if(_0xa64b38){return db[_0xb720('0x3f')][_0xb720('0x5c')]({'where':{'id':_0xa64b38['id']},'include':[{'model':db[_0xb720('0x85')],'as':_0xb720('0x8f'),'include':[{'model':db[_0xb720('0x86')],'as':_0xb720('0x87'),'where':{[_0xa64b38['mapKey']]:_0x84cc39},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x365c99,null))[_0xb720('0x22')](function(_0x202e62){if(_0x202e62&&_0x202e62[_0xb720('0x8f')]){_0x9b4ad5=_0x202e62[_0xb720('0x38')]({'plain':!![]});if(_0x9b4ad5[_0xb720('0x8f')]&&_0x9b4ad5['List'][_0xb720('0x87')]['length']){return _0x9b4ad5['List'][_0xb720('0x87')][0x0];}return db[_0xb720('0x86')]['create'](_[_0xb720('0x18')](_0x1fc2df[_0xb720('0x5e')],{'firstName':_0x84cc39,[_0x202e62[_0xb720('0x81')]]:_0x84cc39,'phone':_0x84cc39,'ListId':_0x9b4ad5[_0xb720('0x7c')]}));}})[_0xb720('0x22')](handleEntityNotFound(_0x365c99,null))['then'](function(_0x1ed7db){if(_0x1ed7db){_0x492d17=_0x1ed7db;return db[_0xb720('0x94')][_0xb720('0x5c')]({'where':{'ContactId':_0x492d17['id'],'closed':![],'OpenchannelAccountId':_0x9b4ad5['id']}})[_0xb720('0x22')](function(_0x1ca466){if(_0x1ca466){return[_0x1ca466,![]];}return db[_0xb720('0x94')][_0xb720('0x5d')]({'UserId':_0x1fc2df[_0xb720('0x5f')]['id'],'ContactId':_0x492d17['id'],'OpenchannelAccountId':_0x9b4ad5['id'],'lastMsgDirection':'out','firstMsgDirection':_0xb720('0xc1'),'Messages':[_[_0xb720('0x53')](_0x1fc2df['body'],{'read':![],'body':_0x1fc2df['body'][_0xb720('0x5e')],'OpenchannelAccountId':_0x9b4ad5['id'],'UserId':_0x1fc2df[_0xb720('0x5f')]['id'],'ContactId':_0x492d17['id']})]},{'include':[{'model':db[_0xb720('0xc2')],'as':_0xb720('0xc3')}]})['then'](function(_0x3d1efb){return[_0x3d1efb,!![]];});});}})[_0xb720('0x97')](function(_0x135d78,_0x34f21d){if(_0x34f21d){return _0x135d78;}return db['OpenchannelMessage'][_0xb720('0x5d')](_[_0xb720('0x53')](_0x1fc2df[_0xb720('0x5e')],{'read':![],'body':_0x1fc2df[_0xb720('0x5e')][_0xb720('0x5e')],'OpenchannelAccountId':_0x9b4ad5['id'],'OpenchannelInteractionId':_0x135d78['id'],'UserId':_0x1fc2df[_0xb720('0x5f')]['id'],'ContactId':_0x492d17['id']}))[_0xb720('0x22')](function(_0x2d9a02){_0x135d78[_0xb720('0xc4')]['Messages']=[];_0x135d78[_0xb720('0xc4')][_0xb720('0xc3')][_0xb720('0xc5')](_0x2d9a02[_0xb720('0xc4')]);return _0x135d78;});});}})['then'](respondWithResult(_0x365c99,null))[_0xb720('0x57')](handleError(_0x365c99,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0e46517..001a4d8 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 _0xb58b=['exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x2970f4,_0x171125){var _0x15bb2b=function(_0x48ab7c){while(--_0x48ab7c){_0x2970f4['push'](_0x2970f4['shift']());}};_0x15bb2b(++_0x171125);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4c0cc6,_0x12de3b){_0x4c0cc6=_0x4c0cc6-0x0;var _0x403708=_0xb58b[_0x4c0cc6];return _0x403708;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xbb58('0x0'))['db'][_0xbb58('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb58('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb58('0x3'),'afterDestroy':_0xbb58('0x4')};function emitEvent(_0x5c9ec5){return function(_0x226363,_0x546510,_0x2edb10){OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5+':'+_0x226363['id'],_0x226363);OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5,_0x226363);_0x2edb10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xbb58('0x6')](e,emitEvent(event));}}module[_0xbb58('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xa571=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa571,0x107));var _0x1a57=function(_0x9d2458,_0x34f8a7){_0x9d2458=_0x9d2458-0x0;var _0x45926e=_0xa571[_0x9d2458];return _0x45926e;};'use strict';var EventEmitter=require(_0x1a57('0x0'));var OpenchannelAccount=require(_0x1a57('0x1'))['db'][_0x1a57('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1a57('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a57('0x4'),'afterDestroy':_0x1a57('0x5')};function emitEvent(_0x4d5f7a){return function(_0x5ec815,_0x1f2c44,_0x5067fa){OpenchannelAccountEvents[_0x1a57('0x6')](_0x4d5f7a+':'+_0x5ec815['id'],_0x5ec815);OpenchannelAccountEvents[_0x1a57('0x6')](_0x4d5f7a,_0x5ec815);_0x5067fa(null);};}for(var e in events){if(events[_0x1a57('0x7')](e)){var event=events[e];OpenchannelAccount[_0x1a57('0x8')](e,emitEvent(event));}}module[_0x1a57('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index c87f813..91130cd 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(_0x4581cb,_0x4f7523){var _0x2035d2=function(_0x1c00bc){while(--_0x1c00bc){_0x4581cb['push'](_0x4581cb['shift']());}};_0x2035d2(++_0x4f7523);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0xfff0a4,_0x8ca78a){var _0x371cb5=function(_0x4485b2){while(--_0x4485b2){_0xfff0a4['push'](_0xfff0a4['shift']());}};_0x371cb5(++_0x8ca78a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 551b867..fac6220 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 _0x00b3=['OpenchannelAccount,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./openchannelAccount.socket','register','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x00b3,0x17a));var _0x300b=function(_0x258253,_0x22d730){_0x258253=_0x258253-0x0;var _0xaa0415=_0x00b3[_0x258253];return _0xaa0415;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x300b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x300b('0xa')]));require(_0x300b('0xb'))[_0x300b('0xc')](socket);function respondWithRpcPromise(_0x4d8d78,_0x42e5a5,_0x3d907e){return new BPromise(function(_0x243abf,_0x212b2b){return client['request'](_0x4d8d78,_0x3d907e)[_0x300b('0xd')](function(_0x2eeb2d){logger[_0x300b('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x42e5a5,_0x300b('0xf'));logger[_0x300b('0x10')](_0x300b('0x11'),_0x42e5a5,_0x300b('0xf'),JSON[_0x300b('0x12')](_0x2eeb2d));if(_0x2eeb2d[_0x300b('0x13')]){if(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x14')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x42e5a5,_0x2eeb2d['error']['message']);return _0x212b2b(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x15')]);}logger[_0x300b('0x13')](_0x300b('0x16'),_0x42e5a5,_0x2eeb2d['error']['message']);return _0x243abf(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x15')]);}else{logger[_0x300b('0xe')](_0x300b('0x16'),_0x42e5a5,'request\x20sent');_0x243abf(_0x2eeb2d[_0x300b('0x17')][_0x300b('0x15')]);}})[_0x300b('0x18')](function(_0x5cba7c){logger[_0x300b('0x13')](_0x300b('0x16'),_0x42e5a5,_0x5cba7c);_0x212b2b(_0x5cba7c);});});} \ No newline at end of file +var _0x4024=['randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','bluebird'];(function(_0x256e45,_0x353556){var _0x2975cd=function(_0x7fcd64){while(--_0x7fcd64){_0x256e45['push'](_0x256e45['shift']());}};_0x2975cd(++_0x353556);}(_0x4024,0x89));var _0x4402=function(_0x41cd39,_0x3db073){_0x41cd39=_0x41cd39-0x0;var _0x33640b=_0x4024[_0x41cd39];return _0x33640b;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});config[_0x4402('0x9')]=_['defaults'](config[_0x4402('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4402('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x30fd34,_0x4f56aa,_0x1a4a47){return new BPromise(function(_0x4e1a7e,_0x34b4a6){return client['request'](_0x30fd34,_0x1a4a47)[_0x4402('0xa')](function(_0x251286){logger['info'](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));logger[_0x4402('0xd')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4f56aa,_0x4402('0xc'),JSON[_0x4402('0xe')](_0x251286));if(_0x251286[_0x4402('0xf')]){if(_0x251286[_0x4402('0xf')][_0x4402('0x10')]===0x1f4){logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x34b4a6(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x4e1a7e(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}else{logger[_0x4402('0x12')](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));_0x4e1a7e(_0x251286['result']['message']);}})[_0x4402('0x13')](function(_0x2a7afc){logger['error'](_0x4402('0xb'),_0x4f56aa,_0x2a7afc);_0x34b4a6(_0x2a7afc);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 26c38ef..787ec2d 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 _0x9780=['update','emit','removeListener','register','length','openchannelAccount:','remove'];(function(_0x24774f,_0x4b98ff){var _0x404657=function(_0x1eed6d){while(--_0x1eed6d){_0x24774f['push'](_0x24774f['shift']());}};_0x404657(++_0x4b98ff);}(_0x9780,0x1d4));var _0x0978=function(_0x1d20ba,_0x5425bf){_0x1d20ba=_0x1d20ba-0x0;var _0x347f2a=_0x9780[_0x1d20ba];return _0x347f2a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x0978('0x0'),_0x0978('0x1')];function createListener(_0x2b231c,_0x40b85f){return function(_0x30a2b7){_0x40b85f[_0x0978('0x2')](_0x2b231c,_0x30a2b7);};}function removeListener(_0x173398,_0x1e1969){return function(){OpenchannelAccountEvents[_0x0978('0x3')](_0x173398,_0x1e1969);};}exports[_0x0978('0x4')]=function(_0x21b165){for(var _0x5bb746=0x0,_0x422038=events[_0x0978('0x5')];_0x5bb746<_0x422038;_0x5bb746++){var _0x3e4d16=events[_0x5bb746];var _0xefd03b=createListener(_0x0978('0x6')+_0x3e4d16,_0x21b165);OpenchannelAccountEvents['on'](_0x3e4d16,_0xefd03b);}}; \ No newline at end of file +var _0xf6e8=['removeListener','register','length','openchannelAccount:','save','remove','update'];(function(_0x4bcb41,_0x4525cf){var _0x4345f0=function(_0x7b5751){while(--_0x7b5751){_0x4bcb41['push'](_0x4bcb41['shift']());}};_0x4345f0(++_0x4525cf);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x128dcc,_0x37f990){_0x128dcc=_0x128dcc-0x0;var _0x2c964a=_0xf6e8[_0x128dcc];return _0x2c964a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x8f6e('0x0'),_0x8f6e('0x1'),_0x8f6e('0x2')];function createListener(_0x1a5d5b,_0x3c2632){return function(_0x24d74f){_0x3c2632['emit'](_0x1a5d5b,_0x24d74f);};}function removeListener(_0xac263e,_0x55673a){return function(){OpenchannelAccountEvents[_0x8f6e('0x3')](_0xac263e,_0x55673a);};}exports[_0x8f6e('0x4')]=function(_0x5a5609){for(var _0x7b6df3=0x0,_0x233158=events[_0x8f6e('0x5')];_0x7b6df3<_0x233158;_0x7b6df3++){var _0x71b52c=events[_0x7b6df3];var _0x423ed4=createListener(_0x8f6e('0x6')+_0x71b52c,_0x5a5609);OpenchannelAccountEvents['on'](_0x71b52c,_0x423ed4);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c3d5744..5bc6278 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 _0xb0b1=['isAuthenticated','index','/:id','create','update','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb0b1,0xba));var _0x1b0b=function(_0x1b04da,_0x39afef){_0x1b04da=_0x1b04da-0x0;var _0x17af6b=_0xb0b1[_0x1b04da];return _0x17af6b;};'use strict';var multer=require('multer');var util=require(_0x1b0b('0x0'));var path=require('path');var timeout=require(_0x1b0b('0x1'));var express=require(_0x1b0b('0x2'));var router=express['Router']();var fs_extra=require(_0x1b0b('0x3'));var auth=require(_0x1b0b('0x4'));var interaction=require(_0x1b0b('0x5'));var config=require(_0x1b0b('0x6'));var controller=require(_0x1b0b('0x7'));router[_0x1b0b('0x8')]('/',auth[_0x1b0b('0x9')](),controller[_0x1b0b('0xa')]);router['get'](_0x1b0b('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1b0b('0xc')]);router['put']('/:id',auth[_0x1b0b('0x9')](),controller[_0x1b0b('0xd')]);router['delete'](_0x1b0b('0xb'),auth[_0x1b0b('0x9')](),controller[_0x1b0b('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd0dd=['post','create','put','update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x58c453,_0x46ee3a){var _0x40186c=function(_0x4777d2){while(--_0x4777d2){_0x58c453['push'](_0x58c453['shift']());}};_0x40186c(++_0x46ee3a);}(_0xd0dd,0x115));var _0xdd0d=function(_0x2c1d63,_0x3bd38c){_0x2c1d63=_0x2c1d63-0x0;var _0x27e90b=_0xd0dd[_0x2c1d63];return _0x27e90b;};'use strict';var multer=require(_0xdd0d('0x0'));var util=require('util');var path=require(_0xdd0d('0x1'));var timeout=require(_0xdd0d('0x2'));var express=require(_0xdd0d('0x3'));var router=express['Router']();var fs_extra=require(_0xdd0d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdd0d('0x5'));var config=require(_0xdd0d('0x6'));var controller=require(_0xdd0d('0x7'));router[_0xdd0d('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd0d('0x9')]);router['get'](_0xdd0d('0xa'),auth[_0xdd0d('0xb')](),controller['show']);router[_0xdd0d('0xc')]('/',auth['isAuthenticated'](),controller[_0xdd0d('0xd')]);router[_0xdd0d('0xe')](_0xdd0d('0xa'),auth[_0xdd0d('0xb')](),controller[_0xdd0d('0xf')]);router['delete'](_0xdd0d('0xa'),auth['isAuthenticated'](),controller[_0xdd0d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 2e47f16..e052c26 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 _0x410c=['exports','INTEGER','noop','TEXT','STRING'];(function(_0x6646c2,_0x142a02){var _0x18c158=function(_0x9bbbe5){while(--_0x9bbbe5){_0x6646c2['push'](_0x6646c2['shift']());}};_0x18c158(++_0x142a02);}(_0x410c,0x18b));var _0xc410=function(_0x2e691d,_0x4c56b6){_0x2e691d=_0x2e691d-0x0;var _0x3ad4da=_0x410c[_0x2e691d];return _0x3ad4da;};'use strict';var Sequelize=require('sequelize');module[_0xc410('0x0')]={'priority':{'type':Sequelize[_0xc410('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc410('0x2')},'appdata':{'type':Sequelize[_0xc410('0x3')]()},'description':{'type':Sequelize[_0xc410('0x4')]},'interval':{'type':Sequelize[_0xc410('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe4e5=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x483ca3,_0x4359c6){var _0x3264af=function(_0x36f183){while(--_0x36f183){_0x483ca3['push'](_0x483ca3['shift']());}};_0x3264af(++_0x4359c6);}(_0xe4e5,0x106));var _0x5e4e=function(_0x37f184,_0x13ed3c){_0x37f184=_0x37f184-0x0;var _0x26e39f=_0xe4e5[_0x37f184];return _0x26e39f;};'use strict';var Sequelize=require(_0x5e4e('0x0'));module[_0x5e4e('0x1')]={'priority':{'type':Sequelize[_0x5e4e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5e4e('0x3')],'allowNull':![],'defaultValue':_0x5e4e('0x4')},'appdata':{'type':Sequelize[_0x5e4e('0x5')]()},'description':{'type':Sequelize[_0x5e4e('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5e4e('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index ea5a7ec..4af277b 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 _0x5408=['includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x72222d,_0x270476){var _0x36a7f8=function(_0x532910){while(--_0x532910){_0x72222d['push'](_0x72222d['shift']());}};_0x36a7f8(++_0x270476);}(_0x5408,0x13c));var _0x8540=function(_0x20bc66,_0x2aef37){_0x20bc66=_0x20bc66-0x0;var _0x3c1b3c=_0x5408[_0x20bc66];return _0x3c1b3c;};'use strict';var emlformat=require(_0x8540('0x0'));var rimraf=require(_0x8540('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8540('0x2'));var rp=require(_0x8540('0x3'));var moment=require(_0x8540('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8540('0x5'));var util=require(_0x8540('0x6'));var path=require(_0x8540('0x7'));var sox=require(_0x8540('0x8'));var csv=require(_0x8540('0x9'));var ejs=require(_0x8540('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8540('0xb'));var squel=require(_0x8540('0xc'));var crypto=require(_0x8540('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8540('0xe'));var toCsv=require(_0x8540('0x9'));var querystring=require(_0x8540('0xf'));var Papa=require(_0x8540('0x10'));var Redis=require('ioredis');var authService=require(_0x8540('0x11'));var qs=require(_0x8540('0x12'));var as=require(_0x8540('0x13'));var hardwareService=require(_0x8540('0x14'));var logger=require(_0x8540('0x15'))('api');var utils=require(_0x8540('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8540('0x17'));var db=require(_0x8540('0x18'))['db'];function respondWithStatusCode(_0x28eb70,_0xe04f2c){_0xe04f2c=_0xe04f2c||0xcc;return function(_0x45c68b){if(_0x45c68b){return _0x28eb70['sendStatus'](_0xe04f2c);}return _0x28eb70[_0x8540('0x19')](_0xe04f2c)[_0x8540('0x1a')]();};}function respondWithResult(_0x230b20,_0x292b3e){_0x292b3e=_0x292b3e||0xc8;return function(_0x9bf58){if(_0x9bf58){return _0x230b20[_0x8540('0x19')](_0x292b3e)[_0x8540('0x1b')](_0x9bf58);}};}function respondWithFilteredResult(_0x807591,_0x56675e){return function(_0x62fa07){if(_0x62fa07){var _0x5ad1a2=typeof _0x56675e[_0x8540('0x1c')]===_0x8540('0x1d')&&typeof _0x56675e['limit']===_0x8540('0x1d');var _0x5bc1f1=_0x62fa07['count'];var _0x33a39c=_0x5ad1a2?0x0:_0x56675e[_0x8540('0x1c')];var _0x1c14f7=_0x5ad1a2?_0x62fa07[_0x8540('0x1e')]:_0x56675e[_0x8540('0x1c')]+_0x56675e['limit'];var _0x1d85fe;if(_0x1c14f7>=_0x5bc1f1){_0x1c14f7=_0x5bc1f1;_0x1d85fe=0xc8;}else{_0x1d85fe=0xce;}_0x807591[_0x8540('0x19')](_0x1d85fe);return _0x807591[_0x8540('0x1f')](_0x8540('0x20'),_0x33a39c+'-'+_0x1c14f7+'/'+_0x5bc1f1)[_0x8540('0x1b')](_0x62fa07);}return null;};}function patchUpdates(_0x2b38e9){return function(_0x4447b7){try{jsonpatch[_0x8540('0x21')](_0x4447b7,_0x2b38e9,!![]);}catch(_0x5b70f6){return BPromise[_0x8540('0x22')](_0x5b70f6);}return _0x4447b7['save']();};}function saveUpdates(_0x1c4ac5,_0x1986e1){return function(_0x4d2029){if(_0x4d2029){return _0x4d2029['update'](_0x1c4ac5)['then'](function(_0x159127){return _0x159127;});}return null;};}function removeEntity(_0x3710d8,_0x26c1db){return function(_0x2425c8){if(_0x2425c8){return _0x2425c8[_0x8540('0x23')]()[_0x8540('0x24')](function(){_0x3710d8[_0x8540('0x19')](0xcc)[_0x8540('0x1a')]();});}};}function handleEntityNotFound(_0x177dc5,_0x2e2ba5){return function(_0x1957d5){if(!_0x1957d5){_0x177dc5[_0x8540('0x25')](0x194);}return _0x1957d5;};}function handleError(_0xa2f855,_0x53c6a2){_0x53c6a2=_0x53c6a2||0x1f4;return function(_0x5dbe87){logger[_0x8540('0x26')](_0x5dbe87[_0x8540('0x27')]);if(_0x5dbe87[_0x8540('0x28')]){delete _0x5dbe87[_0x8540('0x28')];}_0xa2f855[_0x8540('0x19')](_0x53c6a2)[_0x8540('0x29')](_0x5dbe87);};}exports[_0x8540('0x2a')]=function(_0x153104,_0x143520){var _0x139a1e={},_0x2b638f={},_0x654eeb={'count':0x0,'rows':[]};var _0x2b6a97=_[_0x8540('0x2b')](db[_0x8540('0x2c')]['rawAttributes'],function(_0xbcd46c){return{'name':_0xbcd46c['fieldName'],'type':_0xbcd46c[_0x8540('0x2d')]['key']};});_0x2b638f[_0x8540('0x2e')]=_[_0x8540('0x2b')](_0x2b6a97,_0x8540('0x28'));_0x2b638f[_0x8540('0x2f')]=_['keys'](_0x153104[_0x8540('0x2f')]);_0x2b638f['filters']=_[_0x8540('0x30')](_0x2b638f[_0x8540('0x2e')],_0x2b638f['query']);_0x139a1e[_0x8540('0x31')]=_[_0x8540('0x30')](_0x2b638f[_0x8540('0x2e')],qs[_0x8540('0x32')](_0x153104[_0x8540('0x2f')]['fields']));_0x139a1e['attributes']=_0x139a1e[_0x8540('0x31')][_0x8540('0x33')]?_0x139a1e[_0x8540('0x31')]:_0x2b638f[_0x8540('0x2e')];if(!_0x153104['query'][_0x8540('0x34')](_0x8540('0x35'))){_0x139a1e[_0x8540('0x36')]=qs['limit'](_0x153104[_0x8540('0x2f')][_0x8540('0x36')]);_0x139a1e[_0x8540('0x1c')]=qs[_0x8540('0x1c')](_0x153104[_0x8540('0x2f')][_0x8540('0x1c')]);}_0x139a1e[_0x8540('0x37')]=qs[_0x8540('0x38')](_0x153104['query'][_0x8540('0x38')]);_0x139a1e[_0x8540('0x39')]=qs[_0x8540('0x3a')](_[_0x8540('0x3b')](_0x153104[_0x8540('0x2f')],_0x2b638f[_0x8540('0x3a')]),_0x2b6a97);if(_0x153104[_0x8540('0x2f')][_0x8540('0x3c')]){_0x139a1e[_0x8540('0x39')]=_['merge'](_0x139a1e[_0x8540('0x39')],{'$or':_[_0x8540('0x2b')](_0x2b6a97,function(_0x5efa27){if(_0x5efa27['type']!==_0x8540('0x3d')){var _0x17e974={};_0x17e974[_0x5efa27['name']]={'$like':'%'+_0x153104[_0x8540('0x2f')]['filter']+'%'};return _0x17e974;}})});}_0x139a1e=_[_0x8540('0x3e')]({},_0x139a1e,_0x153104[_0x8540('0x3f')]);var _0x19a30d={'where':_0x139a1e[_0x8540('0x39')]};return db['OpenchannelApplication'][_0x8540('0x1e')](_0x19a30d)['then'](function(_0x3b58f7){_0x654eeb[_0x8540('0x1e')]=_0x3b58f7;if(_0x153104[_0x8540('0x2f')][_0x8540('0x40')]){_0x139a1e[_0x8540('0x41')]=[{'all':!![]}];}return db[_0x8540('0x2c')]['findAll'](_0x139a1e);})['then'](function(_0x4375d7){_0x654eeb[_0x8540('0x42')]=_0x4375d7;return _0x654eeb;})[_0x8540('0x24')](respondWithFilteredResult(_0x143520,_0x139a1e))[_0x8540('0x43')](handleError(_0x143520,null));};exports[_0x8540('0x44')]=function(_0x45a9fd,_0x86aa25){var _0xddca96={'raw':!![],'where':{'id':_0x45a9fd['params']['id']}},_0x3cc126={};_0x3cc126['model']=_[_0x8540('0x45')](db[_0x8540('0x2c')][_0x8540('0x46')]);_0x3cc126['query']=_[_0x8540('0x45')](_0x45a9fd[_0x8540('0x2f')]);_0x3cc126[_0x8540('0x3a')]=_[_0x8540('0x30')](_0x3cc126[_0x8540('0x2e')],_0x3cc126[_0x8540('0x2f')]);_0xddca96['attributes']=_[_0x8540('0x30')](_0x3cc126[_0x8540('0x2e')],qs[_0x8540('0x32')](_0x45a9fd['query'][_0x8540('0x32')]));_0xddca96['attributes']=_0xddca96[_0x8540('0x31')][_0x8540('0x33')]?_0xddca96[_0x8540('0x31')]:_0x3cc126[_0x8540('0x2e')];if(_0x45a9fd[_0x8540('0x2f')][_0x8540('0x40')]){_0xddca96['include']=[{'all':!![]}];}_0xddca96=_[_0x8540('0x3e')]({},_0xddca96,_0x45a9fd[_0x8540('0x3f')]);return db[_0x8540('0x2c')][_0x8540('0x47')](_0xddca96)['then'](handleEntityNotFound(_0x86aa25,null))[_0x8540('0x24')](respondWithResult(_0x86aa25,null))[_0x8540('0x43')](handleError(_0x86aa25,null));};exports[_0x8540('0x48')]=function(_0x2cd208,_0xc18754){return db[_0x8540('0x2c')][_0x8540('0x48')](_0x2cd208[_0x8540('0x49')],{})[_0x8540('0x24')](respondWithResult(_0xc18754,0xc9))['catch'](handleError(_0xc18754,null));};exports[_0x8540('0x4a')]=function(_0x474f96,_0x420181){if(_0x474f96[_0x8540('0x49')]['id']){delete _0x474f96[_0x8540('0x49')]['id'];}return db['OpenchannelApplication'][_0x8540('0x47')]({'where':{'id':_0x474f96[_0x8540('0x4b')]['id']}})[_0x8540('0x24')](handleEntityNotFound(_0x420181,null))['then'](saveUpdates(_0x474f96[_0x8540('0x49')],null))[_0x8540('0x24')](respondWithResult(_0x420181,null))[_0x8540('0x43')](handleError(_0x420181,null));};exports[_0x8540('0x23')]=function(_0x2aa7c4,_0x38790c){return db[_0x8540('0x2c')][_0x8540('0x47')]({'where':{'id':_0x2aa7c4['params']['id']}})['then'](handleEntityNotFound(_0x38790c,null))[_0x8540('0x24')](removeEntity(_0x38790c,null))[_0x8540('0x43')](handleError(_0x38790c,null));}; \ No newline at end of file +var _0xb564=['rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','map','merge','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','OpenchannelApplication'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0xb564,0x144));var _0x4b56=function(_0x5effbd,_0x5e45eb){_0x5effbd=_0x5effbd-0x0;var _0x141294=_0xb564[_0x5effbd];return _0x141294;};'use strict';var emlformat=require(_0x4b56('0x0'));var rimraf=require(_0x4b56('0x1'));var zipdir=require(_0x4b56('0x2'));var jsonpatch=require(_0x4b56('0x3'));var rp=require(_0x4b56('0x4'));var moment=require('moment');var BPromise=require(_0x4b56('0x5'));var Mustache=require(_0x4b56('0x6'));var util=require(_0x4b56('0x7'));var path=require(_0x4b56('0x8'));var sox=require(_0x4b56('0x9'));var csv=require('to-csv');var ejs=require(_0x4b56('0xa'));var fs=require('fs');var fs_extra=require(_0x4b56('0xb'));var _=require(_0x4b56('0xc'));var squel=require(_0x4b56('0xd'));var crypto=require('crypto');var jsforce=require(_0x4b56('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4b56('0xf'));var querystring=require('querystring');var Papa=require(_0x4b56('0x10'));var Redis=require(_0x4b56('0x11'));var authService=require(_0x4b56('0x12'));var qs=require(_0x4b56('0x13'));var as=require(_0x4b56('0x14'));var hardwareService=require(_0x4b56('0x15'));var logger=require(_0x4b56('0x16'))(_0x4b56('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4b56('0x18'));var db=require(_0x4b56('0x19'))['db'];function respondWithStatusCode(_0x1cb7a5,_0xac5c92){_0xac5c92=_0xac5c92||0xcc;return function(_0xa22e12){if(_0xa22e12){return _0x1cb7a5['sendStatus'](_0xac5c92);}return _0x1cb7a5[_0x4b56('0x1a')](_0xac5c92)['end']();};}function respondWithResult(_0x4d07ad,_0x19f206){_0x19f206=_0x19f206||0xc8;return function(_0x3583b5){if(_0x3583b5){return _0x4d07ad[_0x4b56('0x1a')](_0x19f206)['json'](_0x3583b5);}};}function respondWithFilteredResult(_0x589d48,_0x30adb4){return function(_0x3f421d){if(_0x3f421d){var _0xf2bf3a=typeof _0x30adb4[_0x4b56('0x1b')]===_0x4b56('0x1c')&&typeof _0x30adb4[_0x4b56('0x1d')]===_0x4b56('0x1c');var _0x1bea0d=_0x3f421d[_0x4b56('0x1e')];var _0x1809d6=_0xf2bf3a?0x0:_0x30adb4[_0x4b56('0x1b')];var _0x1d29d9=_0xf2bf3a?_0x3f421d['count']:_0x30adb4[_0x4b56('0x1b')]+_0x30adb4[_0x4b56('0x1d')];var _0x2cbc43;if(_0x1d29d9>=_0x1bea0d){_0x1d29d9=_0x1bea0d;_0x2cbc43=0xc8;}else{_0x2cbc43=0xce;}_0x589d48['status'](_0x2cbc43);return _0x589d48[_0x4b56('0x1f')](_0x4b56('0x20'),_0x1809d6+'-'+_0x1d29d9+'/'+_0x1bea0d)[_0x4b56('0x21')](_0x3f421d);}return null;};}function patchUpdates(_0x2471b2){return function(_0x592fd6){try{jsonpatch[_0x4b56('0x22')](_0x592fd6,_0x2471b2,!![]);}catch(_0x14909d){return BPromise[_0x4b56('0x23')](_0x14909d);}return _0x592fd6['save']();};}function saveUpdates(_0x12ea6b,_0x1d114f){return function(_0x3a2adc){if(_0x3a2adc){return _0x3a2adc[_0x4b56('0x24')](_0x12ea6b)[_0x4b56('0x25')](function(_0x18e82e){return _0x18e82e;});}return null;};}function removeEntity(_0x4e583e,_0xd2d4ca){return function(_0x51de77){if(_0x51de77){return _0x51de77[_0x4b56('0x26')]()[_0x4b56('0x25')](function(){_0x4e583e[_0x4b56('0x1a')](0xcc)[_0x4b56('0x27')]();});}};}function handleEntityNotFound(_0x1db73a,_0x548685){return function(_0x5b9c0e){if(!_0x5b9c0e){_0x1db73a['sendStatus'](0x194);}return _0x5b9c0e;};}function handleError(_0x164346,_0x4374c5){_0x4374c5=_0x4374c5||0x1f4;return function(_0x1a8358){logger[_0x4b56('0x28')](_0x1a8358[_0x4b56('0x29')]);if(_0x1a8358[_0x4b56('0x2a')]){delete _0x1a8358[_0x4b56('0x2a')];}_0x164346['status'](_0x4374c5)[_0x4b56('0x2b')](_0x1a8358);};}exports[_0x4b56('0x2c')]=function(_0x32f5d6,_0xc56a08){var _0xeed63a={},_0x2266a2={},_0xc55779={'count':0x0,'rows':[]};var _0x880706=_['map'](db[_0x4b56('0x2d')][_0x4b56('0x2e')],function(_0x169ebc){return{'name':_0x169ebc['fieldName'],'type':_0x169ebc[_0x4b56('0x2f')][_0x4b56('0x30')]};});_0x2266a2[_0x4b56('0x31')]=_['map'](_0x880706,_0x4b56('0x2a'));_0x2266a2['query']=_['keys'](_0x32f5d6[_0x4b56('0x32')]);_0x2266a2[_0x4b56('0x33')]=_[_0x4b56('0x34')](_0x2266a2[_0x4b56('0x31')],_0x2266a2[_0x4b56('0x32')]);_0xeed63a['attributes']=_['intersection'](_0x2266a2[_0x4b56('0x31')],qs['fields'](_0x32f5d6['query'][_0x4b56('0x35')]));_0xeed63a['attributes']=_0xeed63a[_0x4b56('0x36')]['length']?_0xeed63a['attributes']:_0x2266a2[_0x4b56('0x31')];if(!_0x32f5d6['query']['hasOwnProperty'](_0x4b56('0x37'))){_0xeed63a[_0x4b56('0x1d')]=qs[_0x4b56('0x1d')](_0x32f5d6['query'][_0x4b56('0x1d')]);_0xeed63a[_0x4b56('0x1b')]=qs[_0x4b56('0x1b')](_0x32f5d6[_0x4b56('0x32')]['offset']);}_0xeed63a[_0x4b56('0x38')]=qs['sort'](_0x32f5d6[_0x4b56('0x32')][_0x4b56('0x39')]);_0xeed63a[_0x4b56('0x3a')]=qs[_0x4b56('0x33')](_[_0x4b56('0x3b')](_0x32f5d6['query'],_0x2266a2['filters']),_0x880706);if(_0x32f5d6[_0x4b56('0x32')]['filter']){_0xeed63a['where']=_['merge'](_0xeed63a[_0x4b56('0x3a')],{'$or':_[_0x4b56('0x3c')](_0x880706,function(_0xfa3a97){if(_0xfa3a97[_0x4b56('0x2f')]!=='VIRTUAL'){var _0x32483f={};_0x32483f[_0xfa3a97[_0x4b56('0x2a')]]={'$like':'%'+_0x32f5d6['query']['filter']+'%'};return _0x32483f;}})});}_0xeed63a=_[_0x4b56('0x3d')]({},_0xeed63a,_0x32f5d6[_0x4b56('0x3e')]);var _0x52f998={'where':_0xeed63a[_0x4b56('0x3a')]};return db[_0x4b56('0x2d')][_0x4b56('0x1e')](_0x52f998)['then'](function(_0x44515f){_0xc55779[_0x4b56('0x1e')]=_0x44515f;if(_0x32f5d6[_0x4b56('0x32')][_0x4b56('0x3f')]){_0xeed63a[_0x4b56('0x40')]=[{'all':!![]}];}return db[_0x4b56('0x2d')][_0x4b56('0x41')](_0xeed63a);})[_0x4b56('0x25')](function(_0x27faa9){_0xc55779[_0x4b56('0x42')]=_0x27faa9;return _0xc55779;})['then'](respondWithFilteredResult(_0xc56a08,_0xeed63a))[_0x4b56('0x43')](handleError(_0xc56a08,null));};exports['show']=function(_0x1fc055,_0x528601){var _0x316b87={'raw':!![],'where':{'id':_0x1fc055[_0x4b56('0x44')]['id']}},_0x1747ee={};_0x1747ee['model']=_[_0x4b56('0x45')](db[_0x4b56('0x2d')]['rawAttributes']);_0x1747ee['query']=_['keys'](_0x1fc055[_0x4b56('0x32')]);_0x1747ee[_0x4b56('0x33')]=_[_0x4b56('0x34')](_0x1747ee[_0x4b56('0x31')],_0x1747ee[_0x4b56('0x32')]);_0x316b87[_0x4b56('0x36')]=_[_0x4b56('0x34')](_0x1747ee[_0x4b56('0x31')],qs[_0x4b56('0x35')](_0x1fc055['query'][_0x4b56('0x35')]));_0x316b87[_0x4b56('0x36')]=_0x316b87['attributes'][_0x4b56('0x46')]?_0x316b87['attributes']:_0x1747ee[_0x4b56('0x31')];if(_0x1fc055[_0x4b56('0x32')][_0x4b56('0x3f')]){_0x316b87['include']=[{'all':!![]}];}_0x316b87=_[_0x4b56('0x3d')]({},_0x316b87,_0x1fc055['options']);return db[_0x4b56('0x2d')][_0x4b56('0x47')](_0x316b87)[_0x4b56('0x25')](handleEntityNotFound(_0x528601,null))[_0x4b56('0x25')](respondWithResult(_0x528601,null))[_0x4b56('0x43')](handleError(_0x528601,null));};exports[_0x4b56('0x48')]=function(_0x505db5,_0x2e0269){return db[_0x4b56('0x2d')][_0x4b56('0x48')](_0x505db5[_0x4b56('0x49')],{})[_0x4b56('0x25')](respondWithResult(_0x2e0269,0xc9))['catch'](handleError(_0x2e0269,null));};exports[_0x4b56('0x24')]=function(_0x1ae21a,_0x22889f){if(_0x1ae21a['body']['id']){delete _0x1ae21a['body']['id'];}return db[_0x4b56('0x2d')][_0x4b56('0x47')]({'where':{'id':_0x1ae21a['params']['id']}})['then'](handleEntityNotFound(_0x22889f,null))[_0x4b56('0x25')](saveUpdates(_0x1ae21a[_0x4b56('0x49')],null))['then'](respondWithResult(_0x22889f,null))[_0x4b56('0x43')](handleError(_0x22889f,null));};exports[_0x4b56('0x26')]=function(_0x28749e,_0x339ac2){return db['OpenchannelApplication'][_0x4b56('0x47')]({'where':{'id':_0x28749e[_0x4b56('0x44')]['id']}})[_0x4b56('0x25')](handleEntityNotFound(_0x339ac2,null))[_0x4b56('0x25')](removeEntity(_0x339ac2,null))['catch'](handleError(_0x339ac2,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0decc69..6a07c28 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 _0x0d29=['path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','api','moment','request-promise'];(function(_0xe0f6f9,_0x13c46e){var _0x339214=function(_0x31fcfb){while(--_0x31fcfb){_0xe0f6f9['push'](_0xe0f6f9['shift']());}};_0x339214(++_0x13c46e);}(_0x0d29,0x1b9));var _0x90d2=function(_0x22dd0e,_0x18ac72){_0x22dd0e=_0x22dd0e-0x0;var _0x41b401=_0x0d29[_0x22dd0e];return _0x41b401;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x90d2('0x0'));var moment=require(_0x90d2('0x1'));var BPromise=require('bluebird');var rp=require(_0x90d2('0x2'));var fs=require('fs');var path=require(_0x90d2('0x3'));var rimraf=require(_0x90d2('0x4'));var config=require(_0x90d2('0x5'));var attributes=require('./openchannelApplication.attributes');module[_0x90d2('0x6')]=function(_0x11de82,_0xec35e0){return _0x11de82[_0x90d2('0x7')](_0x90d2('0x8'),attributes,{'tableName':_0x90d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x90d2('0xa'),'collate':_0x90d2('0xb')});}; \ No newline at end of file +var _0x7772=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x35af98,_0x103f33){var _0x5f5a62=function(_0x1b1eea){while(--_0x1b1eea){_0x35af98['push'](_0x35af98['shift']());}};_0x5f5a62(++_0x103f33);}(_0x7772,0x17e));var _0x2777=function(_0x41a28f,_0x39ed7b){_0x41a28f=_0x41a28f-0x0;var _0x1cfba2=_0x7772[_0x41a28f];return _0x1cfba2;};'use strict';var _=require(_0x2777('0x0'));var util=require(_0x2777('0x1'));var logger=require(_0x2777('0x2'))(_0x2777('0x3'));var moment=require(_0x2777('0x4'));var BPromise=require(_0x2777('0x5'));var rp=require(_0x2777('0x6'));var fs=require('fs');var path=require(_0x2777('0x7'));var rimraf=require('rimraf');var config=require(_0x2777('0x8'));var attributes=require(_0x2777('0x9'));module[_0x2777('0xa')]=function(_0x4e3c46,_0x5e049b){return _0x4e3c46[_0x2777('0xb')](_0x2777('0xc'),attributes,{'tableName':_0x2777('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2777('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index f4cc20a..61e3b4a 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 _0x93ee=['client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3f3689,_0x155be4){var _0x56c909=function(_0x23e9bb){while(--_0x23e9bb){_0x3f3689['push'](_0x3f3689['shift']());}};_0x56c909(++_0x155be4);}(_0x93ee,0x18e));var _0xe93e=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x93ee[_0x2a18b7];return _0x45e74e;};'use strict';var _=require('lodash');var util=require(_0xe93e('0x0'));var moment=require(_0xe93e('0x1'));var BPromise=require(_0xe93e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe93e('0x3'));var db=require(_0xe93e('0x4'))['db'];var utils=require(_0xe93e('0x5'));var logger=require(_0xe93e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe93e('0x7')][_0xe93e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d76d9,_0x4465f4,_0x54ebe6){return new BPromise(function(_0x21b926,_0x841f10){return client[_0xe93e('0x9')](_0x3d76d9,_0x54ebe6)[_0xe93e('0xa')](function(_0x13b394){logger['info'](_0xe93e('0xb'),_0x4465f4,_0xe93e('0xc'));logger[_0xe93e('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x4465f4,'request\x20sent',JSON[_0xe93e('0xe')](_0x13b394));if(_0x13b394[_0xe93e('0xf')]){if(_0x13b394[_0xe93e('0xf')][_0xe93e('0x10')]===0x1f4){logger['error'](_0xe93e('0xb'),_0x4465f4,_0x13b394['error']['message']);return _0x841f10(_0x13b394['error']['message']);}logger[_0xe93e('0xf')](_0xe93e('0xb'),_0x4465f4,_0x13b394[_0xe93e('0xf')]['message']);return _0x21b926(_0x13b394[_0xe93e('0xf')][_0xe93e('0x11')]);}else{logger[_0xe93e('0x12')](_0xe93e('0xb'),_0x4465f4,_0xe93e('0xc'));_0x21b926(_0x13b394['result']['message']);}})[_0xe93e('0x13')](function(_0x25aa29){logger[_0xe93e('0xf')](_0xe93e('0xb'),_0x4465f4,_0x25aa29);_0x841f10(_0x25aa29);});});}exports[_0xe93e('0x14')]=function(_0x47b569){var _0xbf37e3=this;return new Promise(function(_0x31c0f5,_0x5a8949){return db[_0xe93e('0x15')][_0xe93e('0x16')](_0x47b569['body'],{'raw':_0x47b569[_0xe93e('0x17')]?_0x47b569['options'][_0xe93e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47b569[_0xe93e('0x17')]?_0x47b569[_0xe93e('0x17')]['where']||null:null,'attributes':_0x47b569[_0xe93e('0x17')]?_0x47b569['options'][_0xe93e('0x19')]||null:null,'limit':_0x47b569[_0xe93e('0x17')]?_0x47b569['options'][_0xe93e('0x1a')]||null:null})[_0xe93e('0xa')](function(_0x260d66){logger['info'](_0xe93e('0x14'),_0x47b569);logger[_0xe93e('0xd')](_0xe93e('0x14'),_0x47b569,JSON[_0xe93e('0xe')](_0x260d66));_0x31c0f5(_0x260d66);})[_0xe93e('0x13')](function(_0x5504cd){logger[_0xe93e('0xf')](_0xe93e('0x14'),_0x5504cd[_0xe93e('0x11')],_0x47b569);_0x5a8949(_0xbf37e3[_0xe93e('0xf')](0x1f4,_0x5504cd[_0xe93e('0x11')]));});});}; \ No newline at end of file +var _0x9a8c=['update','options','raw','where','attributes','limit','UpdateOpenchannelApplication','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelApplication'];(function(_0x5c2ec1,_0xfc406a){var _0x5bde22=function(_0x571e46){while(--_0x571e46){_0x5c2ec1['push'](_0x5c2ec1['shift']());}};_0x5bde22(++_0xfc406a);}(_0x9a8c,0x18e));var _0xc9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9a8('0x0'));var util=require(_0xc9a8('0x1'));var moment=require('moment');var BPromise=require(_0xc9a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9a8('0x3'));var db=require(_0xc9a8('0x4'))['db'];var utils=require(_0xc9a8('0x5'));var logger=require(_0xc9a8('0x6'))(_0xc9a8('0x7'));var config=require('../../config/environment');var jayson=require(_0xc9a8('0x8'));var client=jayson[_0xc9a8('0x9')][_0xc9a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b3504,_0xe2cf1b,_0x483d0a){return new BPromise(function(_0x402f31,_0x2b2a0e){return client['request'](_0x5b3504,_0x483d0a)[_0xc9a8('0xb')](function(_0x5aa5a1){logger[_0xc9a8('0xc')](_0xc9a8('0xd'),_0xe2cf1b,_0xc9a8('0xe'));logger[_0xc9a8('0xf')](_0xc9a8('0x10'),_0xe2cf1b,'request\x20sent',JSON[_0xc9a8('0x11')](_0x5aa5a1));if(_0x5aa5a1[_0xc9a8('0x12')]){if(_0x5aa5a1[_0xc9a8('0x12')][_0xc9a8('0x13')]===0x1f4){logger[_0xc9a8('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0xe2cf1b,_0x5aa5a1['error'][_0xc9a8('0x14')]);return _0x2b2a0e(_0x5aa5a1['error']['message']);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0xe2cf1b,_0x5aa5a1[_0xc9a8('0x12')][_0xc9a8('0x14')]);return _0x402f31(_0x5aa5a1[_0xc9a8('0x12')][_0xc9a8('0x14')]);}else{logger['info'](_0xc9a8('0xd'),_0xe2cf1b,_0xc9a8('0xe'));_0x402f31(_0x5aa5a1['result'][_0xc9a8('0x14')]);}})['catch'](function(_0x47ac04){logger['error'](_0xc9a8('0xd'),_0xe2cf1b,_0x47ac04);_0x2b2a0e(_0x47ac04);});});}exports['UpdateOpenchannelApplication']=function(_0x897cb2){var _0x5ddc3e=this;return new Promise(function(_0x5091ec,_0x1c32a6){return db[_0xc9a8('0x15')][_0xc9a8('0x16')](_0x897cb2['body'],{'raw':_0x897cb2[_0xc9a8('0x17')]?_0x897cb2[_0xc9a8('0x17')][_0xc9a8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x897cb2[_0xc9a8('0x17')]?_0x897cb2[_0xc9a8('0x17')][_0xc9a8('0x19')]||null:null,'attributes':_0x897cb2[_0xc9a8('0x17')]?_0x897cb2[_0xc9a8('0x17')][_0xc9a8('0x1a')]||null:null,'limit':_0x897cb2[_0xc9a8('0x17')]?_0x897cb2[_0xc9a8('0x17')][_0xc9a8('0x1b')]||null:null})[_0xc9a8('0xb')](function(_0x1d618a){logger['info'](_0xc9a8('0x1c'),_0x897cb2);logger[_0xc9a8('0xf')](_0xc9a8('0x1c'),_0x897cb2,JSON['stringify'](_0x1d618a));_0x5091ec(_0x1d618a);})[_0xc9a8('0x1d')](function(_0x411816){logger[_0xc9a8('0x12')]('UpdateOpenchannelApplication',_0x411816[_0xc9a8('0x14')],_0x897cb2);_0x1c32a6(_0x5ddc3e[_0xc9a8('0x12')](0x1f4,_0x411816[_0xc9a8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a63d514..5ee76d1 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 _0x3edc=['put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','tracked','openchannelinteraction:addtags','addTags'];(function(_0x59eb64,_0x181d19){var _0x2df4b1=function(_0x452d59){while(--_0x452d59){_0x59eb64['push'](_0x59eb64['shift']());}};_0x2df4b1(++_0x181d19);}(_0x3edc,0x19b));var _0xc3ed=function(_0xae6db5,_0x5b81e9){_0xae6db5=_0xae6db5-0x0;var _0x526e3c=_0x3edc[_0xae6db5];return _0x526e3c;};'use strict';var multer=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var path=require(_0xc3ed('0x2'));var timeout=require(_0xc3ed('0x3'));var express=require(_0xc3ed('0x4'));var router=express['Router']();var fs_extra=require(_0xc3ed('0x5'));var auth=require(_0xc3ed('0x6'));var interaction=require(_0xc3ed('0x7'));var config=require('../../config/environment');var controller=require(_0xc3ed('0x8'));router[_0xc3ed('0x9')]('/',auth[_0xc3ed('0xa')](),controller['index']);router[_0xc3ed('0x9')](_0xc3ed('0xb'),auth[_0xc3ed('0xa')](),controller['describe']);router[_0xc3ed('0x9')](_0xc3ed('0xc'),auth['isAuthenticated'](),controller[_0xc3ed('0xd')]);router['get'](_0xc3ed('0xe'),auth[_0xc3ed('0xa')](),controller[_0xc3ed('0xf')]);router[_0xc3ed('0x9')]('/:id/download',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0x10')]);router[_0xc3ed('0x11')]('/',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0x12')]);router['post'](_0xc3ed('0xe'),auth['isAuthenticated'](),controller[_0xc3ed('0x13')]);router[_0xc3ed('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xc3ed('0x14')]('openchannel',_0xc3ed('0x15')),controller[_0xc3ed('0x16')]);router[_0xc3ed('0x17')](_0xc3ed('0xc'),auth[_0xc3ed('0xa')](),interaction[_0xc3ed('0x14')]('openchannel',_0xc3ed('0x18')),controller[_0xc3ed('0x19')]);router[_0xc3ed('0x1a')]('/:id',auth[_0xc3ed('0xa')](),interaction[_0xc3ed('0x14')]('openchannel',_0xc3ed('0x1b')),controller[_0xc3ed('0x1c')]);router[_0xc3ed('0x1a')](_0xc3ed('0x1d'),auth['isAuthenticated'](),controller[_0xc3ed('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xb9dc=['create','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x4587fe,_0x4b740c){var _0x379355=function(_0x24247c){while(--_0x24247c){_0x4587fe['push'](_0x4587fe['shift']());}};_0x379355(++_0x4b740c);}(_0xb9dc,0x14c));var _0xcb9d=function(_0x5d5a34,_0x1b54e1){_0x5d5a34=_0x5d5a34-0x0;var _0x235f0d=_0xb9dc[_0x5d5a34];return _0x235f0d;};'use strict';var multer=require(_0xcb9d('0x0'));var util=require('util');var path=require(_0xcb9d('0x1'));var timeout=require(_0xcb9d('0x2'));var express=require(_0xcb9d('0x3'));var router=express[_0xcb9d('0x4')]();var fs_extra=require(_0xcb9d('0x5'));var auth=require(_0xcb9d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb9d('0x7'));var controller=require('./openchannelInteraction.controller');router[_0xcb9d('0x8')]('/',auth[_0xcb9d('0x9')](),controller[_0xcb9d('0xa')]);router[_0xcb9d('0x8')](_0xcb9d('0xb'),auth[_0xcb9d('0x9')](),controller[_0xcb9d('0xc')]);router[_0xcb9d('0x8')](_0xcb9d('0xd'),auth['isAuthenticated'](),controller[_0xcb9d('0xe')]);router[_0xcb9d('0x8')](_0xcb9d('0xf'),auth[_0xcb9d('0x9')](),controller[_0xcb9d('0x10')]);router[_0xcb9d('0x8')](_0xcb9d('0x11'),auth[_0xcb9d('0x9')](),controller[_0xcb9d('0x12')]);router[_0xcb9d('0x13')]('/',auth[_0xcb9d('0x9')](),controller[_0xcb9d('0x14')]);router[_0xcb9d('0x13')]('/:id/messages',auth[_0xcb9d('0x9')](),controller['addMessage']);router[_0xcb9d('0x13')]('/:id/tags',auth[_0xcb9d('0x9')](),interaction[_0xcb9d('0x15')](_0xcb9d('0x16'),'openchannelinteraction:addtags'),controller[_0xcb9d('0x17')]);router[_0xcb9d('0x18')]('/:id',auth[_0xcb9d('0x9')](),interaction['tracked'](_0xcb9d('0x16'),_0xcb9d('0x19')),controller[_0xcb9d('0x1a')]);router[_0xcb9d('0x1b')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xcb9d('0x16'),_0xcb9d('0x1c')),controller[_0xcb9d('0x1d')]);router[_0xcb9d('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0xcb9d('0x1e')]);module[_0xcb9d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 15d0a40..05070e8 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 _0x30c7=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x38b3cb,_0x2b3f46){var _0x145400=function(_0x19c486){while(--_0x19c486){_0x38b3cb['push'](_0x38b3cb['shift']());}};_0x145400(++_0x2b3f46);}(_0x30c7,0x111));var _0x730c=function(_0x55b0b9,_0x151dc3){_0x55b0b9=_0x55b0b9-0x0;var _0x354b7f=_0x30c7[_0x55b0b9];return _0x354b7f;};'use strict';var Sequelize=require(_0x730c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x730c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x730c('0x2')]},'disposition':{'type':Sequelize[_0x730c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x730c('0x3')]},'note':{'type':Sequelize[_0x730c('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x730c('0x4')]('in',_0x730c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x730c('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x730c('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x730c('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8f9f=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x26429a,_0x158cca){var _0x342928=function(_0x353668){while(--_0x353668){_0x26429a['push'](_0x26429a['shift']());}};_0x342928(++_0x158cca);}(_0x8f9f,0xbf));var _0xf8f9=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8f9f[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0xf8f9('0x0'));module[_0xf8f9('0x1')]={'closed':{'type':Sequelize[_0xf8f9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf8f9('0x3')]},'disposition':{'type':Sequelize[_0xf8f9('0x4')]},'secondDisposition':{'type':Sequelize[_0xf8f9('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf8f9('0x4')]},'note':{'type':Sequelize[_0xf8f9('0x4')]},'read1stAt':{'type':Sequelize[_0xf8f9('0x3')]},'threadId':{'type':Sequelize[_0xf8f9('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xf8f9('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xf8f9('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xf8f9('0x5')]('in',_0xf8f9('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf8f9('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf8f9('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf8f9('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index e216354..d531f5a 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 _0xee82=['lastName','attachments','Attachment','createdAt','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','download','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','type','getOptions','findAll','openchannel','user','catch','query','from','params','model','keys','filters','attributes','intersection','fields','includeAll','include','merge','find','create','body','describe','addMessage','OpenchannelMessage','findOne','length','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','map','$gte','format','options','rows','addTags','setTags','ids','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xee82,0x1b7));var _0x2ee8=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0xee82[_0x1fc84d];return _0x2658fa;};'use strict';var rimraf=require(_0x2ee8('0x0'));var zipdir=require(_0x2ee8('0x1'));var moment=require(_0x2ee8('0x2'));var util=require(_0x2ee8('0x3'));var path=require(_0x2ee8('0x4'));var ejs=require(_0x2ee8('0x5'));var fs=require('fs');var _=require(_0x2ee8('0x6'));var Redis=require(_0x2ee8('0x7'));var interaction=require(_0x2ee8('0x8'));var qs=require(_0x2ee8('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x2ee8('0xa'))(_0x2ee8('0xb'));var config=require(_0x2ee8('0xc'));var db=require(_0x2ee8('0xd'))['db'];config[_0x2ee8('0xe')]=_[_0x2ee8('0xf')](config[_0x2ee8('0xe')],{'host':_0x2ee8('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ee8('0xe')]));require(_0x2ee8('0x11'))[_0x2ee8('0x12')](socket);function respondWithStatusCode(_0x358839,_0x3008b8){_0x3008b8=_0x3008b8||0xcc;return function(_0x4bd133){if(_0x4bd133){return _0x358839['sendStatus'](_0x3008b8);}return _0x358839[_0x2ee8('0x13')](_0x3008b8)[_0x2ee8('0x14')]();};}function respondWithResult(_0x3c9679,_0x32640e){_0x32640e=_0x32640e||0xc8;return function(_0x401a68){if(_0x401a68){return _0x3c9679[_0x2ee8('0x13')](_0x32640e)[_0x2ee8('0x15')](_0x401a68);}};}function respondWithFilteredResult(_0x4772c1,_0x4c18cd){return function(_0x7a6591){if(_0x7a6591){var _0x15909d=typeof _0x4c18cd[_0x2ee8('0x16')]===_0x2ee8('0x17')&&typeof _0x4c18cd[_0x2ee8('0x18')]===_0x2ee8('0x17');var _0x266d83=_0x7a6591[_0x2ee8('0x19')];var _0x5813d0=_0x15909d?0x0:_0x4c18cd[_0x2ee8('0x16')];var _0x4a246a=_0x15909d?_0x7a6591[_0x2ee8('0x19')]:_0x4c18cd[_0x2ee8('0x16')]+_0x4c18cd[_0x2ee8('0x18')];var _0x3c6c6c;if(_0x4a246a>=_0x266d83){_0x4a246a=_0x266d83;_0x3c6c6c=0xc8;}else{_0x3c6c6c=0xce;}_0x4772c1[_0x2ee8('0x13')](_0x3c6c6c);return _0x4772c1['set'](_0x2ee8('0x1a'),_0x5813d0+'-'+_0x4a246a+'/'+_0x266d83)['json'](_0x7a6591);}return null;};}function saveUpdates(_0x5c8783){return function(_0x37a872){if(_0x37a872){return _0x37a872[_0x2ee8('0x1b')](_0x5c8783)[_0x2ee8('0x1c')](function(_0x123a01){return _0x123a01;});}return null;};}function removeEntity(_0x1aafad){return function(_0x26f525){if(_0x26f525){return _0x26f525[_0x2ee8('0x1d')]()[_0x2ee8('0x1c')](function(){_0x1aafad[_0x2ee8('0x13')](0xcc)[_0x2ee8('0x14')]();});}};}function handleEntityNotFound(_0x5d2f30){return function(_0x6a6725){if(!_0x6a6725){_0x5d2f30[_0x2ee8('0x1e')](0x194);}return _0x6a6725;};}function handleError(_0x67497c,_0x4c0769){_0x4c0769=_0x4c0769||0x1f4;return function(_0xc71332){logger['error'](_0xc71332[_0x2ee8('0x1f')]);if(_0xc71332[_0x2ee8('0x20')]){delete _0xc71332[_0x2ee8('0x20')];}_0x67497c[_0x2ee8('0x13')](_0x4c0769)[_0x2ee8('0x21')](_0xc71332);};}exports[_0x2ee8('0x22')]=function(_0x4557f7,_0x3bb393){var _0x363d06={};var _0x1b039c=_['map'](db[_0x2ee8('0x23')][_0x2ee8('0x24')],function(_0x21a258){return{'name':_0x21a258[_0x2ee8('0x25')],'type':_0x21a258[_0x2ee8('0x26')]['key']};});_0x363d06=qs[_0x2ee8('0x27')](_0x1b039c,_0x4557f7);return interaction[_0x2ee8('0x28')](_0x2ee8('0x29'),_0x4557f7['query'],_0x4557f7[_0x2ee8('0x2a')],_0x363d06,_0x1b039c)['then'](respondWithFilteredResult(_0x3bb393,_0x363d06))[_0x2ee8('0x2b')](handleError(_0x3bb393,null));};exports['show']=function(_0x442cad,_0x24574c){var _0x11ab13={};if(_0x442cad[_0x2ee8('0x2c')][_0x2ee8('0x26')]&&_0x442cad[_0x2ee8('0x2c')][_0x2ee8('0x26')]===_0x2ee8('0x2d')){_0x11ab13['from']=_0x442cad[_0x2ee8('0x2e')]['id'];}else{_0x11ab13['id']=_0x442cad['params']['id'];}var _0x299e26={'raw':![],'where':_0x11ab13},_0x56f295={};_0x56f295[_0x2ee8('0x2f')]=_['keys'](db[_0x2ee8('0x23')][_0x2ee8('0x24')]);_0x56f295[_0x2ee8('0x2c')]=_[_0x2ee8('0x30')](_0x442cad[_0x2ee8('0x2c')]);_0x56f295[_0x2ee8('0x31')]=_['intersection'](_0x56f295[_0x2ee8('0x2f')],_0x56f295['query']);_0x299e26[_0x2ee8('0x32')]=_[_0x2ee8('0x33')](_0x56f295[_0x2ee8('0x2f')],qs['fields'](_0x442cad[_0x2ee8('0x2c')][_0x2ee8('0x34')]));_0x299e26['attributes']=_0x299e26[_0x2ee8('0x32')]['length']?_0x299e26[_0x2ee8('0x32')]:_0x56f295[_0x2ee8('0x2f')];if(_0x442cad['query'][_0x2ee8('0x35')]){_0x299e26[_0x2ee8('0x36')]=[{'all':!![]}];}_0x299e26=_[_0x2ee8('0x37')]({},_0x299e26,_0x442cad['options']);return db[_0x2ee8('0x23')][_0x2ee8('0x38')](_0x299e26)[_0x2ee8('0x1c')](handleEntityNotFound(_0x24574c,null))[_0x2ee8('0x1c')](respondWithResult(_0x24574c,null))['catch'](handleError(_0x24574c,null));};exports[_0x2ee8('0x39')]=function(_0x3d3701,_0x3991b4){return db['OpenchannelInteraction'][_0x2ee8('0x39')](_0x3d3701[_0x2ee8('0x3a')],{})[_0x2ee8('0x1c')](respondWithResult(_0x3991b4,0xc9))[_0x2ee8('0x2b')](handleError(_0x3991b4,null));};exports[_0x2ee8('0x1b')]=function(_0x31c055,_0x8480b7){if(_0x31c055[_0x2ee8('0x3a')]['id']){delete _0x31c055[_0x2ee8('0x3a')]['id'];}return db['OpenchannelInteraction'][_0x2ee8('0x38')]({'where':{'id':_0x31c055['params']['id']}})[_0x2ee8('0x1c')](handleEntityNotFound(_0x8480b7,null))[_0x2ee8('0x1c')](saveUpdates(_0x31c055[_0x2ee8('0x3a')],null))['then'](respondWithResult(_0x8480b7,null))[_0x2ee8('0x2b')](handleError(_0x8480b7,null));};exports[_0x2ee8('0x1d')]=function(_0x1cabd2,_0x51a9f1){return db[_0x2ee8('0x23')][_0x2ee8('0x38')]({'where':{'id':_0x1cabd2[_0x2ee8('0x2e')]['id']}})[_0x2ee8('0x1c')](handleEntityNotFound(_0x51a9f1,null))[_0x2ee8('0x1c')](removeEntity(_0x51a9f1,null))[_0x2ee8('0x2b')](handleError(_0x51a9f1,null));};exports[_0x2ee8('0x3b')]=function(_0x27ecde,_0x25a50f){return db[_0x2ee8('0x23')][_0x2ee8('0x3b')]()[_0x2ee8('0x1c')](respondWithResult(_0x25a50f,null))['catch'](handleError(_0x25a50f,null));};exports[_0x2ee8('0x3c')]=function(_0x59f070,_0x206815){return db[_0x2ee8('0x3d')][_0x2ee8('0x38')]({'where':{'id':_0x59f070[_0x2ee8('0x2e')]['id']}})['then'](handleEntityNotFound(_0x206815,null))[_0x2ee8('0x1c')](function(_0x1e77cb){if(_0x1e77cb){return _0x1e77cb[_0x2ee8('0x3c')](_0x59f070[_0x2ee8('0x3a')]['ids'],_['omit'](_0x59f070[_0x2ee8('0x3a')],['ids','id'])||{});}})[_0x2ee8('0x1c')](respondWithResult(_0x206815,null))[_0x2ee8('0x2b')](handleError(_0x206815,null));};exports['getMessages']=function(_0x4213bf,_0x2fd0a5){var _0x12c1e3={'raw':![],'where':{}};var _0x28db73={};var _0x124e49={'count':0x0,'rows':[]};return db[_0x2ee8('0x23')][_0x2ee8('0x3e')]({'where':{'id':_0x4213bf[_0x2ee8('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2fd0a5,null))[_0x2ee8('0x1c')](function(_0x5d10fb){if(_0x5d10fb){_0x28db73[_0x2ee8('0x2f')]=_[_0x2ee8('0x30')](db['OpenchannelMessage'][_0x2ee8('0x24')]);_0x28db73['query']=_[_0x2ee8('0x30')](_0x4213bf['query']);_0x28db73[_0x2ee8('0x31')]=_[_0x2ee8('0x33')](_0x28db73[_0x2ee8('0x2f')],_0x28db73[_0x2ee8('0x2c')]);_0x12c1e3[_0x2ee8('0x32')]=_[_0x2ee8('0x33')](_0x28db73[_0x2ee8('0x2f')],qs['fields'](_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x34')]));_0x12c1e3[_0x2ee8('0x32')]=_0x12c1e3[_0x2ee8('0x32')][_0x2ee8('0x3f')]?_0x12c1e3[_0x2ee8('0x32')]:_0x28db73[_0x2ee8('0x2f')];if(!_0x4213bf[_0x2ee8('0x2c')]['hasOwnProperty'](_0x2ee8('0x40'))){_0x12c1e3[_0x2ee8('0x18')]=qs['limit'](_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x18')]);_0x12c1e3[_0x2ee8('0x16')]=qs[_0x2ee8('0x16')](_0x4213bf[_0x2ee8('0x2c')]['offset']);}_0x12c1e3[_0x2ee8('0x41')]=qs['sort'](_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x42')]);_0x12c1e3[_0x2ee8('0x43')]=qs[_0x2ee8('0x31')](_[_0x2ee8('0x44')](_0x4213bf[_0x2ee8('0x2c')],_0x28db73[_0x2ee8('0x31')]));_0x12c1e3['where'][_0x2ee8('0x45')]=_0x5d10fb['id'];if(_0x4213bf['query'][_0x2ee8('0x46')]){_0x12c1e3[_0x2ee8('0x43')]=_[_0x2ee8('0x37')](_0x12c1e3[_0x2ee8('0x43')],{'$or':_[_0x2ee8('0x47')](_0x12c1e3[_0x2ee8('0x32')],function(_0x5c3d53){var _0x53cfb7={};_0x53cfb7[_0x5c3d53]={'$like':'%'+_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x46')]+'%'};return _0x53cfb7;})});}if(_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x48')]){var _0x465b9f=_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x48')]['split'](',');var _0x555c8e={};_0x555c8e[_0x465b9f[0x0]]={'$gte':moment(_0x465b9f[0x1])[_0x2ee8('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x12c1e3['where']=_[_0x2ee8('0x37')](_0x12c1e3[_0x2ee8('0x43')],_0x555c8e);}_0x12c1e3=_[_0x2ee8('0x37')]({},_0x12c1e3,_0x4213bf[_0x2ee8('0x4a')]);return db['OpenchannelMessage']['count']({'where':_0x12c1e3[_0x2ee8('0x43')]})['then'](function(_0xcce66f){_0x124e49['count']=_0xcce66f;if(_0x4213bf['query'][_0x2ee8('0x35')]){_0x12c1e3[_0x2ee8('0x36')]=[{'all':!![]}];}return db[_0x2ee8('0x3d')][_0x2ee8('0x28')](_0x12c1e3);})[_0x2ee8('0x1c')](function(_0x5de327){_0x124e49[_0x2ee8('0x4b')]=_0x5de327;return _0x124e49;});}})[_0x2ee8('0x1c')](respondWithFilteredResult(_0x2fd0a5,_0x12c1e3))[_0x2ee8('0x2b')](handleError(_0x2fd0a5,null));};exports[_0x2ee8('0x4c')]=function(_0x21a2e9,_0x2f2123){return db[_0x2ee8('0x23')][_0x2ee8('0x38')]({'where':{'id':_0x21a2e9[_0x2ee8('0x2e')]['id']}})[_0x2ee8('0x1c')](handleEntityNotFound(_0x2f2123,null))[_0x2ee8('0x1c')](function(_0xdfaad){if(_0xdfaad){return _0xdfaad[_0x2ee8('0x4d')](_0x21a2e9[_0x2ee8('0x3a')][_0x2ee8('0x4e')],_['omit'](_0x21a2e9[_0x2ee8('0x3a')],[_0x2ee8('0x4e'),'id'])||{})['spread'](function(){return db[_0x2ee8('0x4f')][_0x2ee8('0x28')]({'attributes':['id',_0x2ee8('0x20'),_0x2ee8('0x50')],'where':{'id':_0x21a2e9[_0x2ee8('0x3a')][_0x2ee8('0x4e')]}});})[_0x2ee8('0x1c')](function(_0x5e7d0b){socket[_0x2ee8('0x51')](_0x2ee8('0x52'),{'id':Number(_0x21a2e9[_0x2ee8('0x2e')]['id']),'tags':_0x5e7d0b||[]});return{'id':Number(_0x21a2e9['params']['id']),'tags':_0x5e7d0b||[]};});}})[_0x2ee8('0x1c')](respondWithResult(_0x2f2123,null))[_0x2ee8('0x2b')](handleError(_0x2f2123,null));};exports[_0x2ee8('0x53')]=function(_0x5127f0,_0x539641){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5127f0[_0x2ee8('0x2e')]['id']}})[_0x2ee8('0x1c')](handleEntityNotFound(_0x539641,null))[_0x2ee8('0x1c')](function(_0x1322a0){if(_0x1322a0){return _0x1322a0['removeTags'](_0x5127f0[_0x2ee8('0x2c')][_0x2ee8('0x4e')]);}})['then'](respondWithStatusCode(_0x539641,null))[_0x2ee8('0x2b')](handleError(_0x539641,null));};exports['download']=function(_0x1312f0,_0x5d497b){var _0x34f145=moment()[_0x2ee8('0x54')]()[_0x2ee8('0x55')]();var _0x4f1be2=path[_0x2ee8('0x56')](config[_0x2ee8('0x57')],_0x2ee8('0x58'),_0x2ee8('0x59'),'tmp');var _0x42f36c=path['join'](config[_0x2ee8('0x57')],_0x2ee8('0x58'),_0x2ee8('0x59'),'attachments');var _0x399f80=path['join'](_0x4f1be2,_0x34f145);var _0x428a4d=util[_0x2ee8('0x49')](_0x2ee8('0x5a'),_0x1312f0[_0x2ee8('0x2e')]['id'],_0x34f145);var _0x3e4e69=path['join'](_0x4f1be2,_0x428a4d);var _0x34c04b=[];_0x34c04b[_0x2ee8('0x5b')]({'model':db[_0x2ee8('0x5c')],'as':_0x2ee8('0x5c'),'attributes':['id',_0x2ee8('0x5d')],'raw':!![]});_0x34c04b[_0x2ee8('0x5b')]({'model':db[_0x2ee8('0x5e')],'as':_0x2ee8('0x5f'),'attributes':['id',_0x2ee8('0x60'),_0x2ee8('0x61')],'raw':!![]});if(_0x1312f0[_0x2ee8('0x2c')][_0x2ee8('0x62')]){_0x34c04b[_0x2ee8('0x5b')]({'model':db['Attachment'],'as':_0x2ee8('0x63'),'raw':!![]});}var _0x419074=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x2ee8('0x3a'),_0x2ee8('0x64'),_0x2ee8('0x65'),_0x2ee8('0x66'),'read'],'include':_0x34c04b}];_0x419074[_0x2ee8('0x5b')]({'model':db[_0x2ee8('0x67')],'as':_0x2ee8('0x68'),'attributes':['id',_0x2ee8('0x20')]});_0x419074['push']({'model':db[_0x2ee8('0x5c')],'as':_0x2ee8('0x69'),'attributes':['id',_0x2ee8('0x5d')]});return db[_0x2ee8('0x23')][_0x2ee8('0x38')]({'where':{'id':_0x1312f0[_0x2ee8('0x2e')]['id']},'include':_0x419074})[_0x2ee8('0x1c')](handleEntityNotFound(_0x5d497b,null))[_0x2ee8('0x1c')](function(_0x16ec0c){if(_0x16ec0c){var _0x327770=_0x16ec0c['get']({'plain':!![]});fs[_0x2ee8('0x6a')](_0x399f80);var _0x51eed8={'channel':'Openchannel','account':_0x327770[_0x2ee8('0x68')][_0x2ee8('0x20')],'agent':_0x327770['Owner']?_0x327770[_0x2ee8('0x69')][_0x2ee8('0x5d')]:_0x2ee8('0x6b'),'createdAt':moment(_0x327770[_0x2ee8('0x64')])[_0x2ee8('0x49')](_0x2ee8('0x6c'))['toString'](),'closedAt':_0x327770[_0x2ee8('0x6d')]?moment(_0x327770[_0x2ee8('0x6e')])[_0x2ee8('0x49')](_0x2ee8('0x6c'))[_0x2ee8('0x55')]():'','disposition':_0x327770[_0x2ee8('0x6f')],'visibility':_0x327770[_0x2ee8('0x70')]?_0x2ee8('0x71'):_0x2ee8('0x72'),'messages':_(_0x327770[_0x2ee8('0x73')])[_0x2ee8('0x46')]({'secret':![]})['map'](function(_0x25014c){if(_0x25014c[_0x2ee8('0x63')]){var _0x4b462f=path['join'](_0x42f36c,_0x25014c['Attachment'][_0x2ee8('0x74')]);if(fs[_0x2ee8('0x75')](_0x4b462f)){fs[_0x2ee8('0x76')](_0x4b462f)[_0x2ee8('0x77')](fs[_0x2ee8('0x78')](path[_0x2ee8('0x56')](_0x399f80,_0x25014c[_0x2ee8('0x63')]['basename'])));}}return{'date':moment(_0x25014c[_0x2ee8('0x64')])[_0x2ee8('0x49')](_0x2ee8('0x6c'))[_0x2ee8('0x55')](),'sender':_0x25014c[_0x2ee8('0x65')]===_0x2ee8('0x79')?_0x25014c[_0x2ee8('0x5c')]?_0x25014c[_0x2ee8('0x5c')][_0x2ee8('0x5d')]:_0x2ee8('0x7a'):_0x25014c['Contact'][_0x2ee8('0x60')]+(_0x25014c['Contact'][_0x2ee8('0x61')]?'\x20'+_0x25014c[_0x2ee8('0x5f')]['lastName']:''),'body':_0x25014c[_0x2ee8('0x63')]?_0x25014c[_0x2ee8('0x63')][_0x2ee8('0x74')]:_0x25014c['body'],'direction':_0x25014c[_0x2ee8('0x65')]===_0x2ee8('0x79')?'A':'C','secret':_0x25014c[_0x2ee8('0x66')],'read':_0x25014c['read'],'attachment':_0x25014c[_0x2ee8('0x63')]};})[_0x2ee8('0x7b')]()};return ejs[_0x2ee8('0x7c')](path[_0x2ee8('0x56')](config['root'],_0x2ee8('0x58'),_0x2ee8('0x7d'),_0x2ee8('0x7e')),{'interaction':_0x51eed8})[_0x2ee8('0x1c')](function(_0x170d8c){var _0x538af1=path[_0x2ee8('0x56')](_0x399f80,_0x2ee8('0x7f')+_0x327770['id']+'-'+_0x34f145+'.pdf');var _0x41076b={'path':_0x538af1,'channel':_0x2ee8('0x80'),'interactionId':_0x327770['id']};return pdf[_0x2ee8('0x81')](_0x170d8c,_0x41076b);})[_0x2ee8('0x1c')](function(){return new Promise(function(_0x27345c,_0x21ce80){zipdir(_0x399f80,{'saveTo':_0x3e4e69},function(_0x4dc7d3,_0x108f37){if(_0x4dc7d3)return _0x21ce80(_0x4dc7d3);return _0x27345c(_0x108f37);});})['then'](function(){return new Promise(function(_0x55e143,_0x51669a){rimraf(_0x399f80,function(_0x48bf2e){if(_0x48bf2e)_0x51669a(_0x48bf2e);return _0x55e143();});});})['then'](function(){return _0x5d497b[_0x2ee8('0x82')](_0x3e4e69,_0x428a4d,function(_0x4c9e75){if(_0x4c9e75){logger[_0x2ee8('0x83')](_0x2ee8('0x84'),_0x4c9e75);}else{fs[_0x2ee8('0x85')](_0x3e4e69);}});});});}else{return _0x5d497b[_0x2ee8('0x1e')](0xc8);}})[_0x2ee8('0x2b')](handleError(_0x5d497b,null));}; \ No newline at end of file +var _0xa137=['merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','setTags','spread','Tag','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','Openchannel','toString','closed','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','System','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','update','then','destroy','error','stack','name','send','index','OpenchannelInteraction','getOptions','findAll','openchannel','query','user','catch','show','type','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter'];(function(_0x42b159,_0x2f2076){var _0x125d91=function(_0x343fb4){while(--_0x343fb4){_0x42b159['push'](_0x42b159['shift']());}};_0x125d91(++_0x2f2076);}(_0xa137,0xc0));var _0x7a13=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xa137[_0x36ed48];return _0x51c63a;};'use strict';var rimraf=require(_0x7a13('0x0'));var zipdir=require('zip-dir');var moment=require(_0x7a13('0x1'));var util=require(_0x7a13('0x2'));var path=require(_0x7a13('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7a13('0x4'));var Redis=require(_0x7a13('0x5'));var interaction=require(_0x7a13('0x6'));var qs=require(_0x7a13('0x7'));var pdf=require(_0x7a13('0x8'));var logger=require(_0x7a13('0x9'))(_0x7a13('0xa'));var config=require(_0x7a13('0xb'));var db=require('../../mysqldb')['db'];config[_0x7a13('0xc')]=_[_0x7a13('0xd')](config['redis'],{'host':_0x7a13('0xe'),'port':0x18eb});var socket=require(_0x7a13('0xf'))(new Redis(config[_0x7a13('0xc')]));require('./openchannelInteraction.socket')[_0x7a13('0x10')](socket);function respondWithStatusCode(_0x23c515,_0x16543f){_0x16543f=_0x16543f||0xcc;return function(_0x27b4a8){if(_0x27b4a8){return _0x23c515[_0x7a13('0x11')](_0x16543f);}return _0x23c515[_0x7a13('0x12')](_0x16543f)[_0x7a13('0x13')]();};}function respondWithResult(_0x5a0ec9,_0x3cd9a0){_0x3cd9a0=_0x3cd9a0||0xc8;return function(_0x106596){if(_0x106596){return _0x5a0ec9['status'](_0x3cd9a0)[_0x7a13('0x14')](_0x106596);}};}function respondWithFilteredResult(_0x787134,_0x4d7b64){return function(_0x22bdd8){if(_0x22bdd8){var _0x2d932a=typeof _0x4d7b64[_0x7a13('0x15')]===_0x7a13('0x16')&&typeof _0x4d7b64[_0x7a13('0x17')]===_0x7a13('0x16');var _0x583a55=_0x22bdd8[_0x7a13('0x18')];var _0x347325=_0x2d932a?0x0:_0x4d7b64[_0x7a13('0x15')];var _0x2ca700=_0x2d932a?_0x22bdd8[_0x7a13('0x18')]:_0x4d7b64['offset']+_0x4d7b64[_0x7a13('0x17')];var _0x25c419;if(_0x2ca700>=_0x583a55){_0x2ca700=_0x583a55;_0x25c419=0xc8;}else{_0x25c419=0xce;}_0x787134[_0x7a13('0x12')](_0x25c419);return _0x787134['set']('Content-Range',_0x347325+'-'+_0x2ca700+'/'+_0x583a55)['json'](_0x22bdd8);}return null;};}function saveUpdates(_0x4d8118){return function(_0x3a5384){if(_0x3a5384){return _0x3a5384[_0x7a13('0x19')](_0x4d8118)[_0x7a13('0x1a')](function(_0x218754){return _0x218754;});}return null;};}function removeEntity(_0x593fc9){return function(_0x44a32e){if(_0x44a32e){return _0x44a32e[_0x7a13('0x1b')]()[_0x7a13('0x1a')](function(){_0x593fc9['status'](0xcc)[_0x7a13('0x13')]();});}};}function handleEntityNotFound(_0x5e802a){return function(_0x75d352){if(!_0x75d352){_0x5e802a[_0x7a13('0x11')](0x194);}return _0x75d352;};}function handleError(_0x324209,_0x4a4076){_0x4a4076=_0x4a4076||0x1f4;return function(_0x4125ed){logger[_0x7a13('0x1c')](_0x4125ed[_0x7a13('0x1d')]);if(_0x4125ed[_0x7a13('0x1e')]){delete _0x4125ed[_0x7a13('0x1e')];}_0x324209[_0x7a13('0x12')](_0x4a4076)[_0x7a13('0x1f')](_0x4125ed);};}exports[_0x7a13('0x20')]=function(_0x2731a5,_0x33be0a){var _0x23f01a={};var _0x45430c=_['map'](db[_0x7a13('0x21')]['rawAttributes'],function(_0x292f04){return{'name':_0x292f04['fieldName'],'type':_0x292f04['type']['key']};});_0x23f01a=qs[_0x7a13('0x22')](_0x45430c,_0x2731a5);return interaction[_0x7a13('0x23')](_0x7a13('0x24'),_0x2731a5[_0x7a13('0x25')],_0x2731a5[_0x7a13('0x26')],_0x23f01a,_0x45430c)['then'](respondWithFilteredResult(_0x33be0a,_0x23f01a))[_0x7a13('0x27')](handleError(_0x33be0a,null));};exports[_0x7a13('0x28')]=function(_0x73cd36,_0x3e8b3d){var _0x82dc76={};if(_0x73cd36[_0x7a13('0x25')]['type']&&_0x73cd36[_0x7a13('0x25')][_0x7a13('0x29')]===_0x7a13('0x2a')){_0x82dc76[_0x7a13('0x2a')]=_0x73cd36[_0x7a13('0x2b')]['id'];}else{_0x82dc76['id']=_0x73cd36[_0x7a13('0x2b')]['id'];}var _0x218208={'raw':![],'where':_0x82dc76},_0x14b8d9={};_0x14b8d9[_0x7a13('0x2c')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x14b8d9[_0x7a13('0x25')]=_[_0x7a13('0x2d')](_0x73cd36['query']);_0x14b8d9[_0x7a13('0x2e')]=_[_0x7a13('0x2f')](_0x14b8d9[_0x7a13('0x2c')],_0x14b8d9[_0x7a13('0x25')]);_0x218208[_0x7a13('0x30')]=_['intersection'](_0x14b8d9[_0x7a13('0x2c')],qs['fields'](_0x73cd36[_0x7a13('0x25')][_0x7a13('0x31')]));_0x218208[_0x7a13('0x30')]=_0x218208['attributes'][_0x7a13('0x32')]?_0x218208[_0x7a13('0x30')]:_0x14b8d9[_0x7a13('0x2c')];if(_0x73cd36[_0x7a13('0x25')][_0x7a13('0x33')]){_0x218208['include']=[{'all':!![]}];}_0x218208=_['merge']({},_0x218208,_0x73cd36['options']);return db[_0x7a13('0x21')][_0x7a13('0x34')](_0x218208)[_0x7a13('0x1a')](handleEntityNotFound(_0x3e8b3d,null))[_0x7a13('0x1a')](respondWithResult(_0x3e8b3d,null))['catch'](handleError(_0x3e8b3d,null));};exports[_0x7a13('0x35')]=function(_0x1203d6,_0x4023fd){return db[_0x7a13('0x21')][_0x7a13('0x35')](_0x1203d6[_0x7a13('0x36')],{})[_0x7a13('0x1a')](respondWithResult(_0x4023fd,0xc9))[_0x7a13('0x27')](handleError(_0x4023fd,null));};exports['update']=function(_0x40efda,_0x218b52){if(_0x40efda[_0x7a13('0x36')]['id']){delete _0x40efda[_0x7a13('0x36')]['id'];}return db[_0x7a13('0x21')][_0x7a13('0x34')]({'where':{'id':_0x40efda[_0x7a13('0x2b')]['id']}})['then'](handleEntityNotFound(_0x218b52,null))[_0x7a13('0x1a')](saveUpdates(_0x40efda[_0x7a13('0x36')],null))[_0x7a13('0x1a')](respondWithResult(_0x218b52,null))[_0x7a13('0x27')](handleError(_0x218b52,null));};exports[_0x7a13('0x1b')]=function(_0x414c7b,_0x516433){return db['OpenchannelInteraction'][_0x7a13('0x34')]({'where':{'id':_0x414c7b['params']['id']}})['then'](handleEntityNotFound(_0x516433,null))[_0x7a13('0x1a')](removeEntity(_0x516433,null))[_0x7a13('0x27')](handleError(_0x516433,null));};exports['describe']=function(_0x3b9c25,_0x1ff9ce){return db['OpenchannelInteraction'][_0x7a13('0x37')]()[_0x7a13('0x1a')](respondWithResult(_0x1ff9ce,null))[_0x7a13('0x27')](handleError(_0x1ff9ce,null));};exports[_0x7a13('0x38')]=function(_0x1f94c8,_0x5543f8){return db[_0x7a13('0x39')][_0x7a13('0x34')]({'where':{'id':_0x1f94c8[_0x7a13('0x2b')]['id']}})[_0x7a13('0x1a')](handleEntityNotFound(_0x5543f8,null))[_0x7a13('0x1a')](function(_0x263668){if(_0x263668){return _0x263668[_0x7a13('0x38')](_0x1f94c8[_0x7a13('0x36')][_0x7a13('0x3a')],_[_0x7a13('0x3b')](_0x1f94c8[_0x7a13('0x36')],[_0x7a13('0x3a'),'id'])||{});}})[_0x7a13('0x1a')](respondWithResult(_0x5543f8,null))[_0x7a13('0x27')](handleError(_0x5543f8,null));};exports['getMessages']=function(_0x34e2a4,_0x3d7e9d){var _0x5540c1={'raw':![],'where':{}};var _0x32b3bd={};var _0x542251={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x7a13('0x3c')]({'where':{'id':_0x34e2a4[_0x7a13('0x2b')]['id']}})[_0x7a13('0x1a')](handleEntityNotFound(_0x3d7e9d,null))[_0x7a13('0x1a')](function(_0x2b9b7f){if(_0x2b9b7f){_0x32b3bd['model']=_[_0x7a13('0x2d')](db[_0x7a13('0x39')][_0x7a13('0x3d')]);_0x32b3bd[_0x7a13('0x25')]=_['keys'](_0x34e2a4['query']);_0x32b3bd['filters']=_[_0x7a13('0x2f')](_0x32b3bd[_0x7a13('0x2c')],_0x32b3bd[_0x7a13('0x25')]);_0x5540c1[_0x7a13('0x30')]=_[_0x7a13('0x2f')](_0x32b3bd['model'],qs[_0x7a13('0x31')](_0x34e2a4[_0x7a13('0x25')][_0x7a13('0x31')]));_0x5540c1[_0x7a13('0x30')]=_0x5540c1['attributes'][_0x7a13('0x32')]?_0x5540c1[_0x7a13('0x30')]:_0x32b3bd[_0x7a13('0x2c')];if(!_0x34e2a4['query'][_0x7a13('0x3e')](_0x7a13('0x3f'))){_0x5540c1[_0x7a13('0x17')]=qs[_0x7a13('0x17')](_0x34e2a4[_0x7a13('0x25')][_0x7a13('0x17')]);_0x5540c1['offset']=qs['offset'](_0x34e2a4[_0x7a13('0x25')][_0x7a13('0x15')]);}_0x5540c1[_0x7a13('0x40')]=qs[_0x7a13('0x41')](_0x34e2a4[_0x7a13('0x25')][_0x7a13('0x41')]);_0x5540c1[_0x7a13('0x42')]=qs[_0x7a13('0x2e')](_[_0x7a13('0x43')](_0x34e2a4[_0x7a13('0x25')],_0x32b3bd['filters']));_0x5540c1[_0x7a13('0x42')][_0x7a13('0x44')]=_0x2b9b7f['id'];if(_0x34e2a4[_0x7a13('0x25')][_0x7a13('0x45')]){_0x5540c1[_0x7a13('0x42')]=_[_0x7a13('0x46')](_0x5540c1[_0x7a13('0x42')],{'$or':_[_0x7a13('0x47')](_0x5540c1['attributes'],function(_0x3d0e18){var _0x525fa6={};_0x525fa6[_0x3d0e18]={'$like':'%'+_0x34e2a4[_0x7a13('0x25')][_0x7a13('0x45')]+'%'};return _0x525fa6;})});}if(_0x34e2a4['query'][_0x7a13('0x48')]){var _0x2809ab=_0x34e2a4['query'][_0x7a13('0x48')][_0x7a13('0x49')](',');var _0x4196d7={};_0x4196d7[_0x2809ab[0x0]]={'$gte':moment(_0x2809ab[0x1])[_0x7a13('0x4a')](_0x7a13('0x4b'))};_0x5540c1['where']=_['merge'](_0x5540c1[_0x7a13('0x42')],_0x4196d7);}_0x5540c1=_[_0x7a13('0x46')]({},_0x5540c1,_0x34e2a4[_0x7a13('0x4c')]);return db[_0x7a13('0x39')][_0x7a13('0x18')]({'where':_0x5540c1[_0x7a13('0x42')]})[_0x7a13('0x1a')](function(_0x3b074b){_0x542251[_0x7a13('0x18')]=_0x3b074b;if(_0x34e2a4[_0x7a13('0x25')][_0x7a13('0x33')]){_0x5540c1[_0x7a13('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7a13('0x23')](_0x5540c1);})['then'](function(_0x17258b){_0x542251[_0x7a13('0x4e')]=_0x17258b;return _0x542251;});}})['then'](respondWithFilteredResult(_0x3d7e9d,_0x5540c1))['catch'](handleError(_0x3d7e9d,null));};exports['addTags']=function(_0x3bf27f,_0x4c10cf){return db[_0x7a13('0x21')][_0x7a13('0x34')]({'where':{'id':_0x3bf27f['params']['id']}})[_0x7a13('0x1a')](handleEntityNotFound(_0x4c10cf,null))[_0x7a13('0x1a')](function(_0x31e8b5){if(_0x31e8b5){return _0x31e8b5[_0x7a13('0x4f')](_0x3bf27f[_0x7a13('0x36')][_0x7a13('0x3a')],_[_0x7a13('0x3b')](_0x3bf27f[_0x7a13('0x36')],['ids','id'])||{})[_0x7a13('0x50')](function(){return db[_0x7a13('0x51')][_0x7a13('0x23')]({'attributes':['id',_0x7a13('0x1e'),'color'],'where':{'id':_0x3bf27f[_0x7a13('0x36')][_0x7a13('0x3a')]}});})[_0x7a13('0x1a')](function(_0x5cfd31){socket['emit'](_0x7a13('0x52'),{'id':Number(_0x3bf27f[_0x7a13('0x2b')]['id']),'tags':_0x5cfd31||[]});return{'id':Number(_0x3bf27f[_0x7a13('0x2b')]['id']),'tags':_0x5cfd31||[]};});}})[_0x7a13('0x1a')](respondWithResult(_0x4c10cf,null))['catch'](handleError(_0x4c10cf,null));};exports[_0x7a13('0x53')]=function(_0x34bd7e,_0x5435dc){return db[_0x7a13('0x21')][_0x7a13('0x34')]({'where':{'id':_0x34bd7e[_0x7a13('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5435dc,null))[_0x7a13('0x1a')](function(_0xd120c8){if(_0xd120c8){return _0xd120c8['removeTags'](_0x34bd7e[_0x7a13('0x25')][_0x7a13('0x3a')]);}})['then'](respondWithStatusCode(_0x5435dc,null))[_0x7a13('0x27')](handleError(_0x5435dc,null));};exports[_0x7a13('0x54')]=function(_0x5d1d4b,_0x55decb){var _0x128485=moment()[_0x7a13('0x55')]()['toString']();var _0x2f65dc=path[_0x7a13('0x56')](config[_0x7a13('0x57')],'server',_0x7a13('0x58'),_0x7a13('0x59'));var _0x890356=path[_0x7a13('0x56')](config[_0x7a13('0x57')],_0x7a13('0x5a'),_0x7a13('0x58'),'attachments');var _0x318847=path['join'](_0x2f65dc,_0x128485);var _0x52ed74=util[_0x7a13('0x4a')](_0x7a13('0x5b'),_0x5d1d4b[_0x7a13('0x2b')]['id'],_0x128485);var _0x85527a=path['join'](_0x2f65dc,_0x52ed74);var _0x3e5aca=[];_0x3e5aca[_0x7a13('0x5c')]({'model':db[_0x7a13('0x5d')],'as':_0x7a13('0x5d'),'attributes':['id',_0x7a13('0x5e')],'raw':!![]});_0x3e5aca[_0x7a13('0x5c')]({'model':db[_0x7a13('0x5f')],'as':_0x7a13('0x60'),'attributes':['id',_0x7a13('0x61'),_0x7a13('0x62')],'raw':!![]});if(_0x5d1d4b[_0x7a13('0x25')]['attachments']){_0x3e5aca['push']({'model':db[_0x7a13('0x63')],'as':'Attachment','raw':!![]});}var _0x55b81b=[{'model':db[_0x7a13('0x39')],'as':_0x7a13('0x64'),'attributes':['id',_0x7a13('0x36'),_0x7a13('0x65'),_0x7a13('0x66'),_0x7a13('0x67'),_0x7a13('0x68')],'include':_0x3e5aca}];_0x55b81b[_0x7a13('0x5c')]({'model':db[_0x7a13('0x69')],'as':_0x7a13('0x6a'),'attributes':['id',_0x7a13('0x1e')]});_0x55b81b[_0x7a13('0x5c')]({'model':db[_0x7a13('0x5d')],'as':_0x7a13('0x6b'),'attributes':['id',_0x7a13('0x5e')]});return db[_0x7a13('0x21')][_0x7a13('0x34')]({'where':{'id':_0x5d1d4b['params']['id']},'include':_0x55b81b})[_0x7a13('0x1a')](handleEntityNotFound(_0x55decb,null))['then'](function(_0x538c9e){if(_0x538c9e){var _0x1df671=_0x538c9e[_0x7a13('0x6c')]({'plain':!![]});fs['mkdirSync'](_0x318847);var _0x40b5f8={'channel':_0x7a13('0x6d'),'account':_0x1df671['Account'][_0x7a13('0x1e')],'agent':_0x1df671[_0x7a13('0x6b')]?_0x1df671[_0x7a13('0x6b')]['fullname']:'N.A.','createdAt':moment(_0x1df671['createdAt'])[_0x7a13('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7a13('0x6e')](),'closedAt':_0x1df671[_0x7a13('0x6f')]?moment(_0x1df671[_0x7a13('0x70')])[_0x7a13('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7a13('0x6e')]():'','disposition':_0x1df671[_0x7a13('0x71')],'visibility':_0x1df671[_0x7a13('0x72')]?_0x7a13('0x73'):_0x7a13('0x74'),'messages':_(_0x1df671['Messages'])[_0x7a13('0x45')]({'secret':![]})[_0x7a13('0x47')](function(_0x12ecc2){if(_0x12ecc2[_0x7a13('0x63')]){var _0x5612b2=path[_0x7a13('0x56')](_0x890356,_0x12ecc2[_0x7a13('0x63')][_0x7a13('0x75')]);if(fs['existsSync'](_0x5612b2)){fs[_0x7a13('0x76')](_0x5612b2)[_0x7a13('0x77')](fs[_0x7a13('0x78')](path['join'](_0x318847,_0x12ecc2[_0x7a13('0x63')][_0x7a13('0x75')])));}}return{'date':moment(_0x12ecc2['createdAt'])[_0x7a13('0x4a')](_0x7a13('0x4b'))[_0x7a13('0x6e')](),'sender':_0x12ecc2[_0x7a13('0x66')]==='out'?_0x12ecc2[_0x7a13('0x5d')]?_0x12ecc2[_0x7a13('0x5d')][_0x7a13('0x5e')]:_0x7a13('0x79'):_0x12ecc2[_0x7a13('0x60')][_0x7a13('0x61')]+(_0x12ecc2[_0x7a13('0x60')][_0x7a13('0x62')]?'\x20'+_0x12ecc2[_0x7a13('0x60')][_0x7a13('0x62')]:''),'body':_0x12ecc2['Attachment']?_0x12ecc2[_0x7a13('0x63')][_0x7a13('0x75')]:_0x12ecc2[_0x7a13('0x36')],'direction':_0x12ecc2[_0x7a13('0x66')]===_0x7a13('0x7a')?'A':'C','secret':_0x12ecc2['secret'],'read':_0x12ecc2[_0x7a13('0x68')],'attachment':_0x12ecc2['Attachment']};})[_0x7a13('0x7b')]()};return ejs[_0x7a13('0x7c')](path['join'](config[_0x7a13('0x57')],'server',_0x7a13('0x7d'),_0x7a13('0x7e')),{'interaction':_0x40b5f8})[_0x7a13('0x1a')](function(_0x42e637){var _0x183403=path[_0x7a13('0x56')](_0x318847,_0x7a13('0x7f')+_0x1df671['id']+'-'+_0x128485+_0x7a13('0x80'));var _0x392cb2={'path':_0x183403,'channel':_0x7a13('0x6d'),'interactionId':_0x1df671['id']};return pdf[_0x7a13('0x81')](_0x42e637,_0x392cb2);})[_0x7a13('0x1a')](function(){return new Promise(function(_0x47f367,_0x34a0ed){zipdir(_0x318847,{'saveTo':_0x85527a},function(_0x41cb92,_0x4d0eb1){if(_0x41cb92)return _0x34a0ed(_0x41cb92);return _0x47f367(_0x4d0eb1);});})[_0x7a13('0x1a')](function(){return new Promise(function(_0x4953f3,_0x50b042){rimraf(_0x318847,function(_0x4c53bf){if(_0x4c53bf)_0x50b042(_0x4c53bf);return _0x4953f3();});});})[_0x7a13('0x1a')](function(){return _0x55decb['download'](_0x85527a,_0x52ed74,function(_0x11c699){if(_0x11c699){logger[_0x7a13('0x1c')](_0x7a13('0x82'),_0x11c699);}else{fs['unlinkSync'](_0x85527a);}});});});}else{return _0x55decb[_0x7a13('0x11')](0xc8);}})['catch'](handleError(_0x55decb,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b4dd6d9..5900690 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 _0x8210=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','getUsers','setDataValue','Users','findAll'];(function(_0x56d9a1,_0x5e6784){var _0x40e340=function(_0x329040){while(--_0x329040){_0x56d9a1['push'](_0x56d9a1['shift']());}};_0x40e340(++_0x5e6784);}(_0x8210,0x137));var _0x0821=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8210[_0x18ab2a];return _0x16dcee;};'use strict';var EventEmitter=require(_0x0821('0x0'));var OpenchannelInteraction=require(_0x0821('0x1'))['db'][_0x0821('0x2')];var OpenchannelMessage=require(_0x0821('0x1'))['db'][_0x0821('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0821('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b2c9a){return function(_0x38efb8,_0x28496c,_0x2a89dc){_0x38efb8[_0x0821('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x383f91){_0x38efb8[_0x0821('0x6')](_0x0821('0x7'),_0x383f91['map'](function(_0x147b17){return{'id':_0x147b17['id']};}));return OpenchannelMessage[_0x0821('0x8')]({'where':{'OpenchannelInteractionId':_0x38efb8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0821('0x9')](function(_0x27cace){_0x38efb8[_0x0821('0x6')](_0x0821('0xa'),_0x27cace[_0x0821('0xb')]);OpenchannelInteractionEvents[_0x0821('0xc')](_0x3b2c9a+':'+_0x38efb8['id'],_0x38efb8);OpenchannelInteractionEvents['emit'](_0x3b2c9a,_0x38efb8);_0x2a89dc(null);})[_0x0821('0xd')](_0x2a89dc(null));};}for(var e in events){if(events[_0x0821('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x0821('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x85df=['setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hook','../../mysqldb','OpenchannelMessage'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x85df,0x7e));var _0xf85d=function(_0xdd5dfc,_0x105477){_0xdd5dfc=_0xdd5dfc-0x0;var _0x4587c8=_0x85df[_0xdd5dfc];return _0x4587c8;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xf85d('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0xf85d('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf85d('0x2')](0x0);var events={'afterCreate':_0xf85d('0x3'),'afterUpdate':_0xf85d('0x4'),'afterDestroy':_0xf85d('0x5')};function emitEvent(_0x3d55e5){return function(_0x22d061,_0x5cee19,_0x5d59e4){_0x22d061['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x32dc71){_0x22d061[_0xf85d('0x6')](_0xf85d('0x7'),_0x32dc71[_0xf85d('0x8')](function(_0x7bad40){return{'id':_0x7bad40['id']};}));return OpenchannelMessage[_0xf85d('0x9')]({'where':{'OpenchannelInteractionId':_0x22d061['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf85d('0xa')](function(_0xbc81c0){_0x22d061[_0xf85d('0x6')](_0xf85d('0xb'),_0xbc81c0[_0xf85d('0xc')]);OpenchannelInteractionEvents['emit'](_0x3d55e5+':'+_0x22d061['id'],_0x22d061);OpenchannelInteractionEvents[_0xf85d('0xd')](_0x3d55e5,_0x22d061);_0x5d59e4(null);})[_0xf85d('0xe')](_0x5d59e4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xf85d('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 1460984..3cb1908 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 _0x9552=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4c8281,_0x964908){var _0x3ceece=function(_0x42d82d){while(--_0x42d82d){_0x4c8281['push'](_0x4c8281['shift']());}};_0x3ceece(++_0x964908);}(_0x9552,0xea));var _0x2955=function(_0x556330,_0x31816a){_0x556330=_0x556330-0x0;var _0xb4364f=_0x9552[_0x556330];return _0xb4364f;};'use strict';var _=require(_0x2955('0x0'));var util=require(_0x2955('0x1'));var logger=require(_0x2955('0x2'))('api');var moment=require(_0x2955('0x3'));var BPromise=require(_0x2955('0x4'));var rp=require(_0x2955('0x5'));var fs=require('fs');var path=require(_0x2955('0x6'));var rimraf=require(_0x2955('0x7'));var config=require(_0x2955('0x8'));var attributes=require(_0x2955('0x9'));module[_0x2955('0xa')]=function(_0x3e8a1e,_0x4f5e98){return _0x3e8a1e[_0x2955('0xb')](_0x2955('0xc'),attributes,{'tableName':_0x2955('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2955('0xe'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x27e3ee,_0x26e6dc,_0x2c4ef7){if(_0x27e3ee[_0x2955('0xf')]('closed')){_0x27e3ee[_0x2955('0x10')]=moment()['format'](_0x2955('0x11'));}_0x2c4ef7(null,_0x27e3ee);}}});}; \ No newline at end of file +var _0x04b1=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1a0c32,_0x30a902){var _0x1f0f0e=function(_0x2a639b){while(--_0x2a639b){_0x1a0c32['push'](_0x1a0c32['shift']());}};_0x1f0f0e(++_0x30a902);}(_0x04b1,0x98));var _0x104b=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x04b1[_0x256d6a];return _0x460058;};'use strict';var _=require(_0x104b('0x0'));var util=require(_0x104b('0x1'));var logger=require(_0x104b('0x2'))(_0x104b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x104b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x104b('0x5'));var config=require(_0x104b('0x6'));var attributes=require(_0x104b('0x7'));module[_0x104b('0x8')]=function(_0x425e35,_0x3cc8e7){return _0x425e35[_0x104b('0x9')](_0x104b('0xa'),attributes,{'tableName':_0x104b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x104b('0xc'),'collate':_0x104b('0xd'),'hooks':{'beforeUpdate':function(_0x31e6ec,_0x36ace2,_0x4c7596){if(_0x31e6ec[_0x104b('0xe')](_0x104b('0xf'))){_0x31e6ec[_0x104b('0x10')]=moment()[_0x104b('0x11')](_0x104b('0x12'));}_0x4c7596(null,_0x31e6ec);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ceb3d99..f906256 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 _0xccec=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','UpdateOpenchannelInteraction','update','body','options','raw','attributes','limit','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','then','addTags','ids','omit','AddTags','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','request\x20sent'];(function(_0x32eefb,_0xee05a3){var _0x3ef53a=function(_0x2a6c69){while(--_0x2a6c69){_0x32eefb['push'](_0x32eefb['shift']());}};_0x3ef53a(++_0xee05a3);}(_0xccec,0x97));var _0xccce=function(_0x532d86,_0x2067ff){_0x532d86=_0x532d86-0x0;var _0x152b27=_0xccec[_0x532d86];return _0x152b27;};'use strict';var _=require('lodash');var util=require(_0xccce('0x0'));var moment=require(_0xccce('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccce('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xccce('0x3'));var logger=require(_0xccce('0x4'))(_0xccce('0x5'));var config=require(_0xccce('0x6'));var jayson=require(_0xccce('0x7'));var client=jayson[_0xccce('0x8')][_0xccce('0x9')]({'port':0x232a});config['redis']=_[_0xccce('0xa')](config['redis'],{'host':_0xccce('0xb'),'port':0x18eb});var socket=require(_0xccce('0xc'))(new Redis(config[_0xccce('0xd')]));require('./openchannelInteraction.socket')[_0xccce('0xe')](socket);function respondWithRpcPromise(_0x2a5011,_0x427450,_0x16d733){return new BPromise(function(_0x5c75ec,_0x4a45ff){return client[_0xccce('0xf')](_0x2a5011,_0x16d733)['then'](function(_0x3ce2a6){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x427450,_0xccce('0x10'));logger[_0xccce('0x11')](_0xccce('0x12'),_0x427450,_0xccce('0x10'),JSON[_0xccce('0x13')](_0x3ce2a6));if(_0x3ce2a6[_0xccce('0x14')]){if(_0x3ce2a6[_0xccce('0x14')][_0xccce('0x15')]===0x1f4){logger[_0xccce('0x14')](_0xccce('0x16'),_0x427450,_0x3ce2a6[_0xccce('0x14')][_0xccce('0x17')]);return _0x4a45ff(_0x3ce2a6[_0xccce('0x14')][_0xccce('0x17')]);}logger[_0xccce('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x427450,_0x3ce2a6[_0xccce('0x14')][_0xccce('0x17')]);return _0x5c75ec(_0x3ce2a6['error'][_0xccce('0x17')]);}else{logger[_0xccce('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x427450,_0xccce('0x10'));_0x5c75ec(_0x3ce2a6[_0xccce('0x19')][_0xccce('0x17')]);}})['catch'](function(_0x2d7664){logger[_0xccce('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x427450,_0x2d7664);_0x4a45ff(_0x2d7664);});});}exports[_0xccce('0x1a')]=function(_0x277d01){var _0x1d66f6=this;return new Promise(function(_0x365a8f,_0x3726a5){return db['OpenchannelInteraction'][_0xccce('0x1b')](_0x277d01[_0xccce('0x1c')],{'raw':_0x277d01[_0xccce('0x1d')]?_0x277d01[_0xccce('0x1d')][_0xccce('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x277d01[_0xccce('0x1d')]?_0x277d01[_0xccce('0x1d')]['where']||null:null,'attributes':_0x277d01[_0xccce('0x1d')]?_0x277d01['options'][_0xccce('0x1f')]||null:null,'limit':_0x277d01[_0xccce('0x1d')]?_0x277d01[_0xccce('0x1d')][_0xccce('0x20')]||null:null})['then'](function(_0x3cf718){logger['info'](_0xccce('0x1a'),_0x277d01);logger[_0xccce('0x11')](_0xccce('0x1a'),_0x277d01,JSON[_0xccce('0x13')](_0x3cf718));_0x365a8f(_0x3cf718);})[_0xccce('0x21')](function(_0x4788b3){logger[_0xccce('0x14')](_0xccce('0x1a'),_0x4788b3['message'],_0x277d01);_0x3726a5(_0x1d66f6[_0xccce('0x14')](0x1f4,_0x4788b3[_0xccce('0x17')]));});});};exports[_0xccce('0x22')]=function(_0x9222f2){return new Promise(function(_0x4dd463,_0x1b790e){return db[_0xccce('0x23')][_0xccce('0x24')]({'where':_0x9222f2[_0xccce('0x1d')]?_0x9222f2['options']['where']||null:null})[_0xccce('0x25')](function(_0x3b3160){if(_0x3b3160){return _0x3b3160[_0xccce('0x26')](_0x9222f2[_0xccce('0x1c')][_0xccce('0x27')],_[_0xccce('0x28')](_0x9222f2[_0xccce('0x1c')],['ids','id'])||{});}})['spread'](function(_0x137cd8){logger['info'](_0xccce('0x29'),_0x9222f2);logger[_0xccce('0x11')](_0xccce('0x29'),_0x9222f2,JSON['stringify'](_0x137cd8));_0x4dd463(_0x137cd8);})[_0xccce('0x21')](function(_0x1d2fb4){logger[_0xccce('0x14')]('AddTags',_0x1d2fb4[_0xccce('0x17')],_0x9222f2);_0x1b790e(_this['error'](0x1f4,_0x1d2fb4['message']));});});}; \ No newline at end of file +var _0xdd0b=['AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','update','body','options','raw','where','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread'];(function(_0x4ff939,_0x5f54ea){var _0x3f8ba8=function(_0x25e6f7){while(--_0x25e6f7){_0x4ff939['push'](_0x4ff939['shift']());}};_0x3f8ba8(++_0x5f54ea);}(_0xdd0b,0x169));var _0xbdd0=function(_0x4a4589,_0xbe983c){_0x4a4589=_0x4a4589-0x0;var _0x27e15b=_0xdd0b[_0x4a4589];return _0x27e15b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbdd0('0x0'));var BPromise=require(_0xbdd0('0x1'));var rs=require(_0xbdd0('0x2'));var fs=require('fs');var Redis=require(_0xbdd0('0x3'));var db=require(_0xbdd0('0x4'))['db'];var utils=require(_0xbdd0('0x5'));var logger=require('../../config/logger')(_0xbdd0('0x6'));var config=require(_0xbdd0('0x7'));var jayson=require(_0xbdd0('0x8'));var client=jayson['client'][_0xbdd0('0x9')]({'port':0x232a});config[_0xbdd0('0xa')]=_[_0xbdd0('0xb')](config[_0xbdd0('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbdd0('0xa')]));require(_0xbdd0('0xc'))[_0xbdd0('0xd')](socket);function respondWithRpcPromise(_0x1d9f5b,_0x4f7f14,_0x24cd2e){return new BPromise(function(_0x51aa7c,_0x56fd19){return client[_0xbdd0('0xe')](_0x1d9f5b,_0x24cd2e)[_0xbdd0('0xf')](function(_0x471950){logger[_0xbdd0('0x10')](_0xbdd0('0x11'),_0x4f7f14,_0xbdd0('0x12'));logger[_0xbdd0('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4f7f14,_0xbdd0('0x12'),JSON[_0xbdd0('0x14')](_0x471950));if(_0x471950['error']){if(_0x471950['error'][_0xbdd0('0x15')]===0x1f4){logger[_0xbdd0('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4f7f14,_0x471950[_0xbdd0('0x16')][_0xbdd0('0x17')]);return _0x56fd19(_0x471950[_0xbdd0('0x16')]['message']);}logger[_0xbdd0('0x16')](_0xbdd0('0x11'),_0x4f7f14,_0x471950[_0xbdd0('0x16')][_0xbdd0('0x17')]);return _0x51aa7c(_0x471950[_0xbdd0('0x16')][_0xbdd0('0x17')]);}else{logger['info'](_0xbdd0('0x11'),_0x4f7f14,_0xbdd0('0x12'));_0x51aa7c(_0x471950['result']['message']);}})[_0xbdd0('0x18')](function(_0x27fc18){logger[_0xbdd0('0x16')](_0xbdd0('0x11'),_0x4f7f14,_0x27fc18);_0x56fd19(_0x27fc18);});});}exports['UpdateOpenchannelInteraction']=function(_0x8abd42){var _0x1cf65c=this;return new Promise(function(_0x13b115,_0x251e5a){return db['OpenchannelInteraction'][_0xbdd0('0x19')](_0x8abd42[_0xbdd0('0x1a')],{'raw':_0x8abd42[_0xbdd0('0x1b')]?_0x8abd42[_0xbdd0('0x1b')][_0xbdd0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8abd42[_0xbdd0('0x1b')]?_0x8abd42['options'][_0xbdd0('0x1d')]||null:null,'attributes':_0x8abd42[_0xbdd0('0x1b')]?_0x8abd42[_0xbdd0('0x1b')]['attributes']||null:null,'limit':_0x8abd42[_0xbdd0('0x1b')]?_0x8abd42[_0xbdd0('0x1b')][_0xbdd0('0x1e')]||null:null})[_0xbdd0('0xf')](function(_0xecbaac){logger[_0xbdd0('0x10')](_0xbdd0('0x1f'),_0x8abd42);logger['debug'](_0xbdd0('0x1f'),_0x8abd42,JSON[_0xbdd0('0x14')](_0xecbaac));_0x13b115(_0xecbaac);})[_0xbdd0('0x18')](function(_0x57d434){logger[_0xbdd0('0x16')](_0xbdd0('0x1f'),_0x57d434[_0xbdd0('0x17')],_0x8abd42);_0x251e5a(_0x1cf65c[_0xbdd0('0x16')](0x1f4,_0x57d434['message']));});});};exports[_0xbdd0('0x20')]=function(_0x8ffcbb){return new Promise(function(_0x2cfa9a,_0x48a699){return db[_0xbdd0('0x21')][_0xbdd0('0x22')]({'where':_0x8ffcbb['options']?_0x8ffcbb['options']['where']||null:null})['then'](function(_0x2c4ca2){if(_0x2c4ca2){return _0x2c4ca2[_0xbdd0('0x23')](_0x8ffcbb[_0xbdd0('0x1a')][_0xbdd0('0x24')],_[_0xbdd0('0x25')](_0x8ffcbb[_0xbdd0('0x1a')],[_0xbdd0('0x24'),'id'])||{});}})[_0xbdd0('0x26')](function(_0x2ed291){logger[_0xbdd0('0x10')](_0xbdd0('0x27'),_0x8ffcbb);logger[_0xbdd0('0x13')]('AddTags',_0x8ffcbb,JSON[_0xbdd0('0x14')](_0x2ed291));_0x2cfa9a(_0x2ed291);})[_0xbdd0('0x18')](function(_0x163ffb){logger[_0xbdd0('0x16')](_0xbdd0('0x27'),_0x163ffb[_0xbdd0('0x17')],_0x8ffcbb);_0x48a699(_this['error'](0x1f4,_0x163ffb[_0xbdd0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 54394c4..450ed4b 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 _0xcea1=['removeListener','register','length','./openchannelInteraction.events','save','emit'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xcea1,0xf9));var _0x1cea=function(_0x14f6db,_0x4d9f26){_0x14f6db=_0x14f6db-0x0;var _0x45344d=_0xcea1[_0x14f6db];return _0x45344d;};'use strict';var OpenchannelInteractionEvents=require(_0x1cea('0x0'));var events=[_0x1cea('0x1'),'remove','update'];function createListener(_0x154fc3,_0x4d5431){return function(_0x350780){_0x4d5431[_0x1cea('0x2')](_0x154fc3,_0x350780);};}function removeListener(_0x4603c1,_0x2d29f0){return function(){OpenchannelInteractionEvents[_0x1cea('0x3')](_0x4603c1,_0x2d29f0);};}exports[_0x1cea('0x4')]=function(_0x1cb4bb){for(var _0x4b7549=0x0,_0x60b245=events[_0x1cea('0x5')];_0x4b7549<_0x60b245;_0x4b7549++){var _0xcacc1b=events[_0x4b7549];var _0x2b4911=createListener('openchannelInteraction:'+_0xcacc1b,_0x1cb4bb);OpenchannelInteractionEvents['on'](_0xcacc1b,_0x2b4911);}}; \ No newline at end of file +var _0x707e=['./openchannelInteraction.events','save','update','removeListener','register','length','openchannelInteraction:'];(function(_0x4124c8,_0x55b4fe){var _0x59b070=function(_0x34f7ea){while(--_0x34f7ea){_0x4124c8['push'](_0x4124c8['shift']());}};_0x59b070(++_0x55b4fe);}(_0x707e,0x165));var _0xe707=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x707e[_0x18cac4];return _0x2227c6;};'use strict';var OpenchannelInteractionEvents=require(_0xe707('0x0'));var events=[_0xe707('0x1'),'remove',_0xe707('0x2')];function createListener(_0x49d322,_0x1041d3){return function(_0x38cea7){_0x1041d3['emit'](_0x49d322,_0x38cea7);};}function removeListener(_0xbedb85,_0x586eb6){return function(){OpenchannelInteractionEvents[_0xe707('0x3')](_0xbedb85,_0x586eb6);};}exports[_0xe707('0x4')]=function(_0x2c0030){for(var _0x58dee7=0x0,_0x4a483f=events[_0xe707('0x5')];_0x58dee7<_0x4a483f;_0x58dee7++){var _0x1e47ff=events[_0x58dee7];var _0x22b4cb=createListener(_0xe707('0x6')+_0x1e47ff,_0x2c0030);OpenchannelInteractionEvents['on'](_0x1e47ff,_0x22b4cb);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5bf9865..4bc5574 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x955747,_0xd1ab29){var _0x3ff6d5=function(_0x56ef79){while(--_0x56ef79){_0x955747['push'](_0x955747['shift']());}};_0x3ff6d5(++_0xd1ab29);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xcb91[_0x1ee351];return _0x245aaf;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b4caa36..d356d55 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3aa=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x3de97a,_0x4f9bba){var _0x463d5d=function(_0x34ad1f){while(--_0x34ad1f){_0x3de97a['push'](_0x3de97a['shift']());}};_0x463d5d(++_0x4f9bba);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x19cbac,_0x4a7597){_0x19cbac=_0x19cbac-0x0;var _0x180da3=_0xf3aa[_0x19cbac];return _0x180da3;};'use strict';var Sequelize=require(_0xaf3a('0x0'));module[_0xaf3a('0x1')]={'body':{'type':Sequelize[_0xaf3a('0x2')](_0xaf3a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xaf3a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xaf3a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xaf3a('0x6')]},'providerName':{'type':Sequelize[_0xaf3a('0x7')]},'providerResponse':{'type':Sequelize[_0xaf3a('0x2')]}}; \ No newline at end of file +var _0x4a1d=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x22b883,_0x2931e0){var _0x16089f=function(_0xf9daed){while(--_0xf9daed){_0x22b883['push'](_0x22b883['shift']());}};_0x16089f(++_0x2931e0);}(_0x4a1d,0x77));var _0xd4a1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4a1d[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xd4a1('0x0'));module[_0xd4a1('0x1')]={'body':{'type':Sequelize[_0xd4a1('0x2')](_0xd4a1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd4a1('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd4a1('0x5')]('in',_0xd4a1('0x6')),'defaultValue':_0xd4a1('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd4a1('0x7')]},'providerName':{'type':Sequelize[_0xd4a1('0x8')]},'providerResponse':{'type':Sequelize[_0xd4a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 3a567d2..ba37cc7 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 _0xd0e0=['channel','reject','EventManager','rejectmessage','util','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','../../config/logger','openchannel-interactions','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','json','offset','undefined','count','Content-Range','update','then','destroy','status','end','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','OpenchannelMessage','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','accept','openchannel','acceptMessage','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','format','SIP/%s'];(function(_0x49c890,_0x15e07f){var _0x310738=function(_0x3c604e){while(--_0x3c604e){_0x49c890['push'](_0x49c890['shift']());}};_0x310738(++_0x15e07f);}(_0xd0e0,0x66));var _0x0d0e=function(_0x88764f,_0x22546f){_0x88764f=_0x88764f-0x0;var _0x2d0461=_0xd0e0[_0x88764f];return _0x2d0461;};'use strict';var util=require(_0x0d0e('0x0'));var _=require(_0x0d0e('0x1'));var Redis=require(_0x0d0e('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x0d0e('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x0d0e('0x4'));var db=require(_0x0d0e('0x5'))['db'];config[_0x0d0e('0x6')]=_['defaults'](config['redis'],{'host':_0x0d0e('0x7'),'port':0x18eb});var socket=require(_0x0d0e('0x8'))(new Redis(config[_0x0d0e('0x6')]));require(_0x0d0e('0x9'))['register'](socket);var jayson=require(_0x0d0e('0xa'));var client=jayson[_0x0d0e('0xb')][_0x0d0e('0xc')]({'port':0x232c});var client9002=jayson[_0x0d0e('0xb')][_0x0d0e('0xc')]({'port':0x232a});var interaction_log=require(_0x0d0e('0xd'))(_0x0d0e('0xe'));function respondWithRpcPromise(_0x310bd9,_0x19f64d,_0x1f7f94,_0x4e34da){return new Promise(function(_0x5ad4a0,_0x3c0735){var _0x2221dc=_0x4e34da||client;return _0x2221dc[_0x0d0e('0xf')](_0x310bd9,_0x1f7f94)['then'](function(_0x350fd7){logger[_0x0d0e('0x10')](_0x0d0e('0x11'),_0x19f64d,_0x0d0e('0x12'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x19f64d,'request\x20sent',JSON[_0x0d0e('0x13')](_0x350fd7));if(_0x350fd7['error']){if(_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x19f64d,_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x16')]);return _0x3c0735(_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x16')]);}logger[_0x0d0e('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x19f64d,_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x16')]);return _0x5ad4a0(_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x16')]);}else{logger[_0x0d0e('0x10')](_0x0d0e('0x11'),_0x19f64d,_0x0d0e('0x12'));_0x5ad4a0(_0x350fd7[_0x0d0e('0x17')][_0x0d0e('0x16')]);}})['catch'](function(_0x89012a){logger['error'](_0x0d0e('0x11'),_0x19f64d,_0x89012a);_0x3c0735(_0x89012a);});});}function respondWithResult(_0x4aef62,_0x199eda){_0x199eda=_0x199eda||0xc8;return function(_0x238daa){if(_0x238daa){return _0x4aef62['status'](_0x199eda)[_0x0d0e('0x18')](_0x238daa);}};}function respondWithFilteredResult(_0x584d68,_0x355166){return function(_0x1527de){if(_0x1527de){var _0x452271=typeof _0x355166[_0x0d0e('0x19')]===_0x0d0e('0x1a')&&typeof _0x355166['limit']===_0x0d0e('0x1a');var _0x5066e5=_0x1527de[_0x0d0e('0x1b')];var _0x47cc14=_0x452271?0x0:_0x355166['offset'];var _0x1f1d9c=_0x452271?_0x1527de[_0x0d0e('0x1b')]:_0x355166[_0x0d0e('0x19')]+_0x355166['limit'];var _0x8a6f0d;if(_0x1f1d9c>=_0x5066e5){_0x1f1d9c=_0x5066e5;_0x8a6f0d=0xc8;}else{_0x8a6f0d=0xce;}_0x584d68['status'](_0x8a6f0d);return _0x584d68['set'](_0x0d0e('0x1c'),_0x47cc14+'-'+_0x1f1d9c+'/'+_0x5066e5)[_0x0d0e('0x18')](_0x1527de);}return null;};}function saveUpdates(_0x16ce96){return function(_0x2a79d3){if(_0x2a79d3){return _0x2a79d3[_0x0d0e('0x1d')](_0x16ce96)[_0x0d0e('0x1e')](function(_0x44c1d5){return _0x44c1d5;});}return null;};}function removeEntity(_0x4f7b46){return function(_0x137497){if(_0x137497){return _0x137497[_0x0d0e('0x1f')]()[_0x0d0e('0x1e')](function(){_0x4f7b46[_0x0d0e('0x20')](0xcc)[_0x0d0e('0x21')]();});}};}function handleEntityNotFound(_0x7a5237){return function(_0xe4ba2d){if(!_0xe4ba2d){_0x7a5237['sendStatus'](0x194);}return _0xe4ba2d;};}function handleError(_0x5dd496,_0x34c443){_0x34c443=_0x34c443||0x1f4;return function(_0x33f42b){logger[_0x0d0e('0x14')](_0x33f42b['stack']);if(_0x33f42b[_0x0d0e('0x22')]){delete _0x33f42b[_0x0d0e('0x22')];}_0x5dd496[_0x0d0e('0x20')](_0x34c443)[_0x0d0e('0x23')](_0x33f42b);};}exports[_0x0d0e('0x24')]=function(_0x96456f,_0x147dc9){var _0x290448={},_0x2e54bc={},_0x2608be={'count':0x0,'rows':[]};var _0x50fee4=_[_0x0d0e('0x25')](db['OpenchannelMessage']['rawAttributes'],function(_0x3193fb){return{'name':_0x3193fb['fieldName'],'type':_0x3193fb[_0x0d0e('0x26')][_0x0d0e('0x27')]};});_0x2e54bc['model']=_[_0x0d0e('0x25')](_0x50fee4,_0x0d0e('0x22'));_0x2e54bc[_0x0d0e('0x28')]=_[_0x0d0e('0x29')](_0x96456f[_0x0d0e('0x28')]);_0x2e54bc[_0x0d0e('0x2a')]=_[_0x0d0e('0x2b')](_0x2e54bc[_0x0d0e('0x2c')],_0x2e54bc[_0x0d0e('0x28')]);_0x290448[_0x0d0e('0x2d')]=_[_0x0d0e('0x2b')](_0x2e54bc[_0x0d0e('0x2c')],qs[_0x0d0e('0x2e')](_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x2e')]));_0x290448[_0x0d0e('0x2d')]=_0x290448[_0x0d0e('0x2d')][_0x0d0e('0x2f')]?_0x290448[_0x0d0e('0x2d')]:_0x2e54bc[_0x0d0e('0x2c')];if(!_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x30')](_0x0d0e('0x31'))){_0x290448['limit']=qs['limit'](_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x32')]);_0x290448['offset']=qs[_0x0d0e('0x19')](_0x96456f['query'][_0x0d0e('0x19')]);}_0x290448['order']=qs[_0x0d0e('0x33')](_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x33')]);_0x290448[_0x0d0e('0x34')]=qs[_0x0d0e('0x2a')](_['pick'](_0x96456f[_0x0d0e('0x28')],_0x2e54bc[_0x0d0e('0x2a')]),_0x50fee4);if(_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x35')]){_0x290448[_0x0d0e('0x34')]=_[_0x0d0e('0x36')](_0x290448[_0x0d0e('0x34')],{'$or':_[_0x0d0e('0x25')](_0x50fee4,function(_0x2c7de4){if(_0x2c7de4[_0x0d0e('0x26')]!==_0x0d0e('0x37')){var _0x538764={};_0x538764[_0x2c7de4[_0x0d0e('0x22')]]={'$like':'%'+_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x35')]+'%'};return _0x538764;}})});}_0x290448=_[_0x0d0e('0x36')]({},_0x290448,_0x96456f['options']);var _0x4a7005={'where':_0x290448[_0x0d0e('0x34')]};return db[_0x0d0e('0x38')][_0x0d0e('0x1b')](_0x4a7005)[_0x0d0e('0x1e')](function(_0xf05d0b){_0x2608be[_0x0d0e('0x1b')]=_0xf05d0b;if(_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x39')]){_0x290448[_0x0d0e('0x3a')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0d0e('0x3b')](_0x290448);})[_0x0d0e('0x1e')](function(_0x44c66e){_0x2608be[_0x0d0e('0x3c')]=_0x44c66e;return _0x2608be;})[_0x0d0e('0x1e')](respondWithFilteredResult(_0x147dc9,_0x290448))[_0x0d0e('0x3d')](handleError(_0x147dc9,null));};exports[_0x0d0e('0x3e')]=function(_0x186aa,_0x3fe15f){var _0x57d9ac={'raw':!![],'where':{'id':_0x186aa[_0x0d0e('0x3f')]['id']}},_0x2e2631={};_0x2e2631[_0x0d0e('0x2c')]=_['keys'](db[_0x0d0e('0x38')]['rawAttributes']);_0x2e2631[_0x0d0e('0x28')]=_['keys'](_0x186aa[_0x0d0e('0x28')]);_0x2e2631[_0x0d0e('0x2a')]=_['intersection'](_0x2e2631[_0x0d0e('0x2c')],_0x2e2631['query']);_0x57d9ac[_0x0d0e('0x2d')]=_[_0x0d0e('0x2b')](_0x2e2631[_0x0d0e('0x2c')],qs[_0x0d0e('0x2e')](_0x186aa[_0x0d0e('0x28')][_0x0d0e('0x2e')]));_0x57d9ac[_0x0d0e('0x2d')]=_0x57d9ac[_0x0d0e('0x2d')]['length']?_0x57d9ac[_0x0d0e('0x2d')]:_0x2e2631[_0x0d0e('0x2c')];if(_0x186aa[_0x0d0e('0x28')]['includeAll']){_0x57d9ac['include']=[{'all':!![]}];}_0x57d9ac=_[_0x0d0e('0x36')]({},_0x57d9ac,_0x186aa[_0x0d0e('0x40')]);return db['OpenchannelMessage']['find'](_0x57d9ac)['then'](handleEntityNotFound(_0x3fe15f,null))[_0x0d0e('0x1e')](respondWithResult(_0x3fe15f,null))[_0x0d0e('0x3d')](handleError(_0x3fe15f,null));};exports[_0x0d0e('0x41')]=function(_0x40079a,_0x39c61b){return db[_0x0d0e('0x38')]['create'](_0x40079a[_0x0d0e('0x42')],{})[_0x0d0e('0x1e')](respondWithResult(_0x39c61b,0xc9))[_0x0d0e('0x3d')](handleError(_0x39c61b,null));};exports['update']=function(_0x26e579,_0x441099){if(_0x26e579[_0x0d0e('0x42')]['id']){delete _0x26e579[_0x0d0e('0x42')]['id'];}return db['OpenchannelMessage'][_0x0d0e('0x43')]({'where':{'id':_0x26e579[_0x0d0e('0x3f')]['id']}})[_0x0d0e('0x1e')](handleEntityNotFound(_0x441099,null))[_0x0d0e('0x1e')](saveUpdates(_0x26e579['body'],null))[_0x0d0e('0x1e')](respondWithResult(_0x441099,null))['catch'](handleError(_0x441099,null));};exports['destroy']=function(_0xda3505,_0x9b670d){return db[_0x0d0e('0x38')]['find']({'where':{'id':_0xda3505[_0x0d0e('0x3f')]['id']}})[_0x0d0e('0x1e')](handleEntityNotFound(_0x9b670d,null))[_0x0d0e('0x1e')](removeEntity(_0x9b670d,null))[_0x0d0e('0x3d')](handleError(_0x9b670d,null));};exports[_0x0d0e('0x44')]=function(_0x1c417f,_0x5da8e6){return db[_0x0d0e('0x38')][_0x0d0e('0x44')]()['then'](respondWithResult(_0x5da8e6,null))['catch'](handleError(_0x5da8e6,null));};exports[_0x0d0e('0x45')]=function(_0x4cadb4,_0x58f183){var _0x5a4962=_0x0d0e('0x46');return interactionService[_0x0d0e('0x47')](_0x4cadb4,_0x5a4962)['then'](respondWithResult(_0x58f183,null))[_0x0d0e('0x3d')](handleError(_0x58f183,null));};exports['reject']=function(_0x85c085,_0xa86697){var _0x5decfb={'agent':{},'channel':'openchannel'};if(_0x85c085[_0x0d0e('0x42')]['id']){delete _0x85c085[_0x0d0e('0x42')]['id'];}_0x85c085['body'][_0x0d0e('0x48')]=_0x85c085[_0x0d0e('0x42')][_0x0d0e('0x48')]||_0x85c085['user']['id'];_0x5decfb[_0x0d0e('0x49')]['id']=_0x85c085[_0x0d0e('0x42')][_0x0d0e('0x48')];return db[_0x0d0e('0x38')]['find']({'where':{'id':_0x85c085[_0x0d0e('0x3f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa86697,null))[_0x0d0e('0x1e')](function(_0x1f0717){if(_0x1f0717){_0x5decfb[_0x0d0e('0x16')]=_0x1f0717[_0x0d0e('0x4a')]({'plain':!![]});return db[_0x0d0e('0x4b')][_0x0d0e('0x43')]({'where':{'id':_0x1f0717[_0x0d0e('0x4c')]}});}return null;})['then'](handleEntityNotFound(_0xa86697,null))[_0x0d0e('0x1e')](function(_0x571775){if(_0x571775){_0x5decfb['interaction']=_0x571775[_0x0d0e('0x4a')]({'plain':!![]});interaction_log[_0x0d0e('0x10')](_0x0d0e('0x4d'),_0x85c085[_0x0d0e('0x4e')]['id'],_0x85c085['user'][_0x0d0e('0x22')],_0x85c085[_0x0d0e('0x4e')][_0x0d0e('0x4f')],_0x5decfb['interaction']['id'],_0x85c085[_0x0d0e('0x42')]?JSON[_0x0d0e('0x13')](_0x85c085[_0x0d0e('0x42')]):_0x0d0e('0x50'));return respondWithRpcPromise(_0x0d0e('0x51'),'rejectMessage',_0x5decfb);}return null;})[_0x0d0e('0x1e')](function(_0x454b23){var _0x28b17c=_0x0d0e('0x52')+_0x454b23[_0x0d0e('0x16')][_0x0d0e('0x53')];return db['sequelize'][_0x0d0e('0x28')](_0x28b17c,{'type':db[_0x0d0e('0x54')][_0x0d0e('0x55')][_0x0d0e('0x56')],'raw':!![]})[_0x0d0e('0x1e')](function(_0x5f31cc){return _0x5f31cc;});})['then'](function(_0x395a17){if(_0x395a17){_0x5decfb[_0x0d0e('0x16')][_0x0d0e('0x57')]=_0x395a17[0x0];if(!_0x85c085['body'][_0x0d0e('0x48')])return;return db['User'][_0x0d0e('0x43')]({'where':{'id':_0x85c085['body']['UserId'],'role':'agent'},'attributes':['id',_0x0d0e('0x22'),_0x0d0e('0x58'),_0x0d0e('0x59'),_0x0d0e('0x5a')],'raw':!![]});}return null;})[_0x0d0e('0x1e')](function(_0x544955){if(!_0x544955)return null;_0x5decfb[_0x0d0e('0x16')][_0x0d0e('0x49')]=_0x544955;return _0x5decfb;})[_0x0d0e('0x1e')](function(_0x13e75f){if(_0x13e75f){_0x13e75f[_0x0d0e('0x16')][_0x0d0e('0x5b')]=util[_0x0d0e('0x5c')](_0x0d0e('0x5d'),_0x85c085[_0x0d0e('0x4e')]['name']);_0x13e75f[_0x0d0e('0x16')][_0x0d0e('0x5e')]=_0x5decfb['channel'];_0x13e75f[_0x0d0e('0x16')]['motionChannel']=_0x5decfb[_0x0d0e('0x5e')];_0x13e75f[_0x0d0e('0x16')]['event']=_0x0d0e('0x5f');respondWithRpcPromise(_0x0d0e('0x60'),'EventManager',{'event':_0x0d0e('0x61'),'message':_0x13e75f['message']},client9002);return _0x5decfb;}return null;})[_0x0d0e('0x1e')](respondWithResult(_0xa86697,null))[_0x0d0e('0x3d')](handleError(_0xa86697,null));}; \ No newline at end of file +var _0x1018=['util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','openchannel-interactions','request','info','debug','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','OpenchannelMessage','then','includeAll','include','findAll','rows','params','rawAttributes','options','create','body','update','find','describe','accept','openchannel','reject','UserId','user','get','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','interface','format','SIP/%s','motionChannel','EventManager','rejectmessage'];(function(_0x11fb47,_0x50fbf8){var _0xa0d270=function(_0x2d6c3e){while(--_0x2d6c3e){_0x11fb47['push'](_0x11fb47['shift']());}};_0xa0d270(++_0x50fbf8);}(_0x1018,0x13b));var _0x8101=function(_0x4c097a,_0x462462){_0x4c097a=_0x4c097a-0x0;var _0x3d9368=_0x1018[_0x4c097a];return _0x3d9368;};'use strict';var util=require(_0x8101('0x0'));var _=require('lodash');var Redis=require(_0x8101('0x1'));var interactionService=require(_0x8101('0x2'));var qs=require(_0x8101('0x3'));var logger=require(_0x8101('0x4'))(_0x8101('0x5'));var config=require(_0x8101('0x6'));var db=require(_0x8101('0x7'))['db'];config[_0x8101('0x8')]=_['defaults'](config[_0x8101('0x8')],{'host':_0x8101('0x9'),'port':0x18eb});var socket=require(_0x8101('0xa'))(new Redis(config[_0x8101('0x8')]));require(_0x8101('0xb'))[_0x8101('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8101('0xd')][_0x8101('0xe')]({'port':0x232c});var client9002=jayson[_0x8101('0xd')]['http']({'port':0x232a});var interaction_log=require(_0x8101('0x4'))(_0x8101('0xf'));function respondWithRpcPromise(_0x631b6a,_0x82e35,_0x243dc3,_0x5d980e){return new Promise(function(_0x4f7622,_0x4a513f){var _0x523436=_0x5d980e||client;return _0x523436[_0x8101('0x10')](_0x631b6a,_0x243dc3)['then'](function(_0x453de1){logger[_0x8101('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x82e35,'request\x20sent');logger[_0x8101('0x12')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x82e35,'request\x20sent',JSON[_0x8101('0x13')](_0x453de1));if(_0x453de1['error']){if(_0x453de1[_0x8101('0x14')][_0x8101('0x15')]===0x1f4){logger[_0x8101('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x82e35,_0x453de1[_0x8101('0x14')]['message']);return _0x4a513f(_0x453de1[_0x8101('0x14')][_0x8101('0x16')]);}logger[_0x8101('0x14')](_0x8101('0x17'),_0x82e35,_0x453de1[_0x8101('0x14')]['message']);return _0x4f7622(_0x453de1['error'][_0x8101('0x16')]);}else{logger['info'](_0x8101('0x17'),_0x82e35,'request\x20sent');_0x4f7622(_0x453de1[_0x8101('0x18')]['message']);}})[_0x8101('0x19')](function(_0x584781){logger[_0x8101('0x14')](_0x8101('0x17'),_0x82e35,_0x584781);_0x4a513f(_0x584781);});});}function respondWithResult(_0x28f8bd,_0x3b7818){_0x3b7818=_0x3b7818||0xc8;return function(_0x4790b7){if(_0x4790b7){return _0x28f8bd[_0x8101('0x1a')](_0x3b7818)[_0x8101('0x1b')](_0x4790b7);}};}function respondWithFilteredResult(_0x53efb0,_0x320001){return function(_0x1e6ff9){if(_0x1e6ff9){var _0x4a466c=typeof _0x320001[_0x8101('0x1c')]==='undefined'&&typeof _0x320001[_0x8101('0x1d')]===_0x8101('0x1e');var _0x3da4c6=_0x1e6ff9[_0x8101('0x1f')];var _0x85ef0f=_0x4a466c?0x0:_0x320001['offset'];var _0x36e8bd=_0x4a466c?_0x1e6ff9['count']:_0x320001['offset']+_0x320001['limit'];var _0x2624f2;if(_0x36e8bd>=_0x3da4c6){_0x36e8bd=_0x3da4c6;_0x2624f2=0xc8;}else{_0x2624f2=0xce;}_0x53efb0[_0x8101('0x1a')](_0x2624f2);return _0x53efb0[_0x8101('0x20')](_0x8101('0x21'),_0x85ef0f+'-'+_0x36e8bd+'/'+_0x3da4c6)[_0x8101('0x1b')](_0x1e6ff9);}return null;};}function saveUpdates(_0xae5d2d){return function(_0x3fa116){if(_0x3fa116){return _0x3fa116['update'](_0xae5d2d)['then'](function(_0x1cb9c6){return _0x1cb9c6;});}return null;};}function removeEntity(_0x49aa72){return function(_0x3b6225){if(_0x3b6225){return _0x3b6225[_0x8101('0x22')]()['then'](function(){_0x49aa72[_0x8101('0x1a')](0xcc)[_0x8101('0x23')]();});}};}function handleEntityNotFound(_0x2d2955){return function(_0x801009){if(!_0x801009){_0x2d2955[_0x8101('0x24')](0x194);}return _0x801009;};}function handleError(_0x3f13fb,_0x44750d){_0x44750d=_0x44750d||0x1f4;return function(_0x2f46f2){logger[_0x8101('0x14')](_0x2f46f2[_0x8101('0x25')]);if(_0x2f46f2[_0x8101('0x26')]){delete _0x2f46f2[_0x8101('0x26')];}_0x3f13fb[_0x8101('0x1a')](_0x44750d)[_0x8101('0x27')](_0x2f46f2);};}exports[_0x8101('0x28')]=function(_0x33e836,_0x5ed7bb){var _0x56f53c={},_0x33dbd2={},_0x541226={'count':0x0,'rows':[]};var _0x39de50=_[_0x8101('0x29')](db['OpenchannelMessage']['rawAttributes'],function(_0x35b15e){return{'name':_0x35b15e[_0x8101('0x2a')],'type':_0x35b15e[_0x8101('0x2b')][_0x8101('0x2c')]};});_0x33dbd2['model']=_['map'](_0x39de50,_0x8101('0x26'));_0x33dbd2['query']=_[_0x8101('0x2d')](_0x33e836[_0x8101('0x2e')]);_0x33dbd2['filters']=_[_0x8101('0x2f')](_0x33dbd2[_0x8101('0x30')],_0x33dbd2[_0x8101('0x2e')]);_0x56f53c[_0x8101('0x31')]=_[_0x8101('0x2f')](_0x33dbd2[_0x8101('0x30')],qs['fields'](_0x33e836[_0x8101('0x2e')][_0x8101('0x32')]));_0x56f53c['attributes']=_0x56f53c[_0x8101('0x31')][_0x8101('0x33')]?_0x56f53c[_0x8101('0x31')]:_0x33dbd2[_0x8101('0x30')];if(!_0x33e836[_0x8101('0x2e')][_0x8101('0x34')](_0x8101('0x35'))){_0x56f53c['limit']=qs[_0x8101('0x1d')](_0x33e836[_0x8101('0x2e')][_0x8101('0x1d')]);_0x56f53c[_0x8101('0x1c')]=qs['offset'](_0x33e836[_0x8101('0x2e')]['offset']);}_0x56f53c[_0x8101('0x36')]=qs[_0x8101('0x37')](_0x33e836[_0x8101('0x2e')]['sort']);_0x56f53c[_0x8101('0x38')]=qs[_0x8101('0x39')](_[_0x8101('0x3a')](_0x33e836[_0x8101('0x2e')],_0x33dbd2['filters']),_0x39de50);if(_0x33e836[_0x8101('0x2e')][_0x8101('0x3b')]){_0x56f53c[_0x8101('0x38')]=_[_0x8101('0x3c')](_0x56f53c[_0x8101('0x38')],{'$or':_['map'](_0x39de50,function(_0x2f5d31){if(_0x2f5d31[_0x8101('0x2b')]!==_0x8101('0x3d')){var _0x2adc6c={};_0x2adc6c[_0x2f5d31[_0x8101('0x26')]]={'$like':'%'+_0x33e836[_0x8101('0x2e')][_0x8101('0x3b')]+'%'};return _0x2adc6c;}})});}_0x56f53c=_[_0x8101('0x3c')]({},_0x56f53c,_0x33e836['options']);var _0x355232={'where':_0x56f53c[_0x8101('0x38')]};return db[_0x8101('0x3e')][_0x8101('0x1f')](_0x355232)[_0x8101('0x3f')](function(_0x33566b){_0x541226['count']=_0x33566b;if(_0x33e836[_0x8101('0x2e')][_0x8101('0x40')]){_0x56f53c[_0x8101('0x41')]=[{'all':!![]}];}return db[_0x8101('0x3e')][_0x8101('0x42')](_0x56f53c);})[_0x8101('0x3f')](function(_0x16304c){_0x541226[_0x8101('0x43')]=_0x16304c;return _0x541226;})[_0x8101('0x3f')](respondWithFilteredResult(_0x5ed7bb,_0x56f53c))[_0x8101('0x19')](handleError(_0x5ed7bb,null));};exports['show']=function(_0x159853,_0xe8db71){var _0x5992a3={'raw':!![],'where':{'id':_0x159853[_0x8101('0x44')]['id']}},_0x457275={};_0x457275[_0x8101('0x30')]=_['keys'](db['OpenchannelMessage'][_0x8101('0x45')]);_0x457275['query']=_[_0x8101('0x2d')](_0x159853[_0x8101('0x2e')]);_0x457275[_0x8101('0x39')]=_[_0x8101('0x2f')](_0x457275[_0x8101('0x30')],_0x457275[_0x8101('0x2e')]);_0x5992a3[_0x8101('0x31')]=_['intersection'](_0x457275[_0x8101('0x30')],qs[_0x8101('0x32')](_0x159853[_0x8101('0x2e')]['fields']));_0x5992a3[_0x8101('0x31')]=_0x5992a3[_0x8101('0x31')][_0x8101('0x33')]?_0x5992a3[_0x8101('0x31')]:_0x457275[_0x8101('0x30')];if(_0x159853[_0x8101('0x2e')][_0x8101('0x40')]){_0x5992a3[_0x8101('0x41')]=[{'all':!![]}];}_0x5992a3=_['merge']({},_0x5992a3,_0x159853[_0x8101('0x46')]);return db[_0x8101('0x3e')]['find'](_0x5992a3)[_0x8101('0x3f')](handleEntityNotFound(_0xe8db71,null))['then'](respondWithResult(_0xe8db71,null))['catch'](handleError(_0xe8db71,null));};exports[_0x8101('0x47')]=function(_0x2d0a31,_0x2920d4){return db[_0x8101('0x3e')][_0x8101('0x47')](_0x2d0a31[_0x8101('0x48')],{})[_0x8101('0x3f')](respondWithResult(_0x2920d4,0xc9))['catch'](handleError(_0x2920d4,null));};exports[_0x8101('0x49')]=function(_0x58b11b,_0x33a68c){if(_0x58b11b[_0x8101('0x48')]['id']){delete _0x58b11b[_0x8101('0x48')]['id'];}return db[_0x8101('0x3e')][_0x8101('0x4a')]({'where':{'id':_0x58b11b[_0x8101('0x44')]['id']}})['then'](handleEntityNotFound(_0x33a68c,null))[_0x8101('0x3f')](saveUpdates(_0x58b11b[_0x8101('0x48')],null))[_0x8101('0x3f')](respondWithResult(_0x33a68c,null))[_0x8101('0x19')](handleError(_0x33a68c,null));};exports['destroy']=function(_0x44b41b,_0x236ac0){return db[_0x8101('0x3e')][_0x8101('0x4a')]({'where':{'id':_0x44b41b[_0x8101('0x44')]['id']}})[_0x8101('0x3f')](handleEntityNotFound(_0x236ac0,null))[_0x8101('0x3f')](removeEntity(_0x236ac0,null))[_0x8101('0x19')](handleError(_0x236ac0,null));};exports[_0x8101('0x4b')]=function(_0x5ee4bb,_0x7b6256){return db[_0x8101('0x3e')][_0x8101('0x4b')]()[_0x8101('0x3f')](respondWithResult(_0x7b6256,null))[_0x8101('0x19')](handleError(_0x7b6256,null));};exports[_0x8101('0x4c')]=function(_0x323ee4,_0x570378){var _0x16a61a=_0x8101('0x4d');return interactionService['acceptMessage'](_0x323ee4,_0x16a61a)[_0x8101('0x3f')](respondWithResult(_0x570378,null))[_0x8101('0x19')](handleError(_0x570378,null));};exports[_0x8101('0x4e')]=function(_0x5a57e0,_0x31e0fa){var _0x1537bd={'agent':{},'channel':_0x8101('0x4d')};if(_0x5a57e0[_0x8101('0x48')]['id']){delete _0x5a57e0[_0x8101('0x48')]['id'];}_0x5a57e0['body'][_0x8101('0x4f')]=_0x5a57e0[_0x8101('0x48')][_0x8101('0x4f')]||_0x5a57e0[_0x8101('0x50')]['id'];_0x1537bd['agent']['id']=_0x5a57e0['body']['UserId'];return db[_0x8101('0x3e')][_0x8101('0x4a')]({'where':{'id':_0x5a57e0[_0x8101('0x44')]['id'],'UserId':null}})[_0x8101('0x3f')](handleEntityNotFound(_0x31e0fa,null))[_0x8101('0x3f')](function(_0x1f9474){if(_0x1f9474){_0x1537bd[_0x8101('0x16')]=_0x1f9474[_0x8101('0x51')]({'plain':!![]});return db['OpenchannelInteraction'][_0x8101('0x4a')]({'where':{'id':_0x1f9474[_0x8101('0x52')]}});}return null;})[_0x8101('0x3f')](handleEntityNotFound(_0x31e0fa,null))[_0x8101('0x3f')](function(_0x3cca06){if(_0x3cca06){_0x1537bd[_0x8101('0x53')]=_0x3cca06[_0x8101('0x51')]({'plain':!![]});interaction_log[_0x8101('0x11')](_0x8101('0x54'),_0x5a57e0[_0x8101('0x50')]['id'],_0x5a57e0[_0x8101('0x50')][_0x8101('0x26')],_0x5a57e0['user'][_0x8101('0x55')],_0x1537bd['interaction']['id'],_0x5a57e0[_0x8101('0x48')]?JSON[_0x8101('0x13')](_0x5a57e0['body']):_0x8101('0x56'));return respondWithRpcPromise('RejectMessage',_0x8101('0x57'),_0x1537bd);}return null;})[_0x8101('0x3f')](function(_0x11f36b){var _0x218e32=_0x8101('0x58')+_0x11f36b[_0x8101('0x16')][_0x8101('0x59')];return db[_0x8101('0x5a')][_0x8101('0x2e')](_0x218e32,{'type':db[_0x8101('0x5b')][_0x8101('0x5c')][_0x8101('0x5d')],'raw':!![]})['then'](function(_0x3a0bca){return _0x3a0bca;});})[_0x8101('0x3f')](function(_0x4fac8b){if(_0x4fac8b){_0x1537bd['message']['contact']=_0x4fac8b[0x0];if(!_0x5a57e0[_0x8101('0x48')][_0x8101('0x4f')])return;return db[_0x8101('0x5e')][_0x8101('0x4a')]({'where':{'id':_0x5a57e0[_0x8101('0x48')][_0x8101('0x4f')],'role':_0x8101('0x5f')},'attributes':['id',_0x8101('0x26'),_0x8101('0x60'),_0x8101('0x61'),_0x8101('0x62')],'raw':!![]});}return null;})[_0x8101('0x3f')](function(_0x3abaef){if(!_0x3abaef)return null;_0x1537bd['message'][_0x8101('0x5f')]=_0x3abaef;return _0x1537bd;})[_0x8101('0x3f')](function(_0x2e5e0f){if(_0x2e5e0f){_0x2e5e0f[_0x8101('0x16')][_0x8101('0x63')]=util[_0x8101('0x64')](_0x8101('0x65'),_0x5a57e0[_0x8101('0x50')]['name']);_0x2e5e0f[_0x8101('0x16')]['channel']=_0x1537bd['channel'];_0x2e5e0f[_0x8101('0x16')][_0x8101('0x66')]=_0x1537bd['channel'];_0x2e5e0f[_0x8101('0x16')]['event']=_0x8101('0x4e');respondWithRpcPromise(_0x8101('0x67'),'EventManager',{'event':_0x8101('0x68'),'message':_0x2e5e0f[_0x8101('0x16')]},client9002);return _0x1537bd;}return null;})[_0x8101('0x3f')](respondWithResult(_0x31e0fa,null))[_0x8101('0x19')](handleError(_0x31e0fa,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1ae2413..7e1532e 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 _0x375c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0x375c,0x159));var _0xc375=function(_0x99f205,_0x3ac6cd){_0x99f205=_0x99f205-0x0;var _0x43d038=_0x375c[_0x99f205];return _0x43d038;};'use strict';var EventEmitter=require(_0xc375('0x0'));var OpenchannelMessage=require(_0xc375('0x1'))['db'][_0xc375('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc375('0x3')](0x0);var events={'afterCreate':_0xc375('0x4'),'afterUpdate':_0xc375('0x5'),'afterDestroy':_0xc375('0x6')};function emitEvent(_0x16ab1f){return function(_0xfd77a0,_0x2c875c,_0x3acc6c){OpenchannelMessageEvents[_0xc375('0x7')](_0x16ab1f+':'+_0xfd77a0['id'],_0xfd77a0);OpenchannelMessageEvents['emit'](_0x16ab1f,_0xfd77a0);_0x3acc6c(null);};}for(var e in events){if(events[_0xc375('0x8')](e)){var event=events[e];OpenchannelMessage[_0xc375('0x9')](e,emitEvent(event));}}module[_0xc375('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x6654=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0x6654,0xcc));var _0x4665=function(_0x2f5072,_0x11d0cd){_0x2f5072=_0x2f5072-0x0;var _0x28d2c8=_0x6654[_0x2f5072];return _0x28d2c8;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x4665('0x0'))['db'][_0x4665('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4665('0x2')](0x0);var events={'afterCreate':_0x4665('0x3'),'afterUpdate':'update','afterDestroy':_0x4665('0x4')};function emitEvent(_0x4a9484){return function(_0x7edaad,_0x25139c,_0x3ed6bb){OpenchannelMessageEvents['emit'](_0x4a9484+':'+_0x7edaad['id'],_0x7edaad);OpenchannelMessageEvents[_0x4665('0x5')](_0x4a9484,_0x7edaad);_0x3ed6bb(null);};}for(var e in events){if(events[_0x4665('0x6')](e)){var event=events[e];OpenchannelMessage[_0x4665('0x7')](e,emitEvent(event));}}module[_0x4665('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 5677896..9a84d81 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 _0x38fb=['Interactions','length','Interaction','omit','POST','method','GET','info','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','find','OpenchannelInteractionId','Contact','keys','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x38fb,0xa5));var _0xb38f=function(_0x513254,_0x1305ca){_0x513254=_0x513254-0x0;var _0x384c92=_0x38fb[_0x513254];return _0x384c92;};'use strict';var _=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var logger=require(_0xb38f('0x2'))(_0xb38f('0x3'));var moment=require(_0xb38f('0x4'));var BPromise=require(_0xb38f('0x5'));var rp=require(_0xb38f('0x6'));var fs=require('fs');var path=require(_0xb38f('0x7'));var rimraf=require('rimraf');var config=require(_0xb38f('0x8'));var attributes=require(_0xb38f('0x9'));module[_0xb38f('0xa')]=function(_0x5b8615,_0x3c2051){return _0x5b8615[_0xb38f('0xb')](_0xb38f('0xc'),attributes,{'tableName':_0xb38f('0xd'),'paranoid':![],'indexes':[{'name':_0xb38f('0xe'),'fields':[_0xb38f('0xf')],'type':_0xb38f('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a09d1,_0xe65e24,_0x1dc055){var _0x32c409=_0x5b8615['models'];var _0x242ca1=_0x5a09d1['get']({'plain':!![]});if(_0x242ca1[_0xb38f('0x11')][_0xb38f('0x12')]()==='in'||_0x242ca1[_0xb38f('0x11')]['toLowerCase']()===_0xb38f('0x13')&&!_0x242ca1[_0xb38f('0x14')]&&!_[_0xb38f('0x15')](_0x242ca1['UserId'])){_0x32c409[_0xb38f('0x16')][_0xb38f('0x17')]({'where':{'id':_0x242ca1['OpenchannelInteractionId']}})[_0xb38f('0x18')](function(_0x2d53f4){if(_0x2d53f4){_0x2d53f4[_0xb38f('0x19')]({'lastMsgAt':_0x242ca1[_0xb38f('0x1a')],'lastMsgDirection':_0x242ca1[_0xb38f('0x11')][_0xb38f('0x12')]()});}})[_0xb38f('0x1b')](function(_0x26c862){console[_0xb38f('0x1c')](_0x26c862);});}if(_0x242ca1[_0xb38f('0x11')]==='out'&&!_0x242ca1[_0xb38f('0x14')]){var _0x38742e;_0x32c409[_0xb38f('0x1d')]['describe']()[_0xb38f('0x18')](function(_0x3ad4dc){return _0x32c409['OpenchannelAccount'][_0xb38f('0x1e')]({'where':{'id':_0x242ca1['OpenchannelAccountId']},'include':[{'model':_0x32c409[_0xb38f('0x16')],'as':'Interactions','where':{'id':_0x242ca1[_0xb38f('0x1f')]},'limit':0x1,'include':[{'model':_0x32c409[_0xb38f('0x1d')],'as':_0xb38f('0x20'),'attributes':_[_0xb38f('0x21')](_0x3ad4dc)}]}]});})[_0xb38f('0x18')](function(_0x3dfe98){_0x38742e=_0x3dfe98[_0xb38f('0x22')]({'plain':!![]});if(_0x38742e&&_0x38742e[_0xb38f('0x23')]){logger['info'](_0xb38f('0x24'),_0xb38f('0x25'),util['format'](_0xb38f('0x26'),_0x242ca1['id'],_0x38742e['replyUri']));if(_0x38742e[_0xb38f('0x27')]&&_0x38742e[_0xb38f('0x27')][_0xb38f('0x28')]){_0x242ca1[_0xb38f('0x29')]=_[_0xb38f('0x2a')](_0x38742e['Interactions'][0x0],_0xb38f('0x20'));_0x242ca1['Contact']=_0x38742e[_0xb38f('0x27')][0x0][_0xb38f('0x20')];}var _0xe65e24={'method':_0xb38f('0x2b'),'uri':encodeURI(_0x38742e[_0xb38f('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xe65e24[_0xb38f('0x2c')]){case _0xb38f('0x2d'):_0xe65e24['qs']=_0x242ca1;break;case _0xb38f('0x2b'):_0xe65e24[_0xb38f('0xf')]=_0x242ca1;break;}return rp(_0xe65e24)[_0xb38f('0x18')](function(_0x17d99c){logger[_0xb38f('0x2e')](_0xb38f('0x24'),_0xb38f('0x25'),util[_0xb38f('0x2f')](_0xb38f('0x30'),_0x242ca1['id'],_0x38742e['replyUri']));if(_0x17d99c['body'][_0xb38f('0x31')]&&_0x17d99c[_0xb38f('0xf')][_0xb38f('0x31')]!=_0x242ca1[_0xb38f('0x29')][_0xb38f('0x31')]){return _0x32c409[_0xb38f('0x16')][_0xb38f('0x19')]({'threadId':_0x17d99c[_0xb38f('0xf')][_0xb38f('0x31')]},{'where':{'id':_0x242ca1[_0xb38f('0x29')]['id']}});}else{return;}})[_0xb38f('0x18')](function(){return _0x5a09d1[_0xb38f('0x19')]({'read':!![]});})[_0xb38f('0x1b')](function(_0x3866fa){logger[_0xb38f('0x1c')](_0xb38f('0x24'),_0xb38f('0x25'),util['inspect'](_0x3866fa,{'showHidden':![],'depth':null}));_0x1dc055();});}else{_0x1dc055();}})['finally'](function(){_0x1dc055();});}else{_0x1dc055();}}},'charset':_0xb38f('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x441f=['inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','Interaction','Contact','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId'];(function(_0x30b5eb,_0x497e5a){var _0x1059ce=function(_0xdb55a5){while(--_0xdb55a5){_0x30b5eb['push'](_0x30b5eb['shift']());}};_0x1059ce(++_0x497e5a);}(_0x441f,0x6c));var _0xf441=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x441f[_0x12bcf7];return _0x2825a;};'use strict';var _=require(_0xf441('0x0'));var util=require('util');var logger=require(_0xf441('0x1'))(_0xf441('0x2'));var moment=require(_0xf441('0x3'));var BPromise=require(_0xf441('0x4'));var rp=require(_0xf441('0x5'));var fs=require('fs');var path=require(_0xf441('0x6'));var rimraf=require(_0xf441('0x7'));var config=require(_0xf441('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0xf441('0x9')]=function(_0x14bd1e,_0x2b38fa){return _0x14bd1e[_0xf441('0xa')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xf441('0xb'),'fields':[_0xf441('0xc')],'type':_0xf441('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b7167,_0x18e2f5,_0x3f6b10){var _0x55dd8f=_0x14bd1e[_0xf441('0xe')];var _0x5a81c7=_0x1b7167[_0xf441('0xf')]({'plain':!![]});if(_0x5a81c7[_0xf441('0x10')][_0xf441('0x11')]()==='in'||_0x5a81c7[_0xf441('0x10')][_0xf441('0x11')]()===_0xf441('0x12')&&!_0x5a81c7['secret']&&!_[_0xf441('0x13')](_0x5a81c7[_0xf441('0x14')])){_0x55dd8f[_0xf441('0x15')][_0xf441('0x16')]({'where':{'id':_0x5a81c7[_0xf441('0x17')]}})[_0xf441('0x18')](function(_0x48df40){if(_0x48df40){_0x48df40[_0xf441('0x19')]({'lastMsgAt':_0x5a81c7[_0xf441('0x1a')],'lastMsgDirection':_0x5a81c7[_0xf441('0x10')][_0xf441('0x11')]()});}})[_0xf441('0x1b')](function(_0x53b295){console['error'](_0x53b295);});}if(_0x5a81c7[_0xf441('0x10')]===_0xf441('0x12')&&!_0x5a81c7[_0xf441('0x1c')]){var _0x10d54c;_0x55dd8f[_0xf441('0x1d')][_0xf441('0x1e')]()[_0xf441('0x18')](function(_0x59dba3){return _0x55dd8f[_0xf441('0x1f')][_0xf441('0x20')]({'where':{'id':_0x5a81c7[_0xf441('0x21')]},'include':[{'model':_0x55dd8f['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x5a81c7['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x55dd8f['CmContact'],'as':'Contact','attributes':_[_0xf441('0x22')](_0x59dba3)}]}]});})['then'](function(_0xb71b73){_0x10d54c=_0xb71b73[_0xf441('0xf')]({'plain':!![]});if(_0x10d54c&&_0x10d54c[_0xf441('0x23')]){logger[_0xf441('0x24')](_0xf441('0x25'),'afterCreate',util[_0xf441('0x26')](_0xf441('0x27'),_0x5a81c7['id'],_0x10d54c[_0xf441('0x23')]));if(_0x10d54c[_0xf441('0x28')]&&_0x10d54c[_0xf441('0x28')]['length']){_0x5a81c7[_0xf441('0x29')]=_['omit'](_0x10d54c[_0xf441('0x28')][0x0],_0xf441('0x2a'));_0x5a81c7[_0xf441('0x2a')]=_0x10d54c[_0xf441('0x28')][0x0][_0xf441('0x2a')];}var _0x18e2f5={'method':'POST','uri':encodeURI(_0x10d54c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x18e2f5[_0xf441('0x2b')]){case _0xf441('0x2c'):_0x18e2f5['qs']=_0x5a81c7;break;case'POST':_0x18e2f5['body']=_0x5a81c7;break;}return rp(_0x18e2f5)['then'](function(_0x221da4){logger[_0xf441('0x24')](_0xf441('0x25'),_0xf441('0x2d'),util[_0xf441('0x26')](_0xf441('0x2e'),_0x5a81c7['id'],_0x10d54c[_0xf441('0x23')]));if(_0x221da4[_0xf441('0xc')][_0xf441('0x2f')]&&_0x221da4[_0xf441('0xc')][_0xf441('0x2f')]!=_0x5a81c7['Interaction'][_0xf441('0x2f')]){return _0x55dd8f[_0xf441('0x15')][_0xf441('0x19')]({'threadId':_0x221da4[_0xf441('0xc')][_0xf441('0x2f')]},{'where':{'id':_0x5a81c7[_0xf441('0x29')]['id']}});}else{return;}})[_0xf441('0x18')](function(){return _0x1b7167['update']({'read':!![]});})[_0xf441('0x1b')](function(_0x36aa63){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xf441('0x2d'),util[_0xf441('0x30')](_0x36aa63,{'showHidden':![],'depth':null}));_0x3f6b10();});}else{_0x3f6b10();}})[_0xf441('0x31')](function(){_0x3f6b10();});}else{_0x3f6b10();}}},'charset':_0xf441('0x32'),'collate':_0xf441('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6234800..42c56f1 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0xb73abe,_0x48ec85){var _0x5b99de=function(_0x475ce0){while(--_0x475ce0){_0xb73abe['push'](_0xb73abe['shift']());}};_0x5b99de(++_0x48ec85);}(_0xadb5,0xad));var _0x5adb=function(_0x2620d1,_0x4a6696){_0x2620d1=_0x2620d1-0x0;var _0x14a213=_0xadb5[_0x2620d1];return _0x14a213;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ 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(_0x22b54c,_0xd5140){var _0x522e68=function(_0x115334){while(--_0x115334){_0x22b54c['push'](_0x22b54c['shift']());}};_0x522e68(++_0xd5140);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'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 283fa5a..8dfa72d 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 _0x636d=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit'];(function(_0x5f205c,_0x4c1ad1){var _0x564767=function(_0x23fabd){while(--_0x23fabd){_0x5f205c['push'](_0x5f205c['shift']());}};_0x564767(++_0x4c1ad1);}(_0x636d,0xf0));var _0xd636=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x636d[_0xbca1b1];return _0x4e1686;};'use strict';var OpenchannelMessageEvents=require(_0xd636('0x0'));var events=[_0xd636('0x1'),_0xd636('0x2'),_0xd636('0x3')];function createListener(_0x5e2d03,_0x49f38b){return function(_0x23f77d){_0x49f38b[_0xd636('0x4')](_0x5e2d03,_0x23f77d);};}function removeListener(_0x410d05,_0x566021){return function(){OpenchannelMessageEvents['removeListener'](_0x410d05,_0x566021);};}exports['register']=function(_0x1b623a){for(var _0x15bcdd=0x0,_0x5c624c=events[_0xd636('0x5')];_0x15bcdd<_0x5c624c;_0x15bcdd++){var _0x4c398f=events[_0x15bcdd];var _0x241046=createListener(_0xd636('0x6')+_0x4c398f,_0x1b623a);OpenchannelMessageEvents['on'](_0x4c398f,_0x241046);}}; \ No newline at end of file +var _0x8ae5=['./openchannelMessage.events','save','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0x8ae5,0xab));var _0x58ae=function(_0x2ffba1,_0x58d71f){_0x2ffba1=_0x2ffba1-0x0;var _0x6527d4=_0x8ae5[_0x2ffba1];return _0x6527d4;};'use strict';var OpenchannelMessageEvents=require(_0x58ae('0x0'));var events=[_0x58ae('0x1'),_0x58ae('0x2'),_0x58ae('0x3')];function createListener(_0x392e4e,_0x2f3b82){return function(_0x2dfd1b){_0x2f3b82[_0x58ae('0x4')](_0x392e4e,_0x2dfd1b);};}function removeListener(_0x464fbb,_0x898c59){return function(){OpenchannelMessageEvents[_0x58ae('0x5')](_0x464fbb,_0x898c59);};}exports[_0x58ae('0x6')]=function(_0x129865){for(var _0xba23e0=0x0,_0x14a4e0=events[_0x58ae('0x7')];_0xba23e0<_0x14a4e0;_0xba23e0++){var _0x59f192=events[_0xba23e0];var _0x5b520a=createListener(_0x58ae('0x8')+_0x59f192,_0x129865);OpenchannelMessageEvents['on'](_0x59f192,_0x5b520a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 594b13d..0b7b735 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 _0xc1a1=['/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x411199,_0x518711){var _0x568ce7=function(_0x31c17c){while(--_0x31c17c){_0x411199['push'](_0x411199['shift']());}};_0x568ce7(++_0x518711);}(_0xc1a1,0x1d1));var _0x1c1a=function(_0x256c72,_0x44704b){_0x256c72=_0x256c72-0x0;var _0x52e000=_0xc1a1[_0x256c72];return _0x52e000;};'use strict';var multer=require(_0x1c1a('0x0'));var util=require(_0x1c1a('0x1'));var path=require(_0x1c1a('0x2'));var timeout=require(_0x1c1a('0x3'));var express=require(_0x1c1a('0x4'));var router=express[_0x1c1a('0x5')]();var fs_extra=require(_0x1c1a('0x6'));var auth=require(_0x1c1a('0x7'));var interaction=require(_0x1c1a('0x8'));var config=require(_0x1c1a('0x9'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0x1c1a('0xa')](),controller[_0x1c1a('0xb')]);router[_0x1c1a('0xc')](_0x1c1a('0xd'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0xe')]);router[_0x1c1a('0xc')](_0x1c1a('0xf'),auth[_0x1c1a('0xa')](),controller['show']);router[_0x1c1a('0xc')](_0x1c1a('0x10'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x11')]);router[_0x1c1a('0xc')](_0x1c1a('0x12'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x13')]);router['get'](_0x1c1a('0x14'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x15')]);router[_0x1c1a('0x16')]('/',auth[_0x1c1a('0xa')](),controller['create']);router[_0x1c1a('0x16')](_0x1c1a('0x12'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x17')]);router[_0x1c1a('0x16')](_0x1c1a('0x14'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x18')]);router[_0x1c1a('0x19')](_0x1c1a('0xf'),auth['isAuthenticated'](),controller[_0x1c1a('0x1a')]);router[_0x1c1a('0x1b')](_0x1c1a('0xf'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x1c')]);router[_0x1c1a('0x1b')]('/:id/teams',auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x1d')]);router[_0x1c1a('0x1b')](_0x1c1a('0x14'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x1e')]);module[_0x1c1a('0x1f')]=router; \ No newline at end of file +var _0x3dc2=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','destroy','delete','exports'];(function(_0x523a07,_0x2c66f4){var _0xdd5a93=function(_0x5b6442){while(--_0x5b6442){_0x523a07['push'](_0x523a07['shift']());}};_0xdd5a93(++_0x2c66f4);}(_0x3dc2,0xd0));var _0x23dc=function(_0x25b3e9,_0x217868){_0x25b3e9=_0x25b3e9-0x0;var _0xc44a48=_0x3dc2[_0x25b3e9];return _0xc44a48;};'use strict';var multer=require(_0x23dc('0x0'));var util=require(_0x23dc('0x1'));var path=require(_0x23dc('0x2'));var timeout=require('connect-timeout');var express=require(_0x23dc('0x3'));var router=express[_0x23dc('0x4')]();var fs_extra=require(_0x23dc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x23dc('0x6'));var config=require(_0x23dc('0x7'));var controller=require(_0x23dc('0x8'));router[_0x23dc('0x9')]('/',auth[_0x23dc('0xa')](),controller[_0x23dc('0xb')]);router[_0x23dc('0x9')](_0x23dc('0xc'),auth['isAuthenticated'](),controller[_0x23dc('0xd')]);router[_0x23dc('0x9')](_0x23dc('0xe'),auth['isAuthenticated'](),controller[_0x23dc('0xf')]);router[_0x23dc('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x23dc('0x9')](_0x23dc('0x10'),auth[_0x23dc('0xa')](),controller['getTeams']);router[_0x23dc('0x9')](_0x23dc('0x11'),auth[_0x23dc('0xa')](),controller[_0x23dc('0x12')]);router[_0x23dc('0x13')]('/',auth['isAuthenticated'](),controller[_0x23dc('0x14')]);router[_0x23dc('0x13')](_0x23dc('0x10'),auth[_0x23dc('0xa')](),controller['addTeams']);router['post'](_0x23dc('0x11'),auth[_0x23dc('0xa')](),controller[_0x23dc('0x15')]);router[_0x23dc('0x16')](_0x23dc('0xe'),auth[_0x23dc('0xa')](),controller['update']);router['delete'](_0x23dc('0xe'),auth[_0x23dc('0xa')](),controller[_0x23dc('0x17')]);router[_0x23dc('0x18')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x23dc('0x18')](_0x23dc('0x11'),auth[_0x23dc('0xa')](),controller['removeAgents']);module[_0x23dc('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 028cc37..bf06759 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 _0xe2ae=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x4ee8c6,_0x258b11){var _0x410803=function(_0x10ec07){while(--_0x10ec07){_0x4ee8c6['push'](_0x4ee8c6['shift']());}};_0x410803(++_0x258b11);}(_0xe2ae,0x142));var _0xee2a=function(_0x144307,_0x515bb4){_0x144307=_0x144307-0x0;var _0x49035d=_0xe2ae[_0x144307];return _0x49035d;};'use strict';var Sequelize=require(_0xee2a('0x0'));module[_0xee2a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xee2a('0x2')]},'timeout':{'type':Sequelize[_0xee2a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xee2a('0x4')](_0xee2a('0x5'),_0xee2a('0x6'),_0xee2a('0x7'))}}; \ No newline at end of file +var _0x95b3=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0xcffa4,_0x235b3e){var _0x5bdf7b=function(_0x3610e3){while(--_0x3610e3){_0xcffa4['push'](_0xcffa4['shift']());}};_0x5bdf7b(++_0x235b3e);}(_0x95b3,0x89));var _0x395b=function(_0x550508,_0x49f8d6){_0x550508=_0x550508-0x0;var _0x376095=_0x95b3[_0x550508];return _0x376095;};'use strict';var Sequelize=require(_0x395b('0x0'));module['exports']={'name':{'type':Sequelize[_0x395b('0x1')],'unique':_0x395b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x395b('0x1')]},'timeout':{'type':Sequelize[_0x395b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x395b('0x4')](_0x395b('0x5'),_0x395b('0x6'),_0x395b('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 293a688..49d3ae0 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 _0x898c=['Team','addTeams','ids','voicePause','interface','flatMap','findOrCreate','forEach','emit','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','Agents','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','localhost','redis','./openchannelQueue.socket','status','json','undefined','limit','offset','set','Content-Range','update','then','get','UserProfileResource','destroy','end','error','name','index','map','OpenchannelQueue','type','key','getOptions','count','include','query','findAll','show','model','keys','intersection','attributes','fields','options','find','create','body','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','rawAttributes','filters','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','getTeams'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x898c,0x1f1));var _0xc898=function(_0x3ad46a,_0x420179){_0x3ad46a=_0x3ad46a-0x0;var _0x1f6cfc=_0x898c[_0x3ad46a];return _0x1f6cfc;};'use strict';var BPromise=require(_0xc898('0x0'));var util=require(_0xc898('0x1'));var _=require(_0xc898('0x2'));var squel=require(_0xc898('0x3'));var Redis=require(_0xc898('0x4'));var qs=require(_0xc898('0x5'));var logger=require(_0xc898('0x6'))(_0xc898('0x7'));var config=require(_0xc898('0x8'));var db=require(_0xc898('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xc898('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc898('0xb')]));require(_0xc898('0xc'))['register'](socket);function respondWithStatusCode(_0xae4b5c,_0x453704){_0x453704=_0x453704||0xcc;return function(_0x3cd61c){if(_0x3cd61c){return _0xae4b5c['sendStatus'](_0x453704);}return _0xae4b5c[_0xc898('0xd')](_0x453704)['end']();};}function respondWithResult(_0x4c5cdf,_0x17a0d0){_0x17a0d0=_0x17a0d0||0xc8;return function(_0x20ec49){if(_0x20ec49){return _0x4c5cdf['status'](_0x17a0d0)[_0xc898('0xe')](_0x20ec49);}};}function respondWithFilteredResult(_0x5b6117,_0x5390ee){return function(_0x1946dc){if(_0x1946dc){var _0x4d884c=typeof _0x5390ee['offset']===_0xc898('0xf')&&typeof _0x5390ee[_0xc898('0x10')]===_0xc898('0xf');var _0x3b6784=_0x1946dc['count'];var _0xace37f=_0x4d884c?0x0:_0x5390ee[_0xc898('0x11')];var _0x4fa6b9=_0x4d884c?_0x1946dc['count']:_0x5390ee[_0xc898('0x11')]+_0x5390ee[_0xc898('0x10')];var _0xdee441;if(_0x4fa6b9>=_0x3b6784){_0x4fa6b9=_0x3b6784;_0xdee441=0xc8;}else{_0xdee441=0xce;}_0x5b6117['status'](_0xdee441);return _0x5b6117[_0xc898('0x12')](_0xc898('0x13'),_0xace37f+'-'+_0x4fa6b9+'/'+_0x3b6784)['json'](_0x1946dc);}return null;};}function saveUpdates(_0x134016){return function(_0x480aa0){if(_0x480aa0){return _0x480aa0[_0xc898('0x14')](_0x134016)[_0xc898('0x15')](function(_0x465eb0){return _0x465eb0;});}return null;};}function removeEntity(_0x7fd63d){return function(_0x20ab73){if(_0x20ab73){return _0x20ab73['destroy']()['then'](function(){var _0x3de4fc=_0x20ab73[_0xc898('0x16')]({'plain':!![]});var _0x33b429='OpenchannelQueues';return db[_0xc898('0x17')][_0xc898('0x18')]({'where':{'type':_0x33b429,'resourceId':_0x3de4fc['id']}})[_0xc898('0x15')](function(){return _0x20ab73;});})['then'](function(){_0x7fd63d[_0xc898('0xd')](0xcc)[_0xc898('0x19')]();});}};}function handleEntityNotFound(_0x11e7eb){return function(_0x116569){if(!_0x116569){_0x11e7eb['sendStatus'](0x194);}return _0x116569;};}function handleError(_0x2d5709,_0x715f4b){_0x715f4b=_0x715f4b||0x1f4;return function(_0x29b550){logger[_0xc898('0x1a')](_0x29b550['stack']);if(_0x29b550['name']){delete _0x29b550[_0xc898('0x1b')];}_0x2d5709[_0xc898('0xd')](_0x715f4b)['send'](_0x29b550);};}exports[_0xc898('0x1c')]=function(_0x3cdb7a,_0x393f4c){var _0x4c2b41={};var _0x134dcb={'count':0x0,'rows':[]};var _0x2b7135=_[_0xc898('0x1d')](db[_0xc898('0x1e')]['rawAttributes'],function(_0x43eb72){return{'name':_0x43eb72['fieldName'],'type':_0x43eb72[_0xc898('0x1f')][_0xc898('0x20')]};});_0x4c2b41=qs[_0xc898('0x21')](_0x2b7135,_0x3cdb7a);var _0x2c9f36={'where':_0x4c2b41['where']};return db[_0xc898('0x1e')][_0xc898('0x22')](_0x2c9f36)[_0xc898('0x15')](function(_0x41ec58){_0x134dcb[_0xc898('0x22')]=_0x41ec58;_0x4c2b41[_0xc898('0x23')]=qs[_0xc898('0x23')](_0x3cdb7a[_0xc898('0x24')]);return db[_0xc898('0x1e')][_0xc898('0x25')](_0x4c2b41);})[_0xc898('0x15')](function(_0x7f060e){_0x134dcb['rows']=_0x7f060e;return _0x134dcb;})[_0xc898('0x15')](respondWithFilteredResult(_0x393f4c,_0x4c2b41))['catch'](handleError(_0x393f4c,null));};exports[_0xc898('0x26')]=function(_0x2a0439,_0x106523){var _0x18f0f9={'raw':!![],'where':{'id':_0x2a0439['params']['id']}},_0x2917a7={};_0x2917a7[_0xc898('0x27')]=_[_0xc898('0x28')](db[_0xc898('0x1e')]['rawAttributes']);_0x2917a7[_0xc898('0x24')]=_[_0xc898('0x28')](_0x2a0439[_0xc898('0x24')]);_0x2917a7['filters']=_[_0xc898('0x29')](_0x2917a7[_0xc898('0x27')],_0x2917a7[_0xc898('0x24')]);_0x18f0f9[_0xc898('0x2a')]=_[_0xc898('0x29')](_0x2917a7[_0xc898('0x27')],qs[_0xc898('0x2b')](_0x2a0439[_0xc898('0x24')][_0xc898('0x2b')]));_0x18f0f9['attributes']=_0x18f0f9[_0xc898('0x2a')]['length']?_0x18f0f9[_0xc898('0x2a')]:_0x2917a7[_0xc898('0x27')];if(_0x2a0439[_0xc898('0x24')]['includeAll']){_0x18f0f9[_0xc898('0x23')]=[{'all':!![]}];}_0x18f0f9=_['merge']({},_0x18f0f9,_0x2a0439[_0xc898('0x2c')]);return db[_0xc898('0x1e')][_0xc898('0x2d')](_0x18f0f9)['then'](handleEntityNotFound(_0x106523,null))[_0xc898('0x15')](respondWithResult(_0x106523,null))['catch'](handleError(_0x106523,null));};exports[_0xc898('0x2e')]=function(_0x2c8b70,_0x55f103){return db['OpenchannelQueue'][_0xc898('0x2e')](_0x2c8b70[_0xc898('0x2f')],{})[_0xc898('0x15')](function(_0xe2470a){var _0x3e9457=_0x2c8b70[_0xc898('0x30')][_0xc898('0x16')]({'plain':!![]});if(!_0x3e9457)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e9457['role']===_0xc898('0x30')){var _0x2b4ed6=_0xe2470a[_0xc898('0x16')]({'plain':!![]});var _0x350651='OpenchannelQueues';return db['UserProfileSection'][_0xc898('0x2d')]({'where':{'name':_0x350651,'userProfileId':_0x3e9457[_0xc898('0x31')]},'raw':!![]})[_0xc898('0x15')](function(_0x10c8d9){if(_0x10c8d9&&_0x10c8d9[_0xc898('0x32')]===0x0){return db[_0xc898('0x17')][_0xc898('0x2e')]({'name':_0x2b4ed6['name'],'resourceId':_0x2b4ed6['id'],'type':_0x10c8d9[_0xc898('0x1b')],'sectionId':_0x10c8d9['id']},{})[_0xc898('0x15')](function(){return _0xe2470a;});}else{return _0xe2470a;}})[_0xc898('0x33')](function(_0x29ed06){logger['error'](_0xc898('0x34'),_0x29ed06);throw _0x29ed06;});}return _0xe2470a;})[_0xc898('0x15')](respondWithResult(_0x55f103,0xc9))[_0xc898('0x33')](handleError(_0x55f103,null));};exports[_0xc898('0x14')]=function(_0x21ec7a,_0x50c66b){if(_0x21ec7a['body']['id']){delete _0x21ec7a[_0xc898('0x2f')]['id'];}return db[_0xc898('0x1e')][_0xc898('0x2d')]({'where':{'id':_0x21ec7a[_0xc898('0x35')]['id']}})[_0xc898('0x15')](handleEntityNotFound(_0x50c66b,null))[_0xc898('0x15')](saveUpdates(_0x21ec7a[_0xc898('0x2f')],null))[_0xc898('0x15')](respondWithResult(_0x50c66b,null))['catch'](handleError(_0x50c66b,null));};exports[_0xc898('0x18')]=function(_0x48398f,_0x1134a3){return db[_0xc898('0x1e')][_0xc898('0x2d')]({'where':{'id':_0x48398f['params']['id']}})[_0xc898('0x15')](handleEntityNotFound(_0x1134a3,null))['then'](removeEntity(_0x1134a3,null))[_0xc898('0x33')](handleError(_0x1134a3,null));};exports['describe']=function(_0x17a9ca,_0x1d8eb0){return db['OpenchannelQueue'][_0xc898('0x36')]()[_0xc898('0x15')](respondWithResult(_0x1d8eb0,null))['catch'](handleError(_0x1d8eb0,null));};exports[_0xc898('0x37')]=function(_0x4028da,_0x393f79){var _0x17e9a3={'raw':!![],'where':{}},_0x4483c0={},_0x229649;return db[_0xc898('0x1e')][_0xc898('0x38')]({'where':{'id':_0x4028da['params']['id']}})['then'](handleEntityNotFound(_0x393f79,null))[_0xc898('0x15')](function(_0x1c7aed){if(_0x1c7aed){_0x229649=_0x1c7aed[_0xc898('0x16')]({'plain':!![]});_0x4483c0['model']=_[_0xc898('0x28')](db['UserOpenchannelQueue'][_0xc898('0x39')]);_0x4483c0['query']=_[_0xc898('0x28')](_0x4028da[_0xc898('0x24')]);_0x4483c0[_0xc898('0x3a')]=_[_0xc898('0x29')](_0x4483c0[_0xc898('0x27')],_0x4483c0['query']);_0x17e9a3[_0xc898('0x2a')]=_[_0xc898('0x29')](_0x4483c0['model'],qs[_0xc898('0x2b')](_0x4028da[_0xc898('0x24')][_0xc898('0x2b')]));_0x17e9a3[_0xc898('0x2a')]=_0x17e9a3[_0xc898('0x2a')][_0xc898('0x3b')]?_0x17e9a3[_0xc898('0x2a')]:_0x4483c0[_0xc898('0x27')];if(!_0x4028da[_0xc898('0x24')][_0xc898('0x3c')](_0xc898('0x3d'))){_0x17e9a3['limit']=qs[_0xc898('0x10')](_0x4028da[_0xc898('0x24')]['limit']);_0x17e9a3[_0xc898('0x11')]=qs['offset'](_0x4028da['query'][_0xc898('0x11')]);}_0x17e9a3['order']=qs['sort'](_0x4028da[_0xc898('0x24')][_0xc898('0x3e')]);_0x17e9a3[_0xc898('0x3f')]=qs[_0xc898('0x3a')](_[_0xc898('0x40')](_0x4028da[_0xc898('0x24')],_0x4483c0[_0xc898('0x3a')]));_0x17e9a3[_0xc898('0x3f')]['OpenchannelQueueId']=_0x1c7aed['id'];if(_0x4028da[_0xc898('0x24')][_0xc898('0x41')]){_0x17e9a3['where']=_[_0xc898('0x42')](_0x17e9a3[_0xc898('0x3f')],{'$or':_[_0xc898('0x1d')](_0x17e9a3[_0xc898('0x2a')],function(_0x147db9){var _0x523c0d={};_0x523c0d[_0x147db9]={'$like':'%'+_0x4028da[_0xc898('0x24')][_0xc898('0x41')]+'%'};return _0x523c0d;})});}_0x17e9a3=_[_0xc898('0x42')]({},_0x17e9a3,_0x4028da[_0xc898('0x2c')]);return db[_0xc898('0x43')][_0xc898('0x25')](_0x17e9a3);}})[_0xc898('0x15')](function(_0x2f7255){if(_0x2f7255){return db[_0xc898('0x44')][_0xc898('0x45')]({'where':{'id':_['map'](_0x2f7255,_0xc898('0x46')),'role':_0xc898('0x47')},'attributes':['id',_0xc898('0x1b'),_0xc898('0x48'),_0xc898('0x49'),_0xc898('0x4a')]});}})[_0xc898('0x15')](function(_0x32fbd8){if(_0x32fbd8){return{'count':_0x32fbd8[_0xc898('0x22')],'rows':_[_0xc898('0x1d')](_0x32fbd8[_0xc898('0x4b')],function(_0x22c1ba){return{'membername':_0x22c1ba[_0xc898('0x1b')],'UserId':_0x22c1ba['id'],'queue_name':_0x229649[_0xc898('0x1b')],'OpenchannelQueueId':_0x229649['id'],'interface':util[_0xc898('0x4c')]('%s/%s','SIP',_0x22c1ba['name']),'penalty':0x0,'paused':_0x22c1ba[_0xc898('0x48')],'createdAt':_0x22c1ba[_0xc898('0x4a')],'updatedAt':_0x22c1ba['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc898('0x15')](respondWithFilteredResult(_0x393f79,_0x17e9a3))[_0xc898('0x33')](handleError(_0x393f79,null));};exports[_0xc898('0x4d')]=function(_0x9d5bf,_0x31d6ca){var _0x43aabb={};var _0x5395e6={};var _0x36edfb;var _0x4687aa;return db[_0xc898('0x1e')]['findOne']({'where':{'id':_0x9d5bf[_0xc898('0x35')]['id']}})['then'](handleEntityNotFound(_0x31d6ca,null))[_0xc898('0x15')](function(_0x397b5d){if(_0x397b5d){_0x36edfb=_0x397b5d;_0x5395e6[_0xc898('0x27')]=_[_0xc898('0x28')](db[_0xc898('0x4e')][_0xc898('0x39')]);_0x5395e6[_0xc898('0x24')]=_['keys'](_0x9d5bf[_0xc898('0x24')]);_0x5395e6[_0xc898('0x3a')]=_[_0xc898('0x29')](_0x5395e6['model'],_0x5395e6[_0xc898('0x24')]);_0x43aabb['attributes']=_['intersection'](_0x5395e6['model'],qs[_0xc898('0x2b')](_0x9d5bf[_0xc898('0x24')][_0xc898('0x2b')]));_0x43aabb[_0xc898('0x2a')]=_0x43aabb[_0xc898('0x2a')][_0xc898('0x3b')]?_0x43aabb[_0xc898('0x2a')]:_0x5395e6[_0xc898('0x27')];_0x43aabb['order']=qs[_0xc898('0x3e')](_0x9d5bf['query'][_0xc898('0x3e')]);_0x43aabb[_0xc898('0x3f')]=qs[_0xc898('0x3a')](_[_0xc898('0x40')](_0x9d5bf['query'],_0x5395e6[_0xc898('0x3a')]));if(_0x9d5bf['query'][_0xc898('0x41')]){_0x43aabb[_0xc898('0x3f')]=_['merge'](_0x43aabb[_0xc898('0x3f')],{'$or':_['map'](_0x43aabb[_0xc898('0x2a')],function(_0x3ca016){var _0x26b2b8={};_0x26b2b8[_0x3ca016]={'$like':'%'+_0x9d5bf['query'][_0xc898('0x41')]+'%'};return _0x26b2b8;})});}_0x43aabb=_[_0xc898('0x42')]({},_0x43aabb,_0x9d5bf[_0xc898('0x2c')]);return _0x36edfb['getTeams'](_0x43aabb);}})['then'](function(_0x1c3f79){if(_0x1c3f79){_0x4687aa=_0x1c3f79['length'];if(!_0x9d5bf[_0xc898('0x24')]['hasOwnProperty'](_0xc898('0x3d'))){_0x43aabb['limit']=qs[_0xc898('0x10')](_0x9d5bf[_0xc898('0x24')][_0xc898('0x10')]);_0x43aabb[_0xc898('0x11')]=qs[_0xc898('0x11')](_0x9d5bf[_0xc898('0x24')]['offset']);}return _0x36edfb[_0xc898('0x4d')](_0x43aabb);}})[_0xc898('0x15')](function(_0x47c041){if(_0x47c041){return _0x47c041?{'count':_0x4687aa,'rows':_0x47c041}:null;}})[_0xc898('0x15')](respondWithResult(_0x31d6ca,null))['catch'](handleError(_0x31d6ca,null));};exports[_0xc898('0x4f')]=function(_0x46971e,_0x1cd177){var _0x5a8ff3=_0x46971e['body'][_0xc898('0x50')];return db['Team'][_0xc898('0x25')]({'where':{'id':_0x5a8ff3},'attributes':['id'],'include':[{'model':db[_0xc898('0x44')],'as':'Agents','attributes':['id',_0xc898('0x1b'),'online',_0xc898('0x51'),_0xc898('0x52')],'raw':!![]}]})[_0xc898('0x15')](function(_0x8bc2fb){if(_0x8bc2fb){var _0x3aedb8=_[_0xc898('0x53')](_0x8bc2fb,function(_0x4e5b7c){var _0x7fff6a=_0x4e5b7c['get']({'plain':!![]});return _0x7fff6a['Agents'];});return db[_0xc898('0x1e')]['find']({'where':{'id':_0x46971e[_0xc898('0x35')]['id']}})[_0xc898('0x15')](function(_0x1bddef){return db['sequelize']['transaction'](function(_0x2dffab){return _0x1bddef[_0xc898('0x4f')](_0x5a8ff3,{'transaction':_0x2dffab})[_0xc898('0x15')](function(){return BPromise['each'](_0x3aedb8,function(_0x499a8d){return db[_0xc898('0x43')][_0xc898('0x54')]({'where':{'UserId':_0x499a8d['id'],'OpenchannelQueueId':_0x46971e['params']['id']},'transaction':_0x2dffab});});})['then'](function(){_0x3aedb8[_0xc898('0x55')](function(_0x11a7d4){socket[_0xc898('0x56')]('userOpenchannelQueue:save',{'UserId':_0x11a7d4['id'],'OpenchannelQueueId':_0x1bddef['id']});});});});});}})['then'](respondWithStatusCode(_0x1cd177,null))[_0xc898('0x33')](handleError(_0x1cd177,null));};exports[_0xc898('0x57')]=function(_0x20777d,_0x1895e4){return db[_0xc898('0x4e')][_0xc898('0x25')]({'where':{'id':_0x20777d[_0xc898('0x24')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc898('0x44')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc898('0x15')](handleEntityNotFound(_0x1895e4,null))[_0xc898('0x15')](function(_0x1b8443){var _0x45ea79=_[_0xc898('0x1d')](_0x1b8443,'id');var _0xe790b8=[];var _0x1e21c0=[];var _0xa2accd=squel[_0xc898('0x58')]();_0xa2accd[_0xc898('0x59')]('tq.TeamId')[_0xc898('0x5a')]('team_has_openchannel_queues','tq')[_0xc898('0x5b')](_0xc898('0x5c'),'ut',_0xc898('0x5d'))['where']('OpenchannelQueueId\x20=\x20?',_0x20777d[_0xc898('0x35')]['id']);for(var _0x1e934d=0x0;_0x1e934d<_0x1b8443[_0xc898('0x3b')];_0x1e934d+=0x1){let _0x1e21f5=_0x1b8443[_0x1e934d];for(var _0x2b2336=0x0;_0x2b2336<_0x1e21f5['Agents'][_0xc898('0x3b')];_0x2b2336+=0x1){let _0x59c60d=_0x1e21f5[_0xc898('0x5e')][_0x2b2336];var _0x374dc9=_0xa2accd[_0xc898('0x5f')]();_0x374dc9[_0xc898('0x3f')](_0xc898('0x60'),_0x59c60d['id']);_0x1e21c0[_0xc898('0x61')](db[_0xc898('0x62')][_0xc898('0x24')](_0x374dc9[_0xc898('0x63')](),{'type':db['sequelize'][_0xc898('0x64')]['SELECT']})['then'](function(_0x3e43a1){if(_0x3e43a1[_0xc898('0x3b')]===0x1){return _0x59c60d['id'];}else{var _0x16eca0=_[_0xc898('0x65')](_[_0xc898('0x1d')](_0x3e43a1,'TeamId'),function(_0x32af9e){return _[_0xc898('0x66')](_0x45ea79,_0x32af9e);});if(_0x16eca0){return _0x59c60d['id'];}}}));}}return BPromise[_0xc898('0x67')](_0x1e21c0)['then'](function(_0x180842){_0xe790b8=_(_0xe790b8)[_0xc898('0x68')](_0x180842)['compact']()[_0xc898('0x69')]();return db[_0xc898('0x1e')][_0xc898('0x2d')]({'where':{'id':_0x20777d[_0xc898('0x35')]['id']}})[_0xc898('0x15')](function(_0x48ebb3){return db['sequelize']['transaction'](function(_0x4f62ac){return _0x48ebb3[_0xc898('0x57')](_0x20777d[_0xc898('0x24')][_0xc898('0x50')],{'transaction':_0x4f62ac})[_0xc898('0x15')](function(){if(!_[_0xc898('0x6a')](_0xe790b8)){return _0x48ebb3[_0xc898('0x6b')](_0xe790b8,{'transaction':_0x4f62ac});}})[_0xc898('0x15')](function(){_0xe790b8[_0xc898('0x55')](function(_0x31765f){socket[_0xc898('0x56')](_0xc898('0x6c'),{'UserId':_0x31765f,'OpenchannelQueueId':_0x48ebb3['id']});});});});});});})[_0xc898('0x15')](respondWithStatusCode(_0x1895e4,null))[_0xc898('0x33')](handleError(_0x1895e4,null));};exports[_0xc898('0x6d')]=function(_0x41e6dc,_0x4c4f56){return db[_0xc898('0x1e')][_0xc898('0x2d')]({'where':{'id':_0x41e6dc[_0xc898('0x35')]['id']}})['then'](handleEntityNotFound(_0x4c4f56,null))[_0xc898('0x15')](function(_0x510f8a){if(_0x510f8a){return _0x510f8a[_0xc898('0x6d')](_0x41e6dc[_0xc898('0x2f')][_0xc898('0x50')],_[_0xc898('0x6e')](_0x41e6dc[_0xc898('0x2f')],[_0xc898('0x50'),'id'])||{})[_0xc898('0x6f')](function(_0x276fb9){for(var _0x5078fb=0x0;_0x5078fb<_0x41e6dc[_0xc898('0x2f')]['ids'][_0xc898('0x3b')];_0x5078fb+=0x1){socket[_0xc898('0x56')](_0xc898('0x70'),{'UserId':Number(_0x41e6dc[_0xc898('0x2f')]['ids'][_0x5078fb]),'OpenchannelQueueId':Number(_0x41e6dc['params']['id'])});}return _0x276fb9;});}})[_0xc898('0x15')](respondWithResult(_0x4c4f56,null))[_0xc898('0x33')](handleError(_0x4c4f56,null));};exports[_0xc898('0x6b')]=function(_0x5e3c72,_0x390a59){return db['OpenchannelQueue'][_0xc898('0x2d')]({'where':{'id':_0x5e3c72['params']['id']}})['then'](handleEntityNotFound(_0x390a59,null))[_0xc898('0x15')](function(_0x2fc187){if(_0x2fc187){return _0x2fc187[_0xc898('0x6b')](_0x5e3c72[_0xc898('0x24')]['ids'])[_0xc898('0x15')](function(){if(_[_0xc898('0x71')](_0x5e3c72[_0xc898('0x24')]['ids'])){for(var _0x496201=0x0;_0x496201<_0x5e3c72[_0xc898('0x24')]['ids'][_0xc898('0x3b')];_0x496201+=0x1){socket[_0xc898('0x56')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5e3c72[_0xc898('0x24')][_0xc898('0x50')][_0x496201]),'OpenchannelQueueId':Number(_0x5e3c72[_0xc898('0x35')]['id'])});}}else{socket[_0xc898('0x56')](_0xc898('0x6c'),{'UserId':Number(_0x5e3c72[_0xc898('0x24')][_0xc898('0x50')]),'OpenchannelQueueId':Number(_0x5e3c72['params']['id'])});}});}})['then'](respondWithStatusCode(_0x390a59,null))['catch'](handleError(_0x390a59,null));};exports[_0xc898('0x72')]=function(_0x299678,_0x4a9c7d){var _0x2228ae={};var _0x39b6ef={};var _0x362182;var _0x2435cf;return db[_0xc898('0x1e')][_0xc898('0x38')]({'where':{'id':_0x299678['params']['id']}})['then'](handleEntityNotFound(_0x4a9c7d,null))[_0xc898('0x15')](function(_0x56b07a){if(_0x56b07a){_0x362182=_0x56b07a;_0x39b6ef[_0xc898('0x27')]=_[_0xc898('0x28')](db[_0xc898('0x44')][_0xc898('0x39')]);_0x39b6ef[_0xc898('0x24')]=_[_0xc898('0x28')](_0x299678['query']);_0x39b6ef[_0xc898('0x3a')]=_['intersection'](_0x39b6ef[_0xc898('0x27')],_0x39b6ef['query']);_0x2228ae[_0xc898('0x2a')]=_[_0xc898('0x29')](_0x39b6ef[_0xc898('0x27')],qs[_0xc898('0x2b')](_0x299678['query'][_0xc898('0x2b')]));_0x2228ae[_0xc898('0x2a')]=_0x2228ae[_0xc898('0x2a')][_0xc898('0x3b')]?_0x2228ae['attributes']:_0x39b6ef[_0xc898('0x27')];_0x2228ae['order']=qs[_0xc898('0x3e')](_0x299678[_0xc898('0x24')]['sort']);_0x2228ae['where']=qs[_0xc898('0x3a')](_[_0xc898('0x40')](_0x299678[_0xc898('0x24')],_0x39b6ef[_0xc898('0x3a')]));if(_0x299678[_0xc898('0x24')][_0xc898('0x41')]){_0x2228ae[_0xc898('0x3f')]=_[_0xc898('0x42')](_0x2228ae[_0xc898('0x3f')],{'$or':_[_0xc898('0x1d')](_0x2228ae[_0xc898('0x2a')],function(_0x47073){var _0x3080fe={};_0x3080fe[_0x47073]={'$like':'%'+_0x299678[_0xc898('0x24')][_0xc898('0x41')]+'%'};return _0x3080fe;})});}_0x2228ae=_[_0xc898('0x42')]({},_0x2228ae,_0x299678[_0xc898('0x2c')]);return _0x362182[_0xc898('0x72')](_0x2228ae);}})['then'](function(_0xf88996){if(_0xf88996){_0x2435cf=_0xf88996[_0xc898('0x3b')];if(!_0x299678['query']['hasOwnProperty']('nolimit')){_0x2228ae[_0xc898('0x10')]=qs[_0xc898('0x10')](_0x299678[_0xc898('0x24')][_0xc898('0x10')]);_0x2228ae[_0xc898('0x11')]=qs[_0xc898('0x11')](_0x299678[_0xc898('0x24')][_0xc898('0x11')]);}return _0x362182[_0xc898('0x72')](_0x2228ae);}})['then'](function(_0x48eccf){if(_0x48eccf){return _0x48eccf?{'count':_0x2435cf,'rows':_0x48eccf}:null;}})[_0xc898('0x15')](respondWithResult(_0x4a9c7d,null))[_0xc898('0x33')](handleError(_0x4a9c7d,null));}; \ No newline at end of file +var _0x83fa=['Team','findAll','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','error','stack','name','map','rawAttributes','type','key','getOptions','where','OpenchannelQueue','include','query','rows','catch','show','params','model','keys','intersection','attributes','fields','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','filters','hasOwnProperty','order','sort','pick','merge','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','nolimit','getTeams','addTeams','ids'];(function(_0x3a0c9a,_0x1c423f){var _0x432ad6=function(_0x47ba3c){while(--_0x47ba3c){_0x3a0c9a['push'](_0x3a0c9a['shift']());}};_0x432ad6(++_0x1c423f);}(_0x83fa,0x120));var _0xa83f=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x83fa[_0x2d7f0e];return _0x110b07;};'use strict';var BPromise=require(_0xa83f('0x0'));var util=require(_0xa83f('0x1'));var _=require('lodash');var squel=require(_0xa83f('0x2'));var Redis=require(_0xa83f('0x3'));var qs=require(_0xa83f('0x4'));var logger=require(_0xa83f('0x5'))('api');var config=require(_0xa83f('0x6'));var db=require(_0xa83f('0x7'))['db'];config[_0xa83f('0x8')]=_[_0xa83f('0x9')](config[_0xa83f('0x8')],{'host':_0xa83f('0xa'),'port':0x18eb});var socket=require(_0xa83f('0xb'))(new Redis(config['redis']));require(_0xa83f('0xc'))[_0xa83f('0xd')](socket);function respondWithStatusCode(_0x386d57,_0x32f91a){_0x32f91a=_0x32f91a||0xcc;return function(_0x310192){if(_0x310192){return _0x386d57[_0xa83f('0xe')](_0x32f91a);}return _0x386d57[_0xa83f('0xf')](_0x32f91a)[_0xa83f('0x10')]();};}function respondWithResult(_0x5c82ac,_0x3f921b){_0x3f921b=_0x3f921b||0xc8;return function(_0x40b1e0){if(_0x40b1e0){return _0x5c82ac['status'](_0x3f921b)['json'](_0x40b1e0);}};}function respondWithFilteredResult(_0x441190,_0x2cd4c0){return function(_0x360729){if(_0x360729){var _0x402c69=typeof _0x2cd4c0[_0xa83f('0x11')]===_0xa83f('0x12')&&typeof _0x2cd4c0[_0xa83f('0x13')]===_0xa83f('0x12');var _0x445313=_0x360729[_0xa83f('0x14')];var _0x403fc0=_0x402c69?0x0:_0x2cd4c0[_0xa83f('0x11')];var _0x1754a5=_0x402c69?_0x360729[_0xa83f('0x14')]:_0x2cd4c0[_0xa83f('0x11')]+_0x2cd4c0[_0xa83f('0x13')];var _0x8c2c58;if(_0x1754a5>=_0x445313){_0x1754a5=_0x445313;_0x8c2c58=0xc8;}else{_0x8c2c58=0xce;}_0x441190['status'](_0x8c2c58);return _0x441190['set'](_0xa83f('0x15'),_0x403fc0+'-'+_0x1754a5+'/'+_0x445313)[_0xa83f('0x16')](_0x360729);}return null;};}function saveUpdates(_0x38bb06){return function(_0x1121d2){if(_0x1121d2){return _0x1121d2['update'](_0x38bb06)[_0xa83f('0x17')](function(_0x37048e){return _0x37048e;});}return null;};}function removeEntity(_0x15ca0d){return function(_0x33e2da){if(_0x33e2da){return _0x33e2da[_0xa83f('0x18')]()[_0xa83f('0x17')](function(){var _0xf36bce=_0x33e2da[_0xa83f('0x19')]({'plain':!![]});var _0x3299a3='OpenchannelQueues';return db['UserProfileResource'][_0xa83f('0x18')]({'where':{'type':_0x3299a3,'resourceId':_0xf36bce['id']}})[_0xa83f('0x17')](function(){return _0x33e2da;});})[_0xa83f('0x17')](function(){_0x15ca0d[_0xa83f('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a4bd){return function(_0x455352){if(!_0x455352){_0x16a4bd[_0xa83f('0xe')](0x194);}return _0x455352;};}function handleError(_0x340e61,_0x525bc5){_0x525bc5=_0x525bc5||0x1f4;return function(_0x1a9afc){logger[_0xa83f('0x1a')](_0x1a9afc[_0xa83f('0x1b')]);if(_0x1a9afc[_0xa83f('0x1c')]){delete _0x1a9afc[_0xa83f('0x1c')];}_0x340e61[_0xa83f('0xf')](_0x525bc5)['send'](_0x1a9afc);};}exports['index']=function(_0x52085c,_0x1db969){var _0x3dffd5={};var _0x149883={'count':0x0,'rows':[]};var _0x2d2777=_[_0xa83f('0x1d')](db['OpenchannelQueue'][_0xa83f('0x1e')],function(_0x132e46){return{'name':_0x132e46['fieldName'],'type':_0x132e46[_0xa83f('0x1f')][_0xa83f('0x20')]};});_0x3dffd5=qs[_0xa83f('0x21')](_0x2d2777,_0x52085c);var _0x52a2b9={'where':_0x3dffd5[_0xa83f('0x22')]};return db[_0xa83f('0x23')][_0xa83f('0x14')](_0x52a2b9)['then'](function(_0x2dcd63){_0x149883[_0xa83f('0x14')]=_0x2dcd63;_0x3dffd5[_0xa83f('0x24')]=qs[_0xa83f('0x24')](_0x52085c[_0xa83f('0x25')]);return db['OpenchannelQueue']['findAll'](_0x3dffd5);})[_0xa83f('0x17')](function(_0x1e4edd){_0x149883[_0xa83f('0x26')]=_0x1e4edd;return _0x149883;})[_0xa83f('0x17')](respondWithFilteredResult(_0x1db969,_0x3dffd5))[_0xa83f('0x27')](handleError(_0x1db969,null));};exports[_0xa83f('0x28')]=function(_0x1e7d23,_0x4569e7){var _0x4e0db5={'raw':!![],'where':{'id':_0x1e7d23[_0xa83f('0x29')]['id']}},_0x2ae621={};_0x2ae621[_0xa83f('0x2a')]=_['keys'](db[_0xa83f('0x23')][_0xa83f('0x1e')]);_0x2ae621[_0xa83f('0x25')]=_[_0xa83f('0x2b')](_0x1e7d23[_0xa83f('0x25')]);_0x2ae621['filters']=_[_0xa83f('0x2c')](_0x2ae621[_0xa83f('0x2a')],_0x2ae621['query']);_0x4e0db5[_0xa83f('0x2d')]=_['intersection'](_0x2ae621[_0xa83f('0x2a')],qs[_0xa83f('0x2e')](_0x1e7d23['query'][_0xa83f('0x2e')]));_0x4e0db5[_0xa83f('0x2d')]=_0x4e0db5['attributes'][_0xa83f('0x2f')]?_0x4e0db5[_0xa83f('0x2d')]:_0x2ae621[_0xa83f('0x2a')];if(_0x1e7d23[_0xa83f('0x25')]['includeAll']){_0x4e0db5[_0xa83f('0x24')]=[{'all':!![]}];}_0x4e0db5=_['merge']({},_0x4e0db5,_0x1e7d23[_0xa83f('0x30')]);return db['OpenchannelQueue']['find'](_0x4e0db5)[_0xa83f('0x17')](handleEntityNotFound(_0x4569e7,null))['then'](respondWithResult(_0x4569e7,null))[_0xa83f('0x27')](handleError(_0x4569e7,null));};exports[_0xa83f('0x31')]=function(_0x484371,_0x29a393){return db[_0xa83f('0x23')][_0xa83f('0x31')](_0x484371[_0xa83f('0x32')],{})[_0xa83f('0x17')](function(_0x4baf3b){var _0x4fb92b=_0x484371[_0xa83f('0x33')][_0xa83f('0x19')]({'plain':!![]});if(!_0x4fb92b)throw new Error(_0xa83f('0x34'));if(_0x4fb92b[_0xa83f('0x35')]===_0xa83f('0x33')){var _0x29fe40=_0x4baf3b['get']({'plain':!![]});var _0x3ebba5=_0xa83f('0x36');return db[_0xa83f('0x37')]['find']({'where':{'name':_0x3ebba5,'userProfileId':_0x4fb92b[_0xa83f('0x38')]},'raw':!![]})[_0xa83f('0x17')](function(_0x389ca5){if(_0x389ca5&&_0x389ca5['autoAssociation']===0x0){return db[_0xa83f('0x39')][_0xa83f('0x31')]({'name':_0x29fe40[_0xa83f('0x1c')],'resourceId':_0x29fe40['id'],'type':_0x389ca5[_0xa83f('0x1c')],'sectionId':_0x389ca5['id']},{})[_0xa83f('0x17')](function(){return _0x4baf3b;});}else{return _0x4baf3b;}})[_0xa83f('0x27')](function(_0x488aa4){logger[_0xa83f('0x1a')](_0xa83f('0x3a'),_0x488aa4);throw _0x488aa4;});}return _0x4baf3b;})[_0xa83f('0x17')](respondWithResult(_0x29a393,0xc9))[_0xa83f('0x27')](handleError(_0x29a393,null));};exports[_0xa83f('0x3b')]=function(_0x478854,_0x36901a){if(_0x478854[_0xa83f('0x32')]['id']){delete _0x478854['body']['id'];}return db[_0xa83f('0x23')]['find']({'where':{'id':_0x478854[_0xa83f('0x29')]['id']}})[_0xa83f('0x17')](handleEntityNotFound(_0x36901a,null))[_0xa83f('0x17')](saveUpdates(_0x478854[_0xa83f('0x32')],null))[_0xa83f('0x17')](respondWithResult(_0x36901a,null))[_0xa83f('0x27')](handleError(_0x36901a,null));};exports[_0xa83f('0x18')]=function(_0x20ddbf,_0x456f85){return db['OpenchannelQueue'][_0xa83f('0x3c')]({'where':{'id':_0x20ddbf['params']['id']}})[_0xa83f('0x17')](handleEntityNotFound(_0x456f85,null))[_0xa83f('0x17')](removeEntity(_0x456f85,null))[_0xa83f('0x27')](handleError(_0x456f85,null));};exports[_0xa83f('0x3d')]=function(_0x3b274d,_0x4b68e6){return db['OpenchannelQueue'][_0xa83f('0x3d')]()[_0xa83f('0x17')](respondWithResult(_0x4b68e6,null))['catch'](handleError(_0x4b68e6,null));};exports[_0xa83f('0x3e')]=function(_0x3c0910,_0x5d9a48){var _0x377e39={'raw':!![],'where':{}},_0x1f2801={},_0x60e4bc;return db[_0xa83f('0x23')]['findOne']({'where':{'id':_0x3c0910[_0xa83f('0x29')]['id']}})[_0xa83f('0x17')](handleEntityNotFound(_0x5d9a48,null))[_0xa83f('0x17')](function(_0x1ee719){if(_0x1ee719){_0x60e4bc=_0x1ee719['get']({'plain':!![]});_0x1f2801[_0xa83f('0x2a')]=_['keys'](db['UserOpenchannelQueue']['rawAttributes']);_0x1f2801[_0xa83f('0x25')]=_['keys'](_0x3c0910[_0xa83f('0x25')]);_0x1f2801[_0xa83f('0x3f')]=_['intersection'](_0x1f2801[_0xa83f('0x2a')],_0x1f2801[_0xa83f('0x25')]);_0x377e39[_0xa83f('0x2d')]=_['intersection'](_0x1f2801[_0xa83f('0x2a')],qs[_0xa83f('0x2e')](_0x3c0910[_0xa83f('0x25')][_0xa83f('0x2e')]));_0x377e39[_0xa83f('0x2d')]=_0x377e39[_0xa83f('0x2d')][_0xa83f('0x2f')]?_0x377e39[_0xa83f('0x2d')]:_0x1f2801[_0xa83f('0x2a')];if(!_0x3c0910[_0xa83f('0x25')][_0xa83f('0x40')]('nolimit')){_0x377e39['limit']=qs[_0xa83f('0x13')](_0x3c0910[_0xa83f('0x25')][_0xa83f('0x13')]);_0x377e39[_0xa83f('0x11')]=qs[_0xa83f('0x11')](_0x3c0910[_0xa83f('0x25')][_0xa83f('0x11')]);}_0x377e39[_0xa83f('0x41')]=qs[_0xa83f('0x42')](_0x3c0910[_0xa83f('0x25')][_0xa83f('0x42')]);_0x377e39[_0xa83f('0x22')]=qs['filters'](_[_0xa83f('0x43')](_0x3c0910['query'],_0x1f2801[_0xa83f('0x3f')]));_0x377e39[_0xa83f('0x22')]['OpenchannelQueueId']=_0x1ee719['id'];if(_0x3c0910[_0xa83f('0x25')]['filter']){_0x377e39[_0xa83f('0x22')]=_[_0xa83f('0x44')](_0x377e39[_0xa83f('0x22')],{'$or':_['map'](_0x377e39[_0xa83f('0x2d')],function(_0x45a1df){var _0x133b9f={};_0x133b9f[_0x45a1df]={'$like':'%'+_0x3c0910['query'][_0xa83f('0x45')]+'%'};return _0x133b9f;})});}_0x377e39=_[_0xa83f('0x44')]({},_0x377e39,_0x3c0910['options']);return db[_0xa83f('0x46')]['findAll'](_0x377e39);}})[_0xa83f('0x17')](function(_0x3e525c){if(_0x3e525c){return db[_0xa83f('0x47')][_0xa83f('0x48')]({'where':{'id':_[_0xa83f('0x1d')](_0x3e525c,_0xa83f('0x49')),'role':_0xa83f('0x4a')},'attributes':['id',_0xa83f('0x1c'),_0xa83f('0x4b'),_0xa83f('0x4c'),_0xa83f('0x4d')]});}})['then'](function(_0xe2cda2){if(_0xe2cda2){return{'count':_0xe2cda2[_0xa83f('0x14')],'rows':_[_0xa83f('0x1d')](_0xe2cda2[_0xa83f('0x26')],function(_0x24331b){return{'membername':_0x24331b[_0xa83f('0x1c')],'UserId':_0x24331b['id'],'queue_name':_0x60e4bc[_0xa83f('0x1c')],'OpenchannelQueueId':_0x60e4bc['id'],'interface':util[_0xa83f('0x4e')](_0xa83f('0x4f'),'SIP',_0x24331b[_0xa83f('0x1c')]),'penalty':0x0,'paused':_0x24331b[_0xa83f('0x4b')],'createdAt':_0x24331b['createdAt'],'updatedAt':_0x24331b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5d9a48,_0x377e39))[_0xa83f('0x27')](handleError(_0x5d9a48,null));};exports['getTeams']=function(_0x1e4302,_0x4b8487){var _0x28a4e5={};var _0x9fe91d={};var _0x23e61f;var _0xa85da1;return db[_0xa83f('0x23')]['findOne']({'where':{'id':_0x1e4302[_0xa83f('0x29')]['id']}})[_0xa83f('0x17')](handleEntityNotFound(_0x4b8487,null))['then'](function(_0x4492c9){if(_0x4492c9){_0x23e61f=_0x4492c9;_0x9fe91d['model']=_['keys'](db['Team'][_0xa83f('0x1e')]);_0x9fe91d[_0xa83f('0x25')]=_[_0xa83f('0x2b')](_0x1e4302[_0xa83f('0x25')]);_0x9fe91d['filters']=_[_0xa83f('0x2c')](_0x9fe91d[_0xa83f('0x2a')],_0x9fe91d[_0xa83f('0x25')]);_0x28a4e5[_0xa83f('0x2d')]=_[_0xa83f('0x2c')](_0x9fe91d[_0xa83f('0x2a')],qs[_0xa83f('0x2e')](_0x1e4302[_0xa83f('0x25')]['fields']));_0x28a4e5[_0xa83f('0x2d')]=_0x28a4e5[_0xa83f('0x2d')][_0xa83f('0x2f')]?_0x28a4e5[_0xa83f('0x2d')]:_0x9fe91d[_0xa83f('0x2a')];_0x28a4e5['order']=qs[_0xa83f('0x42')](_0x1e4302[_0xa83f('0x25')][_0xa83f('0x42')]);_0x28a4e5[_0xa83f('0x22')]=qs[_0xa83f('0x3f')](_[_0xa83f('0x43')](_0x1e4302[_0xa83f('0x25')],_0x9fe91d[_0xa83f('0x3f')]));if(_0x1e4302[_0xa83f('0x25')][_0xa83f('0x45')]){_0x28a4e5[_0xa83f('0x22')]=_[_0xa83f('0x44')](_0x28a4e5[_0xa83f('0x22')],{'$or':_[_0xa83f('0x1d')](_0x28a4e5['attributes'],function(_0x2fae7d){var _0x1de333={};_0x1de333[_0x2fae7d]={'$like':'%'+_0x1e4302[_0xa83f('0x25')][_0xa83f('0x45')]+'%'};return _0x1de333;})});}_0x28a4e5=_[_0xa83f('0x44')]({},_0x28a4e5,_0x1e4302[_0xa83f('0x30')]);return _0x23e61f['getTeams'](_0x28a4e5);}})['then'](function(_0x326ee1){if(_0x326ee1){_0xa85da1=_0x326ee1[_0xa83f('0x2f')];if(!_0x1e4302['query']['hasOwnProperty'](_0xa83f('0x50'))){_0x28a4e5['limit']=qs[_0xa83f('0x13')](_0x1e4302['query']['limit']);_0x28a4e5[_0xa83f('0x11')]=qs[_0xa83f('0x11')](_0x1e4302['query'][_0xa83f('0x11')]);}return _0x23e61f[_0xa83f('0x51')](_0x28a4e5);}})[_0xa83f('0x17')](function(_0x26b3aa){if(_0x26b3aa){return _0x26b3aa?{'count':_0xa85da1,'rows':_0x26b3aa}:null;}})[_0xa83f('0x17')](respondWithResult(_0x4b8487,null))[_0xa83f('0x27')](handleError(_0x4b8487,null));};exports[_0xa83f('0x52')]=function(_0x15c113,_0x361555){var _0x4496bf=_0x15c113['body'][_0xa83f('0x53')];return db[_0xa83f('0x54')][_0xa83f('0x55')]({'where':{'id':_0x4496bf},'attributes':['id'],'include':[{'model':db[_0xa83f('0x47')],'as':_0xa83f('0x56'),'attributes':['id',_0xa83f('0x1c'),'online',_0xa83f('0x57'),_0xa83f('0x58')],'raw':!![]}]})[_0xa83f('0x17')](function(_0x35da5d){if(_0x35da5d){var _0x112c61=_[_0xa83f('0x59')](_0x35da5d,function(_0x196443){var _0x2062f7=_0x196443['get']({'plain':!![]});return _0x2062f7[_0xa83f('0x56')];});return db[_0xa83f('0x23')]['find']({'where':{'id':_0x15c113['params']['id']}})[_0xa83f('0x17')](function(_0x5c884b){return db[_0xa83f('0x5a')][_0xa83f('0x5b')](function(_0x196104){return _0x5c884b[_0xa83f('0x52')](_0x4496bf,{'transaction':_0x196104})[_0xa83f('0x17')](function(){return BPromise[_0xa83f('0x5c')](_0x112c61,function(_0x47b529){return db[_0xa83f('0x46')][_0xa83f('0x5d')]({'where':{'UserId':_0x47b529['id'],'OpenchannelQueueId':_0x15c113[_0xa83f('0x29')]['id']},'transaction':_0x196104});});})[_0xa83f('0x17')](function(){_0x112c61[_0xa83f('0x5e')](function(_0x5d3947){socket[_0xa83f('0x5f')](_0xa83f('0x60'),{'UserId':_0x5d3947['id'],'OpenchannelQueueId':_0x5c884b['id']});});});});});}})[_0xa83f('0x17')](respondWithStatusCode(_0x361555,null))['catch'](handleError(_0x361555,null));};exports['removeTeams']=function(_0x4308e4,_0x5cfd60){return db[_0xa83f('0x54')][_0xa83f('0x55')]({'where':{'id':_0x4308e4[_0xa83f('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa83f('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa83f('0x17')](handleEntityNotFound(_0x5cfd60,null))[_0xa83f('0x17')](function(_0x5366c3){var _0x429289=_[_0xa83f('0x1d')](_0x5366c3,'id');var _0x8ac5ce=[];var _0x20ce47=[];var _0x5a53fe=squel['select']();_0x5a53fe[_0xa83f('0x61')](_0xa83f('0x62'))[_0xa83f('0x63')](_0xa83f('0x64'),'tq')[_0xa83f('0x65')](_0xa83f('0x66'),'ut',_0xa83f('0x67'))[_0xa83f('0x22')]('OpenchannelQueueId\x20=\x20?',_0x4308e4[_0xa83f('0x29')]['id']);for(var _0x30a2e4=0x0;_0x30a2e4<_0x5366c3[_0xa83f('0x2f')];_0x30a2e4+=0x1){let _0x1186ea=_0x5366c3[_0x30a2e4];for(var _0x7931ff=0x0;_0x7931ff<_0x1186ea[_0xa83f('0x56')]['length'];_0x7931ff+=0x1){let _0x31565d=_0x1186ea['Agents'][_0x7931ff];var _0x221c7f=_0x5a53fe[_0xa83f('0x68')]();_0x221c7f[_0xa83f('0x22')](_0xa83f('0x69'),_0x31565d['id']);_0x20ce47[_0xa83f('0x6a')](db['sequelize'][_0xa83f('0x25')](_0x221c7f[_0xa83f('0x6b')](),{'type':db['sequelize'][_0xa83f('0x6c')][_0xa83f('0x6d')]})['then'](function(_0x5ed5c3){if(_0x5ed5c3['length']===0x1){return _0x31565d['id'];}else{var _0x2bbf1f=_[_0xa83f('0x6e')](_[_0xa83f('0x1d')](_0x5ed5c3,'TeamId'),function(_0x1e9417){return _[_0xa83f('0x6f')](_0x429289,_0x1e9417);});if(_0x2bbf1f){return _0x31565d['id'];}}}));}}return BPromise[_0xa83f('0x70')](_0x20ce47)[_0xa83f('0x17')](function(_0x5717bc){_0x8ac5ce=_(_0x8ac5ce)[_0xa83f('0x71')](_0x5717bc)[_0xa83f('0x72')]()[_0xa83f('0x73')]();return db[_0xa83f('0x23')][_0xa83f('0x3c')]({'where':{'id':_0x4308e4[_0xa83f('0x29')]['id']}})['then'](function(_0x5f32a7){return db[_0xa83f('0x5a')][_0xa83f('0x5b')](function(_0x2f396f){return _0x5f32a7['removeTeams'](_0x4308e4['query'][_0xa83f('0x53')],{'transaction':_0x2f396f})['then'](function(){if(!_[_0xa83f('0x74')](_0x8ac5ce)){return _0x5f32a7[_0xa83f('0x75')](_0x8ac5ce,{'transaction':_0x2f396f});}})[_0xa83f('0x17')](function(){_0x8ac5ce['forEach'](function(_0x39117e){socket[_0xa83f('0x5f')](_0xa83f('0x76'),{'UserId':_0x39117e,'OpenchannelQueueId':_0x5f32a7['id']});});});});});});})[_0xa83f('0x17')](respondWithStatusCode(_0x5cfd60,null))['catch'](handleError(_0x5cfd60,null));};exports[_0xa83f('0x77')]=function(_0x5c8b1f,_0x113430){return db[_0xa83f('0x23')][_0xa83f('0x3c')]({'where':{'id':_0x5c8b1f[_0xa83f('0x29')]['id']}})[_0xa83f('0x17')](handleEntityNotFound(_0x113430,null))[_0xa83f('0x17')](function(_0x28f62a){if(_0x28f62a){return _0x28f62a['addAgents'](_0x5c8b1f[_0xa83f('0x32')][_0xa83f('0x53')],_[_0xa83f('0x78')](_0x5c8b1f[_0xa83f('0x32')],[_0xa83f('0x53'),'id'])||{})[_0xa83f('0x79')](function(_0xa70eaa){for(var _0x5ce13c=0x0;_0x5ce13c<_0x5c8b1f[_0xa83f('0x32')][_0xa83f('0x53')][_0xa83f('0x2f')];_0x5ce13c+=0x1){socket[_0xa83f('0x5f')]('userOpenchannelQueue:save',{'UserId':Number(_0x5c8b1f[_0xa83f('0x32')][_0xa83f('0x53')][_0x5ce13c]),'OpenchannelQueueId':Number(_0x5c8b1f[_0xa83f('0x29')]['id'])});}return _0xa70eaa;});}})[_0xa83f('0x17')](respondWithResult(_0x113430,null))[_0xa83f('0x27')](handleError(_0x113430,null));};exports['removeAgents']=function(_0x4df61f,_0x2d6dfd){return db[_0xa83f('0x23')][_0xa83f('0x3c')]({'where':{'id':_0x4df61f[_0xa83f('0x29')]['id']}})[_0xa83f('0x17')](handleEntityNotFound(_0x2d6dfd,null))[_0xa83f('0x17')](function(_0x1896b9){if(_0x1896b9){return _0x1896b9[_0xa83f('0x75')](_0x4df61f[_0xa83f('0x25')][_0xa83f('0x53')])[_0xa83f('0x17')](function(){if(_[_0xa83f('0x7a')](_0x4df61f[_0xa83f('0x25')][_0xa83f('0x53')])){for(var _0x4c6312=0x0;_0x4c6312<_0x4df61f[_0xa83f('0x25')][_0xa83f('0x53')][_0xa83f('0x2f')];_0x4c6312+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x4df61f[_0xa83f('0x25')][_0xa83f('0x53')][_0x4c6312]),'OpenchannelQueueId':Number(_0x4df61f['params']['id'])});}}else{socket[_0xa83f('0x5f')](_0xa83f('0x76'),{'UserId':Number(_0x4df61f[_0xa83f('0x25')][_0xa83f('0x53')]),'OpenchannelQueueId':Number(_0x4df61f[_0xa83f('0x29')]['id'])});}});}})[_0xa83f('0x17')](respondWithStatusCode(_0x2d6dfd,null))[_0xa83f('0x27')](handleError(_0x2d6dfd,null));};exports[_0xa83f('0x7b')]=function(_0x2fe00a,_0x5e4e5a){var _0x16add1={};var _0x1c0a3c={};var _0x15c65a;var _0x152373;return db[_0xa83f('0x23')]['findOne']({'where':{'id':_0x2fe00a['params']['id']}})[_0xa83f('0x17')](handleEntityNotFound(_0x5e4e5a,null))[_0xa83f('0x17')](function(_0x1b1480){if(_0x1b1480){_0x15c65a=_0x1b1480;_0x1c0a3c['model']=_[_0xa83f('0x2b')](db[_0xa83f('0x47')][_0xa83f('0x1e')]);_0x1c0a3c[_0xa83f('0x25')]=_['keys'](_0x2fe00a[_0xa83f('0x25')]);_0x1c0a3c[_0xa83f('0x3f')]=_[_0xa83f('0x2c')](_0x1c0a3c[_0xa83f('0x2a')],_0x1c0a3c['query']);_0x16add1['attributes']=_[_0xa83f('0x2c')](_0x1c0a3c['model'],qs[_0xa83f('0x2e')](_0x2fe00a['query'][_0xa83f('0x2e')]));_0x16add1[_0xa83f('0x2d')]=_0x16add1[_0xa83f('0x2d')]['length']?_0x16add1['attributes']:_0x1c0a3c[_0xa83f('0x2a')];_0x16add1['order']=qs['sort'](_0x2fe00a[_0xa83f('0x25')][_0xa83f('0x42')]);_0x16add1[_0xa83f('0x22')]=qs[_0xa83f('0x3f')](_[_0xa83f('0x43')](_0x2fe00a[_0xa83f('0x25')],_0x1c0a3c[_0xa83f('0x3f')]));if(_0x2fe00a[_0xa83f('0x25')][_0xa83f('0x45')]){_0x16add1[_0xa83f('0x22')]=_[_0xa83f('0x44')](_0x16add1[_0xa83f('0x22')],{'$or':_[_0xa83f('0x1d')](_0x16add1[_0xa83f('0x2d')],function(_0x32557b){var _0x46fe78={};_0x46fe78[_0x32557b]={'$like':'%'+_0x2fe00a[_0xa83f('0x25')][_0xa83f('0x45')]+'%'};return _0x46fe78;})});}_0x16add1=_['merge']({},_0x16add1,_0x2fe00a[_0xa83f('0x30')]);return _0x15c65a['getAgents'](_0x16add1);}})[_0xa83f('0x17')](function(_0x49e4e2){if(_0x49e4e2){_0x152373=_0x49e4e2[_0xa83f('0x2f')];if(!_0x2fe00a[_0xa83f('0x25')][_0xa83f('0x40')](_0xa83f('0x50'))){_0x16add1[_0xa83f('0x13')]=qs['limit'](_0x2fe00a['query'][_0xa83f('0x13')]);_0x16add1[_0xa83f('0x11')]=qs[_0xa83f('0x11')](_0x2fe00a[_0xa83f('0x25')][_0xa83f('0x11')]);}return _0x15c65a['getAgents'](_0x16add1);}})[_0xa83f('0x17')](function(_0x5c3bc2){if(_0x5c3bc2){return _0x5c3bc2?{'count':_0x152373,'rows':_0x5c3bc2}:null;}})['then'](respondWithResult(_0x5e4e5a,null))['catch'](handleError(_0x5e4e5a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index e14022d..979a122 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 _0xed24=['exports','events','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1fd9b2,_0x1be29e){var _0x1aacca=function(_0x740af1){while(--_0x740af1){_0x1fd9b2['push'](_0x1fd9b2['shift']());}};_0x1aacca(++_0x1be29e);}(_0xed24,0xa1));var _0x4ed2=function(_0x1b69a1,_0x4ee222){_0x1b69a1=_0x1b69a1-0x0;var _0x8915f3=_0xed24[_0x1b69a1];return _0x8915f3;};'use strict';var EventEmitter=require(_0x4ed2('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ed2('0x1'),'afterUpdate':_0x4ed2('0x2'),'afterDestroy':_0x4ed2('0x3')};function emitEvent(_0x29516a){return function(_0x2ffb78,_0x5108dd,_0x3fcad0){OpenchannelQueueEvents[_0x4ed2('0x4')](_0x29516a+':'+_0x2ffb78['id'],_0x2ffb78);OpenchannelQueueEvents[_0x4ed2('0x4')](_0x29516a,_0x2ffb78);_0x3fcad0(null);};}for(var e in events){if(events[_0x4ed2('0x5')](e)){var event=events[e];OpenchannelQueue[_0x4ed2('0x6')](e,emitEvent(event));}}module[_0x4ed2('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x2809=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1fd37a,_0x272d39){var _0x244db0=function(_0x4a7d2c){while(--_0x4a7d2c){_0x1fd37a['push'](_0x1fd37a['shift']());}};_0x244db0(++_0x272d39);}(_0x2809,0x168));var _0x9280=function(_0x192ec2,_0xc3a237){_0x192ec2=_0x192ec2-0x0;var _0x4abd11=_0x2809[_0x192ec2];return _0x4abd11;};'use strict';var EventEmitter=require(_0x9280('0x0'));var OpenchannelQueue=require(_0x9280('0x1'))['db'][_0x9280('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9280('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9280('0x4'),'afterDestroy':_0x9280('0x5')};function emitEvent(_0x44e9c7){return function(_0x46bfcf,_0x20678e,_0x3a5e0b){OpenchannelQueueEvents[_0x9280('0x6')](_0x44e9c7+':'+_0x46bfcf['id'],_0x46bfcf);OpenchannelQueueEvents['emit'](_0x44e9c7,_0x46bfcf);_0x3a5e0b(null);};}for(var e in events){if(events[_0x9280('0x7')](e)){var event=events[e];OpenchannelQueue[_0x9280('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index b74b129..388cb67 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 _0x33e3=['openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x33e3,0x1ae));var _0x333e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x33e3[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x333e('0x0'));var util=require('util');var logger=require(_0x333e('0x1'))(_0x333e('0x2'));var moment=require(_0x333e('0x3'));var BPromise=require(_0x333e('0x4'));var rp=require(_0x333e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x333e('0x6'));var config=require(_0x333e('0x7'));var attributes=require(_0x333e('0x8'));module[_0x333e('0x9')]=function(_0x37cb62,_0x23fe03){return _0x37cb62[_0x333e('0xa')](_0x333e('0xb'),attributes,{'tableName':_0x333e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24b9=['moment','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x4bf5aa,_0x357bbf){var _0x474b8a=function(_0x151a84){while(--_0x151a84){_0x4bf5aa['push'](_0x4bf5aa['shift']());}};_0x474b8a(++_0x357bbf);}(_0x24b9,0x17d));var _0x924b=function(_0x18f50b,_0x52b050){_0x18f50b=_0x18f50b-0x0;var _0x39ca60=_0x24b9[_0x18f50b];return _0x39ca60;};'use strict';var _=require(_0x924b('0x0'));var util=require(_0x924b('0x1'));var logger=require(_0x924b('0x2'))(_0x924b('0x3'));var moment=require(_0x924b('0x4'));var BPromise=require(_0x924b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x924b('0x6'));var config=require(_0x924b('0x7'));var attributes=require(_0x924b('0x8'));module['exports']=function(_0x5a81b1,_0x70059a){return _0x5a81b1['define'](_0x924b('0x9'),attributes,{'tableName':_0x924b('0xa'),'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 c6ab9ad..e9018d3 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 _0xbd6a=['jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','debug','error','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','raw','options','where','attributes','limit','model','map','include','stringify','ShowOpenchannelQueue','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xbd6a,0x106));var _0xabd6=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xbd6a[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0xabd6('0x0'));var util=require(_0xabd6('0x1'));var moment=require(_0xabd6('0x2'));var BPromise=require(_0xabd6('0x3'));var rs=require(_0xabd6('0x4'));var fs=require('fs');var Redis=require(_0xabd6('0x5'));var db=require(_0xabd6('0x6'))['db'];var utils=require(_0xabd6('0x7'));var logger=require(_0xabd6('0x8'))(_0xabd6('0x9'));var config=require(_0xabd6('0xa'));var jayson=require(_0xabd6('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0xabd6('0xc')]=_[_0xabd6('0xd')](config[_0xabd6('0xc')],{'host':_0xabd6('0xe'),'port':0x18eb});var socket=require(_0xabd6('0xf'))(new Redis(config[_0xabd6('0xc')]));require(_0xabd6('0x10'))[_0xabd6('0x11')](socket);function respondWithRpcPromise(_0x262340,_0x5628b3,_0x18af4b){return new BPromise(function(_0x32a2ee,_0x17367d){return client['request'](_0x262340,_0x18af4b)[_0xabd6('0x12')](function(_0x1c0560){logger[_0xabd6('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x5628b3,'request\x20sent');logger[_0xabd6('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5628b3,'request\x20sent',JSON['stringify'](_0x1c0560));if(_0x1c0560[_0xabd6('0x15')]){if(_0x1c0560[_0xabd6('0x15')]['code']===0x1f4){logger['error'](_0xabd6('0x16'),_0x5628b3,_0x1c0560[_0xabd6('0x15')][_0xabd6('0x17')]);return _0x17367d(_0x1c0560[_0xabd6('0x15')][_0xabd6('0x17')]);}logger[_0xabd6('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5628b3,_0x1c0560[_0xabd6('0x15')][_0xabd6('0x17')]);return _0x32a2ee(_0x1c0560['error'][_0xabd6('0x17')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x5628b3,'request\x20sent');_0x32a2ee(_0x1c0560[_0xabd6('0x18')][_0xabd6('0x17')]);}})['catch'](function(_0x1eb082){logger[_0xabd6('0x15')](_0xabd6('0x16'),_0x5628b3,_0x1eb082);_0x17367d(_0x1eb082);});});}exports[_0xabd6('0x19')]=function(_0x4830a9){var _0xe4ad3a=this;return new Promise(function(_0x350cc9,_0x14d398){return db[_0xabd6('0x1a')]['findAll']({'raw':_0x4830a9['options']?_0x4830a9['options'][_0xabd6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4830a9['options']?_0x4830a9[_0xabd6('0x1c')][_0xabd6('0x1d')]||null:null,'attributes':_0x4830a9['options']?_0x4830a9[_0xabd6('0x1c')][_0xabd6('0x1e')]||null:null,'limit':_0x4830a9[_0xabd6('0x1c')]?_0x4830a9[_0xabd6('0x1c')][_0xabd6('0x1f')]||null:null,'include':_0x4830a9[_0xabd6('0x1c')]?_0x4830a9[_0xabd6('0x1c')]['include']?_['map'](_0x4830a9[_0xabd6('0x1c')]['include'],function(_0x581a39){return{'model':db[_0x581a39[_0xabd6('0x20')]],'as':_0x581a39['as'],'attributes':_0x581a39[_0xabd6('0x1e')],'include':_0x581a39['include']?_[_0xabd6('0x21')](_0x581a39[_0xabd6('0x22')],function(_0x16dbac){return{'model':db[_0x16dbac[_0xabd6('0x20')]],'as':_0x16dbac['as'],'attributes':_0x16dbac[_0xabd6('0x1e')],'include':_0x16dbac['include']?_[_0xabd6('0x21')](_0x16dbac[_0xabd6('0x22')],function(_0x5ba082){return{'model':db[_0x5ba082['model']],'as':_0x5ba082['as'],'attributes':_0x5ba082[_0xabd6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xabd6('0x12')](function(_0x30703f){logger[_0xabd6('0x13')]('GetOpenchannelQueue',_0x4830a9);logger[_0xabd6('0x14')](_0xabd6('0x19'),_0x4830a9,JSON[_0xabd6('0x23')](_0x30703f));_0x350cc9(_0x30703f);})['catch'](function(_0x56cddd){logger[_0xabd6('0x15')](_0xabd6('0x19'),_0x56cddd['message'],_0x4830a9);_0x14d398(_0xe4ad3a[_0xabd6('0x15')](0x1f4,_0x56cddd['message']));});});};exports[_0xabd6('0x24')]=function(_0x4be170){var _0x72df84=this;return new Promise(function(_0x31dd68,_0x3f53bd){return db[_0xabd6('0x1a')][_0xabd6('0x25')]({'raw':_0x4be170[_0xabd6('0x1c')]?_0x4be170['options'][_0xabd6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4be170[_0xabd6('0x1c')]?_0x4be170[_0xabd6('0x1c')]['where']||null:null,'attributes':_0x4be170[_0xabd6('0x1c')]?_0x4be170['options'][_0xabd6('0x1e')]||null:null,'include':_0x4be170[_0xabd6('0x1c')]?_0x4be170[_0xabd6('0x1c')]['include']?_[_0xabd6('0x21')](_0x4be170[_0xabd6('0x1c')][_0xabd6('0x22')],function(_0x32def6){return{'model':db[_0x32def6['model']],'as':_0x32def6['as'],'attributes':_0x32def6['attributes'],'include':_0x32def6[_0xabd6('0x22')]?_['map'](_0x32def6[_0xabd6('0x22')],function(_0xed1082){return{'model':db[_0xed1082['model']],'as':_0xed1082['as'],'attributes':_0xed1082['attributes'],'include':_0xed1082[_0xabd6('0x22')]?_[_0xabd6('0x21')](_0xed1082[_0xabd6('0x22')],function(_0x18797f){return{'model':db[_0x18797f[_0xabd6('0x20')]],'as':_0x18797f['as'],'attributes':_0x18797f[_0xabd6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xabd6('0x12')](function(_0x3e3320){logger[_0xabd6('0x13')]('ShowOpenchannelQueue',_0x4be170);logger[_0xabd6('0x14')](_0xabd6('0x24'),_0x4be170,JSON['stringify'](_0x3e3320));_0x31dd68(_0x3e3320);})[_0xabd6('0x26')](function(_0x5648db){logger[_0xabd6('0x15')](_0xabd6('0x24'),_0x5648db['message'],_0x4be170);_0x3f53bd(_0x72df84[_0xabd6('0x15')](0x1f4,_0x5648db[_0xabd6('0x17')]));});});}; \ No newline at end of file +var _0x8231=['catch','OpenchannelQueue','findAll','options','raw','attributes','limit','map','include','model','GetOpenchannelQueue','find','where','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x200cee,_0x396207){var _0x5ea117=function(_0xd397ea){while(--_0xd397ea){_0x200cee['push'](_0x200cee['shift']());}};_0x5ea117(++_0x396207);}(_0x8231,0x118));var _0x1823=function(_0x1ce377,_0x413baf){_0x1ce377=_0x1ce377-0x0;var _0x3eafd5=_0x8231[_0x1ce377];return _0x3eafd5;};'use strict';var _=require(_0x1823('0x0'));var util=require('util');var moment=require(_0x1823('0x1'));var BPromise=require(_0x1823('0x2'));var rs=require(_0x1823('0x3'));var fs=require('fs');var Redis=require(_0x1823('0x4'));var db=require(_0x1823('0x5'))['db'];var utils=require(_0x1823('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1823('0x7'));var jayson=require(_0x1823('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x1823('0x9')]=_['defaults'](config['redis'],{'host':_0x1823('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1823('0xb'))[_0x1823('0xc')](socket);function respondWithRpcPromise(_0x24358e,_0x24463e,_0x544931){return new BPromise(function(_0x5cf9ca,_0x307609){return client[_0x1823('0xd')](_0x24358e,_0x544931)[_0x1823('0xe')](function(_0x23ad8b){logger[_0x1823('0xf')](_0x1823('0x10'),_0x24463e,_0x1823('0x11'));logger[_0x1823('0x12')](_0x1823('0x13'),_0x24463e,_0x1823('0x11'),JSON[_0x1823('0x14')](_0x23ad8b));if(_0x23ad8b[_0x1823('0x15')]){if(_0x23ad8b['error']['code']===0x1f4){logger[_0x1823('0x15')](_0x1823('0x10'),_0x24463e,_0x23ad8b[_0x1823('0x15')][_0x1823('0x16')]);return _0x307609(_0x23ad8b[_0x1823('0x15')][_0x1823('0x16')]);}logger[_0x1823('0x15')](_0x1823('0x10'),_0x24463e,_0x23ad8b[_0x1823('0x15')][_0x1823('0x16')]);return _0x5cf9ca(_0x23ad8b[_0x1823('0x15')]['message']);}else{logger['info'](_0x1823('0x10'),_0x24463e,_0x1823('0x11'));_0x5cf9ca(_0x23ad8b[_0x1823('0x17')][_0x1823('0x16')]);}})[_0x1823('0x18')](function(_0x102650){logger[_0x1823('0x15')](_0x1823('0x10'),_0x24463e,_0x102650);_0x307609(_0x102650);});});}exports['GetOpenchannelQueue']=function(_0x393788){var _0x50a1eb=this;return new Promise(function(_0x26633b,_0x5a7842){return db[_0x1823('0x19')][_0x1823('0x1a')]({'raw':_0x393788['options']?_0x393788[_0x1823('0x1b')][_0x1823('0x1c')]===undefined?!![]:![]:!![],'where':_0x393788[_0x1823('0x1b')]?_0x393788[_0x1823('0x1b')]['where']||null:null,'attributes':_0x393788[_0x1823('0x1b')]?_0x393788[_0x1823('0x1b')][_0x1823('0x1d')]||null:null,'limit':_0x393788[_0x1823('0x1b')]?_0x393788[_0x1823('0x1b')][_0x1823('0x1e')]||null:null,'include':_0x393788[_0x1823('0x1b')]?_0x393788[_0x1823('0x1b')]['include']?_[_0x1823('0x1f')](_0x393788['options'][_0x1823('0x20')],function(_0x53b3af){return{'model':db[_0x53b3af[_0x1823('0x21')]],'as':_0x53b3af['as'],'attributes':_0x53b3af[_0x1823('0x1d')],'include':_0x53b3af[_0x1823('0x20')]?_[_0x1823('0x1f')](_0x53b3af[_0x1823('0x20')],function(_0x18daec){return{'model':db[_0x18daec['model']],'as':_0x18daec['as'],'attributes':_0x18daec[_0x1823('0x1d')],'include':_0x18daec[_0x1823('0x20')]?_[_0x1823('0x1f')](_0x18daec[_0x1823('0x20')],function(_0xeabf1b){return{'model':db[_0xeabf1b[_0x1823('0x21')]],'as':_0xeabf1b['as'],'attributes':_0xeabf1b[_0x1823('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1823('0xe')](function(_0x1a0fbc){logger[_0x1823('0xf')](_0x1823('0x22'),_0x393788);logger[_0x1823('0x12')]('GetOpenchannelQueue',_0x393788,JSON[_0x1823('0x14')](_0x1a0fbc));_0x26633b(_0x1a0fbc);})[_0x1823('0x18')](function(_0x57b100){logger[_0x1823('0x15')](_0x1823('0x22'),_0x57b100[_0x1823('0x16')],_0x393788);_0x5a7842(_0x50a1eb[_0x1823('0x15')](0x1f4,_0x57b100[_0x1823('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x50123b){var _0x11a3b5=this;return new Promise(function(_0x5a7c6a,_0x4c38d1){return db[_0x1823('0x19')][_0x1823('0x23')]({'raw':_0x50123b[_0x1823('0x1b')]?_0x50123b['options']['raw']===undefined?!![]:![]:!![],'where':_0x50123b[_0x1823('0x1b')]?_0x50123b[_0x1823('0x1b')][_0x1823('0x24')]||null:null,'attributes':_0x50123b['options']?_0x50123b[_0x1823('0x1b')][_0x1823('0x1d')]||null:null,'include':_0x50123b['options']?_0x50123b[_0x1823('0x1b')][_0x1823('0x20')]?_['map'](_0x50123b[_0x1823('0x1b')]['include'],function(_0x477de6){return{'model':db[_0x477de6['model']],'as':_0x477de6['as'],'attributes':_0x477de6[_0x1823('0x1d')],'include':_0x477de6[_0x1823('0x20')]?_[_0x1823('0x1f')](_0x477de6[_0x1823('0x20')],function(_0x577ab7){return{'model':db[_0x577ab7['model']],'as':_0x577ab7['as'],'attributes':_0x577ab7[_0x1823('0x1d')],'include':_0x577ab7[_0x1823('0x20')]?_[_0x1823('0x1f')](_0x577ab7[_0x1823('0x20')],function(_0x46e451){return{'model':db[_0x46e451[_0x1823('0x21')]],'as':_0x46e451['as'],'attributes':_0x46e451[_0x1823('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1823('0xe')](function(_0x54b3bd){logger[_0x1823('0xf')](_0x1823('0x25'),_0x50123b);logger['debug']('ShowOpenchannelQueue',_0x50123b,JSON['stringify'](_0x54b3bd));_0x5a7c6a(_0x54b3bd);})['catch'](function(_0x83cd5f){logger[_0x1823('0x15')](_0x1823('0x25'),_0x83cd5f['message'],_0x50123b);_0x4c38d1(_0x11a3b5[_0x1823('0x15')](0x1f4,_0x83cd5f[_0x1823('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0c0163f..12e8e48 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 _0x1933=['remove','emit','register','length','./openchannelQueue.events','save'];(function(_0x3b0dfe,_0x2b7618){var _0xeeac7e=function(_0x19e757){while(--_0x19e757){_0x3b0dfe['push'](_0x3b0dfe['shift']());}};_0xeeac7e(++_0x2b7618);}(_0x1933,0xa0));var _0x3193=function(_0x1913c1,_0xe25386){_0x1913c1=_0x1913c1-0x0;var _0x45b05a=_0x1933[_0x1913c1];return _0x45b05a;};'use strict';var OpenchannelQueueEvents=require(_0x3193('0x0'));var events=[_0x3193('0x1'),_0x3193('0x2'),'update'];function createListener(_0x51f09d,_0x1dea69){return function(_0x59eed2){_0x1dea69[_0x3193('0x3')](_0x51f09d,_0x59eed2);};}function removeListener(_0x929198,_0x3269ef){return function(){OpenchannelQueueEvents['removeListener'](_0x929198,_0x3269ef);};}exports[_0x3193('0x4')]=function(_0x891f70){for(var _0x2f51fd=0x0,_0x474e6f=events[_0x3193('0x5')];_0x2f51fd<_0x474e6f;_0x2f51fd++){var _0x196c22=events[_0x2f51fd];var _0x3f6d4e=createListener('openchannelQueue:'+_0x196c22,_0x891f70);OpenchannelQueueEvents['on'](_0x196c22,_0x3f6d4e);}}; \ No newline at end of file +var _0x483e=['openchannelQueue:','./openchannelQueue.events','remove','removeListener','length'];(function(_0x24a730,_0x128bed){var _0x21d451=function(_0x1bb9cb){while(--_0x1bb9cb){_0x24a730['push'](_0x24a730['shift']());}};_0x21d451(++_0x128bed);}(_0x483e,0x19b));var _0xe483=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0x483e[_0x10dc64];return _0x9cf98d;};'use strict';var OpenchannelQueueEvents=require(_0xe483('0x0'));var events=['save',_0xe483('0x1'),'update'];function createListener(_0x26e588,_0x384f92){return function(_0x1d759a){_0x384f92['emit'](_0x26e588,_0x1d759a);};}function removeListener(_0x23cd13,_0x55d806){return function(){OpenchannelQueueEvents[_0xe483('0x2')](_0x23cd13,_0x55d806);};}exports['register']=function(_0x4c5594){for(var _0x2e0fd5=0x0,_0x2e8669=events[_0xe483('0x3')];_0x2e0fd5<_0x2e8669;_0x2e0fd5++){var _0x39b04c=events[_0x2e0fd5];var _0x5e7f22=createListener(_0xe483('0x4')+_0x39b04c,_0x4c5594);OpenchannelQueueEvents['on'](_0x39b04c,_0x5e7f22);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ed51861..3d1d1c1 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 _0xde72=['fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde72,0xb8));var _0x2de7=function(_0x4f55a6,_0x2ef0ec){_0x4f55a6=_0x4f55a6-0x0;var _0x4aab7c=_0xde72[_0x4f55a6];return _0x4aab7c;};'use strict';var multer=require(_0x2de7('0x0'));var util=require(_0x2de7('0x1'));var path=require('path');var timeout=require(_0x2de7('0x2'));var express=require(_0x2de7('0x3'));var router=express[_0x2de7('0x4')]();var fs_extra=require(_0x2de7('0x5'));var auth=require(_0x2de7('0x6'));var interaction=require(_0x2de7('0x7'));var config=require('../../config/environment');var controller=require(_0x2de7('0x8'));router['get']('/',auth[_0x2de7('0x9')](),controller[_0x2de7('0xa')]);router[_0x2de7('0xb')](_0x2de7('0xc'),auth[_0x2de7('0x9')](),controller[_0x2de7('0xd')]);router[_0x2de7('0xb')]('/:id',auth[_0x2de7('0x9')](),controller[_0x2de7('0xe')]);router[_0x2de7('0xf')]('/',auth[_0x2de7('0x9')](),controller['create']);router[_0x2de7('0x10')]('/:id',auth[_0x2de7('0x9')](),controller[_0x2de7('0x11')]);router['delete'](_0x2de7('0x12'),auth['isAuthenticated'](),controller[_0x2de7('0x13')]);module[_0x2de7('0x14')]=router; \ No newline at end of file +var _0x750f=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','delete'];(function(_0x20d970,_0x454832){var _0x5e9c45=function(_0x114d52){while(--_0x114d52){_0x20d970['push'](_0x20d970['shift']());}};_0x5e9c45(++_0x454832);}(_0x750f,0x157));var _0xf750=function(_0x419c19,_0x1aa8e0){_0x419c19=_0x419c19-0x0;var _0x510d71=_0x750f[_0x419c19];return _0x510d71;};'use strict';var multer=require(_0xf750('0x0'));var util=require(_0xf750('0x1'));var path=require(_0xf750('0x2'));var timeout=require('connect-timeout');var express=require(_0xf750('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf750('0x4'));var interaction=require(_0xf750('0x5'));var config=require(_0xf750('0x6'));var controller=require(_0xf750('0x7'));router['get']('/',auth[_0xf750('0x8')](),controller[_0xf750('0x9')]);router[_0xf750('0xa')](_0xf750('0xb'),auth[_0xf750('0x8')](),controller[_0xf750('0xc')]);router['get'](_0xf750('0xd'),auth[_0xf750('0x8')](),controller[_0xf750('0xe')]);router['post']('/',auth[_0xf750('0x8')](),controller[_0xf750('0xf')]);router[_0xf750('0x10')](_0xf750('0xd'),auth[_0xf750('0x8')](),controller['update']);router[_0xf750('0x11')](_0xf750('0xd'),auth[_0xf750('0x8')](),controller['destroy']);module[_0xf750('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index b540143..035f04f 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 _0x9c51=['exports','STRING','DATE','moment','sequelize'];(function(_0xcd9ece,_0x33ff67){var _0x36f54f=function(_0x54ec76){while(--_0x54ec76){_0xcd9ece['push'](_0xcd9ece['shift']());}};_0x36f54f(++_0x33ff67);}(_0x9c51,0x8f));var _0x19c5=function(_0x4bdb3b,_0x8b3f01){_0x4bdb3b=_0x4bdb3b-0x0;var _0x2fb99b=_0x9c51[_0x4bdb3b];return _0x2fb99b;};'use strict';var moment=require(_0x19c5('0x0'));var Sequelize=require(_0x19c5('0x1'));module[_0x19c5('0x2')]={'uniqueid':{'type':Sequelize[_0x19c5('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x19c5('0x4')]},'leaveAt':{'type':Sequelize[_0x19c5('0x4')]},'acceptAt':{'type':Sequelize[_0x19c5('0x4')]},'exitAt':{'type':Sequelize[_0x19c5('0x4')]},'reason':{'type':Sequelize[_0x19c5('0x3')]}}; \ No newline at end of file +var _0x7e06=['sequelize','exports','STRING','DATE'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7e06,0x1b0));var _0x67e0=function(_0x28b6c0,_0x5d98f0){_0x28b6c0=_0x28b6c0-0x0;var _0x883a1=_0x7e06[_0x28b6c0];return _0x883a1;};'use strict';var moment=require('moment');var Sequelize=require(_0x67e0('0x0'));module[_0x67e0('0x1')]={'uniqueid':{'type':Sequelize[_0x67e0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x67e0('0x2')]},'joinAt':{'type':Sequelize[_0x67e0('0x3')]},'leaveAt':{'type':Sequelize[_0x67e0('0x3')]},'acceptAt':{'type':Sequelize[_0x67e0('0x3')]},'exitAt':{'type':Sequelize[_0x67e0('0x3')]},'reason':{'type':Sequelize[_0x67e0('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index b6c25c6..af75c81 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 _0x1484=['OpenchannelQueueReport','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','error','name','send','index','map','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x397771,_0x576694){var _0x345e04=function(_0x57da9c){while(--_0x57da9c){_0x397771['push'](_0x397771['shift']());}};_0x345e04(++_0x576694);}(_0x1484,0x1d0));var _0x4148=function(_0xe480f0,_0x4c0dc1){_0xe480f0=_0xe480f0-0x0;var _0x57b198=_0x1484[_0xe480f0];return _0x57b198;};'use strict';var emlformat=require(_0x4148('0x0'));var rimraf=require(_0x4148('0x1'));var zipdir=require(_0x4148('0x2'));var jsonpatch=require(_0x4148('0x3'));var rp=require(_0x4148('0x4'));var moment=require(_0x4148('0x5'));var BPromise=require(_0x4148('0x6'));var Mustache=require(_0x4148('0x7'));var util=require(_0x4148('0x8'));var path=require(_0x4148('0x9'));var sox=require(_0x4148('0xa'));var csv=require('to-csv');var ejs=require(_0x4148('0xb'));var fs=require('fs');var fs_extra=require(_0x4148('0xc'));var _=require(_0x4148('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4148('0xe'));var deskjs=require(_0x4148('0xf'));var toCsv=require(_0x4148('0x10'));var querystring=require('querystring');var Papa=require(_0x4148('0x11'));var Redis=require(_0x4148('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4148('0x13'));var as=require(_0x4148('0x14'));var hardwareService=require(_0x4148('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4148('0x16'));var config=require(_0x4148('0x17'));var licenseUtil=require(_0x4148('0x18'));var db=require(_0x4148('0x19'))['db'];function respondWithStatusCode(_0x1fca16,_0x41af74){_0x41af74=_0x41af74||0xcc;return function(_0x538413){if(_0x538413){return _0x1fca16[_0x4148('0x1a')](_0x41af74);}return _0x1fca16[_0x4148('0x1b')](_0x41af74)[_0x4148('0x1c')]();};}function respondWithResult(_0x314d52,_0x5e1f10){_0x5e1f10=_0x5e1f10||0xc8;return function(_0x325526){if(_0x325526){return _0x314d52['status'](_0x5e1f10)['json'](_0x325526);}};}function respondWithFilteredResult(_0x2c3a7b,_0x3eb0f4){return function(_0x51858b){if(_0x51858b){var _0x2e0e20=typeof _0x3eb0f4[_0x4148('0x1d')]===_0x4148('0x1e')&&typeof _0x3eb0f4[_0x4148('0x1f')]==='undefined';var _0x318847=_0x51858b[_0x4148('0x20')];var _0x37ee80=_0x2e0e20?0x0:_0x3eb0f4[_0x4148('0x1d')];var _0x540e46=_0x2e0e20?_0x51858b['count']:_0x3eb0f4[_0x4148('0x1d')]+_0x3eb0f4[_0x4148('0x1f')];var _0x5b9399;if(_0x540e46>=_0x318847){_0x540e46=_0x318847;_0x5b9399=0xc8;}else{_0x5b9399=0xce;}_0x2c3a7b['status'](_0x5b9399);return _0x2c3a7b['set'](_0x4148('0x21'),_0x37ee80+'-'+_0x540e46+'/'+_0x318847)[_0x4148('0x22')](_0x51858b);}return null;};}function patchUpdates(_0x51ac37){return function(_0x4dd28c){try{jsonpatch[_0x4148('0x23')](_0x4dd28c,_0x51ac37,!![]);}catch(_0x350cff){return BPromise[_0x4148('0x24')](_0x350cff);}return _0x4dd28c[_0x4148('0x25')]();};}function saveUpdates(_0x2c3c55,_0xc64c22){return function(_0x502bbc){if(_0x502bbc){return _0x502bbc[_0x4148('0x26')](_0x2c3c55)['then'](function(_0x479fa9){return _0x479fa9;});}return null;};}function removeEntity(_0x4be35a,_0x2f837c){return function(_0x1776d2){if(_0x1776d2){return _0x1776d2['destroy']()['then'](function(){_0x4be35a[_0x4148('0x1b')](0xcc)[_0x4148('0x1c')]();});}};}function handleEntityNotFound(_0x135bbb,_0x12fb7c){return function(_0x20ce48){if(!_0x20ce48){_0x135bbb[_0x4148('0x1a')](0x194);}return _0x20ce48;};}function handleError(_0x109561,_0xbb05bf){_0xbb05bf=_0xbb05bf||0x1f4;return function(_0x2e80f7){logger[_0x4148('0x27')](_0x2e80f7['stack']);if(_0x2e80f7[_0x4148('0x28')]){delete _0x2e80f7[_0x4148('0x28')];}_0x109561[_0x4148('0x1b')](_0xbb05bf)[_0x4148('0x29')](_0x2e80f7);};}exports[_0x4148('0x2a')]=function(_0x58786e,_0x236a7f){var _0x6b49ce={},_0x3ca902={},_0x1e6f38={'count':0x0,'rows':[]};var _0x573712=_[_0x4148('0x2b')](db['OpenchannelQueueReport'][_0x4148('0x2c')],function(_0x4f4989){return{'name':_0x4f4989['fieldName'],'type':_0x4f4989['type']['key']};});_0x3ca902[_0x4148('0x2d')]=_[_0x4148('0x2b')](_0x573712,_0x4148('0x28'));_0x3ca902['query']=_[_0x4148('0x2e')](_0x58786e[_0x4148('0x2f')]);_0x3ca902[_0x4148('0x30')]=_['intersection'](_0x3ca902[_0x4148('0x2d')],_0x3ca902[_0x4148('0x2f')]);_0x6b49ce['attributes']=_[_0x4148('0x31')](_0x3ca902[_0x4148('0x2d')],qs[_0x4148('0x32')](_0x58786e[_0x4148('0x2f')][_0x4148('0x32')]));_0x6b49ce[_0x4148('0x33')]=_0x6b49ce['attributes'][_0x4148('0x34')]?_0x6b49ce[_0x4148('0x33')]:_0x3ca902[_0x4148('0x2d')];if(!_0x58786e[_0x4148('0x2f')]['hasOwnProperty'](_0x4148('0x35'))){_0x6b49ce[_0x4148('0x1f')]=qs['limit'](_0x58786e['query'][_0x4148('0x1f')]);_0x6b49ce[_0x4148('0x1d')]=qs[_0x4148('0x1d')](_0x58786e[_0x4148('0x2f')][_0x4148('0x1d')]);}_0x6b49ce[_0x4148('0x36')]=qs[_0x4148('0x37')](_0x58786e[_0x4148('0x2f')][_0x4148('0x37')]);_0x6b49ce[_0x4148('0x38')]=qs[_0x4148('0x30')](_['pick'](_0x58786e[_0x4148('0x2f')],_0x3ca902['filters']),_0x573712);if(_0x58786e[_0x4148('0x2f')][_0x4148('0x39')]){_0x6b49ce[_0x4148('0x38')]=_[_0x4148('0x3a')](_0x6b49ce[_0x4148('0x38')],{'$or':_[_0x4148('0x2b')](_0x573712,function(_0x4a42bc){if(_0x4a42bc['type']!==_0x4148('0x3b')){var _0x14a27c={};_0x14a27c[_0x4a42bc[_0x4148('0x28')]]={'$like':'%'+_0x58786e[_0x4148('0x2f')][_0x4148('0x39')]+'%'};return _0x14a27c;}})});}_0x6b49ce=_['merge']({},_0x6b49ce,_0x58786e[_0x4148('0x3c')]);var _0xe64fff={'where':_0x6b49ce[_0x4148('0x38')]};return db[_0x4148('0x3d')][_0x4148('0x20')](_0xe64fff)[_0x4148('0x3e')](function(_0x1cb93d){_0x1e6f38[_0x4148('0x20')]=_0x1cb93d;if(_0x58786e[_0x4148('0x2f')][_0x4148('0x3f')]){_0x6b49ce['include']=[{'all':!![]}];}return db[_0x4148('0x3d')][_0x4148('0x40')](_0x6b49ce);})['then'](function(_0x1386e0){_0x1e6f38[_0x4148('0x41')]=_0x1386e0;return _0x1e6f38;})[_0x4148('0x3e')](respondWithFilteredResult(_0x236a7f,_0x6b49ce))[_0x4148('0x42')](handleError(_0x236a7f,null));};exports[_0x4148('0x43')]=function(_0x41b3eb,_0x37f178){var _0x58ecac={'raw':!![],'where':{'id':_0x41b3eb[_0x4148('0x44')]['id']}},_0x364073={};_0x364073[_0x4148('0x2d')]=_[_0x4148('0x2e')](db[_0x4148('0x3d')][_0x4148('0x2c')]);_0x364073[_0x4148('0x2f')]=_[_0x4148('0x2e')](_0x41b3eb['query']);_0x364073[_0x4148('0x30')]=_[_0x4148('0x31')](_0x364073[_0x4148('0x2d')],_0x364073[_0x4148('0x2f')]);_0x58ecac[_0x4148('0x33')]=_['intersection'](_0x364073[_0x4148('0x2d')],qs['fields'](_0x41b3eb[_0x4148('0x2f')][_0x4148('0x32')]));_0x58ecac['attributes']=_0x58ecac[_0x4148('0x33')][_0x4148('0x34')]?_0x58ecac[_0x4148('0x33')]:_0x364073[_0x4148('0x2d')];if(_0x41b3eb['query'][_0x4148('0x3f')]){_0x58ecac[_0x4148('0x45')]=[{'all':!![]}];}_0x58ecac=_[_0x4148('0x3a')]({},_0x58ecac,_0x41b3eb[_0x4148('0x3c')]);return db[_0x4148('0x3d')][_0x4148('0x46')](_0x58ecac)[_0x4148('0x3e')](handleEntityNotFound(_0x37f178,null))['then'](respondWithResult(_0x37f178,null))[_0x4148('0x42')](handleError(_0x37f178,null));};exports[_0x4148('0x47')]=function(_0x4caf61,_0x14b24a){return db[_0x4148('0x3d')][_0x4148('0x47')](_0x4caf61[_0x4148('0x48')],{})[_0x4148('0x3e')](respondWithResult(_0x14b24a,0xc9))[_0x4148('0x42')](handleError(_0x14b24a,null));};exports[_0x4148('0x26')]=function(_0x5046b7,_0x4e561f){if(_0x5046b7['body']['id']){delete _0x5046b7[_0x4148('0x48')]['id'];}return db['OpenchannelQueueReport'][_0x4148('0x46')]({'where':{'id':_0x5046b7['params']['id']}})[_0x4148('0x3e')](handleEntityNotFound(_0x4e561f,null))[_0x4148('0x3e')](saveUpdates(_0x5046b7[_0x4148('0x48')],null))['then'](respondWithResult(_0x4e561f,null))['catch'](handleError(_0x4e561f,null));};exports[_0x4148('0x49')]=function(_0x53c206,_0x380a41){return db[_0x4148('0x3d')][_0x4148('0x46')]({'where':{'id':_0x53c206[_0x4148('0x44')]['id']}})[_0x4148('0x3e')](handleEntityNotFound(_0x380a41,null))[_0x4148('0x3e')](removeEntity(_0x380a41,null))[_0x4148('0x42')](handleError(_0x380a41,null));};exports[_0x4148('0x4a')]=function(_0x42f02c,_0x4851c9){return db[_0x4148('0x3d')][_0x4148('0x4a')]()[_0x4148('0x3e')](respondWithResult(_0x4851c9,null))[_0x4148('0x42')](handleError(_0x4851c9,null));}; \ No newline at end of file +var _0x7ce1=['key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','update','then','error','stack','name','send','index','map','rawAttributes','type'];(function(_0x3faaee,_0x8d2665){var _0x17bbe3=function(_0x830e73){while(--_0x830e73){_0x3faaee['push'](_0x3faaee['shift']());}};_0x17bbe3(++_0x8d2665);}(_0x7ce1,0x10c));var _0x17ce=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0x7ce1[_0x1d4449];return _0x4dcde3;};'use strict';var emlformat=require(_0x17ce('0x0'));var rimraf=require(_0x17ce('0x1'));var zipdir=require(_0x17ce('0x2'));var jsonpatch=require(_0x17ce('0x3'));var rp=require(_0x17ce('0x4'));var moment=require('moment');var BPromise=require(_0x17ce('0x5'));var Mustache=require(_0x17ce('0x6'));var util=require(_0x17ce('0x7'));var path=require(_0x17ce('0x8'));var sox=require('sox');var csv=require(_0x17ce('0x9'));var ejs=require(_0x17ce('0xa'));var fs=require('fs');var fs_extra=require(_0x17ce('0xb'));var _=require(_0x17ce('0xc'));var squel=require(_0x17ce('0xd'));var crypto=require(_0x17ce('0xe'));var jsforce=require(_0x17ce('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x17ce('0x9'));var querystring=require(_0x17ce('0x10'));var Papa=require(_0x17ce('0x11'));var Redis=require('ioredis');var authService=require(_0x17ce('0x12'));var qs=require(_0x17ce('0x13'));var as=require(_0x17ce('0x14'));var hardwareService=require(_0x17ce('0x15'));var logger=require(_0x17ce('0x16'))(_0x17ce('0x17'));var utils=require(_0x17ce('0x18'));var config=require(_0x17ce('0x19'));var licenseUtil=require(_0x17ce('0x1a'));var db=require(_0x17ce('0x1b'))['db'];function respondWithStatusCode(_0x1a4958,_0xeef022){_0xeef022=_0xeef022||0xcc;return function(_0x2ad8fb){if(_0x2ad8fb){return _0x1a4958[_0x17ce('0x1c')](_0xeef022);}return _0x1a4958[_0x17ce('0x1d')](_0xeef022)[_0x17ce('0x1e')]();};}function respondWithResult(_0x59e63f,_0x4c4055){_0x4c4055=_0x4c4055||0xc8;return function(_0x2e123a){if(_0x2e123a){return _0x59e63f['status'](_0x4c4055)[_0x17ce('0x1f')](_0x2e123a);}};}function respondWithFilteredResult(_0x4d7f61,_0x4c7d3b){return function(_0x21d85b){if(_0x21d85b){var _0x1084f9=typeof _0x4c7d3b[_0x17ce('0x20')]==='undefined'&&typeof _0x4c7d3b[_0x17ce('0x21')]===_0x17ce('0x22');var _0x52fc78=_0x21d85b['count'];var _0x4cccc1=_0x1084f9?0x0:_0x4c7d3b['offset'];var _0x116bcf=_0x1084f9?_0x21d85b[_0x17ce('0x23')]:_0x4c7d3b[_0x17ce('0x20')]+_0x4c7d3b[_0x17ce('0x21')];var _0x2f40cb;if(_0x116bcf>=_0x52fc78){_0x116bcf=_0x52fc78;_0x2f40cb=0xc8;}else{_0x2f40cb=0xce;}_0x4d7f61[_0x17ce('0x1d')](_0x2f40cb);return _0x4d7f61[_0x17ce('0x24')]('Content-Range',_0x4cccc1+'-'+_0x116bcf+'/'+_0x52fc78)[_0x17ce('0x1f')](_0x21d85b);}return null;};}function patchUpdates(_0xb33284){return function(_0x165fd1){try{jsonpatch['apply'](_0x165fd1,_0xb33284,!![]);}catch(_0x5d344a){return BPromise[_0x17ce('0x25')](_0x5d344a);}return _0x165fd1['save']();};}function saveUpdates(_0x45e378,_0x12c1c4){return function(_0x1a6f1e){if(_0x1a6f1e){return _0x1a6f1e[_0x17ce('0x26')](_0x45e378)[_0x17ce('0x27')](function(_0x7aa7f3){return _0x7aa7f3;});}return null;};}function removeEntity(_0xff16f,_0x27e044){return function(_0x167f3c){if(_0x167f3c){return _0x167f3c['destroy']()[_0x17ce('0x27')](function(){_0xff16f[_0x17ce('0x1d')](0xcc)[_0x17ce('0x1e')]();});}};}function handleEntityNotFound(_0x59568f,_0x2509f1){return function(_0x3ec6ce){if(!_0x3ec6ce){_0x59568f['sendStatus'](0x194);}return _0x3ec6ce;};}function handleError(_0xd1a490,_0x16ab28){_0x16ab28=_0x16ab28||0x1f4;return function(_0x5bf15d){logger[_0x17ce('0x28')](_0x5bf15d[_0x17ce('0x29')]);if(_0x5bf15d['name']){delete _0x5bf15d[_0x17ce('0x2a')];}_0xd1a490[_0x17ce('0x1d')](_0x16ab28)[_0x17ce('0x2b')](_0x5bf15d);};}exports[_0x17ce('0x2c')]=function(_0x2f6fd0,_0x26b982){var _0x1646a5={},_0x111dad={},_0x31e281={'count':0x0,'rows':[]};var _0x24fee0=_[_0x17ce('0x2d')](db['OpenchannelQueueReport'][_0x17ce('0x2e')],function(_0x53f6b2){return{'name':_0x53f6b2['fieldName'],'type':_0x53f6b2[_0x17ce('0x2f')][_0x17ce('0x30')]};});_0x111dad[_0x17ce('0x31')]=_[_0x17ce('0x2d')](_0x24fee0,_0x17ce('0x2a'));_0x111dad[_0x17ce('0x32')]=_[_0x17ce('0x33')](_0x2f6fd0[_0x17ce('0x32')]);_0x111dad[_0x17ce('0x34')]=_['intersection'](_0x111dad[_0x17ce('0x31')],_0x111dad['query']);_0x1646a5[_0x17ce('0x35')]=_[_0x17ce('0x36')](_0x111dad['model'],qs[_0x17ce('0x37')](_0x2f6fd0[_0x17ce('0x32')]['fields']));_0x1646a5[_0x17ce('0x35')]=_0x1646a5[_0x17ce('0x35')][_0x17ce('0x38')]?_0x1646a5['attributes']:_0x111dad[_0x17ce('0x31')];if(!_0x2f6fd0[_0x17ce('0x32')][_0x17ce('0x39')](_0x17ce('0x3a'))){_0x1646a5[_0x17ce('0x21')]=qs[_0x17ce('0x21')](_0x2f6fd0[_0x17ce('0x32')][_0x17ce('0x21')]);_0x1646a5[_0x17ce('0x20')]=qs['offset'](_0x2f6fd0[_0x17ce('0x32')]['offset']);}_0x1646a5[_0x17ce('0x3b')]=qs['sort'](_0x2f6fd0['query'][_0x17ce('0x3c')]);_0x1646a5[_0x17ce('0x3d')]=qs['filters'](_[_0x17ce('0x3e')](_0x2f6fd0[_0x17ce('0x32')],_0x111dad[_0x17ce('0x34')]),_0x24fee0);if(_0x2f6fd0[_0x17ce('0x32')][_0x17ce('0x3f')]){_0x1646a5[_0x17ce('0x3d')]=_[_0x17ce('0x40')](_0x1646a5[_0x17ce('0x3d')],{'$or':_[_0x17ce('0x2d')](_0x24fee0,function(_0x83a8c0){if(_0x83a8c0[_0x17ce('0x2f')]!=='VIRTUAL'){var _0x423d4d={};_0x423d4d[_0x83a8c0['name']]={'$like':'%'+_0x2f6fd0['query'][_0x17ce('0x3f')]+'%'};return _0x423d4d;}})});}_0x1646a5=_[_0x17ce('0x40')]({},_0x1646a5,_0x2f6fd0[_0x17ce('0x41')]);var _0x5b5bc3={'where':_0x1646a5[_0x17ce('0x3d')]};return db[_0x17ce('0x42')]['count'](_0x5b5bc3)[_0x17ce('0x27')](function(_0x3644d3){_0x31e281[_0x17ce('0x23')]=_0x3644d3;if(_0x2f6fd0[_0x17ce('0x32')][_0x17ce('0x43')]){_0x1646a5[_0x17ce('0x44')]=[{'all':!![]}];}return db[_0x17ce('0x42')][_0x17ce('0x45')](_0x1646a5);})[_0x17ce('0x27')](function(_0xfa0126){_0x31e281[_0x17ce('0x46')]=_0xfa0126;return _0x31e281;})[_0x17ce('0x27')](respondWithFilteredResult(_0x26b982,_0x1646a5))[_0x17ce('0x47')](handleError(_0x26b982,null));};exports[_0x17ce('0x48')]=function(_0x5356a4,_0x132056){var _0x17590c={'raw':!![],'where':{'id':_0x5356a4['params']['id']}},_0x2cbc65={};_0x2cbc65[_0x17ce('0x31')]=_[_0x17ce('0x33')](db['OpenchannelQueueReport'][_0x17ce('0x2e')]);_0x2cbc65['query']=_[_0x17ce('0x33')](_0x5356a4[_0x17ce('0x32')]);_0x2cbc65[_0x17ce('0x34')]=_[_0x17ce('0x36')](_0x2cbc65[_0x17ce('0x31')],_0x2cbc65['query']);_0x17590c[_0x17ce('0x35')]=_[_0x17ce('0x36')](_0x2cbc65[_0x17ce('0x31')],qs[_0x17ce('0x37')](_0x5356a4[_0x17ce('0x32')][_0x17ce('0x37')]));_0x17590c[_0x17ce('0x35')]=_0x17590c['attributes'][_0x17ce('0x38')]?_0x17590c[_0x17ce('0x35')]:_0x2cbc65[_0x17ce('0x31')];if(_0x5356a4[_0x17ce('0x32')][_0x17ce('0x43')]){_0x17590c[_0x17ce('0x44')]=[{'all':!![]}];}_0x17590c=_['merge']({},_0x17590c,_0x5356a4[_0x17ce('0x41')]);return db[_0x17ce('0x42')][_0x17ce('0x49')](_0x17590c)[_0x17ce('0x27')](handleEntityNotFound(_0x132056,null))[_0x17ce('0x27')](respondWithResult(_0x132056,null))[_0x17ce('0x47')](handleError(_0x132056,null));};exports[_0x17ce('0x4a')]=function(_0x2cccf6,_0x5786e3){return db[_0x17ce('0x42')][_0x17ce('0x4a')](_0x2cccf6['body'],{})['then'](respondWithResult(_0x5786e3,0xc9))[_0x17ce('0x47')](handleError(_0x5786e3,null));};exports['update']=function(_0x43ab50,_0x578f60){if(_0x43ab50['body']['id']){delete _0x43ab50[_0x17ce('0x4b')]['id'];}return db[_0x17ce('0x42')]['find']({'where':{'id':_0x43ab50['params']['id']}})['then'](handleEntityNotFound(_0x578f60,null))[_0x17ce('0x27')](saveUpdates(_0x43ab50[_0x17ce('0x4b')],null))[_0x17ce('0x27')](respondWithResult(_0x578f60,null))[_0x17ce('0x47')](handleError(_0x578f60,null));};exports[_0x17ce('0x4c')]=function(_0x43127f,_0x14513d){return db['OpenchannelQueueReport'][_0x17ce('0x49')]({'where':{'id':_0x43127f[_0x17ce('0x4d')]['id']}})[_0x17ce('0x27')](handleEntityNotFound(_0x14513d,null))[_0x17ce('0x27')](removeEntity(_0x14513d,null))[_0x17ce('0x47')](handleError(_0x14513d,null));};exports['describe']=function(_0x2af383,_0x5b8d76){return db['OpenchannelQueueReport'][_0x17ce('0x4e')]()[_0x17ce('0x27')](respondWithResult(_0x5b8d76,null))[_0x17ce('0x47')](handleError(_0x5b8d76,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 212d8b0..2652d75 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x170e56,_0x4750dc){var _0x141888=function(_0x11fe4b){while(--_0x11fe4b){_0x170e56['push'](_0x170e56['shift']());}};_0x141888(++_0x4750dc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0x5fc3[_0x339129];return _0x1570df;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x5ce08b,_0x188c09){var _0x327658=function(_0x1a4876){while(--_0x1a4876){_0x5ce08b['push'](_0x5ce08b['shift']());}};_0x327658(++_0x188c09);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index f7c7119..29588aa 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 _0x47c5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4b9d10,_0x546ad4){var _0xd7750a=function(_0x400a9a){while(--_0x400a9a){_0x4b9d10['push'](_0x4b9d10['shift']());}};_0xd7750a(++_0x546ad4);}(_0x47c5,0x165));var _0x547c=function(_0x568ae7,_0x2b5fa3){_0x568ae7=_0x568ae7-0x0;var _0x257050=_0x47c5[_0x568ae7];return _0x257050;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['CreateOpenchannelQueueReport']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5453f9){logger[_0x547c('0xd')](_0x547c('0x1d'),_0x23fa9e);logger['debug'](_0x547c('0x1d'),_0x23fa9e,JSON[_0x547c('0x12')](_0x5453f9));_0xeb059e(_0x5453f9);})['catch'](function(_0x2e317a){logger[_0x547c('0x13')](_0x547c('0x1d'),_0x2e317a['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2e317a[_0x547c('0x15')]));});});};exports[_0x547c('0x1e')]=function(_0x26823c){var _0x1f3581=this;return new Promise(function(_0x2663bc,_0x2ab2cc){return db[_0x547c('0x18')]['update'](_0x26823c[_0x547c('0x1a')],{'raw':_0x26823c['options']?_0x26823c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26823c['options']?_0x26823c[_0x547c('0x1b')]['where']||null:null,'attributes':_0x26823c[_0x547c('0x1b')]?_0x26823c['options'][_0x547c('0x1f')]||null:null,'limit':_0x26823c['options']?_0x26823c[_0x547c('0x1b')][_0x547c('0x20')]||null:null})[_0x547c('0xc')](function(_0x30a96c){logger[_0x547c('0xd')]('UpdateOpenchannelQueueReport',_0x26823c);logger['debug'](_0x547c('0x1e'),_0x26823c,JSON['stringify'](_0x30a96c));_0x2663bc(_0x30a96c);})[_0x547c('0x17')](function(_0xed2d39){logger[_0x547c('0x13')](_0x547c('0x1e'),_0xed2d39[_0x547c('0x15')],_0x26823c);_0x2ab2cc(_0x1f3581[_0x547c('0x13')](0x1f4,_0xed2d39[_0x547c('0x15')]));});});}; \ No newline at end of file +var _0x0447=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','raw','then','UpdateOpenchannelQueueReport','update','body','options','where','attributes','limit','catch','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0447,0x8b));var _0x7044=function(_0x3f23d9,_0x4f118e){_0x3f23d9=_0x3f23d9-0x0;var _0x5f15be=_0x0447[_0x3f23d9];return _0x5f15be;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var moment=require(_0x7044('0x2'));var BPromise=require(_0x7044('0x3'));var rs=require(_0x7044('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7044('0x5'))['db'];var utils=require(_0x7044('0x6'));var logger=require(_0x7044('0x7'))(_0x7044('0x8'));var config=require(_0x7044('0x9'));var jayson=require(_0x7044('0xa'));var client=jayson[_0x7044('0xb')][_0x7044('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x66b8cb,_0x51de50,_0x72d341){return new BPromise(function(_0x42d53b,_0x2a2b36){return client[_0x7044('0xd')](_0x66b8cb,_0x72d341)['then'](function(_0x41616d){logger[_0x7044('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x51de50,_0x7044('0xf'));logger[_0x7044('0x10')](_0x7044('0x11'),_0x51de50,_0x7044('0xf'),JSON['stringify'](_0x41616d));if(_0x41616d[_0x7044('0x12')]){if(_0x41616d['error']['code']===0x1f4){logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')][_0x7044('0x14')]);return _0x2a2b36(_0x41616d[_0x7044('0x12')]['message']);}logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')]['message']);return _0x42d53b(_0x41616d['error'][_0x7044('0x14')]);}else{logger[_0x7044('0xe')](_0x7044('0x13'),_0x51de50,_0x7044('0xf'));_0x42d53b(_0x41616d[_0x7044('0x15')][_0x7044('0x14')]);}})['catch'](function(_0xdae8a){logger[_0x7044('0x12')](_0x7044('0x13'),_0x51de50,_0xdae8a);_0x2a2b36(_0xdae8a);});});}exports[_0x7044('0x16')]=function(_0x219486){var _0x3f373c=this;return new Promise(function(_0x4df89b,_0x1f300e){return db[_0x7044('0x17')][_0x7044('0x18')](_0x219486['body'],{'raw':_0x219486['options']?_0x219486['options'][_0x7044('0x19')]===undefined?!![]:![]:!![]})[_0x7044('0x1a')](function(_0x2c5dcb){logger[_0x7044('0xe')](_0x7044('0x16'),_0x219486);logger['debug'](_0x7044('0x16'),_0x219486,JSON['stringify'](_0x2c5dcb));_0x4df89b(_0x2c5dcb);})['catch'](function(_0x3db88b){logger[_0x7044('0x12')](_0x7044('0x16'),_0x3db88b[_0x7044('0x14')],_0x219486);_0x1f300e(_0x3f373c[_0x7044('0x12')](0x1f4,_0x3db88b[_0x7044('0x14')]));});});};exports[_0x7044('0x1b')]=function(_0x9452a1){var _0x4271b5=this;return new Promise(function(_0x5e2c9a,_0x5d7d8a){return db[_0x7044('0x17')][_0x7044('0x1c')](_0x9452a1[_0x7044('0x1d')],{'raw':_0x9452a1[_0x7044('0x1e')]?_0x9452a1[_0x7044('0x1e')][_0x7044('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9452a1[_0x7044('0x1e')]?_0x9452a1[_0x7044('0x1e')][_0x7044('0x1f')]||null:null,'attributes':_0x9452a1[_0x7044('0x1e')]?_0x9452a1[_0x7044('0x1e')][_0x7044('0x20')]||null:null,'limit':_0x9452a1['options']?_0x9452a1[_0x7044('0x1e')][_0x7044('0x21')]||null:null})[_0x7044('0x1a')](function(_0x1a75ff){logger['info'](_0x7044('0x1b'),_0x9452a1);logger['debug']('UpdateOpenchannelQueueReport',_0x9452a1,JSON['stringify'](_0x1a75ff));_0x5e2c9a(_0x1a75ff);})[_0x7044('0x22')](function(_0x55ea91){logger[_0x7044('0x12')](_0x7044('0x1b'),_0x55ea91['message'],_0x9452a1);_0x5d7d8a(_0x4271b5['error'](0x1f4,_0x55ea91[_0x7044('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f613e7c..fd986ca 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 _0xa3f5=['show','create','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa3f5,0x11c));var _0x5a3f=function(_0x5dd0aa,_0x4f5d0c){_0x5dd0aa=_0x5dd0aa-0x0;var _0x71501c=_0xa3f5[_0x5dd0aa];return _0x71501c;};'use strict';var multer=require(_0x5a3f('0x0'));var util=require(_0x5a3f('0x1'));var path=require(_0x5a3f('0x2'));var timeout=require(_0x5a3f('0x3'));var express=require(_0x5a3f('0x4'));var router=express[_0x5a3f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5a3f('0x6'));var interaction=require(_0x5a3f('0x7'));var config=require(_0x5a3f('0x8'));var controller=require(_0x5a3f('0x9'));router['get']('/',auth[_0x5a3f('0xa')](),controller[_0x5a3f('0xb')]);router[_0x5a3f('0xc')](_0x5a3f('0xd'),auth['isAuthenticated'](),controller[_0x5a3f('0xe')]);router[_0x5a3f('0xc')](_0x5a3f('0xf'),auth['isAuthenticated'](),controller[_0x5a3f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5a3f('0x11')]);router['put'](_0x5a3f('0xf'),auth[_0x5a3f('0xa')](),controller['update']);router['delete'](_0x5a3f('0xf'),auth[_0x5a3f('0xa')](),controller[_0x5a3f('0x12')]);module[_0x5a3f('0x13')]=router; \ No newline at end of file +var _0xcb28=['../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xcb28,0x6c));var _0x8cb2=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0xcb28[_0xcf5436];return _0xc4f5c8;};'use strict';var multer=require('multer');var util=require(_0x8cb2('0x0'));var path=require('path');var timeout=require(_0x8cb2('0x1'));var express=require(_0x8cb2('0x2'));var router=express[_0x8cb2('0x3')]();var fs_extra=require(_0x8cb2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8cb2('0x5'));var config=require(_0x8cb2('0x6'));var controller=require(_0x8cb2('0x7'));router[_0x8cb2('0x8')]('/',auth[_0x8cb2('0x9')](),controller[_0x8cb2('0xa')]);router[_0x8cb2('0x8')]('/describe',auth[_0x8cb2('0x9')](),controller['describe']);router[_0x8cb2('0x8')](_0x8cb2('0xb'),auth['isAuthenticated'](),controller[_0x8cb2('0xc')]);router[_0x8cb2('0xd')]('/',auth['isAuthenticated'](),controller[_0x8cb2('0xe')]);router[_0x8cb2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8cb2('0x10')]);router[_0x8cb2('0x11')](_0x8cb2('0xb'),auth['isAuthenticated'](),controller[_0x8cb2('0x12')]);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 238f54b..cc63a30 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x464d67,_0x3d5705){var _0x4e60ac=function(_0x257b07){while(--_0x257b07){_0x464d67['push'](_0x464d67['shift']());}};_0x4e60ac(++_0x3d5705);}(_0x70e0,0x17b));var _0x070e=function(_0x3b232a,_0x3926bd){_0x3b232a=_0x3b232a-0x0;var _0x2a96be=_0x70e0[_0x3b232a];return _0x2a96be;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2b0102,_0xe3da2e){var _0x22e6e1=function(_0x5c18fb){while(--_0x5c18fb){_0x2b0102['push'](_0x2b0102['shift']());}};_0x22e6e1(++_0xe3da2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 04dfc6f..a1d6010 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 _0x93f4=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x30c3c2,_0x330cca){var _0x738110=function(_0x13891e){while(--_0x13891e){_0x30c3c2['push'](_0x30c3c2['shift']());}};_0x738110(++_0x330cca);}(_0x93f4,0x13a));var _0x493f=function(_0x4b8618,_0x3dcb39){_0x4b8618=_0x4b8618-0x0;var _0x3da94d=_0x93f4[_0x4b8618];return _0x3da94d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x493f('0x0'));var zipdir=require(_0x493f('0x1'));var jsonpatch=require(_0x493f('0x2'));var rp=require(_0x493f('0x3'));var moment=require(_0x493f('0x4'));var BPromise=require(_0x493f('0x5'));var Mustache=require(_0x493f('0x6'));var util=require('util');var path=require(_0x493f('0x7'));var sox=require('sox');var csv=require(_0x493f('0x8'));var ejs=require(_0x493f('0x9'));var fs=require('fs');var fs_extra=require(_0x493f('0xa'));var _=require(_0x493f('0xb'));var squel=require(_0x493f('0xc'));var crypto=require(_0x493f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x493f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x493f('0xf'));var Papa=require(_0x493f('0x10'));var Redis=require('ioredis');var authService=require(_0x493f('0x11'));var qs=require(_0x493f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x493f('0x13'));var utils=require('../../config/utils');var config=require(_0x493f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x493f('0x15'))['db'];function respondWithStatusCode(_0x25eb44,_0x36aa24){_0x36aa24=_0x36aa24||0xcc;return function(_0x1e5126){if(_0x1e5126){return _0x25eb44[_0x493f('0x16')](_0x36aa24);}return _0x25eb44[_0x493f('0x17')](_0x36aa24)['end']();};}function respondWithResult(_0x54c788,_0x395ad4){_0x395ad4=_0x395ad4||0xc8;return function(_0x30496d){if(_0x30496d){return _0x54c788[_0x493f('0x17')](_0x395ad4)[_0x493f('0x18')](_0x30496d);}};}function respondWithFilteredResult(_0x419fb7,_0x55cd17){return function(_0x21dd33){if(_0x21dd33){var _0x1b034b=typeof _0x55cd17[_0x493f('0x19')]===_0x493f('0x1a')&&typeof _0x55cd17['limit']===_0x493f('0x1a');var _0x59f18a=_0x21dd33[_0x493f('0x1b')];var _0x4ecfc2=_0x1b034b?0x0:_0x55cd17[_0x493f('0x19')];var _0x1c6237=_0x1b034b?_0x21dd33[_0x493f('0x1b')]:_0x55cd17[_0x493f('0x19')]+_0x55cd17[_0x493f('0x1c')];var _0x362032;if(_0x1c6237>=_0x59f18a){_0x1c6237=_0x59f18a;_0x362032=0xc8;}else{_0x362032=0xce;}_0x419fb7['status'](_0x362032);return _0x419fb7[_0x493f('0x1d')](_0x493f('0x1e'),_0x4ecfc2+'-'+_0x1c6237+'/'+_0x59f18a)['json'](_0x21dd33);}return null;};}function patchUpdates(_0x3287b1){return function(_0x4d1c45){try{jsonpatch[_0x493f('0x1f')](_0x4d1c45,_0x3287b1,!![]);}catch(_0x50b9d6){return BPromise[_0x493f('0x20')](_0x50b9d6);}return _0x4d1c45[_0x493f('0x21')]();};}function saveUpdates(_0x2e209c,_0x27e467){return function(_0x20dc4f){if(_0x20dc4f){return _0x20dc4f[_0x493f('0x22')](_0x2e209c)[_0x493f('0x23')](function(_0x588ce5){return _0x588ce5;});}return null;};}function removeEntity(_0x24dcfd,_0x50952e){return function(_0x3674d5){if(_0x3674d5){return _0x3674d5[_0x493f('0x24')]()[_0x493f('0x23')](function(){_0x24dcfd[_0x493f('0x17')](0xcc)[_0x493f('0x25')]();});}};}function handleEntityNotFound(_0xe38ab7,_0x1b0827){return function(_0x583c57){if(!_0x583c57){_0xe38ab7[_0x493f('0x16')](0x194);}return _0x583c57;};}function handleError(_0x40eb1f,_0x106bfa){_0x106bfa=_0x106bfa||0x1f4;return function(_0x2e1c63){logger[_0x493f('0x26')](_0x2e1c63[_0x493f('0x27')]);if(_0x2e1c63[_0x493f('0x28')]){delete _0x2e1c63[_0x493f('0x28')];}_0x40eb1f['status'](_0x106bfa)[_0x493f('0x29')](_0x2e1c63);};}exports[_0x493f('0x2a')]=function(_0x2e43ea,_0x503d0f){var _0x24f3b2={},_0x15e0df={},_0x1e7373={'count':0x0,'rows':[]};var _0x1e2acd=_[_0x493f('0x2b')](db[_0x493f('0x2c')][_0x493f('0x2d')],function(_0x115653){return{'name':_0x115653[_0x493f('0x2e')],'type':_0x115653[_0x493f('0x2f')][_0x493f('0x30')]};});_0x15e0df[_0x493f('0x31')]=_[_0x493f('0x2b')](_0x1e2acd,_0x493f('0x28'));_0x15e0df[_0x493f('0x32')]=_[_0x493f('0x33')](_0x2e43ea[_0x493f('0x32')]);_0x15e0df[_0x493f('0x34')]=_[_0x493f('0x35')](_0x15e0df[_0x493f('0x31')],_0x15e0df[_0x493f('0x32')]);_0x24f3b2['attributes']=_[_0x493f('0x35')](_0x15e0df[_0x493f('0x31')],qs['fields'](_0x2e43ea[_0x493f('0x32')][_0x493f('0x36')]));_0x24f3b2[_0x493f('0x37')]=_0x24f3b2['attributes'][_0x493f('0x38')]?_0x24f3b2[_0x493f('0x37')]:_0x15e0df[_0x493f('0x31')];if(!_0x2e43ea[_0x493f('0x32')]['hasOwnProperty'](_0x493f('0x39'))){_0x24f3b2[_0x493f('0x1c')]=qs[_0x493f('0x1c')](_0x2e43ea[_0x493f('0x32')][_0x493f('0x1c')]);_0x24f3b2['offset']=qs['offset'](_0x2e43ea['query']['offset']);}_0x24f3b2[_0x493f('0x3a')]=qs[_0x493f('0x3b')](_0x2e43ea[_0x493f('0x32')][_0x493f('0x3b')]);_0x24f3b2[_0x493f('0x3c')]=qs['filters'](_[_0x493f('0x3d')](_0x2e43ea[_0x493f('0x32')],_0x15e0df[_0x493f('0x34')]),_0x1e2acd);if(_0x2e43ea[_0x493f('0x32')][_0x493f('0x3e')]){_0x24f3b2['where']=_[_0x493f('0x3f')](_0x24f3b2[_0x493f('0x3c')],{'$or':_[_0x493f('0x2b')](_0x1e2acd,function(_0x259659){if(_0x259659['type']!==_0x493f('0x40')){var _0x26fc11={};_0x26fc11[_0x259659['name']]={'$like':'%'+_0x2e43ea[_0x493f('0x32')][_0x493f('0x3e')]+'%'};return _0x26fc11;}})});}_0x24f3b2=_[_0x493f('0x3f')]({},_0x24f3b2,_0x2e43ea['options']);var _0x2c5ede={'where':_0x24f3b2['where']};return db['OpenchannelTransferReport'][_0x493f('0x1b')](_0x2c5ede)[_0x493f('0x23')](function(_0x2434d4){_0x1e7373[_0x493f('0x1b')]=_0x2434d4;if(_0x2e43ea[_0x493f('0x32')][_0x493f('0x41')]){_0x24f3b2[_0x493f('0x42')]=[{'all':!![]}];}return db[_0x493f('0x2c')]['findAll'](_0x24f3b2);})['then'](function(_0x35da64){_0x1e7373[_0x493f('0x43')]=_0x35da64;return _0x1e7373;})[_0x493f('0x23')](respondWithFilteredResult(_0x503d0f,_0x24f3b2))[_0x493f('0x44')](handleError(_0x503d0f,null));};exports[_0x493f('0x45')]=function(_0x51de80,_0x5a7c02){var _0x20ac8c={'raw':!![],'where':{'id':_0x51de80[_0x493f('0x46')]['id']}},_0x275fa0={};_0x275fa0['model']=_[_0x493f('0x33')](db[_0x493f('0x2c')][_0x493f('0x2d')]);_0x275fa0[_0x493f('0x32')]=_[_0x493f('0x33')](_0x51de80[_0x493f('0x32')]);_0x275fa0[_0x493f('0x34')]=_[_0x493f('0x35')](_0x275fa0[_0x493f('0x31')],_0x275fa0[_0x493f('0x32')]);_0x20ac8c[_0x493f('0x37')]=_[_0x493f('0x35')](_0x275fa0[_0x493f('0x31')],qs[_0x493f('0x36')](_0x51de80[_0x493f('0x32')]['fields']));_0x20ac8c[_0x493f('0x37')]=_0x20ac8c[_0x493f('0x37')]['length']?_0x20ac8c['attributes']:_0x275fa0[_0x493f('0x31')];if(_0x51de80['query'][_0x493f('0x41')]){_0x20ac8c[_0x493f('0x42')]=[{'all':!![]}];}_0x20ac8c=_[_0x493f('0x3f')]({},_0x20ac8c,_0x51de80['options']);return db[_0x493f('0x2c')][_0x493f('0x47')](_0x20ac8c)[_0x493f('0x23')](handleEntityNotFound(_0x5a7c02,null))[_0x493f('0x23')](respondWithResult(_0x5a7c02,null))[_0x493f('0x44')](handleError(_0x5a7c02,null));};exports[_0x493f('0x48')]=function(_0x4ff974,_0x43c772){return db[_0x493f('0x2c')][_0x493f('0x48')](_0x4ff974['body'],{})[_0x493f('0x23')](respondWithResult(_0x43c772,0xc9))[_0x493f('0x44')](handleError(_0x43c772,null));};exports[_0x493f('0x22')]=function(_0x756765,_0x452e1d){if(_0x756765[_0x493f('0x49')]['id']){delete _0x756765[_0x493f('0x49')]['id'];}return db[_0x493f('0x2c')][_0x493f('0x47')]({'where':{'id':_0x756765['params']['id']}})[_0x493f('0x23')](handleEntityNotFound(_0x452e1d,null))['then'](saveUpdates(_0x756765['body'],null))[_0x493f('0x23')](respondWithResult(_0x452e1d,null))[_0x493f('0x44')](handleError(_0x452e1d,null));};exports[_0x493f('0x24')]=function(_0x5ce1e3,_0x1f242b){return db[_0x493f('0x2c')][_0x493f('0x47')]({'where':{'id':_0x5ce1e3[_0x493f('0x46')]['id']}})[_0x493f('0x23')](handleEntityNotFound(_0x1f242b,null))['then'](removeEntity(_0x1f242b,null))[_0x493f('0x44')](handleError(_0x1f242b,null));};exports['describe']=function(_0x8a457b,_0x31b4aa){return db[_0x493f('0x2c')]['describe']()['then'](respondWithResult(_0x31b4aa,null))[_0x493f('0x44')](handleError(_0x31b4aa,null));}; \ No newline at end of file +var _0x4763=['create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4763,0x9f));var _0x3476=function(_0x59c343,_0x24eb10){_0x59c343=_0x59c343-0x0;var _0x6a2d88=_0x4763[_0x59c343];return _0x6a2d88;};'use strict';var emlformat=require(_0x3476('0x0'));var rimraf=require(_0x3476('0x1'));var zipdir=require(_0x3476('0x2'));var jsonpatch=require(_0x3476('0x3'));var rp=require('request-promise');var moment=require(_0x3476('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3476('0x5'));var util=require(_0x3476('0x6'));var path=require(_0x3476('0x7'));var sox=require(_0x3476('0x8'));var csv=require(_0x3476('0x9'));var ejs=require(_0x3476('0xa'));var fs=require('fs');var fs_extra=require(_0x3476('0xb'));var _=require('lodash');var squel=require(_0x3476('0xc'));var crypto=require(_0x3476('0xd'));var jsforce=require(_0x3476('0xe'));var deskjs=require(_0x3476('0xf'));var toCsv=require(_0x3476('0x9'));var querystring=require(_0x3476('0x10'));var Papa=require(_0x3476('0x11'));var Redis=require('ioredis');var authService=require(_0x3476('0x12'));var qs=require(_0x3476('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3476('0x14'));var logger=require(_0x3476('0x15'))(_0x3476('0x16'));var utils=require('../../config/utils');var config=require(_0x3476('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3476('0x18'))['db'];function respondWithStatusCode(_0x34cc7f,_0xd04046){_0xd04046=_0xd04046||0xcc;return function(_0x29be0e){if(_0x29be0e){return _0x34cc7f['sendStatus'](_0xd04046);}return _0x34cc7f['status'](_0xd04046)[_0x3476('0x19')]();};}function respondWithResult(_0x4b74d1,_0x3b40e0){_0x3b40e0=_0x3b40e0||0xc8;return function(_0x17a72b){if(_0x17a72b){return _0x4b74d1[_0x3476('0x1a')](_0x3b40e0)['json'](_0x17a72b);}};}function respondWithFilteredResult(_0xef75cf,_0x619ab3){return function(_0x476aeb){if(_0x476aeb){var _0x29c650=typeof _0x619ab3[_0x3476('0x1b')]===_0x3476('0x1c')&&typeof _0x619ab3['limit']===_0x3476('0x1c');var _0x409805=_0x476aeb[_0x3476('0x1d')];var _0x55588d=_0x29c650?0x0:_0x619ab3['offset'];var _0x591e2a=_0x29c650?_0x476aeb[_0x3476('0x1d')]:_0x619ab3[_0x3476('0x1b')]+_0x619ab3[_0x3476('0x1e')];var _0x1880b2;if(_0x591e2a>=_0x409805){_0x591e2a=_0x409805;_0x1880b2=0xc8;}else{_0x1880b2=0xce;}_0xef75cf[_0x3476('0x1a')](_0x1880b2);return _0xef75cf[_0x3476('0x1f')](_0x3476('0x20'),_0x55588d+'-'+_0x591e2a+'/'+_0x409805)[_0x3476('0x21')](_0x476aeb);}return null;};}function patchUpdates(_0x177c37){return function(_0x53046f){try{jsonpatch[_0x3476('0x22')](_0x53046f,_0x177c37,!![]);}catch(_0x37dbbc){return BPromise['reject'](_0x37dbbc);}return _0x53046f[_0x3476('0x23')]();};}function saveUpdates(_0x498844,_0x43ff6b){return function(_0x3278f7){if(_0x3278f7){return _0x3278f7[_0x3476('0x24')](_0x498844)[_0x3476('0x25')](function(_0x5899cd){return _0x5899cd;});}return null;};}function removeEntity(_0x1b4d5f,_0x4248c0){return function(_0x4f9c0c){if(_0x4f9c0c){return _0x4f9c0c['destroy']()['then'](function(){_0x1b4d5f[_0x3476('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bfdba,_0x13a831){return function(_0x3cef22){if(!_0x3cef22){_0x3bfdba[_0x3476('0x26')](0x194);}return _0x3cef22;};}function handleError(_0x4c032d,_0x1bdadd){_0x1bdadd=_0x1bdadd||0x1f4;return function(_0x4d3214){logger[_0x3476('0x27')](_0x4d3214[_0x3476('0x28')]);if(_0x4d3214[_0x3476('0x29')]){delete _0x4d3214[_0x3476('0x29')];}_0x4c032d['status'](_0x1bdadd)[_0x3476('0x2a')](_0x4d3214);};}exports['index']=function(_0x4f3942,_0x53cdf3){var _0x4ebbea={},_0x58984a={},_0x356d5b={'count':0x0,'rows':[]};var _0x191180=_[_0x3476('0x2b')](db['OpenchannelTransferReport'][_0x3476('0x2c')],function(_0x4d7c25){return{'name':_0x4d7c25[_0x3476('0x2d')],'type':_0x4d7c25[_0x3476('0x2e')]['key']};});_0x58984a[_0x3476('0x2f')]=_[_0x3476('0x2b')](_0x191180,'name');_0x58984a[_0x3476('0x30')]=_[_0x3476('0x31')](_0x4f3942[_0x3476('0x30')]);_0x58984a[_0x3476('0x32')]=_[_0x3476('0x33')](_0x58984a[_0x3476('0x2f')],_0x58984a[_0x3476('0x30')]);_0x4ebbea[_0x3476('0x34')]=_['intersection'](_0x58984a[_0x3476('0x2f')],qs['fields'](_0x4f3942[_0x3476('0x30')][_0x3476('0x35')]));_0x4ebbea[_0x3476('0x34')]=_0x4ebbea['attributes']['length']?_0x4ebbea[_0x3476('0x34')]:_0x58984a[_0x3476('0x2f')];if(!_0x4f3942[_0x3476('0x30')][_0x3476('0x36')]('nolimit')){_0x4ebbea['limit']=qs[_0x3476('0x1e')](_0x4f3942[_0x3476('0x30')][_0x3476('0x1e')]);_0x4ebbea[_0x3476('0x1b')]=qs[_0x3476('0x1b')](_0x4f3942[_0x3476('0x30')]['offset']);}_0x4ebbea[_0x3476('0x37')]=qs['sort'](_0x4f3942[_0x3476('0x30')][_0x3476('0x38')]);_0x4ebbea[_0x3476('0x39')]=qs['filters'](_[_0x3476('0x3a')](_0x4f3942['query'],_0x58984a['filters']),_0x191180);if(_0x4f3942[_0x3476('0x30')][_0x3476('0x3b')]){_0x4ebbea['where']=_[_0x3476('0x3c')](_0x4ebbea[_0x3476('0x39')],{'$or':_[_0x3476('0x2b')](_0x191180,function(_0x22bd4a){if(_0x22bd4a[_0x3476('0x2e')]!==_0x3476('0x3d')){var _0x28bfa9={};_0x28bfa9[_0x22bd4a[_0x3476('0x29')]]={'$like':'%'+_0x4f3942[_0x3476('0x30')][_0x3476('0x3b')]+'%'};return _0x28bfa9;}})});}_0x4ebbea=_[_0x3476('0x3c')]({},_0x4ebbea,_0x4f3942[_0x3476('0x3e')]);var _0x364c86={'where':_0x4ebbea['where']};return db[_0x3476('0x3f')][_0x3476('0x1d')](_0x364c86)[_0x3476('0x25')](function(_0x5824f7){_0x356d5b['count']=_0x5824f7;if(_0x4f3942[_0x3476('0x30')][_0x3476('0x40')]){_0x4ebbea[_0x3476('0x41')]=[{'all':!![]}];}return db[_0x3476('0x3f')][_0x3476('0x42')](_0x4ebbea);})[_0x3476('0x25')](function(_0x56c8f0){_0x356d5b[_0x3476('0x43')]=_0x56c8f0;return _0x356d5b;})['then'](respondWithFilteredResult(_0x53cdf3,_0x4ebbea))[_0x3476('0x44')](handleError(_0x53cdf3,null));};exports[_0x3476('0x45')]=function(_0x1211da,_0x2be95c){var _0x2586cb={'raw':!![],'where':{'id':_0x1211da[_0x3476('0x46')]['id']}},_0xabede5={};_0xabede5[_0x3476('0x2f')]=_['keys'](db[_0x3476('0x3f')]['rawAttributes']);_0xabede5[_0x3476('0x30')]=_['keys'](_0x1211da[_0x3476('0x30')]);_0xabede5['filters']=_['intersection'](_0xabede5['model'],_0xabede5[_0x3476('0x30')]);_0x2586cb['attributes']=_[_0x3476('0x33')](_0xabede5[_0x3476('0x2f')],qs[_0x3476('0x35')](_0x1211da[_0x3476('0x30')][_0x3476('0x35')]));_0x2586cb['attributes']=_0x2586cb[_0x3476('0x34')][_0x3476('0x47')]?_0x2586cb[_0x3476('0x34')]:_0xabede5[_0x3476('0x2f')];if(_0x1211da[_0x3476('0x30')][_0x3476('0x40')]){_0x2586cb[_0x3476('0x41')]=[{'all':!![]}];}_0x2586cb=_[_0x3476('0x3c')]({},_0x2586cb,_0x1211da[_0x3476('0x3e')]);return db[_0x3476('0x3f')]['find'](_0x2586cb)[_0x3476('0x25')](handleEntityNotFound(_0x2be95c,null))[_0x3476('0x25')](respondWithResult(_0x2be95c,null))[_0x3476('0x44')](handleError(_0x2be95c,null));};exports[_0x3476('0x48')]=function(_0x2fb039,_0x28d033){return db['OpenchannelTransferReport'][_0x3476('0x48')](_0x2fb039['body'],{})['then'](respondWithResult(_0x28d033,0xc9))[_0x3476('0x44')](handleError(_0x28d033,null));};exports['update']=function(_0x587ecd,_0x356f59){if(_0x587ecd[_0x3476('0x49')]['id']){delete _0x587ecd[_0x3476('0x49')]['id'];}return db[_0x3476('0x3f')]['find']({'where':{'id':_0x587ecd[_0x3476('0x46')]['id']}})['then'](handleEntityNotFound(_0x356f59,null))[_0x3476('0x25')](saveUpdates(_0x587ecd[_0x3476('0x49')],null))[_0x3476('0x25')](respondWithResult(_0x356f59,null))[_0x3476('0x44')](handleError(_0x356f59,null));};exports[_0x3476('0x4a')]=function(_0x3e8d15,_0x12917b){return db[_0x3476('0x3f')][_0x3476('0x4b')]({'where':{'id':_0x3e8d15['params']['id']}})[_0x3476('0x25')](handleEntityNotFound(_0x12917b,null))[_0x3476('0x25')](removeEntity(_0x12917b,null))['catch'](handleError(_0x12917b,null));};exports[_0x3476('0x4c')]=function(_0x505b30,_0x120f4f){return db[_0x3476('0x3f')]['describe']()[_0x3476('0x25')](respondWithResult(_0x120f4f,null))['catch'](handleError(_0x120f4f,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d49f295..f1795c8 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 _0xf275=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define'];(function(_0x53aaf8,_0x863bcb){var _0x1fedb1=function(_0x5696f4){while(--_0x5696f4){_0x53aaf8['push'](_0x53aaf8['shift']());}};_0x1fedb1(++_0x863bcb);}(_0xf275,0x1bd));var _0x5f27=function(_0x4cf6b5,_0x544a4a){_0x4cf6b5=_0x4cf6b5-0x0;var _0xb458a4=_0xf275[_0x4cf6b5];return _0xb458a4;};'use strict';var _=require(_0x5f27('0x0'));var util=require('util');var logger=require(_0x5f27('0x1'))(_0x5f27('0x2'));var moment=require(_0x5f27('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f27('0x4'));var fs=require('fs');var path=require(_0x5f27('0x5'));var rimraf=require(_0x5f27('0x6'));var config=require(_0x5f27('0x7'));var attributes=require(_0x5f27('0x8'));module['exports']=function(_0x296602,_0x3ac826){return _0x296602[_0x5f27('0x9')](_0x5f27('0xa'),attributes,{'tableName':_0x5f27('0xb'),'paranoid':![],'indexes':[{'name':_0x5f27('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xee4c=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4cd30d,_0x195136){var _0x2266f1=function(_0xfe90b4){while(--_0xfe90b4){_0x4cd30d['push'](_0x4cd30d['shift']());}};_0x2266f1(++_0x195136);}(_0xee4c,0xda));var _0xcee4=function(_0x2c33ea,_0x529eb2){_0x2c33ea=_0x2c33ea-0x0;var _0x3ccd86=_0xee4c[_0x2c33ea];return _0x3ccd86;};'use strict';var _=require(_0xcee4('0x0'));var util=require(_0xcee4('0x1'));var logger=require('../../config/logger')(_0xcee4('0x2'));var moment=require(_0xcee4('0x3'));var BPromise=require(_0xcee4('0x4'));var rp=require(_0xcee4('0x5'));var fs=require('fs');var path=require(_0xcee4('0x6'));var rimraf=require(_0xcee4('0x7'));var config=require(_0xcee4('0x8'));var attributes=require(_0xcee4('0x9'));module[_0xcee4('0xa')]=function(_0x6dfec9,_0x53d51e){return _0x6dfec9[_0xcee4('0xb')](_0xcee4('0xc'),attributes,{'tableName':_0xcee4('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcee4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index e814449..324adc3 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 _0xf1e1=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4fcc4a,_0x4f8ebe){var _0x219ec3=function(_0x32bbd3){while(--_0x32bbd3){_0x4fcc4a['push'](_0x4fcc4a['shift']());}};_0x219ec3(++_0x4f8ebe);}(_0xf1e1,0x102));var _0x1f1e=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0xf1e1[_0x3c22e0];return _0x215811;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var moment=require(_0x1f1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f1e('0x3'))['db'];var utils=require(_0x1f1e('0x4'));var logger=require(_0x1f1e('0x5'))(_0x1f1e('0x6'));var config=require(_0x1f1e('0x7'));var jayson=require(_0x1f1e('0x8'));var client=jayson[_0x1f1e('0x9')][_0x1f1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db643,_0x38585e,_0x46e32b){return new BPromise(function(_0x3699d2,_0x6ab45b){return client[_0x1f1e('0xb')](_0x1db643,_0x46e32b)['then'](function(_0x44e626){logger[_0x1f1e('0xc')](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));logger[_0x1f1e('0xf')](_0x1f1e('0x10'),_0x38585e,_0x1f1e('0xe'),JSON[_0x1f1e('0x11')](_0x44e626));if(_0x44e626[_0x1f1e('0x12')]){if(_0x44e626['error'][_0x1f1e('0x13')]===0x1f4){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);return _0x6ab45b(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}logger['error'](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')]['message']);return _0x3699d2(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}else{logger['info'](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));_0x3699d2(_0x44e626[_0x1f1e('0x15')][_0x1f1e('0x14')]);}})[_0x1f1e('0x16')](function(_0x3f978f){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x3f978f);_0x6ab45b(_0x3f978f);});});} \ No newline at end of file +var _0xed1f=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3708a7,_0x27910c){var _0x2ce8e7=function(_0x7f3212){while(--_0x7f3212){_0x3708a7['push'](_0x3708a7['shift']());}};_0x2ce8e7(++_0x27910c);}(_0xed1f,0x6a));var _0xfed1=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xed1f[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 396f5f3..370514f 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 _0x0f6f=['isAuthenticated','index','/:id','show','post','create','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x2110d4,_0x20b1d5){var _0x2bcdf6=function(_0x1e9204){while(--_0x1e9204){_0x2110d4['push'](_0x2110d4['shift']());}};_0x2bcdf6(++_0x20b1d5);}(_0x0f6f,0x1c2));var _0xf0f6=function(_0x49ed67,_0x290989){_0x49ed67=_0x49ed67-0x0;var _0x1523d5=_0x0f6f[_0x49ed67];return _0x1523d5;};'use strict';var multer=require(_0xf0f6('0x0'));var util=require(_0xf0f6('0x1'));var path=require('path');var timeout=require(_0xf0f6('0x2'));var express=require(_0xf0f6('0x3'));var router=express[_0xf0f6('0x4')]();var fs_extra=require(_0xf0f6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0f6('0x6'));var config=require(_0xf0f6('0x7'));var controller=require('./pause.controller');router[_0xf0f6('0x8')]('/',auth[_0xf0f6('0x9')](),controller[_0xf0f6('0xa')]);router['get'](_0xf0f6('0xb'),auth['isAuthenticated'](),controller[_0xf0f6('0xc')]);router[_0xf0f6('0xd')]('/',auth['isAuthenticated'](),controller[_0xf0f6('0xe')]);router['put'](_0xf0f6('0xb'),auth[_0xf0f6('0x9')](),controller[_0xf0f6('0xf')]);router[_0xf0f6('0x10')](_0xf0f6('0xb'),auth[_0xf0f6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb1c1=['post','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get','/:id','show'];(function(_0x6161e6,_0x2a785a){var _0x4e64c4=function(_0x300cd3){while(--_0x300cd3){_0x6161e6['push'](_0x6161e6['shift']());}};_0x4e64c4(++_0x2a785a);}(_0xb1c1,0x1c7));var _0x1b1c=function(_0x4edd4b,_0x4a9aab){_0x4edd4b=_0x4edd4b-0x0;var _0x4316cc=_0xb1c1[_0x4edd4b];return _0x4316cc;};'use strict';var multer=require(_0x1b1c('0x0'));var util=require(_0x1b1c('0x1'));var path=require('path');var timeout=require(_0x1b1c('0x2'));var express=require('express');var router=express[_0x1b1c('0x3')]();var fs_extra=require(_0x1b1c('0x4'));var auth=require(_0x1b1c('0x5'));var interaction=require(_0x1b1c('0x6'));var config=require(_0x1b1c('0x7'));var controller=require(_0x1b1c('0x8'));router['get']('/',auth[_0x1b1c('0x9')](),controller['index']);router[_0x1b1c('0xa')](_0x1b1c('0xb'),auth[_0x1b1c('0x9')](),controller[_0x1b1c('0xc')]);router[_0x1b1c('0xd')]('/',auth[_0x1b1c('0x9')](),controller['create']);router[_0x1b1c('0xe')](_0x1b1c('0xb'),auth[_0x1b1c('0x9')](),controller[_0x1b1c('0xf')]);router['delete'](_0x1b1c('0xb'),auth[_0x1b1c('0x9')](),controller[_0x1b1c('0x10')]);module[_0x1b1c('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4280d0d..3a30d9f 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 _0x7d43=['STRING','name','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7d43,0x15a));var _0x37d4=function(_0x2b65df,_0x2c029c){_0x2b65df=_0x2b65df-0x0;var _0xd6c56=_0x7d43[_0x2b65df];return _0xd6c56;};'use strict';var Sequelize=require(_0x37d4('0x0'));module[_0x37d4('0x1')]={'name':{'type':Sequelize[_0x37d4('0x2')],'unique':_0x37d4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x37d4('0x2')]}}; \ No newline at end of file +var _0x6b99=['sequelize','STRING'];(function(_0x3e3fab,_0x47f80e){var _0xc086ee=function(_0x2aa6f5){while(--_0x2aa6f5){_0x3e3fab['push'](_0x3e3fab['shift']());}};_0xc086ee(++_0x47f80e);}(_0x6b99,0xee));var _0x96b9=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x6b99[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require(_0x96b9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x96b9('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 9150453..1c7dab0 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 _0x57c3=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','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','offset','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57c3,0x17d));var _0x357c=function(_0x5b2bd7,_0x34bc30){_0x5b2bd7=_0x5b2bd7-0x0;var _0xfc8ea1=_0x57c3[_0x5b2bd7];return _0xfc8ea1;};'use strict';var emlformat=require(_0x357c('0x0'));var rimraf=require(_0x357c('0x1'));var zipdir=require(_0x357c('0x2'));var jsonpatch=require(_0x357c('0x3'));var rp=require(_0x357c('0x4'));var moment=require(_0x357c('0x5'));var BPromise=require(_0x357c('0x6'));var Mustache=require(_0x357c('0x7'));var util=require(_0x357c('0x8'));var path=require('path');var sox=require(_0x357c('0x9'));var csv=require(_0x357c('0xa'));var ejs=require(_0x357c('0xb'));var fs=require('fs');var fs_extra=require(_0x357c('0xc'));var _=require(_0x357c('0xd'));var squel=require(_0x357c('0xe'));var crypto=require(_0x357c('0xf'));var jsforce=require(_0x357c('0x10'));var deskjs=require(_0x357c('0x11'));var toCsv=require(_0x357c('0xa'));var querystring=require('querystring');var Papa=require(_0x357c('0x12'));var Redis=require(_0x357c('0x13'));var authService=require(_0x357c('0x14'));var qs=require(_0x357c('0x15'));var as=require(_0x357c('0x16'));var hardwareService=require(_0x357c('0x17'));var logger=require(_0x357c('0x18'))(_0x357c('0x19'));var utils=require(_0x357c('0x1a'));var config=require(_0x357c('0x1b'));var licenseUtil=require(_0x357c('0x1c'));var db=require(_0x357c('0x1d'))['db'];function respondWithStatusCode(_0x551bbc,_0x2959fb){_0x2959fb=_0x2959fb||0xcc;return function(_0x3646ec){if(_0x3646ec){return _0x551bbc[_0x357c('0x1e')](_0x2959fb);}return _0x551bbc[_0x357c('0x1f')](_0x2959fb)[_0x357c('0x20')]();};}function respondWithResult(_0x17eb17,_0x50775f){_0x50775f=_0x50775f||0xc8;return function(_0x7990a6){if(_0x7990a6){return _0x17eb17[_0x357c('0x1f')](_0x50775f)[_0x357c('0x21')](_0x7990a6);}};}function respondWithFilteredResult(_0x381b0d,_0x2c66c6){return function(_0x4564ff){if(_0x4564ff){var _0x4fb07b=typeof _0x2c66c6['offset']===_0x357c('0x22')&&typeof _0x2c66c6[_0x357c('0x23')]===_0x357c('0x22');var _0x49c8bc=_0x4564ff[_0x357c('0x24')];var _0xbfc2bf=_0x4fb07b?0x0:_0x2c66c6['offset'];var _0x3ffc5d=_0x4fb07b?_0x4564ff[_0x357c('0x24')]:_0x2c66c6[_0x357c('0x25')]+_0x2c66c6[_0x357c('0x23')];var _0x5859e3;if(_0x3ffc5d>=_0x49c8bc){_0x3ffc5d=_0x49c8bc;_0x5859e3=0xc8;}else{_0x5859e3=0xce;}_0x381b0d[_0x357c('0x1f')](_0x5859e3);return _0x381b0d['set'](_0x357c('0x26'),_0xbfc2bf+'-'+_0x3ffc5d+'/'+_0x49c8bc)[_0x357c('0x21')](_0x4564ff);}return null;};}function patchUpdates(_0x1ec619){return function(_0x3c5921){try{jsonpatch[_0x357c('0x27')](_0x3c5921,_0x1ec619,!![]);}catch(_0xffa91a){return BPromise[_0x357c('0x28')](_0xffa91a);}return _0x3c5921[_0x357c('0x29')]();};}function saveUpdates(_0x113cfd,_0x590365){return function(_0x22d74b){if(_0x22d74b){return _0x22d74b[_0x357c('0x2a')](_0x113cfd)[_0x357c('0x2b')](function(_0x1d8bd6){return _0x1d8bd6;});}return null;};}function removeEntity(_0x3db9b6,_0x27e85d){return function(_0x26ebb4){if(_0x26ebb4){return _0x26ebb4[_0x357c('0x2c')]()[_0x357c('0x2b')](function(){var _0x149225=_0x26ebb4[_0x357c('0x2d')]({'plain':!![]});var _0x83405e=_0x357c('0x2e');return db[_0x357c('0x2f')]['destroy']({'where':{'type':_0x83405e,'resourceId':_0x149225['id']}})['then'](function(){return _0x26ebb4;});})[_0x357c('0x2b')](function(){_0x3db9b6[_0x357c('0x1f')](0xcc)[_0x357c('0x20')]();});}};}function handleEntityNotFound(_0x1a2e28,_0x267fe8){return function(_0xa55a8b){if(!_0xa55a8b){_0x1a2e28[_0x357c('0x1e')](0x194);}return _0xa55a8b;};}function handleError(_0xcac490,_0x4b926f){_0x4b926f=_0x4b926f||0x1f4;return function(_0x387c09){logger[_0x357c('0x30')](_0x387c09[_0x357c('0x31')]);if(_0x387c09[_0x357c('0x32')]){delete _0x387c09[_0x357c('0x32')];}_0xcac490[_0x357c('0x1f')](_0x4b926f)[_0x357c('0x33')](_0x387c09);};}exports['index']=function(_0x2dbfef,_0x72c5fa){var _0x47a456={},_0x3dcc8d={},_0x1464be={'count':0x0,'rows':[]};var _0x1cabf6=_[_0x357c('0x34')](db[_0x357c('0x35')][_0x357c('0x36')],function(_0x42bbdc){return{'name':_0x42bbdc[_0x357c('0x37')],'type':_0x42bbdc[_0x357c('0x38')][_0x357c('0x39')]};});_0x3dcc8d['model']=_[_0x357c('0x34')](_0x1cabf6,_0x357c('0x32'));_0x3dcc8d[_0x357c('0x3a')]=_['keys'](_0x2dbfef[_0x357c('0x3a')]);_0x3dcc8d[_0x357c('0x3b')]=_[_0x357c('0x3c')](_0x3dcc8d[_0x357c('0x3d')],_0x3dcc8d[_0x357c('0x3a')]);_0x47a456['attributes']=_[_0x357c('0x3c')](_0x3dcc8d[_0x357c('0x3d')],qs[_0x357c('0x3e')](_0x2dbfef[_0x357c('0x3a')][_0x357c('0x3e')]));_0x47a456[_0x357c('0x3f')]=_0x47a456[_0x357c('0x3f')][_0x357c('0x40')]?_0x47a456[_0x357c('0x3f')]:_0x3dcc8d['model'];if(!_0x2dbfef[_0x357c('0x3a')]['hasOwnProperty'](_0x357c('0x41'))){_0x47a456[_0x357c('0x23')]=qs[_0x357c('0x23')](_0x2dbfef[_0x357c('0x3a')][_0x357c('0x23')]);_0x47a456[_0x357c('0x25')]=qs[_0x357c('0x25')](_0x2dbfef[_0x357c('0x3a')][_0x357c('0x25')]);}_0x47a456[_0x357c('0x42')]=qs[_0x357c('0x43')](_0x2dbfef[_0x357c('0x3a')][_0x357c('0x43')]);_0x47a456[_0x357c('0x44')]=qs[_0x357c('0x3b')](_[_0x357c('0x45')](_0x2dbfef[_0x357c('0x3a')],_0x3dcc8d[_0x357c('0x3b')]),_0x1cabf6);if(_0x2dbfef[_0x357c('0x3a')][_0x357c('0x46')]){_0x47a456[_0x357c('0x44')]=_[_0x357c('0x47')](_0x47a456[_0x357c('0x44')],{'$or':_[_0x357c('0x34')](_0x1cabf6,function(_0x86f9e6){if(_0x86f9e6[_0x357c('0x38')]!==_0x357c('0x48')){var _0x2a3f80={};_0x2a3f80[_0x86f9e6[_0x357c('0x32')]]={'$like':'%'+_0x2dbfef[_0x357c('0x3a')]['filter']+'%'};return _0x2a3f80;}})});}_0x47a456=_['merge']({},_0x47a456,_0x2dbfef[_0x357c('0x49')]);var _0x32b685={'where':_0x47a456[_0x357c('0x44')]};return db[_0x357c('0x35')][_0x357c('0x24')](_0x32b685)[_0x357c('0x2b')](function(_0x93b6f8){_0x1464be[_0x357c('0x24')]=_0x93b6f8;if(_0x2dbfef[_0x357c('0x3a')][_0x357c('0x4a')]){_0x47a456[_0x357c('0x4b')]=[{'all':!![]}];}return db[_0x357c('0x35')][_0x357c('0x4c')](_0x47a456);})[_0x357c('0x2b')](function(_0x160d91){_0x1464be[_0x357c('0x4d')]=_0x160d91;return _0x1464be;})[_0x357c('0x2b')](respondWithFilteredResult(_0x72c5fa,_0x47a456))[_0x357c('0x4e')](handleError(_0x72c5fa,null));};exports[_0x357c('0x4f')]=function(_0x37d2b6,_0x55e99e){var _0x4cc319={'raw':!![],'where':{'id':_0x37d2b6[_0x357c('0x50')]['id']}},_0x32cae7={};_0x32cae7[_0x357c('0x3d')]=_['keys'](db['Pause'][_0x357c('0x36')]);_0x32cae7[_0x357c('0x3a')]=_['keys'](_0x37d2b6[_0x357c('0x3a')]);_0x32cae7[_0x357c('0x3b')]=_['intersection'](_0x32cae7[_0x357c('0x3d')],_0x32cae7[_0x357c('0x3a')]);_0x4cc319['attributes']=_['intersection'](_0x32cae7[_0x357c('0x3d')],qs['fields'](_0x37d2b6[_0x357c('0x3a')][_0x357c('0x3e')]));_0x4cc319['attributes']=_0x4cc319[_0x357c('0x3f')][_0x357c('0x40')]?_0x4cc319[_0x357c('0x3f')]:_0x32cae7['model'];if(_0x37d2b6[_0x357c('0x3a')]['includeAll']){_0x4cc319['include']=[{'all':!![]}];}_0x4cc319=_[_0x357c('0x47')]({},_0x4cc319,_0x37d2b6[_0x357c('0x49')]);return db[_0x357c('0x35')][_0x357c('0x51')](_0x4cc319)[_0x357c('0x2b')](handleEntityNotFound(_0x55e99e,null))['then'](respondWithResult(_0x55e99e,null))['catch'](handleError(_0x55e99e,null));};exports[_0x357c('0x52')]=function(_0x5e1c10,_0x406b25){return db[_0x357c('0x35')][_0x357c('0x52')](_0x5e1c10[_0x357c('0x53')],{})[_0x357c('0x2b')](function(_0x3ba432){var _0x23bb22=_0x5e1c10[_0x357c('0x54')][_0x357c('0x2d')]({'plain':!![]});if(!_0x23bb22)throw new Error(_0x357c('0x55'));if(_0x23bb22[_0x357c('0x56')]===_0x357c('0x54')){var _0x4ef8be=_0x3ba432[_0x357c('0x2d')]({'plain':!![]});var _0x1a2cf8=_0x357c('0x2e');return db[_0x357c('0x57')]['find']({'where':{'name':_0x1a2cf8,'userProfileId':_0x23bb22[_0x357c('0x58')]},'raw':!![]})[_0x357c('0x2b')](function(_0x407fb4){if(_0x407fb4&&_0x407fb4[_0x357c('0x59')]===0x0){return db['UserProfileResource'][_0x357c('0x52')]({'name':_0x4ef8be[_0x357c('0x32')],'resourceId':_0x4ef8be['id'],'type':_0x407fb4[_0x357c('0x32')],'sectionId':_0x407fb4['id']},{})[_0x357c('0x2b')](function(){return _0x3ba432;});}else{return _0x3ba432;}})[_0x357c('0x4e')](function(_0xc01700){logger[_0x357c('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc01700);throw _0xc01700;});}return _0x3ba432;})[_0x357c('0x2b')](respondWithResult(_0x406b25,0xc9))[_0x357c('0x4e')](handleError(_0x406b25,null));};exports[_0x357c('0x2a')]=function(_0x478630,_0x1a9621){if(_0x478630['body']['id']){delete _0x478630['body']['id'];}return db[_0x357c('0x35')][_0x357c('0x51')]({'where':{'id':_0x478630[_0x357c('0x50')]['id']}})[_0x357c('0x2b')](handleEntityNotFound(_0x1a9621,null))[_0x357c('0x2b')](saveUpdates(_0x478630[_0x357c('0x53')],null))[_0x357c('0x2b')](respondWithResult(_0x1a9621,null))[_0x357c('0x4e')](handleError(_0x1a9621,null));};exports[_0x357c('0x2c')]=function(_0x9b8e4e,_0x318719){return db[_0x357c('0x35')]['find']({'where':{'id':_0x9b8e4e[_0x357c('0x50')]['id']}})[_0x357c('0x2b')](handleEntityNotFound(_0x318719,null))['then'](removeEntity(_0x318719,null))[_0x357c('0x4e')](handleError(_0x318719,null));}; \ No newline at end of file +var _0x3609=['error','stack','name','index','map','Pause','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','params','keys','includeAll','options','create','body','user','role','find','userProfileId','autoAssociation','eml-format','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','get','Pauses','UserProfileResource'];(function(_0x33f367,_0xa6ca40){var _0x133900=function(_0x2c9f47){while(--_0x2c9f47){_0x33f367['push'](_0x33f367['shift']());}};_0x133900(++_0xa6ca40);}(_0x3609,0x1a7));var _0x9360=function(_0x4f0a99,_0x48f06a){_0x4f0a99=_0x4f0a99-0x0;var _0x7e813e=_0x3609[_0x4f0a99];return _0x7e813e;};'use strict';var emlformat=require(_0x9360('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9360('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9360('0x2'));var util=require(_0x9360('0x3'));var path=require(_0x9360('0x4'));var sox=require(_0x9360('0x5'));var csv=require(_0x9360('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9360('0x7'));var _=require(_0x9360('0x8'));var squel=require(_0x9360('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9360('0xa'));var toCsv=require(_0x9360('0x6'));var querystring=require(_0x9360('0xb'));var Papa=require(_0x9360('0xc'));var Redis=require(_0x9360('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9360('0xe'));var as=require(_0x9360('0xf'));var hardwareService=require(_0x9360('0x10'));var logger=require(_0x9360('0x11'))(_0x9360('0x12'));var utils=require(_0x9360('0x13'));var config=require(_0x9360('0x14'));var licenseUtil=require(_0x9360('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aa8ae,_0x1f5cf5){_0x1f5cf5=_0x1f5cf5||0xcc;return function(_0x16203e){if(_0x16203e){return _0x3aa8ae[_0x9360('0x16')](_0x1f5cf5);}return _0x3aa8ae[_0x9360('0x17')](_0x1f5cf5)[_0x9360('0x18')]();};}function respondWithResult(_0x31c55e,_0x5258c7){_0x5258c7=_0x5258c7||0xc8;return function(_0xd236cd){if(_0xd236cd){return _0x31c55e[_0x9360('0x17')](_0x5258c7)['json'](_0xd236cd);}};}function respondWithFilteredResult(_0x34a7e4,_0x2c0ec7){return function(_0x56f68a){if(_0x56f68a){var _0x370ddf=typeof _0x2c0ec7[_0x9360('0x19')]==='undefined'&&typeof _0x2c0ec7[_0x9360('0x1a')]===_0x9360('0x1b');var _0x1c8d68=_0x56f68a[_0x9360('0x1c')];var _0x33f208=_0x370ddf?0x0:_0x2c0ec7['offset'];var _0x2b831c=_0x370ddf?_0x56f68a[_0x9360('0x1c')]:_0x2c0ec7['offset']+_0x2c0ec7['limit'];var _0x640039;if(_0x2b831c>=_0x1c8d68){_0x2b831c=_0x1c8d68;_0x640039=0xc8;}else{_0x640039=0xce;}_0x34a7e4[_0x9360('0x17')](_0x640039);return _0x34a7e4['set'](_0x9360('0x1d'),_0x33f208+'-'+_0x2b831c+'/'+_0x1c8d68)[_0x9360('0x1e')](_0x56f68a);}return null;};}function patchUpdates(_0xa770ff){return function(_0x3fe6a1){try{jsonpatch['apply'](_0x3fe6a1,_0xa770ff,!![]);}catch(_0x4248b1){return BPromise[_0x9360('0x1f')](_0x4248b1);}return _0x3fe6a1[_0x9360('0x20')]();};}function saveUpdates(_0x208598,_0x33336b){return function(_0x425cbd){if(_0x425cbd){return _0x425cbd[_0x9360('0x21')](_0x208598)[_0x9360('0x22')](function(_0x3f422a){return _0x3f422a;});}return null;};}function removeEntity(_0x4845fa,_0x363a4a){return function(_0x1d21ee){if(_0x1d21ee){return _0x1d21ee[_0x9360('0x23')]()[_0x9360('0x22')](function(){var _0x3d575b=_0x1d21ee[_0x9360('0x24')]({'plain':!![]});var _0x4bd97c=_0x9360('0x25');return db[_0x9360('0x26')]['destroy']({'where':{'type':_0x4bd97c,'resourceId':_0x3d575b['id']}})[_0x9360('0x22')](function(){return _0x1d21ee;});})['then'](function(){_0x4845fa[_0x9360('0x17')](0xcc)[_0x9360('0x18')]();});}};}function handleEntityNotFound(_0x4b796c,_0x19b74a){return function(_0x5ef47e){if(!_0x5ef47e){_0x4b796c[_0x9360('0x16')](0x194);}return _0x5ef47e;};}function handleError(_0x50a371,_0x31ad3e){_0x31ad3e=_0x31ad3e||0x1f4;return function(_0x192145){logger[_0x9360('0x27')](_0x192145[_0x9360('0x28')]);if(_0x192145[_0x9360('0x29')]){delete _0x192145[_0x9360('0x29')];}_0x50a371[_0x9360('0x17')](_0x31ad3e)['send'](_0x192145);};}exports[_0x9360('0x2a')]=function(_0x174a2c,_0x52d14a){var _0x1d2288={},_0x1be5f7={},_0x70d181={'count':0x0,'rows':[]};var _0x2cb173=_[_0x9360('0x2b')](db[_0x9360('0x2c')][_0x9360('0x2d')],function(_0x4825da){return{'name':_0x4825da['fieldName'],'type':_0x4825da[_0x9360('0x2e')]['key']};});_0x1be5f7[_0x9360('0x2f')]=_[_0x9360('0x2b')](_0x2cb173,_0x9360('0x29'));_0x1be5f7[_0x9360('0x30')]=_['keys'](_0x174a2c[_0x9360('0x30')]);_0x1be5f7[_0x9360('0x31')]=_[_0x9360('0x32')](_0x1be5f7['model'],_0x1be5f7['query']);_0x1d2288[_0x9360('0x33')]=_[_0x9360('0x32')](_0x1be5f7[_0x9360('0x2f')],qs[_0x9360('0x34')](_0x174a2c[_0x9360('0x30')][_0x9360('0x34')]));_0x1d2288['attributes']=_0x1d2288[_0x9360('0x33')][_0x9360('0x35')]?_0x1d2288[_0x9360('0x33')]:_0x1be5f7[_0x9360('0x2f')];if(!_0x174a2c[_0x9360('0x30')][_0x9360('0x36')](_0x9360('0x37'))){_0x1d2288[_0x9360('0x1a')]=qs[_0x9360('0x1a')](_0x174a2c['query'][_0x9360('0x1a')]);_0x1d2288['offset']=qs[_0x9360('0x19')](_0x174a2c[_0x9360('0x30')][_0x9360('0x19')]);}_0x1d2288[_0x9360('0x38')]=qs[_0x9360('0x39')](_0x174a2c[_0x9360('0x30')][_0x9360('0x39')]);_0x1d2288[_0x9360('0x3a')]=qs[_0x9360('0x31')](_['pick'](_0x174a2c[_0x9360('0x30')],_0x1be5f7[_0x9360('0x31')]),_0x2cb173);if(_0x174a2c[_0x9360('0x30')][_0x9360('0x3b')]){_0x1d2288['where']=_[_0x9360('0x3c')](_0x1d2288[_0x9360('0x3a')],{'$or':_[_0x9360('0x2b')](_0x2cb173,function(_0x167656){if(_0x167656[_0x9360('0x2e')]!==_0x9360('0x3d')){var _0x45a422={};_0x45a422[_0x167656['name']]={'$like':'%'+_0x174a2c[_0x9360('0x30')][_0x9360('0x3b')]+'%'};return _0x45a422;}})});}_0x1d2288=_[_0x9360('0x3c')]({},_0x1d2288,_0x174a2c['options']);var _0x5be302={'where':_0x1d2288[_0x9360('0x3a')]};return db[_0x9360('0x2c')][_0x9360('0x1c')](_0x5be302)[_0x9360('0x22')](function(_0x202baf){_0x70d181[_0x9360('0x1c')]=_0x202baf;if(_0x174a2c[_0x9360('0x30')]['includeAll']){_0x1d2288[_0x9360('0x3e')]=[{'all':!![]}];}return db[_0x9360('0x2c')][_0x9360('0x3f')](_0x1d2288);})[_0x9360('0x22')](function(_0xf691fd){_0x70d181[_0x9360('0x40')]=_0xf691fd;return _0x70d181;})[_0x9360('0x22')](respondWithFilteredResult(_0x52d14a,_0x1d2288))[_0x9360('0x41')](handleError(_0x52d14a,null));};exports['show']=function(_0x48b17e,_0xf6485f){var _0x35bd14={'raw':!![],'where':{'id':_0x48b17e[_0x9360('0x42')]['id']}},_0x3ff43b={};_0x3ff43b['model']=_[_0x9360('0x43')](db['Pause']['rawAttributes']);_0x3ff43b[_0x9360('0x30')]=_[_0x9360('0x43')](_0x48b17e[_0x9360('0x30')]);_0x3ff43b[_0x9360('0x31')]=_[_0x9360('0x32')](_0x3ff43b['model'],_0x3ff43b['query']);_0x35bd14[_0x9360('0x33')]=_['intersection'](_0x3ff43b[_0x9360('0x2f')],qs[_0x9360('0x34')](_0x48b17e['query'][_0x9360('0x34')]));_0x35bd14[_0x9360('0x33')]=_0x35bd14[_0x9360('0x33')]['length']?_0x35bd14[_0x9360('0x33')]:_0x3ff43b[_0x9360('0x2f')];if(_0x48b17e[_0x9360('0x30')][_0x9360('0x44')]){_0x35bd14[_0x9360('0x3e')]=[{'all':!![]}];}_0x35bd14=_['merge']({},_0x35bd14,_0x48b17e[_0x9360('0x45')]);return db[_0x9360('0x2c')]['find'](_0x35bd14)['then'](handleEntityNotFound(_0xf6485f,null))[_0x9360('0x22')](respondWithResult(_0xf6485f,null))[_0x9360('0x41')](handleError(_0xf6485f,null));};exports[_0x9360('0x46')]=function(_0x5325e2,_0x274543){return db[_0x9360('0x2c')]['create'](_0x5325e2[_0x9360('0x47')],{})['then'](function(_0x3a0f4a){var _0x1fba93=_0x5325e2[_0x9360('0x48')][_0x9360('0x24')]({'plain':!![]});if(!_0x1fba93)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fba93[_0x9360('0x49')]===_0x9360('0x48')){var _0x2ffa03=_0x3a0f4a[_0x9360('0x24')]({'plain':!![]});var _0x2f24ce='Pauses';return db['UserProfileSection'][_0x9360('0x4a')]({'where':{'name':_0x2f24ce,'userProfileId':_0x1fba93[_0x9360('0x4b')]},'raw':!![]})[_0x9360('0x22')](function(_0x33b74c){if(_0x33b74c&&_0x33b74c[_0x9360('0x4c')]===0x0){return db[_0x9360('0x26')]['create']({'name':_0x2ffa03[_0x9360('0x29')],'resourceId':_0x2ffa03['id'],'type':_0x33b74c['name'],'sectionId':_0x33b74c['id']},{})['then'](function(){return _0x3a0f4a;});}else{return _0x3a0f4a;}})[_0x9360('0x41')](function(_0x5678ee){logger[_0x9360('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5678ee);throw _0x5678ee;});}return _0x3a0f4a;})['then'](respondWithResult(_0x274543,0xc9))[_0x9360('0x41')](handleError(_0x274543,null));};exports[_0x9360('0x21')]=function(_0x5e7538,_0xbf6257){if(_0x5e7538[_0x9360('0x47')]['id']){delete _0x5e7538['body']['id'];}return db[_0x9360('0x2c')][_0x9360('0x4a')]({'where':{'id':_0x5e7538['params']['id']}})[_0x9360('0x22')](handleEntityNotFound(_0xbf6257,null))[_0x9360('0x22')](saveUpdates(_0x5e7538[_0x9360('0x47')],null))[_0x9360('0x22')](respondWithResult(_0xbf6257,null))[_0x9360('0x41')](handleError(_0xbf6257,null));};exports[_0x9360('0x23')]=function(_0x40e4ca,_0x5230dd){return db[_0x9360('0x2c')]['find']({'where':{'id':_0x40e4ca[_0x9360('0x42')]['id']}})[_0x9360('0x22')](handleEntityNotFound(_0x5230dd,null))['then'](removeEntity(_0x5230dd,null))[_0x9360('0x41')](handleError(_0x5230dd,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f3aac14..669ce56 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x3e1c04,_0x38885e){var _0x451afd=function(_0x5bf98a){while(--_0x5bf98a){_0x3e1c04['push'](_0x3e1c04['shift']());}};_0x451afd(++_0x38885e);}(_0xe14b,0x93));var _0xbe14=function(_0x45b2b5,_0x273192){_0x45b2b5=_0x45b2b5-0x0;var _0x1fd982=_0xe14b[_0x45b2b5];return _0x1fd982;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4dd954,_0x1e08f4){var _0x169234=function(_0x12ad5a){while(--_0x12ad5a){_0x4dd954['push'](_0x4dd954['shift']());}};_0x169234(++_0x1e08f4);}(_0x326f,0xd1));var _0xf326=function(_0x5a27cd,_0x3e3421){_0x5a27cd=_0x5a27cd-0x0;var _0x38584d=_0x326f[_0x5a27cd];return _0x38584d;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e6d31b8..ccf80d4 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x53aa6d,_0x2d2714){var _0x2ce081=function(_0x1618e6){while(--_0x1618e6){_0x53aa6d['push'](_0x53aa6d['shift']());}};_0x2ce081(++_0x2d2714);}(_0x7a54,0x106));var _0x47a5=function(_0x37d9a3,_0x5e8641){_0x37d9a3=_0x37d9a3-0x0;var _0x5b4dd3=_0x7a54[_0x37d9a3];return _0x5b4dd3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x52094c,_0x33f353){var _0x45b09a=function(_0xb3a3e7){while(--_0xb3a3e7){_0x52094c['push'](_0x52094c['shift']());}};_0x45b09a(++_0x33f353);}(_0x7a54,0x106));var _0x47a5=function(_0x1ad27f,_0x22ee72){_0x1ad27f=_0x1ad27f-0x0;var _0x3340dc=_0x7a54[_0x1ad27f];return _0x3340dc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 0d0051a..24ca37f 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 _0x8d0e=['basename','extname','now','post','file','upload','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','join','root','server/files/plugins','originalname','replace'];(function(_0x213e2d,_0x47b0c2){var _0x468668=function(_0x5b760c){while(--_0x5b760c){_0x213e2d['push'](_0x213e2d['shift']());}};_0x468668(++_0x47b0c2);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x27822c,_0x11f904){_0x27822c=_0x27822c-0x0;var _0x314cce=_0x8d0e[_0x27822c];return _0x314cce;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xb')](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x10')]);router['get'](_0xe8d0('0x11'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x580aab,_0x42e0c2,_0x25e6b8){_0x25e6b8(null,path[_0xe8d0('0x13')](config[_0xe8d0('0x14')],_0xe8d0('0x15')));},'filename':function(_0x41de69,_0x5934b2,_0x38fac0){_0x5934b2[_0xe8d0('0x16')]=_0x5934b2['originalname'][_0xe8d0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38fac0(null,util['format']('%s-%s%s',path[_0xe8d0('0x18')](_0x5934b2[_0xe8d0('0x16')],path[_0xe8d0('0x19')](_0x5934b2[_0xe8d0('0x16')])),Date[_0xe8d0('0x1a')](),path[_0xe8d0('0x19')](_0x5934b2['originalname'])));}})});router[_0xe8d0('0x1b')]('/',upload['single'](_0xe8d0('0x1c')),controller[_0xe8d0('0x1d')]);router[_0xe8d0('0x1b')]('/webhook',controller['webhookPost']);router['put'](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x1e')]);router[_0xe8d0('0x1f')](_0xe8d0('0xe'),auth['isAuthenticated'](),controller[_0xe8d0('0x1f')]);module[_0xe8d0('0x20')]=router; \ No newline at end of file +var _0x34e5=['%s-%s%s','basename','extname','now','post','upload','webhookPost','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','/:id/download','download','root','server/files/plugins','originalname','replace','format'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x34e5,0x172));var _0x534e=function(_0x3836a6,_0x524647){_0x3836a6=_0x3836a6-0x0;var _0xdaa8f7=_0x34e5[_0x3836a6];return _0xdaa8f7;};'use strict';var multer=require('multer');var util=require(_0x534e('0x0'));var path=require('path');var timeout=require(_0x534e('0x1'));var express=require(_0x534e('0x2'));var router=express[_0x534e('0x3')]();var fs_extra=require(_0x534e('0x4'));var auth=require(_0x534e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x534e('0x6'));var controller=require(_0x534e('0x7'));router[_0x534e('0x8')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xa')]);router[_0x534e('0x8')](_0x534e('0xb'),controller['webhookGet']);router[_0x534e('0x8')](_0x534e('0xc'),auth[_0x534e('0x9')](),controller['show']);router['get'](_0x534e('0xd'),auth['isAuthenticated'](),controller[_0x534e('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb30dd6,_0x310b6d,_0x27561c){_0x27561c(null,path['join'](config[_0x534e('0xf')],_0x534e('0x10')));},'filename':function(_0x73b135,_0x28b8ff,_0x2c4539){_0x28b8ff['originalname']=_0x28b8ff[_0x534e('0x11')][_0x534e('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c4539(null,util[_0x534e('0x13')](_0x534e('0x14'),path[_0x534e('0x15')](_0x28b8ff[_0x534e('0x11')],path[_0x534e('0x16')](_0x28b8ff[_0x534e('0x11')])),Date[_0x534e('0x17')](),path['extname'](_0x28b8ff[_0x534e('0x11')])));}})});router[_0x534e('0x18')]('/',upload['single']('file'),controller[_0x534e('0x19')]);router[_0x534e('0x18')](_0x534e('0xb'),controller[_0x534e('0x1a')]);router[_0x534e('0x1b')](_0x534e('0xc'),auth[_0x534e('0x9')](),controller['update']);router[_0x534e('0x1c')](_0x534e('0xc'),auth[_0x534e('0x9')](),controller[_0x534e('0x1c')]);module[_0x534e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index c430d95..0b287a6 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 _0x0185=['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.','sequelize','exports','STRING','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0x0185,0x164));var _0x5018=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x0185[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x5018('0x0'));module[_0x5018('0x1')]={'name':{'type':Sequelize[_0x5018('0x2')]},'type':{'type':Sequelize[_0x5018('0x3')](_0x5018('0x4'),_0x5018('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x5018('0x2')],'comment':_0x5018('0x6')},'active':{'type':Sequelize[_0x5018('0x7')],'defaultValue':0x0,'comment':_0x5018('0x8')},'sidebar':{'type':Sequelize[_0x5018('0x3')](_0x5018('0x9'),_0x5018('0xa'),_0x5018('0xb'),_0x5018('0xc')),'defaultValue':'always','comment':_0x5018('0xd')},'icon':{'type':Sequelize[_0x5018('0x2')]},'adminUrl':{'type':Sequelize[_0x5018('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x5018('0x2')]},'scriptPath':{'type':Sequelize[_0x5018('0x2')]}}; \ No newline at end of file +var _0xbb6e=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','sequelize','exports','STRING','ENUM','script','TEXT'];(function(_0x29dc38,_0x5651e7){var _0x593e0f=function(_0x50cad0){while(--_0x50cad0){_0x29dc38['push'](_0x29dc38['shift']());}};_0x593e0f(++_0x5651e7);}(_0xbb6e,0xe4));var _0xebb6=function(_0x474c98,_0x397bdb){_0x474c98=_0x474c98-0x0;var _0x2eebd1=_0xbb6e[_0x474c98];return _0x2eebd1;};'use strict';var Sequelize=require(_0xebb6('0x0'));module[_0xebb6('0x1')]={'name':{'type':Sequelize[_0xebb6('0x2')]},'type':{'type':Sequelize[_0xebb6('0x3')]('html',_0xebb6('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xebb6('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0xebb6('0x6')},'active':{'type':Sequelize[_0xebb6('0x7')],'defaultValue':0x0,'comment':_0xebb6('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xebb6('0x9'),_0xebb6('0xa'),_0xebb6('0xb'),_0xebb6('0xc')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xebb6('0x2')]},'adminUrl':{'type':Sequelize[_0xebb6('0x2')]},'agentUrl':{'type':Sequelize[_0xebb6('0x2')]},'scriptName':{'type':Sequelize[_0xebb6('0x2')]},'scriptPath':{'type':Sequelize[_0xebb6('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index b022618..5a7060d 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 _0x099b=['filter','options','includeAll','findAll','catch','show','params','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','attachments/**/*','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','error','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','format','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','port','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','Plugins','UserProfileResource','stack','name','send','index','Plugin','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x099b,0x116));var _0xb099=function(_0x1829d3,_0x24f67f){_0x1829d3=_0x1829d3-0x0;var _0x1b146e=_0x099b[_0x1829d3];return _0x1b146e;};'use strict';var emlformat=require(_0xb099('0x0'));var rimraf=require(_0xb099('0x1'));var zipdir=require(_0xb099('0x2'));var jsonpatch=require(_0xb099('0x3'));var rp=require(_0xb099('0x4'));var moment=require(_0xb099('0x5'));var BPromise=require(_0xb099('0x6'));var Mustache=require(_0xb099('0x7'));var util=require(_0xb099('0x8'));var path=require(_0xb099('0x9'));var sox=require('sox');var csv=require(_0xb099('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb099('0xb'));var _=require(_0xb099('0xc'));var squel=require(_0xb099('0xd'));var crypto=require(_0xb099('0xe'));var jsforce=require(_0xb099('0xf'));var deskjs=require(_0xb099('0x10'));var toCsv=require(_0xb099('0xa'));var querystring=require('querystring');var Papa=require(_0xb099('0x11'));var extract=require(_0xb099('0x12'));var rimraf=require(_0xb099('0x1'));var archiver=require(_0xb099('0x13'));var Redis=require('ioredis');var authService=require(_0xb099('0x14'));var qs=require(_0xb099('0x15'));var as=require(_0xb099('0x16'));var hardwareService=require(_0xb099('0x17'));var logger=require(_0xb099('0x18'))(_0xb099('0x19'));var utils=require(_0xb099('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xb099('0x1b'));var db=require(_0xb099('0x1c'))['db'];config[_0xb099('0x1d')]=_[_0xb099('0x1e')](config[_0xb099('0x1d')],{'host':_0xb099('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb099('0x1d')]));require(_0xb099('0x20'))[_0xb099('0x21')](socket);function respondWithStatusCode(_0x58a6d5,_0x17d53f){_0x17d53f=_0x17d53f||0xcc;return function(_0x432ce7){if(_0x432ce7){return _0x58a6d5[_0xb099('0x22')](_0x17d53f);}return _0x58a6d5[_0xb099('0x23')](_0x17d53f)[_0xb099('0x24')]();};}function respondWithResult(_0x9f0e13,_0x2a8a4d){_0x2a8a4d=_0x2a8a4d||0xc8;return function(_0x22d4f4){if(_0x22d4f4){return _0x9f0e13['status'](_0x2a8a4d)[_0xb099('0x25')](_0x22d4f4);}};}function respondWithFilteredResult(_0x1c41f5,_0x23f077){return function(_0x19fbb4){if(_0x19fbb4){var _0x245afc=typeof _0x23f077[_0xb099('0x26')]===_0xb099('0x27')&&typeof _0x23f077[_0xb099('0x28')]==='undefined';var _0x4821ae=_0x19fbb4[_0xb099('0x29')];var _0x52848b=_0x245afc?0x0:_0x23f077['offset'];var _0x4293eb=_0x245afc?_0x19fbb4[_0xb099('0x29')]:_0x23f077[_0xb099('0x26')]+_0x23f077[_0xb099('0x28')];var _0x321062;if(_0x4293eb>=_0x4821ae){_0x4293eb=_0x4821ae;_0x321062=0xc8;}else{_0x321062=0xce;}_0x1c41f5[_0xb099('0x23')](_0x321062);return _0x1c41f5[_0xb099('0x2a')](_0xb099('0x2b'),_0x52848b+'-'+_0x4293eb+'/'+_0x4821ae)['json'](_0x19fbb4);}return null;};}function patchUpdates(_0xfeabc6){return function(_0x50acac){try{jsonpatch[_0xb099('0x2c')](_0x50acac,_0xfeabc6,!![]);}catch(_0x5e2a27){return BPromise[_0xb099('0x2d')](_0x5e2a27);}return _0x50acac['save']();};}function saveUpdates(_0x5cfd66,_0x4b414c){return function(_0x10f7af){if(_0x10f7af){return _0x10f7af['update'](_0x5cfd66)[_0xb099('0x2e')](function(_0xab61c9){return _0xab61c9;});}return null;};}function removeEntity(_0x246dea,_0x389f94){return function(_0x2a39d4){if(_0x2a39d4){return _0x2a39d4[_0xb099('0x2f')]()['then'](function(){var _0x297ff1=_0x2a39d4[_0xb099('0x30')]({'plain':!![]});var _0x213309=_0xb099('0x31');return db[_0xb099('0x32')]['destroy']({'where':{'type':_0x213309,'resourceId':_0x297ff1['id']}})[_0xb099('0x2e')](function(){return _0x2a39d4;});})[_0xb099('0x2e')](function(){_0x246dea[_0xb099('0x23')](0xcc)[_0xb099('0x24')]();});}};}function handleEntityNotFound(_0x487de6,_0x233420){return function(_0x48913b){if(!_0x48913b){_0x487de6[_0xb099('0x22')](0x194);}return _0x48913b;};}function handleError(_0x3ccd42,_0x1ca4b9){_0x1ca4b9=_0x1ca4b9||0x1f4;return function(_0xeebb87){logger['error'](_0xeebb87[_0xb099('0x33')]);if(_0xeebb87[_0xb099('0x34')]){delete _0xeebb87['name'];}_0x3ccd42[_0xb099('0x23')](_0x1ca4b9)[_0xb099('0x35')](_0xeebb87);};}exports[_0xb099('0x36')]=function(_0x44950f,_0x5a78e6){var _0x2a1a05={},_0x4f1e47={},_0x3a9caf={'count':0x0,'rows':[]};var _0x32b3cc=_['map'](db[_0xb099('0x37')]['rawAttributes'],function(_0x3de397){return{'name':_0x3de397[_0xb099('0x38')],'type':_0x3de397[_0xb099('0x39')][_0xb099('0x3a')]};});_0x4f1e47[_0xb099('0x3b')]=_[_0xb099('0x3c')](_0x32b3cc,_0xb099('0x34'));_0x4f1e47['query']=_[_0xb099('0x3d')](_0x44950f[_0xb099('0x3e')]);_0x4f1e47[_0xb099('0x3f')]=_[_0xb099('0x40')](_0x4f1e47[_0xb099('0x3b')],_0x4f1e47[_0xb099('0x3e')]);_0x2a1a05['attributes']=_['intersection'](_0x4f1e47[_0xb099('0x3b')],qs[_0xb099('0x41')](_0x44950f[_0xb099('0x3e')][_0xb099('0x41')]));_0x2a1a05[_0xb099('0x42')]=_0x2a1a05[_0xb099('0x42')][_0xb099('0x43')]?_0x2a1a05[_0xb099('0x42')]:_0x4f1e47[_0xb099('0x3b')];if(!_0x44950f['query'][_0xb099('0x44')](_0xb099('0x45'))){_0x2a1a05['limit']=qs['limit'](_0x44950f[_0xb099('0x3e')]['limit']);_0x2a1a05[_0xb099('0x26')]=qs[_0xb099('0x26')](_0x44950f['query'][_0xb099('0x26')]);}_0x2a1a05[_0xb099('0x46')]=qs[_0xb099('0x47')](_0x44950f[_0xb099('0x3e')]['sort']);_0x2a1a05['where']=qs[_0xb099('0x3f')](_[_0xb099('0x48')](_0x44950f[_0xb099('0x3e')],_0x4f1e47[_0xb099('0x3f')]),_0x32b3cc);if(_0x44950f['query']['filter']){_0x2a1a05[_0xb099('0x49')]=_[_0xb099('0x4a')](_0x2a1a05[_0xb099('0x49')],{'$or':_['map'](_0x32b3cc,function(_0x85280f){if(_0x85280f['type']!==_0xb099('0x4b')){var _0x1f0e7a={};_0x1f0e7a[_0x85280f[_0xb099('0x34')]]={'$like':'%'+_0x44950f[_0xb099('0x3e')][_0xb099('0x4c')]+'%'};return _0x1f0e7a;}})});}_0x2a1a05=_[_0xb099('0x4a')]({},_0x2a1a05,_0x44950f[_0xb099('0x4d')]);var _0x22ec3d={'where':_0x2a1a05[_0xb099('0x49')]};return db[_0xb099('0x37')][_0xb099('0x29')](_0x22ec3d)['then'](function(_0x114681){_0x3a9caf[_0xb099('0x29')]=_0x114681;if(_0x44950f[_0xb099('0x3e')][_0xb099('0x4e')]){_0x2a1a05['include']=[{'all':!![]}];}return db[_0xb099('0x37')][_0xb099('0x4f')](_0x2a1a05);})[_0xb099('0x2e')](function(_0x421959){_0x3a9caf['rows']=_0x421959;return _0x3a9caf;})[_0xb099('0x2e')](respondWithFilteredResult(_0x5a78e6,_0x2a1a05))[_0xb099('0x50')](handleError(_0x5a78e6,null));};exports[_0xb099('0x51')]=function(_0x2ae61c,_0x33b50e){var _0x45e105={'raw':!![],'where':{'id':_0x2ae61c[_0xb099('0x52')]['id']}},_0x2e482e={};_0x2e482e[_0xb099('0x3b')]=_[_0xb099('0x3d')](db[_0xb099('0x37')]['rawAttributes']);_0x2e482e[_0xb099('0x3e')]=_[_0xb099('0x3d')](_0x2ae61c[_0xb099('0x3e')]);_0x2e482e['filters']=_[_0xb099('0x40')](_0x2e482e[_0xb099('0x3b')],_0x2e482e[_0xb099('0x3e')]);_0x45e105[_0xb099('0x42')]=_[_0xb099('0x40')](_0x2e482e['model'],qs[_0xb099('0x41')](_0x2ae61c[_0xb099('0x3e')][_0xb099('0x41')]));_0x45e105[_0xb099('0x42')]=_0x45e105[_0xb099('0x42')][_0xb099('0x43')]?_0x45e105['attributes']:_0x2e482e[_0xb099('0x3b')];if(_0x2ae61c[_0xb099('0x3e')][_0xb099('0x4e')]){_0x45e105['include']=[{'all':!![]}];}_0x45e105=_['merge']({},_0x45e105,_0x2ae61c[_0xb099('0x4d')]);return db[_0xb099('0x37')][_0xb099('0x53')](_0x45e105)[_0xb099('0x2e')](handleEntityNotFound(_0x33b50e,null))['then'](respondWithResult(_0x33b50e,null))['catch'](handleError(_0x33b50e,null));};exports[_0xb099('0x54')]=function(_0x229c7a,_0x240cc1,_0xf7568b){return db['Plugin']['find']({'where':{'id':_0x229c7a[_0xb099('0x52')]['id']},'attributes':[_0xb099('0x34'),_0xb099('0x9')],'raw':!![]})[_0xb099('0x2e')](handleEntityNotFound(_0x240cc1,null))[_0xb099('0x2e')](function(_0x562cc8){if(_0x562cc8){var _0x531697=path[_0xb099('0x55')](config[_0xb099('0x56')],_0xb099('0x57'),util['format'](_0xb099('0x58'),path[_0xb099('0x59')](_0x562cc8[_0xb099('0x9')])));var _0x37ad3f=fs[_0xb099('0x5a')](_0x531697);var _0x31d301=archiver(_0xb099('0x5b'),{'zlib':{'level':0x9}});_0x31d301['on'](_0xb099('0x5c'),function(_0x4553de){if(_0x4553de[_0xb099('0x5d')]===_0xb099('0x5e')){logger['error'](_0x4553de);}else{throw new db[(_0xb099('0x5f'))][(_0xb099('0x60'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x31d301['on']('error',function(_0x1d3186){throw new db[(_0xb099('0x5f'))][(_0xb099('0x60'))](_0xb099('0x61'));});_0x31d301[_0xb099('0x62')](_0x37ad3f);_0x31d301['glob'](_0xb099('0x63'),{'cwd':path['join'](config[_0xb099('0x56')],'server/files/plugins',path[_0xb099('0x64')](_0x562cc8[_0xb099('0x9')])),'ignore':[path[_0xb099('0x55')](path[_0xb099('0x59')](_0x562cc8['path']),'node_modules/**/*'),path[_0xb099('0x55')](path[_0xb099('0x59')](_0x562cc8[_0xb099('0x9')]),_0xb099('0x65'))],'nodir':!![]})['finalize']();_0x37ad3f['on']('close',function(){if(!fs[_0xb099('0x66')](_0x531697)){throw new db[(_0xb099('0x5f'))][(_0xb099('0x60'))](_0xb099('0x67'));}return _0x240cc1[_0xb099('0x54')](_0x531697,util['format'](_0xb099('0x58'),path['basename'](_0x562cc8['path'])),function(_0x451071){if(_0x451071){throw new db[(_0xb099('0x5f'))][(_0xb099('0x60'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb099('0x68')](_0x531697);logger[_0xb099('0x69')](_0xb099('0x6a'));logger['info'](_0xb099('0x6b'));});});}return null;})['catch'](handleError(_0x240cc1,null));};exports[_0xb099('0x6c')]=function(_0x3d6f4c,_0x58165a,_0x1f5abf){var _0x5007e0=path[_0xb099('0x59')](_0x3d6f4c[_0xb099('0x6d')][_0xb099('0x6e')],path[_0xb099('0x6f')](_0x3d6f4c[_0xb099('0x6d')][_0xb099('0x6e')]));var _0x10fa63=path[_0xb099('0x55')](config[_0xb099('0x56')],_0xb099('0x57'),_0x3d6f4c[_0xb099('0x6d')][_0xb099('0x6e')]);var _0x1b3b0b=path[_0xb099('0x55')](config[_0xb099('0x56')],_0xb099('0x57'),_0x5007e0);logger[_0xb099('0x69')](_0xb099('0x70'),_0x10fa63);logger[_0xb099('0x69')](_0xb099('0x71'),_0x1b3b0b);try{fs[_0xb099('0x72')](_0x10fa63,parseInt(_0xb099('0x73'),0x8));extract(_0x10fa63,{'dir':_0x1b3b0b},function(_0x2cecd2){if(_0x2cecd2){logger['error'](_0x2cecd2);handleError(_0x2cecd2,!![]);};var _0x47aff8=fs[_0xb099('0x74')](_0x1b3b0b);if(_0x47aff8[_0xb099('0x43')]>0x1){removeReferences(_0x10fa63,_0x1b3b0b);logger[_0xb099('0x75')](_0xb099('0x76'));return _0x1f5abf(new Error(_0xb099('0x76')));}var _0x13af27=fs['lstatSync'](path[_0xb099('0x55')](_0x1b3b0b,_0x47aff8[0x0]));if(_0x13af27[_0xb099('0x77')]()){removeReferences(_0x10fa63,_0x1b3b0b);logger[_0xb099('0x75')](_0xb099('0x76'));return _0x1f5abf(new Error('Invalid\x20plugin\x20structure'));}if(_0x13af27[_0xb099('0x78')]()){var _0x1f0367=fs[_0xb099('0x74')](path[_0xb099('0x55')](_0x1b3b0b,_0x47aff8[0x0]));if(_0x1f0367[_0xb099('0x43')]===0x0){removeReferences(_0x10fa63,_0x1b3b0b);logger['error'](_0xb099('0x76'));return _0x1f5abf(new Error(_0xb099('0x76')));}var _0x522689=_0x1f0367[_0xb099('0x79')](function(_0x3e1c7b){return _0x3e1c7b===_0xb099('0x7a');});if(!_0x522689){return _0x1f5abf(new Error(_0xb099('0x7b')));}var _0x456302=fs[_0xb099('0x7c')](path[_0xb099('0x55')](_0x1b3b0b,_0x47aff8[0x0],'manifest.json'));var _0x56c11f=JSON[_0xb099('0x7d')](_0x456302);if(_0xb099('0x27')==typeof _0x56c11f[_0xb099('0x34')]){return _0x1f5abf(new Error(_0xb099('0x7e')));}if('undefined'==typeof _0x56c11f[_0xb099('0x39')]){return _0x1f5abf(new Error(_0xb099('0x7f')));}if('undefined'==typeof _0x56c11f[_0xb099('0x80')]){return _0x1f5abf(new Error(_0xb099('0x81')));}if(_0xb099('0x27')==typeof _0x56c11f['parameters']){return _0x1f5abf(new Error(_0xb099('0x82')));}if(_0x56c11f[_0xb099('0x39')]===_0xb099('0x83')){if(_0xb099('0x27')==typeof _0x56c11f['parameters'][_0xb099('0x84')]){return _0x1f5abf(new Error(_0xb099('0x85')));}if('undefined'==typeof _0x56c11f[_0xb099('0x86')]['views'][_0xb099('0x87')]&&_0xb099('0x27')==typeof _0x56c11f[_0xb099('0x86')][_0xb099('0x84')][_0xb099('0x88')]){return _0x1f5abf(new Error(_0xb099('0x89')));}}else if(_0x56c11f[_0xb099('0x39')]===_0xb099('0x8a')){if(_0xb099('0x27')==typeof _0x56c11f['parameters'][_0xb099('0x8b')]){return _0x1f5abf(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x56c11f['parameters'][_0xb099('0x8c')]){return _0x1f5abf(new Error(_0xb099('0x8d')));}}else{return _0x1f5abf(new Error(_0xb099('0x8e')));}var _0x4fc3a4=_0x56c11f[_0xb099('0x34')];var _0x1e0919=_0x56c11f[_0xb099('0x8f')];var _0x1fe9e4=_0x56c11f[_0xb099('0x39')];var _0x1bf749=_0x56c11f[_0xb099('0x90')]?_0x56c11f[_0xb099('0x90')]:'always';var _0x316172=_0x56c11f[_0xb099('0x91')]?_0x56c11f[_0xb099('0x91')]:_0xb099('0x92');var _0x29d8a0='';var _0x1e2a1c='';var _0x53542d='';var _0x3a272a='';var _0x452a0f=_0x56c11f[_0xb099('0x80')];if(_0x1fe9e4===_0xb099('0x83')){if(_0xb099('0x27')!=typeof _0x56c11f['parameters'][_0xb099('0x84')][_0xb099('0x87')]){var _0x177794=_0x56c11f[_0xb099('0x86')]['views'][_0xb099('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xb099('0x93')](_0x177794)){_0x29d8a0=path['join'](_0xb099('0x94'),_0x5007e0,_0x47aff8[0x0],_0x177794);}else{_0x29d8a0=_0x177794;}}else{logger[_0xb099('0x69')](_0xb099('0x95'));}if('undefined'!=typeof _0x56c11f[_0xb099('0x86')]['views'][_0xb099('0x88')]){var _0x36e5fb=_0x56c11f[_0xb099('0x86')][_0xb099('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xb099('0x93')](_0x36e5fb)){_0x1e2a1c=path[_0xb099('0x55')](_0xb099('0x94'),_0x5007e0,_0x47aff8[0x0],_0x36e5fb);}else{_0x1e2a1c=_0x36e5fb;}}else{logger[_0xb099('0x69')](_0xb099('0x96'));}}else if(_0x1fe9e4===_0xb099('0x8a')){_0x53542d=_0x56c11f['parameters'][_0xb099('0x8b')];_0x3a272a=_0x56c11f['parameters'][_0xb099('0x8c')];if(_0xb099('0x27')!=typeof _0x56c11f[_0xb099('0x86')][_0xb099('0x84')]){if(_0xb099('0x27')!=typeof _0x56c11f['parameters'][_0xb099('0x84')][_0xb099('0x87')]){var _0x177794=_0x56c11f['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xb099('0x93')](_0x177794)){_0x29d8a0=path[_0xb099('0x55')]('plugins',_0x5007e0,_0x47aff8[0x0],_0x177794);}else{_0x29d8a0=_0x177794;}}if(_0xb099('0x27')!=typeof _0x56c11f[_0xb099('0x86')][_0xb099('0x84')][_0xb099('0x88')]){var _0x36e5fb=_0x56c11f[_0xb099('0x86')][_0xb099('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xb099('0x93')](_0x36e5fb)){_0x1e2a1c=path['join']('plugins',_0x5007e0,_0x47aff8[0x0],_0x36e5fb);}else{_0x1e2a1c=_0x36e5fb;}}}}var _0x82e920={'name':_0x4fc3a4,'description':_0x1e0919,'path':path['join'](_0x5007e0,_0x47aff8[0x0]),'type':_0x1fe9e4,'sidebar':_0x1bf749,'icon':_0x316172,'adminUrl':_0x29d8a0,'agentUrl':_0x1e2a1c,'scriptName':_0x53542d,'scriptPath':_0x3a272a,'version':_0x452a0f};removeReferences(_0x10fa63,null);return db[_0xb099('0x37')]['create'](_0x82e920)[_0xb099('0x2e')](function(_0x5bb8f0){var _0x424b30={'role':_0x3d6f4c[_0xb099('0x97')]['role'],'userProfileId':_0x3d6f4c[_0xb099('0x97')][_0xb099('0x98')]};if(!_0x424b30)throw new Error(_0xb099('0x99'));if(_0x424b30['role']===_0xb099('0x9a')){var _0xcf787b=_0x5bb8f0[_0xb099('0x30')]({'plain':!![]});return db['UserProfileSection'][_0xb099('0x53')]({'where':{'name':'Plugins','userProfileId':_0x424b30[_0xb099('0x98')]},'raw':!![]})[_0xb099('0x2e')](function(_0x584548){if(_0x584548&&_0x584548['autoAssociation']===0x0){return db['UserProfileResource'][_0xb099('0x9b')]({'name':_0xcf787b[_0xb099('0x34')],'resourceId':_0xcf787b['id'],'type':_0x584548['name'],'sectionId':_0x584548['id']},{})[_0xb099('0x2e')](function(){return _0x5bb8f0;});}else{return _0x5bb8f0;}})[_0xb099('0x50')](function(_0x30df1d){logger[_0xb099('0x75')](_0xb099('0x9c'),_0x30df1d);throw _0x30df1d;});}return _0x5bb8f0;})[_0xb099('0x2e')](respondWithResult(_0x58165a,null))[_0xb099('0x50')](handleError(_0x58165a,null));}});}catch(_0x3a20b3){_0x58165a['status'](0x1f4)[_0xb099('0x35')](_0x3a20b3);}};function removeReferences(_0x30c6fe,_0x47f70e){try{if(_0x30c6fe){fs[_0xb099('0x68')](_0x30c6fe);logger[_0xb099('0x69')](_0xb099('0x9d'));}if(_0x47f70e){rimraf(_0x47f70e,function(){});logger[_0xb099('0x69')](_0xb099('0x9e'));}}catch(_0x23d11e){logger[_0xb099('0x75')](_0x23d11e);}}exports[_0xb099('0x9f')]=function(_0x25bb0f,_0x2ead90,_0x51514c){return db['Plugin'][_0xb099('0x53')]({'where':{'id':_0x25bb0f[_0xb099('0x52')]['id']}})[_0xb099('0x2e')](handleEntityNotFound(_0x2ead90,null))[_0xb099('0x2e')](saveUpdates(_0x25bb0f[_0xb099('0x97')],null))['then'](respondWithResult(_0x2ead90,null))[_0xb099('0x50')](handleError(_0x2ead90,null));};exports['delete']=function(_0x2c9ff5,_0x14068a,_0x126771){return db[_0xb099('0x37')][_0xb099('0x53')]({'where':{'id':_0x2c9ff5[_0xb099('0x52')]['id']}})[_0xb099('0x2e')](function(_0x17cffa){if(_0x17cffa){return _0x17cffa[_0xb099('0x2f')]();}})['then'](function(_0x174eff){rimraf(path[_0xb099('0x55')](config[_0xb099('0x56')],_0xb099('0x57'),path[_0xb099('0x64')](_0x174eff['path'])),function(){});return _0x174eff;})[_0xb099('0x2e')](handleEntityNotFound(_0x14068a,null))[_0xb099('0x2e')](respondWithStatusCode(_0x14068a,null))['catch'](handleError(_0x14068a,null));};exports[_0xb099('0xa0')]=function(_0xe502dd,_0x59b11e,_0x471791){return BPromise['resolve']()[_0xb099('0x2e')](function(){if(!_0xe502dd[_0xb099('0x3e')][_0xb099('0x9')]){throw new Error(_0xb099('0xa1'));}if(!_0xe502dd[_0xb099('0x3e')]['port']){throw new Error(_0xb099('0xa2'));}var _0x4ddbb4=_0xe502dd[_0xb099('0x3e')][_0xb099('0xa3')]?_0xe502dd[_0xb099('0x3e')][_0xb099('0xa3')]+':'+_0xe502dd[_0xb099('0x3e')]['port']:_0xb099('0xa4')+_0xe502dd[_0xb099('0x3e')]['port'];var _0x502c4f=_0xe502dd[_0xb099('0x3e')][_0xb099('0x25')]?_0xe502dd[_0xb099('0x3e')][_0xb099('0x25')]:!![];var _0x13a3f9=_0xe502dd[_0xb099('0x3e')][_0xb099('0xa5')]?_0xe502dd[_0xb099('0x3e')][_0xb099('0xa5')]:null;var _0x3b83de={'method':_0xe502dd[_0xb099('0xa6')],'uri':util[_0xb099('0xa7')]('%s%s',_0x4ddbb4,_0xe502dd[_0xb099('0x3e')]['path']),'json':_0x502c4f,'resolveWithFullResponse':!![],'encoding':_0x13a3f9,'qs':_0xe502dd['query']};if(_0xe502dd[_0xb099('0xa8')]){_0x3b83de[_0xb099('0xa8')]=_0xe502dd[_0xb099('0xa8')];if(_0x3b83de[_0xb099('0xa8')][_0xb099('0xa9')]){delete _0x3b83de[_0xb099('0xa8')][_0xb099('0xa9')];}}if(_0x3b83de['headers']['content-type']){delete _0x3b83de[_0xb099('0xa8')][_0xb099('0xaa')];}return rp(_0x3b83de);})[_0xb099('0x2e')](function(_0x1243b5){if(_0x1243b5){_0x59b11e[_0xb099('0x2a')](_0x1243b5[_0xb099('0xa8')]);logger[_0xb099('0x69')](_0x1243b5[_0xb099('0x97')]);if(_[_0xb099('0xab')](_0xe502dd[_0xb099('0x3e')][_0xb099('0x9')],_0xb099('0x54'))&&_0x1243b5[_0xb099('0xac')]==0x1f4){return _0x59b11e['sendStatus'](_0x1243b5[_0xb099('0xac')]);}else{return _0x59b11e[_0xb099('0x23')](_0x1243b5[_0xb099('0xac')])['send'](_0x1243b5[_0xb099('0x97')]);}}else{return _0x59b11e['sendStatus'](0xc8);}})['catch'](handleError(_0x59b11e,null));};exports[_0xb099('0xad')]=function(_0x12aacd,_0xeea725,_0x503de1){return BPromise[_0xb099('0xae')]()[_0xb099('0x2e')](function(){if(!_0x12aacd['query'][_0xb099('0x9')]){throw new Error(_0xb099('0xa1'));}if(!_0x12aacd[_0xb099('0x3e')][_0xb099('0xaf')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x42507d=_0x12aacd[_0xb099('0x3e')][_0xb099('0xa3')]?_0x12aacd[_0xb099('0x3e')][_0xb099('0xa3')]+':'+_0x12aacd[_0xb099('0x3e')][_0xb099('0xaf')]:_0xb099('0xa4')+_0x12aacd[_0xb099('0x3e')][_0xb099('0xaf')];var _0x51c540=_0x12aacd[_0xb099('0x3e')][_0xb099('0x25')]?_0x12aacd[_0xb099('0x3e')][_0xb099('0x25')]:!![];var _0x322a82=_0x12aacd[_0xb099('0x3e')][_0xb099('0xa5')]?_0x12aacd[_0xb099('0x3e')][_0xb099('0xa5')]:null;var _0x21ad15={'method':_0x12aacd[_0xb099('0xa6')],'uri':util['format'](_0xb099('0xb0'),_0x42507d,_0x12aacd['query'][_0xb099('0x9')]),'json':_0x51c540,'resolveWithFullResponse':!![],'encoding':_0x322a82,'body':_0x12aacd['body']};if(_0x12aacd[_0xb099('0xa8')]){_0x21ad15[_0xb099('0xa8')]=_0x12aacd[_0xb099('0xa8')];if(_0x21ad15[_0xb099('0xa8')][_0xb099('0xa9')]){delete _0x21ad15[_0xb099('0xa8')][_0xb099('0xa9')];}}if(_0x21ad15['headers'][_0xb099('0xaa')]){delete _0x21ad15['headers'][_0xb099('0xaa')];}return rp(_0x21ad15);})[_0xb099('0x2e')](function(_0x550465){if(_0x550465){_0xeea725[_0xb099('0x2a')](_0x550465[_0xb099('0xa8')]);logger[_0xb099('0x69')](_0x550465[_0xb099('0x97')]);return _0xeea725[_0xb099('0x23')](_0x550465[_0xb099('0xac')])[_0xb099('0x35')](_0x550465['body']);}else{return _0xeea725[_0xb099('0x22')](0xc8);}})[_0xb099('0x50')](handleError(_0xeea725,null));}; \ No newline at end of file +var _0x575f=['defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','download','root','format','%s.zip','basename','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','join','server/files/plugins','dirname','attachments/**/*','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','views','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','headers','content-type','endsWith','statusCode','webhookPost','encoding','%s%s','content-length','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x44092b,_0x3bd498){var _0x5c2236=function(_0x12fff7){while(--_0x12fff7){_0x44092b['push'](_0x44092b['shift']());}};_0x5c2236(++_0x3bd498);}(_0x575f,0x134));var _0xf575=function(_0x424214,_0x1cc266){_0x424214=_0x424214-0x0;var _0x62077b=_0x575f[_0x424214];return _0x62077b;};'use strict';var emlformat=require(_0xf575('0x0'));var rimraf=require(_0xf575('0x1'));var zipdir=require(_0xf575('0x2'));var jsonpatch=require(_0xf575('0x3'));var rp=require('request-promise');var moment=require(_0xf575('0x4'));var BPromise=require(_0xf575('0x5'));var Mustache=require(_0xf575('0x6'));var util=require(_0xf575('0x7'));var path=require(_0xf575('0x8'));var sox=require(_0xf575('0x9'));var csv=require(_0xf575('0xa'));var ejs=require(_0xf575('0xb'));var fs=require('fs');var fs_extra=require(_0xf575('0xc'));var _=require(_0xf575('0xd'));var squel=require('squel');var crypto=require(_0xf575('0xe'));var jsforce=require(_0xf575('0xf'));var deskjs=require(_0xf575('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xf575('0x11'));var rimraf=require(_0xf575('0x1'));var archiver=require(_0xf575('0x12'));var Redis=require(_0xf575('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf575('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf575('0x15'));var logger=require(_0xf575('0x16'))(_0xf575('0x17'));var utils=require(_0xf575('0x18'));var config=require(_0xf575('0x19'));var licenseUtil=require(_0xf575('0x1a'));var db=require(_0xf575('0x1b'))['db'];config['redis']=_[_0xf575('0x1c')](config[_0xf575('0x1d')],{'host':_0xf575('0x1e'),'port':0x18eb});var socket=require(_0xf575('0x1f'))(new Redis(config[_0xf575('0x1d')]));require(_0xf575('0x20'))[_0xf575('0x21')](socket);function respondWithStatusCode(_0x1b9b4f,_0x3d750e){_0x3d750e=_0x3d750e||0xcc;return function(_0xe10d1c){if(_0xe10d1c){return _0x1b9b4f[_0xf575('0x22')](_0x3d750e);}return _0x1b9b4f['status'](_0x3d750e)[_0xf575('0x23')]();};}function respondWithResult(_0x24e92f,_0x8d6a56){_0x8d6a56=_0x8d6a56||0xc8;return function(_0x49e196){if(_0x49e196){return _0x24e92f[_0xf575('0x24')](_0x8d6a56)[_0xf575('0x25')](_0x49e196);}};}function respondWithFilteredResult(_0x4fedb1,_0x5de3bd){return function(_0x38a5b3){if(_0x38a5b3){var _0x1fc13c=typeof _0x5de3bd[_0xf575('0x26')]===_0xf575('0x27')&&typeof _0x5de3bd[_0xf575('0x28')]==='undefined';var _0x236115=_0x38a5b3[_0xf575('0x29')];var _0x5554fc=_0x1fc13c?0x0:_0x5de3bd[_0xf575('0x26')];var _0x1f8edf=_0x1fc13c?_0x38a5b3[_0xf575('0x29')]:_0x5de3bd[_0xf575('0x26')]+_0x5de3bd[_0xf575('0x28')];var _0x1cb4bd;if(_0x1f8edf>=_0x236115){_0x1f8edf=_0x236115;_0x1cb4bd=0xc8;}else{_0x1cb4bd=0xce;}_0x4fedb1['status'](_0x1cb4bd);return _0x4fedb1[_0xf575('0x2a')](_0xf575('0x2b'),_0x5554fc+'-'+_0x1f8edf+'/'+_0x236115)['json'](_0x38a5b3);}return null;};}function patchUpdates(_0x23c27a){return function(_0x69178f){try{jsonpatch[_0xf575('0x2c')](_0x69178f,_0x23c27a,!![]);}catch(_0x5858f4){return BPromise[_0xf575('0x2d')](_0x5858f4);}return _0x69178f[_0xf575('0x2e')]();};}function saveUpdates(_0x2b1514,_0x453f6d){return function(_0x2e0e7e){if(_0x2e0e7e){return _0x2e0e7e[_0xf575('0x2f')](_0x2b1514)[_0xf575('0x30')](function(_0x271e2d){return _0x271e2d;});}return null;};}function removeEntity(_0x587b7d,_0x4610eb){return function(_0xe686c8){if(_0xe686c8){return _0xe686c8[_0xf575('0x31')]()[_0xf575('0x30')](function(){var _0x1adeea=_0xe686c8[_0xf575('0x32')]({'plain':!![]});var _0x35dcfe=_0xf575('0x33');return db[_0xf575('0x34')]['destroy']({'where':{'type':_0x35dcfe,'resourceId':_0x1adeea['id']}})['then'](function(){return _0xe686c8;});})['then'](function(){_0x587b7d[_0xf575('0x24')](0xcc)[_0xf575('0x23')]();});}};}function handleEntityNotFound(_0x1e9e48,_0x2a31b2){return function(_0x42aad2){if(!_0x42aad2){_0x1e9e48[_0xf575('0x22')](0x194);}return _0x42aad2;};}function handleError(_0xedd4c2,_0xef1468){_0xef1468=_0xef1468||0x1f4;return function(_0x5d5db7){logger[_0xf575('0x35')](_0x5d5db7[_0xf575('0x36')]);if(_0x5d5db7[_0xf575('0x37')]){delete _0x5d5db7['name'];}_0xedd4c2[_0xf575('0x24')](_0xef1468)[_0xf575('0x38')](_0x5d5db7);};}exports[_0xf575('0x39')]=function(_0x7975f8,_0x12a2f6){var _0x442c7e={},_0x504a37={},_0x2fa494={'count':0x0,'rows':[]};var _0x2c15c6=_['map'](db[_0xf575('0x3a')][_0xf575('0x3b')],function(_0x55d8a3){return{'name':_0x55d8a3['fieldName'],'type':_0x55d8a3[_0xf575('0x3c')]['key']};});_0x504a37[_0xf575('0x3d')]=_[_0xf575('0x3e')](_0x2c15c6,_0xf575('0x37'));_0x504a37[_0xf575('0x3f')]=_[_0xf575('0x40')](_0x7975f8['query']);_0x504a37[_0xf575('0x41')]=_[_0xf575('0x42')](_0x504a37[_0xf575('0x3d')],_0x504a37[_0xf575('0x3f')]);_0x442c7e[_0xf575('0x43')]=_[_0xf575('0x42')](_0x504a37[_0xf575('0x3d')],qs['fields'](_0x7975f8[_0xf575('0x3f')][_0xf575('0x44')]));_0x442c7e[_0xf575('0x43')]=_0x442c7e[_0xf575('0x43')]['length']?_0x442c7e[_0xf575('0x43')]:_0x504a37[_0xf575('0x3d')];if(!_0x7975f8[_0xf575('0x3f')][_0xf575('0x45')](_0xf575('0x46'))){_0x442c7e[_0xf575('0x28')]=qs[_0xf575('0x28')](_0x7975f8[_0xf575('0x3f')]['limit']);_0x442c7e['offset']=qs[_0xf575('0x26')](_0x7975f8[_0xf575('0x3f')][_0xf575('0x26')]);}_0x442c7e['order']=qs['sort'](_0x7975f8[_0xf575('0x3f')][_0xf575('0x47')]);_0x442c7e['where']=qs[_0xf575('0x41')](_[_0xf575('0x48')](_0x7975f8[_0xf575('0x3f')],_0x504a37['filters']),_0x2c15c6);if(_0x7975f8[_0xf575('0x3f')]['filter']){_0x442c7e[_0xf575('0x49')]=_[_0xf575('0x4a')](_0x442c7e[_0xf575('0x49')],{'$or':_[_0xf575('0x3e')](_0x2c15c6,function(_0x100095){if(_0x100095[_0xf575('0x3c')]!==_0xf575('0x4b')){var _0x4fa77c={};_0x4fa77c[_0x100095[_0xf575('0x37')]]={'$like':'%'+_0x7975f8[_0xf575('0x3f')]['filter']+'%'};return _0x4fa77c;}})});}_0x442c7e=_[_0xf575('0x4a')]({},_0x442c7e,_0x7975f8[_0xf575('0x4c')]);var _0x37f837={'where':_0x442c7e[_0xf575('0x49')]};return db[_0xf575('0x3a')][_0xf575('0x29')](_0x37f837)['then'](function(_0x5835e3){_0x2fa494['count']=_0x5835e3;if(_0x7975f8['query'][_0xf575('0x4d')]){_0x442c7e[_0xf575('0x4e')]=[{'all':!![]}];}return db[_0xf575('0x3a')][_0xf575('0x4f')](_0x442c7e);})[_0xf575('0x30')](function(_0x28ccaf){_0x2fa494[_0xf575('0x50')]=_0x28ccaf;return _0x2fa494;})[_0xf575('0x30')](respondWithFilteredResult(_0x12a2f6,_0x442c7e))[_0xf575('0x51')](handleError(_0x12a2f6,null));};exports[_0xf575('0x52')]=function(_0xa4d56,_0x3aba8d){var _0x53343a={'raw':!![],'where':{'id':_0xa4d56[_0xf575('0x53')]['id']}},_0x42e1ab={};_0x42e1ab[_0xf575('0x3d')]=_[_0xf575('0x40')](db[_0xf575('0x3a')][_0xf575('0x3b')]);_0x42e1ab[_0xf575('0x3f')]=_['keys'](_0xa4d56[_0xf575('0x3f')]);_0x42e1ab[_0xf575('0x41')]=_[_0xf575('0x42')](_0x42e1ab['model'],_0x42e1ab[_0xf575('0x3f')]);_0x53343a[_0xf575('0x43')]=_[_0xf575('0x42')](_0x42e1ab['model'],qs[_0xf575('0x44')](_0xa4d56['query'][_0xf575('0x44')]));_0x53343a[_0xf575('0x43')]=_0x53343a[_0xf575('0x43')][_0xf575('0x54')]?_0x53343a[_0xf575('0x43')]:_0x42e1ab[_0xf575('0x3d')];if(_0xa4d56[_0xf575('0x3f')]['includeAll']){_0x53343a[_0xf575('0x4e')]=[{'all':!![]}];}_0x53343a=_[_0xf575('0x4a')]({},_0x53343a,_0xa4d56[_0xf575('0x4c')]);return db[_0xf575('0x3a')][_0xf575('0x55')](_0x53343a)[_0xf575('0x30')](handleEntityNotFound(_0x3aba8d,null))['then'](respondWithResult(_0x3aba8d,null))[_0xf575('0x51')](handleError(_0x3aba8d,null));};exports[_0xf575('0x56')]=function(_0x12ca26,_0x4fb7bb,_0x41afca){return db[_0xf575('0x3a')][_0xf575('0x55')]({'where':{'id':_0x12ca26[_0xf575('0x53')]['id']},'attributes':[_0xf575('0x37'),_0xf575('0x8')],'raw':!![]})[_0xf575('0x30')](handleEntityNotFound(_0x4fb7bb,null))['then'](function(_0x394caa){if(_0x394caa){var _0x3bd62e=path['join'](config[_0xf575('0x57')],'server/files/plugins',util[_0xf575('0x58')](_0xf575('0x59'),path[_0xf575('0x5a')](_0x394caa[_0xf575('0x8')])));var _0x25586b=fs['createWriteStream'](_0x3bd62e);var _0x30c3cb=archiver(_0xf575('0x5b'),{'zlib':{'level':0x9}});_0x30c3cb['on']('warning',function(_0x3b4023){if(_0x3b4023[_0xf575('0x5c')]===_0xf575('0x5d')){logger['error'](_0x3b4023);}else{throw new db[(_0xf575('0x5e'))][(_0xf575('0x5f'))](_0xf575('0x60'));}});_0x30c3cb['on'](_0xf575('0x35'),function(_0x39a0a3){throw new db[(_0xf575('0x5e'))][(_0xf575('0x5f'))](_0xf575('0x60'));});_0x30c3cb['pipe'](_0x25586b);_0x30c3cb[_0xf575('0x61')](_0xf575('0x62'),{'cwd':path[_0xf575('0x63')](config[_0xf575('0x57')],_0xf575('0x64'),path[_0xf575('0x65')](_0x394caa[_0xf575('0x8')])),'ignore':[path[_0xf575('0x63')](path[_0xf575('0x5a')](_0x394caa[_0xf575('0x8')]),'node_modules/**/*'),path[_0xf575('0x63')](path['basename'](_0x394caa['path']),_0xf575('0x66'))],'nodir':!![]})['finalize']();_0x25586b['on'](_0xf575('0x67'),function(){if(!fs['existsSync'](_0x3bd62e)){throw new db['Sequelize'][(_0xf575('0x5f'))](_0xf575('0x68'));}return _0x4fb7bb[_0xf575('0x56')](_0x3bd62e,util[_0xf575('0x58')](_0xf575('0x59'),path[_0xf575('0x5a')](_0x394caa['path'])),function(_0x3da8e6){if(_0x3da8e6){throw new db['Sequelize'][(_0xf575('0x5f'))](_0xf575('0x69'));}fs[_0xf575('0x6a')](_0x3bd62e);logger['info'](_0xf575('0x6b'));logger[_0xf575('0x6c')](_0xf575('0x6d'));});});}return null;})['catch'](handleError(_0x4fb7bb,null));};exports['upload']=function(_0x545fed,_0x172c48,_0x4b3c73){var _0xaaa5f2=path['basename'](_0x545fed[_0xf575('0x6e')][_0xf575('0x6f')],path['extname'](_0x545fed[_0xf575('0x6e')][_0xf575('0x6f')]));var _0x419eef=path['join'](config['root'],_0xf575('0x64'),_0x545fed[_0xf575('0x6e')][_0xf575('0x6f')]);var _0x11b4d2=path['join'](config['root'],_0xf575('0x64'),_0xaaa5f2);logger[_0xf575('0x6c')](_0xf575('0x70'),_0x419eef);logger[_0xf575('0x6c')]('Plugin\x20upload\x20destination:\x20%s',_0x11b4d2);try{fs[_0xf575('0x71')](_0x419eef,parseInt(_0xf575('0x72'),0x8));extract(_0x419eef,{'dir':_0x11b4d2},function(_0x14b762){if(_0x14b762){logger[_0xf575('0x35')](_0x14b762);handleError(_0x14b762,!![]);};var _0x2fdb4d=fs['readdirSync'](_0x11b4d2);if(_0x2fdb4d[_0xf575('0x54')]>0x1){removeReferences(_0x419eef,_0x11b4d2);logger[_0xf575('0x35')](_0xf575('0x73'));return _0x4b3c73(new Error('Invalid\x20plugin\x20structure'));}var _0x152575=fs[_0xf575('0x74')](path['join'](_0x11b4d2,_0x2fdb4d[0x0]));if(_0x152575[_0xf575('0x75')]()){removeReferences(_0x419eef,_0x11b4d2);logger[_0xf575('0x35')]('Invalid\x20plugin\x20structure');return _0x4b3c73(new Error(_0xf575('0x73')));}if(_0x152575['isDirectory']()){var _0x39acec=fs['readdirSync'](path['join'](_0x11b4d2,_0x2fdb4d[0x0]));if(_0x39acec[_0xf575('0x54')]===0x0){removeReferences(_0x419eef,_0x11b4d2);logger[_0xf575('0x35')](_0xf575('0x73'));return _0x4b3c73(new Error(_0xf575('0x73')));}var _0x2370c1=_0x39acec[_0xf575('0x76')](function(_0x1f81b3){return _0x1f81b3===_0xf575('0x77');});if(!_0x2370c1){return _0x4b3c73(new Error('Plugin\x20manifest\x20missing'));}var _0x592ac9=fs[_0xf575('0x78')](path[_0xf575('0x63')](_0x11b4d2,_0x2fdb4d[0x0],_0xf575('0x77')));var _0x263e38=JSON['parse'](_0x592ac9);if('undefined'==typeof _0x263e38[_0xf575('0x37')]){return _0x4b3c73(new Error(_0xf575('0x79')));}if(_0xf575('0x27')==typeof _0x263e38['type']){return _0x4b3c73(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xf575('0x27')==typeof _0x263e38[_0xf575('0x7a')]){return _0x4b3c73(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xf575('0x27')==typeof _0x263e38['parameters']){return _0x4b3c73(new Error(_0xf575('0x7b')));}if(_0x263e38[_0xf575('0x3c')]===_0xf575('0x7c')){if(_0xf575('0x27')==typeof _0x263e38[_0xf575('0x7d')]['views']){return _0x4b3c73(new Error(_0xf575('0x7e')));}if(_0xf575('0x27')==typeof _0x263e38[_0xf575('0x7d')]['views']['admin']&&_0xf575('0x27')==typeof _0x263e38[_0xf575('0x7d')]['views'][_0xf575('0x7f')]){return _0x4b3c73(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x263e38[_0xf575('0x3c')]===_0xf575('0x80')){if(_0xf575('0x27')==typeof _0x263e38['parameters']['scriptName']){return _0x4b3c73(new Error(_0xf575('0x81')));}if(_0xf575('0x27')==typeof _0x263e38[_0xf575('0x7d')][_0xf575('0x82')]){return _0x4b3c73(new Error(_0xf575('0x83')));}}else{return _0x4b3c73(new Error(_0xf575('0x84')));}var _0x3e8518=_0x263e38[_0xf575('0x37')];var _0x1d65f7=_0x263e38['description'];var _0x62576d=_0x263e38[_0xf575('0x3c')];var _0x1cb61f=_0x263e38['sidebar']?_0x263e38[_0xf575('0x85')]:_0xf575('0x86');var _0x46d32f=_0x263e38['icon']?_0x263e38[_0xf575('0x87')]:_0xf575('0x88');var _0x5791eb='';var _0x213c20='';var _0x1a4cce='';var _0x358602='';var _0x415bf7=_0x263e38[_0xf575('0x7a')];if(_0x62576d===_0xf575('0x7c')){if(_0xf575('0x27')!=typeof _0x263e38[_0xf575('0x7d')][_0xf575('0x89')]['admin']){var _0x220941=_0x263e38[_0xf575('0x7d')]['views'][_0xf575('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xf575('0x8b')](_0x220941)){_0x5791eb=path['join'](_0xf575('0x8c'),_0xaaa5f2,_0x2fdb4d[0x0],_0x220941);}else{_0x5791eb=_0x220941;}}else{logger[_0xf575('0x6c')](_0xf575('0x8d'));}if(_0xf575('0x27')!=typeof _0x263e38[_0xf575('0x7d')][_0xf575('0x89')][_0xf575('0x7f')]){var _0x45a6a9=_0x263e38[_0xf575('0x7d')][_0xf575('0x89')][_0xf575('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xf575('0x8b')](_0x45a6a9)){_0x213c20=path['join'](_0xf575('0x8c'),_0xaaa5f2,_0x2fdb4d[0x0],_0x45a6a9);}else{_0x213c20=_0x45a6a9;}}else{logger[_0xf575('0x6c')](_0xf575('0x8e'));}}else if(_0x62576d===_0xf575('0x80')){_0x1a4cce=_0x263e38[_0xf575('0x7d')][_0xf575('0x8f')];_0x358602=_0x263e38['parameters'][_0xf575('0x82')];if('undefined'!=typeof _0x263e38['parameters'][_0xf575('0x89')]){if(_0xf575('0x27')!=typeof _0x263e38[_0xf575('0x7d')][_0xf575('0x89')]['admin']){var _0x220941=_0x263e38[_0xf575('0x7d')]['views'][_0xf575('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xf575('0x8b')](_0x220941)){_0x5791eb=path['join']('plugins',_0xaaa5f2,_0x2fdb4d[0x0],_0x220941);}else{_0x5791eb=_0x220941;}}if(_0xf575('0x27')!=typeof _0x263e38['parameters'][_0xf575('0x89')]['agent']){var _0x45a6a9=_0x263e38[_0xf575('0x7d')][_0xf575('0x89')][_0xf575('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xf575('0x8b')](_0x45a6a9)){_0x213c20=path[_0xf575('0x63')](_0xf575('0x8c'),_0xaaa5f2,_0x2fdb4d[0x0],_0x45a6a9);}else{_0x213c20=_0x45a6a9;}}}}var _0x2d36b0={'name':_0x3e8518,'description':_0x1d65f7,'path':path['join'](_0xaaa5f2,_0x2fdb4d[0x0]),'type':_0x62576d,'sidebar':_0x1cb61f,'icon':_0x46d32f,'adminUrl':_0x5791eb,'agentUrl':_0x213c20,'scriptName':_0x1a4cce,'scriptPath':_0x358602,'version':_0x415bf7};removeReferences(_0x419eef,null);return db[_0xf575('0x3a')][_0xf575('0x90')](_0x2d36b0)['then'](function(_0x1a33bd){var _0x91ca66={'role':_0x545fed[_0xf575('0x91')]['role'],'userProfileId':_0x545fed[_0xf575('0x91')]['userProfileId']};if(!_0x91ca66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x91ca66[_0xf575('0x92')]===_0xf575('0x93')){var _0xadf4a8=_0x1a33bd[_0xf575('0x32')]({'plain':!![]});return db[_0xf575('0x94')]['find']({'where':{'name':_0xf575('0x33'),'userProfileId':_0x91ca66[_0xf575('0x95')]},'raw':!![]})[_0xf575('0x30')](function(_0x52ca82){if(_0x52ca82&&_0x52ca82['autoAssociation']===0x0){return db[_0xf575('0x34')]['create']({'name':_0xadf4a8[_0xf575('0x37')],'resourceId':_0xadf4a8['id'],'type':_0x52ca82[_0xf575('0x37')],'sectionId':_0x52ca82['id']},{})[_0xf575('0x30')](function(){return _0x1a33bd;});}else{return _0x1a33bd;}})[_0xf575('0x51')](function(_0x4b5f7e){logger[_0xf575('0x35')](_0xf575('0x96'),_0x4b5f7e);throw _0x4b5f7e;});}return _0x1a33bd;})[_0xf575('0x30')](respondWithResult(_0x172c48,null))[_0xf575('0x51')](handleError(_0x172c48,null));}});}catch(_0x1296b1){_0x172c48['status'](0x1f4)['send'](_0x1296b1);}};function removeReferences(_0x34158d,_0x1d860a){try{if(_0x34158d){fs[_0xf575('0x6a')](_0x34158d);logger[_0xf575('0x6c')](_0xf575('0x97'));}if(_0x1d860a){rimraf(_0x1d860a,function(){});logger[_0xf575('0x6c')](_0xf575('0x98'));}}catch(_0x11268d){logger[_0xf575('0x35')](_0x11268d);}}exports[_0xf575('0x2f')]=function(_0x14f287,_0xc6613c,_0xb76db7){return db[_0xf575('0x3a')][_0xf575('0x55')]({'where':{'id':_0x14f287['params']['id']}})[_0xf575('0x30')](handleEntityNotFound(_0xc6613c,null))[_0xf575('0x30')](saveUpdates(_0x14f287[_0xf575('0x91')],null))[_0xf575('0x30')](respondWithResult(_0xc6613c,null))[_0xf575('0x51')](handleError(_0xc6613c,null));};exports[_0xf575('0x99')]=function(_0x503f29,_0x45fb47,_0x94ed73){return db[_0xf575('0x3a')]['find']({'where':{'id':_0x503f29[_0xf575('0x53')]['id']}})[_0xf575('0x30')](function(_0x21d4a6){if(_0x21d4a6){return _0x21d4a6['destroy']();}})[_0xf575('0x30')](function(_0x5f2591){rimraf(path['join'](config[_0xf575('0x57')],_0xf575('0x64'),path[_0xf575('0x65')](_0x5f2591[_0xf575('0x8')])),function(){});return _0x5f2591;})[_0xf575('0x30')](handleEntityNotFound(_0x45fb47,null))[_0xf575('0x30')](respondWithStatusCode(_0x45fb47,null))[_0xf575('0x51')](handleError(_0x45fb47,null));};exports['webhookGet']=function(_0x3d089d,_0x422097,_0x4c2cb7){return BPromise[_0xf575('0x9a')]()[_0xf575('0x30')](function(){if(!_0x3d089d['query'][_0xf575('0x8')]){throw new Error(_0xf575('0x9b'));}if(!_0x3d089d[_0xf575('0x3f')][_0xf575('0x9c')]){throw new Error(_0xf575('0x9d'));}var _0x5176ee=_0x3d089d[_0xf575('0x3f')]['hostname']?_0x3d089d['query'][_0xf575('0x9e')]+':'+_0x3d089d[_0xf575('0x3f')][_0xf575('0x9c')]:_0xf575('0x9f')+_0x3d089d['query']['port'];var _0x4864bd=_0x3d089d[_0xf575('0x3f')][_0xf575('0x25')]?_0x3d089d[_0xf575('0x3f')]['json']:!![];var _0x36c13=_0x3d089d[_0xf575('0x3f')]['encoding']?_0x3d089d['query']['encoding']:null;var _0x2dffda={'method':_0x3d089d['method'],'uri':util[_0xf575('0x58')]('%s%s',_0x5176ee,_0x3d089d[_0xf575('0x3f')]['path']),'json':_0x4864bd,'resolveWithFullResponse':!![],'encoding':_0x36c13,'qs':_0x3d089d['query']};if(_0x3d089d[_0xf575('0xa0')]){_0x2dffda['headers']=_0x3d089d[_0xf575('0xa0')];if(_0x2dffda[_0xf575('0xa0')]['content-length']){delete _0x2dffda[_0xf575('0xa0')]['content-length'];}}if(_0x2dffda[_0xf575('0xa0')][_0xf575('0xa1')]){delete _0x2dffda[_0xf575('0xa0')][_0xf575('0xa1')];}return rp(_0x2dffda);})[_0xf575('0x30')](function(_0x1fa746){if(_0x1fa746){_0x422097['set'](_0x1fa746['headers']);logger[_0xf575('0x6c')](_0x1fa746[_0xf575('0x91')]);if(_[_0xf575('0xa2')](_0x3d089d[_0xf575('0x3f')][_0xf575('0x8')],_0xf575('0x56'))&&_0x1fa746[_0xf575('0xa3')]==0x1f4){return _0x422097[_0xf575('0x22')](_0x1fa746[_0xf575('0xa3')]);}else{return _0x422097[_0xf575('0x24')](_0x1fa746[_0xf575('0xa3')])[_0xf575('0x38')](_0x1fa746['body']);}}else{return _0x422097[_0xf575('0x22')](0xc8);}})['catch'](handleError(_0x422097,null));};exports[_0xf575('0xa4')]=function(_0x20c601,_0x15c1b1,_0x4d3f43){return BPromise['resolve']()[_0xf575('0x30')](function(){if(!_0x20c601[_0xf575('0x3f')][_0xf575('0x8')]){throw new Error(_0xf575('0x9b'));}if(!_0x20c601[_0xf575('0x3f')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x384da1=_0x20c601[_0xf575('0x3f')][_0xf575('0x9e')]?_0x20c601[_0xf575('0x3f')][_0xf575('0x9e')]+':'+_0x20c601[_0xf575('0x3f')]['port']:_0xf575('0x9f')+_0x20c601[_0xf575('0x3f')][_0xf575('0x9c')];var _0x420b14=_0x20c601[_0xf575('0x3f')][_0xf575('0x25')]?_0x20c601[_0xf575('0x3f')][_0xf575('0x25')]:!![];var _0x4cb7b4=_0x20c601['query'][_0xf575('0xa5')]?_0x20c601[_0xf575('0x3f')][_0xf575('0xa5')]:null;var _0x4f869e={'method':_0x20c601['method'],'uri':util[_0xf575('0x58')](_0xf575('0xa6'),_0x384da1,_0x20c601['query'][_0xf575('0x8')]),'json':_0x420b14,'resolveWithFullResponse':!![],'encoding':_0x4cb7b4,'body':_0x20c601[_0xf575('0x91')]};if(_0x20c601[_0xf575('0xa0')]){_0x4f869e[_0xf575('0xa0')]=_0x20c601[_0xf575('0xa0')];if(_0x4f869e[_0xf575('0xa0')]['content-length']){delete _0x4f869e[_0xf575('0xa0')][_0xf575('0xa7')];}}if(_0x4f869e[_0xf575('0xa0')][_0xf575('0xa1')]){delete _0x4f869e[_0xf575('0xa0')][_0xf575('0xa1')];}return rp(_0x4f869e);})[_0xf575('0x30')](function(_0x2c392e){if(_0x2c392e){_0x15c1b1[_0xf575('0x2a')](_0x2c392e[_0xf575('0xa0')]);logger[_0xf575('0x6c')](_0x2c392e[_0xf575('0x91')]);return _0x15c1b1['status'](_0x2c392e[_0xf575('0xa3')])['send'](_0x2c392e[_0xf575('0x91')]);}else{return _0x15c1b1['sendStatus'](0xc8);}})['catch'](handleError(_0x15c1b1,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b81aed0..2fcd50c 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 _0x5785=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x5785,0x119));var _0x5578=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x5785[_0x9cd4c3];return _0x4c9025;};'use strict';var EventEmitter=require(_0x5578('0x0'));var Plugin=require(_0x5578('0x1'))['db'][_0x5578('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5578('0x3')](0x0);var events={'afterCreate':_0x5578('0x4'),'afterUpdate':'update','afterDestroy':_0x5578('0x5')};function emitEvent(_0x2a3b8a){return function(_0x1af5f6,_0x8c7841,_0x3112c5){PluginEvents[_0x5578('0x6')](_0x2a3b8a+':'+_0x1af5f6['id'],_0x1af5f6);PluginEvents[_0x5578('0x6')](_0x2a3b8a,_0x1af5f6);_0x3112c5(null);};}for(var e in events){if(events[_0x5578('0x7')](e)){var event=events[e];Plugin[_0x5578('0x8')](e,emitEvent(event));}}module[_0x5578('0x9')]=PluginEvents; \ No newline at end of file +var _0x1354=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x5ba0c4,_0x3b22f6){var _0x49574f=function(_0x4bdc90){while(--_0x4bdc90){_0x5ba0c4['push'](_0x5ba0c4['shift']());}};_0x49574f(++_0x3b22f6);}(_0x1354,0x95));var _0x4135=function(_0x150cc4,_0x15e9f1){_0x150cc4=_0x150cc4-0x0;var _0x22a995=_0x1354[_0x150cc4];return _0x22a995;};'use strict';var EventEmitter=require(_0x4135('0x0'));var Plugin=require(_0x4135('0x1'))['db'][_0x4135('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x4135('0x3')](0x0);var events={'afterCreate':_0x4135('0x4'),'afterUpdate':_0x4135('0x5'),'afterDestroy':_0x4135('0x6')};function emitEvent(_0x537b00){return function(_0x2c75a3,_0x4ed434,_0x202042){PluginEvents['emit'](_0x537b00+':'+_0x2c75a3['id'],_0x2c75a3);PluginEvents[_0x4135('0x7')](_0x537b00,_0x2c75a3);_0x202042(null);};}for(var e in events){if(events[_0x4135('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x4135('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a067a5f..5cfac98 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 _0x07bd=['define','Plugin','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x52c6eb,_0x186bc9){var _0x16559d=function(_0x3f4c1b){while(--_0x3f4c1b){_0x52c6eb['push'](_0x52c6eb['shift']());}};_0x16559d(++_0x186bc9);}(_0x07bd,0x13a));var _0xd07b=function(_0x2c75e8,_0x2f2e7e){_0x2c75e8=_0x2c75e8-0x0;var _0x5e6112=_0x07bd[_0x2c75e8];return _0x5e6112;};'use strict';var _=require(_0xd07b('0x0'));var util=require(_0xd07b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd07b('0x2'));var BPromise=require(_0xd07b('0x3'));var rp=require(_0xd07b('0x4'));var fs=require('fs');var path=require(_0xd07b('0x5'));var rimraf=require(_0xd07b('0x6'));var config=require(_0xd07b('0x7'));var attributes=require(_0xd07b('0x8'));module[_0xd07b('0x9')]=function(_0x439e2c,_0x328944){return _0x439e2c[_0xd07b('0xa')](_0xd07b('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21d8=['request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x11e1b2,_0x21cb36){var _0x374bd5=function(_0x484278){while(--_0x484278){_0x11e1b2['push'](_0x11e1b2['shift']());}};_0x374bd5(++_0x21cb36);}(_0x21d8,0x145));var _0x821d=function(_0x3c0d5d,_0x3053b0){_0x3c0d5d=_0x3c0d5d-0x0;var _0xd3c12e=_0x21d8[_0x3c0d5d];return _0xd3c12e;};'use strict';var _=require(_0x821d('0x0'));var util=require('util');var logger=require(_0x821d('0x1'))(_0x821d('0x2'));var moment=require(_0x821d('0x3'));var BPromise=require(_0x821d('0x4'));var rp=require(_0x821d('0x5'));var fs=require('fs');var path=require(_0x821d('0x6'));var rimraf=require(_0x821d('0x7'));var config=require(_0x821d('0x8'));var attributes=require(_0x821d('0x9'));module['exports']=function(_0x57a1f0,_0x28e824){return _0x57a1f0[_0x821d('0xa')]('Plugin',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 fcf4fac..be3a62c 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 _0x304d=['catch','body','options','raw','debug','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x304d,0xd2));var _0xd304=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x304d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd304('0x0'));var util=require(_0xd304('0x1'));var moment=require(_0xd304('0x2'));var BPromise=require(_0xd304('0x3'));var rs=require(_0xd304('0x4'));var fs=require('fs');var Redis=require(_0xd304('0x5'));var db=require(_0xd304('0x6'))['db'];var utils=require(_0xd304('0x7'));var logger=require(_0xd304('0x8'))(_0xd304('0x9'));var config=require('../../config/environment');var jayson=require(_0xd304('0xa'));var client=jayson[_0xd304('0xb')][_0xd304('0xc')]({'port':0x232a});config[_0xd304('0xd')]=_[_0xd304('0xe')](config[_0xd304('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd304('0xf'))(new Redis(config[_0xd304('0xd')]));require(_0xd304('0x10'))['register'](socket);function respondWithRpcPromise(_0x3ee45a,_0x138c80,_0x51cf18){return new BPromise(function(_0x49d25c,_0x21cef3){return client[_0xd304('0x11')](_0x3ee45a,_0x51cf18)[_0xd304('0x12')](function(_0x2ab6f5){logger['info'](_0xd304('0x13'),_0x138c80,_0xd304('0x14'));logger['debug'](_0xd304('0x15'),_0x138c80,_0xd304('0x14'),JSON[_0xd304('0x16')](_0x2ab6f5));if(_0x2ab6f5[_0xd304('0x17')]){if(_0x2ab6f5['error'][_0xd304('0x18')]===0x1f4){logger[_0xd304('0x17')](_0xd304('0x13'),_0x138c80,_0x2ab6f5['error'][_0xd304('0x19')]);return _0x21cef3(_0x2ab6f5[_0xd304('0x17')][_0xd304('0x19')]);}logger[_0xd304('0x17')]('Plugin,\x20%s,\x20%s',_0x138c80,_0x2ab6f5[_0xd304('0x17')][_0xd304('0x19')]);return _0x49d25c(_0x2ab6f5[_0xd304('0x17')]['message']);}else{logger[_0xd304('0x1a')]('Plugin,\x20%s,\x20%s',_0x138c80,_0xd304('0x14'));_0x49d25c(_0x2ab6f5[_0xd304('0x1b')][_0xd304('0x19')]);}})[_0xd304('0x1c')](function(_0x3f91d1){logger[_0xd304('0x17')](_0xd304('0x13'),_0x138c80,_0x3f91d1);_0x21cef3(_0x3f91d1);});});}exports['CreatePlugin']=function(_0x2911ff){var _0x2641c2=this;return new Promise(function(_0x3c2660,_0x49ea93){return db['Plugin']['create'](_0x2911ff[_0xd304('0x1d')],{'raw':_0x2911ff[_0xd304('0x1e')]?_0x2911ff[_0xd304('0x1e')][_0xd304('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x417ae3){logger['info']('CreatePlugin',_0x2911ff);logger[_0xd304('0x20')](_0xd304('0x21'),_0x2911ff,JSON[_0xd304('0x16')](_0x417ae3));_0x3c2660(_0x417ae3);})[_0xd304('0x1c')](function(_0xf91ce0){logger[_0xd304('0x17')](_0xd304('0x21'),_0xf91ce0['message'],_0x2911ff);_0x49ea93(_0x2641c2[_0xd304('0x17')](0x1f4,_0xf91ce0[_0xd304('0x19')]));});});}; \ No newline at end of file +var _0xe607=['localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xe607,0x7f));var _0x7e60=function(_0x51bc9e,_0x385262){_0x51bc9e=_0x51bc9e-0x0;var _0x374d68=_0xe607[_0x51bc9e];return _0x374d68;};'use strict';var _=require(_0x7e60('0x0'));var util=require(_0x7e60('0x1'));var moment=require(_0x7e60('0x2'));var BPromise=require(_0x7e60('0x3'));var rs=require(_0x7e60('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e60('0x5'))['db'];var utils=require(_0x7e60('0x6'));var logger=require('../../config/logger')(_0x7e60('0x7'));var config=require(_0x7e60('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7e60('0x9')][_0x7e60('0xa')]({'port':0x232a});config['redis']=_[_0x7e60('0xb')](config[_0x7e60('0xc')],{'host':_0x7e60('0xd'),'port':0x18eb});var socket=require(_0x7e60('0xe'))(new Redis(config['redis']));require(_0x7e60('0xf'))[_0x7e60('0x10')](socket);function respondWithRpcPromise(_0x129dea,_0x136461,_0x13ac09){return new BPromise(function(_0x384875,_0x528e24){return client[_0x7e60('0x11')](_0x129dea,_0x13ac09)[_0x7e60('0x12')](function(_0x2d14cf){logger[_0x7e60('0x13')](_0x7e60('0x14'),_0x136461,_0x7e60('0x15'));logger[_0x7e60('0x16')](_0x7e60('0x17'),_0x136461,_0x7e60('0x15'),JSON[_0x7e60('0x18')](_0x2d14cf));if(_0x2d14cf[_0x7e60('0x19')]){if(_0x2d14cf['error'][_0x7e60('0x1a')]===0x1f4){logger[_0x7e60('0x19')]('Plugin,\x20%s,\x20%s',_0x136461,_0x2d14cf['error'][_0x7e60('0x1b')]);return _0x528e24(_0x2d14cf[_0x7e60('0x19')][_0x7e60('0x1b')]);}logger[_0x7e60('0x19')](_0x7e60('0x14'),_0x136461,_0x2d14cf[_0x7e60('0x19')]['message']);return _0x384875(_0x2d14cf[_0x7e60('0x19')]['message']);}else{logger[_0x7e60('0x13')](_0x7e60('0x14'),_0x136461,_0x7e60('0x15'));_0x384875(_0x2d14cf[_0x7e60('0x1c')][_0x7e60('0x1b')]);}})[_0x7e60('0x1d')](function(_0x2de47b){logger['error'](_0x7e60('0x14'),_0x136461,_0x2de47b);_0x528e24(_0x2de47b);});});}exports['CreatePlugin']=function(_0x3f66b6){var _0x13fb4d=this;return new Promise(function(_0x1dab4e,_0x17d6bf){return db['Plugin'][_0x7e60('0x1e')](_0x3f66b6[_0x7e60('0x1f')],{'raw':_0x3f66b6[_0x7e60('0x20')]?_0x3f66b6['options'][_0x7e60('0x21')]===undefined?!![]:![]:!![]})[_0x7e60('0x12')](function(_0x54cb1f){logger['info'](_0x7e60('0x22'),_0x3f66b6);logger[_0x7e60('0x16')]('CreatePlugin',_0x3f66b6,JSON[_0x7e60('0x18')](_0x54cb1f));_0x1dab4e(_0x54cb1f);})[_0x7e60('0x1d')](function(_0x3befca){logger[_0x7e60('0x19')](_0x7e60('0x22'),_0x3befca['message'],_0x3f66b6);_0x17d6bf(_0x13fb4d['error'](0x1f4,_0x3befca['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 927cdc3..7c59ea3 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 _0xe39c=['register','length','plugin:','./plugin.events','save','update','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe39c,0x143));var _0xce39=function(_0x1d647d,_0x197452){_0x1d647d=_0x1d647d-0x0;var _0x4454d4=_0xe39c[_0x1d647d];return _0x4454d4;};'use strict';var PluginEvents=require(_0xce39('0x0'));var events=[_0xce39('0x1'),'remove',_0xce39('0x2')];function createListener(_0x3c9fd2,_0x16e83b){return function(_0x1161e8){_0x16e83b[_0xce39('0x3')](_0x3c9fd2,_0x1161e8);};}function removeListener(_0x4851cb,_0x2e9358){return function(){PluginEvents[_0xce39('0x4')](_0x4851cb,_0x2e9358);};}exports[_0xce39('0x5')]=function(_0x201fba){for(var _0x119794=0x0,_0x15c1ef=events[_0xce39('0x6')];_0x119794<_0x15c1ef;_0x119794++){var _0x4d59f6=events[_0x119794];var _0x2f818c=createListener(_0xce39('0x7')+_0x4d59f6,_0x201fba);PluginEvents['on'](_0x4d59f6,_0x2f818c);}}; \ No newline at end of file +var _0x3ae3=['update','emit','register','./plugin.events','save','remove'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3ae3,0x19b));var _0x33ae=function(_0x459a75,_0x2ca5dd){_0x459a75=_0x459a75-0x0;var _0x1e15ca=_0x3ae3[_0x459a75];return _0x1e15ca;};'use strict';var PluginEvents=require(_0x33ae('0x0'));var events=[_0x33ae('0x1'),_0x33ae('0x2'),_0x33ae('0x3')];function createListener(_0xded461,_0x447909){return function(_0x40cbec){_0x447909[_0x33ae('0x4')](_0xded461,_0x40cbec);};}function removeListener(_0x373c92,_0x2c8c82){return function(){PluginEvents['removeListener'](_0x373c92,_0x2c8c82);};}exports[_0x33ae('0x5')]=function(_0x4a30fc){for(var _0xd67ba2=0x0,_0x472f9a=events['length'];_0xd67ba2<_0x472f9a;_0xd67ba2++){var _0x43f14e=events[_0xd67ba2];var _0xac6d22=createListener('plugin:'+_0x43f14e,_0x4a30fc);PluginEvents['on'](_0x43f14e,_0xac6d22);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index c74c24f..e7deb75 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(_0x4a68dd,_0x110bc5){var _0x266bf9=function(_0x369ce5){while(--_0x369ce5){_0x4a68dd['push'](_0x4a68dd['shift']());}};_0x266bf9(++_0x110bc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x3be258,_0x1b63bc){var _0x1e2acb=function(_0x284188){while(--_0x284188){_0x3be258['push'](_0x3be258['shift']());}};_0x1e2acb(++_0x1b63bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 cedac95..46e4aa7 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 _0x9bde=['describe','params','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','delete','../../config/pm2','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x9bde,0xe1));var _0xe9bd=function(_0x583c32,_0x35d3d4){_0x583c32=_0x583c32-0x0;var _0x8086fe=_0x9bde[_0x583c32];return _0x8086fe;};'use strict';var _=require('lodash');var pm2=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var path=require('path');var exec=require(_0xe9bd('0x2'))[_0xe9bd('0x3')];var BPromise=require(_0xe9bd('0x4'));function handleEntityNotFound(_0x1c1b34,_0x10822d){return function(_0x1a4d14){if(!_0x1a4d14){_0x1c1b34[_0xe9bd('0x5')](0x194);;}return _0x1a4d14;};}function respondWithResult(_0x4fd7b8,_0x4763e9){_0x4763e9=_0x4763e9||0xc8;return function(_0x5f18fe){if(_0x5f18fe){return _0x4fd7b8[_0xe9bd('0x6')](_0x4763e9)[_0xe9bd('0x7')](_0x5f18fe);}return null;};}function handleError(_0x2d5c75,_0x3ef9e3){_0x3ef9e3=_0x3ef9e3||0x1f4;return function(_0x29bc2b){logger[_0xe9bd('0x8')](_0x29bc2b[_0xe9bd('0x9')]);if(_0x29bc2b[_0xe9bd('0xa')]){delete _0x29bc2b['name'];}_0x2d5c75['status'](_0x3ef9e3)[_0xe9bd('0xb')](_0x29bc2b);};}function execChildProcess(){return new BPromise(function(_0x145521,_0x2601ac){exec('npm\x20install',function(_0x12c96e,_0x9eca50,_0x3339f9){logger[_0xe9bd('0xc')](_0x9eca50);logger['info'](_0x3339f9);if(_0x12c96e){logger[_0xe9bd('0x8')](_0x12c96e);return _0x2601ac(_0x12c96e);}return _0x145521(_0x9eca50);});});}exports['index']=function(_0x220d07,_0x429e88){return pm2[_0xe9bd('0xd')]()['then'](function(_0x47ba5e){if(_0x47ba5e){var _0x46a95e=_[_0xe9bd('0xe')](_0x47ba5e,function(_0x3a9e5f){return _0x3a9e5f[_0xe9bd('0xa')]===_0xe9bd('0xf')||_0x3a9e5f[_0xe9bd('0xa')]===_0xe9bd('0x10');});return{'rows':_0x46a95e,'count':_0x46a95e['length']};}return null;})[_0xe9bd('0x11')](respondWithResult(_0x429e88,null))[_0xe9bd('0x12')](handleError(_0x429e88,null));};exports[_0xe9bd('0x13')]=function(_0x494b27,_0x36f03d){return pm2[_0xe9bd('0x14')](_0x494b27[_0xe9bd('0x15')]['id'])[_0xe9bd('0x11')](respondWithResult(_0x36f03d,null))['then'](handleEntityNotFound(_0x36f03d,null))[_0xe9bd('0x12')](handleError(_0x36f03d,null));};exports['create']=function(_0xc6b661,_0x55b869){if(_0xc6b661[_0xe9bd('0x16')][_0xe9bd('0xa')]&&_0xc6b661[_0xe9bd('0x16')][_0xe9bd('0x17')]){var _0x1acb82=path[_0xe9bd('0x18')](__dirname,_0xe9bd('0x19'),_0xc6b661['body'][_0xe9bd('0x17')]);var _0x28cd17=process['cwd']();process[_0xe9bd('0x1a')](path['dirname'](_0x1acb82));return execChildProcess()[_0xe9bd('0x11')](function(_0x1b9cc9){process[_0xe9bd('0x1a')](_0x28cd17);return pm2[_0xe9bd('0x1b')]({'name':_0xc6b661['body'][_0xe9bd('0xa')],'script':_0x1acb82});})[_0xe9bd('0x11')](function(_0x2c9a57){pm2[_0xe9bd('0x1c')]();return _0x2c9a57[0x0];})[_0xe9bd('0x11')](respondWithResult(_0x55b869,0xc9))[_0xe9bd('0x12')](handleError(_0x55b869,null));}else{return _0x55b869[_0xe9bd('0x6')](0x1f4)[_0xe9bd('0xb')]({'message':_0xe9bd('0x1d')});}};exports['update']=function(_0x3c211a,_0x38fdfa){if(_0x3c211a['body']['id']){delete _0x3c211a[_0xe9bd('0x16')]['id'];}var _0xc25248={'online':_0xe9bd('0x1e'),'stopped':_0xe9bd('0x1f')};if(_0xc25248[_0xe9bd('0x20')](_0x3c211a[_0xe9bd('0x16')]['status'])){return pm2[_0xc25248[_0x3c211a['body'][_0xe9bd('0x6')]]](_0x3c211a['params']['id'])[_0xe9bd('0x11')](respondWithResult(_0x38fdfa,0xc8))[_0xe9bd('0x12')](handleError(_0x38fdfa,null));}else{return _0x38fdfa[_0xe9bd('0x6')](0x1f4)[_0xe9bd('0xb')]({'message':_0xe9bd('0x21')});}};exports['destroy']=function(_0x4b7bc2,_0x7f2c5){if(_0x4b7bc2[_0xe9bd('0x16')]['id']){delete _0x4b7bc2[_0xe9bd('0x16')]['id'];}if(_0x4b7bc2[_0xe9bd('0x15')]['id']){return pm2[_0xe9bd('0x22')](_0x4b7bc2[_0xe9bd('0x15')]['id'])[_0xe9bd('0x11')](function(_0x66213a){pm2[_0xe9bd('0x1c')]();return _0x66213a[0x0];})['then'](respondWithResult(_0x7f2c5,null))[_0xe9bd('0x12')](handleError(_0x7f2c5,null));}else{return _0x7f2c5[_0xe9bd('0x6')](0x1f4)[_0xe9bd('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xcea2=['then','express','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','update','restart','stop','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/logger','path','child_process','exec','status','json','stack','name','send','npm\x20install','info','index','list'];(function(_0x34b207,_0x445c91){var _0x572ba6=function(_0x3b0734){while(--_0x3b0734){_0x34b207['push'](_0x34b207['shift']());}};_0x572ba6(++_0x445c91);}(_0xcea2,0x15a));var _0x2cea=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcea2[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x2cea('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x2cea('0x1'))('api');var path=require(_0x2cea('0x2'));var exec=require(_0x2cea('0x3'))[_0x2cea('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3ff73f,_0x46060b){return function(_0x11596e){if(!_0x11596e){_0x3ff73f['sendStatus'](0x194);;}return _0x11596e;};}function respondWithResult(_0x34f0f2,_0x485c26){_0x485c26=_0x485c26||0xc8;return function(_0x2d69ff){if(_0x2d69ff){return _0x34f0f2[_0x2cea('0x5')](_0x485c26)[_0x2cea('0x6')](_0x2d69ff);}return null;};}function handleError(_0x160cca,_0x11c5c0){_0x11c5c0=_0x11c5c0||0x1f4;return function(_0x1519f6){logger['error'](_0x1519f6[_0x2cea('0x7')]);if(_0x1519f6[_0x2cea('0x8')]){delete _0x1519f6[_0x2cea('0x8')];}_0x160cca[_0x2cea('0x5')](_0x11c5c0)[_0x2cea('0x9')](_0x1519f6);};}function execChildProcess(){return new BPromise(function(_0x439c4d,_0x4298a4){exec(_0x2cea('0xa'),function(_0x58a102,_0x5724b0,_0x2fe9cd){logger[_0x2cea('0xb')](_0x5724b0);logger['info'](_0x2fe9cd);if(_0x58a102){logger['error'](_0x58a102);return _0x4298a4(_0x58a102);}return _0x439c4d(_0x5724b0);});});}exports[_0x2cea('0xc')]=function(_0x4e0da7,_0xa4ce3d){return pm2[_0x2cea('0xd')]()[_0x2cea('0xe')](function(_0x5cf805){if(_0x5cf805){var _0x4d7f8b=_['reject'](_0x5cf805,function(_0x369c72){return _0x369c72['name']===_0x2cea('0xf')||_0x369c72[_0x2cea('0x8')]===_0x2cea('0x10');});return{'rows':_0x4d7f8b,'count':_0x4d7f8b[_0x2cea('0x11')]};}return null;})[_0x2cea('0xe')](respondWithResult(_0xa4ce3d,null))[_0x2cea('0x12')](handleError(_0xa4ce3d,null));};exports[_0x2cea('0x13')]=function(_0x1ead4c,_0x5eee09){return pm2[_0x2cea('0x14')](_0x1ead4c[_0x2cea('0x15')]['id'])[_0x2cea('0xe')](respondWithResult(_0x5eee09,null))[_0x2cea('0xe')](handleEntityNotFound(_0x5eee09,null))[_0x2cea('0x12')](handleError(_0x5eee09,null));};exports[_0x2cea('0x16')]=function(_0x5d75c4,_0x27375b){if(_0x5d75c4['body'][_0x2cea('0x8')]&&_0x5d75c4[_0x2cea('0x17')][_0x2cea('0x18')]){var _0x4fd3d5=path[_0x2cea('0x19')](__dirname,_0x2cea('0x1a'),_0x5d75c4[_0x2cea('0x17')][_0x2cea('0x18')]);var _0x3246bc=process[_0x2cea('0x1b')]();process[_0x2cea('0x1c')](path['dirname'](_0x4fd3d5));return execChildProcess()[_0x2cea('0xe')](function(_0x5e5b46){process[_0x2cea('0x1c')](_0x3246bc);return pm2['start']({'name':_0x5d75c4[_0x2cea('0x17')][_0x2cea('0x8')],'script':_0x4fd3d5});})['then'](function(_0x41d272){pm2[_0x2cea('0x1d')]();return _0x41d272[0x0];})[_0x2cea('0xe')](respondWithResult(_0x27375b,0xc9))[_0x2cea('0x12')](handleError(_0x27375b,null));}else{return _0x27375b[_0x2cea('0x5')](0x1f4)[_0x2cea('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2cea('0x1e')]=function(_0x32b6a3,_0x2bbe9b){if(_0x32b6a3[_0x2cea('0x17')]['id']){delete _0x32b6a3[_0x2cea('0x17')]['id'];}var _0x3ea40c={'online':_0x2cea('0x1f'),'stopped':_0x2cea('0x20')};if(_0x3ea40c['hasOwnProperty'](_0x32b6a3[_0x2cea('0x17')][_0x2cea('0x5')])){return pm2[_0x3ea40c[_0x32b6a3['body'][_0x2cea('0x5')]]](_0x32b6a3[_0x2cea('0x15')]['id'])[_0x2cea('0xe')](respondWithResult(_0x2bbe9b,0xc8))[_0x2cea('0x12')](handleError(_0x2bbe9b,null));}else{return _0x2bbe9b['status'](0x1f4)[_0x2cea('0x9')]({'message':_0x2cea('0x21')});}};exports['destroy']=function(_0x2bf4e9,_0x2e3d44){if(_0x2bf4e9[_0x2cea('0x17')]['id']){delete _0x2bf4e9[_0x2cea('0x17')]['id'];}if(_0x2bf4e9[_0x2cea('0x15')]['id']){return pm2[_0x2cea('0x22')](_0x2bf4e9[_0x2cea('0x15')]['id'])[_0x2cea('0xe')](function(_0x2e1cd6){pm2[_0x2cea('0x1d')]();return _0x2e1cd6[0x0];})[_0x2cea('0xe')](respondWithResult(_0x2e3d44,null))['catch'](handleError(_0x2e3d44,null));}else{return _0x2e3d44[_0x2cea('0x5')](0x1f4)[_0x2cea('0x9')]({'message':_0x2cea('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index dd84ec0..4692ec2 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 _0xc61f=['isAuthenticated','getAgents','/queues','Router','../../components/auth/service','get','/agents'];(function(_0x25405c,_0x399183){var _0x6fdbf4=function(_0x4dcc28){while(--_0x4dcc28){_0x25405c['push'](_0x25405c['shift']());}};_0x6fdbf4(++_0x399183);}(_0xc61f,0x6c));var _0xfc61=function(_0x9974f1,_0xcb4a90){_0x9974f1=_0x9974f1-0x0;var _0x159360=_0xc61f[_0x9974f1];return _0x159360;};'use strict';var express=require('express');var router=express[_0xfc61('0x0')]();var auth=require(_0xfc61('0x1'));var controller=require('./realtime.controller');router[_0xfc61('0x2')](_0xfc61('0x3'),auth[_0xfc61('0x4')](),controller[_0xfc61('0x5')]);router[_0xfc61('0x2')](_0xfc61('0x6'),auth[_0xfc61('0x4')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x616d=['getAgents','get','/queues','exports','express','Router','/agents','isAuthenticated'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x616d,0xfc));var _0xd616=function(_0x2737f2,_0x596043){_0x2737f2=_0x2737f2-0x0;var _0x57e6e7=_0x616d[_0x2737f2];return _0x57e6e7;};'use strict';var express=require(_0xd616('0x0'));var router=express[_0xd616('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router['get'](_0xd616('0x2'),auth[_0xd616('0x3')](),controller[_0xd616('0x4')]);router[_0xd616('0x5')](_0xd616('0x6'),auth[_0xd616('0x3')](),controller['getQueues']);module[_0xd616('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 02bf7b3..031550c 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 _0x425e=['getOptions','raw','length','push','sequelize','FIELD(id,','forEach','Pause','merge','where','user','userProfileId','Agents','agent','online','assign','omit','getResources','findAndCountAll','rows','map','filterAgentAttributes','getAgentStatus','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','type','voice','outbound','dialActive','dialMethod','Queues','name','UserProfile','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','Content-Range','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','channel','isValidChannel','format','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','User','rawAttributes','fieldName','key','role'];(function(_0x4ae2e6,_0x4580d6){var _0x2e359f=function(_0x1dc083){while(--_0x1dc083){_0x4ae2e6['push'](_0x4ae2e6['shift']());}};_0x2e359f(++_0x4580d6);}(_0x425e,0x17a));var _0xe425=function(_0x454c5d,_0x3b249c){_0x454c5d=_0x454c5d-0x0;var _0xa1d8b0=_0x425e[_0x454c5d];return _0xa1d8b0;};'use strict';var _=require(_0xe425('0x0'));var util=require(_0xe425('0x1'));var rta=require(_0xe425('0x2'));var rtq=require(_0xe425('0x3'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require(_0xe425('0x4'))['db'];var APIBadRequestError=require(_0xe425('0x5'))[_0xe425('0x6')];var APIHandleError=require(_0xe425('0x5'))['handleError'];function respondWithFilteredResult(_0x3e2c39,_0x16b0e2){return function(_0x3c571e){if(_0x3c571e){var _0xec607a=typeof _0x16b0e2[_0xe425('0x7')]===_0xe425('0x8')&&typeof _0x16b0e2[_0xe425('0x9')]===_0xe425('0x8');var _0x393b77=_0x3c571e[_0xe425('0xa')];var _0x57b5fa=_0xec607a?0x0:_0x16b0e2[_0xe425('0x7')];var _0x57c883=_0xec607a?_0x3c571e[_0xe425('0xa')]:_0x16b0e2[_0xe425('0x7')]+_0x16b0e2[_0xe425('0x9')];var _0x442e5c;if(_0x57c883>=_0x393b77){_0x57c883=_0x393b77;_0x442e5c=0xc8;}else{_0x442e5c=0xce;}_0x3e2c39[_0xe425('0xb')](_0x442e5c);return _0x3e2c39['set'](_0xe425('0xc'),_0x57b5fa+'-'+_0x57c883+'/'+_0x393b77)['json'](_0x3c571e);}return null;};}exports[_0xe425('0xd')]=function(_0x752486,_0x5eb715){var _0x3f7978={'count':0x0,'rows':[]};var _0x3777a1={};var _0x31d6a2;var _0x28ff89=utils[_0xe425('0xe')]();var _0x39b590;var _0x298eb1;var _0x24d9b5=_0x752486[_0xe425('0xf')][_0xe425('0x10')];var _0x5867dc=_0x752486[_0xe425('0xf')][_0xe425('0x11')];var _0x570e18=_0x752486[_0xe425('0xf')][_0xe425('0x12')];var _0x586a6d=_0x5867dc===_0xe425('0x13')||_0x5867dc===_0xe425('0x14')?!![]:![];var _0x43be69=[];var _0x279f79;var _0x11ec55;Promise[_0xe425('0x15')]()['then'](function(){if(_0x752486[_0xe425('0xf')][_0xe425('0x16')]){if(!utils[_0xe425('0x17')](_0x752486[_0xe425('0xf')][_0xe425('0x16')])){throw new APIBadRequestError(util[_0xe425('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x752486['query'][_0xe425('0x16')]));}_0x31d6a2=_0x752486['query'][_0xe425('0x16')][_0xe425('0x19')]();}if(!_0x752486[_0xe425('0xf')][_0xe425('0x1a')]||!_0x752486['query']['sort'][_0xe425('0x1b')](_0xe425('0x1c'))){_0x752486[_0xe425('0xf')][_0xe425('0x1a')]=rta[_0xe425('0x1d')](_0x752486['query'][_0xe425('0x1a')]);return;}var _0x275558=rta['getUpdatedSortOptions'](_0x752486[_0xe425('0xf')][_0xe425('0x1a')]);_0x752486['query']['sort']=_0x275558[_0xe425('0x1e')][_0xe425('0x1f')](',');_0x279f79=_0x275558[_0xe425('0x20')];})[_0xe425('0x21')](function(){if(!_0x24d9b5){return[];}return rta[_0xe425('0x22')](_0x24d9b5,_0x31d6a2);})[_0xe425('0x21')](function(_0x357414){_0x43be69=_0x357414;return rta[_0xe425('0x23')]();})['then'](function(_0x2da0f1){_0x298eb1=_0x2da0f1['rows'];if((!_0x5867dc||_0x586a6d)&&!_0x279f79){return _0x43be69;}if(_0x279f79&&!_0x5867dc){return rta[_0xe425('0x24')](_0x298eb1,_0x43be69,_0x279f79);}else{return rta['getAgentIdsByStatus'](_0x298eb1,_0x43be69,_0x5867dc);}})[_0xe425('0x21')](function(_0xb3f6ea){_0x43be69=_0xb3f6ea;var _0x2dbf8e=![];if(_0x43be69['length']===0x0){if(_0x24d9b5||_0x5867dc){_0x2dbf8e=!![];}if(_0x586a6d){_0x2dbf8e=![];}}if(_0x2dbf8e){return _0x3f7978;}var _0xf47b22=_['map'](db[_0xe425('0x25')][_0xe425('0x26')],function(_0x1e78b0){return{'name':_0x1e78b0[_0xe425('0x27')],'type':_0x1e78b0['type'][_0xe425('0x28')]};});_0x752486[_0xe425('0xf')][_0xe425('0x29')]='agent';_0x3777a1=qs[_0xe425('0x2a')](_0xf47b22,_0x752486);_0x3777a1[_0xe425('0x2b')]=!![];var _0x27fe64=[];if(_0x43be69[_0xe425('0x2c')]>0x0){_0x27fe64[_0xe425('0x2d')]({'id':{'$in':_0x43be69}});if(_0x279f79&&!_0x5867dc){_0x11ec55=[db[_0xe425('0x2e')]['literal'](_0xe425('0x2f')+_0x43be69+')')];_0x3777a1['order']=_0x11ec55;}}if(_0x586a6d){_0x28ff89[_0xe425('0x30')](function(_0x1e68e5){var _0x58d720=!![];if(_0x5867dc===_0xe425('0x14')&&_0x31d6a2!==_0x1e68e5){_0x58d720=![];}_0x27fe64[_0xe425('0x2d')]({[_0x1e68e5+'Pause']:_0x58d720});});if(_0x570e18){_0x27fe64[_0xe425('0x2d')]({'pauseType':_0x570e18});}}else if(_0x5867dc){_0x28ff89[_0xe425('0x30')](function(_0x4f9978){_0x27fe64[_0xe425('0x2d')]({[_0x4f9978+_0xe425('0x31')]:![]});});}_0x3777a1['where']=_[_0xe425('0x32')](_0x3777a1[_0xe425('0x33')],{'$and':_0x27fe64});if(_0x752486['user'][_0xe425('0x29')]===_0xe425('0x34')){var _0x752424={'params':{'id':_0x752486[_0xe425('0x34')][_0xe425('0x35')]},'query':{'section':_0xe425('0x36'),'role':_0xe425('0x37'),'raw':!![],'ids':_0x43be69,'customSorting':_0x11ec55}};if(_0x752486[_0xe425('0xf')]['online']){_0x752424[_0xe425('0xf')][_0xe425('0x38')]=!![];}if(_0x586a6d){_0x752424[_0xe425('0xf')]['extraQueryConditions']=_0x27fe64;}_0x752424['query']=Object[_0xe425('0x39')](_0x752424[_0xe425('0xf')],_[_0xe425('0x3a')](_0x752486[_0xe425('0xf')],'id'));return db['UserProfile'][_0xe425('0x3b')](_0x752424);}return db[_0xe425('0x25')][_0xe425('0x3c')](_0x3777a1);})[_0xe425('0x21')](function(_0x3cc82c){_0x3f7978['count']=_0x3cc82c[_0xe425('0xa')];_0x39b590=_0x3cc82c[_0xe425('0x3d')];return _0x39b590[_0xe425('0x3e')](function(_0x576bd0){var _0x198463=_['find'](_0x298eb1,['id',_0x576bd0['id']]);if(_0x198463){var _0x39baf8=rta[_0xe425('0x3f')](_0x198463);_[_0xe425('0x32')](_0x576bd0,_0x39baf8);}_0x576bd0['globalStatus']=rta[_0xe425('0x40')](_0x576bd0);if(_0x576bd0['globalStatus']['includes'](_0xe425('0x13'))){_0x28ff89[_0xe425('0x30')](function(_0x373f97){if(_0x576bd0[_0x373f97+_0xe425('0x31')]){if(_0x373f97==='voice'){if(_0x576bd0[_0xe425('0x41')]!==_0xe425('0x42')){_0x576bd0[_0xe425('0x41')]=_0xe425('0x13');}}else{_0x576bd0[_0x373f97+_0xe425('0x43')]='pause';}}});}return _0x576bd0;});})[_0xe425('0x21')](function(_0xec1fa2){if(!_0x279f79||_0x11ec55){return _0xec1fa2;}return rta[_0xe425('0x44')](_0xec1fa2,_0x279f79);})[_0xe425('0x21')](function(_0x531e79){var _0x4974c4=rta[_0xe425('0x45')]();_0x3f7978[_0xe425('0x3d')]=_0x531e79[_0xe425('0x3e')](function(_0x3f6b2b){return _[_0xe425('0x46')](_0x3f6b2b,_0x4974c4);});return _0x3f7978;})[_0xe425('0x21')](respondWithFilteredResult(_0x5eb715,_0x3777a1))[_0xe425('0x47')](APIHandleError(_0x5eb715));};exports[_0xe425('0x48')]=function(_0x671649,_0x1f782a){var _0x4e5a94={'count':0x0,'rows':[]};var _0x3470b1={};var _0x5977b1;var _0x39eb1f;var _0x588675;Promise[_0xe425('0x15')]()[_0xe425('0x21')](function(){if(_0x671649['query']['channel']){if(!utils[_0xe425('0x17')](_0x671649[_0xe425('0xf')]['channel'])){throw new APIBadRequestError(util[_0xe425('0x18')](_0xe425('0x49'),_0x671649[_0xe425('0xf')][_0xe425('0x16')]));}_0x5977b1=_0x671649[_0xe425('0xf')]['channel']['toLowerCase']();}var _0x53dcc1=_[_0xe425('0x4a')](_0x5977b1)+'Queue';var _0x3809dc=_[_0xe425('0x3e')](db[_0x53dcc1][_0xe425('0x26')],function(_0x199f66){return{'name':_0x199f66[_0xe425('0x27')],'type':_0x199f66[_0xe425('0x4b')][_0xe425('0x28')]};});if(!_0x671649[_0xe425('0xf')][_0xe425('0x1e')]){var _0x230b4f=['id','name'];if(_0x5977b1===_0xe425('0x4c')){_0x230b4f[_0xe425('0x2d')](_0xe425('0x4b'));if(_0x671649['query']['type']===_0xe425('0x4d')){_0x230b4f[_0xe425('0x2d')]([_0xe425('0x4e'),_0xe425('0x4f')]);}}_0x671649['query']['fields']=_0x230b4f['join'](',');}_0x3470b1=qs[_0xe425('0x2a')](_0x3809dc,_0x671649);if(_0x671649[_0xe425('0x34')][_0xe425('0x29')]==='user'){var _0x37d04b={'params':{'id':_0x671649[_0xe425('0x34')]['userProfileId']},'query':{'section':_0x5977b1===_0xe425('0x4c')&&_0x671649[_0xe425('0xf')][_0xe425('0x4b')]===_0xe425('0x4d')?'QueueCampaigns':_[_0xe425('0x4a')](_0x5977b1)+_0xe425('0x50'),'type':_0x671649[_0xe425('0xf')][_0xe425('0x4b')],'nolimit':!![],'sort':_0xe425('0x51'),'filter':_0x671649['query']['filter']}};_0x37d04b['query']=Object[_0xe425('0x39')](_0x37d04b[_0xe425('0xf')],_0x671649[_0xe425('0xf')]);delete _0x37d04b[_0xe425('0xf')]['id'];return db[_0xe425('0x52')]['getResources'](_0x37d04b);}return db[_0x53dcc1][_0xe425('0x3c')](_0x3470b1);})[_0xe425('0x21')](function(_0x4f4445){_0x4e5a94[_0xe425('0xa')]=_0x4f4445[_0xe425('0xa')];_0x39eb1f=_0x4f4445[_0xe425('0x3d')];return rtq[_0xe425('0x53')](_0x671649,_0x5977b1);})[_0xe425('0x21')](function(_0x5089f7){_0x588675=_0x5089f7[_0xe425('0x3d')];return rtq['initializeQueues'](_0x39eb1f,_0x588675,_0x5977b1,_0x671649[_0xe425('0xf')]['type']);})[_0xe425('0x21')](function(_0x1725d8){_0x4e5a94[_0xe425('0x3d')]=_0x1725d8;return _0x4e5a94;})[_0xe425('0x21')](respondWithFilteredResult(_0x1f782a,_0x3470b1))[_0xe425('0x47')](APIHandleError(_0x1f782a));}; \ No newline at end of file +var _0x450a=['resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','length','User','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','forEach','push','Pause','where','user','online','extraQueryConditions','assign','UserProfile','findAndCountAll','map','find','merge','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','name','outbound','dialActive','dialMethod','userProfileId','Queues','filter','getResources','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause'];(function(_0x152ae0,_0x37d19c){var _0x504059=function(_0x3b6de0){while(--_0x3b6de0){_0x152ae0['push'](_0x152ae0['shift']());}};_0x504059(++_0x37d19c);}(_0x450a,0x1ee));var _0xa450=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x450a[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa450('0x0'));var util=require(_0xa450('0x1'));var rta=require(_0xa450('0x2'));var rtq=require(_0xa450('0x3'));var qs=require(_0xa450('0x4'));var utils=require(_0xa450('0x5'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require(_0xa450('0x6'))['handleError'];function respondWithFilteredResult(_0x200922,_0x176d22){return function(_0x1f4f0d){if(_0x1f4f0d){var _0x260a66=typeof _0x176d22[_0xa450('0x7')]===_0xa450('0x8')&&typeof _0x176d22[_0xa450('0x9')]===_0xa450('0x8');var _0x1c3883=_0x1f4f0d['count'];var _0x4e9880=_0x260a66?0x0:_0x176d22[_0xa450('0x7')];var _0x515f99=_0x260a66?_0x1f4f0d[_0xa450('0xa')]:_0x176d22['offset']+_0x176d22[_0xa450('0x9')];var _0x5ae17c;if(_0x515f99>=_0x1c3883){_0x515f99=_0x1c3883;_0x5ae17c=0xc8;}else{_0x5ae17c=0xce;}_0x200922[_0xa450('0xb')](_0x5ae17c);return _0x200922[_0xa450('0xc')](_0xa450('0xd'),_0x4e9880+'-'+_0x515f99+'/'+_0x1c3883)[_0xa450('0xe')](_0x1f4f0d);}return null;};}exports[_0xa450('0xf')]=function(_0x32b164,_0x1fba8b){var _0x5681d3={'count':0x0,'rows':[]};var _0x43bc7e={};var _0xc0988f;var _0x3c09e8=utils[_0xa450('0x10')]();var _0x1d776a;var _0x6c2721;var _0x11edb5=_0x32b164[_0xa450('0x11')]['globalQueueFilter'];var _0x12c8e0=_0x32b164[_0xa450('0x11')][_0xa450('0x12')];var _0x521caf=_0x32b164[_0xa450('0x11')][_0xa450('0x13')];var _0x29b5d0=_0x12c8e0===_0xa450('0x14')||_0x12c8e0===_0xa450('0x15')?!![]:![];var _0x41732b=[];var _0x5a3962;var _0x4f901b;Promise[_0xa450('0x16')]()[_0xa450('0x17')](function(){if(_0x32b164[_0xa450('0x11')][_0xa450('0x18')]){if(!utils[_0xa450('0x19')](_0x32b164['query']['channel'])){throw new APIBadRequestError(util[_0xa450('0x1a')](_0xa450('0x1b'),_0x32b164['query'][_0xa450('0x18')]));}_0xc0988f=_0x32b164['query'][_0xa450('0x18')][_0xa450('0x1c')]();}if(!_0x32b164[_0xa450('0x11')]['sort']||!_0x32b164[_0xa450('0x11')][_0xa450('0x1d')][_0xa450('0x1e')](_0xa450('0x1f'))){_0x32b164[_0xa450('0x11')][_0xa450('0x1d')]=rta[_0xa450('0x20')](_0x32b164['query'][_0xa450('0x1d')]);return;}var _0x2e9156=rta['getUpdatedSortOptions'](_0x32b164[_0xa450('0x11')]['sort']);_0x32b164[_0xa450('0x11')][_0xa450('0x1d')]=_0x2e9156[_0xa450('0x21')][_0xa450('0x22')](',');_0x5a3962=_0x2e9156[_0xa450('0x23')];})[_0xa450('0x17')](function(){if(!_0x11edb5){return[];}return rta[_0xa450('0x24')](_0x11edb5,_0xc0988f);})[_0xa450('0x17')](function(_0x4e7c3f){_0x41732b=_0x4e7c3f;return rta[_0xa450('0x25')]();})['then'](function(_0x1cb2a6){_0x6c2721=_0x1cb2a6[_0xa450('0x26')];if((!_0x12c8e0||_0x29b5d0)&&!_0x5a3962){return _0x41732b;}if(_0x5a3962&&!_0x12c8e0){return rta['getSortedAgentsIdsByStatus'](_0x6c2721,_0x41732b,_0x5a3962);}else{return rta[_0xa450('0x27')](_0x6c2721,_0x41732b,_0x12c8e0);}})[_0xa450('0x17')](function(_0x23685e){_0x41732b=_0x23685e;var _0x3bc7f2=![];if(_0x41732b[_0xa450('0x28')]===0x0){if(_0x11edb5||_0x12c8e0){_0x3bc7f2=!![];}if(_0x29b5d0){_0x3bc7f2=![];}}if(_0x3bc7f2){return _0x5681d3;}var _0x483181=_['map'](db[_0xa450('0x29')]['rawAttributes'],function(_0x11fc43){return{'name':_0x11fc43[_0xa450('0x2a')],'type':_0x11fc43[_0xa450('0x2b')][_0xa450('0x2c')]};});_0x32b164['query'][_0xa450('0x2d')]=_0xa450('0x2e');_0x43bc7e=qs[_0xa450('0x2f')](_0x483181,_0x32b164);_0x43bc7e[_0xa450('0x30')]=!![];var _0x4cd1d3=[];if(_0x41732b[_0xa450('0x28')]>0x0){_0x4cd1d3['push']({'id':{'$in':_0x41732b}});if(_0x5a3962&&!_0x12c8e0){_0x4f901b=[db[_0xa450('0x31')][_0xa450('0x32')](_0xa450('0x33')+_0x41732b+')')];_0x43bc7e[_0xa450('0x23')]=_0x4f901b;}}if(_0x29b5d0){_0x3c09e8[_0xa450('0x34')](function(_0x591967){var _0x2a7032=!![];if(_0x12c8e0==='*pause'&&_0xc0988f!==_0x591967){_0x2a7032=![];}_0x4cd1d3[_0xa450('0x35')]({[_0x591967+_0xa450('0x36')]:_0x2a7032});});if(_0x521caf){_0x4cd1d3[_0xa450('0x35')]({'pauseType':_0x521caf});}}else if(_0x12c8e0){_0x3c09e8[_0xa450('0x34')](function(_0x49cc47){_0x4cd1d3[_0xa450('0x35')]({[_0x49cc47+'Pause']:![]});});}_0x43bc7e[_0xa450('0x37')]=_['merge'](_0x43bc7e['where'],{'$and':_0x4cd1d3});if(_0x32b164[_0xa450('0x38')]['role']==='user'){var _0x1aa08c={'params':{'id':_0x32b164[_0xa450('0x38')]['userProfileId']},'query':{'section':'Agents','role':_0xa450('0x2e'),'raw':!![],'ids':_0x41732b,'customSorting':_0x4f901b}};if(_0x32b164['query'][_0xa450('0x39')]){_0x1aa08c[_0xa450('0x11')]['online']=!![];}if(_0x29b5d0){_0x1aa08c['query'][_0xa450('0x3a')]=_0x4cd1d3;}_0x1aa08c[_0xa450('0x11')]=Object[_0xa450('0x3b')](_0x1aa08c['query'],_['omit'](_0x32b164[_0xa450('0x11')],'id'));return db[_0xa450('0x3c')]['getResources'](_0x1aa08c);}return db[_0xa450('0x29')][_0xa450('0x3d')](_0x43bc7e);})[_0xa450('0x17')](function(_0x5ba26d){_0x5681d3[_0xa450('0xa')]=_0x5ba26d[_0xa450('0xa')];_0x1d776a=_0x5ba26d['rows'];return _0x1d776a[_0xa450('0x3e')](function(_0x27565f){var _0x5a08de=_[_0xa450('0x3f')](_0x6c2721,['id',_0x27565f['id']]);if(_0x5a08de){var _0x4e10e0=rta['filterAgentAttributes'](_0x5a08de);_[_0xa450('0x40')](_0x27565f,_0x4e10e0);}_0x27565f[_0xa450('0x1f')]=rta[_0xa450('0x41')](_0x27565f);if(_0x27565f['globalStatus'][_0xa450('0x1e')](_0xa450('0x14'))){_0x3c09e8[_0xa450('0x34')](function(_0x105cb1){if(_0x27565f[_0x105cb1+_0xa450('0x36')]){if(_0x105cb1===_0xa450('0x42')){if(_0x27565f[_0xa450('0x43')]!==_0xa450('0x44')){_0x27565f[_0xa450('0x43')]=_0xa450('0x14');}}else{_0x27565f[_0x105cb1+_0xa450('0x45')]=_0xa450('0x14');}}});}return _0x27565f;});})[_0xa450('0x17')](function(_0x54143a){if(!_0x5a3962||_0x4f901b){return _0x54143a;}return rta[_0xa450('0x46')](_0x54143a,_0x5a3962);})['then'](function(_0x43f351){var _0x1c9e13=rta[_0xa450('0x47')]();_0x5681d3[_0xa450('0x26')]=_0x43f351['map'](function(_0x3471fb){return _[_0xa450('0x48')](_0x3471fb,_0x1c9e13);});return _0x5681d3;})[_0xa450('0x17')](respondWithFilteredResult(_0x1fba8b,_0x43bc7e))[_0xa450('0x49')](APIHandleError(_0x1fba8b));};exports[_0xa450('0x4a')]=function(_0xca22a5,_0x223d96){var _0x597687={'count':0x0,'rows':[]};var _0x2340b5={};var _0x44169b;var _0x35f3dd;var _0x154abe;Promise[_0xa450('0x16')]()[_0xa450('0x17')](function(){if(_0xca22a5[_0xa450('0x11')]['channel']){if(!utils[_0xa450('0x19')](_0xca22a5['query']['channel'])){throw new APIBadRequestError(util[_0xa450('0x1a')](_0xa450('0x1b'),_0xca22a5['query'][_0xa450('0x18')]));}_0x44169b=_0xca22a5['query']['channel'][_0xa450('0x1c')]();}var _0x4c04f7=_[_0xa450('0x4b')](_0x44169b)+_0xa450('0x4c');var _0x5c0dbc=_[_0xa450('0x3e')](db[_0x4c04f7]['rawAttributes'],function(_0x288e1b){return{'name':_0x288e1b[_0xa450('0x2a')],'type':_0x288e1b[_0xa450('0x2b')][_0xa450('0x2c')]};});if(!_0xca22a5[_0xa450('0x11')][_0xa450('0x21')]){var _0x1a9f12=['id',_0xa450('0x4d')];if(_0x44169b==='voice'){_0x1a9f12[_0xa450('0x35')]('type');if(_0xca22a5[_0xa450('0x11')][_0xa450('0x2b')]===_0xa450('0x4e')){_0x1a9f12[_0xa450('0x35')]([_0xa450('0x4f'),_0xa450('0x50')]);}}_0xca22a5['query'][_0xa450('0x21')]=_0x1a9f12[_0xa450('0x22')](',');}_0x2340b5=qs[_0xa450('0x2f')](_0x5c0dbc,_0xca22a5);if(_0xca22a5[_0xa450('0x38')][_0xa450('0x2d')]===_0xa450('0x38')){var _0x4c22d5={'params':{'id':_0xca22a5[_0xa450('0x38')][_0xa450('0x51')]},'query':{'section':_0x44169b===_0xa450('0x42')&&_0xca22a5['query'][_0xa450('0x2b')]===_0xa450('0x4e')?'QueueCampaigns':_[_0xa450('0x4b')](_0x44169b)+_0xa450('0x52'),'type':_0xca22a5['query'][_0xa450('0x2b')],'nolimit':!![],'sort':_0xa450('0x4d'),'filter':_0xca22a5['query'][_0xa450('0x53')]}};_0x4c22d5[_0xa450('0x11')]=Object[_0xa450('0x3b')](_0x4c22d5[_0xa450('0x11')],_0xca22a5[_0xa450('0x11')]);delete _0x4c22d5['query']['id'];return db['UserProfile'][_0xa450('0x54')](_0x4c22d5);}return db[_0x4c04f7][_0xa450('0x3d')](_0x2340b5);})[_0xa450('0x17')](function(_0x49658b){_0x597687[_0xa450('0xa')]=_0x49658b[_0xa450('0xa')];_0x35f3dd=_0x49658b[_0xa450('0x26')];return rtq[_0xa450('0x55')](_0xca22a5,_0x44169b);})['then'](function(_0x1d0762){_0x154abe=_0x1d0762[_0xa450('0x26')];return rtq['initializeQueues'](_0x35f3dd,_0x154abe,_0x44169b,_0xca22a5[_0xa450('0x11')][_0xa450('0x2b')]);})[_0xa450('0x17')](function(_0x35794f){_0x597687[_0xa450('0x26')]=_0x35794f;return _0x597687;})[_0xa450('0x17')](respondWithFilteredResult(_0x223d96,_0x2340b5))[_0xa450('0x49')](APIHandleError(_0x223d96));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 59cce62..aebae37 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x427935,_0x71fb83){var _0x5a8288=function(_0x90a524){while(--_0x90a524){_0x427935['push'](_0x427935['shift']());}};_0x5a8288(++_0x71fb83);}(_0xedd9,0xfc));var _0x9edd=function(_0x2d0ef5,_0x5621a4){_0x2d0ef5=_0x2d0ef5-0x0;var _0x550979=_0xedd9[_0x2d0ef5];return _0x550979;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x41b15f,_0x1e6e75){var _0x38bb1d=function(_0x591b5e){while(--_0x591b5e){_0x41b15f['push'](_0x41b15f['shift']());}};_0x38bb1d(++_0x1e6e75);}(_0xe706,0xa3));var _0x6e70=function(_0x36c063,_0x233be3){_0x36c063=_0x36c063-0x0;var _0x1b6102=_0xe706[_0x36c063];return _0x1b6102;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ffae9ea..832322d 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 _0x2484=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x27f903,_0x3212c1){var _0x371513=function(_0x2be072){while(--_0x2be072){_0x27f903['push'](_0x27f903['shift']());}};_0x371513(++_0x3212c1);}(_0x2484,0x178));var _0x4248=function(_0x5e7ee9,_0x4dbc4b){_0x5e7ee9=_0x5e7ee9-0x0;var _0xadb900=_0x2484[_0x5e7ee9];return _0xadb900;};'use strict';var Sequelize=require(_0x4248('0x0'));module[_0x4248('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4248('0x2')]},'scheduledat':{'type':Sequelize[_0x4248('0x3')]},'uniqueid':{'type':Sequelize[_0x4248('0x2')]},'starttime':{'type':Sequelize[_0x4248('0x3')]},'responsetime':{'type':Sequelize[_0x4248('0x3')]},'ringtime':{'type':Sequelize[_0x4248('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4248('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4248('0x2')]}}; \ No newline at end of file +var _0x0650=['DATE','sequelize','INTEGER','STRING'];(function(_0xa7968a,_0x124ce8){var _0x5ddefd=function(_0x1ae1d8){while(--_0x1ae1d8){_0xa7968a['push'](_0xa7968a['shift']());}};_0x5ddefd(++_0x124ce8);}(_0x0650,0xed));var _0x0065=function(_0x150533,_0x4d1976){_0x150533=_0x150533-0x0;var _0xe51556=_0x0650[_0x150533];return _0xe51556;};'use strict';var Sequelize=require(_0x0065('0x0'));module['exports']={'state':{'type':Sequelize[_0x0065('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0065('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x0065('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0065('0x3')]},'ringtime':{'type':Sequelize[_0x0065('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0065('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0065('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a29dacd..5cb5161 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 _0x8e61=['exports','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x8e61,0xcf));var _0x18e6=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x8e61[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x18e6('0x0'));var util=require('util');var logger=require(_0x18e6('0x1'))(_0x18e6('0x2'));var moment=require(_0x18e6('0x3'));var BPromise=require(_0x18e6('0x4'));var rp=require(_0x18e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18e6('0x6'));var config=require(_0x18e6('0x7'));var attributes=require(_0x18e6('0x8'));module[_0x18e6('0x9')]=function(_0x3ed092,_0x1bdd65){return _0x3ed092['define'](_0x18e6('0xa'),attributes,{'tableName':_0x18e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc21=['../../config/logger','moment','bluebird','path','rimraf','exports','define','ReportAgentPreview','report_agent_preview','util'];(function(_0x15fab8,_0x31c76d){var _0x56064d=function(_0x159764){while(--_0x159764){_0x15fab8['push'](_0x15fab8['shift']());}};_0x56064d(++_0x31c76d);}(_0xdc21,0xc7));var _0x1dc2=function(_0x11e105,_0x1191e2){_0x11e105=_0x11e105-0x0;var _0x2e9dc=_0xdc21[_0x11e105];return _0x2e9dc;};'use strict';var _=require('lodash');var util=require(_0x1dc2('0x0'));var logger=require(_0x1dc2('0x1'))('api');var moment=require(_0x1dc2('0x2'));var BPromise=require(_0x1dc2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1dc2('0x4'));var rimraf=require(_0x1dc2('0x5'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0x1dc2('0x6')]=function(_0xdd4352,_0x18f153){return _0xdd4352[_0x1dc2('0x7')](_0x1dc2('0x8'),attributes,{'tableName':_0x1dc2('0x9'),'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 82f0392..6e2cbf3 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 _0x30b9=['create','body','options','raw','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview'];(function(_0x237e36,_0x30d6ae){var _0xf89afa=function(_0x28b30a){while(--_0x28b30a){_0x237e36['push'](_0x237e36['shift']());}};_0xf89afa(++_0x30d6ae);}(_0x30b9,0x79));var _0x930b=function(_0x1c9256,_0x266ae0){_0x1c9256=_0x1c9256-0x0;var _0x3ef89b=_0x30b9[_0x1c9256];return _0x3ef89b;};'use strict';var _=require(_0x930b('0x0'));var util=require('util');var moment=require(_0x930b('0x1'));var BPromise=require(_0x930b('0x2'));var rs=require(_0x930b('0x3'));var fs=require('fs');var Redis=require(_0x930b('0x4'));var db=require(_0x930b('0x5'))['db'];var utils=require(_0x930b('0x6'));var logger=require('../../config/logger')(_0x930b('0x7'));var config=require(_0x930b('0x8'));var jayson=require(_0x930b('0x9'));var client=jayson['client'][_0x930b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d8080,_0x1827f1,_0x19047e){return new BPromise(function(_0x418454,_0x24bbc7){return client[_0x930b('0xb')](_0x3d8080,_0x19047e)['then'](function(_0x3706f3){logger[_0x930b('0xc')](_0x930b('0xd'),_0x1827f1,_0x930b('0xe'));logger[_0x930b('0xf')](_0x930b('0x10'),_0x1827f1,_0x930b('0xe'),JSON[_0x930b('0x11')](_0x3706f3));if(_0x3706f3[_0x930b('0x12')]){if(_0x3706f3[_0x930b('0x12')][_0x930b('0x13')]===0x1f4){logger[_0x930b('0x12')](_0x930b('0xd'),_0x1827f1,_0x3706f3[_0x930b('0x12')]['message']);return _0x24bbc7(_0x3706f3[_0x930b('0x12')][_0x930b('0x14')]);}logger[_0x930b('0x12')](_0x930b('0xd'),_0x1827f1,_0x3706f3[_0x930b('0x12')][_0x930b('0x14')]);return _0x418454(_0x3706f3[_0x930b('0x12')]['message']);}else{logger['info'](_0x930b('0xd'),_0x1827f1,_0x930b('0xe'));_0x418454(_0x3706f3[_0x930b('0x15')]['message']);}})[_0x930b('0x16')](function(_0x22bbda){logger['error'](_0x930b('0xd'),_0x1827f1,_0x22bbda);_0x24bbc7(_0x22bbda);});});}exports[_0x930b('0x17')]=function(_0x12eff3){var _0x5d179e=this;return new Promise(function(_0x1fd62e,_0x4823c7){return db['ReportAgentPreview'][_0x930b('0x18')](_0x12eff3[_0x930b('0x19')],{'raw':_0x12eff3['options']?_0x12eff3[_0x930b('0x1a')][_0x930b('0x1b')]===undefined?!![]:![]:!![]})[_0x930b('0x1c')](function(_0x1cda17){logger[_0x930b('0xc')]('CreateReportAgentPreview',_0x12eff3);logger[_0x930b('0xf')](_0x930b('0x17'),_0x12eff3,JSON['stringify'](_0x1cda17));_0x1fd62e(_0x1cda17);})[_0x930b('0x16')](function(_0x232019){logger[_0x930b('0x12')](_0x930b('0x17'),_0x232019['message'],_0x12eff3);_0x4823c7(_0x5d179e[_0x930b('0x12')](0x1f4,_0x232019[_0x930b('0x14')]));});});}; \ No newline at end of file +var _0x9f24=['catch','CreateReportAgentPreview','ReportAgentPreview','create','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result'];(function(_0x4a04de,_0x2e342c){var _0xbbe018=function(_0x39639c){while(--_0x39639c){_0x4a04de['push'](_0x4a04de['shift']());}};_0xbbe018(++_0x2e342c);}(_0x9f24,0x13d));var _0x49f2=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x9f24[_0x489b87];return _0x1823b6;};'use strict';var _=require(_0x49f2('0x0'));var util=require(_0x49f2('0x1'));var moment=require(_0x49f2('0x2'));var BPromise=require(_0x49f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x49f2('0x4'));var logger=require(_0x49f2('0x5'))(_0x49f2('0x6'));var config=require('../../config/environment');var jayson=require(_0x49f2('0x7'));var client=jayson[_0x49f2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c097d,_0x2871d7,_0x13ddf7){return new BPromise(function(_0x183275,_0x5fc678){return client[_0x49f2('0x9')](_0x4c097d,_0x13ddf7)[_0x49f2('0xa')](function(_0x48571f){logger[_0x49f2('0xb')](_0x49f2('0xc'),_0x2871d7,_0x49f2('0xd'));logger[_0x49f2('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2871d7,'request\x20sent',JSON['stringify'](_0x48571f));if(_0x48571f['error']){if(_0x48571f['error'][_0x49f2('0xf')]===0x1f4){logger['error'](_0x49f2('0xc'),_0x2871d7,_0x48571f[_0x49f2('0x10')][_0x49f2('0x11')]);return _0x5fc678(_0x48571f[_0x49f2('0x10')][_0x49f2('0x11')]);}logger[_0x49f2('0x10')](_0x49f2('0xc'),_0x2871d7,_0x48571f[_0x49f2('0x10')][_0x49f2('0x11')]);return _0x183275(_0x48571f[_0x49f2('0x10')]['message']);}else{logger[_0x49f2('0xb')](_0x49f2('0xc'),_0x2871d7,_0x49f2('0xd'));_0x183275(_0x48571f[_0x49f2('0x12')][_0x49f2('0x11')]);}})[_0x49f2('0x13')](function(_0xb12012){logger[_0x49f2('0x10')](_0x49f2('0xc'),_0x2871d7,_0xb12012);_0x5fc678(_0xb12012);});});}exports[_0x49f2('0x14')]=function(_0x3957b0){var _0x435b94=this;return new Promise(function(_0x2eb85d,_0x33b7c3){return db[_0x49f2('0x15')][_0x49f2('0x16')](_0x3957b0['body'],{'raw':_0x3957b0['options']?_0x3957b0['options']['raw']===undefined?!![]:![]:!![]})[_0x49f2('0xa')](function(_0x15034b){logger['info'](_0x49f2('0x14'),_0x3957b0);logger['debug'](_0x49f2('0x14'),_0x3957b0,JSON[_0x49f2('0x17')](_0x15034b));_0x2eb85d(_0x15034b);})[_0x49f2('0x13')](function(_0x2861ef){logger['error']('CreateReportAgentPreview',_0x2861ef[_0x49f2('0x11')],_0x3957b0);_0x33b7c3(_0x435b94[_0x49f2('0x10')](0x1f4,_0x2861ef[_0x49f2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 8760667..ce94c42 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 _0xc160=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','post','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/whatsapp/queues','whatsappQueues','faxQueues'];(function(_0xcc10aa,_0x10907c){var _0x3350f7=function(_0x26f5c1){while(--_0x26f5c1){_0xcc10aa['push'](_0xcc10aa['shift']());}};_0x3350f7(++_0x10907c);}(_0xc160,0xd5));var _0x0c16=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0xc160[_0x257017];return _0x38536d;};'use strict';var multer=require(_0x0c16('0x0'));var util=require(_0x0c16('0x1'));var path=require(_0x0c16('0x2'));var express=require('express');var router=express[_0x0c16('0x3')]();var auth=require(_0x0c16('0x4'));var controller=require(_0x0c16('0x5'));router[_0x0c16('0x6')](_0x0c16('0x7'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x9')]);router[_0x0c16('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x0c16('0x8')](),controller[_0x0c16('0xa')]);router[_0x0c16('0x6')](_0x0c16('0xb'),auth[_0x0c16('0x8')](),controller[_0x0c16('0xc')]);router[_0x0c16('0x6')](_0x0c16('0xd'),auth[_0x0c16('0x8')](),controller[_0x0c16('0xe')]);router[_0x0c16('0x6')]('/chat/queues',auth[_0x0c16('0x8')](),controller[_0x0c16('0xf')]);router['get'](_0x0c16('0x10'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x11')]);router[_0x0c16('0x6')](_0x0c16('0x12'),auth['isAuthenticated'](),controller[_0x0c16('0x13')]);router[_0x0c16('0x6')](_0x0c16('0x14'),auth[_0x0c16('0x8')](),controller['openchannelQueues']);router[_0x0c16('0x6')]('/sms/queues',auth[_0x0c16('0x8')](),controller['smsQueues']);router[_0x0c16('0x6')](_0x0c16('0x15'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x16')]);router[_0x0c16('0x6')]('/fax/queues',auth[_0x0c16('0x8')](),controller[_0x0c16('0x17')]);router[_0x0c16('0x6')](_0x0c16('0x18'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x19')]);router[_0x0c16('0x6')](_0x0c16('0x1a'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x1b')]);router[_0x0c16('0x6')](_0x0c16('0x1c'),auth[_0x0c16('0x8')](),controller['voiceQueuesChannel']);router[_0x0c16('0x6')](_0x0c16('0x1d'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x1e')]);router[_0x0c16('0x6')](_0x0c16('0x1f'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x20')]);router[_0x0c16('0x6')]('/voice/queues/:id',auth[_0x0c16('0x8')](),controller[_0x0c16('0x21')]);router[_0x0c16('0x22')](_0x0c16('0x23'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x24')]);router[_0x0c16('0x6')](_0x0c16('0x25'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x26')]);router['get'](_0x0c16('0x27'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x28')]);router[_0x0c16('0x6')](_0x0c16('0x29'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x2a')]);router[_0x0c16('0x22')]('/agents/:id/capacity',auth[_0x0c16('0x8')](),controller[_0x0c16('0x2b')]);router[_0x0c16('0x6')]('/telephones',auth[_0x0c16('0x8')](),controller[_0x0c16('0x2c')]);router[_0x0c16('0x6')](_0x0c16('0x2d'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x2e')]);router[_0x0c16('0x6')](_0x0c16('0x2f'),auth['isAuthenticated'](),controller['campaigns']);router[_0x0c16('0x6')](_0x0c16('0x30'),auth[_0x0c16('0x8')](),controller['faxAccounts']);router[_0x0c16('0x6')](_0x0c16('0x31'),auth[_0x0c16('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x0c16('0x6')](_0x0c16('0x32'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x33')]);router[_0x0c16('0x6')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x0c16('0x6')](_0x0c16('0x34'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x0c16('0x6')](_0x0c16('0x35'),auth[_0x0c16('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x0c16('0x6')](_0x0c16('0x36'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x37')]);router['get']('/fax/queues/waitinginteractions',auth[_0x0c16('0x8')](),controller[_0x0c16('0x38')]);router['post']('/mail/queues/:id/notify',auth[_0x0c16('0x8')](),controller['queueNotify']('mail'));router[_0x0c16('0x6')](_0x0c16('0x39'),auth[_0x0c16('0x8')](),controller['showMailQueues']);router['post'](_0x0c16('0x3a'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3b')](_0x0c16('0x3c')));router['get'](_0x0c16('0x3d'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3e')]);router['post'](_0x0c16('0x3f'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3b')](_0x0c16('0x40')));router[_0x0c16('0x6')]('/fax/queues/:id',auth[_0x0c16('0x8')](),controller[_0x0c16('0x41')]);router[_0x0c16('0x42')](_0x0c16('0x43'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3b')](_0x0c16('0x44')));router[_0x0c16('0x6')](_0x0c16('0x45'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x46')]);router['post'](_0x0c16('0x47'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3b')](_0x0c16('0x48')));router[_0x0c16('0x42')](_0x0c16('0x49'),auth[_0x0c16('0x8')](),controller['queueNotify'](_0x0c16('0x4a')));router[_0x0c16('0x6')]('/sms/queues/:id',auth[_0x0c16('0x8')](),controller[_0x0c16('0x4b')]);router[_0x0c16('0x6')]('/whatsapp/queues/:id',auth[_0x0c16('0x8')](),controller[_0x0c16('0x4c')]);router[_0x0c16('0x42')](_0x0c16('0x4d'),auth['isAuthenticated'](),controller[_0x0c16('0x4e')]);module['exports']=router; \ No newline at end of file +var _0x4940=['whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','express','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x4940,0x15a));var _0x0494=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4940[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x0494('0x0'));var util=require(_0x0494('0x1'));var path=require('path');var express=require(_0x0494('0x2'));var router=express['Router']();var auth=require(_0x0494('0x3'));var controller=require('./rpc.controller');router[_0x0494('0x4')](_0x0494('0x5'),auth[_0x0494('0x6')](),controller['voiceChannels']);router[_0x0494('0x4')](_0x0494('0x7'),auth[_0x0494('0x6')](),controller['voiceChannelMixMonitor']);router[_0x0494('0x4')](_0x0494('0x8'),auth[_0x0494('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0x0494('0x4')]('/voice/queues',auth['isAuthenticated'](),controller[_0x0494('0x9')]);router[_0x0494('0x4')](_0x0494('0xa'),auth['isAuthenticated'](),controller[_0x0494('0xb')]);router[_0x0494('0x4')](_0x0494('0xc'),auth[_0x0494('0x6')](),controller['mailQueues']);router[_0x0494('0x4')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x0494('0xd')]);router[_0x0494('0x4')](_0x0494('0xe'),auth['isAuthenticated'](),controller[_0x0494('0xf')]);router[_0x0494('0x4')]('/sms/queues',auth[_0x0494('0x6')](),controller[_0x0494('0x10')]);router[_0x0494('0x4')](_0x0494('0x11'),auth[_0x0494('0x6')](),controller[_0x0494('0x12')]);router[_0x0494('0x4')]('/fax/queues',auth['isAuthenticated'](),controller[_0x0494('0x13')]);router['get'](_0x0494('0x14'),auth[_0x0494('0x6')](),controller[_0x0494('0x15')]);router['get'](_0x0494('0x16'),auth[_0x0494('0x6')](),controller[_0x0494('0x17')]);router['get'](_0x0494('0x18'),auth[_0x0494('0x6')](),controller[_0x0494('0x19')]);router[_0x0494('0x4')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x0494('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x0494('0x4')](_0x0494('0x1a'),auth[_0x0494('0x6')](),controller[_0x0494('0x1b')]);router['get'](_0x0494('0x1c'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x0494('0x1d')]('/voice/queues/:id',auth[_0x0494('0x6')](),controller[_0x0494('0x1e')]);router[_0x0494('0x4')](_0x0494('0x1f'),auth[_0x0494('0x6')](),controller[_0x0494('0x20')]);router[_0x0494('0x4')](_0x0494('0x21'),auth[_0x0494('0x6')](),controller[_0x0494('0x22')]);router[_0x0494('0x4')](_0x0494('0x23'),auth[_0x0494('0x6')](),controller[_0x0494('0x24')]);router['put'](_0x0494('0x25'),auth[_0x0494('0x6')](),controller[_0x0494('0x26')]);router['get'](_0x0494('0x27'),auth[_0x0494('0x6')](),controller[_0x0494('0x28')]);router['get'](_0x0494('0x29'),auth[_0x0494('0x6')](),controller[_0x0494('0x2a')]);router[_0x0494('0x4')](_0x0494('0x2b'),auth[_0x0494('0x6')](),controller[_0x0494('0x2c')]);router[_0x0494('0x4')](_0x0494('0x2d'),auth[_0x0494('0x6')](),controller['faxAccounts']);router['get'](_0x0494('0x2e'),auth[_0x0494('0x6')](),controller['chatQueuesWaitingInteractions']);router[_0x0494('0x4')](_0x0494('0x2f'),auth[_0x0494('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x0494('0x4')](_0x0494('0x30'),auth[_0x0494('0x6')](),controller[_0x0494('0x31')]);router['get'](_0x0494('0x32'),auth[_0x0494('0x6')](),controller[_0x0494('0x33')]);router[_0x0494('0x4')](_0x0494('0x34'),auth[_0x0494('0x6')](),controller[_0x0494('0x35')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x0494('0x6')](),controller[_0x0494('0x36')]);router['get'](_0x0494('0x37'),auth['isAuthenticated'](),controller[_0x0494('0x38')]);router[_0x0494('0x39')](_0x0494('0x3a'),auth[_0x0494('0x6')](),controller[_0x0494('0x3b')]('mail'));router['get'](_0x0494('0x3c'),auth[_0x0494('0x6')](),controller[_0x0494('0x3d')]);router['post'](_0x0494('0x3e'),auth['isAuthenticated'](),controller['queueNotify'](_0x0494('0x3f')));router[_0x0494('0x4')]('/chat/queues/:id',auth[_0x0494('0x6')](),controller[_0x0494('0x40')]);router[_0x0494('0x39')]('/fax/queues/:id/notify',auth[_0x0494('0x6')](),controller[_0x0494('0x3b')]('fax'));router[_0x0494('0x4')](_0x0494('0x41'),auth[_0x0494('0x6')](),controller[_0x0494('0x42')]);router['post'](_0x0494('0x43'),auth[_0x0494('0x6')](),controller[_0x0494('0x3b')](_0x0494('0x44')));router['get'](_0x0494('0x45'),auth[_0x0494('0x6')](),controller[_0x0494('0x46')]);router[_0x0494('0x39')](_0x0494('0x47'),auth[_0x0494('0x6')](),controller[_0x0494('0x3b')](_0x0494('0x48')));router[_0x0494('0x39')](_0x0494('0x49'),auth[_0x0494('0x6')](),controller[_0x0494('0x3b')](_0x0494('0x4a')));router[_0x0494('0x4')](_0x0494('0x4b'),auth[_0x0494('0x6')](),controller['showSmsQueues']);router[_0x0494('0x4')](_0x0494('0x4c'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x0494('0x39')](_0x0494('0x4d'),auth[_0x0494('0x6')](),controller[_0x0494('0x4e')]);module[_0x0494('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 4f22b2b..ac2c996 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 _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file +var _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 76fc428..aeb80ec 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 _0xda18=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','update','delete','destroy'];(function(_0x4db810,_0x1d17b5){var _0x5bdc23=function(_0x365416){while(--_0x365416){_0x4db810['push'](_0x4db810['shift']());}};_0x5bdc23(++_0x1d17b5);}(_0xda18,0x7f));var _0x8da1=function(_0x11a3f5,_0x56ceff){_0x11a3f5=_0x11a3f5-0x0;var _0x39333a=_0xda18[_0x11a3f5];return _0x39333a;};'use strict';var multer=require(_0x8da1('0x0'));var util=require(_0x8da1('0x1'));var path=require(_0x8da1('0x2'));var timeout=require(_0x8da1('0x3'));var express=require(_0x8da1('0x4'));var router=express[_0x8da1('0x5')]();var fs_extra=require(_0x8da1('0x6'));var auth=require(_0x8da1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8da1('0x8'));var controller=require('./schedule.controller');router[_0x8da1('0x9')]('/',auth[_0x8da1('0xa')](),controller[_0x8da1('0xb')]);router[_0x8da1('0x9')](_0x8da1('0xc'),auth['isAuthenticated'](),controller[_0x8da1('0xd')]);router[_0x8da1('0x9')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8da1('0xc'),auth['isAuthenticated'](),controller[_0x8da1('0xe')]);router[_0x8da1('0xf')](_0x8da1('0xc'),auth[_0x8da1('0xa')](),controller[_0x8da1('0x10')]);module[_0x8da1('0x11')]=router; \ No newline at end of file +var _0x16b9=['isAuthenticated','index','/:id','show','get','/:id/run','create','put','update','delete','destroy','exports','express','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x16b9,0x1b5));var _0x916b=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x16b9[_0x4e676e];return _0x336a3c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x916b('0x0'));var router=express['Router']();var fs_extra=require(_0x916b('0x1'));var auth=require(_0x916b('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x916b('0x3'));var controller=require(_0x916b('0x4'));router['get']('/',auth[_0x916b('0x5')](),controller[_0x916b('0x6')]);router['get'](_0x916b('0x7'),auth[_0x916b('0x5')](),controller[_0x916b('0x8')]);router[_0x916b('0x9')](_0x916b('0xa'),auth[_0x916b('0x5')](),controller['run']);router['post']('/',auth[_0x916b('0x5')](),controller[_0x916b('0xb')]);router[_0x916b('0xc')](_0x916b('0x7'),auth[_0x916b('0x5')](),controller[_0x916b('0xd')]);router[_0x916b('0xe')](_0x916b('0x7'),auth['isAuthenticated'](),controller[_0x916b('0xf')]);module[_0x916b('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 1c06078..45a107a 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 _0xba80=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','weeks','days','hours','ENUM','csv','pdf','xlsx','custom','default','TEXT','sequelize'];(function(_0x1ba7ea,_0x833388){var _0x37a816=function(_0x129e3f){while(--_0x129e3f){_0x1ba7ea['push'](_0x1ba7ea['shift']());}};_0x37a816(++_0x833388);}(_0xba80,0xa1));var _0x0ba8=function(_0x6d18be,_0x2cdf00){_0x6d18be=_0x6d18be-0x0;var _0x24931a=_0xba80[_0x6d18be];return _0x24931a;};'use strict';var Sequelize=require(_0x0ba8('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ba8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0ba8('0x1')]},'active':{'type':Sequelize[_0x0ba8('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0ba8('0x1')],'allowNull':![],'defaultValue':_0x0ba8('0x3')},'startAt':{'type':Sequelize[_0x0ba8('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x0ba8('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x0ba8('0x5'),_0x0ba8('0x6'),_0x0ba8('0x7'),_0x0ba8('0x8'),_0x0ba8('0x9'),_0x0ba8('0xa'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x0ba8('0xb')](_0x0ba8('0xc'),_0x0ba8('0xd'),_0x0ba8('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x0ba8('0xb')](_0x0ba8('0xf'),_0x0ba8('0x10')),'allowNull':![],'defaultValue':_0x0ba8('0xf')},'sendMail':{'type':Sequelize[_0x0ba8('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0ba8('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x0ba8('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x0ba8('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaee2=['years','quarters','months','weeks','days','csv','pdf','default','custom','BOOLEAN','TEXT','sequelize','exports','STRING','DATE','ENUM'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xaee2,0x8b));var _0x2aee=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xaee2[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0x2aee('0x0'));module[_0x2aee('0x1')]={'name':{'type':Sequelize[_0x2aee('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2aee('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x2aee('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2aee('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2aee('0x4')](_0x2aee('0x5'),_0x2aee('0x6'),_0x2aee('0x7'),_0x2aee('0x8'),_0x2aee('0x9'),'hours','minutes'),'allowNull':![],'defaultValue':_0x2aee('0x9')},'output':{'type':Sequelize[_0x2aee('0x4')](_0x2aee('0xa'),_0x2aee('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0x2aee('0xa')},'type':{'type':Sequelize['ENUM']('custom',_0x2aee('0xc')),'allowNull':![],'defaultValue':_0x2aee('0xd')},'sendMail':{'type':Sequelize[_0x2aee('0xe')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2aee('0xf')]},'bcc':{'type':Sequelize[_0x2aee('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x2aee('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 081b4a9..f2c888c 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 _0x09e3=['map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','rimraf','fast-json-patch','bluebird','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Scheduler','error','stack','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09e3,0xd6));var _0x309e=function(_0x176f07,_0xf62723){_0x176f07=_0x176f07-0x0;var _0x56847f=_0x09e3[_0x176f07];return _0x56847f;};'use strict';var emlformat=require(_0x309e('0x0'));var rimraf=require(_0x309e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x309e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x309e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x309e('0x4'));var sox=require('sox');var csv=require(_0x309e('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x309e('0x6'));var squel=require('squel');var crypto=require(_0x309e('0x7'));var jsforce=require(_0x309e('0x8'));var deskjs=require(_0x309e('0x9'));var toCsv=require(_0x309e('0x5'));var querystring=require(_0x309e('0xa'));var Papa=require(_0x309e('0xb'));var Redis=require(_0x309e('0xc'));var authService=require(_0x309e('0xd'));var qs=require(_0x309e('0xe'));var as=require(_0x309e('0xf'));var hardwareService=require(_0x309e('0x10'));var logger=require(_0x309e('0x11'))(_0x309e('0x12'));var utils=require(_0x309e('0x13'));var config=require(_0x309e('0x14'));var licenseUtil=require(_0x309e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aede3,_0x4a81d6){_0x4a81d6=_0x4a81d6||0xcc;return function(_0x566483){if(_0x566483){return _0x3aede3[_0x309e('0x16')](_0x4a81d6);}return _0x3aede3[_0x309e('0x17')](_0x4a81d6)[_0x309e('0x18')]();};}function respondWithResult(_0x5992a9,_0x3afdf4){_0x3afdf4=_0x3afdf4||0xc8;return function(_0x3f82a6){if(_0x3f82a6){return _0x5992a9[_0x309e('0x17')](_0x3afdf4)[_0x309e('0x19')](_0x3f82a6);}};}function respondWithFilteredResult(_0x175cc5,_0x233225){return function(_0x534312){if(_0x534312){var _0x12cdb1=typeof _0x233225[_0x309e('0x1a')]===_0x309e('0x1b')&&typeof _0x233225[_0x309e('0x1c')]===_0x309e('0x1b');var _0x4748b3=_0x534312['count'];var _0x2dc333=_0x12cdb1?0x0:_0x233225[_0x309e('0x1a')];var _0x59aeb4=_0x12cdb1?_0x534312[_0x309e('0x1d')]:_0x233225[_0x309e('0x1a')]+_0x233225['limit'];var _0x5a9368;if(_0x59aeb4>=_0x4748b3){_0x59aeb4=_0x4748b3;_0x5a9368=0xc8;}else{_0x5a9368=0xce;}_0x175cc5[_0x309e('0x17')](_0x5a9368);return _0x175cc5[_0x309e('0x1e')](_0x309e('0x1f'),_0x2dc333+'-'+_0x59aeb4+'/'+_0x4748b3)[_0x309e('0x19')](_0x534312);}return null;};}function patchUpdates(_0x76d2fb){return function(_0xd28fc5){try{jsonpatch[_0x309e('0x20')](_0xd28fc5,_0x76d2fb,!![]);}catch(_0x4d8a80){return BPromise[_0x309e('0x21')](_0x4d8a80);}return _0xd28fc5[_0x309e('0x22')]();};}function saveUpdates(_0x3f8625,_0x47ef65){return function(_0x20f857){if(_0x20f857){return _0x20f857['update'](_0x3f8625)[_0x309e('0x23')](function(_0x4073f4){return _0x4073f4;});}return null;};}function removeEntity(_0x55cdfd,_0x2723c1){return function(_0x6b1043){if(_0x6b1043){return _0x6b1043[_0x309e('0x24')]()[_0x309e('0x23')](function(){var _0x472a17=_0x6b1043[_0x309e('0x25')]({'plain':!![]});var _0x59e5db=_0x309e('0x26');return db['UserProfileResource'][_0x309e('0x24')]({'where':{'type':_0x59e5db,'resourceId':_0x472a17['id']}})[_0x309e('0x23')](function(){return _0x6b1043;});})[_0x309e('0x23')](function(){_0x55cdfd[_0x309e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4402bd,_0x5116be){return function(_0x1ea5ee){if(!_0x1ea5ee){_0x4402bd[_0x309e('0x16')](0x194);}return _0x1ea5ee;};}function handleError(_0x537a7c,_0x5ec14b){_0x5ec14b=_0x5ec14b||0x1f4;return function(_0x14232a){logger[_0x309e('0x27')](_0x14232a[_0x309e('0x28')]);if(_0x14232a[_0x309e('0x29')]){delete _0x14232a['name'];}_0x537a7c[_0x309e('0x17')](_0x5ec14b)[_0x309e('0x2a')](_0x14232a);};}exports[_0x309e('0x2b')]=function(_0xf0e07c,_0x143742){var _0x3ecf9d={},_0x1776f4={},_0x8538af={'count':0x0,'rows':[]};var _0x368c41=_[_0x309e('0x2c')](db[_0x309e('0x2d')][_0x309e('0x2e')],function(_0x3a3602){return{'name':_0x3a3602[_0x309e('0x2f')],'type':_0x3a3602[_0x309e('0x30')][_0x309e('0x31')]};});_0x1776f4[_0x309e('0x32')]=_[_0x309e('0x2c')](_0x368c41,_0x309e('0x29'));_0x1776f4['query']=_[_0x309e('0x33')](_0xf0e07c[_0x309e('0x34')]);_0x1776f4[_0x309e('0x35')]=_[_0x309e('0x36')](_0x1776f4[_0x309e('0x32')],_0x1776f4['query']);_0x3ecf9d['attributes']=_[_0x309e('0x36')](_0x1776f4['model'],qs[_0x309e('0x37')](_0xf0e07c[_0x309e('0x34')][_0x309e('0x37')]));_0x3ecf9d[_0x309e('0x38')]=_0x3ecf9d['attributes'][_0x309e('0x39')]?_0x3ecf9d[_0x309e('0x38')]:_0x1776f4[_0x309e('0x32')];if(!_0xf0e07c[_0x309e('0x34')][_0x309e('0x3a')](_0x309e('0x3b'))){_0x3ecf9d[_0x309e('0x1c')]=qs[_0x309e('0x1c')](_0xf0e07c[_0x309e('0x34')][_0x309e('0x1c')]);_0x3ecf9d[_0x309e('0x1a')]=qs['offset'](_0xf0e07c[_0x309e('0x34')][_0x309e('0x1a')]);}_0x3ecf9d[_0x309e('0x3c')]=qs[_0x309e('0x3d')](_0xf0e07c[_0x309e('0x34')][_0x309e('0x3d')]);_0x3ecf9d[_0x309e('0x3e')]=qs[_0x309e('0x35')](_[_0x309e('0x3f')](_0xf0e07c[_0x309e('0x34')],_0x1776f4[_0x309e('0x35')]),_0x368c41);if(_0xf0e07c[_0x309e('0x34')][_0x309e('0x40')]){_0x3ecf9d[_0x309e('0x3e')]=_[_0x309e('0x41')](_0x3ecf9d[_0x309e('0x3e')],{'$or':_[_0x309e('0x2c')](_0x368c41,function(_0xbe7877){if(_0xbe7877[_0x309e('0x30')]!==_0x309e('0x42')){var _0xa73bc3={};_0xa73bc3[_0xbe7877[_0x309e('0x29')]]={'$like':'%'+_0xf0e07c['query'][_0x309e('0x40')]+'%'};return _0xa73bc3;}})});}_0x3ecf9d=_[_0x309e('0x41')]({},_0x3ecf9d,_0xf0e07c[_0x309e('0x43')]);var _0x5ce669={'where':_0x3ecf9d['where']};return db[_0x309e('0x2d')][_0x309e('0x1d')](_0x5ce669)[_0x309e('0x23')](function(_0xabc744){_0x8538af['count']=_0xabc744;if(_0xf0e07c['query']['includeAll']){_0x3ecf9d[_0x309e('0x44')]=[{'all':!![]}];}return db[_0x309e('0x2d')]['findAll'](_0x3ecf9d);})[_0x309e('0x23')](function(_0x312a19){_0x8538af[_0x309e('0x45')]=_0x312a19;return _0x8538af;})['then'](respondWithFilteredResult(_0x143742,_0x3ecf9d))['catch'](handleError(_0x143742,null));};exports[_0x309e('0x46')]=function(_0xc0b965,_0x5089ab){var _0x54a65e={'raw':![],'where':{'id':_0xc0b965[_0x309e('0x47')]['id']}},_0x519e71={};_0x519e71[_0x309e('0x32')]=_[_0x309e('0x33')](db[_0x309e('0x2d')][_0x309e('0x2e')]);_0x519e71[_0x309e('0x34')]=_[_0x309e('0x33')](_0xc0b965[_0x309e('0x34')]);_0x519e71[_0x309e('0x35')]=_[_0x309e('0x36')](_0x519e71[_0x309e('0x32')],_0x519e71[_0x309e('0x34')]);_0x54a65e[_0x309e('0x38')]=_['intersection'](_0x519e71[_0x309e('0x32')],qs[_0x309e('0x37')](_0xc0b965[_0x309e('0x34')][_0x309e('0x37')]));_0x54a65e[_0x309e('0x38')]=_0x54a65e[_0x309e('0x38')][_0x309e('0x39')]?_0x54a65e['attributes']:_0x519e71['model'];if(_0xc0b965[_0x309e('0x34')]['includeAll']){_0x54a65e[_0x309e('0x44')]=[{'all':!![]}];}_0x54a65e=_[_0x309e('0x41')]({},_0x54a65e,_0xc0b965['options']);return db[_0x309e('0x2d')][_0x309e('0x48')](_0x54a65e)[_0x309e('0x23')](handleEntityNotFound(_0x5089ab,null))[_0x309e('0x23')](respondWithResult(_0x5089ab,null))[_0x309e('0x49')](handleError(_0x5089ab,null));};exports[_0x309e('0x4a')]=function(_0x18fa32,_0x9bf320){return db[_0x309e('0x2d')][_0x309e('0x4a')](_0x18fa32[_0x309e('0x4b')],{})['then'](function(_0x139df1){var _0x2d9408=_0x18fa32['user'][_0x309e('0x25')]({'plain':!![]});if(!_0x2d9408)throw new Error(_0x309e('0x4c'));if(_0x2d9408[_0x309e('0x4d')]===_0x309e('0x4e')){var _0x14199c=_0x139df1[_0x309e('0x25')]({'plain':!![]});var _0xe581c8=_0x309e('0x26');return db[_0x309e('0x4f')]['find']({'where':{'name':_0xe581c8,'userProfileId':_0x2d9408[_0x309e('0x50')]},'raw':!![]})[_0x309e('0x23')](function(_0x2a0b06){if(_0x2a0b06&&_0x2a0b06[_0x309e('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x14199c[_0x309e('0x29')],'resourceId':_0x14199c['id'],'type':_0x2a0b06[_0x309e('0x29')],'sectionId':_0x2a0b06['id']},{})[_0x309e('0x23')](function(){return _0x139df1;});}else{return _0x139df1;}})[_0x309e('0x49')](function(_0x1bb09b){logger[_0x309e('0x27')](_0x309e('0x52'),_0x1bb09b);throw _0x1bb09b;});}return _0x139df1;})[_0x309e('0x23')](respondWithResult(_0x9bf320,0xc9))[_0x309e('0x49')](handleError(_0x9bf320,null));};exports[_0x309e('0x53')]=function(_0x12635e,_0x3cfefd){if(_0x12635e['body']['id']){delete _0x12635e[_0x309e('0x4b')]['id'];}return db['Schedule'][_0x309e('0x48')]({'where':{'id':_0x12635e['params']['id']}})[_0x309e('0x23')](handleEntityNotFound(_0x3cfefd,null))[_0x309e('0x23')](saveUpdates(_0x12635e[_0x309e('0x4b')],null))[_0x309e('0x23')](respondWithResult(_0x3cfefd,null))[_0x309e('0x49')](handleError(_0x3cfefd,null));};exports[_0x309e('0x24')]=function(_0x103896,_0x71eb6d){return db['Schedule'][_0x309e('0x48')]({'where':{'id':_0x103896[_0x309e('0x47')]['id']}})[_0x309e('0x23')](handleEntityNotFound(_0x71eb6d,null))['then'](removeEntity(_0x71eb6d,null))[_0x309e('0x49')](handleError(_0x71eb6d,null));};exports[_0x309e('0x54')]=function(_0x5301aa,_0x5ae8a5,_0x408ba8){var _0x57fe1b=require(_0x309e('0x55'));return db['Schedule'][_0x309e('0x48')]({'where':{'id':_0x5301aa[_0x309e('0x47')]['id']},'raw':!![]})[_0x309e('0x23')](handleEntityNotFound(_0x5ae8a5,null))['then'](function(){_0x57fe1b['run'](_0x5301aa[_0x309e('0x47')]['id']);})['then'](respondWithStatusCode(_0x5ae8a5,null))[_0x309e('0x49')](handleError(_0x5ae8a5,null));}; \ No newline at end of file +var _0x44cf=['../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','Scheduler','UserProfileResource','then','end','sendStatus','error','stack','name','send','Schedule','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','merge','map','include','rows','catch','show','rawAttributes','includeAll','options','find','create','body','role','get','UserProfileSection','userProfileId','autoAssociation','params','run','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x44cf,0x12d));var _0xf44c=function(_0x37f532,_0x539e1f){_0x37f532=_0x37f532-0x0;var _0x49547d=_0x44cf[_0x37f532];return _0x49547d;};'use strict';var emlformat=require(_0xf44c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf44c('0x1'));var jsonpatch=require(_0xf44c('0x2'));var rp=require('request-promise');var moment=require(_0xf44c('0x3'));var BPromise=require(_0xf44c('0x4'));var Mustache=require(_0xf44c('0x5'));var util=require(_0xf44c('0x6'));var path=require('path');var sox=require(_0xf44c('0x7'));var csv=require(_0xf44c('0x8'));var ejs=require(_0xf44c('0x9'));var fs=require('fs');var fs_extra=require(_0xf44c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf44c('0xb'));var deskjs=require(_0xf44c('0xc'));var toCsv=require(_0xf44c('0x8'));var querystring=require(_0xf44c('0xd'));var Papa=require(_0xf44c('0xe'));var Redis=require(_0xf44c('0xf'));var authService=require(_0xf44c('0x10'));var qs=require(_0xf44c('0x11'));var as=require(_0xf44c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf44c('0x13'))(_0xf44c('0x14'));var utils=require('../../config/utils');var config=require(_0xf44c('0x15'));var licenseUtil=require(_0xf44c('0x16'));var db=require(_0xf44c('0x17'))['db'];function respondWithStatusCode(_0x501369,_0x5a28d6){_0x5a28d6=_0x5a28d6||0xcc;return function(_0x29f3e7){if(_0x29f3e7){return _0x501369['sendStatus'](_0x5a28d6);}return _0x501369[_0xf44c('0x18')](_0x5a28d6)['end']();};}function respondWithResult(_0xd45eee,_0x271ae7){_0x271ae7=_0x271ae7||0xc8;return function(_0x13f0a6){if(_0x13f0a6){return _0xd45eee[_0xf44c('0x18')](_0x271ae7)[_0xf44c('0x19')](_0x13f0a6);}};}function respondWithFilteredResult(_0x2ad25a,_0x49f55b){return function(_0x15717b){if(_0x15717b){var _0x5cf5e0=typeof _0x49f55b[_0xf44c('0x1a')]==='undefined'&&typeof _0x49f55b['limit']===_0xf44c('0x1b');var _0x43c03a=_0x15717b[_0xf44c('0x1c')];var _0x43be61=_0x5cf5e0?0x0:_0x49f55b[_0xf44c('0x1a')];var _0x278ed0=_0x5cf5e0?_0x15717b[_0xf44c('0x1c')]:_0x49f55b[_0xf44c('0x1a')]+_0x49f55b[_0xf44c('0x1d')];var _0x5b733e;if(_0x278ed0>=_0x43c03a){_0x278ed0=_0x43c03a;_0x5b733e=0xc8;}else{_0x5b733e=0xce;}_0x2ad25a['status'](_0x5b733e);return _0x2ad25a[_0xf44c('0x1e')]('Content-Range',_0x43be61+'-'+_0x278ed0+'/'+_0x43c03a)[_0xf44c('0x19')](_0x15717b);}return null;};}function patchUpdates(_0x8f549c){return function(_0x58efa9){try{jsonpatch[_0xf44c('0x1f')](_0x58efa9,_0x8f549c,!![]);}catch(_0x513564){return BPromise[_0xf44c('0x20')](_0x513564);}return _0x58efa9[_0xf44c('0x21')]();};}function saveUpdates(_0x5d2ceb,_0x5f2d47){return function(_0x1819fe){if(_0x1819fe){return _0x1819fe[_0xf44c('0x22')](_0x5d2ceb)['then'](function(_0x1ea3dd){return _0x1ea3dd;});}return null;};}function removeEntity(_0x3063f6,_0x20afdb){return function(_0x45529e){if(_0x45529e){return _0x45529e[_0xf44c('0x23')]()['then'](function(){var _0x36918c=_0x45529e['get']({'plain':!![]});var _0x4027ff=_0xf44c('0x24');return db[_0xf44c('0x25')][_0xf44c('0x23')]({'where':{'type':_0x4027ff,'resourceId':_0x36918c['id']}})[_0xf44c('0x26')](function(){return _0x45529e;});})[_0xf44c('0x26')](function(){_0x3063f6[_0xf44c('0x18')](0xcc)[_0xf44c('0x27')]();});}};}function handleEntityNotFound(_0x30e548,_0x224eb8){return function(_0x4854c3){if(!_0x4854c3){_0x30e548[_0xf44c('0x28')](0x194);}return _0x4854c3;};}function handleError(_0x281cfb,_0x193e90){_0x193e90=_0x193e90||0x1f4;return function(_0x272bea){logger[_0xf44c('0x29')](_0x272bea[_0xf44c('0x2a')]);if(_0x272bea[_0xf44c('0x2b')]){delete _0x272bea[_0xf44c('0x2b')];}_0x281cfb[_0xf44c('0x18')](_0x193e90)[_0xf44c('0x2c')](_0x272bea);};}exports['index']=function(_0x21561c,_0x3959e9){var _0x415eda={},_0x2aa23b={},_0x394b25={'count':0x0,'rows':[]};var _0x4e33e7=_['map'](db[_0xf44c('0x2d')]['rawAttributes'],function(_0x3508bf){return{'name':_0x3508bf[_0xf44c('0x2e')],'type':_0x3508bf[_0xf44c('0x2f')][_0xf44c('0x30')]};});_0x2aa23b[_0xf44c('0x31')]=_['map'](_0x4e33e7,_0xf44c('0x2b'));_0x2aa23b['query']=_[_0xf44c('0x32')](_0x21561c[_0xf44c('0x33')]);_0x2aa23b[_0xf44c('0x34')]=_['intersection'](_0x2aa23b[_0xf44c('0x31')],_0x2aa23b['query']);_0x415eda[_0xf44c('0x35')]=_[_0xf44c('0x36')](_0x2aa23b[_0xf44c('0x31')],qs[_0xf44c('0x37')](_0x21561c['query']['fields']));_0x415eda[_0xf44c('0x35')]=_0x415eda[_0xf44c('0x35')][_0xf44c('0x38')]?_0x415eda['attributes']:_0x2aa23b[_0xf44c('0x31')];if(!_0x21561c[_0xf44c('0x33')][_0xf44c('0x39')]('nolimit')){_0x415eda[_0xf44c('0x1d')]=qs[_0xf44c('0x1d')](_0x21561c[_0xf44c('0x33')][_0xf44c('0x1d')]);_0x415eda[_0xf44c('0x1a')]=qs['offset'](_0x21561c[_0xf44c('0x33')][_0xf44c('0x1a')]);}_0x415eda['order']=qs['sort'](_0x21561c['query'][_0xf44c('0x3a')]);_0x415eda['where']=qs[_0xf44c('0x34')](_[_0xf44c('0x3b')](_0x21561c[_0xf44c('0x33')],_0x2aa23b[_0xf44c('0x34')]),_0x4e33e7);if(_0x21561c['query'][_0xf44c('0x3c')]){_0x415eda[_0xf44c('0x3d')]=_[_0xf44c('0x3e')](_0x415eda['where'],{'$or':_[_0xf44c('0x3f')](_0x4e33e7,function(_0x38a7d0){if(_0x38a7d0[_0xf44c('0x2f')]!=='VIRTUAL'){var _0x39e2ba={};_0x39e2ba[_0x38a7d0['name']]={'$like':'%'+_0x21561c['query'][_0xf44c('0x3c')]+'%'};return _0x39e2ba;}})});}_0x415eda=_[_0xf44c('0x3e')]({},_0x415eda,_0x21561c['options']);var _0x3c7019={'where':_0x415eda[_0xf44c('0x3d')]};return db[_0xf44c('0x2d')]['count'](_0x3c7019)[_0xf44c('0x26')](function(_0x101b46){_0x394b25['count']=_0x101b46;if(_0x21561c[_0xf44c('0x33')]['includeAll']){_0x415eda[_0xf44c('0x40')]=[{'all':!![]}];}return db[_0xf44c('0x2d')]['findAll'](_0x415eda);})[_0xf44c('0x26')](function(_0x2fe58a){_0x394b25[_0xf44c('0x41')]=_0x2fe58a;return _0x394b25;})[_0xf44c('0x26')](respondWithFilteredResult(_0x3959e9,_0x415eda))[_0xf44c('0x42')](handleError(_0x3959e9,null));};exports[_0xf44c('0x43')]=function(_0x27851b,_0x4cfae1){var _0x1aa4e4={'raw':![],'where':{'id':_0x27851b['params']['id']}},_0xdcb47b={};_0xdcb47b[_0xf44c('0x31')]=_[_0xf44c('0x32')](db[_0xf44c('0x2d')][_0xf44c('0x44')]);_0xdcb47b[_0xf44c('0x33')]=_['keys'](_0x27851b[_0xf44c('0x33')]);_0xdcb47b[_0xf44c('0x34')]=_[_0xf44c('0x36')](_0xdcb47b[_0xf44c('0x31')],_0xdcb47b[_0xf44c('0x33')]);_0x1aa4e4[_0xf44c('0x35')]=_[_0xf44c('0x36')](_0xdcb47b[_0xf44c('0x31')],qs[_0xf44c('0x37')](_0x27851b['query']['fields']));_0x1aa4e4[_0xf44c('0x35')]=_0x1aa4e4[_0xf44c('0x35')]['length']?_0x1aa4e4[_0xf44c('0x35')]:_0xdcb47b[_0xf44c('0x31')];if(_0x27851b[_0xf44c('0x33')][_0xf44c('0x45')]){_0x1aa4e4[_0xf44c('0x40')]=[{'all':!![]}];}_0x1aa4e4=_['merge']({},_0x1aa4e4,_0x27851b[_0xf44c('0x46')]);return db[_0xf44c('0x2d')][_0xf44c('0x47')](_0x1aa4e4)[_0xf44c('0x26')](handleEntityNotFound(_0x4cfae1,null))['then'](respondWithResult(_0x4cfae1,null))[_0xf44c('0x42')](handleError(_0x4cfae1,null));};exports['create']=function(_0x8d65a7,_0x49ee2c){return db[_0xf44c('0x2d')][_0xf44c('0x48')](_0x8d65a7[_0xf44c('0x49')],{})[_0xf44c('0x26')](function(_0x3b54d8){var _0x21d75f=_0x8d65a7['user']['get']({'plain':!![]});if(!_0x21d75f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21d75f[_0xf44c('0x4a')]==='user'){var _0x274976=_0x3b54d8[_0xf44c('0x4b')]({'plain':!![]});var _0x4a76ff='Scheduler';return db[_0xf44c('0x4c')][_0xf44c('0x47')]({'where':{'name':_0x4a76ff,'userProfileId':_0x21d75f[_0xf44c('0x4d')]},'raw':!![]})[_0xf44c('0x26')](function(_0x305fb5){if(_0x305fb5&&_0x305fb5[_0xf44c('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x274976[_0xf44c('0x2b')],'resourceId':_0x274976['id'],'type':_0x305fb5[_0xf44c('0x2b')],'sectionId':_0x305fb5['id']},{})[_0xf44c('0x26')](function(){return _0x3b54d8;});}else{return _0x3b54d8;}})[_0xf44c('0x42')](function(_0x464523){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x464523);throw _0x464523;});}return _0x3b54d8;})[_0xf44c('0x26')](respondWithResult(_0x49ee2c,0xc9))[_0xf44c('0x42')](handleError(_0x49ee2c,null));};exports[_0xf44c('0x22')]=function(_0x31d67b,_0x1edabc){if(_0x31d67b['body']['id']){delete _0x31d67b['body']['id'];}return db[_0xf44c('0x2d')][_0xf44c('0x47')]({'where':{'id':_0x31d67b[_0xf44c('0x4f')]['id']}})[_0xf44c('0x26')](handleEntityNotFound(_0x1edabc,null))[_0xf44c('0x26')](saveUpdates(_0x31d67b['body'],null))[_0xf44c('0x26')](respondWithResult(_0x1edabc,null))[_0xf44c('0x42')](handleError(_0x1edabc,null));};exports[_0xf44c('0x23')]=function(_0x453821,_0x50802c){return db[_0xf44c('0x2d')][_0xf44c('0x47')]({'where':{'id':_0x453821[_0xf44c('0x4f')]['id']}})[_0xf44c('0x26')](handleEntityNotFound(_0x50802c,null))[_0xf44c('0x26')](removeEntity(_0x50802c,null))['catch'](handleError(_0x50802c,null));};exports[_0xf44c('0x50')]=function(_0x1fc353,_0x2a1565,_0x2aa319){var _0x1439b9=require('../../config/schedule');return db[_0xf44c('0x2d')][_0xf44c('0x47')]({'where':{'id':_0x1fc353[_0xf44c('0x4f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2a1565,null))[_0xf44c('0x26')](function(){_0x1439b9['run'](_0x1fc353[_0xf44c('0x4f')]['id']);})[_0xf44c('0x26')](respondWithStatusCode(_0x2a1565,null))['catch'](handleError(_0x2a1565,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c6d1845..77c6ff7 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 _0x8375=['request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','api','bluebird'];(function(_0x3f3d28,_0x474b43){var _0x472743=function(_0x259b28){while(--_0x259b28){_0x3f3d28['push'](_0x3f3d28['shift']());}};_0x472743(++_0x474b43);}(_0x8375,0x97));var _0x5837=function(_0x5ee28e,_0x204ac2){_0x5ee28e=_0x5ee28e-0x0;var _0x3bf895=_0x8375[_0x5ee28e];return _0x3bf895;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var logger=require(_0x5837('0x2'))(_0x5837('0x3'));var moment=require('moment');var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require('rimraf');var config=require(_0x5837('0x7'));var attributes=require(_0x5837('0x8'));module[_0x5837('0x9')]=function(_0x104119,_0x480461){return _0x104119[_0x5837('0xa')](_0x5837('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8f9=['define','Schedule','tools_schedules','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0xe8f9,0x1f2));var _0x9e8f=function(_0x100e6b,_0x3ba80f){_0x100e6b=_0x100e6b-0x0;var _0x3478e2=_0xe8f9[_0x100e6b];return _0x3478e2;};'use strict';var _=require('lodash');var util=require(_0x9e8f('0x0'));var logger=require(_0x9e8f('0x1'))('api');var moment=require(_0x9e8f('0x2'));var BPromise=require(_0x9e8f('0x3'));var rp=require(_0x9e8f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e8f('0x5'));var config=require(_0x9e8f('0x6'));var attributes=require(_0x9e8f('0x7'));module['exports']=function(_0x4599ff,_0x4bf52a){return _0x4599ff[_0x9e8f('0x8')](_0x9e8f('0x9'),attributes,{'tableName':_0x9e8f('0xa'),'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 6b388fb..719f7e7 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 _0x204b=['code','Schedule,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error'];(function(_0x1dc15f,_0x3ce560){var _0x5c3da7=function(_0x2bf2e2){while(--_0x2bf2e2){_0x1dc15f['push'](_0x1dc15f['shift']());}};_0x5c3da7(++_0x3ce560);}(_0x204b,0x76));var _0xb204=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x204b[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0xb204('0x0'));var util=require(_0xb204('0x1'));var moment=require(_0xb204('0x2'));var BPromise=require(_0xb204('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb204('0x4'));var db=require(_0xb204('0x5'))['db'];var utils=require(_0xb204('0x6'));var logger=require(_0xb204('0x7'))(_0xb204('0x8'));var config=require(_0xb204('0x9'));var jayson=require(_0xb204('0xa'));var client=jayson[_0xb204('0xb')][_0xb204('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x361924,_0x107c65,_0x2ea49d){return new BPromise(function(_0x737253,_0x15305c){return client[_0xb204('0xd')](_0x361924,_0x2ea49d)[_0xb204('0xe')](function(_0xaea478){logger[_0xb204('0xf')]('Schedule,\x20%s,\x20%s',_0x107c65,_0xb204('0x10'));logger[_0xb204('0x11')](_0xb204('0x12'),_0x107c65,_0xb204('0x10'),JSON['stringify'](_0xaea478));if(_0xaea478[_0xb204('0x13')]){if(_0xaea478[_0xb204('0x13')][_0xb204('0x14')]===0x1f4){logger[_0xb204('0x13')](_0xb204('0x15'),_0x107c65,_0xaea478[_0xb204('0x13')][_0xb204('0x16')]);return _0x15305c(_0xaea478[_0xb204('0x13')][_0xb204('0x16')]);}logger[_0xb204('0x13')]('Schedule,\x20%s,\x20%s',_0x107c65,_0xaea478['error'][_0xb204('0x16')]);return _0x737253(_0xaea478[_0xb204('0x13')]['message']);}else{logger[_0xb204('0xf')](_0xb204('0x15'),_0x107c65,_0xb204('0x10'));_0x737253(_0xaea478['result'][_0xb204('0x16')]);}})['catch'](function(_0x5e9e09){logger[_0xb204('0x13')]('Schedule,\x20%s,\x20%s',_0x107c65,_0x5e9e09);_0x15305c(_0x5e9e09);});});} \ No newline at end of file +var _0x7c8a=['../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x42b9e1,_0x592b16){var _0xcb47=function(_0x10fdc5){while(--_0x10fdc5){_0x42b9e1['push'](_0x42b9e1['shift']());}};_0xcb47(++_0x592b16);}(_0x7c8a,0xb6));var _0xa7c8=function(_0x5efbf4,_0x151fca){_0x5efbf4=_0x5efbf4-0x0;var _0x36283c=_0x7c8a[_0x5efbf4];return _0x36283c;};'use strict';var _=require('lodash');var util=require(_0xa7c8('0x0'));var moment=require(_0xa7c8('0x1'));var BPromise=require(_0xa7c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7c8('0x3'))['db'];var utils=require(_0xa7c8('0x4'));var logger=require(_0xa7c8('0x5'))(_0xa7c8('0x6'));var config=require(_0xa7c8('0x7'));var jayson=require(_0xa7c8('0x8'));var client=jayson[_0xa7c8('0x9')][_0xa7c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x315032,_0x241fce,_0x57b68a){return new BPromise(function(_0x49aa9c,_0x2ca6ae){return client[_0xa7c8('0xb')](_0x315032,_0x57b68a)[_0xa7c8('0xc')](function(_0x394144){logger[_0xa7c8('0xd')](_0xa7c8('0xe'),_0x241fce,_0xa7c8('0xf'));logger[_0xa7c8('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x241fce,_0xa7c8('0xf'),JSON['stringify'](_0x394144));if(_0x394144[_0xa7c8('0x11')]){if(_0x394144[_0xa7c8('0x11')]['code']===0x1f4){logger[_0xa7c8('0x11')](_0xa7c8('0xe'),_0x241fce,_0x394144['error'][_0xa7c8('0x12')]);return _0x2ca6ae(_0x394144[_0xa7c8('0x11')][_0xa7c8('0x12')]);}logger[_0xa7c8('0x11')]('Schedule,\x20%s,\x20%s',_0x241fce,_0x394144['error'][_0xa7c8('0x12')]);return _0x49aa9c(_0x394144['error'][_0xa7c8('0x12')]);}else{logger[_0xa7c8('0xd')](_0xa7c8('0xe'),_0x241fce,'request\x20sent');_0x49aa9c(_0x394144[_0xa7c8('0x13')][_0xa7c8('0x12')]);}})[_0xa7c8('0x14')](function(_0x2f866f){logger['error'](_0xa7c8('0xe'),_0x241fce,_0x2f866f);_0x2ca6ae(_0x2f866f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 485d051..26853ba 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 _0xd381=['create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','post'];(function(_0x4b731e,_0x4a48bc){var _0x26ca45=function(_0x2217b9){while(--_0x2217b9){_0x4b731e['push'](_0x4b731e['shift']());}};_0x26ca45(++_0x4a48bc);}(_0xd381,0x165));var _0x1d38=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xd381[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require('multer');var util=require(_0x1d38('0x0'));var path=require('path');var timeout=require(_0x1d38('0x1'));var express=require(_0x1d38('0x2'));var router=express[_0x1d38('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1d38('0x4'));var interaction=require(_0x1d38('0x5'));var config=require(_0x1d38('0x6'));var controller=require(_0x1d38('0x7'));router['get']('/',auth[_0x1d38('0x8')](),controller[_0x1d38('0x9')]);router[_0x1d38('0xa')](_0x1d38('0xb'),auth[_0x1d38('0x8')](),controller[_0x1d38('0xc')]);router['get'](_0x1d38('0xd'),auth[_0x1d38('0x8')](),controller[_0x1d38('0xe')]);router['get'](_0x1d38('0xf'),auth[_0x1d38('0x8')](),controller['download']);router[_0x1d38('0x10')]('/',auth['isAuthenticated'](),controller[_0x1d38('0x11')]);router['put'](_0x1d38('0xd'),auth['isAuthenticated'](),controller[_0x1d38('0x12')]);router[_0x1d38('0x13')](_0x1d38('0xd'),auth['isAuthenticated'](),controller[_0x1d38('0x14')]);module[_0x1d38('0x15')]=router; \ No newline at end of file +var _0x0229=['/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0229,0xdb));var _0x9022=function(_0x1d16e1,_0x3d9e13){_0x1d16e1=_0x1d16e1-0x0;var _0x30c910=_0x0229[_0x1d16e1];return _0x30c910;};'use strict';var multer=require(_0x9022('0x0'));var util=require(_0x9022('0x1'));var path=require(_0x9022('0x2'));var timeout=require(_0x9022('0x3'));var express=require(_0x9022('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9022('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9022('0x6'));var controller=require('./screenRecording.controller');router[_0x9022('0x7')]('/',auth['isAuthenticated'](),controller[_0x9022('0x8')]);router[_0x9022('0x7')](_0x9022('0x9'),auth['isAuthenticated'](),controller[_0x9022('0xa')]);router[_0x9022('0x7')](_0x9022('0xb'),auth[_0x9022('0xc')](),controller[_0x9022('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x9022('0xe')]('/',auth[_0x9022('0xc')](),controller[_0x9022('0xf')]);router[_0x9022('0x10')](_0x9022('0xb'),auth['isAuthenticated'](),controller[_0x9022('0x11')]);router['delete'](_0x9022('0xb'),auth[_0x9022('0xc')](),controller[_0x9022('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 5c2af53..c6d8d9f 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 _0xf3e2=['closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','toString','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf3e2,0x168));var _0x2f3e=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0xf3e2[_0x9b5bb2];return _0x2e1e92;};'use strict';var Sequelize=require(_0x2f3e('0x0'));var moment=require(_0x2f3e('0x1'));var path=require(_0x2f3e('0x2'));var config=require(_0x2f3e('0x3'));module[_0x2f3e('0x4')]={'format':{'type':Sequelize[_0x2f3e('0x5')],'get':function(){return this[_0x2f3e('0x6')](_0x2f3e('0x7'))?path['extname'](this[_0x2f3e('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x2f3e('0x8')]},'channel':{'type':Sequelize[_0x2f3e('0x8')]},'value':{'type':Sequelize[_0x2f3e('0x8')],'set':function(_0x392f91){var _0x3b556b=_0x392f91[_0x2f3e('0x9')](/\\/g,'/');this[_0x2f3e('0xa')](_0x2f3e('0x7'),_0x3b556b);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2f3e('0xb')],'set':function(_0x4d7f7d){this[_0x2f3e('0xa')](_0x2f3e('0xc'),moment()[_0x2f3e('0xd')](_0x4d7f7d,'ms'));this[_0x2f3e('0xa')](_0x2f3e('0xe'),moment());this[_0x2f3e('0xa')](_0x2f3e('0xf'),_0x4d7f7d);}},'startedAt':{'type':Sequelize[_0x2f3e('0x10')],'get':function(){return moment(this[_0x2f3e('0x6')](_0x2f3e('0xc')))[_0x2f3e('0x11')](_0x2f3e('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0x2f3e('0x10')],'get':function(){return moment(this['getDataValue'](_0x2f3e('0xe')))[_0x2f3e('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x2f3e('0x10')],'get':function(){return moment(this[_0x2f3e('0x6')](_0x2f3e('0x13')))[_0x2f3e('0x11')](_0x2f3e('0x12'))[_0x2f3e('0x14')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2f3e('0x6')](_0x2f3e('0x15')))[_0x2f3e('0x11')](_0x2f3e('0x12'))['toString']();}}}; \ No newline at end of file +var _0x9e6d=['DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration'];(function(_0x551fdb,_0x4f24a9){var _0x54e6a2=function(_0x328979){while(--_0x328979){_0x551fdb['push'](_0x551fdb['shift']());}};_0x54e6a2(++_0x4f24a9);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x413a65,_0x4000d8){_0x413a65=_0x413a65-0x0;var _0x36ce4a=_0x9e6d[_0x413a65];return _0x36ce4a;};'use strict';var Sequelize=require(_0xd9e6('0x0'));var moment=require('moment');var path=require(_0xd9e6('0x1'));var config=require(_0xd9e6('0x2'));module[_0xd9e6('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd9e6('0x4')](_0xd9e6('0x5'))?path[_0xd9e6('0x6')](this[_0xd9e6('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xd9e6('0x7')]},'channel':{'type':Sequelize[_0xd9e6('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x57a688){var _0x1cb696=_0x57a688[_0xd9e6('0x8')](/\\/g,'/');this[_0xd9e6('0x9')]('value',_0x1cb696);}},'rating':{'type':Sequelize[_0xd9e6('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd9e6('0xa')],'set':function(_0x596895){this[_0xd9e6('0x9')](_0xd9e6('0xb'),moment()['subtract'](_0x596895,'ms'));this['setDataValue'](_0xd9e6('0xc'),moment());this[_0xd9e6('0x9')](_0xd9e6('0xd'),_0x596895);}},'startedAt':{'type':Sequelize[_0xd9e6('0xe')],'get':function(){return moment(this[_0xd9e6('0x4')](_0xd9e6('0xb')))[_0xd9e6('0xf')](_0xd9e6('0x10'))[_0xd9e6('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd9e6('0x4')](_0xd9e6('0xc')))['format']('MM-DD-YYYY\x20HH:mm')[_0xd9e6('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd9e6('0x4')](_0xd9e6('0x12')))[_0xd9e6('0xf')](_0xd9e6('0x10'))[_0xd9e6('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xd9e6('0x13')))['format'](_0xd9e6('0x10'))[_0xd9e6('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 14e7dd9..da2cfc3 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 _0x7bae=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','find','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','secrets','recording','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x7bae,0x13b));var _0xe7ba=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7bae[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['differenceBy'](_[_0xe7ba('0x2b')](_0x587c7d,'name'),['format']);_0x369451[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x48c869[_0xe7ba('0x31')]);_0x369451['filters']=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7[_0xe7ba('0x34')]=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x48c869['query'][_0xe7ba('0x35')]));_0x92fe7[_0xe7ba('0x34')]=_0x92fe7['attributes'][_0xe7ba('0x36')]?_0x92fe7[_0xe7ba('0x34')]:_0x369451[_0xe7ba('0x30')];if(!_0x48c869['query'][_0xe7ba('0x37')](_0xe7ba('0x38'))){_0x92fe7['limit']=qs[_0xe7ba('0x1e')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x92fe7['offset']=qs[_0xe7ba('0x20')](_0x48c869[_0xe7ba('0x31')]['offset']);}_0x92fe7[_0xe7ba('0x39')]=qs[_0xe7ba('0x3a')](_0x48c869[_0xe7ba('0x31')]['sort']);_0x92fe7['where']=qs[_0xe7ba('0x3b')](_[_0xe7ba('0x3c')](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x3b')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')]['filter']){_0x92fe7[_0xe7ba('0x3d')]=_[_0xe7ba('0x3e')](_0x92fe7[_0xe7ba('0x3d')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x5e9619){if(_0x5e9619[_0xe7ba('0x3f')]!==_0xe7ba('0x40')){var _0x46e31a={};_0x46e31a[_0x5e9619[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x41')]+'%'};return _0x46e31a;}})});}_0x92fe7=_[_0xe7ba('0x3e')]({},_0x92fe7,_0x48c869['options']);var _0x3429fa={'where':_0x92fe7[_0xe7ba('0x3d')]};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x3429fa)[_0xe7ba('0x26')](function(_0x3b3abe){_0x4bf5f9[_0xe7ba('0x1f')]=_0x3b3abe;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x42')]){_0x92fe7['include']=[{'all':!![]}];}return db[_0xe7ba('0x2c')][_0xe7ba('0x43')](_0x92fe7);})['then'](function(_0x5dae52){_0x4bf5f9[_0xe7ba('0x44')]=_0x5dae52;return _0x4bf5f9;})[_0xe7ba('0x26')](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x45')](handleError(_0x102925,null));};exports['show']=function(_0x249e1d,_0x82246e){var _0x3569b6={'raw':![],'where':{'id':_0x249e1d[_0xe7ba('0x46')]['id']}},_0x12770d={};_0x12770d['model']=_[_0xe7ba('0x32')](db['ScreenRecording'][_0xe7ba('0x2d')]);_0x12770d[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x249e1d[_0xe7ba('0x31')]);_0x12770d[_0xe7ba('0x3b')]=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],_0x12770d[_0xe7ba('0x31')]);_0x3569b6['attributes']=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x249e1d[_0xe7ba('0x31')][_0xe7ba('0x35')]));_0x3569b6[_0xe7ba('0x34')]=_0x3569b6[_0xe7ba('0x34')][_0xe7ba('0x36')]?_0x3569b6[_0xe7ba('0x34')]:_0x12770d[_0xe7ba('0x30')];if(_0x249e1d['query'][_0xe7ba('0x42')]){_0x3569b6['include']=[{'all':!![]}];}_0x3569b6=_[_0xe7ba('0x3e')]({},_0x3569b6,_0x249e1d[_0xe7ba('0x47')]);return db[_0xe7ba('0x2c')][_0xe7ba('0x48')](_0x3569b6)[_0xe7ba('0x26')](handleEntityNotFound(_0x82246e,null))[_0xe7ba('0x26')](respondWithResult(_0x82246e,null))['catch'](handleError(_0x82246e,null));};exports[_0xe7ba('0x49')]=function(_0x1cc668,_0x3f17ed){return db[_0xe7ba('0x2c')][_0xe7ba('0x49')](_0x1cc668[_0xe7ba('0x4a')],{})[_0xe7ba('0x26')](respondWithResult(_0x3f17ed,0xc9))[_0xe7ba('0x45')](handleError(_0x3f17ed,null));};exports[_0xe7ba('0x25')]=function(_0x1189bd,_0xbe2a32){if(_0x1189bd['body']['id']){delete _0x1189bd[_0xe7ba('0x4a')]['id'];}delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4b')];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4c')];delete _0x1189bd[_0xe7ba('0x4a')]['closedAt'];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4d')];return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x1189bd[_0xe7ba('0x46')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0xbe2a32,null))[_0xe7ba('0x26')](saveUpdates(_0x1189bd['body'],null))['then'](respondWithResult(_0xbe2a32,null))[_0xe7ba('0x45')](handleError(_0xbe2a32,null));};exports[_0xe7ba('0x4e')]=function(_0x285743,_0x5af106){return db[_0xe7ba('0x2c')][_0xe7ba('0x4e')]()[_0xe7ba('0x26')](respondWithResult(_0x5af106,null))[_0xe7ba('0x45')](handleError(_0x5af106,null));};exports[_0xe7ba('0x4f')]=function(_0x6b6f1,_0xf3a41f,_0x5e6612){var _0x2a6fdd=require(_0xe7ba('0x50'));var _0x316b51=![];var _0x5863c8={};if(_0x6b6f1[_0xe7ba('0x31')][_0xe7ba('0x3f')]&&_0x6b6f1['query'][_0xe7ba('0x3f')]===_0xe7ba('0x51')){_0x5863c8['uniqueid']=_0x6b6f1[_0xe7ba('0x46')]['id'];}else{_0x5863c8['id']=_0x6b6f1['params']['id'];}return db[_0xe7ba('0x2c')][_0xe7ba('0x48')]({'where':_0x5863c8,'attributes':['id',_0xe7ba('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xf3a41f,null))[_0xe7ba('0x26')](function(_0x1128be){if(_0x1128be){var _0x314549=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],'server/files/screen_recordings',_0x1128be[_0xe7ba('0x4d')]);var _0x455e50=util[_0xe7ba('0x54')](_0xe7ba('0x55'),_0x314549);if(fs[_0xe7ba('0x56')](_0x455e50)){_0x316b51=!![];return _0x2a6fdd['decryptFile'](_0x455e50,_0x314549,config[_0xe7ba('0x57')][_0xe7ba('0x58')])[_0xe7ba('0x26')](function(){return _0x1128be;});}return _0x1128be;}})[_0xe7ba('0x26')](function(_0x57b23e){if(_0x57b23e){var _0x3e31c1=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],_0xe7ba('0x59'),_0x57b23e[_0xe7ba('0x4d')]);if(!fs[_0xe7ba('0x56')](_0x3e31c1)){throw new db['Sequelize'][(_0xe7ba('0x5a'))](_0xe7ba('0x5b'));}if(_0x57b23e[_0xe7ba('0x5c')]){return _0xf3a41f['download'](_0x3e31c1,_0x57b23e[_0xe7ba('0x5c')]+path[_0xe7ba('0x5d')](_0x3e31c1),function(){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}else{return _0xf3a41f[_0xe7ba('0x4f')](_0x3e31c1,function(_0x45fb0f){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}}})[_0xe7ba('0x45')](function(_0x3351d5){if(_0x3351d5[_0xe7ba('0x5f')]===_0xe7ba('0x5b')){_0xf3a41f[_0xe7ba('0x1b')](0x194)[_0xe7ba('0x60')]('Not\x20found');}else{return handleError(_0xf3a41f,null);}});};exports[_0xe7ba('0x61')]=function(_0x384cea,_0x357af4){return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x384cea['params']['id']}})[_0xe7ba('0x26')](function(_0x194dff){if(_[_0xe7ba('0x62')](_0x194dff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x194dff;})['then'](function(_0x46d06e){var _0x2812af=path[_0xe7ba('0x52')](config['root'],_0xe7ba('0x59'),_0x46d06e[_0xe7ba('0x4d')]);logger[_0xe7ba('0x63')](_0xe7ba('0x64'),_0x2812af);if(!_[_0xe7ba('0x62')](_0x46d06e['value'])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7ba('0x66')](_0x2812af);}_0x2812af=_0x2812af+_0xe7ba('0x67');if(!_[_0xe7ba('0x62')](_0x46d06e[_0xe7ba('0x4d')])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+_0xe7ba('0x68'));fs[_0xe7ba('0x66')](_0x2812af);}return _0x46d06e;})[_0xe7ba('0x26')](function(_0x5a5394){if(!_0x5a5394)throw new InternalError();return _0x5a5394[_0xe7ba('0x61')]();})[_0xe7ba('0x26')](function(){_0x357af4[_0xe7ba('0x1b')](0xcc)[_0xe7ba('0x1c')]();})['catch'](handleError(_0x357af4,null));}; \ No newline at end of file +var _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x4e4a47,_0x2a570c){var _0x1c44bf=function(_0x5bfcc7){while(--_0x5bfcc7){_0x4e4a47['push'](_0x4e4a47['shift']());}};_0x1c44bf(++_0x2a570c);}(_0x5c12,0x188));var _0x25c1=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x5c12[_0x15ea09];return _0x3e9c78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 7b6ce71..6e80690 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 _0x54e1=['exports','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','bluebird','request-promise','path','./screenRecording.attributes'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x54e1,0x17a));var _0x154e=function(_0x454e8f,_0xc51eda){_0x454e8f=_0x454e8f-0x0;var _0x3f678c=_0x54e1[_0x454e8f];return _0x3f678c;};'use strict';var _=require('lodash');var util=require(_0x154e('0x0'));var logger=require(_0x154e('0x1'))(_0x154e('0x2'));var moment=require('moment');var BPromise=require(_0x154e('0x3'));var rp=require(_0x154e('0x4'));var fs=require('fs');var path=require(_0x154e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x154e('0x6'));module[_0x154e('0x7')]=function(_0x282b7b,_0x3a0739){return _0x282b7b['define'](_0x154e('0x8'),attributes,{'tableName':_0x154e('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x154e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6130=['screen_recordings','interactionid','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x552720,_0xa47e76){var _0x284205=function(_0x4b80a9){while(--_0x4b80a9){_0x552720['push'](_0x552720['shift']());}};_0x284205(++_0xa47e76);}(_0x6130,0x13a));var _0x0613=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6130[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x0613('0x0'));var util=require('util');var logger=require(_0x0613('0x1'))(_0x0613('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0613('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0613('0x4'));var config=require(_0x0613('0x5'));var attributes=require(_0x0613('0x6'));module[_0x0613('0x7')]=function(_0x202d44,_0x2ea645){return _0x202d44[_0x0613('0x8')](_0x0613('0x9'),attributes,{'tableName':_0x0613('0xa'),'paranoid':![],'indexes':[{'name':_0x0613('0xb'),'fields':[_0x0613('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 b2d2025..1850ff2 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 _0x17fe=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x5c72ee,_0x5a8bf8){var _0x231876=function(_0x955276){while(--_0x955276){_0x5c72ee['push'](_0x5c72ee['shift']());}};_0x231876(++_0x5a8bf8);}(_0x17fe,0x131));var _0xe17f=function(_0x10166e,_0x4d595d){_0x10166e=_0x10166e-0x0;var _0xe53d72=_0x17fe[_0x10166e];return _0xe53d72;};'use strict';var _=require('lodash');var util=require(_0xe17f('0x0'));var moment=require(_0xe17f('0x1'));var BPromise=require(_0xe17f('0x2'));var rs=require(_0xe17f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe17f('0x4'))['db'];var utils=require(_0xe17f('0x5'));var logger=require(_0xe17f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe17f('0x7'));var client=jayson[_0xe17f('0x8')][_0xe17f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46937d,_0x1aaa8d,_0x63424e){return new BPromise(function(_0x5217a6,_0x3da15f){return client[_0xe17f('0xa')](_0x46937d,_0x63424e)[_0xe17f('0xb')](function(_0x5cfdfb){logger[_0xe17f('0xc')](_0xe17f('0xd'),_0x1aaa8d,'request\x20sent');logger[_0xe17f('0xe')](_0xe17f('0xf'),_0x1aaa8d,_0xe17f('0x10'),JSON[_0xe17f('0x11')](_0x5cfdfb));if(_0x5cfdfb[_0xe17f('0x12')]){if(_0x5cfdfb[_0xe17f('0x12')]['code']===0x1f4){logger[_0xe17f('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x1aaa8d,_0x5cfdfb[_0xe17f('0x12')][_0xe17f('0x13')]);return _0x3da15f(_0x5cfdfb[_0xe17f('0x12')][_0xe17f('0x13')]);}logger[_0xe17f('0x12')](_0xe17f('0xd'),_0x1aaa8d,_0x5cfdfb[_0xe17f('0x12')]['message']);return _0x5217a6(_0x5cfdfb['error']['message']);}else{logger[_0xe17f('0xc')](_0xe17f('0xd'),_0x1aaa8d,_0xe17f('0x10'));_0x5217a6(_0x5cfdfb[_0xe17f('0x14')][_0xe17f('0x13')]);}})[_0xe17f('0x15')](function(_0xdd094){logger[_0xe17f('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x1aaa8d,_0xdd094);_0x3da15f(_0xdd094);});});} \ No newline at end of file +var _0x3a68=['result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message'];(function(_0x43b9c3,_0x1e168c){var _0x382f9=function(_0x4405a1){while(--_0x4405a1){_0x43b9c3['push'](_0x43b9c3['shift']());}};_0x382f9(++_0x1e168c);}(_0x3a68,0x18d));var _0x83a6=function(_0x24d77d,_0x119ca9){_0x24d77d=_0x24d77d-0x0;var _0x45cfd6=_0x3a68[_0x24d77d];return _0x45cfd6;};'use strict';var _=require(_0x83a6('0x0'));var util=require('util');var moment=require(_0x83a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x83a6('0x2'));var fs=require('fs');var Redis=require(_0x83a6('0x3'));var db=require(_0x83a6('0x4'))['db'];var utils=require(_0x83a6('0x5'));var logger=require(_0x83a6('0x6'))(_0x83a6('0x7'));var config=require(_0x83a6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x83a6('0x9')][_0x83a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a33d9,_0x36b2f0,_0x2e0de5){return new BPromise(function(_0x354364,_0x464c55){return client['request'](_0x2a33d9,_0x2e0de5)[_0x83a6('0xb')](function(_0x2d1254){logger[_0x83a6('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x36b2f0,_0x83a6('0xd'));logger[_0x83a6('0xe')](_0x83a6('0xf'),_0x36b2f0,_0x83a6('0xd'),JSON[_0x83a6('0x10')](_0x2d1254));if(_0x2d1254[_0x83a6('0x11')]){if(_0x2d1254[_0x83a6('0x11')][_0x83a6('0x12')]===0x1f4){logger[_0x83a6('0x11')](_0x83a6('0x13'),_0x36b2f0,_0x2d1254['error'][_0x83a6('0x14')]);return _0x464c55(_0x2d1254[_0x83a6('0x11')]['message']);}logger[_0x83a6('0x11')](_0x83a6('0x13'),_0x36b2f0,_0x2d1254[_0x83a6('0x11')][_0x83a6('0x14')]);return _0x354364(_0x2d1254['error'][_0x83a6('0x14')]);}else{logger[_0x83a6('0xc')](_0x83a6('0x13'),_0x36b2f0,_0x83a6('0xd'));_0x354364(_0x2d1254[_0x83a6('0x15')][_0x83a6('0x14')]);}})['catch'](function(_0x2f04e1){logger['error'](_0x83a6('0x13'),_0x36b2f0,_0x2f04e1);_0x464c55(_0x2f04e1);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 728fa9f..45f21f6 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 _0x42db=['single','file','addLogo','logologin','addLogoLogin','preferred','addPreferred','favicon','put','update','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo'];(function(_0x50db57,_0x2273c3){var _0x50f054=function(_0x231e4c){while(--_0x231e4c){_0x50db57['push'](_0x50db57['shift']());}};_0x50f054(++_0x2273c3);}(_0x42db,0x129));var _0xb42d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x42db[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xb42d('0x0'));var path=require('path');var timeout=require(_0xb42d('0x1'));var express=require(_0xb42d('0x2'));var router=express['Router']();var fs_extra=require(_0xb42d('0x3'));var auth=require(_0xb42d('0x4'));var interaction=require(_0xb42d('0x5'));var config=require(_0xb42d('0x6'));var controller=require(_0xb42d('0x7'));router['get']('/',auth[_0xb42d('0x8')](),controller[_0xb42d('0x9')]);router[_0xb42d('0xa')](_0xb42d('0xb'),controller[_0xb42d('0xc')]);router[_0xb42d('0xa')](_0xb42d('0xd'),controller['show']);router[_0xb42d('0xa')]('/:id/logo',controller[_0xb42d('0xe')]);router[_0xb42d('0xa')](_0xb42d('0xf'),controller[_0xb42d('0x10')]);router['get']('/:id/gdpr',controller['gdpr']);router[_0xb42d('0xa')](_0xb42d('0x11'),controller[_0xb42d('0x12')]);router[_0xb42d('0xa')](_0xb42d('0x13'),controller['getFavicon']);var upload=multer({'storage':multer[_0xb42d('0x14')]({'destination':function(_0xdaa562,_0x5a93fe,_0x1a5fc1){_0x1a5fc1(null,path[_0xb42d('0x15')](config[_0xb42d('0x16')],_0xb42d('0x17')));},'filename':function(_0x5252a1,_0xc68689,_0x474fe1){_0x474fe1(null,util[_0xb42d('0x18')](_0xb42d('0x19'),_0xb42d('0x1a'),path[_0xb42d('0x1b')](_0xc68689[_0xb42d('0x1c')])));}})});router[_0xb42d('0x1d')](_0xb42d('0x1e'),upload[_0xb42d('0x1f')](_0xb42d('0x20')),controller[_0xb42d('0x21')]);var upload=multer({'storage':multer[_0xb42d('0x14')]({'destination':function(_0x1aaed8,_0x16fcd8,_0x47f15e){_0x47f15e(null,path[_0xb42d('0x15')](config[_0xb42d('0x16')],_0xb42d('0x17')));},'filename':function(_0x56deb5,_0x47284e,_0x52c6aa){_0x52c6aa(null,util['format'](_0xb42d('0x19'),_0xb42d('0x22'),path[_0xb42d('0x1b')](_0x47284e[_0xb42d('0x1c')])));}})});router[_0xb42d('0x1d')](_0xb42d('0xf'),upload['single'](_0xb42d('0x20')),controller[_0xb42d('0x23')]);var upload=multer({'storage':multer[_0xb42d('0x14')]({'destination':function(_0x15119f,_0x1d4c2f,_0x2e5a52){_0x2e5a52(null,path[_0xb42d('0x15')](config[_0xb42d('0x16')],'server/files/images/logos/'));},'filename':function(_0x141000,_0x16ad18,_0x321c29){_0x321c29(null,util[_0xb42d('0x18')]('%s%s',_0xb42d('0x24'),path[_0xb42d('0x1b')](_0x16ad18[_0xb42d('0x1c')])));}})});router[_0xb42d('0x1d')]('/:id/preferred',upload['single'](_0xb42d('0x20')),controller[_0xb42d('0x25')]);var upload=multer({'storage':multer[_0xb42d('0x14')]({'destination':function(_0x2394f4,_0x9a3a3f,_0x84c5ca){_0x84c5ca(null,path[_0xb42d('0x15')](config[_0xb42d('0x16')],_0xb42d('0x17')));},'filename':function(_0x27cd6a,_0x3b3145,_0x7a6ff7){_0x7a6ff7(null,util[_0xb42d('0x18')](_0xb42d('0x19'),_0xb42d('0x26'),path[_0xb42d('0x1b')](_0x3b3145[_0xb42d('0x1c')])));}})});router[_0xb42d('0x1d')](_0xb42d('0x13'),upload[_0xb42d('0x1f')](_0xb42d('0x20')),controller['addFavicon']);router[_0xb42d('0x27')](_0xb42d('0xd'),auth[_0xb42d('0x8')](),controller[_0xb42d('0x28')]);module['exports']=router; \ No newline at end of file +var _0x934a=['/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','originalname','post','file','addLogo','logologin','extname','single','addLogoLogin','preferred','favicon','addFavicon','put','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin'];(function(_0x40230c,_0x16e44d){var _0x2c4598=function(_0x5a64fb){while(--_0x5a64fb){_0x40230c['push'](_0x40230c['shift']());}};_0x2c4598(++_0x16e44d);}(_0x934a,0x123));var _0xa934=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0x934a[_0x4599b6];return _0x2e014c;};'use strict';var multer=require('multer');var util=require(_0xa934('0x0'));var path=require('path');var timeout=require(_0xa934('0x1'));var express=require(_0xa934('0x2'));var router=express[_0xa934('0x3')]();var fs_extra=require(_0xa934('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa934('0x5'));var config=require(_0xa934('0x6'));var controller=require('./setting.controller');router[_0xa934('0x7')]('/',auth[_0xa934('0x8')](),controller[_0xa934('0x9')]);router['get'](_0xa934('0xa'),controller[_0xa934('0xb')]);router[_0xa934('0x7')](_0xa934('0xc'),controller[_0xa934('0xd')]);router[_0xa934('0x7')](_0xa934('0xe'),controller['getLogo']);router['get'](_0xa934('0xf'),controller[_0xa934('0x10')]);router['get'](_0xa934('0x11'),controller[_0xa934('0x12')]);router[_0xa934('0x7')](_0xa934('0x13'),controller[_0xa934('0x14')]);router['get'](_0xa934('0x15'),controller[_0xa934('0x16')]);var upload=multer({'storage':multer[_0xa934('0x17')]({'destination':function(_0x4b76b8,_0x186b9a,_0x4294d4){_0x4294d4(null,path[_0xa934('0x18')](config[_0xa934('0x19')],_0xa934('0x1a')));},'filename':function(_0x27aed4,_0x2cc236,_0xe52eb8){_0xe52eb8(null,util[_0xa934('0x1b')](_0xa934('0x1c'),_0xa934('0x1d'),path['extname'](_0x2cc236[_0xa934('0x1e')])));}})});router[_0xa934('0x1f')](_0xa934('0xe'),upload['single'](_0xa934('0x20')),controller[_0xa934('0x21')]);var upload=multer({'storage':multer[_0xa934('0x17')]({'destination':function(_0x51c944,_0x224795,_0x7efb10){_0x7efb10(null,path['join'](config[_0xa934('0x19')],_0xa934('0x1a')));},'filename':function(_0x1abdb4,_0x261fe1,_0x302152){_0x302152(null,util[_0xa934('0x1b')](_0xa934('0x1c'),_0xa934('0x22'),path[_0xa934('0x23')](_0x261fe1['originalname'])));}})});router['post'](_0xa934('0xf'),upload[_0xa934('0x24')](_0xa934('0x20')),controller[_0xa934('0x25')]);var upload=multer({'storage':multer[_0xa934('0x17')]({'destination':function(_0x27009e,_0x2d8346,_0x57bc5e){_0x57bc5e(null,path[_0xa934('0x18')](config[_0xa934('0x19')],_0xa934('0x1a')));},'filename':function(_0x319afb,_0x4ce94b,_0x57c5bb){_0x57c5bb(null,util[_0xa934('0x1b')]('%s%s',_0xa934('0x26'),path[_0xa934('0x23')](_0x4ce94b['originalname'])));}})});router[_0xa934('0x1f')](_0xa934('0x13'),upload[_0xa934('0x24')]('file'),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x375e6b,_0xe72e5e,_0x321a18){_0x321a18(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x5019a2,_0x3190b7,_0x35987e){_0x35987e(null,util[_0xa934('0x1b')](_0xa934('0x1c'),_0xa934('0x27'),path[_0xa934('0x23')](_0x3190b7[_0xa934('0x1e')])));}})});router[_0xa934('0x1f')](_0xa934('0x15'),upload[_0xa934('0x24')]('file'),controller[_0xa934('0x28')]);router[_0xa934('0x29')]('/:id',auth['isAuthenticated'](),controller[_0xa934('0x2a')]);module[_0xa934('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 ba238cf..521b1e8 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 _0xc611=['STRING','BOOLEAN','alternate','UNSIGNED','INTEGER','min_internal','min_mailbox'];(function(_0x834bb6,_0x1c5e35){var _0xa35d00=function(_0x14aeb3){while(--_0x14aeb3){_0x834bb6['push'](_0x834bb6['shift']());}};_0xa35d00(++_0x1c5e35);}(_0xc611,0x97));var _0x1c61=function(_0x7622c8,_0x1370aa){_0x7622c8=_0x7622c8-0x0;var _0xc26521=_0xc611[_0x7622c8];return _0xc26521;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x1c61('0x0')](0xb),'unique':_0x1c61('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1c61('0x0')](0xb),'unique':_0x1c61('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1c61('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1c61('0x3')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1c61('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1c61('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1c61('0x3')]},'turnaddr':{'type':Sequelize[_0x1c61('0x3')]},'turnusername':{'type':Sequelize[_0x1c61('0x3')]},'turnpassword':{'type':Sequelize[_0x1c61('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1c61('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1c61('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x1c61('0x5')},'chatTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1c61('0x3')]},'defaultPreferred':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1c61('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1c61('0x3')]},'defaultFavicon':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1c61('0x0')]},'transcribeRegion':{'type':Sequelize[_0x1c61('0x3')]},'sentiment':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1c61('0x0')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1c61('0x3')]},'bucket':{'type':Sequelize[_0x1c61('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x1c61('0x0')](0x2)[_0x1c61('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x1c61('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1c61('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x1c61('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xcc19=['INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc19,0x13e));var _0x9cc1=function(_0xa8ccab,_0x4d7cae){_0xa8ccab=_0xa8ccab-0x0;var _0x570d5f=_0xcc19[_0xa8ccab];return _0x570d5f;};'use strict';var Sequelize=require(_0x9cc1('0x0'));module[_0x9cc1('0x1')]={'min_internal':{'type':Sequelize[_0x9cc1('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x9cc1('0x2')](0xb),'unique':_0x9cc1('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9cc1('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x9cc1('0x4')},'logo':{'type':Sequelize[_0x9cc1('0x5')]},'defaultLogo':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9cc1('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9cc1('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9cc1('0x5')]},'turnaddr':{'type':Sequelize[_0x9cc1('0x5')]},'turnusername':{'type':Sequelize[_0x9cc1('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x9cc1('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9cc1('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x9cc1('0x7')},'enableEmailPreview':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9cc1('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9cc1('0x5')],'defaultValue':_0x9cc1('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9cc1('0x5')]},'defaultPreferred':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x9cc1('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9cc1('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9cc1('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x9cc1('0x2')]},'transcribeRegion':{'type':Sequelize[_0x9cc1('0x5')]},'sentiment':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9cc1('0x2')]},'sentimentRegion':{'type':Sequelize[_0x9cc1('0x5')]},'language':{'type':Sequelize[_0x9cc1('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9cc1('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x9cc1('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x9cc1('0x2')](0x2)[_0x9cc1('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x9cc1('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x9cc1('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x9cc1('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x9cc1('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x9cc1('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x9cc1('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 522fbc7..e92fe68 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 _0x65f4=['include','findAll','rows','catch','show','params','fields','length','find','file','filename','body','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','defaultPreferred','default_loginLogo.svg','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','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','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','stack','name','index','map','Setting','rawAttributes','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x51f366,_0x327d59){var _0x2995e2=function(_0x28466c){while(--_0x28466c){_0x51f366['push'](_0x51f366['shift']());}};_0x2995e2(++_0x327d59);}(_0x65f4,0x19a));var _0x465f=function(_0x18763f,_0x3ac650){_0x18763f=_0x18763f-0x0;var _0x313844=_0x65f4[_0x18763f];return _0x313844;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x465f('0x0'));var jsonpatch=require(_0x465f('0x1'));var rp=require(_0x465f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x465f('0x3'));var util=require(_0x465f('0x4'));var path=require(_0x465f('0x5'));var sox=require('sox');var csv=require(_0x465f('0x6'));var ejs=require(_0x465f('0x7'));var fs=require('fs');var fs_extra=require(_0x465f('0x8'));var _=require('lodash');var squel=require(_0x465f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x465f('0xa'));var toCsv=require(_0x465f('0x6'));var querystring=require(_0x465f('0xb'));var Papa=require(_0x465f('0xc'));var Redis=require(_0x465f('0xd'));var authService=require(_0x465f('0xe'));var qs=require(_0x465f('0xf'));var as=require(_0x465f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x465f('0x11'))(_0x465f('0x12'));var utils=require(_0x465f('0x13'));var config=require(_0x465f('0x14'));var licenseUtil=require(_0x465f('0x15'));var db=require(_0x465f('0x16'))['db'];var jayson=require(_0x465f('0x17'));var client=jayson[_0x465f('0x18')][_0x465f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5937e6,_0x530842,_0x2784b8,_0x2558a0){return new BPromise(function(_0x2cb09c,_0x3a6c49){var _0x532e49=_0x2558a0||client;return _0x532e49[_0x465f('0x1a')](_0x5937e6,_0x2784b8)[_0x465f('0x1b')](function(_0x52f29d){logger['info'](_0x465f('0x1c'),_0x530842,_0x465f('0x1d'));logger[_0x465f('0x1e')](_0x465f('0x1f'),_0x530842,_0x465f('0x1d'),JSON['stringify'](_0x52f29d));if(_0x52f29d[_0x465f('0x20')]){if(_0x52f29d[_0x465f('0x20')][_0x465f('0x21')]===0x1f4){logger['error'](_0x465f('0x1c'),_0x530842,_0x52f29d[_0x465f('0x20')]['message']);return _0x3a6c49(_0x52f29d[_0x465f('0x20')]['message']);}logger[_0x465f('0x20')](_0x465f('0x1c'),_0x530842,_0x52f29d[_0x465f('0x20')][_0x465f('0x22')]);return _0x2cb09c(_0x52f29d[_0x465f('0x20')][_0x465f('0x22')]);}else{logger[_0x465f('0x23')](_0x465f('0x1c'),_0x530842,_0x465f('0x1d'));_0x2cb09c(_0x52f29d[_0x465f('0x24')][_0x465f('0x22')]);}})['catch'](function(_0x41e279){logger[_0x465f('0x20')](_0x465f('0x1c'),_0x530842,_0x41e279);_0x3a6c49(_0x41e279);});});}function respondWithStatusCode(_0x317aed,_0x1d6677){_0x1d6677=_0x1d6677||0xcc;return function(_0x2566e3){if(_0x2566e3){return _0x317aed[_0x465f('0x25')](_0x1d6677);}return _0x317aed[_0x465f('0x26')](_0x1d6677)[_0x465f('0x27')]();};}function respondWithResult(_0xbea909,_0x59ace5){_0x59ace5=_0x59ace5||0xc8;return function(_0x186fff){if(_0x186fff){return _0xbea909[_0x465f('0x26')](_0x59ace5)['json'](_0x186fff);}};}function respondWithFilteredResult(_0x5a9fc3,_0xc45dc){return function(_0x3cd248){if(_0x3cd248){var _0x2fc986=typeof _0xc45dc[_0x465f('0x28')]===_0x465f('0x29')&&typeof _0xc45dc[_0x465f('0x2a')]===_0x465f('0x29');var _0x9d9ca9=_0x3cd248[_0x465f('0x2b')];var _0x190506=_0x2fc986?0x0:_0xc45dc['offset'];var _0x222240=_0x2fc986?_0x3cd248[_0x465f('0x2b')]:_0xc45dc['offset']+_0xc45dc[_0x465f('0x2a')];var _0x4a6301;if(_0x222240>=_0x9d9ca9){_0x222240=_0x9d9ca9;_0x4a6301=0xc8;}else{_0x4a6301=0xce;}_0x5a9fc3[_0x465f('0x26')](_0x4a6301);return _0x5a9fc3['set'](_0x465f('0x2c'),_0x190506+'-'+_0x222240+'/'+_0x9d9ca9)[_0x465f('0x2d')](_0x3cd248);}return null;};}function patchUpdates(_0x1817d0){return function(_0x25d2d7){try{jsonpatch['apply'](_0x25d2d7,_0x1817d0,!![]);}catch(_0x462462){return BPromise[_0x465f('0x2e')](_0x462462);}return _0x25d2d7[_0x465f('0x2f')]();};}function saveUpdates(_0x597afd,_0x156eb2){return function(_0x44884b){if(_0x44884b){return _0x44884b[_0x465f('0x30')](_0x597afd)['then'](function(_0x268ed3){return _0x268ed3;});}return null;};}function removeEntity(_0x3225b7,_0xfdb59c){return function(_0x4138ed){if(_0x4138ed){return _0x4138ed[_0x465f('0x31')]()['then'](function(){_0x3225b7['status'](0xcc)[_0x465f('0x27')]();});}};}function handleEntityNotFound(_0xb9c552,_0x425369){return function(_0x5230ae){if(!_0x5230ae){_0xb9c552[_0x465f('0x25')](0x194);}return _0x5230ae;};}function handleError(_0x587181,_0x11d55c){_0x11d55c=_0x11d55c||0x1f4;return function(_0x61835b){logger[_0x465f('0x20')](_0x61835b[_0x465f('0x32')]);if(_0x61835b[_0x465f('0x33')]){delete _0x61835b[_0x465f('0x33')];}_0x587181['status'](_0x11d55c)['send'](_0x61835b);};}exports[_0x465f('0x34')]=function(_0x11c472,_0x2e27f7){var _0x41c75c={},_0xf8b1c6={},_0x544f9d={'count':0x0,'rows':[]};var _0x3c40e2=_[_0x465f('0x35')](db[_0x465f('0x36')][_0x465f('0x37')],function(_0x486dfd){return{'name':_0x486dfd['fieldName'],'type':_0x486dfd[_0x465f('0x38')]['key']};});_0xf8b1c6[_0x465f('0x39')]=_[_0x465f('0x35')](_0x3c40e2,_0x465f('0x33'));_0xf8b1c6[_0x465f('0x3a')]=_[_0x465f('0x3b')](_0x11c472['query']);_0xf8b1c6[_0x465f('0x3c')]=_[_0x465f('0x3d')](_0xf8b1c6[_0x465f('0x39')],_0xf8b1c6[_0x465f('0x3a')]);_0x41c75c['attributes']=_[_0x465f('0x3d')](_0xf8b1c6[_0x465f('0x39')],qs['fields'](_0x11c472[_0x465f('0x3a')]['fields']));_0x41c75c[_0x465f('0x3e')]=_0x41c75c['attributes']['length']?_0x41c75c[_0x465f('0x3e')]:_0xf8b1c6[_0x465f('0x39')];if(!_0x11c472[_0x465f('0x3a')][_0x465f('0x3f')](_0x465f('0x40'))){_0x41c75c['limit']=qs[_0x465f('0x2a')](_0x11c472[_0x465f('0x3a')][_0x465f('0x2a')]);_0x41c75c[_0x465f('0x28')]=qs[_0x465f('0x28')](_0x11c472[_0x465f('0x3a')][_0x465f('0x28')]);}_0x41c75c[_0x465f('0x41')]=qs[_0x465f('0x42')](_0x11c472['query'][_0x465f('0x42')]);_0x41c75c[_0x465f('0x43')]=qs[_0x465f('0x3c')](_[_0x465f('0x44')](_0x11c472[_0x465f('0x3a')],_0xf8b1c6[_0x465f('0x3c')]),_0x3c40e2);if(_0x11c472[_0x465f('0x3a')][_0x465f('0x45')]){_0x41c75c[_0x465f('0x43')]=_[_0x465f('0x46')](_0x41c75c[_0x465f('0x43')],{'$or':_[_0x465f('0x35')](_0x3c40e2,function(_0x3d2a5f){if(_0x3d2a5f[_0x465f('0x38')]!==_0x465f('0x47')){var _0x2c6245={};_0x2c6245[_0x3d2a5f[_0x465f('0x33')]]={'$like':'%'+_0x11c472[_0x465f('0x3a')][_0x465f('0x45')]+'%'};return _0x2c6245;}})});}_0x41c75c=_[_0x465f('0x46')]({},_0x41c75c,_0x11c472[_0x465f('0x48')]);var _0x468936={'where':_0x41c75c[_0x465f('0x43')]};return db[_0x465f('0x36')][_0x465f('0x2b')](_0x468936)[_0x465f('0x1b')](function(_0x4aaebb){_0x544f9d[_0x465f('0x2b')]=_0x4aaebb;if(_0x11c472[_0x465f('0x3a')][_0x465f('0x49')]){_0x41c75c[_0x465f('0x4a')]=[{'all':!![]}];}return db[_0x465f('0x36')][_0x465f('0x4b')](_0x41c75c);})[_0x465f('0x1b')](function(_0x22d8b6){_0x544f9d[_0x465f('0x4c')]=_0x22d8b6;return _0x544f9d;})[_0x465f('0x1b')](respondWithFilteredResult(_0x2e27f7,_0x41c75c))[_0x465f('0x4d')](handleError(_0x2e27f7,null));};exports[_0x465f('0x4e')]=function(_0x4d7197,_0x325a26){var _0x1b8c02={'raw':![],'where':{'id':_0x4d7197[_0x465f('0x4f')]['id']}},_0x1d7cc0={};_0x1d7cc0[_0x465f('0x39')]=_[_0x465f('0x3b')](db[_0x465f('0x36')][_0x465f('0x37')]);_0x1d7cc0[_0x465f('0x3a')]=_[_0x465f('0x3b')](_0x4d7197[_0x465f('0x3a')]);_0x1d7cc0[_0x465f('0x3c')]=_[_0x465f('0x3d')](_0x1d7cc0[_0x465f('0x39')],_0x1d7cc0[_0x465f('0x3a')]);_0x1b8c02[_0x465f('0x3e')]=_['intersection'](_0x1d7cc0['model'],qs[_0x465f('0x50')](_0x4d7197[_0x465f('0x3a')]['fields']));_0x1b8c02['attributes']=_0x1b8c02[_0x465f('0x3e')][_0x465f('0x51')]?_0x1b8c02[_0x465f('0x3e')]:_0x1d7cc0['model'];if(_0x4d7197[_0x465f('0x3a')][_0x465f('0x49')]){_0x1b8c02[_0x465f('0x4a')]=[{'all':!![]}];}_0x1b8c02=_[_0x465f('0x46')]({},_0x1b8c02,_0x4d7197[_0x465f('0x48')]);return db[_0x465f('0x36')][_0x465f('0x52')](_0x1b8c02)[_0x465f('0x1b')](handleEntityNotFound(_0x325a26,null))['then'](respondWithResult(_0x325a26,null))[_0x465f('0x4d')](handleError(_0x325a26,null));};exports[_0x465f('0x30')]=function(_0x3f17e4,_0x425894){if(_0x3f17e4['body']['id']){delete _0x3f17e4['body']['id'];}return db['Setting'][_0x465f('0x52')]({'where':{'id':_0x3f17e4[_0x465f('0x4f')]['id']}})[_0x465f('0x1b')](handleEntityNotFound(_0x425894,null))[_0x465f('0x1b')](saveUpdates(_0x3f17e4['body'],null))[_0x465f('0x1b')](respondWithResult(_0x425894,null))[_0x465f('0x4d')](handleError(_0x425894,null));};exports['addLogo']=function(_0x218ad5,_0x15e947,_0x3f8400){if(_0x218ad5['file']&&_0x218ad5[_0x465f('0x53')][_0x465f('0x54')]){_0x218ad5[_0x465f('0x55')][_0x465f('0x56')]=_0x218ad5[_0x465f('0x53')]['filename'];}return db[_0x465f('0x36')]['find']({'where':{'id':_0x218ad5[_0x465f('0x4f')]['id']}})[_0x465f('0x1b')](handleEntityNotFound(_0x15e947,null))[_0x465f('0x1b')](saveUpdates(_0x218ad5[_0x465f('0x55')],null))['then'](respondWithResult(_0x15e947,null))[_0x465f('0x4d')](handleError(_0x15e947,null));};exports[_0x465f('0x57')]=function(_0x57b211,_0x199cbd,_0xa314ef){if(_0x57b211[_0x465f('0x53')]&&_0x57b211[_0x465f('0x53')][_0x465f('0x54')]){_0x57b211[_0x465f('0x55')][_0x465f('0x58')]=_0x57b211[_0x465f('0x53')]['filename'];}return db['Setting'][_0x465f('0x52')]({'where':{'id':_0x57b211[_0x465f('0x4f')]['id']}})[_0x465f('0x1b')](handleEntityNotFound(_0x199cbd,null))[_0x465f('0x1b')](saveUpdates(_0x57b211[_0x465f('0x55')],null))[_0x465f('0x1b')](respondWithResult(_0x199cbd,null))[_0x465f('0x4d')](handleError(_0x199cbd,null));};var utilLicense=require(_0x465f('0x15'));exports[_0x465f('0x59')]=function(_0x29e461,_0x25e2e6,_0x2508be){var _0xbd97a=_0x465f('0x5a');var _0x1a7ae7={'custom':![]};return utilLicense[_0x465f('0x5b')]()[_0x465f('0x1b')](function(_0x103322){if(_0x103322){_0x1a7ae7=_0x103322;}return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x29e461[_0x465f('0x4f')]['id']},'attributes':['logo','loginLogo',_0x465f('0x5c'),_0x465f('0x5d'),_0x465f('0x5e'),_0x465f('0x5f'),'defaultPreferred',_0x465f('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x25e2e6,null))['then'](function(_0x4593fc){if(_0x4593fc){var _0x832ba3=_0x4593fc[_0x465f('0x56')]&&fs[_0x465f('0x61')](path[_0x465f('0x62')](config[_0x465f('0x63')],_0xbd97a,_[_0x465f('0x64')](_0x4593fc[_0x465f('0x56')])))?path[_0x465f('0x62')](config['root'],_0xbd97a,_['toLower'](_0x4593fc[_0x465f('0x56')])):path[_0x465f('0x62')](config[_0x465f('0x63')],_0xbd97a,_[_0x465f('0x64')](_0x465f('0x65')));var _0x796cd1=_0x465f('0x66')+_[_0x465f('0x67')](_0x465f('0x56'));if(_0x4593fc[_0x796cd1]||!_0x1a7ae7[_0x465f('0x68')]){_0x832ba3=path[_0x465f('0x62')](config[_0x465f('0x63')],_0xbd97a,_[_0x465f('0x64')]('default_logo.svg'));}if(!fs[_0x465f('0x61')](_0x832ba3)){throw new db[(_0x465f('0x69'))][(_0x465f('0x6a'))](_[_0x465f('0x67')](_0x465f('0x56'))+_0x465f('0x6b'));}return _0x25e2e6[_0x465f('0x6c')](_0x832ba3);}})['catch'](handleError(_0x25e2e6,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x15b80c,_0x44527d,_0x4346cb){var _0x1c2c22=_0x465f('0x5a');var _0x5d51c2={'custom':![]};return utilLicense[_0x465f('0x5b')]()['then'](function(_0x1a5272){if(_0x1a5272){_0x5d51c2=_0x1a5272;}return db['Setting'][_0x465f('0x52')]({'where':{'id':_0x15b80c[_0x465f('0x4f')]['id']},'attributes':[_0x465f('0x56'),_0x465f('0x58'),_0x465f('0x5c'),_0x465f('0x5d'),_0x465f('0x5e'),_0x465f('0x5f'),_0x465f('0x6d'),'defaultFavicon'],'raw':!![]});})[_0x465f('0x1b')](handleEntityNotFound(_0x44527d,null))['then'](function(_0x24f6a9){if(_0x24f6a9){var _0x12ebbf=_0x24f6a9[_0x465f('0x58')]&&fs[_0x465f('0x61')](path['join'](config[_0x465f('0x63')],_0x1c2c22,_[_0x465f('0x64')](_0x24f6a9['loginLogo'])))?path[_0x465f('0x62')](config[_0x465f('0x63')],_0x1c2c22,_['toLower'](_0x24f6a9[_0x465f('0x58')])):path[_0x465f('0x62')](config[_0x465f('0x63')],_0x1c2c22,_[_0x465f('0x64')]('default_loginLogo.svg'));var _0x203540=_0x465f('0x66')+_[_0x465f('0x67')](_0x465f('0x58'));if(_0x24f6a9[_0x203540]||!_0x5d51c2['custom']){_0x12ebbf=path[_0x465f('0x62')](config[_0x465f('0x63')],_0x1c2c22,_[_0x465f('0x64')](_0x465f('0x6e')));}if(!fs[_0x465f('0x61')](_0x12ebbf)){throw new db[(_0x465f('0x69'))][(_0x465f('0x6a'))](_[_0x465f('0x67')](_0x465f('0x58'))+'\x20not\x20found');}return _0x44527d[_0x465f('0x6c')](_0x12ebbf);}})[_0x465f('0x4d')](handleError(_0x44527d,null));};exports['gdpr']=function(_0x29341e,_0x459984){return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x29341e[_0x465f('0x4f')]['id']},'attributes':[_0x465f('0x6f')]})[_0x465f('0x1b')](respondWithResult(_0x459984,null))[_0x465f('0x4d')](handleError(_0x459984,null));};exports[_0x465f('0x70')]=function(_0x77615e,_0x3c3bdf,_0x3f9b86){if(_0x77615e['file']&&_0x77615e[_0x465f('0x53')][_0x465f('0x54')]){_0x77615e[_0x465f('0x55')][_0x465f('0x5c')]=_0x77615e[_0x465f('0x53')][_0x465f('0x54')];}return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x77615e[_0x465f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3c3bdf,null))['then'](saveUpdates(_0x77615e[_0x465f('0x55')],null))[_0x465f('0x1b')](respondWithResult(_0x3c3bdf,null))[_0x465f('0x4d')](handleError(_0x3c3bdf,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x2c4aed,_0x3d2a11,_0x5d5c64){var _0x177547=_0x465f('0x5a');var _0x4dd4af={'custom':![]};return utilLicense['getLicense']()[_0x465f('0x1b')](function(_0x493d59){if(_0x493d59){_0x4dd4af=_0x493d59;}return db['Setting'][_0x465f('0x52')]({'where':{'id':_0x2c4aed[_0x465f('0x4f')]['id']},'attributes':[_0x465f('0x56'),_0x465f('0x58'),_0x465f('0x5c'),_0x465f('0x5d'),_0x465f('0x5e'),_0x465f('0x5f'),_0x465f('0x6d'),_0x465f('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x3d2a11,null))['then'](function(_0x3dd93a){if(_0x3dd93a){var _0x156548=_0x3dd93a[_0x465f('0x5c')]&&fs[_0x465f('0x61')](path[_0x465f('0x62')](config[_0x465f('0x63')],_0x177547,_[_0x465f('0x64')](_0x3dd93a['preferred'])))?path['join'](config[_0x465f('0x63')],_0x177547,_[_0x465f('0x64')](_0x3dd93a[_0x465f('0x5c')])):path[_0x465f('0x62')](config['root'],_0x177547,_[_0x465f('0x64')]('default_preferred.png'));var _0x5bd0cc='default'+_['upperFirst']('preferred');if(_0x3dd93a[_0x5bd0cc]||!_0x4dd4af['custom']||!_0x4dd4af[_0x465f('0x5c')]){_0x156548=path[_0x465f('0x62')](config[_0x465f('0x63')],_0x177547,_[_0x465f('0x64')](_0x465f('0x71')));}if(!fs['existsSync'](_0x156548)){throw new db[(_0x465f('0x69'))][(_0x465f('0x6a'))](_[_0x465f('0x67')]('preferred')+_0x465f('0x6b'));}return _0x3d2a11[_0x465f('0x6c')](_0x156548);}})['catch'](handleError(_0x3d2a11,null));};exports[_0x465f('0x72')]=function(_0x4f2319,_0x32a41d,_0x3db863){if(_0x4f2319['file']&&_0x4f2319['file'][_0x465f('0x54')]){_0x4f2319['body'][_0x465f('0x5d')]=_0x4f2319[_0x465f('0x53')][_0x465f('0x54')];}return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x4f2319[_0x465f('0x4f')]['id']}})[_0x465f('0x1b')](handleEntityNotFound(_0x32a41d,null))['then'](saveUpdates(_0x4f2319[_0x465f('0x55')],null))['then'](respondWithResult(_0x32a41d,null))[_0x465f('0x4d')](handleError(_0x32a41d,null));};var utilLicense=require('../../config/license/util');exports[_0x465f('0x73')]=function(_0x3e21fe,_0x229964,_0x148212){var _0x4650b6=_0x465f('0x5a');var _0x4ca969={'custom':![]};return utilLicense[_0x465f('0x5b')]()[_0x465f('0x1b')](function(_0x1ad76e){if(_0x1ad76e){_0x4ca969=_0x1ad76e;}return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x3e21fe[_0x465f('0x4f')]['id']},'attributes':[_0x465f('0x56'),_0x465f('0x58'),_0x465f('0x5c'),_0x465f('0x5d'),_0x465f('0x5e'),'defaultLoginLogo','defaultPreferred',_0x465f('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x229964,null))[_0x465f('0x1b')](function(_0x5cc1f2){if(_0x5cc1f2){var _0x19c155=_0x5cc1f2['favicon']&&fs[_0x465f('0x61')](path[_0x465f('0x62')](config[_0x465f('0x63')],_0x4650b6,_[_0x465f('0x64')](_0x5cc1f2[_0x465f('0x5d')])))?path[_0x465f('0x62')](config['root'],_0x4650b6,_['toLower'](_0x5cc1f2[_0x465f('0x5d')])):path[_0x465f('0x62')](config['root'],_0x4650b6,_[_0x465f('0x64')](_0x465f('0x74')));var _0xbf71ed=_0x465f('0x66')+_[_0x465f('0x67')](_0x465f('0x5d'));if(_0x5cc1f2[_0xbf71ed]||!_0x4ca969[_0x465f('0x68')]){_0x19c155=path['join'](config['root'],_0x4650b6,_[_0x465f('0x64')]('default_favicon.ico'));}if(!fs[_0x465f('0x61')](_0x19c155)){throw new db[(_0x465f('0x69'))][(_0x465f('0x6a'))](_[_0x465f('0x67')](_0x465f('0x5d'))+_0x465f('0x6b'));}return _0x229964[_0x465f('0x6c')](_0x19c155);}})[_0x465f('0x4d')](handleError(_0x229964,null));};exports['getDate']=function(_0x2b81f0,_0x42cd76){var _0x5df896={'offset':moment()[_0x465f('0x75')]()};_0x5df896['now']=moment()[_0x465f('0x75')](_0x5df896['offset'])[_0x465f('0x76')](_0x465f('0x77'));return _0x42cd76[_0x465f('0x26')](0xc8)[_0x465f('0x78')](_0x5df896);}; \ No newline at end of file +var _0x0a52=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','options','find','catch','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','getLogoLogin','defaultPreferred','default_loginLogo.svg','download','addPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x0a52,0xe4));var _0x20a5=function(_0x2fadf4,_0x4bd86f){_0x2fadf4=_0x2fadf4-0x0;var _0x474dd6=_0x0a52[_0x2fadf4];return _0x474dd6;};'use strict';var emlformat=require(_0x20a5('0x0'));var rimraf=require(_0x20a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20a5('0x2'));var rp=require(_0x20a5('0x3'));var moment=require(_0x20a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x20a5('0x5'));var util=require(_0x20a5('0x6'));var path=require(_0x20a5('0x7'));var sox=require(_0x20a5('0x8'));var csv=require(_0x20a5('0x9'));var ejs=require(_0x20a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x20a5('0xb'));var crypto=require(_0x20a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x20a5('0xd'));var toCsv=require(_0x20a5('0x9'));var querystring=require(_0x20a5('0xe'));var Papa=require(_0x20a5('0xf'));var Redis=require('ioredis');var authService=require(_0x20a5('0x10'));var qs=require(_0x20a5('0x11'));var as=require(_0x20a5('0x12'));var hardwareService=require(_0x20a5('0x13'));var logger=require(_0x20a5('0x14'))(_0x20a5('0x15'));var utils=require(_0x20a5('0x16'));var config=require(_0x20a5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x20a5('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x20a5('0x19')][_0x20a5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5d12df,_0x20da76,_0x19ef93,_0x46acee){return new BPromise(function(_0x43528b,_0x42bc38){var _0x2d149d=_0x46acee||client;return _0x2d149d[_0x20a5('0x1b')](_0x5d12df,_0x19ef93)[_0x20a5('0x1c')](function(_0x39b063){logger[_0x20a5('0x1d')](_0x20a5('0x1e'),_0x20da76,_0x20a5('0x1f'));logger['debug'](_0x20a5('0x20'),_0x20da76,'request\x20sent',JSON[_0x20a5('0x21')](_0x39b063));if(_0x39b063[_0x20a5('0x22')]){if(_0x39b063[_0x20a5('0x22')][_0x20a5('0x23')]===0x1f4){logger[_0x20a5('0x22')](_0x20a5('0x1e'),_0x20da76,_0x39b063[_0x20a5('0x22')]['message']);return _0x42bc38(_0x39b063[_0x20a5('0x22')]['message']);}logger[_0x20a5('0x22')](_0x20a5('0x1e'),_0x20da76,_0x39b063[_0x20a5('0x22')][_0x20a5('0x24')]);return _0x43528b(_0x39b063[_0x20a5('0x22')][_0x20a5('0x24')]);}else{logger[_0x20a5('0x1d')](_0x20a5('0x1e'),_0x20da76,_0x20a5('0x1f'));_0x43528b(_0x39b063[_0x20a5('0x25')][_0x20a5('0x24')]);}})['catch'](function(_0x21b629){logger[_0x20a5('0x22')](_0x20a5('0x1e'),_0x20da76,_0x21b629);_0x42bc38(_0x21b629);});});}function respondWithStatusCode(_0x4d4052,_0x370efa){_0x370efa=_0x370efa||0xcc;return function(_0x1b2850){if(_0x1b2850){return _0x4d4052[_0x20a5('0x26')](_0x370efa);}return _0x4d4052[_0x20a5('0x27')](_0x370efa)['end']();};}function respondWithResult(_0x2252ee,_0x3103bd){_0x3103bd=_0x3103bd||0xc8;return function(_0x16022f){if(_0x16022f){return _0x2252ee[_0x20a5('0x27')](_0x3103bd)[_0x20a5('0x28')](_0x16022f);}};}function respondWithFilteredResult(_0x23239d,_0x171cd5){return function(_0x3987c5){if(_0x3987c5){var _0x4a7f62=typeof _0x171cd5['offset']===_0x20a5('0x29')&&typeof _0x171cd5[_0x20a5('0x2a')]==='undefined';var _0x46a3df=_0x3987c5[_0x20a5('0x2b')];var _0x2b891c=_0x4a7f62?0x0:_0x171cd5[_0x20a5('0x2c')];var _0x5a84be=_0x4a7f62?_0x3987c5[_0x20a5('0x2b')]:_0x171cd5[_0x20a5('0x2c')]+_0x171cd5[_0x20a5('0x2a')];var _0x292044;if(_0x5a84be>=_0x46a3df){_0x5a84be=_0x46a3df;_0x292044=0xc8;}else{_0x292044=0xce;}_0x23239d[_0x20a5('0x27')](_0x292044);return _0x23239d[_0x20a5('0x2d')](_0x20a5('0x2e'),_0x2b891c+'-'+_0x5a84be+'/'+_0x46a3df)[_0x20a5('0x28')](_0x3987c5);}return null;};}function patchUpdates(_0x51de08){return function(_0xe51112){try{jsonpatch[_0x20a5('0x2f')](_0xe51112,_0x51de08,!![]);}catch(_0x2b996c){return BPromise[_0x20a5('0x30')](_0x2b996c);}return _0xe51112['save']();};}function saveUpdates(_0x2a74fa,_0x2a59a5){return function(_0x47b866){if(_0x47b866){return _0x47b866[_0x20a5('0x31')](_0x2a74fa)[_0x20a5('0x1c')](function(_0x279d45){return _0x279d45;});}return null;};}function removeEntity(_0x3e7f84,_0x2a8dd7){return function(_0x1cdc7c){if(_0x1cdc7c){return _0x1cdc7c[_0x20a5('0x32')]()['then'](function(){_0x3e7f84[_0x20a5('0x27')](0xcc)[_0x20a5('0x33')]();});}};}function handleEntityNotFound(_0x461a4a,_0x3c305a){return function(_0x195731){if(!_0x195731){_0x461a4a[_0x20a5('0x26')](0x194);}return _0x195731;};}function handleError(_0x235c65,_0x4959ce){_0x4959ce=_0x4959ce||0x1f4;return function(_0x15b20c){logger[_0x20a5('0x22')](_0x15b20c[_0x20a5('0x34')]);if(_0x15b20c[_0x20a5('0x35')]){delete _0x15b20c['name'];}_0x235c65[_0x20a5('0x27')](_0x4959ce)[_0x20a5('0x36')](_0x15b20c);};}exports[_0x20a5('0x37')]=function(_0x484ffc,_0x52ab8d){var _0x1808a0={},_0x54d667={},_0x3600fa={'count':0x0,'rows':[]};var _0x50ffa5=_[_0x20a5('0x38')](db[_0x20a5('0x39')][_0x20a5('0x3a')],function(_0x878027){return{'name':_0x878027[_0x20a5('0x3b')],'type':_0x878027['type'][_0x20a5('0x3c')]};});_0x54d667[_0x20a5('0x3d')]=_[_0x20a5('0x38')](_0x50ffa5,_0x20a5('0x35'));_0x54d667[_0x20a5('0x3e')]=_[_0x20a5('0x3f')](_0x484ffc[_0x20a5('0x3e')]);_0x54d667[_0x20a5('0x40')]=_['intersection'](_0x54d667[_0x20a5('0x3d')],_0x54d667['query']);_0x1808a0[_0x20a5('0x41')]=_[_0x20a5('0x42')](_0x54d667[_0x20a5('0x3d')],qs[_0x20a5('0x43')](_0x484ffc['query'][_0x20a5('0x43')]));_0x1808a0[_0x20a5('0x41')]=_0x1808a0[_0x20a5('0x41')]['length']?_0x1808a0['attributes']:_0x54d667[_0x20a5('0x3d')];if(!_0x484ffc[_0x20a5('0x3e')][_0x20a5('0x44')](_0x20a5('0x45'))){_0x1808a0[_0x20a5('0x2a')]=qs[_0x20a5('0x2a')](_0x484ffc[_0x20a5('0x3e')][_0x20a5('0x2a')]);_0x1808a0['offset']=qs[_0x20a5('0x2c')](_0x484ffc[_0x20a5('0x3e')][_0x20a5('0x2c')]);}_0x1808a0[_0x20a5('0x46')]=qs['sort'](_0x484ffc[_0x20a5('0x3e')][_0x20a5('0x47')]);_0x1808a0['where']=qs['filters'](_[_0x20a5('0x48')](_0x484ffc['query'],_0x54d667[_0x20a5('0x40')]),_0x50ffa5);if(_0x484ffc['query'][_0x20a5('0x49')]){_0x1808a0[_0x20a5('0x4a')]=_['merge'](_0x1808a0[_0x20a5('0x4a')],{'$or':_['map'](_0x50ffa5,function(_0x361aad){if(_0x361aad[_0x20a5('0x4b')]!==_0x20a5('0x4c')){var _0x568d21={};_0x568d21[_0x361aad[_0x20a5('0x35')]]={'$like':'%'+_0x484ffc['query'][_0x20a5('0x49')]+'%'};return _0x568d21;}})});}_0x1808a0=_[_0x20a5('0x4d')]({},_0x1808a0,_0x484ffc['options']);var _0x4b951e={'where':_0x1808a0[_0x20a5('0x4a')]};return db[_0x20a5('0x39')][_0x20a5('0x2b')](_0x4b951e)[_0x20a5('0x1c')](function(_0x2c6b27){_0x3600fa['count']=_0x2c6b27;if(_0x484ffc[_0x20a5('0x3e')][_0x20a5('0x4e')]){_0x1808a0[_0x20a5('0x4f')]=[{'all':!![]}];}return db[_0x20a5('0x39')][_0x20a5('0x50')](_0x1808a0);})[_0x20a5('0x1c')](function(_0x42aa14){_0x3600fa[_0x20a5('0x51')]=_0x42aa14;return _0x3600fa;})[_0x20a5('0x1c')](respondWithFilteredResult(_0x52ab8d,_0x1808a0))['catch'](handleError(_0x52ab8d,null));};exports[_0x20a5('0x52')]=function(_0x384d15,_0x4668a2){var _0x1e6981={'raw':![],'where':{'id':_0x384d15['params']['id']}},_0x78729f={};_0x78729f[_0x20a5('0x3d')]=_[_0x20a5('0x3f')](db['Setting'][_0x20a5('0x3a')]);_0x78729f[_0x20a5('0x3e')]=_[_0x20a5('0x3f')](_0x384d15['query']);_0x78729f[_0x20a5('0x40')]=_[_0x20a5('0x42')](_0x78729f[_0x20a5('0x3d')],_0x78729f[_0x20a5('0x3e')]);_0x1e6981['attributes']=_[_0x20a5('0x42')](_0x78729f[_0x20a5('0x3d')],qs[_0x20a5('0x43')](_0x384d15[_0x20a5('0x3e')][_0x20a5('0x43')]));_0x1e6981[_0x20a5('0x41')]=_0x1e6981['attributes']['length']?_0x1e6981[_0x20a5('0x41')]:_0x78729f[_0x20a5('0x3d')];if(_0x384d15['query'][_0x20a5('0x4e')]){_0x1e6981['include']=[{'all':!![]}];}_0x1e6981=_[_0x20a5('0x4d')]({},_0x1e6981,_0x384d15[_0x20a5('0x53')]);return db['Setting'][_0x20a5('0x54')](_0x1e6981)[_0x20a5('0x1c')](handleEntityNotFound(_0x4668a2,null))[_0x20a5('0x1c')](respondWithResult(_0x4668a2,null))[_0x20a5('0x55')](handleError(_0x4668a2,null));};exports[_0x20a5('0x31')]=function(_0x4abc47,_0x42d625){if(_0x4abc47[_0x20a5('0x56')]['id']){delete _0x4abc47[_0x20a5('0x56')]['id'];}return db[_0x20a5('0x39')][_0x20a5('0x54')]({'where':{'id':_0x4abc47[_0x20a5('0x57')]['id']}})[_0x20a5('0x1c')](handleEntityNotFound(_0x42d625,null))[_0x20a5('0x1c')](saveUpdates(_0x4abc47[_0x20a5('0x56')],null))[_0x20a5('0x1c')](respondWithResult(_0x42d625,null))[_0x20a5('0x55')](handleError(_0x42d625,null));};exports[_0x20a5('0x58')]=function(_0x382b48,_0x2726ed,_0x20691e){if(_0x382b48[_0x20a5('0x59')]&&_0x382b48[_0x20a5('0x59')][_0x20a5('0x5a')]){_0x382b48[_0x20a5('0x56')][_0x20a5('0x5b')]=_0x382b48['file']['filename'];}return db['Setting'][_0x20a5('0x54')]({'where':{'id':_0x382b48[_0x20a5('0x57')]['id']}})['then'](handleEntityNotFound(_0x2726ed,null))['then'](saveUpdates(_0x382b48[_0x20a5('0x56')],null))[_0x20a5('0x1c')](respondWithResult(_0x2726ed,null))['catch'](handleError(_0x2726ed,null));};exports[_0x20a5('0x5c')]=function(_0x1aa702,_0x2f546e,_0x519272){if(_0x1aa702['file']&&_0x1aa702[_0x20a5('0x59')][_0x20a5('0x5a')]){_0x1aa702['body'][_0x20a5('0x5d')]=_0x1aa702['file'][_0x20a5('0x5a')];}return db[_0x20a5('0x39')][_0x20a5('0x54')]({'where':{'id':_0x1aa702[_0x20a5('0x57')]['id']}})[_0x20a5('0x1c')](handleEntityNotFound(_0x2f546e,null))[_0x20a5('0x1c')](saveUpdates(_0x1aa702['body'],null))[_0x20a5('0x1c')](respondWithResult(_0x2f546e,null))[_0x20a5('0x55')](handleError(_0x2f546e,null));};var utilLicense=require(_0x20a5('0x5e'));exports[_0x20a5('0x5f')]=function(_0x91bf82,_0x4f2dd0,_0x5ad6a4){var _0x410b6c=_0x20a5('0x60');var _0x158a18={'custom':![]};return utilLicense[_0x20a5('0x61')]()[_0x20a5('0x1c')](function(_0x1d9a8c){if(_0x1d9a8c){_0x158a18=_0x1d9a8c;}return db[_0x20a5('0x39')]['find']({'where':{'id':_0x91bf82[_0x20a5('0x57')]['id']},'attributes':['logo','loginLogo',_0x20a5('0x62'),_0x20a5('0x63'),_0x20a5('0x64'),_0x20a5('0x65'),'defaultPreferred',_0x20a5('0x66')],'raw':!![]});})['then'](handleEntityNotFound(_0x4f2dd0,null))['then'](function(_0x54f0ab){if(_0x54f0ab){var _0x11ecf9=_0x54f0ab[_0x20a5('0x5b')]&&fs[_0x20a5('0x67')](path[_0x20a5('0x68')](config[_0x20a5('0x69')],_0x410b6c,_['toLower'](_0x54f0ab[_0x20a5('0x5b')])))?path['join'](config[_0x20a5('0x69')],_0x410b6c,_[_0x20a5('0x6a')](_0x54f0ab['logo'])):path[_0x20a5('0x68')](config[_0x20a5('0x69')],_0x410b6c,_['toLower'](_0x20a5('0x6b')));var _0x2f69c6=_0x20a5('0x6c')+_[_0x20a5('0x6d')](_0x20a5('0x5b'));if(_0x54f0ab[_0x2f69c6]||!_0x158a18[_0x20a5('0x6e')]){_0x11ecf9=path['join'](config[_0x20a5('0x69')],_0x410b6c,_[_0x20a5('0x6a')](_0x20a5('0x6b')));}if(!fs[_0x20a5('0x67')](_0x11ecf9)){throw new db[(_0x20a5('0x6f'))][(_0x20a5('0x70'))](_[_0x20a5('0x6d')]('logo')+'\x20not\x20found');}return _0x4f2dd0['download'](_0x11ecf9);}})[_0x20a5('0x55')](handleError(_0x4f2dd0,null));};var utilLicense=require(_0x20a5('0x5e'));exports[_0x20a5('0x71')]=function(_0x1f7474,_0x2af27a,_0x55cf18){var _0x6947f1=_0x20a5('0x60');var _0x5dea0b={'custom':![]};return utilLicense[_0x20a5('0x61')]()[_0x20a5('0x1c')](function(_0x425d4c){if(_0x425d4c){_0x5dea0b=_0x425d4c;}return db[_0x20a5('0x39')][_0x20a5('0x54')]({'where':{'id':_0x1f7474[_0x20a5('0x57')]['id']},'attributes':[_0x20a5('0x5b'),_0x20a5('0x5d'),_0x20a5('0x62'),'favicon','defaultLogo','defaultLoginLogo',_0x20a5('0x72'),'defaultFavicon'],'raw':!![]});})[_0x20a5('0x1c')](handleEntityNotFound(_0x2af27a,null))['then'](function(_0x8385d8){if(_0x8385d8){var _0x5ca685=_0x8385d8[_0x20a5('0x5d')]&&fs[_0x20a5('0x67')](path[_0x20a5('0x68')](config[_0x20a5('0x69')],_0x6947f1,_[_0x20a5('0x6a')](_0x8385d8[_0x20a5('0x5d')])))?path['join'](config['root'],_0x6947f1,_['toLower'](_0x8385d8[_0x20a5('0x5d')])):path['join'](config[_0x20a5('0x69')],_0x6947f1,_['toLower'](_0x20a5('0x73')));var _0x28960d=_0x20a5('0x6c')+_['upperFirst'](_0x20a5('0x5d'));if(_0x8385d8[_0x28960d]||!_0x5dea0b['custom']){_0x5ca685=path[_0x20a5('0x68')](config[_0x20a5('0x69')],_0x6947f1,_['toLower'](_0x20a5('0x73')));}if(!fs[_0x20a5('0x67')](_0x5ca685)){throw new db[(_0x20a5('0x6f'))][(_0x20a5('0x70'))](_[_0x20a5('0x6d')](_0x20a5('0x5d'))+'\x20not\x20found');}return _0x2af27a[_0x20a5('0x74')](_0x5ca685);}})[_0x20a5('0x55')](handleError(_0x2af27a,null));};exports['gdpr']=function(_0x433f96,_0x536b22){return db['Setting'][_0x20a5('0x54')]({'where':{'id':_0x433f96[_0x20a5('0x57')]['id']},'attributes':['securePassword']})[_0x20a5('0x1c')](respondWithResult(_0x536b22,null))['catch'](handleError(_0x536b22,null));};exports[_0x20a5('0x75')]=function(_0x5bbcd7,_0x42251b,_0x278a47){if(_0x5bbcd7[_0x20a5('0x59')]&&_0x5bbcd7[_0x20a5('0x59')]['filename']){_0x5bbcd7['body']['preferred']=_0x5bbcd7[_0x20a5('0x59')]['filename'];}return db[_0x20a5('0x39')][_0x20a5('0x54')]({'where':{'id':_0x5bbcd7[_0x20a5('0x57')]['id']}})['then'](handleEntityNotFound(_0x42251b,null))[_0x20a5('0x1c')](saveUpdates(_0x5bbcd7[_0x20a5('0x56')],null))['then'](respondWithResult(_0x42251b,null))[_0x20a5('0x55')](handleError(_0x42251b,null));};var utilLicense=require(_0x20a5('0x5e'));exports['getPreferred']=function(_0x44567f,_0x4a3b25,_0x5362f7){var _0xad432d=_0x20a5('0x60');var _0x1297bc={'custom':![]};return utilLicense[_0x20a5('0x61')]()[_0x20a5('0x1c')](function(_0x30a50d){if(_0x30a50d){_0x1297bc=_0x30a50d;}return db[_0x20a5('0x39')][_0x20a5('0x54')]({'where':{'id':_0x44567f[_0x20a5('0x57')]['id']},'attributes':['logo',_0x20a5('0x5d'),'preferred',_0x20a5('0x63'),_0x20a5('0x64'),_0x20a5('0x65'),_0x20a5('0x72'),_0x20a5('0x66')],'raw':!![]});})[_0x20a5('0x1c')](handleEntityNotFound(_0x4a3b25,null))[_0x20a5('0x1c')](function(_0xab6195){if(_0xab6195){var _0x581c4a=_0xab6195['preferred']&&fs['existsSync'](path[_0x20a5('0x68')](config[_0x20a5('0x69')],_0xad432d,_[_0x20a5('0x6a')](_0xab6195[_0x20a5('0x62')])))?path[_0x20a5('0x68')](config['root'],_0xad432d,_[_0x20a5('0x6a')](_0xab6195[_0x20a5('0x62')])):path[_0x20a5('0x68')](config[_0x20a5('0x69')],_0xad432d,_['toLower'](_0x20a5('0x76')));var _0xaa1c9e=_0x20a5('0x6c')+_['upperFirst'](_0x20a5('0x62'));if(_0xab6195[_0xaa1c9e]||!_0x1297bc[_0x20a5('0x6e')]||!_0x1297bc[_0x20a5('0x62')]){_0x581c4a=path['join'](config[_0x20a5('0x69')],_0xad432d,_[_0x20a5('0x6a')](_0x20a5('0x76')));}if(!fs[_0x20a5('0x67')](_0x581c4a)){throw new db[(_0x20a5('0x6f'))][(_0x20a5('0x70'))](_[_0x20a5('0x6d')]('preferred')+_0x20a5('0x77'));}return _0x4a3b25['download'](_0x581c4a);}})['catch'](handleError(_0x4a3b25,null));};exports[_0x20a5('0x78')]=function(_0x4dcadc,_0x4a900d,_0x21bfea){if(_0x4dcadc[_0x20a5('0x59')]&&_0x4dcadc[_0x20a5('0x59')][_0x20a5('0x5a')]){_0x4dcadc[_0x20a5('0x56')][_0x20a5('0x63')]=_0x4dcadc[_0x20a5('0x59')]['filename'];}return db[_0x20a5('0x39')][_0x20a5('0x54')]({'where':{'id':_0x4dcadc[_0x20a5('0x57')]['id']}})[_0x20a5('0x1c')](handleEntityNotFound(_0x4a900d,null))[_0x20a5('0x1c')](saveUpdates(_0x4dcadc[_0x20a5('0x56')],null))[_0x20a5('0x1c')](respondWithResult(_0x4a900d,null))[_0x20a5('0x55')](handleError(_0x4a900d,null));};var utilLicense=require('../../config/license/util');exports[_0x20a5('0x79')]=function(_0x552097,_0x357646,_0x15ebf8){var _0x5787fa=_0x20a5('0x60');var _0x381fe2={'custom':![]};return utilLicense[_0x20a5('0x61')]()[_0x20a5('0x1c')](function(_0xd2ff57){if(_0xd2ff57){_0x381fe2=_0xd2ff57;}return db[_0x20a5('0x39')][_0x20a5('0x54')]({'where':{'id':_0x552097[_0x20a5('0x57')]['id']},'attributes':[_0x20a5('0x5b'),_0x20a5('0x5d'),'preferred','favicon',_0x20a5('0x64'),_0x20a5('0x65'),_0x20a5('0x72'),_0x20a5('0x66')],'raw':!![]});})[_0x20a5('0x1c')](handleEntityNotFound(_0x357646,null))[_0x20a5('0x1c')](function(_0x41b158){if(_0x41b158){var _0x45c493=_0x41b158[_0x20a5('0x63')]&&fs['existsSync'](path[_0x20a5('0x68')](config[_0x20a5('0x69')],_0x5787fa,_[_0x20a5('0x6a')](_0x41b158['favicon'])))?path[_0x20a5('0x68')](config[_0x20a5('0x69')],_0x5787fa,_[_0x20a5('0x6a')](_0x41b158[_0x20a5('0x63')])):path['join'](config[_0x20a5('0x69')],_0x5787fa,_[_0x20a5('0x6a')](_0x20a5('0x7a')));var _0x2c54bd=_0x20a5('0x6c')+_['upperFirst'](_0x20a5('0x63'));if(_0x41b158[_0x2c54bd]||!_0x381fe2[_0x20a5('0x6e')]){_0x45c493=path[_0x20a5('0x68')](config[_0x20a5('0x69')],_0x5787fa,_[_0x20a5('0x6a')](_0x20a5('0x7a')));}if(!fs[_0x20a5('0x67')](_0x45c493)){throw new db['Sequelize'][(_0x20a5('0x70'))](_[_0x20a5('0x6d')](_0x20a5('0x63'))+_0x20a5('0x77'));}return _0x357646[_0x20a5('0x74')](_0x45c493);}})['catch'](handleError(_0x357646,null));};exports['getDate']=function(_0x8e8ceb,_0x29a463){var _0x33ef56={'offset':moment()['utcOffset']()};_0x33ef56[_0x20a5('0x7b')]=moment()[_0x20a5('0x7c')](_0x33ef56['offset'])[_0x20a5('0x7d')](_0x20a5('0x7e'));return _0x29a463[_0x20a5('0x27')](0xc8)['send'](_0x33ef56);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a6adfe3..95a7b50 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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0x3e74,0x175));var _0x43e7=function(_0x4312c7,_0xfdabe4){_0x4312c7=_0x4312c7-0x0;var _0x55f757=_0x3e74[_0x4312c7];return _0x55f757;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x1db8a2,_0x3c5a5f){var _0x2e3658=function(_0x466580){while(--_0x466580){_0x1db8a2['push'](_0x1db8a2['shift']());}};_0x2e3658(++_0x3c5a5f);}(_0x34e8,0x12c));var _0x834e=function(_0x51148f,_0x227b2d){_0x51148f=_0x51148f-0x0;var _0x1bbdda=_0x34e8[_0x51148f];return _0x1bbdda;};'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 6478077..670d415 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 _0x7082=['rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSetting','Setting','find','options','raw','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x142890,_0x4e431a){var _0x33d7e6=function(_0x5d0162){while(--_0x5d0162){_0x142890['push'](_0x142890['shift']());}};_0x33d7e6(++_0x4e431a);}(_0x7082,0x14e));var _0x2708=function(_0x11d541,_0xc8fe9){_0x11d541=_0x11d541-0x0;var _0x3e612a=_0x7082[_0x11d541];return _0x3e612a;};'use strict';var _=require(_0x2708('0x0'));var util=require(_0x2708('0x1'));var moment=require(_0x2708('0x2'));var BPromise=require(_0x2708('0x3'));var rs=require(_0x2708('0x4'));var fs=require('fs');var Redis=require(_0x2708('0x5'));var db=require(_0x2708('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2708('0x7'));var config=require(_0x2708('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2708('0x9')][_0x2708('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ba834,_0x31defe,_0x20cb41){return new BPromise(function(_0x149f56,_0x385973){return client[_0x2708('0xb')](_0x3ba834,_0x20cb41)[_0x2708('0xc')](function(_0x14d2cd){logger[_0x2708('0xd')](_0x2708('0xe'),_0x31defe,_0x2708('0xf'));logger[_0x2708('0x10')](_0x2708('0x11'),_0x31defe,_0x2708('0xf'),JSON[_0x2708('0x12')](_0x14d2cd));if(_0x14d2cd[_0x2708('0x13')]){if(_0x14d2cd[_0x2708('0x13')]['code']===0x1f4){logger[_0x2708('0x13')](_0x2708('0xe'),_0x31defe,_0x14d2cd['error']['message']);return _0x385973(_0x14d2cd['error'][_0x2708('0x14')]);}logger[_0x2708('0x13')](_0x2708('0xe'),_0x31defe,_0x14d2cd[_0x2708('0x13')][_0x2708('0x14')]);return _0x149f56(_0x14d2cd[_0x2708('0x13')][_0x2708('0x14')]);}else{logger[_0x2708('0xd')](_0x2708('0xe'),_0x31defe,_0x2708('0xf'));_0x149f56(_0x14d2cd['result']['message']);}})[_0x2708('0x15')](function(_0x40a27d){logger[_0x2708('0x13')](_0x2708('0xe'),_0x31defe,_0x40a27d);_0x385973(_0x40a27d);});});}exports[_0x2708('0x16')]=function(_0x153756){var _0x1a29d9=this;return new Promise(function(_0x1b305d,_0x30bbda){return db[_0x2708('0x17')][_0x2708('0x18')]({'raw':_0x153756[_0x2708('0x19')]?_0x153756[_0x2708('0x19')][_0x2708('0x1a')]===undefined?!![]:![]:!![],'where':_0x153756[_0x2708('0x19')]?_0x153756['options']['where']||null:null,'attributes':_0x153756['options']?_0x153756[_0x2708('0x19')][_0x2708('0x1b')]||null:null,'include':_0x153756[_0x2708('0x19')]?_0x153756[_0x2708('0x19')][_0x2708('0x1c')]?_[_0x2708('0x1d')](_0x153756[_0x2708('0x19')][_0x2708('0x1c')],function(_0x5064e3){return{'model':db[_0x5064e3[_0x2708('0x1e')]],'as':_0x5064e3['as'],'attributes':_0x5064e3[_0x2708('0x1b')],'include':_0x5064e3[_0x2708('0x1c')]?_['map'](_0x5064e3[_0x2708('0x1c')],function(_0x28479a){return{'model':db[_0x28479a[_0x2708('0x1e')]],'as':_0x28479a['as'],'attributes':_0x28479a[_0x2708('0x1b')],'include':_0x28479a[_0x2708('0x1c')]?_[_0x2708('0x1d')](_0x28479a[_0x2708('0x1c')],function(_0x2b9c32){return{'model':db[_0x2b9c32['model']],'as':_0x2b9c32['as'],'attributes':_0x2b9c32[_0x2708('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2708('0xc')](function(_0x4a9a00){logger['info'](_0x2708('0x16'),_0x153756);logger['debug']('ShowSetting',_0x153756,JSON[_0x2708('0x12')](_0x4a9a00));_0x1b305d(_0x4a9a00);})[_0x2708('0x15')](function(_0x10cd0b){logger[_0x2708('0x13')]('ShowSetting',_0x10cd0b['message'],_0x153756);_0x30bbda(_0x1a29d9['error'](0x1f4,_0x10cd0b[_0x2708('0x14')]));});});}; \ No newline at end of file +var _0x9f61=['include','map','attributes','then','info','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','ShowSetting','find','options','raw'];(function(_0x3f5e5b,_0x350dbf){var _0x2e899d=function(_0xe1a288){while(--_0xe1a288){_0x3f5e5b['push'](_0x3f5e5b['shift']());}};_0x2e899d(++_0x350dbf);}(_0x9f61,0x65));var _0x19f6=function(_0x5a65c1,_0x14a152){_0x5a65c1=_0x5a65c1-0x0;var _0x30c07e=_0x9f61[_0x5a65c1];return _0x30c07e;};'use strict';var _=require(_0x19f6('0x0'));var util=require(_0x19f6('0x1'));var moment=require('moment');var BPromise=require(_0x19f6('0x2'));var rs=require(_0x19f6('0x3'));var fs=require('fs');var Redis=require(_0x19f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x19f6('0x5'));var logger=require(_0x19f6('0x6'))(_0x19f6('0x7'));var config=require(_0x19f6('0x8'));var jayson=require(_0x19f6('0x9'));var client=jayson[_0x19f6('0xa')][_0x19f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5308eb,_0x81079,_0x2c5272){return new BPromise(function(_0x17bab7,_0x59bc4e){return client[_0x19f6('0xc')](_0x5308eb,_0x2c5272)['then'](function(_0x118d3f){logger['info']('Setting,\x20%s,\x20%s',_0x81079,'request\x20sent');logger[_0x19f6('0xd')](_0x19f6('0xe'),_0x81079,_0x19f6('0xf'),JSON[_0x19f6('0x10')](_0x118d3f));if(_0x118d3f[_0x19f6('0x11')]){if(_0x118d3f[_0x19f6('0x11')][_0x19f6('0x12')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x81079,_0x118d3f['error'][_0x19f6('0x13')]);return _0x59bc4e(_0x118d3f[_0x19f6('0x11')][_0x19f6('0x13')]);}logger[_0x19f6('0x11')]('Setting,\x20%s,\x20%s',_0x81079,_0x118d3f[_0x19f6('0x11')][_0x19f6('0x13')]);return _0x17bab7(_0x118d3f[_0x19f6('0x11')][_0x19f6('0x13')]);}else{logger['info'](_0x19f6('0x14'),_0x81079,_0x19f6('0xf'));_0x17bab7(_0x118d3f[_0x19f6('0x15')][_0x19f6('0x13')]);}})[_0x19f6('0x16')](function(_0x40d146){logger[_0x19f6('0x11')](_0x19f6('0x14'),_0x81079,_0x40d146);_0x59bc4e(_0x40d146);});});}exports[_0x19f6('0x17')]=function(_0x2afe28){var _0x2a636c=this;return new Promise(function(_0x28786f,_0x5eac80){return db['Setting'][_0x19f6('0x18')]({'raw':_0x2afe28['options']?_0x2afe28[_0x19f6('0x19')][_0x19f6('0x1a')]===undefined?!![]:![]:!![],'where':_0x2afe28[_0x19f6('0x19')]?_0x2afe28[_0x19f6('0x19')]['where']||null:null,'attributes':_0x2afe28['options']?_0x2afe28[_0x19f6('0x19')]['attributes']||null:null,'include':_0x2afe28[_0x19f6('0x19')]?_0x2afe28[_0x19f6('0x19')][_0x19f6('0x1b')]?_[_0x19f6('0x1c')](_0x2afe28[_0x19f6('0x19')]['include'],function(_0x1bc5af){return{'model':db[_0x1bc5af['model']],'as':_0x1bc5af['as'],'attributes':_0x1bc5af[_0x19f6('0x1d')],'include':_0x1bc5af[_0x19f6('0x1b')]?_[_0x19f6('0x1c')](_0x1bc5af[_0x19f6('0x1b')],function(_0x415e0e){return{'model':db[_0x415e0e['model']],'as':_0x415e0e['as'],'attributes':_0x415e0e[_0x19f6('0x1d')],'include':_0x415e0e[_0x19f6('0x1b')]?_['map'](_0x415e0e[_0x19f6('0x1b')],function(_0x4fb1cf){return{'model':db[_0x4fb1cf['model']],'as':_0x4fb1cf['as'],'attributes':_0x4fb1cf[_0x19f6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x19f6('0x1e')](function(_0x57555c){logger[_0x19f6('0x1f')](_0x19f6('0x17'),_0x2afe28);logger[_0x19f6('0xd')]('ShowSetting',_0x2afe28,JSON[_0x19f6('0x10')](_0x57555c));_0x28786f(_0x57555c);})[_0x19f6('0x16')](function(_0x33f790){logger[_0x19f6('0x11')](_0x19f6('0x17'),_0x33f790['message'],_0x2afe28);_0x5eac80(_0x2a636c[_0x19f6('0x11')](0x1f4,_0x33f790[_0x19f6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c3810f1..9cd5880 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x1d4275,_0x275f37){var _0xa30808=function(_0x405f11){while(--_0x405f11){_0x1d4275['push'](_0x1d4275['shift']());}};_0xa30808(++_0x275f37);}(_0x7a54,0x106));var _0x47a5=function(_0x44e3f8,_0x159e28){_0x44e3f8=_0x44e3f8-0x0;var _0x5a5ce0=_0x7a54[_0x44e3f8];return _0x5a5ce0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _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(_0x405a37,_0x5aea5e){var _0x5c781b=function(_0xd41d5e){while(--_0xd41d5e){_0x405a37['push'](_0x405a37['shift']());}};_0x5c781b(++_0x5aea5e);}(_0x7a54,0x106));var _0x47a5=function(_0x3743de,_0x46ea44){_0x3743de=_0x3743de-0x0;var _0x2ff48b=_0x7a54[_0x3743de];return _0x2ff48b;};'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 c29f899..caf78a5 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 _0x8e22=['intelepeer','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip'];(function(_0x2f7c1e,_0x56bc3c){var _0x23e97d=function(_0x3553b5){while(--_0x3553b5){_0x2f7c1e['push'](_0x2f7c1e['shift']());}};_0x23e97d(++_0x56bc3c);}(_0x8e22,0x76));var _0x28e2=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0x8e22[_0x42d1f8];return _0x40d234;};'use strict';var Sequelize=require(_0x28e2('0x0'));var rs=require(_0x28e2('0x1'));module[_0x28e2('0x2')]={'name':{'type':Sequelize[_0x28e2('0x3')],'unique':_0x28e2('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x28e2('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x28e2('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x28e2('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x28e2('0x3')]},'type':{'type':Sequelize[_0x28e2('0x5')](_0x28e2('0x6'),_0x28e2('0x7'),_0x28e2('0x8'),_0x28e2('0x9'),_0x28e2('0xa'),'clickatell',_0x28e2('0xb'),_0x28e2('0xc'),_0x28e2('0xd'),_0x28e2('0xe'))},'accountSid':{'type':Sequelize[_0x28e2('0x3')]},'authId':{'type':Sequelize[_0x28e2('0x3')]},'authToken':{'type':Sequelize[_0x28e2('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x28e2('0x3')]},'password':{'type':Sequelize[_0x28e2('0x3')]},'apiKey':{'type':Sequelize[_0x28e2('0x3')]},'applicationId':{'type':Sequelize[_0x28e2('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x28e2('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x28e2('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x28e2('0xf');}},'notificationSound':{'type':Sequelize[_0x28e2('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x28e2('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x28e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x28e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x28e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x28e2('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x28e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x28e2('0x11')],'comment':_0x28e2('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x28e2('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x56fec7){if(!_0x56fec7)this[_0x28e2('0x13')](_0x28e2('0x14'),null);this[_0x28e2('0x13')](_0x28e2('0x15'),_0x56fec7);}}}; \ No newline at end of file +var _0x90ed=['setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90ed,0x1ce));var _0xd90e=function(_0x48d517,_0x4046dc){_0x48d517=_0x48d517-0x0;var _0x1a79ea=_0x90ed[_0x48d517];return _0x1a79ea;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd90e('0x0'));module[_0xd90e('0x1')]={'name':{'type':Sequelize[_0xd90e('0x2')],'unique':_0xd90e('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xd90e('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xd90e('0x2')],'defaultValue':function(){return rs[_0xd90e('0x4')]();}},'phone':{'type':Sequelize[_0xd90e('0x2')]},'type':{'type':Sequelize[_0xd90e('0x5')](_0xd90e('0x6'),_0xd90e('0x7'),_0xd90e('0x8'),_0xd90e('0x9'),_0xd90e('0xa'),'clickatell',_0xd90e('0xb'),_0xd90e('0xc'),_0xd90e('0xd'),_0xd90e('0xe'))},'accountSid':{'type':Sequelize[_0xd90e('0x2')]},'authId':{'type':Sequelize[_0xd90e('0x2')]},'authToken':{'type':Sequelize[_0xd90e('0x2')]},'smsMethod':{'type':Sequelize[_0xd90e('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd90e('0x2')]},'password':{'type':Sequelize[_0xd90e('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xd90e('0x2')]},'accountId':{'type':Sequelize[_0xd90e('0x2')]},'senderString':{'type':Sequelize[_0xd90e('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xd90e('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd90e('0xf')],'defaultValue':function(){return _0xd90e('0x10');}},'notificationSound':{'type':Sequelize[_0xd90e('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd90e('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd90e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd90e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd90e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd90e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd90e('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd90e('0x12')],'comment':_0xd90e('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xd90e('0x11')],'defaultValue':![],'comment':_0xd90e('0x14'),'set':function(_0x369bf0){if(!_0x369bf0)this[_0xd90e('0x15')](_0xd90e('0x16'),null);this[_0xd90e('0x15')]('mandatoryDisposition',_0x369bf0);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index acb00ca..4b3da9a 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 _0x384f=['destroy','get','SmsAccounts','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','VIRTUAL','filter','where','includeAll','findAll','rows','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','params','describe','addDisposition','SmsAccountId','getDispositions','Disposition','order','options','include','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','SmsApplication','account','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','From','Body','MessageSid','text','connectel','messageId','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','User','UserId','agent','waitForTheAssignedAgent','SmsQueue','queueId','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','set','\x0a','json','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','redif','skebby','error_code','clicksend','DELIVERED','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x2427e8,_0x4f7a0c){var _0x4a5c34=function(_0xdb17ab){while(--_0xdb17ab){_0x2427e8['push'](_0x2427e8['shift']());}};_0x4a5c34(++_0x4f7a0c);}(_0x384f,0xb1));var _0xf384=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x384f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf384('0x0'));var rimraf=require(_0xf384('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf384('0x2'));var rp=require(_0xf384('0x3'));var moment=require('moment');var BPromise=require(_0xf384('0x4'));var Mustache=require(_0xf384('0x5'));var util=require(_0xf384('0x6'));var path=require(_0xf384('0x7'));var sox=require('sox');var csv=require(_0xf384('0x8'));var ejs=require(_0xf384('0x9'));var fs=require('fs');var fs_extra=require(_0xf384('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf384('0xb'));var jsforce=require(_0xf384('0xc'));var deskjs=require(_0xf384('0xd'));var toCsv=require(_0xf384('0x8'));var querystring=require('querystring');var Papa=require(_0xf384('0xe'));var Redis=require(_0xf384('0xf'));var authService=require(_0xf384('0x10'));var qs=require(_0xf384('0x11'));var as=require(_0xf384('0x12'));var hardwareService=require(_0xf384('0x13'));var logger=require(_0xf384('0x14'))(_0xf384('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf384('0x16'));var db=require('../../mysqldb')['db'];config[_0xf384('0x17')]=_[_0xf384('0x18')](config['redis'],{'host':_0xf384('0x19'),'port':0x18eb});var socket=require(_0xf384('0x1a'))(new Redis(config['redis']));require(_0xf384('0x1b'))[_0xf384('0x1c')](socket);var jayson=require(_0xf384('0x1d'));var client=jayson[_0xf384('0x1e')][_0xf384('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x374413,_0xd06948,_0x121e64,_0x3c8c66){return new BPromise(function(_0x253707,_0x1a6083){var _0x2fe346=_0x3c8c66||client;return _0x2fe346[_0xf384('0x20')](_0x374413,_0x121e64)[_0xf384('0x21')](function(_0x3875f6){logger[_0xf384('0x22')](_0xf384('0x23'),_0xd06948,_0xf384('0x24'));logger[_0xf384('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd06948,_0xf384('0x24'),JSON['stringify'](_0x3875f6));if(_0x3875f6[_0xf384('0x26')]){if(_0x3875f6[_0xf384('0x26')][_0xf384('0x27')]===0x1f4){logger[_0xf384('0x26')](_0xf384('0x23'),_0xd06948,_0x3875f6[_0xf384('0x26')][_0xf384('0x28')]);return _0x1a6083(_0x3875f6[_0xf384('0x26')]['message']);}logger['error'](_0xf384('0x23'),_0xd06948,_0x3875f6[_0xf384('0x26')][_0xf384('0x28')]);return _0x253707(_0x3875f6[_0xf384('0x26')][_0xf384('0x28')]);}else{logger[_0xf384('0x22')]('SmsAccount,\x20%s,\x20%s',_0xd06948,_0xf384('0x24'));_0x253707(_0x3875f6[_0xf384('0x29')][_0xf384('0x28')]);}})[_0xf384('0x2a')](function(_0xd8daff){logger[_0xf384('0x26')]('SmsAccount,\x20%s,\x20%s',_0xd06948,_0xd8daff);_0x1a6083(_0xd8daff);});});}function respondWithStatusCode(_0xcef116,_0x3a802a){_0x3a802a=_0x3a802a||0xcc;return function(_0xff543e){if(_0xff543e){return _0xcef116[_0xf384('0x2b')](_0x3a802a);}return _0xcef116[_0xf384('0x2c')](_0x3a802a)[_0xf384('0x2d')]();};}function respondWithResult(_0x2720e1,_0x4bab68){_0x4bab68=_0x4bab68||0xc8;return function(_0x1df5d4){if(_0x1df5d4){return _0x2720e1['status'](_0x4bab68)['json'](_0x1df5d4);}};}function respondWithFilteredResult(_0x520e7d,_0x3fae86){return function(_0x9a25fc){if(_0x9a25fc){var _0x2b140d=typeof _0x3fae86[_0xf384('0x2e')]===_0xf384('0x2f')&&typeof _0x3fae86[_0xf384('0x30')]===_0xf384('0x2f');var _0x4d12cc=_0x9a25fc[_0xf384('0x31')];var _0x2a1792=_0x2b140d?0x0:_0x3fae86[_0xf384('0x2e')];var _0x1a8033=_0x2b140d?_0x9a25fc[_0xf384('0x31')]:_0x3fae86[_0xf384('0x2e')]+_0x3fae86[_0xf384('0x30')];var _0x524086;if(_0x1a8033>=_0x4d12cc){_0x1a8033=_0x4d12cc;_0x524086=0xc8;}else{_0x524086=0xce;}_0x520e7d[_0xf384('0x2c')](_0x524086);return _0x520e7d['set'](_0xf384('0x32'),_0x2a1792+'-'+_0x1a8033+'/'+_0x4d12cc)['json'](_0x9a25fc);}return null;};}function patchUpdates(_0x49af7d){return function(_0x2332fb){try{jsonpatch[_0xf384('0x33')](_0x2332fb,_0x49af7d,!![]);}catch(_0x417d3d){return BPromise[_0xf384('0x34')](_0x417d3d);}return _0x2332fb[_0xf384('0x35')]();};}function saveUpdates(_0x1adc68,_0x54ecaa){return function(_0x34e489){if(_0x34e489){return _0x34e489[_0xf384('0x36')](_0x1adc68)[_0xf384('0x21')](function(_0x3cf1e2){return _0x3cf1e2;});}return null;};}function removeEntity(_0x2182e2,_0x30b9de){return function(_0x1e83a5){if(_0x1e83a5){return _0x1e83a5[_0xf384('0x37')]()[_0xf384('0x21')](function(){var _0x18d914=_0x1e83a5[_0xf384('0x38')]({'plain':!![]});var _0x56ae2d=_0xf384('0x39');return db['UserProfileResource'][_0xf384('0x37')]({'where':{'type':_0x56ae2d,'resourceId':_0x18d914['id']}})[_0xf384('0x21')](function(){return _0x1e83a5;});})['then'](function(){_0x2182e2[_0xf384('0x2c')](0xcc)[_0xf384('0x2d')]();});}};}function handleEntityNotFound(_0x1f3408,_0x86205b){return function(_0x2214d6){if(!_0x2214d6){_0x1f3408[_0xf384('0x2b')](0x194);}return _0x2214d6;};}function handleError(_0x255512,_0x4f5126){_0x4f5126=_0x4f5126||0x1f4;return function(_0x222f91){logger[_0xf384('0x26')](_0x222f91[_0xf384('0x3a')]);if(_0x222f91[_0xf384('0x3b')]){delete _0x222f91[_0xf384('0x3b')];}_0x255512[_0xf384('0x2c')](_0x4f5126)[_0xf384('0x3c')](_0x222f91);};}exports['index']=function(_0x427646,_0x50461b){var _0x226ec8={'include':[{'model':db[_0xf384('0x3d')],'as':_0xf384('0x3e')}]},_0x5017d7={},_0x36a647={'count':0x0,'rows':[]};var _0x502d98=_[_0xf384('0x3f')](db[_0xf384('0x40')][_0xf384('0x41')],function(_0x1e89ce){return{'name':_0x1e89ce[_0xf384('0x42')],'type':_0x1e89ce[_0xf384('0x43')][_0xf384('0x44')]};});_0x5017d7['model']=_['map'](_0x502d98,_0xf384('0x3b'));_0x5017d7[_0xf384('0x45')]=_[_0xf384('0x46')](_0x427646[_0xf384('0x45')]);_0x5017d7[_0xf384('0x47')]=_[_0xf384('0x48')](_0x5017d7[_0xf384('0x49')],_0x5017d7[_0xf384('0x45')]);_0x226ec8[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x5017d7['model'],qs[_0xf384('0x4b')](_0x427646[_0xf384('0x45')][_0xf384('0x4b')]));_0x226ec8[_0xf384('0x4a')]=_0x226ec8[_0xf384('0x4a')]['length']?_0x226ec8['attributes']:_0x5017d7[_0xf384('0x49')];if(!_0x427646[_0xf384('0x45')][_0xf384('0x4c')](_0xf384('0x4d'))){_0x226ec8['limit']=qs['limit'](_0x427646[_0xf384('0x45')][_0xf384('0x30')]);_0x226ec8['offset']=qs[_0xf384('0x2e')](_0x427646[_0xf384('0x45')]['offset']);}_0x226ec8['order']=qs['sort'](_0x427646[_0xf384('0x45')][_0xf384('0x4e')]);_0x226ec8['where']=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x427646['query'],_0x5017d7[_0xf384('0x47')]),_0x502d98);if(_0x427646[_0xf384('0x45')]['filter']){_0x226ec8['where']=_[_0xf384('0x50')](_0x226ec8['where'],{'$or':_[_0xf384('0x3f')](_0x502d98,function(_0xfff8f8){if(_0xfff8f8[_0xf384('0x43')]!==_0xf384('0x51')){var _0x1e0f77={};_0x1e0f77[_0xfff8f8[_0xf384('0x3b')]]={'$like':'%'+_0x427646['query'][_0xf384('0x52')]+'%'};return _0x1e0f77;}})});}_0x226ec8=_[_0xf384('0x50')]({},_0x226ec8,_0x427646['options']);var _0x3cec5c={'where':_0x226ec8[_0xf384('0x53')]};return db[_0xf384('0x40')][_0xf384('0x31')](_0x3cec5c)[_0xf384('0x21')](function(_0x4d8da8){_0x36a647[_0xf384('0x31')]=_0x4d8da8;if(_0x427646[_0xf384('0x45')][_0xf384('0x54')]){_0x226ec8['include']=[{'all':!![]}];}return db[_0xf384('0x40')][_0xf384('0x55')](_0x226ec8);})[_0xf384('0x21')](function(_0x3d8100){_0x36a647[_0xf384('0x56')]=_0x3d8100;return _0x36a647;})[_0xf384('0x21')](respondWithFilteredResult(_0x50461b,_0x226ec8))[_0xf384('0x2a')](handleError(_0x50461b,null));};exports['show']=function(_0x146c60,_0x542123){var _0x46dc50={'raw':![],'where':{'id':_0x146c60['params']['id']},'include':[{'model':db['Pause'],'as':_0xf384('0x3e')}]},_0x386395={};_0x386395[_0xf384('0x49')]=_[_0xf384('0x46')](db[_0xf384('0x40')][_0xf384('0x41')]);_0x386395[_0xf384('0x45')]=_['keys'](_0x146c60['query']);_0x386395[_0xf384('0x47')]=_[_0xf384('0x48')](_0x386395[_0xf384('0x49')],_0x386395['query']);_0x46dc50[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x386395['model'],qs[_0xf384('0x4b')](_0x146c60[_0xf384('0x45')][_0xf384('0x4b')]));_0x46dc50[_0xf384('0x4a')]=_0x46dc50[_0xf384('0x4a')][_0xf384('0x57')]?_0x46dc50[_0xf384('0x4a')]:_0x386395[_0xf384('0x49')];if(_0x146c60[_0xf384('0x45')]['includeAll']){_0x46dc50['include']=[{'all':!![]}];}_0x46dc50=_[_0xf384('0x50')]({},_0x46dc50,_0x146c60['options']);return db['SmsAccount'][_0xf384('0x58')](_0x46dc50)[_0xf384('0x21')](handleEntityNotFound(_0x542123,null))['then'](respondWithResult(_0x542123,null))['catch'](handleError(_0x542123,null));};exports[_0xf384('0x59')]=function(_0x390f53,_0x436023){return db[_0xf384('0x40')][_0xf384('0x59')](_0x390f53[_0xf384('0x5a')],{})[_0xf384('0x21')](function(_0x56e4de){var _0x438805=_0x390f53[_0xf384('0x5b')]['get']({'plain':!![]});if(!_0x438805)throw new Error(_0xf384('0x5c'));if(_0x438805['role']===_0xf384('0x5b')){var _0x3cf1d9=_0x56e4de[_0xf384('0x38')]({'plain':!![]});var _0x483021=_0xf384('0x39');return db['UserProfileSection'][_0xf384('0x58')]({'where':{'name':_0x483021,'userProfileId':_0x438805['userProfileId']},'raw':!![]})[_0xf384('0x21')](function(_0x357c4e){if(_0x357c4e&&_0x357c4e['autoAssociation']===0x0){return db[_0xf384('0x5d')]['create']({'name':_0x3cf1d9[_0xf384('0x3b')],'resourceId':_0x3cf1d9['id'],'type':_0x357c4e[_0xf384('0x3b')],'sectionId':_0x357c4e['id']},{})[_0xf384('0x21')](function(){return _0x56e4de;});}else{return _0x56e4de;}})[_0xf384('0x2a')](function(_0x140acf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x140acf);throw _0x140acf;});}return _0x56e4de;})[_0xf384('0x21')](respondWithResult(_0x436023,0xc9))[_0xf384('0x2a')](handleError(_0x436023,null));};exports[_0xf384('0x36')]=function(_0xa560e1,_0x2cec35){if(_0xa560e1[_0xf384('0x5a')]['id']){delete _0xa560e1['body']['id'];}return db['SmsAccount'][_0xf384('0x58')]({'where':{'id':_0xa560e1[_0xf384('0x5e')]['id']},'include':[{'model':db[_0xf384('0x3d')],'as':_0xf384('0x3e')}]})[_0xf384('0x21')](handleEntityNotFound(_0x2cec35,null))['then'](saveUpdates(_0xa560e1['body'],null))[_0xf384('0x21')](respondWithResult(_0x2cec35,null))[_0xf384('0x2a')](handleError(_0x2cec35,null));};exports[_0xf384('0x37')]=function(_0x1c3979,_0x3dff7d){return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x1c3979[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x3dff7d,null))['then'](removeEntity(_0x3dff7d,null))[_0xf384('0x2a')](handleError(_0x3dff7d,null));};exports[_0xf384('0x5f')]=function(_0x140183,_0x3301f7){return db[_0xf384('0x40')][_0xf384('0x5f')]()[_0xf384('0x21')](respondWithResult(_0x3301f7,null))[_0xf384('0x2a')](handleError(_0x3301f7,null));};exports[_0xf384('0x60')]=function(_0x5bce18,_0x1c44bc,_0x5a6dc8){if(_0x5bce18[_0xf384('0x5a')]['id']){delete _0x5bce18[_0xf384('0x5a')]['id'];}return db['SmsAccount'][_0xf384('0x58')]({'where':{'id':_0x5bce18[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x1c44bc,null))['then'](function(_0x56620c){if(_0x56620c){_0x5bce18[_0xf384('0x5a')][_0xf384('0x61')]=_0x56620c['id'];return db['Disposition']['create'](_0x5bce18[_0xf384('0x5a')]);}})[_0xf384('0x21')](respondWithResult(_0x1c44bc,null))[_0xf384('0x2a')](handleError(_0x1c44bc,null));};exports[_0xf384('0x62')]=function(_0x103e8e,_0x4cc4f9,_0x587f25){var _0x5525c4={'raw':![],'where':{}};var _0x309b61={};var _0x1119e9={'count':0x0,'rows':[]};return db[_0xf384('0x40')]['findOne']({'where':{'id':_0x103e8e[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4cc4f9,null))[_0xf384('0x21')](function(_0x37c2fa){if(_0x37c2fa){_0x309b61[_0xf384('0x49')]=_[_0xf384('0x46')](db[_0xf384('0x63')][_0xf384('0x41')]);_0x309b61[_0xf384('0x45')]=_['keys'](_0x103e8e['query']);_0x309b61[_0xf384('0x47')]=_[_0xf384('0x48')](_0x309b61[_0xf384('0x49')],_0x309b61[_0xf384('0x45')]);_0x5525c4[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x309b61['model'],qs[_0xf384('0x4b')](_0x103e8e[_0xf384('0x45')][_0xf384('0x4b')]));_0x5525c4[_0xf384('0x4a')]=_0x5525c4[_0xf384('0x4a')][_0xf384('0x57')]?_0x5525c4[_0xf384('0x4a')]:_0x309b61[_0xf384('0x49')];if(!_0x103e8e[_0xf384('0x45')][_0xf384('0x4c')]('nolimit')){_0x5525c4[_0xf384('0x30')]=qs[_0xf384('0x30')](_0x103e8e[_0xf384('0x45')][_0xf384('0x30')]);_0x5525c4['offset']=qs[_0xf384('0x2e')](_0x103e8e[_0xf384('0x45')]['offset']);}_0x5525c4[_0xf384('0x64')]=qs[_0xf384('0x4e')](_0x103e8e['query']['sort']);_0x5525c4[_0xf384('0x53')]=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x103e8e[_0xf384('0x45')],_0x309b61[_0xf384('0x47')]));_0x5525c4[_0xf384('0x53')][_0xf384('0x61')]=_0x37c2fa['id'];if(_0x103e8e[_0xf384('0x45')][_0xf384('0x52')]){_0x5525c4[_0xf384('0x53')]=_[_0xf384('0x50')](_0x5525c4[_0xf384('0x53')],{'$or':_['map'](_0x5525c4['attributes'],function(_0x7ce195){var _0x112e86={};_0x112e86[_0x7ce195]={'$like':'%'+_0x103e8e[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x112e86;})});}_0x5525c4=_[_0xf384('0x50')]({},_0x5525c4,_0x103e8e[_0xf384('0x65')]);return db[_0xf384('0x63')][_0xf384('0x31')]({'where':_0x5525c4['where']})[_0xf384('0x21')](function(_0x1883cd){_0x1119e9['count']=_0x1883cd;if(_0x103e8e[_0xf384('0x45')][_0xf384('0x54')]){_0x5525c4[_0xf384('0x66')]=[{'all':!![]}];}return db[_0xf384('0x63')]['findAll'](_0x5525c4);})['then'](function(_0x16311a){_0x1119e9['rows']=_0x16311a;return _0x1119e9;});}})[_0xf384('0x21')](respondWithFilteredResult(_0x4cc4f9,_0x5525c4))[_0xf384('0x2a')](handleError(_0x4cc4f9,null));};exports['removeDispositions']=function(_0xa6bd6e,_0xa9032f,_0x567f93){return db[_0xf384('0x40')]['find']({'where':{'id':_0xa6bd6e[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0xa9032f,null))[_0xf384('0x21')](function(_0x5e2266){if(_0x5e2266){return _0x5e2266[_0xf384('0x67')](_0xa6bd6e['query'][_0xf384('0x68')]);}})[_0xf384('0x21')](respondWithStatusCode(_0xa9032f,null))[_0xf384('0x2a')](handleError(_0xa9032f,null));};exports[_0xf384('0x69')]=function(_0x1e57a0,_0x403cfe,_0x364525){if(_0x1e57a0[_0xf384('0x5a')]['id']){delete _0x1e57a0['body']['id'];}return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x1e57a0[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x403cfe,null))[_0xf384('0x21')](function(_0x1b8cac){if(_0x1b8cac){_0x1e57a0[_0xf384('0x5a')][_0xf384('0x61')]=_0x1b8cac['id'];return db['CannedAnswer']['create'](_0x1e57a0['body']);}})['then'](respondWithResult(_0x403cfe,null))['catch'](handleError(_0x403cfe,null));};exports[_0xf384('0x6a')]=function(_0x26bd9d,_0x36f96d,_0x5c109a){var _0x45a19e={'raw':![],'where':{}};var _0x356235={};var _0x24393c={'count':0x0,'rows':[]};return db[_0xf384('0x40')][_0xf384('0x6b')]({'where':{'id':_0x26bd9d[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x36f96d,null))[_0xf384('0x21')](function(_0x186524){if(_0x186524){_0x356235['model']=_['keys'](db[_0xf384('0x6c')][_0xf384('0x41')]);_0x356235[_0xf384('0x45')]=_[_0xf384('0x46')](_0x26bd9d['query']);_0x356235[_0xf384('0x47')]=_[_0xf384('0x48')](_0x356235[_0xf384('0x49')],_0x356235[_0xf384('0x45')]);_0x45a19e[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x356235[_0xf384('0x49')],qs[_0xf384('0x4b')](_0x26bd9d['query'][_0xf384('0x4b')]));_0x45a19e[_0xf384('0x4a')]=_0x45a19e[_0xf384('0x4a')][_0xf384('0x57')]?_0x45a19e['attributes']:_0x356235[_0xf384('0x49')];if(!_0x26bd9d['query'][_0xf384('0x4c')](_0xf384('0x4d'))){_0x45a19e['limit']=qs[_0xf384('0x30')](_0x26bd9d[_0xf384('0x45')]['limit']);_0x45a19e['offset']=qs[_0xf384('0x2e')](_0x26bd9d['query']['offset']);}_0x45a19e[_0xf384('0x64')]=qs[_0xf384('0x4e')](_0x26bd9d['query'][_0xf384('0x4e')]);_0x45a19e[_0xf384('0x53')]=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x26bd9d[_0xf384('0x45')],_0x356235['filters']));_0x45a19e['where']['SmsAccountId']=_0x186524['id'];if(_0x26bd9d[_0xf384('0x45')]['filter']){_0x45a19e[_0xf384('0x53')]=_[_0xf384('0x50')](_0x45a19e['where'],{'$or':_[_0xf384('0x3f')](_0x45a19e[_0xf384('0x4a')],function(_0x1579a7){var _0x120a4e={};_0x120a4e[_0x1579a7]={'$like':'%'+_0x26bd9d[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x120a4e;})});}_0x45a19e=_[_0xf384('0x50')]({},_0x45a19e,_0x26bd9d[_0xf384('0x65')]);return db[_0xf384('0x6c')][_0xf384('0x31')]({'where':_0x45a19e[_0xf384('0x53')]})[_0xf384('0x21')](function(_0x35a1e0){_0x24393c[_0xf384('0x31')]=_0x35a1e0;if(_0x26bd9d[_0xf384('0x45')][_0xf384('0x54')]){_0x45a19e['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xf384('0x55')](_0x45a19e);})[_0xf384('0x21')](function(_0x377cc0){_0x24393c[_0xf384('0x56')]=_0x377cc0;return _0x24393c;});}})[_0xf384('0x21')](respondWithFilteredResult(_0x36f96d,_0x45a19e))[_0xf384('0x2a')](handleError(_0x36f96d,null));};exports[_0xf384('0x6d')]=function(_0x4dbb17,_0x3499ac,_0x12ba04){return db[_0xf384('0x40')]['find']({'where':{'id':_0x4dbb17[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x3499ac,null))['then'](function(_0x20e927){if(_0x20e927){return _0x20e927[_0xf384('0x6d')](_0x4dbb17[_0xf384('0x45')][_0xf384('0x68')]);}})[_0xf384('0x21')](respondWithStatusCode(_0x3499ac,null))[_0xf384('0x2a')](handleError(_0x3499ac,null));};exports[_0xf384('0x6e')]=function(_0x8e720a,_0x11a36d,_0x16dd82){var _0xfa32f4={'channel':'sms'};var _0x125d95=[];var _0x215642=[];var _0x1c2d87={};return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x8e720a[_0xf384('0x5e')]['id']},'include':[{'model':db[_0xf384('0x6f')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x11a36d,null))[_0xf384('0x21')](function(_0x34b0cf){_0xfa32f4[_0xf384('0x70')]=_0x34b0cf;_0xfa32f4['applications']=_[_0xf384('0x71')](_0x34b0cf[_0xf384('0x72')],[_0xf384('0x73')],[_0xf384('0x74')]);if(_0xfa32f4['account'][_0xf384('0x72')]){delete _0xfa32f4[_0xf384('0x70')]['Applications'];}return db[_0xf384('0x75')][_0xf384('0x5f')]();})[_0xf384('0x21')](function(_0x3304f4){if(!_0x3304f4){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))](_0xf384('0x78'));}_0x125d95=_[_0xf384('0x79')](_[_0xf384('0x46')](_0x3304f4),[_0xf384('0x7a'),_0xf384('0x7b')]);_0x215642=_[_0xf384('0x79')](_[_0xf384('0x46')](_0x3304f4),[_0xf384('0x7a'),_0xf384('0x7b'),'CompanyId','ListId']);_0xfa32f4[_0xf384('0x5a')]={'mapKey':_0xf384('0x7c')};if(_0xfa32f4[_0xf384('0x70')][_0xf384('0x43')]){switch(_0xfa32f4['account'][_0xf384('0x43')]){case _0xf384('0x7d'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x7f')];_0xfa32f4['body'][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x80')];_0xfa32f4[_0xf384('0x5a')]['messageId']=_0x8e720a[_0xf384('0x5a')][_0xf384('0x81')];break;case'skebby':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]='+'+_0x8e720a[_0xf384('0x5a')]['sender'];_0xfa32f4['body']['body']=_0x8e720a[_0xf384('0x5a')][_0xf384('0x82')];break;case _0xf384('0x83'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x7e')];_0xfa32f4['body'][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')]['message'];break;case'clicksend':_0xfa32f4['body'][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x7e')];_0xfa32f4['body']['body']=_0x8e720a[_0xf384('0x5a')][_0xf384('0x5a')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')]=_0x8e720a['body'][_0xf384('0x85')];break;case'plivo':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x7f')];_0xfa32f4[_0xf384('0x5a')]['body']=_0x8e720a['body'][_0xf384('0x86')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x87')];break;case _0xf384('0x88'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]='+'+_0x8e720a['body'][_0xf384('0x89')][0x0][_0xf384('0x7e')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a['body'][_0xf384('0x89')][0x0][_0xf384('0x82')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')]=_0x8e720a['body'][_0xf384('0x89')][0x0]['messageId'];break;case _0xf384('0x8a'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x8b')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x8c')]['message'];break;case _0xf384('0x8d'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a['body'][_0xf384('0x8e')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')]['text'];_0xfa32f4[_0xf384('0x5a')]['messageId']=_0x8e720a['body'][_0xf384('0x8f')];break;case _0xf384('0x90'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')]=_0x8e720a[_0xf384('0x5a')][0x0]['message']['id'];_0xfa32f4['body'][_0xf384('0x7e')]=_0x8e720a['body'][0x0][_0xf384('0x28')][_0xf384('0x7e')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')][0x0][_0xf384('0x28')][_0xf384('0x82')];break;case _0xf384('0x91'):_0xfa32f4[_0xf384('0x5a')]['from']=_0x8e720a[_0xf384('0x5a')]['from'];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')]['message'];_0xfa32f4[_0xf384('0x5a')]['messageId']=_0x8e720a[_0xf384('0x5a')][_0xf384('0x92')];break;}}if(_0xfa32f4[_0xf384('0x5a')]['id']){delete _0xfa32f4[_0xf384('0x5a')]['id'];}if(_[_0xf384('0x93')](_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')])){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))]('from\x20is\x20mandatory');}if(_[_0xf384('0x93')](_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')])||_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]===''){throw new db['Sequelize']['ValidationError'](_0xf384('0x94'));}if(_[_0xf384('0x93')](_0xfa32f4['body']['mapKey'])){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))](_0xf384('0x95')+_0x215642);}if(!_[_0xf384('0x96')](_0x215642,_0xfa32f4[_0xf384('0x5a')][_0xf384('0x97')])){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))](_0xf384('0x98')+_0x215642);}_0x1c2d87[_0xfa32f4['body'][_0xf384('0x97')]]=_0xfa32f4[_0xf384('0x5a')]['from'];return db[_0xf384('0x99')]['find']({'where':{'id':_0xfa32f4[_0xf384('0x70')][_0xf384('0x9a')]},'include':[{'model':db[_0xf384('0x75')],'as':_0xf384('0x9b'),'where':_0x1c2d87,'limit':0x1,'order':[[_0xf384('0x7b'),_0xf384('0x9c')]]}]});})[_0xf384('0x21')](handleEntityNotFound(_0x11a36d,null))[_0xf384('0x21')](function(_0x2db34a){if(_0x2db34a){_0xfa32f4[_0xf384('0x9d')]=_[_0xf384('0x9e')](_0x2db34a,['Contacts']);if(_0x2db34a[_0xf384('0x9b')][_0xf384('0x57')]){return _0x2db34a[_0xf384('0x9b')][0x0];}var _0xe63a8d=_[_0xf384('0x18')](_0xfa32f4[_0xf384('0x5a')],{'firstName':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')],'ListId':_0x2db34a['id']});_0xe63a8d[_0xfa32f4[_0xf384('0x5a')][_0xf384('0x97')]]=_0xfa32f4['body'][_0xf384('0x7e')];return db[_0xf384('0x75')]['create'](_0xe63a8d,{'fields':_0x125d95,'raw':!![]});}})['then'](handleEntityNotFound(_0x11a36d,null))[_0xf384('0x21')](function(_0x3a005f){if(_0x3a005f){_0xfa32f4[_0xf384('0x9f')]=_0x3a005f;var _0x13de4f={'ContactId':_0x3a005f['id'],'phone':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')],'SmsAccountId':_0x8e720a['params']['id']};var _0x34449d={'ContactId':_0x3a005f['id'],'SmsAccountId':_0x8e720a[_0xf384('0x5e')]['id'],'closed':![]};return db[_0xf384('0xa0')]['find']({'where':_0x34449d})[_0xf384('0x21')](function(_0x41778f){if(_0x41778f){return[_0x41778f,![]];}return db[_0xf384('0xa0')]['create'](_0x13de4f)[_0xf384('0x21')](function(_0x340913){return[_0x340913,!![]];});});}})[_0xf384('0xa1')](function(_0x3577ef,_0xcc5541){_0xfa32f4['interaction']=_0x3577ef[_0xf384('0x38')]({'plain':!![]});_0xfa32f4[_0xf384('0xa2')][_0xf384('0xa3')]=![];if(_0xcc5541){if(_0xfa32f4[_0xf384('0x70')]['autoclose']){_0xfa32f4[_0xf384('0xa4')][_0xf384('0xa5')]({'id':0x0,'priority':_0xfa32f4[_0xf384('0xa4')][_0xf384('0x57')]+0x1,'app':_0xf384('0xa6'),'appdata':_0xf384('0xa7'),'interval':_0xf384('0xa8')});}_0xfa32f4['interaction'][_0xf384('0xa3')]=!![];}return db[_0xf384('0xa9')]['create']({'phone':_0xfa32f4[_0xf384('0x5a')]['from'],'messageId':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')],'body':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')],'SmsAccountId':_0x8e720a[_0xf384('0x5e')]['id'],'SmsInteractionId':_0x3577ef['id'],'direction':'in','ContactId':_0x3577ef[_0xf384('0xaa')],'AttachmentId':_0xfa32f4['body']['AttachmentId']});})[_0xf384('0x21')](function(_0x149e00){_0xfa32f4[_0xf384('0x28')]=_0x149e00;if(!_0xfa32f4['interaction']['UserId'])return;return db[_0xf384('0xab')][_0xf384('0x58')]({'attributes':['id',_0xf384('0x3b')],'where':{'id':_0xfa32f4[_0xf384('0xa2')][_0xf384('0xac')]}});})[_0xf384('0x21')](function(_0x3b9885){if(_0x3b9885){_0xfa32f4[_0xf384('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf384('0xad'),'appdata':_0x3b9885[_0xf384('0x3b')]+','+(_0xfa32f4[_0xf384('0x70')][_0xf384('0xae')]||0xa),'interval':_0xf384('0xa8')});}if(!_0xfa32f4[_0xf384('0xa2')]['queueId'])return;return db[_0xf384('0xaf')]['find']({'attributes':['id','name'],'where':{'id':_0xfa32f4[_0xf384('0xa2')][_0xf384('0xb0')]}});})[_0xf384('0x21')](function(_0x511775){if(_0x511775){_0xfa32f4[_0xf384('0xa4')]['unshift']({'id':0x0,'priority':0x1,'app':_0xf384('0xb1'),'appdata':_0x511775[_0xf384('0x3b')]+','+(_0xfa32f4[_0xf384('0x70')][_0xf384('0xb2')]||0x12c),'interval':_0xf384('0xa8')});}return respondWithRpcPromise('Start',_0xf384('0xb3'),_0xfa32f4);})[_0xf384('0x21')](function(_0x5bcae2){if(_0x5bcae2){var _0xbb02cd=0xc8;var _0xf0a033=_0xf384('0xb4');logger[_0xf384('0x22')](_0xf384('0xb5'),_0xf0a033,_0xbb02cd,_0xf384('0xb6'));logger[_0xf384('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xf0a033,_0xbb02cd,_0xf384('0xb6'),JSON[_0xf384('0xb7')](_0x5bcae2));if(_0xfa32f4[_0xf384('0x70')][_0xf384('0x43')]===_0xf384('0x7d')){return _0x11a36d[_0xf384('0x2c')](_0xbb02cd)[_0xf384('0xb8')]('Content-Type','text/xml')[_0xf384('0x3c')](_0xf384('0xb9'));}else{return _0x11a36d[_0xf384('0x2c')](_0xbb02cd)[_0xf384('0xba')](_0x5bcae2);}}})[_0xf384('0x2a')](handleError(_0x11a36d,null));};exports[_0xf384('0xbb')]=function(_0x2f7e22,_0x3dec3e){var _0x200de8=_0x2f7e22[_0xf384('0x5e')]['id'];var _0xc6ba1f=_0x2f7e22[_0xf384('0x5a')];var _0x1ec342=0xc8;var _0x3e26fb=null;return db[_0xf384('0xbc')][_0xf384('0xbd')]({'isolationLevel':db['sequelize'][_0xf384('0xbe')][_0xf384('0xbf')][_0xf384('0xc0')]},function(_0x370aa4){return db['SmsAccount'][_0xf384('0x6b')]({'where':{'id':_0x200de8},'transaction':_0x370aa4})[_0xf384('0x21')](function(_0x150bcf){if(_0x150bcf){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x200de8},'transaction':_0x370aa4})[_0xf384('0x21')](function(){var _0x357c3b=_['map'](_0xc6ba1f,function(_0x506da5){_0x506da5['SmsAccountId']=_0x200de8;return _0x506da5;});return db[_0xf384('0x6f')][_0xf384('0xc1')](_0x357c3b,{'transaction':_0x370aa4});});}else{_0x1ec342=0x194;_0x3e26fb=[];}});})[_0xf384('0x21')](function(){if(_0x1ec342!==0x194){return db[_0xf384('0x6f')][_0xf384('0xc2')]({'where':{'SmsAccountId':_0x200de8},'order':_0xf384('0x73')})[_0xf384('0x21')](function(_0x2bffd5){_0x3e26fb=_0x2bffd5;});}})[_0xf384('0x2a')](function(_0x99b15f){_0x1ec342=0x1f4;logger[_0xf384('0x26')](_0x99b15f[_0xf384('0x3a')]);if(_0x99b15f['name']){delete _0x99b15f[_0xf384('0x3b')];}_0x3e26fb=_0x99b15f;})[_0xf384('0xc3')](function(){if(_0x3e26fb===null){_0x3dec3e[_0xf384('0x2b')](_0x1ec342);}else{if(_0x1ec342===0x1f4){_0x3dec3e['status'](_0x1ec342)[_0xf384('0x3c')](_0x3e26fb);}else{_0x3dec3e[_0xf384('0x2c')](_0x1ec342)[_0xf384('0xba')](_0x3e26fb);}}});};exports['getApplications']=function(_0x24b0a3,_0x17ffa1,_0x5ee1c9){var _0x3930f7={};var _0x149197={};var _0x4ae467;var _0x17e3f3;return db[_0xf384('0x40')][_0xf384('0x6b')]({'where':{'id':_0x24b0a3['params']['id']}})['then'](handleEntityNotFound(_0x17ffa1,null))[_0xf384('0x21')](function(_0x155351){if(_0x155351){_0x4ae467=_0x155351;_0x149197[_0xf384('0x49')]=_[_0xf384('0x46')](db['SmsApplication'][_0xf384('0x41')]);_0x149197[_0xf384('0x45')]=_[_0xf384('0x46')](_0x24b0a3[_0xf384('0x45')]);_0x149197[_0xf384('0x47')]=_['intersection'](_0x149197[_0xf384('0x49')],_0x149197[_0xf384('0x45')]);_0x3930f7[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x149197[_0xf384('0x49')],qs[_0xf384('0x4b')](_0x24b0a3['query'][_0xf384('0x4b')]));_0x3930f7[_0xf384('0x4a')]=_0x3930f7[_0xf384('0x4a')][_0xf384('0x57')]?_0x3930f7['attributes']:_0x149197[_0xf384('0x49')];_0x3930f7[_0xf384('0x64')]=qs['sort'](_0x24b0a3[_0xf384('0x45')][_0xf384('0x4e')]);_0x3930f7['where']=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x24b0a3[_0xf384('0x45')],_0x149197[_0xf384('0x47')]));if(_0x24b0a3[_0xf384('0x45')][_0xf384('0x52')]){_0x3930f7[_0xf384('0x53')]=_[_0xf384('0x50')](_0x3930f7[_0xf384('0x53')],{'$or':_['map'](_0x3930f7['attributes'],function(_0x237588){var _0x3ba75d={};_0x3ba75d[_0x237588]={'$like':'%'+_0x24b0a3[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x3ba75d;})});}_0x3930f7=_[_0xf384('0x50')]({},_0x3930f7,_0x24b0a3[_0xf384('0x65')]);return _0x4ae467[_0xf384('0xc4')](_0x3930f7);}})[_0xf384('0x21')](function(_0x3dc055){if(_0x3dc055){_0x17e3f3=_0x3dc055['length'];if(!_0x24b0a3['query']['hasOwnProperty'](_0xf384('0x4d'))){_0x3930f7[_0xf384('0x30')]=qs['limit'](_0x24b0a3[_0xf384('0x45')][_0xf384('0x30')]);_0x3930f7[_0xf384('0x2e')]=qs['offset'](_0x24b0a3['query']['offset']);}return _0x4ae467[_0xf384('0xc4')](_0x3930f7);}})[_0xf384('0x21')](function(_0x44b2d5){if(_0x44b2d5){return _0x44b2d5?{'count':_0x17e3f3,'rows':_0x44b2d5}:null;}})['then'](respondWithResult(_0x17ffa1,null))['catch'](handleError(_0x17ffa1,null));};exports[_0xf384('0xc5')]=function(_0x1bc779,_0x1130db,_0x279caf){var _0x3eba98={'raw':![],'where':{}};var _0x2f0a52={};var _0x55b6aa={'count':0x0,'rows':[]};return db[_0xf384('0x40')][_0xf384('0x6b')]({'where':{'id':_0x1bc779['params']['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x1130db,null))[_0xf384('0x21')](function(_0x4b78ba){if(_0x4b78ba){_0x2f0a52['model']=_[_0xf384('0x46')](db[_0xf384('0xa0')]['rawAttributes']);_0x2f0a52['query']=_[_0xf384('0x46')](_0x1bc779[_0xf384('0x45')]);_0x2f0a52['filters']=_[_0xf384('0x48')](_0x2f0a52[_0xf384('0x49')],_0x2f0a52[_0xf384('0x45')]);_0x3eba98[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x2f0a52[_0xf384('0x49')],qs[_0xf384('0x4b')](_0x1bc779['query'][_0xf384('0x4b')]));_0x3eba98[_0xf384('0x4a')]=_0x3eba98[_0xf384('0x4a')][_0xf384('0x57')]?_0x3eba98['attributes']:_0x2f0a52['model'];if(!_0x1bc779[_0xf384('0x45')][_0xf384('0x4c')](_0xf384('0x4d'))){_0x3eba98['limit']=qs[_0xf384('0x30')](_0x1bc779[_0xf384('0x45')][_0xf384('0x30')]);_0x3eba98[_0xf384('0x2e')]=qs[_0xf384('0x2e')](_0x1bc779[_0xf384('0x45')][_0xf384('0x2e')]);}_0x3eba98['order']=qs[_0xf384('0x4e')](_0x1bc779['query'][_0xf384('0x4e')]);_0x3eba98[_0xf384('0x53')]=qs[_0xf384('0x47')](_['pick'](_0x1bc779[_0xf384('0x45')],_0x2f0a52['filters']));_0x3eba98[_0xf384('0x53')][_0xf384('0x61')]=_0x4b78ba['id'];if(_0x1bc779[_0xf384('0x45')]['filter']){_0x3eba98[_0xf384('0x53')]=_[_0xf384('0x50')](_0x3eba98['where'],{'$or':_[_0xf384('0x3f')](_0x3eba98[_0xf384('0x4a')],function(_0x1dafc6){var _0x520b37={};_0x520b37[_0x1dafc6]={'$like':'%'+_0x1bc779[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x520b37;})});}_0x3eba98=_['merge']({},_0x3eba98,_0x1bc779['options']);return db[_0xf384('0xa0')]['count']({'where':_0x3eba98['where']})[_0xf384('0x21')](function(_0xcd6dcd){_0x55b6aa[_0xf384('0x31')]=_0xcd6dcd;if(_0x1bc779['query'][_0xf384('0x54')]){_0x3eba98[_0xf384('0x66')]=[{'model':db[_0xf384('0x75')],'as':'Contact','required':![]},{'model':db[_0xf384('0xab')],'as':_0xf384('0xc6'),'attributes':[_0xf384('0x3b'),_0xf384('0xc7'),'internal'],'required':![]},{'model':db[_0xf384('0xc8')],'as':_0xf384('0xc9'),'attributes':['id',_0xf384('0x3b'),_0xf384('0xca')],'where':_0x1bc779[_0xf384('0x45')][_0xf384('0xcb')]?{'id':_0x1bc779[_0xf384('0x45')]['tag']}:undefined,'required':_0x1bc779['query']['tag']?!![]:![]}];}return db[_0xf384('0xa0')][_0xf384('0x55')](_0x3eba98);})[_0xf384('0x21')](function(_0x56de21){_0x55b6aa[_0xf384('0x56')]=_0x56de21;return _0x55b6aa;});}})[_0xf384('0x21')](respondWithFilteredResult(_0x1130db,_0x3eba98))[_0xf384('0x2a')](handleError(_0x1130db,null));};exports[_0xf384('0x3c')]=function(_0x1df6db,_0x2ea33b,_0x588108){var _0x1628a4,_0x2ed4ae,_0xbd948;if(_[_0xf384('0x93')](_0x1df6db[_0xf384('0x5a')][_0xf384('0x5a')])||_0x1df6db[_0xf384('0x5a')][_0xf384('0x5a')]===''){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))](_0xf384('0x94'));}if(_['isNil'](_0x1df6db['body']['to'])){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))]('to\x20is\x20mandatory');}_0x1628a4=_0x1df6db[_0xf384('0x5a')]['to'];return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x1df6db[_0xf384('0x5e')]['id']},'include':[{'model':db[_0xf384('0x99')],'as':_0xf384('0xcc'),'include':[{'model':db['CmContact'],'as':_0xf384('0x9b'),'where':{'mobile':_0x1628a4},'limit':0x1,'order':[[_0xf384('0x7b'),_0xf384('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x2ea33b,null))['then'](function(_0x1d1d3f){if(_0x1d1d3f&&_0x1d1d3f[_0xf384('0xcc')]){_0x2ed4ae=_0x1d1d3f['get']({'plain':!![]});if(_0x2ed4ae[_0xf384('0xcc')]&&_0x2ed4ae['List'][_0xf384('0x9b')]['length']){return _0x2ed4ae['List'][_0xf384('0x9b')][0x0];}return db[_0xf384('0x75')][_0xf384('0x59')](_['defaults'](_0x1df6db[_0xf384('0x5a')],{'firstName':_0x1628a4,'mobile':_0x1628a4,'phone':_0x1628a4,'ListId':_0x2ed4ae[_0xf384('0x9a')]}));}})[_0xf384('0x21')](handleEntityNotFound(_0x2ea33b,null))[_0xf384('0x21')](function(_0x50bbed){if(_0x50bbed){_0xbd948=_0x50bbed;return db[_0xf384('0xa0')][_0xf384('0x58')]({'where':{'ContactId':_0xbd948['id'],'closed':![],'SmsAccountId':_0x2ed4ae['id']}})['then'](function(_0x12e9a7){if(_0x12e9a7){return[_0x12e9a7,![]];}return db[_0xf384('0xa0')][_0xf384('0x59')]({'UserId':_0x1df6db[_0xf384('0x5b')]['id'],'ContactId':_0xbd948['id'],'SmsAccountId':_0x2ed4ae['id'],'phone':_0x1628a4,'firstMsgDirection':_0xf384('0xcd'),'Messages':[_[_0xf384('0x50')](_0x1df6db[_0xf384('0x5a')],{'read':![],'body':_0x1df6db['body']['body'],'phone':_0x1628a4,'SmsAccountId':_0x2ed4ae['id'],'UserId':_0x1df6db[_0xf384('0x5b')]['id'],'ContactId':_0xbd948['id']})]},{'include':[{'model':db[_0xf384('0xa9')],'as':_0xf384('0xce')}]})[_0xf384('0x21')](function(_0x25a50d){return[_0x25a50d,!![]];});});}})[_0xf384('0xa1')](function(_0x5294d4,_0x4d6c2a){if(_0x4d6c2a){return _0x5294d4;}return db[_0xf384('0xa9')][_0xf384('0x59')](_['merge'](_0x1df6db[_0xf384('0x5a')],{'read':![],'body':_0x1df6db[_0xf384('0x5a')][_0xf384('0x5a')],'phone':_0x1628a4,'SmsAccountId':_0x2ed4ae['id'],'SmsInteractionId':_0x5294d4['id'],'UserId':_0x1df6db[_0xf384('0x5b')]['id'],'ContactId':_0xbd948['id']}))[_0xf384('0x21')](function(_0x24fc83){_0x5294d4['dataValues'][_0xf384('0xce')]=[];_0x5294d4[_0xf384('0xcf')]['Messages'][_0xf384('0xa5')](_0x24fc83[_0xf384('0xcf')]);return _0x5294d4;});})[_0xf384('0x21')](respondWithResult(_0x2ea33b,null))[_0xf384('0x2a')](handleError(_0x2ea33b,null));};exports[_0xf384('0x2c')]=function(_0x4d5c78,_0x2ab160,_0x34ada3){if(_0x4d5c78['body']['id']){delete _0x4d5c78[_0xf384('0x5a')]['id'];}var _0x14bef5,_0x58510c,_0x2ce598;return db[_0xf384('0x40')]['find']({'where':{'id':_0x4d5c78['params']['id']}})['then'](handleEntityNotFound(_0x2ab160,null))[_0xf384('0x21')](function(_0x13540d){if(_0x13540d){_0x2ce598=_0x13540d;logger[_0xf384('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf384('0x2c'),_0xf384('0xd0'),_0x13540d[_0xf384('0x43')],util[_0xf384('0xd1')](_0x4d5c78['body'],{'showHidden':![],'depth':null}));switch(_0x13540d[_0xf384('0x43')]){case'skebby':if(_0x4d5c78[_0xf384('0x5a')]['skebby_dispatch_id']&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')];return db[_0xf384('0xa9')]['find']({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd2')]}});}break;case _0xf384('0x83'):if(_0x4d5c78[_0xf384('0x5a')]['requestid']&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd3')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd3')];return db['SmsMessage'][_0xf384('0x58')]({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd4')]}});}break;case'clicksend':if(_0x4d5c78['body'][_0xf384('0x85')]&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd5')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd5')];return db['SmsMessage'][_0xf384('0x58')]({'where':{'messageId':_0x4d5c78['body'][_0xf384('0x85')]}});}break;case _0xf384('0x88'):var _0x5e5117=_0x4d5c78['body'][_0xf384('0x89')][0x0];if(_0x5e5117[_0xf384('0x84')]&&_0x5e5117['status'][_0xf384('0xd6')]==='DELIVERED'){_0x58510c=_0x5e5117[_0xf384('0x2c')]['groupName'];return db[_0xf384('0xa9')][_0xf384('0x58')]({'where':{'messageId':_0x5e5117[_0xf384('0x84')]}});}break;case'clickatell':if(_0x4d5c78[_0xf384('0x5a')][_0xf384('0x84')]&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')];return db[_0xf384('0xa9')]['find']({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][_0xf384('0x84')]}});}break;case _0xf384('0x90'):if(_0x4d5c78[_0xf384('0x5a')][0x0]['message']['id']){_0x58510c=_0x4d5c78[_0xf384('0x5a')][0x0][_0xf384('0x43')];return db[_0xf384('0xa9')][_0xf384('0x58')]({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][0x0][_0xf384('0x28')]['id']}});}break;case _0xf384('0x91'):if(_0x4d5c78[_0xf384('0x5a')]['redif']&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')];return db['SmsMessage'][_0xf384('0x58')]({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x2ab160,null))['then'](function(_0x47a2bb){if(_0x47a2bb){_0x14bef5=_0x47a2bb;switch(_0x2ce598[_0xf384('0x43')]){case _0xf384('0xd8'):if(_0x58510c==='DELIVERED'){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger[_0xf384('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf384('0x2c'),_0xf384('0xd8'),util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x83'):if(_0x58510c==='1'){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger[_0xf384('0x26')](_0xf384('0xb5'),'status',_0xf384('0xd8'),util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd9')]&&_0x58510c>=0xc8&&_0x58510c<=0xce){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger[_0xf384('0x26')](_0xf384('0xb5'),'status',_0xf384('0xda'),util['inspect'](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x88'):var _0x280570=_0x4d5c78[_0xf384('0x5a')][_0xf384('0x89')][0x0];if(_0x280570['status'][_0xf384('0xd6')]===_0xf384('0xdb')){return _0x14bef5['update']({'read':!![]});}else{logger[_0xf384('0x26')](_0xf384('0xb5'),_0xf384('0x2c'),'infobip',util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x8d'):if(_0x58510c=='DELIVERED_TO_GATEWAY'||_0x58510c=='RECEIVED_BY_RECIPIENT'){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','clickatell',util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x90'):if(_0x58510c=='message-delivered'){return _0x14bef5['update']({'read':!![]});}else{logger[_0xf384('0x26')](_0xf384('0xb5'),_0xf384('0x2c'),_0xf384('0x90'),util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x91'):if(_0x58510c===_0xf384('0xdc')||_0x58510c===_0xf384('0xdd')){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger[_0xf384('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf384('0x2c'),_0xf384('0x91'),util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x14bef5;}})[_0xf384('0x21')](respondWithResult(_0x2ab160,null))[_0xf384('0x2a')](handleError(_0x2ab160,null));};exports[_0xf384('0xde')]=function(_0x33c9b8,_0x550e55,_0x4dba45){var _0x239a46,_0x2ab884,_0x5884ef;return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x33c9b8[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x550e55,null))['then'](function(_0x427101){if(_0x427101){_0x5884ef=_0x427101;logger[_0xf384('0x25')](_0xf384('0xb5'),_0xf384('0x2c'),'received\x20delivery\x20report\x20from',_0x427101['type'],util['inspect'](_0x33c9b8[_0xf384('0x45')],{'showHidden':![],'depth':null}));switch(_0x427101[_0xf384('0x43')]){case _0xf384('0x8a'):if(_0x33c9b8[_0xf384('0x45')][_0xf384('0xdf')]&&_0x33c9b8[_0xf384('0x45')][_0xf384('0xe0')]){_0x2ab884=_0x33c9b8[_0xf384('0x45')][_0xf384('0xe0')];return db[_0xf384('0xa9')]['find']({'where':{'messageId':_0x33c9b8[_0xf384('0x45')][_0xf384('0xdf')]}});}break;}}})['then'](handleEntityNotFound(_0x550e55,null))[_0xf384('0x21')](function(_0x4557dc){if(_0x4557dc){_0x239a46=_0x4557dc;switch(_0x5884ef[_0xf384('0x43')]){case'csc':if(_0x2ab884==='2'||_0x2ab884==='6'){return _0x239a46['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf384('0x2c'),_0xf384('0x8a'),util[_0xf384('0xd1')](_0x33c9b8[_0xf384('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x239a46;}})['then'](respondWithResult(_0x550e55,null))[_0xf384('0x2a')](handleError(_0x550e55,null));};exports[_0xf384('0xe1')]=function(_0x577413,_0x38b10a,_0x5415d9){return db['SmsAccount']['find']({'where':{'id':_0x577413['params']['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x38b10a,null))[_0xf384('0x21')](function(_0x4a0010){if(_0x4a0010){return _0x4a0010[_0xf384('0xe1')](_0x577413[_0xf384('0x5a')][_0xf384('0x68')],_[_0xf384('0x9e')](_0x577413[_0xf384('0x5a')],[_0xf384('0x68'),'id'])||{})[_0xf384('0xa1')](function(_0x2c2a2f){for(var _0x134b4f=0x0;_0x134b4f<_0x577413[_0xf384('0x5a')][_0xf384('0x68')][_0xf384('0x57')];_0x134b4f+=0x1){socket[_0xf384('0xe2')](_0xf384('0xe3'),{'UserId':Number(_0x577413[_0xf384('0x5a')][_0xf384('0x68')][_0x134b4f]),'SmsAccountId':Number(_0x577413['params']['id'])});}return _0x2c2a2f;});}})[_0xf384('0x21')](respondWithResult(_0x38b10a,null))[_0xf384('0x2a')](handleError(_0x38b10a,null));};exports[_0xf384('0xe4')]=function(_0x4b7e61,_0x1a81cc,_0x1070c0){return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x4b7e61[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1a81cc,null))[_0xf384('0x21')](function(_0x3de270){if(_0x3de270){return _0x3de270['removeAgents'](_0x4b7e61['query'][_0xf384('0x68')])[_0xf384('0x21')](function(){if(_[_0xf384('0xe5')](_0x4b7e61[_0xf384('0x45')]['ids'])){for(var _0x50acc7=0x0;_0x50acc7<_0x4b7e61[_0xf384('0x45')][_0xf384('0x68')][_0xf384('0x57')];_0x50acc7+=0x1){socket[_0xf384('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0x4b7e61[_0xf384('0x45')][_0xf384('0x68')][_0x50acc7]),'SmsAccountId':Number(_0x4b7e61['params']['id'])});}}else{socket[_0xf384('0xe2')](_0xf384('0xe6'),{'UserId':Number(_0x4b7e61[_0xf384('0x45')][_0xf384('0x68')]),'SmsAccountId':Number(_0x4b7e61[_0xf384('0x5e')]['id'])});}});}})[_0xf384('0x21')](respondWithStatusCode(_0x1a81cc,null))[_0xf384('0x2a')](handleError(_0x1a81cc,null));};exports['getAgents']=function(_0x5bc344,_0x205c4a,_0x2742a0){var _0x4f2808={};var _0x41a26c={};var _0x55abaa;var _0x921067;return db[_0xf384('0x40')][_0xf384('0x6b')]({'where':{'id':_0x5bc344[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x205c4a,null))[_0xf384('0x21')](function(_0x2e5267){if(_0x2e5267){_0x55abaa=_0x2e5267;_0x41a26c[_0xf384('0x49')]=_[_0xf384('0x46')](db[_0xf384('0xab')][_0xf384('0x41')]);_0x41a26c[_0xf384('0x45')]=_[_0xf384('0x46')](_0x5bc344[_0xf384('0x45')]);_0x41a26c['filters']=_[_0xf384('0x48')](_0x41a26c['model'],_0x41a26c[_0xf384('0x45')]);_0x4f2808[_0xf384('0x4a')]=_['intersection'](_0x41a26c[_0xf384('0x49')],qs[_0xf384('0x4b')](_0x5bc344['query']['fields']));_0x4f2808[_0xf384('0x4a')]=_0x4f2808['attributes'][_0xf384('0x57')]?_0x4f2808[_0xf384('0x4a')]:_0x41a26c[_0xf384('0x49')];_0x4f2808[_0xf384('0x64')]=qs[_0xf384('0x4e')](_0x5bc344[_0xf384('0x45')]['sort']);_0x4f2808[_0xf384('0x53')]=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x5bc344[_0xf384('0x45')],_0x41a26c[_0xf384('0x47')]));if(_0x5bc344['query']['filter']){_0x4f2808[_0xf384('0x53')]=_[_0xf384('0x50')](_0x4f2808[_0xf384('0x53')],{'$or':_[_0xf384('0x3f')](_0x4f2808[_0xf384('0x4a')],function(_0x56df9b){var _0x5d8539={};_0x5d8539[_0x56df9b]={'$like':'%'+_0x5bc344[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x5d8539;})});}_0x4f2808=_['merge']({},_0x4f2808,_0x5bc344[_0xf384('0x65')]);return _0x55abaa[_0xf384('0xe7')](_0x4f2808);}})['then'](function(_0x30040f){if(_0x30040f){_0x921067=_0x30040f[_0xf384('0x57')];if(!_0x5bc344[_0xf384('0x45')][_0xf384('0x4c')]('nolimit')){_0x4f2808['limit']=qs[_0xf384('0x30')](_0x5bc344[_0xf384('0x45')][_0xf384('0x30')]);_0x4f2808[_0xf384('0x2e')]=qs['offset'](_0x5bc344[_0xf384('0x45')][_0xf384('0x2e')]);}return _0x55abaa[_0xf384('0xe7')](_0x4f2808);}})['then'](function(_0x12d4f4){if(_0x12d4f4){return _0x12d4f4?{'count':_0x921067,'rows':_0x12d4f4}:null;}})['then'](respondWithResult(_0x205c4a,null))[_0xf384('0x2a')](handleError(_0x205c4a,null));}; \ No newline at end of file +var _0xb049=['UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','stack','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','message-id','state','csc','addAgents','omit','emit','userSmsAccount:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','SmsAccounts','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','SmsAccountId','findAll','rows','removeDispositions','CannedAnswer','removeAnswers','ids','notify','sms','account','orderBy','priority','asc','Applications','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','Body','MessageSid','skebby','from','connectel','clicksend','messageId','message_id','plivo','Text','infobip','results','text','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','applications','close','*,*,*,*','SmsMessage','ContactId','User'];(function(_0x5dff47,_0x36ffb9){var _0x1faac1=function(_0x34486f){while(--_0x34486f){_0x5dff47['push'](_0x5dff47['shift']());}};_0x1faac1(++_0x36ffb9);}(_0xb049,0x125));var _0x9b04=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb049[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x9b04('0x0'));var rimraf=require(_0x9b04('0x1'));var zipdir=require(_0x9b04('0x2'));var jsonpatch=require(_0x9b04('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9b04('0x4'));var util=require(_0x9b04('0x5'));var path=require(_0x9b04('0x6'));var sox=require(_0x9b04('0x7'));var csv=require(_0x9b04('0x8'));var ejs=require(_0x9b04('0x9'));var fs=require('fs');var fs_extra=require(_0x9b04('0xa'));var _=require(_0x9b04('0xb'));var squel=require(_0x9b04('0xc'));var crypto=require(_0x9b04('0xd'));var jsforce=require(_0x9b04('0xe'));var deskjs=require(_0x9b04('0xf'));var toCsv=require(_0x9b04('0x8'));var querystring=require(_0x9b04('0x10'));var Papa=require(_0x9b04('0x11'));var Redis=require(_0x9b04('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9b04('0x13'));var hardwareService=require(_0x9b04('0x14'));var logger=require(_0x9b04('0x15'))('api');var utils=require(_0x9b04('0x16'));var config=require(_0x9b04('0x17'));var licenseUtil=require(_0x9b04('0x18'));var db=require(_0x9b04('0x19'))['db'];config['redis']=_['defaults'](config[_0x9b04('0x1a')],{'host':_0x9b04('0x1b'),'port':0x18eb});var socket=require(_0x9b04('0x1c'))(new Redis(config[_0x9b04('0x1a')]));require(_0x9b04('0x1d'))[_0x9b04('0x1e')](socket);var jayson=require(_0x9b04('0x1f'));var client=jayson[_0x9b04('0x20')][_0x9b04('0x21')]({'port':0x232c});function respondWithRpcPromise(_0xd2190b,_0x420c52,_0x24d697,_0x32dabb){return new BPromise(function(_0x5a626b,_0x5222eb){var _0x163a0a=_0x32dabb||client;return _0x163a0a[_0x9b04('0x22')](_0xd2190b,_0x24d697)[_0x9b04('0x23')](function(_0x583098){logger['info']('SmsAccount,\x20%s,\x20%s',_0x420c52,_0x9b04('0x24'));logger[_0x9b04('0x25')](_0x9b04('0x26'),_0x420c52,_0x9b04('0x24'),JSON['stringify'](_0x583098));if(_0x583098['error']){if(_0x583098[_0x9b04('0x27')][_0x9b04('0x28')]===0x1f4){logger[_0x9b04('0x27')](_0x9b04('0x29'),_0x420c52,_0x583098[_0x9b04('0x27')]['message']);return _0x5222eb(_0x583098[_0x9b04('0x27')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x420c52,_0x583098[_0x9b04('0x27')][_0x9b04('0x2a')]);return _0x5a626b(_0x583098[_0x9b04('0x27')][_0x9b04('0x2a')]);}else{logger[_0x9b04('0x2b')](_0x9b04('0x29'),_0x420c52,_0x9b04('0x24'));_0x5a626b(_0x583098[_0x9b04('0x2c')][_0x9b04('0x2a')]);}})['catch'](function(_0x5c772c){logger[_0x9b04('0x27')]('SmsAccount,\x20%s,\x20%s',_0x420c52,_0x5c772c);_0x5222eb(_0x5c772c);});});}function respondWithStatusCode(_0x2c3b7f,_0x3422e8){_0x3422e8=_0x3422e8||0xcc;return function(_0x420c44){if(_0x420c44){return _0x2c3b7f['sendStatus'](_0x3422e8);}return _0x2c3b7f[_0x9b04('0x2d')](_0x3422e8)[_0x9b04('0x2e')]();};}function respondWithResult(_0x491cda,_0x2a0c42){_0x2a0c42=_0x2a0c42||0xc8;return function(_0x42078a){if(_0x42078a){return _0x491cda[_0x9b04('0x2d')](_0x2a0c42)[_0x9b04('0x2f')](_0x42078a);}};}function respondWithFilteredResult(_0x412f2b,_0x5d619f){return function(_0x3ce290){if(_0x3ce290){var _0x47954b=typeof _0x5d619f[_0x9b04('0x30')]===_0x9b04('0x31')&&typeof _0x5d619f[_0x9b04('0x32')]===_0x9b04('0x31');var _0x44751b=_0x3ce290[_0x9b04('0x33')];var _0x2e48a8=_0x47954b?0x0:_0x5d619f['offset'];var _0x37234c=_0x47954b?_0x3ce290[_0x9b04('0x33')]:_0x5d619f[_0x9b04('0x30')]+_0x5d619f[_0x9b04('0x32')];var _0x408602;if(_0x37234c>=_0x44751b){_0x37234c=_0x44751b;_0x408602=0xc8;}else{_0x408602=0xce;}_0x412f2b[_0x9b04('0x2d')](_0x408602);return _0x412f2b[_0x9b04('0x34')](_0x9b04('0x35'),_0x2e48a8+'-'+_0x37234c+'/'+_0x44751b)['json'](_0x3ce290);}return null;};}function patchUpdates(_0x2a45b9){return function(_0x1ce181){try{jsonpatch['apply'](_0x1ce181,_0x2a45b9,!![]);}catch(_0x1b4e1c){return BPromise[_0x9b04('0x36')](_0x1b4e1c);}return _0x1ce181[_0x9b04('0x37')]();};}function saveUpdates(_0x3bafc9,_0x4873ea){return function(_0x55582b){if(_0x55582b){return _0x55582b[_0x9b04('0x38')](_0x3bafc9)[_0x9b04('0x23')](function(_0x1317af){return _0x1317af;});}return null;};}function removeEntity(_0x4872a5,_0x2e8c2d){return function(_0x41a02d){if(_0x41a02d){return _0x41a02d[_0x9b04('0x39')]()[_0x9b04('0x23')](function(){var _0x9cfb50=_0x41a02d[_0x9b04('0x3a')]({'plain':!![]});var _0x276c0d=_0x9b04('0x3b');return db['UserProfileResource'][_0x9b04('0x39')]({'where':{'type':_0x276c0d,'resourceId':_0x9cfb50['id']}})[_0x9b04('0x23')](function(){return _0x41a02d;});})[_0x9b04('0x23')](function(){_0x4872a5['status'](0xcc)[_0x9b04('0x2e')]();});}};}function handleEntityNotFound(_0x397b8c,_0xfd8857){return function(_0x1ab292){if(!_0x1ab292){_0x397b8c[_0x9b04('0x3c')](0x194);}return _0x1ab292;};}function handleError(_0x24b631,_0x4a6283){_0x4a6283=_0x4a6283||0x1f4;return function(_0x14aa81){logger[_0x9b04('0x27')](_0x14aa81['stack']);if(_0x14aa81[_0x9b04('0x3d')]){delete _0x14aa81[_0x9b04('0x3d')];}_0x24b631[_0x9b04('0x2d')](_0x4a6283)[_0x9b04('0x3e')](_0x14aa81);};}exports[_0x9b04('0x3f')]=function(_0x57c1ad,_0x358eb3){var _0x358f20={'include':[{'model':db[_0x9b04('0x40')],'as':_0x9b04('0x41')}]},_0x19bf16={},_0x914814={'count':0x0,'rows':[]};var _0x433cef=_[_0x9b04('0x42')](db[_0x9b04('0x43')][_0x9b04('0x44')],function(_0x3e81bf){return{'name':_0x3e81bf['fieldName'],'type':_0x3e81bf['type'][_0x9b04('0x45')]};});_0x19bf16[_0x9b04('0x46')]=_['map'](_0x433cef,'name');_0x19bf16[_0x9b04('0x47')]=_[_0x9b04('0x48')](_0x57c1ad[_0x9b04('0x47')]);_0x19bf16[_0x9b04('0x49')]=_['intersection'](_0x19bf16['model'],_0x19bf16[_0x9b04('0x47')]);_0x358f20[_0x9b04('0x4a')]=_['intersection'](_0x19bf16[_0x9b04('0x46')],qs[_0x9b04('0x4b')](_0x57c1ad['query']['fields']));_0x358f20[_0x9b04('0x4a')]=_0x358f20['attributes'][_0x9b04('0x4c')]?_0x358f20[_0x9b04('0x4a')]:_0x19bf16['model'];if(!_0x57c1ad[_0x9b04('0x47')][_0x9b04('0x4d')](_0x9b04('0x4e'))){_0x358f20[_0x9b04('0x32')]=qs[_0x9b04('0x32')](_0x57c1ad[_0x9b04('0x47')][_0x9b04('0x32')]);_0x358f20[_0x9b04('0x30')]=qs[_0x9b04('0x30')](_0x57c1ad['query'][_0x9b04('0x30')]);}_0x358f20[_0x9b04('0x4f')]=qs[_0x9b04('0x50')](_0x57c1ad['query'][_0x9b04('0x50')]);_0x358f20[_0x9b04('0x51')]=qs['filters'](_[_0x9b04('0x52')](_0x57c1ad[_0x9b04('0x47')],_0x19bf16[_0x9b04('0x49')]),_0x433cef);if(_0x57c1ad[_0x9b04('0x47')][_0x9b04('0x53')]){_0x358f20[_0x9b04('0x51')]=_[_0x9b04('0x54')](_0x358f20[_0x9b04('0x51')],{'$or':_['map'](_0x433cef,function(_0x4c63d5){if(_0x4c63d5[_0x9b04('0x55')]!=='VIRTUAL'){var _0x10fc68={};_0x10fc68[_0x4c63d5['name']]={'$like':'%'+_0x57c1ad[_0x9b04('0x47')][_0x9b04('0x53')]+'%'};return _0x10fc68;}})});}_0x358f20=_[_0x9b04('0x54')]({},_0x358f20,_0x57c1ad[_0x9b04('0x56')]);var _0x5a0438={'where':_0x358f20[_0x9b04('0x51')]};return db[_0x9b04('0x43')][_0x9b04('0x33')](_0x5a0438)[_0x9b04('0x23')](function(_0x139ca9){_0x914814[_0x9b04('0x33')]=_0x139ca9;if(_0x57c1ad[_0x9b04('0x47')][_0x9b04('0x57')]){_0x358f20[_0x9b04('0x58')]=[{'all':!![]}];}return db[_0x9b04('0x43')]['findAll'](_0x358f20);})[_0x9b04('0x23')](function(_0x219e3b){_0x914814['rows']=_0x219e3b;return _0x914814;})[_0x9b04('0x23')](respondWithFilteredResult(_0x358eb3,_0x358f20))[_0x9b04('0x59')](handleError(_0x358eb3,null));};exports[_0x9b04('0x5a')]=function(_0x3fb2e3,_0x171fe7){var _0x16b4bb={'raw':![],'where':{'id':_0x3fb2e3[_0x9b04('0x5b')]['id']},'include':[{'model':db[_0x9b04('0x40')],'as':_0x9b04('0x41')}]},_0x26dc41={};_0x26dc41['model']=_['keys'](db[_0x9b04('0x43')][_0x9b04('0x44')]);_0x26dc41['query']=_[_0x9b04('0x48')](_0x3fb2e3['query']);_0x26dc41[_0x9b04('0x49')]=_['intersection'](_0x26dc41[_0x9b04('0x46')],_0x26dc41[_0x9b04('0x47')]);_0x16b4bb[_0x9b04('0x4a')]=_[_0x9b04('0x5c')](_0x26dc41['model'],qs[_0x9b04('0x4b')](_0x3fb2e3[_0x9b04('0x47')][_0x9b04('0x4b')]));_0x16b4bb[_0x9b04('0x4a')]=_0x16b4bb['attributes'][_0x9b04('0x4c')]?_0x16b4bb[_0x9b04('0x4a')]:_0x26dc41[_0x9b04('0x46')];if(_0x3fb2e3[_0x9b04('0x47')][_0x9b04('0x57')]){_0x16b4bb[_0x9b04('0x58')]=[{'all':!![]}];}_0x16b4bb=_[_0x9b04('0x54')]({},_0x16b4bb,_0x3fb2e3['options']);return db[_0x9b04('0x43')][_0x9b04('0x5d')](_0x16b4bb)[_0x9b04('0x23')](handleEntityNotFound(_0x171fe7,null))[_0x9b04('0x23')](respondWithResult(_0x171fe7,null))[_0x9b04('0x59')](handleError(_0x171fe7,null));};exports['create']=function(_0x83820b,_0x2e0aa6){return db[_0x9b04('0x43')][_0x9b04('0x5e')](_0x83820b[_0x9b04('0x5f')],{})['then'](function(_0x30236c){var _0x35fc36=_0x83820b[_0x9b04('0x60')][_0x9b04('0x3a')]({'plain':!![]});if(!_0x35fc36)throw new Error(_0x9b04('0x61'));if(_0x35fc36[_0x9b04('0x62')]===_0x9b04('0x60')){var _0x583e47=_0x30236c[_0x9b04('0x3a')]({'plain':!![]});var _0x2b2fbf=_0x9b04('0x3b');return db[_0x9b04('0x63')][_0x9b04('0x5d')]({'where':{'name':_0x2b2fbf,'userProfileId':_0x35fc36[_0x9b04('0x64')]},'raw':!![]})[_0x9b04('0x23')](function(_0xe09233){if(_0xe09233&&_0xe09233[_0x9b04('0x65')]===0x0){return db[_0x9b04('0x66')][_0x9b04('0x5e')]({'name':_0x583e47[_0x9b04('0x3d')],'resourceId':_0x583e47['id'],'type':_0xe09233['name'],'sectionId':_0xe09233['id']},{})[_0x9b04('0x23')](function(){return _0x30236c;});}else{return _0x30236c;}})['catch'](function(_0x26ece8){logger[_0x9b04('0x27')](_0x9b04('0x67'),_0x26ece8);throw _0x26ece8;});}return _0x30236c;})[_0x9b04('0x23')](respondWithResult(_0x2e0aa6,0xc9))['catch'](handleError(_0x2e0aa6,null));};exports[_0x9b04('0x38')]=function(_0x32b1b1,_0x5d8a8d){if(_0x32b1b1['body']['id']){delete _0x32b1b1[_0x9b04('0x5f')]['id'];}return db['SmsAccount'][_0x9b04('0x5d')]({'where':{'id':_0x32b1b1[_0x9b04('0x5b')]['id']},'include':[{'model':db[_0x9b04('0x40')],'as':_0x9b04('0x41')}]})['then'](handleEntityNotFound(_0x5d8a8d,null))[_0x9b04('0x23')](saveUpdates(_0x32b1b1[_0x9b04('0x5f')],null))[_0x9b04('0x23')](respondWithResult(_0x5d8a8d,null))[_0x9b04('0x59')](handleError(_0x5d8a8d,null));};exports[_0x9b04('0x39')]=function(_0x27b413,_0x47fd82){return db[_0x9b04('0x43')][_0x9b04('0x5d')]({'where':{'id':_0x27b413['params']['id']}})[_0x9b04('0x23')](handleEntityNotFound(_0x47fd82,null))[_0x9b04('0x23')](removeEntity(_0x47fd82,null))['catch'](handleError(_0x47fd82,null));};exports[_0x9b04('0x68')]=function(_0x297f20,_0x9de353){return db['SmsAccount']['describe']()[_0x9b04('0x23')](respondWithResult(_0x9de353,null))[_0x9b04('0x59')](handleError(_0x9de353,null));};exports[_0x9b04('0x69')]=function(_0x2c0278,_0x4b4dcf,_0x309fe4){if(_0x2c0278[_0x9b04('0x5f')]['id']){delete _0x2c0278['body']['id'];}return db[_0x9b04('0x43')]['find']({'where':{'id':_0x2c0278[_0x9b04('0x5b')]['id']}})[_0x9b04('0x23')](handleEntityNotFound(_0x4b4dcf,null))[_0x9b04('0x23')](function(_0x2a3b94){if(_0x2a3b94){_0x2c0278[_0x9b04('0x5f')]['SmsAccountId']=_0x2a3b94['id'];return db[_0x9b04('0x6a')][_0x9b04('0x5e')](_0x2c0278['body']);}})[_0x9b04('0x23')](respondWithResult(_0x4b4dcf,null))[_0x9b04('0x59')](handleError(_0x4b4dcf,null));};exports['getDispositions']=function(_0x275510,_0x346259,_0x3594a8){var _0x2f3439={'raw':![],'where':{}};var _0x4bdfc5={};var _0x1e7578={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9b04('0x6b')]({'where':{'id':_0x275510[_0x9b04('0x5b')]['id']}})[_0x9b04('0x23')](handleEntityNotFound(_0x346259,null))[_0x9b04('0x23')](function(_0x22331d){if(_0x22331d){_0x4bdfc5[_0x9b04('0x46')]=_['keys'](db[_0x9b04('0x6a')][_0x9b04('0x44')]);_0x4bdfc5['query']=_[_0x9b04('0x48')](_0x275510[_0x9b04('0x47')]);_0x4bdfc5[_0x9b04('0x49')]=_[_0x9b04('0x5c')](_0x4bdfc5[_0x9b04('0x46')],_0x4bdfc5[_0x9b04('0x47')]);_0x2f3439[_0x9b04('0x4a')]=_[_0x9b04('0x5c')](_0x4bdfc5['model'],qs[_0x9b04('0x4b')](_0x275510[_0x9b04('0x47')][_0x9b04('0x4b')]));_0x2f3439['attributes']=_0x2f3439[_0x9b04('0x4a')][_0x9b04('0x4c')]?_0x2f3439[_0x9b04('0x4a')]:_0x4bdfc5[_0x9b04('0x46')];if(!_0x275510[_0x9b04('0x47')][_0x9b04('0x4d')]('nolimit')){_0x2f3439[_0x9b04('0x32')]=qs['limit'](_0x275510['query']['limit']);_0x2f3439[_0x9b04('0x30')]=qs['offset'](_0x275510[_0x9b04('0x47')][_0x9b04('0x30')]);}_0x2f3439[_0x9b04('0x4f')]=qs[_0x9b04('0x50')](_0x275510[_0x9b04('0x47')][_0x9b04('0x50')]);_0x2f3439[_0x9b04('0x51')]=qs['filters'](_[_0x9b04('0x52')](_0x275510[_0x9b04('0x47')],_0x4bdfc5[_0x9b04('0x49')]));_0x2f3439[_0x9b04('0x51')][_0x9b04('0x6c')]=_0x22331d['id'];if(_0x275510[_0x9b04('0x47')]['filter']){_0x2f3439[_0x9b04('0x51')]=_[_0x9b04('0x54')](_0x2f3439[_0x9b04('0x51')],{'$or':_[_0x9b04('0x42')](_0x2f3439['attributes'],function(_0xaebb14){var _0x5b25f3={};_0x5b25f3[_0xaebb14]={'$like':'%'+_0x275510[_0x9b04('0x47')][_0x9b04('0x53')]+'%'};return _0x5b25f3;})});}_0x2f3439=_[_0x9b04('0x54')]({},_0x2f3439,_0x275510['options']);return db[_0x9b04('0x6a')]['count']({'where':_0x2f3439[_0x9b04('0x51')]})['then'](function(_0x5b9e33){_0x1e7578[_0x9b04('0x33')]=_0x5b9e33;if(_0x275510['query'][_0x9b04('0x57')]){_0x2f3439[_0x9b04('0x58')]=[{'all':!![]}];}return db[_0x9b04('0x6a')][_0x9b04('0x6d')](_0x2f3439);})[_0x9b04('0x23')](function(_0x20e3e1){_0x1e7578[_0x9b04('0x6e')]=_0x20e3e1;return _0x1e7578;});}})[_0x9b04('0x23')](respondWithFilteredResult(_0x346259,_0x2f3439))[_0x9b04('0x59')](handleError(_0x346259,null));};exports[_0x9b04('0x6f')]=function(_0x4f7856,_0x27ea4c,_0x3c5c8b){return db['SmsAccount'][_0x9b04('0x5d')]({'where':{'id':_0x4f7856[_0x9b04('0x5b')]['id']}})['then'](handleEntityNotFound(_0x27ea4c,null))[_0x9b04('0x23')](function(_0x593b71){if(_0x593b71){return _0x593b71[_0x9b04('0x6f')](_0x4f7856[_0x9b04('0x47')]['ids']);}})[_0x9b04('0x23')](respondWithStatusCode(_0x27ea4c,null))[_0x9b04('0x59')](handleError(_0x27ea4c,null));};exports['addAnswer']=function(_0x3c327c,_0x3777f1,_0x5b9f88){if(_0x3c327c[_0x9b04('0x5f')]['id']){delete _0x3c327c[_0x9b04('0x5f')]['id'];}return db[_0x9b04('0x43')][_0x9b04('0x5d')]({'where':{'id':_0x3c327c[_0x9b04('0x5b')]['id']}})[_0x9b04('0x23')](handleEntityNotFound(_0x3777f1,null))['then'](function(_0x3e41c5){if(_0x3e41c5){_0x3c327c[_0x9b04('0x5f')][_0x9b04('0x6c')]=_0x3e41c5['id'];return db[_0x9b04('0x70')]['create'](_0x3c327c['body']);}})[_0x9b04('0x23')](respondWithResult(_0x3777f1,null))[_0x9b04('0x59')](handleError(_0x3777f1,null));};exports['getAnswers']=function(_0x41bdda,_0x423e26,_0xfc7ba7){var _0x509ad0={'raw':![],'where':{}};var _0x1c7081={};var _0x235e4b={'count':0x0,'rows':[]};return db[_0x9b04('0x43')][_0x9b04('0x6b')]({'where':{'id':_0x41bdda[_0x9b04('0x5b')]['id']}})['then'](handleEntityNotFound(_0x423e26,null))[_0x9b04('0x23')](function(_0x57a80d){if(_0x57a80d){_0x1c7081['model']=_[_0x9b04('0x48')](db[_0x9b04('0x70')][_0x9b04('0x44')]);_0x1c7081[_0x9b04('0x47')]=_[_0x9b04('0x48')](_0x41bdda[_0x9b04('0x47')]);_0x1c7081['filters']=_[_0x9b04('0x5c')](_0x1c7081[_0x9b04('0x46')],_0x1c7081['query']);_0x509ad0['attributes']=_[_0x9b04('0x5c')](_0x1c7081[_0x9b04('0x46')],qs[_0x9b04('0x4b')](_0x41bdda[_0x9b04('0x47')][_0x9b04('0x4b')]));_0x509ad0[_0x9b04('0x4a')]=_0x509ad0[_0x9b04('0x4a')][_0x9b04('0x4c')]?_0x509ad0[_0x9b04('0x4a')]:_0x1c7081['model'];if(!_0x41bdda['query']['hasOwnProperty'](_0x9b04('0x4e'))){_0x509ad0[_0x9b04('0x32')]=qs[_0x9b04('0x32')](_0x41bdda[_0x9b04('0x47')][_0x9b04('0x32')]);_0x509ad0[_0x9b04('0x30')]=qs[_0x9b04('0x30')](_0x41bdda[_0x9b04('0x47')]['offset']);}_0x509ad0[_0x9b04('0x4f')]=qs[_0x9b04('0x50')](_0x41bdda['query'][_0x9b04('0x50')]);_0x509ad0[_0x9b04('0x51')]=qs[_0x9b04('0x49')](_[_0x9b04('0x52')](_0x41bdda[_0x9b04('0x47')],_0x1c7081[_0x9b04('0x49')]));_0x509ad0[_0x9b04('0x51')][_0x9b04('0x6c')]=_0x57a80d['id'];if(_0x41bdda[_0x9b04('0x47')][_0x9b04('0x53')]){_0x509ad0[_0x9b04('0x51')]=_[_0x9b04('0x54')](_0x509ad0[_0x9b04('0x51')],{'$or':_['map'](_0x509ad0[_0x9b04('0x4a')],function(_0x509856){var _0x181a18={};_0x181a18[_0x509856]={'$like':'%'+_0x41bdda[_0x9b04('0x47')][_0x9b04('0x53')]+'%'};return _0x181a18;})});}_0x509ad0=_[_0x9b04('0x54')]({},_0x509ad0,_0x41bdda[_0x9b04('0x56')]);return db['CannedAnswer'][_0x9b04('0x33')]({'where':_0x509ad0[_0x9b04('0x51')]})[_0x9b04('0x23')](function(_0x2459b8){_0x235e4b[_0x9b04('0x33')]=_0x2459b8;if(_0x41bdda['query']['includeAll']){_0x509ad0[_0x9b04('0x58')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x509ad0);})[_0x9b04('0x23')](function(_0x1d185c){_0x235e4b['rows']=_0x1d185c;return _0x235e4b;});}})[_0x9b04('0x23')](respondWithFilteredResult(_0x423e26,_0x509ad0))['catch'](handleError(_0x423e26,null));};exports[_0x9b04('0x71')]=function(_0x279459,_0x1dd9ab,_0x559e){return db[_0x9b04('0x43')]['find']({'where':{'id':_0x279459[_0x9b04('0x5b')]['id']}})[_0x9b04('0x23')](handleEntityNotFound(_0x1dd9ab,null))['then'](function(_0x328e29){if(_0x328e29){return _0x328e29[_0x9b04('0x71')](_0x279459[_0x9b04('0x47')][_0x9b04('0x72')]);}})['then'](respondWithStatusCode(_0x1dd9ab,null))['catch'](handleError(_0x1dd9ab,null));};exports[_0x9b04('0x73')]=function(_0x313530,_0x27a394,_0x2a137d){var _0x6b58e={'channel':_0x9b04('0x74')};var _0x3fb34d=[];var _0x1895db=[];var _0x443398={};return db[_0x9b04('0x43')][_0x9b04('0x5d')]({'where':{'id':_0x313530['params']['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0x9b04('0x23')](handleEntityNotFound(_0x27a394,null))['then'](function(_0x87e994){_0x6b58e[_0x9b04('0x75')]=_0x87e994;_0x6b58e['applications']=_[_0x9b04('0x76')](_0x87e994['Applications'],[_0x9b04('0x77')],[_0x9b04('0x78')]);if(_0x6b58e['account'][_0x9b04('0x79')]){delete _0x6b58e[_0x9b04('0x75')][_0x9b04('0x79')];}return db[_0x9b04('0x7a')][_0x9b04('0x68')]();})[_0x9b04('0x23')](function(_0x55fbd3){if(!_0x55fbd3){throw new db['Sequelize'][(_0x9b04('0x7b'))](_0x9b04('0x7c'));}_0x3fb34d=_[_0x9b04('0x7d')](_[_0x9b04('0x48')](_0x55fbd3),[_0x9b04('0x7e'),_0x9b04('0x7f')]);_0x1895db=_[_0x9b04('0x7d')](_[_0x9b04('0x48')](_0x55fbd3),['createdAt','updatedAt','CompanyId',_0x9b04('0x80')]);_0x6b58e[_0x9b04('0x5f')]={'mapKey':_0x9b04('0x81')};if(_0x6b58e[_0x9b04('0x75')][_0x9b04('0x55')]){switch(_0x6b58e['account'][_0x9b04('0x55')]){case _0x9b04('0x82'):_0x6b58e[_0x9b04('0x5f')]['from']=_0x313530[_0x9b04('0x5f')]['From'];_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x5f')]=_0x313530[_0x9b04('0x5f')][_0x9b04('0x83')];_0x6b58e[_0x9b04('0x5f')]['messageId']=_0x313530[_0x9b04('0x5f')][_0x9b04('0x84')];break;case _0x9b04('0x85'):_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x86')]='+'+_0x313530[_0x9b04('0x5f')]['sender'];_0x6b58e[_0x9b04('0x5f')]['body']=_0x313530['body']['text'];break;case _0x9b04('0x87'):_0x6b58e[_0x9b04('0x5f')]['from']=_0x313530[_0x9b04('0x5f')][_0x9b04('0x86')];_0x6b58e['body'][_0x9b04('0x5f')]=_0x313530[_0x9b04('0x5f')][_0x9b04('0x2a')];break;case _0x9b04('0x88'):_0x6b58e['body'][_0x9b04('0x86')]=_0x313530[_0x9b04('0x5f')][_0x9b04('0x86')];_0x6b58e[_0x9b04('0x5f')]['body']=_0x313530[_0x9b04('0x5f')][_0x9b04('0x5f')];_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x89')]=_0x313530[_0x9b04('0x5f')][_0x9b04('0x8a')];break;case _0x9b04('0x8b'):_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x86')]=_0x313530[_0x9b04('0x5f')]['From'];_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x5f')]=_0x313530['body'][_0x9b04('0x8c')];_0x6b58e['body'][_0x9b04('0x89')]=_0x313530[_0x9b04('0x5f')]['MessageUUID'];break;case _0x9b04('0x8d'):_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x86')]='+'+_0x313530[_0x9b04('0x5f')][_0x9b04('0x8e')][0x0][_0x9b04('0x86')];_0x6b58e['body'][_0x9b04('0x5f')]=_0x313530[_0x9b04('0x5f')]['results'][0x0][_0x9b04('0x8f')];_0x6b58e['body']['messageId']=_0x313530[_0x9b04('0x5f')][_0x9b04('0x8e')][0x0]['messageId'];break;case'csc':_0x6b58e[_0x9b04('0x5f')]['from']=_0x313530[_0x9b04('0x5f')][_0x9b04('0x90')];_0x6b58e['body'][_0x9b04('0x5f')]=_0x313530[_0x9b04('0x5f')][_0x9b04('0x91')][_0x9b04('0x2a')];break;case _0x9b04('0x92'):_0x6b58e['body'][_0x9b04('0x86')]=_0x313530[_0x9b04('0x5f')]['fromNumber'];_0x6b58e[_0x9b04('0x5f')]['body']=_0x313530[_0x9b04('0x5f')]['text'];_0x6b58e['body'][_0x9b04('0x89')]=_0x313530['body'][_0x9b04('0x93')];break;case _0x9b04('0x94'):_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x89')]=_0x313530[_0x9b04('0x5f')][0x0][_0x9b04('0x2a')]['id'];_0x6b58e[_0x9b04('0x5f')]['from']=_0x313530[_0x9b04('0x5f')][0x0][_0x9b04('0x2a')][_0x9b04('0x86')];_0x6b58e[_0x9b04('0x5f')]['body']=_0x313530[_0x9b04('0x5f')][0x0][_0x9b04('0x2a')][_0x9b04('0x8f')];break;case'intelepeer':_0x6b58e['body']['from']=_0x313530[_0x9b04('0x5f')][_0x9b04('0x86')];_0x6b58e['body']['body']=_0x313530[_0x9b04('0x5f')][_0x9b04('0x2a')];_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x89')]=_0x313530[_0x9b04('0x5f')][_0x9b04('0x95')];break;}}if(_0x6b58e[_0x9b04('0x5f')]['id']){delete _0x6b58e['body']['id'];}if(_[_0x9b04('0x96')](_0x6b58e[_0x9b04('0x5f')]['from'])){throw new db[(_0x9b04('0x97'))]['ValidationError'](_0x9b04('0x98'));}if(_[_0x9b04('0x96')](_0x6b58e[_0x9b04('0x5f')]['body'])||_0x6b58e[_0x9b04('0x5f')]['body']===''){throw new db[(_0x9b04('0x97'))][(_0x9b04('0x7b'))](_0x9b04('0x99'));}if(_[_0x9b04('0x96')](_0x6b58e['body'][_0x9b04('0x9a')])){throw new db['Sequelize'][(_0x9b04('0x7b'))](_0x9b04('0x9b')+_0x1895db);}if(!_[_0x9b04('0x9c')](_0x1895db,_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x9a')])){throw new db['Sequelize']['ValidationError'](_0x9b04('0x9d')+_0x1895db);}_0x443398[_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x9a')]]=_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x86')];return db[_0x9b04('0x9e')]['find']({'where':{'id':_0x6b58e[_0x9b04('0x75')][_0x9b04('0x80')]},'include':[{'model':db[_0x9b04('0x7a')],'as':_0x9b04('0x9f'),'where':_0x443398,'limit':0x1,'order':[['updatedAt',_0x9b04('0xa0')]]}]});})[_0x9b04('0x23')](handleEntityNotFound(_0x27a394,null))[_0x9b04('0x23')](function(_0x167cd5){if(_0x167cd5){_0x6b58e[_0x9b04('0xa1')]=_['omit'](_0x167cd5,['Contacts']);if(_0x167cd5[_0x9b04('0x9f')][_0x9b04('0x4c')]){return _0x167cd5[_0x9b04('0x9f')][0x0];}var _0x2255db=_[_0x9b04('0xa2')](_0x6b58e[_0x9b04('0x5f')],{'firstName':_0x6b58e[_0x9b04('0x5f')]['from'],'ListId':_0x167cd5['id']});_0x2255db[_0x6b58e[_0x9b04('0x5f')]['mapKey']]=_0x6b58e[_0x9b04('0x5f')]['from'];return db[_0x9b04('0x7a')][_0x9b04('0x5e')](_0x2255db,{'fields':_0x3fb34d,'raw':!![]});}})['then'](handleEntityNotFound(_0x27a394,null))[_0x9b04('0x23')](function(_0x23690a){if(_0x23690a){_0x6b58e[_0x9b04('0xa3')]=_0x23690a;var _0x376b18={'ContactId':_0x23690a['id'],'phone':_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x86')],'SmsAccountId':_0x313530[_0x9b04('0x5b')]['id']};var _0x327e6e={'ContactId':_0x23690a['id'],'SmsAccountId':_0x313530[_0x9b04('0x5b')]['id'],'closed':![]};return db[_0x9b04('0xa4')]['find']({'where':_0x327e6e})[_0x9b04('0x23')](function(_0x2e8147){if(_0x2e8147){return[_0x2e8147,![]];}return db['SmsInteraction'][_0x9b04('0x5e')](_0x376b18)[_0x9b04('0x23')](function(_0x538f04){return[_0x538f04,!![]];});});}})[_0x9b04('0xa5')](function(_0xbce00,_0x27b9f8){_0x6b58e[_0x9b04('0xa6')]=_0xbce00['get']({'plain':!![]});_0x6b58e[_0x9b04('0xa6')][_0x9b04('0xa7')]=![];if(_0x27b9f8){if(_0x6b58e[_0x9b04('0x75')][_0x9b04('0xa8')]){_0x6b58e[_0x9b04('0xa9')]['push']({'id':0x0,'priority':_0x6b58e[_0x9b04('0xa9')][_0x9b04('0x4c')]+0x1,'app':_0x9b04('0xaa'),'appdata':'unmanaged','interval':_0x9b04('0xab')});}_0x6b58e[_0x9b04('0xa6')][_0x9b04('0xa7')]=!![];}return db[_0x9b04('0xac')][_0x9b04('0x5e')]({'phone':_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x86')],'messageId':_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x89')],'body':_0x6b58e[_0x9b04('0x5f')][_0x9b04('0x5f')],'SmsAccountId':_0x313530[_0x9b04('0x5b')]['id'],'SmsInteractionId':_0xbce00['id'],'direction':'in','ContactId':_0xbce00[_0x9b04('0xad')],'AttachmentId':_0x6b58e[_0x9b04('0x5f')]['AttachmentId']});})['then'](function(_0x210103){_0x6b58e[_0x9b04('0x2a')]=_0x210103;if(!_0x6b58e['interaction']['UserId'])return;return db[_0x9b04('0xae')]['find']({'attributes':['id','name'],'where':{'id':_0x6b58e[_0x9b04('0xa6')][_0x9b04('0xaf')]}});})[_0x9b04('0x23')](function(_0x35d994){if(_0x35d994){_0x6b58e['applications'][_0x9b04('0xb0')]({'id':0x0,'priority':0x0,'app':_0x9b04('0xb1'),'appdata':_0x35d994[_0x9b04('0x3d')]+','+(_0x6b58e[_0x9b04('0x75')][_0x9b04('0xb2')]||0xa),'interval':_0x9b04('0xab')});}if(!_0x6b58e[_0x9b04('0xa6')][_0x9b04('0xb3')])return;return db[_0x9b04('0xb4')][_0x9b04('0x5d')]({'attributes':['id',_0x9b04('0x3d')],'where':{'id':_0x6b58e['interaction'][_0x9b04('0xb3')]}});})[_0x9b04('0x23')](function(_0x15ee99){if(_0x15ee99){_0x6b58e['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x9b04('0xb5'),'appdata':_0x15ee99[_0x9b04('0x3d')]+','+(_0x6b58e['account'][_0x9b04('0xb6')]||0x12c),'interval':_0x9b04('0xab')});}return respondWithRpcPromise(_0x9b04('0xb7'),'startRouting',_0x6b58e);})[_0x9b04('0x23')](function(_0x29ef5c){if(_0x29ef5c){var _0x220543=0xc8;var _0x2ede54=_0x9b04('0xb8');logger[_0x9b04('0x2b')](_0x9b04('0x26'),_0x2ede54,_0x220543,_0x9b04('0xb9'));logger[_0x9b04('0x25')](_0x9b04('0xba'),_0x2ede54,_0x220543,_0x9b04('0xb9'),JSON[_0x9b04('0xbb')](_0x29ef5c));if(_0x6b58e['account'][_0x9b04('0x55')]===_0x9b04('0x82')){return _0x27a394[_0x9b04('0x2d')](_0x220543)['set'](_0x9b04('0xbc'),_0x9b04('0xbd'))[_0x9b04('0x3e')](_0x9b04('0xbe'));}else{return _0x27a394['status'](_0x220543)[_0x9b04('0x2f')](_0x29ef5c);}}})[_0x9b04('0x59')](handleError(_0x27a394,null));};exports['addApplications']=function(_0x1bb501,_0x494a4e){var _0x5ebfaa=_0x1bb501['params']['id'];var _0x8eaa6f=_0x1bb501['body'];var _0x5059b9=0xc8;var _0x2d7193=null;return db[_0x9b04('0xbf')][_0x9b04('0xc0')]({'isolationLevel':db[_0x9b04('0xbf')]['Transaction'][_0x9b04('0xc1')][_0x9b04('0xc2')]},function(_0xe4e402){return db[_0x9b04('0x43')][_0x9b04('0x6b')]({'where':{'id':_0x5ebfaa},'transaction':_0xe4e402})[_0x9b04('0x23')](function(_0x401a19){if(_0x401a19){return db[_0x9b04('0xc3')][_0x9b04('0x39')]({'where':{'SmsAccountId':_0x5ebfaa},'transaction':_0xe4e402})[_0x9b04('0x23')](function(){var _0x4d6459=_[_0x9b04('0x42')](_0x8eaa6f,function(_0x38cf30){_0x38cf30[_0x9b04('0x6c')]=_0x5ebfaa;return _0x38cf30;});return db['SmsApplication'][_0x9b04('0xc4')](_0x4d6459,{'transaction':_0xe4e402});});}else{_0x5059b9=0x194;_0x2d7193=[];}});})['then'](function(){if(_0x5059b9!==0x194){return db[_0x9b04('0xc3')][_0x9b04('0xc5')]({'where':{'SmsAccountId':_0x5ebfaa},'order':_0x9b04('0x77')})[_0x9b04('0x23')](function(_0x347209){_0x2d7193=_0x347209;});}})[_0x9b04('0x59')](function(_0x1113fa){_0x5059b9=0x1f4;logger[_0x9b04('0x27')](_0x1113fa[_0x9b04('0xc6')]);if(_0x1113fa[_0x9b04('0x3d')]){delete _0x1113fa[_0x9b04('0x3d')];}_0x2d7193=_0x1113fa;})['finally'](function(){if(_0x2d7193===null){_0x494a4e[_0x9b04('0x3c')](_0x5059b9);}else{if(_0x5059b9===0x1f4){_0x494a4e[_0x9b04('0x2d')](_0x5059b9)[_0x9b04('0x3e')](_0x2d7193);}else{_0x494a4e[_0x9b04('0x2d')](_0x5059b9)['json'](_0x2d7193);}}});};exports[_0x9b04('0xc7')]=function(_0x46c7fd,_0x6e09f1,_0x357fe3){var _0x3c6f53={};var _0x3c932d={};var _0x52c6dc;var _0x11b27e;return db[_0x9b04('0x43')][_0x9b04('0x6b')]({'where':{'id':_0x46c7fd[_0x9b04('0x5b')]['id']}})['then'](handleEntityNotFound(_0x6e09f1,null))['then'](function(_0x44bd9c){if(_0x44bd9c){_0x52c6dc=_0x44bd9c;_0x3c932d[_0x9b04('0x46')]=_[_0x9b04('0x48')](db[_0x9b04('0xc3')][_0x9b04('0x44')]);_0x3c932d['query']=_['keys'](_0x46c7fd['query']);_0x3c932d[_0x9b04('0x49')]=_[_0x9b04('0x5c')](_0x3c932d['model'],_0x3c932d[_0x9b04('0x47')]);_0x3c6f53[_0x9b04('0x4a')]=_[_0x9b04('0x5c')](_0x3c932d[_0x9b04('0x46')],qs['fields'](_0x46c7fd[_0x9b04('0x47')][_0x9b04('0x4b')]));_0x3c6f53[_0x9b04('0x4a')]=_0x3c6f53[_0x9b04('0x4a')]['length']?_0x3c6f53['attributes']:_0x3c932d['model'];_0x3c6f53['order']=qs[_0x9b04('0x50')](_0x46c7fd[_0x9b04('0x47')]['sort']);_0x3c6f53[_0x9b04('0x51')]=qs[_0x9b04('0x49')](_['pick'](_0x46c7fd[_0x9b04('0x47')],_0x3c932d['filters']));if(_0x46c7fd[_0x9b04('0x47')][_0x9b04('0x53')]){_0x3c6f53[_0x9b04('0x51')]=_[_0x9b04('0x54')](_0x3c6f53[_0x9b04('0x51')],{'$or':_['map'](_0x3c6f53[_0x9b04('0x4a')],function(_0x31fb8c){var _0x3d0c14={};_0x3d0c14[_0x31fb8c]={'$like':'%'+_0x46c7fd[_0x9b04('0x47')][_0x9b04('0x53')]+'%'};return _0x3d0c14;})});}_0x3c6f53=_[_0x9b04('0x54')]({},_0x3c6f53,_0x46c7fd[_0x9b04('0x56')]);return _0x52c6dc[_0x9b04('0xc7')](_0x3c6f53);}})[_0x9b04('0x23')](function(_0x1c7bfe){if(_0x1c7bfe){_0x11b27e=_0x1c7bfe['length'];if(!_0x46c7fd[_0x9b04('0x47')][_0x9b04('0x4d')](_0x9b04('0x4e'))){_0x3c6f53['limit']=qs['limit'](_0x46c7fd[_0x9b04('0x47')][_0x9b04('0x32')]);_0x3c6f53['offset']=qs[_0x9b04('0x30')](_0x46c7fd['query'][_0x9b04('0x30')]);}return _0x52c6dc['getApplications'](_0x3c6f53);}})[_0x9b04('0x23')](function(_0x100a99){if(_0x100a99){return _0x100a99?{'count':_0x11b27e,'rows':_0x100a99}:null;}})[_0x9b04('0x23')](respondWithResult(_0x6e09f1,null))['catch'](handleError(_0x6e09f1,null));};exports['getInteractions']=function(_0x53b063,_0x184d46,_0x80c792){var _0x273772={'raw':![],'where':{}};var _0x135938={};var _0x389c12={'count':0x0,'rows':[]};return db[_0x9b04('0x43')][_0x9b04('0x6b')]({'where':{'id':_0x53b063[_0x9b04('0x5b')]['id']}})['then'](handleEntityNotFound(_0x184d46,null))['then'](function(_0x141275){if(_0x141275){_0x135938[_0x9b04('0x46')]=_['keys'](db[_0x9b04('0xa4')][_0x9b04('0x44')]);_0x135938['query']=_[_0x9b04('0x48')](_0x53b063[_0x9b04('0x47')]);_0x135938['filters']=_[_0x9b04('0x5c')](_0x135938[_0x9b04('0x46')],_0x135938[_0x9b04('0x47')]);_0x273772[_0x9b04('0x4a')]=_[_0x9b04('0x5c')](_0x135938['model'],qs['fields'](_0x53b063[_0x9b04('0x47')]['fields']));_0x273772['attributes']=_0x273772[_0x9b04('0x4a')][_0x9b04('0x4c')]?_0x273772[_0x9b04('0x4a')]:_0x135938['model'];if(!_0x53b063[_0x9b04('0x47')][_0x9b04('0x4d')](_0x9b04('0x4e'))){_0x273772[_0x9b04('0x32')]=qs['limit'](_0x53b063[_0x9b04('0x47')][_0x9b04('0x32')]);_0x273772[_0x9b04('0x30')]=qs[_0x9b04('0x30')](_0x53b063[_0x9b04('0x47')][_0x9b04('0x30')]);}_0x273772[_0x9b04('0x4f')]=qs['sort'](_0x53b063['query']['sort']);_0x273772[_0x9b04('0x51')]=qs[_0x9b04('0x49')](_[_0x9b04('0x52')](_0x53b063[_0x9b04('0x47')],_0x135938['filters']));_0x273772[_0x9b04('0x51')][_0x9b04('0x6c')]=_0x141275['id'];if(_0x53b063[_0x9b04('0x47')]['filter']){_0x273772[_0x9b04('0x51')]=_[_0x9b04('0x54')](_0x273772[_0x9b04('0x51')],{'$or':_['map'](_0x273772[_0x9b04('0x4a')],function(_0x55c188){var _0x20451f={};_0x20451f[_0x55c188]={'$like':'%'+_0x53b063[_0x9b04('0x47')][_0x9b04('0x53')]+'%'};return _0x20451f;})});}_0x273772=_[_0x9b04('0x54')]({},_0x273772,_0x53b063[_0x9b04('0x56')]);return db['SmsInteraction'][_0x9b04('0x33')]({'where':_0x273772[_0x9b04('0x51')]})[_0x9b04('0x23')](function(_0x56ddd2){_0x389c12[_0x9b04('0x33')]=_0x56ddd2;if(_0x53b063[_0x9b04('0x47')]['includeAll']){_0x273772[_0x9b04('0x58')]=[{'model':db[_0x9b04('0x7a')],'as':_0x9b04('0xc8'),'required':![]},{'model':db[_0x9b04('0xae')],'as':_0x9b04('0xc9'),'attributes':[_0x9b04('0x3d'),_0x9b04('0xca'),'internal'],'required':![]},{'model':db[_0x9b04('0xcb')],'as':_0x9b04('0xcc'),'attributes':['id',_0x9b04('0x3d'),_0x9b04('0xcd')],'where':_0x53b063[_0x9b04('0x47')][_0x9b04('0xce')]?{'id':_0x53b063[_0x9b04('0x47')][_0x9b04('0xce')]}:undefined,'required':_0x53b063[_0x9b04('0x47')][_0x9b04('0xce')]?!![]:![]}];}return db['SmsInteraction'][_0x9b04('0x6d')](_0x273772);})[_0x9b04('0x23')](function(_0x787961){_0x389c12[_0x9b04('0x6e')]=_0x787961;return _0x389c12;});}})[_0x9b04('0x23')](respondWithFilteredResult(_0x184d46,_0x273772))[_0x9b04('0x59')](handleError(_0x184d46,null));};exports[_0x9b04('0x3e')]=function(_0x3bd1dd,_0x599025,_0x5e2434){var _0x2058d0,_0x1e0d58,_0x53d5c5;if(_['isNil'](_0x3bd1dd['body'][_0x9b04('0x5f')])||_0x3bd1dd[_0x9b04('0x5f')]['body']===''){throw new db[(_0x9b04('0x97'))]['ValidationError'](_0x9b04('0x99'));}if(_['isNil'](_0x3bd1dd[_0x9b04('0x5f')]['to'])){throw new db[(_0x9b04('0x97'))][(_0x9b04('0x7b'))](_0x9b04('0xcf'));}_0x2058d0=_0x3bd1dd[_0x9b04('0x5f')]['to'];return db[_0x9b04('0x43')]['find']({'where':{'id':_0x3bd1dd[_0x9b04('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x9b04('0xd0'),'include':[{'model':db[_0x9b04('0x7a')],'as':'Contacts','where':{'mobile':_0x2058d0},'limit':0x1,'order':[[_0x9b04('0x7f'),_0x9b04('0xa0')]]}]}]})[_0x9b04('0x23')](handleEntityNotFound(_0x599025,null))['then'](function(_0x416d76){if(_0x416d76&&_0x416d76[_0x9b04('0xd0')]){_0x1e0d58=_0x416d76[_0x9b04('0x3a')]({'plain':!![]});if(_0x1e0d58[_0x9b04('0xd0')]&&_0x1e0d58[_0x9b04('0xd0')]['Contacts'][_0x9b04('0x4c')]){return _0x1e0d58[_0x9b04('0xd0')][_0x9b04('0x9f')][0x0];}return db[_0x9b04('0x7a')][_0x9b04('0x5e')](_[_0x9b04('0xa2')](_0x3bd1dd[_0x9b04('0x5f')],{'firstName':_0x2058d0,'mobile':_0x2058d0,'phone':_0x2058d0,'ListId':_0x1e0d58[_0x9b04('0x80')]}));}})[_0x9b04('0x23')](handleEntityNotFound(_0x599025,null))[_0x9b04('0x23')](function(_0x507213){if(_0x507213){_0x53d5c5=_0x507213;return db[_0x9b04('0xa4')][_0x9b04('0x5d')]({'where':{'ContactId':_0x53d5c5['id'],'closed':![],'SmsAccountId':_0x1e0d58['id']}})[_0x9b04('0x23')](function(_0x393147){if(_0x393147){return[_0x393147,![]];}return db[_0x9b04('0xa4')][_0x9b04('0x5e')]({'UserId':_0x3bd1dd['user']['id'],'ContactId':_0x53d5c5['id'],'SmsAccountId':_0x1e0d58['id'],'phone':_0x2058d0,'firstMsgDirection':'out','Messages':[_[_0x9b04('0x54')](_0x3bd1dd['body'],{'read':![],'body':_0x3bd1dd[_0x9b04('0x5f')]['body'],'phone':_0x2058d0,'SmsAccountId':_0x1e0d58['id'],'UserId':_0x3bd1dd[_0x9b04('0x60')]['id'],'ContactId':_0x53d5c5['id']})]},{'include':[{'model':db[_0x9b04('0xac')],'as':_0x9b04('0xd1')}]})[_0x9b04('0x23')](function(_0x5a3c88){return[_0x5a3c88,!![]];});});}})[_0x9b04('0xa5')](function(_0x2ec1f2,_0x4aff13){if(_0x4aff13){return _0x2ec1f2;}return db[_0x9b04('0xac')][_0x9b04('0x5e')](_[_0x9b04('0x54')](_0x3bd1dd[_0x9b04('0x5f')],{'read':![],'body':_0x3bd1dd[_0x9b04('0x5f')]['body'],'phone':_0x2058d0,'SmsAccountId':_0x1e0d58['id'],'SmsInteractionId':_0x2ec1f2['id'],'UserId':_0x3bd1dd[_0x9b04('0x60')]['id'],'ContactId':_0x53d5c5['id']}))[_0x9b04('0x23')](function(_0x2eb9c7){_0x2ec1f2[_0x9b04('0xd2')]['Messages']=[];_0x2ec1f2[_0x9b04('0xd2')]['Messages'][_0x9b04('0xd3')](_0x2eb9c7[_0x9b04('0xd2')]);return _0x2ec1f2;});})['then'](respondWithResult(_0x599025,null))[_0x9b04('0x59')](handleError(_0x599025,null));};exports[_0x9b04('0x2d')]=function(_0x5ea287,_0x54df9b,_0x2fb33c){if(_0x5ea287['body']['id']){delete _0x5ea287['body']['id'];}var _0x57f6e9,_0x5b1085,_0x3bb869;return db[_0x9b04('0x43')][_0x9b04('0x5d')]({'where':{'id':_0x5ea287[_0x9b04('0x5b')]['id']}})['then'](handleEntityNotFound(_0x54df9b,null))[_0x9b04('0x23')](function(_0x401060){if(_0x401060){_0x3bb869=_0x401060;logger[_0x9b04('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9b04('0x2d'),_0x9b04('0xd4'),_0x401060['type'],util[_0x9b04('0xd5')](_0x5ea287[_0x9b04('0x5f')],{'showHidden':![],'depth':null}));switch(_0x401060[_0x9b04('0x55')]){case _0x9b04('0x85'):if(_0x5ea287[_0x9b04('0x5f')][_0x9b04('0xd6')]&&_0x5ea287[_0x9b04('0x5f')][_0x9b04('0x2d')]){_0x5b1085=_0x5ea287['body'][_0x9b04('0x2d')];return db[_0x9b04('0xac')][_0x9b04('0x5d')]({'where':{'messageId':_0x5ea287[_0x9b04('0x5f')]['skebby_dispatch_id']}});}break;case _0x9b04('0x87'):if(_0x5ea287['body'][_0x9b04('0xd7')]&&_0x5ea287[_0x9b04('0x5f')][_0x9b04('0xd8')]){_0x5b1085=_0x5ea287[_0x9b04('0x5f')]['statusInt'];return db[_0x9b04('0xac')][_0x9b04('0x5d')]({'where':{'messageId':_0x5ea287[_0x9b04('0x5f')]['requestid']}});}break;case _0x9b04('0x88'):if(_0x5ea287[_0x9b04('0x5f')][_0x9b04('0x8a')]&&_0x5ea287[_0x9b04('0x5f')][_0x9b04('0xd9')]){_0x5b1085=_0x5ea287['body'][_0x9b04('0xd9')];return db[_0x9b04('0xac')][_0x9b04('0x5d')]({'where':{'messageId':_0x5ea287['body'][_0x9b04('0x8a')]}});}break;case _0x9b04('0x8d'):var _0x1aa40f=_0x5ea287[_0x9b04('0x5f')]['results'][0x0];if(_0x1aa40f[_0x9b04('0x89')]&&_0x1aa40f['status']['groupName']===_0x9b04('0xda')){_0x5b1085=_0x1aa40f[_0x9b04('0x2d')][_0x9b04('0xdb')];return db[_0x9b04('0xac')][_0x9b04('0x5d')]({'where':{'messageId':_0x1aa40f[_0x9b04('0x89')]}});}break;case _0x9b04('0x92'):if(_0x5ea287[_0x9b04('0x5f')][_0x9b04('0x89')]&&_0x5ea287[_0x9b04('0x5f')][_0x9b04('0x2d')]){_0x5b1085=_0x5ea287['body'][_0x9b04('0x2d')];return db[_0x9b04('0xac')][_0x9b04('0x5d')]({'where':{'messageId':_0x5ea287['body'][_0x9b04('0x89')]}});}break;case _0x9b04('0x94'):if(_0x5ea287[_0x9b04('0x5f')][0x0][_0x9b04('0x2a')]['id']){_0x5b1085=_0x5ea287['body'][0x0][_0x9b04('0x55')];return db['SmsMessage'][_0x9b04('0x5d')]({'where':{'messageId':_0x5ea287[_0x9b04('0x5f')][0x0][_0x9b04('0x2a')]['id']}});}break;case'intelepeer':if(_0x5ea287['body'][_0x9b04('0xdc')]&&_0x5ea287['body'][_0x9b04('0x2d')]){_0x5b1085=_0x5ea287[_0x9b04('0x5f')][_0x9b04('0x2d')];return db[_0x9b04('0xac')][_0x9b04('0x5d')]({'where':{'messageId':_0x5ea287[_0x9b04('0x5f')]['redif']}});}break;}}})[_0x9b04('0x23')](handleEntityNotFound(_0x54df9b,null))[_0x9b04('0x23')](function(_0x21bd02){if(_0x21bd02){_0x57f6e9=_0x21bd02;switch(_0x3bb869[_0x9b04('0x55')]){case'skebby':if(_0x5b1085==='DELIVERED'){return _0x57f6e9[_0x9b04('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9b04('0x2d'),_0x9b04('0x85'),util[_0x9b04('0xd5')](_0x5ea287['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5b1085==='1'){return _0x57f6e9[_0x9b04('0x38')]({'read':!![]});}else{logger[_0x9b04('0x27')](_0x9b04('0x26'),_0x9b04('0x2d'),_0x9b04('0x85'),util[_0x9b04('0xd5')](_0x5ea287[_0x9b04('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x9b04('0x88'):if(!_0x5ea287[_0x9b04('0x5f')]['error_code']&&_0x5b1085>=0xc8&&_0x5b1085<=0xce){return _0x57f6e9[_0x9b04('0x38')]({'read':!![]});}else{logger[_0x9b04('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9b04('0x2d'),'clicksend',util[_0x9b04('0xd5')](_0x5ea287[_0x9b04('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5d8070=_0x5ea287[_0x9b04('0x5f')]['results'][0x0];if(_0x5d8070[_0x9b04('0x2d')][_0x9b04('0xdb')]===_0x9b04('0xda')){return _0x57f6e9[_0x9b04('0x38')]({'read':!![]});}else{logger[_0x9b04('0x27')](_0x9b04('0x26'),'status',_0x9b04('0x8d'),util[_0x9b04('0xd5')](_0x5ea287[_0x9b04('0x5f')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5b1085==_0x9b04('0xdd')||_0x5b1085==_0x9b04('0xde')){return _0x57f6e9[_0x9b04('0x38')]({'read':!![]});}else{logger[_0x9b04('0x27')](_0x9b04('0x26'),_0x9b04('0x2d'),_0x9b04('0x92'),util[_0x9b04('0xd5')](_0x5ea287[_0x9b04('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x9b04('0x94'):if(_0x5b1085==_0x9b04('0xdf')){return _0x57f6e9[_0x9b04('0x38')]({'read':!![]});}else{logger['error'](_0x9b04('0x26'),_0x9b04('0x2d'),_0x9b04('0x94'),util[_0x9b04('0xd5')](_0x5ea287[_0x9b04('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x9b04('0xe0'):if(_0x5b1085==='DELIVRD'||_0x5b1085==='ACCEPTD'){return _0x57f6e9[_0x9b04('0x38')]({'read':!![]});}else{logger['error'](_0x9b04('0x26'),_0x9b04('0x2d'),_0x9b04('0xe0'),util['inspect'](_0x5ea287[_0x9b04('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x57f6e9;}})['then'](respondWithResult(_0x54df9b,null))[_0x9b04('0x59')](handleError(_0x54df9b,null));};exports['statusGet']=function(_0x3e662f,_0x571a38,_0x697399){var _0x321db1,_0x14081e,_0x349147;return db['SmsAccount'][_0x9b04('0x5d')]({'where':{'id':_0x3e662f['params']['id']}})[_0x9b04('0x23')](handleEntityNotFound(_0x571a38,null))['then'](function(_0x244f76){if(_0x244f76){_0x349147=_0x244f76;logger[_0x9b04('0x25')](_0x9b04('0x26'),_0x9b04('0x2d'),_0x9b04('0xd4'),_0x244f76[_0x9b04('0x55')],util[_0x9b04('0xd5')](_0x3e662f[_0x9b04('0x47')],{'showHidden':![],'depth':null}));switch(_0x244f76['type']){case'csc':if(_0x3e662f[_0x9b04('0x47')][_0x9b04('0xe1')]&&_0x3e662f[_0x9b04('0x47')][_0x9b04('0xe2')]){_0x14081e=_0x3e662f[_0x9b04('0x47')][_0x9b04('0xe2')];return db[_0x9b04('0xac')][_0x9b04('0x5d')]({'where':{'messageId':_0x3e662f[_0x9b04('0x47')][_0x9b04('0xe1')]}});}break;}}})['then'](handleEntityNotFound(_0x571a38,null))[_0x9b04('0x23')](function(_0x1e174c){if(_0x1e174c){_0x321db1=_0x1e174c;switch(_0x349147[_0x9b04('0x55')]){case _0x9b04('0xe3'):if(_0x14081e==='2'||_0x14081e==='6'){return _0x321db1[_0x9b04('0x38')]({'read':!![]});}else{logger[_0x9b04('0x27')](_0x9b04('0x26'),_0x9b04('0x2d'),_0x9b04('0xe3'),util[_0x9b04('0xd5')](_0x3e662f[_0x9b04('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x321db1;}})[_0x9b04('0x23')](respondWithResult(_0x571a38,null))[_0x9b04('0x59')](handleError(_0x571a38,null));};exports[_0x9b04('0xe4')]=function(_0x1556cd,_0x29a912,_0x9a61b){return db['SmsAccount']['find']({'where':{'id':_0x1556cd[_0x9b04('0x5b')]['id']}})['then'](handleEntityNotFound(_0x29a912,null))[_0x9b04('0x23')](function(_0x5e046a){if(_0x5e046a){return _0x5e046a[_0x9b04('0xe4')](_0x1556cd[_0x9b04('0x5f')][_0x9b04('0x72')],_[_0x9b04('0xe5')](_0x1556cd[_0x9b04('0x5f')],[_0x9b04('0x72'),'id'])||{})[_0x9b04('0xa5')](function(_0x4313d0){for(var _0x1ba123=0x0;_0x1ba123<_0x1556cd[_0x9b04('0x5f')]['ids'][_0x9b04('0x4c')];_0x1ba123+=0x1){socket[_0x9b04('0xe6')](_0x9b04('0xe7'),{'UserId':Number(_0x1556cd[_0x9b04('0x5f')][_0x9b04('0x72')][_0x1ba123]),'SmsAccountId':Number(_0x1556cd[_0x9b04('0x5b')]['id'])});}return _0x4313d0;});}})['then'](respondWithResult(_0x29a912,null))['catch'](handleError(_0x29a912,null));};exports[_0x9b04('0xe8')]=function(_0x3e9ede,_0x5a692b,_0x1e146f){return db[_0x9b04('0x43')][_0x9b04('0x5d')]({'where':{'id':_0x3e9ede[_0x9b04('0x5b')]['id']}})[_0x9b04('0x23')](handleEntityNotFound(_0x5a692b,null))[_0x9b04('0x23')](function(_0x43f710){if(_0x43f710){return _0x43f710[_0x9b04('0xe8')](_0x3e9ede[_0x9b04('0x47')][_0x9b04('0x72')])[_0x9b04('0x23')](function(){if(_['isArray'](_0x3e9ede[_0x9b04('0x47')]['ids'])){for(var _0x104e0b=0x0;_0x104e0b<_0x3e9ede[_0x9b04('0x47')][_0x9b04('0x72')][_0x9b04('0x4c')];_0x104e0b+=0x1){socket[_0x9b04('0xe6')]('userSmsAccount:remove',{'UserId':Number(_0x3e9ede[_0x9b04('0x47')][_0x9b04('0x72')][_0x104e0b]),'SmsAccountId':Number(_0x3e9ede[_0x9b04('0x5b')]['id'])});}}else{socket[_0x9b04('0xe6')]('userSmsAccount:remove',{'UserId':Number(_0x3e9ede[_0x9b04('0x47')]['ids']),'SmsAccountId':Number(_0x3e9ede['params']['id'])});}});}})[_0x9b04('0x23')](respondWithStatusCode(_0x5a692b,null))[_0x9b04('0x59')](handleError(_0x5a692b,null));};exports['getAgents']=function(_0xd161a4,_0x5e23c0,_0x2b241e){var _0x4776ec={};var _0x4da923={};var _0x59d0e7;var _0x270f5a;return db[_0x9b04('0x43')][_0x9b04('0x6b')]({'where':{'id':_0xd161a4[_0x9b04('0x5b')]['id']}})[_0x9b04('0x23')](handleEntityNotFound(_0x5e23c0,null))['then'](function(_0x32db78){if(_0x32db78){_0x59d0e7=_0x32db78;_0x4da923['model']=_['keys'](db['User'][_0x9b04('0x44')]);_0x4da923['query']=_[_0x9b04('0x48')](_0xd161a4['query']);_0x4da923['filters']=_['intersection'](_0x4da923[_0x9b04('0x46')],_0x4da923[_0x9b04('0x47')]);_0x4776ec[_0x9b04('0x4a')]=_[_0x9b04('0x5c')](_0x4da923['model'],qs[_0x9b04('0x4b')](_0xd161a4['query'][_0x9b04('0x4b')]));_0x4776ec[_0x9b04('0x4a')]=_0x4776ec['attributes'][_0x9b04('0x4c')]?_0x4776ec['attributes']:_0x4da923[_0x9b04('0x46')];_0x4776ec[_0x9b04('0x4f')]=qs[_0x9b04('0x50')](_0xd161a4['query'][_0x9b04('0x50')]);_0x4776ec['where']=qs[_0x9b04('0x49')](_['pick'](_0xd161a4[_0x9b04('0x47')],_0x4da923['filters']));if(_0xd161a4[_0x9b04('0x47')][_0x9b04('0x53')]){_0x4776ec['where']=_['merge'](_0x4776ec['where'],{'$or':_['map'](_0x4776ec[_0x9b04('0x4a')],function(_0x521533){var _0x2a9d30={};_0x2a9d30[_0x521533]={'$like':'%'+_0xd161a4['query'][_0x9b04('0x53')]+'%'};return _0x2a9d30;})});}_0x4776ec=_['merge']({},_0x4776ec,_0xd161a4[_0x9b04('0x56')]);return _0x59d0e7[_0x9b04('0xe9')](_0x4776ec);}})[_0x9b04('0x23')](function(_0x6c8437){if(_0x6c8437){_0x270f5a=_0x6c8437['length'];if(!_0xd161a4[_0x9b04('0x47')][_0x9b04('0x4d')](_0x9b04('0x4e'))){_0x4776ec[_0x9b04('0x32')]=qs[_0x9b04('0x32')](_0xd161a4[_0x9b04('0x47')][_0x9b04('0x32')]);_0x4776ec[_0x9b04('0x30')]=qs['offset'](_0xd161a4[_0x9b04('0x47')][_0x9b04('0x30')]);}return _0x59d0e7[_0x9b04('0xe9')](_0x4776ec);}})['then'](function(_0x4c6bfd){if(_0x4c6bfd){return _0x4c6bfd?{'count':_0x270f5a,'rows':_0x4c6bfd}:null;}})[_0x9b04('0x23')](respondWithResult(_0x5e23c0,null))['catch'](handleError(_0x5e23c0,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ffaba69..403064e 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 _0xa00b=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x14b667,_0x395c9f){var _0xd1d6c0=function(_0x1d700d){while(--_0x1d700d){_0x14b667['push'](_0x14b667['shift']());}};_0xd1d6c0(++_0x395c9f);}(_0xa00b,0x1f1));var _0xba00=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa00b[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xba00('0x0'));var SmsAccount=require(_0xba00('0x1'))['db'][_0xba00('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xba00('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xba00('0x4'),'afterDestroy':_0xba00('0x5')};function emitEvent(_0x5de27f){return function(_0xa17fc9,_0x266e5f,_0x418b3b){SmsAccountEvents['emit'](_0x5de27f+':'+_0xa17fc9['id'],_0xa17fc9);SmsAccountEvents['emit'](_0x5de27f,_0xa17fc9);_0x418b3b(null);};}for(var e in events){if(events[_0xba00('0x6')](e)){var event=events[e];SmsAccount[_0xba00('0x7')](e,emitEvent(event));}}module[_0xba00('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xf022=['hasOwnProperty','hook','exports','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x36c97f,_0x445d22){var _0x42f8ce=function(_0x1e6a9d){while(--_0x1e6a9d){_0x36c97f['push'](_0x36c97f['shift']());}};_0x42f8ce(++_0x445d22);}(_0xf022,0x7b));var _0x2f02=function(_0x3a23d3,_0x4088d8){_0x3a23d3=_0x3a23d3-0x0;var _0x10803b=_0xf022[_0x3a23d3];return _0x10803b;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x2f02('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2f02('0x1')](0x0);var events={'afterCreate':_0x2f02('0x2'),'afterUpdate':_0x2f02('0x3'),'afterDestroy':_0x2f02('0x4')};function emitEvent(_0x298ccd){return function(_0x1e2a1d,_0x34d5ae,_0x475670){SmsAccountEvents['emit'](_0x298ccd+':'+_0x1e2a1d['id'],_0x1e2a1d);SmsAccountEvents['emit'](_0x298ccd,_0x1e2a1d);_0x475670(null);};}for(var e in events){if(events[_0x2f02('0x5')](e)){var event=events[e];SmsAccount[_0x2f02('0x6')](e,emitEvent(event));}}module[_0x2f02('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 56b15aa..507cbbd 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 _0x2c8b=['../../config/logger','moment','exports','define','SmsAccount','util'];(function(_0x3f967a,_0x2c8f5d){var _0x312a83=function(_0x4a7e4e){while(--_0x4a7e4e){_0x3f967a['push'](_0x3f967a['shift']());}};_0x312a83(++_0x2c8f5d);}(_0x2c8b,0x83));var _0xb2c8=function(_0x27b0db,_0x3ebc39){_0x27b0db=_0x27b0db-0x0;var _0x711728=_0x2c8b[_0x27b0db];return _0x711728;};'use strict';var _=require('lodash');var util=require(_0xb2c8('0x0'));var logger=require(_0xb2c8('0x1'))('api');var moment=require(_0xb2c8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xb2c8('0x3')]=function(_0x40948a,_0x1f7eef){return _0x40948a[_0xb2c8('0x4')](_0xb2c8('0x5'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39c4=['request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api'];(function(_0x4c86ab,_0x6736cd){var _0x1f69a8=function(_0x56202c){while(--_0x56202c){_0x4c86ab['push'](_0x4c86ab['shift']());}};_0x1f69a8(++_0x6736cd);}(_0x39c4,0x81));var _0x439c=function(_0x3031bb,_0x14d224){_0x3031bb=_0x3031bb-0x0;var _0x4dae7e=_0x39c4[_0x3031bb];return _0x4dae7e;};'use strict';var _=require(_0x439c('0x0'));var util=require('util');var logger=require(_0x439c('0x1'))(_0x439c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x439c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x439c('0x4'));var config=require(_0x439c('0x5'));var attributes=require(_0x439c('0x6'));module[_0x439c('0x7')]=function(_0x5ebaac,_0x234926){return _0x5ebaac[_0x439c('0x8')](_0x439c('0x9'),attributes,{'tableName':_0x439c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 5c4bcb0..3e6a1aa 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 _0x39b5=['catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','stringify'];(function(_0x25eaee,_0x1e6191){var _0xdca794=function(_0x3669ad){while(--_0x3669ad){_0x25eaee['push'](_0x25eaee['shift']());}};_0xdca794(++_0x1e6191);}(_0x39b5,0x169));var _0x539b=function(_0x2532a6,_0x25e8e9){_0x2532a6=_0x2532a6-0x0;var _0x1d6b92=_0x39b5[_0x2532a6];return _0x1d6b92;};'use strict';var _=require(_0x539b('0x0'));var util=require(_0x539b('0x1'));var moment=require(_0x539b('0x2'));var BPromise=require(_0x539b('0x3'));var rs=require(_0x539b('0x4'));var fs=require('fs');var Redis=require(_0x539b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x539b('0x6'));var config=require('../../config/environment');var jayson=require(_0x539b('0x7'));var client=jayson[_0x539b('0x8')][_0x539b('0x9')]({'port':0x232a});config[_0x539b('0xa')]=_[_0x539b('0xb')](config[_0x539b('0xa')],{'host':_0x539b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x539b('0xa')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x9ad19d,_0x383ce7,_0xacb14c){return new BPromise(function(_0x56885d,_0x410d83){return client[_0x539b('0xd')](_0x9ad19d,_0xacb14c)[_0x539b('0xe')](function(_0x1d7f4a){logger[_0x539b('0xf')](_0x539b('0x10'),_0x383ce7,_0x539b('0x11'));logger[_0x539b('0x12')](_0x539b('0x13'),_0x383ce7,_0x539b('0x11'),JSON['stringify'](_0x1d7f4a));if(_0x1d7f4a['error']){if(_0x1d7f4a['error'][_0x539b('0x14')]===0x1f4){logger['error'](_0x539b('0x10'),_0x383ce7,_0x1d7f4a['error']['message']);return _0x410d83(_0x1d7f4a[_0x539b('0x15')][_0x539b('0x16')]);}logger['error'](_0x539b('0x10'),_0x383ce7,_0x1d7f4a['error'][_0x539b('0x16')]);return _0x56885d(_0x1d7f4a[_0x539b('0x15')][_0x539b('0x16')]);}else{logger[_0x539b('0xf')](_0x539b('0x10'),_0x383ce7,_0x539b('0x11'));_0x56885d(_0x1d7f4a[_0x539b('0x17')][_0x539b('0x16')]);}})['catch'](function(_0x2c7640){logger['error'](_0x539b('0x10'),_0x383ce7,_0x2c7640);_0x410d83(_0x2c7640);});});}exports[_0x539b('0x18')]=function(_0x894cf4){var _0x1013fc=this;return new Promise(function(_0xe273c4,_0x2604bc){return db[_0x539b('0x19')][_0x539b('0x1a')]({'raw':_0x894cf4[_0x539b('0x1b')]?_0x894cf4[_0x539b('0x1b')][_0x539b('0x1c')]===undefined?!![]:![]:!![],'where':_0x894cf4['options']?_0x894cf4[_0x539b('0x1b')][_0x539b('0x1d')]||null:null,'attributes':_0x894cf4[_0x539b('0x1b')]?_0x894cf4['options'][_0x539b('0x1e')]||null:null,'include':_0x894cf4[_0x539b('0x1b')]?_0x894cf4[_0x539b('0x1b')][_0x539b('0x1f')]?_[_0x539b('0x20')](_0x894cf4[_0x539b('0x1b')][_0x539b('0x1f')],function(_0x1d8c5a){return{'model':db[_0x1d8c5a[_0x539b('0x21')]],'as':_0x1d8c5a['as'],'attributes':_0x1d8c5a['attributes'],'include':_0x1d8c5a['include']?_[_0x539b('0x20')](_0x1d8c5a['include'],function(_0x16f178){return{'model':db[_0x16f178[_0x539b('0x21')]],'as':_0x16f178['as'],'attributes':_0x16f178[_0x539b('0x1e')],'include':_0x16f178['include']?_[_0x539b('0x20')](_0x16f178[_0x539b('0x1f')],function(_0x1330e3){return{'model':db[_0x1330e3[_0x539b('0x21')]],'as':_0x1330e3['as'],'attributes':_0x1330e3[_0x539b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17b750){logger[_0x539b('0xf')](_0x539b('0x18'),_0x894cf4);logger['debug'](_0x539b('0x18'),_0x894cf4,JSON[_0x539b('0x22')](_0x17b750));_0xe273c4(_0x17b750);})[_0x539b('0x23')](function(_0x954422){logger['error'](_0x539b('0x18'),_0x954422[_0x539b('0x16')],_0x894cf4);_0x2604bc(_0x1013fc[_0x539b('0x15')](0x1f4,_0x954422[_0x539b('0x16')]));});});}; \ No newline at end of file +var _0xcef1=['request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','attributes','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register'];(function(_0x53a724,_0x1b9746){var _0x2a305b=function(_0x356c61){while(--_0x356c61){_0x53a724['push'](_0x53a724['shift']());}};_0x2a305b(++_0x1b9746);}(_0xcef1,0x120));var _0x1cef=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcef1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1cef('0x0'));var util=require(_0x1cef('0x1'));var moment=require(_0x1cef('0x2'));var BPromise=require('bluebird');var rs=require(_0x1cef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cef('0x4'))['db'];var utils=require(_0x1cef('0x5'));var logger=require(_0x1cef('0x6'))(_0x1cef('0x7'));var config=require(_0x1cef('0x8'));var jayson=require(_0x1cef('0x9'));var client=jayson[_0x1cef('0xa')][_0x1cef('0xb')]({'port':0x232a});config[_0x1cef('0xc')]=_[_0x1cef('0xd')](config['redis'],{'host':_0x1cef('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0x1cef('0xf')](socket);function respondWithRpcPromise(_0x3c49bb,_0x1c9c77,_0xc0e4c6){return new BPromise(function(_0x10408e,_0x4f8045){return client[_0x1cef('0x10')](_0x3c49bb,_0xc0e4c6)[_0x1cef('0x11')](function(_0xc24e36){logger[_0x1cef('0x12')](_0x1cef('0x13'),_0x1c9c77,_0x1cef('0x14'));logger[_0x1cef('0x15')](_0x1cef('0x16'),_0x1c9c77,'request\x20sent',JSON[_0x1cef('0x17')](_0xc24e36));if(_0xc24e36[_0x1cef('0x18')]){if(_0xc24e36['error'][_0x1cef('0x19')]===0x1f4){logger[_0x1cef('0x18')](_0x1cef('0x13'),_0x1c9c77,_0xc24e36[_0x1cef('0x18')]['message']);return _0x4f8045(_0xc24e36[_0x1cef('0x18')]['message']);}logger[_0x1cef('0x18')]('SmsAccount,\x20%s,\x20%s',_0x1c9c77,_0xc24e36['error'][_0x1cef('0x1a')]);return _0x10408e(_0xc24e36[_0x1cef('0x18')][_0x1cef('0x1a')]);}else{logger[_0x1cef('0x12')]('SmsAccount,\x20%s,\x20%s',_0x1c9c77,'request\x20sent');_0x10408e(_0xc24e36[_0x1cef('0x1b')][_0x1cef('0x1a')]);}})[_0x1cef('0x1c')](function(_0x5ce702){logger[_0x1cef('0x18')](_0x1cef('0x13'),_0x1c9c77,_0x5ce702);_0x4f8045(_0x5ce702);});});}exports[_0x1cef('0x1d')]=function(_0x534125){var _0x5f1543=this;return new Promise(function(_0x106512,_0xa9dcd8){return db[_0x1cef('0x1e')][_0x1cef('0x1f')]({'raw':_0x534125['options']?_0x534125['options'][_0x1cef('0x20')]===undefined?!![]:![]:!![],'where':_0x534125['options']?_0x534125[_0x1cef('0x21')]['where']||null:null,'attributes':_0x534125['options']?_0x534125[_0x1cef('0x21')][_0x1cef('0x22')]||null:null,'include':_0x534125[_0x1cef('0x21')]?_0x534125['options'][_0x1cef('0x23')]?_[_0x1cef('0x24')](_0x534125['options'][_0x1cef('0x23')],function(_0xe6429c){return{'model':db[_0xe6429c[_0x1cef('0x25')]],'as':_0xe6429c['as'],'attributes':_0xe6429c[_0x1cef('0x22')],'include':_0xe6429c['include']?_['map'](_0xe6429c[_0x1cef('0x23')],function(_0x1b4648){return{'model':db[_0x1b4648['model']],'as':_0x1b4648['as'],'attributes':_0x1b4648['attributes'],'include':_0x1b4648[_0x1cef('0x23')]?_['map'](_0x1b4648[_0x1cef('0x23')],function(_0x4c95d4){return{'model':db[_0x4c95d4[_0x1cef('0x25')]],'as':_0x4c95d4['as'],'attributes':_0x4c95d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x1cef('0x11')](function(_0x599732){logger[_0x1cef('0x12')](_0x1cef('0x1d'),_0x534125);logger[_0x1cef('0x15')]('ShowSmsAccount',_0x534125,JSON['stringify'](_0x599732));_0x106512(_0x599732);})[_0x1cef('0x1c')](function(_0x5090b4){logger[_0x1cef('0x18')](_0x1cef('0x1d'),_0x5090b4[_0x1cef('0x1a')],_0x534125);_0xa9dcd8(_0x5f1543[_0x1cef('0x18')](0x1f4,_0x5090b4[_0x1cef('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 149cd1f..d98cc1c 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 4352a72..146653d 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3eb4ae,_0x493c5b){var _0x1aa0d4=function(_0x194a3b){while(--_0x194a3b){_0x3eb4ae['push'](_0x3eb4ae['shift']());}};_0x1aa0d4(++_0x493c5b);}(_0x3e74,0x175));var _0x43e7=function(_0x4c7992,_0xf01c4f){_0x4c7992=_0x4c7992-0x0;var _0x3b0e68=_0x3e74[_0x4c7992];return _0x3b0e68;};'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 +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2f0ce5,_0x21acce){var _0x385158=function(_0x443b1a){while(--_0x443b1a){_0x2f0ce5['push'](_0x2f0ce5['shift']());}};_0x385158(++_0x21acce);}(_0xedd9,0xfc));var _0x9edd=function(_0x3219f9,_0x31182b){_0x3219f9=_0x3219f9-0x0;var _0x194d4c=_0xedd9[_0x3219f9];return _0x194d4c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index cb82ada..3489670 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 _0x5807=['exports','INTEGER','STRING','sequelize'];(function(_0x3d9dc2,_0x4d0f69){var _0x9f75a0=function(_0x23d927){while(--_0x23d927){_0x3d9dc2['push'](_0x3d9dc2['shift']());}};_0x9f75a0(++_0x4d0f69);}(_0x5807,0x1a3));var _0x7580=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x5807[_0xc55d64];return _0x4194f6;};'use strict';var Sequelize=require(_0x7580('0x0'));module[_0x7580('0x1')]={'priority':{'type':Sequelize[_0x7580('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7580('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7580('0x3')]},'interval':{'type':Sequelize[_0x7580('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xbc09=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xbc09,0x17b));var _0x9bc0=function(_0x5b1e30,_0x3be069){_0x5b1e30=_0x5b1e30-0x0;var _0x4bd986=_0xbc09[_0x5b1e30];return _0x4bd986;};'use strict';var Sequelize=require(_0x9bc0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9bc0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9bc0('0x2')],'allowNull':![],'defaultValue':_0x9bc0('0x3')},'appdata':{'type':Sequelize[_0x9bc0('0x4')]()},'description':{'type':Sequelize[_0x9bc0('0x2')]},'interval':{'type':Sequelize[_0x9bc0('0x2')],'defaultValue':_0x9bc0('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index fba2216..73a1863 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 _0x24bd=['apply','reject','save','then','destroy','error','stack','name','map','SmsApplication','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','create','body','update','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24bd,0xb9));var _0xd24b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x24bd[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xd24b('0x0'));var rimraf=require(_0xd24b('0x1'));var zipdir=require(_0xd24b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd24b('0x3'));var moment=require(_0xd24b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd24b('0x5'));var util=require(_0xd24b('0x6'));var path=require(_0xd24b('0x7'));var sox=require(_0xd24b('0x8'));var csv=require('to-csv');var ejs=require(_0xd24b('0x9'));var fs=require('fs');var fs_extra=require(_0xd24b('0xa'));var _=require(_0xd24b('0xb'));var squel=require('squel');var crypto=require(_0xd24b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd24b('0xd'));var toCsv=require(_0xd24b('0xe'));var querystring=require(_0xd24b('0xf'));var Papa=require('papaparse');var Redis=require(_0xd24b('0x10'));var authService=require(_0xd24b('0x11'));var qs=require(_0xd24b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd24b('0x13'));var logger=require('../../config/logger')(_0xd24b('0x14'));var utils=require(_0xd24b('0x15'));var config=require(_0xd24b('0x16'));var licenseUtil=require(_0xd24b('0x17'));var db=require(_0xd24b('0x18'))['db'];function respondWithStatusCode(_0x44ad26,_0x5aabe3){_0x5aabe3=_0x5aabe3||0xcc;return function(_0x20264c){if(_0x20264c){return _0x44ad26[_0xd24b('0x19')](_0x5aabe3);}return _0x44ad26['status'](_0x5aabe3)[_0xd24b('0x1a')]();};}function respondWithResult(_0x54f891,_0x4adb42){_0x4adb42=_0x4adb42||0xc8;return function(_0x4a2bf6){if(_0x4a2bf6){return _0x54f891[_0xd24b('0x1b')](_0x4adb42)[_0xd24b('0x1c')](_0x4a2bf6);}};}function respondWithFilteredResult(_0xcec7a7,_0x1e609b){return function(_0x3b13da){if(_0x3b13da){var _0x1540f7=typeof _0x1e609b[_0xd24b('0x1d')]===_0xd24b('0x1e')&&typeof _0x1e609b[_0xd24b('0x1f')]===_0xd24b('0x1e');var _0x53fc71=_0x3b13da['count'];var _0x2032e1=_0x1540f7?0x0:_0x1e609b[_0xd24b('0x1d')];var _0x183b8c=_0x1540f7?_0x3b13da[_0xd24b('0x20')]:_0x1e609b[_0xd24b('0x1d')]+_0x1e609b['limit'];var _0x52d067;if(_0x183b8c>=_0x53fc71){_0x183b8c=_0x53fc71;_0x52d067=0xc8;}else{_0x52d067=0xce;}_0xcec7a7[_0xd24b('0x1b')](_0x52d067);return _0xcec7a7['set'](_0xd24b('0x21'),_0x2032e1+'-'+_0x183b8c+'/'+_0x53fc71)[_0xd24b('0x1c')](_0x3b13da);}return null;};}function patchUpdates(_0x4a68a7){return function(_0xdf13dd){try{jsonpatch[_0xd24b('0x22')](_0xdf13dd,_0x4a68a7,!![]);}catch(_0x208ba4){return BPromise[_0xd24b('0x23')](_0x208ba4);}return _0xdf13dd[_0xd24b('0x24')]();};}function saveUpdates(_0x11009d,_0x28b9e4){return function(_0x54b541){if(_0x54b541){return _0x54b541['update'](_0x11009d)[_0xd24b('0x25')](function(_0x53cfb3){return _0x53cfb3;});}return null;};}function removeEntity(_0x3ac6d1,_0x5a7abb){return function(_0x56db55){if(_0x56db55){return _0x56db55[_0xd24b('0x26')]()[_0xd24b('0x25')](function(){_0x3ac6d1[_0xd24b('0x1b')](0xcc)[_0xd24b('0x1a')]();});}};}function handleEntityNotFound(_0x5f0346,_0x189696){return function(_0x37afb0){if(!_0x37afb0){_0x5f0346[_0xd24b('0x19')](0x194);}return _0x37afb0;};}function handleError(_0x59cac0,_0x35f8bb){_0x35f8bb=_0x35f8bb||0x1f4;return function(_0x42bf51){logger[_0xd24b('0x27')](_0x42bf51[_0xd24b('0x28')]);if(_0x42bf51[_0xd24b('0x29')]){delete _0x42bf51[_0xd24b('0x29')];}_0x59cac0[_0xd24b('0x1b')](_0x35f8bb)['send'](_0x42bf51);};}exports['index']=function(_0x11ca72,_0xfb1871){var _0x1477d2={},_0x31ed84={},_0x20a0dc={'count':0x0,'rows':[]};var _0x5b25ee=_[_0xd24b('0x2a')](db[_0xd24b('0x2b')][_0xd24b('0x2c')],function(_0x417709){return{'name':_0x417709['fieldName'],'type':_0x417709['type']['key']};});_0x31ed84[_0xd24b('0x2d')]=_[_0xd24b('0x2a')](_0x5b25ee,_0xd24b('0x29'));_0x31ed84[_0xd24b('0x2e')]=_[_0xd24b('0x2f')](_0x11ca72[_0xd24b('0x2e')]);_0x31ed84['filters']=_[_0xd24b('0x30')](_0x31ed84[_0xd24b('0x2d')],_0x31ed84[_0xd24b('0x2e')]);_0x1477d2[_0xd24b('0x31')]=_[_0xd24b('0x30')](_0x31ed84[_0xd24b('0x2d')],qs[_0xd24b('0x32')](_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x32')]));_0x1477d2[_0xd24b('0x31')]=_0x1477d2[_0xd24b('0x31')][_0xd24b('0x33')]?_0x1477d2[_0xd24b('0x31')]:_0x31ed84[_0xd24b('0x2d')];if(!_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x34')](_0xd24b('0x35'))){_0x1477d2[_0xd24b('0x1f')]=qs[_0xd24b('0x1f')](_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x1f')]);_0x1477d2[_0xd24b('0x1d')]=qs[_0xd24b('0x1d')](_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x1d')]);}_0x1477d2[_0xd24b('0x36')]=qs[_0xd24b('0x37')](_0x11ca72['query']['sort']);_0x1477d2[_0xd24b('0x38')]=qs[_0xd24b('0x39')](_['pick'](_0x11ca72[_0xd24b('0x2e')],_0x31ed84['filters']),_0x5b25ee);if(_0x11ca72['query'][_0xd24b('0x3a')]){_0x1477d2[_0xd24b('0x38')]=_[_0xd24b('0x3b')](_0x1477d2[_0xd24b('0x38')],{'$or':_[_0xd24b('0x2a')](_0x5b25ee,function(_0x35af5f){if(_0x35af5f[_0xd24b('0x3c')]!==_0xd24b('0x3d')){var _0x3db554={};_0x3db554[_0x35af5f[_0xd24b('0x29')]]={'$like':'%'+_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x3a')]+'%'};return _0x3db554;}})});}_0x1477d2=_['merge']({},_0x1477d2,_0x11ca72[_0xd24b('0x3e')]);var _0x2c551d={'where':_0x1477d2[_0xd24b('0x38')]};return db[_0xd24b('0x2b')]['count'](_0x2c551d)[_0xd24b('0x25')](function(_0x5f56f7){_0x20a0dc[_0xd24b('0x20')]=_0x5f56f7;if(_0x11ca72[_0xd24b('0x2e')]['includeAll']){_0x1477d2['include']=[{'all':!![]}];}return db[_0xd24b('0x2b')][_0xd24b('0x3f')](_0x1477d2);})[_0xd24b('0x25')](function(_0x5d0200){_0x20a0dc[_0xd24b('0x40')]=_0x5d0200;return _0x20a0dc;})[_0xd24b('0x25')](respondWithFilteredResult(_0xfb1871,_0x1477d2))[_0xd24b('0x41')](handleError(_0xfb1871,null));};exports['show']=function(_0x1e4417,_0x267804){var _0x3eec53={'raw':!![],'where':{'id':_0x1e4417[_0xd24b('0x42')]['id']}},_0x42ec23={};_0x42ec23[_0xd24b('0x2d')]=_[_0xd24b('0x2f')](db[_0xd24b('0x2b')][_0xd24b('0x2c')]);_0x42ec23[_0xd24b('0x2e')]=_[_0xd24b('0x2f')](_0x1e4417[_0xd24b('0x2e')]);_0x42ec23[_0xd24b('0x39')]=_[_0xd24b('0x30')](_0x42ec23[_0xd24b('0x2d')],_0x42ec23[_0xd24b('0x2e')]);_0x3eec53[_0xd24b('0x31')]=_[_0xd24b('0x30')](_0x42ec23[_0xd24b('0x2d')],qs[_0xd24b('0x32')](_0x1e4417[_0xd24b('0x2e')][_0xd24b('0x32')]));_0x3eec53[_0xd24b('0x31')]=_0x3eec53[_0xd24b('0x31')][_0xd24b('0x33')]?_0x3eec53[_0xd24b('0x31')]:_0x42ec23[_0xd24b('0x2d')];if(_0x1e4417['query'][_0xd24b('0x43')]){_0x3eec53[_0xd24b('0x44')]=[{'all':!![]}];}_0x3eec53=_['merge']({},_0x3eec53,_0x1e4417[_0xd24b('0x3e')]);return db['SmsApplication']['find'](_0x3eec53)[_0xd24b('0x25')](handleEntityNotFound(_0x267804,null))['then'](respondWithResult(_0x267804,null))['catch'](handleError(_0x267804,null));};exports[_0xd24b('0x45')]=function(_0x22347d,_0x10d823){return db[_0xd24b('0x2b')]['create'](_0x22347d[_0xd24b('0x46')],{})[_0xd24b('0x25')](respondWithResult(_0x10d823,0xc9))[_0xd24b('0x41')](handleError(_0x10d823,null));};exports[_0xd24b('0x47')]=function(_0x41bed0,_0x22d671){if(_0x41bed0[_0xd24b('0x46')]['id']){delete _0x41bed0[_0xd24b('0x46')]['id'];}return db['SmsApplication'][_0xd24b('0x48')]({'where':{'id':_0x41bed0[_0xd24b('0x42')]['id']}})[_0xd24b('0x25')](handleEntityNotFound(_0x22d671,null))[_0xd24b('0x25')](saveUpdates(_0x41bed0[_0xd24b('0x46')],null))[_0xd24b('0x25')](respondWithResult(_0x22d671,null))[_0xd24b('0x41')](handleError(_0x22d671,null));};exports[_0xd24b('0x26')]=function(_0x55d0a4,_0x464fa0){return db['SmsApplication'][_0xd24b('0x48')]({'where':{'id':_0x55d0a4['params']['id']}})['then'](handleEntityNotFound(_0x464fa0,null))[_0xd24b('0x25')](removeEntity(_0x464fa0,null))[_0xd24b('0x41')](handleError(_0x464fa0,null));}; \ No newline at end of file +var _0xff18=['mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','SmsApplication','includeAll','rows','catch','show','params','find','create','body','destroy','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4f027d,_0x3f9587){var _0xc46890=function(_0x27d06c){while(--_0x27d06c){_0x4f027d['push'](_0x4f027d['shift']());}};_0xc46890(++_0x3f9587);}(_0xff18,0x8a));var _0x8ff1=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xff18[_0x5c6994];return _0x1d5c84;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ff1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ff1('0x1'));var rp=require(_0x8ff1('0x2'));var moment=require(_0x8ff1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ff1('0x4'));var util=require(_0x8ff1('0x5'));var path=require('path');var sox=require(_0x8ff1('0x6'));var csv=require(_0x8ff1('0x7'));var ejs=require(_0x8ff1('0x8'));var fs=require('fs');var fs_extra=require(_0x8ff1('0x9'));var _=require('lodash');var squel=require(_0x8ff1('0xa'));var crypto=require(_0x8ff1('0xb'));var jsforce=require(_0x8ff1('0xc'));var deskjs=require(_0x8ff1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8ff1('0xe'));var Papa=require(_0x8ff1('0xf'));var Redis=require('ioredis');var authService=require(_0x8ff1('0x10'));var qs=require(_0x8ff1('0x11'));var as=require(_0x8ff1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ff1('0x13'))(_0x8ff1('0x14'));var utils=require(_0x8ff1('0x15'));var config=require(_0x8ff1('0x16'));var licenseUtil=require(_0x8ff1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16ae83,_0x43323a){_0x43323a=_0x43323a||0xcc;return function(_0x1b95a5){if(_0x1b95a5){return _0x16ae83[_0x8ff1('0x18')](_0x43323a);}return _0x16ae83[_0x8ff1('0x19')](_0x43323a)[_0x8ff1('0x1a')]();};}function respondWithResult(_0x16a53b,_0x3780b6){_0x3780b6=_0x3780b6||0xc8;return function(_0xb1ebbb){if(_0xb1ebbb){return _0x16a53b[_0x8ff1('0x19')](_0x3780b6)['json'](_0xb1ebbb);}};}function respondWithFilteredResult(_0x5a9312,_0x3345c3){return function(_0x52487a){if(_0x52487a){var _0x674fd6=typeof _0x3345c3[_0x8ff1('0x1b')]===_0x8ff1('0x1c')&&typeof _0x3345c3[_0x8ff1('0x1d')]===_0x8ff1('0x1c');var _0x1a438e=_0x52487a[_0x8ff1('0x1e')];var _0xdc36ea=_0x674fd6?0x0:_0x3345c3[_0x8ff1('0x1b')];var _0x40ec77=_0x674fd6?_0x52487a['count']:_0x3345c3[_0x8ff1('0x1b')]+_0x3345c3[_0x8ff1('0x1d')];var _0x4549a4;if(_0x40ec77>=_0x1a438e){_0x40ec77=_0x1a438e;_0x4549a4=0xc8;}else{_0x4549a4=0xce;}_0x5a9312[_0x8ff1('0x19')](_0x4549a4);return _0x5a9312['set']('Content-Range',_0xdc36ea+'-'+_0x40ec77+'/'+_0x1a438e)[_0x8ff1('0x1f')](_0x52487a);}return null;};}function patchUpdates(_0x4277bf){return function(_0x48a4ba){try{jsonpatch['apply'](_0x48a4ba,_0x4277bf,!![]);}catch(_0x4f0388){return BPromise[_0x8ff1('0x20')](_0x4f0388);}return _0x48a4ba['save']();};}function saveUpdates(_0x3098e7,_0x5309ec){return function(_0x3fb3cd){if(_0x3fb3cd){return _0x3fb3cd[_0x8ff1('0x21')](_0x3098e7)[_0x8ff1('0x22')](function(_0x526a1c){return _0x526a1c;});}return null;};}function removeEntity(_0x55a22b,_0x408dd9){return function(_0x427415){if(_0x427415){return _0x427415['destroy']()[_0x8ff1('0x22')](function(){_0x55a22b[_0x8ff1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa359,_0x2cc5a2){return function(_0x37a8a9){if(!_0x37a8a9){_0x5aa359[_0x8ff1('0x18')](0x194);}return _0x37a8a9;};}function handleError(_0x3d89fd,_0x19284e){_0x19284e=_0x19284e||0x1f4;return function(_0x94fde9){logger[_0x8ff1('0x23')](_0x94fde9[_0x8ff1('0x24')]);if(_0x94fde9[_0x8ff1('0x25')]){delete _0x94fde9['name'];}_0x3d89fd[_0x8ff1('0x19')](_0x19284e)[_0x8ff1('0x26')](_0x94fde9);};}exports[_0x8ff1('0x27')]=function(_0x8be101,_0x1ba546){var _0x547966={},_0x3dc4b6={},_0x40bff7={'count':0x0,'rows':[]};var _0x2823c0=_[_0x8ff1('0x28')](db['SmsApplication'][_0x8ff1('0x29')],function(_0x4e60e3){return{'name':_0x4e60e3[_0x8ff1('0x2a')],'type':_0x4e60e3[_0x8ff1('0x2b')]['key']};});_0x3dc4b6[_0x8ff1('0x2c')]=_[_0x8ff1('0x28')](_0x2823c0,_0x8ff1('0x25'));_0x3dc4b6[_0x8ff1('0x2d')]=_[_0x8ff1('0x2e')](_0x8be101[_0x8ff1('0x2d')]);_0x3dc4b6[_0x8ff1('0x2f')]=_[_0x8ff1('0x30')](_0x3dc4b6['model'],_0x3dc4b6['query']);_0x547966[_0x8ff1('0x31')]=_[_0x8ff1('0x30')](_0x3dc4b6[_0x8ff1('0x2c')],qs[_0x8ff1('0x32')](_0x8be101['query'][_0x8ff1('0x32')]));_0x547966[_0x8ff1('0x31')]=_0x547966[_0x8ff1('0x31')][_0x8ff1('0x33')]?_0x547966['attributes']:_0x3dc4b6[_0x8ff1('0x2c')];if(!_0x8be101[_0x8ff1('0x2d')][_0x8ff1('0x34')](_0x8ff1('0x35'))){_0x547966[_0x8ff1('0x1d')]=qs['limit'](_0x8be101[_0x8ff1('0x2d')][_0x8ff1('0x1d')]);_0x547966['offset']=qs[_0x8ff1('0x1b')](_0x8be101[_0x8ff1('0x2d')]['offset']);}_0x547966[_0x8ff1('0x36')]=qs[_0x8ff1('0x37')](_0x8be101['query'][_0x8ff1('0x37')]);_0x547966[_0x8ff1('0x38')]=qs['filters'](_['pick'](_0x8be101[_0x8ff1('0x2d')],_0x3dc4b6[_0x8ff1('0x2f')]),_0x2823c0);if(_0x8be101[_0x8ff1('0x2d')]['filter']){_0x547966[_0x8ff1('0x38')]=_[_0x8ff1('0x39')](_0x547966[_0x8ff1('0x38')],{'$or':_['map'](_0x2823c0,function(_0x59c4be){if(_0x59c4be[_0x8ff1('0x2b')]!==_0x8ff1('0x3a')){var _0x4bb844={};_0x4bb844[_0x59c4be[_0x8ff1('0x25')]]={'$like':'%'+_0x8be101[_0x8ff1('0x2d')][_0x8ff1('0x3b')]+'%'};return _0x4bb844;}})});}_0x547966=_['merge']({},_0x547966,_0x8be101[_0x8ff1('0x3c')]);var _0x2e2cea={'where':_0x547966['where']};return db[_0x8ff1('0x3d')][_0x8ff1('0x1e')](_0x2e2cea)['then'](function(_0x31d12c){_0x40bff7[_0x8ff1('0x1e')]=_0x31d12c;if(_0x8be101[_0x8ff1('0x2d')][_0x8ff1('0x3e')]){_0x547966['include']=[{'all':!![]}];}return db[_0x8ff1('0x3d')]['findAll'](_0x547966);})[_0x8ff1('0x22')](function(_0x2ae8ad){_0x40bff7[_0x8ff1('0x3f')]=_0x2ae8ad;return _0x40bff7;})[_0x8ff1('0x22')](respondWithFilteredResult(_0x1ba546,_0x547966))[_0x8ff1('0x40')](handleError(_0x1ba546,null));};exports[_0x8ff1('0x41')]=function(_0x113c13,_0x447053){var _0x5c3424={'raw':!![],'where':{'id':_0x113c13[_0x8ff1('0x42')]['id']}},_0x45d0cc={};_0x45d0cc[_0x8ff1('0x2c')]=_[_0x8ff1('0x2e')](db['SmsApplication'][_0x8ff1('0x29')]);_0x45d0cc[_0x8ff1('0x2d')]=_[_0x8ff1('0x2e')](_0x113c13[_0x8ff1('0x2d')]);_0x45d0cc[_0x8ff1('0x2f')]=_[_0x8ff1('0x30')](_0x45d0cc[_0x8ff1('0x2c')],_0x45d0cc['query']);_0x5c3424[_0x8ff1('0x31')]=_[_0x8ff1('0x30')](_0x45d0cc[_0x8ff1('0x2c')],qs['fields'](_0x113c13[_0x8ff1('0x2d')][_0x8ff1('0x32')]));_0x5c3424['attributes']=_0x5c3424[_0x8ff1('0x31')][_0x8ff1('0x33')]?_0x5c3424[_0x8ff1('0x31')]:_0x45d0cc[_0x8ff1('0x2c')];if(_0x113c13[_0x8ff1('0x2d')][_0x8ff1('0x3e')]){_0x5c3424['include']=[{'all':!![]}];}_0x5c3424=_[_0x8ff1('0x39')]({},_0x5c3424,_0x113c13[_0x8ff1('0x3c')]);return db[_0x8ff1('0x3d')][_0x8ff1('0x43')](_0x5c3424)['then'](handleEntityNotFound(_0x447053,null))['then'](respondWithResult(_0x447053,null))[_0x8ff1('0x40')](handleError(_0x447053,null));};exports[_0x8ff1('0x44')]=function(_0x5a455b,_0x4accb9){return db[_0x8ff1('0x3d')][_0x8ff1('0x44')](_0x5a455b[_0x8ff1('0x45')],{})[_0x8ff1('0x22')](respondWithResult(_0x4accb9,0xc9))[_0x8ff1('0x40')](handleError(_0x4accb9,null));};exports[_0x8ff1('0x21')]=function(_0x48ba5e,_0xd0818f){if(_0x48ba5e[_0x8ff1('0x45')]['id']){delete _0x48ba5e['body']['id'];}return db[_0x8ff1('0x3d')][_0x8ff1('0x43')]({'where':{'id':_0x48ba5e[_0x8ff1('0x42')]['id']}})[_0x8ff1('0x22')](handleEntityNotFound(_0xd0818f,null))[_0x8ff1('0x22')](saveUpdates(_0x48ba5e[_0x8ff1('0x45')],null))[_0x8ff1('0x22')](respondWithResult(_0xd0818f,null))[_0x8ff1('0x40')](handleError(_0xd0818f,null));};exports[_0x8ff1('0x46')]=function(_0x374471,_0x81cf86){return db[_0x8ff1('0x3d')]['find']({'where':{'id':_0x374471[_0x8ff1('0x42')]['id']}})['then'](handleEntityNotFound(_0x81cf86,null))[_0x8ff1('0x22')](removeEntity(_0x81cf86,null))['catch'](handleError(_0x81cf86,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index e38760b..7c12381 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 _0x58a2=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0x530159,_0x774c9d){var _0x17c43f=function(_0x4dd669){while(--_0x4dd669){_0x530159['push'](_0x530159['shift']());}};_0x17c43f(++_0x774c9d);}(_0x58a2,0x10b));var _0x258a=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x58a2[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x258a('0x0'));var util=require('util');var logger=require(_0x258a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x258a('0x2'));var fs=require('fs');var path=require(_0x258a('0x3'));var rimraf=require(_0x258a('0x4'));var config=require(_0x258a('0x5'));var attributes=require(_0x258a('0x6'));module[_0x258a('0x7')]=function(_0x4412f9,_0x53746b){return _0x4412f9['define']('SmsApplication',attributes,{'tableName':_0x258a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x258a('0x9'),'collate':_0x258a('0xa')});}; \ No newline at end of file +var _0x77c6=['request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0x77c6,0x1b7));var _0x677c=function(_0x325a58,_0x5a12ab){_0x325a58=_0x325a58-0x0;var _0x41d1b1=_0x77c6[_0x325a58];return _0x41d1b1;};'use strict';var _=require(_0x677c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x677c('0x1'));var moment=require('moment');var BPromise=require(_0x677c('0x2'));var rp=require(_0x677c('0x3'));var fs=require('fs');var path=require(_0x677c('0x4'));var rimraf=require(_0x677c('0x5'));var config=require(_0x677c('0x6'));var attributes=require('./smsApplication.attributes');module[_0x677c('0x7')]=function(_0x5447de,_0x3efacc){return _0x5447de[_0x677c('0x8')](_0x677c('0x9'),attributes,{'tableName':_0x677c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x677c('0xb'),'collate':_0x677c('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index e25672b..0994fb7 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 _0x7d06=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x7d06,0x158));var _0x67d0=function(_0x2b60eb,_0x48074c){_0x2b60eb=_0x2b60eb-0x0;var _0x56aa21=_0x7d06[_0x2b60eb];return _0x56aa21;};'use strict';var _=require(_0x67d0('0x0'));var util=require(_0x67d0('0x1'));var moment=require(_0x67d0('0x2'));var BPromise=require(_0x67d0('0x3'));var rs=require(_0x67d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67d0('0x5'))['db'];var utils=require(_0x67d0('0x6'));var logger=require(_0x67d0('0x7'))('rpc');var config=require(_0x67d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x67d0('0x9')][_0x67d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x367f1d,_0xe4789b,_0x3c9976){return new BPromise(function(_0x481a08,_0x358986){return client['request'](_0x367f1d,_0x3c9976)[_0x67d0('0xb')](function(_0x5916d0){logger[_0x67d0('0xc')](_0x67d0('0xd'),_0xe4789b,_0x67d0('0xe'));logger[_0x67d0('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0xe4789b,_0x67d0('0xe'),JSON['stringify'](_0x5916d0));if(_0x5916d0['error']){if(_0x5916d0[_0x67d0('0x10')][_0x67d0('0x11')]===0x1f4){logger['error'](_0x67d0('0xd'),_0xe4789b,_0x5916d0[_0x67d0('0x10')]['message']);return _0x358986(_0x5916d0[_0x67d0('0x10')]['message']);}logger[_0x67d0('0x10')](_0x67d0('0xd'),_0xe4789b,_0x5916d0[_0x67d0('0x10')][_0x67d0('0x12')]);return _0x481a08(_0x5916d0[_0x67d0('0x10')][_0x67d0('0x12')]);}else{logger[_0x67d0('0xc')](_0x67d0('0xd'),_0xe4789b,_0x67d0('0xe'));_0x481a08(_0x5916d0[_0x67d0('0x13')]['message']);}})[_0x67d0('0x14')](function(_0xa1b889){logger['error'](_0x67d0('0xd'),_0xe4789b,_0xa1b889);_0x358986(_0xa1b889);});});} \ No newline at end of file +var _0xf9e5=['info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x113f9a,_0x57b136){var _0x10bd8e=function(_0x6162bb){while(--_0x6162bb){_0x113f9a['push'](_0x113f9a['shift']());}};_0x10bd8e(++_0x57b136);}(_0xf9e5,0x89));var _0x5f9e=function(_0xe76202,_0x54d158){_0xe76202=_0xe76202-0x0;var _0x4c44c4=_0xf9e5[_0xe76202];return _0x4c44c4;};'use strict';var _=require(_0x5f9e('0x0'));var util=require(_0x5f9e('0x1'));var moment=require(_0x5f9e('0x2'));var BPromise=require(_0x5f9e('0x3'));var rs=require(_0x5f9e('0x4'));var fs=require('fs');var Redis=require(_0x5f9e('0x5'));var db=require(_0x5f9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f9e('0x7'))(_0x5f9e('0x8'));var config=require('../../config/environment');var jayson=require(_0x5f9e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8bb75c,_0x35fcc8,_0x4ee331){return new BPromise(function(_0x13de1c,_0x3cebf5){return client['request'](_0x8bb75c,_0x4ee331)['then'](function(_0x549a00){logger[_0x5f9e('0xa')](_0x5f9e('0xb'),_0x35fcc8,'request\x20sent');logger[_0x5f9e('0xc')](_0x5f9e('0xd'),_0x35fcc8,_0x5f9e('0xe'),JSON[_0x5f9e('0xf')](_0x549a00));if(_0x549a00[_0x5f9e('0x10')]){if(_0x549a00['error'][_0x5f9e('0x11')]===0x1f4){logger[_0x5f9e('0x10')](_0x5f9e('0xb'),_0x35fcc8,_0x549a00[_0x5f9e('0x10')]['message']);return _0x3cebf5(_0x549a00[_0x5f9e('0x10')][_0x5f9e('0x12')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x35fcc8,_0x549a00[_0x5f9e('0x10')][_0x5f9e('0x12')]);return _0x13de1c(_0x549a00[_0x5f9e('0x10')]['message']);}else{logger[_0x5f9e('0xa')](_0x5f9e('0xb'),_0x35fcc8,_0x5f9e('0xe'));_0x13de1c(_0x549a00[_0x5f9e('0x13')]['message']);}})[_0x5f9e('0x14')](function(_0x293fe2){logger['error']('SmsApplication,\x20%s,\x20%s',_0x35fcc8,_0x293fe2);_0x3cebf5(_0x293fe2);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index fe2e125..2f0a5df 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 _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x96cc19,_0x3246a9){var _0x23d336=function(_0x2274bc){while(--_0x2274bc){_0x96cc19['push'](_0x96cc19['shift']());}};_0x23d336(++_0x3246a9);}(_0xb03e,0x1eb));var _0xeb03=function(_0x22ff2e,_0x4076a0){_0x22ff2e=_0x22ff2e-0x0;var _0x42e1a2=_0xb03e[_0x22ff2e];return _0x42e1a2;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x14')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x16')]);router[_0xeb03('0x14')](_0xeb03('0x17'),auth['isAuthenticated'](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1a')),controller[_0xeb03('0x1b')]);router['put'](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')]('sms',_0xeb03('0x1c')),controller[_0xeb03('0x1d')]);router[_0xeb03('0x1e')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1f')),controller[_0xeb03('0x20')]);router[_0xeb03('0x1e')](_0xeb03('0x17'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x21')]);module[_0xeb03('0x22')]=router; \ No newline at end of file +var _0xf7b4=['/describe','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index'];(function(_0x17a2ad,_0x40b692){var _0x530ce0=function(_0x5ca6e8){while(--_0x5ca6e8){_0x17a2ad['push'](_0x17a2ad['shift']());}};_0x530ce0(++_0x40b692);}(_0xf7b4,0x152));var _0x4f7b=function(_0x44e061,_0x578093){_0x44e061=_0x44e061-0x0;var _0x428896=_0xf7b4[_0x44e061];return _0x428896;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/messages',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0x7')](_0x4f7b('0xf'),auth[_0x4f7b('0x8')](),controller['download']);router[_0x4f7b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f7b('0x10')](_0x4f7b('0x11'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['post'](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x16')),controller[_0x4f7b('0x17')]);router[_0x4f7b('0x18')](_0x4f7b('0xc'),auth[_0x4f7b('0x8')](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),_0x4f7b('0x19')),controller['update']);router[_0x4f7b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x4f7b('0x14')](_0x4f7b('0x15'),'smsinteraction:destroy'),controller[_0x4f7b('0x1b')]);router[_0x4f7b('0x1a')](_0x4f7b('0x13'),auth[_0x4f7b('0x8')](),controller['removeTags']);module[_0x4f7b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 36a911d..c59312c 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 _0x6739=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x479d34,_0x4ed609){var _0x42a5cd=function(_0x25edb9){while(--_0x25edb9){_0x479d34['push'](_0x479d34['shift']());}};_0x42a5cd(++_0x4ed609);}(_0x6739,0xd3));var _0x9673=function(_0x1a51aa,_0x344705){_0x1a51aa=_0x1a51aa-0x0;var _0x28c6e8=_0x6739[_0x1a51aa];return _0x28c6e8;};'use strict';var Sequelize=require(_0x9673('0x0'));var moment=require(_0x9673('0x1'));module[_0x9673('0x2')]={'closed':{'type':Sequelize[_0x9673('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9673('0x4')]},'disposition':{'type':Sequelize[_0x9673('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9673('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9673('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9673('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9673('0x6')]('in',_0x9673('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xaf60=['ENUM','out','BOOLEAN','INTEGER','sequelize','moment','exports','STRING','DATE'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0xaf60,0x82));var _0x0af6=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xaf60[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x0af6('0x0'));var moment=require(_0x0af6('0x1'));module[_0x0af6('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0af6('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0af6('0x3')]},'phone':{'type':Sequelize[_0x0af6('0x3')]},'read1stAt':{'type':Sequelize[_0x0af6('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0af6('0x5')]('in',_0x0af6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0af6('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0af6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0af6('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0af6('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ec545b1..a652316 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 _0x39d4=['count','json','update','destroy','then','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','keys','filters','attributes','model','fields','length','includeAll','merge','options','find','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','SmsMessage','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','root','server','files','transcript-%d-%s.zip','User','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','push','SmsAccount','Account','Owner','fullname','get','Sms','N.A.','closed','closedAt','disposition','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','log','err','unlinkSync','bluebird','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x39d4,0x1dc));var _0x439d=function(_0x1a463d,_0x30ea3b){_0x1a463d=_0x1a463d-0x0;var _0x43eec8=_0x39d4[_0x1a463d];return _0x43eec8;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x439d('0x0'));var util=require('util');var path=require(_0x439d('0x1'));var ejs=require(_0x439d('0x2'));var fs=require('fs');var _=require(_0x439d('0x3'));var Redis=require('ioredis');var interaction=require(_0x439d('0x4'));var qs=require(_0x439d('0x5'));var pdf=require(_0x439d('0x6'));var logger=require(_0x439d('0x7'))('api');var config=require(_0x439d('0x8'));var db=require(_0x439d('0x9'))['db'];config[_0x439d('0xa')]=_[_0x439d('0xb')](config[_0x439d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x439d('0xc'))(new Redis(config[_0x439d('0xa')]));require('./smsInteraction.socket')[_0x439d('0xd')](socket);function respondWithStatusCode(_0x5aca7c,_0x297144){_0x297144=_0x297144||0xcc;return function(_0x46bf1e){if(_0x46bf1e){return _0x5aca7c[_0x439d('0xe')](_0x297144);}return _0x5aca7c[_0x439d('0xf')](_0x297144)[_0x439d('0x10')]();};}function respondWithResult(_0x519c04,_0x110482){_0x110482=_0x110482||0xc8;return function(_0x3dace7){if(_0x3dace7){return _0x519c04[_0x439d('0xf')](_0x110482)['json'](_0x3dace7);}};}function respondWithFilteredResult(_0x27af43,_0x242c42){return function(_0x4ef1aa){if(_0x4ef1aa){var _0x4a76be=typeof _0x242c42[_0x439d('0x11')]===_0x439d('0x12')&&typeof _0x242c42[_0x439d('0x13')]===_0x439d('0x12');var _0x361ece=_0x4ef1aa[_0x439d('0x14')];var _0x4a474e=_0x4a76be?0x0:_0x242c42[_0x439d('0x11')];var _0x1bd746=_0x4a76be?_0x4ef1aa[_0x439d('0x14')]:_0x242c42[_0x439d('0x11')]+_0x242c42[_0x439d('0x13')];var _0x1e5149;if(_0x1bd746>=_0x361ece){_0x1bd746=_0x361ece;_0x1e5149=0xc8;}else{_0x1e5149=0xce;}_0x27af43[_0x439d('0xf')](_0x1e5149);return _0x27af43['set']('Content-Range',_0x4a474e+'-'+_0x1bd746+'/'+_0x361ece)[_0x439d('0x15')](_0x4ef1aa);}return null;};}function saveUpdates(_0x19a02a){return function(_0x1a2937){if(_0x1a2937){return _0x1a2937[_0x439d('0x16')](_0x19a02a)['then'](function(_0x1f316d){return _0x1f316d;});}return null;};}function removeEntity(_0x26cef4){return function(_0x2e7247){if(_0x2e7247){return _0x2e7247[_0x439d('0x17')]()[_0x439d('0x18')](function(){_0x26cef4[_0x439d('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5068af){return function(_0x5d5f4b){if(!_0x5d5f4b){_0x5068af[_0x439d('0xe')](0x194);}return _0x5d5f4b;};}function handleError(_0xe66000,_0x34d5ff){_0x34d5ff=_0x34d5ff||0x1f4;return function(_0x1713d){logger[_0x439d('0x19')](_0x1713d[_0x439d('0x1a')]);if(_0x1713d[_0x439d('0x1b')]){delete _0x1713d[_0x439d('0x1b')];}_0xe66000[_0x439d('0xf')](_0x34d5ff)[_0x439d('0x1c')](_0x1713d);};}exports[_0x439d('0x1d')]=function(_0x1c5de0,_0x29dad2){var _0x5874a2={};var _0x286753=_[_0x439d('0x1e')](db[_0x439d('0x1f')][_0x439d('0x20')],function(_0x31c956){return{'name':_0x31c956[_0x439d('0x21')],'type':_0x31c956[_0x439d('0x22')][_0x439d('0x23')]};});_0x5874a2=qs[_0x439d('0x24')](_0x286753,_0x1c5de0);return interaction[_0x439d('0x25')](_0x439d('0x26'),_0x1c5de0[_0x439d('0x27')],_0x1c5de0[_0x439d('0x28')],_0x5874a2,_0x286753)[_0x439d('0x18')](respondWithFilteredResult(_0x29dad2,_0x5874a2))[_0x439d('0x29')](handleError(_0x29dad2,null));};exports['show']=function(_0x254014,_0x12e2e0){var _0x33b7f6={'raw':![],'where':{'id':_0x254014['params']['id']}},_0x11c89f={};_0x11c89f['model']=_[_0x439d('0x2a')](db[_0x439d('0x1f')][_0x439d('0x20')]);_0x11c89f[_0x439d('0x27')]=_[_0x439d('0x2a')](_0x254014['query']);_0x11c89f[_0x439d('0x2b')]=_['intersection'](_0x11c89f['model'],_0x11c89f[_0x439d('0x27')]);_0x33b7f6[_0x439d('0x2c')]=_['intersection'](_0x11c89f[_0x439d('0x2d')],qs[_0x439d('0x2e')](_0x254014['query']['fields']));_0x33b7f6[_0x439d('0x2c')]=_0x33b7f6[_0x439d('0x2c')][_0x439d('0x2f')]?_0x33b7f6[_0x439d('0x2c')]:_0x11c89f[_0x439d('0x2d')];if(_0x254014[_0x439d('0x27')][_0x439d('0x30')]){_0x33b7f6['include']=[{'all':!![]}];}_0x33b7f6=_[_0x439d('0x31')]({},_0x33b7f6,_0x254014[_0x439d('0x32')]);return db[_0x439d('0x1f')][_0x439d('0x33')](_0x33b7f6)[_0x439d('0x18')](handleEntityNotFound(_0x12e2e0,null))[_0x439d('0x18')](respondWithResult(_0x12e2e0,null))[_0x439d('0x29')](handleError(_0x12e2e0,null));};exports[_0x439d('0x34')]=function(_0x2bb89d,_0x5b0913){return db[_0x439d('0x1f')][_0x439d('0x34')](_0x2bb89d[_0x439d('0x35')],{})[_0x439d('0x18')](respondWithResult(_0x5b0913,0xc9))[_0x439d('0x29')](handleError(_0x5b0913,null));};exports[_0x439d('0x16')]=function(_0x4c4b55,_0x494643){if(_0x4c4b55[_0x439d('0x35')]['id']){delete _0x4c4b55[_0x439d('0x35')]['id'];}return db[_0x439d('0x1f')]['find']({'where':{'id':_0x4c4b55[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x494643,null))[_0x439d('0x18')](saveUpdates(_0x4c4b55['body'],null))[_0x439d('0x18')](respondWithResult(_0x494643,null))[_0x439d('0x29')](handleError(_0x494643,null));};exports[_0x439d('0x17')]=function(_0x271a40,_0x109866){return db['SmsInteraction'][_0x439d('0x33')]({'where':{'id':_0x271a40[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x109866,null))[_0x439d('0x18')](removeEntity(_0x109866,null))[_0x439d('0x29')](handleError(_0x109866,null));};exports[_0x439d('0x37')]=function(_0x2fd898,_0x5c7269){return db[_0x439d('0x1f')][_0x439d('0x37')]()[_0x439d('0x18')](respondWithResult(_0x5c7269,null))[_0x439d('0x29')](handleError(_0x5c7269,null));};exports[_0x439d('0x38')]=function(_0x2d36e9,_0x41e36a){return db['SmsMessage'][_0x439d('0x33')]({'where':{'id':_0x2d36e9['params']['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x41e36a,null))['then'](function(_0x173e14){if(_0x173e14){return _0x173e14[_0x439d('0x38')](_0x2d36e9[_0x439d('0x35')][_0x439d('0x39')],_[_0x439d('0x3a')](_0x2d36e9[_0x439d('0x35')],['ids','id'])||{});}})['then'](respondWithResult(_0x41e36a,null))[_0x439d('0x29')](handleError(_0x41e36a,null));};exports[_0x439d('0x3b')]=function(_0x59a54d,_0x3023e1){var _0x2bd93c={'raw':![],'where':{}};var _0x3e7fbc={};var _0x5be114={'count':0x0,'rows':[]};return db[_0x439d('0x1f')][_0x439d('0x3c')]({'where':{'id':_0x59a54d[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x3023e1,null))[_0x439d('0x18')](function(_0x5db2d3){if(_0x5db2d3){_0x3e7fbc[_0x439d('0x2d')]=_[_0x439d('0x2a')](db['SmsMessage'][_0x439d('0x20')]);_0x3e7fbc[_0x439d('0x27')]=_[_0x439d('0x2a')](_0x59a54d['query']);_0x3e7fbc['filters']=_[_0x439d('0x3d')](_0x3e7fbc[_0x439d('0x2d')],_0x3e7fbc[_0x439d('0x27')]);_0x2bd93c[_0x439d('0x2c')]=_[_0x439d('0x3d')](_0x3e7fbc[_0x439d('0x2d')],qs[_0x439d('0x2e')](_0x59a54d[_0x439d('0x27')][_0x439d('0x2e')]));_0x2bd93c['attributes']=_0x2bd93c[_0x439d('0x2c')]['length']?_0x2bd93c[_0x439d('0x2c')]:_0x3e7fbc[_0x439d('0x2d')];if(!_0x59a54d[_0x439d('0x27')][_0x439d('0x3e')](_0x439d('0x3f'))){_0x2bd93c[_0x439d('0x13')]=qs['limit'](_0x59a54d['query'][_0x439d('0x13')]);_0x2bd93c[_0x439d('0x11')]=qs[_0x439d('0x11')](_0x59a54d[_0x439d('0x27')][_0x439d('0x11')]);}_0x2bd93c[_0x439d('0x40')]=qs['sort'](_0x59a54d[_0x439d('0x27')][_0x439d('0x41')]);_0x2bd93c[_0x439d('0x42')]=qs[_0x439d('0x2b')](_[_0x439d('0x43')](_0x59a54d[_0x439d('0x27')],_0x3e7fbc[_0x439d('0x2b')]));_0x2bd93c[_0x439d('0x42')][_0x439d('0x44')]=_0x5db2d3['id'];if(_0x59a54d['query'][_0x439d('0x45')]){_0x2bd93c['where']=_[_0x439d('0x31')](_0x2bd93c[_0x439d('0x42')],{'$or':_[_0x439d('0x1e')](_0x2bd93c['attributes'],function(_0x10f009){var _0x9b30e2={};_0x9b30e2[_0x10f009]={'$like':'%'+_0x59a54d[_0x439d('0x27')][_0x439d('0x45')]+'%'};return _0x9b30e2;})});}if(_0x59a54d[_0x439d('0x27')][_0x439d('0x46')]){var _0x10f68c=_0x59a54d[_0x439d('0x27')][_0x439d('0x46')][_0x439d('0x47')](',');var _0x5d54b2={};_0x5d54b2[_0x10f68c[0x0]]={'$gte':moment(_0x10f68c[0x1])[_0x439d('0x48')](_0x439d('0x49'))};_0x2bd93c[_0x439d('0x42')]=_['merge'](_0x2bd93c['where'],_0x5d54b2);}_0x2bd93c=_[_0x439d('0x31')]({},_0x2bd93c,_0x59a54d['options']);return db['SmsMessage'][_0x439d('0x14')]({'where':_0x2bd93c[_0x439d('0x42')]})[_0x439d('0x18')](function(_0x2f315f){_0x5be114[_0x439d('0x14')]=_0x2f315f;if(_0x59a54d[_0x439d('0x27')][_0x439d('0x30')]){_0x2bd93c[_0x439d('0x4a')]=[{'all':!![]}];}return db[_0x439d('0x4b')][_0x439d('0x25')](_0x2bd93c);})[_0x439d('0x18')](function(_0x2a7566){_0x5be114['rows']=_0x2a7566;return _0x5be114;});}})['then'](respondWithFilteredResult(_0x3023e1,_0x2bd93c))[_0x439d('0x29')](handleError(_0x3023e1,null));};exports[_0x439d('0x4c')]=function(_0x4c5c7e,_0x4f6bf5){return db[_0x439d('0x1f')][_0x439d('0x33')]({'where':{'id':_0x4c5c7e[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x4f6bf5,null))['then'](function(_0x4db888){if(_0x4db888){return _0x4db888[_0x439d('0x4d')](_0x4c5c7e[_0x439d('0x35')][_0x439d('0x39')],_[_0x439d('0x3a')](_0x4c5c7e[_0x439d('0x35')],[_0x439d('0x39'),'id'])||{})[_0x439d('0x4e')](function(){return db[_0x439d('0x4f')][_0x439d('0x25')]({'attributes':['id',_0x439d('0x1b'),_0x439d('0x50')],'where':{'id':_0x4c5c7e[_0x439d('0x35')][_0x439d('0x39')]}});})['then'](function(_0x33affa){socket[_0x439d('0x51')](_0x439d('0x52'),{'id':Number(_0x4c5c7e[_0x439d('0x36')]['id']),'tags':_0x33affa||[]});return{'id':Number(_0x4c5c7e['params']['id']),'tags':_0x33affa||[]};});}})[_0x439d('0x18')](respondWithResult(_0x4f6bf5,null))[_0x439d('0x29')](handleError(_0x4f6bf5,null));};exports[_0x439d('0x53')]=function(_0xff83b2,_0x80b11){return db['SmsInteraction']['find']({'where':{'id':_0xff83b2[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x80b11,null))[_0x439d('0x18')](function(_0x331b18){if(_0x331b18){return _0x331b18['removeTags'](_0xff83b2[_0x439d('0x27')][_0x439d('0x39')]);}})[_0x439d('0x18')](respondWithStatusCode(_0x80b11,null))[_0x439d('0x29')](handleError(_0x80b11,null));};exports['download']=function(_0x5df129,_0x5c7c3d){var _0x1100b9=moment()[_0x439d('0x54')]()[_0x439d('0x55')]();var _0x1ff2e9=path[_0x439d('0x56')](config[_0x439d('0x57')],_0x439d('0x58'),_0x439d('0x59'),'tmp');var _0x24cd94=path[_0x439d('0x56')](_0x1ff2e9,_0x1100b9);var _0x1e8b1d=util[_0x439d('0x48')](_0x439d('0x5a'),_0x5df129[_0x439d('0x36')]['id'],_0x1100b9);var _0x15e381=path['join'](_0x1ff2e9,_0x1e8b1d);var _0xfc138=[];_0xfc138['push']({'model':db[_0x439d('0x5b')],'as':_0x439d('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0xfc138['push']({'model':db[_0x439d('0x5c')],'as':_0x439d('0x5d'),'attributes':['id',_0x439d('0x5e'),_0x439d('0x5f')],'raw':!![]});var _0xf60019=[{'model':db[_0x439d('0x4b')],'as':_0x439d('0x60'),'attributes':['id',_0x439d('0x35'),_0x439d('0x61'),_0x439d('0x62'),_0x439d('0x63'),'read'],'include':_0xfc138}];_0xf60019[_0x439d('0x64')]({'model':db[_0x439d('0x65')],'as':_0x439d('0x66'),'attributes':['id',_0x439d('0x1b')]});_0xf60019[_0x439d('0x64')]({'model':db[_0x439d('0x5b')],'as':_0x439d('0x67'),'attributes':['id',_0x439d('0x68')]});return db[_0x439d('0x1f')][_0x439d('0x33')]({'where':{'id':_0x5df129['params']['id']},'include':_0xf60019})[_0x439d('0x18')](handleEntityNotFound(_0x5c7c3d,null))['then'](function(_0x118086){if(_0x118086){var _0x23f26e=_0x118086[_0x439d('0x69')]({'plain':!![]});fs['mkdirSync'](_0x24cd94);var _0xbbd92={'channel':_0x439d('0x6a'),'account':_0x23f26e[_0x439d('0x66')][_0x439d('0x1b')],'agent':_0x23f26e[_0x439d('0x67')]?_0x23f26e[_0x439d('0x67')][_0x439d('0x68')]:_0x439d('0x6b'),'createdAt':moment(_0x23f26e[_0x439d('0x61')])[_0x439d('0x48')](_0x439d('0x49'))[_0x439d('0x55')](),'closedAt':_0x23f26e[_0x439d('0x6c')]?moment(_0x23f26e[_0x439d('0x6d')])['format'](_0x439d('0x49'))[_0x439d('0x55')]():'','disposition':_0x23f26e[_0x439d('0x6e')],'messages':_(_0x23f26e[_0x439d('0x60')])[_0x439d('0x45')]({'secret':![]})['map'](function(_0x2fa3cf){return{'date':moment(_0x2fa3cf[_0x439d('0x61')])['format'](_0x439d('0x49'))[_0x439d('0x55')](),'sender':_0x2fa3cf[_0x439d('0x62')]===_0x439d('0x6f')?_0x2fa3cf[_0x439d('0x5b')]?_0x2fa3cf[_0x439d('0x5b')][_0x439d('0x68')]:_0x439d('0x70'):_0x2fa3cf[_0x439d('0x5d')]['firstName']+(_0x2fa3cf[_0x439d('0x5d')][_0x439d('0x5f')]?'\x20'+_0x2fa3cf[_0x439d('0x5d')][_0x439d('0x5f')]:''),'body':_0x2fa3cf[_0x439d('0x35')],'direction':_0x2fa3cf['direction']===_0x439d('0x6f')?'A':'C','secret':_0x2fa3cf[_0x439d('0x63')],'read':_0x2fa3cf[_0x439d('0x71')]};})[_0x439d('0x72')]()};return ejs[_0x439d('0x73')](path[_0x439d('0x56')](config[_0x439d('0x57')],_0x439d('0x58'),_0x439d('0x74'),_0x439d('0x75')),{'interaction':_0xbbd92})[_0x439d('0x18')](function(_0x5aeda0){var _0x1aacd9=path['join'](_0x24cd94,_0x439d('0x76')+_0x23f26e['id']+'-'+_0x1100b9+'.pdf');var _0x1bb4c9={'path':_0x1aacd9,'channel':_0x439d('0x6a'),'interactionId':_0x23f26e['id']};return pdf[_0x439d('0x77')](_0x5aeda0,_0x1bb4c9);})['then'](function(){return new BPromise(function(_0x138138,_0x5558e1){zipdir(_0x24cd94,{'saveTo':_0x15e381},function(_0x424054,_0x5e6f71){if(_0x424054)return _0x5558e1(_0x424054);return _0x138138(_0x5e6f71);});})['then'](function(){return new BPromise(function(_0x33a43c,_0x22585e){rimraf(_0x24cd94,function(_0x257c98){if(_0x257c98)_0x22585e(_0x257c98);return _0x33a43c();});});})['then'](function(){return _0x5c7c3d[_0x439d('0x78')](_0x15e381,_0x1e8b1d,function(_0x61327){if(_0x61327){console[_0x439d('0x79')](_0x439d('0x7a'),_0x61327);}else{fs[_0x439d('0x7b')](_0x15e381);}});});});}else{return _0x5c7c3d[_0x439d('0xe')](0xc8);}})[_0x439d('0x29')](handleError(_0x5c7c3d,null));}; \ No newline at end of file +var _0xd0ae=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','name','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','user','catch','show','params','model','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','create','body','find','describe','addMessage','SmsMessage','ids','omit','getMessages','hasOwnProperty','order','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','toString','server','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','direction','read','SmsAccount','Account','Sms','Owner','N.A.','createdAt','closed','closedAt','disposition','System','out','value','renderFile','root','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api'];(function(_0x17d133,_0x3aebc5){var _0xf4f7a2=function(_0x30277d){while(--_0x30277d){_0x17d133['push'](_0x17d133['shift']());}};_0xf4f7a2(++_0x3aebc5);}(_0xd0ae,0x160));var _0xed0a=function(_0x2c942f,_0x6bfac6){_0x2c942f=_0x2c942f-0x0;var _0x4cbe0d=_0xd0ae[_0x2c942f];return _0x4cbe0d;};'use strict';var rimraf=require(_0xed0a('0x0'));var zipdir=require(_0xed0a('0x1'));var moment=require('moment');var BPromise=require(_0xed0a('0x2'));var util=require('util');var path=require(_0xed0a('0x3'));var ejs=require(_0xed0a('0x4'));var fs=require('fs');var _=require(_0xed0a('0x5'));var Redis=require(_0xed0a('0x6'));var interaction=require(_0xed0a('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xed0a('0x8'));var logger=require(_0xed0a('0x9'))(_0xed0a('0xa'));var config=require(_0xed0a('0xb'));var db=require(_0xed0a('0xc'))['db'];config[_0xed0a('0xd')]=_[_0xed0a('0xe')](config['redis'],{'host':_0xed0a('0xf'),'port':0x18eb});var socket=require(_0xed0a('0x10'))(new Redis(config[_0xed0a('0xd')]));require(_0xed0a('0x11'))[_0xed0a('0x12')](socket);function respondWithStatusCode(_0x586667,_0x1f34f1){_0x1f34f1=_0x1f34f1||0xcc;return function(_0x2852aa){if(_0x2852aa){return _0x586667[_0xed0a('0x13')](_0x1f34f1);}return _0x586667['status'](_0x1f34f1)['end']();};}function respondWithResult(_0x24825f,_0x32ce5d){_0x32ce5d=_0x32ce5d||0xc8;return function(_0x195257){if(_0x195257){return _0x24825f[_0xed0a('0x14')](_0x32ce5d)[_0xed0a('0x15')](_0x195257);}};}function respondWithFilteredResult(_0x38efc9,_0x29dd2b){return function(_0x1661da){if(_0x1661da){var _0xce85ff=typeof _0x29dd2b[_0xed0a('0x16')]===_0xed0a('0x17')&&typeof _0x29dd2b[_0xed0a('0x18')]==='undefined';var _0x396dc5=_0x1661da['count'];var _0x3f96de=_0xce85ff?0x0:_0x29dd2b[_0xed0a('0x16')];var _0x3201f1=_0xce85ff?_0x1661da[_0xed0a('0x19')]:_0x29dd2b['offset']+_0x29dd2b[_0xed0a('0x18')];var _0xdfc6f2;if(_0x3201f1>=_0x396dc5){_0x3201f1=_0x396dc5;_0xdfc6f2=0xc8;}else{_0xdfc6f2=0xce;}_0x38efc9[_0xed0a('0x14')](_0xdfc6f2);return _0x38efc9['set'](_0xed0a('0x1a'),_0x3f96de+'-'+_0x3201f1+'/'+_0x396dc5)[_0xed0a('0x15')](_0x1661da);}return null;};}function saveUpdates(_0x498e3f){return function(_0x59020c){if(_0x59020c){return _0x59020c[_0xed0a('0x1b')](_0x498e3f)[_0xed0a('0x1c')](function(_0x3bb649){return _0x3bb649;});}return null;};}function removeEntity(_0x3700ad){return function(_0x3b97fc){if(_0x3b97fc){return _0x3b97fc[_0xed0a('0x1d')]()[_0xed0a('0x1c')](function(){_0x3700ad[_0xed0a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x389d82){return function(_0x39a2ca){if(!_0x39a2ca){_0x389d82[_0xed0a('0x13')](0x194);}return _0x39a2ca;};}function handleError(_0x50a8d8,_0x5a8efe){_0x5a8efe=_0x5a8efe||0x1f4;return function(_0x20a3f6){logger[_0xed0a('0x1e')](_0x20a3f6['stack']);if(_0x20a3f6[_0xed0a('0x1f')]){delete _0x20a3f6[_0xed0a('0x1f')];}_0x50a8d8[_0xed0a('0x14')](_0x5a8efe)['send'](_0x20a3f6);};}exports[_0xed0a('0x20')]=function(_0x3b0260,_0x214b08){var _0x5bb2c9={};var _0xf21bef=_[_0xed0a('0x21')](db[_0xed0a('0x22')][_0xed0a('0x23')],function(_0x1f84cf){return{'name':_0x1f84cf[_0xed0a('0x24')],'type':_0x1f84cf[_0xed0a('0x25')][_0xed0a('0x26')]};});_0x5bb2c9=qs[_0xed0a('0x27')](_0xf21bef,_0x3b0260);return interaction[_0xed0a('0x28')](_0xed0a('0x29'),_0x3b0260['query'],_0x3b0260[_0xed0a('0x2a')],_0x5bb2c9,_0xf21bef)[_0xed0a('0x1c')](respondWithFilteredResult(_0x214b08,_0x5bb2c9))[_0xed0a('0x2b')](handleError(_0x214b08,null));};exports[_0xed0a('0x2c')]=function(_0x4aff85,_0x233a6f){var _0x179cf9={'raw':![],'where':{'id':_0x4aff85[_0xed0a('0x2d')]['id']}},_0x24cf27={};_0x24cf27[_0xed0a('0x2e')]=_['keys'](db[_0xed0a('0x22')]['rawAttributes']);_0x24cf27[_0xed0a('0x2f')]=_[_0xed0a('0x30')](_0x4aff85['query']);_0x24cf27[_0xed0a('0x31')]=_[_0xed0a('0x32')](_0x24cf27[_0xed0a('0x2e')],_0x24cf27['query']);_0x179cf9['attributes']=_[_0xed0a('0x32')](_0x24cf27[_0xed0a('0x2e')],qs['fields'](_0x4aff85[_0xed0a('0x2f')][_0xed0a('0x33')]));_0x179cf9['attributes']=_0x179cf9[_0xed0a('0x34')][_0xed0a('0x35')]?_0x179cf9[_0xed0a('0x34')]:_0x24cf27[_0xed0a('0x2e')];if(_0x4aff85[_0xed0a('0x2f')][_0xed0a('0x36')]){_0x179cf9[_0xed0a('0x37')]=[{'all':!![]}];}_0x179cf9=_[_0xed0a('0x38')]({},_0x179cf9,_0x4aff85['options']);return db[_0xed0a('0x22')]['find'](_0x179cf9)[_0xed0a('0x1c')](handleEntityNotFound(_0x233a6f,null))[_0xed0a('0x1c')](respondWithResult(_0x233a6f,null))['catch'](handleError(_0x233a6f,null));};exports[_0xed0a('0x39')]=function(_0x5a4765,_0x45567b){return db[_0xed0a('0x22')][_0xed0a('0x39')](_0x5a4765[_0xed0a('0x3a')],{})[_0xed0a('0x1c')](respondWithResult(_0x45567b,0xc9))[_0xed0a('0x2b')](handleError(_0x45567b,null));};exports[_0xed0a('0x1b')]=function(_0x46eeff,_0x1e9115){if(_0x46eeff[_0xed0a('0x3a')]['id']){delete _0x46eeff['body']['id'];}return db[_0xed0a('0x22')][_0xed0a('0x3b')]({'where':{'id':_0x46eeff[_0xed0a('0x2d')]['id']}})[_0xed0a('0x1c')](handleEntityNotFound(_0x1e9115,null))[_0xed0a('0x1c')](saveUpdates(_0x46eeff[_0xed0a('0x3a')],null))[_0xed0a('0x1c')](respondWithResult(_0x1e9115,null))[_0xed0a('0x2b')](handleError(_0x1e9115,null));};exports[_0xed0a('0x1d')]=function(_0x2ccdc1,_0x210996){return db[_0xed0a('0x22')][_0xed0a('0x3b')]({'where':{'id':_0x2ccdc1[_0xed0a('0x2d')]['id']}})[_0xed0a('0x1c')](handleEntityNotFound(_0x210996,null))[_0xed0a('0x1c')](removeEntity(_0x210996,null))['catch'](handleError(_0x210996,null));};exports[_0xed0a('0x3c')]=function(_0x49fa17,_0x3c27a7){return db[_0xed0a('0x22')][_0xed0a('0x3c')]()[_0xed0a('0x1c')](respondWithResult(_0x3c27a7,null))[_0xed0a('0x2b')](handleError(_0x3c27a7,null));};exports[_0xed0a('0x3d')]=function(_0x1836dd,_0x4598bc){return db[_0xed0a('0x3e')][_0xed0a('0x3b')]({'where':{'id':_0x1836dd['params']['id']}})[_0xed0a('0x1c')](handleEntityNotFound(_0x4598bc,null))[_0xed0a('0x1c')](function(_0x179756){if(_0x179756){return _0x179756[_0xed0a('0x3d')](_0x1836dd[_0xed0a('0x3a')][_0xed0a('0x3f')],_[_0xed0a('0x40')](_0x1836dd[_0xed0a('0x3a')],[_0xed0a('0x3f'),'id'])||{});}})[_0xed0a('0x1c')](respondWithResult(_0x4598bc,null))[_0xed0a('0x2b')](handleError(_0x4598bc,null));};exports[_0xed0a('0x41')]=function(_0x5eb0ea,_0x2f8bff){var _0x37866e={'raw':![],'where':{}};var _0x4918b9={};var _0x593734={'count':0x0,'rows':[]};return db[_0xed0a('0x22')]['findOne']({'where':{'id':_0x5eb0ea['params']['id']}})[_0xed0a('0x1c')](handleEntityNotFound(_0x2f8bff,null))[_0xed0a('0x1c')](function(_0x2055c9){if(_0x2055c9){_0x4918b9[_0xed0a('0x2e')]=_[_0xed0a('0x30')](db[_0xed0a('0x3e')]['rawAttributes']);_0x4918b9[_0xed0a('0x2f')]=_[_0xed0a('0x30')](_0x5eb0ea[_0xed0a('0x2f')]);_0x4918b9[_0xed0a('0x31')]=_[_0xed0a('0x32')](_0x4918b9[_0xed0a('0x2e')],_0x4918b9[_0xed0a('0x2f')]);_0x37866e[_0xed0a('0x34')]=_[_0xed0a('0x32')](_0x4918b9[_0xed0a('0x2e')],qs[_0xed0a('0x33')](_0x5eb0ea['query']['fields']));_0x37866e[_0xed0a('0x34')]=_0x37866e['attributes']['length']?_0x37866e[_0xed0a('0x34')]:_0x4918b9[_0xed0a('0x2e')];if(!_0x5eb0ea[_0xed0a('0x2f')][_0xed0a('0x42')]('nolimit')){_0x37866e['limit']=qs['limit'](_0x5eb0ea[_0xed0a('0x2f')][_0xed0a('0x18')]);_0x37866e[_0xed0a('0x16')]=qs[_0xed0a('0x16')](_0x5eb0ea[_0xed0a('0x2f')][_0xed0a('0x16')]);}_0x37866e[_0xed0a('0x43')]=qs['sort'](_0x5eb0ea['query'][_0xed0a('0x44')]);_0x37866e[_0xed0a('0x45')]=qs[_0xed0a('0x31')](_['pick'](_0x5eb0ea[_0xed0a('0x2f')],_0x4918b9[_0xed0a('0x31')]));_0x37866e[_0xed0a('0x45')][_0xed0a('0x46')]=_0x2055c9['id'];if(_0x5eb0ea['query'][_0xed0a('0x47')]){_0x37866e[_0xed0a('0x45')]=_[_0xed0a('0x38')](_0x37866e[_0xed0a('0x45')],{'$or':_[_0xed0a('0x21')](_0x37866e['attributes'],function(_0x395910){var _0x544276={};_0x544276[_0x395910]={'$like':'%'+_0x5eb0ea[_0xed0a('0x2f')][_0xed0a('0x47')]+'%'};return _0x544276;})});}if(_0x5eb0ea['query'][_0xed0a('0x48')]){var _0x2dc0f5=_0x5eb0ea[_0xed0a('0x2f')][_0xed0a('0x48')][_0xed0a('0x49')](',');var _0x4092d5={};_0x4092d5[_0x2dc0f5[0x0]]={'$gte':moment(_0x2dc0f5[0x1])[_0xed0a('0x4a')](_0xed0a('0x4b'))};_0x37866e[_0xed0a('0x45')]=_['merge'](_0x37866e['where'],_0x4092d5);}_0x37866e=_['merge']({},_0x37866e,_0x5eb0ea[_0xed0a('0x4c')]);return db[_0xed0a('0x3e')][_0xed0a('0x19')]({'where':_0x37866e['where']})[_0xed0a('0x1c')](function(_0x23e237){_0x593734[_0xed0a('0x19')]=_0x23e237;if(_0x5eb0ea[_0xed0a('0x2f')][_0xed0a('0x36')]){_0x37866e['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x37866e);})['then'](function(_0x301e5e){_0x593734[_0xed0a('0x4d')]=_0x301e5e;return _0x593734;});}})[_0xed0a('0x1c')](respondWithFilteredResult(_0x2f8bff,_0x37866e))[_0xed0a('0x2b')](handleError(_0x2f8bff,null));};exports['addTags']=function(_0x29d78f,_0x4dd9f8){return db['SmsInteraction'][_0xed0a('0x3b')]({'where':{'id':_0x29d78f['params']['id']}})[_0xed0a('0x1c')](handleEntityNotFound(_0x4dd9f8,null))[_0xed0a('0x1c')](function(_0x56c186){if(_0x56c186){return _0x56c186[_0xed0a('0x4e')](_0x29d78f['body']['ids'],_[_0xed0a('0x40')](_0x29d78f[_0xed0a('0x3a')],['ids','id'])||{})[_0xed0a('0x4f')](function(){return db[_0xed0a('0x50')][_0xed0a('0x28')]({'attributes':['id',_0xed0a('0x1f'),_0xed0a('0x51')],'where':{'id':_0x29d78f[_0xed0a('0x3a')][_0xed0a('0x3f')]}});})['then'](function(_0x2e74c6){socket[_0xed0a('0x52')](_0xed0a('0x53'),{'id':Number(_0x29d78f[_0xed0a('0x2d')]['id']),'tags':_0x2e74c6||[]});return{'id':Number(_0x29d78f[_0xed0a('0x2d')]['id']),'tags':_0x2e74c6||[]};});}})[_0xed0a('0x1c')](respondWithResult(_0x4dd9f8,null))['catch'](handleError(_0x4dd9f8,null));};exports[_0xed0a('0x54')]=function(_0xafd08c,_0x35bc8a){return db[_0xed0a('0x22')][_0xed0a('0x3b')]({'where':{'id':_0xafd08c['params']['id']}})[_0xed0a('0x1c')](handleEntityNotFound(_0x35bc8a,null))[_0xed0a('0x1c')](function(_0x15dbcd){if(_0x15dbcd){return _0x15dbcd[_0xed0a('0x54')](_0xafd08c['query'][_0xed0a('0x3f')]);}})[_0xed0a('0x1c')](respondWithStatusCode(_0x35bc8a,null))[_0xed0a('0x2b')](handleError(_0x35bc8a,null));};exports[_0xed0a('0x55')]=function(_0x2648f7,_0x92ea99){var _0x1bb831=moment()['unix']()[_0xed0a('0x56')]();var _0x124725=path['join'](config['root'],_0xed0a('0x57'),'files',_0xed0a('0x58'));var _0x651c8c=path[_0xed0a('0x59')](_0x124725,_0x1bb831);var _0x18b1d7=util[_0xed0a('0x4a')](_0xed0a('0x5a'),_0x2648f7[_0xed0a('0x2d')]['id'],_0x1bb831);var _0x3abc13=path[_0xed0a('0x59')](_0x124725,_0x18b1d7);var _0x18eff1=[];_0x18eff1[_0xed0a('0x5b')]({'model':db[_0xed0a('0x5c')],'as':_0xed0a('0x5c'),'attributes':['id',_0xed0a('0x5d')],'raw':!![]});_0x18eff1[_0xed0a('0x5b')]({'model':db[_0xed0a('0x5e')],'as':_0xed0a('0x5f'),'attributes':['id',_0xed0a('0x60'),_0xed0a('0x61')],'raw':!![]});var _0x4dea52=[{'model':db[_0xed0a('0x3e')],'as':_0xed0a('0x62'),'attributes':['id',_0xed0a('0x3a'),'createdAt',_0xed0a('0x63'),'secret',_0xed0a('0x64')],'include':_0x18eff1}];_0x4dea52[_0xed0a('0x5b')]({'model':db[_0xed0a('0x65')],'as':_0xed0a('0x66'),'attributes':['id',_0xed0a('0x1f')]});_0x4dea52[_0xed0a('0x5b')]({'model':db[_0xed0a('0x5c')],'as':'Owner','attributes':['id','fullname']});return db[_0xed0a('0x22')]['find']({'where':{'id':_0x2648f7[_0xed0a('0x2d')]['id']},'include':_0x4dea52})[_0xed0a('0x1c')](handleEntityNotFound(_0x92ea99,null))[_0xed0a('0x1c')](function(_0x1a3b0d){if(_0x1a3b0d){var _0x25bd97=_0x1a3b0d['get']({'plain':!![]});fs['mkdirSync'](_0x651c8c);var _0x50b9a6={'channel':_0xed0a('0x67'),'account':_0x25bd97[_0xed0a('0x66')]['name'],'agent':_0x25bd97[_0xed0a('0x68')]?_0x25bd97[_0xed0a('0x68')]['fullname']:_0xed0a('0x69'),'createdAt':moment(_0x25bd97[_0xed0a('0x6a')])[_0xed0a('0x4a')](_0xed0a('0x4b'))['toString'](),'closedAt':_0x25bd97[_0xed0a('0x6b')]?moment(_0x25bd97[_0xed0a('0x6c')])[_0xed0a('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xed0a('0x56')]():'','disposition':_0x25bd97[_0xed0a('0x6d')],'messages':_(_0x25bd97['Messages'])['filter']({'secret':![]})['map'](function(_0xe0711d){return{'date':moment(_0xe0711d[_0xed0a('0x6a')])[_0xed0a('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xed0a('0x56')](),'sender':_0xe0711d['direction']==='out'?_0xe0711d[_0xed0a('0x5c')]?_0xe0711d[_0xed0a('0x5c')][_0xed0a('0x5d')]:_0xed0a('0x6e'):_0xe0711d['Contact'][_0xed0a('0x60')]+(_0xe0711d[_0xed0a('0x5f')][_0xed0a('0x61')]?'\x20'+_0xe0711d[_0xed0a('0x5f')][_0xed0a('0x61')]:''),'body':_0xe0711d[_0xed0a('0x3a')],'direction':_0xe0711d[_0xed0a('0x63')]===_0xed0a('0x6f')?'A':'C','secret':_0xe0711d['secret'],'read':_0xe0711d[_0xed0a('0x64')]};})[_0xed0a('0x70')]()};return ejs[_0xed0a('0x71')](path['join'](config[_0xed0a('0x72')],_0xed0a('0x57'),_0xed0a('0x73'),_0xed0a('0x74')),{'interaction':_0x50b9a6})[_0xed0a('0x1c')](function(_0x4e3f58){var _0x1f6a4b=path[_0xed0a('0x59')](_0x651c8c,'transcript-'+_0x25bd97['id']+'-'+_0x1bb831+_0xed0a('0x75'));var _0x392ed2={'path':_0x1f6a4b,'channel':'Sms','interactionId':_0x25bd97['id']};return pdf[_0xed0a('0x76')](_0x4e3f58,_0x392ed2);})[_0xed0a('0x1c')](function(){return new BPromise(function(_0x1016bd,_0x9c43de){zipdir(_0x651c8c,{'saveTo':_0x3abc13},function(_0x4c79b7,_0x3d74e2){if(_0x4c79b7)return _0x9c43de(_0x4c79b7);return _0x1016bd(_0x3d74e2);});})[_0xed0a('0x1c')](function(){return new BPromise(function(_0xa4431b,_0x5c3c1d){rimraf(_0x651c8c,function(_0x216020){if(_0x216020)_0x5c3c1d(_0x216020);return _0xa4431b();});});})['then'](function(){return _0x92ea99[_0xed0a('0x55')](_0x3abc13,_0x18b1d7,function(_0x1f9825){if(_0x1f9825){console[_0xed0a('0x77')](_0xed0a('0x78'),_0x1f9825);}else{fs['unlinkSync'](_0x3abc13);}});});});}else{return _0x92ea99['sendStatus'](0xc8);}})[_0xed0a('0x2b')](handleError(_0x92ea99,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 477d05d..7a56483 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 _0x5464=['SmsMessage','save','remove','setDataValue','Users','map','findAll','then','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction'];(function(_0x341b9f,_0x3e2e42){var _0x3edf48=function(_0x490591){while(--_0x490591){_0x341b9f['push'](_0x341b9f['shift']());}};_0x3edf48(++_0x3e2e42);}(_0x5464,0x15d));var _0x4546=function(_0xa08ad6,_0xd503c6){_0xa08ad6=_0xa08ad6-0x0;var _0x240e2f=_0x5464[_0xa08ad6];return _0x240e2f;};'use strict';var EventEmitter=require(_0x4546('0x0'));var SmsInteraction=require(_0x4546('0x1'))['db'][_0x4546('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x4546('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4546('0x4'),'afterUpdate':'update','afterDestroy':_0x4546('0x5')};function emitEvent(_0x396a1d){return function(_0xcc9def,_0x2b1a9b,_0x54228a){_0xcc9def['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x224c7c){_0xcc9def[_0x4546('0x6')](_0x4546('0x7'),_0x224c7c[_0x4546('0x8')](function(_0x2f0376){return{'id':_0x2f0376['id']};}));return SmsMessage[_0x4546('0x9')]({'where':{'SmsInteractionId':_0xcc9def['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4546('0xa')](function(_0x430b2e){_0xcc9def[_0x4546('0x6')]('unreadMessages',_0x430b2e[_0x4546('0xb')]);SmsInteractionEvents[_0x4546('0xc')](_0x396a1d+':'+_0xcc9def['id'],_0xcc9def);SmsInteractionEvents[_0x4546('0xc')](_0x396a1d,_0xcc9def);_0x54228a(null);})['catch'](_0x54228a(null));};}for(var e in events){if(events[_0x4546('0xd')](e)){var event=events[e];SmsInteraction[_0x4546('0xe')](e,emitEvent(event));}}module[_0x4546('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x5f66=['update','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x31ec29,_0x58915c){var _0x3275fc=function(_0x435075){while(--_0x435075){_0x31ec29['push'](_0x31ec29['shift']());}};_0x3275fc(++_0x58915c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x65f6('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x65f6('0x0'))['db'][_0x65f6('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x65f6('0x2')](0x0);var events={'afterCreate':_0x65f6('0x3'),'afterUpdate':_0x65f6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c5029){return function(_0x5150c8,_0x1c9f5b,_0x22b017){_0x5150c8['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c0e12){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x6'),_0x1c0e12[_0x65f6('0x7')](function(_0xc44c70){return{'id':_0xc44c70['id']};}));return SmsMessage[_0x65f6('0x8')]({'where':{'SmsInteractionId':_0x5150c8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5123ee){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x9'),_0x5123ee[_0x65f6('0xa')]);SmsInteractionEvents[_0x65f6('0xb')](_0x3c5029+':'+_0x5150c8['id'],_0x5150c8);SmsInteractionEvents['emit'](_0x3c5029,_0x5150c8);_0x22b017(null);})[_0x65f6('0xc')](_0x22b017(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x65f6('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 80edb13..4a549b3 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 _0x8228=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8228,0x127));var _0x8822=function(_0x3f5fae,_0x185b5a){_0x3f5fae=_0x3f5fae-0x0;var _0x195ba3=_0x8228[_0x3f5fae];return _0x195ba3;};'use strict';var _=require(_0x8822('0x0'));var util=require('util');var logger=require(_0x8822('0x1'))(_0x8822('0x2'));var moment=require(_0x8822('0x3'));var BPromise=require(_0x8822('0x4'));var rp=require(_0x8822('0x5'));var fs=require('fs');var path=require(_0x8822('0x6'));var rimraf=require(_0x8822('0x7'));var config=require(_0x8822('0x8'));var attributes=require(_0x8822('0x9'));module[_0x8822('0xa')]=function(_0x4e7598,_0x339bbf){return _0x4e7598[_0x8822('0xb')](_0x8822('0xc'),attributes,{'tableName':_0x8822('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b0e37,_0x4dbdbc,_0x14d3ae){if(_0x3b0e37[_0x8822('0xe')](_0x8822('0xf'))){_0x3b0e37[_0x8822('0x10')]=moment()[_0x8822('0x11')](_0x8822('0x12'));}_0x14d3ae(null,_0x3b0e37);}}});}; \ No newline at end of file +var _0x2f68=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2e7944,_0x302974){var _0x26281e=function(_0x598495){while(--_0x598495){_0x2e7944['push'](_0x2e7944['shift']());}};_0x26281e(++_0x302974);}(_0x2f68,0xb0));var _0x82f6=function(_0x438c33,_0x4b4558){_0x438c33=_0x438c33-0x0;var _0x164ce2=_0x2f68[_0x438c33];return _0x164ce2;};'use strict';var _=require(_0x82f6('0x0'));var util=require(_0x82f6('0x1'));var logger=require(_0x82f6('0x2'))(_0x82f6('0x3'));var moment=require(_0x82f6('0x4'));var BPromise=require(_0x82f6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x82f6('0x6'));var attributes=require(_0x82f6('0x7'));module[_0x82f6('0x8')]=function(_0x51aa46,_0x2672ba){return _0x51aa46[_0x82f6('0x9')](_0x82f6('0xa'),attributes,{'tableName':_0x82f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xfbdbaa,_0x112abe,_0x49849f){if(_0xfbdbaa['changed'](_0x82f6('0xc'))){_0xfbdbaa['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x49849f(null,_0xfbdbaa);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0f899cd..06a21e0 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 _0x6507=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','update','body','options','raw','where','UpdateSmsInteraction','SmsInteraction','omit','ids','spread','AddTags','stringify','util'];(function(_0x3a51d1,_0x148afb){var _0x3c16cf=function(_0x1020c4){while(--_0x1020c4){_0x3a51d1['push'](_0x3a51d1['shift']());}};_0x3c16cf(++_0x148afb);}(_0x6507,0x1bb));var _0x7650=function(_0x3b4359,_0x2a9330){_0x3b4359=_0x3b4359-0x0;var _0x1c16fd=_0x6507[_0x3b4359];return _0x1c16fd;};'use strict';var _=require('lodash');var util=require(_0x7650('0x0'));var moment=require(_0x7650('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7650('0x2'));var db=require(_0x7650('0x3'))['db'];var utils=require(_0x7650('0x4'));var logger=require(_0x7650('0x5'))(_0x7650('0x6'));var config=require('../../config/environment');var jayson=require(_0x7650('0x7'));var client=jayson[_0x7650('0x8')]['http']({'port':0x232a});config[_0x7650('0x9')]=_[_0x7650('0xa')](config[_0x7650('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7650('0xb'))(new Redis(config[_0x7650('0x9')]));require('./smsInteraction.socket')[_0x7650('0xc')](socket);function respondWithRpcPromise(_0x3d78cc,_0x339468,_0x34219b){return new BPromise(function(_0x1e35c9,_0x19fbe3){return client[_0x7650('0xd')](_0x3d78cc,_0x34219b)[_0x7650('0xe')](function(_0x42bce3){logger[_0x7650('0xf')](_0x7650('0x10'),_0x339468,'request\x20sent');logger[_0x7650('0x11')](_0x7650('0x12'),_0x339468,_0x7650('0x13'),JSON['stringify'](_0x42bce3));if(_0x42bce3[_0x7650('0x14')]){if(_0x42bce3[_0x7650('0x14')][_0x7650('0x15')]===0x1f4){logger[_0x7650('0x14')](_0x7650('0x10'),_0x339468,_0x42bce3[_0x7650('0x14')][_0x7650('0x16')]);return _0x19fbe3(_0x42bce3[_0x7650('0x14')][_0x7650('0x16')]);}logger[_0x7650('0x14')](_0x7650('0x10'),_0x339468,_0x42bce3[_0x7650('0x14')][_0x7650('0x16')]);return _0x1e35c9(_0x42bce3[_0x7650('0x14')][_0x7650('0x16')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x339468,_0x7650('0x13'));_0x1e35c9(_0x42bce3[_0x7650('0x17')][_0x7650('0x16')]);}})[_0x7650('0x18')](function(_0x27fb73){logger[_0x7650('0x14')](_0x7650('0x10'),_0x339468,_0x27fb73);_0x19fbe3(_0x27fb73);});});}exports['UpdateSmsInteraction']=function(_0x3455a4){var _0x2e1d0a=this;return new Promise(function(_0x79d9be,_0x138c57){return db['SmsInteraction'][_0x7650('0x19')](_0x3455a4[_0x7650('0x1a')],{'raw':_0x3455a4['options']?_0x3455a4[_0x7650('0x1b')][_0x7650('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3455a4['options']?_0x3455a4[_0x7650('0x1b')][_0x7650('0x1d')]||null:null,'attributes':_0x3455a4[_0x7650('0x1b')]?_0x3455a4[_0x7650('0x1b')]['attributes']||null:null,'limit':_0x3455a4['options']?_0x3455a4[_0x7650('0x1b')]['limit']||null:null})[_0x7650('0xe')](function(_0x413da5){logger[_0x7650('0xf')](_0x7650('0x1e'),_0x3455a4);logger[_0x7650('0x11')]('UpdateSmsInteraction',_0x3455a4,JSON['stringify'](_0x413da5));_0x79d9be(_0x413da5);})[_0x7650('0x18')](function(_0x52ffa3){logger['error']('UpdateSmsInteraction',_0x52ffa3['message'],_0x3455a4);_0x138c57(_0x2e1d0a[_0x7650('0x14')](0x1f4,_0x52ffa3['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x4f8a56){return new Promise(function(_0xee500c,_0xcbfce5){return db[_0x7650('0x1f')]['find']({'where':_0x4f8a56[_0x7650('0x1b')]?_0x4f8a56['options'][_0x7650('0x1d')]||null:null})[_0x7650('0xe')](function(_0x38dc4d){if(_0x38dc4d){return _0x38dc4d['addTags'](_0x4f8a56[_0x7650('0x1a')]['ids'],_[_0x7650('0x20')](_0x4f8a56[_0x7650('0x1a')],[_0x7650('0x21'),'id'])||{});}})[_0x7650('0x22')](function(_0x1265c8){logger[_0x7650('0xf')](_0x7650('0x23'),_0x4f8a56);logger[_0x7650('0x11')](_0x7650('0x23'),_0x4f8a56,JSON[_0x7650('0x24')](_0x1265c8));_0xee500c(_0x1265c8);})[_0x7650('0x18')](function(_0x55d989){logger[_0x7650('0x14')]('AddTags',_0x55d989['message'],_0x4f8a56);_0xcbfce5(_this[_0x7650('0x14')](0x1f4,_0x55d989[_0x7650('0x16')]));});});}; \ No newline at end of file +var _0x8564=['localhost','socket.io-emitter','redis','request','then','info','request\x20sent','debug','stringify','code','error','SmsInteraction,\x20%s,\x20%s','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','limit','find','addTags','ids','omit','spread','AddTags','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0x478401,_0x3442ea){var _0xe5dec5=function(_0x20d61c){while(--_0x20d61c){_0x478401['push'](_0x478401['shift']());}};_0xe5dec5(++_0x3442ea);}(_0x8564,0x1be));var _0x4856=function(_0x4bd40c,_0x3d84be){_0x4bd40c=_0x4bd40c-0x0;var _0x8afd60=_0x8564[_0x4bd40c];return _0x8afd60;};'use strict';var _=require('lodash');var util=require(_0x4856('0x0'));var moment=require('moment');var BPromise=require(_0x4856('0x1'));var rs=require(_0x4856('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4856('0x3'));var logger=require(_0x4856('0x4'))(_0x4856('0x5'));var config=require(_0x4856('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4856('0x7')][_0x4856('0x8')]({'port':0x232a});config['redis']=_[_0x4856('0x9')](config['redis'],{'host':_0x4856('0xa'),'port':0x18eb});var socket=require(_0x4856('0xb'))(new Redis(config[_0x4856('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5dcb39,_0x5ceecb,_0x2664e1){return new BPromise(function(_0x439480,_0x5e92cb){return client[_0x4856('0xd')](_0x5dcb39,_0x2664e1)[_0x4856('0xe')](function(_0x3b1b09){logger[_0x4856('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x5ceecb,_0x4856('0x10'));logger[_0x4856('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x5ceecb,_0x4856('0x10'),JSON[_0x4856('0x12')](_0x3b1b09));if(_0x3b1b09['error']){if(_0x3b1b09['error'][_0x4856('0x13')]===0x1f4){logger[_0x4856('0x14')](_0x4856('0x15'),_0x5ceecb,_0x3b1b09['error'][_0x4856('0x16')]);return _0x5e92cb(_0x3b1b09['error']['message']);}logger[_0x4856('0x14')](_0x4856('0x15'),_0x5ceecb,_0x3b1b09[_0x4856('0x14')][_0x4856('0x16')]);return _0x439480(_0x3b1b09[_0x4856('0x14')][_0x4856('0x16')]);}else{logger['info'](_0x4856('0x15'),_0x5ceecb,_0x4856('0x10'));_0x439480(_0x3b1b09[_0x4856('0x17')][_0x4856('0x16')]);}})['catch'](function(_0x2196ed){logger[_0x4856('0x14')](_0x4856('0x15'),_0x5ceecb,_0x2196ed);_0x5e92cb(_0x2196ed);});});}exports[_0x4856('0x18')]=function(_0x17953f){var _0x167ed0=this;return new Promise(function(_0x4caca7,_0x557242){return db[_0x4856('0x19')][_0x4856('0x1a')](_0x17953f[_0x4856('0x1b')],{'raw':_0x17953f[_0x4856('0x1c')]?_0x17953f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17953f[_0x4856('0x1c')]?_0x17953f['options'][_0x4856('0x1d')]||null:null,'attributes':_0x17953f[_0x4856('0x1c')]?_0x17953f[_0x4856('0x1c')]['attributes']||null:null,'limit':_0x17953f['options']?_0x17953f[_0x4856('0x1c')][_0x4856('0x1e')]||null:null})[_0x4856('0xe')](function(_0x367ae7){logger[_0x4856('0xf')](_0x4856('0x18'),_0x17953f);logger[_0x4856('0x11')]('UpdateSmsInteraction',_0x17953f,JSON['stringify'](_0x367ae7));_0x4caca7(_0x367ae7);})['catch'](function(_0x5a2ba1){logger[_0x4856('0x14')]('UpdateSmsInteraction',_0x5a2ba1['message'],_0x17953f);_0x557242(_0x167ed0['error'](0x1f4,_0x5a2ba1[_0x4856('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x561337){return new Promise(function(_0x4eabe3,_0x175123){return db[_0x4856('0x19')][_0x4856('0x1f')]({'where':_0x561337[_0x4856('0x1c')]?_0x561337[_0x4856('0x1c')][_0x4856('0x1d')]||null:null})[_0x4856('0xe')](function(_0x17779c){if(_0x17779c){return _0x17779c[_0x4856('0x20')](_0x561337[_0x4856('0x1b')][_0x4856('0x21')],_[_0x4856('0x22')](_0x561337['body'],['ids','id'])||{});}})[_0x4856('0x23')](function(_0x168493){logger[_0x4856('0xf')](_0x4856('0x24'),_0x561337);logger['debug'](_0x4856('0x24'),_0x561337,JSON[_0x4856('0x12')](_0x168493));_0x4eabe3(_0x168493);})[_0x4856('0x25')](function(_0x33cc3a){logger[_0x4856('0x14')](_0x4856('0x24'),_0x33cc3a[_0x4856('0x16')],_0x561337);_0x175123(_this[_0x4856('0x14')](0x1f4,_0x33cc3a[_0x4856('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index bb3cf87..5993a2d 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 _0x35ba=['update','emit','removeListener','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x33d366,_0x12d5a2){var _0x501c15=function(_0x19fc7e){while(--_0x19fc7e){_0x33d366['push'](_0x33d366['shift']());}};_0x501c15(++_0x12d5a2);}(_0x35ba,0x1a5));var _0xa35b=function(_0x5f2098,_0x47308b){_0x5f2098=_0x5f2098-0x0;var _0x18af32=_0x35ba[_0x5f2098];return _0x18af32;};'use strict';var SmsInteractionEvents=require(_0xa35b('0x0'));var events=[_0xa35b('0x1'),_0xa35b('0x2'),_0xa35b('0x3')];function createListener(_0xb248a6,_0x338b99){return function(_0x2f20b4){_0x338b99[_0xa35b('0x4')](_0xb248a6,_0x2f20b4);};}function removeListener(_0x14f9f0,_0x349269){return function(){SmsInteractionEvents[_0xa35b('0x5')](_0x14f9f0,_0x349269);};}exports['register']=function(_0x1d4427){for(var _0x2fc4e6=0x0,_0x1da39b=events[_0xa35b('0x6')];_0x2fc4e6<_0x1da39b;_0x2fc4e6++){var _0x5c54b3=events[_0x2fc4e6];var _0x7da553=createListener(_0xa35b('0x7')+_0x5c54b3,_0x1d4427);SmsInteractionEvents['on'](_0x5c54b3,_0x7da553);}}; \ No newline at end of file +var _0x44ea=['./smsInteraction.events','save','remove','emit','register','length','smsInteraction:'];(function(_0x331da3,_0x128b92){var _0x4b4a37=function(_0x56cf74){while(--_0x56cf74){_0x331da3['push'](_0x331da3['shift']());}};_0x4b4a37(++_0x128b92);}(_0x44ea,0x9a));var _0xa44e=function(_0x544e20,_0x2c441d){_0x544e20=_0x544e20-0x0;var _0x490720=_0x44ea[_0x544e20];return _0x490720;};'use strict';var SmsInteractionEvents=require(_0xa44e('0x0'));var events=[_0xa44e('0x1'),_0xa44e('0x2'),'update'];function createListener(_0x264cb4,_0x4b48b6){return function(_0x18c832){_0x4b48b6[_0xa44e('0x3')](_0x264cb4,_0x18c832);};}function removeListener(_0x2e1679,_0x60d07){return function(){SmsInteractionEvents['removeListener'](_0x2e1679,_0x60d07);};}exports[_0xa44e('0x4')]=function(_0x57d869){for(var _0x5db830=0x0,_0x4eeaae=events[_0xa44e('0x5')];_0x5db830<_0x4eeaae;_0x5db830++){var _0x40d0a9=events[_0x5db830];var _0x173c1a=createListener(_0xa44e('0x6')+_0x40d0a9,_0x57d869);SmsInteractionEvents['on'](_0x40d0a9,_0x173c1a);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index e21788a..969c36c 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 _0x8357=['index','describe','/:id','isAuthenticated','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2bb3f6,_0x25fde0){var _0x62b339=function(_0x53e014){while(--_0x53e014){_0x2bb3f6['push'](_0x2bb3f6['shift']());}};_0x62b339(++_0x25fde0);}(_0x8357,0x1e4));var _0x7835=function(_0x55dc46,_0x164e64){_0x55dc46=_0x55dc46-0x0;var _0x286fc7=_0x8357[_0x55dc46];return _0x286fc7;};'use strict';var multer=require(_0x7835('0x0'));var util=require(_0x7835('0x1'));var path=require(_0x7835('0x2'));var timeout=require('connect-timeout');var express=require(_0x7835('0x3'));var router=express[_0x7835('0x4')]();var fs_extra=require(_0x7835('0x5'));var auth=require(_0x7835('0x6'));var interaction=require(_0x7835('0x7'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x7835('0x8')]('/',auth['isAuthenticated'](),controller[_0x7835('0x9')]);router[_0x7835('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7835('0xa')]);router['get'](_0x7835('0xb'),auth[_0x7835('0xc')](),controller[_0x7835('0xd')]);router[_0x7835('0xe')]('/',auth['isAuthenticated'](),interaction[_0x7835('0xf')](_0x7835('0x10'),_0x7835('0x11')),controller[_0x7835('0x12')]);router[_0x7835('0xe')](_0x7835('0x13'),controller[_0x7835('0x14')]);router['put'](_0x7835('0xb'),auth[_0x7835('0xc')](),controller[_0x7835('0x15')]);router[_0x7835('0x16')](_0x7835('0x17'),auth[_0x7835('0xc')](),controller[_0x7835('0x18')]);router[_0x7835('0x16')](_0x7835('0x19'),auth[_0x7835('0xc')](),controller[_0x7835('0x1a')]);router[_0x7835('0x1b')](_0x7835('0xb'),auth[_0x7835('0xc')](),controller['destroy']);module[_0x7835('0x1c')]=router; \ No newline at end of file +var _0x5732=['reject','delete','/:id','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','describe','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5732,0xdc));var _0x2573=function(_0x3ea1c6,_0x5822d0){_0x3ea1c6=_0x3ea1c6-0x0;var _0x11760d=_0x5732[_0x3ea1c6];return _0x11760d;};'use strict';var multer=require('multer');var util=require(_0x2573('0x0'));var path=require(_0x2573('0x1'));var timeout=require(_0x2573('0x2'));var express=require('express');var router=express[_0x2573('0x3')]();var fs_extra=require(_0x2573('0x4'));var auth=require(_0x2573('0x5'));var interaction=require(_0x2573('0x6'));var config=require(_0x2573('0x7'));var controller=require(_0x2573('0x8'));router[_0x2573('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2573('0xa'),auth[_0x2573('0xb')](),controller[_0x2573('0xc')]);router['get']('/:id',auth[_0x2573('0xb')](),controller['show']);router[_0x2573('0xd')]('/',auth[_0x2573('0xb')](),interaction[_0x2573('0xe')](_0x2573('0xf'),_0x2573('0x10')),controller[_0x2573('0x11')]);router[_0x2573('0xd')](_0x2573('0x12'),controller[_0x2573('0x13')]);router[_0x2573('0x14')]('/:id',auth[_0x2573('0xb')](),controller['update']);router[_0x2573('0x14')](_0x2573('0x15'),auth['isAuthenticated'](),controller[_0x2573('0x16')]);router[_0x2573('0x14')]('/:id/reject',auth[_0x2573('0xb')](),controller[_0x2573('0x17')]);router[_0x2573('0x18')](_0x2573('0x19'),auth['isAuthenticated'](),controller['destroy']);module[_0x2573('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f212bff..7738586 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 _0xd134=['ENUM','out','STRING','DATE','BOOLEAN','TEXT','sequelize','exports','medium'];(function(_0x11061c,_0x1fc7cf){var _0x42e965=function(_0x31caf9){while(--_0x31caf9){_0x11061c['push'](_0x11061c['shift']());}};_0x42e965(++_0x1fc7cf);}(_0xd134,0x1b6));var _0x4d13=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xd134[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0x4d13('0x0'));module[_0x4d13('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4d13('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d13('0x3')]('in',_0x4d13('0x4')),'defaultValue':_0x4d13('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4d13('0x5')](0xbe)},'phone':{'type':Sequelize[_0x4d13('0x5')]},'readAt':{'type':Sequelize[_0x4d13('0x6')]},'secret':{'type':Sequelize[_0x4d13('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4d13('0x8')]}}; \ No newline at end of file +var _0x2ce9=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x715026,_0x53f81c){var _0xed2dea=function(_0x45380f){while(--_0x45380f){_0x715026['push'](_0x715026['shift']());}};_0xed2dea(++_0x53f81c);}(_0x2ce9,0x86));var _0x92ce=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2ce9[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x92ce('0x0'));module[_0x92ce('0x1')]={'body':{'type':Sequelize[_0x92ce('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x92ce('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x92ce('0x4')]('in','out'),'defaultValue':_0x92ce('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x92ce('0x6')](0xbe)},'phone':{'type':Sequelize[_0x92ce('0x6')]},'readAt':{'type':Sequelize[_0x92ce('0x7')]},'secret':{'type':Sequelize[_0x92ce('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x92ce('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 594418a..daa3173 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 _0xd2c7=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','plivio','infobip','results','groupName','lodash','../../components/interaction/service','api','../../config/environment','redis','localhost','./smsMessage.socket','register','jayson/promise','client','http','../../config/logger','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','map','SmsMessage','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','show','params','keys','find','body','describe','accept','sms','reject','UserId','agent','get','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','rejectMessage'];(function(_0x31ab90,_0x145a96){var _0x2d6123=function(_0x2bf73f){while(--_0x2bf73f){_0x31ab90['push'](_0x31ab90['shift']());}};_0x2d6123(++_0x145a96);}(_0xd2c7,0x1e5));var _0x7d2c=function(_0x51f9a1,_0x181d54){_0x51f9a1=_0x51f9a1-0x0;var _0x14b1d3=_0xd2c7[_0x51f9a1];return _0x14b1d3;};'use strict';var util=require('util');var _=require(_0x7d2c('0x0'));var Redis=require('ioredis');var interactionService=require(_0x7d2c('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7d2c('0x2'));var config=require(_0x7d2c('0x3'));var db=require('../../mysqldb')['db'];config[_0x7d2c('0x4')]=_['defaults'](config[_0x7d2c('0x4')],{'host':_0x7d2c('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d2c('0x4')]));require(_0x7d2c('0x6'))[_0x7d2c('0x7')](socket);var jayson=require(_0x7d2c('0x8'));var client=jayson[_0x7d2c('0x9')][_0x7d2c('0xa')]({'port':0x232c});var client9002=jayson['client'][_0x7d2c('0xa')]({'port':0x232a});var interaction_log=require(_0x7d2c('0xb'))(_0x7d2c('0xc'));function respondWithRpcPromise(_0x2f0e78,_0xc1fc71,_0x5414db,_0x3427d0){return new Promise(function(_0x4d7de8,_0x18b01a){var _0x50741a=_0x3427d0||client;return _0x50741a[_0x7d2c('0xd')](_0x2f0e78,_0x5414db)[_0x7d2c('0xe')](function(_0x3cd94a){logger[_0x7d2c('0xf')](_0x7d2c('0x10'),_0xc1fc71,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc1fc71,_0x7d2c('0x11'),JSON['stringify'](_0x3cd94a));if(_0x3cd94a[_0x7d2c('0x12')]){if(_0x3cd94a[_0x7d2c('0x12')][_0x7d2c('0x13')]===0x1f4){logger['error'](_0x7d2c('0x10'),_0xc1fc71,_0x3cd94a['error'][_0x7d2c('0x14')]);return _0x18b01a(_0x3cd94a['error'][_0x7d2c('0x14')]);}logger['error'](_0x7d2c('0x10'),_0xc1fc71,_0x3cd94a[_0x7d2c('0x12')][_0x7d2c('0x14')]);return _0x4d7de8(_0x3cd94a[_0x7d2c('0x12')][_0x7d2c('0x14')]);}else{logger[_0x7d2c('0xf')]('SmsMessage,\x20%s,\x20%s',_0xc1fc71,_0x7d2c('0x11'));_0x4d7de8(_0x3cd94a['result'][_0x7d2c('0x14')]);}})[_0x7d2c('0x15')](function(_0x5aab39){logger[_0x7d2c('0x12')](_0x7d2c('0x10'),_0xc1fc71,_0x5aab39);_0x18b01a(_0x5aab39);});});}function respondWithResult(_0x1a485d,_0x39d1cf){_0x39d1cf=_0x39d1cf||0xc8;return function(_0x200e09){if(_0x200e09){return _0x1a485d[_0x7d2c('0x16')](_0x39d1cf)[_0x7d2c('0x17')](_0x200e09);}};}function respondWithFilteredResult(_0x34606c,_0x53a2a6){return function(_0x529302){if(_0x529302){var _0x5e2c3a=typeof _0x53a2a6[_0x7d2c('0x18')]===_0x7d2c('0x19')&&typeof _0x53a2a6[_0x7d2c('0x1a')]===_0x7d2c('0x19');var _0x13c343=_0x529302[_0x7d2c('0x1b')];var _0x1655fd=_0x5e2c3a?0x0:_0x53a2a6[_0x7d2c('0x18')];var _0x434b1d=_0x5e2c3a?_0x529302['count']:_0x53a2a6['offset']+_0x53a2a6[_0x7d2c('0x1a')];var _0x525c2a;if(_0x434b1d>=_0x13c343){_0x434b1d=_0x13c343;_0x525c2a=0xc8;}else{_0x525c2a=0xce;}_0x34606c[_0x7d2c('0x16')](_0x525c2a);return _0x34606c[_0x7d2c('0x1c')](_0x7d2c('0x1d'),_0x1655fd+'-'+_0x434b1d+'/'+_0x13c343)['json'](_0x529302);}return null;};}function saveUpdates(_0x3aee36){return function(_0x526bd5){if(_0x526bd5){return _0x526bd5[_0x7d2c('0x1e')](_0x3aee36)[_0x7d2c('0xe')](function(_0x4a690e){return _0x4a690e;});}return null;};}function removeEntity(_0x4e4027){return function(_0xd89f31){if(_0xd89f31){return _0xd89f31[_0x7d2c('0x1f')]()['then'](function(){_0x4e4027['status'](0xcc)[_0x7d2c('0x20')]();});}};}function handleEntityNotFound(_0x5a0160){return function(_0x8101b9){if(!_0x8101b9){_0x5a0160[_0x7d2c('0x21')](0x194);}return _0x8101b9;};}function handleError(_0x2e75e5,_0x2fd96a){_0x2fd96a=_0x2fd96a||0x1f4;return function(_0xce4f7c){logger[_0x7d2c('0x12')](_0xce4f7c[_0x7d2c('0x22')]);if(_0xce4f7c['name']){delete _0xce4f7c['name'];}_0x2e75e5[_0x7d2c('0x16')](_0x2fd96a)['send'](_0xce4f7c);};}exports['index']=function(_0x2b39a4,_0x47783d){var _0x5935ea={},_0x3a4e31={},_0x25cc7b={'count':0x0,'rows':[]};var _0x3c19c0=_[_0x7d2c('0x23')](db[_0x7d2c('0x24')]['rawAttributes'],function(_0xe3c7ee){return{'name':_0xe3c7ee[_0x7d2c('0x25')],'type':_0xe3c7ee[_0x7d2c('0x26')][_0x7d2c('0x27')]};});_0x3a4e31['model']=_[_0x7d2c('0x23')](_0x3c19c0,'name');_0x3a4e31[_0x7d2c('0x28')]=_['keys'](_0x2b39a4[_0x7d2c('0x28')]);_0x3a4e31[_0x7d2c('0x29')]=_['intersection'](_0x3a4e31[_0x7d2c('0x2a')],_0x3a4e31['query']);_0x5935ea[_0x7d2c('0x2b')]=_[_0x7d2c('0x2c')](_0x3a4e31[_0x7d2c('0x2a')],qs[_0x7d2c('0x2d')](_0x2b39a4[_0x7d2c('0x28')]['fields']));_0x5935ea[_0x7d2c('0x2b')]=_0x5935ea['attributes'][_0x7d2c('0x2e')]?_0x5935ea[_0x7d2c('0x2b')]:_0x3a4e31[_0x7d2c('0x2a')];if(!_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x2f')](_0x7d2c('0x30'))){_0x5935ea[_0x7d2c('0x1a')]=qs[_0x7d2c('0x1a')](_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x1a')]);_0x5935ea[_0x7d2c('0x18')]=qs[_0x7d2c('0x18')](_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x18')]);}_0x5935ea[_0x7d2c('0x31')]=qs[_0x7d2c('0x32')](_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x32')]);_0x5935ea[_0x7d2c('0x33')]=qs[_0x7d2c('0x29')](_[_0x7d2c('0x34')](_0x2b39a4[_0x7d2c('0x28')],_0x3a4e31[_0x7d2c('0x29')]),_0x3c19c0);if(_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x35')]){_0x5935ea[_0x7d2c('0x33')]=_[_0x7d2c('0x36')](_0x5935ea[_0x7d2c('0x33')],{'$or':_[_0x7d2c('0x23')](_0x3c19c0,function(_0x5b8280){if(_0x5b8280['type']!==_0x7d2c('0x37')){var _0x601d53={};_0x601d53[_0x5b8280[_0x7d2c('0x38')]]={'$like':'%'+_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x35')]+'%'};return _0x601d53;}})});}_0x5935ea=_[_0x7d2c('0x36')]({},_0x5935ea,_0x2b39a4[_0x7d2c('0x39')]);var _0xe3c4de={'where':_0x5935ea[_0x7d2c('0x33')]};return db[_0x7d2c('0x24')]['count'](_0xe3c4de)[_0x7d2c('0xe')](function(_0x4ad14b){_0x25cc7b[_0x7d2c('0x1b')]=_0x4ad14b;if(_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x3a')]){_0x5935ea[_0x7d2c('0x3b')]=[{'all':!![]}];}return db['SmsMessage'][_0x7d2c('0x3c')](_0x5935ea);})[_0x7d2c('0xe')](function(_0x1c1f2a){_0x25cc7b[_0x7d2c('0x3d')]=_0x1c1f2a;return _0x25cc7b;})[_0x7d2c('0xe')](respondWithFilteredResult(_0x47783d,_0x5935ea))[_0x7d2c('0x15')](handleError(_0x47783d,null));};exports[_0x7d2c('0x3e')]=function(_0x2bf8ef,_0x134ad3){var _0x501f15={'raw':!![],'where':{'id':_0x2bf8ef[_0x7d2c('0x3f')]['id']}},_0x49f27f={};_0x49f27f['model']=_[_0x7d2c('0x40')](db[_0x7d2c('0x24')]['rawAttributes']);_0x49f27f[_0x7d2c('0x28')]=_[_0x7d2c('0x40')](_0x2bf8ef['query']);_0x49f27f[_0x7d2c('0x29')]=_[_0x7d2c('0x2c')](_0x49f27f[_0x7d2c('0x2a')],_0x49f27f['query']);_0x501f15['attributes']=_['intersection'](_0x49f27f[_0x7d2c('0x2a')],qs[_0x7d2c('0x2d')](_0x2bf8ef[_0x7d2c('0x28')][_0x7d2c('0x2d')]));_0x501f15[_0x7d2c('0x2b')]=_0x501f15[_0x7d2c('0x2b')][_0x7d2c('0x2e')]?_0x501f15[_0x7d2c('0x2b')]:_0x49f27f[_0x7d2c('0x2a')];if(_0x2bf8ef['query'][_0x7d2c('0x3a')]){_0x501f15[_0x7d2c('0x3b')]=[{'all':!![]}];}_0x501f15=_[_0x7d2c('0x36')]({},_0x501f15,_0x2bf8ef['options']);return db[_0x7d2c('0x24')][_0x7d2c('0x41')](_0x501f15)[_0x7d2c('0xe')](handleEntityNotFound(_0x134ad3,null))[_0x7d2c('0xe')](respondWithResult(_0x134ad3,null))['catch'](handleError(_0x134ad3,null));};exports['create']=function(_0xe3c641,_0x232642){return db[_0x7d2c('0x24')]['create'](_0xe3c641[_0x7d2c('0x42')],{})[_0x7d2c('0xe')](respondWithResult(_0x232642,0xc9))[_0x7d2c('0x15')](handleError(_0x232642,null));};exports[_0x7d2c('0x1e')]=function(_0x108325,_0x22c088){if(_0x108325[_0x7d2c('0x42')]['id']){delete _0x108325[_0x7d2c('0x42')]['id'];}return db[_0x7d2c('0x24')][_0x7d2c('0x41')]({'where':{'id':_0x108325[_0x7d2c('0x3f')]['id']}})[_0x7d2c('0xe')](handleEntityNotFound(_0x22c088,null))[_0x7d2c('0xe')](saveUpdates(_0x108325[_0x7d2c('0x42')],null))['then'](respondWithResult(_0x22c088,null))[_0x7d2c('0x15')](handleError(_0x22c088,null));};exports[_0x7d2c('0x1f')]=function(_0xd1550d,_0x528797){return db[_0x7d2c('0x24')][_0x7d2c('0x41')]({'where':{'id':_0xd1550d['params']['id']}})[_0x7d2c('0xe')](handleEntityNotFound(_0x528797,null))[_0x7d2c('0xe')](removeEntity(_0x528797,null))[_0x7d2c('0x15')](handleError(_0x528797,null));};exports[_0x7d2c('0x43')]=function(_0x3f6bb6,_0x2a613e){return db[_0x7d2c('0x24')]['describe']()['then'](respondWithResult(_0x2a613e,null))['catch'](handleError(_0x2a613e,null));};exports[_0x7d2c('0x44')]=function(_0x2daca6,_0x2a0866){var _0x31027d=_0x7d2c('0x45');return interactionService['acceptMessage'](_0x2daca6,_0x31027d)[_0x7d2c('0xe')](respondWithResult(_0x2a0866,null))['catch'](handleError(_0x2a0866,null));};exports[_0x7d2c('0x46')]=function(_0x7ba8a3,_0x494fae){var _0x3301fc={'agent':{},'channel':_0x7d2c('0x45')};if(_0x7ba8a3[_0x7d2c('0x42')]['id']){delete _0x7ba8a3['body']['id'];}_0x7ba8a3[_0x7d2c('0x42')][_0x7d2c('0x47')]=_0x7ba8a3['body']['UserId']||_0x7ba8a3['user']['id'];_0x3301fc[_0x7d2c('0x48')]['id']=_0x7ba8a3[_0x7d2c('0x42')][_0x7d2c('0x47')];return db[_0x7d2c('0x24')]['find']({'where':{'id':_0x7ba8a3[_0x7d2c('0x3f')]['id'],'UserId':null}})[_0x7d2c('0xe')](handleEntityNotFound(_0x494fae,null))[_0x7d2c('0xe')](function(_0x344a8b){if(_0x344a8b){_0x3301fc[_0x7d2c('0x14')]=_0x344a8b[_0x7d2c('0x49')]({'plain':!![]});return db[_0x7d2c('0x4a')][_0x7d2c('0x41')]({'where':{'id':_0x344a8b['SmsInteractionId']}});}return null;})[_0x7d2c('0xe')](handleEntityNotFound(_0x494fae,null))[_0x7d2c('0xe')](function(_0x2c0dd2){if(_0x2c0dd2){_0x3301fc['interaction']=_0x2c0dd2[_0x7d2c('0x49')]({'plain':!![]});interaction_log['info'](_0x7d2c('0x4b'),_0x7ba8a3[_0x7d2c('0x4c')]['id'],_0x7ba8a3['user']['name'],_0x7ba8a3[_0x7d2c('0x4c')]['role'],_0x3301fc['interaction']['id'],_0x7ba8a3['body']?JSON[_0x7d2c('0x4d')](_0x7ba8a3[_0x7d2c('0x42')]):_0x7d2c('0x4e'));return respondWithRpcPromise('RejectMessage',_0x7d2c('0x4f'),_0x3301fc);}return null;})['then'](function(_0x22d2b3){var _0xcde4b5=_0x7d2c('0x50')+_0x22d2b3[_0x7d2c('0x14')][_0x7d2c('0x51')];return db[_0x7d2c('0x52')]['query'](_0xcde4b5,{'type':db[_0x7d2c('0x53')][_0x7d2c('0x54')][_0x7d2c('0x55')],'raw':!![]})[_0x7d2c('0xe')](function(_0x296765){return _0x296765;});})['then'](function(_0x1a2546){if(_0x1a2546){_0x3301fc[_0x7d2c('0x14')][_0x7d2c('0x56')]=_0x1a2546[0x0];if(!_0x7ba8a3[_0x7d2c('0x42')][_0x7d2c('0x47')])return;return db[_0x7d2c('0x57')][_0x7d2c('0x41')]({'where':{'id':_0x7ba8a3[_0x7d2c('0x42')][_0x7d2c('0x47')],'role':'agent'},'attributes':['id','name',_0x7d2c('0x58'),_0x7d2c('0x59'),_0x7d2c('0x5a')],'raw':!![]});}return null;})['then'](function(_0x198326){if(!_0x198326)return null;_0x3301fc[_0x7d2c('0x14')][_0x7d2c('0x48')]=_0x198326;return _0x3301fc;})[_0x7d2c('0xe')](function(_0x26ada3){if(_0x26ada3){_0x26ada3[_0x7d2c('0x14')]['interface']=util[_0x7d2c('0x5b')](_0x7d2c('0x5c'),_0x7ba8a3[_0x7d2c('0x4c')][_0x7d2c('0x38')]);_0x26ada3['message'][_0x7d2c('0x5d')]=_0x3301fc['channel'];_0x26ada3[_0x7d2c('0x14')][_0x7d2c('0x5e')]=_0x3301fc[_0x7d2c('0x5d')];_0x26ada3[_0x7d2c('0x14')]['event']=_0x7d2c('0x46');respondWithRpcPromise(_0x7d2c('0x5f'),'EventManager',{'event':_0x7d2c('0x60'),'message':_0x26ada3[_0x7d2c('0x14')]},client9002);return _0x3301fc;}return null;})[_0x7d2c('0xe')](respondWithResult(_0x494fae,null))[_0x7d2c('0x15')](handleError(_0x494fae,null));};exports[_0x7d2c('0x16')]=function(_0x594925,_0x495859){if(_0x594925[_0x7d2c('0x42')]['id']){delete _0x594925['body']['id'];}var _0x480c36;return db[_0x7d2c('0x24')]['find']({'where':{'id':_0x594925[_0x7d2c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x495859,null))[_0x7d2c('0xe')](function(_0x26a934){if(_0x26a934){_0x480c36=_0x26a934;return db[_0x7d2c('0x61')][_0x7d2c('0x41')]({'where':{'id':_0x26a934[_0x7d2c('0x62')]}});}})[_0x7d2c('0xe')](handleEntityNotFound(_0x495859,null))[_0x7d2c('0xe')](function(_0x2da7b2){if(_0x2da7b2){logger[_0x7d2c('0x63')](_0x7d2c('0x64'),'status',_0x7d2c('0x65'),_0x2da7b2[_0x7d2c('0x26')],util[_0x7d2c('0x66')](_0x594925[_0x7d2c('0x42')],{'showHidden':![],'depth':null}));switch(_0x2da7b2['type']){case _0x7d2c('0x67'):if(_0x594925[_0x7d2c('0x42')][_0x7d2c('0x68')]&&_0x594925[_0x7d2c('0x42')][_0x7d2c('0x68')]===_0x480c36[_0x7d2c('0x69')]){return _0x480c36[_0x7d2c('0x1e')]({'read':!![]});}else{logger[_0x7d2c('0x12')](_0x7d2c('0x6a'),_0x7d2c('0x16'),_0x7d2c('0x67'),util['inspect'](_0x594925['body'],{'showHidden':![],'depth':null}));}break;case _0x7d2c('0x6b'):if(_0x594925[_0x7d2c('0x42')]['MessageUUID']&&_0x594925[_0x7d2c('0x42')][_0x7d2c('0x6c')]===_0x480c36[_0x7d2c('0x69')]&&_['indexOf'](['sent','delivered'],_0x594925[_0x7d2c('0x42')]['Status'])>=0x0){return _0x480c36[_0x7d2c('0x1e')]({'read':!![]});}else{logger[_0x7d2c('0x12')](_0x7d2c('0x6a'),'status',_0x7d2c('0x6d'),util['inspect'](_0x594925[_0x7d2c('0x42')],{'showHidden':![],'depth':null}));}break;case _0x7d2c('0x6e'):var _0x60247c=_0x594925[_0x7d2c('0x42')][_0x7d2c('0x6f')][0x0];if(_0x60247c[_0x7d2c('0x16')][_0x7d2c('0x70')]==='DELIVERED'){return _0x480c36[_0x7d2c('0x1e')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util[_0x7d2c('0x66')](_0x594925[_0x7d2c('0x42')],{'showHidden':![],'depth':null}));}break;}return _0x480c36;}})['then'](respondWithResult(_0x495859,null))[_0x7d2c('0x15')](handleError(_0x495859,null));}; \ No newline at end of file +var _0xb6b3=['key','model','map','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','accept','acceptMessage','sms','UserId','user','agent','get','SmsInteraction','interaction','role','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','internal','SIP/%s','channel','motionChannel','event','reject','EventManager','rejectmessage','SmsAccount','SmsAccountId','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','DELIVERED','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','sms-interactions','request','then','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','SmsMessage,\x20%s,\x20%s','request\x20sent','status','undefined','limit','count','offset','set','json','update','destroy','stack','send','index','SmsMessage','rawAttributes','fieldName','type'];(function(_0x3e5c2b,_0x1bf391){var _0x460f3c=function(_0x344d0a){while(--_0x344d0a){_0x3e5c2b['push'](_0x3e5c2b['shift']());}};_0x460f3c(++_0x1bf391);}(_0xb6b3,0x12e));var _0x3b6b=function(_0x430e06,_0x232d4d){_0x430e06=_0x430e06-0x0;var _0x283d56=_0xb6b3[_0x430e06];return _0x283d56;};'use strict';var util=require(_0x3b6b('0x0'));var _=require('lodash');var Redis=require(_0x3b6b('0x1'));var interactionService=require(_0x3b6b('0x2'));var qs=require(_0x3b6b('0x3'));var logger=require(_0x3b6b('0x4'))('api');var config=require(_0x3b6b('0x5'));var db=require(_0x3b6b('0x6'))['db'];config[_0x3b6b('0x7')]=_[_0x3b6b('0x8')](config['redis'],{'host':_0x3b6b('0x9'),'port':0x18eb});var socket=require(_0x3b6b('0xa'))(new Redis(config[_0x3b6b('0x7')]));require(_0x3b6b('0xb'))[_0x3b6b('0xc')](socket);var jayson=require(_0x3b6b('0xd'));var client=jayson[_0x3b6b('0xe')][_0x3b6b('0xf')]({'port':0x232c});var client9002=jayson[_0x3b6b('0xe')]['http']({'port':0x232a});var interaction_log=require(_0x3b6b('0x4'))(_0x3b6b('0x10'));function respondWithRpcPromise(_0x54ce25,_0x1634b3,_0x157553,_0x293bee){return new Promise(function(_0x5702c6,_0x12a0ae){var _0x5231d4=_0x293bee||client;return _0x5231d4[_0x3b6b('0x11')](_0x54ce25,_0x157553)[_0x3b6b('0x12')](function(_0x5f20a6){logger['info']('SmsMessage,\x20%s,\x20%s',_0x1634b3,'request\x20sent');logger[_0x3b6b('0x13')](_0x3b6b('0x14'),_0x1634b3,'request\x20sent',JSON['stringify'](_0x5f20a6));if(_0x5f20a6[_0x3b6b('0x15')]){if(_0x5f20a6[_0x3b6b('0x15')][_0x3b6b('0x16')]===0x1f4){logger[_0x3b6b('0x15')]('SmsMessage,\x20%s,\x20%s',_0x1634b3,_0x5f20a6[_0x3b6b('0x15')][_0x3b6b('0x17')]);return _0x12a0ae(_0x5f20a6[_0x3b6b('0x15')][_0x3b6b('0x17')]);}logger[_0x3b6b('0x15')]('SmsMessage,\x20%s,\x20%s',_0x1634b3,_0x5f20a6[_0x3b6b('0x15')][_0x3b6b('0x17')]);return _0x5702c6(_0x5f20a6[_0x3b6b('0x15')][_0x3b6b('0x17')]);}else{logger[_0x3b6b('0x18')](_0x3b6b('0x19'),_0x1634b3,_0x3b6b('0x1a'));_0x5702c6(_0x5f20a6['result'][_0x3b6b('0x17')]);}})['catch'](function(_0x1a38ce){logger[_0x3b6b('0x15')](_0x3b6b('0x19'),_0x1634b3,_0x1a38ce);_0x12a0ae(_0x1a38ce);});});}function respondWithResult(_0x55352e,_0x26a88d){_0x26a88d=_0x26a88d||0xc8;return function(_0x4adbe8){if(_0x4adbe8){return _0x55352e[_0x3b6b('0x1b')](_0x26a88d)['json'](_0x4adbe8);}};}function respondWithFilteredResult(_0x101a95,_0xa7c144){return function(_0x40327a){if(_0x40327a){var _0x3f8de5=typeof _0xa7c144['offset']===_0x3b6b('0x1c')&&typeof _0xa7c144[_0x3b6b('0x1d')]==='undefined';var _0x442cda=_0x40327a[_0x3b6b('0x1e')];var _0xd6c7d9=_0x3f8de5?0x0:_0xa7c144['offset'];var _0x28deab=_0x3f8de5?_0x40327a[_0x3b6b('0x1e')]:_0xa7c144[_0x3b6b('0x1f')]+_0xa7c144['limit'];var _0x5029ca;if(_0x28deab>=_0x442cda){_0x28deab=_0x442cda;_0x5029ca=0xc8;}else{_0x5029ca=0xce;}_0x101a95[_0x3b6b('0x1b')](_0x5029ca);return _0x101a95[_0x3b6b('0x20')]('Content-Range',_0xd6c7d9+'-'+_0x28deab+'/'+_0x442cda)[_0x3b6b('0x21')](_0x40327a);}return null;};}function saveUpdates(_0x404634){return function(_0x2cffdd){if(_0x2cffdd){return _0x2cffdd[_0x3b6b('0x22')](_0x404634)[_0x3b6b('0x12')](function(_0x2472dc){return _0x2472dc;});}return null;};}function removeEntity(_0x1d03d5){return function(_0xd2785){if(_0xd2785){return _0xd2785[_0x3b6b('0x23')]()[_0x3b6b('0x12')](function(){_0x1d03d5[_0x3b6b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e176){return function(_0x5dfba8){if(!_0x5dfba8){_0x51e176['sendStatus'](0x194);}return _0x5dfba8;};}function handleError(_0x3d33b6,_0x28f3d0){_0x28f3d0=_0x28f3d0||0x1f4;return function(_0xe4cb23){logger[_0x3b6b('0x15')](_0xe4cb23[_0x3b6b('0x24')]);if(_0xe4cb23['name']){delete _0xe4cb23['name'];}_0x3d33b6['status'](_0x28f3d0)[_0x3b6b('0x25')](_0xe4cb23);};}exports[_0x3b6b('0x26')]=function(_0x49a365,_0x42f640){var _0x5327ba={},_0x536a75={},_0x1989da={'count':0x0,'rows':[]};var _0x5b51e6=_['map'](db[_0x3b6b('0x27')][_0x3b6b('0x28')],function(_0x2446fd){return{'name':_0x2446fd[_0x3b6b('0x29')],'type':_0x2446fd[_0x3b6b('0x2a')][_0x3b6b('0x2b')]};});_0x536a75[_0x3b6b('0x2c')]=_[_0x3b6b('0x2d')](_0x5b51e6,_0x3b6b('0x2e'));_0x536a75[_0x3b6b('0x2f')]=_['keys'](_0x49a365[_0x3b6b('0x2f')]);_0x536a75[_0x3b6b('0x30')]=_[_0x3b6b('0x31')](_0x536a75[_0x3b6b('0x2c')],_0x536a75[_0x3b6b('0x2f')]);_0x5327ba[_0x3b6b('0x32')]=_[_0x3b6b('0x31')](_0x536a75[_0x3b6b('0x2c')],qs[_0x3b6b('0x33')](_0x49a365['query'][_0x3b6b('0x33')]));_0x5327ba['attributes']=_0x5327ba['attributes'][_0x3b6b('0x34')]?_0x5327ba['attributes']:_0x536a75['model'];if(!_0x49a365[_0x3b6b('0x2f')]['hasOwnProperty'](_0x3b6b('0x35'))){_0x5327ba[_0x3b6b('0x1d')]=qs[_0x3b6b('0x1d')](_0x49a365['query'][_0x3b6b('0x1d')]);_0x5327ba[_0x3b6b('0x1f')]=qs[_0x3b6b('0x1f')](_0x49a365[_0x3b6b('0x2f')][_0x3b6b('0x1f')]);}_0x5327ba[_0x3b6b('0x36')]=qs[_0x3b6b('0x37')](_0x49a365[_0x3b6b('0x2f')]['sort']);_0x5327ba[_0x3b6b('0x38')]=qs['filters'](_[_0x3b6b('0x39')](_0x49a365[_0x3b6b('0x2f')],_0x536a75[_0x3b6b('0x30')]),_0x5b51e6);if(_0x49a365[_0x3b6b('0x2f')][_0x3b6b('0x3a')]){_0x5327ba['where']=_[_0x3b6b('0x3b')](_0x5327ba[_0x3b6b('0x38')],{'$or':_['map'](_0x5b51e6,function(_0x302df7){if(_0x302df7[_0x3b6b('0x2a')]!=='VIRTUAL'){var _0x3b4172={};_0x3b4172[_0x302df7[_0x3b6b('0x2e')]]={'$like':'%'+_0x49a365[_0x3b6b('0x2f')][_0x3b6b('0x3a')]+'%'};return _0x3b4172;}})});}_0x5327ba=_['merge']({},_0x5327ba,_0x49a365[_0x3b6b('0x3c')]);var _0x18dee4={'where':_0x5327ba[_0x3b6b('0x38')]};return db[_0x3b6b('0x27')][_0x3b6b('0x1e')](_0x18dee4)[_0x3b6b('0x12')](function(_0x4cefe6){_0x1989da[_0x3b6b('0x1e')]=_0x4cefe6;if(_0x49a365['query'][_0x3b6b('0x3d')]){_0x5327ba[_0x3b6b('0x3e')]=[{'all':!![]}];}return db[_0x3b6b('0x27')]['findAll'](_0x5327ba);})['then'](function(_0x1b54c8){_0x1989da[_0x3b6b('0x3f')]=_0x1b54c8;return _0x1989da;})[_0x3b6b('0x12')](respondWithFilteredResult(_0x42f640,_0x5327ba))[_0x3b6b('0x40')](handleError(_0x42f640,null));};exports[_0x3b6b('0x41')]=function(_0x485537,_0x1b2237){var _0x5b804d={'raw':!![],'where':{'id':_0x485537[_0x3b6b('0x42')]['id']}},_0x647c41={};_0x647c41[_0x3b6b('0x2c')]=_[_0x3b6b('0x43')](db['SmsMessage']['rawAttributes']);_0x647c41[_0x3b6b('0x2f')]=_[_0x3b6b('0x43')](_0x485537[_0x3b6b('0x2f')]);_0x647c41[_0x3b6b('0x30')]=_['intersection'](_0x647c41['model'],_0x647c41[_0x3b6b('0x2f')]);_0x5b804d[_0x3b6b('0x32')]=_['intersection'](_0x647c41[_0x3b6b('0x2c')],qs['fields'](_0x485537[_0x3b6b('0x2f')][_0x3b6b('0x33')]));_0x5b804d[_0x3b6b('0x32')]=_0x5b804d['attributes'][_0x3b6b('0x34')]?_0x5b804d[_0x3b6b('0x32')]:_0x647c41[_0x3b6b('0x2c')];if(_0x485537[_0x3b6b('0x2f')][_0x3b6b('0x3d')]){_0x5b804d[_0x3b6b('0x3e')]=[{'all':!![]}];}_0x5b804d=_[_0x3b6b('0x3b')]({},_0x5b804d,_0x485537['options']);return db[_0x3b6b('0x27')][_0x3b6b('0x44')](_0x5b804d)[_0x3b6b('0x12')](handleEntityNotFound(_0x1b2237,null))[_0x3b6b('0x12')](respondWithResult(_0x1b2237,null))['catch'](handleError(_0x1b2237,null));};exports[_0x3b6b('0x45')]=function(_0x74159c,_0x4036b8){return db[_0x3b6b('0x27')][_0x3b6b('0x45')](_0x74159c[_0x3b6b('0x46')],{})[_0x3b6b('0x12')](respondWithResult(_0x4036b8,0xc9))['catch'](handleError(_0x4036b8,null));};exports[_0x3b6b('0x22')]=function(_0xa4d718,_0x28a775){if(_0xa4d718['body']['id']){delete _0xa4d718['body']['id'];}return db['SmsMessage']['find']({'where':{'id':_0xa4d718[_0x3b6b('0x42')]['id']}})[_0x3b6b('0x12')](handleEntityNotFound(_0x28a775,null))['then'](saveUpdates(_0xa4d718[_0x3b6b('0x46')],null))[_0x3b6b('0x12')](respondWithResult(_0x28a775,null))[_0x3b6b('0x40')](handleError(_0x28a775,null));};exports[_0x3b6b('0x23')]=function(_0x77c961,_0x25a7cf){return db[_0x3b6b('0x27')][_0x3b6b('0x44')]({'where':{'id':_0x77c961[_0x3b6b('0x42')]['id']}})['then'](handleEntityNotFound(_0x25a7cf,null))[_0x3b6b('0x12')](removeEntity(_0x25a7cf,null))['catch'](handleError(_0x25a7cf,null));};exports[_0x3b6b('0x47')]=function(_0x5ab3c3,_0x2c2c32){return db[_0x3b6b('0x27')][_0x3b6b('0x47')]()[_0x3b6b('0x12')](respondWithResult(_0x2c2c32,null))['catch'](handleError(_0x2c2c32,null));};exports[_0x3b6b('0x48')]=function(_0x44d031,_0xe7edce){var _0x4c50cb='sms';return interactionService[_0x3b6b('0x49')](_0x44d031,_0x4c50cb)['then'](respondWithResult(_0xe7edce,null))[_0x3b6b('0x40')](handleError(_0xe7edce,null));};exports['reject']=function(_0x5e12ae,_0x2391cb){var _0x5e205c={'agent':{},'channel':_0x3b6b('0x4a')};if(_0x5e12ae[_0x3b6b('0x46')]['id']){delete _0x5e12ae['body']['id'];}_0x5e12ae['body'][_0x3b6b('0x4b')]=_0x5e12ae[_0x3b6b('0x46')][_0x3b6b('0x4b')]||_0x5e12ae[_0x3b6b('0x4c')]['id'];_0x5e205c[_0x3b6b('0x4d')]['id']=_0x5e12ae[_0x3b6b('0x46')]['UserId'];return db[_0x3b6b('0x27')][_0x3b6b('0x44')]({'where':{'id':_0x5e12ae['params']['id'],'UserId':null}})[_0x3b6b('0x12')](handleEntityNotFound(_0x2391cb,null))[_0x3b6b('0x12')](function(_0x3761c4){if(_0x3761c4){_0x5e205c[_0x3b6b('0x17')]=_0x3761c4[_0x3b6b('0x4e')]({'plain':!![]});return db[_0x3b6b('0x4f')][_0x3b6b('0x44')]({'where':{'id':_0x3761c4['SmsInteractionId']}});}return null;})[_0x3b6b('0x12')](handleEntityNotFound(_0x2391cb,null))[_0x3b6b('0x12')](function(_0x1bd7d0){if(_0x1bd7d0){_0x5e205c[_0x3b6b('0x50')]=_0x1bd7d0['get']({'plain':!![]});interaction_log[_0x3b6b('0x18')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5e12ae[_0x3b6b('0x4c')]['id'],_0x5e12ae[_0x3b6b('0x4c')][_0x3b6b('0x2e')],_0x5e12ae[_0x3b6b('0x4c')][_0x3b6b('0x51')],_0x5e205c[_0x3b6b('0x50')]['id'],_0x5e12ae['body']?JSON[_0x3b6b('0x52')](_0x5e12ae[_0x3b6b('0x46')]):'null');return respondWithRpcPromise('RejectMessage',_0x3b6b('0x53'),_0x5e205c);}return null;})['then'](function(_0x2a7880){var _0x4921d3=_0x3b6b('0x54')+_0x2a7880[_0x3b6b('0x17')][_0x3b6b('0x55')];return db[_0x3b6b('0x56')][_0x3b6b('0x2f')](_0x4921d3,{'type':db[_0x3b6b('0x57')]['QueryTypes']['SELECT'],'raw':!![]})[_0x3b6b('0x12')](function(_0x3cba51){return _0x3cba51;});})[_0x3b6b('0x12')](function(_0x45ff95){if(_0x45ff95){_0x5e205c[_0x3b6b('0x17')][_0x3b6b('0x58')]=_0x45ff95[0x0];if(!_0x5e12ae[_0x3b6b('0x46')]['UserId'])return;return db[_0x3b6b('0x59')]['find']({'where':{'id':_0x5e12ae[_0x3b6b('0x46')][_0x3b6b('0x4b')],'role':_0x3b6b('0x4d')},'attributes':['id','name',_0x3b6b('0x5a'),'email',_0x3b6b('0x5b')],'raw':!![]});}return null;})[_0x3b6b('0x12')](function(_0x1f486a){if(!_0x1f486a)return null;_0x5e205c[_0x3b6b('0x17')]['agent']=_0x1f486a;return _0x5e205c;})[_0x3b6b('0x12')](function(_0x202185){if(_0x202185){_0x202185['message']['interface']=util['format'](_0x3b6b('0x5c'),_0x5e12ae[_0x3b6b('0x4c')][_0x3b6b('0x2e')]);_0x202185[_0x3b6b('0x17')][_0x3b6b('0x5d')]=_0x5e205c[_0x3b6b('0x5d')];_0x202185[_0x3b6b('0x17')][_0x3b6b('0x5e')]=_0x5e205c['channel'];_0x202185[_0x3b6b('0x17')][_0x3b6b('0x5f')]=_0x3b6b('0x60');respondWithRpcPromise(_0x3b6b('0x61'),_0x3b6b('0x61'),{'event':_0x3b6b('0x62'),'message':_0x202185['message']},client9002);return _0x5e205c;}return null;})[_0x3b6b('0x12')](respondWithResult(_0x2391cb,null))[_0x3b6b('0x40')](handleError(_0x2391cb,null));};exports['status']=function(_0x4d940f,_0x1603bc){if(_0x4d940f[_0x3b6b('0x46')]['id']){delete _0x4d940f[_0x3b6b('0x46')]['id'];}var _0xef8cb9;return db[_0x3b6b('0x27')][_0x3b6b('0x44')]({'where':{'id':_0x4d940f[_0x3b6b('0x42')]['id']}})[_0x3b6b('0x12')](handleEntityNotFound(_0x1603bc,null))[_0x3b6b('0x12')](function(_0x18831c){if(_0x18831c){_0xef8cb9=_0x18831c;return db[_0x3b6b('0x63')][_0x3b6b('0x44')]({'where':{'id':_0x18831c[_0x3b6b('0x64')]}});}})[_0x3b6b('0x12')](handleEntityNotFound(_0x1603bc,null))[_0x3b6b('0x12')](function(_0x527d78){if(_0x527d78){logger[_0x3b6b('0x13')](_0x3b6b('0x14'),_0x3b6b('0x1b'),'received\x20delivery\x20report\x20from',_0x527d78['type'],util['inspect'](_0x4d940f[_0x3b6b('0x46')],{'showHidden':![],'depth':null}));switch(_0x527d78[_0x3b6b('0x2a')]){case'twilio':if(_0x4d940f[_0x3b6b('0x46')][_0x3b6b('0x65')]&&_0x4d940f[_0x3b6b('0x46')][_0x3b6b('0x65')]===_0xef8cb9[_0x3b6b('0x66')]){return _0xef8cb9[_0x3b6b('0x22')]({'read':!![]});}else{logger[_0x3b6b('0x15')](_0x3b6b('0x67'),'status','twilio',util[_0x3b6b('0x68')](_0x4d940f[_0x3b6b('0x46')],{'showHidden':![],'depth':null}));}break;case _0x3b6b('0x69'):if(_0x4d940f['body'][_0x3b6b('0x6a')]&&_0x4d940f[_0x3b6b('0x46')]['MessageUUID']===_0xef8cb9[_0x3b6b('0x66')]&&_[_0x3b6b('0x6b')]([_0x3b6b('0x6c'),_0x3b6b('0x6d')],_0x4d940f['body'][_0x3b6b('0x6e')])>=0x0){return _0xef8cb9['update']({'read':!![]});}else{logger[_0x3b6b('0x15')](_0x3b6b('0x67'),_0x3b6b('0x1b'),_0x3b6b('0x6f'),util[_0x3b6b('0x68')](_0x4d940f['body'],{'showHidden':![],'depth':null}));}break;case _0x3b6b('0x70'):var _0x428ed8=_0x4d940f[_0x3b6b('0x46')][_0x3b6b('0x71')][0x0];if(_0x428ed8[_0x3b6b('0x1b')]['groupName']===_0x3b6b('0x72')){return _0xef8cb9[_0x3b6b('0x22')]({'read':!![]});}else{logger['error'](_0x3b6b('0x67'),_0x3b6b('0x1b'),_0x3b6b('0x70'),util['inspect'](_0x4d940f[_0x3b6b('0x46')],{'showHidden':![],'depth':null}));}break;}return _0xef8cb9;}})[_0x3b6b('0x12')](respondWithResult(_0x1603bc,null))[_0x3b6b('0x40')](handleError(_0x1603bc,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 133682b..faba4c7 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 _0x59ab=['SmsMessage','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0xd20f56,_0x4289bf){var _0x366917=function(_0x46b37c){while(--_0x46b37c){_0xd20f56['push'](_0xd20f56['shift']());}};_0x366917(++_0x4289bf);}(_0x59ab,0x16f));var _0xb59a=function(_0x57ae68,_0x1edcf3){_0x57ae68=_0x57ae68-0x0;var _0x45f81b=_0x59ab[_0x57ae68];return _0x45f81b;};'use strict';var EventEmitter=require(_0xb59a('0x0'));var SmsMessage=require(_0xb59a('0x1'))['db'][_0xb59a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb59a('0x3')](0x0);var events={'afterCreate':_0xb59a('0x4'),'afterUpdate':_0xb59a('0x5'),'afterDestroy':_0xb59a('0x6')};function emitEvent(_0x2c4fb6){return function(_0x319aac,_0x4b37b5,_0x58b4d6){SmsMessageEvents['emit'](_0x2c4fb6+':'+_0x319aac['id'],_0x319aac);SmsMessageEvents[_0xb59a('0x7')](_0x2c4fb6,_0x319aac);_0x58b4d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xb59a('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xb6e3=['events','../../mysqldb','SmsMessage','setMaxListeners','update','emit','hook'];(function(_0x3b2071,_0x237aed){var _0x1a5002=function(_0x445bc1){while(--_0x445bc1){_0x3b2071['push'](_0x3b2071['shift']());}};_0x1a5002(++_0x237aed);}(_0xb6e3,0x7e));var _0x3b6e=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xb6e3[_0x2e4aa2];return _0x5e6092;};'use strict';var EventEmitter=require(_0x3b6e('0x0'));var SmsMessage=require(_0x3b6e('0x1'))['db'][_0x3b6e('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3b6e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b6e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x6df926){return function(_0x1ddd36,_0x1af182,_0xd06ea6){SmsMessageEvents[_0x3b6e('0x5')](_0x6df926+':'+_0x1ddd36['id'],_0x1ddd36);SmsMessageEvents[_0x3b6e('0x5')](_0x6df926,_0x1ddd36);_0xd06ea6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x3b6e('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c0d9a34..bee6431 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 _0xce6d=['twilio','authToken','phone','accountSid','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','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','GET','sms','session_key','total_sent','internal_order_id','deliveryReport','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','update','xCALLY\x20Motion','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','accountId','/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','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','bluebird','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','createdAt','catch','error','SmsAccount','find','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xce6d,0x1c9));var _0xdce6=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0xce6d[_0x59710f];return _0xaae66a;};'use strict';var _=require(_0xdce6('0x0'));var util=require(_0xdce6('0x1'));var logger=require(_0xdce6('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdce6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdce6('0x4'));var rimraf=require(_0xdce6('0x5'));var config=require('../../config/environment');var attributes=require(_0xdce6('0x6'));module[_0xdce6('0x7')]=function(_0x14229b,_0xc021dc){return _0x14229b[_0xdce6('0x8')](_0xdce6('0x9'),attributes,{'tableName':_0xdce6('0xa'),'paranoid':![],'indexes':[{'name':_0xdce6('0xb'),'fields':[_0xdce6('0xb')]},{'name':_0xdce6('0xc'),'fields':[_0xdce6('0xd')],'type':_0xdce6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35bff3,_0xed80b7,_0x1bcd1c){var _0x3679c7=_0x14229b[_0xdce6('0xf')];var _0x48b910=_0x35bff3[_0xdce6('0x10')]({'plain':!![]});if(_0x48b910[_0xdce6('0x11')][_0xdce6('0x12')]()==='in'||_0x48b910[_0xdce6('0x11')][_0xdce6('0x12')]()===_0xdce6('0x13')&&!_0x48b910[_0xdce6('0x14')]&&!_[_0xdce6('0x15')](_0x48b910['UserId'])&&!_['isNil'](_0x48b910[_0xdce6('0x16')])){_0x3679c7[_0xdce6('0x17')][_0xdce6('0x18')]({'where':{'id':_0x48b910[_0xdce6('0x16')]}})['then'](function(_0x5f4664){if(_0x5f4664){_0x5f4664['update']({'lastMsgAt':_0x48b910[_0xdce6('0x19')],'lastMsgDirection':_0x48b910[_0xdce6('0x11')][_0xdce6('0x12')]()});}})[_0xdce6('0x1a')](function(_0xda8f53){console[_0xdce6('0x1b')](_0xda8f53);});}if(_0x48b910[_0xdce6('0x11')]===_0xdce6('0x13')&&!_0x48b910[_0xdce6('0x14')]){var _0x35a925;_0x3679c7[_0xdce6('0x1c')][_0xdce6('0x1d')]({'where':{'id':_0x48b910['SmsAccountId']},'raw':!![]})[_0xdce6('0x1e')](function(_0x5e646e){_0x35a925=_0x5e646e;if(_0x35a925&&_0x35a925['type']){switch(_0x35a925['type']){case _0xdce6('0x1f'):var _0x47f20e=require(_0xdce6('0x1f'));if(_0x35a925['accountSid']&&_0x35a925[_0xdce6('0x20')]&&_0x35a925[_0xdce6('0x21')]){var _0x4ad2e3=new _0x47f20e(_0x35a925[_0xdce6('0x22')],_0x35a925[_0xdce6('0x20')]);_0x4ad2e3[_0xdce6('0x23')][_0xdce6('0x24')]({'body':_0x48b910['body'],'to':_0x48b910[_0xdce6('0x21')],'from':_0x35a925[_0xdce6('0x21')],'statusCallback':_0x35a925[_0xdce6('0x25')]+_0xdce6('0x26')+_0x48b910['id']+_0xdce6('0x27')+_0x35a925[_0xdce6('0x28')]})[_0xdce6('0x1e')](function(_0x3faa67){if(_0x3faa67[_0xdce6('0x29')]){return _0x35bff3['update']({'messageId':_0x3faa67[_0xdce6('0x29')]});}})['catch'](function(_0x41e82d){logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),'twilio',util[_0xdce6('0x2b')](_0x41e82d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x1f'),_0xdce6('0x2d'));}break;case _0xdce6('0x2e'):var _0x5574fe=_0xdce6('0x2f');if(_0x35a925[_0xdce6('0x30')]&&_0x35a925[_0xdce6('0x31')]){var _0x48b6a6={'recipient':[_0x48b910[_0xdce6('0x21')]],'message':_0x48b910['body'],'message_type':_0x35a925['smsMethod']};if(_0x35a925[_0xdce6('0x32')]&&_0x35a925['smsMethod']!=='SI'){_0x48b6a6['sender']=_0x35a925[_0xdce6('0x21')];}var _0x1349f1={'url':_0x5574fe+_0xdce6('0x33')+_0x35a925[_0xdce6('0x30')]+'&password='+_0x35a925['password'],'method':_0xdce6('0x34')};rp(_0x1349f1)[_0xdce6('0x1e')](function(_0x35d5c1){var _0x463a6d=_0x35d5c1['split'](';');var _0x4b08af={'user_key':_0x463a6d[0x0],'session_key':_0x463a6d[0x1]};_0x1349f1={'url':_0x5574fe+_0xdce6('0x35'),'method':'POST','headers':{'user_key':_0x4b08af['user_key'],'Session_key':_0x4b08af[_0xdce6('0x36')]},'json':!![],'body':_0x48b6a6};return rp(_0x1349f1);})['then'](function(_0x2b20f3){if(_0x2b20f3[_0xdce6('0x37')]>=0x1){var _0x5db718={'messageId':_0x2b20f3[_0xdce6('0x38')]};if(_0x35a925[_0xdce6('0x32')]!=='GP'||!_0x35a925[_0xdce6('0x39')]){_0x5db718[_0xdce6('0x3a')]=!![];}return _0x35bff3['update'](_0x5db718);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0xdce6('0x2b')](_0x2b20f3,{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x530303){return logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x2e'),util[_0xdce6('0x2b')](_0x530303,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xdce6('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xdce6('0x3b'):if(_0x35a925[_0xdce6('0x20')]){var _0x2d7cbb={'recipient':_0x48b910['phone'],'message':_0x48b910[_0xdce6('0xd')],'sender':_0x35a925[_0xdce6('0x3c')]||_0x35a925['phone'],'authorization':_0x35a925[_0xdce6('0x20')]};var _0xed80b7={'method':'POST','uri':_0xdce6('0x3d'),'body':_0x2d7cbb,'json':!![]};rp(_0xed80b7)[_0xdce6('0x1e')](function(_0x254236){var _0x2b7f42={'messageId':_0x254236[_0xdce6('0x3e')]};if(!_0x35a925[_0xdce6('0x39')]){_0x2b7f42[_0xdce6('0x3a')]=!![];}return _0x35bff3[_0xdce6('0x3f')](_0x2b7f42);})['catch'](function(_0x3ed1ff){logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'connectel',util[_0xdce6('0x2b')](_0x3ed1ff,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),'afterCreate',_0xdce6('0x3b'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x35a925[_0xdce6('0x30')]&&_0x35a925[_0xdce6('0x31')]){var _0x2d7cbb={'messages':[{'source':_0xdce6('0x40'),'to':_0x48b910[_0xdce6('0x21')],'body':_0x48b910[_0xdce6('0xd')],'from':_0x35a925[_0xdce6('0x3c')]||_0x35a925[_0xdce6('0x21')]}]};var _0x540ffa=util[_0xdce6('0x41')](_0xdce6('0x42'),_0x35a925[_0xdce6('0x30')],_0x35a925[_0xdce6('0x31')]);var _0xed80b7={'method':_0xdce6('0x43'),'uri':_0xdce6('0x44'),'body':_0x2d7cbb,'headers':{'Authorization':util[_0xdce6('0x41')](_0xdce6('0x45'),new Buffer(_0x540ffa)[_0xdce6('0x46')](_0xdce6('0x47')))},'json':!![]};rp(_0xed80b7)[_0xdce6('0x1e')](function(_0x4104ff){if(_0x4104ff['http_code']>=0xc8&&_0x4104ff['http_code']<=0xce){if(_0x4104ff[_0xdce6('0x48')]&&_0x4104ff[_0xdce6('0x48')][_0xdce6('0x49')]>0x0){var _0x41960a=_[_0xdce6('0x4a')](_0x4104ff[_0xdce6('0x48')][_0xdce6('0x23')]);var _0x1b115d={'messageId':_0x41960a[_0xdce6('0x4b')]};if(!_0x35a925[_0xdce6('0x39')]){_0x1b115d['read']=!![];}return _0x35bff3['update'](_0x1b115d);}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x4c'),util[_0xdce6('0x2b')](_0x4104ff,{'showHidden':![],'depth':null}));}}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x4c'),util[_0xdce6('0x2b')](_0x4104ff,{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x14b8aa){logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),_0xdce6('0x4c'),util[_0xdce6('0x2b')](_0x14b8aa,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x4c'),_0xdce6('0x4d'));}break;case'plivo':if(_0x35a925[_0xdce6('0x4e')]&&_0x35a925[_0xdce6('0x20')]){var _0x2d7cbb={'dst':_0x48b910['phone'],'text':_0x48b910[_0xdce6('0xd')],'src':_0x35a925['senderString']||_0x35a925[_0xdce6('0x21')],'url':_0x35a925[_0xdce6('0x25')]+_0xdce6('0x26')+_0x48b910['id']+_0xdce6('0x27')+_0x35a925[_0xdce6('0x28')]};var _0x540ffa=util[_0xdce6('0x41')]('%s:%s',_0x35a925[_0xdce6('0x4e')],_0x35a925[_0xdce6('0x20')]);var _0xed80b7={'method':_0xdce6('0x43'),'uri':util['format'](_0xdce6('0x4f'),_0x35a925[_0xdce6('0x4e')]),'body':_0x2d7cbb,'headers':{'Authorization':util[_0xdce6('0x41')](_0xdce6('0x45'),new Buffer(_0x540ffa)['toString'](_0xdce6('0x47')))},'json':!![]};rp(_0xed80b7)[_0xdce6('0x1e')](function(_0x34cb1f){var _0xbceb0e={'messageId':_0x34cb1f[_0xdce6('0x50')][0x0]};return _0x35bff3[_0xdce6('0x3f')](_0xbceb0e);})['catch'](function(_0x39b69e){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),_0xdce6('0x51'),util['inspect'](_0x39b69e,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'plivo',_0xdce6('0x52'));}break;case'infobip':if(_0x35a925[_0xdce6('0x30')]&&_0x35a925['password']){if(_0x35a925[_0xdce6('0x53')]){var _0x26e76e={'method':'POST','uri':_0x35a925['baseUrl']+_0xdce6('0x54'),'body':{'username':_0x35a925[_0xdce6('0x30')],'password':_0x35a925[_0xdce6('0x31')]},'json':!![]};return rp(_0x26e76e)[_0xdce6('0x1e')](function(_0xa0dff0){var _0x1078a8={'method':_0xdce6('0x43'),'uri':_0x35a925[_0xdce6('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x35a925[_0xdce6('0x21')],'destinations':[{'to':_0x48b910['phone']}],'text':_0x48b910[_0xdce6('0xd')],'notifyUrl':_0x35a925[_0xdce6('0x25')]+_0xdce6('0x26')+_0x48b910['id']+_0xdce6('0x27')+_0x35a925['token'],'notifyContentType':_0xdce6('0x55'),'callbackData':_0x35a925['phone']+';'+_0x48b910['body']}]},'headers':{'Authorization':_0xdce6('0x56')+_0xa0dff0[_0xdce6('0x28')]},'json':!![]};return rp(_0x1078a8)[_0xdce6('0x1e')](function(_0x12aa76){if(_0x12aa76[_0xdce6('0x23')]){var _0x5da7c7={'messageId':_0x12aa76[_0xdce6('0x23')][0x0][_0xdce6('0xb')]};if(!_0x35a925[_0xdce6('0x39')]){_0x5da7c7[_0xdce6('0x3a')]=!![];}return _0x35bff3[_0xdce6('0x3f')](_0x5da7c7);}else{return logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0xdce6('0x2b')](_0x12aa76,{'showHidden':![],'depth':null}));}});})[_0xdce6('0x1a')](function(_0x90d5cf){return logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),'infobip',util[_0xdce6('0x2b')](_0x90d5cf,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),'afterCreate',_0xdce6('0x57'),_0xdce6('0x58'));}}else{logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),'infobip',_0xdce6('0x4d'));}break;case _0xdce6('0x59'):var _0x2c6821=require(_0xdce6('0x5a'));if(_0x35a925[_0xdce6('0x5b')]){var _0x589b2d={};_0x589b2d[_0xdce6('0x5c')]=_0x35a925[_0xdce6('0x30')];_0x589b2d[_0xdce6('0x21')]=_0x48b910[_0xdce6('0x21')];_0x589b2d[_0xdce6('0x5d')]=_0x35a925['phone'];_0x589b2d[_0xdce6('0x5e')]=_0x48b910[_0xdce6('0xd')];_0x589b2d[_0xdce6('0x5f')]=+new Date();var _0x354a81='';var _0x18c4b4='';var _0x5d8d39=Object[_0xdce6('0x60')](_0x589b2d);_0x5d8d39[_0xdce6('0x61')]();for(var _0x4c4a67=0x0;_0x4c4a67<_0x5d8d39[_0xdce6('0x62')];_0x4c4a67++){if(_0x354a81!=''){_0x354a81+='&';}_0x354a81+=_0x5d8d39[_0x4c4a67]+'='+encodeURIComponent(_0x589b2d[_0x5d8d39[_0x4c4a67]]);_0x18c4b4+=_0x589b2d[_0x5d8d39[_0x4c4a67]];}_0x18c4b4+=_0x35a925['apiKey'];_0x18c4b4=_0x2c6821['createHash'](_0xdce6('0x63'))[_0xdce6('0x3f')](_0x18c4b4)[_0xdce6('0x64')](_0xdce6('0x65'));if(_0x354a81!==''){_0x354a81+='&';}_0x354a81+=_0xdce6('0x66')+_0x18c4b4;var _0x1349f1={'method':_0xdce6('0x34'),'uri':_0x35a925[_0xdce6('0x53')]+_0xdce6('0x67')+_0x354a81,'json':!![]};return rp(_0x1349f1)[_0xdce6('0x1e')](function(_0x23dfb6){var _0x53664c=Object['keys'](_0x23dfb6);if(_0x23dfb6[_0x53664c[0x0]][_0xdce6('0x1b')]&&parseInt(_0x23dfb6[_0x53664c[0x0]][_0xdce6('0x1b')])===0x0){var _0x5c4d72={'messageId':_0x23dfb6[_0x53664c[0x0]][_0xdce6('0x68')]};if(!_0x35a925['deliveryReport']){_0x5c4d72['read']=!![];}return _0x35bff3[_0xdce6('0x3f')](_0x5c4d72);}else{return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'csc',util[_0xdce6('0x2b')](_0x23dfb6[_0xdce6('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x86e1da){return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'csc',util['inspect'](_0x86e1da,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'csc',_0xdce6('0x69'));}break;case _0xdce6('0x6a'):if(_0x35a925[_0xdce6('0x5b')]){var _0x5c5657={'method':'POST','uri':_0xdce6('0x6b'),'headers':{'Authorization':_0x35a925['apiKey']},'body':{'content':_0x48b910[_0xdce6('0xd')],'to':[_0x48b910[_0xdce6('0x21')]],'from':_0x35a925[_0xdce6('0x21')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x5c5657)[_0xdce6('0x1e')](function(_0x3676ea){if(!_0x3676ea[_0xdce6('0x1b')]){var _0x333e1a={'messageId':_0x3676ea[_0xdce6('0x23')][0x0]['apiMessageId']};if(!_0x35a925[_0xdce6('0x39')]){_0x333e1a['read']=!![];}return _0x35bff3[_0xdce6('0x3f')](_0x333e1a);}else{return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x6a'),util['inspect'](_0x3676ea[_0xdce6('0x1b')],{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x279b73){return logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x6a'),util['inspect'](_0x279b73,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x6a'),_0xdce6('0x69'));}break;case'bandwidth':if(_0x35a925[_0xdce6('0x30')]&&_0x35a925[_0xdce6('0x31')]){var _0x540ffa=util['format'](_0xdce6('0x42'),_0x35a925[_0xdce6('0x30')],_0x35a925[_0xdce6('0x31')]);var _0xed80b7={'method':_0xdce6('0x43'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x35a925[_0xdce6('0x6c')]+_0xdce6('0x6d'),'body':{'to':[_0x48b910['phone']],'text':_0x48b910[_0xdce6('0xd')],'from':_0x35a925['phone'],'applicationId':_0x35a925[_0xdce6('0x6e')]},'headers':{'Authorization':util[_0xdce6('0x41')](_0xdce6('0x45'),new Buffer(_0x540ffa)['toString'](_0xdce6('0x47')))},'json':!![]};rp(_0xed80b7)[_0xdce6('0x1e')](function(_0x10c5a5){if(_0x10c5a5['id']){var _0x1d9036={'messageId':_0x10c5a5['id']};return _0x35bff3[_0xdce6('0x3f')](_0x1d9036);}else{logger['error'](_0xdce6('0x2c'),'afterCreate',_0xdce6('0x6f'),util[_0xdce6('0x2b')](_0x10c5a5,{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x279bb9){logger[_0xdce6('0x1b')](_0xdce6('0x2c'),'afterCreate','bandwidth',util[_0xdce6('0x2b')](_0x279bb9,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),_0xdce6('0x6f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xdce6('0x70'):if(_0x35a925['apiKey']){var _0x291cdb={};var _0x1349f1={'method':_0xdce6('0x43'),'uri':_0xdce6('0x71'),'headers':{'Authorization':_0xdce6('0x72')+_0x35a925[_0xdce6('0x5b')],'Content-Type':_0xdce6('0x55')},'body':{'from':_0x35a925['phone'],'to':_0x48b910[_0xdce6('0x21')],'text':_0x48b910[_0xdce6('0xd')]},'json':!![]};return rp(_0x1349f1)[_0xdce6('0x1e')](function(_0x348721){if(_0x348721[_0xdce6('0x73')]==0xca){_0x291cdb[_0xdce6('0x74')]=_0x348721;var _0x109e58={'method':_0xdce6('0x43'),'uri':_0xdce6('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x35a925['apiKey'],'Content-Type':_0xdce6('0x55')},'body':{'refid':_0x291cdb[_0xdce6('0x74')][_0xdce6('0x76')]},'json':!![]};return rp(_0x109e58)['then'](function(_0x462f46){_0x291cdb['status']=_0x462f46;var _0x2df27b={'messageId':_0x291cdb[_0xdce6('0x74')][_0xdce6('0x76')],'read':!![]};return _0x35bff3[_0xdce6('0x3f')](_0x2df27b);});}else{return logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),'intelepeer',util[_0xdce6('0x2b')](_0x348721,{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x3d35c1){return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'intelepeer',util[_0xdce6('0x2b')](_0x3d35c1,{'showHidden':![],'depth':null}));});}else{return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x70'),_0xdce6('0x77'));}break;}}})[_0xdce6('0x78')](function(){_0x1bcd1c();});}else{_0x1bcd1c();}}},'charset':_0xdce6('0x79'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8c41=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','messageId','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','find','type','twilio','accountSid','phone','authToken','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','login?username=','&password=','GET','split','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','data','queued_count','head','messages','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','sender','text','timestamp','keys','sort','length','createHash','md5','hex','signature=','apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','intelepeer','Token\x20not\x20received','finally'];(function(_0x22544b,_0x301001){var _0x245051=function(_0x1dcd9b){while(--_0x1dcd9b){_0x22544b['push'](_0x22544b['shift']());}};_0x245051(++_0x301001);}(_0x8c41,0x1dd));var _0x18c4=function(_0x5b3b34,_0x426d9b){_0x5b3b34=_0x5b3b34-0x0;var _0x16b72b=_0x8c41[_0x5b3b34];return _0x16b72b;};'use strict';var _=require(_0x18c4('0x0'));var util=require(_0x18c4('0x1'));var logger=require(_0x18c4('0x2'))(_0x18c4('0x3'));var moment=require(_0x18c4('0x4'));var BPromise=require(_0x18c4('0x5'));var rp=require(_0x18c4('0x6'));var fs=require('fs');var path=require(_0x18c4('0x7'));var rimraf=require(_0x18c4('0x8'));var config=require(_0x18c4('0x9'));var attributes=require(_0x18c4('0xa'));module[_0x18c4('0xb')]=function(_0x2a59cd,_0x5e7474){return _0x2a59cd[_0x18c4('0xc')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x18c4('0xd'),'fields':[_0x18c4('0xd')]},{'name':'fti_sms_messages','fields':[_0x18c4('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45fd75,_0x1fc467,_0x28583b){var _0x11c73=_0x2a59cd[_0x18c4('0xf')];var _0x3e17a7=_0x45fd75[_0x18c4('0x10')]({'plain':!![]});if(_0x3e17a7[_0x18c4('0x11')]['toLowerCase']()==='in'||_0x3e17a7[_0x18c4('0x11')][_0x18c4('0x12')]()===_0x18c4('0x13')&&!_0x3e17a7[_0x18c4('0x14')]&&!_[_0x18c4('0x15')](_0x3e17a7[_0x18c4('0x16')])&&!_[_0x18c4('0x15')](_0x3e17a7[_0x18c4('0x17')])){_0x11c73[_0x18c4('0x18')]['findOne']({'where':{'id':_0x3e17a7['SmsInteractionId']}})[_0x18c4('0x19')](function(_0xff270e){if(_0xff270e){_0xff270e[_0x18c4('0x1a')]({'lastMsgAt':_0x3e17a7[_0x18c4('0x1b')],'lastMsgDirection':_0x3e17a7['direction'][_0x18c4('0x12')]()});}})[_0x18c4('0x1c')](function(_0xd35189){console[_0x18c4('0x1d')](_0xd35189);});}if(_0x3e17a7['direction']===_0x18c4('0x13')&&!_0x3e17a7[_0x18c4('0x14')]){var _0x2756be;_0x11c73['SmsAccount'][_0x18c4('0x1e')]({'where':{'id':_0x3e17a7['SmsAccountId']},'raw':!![]})[_0x18c4('0x19')](function(_0xbc3298){_0x2756be=_0xbc3298;if(_0x2756be&&_0x2756be['type']){switch(_0x2756be[_0x18c4('0x1f')]){case _0x18c4('0x20'):var _0x1d924d=require('twilio');if(_0x2756be[_0x18c4('0x21')]&&_0x2756be['authToken']&&_0x2756be[_0x18c4('0x22')]){var _0x2e6bf9=new _0x1d924d(_0x2756be['accountSid'],_0x2756be[_0x18c4('0x23')]);_0x2e6bf9['messages'][_0x18c4('0x24')]({'body':_0x3e17a7['body'],'to':_0x3e17a7[_0x18c4('0x22')],'from':_0x2756be[_0x18c4('0x22')],'statusCallback':_0x2756be[_0x18c4('0x25')]+'/api/sms/messages/'+_0x3e17a7['id']+_0x18c4('0x26')+_0x2756be[_0x18c4('0x27')]})[_0x18c4('0x19')](function(_0x55e537){if(_0x55e537[_0x18c4('0x28')]){return _0x45fd75['update']({'messageId':_0x55e537[_0x18c4('0x28')]});}})['catch'](function(_0x2bbdda){logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x20'),util['inspect'](_0x2bbdda,{'showHidden':![],'depth':null}));});}else{logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x20'),_0x18c4('0x2b'));}break;case _0x18c4('0x2c'):var _0x973c81='https://api.skebby.it/API/v1.0/REST/';if(_0x2756be[_0x18c4('0x2d')]&&_0x2756be[_0x18c4('0x2e')]){var _0x45656b={'recipient':[_0x3e17a7['phone']],'message':_0x3e17a7[_0x18c4('0xe')],'message_type':_0x2756be[_0x18c4('0x2f')]};if(_0x2756be[_0x18c4('0x2f')]&&_0x2756be[_0x18c4('0x2f')]!=='SI'){_0x45656b['sender']=_0x2756be[_0x18c4('0x22')];}var _0x5ba22b={'url':_0x973c81+_0x18c4('0x30')+_0x2756be[_0x18c4('0x2d')]+_0x18c4('0x31')+_0x2756be[_0x18c4('0x2e')],'method':_0x18c4('0x32')};rp(_0x5ba22b)[_0x18c4('0x19')](function(_0x46e275){var _0x164723=_0x46e275[_0x18c4('0x33')](';');var _0x36a7de={'user_key':_0x164723[0x0],'session_key':_0x164723[0x1]};_0x5ba22b={'url':_0x973c81+'sms','method':_0x18c4('0x34'),'headers':{'user_key':_0x36a7de['user_key'],'Session_key':_0x36a7de[_0x18c4('0x35')]},'json':!![],'body':_0x45656b};return rp(_0x5ba22b);})[_0x18c4('0x19')](function(_0x416e41){if(_0x416e41[_0x18c4('0x36')]>=0x1){var _0x4a0bfc={'messageId':_0x416e41[_0x18c4('0x37')]};if(_0x2756be[_0x18c4('0x2f')]!=='GP'||!_0x2756be[_0x18c4('0x38')]){_0x4a0bfc[_0x18c4('0x39')]=!![];}return _0x45fd75[_0x18c4('0x1a')](_0x4a0bfc);}else{return logger[_0x18c4('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18c4('0x2a'),'skebby',util['inspect'](_0x416e41,{'showHidden':![],'depth':null}));}})[_0x18c4('0x1c')](function(_0x38b0c2){return logger[_0x18c4('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18c4('0x2a'),'skebby',util[_0x18c4('0x3a')](_0x38b0c2,{'showHidden':![],'depth':null}));});}else{logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x2c'),_0x18c4('0x3b'));}break;case _0x18c4('0x3c'):if(_0x2756be[_0x18c4('0x23')]){var _0x2d2544={'recipient':_0x3e17a7[_0x18c4('0x22')],'message':_0x3e17a7['body'],'sender':_0x2756be[_0x18c4('0x3d')]||_0x2756be[_0x18c4('0x22')],'authorization':_0x2756be[_0x18c4('0x23')]};var _0x1fc467={'method':_0x18c4('0x34'),'uri':_0x18c4('0x3e'),'body':_0x2d2544,'json':!![]};rp(_0x1fc467)[_0x18c4('0x19')](function(_0x1a922d){var _0x417d16={'messageId':_0x1a922d['requestid']};if(!_0x2756be[_0x18c4('0x38')]){_0x417d16['read']=!![];}return _0x45fd75[_0x18c4('0x1a')](_0x417d16);})[_0x18c4('0x1c')](function(_0x448199){logger[_0x18c4('0x1d')](_0x18c4('0x29'),'afterCreate',_0x18c4('0x3c'),util[_0x18c4('0x3a')](_0x448199,{'showHidden':![],'depth':null}));});}else{logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),'connectel',_0x18c4('0x3f'));}break;case'clicksend':if(_0x2756be[_0x18c4('0x2d')]&&_0x2756be['password']){var _0x2d2544={'messages':[{'source':_0x18c4('0x40'),'to':_0x3e17a7['phone'],'body':_0x3e17a7['body'],'from':_0x2756be[_0x18c4('0x3d')]||_0x2756be[_0x18c4('0x22')]}]};var _0x3d9f29=util[_0x18c4('0x41')](_0x18c4('0x42'),_0x2756be[_0x18c4('0x2d')],_0x2756be[_0x18c4('0x2e')]);var _0x1fc467={'method':_0x18c4('0x34'),'uri':_0x18c4('0x43'),'body':_0x2d2544,'headers':{'Authorization':util['format'](_0x18c4('0x44'),new Buffer(_0x3d9f29)[_0x18c4('0x45')](_0x18c4('0x46')))},'json':!![]};rp(_0x1fc467)[_0x18c4('0x19')](function(_0x505799){if(_0x505799['http_code']>=0xc8&&_0x505799['http_code']<=0xce){if(_0x505799[_0x18c4('0x47')]&&_0x505799[_0x18c4('0x47')][_0x18c4('0x48')]>0x0){var _0x16e0e0=_[_0x18c4('0x49')](_0x505799['data'][_0x18c4('0x4a')]);var _0x3dab6d={'messageId':_0x16e0e0[_0x18c4('0x4b')]};if(!_0x2756be[_0x18c4('0x38')]){_0x3dab6d[_0x18c4('0x39')]=!![];}return _0x45fd75[_0x18c4('0x1a')](_0x3dab6d);}else{logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),'clickSend',util[_0x18c4('0x3a')](_0x505799,{'showHidden':![],'depth':null}));}}else{logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x4c'),util['inspect'](_0x505799,{'showHidden':![],'depth':null}));}})[_0x18c4('0x1c')](function(_0x357f98){logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x4c'),util[_0x18c4('0x3a')](_0x357f98,{'showHidden':![],'depth':null}));});}else{logger[_0x18c4('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x18c4('0x4c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x18c4('0x4d'):if(_0x2756be['authId']&&_0x2756be[_0x18c4('0x23')]){var _0x2d2544={'dst':_0x3e17a7['phone'],'text':_0x3e17a7[_0x18c4('0xe')],'src':_0x2756be['senderString']||_0x2756be[_0x18c4('0x22')],'url':_0x2756be['remote']+'/api/sms/messages/'+_0x3e17a7['id']+_0x18c4('0x26')+_0x2756be[_0x18c4('0x27')]};var _0x3d9f29=util[_0x18c4('0x41')](_0x18c4('0x42'),_0x2756be[_0x18c4('0x4e')],_0x2756be[_0x18c4('0x23')]);var _0x1fc467={'method':'POST','uri':util[_0x18c4('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2756be[_0x18c4('0x4e')]),'body':_0x2d2544,'headers':{'Authorization':util[_0x18c4('0x41')](_0x18c4('0x44'),new Buffer(_0x3d9f29)[_0x18c4('0x45')](_0x18c4('0x46')))},'json':!![]};rp(_0x1fc467)['then'](function(_0x27eb82){var _0x56c807={'messageId':_0x27eb82[_0x18c4('0x4f')][0x0]};return _0x45fd75['update'](_0x56c807);})[_0x18c4('0x1c')](function(_0x4618fa){logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x4d'),util[_0x18c4('0x3a')](_0x4618fa,{'showHidden':![],'depth':null}));});}else{logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x4d'),_0x18c4('0x50'));}break;case _0x18c4('0x51'):if(_0x2756be[_0x18c4('0x2d')]&&_0x2756be['password']){if(_0x2756be[_0x18c4('0x52')]){var _0x3e58fa={'method':_0x18c4('0x34'),'uri':_0x2756be['baseUrl']+_0x18c4('0x53'),'body':{'username':_0x2756be['username'],'password':_0x2756be['password']},'json':!![]};return rp(_0x3e58fa)[_0x18c4('0x19')](function(_0x3449d8){var _0x58a21a={'method':_0x18c4('0x34'),'uri':_0x2756be[_0x18c4('0x52')]+_0x18c4('0x54'),'body':{'messages':[{'from':_0x2756be[_0x18c4('0x22')],'destinations':[{'to':_0x3e17a7['phone']}],'text':_0x3e17a7[_0x18c4('0xe')],'notifyUrl':_0x2756be[_0x18c4('0x25')]+'/api/sms/messages/'+_0x3e17a7['id']+_0x18c4('0x26')+_0x2756be[_0x18c4('0x27')],'notifyContentType':_0x18c4('0x55'),'callbackData':_0x2756be[_0x18c4('0x22')]+';'+_0x3e17a7[_0x18c4('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x3449d8[_0x18c4('0x27')]},'json':!![]};return rp(_0x58a21a)['then'](function(_0x19b69b){if(_0x19b69b[_0x18c4('0x4a')]){var _0x4137fd={'messageId':_0x19b69b[_0x18c4('0x4a')][0x0]['messageId']};if(!_0x2756be[_0x18c4('0x38')]){_0x4137fd[_0x18c4('0x39')]=!![];}return _0x45fd75[_0x18c4('0x1a')](_0x4137fd);}else{return logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x51'),util[_0x18c4('0x3a')](_0x19b69b,{'showHidden':![],'depth':null}));}});})[_0x18c4('0x1c')](function(_0x281d47){return logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x51'),util[_0x18c4('0x3a')](_0x281d47,{'showHidden':![],'depth':null}));});}else{logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x51'),_0x18c4('0x56'));}}else{logger['error'](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x51'),_0x18c4('0x3b'));}break;case _0x18c4('0x57'):var _0x169da8=require(_0x18c4('0x58'));if(_0x2756be['apiKey']){var _0x1efd03={};_0x1efd03[_0x18c4('0x59')]=_0x2756be[_0x18c4('0x2d')];_0x1efd03[_0x18c4('0x22')]=_0x3e17a7[_0x18c4('0x22')];_0x1efd03[_0x18c4('0x5a')]=_0x2756be['phone'];_0x1efd03[_0x18c4('0x5b')]=_0x3e17a7['body'];_0x1efd03[_0x18c4('0x5c')]=+new Date();var _0x15e71a='';var _0x522c55='';var _0x2f822a=Object[_0x18c4('0x5d')](_0x1efd03);_0x2f822a[_0x18c4('0x5e')]();for(var _0x5b061b=0x0;_0x5b061b<_0x2f822a[_0x18c4('0x5f')];_0x5b061b++){if(_0x15e71a!=''){_0x15e71a+='&';}_0x15e71a+=_0x2f822a[_0x5b061b]+'='+encodeURIComponent(_0x1efd03[_0x2f822a[_0x5b061b]]);_0x522c55+=_0x1efd03[_0x2f822a[_0x5b061b]];}_0x522c55+=_0x2756be['apiKey'];_0x522c55=_0x169da8[_0x18c4('0x60')](_0x18c4('0x61'))['update'](_0x522c55)['digest'](_0x18c4('0x62'));if(_0x15e71a!==''){_0x15e71a+='&';}_0x15e71a+=_0x18c4('0x63')+_0x522c55;var _0x5ba22b={'method':_0x18c4('0x32'),'uri':_0x2756be[_0x18c4('0x52')]+'/external/get/send.php?'+_0x15e71a,'json':!![]};return rp(_0x5ba22b)[_0x18c4('0x19')](function(_0x5c5b4a){var _0x35b1db=Object[_0x18c4('0x5d')](_0x5c5b4a);if(_0x5c5b4a[_0x35b1db[0x0]][_0x18c4('0x1d')]&&parseInt(_0x5c5b4a[_0x35b1db[0x0]][_0x18c4('0x1d')])===0x0){var _0x3fb5d9={'messageId':_0x5c5b4a[_0x35b1db[0x0]]['id_sms']};if(!_0x2756be['deliveryReport']){_0x3fb5d9[_0x18c4('0x39')]=!![];}return _0x45fd75[_0x18c4('0x1a')](_0x3fb5d9);}else{return logger['error'](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x57'),util[_0x18c4('0x3a')](_0x5c5b4a[_0x18c4('0x1d')],{'showHidden':![],'depth':null}));}})[_0x18c4('0x1c')](function(_0x2d1fd4){return logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x57'),util['inspect'](_0x2d1fd4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x18c4('0x29'),'afterCreate',_0x18c4('0x57'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x2756be[_0x18c4('0x64')]){var _0x94b0aa={'method':_0x18c4('0x34'),'uri':_0x18c4('0x65'),'headers':{'Authorization':_0x2756be[_0x18c4('0x64')]},'body':{'content':_0x3e17a7[_0x18c4('0xe')],'to':[_0x3e17a7[_0x18c4('0x22')]],'from':_0x2756be[_0x18c4('0x22')],'binary':![],'clientMessageId':_0x18c4('0x66'),'charset':'UTF-8'},'json':!![]};rp(_0x94b0aa)[_0x18c4('0x19')](function(_0x209443){if(!_0x209443[_0x18c4('0x1d')]){var _0x30dbca={'messageId':_0x209443[_0x18c4('0x4a')][0x0][_0x18c4('0x67')]};if(!_0x2756be[_0x18c4('0x38')]){_0x30dbca[_0x18c4('0x39')]=!![];}return _0x45fd75['update'](_0x30dbca);}else{return logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x68'),util[_0x18c4('0x3a')](_0x209443[_0x18c4('0x1d')],{'showHidden':![],'depth':null}));}})[_0x18c4('0x1c')](function(_0x5a6571){return logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),'clickatell',util[_0x18c4('0x3a')](_0x5a6571,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x68'),_0x18c4('0x69'));}break;case'bandwidth':if(_0x2756be['username']&&_0x2756be[_0x18c4('0x2e')]){var _0x3d9f29=util[_0x18c4('0x41')](_0x18c4('0x42'),_0x2756be[_0x18c4('0x2d')],_0x2756be[_0x18c4('0x2e')]);var _0x1fc467={'method':_0x18c4('0x34'),'uri':_0x18c4('0x6a')+_0x2756be[_0x18c4('0x6b')]+_0x18c4('0x6c'),'body':{'to':[_0x3e17a7[_0x18c4('0x22')]],'text':_0x3e17a7['body'],'from':_0x2756be['phone'],'applicationId':_0x2756be[_0x18c4('0x6d')]},'headers':{'Authorization':util[_0x18c4('0x41')](_0x18c4('0x44'),new Buffer(_0x3d9f29)[_0x18c4('0x45')](_0x18c4('0x46')))},'json':!![]};rp(_0x1fc467)['then'](function(_0x11fb7f){if(_0x11fb7f['id']){var _0x29ef76={'messageId':_0x11fb7f['id']};return _0x45fd75['update'](_0x29ef76);}else{logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x6e'),util[_0x18c4('0x3a')](_0x11fb7f,{'showHidden':![],'depth':null}));}})[_0x18c4('0x1c')](function(_0x373351){logger[_0x18c4('0x1d')](_0x18c4('0x29'),'afterCreate',_0x18c4('0x6e'),util[_0x18c4('0x3a')](_0x373351,{'showHidden':![],'depth':null}));});}else{logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),'bandwidth',_0x18c4('0x3b'));}break;case'intelepeer':if(_0x2756be[_0x18c4('0x64')]){var _0x4fc8fe={};var _0x5ba22b={'method':_0x18c4('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x18c4('0x6f')+_0x2756be['apiKey'],'Content-Type':_0x18c4('0x55')},'body':{'from':_0x2756be[_0x18c4('0x22')],'to':_0x3e17a7[_0x18c4('0x22')],'text':_0x3e17a7['body']},'json':!![]};return rp(_0x5ba22b)['then'](function(_0x3bc975){if(_0x3bc975['code']==0xca){_0x4fc8fe['message']=_0x3bc975;var _0x2e456e={'method':_0x18c4('0x34'),'uri':_0x18c4('0x70'),'headers':{'Authorization':_0x18c4('0x6f')+_0x2756be[_0x18c4('0x64')],'Content-Type':_0x18c4('0x55')},'body':{'refid':_0x4fc8fe[_0x18c4('0x71')]['refid']},'json':!![]};return rp(_0x2e456e)[_0x18c4('0x19')](function(_0x1b5554){_0x4fc8fe['status']=_0x1b5554;var _0x50019d={'messageId':_0x4fc8fe[_0x18c4('0x71')][_0x18c4('0x72')],'read':!![]};return _0x45fd75[_0x18c4('0x1a')](_0x50019d);});}else{return logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),'intelepeer',util[_0x18c4('0x3a')](_0x3bc975,{'showHidden':![],'depth':null}));}})[_0x18c4('0x1c')](function(_0x638128){return logger[_0x18c4('0x1d')](_0x18c4('0x29'),_0x18c4('0x2a'),_0x18c4('0x73'),util[_0x18c4('0x3a')](_0x638128,{'showHidden':![],'depth':null}));});}else{return logger[_0x18c4('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18c4('0x2a'),_0x18c4('0x73'),_0x18c4('0x74'));}break;}}})[_0x18c4('0x75')](function(){_0x28583b();});}else{_0x28583b();}}},'charset':'utf8mb4','collate':_0x18c4('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ea3f10d..27ddc23 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 _0x7268=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','lodash','util','moment','bluebird','ioredis'];(function(_0x18e124,_0x5ca114){var _0x2f335a=function(_0x2d752e){while(--_0x2d752e){_0x18e124['push'](_0x18e124['shift']());}};_0x2f335a(++_0x5ca114);}(_0x7268,0x123));var _0x8726=function(_0x3c88cd,_0xe662d6){_0x3c88cd=_0x3c88cd-0x0;var _0x2753f3=_0x7268[_0x3c88cd];return _0x2753f3;};'use strict';var _=require(_0x8726('0x0'));var util=require(_0x8726('0x1'));var moment=require(_0x8726('0x2'));var BPromise=require(_0x8726('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8726('0x4'));var db=require(_0x8726('0x5'))['db'];var utils=require(_0x8726('0x6'));var logger=require(_0x8726('0x7'))(_0x8726('0x8'));var config=require(_0x8726('0x9'));var jayson=require(_0x8726('0xa'));var client=jayson[_0x8726('0xb')][_0x8726('0xc')]({'port':0x232a});config[_0x8726('0xd')]=_[_0x8726('0xe')](config[_0x8726('0xd')],{'host':_0x8726('0xf'),'port':0x18eb});var socket=require(_0x8726('0x10'))(new Redis(config[_0x8726('0xd')]));require(_0x8726('0x11'))[_0x8726('0x12')](socket);function respondWithRpcPromise(_0x4b2296,_0x34350c,_0x5a6383){return new BPromise(function(_0x2fc73a,_0x928262){return client[_0x8726('0x13')](_0x4b2296,_0x5a6383)[_0x8726('0x14')](function(_0xb64fbb){logger['info'](_0x8726('0x15'),_0x34350c,_0x8726('0x16'));logger[_0x8726('0x17')](_0x8726('0x18'),_0x34350c,'request\x20sent',JSON[_0x8726('0x19')](_0xb64fbb));if(_0xb64fbb[_0x8726('0x1a')]){if(_0xb64fbb['error'][_0x8726('0x1b')]===0x1f4){logger[_0x8726('0x1a')](_0x8726('0x15'),_0x34350c,_0xb64fbb[_0x8726('0x1a')][_0x8726('0x1c')]);return _0x928262(_0xb64fbb[_0x8726('0x1a')][_0x8726('0x1c')]);}logger[_0x8726('0x1a')](_0x8726('0x15'),_0x34350c,_0xb64fbb[_0x8726('0x1a')]['message']);return _0x2fc73a(_0xb64fbb[_0x8726('0x1a')]['message']);}else{logger[_0x8726('0x1d')](_0x8726('0x15'),_0x34350c,_0x8726('0x16'));_0x2fc73a(_0xb64fbb[_0x8726('0x1e')][_0x8726('0x1c')]);}})[_0x8726('0x1f')](function(_0x191e56){logger[_0x8726('0x1a')](_0x8726('0x15'),_0x34350c,_0x191e56);_0x928262(_0x191e56);});});}exports[_0x8726('0x20')]=function(_0x2e0a2a){var _0x4c8916=this;return new Promise(function(_0x5aee0e,_0x2ceec2){return db[_0x8726('0x21')][_0x8726('0x22')](_0x2e0a2a['body'],{'raw':_0x2e0a2a[_0x8726('0x23')]?_0x2e0a2a[_0x8726('0x23')][_0x8726('0x24')]===undefined?!![]:![]:!![]})[_0x8726('0x14')](function(_0x2bbaac){logger['info'](_0x8726('0x20'),_0x2e0a2a);logger[_0x8726('0x17')]('CreateSmsMessage',_0x2e0a2a,JSON['stringify'](_0x2bbaac));_0x5aee0e(_0x2bbaac);})[_0x8726('0x1f')](function(_0x3daa3a){logger[_0x8726('0x1a')](_0x8726('0x20'),_0x3daa3a[_0x8726('0x1c')],_0x2e0a2a);_0x2ceec2(_0x4c8916[_0x8726('0x1a')](0x1f4,_0x3daa3a['message']));});});}; \ No newline at end of file +var _0x0cf1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','raw','then','catch','lodash','util','moment','randomstring'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x0cf1,0x11c));var _0x10cf=function(_0x3e9131,_0x1f86d4){_0x3e9131=_0x3e9131-0x0;var _0x444856=_0x0cf1[_0x3e9131];return _0x444856;};'use strict';var _=require(_0x10cf('0x0'));var util=require(_0x10cf('0x1'));var moment=require(_0x10cf('0x2'));var BPromise=require('bluebird');var rs=require(_0x10cf('0x3'));var fs=require('fs');var Redis=require(_0x10cf('0x4'));var db=require(_0x10cf('0x5'))['db'];var utils=require(_0x10cf('0x6'));var logger=require(_0x10cf('0x7'))(_0x10cf('0x8'));var config=require(_0x10cf('0x9'));var jayson=require(_0x10cf('0xa'));var client=jayson[_0x10cf('0xb')][_0x10cf('0xc')]({'port':0x232a});config[_0x10cf('0xd')]=_[_0x10cf('0xe')](config['redis'],{'host':_0x10cf('0xf'),'port':0x18eb});var socket=require(_0x10cf('0x10'))(new Redis(config[_0x10cf('0xd')]));require('./smsMessage.socket')[_0x10cf('0x11')](socket);function respondWithRpcPromise(_0x5c1284,_0x562b08,_0x1c273c){return new BPromise(function(_0xd9a77c,_0x4a6876){return client['request'](_0x5c1284,_0x1c273c)['then'](function(_0x2d03ef){logger[_0x10cf('0x12')](_0x10cf('0x13'),_0x562b08,_0x10cf('0x14'));logger[_0x10cf('0x15')](_0x10cf('0x16'),_0x562b08,_0x10cf('0x14'),JSON[_0x10cf('0x17')](_0x2d03ef));if(_0x2d03ef[_0x10cf('0x18')]){if(_0x2d03ef[_0x10cf('0x18')][_0x10cf('0x19')]===0x1f4){logger['error'](_0x10cf('0x13'),_0x562b08,_0x2d03ef[_0x10cf('0x18')][_0x10cf('0x1a')]);return _0x4a6876(_0x2d03ef[_0x10cf('0x18')][_0x10cf('0x1a')]);}logger[_0x10cf('0x18')](_0x10cf('0x13'),_0x562b08,_0x2d03ef[_0x10cf('0x18')][_0x10cf('0x1a')]);return _0xd9a77c(_0x2d03ef['error'][_0x10cf('0x1a')]);}else{logger['info'](_0x10cf('0x13'),_0x562b08,_0x10cf('0x14'));_0xd9a77c(_0x2d03ef[_0x10cf('0x1b')][_0x10cf('0x1a')]);}})['catch'](function(_0x5e5597){logger[_0x10cf('0x18')](_0x10cf('0x13'),_0x562b08,_0x5e5597);_0x4a6876(_0x5e5597);});});}exports[_0x10cf('0x1c')]=function(_0x2264fb){var _0x5cdd02=this;return new Promise(function(_0x365489,_0x383e53){return db[_0x10cf('0x1d')][_0x10cf('0x1e')](_0x2264fb[_0x10cf('0x1f')],{'raw':_0x2264fb[_0x10cf('0x20')]?_0x2264fb[_0x10cf('0x20')][_0x10cf('0x21')]===undefined?!![]:![]:!![]})[_0x10cf('0x22')](function(_0x3d8fda){logger[_0x10cf('0x12')](_0x10cf('0x1c'),_0x2264fb);logger['debug'](_0x10cf('0x1c'),_0x2264fb,JSON[_0x10cf('0x17')](_0x3d8fda));_0x365489(_0x3d8fda);})[_0x10cf('0x23')](function(_0x4270dc){logger[_0x10cf('0x18')](_0x10cf('0x1c'),_0x4270dc[_0x10cf('0x1a')],_0x2264fb);_0x383e53(_0x5cdd02['error'](0x1f4,_0x4270dc[_0x10cf('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 3d290a7..0b1f2f9 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 _0x638f=['register','length','smsMessage:','./smsMessage.events','save','remove','update','removeListener'];(function(_0x574bbb,_0x54ccef){var _0x4e8cae=function(_0x337ffb){while(--_0x337ffb){_0x574bbb['push'](_0x574bbb['shift']());}};_0x4e8cae(++_0x54ccef);}(_0x638f,0x16b));var _0xf638=function(_0x20db5c,_0x3e2079){_0x20db5c=_0x20db5c-0x0;var _0x299b65=_0x638f[_0x20db5c];return _0x299b65;};'use strict';var SmsMessageEvents=require(_0xf638('0x0'));var events=[_0xf638('0x1'),_0xf638('0x2'),_0xf638('0x3')];function createListener(_0x36fb64,_0x3f62b5){return function(_0x33387a){_0x3f62b5['emit'](_0x36fb64,_0x33387a);};}function removeListener(_0x9c489d,_0x24250d){return function(){SmsMessageEvents[_0xf638('0x4')](_0x9c489d,_0x24250d);};}exports[_0xf638('0x5')]=function(_0x5233df){for(var _0x452767=0x0,_0x60cb7=events[_0xf638('0x6')];_0x452767<_0x60cb7;_0x452767++){var _0x303ade=events[_0x452767];var _0x22c251=createListener(_0xf638('0x7')+_0x303ade,_0x5233df);SmsMessageEvents['on'](_0x303ade,_0x22c251);}}; \ No newline at end of file +var _0x6e6c=['save','remove','removeListener','smsMessage:','./smsMessage.events'];(function(_0x4ea82f,_0x51a2b4){var _0x51769d=function(_0x41578e){while(--_0x41578e){_0x4ea82f['push'](_0x4ea82f['shift']());}};_0x51769d(++_0x51a2b4);}(_0x6e6c,0x194));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var SmsMessageEvents=require(_0xc6e6('0x0'));var events=[_0xc6e6('0x1'),_0xc6e6('0x2'),'update'];function createListener(_0x4313f3,_0x30da80){return function(_0x53fee5){_0x30da80['emit'](_0x4313f3,_0x53fee5);};}function removeListener(_0x27fdfe,_0x3bd593){return function(){SmsMessageEvents[_0xc6e6('0x3')](_0x27fdfe,_0x3bd593);};}exports['register']=function(_0x1949ea){for(var _0x6ac296=0x0,_0x3e6af7=events['length'];_0x6ac296<_0x3e6af7;_0x6ac296++){var _0x3e64a5=events[_0x6ac296];var _0x476764=createListener(_0xc6e6('0x4')+_0x3e64a5,_0x1949ea);SmsMessageEvents['on'](_0x3e64a5,_0x476764);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 811dc26..f8f0487 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 _0x8571=['delete','removeTeams','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update'];(function(_0x419ada,_0x31d2df){var _0x1e98da=function(_0x2c652c){while(--_0x2c652c){_0x419ada['push'](_0x419ada['shift']());}};_0x1e98da(++_0x31d2df);}(_0x8571,0x1e9));var _0x1857=function(_0x4f0ce6,_0x4b050b){_0x4f0ce6=_0x4f0ce6-0x0;var _0x3dbaab=_0x8571[_0x4f0ce6];return _0x3dbaab;};'use strict';var multer=require(_0x1857('0x0'));var util=require('util');var path=require(_0x1857('0x1'));var timeout=require('connect-timeout');var express=require(_0x1857('0x2'));var router=express['Router']();var fs_extra=require(_0x1857('0x3'));var auth=require(_0x1857('0x4'));var interaction=require(_0x1857('0x5'));var config=require(_0x1857('0x6'));var controller=require('./smsQueue.controller');router[_0x1857('0x7')]('/',auth['isAuthenticated'](),controller[_0x1857('0x8')]);router[_0x1857('0x7')](_0x1857('0x9'),auth[_0x1857('0xa')](),controller['describe']);router[_0x1857('0x7')](_0x1857('0xb'),auth[_0x1857('0xa')](),controller[_0x1857('0xc')]);router[_0x1857('0x7')](_0x1857('0xd'),auth['isAuthenticated'](),controller[_0x1857('0xe')]);router[_0x1857('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1857('0xf')]);router[_0x1857('0x7')](_0x1857('0x10'),auth[_0x1857('0xa')](),controller[_0x1857('0x11')]);router[_0x1857('0x12')]('/',auth[_0x1857('0xa')](),controller['create']);router['post'](_0x1857('0x13'),auth[_0x1857('0xa')](),controller[_0x1857('0x14')]);router['post'](_0x1857('0x10'),auth[_0x1857('0xa')](),controller[_0x1857('0x15')]);router[_0x1857('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x1857('0x17')]);router[_0x1857('0x18')](_0x1857('0xb'),auth[_0x1857('0xa')](),controller['destroy']);router[_0x1857('0x18')](_0x1857('0x13'),auth[_0x1857('0xa')](),controller[_0x1857('0x19')]);router[_0x1857('0x18')](_0x1857('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1857('0x1a')]=router; \ No newline at end of file +var _0x34e1=['create','addTeams','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x34e1,0x158));var _0x134e=function(_0xa960b0,_0x272162){_0xa960b0=_0xa960b0-0x0;var _0x44be7a=_0x34e1[_0xa960b0];return _0x44be7a;};'use strict';var multer=require(_0x134e('0x0'));var util=require(_0x134e('0x1'));var path=require('path');var timeout=require(_0x134e('0x2'));var express=require(_0x134e('0x3'));var router=express['Router']();var fs_extra=require(_0x134e('0x4'));var auth=require(_0x134e('0x5'));var interaction=require(_0x134e('0x6'));var config=require(_0x134e('0x7'));var controller=require(_0x134e('0x8'));router[_0x134e('0x9')]('/',auth[_0x134e('0xa')](),controller[_0x134e('0xb')]);router[_0x134e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x134e('0xc')]);router[_0x134e('0x9')]('/:id',auth[_0x134e('0xa')](),controller[_0x134e('0xd')]);router[_0x134e('0x9')](_0x134e('0xe'),auth[_0x134e('0xa')](),controller['getMembers']);router[_0x134e('0x9')](_0x134e('0xf'),auth[_0x134e('0xa')](),controller[_0x134e('0x10')]);router['get'](_0x134e('0x11'),auth['isAuthenticated'](),controller[_0x134e('0x12')]);router[_0x134e('0x13')]('/',auth[_0x134e('0xa')](),controller[_0x134e('0x14')]);router[_0x134e('0x13')](_0x134e('0xf'),auth['isAuthenticated'](),controller[_0x134e('0x15')]);router[_0x134e('0x13')](_0x134e('0x11'),auth[_0x134e('0xa')](),controller['addAgents']);router['put'](_0x134e('0x16'),auth[_0x134e('0xa')](),controller[_0x134e('0x17')]);router[_0x134e('0x18')]('/:id',auth[_0x134e('0xa')](),controller['destroy']);router[_0x134e('0x18')](_0x134e('0xf'),auth['isAuthenticated'](),controller[_0x134e('0x19')]);router[_0x134e('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x134e('0x1a')]);module[_0x134e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7fa7dd4..a395f2e 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 _0x0615=['name','INTEGER','ENUM','beepall','roundrobin','exports','STRING'];(function(_0x56d727,_0x32ce0d){var _0x160b5c=function(_0xddd682){while(--_0xddd682){_0x56d727['push'](_0x56d727['shift']());}};_0x160b5c(++_0x32ce0d);}(_0x0615,0xde));var _0x5061=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0615[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x5061('0x0')]={'name':{'type':Sequelize[_0x5061('0x1')],'unique':_0x5061('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5061('0x1')]},'timeout':{'type':Sequelize[_0x5061('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5061('0x4')]('rrmemory',_0x5061('0x5'),_0x5061('0x6'))}}; \ No newline at end of file +var _0x18f2=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','exports'];(function(_0x14583b,_0x324ab5){var _0x17bd36=function(_0xcb50c9){while(--_0xcb50c9){_0x14583b['push'](_0x14583b['shift']());}};_0x17bd36(++_0x324ab5);}(_0x18f2,0xa0));var _0x218f=function(_0x434698,_0xd4ec53){_0x434698=_0x434698-0x0;var _0x14e34e=_0x18f2[_0x434698];return _0x14e34e;};'use strict';var Sequelize=require('sequelize');module[_0x218f('0x0')]={'name':{'type':Sequelize[_0x218f('0x1')],'unique':_0x218f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x218f('0x1')]},'timeout':{'type':Sequelize[_0x218f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x218f('0x4')](_0x218f('0x5'),'beepall',_0x218f('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ede45e6..31eee97 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 _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x239dc7,_0x10df14){var _0x1ee670=function(_0x58a16b){while(--_0x58a16b){_0x239dc7['push'](_0x239dc7['shift']());}};_0x1ee670(++_0x10df14);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b301e,_0x388e77){_0x3b301e=_0x3b301e-0x0;var _0x47ac39=_0x5f2f[_0x3b301e];return _0x47ac39;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,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(_0x1bb9cb,_0x5c63aa){var _0x3e232d=function(_0x5ef2b0){while(--_0x5ef2b0){_0x1bb9cb['push'](_0x1bb9cb['shift']());}};_0x3e232d(++_0x5c63aa);}(_0xdb28,0x106));var _0x8db2=function(_0x1a700d,_0x70272c){_0x1a700d=_0x1a700d-0x0;var _0xa197d=_0xdb28[_0x1a700d];return _0xa197d;};'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 11a1c85..1516c92 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 _0x5e62=['emit','exports','SmsQueue','save','remove'];(function(_0x4f5887,_0x282239){var _0x228b54=function(_0xe3c271){while(--_0xe3c271){_0x4f5887['push'](_0x4f5887['shift']());}};_0x228b54(++_0x282239);}(_0x5e62,0x1ec));var _0x25e6=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x5e62[_0x3826ad];return _0x17b900;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x25e6('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x25e6('0x1'),'afterUpdate':'update','afterDestroy':_0x25e6('0x2')};function emitEvent(_0x38e190){return function(_0x1b4716,_0x6c818f,_0x555922){SmsQueueEvents[_0x25e6('0x3')](_0x38e190+':'+_0x1b4716['id'],_0x1b4716);SmsQueueEvents[_0x25e6('0x3')](_0x38e190,_0x1b4716);_0x555922(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x25e6('0x4')]=SmsQueueEvents; \ No newline at end of file +var _0xdace=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','SmsQueue'];(function(_0x12e51b,_0x2a5420){var _0xb24e1a=function(_0x53d57a){while(--_0x53d57a){_0x12e51b['push'](_0x12e51b['shift']());}};_0xb24e1a(++_0x2a5420);}(_0xdace,0xa9));var _0xedac=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0xdace[_0x39a2d6];return _0x23af66;};'use strict';var EventEmitter=require(_0xedac('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xedac('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xedac('0x2')](0x0);var events={'afterCreate':_0xedac('0x3'),'afterUpdate':_0xedac('0x4'),'afterDestroy':_0xedac('0x5')};function emitEvent(_0x413428){return function(_0x4703ed,_0x11d953,_0x472d8a){SmsQueueEvents[_0xedac('0x6')](_0x413428+':'+_0x4703ed['id'],_0x4703ed);SmsQueueEvents['emit'](_0x413428,_0x4703ed);_0x472d8a(null);};}for(var e in events){if(events[_0xedac('0x7')](e)){var event=events[e];SmsQueue[_0xedac('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 2cdba97..2865cd0 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 _0x2498=['path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e5f01,_0x2e05d9){var _0x1e94f3=function(_0x524d59){while(--_0x524d59){_0x2e5f01['push'](_0x2e5f01['shift']());}};_0x1e94f3(++_0x2e05d9);}(_0x2498,0x132));var _0x8249=function(_0x1afcb2,_0x4045cd){_0x1afcb2=_0x1afcb2-0x0;var _0x11cb27=_0x2498[_0x1afcb2];return _0x11cb27;};'use strict';var _=require('lodash');var util=require(_0x8249('0x0'));var logger=require(_0x8249('0x1'))(_0x8249('0x2'));var moment=require(_0x8249('0x3'));var BPromise=require(_0x8249('0x4'));var rp=require(_0x8249('0x5'));var fs=require('fs');var path=require(_0x8249('0x6'));var rimraf=require('rimraf');var config=require(_0x8249('0x7'));var attributes=require(_0x8249('0x8'));module[_0x8249('0x9')]=function(_0x4b4cc8,_0xa90be8){return _0x4b4cc8[_0x8249('0xa')](_0x8249('0xb'),attributes,{'tableName':_0x8249('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa076=['rimraf','../../config/environment','exports','define','sms_queues','lodash','util','moment','bluebird','request-promise','path'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xa076,0xb5));var _0x6a07=function(_0x63113f,_0x4e2135){_0x63113f=_0x63113f-0x0;var _0x47b839=_0xa076[_0x63113f];return _0x47b839;};'use strict';var _=require(_0x6a07('0x0'));var util=require(_0x6a07('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6a07('0x2'));var BPromise=require(_0x6a07('0x3'));var rp=require(_0x6a07('0x4'));var fs=require('fs');var path=require(_0x6a07('0x5'));var rimraf=require(_0x6a07('0x6'));var config=require(_0x6a07('0x7'));var attributes=require('./smsQueue.attributes');module[_0x6a07('0x8')]=function(_0x4f538f,_0x4f539e){return _0x4f538f[_0x6a07('0x9')]('SmsQueue',attributes,{'tableName':_0x6a07('0xa'),'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 178e024..e1961f2 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 _0xc98f=['client','redis','defaults','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','SmsQueue','options','where','include','map','model','attributes','info','ShowSmsQueue','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xc98f,0x81));var _0xfc98=function(_0x82d35a,_0x3e4858){_0x82d35a=_0x82d35a-0x0;var _0x54b078=_0xc98f[_0x82d35a];return _0x54b078;};'use strict';var _=require('lodash');var util=require(_0xfc98('0x0'));var moment=require(_0xfc98('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc98('0x2'));var db=require(_0xfc98('0x3'))['db'];var utils=require(_0xfc98('0x4'));var logger=require(_0xfc98('0x5'))('rpc');var config=require(_0xfc98('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfc98('0x7')]['http']({'port':0x232a});config[_0xfc98('0x8')]=_[_0xfc98('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc98('0x8')]));require(_0xfc98('0xa'))[_0xfc98('0xb')](socket);function respondWithRpcPromise(_0x16a89b,_0x1bd6d8,_0x224189){return new BPromise(function(_0x261c41,_0x45a3dc){return client[_0xfc98('0xc')](_0x16a89b,_0x224189)[_0xfc98('0xd')](function(_0x55fda4){logger['info'](_0xfc98('0xe'),_0x1bd6d8,_0xfc98('0xf'));logger[_0xfc98('0x10')](_0xfc98('0x11'),_0x1bd6d8,'request\x20sent',JSON[_0xfc98('0x12')](_0x55fda4));if(_0x55fda4[_0xfc98('0x13')]){if(_0x55fda4[_0xfc98('0x13')][_0xfc98('0x14')]===0x1f4){logger[_0xfc98('0x13')]('SmsQueue,\x20%s,\x20%s',_0x1bd6d8,_0x55fda4[_0xfc98('0x13')][_0xfc98('0x15')]);return _0x45a3dc(_0x55fda4[_0xfc98('0x13')][_0xfc98('0x15')]);}logger[_0xfc98('0x13')]('SmsQueue,\x20%s,\x20%s',_0x1bd6d8,_0x55fda4[_0xfc98('0x13')][_0xfc98('0x15')]);return _0x261c41(_0x55fda4[_0xfc98('0x13')]['message']);}else{logger['info'](_0xfc98('0xe'),_0x1bd6d8,'request\x20sent');_0x261c41(_0x55fda4[_0xfc98('0x16')][_0xfc98('0x15')]);}})['catch'](function(_0x178ffb){logger[_0xfc98('0x13')](_0xfc98('0xe'),_0x1bd6d8,_0x178ffb);_0x45a3dc(_0x178ffb);});});}exports[_0xfc98('0x17')]=function(_0x2905ea){var _0x3ab0bb=this;return new Promise(function(_0x4ebac9,_0x9df101){return db[_0xfc98('0x18')]['findAll']({'raw':_0x2905ea[_0xfc98('0x19')]?_0x2905ea[_0xfc98('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2905ea[_0xfc98('0x19')]?_0x2905ea[_0xfc98('0x19')][_0xfc98('0x1a')]||null:null,'attributes':_0x2905ea['options']?_0x2905ea[_0xfc98('0x19')]['attributes']||null:null,'limit':_0x2905ea[_0xfc98('0x19')]?_0x2905ea[_0xfc98('0x19')]['limit']||null:null,'include':_0x2905ea[_0xfc98('0x19')]?_0x2905ea[_0xfc98('0x19')][_0xfc98('0x1b')]?_[_0xfc98('0x1c')](_0x2905ea[_0xfc98('0x19')]['include'],function(_0x25414a){return{'model':db[_0x25414a[_0xfc98('0x1d')]],'as':_0x25414a['as'],'attributes':_0x25414a[_0xfc98('0x1e')],'include':_0x25414a[_0xfc98('0x1b')]?_[_0xfc98('0x1c')](_0x25414a[_0xfc98('0x1b')],function(_0x3cc05a){return{'model':db[_0x3cc05a[_0xfc98('0x1d')]],'as':_0x3cc05a['as'],'attributes':_0x3cc05a[_0xfc98('0x1e')],'include':_0x3cc05a['include']?_[_0xfc98('0x1c')](_0x3cc05a[_0xfc98('0x1b')],function(_0x641b66){return{'model':db[_0x641b66[_0xfc98('0x1d')]],'as':_0x641b66['as'],'attributes':_0x641b66[_0xfc98('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc98('0xd')](function(_0x4cfa4f){logger[_0xfc98('0x1f')](_0xfc98('0x17'),_0x2905ea);logger['debug']('GetSmsQueue',_0x2905ea,JSON[_0xfc98('0x12')](_0x4cfa4f));_0x4ebac9(_0x4cfa4f);})['catch'](function(_0x25340d){logger[_0xfc98('0x13')](_0xfc98('0x17'),_0x25340d[_0xfc98('0x15')],_0x2905ea);_0x9df101(_0x3ab0bb['error'](0x1f4,_0x25340d[_0xfc98('0x15')]));});});};exports[_0xfc98('0x20')]=function(_0x47395c){var _0x13f52a=this;return new Promise(function(_0x527c08,_0xce667){return db['SmsQueue'][_0xfc98('0x21')]({'raw':_0x47395c[_0xfc98('0x19')]?_0x47395c['options']['raw']===undefined?!![]:![]:!![],'where':_0x47395c[_0xfc98('0x19')]?_0x47395c[_0xfc98('0x19')][_0xfc98('0x1a')]||null:null,'attributes':_0x47395c[_0xfc98('0x19')]?_0x47395c[_0xfc98('0x19')][_0xfc98('0x1e')]||null:null,'include':_0x47395c['options']?_0x47395c['options'][_0xfc98('0x1b')]?_[_0xfc98('0x1c')](_0x47395c[_0xfc98('0x19')][_0xfc98('0x1b')],function(_0x5ab76b){return{'model':db[_0x5ab76b[_0xfc98('0x1d')]],'as':_0x5ab76b['as'],'attributes':_0x5ab76b[_0xfc98('0x1e')],'include':_0x5ab76b[_0xfc98('0x1b')]?_['map'](_0x5ab76b[_0xfc98('0x1b')],function(_0x2b93d0){return{'model':db[_0x2b93d0['model']],'as':_0x2b93d0['as'],'attributes':_0x2b93d0[_0xfc98('0x1e')],'include':_0x2b93d0['include']?_['map'](_0x2b93d0[_0xfc98('0x1b')],function(_0x36e586){return{'model':db[_0x36e586[_0xfc98('0x1d')]],'as':_0x36e586['as'],'attributes':_0x36e586[_0xfc98('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc98('0xd')](function(_0x4dbadd){logger[_0xfc98('0x1f')]('ShowSmsQueue',_0x47395c);logger[_0xfc98('0x10')](_0xfc98('0x20'),_0x47395c,JSON[_0xfc98('0x12')](_0x4dbadd));_0x527c08(_0x4dbadd);})['catch'](function(_0x4ef434){logger[_0xfc98('0x13')](_0xfc98('0x20'),_0x4ef434[_0xfc98('0x15')],_0x47395c);_0xce667(_0x13f52a[_0xfc98('0x13')](0x1f4,_0x4ef434[_0xfc98('0x15')]));});});}; \ No newline at end of file +var _0xbd4c=['attributes','GetSmsQueue','ShowSmsQueue','SmsQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','model'];(function(_0x387df7,_0x9cd2be){var _0x201664=function(_0x5e3a5b){while(--_0x5e3a5b){_0x387df7['push'](_0x387df7['shift']());}};_0x201664(++_0x9cd2be);}(_0xbd4c,0x1d8));var _0xcbd4=function(_0x24d725,_0x5ac0f3){_0x24d725=_0x24d725-0x0;var _0x529dac=_0xbd4c[_0x24d725];return _0x529dac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcbd4('0x0'));var BPromise=require(_0xcbd4('0x1'));var rs=require(_0xcbd4('0x2'));var fs=require('fs');var Redis=require(_0xcbd4('0x3'));var db=require(_0xcbd4('0x4'))['db'];var utils=require(_0xcbd4('0x5'));var logger=require(_0xcbd4('0x6'))(_0xcbd4('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbd4('0x8'));var client=jayson[_0xcbd4('0x9')][_0xcbd4('0xa')]({'port':0x232a});config[_0xcbd4('0xb')]=_[_0xcbd4('0xc')](config[_0xcbd4('0xb')],{'host':_0xcbd4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbd4('0xb')]));require(_0xcbd4('0xe'))[_0xcbd4('0xf')](socket);function respondWithRpcPromise(_0x553847,_0xcbf4a,_0x2d1706){return new BPromise(function(_0x3d657e,_0x24449e){return client['request'](_0x553847,_0x2d1706)[_0xcbd4('0x10')](function(_0x1b4758){logger[_0xcbd4('0x11')](_0xcbd4('0x12'),_0xcbf4a,_0xcbd4('0x13'));logger[_0xcbd4('0x14')](_0xcbd4('0x15'),_0xcbf4a,_0xcbd4('0x13'),JSON[_0xcbd4('0x16')](_0x1b4758));if(_0x1b4758['error']){if(_0x1b4758[_0xcbd4('0x17')][_0xcbd4('0x18')]===0x1f4){logger[_0xcbd4('0x17')](_0xcbd4('0x12'),_0xcbf4a,_0x1b4758[_0xcbd4('0x17')][_0xcbd4('0x19')]);return _0x24449e(_0x1b4758[_0xcbd4('0x17')][_0xcbd4('0x19')]);}logger[_0xcbd4('0x17')](_0xcbd4('0x12'),_0xcbf4a,_0x1b4758[_0xcbd4('0x17')]['message']);return _0x3d657e(_0x1b4758[_0xcbd4('0x17')][_0xcbd4('0x19')]);}else{logger[_0xcbd4('0x11')](_0xcbd4('0x12'),_0xcbf4a,_0xcbd4('0x13'));_0x3d657e(_0x1b4758[_0xcbd4('0x1a')]['message']);}})[_0xcbd4('0x1b')](function(_0x3cc99b){logger[_0xcbd4('0x17')](_0xcbd4('0x12'),_0xcbf4a,_0x3cc99b);_0x24449e(_0x3cc99b);});});}exports['GetSmsQueue']=function(_0x139271){var _0x52ea33=this;return new Promise(function(_0x3a93a3,_0x34d59e){return db['SmsQueue'][_0xcbd4('0x1c')]({'raw':_0x139271[_0xcbd4('0x1d')]?_0x139271[_0xcbd4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x139271[_0xcbd4('0x1d')]?_0x139271[_0xcbd4('0x1d')][_0xcbd4('0x1e')]||null:null,'attributes':_0x139271[_0xcbd4('0x1d')]?_0x139271[_0xcbd4('0x1d')]['attributes']||null:null,'limit':_0x139271[_0xcbd4('0x1d')]?_0x139271['options'][_0xcbd4('0x1f')]||null:null,'include':_0x139271[_0xcbd4('0x1d')]?_0x139271[_0xcbd4('0x1d')][_0xcbd4('0x20')]?_[_0xcbd4('0x21')](_0x139271[_0xcbd4('0x1d')][_0xcbd4('0x20')],function(_0x5ac35d){return{'model':db[_0x5ac35d[_0xcbd4('0x22')]],'as':_0x5ac35d['as'],'attributes':_0x5ac35d['attributes'],'include':_0x5ac35d[_0xcbd4('0x20')]?_[_0xcbd4('0x21')](_0x5ac35d[_0xcbd4('0x20')],function(_0x398220){return{'model':db[_0x398220[_0xcbd4('0x22')]],'as':_0x398220['as'],'attributes':_0x398220[_0xcbd4('0x23')],'include':_0x398220[_0xcbd4('0x20')]?_[_0xcbd4('0x21')](_0x398220[_0xcbd4('0x20')],function(_0x50d8f0){return{'model':db[_0x50d8f0[_0xcbd4('0x22')]],'as':_0x50d8f0['as'],'attributes':_0x50d8f0[_0xcbd4('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcbd4('0x10')](function(_0x378043){logger[_0xcbd4('0x11')](_0xcbd4('0x24'),_0x139271);logger[_0xcbd4('0x14')](_0xcbd4('0x24'),_0x139271,JSON['stringify'](_0x378043));_0x3a93a3(_0x378043);})[_0xcbd4('0x1b')](function(_0x3fa135){logger[_0xcbd4('0x17')](_0xcbd4('0x24'),_0x3fa135[_0xcbd4('0x19')],_0x139271);_0x34d59e(_0x52ea33[_0xcbd4('0x17')](0x1f4,_0x3fa135[_0xcbd4('0x19')]));});});};exports[_0xcbd4('0x25')]=function(_0x2a1daa){var _0x332156=this;return new Promise(function(_0x253bfc,_0x10a0c9){return db[_0xcbd4('0x26')]['find']({'raw':_0x2a1daa[_0xcbd4('0x1d')]?_0x2a1daa[_0xcbd4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2a1daa['options']?_0x2a1daa['options'][_0xcbd4('0x1e')]||null:null,'attributes':_0x2a1daa[_0xcbd4('0x1d')]?_0x2a1daa['options'][_0xcbd4('0x23')]||null:null,'include':_0x2a1daa[_0xcbd4('0x1d')]?_0x2a1daa[_0xcbd4('0x1d')]['include']?_['map'](_0x2a1daa[_0xcbd4('0x1d')][_0xcbd4('0x20')],function(_0x4bae7b){return{'model':db[_0x4bae7b[_0xcbd4('0x22')]],'as':_0x4bae7b['as'],'attributes':_0x4bae7b[_0xcbd4('0x23')],'include':_0x4bae7b['include']?_['map'](_0x4bae7b[_0xcbd4('0x20')],function(_0x27486c){return{'model':db[_0x27486c[_0xcbd4('0x22')]],'as':_0x27486c['as'],'attributes':_0x27486c['attributes'],'include':_0x27486c[_0xcbd4('0x20')]?_[_0xcbd4('0x21')](_0x27486c[_0xcbd4('0x20')],function(_0x2a9844){return{'model':db[_0x2a9844[_0xcbd4('0x22')]],'as':_0x2a9844['as'],'attributes':_0x2a9844[_0xcbd4('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcbd4('0x10')](function(_0x510290){logger[_0xcbd4('0x11')]('ShowSmsQueue',_0x2a1daa);logger['debug'](_0xcbd4('0x25'),_0x2a1daa,JSON[_0xcbd4('0x16')](_0x510290));_0x253bfc(_0x510290);})[_0xcbd4('0x1b')](function(_0x26bc2a){logger['error']('ShowSmsQueue',_0x26bc2a[_0xcbd4('0x19')],_0x2a1daa);_0x10a0c9(_0x332156[_0xcbd4('0x17')](0x1f4,_0x26bc2a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 33d840a..3bc632d 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 _0x9d0a=['save','remove','emit','removeListener','register','smsQueue:'];(function(_0x431537,_0xb9bb6c){var _0x3a60cd=function(_0x5c9087){while(--_0x5c9087){_0x431537['push'](_0x431537['shift']());}};_0x3a60cd(++_0xb9bb6c);}(_0x9d0a,0xde));var _0xa9d0=function(_0x3944b3,_0xf05375){_0x3944b3=_0x3944b3-0x0;var _0xbf7a53=_0x9d0a[_0x3944b3];return _0xbf7a53;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xa9d0('0x0'),_0xa9d0('0x1'),'update'];function createListener(_0x3217f3,_0x292587){return function(_0x16d744){_0x292587[_0xa9d0('0x2')](_0x3217f3,_0x16d744);};}function removeListener(_0x569642,_0x3d39e3){return function(){SmsQueueEvents[_0xa9d0('0x3')](_0x569642,_0x3d39e3);};}exports[_0xa9d0('0x4')]=function(_0x451eac){for(var _0x45f9aa=0x0,_0x48e3e3=events['length'];_0x45f9aa<_0x48e3e3;_0x45f9aa++){var _0x13e849=events[_0x45f9aa];var _0x50d5ba=createListener(_0xa9d0('0x5')+_0x13e849,_0x451eac);SmsQueueEvents['on'](_0x13e849,_0x50d5ba);}}; \ No newline at end of file +var _0x2b1e=['emit','removeListener','register','length','save','remove'];(function(_0x441e82,_0x77d687){var _0x5efb76=function(_0x20520f){while(--_0x20520f){_0x441e82['push'](_0x441e82['shift']());}};_0x5efb76(++_0x77d687);}(_0x2b1e,0x13c));var _0xe2b1=function(_0x19b5ad,_0x50eb62){_0x19b5ad=_0x19b5ad-0x0;var _0x1da0d8=_0x2b1e[_0x19b5ad];return _0x1da0d8;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xe2b1('0x0'),_0xe2b1('0x1'),'update'];function createListener(_0xb935eb,_0x3f8f47){return function(_0xef3386){_0x3f8f47[_0xe2b1('0x2')](_0xb935eb,_0xef3386);};}function removeListener(_0x5e5978,_0x9decc2){return function(){SmsQueueEvents[_0xe2b1('0x3')](_0x5e5978,_0x9decc2);};}exports[_0xe2b1('0x4')]=function(_0x10d401){for(var _0x107eb2=0x0,_0x278117=events[_0xe2b1('0x5')];_0x107eb2<_0x278117;_0x107eb2++){var _0x3f3a00=events[_0x107eb2];var _0x2bfbfc=createListener('smsQueue:'+_0x3f3a00,_0x10d401);SmsQueueEvents['on'](_0x3f3a00,_0x2bfbfc);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e34807e..7486c5c 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 _0xba2d=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','util','../../components/auth/service'];(function(_0x133106,_0x156b40){var _0x5ddfac=function(_0x4765c3){while(--_0x4765c3){_0x133106['push'](_0x133106['shift']());}};_0x5ddfac(++_0x156b40);}(_0xba2d,0xa3));var _0xdba2=function(_0x10403d,_0x3a7685){_0x10403d=_0x10403d-0x0;var _0x2c6d9d=_0xba2d[_0x10403d];return _0x2c6d9d;};'use strict';var multer=require('multer');var util=require(_0xdba2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdba2('0x1'));var interaction=require(_0xdba2('0x2'));var config=require(_0xdba2('0x3'));var controller=require(_0xdba2('0x4'));router[_0xdba2('0x5')]('/',auth[_0xdba2('0x6')](),controller[_0xdba2('0x7')]);router[_0xdba2('0x5')]('/describe',auth[_0xdba2('0x6')](),controller['describe']);router[_0xdba2('0x5')](_0xdba2('0x8'),auth[_0xdba2('0x6')](),controller[_0xdba2('0x9')]);router[_0xdba2('0xa')]('/',auth[_0xdba2('0x6')](),controller['create']);router[_0xdba2('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdba2('0xc')](_0xdba2('0x8'),auth[_0xdba2('0x6')](),controller[_0xdba2('0xd')]);module[_0xdba2('0xe')]=router; \ No newline at end of file +var _0x6eb6=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x1b5094,_0x4b0c43){var _0x3b639b=function(_0x458ee5){while(--_0x458ee5){_0x1b5094['push'](_0x1b5094['shift']());}};_0x3b639b(++_0x4b0c43);}(_0x6eb6,0xbe));var _0x66eb=function(_0x5ed385,_0x3c99d4){_0x5ed385=_0x5ed385-0x0;var _0x53936d=_0x6eb6[_0x5ed385];return _0x53936d;};'use strict';var multer=require(_0x66eb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x66eb('0x1'));var express=require(_0x66eb('0x2'));var router=express[_0x66eb('0x3')]();var fs_extra=require(_0x66eb('0x4'));var auth=require(_0x66eb('0x5'));var interaction=require(_0x66eb('0x6'));var config=require(_0x66eb('0x7'));var controller=require(_0x66eb('0x8'));router[_0x66eb('0x9')]('/',auth['isAuthenticated'](),controller[_0x66eb('0xa')]);router[_0x66eb('0x9')]('/describe',auth[_0x66eb('0xb')](),controller[_0x66eb('0xc')]);router['get'](_0x66eb('0xd'),auth[_0x66eb('0xb')](),controller[_0x66eb('0xe')]);router[_0x66eb('0xf')]('/',auth[_0x66eb('0xb')](),controller[_0x66eb('0x10')]);router['put'](_0x66eb('0xd'),auth[_0x66eb('0xb')](),controller[_0x66eb('0x11')]);router[_0x66eb('0x12')](_0x66eb('0xd'),auth[_0x66eb('0xb')](),controller[_0x66eb('0x13')]);module[_0x66eb('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b347b6f..db6a944 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 _0xdf3b=['DATE','sequelize','STRING'];(function(_0x34668e,_0xcc9efb){var _0x1a9f0f=function(_0x119838){while(--_0x119838){_0x34668e['push'](_0x34668e['shift']());}};_0x1a9f0f(++_0xcc9efb);}(_0xdf3b,0x172));var _0xbdf3=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xdf3b[_0xbc1a4b];return _0x108b87;};'use strict';var moment=require('moment');var Sequelize=require(_0xbdf3('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbdf3('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xbdf3('0x1')]},'joinAt':{'type':Sequelize[_0xbdf3('0x2')]},'leaveAt':{'type':Sequelize[_0xbdf3('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbdf3('0x2')]},'reason':{'type':Sequelize[_0xbdf3('0x1')]}}; \ No newline at end of file +var _0x8939=['DATE','sequelize','exports','STRING'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x8939,0x12d));var _0x9893=function(_0x25baa6,_0x3616f6){_0x25baa6=_0x25baa6-0x0;var _0x533a86=_0x8939[_0x25baa6];return _0x533a86;};'use strict';var moment=require('moment');var Sequelize=require(_0x9893('0x0'));module[_0x9893('0x1')]={'uniqueid':{'type':Sequelize[_0x9893('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9893('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9893('0x3')]},'exitAt':{'type':Sequelize[_0x9893('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b8d5f94..c8b340e 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 _0x4514=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','pick','where','merge','VIRTUAL','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils'];(function(_0x2c09c5,_0x4c1ae3){var _0x4cc01d=function(_0x32bca0){while(--_0x32bca0){_0x2c09c5['push'](_0x2c09c5['shift']());}};_0x4cc01d(++_0x4c1ae3);}(_0x4514,0x1a8));var _0x4451=function(_0x408a02,_0x478ca0){_0x408a02=_0x408a02-0x0;var _0x579bce=_0x4514[_0x408a02];return _0x579bce;};'use strict';var emlformat=require(_0x4451('0x0'));var rimraf=require(_0x4451('0x1'));var zipdir=require(_0x4451('0x2'));var jsonpatch=require(_0x4451('0x3'));var rp=require(_0x4451('0x4'));var moment=require('moment');var BPromise=require(_0x4451('0x5'));var Mustache=require('mustache');var util=require(_0x4451('0x6'));var path=require(_0x4451('0x7'));var sox=require(_0x4451('0x8'));var csv=require(_0x4451('0x9'));var ejs=require(_0x4451('0xa'));var fs=require('fs');var fs_extra=require(_0x4451('0xb'));var _=require(_0x4451('0xc'));var squel=require('squel');var crypto=require(_0x4451('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4451('0xe'));var toCsv=require(_0x4451('0x9'));var querystring=require('querystring');var Papa=require(_0x4451('0xf'));var Redis=require(_0x4451('0x10'));var authService=require(_0x4451('0x11'));var qs=require(_0x4451('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4451('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4451('0x14'));var db=require(_0x4451('0x15'))['db'];function respondWithStatusCode(_0x304ccc,_0x258466){_0x258466=_0x258466||0xcc;return function(_0x6e7a47){if(_0x6e7a47){return _0x304ccc[_0x4451('0x16')](_0x258466);}return _0x304ccc[_0x4451('0x17')](_0x258466)[_0x4451('0x18')]();};}function respondWithResult(_0x4dd8cc,_0x1ed4a5){_0x1ed4a5=_0x1ed4a5||0xc8;return function(_0x2868fb){if(_0x2868fb){return _0x4dd8cc[_0x4451('0x17')](_0x1ed4a5)[_0x4451('0x19')](_0x2868fb);}};}function respondWithFilteredResult(_0x51168b,_0x21a56c){return function(_0x3944bf){if(_0x3944bf){var _0x1a83e3=typeof _0x21a56c[_0x4451('0x1a')]===_0x4451('0x1b')&&typeof _0x21a56c['limit']===_0x4451('0x1b');var _0x48bbde=_0x3944bf['count'];var _0xb21d46=_0x1a83e3?0x0:_0x21a56c['offset'];var _0x534567=_0x1a83e3?_0x3944bf[_0x4451('0x1c')]:_0x21a56c[_0x4451('0x1a')]+_0x21a56c[_0x4451('0x1d')];var _0x4b00b4;if(_0x534567>=_0x48bbde){_0x534567=_0x48bbde;_0x4b00b4=0xc8;}else{_0x4b00b4=0xce;}_0x51168b[_0x4451('0x17')](_0x4b00b4);return _0x51168b[_0x4451('0x1e')](_0x4451('0x1f'),_0xb21d46+'-'+_0x534567+'/'+_0x48bbde)['json'](_0x3944bf);}return null;};}function patchUpdates(_0x4086b6){return function(_0x119578){try{jsonpatch[_0x4451('0x20')](_0x119578,_0x4086b6,!![]);}catch(_0x31dc5c){return BPromise[_0x4451('0x21')](_0x31dc5c);}return _0x119578[_0x4451('0x22')]();};}function saveUpdates(_0x1e83ea,_0x5c50f0){return function(_0x367da3){if(_0x367da3){return _0x367da3[_0x4451('0x23')](_0x1e83ea)[_0x4451('0x24')](function(_0x229d50){return _0x229d50;});}return null;};}function removeEntity(_0xd97006,_0x9693b4){return function(_0xf078c5){if(_0xf078c5){return _0xf078c5[_0x4451('0x25')]()[_0x4451('0x24')](function(){_0xd97006[_0x4451('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd171,_0x5696d5){return function(_0x48b96a){if(!_0x48b96a){_0x3cd171[_0x4451('0x16')](0x194);}return _0x48b96a;};}function handleError(_0x517cce,_0x23601f){_0x23601f=_0x23601f||0x1f4;return function(_0x21a17d){logger[_0x4451('0x26')](_0x21a17d[_0x4451('0x27')]);if(_0x21a17d[_0x4451('0x28')]){delete _0x21a17d['name'];}_0x517cce[_0x4451('0x17')](_0x23601f)[_0x4451('0x29')](_0x21a17d);};}exports[_0x4451('0x2a')]=function(_0x24c67f,_0x4b8cd6){var _0x48476d={},_0x209e7d={},_0x281d77={'count':0x0,'rows':[]};var _0x489c11=_[_0x4451('0x2b')](db['SmsQueueReport'][_0x4451('0x2c')],function(_0x4709a3){return{'name':_0x4709a3[_0x4451('0x2d')],'type':_0x4709a3[_0x4451('0x2e')][_0x4451('0x2f')]};});_0x209e7d[_0x4451('0x30')]=_['map'](_0x489c11,_0x4451('0x28'));_0x209e7d[_0x4451('0x31')]=_[_0x4451('0x32')](_0x24c67f['query']);_0x209e7d[_0x4451('0x33')]=_[_0x4451('0x34')](_0x209e7d[_0x4451('0x30')],_0x209e7d[_0x4451('0x31')]);_0x48476d['attributes']=_[_0x4451('0x34')](_0x209e7d[_0x4451('0x30')],qs[_0x4451('0x35')](_0x24c67f[_0x4451('0x31')]['fields']));_0x48476d[_0x4451('0x36')]=_0x48476d[_0x4451('0x36')][_0x4451('0x37')]?_0x48476d[_0x4451('0x36')]:_0x209e7d[_0x4451('0x30')];if(!_0x24c67f[_0x4451('0x31')]['hasOwnProperty'](_0x4451('0x38'))){_0x48476d['limit']=qs[_0x4451('0x1d')](_0x24c67f[_0x4451('0x31')]['limit']);_0x48476d[_0x4451('0x1a')]=qs[_0x4451('0x1a')](_0x24c67f[_0x4451('0x31')][_0x4451('0x1a')]);}_0x48476d['order']=qs['sort'](_0x24c67f[_0x4451('0x31')]['sort']);_0x48476d['where']=qs[_0x4451('0x33')](_[_0x4451('0x39')](_0x24c67f['query'],_0x209e7d[_0x4451('0x33')]),_0x489c11);if(_0x24c67f[_0x4451('0x31')]['filter']){_0x48476d[_0x4451('0x3a')]=_[_0x4451('0x3b')](_0x48476d[_0x4451('0x3a')],{'$or':_['map'](_0x489c11,function(_0x2cfeb9){if(_0x2cfeb9[_0x4451('0x2e')]!==_0x4451('0x3c')){var _0x3f33a7={};_0x3f33a7[_0x2cfeb9[_0x4451('0x28')]]={'$like':'%'+_0x24c67f[_0x4451('0x31')]['filter']+'%'};return _0x3f33a7;}})});}_0x48476d=_[_0x4451('0x3b')]({},_0x48476d,_0x24c67f['options']);var _0x2658d7={'where':_0x48476d['where']};return db[_0x4451('0x3d')][_0x4451('0x1c')](_0x2658d7)[_0x4451('0x24')](function(_0xa9f9){_0x281d77[_0x4451('0x1c')]=_0xa9f9;if(_0x24c67f[_0x4451('0x31')][_0x4451('0x3e')]){_0x48476d[_0x4451('0x3f')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x4451('0x40')](_0x48476d);})['then'](function(_0x417791){_0x281d77[_0x4451('0x41')]=_0x417791;return _0x281d77;})[_0x4451('0x24')](respondWithFilteredResult(_0x4b8cd6,_0x48476d))[_0x4451('0x42')](handleError(_0x4b8cd6,null));};exports[_0x4451('0x43')]=function(_0x29c5ec,_0x23c077){var _0x12d010={'raw':!![],'where':{'id':_0x29c5ec[_0x4451('0x44')]['id']}},_0x109587={};_0x109587['model']=_[_0x4451('0x32')](db[_0x4451('0x3d')][_0x4451('0x2c')]);_0x109587[_0x4451('0x31')]=_[_0x4451('0x32')](_0x29c5ec[_0x4451('0x31')]);_0x109587[_0x4451('0x33')]=_[_0x4451('0x34')](_0x109587[_0x4451('0x30')],_0x109587[_0x4451('0x31')]);_0x12d010[_0x4451('0x36')]=_[_0x4451('0x34')](_0x109587[_0x4451('0x30')],qs[_0x4451('0x35')](_0x29c5ec[_0x4451('0x31')][_0x4451('0x35')]));_0x12d010[_0x4451('0x36')]=_0x12d010['attributes']['length']?_0x12d010[_0x4451('0x36')]:_0x109587[_0x4451('0x30')];if(_0x29c5ec[_0x4451('0x31')][_0x4451('0x3e')]){_0x12d010[_0x4451('0x3f')]=[{'all':!![]}];}_0x12d010=_[_0x4451('0x3b')]({},_0x12d010,_0x29c5ec[_0x4451('0x45')]);return db[_0x4451('0x3d')][_0x4451('0x46')](_0x12d010)['then'](handleEntityNotFound(_0x23c077,null))[_0x4451('0x24')](respondWithResult(_0x23c077,null))[_0x4451('0x42')](handleError(_0x23c077,null));};exports[_0x4451('0x47')]=function(_0x46d516,_0x7a25fd){return db['SmsQueueReport'][_0x4451('0x47')](_0x46d516[_0x4451('0x48')],{})[_0x4451('0x24')](respondWithResult(_0x7a25fd,0xc9))['catch'](handleError(_0x7a25fd,null));};exports['update']=function(_0xca66f3,_0x469922){if(_0xca66f3[_0x4451('0x48')]['id']){delete _0xca66f3[_0x4451('0x48')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0xca66f3[_0x4451('0x44')]['id']}})[_0x4451('0x24')](handleEntityNotFound(_0x469922,null))['then'](saveUpdates(_0xca66f3[_0x4451('0x48')],null))[_0x4451('0x24')](respondWithResult(_0x469922,null))[_0x4451('0x42')](handleError(_0x469922,null));};exports[_0x4451('0x25')]=function(_0x870349,_0x4f5337){return db[_0x4451('0x3d')][_0x4451('0x46')]({'where':{'id':_0x870349[_0x4451('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f5337,null))['then'](removeEntity(_0x4f5337,null))[_0x4451('0x42')](handleError(_0x4f5337,null));};exports[_0x4451('0x49')]=function(_0x41d452,_0x1b80d2){return db[_0x4451('0x3d')][_0x4451('0x49')]()[_0x4451('0x24')](respondWithResult(_0x1b80d2,null))[_0x4451('0x42')](handleError(_0x1b80d2,null));}; \ No newline at end of file +var _0xe05f=['send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueueReport','includeAll','include','rows','catch','params','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name'];(function(_0x2dee27,_0x58a14e){var _0x24c440=function(_0x4352b3){while(--_0x4352b3){_0x2dee27['push'](_0x2dee27['shift']());}};_0x24c440(++_0x58a14e);}(_0xe05f,0xb4));var _0xfe05=function(_0xc29ada,_0x5d11b7){_0xc29ada=_0xc29ada-0x0;var _0x619490=_0xe05f[_0xc29ada];return _0x619490;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe05('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfe05('0x1'));var moment=require(_0xfe05('0x2'));var BPromise=require(_0xfe05('0x3'));var Mustache=require(_0xfe05('0x4'));var util=require(_0xfe05('0x5'));var path=require(_0xfe05('0x6'));var sox=require(_0xfe05('0x7'));var csv=require(_0xfe05('0x8'));var ejs=require(_0xfe05('0x9'));var fs=require('fs');var fs_extra=require(_0xfe05('0xa'));var _=require(_0xfe05('0xb'));var squel=require(_0xfe05('0xc'));var crypto=require('crypto');var jsforce=require(_0xfe05('0xd'));var deskjs=require(_0xfe05('0xe'));var toCsv=require(_0xfe05('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfe05('0xf'));var authService=require(_0xfe05('0x10'));var qs=require(_0xfe05('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe05('0x12'));var logger=require(_0xfe05('0x13'))(_0xfe05('0x14'));var utils=require(_0xfe05('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x576cb9,_0x4d0a14){_0x4d0a14=_0x4d0a14||0xcc;return function(_0x446928){if(_0x446928){return _0x576cb9['sendStatus'](_0x4d0a14);}return _0x576cb9[_0xfe05('0x16')](_0x4d0a14)[_0xfe05('0x17')]();};}function respondWithResult(_0x978fd8,_0x2bda03){_0x2bda03=_0x2bda03||0xc8;return function(_0x2b1aaa){if(_0x2b1aaa){return _0x978fd8[_0xfe05('0x16')](_0x2bda03)[_0xfe05('0x18')](_0x2b1aaa);}};}function respondWithFilteredResult(_0x59c240,_0x4cbe60){return function(_0x82756c){if(_0x82756c){var _0x3eb699=typeof _0x4cbe60[_0xfe05('0x19')]===_0xfe05('0x1a')&&typeof _0x4cbe60['limit']===_0xfe05('0x1a');var _0x51ae19=_0x82756c['count'];var _0x4d89cf=_0x3eb699?0x0:_0x4cbe60[_0xfe05('0x19')];var _0x336193=_0x3eb699?_0x82756c[_0xfe05('0x1b')]:_0x4cbe60['offset']+_0x4cbe60[_0xfe05('0x1c')];var _0x134089;if(_0x336193>=_0x51ae19){_0x336193=_0x51ae19;_0x134089=0xc8;}else{_0x134089=0xce;}_0x59c240[_0xfe05('0x16')](_0x134089);return _0x59c240[_0xfe05('0x1d')](_0xfe05('0x1e'),_0x4d89cf+'-'+_0x336193+'/'+_0x51ae19)['json'](_0x82756c);}return null;};}function patchUpdates(_0x3cbc77){return function(_0x268082){try{jsonpatch['apply'](_0x268082,_0x3cbc77,!![]);}catch(_0x572537){return BPromise[_0xfe05('0x1f')](_0x572537);}return _0x268082['save']();};}function saveUpdates(_0x16653b,_0x371e12){return function(_0x2f2821){if(_0x2f2821){return _0x2f2821[_0xfe05('0x20')](_0x16653b)[_0xfe05('0x21')](function(_0x5d3768){return _0x5d3768;});}return null;};}function removeEntity(_0x165f58,_0x528431){return function(_0x4eb139){if(_0x4eb139){return _0x4eb139[_0xfe05('0x22')]()[_0xfe05('0x21')](function(){_0x165f58[_0xfe05('0x16')](0xcc)[_0xfe05('0x17')]();});}};}function handleEntityNotFound(_0x272877,_0x2f393a){return function(_0x302b91){if(!_0x302b91){_0x272877[_0xfe05('0x23')](0x194);}return _0x302b91;};}function handleError(_0x37b34e,_0x5431b5){_0x5431b5=_0x5431b5||0x1f4;return function(_0x5d27d3){logger[_0xfe05('0x24')](_0x5d27d3[_0xfe05('0x25')]);if(_0x5d27d3['name']){delete _0x5d27d3[_0xfe05('0x26')];}_0x37b34e['status'](_0x5431b5)[_0xfe05('0x27')](_0x5d27d3);};}exports[_0xfe05('0x28')]=function(_0x1fc25d,_0x23325d){var _0x5e6fb0={},_0x1ecd3d={},_0x3deec1={'count':0x0,'rows':[]};var _0x433199=_[_0xfe05('0x29')](db['SmsQueueReport'][_0xfe05('0x2a')],function(_0x369ee6){return{'name':_0x369ee6[_0xfe05('0x2b')],'type':_0x369ee6[_0xfe05('0x2c')][_0xfe05('0x2d')]};});_0x1ecd3d[_0xfe05('0x2e')]=_[_0xfe05('0x29')](_0x433199,_0xfe05('0x26'));_0x1ecd3d['query']=_[_0xfe05('0x2f')](_0x1fc25d[_0xfe05('0x30')]);_0x1ecd3d[_0xfe05('0x31')]=_['intersection'](_0x1ecd3d['model'],_0x1ecd3d[_0xfe05('0x30')]);_0x5e6fb0[_0xfe05('0x32')]=_[_0xfe05('0x33')](_0x1ecd3d[_0xfe05('0x2e')],qs[_0xfe05('0x34')](_0x1fc25d[_0xfe05('0x30')][_0xfe05('0x34')]));_0x5e6fb0[_0xfe05('0x32')]=_0x5e6fb0[_0xfe05('0x32')][_0xfe05('0x35')]?_0x5e6fb0[_0xfe05('0x32')]:_0x1ecd3d[_0xfe05('0x2e')];if(!_0x1fc25d[_0xfe05('0x30')][_0xfe05('0x36')](_0xfe05('0x37'))){_0x5e6fb0[_0xfe05('0x1c')]=qs[_0xfe05('0x1c')](_0x1fc25d[_0xfe05('0x30')][_0xfe05('0x1c')]);_0x5e6fb0['offset']=qs[_0xfe05('0x19')](_0x1fc25d[_0xfe05('0x30')][_0xfe05('0x19')]);}_0x5e6fb0['order']=qs[_0xfe05('0x38')](_0x1fc25d['query'][_0xfe05('0x38')]);_0x5e6fb0[_0xfe05('0x39')]=qs[_0xfe05('0x31')](_[_0xfe05('0x3a')](_0x1fc25d[_0xfe05('0x30')],_0x1ecd3d[_0xfe05('0x31')]),_0x433199);if(_0x1fc25d[_0xfe05('0x30')][_0xfe05('0x3b')]){_0x5e6fb0[_0xfe05('0x39')]=_[_0xfe05('0x3c')](_0x5e6fb0[_0xfe05('0x39')],{'$or':_['map'](_0x433199,function(_0x2ae45e){if(_0x2ae45e[_0xfe05('0x2c')]!==_0xfe05('0x3d')){var _0x39b072={};_0x39b072[_0x2ae45e[_0xfe05('0x26')]]={'$like':'%'+_0x1fc25d[_0xfe05('0x30')][_0xfe05('0x3b')]+'%'};return _0x39b072;}})});}_0x5e6fb0=_[_0xfe05('0x3c')]({},_0x5e6fb0,_0x1fc25d[_0xfe05('0x3e')]);var _0x696052={'where':_0x5e6fb0['where']};return db[_0xfe05('0x3f')][_0xfe05('0x1b')](_0x696052)[_0xfe05('0x21')](function(_0x2ed0db){_0x3deec1['count']=_0x2ed0db;if(_0x1fc25d[_0xfe05('0x30')][_0xfe05('0x40')]){_0x5e6fb0[_0xfe05('0x41')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x5e6fb0);})[_0xfe05('0x21')](function(_0x27f33c){_0x3deec1[_0xfe05('0x42')]=_0x27f33c;return _0x3deec1;})['then'](respondWithFilteredResult(_0x23325d,_0x5e6fb0))[_0xfe05('0x43')](handleError(_0x23325d,null));};exports['show']=function(_0x59ede9,_0x4e768f){var _0x634b19={'raw':!![],'where':{'id':_0x59ede9[_0xfe05('0x44')]['id']}},_0x3e16f6={};_0x3e16f6[_0xfe05('0x2e')]=_[_0xfe05('0x2f')](db[_0xfe05('0x3f')]['rawAttributes']);_0x3e16f6[_0xfe05('0x30')]=_[_0xfe05('0x2f')](_0x59ede9[_0xfe05('0x30')]);_0x3e16f6['filters']=_['intersection'](_0x3e16f6[_0xfe05('0x2e')],_0x3e16f6[_0xfe05('0x30')]);_0x634b19[_0xfe05('0x32')]=_['intersection'](_0x3e16f6[_0xfe05('0x2e')],qs['fields'](_0x59ede9[_0xfe05('0x30')][_0xfe05('0x34')]));_0x634b19[_0xfe05('0x32')]=_0x634b19[_0xfe05('0x32')][_0xfe05('0x35')]?_0x634b19[_0xfe05('0x32')]:_0x3e16f6['model'];if(_0x59ede9[_0xfe05('0x30')][_0xfe05('0x40')]){_0x634b19[_0xfe05('0x41')]=[{'all':!![]}];}_0x634b19=_['merge']({},_0x634b19,_0x59ede9['options']);return db[_0xfe05('0x3f')][_0xfe05('0x45')](_0x634b19)[_0xfe05('0x21')](handleEntityNotFound(_0x4e768f,null))['then'](respondWithResult(_0x4e768f,null))['catch'](handleError(_0x4e768f,null));};exports[_0xfe05('0x46')]=function(_0x57f5d4,_0x1ea31c){return db[_0xfe05('0x3f')]['create'](_0x57f5d4[_0xfe05('0x47')],{})[_0xfe05('0x21')](respondWithResult(_0x1ea31c,0xc9))[_0xfe05('0x43')](handleError(_0x1ea31c,null));};exports[_0xfe05('0x20')]=function(_0x228d38,_0x1bef5a){if(_0x228d38[_0xfe05('0x47')]['id']){delete _0x228d38['body']['id'];}return db['SmsQueueReport'][_0xfe05('0x45')]({'where':{'id':_0x228d38[_0xfe05('0x44')]['id']}})['then'](handleEntityNotFound(_0x1bef5a,null))[_0xfe05('0x21')](saveUpdates(_0x228d38['body'],null))[_0xfe05('0x21')](respondWithResult(_0x1bef5a,null))[_0xfe05('0x43')](handleError(_0x1bef5a,null));};exports[_0xfe05('0x22')]=function(_0x288598,_0x140599){return db[_0xfe05('0x3f')][_0xfe05('0x45')]({'where':{'id':_0x288598['params']['id']}})[_0xfe05('0x21')](handleEntityNotFound(_0x140599,null))[_0xfe05('0x21')](removeEntity(_0x140599,null))['catch'](handleError(_0x140599,null));};exports['describe']=function(_0xc18b35,_0x4677eb){return db[_0xfe05('0x3f')][_0xfe05('0x48')]()[_0xfe05('0x21')](respondWithResult(_0x4677eb,null))[_0xfe05('0x43')](handleError(_0x4677eb,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ceeeb0d..fd8c85f 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x4888e0,_0x35f563){var _0x346fee=function(_0x4bc27b){while(--_0x4bc27b){_0x4888e0['push'](_0x4888e0['shift']());}};_0x346fee(++_0x35f563);}(_0xe706,0xa3));var _0x6e70=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xe706[_0x548200];return _0x1a6d74;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 63e3067..9f1072f 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 _0x03e3=['http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x5cbf3a,_0x31b32b){var _0x360805=function(_0x13b23a){while(--_0x13b23a){_0x5cbf3a['push'](_0x5cbf3a['shift']());}};_0x360805(++_0x31b32b);}(_0x03e3,0xee));var _0x303e=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x03e3[_0x279d37];return _0x530173;};'use strict';var _=require(_0x303e('0x0'));var util=require('util');var moment=require(_0x303e('0x1'));var BPromise=require(_0x303e('0x2'));var rs=require(_0x303e('0x3'));var fs=require('fs');var Redis=require(_0x303e('0x4'));var db=require(_0x303e('0x5'))['db'];var utils=require(_0x303e('0x6'));var logger=require(_0x303e('0x7'))('rpc');var config=require(_0x303e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x303e('0x9')][_0x303e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x292c5f,_0x82b6fa,_0x229e40){return new BPromise(function(_0x48819e,_0xba13b5){return client['request'](_0x292c5f,_0x229e40)[_0x303e('0xb')](function(_0x573e9e){logger[_0x303e('0xc')](_0x303e('0xd'),_0x82b6fa,_0x303e('0xe'));logger[_0x303e('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x82b6fa,_0x303e('0xe'),JSON[_0x303e('0x10')](_0x573e9e));if(_0x573e9e[_0x303e('0x11')]){if(_0x573e9e[_0x303e('0x11')][_0x303e('0x12')]===0x1f4){logger[_0x303e('0x11')](_0x303e('0xd'),_0x82b6fa,_0x573e9e[_0x303e('0x11')][_0x303e('0x13')]);return _0xba13b5(_0x573e9e['error'][_0x303e('0x13')]);}logger[_0x303e('0x11')](_0x303e('0xd'),_0x82b6fa,_0x573e9e[_0x303e('0x11')][_0x303e('0x13')]);return _0x48819e(_0x573e9e['error'][_0x303e('0x13')]);}else{logger[_0x303e('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x82b6fa,_0x303e('0xe'));_0x48819e(_0x573e9e[_0x303e('0x14')][_0x303e('0x13')]);}})[_0x303e('0x15')](function(_0x4d9d46){logger[_0x303e('0x11')](_0x303e('0xd'),_0x82b6fa,_0x4d9d46);_0xba13b5(_0x4d9d46);});});}exports[_0x303e('0x16')]=function(_0x3e1f43){var _0x3199db=this;return new Promise(function(_0x3d2ff3,_0x545235){return db[_0x303e('0x17')][_0x303e('0x18')](_0x3e1f43['body'],{'raw':_0x3e1f43['options']?_0x3e1f43[_0x303e('0x19')][_0x303e('0x1a')]===undefined?!![]:![]:!![]})[_0x303e('0xb')](function(_0x12bc88){logger['info'](_0x303e('0x16'),_0x3e1f43);logger[_0x303e('0xf')](_0x303e('0x16'),_0x3e1f43,JSON[_0x303e('0x10')](_0x12bc88));_0x3d2ff3(_0x12bc88);})[_0x303e('0x15')](function(_0x49195a){logger[_0x303e('0x11')](_0x303e('0x16'),_0x49195a[_0x303e('0x13')],_0x3e1f43);_0x545235(_0x3199db[_0x303e('0x11')](0x1f4,_0x49195a['message']));});});};exports[_0x303e('0x1b')]=function(_0x275d36){var _0x50965c=this;return new Promise(function(_0x53aca9,_0x2e1316){return db[_0x303e('0x17')][_0x303e('0x1c')](_0x275d36[_0x303e('0x1d')],{'raw':_0x275d36[_0x303e('0x19')]?_0x275d36[_0x303e('0x19')][_0x303e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x275d36[_0x303e('0x19')]?_0x275d36[_0x303e('0x19')][_0x303e('0x1e')]||null:null,'attributes':_0x275d36[_0x303e('0x19')]?_0x275d36[_0x303e('0x19')]['attributes']||null:null,'limit':_0x275d36[_0x303e('0x19')]?_0x275d36[_0x303e('0x19')]['limit']||null:null})['then'](function(_0x19b1ea){logger[_0x303e('0xc')]('UpdateSmsQueueReport',_0x275d36);logger[_0x303e('0xf')](_0x303e('0x1b'),_0x275d36,JSON[_0x303e('0x10')](_0x19b1ea));_0x53aca9(_0x19b1ea);})[_0x303e('0x15')](function(_0x43d4ee){logger['error'](_0x303e('0x1b'),_0x43d4ee[_0x303e('0x13')],_0x275d36);_0x2e1316(_0x50965c[_0x303e('0x11')](0x1f4,_0x43d4ee['message']));});});}; \ No newline at end of file +var _0xe759=['rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','options','then','debug','update','body','raw','where','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x3fffd7,_0x531857){var _0xa11983=function(_0x445d0b){while(--_0x445d0b){_0x3fffd7['push'](_0x3fffd7['shift']());}};_0xa11983(++_0x531857);}(_0xe759,0xd3));var _0x9e75=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe759[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x9e75('0x0'));var moment=require(_0x9e75('0x1'));var BPromise=require(_0x9e75('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e75('0x3'));var db=require(_0x9e75('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e75('0x5'))(_0x9e75('0x6'));var config=require(_0x9e75('0x7'));var jayson=require(_0x9e75('0x8'));var client=jayson[_0x9e75('0x9')][_0x9e75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x277367,_0xf510fd,_0xb69c21){return new BPromise(function(_0x3e47c7,_0x2dffc3){return client[_0x9e75('0xb')](_0x277367,_0xb69c21)['then'](function(_0x1c0f6c){logger[_0x9e75('0xc')](_0x9e75('0xd'),_0xf510fd,_0x9e75('0xe'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0xf510fd,_0x9e75('0xe'),JSON[_0x9e75('0xf')](_0x1c0f6c));if(_0x1c0f6c[_0x9e75('0x10')]){if(_0x1c0f6c[_0x9e75('0x10')][_0x9e75('0x11')]===0x1f4){logger['error'](_0x9e75('0xd'),_0xf510fd,_0x1c0f6c[_0x9e75('0x10')][_0x9e75('0x12')]);return _0x2dffc3(_0x1c0f6c['error']['message']);}logger['error'](_0x9e75('0xd'),_0xf510fd,_0x1c0f6c[_0x9e75('0x10')][_0x9e75('0x12')]);return _0x3e47c7(_0x1c0f6c[_0x9e75('0x10')][_0x9e75('0x12')]);}else{logger[_0x9e75('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0xf510fd,_0x9e75('0xe'));_0x3e47c7(_0x1c0f6c['result'][_0x9e75('0x12')]);}})[_0x9e75('0x13')](function(_0x4bedcb){logger[_0x9e75('0x10')](_0x9e75('0xd'),_0xf510fd,_0x4bedcb);_0x2dffc3(_0x4bedcb);});});}exports[_0x9e75('0x14')]=function(_0x11f903){var _0x32d8a4=this;return new Promise(function(_0x304cce,_0x11b0ea){return db[_0x9e75('0x15')][_0x9e75('0x16')](_0x11f903['body'],{'raw':_0x11f903[_0x9e75('0x17')]?_0x11f903['options']['raw']===undefined?!![]:![]:!![]})[_0x9e75('0x18')](function(_0x279469){logger[_0x9e75('0xc')](_0x9e75('0x14'),_0x11f903);logger[_0x9e75('0x19')](_0x9e75('0x14'),_0x11f903,JSON['stringify'](_0x279469));_0x304cce(_0x279469);})[_0x9e75('0x13')](function(_0x4b6c08){logger[_0x9e75('0x10')](_0x9e75('0x14'),_0x4b6c08['message'],_0x11f903);_0x11b0ea(_0x32d8a4[_0x9e75('0x10')](0x1f4,_0x4b6c08['message']));});});};exports['UpdateSmsQueueReport']=function(_0x41cecb){var _0x52f26a=this;return new Promise(function(_0x26b06a,_0xeab95c){return db[_0x9e75('0x15')][_0x9e75('0x1a')](_0x41cecb[_0x9e75('0x1b')],{'raw':_0x41cecb[_0x9e75('0x17')]?_0x41cecb[_0x9e75('0x17')][_0x9e75('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41cecb[_0x9e75('0x17')]?_0x41cecb[_0x9e75('0x17')][_0x9e75('0x1d')]||null:null,'attributes':_0x41cecb[_0x9e75('0x17')]?_0x41cecb[_0x9e75('0x17')][_0x9e75('0x1e')]||null:null,'limit':_0x41cecb[_0x9e75('0x17')]?_0x41cecb[_0x9e75('0x17')]['limit']||null:null})[_0x9e75('0x18')](function(_0x33efe1){logger[_0x9e75('0xc')]('UpdateSmsQueueReport',_0x41cecb);logger[_0x9e75('0x19')]('UpdateSmsQueueReport',_0x41cecb,JSON[_0x9e75('0xf')](_0x33efe1));_0x26b06a(_0x33efe1);})[_0x9e75('0x13')](function(_0x2f3bf8){logger['error']('UpdateSmsQueueReport',_0x2f3bf8['message'],_0x41cecb);_0xeab95c(_0x52f26a[_0x9e75('0x10')](0x1f4,_0x2f3bf8[_0x9e75('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 0209dc3..002e279 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 _0x8d0e=['/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get'];(function(_0x5411cb,_0x1cd69d){var _0x32727a=function(_0x22a762){while(--_0x22a762){_0x5411cb['push'](_0x5411cb['shift']());}};_0x32727a(++_0x1cd69d);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x294abb,_0x5ac422){_0x294abb=_0x294abb-0x0;var _0x1ea75a=_0x8d0e[_0x294abb];return _0x1ea75a;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0xe')]);router[_0xe8d0('0xb')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller['show']);router[_0xe8d0('0x10')]('/',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x11')]);router['put']('/:id',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x12')]);router[_0xe8d0('0x13')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xeec6=['isAuthenticated','index','/describe','describe','get','show','post','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xeec6,0x1c2));var _0x6eec=function(_0x5815af,_0x361f0b){_0x5815af=_0x5815af-0x0;var _0x3f14cb=_0xeec6[_0x5815af];return _0x3f14cb;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get']('/',auth[_0x6eec('0xa')](),controller[_0x6eec('0xb')]);router['get'](_0x6eec('0xc'),auth[_0x6eec('0xa')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xa')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6eec('0x11'),auth[_0x6eec('0xa')](),controller['update']);router['delete'](_0x6eec('0x11'),auth['isAuthenticated'](),controller[_0x6eec('0x12')]);module[_0x6eec('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index bf23a4f..4eb10ee 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x456d08,_0x3c6888){var _0xc05953=function(_0x47389e){while(--_0x47389e){_0x456d08['push'](_0x456d08['shift']());}};_0xc05953(++_0x3c6888);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xf3cd[_0x2b5eae];return _0x5f3ac9;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x9bde,0xe1));var _0xe9bd=function(_0xf41a1d,_0x4a4b18){_0xf41a1d=_0xf41a1d-0x0;var _0x2de7f7=_0x9bde[_0xf41a1d];return _0x2de7f7;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c361887..e25dbb5 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 _0x6614=['zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','SmsTransferReport','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','rawAttributes','include','find','catch','create','body','params','describe','eml-format','rimraf'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x6614,0xe8));var _0x4661=function(_0x1b999f,_0xada878){_0x1b999f=_0x1b999f-0x0;var _0x51d27a=_0x6614[_0x1b999f];return _0x51d27a;};'use strict';var emlformat=require(_0x4661('0x0'));var rimraf=require(_0x4661('0x1'));var zipdir=require(_0x4661('0x2'));var jsonpatch=require(_0x4661('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4661('0x4'));var util=require(_0x4661('0x5'));var path=require(_0x4661('0x6'));var sox=require(_0x4661('0x7'));var csv=require(_0x4661('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4661('0x9'));var _=require(_0x4661('0xa'));var squel=require(_0x4661('0xb'));var crypto=require(_0x4661('0xc'));var jsforce=require(_0x4661('0xd'));var deskjs=require(_0x4661('0xe'));var toCsv=require(_0x4661('0x8'));var querystring=require('querystring');var Papa=require(_0x4661('0xf'));var Redis=require(_0x4661('0x10'));var authService=require(_0x4661('0x11'));var qs=require(_0x4661('0x12'));var as=require(_0x4661('0x13'));var hardwareService=require(_0x4661('0x14'));var logger=require(_0x4661('0x15'))(_0x4661('0x16'));var utils=require(_0x4661('0x17'));var config=require(_0x4661('0x18'));var licenseUtil=require(_0x4661('0x19'));var db=require(_0x4661('0x1a'))['db'];function respondWithStatusCode(_0x2e2153,_0xef67b3){_0xef67b3=_0xef67b3||0xcc;return function(_0x2f885a){if(_0x2f885a){return _0x2e2153[_0x4661('0x1b')](_0xef67b3);}return _0x2e2153[_0x4661('0x1c')](_0xef67b3)['end']();};}function respondWithResult(_0x468109,_0x1889ec){_0x1889ec=_0x1889ec||0xc8;return function(_0x4df427){if(_0x4df427){return _0x468109[_0x4661('0x1c')](_0x1889ec)['json'](_0x4df427);}};}function respondWithFilteredResult(_0x4d6175,_0x356b15){return function(_0x38a981){if(_0x38a981){var _0x382232=typeof _0x356b15['offset']===_0x4661('0x1d')&&typeof _0x356b15['limit']===_0x4661('0x1d');var _0x4a5a0e=_0x38a981[_0x4661('0x1e')];var _0x7c9313=_0x382232?0x0:_0x356b15[_0x4661('0x1f')];var _0xfc394=_0x382232?_0x38a981[_0x4661('0x1e')]:_0x356b15[_0x4661('0x1f')]+_0x356b15['limit'];var _0x510442;if(_0xfc394>=_0x4a5a0e){_0xfc394=_0x4a5a0e;_0x510442=0xc8;}else{_0x510442=0xce;}_0x4d6175[_0x4661('0x1c')](_0x510442);return _0x4d6175['set'](_0x4661('0x20'),_0x7c9313+'-'+_0xfc394+'/'+_0x4a5a0e)[_0x4661('0x21')](_0x38a981);}return null;};}function patchUpdates(_0x15da8a){return function(_0x4b95b0){try{jsonpatch['apply'](_0x4b95b0,_0x15da8a,!![]);}catch(_0x52f780){return BPromise[_0x4661('0x22')](_0x52f780);}return _0x4b95b0[_0x4661('0x23')]();};}function saveUpdates(_0x2c8d51,_0x4092bb){return function(_0x5cbc42){if(_0x5cbc42){return _0x5cbc42[_0x4661('0x24')](_0x2c8d51)[_0x4661('0x25')](function(_0x18cd84){return _0x18cd84;});}return null;};}function removeEntity(_0x1c10f6,_0x2ac5d2){return function(_0x2811a1){if(_0x2811a1){return _0x2811a1[_0x4661('0x26')]()[_0x4661('0x25')](function(){_0x1c10f6['status'](0xcc)[_0x4661('0x27')]();});}};}function handleEntityNotFound(_0x1c1b3c,_0x2e7453){return function(_0x488ef9){if(!_0x488ef9){_0x1c1b3c[_0x4661('0x1b')](0x194);}return _0x488ef9;};}function handleError(_0x2178db,_0x3823c5){_0x3823c5=_0x3823c5||0x1f4;return function(_0x281c0d){logger[_0x4661('0x28')](_0x281c0d[_0x4661('0x29')]);if(_0x281c0d[_0x4661('0x2a')]){delete _0x281c0d[_0x4661('0x2a')];}_0x2178db[_0x4661('0x1c')](_0x3823c5)[_0x4661('0x2b')](_0x281c0d);};}exports[_0x4661('0x2c')]=function(_0xb82f79,_0x4a2d34){var _0x51f055={},_0x38749a={},_0x5c05f5={'count':0x0,'rows':[]};var _0x386010=_['map'](db[_0x4661('0x2d')]['rawAttributes'],function(_0x5943ae){return{'name':_0x5943ae[_0x4661('0x2e')],'type':_0x5943ae['type']['key']};});_0x38749a[_0x4661('0x2f')]=_[_0x4661('0x30')](_0x386010,_0x4661('0x2a'));_0x38749a[_0x4661('0x31')]=_[_0x4661('0x32')](_0xb82f79['query']);_0x38749a[_0x4661('0x33')]=_['intersection'](_0x38749a[_0x4661('0x2f')],_0x38749a[_0x4661('0x31')]);_0x51f055[_0x4661('0x34')]=_[_0x4661('0x35')](_0x38749a[_0x4661('0x2f')],qs[_0x4661('0x36')](_0xb82f79[_0x4661('0x31')][_0x4661('0x36')]));_0x51f055['attributes']=_0x51f055['attributes'][_0x4661('0x37')]?_0x51f055[_0x4661('0x34')]:_0x38749a[_0x4661('0x2f')];if(!_0xb82f79[_0x4661('0x31')][_0x4661('0x38')]('nolimit')){_0x51f055[_0x4661('0x39')]=qs[_0x4661('0x39')](_0xb82f79[_0x4661('0x31')]['limit']);_0x51f055['offset']=qs[_0x4661('0x1f')](_0xb82f79[_0x4661('0x31')][_0x4661('0x1f')]);}_0x51f055['order']=qs[_0x4661('0x3a')](_0xb82f79[_0x4661('0x31')][_0x4661('0x3a')]);_0x51f055[_0x4661('0x3b')]=qs[_0x4661('0x33')](_[_0x4661('0x3c')](_0xb82f79[_0x4661('0x31')],_0x38749a['filters']),_0x386010);if(_0xb82f79[_0x4661('0x31')]['filter']){_0x51f055[_0x4661('0x3b')]=_[_0x4661('0x3d')](_0x51f055[_0x4661('0x3b')],{'$or':_[_0x4661('0x30')](_0x386010,function(_0x4e5bce){if(_0x4e5bce[_0x4661('0x3e')]!==_0x4661('0x3f')){var _0x566d64={};_0x566d64[_0x4e5bce['name']]={'$like':'%'+_0xb82f79[_0x4661('0x31')][_0x4661('0x40')]+'%'};return _0x566d64;}})});}_0x51f055=_[_0x4661('0x3d')]({},_0x51f055,_0xb82f79[_0x4661('0x41')]);var _0x485b9b={'where':_0x51f055[_0x4661('0x3b')]};return db['SmsTransferReport'][_0x4661('0x1e')](_0x485b9b)[_0x4661('0x25')](function(_0x480e4c){_0x5c05f5['count']=_0x480e4c;if(_0xb82f79[_0x4661('0x31')][_0x4661('0x42')]){_0x51f055['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x4661('0x43')](_0x51f055);})[_0x4661('0x25')](function(_0x2ec71d){_0x5c05f5[_0x4661('0x44')]=_0x2ec71d;return _0x5c05f5;})[_0x4661('0x25')](respondWithFilteredResult(_0x4a2d34,_0x51f055))['catch'](handleError(_0x4a2d34,null));};exports[_0x4661('0x45')]=function(_0x57d411,_0x1ac80f){var _0x35cb71={'raw':!![],'where':{'id':_0x57d411['params']['id']}},_0x12577a={};_0x12577a[_0x4661('0x2f')]=_[_0x4661('0x32')](db[_0x4661('0x2d')][_0x4661('0x46')]);_0x12577a[_0x4661('0x31')]=_[_0x4661('0x32')](_0x57d411[_0x4661('0x31')]);_0x12577a[_0x4661('0x33')]=_[_0x4661('0x35')](_0x12577a[_0x4661('0x2f')],_0x12577a[_0x4661('0x31')]);_0x35cb71[_0x4661('0x34')]=_[_0x4661('0x35')](_0x12577a[_0x4661('0x2f')],qs[_0x4661('0x36')](_0x57d411[_0x4661('0x31')]['fields']));_0x35cb71[_0x4661('0x34')]=_0x35cb71[_0x4661('0x34')][_0x4661('0x37')]?_0x35cb71['attributes']:_0x12577a[_0x4661('0x2f')];if(_0x57d411[_0x4661('0x31')][_0x4661('0x42')]){_0x35cb71[_0x4661('0x47')]=[{'all':!![]}];}_0x35cb71=_['merge']({},_0x35cb71,_0x57d411['options']);return db['SmsTransferReport'][_0x4661('0x48')](_0x35cb71)[_0x4661('0x25')](handleEntityNotFound(_0x1ac80f,null))['then'](respondWithResult(_0x1ac80f,null))[_0x4661('0x49')](handleError(_0x1ac80f,null));};exports[_0x4661('0x4a')]=function(_0x466712,_0x5dbc3b){return db[_0x4661('0x2d')][_0x4661('0x4a')](_0x466712[_0x4661('0x4b')],{})[_0x4661('0x25')](respondWithResult(_0x5dbc3b,0xc9))['catch'](handleError(_0x5dbc3b,null));};exports[_0x4661('0x24')]=function(_0x21cfef,_0x419c95){if(_0x21cfef[_0x4661('0x4b')]['id']){delete _0x21cfef[_0x4661('0x4b')]['id'];}return db[_0x4661('0x2d')][_0x4661('0x48')]({'where':{'id':_0x21cfef[_0x4661('0x4c')]['id']}})['then'](handleEntityNotFound(_0x419c95,null))['then'](saveUpdates(_0x21cfef[_0x4661('0x4b')],null))[_0x4661('0x25')](respondWithResult(_0x419c95,null))['catch'](handleError(_0x419c95,null));};exports[_0x4661('0x26')]=function(_0x5eb396,_0x3cfa92){return db[_0x4661('0x2d')][_0x4661('0x48')]({'where':{'id':_0x5eb396['params']['id']}})[_0x4661('0x25')](handleEntityNotFound(_0x3cfa92,null))[_0x4661('0x25')](removeEntity(_0x3cfa92,null))['catch'](handleError(_0x3cfa92,null));};exports[_0x4661('0x4d')]=function(_0x1d8226,_0x7eab9f){return db[_0x4661('0x2d')]['describe']()[_0x4661('0x25')](respondWithResult(_0x7eab9f,null))[_0x4661('0x49')](handleError(_0x7eab9f,null));}; \ No newline at end of file +var _0x36d4=['reject','save','update','then','stack','name','index','map','SmsTransferReport','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','keys','includeAll','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','apply'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0x36d4,0xea));var _0x436d=function(_0x29f80e,_0x9027ff){_0x29f80e=_0x29f80e-0x0;var _0x5c7eaa=_0x36d4[_0x29f80e];return _0x5c7eaa;};'use strict';var emlformat=require(_0x436d('0x0'));var rimraf=require(_0x436d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x436d('0x2'));var rp=require('request-promise');var moment=require(_0x436d('0x3'));var BPromise=require(_0x436d('0x4'));var Mustache=require(_0x436d('0x5'));var util=require(_0x436d('0x6'));var path=require(_0x436d('0x7'));var sox=require(_0x436d('0x8'));var csv=require(_0x436d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x436d('0xa'));var _=require('lodash');var squel=require(_0x436d('0xb'));var crypto=require('crypto');var jsforce=require(_0x436d('0xc'));var deskjs=require(_0x436d('0xd'));var toCsv=require(_0x436d('0x9'));var querystring=require(_0x436d('0xe'));var Papa=require(_0x436d('0xf'));var Redis=require(_0x436d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x436d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x436d('0x12'));var logger=require('../../config/logger')(_0x436d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x436d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35f630,_0x4812cf){_0x4812cf=_0x4812cf||0xcc;return function(_0x5ee4ca){if(_0x5ee4ca){return _0x35f630[_0x436d('0x15')](_0x4812cf);}return _0x35f630['status'](_0x4812cf)[_0x436d('0x16')]();};}function respondWithResult(_0x57b87d,_0x3c154e){_0x3c154e=_0x3c154e||0xc8;return function(_0x51f4a9){if(_0x51f4a9){return _0x57b87d[_0x436d('0x17')](_0x3c154e)[_0x436d('0x18')](_0x51f4a9);}};}function respondWithFilteredResult(_0x4e8cf5,_0x2cc734){return function(_0x29217f){if(_0x29217f){var _0x583e7c=typeof _0x2cc734[_0x436d('0x19')]===_0x436d('0x1a')&&typeof _0x2cc734[_0x436d('0x1b')]===_0x436d('0x1a');var _0x57e4be=_0x29217f[_0x436d('0x1c')];var _0x34be7a=_0x583e7c?0x0:_0x2cc734[_0x436d('0x19')];var _0x146c2d=_0x583e7c?_0x29217f[_0x436d('0x1c')]:_0x2cc734[_0x436d('0x19')]+_0x2cc734[_0x436d('0x1b')];var _0x26c0c4;if(_0x146c2d>=_0x57e4be){_0x146c2d=_0x57e4be;_0x26c0c4=0xc8;}else{_0x26c0c4=0xce;}_0x4e8cf5['status'](_0x26c0c4);return _0x4e8cf5['set']('Content-Range',_0x34be7a+'-'+_0x146c2d+'/'+_0x57e4be)[_0x436d('0x18')](_0x29217f);}return null;};}function patchUpdates(_0x37bd0b){return function(_0x1975a8){try{jsonpatch[_0x436d('0x1d')](_0x1975a8,_0x37bd0b,!![]);}catch(_0x4c9331){return BPromise[_0x436d('0x1e')](_0x4c9331);}return _0x1975a8[_0x436d('0x1f')]();};}function saveUpdates(_0x1cf4ee,_0x3cef77){return function(_0x1433d9){if(_0x1433d9){return _0x1433d9[_0x436d('0x20')](_0x1cf4ee)[_0x436d('0x21')](function(_0x58aa1d){return _0x58aa1d;});}return null;};}function removeEntity(_0x22c246,_0x4e2576){return function(_0x45cf0e){if(_0x45cf0e){return _0x45cf0e['destroy']()['then'](function(){_0x22c246[_0x436d('0x17')](0xcc)[_0x436d('0x16')]();});}};}function handleEntityNotFound(_0xfa9b6f,_0x35ef5a){return function(_0x2fa44e){if(!_0x2fa44e){_0xfa9b6f['sendStatus'](0x194);}return _0x2fa44e;};}function handleError(_0x78103e,_0x5d5346){_0x5d5346=_0x5d5346||0x1f4;return function(_0x30e6e6){logger['error'](_0x30e6e6[_0x436d('0x22')]);if(_0x30e6e6[_0x436d('0x23')]){delete _0x30e6e6[_0x436d('0x23')];}_0x78103e[_0x436d('0x17')](_0x5d5346)['send'](_0x30e6e6);};}exports[_0x436d('0x24')]=function(_0x257e91,_0x800458){var _0x32ac8b={},_0x23c85f={},_0x241f94={'count':0x0,'rows':[]};var _0x4e7ad2=_[_0x436d('0x25')](db[_0x436d('0x26')]['rawAttributes'],function(_0x53e623){return{'name':_0x53e623['fieldName'],'type':_0x53e623[_0x436d('0x27')][_0x436d('0x28')]};});_0x23c85f[_0x436d('0x29')]=_['map'](_0x4e7ad2,'name');_0x23c85f[_0x436d('0x2a')]=_['keys'](_0x257e91[_0x436d('0x2a')]);_0x23c85f[_0x436d('0x2b')]=_[_0x436d('0x2c')](_0x23c85f[_0x436d('0x29')],_0x23c85f[_0x436d('0x2a')]);_0x32ac8b[_0x436d('0x2d')]=_['intersection'](_0x23c85f[_0x436d('0x29')],qs[_0x436d('0x2e')](_0x257e91[_0x436d('0x2a')]['fields']));_0x32ac8b['attributes']=_0x32ac8b[_0x436d('0x2d')]['length']?_0x32ac8b[_0x436d('0x2d')]:_0x23c85f[_0x436d('0x29')];if(!_0x257e91[_0x436d('0x2a')]['hasOwnProperty'](_0x436d('0x2f'))){_0x32ac8b[_0x436d('0x1b')]=qs[_0x436d('0x1b')](_0x257e91[_0x436d('0x2a')][_0x436d('0x1b')]);_0x32ac8b[_0x436d('0x19')]=qs[_0x436d('0x19')](_0x257e91[_0x436d('0x2a')][_0x436d('0x19')]);}_0x32ac8b[_0x436d('0x30')]=qs['sort'](_0x257e91[_0x436d('0x2a')]['sort']);_0x32ac8b[_0x436d('0x31')]=qs['filters'](_[_0x436d('0x32')](_0x257e91[_0x436d('0x2a')],_0x23c85f[_0x436d('0x2b')]),_0x4e7ad2);if(_0x257e91[_0x436d('0x2a')][_0x436d('0x33')]){_0x32ac8b[_0x436d('0x31')]=_[_0x436d('0x34')](_0x32ac8b[_0x436d('0x31')],{'$or':_[_0x436d('0x25')](_0x4e7ad2,function(_0x179775){if(_0x179775['type']!==_0x436d('0x35')){var _0x22b4ec={};_0x22b4ec[_0x179775[_0x436d('0x23')]]={'$like':'%'+_0x257e91[_0x436d('0x2a')]['filter']+'%'};return _0x22b4ec;}})});}_0x32ac8b=_[_0x436d('0x34')]({},_0x32ac8b,_0x257e91[_0x436d('0x36')]);var _0x4f472e={'where':_0x32ac8b[_0x436d('0x31')]};return db[_0x436d('0x26')][_0x436d('0x1c')](_0x4f472e)['then'](function(_0x2768f0){_0x241f94['count']=_0x2768f0;if(_0x257e91[_0x436d('0x2a')]['includeAll']){_0x32ac8b['include']=[{'all':!![]}];}return db[_0x436d('0x26')]['findAll'](_0x32ac8b);})['then'](function(_0x201b59){_0x241f94[_0x436d('0x37')]=_0x201b59;return _0x241f94;})['then'](respondWithFilteredResult(_0x800458,_0x32ac8b))[_0x436d('0x38')](handleError(_0x800458,null));};exports[_0x436d('0x39')]=function(_0x5b8a49,_0x277974){var _0x2a450f={'raw':!![],'where':{'id':_0x5b8a49[_0x436d('0x3a')]['id']}},_0x9bc1c7={};_0x9bc1c7['model']=_[_0x436d('0x3b')](db[_0x436d('0x26')]['rawAttributes']);_0x9bc1c7['query']=_[_0x436d('0x3b')](_0x5b8a49['query']);_0x9bc1c7[_0x436d('0x2b')]=_[_0x436d('0x2c')](_0x9bc1c7['model'],_0x9bc1c7['query']);_0x2a450f[_0x436d('0x2d')]=_[_0x436d('0x2c')](_0x9bc1c7['model'],qs[_0x436d('0x2e')](_0x5b8a49['query'][_0x436d('0x2e')]));_0x2a450f[_0x436d('0x2d')]=_0x2a450f[_0x436d('0x2d')]['length']?_0x2a450f[_0x436d('0x2d')]:_0x9bc1c7[_0x436d('0x29')];if(_0x5b8a49[_0x436d('0x2a')][_0x436d('0x3c')]){_0x2a450f['include']=[{'all':!![]}];}_0x2a450f=_[_0x436d('0x34')]({},_0x2a450f,_0x5b8a49['options']);return db['SmsTransferReport'][_0x436d('0x3d')](_0x2a450f)[_0x436d('0x21')](handleEntityNotFound(_0x277974,null))[_0x436d('0x21')](respondWithResult(_0x277974,null))[_0x436d('0x38')](handleError(_0x277974,null));};exports[_0x436d('0x3e')]=function(_0xe3d6e2,_0xb33638){return db['SmsTransferReport'][_0x436d('0x3e')](_0xe3d6e2[_0x436d('0x3f')],{})[_0x436d('0x21')](respondWithResult(_0xb33638,0xc9))[_0x436d('0x38')](handleError(_0xb33638,null));};exports[_0x436d('0x20')]=function(_0x6124b8,_0x5999d9){if(_0x6124b8['body']['id']){delete _0x6124b8['body']['id'];}return db[_0x436d('0x26')][_0x436d('0x3d')]({'where':{'id':_0x6124b8[_0x436d('0x3a')]['id']}})[_0x436d('0x21')](handleEntityNotFound(_0x5999d9,null))['then'](saveUpdates(_0x6124b8[_0x436d('0x3f')],null))[_0x436d('0x21')](respondWithResult(_0x5999d9,null))[_0x436d('0x38')](handleError(_0x5999d9,null));};exports[_0x436d('0x40')]=function(_0x28780e,_0x38e361){return db['SmsTransferReport']['find']({'where':{'id':_0x28780e[_0x436d('0x3a')]['id']}})[_0x436d('0x21')](handleEntityNotFound(_0x38e361,null))[_0x436d('0x21')](removeEntity(_0x38e361,null))['catch'](handleError(_0x38e361,null));};exports[_0x436d('0x41')]=function(_0x7bd078,_0x39dfc9){return db[_0x436d('0x26')][_0x436d('0x41')]()['then'](respondWithResult(_0x39dfc9,null))[_0x436d('0x38')](handleError(_0x39dfc9,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d7a3cf3..208c9c6 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 _0xf6c6=['define','SmsTransferReport','report_sms_transfer','uniqueid','util','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0xb20b1d,_0x528253){var _0x245ced=function(_0x4c8bc0){while(--_0x4c8bc0){_0xb20b1d['push'](_0xb20b1d['shift']());}};_0x245ced(++_0x528253);}(_0xf6c6,0x154));var _0x6f6c=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xf6c6[_0x11c573];return _0x6b72de;};'use strict';var _=require('lodash');var util=require(_0x6f6c('0x0'));var logger=require('../../config/logger')(_0x6f6c('0x1'));var moment=require(_0x6f6c('0x2'));var BPromise=require(_0x6f6c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f6c('0x4'));var rimraf=require(_0x6f6c('0x5'));var config=require(_0x6f6c('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x6f6c('0x7')]=function(_0x475482,_0x2b259e){return _0x475482[_0x6f6c('0x8')](_0x6f6c('0x9'),attributes,{'tableName':_0x6f6c('0xa'),'paranoid':![],'indexes':[{'name':_0x6f6c('0xb'),'fields':[_0x6f6c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x078c=['../../config/logger','api','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x078c,0x19f));var _0xc078=function(_0x2fcf18,_0x10009a){_0x2fcf18=_0x2fcf18-0x0;var _0x4c68cc=_0x078c[_0x2fcf18];return _0x4c68cc;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var logger=require(_0xc078('0x1'))(_0xc078('0x2'));var moment=require('moment');var BPromise=require(_0xc078('0x3'));var rp=require(_0xc078('0x4'));var fs=require('fs');var path=require(_0xc078('0x5'));var rimraf=require(_0xc078('0x6'));var config=require('../../config/environment');var attributes=require(_0xc078('0x7'));module[_0xc078('0x8')]=function(_0x394068,_0x24b241){return _0x394068[_0xc078('0x9')](_0xc078('0xa'),attributes,{'tableName':_0xc078('0xb'),'paranoid':![],'indexes':[{'name':_0xc078('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8e91256..a084ca9 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 _0x34e7=['SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ef909,_0x3cd0a8){var _0x369bc0=function(_0x482192){while(--_0x482192){_0x1ef909['push'](_0x1ef909['shift']());}};_0x369bc0(++_0x3cd0a8);}(_0x34e7,0x164));var _0x734e=function(_0x2be67f,_0x238c6d){_0x2be67f=_0x2be67f-0x0;var _0x1d94b4=_0x34e7[_0x2be67f];return _0x1d94b4;};'use strict';var _=require(_0x734e('0x0'));var util=require(_0x734e('0x1'));var moment=require(_0x734e('0x2'));var BPromise=require(_0x734e('0x3'));var rs=require(_0x734e('0x4'));var fs=require('fs');var Redis=require(_0x734e('0x5'));var db=require(_0x734e('0x6'))['db'];var utils=require(_0x734e('0x7'));var logger=require(_0x734e('0x8'))(_0x734e('0x9'));var config=require(_0x734e('0xa'));var jayson=require(_0x734e('0xb'));var client=jayson[_0x734e('0xc')][_0x734e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4f49aa,_0x2cf8f9,_0x1b11da){return new BPromise(function(_0x444194,_0x4df479){return client[_0x734e('0xe')](_0x4f49aa,_0x1b11da)['then'](function(_0x1ce121){logger[_0x734e('0xf')](_0x734e('0x10'),_0x2cf8f9,_0x734e('0x11'));logger[_0x734e('0x12')](_0x734e('0x13'),_0x2cf8f9,'request\x20sent',JSON['stringify'](_0x1ce121));if(_0x1ce121[_0x734e('0x14')]){if(_0x1ce121[_0x734e('0x14')][_0x734e('0x15')]===0x1f4){logger[_0x734e('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x2cf8f9,_0x1ce121[_0x734e('0x14')][_0x734e('0x16')]);return _0x4df479(_0x1ce121['error'][_0x734e('0x16')]);}logger[_0x734e('0x14')](_0x734e('0x10'),_0x2cf8f9,_0x1ce121[_0x734e('0x14')][_0x734e('0x16')]);return _0x444194(_0x1ce121['error'][_0x734e('0x16')]);}else{logger[_0x734e('0xf')](_0x734e('0x10'),_0x2cf8f9,'request\x20sent');_0x444194(_0x1ce121[_0x734e('0x17')]['message']);}})[_0x734e('0x18')](function(_0x3aa65b){logger['error'](_0x734e('0x10'),_0x2cf8f9,_0x3aa65b);_0x4df479(_0x3aa65b);});});} \ No newline at end of file +var _0xd307=['request\x20sent','debug','stringify','error','code','message','SmsTransferReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info'];(function(_0x17eba5,_0x434f32){var _0x1aa6f1=function(_0x163713){while(--_0x163713){_0x17eba5['push'](_0x17eba5['shift']());}};_0x1aa6f1(++_0x434f32);}(_0xd307,0x110));var _0x7d30=function(_0x50394,_0x3508dd){_0x50394=_0x50394-0x0;var _0x4e3007=_0xd307[_0x50394];return _0x4e3007;};'use strict';var _=require(_0x7d30('0x0'));var util=require(_0x7d30('0x1'));var moment=require(_0x7d30('0x2'));var BPromise=require(_0x7d30('0x3'));var rs=require(_0x7d30('0x4'));var fs=require('fs');var Redis=require(_0x7d30('0x5'));var db=require(_0x7d30('0x6'))['db'];var utils=require(_0x7d30('0x7'));var logger=require('../../config/logger')(_0x7d30('0x8'));var config=require(_0x7d30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d30('0xa')][_0x7d30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9451ed,_0x35c861,_0x43b35e){return new BPromise(function(_0x1ef3e7,_0x1eb28c){return client[_0x7d30('0xc')](_0x9451ed,_0x43b35e)['then'](function(_0x3cd180){logger[_0x7d30('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x35c861,_0x7d30('0xe'));logger[_0x7d30('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x35c861,'request\x20sent',JSON[_0x7d30('0x10')](_0x3cd180));if(_0x3cd180[_0x7d30('0x11')]){if(_0x3cd180[_0x7d30('0x11')][_0x7d30('0x12')]===0x1f4){logger[_0x7d30('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x35c861,_0x3cd180[_0x7d30('0x11')][_0x7d30('0x13')]);return _0x1eb28c(_0x3cd180['error'][_0x7d30('0x13')]);}logger[_0x7d30('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x35c861,_0x3cd180[_0x7d30('0x11')][_0x7d30('0x13')]);return _0x1ef3e7(_0x3cd180[_0x7d30('0x11')][_0x7d30('0x13')]);}else{logger['info'](_0x7d30('0x14'),_0x35c861,_0x7d30('0xe'));_0x1ef3e7(_0x3cd180[_0x7d30('0x15')]['message']);}})['catch'](function(_0x5027b3){logger[_0x7d30('0x11')](_0x7d30('0x14'),_0x35c861,_0x5027b3);_0x1eb28c(_0x5027b3);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 48984bf..cc57be8 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 _0xf9cc=['util','path','Router','fs-extra','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','file','put','delete','exports','multer'];(function(_0x17d9a0,_0x56dd58){var _0x490120=function(_0x18dd7b){while(--_0x18dd7b){_0x17d9a0['push'](_0x17d9a0['shift']());}};_0x490120(++_0x56dd58);}(_0xf9cc,0xcf));var _0xcf9c=function(_0x340781,_0x32b659){_0x340781=_0x340781-0x0;var _0x1a6ab9=_0xf9cc[_0x340781];return _0x1a6ab9;};'use strict';var multer=require(_0xcf9c('0x0'));var util=require(_0xcf9c('0x1'));var path=require(_0xcf9c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf9c('0x3')]();var fs_extra=require(_0xcf9c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xcf9c('0x5')]('/',auth[_0xcf9c('0x6')](),controller[_0xcf9c('0x7')]);router[_0xcf9c('0x5')](_0xcf9c('0x8'),auth[_0xcf9c('0x6')](),controller['show']);router[_0xcf9c('0x5')](_0xcf9c('0x9'),auth[_0xcf9c('0x6')](),controller[_0xcf9c('0xa')]);var upload=multer({'storage':multer[_0xcf9c('0xb')]({'destination':function(_0x29be9e,_0x36b142,_0x57fb41){_0x57fb41(null,path[_0xcf9c('0xc')](config[_0xcf9c('0xd')],_0xcf9c('0xe')));},'filename':function(_0x278439,_0x389946,_0x4cf645){_0x389946[_0xcf9c('0xf')]=_0x389946['originalname'][_0xcf9c('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4cf645(null,util['format'](_0xcf9c('0x11'),path[_0xcf9c('0x12')](_0x389946[_0xcf9c('0xf')],path[_0xcf9c('0x13')](_0x389946['originalname'])),Date[_0xcf9c('0x14')](),path['extname'](_0x389946[_0xcf9c('0xf')])));}})});router[_0xcf9c('0x15')]('/',upload['single'](_0xcf9c('0x16')),controller['create']);router[_0xcf9c('0x17')](_0xcf9c('0x8'),auth[_0xcf9c('0x6')](),controller['update']);router[_0xcf9c('0x18')]('/:id',auth[_0xcf9c('0x6')](),controller['delete']);module[_0xcf9c('0x19')]=router; \ No newline at end of file +var _0xf440=['post','file','create','put','delete','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','join','root','originalname','replace','format','%s-%s%s','basename','extname','now'];(function(_0x342416,_0x22a7c6){var _0x4f7dc7=function(_0x203f61){while(--_0x203f61){_0x342416['push'](_0x342416['shift']());}};_0x4f7dc7(++_0x22a7c6);}(_0xf440,0x172));var _0x0f44=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf440[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f44('0x0'));var timeout=require('connect-timeout');var express=require(_0x0f44('0x1'));var router=express['Router']();var fs_extra=require(_0x0f44('0x2'));var auth=require(_0x0f44('0x3'));var interaction=require(_0x0f44('0x4'));var config=require(_0x0f44('0x5'));var controller=require(_0x0f44('0x6'));router[_0x0f44('0x7')]('/',auth[_0x0f44('0x8')](),controller[_0x0f44('0x9')]);router[_0x0f44('0x7')](_0x0f44('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0f44('0xb'),auth['isAuthenticated'](),controller[_0x0f44('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3dd423,_0xa04f8d,_0x36733d){_0x36733d(null,path[_0x0f44('0xd')](config[_0x0f44('0xe')],'server/files/sounds/original/'));},'filename':function(_0x1c3ee5,_0x43f054,_0xd2ceb7){_0x43f054[_0x0f44('0xf')]=_0x43f054[_0x0f44('0xf')][_0x0f44('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xd2ceb7(null,util[_0x0f44('0x11')](_0x0f44('0x12'),path[_0x0f44('0x13')](_0x43f054[_0x0f44('0xf')],path[_0x0f44('0x14')](_0x43f054['originalname'])),Date[_0x0f44('0x15')](),path['extname'](_0x43f054[_0x0f44('0xf')])));}})});router[_0x0f44('0x16')]('/',upload['single'](_0x0f44('0x17')),controller[_0x0f44('0x18')]);router[_0x0f44('0x19')](_0x0f44('0xa'),auth[_0x0f44('0x8')](),controller['update']);router['delete'](_0x0f44('0xa'),auth[_0x0f44('0x8')](),controller[_0x0f44('0x1a')]);module[_0x0f44('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 853c487..578a486 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 _0x9ae4=['name','STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x33578f,_0x530bb5){var _0x41b2f3=function(_0x137db0){while(--_0x137db0){_0x33578f['push'](_0x33578f['shift']());}};_0x41b2f3(++_0x530bb5);}(_0x9ae4,0x194));var _0x49ae=function(_0x475640,_0x1fa709){_0x475640=_0x475640-0x0;var _0x4e1eb7=_0x9ae4[_0x475640];return _0x4e1eb7;};'use strict';var Sequelize=require(_0x49ae('0x0'));module[_0x49ae('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x49ae('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x49ae('0x3')]},'display_name':{'type':Sequelize[_0x49ae('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x49ae('0x3')]},'original_duration':{'type':Sequelize[_0x49ae('0x4')]},'original_sampleCount':{'type':Sequelize[_0x49ae('0x5')]},'original_channelCount':{'type':Sequelize[_0x49ae('0x6')]},'original_bitRate':{'type':Sequelize[_0x49ae('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x49ae('0x3')]},'converted_duration':{'type':Sequelize[_0x49ae('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x49ae('0x5')]},'converted_channelCount':{'type':Sequelize[_0x49ae('0x6')]},'converted_bitRate':{'type':Sequelize[_0x49ae('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x49ae('0x6')]}}; \ No newline at end of file +var _0x76f9=['name','FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x411116,_0x4410a7){var _0x45ca33=function(_0x3460d8){while(--_0x3460d8){_0x411116['push'](_0x411116['shift']());}};_0x45ca33(++_0x4410a7);}(_0x76f9,0x10c));var _0x976f=function(_0x1e5dfd,_0x1d0710){_0x1e5dfd=_0x1e5dfd-0x0;var _0xc7e9ef=_0x76f9[_0x1e5dfd];return _0xc7e9ef;};'use strict';var Sequelize=require(_0x976f('0x0'));module['exports']={'name':{'type':Sequelize[_0x976f('0x1')],'unique':_0x976f('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x976f('0x1')]},'display_name':{'type':Sequelize[_0x976f('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x976f('0x1')]},'original_format':{'type':Sequelize[_0x976f('0x1')]},'original_duration':{'type':Sequelize[_0x976f('0x3')]},'original_sampleCount':{'type':Sequelize[_0x976f('0x4')]},'original_channelCount':{'type':Sequelize[_0x976f('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x976f('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x976f('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x976f('0x5')]},'converted_bitRate':{'type':Sequelize[_0x976f('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x976f('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 5ab5391..980113b 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 _0xc259=['%s.%s','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','description','delete','original_format','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/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','save','update','then','destroy','get','Sounds','UserProfileResource','end','sendStatus','error','name','map','Sound','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','merge','where','filter','options','includeAll','include','rows','catch','show','params','keys','download','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format'];(function(_0x581e75,_0x55908d){var _0x2baedc=function(_0x409ac0){while(--_0x409ac0){_0x581e75['push'](_0x581e75['shift']());}};_0x2baedc(++_0x55908d);}(_0xc259,0x19e));var _0x9c25=function(_0x45e829,_0xbe0176){_0x45e829=_0x45e829-0x0;var _0x557688=_0xc259[_0x45e829];return _0x557688;};'use strict';var emlformat=require(_0x9c25('0x0'));var rimraf=require(_0x9c25('0x1'));var zipdir=require(_0x9c25('0x2'));var jsonpatch=require(_0x9c25('0x3'));var rp=require(_0x9c25('0x4'));var moment=require(_0x9c25('0x5'));var BPromise=require(_0x9c25('0x6'));var Mustache=require('mustache');var util=require(_0x9c25('0x7'));var path=require('path');var sox=require(_0x9c25('0x8'));var csv=require(_0x9c25('0x9'));var ejs=require(_0x9c25('0xa'));var fs=require('fs');var fs_extra=require(_0x9c25('0xb'));var _=require(_0x9c25('0xc'));var squel=require(_0x9c25('0xd'));var crypto=require(_0x9c25('0xe'));var jsforce=require(_0x9c25('0xf'));var deskjs=require(_0x9c25('0x10'));var toCsv=require(_0x9c25('0x9'));var querystring=require(_0x9c25('0x11'));var Papa=require('papaparse');var Redis=require(_0x9c25('0x12'));var authService=require(_0x9c25('0x13'));var qs=require(_0x9c25('0x14'));var as=require(_0x9c25('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c25('0x16'))(_0x9c25('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c25('0x18'));var db=require(_0x9c25('0x19'))['db'];function respondWithStatusCode(_0x407757,_0x2b9c2e){_0x2b9c2e=_0x2b9c2e||0xcc;return function(_0x1225fc){if(_0x1225fc){return _0x407757['sendStatus'](_0x2b9c2e);}return _0x407757[_0x9c25('0x1a')](_0x2b9c2e)['end']();};}function respondWithResult(_0x195e29,_0xc74fca){_0xc74fca=_0xc74fca||0xc8;return function(_0x241809){if(_0x241809){return _0x195e29[_0x9c25('0x1a')](_0xc74fca)[_0x9c25('0x1b')](_0x241809);}};}function respondWithFilteredResult(_0x57e495,_0x43ad20){return function(_0x39bdae){if(_0x39bdae){var _0x4bf482=typeof _0x43ad20[_0x9c25('0x1c')]==='undefined'&&typeof _0x43ad20[_0x9c25('0x1d')]===_0x9c25('0x1e');var _0x12775c=_0x39bdae[_0x9c25('0x1f')];var _0x2e9139=_0x4bf482?0x0:_0x43ad20[_0x9c25('0x1c')];var _0x52fce5=_0x4bf482?_0x39bdae[_0x9c25('0x1f')]:_0x43ad20['offset']+_0x43ad20[_0x9c25('0x1d')];var _0x29eac9;if(_0x52fce5>=_0x12775c){_0x52fce5=_0x12775c;_0x29eac9=0xc8;}else{_0x29eac9=0xce;}_0x57e495[_0x9c25('0x1a')](_0x29eac9);return _0x57e495[_0x9c25('0x20')]('Content-Range',_0x2e9139+'-'+_0x52fce5+'/'+_0x12775c)[_0x9c25('0x1b')](_0x39bdae);}return null;};}function patchUpdates(_0x2d5d7e){return function(_0x30cfb3){try{jsonpatch['apply'](_0x30cfb3,_0x2d5d7e,!![]);}catch(_0x25a25c){return BPromise['reject'](_0x25a25c);}return _0x30cfb3[_0x9c25('0x21')]();};}function saveUpdates(_0x272ce4,_0x54b8d5){return function(_0x54a000){if(_0x54a000){return _0x54a000[_0x9c25('0x22')](_0x272ce4)[_0x9c25('0x23')](function(_0x10706b){return _0x10706b;});}return null;};}function removeEntity(_0x4194ee,_0x139445){return function(_0x35689a){if(_0x35689a){return _0x35689a[_0x9c25('0x24')]()[_0x9c25('0x23')](function(){var _0x5a7d42=_0x35689a[_0x9c25('0x25')]({'plain':!![]});var _0x78a6=_0x9c25('0x26');return db[_0x9c25('0x27')][_0x9c25('0x24')]({'where':{'type':_0x78a6,'resourceId':_0x5a7d42['id']}})[_0x9c25('0x23')](function(){return _0x35689a;});})[_0x9c25('0x23')](function(){_0x4194ee['status'](0xcc)[_0x9c25('0x28')]();});}};}function handleEntityNotFound(_0xbfddd5,_0xcbfca1){return function(_0x1eea48){if(!_0x1eea48){_0xbfddd5[_0x9c25('0x29')](0x194);}return _0x1eea48;};}function handleError(_0x2f192e,_0x5175c8){_0x5175c8=_0x5175c8||0x1f4;return function(_0x6f841b){logger[_0x9c25('0x2a')](_0x6f841b['stack']);if(_0x6f841b[_0x9c25('0x2b')]){delete _0x6f841b[_0x9c25('0x2b')];}_0x2f192e[_0x9c25('0x1a')](_0x5175c8)['send'](_0x6f841b);};}exports['index']=function(_0x25b247,_0x9b0b31){var _0x13a54b={},_0x53ad0f={},_0x52acd2={'count':0x0,'rows':[]};var _0x4ab23a=_[_0x9c25('0x2c')](db[_0x9c25('0x2d')][_0x9c25('0x2e')],function(_0x52045){return{'name':_0x52045['fieldName'],'type':_0x52045[_0x9c25('0x2f')][_0x9c25('0x30')]};});_0x53ad0f[_0x9c25('0x31')]=_[_0x9c25('0x2c')](_0x4ab23a,_0x9c25('0x2b'));_0x53ad0f[_0x9c25('0x32')]=_['keys'](_0x25b247[_0x9c25('0x32')]);_0x53ad0f[_0x9c25('0x33')]=_['intersection'](_0x53ad0f['model'],_0x53ad0f[_0x9c25('0x32')]);_0x13a54b[_0x9c25('0x34')]=_[_0x9c25('0x35')](_0x53ad0f[_0x9c25('0x31')],qs[_0x9c25('0x36')](_0x25b247[_0x9c25('0x32')][_0x9c25('0x36')]));_0x13a54b[_0x9c25('0x34')]=_0x13a54b['attributes'][_0x9c25('0x37')]?_0x13a54b[_0x9c25('0x34')]:_0x53ad0f['model'];if(!_0x25b247['query']['hasOwnProperty'](_0x9c25('0x38'))){_0x13a54b['limit']=qs[_0x9c25('0x1d')](_0x25b247[_0x9c25('0x32')][_0x9c25('0x1d')]);_0x13a54b[_0x9c25('0x1c')]=qs[_0x9c25('0x1c')](_0x25b247[_0x9c25('0x32')][_0x9c25('0x1c')]);}_0x13a54b[_0x9c25('0x39')]=qs[_0x9c25('0x3a')](_0x25b247['query'][_0x9c25('0x3a')]);_0x13a54b['where']=qs[_0x9c25('0x33')](_[_0x9c25('0x3b')](_0x25b247[_0x9c25('0x32')],_0x53ad0f[_0x9c25('0x33')]),_0x4ab23a);if(_0x25b247[_0x9c25('0x32')]['filter']){_0x13a54b['where']=_[_0x9c25('0x3c')](_0x13a54b[_0x9c25('0x3d')],{'$or':_[_0x9c25('0x2c')](_0x4ab23a,function(_0x5df461){if(_0x5df461[_0x9c25('0x2f')]!=='VIRTUAL'){var _0x327ac6={};_0x327ac6[_0x5df461[_0x9c25('0x2b')]]={'$like':'%'+_0x25b247[_0x9c25('0x32')][_0x9c25('0x3e')]+'%'};return _0x327ac6;}})});}_0x13a54b=_[_0x9c25('0x3c')]({},_0x13a54b,_0x25b247[_0x9c25('0x3f')]);var _0x354476={'where':_0x13a54b[_0x9c25('0x3d')]};return db[_0x9c25('0x2d')][_0x9c25('0x1f')](_0x354476)[_0x9c25('0x23')](function(_0x47dd14){_0x52acd2[_0x9c25('0x1f')]=_0x47dd14;if(_0x25b247[_0x9c25('0x32')][_0x9c25('0x40')]){_0x13a54b[_0x9c25('0x41')]=[{'all':!![]}];}return db[_0x9c25('0x2d')]['findAll'](_0x13a54b);})[_0x9c25('0x23')](function(_0x3566a4){_0x52acd2[_0x9c25('0x42')]=_0x3566a4;return _0x52acd2;})[_0x9c25('0x23')](respondWithFilteredResult(_0x9b0b31,_0x13a54b))[_0x9c25('0x43')](handleError(_0x9b0b31,null));};exports[_0x9c25('0x44')]=function(_0xa6be65,_0x2a1190){var _0x451364={'raw':!![],'where':{'id':_0xa6be65[_0x9c25('0x45')]['id']}},_0x23c6fa={};_0x23c6fa['model']=_[_0x9c25('0x46')](db[_0x9c25('0x2d')][_0x9c25('0x2e')]);_0x23c6fa[_0x9c25('0x32')]=_['keys'](_0xa6be65[_0x9c25('0x32')]);_0x23c6fa[_0x9c25('0x33')]=_['intersection'](_0x23c6fa['model'],_0x23c6fa[_0x9c25('0x32')]);_0x451364[_0x9c25('0x34')]=_['intersection'](_0x23c6fa[_0x9c25('0x31')],qs[_0x9c25('0x36')](_0xa6be65[_0x9c25('0x32')][_0x9c25('0x36')]));_0x451364['attributes']=_0x451364['attributes'][_0x9c25('0x37')]?_0x451364[_0x9c25('0x34')]:_0x23c6fa[_0x9c25('0x31')];if(_0xa6be65[_0x9c25('0x32')][_0x9c25('0x40')]){_0x451364[_0x9c25('0x41')]=[{'all':!![]}];}_0x451364=_[_0x9c25('0x3c')]({},_0x451364,_0xa6be65[_0x9c25('0x3f')]);return db[_0x9c25('0x2d')]['find'](_0x451364)['then'](handleEntityNotFound(_0x2a1190,null))[_0x9c25('0x23')](respondWithResult(_0x2a1190,null))['catch'](handleError(_0x2a1190,null));};exports[_0x9c25('0x47')]=function(_0x3c823d,_0x23928a,_0x45d8d9){return db[_0x9c25('0x2d')][_0x9c25('0x48')]({'where':{'id':_0x3c823d[_0x9c25('0x45')]['id']},'attributes':[_0x9c25('0x2b'),_0x9c25('0x49'),_0x9c25('0x4a')],'raw':!![]})[_0x9c25('0x23')](handleEntityNotFound(_0x23928a,null))[_0x9c25('0x23')](function(_0x5999ef){if(_0x5999ef){if(!fs[_0x9c25('0x4b')](path[_0x9c25('0x4c')](config[_0x9c25('0x4d')],_0x9c25('0x4e'),_0x5999ef[_0x9c25('0x49')]+'.'+_0x5999ef[_0x9c25('0x4a')]))){throw new db[(_0x9c25('0x4f'))]['ValidationError'](_0x9c25('0x50'));}return _0x23928a[_0x9c25('0x47')](path[_0x9c25('0x4c')](config['root'],'server/files/sounds/converted',util[_0x9c25('0x51')](_0x9c25('0x52'),_0x5999ef[_0x9c25('0x49')],_0x5999ef[_0x9c25('0x4a')])),util[_0x9c25('0x51')]('%s.%s',_0x5999ef[_0x9c25('0x2b')],_0x5999ef[_0x9c25('0x4a')]));}return null;})[_0x9c25('0x43')](handleError(_0x23928a,null));};exports[_0x9c25('0x53')]=function(_0x82ed67,_0x50d10c,_0x373b74){var _0x374367={'name':path[_0x9c25('0x54')](_0x82ed67[_0x9c25('0x55')]['originalname'],path['extname'](_0x82ed67[_0x9c25('0x55')][_0x9c25('0x56')])),'save_name':path['basename'](_0x82ed67['file'][_0x9c25('0x57')],path['extname'](_0x82ed67[_0x9c25('0x55')]['filename'])),'original_format':path[_0x9c25('0x58')](_0x82ed67[_0x9c25('0x55')][_0x9c25('0x56')])[_0x9c25('0x59')](0x1),'converted_format':'wav'};var _0x6b6c71=path[_0x9c25('0x4c')](config[_0x9c25('0x4d')],_0x9c25('0x5a'),_0x82ed67[_0x9c25('0x55')][_0x9c25('0x57')]);var _0x2eeb10=path['join'](config[_0x9c25('0x4d')],_0x9c25('0x4e'),util[_0x9c25('0x51')](_0x9c25('0x52'),path[_0x9c25('0x54')](_0x82ed67['file'][_0x9c25('0x57')],path[_0x9c25('0x58')](_0x82ed67['file'][_0x9c25('0x57')])),_0x374367[_0x9c25('0x4a')]));logger[_0x9c25('0x5b')]('Sound\x20upload\x20filepath:\x20%s',_0x6b6c71);logger[_0x9c25('0x5b')](_0x9c25('0x5c'),_0x2eeb10);try{fs[_0x9c25('0x5d')](_0x6b6c71,parseInt(_0x9c25('0x5e'),0x8));var _0x3c6f2a=sox[_0x9c25('0x5f')](_0x6b6c71,_0x2eeb10,{'sampleRate':0x1f40,'format':_0x9c25('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3c6f2a['on'](_0x9c25('0x2a'),function(_0x30978a){fs[_0x9c25('0x61')](_0x6b6c71);_0x50d10c[_0x9c25('0x1a')](0x1f4)['send'](_0x30978a);});_0x3c6f2a['on']('src',function(_0x933107){_0x374367[_0x9c25('0x62')]=isNaN(_0x933107[_0x9c25('0x63')])?null:_0x933107['duration']*0x3e8;_0x374367[_0x9c25('0x64')]=isNaN(_0x933107[_0x9c25('0x65')])?null:_0x933107[_0x9c25('0x65')];_0x374367[_0x9c25('0x66')]=isNaN(_0x933107[_0x9c25('0x67')])?null:_0x933107[_0x9c25('0x67')];_0x374367['original_bitRate']=isNaN(_0x933107[_0x9c25('0x68')])?null:_0x933107['bitRate'];_0x374367[_0x9c25('0x69')]=isNaN(_0x933107[_0x9c25('0x6a')])?null:_0x933107[_0x9c25('0x6a')];});_0x3c6f2a['on'](_0x9c25('0x6b'),function(_0x1df61e){_0x374367[_0x9c25('0x6c')]=isNaN(_0x1df61e[_0x9c25('0x63')])?null:_0x1df61e[_0x9c25('0x63')]*0x3e8;_0x374367[_0x9c25('0x6d')]=isNaN(_0x1df61e[_0x9c25('0x65')])?null:_0x1df61e[_0x9c25('0x65')];_0x374367[_0x9c25('0x6e')]=isNaN(_0x1df61e[_0x9c25('0x67')])?null:_0x1df61e[_0x9c25('0x67')];_0x374367[_0x9c25('0x6f')]=isNaN(_0x1df61e['bitRate'])?null:_0x1df61e[_0x9c25('0x68')];_0x374367['converted_sampleRate']=isNaN(_0x1df61e[_0x9c25('0x6a')])?null:_0x1df61e[_0x9c25('0x6a')];});_0x3c6f2a['on']('end',function(){fs['chmodSync'](_0x2eeb10,parseInt(_0x9c25('0x5e'),0x8));return db[_0x9c25('0x2d')]['create'](_0x374367)[_0x9c25('0x23')](function(_0x471cc2){var _0x398739={'role':_0x82ed67[_0x9c25('0x70')][_0x9c25('0x71')],'userProfileId':_0x82ed67[_0x9c25('0x70')][_0x9c25('0x72')]};if(!_0x398739)throw new Error(_0x9c25('0x73'));if(_0x398739[_0x9c25('0x71')]===_0x9c25('0x74')){var _0xecdf5e=_0x471cc2[_0x9c25('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x9c25('0x48')]({'where':{'name':_0x9c25('0x26'),'userProfileId':_0x398739['userProfileId']},'raw':!![]})['then'](function(_0xded341){if(_0xded341&&_0xded341[_0x9c25('0x75')]===0x0){return db['UserProfileResource'][_0x9c25('0x53')]({'name':_0xecdf5e[_0x9c25('0x2b')],'resourceId':_0xecdf5e['id'],'type':_0xded341['name'],'sectionId':_0xded341['id']},{})['then'](function(){return _0x471cc2;});}else{return _0x471cc2;}})[_0x9c25('0x43')](function(_0x5969c2){logger['error'](_0x9c25('0x76'),_0x5969c2);throw _0x5969c2;});}return _0x471cc2;})[_0x9c25('0x23')](respondWithResult(_0x50d10c,null))[_0x9c25('0x43')](handleError(_0x50d10c,null));});_0x3c6f2a[_0x9c25('0x77')]();}catch(_0x2e0e84){_0x50d10c[_0x9c25('0x1a')](0x1f4)[_0x9c25('0x78')](_0x2e0e84);}};exports[_0x9c25('0x22')]=function(_0x4f8241,_0x27d8a6,_0x94dfc7){return db[_0x9c25('0x2d')][_0x9c25('0x48')]({'where':{'id':_0x4f8241[_0x9c25('0x45')]['id']}})[_0x9c25('0x23')](handleEntityNotFound(_0x27d8a6,null))[_0x9c25('0x23')](saveUpdates(_[_0x9c25('0x3b')](_0x4f8241[_0x9c25('0x70')],[_0x9c25('0x2b'),_0x9c25('0x79')]),null))[_0x9c25('0x23')](respondWithResult(_0x27d8a6,null))[_0x9c25('0x43')](handleError(_0x27d8a6,null));};exports[_0x9c25('0x7a')]=function(_0x20ddec,_0x1b3bba,_0x115db1){return db[_0x9c25('0x2d')]['find']({'where':{'id':_0x20ddec[_0x9c25('0x45')]['id']}})[_0x9c25('0x23')](function(_0x44006f){if(_0x44006f){return _0x44006f[_0x9c25('0x24')]();}})[_0x9c25('0x23')](function(_0x3887db){var _0x3af5ab=path['join'](config[_0x9c25('0x4d')],_0x9c25('0x5a'),util[_0x9c25('0x51')](_0x9c25('0x52'),_0x3887db[_0x9c25('0x49')],_0x3887db[_0x9c25('0x7b')]));var _0x20ba4c=path['join'](config['root'],_0x9c25('0x4e'),util[_0x9c25('0x51')](_0x9c25('0x52'),_0x3887db['save_name'],_0x3887db[_0x9c25('0x4a')]));fs[_0x9c25('0x61')](_0x3af5ab);fs[_0x9c25('0x61')](_0x20ba4c);return _0x3887db;})['then'](function(_0x2ec1a2){if(_0x2ec1a2){return _0x1b3bba[_0x9c25('0x1a')](0xcc)[_0x9c25('0x28')]();}})[_0x9c25('0x23')](handleEntityNotFound(_0x1b3bba,null))['catch'](handleError(_0x1b3bba,null));}; \ No newline at end of file +var _0xaa88=['save_name','Sequelize','ValidationError','Sound\x20not\x20found','join','%s.%s','format','create','basename','originalname','extname','file','filename','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','description','delete','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','offset','limit','undefined','count','Content-Range','json','reject','save','then','get','Sounds','UserProfileResource','destroy','sendStatus','stack','name','index','map','Sound','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','rawAttributes','find','catch','download','params','converted_format','existsSync','root','server/files/sounds/converted'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0xaa88,0x120));var _0x8aa8=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xaa88[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8aa8('0x2'));var rp=require('request-promise');var moment=require(_0x8aa8('0x3'));var BPromise=require(_0x8aa8('0x4'));var Mustache=require(_0x8aa8('0x5'));var util=require(_0x8aa8('0x6'));var path=require(_0x8aa8('0x7'));var sox=require(_0x8aa8('0x8'));var csv=require(_0x8aa8('0x9'));var ejs=require(_0x8aa8('0xa'));var fs=require('fs');var fs_extra=require(_0x8aa8('0xb'));var _=require(_0x8aa8('0xc'));var squel=require(_0x8aa8('0xd'));var crypto=require(_0x8aa8('0xe'));var jsforce=require(_0x8aa8('0xf'));var deskjs=require(_0x8aa8('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8aa8('0x11'));var Redis=require(_0x8aa8('0x12'));var authService=require(_0x8aa8('0x13'));var qs=require(_0x8aa8('0x14'));var as=require(_0x8aa8('0x15'));var hardwareService=require(_0x8aa8('0x16'));var logger=require(_0x8aa8('0x17'))(_0x8aa8('0x18'));var utils=require(_0x8aa8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8aa8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x370148,_0x411836){_0x411836=_0x411836||0xcc;return function(_0xae6f6d){if(_0xae6f6d){return _0x370148['sendStatus'](_0x411836);}return _0x370148['status'](_0x411836)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4a4dc5,_0x35a910){_0x35a910=_0x35a910||0xc8;return function(_0x363818){if(_0x363818){return _0x4a4dc5[_0x8aa8('0x1c')](_0x35a910)['json'](_0x363818);}};}function respondWithFilteredResult(_0x1f6b2c,_0x36ab33){return function(_0x35bd1b){if(_0x35bd1b){var _0xe7df86=typeof _0x36ab33[_0x8aa8('0x1d')]==='undefined'&&typeof _0x36ab33[_0x8aa8('0x1e')]===_0x8aa8('0x1f');var _0x5c1a04=_0x35bd1b['count'];var _0x264b80=_0xe7df86?0x0:_0x36ab33[_0x8aa8('0x1d')];var _0x540762=_0xe7df86?_0x35bd1b[_0x8aa8('0x20')]:_0x36ab33[_0x8aa8('0x1d')]+_0x36ab33[_0x8aa8('0x1e')];var _0x8446b;if(_0x540762>=_0x5c1a04){_0x540762=_0x5c1a04;_0x8446b=0xc8;}else{_0x8446b=0xce;}_0x1f6b2c[_0x8aa8('0x1c')](_0x8446b);return _0x1f6b2c['set'](_0x8aa8('0x21'),_0x264b80+'-'+_0x540762+'/'+_0x5c1a04)[_0x8aa8('0x22')](_0x35bd1b);}return null;};}function patchUpdates(_0x4fc3f8){return function(_0x3835ff){try{jsonpatch['apply'](_0x3835ff,_0x4fc3f8,!![]);}catch(_0x715f0e){return BPromise[_0x8aa8('0x23')](_0x715f0e);}return _0x3835ff[_0x8aa8('0x24')]();};}function saveUpdates(_0x1b33e0,_0x24e1ab){return function(_0x26258a){if(_0x26258a){return _0x26258a['update'](_0x1b33e0)[_0x8aa8('0x25')](function(_0x1c1e5d){return _0x1c1e5d;});}return null;};}function removeEntity(_0x29c2df,_0x14f157){return function(_0x42b31d){if(_0x42b31d){return _0x42b31d['destroy']()[_0x8aa8('0x25')](function(){var _0x3de562=_0x42b31d[_0x8aa8('0x26')]({'plain':!![]});var _0x55d190=_0x8aa8('0x27');return db[_0x8aa8('0x28')][_0x8aa8('0x29')]({'where':{'type':_0x55d190,'resourceId':_0x3de562['id']}})[_0x8aa8('0x25')](function(){return _0x42b31d;});})['then'](function(){_0x29c2df['status'](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x5e132d,_0x3881c2){return function(_0x33599e){if(!_0x33599e){_0x5e132d[_0x8aa8('0x2a')](0x194);}return _0x33599e;};}function handleError(_0x1ff85a,_0x5de520){_0x5de520=_0x5de520||0x1f4;return function(_0x7360bb){logger['error'](_0x7360bb[_0x8aa8('0x2b')]);if(_0x7360bb[_0x8aa8('0x2c')]){delete _0x7360bb[_0x8aa8('0x2c')];}_0x1ff85a['status'](_0x5de520)['send'](_0x7360bb);};}exports[_0x8aa8('0x2d')]=function(_0x40a56f,_0x67be86){var _0x5559ae={},_0x78eac2={},_0xf0627c={'count':0x0,'rows':[]};var _0x28abae=_[_0x8aa8('0x2e')](db[_0x8aa8('0x2f')]['rawAttributes'],function(_0x257400){return{'name':_0x257400[_0x8aa8('0x30')],'type':_0x257400[_0x8aa8('0x31')][_0x8aa8('0x32')]};});_0x78eac2[_0x8aa8('0x33')]=_[_0x8aa8('0x2e')](_0x28abae,_0x8aa8('0x2c'));_0x78eac2[_0x8aa8('0x34')]=_[_0x8aa8('0x35')](_0x40a56f[_0x8aa8('0x34')]);_0x78eac2['filters']=_[_0x8aa8('0x36')](_0x78eac2[_0x8aa8('0x33')],_0x78eac2[_0x8aa8('0x34')]);_0x5559ae[_0x8aa8('0x37')]=_['intersection'](_0x78eac2[_0x8aa8('0x33')],qs[_0x8aa8('0x38')](_0x40a56f[_0x8aa8('0x34')][_0x8aa8('0x38')]));_0x5559ae[_0x8aa8('0x37')]=_0x5559ae[_0x8aa8('0x37')][_0x8aa8('0x39')]?_0x5559ae[_0x8aa8('0x37')]:_0x78eac2[_0x8aa8('0x33')];if(!_0x40a56f[_0x8aa8('0x34')][_0x8aa8('0x3a')](_0x8aa8('0x3b'))){_0x5559ae[_0x8aa8('0x1e')]=qs['limit'](_0x40a56f[_0x8aa8('0x34')][_0x8aa8('0x1e')]);_0x5559ae['offset']=qs[_0x8aa8('0x1d')](_0x40a56f['query'][_0x8aa8('0x1d')]);}_0x5559ae[_0x8aa8('0x3c')]=qs[_0x8aa8('0x3d')](_0x40a56f['query'][_0x8aa8('0x3d')]);_0x5559ae[_0x8aa8('0x3e')]=qs[_0x8aa8('0x3f')](_[_0x8aa8('0x40')](_0x40a56f['query'],_0x78eac2['filters']),_0x28abae);if(_0x40a56f[_0x8aa8('0x34')]['filter']){_0x5559ae[_0x8aa8('0x3e')]=_['merge'](_0x5559ae['where'],{'$or':_['map'](_0x28abae,function(_0x58d1fe){if(_0x58d1fe[_0x8aa8('0x31')]!=='VIRTUAL'){var _0x343e97={};_0x343e97[_0x58d1fe[_0x8aa8('0x2c')]]={'$like':'%'+_0x40a56f[_0x8aa8('0x34')][_0x8aa8('0x41')]+'%'};return _0x343e97;}})});}_0x5559ae=_[_0x8aa8('0x42')]({},_0x5559ae,_0x40a56f[_0x8aa8('0x43')]);var _0x470daf={'where':_0x5559ae[_0x8aa8('0x3e')]};return db[_0x8aa8('0x2f')][_0x8aa8('0x20')](_0x470daf)[_0x8aa8('0x25')](function(_0x163d3b){_0xf0627c[_0x8aa8('0x20')]=_0x163d3b;if(_0x40a56f['query'][_0x8aa8('0x44')]){_0x5559ae[_0x8aa8('0x45')]=[{'all':!![]}];}return db[_0x8aa8('0x2f')]['findAll'](_0x5559ae);})[_0x8aa8('0x25')](function(_0x317e58){_0xf0627c[_0x8aa8('0x46')]=_0x317e58;return _0xf0627c;})['then'](respondWithFilteredResult(_0x67be86,_0x5559ae))['catch'](handleError(_0x67be86,null));};exports[_0x8aa8('0x47')]=function(_0xdb1de6,_0x1acd13){var _0x59f18a={'raw':!![],'where':{'id':_0xdb1de6['params']['id']}},_0x47e521={};_0x47e521[_0x8aa8('0x33')]=_[_0x8aa8('0x35')](db[_0x8aa8('0x2f')][_0x8aa8('0x48')]);_0x47e521['query']=_[_0x8aa8('0x35')](_0xdb1de6[_0x8aa8('0x34')]);_0x47e521[_0x8aa8('0x3f')]=_[_0x8aa8('0x36')](_0x47e521[_0x8aa8('0x33')],_0x47e521['query']);_0x59f18a['attributes']=_['intersection'](_0x47e521['model'],qs[_0x8aa8('0x38')](_0xdb1de6[_0x8aa8('0x34')][_0x8aa8('0x38')]));_0x59f18a['attributes']=_0x59f18a[_0x8aa8('0x37')][_0x8aa8('0x39')]?_0x59f18a[_0x8aa8('0x37')]:_0x47e521[_0x8aa8('0x33')];if(_0xdb1de6[_0x8aa8('0x34')][_0x8aa8('0x44')]){_0x59f18a[_0x8aa8('0x45')]=[{'all':!![]}];}_0x59f18a=_[_0x8aa8('0x42')]({},_0x59f18a,_0xdb1de6[_0x8aa8('0x43')]);return db[_0x8aa8('0x2f')][_0x8aa8('0x49')](_0x59f18a)[_0x8aa8('0x25')](handleEntityNotFound(_0x1acd13,null))[_0x8aa8('0x25')](respondWithResult(_0x1acd13,null))[_0x8aa8('0x4a')](handleError(_0x1acd13,null));};exports[_0x8aa8('0x4b')]=function(_0x1aa131,_0x23f2a7,_0x30e399){return db[_0x8aa8('0x2f')]['find']({'where':{'id':_0x1aa131[_0x8aa8('0x4c')]['id']},'attributes':['name','save_name',_0x8aa8('0x4d')],'raw':!![]})[_0x8aa8('0x25')](handleEntityNotFound(_0x23f2a7,null))[_0x8aa8('0x25')](function(_0x40ea84){if(_0x40ea84){if(!fs[_0x8aa8('0x4e')](path['join'](config[_0x8aa8('0x4f')],_0x8aa8('0x50'),_0x40ea84[_0x8aa8('0x51')]+'.'+_0x40ea84['converted_format']))){throw new db[(_0x8aa8('0x52'))][(_0x8aa8('0x53'))](_0x8aa8('0x54'));}return _0x23f2a7[_0x8aa8('0x4b')](path[_0x8aa8('0x55')](config[_0x8aa8('0x4f')],_0x8aa8('0x50'),util['format'](_0x8aa8('0x56'),_0x40ea84[_0x8aa8('0x51')],_0x40ea84[_0x8aa8('0x4d')])),util[_0x8aa8('0x57')]('%s.%s',_0x40ea84[_0x8aa8('0x2c')],_0x40ea84['converted_format']));}return null;})[_0x8aa8('0x4a')](handleError(_0x23f2a7,null));};exports[_0x8aa8('0x58')]=function(_0x53986b,_0x3c2b57,_0x1524e2){var _0x654456={'name':path[_0x8aa8('0x59')](_0x53986b['file'][_0x8aa8('0x5a')],path[_0x8aa8('0x5b')](_0x53986b[_0x8aa8('0x5c')]['originalname'])),'save_name':path['basename'](_0x53986b[_0x8aa8('0x5c')][_0x8aa8('0x5d')],path[_0x8aa8('0x5b')](_0x53986b[_0x8aa8('0x5c')][_0x8aa8('0x5d')])),'original_format':path[_0x8aa8('0x5b')](_0x53986b[_0x8aa8('0x5c')][_0x8aa8('0x5a')])['substring'](0x1),'converted_format':'wav'};var _0x350a34=path[_0x8aa8('0x55')](config[_0x8aa8('0x4f')],_0x8aa8('0x5e'),_0x53986b[_0x8aa8('0x5c')][_0x8aa8('0x5d')]);var _0x78cc4f=path[_0x8aa8('0x55')](config[_0x8aa8('0x4f')],'server/files/sounds/converted',util[_0x8aa8('0x57')]('%s.%s',path[_0x8aa8('0x59')](_0x53986b['file'][_0x8aa8('0x5d')],path[_0x8aa8('0x5b')](_0x53986b[_0x8aa8('0x5c')]['filename'])),_0x654456[_0x8aa8('0x4d')]));logger[_0x8aa8('0x5f')]('Sound\x20upload\x20filepath:\x20%s',_0x350a34);logger[_0x8aa8('0x5f')](_0x8aa8('0x60'),_0x78cc4f);try{fs[_0x8aa8('0x61')](_0x350a34,parseInt(_0x8aa8('0x62'),0x8));var _0x50ef31=sox[_0x8aa8('0x63')](_0x350a34,_0x78cc4f,{'sampleRate':0x1f40,'format':_0x8aa8('0x64'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x50ef31['on'](_0x8aa8('0x65'),function(_0x492a0b){fs['unlinkSync'](_0x350a34);_0x3c2b57[_0x8aa8('0x1c')](0x1f4)[_0x8aa8('0x66')](_0x492a0b);});_0x50ef31['on'](_0x8aa8('0x67'),function(_0x54d744){_0x654456[_0x8aa8('0x68')]=isNaN(_0x54d744['duration'])?null:_0x54d744[_0x8aa8('0x69')]*0x3e8;_0x654456[_0x8aa8('0x6a')]=isNaN(_0x54d744['sampleCount'])?null:_0x54d744[_0x8aa8('0x6b')];_0x654456['original_channelCount']=isNaN(_0x54d744[_0x8aa8('0x6c')])?null:_0x54d744[_0x8aa8('0x6c')];_0x654456[_0x8aa8('0x6d')]=isNaN(_0x54d744[_0x8aa8('0x6e')])?null:_0x54d744[_0x8aa8('0x6e')];_0x654456['original_sampleRate']=isNaN(_0x54d744[_0x8aa8('0x6f')])?null:_0x54d744[_0x8aa8('0x6f')];});_0x50ef31['on']('dest',function(_0x307ad7){_0x654456[_0x8aa8('0x70')]=isNaN(_0x307ad7[_0x8aa8('0x69')])?null:_0x307ad7[_0x8aa8('0x69')]*0x3e8;_0x654456[_0x8aa8('0x71')]=isNaN(_0x307ad7[_0x8aa8('0x6b')])?null:_0x307ad7['sampleCount'];_0x654456['converted_channelCount']=isNaN(_0x307ad7[_0x8aa8('0x6c')])?null:_0x307ad7[_0x8aa8('0x6c')];_0x654456['converted_bitRate']=isNaN(_0x307ad7[_0x8aa8('0x6e')])?null:_0x307ad7[_0x8aa8('0x6e')];_0x654456[_0x8aa8('0x72')]=isNaN(_0x307ad7[_0x8aa8('0x6f')])?null:_0x307ad7[_0x8aa8('0x6f')];});_0x50ef31['on']('end',function(){fs[_0x8aa8('0x61')](_0x78cc4f,parseInt(_0x8aa8('0x62'),0x8));return db[_0x8aa8('0x2f')][_0x8aa8('0x58')](_0x654456)[_0x8aa8('0x25')](function(_0x4714b1){var _0x48219b={'role':_0x53986b[_0x8aa8('0x73')][_0x8aa8('0x74')],'userProfileId':_0x53986b[_0x8aa8('0x73')][_0x8aa8('0x75')]};if(!_0x48219b)throw new Error(_0x8aa8('0x76'));if(_0x48219b[_0x8aa8('0x74')]==='user'){var _0x2114e2=_0x4714b1[_0x8aa8('0x26')]({'plain':!![]});return db[_0x8aa8('0x77')][_0x8aa8('0x49')]({'where':{'name':_0x8aa8('0x27'),'userProfileId':_0x48219b[_0x8aa8('0x75')]},'raw':!![]})[_0x8aa8('0x25')](function(_0x3acf1b){if(_0x3acf1b&&_0x3acf1b['autoAssociation']===0x0){return db['UserProfileResource'][_0x8aa8('0x58')]({'name':_0x2114e2[_0x8aa8('0x2c')],'resourceId':_0x2114e2['id'],'type':_0x3acf1b['name'],'sectionId':_0x3acf1b['id']},{})[_0x8aa8('0x25')](function(){return _0x4714b1;});}else{return _0x4714b1;}})['catch'](function(_0x53aa07){logger[_0x8aa8('0x65')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53aa07);throw _0x53aa07;});}return _0x4714b1;})[_0x8aa8('0x25')](respondWithResult(_0x3c2b57,null))['catch'](handleError(_0x3c2b57,null));});_0x50ef31['start']();}catch(_0x88da62){_0x3c2b57[_0x8aa8('0x1c')](0x1f4)[_0x8aa8('0x66')](_0x88da62);}};exports['update']=function(_0x56f116,_0x10dee4,_0x315976){return db[_0x8aa8('0x2f')][_0x8aa8('0x49')]({'where':{'id':_0x56f116['params']['id']}})['then'](handleEntityNotFound(_0x10dee4,null))[_0x8aa8('0x25')](saveUpdates(_[_0x8aa8('0x40')](_0x56f116[_0x8aa8('0x73')],[_0x8aa8('0x2c'),_0x8aa8('0x78')]),null))[_0x8aa8('0x25')](respondWithResult(_0x10dee4,null))[_0x8aa8('0x4a')](handleError(_0x10dee4,null));};exports[_0x8aa8('0x79')]=function(_0xa2d263,_0x396753,_0x363954){return db['Sound'][_0x8aa8('0x49')]({'where':{'id':_0xa2d263[_0x8aa8('0x4c')]['id']}})[_0x8aa8('0x25')](function(_0xd6cb54){if(_0xd6cb54){return _0xd6cb54['destroy']();}})[_0x8aa8('0x25')](function(_0x27d006){var _0x70b66a=path[_0x8aa8('0x55')](config[_0x8aa8('0x4f')],'server/files/sounds/original',util[_0x8aa8('0x57')](_0x8aa8('0x56'),_0x27d006['save_name'],_0x27d006['original_format']));var _0x4ad726=path[_0x8aa8('0x55')](config[_0x8aa8('0x4f')],'server/files/sounds/converted',util[_0x8aa8('0x57')](_0x8aa8('0x56'),_0x27d006[_0x8aa8('0x51')],_0x27d006['converted_format']));fs[_0x8aa8('0x7a')](_0x70b66a);fs[_0x8aa8('0x7a')](_0x4ad726);return _0x27d006;})[_0x8aa8('0x25')](function(_0x535bde){if(_0x535bde){return _0x396753['status'](0xcc)[_0x8aa8('0x1b')]();}})['then'](handleEntityNotFound(_0x396753,null))[_0x8aa8('0x4a')](handleError(_0x396753,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index d169e10..371d9c8 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 _0x99d5=['util','../../config/logger','api','path','rimraf','./sound.attributes','exports','Sound','tools_sounds','lodash'];(function(_0x25e39e,_0x5f270d){var _0xdc664e=function(_0x1edf77){while(--_0x1edf77){_0x25e39e['push'](_0x25e39e['shift']());}};_0xdc664e(++_0x5f270d);}(_0x99d5,0x77));var _0x599d=function(_0x5ebe4b,_0x856beb){_0x5ebe4b=_0x5ebe4b-0x0;var _0x3330f7=_0x99d5[_0x5ebe4b];return _0x3330f7;};'use strict';var _=require(_0x599d('0x0'));var util=require(_0x599d('0x1'));var logger=require(_0x599d('0x2'))(_0x599d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x599d('0x4'));var rimraf=require(_0x599d('0x5'));var config=require('../../config/environment');var attributes=require(_0x599d('0x6'));module[_0x599d('0x7')]=function(_0x3657da,_0x461982){return _0x3657da['define'](_0x599d('0x8'),attributes,{'tableName':_0x599d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8581=['bluebird','request-promise','path','../../config/environment','./sound.attributes','define','Sound','lodash','../../config/logger','moment'];(function(_0x25550b,_0x16b0a1){var _0x4121fc=function(_0x5f3408){while(--_0x5f3408){_0x25550b['push'](_0x25550b['shift']());}};_0x4121fc(++_0x16b0a1);}(_0x8581,0x1e7));var _0x1858=function(_0x169639,_0x146136){_0x169639=_0x169639-0x0;var _0x277351=_0x8581[_0x169639];return _0x277351;};'use strict';var _=require(_0x1858('0x0'));var util=require('util');var logger=require(_0x1858('0x1'))('api');var moment=require(_0x1858('0x2'));var BPromise=require(_0x1858('0x3'));var rp=require(_0x1858('0x4'));var fs=require('fs');var path=require(_0x1858('0x5'));var rimraf=require('rimraf');var config=require(_0x1858('0x6'));var attributes=require(_0x1858('0x7'));module['exports']=function(_0x59359e,_0x295565){return _0x59359e[_0x1858('0x8')](_0x1858('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 63fc2e6..4da83f7 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 _0xb688=['where','include','map','model','attributes','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowSound','Sound','options','raw'];(function(_0x1a3389,_0x1f99f5){var _0x1df75a=function(_0x18b632){while(--_0x18b632){_0x1a3389['push'](_0x1a3389['shift']());}};_0x1df75a(++_0x1f99f5);}(_0xb688,0x1d7));var _0x8b68=function(_0x296cca,_0x2725e5){_0x296cca=_0x296cca-0x0;var _0x2da598=_0xb688[_0x296cca];return _0x2da598;};'use strict';var _=require(_0x8b68('0x0'));var util=require(_0x8b68('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b68('0x2'));var fs=require('fs');var Redis=require(_0x8b68('0x3'));var db=require(_0x8b68('0x4'))['db'];var utils=require(_0x8b68('0x5'));var logger=require(_0x8b68('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b68('0x7'));var client=jayson[_0x8b68('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ebfc0,_0x5dc390,_0x43b2d8){return new BPromise(function(_0x39a0b8,_0x31b7e9){return client[_0x8b68('0x9')](_0x5ebfc0,_0x43b2d8)[_0x8b68('0xa')](function(_0x3c07f4){logger[_0x8b68('0xb')](_0x8b68('0xc'),_0x5dc390,'request\x20sent');logger[_0x8b68('0xd')](_0x8b68('0xe'),_0x5dc390,_0x8b68('0xf'),JSON[_0x8b68('0x10')](_0x3c07f4));if(_0x3c07f4[_0x8b68('0x11')]){if(_0x3c07f4[_0x8b68('0x11')][_0x8b68('0x12')]===0x1f4){logger[_0x8b68('0x11')](_0x8b68('0xc'),_0x5dc390,_0x3c07f4[_0x8b68('0x11')][_0x8b68('0x13')]);return _0x31b7e9(_0x3c07f4['error'][_0x8b68('0x13')]);}logger[_0x8b68('0x11')]('Sound,\x20%s,\x20%s',_0x5dc390,_0x3c07f4['error']['message']);return _0x39a0b8(_0x3c07f4[_0x8b68('0x11')][_0x8b68('0x13')]);}else{logger[_0x8b68('0xb')]('Sound,\x20%s,\x20%s',_0x5dc390,'request\x20sent');_0x39a0b8(_0x3c07f4[_0x8b68('0x14')][_0x8b68('0x13')]);}})['catch'](function(_0x1fd2b4){logger[_0x8b68('0x11')](_0x8b68('0xc'),_0x5dc390,_0x1fd2b4);_0x31b7e9(_0x1fd2b4);});});}exports[_0x8b68('0x15')]=function(_0x2d54ef){var _0x137f99=this;return new Promise(function(_0x1c48fb,_0x228d7c){return db[_0x8b68('0x16')]['find']({'raw':_0x2d54ef[_0x8b68('0x17')]?_0x2d54ef[_0x8b68('0x17')][_0x8b68('0x18')]===undefined?!![]:![]:!![],'where':_0x2d54ef[_0x8b68('0x17')]?_0x2d54ef[_0x8b68('0x17')][_0x8b68('0x19')]||null:null,'attributes':_0x2d54ef[_0x8b68('0x17')]?_0x2d54ef[_0x8b68('0x17')]['attributes']||null:null,'include':_0x2d54ef[_0x8b68('0x17')]?_0x2d54ef[_0x8b68('0x17')][_0x8b68('0x1a')]?_[_0x8b68('0x1b')](_0x2d54ef[_0x8b68('0x17')]['include'],function(_0x57558f){return{'model':db[_0x57558f[_0x8b68('0x1c')]],'as':_0x57558f['as'],'attributes':_0x57558f['attributes'],'include':_0x57558f[_0x8b68('0x1a')]?_['map'](_0x57558f[_0x8b68('0x1a')],function(_0x34b87b){return{'model':db[_0x34b87b[_0x8b68('0x1c')]],'as':_0x34b87b['as'],'attributes':_0x34b87b['attributes'],'include':_0x34b87b[_0x8b68('0x1a')]?_[_0x8b68('0x1b')](_0x34b87b[_0x8b68('0x1a')],function(_0x18848e){return{'model':db[_0x18848e[_0x8b68('0x1c')]],'as':_0x18848e['as'],'attributes':_0x18848e[_0x8b68('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8b68('0xa')](function(_0x3d3ef4){logger[_0x8b68('0xb')]('ShowSound',_0x2d54ef);logger[_0x8b68('0xd')](_0x8b68('0x15'),_0x2d54ef,JSON[_0x8b68('0x10')](_0x3d3ef4));_0x1c48fb(_0x3d3ef4);})[_0x8b68('0x1e')](function(_0x22c9fa){logger[_0x8b68('0x11')](_0x8b68('0x15'),_0x22c9fa[_0x8b68('0x13')],_0x2d54ef);_0x228d7c(_0x137f99['error'](0x1f4,_0x22c9fa[_0x8b68('0x13')]));});});}; \ No newline at end of file +var _0x46b2=['code','Sound,\x20%s,\x20%s','message','catch','ShowSound','Sound','find','raw','options','include','map','model','attributes','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0x46b2,0xe0));var _0x246b=function(_0x5c190e,_0x5997ec){_0x5c190e=_0x5c190e-0x0;var _0x45948f=_0x46b2[_0x5c190e];return _0x45948f;};'use strict';var _=require(_0x246b('0x0'));var util=require('util');var moment=require(_0x246b('0x1'));var BPromise=require('bluebird');var rs=require(_0x246b('0x2'));var fs=require('fs');var Redis=require(_0x246b('0x3'));var db=require(_0x246b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x246b('0x5'))('rpc');var config=require(_0x246b('0x6'));var jayson=require(_0x246b('0x7'));var client=jayson[_0x246b('0x8')][_0x246b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f4434,_0x3d2353,_0x509e78){return new BPromise(function(_0x2f428c,_0x4185e5){return client['request'](_0x1f4434,_0x509e78)['then'](function(_0x3480f4){logger[_0x246b('0xa')]('Sound,\x20%s,\x20%s',_0x3d2353,_0x246b('0xb'));logger[_0x246b('0xc')](_0x246b('0xd'),_0x3d2353,_0x246b('0xb'),JSON[_0x246b('0xe')](_0x3480f4));if(_0x3480f4[_0x246b('0xf')]){if(_0x3480f4[_0x246b('0xf')][_0x246b('0x10')]===0x1f4){logger['error'](_0x246b('0x11'),_0x3d2353,_0x3480f4['error'][_0x246b('0x12')]);return _0x4185e5(_0x3480f4['error'][_0x246b('0x12')]);}logger['error'](_0x246b('0x11'),_0x3d2353,_0x3480f4[_0x246b('0xf')][_0x246b('0x12')]);return _0x2f428c(_0x3480f4[_0x246b('0xf')]['message']);}else{logger[_0x246b('0xa')](_0x246b('0x11'),_0x3d2353,'request\x20sent');_0x2f428c(_0x3480f4['result'][_0x246b('0x12')]);}})[_0x246b('0x13')](function(_0x3c35ff){logger[_0x246b('0xf')](_0x246b('0x11'),_0x3d2353,_0x3c35ff);_0x4185e5(_0x3c35ff);});});}exports[_0x246b('0x14')]=function(_0x1df58c){var _0x26c368=this;return new Promise(function(_0xe7b690,_0x4ec557){return db[_0x246b('0x15')][_0x246b('0x16')]({'raw':_0x1df58c['options']?_0x1df58c['options'][_0x246b('0x17')]===undefined?!![]:![]:!![],'where':_0x1df58c[_0x246b('0x18')]?_0x1df58c[_0x246b('0x18')]['where']||null:null,'attributes':_0x1df58c[_0x246b('0x18')]?_0x1df58c[_0x246b('0x18')]['attributes']||null:null,'include':_0x1df58c[_0x246b('0x18')]?_0x1df58c[_0x246b('0x18')][_0x246b('0x19')]?_[_0x246b('0x1a')](_0x1df58c[_0x246b('0x18')][_0x246b('0x19')],function(_0x165820){return{'model':db[_0x165820[_0x246b('0x1b')]],'as':_0x165820['as'],'attributes':_0x165820[_0x246b('0x1c')],'include':_0x165820[_0x246b('0x19')]?_['map'](_0x165820[_0x246b('0x19')],function(_0x57541b){return{'model':db[_0x57541b['model']],'as':_0x57541b['as'],'attributes':_0x57541b[_0x246b('0x1c')],'include':_0x57541b[_0x246b('0x19')]?_[_0x246b('0x1a')](_0x57541b[_0x246b('0x19')],function(_0x5c9bbf){return{'model':db[_0x5c9bbf[_0x246b('0x1b')]],'as':_0x5c9bbf['as'],'attributes':_0x5c9bbf[_0x246b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x246b('0x1d')](function(_0x584f75){logger[_0x246b('0xa')]('ShowSound',_0x1df58c);logger[_0x246b('0xc')]('ShowSound',_0x1df58c,JSON[_0x246b('0xe')](_0x584f75));_0xe7b690(_0x584f75);})[_0x246b('0x13')](function(_0x4841c7){logger[_0x246b('0xf')](_0x246b('0x14'),_0x4841c7[_0x246b('0x12')],_0x1df58c);_0x4ec557(_0x26c368[_0x246b('0xf')](0x1f4,_0x4841c7[_0x246b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index c43731a..addbc2e 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5cd2a9,_0x9d7a8d){var _0x1544ad=function(_0x22acdc){while(--_0x22acdc){_0x5cd2a9['push'](_0x5cd2a9['shift']());}};_0x1544ad(++_0x9d7a8d);}(_0xac4a,0x13f));var _0xaac4=function(_0x507af6,_0x31f5b6){_0x507af6=_0x507af6-0x0;var _0x33637a=_0xac4a[_0x507af6];return _0x33637a;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x5c0979,_0x287854){var _0x309972=function(_0x17defd){while(--_0x17defd){_0x5c0979['push'](_0x5c0979['shift']());}};_0x309972(++_0x287854);}(_0x4fc2,0x111));var _0x24fc=function(_0x5b25af,_0x121dd7){_0x5b25af=_0x5b25af-0x0;var _0x181a07=_0x4fc2[_0x5b25af];return _0x181a07;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a4911dd..c2ab4cb 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 _0xfd01=['sequelize','exports','STRING','medium','ENUM','out'];(function(_0x478cae,_0x3ac14b){var _0x47b631=function(_0x5af508){while(--_0x5af508){_0x478cae['push'](_0x478cae['shift']());}};_0x47b631(++_0x3ac14b);}(_0xfd01,0x1bc));var _0x1fd0=function(_0x3728b4,_0x1a38da){_0x3728b4=_0x3728b4-0x0;var _0x26dc9b=_0xfd01[_0x3728b4];return _0x26dc9b;};'use strict';var Sequelize=require(_0x1fd0('0x0'));module[_0x1fd0('0x1')]={'uniqueid':{'type':Sequelize[_0x1fd0('0x2')]},'body':{'type':Sequelize['TEXT'](_0x1fd0('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x1fd0('0x4')]('in',_0x1fd0('0x5')),'defaultValue':_0x1fd0('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x1fd0('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x01ab=['TEXT','medium','ENUM','out','sequelize','exports'];(function(_0x483351,_0xb26b44){var _0x2f9d65=function(_0x4b88eb){while(--_0x4b88eb){_0x483351['push'](_0x483351['shift']());}};_0x2f9d65(++_0xb26b44);}(_0x01ab,0xf4));var _0xb01a=function(_0x5b2809,_0x48b226){_0x5b2809=_0x5b2809-0x0;var _0x572dee=_0x01ab[_0x5b2809];return _0x572dee;};'use strict';var Sequelize=require(_0xb01a('0x0'));module[_0xb01a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xb01a('0x2')](_0xb01a('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xb01a('0x4')]('in','out'),'defaultValue':_0xb01a('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb01a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2825aad..9733fc7 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 _0x6c79=['rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','filter','type','merge','options','includeAll','include','findAll','rows','show','keys','create','body','catch','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','SquareMessage'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6c79,0x184));var _0x96c7=function(_0x51e496,_0xcd0e4b){_0x51e496=_0x51e496-0x0;var _0x19cb20=_0x6c79[_0x51e496];return _0x19cb20;};'use strict';var emlformat=require(_0x96c7('0x0'));var rimraf=require(_0x96c7('0x1'));var zipdir=require(_0x96c7('0x2'));var jsonpatch=require(_0x96c7('0x3'));var rp=require(_0x96c7('0x4'));var moment=require('moment');var BPromise=require(_0x96c7('0x5'));var Mustache=require('mustache');var util=require(_0x96c7('0x6'));var path=require(_0x96c7('0x7'));var sox=require(_0x96c7('0x8'));var csv=require(_0x96c7('0x9'));var ejs=require(_0x96c7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96c7('0xb'));var squel=require(_0x96c7('0xc'));var crypto=require(_0x96c7('0xd'));var jsforce=require(_0x96c7('0xe'));var deskjs=require(_0x96c7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x96c7('0x10'));var Papa=require(_0x96c7('0x11'));var Redis=require(_0x96c7('0x12'));var authService=require(_0x96c7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96c7('0x14'));var logger=require(_0x96c7('0x15'))('api');var utils=require(_0x96c7('0x16'));var config=require(_0x96c7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x96c7('0x18'))['db'];function respondWithStatusCode(_0x434b36,_0x5f4bf5){_0x5f4bf5=_0x5f4bf5||0xcc;return function(_0x35d77d){if(_0x35d77d){return _0x434b36['sendStatus'](_0x5f4bf5);}return _0x434b36[_0x96c7('0x19')](_0x5f4bf5)[_0x96c7('0x1a')]();};}function respondWithResult(_0x185b2e,_0x29ebe3){_0x29ebe3=_0x29ebe3||0xc8;return function(_0x260b9a){if(_0x260b9a){return _0x185b2e['status'](_0x29ebe3)[_0x96c7('0x1b')](_0x260b9a);}};}function respondWithFilteredResult(_0x4c4727,_0x5e30be){return function(_0x547d0a){if(_0x547d0a){var _0x530b5c=typeof _0x5e30be['offset']==='undefined'&&typeof _0x5e30be[_0x96c7('0x1c')]===_0x96c7('0x1d');var _0x139fd1=_0x547d0a[_0x96c7('0x1e')];var _0x2255d7=_0x530b5c?0x0:_0x5e30be[_0x96c7('0x1f')];var _0x29104d=_0x530b5c?_0x547d0a[_0x96c7('0x1e')]:_0x5e30be[_0x96c7('0x1f')]+_0x5e30be[_0x96c7('0x1c')];var _0x45a25f;if(_0x29104d>=_0x139fd1){_0x29104d=_0x139fd1;_0x45a25f=0xc8;}else{_0x45a25f=0xce;}_0x4c4727[_0x96c7('0x19')](_0x45a25f);return _0x4c4727['set'](_0x96c7('0x20'),_0x2255d7+'-'+_0x29104d+'/'+_0x139fd1)[_0x96c7('0x1b')](_0x547d0a);}return null;};}function patchUpdates(_0x2527ca){return function(_0xb78ee9){try{jsonpatch['apply'](_0xb78ee9,_0x2527ca,!![]);}catch(_0x23a000){return BPromise[_0x96c7('0x21')](_0x23a000);}return _0xb78ee9[_0x96c7('0x22')]();};}function saveUpdates(_0x1342b7,_0x466151){return function(_0x145c1a){if(_0x145c1a){return _0x145c1a[_0x96c7('0x23')](_0x1342b7)[_0x96c7('0x24')](function(_0x92884e){return _0x92884e;});}return null;};}function removeEntity(_0x70e67f,_0x6aec95){return function(_0x46eac5){if(_0x46eac5){return _0x46eac5['destroy']()['then'](function(){_0x70e67f['status'](0xcc)[_0x96c7('0x1a')]();});}};}function handleEntityNotFound(_0x2a70c1,_0x269b98){return function(_0x5cd090){if(!_0x5cd090){_0x2a70c1[_0x96c7('0x25')](0x194);}return _0x5cd090;};}function handleError(_0x341bcc,_0x2f9cec){_0x2f9cec=_0x2f9cec||0x1f4;return function(_0x5c7a40){logger[_0x96c7('0x26')](_0x5c7a40['stack']);if(_0x5c7a40[_0x96c7('0x27')]){delete _0x5c7a40[_0x96c7('0x27')];}_0x341bcc[_0x96c7('0x19')](_0x2f9cec)[_0x96c7('0x28')](_0x5c7a40);};}exports[_0x96c7('0x29')]=function(_0x54806d,_0x3a333f){var _0x225087={},_0x5c2c9e={},_0x543aa4={'count':0x0,'rows':[]};var _0xb4195d=_[_0x96c7('0x2a')](db[_0x96c7('0x2b')][_0x96c7('0x2c')],function(_0x116935){return{'name':_0x116935[_0x96c7('0x2d')],'type':_0x116935['type']['key']};});_0x5c2c9e[_0x96c7('0x2e')]=_['map'](_0xb4195d,_0x96c7('0x27'));_0x5c2c9e[_0x96c7('0x2f')]=_['keys'](_0x54806d[_0x96c7('0x2f')]);_0x5c2c9e[_0x96c7('0x30')]=_[_0x96c7('0x31')](_0x5c2c9e[_0x96c7('0x2e')],_0x5c2c9e[_0x96c7('0x2f')]);_0x225087['attributes']=_[_0x96c7('0x31')](_0x5c2c9e['model'],qs[_0x96c7('0x32')](_0x54806d['query']['fields']));_0x225087[_0x96c7('0x33')]=_0x225087[_0x96c7('0x33')][_0x96c7('0x34')]?_0x225087[_0x96c7('0x33')]:_0x5c2c9e[_0x96c7('0x2e')];if(!_0x54806d[_0x96c7('0x2f')]['hasOwnProperty'](_0x96c7('0x35'))){_0x225087['limit']=qs[_0x96c7('0x1c')](_0x54806d[_0x96c7('0x2f')][_0x96c7('0x1c')]);_0x225087[_0x96c7('0x1f')]=qs[_0x96c7('0x1f')](_0x54806d[_0x96c7('0x2f')][_0x96c7('0x1f')]);}_0x225087[_0x96c7('0x36')]=qs['sort'](_0x54806d[_0x96c7('0x2f')]['sort']);_0x225087[_0x96c7('0x37')]=qs[_0x96c7('0x30')](_['pick'](_0x54806d['query'],_0x5c2c9e[_0x96c7('0x30')]),_0xb4195d);if(_0x54806d['query'][_0x96c7('0x38')]){_0x225087['where']=_['merge'](_0x225087['where'],{'$or':_[_0x96c7('0x2a')](_0xb4195d,function(_0x4c28f9){if(_0x4c28f9[_0x96c7('0x39')]!=='VIRTUAL'){var _0xd7bcdf={};_0xd7bcdf[_0x4c28f9['name']]={'$like':'%'+_0x54806d[_0x96c7('0x2f')][_0x96c7('0x38')]+'%'};return _0xd7bcdf;}})});}_0x225087=_[_0x96c7('0x3a')]({},_0x225087,_0x54806d[_0x96c7('0x3b')]);var _0x2c8916={'where':_0x225087[_0x96c7('0x37')]};return db[_0x96c7('0x2b')][_0x96c7('0x1e')](_0x2c8916)[_0x96c7('0x24')](function(_0x5dede1){_0x543aa4[_0x96c7('0x1e')]=_0x5dede1;if(_0x54806d['query'][_0x96c7('0x3c')]){_0x225087[_0x96c7('0x3d')]=[{'all':!![]}];}return db['SquareMessage'][_0x96c7('0x3e')](_0x225087);})[_0x96c7('0x24')](function(_0x5ca7c1){_0x543aa4[_0x96c7('0x3f')]=_0x5ca7c1;return _0x543aa4;})[_0x96c7('0x24')](respondWithFilteredResult(_0x3a333f,_0x225087))['catch'](handleError(_0x3a333f,null));};exports[_0x96c7('0x40')]=function(_0x12108f,_0x1690c4){var _0x53cb0f={'raw':!![],'where':{'id':_0x12108f['params']['id']}},_0x13235e={};_0x13235e['model']=_['keys'](db['SquareMessage'][_0x96c7('0x2c')]);_0x13235e[_0x96c7('0x2f')]=_[_0x96c7('0x41')](_0x12108f['query']);_0x13235e[_0x96c7('0x30')]=_[_0x96c7('0x31')](_0x13235e['model'],_0x13235e[_0x96c7('0x2f')]);_0x53cb0f[_0x96c7('0x33')]=_['intersection'](_0x13235e[_0x96c7('0x2e')],qs[_0x96c7('0x32')](_0x12108f[_0x96c7('0x2f')][_0x96c7('0x32')]));_0x53cb0f[_0x96c7('0x33')]=_0x53cb0f[_0x96c7('0x33')][_0x96c7('0x34')]?_0x53cb0f[_0x96c7('0x33')]:_0x13235e['model'];if(_0x12108f[_0x96c7('0x2f')][_0x96c7('0x3c')]){_0x53cb0f[_0x96c7('0x3d')]=[{'all':!![]}];}_0x53cb0f=_[_0x96c7('0x3a')]({},_0x53cb0f,_0x12108f['options']);return db[_0x96c7('0x2b')]['find'](_0x53cb0f)['then'](handleEntityNotFound(_0x1690c4,null))[_0x96c7('0x24')](respondWithResult(_0x1690c4,null))['catch'](handleError(_0x1690c4,null));};exports['create']=function(_0x3e411b,_0x1d3bcb){return db[_0x96c7('0x2b')][_0x96c7('0x42')](_0x3e411b[_0x96c7('0x43')],{})['then'](respondWithResult(_0x1d3bcb,0xc9))[_0x96c7('0x44')](handleError(_0x1d3bcb,null));};exports[_0x96c7('0x23')]=function(_0x152978,_0xb2e976){if(_0x152978[_0x96c7('0x43')]['id']){delete _0x152978[_0x96c7('0x43')]['id'];}return db[_0x96c7('0x2b')][_0x96c7('0x45')]({'where':{'id':_0x152978[_0x96c7('0x46')]['id']}})[_0x96c7('0x24')](handleEntityNotFound(_0xb2e976,null))[_0x96c7('0x24')](saveUpdates(_0x152978[_0x96c7('0x43')],null))['then'](respondWithResult(_0xb2e976,null))[_0x96c7('0x44')](handleError(_0xb2e976,null));};exports[_0x96c7('0x47')]=function(_0x175150,_0x2b89b8){return db[_0x96c7('0x2b')][_0x96c7('0x45')]({'where':{'id':_0x175150['params']['id']}})[_0x96c7('0x24')](handleEntityNotFound(_0x2b89b8,null))[_0x96c7('0x24')](removeEntity(_0x2b89b8,null))[_0x96c7('0x44')](handleError(_0x2b89b8,null));}; \ No newline at end of file +var _0x40ac=['order','sort','pick','filter','where','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','destroy','error','name','map','SquareMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x38cfb2,_0x554c2f){var _0xef36aa=function(_0x34b553){while(--_0x34b553){_0x38cfb2['push'](_0x38cfb2['shift']());}};_0xef36aa(++_0x554c2f);}(_0x40ac,0x1de));var _0xc40a=function(_0x443f85,_0x53c6a2){_0x443f85=_0x443f85-0x0;var _0x4e8d34=_0x40ac[_0x443f85];return _0x4e8d34;};'use strict';var emlformat=require(_0xc40a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc40a('0x1'));var jsonpatch=require(_0xc40a('0x2'));var rp=require(_0xc40a('0x3'));var moment=require(_0xc40a('0x4'));var BPromise=require(_0xc40a('0x5'));var Mustache=require(_0xc40a('0x6'));var util=require(_0xc40a('0x7'));var path=require('path');var sox=require(_0xc40a('0x8'));var csv=require(_0xc40a('0x9'));var ejs=require(_0xc40a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc40a('0xb'));var crypto=require(_0xc40a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc40a('0xd'));var toCsv=require(_0xc40a('0x9'));var querystring=require(_0xc40a('0xe'));var Papa=require(_0xc40a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc40a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc40a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xc40a('0x12'));var licenseUtil=require(_0xc40a('0x13'));var db=require(_0xc40a('0x14'))['db'];function respondWithStatusCode(_0xc379e1,_0x1e2676){_0x1e2676=_0x1e2676||0xcc;return function(_0x290e7b){if(_0x290e7b){return _0xc379e1[_0xc40a('0x15')](_0x1e2676);}return _0xc379e1[_0xc40a('0x16')](_0x1e2676)['end']();};}function respondWithResult(_0x3f8c9d,_0x3ba8e8){_0x3ba8e8=_0x3ba8e8||0xc8;return function(_0x4a360c){if(_0x4a360c){return _0x3f8c9d[_0xc40a('0x16')](_0x3ba8e8)['json'](_0x4a360c);}};}function respondWithFilteredResult(_0x33cd18,_0x5e65ce){return function(_0x1a8654){if(_0x1a8654){var _0x3eeeb8=typeof _0x5e65ce[_0xc40a('0x17')]==='undefined'&&typeof _0x5e65ce[_0xc40a('0x18')]===_0xc40a('0x19');var _0x158625=_0x1a8654['count'];var _0x4cab5b=_0x3eeeb8?0x0:_0x5e65ce[_0xc40a('0x17')];var _0x5d5e71=_0x3eeeb8?_0x1a8654[_0xc40a('0x1a')]:_0x5e65ce['offset']+_0x5e65ce[_0xc40a('0x18')];var _0x294339;if(_0x5d5e71>=_0x158625){_0x5d5e71=_0x158625;_0x294339=0xc8;}else{_0x294339=0xce;}_0x33cd18[_0xc40a('0x16')](_0x294339);return _0x33cd18[_0xc40a('0x1b')]('Content-Range',_0x4cab5b+'-'+_0x5d5e71+'/'+_0x158625)[_0xc40a('0x1c')](_0x1a8654);}return null;};}function patchUpdates(_0x125e1b){return function(_0x4ce4ed){try{jsonpatch[_0xc40a('0x1d')](_0x4ce4ed,_0x125e1b,!![]);}catch(_0x4a6ca9){return BPromise['reject'](_0x4a6ca9);}return _0x4ce4ed[_0xc40a('0x1e')]();};}function saveUpdates(_0x1ea9f9,_0x4233fc){return function(_0x2d9eaf){if(_0x2d9eaf){return _0x2d9eaf[_0xc40a('0x1f')](_0x1ea9f9)[_0xc40a('0x20')](function(_0x149754){return _0x149754;});}return null;};}function removeEntity(_0x511413,_0xae5a35){return function(_0x5dffaf){if(_0x5dffaf){return _0x5dffaf[_0xc40a('0x21')]()['then'](function(){_0x511413[_0xc40a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f37c5,_0x4d4785){return function(_0x3aa78f){if(!_0x3aa78f){_0x1f37c5[_0xc40a('0x15')](0x194);}return _0x3aa78f;};}function handleError(_0x27346e,_0x5c144e){_0x5c144e=_0x5c144e||0x1f4;return function(_0x4eed6a){logger[_0xc40a('0x22')](_0x4eed6a['stack']);if(_0x4eed6a[_0xc40a('0x23')]){delete _0x4eed6a[_0xc40a('0x23')];}_0x27346e['status'](_0x5c144e)['send'](_0x4eed6a);};}exports['index']=function(_0x14240f,_0x7fc56d){var _0x7769dd={},_0x2f3c49={},_0x473b2a={'count':0x0,'rows':[]};var _0x468b6d=_[_0xc40a('0x24')](db[_0xc40a('0x25')]['rawAttributes'],function(_0x3e825f){return{'name':_0x3e825f[_0xc40a('0x26')],'type':_0x3e825f[_0xc40a('0x27')][_0xc40a('0x28')]};});_0x2f3c49[_0xc40a('0x29')]=_[_0xc40a('0x24')](_0x468b6d,_0xc40a('0x23'));_0x2f3c49[_0xc40a('0x2a')]=_[_0xc40a('0x2b')](_0x14240f[_0xc40a('0x2a')]);_0x2f3c49['filters']=_[_0xc40a('0x2c')](_0x2f3c49[_0xc40a('0x29')],_0x2f3c49[_0xc40a('0x2a')]);_0x7769dd[_0xc40a('0x2d')]=_[_0xc40a('0x2c')](_0x2f3c49[_0xc40a('0x29')],qs['fields'](_0x14240f['query'][_0xc40a('0x2e')]));_0x7769dd[_0xc40a('0x2d')]=_0x7769dd[_0xc40a('0x2d')][_0xc40a('0x2f')]?_0x7769dd[_0xc40a('0x2d')]:_0x2f3c49['model'];if(!_0x14240f[_0xc40a('0x2a')][_0xc40a('0x30')](_0xc40a('0x31'))){_0x7769dd[_0xc40a('0x18')]=qs[_0xc40a('0x18')](_0x14240f[_0xc40a('0x2a')][_0xc40a('0x18')]);_0x7769dd[_0xc40a('0x17')]=qs['offset'](_0x14240f[_0xc40a('0x2a')][_0xc40a('0x17')]);}_0x7769dd[_0xc40a('0x32')]=qs[_0xc40a('0x33')](_0x14240f[_0xc40a('0x2a')][_0xc40a('0x33')]);_0x7769dd['where']=qs['filters'](_[_0xc40a('0x34')](_0x14240f[_0xc40a('0x2a')],_0x2f3c49['filters']),_0x468b6d);if(_0x14240f[_0xc40a('0x2a')][_0xc40a('0x35')]){_0x7769dd[_0xc40a('0x36')]=_[_0xc40a('0x37')](_0x7769dd[_0xc40a('0x36')],{'$or':_[_0xc40a('0x24')](_0x468b6d,function(_0x3dfea7){if(_0x3dfea7[_0xc40a('0x27')]!==_0xc40a('0x38')){var _0x5a6408={};_0x5a6408[_0x3dfea7[_0xc40a('0x23')]]={'$like':'%'+_0x14240f[_0xc40a('0x2a')][_0xc40a('0x35')]+'%'};return _0x5a6408;}})});}_0x7769dd=_[_0xc40a('0x37')]({},_0x7769dd,_0x14240f['options']);var _0x3591eb={'where':_0x7769dd[_0xc40a('0x36')]};return db[_0xc40a('0x25')][_0xc40a('0x1a')](_0x3591eb)[_0xc40a('0x20')](function(_0x2ed05a){_0x473b2a[_0xc40a('0x1a')]=_0x2ed05a;if(_0x14240f[_0xc40a('0x2a')][_0xc40a('0x39')]){_0x7769dd['include']=[{'all':!![]}];}return db[_0xc40a('0x25')]['findAll'](_0x7769dd);})[_0xc40a('0x20')](function(_0xafd676){_0x473b2a['rows']=_0xafd676;return _0x473b2a;})[_0xc40a('0x20')](respondWithFilteredResult(_0x7fc56d,_0x7769dd))[_0xc40a('0x3a')](handleError(_0x7fc56d,null));};exports[_0xc40a('0x3b')]=function(_0x301915,_0x583045){var _0x27494d={'raw':!![],'where':{'id':_0x301915[_0xc40a('0x3c')]['id']}},_0x3bc1fa={};_0x3bc1fa['model']=_['keys'](db[_0xc40a('0x25')][_0xc40a('0x3d')]);_0x3bc1fa[_0xc40a('0x2a')]=_[_0xc40a('0x2b')](_0x301915[_0xc40a('0x2a')]);_0x3bc1fa['filters']=_[_0xc40a('0x2c')](_0x3bc1fa[_0xc40a('0x29')],_0x3bc1fa[_0xc40a('0x2a')]);_0x27494d[_0xc40a('0x2d')]=_['intersection'](_0x3bc1fa[_0xc40a('0x29')],qs[_0xc40a('0x2e')](_0x301915[_0xc40a('0x2a')][_0xc40a('0x2e')]));_0x27494d[_0xc40a('0x2d')]=_0x27494d['attributes'][_0xc40a('0x2f')]?_0x27494d[_0xc40a('0x2d')]:_0x3bc1fa['model'];if(_0x301915[_0xc40a('0x2a')][_0xc40a('0x39')]){_0x27494d['include']=[{'all':!![]}];}_0x27494d=_['merge']({},_0x27494d,_0x301915[_0xc40a('0x3e')]);return db[_0xc40a('0x25')]['find'](_0x27494d)['then'](handleEntityNotFound(_0x583045,null))['then'](respondWithResult(_0x583045,null))[_0xc40a('0x3a')](handleError(_0x583045,null));};exports[_0xc40a('0x3f')]=function(_0x562b7f,_0x412d5c){return db[_0xc40a('0x25')][_0xc40a('0x3f')](_0x562b7f[_0xc40a('0x40')],{})[_0xc40a('0x20')](respondWithResult(_0x412d5c,0xc9))[_0xc40a('0x3a')](handleError(_0x412d5c,null));};exports['update']=function(_0x23cd85,_0x2380c9){if(_0x23cd85[_0xc40a('0x40')]['id']){delete _0x23cd85[_0xc40a('0x40')]['id'];}return db[_0xc40a('0x25')][_0xc40a('0x41')]({'where':{'id':_0x23cd85['params']['id']}})[_0xc40a('0x20')](handleEntityNotFound(_0x2380c9,null))[_0xc40a('0x20')](saveUpdates(_0x23cd85[_0xc40a('0x40')],null))[_0xc40a('0x20')](respondWithResult(_0x2380c9,null))['catch'](handleError(_0x2380c9,null));};exports[_0xc40a('0x21')]=function(_0x4fdb63,_0x4f9ef7){return db[_0xc40a('0x25')]['find']({'where':{'id':_0x4fdb63['params']['id']}})['then'](handleEntityNotFound(_0x4f9ef7,null))[_0xc40a('0x20')](removeEntity(_0x4f9ef7,null))[_0xc40a('0x3a')](handleError(_0x4f9ef7,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 7637c2f..61efe28 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 _0x83de=['define','SquareMessage','square_messages','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x83de,0xff));var _0xe83d=function(_0x38aa80,_0x3a9d57){_0x38aa80=_0x38aa80-0x0;var _0x134b7f=_0x83de[_0x38aa80];return _0x134b7f;};'use strict';var _=require(_0xe83d('0x0'));var util=require('util');var logger=require(_0xe83d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe83d('0x2'));var rp=require(_0xe83d('0x3'));var fs=require('fs');var path=require(_0xe83d('0x4'));var rimraf=require(_0xe83d('0x5'));var config=require(_0xe83d('0x6'));var attributes=require(_0xe83d('0x7'));module[_0xe83d('0x8')]=function(_0x2bf182,_0x192e29){return _0x2bf182[_0xe83d('0x9')](_0xe83d('0xa'),attributes,{'tableName':_0xe83d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bce=['define','SquareMessage','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x140616,_0x58bbb){var _0x165ba6=function(_0x3ba2bf){while(--_0x3ba2bf){_0x140616['push'](_0x140616['shift']());}};_0x165ba6(++_0x58bbb);}(_0x9bce,0xca));var _0xe9bc=function(_0x1e87f5,_0x59571c){_0x1e87f5=_0x1e87f5-0x0;var _0x2d03ac=_0x9bce[_0x1e87f5];return _0x2d03ac;};'use strict';var _=require(_0xe9bc('0x0'));var util=require(_0xe9bc('0x1'));var logger=require('../../config/logger')(_0xe9bc('0x2'));var moment=require('moment');var BPromise=require(_0xe9bc('0x3'));var rp=require(_0xe9bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9bc('0x5'));var config=require(_0xe9bc('0x6'));var attributes=require(_0xe9bc('0x7'));module['exports']=function(_0x4641fb,_0x1d50f4){return _0x4641fb[_0xe9bc('0x8')](_0xe9bc('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index f5243a3..4a66618 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 _0x6326=['CreateSquareMessage','SquareMessage','create','body','options','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x473f42,_0x2bf168){var _0x489f33=function(_0x4f2bfb){while(--_0x4f2bfb){_0x473f42['push'](_0x473f42['shift']());}};_0x489f33(++_0x2bf168);}(_0x6326,0x1cd));var _0x6632=function(_0xa059ea,_0x5cb91e){_0xa059ea=_0xa059ea-0x0;var _0x156a4c=_0x6326[_0xa059ea];return _0x156a4c;};'use strict';var _=require(_0x6632('0x0'));var util=require('util');var moment=require(_0x6632('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6632('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6632('0x3'))(_0x6632('0x4'));var config=require(_0x6632('0x5'));var jayson=require(_0x6632('0x6'));var client=jayson[_0x6632('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ae2c6,_0x33c18d,_0x342ce6){return new BPromise(function(_0x4fa720,_0x14409a){return client['request'](_0x1ae2c6,_0x342ce6)[_0x6632('0x8')](function(_0x4e1403){logger[_0x6632('0x9')](_0x6632('0xa'),_0x33c18d,_0x6632('0xb'));logger[_0x6632('0xc')](_0x6632('0xd'),_0x33c18d,'request\x20sent',JSON[_0x6632('0xe')](_0x4e1403));if(_0x4e1403[_0x6632('0xf')]){if(_0x4e1403[_0x6632('0xf')][_0x6632('0x10')]===0x1f4){logger[_0x6632('0xf')]('SquareMessage,\x20%s,\x20%s',_0x33c18d,_0x4e1403[_0x6632('0xf')]['message']);return _0x14409a(_0x4e1403[_0x6632('0xf')][_0x6632('0x11')]);}logger[_0x6632('0xf')]('SquareMessage,\x20%s,\x20%s',_0x33c18d,_0x4e1403[_0x6632('0xf')][_0x6632('0x11')]);return _0x4fa720(_0x4e1403[_0x6632('0xf')]['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x33c18d,_0x6632('0xb'));_0x4fa720(_0x4e1403['result'][_0x6632('0x11')]);}})[_0x6632('0x12')](function(_0x5afb8c){logger['error']('SquareMessage,\x20%s,\x20%s',_0x33c18d,_0x5afb8c);_0x14409a(_0x5afb8c);});});}exports[_0x6632('0x13')]=function(_0xba152a){var _0x386f3f=this;return new Promise(function(_0x3fd21b,_0x56360c){return db[_0x6632('0x14')][_0x6632('0x15')](_0xba152a[_0x6632('0x16')],{'raw':_0xba152a[_0x6632('0x17')]?_0xba152a[_0x6632('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x6632('0x8')](function(_0x488507){logger[_0x6632('0x9')]('CreateSquareMessage',_0xba152a);logger['debug']('CreateSquareMessage',_0xba152a,JSON[_0x6632('0xe')](_0x488507));_0x3fd21b(_0x488507);})['catch'](function(_0x4d4b82){logger['error'](_0x6632('0x13'),_0x4d4b82[_0x6632('0x11')],_0xba152a);_0x56360c(_0x386f3f[_0x6632('0xf')](0x1f4,_0x4d4b82[_0x6632('0x11')]));});});}; \ No newline at end of file +var _0x3e50=['SquareMessage','create','body','options','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSquareMessage'];(function(_0x2c5c8b,_0x3326d7){var _0x2c9cf9=function(_0x457832){while(--_0x457832){_0x2c5c8b['push'](_0x2c5c8b['shift']());}};_0x2c9cf9(++_0x3326d7);}(_0x3e50,0x108));var _0x03e5=function(_0x1d04d4,_0x11e0cb){_0x1d04d4=_0x1d04d4-0x0;var _0x3d7f83=_0x3e50[_0x1d04d4];return _0x3d7f83;};'use strict';var _=require(_0x03e5('0x0'));var util=require('util');var moment=require(_0x03e5('0x1'));var BPromise=require(_0x03e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03e5('0x3'))['db'];var utils=require(_0x03e5('0x4'));var logger=require(_0x03e5('0x5'))('rpc');var config=require(_0x03e5('0x6'));var jayson=require(_0x03e5('0x7'));var client=jayson[_0x03e5('0x8')][_0x03e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xeb3495,_0x25855e,_0x209331){return new BPromise(function(_0xa195c8,_0x587dab){return client[_0x03e5('0xa')](_0xeb3495,_0x209331)[_0x03e5('0xb')](function(_0x5449ea){logger[_0x03e5('0xc')](_0x03e5('0xd'),_0x25855e,_0x03e5('0xe'));logger[_0x03e5('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x25855e,_0x03e5('0xe'),JSON[_0x03e5('0x10')](_0x5449ea));if(_0x5449ea[_0x03e5('0x11')]){if(_0x5449ea[_0x03e5('0x11')]['code']===0x1f4){logger['error'](_0x03e5('0xd'),_0x25855e,_0x5449ea['error']['message']);return _0x587dab(_0x5449ea[_0x03e5('0x11')][_0x03e5('0x12')]);}logger['error'](_0x03e5('0xd'),_0x25855e,_0x5449ea[_0x03e5('0x11')][_0x03e5('0x12')]);return _0xa195c8(_0x5449ea[_0x03e5('0x11')][_0x03e5('0x12')]);}else{logger[_0x03e5('0xc')]('SquareMessage,\x20%s,\x20%s',_0x25855e,_0x03e5('0xe'));_0xa195c8(_0x5449ea[_0x03e5('0x13')][_0x03e5('0x12')]);}})[_0x03e5('0x14')](function(_0x1dcd9b){logger[_0x03e5('0x11')](_0x03e5('0xd'),_0x25855e,_0x1dcd9b);_0x587dab(_0x1dcd9b);});});}exports[_0x03e5('0x15')]=function(_0x1654ac){var _0x5a8867=this;return new Promise(function(_0x51dcdf,_0xd6adda){return db[_0x03e5('0x16')][_0x03e5('0x17')](_0x1654ac[_0x03e5('0x18')],{'raw':_0x1654ac[_0x03e5('0x19')]?_0x1654ac[_0x03e5('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x03e5('0xb')](function(_0x6cf63d){logger[_0x03e5('0xc')](_0x03e5('0x15'),_0x1654ac);logger[_0x03e5('0xf')](_0x03e5('0x15'),_0x1654ac,JSON['stringify'](_0x6cf63d));_0x51dcdf(_0x6cf63d);})[_0x03e5('0x14')](function(_0x2affbb){logger[_0x03e5('0x11')](_0x03e5('0x15'),_0x2affbb[_0x03e5('0x12')],_0x1654ac);_0xd6adda(_0x5a8867['error'](0x1f4,_0x2affbb['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 4e52a20..b502926 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 _0xe115=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','create','put','update'];(function(_0x434b4c,_0x2f9dcc){var _0x2d0187=function(_0x18a955){while(--_0x18a955){_0x434b4c['push'](_0x434b4c['shift']());}};_0x2d0187(++_0x2f9dcc);}(_0xe115,0xeb));var _0x5e11=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe115[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x5e11('0x0'));var util=require(_0x5e11('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5e11('0x2'));var router=express[_0x5e11('0x3')]();var fs_extra=require(_0x5e11('0x4'));var auth=require(_0x5e11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5e11('0x6'));var controller=require('./squareOdbc.controller');router[_0x5e11('0x7')]('/',auth[_0x5e11('0x8')](),controller[_0x5e11('0x9')]);router[_0x5e11('0x7')](_0x5e11('0xa'),auth[_0x5e11('0x8')](),controller[_0x5e11('0xb')]);router[_0x5e11('0x7')](_0x5e11('0xc'),auth['isAuthenticated'](),timeout(_0x5e11('0xd')),controller['test']);router['post']('/',auth[_0x5e11('0x8')](),controller[_0x5e11('0xe')]);router[_0x5e11('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5e11('0x10')]);router['delete']('/:id',auth[_0x5e11('0x8')](),controller['destroy']);module[_0x5e11('0x11')]=router; \ No newline at end of file +var _0xc1cd=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','15s','test','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1cd,0x1e4));var _0xdc1c=function(_0x56bb29,_0x49bb04){_0x56bb29=_0x56bb29-0x0;var _0x455259=_0xc1cd[_0x56bb29];return _0x455259;};'use strict';var multer=require(_0xdc1c('0x0'));var util=require(_0xdc1c('0x1'));var path=require(_0xdc1c('0x2'));var timeout=require(_0xdc1c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdc1c('0x4'));var interaction=require(_0xdc1c('0x5'));var config=require(_0xdc1c('0x6'));var controller=require('./squareOdbc.controller');router[_0xdc1c('0x7')]('/',auth['isAuthenticated'](),controller[_0xdc1c('0x8')]);router[_0xdc1c('0x7')](_0xdc1c('0x9'),auth[_0xdc1c('0xa')](),controller['show']);router[_0xdc1c('0x7')]('/:id/test',auth[_0xdc1c('0xa')](),timeout(_0xdc1c('0xb')),controller[_0xdc1c('0xc')]);router[_0xdc1c('0xd')]('/',auth['isAuthenticated'](),controller[_0xdc1c('0xe')]);router[_0xdc1c('0xf')](_0xdc1c('0x9'),auth[_0xdc1c('0xa')](),controller[_0xdc1c('0x10')]);router[_0xdc1c('0x11')](_0xdc1c('0x9'),auth[_0xdc1c('0xa')](),controller[_0xdc1c('0x12')]);module[_0xdc1c('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index e4a9d2b..450970a 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 _0x079f=['name','sequelize','exports','STRING'];(function(_0x40dfad,_0x1fbaa7){var _0x4c6b8d=function(_0x3c3ee6){while(--_0x3c3ee6){_0x40dfad['push'](_0x40dfad['shift']());}};_0x4c6b8d(++_0x1fbaa7);}(_0x079f,0x8d));var _0xf079=function(_0x95a91a,_0x3599a7){_0x95a91a=_0x95a91a-0x0;var _0x5b0453=_0x079f[_0x95a91a];return _0x5b0453;};'use strict';var Sequelize=require(_0xf079('0x0'));module[_0xf079('0x1')]={'name':{'type':Sequelize[_0xf079('0x2')],'unique':_0xf079('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf079('0x2')]}}; \ No newline at end of file +var _0x75c3=['exports','name','STRING'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0x75c3,0x7e));var _0x375c=function(_0x3a2d49,_0x4665ad){_0x3a2d49=_0x3a2d49-0x0;var _0x121c50=_0x75c3[_0x3a2d49];return _0x121c50;};'use strict';var Sequelize=require('sequelize');module[_0x375c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x375c('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x375c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index c63ac29..8aa1674 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 _0xa385=['findAll','rows','catch','show','params','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','ODBC','error','stack','name','index','SquareOdbc','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','filter','options'];(function(_0x351fb7,_0x98949e){var _0x433ac8=function(_0x230ac9){while(--_0x230ac9){_0x351fb7['push'](_0x351fb7['shift']());}};_0x433ac8(++_0x98949e);}(_0xa385,0x11c));var _0x5a38=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa385[_0x51020b];return _0x371e47;};'use strict';var emlformat=require(_0x5a38('0x0'));var rimraf=require(_0x5a38('0x1'));var zipdir=require(_0x5a38('0x2'));var jsonpatch=require(_0x5a38('0x3'));var rp=require(_0x5a38('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5a38('0x5'));var util=require('util');var path=require(_0x5a38('0x6'));var sox=require(_0x5a38('0x7'));var csv=require(_0x5a38('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a38('0x9'));var squel=require(_0x5a38('0xa'));var crypto=require(_0x5a38('0xb'));var jsforce=require(_0x5a38('0xc'));var deskjs=require(_0x5a38('0xd'));var toCsv=require(_0x5a38('0x8'));var querystring=require(_0x5a38('0xe'));var Papa=require(_0x5a38('0xf'));var Redis=require(_0x5a38('0x10'));var authService=require(_0x5a38('0x11'));var qs=require(_0x5a38('0x12'));var as=require(_0x5a38('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5a38('0x14'));var utils=require('../../config/utils');var config=require(_0x5a38('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a38('0x16'))['db'];function respondWithStatusCode(_0x47f804,_0x9be52b){_0x9be52b=_0x9be52b||0xcc;return function(_0x530550){if(_0x530550){return _0x47f804[_0x5a38('0x17')](_0x9be52b);}return _0x47f804[_0x5a38('0x18')](_0x9be52b)[_0x5a38('0x19')]();};}function respondWithResult(_0x413836,_0x1d3c4a){_0x1d3c4a=_0x1d3c4a||0xc8;return function(_0x36a6e0){if(_0x36a6e0){return _0x413836[_0x5a38('0x18')](_0x1d3c4a)[_0x5a38('0x1a')](_0x36a6e0);}};}function respondWithFilteredResult(_0xd8b1b2,_0x598f59){return function(_0x5e343d){if(_0x5e343d){var _0x35bb1d=typeof _0x598f59[_0x5a38('0x1b')]===_0x5a38('0x1c')&&typeof _0x598f59[_0x5a38('0x1d')]===_0x5a38('0x1c');var _0x4e6e55=_0x5e343d[_0x5a38('0x1e')];var _0x2bc69d=_0x35bb1d?0x0:_0x598f59[_0x5a38('0x1b')];var _0x46071f=_0x35bb1d?_0x5e343d[_0x5a38('0x1e')]:_0x598f59['offset']+_0x598f59[_0x5a38('0x1d')];var _0x2f82ae;if(_0x46071f>=_0x4e6e55){_0x46071f=_0x4e6e55;_0x2f82ae=0xc8;}else{_0x2f82ae=0xce;}_0xd8b1b2['status'](_0x2f82ae);return _0xd8b1b2['set'](_0x5a38('0x1f'),_0x2bc69d+'-'+_0x46071f+'/'+_0x4e6e55)['json'](_0x5e343d);}return null;};}function patchUpdates(_0xbbb36c){return function(_0x24b237){try{jsonpatch['apply'](_0x24b237,_0xbbb36c,!![]);}catch(_0x2f5320){return BPromise[_0x5a38('0x20')](_0x2f5320);}return _0x24b237[_0x5a38('0x21')]();};}function saveUpdates(_0x1bad9b,_0x28e234){return function(_0x283660){if(_0x283660){return _0x283660[_0x5a38('0x22')](_0x1bad9b)['then'](function(_0x2f4c42){return _0x2f4c42;});}return null;};}function removeEntity(_0x204928,_0x4eae7a){return function(_0x5061aa){if(_0x5061aa){return _0x5061aa[_0x5a38('0x23')]()[_0x5a38('0x24')](function(){var _0x5df4aa=_0x5061aa['get']({'plain':!![]});var _0x3399a5=_0x5a38('0x25');return db['UserProfileResource'][_0x5a38('0x23')]({'where':{'type':_0x3399a5,'resourceId':_0x5df4aa['id']}})[_0x5a38('0x24')](function(){return _0x5061aa;});})[_0x5a38('0x24')](function(){_0x204928['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc1f6bf,_0x56ed1f){return function(_0xf6fdcb){if(!_0xf6fdcb){_0xc1f6bf[_0x5a38('0x17')](0x194);}return _0xf6fdcb;};}function handleError(_0x280ab2,_0x40f604){_0x40f604=_0x40f604||0x1f4;return function(_0x396bc7){logger[_0x5a38('0x26')](_0x396bc7[_0x5a38('0x27')]);if(_0x396bc7[_0x5a38('0x28')]){delete _0x396bc7['name'];}_0x280ab2['status'](_0x40f604)['send'](_0x396bc7);};}exports[_0x5a38('0x29')]=function(_0x327680,_0x2d5392){var _0x2e3699={},_0x2ac7b6={},_0x16912f={'count':0x0,'rows':[]};var _0x2ea459=_['map'](db[_0x5a38('0x2a')]['rawAttributes'],function(_0xf3de5b){return{'name':_0xf3de5b[_0x5a38('0x2b')],'type':_0xf3de5b['type'][_0x5a38('0x2c')]};});_0x2ac7b6[_0x5a38('0x2d')]=_['map'](_0x2ea459,_0x5a38('0x28'));_0x2ac7b6[_0x5a38('0x2e')]=_[_0x5a38('0x2f')](_0x327680[_0x5a38('0x2e')]);_0x2ac7b6[_0x5a38('0x30')]=_[_0x5a38('0x31')](_0x2ac7b6[_0x5a38('0x2d')],_0x2ac7b6[_0x5a38('0x2e')]);_0x2e3699[_0x5a38('0x32')]=_[_0x5a38('0x31')](_0x2ac7b6[_0x5a38('0x2d')],qs[_0x5a38('0x33')](_0x327680[_0x5a38('0x2e')][_0x5a38('0x33')]));_0x2e3699[_0x5a38('0x32')]=_0x2e3699[_0x5a38('0x32')][_0x5a38('0x34')]?_0x2e3699['attributes']:_0x2ac7b6[_0x5a38('0x2d')];if(!_0x327680['query'][_0x5a38('0x35')](_0x5a38('0x36'))){_0x2e3699[_0x5a38('0x1d')]=qs[_0x5a38('0x1d')](_0x327680[_0x5a38('0x2e')][_0x5a38('0x1d')]);_0x2e3699[_0x5a38('0x1b')]=qs[_0x5a38('0x1b')](_0x327680['query'][_0x5a38('0x1b')]);}_0x2e3699[_0x5a38('0x37')]=qs[_0x5a38('0x38')](_0x327680[_0x5a38('0x2e')][_0x5a38('0x38')]);_0x2e3699['where']=qs[_0x5a38('0x30')](_[_0x5a38('0x39')](_0x327680[_0x5a38('0x2e')],_0x2ac7b6['filters']),_0x2ea459);if(_0x327680[_0x5a38('0x2e')]['filter']){_0x2e3699[_0x5a38('0x3a')]=_[_0x5a38('0x3b')](_0x2e3699['where'],{'$or':_[_0x5a38('0x3c')](_0x2ea459,function(_0x51fedc){if(_0x51fedc['type']!==_0x5a38('0x3d')){var _0x3e0f4e={};_0x3e0f4e[_0x51fedc[_0x5a38('0x28')]]={'$like':'%'+_0x327680[_0x5a38('0x2e')][_0x5a38('0x3e')]+'%'};return _0x3e0f4e;}})});}_0x2e3699=_[_0x5a38('0x3b')]({},_0x2e3699,_0x327680[_0x5a38('0x3f')]);var _0x57a115={'where':_0x2e3699['where']};return db['SquareOdbc'][_0x5a38('0x1e')](_0x57a115)[_0x5a38('0x24')](function(_0x4489b8){_0x16912f[_0x5a38('0x1e')]=_0x4489b8;if(_0x327680['query']['includeAll']){_0x2e3699['include']=[{'all':!![]}];}return db[_0x5a38('0x2a')][_0x5a38('0x40')](_0x2e3699);})[_0x5a38('0x24')](function(_0x30268d){_0x16912f[_0x5a38('0x41')]=_0x30268d;return _0x16912f;})[_0x5a38('0x24')](respondWithFilteredResult(_0x2d5392,_0x2e3699))[_0x5a38('0x42')](handleError(_0x2d5392,null));};exports[_0x5a38('0x43')]=function(_0x3c412a,_0xd5659c){var _0x101910={'raw':!![],'where':{'id':_0x3c412a[_0x5a38('0x44')]['id']}},_0x19861c={};_0x19861c[_0x5a38('0x2d')]=_[_0x5a38('0x2f')](db[_0x5a38('0x2a')]['rawAttributes']);_0x19861c['query']=_[_0x5a38('0x2f')](_0x3c412a[_0x5a38('0x2e')]);_0x19861c[_0x5a38('0x30')]=_['intersection'](_0x19861c[_0x5a38('0x2d')],_0x19861c[_0x5a38('0x2e')]);_0x101910[_0x5a38('0x32')]=_['intersection'](_0x19861c[_0x5a38('0x2d')],qs[_0x5a38('0x33')](_0x3c412a[_0x5a38('0x2e')]['fields']));_0x101910[_0x5a38('0x32')]=_0x101910[_0x5a38('0x32')][_0x5a38('0x34')]?_0x101910[_0x5a38('0x32')]:_0x19861c['model'];if(_0x3c412a['query'][_0x5a38('0x45')]){_0x101910[_0x5a38('0x46')]=[{'all':!![]}];}_0x101910=_[_0x5a38('0x3b')]({},_0x101910,_0x3c412a['options']);return db[_0x5a38('0x2a')]['find'](_0x101910)[_0x5a38('0x24')](handleEntityNotFound(_0xd5659c,null))['then'](respondWithResult(_0xd5659c,null))['catch'](handleError(_0xd5659c,null));};exports['create']=function(_0x355b24,_0x5c2a2a){return db[_0x5a38('0x2a')][_0x5a38('0x47')](_0x355b24[_0x5a38('0x48')],{})['then'](function(_0x38a76b){var _0x4e4146=_0x355b24[_0x5a38('0x49')][_0x5a38('0x4a')]({'plain':!![]});if(!_0x4e4146)throw new Error(_0x5a38('0x4b'));if(_0x4e4146[_0x5a38('0x4c')]===_0x5a38('0x49')){var _0x359694=_0x38a76b['get']({'plain':!![]});var _0x4a9045=_0x5a38('0x25');return db[_0x5a38('0x4d')][_0x5a38('0x4e')]({'where':{'name':_0x4a9045,'userProfileId':_0x4e4146[_0x5a38('0x4f')]},'raw':!![]})[_0x5a38('0x24')](function(_0x4254fd){if(_0x4254fd&&_0x4254fd[_0x5a38('0x50')]===0x0){return db['UserProfileResource'][_0x5a38('0x47')]({'name':_0x359694[_0x5a38('0x28')],'resourceId':_0x359694['id'],'type':_0x4254fd[_0x5a38('0x28')],'sectionId':_0x4254fd['id']},{})['then'](function(){return _0x38a76b;});}else{return _0x38a76b;}})[_0x5a38('0x42')](function(_0x3a445f){logger[_0x5a38('0x26')](_0x5a38('0x51'),_0x3a445f);throw _0x3a445f;});}return _0x38a76b;})[_0x5a38('0x24')](respondWithResult(_0x5c2a2a,0xc9))[_0x5a38('0x42')](handleError(_0x5c2a2a,null));};exports[_0x5a38('0x22')]=function(_0x33a76d,_0x46a690){if(_0x33a76d['body']['id']){delete _0x33a76d[_0x5a38('0x48')]['id'];}return db[_0x5a38('0x2a')][_0x5a38('0x4e')]({'where':{'id':_0x33a76d['params']['id']}})[_0x5a38('0x24')](handleEntityNotFound(_0x46a690,null))[_0x5a38('0x24')](saveUpdates(_0x33a76d[_0x5a38('0x48')],null))['then'](respondWithResult(_0x46a690,null))[_0x5a38('0x42')](handleError(_0x46a690,null));};exports['destroy']=function(_0x5bf9df,_0x42bb30){return db['SquareOdbc']['find']({'where':{'id':_0x5bf9df['params']['id']}})[_0x5a38('0x24')](handleEntityNotFound(_0x42bb30,null))['then'](removeEntity(_0x42bb30,null))[_0x5a38('0x42')](handleError(_0x42bb30,null));};exports[_0x5a38('0x52')]=function(_0xe65808,_0x268cc2,_0x289738){var _0x44d12b;return db['SquareOdbc']['find']({'where':{'id':_0xe65808['params']['id']},'attributes':['id',_0x5a38('0x53')]})[_0x5a38('0x24')](handleEntityNotFound(_0x268cc2,null))['then'](function(_0x4cc984){if(_0x4cc984){var _0x1027a0=require(_0x5a38('0x54'))();_0x1027a0[_0x5a38('0x55')](_0x4cc984[_0x5a38('0x53')]);_0x1027a0[_0x5a38('0x56')]();return _0x4cc984;}})['then'](respondWithResult(_0x268cc2,null))[_0x5a38('0x42')](handleError(_0x268cc2,null));}; \ No newline at end of file +var _0xa6f3=['attributes','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','body','test','dsn','openSync','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','apply','save','update','then','destroy','ODBC','UserProfileResource','end','stack','name','send','index','SquareOdbc','type','map','keys','intersection','query','model','fields'];(function(_0x365107,_0x27278c){var _0x4bac0b=function(_0x24ecfe){while(--_0x24ecfe){_0x365107['push'](_0x365107['shift']());}};_0x4bac0b(++_0x27278c);}(_0xa6f3,0x1d2));var _0x3a6f=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0xa6f3[_0x50bf5a];return _0x4ddc1d;};'use strict';var emlformat=require(_0x3a6f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3a6f('0x1'));var rp=require(_0x3a6f('0x2'));var moment=require('moment');var BPromise=require(_0x3a6f('0x3'));var Mustache=require(_0x3a6f('0x4'));var util=require(_0x3a6f('0x5'));var path=require(_0x3a6f('0x6'));var sox=require(_0x3a6f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a6f('0x8'));var _=require(_0x3a6f('0x9'));var squel=require(_0x3a6f('0xa'));var crypto=require(_0x3a6f('0xb'));var jsforce=require(_0x3a6f('0xc'));var deskjs=require(_0x3a6f('0xd'));var toCsv=require(_0x3a6f('0xe'));var querystring=require(_0x3a6f('0xf'));var Papa=require(_0x3a6f('0x10'));var Redis=require(_0x3a6f('0x11'));var authService=require(_0x3a6f('0x12'));var qs=require(_0x3a6f('0x13'));var as=require(_0x3a6f('0x14'));var hardwareService=require(_0x3a6f('0x15'));var logger=require(_0x3a6f('0x16'))(_0x3a6f('0x17'));var utils=require(_0x3a6f('0x18'));var config=require(_0x3a6f('0x19'));var licenseUtil=require(_0x3a6f('0x1a'));var db=require(_0x3a6f('0x1b'))['db'];function respondWithStatusCode(_0x1eee96,_0x1150f6){_0x1150f6=_0x1150f6||0xcc;return function(_0x3f7858){if(_0x3f7858){return _0x1eee96[_0x3a6f('0x1c')](_0x1150f6);}return _0x1eee96[_0x3a6f('0x1d')](_0x1150f6)['end']();};}function respondWithResult(_0x4a73bc,_0x860b3f){_0x860b3f=_0x860b3f||0xc8;return function(_0x154c59){if(_0x154c59){return _0x4a73bc[_0x3a6f('0x1d')](_0x860b3f)[_0x3a6f('0x1e')](_0x154c59);}};}function respondWithFilteredResult(_0x46b2e3,_0x5cd187){return function(_0x4897b7){if(_0x4897b7){var _0x5d0f94=typeof _0x5cd187['offset']===_0x3a6f('0x1f')&&typeof _0x5cd187[_0x3a6f('0x20')]==='undefined';var _0xa3807c=_0x4897b7['count'];var _0x420eff=_0x5d0f94?0x0:_0x5cd187[_0x3a6f('0x21')];var _0x333e02=_0x5d0f94?_0x4897b7[_0x3a6f('0x22')]:_0x5cd187['offset']+_0x5cd187[_0x3a6f('0x20')];var _0x3182e7;if(_0x333e02>=_0xa3807c){_0x333e02=_0xa3807c;_0x3182e7=0xc8;}else{_0x3182e7=0xce;}_0x46b2e3[_0x3a6f('0x1d')](_0x3182e7);return _0x46b2e3[_0x3a6f('0x23')]('Content-Range',_0x420eff+'-'+_0x333e02+'/'+_0xa3807c)[_0x3a6f('0x1e')](_0x4897b7);}return null;};}function patchUpdates(_0x2c72cf){return function(_0x15e629){try{jsonpatch[_0x3a6f('0x24')](_0x15e629,_0x2c72cf,!![]);}catch(_0x10cebf){return BPromise['reject'](_0x10cebf);}return _0x15e629[_0x3a6f('0x25')]();};}function saveUpdates(_0x194c95,_0x572b7a){return function(_0x4cef9f){if(_0x4cef9f){return _0x4cef9f[_0x3a6f('0x26')](_0x194c95)[_0x3a6f('0x27')](function(_0x1b20e5){return _0x1b20e5;});}return null;};}function removeEntity(_0x2a156c,_0x488963){return function(_0x599f45){if(_0x599f45){return _0x599f45[_0x3a6f('0x28')]()['then'](function(){var _0x27a944=_0x599f45['get']({'plain':!![]});var _0x5eccf5=_0x3a6f('0x29');return db[_0x3a6f('0x2a')][_0x3a6f('0x28')]({'where':{'type':_0x5eccf5,'resourceId':_0x27a944['id']}})[_0x3a6f('0x27')](function(){return _0x599f45;});})[_0x3a6f('0x27')](function(){_0x2a156c[_0x3a6f('0x1d')](0xcc)[_0x3a6f('0x2b')]();});}};}function handleEntityNotFound(_0x3248dd,_0x111a1e){return function(_0x176d78){if(!_0x176d78){_0x3248dd[_0x3a6f('0x1c')](0x194);}return _0x176d78;};}function handleError(_0x27090f,_0x413da6){_0x413da6=_0x413da6||0x1f4;return function(_0x336649){logger['error'](_0x336649[_0x3a6f('0x2c')]);if(_0x336649[_0x3a6f('0x2d')]){delete _0x336649[_0x3a6f('0x2d')];}_0x27090f[_0x3a6f('0x1d')](_0x413da6)[_0x3a6f('0x2e')](_0x336649);};}exports[_0x3a6f('0x2f')]=function(_0x3c1bc5,_0x54842c){var _0x3ed6c6={},_0x9fa3d3={},_0x3ed4ad={'count':0x0,'rows':[]};var _0x43190f=_['map'](db[_0x3a6f('0x30')]['rawAttributes'],function(_0xcd784f){return{'name':_0xcd784f['fieldName'],'type':_0xcd784f[_0x3a6f('0x31')]['key']};});_0x9fa3d3['model']=_[_0x3a6f('0x32')](_0x43190f,_0x3a6f('0x2d'));_0x9fa3d3['query']=_[_0x3a6f('0x33')](_0x3c1bc5['query']);_0x9fa3d3['filters']=_[_0x3a6f('0x34')](_0x9fa3d3['model'],_0x9fa3d3[_0x3a6f('0x35')]);_0x3ed6c6['attributes']=_[_0x3a6f('0x34')](_0x9fa3d3[_0x3a6f('0x36')],qs[_0x3a6f('0x37')](_0x3c1bc5[_0x3a6f('0x35')][_0x3a6f('0x37')]));_0x3ed6c6['attributes']=_0x3ed6c6[_0x3a6f('0x38')][_0x3a6f('0x39')]?_0x3ed6c6['attributes']:_0x9fa3d3[_0x3a6f('0x36')];if(!_0x3c1bc5[_0x3a6f('0x35')]['hasOwnProperty'](_0x3a6f('0x3a'))){_0x3ed6c6[_0x3a6f('0x20')]=qs[_0x3a6f('0x20')](_0x3c1bc5[_0x3a6f('0x35')][_0x3a6f('0x20')]);_0x3ed6c6[_0x3a6f('0x21')]=qs[_0x3a6f('0x21')](_0x3c1bc5[_0x3a6f('0x35')][_0x3a6f('0x21')]);}_0x3ed6c6[_0x3a6f('0x3b')]=qs['sort'](_0x3c1bc5[_0x3a6f('0x35')][_0x3a6f('0x3c')]);_0x3ed6c6[_0x3a6f('0x3d')]=qs[_0x3a6f('0x3e')](_['pick'](_0x3c1bc5[_0x3a6f('0x35')],_0x9fa3d3[_0x3a6f('0x3e')]),_0x43190f);if(_0x3c1bc5[_0x3a6f('0x35')][_0x3a6f('0x3f')]){_0x3ed6c6[_0x3a6f('0x3d')]=_['merge'](_0x3ed6c6[_0x3a6f('0x3d')],{'$or':_[_0x3a6f('0x32')](_0x43190f,function(_0x29f12b){if(_0x29f12b[_0x3a6f('0x31')]!==_0x3a6f('0x40')){var _0x259f5e={};_0x259f5e[_0x29f12b['name']]={'$like':'%'+_0x3c1bc5[_0x3a6f('0x35')][_0x3a6f('0x3f')]+'%'};return _0x259f5e;}})});}_0x3ed6c6=_[_0x3a6f('0x41')]({},_0x3ed6c6,_0x3c1bc5[_0x3a6f('0x42')]);var _0x183258={'where':_0x3ed6c6[_0x3a6f('0x3d')]};return db['SquareOdbc'][_0x3a6f('0x22')](_0x183258)[_0x3a6f('0x27')](function(_0x1ed7ab){_0x3ed4ad[_0x3a6f('0x22')]=_0x1ed7ab;if(_0x3c1bc5['query'][_0x3a6f('0x43')]){_0x3ed6c6['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x3ed6c6);})[_0x3a6f('0x27')](function(_0x2ed088){_0x3ed4ad[_0x3a6f('0x44')]=_0x2ed088;return _0x3ed4ad;})[_0x3a6f('0x27')](respondWithFilteredResult(_0x54842c,_0x3ed6c6))[_0x3a6f('0x45')](handleError(_0x54842c,null));};exports[_0x3a6f('0x46')]=function(_0x2e8fd3,_0x903bf8){var _0x385210={'raw':!![],'where':{'id':_0x2e8fd3[_0x3a6f('0x47')]['id']}},_0x3c1ef1={};_0x3c1ef1[_0x3a6f('0x36')]=_['keys'](db['SquareOdbc'][_0x3a6f('0x48')]);_0x3c1ef1[_0x3a6f('0x35')]=_[_0x3a6f('0x33')](_0x2e8fd3['query']);_0x3c1ef1[_0x3a6f('0x3e')]=_[_0x3a6f('0x34')](_0x3c1ef1['model'],_0x3c1ef1['query']);_0x385210[_0x3a6f('0x38')]=_[_0x3a6f('0x34')](_0x3c1ef1[_0x3a6f('0x36')],qs[_0x3a6f('0x37')](_0x2e8fd3[_0x3a6f('0x35')][_0x3a6f('0x37')]));_0x385210[_0x3a6f('0x38')]=_0x385210[_0x3a6f('0x38')][_0x3a6f('0x39')]?_0x385210[_0x3a6f('0x38')]:_0x3c1ef1[_0x3a6f('0x36')];if(_0x2e8fd3['query']['includeAll']){_0x385210[_0x3a6f('0x49')]=[{'all':!![]}];}_0x385210=_[_0x3a6f('0x41')]({},_0x385210,_0x2e8fd3[_0x3a6f('0x42')]);return db[_0x3a6f('0x30')][_0x3a6f('0x4a')](_0x385210)[_0x3a6f('0x27')](handleEntityNotFound(_0x903bf8,null))['then'](respondWithResult(_0x903bf8,null))[_0x3a6f('0x45')](handleError(_0x903bf8,null));};exports[_0x3a6f('0x4b')]=function(_0x721473,_0x3e0911){return db[_0x3a6f('0x30')][_0x3a6f('0x4b')](_0x721473['body'],{})[_0x3a6f('0x27')](function(_0x2b9b8e){var _0x1bcc5c=_0x721473['user'][_0x3a6f('0x4c')]({'plain':!![]});if(!_0x1bcc5c)throw new Error(_0x3a6f('0x4d'));if(_0x1bcc5c[_0x3a6f('0x4e')]===_0x3a6f('0x4f')){var _0x1d1665=_0x2b9b8e['get']({'plain':!![]});var _0x55399d='ODBC';return db[_0x3a6f('0x50')][_0x3a6f('0x4a')]({'where':{'name':_0x55399d,'userProfileId':_0x1bcc5c[_0x3a6f('0x51')]},'raw':!![]})['then'](function(_0x5f5c03){if(_0x5f5c03&&_0x5f5c03['autoAssociation']===0x0){return db[_0x3a6f('0x2a')][_0x3a6f('0x4b')]({'name':_0x1d1665['name'],'resourceId':_0x1d1665['id'],'type':_0x5f5c03[_0x3a6f('0x2d')],'sectionId':_0x5f5c03['id']},{})['then'](function(){return _0x2b9b8e;});}else{return _0x2b9b8e;}})[_0x3a6f('0x45')](function(_0x177afa){logger[_0x3a6f('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x177afa);throw _0x177afa;});}return _0x2b9b8e;})['then'](respondWithResult(_0x3e0911,0xc9))[_0x3a6f('0x45')](handleError(_0x3e0911,null));};exports[_0x3a6f('0x26')]=function(_0x376361,_0x294e12){if(_0x376361['body']['id']){delete _0x376361['body']['id'];}return db[_0x3a6f('0x30')]['find']({'where':{'id':_0x376361['params']['id']}})[_0x3a6f('0x27')](handleEntityNotFound(_0x294e12,null))[_0x3a6f('0x27')](saveUpdates(_0x376361[_0x3a6f('0x53')],null))[_0x3a6f('0x27')](respondWithResult(_0x294e12,null))[_0x3a6f('0x45')](handleError(_0x294e12,null));};exports[_0x3a6f('0x28')]=function(_0x3d5cc2,_0x33dc33){return db['SquareOdbc'][_0x3a6f('0x4a')]({'where':{'id':_0x3d5cc2['params']['id']}})[_0x3a6f('0x27')](handleEntityNotFound(_0x33dc33,null))[_0x3a6f('0x27')](removeEntity(_0x33dc33,null))[_0x3a6f('0x45')](handleError(_0x33dc33,null));};exports[_0x3a6f('0x54')]=function(_0x126012,_0xe710cb,_0x29d9f6){var _0x1c3d6f;return db[_0x3a6f('0x30')][_0x3a6f('0x4a')]({'where':{'id':_0x126012[_0x3a6f('0x47')]['id']},'attributes':['id',_0x3a6f('0x55')]})[_0x3a6f('0x27')](handleEntityNotFound(_0xe710cb,null))[_0x3a6f('0x27')](function(_0x5d5cf4){if(_0x5d5cf4){var _0x387983=require('odbc')();_0x387983[_0x3a6f('0x56')](_0x5d5cf4[_0x3a6f('0x55')]);_0x387983['closeSync']();return _0x5d5cf4;}})[_0x3a6f('0x27')](respondWithResult(_0xe710cb,null))[_0x3a6f('0x45')](handleError(_0xe710cb,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index bf26594..87f34a9 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 _0xb440=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb440,0x1e0));var _0x0b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb440[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b44('0x0'));var util=require(_0x0b44('0x1'));var logger=require(_0x0b44('0x2'))(_0x0b44('0x3'));var moment=require(_0x0b44('0x4'));var BPromise=require(_0x0b44('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b44('0x6'));var rimraf=require(_0x0b44('0x7'));var config=require(_0x0b44('0x8'));var attributes=require(_0x0b44('0x9'));module[_0x0b44('0xa')]=function(_0x112203,_0x20f513){return _0x112203['define'](_0x0b44('0xb'),attributes,{'tableName':_0x0b44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f87=['SquareOdbc','square_odbc','lodash','util','../../config/logger','path','rimraf','../../config/environment','exports','define'];(function(_0x2a1140,_0x103c82){var _0x3a595b=function(_0x8936a9){while(--_0x8936a9){_0x2a1140['push'](_0x2a1140['shift']());}};_0x3a595b(++_0x103c82);}(_0x8f87,0x138));var _0x78f8=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0x8f87[_0x44fef1];return _0x3c3a04;};'use strict';var _=require(_0x78f8('0x0'));var util=require(_0x78f8('0x1'));var logger=require(_0x78f8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78f8('0x3'));var rimraf=require(_0x78f8('0x4'));var config=require(_0x78f8('0x5'));var attributes=require('./squareOdbc.attributes');module[_0x78f8('0x6')]=function(_0x4a9215,_0x49ff32){return _0x4a9215[_0x78f8('0x7')](_0x78f8('0x8'),attributes,{'tableName':_0x78f8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 683e110..d53dee9 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 _0xc822=['include','map','model','debug','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','where','attributes'];(function(_0x15102e,_0x3539b1){var _0x1fcfc2=function(_0x5296f3){while(--_0x5296f3){_0x15102e['push'](_0x15102e['shift']());}};_0x1fcfc2(++_0x3539b1);}(_0xc822,0xc8));var _0x2c82=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0xc822[_0x4cee4b];return _0x4d891d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2c82('0x0'));var BPromise=require(_0x2c82('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c82('0x2'));var db=require(_0x2c82('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c82('0x4'));var config=require('../../config/environment');var jayson=require(_0x2c82('0x5'));var client=jayson[_0x2c82('0x6')][_0x2c82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10b0ac,_0x1a2a71,_0x3c3c33){return new BPromise(function(_0x4250bf,_0x5a6ecc){return client[_0x2c82('0x8')](_0x10b0ac,_0x3c3c33)[_0x2c82('0x9')](function(_0x221ef9){logger[_0x2c82('0xa')](_0x2c82('0xb'),_0x1a2a71,'request\x20sent');logger['debug'](_0x2c82('0xc'),_0x1a2a71,_0x2c82('0xd'),JSON[_0x2c82('0xe')](_0x221ef9));if(_0x221ef9[_0x2c82('0xf')]){if(_0x221ef9[_0x2c82('0xf')]['code']===0x1f4){logger[_0x2c82('0xf')](_0x2c82('0xb'),_0x1a2a71,_0x221ef9[_0x2c82('0xf')][_0x2c82('0x10')]);return _0x5a6ecc(_0x221ef9['error'][_0x2c82('0x10')]);}logger[_0x2c82('0xf')](_0x2c82('0xb'),_0x1a2a71,_0x221ef9[_0x2c82('0xf')][_0x2c82('0x10')]);return _0x4250bf(_0x221ef9[_0x2c82('0xf')][_0x2c82('0x10')]);}else{logger[_0x2c82('0xa')](_0x2c82('0xb'),_0x1a2a71,_0x2c82('0xd'));_0x4250bf(_0x221ef9[_0x2c82('0x11')]['message']);}})['catch'](function(_0x8ae836){logger[_0x2c82('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x1a2a71,_0x8ae836);_0x5a6ecc(_0x8ae836);});});}exports[_0x2c82('0x12')]=function(_0x44f4ca){var _0x463d34=this;return new Promise(function(_0x45da4e,_0x3ee30d){return db[_0x2c82('0x13')][_0x2c82('0x14')]({'raw':_0x44f4ca[_0x2c82('0x15')]?_0x44f4ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x44f4ca['options']?_0x44f4ca['options'][_0x2c82('0x16')]||null:null,'attributes':_0x44f4ca['options']?_0x44f4ca['options'][_0x2c82('0x17')]||null:null,'include':_0x44f4ca[_0x2c82('0x15')]?_0x44f4ca[_0x2c82('0x15')][_0x2c82('0x18')]?_[_0x2c82('0x19')](_0x44f4ca[_0x2c82('0x15')][_0x2c82('0x18')],function(_0x5d1849){return{'model':db[_0x5d1849[_0x2c82('0x1a')]],'as':_0x5d1849['as'],'attributes':_0x5d1849[_0x2c82('0x17')],'include':_0x5d1849[_0x2c82('0x18')]?_[_0x2c82('0x19')](_0x5d1849[_0x2c82('0x18')],function(_0x22c062){return{'model':db[_0x22c062[_0x2c82('0x1a')]],'as':_0x22c062['as'],'attributes':_0x22c062['attributes'],'include':_0x22c062[_0x2c82('0x18')]?_[_0x2c82('0x19')](_0x22c062[_0x2c82('0x18')],function(_0x5951c8){return{'model':db[_0x5951c8[_0x2c82('0x1a')]],'as':_0x5951c8['as'],'attributes':_0x5951c8[_0x2c82('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f0709){logger[_0x2c82('0xa')](_0x2c82('0x12'),_0x44f4ca);logger[_0x2c82('0x1b')]('ShowSquareOdbc',_0x44f4ca,JSON[_0x2c82('0xe')](_0x5f0709));_0x45da4e(_0x5f0709);})['catch'](function(_0x43348f){logger[_0x2c82('0xf')](_0x2c82('0x12'),_0x43348f[_0x2c82('0x10')],_0x44f4ca);_0x3ee30d(_0x463d34[_0x2c82('0xf')](0x1f4,_0x43348f['message']));});});}; \ No newline at end of file +var _0x3bd8=['catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','code','error','message','SquareOdbc,\x20%s,\x20%s','result'];(function(_0x5b7d28,_0x38e810){var _0x14cb5f=function(_0x52cf14){while(--_0x52cf14){_0x5b7d28['push'](_0x5b7d28['shift']());}};_0x14cb5f(++_0x38e810);}(_0x3bd8,0x10b));var _0x83bd=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0x3bd8[_0x1486e5];return _0x29d89b;};'use strict';var _=require(_0x83bd('0x0'));var util=require('util');var moment=require(_0x83bd('0x1'));var BPromise=require('bluebird');var rs=require(_0x83bd('0x2'));var fs=require('fs');var Redis=require(_0x83bd('0x3'));var db=require(_0x83bd('0x4'))['db'];var utils=require(_0x83bd('0x5'));var logger=require('../../config/logger')(_0x83bd('0x6'));var config=require(_0x83bd('0x7'));var jayson=require(_0x83bd('0x8'));var client=jayson[_0x83bd('0x9')][_0x83bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c1b95,_0x3396b3,_0x1faf92){return new BPromise(function(_0x298abd,_0x57e306){return client[_0x83bd('0xb')](_0x2c1b95,_0x1faf92)[_0x83bd('0xc')](function(_0xd8b72a){logger[_0x83bd('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x3396b3,_0x83bd('0xe'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3396b3,'request\x20sent',JSON[_0x83bd('0xf')](_0xd8b72a));if(_0xd8b72a['error']){if(_0xd8b72a['error'][_0x83bd('0x10')]===0x1f4){logger[_0x83bd('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x3396b3,_0xd8b72a[_0x83bd('0x11')]['message']);return _0x57e306(_0xd8b72a[_0x83bd('0x11')][_0x83bd('0x12')]);}logger['error'](_0x83bd('0x13'),_0x3396b3,_0xd8b72a[_0x83bd('0x11')][_0x83bd('0x12')]);return _0x298abd(_0xd8b72a['error'][_0x83bd('0x12')]);}else{logger['info'](_0x83bd('0x13'),_0x3396b3,_0x83bd('0xe'));_0x298abd(_0xd8b72a[_0x83bd('0x14')][_0x83bd('0x12')]);}})[_0x83bd('0x15')](function(_0x27e0ba){logger[_0x83bd('0x11')](_0x83bd('0x13'),_0x3396b3,_0x27e0ba);_0x57e306(_0x27e0ba);});});}exports[_0x83bd('0x16')]=function(_0x5cbe9b){var _0x4ecec2=this;return new Promise(function(_0x58f2cc,_0x1413ca){return db[_0x83bd('0x17')][_0x83bd('0x18')]({'raw':_0x5cbe9b[_0x83bd('0x19')]?_0x5cbe9b[_0x83bd('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5cbe9b[_0x83bd('0x19')]?_0x5cbe9b['options'][_0x83bd('0x1a')]||null:null,'attributes':_0x5cbe9b[_0x83bd('0x19')]?_0x5cbe9b['options'][_0x83bd('0x1b')]||null:null,'include':_0x5cbe9b[_0x83bd('0x19')]?_0x5cbe9b['options'][_0x83bd('0x1c')]?_[_0x83bd('0x1d')](_0x5cbe9b[_0x83bd('0x19')][_0x83bd('0x1c')],function(_0x257955){return{'model':db[_0x257955[_0x83bd('0x1e')]],'as':_0x257955['as'],'attributes':_0x257955[_0x83bd('0x1b')],'include':_0x257955[_0x83bd('0x1c')]?_['map'](_0x257955['include'],function(_0x2ad29c){return{'model':db[_0x2ad29c[_0x83bd('0x1e')]],'as':_0x2ad29c['as'],'attributes':_0x2ad29c[_0x83bd('0x1b')],'include':_0x2ad29c[_0x83bd('0x1c')]?_['map'](_0x2ad29c['include'],function(_0x453d3e){return{'model':db[_0x453d3e[_0x83bd('0x1e')]],'as':_0x453d3e['as'],'attributes':_0x453d3e['attributes']};}):[]};}):[]};}):[]:[]})[_0x83bd('0xc')](function(_0x365060){logger[_0x83bd('0xd')](_0x83bd('0x16'),_0x5cbe9b);logger[_0x83bd('0x1f')](_0x83bd('0x16'),_0x5cbe9b,JSON[_0x83bd('0xf')](_0x365060));_0x58f2cc(_0x365060);})['catch'](function(_0x2bf5bd){logger['error'](_0x83bd('0x16'),_0x2bf5bd[_0x83bd('0x12')],_0x5cbe9b);_0x1413ca(_0x4ecec2[_0x83bd('0x11')](0x1f4,_0x2bf5bd[_0x83bd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 89f0f5b..ead1748 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 _0x2fe4=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2fe4,0x120));var _0x42fe=function(_0x56c6b1,_0x4db891){_0x56c6b1=_0x56c6b1-0x0;var _0x527771=_0x2fe4[_0x56c6b1];return _0x527771;};'use strict';var multer=require('multer');var util=require(_0x42fe('0x0'));var path=require('path');var timeout=require(_0x42fe('0x1'));var express=require('express');var router=express[_0x42fe('0x2')]();var fs_extra=require(_0x42fe('0x3'));var auth=require(_0x42fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x42fe('0x5'));var controller=require(_0x42fe('0x6'));router[_0x42fe('0x7')]('/',auth[_0x42fe('0x8')](),controller[_0x42fe('0x9')]);router['get'](_0x42fe('0xa'),auth[_0x42fe('0x8')](),controller[_0x42fe('0xb')]);router[_0x42fe('0xc')]('/',auth[_0x42fe('0x8')](),controller['create']);router['put'](_0x42fe('0xa'),auth['isAuthenticated'](),controller[_0x42fe('0xd')]);router[_0x42fe('0xe')](_0x42fe('0xa'),auth[_0x42fe('0x8')](),controller[_0x42fe('0xf')]);module['exports']=router; \ No newline at end of file +var _0x202a=['multer','util','connect-timeout','Router','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x202a,0xff));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa202('0x0'));var util=require(_0xa202('0x1'));var path=require('path');var timeout=require(_0xa202('0x2'));var express=require('express');var router=express[_0xa202('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa202('0x4'));var config=require('../../config/environment');var controller=require(_0xa202('0x5'));router[_0xa202('0x6')]('/',auth[_0xa202('0x7')](),controller[_0xa202('0x8')]);router[_0xa202('0x6')](_0xa202('0x9'),auth[_0xa202('0x7')](),controller['show']);router['post']('/',auth[_0xa202('0x7')](),controller[_0xa202('0xa')]);router[_0xa202('0xb')](_0xa202('0x9'),auth[_0xa202('0x7')](),controller[_0xa202('0xc')]);router[_0xa202('0xd')](_0xa202('0x9'),auth[_0xa202('0x7')](),controller[_0xa202('0xe')]);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 a3a7637..7c1ecf2 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 _0x0c1a=['getDataValue','DATE','sequelize','exports','STRING','name','TEXT','long','preproduction','toString','utf8','production'];(function(_0x21108b,_0x368dbc){var _0x525f48=function(_0x3d2881){while(--_0x3d2881){_0x21108b['push'](_0x21108b['shift']());}};_0x525f48(++_0x368dbc);}(_0x0c1a,0x1d6));var _0xa0c1=function(_0x578f1f,_0x5a3c84){_0x578f1f=_0x578f1f-0x0;var _0x31d75e=_0x0c1a[_0x578f1f];return _0x31d75e;};'use strict';var Sequelize=require(_0xa0c1('0x0'));module[_0xa0c1('0x1')]={'name':{'type':Sequelize[_0xa0c1('0x2')],'unique':_0xa0c1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa0c1('0x2')]},'notes':{'type':Sequelize[_0xa0c1('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0xa0c1('0x5')),'get':function(){if(this['getDataValue'](_0xa0c1('0x6'))){return this['getDataValue']('preproduction')[_0xa0c1('0x7')](_0xa0c1('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0xa0c1('0x9'))){return this[_0xa0c1('0xa')](_0xa0c1('0x9'))['toString'](_0xa0c1('0x8'));}}},'savedAt':{'type':Sequelize[_0xa0c1('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x3147=['production','utf8','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString'];(function(_0x4973ce,_0xd765aa){var _0x3bcf0a=function(_0x3171e6){while(--_0x3171e6){_0x4973ce['push'](_0x4973ce['shift']());}};_0x3bcf0a(++_0xd765aa);}(_0x3147,0x1b0));var _0x7314=function(_0x2cc5dc,_0x373c0b){_0x2cc5dc=_0x2cc5dc-0x0;var _0x1c8b8e=_0x3147[_0x2cc5dc];return _0x1c8b8e;};'use strict';var Sequelize=require(_0x7314('0x0'));module[_0x7314('0x1')]={'name':{'type':Sequelize[_0x7314('0x2')],'unique':_0x7314('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7314('0x2')]},'notes':{'type':Sequelize[_0x7314('0x4')]},'preproduction':{'type':Sequelize[_0x7314('0x5')](_0x7314('0x6')),'get':function(){if(this[_0x7314('0x7')]('preproduction')){return this[_0x7314('0x7')](_0x7314('0x8'))[_0x7314('0x9')]('utf8');}}},'production':{'type':Sequelize[_0x7314('0x5')](_0x7314('0x6')),'get':function(){if(this[_0x7314('0x7')](_0x7314('0xa'))){return this[_0x7314('0x7')](_0x7314('0xa'))[_0x7314('0x9')](_0x7314('0xb'));}}},'savedAt':{'type':Sequelize[_0x7314('0xc')]},'publishedAt':{'type':Sequelize[_0x7314('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b81593f..8424dcf 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 _0xfd42=['rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','SquareProject','include','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','SquareProjects','UserProfileSection','userProfileId','autoAssociation','body','pick','production','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','json','update','then','UserProfileResource','destroy','publish','agi','stringify','end','error','stack','send','index','map'];(function(_0x16d039,_0x3721b4){var _0x53295b=function(_0x21f881){while(--_0x21f881){_0x16d039['push'](_0x16d039['shift']());}};_0x53295b(++_0x3721b4);}(_0xfd42,0xfe));var _0x2fd4=function(_0x2158cd,_0xc096f4){_0x2158cd=_0x2158cd-0x0;var _0x206889=_0xfd42[_0x2158cd];return _0x206889;};'use strict';var _=require('lodash');var Redis=require(_0x2fd4('0x0'));var qs=require(_0x2fd4('0x1'));var logger=require(_0x2fd4('0x2'))(_0x2fd4('0x3'));var config=require(_0x2fd4('0x4'));var db=require(_0x2fd4('0x5'))['db'];config[_0x2fd4('0x6')]=_['defaults'](config[_0x2fd4('0x6')],{'host':_0x2fd4('0x7'),'port':0x18eb});var socket=require(_0x2fd4('0x8'))(new Redis(config[_0x2fd4('0x6')]));require('./squareProject.socket')[_0x2fd4('0x9')](socket);function respondWithResult(_0x283fc9,_0x509189){_0x509189=_0x509189||0xc8;return function(_0x5bbc76){if(_0x5bbc76){return _0x283fc9[_0x2fd4('0xa')](_0x509189)['json'](_0x5bbc76);}};}function respondWithFilteredResult(_0x5c13a8,_0x50c34f){return function(_0x3ed407){if(_0x3ed407){var _0x23affd=typeof _0x50c34f[_0x2fd4('0xb')]===_0x2fd4('0xc')&&typeof _0x50c34f[_0x2fd4('0xd')]===_0x2fd4('0xc');var _0x37844b=_0x3ed407[_0x2fd4('0xe')];var _0x18fd56=_0x23affd?0x0:_0x50c34f[_0x2fd4('0xb')];var _0x32007b=_0x23affd?_0x3ed407[_0x2fd4('0xe')]:_0x50c34f[_0x2fd4('0xb')]+_0x50c34f[_0x2fd4('0xd')];var _0x40022f;if(_0x32007b>=_0x37844b){_0x32007b=_0x37844b;_0x40022f=0xc8;}else{_0x40022f=0xce;}_0x5c13a8[_0x2fd4('0xa')](_0x40022f);return _0x5c13a8[_0x2fd4('0xf')]('Content-Range',_0x18fd56+'-'+_0x32007b+'/'+_0x37844b)[_0x2fd4('0x10')](_0x3ed407);}return null;};}function saveUpdates(_0x2a8b92){return function(_0x45149d){if(_0x45149d){return _0x45149d[_0x2fd4('0x11')](_0x2a8b92)[_0x2fd4('0x12')](function(_0xd05502){return _0xd05502;});}return null;};}function removeEntity(_0x55853b){return function(_0x4e4894){if(_0x4e4894){return _0x4e4894['destroy']()[_0x2fd4('0x12')](function(){var _0x1109ed=_0x4e4894['get']({'plain':!![]});var _0x580442='SquareProjects';return db[_0x2fd4('0x13')][_0x2fd4('0x14')]({'where':{'type':_0x580442,'resourceId':_0x1109ed['id']}})[_0x2fd4('0x12')](function(){return _0x4e4894;});})[_0x2fd4('0x12')](function(){var _0x4a5a96=new Redis(config['redis']);_0x4a5a96[_0x2fd4('0x15')](_0x2fd4('0x16'),JSON[_0x2fd4('0x17')]({'id':_0x4e4894['id'],'deleted':!![]}));})[_0x2fd4('0x12')](function(){_0x55853b[_0x2fd4('0xa')](0xcc)[_0x2fd4('0x18')]();});}};}function handleEntityNotFound(_0x195725){return function(_0x71b220){if(!_0x71b220){_0x195725['sendStatus'](0x194);}return _0x71b220;};}function handleError(_0x3ee3fd,_0x15eef1){_0x15eef1=_0x15eef1||0x1f4;return function(_0x1379f1){logger[_0x2fd4('0x19')](_0x1379f1[_0x2fd4('0x1a')]);if(_0x1379f1['name']){delete _0x1379f1['name'];}_0x3ee3fd[_0x2fd4('0xa')](_0x15eef1)[_0x2fd4('0x1b')](_0x1379f1);};}exports[_0x2fd4('0x1c')]=function(_0x20e0fb,_0x16de8d){var _0x75a6a5={},_0x37245b={},_0x47bb3c={'count':0x0,'rows':[]};var _0x239793=_[_0x2fd4('0x1d')](db['SquareProject'][_0x2fd4('0x1e')],function(_0x550f8c){return{'name':_0x550f8c[_0x2fd4('0x1f')],'type':_0x550f8c[_0x2fd4('0x20')][_0x2fd4('0x21')]};});_0x37245b[_0x2fd4('0x22')]=_[_0x2fd4('0x1d')](_0x239793,_0x2fd4('0x23'));_0x37245b[_0x2fd4('0x24')]=_[_0x2fd4('0x25')](_0x20e0fb[_0x2fd4('0x24')]);_0x37245b[_0x2fd4('0x26')]=_[_0x2fd4('0x27')](_0x37245b[_0x2fd4('0x22')],_0x37245b[_0x2fd4('0x24')]);_0x75a6a5[_0x2fd4('0x28')]=_['intersection'](_0x37245b[_0x2fd4('0x22')],qs[_0x2fd4('0x29')](_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0x29')]));_0x75a6a5['attributes']=_0x75a6a5['attributes']['length']?_0x75a6a5[_0x2fd4('0x28')]:_0x37245b['model'];if(!_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0x2a')](_0x2fd4('0x2b'))){_0x75a6a5[_0x2fd4('0xd')]=qs[_0x2fd4('0xd')](_0x20e0fb[_0x2fd4('0x24')]['limit']);_0x75a6a5[_0x2fd4('0xb')]=qs[_0x2fd4('0xb')](_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0xb')]);}_0x75a6a5[_0x2fd4('0x2c')]=qs[_0x2fd4('0x2d')](_0x20e0fb[_0x2fd4('0x24')]['sort']);_0x75a6a5['where']=qs[_0x2fd4('0x26')](_['pick'](_0x20e0fb[_0x2fd4('0x24')],_0x37245b[_0x2fd4('0x26')]),_0x239793);if(_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0x2e')]){_0x75a6a5['where']=_['merge'](_0x75a6a5[_0x2fd4('0x2f')],{'$or':_['map'](_0x239793,function(_0x5c0cdf){if(_0x5c0cdf[_0x2fd4('0x20')]!==_0x2fd4('0x30')){var _0x439677={};_0x439677[_0x5c0cdf['name']]={'$like':'%'+_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0x2e')]+'%'};return _0x439677;}})});}_0x75a6a5=_[_0x2fd4('0x31')]({},_0x75a6a5,_0x20e0fb[_0x2fd4('0x32')]);var _0x20a9c5={'where':_0x75a6a5['where']};return db[_0x2fd4('0x33')][_0x2fd4('0xe')](_0x20a9c5)['then'](function(_0x15c92e){_0x47bb3c[_0x2fd4('0xe')]=_0x15c92e;if(_0x20e0fb[_0x2fd4('0x24')]['includeAll']){_0x75a6a5[_0x2fd4('0x34')]=[{'all':!![]}];}return db[_0x2fd4('0x33')]['findAll'](_0x75a6a5);})[_0x2fd4('0x12')](function(_0x3ad7c6){_0x47bb3c[_0x2fd4('0x35')]=_0x3ad7c6;return _0x47bb3c;})[_0x2fd4('0x12')](respondWithFilteredResult(_0x16de8d,_0x75a6a5))[_0x2fd4('0x36')](handleError(_0x16de8d,null));};exports[_0x2fd4('0x37')]=function(_0x3896ef,_0x17f8f7){var _0x38e149={'raw':![],'where':{'id':_0x3896ef[_0x2fd4('0x38')]['id']}},_0x3fc94e={};_0x3fc94e[_0x2fd4('0x22')]=_['keys'](db[_0x2fd4('0x33')][_0x2fd4('0x1e')]);_0x3fc94e[_0x2fd4('0x24')]=_[_0x2fd4('0x25')](_0x3896ef[_0x2fd4('0x24')]);_0x3fc94e[_0x2fd4('0x26')]=_[_0x2fd4('0x27')](_0x3fc94e[_0x2fd4('0x22')],_0x3fc94e['query']);_0x38e149[_0x2fd4('0x28')]=_[_0x2fd4('0x27')](_0x3fc94e['model'],qs[_0x2fd4('0x29')](_0x3896ef[_0x2fd4('0x24')][_0x2fd4('0x29')]));_0x38e149[_0x2fd4('0x28')]=_0x38e149['attributes'][_0x2fd4('0x39')]?_0x38e149[_0x2fd4('0x28')]:_0x3fc94e[_0x2fd4('0x22')];if(_0x3896ef[_0x2fd4('0x24')]['includeAll']){_0x38e149[_0x2fd4('0x34')]=[{'all':!![]}];}_0x38e149=_['merge']({},_0x38e149,_0x3896ef['options']);return db['SquareProject'][_0x2fd4('0x3a')](_0x38e149)[_0x2fd4('0x12')](handleEntityNotFound(_0x17f8f7,null))[_0x2fd4('0x12')](respondWithResult(_0x17f8f7,null))[_0x2fd4('0x36')](handleError(_0x17f8f7,null));};exports['create']=function(_0x36f180,_0x2f2099){return db[_0x2fd4('0x33')][_0x2fd4('0x3b')](_0x36f180['body'],{})['then'](function(_0x34478c){var _0x49990a=_0x36f180[_0x2fd4('0x3c')]['get']({'plain':!![]});if(!_0x49990a)throw new Error(_0x2fd4('0x3d'));if(_0x49990a[_0x2fd4('0x3e')]===_0x2fd4('0x3c')){var _0x5061d0=_0x34478c[_0x2fd4('0x3f')]({'plain':!![]});var _0x36b58b=_0x2fd4('0x40');return db[_0x2fd4('0x41')][_0x2fd4('0x3a')]({'where':{'name':_0x36b58b,'userProfileId':_0x49990a[_0x2fd4('0x42')]},'raw':!![]})['then'](function(_0x2c15ff){if(_0x2c15ff&&_0x2c15ff[_0x2fd4('0x43')]===0x0){return db[_0x2fd4('0x13')]['create']({'name':_0x5061d0[_0x2fd4('0x23')],'resourceId':_0x5061d0['id'],'type':_0x2c15ff[_0x2fd4('0x23')],'sectionId':_0x2c15ff['id']},{})[_0x2fd4('0x12')](function(){return _0x34478c;});}else{return _0x34478c;}})[_0x2fd4('0x36')](function(_0x53ef03){logger[_0x2fd4('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53ef03);throw _0x53ef03;});}return _0x34478c;})[_0x2fd4('0x12')](respondWithResult(_0x2f2099,0xc9))[_0x2fd4('0x36')](handleError(_0x2f2099,null));};exports[_0x2fd4('0x11')]=function(_0x2db2bf,_0x386f04){if(_0x2db2bf[_0x2fd4('0x44')]['id']){delete _0x2db2bf[_0x2fd4('0x44')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x2db2bf[_0x2fd4('0x38')]['id']}})[_0x2fd4('0x12')](handleEntityNotFound(_0x386f04,null))[_0x2fd4('0x12')](saveUpdates(_0x2db2bf[_0x2fd4('0x44')],null))['then'](function(_0x419613){if(!_0x419613)return;var _0x366f30=_0x419613[_0x2fd4('0x3f')]({'plain':!![]});return _0x366f30;})[_0x2fd4('0x12')](function(_0x179ec8){var _0x236375=new Redis(config['redis']);_0x236375['publish'](_0x2fd4('0x16'),JSON[_0x2fd4('0x17')](_[_0x2fd4('0x45')](_0x179ec8,['id',_0x2fd4('0x23'),_0x2fd4('0x46')])));return _0x179ec8;})['then'](respondWithResult(_0x386f04,null))['catch'](handleError(_0x386f04,null));};exports[_0x2fd4('0x14')]=function(_0x153670,_0x55b912){return db['SquareProject']['find']({'where':{'id':_0x153670[_0x2fd4('0x38')]['id']}})[_0x2fd4('0x12')](handleEntityNotFound(_0x55b912,null))['then'](removeEntity(_0x55b912,null))[_0x2fd4('0x36')](handleError(_0x55b912,null));}; \ No newline at end of file +var _0x12d9=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','publish','production','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','get','UserProfileResource','agi','stringify','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','catch','show','params','includeAll'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x12d9,0x16a));var _0x912d=function(_0x1730dd,_0x3cacb2){_0x1730dd=_0x1730dd-0x0;var _0x15a53c=_0x12d9[_0x1730dd];return _0x15a53c;};'use strict';var _=require(_0x912d('0x0'));var Redis=require(_0x912d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x912d('0x2'))('api');var config=require(_0x912d('0x3'));var db=require(_0x912d('0x4'))['db'];config[_0x912d('0x5')]=_[_0x912d('0x6')](config['redis'],{'host':_0x912d('0x7'),'port':0x18eb});var socket=require(_0x912d('0x8'))(new Redis(config[_0x912d('0x5')]));require('./squareProject.socket')[_0x912d('0x9')](socket);function respondWithResult(_0x208116,_0xf44592){_0xf44592=_0xf44592||0xc8;return function(_0xc7b6e1){if(_0xc7b6e1){return _0x208116['status'](_0xf44592)[_0x912d('0xa')](_0xc7b6e1);}};}function respondWithFilteredResult(_0x567b10,_0x4503db){return function(_0x48c9cd){if(_0x48c9cd){var _0x1d1886=typeof _0x4503db[_0x912d('0xb')]===_0x912d('0xc')&&typeof _0x4503db[_0x912d('0xd')]==='undefined';var _0x276495=_0x48c9cd[_0x912d('0xe')];var _0x235f18=_0x1d1886?0x0:_0x4503db['offset'];var _0x5cfe5a=_0x1d1886?_0x48c9cd[_0x912d('0xe')]:_0x4503db[_0x912d('0xb')]+_0x4503db[_0x912d('0xd')];var _0x345545;if(_0x5cfe5a>=_0x276495){_0x5cfe5a=_0x276495;_0x345545=0xc8;}else{_0x345545=0xce;}_0x567b10[_0x912d('0xf')](_0x345545);return _0x567b10[_0x912d('0x10')](_0x912d('0x11'),_0x235f18+'-'+_0x5cfe5a+'/'+_0x276495)[_0x912d('0xa')](_0x48c9cd);}return null;};}function saveUpdates(_0x26dff4){return function(_0x3f69a8){if(_0x3f69a8){return _0x3f69a8['update'](_0x26dff4)[_0x912d('0x12')](function(_0x2dfd62){return _0x2dfd62;});}return null;};}function removeEntity(_0x27ed62){return function(_0x43e64e){if(_0x43e64e){return _0x43e64e[_0x912d('0x13')]()['then'](function(){var _0x3fdd80=_0x43e64e[_0x912d('0x14')]({'plain':!![]});var _0x37fced='SquareProjects';return db[_0x912d('0x15')][_0x912d('0x13')]({'where':{'type':_0x37fced,'resourceId':_0x3fdd80['id']}})[_0x912d('0x12')](function(){return _0x43e64e;});})[_0x912d('0x12')](function(){var _0x4e2ef4=new Redis(config[_0x912d('0x5')]);_0x4e2ef4['publish'](_0x912d('0x16'),JSON[_0x912d('0x17')]({'id':_0x43e64e['id'],'deleted':!![]}));})[_0x912d('0x12')](function(){_0x27ed62[_0x912d('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d412){return function(_0x595942){if(!_0x595942){_0x53d412['sendStatus'](0x194);}return _0x595942;};}function handleError(_0x282bc9,_0x54eb8b){_0x54eb8b=_0x54eb8b||0x1f4;return function(_0x462d78){logger[_0x912d('0x18')](_0x462d78[_0x912d('0x19')]);if(_0x462d78[_0x912d('0x1a')]){delete _0x462d78[_0x912d('0x1a')];}_0x282bc9[_0x912d('0xf')](_0x54eb8b)[_0x912d('0x1b')](_0x462d78);};}exports[_0x912d('0x1c')]=function(_0x3a9096,_0x16a305){var _0x2c44ce={},_0x40cdbb={},_0x27dc3d={'count':0x0,'rows':[]};var _0x51212f=_['map'](db[_0x912d('0x1d')][_0x912d('0x1e')],function(_0x42cf10){return{'name':_0x42cf10[_0x912d('0x1f')],'type':_0x42cf10[_0x912d('0x20')][_0x912d('0x21')]};});_0x40cdbb[_0x912d('0x22')]=_[_0x912d('0x23')](_0x51212f,_0x912d('0x1a'));_0x40cdbb[_0x912d('0x24')]=_[_0x912d('0x25')](_0x3a9096[_0x912d('0x24')]);_0x40cdbb['filters']=_[_0x912d('0x26')](_0x40cdbb['model'],_0x40cdbb[_0x912d('0x24')]);_0x2c44ce['attributes']=_['intersection'](_0x40cdbb[_0x912d('0x22')],qs['fields'](_0x3a9096[_0x912d('0x24')][_0x912d('0x27')]));_0x2c44ce[_0x912d('0x28')]=_0x2c44ce[_0x912d('0x28')][_0x912d('0x29')]?_0x2c44ce[_0x912d('0x28')]:_0x40cdbb[_0x912d('0x22')];if(!_0x3a9096[_0x912d('0x24')][_0x912d('0x2a')](_0x912d('0x2b'))){_0x2c44ce['limit']=qs[_0x912d('0xd')](_0x3a9096['query'][_0x912d('0xd')]);_0x2c44ce['offset']=qs['offset'](_0x3a9096[_0x912d('0x24')][_0x912d('0xb')]);}_0x2c44ce[_0x912d('0x2c')]=qs[_0x912d('0x2d')](_0x3a9096[_0x912d('0x24')][_0x912d('0x2d')]);_0x2c44ce[_0x912d('0x2e')]=qs[_0x912d('0x2f')](_[_0x912d('0x30')](_0x3a9096[_0x912d('0x24')],_0x40cdbb['filters']),_0x51212f);if(_0x3a9096[_0x912d('0x24')][_0x912d('0x31')]){_0x2c44ce[_0x912d('0x2e')]=_[_0x912d('0x32')](_0x2c44ce[_0x912d('0x2e')],{'$or':_['map'](_0x51212f,function(_0x16175e){if(_0x16175e[_0x912d('0x20')]!=='VIRTUAL'){var _0x250e4c={};_0x250e4c[_0x16175e[_0x912d('0x1a')]]={'$like':'%'+_0x3a9096[_0x912d('0x24')][_0x912d('0x31')]+'%'};return _0x250e4c;}})});}_0x2c44ce=_[_0x912d('0x32')]({},_0x2c44ce,_0x3a9096[_0x912d('0x33')]);var _0x3440d7={'where':_0x2c44ce[_0x912d('0x2e')]};return db['SquareProject'][_0x912d('0xe')](_0x3440d7)[_0x912d('0x12')](function(_0x1afd77){_0x27dc3d[_0x912d('0xe')]=_0x1afd77;if(_0x3a9096[_0x912d('0x24')]['includeAll']){_0x2c44ce[_0x912d('0x34')]=[{'all':!![]}];}return db[_0x912d('0x1d')][_0x912d('0x35')](_0x2c44ce);})[_0x912d('0x12')](function(_0x596dec){_0x27dc3d['rows']=_0x596dec;return _0x27dc3d;})['then'](respondWithFilteredResult(_0x16a305,_0x2c44ce))[_0x912d('0x36')](handleError(_0x16a305,null));};exports[_0x912d('0x37')]=function(_0xc53906,_0x38b79c){var _0x327f38={'raw':![],'where':{'id':_0xc53906[_0x912d('0x38')]['id']}},_0x1947d1={};_0x1947d1['model']=_[_0x912d('0x25')](db[_0x912d('0x1d')][_0x912d('0x1e')]);_0x1947d1[_0x912d('0x24')]=_['keys'](_0xc53906[_0x912d('0x24')]);_0x1947d1[_0x912d('0x2f')]=_['intersection'](_0x1947d1['model'],_0x1947d1[_0x912d('0x24')]);_0x327f38[_0x912d('0x28')]=_['intersection'](_0x1947d1[_0x912d('0x22')],qs['fields'](_0xc53906[_0x912d('0x24')][_0x912d('0x27')]));_0x327f38[_0x912d('0x28')]=_0x327f38[_0x912d('0x28')][_0x912d('0x29')]?_0x327f38[_0x912d('0x28')]:_0x1947d1[_0x912d('0x22')];if(_0xc53906[_0x912d('0x24')][_0x912d('0x39')]){_0x327f38[_0x912d('0x34')]=[{'all':!![]}];}_0x327f38=_[_0x912d('0x32')]({},_0x327f38,_0xc53906[_0x912d('0x33')]);return db[_0x912d('0x1d')][_0x912d('0x3a')](_0x327f38)[_0x912d('0x12')](handleEntityNotFound(_0x38b79c,null))[_0x912d('0x12')](respondWithResult(_0x38b79c,null))[_0x912d('0x36')](handleError(_0x38b79c,null));};exports[_0x912d('0x3b')]=function(_0x21a87b,_0x4ef769){return db['SquareProject'][_0x912d('0x3b')](_0x21a87b[_0x912d('0x3c')],{})['then'](function(_0x35bb71){var _0x1ec872=_0x21a87b[_0x912d('0x3d')]['get']({'plain':!![]});if(!_0x1ec872)throw new Error(_0x912d('0x3e'));if(_0x1ec872[_0x912d('0x3f')]===_0x912d('0x3d')){var _0x3afde3=_0x35bb71[_0x912d('0x14')]({'plain':!![]});var _0x501093=_0x912d('0x40');return db['UserProfileSection'][_0x912d('0x3a')]({'where':{'name':_0x501093,'userProfileId':_0x1ec872[_0x912d('0x41')]},'raw':!![]})[_0x912d('0x12')](function(_0x6b157){if(_0x6b157&&_0x6b157['autoAssociation']===0x0){return db[_0x912d('0x15')][_0x912d('0x3b')]({'name':_0x3afde3[_0x912d('0x1a')],'resourceId':_0x3afde3['id'],'type':_0x6b157[_0x912d('0x1a')],'sectionId':_0x6b157['id']},{})['then'](function(){return _0x35bb71;});}else{return _0x35bb71;}})[_0x912d('0x36')](function(_0x342ead){logger[_0x912d('0x18')](_0x912d('0x42'),_0x342ead);throw _0x342ead;});}return _0x35bb71;})['then'](respondWithResult(_0x4ef769,0xc9))['catch'](handleError(_0x4ef769,null));};exports[_0x912d('0x43')]=function(_0x340744,_0x1a1b7a){if(_0x340744[_0x912d('0x3c')]['id']){delete _0x340744[_0x912d('0x3c')]['id'];}return db[_0x912d('0x1d')][_0x912d('0x3a')]({'where':{'id':_0x340744[_0x912d('0x38')]['id']}})[_0x912d('0x12')](handleEntityNotFound(_0x1a1b7a,null))[_0x912d('0x12')](saveUpdates(_0x340744[_0x912d('0x3c')],null))[_0x912d('0x12')](function(_0x3b7980){if(!_0x3b7980)return;var _0x555e86=_0x3b7980[_0x912d('0x14')]({'plain':!![]});return _0x555e86;})[_0x912d('0x12')](function(_0x5887c0){var _0x3ff2c8=new Redis(config['redis']);_0x3ff2c8[_0x912d('0x44')](_0x912d('0x16'),JSON['stringify'](_[_0x912d('0x30')](_0x5887c0,['id','name',_0x912d('0x45')])));return _0x5887c0;})[_0x912d('0x12')](respondWithResult(_0x1a1b7a,null))['catch'](handleError(_0x1a1b7a,null));};exports[_0x912d('0x13')]=function(_0x16d5fb,_0x3360){return db[_0x912d('0x1d')][_0x912d('0x3a')]({'where':{'id':_0x16d5fb[_0x912d('0x38')]['id']}})[_0x912d('0x12')](handleEntityNotFound(_0x3360,null))['then'](removeEntity(_0x3360,null))[_0x912d('0x36')](handleError(_0x3360,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index c4c8fae..7941745 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 _0x646a=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x328d5b,_0x39c179){var _0x307fae=function(_0x49e93c){while(--_0x49e93c){_0x328d5b['push'](_0x328d5b['shift']());}};_0x307fae(++_0x39c179);}(_0x646a,0x117));var _0xa646=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x646a[_0x1da527];return _0x40fc7c;};'use strict';var EventEmitter=require(_0xa646('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xa646('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa646('0x2')](0x0);var events={'afterCreate':_0xa646('0x3'),'afterUpdate':_0xa646('0x4'),'afterDestroy':_0xa646('0x5')};function emitEvent(_0x233682){return function(_0x3a5c44,_0x111627,_0x2fb3e7){SquareProjectEvents[_0xa646('0x6')](_0x233682+':'+_0x3a5c44['id'],_0x3a5c44);SquareProjectEvents[_0xa646('0x6')](_0x233682,_0x3a5c44);_0x2fb3e7(null);};}for(var e in events){if(events[_0xa646('0x7')](e)){var event=events[e];SquareProject[_0xa646('0x8')](e,emitEvent(event));}}module[_0xa646('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x565b=['events','save','remove','hasOwnProperty','hook','exports'];(function(_0x102662,_0x4eab33){var _0x6d6bdc=function(_0x1e6f81){while(--_0x1e6f81){_0x102662['push'](_0x102662['shift']());}};_0x6d6bdc(++_0x4eab33);}(_0x565b,0x96));var _0xb565=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x565b[_0x1e7b16];return _0x37fadc;};'use strict';var EventEmitter=require(_0xb565('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb565('0x1'),'afterUpdate':'update','afterDestroy':_0xb565('0x2')};function emitEvent(_0x52b427){return function(_0x41b57a,_0xf7454f,_0x4d2d12){SquareProjectEvents['emit'](_0x52b427+':'+_0x41b57a['id'],_0x41b57a);SquareProjectEvents['emit'](_0x52b427,_0x41b57a);_0x4d2d12(null);};}for(var e in events){if(events[_0xb565('0x3')](e)){var event=events[e];SquareProject[_0xb565('0x4')](e,emitEvent(event));}}module[_0xb565('0x5')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index e64479a..95554a1 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 _0x344e=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x344e,0x64));var _0xe344=function(_0x5344db,_0x112b8a){_0x5344db=_0x5344db-0x0;var _0xe38f4f=_0x344e[_0x5344db];return _0xe38f4f;};'use strict';var _=require(_0xe344('0x0'));var util=require(_0xe344('0x1'));var logger=require(_0xe344('0x2'))(_0xe344('0x3'));var moment=require(_0xe344('0x4'));var BPromise=require(_0xe344('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe344('0x6'));var rimraf=require(_0xe344('0x7'));var config=require(_0xe344('0x8'));var attributes=require(_0xe344('0x9'));module[_0xe344('0xa')]=function(_0x5b6a7b,_0xffc80f){return _0x5b6a7b['define'](_0xe344('0xb'),attributes,{'tableName':_0xe344('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ff35c,_0xa4af0f,_0x5c6541){if(_0x2ff35c[_0xe344('0xd')]('preproduction')){_0x2ff35c[_0xe344('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2ff35c[_0xe344('0xd')]('production')){_0x2ff35c[_0xe344('0xf')]=moment()['format'](_0xe344('0x10'));}_0x5c6541(null,_0x2ff35c);}}});}; \ No newline at end of file +var _0xc298=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc298,0x143));var _0x8c29=function(_0x2eb80d,_0x2808d6){_0x2eb80d=_0x2eb80d-0x0;var _0x1e05eb=_0xc298[_0x2eb80d];return _0x1e05eb;};'use strict';var _=require('lodash');var util=require(_0x8c29('0x0'));var logger=require(_0x8c29('0x1'))(_0x8c29('0x2'));var moment=require(_0x8c29('0x3'));var BPromise=require(_0x8c29('0x4'));var rp=require(_0x8c29('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c29('0x6'));var config=require(_0x8c29('0x7'));var attributes=require(_0x8c29('0x8'));module[_0x8c29('0x9')]=function(_0x6cac5d,_0x50a81c){return _0x6cac5d[_0x8c29('0xa')](_0x8c29('0xb'),attributes,{'tableName':_0x8c29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xef6e28,_0x29e9e0,_0xe493d7){if(_0xef6e28['changed']('preproduction')){_0xef6e28['savedAt']=moment()[_0x8c29('0xd')](_0x8c29('0xe'));}if(_0xef6e28[_0x8c29('0xf')](_0x8c29('0x10'))){_0xef6e28[_0x8c29('0x11')]=moment()[_0x8c29('0xd')](_0x8c29('0xe'));}_0xe493d7(null,_0xef6e28);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2750f60..fb3e14a 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 _0xa343=['./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','error','message','ShowSquareProject','find','stringify','catch','lodash','ioredis','../../mysqldb','../../config/environment','defaults','redis','localhost','socket.io-emitter'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa343,0x70));var _0x3a34=function(_0x190d7b,_0x548785){_0x190d7b=_0x190d7b-0x0;var _0x33370b=_0xa343[_0x190d7b];return _0x33370b;};'use strict';var _=require(_0x3a34('0x0'));var Redis=require(_0x3a34('0x1'));var db=require(_0x3a34('0x2'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x3a34('0x3'));config['redis']=_[_0x3a34('0x4')](config[_0x3a34('0x5')],{'host':_0x3a34('0x6'),'port':0x18eb});var socket=require(_0x3a34('0x7'))(new Redis(config['redis']));require(_0x3a34('0x8'))[_0x3a34('0x9')](socket);exports[_0x3a34('0xa')]=function(_0x4bcf6e){var _0x8cb380=this;return new Promise(function(_0x167e86,_0x58fea6){return db[_0x3a34('0xb')][_0x3a34('0xc')]({'raw':_0x4bcf6e[_0x3a34('0xd')]?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0xe')]===undefined?!![]:![]:!![],'where':_0x4bcf6e['options']?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0xf')]||null:null,'attributes':_0x4bcf6e[_0x3a34('0xd')]?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0x10')]||null:null,'limit':_0x4bcf6e[_0x3a34('0xd')]?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0x11')]||null:null,'include':_0x4bcf6e['options']?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0x12')]?_[_0x3a34('0x13')](_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0x12')],function(_0x3ab532){return{'model':db[_0x3ab532[_0x3a34('0x14')]],'as':_0x3ab532['as'],'attributes':_0x3ab532['attributes'],'include':_0x3ab532[_0x3a34('0x12')]?_['map'](_0x3ab532[_0x3a34('0x12')],function(_0x429480){return{'model':db[_0x429480[_0x3a34('0x14')]],'as':_0x429480['as'],'attributes':_0x429480['attributes'],'include':_0x429480['include']?_[_0x3a34('0x13')](_0x429480['include'],function(_0x5ab61e){return{'model':db[_0x5ab61e[_0x3a34('0x14')]],'as':_0x5ab61e['as'],'attributes':_0x5ab61e[_0x3a34('0x10')]};}):[]};}):[]};}):[]:[]})[_0x3a34('0x15')](function(_0x523d72){logger[_0x3a34('0x16')](_0x3a34('0xa'),_0x4bcf6e);logger[_0x3a34('0x17')](_0x3a34('0xa'),_0x4bcf6e,JSON['stringify'](_0x523d72));_0x167e86(_0x523d72);})['catch'](function(_0x4ccb26){logger[_0x3a34('0x18')]('GetSquareProjects',_0x4ccb26[_0x3a34('0x19')],_0x4bcf6e);_0x58fea6(_0x8cb380['error'](0x1f4,_0x4ccb26[_0x3a34('0x19')]));});});};exports[_0x3a34('0x1a')]=function(_0x5948d7){var _0xa784db=this;return new Promise(function(_0x1a9339,_0x42f635){return db[_0x3a34('0xb')][_0x3a34('0x1b')]({'raw':_0x5948d7[_0x3a34('0xd')]?_0x5948d7[_0x3a34('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x5948d7[_0x3a34('0xd')]?_0x5948d7['options'][_0x3a34('0xf')]||null:null,'attributes':_0x5948d7[_0x3a34('0xd')]?_0x5948d7[_0x3a34('0xd')][_0x3a34('0x10')]||null:null,'include':_0x5948d7['options']?_0x5948d7[_0x3a34('0xd')][_0x3a34('0x12')]?_[_0x3a34('0x13')](_0x5948d7[_0x3a34('0xd')][_0x3a34('0x12')],function(_0x10f63c){return{'model':db[_0x10f63c[_0x3a34('0x14')]],'as':_0x10f63c['as'],'attributes':_0x10f63c[_0x3a34('0x10')],'include':_0x10f63c[_0x3a34('0x12')]?_[_0x3a34('0x13')](_0x10f63c[_0x3a34('0x12')],function(_0x30df5d){return{'model':db[_0x30df5d[_0x3a34('0x14')]],'as':_0x30df5d['as'],'attributes':_0x30df5d[_0x3a34('0x10')],'include':_0x30df5d[_0x3a34('0x12')]?_[_0x3a34('0x13')](_0x30df5d[_0x3a34('0x12')],function(_0x3a60f2){return{'model':db[_0x3a60f2[_0x3a34('0x14')]],'as':_0x3a60f2['as'],'attributes':_0x3a60f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a34('0x15')](function(_0x221c52){logger['info'](_0x3a34('0x1a'),_0x5948d7);logger['debug'](_0x3a34('0x1a'),_0x5948d7,JSON[_0x3a34('0x1c')](_0x221c52));_0x1a9339(_0x221c52);})[_0x3a34('0x1d')](function(_0x3f73c9){logger['error'](_0x3a34('0x1a'),_0x3f73c9[_0x3a34('0x19')],_0x5948d7);_0x42f635(_0xa784db['error'](0x1f4,_0x3f73c9[_0x3a34('0x19')]));});});}; \ No newline at end of file +var _0x45fe=['findAll','options','where','attributes','limit','include','map','model','then','info','stringify','catch','message','error','ShowSquareProject','raw','debug','ioredis','../../mysqldb','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject'];(function(_0x85a480,_0x10c882){var _0x5939cd=function(_0xb2d0f6){while(--_0xb2d0f6){_0x85a480['push'](_0x85a480['shift']());}};_0x5939cd(++_0x10c882);}(_0x45fe,0x1a6));var _0xe45f=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x45fe[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var Redis=require(_0xe45f('0x0'));var db=require(_0xe45f('0x1'))['db'];var logger=require('../../config/logger')(_0xe45f('0x2'));var config=require(_0xe45f('0x3'));config[_0xe45f('0x4')]=_['defaults'](config[_0xe45f('0x4')],{'host':_0xe45f('0x5'),'port':0x18eb});var socket=require(_0xe45f('0x6'))(new Redis(config[_0xe45f('0x4')]));require('./squareProject.socket')[_0xe45f('0x7')](socket);exports[_0xe45f('0x8')]=function(_0x4650b4){var _0x16ffb1=this;return new Promise(function(_0x39cd09,_0x102c86){return db[_0xe45f('0x9')][_0xe45f('0xa')]({'raw':_0x4650b4[_0xe45f('0xb')]?_0x4650b4[_0xe45f('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x4650b4[_0xe45f('0xb')]?_0x4650b4['options'][_0xe45f('0xc')]||null:null,'attributes':_0x4650b4[_0xe45f('0xb')]?_0x4650b4[_0xe45f('0xb')][_0xe45f('0xd')]||null:null,'limit':_0x4650b4[_0xe45f('0xb')]?_0x4650b4[_0xe45f('0xb')][_0xe45f('0xe')]||null:null,'include':_0x4650b4[_0xe45f('0xb')]?_0x4650b4[_0xe45f('0xb')][_0xe45f('0xf')]?_[_0xe45f('0x10')](_0x4650b4['options']['include'],function(_0x3b5a38){return{'model':db[_0x3b5a38[_0xe45f('0x11')]],'as':_0x3b5a38['as'],'attributes':_0x3b5a38[_0xe45f('0xd')],'include':_0x3b5a38[_0xe45f('0xf')]?_[_0xe45f('0x10')](_0x3b5a38[_0xe45f('0xf')],function(_0x54ce6d){return{'model':db[_0x54ce6d[_0xe45f('0x11')]],'as':_0x54ce6d['as'],'attributes':_0x54ce6d[_0xe45f('0xd')],'include':_0x54ce6d[_0xe45f('0xf')]?_[_0xe45f('0x10')](_0x54ce6d[_0xe45f('0xf')],function(_0x173fb4){return{'model':db[_0x173fb4[_0xe45f('0x11')]],'as':_0x173fb4['as'],'attributes':_0x173fb4[_0xe45f('0xd')]};}):[]};}):[]};}):[]:[]})[_0xe45f('0x12')](function(_0x1068e8){logger[_0xe45f('0x13')]('GetSquareProjects',_0x4650b4);logger['debug'](_0xe45f('0x8'),_0x4650b4,JSON[_0xe45f('0x14')](_0x1068e8));_0x39cd09(_0x1068e8);})[_0xe45f('0x15')](function(_0x2c7906){logger['error'](_0xe45f('0x8'),_0x2c7906[_0xe45f('0x16')],_0x4650b4);_0x102c86(_0x16ffb1[_0xe45f('0x17')](0x1f4,_0x2c7906['message']));});});};exports[_0xe45f('0x18')]=function(_0x1ad238){var _0x36032e=this;return new Promise(function(_0x14cf58,_0x266ab0){return db[_0xe45f('0x9')]['find']({'raw':_0x1ad238[_0xe45f('0xb')]?_0x1ad238[_0xe45f('0xb')][_0xe45f('0x19')]===undefined?!![]:![]:!![],'where':_0x1ad238[_0xe45f('0xb')]?_0x1ad238[_0xe45f('0xb')][_0xe45f('0xc')]||null:null,'attributes':_0x1ad238[_0xe45f('0xb')]?_0x1ad238['options']['attributes']||null:null,'include':_0x1ad238['options']?_0x1ad238[_0xe45f('0xb')][_0xe45f('0xf')]?_[_0xe45f('0x10')](_0x1ad238['options'][_0xe45f('0xf')],function(_0x3a6422){return{'model':db[_0x3a6422[_0xe45f('0x11')]],'as':_0x3a6422['as'],'attributes':_0x3a6422[_0xe45f('0xd')],'include':_0x3a6422[_0xe45f('0xf')]?_[_0xe45f('0x10')](_0x3a6422[_0xe45f('0xf')],function(_0x29ca74){return{'model':db[_0x29ca74[_0xe45f('0x11')]],'as':_0x29ca74['as'],'attributes':_0x29ca74[_0xe45f('0xd')],'include':_0x29ca74[_0xe45f('0xf')]?_[_0xe45f('0x10')](_0x29ca74[_0xe45f('0xf')],function(_0x2cd7b5){return{'model':db[_0x2cd7b5[_0xe45f('0x11')]],'as':_0x2cd7b5['as'],'attributes':_0x2cd7b5[_0xe45f('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a1144){logger[_0xe45f('0x13')]('ShowSquareProject',_0x1ad238);logger[_0xe45f('0x1a')](_0xe45f('0x18'),_0x1ad238,JSON['stringify'](_0x5a1144));_0x14cf58(_0x5a1144);})[_0xe45f('0x15')](function(_0x3e3352){logger['error']('ShowSquareProject',_0x3e3352[_0xe45f('0x16')],_0x1ad238);_0x266ab0(_0x36032e[_0xe45f('0x17')](0x1f4,_0x3e3352[_0xe45f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 5095104..513d524 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 _0x5f37=['update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x39aab2,_0x514502){var _0x3c4a01=function(_0x3da93e){while(--_0x3da93e){_0x39aab2['push'](_0x39aab2['shift']());}};_0x3c4a01(++_0x514502);}(_0x5f37,0x11e));var _0x75f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5f37[_0x2641f9];return _0x585741;};'use strict';var SquareProjectEvents=require(_0x75f3('0x0'));var events=['save','remove',_0x75f3('0x1')];function createListener(_0xe446c7,_0x5da882){return function(_0x2880fd){_0x5da882[_0x75f3('0x2')](_0xe446c7,_0x2880fd);};}function removeListener(_0x1199b6,_0x1e8527){return function(){SquareProjectEvents[_0x75f3('0x3')](_0x1199b6,_0x1e8527);};}exports[_0x75f3('0x4')]=function(_0x221abb){for(var _0x3b7626=0x0,_0x3c69ac=events[_0x75f3('0x5')];_0x3b7626<_0x3c69ac;_0x3b7626++){var _0x346134=events[_0x3b7626];var _0x4889a5=createListener(_0x75f3('0x6')+_0x346134,_0x221abb);SquareProjectEvents['on'](_0x346134,_0x4889a5);}}; \ No newline at end of file +var _0xd2d4=['save','update','length','./squareProject.events'];(function(_0x4267bb,_0x22ffd7){var _0x47f30a=function(_0x511170){while(--_0x511170){_0x4267bb['push'](_0x4267bb['shift']());}};_0x47f30a(++_0x22ffd7);}(_0xd2d4,0x17b));var _0x4d2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd2d4[_0x20a584];return _0x4b41a8;};'use strict';var SquareProjectEvents=require(_0x4d2d('0x0'));var events=[_0x4d2d('0x1'),'remove',_0x4d2d('0x2')];function createListener(_0x4dfb2b,_0x124632){return function(_0xe46504){_0x124632['emit'](_0x4dfb2b,_0xe46504);};}function removeListener(_0x5abcd4,_0x4bf249){return function(){SquareProjectEvents['removeListener'](_0x5abcd4,_0x4bf249);};}exports['register']=function(_0x198294){for(var _0x52d8bd=0x0,_0x125b77=events[_0x4d2d('0x3')];_0x52d8bd<_0x125b77;_0x52d8bd++){var _0x4fa50c=events[_0x52d8bd];var _0x51748e=createListener('squareProject:'+_0x4fa50c,_0x198294);SquareProjectEvents['on'](_0x4fa50c,_0x51748e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1a45a05..95c89e7 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3a26e3,_0x440198){var _0xc5c3c3=function(_0x23d25f){while(--_0x23d25f){_0x3a26e3['push'](_0x3a26e3['shift']());}};_0xc5c3c3(++_0x440198);}(_0x4975,0x86));var _0x5497=function(_0x281b07,_0x35d046){_0x281b07=_0x281b07-0x0;var _0x5ed14c=_0x4975[_0x281b07];return _0x5ed14c;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x134a2b,_0x599293){var _0x3d2b1d=function(_0x4f51fd){while(--_0x4f51fd){_0x134a2b['push'](_0x134a2b['shift']());}};_0x3d2b1d(++_0x599293);}(_0xabce,0x103));var _0xeabc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xabce[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b42420d..696f481 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 _0x6aa7=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x11539d,_0x2b3499){var _0x43e15e=function(_0x369799){while(--_0x369799){_0x11539d['push'](_0x11539d['shift']());}};_0x43e15e(++_0x2b3499);}(_0x6aa7,0x178));var _0x76aa=function(_0x2ec7d6,_0x366964){_0x2ec7d6=_0x2ec7d6-0x0;var _0x2469e8=_0x6aa7[_0x2ec7d6];return _0x2469e8;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'dnid':{'type':Sequelize[_0x76aa('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x76aa('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x76aa('0x2')],'get':function(){var _0x36d12b='';var _0xa9b695=this['getDataValue'](_0x76aa('0x3'));if(_0xa9b695){_0x36d12b=_0xa9b695[_0x76aa('0x4')](_0xa9b695[_0x76aa('0x5')]('.'));}return _0x36d12b;}}}; \ No newline at end of file +var _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x5125e2,_0x14f85c){var _0x45c2f3=function(_0x3ff619){while(--_0x3ff619){_0x5125e2['push'](_0x5125e2['shift']());}};_0x45c2f3(++_0x14f85c);}(_0x5fd1,0x155));var _0x15fd=function(_0x53d2ca,_0x5e145a){_0x53d2ca=_0x53d2ca-0x0;var _0x2448c9=_0x5fd1[_0x53d2ca];return _0x2448c9;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 2866ea7..c35dbdf 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 _0x9919=['rows','catch','params','rawAttributes','include','options','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','status','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','SquareRecording','count','includeAll','findAll'];(function(_0x4d6463,_0x50d8c6){var _0x2d3deb=function(_0x55eae5){while(--_0x55eae5){_0x4d6463['push'](_0x4d6463['shift']());}};_0x2d3deb(++_0x50d8c6);}(_0x9919,0x193));var _0x9991=function(_0x4fd75e,_0x219e4a){_0x4fd75e=_0x4fd75e-0x0;var _0x5b6338=_0x9919[_0x4fd75e];return _0x5b6338;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9991('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9991('0x1'));var moment=require(_0x9991('0x2'));var BPromise=require(_0x9991('0x3'));var Mustache=require('mustache');var util=require(_0x9991('0x4'));var path=require(_0x9991('0x5'));var sox=require(_0x9991('0x6'));var csv=require(_0x9991('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9991('0x8'));var squel=require(_0x9991('0x9'));var crypto=require(_0x9991('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9991('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9991('0xc'));var Papa=require(_0x9991('0xd'));var Redis=require(_0x9991('0xe'));var authService=require(_0x9991('0xf'));var qs=require(_0x9991('0x10'));var as=require(_0x9991('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9991('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9991('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c9165,_0x16116e){_0x16116e=_0x16116e||0xcc;return function(_0x4e211a){if(_0x4e211a){return _0x4c9165['sendStatus'](_0x16116e);}return _0x4c9165[_0x9991('0x14')](_0x16116e)['end']();};}function respondWithResult(_0xc6f062,_0x3b1d0d){_0x3b1d0d=_0x3b1d0d||0xc8;return function(_0x24bf16){if(_0x24bf16){return _0xc6f062[_0x9991('0x14')](_0x3b1d0d)['json'](_0x24bf16);}};}function respondWithFilteredResult(_0x3f2207,_0x625ba){return function(_0x3f9ff6){if(_0x3f9ff6){var _0x1464b2=typeof _0x625ba[_0x9991('0x15')]===_0x9991('0x16')&&typeof _0x625ba[_0x9991('0x17')]===_0x9991('0x16');var _0x461ec6=_0x3f9ff6['count'];var _0x261cc5=_0x1464b2?0x0:_0x625ba['offset'];var _0x346d2d=_0x1464b2?_0x3f9ff6['count']:_0x625ba[_0x9991('0x15')]+_0x625ba['limit'];var _0x2c0b39;if(_0x346d2d>=_0x461ec6){_0x346d2d=_0x461ec6;_0x2c0b39=0xc8;}else{_0x2c0b39=0xce;}_0x3f2207['status'](_0x2c0b39);return _0x3f2207[_0x9991('0x18')]('Content-Range',_0x261cc5+'-'+_0x346d2d+'/'+_0x461ec6)[_0x9991('0x19')](_0x3f9ff6);}return null;};}function patchUpdates(_0x439ed3){return function(_0x992d1c){try{jsonpatch[_0x9991('0x1a')](_0x992d1c,_0x439ed3,!![]);}catch(_0x4cd8ce){return BPromise[_0x9991('0x1b')](_0x4cd8ce);}return _0x992d1c[_0x9991('0x1c')]();};}function saveUpdates(_0x5eb59c,_0x512098){return function(_0x15bc1b){if(_0x15bc1b){return _0x15bc1b[_0x9991('0x1d')](_0x5eb59c)[_0x9991('0x1e')](function(_0x534c11){return _0x534c11;});}return null;};}function removeEntity(_0x35052e,_0x19fe17){return function(_0x17ce11){if(_0x17ce11){return _0x17ce11[_0x9991('0x1f')]()[_0x9991('0x1e')](function(){_0x35052e[_0x9991('0x14')](0xcc)[_0x9991('0x20')]();});}};}function handleEntityNotFound(_0x375661,_0x2e23f1){return function(_0x417c2f){if(!_0x417c2f){_0x375661[_0x9991('0x21')](0x194);}return _0x417c2f;};}function handleError(_0x45258b,_0x1e40ab){_0x1e40ab=_0x1e40ab||0x1f4;return function(_0x39b481){logger[_0x9991('0x22')](_0x39b481[_0x9991('0x23')]);if(_0x39b481[_0x9991('0x24')]){delete _0x39b481['name'];}_0x45258b[_0x9991('0x14')](_0x1e40ab)[_0x9991('0x25')](_0x39b481);};}exports[_0x9991('0x26')]=function(_0x435ce9,_0x2c52ae){var _0x833b5b={},_0x53870a={},_0x6f8936={'count':0x0,'rows':[]};var _0x17c6ba=_[_0x9991('0x27')](db['SquareRecording']['rawAttributes'],function(_0x261a6c){return{'name':_0x261a6c[_0x9991('0x28')],'type':_0x261a6c[_0x9991('0x29')][_0x9991('0x2a')]};});_0x53870a[_0x9991('0x2b')]=_[_0x9991('0x27')](_0x17c6ba,'name');_0x53870a[_0x9991('0x2c')]=_[_0x9991('0x2d')](_0x435ce9['query']);_0x53870a['filters']=_[_0x9991('0x2e')](_0x53870a[_0x9991('0x2b')],_0x53870a[_0x9991('0x2c')]);_0x833b5b[_0x9991('0x2f')]=_[_0x9991('0x2e')](_0x53870a[_0x9991('0x2b')],qs[_0x9991('0x30')](_0x435ce9[_0x9991('0x2c')]['fields']));_0x833b5b[_0x9991('0x2f')]=_0x833b5b['attributes'][_0x9991('0x31')]?_0x833b5b[_0x9991('0x2f')]:_0x53870a[_0x9991('0x2b')];if(!_0x435ce9[_0x9991('0x2c')]['hasOwnProperty'](_0x9991('0x32'))){_0x833b5b[_0x9991('0x17')]=qs[_0x9991('0x17')](_0x435ce9[_0x9991('0x2c')][_0x9991('0x17')]);_0x833b5b[_0x9991('0x15')]=qs[_0x9991('0x15')](_0x435ce9[_0x9991('0x2c')][_0x9991('0x15')]);}_0x833b5b[_0x9991('0x33')]=qs['sort'](_0x435ce9[_0x9991('0x2c')][_0x9991('0x34')]);_0x833b5b[_0x9991('0x35')]=qs[_0x9991('0x36')](_[_0x9991('0x37')](_0x435ce9[_0x9991('0x2c')],_0x53870a[_0x9991('0x36')]),_0x17c6ba);if(_0x435ce9[_0x9991('0x2c')]['filter']){_0x833b5b[_0x9991('0x35')]=_[_0x9991('0x38')](_0x833b5b[_0x9991('0x35')],{'$or':_[_0x9991('0x27')](_0x17c6ba,function(_0x24f0ae){if(_0x24f0ae[_0x9991('0x29')]!=='VIRTUAL'){var _0x18e90b={};_0x18e90b[_0x24f0ae[_0x9991('0x24')]]={'$like':'%'+_0x435ce9[_0x9991('0x2c')][_0x9991('0x39')]+'%'};return _0x18e90b;}})});}_0x833b5b=_['merge']({},_0x833b5b,_0x435ce9['options']);var _0x4cc3bc={'where':_0x833b5b[_0x9991('0x35')]};return db[_0x9991('0x3a')][_0x9991('0x3b')](_0x4cc3bc)[_0x9991('0x1e')](function(_0x50020d){_0x6f8936[_0x9991('0x3b')]=_0x50020d;if(_0x435ce9[_0x9991('0x2c')][_0x9991('0x3c')]){_0x833b5b['include']=[{'all':!![]}];}return db['SquareRecording'][_0x9991('0x3d')](_0x833b5b);})[_0x9991('0x1e')](function(_0x14cb8a){_0x6f8936[_0x9991('0x3e')]=_0x14cb8a;return _0x6f8936;})[_0x9991('0x1e')](respondWithFilteredResult(_0x2c52ae,_0x833b5b))[_0x9991('0x3f')](handleError(_0x2c52ae,null));};exports['show']=function(_0x500b28,_0x769c89){var _0x28ec08={'raw':!![],'where':{'id':_0x500b28[_0x9991('0x40')]['id']}},_0x4ec788={};_0x4ec788[_0x9991('0x2b')]=_[_0x9991('0x2d')](db[_0x9991('0x3a')][_0x9991('0x41')]);_0x4ec788[_0x9991('0x2c')]=_['keys'](_0x500b28[_0x9991('0x2c')]);_0x4ec788[_0x9991('0x36')]=_[_0x9991('0x2e')](_0x4ec788['model'],_0x4ec788['query']);_0x28ec08[_0x9991('0x2f')]=_['intersection'](_0x4ec788['model'],qs['fields'](_0x500b28[_0x9991('0x2c')][_0x9991('0x30')]));_0x28ec08[_0x9991('0x2f')]=_0x28ec08[_0x9991('0x2f')][_0x9991('0x31')]?_0x28ec08['attributes']:_0x4ec788[_0x9991('0x2b')];if(_0x500b28['query'][_0x9991('0x3c')]){_0x28ec08[_0x9991('0x42')]=[{'all':!![]}];}_0x28ec08=_[_0x9991('0x38')]({},_0x28ec08,_0x500b28[_0x9991('0x43')]);return db[_0x9991('0x3a')]['find'](_0x28ec08)[_0x9991('0x1e')](handleEntityNotFound(_0x769c89,null))[_0x9991('0x1e')](respondWithResult(_0x769c89,null))['catch'](handleError(_0x769c89,null));};exports[_0x9991('0x44')]=function(_0x4d096d,_0x1f5815){return db['SquareRecording']['create'](_0x4d096d[_0x9991('0x45')],{})[_0x9991('0x1e')](respondWithResult(_0x1f5815,0xc9))[_0x9991('0x3f')](handleError(_0x1f5815,null));};exports[_0x9991('0x1d')]=function(_0x4232c8,_0x3e4f91){if(_0x4232c8[_0x9991('0x45')]['id']){delete _0x4232c8[_0x9991('0x45')]['id'];}return db[_0x9991('0x3a')][_0x9991('0x46')]({'where':{'id':_0x4232c8[_0x9991('0x40')]['id']}})[_0x9991('0x1e')](handleEntityNotFound(_0x3e4f91,null))[_0x9991('0x1e')](saveUpdates(_0x4232c8['body'],null))[_0x9991('0x1e')](respondWithResult(_0x3e4f91,null))['catch'](handleError(_0x3e4f91,null));};exports[_0x9991('0x47')]=function(_0x2361e1,_0x44e848,_0x2feac3){var _0x4c60d9=require(_0x9991('0x48'));var _0x47ac4e=![];var _0x333929={};if(_0x2361e1[_0x9991('0x2c')][_0x9991('0x29')]&&_0x2361e1[_0x9991('0x2c')][_0x9991('0x29')]===_0x9991('0x49')){_0x333929[_0x9991('0x49')]=_0x2361e1[_0x9991('0x40')]['id'];}else{_0x333929['id']=_0x2361e1['params']['id'];}return db[_0x9991('0x3a')][_0x9991('0x46')]({'where':_0x333929,'attributes':['id',_0x9991('0x4a'),_0x9991('0x4b')],'raw':!![]})[_0x9991('0x1e')](handleEntityNotFound(_0x44e848,null))[_0x9991('0x1e')](function(_0xd118fa){if(_0xd118fa){var _0x4cc60d=_0xd118fa[_0x9991('0x4a')];var _0x16a3b6=util[_0x9991('0x4c')](_0x9991('0x4d'),_0x4cc60d);if(fs[_0x9991('0x4e')](_0x16a3b6)){_0x47ac4e=!![];return _0x4c60d9[_0x9991('0x4f')](_0x16a3b6,_0x4cc60d,config[_0x9991('0x50')][_0x9991('0x51')])['then'](function(){return _0xd118fa;});}return _0xd118fa;}})[_0x9991('0x1e')](function(_0x3d529e){if(_0x3d529e){var _0x3f1bb4=_0x3d529e['savePath'];if(!fs[_0x9991('0x4e')](_0x3f1bb4)){throw new db['Sequelize'][(_0x9991('0x52'))]('SquareRecording\x20not\x20found');}if(_0x3d529e[_0x9991('0x4b')]){return _0x44e848[_0x9991('0x47')](_0x3f1bb4,_0x3d529e[_0x9991('0x4b')]+path[_0x9991('0x53')](_0x3f1bb4),function(){if(_0x47ac4e){fs[_0x9991('0x54')](_0x3f1bb4);}});}else{return _0x44e848[_0x9991('0x47')](_0x3f1bb4,function(_0x4e6960){if(_0x47ac4e){fs['unlink'](_0x3f1bb4);}});}}})[_0x9991('0x3f')](function(_0x55292e){if(_0x55292e[_0x9991('0x55')]==='SquareRecording\x20not\x20found'){_0x44e848[_0x9991('0x14')](0x194)[_0x9991('0x25')](_0x9991('0x56'));}else{return handleError(_0x44e848,null);}});};exports[_0x9991('0x1f')]=function(_0x33747e,_0x5f42dd){return db['SquareRecording'][_0x9991('0x46')]({'where':{'id':_0x33747e[_0x9991('0x40')]['id']}})['then'](function(_0x371739){if(_['isNil'](_0x371739)){throw new ReferenceError(_0x9991('0x57'));}return _0x371739;})['then'](function(_0x40cda5){var _0x53697e=_0x40cda5[_0x9991('0x4a')];logger[_0x9991('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x53697e);if(!_[_0x9991('0x59')](_0x40cda5['savePath'])&&fs[_0x9991('0x4e')](_0x53697e)){logger['info']('File:\x20\x22'+_0x53697e+_0x9991('0x5a'));fs[_0x9991('0x5b')](_0x53697e);}_0x53697e=_0x53697e+_0x9991('0x5c');if(!_[_0x9991('0x59')](_0x40cda5['savePath'])&&fs[_0x9991('0x4e')](_0x53697e)){logger['info']('File:\x20\x22'+_0x53697e+_0x9991('0x5a'));fs[_0x9991('0x5b')](_0x53697e);}return _0x40cda5;})[_0x9991('0x1e')](function(_0x24bb74){if(!_0x24bb74)throw new InternalError();return _0x24bb74[_0x9991('0x1f')]();})[_0x9991('0x1e')](function(){_0x5f42dd['status'](0xcc)[_0x9991('0x20')]();})['catch'](handleError(_0x5f42dd,null));}; \ No newline at end of file +var _0x8ff6=['type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../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','map','SquareRecording','rawAttributes','fieldName'];(function(_0x143417,_0xaa9b96){var _0x156dab=function(_0x24a1bb){while(--_0x24a1bb){_0x143417['push'](_0x143417['shift']());}};_0x156dab(++_0xaa9b96);}(_0x8ff6,0x1d0));var _0x68ff=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8ff6[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x68ff('0x0'));var rimraf=require(_0x68ff('0x1'));var zipdir=require(_0x68ff('0x2'));var jsonpatch=require(_0x68ff('0x3'));var rp=require(_0x68ff('0x4'));var moment=require(_0x68ff('0x5'));var BPromise=require(_0x68ff('0x6'));var Mustache=require('mustache');var util=require(_0x68ff('0x7'));var path=require(_0x68ff('0x8'));var sox=require(_0x68ff('0x9'));var csv=require(_0x68ff('0xa'));var ejs=require(_0x68ff('0xb'));var fs=require('fs');var fs_extra=require(_0x68ff('0xc'));var _=require(_0x68ff('0xd'));var squel=require('squel');var crypto=require(_0x68ff('0xe'));var jsforce=require(_0x68ff('0xf'));var deskjs=require(_0x68ff('0x10'));var toCsv=require(_0x68ff('0xa'));var querystring=require(_0x68ff('0x11'));var Papa=require(_0x68ff('0x12'));var Redis=require('ioredis');var authService=require(_0x68ff('0x13'));var qs=require(_0x68ff('0x14'));var as=require(_0x68ff('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x68ff('0x16'));var utils=require('../../config/utils');var config=require(_0x68ff('0x17'));var licenseUtil=require(_0x68ff('0x18'));var db=require(_0x68ff('0x19'))['db'];function respondWithStatusCode(_0x2dbcdf,_0x4a2ad6){_0x4a2ad6=_0x4a2ad6||0xcc;return function(_0x543ad4){if(_0x543ad4){return _0x2dbcdf[_0x68ff('0x1a')](_0x4a2ad6);}return _0x2dbcdf[_0x68ff('0x1b')](_0x4a2ad6)[_0x68ff('0x1c')]();};}function respondWithResult(_0x51bc11,_0x47056c){_0x47056c=_0x47056c||0xc8;return function(_0x53cff6){if(_0x53cff6){return _0x51bc11[_0x68ff('0x1b')](_0x47056c)[_0x68ff('0x1d')](_0x53cff6);}};}function respondWithFilteredResult(_0x4df40a,_0x4f0efc){return function(_0x1c9b64){if(_0x1c9b64){var _0x5129c1=typeof _0x4f0efc[_0x68ff('0x1e')]===_0x68ff('0x1f')&&typeof _0x4f0efc[_0x68ff('0x20')]===_0x68ff('0x1f');var _0x41008e=_0x1c9b64[_0x68ff('0x21')];var _0x8d1acf=_0x5129c1?0x0:_0x4f0efc[_0x68ff('0x1e')];var _0x4dfd81=_0x5129c1?_0x1c9b64[_0x68ff('0x21')]:_0x4f0efc[_0x68ff('0x1e')]+_0x4f0efc[_0x68ff('0x20')];var _0x5c4cf8;if(_0x4dfd81>=_0x41008e){_0x4dfd81=_0x41008e;_0x5c4cf8=0xc8;}else{_0x5c4cf8=0xce;}_0x4df40a[_0x68ff('0x1b')](_0x5c4cf8);return _0x4df40a[_0x68ff('0x22')](_0x68ff('0x23'),_0x8d1acf+'-'+_0x4dfd81+'/'+_0x41008e)[_0x68ff('0x1d')](_0x1c9b64);}return null;};}function patchUpdates(_0x45a607){return function(_0x576c52){try{jsonpatch[_0x68ff('0x24')](_0x576c52,_0x45a607,!![]);}catch(_0x517ec8){return BPromise[_0x68ff('0x25')](_0x517ec8);}return _0x576c52[_0x68ff('0x26')]();};}function saveUpdates(_0x450cd6,_0xebe6af){return function(_0x3f3de7){if(_0x3f3de7){return _0x3f3de7[_0x68ff('0x27')](_0x450cd6)[_0x68ff('0x28')](function(_0x45288e){return _0x45288e;});}return null;};}function removeEntity(_0x14c995,_0x4bd081){return function(_0x541b0c){if(_0x541b0c){return _0x541b0c[_0x68ff('0x29')]()[_0x68ff('0x28')](function(){_0x14c995[_0x68ff('0x1b')](0xcc)[_0x68ff('0x1c')]();});}};}function handleEntityNotFound(_0x8d70da,_0x300faa){return function(_0x2c6f7b){if(!_0x2c6f7b){_0x8d70da[_0x68ff('0x1a')](0x194);}return _0x2c6f7b;};}function handleError(_0x4193bf,_0x3b7709){_0x3b7709=_0x3b7709||0x1f4;return function(_0xe77416){logger[_0x68ff('0x2a')](_0xe77416[_0x68ff('0x2b')]);if(_0xe77416['name']){delete _0xe77416[_0x68ff('0x2c')];}_0x4193bf[_0x68ff('0x1b')](_0x3b7709)[_0x68ff('0x2d')](_0xe77416);};}exports[_0x68ff('0x2e')]=function(_0x5d2c7d,_0x13cece){var _0x5359c6={},_0x3ac4ae={},_0x3b576f={'count':0x0,'rows':[]};var _0x237829=_[_0x68ff('0x2f')](db[_0x68ff('0x30')][_0x68ff('0x31')],function(_0x416554){return{'name':_0x416554[_0x68ff('0x32')],'type':_0x416554[_0x68ff('0x33')]['key']};});_0x3ac4ae[_0x68ff('0x34')]=_[_0x68ff('0x2f')](_0x237829,_0x68ff('0x2c'));_0x3ac4ae[_0x68ff('0x35')]=_[_0x68ff('0x36')](_0x5d2c7d[_0x68ff('0x35')]);_0x3ac4ae[_0x68ff('0x37')]=_['intersection'](_0x3ac4ae[_0x68ff('0x34')],_0x3ac4ae['query']);_0x5359c6[_0x68ff('0x38')]=_[_0x68ff('0x39')](_0x3ac4ae[_0x68ff('0x34')],qs[_0x68ff('0x3a')](_0x5d2c7d[_0x68ff('0x35')][_0x68ff('0x3a')]));_0x5359c6['attributes']=_0x5359c6[_0x68ff('0x38')][_0x68ff('0x3b')]?_0x5359c6['attributes']:_0x3ac4ae[_0x68ff('0x34')];if(!_0x5d2c7d[_0x68ff('0x35')][_0x68ff('0x3c')](_0x68ff('0x3d'))){_0x5359c6['limit']=qs[_0x68ff('0x20')](_0x5d2c7d[_0x68ff('0x35')][_0x68ff('0x20')]);_0x5359c6['offset']=qs[_0x68ff('0x1e')](_0x5d2c7d['query'][_0x68ff('0x1e')]);}_0x5359c6[_0x68ff('0x3e')]=qs[_0x68ff('0x3f')](_0x5d2c7d[_0x68ff('0x35')]['sort']);_0x5359c6['where']=qs[_0x68ff('0x37')](_[_0x68ff('0x40')](_0x5d2c7d[_0x68ff('0x35')],_0x3ac4ae['filters']),_0x237829);if(_0x5d2c7d['query'][_0x68ff('0x41')]){_0x5359c6[_0x68ff('0x42')]=_[_0x68ff('0x43')](_0x5359c6['where'],{'$or':_['map'](_0x237829,function(_0x1f5da4){if(_0x1f5da4[_0x68ff('0x33')]!=='VIRTUAL'){var _0x1f92cd={};_0x1f92cd[_0x1f5da4[_0x68ff('0x2c')]]={'$like':'%'+_0x5d2c7d[_0x68ff('0x35')]['filter']+'%'};return _0x1f92cd;}})});}_0x5359c6=_['merge']({},_0x5359c6,_0x5d2c7d[_0x68ff('0x44')]);var _0x4f9999={'where':_0x5359c6[_0x68ff('0x42')]};return db[_0x68ff('0x30')][_0x68ff('0x21')](_0x4f9999)['then'](function(_0x4aec5d){_0x3b576f[_0x68ff('0x21')]=_0x4aec5d;if(_0x5d2c7d[_0x68ff('0x35')][_0x68ff('0x45')]){_0x5359c6[_0x68ff('0x46')]=[{'all':!![]}];}return db[_0x68ff('0x30')][_0x68ff('0x47')](_0x5359c6);})[_0x68ff('0x28')](function(_0x246417){_0x3b576f[_0x68ff('0x48')]=_0x246417;return _0x3b576f;})[_0x68ff('0x28')](respondWithFilteredResult(_0x13cece,_0x5359c6))[_0x68ff('0x49')](handleError(_0x13cece,null));};exports[_0x68ff('0x4a')]=function(_0x5a5f5c,_0x407eee){var _0x2bf2bc={'raw':!![],'where':{'id':_0x5a5f5c[_0x68ff('0x4b')]['id']}},_0x18957d={};_0x18957d[_0x68ff('0x34')]=_[_0x68ff('0x36')](db[_0x68ff('0x30')]['rawAttributes']);_0x18957d[_0x68ff('0x35')]=_['keys'](_0x5a5f5c[_0x68ff('0x35')]);_0x18957d['filters']=_[_0x68ff('0x39')](_0x18957d[_0x68ff('0x34')],_0x18957d[_0x68ff('0x35')]);_0x2bf2bc[_0x68ff('0x38')]=_[_0x68ff('0x39')](_0x18957d['model'],qs[_0x68ff('0x3a')](_0x5a5f5c[_0x68ff('0x35')]['fields']));_0x2bf2bc['attributes']=_0x2bf2bc[_0x68ff('0x38')][_0x68ff('0x3b')]?_0x2bf2bc['attributes']:_0x18957d['model'];if(_0x5a5f5c[_0x68ff('0x35')][_0x68ff('0x45')]){_0x2bf2bc[_0x68ff('0x46')]=[{'all':!![]}];}_0x2bf2bc=_[_0x68ff('0x43')]({},_0x2bf2bc,_0x5a5f5c['options']);return db[_0x68ff('0x30')][_0x68ff('0x4c')](_0x2bf2bc)['then'](handleEntityNotFound(_0x407eee,null))[_0x68ff('0x28')](respondWithResult(_0x407eee,null))[_0x68ff('0x49')](handleError(_0x407eee,null));};exports[_0x68ff('0x4d')]=function(_0x404cc1,_0x5706af){return db[_0x68ff('0x30')][_0x68ff('0x4d')](_0x404cc1[_0x68ff('0x4e')],{})['then'](respondWithResult(_0x5706af,0xc9))[_0x68ff('0x49')](handleError(_0x5706af,null));};exports[_0x68ff('0x27')]=function(_0x1ede60,_0x125de6){if(_0x1ede60['body']['id']){delete _0x1ede60[_0x68ff('0x4e')]['id'];}return db['SquareRecording'][_0x68ff('0x4c')]({'where':{'id':_0x1ede60[_0x68ff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x125de6,null))[_0x68ff('0x28')](saveUpdates(_0x1ede60[_0x68ff('0x4e')],null))[_0x68ff('0x28')](respondWithResult(_0x125de6,null))[_0x68ff('0x49')](handleError(_0x125de6,null));};exports[_0x68ff('0x4f')]=function(_0x5ba243,_0x4546a8,_0x517823){var _0x7575b4=require(_0x68ff('0x50'));var _0x1d365f=![];var _0x1ac47a={};if(_0x5ba243[_0x68ff('0x35')][_0x68ff('0x33')]&&_0x5ba243[_0x68ff('0x35')][_0x68ff('0x33')]==='uniqueid'){_0x1ac47a[_0x68ff('0x51')]=_0x5ba243['params']['id'];}else{_0x1ac47a['id']=_0x5ba243[_0x68ff('0x4b')]['id'];}return db[_0x68ff('0x30')][_0x68ff('0x4c')]({'where':_0x1ac47a,'attributes':['id',_0x68ff('0x52'),_0x68ff('0x53')],'raw':!![]})[_0x68ff('0x28')](handleEntityNotFound(_0x4546a8,null))[_0x68ff('0x28')](function(_0x422241){if(_0x422241){var _0xdb72d6=_0x422241['savePath'];var _0x511834=util[_0x68ff('0x54')](_0x68ff('0x55'),_0xdb72d6);if(fs[_0x68ff('0x56')](_0x511834)){_0x1d365f=!![];return _0x7575b4[_0x68ff('0x57')](_0x511834,_0xdb72d6,config[_0x68ff('0x58')][_0x68ff('0x59')])[_0x68ff('0x28')](function(){return _0x422241;});}return _0x422241;}})['then'](function(_0x4819ea){if(_0x4819ea){var _0x57632a=_0x4819ea[_0x68ff('0x52')];if(!fs[_0x68ff('0x56')](_0x57632a)){throw new db[(_0x68ff('0x5a'))]['ValidationError'](_0x68ff('0x5b'));}if(_0x4819ea[_0x68ff('0x53')]){return _0x4546a8['download'](_0x57632a,_0x4819ea[_0x68ff('0x53')]+path['extname'](_0x57632a),function(){if(_0x1d365f){fs[_0x68ff('0x5c')](_0x57632a);}});}else{return _0x4546a8[_0x68ff('0x4f')](_0x57632a,function(_0x26e3c8){if(_0x1d365f){fs[_0x68ff('0x5c')](_0x57632a);}});}}})[_0x68ff('0x49')](function(_0x401d4f){if(_0x401d4f[_0x68ff('0x5d')]===_0x68ff('0x5b')){_0x4546a8['status'](0x194)[_0x68ff('0x2d')](_0x68ff('0x5e'));}else{return handleError(_0x4546a8,null);}});};exports[_0x68ff('0x29')]=function(_0x18664e,_0x2a5a82){return db[_0x68ff('0x30')][_0x68ff('0x4c')]({'where':{'id':_0x18664e[_0x68ff('0x4b')]['id']}})[_0x68ff('0x28')](function(_0x42a32f){if(_[_0x68ff('0x5f')](_0x42a32f)){throw new ReferenceError(_0x68ff('0x60'));}return _0x42a32f;})['then'](function(_0x51650b){var _0x4f0794=_0x51650b[_0x68ff('0x52')];logger[_0x68ff('0x61')](_0x68ff('0x62'),_0x4f0794);if(!_[_0x68ff('0x5f')](_0x51650b[_0x68ff('0x52')])&&fs[_0x68ff('0x56')](_0x4f0794)){logger[_0x68ff('0x61')](_0x68ff('0x63')+_0x4f0794+_0x68ff('0x64'));fs[_0x68ff('0x65')](_0x4f0794);}_0x4f0794=_0x4f0794+_0x68ff('0x66');if(!_[_0x68ff('0x5f')](_0x51650b[_0x68ff('0x52')])&&fs[_0x68ff('0x56')](_0x4f0794)){logger[_0x68ff('0x61')](_0x68ff('0x63')+_0x4f0794+_0x68ff('0x64'));fs['unlinkSync'](_0x4f0794);}return _0x51650b;})[_0x68ff('0x28')](function(_0x5064ae){if(!_0x5064ae)throw new InternalError();return _0x5064ae[_0x68ff('0x29')]();})[_0x68ff('0x28')](function(){_0x2a5a82[_0x68ff('0x1b')](0xcc)['end']();})[_0x68ff('0x49')](handleError(_0x2a5a82,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a3d65b5..4bf9bf3 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 _0x6829=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','bluebird','request-promise'];(function(_0x3b18bb,_0x496cbf){var _0x566885=function(_0x3c85f3){while(--_0x3c85f3){_0x3b18bb['push'](_0x3b18bb['shift']());}};_0x566885(++_0x496cbf);}(_0x6829,0x14c));var _0x9682=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6829[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9682('0x2'));var rp=require(_0x9682('0x3'));var fs=require('fs');var path=require(_0x9682('0x4'));var rimraf=require(_0x9682('0x5'));var config=require(_0x9682('0x6'));var attributes=require(_0x9682('0x7'));module[_0x9682('0x8')]=function(_0x1e6fe8,_0x19b909){return _0x1e6fe8[_0x9682('0x9')](_0x9682('0xa'),attributes,{'tableName':_0x9682('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb242=['./squareRecording.attributes','exports','define','SquareRecording','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x467c5f,_0x425c09){var _0x5e262a=function(_0xe84b75){while(--_0xe84b75){_0x467c5f['push'](_0x467c5f['shift']());}};_0x5e262a(++_0x425c09);}(_0xb242,0x1f3));var _0x2b24=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xb242[_0x2fc012];return _0x2891f9;};'use strict';var _=require('lodash');var util=require(_0x2b24('0x0'));var logger=require(_0x2b24('0x1'))(_0x2b24('0x2'));var moment=require(_0x2b24('0x3'));var BPromise=require(_0x2b24('0x4'));var rp=require(_0x2b24('0x5'));var fs=require('fs');var path=require(_0x2b24('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b24('0x7'));module[_0x2b24('0x8')]=function(_0x5c1f57,_0x341c66){return _0x5c1f57[_0x2b24('0x9')](_0x2b24('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 10230af..0f697cd 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 _0x80bd=['request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x5454e1,_0x2a14f3){var _0xa31794=function(_0x5710a6){while(--_0x5710a6){_0x5454e1['push'](_0x5454e1['shift']());}};_0xa31794(++_0x2a14f3);}(_0x80bd,0x1bf));var _0xd80b=function(_0x38135c,_0x788456){_0x38135c=_0x38135c-0x0;var _0x1275b6=_0x80bd[_0x38135c];return _0x1275b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd80b('0x0'));var BPromise=require(_0xd80b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd80b('0x2'));var db=require(_0xd80b('0x3'))['db'];var utils=require(_0xd80b('0x4'));var logger=require(_0xd80b('0x5'))('rpc');var config=require(_0xd80b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd80b('0x7')][_0xd80b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c4bef,_0x1e05c9,_0x44dbce){return new BPromise(function(_0x121021,_0x311536){return client[_0xd80b('0x9')](_0x1c4bef,_0x44dbce)[_0xd80b('0xa')](function(_0x3a590c){logger[_0xd80b('0xb')]('SquareRecording,\x20%s,\x20%s',_0x1e05c9,_0xd80b('0xc'));logger['debug'](_0xd80b('0xd'),_0x1e05c9,_0xd80b('0xc'),JSON[_0xd80b('0xe')](_0x3a590c));if(_0x3a590c['error']){if(_0x3a590c[_0xd80b('0xf')][_0xd80b('0x10')]===0x1f4){logger[_0xd80b('0xf')](_0xd80b('0x11'),_0x1e05c9,_0x3a590c[_0xd80b('0xf')][_0xd80b('0x12')]);return _0x311536(_0x3a590c[_0xd80b('0xf')]['message']);}logger[_0xd80b('0xf')](_0xd80b('0x11'),_0x1e05c9,_0x3a590c[_0xd80b('0xf')][_0xd80b('0x12')]);return _0x121021(_0x3a590c[_0xd80b('0xf')]['message']);}else{logger[_0xd80b('0xb')]('SquareRecording,\x20%s,\x20%s',_0x1e05c9,_0xd80b('0xc'));_0x121021(_0x3a590c[_0xd80b('0x13')]['message']);}})[_0xd80b('0x14')](function(_0x4de50a){logger[_0xd80b('0xf')](_0xd80b('0x11'),_0x1e05c9,_0x4de50a);_0x311536(_0x4de50a);});});}exports['CreateSquareRecording']=function(_0x5a7322){var _0x149676=this;return new Promise(function(_0x220a1b,_0x3240e0){return db[_0xd80b('0x15')][_0xd80b('0x16')](_0x5a7322[_0xd80b('0x17')],{'raw':_0x5a7322[_0xd80b('0x18')]?_0x5a7322[_0xd80b('0x18')][_0xd80b('0x19')]===undefined?!![]:![]:!![]})[_0xd80b('0xa')](function(_0x24f3c9){logger[_0xd80b('0xb')]('CreateSquareRecording',_0x5a7322);logger['debug'](_0xd80b('0x1a'),_0x5a7322,JSON[_0xd80b('0xe')](_0x24f3c9));_0x220a1b(_0x24f3c9);})['catch'](function(_0x38c946){logger['error'](_0xd80b('0x1a'),_0x38c946['message'],_0x5a7322);_0x3240e0(_0x149676[_0xd80b('0xf')](0x1f4,_0x38c946[_0xd80b('0x12')]));});});}; \ No newline at end of file +var _0xedbf=['moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareRecording','create','body','options','lodash','util'];(function(_0x311d70,_0x38455d){var _0x4e6a9a=function(_0x13db45){while(--_0x13db45){_0x311d70['push'](_0x311d70['shift']());}};_0x4e6a9a(++_0x38455d);}(_0xedbf,0x7b));var _0xfedb=function(_0x42b7b3,_0x2e0015){_0x42b7b3=_0x42b7b3-0x0;var _0x4284e7=_0xedbf[_0x42b7b3];return _0x4284e7;};'use strict';var _=require(_0xfedb('0x0'));var util=require(_0xfedb('0x1'));var moment=require(_0xfedb('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(_0xfedb('0x3'));var logger=require(_0xfedb('0x4'))('rpc');var config=require(_0xfedb('0x5'));var jayson=require(_0xfedb('0x6'));var client=jayson[_0xfedb('0x7')][_0xfedb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2cc21f,_0x3cfb72,_0x25c656){return new BPromise(function(_0x4f3386,_0xacb818){return client[_0xfedb('0x9')](_0x2cc21f,_0x25c656)[_0xfedb('0xa')](function(_0x3a001a){logger[_0xfedb('0xb')](_0xfedb('0xc'),_0x3cfb72,_0xfedb('0xd'));logger[_0xfedb('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3cfb72,_0xfedb('0xd'),JSON[_0xfedb('0xf')](_0x3a001a));if(_0x3a001a[_0xfedb('0x10')]){if(_0x3a001a[_0xfedb('0x10')][_0xfedb('0x11')]===0x1f4){logger[_0xfedb('0x10')](_0xfedb('0xc'),_0x3cfb72,_0x3a001a['error'][_0xfedb('0x12')]);return _0xacb818(_0x3a001a[_0xfedb('0x10')][_0xfedb('0x12')]);}logger[_0xfedb('0x10')](_0xfedb('0xc'),_0x3cfb72,_0x3a001a['error'][_0xfedb('0x12')]);return _0x4f3386(_0x3a001a[_0xfedb('0x10')][_0xfedb('0x12')]);}else{logger[_0xfedb('0xb')](_0xfedb('0xc'),_0x3cfb72,'request\x20sent');_0x4f3386(_0x3a001a[_0xfedb('0x13')][_0xfedb('0x12')]);}})[_0xfedb('0x14')](function(_0xb5c704){logger[_0xfedb('0x10')](_0xfedb('0xc'),_0x3cfb72,_0xb5c704);_0xacb818(_0xb5c704);});});}exports[_0xfedb('0x15')]=function(_0x148e14){var _0x2d1eda=this;return new Promise(function(_0x33be0e,_0xb075ad){return db['SquareRecording'][_0xfedb('0x16')](_0x148e14[_0xfedb('0x17')],{'raw':_0x148e14[_0xfedb('0x18')]?_0x148e14[_0xfedb('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xfedb('0xa')](function(_0x5c31bf){logger[_0xfedb('0xb')](_0xfedb('0x15'),_0x148e14);logger[_0xfedb('0xe')]('CreateSquareRecording',_0x148e14,JSON[_0xfedb('0xf')](_0x5c31bf));_0x33be0e(_0x5c31bf);})[_0xfedb('0x14')](function(_0x1d7582){logger[_0xfedb('0x10')](_0xfedb('0x15'),_0x1d7582[_0xfedb('0x12')],_0x148e14);_0xb075ad(_0x2d1eda[_0xfedb('0x10')](0x1f4,_0x1d7582['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 900c580..e673c4a 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(_0x46457e,_0x411685){var _0x838de8=function(_0x4b56d1){while(--_0x4b56d1){_0x46457e['push'](_0x46457e['shift']());}};_0x838de8(++_0x411685);}(_0xe706,0xa3));var _0x6e70=function(_0x524021,_0x25d5ea){_0x524021=_0x524021-0x0;var _0x269c3e=_0xe706[_0x524021];return _0x269c3e;};'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 _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(_0x2cdcf9,_0x8a09d1){var _0x39412d=function(_0x7b476e){while(--_0x7b476e){_0x2cdcf9['push'](_0x2cdcf9['shift']());}};_0x39412d(++_0x8a09d1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c74970e..673a119 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 _0x16c1=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2d5e73,_0x5af37d){var _0x46bfe5=function(_0x28a4c8){while(--_0x28a4c8){_0x2d5e73['push'](_0x2d5e73['shift']());}};_0x46bfe5(++_0x5af37d);}(_0x16c1,0x195));var _0x116c=function(_0x58d63c,_0x34c6a4){_0x58d63c=_0x58d63c-0x0;var _0x18e6e4=_0x16c1[_0x58d63c];return _0x18e6e4;};'use strict';var Sequelize=require(_0x116c('0x0'));module[_0x116c('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x116c('0x2')]},'language':{'type':Sequelize[_0x116c('0x2')]},'type':{'type':Sequelize[_0x116c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x116c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x116c('0x2')]},'callingpres':{'type':Sequelize[_0x116c('0x2')]},'callingani2':{'type':Sequelize[_0x116c('0x2')]},'callington':{'type':Sequelize[_0x116c('0x2')]},'callingtns':{'type':Sequelize[_0x116c('0x2')]},'dnid':{'type':Sequelize[_0x116c('0x2')]},'rdnis':{'type':Sequelize[_0x116c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x116c('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x116c('0x2')]},'accountcode':{'type':Sequelize[_0x116c('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x116c('0x3')]},'leaveAt':{'type':Sequelize[_0x116c('0x3')]},'bot':{'type':Sequelize[_0x116c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf956=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf956,0x7a));var _0x6f95=function(_0x50afb6,_0x3069fa){_0x50afb6=_0x50afb6-0x0;var _0x4f7385=_0xf956[_0x50afb6];return _0x4f7385;};'use strict';var Sequelize=require(_0x6f95('0x0'));module[_0x6f95('0x1')]={'network':{'type':Sequelize[_0x6f95('0x2')]},'network_script':{'type':Sequelize[_0x6f95('0x2')]},'request':{'type':Sequelize[_0x6f95('0x2')]},'channel':{'type':Sequelize[_0x6f95('0x2')]},'language':{'type':Sequelize[_0x6f95('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6f95('0x2')]},'version':{'type':Sequelize[_0x6f95('0x2')]},'callerid':{'type':Sequelize[_0x6f95('0x2')]},'calleridname':{'type':Sequelize[_0x6f95('0x2')]},'callingpres':{'type':Sequelize[_0x6f95('0x2')]},'callingani2':{'type':Sequelize[_0x6f95('0x2')]},'callington':{'type':Sequelize[_0x6f95('0x2')]},'callingtns':{'type':Sequelize[_0x6f95('0x2')]},'dnid':{'type':Sequelize[_0x6f95('0x2')]},'rdnis':{'type':Sequelize[_0x6f95('0x2')]},'context':{'type':Sequelize[_0x6f95('0x2')]},'extension':{'type':Sequelize[_0x6f95('0x2')]},'priority':{'type':Sequelize[_0x6f95('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6f95('0x2')]},'threadid':{'type':Sequelize[_0x6f95('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6f95('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6f95('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 b1d669e..eb9880a 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 _0x2409=['length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','SquareReport','include','findAll','catch','show','params','fields','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x12312e,_0x2a7080){var _0x2cbcd1=function(_0x1c1c69){while(--_0x1c1c69){_0x12312e['push'](_0x12312e['shift']());}};_0x2cbcd1(++_0x2a7080);}(_0x2409,0x69));var _0x9240=function(_0x3356ad,_0x3df2c0){_0x3356ad=_0x3356ad-0x0;var _0x3cecec=_0x2409[_0x3356ad];return _0x3cecec;};'use strict';var emlformat=require(_0x9240('0x0'));var rimraf=require(_0x9240('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9240('0x2'));var rp=require('request-promise');var moment=require(_0x9240('0x3'));var BPromise=require(_0x9240('0x4'));var Mustache=require(_0x9240('0x5'));var util=require(_0x9240('0x6'));var path=require('path');var sox=require(_0x9240('0x7'));var csv=require(_0x9240('0x8'));var ejs=require(_0x9240('0x9'));var fs=require('fs');var fs_extra=require(_0x9240('0xa'));var _=require(_0x9240('0xb'));var squel=require(_0x9240('0xc'));var crypto=require(_0x9240('0xd'));var jsforce=require(_0x9240('0xe'));var deskjs=require(_0x9240('0xf'));var toCsv=require(_0x9240('0x8'));var querystring=require('querystring');var Papa=require(_0x9240('0x10'));var Redis=require(_0x9240('0x11'));var authService=require(_0x9240('0x12'));var qs=require(_0x9240('0x13'));var as=require(_0x9240('0x14'));var hardwareService=require(_0x9240('0x15'));var logger=require(_0x9240('0x16'))('api');var utils=require(_0x9240('0x17'));var config=require(_0x9240('0x18'));var licenseUtil=require(_0x9240('0x19'));var db=require(_0x9240('0x1a'))['db'];function respondWithStatusCode(_0x2ae49d,_0x11aaf3){_0x11aaf3=_0x11aaf3||0xcc;return function(_0x3a457a){if(_0x3a457a){return _0x2ae49d[_0x9240('0x1b')](_0x11aaf3);}return _0x2ae49d[_0x9240('0x1c')](_0x11aaf3)[_0x9240('0x1d')]();};}function respondWithResult(_0x181dd1,_0x247a0f){_0x247a0f=_0x247a0f||0xc8;return function(_0x460f3d){if(_0x460f3d){return _0x181dd1['status'](_0x247a0f)[_0x9240('0x1e')](_0x460f3d);}};}function respondWithFilteredResult(_0x3463fa,_0x110bdc){return function(_0x1b0a92){if(_0x1b0a92){var _0x1a7860=typeof _0x110bdc['offset']===_0x9240('0x1f')&&typeof _0x110bdc['limit']===_0x9240('0x1f');var _0x2b71a4=_0x1b0a92['count'];var _0x24d00d=_0x1a7860?0x0:_0x110bdc['offset'];var _0x2101f1=_0x1a7860?_0x1b0a92[_0x9240('0x20')]:_0x110bdc[_0x9240('0x21')]+_0x110bdc[_0x9240('0x22')];var _0x47bdf4;if(_0x2101f1>=_0x2b71a4){_0x2101f1=_0x2b71a4;_0x47bdf4=0xc8;}else{_0x47bdf4=0xce;}_0x3463fa[_0x9240('0x1c')](_0x47bdf4);return _0x3463fa[_0x9240('0x23')](_0x9240('0x24'),_0x24d00d+'-'+_0x2101f1+'/'+_0x2b71a4)[_0x9240('0x1e')](_0x1b0a92);}return null;};}function patchUpdates(_0x388446){return function(_0x212765){try{jsonpatch[_0x9240('0x25')](_0x212765,_0x388446,!![]);}catch(_0xd2dd13){return BPromise[_0x9240('0x26')](_0xd2dd13);}return _0x212765[_0x9240('0x27')]();};}function saveUpdates(_0x48b6dc,_0x293cda){return function(_0x105878){if(_0x105878){return _0x105878[_0x9240('0x28')](_0x48b6dc)[_0x9240('0x29')](function(_0x58276c){return _0x58276c;});}return null;};}function removeEntity(_0x45c6c7,_0x105c27){return function(_0x56d664){if(_0x56d664){return _0x56d664[_0x9240('0x2a')]()['then'](function(){_0x45c6c7[_0x9240('0x1c')](0xcc)[_0x9240('0x1d')]();});}};}function handleEntityNotFound(_0x354c3e,_0x37e3d3){return function(_0x3c747d){if(!_0x3c747d){_0x354c3e[_0x9240('0x1b')](0x194);}return _0x3c747d;};}function handleError(_0x1eca55,_0x2746b6){_0x2746b6=_0x2746b6||0x1f4;return function(_0xc70dfc){logger[_0x9240('0x2b')](_0xc70dfc[_0x9240('0x2c')]);if(_0xc70dfc[_0x9240('0x2d')]){delete _0xc70dfc['name'];}_0x1eca55[_0x9240('0x1c')](_0x2746b6)['send'](_0xc70dfc);};}exports[_0x9240('0x2e')]=function(_0x422f2f,_0x1156e9){var _0xe8e2c4={},_0x235c1d={},_0x369da0={'count':0x0,'rows':[]};var _0x4ab6c0=_[_0x9240('0x2f')](db['SquareReport'][_0x9240('0x30')],function(_0x1cde2e){return{'name':_0x1cde2e[_0x9240('0x31')],'type':_0x1cde2e[_0x9240('0x32')][_0x9240('0x33')]};});_0x235c1d[_0x9240('0x34')]=_[_0x9240('0x2f')](_0x4ab6c0,_0x9240('0x2d'));_0x235c1d[_0x9240('0x35')]=_[_0x9240('0x36')](_0x422f2f[_0x9240('0x35')]);_0x235c1d['filters']=_[_0x9240('0x37')](_0x235c1d[_0x9240('0x34')],_0x235c1d[_0x9240('0x35')]);_0xe8e2c4['attributes']=_['intersection'](_0x235c1d['model'],qs['fields'](_0x422f2f['query']['fields']));_0xe8e2c4[_0x9240('0x38')]=_0xe8e2c4[_0x9240('0x38')][_0x9240('0x39')]?_0xe8e2c4[_0x9240('0x38')]:_0x235c1d[_0x9240('0x34')];if(!_0x422f2f[_0x9240('0x35')][_0x9240('0x3a')](_0x9240('0x3b'))){_0xe8e2c4[_0x9240('0x22')]=qs[_0x9240('0x22')](_0x422f2f['query'][_0x9240('0x22')]);_0xe8e2c4[_0x9240('0x21')]=qs[_0x9240('0x21')](_0x422f2f['query'][_0x9240('0x21')]);}_0xe8e2c4[_0x9240('0x3c')]=qs['sort'](_0x422f2f[_0x9240('0x35')][_0x9240('0x3d')]);_0xe8e2c4['where']=qs['filters'](_[_0x9240('0x3e')](_0x422f2f[_0x9240('0x35')],_0x235c1d[_0x9240('0x3f')]),_0x4ab6c0);if(_0x422f2f[_0x9240('0x35')][_0x9240('0x40')]){_0xe8e2c4[_0x9240('0x41')]=_[_0x9240('0x42')](_0xe8e2c4[_0x9240('0x41')],{'$or':_[_0x9240('0x2f')](_0x4ab6c0,function(_0x295145){if(_0x295145['type']!==_0x9240('0x43')){var _0x2207ff={};_0x2207ff[_0x295145[_0x9240('0x2d')]]={'$like':'%'+_0x422f2f['query'][_0x9240('0x40')]+'%'};return _0x2207ff;}})});}_0xe8e2c4=_[_0x9240('0x42')]({},_0xe8e2c4,_0x422f2f[_0x9240('0x44')]);var _0x36fb14={'where':_0xe8e2c4[_0x9240('0x41')]};return db[_0x9240('0x45')][_0x9240('0x20')](_0x36fb14)['then'](function(_0x2dfd4e){_0x369da0[_0x9240('0x20')]=_0x2dfd4e;if(_0x422f2f[_0x9240('0x35')]['includeAll']){_0xe8e2c4[_0x9240('0x46')]=[{'all':!![]}];}return db['SquareReport'][_0x9240('0x47')](_0xe8e2c4);})[_0x9240('0x29')](function(_0x3de2b4){_0x369da0['rows']=_0x3de2b4;return _0x369da0;})['then'](respondWithFilteredResult(_0x1156e9,_0xe8e2c4))[_0x9240('0x48')](handleError(_0x1156e9,null));};exports[_0x9240('0x49')]=function(_0x2512a3,_0x299a0f){var _0x5c9e8f={'raw':!![],'where':{'id':_0x2512a3[_0x9240('0x4a')]['id']}},_0x23a96d={};_0x23a96d[_0x9240('0x34')]=_['keys'](db[_0x9240('0x45')][_0x9240('0x30')]);_0x23a96d['query']=_['keys'](_0x2512a3['query']);_0x23a96d[_0x9240('0x3f')]=_[_0x9240('0x37')](_0x23a96d[_0x9240('0x34')],_0x23a96d[_0x9240('0x35')]);_0x5c9e8f[_0x9240('0x38')]=_[_0x9240('0x37')](_0x23a96d[_0x9240('0x34')],qs[_0x9240('0x4b')](_0x2512a3[_0x9240('0x35')]['fields']));_0x5c9e8f[_0x9240('0x38')]=_0x5c9e8f[_0x9240('0x38')][_0x9240('0x39')]?_0x5c9e8f['attributes']:_0x23a96d[_0x9240('0x34')];if(_0x2512a3[_0x9240('0x35')][_0x9240('0x4c')]){_0x5c9e8f['include']=[{'all':!![]}];}_0x5c9e8f=_[_0x9240('0x42')]({},_0x5c9e8f,_0x2512a3[_0x9240('0x44')]);return db[_0x9240('0x45')][_0x9240('0x4d')](_0x5c9e8f)[_0x9240('0x29')](handleEntityNotFound(_0x299a0f,null))[_0x9240('0x29')](respondWithResult(_0x299a0f,null))['catch'](handleError(_0x299a0f,null));};exports[_0x9240('0x4e')]=function(_0xf0ecba,_0x5118d9){return db[_0x9240('0x45')][_0x9240('0x4e')](_0xf0ecba[_0x9240('0x4f')],{})[_0x9240('0x29')](respondWithResult(_0x5118d9,0xc9))[_0x9240('0x48')](handleError(_0x5118d9,null));};exports['update']=function(_0x509b88,_0x20cbb9){if(_0x509b88[_0x9240('0x4f')]['id']){delete _0x509b88[_0x9240('0x4f')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x509b88[_0x9240('0x4a')]['id']}})[_0x9240('0x29')](handleEntityNotFound(_0x20cbb9,null))[_0x9240('0x29')](saveUpdates(_0x509b88[_0x9240('0x4f')],null))[_0x9240('0x29')](respondWithResult(_0x20cbb9,null))[_0x9240('0x48')](handleError(_0x20cbb9,null));};exports[_0x9240('0x2a')]=function(_0x69a380,_0x182fec){return db[_0x9240('0x45')][_0x9240('0x4d')]({'where':{'id':_0x69a380[_0x9240('0x4a')]['id']}})[_0x9240('0x29')](handleEntityNotFound(_0x182fec,null))[_0x9240('0x29')](removeEntity(_0x182fec,null))[_0x9240('0x48')](handleError(_0x182fec,null));};exports[_0x9240('0x50')]=function(_0xa602f6,_0x2c44d1){return db['SquareReport'][_0x9240('0x50')]()[_0x9240('0x29')](respondWithResult(_0x2c44d1,null))['catch'](handleError(_0x2c44d1,null));}; \ No newline at end of file +var _0xfe2f=['map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index'];(function(_0x2fad8a,_0x26de69){var _0x494d7d=function(_0x52fe59){while(--_0x52fe59){_0x2fad8a['push'](_0x2fad8a['shift']());}};_0x494d7d(++_0x26de69);}(_0xfe2f,0xb8));var _0xffe2=function(_0x448489,_0x9ff6cf){_0x448489=_0x448489-0x0;var _0x3e013c=_0xfe2f[_0x448489];return _0x3e013c;};'use strict';var emlformat=require(_0xffe2('0x0'));var rimraf=require(_0xffe2('0x1'));var zipdir=require(_0xffe2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffe2('0x3'));var moment=require('moment');var BPromise=require(_0xffe2('0x4'));var Mustache=require(_0xffe2('0x5'));var util=require(_0xffe2('0x6'));var path=require(_0xffe2('0x7'));var sox=require(_0xffe2('0x8'));var csv=require(_0xffe2('0x9'));var ejs=require(_0xffe2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffe2('0xb'));var squel=require(_0xffe2('0xc'));var crypto=require('crypto');var jsforce=require(_0xffe2('0xd'));var deskjs=require(_0xffe2('0xe'));var toCsv=require(_0xffe2('0x9'));var querystring=require(_0xffe2('0xf'));var Papa=require(_0xffe2('0x10'));var Redis=require(_0xffe2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xffe2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffe2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xffe2('0x14'));var config=require(_0xffe2('0x15'));var licenseUtil=require(_0xffe2('0x16'));var db=require(_0xffe2('0x17'))['db'];function respondWithStatusCode(_0x5df75e,_0x316d5f){_0x316d5f=_0x316d5f||0xcc;return function(_0x3da39b){if(_0x3da39b){return _0x5df75e[_0xffe2('0x18')](_0x316d5f);}return _0x5df75e[_0xffe2('0x19')](_0x316d5f)[_0xffe2('0x1a')]();};}function respondWithResult(_0xcaaf12,_0x1a0629){_0x1a0629=_0x1a0629||0xc8;return function(_0x3b23a8){if(_0x3b23a8){return _0xcaaf12['status'](_0x1a0629)[_0xffe2('0x1b')](_0x3b23a8);}};}function respondWithFilteredResult(_0x2d4d9c,_0x28670c){return function(_0x211ac5){if(_0x211ac5){var _0x1c9fde=typeof _0x28670c[_0xffe2('0x1c')]===_0xffe2('0x1d')&&typeof _0x28670c[_0xffe2('0x1e')]===_0xffe2('0x1d');var _0x5c7461=_0x211ac5[_0xffe2('0x1f')];var _0x510150=_0x1c9fde?0x0:_0x28670c[_0xffe2('0x1c')];var _0x281b75=_0x1c9fde?_0x211ac5[_0xffe2('0x1f')]:_0x28670c[_0xffe2('0x1c')]+_0x28670c[_0xffe2('0x1e')];var _0x3d1722;if(_0x281b75>=_0x5c7461){_0x281b75=_0x5c7461;_0x3d1722=0xc8;}else{_0x3d1722=0xce;}_0x2d4d9c['status'](_0x3d1722);return _0x2d4d9c[_0xffe2('0x20')](_0xffe2('0x21'),_0x510150+'-'+_0x281b75+'/'+_0x5c7461)[_0xffe2('0x1b')](_0x211ac5);}return null;};}function patchUpdates(_0x148747){return function(_0x167815){try{jsonpatch[_0xffe2('0x22')](_0x167815,_0x148747,!![]);}catch(_0x47b81f){return BPromise[_0xffe2('0x23')](_0x47b81f);}return _0x167815['save']();};}function saveUpdates(_0x318277,_0xbdf2e2){return function(_0x3900b3){if(_0x3900b3){return _0x3900b3[_0xffe2('0x24')](_0x318277)[_0xffe2('0x25')](function(_0x5a560d){return _0x5a560d;});}return null;};}function removeEntity(_0x5eefc4,_0x37e8f2){return function(_0xeabc1e){if(_0xeabc1e){return _0xeabc1e[_0xffe2('0x26')]()[_0xffe2('0x25')](function(){_0x5eefc4[_0xffe2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49cb6d,_0x507ea5){return function(_0x5d5eee){if(!_0x5d5eee){_0x49cb6d[_0xffe2('0x18')](0x194);}return _0x5d5eee;};}function handleError(_0x39c917,_0x2d2448){_0x2d2448=_0x2d2448||0x1f4;return function(_0x4cb540){logger[_0xffe2('0x27')](_0x4cb540[_0xffe2('0x28')]);if(_0x4cb540['name']){delete _0x4cb540[_0xffe2('0x29')];}_0x39c917[_0xffe2('0x19')](_0x2d2448)[_0xffe2('0x2a')](_0x4cb540);};}exports[_0xffe2('0x2b')]=function(_0x1036f1,_0x5f1580){var _0x31db5a={},_0x4326bd={},_0x2b26a9={'count':0x0,'rows':[]};var _0x31bb87=_[_0xffe2('0x2c')](db[_0xffe2('0x2d')][_0xffe2('0x2e')],function(_0x1b6aab){return{'name':_0x1b6aab[_0xffe2('0x2f')],'type':_0x1b6aab[_0xffe2('0x30')][_0xffe2('0x31')]};});_0x4326bd[_0xffe2('0x32')]=_[_0xffe2('0x2c')](_0x31bb87,'name');_0x4326bd[_0xffe2('0x33')]=_[_0xffe2('0x34')](_0x1036f1['query']);_0x4326bd[_0xffe2('0x35')]=_[_0xffe2('0x36')](_0x4326bd[_0xffe2('0x32')],_0x4326bd[_0xffe2('0x33')]);_0x31db5a[_0xffe2('0x37')]=_['intersection'](_0x4326bd[_0xffe2('0x32')],qs[_0xffe2('0x38')](_0x1036f1[_0xffe2('0x33')][_0xffe2('0x38')]));_0x31db5a[_0xffe2('0x37')]=_0x31db5a['attributes'][_0xffe2('0x39')]?_0x31db5a[_0xffe2('0x37')]:_0x4326bd[_0xffe2('0x32')];if(!_0x1036f1[_0xffe2('0x33')][_0xffe2('0x3a')]('nolimit')){_0x31db5a['limit']=qs[_0xffe2('0x1e')](_0x1036f1[_0xffe2('0x33')][_0xffe2('0x1e')]);_0x31db5a[_0xffe2('0x1c')]=qs['offset'](_0x1036f1[_0xffe2('0x33')][_0xffe2('0x1c')]);}_0x31db5a['order']=qs[_0xffe2('0x3b')](_0x1036f1[_0xffe2('0x33')][_0xffe2('0x3b')]);_0x31db5a[_0xffe2('0x3c')]=qs['filters'](_['pick'](_0x1036f1[_0xffe2('0x33')],_0x4326bd[_0xffe2('0x35')]),_0x31bb87);if(_0x1036f1['query'][_0xffe2('0x3d')]){_0x31db5a['where']=_[_0xffe2('0x3e')](_0x31db5a[_0xffe2('0x3c')],{'$or':_[_0xffe2('0x2c')](_0x31bb87,function(_0x5dcde1){if(_0x5dcde1[_0xffe2('0x30')]!==_0xffe2('0x3f')){var _0x27e494={};_0x27e494[_0x5dcde1[_0xffe2('0x29')]]={'$like':'%'+_0x1036f1['query']['filter']+'%'};return _0x27e494;}})});}_0x31db5a=_[_0xffe2('0x3e')]({},_0x31db5a,_0x1036f1[_0xffe2('0x40')]);var _0x213b0a={'where':_0x31db5a['where']};return db[_0xffe2('0x2d')][_0xffe2('0x1f')](_0x213b0a)[_0xffe2('0x25')](function(_0x4005ed){_0x2b26a9['count']=_0x4005ed;if(_0x1036f1[_0xffe2('0x33')][_0xffe2('0x41')]){_0x31db5a[_0xffe2('0x42')]=[{'all':!![]}];}return db['SquareReport'][_0xffe2('0x43')](_0x31db5a);})[_0xffe2('0x25')](function(_0x26d78d){_0x2b26a9[_0xffe2('0x44')]=_0x26d78d;return _0x2b26a9;})[_0xffe2('0x25')](respondWithFilteredResult(_0x5f1580,_0x31db5a))[_0xffe2('0x45')](handleError(_0x5f1580,null));};exports[_0xffe2('0x46')]=function(_0x23845f,_0xa103cf){var _0x471ef9={'raw':!![],'where':{'id':_0x23845f[_0xffe2('0x47')]['id']}},_0x151270={};_0x151270[_0xffe2('0x32')]=_[_0xffe2('0x34')](db['SquareReport']['rawAttributes']);_0x151270['query']=_['keys'](_0x23845f[_0xffe2('0x33')]);_0x151270[_0xffe2('0x35')]=_[_0xffe2('0x36')](_0x151270[_0xffe2('0x32')],_0x151270[_0xffe2('0x33')]);_0x471ef9['attributes']=_[_0xffe2('0x36')](_0x151270[_0xffe2('0x32')],qs[_0xffe2('0x38')](_0x23845f['query'][_0xffe2('0x38')]));_0x471ef9[_0xffe2('0x37')]=_0x471ef9[_0xffe2('0x37')][_0xffe2('0x39')]?_0x471ef9[_0xffe2('0x37')]:_0x151270['model'];if(_0x23845f[_0xffe2('0x33')]['includeAll']){_0x471ef9[_0xffe2('0x42')]=[{'all':!![]}];}_0x471ef9=_['merge']({},_0x471ef9,_0x23845f[_0xffe2('0x40')]);return db['SquareReport']['find'](_0x471ef9)['then'](handleEntityNotFound(_0xa103cf,null))[_0xffe2('0x25')](respondWithResult(_0xa103cf,null))[_0xffe2('0x45')](handleError(_0xa103cf,null));};exports['create']=function(_0x4dde25,_0x2cf266){return db['SquareReport'][_0xffe2('0x48')](_0x4dde25[_0xffe2('0x49')],{})[_0xffe2('0x25')](respondWithResult(_0x2cf266,0xc9))[_0xffe2('0x45')](handleError(_0x2cf266,null));};exports['update']=function(_0x28410c,_0xeea539){if(_0x28410c['body']['id']){delete _0x28410c[_0xffe2('0x49')]['id'];}return db[_0xffe2('0x2d')][_0xffe2('0x4a')]({'where':{'id':_0x28410c['params']['id']}})[_0xffe2('0x25')](handleEntityNotFound(_0xeea539,null))[_0xffe2('0x25')](saveUpdates(_0x28410c[_0xffe2('0x49')],null))[_0xffe2('0x25')](respondWithResult(_0xeea539,null))[_0xffe2('0x45')](handleError(_0xeea539,null));};exports[_0xffe2('0x26')]=function(_0x20a81b,_0x2a74b2){return db[_0xffe2('0x2d')][_0xffe2('0x4a')]({'where':{'id':_0x20a81b['params']['id']}})[_0xffe2('0x25')](handleEntityNotFound(_0x2a74b2,null))['then'](removeEntity(_0x2a74b2,null))[_0xffe2('0x45')](handleError(_0x2a74b2,null));};exports[_0xffe2('0x4b')]=function(_0x3e0789,_0x21b2aa){return db['SquareReport'][_0xffe2('0x4b')]()[_0xffe2('0x25')](respondWithResult(_0x21b2aa,null))[_0xffe2('0x45')](handleError(_0x21b2aa,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index d1ddcdf..d75b5a3 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 _0x7d51=['uid_pname','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0x7d51,0x14c));var _0x17d5=function(_0x443989,_0x14b1b5){_0x443989=_0x443989-0x0;var _0x479edd=_0x7d51[_0x443989];return _0x479edd;};'use strict';var _=require(_0x17d5('0x0'));var util=require(_0x17d5('0x1'));var logger=require(_0x17d5('0x2'))('api');var moment=require(_0x17d5('0x3'));var BPromise=require(_0x17d5('0x4'));var rp=require(_0x17d5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17d5('0x6'));var config=require(_0x17d5('0x7'));var attributes=require(_0x17d5('0x8'));module[_0x17d5('0x9')]=function(_0x45b0eb,_0xa43308){return _0x45b0eb[_0x17d5('0xa')](_0x17d5('0xb'),attributes,{'tableName':_0x17d5('0xc'),'paranoid':![],'indexes':[{'name':_0x17d5('0xd'),'fields':['uniqueid','project_name']},{'name':_0x17d5('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8393=['uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square'];(function(_0x24dfb7,_0x2bf1bf){var _0x525851=function(_0xa8a946){while(--_0xa8a946){_0x24dfb7['push'](_0x24dfb7['shift']());}};_0x525851(++_0x2bf1bf);}(_0x8393,0x1f4));var _0x3839=function(_0x5e013c,_0x4e5149){_0x5e013c=_0x5e013c-0x0;var _0x2b5eca=_0x8393[_0x5e013c];return _0x2b5eca;};'use strict';var _=require(_0x3839('0x0'));var util=require(_0x3839('0x1'));var logger=require(_0x3839('0x2'))('api');var moment=require(_0x3839('0x3'));var BPromise=require('bluebird');var rp=require(_0x3839('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3839('0x5'));var config=require(_0x3839('0x6'));var attributes=require(_0x3839('0x7'));module[_0x3839('0x8')]=function(_0x38a0ee,_0x553233){return _0x38a0ee[_0x3839('0x9')](_0x3839('0xa'),attributes,{'tableName':_0x3839('0xb'),'paranoid':![],'indexes':[{'name':_0x3839('0xc'),'fields':[_0x3839('0xd'),_0x3839('0xe')]},{'name':'leaveAt','fields':[_0x3839('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index cb92dbd..6350066 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 _0x4cce=['info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareReport','body','options','raw','CreateSquareReport','debug','UpdateSquareReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x45cbf3,_0x55fdc1){var _0x73323b=function(_0x502d20){while(--_0x502d20){_0x45cbf3['push'](_0x45cbf3['shift']());}};_0x73323b(++_0x55fdc1);}(_0x4cce,0xd9));var _0xe4cc=function(_0x504612,_0x150527){_0x504612=_0x504612-0x0;var _0x409bbe=_0x4cce[_0x504612];return _0x409bbe;};'use strict';var _=require('lodash');var util=require(_0xe4cc('0x0'));var moment=require(_0xe4cc('0x1'));var BPromise=require(_0xe4cc('0x2'));var rs=require(_0xe4cc('0x3'));var fs=require('fs');var Redis=require(_0xe4cc('0x4'));var db=require(_0xe4cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4cc('0x6'))(_0xe4cc('0x7'));var config=require(_0xe4cc('0x8'));var jayson=require(_0xe4cc('0x9'));var client=jayson[_0xe4cc('0xa')][_0xe4cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f4b37,_0x3b866c,_0x5853c0){return new BPromise(function(_0x4d4b3b,_0x47fbff){return client[_0xe4cc('0xc')](_0x1f4b37,_0x5853c0)[_0xe4cc('0xd')](function(_0x1a41f8){logger[_0xe4cc('0xe')](_0xe4cc('0xf'),_0x3b866c,_0xe4cc('0x10'));logger['debug'](_0xe4cc('0x11'),_0x3b866c,_0xe4cc('0x10'),JSON[_0xe4cc('0x12')](_0x1a41f8));if(_0x1a41f8[_0xe4cc('0x13')]){if(_0x1a41f8['error']['code']===0x1f4){logger[_0xe4cc('0x13')](_0xe4cc('0xf'),_0x3b866c,_0x1a41f8[_0xe4cc('0x13')][_0xe4cc('0x14')]);return _0x47fbff(_0x1a41f8[_0xe4cc('0x13')]['message']);}logger['error'](_0xe4cc('0xf'),_0x3b866c,_0x1a41f8[_0xe4cc('0x13')]['message']);return _0x4d4b3b(_0x1a41f8['error'][_0xe4cc('0x14')]);}else{logger[_0xe4cc('0xe')](_0xe4cc('0xf'),_0x3b866c,_0xe4cc('0x10'));_0x4d4b3b(_0x1a41f8[_0xe4cc('0x15')]['message']);}})[_0xe4cc('0x16')](function(_0xe25d52){logger['error'](_0xe4cc('0xf'),_0x3b866c,_0xe25d52);_0x47fbff(_0xe25d52);});});}exports['CreateSquareReport']=function(_0xa9fd6e){var _0x3946b4=this;return new Promise(function(_0x597931,_0xd2291d){return db[_0xe4cc('0x17')]['create'](_0xa9fd6e[_0xe4cc('0x18')],{'raw':_0xa9fd6e[_0xe4cc('0x19')]?_0xa9fd6e[_0xe4cc('0x19')][_0xe4cc('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2ec7f7){logger[_0xe4cc('0xe')](_0xe4cc('0x1b'),_0xa9fd6e);logger[_0xe4cc('0x1c')](_0xe4cc('0x1b'),_0xa9fd6e,JSON[_0xe4cc('0x12')](_0x2ec7f7));_0x597931(_0x2ec7f7);})['catch'](function(_0x1b4620){logger[_0xe4cc('0x13')](_0xe4cc('0x1b'),_0x1b4620[_0xe4cc('0x14')],_0xa9fd6e);_0xd2291d(_0x3946b4[_0xe4cc('0x13')](0x1f4,_0x1b4620[_0xe4cc('0x14')]));});});};exports[_0xe4cc('0x1d')]=function(_0x5c12fb){var _0x458bdf=this;return new Promise(function(_0x1b3704,_0x1d47e8){return db[_0xe4cc('0x17')]['update'](_0x5c12fb['body'],{'raw':_0x5c12fb['options']?_0x5c12fb[_0xe4cc('0x19')][_0xe4cc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c12fb[_0xe4cc('0x19')]?_0x5c12fb[_0xe4cc('0x19')][_0xe4cc('0x1e')]||null:null,'attributes':_0x5c12fb['options']?_0x5c12fb[_0xe4cc('0x19')][_0xe4cc('0x1f')]||null:null,'limit':_0x5c12fb['options']?_0x5c12fb['options'][_0xe4cc('0x20')]||null:null})[_0xe4cc('0xd')](function(_0x3f8b8e){logger[_0xe4cc('0xe')](_0xe4cc('0x1d'),_0x5c12fb);logger[_0xe4cc('0x1c')](_0xe4cc('0x1d'),_0x5c12fb,JSON[_0xe4cc('0x12')](_0x3f8b8e));_0x1b3704(_0x3f8b8e);})[_0xe4cc('0x16')](function(_0x278176){logger[_0xe4cc('0x13')](_0xe4cc('0x1d'),_0x278176[_0xe4cc('0x14')],_0x5c12fb);_0x1d47e8(_0x458bdf['error'](0x1f4,_0x278176[_0xe4cc('0x14')]));});});}; \ No newline at end of file +var _0xea52=['request','then','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareReport','SquareReport','body','options','raw','update','attributes','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea52,0x188));var _0x2ea5=function(_0x15cef4,_0x448b97){_0x15cef4=_0x15cef4-0x0;var _0x384430=_0xea52[_0x15cef4];return _0x384430;};'use strict';var _=require(_0x2ea5('0x0'));var util=require(_0x2ea5('0x1'));var moment=require(_0x2ea5('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ea5('0x3'));var fs=require('fs');var Redis=require(_0x2ea5('0x4'));var db=require(_0x2ea5('0x5'))['db'];var utils=require(_0x2ea5('0x6'));var logger=require(_0x2ea5('0x7'))('rpc');var config=require(_0x2ea5('0x8'));var jayson=require(_0x2ea5('0x9'));var client=jayson['client'][_0x2ea5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193548,_0x4681f4,_0x20cdfe){return new BPromise(function(_0x1b075e,_0xe953c0){return client[_0x2ea5('0xb')](_0x193548,_0x20cdfe)[_0x2ea5('0xc')](function(_0x128822){logger['info']('SquareReport,\x20%s,\x20%s',_0x4681f4,_0x2ea5('0xd'));logger[_0x2ea5('0xe')](_0x2ea5('0xf'),_0x4681f4,'request\x20sent',JSON[_0x2ea5('0x10')](_0x128822));if(_0x128822[_0x2ea5('0x11')]){if(_0x128822[_0x2ea5('0x11')]['code']===0x1f4){logger['error'](_0x2ea5('0x12'),_0x4681f4,_0x128822[_0x2ea5('0x11')][_0x2ea5('0x13')]);return _0xe953c0(_0x128822['error'][_0x2ea5('0x13')]);}logger[_0x2ea5('0x11')](_0x2ea5('0x12'),_0x4681f4,_0x128822[_0x2ea5('0x11')][_0x2ea5('0x13')]);return _0x1b075e(_0x128822[_0x2ea5('0x11')][_0x2ea5('0x13')]);}else{logger[_0x2ea5('0x14')]('SquareReport,\x20%s,\x20%s',_0x4681f4,_0x2ea5('0xd'));_0x1b075e(_0x128822[_0x2ea5('0x15')][_0x2ea5('0x13')]);}})[_0x2ea5('0x16')](function(_0x223e10){logger[_0x2ea5('0x11')]('SquareReport,\x20%s,\x20%s',_0x4681f4,_0x223e10);_0xe953c0(_0x223e10);});});}exports[_0x2ea5('0x17')]=function(_0xdfdbd1){var _0x47f24e=this;return new Promise(function(_0x58d3c9,_0x3a5e64){return db[_0x2ea5('0x18')]['create'](_0xdfdbd1[_0x2ea5('0x19')],{'raw':_0xdfdbd1[_0x2ea5('0x1a')]?_0xdfdbd1[_0x2ea5('0x1a')][_0x2ea5('0x1b')]===undefined?!![]:![]:!![]})[_0x2ea5('0xc')](function(_0x19cb33){logger[_0x2ea5('0x14')]('CreateSquareReport',_0xdfdbd1);logger[_0x2ea5('0xe')](_0x2ea5('0x17'),_0xdfdbd1,JSON[_0x2ea5('0x10')](_0x19cb33));_0x58d3c9(_0x19cb33);})[_0x2ea5('0x16')](function(_0x21ec64){logger[_0x2ea5('0x11')](_0x2ea5('0x17'),_0x21ec64[_0x2ea5('0x13')],_0xdfdbd1);_0x3a5e64(_0x47f24e[_0x2ea5('0x11')](0x1f4,_0x21ec64[_0x2ea5('0x13')]));});});};exports['UpdateSquareReport']=function(_0x599550){var _0x29cd98=this;return new Promise(function(_0x1ba8df,_0x367833){return db['SquareReport'][_0x2ea5('0x1c')](_0x599550['body'],{'raw':_0x599550['options']?_0x599550['options'][_0x2ea5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x599550[_0x2ea5('0x1a')]?_0x599550[_0x2ea5('0x1a')]['where']||null:null,'attributes':_0x599550[_0x2ea5('0x1a')]?_0x599550[_0x2ea5('0x1a')][_0x2ea5('0x1d')]||null:null,'limit':_0x599550[_0x2ea5('0x1a')]?_0x599550[_0x2ea5('0x1a')]['limit']||null:null})['then'](function(_0x343123){logger['info'](_0x2ea5('0x1e'),_0x599550);logger[_0x2ea5('0xe')](_0x2ea5('0x1e'),_0x599550,JSON[_0x2ea5('0x10')](_0x343123));_0x1ba8df(_0x343123);})[_0x2ea5('0x16')](function(_0x114470){logger['error'](_0x2ea5('0x1e'),_0x114470[_0x2ea5('0x13')],_0x599550);_0x367833(_0x29cd98[_0x2ea5('0x11')](0x1f4,_0x114470[_0x2ea5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6b254c0..e4fccad 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 _0x7f35=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x49b28d,_0x1711e1){var _0x5ce585=function(_0x2b2064){while(--_0x2b2064){_0x49b28d['push'](_0x49b28d['shift']());}};_0x5ce585(++_0x1711e1);}(_0x7f35,0x1b1));var _0x57f3=function(_0x23ffe1,_0x395388){_0x23ffe1=_0x23ffe1-0x0;var _0x55e0da=_0x7f35[_0x23ffe1];return _0x55e0da;};'use strict';var multer=require(_0x57f3('0x0'));var util=require(_0x57f3('0x1'));var path=require(_0x57f3('0x2'));var timeout=require(_0x57f3('0x3'));var express=require(_0x57f3('0x4'));var router=express[_0x57f3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x57f3('0x6'));var interaction=require(_0x57f3('0x7'));var config=require(_0x57f3('0x8'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x57f3('0x9')](),controller[_0x57f3('0xa')]);router[_0x57f3('0xb')](_0x57f3('0xc'),auth[_0x57f3('0x9')](),controller[_0x57f3('0xd')]);router['get'](_0x57f3('0xe'),auth[_0x57f3('0x9')](),controller[_0x57f3('0xf')]);router[_0x57f3('0x10')]('/',auth[_0x57f3('0x9')](),controller[_0x57f3('0x11')]);router['put'](_0x57f3('0xe'),auth[_0x57f3('0x9')](),controller[_0x57f3('0x12')]);router[_0x57f3('0x13')](_0x57f3('0xe'),auth[_0x57f3('0x9')](),controller['destroy']);module[_0x57f3('0x14')]=router; \ No newline at end of file +var _0x1e58=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x584921,_0x51ac30){var _0x429a35=function(_0x4cea08){while(--_0x4cea08){_0x584921['push'](_0x584921['shift']());}};_0x429a35(++_0x51ac30);}(_0x1e58,0x107));var _0x81e5=function(_0x4555ca,_0x3ddc74){_0x4555ca=_0x4555ca-0x0;var _0x3a0735=_0x1e58[_0x4555ca];return _0x3a0735;};'use strict';var multer=require(_0x81e5('0x0'));var util=require(_0x81e5('0x1'));var path=require(_0x81e5('0x2'));var timeout=require(_0x81e5('0x3'));var express=require(_0x81e5('0x4'));var router=express['Router']();var fs_extra=require(_0x81e5('0x5'));var auth=require(_0x81e5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x81e5('0x7'));var controller=require('./squareReportDetail.controller');router[_0x81e5('0x8')]('/',auth[_0x81e5('0x9')](),controller[_0x81e5('0xa')]);router[_0x81e5('0x8')](_0x81e5('0xb'),auth[_0x81e5('0x9')](),controller['describe']);router[_0x81e5('0x8')](_0x81e5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x81e5('0xd')]('/',auth[_0x81e5('0x9')](),controller[_0x81e5('0xe')]);router[_0x81e5('0xf')](_0x81e5('0xc'),auth['isAuthenticated'](),controller[_0x81e5('0x10')]);router[_0x81e5('0x11')](_0x81e5('0xc'),auth[_0x81e5('0x9')](),controller[_0x81e5('0x12')]);module[_0x81e5('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 edfaff8..3959e65 100644 --- a/server/api/squareReportDetail/squareReportDetail.attributes.js +++ b/server/api/squareReportDetail/squareReportDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c0c=['STRING','exports'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x0c0c,0x159));var _0xc0c0=function(_0x25044f,_0x2fbc22){_0x25044f=_0x25044f-0x0;var _0x464afe=_0x0c0c[_0x25044f];return _0x464afe;};'use strict';var Sequelize=require('sequelize');module[_0xc0c0('0x0')]={'uniqueid':{'type':Sequelize[_0xc0c0('0x1')]},'node':{'type':Sequelize[_0xc0c0('0x1')]},'application':{'type':Sequelize[_0xc0c0('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xc0c0('0x1')]},'callerid':{'type':Sequelize[_0xc0c0('0x1')]}}; \ No newline at end of file +var _0x54ec=['sequelize','STRING'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x54ec,0x1c8));var _0xc54e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x54ec[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xc54e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc54e('0x1')]},'node':{'type':Sequelize[_0xc54e('0x1')]},'application':{'type':Sequelize[_0xc54e('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xc54e('0x1')]},'callerid':{'type':Sequelize[_0xc54e('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e24fdca..905e353 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 _0x12b5=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','SquareDetailsReport','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0x12b5,0x129));var _0x512b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12b5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x512b('0x0'));var rimraf=require(_0x512b('0x1'));var zipdir=require(_0x512b('0x2'));var jsonpatch=require(_0x512b('0x3'));var rp=require(_0x512b('0x4'));var moment=require(_0x512b('0x5'));var BPromise=require(_0x512b('0x6'));var Mustache=require('mustache');var util=require(_0x512b('0x7'));var path=require(_0x512b('0x8'));var sox=require(_0x512b('0x9'));var csv=require(_0x512b('0xa'));var ejs=require(_0x512b('0xb'));var fs=require('fs');var fs_extra=require(_0x512b('0xc'));var _=require(_0x512b('0xd'));var squel=require(_0x512b('0xe'));var crypto=require(_0x512b('0xf'));var jsforce=require(_0x512b('0x10'));var deskjs=require(_0x512b('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x512b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x512b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x512b('0x14'))(_0x512b('0x15'));var utils=require(_0x512b('0x16'));var config=require(_0x512b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x512b('0x18'))['db'];function respondWithStatusCode(_0x1004eb,_0x4d3413){_0x4d3413=_0x4d3413||0xcc;return function(_0x1664c8){if(_0x1664c8){return _0x1004eb[_0x512b('0x19')](_0x4d3413);}return _0x1004eb[_0x512b('0x1a')](_0x4d3413)[_0x512b('0x1b')]();};}function respondWithResult(_0x57c36d,_0x31a170){_0x31a170=_0x31a170||0xc8;return function(_0x3f2c51){if(_0x3f2c51){return _0x57c36d['status'](_0x31a170)[_0x512b('0x1c')](_0x3f2c51);}};}function respondWithFilteredResult(_0x1f0bd1,_0x46b0ee){return function(_0x2a364b){if(_0x2a364b){var _0x2a1dfc=typeof _0x46b0ee[_0x512b('0x1d')]===_0x512b('0x1e')&&typeof _0x46b0ee[_0x512b('0x1f')]==='undefined';var _0x41e2e9=_0x2a364b[_0x512b('0x20')];var _0x76247e=_0x2a1dfc?0x0:_0x46b0ee[_0x512b('0x1d')];var _0x2528de=_0x2a1dfc?_0x2a364b['count']:_0x46b0ee[_0x512b('0x1d')]+_0x46b0ee[_0x512b('0x1f')];var _0x2a541f;if(_0x2528de>=_0x41e2e9){_0x2528de=_0x41e2e9;_0x2a541f=0xc8;}else{_0x2a541f=0xce;}_0x1f0bd1['status'](_0x2a541f);return _0x1f0bd1[_0x512b('0x21')](_0x512b('0x22'),_0x76247e+'-'+_0x2528de+'/'+_0x41e2e9)[_0x512b('0x1c')](_0x2a364b);}return null;};}function patchUpdates(_0x5168ee){return function(_0x1879bb){try{jsonpatch[_0x512b('0x23')](_0x1879bb,_0x5168ee,!![]);}catch(_0x4d8a80){return BPromise['reject'](_0x4d8a80);}return _0x1879bb[_0x512b('0x24')]();};}function saveUpdates(_0x3ad3f2,_0xc2fd8a){return function(_0x35105b){if(_0x35105b){return _0x35105b[_0x512b('0x25')](_0x3ad3f2)[_0x512b('0x26')](function(_0x14ee5a){return _0x14ee5a;});}return null;};}function removeEntity(_0x263482,_0x4dda1c){return function(_0x15f994){if(_0x15f994){return _0x15f994[_0x512b('0x27')]()[_0x512b('0x26')](function(){_0x263482[_0x512b('0x1a')](0xcc)[_0x512b('0x1b')]();});}};}function handleEntityNotFound(_0x227b7,_0x302f3d){return function(_0x418ed4){if(!_0x418ed4){_0x227b7[_0x512b('0x19')](0x194);}return _0x418ed4;};}function handleError(_0x2cea62,_0x151074){_0x151074=_0x151074||0x1f4;return function(_0x3c4890){logger[_0x512b('0x28')](_0x3c4890['stack']);if(_0x3c4890[_0x512b('0x29')]){delete _0x3c4890[_0x512b('0x29')];}_0x2cea62[_0x512b('0x1a')](_0x151074)[_0x512b('0x2a')](_0x3c4890);};}exports[_0x512b('0x2b')]=function(_0x225aba,_0x787333){var _0x466f1a={},_0x41f7ab={},_0x336151={'count':0x0,'rows':[]};var _0x86a6f0=_[_0x512b('0x2c')](db['SquareDetailsReport'][_0x512b('0x2d')],function(_0x4467cf){return{'name':_0x4467cf[_0x512b('0x2e')],'type':_0x4467cf[_0x512b('0x2f')]['key']};});_0x41f7ab['model']=_[_0x512b('0x2c')](_0x86a6f0,_0x512b('0x29'));_0x41f7ab[_0x512b('0x30')]=_[_0x512b('0x31')](_0x225aba[_0x512b('0x30')]);_0x41f7ab[_0x512b('0x32')]=_[_0x512b('0x33')](_0x41f7ab[_0x512b('0x34')],_0x41f7ab[_0x512b('0x30')]);_0x466f1a[_0x512b('0x35')]=_['intersection'](_0x41f7ab[_0x512b('0x34')],qs[_0x512b('0x36')](_0x225aba[_0x512b('0x30')][_0x512b('0x36')]));_0x466f1a[_0x512b('0x35')]=_0x466f1a['attributes'][_0x512b('0x37')]?_0x466f1a[_0x512b('0x35')]:_0x41f7ab['model'];if(!_0x225aba[_0x512b('0x30')][_0x512b('0x38')](_0x512b('0x39'))){_0x466f1a[_0x512b('0x1f')]=qs[_0x512b('0x1f')](_0x225aba[_0x512b('0x30')][_0x512b('0x1f')]);_0x466f1a[_0x512b('0x1d')]=qs[_0x512b('0x1d')](_0x225aba[_0x512b('0x30')][_0x512b('0x1d')]);}_0x466f1a[_0x512b('0x3a')]=qs[_0x512b('0x3b')](_0x225aba['query']['sort']);_0x466f1a['where']=qs['filters'](_[_0x512b('0x3c')](_0x225aba['query'],_0x41f7ab[_0x512b('0x32')]),_0x86a6f0);if(_0x225aba['query'][_0x512b('0x3d')]){_0x466f1a[_0x512b('0x3e')]=_[_0x512b('0x3f')](_0x466f1a[_0x512b('0x3e')],{'$or':_[_0x512b('0x2c')](_0x86a6f0,function(_0x5e0d4f){if(_0x5e0d4f[_0x512b('0x2f')]!=='VIRTUAL'){var _0x4b1662={};_0x4b1662[_0x5e0d4f[_0x512b('0x29')]]={'$like':'%'+_0x225aba[_0x512b('0x30')][_0x512b('0x3d')]+'%'};return _0x4b1662;}})});}_0x466f1a=_[_0x512b('0x3f')]({},_0x466f1a,_0x225aba[_0x512b('0x40')]);var _0x3458db={'where':_0x466f1a[_0x512b('0x3e')]};return db['SquareDetailsReport'][_0x512b('0x20')](_0x3458db)[_0x512b('0x26')](function(_0x737786){_0x336151[_0x512b('0x20')]=_0x737786;if(_0x225aba[_0x512b('0x30')][_0x512b('0x41')]){_0x466f1a[_0x512b('0x42')]=[{'all':!![]}];}return db[_0x512b('0x43')][_0x512b('0x44')](_0x466f1a);})[_0x512b('0x26')](function(_0xaf8317){_0x336151[_0x512b('0x45')]=_0xaf8317;return _0x336151;})[_0x512b('0x26')](respondWithFilteredResult(_0x787333,_0x466f1a))[_0x512b('0x46')](handleError(_0x787333,null));};exports['show']=function(_0x528bc3,_0x24d17e){var _0x478709={'raw':!![],'where':{'id':_0x528bc3[_0x512b('0x47')]['id']}},_0x599103={};_0x599103['model']=_[_0x512b('0x31')](db[_0x512b('0x43')]['rawAttributes']);_0x599103[_0x512b('0x30')]=_['keys'](_0x528bc3[_0x512b('0x30')]);_0x599103['filters']=_[_0x512b('0x33')](_0x599103[_0x512b('0x34')],_0x599103['query']);_0x478709['attributes']=_[_0x512b('0x33')](_0x599103['model'],qs[_0x512b('0x36')](_0x528bc3[_0x512b('0x30')][_0x512b('0x36')]));_0x478709['attributes']=_0x478709[_0x512b('0x35')]['length']?_0x478709[_0x512b('0x35')]:_0x599103[_0x512b('0x34')];if(_0x528bc3[_0x512b('0x30')][_0x512b('0x41')]){_0x478709[_0x512b('0x42')]=[{'all':!![]}];}_0x478709=_['merge']({},_0x478709,_0x528bc3[_0x512b('0x40')]);return db['SquareDetailsReport'][_0x512b('0x48')](_0x478709)[_0x512b('0x26')](handleEntityNotFound(_0x24d17e,null))[_0x512b('0x26')](respondWithResult(_0x24d17e,null))[_0x512b('0x46')](handleError(_0x24d17e,null));};exports['create']=function(_0x28784d,_0x97f5f2){return db[_0x512b('0x43')][_0x512b('0x49')](_0x28784d[_0x512b('0x4a')],{})[_0x512b('0x26')](respondWithResult(_0x97f5f2,0xc9))[_0x512b('0x46')](handleError(_0x97f5f2,null));};exports[_0x512b('0x25')]=function(_0x3e1fe1,_0x11a190){if(_0x3e1fe1[_0x512b('0x4a')]['id']){delete _0x3e1fe1[_0x512b('0x4a')]['id'];}return db[_0x512b('0x43')][_0x512b('0x48')]({'where':{'id':_0x3e1fe1[_0x512b('0x47')]['id']}})[_0x512b('0x26')](handleEntityNotFound(_0x11a190,null))['then'](saveUpdates(_0x3e1fe1[_0x512b('0x4a')],null))[_0x512b('0x26')](respondWithResult(_0x11a190,null))[_0x512b('0x46')](handleError(_0x11a190,null));};exports[_0x512b('0x27')]=function(_0x34146a,_0x538e01){return db['SquareDetailsReport'][_0x512b('0x48')]({'where':{'id':_0x34146a[_0x512b('0x47')]['id']}})[_0x512b('0x26')](handleEntityNotFound(_0x538e01,null))[_0x512b('0x26')](removeEntity(_0x538e01,null))[_0x512b('0x46')](handleError(_0x538e01,null));};exports[_0x512b('0x4b')]=function(_0x4a7c97,_0x145e12){return db[_0x512b('0x43')][_0x512b('0x4b')]()[_0x512b('0x26')](respondWithResult(_0x145e12,null))[_0x512b('0x46')](handleError(_0x145e12,null));}; \ No newline at end of file +var _0xaac0=['util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','stack','name','send','SquareDetailsReport','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','catch','show','params','filters','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaac0,0x107));var _0x0aac=function(_0x5e2104,_0x12f596){_0x5e2104=_0x5e2104-0x0;var _0x473067=_0xaac0[_0x5e2104];return _0x473067;};'use strict';var emlformat=require(_0x0aac('0x0'));var rimraf=require(_0x0aac('0x1'));var zipdir=require(_0x0aac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0aac('0x3'));var moment=require(_0x0aac('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0aac('0x5'));var path=require('path');var sox=require(_0x0aac('0x6'));var csv=require(_0x0aac('0x7'));var ejs=require(_0x0aac('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0aac('0x9'));var crypto=require(_0x0aac('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0aac('0xb'));var toCsv=require(_0x0aac('0x7'));var querystring=require('querystring');var Papa=require(_0x0aac('0xc'));var Redis=require(_0x0aac('0xd'));var authService=require(_0x0aac('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0aac('0xf'));var hardwareService=require(_0x0aac('0x10'));var logger=require('../../config/logger')(_0x0aac('0x11'));var utils=require(_0x0aac('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0aac('0x13'));var db=require(_0x0aac('0x14'))['db'];function respondWithStatusCode(_0x40cb5d,_0x5ee3e7){_0x5ee3e7=_0x5ee3e7||0xcc;return function(_0x4e4238){if(_0x4e4238){return _0x40cb5d[_0x0aac('0x15')](_0x5ee3e7);}return _0x40cb5d[_0x0aac('0x16')](_0x5ee3e7)[_0x0aac('0x17')]();};}function respondWithResult(_0x68f996,_0x4c3f7f){_0x4c3f7f=_0x4c3f7f||0xc8;return function(_0x99be52){if(_0x99be52){return _0x68f996['status'](_0x4c3f7f)[_0x0aac('0x18')](_0x99be52);}};}function respondWithFilteredResult(_0x85f13c,_0x493911){return function(_0x49dc9b){if(_0x49dc9b){var _0x409621=typeof _0x493911[_0x0aac('0x19')]===_0x0aac('0x1a')&&typeof _0x493911[_0x0aac('0x1b')]===_0x0aac('0x1a');var _0x3b407d=_0x49dc9b['count'];var _0x3cdc01=_0x409621?0x0:_0x493911[_0x0aac('0x19')];var _0x5b7e21=_0x409621?_0x49dc9b[_0x0aac('0x1c')]:_0x493911[_0x0aac('0x19')]+_0x493911['limit'];var _0x165013;if(_0x5b7e21>=_0x3b407d){_0x5b7e21=_0x3b407d;_0x165013=0xc8;}else{_0x165013=0xce;}_0x85f13c['status'](_0x165013);return _0x85f13c[_0x0aac('0x1d')]('Content-Range',_0x3cdc01+'-'+_0x5b7e21+'/'+_0x3b407d)[_0x0aac('0x18')](_0x49dc9b);}return null;};}function patchUpdates(_0x2bd41e){return function(_0x3338ac){try{jsonpatch[_0x0aac('0x1e')](_0x3338ac,_0x2bd41e,!![]);}catch(_0x5c2ef7){return BPromise['reject'](_0x5c2ef7);}return _0x3338ac['save']();};}function saveUpdates(_0x471381,_0xd5a0eb){return function(_0x3a0cd7){if(_0x3a0cd7){return _0x3a0cd7[_0x0aac('0x1f')](_0x471381)[_0x0aac('0x20')](function(_0x3f01e2){return _0x3f01e2;});}return null;};}function removeEntity(_0x449881,_0x384df2){return function(_0x2bf2f2){if(_0x2bf2f2){return _0x2bf2f2[_0x0aac('0x21')]()[_0x0aac('0x20')](function(){_0x449881[_0x0aac('0x16')](0xcc)[_0x0aac('0x17')]();});}};}function handleEntityNotFound(_0x5e55c2,_0x145014){return function(_0x2721b7){if(!_0x2721b7){_0x5e55c2[_0x0aac('0x15')](0x194);}return _0x2721b7;};}function handleError(_0x19aebd,_0x4f761c){_0x4f761c=_0x4f761c||0x1f4;return function(_0x4d957d){logger[_0x0aac('0x22')](_0x4d957d[_0x0aac('0x23')]);if(_0x4d957d[_0x0aac('0x24')]){delete _0x4d957d[_0x0aac('0x24')];}_0x19aebd[_0x0aac('0x16')](_0x4f761c)[_0x0aac('0x25')](_0x4d957d);};}exports['index']=function(_0x5f1c7d,_0x5dc128){var _0x205d40={},_0x1e5ee3={},_0x33b827={'count':0x0,'rows':[]};var _0x24f11d=_['map'](db[_0x0aac('0x26')][_0x0aac('0x27')],function(_0x435b34){return{'name':_0x435b34['fieldName'],'type':_0x435b34[_0x0aac('0x28')]['key']};});_0x1e5ee3[_0x0aac('0x29')]=_[_0x0aac('0x2a')](_0x24f11d,_0x0aac('0x24'));_0x1e5ee3[_0x0aac('0x2b')]=_[_0x0aac('0x2c')](_0x5f1c7d['query']);_0x1e5ee3['filters']=_[_0x0aac('0x2d')](_0x1e5ee3['model'],_0x1e5ee3[_0x0aac('0x2b')]);_0x205d40[_0x0aac('0x2e')]=_[_0x0aac('0x2d')](_0x1e5ee3['model'],qs[_0x0aac('0x2f')](_0x5f1c7d['query'][_0x0aac('0x2f')]));_0x205d40[_0x0aac('0x2e')]=_0x205d40[_0x0aac('0x2e')][_0x0aac('0x30')]?_0x205d40['attributes']:_0x1e5ee3[_0x0aac('0x29')];if(!_0x5f1c7d[_0x0aac('0x2b')]['hasOwnProperty'](_0x0aac('0x31'))){_0x205d40[_0x0aac('0x1b')]=qs[_0x0aac('0x1b')](_0x5f1c7d[_0x0aac('0x2b')][_0x0aac('0x1b')]);_0x205d40[_0x0aac('0x19')]=qs[_0x0aac('0x19')](_0x5f1c7d['query'][_0x0aac('0x19')]);}_0x205d40[_0x0aac('0x32')]=qs[_0x0aac('0x33')](_0x5f1c7d[_0x0aac('0x2b')][_0x0aac('0x33')]);_0x205d40[_0x0aac('0x34')]=qs['filters'](_[_0x0aac('0x35')](_0x5f1c7d['query'],_0x1e5ee3['filters']),_0x24f11d);if(_0x5f1c7d['query']['filter']){_0x205d40[_0x0aac('0x34')]=_['merge'](_0x205d40['where'],{'$or':_[_0x0aac('0x2a')](_0x24f11d,function(_0x39be7d){if(_0x39be7d[_0x0aac('0x28')]!==_0x0aac('0x36')){var _0x23f773={};_0x23f773[_0x39be7d[_0x0aac('0x24')]]={'$like':'%'+_0x5f1c7d[_0x0aac('0x2b')]['filter']+'%'};return _0x23f773;}})});}_0x205d40=_['merge']({},_0x205d40,_0x5f1c7d[_0x0aac('0x37')]);var _0x5a79f7={'where':_0x205d40[_0x0aac('0x34')]};return db['SquareDetailsReport']['count'](_0x5a79f7)['then'](function(_0x4c5791){_0x33b827[_0x0aac('0x1c')]=_0x4c5791;if(_0x5f1c7d['query'][_0x0aac('0x38')]){_0x205d40[_0x0aac('0x39')]=[{'all':!![]}];}return db[_0x0aac('0x26')][_0x0aac('0x3a')](_0x205d40);})[_0x0aac('0x20')](function(_0x5d812f){_0x33b827['rows']=_0x5d812f;return _0x33b827;})[_0x0aac('0x20')](respondWithFilteredResult(_0x5dc128,_0x205d40))[_0x0aac('0x3b')](handleError(_0x5dc128,null));};exports[_0x0aac('0x3c')]=function(_0x31d0a7,_0xc18094){var _0x53d1c6={'raw':!![],'where':{'id':_0x31d0a7[_0x0aac('0x3d')]['id']}},_0xe6a440={};_0xe6a440[_0x0aac('0x29')]=_[_0x0aac('0x2c')](db[_0x0aac('0x26')][_0x0aac('0x27')]);_0xe6a440['query']=_['keys'](_0x31d0a7[_0x0aac('0x2b')]);_0xe6a440[_0x0aac('0x3e')]=_[_0x0aac('0x2d')](_0xe6a440[_0x0aac('0x29')],_0xe6a440['query']);_0x53d1c6[_0x0aac('0x2e')]=_['intersection'](_0xe6a440[_0x0aac('0x29')],qs[_0x0aac('0x2f')](_0x31d0a7[_0x0aac('0x2b')][_0x0aac('0x2f')]));_0x53d1c6[_0x0aac('0x2e')]=_0x53d1c6[_0x0aac('0x2e')][_0x0aac('0x30')]?_0x53d1c6[_0x0aac('0x2e')]:_0xe6a440[_0x0aac('0x29')];if(_0x31d0a7['query'][_0x0aac('0x38')]){_0x53d1c6[_0x0aac('0x39')]=[{'all':!![]}];}_0x53d1c6=_['merge']({},_0x53d1c6,_0x31d0a7[_0x0aac('0x37')]);return db[_0x0aac('0x26')]['find'](_0x53d1c6)[_0x0aac('0x20')](handleEntityNotFound(_0xc18094,null))[_0x0aac('0x20')](respondWithResult(_0xc18094,null))[_0x0aac('0x3b')](handleError(_0xc18094,null));};exports[_0x0aac('0x3f')]=function(_0x5cd40e,_0x1deb39){return db[_0x0aac('0x26')][_0x0aac('0x3f')](_0x5cd40e['body'],{})[_0x0aac('0x20')](respondWithResult(_0x1deb39,0xc9))['catch'](handleError(_0x1deb39,null));};exports[_0x0aac('0x1f')]=function(_0x69a7d6,_0x4a93ad){if(_0x69a7d6[_0x0aac('0x40')]['id']){delete _0x69a7d6[_0x0aac('0x40')]['id'];}return db[_0x0aac('0x26')]['find']({'where':{'id':_0x69a7d6[_0x0aac('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4a93ad,null))[_0x0aac('0x20')](saveUpdates(_0x69a7d6[_0x0aac('0x40')],null))[_0x0aac('0x20')](respondWithResult(_0x4a93ad,null))[_0x0aac('0x3b')](handleError(_0x4a93ad,null));};exports[_0x0aac('0x21')]=function(_0x1821ef,_0x3c3feb){return db[_0x0aac('0x26')][_0x0aac('0x41')]({'where':{'id':_0x1821ef[_0x0aac('0x3d')]['id']}})[_0x0aac('0x20')](handleEntityNotFound(_0x3c3feb,null))[_0x0aac('0x20')](removeEntity(_0x3c3feb,null))['catch'](handleError(_0x3c3feb,null));};exports[_0x0aac('0x42')]=function(_0x271d95,_0x4cf449){return db[_0x0aac('0x26')]['describe']()[_0x0aac('0x20')](respondWithResult(_0x4cf449,null))[_0x0aac('0x3b')](handleError(_0x4cf449,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 0651f8b..d151508 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 _0xa9af=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa9af,0xcb));var _0xfa9a=function(_0x35f9d4,_0x5dea15){_0x35f9d4=_0x35f9d4-0x0;var _0xfbbb29=_0xa9af[_0x35f9d4];return _0xfbbb29;};'use strict';var _=require(_0xfa9a('0x0'));var util=require(_0xfa9a('0x1'));var logger=require(_0xfa9a('0x2'))(_0xfa9a('0x3'));var moment=require('moment');var BPromise=require(_0xfa9a('0x4'));var rp=require(_0xfa9a('0x5'));var fs=require('fs');var path=require(_0xfa9a('0x6'));var rimraf=require(_0xfa9a('0x7'));var config=require(_0xfa9a('0x8'));var attributes=require(_0xfa9a('0x9'));module['exports']=function(_0x217b82,_0x172488){return _0x217b82[_0xfa9a('0xa')](_0xfa9a('0xb'),attributes,{'tableName':_0xfa9a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef42=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x1add2f,_0x2682c7){var _0xbf717d=function(_0x10540f){while(--_0x10540f){_0x1add2f['push'](_0x1add2f['shift']());}};_0xbf717d(++_0x2682c7);}(_0xef42,0x1d3));var _0x2ef4=function(_0x6e5ca9,_0x581255){_0x6e5ca9=_0x6e5ca9-0x0;var _0x39ecf8=_0xef42[_0x6e5ca9];return _0x39ecf8;};'use strict';var _=require('lodash');var util=require(_0x2ef4('0x0'));var logger=require(_0x2ef4('0x1'))(_0x2ef4('0x2'));var moment=require('moment');var BPromise=require(_0x2ef4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ef4('0x4'));var rimraf=require('rimraf');var config=require(_0x2ef4('0x5'));var attributes=require(_0x2ef4('0x6'));module[_0x2ef4('0x7')]=function(_0x2c3732,_0x364894){return _0x2c3732[_0x2ef4('0x8')](_0x2ef4('0x9'),attributes,{'tableName':_0x2ef4('0xa'),'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 4f7eaaa..585b115 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 _0x3f8c=['code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','catch','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12bd1e,_0x17a330){var _0x5caaeb=function(_0x172ae2){while(--_0x172ae2){_0x12bd1e['push'](_0x12bd1e['shift']());}};_0x5caaeb(++_0x17a330);}(_0x3f8c,0x104));var _0xc3f8=function(_0x5d15e9,_0x4b08be){_0x5d15e9=_0x5d15e9-0x0;var _0x43ef90=_0x3f8c[_0x5d15e9];return _0x43ef90;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')](_0x2e7c0f['body'],{'raw':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f['options'][_0xc3f8('0x16')]===undefined?!![]:![]:!![]})[_0xc3f8('0x8')](function(_0x3b2e98){logger['info']('CreateSquareDetailsReport',_0x2e7c0f);logger[_0xc3f8('0x17')](_0xc3f8('0x12'),_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x3b2e98));_0xb4ab67(_0x3b2e98);})[_0xc3f8('0x18')](function(_0x6522e9){logger[_0xc3f8('0xe')](_0xc3f8('0x12'),_0x6522e9[_0xc3f8('0x10')],_0x2e7c0f);_0x47a185(_0x35500f['error'](0x1f4,_0x6522e9['message']));});});}; \ No newline at end of file +var _0xb688=['body','options','raw','CreateSquareDetailsReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareDetailsReport','create'];(function(_0xb6c6ad,_0x3349a7){var _0x3a36ac=function(_0x415c41){while(--_0x415c41){_0xb6c6ad['push'](_0xb6c6ad['shift']());}};_0x3a36ac(++_0x3349a7);}(_0xb688,0xcf));var _0x8b68=function(_0x59b36d,_0x262a4b){_0x59b36d=_0x59b36d-0x0;var _0x31cb47=_0xb688[_0x59b36d];return _0x31cb47;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var moment=require(_0x8b68('0x1'));var BPromise=require(_0x8b68('0x2'));var rs=require(_0x8b68('0x3'));var fs=require('fs');var Redis=require(_0x8b68('0x4'));var db=require(_0x8b68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var config=require(_0x8b68('0x8'));var jayson=require(_0x8b68('0x9'));var client=jayson['client'][_0x8b68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ee56,_0x37677d,_0x2bbffd){return new BPromise(function(_0x130892,_0xa5571b){return client[_0x8b68('0xb')](_0x57ee56,_0x2bbffd)[_0x8b68('0xc')](function(_0x261753){logger[_0x8b68('0xd')](_0x8b68('0xe'),_0x37677d,_0x8b68('0xf'));logger[_0x8b68('0x10')](_0x8b68('0x11'),_0x37677d,_0x8b68('0xf'),JSON['stringify'](_0x261753));if(_0x261753[_0x8b68('0x12')]){if(_0x261753[_0x8b68('0x12')][_0x8b68('0x13')]===0x1f4){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);return _0xa5571b(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}logger['error'](_0x8b68('0xe'),_0x37677d,_0x261753['error']['message']);return _0x130892(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}else{logger[_0x8b68('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x37677d,'request\x20sent');_0x130892(_0x261753[_0x8b68('0x15')]['message']);}})[_0x8b68('0x16')](function(_0xb44923){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0xb44923);_0xa5571b(_0xb44923);});});}exports['CreateSquareDetailsReport']=function(_0xd17693){var _0x203dd4=this;return new Promise(function(_0x4a68c7,_0x42b3bd){return db[_0x8b68('0x17')][_0x8b68('0x18')](_0xd17693[_0x8b68('0x19')],{'raw':_0xd17693[_0x8b68('0x1a')]?_0xd17693['options'][_0x8b68('0x1b')]===undefined?!![]:![]:!![]})[_0x8b68('0xc')](function(_0x59e9b1){logger[_0x8b68('0xd')](_0x8b68('0x1c'),_0xd17693);logger[_0x8b68('0x10')]('CreateSquareDetailsReport',_0xd17693,JSON['stringify'](_0x59e9b1));_0x4a68c7(_0x59e9b1);})[_0x8b68('0x16')](function(_0x59cb26){logger[_0x8b68('0x12')](_0x8b68('0x1c'),_0x59cb26[_0x8b68('0x14')],_0xd17693);_0x42b3bd(_0x203dd4[_0x8b68('0x12')](0x1f4,_0x59cb26[_0x8b68('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 86583a6..2bfd573 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 _0x51b8=['get','killProcess','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x51b8,0x1eb));var _0x851b=function(_0xe9d604,_0x573d49){_0xe9d604=_0xe9d604-0x0;var _0x2d6709=_0x51b8[_0xe9d604];return _0x2d6709;};'use strict';var express=require(_0x851b('0x0'));var router=express[_0x851b('0x1')]();var auth=require(_0x851b('0x2'));var controller=require(_0x851b('0x3'));router['get']('/',auth[_0x851b('0x4')](),controller['index']);router[_0x851b('0x5')]('/process/:pid/kill',auth[_0x851b('0x4')](),controller[_0x851b('0x6')]);module[_0x851b('0x7')]=router; \ No newline at end of file +var _0xbf3b=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x358ad5,_0x541e0e){var _0x391396=function(_0x46874d){while(--_0x46874d){_0x358ad5['push'](_0x358ad5['shift']());}};_0x391396(++_0x541e0e);}(_0xbf3b,0x1dd));var _0xbbf3=function(_0x3795f2,_0x53c3b1){_0x3795f2=_0x3795f2-0x0;var _0x82376b=_0xbf3b[_0x3795f2];return _0x82376b;};'use strict';var express=require(_0xbbf3('0x0'));var router=express[_0xbbf3('0x1')]();var auth=require(_0xbbf3('0x2'));var controller=require(_0xbbf3('0x3'));router[_0xbbf3('0x4')]('/',auth[_0xbbf3('0x5')](),controller[_0xbbf3('0x6')]);router[_0xbbf3('0x4')](_0xbbf3('0x7'),auth[_0xbbf3('0x5')](),controller[_0xbbf3('0x8')]);module[_0xbbf3('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index c895127..6120614 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 _0x575c=['name','status','send','index','then','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x575c,0x96));var _0xc575=function(_0x2c62c9,_0x2293bc){_0x2c62c9=_0x2c62c9-0x0;var _0x1c6cbe=_0x575c[_0x2c62c9];return _0x1c6cbe;};'use strict';var info=require(_0xc575('0x0'));var exec=require(_0xc575('0x1'))['exec'];var logger=require('../../config/logger')(_0xc575('0x2'));var util=require(_0xc575('0x3'));var BPromise=require('bluebird');var _=require(_0xc575('0x4'));function handleError(_0x18599d,_0x5b2a9d,_0x54f76a){_0x5b2a9d=_0x5b2a9d||0x1f4;return function(_0x3b1e61){logger['error'](_0xc575('0x5'),_0x54f76a,_0x5b2a9d,util['inspect'](_0x3b1e61,{'showHidden':![],'depth':null}));delete _0x3b1e61[_0xc575('0x6')];_0x18599d[_0xc575('0x7')](_0x5b2a9d)[_0xc575('0x8')](_0x3b1e61);};}exports[_0xc575('0x9')]=function(_0xb55f4,_0x533883){return info['getAllData']()[_0xc575('0xa')](function(_0x4edf68){return _0x533883[_0xc575('0x7')](0xc8)[_0xc575('0xb')](_0x4edf68);})['catch'](function(_0x361a1b){return _0x533883[_0xc575('0x7')](0x1f4)[_0xc575('0xb')](_0x361a1b);});};exports['killProcess']=function(_0x11820,_0x23e5b8){var _0x5eb967=[_0xc575('0xc')];return new BPromise(function(_0x58da00,_0x505119){return exec(util[_0xc575('0xd')](_0xc575('0xe'),_0x11820[_0xc575('0xf')][_0xc575('0x10')]),function(_0x33302c,_0x3dbf0e,_0x5ee113){if(_0x33302c){return _0x505119(_0x33302c);}return _0x58da00(_0x3dbf0e);});})[_0xc575('0xa')](function(_0x26350a){var _0x2f6400=![];var _0x1487d7=_0x26350a[_0xc575('0x11')](/\n/);for(var _0x128bdf=0x0,_0x19c2cf=_0x5eb967[_0xc575('0x12')];_0x128bdf<_0x19c2cf,_0x2f6400===![];_0x128bdf+=0x1){if(_0x26350a[_0xc575('0x13')](_0x5eb967[_0x128bdf])>=0x0){_0x2f6400=!![];}}if(!_0x2f6400){throw new Error(util[_0xc575('0xd')](_0xc575('0x14'),_0x11820[_0xc575('0xf')]['pid']));}process[_0xc575('0x15')](_0x11820[_0xc575('0xf')][_0xc575('0x10')],_0xc575('0x16'));return _0x23e5b8[_0xc575('0x7')](0xc8)[_0xc575('0xb')]({'message':util[_0xc575('0xd')](_0xc575('0x17'),_0x11820[_0xc575('0xf')]['pid'])});})[_0xc575('0x18')](handleError(_0x23e5b8,null,_0xc575('0x19')));}; \ No newline at end of file +var _0x9051=['status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0xb491c,_0x54029a){var _0x121f8d=function(_0x3dac80){while(--_0x3dac80){_0xb491c['push'](_0xb491c['shift']());}};_0x121f8d(++_0x54029a);}(_0x9051,0xd6));var _0x1905=function(_0x170cf5,_0x33f192){_0x170cf5=_0x170cf5-0x0;var _0x1d36c5=_0x9051[_0x170cf5];return _0x1d36c5;};'use strict';var info=require('systeminformation');var exec=require(_0x1905('0x0'))[_0x1905('0x1')];var logger=require('../../config/logger')(_0x1905('0x2'));var util=require('util');var BPromise=require(_0x1905('0x3'));var _=require('lodash');function handleError(_0x16f390,_0x49da9d,_0x4a231e){_0x49da9d=_0x49da9d||0x1f4;return function(_0x5ca6b9){logger[_0x1905('0x4')](_0x1905('0x5'),_0x4a231e,_0x49da9d,util['inspect'](_0x5ca6b9,{'showHidden':![],'depth':null}));delete _0x5ca6b9['name'];_0x16f390[_0x1905('0x6')](_0x49da9d)[_0x1905('0x7')](_0x5ca6b9);};}exports[_0x1905('0x8')]=function(_0x138e85,_0x57ffbf){return info[_0x1905('0x9')]()[_0x1905('0xa')](function(_0x30898a){return _0x57ffbf['status'](0xc8)[_0x1905('0xb')](_0x30898a);})[_0x1905('0xc')](function(_0xf3ab0e){return _0x57ffbf[_0x1905('0x6')](0x1f4)[_0x1905('0xb')](_0xf3ab0e);});};exports[_0x1905('0xd')]=function(_0x1fe68f,_0x5a0b04){var _0x5019ac=[_0x1905('0xe')];return new BPromise(function(_0xd724c1,_0x71b935){return exec(util[_0x1905('0xf')](_0x1905('0x10'),_0x1fe68f[_0x1905('0x11')][_0x1905('0x12')]),function(_0x3fefad,_0x14c4bf,_0x41601e){if(_0x3fefad){return _0x71b935(_0x3fefad);}return _0xd724c1(_0x14c4bf);});})[_0x1905('0xa')](function(_0x4eae7){var _0x4b5d38=![];var _0x396c03=_0x4eae7['split'](/\n/);for(var _0x11c050=0x0,_0x522ec2=_0x5019ac[_0x1905('0x13')];_0x11c050<_0x522ec2,_0x4b5d38===![];_0x11c050+=0x1){if(_0x4eae7['indexOf'](_0x5019ac[_0x11c050])>=0x0){_0x4b5d38=!![];}}if(!_0x4b5d38){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1fe68f[_0x1905('0x11')][_0x1905('0x12')]));}process[_0x1905('0x14')](_0x1fe68f[_0x1905('0x11')][_0x1905('0x12')],'SIGINT');return _0x5a0b04[_0x1905('0x6')](0xc8)[_0x1905('0xb')]({'message':util[_0x1905('0xf')](_0x1905('0x15'),_0x1fe68f['params'][_0x1905('0x12')])});})[_0x1905('0xc')](handleError(_0x5a0b04,null,_0x1905('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1447ea8..2851ff8 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 _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x2bf352,_0x31598f){var _0x5e1bbf=function(_0x20c4a0){while(--_0x20c4a0){_0x2bf352['push'](_0x2bf352['shift']());}};_0x5e1bbf(++_0x31598f);}(_0x70e0,0x17b));var _0x070e=function(_0x5c9118,_0x32594f){_0x5c9118=_0x5c9118-0x0;var _0x10082d=_0x70e0[_0x5c9118];return _0x10082d;};'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'](),controller['create']);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x11')]);module[_0x070e('0x12')]=router; \ No newline at end of file +var _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x57060d,_0x47d911){var _0x2e66bd=function(_0x5ef224){while(--_0x5ef224){_0x57060d['push'](_0x57060d['shift']());}};_0x2e66bd(++_0x47d911);}(_0xa75b,0x170));var _0xba75=function(_0x490b2e,_0x428210){_0x490b2e=_0x490b2e-0x0;var _0x5b3189=_0xa75b[_0x490b2e];return _0x5b3189;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 1955ba9..22fc96e 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 _0xd8d7=['sequelize','exports','STRING','name'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xd8d7[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x7d8d('0x0'));module[_0x7d8d('0x1')]={'name':{'type':Sequelize[_0x7d8d('0x2')],'unique':_0x7d8d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7d8d('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x544a=['sequelize','exports','STRING','#0091EA'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x544a,0x118));var _0xa544=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0x544a[_0x1b25c1];return _0x1e4447;};'use strict';var Sequelize=require(_0xa544('0x0'));module[_0xa544('0x1')]={'name':{'type':Sequelize[_0xa544('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xa544('0x3')},'description':{'type':Sequelize[_0xa544('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 9261090..4cc04ff 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 _0xdd03=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','Tag','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x5cda3e,_0x216c8c){var _0x32e52c=function(_0x16a3b5){while(--_0x16a3b5){_0x5cda3e['push'](_0x5cda3e['shift']());}};_0x32e52c(++_0x216c8c);}(_0xdd03,0xe5));var _0x3dd0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdd03[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3dd0('0x0'));var rp=require(_0x3dd0('0x1'));var moment=require(_0x3dd0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3dd0('0x3'));var util=require(_0x3dd0('0x4'));var path=require('path');var sox=require(_0x3dd0('0x5'));var csv=require('to-csv');var ejs=require(_0x3dd0('0x6'));var fs=require('fs');var fs_extra=require(_0x3dd0('0x7'));var _=require(_0x3dd0('0x8'));var squel=require(_0x3dd0('0x9'));var crypto=require(_0x3dd0('0xa'));var jsforce=require(_0x3dd0('0xb'));var deskjs=require(_0x3dd0('0xc'));var toCsv=require(_0x3dd0('0xd'));var querystring=require(_0x3dd0('0xe'));var Papa=require('papaparse');var Redis=require(_0x3dd0('0xf'));var authService=require(_0x3dd0('0x10'));var qs=require(_0x3dd0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dd0('0x12'));var logger=require(_0x3dd0('0x13'))(_0x3dd0('0x14'));var utils=require(_0x3dd0('0x15'));var config=require(_0x3dd0('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50d20b,_0x1a8bb7){_0x1a8bb7=_0x1a8bb7||0xcc;return function(_0x52f757){if(_0x52f757){return _0x50d20b[_0x3dd0('0x17')](_0x1a8bb7);}return _0x50d20b['status'](_0x1a8bb7)[_0x3dd0('0x18')]();};}function respondWithResult(_0x1dee9e,_0x2f3174){_0x2f3174=_0x2f3174||0xc8;return function(_0x526eeb){if(_0x526eeb){return _0x1dee9e[_0x3dd0('0x19')](_0x2f3174)[_0x3dd0('0x1a')](_0x526eeb);}};}function respondWithFilteredResult(_0x25f612,_0x176526){return function(_0x2b57f0){if(_0x2b57f0){var _0x75c5a8=typeof _0x176526[_0x3dd0('0x1b')]===_0x3dd0('0x1c')&&typeof _0x176526[_0x3dd0('0x1d')]===_0x3dd0('0x1c');var _0x247bc3=_0x2b57f0[_0x3dd0('0x1e')];var _0x328903=_0x75c5a8?0x0:_0x176526[_0x3dd0('0x1b')];var _0x59c882=_0x75c5a8?_0x2b57f0[_0x3dd0('0x1e')]:_0x176526[_0x3dd0('0x1b')]+_0x176526[_0x3dd0('0x1d')];var _0x173679;if(_0x59c882>=_0x247bc3){_0x59c882=_0x247bc3;_0x173679=0xc8;}else{_0x173679=0xce;}_0x25f612[_0x3dd0('0x19')](_0x173679);return _0x25f612[_0x3dd0('0x1f')]('Content-Range',_0x328903+'-'+_0x59c882+'/'+_0x247bc3)[_0x3dd0('0x1a')](_0x2b57f0);}return null;};}function patchUpdates(_0x20ab25){return function(_0x33df87){try{jsonpatch['apply'](_0x33df87,_0x20ab25,!![]);}catch(_0x2afc66){return BPromise['reject'](_0x2afc66);}return _0x33df87[_0x3dd0('0x20')]();};}function saveUpdates(_0x57ffeb,_0x5237da){return function(_0x38d262){if(_0x38d262){return _0x38d262[_0x3dd0('0x21')](_0x57ffeb)[_0x3dd0('0x22')](function(_0x4f7aa8){return _0x4f7aa8;});}return null;};}function removeEntity(_0x144b66,_0x1ea8ab){return function(_0x3b4156){if(_0x3b4156){return _0x3b4156[_0x3dd0('0x23')]()[_0x3dd0('0x22')](function(){var _0x2423fd=_0x3b4156[_0x3dd0('0x24')]({'plain':!![]});var _0x50a0d9='Tags';return db[_0x3dd0('0x25')]['destroy']({'where':{'type':_0x50a0d9,'resourceId':_0x2423fd['id']}})[_0x3dd0('0x22')](function(){return _0x3b4156;});})['then'](function(){_0x144b66[_0x3dd0('0x19')](0xcc)[_0x3dd0('0x18')]();});}};}function handleEntityNotFound(_0x51adf1,_0x28e96e){return function(_0x5e0d5d){if(!_0x5e0d5d){_0x51adf1[_0x3dd0('0x17')](0x194);}return _0x5e0d5d;};}function handleError(_0x201bee,_0x4f01eb){_0x4f01eb=_0x4f01eb||0x1f4;return function(_0x48c06a){logger[_0x3dd0('0x26')](_0x48c06a[_0x3dd0('0x27')]);if(_0x48c06a['name']){delete _0x48c06a['name'];}_0x201bee[_0x3dd0('0x19')](_0x4f01eb)[_0x3dd0('0x28')](_0x48c06a);};}exports[_0x3dd0('0x29')]=function(_0x3f7b62,_0x881acd){var _0x201599={},_0x4682d9={},_0x2ea22f={'count':0x0,'rows':[]};var _0x19b2ac=_[_0x3dd0('0x2a')](db[_0x3dd0('0x2b')]['rawAttributes'],function(_0x3f176a){return{'name':_0x3f176a['fieldName'],'type':_0x3f176a['type'][_0x3dd0('0x2c')]};});_0x4682d9[_0x3dd0('0x2d')]=_[_0x3dd0('0x2a')](_0x19b2ac,_0x3dd0('0x2e'));_0x4682d9[_0x3dd0('0x2f')]=_[_0x3dd0('0x30')](_0x3f7b62[_0x3dd0('0x2f')]);_0x4682d9[_0x3dd0('0x31')]=_['intersection'](_0x4682d9[_0x3dd0('0x2d')],_0x4682d9[_0x3dd0('0x2f')]);_0x201599[_0x3dd0('0x32')]=_[_0x3dd0('0x33')](_0x4682d9[_0x3dd0('0x2d')],qs[_0x3dd0('0x34')](_0x3f7b62[_0x3dd0('0x2f')]['fields']));_0x201599['attributes']=_0x201599['attributes'][_0x3dd0('0x35')]?_0x201599[_0x3dd0('0x32')]:_0x4682d9[_0x3dd0('0x2d')];if(!_0x3f7b62['query']['hasOwnProperty'](_0x3dd0('0x36'))){_0x201599[_0x3dd0('0x1d')]=qs[_0x3dd0('0x1d')](_0x3f7b62[_0x3dd0('0x2f')]['limit']);_0x201599[_0x3dd0('0x1b')]=qs[_0x3dd0('0x1b')](_0x3f7b62['query'][_0x3dd0('0x1b')]);}_0x201599['order']=qs['sort'](_0x3f7b62[_0x3dd0('0x2f')][_0x3dd0('0x37')]);_0x201599[_0x3dd0('0x38')]=qs[_0x3dd0('0x31')](_[_0x3dd0('0x39')](_0x3f7b62[_0x3dd0('0x2f')],_0x4682d9[_0x3dd0('0x31')]),_0x19b2ac);if(_0x3f7b62[_0x3dd0('0x2f')][_0x3dd0('0x3a')]){_0x201599['where']=_[_0x3dd0('0x3b')](_0x201599[_0x3dd0('0x38')],{'$or':_['map'](_0x19b2ac,function(_0x17da16){if(_0x17da16[_0x3dd0('0x3c')]!=='VIRTUAL'){var _0x54ada9={};_0x54ada9[_0x17da16[_0x3dd0('0x2e')]]={'$like':'%'+_0x3f7b62['query'][_0x3dd0('0x3a')]+'%'};return _0x54ada9;}})});}_0x201599=_['merge']({},_0x201599,_0x3f7b62[_0x3dd0('0x3d')]);var _0x497589={'where':_0x201599[_0x3dd0('0x38')]};return db[_0x3dd0('0x2b')][_0x3dd0('0x1e')](_0x497589)[_0x3dd0('0x22')](function(_0x197c95){_0x2ea22f['count']=_0x197c95;if(_0x3f7b62['query'][_0x3dd0('0x3e')]){_0x201599['include']=[{'all':!![]}];}return db['Tag'][_0x3dd0('0x3f')](_0x201599);})[_0x3dd0('0x22')](function(_0xd6ef58){_0x2ea22f[_0x3dd0('0x40')]=_0xd6ef58;return _0x2ea22f;})['then'](respondWithFilteredResult(_0x881acd,_0x201599))['catch'](handleError(_0x881acd,null));};exports[_0x3dd0('0x41')]=function(_0x34ba66,_0xad4eb1){var _0x3fdf54={'raw':!![],'where':{'id':_0x34ba66['params']['id']}},_0x3a96db={};_0x3a96db[_0x3dd0('0x2d')]=_['keys'](db[_0x3dd0('0x2b')][_0x3dd0('0x42')]);_0x3a96db['query']=_[_0x3dd0('0x30')](_0x34ba66[_0x3dd0('0x2f')]);_0x3a96db[_0x3dd0('0x31')]=_[_0x3dd0('0x33')](_0x3a96db[_0x3dd0('0x2d')],_0x3a96db[_0x3dd0('0x2f')]);_0x3fdf54[_0x3dd0('0x32')]=_[_0x3dd0('0x33')](_0x3a96db[_0x3dd0('0x2d')],qs[_0x3dd0('0x34')](_0x34ba66[_0x3dd0('0x2f')][_0x3dd0('0x34')]));_0x3fdf54['attributes']=_0x3fdf54[_0x3dd0('0x32')][_0x3dd0('0x35')]?_0x3fdf54[_0x3dd0('0x32')]:_0x3a96db[_0x3dd0('0x2d')];if(_0x34ba66[_0x3dd0('0x2f')][_0x3dd0('0x3e')]){_0x3fdf54['include']=[{'all':!![]}];}_0x3fdf54=_[_0x3dd0('0x3b')]({},_0x3fdf54,_0x34ba66[_0x3dd0('0x3d')]);return db[_0x3dd0('0x2b')][_0x3dd0('0x43')](_0x3fdf54)[_0x3dd0('0x22')](handleEntityNotFound(_0xad4eb1,null))['then'](respondWithResult(_0xad4eb1,null))['catch'](handleError(_0xad4eb1,null));};exports[_0x3dd0('0x44')]=function(_0x2b6361,_0x312c8b){return db['Tag'][_0x3dd0('0x44')](_0x2b6361[_0x3dd0('0x45')],{})[_0x3dd0('0x22')](function(_0x76e263){var _0x2bd6e2=_0x2b6361[_0x3dd0('0x46')][_0x3dd0('0x24')]({'plain':!![]});if(!_0x2bd6e2)throw new Error(_0x3dd0('0x47'));if(_0x2bd6e2[_0x3dd0('0x48')]===_0x3dd0('0x46')){var _0x35d6ac=_0x76e263['get']({'plain':!![]});var _0x339f5f=_0x3dd0('0x49');return db[_0x3dd0('0x4a')][_0x3dd0('0x43')]({'where':{'name':_0x339f5f,'userProfileId':_0x2bd6e2[_0x3dd0('0x4b')]},'raw':!![]})[_0x3dd0('0x22')](function(_0x176a01){if(_0x176a01&&_0x176a01[_0x3dd0('0x4c')]===0x0){return db[_0x3dd0('0x25')][_0x3dd0('0x44')]({'name':_0x35d6ac[_0x3dd0('0x2e')],'resourceId':_0x35d6ac['id'],'type':_0x176a01[_0x3dd0('0x2e')],'sectionId':_0x176a01['id']},{})['then'](function(){return _0x76e263;});}else{return _0x76e263;}})[_0x3dd0('0x4d')](function(_0x1b8db7){logger[_0x3dd0('0x26')](_0x3dd0('0x4e'),_0x1b8db7);throw _0x1b8db7;});}return _0x76e263;})['then'](respondWithResult(_0x312c8b,0xc9))['catch'](handleError(_0x312c8b,null));};exports['update']=function(_0x11011f,_0x19e82c){if(_0x11011f[_0x3dd0('0x45')]['id']){delete _0x11011f[_0x3dd0('0x45')]['id'];}return db[_0x3dd0('0x2b')][_0x3dd0('0x43')]({'where':{'id':_0x11011f['params']['id']}})[_0x3dd0('0x22')](handleEntityNotFound(_0x19e82c,null))['then'](saveUpdates(_0x11011f[_0x3dd0('0x45')],null))['then'](respondWithResult(_0x19e82c,null))[_0x3dd0('0x4d')](handleError(_0x19e82c,null));};exports[_0x3dd0('0x23')]=function(_0x158f59,_0x5c49f5){return db[_0x3dd0('0x2b')][_0x3dd0('0x43')]({'where':{'id':_0x158f59[_0x3dd0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c49f5,null))['then'](removeEntity(_0x5c49f5,null))['catch'](handleError(_0x5c49f5,null));};exports[_0x3dd0('0x50')]=function(_0x11d6e6,_0x3cbc1a){return db[_0x3dd0('0x2b')]['describe']()['then'](respondWithResult(_0x3cbc1a,null))[_0x3dd0('0x4d')](handleError(_0x3cbc1a,null));}; \ No newline at end of file +var _0x3893=['../../config/utils','../../config/license/util','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','Tags','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Tag','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2e8fd1,_0x17377c){var _0x1d6927=function(_0x4743fc){while(--_0x4743fc){_0x2e8fd1['push'](_0x2e8fd1['shift']());}};_0x1d6927(++_0x17377c);}(_0x3893,0x1f0));var _0x3389=function(_0x460d3c,_0x3786ee){_0x460d3c=_0x460d3c-0x0;var _0x205e7e=_0x3893[_0x460d3c];return _0x205e7e;};'use strict';var emlformat=require(_0x3389('0x0'));var rimraf=require(_0x3389('0x1'));var zipdir=require(_0x3389('0x2'));var jsonpatch=require(_0x3389('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3389('0x4'));var Mustache=require(_0x3389('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3389('0x6'));var csv=require(_0x3389('0x7'));var ejs=require(_0x3389('0x8'));var fs=require('fs');var fs_extra=require(_0x3389('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3389('0xa'));var jsforce=require(_0x3389('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3389('0x7'));var querystring=require(_0x3389('0xc'));var Papa=require(_0x3389('0xd'));var Redis=require('ioredis');var authService=require(_0x3389('0xe'));var qs=require(_0x3389('0xf'));var as=require(_0x3389('0x10'));var hardwareService=require(_0x3389('0x11'));var logger=require(_0x3389('0x12'))(_0x3389('0x13'));var utils=require(_0x3389('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3389('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a1fee,_0x4291a6){_0x4291a6=_0x4291a6||0xcc;return function(_0x5f46e9){if(_0x5f46e9){return _0x5a1fee['sendStatus'](_0x4291a6);}return _0x5a1fee['status'](_0x4291a6)[_0x3389('0x16')]();};}function respondWithResult(_0x3f3d4a,_0x561659){_0x561659=_0x561659||0xc8;return function(_0x3993ff){if(_0x3993ff){return _0x3f3d4a[_0x3389('0x17')](_0x561659)['json'](_0x3993ff);}};}function respondWithFilteredResult(_0x30359d,_0x54c89c){return function(_0x170aac){if(_0x170aac){var _0x267292=typeof _0x54c89c[_0x3389('0x18')]===_0x3389('0x19')&&typeof _0x54c89c[_0x3389('0x1a')]===_0x3389('0x19');var _0x129169=_0x170aac[_0x3389('0x1b')];var _0x96351d=_0x267292?0x0:_0x54c89c[_0x3389('0x18')];var _0x1793e8=_0x267292?_0x170aac[_0x3389('0x1b')]:_0x54c89c[_0x3389('0x18')]+_0x54c89c[_0x3389('0x1a')];var _0x23543e;if(_0x1793e8>=_0x129169){_0x1793e8=_0x129169;_0x23543e=0xc8;}else{_0x23543e=0xce;}_0x30359d[_0x3389('0x17')](_0x23543e);return _0x30359d[_0x3389('0x1c')](_0x3389('0x1d'),_0x96351d+'-'+_0x1793e8+'/'+_0x129169)[_0x3389('0x1e')](_0x170aac);}return null;};}function patchUpdates(_0x3180c1){return function(_0x5f333d){try{jsonpatch[_0x3389('0x1f')](_0x5f333d,_0x3180c1,!![]);}catch(_0x22d0a0){return BPromise[_0x3389('0x20')](_0x22d0a0);}return _0x5f333d[_0x3389('0x21')]();};}function saveUpdates(_0x4affe6,_0x2af599){return function(_0x3f0d26){if(_0x3f0d26){return _0x3f0d26[_0x3389('0x22')](_0x4affe6)[_0x3389('0x23')](function(_0x4b41a4){return _0x4b41a4;});}return null;};}function removeEntity(_0x25d57f,_0x31131c){return function(_0x3708a8){if(_0x3708a8){return _0x3708a8['destroy']()['then'](function(){var _0x50b850=_0x3708a8['get']({'plain':!![]});var _0x12b06c=_0x3389('0x24');return db[_0x3389('0x25')][_0x3389('0x26')]({'where':{'type':_0x12b06c,'resourceId':_0x50b850['id']}})[_0x3389('0x23')](function(){return _0x3708a8;});})[_0x3389('0x23')](function(){_0x25d57f['status'](0xcc)[_0x3389('0x16')]();});}};}function handleEntityNotFound(_0x4f1ce6,_0x13b0c4){return function(_0x371b37){if(!_0x371b37){_0x4f1ce6['sendStatus'](0x194);}return _0x371b37;};}function handleError(_0x56d050,_0x1294c9){_0x1294c9=_0x1294c9||0x1f4;return function(_0x53043c){logger[_0x3389('0x27')](_0x53043c['stack']);if(_0x53043c[_0x3389('0x28')]){delete _0x53043c[_0x3389('0x28')];}_0x56d050[_0x3389('0x17')](_0x1294c9)[_0x3389('0x29')](_0x53043c);};}exports[_0x3389('0x2a')]=function(_0x895fd1,_0x1ab219){var _0x3f7f60={},_0x3a943b={},_0x4e652e={'count':0x0,'rows':[]};var _0x2f680f=_[_0x3389('0x2b')](db['Tag'][_0x3389('0x2c')],function(_0x8884ea){return{'name':_0x8884ea[_0x3389('0x2d')],'type':_0x8884ea[_0x3389('0x2e')][_0x3389('0x2f')]};});_0x3a943b[_0x3389('0x30')]=_[_0x3389('0x2b')](_0x2f680f,_0x3389('0x28'));_0x3a943b[_0x3389('0x31')]=_[_0x3389('0x32')](_0x895fd1[_0x3389('0x31')]);_0x3a943b[_0x3389('0x33')]=_[_0x3389('0x34')](_0x3a943b[_0x3389('0x30')],_0x3a943b[_0x3389('0x31')]);_0x3f7f60['attributes']=_[_0x3389('0x34')](_0x3a943b[_0x3389('0x30')],qs[_0x3389('0x35')](_0x895fd1['query'][_0x3389('0x35')]));_0x3f7f60[_0x3389('0x36')]=_0x3f7f60[_0x3389('0x36')][_0x3389('0x37')]?_0x3f7f60[_0x3389('0x36')]:_0x3a943b[_0x3389('0x30')];if(!_0x895fd1[_0x3389('0x31')][_0x3389('0x38')](_0x3389('0x39'))){_0x3f7f60['limit']=qs[_0x3389('0x1a')](_0x895fd1[_0x3389('0x31')]['limit']);_0x3f7f60[_0x3389('0x18')]=qs[_0x3389('0x18')](_0x895fd1[_0x3389('0x31')][_0x3389('0x18')]);}_0x3f7f60[_0x3389('0x3a')]=qs['sort'](_0x895fd1[_0x3389('0x31')][_0x3389('0x3b')]);_0x3f7f60[_0x3389('0x3c')]=qs[_0x3389('0x33')](_[_0x3389('0x3d')](_0x895fd1[_0x3389('0x31')],_0x3a943b['filters']),_0x2f680f);if(_0x895fd1[_0x3389('0x31')][_0x3389('0x3e')]){_0x3f7f60[_0x3389('0x3c')]=_[_0x3389('0x3f')](_0x3f7f60[_0x3389('0x3c')],{'$or':_['map'](_0x2f680f,function(_0x5b6e33){if(_0x5b6e33[_0x3389('0x2e')]!==_0x3389('0x40')){var _0x440b1c={};_0x440b1c[_0x5b6e33[_0x3389('0x28')]]={'$like':'%'+_0x895fd1[_0x3389('0x31')]['filter']+'%'};return _0x440b1c;}})});}_0x3f7f60=_[_0x3389('0x3f')]({},_0x3f7f60,_0x895fd1[_0x3389('0x41')]);var _0x548dae={'where':_0x3f7f60['where']};return db[_0x3389('0x42')][_0x3389('0x1b')](_0x548dae)[_0x3389('0x23')](function(_0x2be83d){_0x4e652e['count']=_0x2be83d;if(_0x895fd1[_0x3389('0x31')][_0x3389('0x43')]){_0x3f7f60[_0x3389('0x44')]=[{'all':!![]}];}return db[_0x3389('0x42')][_0x3389('0x45')](_0x3f7f60);})[_0x3389('0x23')](function(_0x16a239){_0x4e652e[_0x3389('0x46')]=_0x16a239;return _0x4e652e;})[_0x3389('0x23')](respondWithFilteredResult(_0x1ab219,_0x3f7f60))[_0x3389('0x47')](handleError(_0x1ab219,null));};exports[_0x3389('0x48')]=function(_0x18c98f,_0x12024d){var _0x19f334={'raw':!![],'where':{'id':_0x18c98f[_0x3389('0x49')]['id']}},_0x535e0e={};_0x535e0e['model']=_[_0x3389('0x32')](db[_0x3389('0x42')]['rawAttributes']);_0x535e0e[_0x3389('0x31')]=_['keys'](_0x18c98f[_0x3389('0x31')]);_0x535e0e['filters']=_[_0x3389('0x34')](_0x535e0e[_0x3389('0x30')],_0x535e0e['query']);_0x19f334[_0x3389('0x36')]=_['intersection'](_0x535e0e[_0x3389('0x30')],qs[_0x3389('0x35')](_0x18c98f['query']['fields']));_0x19f334[_0x3389('0x36')]=_0x19f334[_0x3389('0x36')][_0x3389('0x37')]?_0x19f334[_0x3389('0x36')]:_0x535e0e[_0x3389('0x30')];if(_0x18c98f['query'][_0x3389('0x43')]){_0x19f334['include']=[{'all':!![]}];}_0x19f334=_[_0x3389('0x3f')]({},_0x19f334,_0x18c98f[_0x3389('0x41')]);return db[_0x3389('0x42')][_0x3389('0x4a')](_0x19f334)[_0x3389('0x23')](handleEntityNotFound(_0x12024d,null))[_0x3389('0x23')](respondWithResult(_0x12024d,null))[_0x3389('0x47')](handleError(_0x12024d,null));};exports[_0x3389('0x4b')]=function(_0x7ba3ce,_0x44fb44){return db[_0x3389('0x42')]['create'](_0x7ba3ce['body'],{})[_0x3389('0x23')](function(_0x41e634){var _0x55f26f=_0x7ba3ce[_0x3389('0x4c')]['get']({'plain':!![]});if(!_0x55f26f)throw new Error(_0x3389('0x4d'));if(_0x55f26f[_0x3389('0x4e')]==='user'){var _0x4b7ad1=_0x41e634[_0x3389('0x4f')]({'plain':!![]});var _0x485447=_0x3389('0x24');return db[_0x3389('0x50')][_0x3389('0x4a')]({'where':{'name':_0x485447,'userProfileId':_0x55f26f[_0x3389('0x51')]},'raw':!![]})[_0x3389('0x23')](function(_0x32869d){if(_0x32869d&&_0x32869d[_0x3389('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x4b7ad1[_0x3389('0x28')],'resourceId':_0x4b7ad1['id'],'type':_0x32869d[_0x3389('0x28')],'sectionId':_0x32869d['id']},{})['then'](function(){return _0x41e634;});}else{return _0x41e634;}})[_0x3389('0x47')](function(_0x31559b){logger['error'](_0x3389('0x53'),_0x31559b);throw _0x31559b;});}return _0x41e634;})[_0x3389('0x23')](respondWithResult(_0x44fb44,0xc9))[_0x3389('0x47')](handleError(_0x44fb44,null));};exports[_0x3389('0x22')]=function(_0xbc1b23,_0x11207f){if(_0xbc1b23[_0x3389('0x54')]['id']){delete _0xbc1b23[_0x3389('0x54')]['id'];}return db[_0x3389('0x42')][_0x3389('0x4a')]({'where':{'id':_0xbc1b23[_0x3389('0x49')]['id']}})[_0x3389('0x23')](handleEntityNotFound(_0x11207f,null))[_0x3389('0x23')](saveUpdates(_0xbc1b23['body'],null))[_0x3389('0x23')](respondWithResult(_0x11207f,null))[_0x3389('0x47')](handleError(_0x11207f,null));};exports[_0x3389('0x26')]=function(_0x546834,_0x498294){return db[_0x3389('0x42')][_0x3389('0x4a')]({'where':{'id':_0x546834[_0x3389('0x49')]['id']}})[_0x3389('0x23')](handleEntityNotFound(_0x498294,null))[_0x3389('0x23')](removeEntity(_0x498294,null))['catch'](handleError(_0x498294,null));};exports[_0x3389('0x55')]=function(_0x2b3562,_0x5a2bc7){return db[_0x3389('0x42')][_0x3389('0x55')]()[_0x3389('0x23')](respondWithResult(_0x5a2bc7,null))[_0x3389('0x47')](handleError(_0x5a2bc7,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index fb46003..587a4e2 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 _0x20cb=['api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','util','../../config/logger'];(function(_0x2bfe47,_0x2dfbdd){var _0x526029=function(_0x28ccf3){while(--_0x28ccf3){_0x2bfe47['push'](_0x2bfe47['shift']());}};_0x526029(++_0x2dfbdd);}(_0x20cb,0x12a));var _0xb20c=function(_0xe7514c,_0x44f623){_0xe7514c=_0xe7514c-0x0;var _0x54c7bb=_0x20cb[_0xe7514c];return _0x54c7bb;};'use strict';var _=require('lodash');var util=require(_0xb20c('0x0'));var logger=require(_0xb20c('0x1'))(_0xb20c('0x2'));var moment=require(_0xb20c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb20c('0x4'));var fs=require('fs');var path=require(_0xb20c('0x5'));var rimraf=require(_0xb20c('0x6'));var config=require(_0xb20c('0x7'));var attributes=require(_0xb20c('0x8'));module[_0xb20c('0x9')]=function(_0x1a6d94,_0x49b697){return _0x1a6d94['define'](_0xb20c('0xa'),attributes,{'tableName':_0xb20c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e77=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./tag.attributes','exports','define','lodash'];(function(_0x5cf215,_0x39a9c2){var _0x15a6cf=function(_0x524b72){while(--_0x524b72){_0x5cf215['push'](_0x5cf215['shift']());}};_0x15a6cf(++_0x39a9c2);}(_0x9e77,0x1df));var _0x79e7=function(_0x3dd2eb,_0x87ba5c){_0x3dd2eb=_0x3dd2eb-0x0;var _0x44fad9=_0x9e77[_0x3dd2eb];return _0x44fad9;};'use strict';var _=require(_0x79e7('0x0'));var util=require(_0x79e7('0x1'));var logger=require(_0x79e7('0x2'))(_0x79e7('0x3'));var moment=require('moment');var BPromise=require(_0x79e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x79e7('0x5'));var config=require(_0x79e7('0x6'));var attributes=require(_0x79e7('0x7'));module[_0x79e7('0x8')]=function(_0x2df64a,_0x5146ec){return _0x2df64a[_0x79e7('0x9')]('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 e9ef183..d436f64 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 _0xe5d5=['request\x20sent','result','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0xe5d5,0x156));var _0x5e5d=function(_0x54a94f,_0x2d2876){_0x54a94f=_0x54a94f-0x0;var _0x4a098c=_0xe5d5[_0x54a94f];return _0x4a098c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e5d('0x0'));var BPromise=require('bluebird');var rs=require(_0x5e5d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e5d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e5d('0x3'))(_0x5e5d('0x4'));var config=require(_0x5e5d('0x5'));var jayson=require(_0x5e5d('0x6'));var client=jayson[_0x5e5d('0x7')][_0x5e5d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3200d5,_0xab446c,_0x23de8d){return new BPromise(function(_0x131a59,_0x11973c){return client[_0x5e5d('0x9')](_0x3200d5,_0x23de8d)[_0x5e5d('0xa')](function(_0x5d3a3b){logger['info'](_0x5e5d('0xb'),_0xab446c,'request\x20sent');logger[_0x5e5d('0xc')](_0x5e5d('0xd'),_0xab446c,'request\x20sent',JSON[_0x5e5d('0xe')](_0x5d3a3b));if(_0x5d3a3b[_0x5e5d('0xf')]){if(_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x10')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0xab446c,_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x11')]);return _0x11973c(_0x5d3a3b['error'][_0x5e5d('0x11')]);}logger[_0x5e5d('0xf')]('Tag,\x20%s,\x20%s',_0xab446c,_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x11')]);return _0x131a59(_0x5d3a3b['error']['message']);}else{logger['info'](_0x5e5d('0xb'),_0xab446c,_0x5e5d('0x12'));_0x131a59(_0x5d3a3b[_0x5e5d('0x13')][_0x5e5d('0x11')]);}})['catch'](function(_0x132532){logger[_0x5e5d('0xf')](_0x5e5d('0xb'),_0xab446c,_0x132532);_0x11973c(_0x132532);});});} \ No newline at end of file +var _0x202c=['message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1dbb03,_0x5dddc1){var _0x593277=function(_0x3a17cc){while(--_0x3a17cc){_0x1dbb03['push'](_0x1dbb03['shift']());}};_0x593277(++_0x5dddc1);}(_0x202c,0x178));var _0xc202=function(_0x10348b,_0x48d5c2){_0x10348b=_0x10348b-0x0;var _0x5c74f9=_0x202c[_0x10348b];return _0x5c74f9;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc202('0x1'));var rs=require(_0xc202('0x2'));var fs=require('fs');var Redis=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc202('0x4'));var logger=require(_0xc202('0x5'))(_0xc202('0x6'));var config=require(_0xc202('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc202('0x8')][_0xc202('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59563a,_0xc2b3eb,_0x574549){return new BPromise(function(_0x872c1a,_0x5978fe){return client[_0xc202('0xa')](_0x59563a,_0x574549)[_0xc202('0xb')](function(_0x36fcb7){logger[_0xc202('0xc')](_0xc202('0xd'),_0xc2b3eb,_0xc202('0xe'));logger[_0xc202('0xf')](_0xc202('0x10'),_0xc2b3eb,_0xc202('0xe'),JSON[_0xc202('0x11')](_0x36fcb7));if(_0x36fcb7[_0xc202('0x12')]){if(_0x36fcb7['error'][_0xc202('0x13')]===0x1f4){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);return _0x5978fe(_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);}logger['error'](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')]['message']);return _0x872c1a(_0x36fcb7['error']['message']);}else{logger[_0xc202('0xc')]('Tag,\x20%s,\x20%s',_0xc2b3eb,_0xc202('0xe'));_0x872c1a(_0x36fcb7['result'][_0xc202('0x14')]);}})[_0xc202('0x15')](function(_0x3018c8){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x3018c8);_0x5978fe(_0x3018c8);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 880fc6e..21eb4c0 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 f9cba25..ad2c961 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0xaa8a12,_0x4b02fa){var _0xe8546e=function(_0x4b90bd){while(--_0x4b90bd){_0xaa8a12['push'](_0xaa8a12['shift']());}};_0xe8546e(++_0x4b02fa);}(_0x2032,0xd9));var _0x2203=function(_0x3d4007,_0x95eb6a){_0x3d4007=_0x3d4007-0x0;var _0x23d47c=_0x2032[_0x3d4007];return _0x23d47c;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x4295b6,_0x299340){var _0x344662=function(_0x32590a){while(--_0x32590a){_0x4295b6['push'](_0x4295b6['shift']());}};_0x344662(++_0x299340);}(_0xb10b,0x12a));var _0xbb10=function(_0x103478,_0x353eca){_0x103478=_0x103478-0x0;var _0x55d015=_0xb10b[_0x103478];return _0x55d015;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 64a7d08..079deac 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 _0x0464=['Sms','Fax','Whatsapp','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','Team','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','merge','where','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','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','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','order','sort','pick','toLowerCase','addQueues','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Openchannel','transaction','through','penalty','defaults','User','Queue','emit','Queue:save','QueueId','online','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','isArray'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x0464,0xa7));var _0x4046=function(_0x9e2cfe,_0x57d5b9){_0x9e2cfe=_0x9e2cfe-0x0;var _0x1f2d2b=_0x0464[_0x9e2cfe];return _0x1f2d2b;};'use strict';var emlformat=require(_0x4046('0x0'));var rimraf=require(_0x4046('0x1'));var zipdir=require(_0x4046('0x2'));var jsonpatch=require(_0x4046('0x3'));var rp=require(_0x4046('0x4'));var moment=require(_0x4046('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4046('0x6'));var util=require('util');var path=require(_0x4046('0x7'));var sox=require(_0x4046('0x8'));var csv=require(_0x4046('0x9'));var ejs=require(_0x4046('0xa'));var fs=require('fs');var fs_extra=require(_0x4046('0xb'));var _=require('lodash');var squel=require(_0x4046('0xc'));var crypto=require(_0x4046('0xd'));var jsforce=require(_0x4046('0xe'));var deskjs=require(_0x4046('0xf'));var toCsv=require(_0x4046('0x9'));var querystring=require(_0x4046('0x10'));var Papa=require(_0x4046('0x11'));var Redis=require(_0x4046('0x12'));var authService=require(_0x4046('0x13'));var qs=require(_0x4046('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4046('0x15'))(_0x4046('0x16'));var utils=require(_0x4046('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4046('0x18'))['db'];config[_0x4046('0x19')]=_['defaults'](config[_0x4046('0x19')],{'host':_0x4046('0x1a'),'port':0x18eb});var socket=require(_0x4046('0x1b'))(new Redis(config[_0x4046('0x19')]));require(_0x4046('0x1c'))[_0x4046('0x1d')](socket);function respondWithStatusCode(_0x5963fe,_0x24ee18){_0x24ee18=_0x24ee18||0xcc;return function(_0x46540d){if(_0x46540d){return _0x5963fe[_0x4046('0x1e')](_0x24ee18);}return _0x5963fe[_0x4046('0x1f')](_0x24ee18)[_0x4046('0x20')]();};}function respondWithResult(_0x308c86,_0x19b362){_0x19b362=_0x19b362||0xc8;return function(_0x4cd925){if(_0x4cd925){return _0x308c86[_0x4046('0x1f')](_0x19b362)[_0x4046('0x21')](_0x4cd925);}};}function respondWithFilteredResult(_0x53f6aa,_0x1c0b11){return function(_0x194e3c){if(_0x194e3c){var _0x21d9bc=typeof _0x1c0b11[_0x4046('0x22')]===_0x4046('0x23')&&typeof _0x1c0b11[_0x4046('0x24')]==='undefined';var _0x176362=_0x194e3c[_0x4046('0x25')];var _0x551632=_0x21d9bc?0x0:_0x1c0b11[_0x4046('0x22')];var _0x3a2ea7=_0x21d9bc?_0x194e3c['count']:_0x1c0b11[_0x4046('0x22')]+_0x1c0b11['limit'];var _0x53c888;if(_0x3a2ea7>=_0x176362){_0x3a2ea7=_0x176362;_0x53c888=0xc8;}else{_0x53c888=0xce;}_0x53f6aa[_0x4046('0x1f')](_0x53c888);return _0x53f6aa[_0x4046('0x26')](_0x4046('0x27'),_0x551632+'-'+_0x3a2ea7+'/'+_0x176362)[_0x4046('0x21')](_0x194e3c);}return null;};}function patchUpdates(_0x256a87){return function(_0x16f968){try{jsonpatch[_0x4046('0x28')](_0x16f968,_0x256a87,!![]);}catch(_0x1ef6ef){return BPromise[_0x4046('0x29')](_0x1ef6ef);}return _0x16f968[_0x4046('0x2a')]();};}function saveUpdates(_0x428817,_0x478f55){return function(_0x5bca6b){if(_0x5bca6b){return _0x5bca6b['update'](_0x428817)[_0x4046('0x2b')](function(_0x51b525){return _0x51b525;});}return null;};}function handleEntityNotFound(_0x1a4326,_0x9e76e3){return function(_0x15c259){if(!_0x15c259){_0x1a4326[_0x4046('0x1e')](0x194);}return _0x15c259;};}function handleError(_0x43f69a,_0x18be24){_0x18be24=_0x18be24||0x1f4;return function(_0x1bed2e){logger[_0x4046('0x2c')](_0x1bed2e['stack']);if(_0x1bed2e[_0x4046('0x2d')]){delete _0x1bed2e[_0x4046('0x2d')];}_0x43f69a['status'](_0x18be24)[_0x4046('0x2e')](_0x1bed2e);};}exports[_0x4046('0x2f')]=function(_0x4c8b4c,_0x384929){var _0x50a4f8={},_0x1d663a={},_0x2a3ce5={'count':0x0,'rows':[]};var _0x34aaf9=_[_0x4046('0x30')](db[_0x4046('0x31')][_0x4046('0x32')],function(_0xe1e369){return{'name':_0xe1e369['fieldName'],'type':_0xe1e369[_0x4046('0x33')][_0x4046('0x34')]};});_0x1d663a[_0x4046('0x35')]=_['map'](_0x34aaf9,_0x4046('0x2d'));_0x1d663a[_0x4046('0x36')]=_['keys'](_0x4c8b4c['query']);_0x1d663a[_0x4046('0x37')]=_['intersection'](_0x1d663a[_0x4046('0x35')],_0x1d663a[_0x4046('0x36')]);_0x50a4f8[_0x4046('0x38')]=_[_0x4046('0x39')](_0x1d663a[_0x4046('0x35')],qs[_0x4046('0x3a')](_0x4c8b4c['query'][_0x4046('0x3a')]));_0x50a4f8['attributes']=_0x50a4f8[_0x4046('0x38')][_0x4046('0x3b')]?_0x50a4f8['attributes']:_0x1d663a[_0x4046('0x35')];if(!_0x4c8b4c[_0x4046('0x36')][_0x4046('0x3c')](_0x4046('0x3d'))){_0x50a4f8[_0x4046('0x24')]=qs[_0x4046('0x24')](_0x4c8b4c[_0x4046('0x36')][_0x4046('0x24')]);_0x50a4f8[_0x4046('0x22')]=qs[_0x4046('0x22')](_0x4c8b4c[_0x4046('0x36')][_0x4046('0x22')]);}_0x50a4f8['order']=qs['sort'](_0x4c8b4c[_0x4046('0x36')]['sort']);_0x50a4f8['where']=qs[_0x4046('0x37')](_['pick'](_0x4c8b4c[_0x4046('0x36')],_0x1d663a[_0x4046('0x37')]),_0x34aaf9);if(_0x4c8b4c[_0x4046('0x36')]['filter']){_0x50a4f8['where']=_[_0x4046('0x3e')](_0x50a4f8[_0x4046('0x3f')],{'$or':_[_0x4046('0x30')](_0x34aaf9,function(_0x4ab8d6){if(_0x4ab8d6[_0x4046('0x33')]!=='VIRTUAL'){var _0x4893f3={};_0x4893f3[_0x4ab8d6[_0x4046('0x2d')]]={'$like':'%'+_0x4c8b4c['query'][_0x4046('0x40')]+'%'};return _0x4893f3;}})});}_0x50a4f8=_[_0x4046('0x3e')]({},_0x50a4f8,_0x4c8b4c[_0x4046('0x41')]);var _0x2a2fc5={'where':_0x50a4f8['where']};return db['Team'][_0x4046('0x25')](_0x2a2fc5)[_0x4046('0x2b')](function(_0x217e32){_0x2a3ce5[_0x4046('0x25')]=_0x217e32;if(_0x4c8b4c[_0x4046('0x36')][_0x4046('0x42')]){_0x50a4f8['include']=[{'all':!![]}];}return db['Team'][_0x4046('0x43')](_0x50a4f8);})[_0x4046('0x2b')](function(_0x34f8b0){_0x2a3ce5[_0x4046('0x44')]=_0x34f8b0;return _0x2a3ce5;})['then'](respondWithFilteredResult(_0x384929,_0x50a4f8))['catch'](handleError(_0x384929,null));};exports[_0x4046('0x45')]=function(_0xf7fb37,_0x27e4a3){var _0x284236={'raw':![],'where':{'id':_0xf7fb37[_0x4046('0x46')]['id']}},_0x5416f9={};_0x5416f9['model']=_[_0x4046('0x47')](db['Team'][_0x4046('0x32')]);_0x5416f9[_0x4046('0x36')]=_['keys'](_0xf7fb37['query']);_0x5416f9[_0x4046('0x37')]=_[_0x4046('0x39')](_0x5416f9[_0x4046('0x35')],_0x5416f9['query']);_0x284236[_0x4046('0x38')]=_['intersection'](_0x5416f9[_0x4046('0x35')],qs[_0x4046('0x3a')](_0xf7fb37[_0x4046('0x36')][_0x4046('0x3a')]));_0x284236[_0x4046('0x38')]=_0x284236[_0x4046('0x38')][_0x4046('0x3b')]?_0x284236['attributes']:_0x5416f9['model'];if(_0xf7fb37[_0x4046('0x36')][_0x4046('0x42')]){_0x284236[_0x4046('0x48')]=[{'all':!![]}];}_0x284236=_[_0x4046('0x3e')]({},_0x284236,_0xf7fb37['options']);return db[_0x4046('0x31')][_0x4046('0x49')](_0x284236)['then'](handleEntityNotFound(_0x27e4a3,null))['then'](respondWithResult(_0x27e4a3,null))[_0x4046('0x4a')](handleError(_0x27e4a3,null));};exports['create']=function(_0x5984c1,_0x472738){return db[_0x4046('0x31')][_0x4046('0x4b')](_0x5984c1[_0x4046('0x4c')],{})[_0x4046('0x2b')](function(_0x56adfe){var _0x5a92d9=_0x5984c1[_0x4046('0x4d')]['get']({'plain':!![]});if(!_0x5a92d9)throw new Error(_0x4046('0x4e'));if(_0x5a92d9['role']===_0x4046('0x4d')){var _0x1ae1ad=_0x56adfe[_0x4046('0x4f')]({'plain':!![]});var _0x36d165=_0x4046('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x36d165,'userProfileId':_0x5a92d9[_0x4046('0x51')]},'raw':!![]})['then'](function(_0x46f74f){if(_0x46f74f&&_0x46f74f[_0x4046('0x52')]===0x0){return db[_0x4046('0x53')][_0x4046('0x4b')]({'name':_0x1ae1ad[_0x4046('0x2d')],'resourceId':_0x1ae1ad['id'],'type':_0x46f74f[_0x4046('0x2d')],'sectionId':_0x46f74f['id']},{})['then'](function(){return _0x56adfe;});}else{return _0x56adfe;}})[_0x4046('0x4a')](function(_0x555d57){logger[_0x4046('0x2c')](_0x4046('0x54'),_0x555d57);throw _0x555d57;});}return _0x56adfe;})[_0x4046('0x2b')](respondWithResult(_0x472738,0xc9))['catch'](handleError(_0x472738,null));};exports[_0x4046('0x55')]=function(_0x27afa4,_0x302e19){if(_0x27afa4['body']['id']){delete _0x27afa4[_0x4046('0x4c')]['id'];}return db[_0x4046('0x31')][_0x4046('0x49')]({'where':{'id':_0x27afa4[_0x4046('0x46')]['id']}})[_0x4046('0x2b')](handleEntityNotFound(_0x302e19,null))[_0x4046('0x2b')](saveUpdates(_0x27afa4[_0x4046('0x4c')],null))[_0x4046('0x2b')](respondWithResult(_0x302e19,null))[_0x4046('0x4a')](handleError(_0x302e19,null));};exports[_0x4046('0x56')]=function(_0x2a796d,_0x5e9a2b){var _0x4c6162=_0x2a796d[_0x4046('0x46')]['id'];var _0x26f6ad=[];return db[_0x4046('0x57')]['transaction'](function(_0x3ca96f){var _0x340744=_0x4046('0x58')+_0x4c6162;return db[_0x4046('0x57')][_0x4046('0x36')](_0x340744,{'type':db[_0x4046('0x59')][_0x4046('0x5a')][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f})[_0x4046('0x2b')](function(_0x5751c9){_0x26f6ad=_[_0x4046('0x30')](_0x5751c9,function(_0x24e005){return Number(_0x24e005[_0x4046('0x5c')]);});})['then'](function(){var _0x4bd2c4=_0x4046('0x5d')+_0x4c6162;return db[_0x4046('0x57')][_0x4046('0x36')](_0x4bd2c4,{'type':db[_0x4046('0x59')][_0x4046('0x5a')][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x5b2c81){var _0xa0d415=_['map'](_0x5b2c81,function(_0x38e3d8){return Number(_0x38e3d8[_0x4046('0x5e')]);});return db[_0x4046('0x5f')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'VoiceQueueId':{'$in':_0xa0d415}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x438755=_0x4046('0x60')+_0x4c6162;return db[_0x4046('0x57')][_0x4046('0x36')](_0x438755,{'type':db[_0x4046('0x59')]['QueryTypes'][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x2f2c0){var _0x3c98d4=_[_0x4046('0x30')](_0x2f2c0,function(_0x303b71){return Number(_0x303b71[_0x4046('0x61')]);});return db[_0x4046('0x62')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'MailQueueId':{'$in':_0x3c98d4}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x31b753=_0x4046('0x63')+_0x4c6162;return db[_0x4046('0x57')][_0x4046('0x36')](_0x31b753,{'type':db[_0x4046('0x59')]['QueryTypes'][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})['then'](function(_0x4a4acd){var _0x5dc1dd=_[_0x4046('0x30')](_0x4a4acd,function(_0x58f505){return Number(_0x58f505['SmsQueueId']);});return db[_0x4046('0x64')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'SmsQueueId':{'$in':_0x5dc1dd}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x88aeee='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4c6162;return db[_0x4046('0x57')]['query'](_0x88aeee,{'type':db[_0x4046('0x59')][_0x4046('0x5a')][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x2afb44){var _0x340389=_['map'](_0x2afb44,function(_0x5494de){return Number(_0x5494de[_0x4046('0x65')]);});return db[_0x4046('0x66')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'ChatQueueId':{'$in':_0x340389}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x3aa7f4=_0x4046('0x67')+_0x4c6162;return db['sequelize'][_0x4046('0x36')](_0x3aa7f4,{'type':db[_0x4046('0x59')][_0x4046('0x5a')]['SELECT'],'raw':!![],'transaction':_0x3ca96f});})['then'](function(_0x5d86ae){var _0x139a76=_[_0x4046('0x30')](_0x5d86ae,function(_0x15acdc){return Number(_0x15acdc[_0x4046('0x68')]);});return db[_0x4046('0x69')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'FaxQueueId':{'$in':_0x139a76}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x4dd68d=_0x4046('0x6a')+_0x4c6162;return db['sequelize'][_0x4046('0x36')](_0x4dd68d,{'type':db[_0x4046('0x59')][_0x4046('0x5a')][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x5598e7){var _0x4e2378=_[_0x4046('0x30')](_0x5598e7,function(_0x37ea9b){return Number(_0x37ea9b[_0x4046('0x6b')]);});return db[_0x4046('0x6c')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'OpenchannelQueueId':{'$in':_0x4e2378}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x5913a0='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4c6162;return db['sequelize'][_0x4046('0x36')](_0x5913a0,{'type':db['Sequelize'][_0x4046('0x5a')]['SELECT'],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x221365){var _0x18a31f=_['map'](_0x221365,function(_0x3c8b0f){return Number(_0x3c8b0f['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'WhatsappQueueId':{'$in':_0x18a31f}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x4c6162}});})[_0x4046('0x2b')](function(_0x3b59e5){if(_0x3b59e5===null){return;}return db[_0x4046('0x6d')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'VoicePrefixId':_0x3b59e5[_0x4046('0x6e')]},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){return db[_0x4046('0x31')][_0x4046('0x56')]({'where':{'id':_0x4c6162},'cascade':!![],'transaction':_0x3ca96f});})['then'](function(_0x593024){if(_0x593024===0x0){_0x5e9a2b['sendStatus'](0x194);}else{return db[_0x4046('0x53')][_0x4046('0x56')]({'where':{'type':'Teams','resourceId':_0x4c6162},'cascade':!![],'transaction':_0x3ca96f})[_0x4046('0x2b')](function(){_0x5e9a2b[_0x4046('0x1f')](0xcc)[_0x4046('0x20')]();});}})['catch'](function(_0x2f80fc){_0x5e9a2b['status'](0x1f4)[_0x4046('0x2e')](_0x2f80fc);});});};exports[_0x4046('0x6f')]=function(_0x309a91,_0x24505,_0x210b81){return db['Team'][_0x4046('0x70')]({'where':{'id':_0x309a91['params']['id']}})[_0x4046('0x2b')](handleEntityNotFound(_0x24505,null))[_0x4046('0x2b')](function(_0x56bc77){if(!_0x309a91[_0x4046('0x36')][_0x4046('0x71')]||!utils[_0x4046('0x72')](_0x309a91['query'][_0x4046('0x71')])){throw new db[(_0x4046('0x59'))][(_0x4046('0x73'))](_0x4046('0x74'));}var _0xbb9b93={};var _0xb9bf33={};_0xb9bf33[_0x4046('0x35')]=_['keys'](db[_[_0x4046('0x75')](_0x309a91[_0x4046('0x36')][_0x4046('0x71')]['toLowerCase']())+'Queue'][_0x4046('0x32')]);_0xb9bf33[_0x4046('0x36')]=_[_0x4046('0x47')](_0x309a91[_0x4046('0x36')]);_0xb9bf33[_0x4046('0x37')]=_[_0x4046('0x39')](_0xb9bf33['model'],_0xb9bf33[_0x4046('0x36')]);_0xbb9b93[_0x4046('0x38')]=_[_0x4046('0x39')](_0xb9bf33[_0x4046('0x35')],qs[_0x4046('0x3a')](_0x309a91[_0x4046('0x36')][_0x4046('0x3a')]));_0xbb9b93[_0x4046('0x38')]=_0xbb9b93[_0x4046('0x38')][_0x4046('0x3b')]?_0xbb9b93[_0x4046('0x38')]:_0xb9bf33[_0x4046('0x35')];_0xbb9b93['limit']=qs['limit'](_0x309a91[_0x4046('0x36')][_0x4046('0x24')]);_0xbb9b93[_0x4046('0x22')]=qs[_0x4046('0x22')](_0x309a91['query'][_0x4046('0x22')]);_0xbb9b93[_0x4046('0x76')]=qs[_0x4046('0x77')](_0x309a91[_0x4046('0x36')]['sort']);_0xbb9b93[_0x4046('0x3f')]=qs[_0x4046('0x37')](_[_0x4046('0x78')](_0x309a91['query'],_0xb9bf33[_0x4046('0x37')]));_0xbb9b93=_[_0x4046('0x3e')]({},_0xbb9b93,_0x309a91[_0x4046('0x41')]);return _0x56bc77[_0x4046('0x4f')+_[_0x4046('0x75')](_0x309a91[_0x4046('0x36')]['channel'][_0x4046('0x79')]())+'Queues'](_0xbb9b93);})[_0x4046('0x2b')](respondWithResult(_0x24505,null))[_0x4046('0x4a')](handleError(_0x24505,null));};exports[_0x4046('0x7a')]=function(_0x5a279e,_0x46d23e,_0x28552f){return db[_0x4046('0x31')][_0x4046('0x70')]({'where':{'id':_0x5a279e[_0x4046('0x46')]['id']}})[_0x4046('0x2b')](function(_0x3cf5b9){if(_0x3cf5b9){if(!_0x5a279e[_0x4046('0x4c')][_0x4046('0x71')]||!utils[_0x4046('0x72')](_0x5a279e[_0x4046('0x4c')][_0x4046('0x71')])){throw new db[(_0x4046('0x59'))][(_0x4046('0x73'))]('Unknown\x20channel');}return _0x3cf5b9[_0x4046('0x7b')+_[_0x4046('0x75')](_0x5a279e['body']['channel'][_0x4046('0x79')]())+_0x4046('0x7c')](_0x5a279e[_0x4046('0x4c')][_0x4046('0x7d')]);}return null;})[_0x4046('0x2b')](handleEntityNotFound(_0x46d23e,null))[_0x4046('0x2b')](respondWithStatusCode(_0x46d23e,null))[_0x4046('0x4a')](handleError(_0x46d23e,null));};exports[_0x4046('0x7e')]=function(_0x4abd2c,_0x5e2035,_0x4ebe28){return db[_0x4046('0x31')][_0x4046('0x70')]({'where':{'id':_0x4abd2c[_0x4046('0x46')]['id']}})[_0x4046('0x2b')](function(_0x1e5c4a){if(_0x1e5c4a){if(!_0x4abd2c['query'][_0x4046('0x71')]||!utils[_0x4046('0x72')](_0x4abd2c['query']['channel'])){throw new db[(_0x4046('0x59'))][(_0x4046('0x73'))](_0x4046('0x74'));}return _0x1e5c4a[_0x4046('0x7f')+_['capitalize'](_0x4abd2c[_0x4046('0x36')][_0x4046('0x71')][_0x4046('0x79')]())+'Queues'](_0x4abd2c[_0x4046('0x36')][_0x4046('0x7d')]);}return null;})[_0x4046('0x2b')](handleEntityNotFound(_0x5e2035,null))[_0x4046('0x2b')](respondWithStatusCode(_0x5e2035,null))[_0x4046('0x4a')](handleError(_0x5e2035,null));};exports[_0x4046('0x80')]=function(_0x278f4d,_0x19741d){var _0x1dc94b=_['isArray'](_0x278f4d['body']['ids'])?_0x278f4d[_0x4046('0x4c')][_0x4046('0x7d')]:[_0x278f4d[_0x4046('0x4c')][_0x4046('0x7d')]];var _0x4177ea=_0x278f4d['params']['id'];return db[_0x4046('0x31')][_0x4046('0x49')]({'where':{'id':_0x4177ea}})[_0x4046('0x2b')](handleEntityNotFound(_0x19741d,null))[_0x4046('0x2b')](function(_0x213d73){if(_0x213d73){var _0x381509=[_0x4046('0x81'),_0x4046('0x82'),_0x4046('0x83'),'Sms','Fax',_0x4046('0x84'),'Whatsapp'];return db[_0x4046('0x57')][_0x4046('0x85')](function(_0x1cf94f){var _0x2f3916=_['map'](_0x381509,function(_0x1b9718){var _0x5ac9d8={'attributes':['id',_0x4046('0x2d')]};if(_0x1b9718===_0x4046('0x81')){_0x5ac9d8[_0x4046('0x86')]={'attributes':[_0x4046('0x87')]};}return _0x213d73[_0x4046('0x4f')+_0x1b9718+_0x4046('0x7c')](_0x5ac9d8)[_0x4046('0x2b')](function(_0x474b62){var _0x319e3b=_[_0x4046('0x30')](_0x474b62,function(_0x482400){var _0x4e1718=_[_0x4046('0x30')](_0x1dc94b,function(_0x396c1f){var _0x434bbc={'where':{'UserId':_0x396c1f,[_0x1b9718+'QueueId']:_0x482400['id']},'transaction':_0x1cf94f};if(_0x1b9718===_0x4046('0x81')){_0x434bbc[_0x4046('0x88')]={'penalty':_0x482400['TeamVoiceQueue'][_0x4046('0x87')]};}return db[_0x4046('0x89')+_0x1b9718+_0x4046('0x8a')]['findOrCreate'](_0x434bbc)['then'](function(){socket[_0x4046('0x8b')](_0x4046('0x4d')+_0x1b9718+_0x4046('0x8c'),{'UserId':_0x396c1f,[_0x1b9718+_0x4046('0x8d')]:_0x482400['id']});if(_0x1b9718!==_0x4046('0x81')){return;}return db[_0x4046('0x89')][_0x4046('0x43')]({'where':{'id':_0x1dc94b,'online':0x1},'attributes':['id',_0x4046('0x2d'),_0x4046('0x8e'),_0x4046('0x8f'),_0x4046('0x90')],'raw':!![]})['then'](function(_0x6bb5c5){var _0x512884=_[_0x4046('0x30')](_0x6bb5c5,function(_0x2d5499){return db['UserVoiceQueueRt'][_0x4046('0x91')]({'membername':_0x2d5499[_0x4046('0x2d')],'UserId':_0x2d5499['id'],'queue_name':_0x482400['name'],'VoiceQueueId':_0x482400['id'],'interface':_[_0x4046('0x92')](_0x2d5499[_0x4046('0x90')])?util[_0x4046('0x93')](_0x4046('0x94'),_0x2d5499[_0x4046('0x2d')]):_0x2d5499['interface'],'paused':_0x2d5499[_0x4046('0x8f')]||![],'penalty':_0x482400[_0x4046('0x95')]['penalty']},{'transaction':_0x1cf94f});});return Promise[_0x4046('0x96')](_0x512884);});});});return Promise[_0x4046('0x96')](_0x4e1718);});return Promise[_0x4046('0x96')](_0x319e3b);})[_0x4046('0x2b')](function(){return db[_0x4046('0x97')][_0x4046('0x70')]({'where':{'teamId':_0x4177ea}})[_0x4046('0x2b')](function(_0x5dd456){if(_0x5dd456){var _0x1cd02b=_[_0x4046('0x30')](_0x1dc94b,function(_0x2feb16){db['UserVoicePrefix'][_0x4046('0x91')]({'UserId':_0x2feb16,'VoicePrefixId':_0x5dd456[_0x4046('0x6e')]});});return Promise[_0x4046('0x96')](_0x1cd02b);}});});});return Promise[_0x4046('0x96')](_0x2f3916)['then'](function(){return _0x213d73['addAgents'](_0x1dc94b,{'transaction':_0x1cf94f})[_0x4046('0x98')](function(_0x1bbe1d){return _0x1bbe1d;});});});}})[_0x4046('0x2b')](respondWithResult(_0x19741d,null))[_0x4046('0x4a')](handleError(_0x19741d,null));};exports[_0x4046('0x99')]=function(_0x5ec768,_0x44cd3a){var _0x2abccc=_[_0x4046('0x9a')](_0x5ec768[_0x4046('0x36')][_0x4046('0x7d')])?_0x5ec768[_0x4046('0x36')]['ids']:[_0x5ec768[_0x4046('0x36')][_0x4046('0x7d')]];var _0x569f46=_0x5ec768[_0x4046('0x46')]['id'];return db[_0x4046('0x31')]['find']({'where':{'id':_0x569f46}})['then'](handleEntityNotFound(_0x44cd3a,null))[_0x4046('0x2b')](function(_0x4d83f3){if(_0x4d83f3){var _0x350a66=[_0x4046('0x81'),'Chat','Mail',_0x4046('0x9b'),_0x4046('0x9c'),_0x4046('0x84'),_0x4046('0x9d')];return db[_0x4046('0x57')][_0x4046('0x85')](function(_0x8f39ee){var _0x567eba=_[_0x4046('0x30')](_0x350a66,function(_0x34def5){var _0x3a9a1c={'attributes':['id',_0x4046('0x2d')]};return _0x4d83f3[_0x4046('0x4f')+_0x34def5+_0x4046('0x7c')](_0x3a9a1c)[_0x4046('0x2b')](function(_0x10404f){var _0xfaec3a=_[_0x4046('0x30')](_0x10404f,function(_0x1f009b){return _0x1f009b['removeAgents'](_0x2abccc,{'transaction':_0x8f39ee})[_0x4046('0x2b')](function(){var _0x2ccd64=_[_0x4046('0x30')](_0x2abccc,function(_0x175730){socket[_0x4046('0x8b')](_0x4046('0x4d')+_0x34def5+_0x4046('0x9e'),{'UserId':Number(_0x175730),[_0x34def5+'QueueId']:_0x1f009b['id']});if(_0x34def5!=='Voice'){return;}return db[_0x4046('0x9f')][_0x4046('0x56')]({'where':{'VoiceQueueId':_0x1f009b['id'],'UserId':_0x175730},'transaction':_0x8f39ee});});return Promise[_0x4046('0x96')](_0x2ccd64);});});return Promise[_0x4046('0x96')](_0xfaec3a);});});return Promise['all'](_0x567eba)[_0x4046('0x2b')](function(){return _0x4d83f3[_0x4046('0x99')](_0x2abccc,{'transaction':_0x8f39ee});})[_0x4046('0x2b')](function(){return db[_0x4046('0x97')][_0x4046('0x70')]({'where':{'teamId':_0x569f46}})['then'](function(_0x80c777){if(_0x80c777){var _0x2f04df=_[_0x4046('0x30')](_0x2abccc,function(_0x10f767){db[_0x4046('0x6d')][_0x4046('0x56')]({'where':{'UserId':_0x10f767,'VoicePrefixId':_0x80c777[_0x4046('0x6e')]}});});return Promise[_0x4046('0x96')](_0x2f04df);}});});});}})[_0x4046('0x2b')](respondWithStatusCode(_0x44cd3a,null))[_0x4046('0x4a')](handleError(_0x44cd3a,null));};exports[_0x4046('0xa0')]=function(_0x37ff16,_0x42d1c1,_0x55e17f){var _0x4902a6={};var _0x46f3e1={};var _0x4c976c;var _0x3ba3fb;return db['Team'][_0x4046('0x70')]({'where':{'id':_0x37ff16[_0x4046('0x46')]['id']}})['then'](handleEntityNotFound(_0x42d1c1,null))[_0x4046('0x2b')](function(_0x29e8f1){if(_0x29e8f1){_0x4c976c=_0x29e8f1;_0x46f3e1[_0x4046('0x35')]=_[_0x4046('0x47')](db[_0x4046('0x89')]['rawAttributes']);_0x46f3e1['query']=_['keys'](_0x37ff16[_0x4046('0x36')]);_0x46f3e1[_0x4046('0x37')]=_[_0x4046('0x39')](_0x46f3e1[_0x4046('0x35')],_0x46f3e1[_0x4046('0x36')]);_0x4902a6[_0x4046('0x38')]=_[_0x4046('0x39')](_0x46f3e1[_0x4046('0x35')],qs['fields'](_0x37ff16['query'][_0x4046('0x3a')]));_0x4902a6[_0x4046('0x38')]=_0x4902a6[_0x4046('0x38')][_0x4046('0x3b')]?_0x4902a6['attributes']:_0x46f3e1['model'];_0x4902a6[_0x4046('0x76')]=qs[_0x4046('0x77')](_0x37ff16[_0x4046('0x36')][_0x4046('0x77')]);_0x4902a6[_0x4046('0x3f')]=qs[_0x4046('0x37')](_['pick'](_0x37ff16[_0x4046('0x36')],_0x46f3e1[_0x4046('0x37')]));if(_0x37ff16[_0x4046('0x36')][_0x4046('0x40')]){_0x4902a6[_0x4046('0x3f')]=_['merge'](_0x4902a6['where'],{'$or':_[_0x4046('0x30')](_0x4902a6[_0x4046('0x38')],function(_0x2ab051){var _0x3aff21={};_0x3aff21[_0x2ab051]={'$like':'%'+_0x37ff16[_0x4046('0x36')][_0x4046('0x40')]+'%'};return _0x3aff21;})});}_0x4902a6=_[_0x4046('0x3e')]({},_0x4902a6,_0x37ff16[_0x4046('0x41')]);return _0x4c976c[_0x4046('0xa0')](_0x4902a6);}})[_0x4046('0x2b')](function(_0x3466d6){if(_0x3466d6){_0x3ba3fb=_0x3466d6[_0x4046('0x3b')];if(!_0x37ff16['query'][_0x4046('0x3c')](_0x4046('0x3d'))){_0x4902a6[_0x4046('0x24')]=qs['limit'](_0x37ff16[_0x4046('0x36')][_0x4046('0x24')]);_0x4902a6['offset']=qs[_0x4046('0x22')](_0x37ff16[_0x4046('0x36')][_0x4046('0x22')]);}return _0x4c976c[_0x4046('0xa0')](_0x4902a6);}})['then'](function(_0x5bbb6e){if(_0x5bbb6e){return _0x5bbb6e?{'count':_0x3ba3fb,'rows':_0x5bbb6e}:null;}})[_0x4046('0x2b')](respondWithResult(_0x42d1c1,null))[_0x4046('0x4a')](handleError(_0x42d1c1,null));}; \ No newline at end of file +var _0xae10=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','Team','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','Sequelize','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','Unknown\x20channel','capitalize','order','get','toLowerCase','addQueues','isValidChannel','ValidationError','add','removeQueues','Queues','ids','addAgents','isArray','Chat','Mail','Openchannel','Whatsapp','Voice','penalty','TeamVoiceQueue','User','Queue','findOrCreate','QueueId','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','upsert','spread','removeAgents','Fax','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x513398,_0x2db9f9){var _0x5cb0b9=function(_0xd2170a){while(--_0xd2170a){_0x513398['push'](_0x513398['shift']());}};_0x5cb0b9(++_0x2db9f9);}(_0xae10,0x88));var _0x0ae1=function(_0x2215f6,_0x43ea64){_0x2215f6=_0x2215f6-0x0;var _0x552aa2=_0xae10[_0x2215f6];return _0x552aa2;};'use strict';var emlformat=require(_0x0ae1('0x0'));var rimraf=require(_0x0ae1('0x1'));var zipdir=require(_0x0ae1('0x2'));var jsonpatch=require(_0x0ae1('0x3'));var rp=require('request-promise');var moment=require(_0x0ae1('0x4'));var BPromise=require(_0x0ae1('0x5'));var Mustache=require(_0x0ae1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0ae1('0x7'));var csv=require('to-csv');var ejs=require(_0x0ae1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ae1('0x9'));var squel=require('squel');var crypto=require(_0x0ae1('0xa'));var jsforce=require(_0x0ae1('0xb'));var deskjs=require(_0x0ae1('0xc'));var toCsv=require(_0x0ae1('0xd'));var querystring=require(_0x0ae1('0xe'));var Papa=require('papaparse');var Redis=require(_0x0ae1('0xf'));var authService=require(_0x0ae1('0x10'));var qs=require(_0x0ae1('0x11'));var as=require(_0x0ae1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ae1('0x13'))(_0x0ae1('0x14'));var utils=require(_0x0ae1('0x15'));var config=require(_0x0ae1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ae1('0x17'))['db'];config[_0x0ae1('0x18')]=_[_0x0ae1('0x19')](config[_0x0ae1('0x18')],{'host':_0x0ae1('0x1a'),'port':0x18eb});var socket=require(_0x0ae1('0x1b'))(new Redis(config[_0x0ae1('0x18')]));require('./team.socket')[_0x0ae1('0x1c')](socket);function respondWithStatusCode(_0xa7c90e,_0x3cce70){_0x3cce70=_0x3cce70||0xcc;return function(_0x31f4a0){if(_0x31f4a0){return _0xa7c90e[_0x0ae1('0x1d')](_0x3cce70);}return _0xa7c90e[_0x0ae1('0x1e')](_0x3cce70)[_0x0ae1('0x1f')]();};}function respondWithResult(_0x3287aa,_0x5a9774){_0x5a9774=_0x5a9774||0xc8;return function(_0x49cdfa){if(_0x49cdfa){return _0x3287aa[_0x0ae1('0x1e')](_0x5a9774)['json'](_0x49cdfa);}};}function respondWithFilteredResult(_0xb97693,_0x164b87){return function(_0x481045){if(_0x481045){var _0x35bbd3=typeof _0x164b87[_0x0ae1('0x20')]===_0x0ae1('0x21')&&typeof _0x164b87[_0x0ae1('0x22')]===_0x0ae1('0x21');var _0xe1ede2=_0x481045[_0x0ae1('0x23')];var _0x3e831b=_0x35bbd3?0x0:_0x164b87['offset'];var _0x30fbb0=_0x35bbd3?_0x481045[_0x0ae1('0x23')]:_0x164b87[_0x0ae1('0x20')]+_0x164b87['limit'];var _0x26d503;if(_0x30fbb0>=_0xe1ede2){_0x30fbb0=_0xe1ede2;_0x26d503=0xc8;}else{_0x26d503=0xce;}_0xb97693[_0x0ae1('0x1e')](_0x26d503);return _0xb97693['set'](_0x0ae1('0x24'),_0x3e831b+'-'+_0x30fbb0+'/'+_0xe1ede2)['json'](_0x481045);}return null;};}function patchUpdates(_0x399fad){return function(_0x292472){try{jsonpatch[_0x0ae1('0x25')](_0x292472,_0x399fad,!![]);}catch(_0x370fde){return BPromise[_0x0ae1('0x26')](_0x370fde);}return _0x292472[_0x0ae1('0x27')]();};}function saveUpdates(_0x2cc281,_0x2149aa){return function(_0x188421){if(_0x188421){return _0x188421[_0x0ae1('0x28')](_0x2cc281)[_0x0ae1('0x29')](function(_0x140a74){return _0x140a74;});}return null;};}function handleEntityNotFound(_0x47dd00,_0x10a9d7){return function(_0x8db541){if(!_0x8db541){_0x47dd00['sendStatus'](0x194);}return _0x8db541;};}function handleError(_0xb84689,_0x330277){_0x330277=_0x330277||0x1f4;return function(_0x1380fa){logger[_0x0ae1('0x2a')](_0x1380fa[_0x0ae1('0x2b')]);if(_0x1380fa[_0x0ae1('0x2c')]){delete _0x1380fa['name'];}_0xb84689['status'](_0x330277)[_0x0ae1('0x2d')](_0x1380fa);};}exports['index']=function(_0x35b23a,_0x52c489){var _0x20a30c={},_0x8996a7={},_0x70c786={'count':0x0,'rows':[]};var _0x4f9eac=_[_0x0ae1('0x2e')](db[_0x0ae1('0x2f')][_0x0ae1('0x30')],function(_0x47c50c){return{'name':_0x47c50c['fieldName'],'type':_0x47c50c['type'][_0x0ae1('0x31')]};});_0x8996a7[_0x0ae1('0x32')]=_['map'](_0x4f9eac,_0x0ae1('0x2c'));_0x8996a7[_0x0ae1('0x33')]=_[_0x0ae1('0x34')](_0x35b23a[_0x0ae1('0x33')]);_0x8996a7['filters']=_[_0x0ae1('0x35')](_0x8996a7[_0x0ae1('0x32')],_0x8996a7[_0x0ae1('0x33')]);_0x20a30c[_0x0ae1('0x36')]=_[_0x0ae1('0x35')](_0x8996a7[_0x0ae1('0x32')],qs[_0x0ae1('0x37')](_0x35b23a['query'][_0x0ae1('0x37')]));_0x20a30c['attributes']=_0x20a30c[_0x0ae1('0x36')][_0x0ae1('0x38')]?_0x20a30c[_0x0ae1('0x36')]:_0x8996a7[_0x0ae1('0x32')];if(!_0x35b23a['query'][_0x0ae1('0x39')](_0x0ae1('0x3a'))){_0x20a30c[_0x0ae1('0x22')]=qs['limit'](_0x35b23a['query']['limit']);_0x20a30c[_0x0ae1('0x20')]=qs[_0x0ae1('0x20')](_0x35b23a[_0x0ae1('0x33')][_0x0ae1('0x20')]);}_0x20a30c['order']=qs[_0x0ae1('0x3b')](_0x35b23a[_0x0ae1('0x33')][_0x0ae1('0x3b')]);_0x20a30c[_0x0ae1('0x3c')]=qs[_0x0ae1('0x3d')](_[_0x0ae1('0x3e')](_0x35b23a[_0x0ae1('0x33')],_0x8996a7[_0x0ae1('0x3d')]),_0x4f9eac);if(_0x35b23a[_0x0ae1('0x33')][_0x0ae1('0x3f')]){_0x20a30c[_0x0ae1('0x3c')]=_[_0x0ae1('0x40')](_0x20a30c[_0x0ae1('0x3c')],{'$or':_[_0x0ae1('0x2e')](_0x4f9eac,function(_0x1ac688){if(_0x1ac688[_0x0ae1('0x41')]!=='VIRTUAL'){var _0x418f8f={};_0x418f8f[_0x1ac688[_0x0ae1('0x2c')]]={'$like':'%'+_0x35b23a[_0x0ae1('0x33')]['filter']+'%'};return _0x418f8f;}})});}_0x20a30c=_[_0x0ae1('0x40')]({},_0x20a30c,_0x35b23a[_0x0ae1('0x42')]);var _0xf49f03={'where':_0x20a30c[_0x0ae1('0x3c')]};return db[_0x0ae1('0x2f')]['count'](_0xf49f03)['then'](function(_0x61531){_0x70c786['count']=_0x61531;if(_0x35b23a[_0x0ae1('0x33')][_0x0ae1('0x43')]){_0x20a30c[_0x0ae1('0x44')]=[{'all':!![]}];}return db[_0x0ae1('0x2f')][_0x0ae1('0x45')](_0x20a30c);})[_0x0ae1('0x29')](function(_0x1a6662){_0x70c786[_0x0ae1('0x46')]=_0x1a6662;return _0x70c786;})[_0x0ae1('0x29')](respondWithFilteredResult(_0x52c489,_0x20a30c))['catch'](handleError(_0x52c489,null));};exports[_0x0ae1('0x47')]=function(_0x2e4f82,_0x431c8c){var _0x38a101={'raw':![],'where':{'id':_0x2e4f82['params']['id']}},_0x5c8fca={};_0x5c8fca['model']=_[_0x0ae1('0x34')](db[_0x0ae1('0x2f')]['rawAttributes']);_0x5c8fca[_0x0ae1('0x33')]=_[_0x0ae1('0x34')](_0x2e4f82[_0x0ae1('0x33')]);_0x5c8fca[_0x0ae1('0x3d')]=_[_0x0ae1('0x35')](_0x5c8fca['model'],_0x5c8fca[_0x0ae1('0x33')]);_0x38a101[_0x0ae1('0x36')]=_[_0x0ae1('0x35')](_0x5c8fca[_0x0ae1('0x32')],qs[_0x0ae1('0x37')](_0x2e4f82[_0x0ae1('0x33')][_0x0ae1('0x37')]));_0x38a101[_0x0ae1('0x36')]=_0x38a101[_0x0ae1('0x36')][_0x0ae1('0x38')]?_0x38a101[_0x0ae1('0x36')]:_0x5c8fca[_0x0ae1('0x32')];if(_0x2e4f82[_0x0ae1('0x33')][_0x0ae1('0x43')]){_0x38a101[_0x0ae1('0x44')]=[{'all':!![]}];}_0x38a101=_[_0x0ae1('0x40')]({},_0x38a101,_0x2e4f82[_0x0ae1('0x42')]);return db['Team'][_0x0ae1('0x48')](_0x38a101)[_0x0ae1('0x29')](handleEntityNotFound(_0x431c8c,null))[_0x0ae1('0x29')](respondWithResult(_0x431c8c,null))['catch'](handleError(_0x431c8c,null));};exports['create']=function(_0x1c1f58,_0x4bd50a){return db[_0x0ae1('0x2f')]['create'](_0x1c1f58[_0x0ae1('0x49')],{})['then'](function(_0x328719){var _0x252637=_0x1c1f58[_0x0ae1('0x4a')]['get']({'plain':!![]});if(!_0x252637)throw new Error(_0x0ae1('0x4b'));if(_0x252637[_0x0ae1('0x4c')]===_0x0ae1('0x4a')){var _0x2bf7ea=_0x328719['get']({'plain':!![]});var _0x3c2991=_0x0ae1('0x4d');return db[_0x0ae1('0x4e')][_0x0ae1('0x48')]({'where':{'name':_0x3c2991,'userProfileId':_0x252637[_0x0ae1('0x4f')]},'raw':!![]})[_0x0ae1('0x29')](function(_0x5cc05b){if(_0x5cc05b&&_0x5cc05b[_0x0ae1('0x50')]===0x0){return db[_0x0ae1('0x51')]['create']({'name':_0x2bf7ea['name'],'resourceId':_0x2bf7ea['id'],'type':_0x5cc05b[_0x0ae1('0x2c')],'sectionId':_0x5cc05b['id']},{})['then'](function(){return _0x328719;});}else{return _0x328719;}})['catch'](function(_0x2fba49){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fba49);throw _0x2fba49;});}return _0x328719;})[_0x0ae1('0x29')](respondWithResult(_0x4bd50a,0xc9))[_0x0ae1('0x52')](handleError(_0x4bd50a,null));};exports[_0x0ae1('0x28')]=function(_0x5bbf3d,_0x11f6dc){if(_0x5bbf3d['body']['id']){delete _0x5bbf3d['body']['id'];}return db[_0x0ae1('0x2f')][_0x0ae1('0x48')]({'where':{'id':_0x5bbf3d[_0x0ae1('0x53')]['id']}})[_0x0ae1('0x29')](handleEntityNotFound(_0x11f6dc,null))[_0x0ae1('0x29')](saveUpdates(_0x5bbf3d['body'],null))[_0x0ae1('0x29')](respondWithResult(_0x11f6dc,null))[_0x0ae1('0x52')](handleError(_0x11f6dc,null));};exports[_0x0ae1('0x54')]=function(_0x291987,_0x474bbb){var _0xbef721=_0x291987[_0x0ae1('0x53')]['id'];var _0xfc1e23=[];return db[_0x0ae1('0x55')][_0x0ae1('0x56')](function(_0x50454f){var _0x2221f8=_0x0ae1('0x57')+_0xbef721;return db['sequelize'][_0x0ae1('0x33')](_0x2221f8,{'type':db['Sequelize'][_0x0ae1('0x58')][_0x0ae1('0x59')],'raw':!![],'transaction':_0x50454f})[_0x0ae1('0x29')](function(_0x22d557){_0xfc1e23=_[_0x0ae1('0x2e')](_0x22d557,function(_0x231480){return Number(_0x231480[_0x0ae1('0x5a')]);});})[_0x0ae1('0x29')](function(){var _0x188398='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0xbef721;return db[_0x0ae1('0x55')][_0x0ae1('0x33')](_0x188398,{'type':db[_0x0ae1('0x5b')][_0x0ae1('0x58')][_0x0ae1('0x59')],'raw':!![],'transaction':_0x50454f});})[_0x0ae1('0x29')](function(_0x300f8b){var _0x1ff7c1=_['map'](_0x300f8b,function(_0x58d97e){return Number(_0x58d97e['VoiceQueueId']);});return db[_0x0ae1('0x5c')][_0x0ae1('0x54')]({'where':{'UserId':{'$in':_0xfc1e23},'VoiceQueueId':{'$in':_0x1ff7c1}},'transaction':_0x50454f});})[_0x0ae1('0x29')](function(){var _0x21b25e=_0x0ae1('0x5d')+_0xbef721;return db[_0x0ae1('0x55')]['query'](_0x21b25e,{'type':db['Sequelize'][_0x0ae1('0x58')][_0x0ae1('0x59')],'raw':!![],'transaction':_0x50454f});})[_0x0ae1('0x29')](function(_0xb0196f){var _0x4c51a8=_[_0x0ae1('0x2e')](_0xb0196f,function(_0xfb57c2){return Number(_0xfb57c2['MailQueueId']);});return db['UserMailQueue'][_0x0ae1('0x54')]({'where':{'UserId':{'$in':_0xfc1e23},'MailQueueId':{'$in':_0x4c51a8}},'transaction':_0x50454f});})['then'](function(){var _0x366090=_0x0ae1('0x5e')+_0xbef721;return db[_0x0ae1('0x55')][_0x0ae1('0x33')](_0x366090,{'type':db['Sequelize'][_0x0ae1('0x58')]['SELECT'],'raw':!![],'transaction':_0x50454f});})['then'](function(_0x276dfb){var _0x150177=_[_0x0ae1('0x2e')](_0x276dfb,function(_0x2be44d){return Number(_0x2be44d[_0x0ae1('0x5f')]);});return db[_0x0ae1('0x60')]['destroy']({'where':{'UserId':{'$in':_0xfc1e23},'SmsQueueId':{'$in':_0x150177}},'transaction':_0x50454f});})['then'](function(){var _0x2c1105='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0xbef721;return db[_0x0ae1('0x55')]['query'](_0x2c1105,{'type':db['Sequelize'][_0x0ae1('0x58')][_0x0ae1('0x59')],'raw':!![],'transaction':_0x50454f});})[_0x0ae1('0x29')](function(_0x35f1cc){var _0x370c29=_[_0x0ae1('0x2e')](_0x35f1cc,function(_0x13f967){return Number(_0x13f967[_0x0ae1('0x61')]);});return db[_0x0ae1('0x62')][_0x0ae1('0x54')]({'where':{'UserId':{'$in':_0xfc1e23},'ChatQueueId':{'$in':_0x370c29}},'transaction':_0x50454f});})[_0x0ae1('0x29')](function(){var _0x412df9=_0x0ae1('0x63')+_0xbef721;return db[_0x0ae1('0x55')]['query'](_0x412df9,{'type':db[_0x0ae1('0x5b')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x50454f});})[_0x0ae1('0x29')](function(_0x5e7952){var _0x5d4537=_[_0x0ae1('0x2e')](_0x5e7952,function(_0x2eb3cd){return Number(_0x2eb3cd['FaxQueueId']);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0xfc1e23},'FaxQueueId':{'$in':_0x5d4537}},'transaction':_0x50454f});})[_0x0ae1('0x29')](function(){var _0x3efff9=_0x0ae1('0x64')+_0xbef721;return db[_0x0ae1('0x55')][_0x0ae1('0x33')](_0x3efff9,{'type':db['Sequelize'][_0x0ae1('0x58')]['SELECT'],'raw':!![],'transaction':_0x50454f});})['then'](function(_0x52e012){var _0xdaa598=_[_0x0ae1('0x2e')](_0x52e012,function(_0xf5f686){return Number(_0xf5f686[_0x0ae1('0x65')]);});return db[_0x0ae1('0x66')][_0x0ae1('0x54')]({'where':{'UserId':{'$in':_0xfc1e23},'OpenchannelQueueId':{'$in':_0xdaa598}},'transaction':_0x50454f});})[_0x0ae1('0x29')](function(){var _0x3d98ac=_0x0ae1('0x67')+_0xbef721;return db[_0x0ae1('0x55')][_0x0ae1('0x33')](_0x3d98ac,{'type':db[_0x0ae1('0x5b')][_0x0ae1('0x58')]['SELECT'],'raw':!![],'transaction':_0x50454f});})[_0x0ae1('0x29')](function(_0x483b68){var _0xdc95d8=_[_0x0ae1('0x2e')](_0x483b68,function(_0x1ef380){return Number(_0x1ef380['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x0ae1('0x54')]({'where':{'UserId':{'$in':_0xfc1e23},'WhatsappQueueId':{'$in':_0xdc95d8}},'transaction':_0x50454f});})[_0x0ae1('0x29')](function(){return db[_0x0ae1('0x68')][_0x0ae1('0x48')]({'where':{'TeamId':_0xbef721}});})[_0x0ae1('0x29')](function(_0x1f542b){if(_0x1f542b===null){return;}return db[_0x0ae1('0x69')][_0x0ae1('0x54')]({'where':{'UserId':{'$in':_0xfc1e23},'VoicePrefixId':_0x1f542b[_0x0ae1('0x6a')]},'transaction':_0x50454f});})[_0x0ae1('0x29')](function(){return db[_0x0ae1('0x2f')][_0x0ae1('0x54')]({'where':{'id':_0xbef721},'cascade':!![],'transaction':_0x50454f});})['then'](function(_0x3b3b4d){if(_0x3b3b4d===0x0){_0x474bbb['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x0ae1('0x54')]({'where':{'type':'Teams','resourceId':_0xbef721},'cascade':!![],'transaction':_0x50454f})[_0x0ae1('0x29')](function(){_0x474bbb[_0x0ae1('0x1e')](0xcc)['end']();});}})[_0x0ae1('0x52')](function(_0x5d0b64){_0x474bbb[_0x0ae1('0x1e')](0x1f4)[_0x0ae1('0x2d')](_0x5d0b64);});});};exports['getQueues']=function(_0x4a4049,_0x3d6eec,_0x1b88d4){return db[_0x0ae1('0x2f')][_0x0ae1('0x6b')]({'where':{'id':_0x4a4049['params']['id']}})[_0x0ae1('0x29')](handleEntityNotFound(_0x3d6eec,null))[_0x0ae1('0x29')](function(_0x205d7f){if(!_0x4a4049['query'][_0x0ae1('0x6c')]||!utils['isValidChannel'](_0x4a4049[_0x0ae1('0x33')][_0x0ae1('0x6c')])){throw new db[(_0x0ae1('0x5b'))]['ValidationError'](_0x0ae1('0x6d'));}var _0x55851d={};var _0x35fc81={};_0x35fc81[_0x0ae1('0x32')]=_[_0x0ae1('0x34')](db[_[_0x0ae1('0x6e')](_0x4a4049['query'][_0x0ae1('0x6c')]['toLowerCase']())+'Queue'][_0x0ae1('0x30')]);_0x35fc81[_0x0ae1('0x33')]=_[_0x0ae1('0x34')](_0x4a4049[_0x0ae1('0x33')]);_0x35fc81['filters']=_['intersection'](_0x35fc81[_0x0ae1('0x32')],_0x35fc81[_0x0ae1('0x33')]);_0x55851d[_0x0ae1('0x36')]=_[_0x0ae1('0x35')](_0x35fc81[_0x0ae1('0x32')],qs[_0x0ae1('0x37')](_0x4a4049[_0x0ae1('0x33')]['fields']));_0x55851d[_0x0ae1('0x36')]=_0x55851d[_0x0ae1('0x36')][_0x0ae1('0x38')]?_0x55851d[_0x0ae1('0x36')]:_0x35fc81['model'];_0x55851d[_0x0ae1('0x22')]=qs[_0x0ae1('0x22')](_0x4a4049[_0x0ae1('0x33')]['limit']);_0x55851d['offset']=qs['offset'](_0x4a4049[_0x0ae1('0x33')][_0x0ae1('0x20')]);_0x55851d[_0x0ae1('0x6f')]=qs['sort'](_0x4a4049[_0x0ae1('0x33')][_0x0ae1('0x3b')]);_0x55851d['where']=qs[_0x0ae1('0x3d')](_[_0x0ae1('0x3e')](_0x4a4049['query'],_0x35fc81['filters']));_0x55851d=_[_0x0ae1('0x40')]({},_0x55851d,_0x4a4049['options']);return _0x205d7f[_0x0ae1('0x70')+_[_0x0ae1('0x6e')](_0x4a4049[_0x0ae1('0x33')][_0x0ae1('0x6c')][_0x0ae1('0x71')]())+'Queues'](_0x55851d);})['then'](respondWithResult(_0x3d6eec,null))[_0x0ae1('0x52')](handleError(_0x3d6eec,null));};exports[_0x0ae1('0x72')]=function(_0x2aeecb,_0x556b7d,_0x3203c6){return db[_0x0ae1('0x2f')][_0x0ae1('0x6b')]({'where':{'id':_0x2aeecb[_0x0ae1('0x53')]['id']}})[_0x0ae1('0x29')](function(_0x2d74c0){if(_0x2d74c0){if(!_0x2aeecb[_0x0ae1('0x49')][_0x0ae1('0x6c')]||!utils[_0x0ae1('0x73')](_0x2aeecb[_0x0ae1('0x49')][_0x0ae1('0x6c')])){throw new db[(_0x0ae1('0x5b'))][(_0x0ae1('0x74'))](_0x0ae1('0x6d'));}return _0x2d74c0[_0x0ae1('0x75')+_[_0x0ae1('0x6e')](_0x2aeecb['body'][_0x0ae1('0x6c')]['toLowerCase']())+'Queues'](_0x2aeecb[_0x0ae1('0x49')]['ids']);}return null;})['then'](handleEntityNotFound(_0x556b7d,null))[_0x0ae1('0x29')](respondWithStatusCode(_0x556b7d,null))[_0x0ae1('0x52')](handleError(_0x556b7d,null));};exports[_0x0ae1('0x76')]=function(_0x4ad31a,_0x3ea9af,_0x29193a){return db[_0x0ae1('0x2f')]['findOne']({'where':{'id':_0x4ad31a[_0x0ae1('0x53')]['id']}})[_0x0ae1('0x29')](function(_0x15de8f){if(_0x15de8f){if(!_0x4ad31a[_0x0ae1('0x33')][_0x0ae1('0x6c')]||!utils['isValidChannel'](_0x4ad31a[_0x0ae1('0x33')][_0x0ae1('0x6c')])){throw new db['Sequelize'][(_0x0ae1('0x74'))](_0x0ae1('0x6d'));}return _0x15de8f['remove'+_[_0x0ae1('0x6e')](_0x4ad31a[_0x0ae1('0x33')][_0x0ae1('0x6c')][_0x0ae1('0x71')]())+_0x0ae1('0x77')](_0x4ad31a['query'][_0x0ae1('0x78')]);}return null;})[_0x0ae1('0x29')](handleEntityNotFound(_0x3ea9af,null))[_0x0ae1('0x29')](respondWithStatusCode(_0x3ea9af,null))[_0x0ae1('0x52')](handleError(_0x3ea9af,null));};exports[_0x0ae1('0x79')]=function(_0x17c9a6,_0x7b96ea){var _0x3273f6=_[_0x0ae1('0x7a')](_0x17c9a6['body'][_0x0ae1('0x78')])?_0x17c9a6[_0x0ae1('0x49')][_0x0ae1('0x78')]:[_0x17c9a6[_0x0ae1('0x49')][_0x0ae1('0x78')]];var _0x555b19=_0x17c9a6[_0x0ae1('0x53')]['id'];return db[_0x0ae1('0x2f')][_0x0ae1('0x48')]({'where':{'id':_0x555b19}})[_0x0ae1('0x29')](handleEntityNotFound(_0x7b96ea,null))[_0x0ae1('0x29')](function(_0x40a8cd){if(_0x40a8cd){var _0x358e42=['Voice',_0x0ae1('0x7b'),_0x0ae1('0x7c'),'Sms','Fax',_0x0ae1('0x7d'),_0x0ae1('0x7e')];return db[_0x0ae1('0x55')]['transaction'](function(_0x13766d){var _0x408b1d=_[_0x0ae1('0x2e')](_0x358e42,function(_0x1f1c23){var _0x5ee147={'attributes':['id',_0x0ae1('0x2c')]};if(_0x1f1c23===_0x0ae1('0x7f')){_0x5ee147['through']={'attributes':[_0x0ae1('0x80')]};}return _0x40a8cd['get'+_0x1f1c23+'Queues'](_0x5ee147)[_0x0ae1('0x29')](function(_0x971231){var _0x3e6af5=_[_0x0ae1('0x2e')](_0x971231,function(_0x1d1757){var _0x4fe242=_['map'](_0x3273f6,function(_0x4629d2){var _0xca30c={'where':{'UserId':_0x4629d2,[_0x1f1c23+'QueueId']:_0x1d1757['id']},'transaction':_0x13766d};if(_0x1f1c23===_0x0ae1('0x7f')){_0xca30c['defaults']={'penalty':_0x1d1757[_0x0ae1('0x81')][_0x0ae1('0x80')]};}return db[_0x0ae1('0x82')+_0x1f1c23+_0x0ae1('0x83')][_0x0ae1('0x84')](_0xca30c)[_0x0ae1('0x29')](function(){socket['emit']('user'+_0x1f1c23+'Queue:save',{'UserId':_0x4629d2,[_0x1f1c23+_0x0ae1('0x85')]:_0x1d1757['id']});if(_0x1f1c23!=='Voice'){return;}return db[_0x0ae1('0x82')][_0x0ae1('0x45')]({'where':{'id':_0x3273f6,'online':0x1},'attributes':['id',_0x0ae1('0x2c'),_0x0ae1('0x86'),_0x0ae1('0x87'),_0x0ae1('0x88')],'raw':!![]})['then'](function(_0x4bd1cd){var _0x2212e7=_[_0x0ae1('0x2e')](_0x4bd1cd,function(_0x2b0619){return db[_0x0ae1('0x89')]['upsert']({'membername':_0x2b0619[_0x0ae1('0x2c')],'UserId':_0x2b0619['id'],'queue_name':_0x1d1757[_0x0ae1('0x2c')],'VoiceQueueId':_0x1d1757['id'],'interface':_[_0x0ae1('0x8a')](_0x2b0619[_0x0ae1('0x88')])?util[_0x0ae1('0x8b')](_0x0ae1('0x8c'),_0x2b0619['name']):_0x2b0619['interface'],'paused':_0x2b0619[_0x0ae1('0x87')]||![],'penalty':_0x1d1757['TeamVoiceQueue'][_0x0ae1('0x80')]},{'transaction':_0x13766d});});return Promise[_0x0ae1('0x8d')](_0x2212e7);});});});return Promise[_0x0ae1('0x8d')](_0x4fe242);});return Promise[_0x0ae1('0x8d')](_0x3e6af5);})[_0x0ae1('0x29')](function(){return db[_0x0ae1('0x68')][_0x0ae1('0x6b')]({'where':{'teamId':_0x555b19}})[_0x0ae1('0x29')](function(_0x37093e){if(_0x37093e){var _0x649f73=_[_0x0ae1('0x2e')](_0x3273f6,function(_0x74ab73){db[_0x0ae1('0x69')][_0x0ae1('0x8e')]({'UserId':_0x74ab73,'VoicePrefixId':_0x37093e[_0x0ae1('0x6a')]});});return Promise['all'](_0x649f73);}});});});return Promise[_0x0ae1('0x8d')](_0x408b1d)['then'](function(){return _0x40a8cd[_0x0ae1('0x79')](_0x3273f6,{'transaction':_0x13766d})[_0x0ae1('0x8f')](function(_0x324b57){return _0x324b57;});});});}})['then'](respondWithResult(_0x7b96ea,null))[_0x0ae1('0x52')](handleError(_0x7b96ea,null));};exports[_0x0ae1('0x90')]=function(_0x3bb69b,_0x5bf9b9){var _0x54bd7d=_[_0x0ae1('0x7a')](_0x3bb69b['query'][_0x0ae1('0x78')])?_0x3bb69b[_0x0ae1('0x33')]['ids']:[_0x3bb69b['query'][_0x0ae1('0x78')]];var _0x3e377a=_0x3bb69b['params']['id'];return db['Team']['find']({'where':{'id':_0x3e377a}})['then'](handleEntityNotFound(_0x5bf9b9,null))[_0x0ae1('0x29')](function(_0x2188a6){if(_0x2188a6){var _0xfbdb72=['Voice',_0x0ae1('0x7b'),_0x0ae1('0x7c'),'Sms',_0x0ae1('0x91'),'Openchannel',_0x0ae1('0x7e')];return db['sequelize'][_0x0ae1('0x56')](function(_0x468100){var _0x4e85c6=_[_0x0ae1('0x2e')](_0xfbdb72,function(_0x158716){var _0x695fde={'attributes':['id',_0x0ae1('0x2c')]};return _0x2188a6[_0x0ae1('0x70')+_0x158716+_0x0ae1('0x77')](_0x695fde)['then'](function(_0x178f4b){var _0x2fd818=_[_0x0ae1('0x2e')](_0x178f4b,function(_0x1694cf){return _0x1694cf[_0x0ae1('0x90')](_0x54bd7d,{'transaction':_0x468100})['then'](function(){var _0x3d188c=_[_0x0ae1('0x2e')](_0x54bd7d,function(_0x23d5a7){socket[_0x0ae1('0x92')]('user'+_0x158716+_0x0ae1('0x93'),{'UserId':Number(_0x23d5a7),[_0x158716+_0x0ae1('0x85')]:_0x1694cf['id']});if(_0x158716!=='Voice'){return;}return db[_0x0ae1('0x89')][_0x0ae1('0x54')]({'where':{'VoiceQueueId':_0x1694cf['id'],'UserId':_0x23d5a7},'transaction':_0x468100});});return Promise[_0x0ae1('0x8d')](_0x3d188c);});});return Promise[_0x0ae1('0x8d')](_0x2fd818);});});return Promise[_0x0ae1('0x8d')](_0x4e85c6)[_0x0ae1('0x29')](function(){return _0x2188a6[_0x0ae1('0x90')](_0x54bd7d,{'transaction':_0x468100});})[_0x0ae1('0x29')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x3e377a}})[_0x0ae1('0x29')](function(_0x31607d){if(_0x31607d){var _0xee0b4e=_[_0x0ae1('0x2e')](_0x54bd7d,function(_0x2a39f8){db[_0x0ae1('0x69')][_0x0ae1('0x54')]({'where':{'UserId':_0x2a39f8,'VoicePrefixId':_0x31607d[_0x0ae1('0x6a')]}});});return Promise['all'](_0xee0b4e);}});});});}})[_0x0ae1('0x29')](respondWithStatusCode(_0x5bf9b9,null))['catch'](handleError(_0x5bf9b9,null));};exports[_0x0ae1('0x94')]=function(_0x59ef62,_0x1291ea,_0x5a7275){var _0x55a88c={};var _0x57bd7f={};var _0x24ce5a;var _0x4be2cc;return db[_0x0ae1('0x2f')][_0x0ae1('0x6b')]({'where':{'id':_0x59ef62[_0x0ae1('0x53')]['id']}})[_0x0ae1('0x29')](handleEntityNotFound(_0x1291ea,null))[_0x0ae1('0x29')](function(_0x3fce19){if(_0x3fce19){_0x24ce5a=_0x3fce19;_0x57bd7f[_0x0ae1('0x32')]=_['keys'](db[_0x0ae1('0x82')][_0x0ae1('0x30')]);_0x57bd7f[_0x0ae1('0x33')]=_['keys'](_0x59ef62[_0x0ae1('0x33')]);_0x57bd7f['filters']=_['intersection'](_0x57bd7f[_0x0ae1('0x32')],_0x57bd7f['query']);_0x55a88c[_0x0ae1('0x36')]=_[_0x0ae1('0x35')](_0x57bd7f[_0x0ae1('0x32')],qs['fields'](_0x59ef62[_0x0ae1('0x33')]['fields']));_0x55a88c[_0x0ae1('0x36')]=_0x55a88c['attributes'][_0x0ae1('0x38')]?_0x55a88c[_0x0ae1('0x36')]:_0x57bd7f['model'];_0x55a88c[_0x0ae1('0x6f')]=qs['sort'](_0x59ef62[_0x0ae1('0x33')][_0x0ae1('0x3b')]);_0x55a88c[_0x0ae1('0x3c')]=qs[_0x0ae1('0x3d')](_['pick'](_0x59ef62[_0x0ae1('0x33')],_0x57bd7f[_0x0ae1('0x3d')]));if(_0x59ef62[_0x0ae1('0x33')][_0x0ae1('0x3f')]){_0x55a88c[_0x0ae1('0x3c')]=_[_0x0ae1('0x40')](_0x55a88c[_0x0ae1('0x3c')],{'$or':_[_0x0ae1('0x2e')](_0x55a88c[_0x0ae1('0x36')],function(_0x3df924){var _0x156926={};_0x156926[_0x3df924]={'$like':'%'+_0x59ef62['query'][_0x0ae1('0x3f')]+'%'};return _0x156926;})});}_0x55a88c=_[_0x0ae1('0x40')]({},_0x55a88c,_0x59ef62[_0x0ae1('0x42')]);return _0x24ce5a[_0x0ae1('0x94')](_0x55a88c);}})[_0x0ae1('0x29')](function(_0x510fa4){if(_0x510fa4){_0x4be2cc=_0x510fa4[_0x0ae1('0x38')];if(!_0x59ef62[_0x0ae1('0x33')]['hasOwnProperty'](_0x0ae1('0x3a'))){_0x55a88c[_0x0ae1('0x22')]=qs[_0x0ae1('0x22')](_0x59ef62[_0x0ae1('0x33')]['limit']);_0x55a88c['offset']=qs[_0x0ae1('0x20')](_0x59ef62[_0x0ae1('0x33')][_0x0ae1('0x20')]);}return _0x24ce5a['getAgents'](_0x55a88c);}})['then'](function(_0x288851){if(_0x288851){return _0x288851?{'count':_0x4be2cc,'rows':_0x288851}:null;}})[_0x0ae1('0x29')](respondWithResult(_0x1291ea,null))['catch'](handleError(_0x1291ea,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index df37165..c4d26dd 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 _0xc9ca=['Team','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xc9ca,0x116));var _0xac9c=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0xc9ca[_0x7b173];return _0x1c598c;};'use strict';var EventEmitter=require(_0xac9c('0x0'));var Team=require(_0xac9c('0x1'))['db'][_0xac9c('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xac9c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac9c('0x4'),'afterDestroy':_0xac9c('0x5')};function emitEvent(_0x41e9de){return function(_0x343a27,_0x326cf8,_0x1e7862){TeamEvents[_0xac9c('0x6')](_0x41e9de+':'+_0x343a27['id'],_0x343a27);TeamEvents[_0xac9c('0x6')](_0x41e9de,_0x343a27);_0x1e7862(null);};}for(var e in events){if(events[_0xac9c('0x7')](e)){var event=events[e];Team[_0xac9c('0x8')](e,emitEvent(event));}}module[_0xac9c('0x9')]=TeamEvents; \ No newline at end of file +var _0x0bda=['exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xaec935,_0x5f3d12){var _0x28a8e1=function(_0x4ca7a1){while(--_0x4ca7a1){_0xaec935['push'](_0xaec935['shift']());}};_0x28a8e1(++_0x5f3d12);}(_0x0bda,0x1eb));var _0xa0bd=function(_0x1874a5,_0x503141){_0x1874a5=_0x1874a5-0x0;var _0xd39632=_0x0bda[_0x1874a5];return _0xd39632;};'use strict';var EventEmitter=require(_0xa0bd('0x0'));var Team=require(_0xa0bd('0x1'))['db'][_0xa0bd('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xa0bd('0x3')](0x0);var events={'afterCreate':_0xa0bd('0x4'),'afterUpdate':_0xa0bd('0x5'),'afterDestroy':_0xa0bd('0x6')};function emitEvent(_0x5e049a){return function(_0x1fe074,_0x357dd0,_0x52c868){TeamEvents['emit'](_0x5e049a+':'+_0x1fe074['id'],_0x1fe074);TeamEvents[_0xa0bd('0x7')](_0x5e049a,_0x1fe074);_0x52c868(null);};}for(var e in events){if(events[_0xa0bd('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xa0bd('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 8f974a3..360a96b 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 _0x3888=['Fax','Mail','Openchannel','Sms','Voice','all','get','then','map','catch','exports','teams','Chat'];(function(_0x525da4,_0x1c9133){var _0x588c1c=function(_0x2b180d){while(--_0x2b180d){_0x525da4['push'](_0x525da4['shift']());}};_0x588c1c(++_0x1c9133);}(_0x3888,0x1e7));var _0x8388=function(_0x19a46d,_0x4a66f8){_0x19a46d=_0x19a46d-0x0;var _0x43402e=_0x3888[_0x19a46d];return _0x43402e;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x4b2245,_0x7739b6){var _0x2c862b=_0x8388('0x0')+_0x7739b6+'Queues';return _0x4b2245[_0x2c862b]()[_0x8388('0x1')](function(_0x19505f){return _[_0x8388('0x2')](_0x19505f,function(_0x284cb3){_0x284cb3['setDataValue']('channel',_0x7739b6);return _0x284cb3;});})[_0x8388('0x3')](function(_0x268542){throw _0x268542;});}module[_0x8388('0x4')]=function(_0x5cb719){return _0x5cb719['define']('Team',attributes,{'tableName':_0x8388('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x29dd3f=this;var _0x4f8f31=[_0x8388('0x6'),_0x8388('0x7'),_0x8388('0x8'),_0x8388('0x9'),_0x8388('0xa'),_0x8388('0xb'),'Whatsapp'];return Promise['resolve']()[_0x8388('0x1')](function(){var _0x469ab2=_[_0x8388('0x2')](_0x4f8f31,function(_0x1bc625){return getQueuesByChannel(_0x29dd3f,_0x1bc625);});return Promise[_0x8388('0xc')](_0x469ab2);})[_0x8388('0x3')](function(_0x35088c){throw _0x35088c;});}}});}; \ No newline at end of file +var _0x9869=['then','map','setDataValue','catch','exports','Team','teams','Chat','Mail','Sms','Voice','resolve','all','./team.attributes','get'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0x9869,0x10c));var _0x9986=function(_0x3dae09,_0x4d38ab){_0x3dae09=_0x3dae09-0x0;var _0x5b55d3=_0x9869[_0x3dae09];return _0x5b55d3;};'use strict';var _=require('lodash');var attributes=require(_0x9986('0x0'));function getQueuesByChannel(_0x310b8e,_0x338c80){var _0x56ffd2=_0x9986('0x1')+_0x338c80+'Queues';return _0x310b8e[_0x56ffd2]()[_0x9986('0x2')](function(_0x5f2f5f){return _[_0x9986('0x3')](_0x5f2f5f,function(_0x18a0b0){_0x18a0b0[_0x9986('0x4')]('channel',_0x338c80);return _0x18a0b0;});})[_0x9986('0x5')](function(_0x327afb){throw _0x327afb;});}module[_0x9986('0x6')]=function(_0x399b20){return _0x399b20['define'](_0x9986('0x7'),attributes,{'tableName':_0x9986('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5ee077=this;var _0x10cc7c=[_0x9986('0x9'),'Fax',_0x9986('0xa'),'Openchannel',_0x9986('0xb'),_0x9986('0xc'),'Whatsapp'];return Promise[_0x9986('0xd')]()[_0x9986('0x2')](function(){var _0x29a30b=_[_0x9986('0x3')](_0x10cc7c,function(_0x1bb9f6){return getQueuesByChannel(_0x5ee077,_0x1bb9f6);});return Promise[_0x9986('0xe')](_0x29a30b);})[_0x9986('0x5')](function(_0x218746){throw _0x218746;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 4c2b066..64b34cc 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 _0x8c7b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','Team,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c7b,0xb6));var _0xb8c7=function(_0x561f60,_0x598be3){_0x561f60=_0x561f60-0x0;var _0x35194e=_0x8c7b[_0x561f60];return _0x35194e;};'use strict';var _=require(_0xb8c7('0x0'));var util=require(_0xb8c7('0x1'));var moment=require('moment');var BPromise=require(_0xb8c7('0x2'));var rs=require(_0xb8c7('0x3'));var fs=require('fs');var Redis=require(_0xb8c7('0x4'));var db=require(_0xb8c7('0x5'))['db'];var utils=require(_0xb8c7('0x6'));var logger=require(_0xb8c7('0x7'))(_0xb8c7('0x8'));var config=require(_0xb8c7('0x9'));var jayson=require(_0xb8c7('0xa'));var client=jayson[_0xb8c7('0xb')][_0xb8c7('0xc')]({'port':0x232a});config[_0xb8c7('0xd')]=_[_0xb8c7('0xe')](config['redis'],{'host':_0xb8c7('0xf'),'port':0x18eb});var socket=require(_0xb8c7('0x10'))(new Redis(config[_0xb8c7('0xd')]));require(_0xb8c7('0x11'))['register'](socket);function respondWithRpcPromise(_0x30f7e5,_0x542b86,_0x188a2e){return new BPromise(function(_0xdab8df,_0xa5851d){return client['request'](_0x30f7e5,_0x188a2e)['then'](function(_0x2df93c){logger['info'](_0xb8c7('0x12'),_0x542b86,_0xb8c7('0x13'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x542b86,_0xb8c7('0x13'),JSON['stringify'](_0x2df93c));if(_0x2df93c[_0xb8c7('0x14')]){if(_0x2df93c['error'][_0xb8c7('0x15')]===0x1f4){logger['error'](_0xb8c7('0x12'),_0x542b86,_0x2df93c['error'][_0xb8c7('0x16')]);return _0xa5851d(_0x2df93c[_0xb8c7('0x14')][_0xb8c7('0x16')]);}logger[_0xb8c7('0x14')](_0xb8c7('0x12'),_0x542b86,_0x2df93c['error'][_0xb8c7('0x16')]);return _0xdab8df(_0x2df93c[_0xb8c7('0x14')][_0xb8c7('0x16')]);}else{logger['info'](_0xb8c7('0x12'),_0x542b86,_0xb8c7('0x13'));_0xdab8df(_0x2df93c[_0xb8c7('0x17')][_0xb8c7('0x16')]);}})['catch'](function(_0x50fc12){logger[_0xb8c7('0x14')]('Team,\x20%s,\x20%s',_0x542b86,_0x50fc12);_0xa5851d(_0x50fc12);});});} \ No newline at end of file +var _0xb7b6=['redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x210e8b,_0x1a0774){_0x210e8b=_0x210e8b-0x0;var _0x35d7e5=_0xb7b6[_0x210e8b];return _0x35d7e5;};'use strict';var _=require(_0x6b7b('0x0'));var util=require(_0x6b7b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b7b('0x2'));var fs=require('fs');var Redis=require(_0x6b7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b7b('0x4'));var logger=require(_0x6b7b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6b7b('0x6'));var client=jayson[_0x6b7b('0x7')][_0x6b7b('0x8')]({'port':0x232a});config[_0x6b7b('0x9')]=_[_0x6b7b('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6b7b('0xb'))(new Redis(config[_0x6b7b('0x9')]));require(_0x6b7b('0xc'))[_0x6b7b('0xd')](socket);function respondWithRpcPromise(_0x525f83,_0x4ac78d,_0x553009){return new BPromise(function(_0x1648af,_0x4223d9){return client[_0x6b7b('0xe')](_0x525f83,_0x553009)[_0x6b7b('0xf')](function(_0x2fbe02){logger[_0x6b7b('0x10')]('Team,\x20%s,\x20%s',_0x4ac78d,_0x6b7b('0x11'));logger[_0x6b7b('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x4ac78d,_0x6b7b('0x11'),JSON[_0x6b7b('0x13')](_0x2fbe02));if(_0x2fbe02['error']){if(_0x2fbe02[_0x6b7b('0x14')]['code']===0x1f4){logger[_0x6b7b('0x14')](_0x6b7b('0x15'),_0x4ac78d,_0x2fbe02[_0x6b7b('0x14')]['message']);return _0x4223d9(_0x2fbe02['error'][_0x6b7b('0x16')]);}logger['error']('Team,\x20%s,\x20%s',_0x4ac78d,_0x2fbe02[_0x6b7b('0x14')][_0x6b7b('0x16')]);return _0x1648af(_0x2fbe02['error'][_0x6b7b('0x16')]);}else{logger[_0x6b7b('0x10')](_0x6b7b('0x15'),_0x4ac78d,_0x6b7b('0x11'));_0x1648af(_0x2fbe02['result'][_0x6b7b('0x16')]);}})[_0x6b7b('0x17')](function(_0x3b9fbf){logger[_0x6b7b('0x14')](_0x6b7b('0x15'),_0x4ac78d,_0x3b9fbf);_0x4223d9(_0x3b9fbf);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index d68ba86..5bb3ecb 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 _0xe9ff=['length','team:','update','emit','removeListener','register'];(function(_0x230a05,_0x551883){var _0x235b93=function(_0x538ff0){while(--_0x538ff0){_0x230a05['push'](_0x230a05['shift']());}};_0x235b93(++_0x551883);}(_0xe9ff,0x17c));var _0xfe9f=function(_0x5aaf23,_0x311f9c){_0x5aaf23=_0x5aaf23-0x0;var _0x4d6d3f=_0xe9ff[_0x5aaf23];return _0x4d6d3f;};'use strict';var TeamEvents=require('./team.events');var events=['save','remove',_0xfe9f('0x0')];function createListener(_0x5d9f8c,_0x3bd6ea){return function(_0xfb3bf3){_0x3bd6ea[_0xfe9f('0x1')](_0x5d9f8c,_0xfb3bf3);};}function removeListener(_0x15cd60,_0x4226ce){return function(){TeamEvents[_0xfe9f('0x2')](_0x15cd60,_0x4226ce);};}exports[_0xfe9f('0x3')]=function(_0x5f9833){for(var _0xe96c92=0x0,_0x53767c=events[_0xfe9f('0x4')];_0xe96c92<_0x53767c;_0xe96c92++){var _0x4e4857=events[_0xe96c92];var _0x4a837d=createListener(_0xfe9f('0x5')+_0x4e4857,_0x5f9833);TeamEvents['on'](_0x4e4857,_0x4a837d);}}; \ No newline at end of file +var _0x9d9b=['team:','save','remove','emit','removeListener','length'];(function(_0x4cb0c4,_0x121aa9){var _0x4f8db4=function(_0x49eeba){while(--_0x49eeba){_0x4cb0c4['push'](_0x4cb0c4['shift']());}};_0x4f8db4(++_0x121aa9);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x54ee94,_0x2bcced){_0x54ee94=_0x54ee94-0x0;var _0x4c60bb=_0x9d9b[_0x54ee94];return _0x4c60bb;};'use strict';var TeamEvents=require('./team.events');var events=[_0xb9d9('0x0'),_0xb9d9('0x1'),'update'];function createListener(_0x1a62c1,_0x5924bd){return function(_0x29ac5b){_0x5924bd[_0xb9d9('0x2')](_0x1a62c1,_0x29ac5b);};}function removeListener(_0x2fd7d5,_0x55b2c3){return function(){TeamEvents[_0xb9d9('0x3')](_0x2fd7d5,_0x55b2c3);};}exports['register']=function(_0x1b1f3c){for(var _0x32cf18=0x0,_0x51af61=events[_0xb9d9('0x4')];_0x32cf18<_0x51af61;_0x32cf18++){var _0x20e0e5=events[_0x32cf18];var _0x184896=createListener(_0xb9d9('0x5')+_0x20e0e5,_0x1b1f3c);TeamEvents['on'](_0x20e0e5,_0x184896);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 16dd6fd..32ea005 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 _0x41bb=['exports','INTEGER','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x41bb,0xc5));var _0xb41b=function(_0x8e440d,_0x30602c){_0x8e440d=_0x8e440d-0x0;var _0x37d5ec=_0x41bb[_0x8e440d];return _0x37d5ec;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb41b('0x2')]}}; \ No newline at end of file +var _0x5044=['exports','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5044,0xc8));var _0x4504=function(_0x3cbccf,_0x5ecadc){_0x3cbccf=_0x3cbccf-0x0;var _0x541a7b=_0x5044[_0x3cbccf];return _0x541a7b;};'use strict';var Sequelize=require('sequelize');module[_0x4504('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x4504('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2b4bba4..32211a8 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 _0x138d=['api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x15def9,_0x33453b){var _0x613ec4=function(_0x5ab902){while(--_0x5ab902){_0x15def9['push'](_0x15def9['shift']());}};_0x613ec4(++_0x33453b);}(_0x138d,0x1ab));var _0xd138=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0x138d[_0x21090b];return _0x3c68d7;};'use strict';var _=require(_0xd138('0x0'));var util=require(_0xd138('0x1'));var logger=require('../../config/logger')(_0xd138('0x2'));var moment=require(_0xd138('0x3'));var BPromise=require(_0xd138('0x4'));var rp=require(_0xd138('0x5'));var fs=require('fs');var path=require(_0xd138('0x6'));var rimraf=require(_0xd138('0x7'));var config=require('../../config/environment');var attributes=require(_0xd138('0x8'));module[_0xd138('0x9')]=function(_0x343962,_0x54f02e){return _0x343962[_0xd138('0xa')](_0xd138('0xb'),attributes,{'tableName':_0xd138('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32d5=['request-promise','rimraf','../../config/environment','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0x32d5,0x1aa));var _0x532d=function(_0xfa8754,_0x3f42f3){_0xfa8754=_0xfa8754-0x0;var _0x3f0b97=_0x32d5[_0xfa8754];return _0x3f0b97;};'use strict';var _=require(_0x532d('0x0'));var util=require(_0x532d('0x1'));var logger=require(_0x532d('0x2'))(_0x532d('0x3'));var moment=require(_0x532d('0x4'));var BPromise=require(_0x532d('0x5'));var rp=require(_0x532d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x532d('0x7'));var config=require(_0x532d('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0x532d('0x9')]=function(_0x2b1142,_0x2995e2){return _0x2b1142[_0x532d('0xa')](_0x532d('0xb'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index cd8bf40..3c07b0b 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x24ec6f,_0x1de736){var _0x2b3d05=function(_0x1d5215){while(--_0x1d5215){_0x24ec6f['push'](_0x24ec6f['shift']());}};_0x2b3d05(++_0x1de736);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x129c08,_0x2a35f8){var _0x234630=function(_0x172994){while(--_0x172994){_0x129c08['push'](_0x129c08['shift']());}};_0x234630(++_0x2a35f8);}(_0x70e0,0x17b));var _0x070e=function(_0x4d927a,_0x525e10){_0x4d927a=_0x4d927a-0x0;var _0x197038=_0x70e0[_0x4d927a];return _0x197038;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index c99eaa0..b97957a 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x072d=['sequelize','INTEGER'];(function(_0x382782,_0x152ce1){var _0x1a1313=function(_0x229ef7){while(--_0x229ef7){_0x382782['push'](_0x382782['shift']());}};_0x1a1313(++_0x152ce1);}(_0x072d,0x1d0));var _0xd072=function(_0x555725,_0x533bfe){_0x555725=_0x555725-0x0;var _0x50df8d=_0x072d[_0x555725];return _0x50df8d;};'use strict';var Sequelize=require(_0xd072('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd072('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8db9=['sequelize','exports','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8db9,0x1c2));var _0x98db=function(_0x549783,_0x3a334c){_0x549783=_0x549783-0x0;var _0x5c325d=_0x8db9[_0x549783];return _0x5c325d;};'use strict';var Sequelize=require(_0x98db('0x0'));module[_0x98db('0x1')]={'penalty':{'type':Sequelize[_0x98db('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 570f2af..9f3358d 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 _0x70e0=['team_has_voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes'];(function(_0x45d1fa,_0x2ff76f){var _0x380621=function(_0x1fd143){while(--_0x1fd143){_0x45d1fa['push'](_0x45d1fa['shift']());}};_0x380621(++_0x2ff76f);}(_0x70e0,0x17b));var _0x070e=function(_0x3a3560,_0xe08396){_0x3a3560=_0x3a3560-0x0;var _0x53e6a3=_0x70e0[_0x3a3560];return _0x53e6a3;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('TeamVoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3ee=['request-promise','../../config/environment','exports','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api'];(function(_0x522ba9,_0x2404f9){var _0x47c818=function(_0x24d1af){while(--_0x24d1af){_0x522ba9['push'](_0x522ba9['shift']());}};_0x47c818(++_0x2404f9);}(_0xe3ee,0x116));var _0xee3e=function(_0x4ad27b,_0x4138aa){_0x4ad27b=_0x4ad27b-0x0;var _0x2e2962=_0xe3ee[_0x4ad27b];return _0x2e2962;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee3e('0x0'))(_0xee3e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee3e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee3e('0x3'));var attributes=require('./teamVoiceQueue.attributes');module[_0xee3e('0x4')]=function(_0x352eca,_0x3907a7){return _0x352eca[_0xee3e('0x5')](_0xee3e('0x6'),attributes,{'tableName':_0xee3e('0x7'),'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 af6130c..2f6b85f 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 _0xec6b=['then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','request'];(function(_0x4e9de8,_0x4d17cf){var _0x4fdc06=function(_0x4dd45f){while(--_0x4dd45f){_0x4e9de8['push'](_0x4e9de8['shift']());}};_0x4fdc06(++_0x4d17cf);}(_0xec6b,0x129));var _0xbec6=function(_0x477710,_0x16174a){_0x477710=_0x477710-0x0;var _0x2e8240=_0xec6b[_0x477710];return _0x2e8240;};'use strict';var _=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));var moment=require('moment');var BPromise=require(_0xbec6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbec6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbec6('0x4'));var logger=require(_0xbec6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51c972,_0x6d3729,_0x5df981){return new BPromise(function(_0x58edd9,_0x3a0c1c){return client[_0xbec6('0x6')](_0x51c972,_0x5df981)[_0xbec6('0x7')](function(_0x3fff36){logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,_0xbec6('0xa'));logger[_0xbec6('0xb')](_0xbec6('0xc'),_0x6d3729,_0xbec6('0xa'),JSON[_0xbec6('0xd')](_0x3fff36));if(_0x3fff36[_0xbec6('0xe')]){if(_0x3fff36['error'][_0xbec6('0xf')]===0x1f4){logger['error'](_0xbec6('0x9'),_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x3a0c1c(_0x3fff36[_0xbec6('0xe')]['message']);}logger[_0xbec6('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x58edd9(_0x3fff36[_0xbec6('0xe')][_0xbec6('0x10')]);}else{logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,'request\x20sent');_0x58edd9(_0x3fff36[_0xbec6('0x11')]['message']);}})[_0xbec6('0x12')](function(_0x20924c){logger[_0xbec6('0xe')](_0xbec6('0x9'),_0x6d3729,_0x20924c);_0x3a0c1c(_0x20924c);});});} \ No newline at end of file +var _0x0ad1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash'];(function(_0x2ac756,_0x33408b){var _0xa621fb=function(_0x5a316f){while(--_0x5a316f){_0x2ac756['push'](_0x2ac756['shift']());}};_0xa621fb(++_0x33408b);}(_0x0ad1,0x149));var _0x10ad=function(_0x5268d0,_0x4168da){_0x5268d0=_0x5268d0-0x0;var _0x1aa9d9=_0x0ad1[_0x5268d0];return _0x1aa9d9;};'use strict';var _=require(_0x10ad('0x0'));var util=require(_0x10ad('0x1'));var moment=require(_0x10ad('0x2'));var BPromise=require(_0x10ad('0x3'));var rs=require(_0x10ad('0x4'));var fs=require('fs');var Redis=require(_0x10ad('0x5'));var db=require(_0x10ad('0x6'))['db'];var utils=require(_0x10ad('0x7'));var logger=require(_0x10ad('0x8'))('rpc');var config=require(_0x10ad('0x9'));var jayson=require(_0x10ad('0xa'));var client=jayson['client'][_0x10ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x171677,_0x3805a7,_0xb02c1f){return new BPromise(function(_0x2263a9,_0x5742d8){return client[_0x10ad('0xc')](_0x171677,_0xb02c1f)[_0x10ad('0xd')](function(_0x4fc4fc){logger[_0x10ad('0xe')](_0x10ad('0xf'),_0x3805a7,'request\x20sent');logger[_0x10ad('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3805a7,_0x10ad('0x11'),JSON['stringify'](_0x4fc4fc));if(_0x4fc4fc[_0x10ad('0x12')]){if(_0x4fc4fc[_0x10ad('0x12')][_0x10ad('0x13')]===0x1f4){logger[_0x10ad('0x12')](_0x10ad('0xf'),_0x3805a7,_0x4fc4fc[_0x10ad('0x12')][_0x10ad('0x14')]);return _0x5742d8(_0x4fc4fc[_0x10ad('0x12')][_0x10ad('0x14')]);}logger[_0x10ad('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3805a7,_0x4fc4fc[_0x10ad('0x12')][_0x10ad('0x14')]);return _0x2263a9(_0x4fc4fc['error']['message']);}else{logger[_0x10ad('0xe')](_0x10ad('0xf'),_0x3805a7,'request\x20sent');_0x2263a9(_0x4fc4fc[_0x10ad('0x15')][_0x10ad('0x14')]);}})['catch'](function(_0x3c2f5f){logger[_0x10ad('0x12')](_0x10ad('0xf'),_0x3805a7,_0x3c2f5f);_0x5742d8(_0x3c2f5f);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index bc253b8..9f6eed2 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 _0xd959=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3a3340,_0x16867e){var _0x16b573=function(_0x236632){while(--_0x236632){_0x3a3340['push'](_0x3a3340['shift']());}};_0x16b573(++_0x16867e);}(_0xd959,0x94));var _0x9d95=function(_0x3d278f,_0x5db7ba){_0x3d278f=_0x3d278f-0x0;var _0x33261a=_0xd959[_0x3d278f];return _0x33261a;};'use strict';var multer=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var path=require(_0x9d95('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d95('0x3'));var router=express[_0x9d95('0x4')]();var fs_extra=require(_0x9d95('0x5'));var auth=require(_0x9d95('0x6'));var interaction=require(_0x9d95('0x7'));var config=require('../../config/environment');var controller=require(_0x9d95('0x8'));router[_0x9d95('0x9')]('/',auth[_0x9d95('0xa')](),controller[_0x9d95('0xb')]);router['get'](_0x9d95('0xc'),auth[_0x9d95('0xa')](),controller[_0x9d95('0xd')]);router['post']('/',auth[_0x9d95('0xa')](),controller['create']);router[_0x9d95('0xe')](_0x9d95('0xc'),auth[_0x9d95('0xa')](),controller[_0x9d95('0xf')]);router[_0x9d95('0x10')]('/:id',auth[_0x9d95('0xa')](),controller[_0x9d95('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa46e=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','create','update','delete'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0xa46e,0x8a));var _0xea46=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0xa46e[_0x274dd7];return _0x148829;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./template.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0xb')]('/',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xea46('0xd')]);router[_0xea46('0xe')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xf')]);module[_0xea46('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 63e28cd..a28f9fb 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 _0x1275=['exports','STRING','TEXT','sequelize'];(function(_0x23f687,_0x2f63a7){var _0x5f4aa2=function(_0x2b6689){while(--_0x2b6689){_0x23f687['push'](_0x23f687['shift']());}};_0x5f4aa2(++_0x2f63a7);}(_0x1275,0x107));var _0x5127=function(_0x4e54ab,_0x1f12ef){_0x4e54ab=_0x4e54ab-0x0;var _0x344b55=_0x1275[_0x4e54ab];return _0x344b55;};'use strict';var Sequelize=require(_0x5127('0x0'));module[_0x5127('0x1')]={'name':{'type':Sequelize[_0x5127('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x5127('0x3')]}}; \ No newline at end of file +var _0x6df6=['STRING','TEXT','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6df6,0x191));var _0x66df=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x6df6[_0x2ca9d4];return _0x258956;};'use strict';var Sequelize=require(_0x66df('0x0'));module['exports']={'name':{'type':Sequelize[_0x66df('0x1')]},'description':{'type':Sequelize[_0x66df('0x1')]},'html':{'type':Sequelize[_0x66df('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 249fcb3..2a6fe33 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 _0x3c5e=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','get','Templates','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','key','keys','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','Template','findAll','rows','catch','show','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x9647da,_0x1f7117){var _0x25c414=function(_0x260ce6){while(--_0x260ce6){_0x9647da['push'](_0x9647da['shift']());}};_0x25c414(++_0x1f7117);}(_0x3c5e,0x91));var _0xe3c5=function(_0x2699ed,_0x5043c9){_0x2699ed=_0x2699ed-0x0;var _0x5d4179=_0x3c5e[_0x2699ed];return _0x5d4179;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3c5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3c5('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xe3c5('0x2'));var util=require(_0xe3c5('0x3'));var path=require('path');var sox=require(_0xe3c5('0x4'));var csv=require('to-csv');var ejs=require(_0xe3c5('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3c5('0x6'));var squel=require(_0xe3c5('0x7'));var crypto=require(_0xe3c5('0x8'));var jsforce=require(_0xe3c5('0x9'));var deskjs=require(_0xe3c5('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe3c5('0xb'));var Redis=require(_0xe3c5('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe3c5('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3c5('0xe'));var logger=require('../../config/logger')(_0xe3c5('0xf'));var utils=require(_0xe3c5('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe3c5('0x11'));var db=require(_0xe3c5('0x12'))['db'];function respondWithStatusCode(_0x344b30,_0x5ec895){_0x5ec895=_0x5ec895||0xcc;return function(_0x195d75){if(_0x195d75){return _0x344b30[_0xe3c5('0x13')](_0x5ec895);}return _0x344b30[_0xe3c5('0x14')](_0x5ec895)['end']();};}function respondWithResult(_0x3a6191,_0x4e0371){_0x4e0371=_0x4e0371||0xc8;return function(_0x5388e5){if(_0x5388e5){return _0x3a6191[_0xe3c5('0x14')](_0x4e0371)[_0xe3c5('0x15')](_0x5388e5);}};}function respondWithFilteredResult(_0x49dc2e,_0x10eeea){return function(_0x496c9a){if(_0x496c9a){var _0xf69d16=typeof _0x10eeea[_0xe3c5('0x16')]==='undefined'&&typeof _0x10eeea['limit']===_0xe3c5('0x17');var _0x131134=_0x496c9a[_0xe3c5('0x18')];var _0xe66274=_0xf69d16?0x0:_0x10eeea[_0xe3c5('0x16')];var _0x51d724=_0xf69d16?_0x496c9a[_0xe3c5('0x18')]:_0x10eeea['offset']+_0x10eeea[_0xe3c5('0x19')];var _0x35fd0d;if(_0x51d724>=_0x131134){_0x51d724=_0x131134;_0x35fd0d=0xc8;}else{_0x35fd0d=0xce;}_0x49dc2e['status'](_0x35fd0d);return _0x49dc2e[_0xe3c5('0x1a')](_0xe3c5('0x1b'),_0xe66274+'-'+_0x51d724+'/'+_0x131134)['json'](_0x496c9a);}return null;};}function patchUpdates(_0x1023b2){return function(_0xb8096e){try{jsonpatch['apply'](_0xb8096e,_0x1023b2,!![]);}catch(_0x615d71){return BPromise[_0xe3c5('0x1c')](_0x615d71);}return _0xb8096e['save']();};}function saveUpdates(_0x2c1f41,_0x43006d){return function(_0x10b29b){if(_0x10b29b){return _0x10b29b[_0xe3c5('0x1d')](_0x2c1f41)[_0xe3c5('0x1e')](function(_0x361c78){return _0x361c78;});}return null;};}function removeEntity(_0x4a238a,_0x3fc587){return function(_0x255501){if(_0x255501){return _0x255501[_0xe3c5('0x1f')]()[_0xe3c5('0x1e')](function(){var _0x98545=_0x255501[_0xe3c5('0x20')]({'plain':!![]});var _0x5687e9=_0xe3c5('0x21');return db[_0xe3c5('0x22')][_0xe3c5('0x1f')]({'where':{'type':_0x5687e9,'resourceId':_0x98545['id']}})[_0xe3c5('0x1e')](function(){return _0x255501;});})['then'](function(){_0x4a238a[_0xe3c5('0x14')](0xcc)[_0xe3c5('0x23')]();});}};}function handleEntityNotFound(_0x4f77e3,_0x4a83c0){return function(_0x1a2ef5){if(!_0x1a2ef5){_0x4f77e3['sendStatus'](0x194);}return _0x1a2ef5;};}function handleError(_0x1b91ac,_0x5b7336){_0x5b7336=_0x5b7336||0x1f4;return function(_0x54f3f3){logger['error'](_0x54f3f3['stack']);if(_0x54f3f3[_0xe3c5('0x24')]){delete _0x54f3f3[_0xe3c5('0x24')];}_0x1b91ac[_0xe3c5('0x14')](_0x5b7336)[_0xe3c5('0x25')](_0x54f3f3);};}exports[_0xe3c5('0x26')]=function(_0x5e4029,_0x2cc380){var _0x3f5dee={},_0x58df90={},_0x42832a={'count':0x0,'rows':[]};var _0x166ef1=_[_0xe3c5('0x27')](db['Template'][_0xe3c5('0x28')],function(_0x1e1b2d){return{'name':_0x1e1b2d[_0xe3c5('0x29')],'type':_0x1e1b2d['type'][_0xe3c5('0x2a')]};});_0x58df90['model']=_[_0xe3c5('0x27')](_0x166ef1,'name');_0x58df90['query']=_[_0xe3c5('0x2b')](_0x5e4029['query']);_0x58df90['filters']=_[_0xe3c5('0x2c')](_0x58df90['model'],_0x58df90[_0xe3c5('0x2d')]);_0x3f5dee[_0xe3c5('0x2e')]=_[_0xe3c5('0x2c')](_0x58df90[_0xe3c5('0x2f')],qs[_0xe3c5('0x30')](_0x5e4029[_0xe3c5('0x2d')][_0xe3c5('0x30')]));_0x3f5dee[_0xe3c5('0x2e')]=_0x3f5dee[_0xe3c5('0x2e')][_0xe3c5('0x31')]?_0x3f5dee[_0xe3c5('0x2e')]:_0x58df90[_0xe3c5('0x2f')];if(!_0x5e4029[_0xe3c5('0x2d')][_0xe3c5('0x32')](_0xe3c5('0x33'))){_0x3f5dee[_0xe3c5('0x19')]=qs[_0xe3c5('0x19')](_0x5e4029[_0xe3c5('0x2d')]['limit']);_0x3f5dee[_0xe3c5('0x16')]=qs['offset'](_0x5e4029[_0xe3c5('0x2d')]['offset']);}_0x3f5dee[_0xe3c5('0x34')]=qs[_0xe3c5('0x35')](_0x5e4029[_0xe3c5('0x2d')][_0xe3c5('0x35')]);_0x3f5dee[_0xe3c5('0x36')]=qs[_0xe3c5('0x37')](_[_0xe3c5('0x38')](_0x5e4029[_0xe3c5('0x2d')],_0x58df90[_0xe3c5('0x37')]),_0x166ef1);if(_0x5e4029[_0xe3c5('0x2d')]['filter']){_0x3f5dee[_0xe3c5('0x36')]=_[_0xe3c5('0x39')](_0x3f5dee[_0xe3c5('0x36')],{'$or':_[_0xe3c5('0x27')](_0x166ef1,function(_0x26648e){if(_0x26648e[_0xe3c5('0x3a')]!==_0xe3c5('0x3b')){var _0x357037={};_0x357037[_0x26648e[_0xe3c5('0x24')]]={'$like':'%'+_0x5e4029[_0xe3c5('0x2d')][_0xe3c5('0x3c')]+'%'};return _0x357037;}})});}_0x3f5dee=_[_0xe3c5('0x39')]({},_0x3f5dee,_0x5e4029[_0xe3c5('0x3d')]);var _0x26b789={'where':_0x3f5dee[_0xe3c5('0x36')]};return db[_0xe3c5('0x3e')][_0xe3c5('0x18')](_0x26b789)[_0xe3c5('0x1e')](function(_0x3ad226){_0x42832a[_0xe3c5('0x18')]=_0x3ad226;if(_0x5e4029[_0xe3c5('0x2d')]['includeAll']){_0x3f5dee['include']=[{'all':!![]}];}return db[_0xe3c5('0x3e')][_0xe3c5('0x3f')](_0x3f5dee);})[_0xe3c5('0x1e')](function(_0x5ef6b2){_0x42832a[_0xe3c5('0x40')]=_0x5ef6b2;return _0x42832a;})['then'](respondWithFilteredResult(_0x2cc380,_0x3f5dee))[_0xe3c5('0x41')](handleError(_0x2cc380,null));};exports[_0xe3c5('0x42')]=function(_0x14a44f,_0x32a995){var _0x5c99f6={'raw':!![],'where':{'id':_0x14a44f[_0xe3c5('0x43')]['id']}},_0x56f03f={};_0x56f03f[_0xe3c5('0x2f')]=_[_0xe3c5('0x2b')](db[_0xe3c5('0x3e')]['rawAttributes']);_0x56f03f[_0xe3c5('0x2d')]=_['keys'](_0x14a44f[_0xe3c5('0x2d')]);_0x56f03f[_0xe3c5('0x37')]=_[_0xe3c5('0x2c')](_0x56f03f['model'],_0x56f03f[_0xe3c5('0x2d')]);_0x5c99f6[_0xe3c5('0x2e')]=_[_0xe3c5('0x2c')](_0x56f03f['model'],qs[_0xe3c5('0x30')](_0x14a44f[_0xe3c5('0x2d')]['fields']));_0x5c99f6[_0xe3c5('0x2e')]=_0x5c99f6['attributes']['length']?_0x5c99f6[_0xe3c5('0x2e')]:_0x56f03f[_0xe3c5('0x2f')];if(_0x14a44f[_0xe3c5('0x2d')][_0xe3c5('0x44')]){_0x5c99f6[_0xe3c5('0x45')]=[{'all':!![]}];}_0x5c99f6=_['merge']({},_0x5c99f6,_0x14a44f[_0xe3c5('0x3d')]);return db['Template']['find'](_0x5c99f6)[_0xe3c5('0x1e')](handleEntityNotFound(_0x32a995,null))[_0xe3c5('0x1e')](respondWithResult(_0x32a995,null))['catch'](handleError(_0x32a995,null));};exports[_0xe3c5('0x46')]=function(_0xb58def,_0xaff2df){return db[_0xe3c5('0x3e')]['create'](_0xb58def[_0xe3c5('0x47')],{})[_0xe3c5('0x1e')](function(_0x47d8fe){var _0x3e40f2=_0xb58def[_0xe3c5('0x48')][_0xe3c5('0x20')]({'plain':!![]});if(!_0x3e40f2)throw new Error(_0xe3c5('0x49'));if(_0x3e40f2[_0xe3c5('0x4a')]===_0xe3c5('0x48')){var _0x576d4a=_0x47d8fe[_0xe3c5('0x20')]({'plain':!![]});var _0x177ee8=_0xe3c5('0x21');return db[_0xe3c5('0x4b')][_0xe3c5('0x4c')]({'where':{'name':_0x177ee8,'userProfileId':_0x3e40f2['userProfileId']},'raw':!![]})[_0xe3c5('0x1e')](function(_0x449d30){if(_0x449d30&&_0x449d30['autoAssociation']===0x0){return db['UserProfileResource'][_0xe3c5('0x46')]({'name':_0x576d4a[_0xe3c5('0x24')],'resourceId':_0x576d4a['id'],'type':_0x449d30['name'],'sectionId':_0x449d30['id']},{})[_0xe3c5('0x1e')](function(){return _0x47d8fe;});}else{return _0x47d8fe;}})[_0xe3c5('0x41')](function(_0x551e00){logger[_0xe3c5('0x4d')](_0xe3c5('0x4e'),_0x551e00);throw _0x551e00;});}return _0x47d8fe;})['then'](respondWithResult(_0xaff2df,0xc9))[_0xe3c5('0x41')](handleError(_0xaff2df,null));};exports[_0xe3c5('0x1d')]=function(_0x14148e,_0x375738){if(_0x14148e[_0xe3c5('0x47')]['id']){delete _0x14148e[_0xe3c5('0x47')]['id'];}return db['Template'][_0xe3c5('0x4c')]({'where':{'id':_0x14148e[_0xe3c5('0x43')]['id']}})[_0xe3c5('0x1e')](handleEntityNotFound(_0x375738,null))['then'](saveUpdates(_0x14148e['body'],null))[_0xe3c5('0x1e')](respondWithResult(_0x375738,null))[_0xe3c5('0x41')](handleError(_0x375738,null));};exports['destroy']=function(_0x49a7ee,_0x50a298){return db[_0xe3c5('0x3e')][_0xe3c5('0x4c')]({'where':{'id':_0x49a7ee[_0xe3c5('0x43')]['id']}})[_0xe3c5('0x1e')](handleEntityNotFound(_0x50a298,null))[_0xe3c5('0x1e')](removeEntity(_0x50a298,null))[_0xe3c5('0x41')](handleError(_0x50a298,null));}; \ No newline at end of file +var _0x020c=['type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Templates','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','Template','fieldName'];(function(_0x4f8709,_0x252add){var _0x1d4968=function(_0x2f3d78){while(--_0x2f3d78){_0x4f8709['push'](_0x4f8709['shift']());}};_0x1d4968(++_0x252add);}(_0x020c,0x18e));var _0xc020=function(_0x14bd71,_0x389274){_0x14bd71=_0x14bd71-0x0;var _0x115ad7=_0x020c[_0x14bd71];return _0x115ad7;};'use strict';var emlformat=require(_0xc020('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc020('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc020('0x2'));var moment=require(_0xc020('0x3'));var BPromise=require(_0xc020('0x4'));var Mustache=require(_0xc020('0x5'));var util=require(_0xc020('0x6'));var path=require(_0xc020('0x7'));var sox=require(_0xc020('0x8'));var csv=require('to-csv');var ejs=require(_0xc020('0x9'));var fs=require('fs');var fs_extra=require(_0xc020('0xa'));var _=require(_0xc020('0xb'));var squel=require('squel');var crypto=require(_0xc020('0xc'));var jsforce=require(_0xc020('0xd'));var deskjs=require(_0xc020('0xe'));var toCsv=require(_0xc020('0xf'));var querystring=require(_0xc020('0x10'));var Papa=require(_0xc020('0x11'));var Redis=require(_0xc020('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc020('0x13'));var as=require(_0xc020('0x14'));var hardwareService=require(_0xc020('0x15'));var logger=require(_0xc020('0x16'))(_0xc020('0x17'));var utils=require(_0xc020('0x18'));var config=require(_0xc020('0x19'));var licenseUtil=require(_0xc020('0x1a'));var db=require(_0xc020('0x1b'))['db'];function respondWithStatusCode(_0x3c8046,_0xfc3d6b){_0xfc3d6b=_0xfc3d6b||0xcc;return function(_0x4d87b2){if(_0x4d87b2){return _0x3c8046[_0xc020('0x1c')](_0xfc3d6b);}return _0x3c8046[_0xc020('0x1d')](_0xfc3d6b)[_0xc020('0x1e')]();};}function respondWithResult(_0x1f2f03,_0x61fbaa){_0x61fbaa=_0x61fbaa||0xc8;return function(_0x3495ec){if(_0x3495ec){return _0x1f2f03['status'](_0x61fbaa)[_0xc020('0x1f')](_0x3495ec);}};}function respondWithFilteredResult(_0x1c38ff,_0x5b0c94){return function(_0x4ad326){if(_0x4ad326){var _0x41a029=typeof _0x5b0c94[_0xc020('0x20')]===_0xc020('0x21')&&typeof _0x5b0c94['limit']==='undefined';var _0x5522c6=_0x4ad326[_0xc020('0x22')];var _0x4005be=_0x41a029?0x0:_0x5b0c94[_0xc020('0x20')];var _0x584b59=_0x41a029?_0x4ad326[_0xc020('0x22')]:_0x5b0c94['offset']+_0x5b0c94[_0xc020('0x23')];var _0xd2c579;if(_0x584b59>=_0x5522c6){_0x584b59=_0x5522c6;_0xd2c579=0xc8;}else{_0xd2c579=0xce;}_0x1c38ff[_0xc020('0x1d')](_0xd2c579);return _0x1c38ff[_0xc020('0x24')]('Content-Range',_0x4005be+'-'+_0x584b59+'/'+_0x5522c6)[_0xc020('0x1f')](_0x4ad326);}return null;};}function patchUpdates(_0x1bca5a){return function(_0x291e95){try{jsonpatch[_0xc020('0x25')](_0x291e95,_0x1bca5a,!![]);}catch(_0x3a4a3c){return BPromise[_0xc020('0x26')](_0x3a4a3c);}return _0x291e95[_0xc020('0x27')]();};}function saveUpdates(_0x116415,_0x3df0b8){return function(_0x52827f){if(_0x52827f){return _0x52827f[_0xc020('0x28')](_0x116415)['then'](function(_0x913df0){return _0x913df0;});}return null;};}function removeEntity(_0x2b78cd,_0x250352){return function(_0x2a0d1a){if(_0x2a0d1a){return _0x2a0d1a['destroy']()[_0xc020('0x29')](function(){var _0x58ad22=_0x2a0d1a['get']({'plain':!![]});var _0x3fe994='Templates';return db[_0xc020('0x2a')][_0xc020('0x2b')]({'where':{'type':_0x3fe994,'resourceId':_0x58ad22['id']}})[_0xc020('0x29')](function(){return _0x2a0d1a;});})[_0xc020('0x29')](function(){_0x2b78cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b17c5,_0x226866){return function(_0x1beaec){if(!_0x1beaec){_0x3b17c5['sendStatus'](0x194);}return _0x1beaec;};}function handleError(_0x4613a3,_0x3c645c){_0x3c645c=_0x3c645c||0x1f4;return function(_0x56020a){logger[_0xc020('0x2c')](_0x56020a[_0xc020('0x2d')]);if(_0x56020a['name']){delete _0x56020a[_0xc020('0x2e')];}_0x4613a3[_0xc020('0x1d')](_0x3c645c)[_0xc020('0x2f')](_0x56020a);};}exports[_0xc020('0x30')]=function(_0x2f5e50,_0x3afd59){var _0x5412c5={},_0x1c6d62={},_0x40530a={'count':0x0,'rows':[]};var _0xf3f8cf=_[_0xc020('0x31')](db[_0xc020('0x32')]['rawAttributes'],function(_0xc7df67){return{'name':_0xc7df67[_0xc020('0x33')],'type':_0xc7df67[_0xc020('0x34')][_0xc020('0x35')]};});_0x1c6d62['model']=_[_0xc020('0x31')](_0xf3f8cf,_0xc020('0x2e'));_0x1c6d62[_0xc020('0x36')]=_[_0xc020('0x37')](_0x2f5e50[_0xc020('0x36')]);_0x1c6d62[_0xc020('0x38')]=_[_0xc020('0x39')](_0x1c6d62[_0xc020('0x3a')],_0x1c6d62['query']);_0x5412c5[_0xc020('0x3b')]=_[_0xc020('0x39')](_0x1c6d62['model'],qs[_0xc020('0x3c')](_0x2f5e50[_0xc020('0x36')]['fields']));_0x5412c5[_0xc020('0x3b')]=_0x5412c5[_0xc020('0x3b')][_0xc020('0x3d')]?_0x5412c5['attributes']:_0x1c6d62[_0xc020('0x3a')];if(!_0x2f5e50[_0xc020('0x36')][_0xc020('0x3e')]('nolimit')){_0x5412c5[_0xc020('0x23')]=qs[_0xc020('0x23')](_0x2f5e50[_0xc020('0x36')]['limit']);_0x5412c5[_0xc020('0x20')]=qs[_0xc020('0x20')](_0x2f5e50['query'][_0xc020('0x20')]);}_0x5412c5[_0xc020('0x3f')]=qs[_0xc020('0x40')](_0x2f5e50[_0xc020('0x36')][_0xc020('0x40')]);_0x5412c5[_0xc020('0x41')]=qs['filters'](_[_0xc020('0x42')](_0x2f5e50[_0xc020('0x36')],_0x1c6d62['filters']),_0xf3f8cf);if(_0x2f5e50[_0xc020('0x36')][_0xc020('0x43')]){_0x5412c5[_0xc020('0x41')]=_[_0xc020('0x44')](_0x5412c5[_0xc020('0x41')],{'$or':_['map'](_0xf3f8cf,function(_0x588cab){if(_0x588cab[_0xc020('0x34')]!==_0xc020('0x45')){var _0x30bc10={};_0x30bc10[_0x588cab['name']]={'$like':'%'+_0x2f5e50[_0xc020('0x36')][_0xc020('0x43')]+'%'};return _0x30bc10;}})});}_0x5412c5=_['merge']({},_0x5412c5,_0x2f5e50['options']);var _0x5cab0f={'where':_0x5412c5['where']};return db[_0xc020('0x32')]['count'](_0x5cab0f)[_0xc020('0x29')](function(_0x5addc7){_0x40530a[_0xc020('0x22')]=_0x5addc7;if(_0x2f5e50[_0xc020('0x36')][_0xc020('0x46')]){_0x5412c5[_0xc020('0x47')]=[{'all':!![]}];}return db['Template'][_0xc020('0x48')](_0x5412c5);})[_0xc020('0x29')](function(_0x67bef3){_0x40530a[_0xc020('0x49')]=_0x67bef3;return _0x40530a;})[_0xc020('0x29')](respondWithFilteredResult(_0x3afd59,_0x5412c5))['catch'](handleError(_0x3afd59,null));};exports[_0xc020('0x4a')]=function(_0x189822,_0x13e757){var _0x3cf249={'raw':!![],'where':{'id':_0x189822[_0xc020('0x4b')]['id']}},_0xa1f84b={};_0xa1f84b[_0xc020('0x3a')]=_[_0xc020('0x37')](db[_0xc020('0x32')][_0xc020('0x4c')]);_0xa1f84b['query']=_['keys'](_0x189822[_0xc020('0x36')]);_0xa1f84b[_0xc020('0x38')]=_['intersection'](_0xa1f84b[_0xc020('0x3a')],_0xa1f84b['query']);_0x3cf249['attributes']=_[_0xc020('0x39')](_0xa1f84b[_0xc020('0x3a')],qs[_0xc020('0x3c')](_0x189822[_0xc020('0x36')][_0xc020('0x3c')]));_0x3cf249[_0xc020('0x3b')]=_0x3cf249[_0xc020('0x3b')][_0xc020('0x3d')]?_0x3cf249[_0xc020('0x3b')]:_0xa1f84b[_0xc020('0x3a')];if(_0x189822[_0xc020('0x36')]['includeAll']){_0x3cf249[_0xc020('0x47')]=[{'all':!![]}];}_0x3cf249=_[_0xc020('0x44')]({},_0x3cf249,_0x189822['options']);return db[_0xc020('0x32')]['find'](_0x3cf249)[_0xc020('0x29')](handleEntityNotFound(_0x13e757,null))[_0xc020('0x29')](respondWithResult(_0x13e757,null))[_0xc020('0x4d')](handleError(_0x13e757,null));};exports[_0xc020('0x4e')]=function(_0x3773d7,_0x3ae326){return db[_0xc020('0x32')]['create'](_0x3773d7[_0xc020('0x4f')],{})[_0xc020('0x29')](function(_0x3076cf){var _0x269d98=_0x3773d7[_0xc020('0x50')]['get']({'plain':!![]});if(!_0x269d98)throw new Error(_0xc020('0x51'));if(_0x269d98[_0xc020('0x52')]===_0xc020('0x50')){var _0x1f2233=_0x3076cf[_0xc020('0x53')]({'plain':!![]});var _0x9132e9=_0xc020('0x54');return db[_0xc020('0x55')][_0xc020('0x56')]({'where':{'name':_0x9132e9,'userProfileId':_0x269d98[_0xc020('0x57')]},'raw':!![]})[_0xc020('0x29')](function(_0x472f4d){if(_0x472f4d&&_0x472f4d[_0xc020('0x58')]===0x0){return db['UserProfileResource'][_0xc020('0x4e')]({'name':_0x1f2233[_0xc020('0x2e')],'resourceId':_0x1f2233['id'],'type':_0x472f4d[_0xc020('0x2e')],'sectionId':_0x472f4d['id']},{})[_0xc020('0x29')](function(){return _0x3076cf;});}else{return _0x3076cf;}})[_0xc020('0x4d')](function(_0x56ddf4){logger['error'](_0xc020('0x59'),_0x56ddf4);throw _0x56ddf4;});}return _0x3076cf;})[_0xc020('0x29')](respondWithResult(_0x3ae326,0xc9))[_0xc020('0x4d')](handleError(_0x3ae326,null));};exports['update']=function(_0x5756c0,_0x26f88c){if(_0x5756c0[_0xc020('0x4f')]['id']){delete _0x5756c0[_0xc020('0x4f')]['id'];}return db[_0xc020('0x32')][_0xc020('0x56')]({'where':{'id':_0x5756c0[_0xc020('0x4b')]['id']}})['then'](handleEntityNotFound(_0x26f88c,null))[_0xc020('0x29')](saveUpdates(_0x5756c0[_0xc020('0x4f')],null))['then'](respondWithResult(_0x26f88c,null))[_0xc020('0x4d')](handleError(_0x26f88c,null));};exports[_0xc020('0x2b')]=function(_0x40a3ca,_0x2cdc90){return db[_0xc020('0x32')][_0xc020('0x56')]({'where':{'id':_0x40a3ca['params']['id']}})[_0xc020('0x29')](handleEntityNotFound(_0x2cdc90,null))['then'](removeEntity(_0x2cdc90,null))[_0xc020('0x4d')](handleError(_0x2cdc90,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 5c6e293..9d8dccf 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 _0xedfa=['path','rimraf','./template.attributes','define','tools_templates','util','api','bluebird','request-promise'];(function(_0x1a8f8d,_0x422e91){var _0x35bbc1=function(_0x148343){while(--_0x148343){_0x1a8f8d['push'](_0x1a8f8d['shift']());}};_0x35bbc1(++_0x422e91);}(_0xedfa,0xdd));var _0xaedf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedfa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xaedf('0x0'));var logger=require('../../config/logger')(_0xaedf('0x1'));var moment=require('moment');var BPromise=require(_0xaedf('0x2'));var rp=require(_0xaedf('0x3'));var fs=require('fs');var path=require(_0xaedf('0x4'));var rimraf=require(_0xaedf('0x5'));var config=require('../../config/environment');var attributes=require(_0xaedf('0x6'));module['exports']=function(_0x19d0f4,_0x2926c9){return _0x19d0f4[_0xaedf('0x7')]('Template',attributes,{'tableName':_0xaedf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13a1=['./template.attributes','exports','define','Template','tools_templates','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4318ee,_0x1f9e7f){var _0x52e97b=function(_0x339826){while(--_0x339826){_0x4318ee['push'](_0x4318ee['shift']());}};_0x52e97b(++_0x1f9e7f);}(_0x13a1,0x1e5));var _0x113a=function(_0x190b22,_0x20a6b8){_0x190b22=_0x190b22-0x0;var _0x9093c3=_0x13a1[_0x190b22];return _0x9093c3;};'use strict';var _=require(_0x113a('0x0'));var util=require('util');var logger=require(_0x113a('0x1'))('api');var moment=require(_0x113a('0x2'));var BPromise=require(_0x113a('0x3'));var rp=require(_0x113a('0x4'));var fs=require('fs');var path=require(_0x113a('0x5'));var rimraf=require(_0x113a('0x6'));var config=require('../../config/environment');var attributes=require(_0x113a('0x7'));module[_0x113a('0x8')]=function(_0x8c9180,_0x5acf0a){return _0x8c9180[_0x113a('0x9')](_0x113a('0xa'),attributes,{'tableName':_0x113a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 24c406c..84c9040 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 _0x4d4b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','message','info','result','GetTemplate','Template','findAll','options','raw','where','limit','include','map','model','attributes','stringify'];(function(_0x2f689b,_0x1f10a0){var _0x515c8f=function(_0x2e69c0){while(--_0x2e69c0){_0x2f689b['push'](_0x2f689b['shift']());}};_0x515c8f(++_0x1f10a0);}(_0x4d4b,0xf5));var _0xb4d4=function(_0x287184,_0x1231a7){_0x287184=_0x287184-0x0;var _0x1b59f3=_0x4d4b[_0x287184];return _0x1b59f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb4d4('0x0'));var BPromise=require(_0xb4d4('0x1'));var rs=require(_0xb4d4('0x2'));var fs=require('fs');var Redis=require(_0xb4d4('0x3'));var db=require(_0xb4d4('0x4'))['db'];var utils=require(_0xb4d4('0x5'));var logger=require(_0xb4d4('0x6'))(_0xb4d4('0x7'));var config=require(_0xb4d4('0x8'));var jayson=require(_0xb4d4('0x9'));var client=jayson[_0xb4d4('0xa')][_0xb4d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18612d,_0x19ab48,_0x178707){return new BPromise(function(_0x1829f3,_0x595652){return client[_0xb4d4('0xc')](_0x18612d,_0x178707)[_0xb4d4('0xd')](function(_0x1c8c6b){logger['info']('Template,\x20%s,\x20%s',_0x19ab48,_0xb4d4('0xe'));logger[_0xb4d4('0xf')](_0xb4d4('0x10'),_0x19ab48,_0xb4d4('0xe'),JSON['stringify'](_0x1c8c6b));if(_0x1c8c6b[_0xb4d4('0x11')]){if(_0x1c8c6b[_0xb4d4('0x11')][_0xb4d4('0x12')]===0x1f4){logger['error'](_0xb4d4('0x13'),_0x19ab48,_0x1c8c6b[_0xb4d4('0x11')][_0xb4d4('0x14')]);return _0x595652(_0x1c8c6b['error']['message']);}logger[_0xb4d4('0x11')]('Template,\x20%s,\x20%s',_0x19ab48,_0x1c8c6b[_0xb4d4('0x11')][_0xb4d4('0x14')]);return _0x1829f3(_0x1c8c6b[_0xb4d4('0x11')][_0xb4d4('0x14')]);}else{logger[_0xb4d4('0x15')](_0xb4d4('0x13'),_0x19ab48,_0xb4d4('0xe'));_0x1829f3(_0x1c8c6b[_0xb4d4('0x16')]['message']);}})['catch'](function(_0x5235f3){logger['error'](_0xb4d4('0x13'),_0x19ab48,_0x5235f3);_0x595652(_0x5235f3);});});}exports[_0xb4d4('0x17')]=function(_0x48f292){var _0x1bf052=this;return new Promise(function(_0x2b4485,_0x3c690d){return db[_0xb4d4('0x18')][_0xb4d4('0x19')]({'raw':_0x48f292[_0xb4d4('0x1a')]?_0x48f292['options'][_0xb4d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x48f292[_0xb4d4('0x1a')]?_0x48f292[_0xb4d4('0x1a')][_0xb4d4('0x1c')]||null:null,'attributes':_0x48f292['options']?_0x48f292[_0xb4d4('0x1a')]['attributes']||null:null,'limit':_0x48f292[_0xb4d4('0x1a')]?_0x48f292[_0xb4d4('0x1a')][_0xb4d4('0x1d')]||null:null,'include':_0x48f292[_0xb4d4('0x1a')]?_0x48f292[_0xb4d4('0x1a')][_0xb4d4('0x1e')]?_[_0xb4d4('0x1f')](_0x48f292[_0xb4d4('0x1a')][_0xb4d4('0x1e')],function(_0x216db6){return{'model':db[_0x216db6[_0xb4d4('0x20')]],'as':_0x216db6['as'],'attributes':_0x216db6['attributes'],'include':_0x216db6[_0xb4d4('0x1e')]?_[_0xb4d4('0x1f')](_0x216db6[_0xb4d4('0x1e')],function(_0x46363e){return{'model':db[_0x46363e[_0xb4d4('0x20')]],'as':_0x46363e['as'],'attributes':_0x46363e['attributes'],'include':_0x46363e[_0xb4d4('0x1e')]?_[_0xb4d4('0x1f')](_0x46363e[_0xb4d4('0x1e')],function(_0x612d74){return{'model':db[_0x612d74[_0xb4d4('0x20')]],'as':_0x612d74['as'],'attributes':_0x612d74[_0xb4d4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb4d4('0xd')](function(_0x579a73){logger['info'](_0xb4d4('0x17'),_0x48f292);logger[_0xb4d4('0xf')](_0xb4d4('0x17'),_0x48f292,JSON[_0xb4d4('0x22')](_0x579a73));_0x2b4485(_0x579a73);})['catch'](function(_0x5a8a43){logger[_0xb4d4('0x11')](_0xb4d4('0x17'),_0x5a8a43['message'],_0x48f292);_0x3c690d(_0x1bf052['error'](0x1f4,_0x5a8a43[_0xb4d4('0x14')]));});});}; \ No newline at end of file +var _0x9188=['attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTemplate','Template','options','raw'];(function(_0xb6b624,_0x2ee115){var _0x5e466d=function(_0x4e8e72){while(--_0x4e8e72){_0xb6b624['push'](_0xb6b624['shift']());}};_0x5e466d(++_0x2ee115);}(_0x9188,0xfc));var _0x8918=function(_0x1dcea6,_0x311cc6){_0x1dcea6=_0x1dcea6-0x0;var _0xcbd902=_0x9188[_0x1dcea6];return _0xcbd902;};'use strict';var _=require('lodash');var util=require(_0x8918('0x0'));var moment=require(_0x8918('0x1'));var BPromise=require(_0x8918('0x2'));var rs=require(_0x8918('0x3'));var fs=require('fs');var Redis=require(_0x8918('0x4'));var db=require(_0x8918('0x5'))['db'];var utils=require(_0x8918('0x6'));var logger=require('../../config/logger')(_0x8918('0x7'));var config=require(_0x8918('0x8'));var jayson=require(_0x8918('0x9'));var client=jayson['client'][_0x8918('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6856bf,_0x3a3f7e,_0x32dab5){return new BPromise(function(_0x767cc8,_0x693c1f){return client['request'](_0x6856bf,_0x32dab5)[_0x8918('0xb')](function(_0xf60b1c){logger['info'](_0x8918('0xc'),_0x3a3f7e,_0x8918('0xd'));logger[_0x8918('0xe')](_0x8918('0xf'),_0x3a3f7e,'request\x20sent',JSON[_0x8918('0x10')](_0xf60b1c));if(_0xf60b1c[_0x8918('0x11')]){if(_0xf60b1c[_0x8918('0x11')][_0x8918('0x12')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x3a3f7e,_0xf60b1c['error'][_0x8918('0x13')]);return _0x693c1f(_0xf60b1c[_0x8918('0x11')][_0x8918('0x13')]);}logger[_0x8918('0x11')](_0x8918('0xc'),_0x3a3f7e,_0xf60b1c[_0x8918('0x11')][_0x8918('0x13')]);return _0x767cc8(_0xf60b1c[_0x8918('0x11')]['message']);}else{logger[_0x8918('0x14')](_0x8918('0xc'),_0x3a3f7e,_0x8918('0xd'));_0x767cc8(_0xf60b1c[_0x8918('0x15')][_0x8918('0x13')]);}})[_0x8918('0x16')](function(_0x29e8e9){logger[_0x8918('0x11')](_0x8918('0xc'),_0x3a3f7e,_0x29e8e9);_0x693c1f(_0x29e8e9);});});}exports[_0x8918('0x17')]=function(_0x13b0ef){var _0x1c1500=this;return new Promise(function(_0x2d2a57,_0x98d2ec){return db[_0x8918('0x18')]['findAll']({'raw':_0x13b0ef[_0x8918('0x19')]?_0x13b0ef[_0x8918('0x19')][_0x8918('0x1a')]===undefined?!![]:![]:!![],'where':_0x13b0ef[_0x8918('0x19')]?_0x13b0ef[_0x8918('0x19')]['where']||null:null,'attributes':_0x13b0ef['options']?_0x13b0ef[_0x8918('0x19')][_0x8918('0x1b')]||null:null,'limit':_0x13b0ef[_0x8918('0x19')]?_0x13b0ef[_0x8918('0x19')]['limit']||null:null,'include':_0x13b0ef['options']?_0x13b0ef['options'][_0x8918('0x1c')]?_['map'](_0x13b0ef[_0x8918('0x19')]['include'],function(_0x3ba302){return{'model':db[_0x3ba302['model']],'as':_0x3ba302['as'],'attributes':_0x3ba302['attributes'],'include':_0x3ba302[_0x8918('0x1c')]?_['map'](_0x3ba302[_0x8918('0x1c')],function(_0x4bcc60){return{'model':db[_0x4bcc60[_0x8918('0x1d')]],'as':_0x4bcc60['as'],'attributes':_0x4bcc60[_0x8918('0x1b')],'include':_0x4bcc60[_0x8918('0x1c')]?_[_0x8918('0x1e')](_0x4bcc60[_0x8918('0x1c')],function(_0x3bdde9){return{'model':db[_0x3bdde9['model']],'as':_0x3bdde9['as'],'attributes':_0x3bdde9[_0x8918('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52e2ff){logger['info']('GetTemplate',_0x13b0ef);logger[_0x8918('0xe')]('GetTemplate',_0x13b0ef,JSON[_0x8918('0x10')](_0x52e2ff));_0x2d2a57(_0x52e2ff);})[_0x8918('0x16')](function(_0x156946){logger[_0x8918('0x11')](_0x8918('0x17'),_0x156946['message'],_0x13b0ef);_0x98d2ec(_0x1c1500['error'](0x1f4,_0x156946['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6e522d5..6f31eb0 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 _0xc27f=['../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x102d39,_0x41cb08){var _0x21098a=function(_0x22a404){while(--_0x22a404){_0x102d39['push'](_0x102d39['shift']());}};_0x21098a(++_0x41cb08);}(_0xc27f,0x85));var _0xfc27=function(_0x53a840,_0x496c09){_0x53a840=_0x53a840-0x0;var _0x3abeed=_0xc27f[_0x53a840];return _0x3abeed;};'use strict';var multer=require(_0xfc27('0x0'));var util=require(_0xfc27('0x1'));var path=require(_0xfc27('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc27('0x3'));var router=express[_0xfc27('0x4')]();var fs_extra=require(_0xfc27('0x5'));var auth=require(_0xfc27('0x6'));var interaction=require(_0xfc27('0x7'));var config=require(_0xfc27('0x8'));var controller=require(_0xfc27('0x9'));router[_0xfc27('0xa')]('/',auth[_0xfc27('0xb')](),controller[_0xfc27('0xc')]);router[_0xfc27('0xa')](_0xfc27('0xd'),auth[_0xfc27('0xb')](),controller['show']);router[_0xfc27('0xa')](_0xfc27('0xe'),auth[_0xfc27('0xb')](),controller['getAllConditions']);router['get']('/:id/any_conditions',auth[_0xfc27('0xb')](),controller[_0xfc27('0xf')]);router[_0xfc27('0xa')](_0xfc27('0x10'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x11')]);router[_0xfc27('0x12')]('/',auth[_0xfc27('0xb')](),controller[_0xfc27('0x13')]);router[_0xfc27('0x12')](_0xfc27('0xe'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x14')]);router[_0xfc27('0x12')](_0xfc27('0x15'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x16')]);router['post'](_0xfc27('0x10'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfc27('0x18')]);router[_0xfc27('0x19')]('/:id',auth[_0xfc27('0xb')](),controller[_0xfc27('0x1a')]);module[_0xfc27('0x1b')]=router; \ No newline at end of file +var _0xc7ee=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4b3edd,_0x1492f1){var _0x21a3cd=function(_0x383df9){while(--_0x383df9){_0x4b3edd['push'](_0x4b3edd['shift']());}};_0x21a3cd(++_0x1492f1);}(_0xc7ee,0x1aa));var _0xec7e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc7ee[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xec7e('0x0'));var util=require(_0xec7e('0x1'));var path=require(_0xec7e('0x2'));var timeout=require(_0xec7e('0x3'));var express=require(_0xec7e('0x4'));var router=express[_0xec7e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xec7e('0x6'));var interaction=require(_0xec7e('0x7'));var config=require(_0xec7e('0x8'));var controller=require(_0xec7e('0x9'));router[_0xec7e('0xa')]('/',auth[_0xec7e('0xb')](),controller[_0xec7e('0xc')]);router[_0xec7e('0xa')](_0xec7e('0xd'),auth[_0xec7e('0xb')](),controller[_0xec7e('0xe')]);router[_0xec7e('0xa')](_0xec7e('0xf'),auth[_0xec7e('0xb')](),controller['getAllConditions']);router[_0xec7e('0xa')](_0xec7e('0x10'),auth[_0xec7e('0xb')](),controller['getAnyConditions']);router[_0xec7e('0xa')](_0xec7e('0x11'),auth[_0xec7e('0xb')](),controller[_0xec7e('0x12')]);router[_0xec7e('0x13')]('/',auth[_0xec7e('0xb')](),controller[_0xec7e('0x14')]);router[_0xec7e('0x13')]('/:id/all_conditions',auth[_0xec7e('0xb')](),controller[_0xec7e('0x15')]);router[_0xec7e('0x13')](_0xec7e('0x10'),auth['isAuthenticated'](),controller[_0xec7e('0x16')]);router['post'](_0xec7e('0x11'),auth[_0xec7e('0xb')](),controller[_0xec7e('0x17')]);router['put'](_0xec7e('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xec7e('0x18')](_0xec7e('0xd'),auth[_0xec7e('0xb')](),controller[_0xec7e('0x19')]);module[_0xec7e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3522843..4457ac1 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 _0xcbef=['BOOLEAN','exports','STRING'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0xcbef,0xc1));var _0xfcbe=function(_0xbc2d9e,_0x40ef4f){_0xbc2d9e=_0xbc2d9e-0x0;var _0x2e315c=_0xcbef[_0xbc2d9e];return _0x2e315c;};'use strict';var Sequelize=require('sequelize');module[_0xfcbe('0x0')]={'name':{'type':Sequelize[_0xfcbe('0x1')]},'channel':{'type':Sequelize[_0xfcbe('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xfcbe('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5081=['BOOLEAN','sequelize','exports','STRING'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x5081,0x145));var _0x1508=function(_0x269a0c,_0x139f27){_0x269a0c=_0x269a0c-0x0;var _0x1ff60e=_0x5081[_0x269a0c];return _0x1ff60e;};'use strict';var Sequelize=require(_0x1508('0x0'));module[_0x1508('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1508('0x2')]},'description':{'type':Sequelize[_0x1508('0x2')]},'status':{'type':Sequelize[_0x1508('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 d5939e6..ae751f0 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 _0x8d20=['TriggerAnyId','getAllConditions','findOne','order','merge','hasOwnProperty','getAnyConditions','addAction','Action','getActions','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','then','destroy','get','Triggers','UserProfileResource','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','include','catch','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','addAllCondition','TriggerAllId','Condition','addAnyCondition'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8d20,0x67));var _0x08d2=function(_0x31312f,_0x3b8d58){_0x31312f=_0x31312f-0x0;var _0x1458af=_0x8d20[_0x31312f];return _0x1458af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x08d2('0x0'));var zipdir=require(_0x08d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08d2('0x2'));var moment=require('moment');var BPromise=require(_0x08d2('0x3'));var Mustache=require(_0x08d2('0x4'));var util=require('util');var path=require(_0x08d2('0x5'));var sox=require(_0x08d2('0x6'));var csv=require(_0x08d2('0x7'));var ejs=require(_0x08d2('0x8'));var fs=require('fs');var fs_extra=require(_0x08d2('0x9'));var _=require(_0x08d2('0xa'));var squel=require('squel');var crypto=require(_0x08d2('0xb'));var jsforce=require(_0x08d2('0xc'));var deskjs=require(_0x08d2('0xd'));var toCsv=require(_0x08d2('0x7'));var querystring=require(_0x08d2('0xe'));var Papa=require(_0x08d2('0xf'));var Redis=require('ioredis');var authService=require(_0x08d2('0x10'));var qs=require(_0x08d2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08d2('0x12'));var logger=require(_0x08d2('0x13'))(_0x08d2('0x14'));var utils=require(_0x08d2('0x15'));var config=require(_0x08d2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc3ffa5,_0x2bc2f8){_0x2bc2f8=_0x2bc2f8||0xcc;return function(_0x1880e4){if(_0x1880e4){return _0xc3ffa5[_0x08d2('0x17')](_0x2bc2f8);}return _0xc3ffa5[_0x08d2('0x18')](_0x2bc2f8)[_0x08d2('0x19')]();};}function respondWithResult(_0x4c3e0a,_0x867726){_0x867726=_0x867726||0xc8;return function(_0x31f4fd){if(_0x31f4fd){return _0x4c3e0a[_0x08d2('0x18')](_0x867726)[_0x08d2('0x1a')](_0x31f4fd);}};}function respondWithFilteredResult(_0x46f646,_0x2682b4){return function(_0x414577){if(_0x414577){var _0x402451=typeof _0x2682b4['offset']===_0x08d2('0x1b')&&typeof _0x2682b4[_0x08d2('0x1c')]===_0x08d2('0x1b');var _0x2a8aa6=_0x414577['count'];var _0x348ce3=_0x402451?0x0:_0x2682b4[_0x08d2('0x1d')];var _0x1b709e=_0x402451?_0x414577[_0x08d2('0x1e')]:_0x2682b4[_0x08d2('0x1d')]+_0x2682b4[_0x08d2('0x1c')];var _0x2b28b5;if(_0x1b709e>=_0x2a8aa6){_0x1b709e=_0x2a8aa6;_0x2b28b5=0xc8;}else{_0x2b28b5=0xce;}_0x46f646[_0x08d2('0x18')](_0x2b28b5);return _0x46f646['set'](_0x08d2('0x1f'),_0x348ce3+'-'+_0x1b709e+'/'+_0x2a8aa6)['json'](_0x414577);}return null;};}function patchUpdates(_0x4e1ad2){return function(_0x582c3e){try{jsonpatch['apply'](_0x582c3e,_0x4e1ad2,!![]);}catch(_0x38e813){return BPromise[_0x08d2('0x20')](_0x38e813);}return _0x582c3e[_0x08d2('0x21')]();};}function saveUpdates(_0x4707e1,_0x180c81){return function(_0x13b500){if(_0x13b500){return _0x13b500['update'](_0x4707e1)[_0x08d2('0x22')](function(_0x5622de){return _0x5622de;});}return null;};}function removeEntity(_0x3cfcaa,_0x4535b0){return function(_0x5a353b){if(_0x5a353b){return _0x5a353b[_0x08d2('0x23')]()[_0x08d2('0x22')](function(){var _0x426ac8=_0x5a353b[_0x08d2('0x24')]({'plain':!![]});var _0x51c494=_0x08d2('0x25');return db[_0x08d2('0x26')]['destroy']({'where':{'type':_0x51c494,'resourceId':_0x426ac8['id']}})[_0x08d2('0x22')](function(){return _0x5a353b;});})[_0x08d2('0x22')](function(){_0x3cfcaa[_0x08d2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a583,_0x45f1b2){return function(_0x53162d){if(!_0x53162d){_0x14a583[_0x08d2('0x17')](0x194);}return _0x53162d;};}function handleError(_0x1d65f7,_0x4886f7){_0x4886f7=_0x4886f7||0x1f4;return function(_0x4a9f1a){logger['error'](_0x4a9f1a[_0x08d2('0x27')]);if(_0x4a9f1a[_0x08d2('0x28')]){delete _0x4a9f1a[_0x08d2('0x28')];}_0x1d65f7[_0x08d2('0x18')](_0x4886f7)[_0x08d2('0x29')](_0x4a9f1a);};}exports[_0x08d2('0x2a')]=function(_0x4907ec,_0x207573){var _0x1af464={},_0x694fc6={},_0x1bb209={'count':0x0,'rows':[]};var _0x3d7fbf=_[_0x08d2('0x2b')](db[_0x08d2('0x2c')][_0x08d2('0x2d')],function(_0x567a6c){return{'name':_0x567a6c[_0x08d2('0x2e')],'type':_0x567a6c[_0x08d2('0x2f')]['key']};});_0x694fc6['model']=_[_0x08d2('0x2b')](_0x3d7fbf,_0x08d2('0x28'));_0x694fc6['query']=_[_0x08d2('0x30')](_0x4907ec[_0x08d2('0x31')]);_0x694fc6[_0x08d2('0x32')]=_['intersection'](_0x694fc6[_0x08d2('0x33')],_0x694fc6[_0x08d2('0x31')]);_0x1af464[_0x08d2('0x34')]=_[_0x08d2('0x35')](_0x694fc6[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x4907ec[_0x08d2('0x31')][_0x08d2('0x36')]));_0x1af464[_0x08d2('0x34')]=_0x1af464['attributes'][_0x08d2('0x37')]?_0x1af464[_0x08d2('0x34')]:_0x694fc6['model'];if(!_0x4907ec[_0x08d2('0x31')]['hasOwnProperty'](_0x08d2('0x38'))){_0x1af464[_0x08d2('0x1c')]=qs[_0x08d2('0x1c')](_0x4907ec['query'][_0x08d2('0x1c')]);_0x1af464[_0x08d2('0x1d')]=qs[_0x08d2('0x1d')](_0x4907ec['query'][_0x08d2('0x1d')]);}_0x1af464['order']=qs[_0x08d2('0x39')](_0x4907ec[_0x08d2('0x31')][_0x08d2('0x39')]);_0x1af464[_0x08d2('0x3a')]=qs[_0x08d2('0x32')](_[_0x08d2('0x3b')](_0x4907ec[_0x08d2('0x31')],_0x694fc6[_0x08d2('0x32')]),_0x3d7fbf);if(_0x4907ec[_0x08d2('0x31')][_0x08d2('0x3c')]){_0x1af464[_0x08d2('0x3a')]=_['merge'](_0x1af464[_0x08d2('0x3a')],{'$or':_[_0x08d2('0x2b')](_0x3d7fbf,function(_0x36f0c9){if(_0x36f0c9[_0x08d2('0x2f')]!==_0x08d2('0x3d')){var _0x5f3e74={};_0x5f3e74[_0x36f0c9[_0x08d2('0x28')]]={'$like':'%'+_0x4907ec[_0x08d2('0x31')]['filter']+'%'};return _0x5f3e74;}})});}_0x1af464=_['merge']({},_0x1af464,_0x4907ec[_0x08d2('0x3e')]);var _0x263862={'where':_0x1af464['where']};return db[_0x08d2('0x2c')]['count'](_0x263862)[_0x08d2('0x22')](function(_0x48771f){_0x1bb209[_0x08d2('0x1e')]=_0x48771f;if(_0x4907ec[_0x08d2('0x31')]['includeAll']){_0x1af464[_0x08d2('0x3f')]=[{'all':!![]}];}return db[_0x08d2('0x2c')]['findAll'](_0x1af464);})['then'](function(_0x18a910){_0x1bb209['rows']=_0x18a910;return _0x1bb209;})[_0x08d2('0x22')](respondWithFilteredResult(_0x207573,_0x1af464))[_0x08d2('0x40')](handleError(_0x207573,null));};exports[_0x08d2('0x41')]=function(_0x3984ae,_0x16770e){var _0x3ecef3={'raw':![],'where':{'id':_0x3984ae[_0x08d2('0x42')]['id']}},_0x32547b={};_0x32547b['model']=_[_0x08d2('0x30')](db[_0x08d2('0x2c')]['rawAttributes']);_0x32547b[_0x08d2('0x31')]=_[_0x08d2('0x30')](_0x3984ae['query']);_0x32547b[_0x08d2('0x32')]=_['intersection'](_0x32547b['model'],_0x32547b[_0x08d2('0x31')]);_0x3ecef3[_0x08d2('0x34')]=_[_0x08d2('0x35')](_0x32547b[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x3984ae[_0x08d2('0x31')][_0x08d2('0x36')]));_0x3ecef3[_0x08d2('0x34')]=_0x3ecef3[_0x08d2('0x34')][_0x08d2('0x37')]?_0x3ecef3[_0x08d2('0x34')]:_0x32547b[_0x08d2('0x33')];if(_0x3984ae[_0x08d2('0x31')][_0x08d2('0x43')]){_0x3ecef3['include']=[{'all':!![]}];}_0x3ecef3=_['merge']({},_0x3ecef3,_0x3984ae['options']);return db[_0x08d2('0x2c')]['find'](_0x3ecef3)[_0x08d2('0x22')](handleEntityNotFound(_0x16770e,null))[_0x08d2('0x22')](respondWithResult(_0x16770e,null))[_0x08d2('0x40')](handleError(_0x16770e,null));};exports[_0x08d2('0x44')]=function(_0x419c44,_0x2dd783){return db['Trigger'][_0x08d2('0x44')](_0x419c44[_0x08d2('0x45')],{})[_0x08d2('0x22')](function(_0x39e305){var _0x5d81ed=_0x419c44['user'][_0x08d2('0x24')]({'plain':!![]});if(!_0x5d81ed)throw new Error(_0x08d2('0x46'));if(_0x5d81ed[_0x08d2('0x47')]===_0x08d2('0x48')){var _0x22da5c=_0x39e305['get']({'plain':!![]});var _0x3fb0c4=_0x08d2('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3fb0c4,'userProfileId':_0x5d81ed[_0x08d2('0x49')]},'raw':!![]})[_0x08d2('0x22')](function(_0x2de158){if(_0x2de158&&_0x2de158[_0x08d2('0x4a')]===0x0){return db[_0x08d2('0x26')]['create']({'name':_0x22da5c[_0x08d2('0x28')],'resourceId':_0x22da5c['id'],'type':_0x2de158[_0x08d2('0x28')],'sectionId':_0x2de158['id']},{})[_0x08d2('0x22')](function(){return _0x39e305;});}else{return _0x39e305;}})[_0x08d2('0x40')](function(_0x385e9c){logger[_0x08d2('0x4b')](_0x08d2('0x4c'),_0x385e9c);throw _0x385e9c;});}return _0x39e305;})['then'](respondWithResult(_0x2dd783,0xc9))[_0x08d2('0x40')](handleError(_0x2dd783,null));};exports[_0x08d2('0x4d')]=function(_0x51d5e5,_0xd51932){if(_0x51d5e5['body']['id']){delete _0x51d5e5[_0x08d2('0x45')]['id'];}return db['Trigger'][_0x08d2('0x4e')]({'where':{'id':_0x51d5e5['params']['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0xd51932,null))[_0x08d2('0x22')](saveUpdates(_0x51d5e5[_0x08d2('0x45')],null))[_0x08d2('0x22')](respondWithResult(_0xd51932,null))[_0x08d2('0x40')](handleError(_0xd51932,null));};exports[_0x08d2('0x23')]=function(_0x4b0f1c,_0x42b7ba){return db[_0x08d2('0x2c')]['find']({'where':{'id':_0x4b0f1c[_0x08d2('0x42')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x42b7ba,null))[_0x08d2('0x22')](removeEntity(_0x42b7ba,null))[_0x08d2('0x40')](handleError(_0x42b7ba,null));};exports[_0x08d2('0x4f')]=function(_0x571673,_0x119cdb,_0x90ddd5){if(_0x571673[_0x08d2('0x45')]['id']){delete _0x571673[_0x08d2('0x45')]['id'];}return db[_0x08d2('0x2c')]['find']({'where':{'id':_0x571673[_0x08d2('0x42')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x119cdb,null))['then'](function(_0x40e1c1){if(_0x40e1c1){_0x571673[_0x08d2('0x45')][_0x08d2('0x50')]=_0x40e1c1['id'];return db[_0x08d2('0x51')][_0x08d2('0x44')](_0x571673[_0x08d2('0x45')]);}})[_0x08d2('0x22')](respondWithResult(_0x119cdb,null))[_0x08d2('0x40')](handleError(_0x119cdb,null));};exports[_0x08d2('0x52')]=function(_0x612003,_0x16c7ee,_0x51c74a){if(_0x612003[_0x08d2('0x45')]['id']){delete _0x612003[_0x08d2('0x45')]['id'];}return db[_0x08d2('0x2c')][_0x08d2('0x4e')]({'where':{'id':_0x612003[_0x08d2('0x42')]['id']}})['then'](handleEntityNotFound(_0x16c7ee,null))[_0x08d2('0x22')](function(_0x1e84d4){if(_0x1e84d4){_0x612003[_0x08d2('0x45')][_0x08d2('0x53')]=_0x1e84d4['id'];return db[_0x08d2('0x51')][_0x08d2('0x44')](_0x612003[_0x08d2('0x45')]);}})[_0x08d2('0x22')](respondWithResult(_0x16c7ee,null))[_0x08d2('0x40')](handleError(_0x16c7ee,null));};exports[_0x08d2('0x54')]=function(_0x567d77,_0x33f617,_0x226aa1){var _0x10ee97={};var _0x3dc173={};var _0xd18268;var _0x21b66b;return db['Trigger'][_0x08d2('0x55')]({'where':{'id':_0x567d77[_0x08d2('0x42')]['id']}})['then'](handleEntityNotFound(_0x33f617,null))[_0x08d2('0x22')](function(_0x5f3c0a){if(_0x5f3c0a){_0xd18268=_0x5f3c0a;_0x3dc173['model']=_[_0x08d2('0x30')](db[_0x08d2('0x51')][_0x08d2('0x2d')]);_0x3dc173[_0x08d2('0x31')]=_[_0x08d2('0x30')](_0x567d77[_0x08d2('0x31')]);_0x3dc173[_0x08d2('0x32')]=_[_0x08d2('0x35')](_0x3dc173[_0x08d2('0x33')],_0x3dc173[_0x08d2('0x31')]);_0x10ee97[_0x08d2('0x34')]=_['intersection'](_0x3dc173[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x567d77[_0x08d2('0x31')][_0x08d2('0x36')]));_0x10ee97[_0x08d2('0x34')]=_0x10ee97[_0x08d2('0x34')][_0x08d2('0x37')]?_0x10ee97['attributes']:_0x3dc173[_0x08d2('0x33')];_0x10ee97[_0x08d2('0x56')]=qs['sort'](_0x567d77[_0x08d2('0x31')][_0x08d2('0x39')]);_0x10ee97[_0x08d2('0x3a')]=qs[_0x08d2('0x32')](_[_0x08d2('0x3b')](_0x567d77[_0x08d2('0x31')],_0x3dc173['filters']));if(_0x567d77[_0x08d2('0x31')][_0x08d2('0x3c')]){_0x10ee97[_0x08d2('0x3a')]=_[_0x08d2('0x57')](_0x10ee97[_0x08d2('0x3a')],{'$or':_[_0x08d2('0x2b')](_0x10ee97[_0x08d2('0x34')],function(_0x24b08c){var _0x28210c={};_0x28210c[_0x24b08c]={'$like':'%'+_0x567d77[_0x08d2('0x31')][_0x08d2('0x3c')]+'%'};return _0x28210c;})});}_0x10ee97=_[_0x08d2('0x57')]({},_0x10ee97,_0x567d77[_0x08d2('0x3e')]);return _0xd18268['getAllConditions'](_0x10ee97);}})[_0x08d2('0x22')](function(_0x1a7540){if(_0x1a7540){_0x21b66b=_0x1a7540['length'];if(!_0x567d77[_0x08d2('0x31')][_0x08d2('0x58')](_0x08d2('0x38'))){_0x10ee97[_0x08d2('0x1c')]=qs[_0x08d2('0x1c')](_0x567d77[_0x08d2('0x31')][_0x08d2('0x1c')]);_0x10ee97['offset']=qs[_0x08d2('0x1d')](_0x567d77[_0x08d2('0x31')][_0x08d2('0x1d')]);}return _0xd18268[_0x08d2('0x54')](_0x10ee97);}})[_0x08d2('0x22')](function(_0x25ae67){if(_0x25ae67){return _0x25ae67?{'count':_0x21b66b,'rows':_0x25ae67}:null;}})[_0x08d2('0x22')](respondWithResult(_0x33f617,null))['catch'](handleError(_0x33f617,null));};exports[_0x08d2('0x59')]=function(_0x47ca42,_0x139a6b,_0x5d7b31){var _0x3d31b1={};var _0x39d3c3={};var _0x2c78ba;var _0x3f4d76;return db[_0x08d2('0x2c')]['findOne']({'where':{'id':_0x47ca42[_0x08d2('0x42')]['id']}})['then'](handleEntityNotFound(_0x139a6b,null))[_0x08d2('0x22')](function(_0x2d0588){if(_0x2d0588){_0x2c78ba=_0x2d0588;_0x39d3c3[_0x08d2('0x33')]=_[_0x08d2('0x30')](db[_0x08d2('0x51')]['rawAttributes']);_0x39d3c3[_0x08d2('0x31')]=_[_0x08d2('0x30')](_0x47ca42[_0x08d2('0x31')]);_0x39d3c3[_0x08d2('0x32')]=_[_0x08d2('0x35')](_0x39d3c3[_0x08d2('0x33')],_0x39d3c3[_0x08d2('0x31')]);_0x3d31b1[_0x08d2('0x34')]=_[_0x08d2('0x35')](_0x39d3c3[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x47ca42[_0x08d2('0x31')][_0x08d2('0x36')]));_0x3d31b1['attributes']=_0x3d31b1[_0x08d2('0x34')][_0x08d2('0x37')]?_0x3d31b1['attributes']:_0x39d3c3[_0x08d2('0x33')];_0x3d31b1['order']=qs[_0x08d2('0x39')](_0x47ca42[_0x08d2('0x31')][_0x08d2('0x39')]);_0x3d31b1[_0x08d2('0x3a')]=qs[_0x08d2('0x32')](_[_0x08d2('0x3b')](_0x47ca42[_0x08d2('0x31')],_0x39d3c3['filters']));if(_0x47ca42[_0x08d2('0x31')][_0x08d2('0x3c')]){_0x3d31b1[_0x08d2('0x3a')]=_[_0x08d2('0x57')](_0x3d31b1['where'],{'$or':_[_0x08d2('0x2b')](_0x3d31b1[_0x08d2('0x34')],function(_0x4874bf){var _0x2ebe49={};_0x2ebe49[_0x4874bf]={'$like':'%'+_0x47ca42[_0x08d2('0x31')][_0x08d2('0x3c')]+'%'};return _0x2ebe49;})});}_0x3d31b1=_[_0x08d2('0x57')]({},_0x3d31b1,_0x47ca42['options']);return _0x2c78ba['getAnyConditions'](_0x3d31b1);}})[_0x08d2('0x22')](function(_0x295545){if(_0x295545){_0x3f4d76=_0x295545[_0x08d2('0x37')];if(!_0x47ca42['query']['hasOwnProperty'](_0x08d2('0x38'))){_0x3d31b1['limit']=qs[_0x08d2('0x1c')](_0x47ca42[_0x08d2('0x31')]['limit']);_0x3d31b1[_0x08d2('0x1d')]=qs['offset'](_0x47ca42[_0x08d2('0x31')][_0x08d2('0x1d')]);}return _0x2c78ba[_0x08d2('0x59')](_0x3d31b1);}})['then'](function(_0x474f5d){if(_0x474f5d){return _0x474f5d?{'count':_0x3f4d76,'rows':_0x474f5d}:null;}})[_0x08d2('0x22')](respondWithResult(_0x139a6b,null))[_0x08d2('0x40')](handleError(_0x139a6b,null));};exports[_0x08d2('0x5a')]=function(_0x8281f0,_0x1be192,_0x417db5){if(_0x8281f0['body']['id']){delete _0x8281f0[_0x08d2('0x45')]['id'];}return db[_0x08d2('0x2c')][_0x08d2('0x4e')]({'where':{'id':_0x8281f0[_0x08d2('0x42')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x1be192,null))[_0x08d2('0x22')](function(_0x58fae8){if(_0x58fae8){_0x8281f0['body']['TriggerId']=_0x58fae8['id'];return db[_0x08d2('0x5b')][_0x08d2('0x44')](_0x8281f0['body']);}})[_0x08d2('0x22')](respondWithResult(_0x1be192,null))['catch'](handleError(_0x1be192,null));};exports['getActions']=function(_0x5959c4,_0x23d68a,_0x565892){var _0x391d3c={};var _0xaed431={};var _0x22c8f9;var _0x2d0c91;return db[_0x08d2('0x2c')][_0x08d2('0x55')]({'where':{'id':_0x5959c4[_0x08d2('0x42')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x23d68a,null))[_0x08d2('0x22')](function(_0x1025a8){if(_0x1025a8){_0x22c8f9=_0x1025a8;_0xaed431[_0x08d2('0x33')]=_[_0x08d2('0x30')](db[_0x08d2('0x5b')][_0x08d2('0x2d')]);_0xaed431['query']=_[_0x08d2('0x30')](_0x5959c4[_0x08d2('0x31')]);_0xaed431['filters']=_[_0x08d2('0x35')](_0xaed431[_0x08d2('0x33')],_0xaed431['query']);_0x391d3c[_0x08d2('0x34')]=_[_0x08d2('0x35')](_0xaed431[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x5959c4[_0x08d2('0x31')][_0x08d2('0x36')]));_0x391d3c[_0x08d2('0x34')]=_0x391d3c[_0x08d2('0x34')]['length']?_0x391d3c[_0x08d2('0x34')]:_0xaed431[_0x08d2('0x33')];_0x391d3c['order']=qs['sort'](_0x5959c4[_0x08d2('0x31')][_0x08d2('0x39')]);_0x391d3c[_0x08d2('0x3a')]=qs[_0x08d2('0x32')](_[_0x08d2('0x3b')](_0x5959c4[_0x08d2('0x31')],_0xaed431[_0x08d2('0x32')]));if(_0x5959c4['query'][_0x08d2('0x3c')]){_0x391d3c['where']=_[_0x08d2('0x57')](_0x391d3c[_0x08d2('0x3a')],{'$or':_[_0x08d2('0x2b')](_0x391d3c[_0x08d2('0x34')],function(_0x59da48){var _0x1bccfd={};_0x1bccfd[_0x59da48]={'$like':'%'+_0x5959c4[_0x08d2('0x31')]['filter']+'%'};return _0x1bccfd;})});}_0x391d3c=_[_0x08d2('0x57')]({},_0x391d3c,_0x5959c4['options']);return _0x22c8f9[_0x08d2('0x5c')](_0x391d3c);}})[_0x08d2('0x22')](function(_0x28a6ca){if(_0x28a6ca){_0x2d0c91=_0x28a6ca[_0x08d2('0x37')];if(!_0x5959c4[_0x08d2('0x31')][_0x08d2('0x58')]('nolimit')){_0x391d3c[_0x08d2('0x1c')]=qs[_0x08d2('0x1c')](_0x5959c4[_0x08d2('0x31')][_0x08d2('0x1c')]);_0x391d3c[_0x08d2('0x1d')]=qs[_0x08d2('0x1d')](_0x5959c4[_0x08d2('0x31')][_0x08d2('0x1d')]);}return _0x22c8f9['getActions'](_0x391d3c);}})[_0x08d2('0x22')](function(_0x54fc90){if(_0x54fc90){return _0x54fc90?{'count':_0x2d0c91,'rows':_0x54fc90}:null;}})[_0x08d2('0x22')](respondWithResult(_0x23d68a,null))['catch'](handleError(_0x23d68a,null));}; \ No newline at end of file +var _0x2b23=['end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','Triggers','UserProfileResource','error','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','Trigger','includeAll','include','findAll','catch','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status'];(function(_0x526ae9,_0x30dd3f){var _0x4114fb=function(_0x34a0d6){while(--_0x34a0d6){_0x526ae9['push'](_0x526ae9['shift']());}};_0x4114fb(++_0x30dd3f);}(_0x2b23,0x1af));var _0x32b2=function(_0x143285,_0x13b361){_0x143285=_0x143285-0x0;var _0x4ddf8a=_0x2b23[_0x143285];return _0x4ddf8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32b2('0x0'));var zipdir=require(_0x32b2('0x1'));var jsonpatch=require(_0x32b2('0x2'));var rp=require(_0x32b2('0x3'));var moment=require('moment');var BPromise=require(_0x32b2('0x4'));var Mustache=require(_0x32b2('0x5'));var util=require('util');var path=require(_0x32b2('0x6'));var sox=require(_0x32b2('0x7'));var csv=require('to-csv');var ejs=require(_0x32b2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32b2('0x9'));var squel=require(_0x32b2('0xa'));var crypto=require(_0x32b2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x32b2('0xc'));var toCsv=require(_0x32b2('0xd'));var querystring=require(_0x32b2('0xe'));var Papa=require('papaparse');var Redis=require(_0x32b2('0xf'));var authService=require(_0x32b2('0x10'));var qs=require(_0x32b2('0x11'));var as=require(_0x32b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x32b2('0x13'))(_0x32b2('0x14'));var utils=require(_0x32b2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x479faf,_0x43cd55){_0x43cd55=_0x43cd55||0xcc;return function(_0x5d3150){if(_0x5d3150){return _0x479faf[_0x32b2('0x16')](_0x43cd55);}return _0x479faf[_0x32b2('0x17')](_0x43cd55)[_0x32b2('0x18')]();};}function respondWithResult(_0x587fac,_0x7ead99){_0x7ead99=_0x7ead99||0xc8;return function(_0x2df0d8){if(_0x2df0d8){return _0x587fac[_0x32b2('0x17')](_0x7ead99)[_0x32b2('0x19')](_0x2df0d8);}};}function respondWithFilteredResult(_0x3c9679,_0x4d5a8a){return function(_0x58dd52){if(_0x58dd52){var _0x9bf51a=typeof _0x4d5a8a[_0x32b2('0x1a')]===_0x32b2('0x1b')&&typeof _0x4d5a8a['limit']===_0x32b2('0x1b');var _0x2bfff8=_0x58dd52[_0x32b2('0x1c')];var _0x58d2e2=_0x9bf51a?0x0:_0x4d5a8a[_0x32b2('0x1a')];var _0x1b66b2=_0x9bf51a?_0x58dd52[_0x32b2('0x1c')]:_0x4d5a8a['offset']+_0x4d5a8a[_0x32b2('0x1d')];var _0x376fa9;if(_0x1b66b2>=_0x2bfff8){_0x1b66b2=_0x2bfff8;_0x376fa9=0xc8;}else{_0x376fa9=0xce;}_0x3c9679[_0x32b2('0x17')](_0x376fa9);return _0x3c9679[_0x32b2('0x1e')](_0x32b2('0x1f'),_0x58d2e2+'-'+_0x1b66b2+'/'+_0x2bfff8)[_0x32b2('0x19')](_0x58dd52);}return null;};}function patchUpdates(_0x3c9bd5){return function(_0x173b92){try{jsonpatch['apply'](_0x173b92,_0x3c9bd5,!![]);}catch(_0x3a6da1){return BPromise[_0x32b2('0x20')](_0x3a6da1);}return _0x173b92[_0x32b2('0x21')]();};}function saveUpdates(_0x59e80a,_0x22ef64){return function(_0x29e4ad){if(_0x29e4ad){return _0x29e4ad['update'](_0x59e80a)[_0x32b2('0x22')](function(_0x2a8c63){return _0x2a8c63;});}return null;};}function removeEntity(_0x1aaaeb,_0x30af39){return function(_0xafc172){if(_0xafc172){return _0xafc172[_0x32b2('0x23')]()[_0x32b2('0x22')](function(){var _0x2d1da7=_0xafc172['get']({'plain':!![]});var _0x560cb2=_0x32b2('0x24');return db[_0x32b2('0x25')][_0x32b2('0x23')]({'where':{'type':_0x560cb2,'resourceId':_0x2d1da7['id']}})['then'](function(){return _0xafc172;});})[_0x32b2('0x22')](function(){_0x1aaaeb['status'](0xcc)[_0x32b2('0x18')]();});}};}function handleEntityNotFound(_0x5333d5,_0x56e9ef){return function(_0x50a863){if(!_0x50a863){_0x5333d5[_0x32b2('0x16')](0x194);}return _0x50a863;};}function handleError(_0x23a499,_0x291008){_0x291008=_0x291008||0x1f4;return function(_0x37c7b2){logger[_0x32b2('0x26')](_0x37c7b2['stack']);if(_0x37c7b2[_0x32b2('0x27')]){delete _0x37c7b2[_0x32b2('0x27')];}_0x23a499[_0x32b2('0x17')](_0x291008)['send'](_0x37c7b2);};}exports[_0x32b2('0x28')]=function(_0x1dbd18,_0x3cecb1){var _0x5aaa6f={},_0x125520={},_0x46d6b6={'count':0x0,'rows':[]};var _0xd125ab=_[_0x32b2('0x29')](db['Trigger'][_0x32b2('0x2a')],function(_0x408a45){return{'name':_0x408a45['fieldName'],'type':_0x408a45[_0x32b2('0x2b')]['key']};});_0x125520[_0x32b2('0x2c')]=_[_0x32b2('0x29')](_0xd125ab,'name');_0x125520[_0x32b2('0x2d')]=_[_0x32b2('0x2e')](_0x1dbd18['query']);_0x125520[_0x32b2('0x2f')]=_[_0x32b2('0x30')](_0x125520['model'],_0x125520[_0x32b2('0x2d')]);_0x5aaa6f['attributes']=_[_0x32b2('0x30')](_0x125520[_0x32b2('0x2c')],qs['fields'](_0x1dbd18['query'][_0x32b2('0x31')]));_0x5aaa6f[_0x32b2('0x32')]=_0x5aaa6f[_0x32b2('0x32')][_0x32b2('0x33')]?_0x5aaa6f[_0x32b2('0x32')]:_0x125520[_0x32b2('0x2c')];if(!_0x1dbd18[_0x32b2('0x2d')][_0x32b2('0x34')](_0x32b2('0x35'))){_0x5aaa6f['limit']=qs['limit'](_0x1dbd18[_0x32b2('0x2d')][_0x32b2('0x1d')]);_0x5aaa6f['offset']=qs['offset'](_0x1dbd18[_0x32b2('0x2d')]['offset']);}_0x5aaa6f[_0x32b2('0x36')]=qs[_0x32b2('0x37')](_0x1dbd18[_0x32b2('0x2d')]['sort']);_0x5aaa6f[_0x32b2('0x38')]=qs['filters'](_['pick'](_0x1dbd18[_0x32b2('0x2d')],_0x125520['filters']),_0xd125ab);if(_0x1dbd18[_0x32b2('0x2d')][_0x32b2('0x39')]){_0x5aaa6f[_0x32b2('0x38')]=_['merge'](_0x5aaa6f['where'],{'$or':_[_0x32b2('0x29')](_0xd125ab,function(_0x200ccd){if(_0x200ccd[_0x32b2('0x2b')]!==_0x32b2('0x3a')){var _0x52b38d={};_0x52b38d[_0x200ccd[_0x32b2('0x27')]]={'$like':'%'+_0x1dbd18[_0x32b2('0x2d')][_0x32b2('0x39')]+'%'};return _0x52b38d;}})});}_0x5aaa6f=_[_0x32b2('0x3b')]({},_0x5aaa6f,_0x1dbd18[_0x32b2('0x3c')]);var _0x5ee491={'where':_0x5aaa6f[_0x32b2('0x38')]};return db[_0x32b2('0x3d')]['count'](_0x5ee491)[_0x32b2('0x22')](function(_0x1cb229){_0x46d6b6[_0x32b2('0x1c')]=_0x1cb229;if(_0x1dbd18[_0x32b2('0x2d')][_0x32b2('0x3e')]){_0x5aaa6f[_0x32b2('0x3f')]=[{'all':!![]}];}return db[_0x32b2('0x3d')][_0x32b2('0x40')](_0x5aaa6f);})['then'](function(_0x4cd997){_0x46d6b6['rows']=_0x4cd997;return _0x46d6b6;})[_0x32b2('0x22')](respondWithFilteredResult(_0x3cecb1,_0x5aaa6f))[_0x32b2('0x41')](handleError(_0x3cecb1,null));};exports['show']=function(_0x311e60,_0x515f7f){var _0x471a4c={'raw':![],'where':{'id':_0x311e60[_0x32b2('0x42')]['id']}},_0x1c27f2={};_0x1c27f2[_0x32b2('0x2c')]=_['keys'](db[_0x32b2('0x3d')][_0x32b2('0x2a')]);_0x1c27f2[_0x32b2('0x2d')]=_['keys'](_0x311e60[_0x32b2('0x2d')]);_0x1c27f2[_0x32b2('0x2f')]=_['intersection'](_0x1c27f2[_0x32b2('0x2c')],_0x1c27f2[_0x32b2('0x2d')]);_0x471a4c['attributes']=_['intersection'](_0x1c27f2[_0x32b2('0x2c')],qs[_0x32b2('0x31')](_0x311e60[_0x32b2('0x2d')][_0x32b2('0x31')]));_0x471a4c[_0x32b2('0x32')]=_0x471a4c[_0x32b2('0x32')][_0x32b2('0x33')]?_0x471a4c['attributes']:_0x1c27f2[_0x32b2('0x2c')];if(_0x311e60[_0x32b2('0x2d')]['includeAll']){_0x471a4c[_0x32b2('0x3f')]=[{'all':!![]}];}_0x471a4c=_[_0x32b2('0x3b')]({},_0x471a4c,_0x311e60['options']);return db[_0x32b2('0x3d')][_0x32b2('0x43')](_0x471a4c)[_0x32b2('0x22')](handleEntityNotFound(_0x515f7f,null))[_0x32b2('0x22')](respondWithResult(_0x515f7f,null))[_0x32b2('0x41')](handleError(_0x515f7f,null));};exports['create']=function(_0x371411,_0x1b0f02){return db[_0x32b2('0x3d')][_0x32b2('0x44')](_0x371411['body'],{})[_0x32b2('0x22')](function(_0x5ef619){var _0x514395=_0x371411[_0x32b2('0x45')][_0x32b2('0x46')]({'plain':!![]});if(!_0x514395)throw new Error(_0x32b2('0x47'));if(_0x514395['role']===_0x32b2('0x45')){var _0x1d9e3d=_0x5ef619[_0x32b2('0x46')]({'plain':!![]});var _0x46115c=_0x32b2('0x24');return db[_0x32b2('0x48')][_0x32b2('0x43')]({'where':{'name':_0x46115c,'userProfileId':_0x514395[_0x32b2('0x49')]},'raw':!![]})[_0x32b2('0x22')](function(_0x312b3b){if(_0x312b3b&&_0x312b3b[_0x32b2('0x4a')]===0x0){return db['UserProfileResource'][_0x32b2('0x44')]({'name':_0x1d9e3d[_0x32b2('0x27')],'resourceId':_0x1d9e3d['id'],'type':_0x312b3b['name'],'sectionId':_0x312b3b['id']},{})[_0x32b2('0x22')](function(){return _0x5ef619;});}else{return _0x5ef619;}})[_0x32b2('0x41')](function(_0x548f8e){logger[_0x32b2('0x26')](_0x32b2('0x4b'),_0x548f8e);throw _0x548f8e;});}return _0x5ef619;})[_0x32b2('0x22')](respondWithResult(_0x1b0f02,0xc9))[_0x32b2('0x41')](handleError(_0x1b0f02,null));};exports[_0x32b2('0x4c')]=function(_0x4b387e,_0x3c3124){if(_0x4b387e[_0x32b2('0x4d')]['id']){delete _0x4b387e[_0x32b2('0x4d')]['id'];}return db[_0x32b2('0x3d')]['find']({'where':{'id':_0x4b387e[_0x32b2('0x42')]['id']}})[_0x32b2('0x22')](handleEntityNotFound(_0x3c3124,null))[_0x32b2('0x22')](saveUpdates(_0x4b387e[_0x32b2('0x4d')],null))['then'](respondWithResult(_0x3c3124,null))[_0x32b2('0x41')](handleError(_0x3c3124,null));};exports[_0x32b2('0x23')]=function(_0x26a226,_0x1ef4db){return db[_0x32b2('0x3d')]['find']({'where':{'id':_0x26a226[_0x32b2('0x42')]['id']}})[_0x32b2('0x22')](handleEntityNotFound(_0x1ef4db,null))[_0x32b2('0x22')](removeEntity(_0x1ef4db,null))['catch'](handleError(_0x1ef4db,null));};exports[_0x32b2('0x4e')]=function(_0x5fdfc5,_0x436682,_0x42937d){if(_0x5fdfc5[_0x32b2('0x4d')]['id']){delete _0x5fdfc5['body']['id'];}return db['Trigger'][_0x32b2('0x43')]({'where':{'id':_0x5fdfc5[_0x32b2('0x42')]['id']}})[_0x32b2('0x22')](handleEntityNotFound(_0x436682,null))[_0x32b2('0x22')](function(_0x4ba6fc){if(_0x4ba6fc){_0x5fdfc5['body'][_0x32b2('0x4f')]=_0x4ba6fc['id'];return db[_0x32b2('0x50')][_0x32b2('0x44')](_0x5fdfc5[_0x32b2('0x4d')]);}})[_0x32b2('0x22')](respondWithResult(_0x436682,null))[_0x32b2('0x41')](handleError(_0x436682,null));};exports[_0x32b2('0x51')]=function(_0x495e8f,_0x230bd9,_0x31eaa3){if(_0x495e8f[_0x32b2('0x4d')]['id']){delete _0x495e8f[_0x32b2('0x4d')]['id'];}return db[_0x32b2('0x3d')][_0x32b2('0x43')]({'where':{'id':_0x495e8f[_0x32b2('0x42')]['id']}})[_0x32b2('0x22')](handleEntityNotFound(_0x230bd9,null))[_0x32b2('0x22')](function(_0xb8a829){if(_0xb8a829){_0x495e8f['body'][_0x32b2('0x52')]=_0xb8a829['id'];return db[_0x32b2('0x50')][_0x32b2('0x44')](_0x495e8f['body']);}})['then'](respondWithResult(_0x230bd9,null))[_0x32b2('0x41')](handleError(_0x230bd9,null));};exports[_0x32b2('0x53')]=function(_0x36e13e,_0x34f693,_0x11c1d1){var _0x1b6af6={};var _0x28afa8={};var _0x1a6f9d;var _0x5f460a;return db[_0x32b2('0x3d')][_0x32b2('0x54')]({'where':{'id':_0x36e13e['params']['id']}})['then'](handleEntityNotFound(_0x34f693,null))['then'](function(_0x2f2eac){if(_0x2f2eac){_0x1a6f9d=_0x2f2eac;_0x28afa8['model']=_[_0x32b2('0x2e')](db[_0x32b2('0x50')][_0x32b2('0x2a')]);_0x28afa8['query']=_[_0x32b2('0x2e')](_0x36e13e['query']);_0x28afa8['filters']=_[_0x32b2('0x30')](_0x28afa8['model'],_0x28afa8['query']);_0x1b6af6[_0x32b2('0x32')]=_[_0x32b2('0x30')](_0x28afa8[_0x32b2('0x2c')],qs[_0x32b2('0x31')](_0x36e13e[_0x32b2('0x2d')][_0x32b2('0x31')]));_0x1b6af6[_0x32b2('0x32')]=_0x1b6af6[_0x32b2('0x32')]['length']?_0x1b6af6[_0x32b2('0x32')]:_0x28afa8[_0x32b2('0x2c')];_0x1b6af6[_0x32b2('0x36')]=qs[_0x32b2('0x37')](_0x36e13e[_0x32b2('0x2d')][_0x32b2('0x37')]);_0x1b6af6[_0x32b2('0x38')]=qs[_0x32b2('0x2f')](_[_0x32b2('0x55')](_0x36e13e[_0x32b2('0x2d')],_0x28afa8[_0x32b2('0x2f')]));if(_0x36e13e['query']['filter']){_0x1b6af6[_0x32b2('0x38')]=_['merge'](_0x1b6af6[_0x32b2('0x38')],{'$or':_[_0x32b2('0x29')](_0x1b6af6[_0x32b2('0x32')],function(_0x489b64){var _0x5acf82={};_0x5acf82[_0x489b64]={'$like':'%'+_0x36e13e[_0x32b2('0x2d')][_0x32b2('0x39')]+'%'};return _0x5acf82;})});}_0x1b6af6=_[_0x32b2('0x3b')]({},_0x1b6af6,_0x36e13e[_0x32b2('0x3c')]);return _0x1a6f9d[_0x32b2('0x53')](_0x1b6af6);}})[_0x32b2('0x22')](function(_0x5dbca9){if(_0x5dbca9){_0x5f460a=_0x5dbca9[_0x32b2('0x33')];if(!_0x36e13e['query'][_0x32b2('0x34')](_0x32b2('0x35'))){_0x1b6af6['limit']=qs[_0x32b2('0x1d')](_0x36e13e[_0x32b2('0x2d')]['limit']);_0x1b6af6[_0x32b2('0x1a')]=qs['offset'](_0x36e13e[_0x32b2('0x2d')][_0x32b2('0x1a')]);}return _0x1a6f9d[_0x32b2('0x53')](_0x1b6af6);}})[_0x32b2('0x22')](function(_0x2a3491){if(_0x2a3491){return _0x2a3491?{'count':_0x5f460a,'rows':_0x2a3491}:null;}})[_0x32b2('0x22')](respondWithResult(_0x34f693,null))[_0x32b2('0x41')](handleError(_0x34f693,null));};exports['getAnyConditions']=function(_0x5ceda5,_0xd59041,_0x3d60c0){var _0x2480ec={};var _0x55e6e3={};var _0x125bf8;var _0x19c924;return db[_0x32b2('0x3d')][_0x32b2('0x54')]({'where':{'id':_0x5ceda5[_0x32b2('0x42')]['id']}})[_0x32b2('0x22')](handleEntityNotFound(_0xd59041,null))[_0x32b2('0x22')](function(_0x367ba7){if(_0x367ba7){_0x125bf8=_0x367ba7;_0x55e6e3[_0x32b2('0x2c')]=_[_0x32b2('0x2e')](db[_0x32b2('0x50')]['rawAttributes']);_0x55e6e3['query']=_[_0x32b2('0x2e')](_0x5ceda5[_0x32b2('0x2d')]);_0x55e6e3[_0x32b2('0x2f')]=_[_0x32b2('0x30')](_0x55e6e3[_0x32b2('0x2c')],_0x55e6e3[_0x32b2('0x2d')]);_0x2480ec[_0x32b2('0x32')]=_['intersection'](_0x55e6e3[_0x32b2('0x2c')],qs[_0x32b2('0x31')](_0x5ceda5[_0x32b2('0x2d')][_0x32b2('0x31')]));_0x2480ec[_0x32b2('0x32')]=_0x2480ec[_0x32b2('0x32')][_0x32b2('0x33')]?_0x2480ec[_0x32b2('0x32')]:_0x55e6e3[_0x32b2('0x2c')];_0x2480ec[_0x32b2('0x36')]=qs[_0x32b2('0x37')](_0x5ceda5[_0x32b2('0x2d')]['sort']);_0x2480ec[_0x32b2('0x38')]=qs[_0x32b2('0x2f')](_[_0x32b2('0x55')](_0x5ceda5[_0x32b2('0x2d')],_0x55e6e3[_0x32b2('0x2f')]));if(_0x5ceda5[_0x32b2('0x2d')][_0x32b2('0x39')]){_0x2480ec[_0x32b2('0x38')]=_[_0x32b2('0x3b')](_0x2480ec['where'],{'$or':_[_0x32b2('0x29')](_0x2480ec[_0x32b2('0x32')],function(_0x4793a6){var _0xff0e12={};_0xff0e12[_0x4793a6]={'$like':'%'+_0x5ceda5[_0x32b2('0x2d')][_0x32b2('0x39')]+'%'};return _0xff0e12;})});}_0x2480ec=_['merge']({},_0x2480ec,_0x5ceda5[_0x32b2('0x3c')]);return _0x125bf8[_0x32b2('0x56')](_0x2480ec);}})['then'](function(_0x18f068){if(_0x18f068){_0x19c924=_0x18f068[_0x32b2('0x33')];if(!_0x5ceda5['query'][_0x32b2('0x34')](_0x32b2('0x35'))){_0x2480ec['limit']=qs[_0x32b2('0x1d')](_0x5ceda5['query'][_0x32b2('0x1d')]);_0x2480ec[_0x32b2('0x1a')]=qs['offset'](_0x5ceda5[_0x32b2('0x2d')][_0x32b2('0x1a')]);}return _0x125bf8[_0x32b2('0x56')](_0x2480ec);}})[_0x32b2('0x22')](function(_0x2372d5){if(_0x2372d5){return _0x2372d5?{'count':_0x19c924,'rows':_0x2372d5}:null;}})[_0x32b2('0x22')](respondWithResult(_0xd59041,null))[_0x32b2('0x41')](handleError(_0xd59041,null));};exports[_0x32b2('0x57')]=function(_0x48ce7c,_0x528719,_0x42e104){if(_0x48ce7c[_0x32b2('0x4d')]['id']){delete _0x48ce7c[_0x32b2('0x4d')]['id'];}return db[_0x32b2('0x3d')][_0x32b2('0x43')]({'where':{'id':_0x48ce7c[_0x32b2('0x42')]['id']}})[_0x32b2('0x22')](handleEntityNotFound(_0x528719,null))['then'](function(_0x79ead0){if(_0x79ead0){_0x48ce7c[_0x32b2('0x4d')][_0x32b2('0x58')]=_0x79ead0['id'];return db[_0x32b2('0x59')][_0x32b2('0x44')](_0x48ce7c[_0x32b2('0x4d')]);}})[_0x32b2('0x22')](respondWithResult(_0x528719,null))[_0x32b2('0x41')](handleError(_0x528719,null));};exports[_0x32b2('0x5a')]=function(_0x2b57c3,_0x1145df,_0x244476){var _0x1e4687={};var _0xa2d6ab={};var _0x2d9b3a;var _0x427e77;return db[_0x32b2('0x3d')][_0x32b2('0x54')]({'where':{'id':_0x2b57c3['params']['id']}})[_0x32b2('0x22')](handleEntityNotFound(_0x1145df,null))[_0x32b2('0x22')](function(_0x3d6e0c){if(_0x3d6e0c){_0x2d9b3a=_0x3d6e0c;_0xa2d6ab['model']=_[_0x32b2('0x2e')](db['Action'][_0x32b2('0x2a')]);_0xa2d6ab[_0x32b2('0x2d')]=_[_0x32b2('0x2e')](_0x2b57c3[_0x32b2('0x2d')]);_0xa2d6ab[_0x32b2('0x2f')]=_[_0x32b2('0x30')](_0xa2d6ab[_0x32b2('0x2c')],_0xa2d6ab[_0x32b2('0x2d')]);_0x1e4687[_0x32b2('0x32')]=_['intersection'](_0xa2d6ab[_0x32b2('0x2c')],qs[_0x32b2('0x31')](_0x2b57c3[_0x32b2('0x2d')][_0x32b2('0x31')]));_0x1e4687['attributes']=_0x1e4687[_0x32b2('0x32')]['length']?_0x1e4687[_0x32b2('0x32')]:_0xa2d6ab[_0x32b2('0x2c')];_0x1e4687[_0x32b2('0x36')]=qs['sort'](_0x2b57c3['query'][_0x32b2('0x37')]);_0x1e4687[_0x32b2('0x38')]=qs['filters'](_[_0x32b2('0x55')](_0x2b57c3[_0x32b2('0x2d')],_0xa2d6ab[_0x32b2('0x2f')]));if(_0x2b57c3['query']['filter']){_0x1e4687[_0x32b2('0x38')]=_[_0x32b2('0x3b')](_0x1e4687[_0x32b2('0x38')],{'$or':_['map'](_0x1e4687[_0x32b2('0x32')],function(_0x1455d2){var _0x544214={};_0x544214[_0x1455d2]={'$like':'%'+_0x2b57c3[_0x32b2('0x2d')][_0x32b2('0x39')]+'%'};return _0x544214;})});}_0x1e4687=_[_0x32b2('0x3b')]({},_0x1e4687,_0x2b57c3[_0x32b2('0x3c')]);return _0x2d9b3a[_0x32b2('0x5a')](_0x1e4687);}})[_0x32b2('0x22')](function(_0x39b2af){if(_0x39b2af){_0x427e77=_0x39b2af[_0x32b2('0x33')];if(!_0x2b57c3[_0x32b2('0x2d')][_0x32b2('0x34')](_0x32b2('0x35'))){_0x1e4687[_0x32b2('0x1d')]=qs[_0x32b2('0x1d')](_0x2b57c3['query'][_0x32b2('0x1d')]);_0x1e4687[_0x32b2('0x1a')]=qs[_0x32b2('0x1a')](_0x2b57c3[_0x32b2('0x2d')][_0x32b2('0x1a')]);}return _0x2d9b3a[_0x32b2('0x5a')](_0x1e4687);}})['then'](function(_0x3ce4c9){if(_0x3ce4c9){return _0x3ce4c9?{'count':_0x427e77,'rows':_0x3ce4c9}:null;}})[_0x32b2('0x22')](respondWithResult(_0x1145df,null))[_0x32b2('0x41')](handleError(_0x1145df,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c34e030..e7f29e3 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 _0x202c=['moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','Trigger','lodash','api'];(function(_0xbe38bd,_0x7a72f7){var _0x4a9f41=function(_0x57ab9a){while(--_0x57ab9a){_0xbe38bd['push'](_0xbe38bd['shift']());}};_0x4a9f41(++_0x7a72f7);}(_0x202c,0x178));var _0xc202=function(_0x282477,_0x3363c7){_0x282477=_0x282477-0x0;var _0x1cdbad=_0x202c[_0x282477];return _0x1cdbad;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc202('0x1'));var moment=require(_0xc202('0x2'));var BPromise=require(_0xc202('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc202('0x4'));var rimraf=require(_0xc202('0x5'));var config=require(_0xc202('0x6'));var attributes=require(_0xc202('0x7'));module['exports']=function(_0x28e51c,_0x68d363){return _0x28e51c['define'](_0xc202('0x8'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08d9=['./trigger.attributes','exports','Trigger','tools_triggers','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x517a1f,_0x4d6816){var _0x5f54f7=function(_0x173597){while(--_0x173597){_0x517a1f['push'](_0x517a1f['shift']());}};_0x5f54f7(++_0x4d6816);}(_0x08d9,0xc2));var _0x908d=function(_0x5421a2,_0x2a5fa5){_0x5421a2=_0x5421a2-0x0;var _0x2faf19=_0x08d9[_0x5421a2];return _0x2faf19;};'use strict';var _=require(_0x908d('0x0'));var util=require('util');var logger=require(_0x908d('0x1'))('api');var moment=require(_0x908d('0x2'));var BPromise=require(_0x908d('0x3'));var rp=require(_0x908d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x908d('0x5'));var attributes=require(_0x908d('0x6'));module[_0x908d('0x7')]=function(_0xe780e0,_0xb63409){return _0xe780e0['define'](_0x908d('0x8'),attributes,{'tableName':_0x908d('0x9'),'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 39ea026..c737ee8 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 _0x896f=['model','map','then','ShowTrigger','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include'];(function(_0xba144b,_0x62e472){var _0x43b7f1=function(_0x28485b){while(--_0x28485b){_0xba144b['push'](_0xba144b['shift']());}};_0x43b7f1(++_0x62e472);}(_0x896f,0x1d3));var _0xf896=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x896f[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xf896('0x0'));var util=require(_0xf896('0x1'));var moment=require('moment');var BPromise=require(_0xf896('0x2'));var rs=require(_0xf896('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf896('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf896('0x5'))(_0xf896('0x6'));var config=require('../../config/environment');var jayson=require(_0xf896('0x7'));var client=jayson[_0xf896('0x8')][_0xf896('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5577de,_0x23396f,_0x2c0f9e){return new BPromise(function(_0x2f2f5e,_0x2ace85){return client['request'](_0x5577de,_0x2c0f9e)['then'](function(_0x57d7ea){logger['info'](_0xf896('0xa'),_0x23396f,'request\x20sent');logger[_0xf896('0xb')](_0xf896('0xc'),_0x23396f,'request\x20sent',JSON[_0xf896('0xd')](_0x57d7ea));if(_0x57d7ea[_0xf896('0xe')]){if(_0x57d7ea[_0xf896('0xe')]['code']===0x1f4){logger[_0xf896('0xe')](_0xf896('0xa'),_0x23396f,_0x57d7ea['error'][_0xf896('0xf')]);return _0x2ace85(_0x57d7ea['error'][_0xf896('0xf')]);}logger[_0xf896('0xe')]('Trigger,\x20%s,\x20%s',_0x23396f,_0x57d7ea[_0xf896('0xe')][_0xf896('0xf')]);return _0x2f2f5e(_0x57d7ea['error']['message']);}else{logger[_0xf896('0x10')](_0xf896('0xa'),_0x23396f,_0xf896('0x11'));_0x2f2f5e(_0x57d7ea[_0xf896('0x12')][_0xf896('0xf')]);}})[_0xf896('0x13')](function(_0x3c87c){logger[_0xf896('0xe')](_0xf896('0xa'),_0x23396f,_0x3c87c);_0x2ace85(_0x3c87c);});});}exports[_0xf896('0x14')]=function(_0x423a80){var _0x28ea16=this;return new Promise(function(_0x38c424,_0x32322b){return db[_0xf896('0x15')][_0xf896('0x16')]({'raw':_0x423a80['options']?_0x423a80[_0xf896('0x17')][_0xf896('0x18')]===undefined?!![]:![]:!![],'where':_0x423a80[_0xf896('0x17')]?_0x423a80['options']['where']||null:null,'attributes':_0x423a80['options']?_0x423a80[_0xf896('0x17')][_0xf896('0x19')]||null:null,'limit':_0x423a80[_0xf896('0x17')]?_0x423a80[_0xf896('0x17')][_0xf896('0x1a')]||null:null,'include':_0x423a80[_0xf896('0x17')]?_0x423a80[_0xf896('0x17')][_0xf896('0x1b')]?_['map'](_0x423a80[_0xf896('0x17')][_0xf896('0x1b')],function(_0x6e69dc){return{'model':db[_0x6e69dc[_0xf896('0x1c')]],'as':_0x6e69dc['as'],'attributes':_0x6e69dc[_0xf896('0x19')],'include':_0x6e69dc[_0xf896('0x1b')]?_[_0xf896('0x1d')](_0x6e69dc['include'],function(_0x3f62bb){return{'model':db[_0x3f62bb[_0xf896('0x1c')]],'as':_0x3f62bb['as'],'attributes':_0x3f62bb[_0xf896('0x19')],'include':_0x3f62bb[_0xf896('0x1b')]?_[_0xf896('0x1d')](_0x3f62bb['include'],function(_0xd4d54c){return{'model':db[_0xd4d54c['model']],'as':_0xd4d54c['as'],'attributes':_0xd4d54c[_0xf896('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf896('0x1e')](function(_0x3e884b){logger[_0xf896('0x10')](_0xf896('0x14'),_0x423a80);logger[_0xf896('0xb')](_0xf896('0x14'),_0x423a80,JSON[_0xf896('0xd')](_0x3e884b));_0x38c424(_0x3e884b);})[_0xf896('0x13')](function(_0x22fb11){logger[_0xf896('0xe')](_0xf896('0x14'),_0x22fb11[_0xf896('0xf')],_0x423a80);_0x32322b(_0x28ea16[_0xf896('0xe')](0x1f4,_0x22fb11['message']));});});};exports[_0xf896('0x1f')]=function(_0x1958fd){var _0x357bfc=this;return new Promise(function(_0x1d7fe1,_0xc371d5){return db[_0xf896('0x15')]['find']({'raw':_0x1958fd[_0xf896('0x17')]?_0x1958fd[_0xf896('0x17')][_0xf896('0x18')]===undefined?!![]:![]:!![],'where':_0x1958fd['options']?_0x1958fd['options'][_0xf896('0x20')]||null:null,'attributes':_0x1958fd[_0xf896('0x17')]?_0x1958fd[_0xf896('0x17')][_0xf896('0x19')]||null:null,'include':_0x1958fd[_0xf896('0x17')]?_0x1958fd[_0xf896('0x17')][_0xf896('0x1b')]?_[_0xf896('0x1d')](_0x1958fd[_0xf896('0x17')][_0xf896('0x1b')],function(_0x1de0c0){return{'model':db[_0x1de0c0['model']],'as':_0x1de0c0['as'],'attributes':_0x1de0c0[_0xf896('0x19')],'include':_0x1de0c0[_0xf896('0x1b')]?_[_0xf896('0x1d')](_0x1de0c0[_0xf896('0x1b')],function(_0x45dfa6){return{'model':db[_0x45dfa6[_0xf896('0x1c')]],'as':_0x45dfa6['as'],'attributes':_0x45dfa6[_0xf896('0x19')],'include':_0x45dfa6['include']?_['map'](_0x45dfa6['include'],function(_0x2be11e){return{'model':db[_0x2be11e['model']],'as':_0x2be11e['as'],'attributes':_0x2be11e[_0xf896('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf896('0x1e')](function(_0x10accc){logger['info']('ShowTrigger',_0x1958fd);logger[_0xf896('0xb')](_0xf896('0x1f'),_0x1958fd,JSON['stringify'](_0x10accc));_0x1d7fe1(_0x10accc);})[_0xf896('0x13')](function(_0x22ca7){logger['error'](_0xf896('0x1f'),_0x22ca7[_0xf896('0xf')],_0x1958fd);_0xc371d5(_0x357bfc[_0xf896('0xe')](0x1f4,_0x22ca7[_0xf896('0xf')]));});});}; \ No newline at end of file +var _0x3d5e=['GetTrigger','Trigger','findAll','options','where','attributes','include','map','model','then','ShowTrigger','debug','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x3d5e,0x18d));var _0xe3d5=function(_0x3d4a53,_0x5e474f){_0x3d4a53=_0x3d4a53-0x0;var _0x884363=_0x3d5e[_0x3d4a53];return _0x884363;};'use strict';var _=require('lodash');var util=require(_0xe3d5('0x0'));var moment=require(_0xe3d5('0x1'));var BPromise=require(_0xe3d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3d5('0x3'));var db=require(_0xe3d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3d5('0x5'))('rpc');var config=require(_0xe3d5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe3d5('0x7')][_0xe3d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x181a17,_0x2d31c1,_0x5d2b9e){return new BPromise(function(_0x210581,_0x33b487){return client[_0xe3d5('0x9')](_0x181a17,_0x5d2b9e)['then'](function(_0x14ed46){logger[_0xe3d5('0xa')](_0xe3d5('0xb'),_0x2d31c1,'request\x20sent');logger['debug'](_0xe3d5('0xc'),_0x2d31c1,_0xe3d5('0xd'),JSON[_0xe3d5('0xe')](_0x14ed46));if(_0x14ed46['error']){if(_0x14ed46[_0xe3d5('0xf')][_0xe3d5('0x10')]===0x1f4){logger[_0xe3d5('0xf')]('Trigger,\x20%s,\x20%s',_0x2d31c1,_0x14ed46['error'][_0xe3d5('0x11')]);return _0x33b487(_0x14ed46[_0xe3d5('0xf')]['message']);}logger[_0xe3d5('0xf')](_0xe3d5('0xb'),_0x2d31c1,_0x14ed46['error'][_0xe3d5('0x11')]);return _0x210581(_0x14ed46['error'][_0xe3d5('0x11')]);}else{logger[_0xe3d5('0xa')]('Trigger,\x20%s,\x20%s',_0x2d31c1,'request\x20sent');_0x210581(_0x14ed46[_0xe3d5('0x12')]['message']);}})['catch'](function(_0x24b581){logger['error'](_0xe3d5('0xb'),_0x2d31c1,_0x24b581);_0x33b487(_0x24b581);});});}exports[_0xe3d5('0x13')]=function(_0x3b1103){var _0x4ed58d=this;return new Promise(function(_0xac0448,_0xb7119c){return db[_0xe3d5('0x14')][_0xe3d5('0x15')]({'raw':_0x3b1103[_0xe3d5('0x16')]?_0x3b1103['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b1103[_0xe3d5('0x16')]?_0x3b1103[_0xe3d5('0x16')][_0xe3d5('0x17')]||null:null,'attributes':_0x3b1103[_0xe3d5('0x16')]?_0x3b1103[_0xe3d5('0x16')][_0xe3d5('0x18')]||null:null,'limit':_0x3b1103['options']?_0x3b1103['options']['limit']||null:null,'include':_0x3b1103[_0xe3d5('0x16')]?_0x3b1103[_0xe3d5('0x16')][_0xe3d5('0x19')]?_[_0xe3d5('0x1a')](_0x3b1103[_0xe3d5('0x16')][_0xe3d5('0x19')],function(_0x4706e8){return{'model':db[_0x4706e8[_0xe3d5('0x1b')]],'as':_0x4706e8['as'],'attributes':_0x4706e8[_0xe3d5('0x18')],'include':_0x4706e8[_0xe3d5('0x19')]?_[_0xe3d5('0x1a')](_0x4706e8['include'],function(_0x2139ed){return{'model':db[_0x2139ed['model']],'as':_0x2139ed['as'],'attributes':_0x2139ed[_0xe3d5('0x18')],'include':_0x2139ed[_0xe3d5('0x19')]?_[_0xe3d5('0x1a')](_0x2139ed[_0xe3d5('0x19')],function(_0x1e244d){return{'model':db[_0x1e244d[_0xe3d5('0x1b')]],'as':_0x1e244d['as'],'attributes':_0x1e244d[_0xe3d5('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe3d5('0x1c')](function(_0xadb45a){logger[_0xe3d5('0xa')]('GetTrigger',_0x3b1103);logger['debug'](_0xe3d5('0x13'),_0x3b1103,JSON[_0xe3d5('0xe')](_0xadb45a));_0xac0448(_0xadb45a);})['catch'](function(_0x5305f2){logger['error'](_0xe3d5('0x13'),_0x5305f2[_0xe3d5('0x11')],_0x3b1103);_0xb7119c(_0x4ed58d['error'](0x1f4,_0x5305f2[_0xe3d5('0x11')]));});});};exports[_0xe3d5('0x1d')]=function(_0x165c41){var _0x1d20f2=this;return new Promise(function(_0x2e5ec1,_0x2d2775){return db[_0xe3d5('0x14')]['find']({'raw':_0x165c41[_0xe3d5('0x16')]?_0x165c41[_0xe3d5('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x165c41['options']?_0x165c41[_0xe3d5('0x16')][_0xe3d5('0x17')]||null:null,'attributes':_0x165c41['options']?_0x165c41['options']['attributes']||null:null,'include':_0x165c41[_0xe3d5('0x16')]?_0x165c41[_0xe3d5('0x16')]['include']?_['map'](_0x165c41['options'][_0xe3d5('0x19')],function(_0x2e67be){return{'model':db[_0x2e67be[_0xe3d5('0x1b')]],'as':_0x2e67be['as'],'attributes':_0x2e67be[_0xe3d5('0x18')],'include':_0x2e67be[_0xe3d5('0x19')]?_[_0xe3d5('0x1a')](_0x2e67be[_0xe3d5('0x19')],function(_0x26a0df){return{'model':db[_0x26a0df[_0xe3d5('0x1b')]],'as':_0x26a0df['as'],'attributes':_0x26a0df[_0xe3d5('0x18')],'include':_0x26a0df['include']?_[_0xe3d5('0x1a')](_0x26a0df['include'],function(_0x5b346b){return{'model':db[_0x5b346b[_0xe3d5('0x1b')]],'as':_0x5b346b['as'],'attributes':_0x5b346b[_0xe3d5('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe3d5('0x1c')](function(_0x2d6182){logger[_0xe3d5('0xa')](_0xe3d5('0x1d'),_0x165c41);logger[_0xe3d5('0x1e')](_0xe3d5('0x1d'),_0x165c41,JSON[_0xe3d5('0xe')](_0x2d6182));_0x2e5ec1(_0x2d6182);})[_0xe3d5('0x1f')](function(_0x2334e6){logger[_0xe3d5('0xf')](_0xe3d5('0x1d'),_0x2334e6[_0xe3d5('0x11')],_0x165c41);_0x2d2775(_0x1d20f2[_0xe3d5('0xf')](0x1f4,_0x2334e6[_0xe3d5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index f11984b..45ddc23 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 _0xd69c=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','post','/:id/clone','clone','create','update','delete','/:id','destroy','util','path','connect-timeout'];(function(_0x40de3b,_0x55f385){var _0x344610=function(_0x5ee1fa){while(--_0x5ee1fa){_0x40de3b['push'](_0x40de3b['shift']());}};_0x344610(++_0x55f385);}(_0xd69c,0x107));var _0xcd69=function(_0x281178,_0x3ef44f){_0x281178=_0x281178-0x0;var _0x2f9ac4=_0xd69c[_0x281178];return _0x2f9ac4;};'use strict';var multer=require('multer');var util=require(_0xcd69('0x0'));var path=require(_0xcd69('0x1'));var timeout=require(_0xcd69('0x2'));var express=require(_0xcd69('0x3'));var router=express[_0xcd69('0x4')]();var fs_extra=require(_0xcd69('0x5'));var auth=require(_0xcd69('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcd69('0x7'));var controller=require(_0xcd69('0x8'));router[_0xcd69('0x9')]('/',auth[_0xcd69('0xa')](),controller['index']);router[_0xcd69('0x9')]('/:id',auth[_0xcd69('0xa')](),controller['show']);router[_0xcd69('0xb')](_0xcd69('0xc'),auth[_0xcd69('0xa')](),controller[_0xcd69('0xd')]);router['post']('/',auth[_0xcd69('0xa')](),controller[_0xcd69('0xe')]);router['put']('/:id',auth[_0xcd69('0xa')](),controller[_0xcd69('0xf')]);router[_0xcd69('0x10')](_0xcd69('0x11'),auth['isAuthenticated'](),controller[_0xcd69('0x12')]);module['exports']=router; \ No newline at end of file +var _0x879b=['exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone','clone','create','/:id','update','delete','destroy'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x879b,0x7f));var _0xb879=function(_0x1a423e,_0xb86076){_0x1a423e=_0x1a423e-0x0;var _0x29de4b=_0x879b[_0x1a423e];return _0x29de4b;};'use strict';var multer=require('multer');var util=require(_0xb879('0x0'));var path=require(_0xb879('0x1'));var timeout=require(_0xb879('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb879('0x3'));var auth=require(_0xb879('0x4'));var interaction=require(_0xb879('0x5'));var config=require(_0xb879('0x6'));var controller=require(_0xb879('0x7'));router[_0xb879('0x8')]('/',auth[_0xb879('0x9')](),controller[_0xb879('0xa')]);router[_0xb879('0x8')]('/:id',auth[_0xb879('0x9')](),controller[_0xb879('0xb')]);router[_0xb879('0xc')](_0xb879('0xd'),auth[_0xb879('0x9')](),controller[_0xb879('0xe')]);router['post']('/',auth[_0xb879('0x9')](),controller[_0xb879('0xf')]);router['put'](_0xb879('0x10'),auth[_0xb879('0x9')](),controller[_0xb879('0x11')]);router[_0xb879('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb879('0x13')]);module[_0xb879('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 7c36933..3b210dd 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 _0x2db9=['transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','\x22\x22\x20<>','always','refuse','originate','uas','pai','fingerprint','certificate','passive','actpass','dynamic','nonat','update','BOOLEAN','sequelize','STRING','name','friend','user','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp'];(function(_0x38953b,_0x5b1078){var _0x1445f2=function(_0x22d728){while(--_0x22d728){_0x38953b['push'](_0x38953b['shift']());}};_0x1445f2(++_0x5b1078);}(_0x2db9,0x11f));var _0x92db=function(_0x78c6ae,_0xdf8c05){_0x78c6ae=_0x78c6ae-0x0;var _0x3d65bd=_0x2db9[_0x78c6ae];return _0x3d65bd;};'use strict';var Sequelize=require(_0x92db('0x0'));module['exports']={'name':{'type':Sequelize[_0x92db('0x1')],'allowNull':![],'unique':_0x92db('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x92db('0x3'),_0x92db('0x4'),'peer'),'allowNull':![],'defaultValue':_0x92db('0x3')},'context':{'type':Sequelize[_0x92db('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x92db('0x5')]('ALLOWED_NOT_SCREENED',_0x92db('0x6'),'ALLOWED_FAILED_SCREEN',_0x92db('0x7'),_0x92db('0x8'),_0x92db('0x9'),_0x92db('0xa'),_0x92db('0xb'))},'deny':{'type':Sequelize[_0x92db('0x1')]},'permit':{'type':Sequelize[_0x92db('0x1')]},'secret':{'type':Sequelize[_0x92db('0x1')]},'md5secret':{'type':Sequelize[_0x92db('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x92db('0x1')],'defaultValue':_0x92db('0xc'),'set':function(_0x5dc302){this['setDataValue'](_0x92db('0xd'),_0x5dc302?_0x5dc302[_0x92db('0xe')](','):null);},'get':function(){return this[_0x92db('0xf')](_0x92db('0xd'))?this[_0x92db('0xf')](_0x92db('0xd'))[_0x92db('0x10')](','):null;},'comment':_0x92db('0x11')},'dtmfmode':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x12'),_0x92db('0x13'),_0x92db('0x14'),_0x92db('0x15'),_0x92db('0x16')),'defaultValue':_0x92db('0x12')},'directmedia':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no','nonat','update',_0x92db('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x92db('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x92db('0x19'),'set':function(_0x540aca){this[_0x92db('0x1a')](_0x92db('0x1b'),_0x540aca?_0x540aca[_0x92db('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x92db('0x1b'))?this[_0x92db('0xf')](_0x92db('0x1b'))['split'](','):null;},'comment':_0x92db('0x1c')},'callgroup':{'type':Sequelize[_0x92db('0x1')]},'namedcallgroup':{'type':Sequelize[_0x92db('0x1')]},'pickupgroup':{'type':Sequelize[_0x92db('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x92db('0x1')]},'language':{'type':Sequelize[_0x92db('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x92db('0x1')],'defaultValue':_0x92db('0x1d')},'allow':{'type':Sequelize[_0x92db('0x1')],'allowNull':![],'defaultValue':_0x92db('0x1e'),'set':function(_0x54f4ec){this[_0x92db('0x1a')]('allow',_0x54f4ec?_0x54f4ec[_0x92db('0xe')](';'):_0x92db('0x1e'));},'get':function(){return this[_0x92db('0xf')](_0x92db('0x1f'))?this[_0x92db('0xf')](_0x92db('0x1f'))[_0x92db('0x10')](';'):null;},'comment':_0x92db('0x20')},'autoframing':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'insecure':{'type':Sequelize[_0x92db('0x1')],'defaultValue':_0x92db('0x21'),'set':function(_0x2badbc){this['setDataValue'](_0x92db('0x22'),_0x2badbc?_0x2badbc[_0x92db('0xe')](','):null);},'get':function(){return this[_0x92db('0xf')]('insecure')?this['getDataValue'](_0x92db('0x22'))[_0x92db('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x92db('0x5')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x92db('0x5')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0x92db('0x5')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x92db('0x17'),'no')},'accountcode':{'type':Sequelize[_0x92db('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x92db('0x1')],'defaultValue':_0x92db('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x92db('0x5')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x92db('0x5')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x92db('0x1')]},'template':{'type':Sequelize[_0x92db('0x1')]},'videosupport':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no',_0x92db('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x92db('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x92db('0x5')]('yes','no')},'mailbox':{'type':Sequelize[_0x92db('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x92db('0x26'),_0x92db('0x27'))},'session_expires':{'type':Sequelize[_0x92db('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x92db('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x92db('0x5')]('uac',_0x92db('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x92db('0x1')]},'regexten':{'type':Sequelize[_0x92db('0x1')]},'fromdomain':{'type':Sequelize[_0x92db('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x92db('0x23')](0x5)},'qualify':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no'),'defaultValue':_0x92db('0x17')},'keepalive':{'type':Sequelize[_0x92db('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x92db('0x1')]},'defaultuser':{'type':Sequelize[_0x92db('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x92db('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x92db('0x5')]('yes','no',_0x92db('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x92db('0x1')]},'callbackextension':{'type':Sequelize[_0x92db('0x1')]},'timert1':{'type':Sequelize[_0x92db('0x23')](0xb)},'timerb':{'type':Sequelize[_0x92db('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x92db('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x92db('0x1')]},'contactdeny':{'type':Sequelize[_0x92db('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x92db('0x1')]},'use_q850_reason':{'type':Sequelize[_0x92db('0x1')]},'maxforwards':{'type':Sequelize[_0x92db('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x92db('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'force_avp':{'type':Sequelize[_0x92db('0x5')]('yes','no')},'icesupport':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no',_0x92db('0x2a'),_0x92db('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x92db('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x92db('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x92db('0x1')]},'dtlscipher':{'type':Sequelize[_0x92db('0x1')]},'dtlscafile':{'type':Sequelize[_0x92db('0x1')]},'dtlscapath':{'type':Sequelize[_0x92db('0x1')]},'dtlssetup':{'type':Sequelize[_0x92db('0x5')]('active',_0x92db('0x2c'),_0x92db('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x92db('0x1')]},'usereqphone':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x92db('0x1')]},'recordofffeature':{'type':Sequelize[_0x92db('0x1')]},'call_limit':{'type':Sequelize[_0x92db('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'vmexten':{'type':Sequelize[_0x92db('0x1')]},'mohinterpret':{'type':Sequelize[_0x92db('0x1')]},'mohsuggest':{'type':Sequelize[_0x92db('0x1')]},'parkinglot':{'type':Sequelize[_0x92db('0x1')]},'description':{'type':Sequelize[_0x92db('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x92db('0x2e')},'canreinvite':{'type':Sequelize['ENUM'](_0x92db('0x17'),'no',_0x92db('0x2f'),_0x92db('0x30'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x92db('0x1')]},'active':{'type':Sequelize[_0x92db('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x92db('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x52d5=['name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','originate','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING'];(function(_0x40feaa,_0x700d0e){var _0x1501af=function(_0x45d484){while(--_0x45d484){_0x40feaa['push'](_0x40feaa['shift']());}};_0x1501af(++_0x700d0e);}(_0x52d5,0x1a5));var _0x552d=function(_0xd2eeab,_0x20565d){_0xd2eeab=_0xd2eeab-0x0;var _0x1bb40b=_0x52d5[_0xd2eeab];return _0x1bb40b;};'use strict';var Sequelize=require(_0x552d('0x0'));module[_0x552d('0x1')]={'name':{'type':Sequelize[_0x552d('0x2')],'allowNull':![],'unique':_0x552d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x5'),_0x552d('0x6'),_0x552d('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x552d('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x8'),'ALLOWED_PASSED_SCREEN',_0x552d('0x9'),_0x552d('0xa'),_0x552d('0xb'),_0x552d('0xc'),_0x552d('0xd'),_0x552d('0xe'))},'deny':{'type':Sequelize[_0x552d('0x2')]},'permit':{'type':Sequelize[_0x552d('0x2')]},'secret':{'type':Sequelize[_0x552d('0x2')]},'md5secret':{'type':Sequelize[_0x552d('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x552d('0x2')],'defaultValue':_0x552d('0xf'),'set':function(_0x3e20f1){this[_0x552d('0x10')](_0x552d('0x11'),_0x3e20f1?_0x3e20f1[_0x552d('0x12')](','):null);},'get':function(){return this[_0x552d('0x13')]('transport')?this['getDataValue'](_0x552d('0x11'))[_0x552d('0x14')](','):null;},'comment':_0x552d('0x15')},'dtmfmode':{'type':Sequelize['ENUM'](_0x552d('0x16'),_0x552d('0x17'),_0x552d('0x18'),_0x552d('0x19'),_0x552d('0x1a')),'defaultValue':_0x552d('0x16')},'directmedia':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no',_0x552d('0x1c'),_0x552d('0x1d'),_0x552d('0x1e')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x552d('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x552d('0x2')]},'directmediadeny':{'type':Sequelize[_0x552d('0x2')]},'nat':{'type':Sequelize[_0x552d('0x2')],'defaultValue':_0x552d('0x1f'),'set':function(_0x649c8e){this[_0x552d('0x10')](_0x552d('0x20'),_0x649c8e?_0x649c8e[_0x552d('0x12')](','):null);},'get':function(){return this[_0x552d('0x13')](_0x552d('0x20'))?this['getDataValue'](_0x552d('0x20'))[_0x552d('0x14')](','):null;},'comment':_0x552d('0x21')},'callgroup':{'type':Sequelize[_0x552d('0x2')]},'namedcallgroup':{'type':Sequelize[_0x552d('0x2')]},'pickupgroup':{'type':Sequelize[_0x552d('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x552d('0x2')]},'language':{'type':Sequelize[_0x552d('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x552d('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x552d('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x552d('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x511297){this[_0x552d('0x10')](_0x552d('0x22'),_0x511297?_0x511297[_0x552d('0x12')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x552d('0x13')](_0x552d('0x22'))?this['getDataValue'](_0x552d('0x22'))[_0x552d('0x14')](';'):null;},'comment':_0x552d('0x23')},'autoframing':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no')},'insecure':{'type':Sequelize[_0x552d('0x2')],'defaultValue':_0x552d('0x24'),'set':function(_0x20c9f9){this[_0x552d('0x10')](_0x552d('0x25'),_0x20c9f9?_0x20c9f9[_0x552d('0x12')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x552d('0x13')](_0x552d('0x25'))[_0x552d('0x14')](','):null;},'comment':_0x552d('0x26')},'trustrpid':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x552d('0x1b'),'no',_0x552d('0x27'))},'promiscredir':{'type':Sequelize['ENUM'](_0x552d('0x1b'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x552d('0x28')](0xb)},'setvar':{'type':Sequelize[_0x552d('0x2')]},'callerid':{'type':Sequelize[_0x552d('0x2')],'defaultValue':_0x552d('0x29')},'amaflags':{'type':Sequelize[_0x552d('0x2')]},'callcounter':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no'),'defaultValue':_0x552d('0x1b')},'busylevel':{'type':Sequelize[_0x552d('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x552d('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x552d('0x2')]},'template':{'type':Sequelize[_0x552d('0x2')]},'videosupport':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no',_0x552d('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x552d('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x552d('0x2')]},'session_timers':{'type':Sequelize[_0x552d('0x4')]('accept','refuse',_0x552d('0x2b'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x552d('0x4')]('uac',_0x552d('0x2c')),'defaultValue':_0x552d('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x552d('0x2')]},'fromuser':{'type':Sequelize[_0x552d('0x2')]},'port':{'type':Sequelize[_0x552d('0x28')](0x5)},'qualify':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x552d('0x28')](0xb)},'defaultip':{'type':Sequelize[_0x552d('0x2')]},'defaultuser':{'type':Sequelize[_0x552d('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x552d('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x552d('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no',_0x552d('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x552d('0x2')]},'callbackextension':{'type':Sequelize[_0x552d('0x2')]},'timert1':{'type':Sequelize[_0x552d('0x28')](0xb)},'timerb':{'type':Sequelize[_0x552d('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x552d('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0x552d('0x2')]},'contactdeny':{'type':Sequelize[_0x552d('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x552d('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x552d('0x28')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x552d('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x552d('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x552d('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x552d('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x552d('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x552d('0x2')]},'dtlscipher':{'type':Sequelize[_0x552d('0x2')]},'dtlscafile':{'type':Sequelize[_0x552d('0x2')]},'dtlscapath':{'type':Sequelize[_0x552d('0x2')]},'dtlssetup':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x2f'),_0x552d('0x30'),_0x552d('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x552d('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x552d('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x552d('0x2')]},'recordofffeature':{'type':Sequelize[_0x552d('0x2')]},'call_limit':{'type':Sequelize[_0x552d('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x552d('0x4')](_0x552d('0x1b'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x552d('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x552d('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x552d('0x2')],'defaultValue':_0x552d('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0x552d('0x1b'),'no',_0x552d('0x1c'),_0x552d('0x1d'),_0x552d('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x552d('0x2')]},'active':{'type':Sequelize[_0x552d('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x552d('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 71f418d..79c3545 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 _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','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','jayson/promise','client','http','request'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3904e9,_0x1c0782){_0x3904e9=_0x3904e9-0x0;var _0x1ba0e0=_0xe5b3[_0x3904e9];return _0x1ba0e0;};'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'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file +var _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x50d77f,_0x1a76da){var _0x477ae3=function(_0x358ee2){while(--_0x358ee2){_0x50d77f['push'](_0x50d77f['shift']());}};_0x477ae3(++_0x1a76da);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x3b1f34,_0x246f17){_0x3b1f34=_0x3b1f34-0x0;var _0x4b0abb=_0x8d0e[_0x3b1f34];return _0x4b0abb;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 37361e6..b37c528 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 _0x740d=['../../config/environment','exports','define','Trunk','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1afadf,_0x357131){var _0x3a3b4a=function(_0x224753){while(--_0x224753){_0x1afadf['push'](_0x1afadf['shift']());}};_0x3a3b4a(++_0x357131);}(_0x740d,0x101));var _0xd740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x740d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd740('0x0'));var util=require('util');var logger=require(_0xd740('0x1'))(_0xd740('0x2'));var moment=require(_0xd740('0x3'));var BPromise=require(_0xd740('0x4'));var rp=require(_0xd740('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd740('0x6'));var config=require(_0xd740('0x7'));var attributes=require('./trunk.attributes');module[_0xd740('0x8')]=function(_0x395053,_0x392b8f){return _0x395053[_0xd740('0x9')](_0xd740('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10c5=['../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','util','moment','bluebird','rimraf'];(function(_0x418799,_0x14f50a){var _0x408715=function(_0x2114c1){while(--_0x2114c1){_0x418799['push'](_0x418799['shift']());}};_0x408715(++_0x14f50a);}(_0x10c5,0x1b3));var _0x510c=function(_0x5da5b5,_0x59214d){_0x5da5b5=_0x5da5b5-0x0;var _0x4001fb=_0x10c5[_0x5da5b5];return _0x4001fb;};'use strict';var _=require(_0x510c('0x0'));var util=require(_0x510c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x510c('0x2'));var BPromise=require(_0x510c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x510c('0x4'));var config=require(_0x510c('0x5'));var attributes=require(_0x510c('0x6'));module[_0x510c('0x7')]=function(_0x3771a8,_0x50d908){return _0x3771a8[_0x510c('0x8')](_0x510c('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 9d4a398..abfe128 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 _0xf774=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','model','map','ShowTrunk','lodash'];(function(_0x8ef800,_0x270234){var _0x3386f6=function(_0x141f30){while(--_0x141f30){_0x8ef800['push'](_0x8ef800['shift']());}};_0x3386f6(++_0x270234);}(_0xf774,0xae));var _0x4f77=function(_0xcaf098,_0x9f56c5){_0xcaf098=_0xcaf098-0x0;var _0x7cc5b4=_0xf774[_0xcaf098];return _0x7cc5b4;};'use strict';var _=require(_0x4f77('0x0'));var util=require('util');var moment=require(_0x4f77('0x1'));var BPromise=require(_0x4f77('0x2'));var rs=require(_0x4f77('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f77('0x4'))['db'];var utils=require(_0x4f77('0x5'));var logger=require(_0x4f77('0x6'))(_0x4f77('0x7'));var config=require(_0x4f77('0x8'));var jayson=require(_0x4f77('0x9'));var client=jayson[_0x4f77('0xa')][_0x4f77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12e180,_0x4daa2a,_0x452882){return new BPromise(function(_0x12e994,_0xdb92c5){return client[_0x4f77('0xc')](_0x12e180,_0x452882)[_0x4f77('0xd')](function(_0x4706d8){logger[_0x4f77('0xe')](_0x4f77('0xf'),_0x4daa2a,'request\x20sent');logger[_0x4f77('0x10')](_0x4f77('0x11'),_0x4daa2a,'request\x20sent',JSON[_0x4f77('0x12')](_0x4706d8));if(_0x4706d8[_0x4f77('0x13')]){if(_0x4706d8['error'][_0x4f77('0x14')]===0x1f4){logger[_0x4f77('0x13')]('Trunk,\x20%s,\x20%s',_0x4daa2a,_0x4706d8['error'][_0x4f77('0x15')]);return _0xdb92c5(_0x4706d8[_0x4f77('0x13')][_0x4f77('0x15')]);}logger[_0x4f77('0x13')](_0x4f77('0xf'),_0x4daa2a,_0x4706d8[_0x4f77('0x13')][_0x4f77('0x15')]);return _0x12e994(_0x4706d8['error'][_0x4f77('0x15')]);}else{logger[_0x4f77('0xe')](_0x4f77('0xf'),_0x4daa2a,_0x4f77('0x16'));_0x12e994(_0x4706d8['result'][_0x4f77('0x15')]);}})[_0x4f77('0x17')](function(_0xf3e2a){logger[_0x4f77('0x13')](_0x4f77('0xf'),_0x4daa2a,_0xf3e2a);_0xdb92c5(_0xf3e2a);});});}exports[_0x4f77('0x18')]=function(_0x5e0689){var _0x22cc59=this;return new Promise(function(_0x45f2b6,_0x4b19fe){return db[_0x4f77('0x19')][_0x4f77('0x1a')]({'raw':_0x5e0689['options']?_0x5e0689[_0x4f77('0x1b')][_0x4f77('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e0689[_0x4f77('0x1b')]?_0x5e0689['options'][_0x4f77('0x1d')]||null:null,'attributes':_0x5e0689[_0x4f77('0x1b')]?_0x5e0689[_0x4f77('0x1b')][_0x4f77('0x1e')]||null:null,'limit':_0x5e0689[_0x4f77('0x1b')]?_0x5e0689[_0x4f77('0x1b')]['limit']||null:null,'include':_0x5e0689[_0x4f77('0x1b')]?_0x5e0689[_0x4f77('0x1b')][_0x4f77('0x1f')]?_['map'](_0x5e0689[_0x4f77('0x1b')][_0x4f77('0x1f')],function(_0x2a803c){return{'model':db[_0x2a803c[_0x4f77('0x20')]],'as':_0x2a803c['as'],'attributes':_0x2a803c['attributes'],'include':_0x2a803c['include']?_[_0x4f77('0x21')](_0x2a803c[_0x4f77('0x1f')],function(_0x2056e2){return{'model':db[_0x2056e2[_0x4f77('0x20')]],'as':_0x2056e2['as'],'attributes':_0x2056e2[_0x4f77('0x1e')],'include':_0x2056e2[_0x4f77('0x1f')]?_[_0x4f77('0x21')](_0x2056e2[_0x4f77('0x1f')],function(_0x237e2e){return{'model':db[_0x237e2e[_0x4f77('0x20')]],'as':_0x237e2e['as'],'attributes':_0x237e2e[_0x4f77('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f77('0xd')](function(_0x3e5f8d){logger[_0x4f77('0xe')]('GetTrunk',_0x5e0689);logger[_0x4f77('0x10')](_0x4f77('0x18'),_0x5e0689,JSON[_0x4f77('0x12')](_0x3e5f8d));_0x45f2b6(_0x3e5f8d);})[_0x4f77('0x17')](function(_0x4528fe){logger[_0x4f77('0x13')](_0x4f77('0x18'),_0x4528fe[_0x4f77('0x15')],_0x5e0689);_0x4b19fe(_0x22cc59[_0x4f77('0x13')](0x1f4,_0x4528fe[_0x4f77('0x15')]));});});};exports[_0x4f77('0x22')]=function(_0x4b3687){var _0x22d28a=this;return new Promise(function(_0x1ff18b,_0x47ea06){return db['Trunk']['find']({'raw':_0x4b3687[_0x4f77('0x1b')]?_0x4b3687[_0x4f77('0x1b')][_0x4f77('0x1c')]===undefined?!![]:![]:!![],'where':_0x4b3687[_0x4f77('0x1b')]?_0x4b3687[_0x4f77('0x1b')][_0x4f77('0x1d')]||null:null,'attributes':_0x4b3687[_0x4f77('0x1b')]?_0x4b3687[_0x4f77('0x1b')]['attributes']||null:null,'include':_0x4b3687[_0x4f77('0x1b')]?_0x4b3687['options']['include']?_[_0x4f77('0x21')](_0x4b3687[_0x4f77('0x1b')][_0x4f77('0x1f')],function(_0x191299){return{'model':db[_0x191299[_0x4f77('0x20')]],'as':_0x191299['as'],'attributes':_0x191299['attributes'],'include':_0x191299['include']?_[_0x4f77('0x21')](_0x191299[_0x4f77('0x1f')],function(_0x8631f4){return{'model':db[_0x8631f4['model']],'as':_0x8631f4['as'],'attributes':_0x8631f4[_0x4f77('0x1e')],'include':_0x8631f4[_0x4f77('0x1f')]?_[_0x4f77('0x21')](_0x8631f4['include'],function(_0x291221){return{'model':db[_0x291221[_0x4f77('0x20')]],'as':_0x291221['as'],'attributes':_0x291221[_0x4f77('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f77('0xd')](function(_0x1b6021){logger[_0x4f77('0xe')]('ShowTrunk',_0x4b3687);logger[_0x4f77('0x10')]('ShowTrunk',_0x4b3687,JSON[_0x4f77('0x12')](_0x1b6021));_0x1ff18b(_0x1b6021);})[_0x4f77('0x17')](function(_0x31dc14){logger[_0x4f77('0x13')](_0x4f77('0x22'),_0x31dc14[_0x4f77('0x15')],_0x4b3687);_0x47ea06(_0x22d28a[_0x4f77('0x13')](0x1f4,_0x31dc14['message']));});});}; \ No newline at end of file +var _0xc6c9=['stringify','catch','ShowTrunk','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Trunk,\x20%s,\x20%s','result','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk'];(function(_0x22789a,_0x4a1c8c){var _0xede88=function(_0x49243f){while(--_0x49243f){_0x22789a['push'](_0x22789a['shift']());}};_0xede88(++_0x4a1c8c);}(_0xc6c9,0x76));var _0x9c6c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc6c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9c6c('0x0'));var util=require('util');var moment=require(_0x9c6c('0x1'));var BPromise=require(_0x9c6c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c6c('0x3'));var db=require(_0x9c6c('0x4'))['db'];var utils=require(_0x9c6c('0x5'));var logger=require(_0x9c6c('0x6'))(_0x9c6c('0x7'));var config=require(_0x9c6c('0x8'));var jayson=require(_0x9c6c('0x9'));var client=jayson[_0x9c6c('0xa')][_0x9c6c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b8a77,_0x1e7f03,_0x262fdf){return new BPromise(function(_0x5481ac,_0x1f0e2e){return client[_0x9c6c('0xc')](_0x3b8a77,_0x262fdf)[_0x9c6c('0xd')](function(_0xd61bc9){logger[_0x9c6c('0xe')]('Trunk,\x20%s,\x20%s',_0x1e7f03,'request\x20sent');logger[_0x9c6c('0xf')](_0x9c6c('0x10'),_0x1e7f03,_0x9c6c('0x11'),JSON['stringify'](_0xd61bc9));if(_0xd61bc9[_0x9c6c('0x12')]){if(_0xd61bc9[_0x9c6c('0x12')][_0x9c6c('0x13')]===0x1f4){logger[_0x9c6c('0x12')]('Trunk,\x20%s,\x20%s',_0x1e7f03,_0xd61bc9[_0x9c6c('0x12')][_0x9c6c('0x14')]);return _0x1f0e2e(_0xd61bc9[_0x9c6c('0x12')][_0x9c6c('0x14')]);}logger[_0x9c6c('0x12')]('Trunk,\x20%s,\x20%s',_0x1e7f03,_0xd61bc9[_0x9c6c('0x12')][_0x9c6c('0x14')]);return _0x5481ac(_0xd61bc9[_0x9c6c('0x12')][_0x9c6c('0x14')]);}else{logger['info'](_0x9c6c('0x15'),_0x1e7f03,_0x9c6c('0x11'));_0x5481ac(_0xd61bc9[_0x9c6c('0x16')][_0x9c6c('0x14')]);}})['catch'](function(_0xda51fc){logger['error']('Trunk,\x20%s,\x20%s',_0x1e7f03,_0xda51fc);_0x1f0e2e(_0xda51fc);});});}exports['GetTrunk']=function(_0x3b6e59){var _0x5716b0=this;return new Promise(function(_0x8beeb5,_0x5d1f94){return db[_0x9c6c('0x17')][_0x9c6c('0x18')]({'raw':_0x3b6e59[_0x9c6c('0x19')]?_0x3b6e59[_0x9c6c('0x19')][_0x9c6c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b6e59[_0x9c6c('0x19')]?_0x3b6e59[_0x9c6c('0x19')][_0x9c6c('0x1b')]||null:null,'attributes':_0x3b6e59[_0x9c6c('0x19')]?_0x3b6e59[_0x9c6c('0x19')][_0x9c6c('0x1c')]||null:null,'limit':_0x3b6e59[_0x9c6c('0x19')]?_0x3b6e59['options'][_0x9c6c('0x1d')]||null:null,'include':_0x3b6e59[_0x9c6c('0x19')]?_0x3b6e59[_0x9c6c('0x19')][_0x9c6c('0x1e')]?_[_0x9c6c('0x1f')](_0x3b6e59[_0x9c6c('0x19')]['include'],function(_0x20bb4c){return{'model':db[_0x20bb4c[_0x9c6c('0x20')]],'as':_0x20bb4c['as'],'attributes':_0x20bb4c[_0x9c6c('0x1c')],'include':_0x20bb4c[_0x9c6c('0x1e')]?_[_0x9c6c('0x1f')](_0x20bb4c['include'],function(_0x6db7d5){return{'model':db[_0x6db7d5[_0x9c6c('0x20')]],'as':_0x6db7d5['as'],'attributes':_0x6db7d5[_0x9c6c('0x1c')],'include':_0x6db7d5[_0x9c6c('0x1e')]?_['map'](_0x6db7d5['include'],function(_0xba8d83){return{'model':db[_0xba8d83[_0x9c6c('0x20')]],'as':_0xba8d83['as'],'attributes':_0xba8d83[_0x9c6c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x180e7c){logger[_0x9c6c('0xe')](_0x9c6c('0x21'),_0x3b6e59);logger[_0x9c6c('0xf')]('GetTrunk',_0x3b6e59,JSON[_0x9c6c('0x22')](_0x180e7c));_0x8beeb5(_0x180e7c);})[_0x9c6c('0x23')](function(_0x206beb){logger[_0x9c6c('0x12')](_0x9c6c('0x21'),_0x206beb['message'],_0x3b6e59);_0x5d1f94(_0x5716b0['error'](0x1f4,_0x206beb[_0x9c6c('0x14')]));});});};exports[_0x9c6c('0x24')]=function(_0x31e77a){var _0x292777=this;return new Promise(function(_0x295896,_0x3f1680){return db[_0x9c6c('0x17')][_0x9c6c('0x25')]({'raw':_0x31e77a[_0x9c6c('0x19')]?_0x31e77a[_0x9c6c('0x19')][_0x9c6c('0x1a')]===undefined?!![]:![]:!![],'where':_0x31e77a[_0x9c6c('0x19')]?_0x31e77a[_0x9c6c('0x19')][_0x9c6c('0x1b')]||null:null,'attributes':_0x31e77a['options']?_0x31e77a[_0x9c6c('0x19')]['attributes']||null:null,'include':_0x31e77a[_0x9c6c('0x19')]?_0x31e77a['options'][_0x9c6c('0x1e')]?_[_0x9c6c('0x1f')](_0x31e77a[_0x9c6c('0x19')][_0x9c6c('0x1e')],function(_0x21c732){return{'model':db[_0x21c732[_0x9c6c('0x20')]],'as':_0x21c732['as'],'attributes':_0x21c732[_0x9c6c('0x1c')],'include':_0x21c732[_0x9c6c('0x1e')]?_[_0x9c6c('0x1f')](_0x21c732[_0x9c6c('0x1e')],function(_0x9afbe1){return{'model':db[_0x9afbe1['model']],'as':_0x9afbe1['as'],'attributes':_0x9afbe1['attributes'],'include':_0x9afbe1[_0x9c6c('0x1e')]?_[_0x9c6c('0x1f')](_0x9afbe1[_0x9c6c('0x1e')],function(_0x129e1e){return{'model':db[_0x129e1e[_0x9c6c('0x20')]],'as':_0x129e1e['as'],'attributes':_0x129e1e[_0x9c6c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b2f67){logger[_0x9c6c('0xe')]('ShowTrunk',_0x31e77a);logger[_0x9c6c('0xf')]('ShowTrunk',_0x31e77a,JSON['stringify'](_0x3b2f67));_0x295896(_0x3b2f67);})[_0x9c6c('0x23')](function(_0x10cb8f){logger[_0x9c6c('0x12')]('ShowTrunk',_0x10cb8f[_0x9c6c('0x14')],_0x31e77a);_0x3f1680(_0x292777[_0x9c6c('0x12')](0x1f4,_0x10cb8f[_0x9c6c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index f619a19..4acf5bd 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 _0xa1e1=['isAuthenticated','update','exports','express','Router','../../components/auth/service','/:id'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa1e1,0xb2));var _0x1a1e=function(_0x598dea,_0x1ecb54){_0x598dea=_0x598dea-0x0;var _0x34f50c=_0xa1e1[_0x598dea];return _0x34f50c;};'use strict';var express=require(_0x1a1e('0x0'));var router=express[_0x1a1e('0x1')]();var auth=require(_0x1a1e('0x2'));var controller=require('./user-setting.controller');router['put'](_0x1a1e('0x3'),auth[_0x1a1e('0x4')](),controller[_0x1a1e('0x5')]);module[_0x1a1e('0x6')]=router; \ No newline at end of file +var _0x79b2=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','express'];(function(_0x1482be,_0x39d7b8){var _0x1b0418=function(_0x1ae867){while(--_0x1ae867){_0x1482be['push'](_0x1482be['shift']());}};_0x1b0418(++_0x39d7b8);}(_0x79b2,0x87));var _0x279b=function(_0x1310a7,_0x5d0098){_0x1310a7=_0x1310a7-0x0;var _0x4b122d=_0x79b2[_0x1310a7];return _0x4b122d;};'use strict';var express=require(_0x279b('0x0'));var router=express['Router']();var auth=require(_0x279b('0x1'));var controller=require(_0x279b('0x2'));router[_0x279b('0x3')](_0x279b('0x4'),auth[_0x279b('0x5')](),controller[_0x279b('0x6')]);module[_0x279b('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 9aa18a7..3e94e8a 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 _0x7389=['sequelize','error','warning','info','debug','exports','TEXT','DATE','INTEGER','UserId'];(function(_0xec7a27,_0x47c037){var _0x85982a=function(_0x7cc5){while(--_0x7cc5){_0xec7a27['push'](_0xec7a27['shift']());}};_0x85982a(++_0x47c037);}(_0x7389,0xaa));var _0x9738=function(_0x291cd4,_0x3d1d11){_0x291cd4=_0x291cd4-0x0;var _0x43daac=_0x7389[_0x291cd4];return _0x43daac;};'use strict';var Sequelize=require(_0x9738('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x9738('0x1'),_0x9738('0x2'),_0x9738('0x3'),_0x9738('0x4')];module[_0x9738('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x9738('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x9738('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x9738('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x9738('0x8')],'unique':_0x9738('0x9')}}; \ No newline at end of file +var _0x2d7c=['error','warning','info','ENUM','BOOLEAN','DATE','INTEGER','UserId','sequelize'];(function(_0x2a1be8,_0x28d9d5){var _0x10cb75=function(_0x29bae4){while(--_0x29bae4){_0x2a1be8['push'](_0x2a1be8['shift']());}};_0x10cb75(++_0x28d9d5);}(_0x2d7c,0x1a6));var _0xc2d7=function(_0x26222d,_0x1d2de1){_0x26222d=_0x26222d-0x0;var _0x16bf9f=_0x2d7c[_0x26222d];return _0x16bf9f;};'use strict';var Sequelize=require(_0xc2d7('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xc2d7('0x1'),_0xc2d7('0x2'),_0xc2d7('0x3'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xc2d7('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xc2d7('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc2d7('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xc2d7('0x7')],'unique':_0xc2d7('0x8')}}; \ 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 403050c..e476d17 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 _0x70e0=['ioredis','../../config/logger','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','status','json','update','then','sendStatus','error','stack','name','send','Unauthorized','params','find','catch','lodash'];(function(_0x3ee672,_0x353727){var _0x277f57=function(_0x19ab2c){while(--_0x19ab2c){_0x3ee672['push'](_0x3ee672['shift']());}};_0x277f57(++_0x353727);}(_0x70e0,0x17b));var _0x070e=function(_0x3e3060,_0x44238e){_0x3e3060=_0x3e3060-0x0;var _0x24ed39=_0x70e0[_0x3e3060];return _0x24ed39;};'use strict';var _=require(_0x070e('0x0'));var Redis=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var config=require('../../config/environment');var db=require(_0x070e('0x3'))['db'];var socket=require(_0x070e('0x4'))(new Redis(config[_0x070e('0x5')]));require(_0x070e('0x6'))['register'](socket);config[_0x070e('0x5')]=_['defaults'](config[_0x070e('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x56e420,_0x5032e5){_0x5032e5=_0x5032e5||0xc8;return function(_0x35ab0c){if(_0x35ab0c){return _0x56e420[_0x070e('0x7')](_0x5032e5)[_0x070e('0x8')](_0x35ab0c);}};}function saveUpdates(_0x2611e6){return function(_0x111743){if(_0x111743){return _0x111743[_0x070e('0x9')](_0x2611e6)[_0x070e('0xa')](function(_0x4e99e6){return _0x4e99e6;});}return null;};}function handleEntityNotFound(_0x49b2fb){return function(_0x50f4eb){if(!_0x50f4eb){_0x49b2fb[_0x070e('0xb')](0x194);}return _0x50f4eb;};}function handleError(_0x12bb37,_0xb8d819){_0xb8d819=_0xb8d819||0x1f4;return function(_0xa927a2){logger[_0x070e('0xc')](_0xa927a2[_0x070e('0xd')]);if(_0xa927a2[_0x070e('0xe')]){delete _0xa927a2[_0x070e('0xe')];}_0x12bb37[_0x070e('0x7')](_0xb8d819)[_0x070e('0xf')](_0xa927a2);};}exports['update']=function(_0x5dca0f,_0x24baba){if(_0x5dca0f['user']['role']!=='admin')throw new Error(_0x070e('0x10'));if(isNaN(Number(_0x5dca0f[_0x070e('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting'][_0x070e('0x12')]({'where':{'id':_0x5dca0f[_0x070e('0x11')]['id']}})[_0x070e('0xa')](handleEntityNotFound(_0x24baba,null))[_0x070e('0xa')](saveUpdates(_0x5dca0f['body'],null))['then'](respondWithResult(_0x24baba,null))[_0x070e('0x13')](handleError(_0x24baba,null));}; \ No newline at end of file +var _0x9f75=['register','defaults','status','json','then','stack','name','send','update','user','role','Invalid\x20user\x20setting\x20id','find','params','body','catch','lodash','../../config/logger','api','socket.io-emitter','redis','./user-setting.socket'];(function(_0x9468f4,_0x34f4b7){var _0x11d27d=function(_0x22be17){while(--_0x22be17){_0x9468f4['push'](_0x9468f4['shift']());}};_0x11d27d(++_0x34f4b7);}(_0x9f75,0x15a));var _0x59f7=function(_0x5e32f9,_0x5bb66c){_0x5e32f9=_0x5e32f9-0x0;var _0x1e98ad=_0x9f75[_0x5e32f9];return _0x1e98ad;};'use strict';var _=require(_0x59f7('0x0'));var Redis=require('ioredis');var logger=require(_0x59f7('0x1'))(_0x59f7('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x59f7('0x3'))(new Redis(config[_0x59f7('0x4')]));require(_0x59f7('0x5'))[_0x59f7('0x6')](socket);config['redis']=_[_0x59f7('0x7')](config[_0x59f7('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x5483bc,_0xeb6d1e){_0xeb6d1e=_0xeb6d1e||0xc8;return function(_0x15903b){if(_0x15903b){return _0x5483bc[_0x59f7('0x8')](_0xeb6d1e)[_0x59f7('0x9')](_0x15903b);}};}function saveUpdates(_0x33bfc3){return function(_0x2c0fac){if(_0x2c0fac){return _0x2c0fac['update'](_0x33bfc3)[_0x59f7('0xa')](function(_0xdc23c7){return _0xdc23c7;});}return null;};}function handleEntityNotFound(_0x296a8d){return function(_0x2db28a){if(!_0x2db28a){_0x296a8d['sendStatus'](0x194);}return _0x2db28a;};}function handleError(_0x41b739,_0x4d345b){_0x4d345b=_0x4d345b||0x1f4;return function(_0x15a74d){logger['error'](_0x15a74d[_0x59f7('0xb')]);if(_0x15a74d[_0x59f7('0xc')]){delete _0x15a74d['name'];}_0x41b739['status'](_0x4d345b)[_0x59f7('0xd')](_0x15a74d);};}exports[_0x59f7('0xe')]=function(_0x2c75a2,_0x328bc5){if(_0x2c75a2[_0x59f7('0xf')][_0x59f7('0x10')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x2c75a2['params']['id'])))throw new Error(_0x59f7('0x11'));return db['UserSetting'][_0x59f7('0x12')]({'where':{'id':_0x2c75a2[_0x59f7('0x13')]['id']}})[_0x59f7('0xa')](handleEntityNotFound(_0x328bc5,null))[_0x59f7('0xa')](saveUpdates(_0x2c75a2[_0x59f7('0x14')],null))[_0x59f7('0xa')](respondWithResult(_0x328bc5,null))[_0x59f7('0x15')](handleError(_0x328bc5,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 5f3ecfc..03ce959 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 _0x061e=['../../mysqldb','UserSetting','setMaxListeners','save','hook','events'];(function(_0x23e073,_0x514e51){var _0x2cc915=function(_0x48baa2){while(--_0x48baa2){_0x23e073['push'](_0x23e073['shift']());}};_0x2cc915(++_0x514e51);}(_0x061e,0xc5));var _0xe061=function(_0x1f0fbb,_0x4ff5c0){_0x1f0fbb=_0x1f0fbb-0x0;var _0x44b0bd=_0x061e[_0x1f0fbb];return _0x44b0bd;};'use strict';var EventEmitter=require(_0xe061('0x0'));var UserSetting=require(_0xe061('0x1'))['db'][_0xe061('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe061('0x3')](0x0);var events={'afterCreate':_0xe061('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f7727){return function(_0x36f2d0,_0x5eec38,_0x5db778){UserSettingEvents['emit'](_0x2f7727+':'+_0x36f2d0['id'],_0x36f2d0);UserSettingEvents['emit'](_0x2f7727,_0x36f2d0);_0x5db778(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xe061('0x5')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x9bfa=['hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bfa,0x197));var _0xa9bf=function(_0x664b04,_0x2d1487){_0x664b04=_0x664b04-0x0;var _0x4687bc=_0x9bfa[_0x664b04];return _0x4687bc;};'use strict';var EventEmitter=require(_0xa9bf('0x0'));var UserSetting=require(_0xa9bf('0x1'))['db'][_0xa9bf('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa9bf('0x3')](0x0);var events={'afterCreate':_0xa9bf('0x4'),'afterUpdate':_0xa9bf('0x5'),'afterDestroy':_0xa9bf('0x6')};function emitEvent(_0x3ecc72){return function(_0x1e7891,_0x1b07da,_0x186dda){UserSettingEvents['emit'](_0x3ecc72+':'+_0x1e7891['id'],_0x1e7891);UserSettingEvents['emit'](_0x3ecc72,_0x1e7891);_0x186dda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xa9bf('0x7')](e,emitEvent(event));}}module[_0xa9bf('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 329fc19..ec67c48 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 _0xefe2=['UserSetting','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x4503f6,_0x3babaf){var _0x2277d1=function(_0x1c005a){while(--_0x1c005a){_0x4503f6['push'](_0x4503f6['shift']());}};_0x2277d1(++_0x3babaf);}(_0xefe2,0xd9));var _0x2efe=function(_0x2f5100,_0x565cbe){_0x2f5100=_0x2f5100-0x0;var _0x40c4bc=_0xefe2[_0x2f5100];return _0x40c4bc;};'use strict';var attributes=require(_0x2efe('0x0'));module[_0x2efe('0x1')]=function(_0x521ca2){return _0x521ca2[_0x2efe('0x2')](_0x2efe('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x166a8e){if(!_0x166a8e['clientSideLoggingEnabled'])_0x166a8e[_0x2efe('0x4')]=null;else if(_0x166a8e[_0x2efe('0x4')]===null)_0x166a8e[_0x2efe('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x9000=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x4a5357,_0x519565){var _0x309139=function(_0x57d8e8){while(--_0x57d8e8){_0x4a5357['push'](_0x4a5357['shift']());}};_0x309139(++_0x519565);}(_0x9000,0x19e));var _0x0900=function(_0x1defb2,_0x429099){_0x1defb2=_0x1defb2-0x0;var _0xad8973=_0x9000[_0x1defb2];return _0xad8973;};'use strict';var attributes=require(_0x0900('0x0'));module[_0x0900('0x1')]=function(_0x562f46){return _0x562f46[_0x0900('0x2')](_0x0900('0x3'),attributes,{'tableName':_0x0900('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f1b03){if(!_0x3f1b03[_0x0900('0x5')])_0x3f1b03[_0x0900('0x6')]=null;else if(_0x3f1b03[_0x0900('0x6')]===null)_0x3f1b03[_0x0900('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 117d713..d199f7f 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 _0x9e8e=['UserId','register','user-setting:','./user-setting.events','save','remove','update','user-setting:update','emit','user-setting:update:user-'];(function(_0x3273ed,_0x45f1b0){var _0x63512b=function(_0x324527){while(--_0x324527){_0x3273ed['push'](_0x3273ed['shift']());}};_0x63512b(++_0x45f1b0);}(_0x9e8e,0x16b));var _0xe9e8=function(_0x5da2d1,_0x4bd038){_0x5da2d1=_0x5da2d1-0x0;var _0x19654c=_0x9e8e[_0x5da2d1];return _0x19654c;};'use strict';var UserSettingEvents=require(_0xe9e8('0x0'));var events=[_0xe9e8('0x1'),_0xe9e8('0x2'),_0xe9e8('0x3')];function createListener(_0xc54954,_0x28485b){return function(_0x1e865a){_0x28485b['emit'](_0xc54954,_0x1e865a);if(_0xc54954===_0xe9e8('0x4')){_0x28485b[_0xe9e8('0x5')](_0xe9e8('0x6')+_0x1e865a[_0xe9e8('0x7')],_0x1e865a);}};}exports[_0xe9e8('0x8')]=function(_0x3338f3){for(var _0x28593e=0x0,_0x33b93c=events['length'];_0x28593e<_0x33b93c;_0x28593e++){var _0x1d5975=events[_0x28593e];var _0x37c151=createListener(_0xe9e8('0x9')+_0x1d5975,_0x3338f3);UserSettingEvents['on'](_0x1d5975,_0x37c151);}}; \ No newline at end of file +var _0x5d8d=['remove','emit','user-setting:update','user-setting:update:user-','length','user-setting:','./user-setting.events','save'];(function(_0x3e618a,_0x135251){var _0x1f3d61=function(_0x12131b){while(--_0x12131b){_0x3e618a['push'](_0x3e618a['shift']());}};_0x1f3d61(++_0x135251);}(_0x5d8d,0x166));var _0xd5d8=function(_0x23ff41,_0x5bf151){_0x23ff41=_0x23ff41-0x0;var _0x2ff0c9=_0x5d8d[_0x23ff41];return _0x2ff0c9;};'use strict';var UserSettingEvents=require(_0xd5d8('0x0'));var events=[_0xd5d8('0x1'),_0xd5d8('0x2'),'update'];function createListener(_0x21bc70,_0x3aaa8b){return function(_0x54d26c){_0x3aaa8b[_0xd5d8('0x3')](_0x21bc70,_0x54d26c);if(_0x21bc70===_0xd5d8('0x4')){_0x3aaa8b[_0xd5d8('0x3')](_0xd5d8('0x5')+_0x54d26c['UserId'],_0x54d26c);}};}exports['register']=function(_0x5d69f1){for(var _0x5c0122=0x0,_0x21c868=events[_0xd5d8('0x6')];_0x5c0122<_0x21c868;_0x5c0122++){var _0x27626a=events[_0x5c0122];var _0x4e3782=createListener(_0xd5d8('0x7')+_0x27626a,_0x5d69f1);UserSettingEvents['on'](_0x27626a,_0x4e3782);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8ab4f41..c5ddab5 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 _0xaa56=['removeTeams','destroy','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','util','path','express','Router','../../components/auth/service','./user.controller','get','isAuthenticated','index','describe','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getAgents','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','post','addContacts','create','/create_many','join','root','server/files/images/','format','%s-%s','now','originalname','single','/:id/login','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','put','delete','removeQueues'];(function(_0x3c700f,_0x48b424){var _0x95ee6c=function(_0x24d818){while(--_0x24d818){_0x3c700f['push'](_0x3c700f['shift']());}};_0x95ee6c(++_0x48b424);}(_0xaa56,0x1ac));var _0x6aa5=function(_0x194696,_0x550819){_0x194696=_0x194696-0x0;var _0x5410cf=_0xaa56[_0x194696];return _0x5410cf;};'use strict';var multer=require('multer');var util=require(_0x6aa5('0x0'));var path=require(_0x6aa5('0x1'));var timeout=require('connect-timeout');var express=require(_0x6aa5('0x2'));var router=express[_0x6aa5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6aa5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6aa5('0x5'));router[_0x6aa5('0x6')]('/',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6aa5('0x9')]);router[_0x6aa5('0x6')]('/whoami',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0xa')]);router[_0x6aa5('0x6')](_0x6aa5('0xb'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0xc')]);router[_0x6aa5('0x6')](_0x6aa5('0xd'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0xe')]);router[_0x6aa5('0x6')]('/:id/avatar',controller[_0x6aa5('0xf')]);router[_0x6aa5('0x6')](_0x6aa5('0x10'),auth['isAuthenticated'](),controller[_0x6aa5('0x11')]);router[_0x6aa5('0x6')](_0x6aa5('0x12'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x13')]);router[_0x6aa5('0x6')](_0x6aa5('0x14'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x15')]);router['get'](_0x6aa5('0x16'),auth['isAuthenticated'](),controller[_0x6aa5('0x17')]);router[_0x6aa5('0x6')]('/:id/groups',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x18')]);router['get'](_0x6aa5('0x19'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x1a')]);router[_0x6aa5('0x6')](_0x6aa5('0x1b'),auth['isAuthenticated'](),controller[_0x6aa5('0x1c')]);router[_0x6aa5('0x6')](_0x6aa5('0x1d'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x1e')]);router[_0x6aa5('0x6')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x6aa5('0x6')]('/:id/mail/interactions',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x1f')]);router['get'](_0x6aa5('0x20'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x21')]);router[_0x6aa5('0x6')]('/:id/fax/interactions',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x22')]);router[_0x6aa5('0x6')](_0x6aa5('0x23'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x24')]);router[_0x6aa5('0x6')](_0x6aa5('0x25'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6aa5('0x6')](_0x6aa5('0x26'),auth['isAuthenticated'](),controller['getLists']);router[_0x6aa5('0x6')]('/:id/agents',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x27')]);router[_0x6aa5('0x6')]('/:id/prefixes',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x28')]);router['get'](_0x6aa5('0x29'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x2a')]);router[_0x6aa5('0x6')](_0x6aa5('0x2b'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x2c')]);router[_0x6aa5('0x6')](_0x6aa5('0x2d'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x2e')]);router[_0x6aa5('0x6')](_0x6aa5('0x2f'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x30')]);router[_0x6aa5('0x6')](_0x6aa5('0x31'),auth['isAuthenticated'](),controller[_0x6aa5('0x32')]);router['get'](_0x6aa5('0x33'),auth[_0x6aa5('0x7')](),controller['getWhatsappAccounts']);router[_0x6aa5('0x6')](_0x6aa5('0x34'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x35')]);router[_0x6aa5('0x6')](_0x6aa5('0x36'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x6aa5('0x37')](_0x6aa5('0x12'),auth['isAuthenticated'](),controller[_0x6aa5('0x38')]);router[_0x6aa5('0x37')]('/',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x39')]);router[_0x6aa5('0x37')](_0x6aa5('0x3a'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x6aa5('0x37')](_0x6aa5('0x14'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d8494,_0x3dbafe,_0x2ed47f){_0x2ed47f(null,path[_0x6aa5('0x3b')](config[_0x6aa5('0x3c')],_0x6aa5('0x3d')));},'filename':function(_0x127e2f,_0x40f811,_0x2bc7cf){_0x2bc7cf(null,util[_0x6aa5('0x3e')](_0x6aa5('0x3f'),Date[_0x6aa5('0x40')](),_0x40f811[_0x6aa5('0x41')]));}})});router[_0x6aa5('0x37')]('/:id/avatar',upload[_0x6aa5('0x42')]('file'),controller['addAvatar']);router[_0x6aa5('0x37')](_0x6aa5('0x43'),auth['isAuthenticated'](),controller['login']);router['post']('/:id/logout',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x44')]);router[_0x6aa5('0x37')]('/:id/pause',auth[_0x6aa5('0x7')](),controller['pause']);router[_0x6aa5('0x37')](_0x6aa5('0x45'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x46')]);router[_0x6aa5('0x37')](_0x6aa5('0x25'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x47')]);router[_0x6aa5('0x37')](_0x6aa5('0x48'),auth['isAuthenticated'](),controller[_0x6aa5('0x49')]);router[_0x6aa5('0x37')](_0x6aa5('0x4a'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x4b')]);router[_0x6aa5('0x37')](_0x6aa5('0x4c'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x4d')]);router[_0x6aa5('0x37')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x6aa5('0x4e')]);router[_0x6aa5('0x37')]('/:id/openchannel_interactions',auth[_0x6aa5('0x7')](),controller['addOpenchannelInteractions']);router['post']('/:id/whatsapp_interactions',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x4f')]);router[_0x6aa5('0x37')](_0x6aa5('0x29'),auth[_0x6aa5('0x7')](),controller['addFaxAccounts']);router[_0x6aa5('0x37')]('/:id/mail_accounts',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x50')]);router[_0x6aa5('0x37')](_0x6aa5('0x2d'),auth[_0x6aa5('0x7')](),controller['addOpenchannelAccounts']);router[_0x6aa5('0x37')](_0x6aa5('0x2f'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x51')]);router['post'](_0x6aa5('0x31'),auth[_0x6aa5('0x7')](),controller['addChatWebsites']);router[_0x6aa5('0x37')](_0x6aa5('0x33'),auth['isAuthenticated'](),controller[_0x6aa5('0x52')]);router[_0x6aa5('0x37')](_0x6aa5('0x36'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x53')]);router['put'](_0x6aa5('0xd'),auth[_0x6aa5('0x7')](),controller['update']);router[_0x6aa5('0x54')]('/:id/password',auth[_0x6aa5('0x7')](),controller['changePassword']);router[_0x6aa5('0x55')](_0x6aa5('0x14'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x56')]);router[_0x6aa5('0x55')](_0x6aa5('0x25'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x57')]);router[_0x6aa5('0x55')](_0x6aa5('0xd'),auth['isAuthenticated'](),controller[_0x6aa5('0x58')]);router[_0x6aa5('0x55')](_0x6aa5('0x48'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x59')]);router[_0x6aa5('0x55')]('/:id/mail_interactions',auth[_0x6aa5('0x7')](),controller['removeMailInteractions']);router[_0x6aa5('0x55')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x6aa5('0x5a')]);router[_0x6aa5('0x55')](_0x6aa5('0x5b'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x5c')]);router['delete'](_0x6aa5('0x5d'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x5e')]);router[_0x6aa5('0x55')](_0x6aa5('0x5f'),auth[_0x6aa5('0x7')](),controller['removeWhatsappInteractions']);router[_0x6aa5('0x55')](_0x6aa5('0x29'),auth['isAuthenticated'](),controller[_0x6aa5('0x60')]);router[_0x6aa5('0x55')](_0x6aa5('0x2b'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x61')]);router[_0x6aa5('0x55')](_0x6aa5('0x2d'),auth[_0x6aa5('0x7')](),controller['removeOpenchannelAccounts']);router[_0x6aa5('0x55')](_0x6aa5('0x2f'),auth[_0x6aa5('0x7')](),controller['removeSmsAccounts']);router[_0x6aa5('0x55')]('/:id/chat_websites',auth[_0x6aa5('0x7')](),controller['removeChatWebsites']);router[_0x6aa5('0x55')](_0x6aa5('0x33'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x62')]);router['delete']('/:id/api_key',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x63')]);router[_0x6aa5('0x37')](_0x6aa5('0x64'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x65')]);module[_0x6aa5('0x66')]=router; \ No newline at end of file +var _0xbafd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./user.controller','isAuthenticated','index','get','describe','/whoami','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','/:id/api_key','post','/:id/contacts','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','now','file','/:id/login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','/:id/password','changePassword','/:id/queues','removeQueues','removeTeams','delete','destroy','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','messengerSoundNotification','exports','util','path'];(function(_0x2d8e66,_0x5dd3e9){var _0x36c90f=function(_0x1ecc4e){while(--_0x1ecc4e){_0x2d8e66['push'](_0x2d8e66['shift']());}};_0x36c90f(++_0x5dd3e9);}(_0xbafd,0x69));var _0xdbaf=function(_0x1c42d5,_0x408e1f){_0x1c42d5=_0x1c42d5-0x0;var _0x33a149=_0xbafd[_0x1c42d5];return _0x33a149;};'use strict';var multer=require('multer');var util=require(_0xdbaf('0x0'));var path=require(_0xdbaf('0x1'));var timeout=require(_0xdbaf('0x2'));var express=require(_0xdbaf('0x3'));var router=express[_0xdbaf('0x4')]();var fs_extra=require(_0xdbaf('0x5'));var auth=require(_0xdbaf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdbaf('0x7'));router['get']('/',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x9')]);router[_0xdbaf('0xa')]('/describe',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0xb')]);router[_0xdbaf('0xa')](_0xdbaf('0xc'),auth[_0xdbaf('0x8')](),controller['whoami']);router[_0xdbaf('0xa')]('/presence',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0xd')]);router[_0xdbaf('0xa')](_0xdbaf('0xe'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0xf')]);router[_0xdbaf('0xa')](_0xdbaf('0x10'),controller['getAvatar']);router[_0xdbaf('0xa')](_0xdbaf('0x11'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x12')]);router['get']('/:id/contacts',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x13')]);router[_0xdbaf('0xa')]('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router[_0xdbaf('0xa')](_0xdbaf('0x14'),auth[_0xdbaf('0x8')](),controller['getVoiceQueuesRt']);router[_0xdbaf('0xa')](_0xdbaf('0x15'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x16')]);router[_0xdbaf('0xa')](_0xdbaf('0x17'),auth['isAuthenticated'](),controller[_0xdbaf('0x18')]);router['get']('/:id/screen_recordings',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x19')]);router['get']('/:id/chat/interactions',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x1a')]);router[_0xdbaf('0xa')](_0xdbaf('0x1b'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x1c')]);router[_0xdbaf('0xa')](_0xdbaf('0x1d'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x1e')]);router['get'](_0xdbaf('0x1f'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x20')]);router[_0xdbaf('0xa')](_0xdbaf('0x21'),auth['isAuthenticated'](),controller[_0xdbaf('0x22')]);router[_0xdbaf('0xa')]('/:id/whatsapp/interactions',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x23')]);router['get'](_0xdbaf('0x24'),auth['isAuthenticated'](),controller[_0xdbaf('0x25')]);router['get'](_0xdbaf('0x26'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x27')]);router[_0xdbaf('0xa')](_0xdbaf('0x28'),auth['isAuthenticated'](),controller[_0xdbaf('0x29')]);router[_0xdbaf('0xa')]('/:id/prefixes',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x2a')]);router[_0xdbaf('0xa')](_0xdbaf('0x2b'),auth[_0xdbaf('0x8')](),controller['getFaxAccounts']);router[_0xdbaf('0xa')](_0xdbaf('0x2c'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x2d')]);router[_0xdbaf('0xa')](_0xdbaf('0x2e'),auth['isAuthenticated'](),controller[_0xdbaf('0x2f')]);router[_0xdbaf('0xa')](_0xdbaf('0x30'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x31')]);router[_0xdbaf('0xa')](_0xdbaf('0x32'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x33')]);router[_0xdbaf('0xa')](_0xdbaf('0x34'),auth[_0xdbaf('0x8')](),controller['getWhatsappAccounts']);router[_0xdbaf('0xa')](_0xdbaf('0x35'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0xdbaf('0xa')](_0xdbaf('0x36'),auth[_0xdbaf('0x8')](),controller['getApiKey']);router[_0xdbaf('0x37')](_0xdbaf('0x38'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x39')]);router[_0xdbaf('0x37')]('/',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x3a')]);router[_0xdbaf('0x37')]('/create_many',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x3b')]);router[_0xdbaf('0x37')]('/:id/queues',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x3c')]);var upload=multer({'storage':multer[_0xdbaf('0x3d')]({'destination':function(_0x2fa9ac,_0xb2f2a4,_0x18cb3d){_0x18cb3d(null,path[_0xdbaf('0x3e')](config[_0xdbaf('0x3f')],_0xdbaf('0x40')));},'filename':function(_0x2b2f6f,_0x17ee92,_0x34d0bb){_0x34d0bb(null,util['format']('%s-%s',Date[_0xdbaf('0x41')](),_0x17ee92['originalname']));}})});router[_0xdbaf('0x37')](_0xdbaf('0x10'),upload['single'](_0xdbaf('0x42')),controller['addAvatar']);router[_0xdbaf('0x37')](_0xdbaf('0x43'),auth[_0xdbaf('0x8')](),controller['login']);router[_0xdbaf('0x37')](_0xdbaf('0x44'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x45')]);router['post']('/:id/pause',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x46')]);router[_0xdbaf('0x37')](_0xdbaf('0x47'),auth[_0xdbaf('0x8')](),controller['unpause']);router['post'](_0xdbaf('0x24'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x48')]);router[_0xdbaf('0x37')](_0xdbaf('0x49'),auth['isAuthenticated'](),controller[_0xdbaf('0x4a')]);router[_0xdbaf('0x37')]('/:id/mail_interactions',auth[_0xdbaf('0x8')](),controller['addMailInteractions']);router[_0xdbaf('0x37')](_0xdbaf('0x4b'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x4c')]);router[_0xdbaf('0x37')](_0xdbaf('0x4d'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xdbaf('0x37')]('/:id/openchannel_interactions',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x4e')]);router[_0xdbaf('0x37')]('/:id/whatsapp_interactions',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x4f')]);router[_0xdbaf('0x37')](_0xdbaf('0x2b'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x50')]);router[_0xdbaf('0x37')](_0xdbaf('0x2c'),auth['isAuthenticated'](),controller[_0xdbaf('0x51')]);router[_0xdbaf('0x37')](_0xdbaf('0x2e'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x52')]);router[_0xdbaf('0x37')](_0xdbaf('0x30'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x53')]);router['post']('/:id/chat_websites',auth[_0xdbaf('0x8')](),controller['addChatWebsites']);router[_0xdbaf('0x37')]('/:id/whatsapp_accounts',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x54')]);router[_0xdbaf('0x37')](_0xdbaf('0x36'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x55')]);router['put'](_0xdbaf('0xe'),auth[_0xdbaf('0x8')](),controller['update']);router['put'](_0xdbaf('0x56'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x57')]);router['delete'](_0xdbaf('0x58'),auth['isAuthenticated'](),controller[_0xdbaf('0x59')]);router['delete'](_0xdbaf('0x24'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x5a')]);router[_0xdbaf('0x5b')]('/:id',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x5c')]);router[_0xdbaf('0x5b')](_0xdbaf('0x49'),auth[_0xdbaf('0x8')](),controller['removeChatInteractions']);router['delete'](_0xdbaf('0x5d'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x5e')]);router[_0xdbaf('0x5b')]('/:id/fax_interactions',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x5f')]);router['delete']('/:id/sms_interactions',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x60')]);router['delete'](_0xdbaf('0x61'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x62')]);router[_0xdbaf('0x5b')](_0xdbaf('0x63'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x64')]);router[_0xdbaf('0x5b')](_0xdbaf('0x2b'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x65')]);router[_0xdbaf('0x5b')](_0xdbaf('0x2c'),auth[_0xdbaf('0x8')](),controller['removeMailAccounts']);router['delete'](_0xdbaf('0x2e'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x66')]);router[_0xdbaf('0x5b')](_0xdbaf('0x30'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x67')]);router[_0xdbaf('0x5b')](_0xdbaf('0x32'),auth[_0xdbaf('0x8')](),controller['removeChatWebsites']);router[_0xdbaf('0x5b')](_0xdbaf('0x34'),auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x68')]);router['delete'](_0xdbaf('0x36'),auth[_0xdbaf('0x8')](),controller['removeApiKey']);router[_0xdbaf('0x37')]('/:id/messengerSoundNotification',auth[_0xdbaf('0x8')](),controller[_0xdbaf('0x69')]);module[_0xdbaf('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index cb07a0e..73d4265 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 _0xd1cc=['getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','split','rfc2833','info','shortinfo','auto','nonat','outgoing','yes','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]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','active','actpass','showWebBar','get','isArray','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','transport','wss','encryption','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>'];(function(_0x2d24ab,_0x431d00){var _0x22bc9f=function(_0x3b5d19){while(--_0x3b5d19){_0x2d24ab['push'](_0x2d24ab['shift']());}};_0x22bc9f(++_0x431d00);}(_0xd1cc,0x1ba));var _0xcd1c=function(_0x5a5035,_0x55a45c){_0x5a5035=_0x5a5035-0x0;var _0x55b8d2=_0xd1cc[_0x5a5035];return _0x55b8d2;};'use strict';var Sequelize=require(_0xcd1c('0x0'));var moment=require(_0xcd1c('0x1'));var util=require(_0xcd1c('0x2'));var _=require(_0xcd1c('0x3'));module[_0xcd1c('0x4')]={'name':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x160194){this[_0xcd1c('0x6')](_0xcd1c('0x7'),_0x160194);this['setDataValue'](_0xcd1c('0x8'),_0x160194);},'comment':_0xcd1c('0x9')},'fullname':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'set':function(_0x3ee824){this[_0xcd1c('0x6')](_0xcd1c('0xa'),_0x3ee824);this['setDataValue']('callerid',util[_0xcd1c('0xb')](_0xcd1c('0xc'),_0x3ee824,this[_0xcd1c('0xd')](_0xcd1c('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x172360){if(_0x172360){this[_0xcd1c('0x6')](_0xcd1c('0xf'),_0x172360[_0xcd1c('0x10')]());}}},'role':{'type':Sequelize[_0xcd1c('0x11')]('admin',_0xcd1c('0x12'),_0xcd1c('0x13'),_0xcd1c('0x14')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':![],'unique':_0xcd1c('0xe'),'set':function(_0x472a45){this['setDataValue']('internal',_0x472a45);this[_0xcd1c('0x6')](_0xcd1c('0x16'),_0x472a45);this[_0xcd1c('0x6')]('callerid',util[_0xcd1c('0xb')]('\x22%s\x22\x20<%s>',this[_0xcd1c('0xd')]('fullname'),_0x472a45));}},'salt':{'type':Sequelize[_0xcd1c('0x5')]},'phone':{'type':Sequelize[_0xcd1c('0x5')]},'mobile':{'type':Sequelize[_0xcd1c('0x5')]},'address':{'type':Sequelize[_0xcd1c('0x5')]},'zipcode':{'type':Sequelize[_0xcd1c('0x5')]},'userpic':{'type':Sequelize[_0xcd1c('0x5')]},'city':{'type':Sequelize[_0xcd1c('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xcd1c('0x18')]},'voicePause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xcd1c('0x5')],'defaultValue':_0xcd1c('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xcd1c('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xcd1c('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcd1c('0x1a')},'ipaddr':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xcd1c('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x1b'),_0xcd1c('0x12'),_0xcd1c('0x1c')),'allowNull':!![],'defaultValue':_0xcd1c('0x1b')},'context':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![],'defaultValue':_0xcd1c('0x1d')},'callingpres':{'type':Sequelize['ENUM'](_0xcd1c('0x1e'),'ALLOWED_PASSED_SCREEN',_0xcd1c('0x1f'),_0xcd1c('0x20'),_0xcd1c('0x21'),_0xcd1c('0x22'),_0xcd1c('0x23'),_0xcd1c('0x24')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![],'defaultValue':_0xcd1c('0x25'),'set':function(_0x24d05a){this[_0xcd1c('0x6')]('transport',_0x24d05a?_0x24d05a[_0xcd1c('0x26')](','):null);},'get':function(){return this[_0xcd1c('0xd')]('transport')?this['getDataValue']('transport')[_0xcd1c('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x28'),_0xcd1c('0x29'),_0xcd1c('0x2a'),'inband',_0xcd1c('0x2b')),'allowNull':!![],'defaultValue':_0xcd1c('0x28')},'directmedia':{'type':Sequelize[_0xcd1c('0x11')]('yes','no',_0xcd1c('0x2c'),'update',_0xcd1c('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x5c9b99){this['setDataValue'](_0xcd1c('0x2f'),_0x5c9b99?_0x5c9b99['join'](','):null);},'get':function(){return this[_0xcd1c('0xd')]('nat')?this[_0xcd1c('0xd')]('nat')[_0xcd1c('0x27')](','):null;},'comment':_0xcd1c('0x30')},'callgroup':{'type':Sequelize[_0xcd1c('0x5')]},'namedcallgroup':{'type':Sequelize[_0xcd1c('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xcd1c('0x5')]},'language':{'type':Sequelize[_0xcd1c('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'defaultValue':_0xcd1c('0x31'),'set':function(_0x175cd0){this['setDataValue'](_0xcd1c('0x32'),_0x175cd0?_0x175cd0[_0xcd1c('0x26')](';'):_0xcd1c('0x31'));},'get':function(){return this[_0xcd1c('0xd')](_0xcd1c('0x32'))?this[_0xcd1c('0xd')](_0xcd1c('0x32'))[_0xcd1c('0x27')](';'):null;},'comment':_0xcd1c('0x33')},'autoframing':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![],'set':function(_0x284a84){this[_0xcd1c('0x6')](_0xcd1c('0x34'),_0x284a84?_0x284a84[_0xcd1c('0x26')](','):null);},'get':function(){return this['getDataValue'](_0xcd1c('0x34'))?this[_0xcd1c('0xd')](_0xcd1c('0x34'))[_0xcd1c('0x27')](','):null;},'comment':_0xcd1c('0x35')},'trustrpid':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no',_0xcd1c('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcd1c('0x37')},'amaflags':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xcd1c('0x2e')},'busylevel':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xcd1c('0x11')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xcd1c('0x11')]('yes','no',_0xcd1c('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xcd1c('0x39'),_0xcd1c('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x3b'),_0xcd1c('0x3c')),'allowNull':!![],'defaultValue':_0xcd1c('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xcd1c('0x2e')},'keepalive':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xcd1c('0x11')]('yes','no','fingerprint',_0xcd1c('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x3e'),'passive',_0xcd1c('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xcd1c('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xcd1c('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xcd1c('0x18')]},'passwordResetAt':{'type':Sequelize[_0xcd1c('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0,'set':function(_0x2f1107){this[_0xcd1c('0x6')](_0xcd1c('0x40'),_0x2f1107);var _0x415cd8=this[_0xcd1c('0x41')]({'plain':!![]});switch(_0x2f1107){case 0x0:case 0x1:var _0x3fa8fc=_0x415cd8['transport']?_[_0xcd1c('0x42')](_0x415cd8['transport'])?_0x415cd8['transport']['join']():_0x415cd8['transport']:'udp';if(_0x3fa8fc==='wss'){_0x3fa8fc=_0xcd1c('0x25');}this[_0xcd1c('0x6')]('transport',_0x3fa8fc);this['setDataValue']('encryption','no');this[_0xcd1c('0x6')](_0xcd1c('0x43'),null);this['setDataValue'](_0xcd1c('0x44'),null);this[_0xcd1c('0x6')](_0xcd1c('0x45'),null);this[_0xcd1c('0x6')]('dtlsenable',null);this[_0xcd1c('0x6')](_0xcd1c('0x46'),null);this['setDataValue'](_0xcd1c('0x47'),null);this[_0xcd1c('0x6')](_0xcd1c('0x48'),null);this[_0xcd1c('0x6')]('dtlsprivatekey',null);this[_0xcd1c('0x6')](_0xcd1c('0x49'),'no');break;case 0x2:this[_0xcd1c('0x6')](_0xcd1c('0x4a'),_0xcd1c('0x4b'));this[_0xcd1c('0x6')](_0xcd1c('0x4c'),_0xcd1c('0x2e'));this[_0xcd1c('0x6')](_0xcd1c('0x43'),_0xcd1c('0x2e'));this[_0xcd1c('0x6')](_0xcd1c('0x44'),_0xcd1c('0x2e'));this['setDataValue'](_0xcd1c('0x45'),'yes');this[_0xcd1c('0x6')]('dtlsenable',_0xcd1c('0x2e'));this[_0xcd1c('0x6')](_0xcd1c('0x46'),'no');this['setDataValue'](_0xcd1c('0x47'),'actpass');this['setDataValue'](_0xcd1c('0x48'),_0x415cd8[_0xcd1c('0x48')]||_0xcd1c('0x4d'));this[_0xcd1c('0x6')]('dtlsprivatekey',_0x415cd8[_0xcd1c('0x4e')]||_0xcd1c('0x4f'));this[_0xcd1c('0x6')](_0xcd1c('0x49'),_0xcd1c('0x2e'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x357a0d){this['setDataValue']('permissions',_0x357a0d?_0x357a0d[_0xcd1c('0x26')](','):[]);},'get':function(){return this['getDataValue'](_0xcd1c('0x50'))?_[_0xcd1c('0x51')](this[_0xcd1c('0xd')](_0xcd1c('0x50'))[_0xcd1c('0x27')](','),function(_0x2132eb){return parseInt(_0x2132eb,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xcd1c('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xcd1c('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xcd1c('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xcd1c('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xcd1c('0x52')],'get':function(){return this['getDataValue'](_0xcd1c('0x53'))?this[_0xcd1c('0xd')](_0xcd1c('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xcd1c('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![],'set':function(_0x24d624){if(typeof _0x24d624===_0xcd1c('0x54')){var _0x3c75bd=_0x24d624==='1'?!![]:_0x24d624==='0'?![]:_0x24d624===_0xcd1c('0x55')?!![]:_0x24d624===_0xcd1c('0x56')?![]:![];this['setDataValue'](_0xcd1c('0x57'),_0x3c75bd);}else{this[_0xcd1c('0x6')](_0xcd1c('0x57'),_0x24d624);}}},'blocked':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![],'set':function(_0x3e524d){this[_0xcd1c('0x6')](_0xcd1c('0x58'),_0x3e524d);if(_0x3e524d===!![]){this[_0xcd1c('0x6')](_0xcd1c('0x59'),moment());this[_0xcd1c('0x6')]('loginAttempts',0x0);}else{this[_0xcd1c('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xcd1c('0x15')](0x5)[_0xcd1c('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbdc7=['true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','internal','email','ENUM','admin','agent','local','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','user','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','uac','uas','active','passive','actpass','update','update,nonat','TEXT','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsenable','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent'];(function(_0x4df721,_0x4b15d6){var _0x123b4d=function(_0x4f2fe5){while(--_0x4f2fe5){_0x4df721['push'](_0x4df721['shift']());}};_0x123b4d(++_0x4b15d6);}(_0xbdc7,0x1bf));var _0x7bdc=function(_0x193474,_0x5c2ece){_0x193474=_0x193474-0x0;var _0x419f71=_0xbdc7[_0x193474];return _0x419f71;};'use strict';var Sequelize=require(_0x7bdc('0x0'));var moment=require(_0x7bdc('0x1'));var util=require(_0x7bdc('0x2'));var _=require(_0x7bdc('0x3'));module[_0x7bdc('0x4')]={'name':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':![],'unique':_0x7bdc('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2b7194){this['setDataValue'](_0x7bdc('0x6'),_0x2b7194);this[_0x7bdc('0x7')](_0x7bdc('0x8'),_0x2b7194);},'comment':_0x7bdc('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3ede50){this[_0x7bdc('0x7')](_0x7bdc('0xa'),_0x3ede50);this[_0x7bdc('0x7')](_0x7bdc('0xb'),util['format']('\x22%s\x22\x20<%s>',_0x3ede50,this['getDataValue'](_0x7bdc('0xc'))));}},'alias':{'type':Sequelize[_0x7bdc('0x5')]},'email':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':![],'unique':_0x7bdc('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2dd303){if(_0x2dd303){this[_0x7bdc('0x7')](_0x7bdc('0xd'),_0x2dd303['toLowerCase']());}}},'role':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0xf'),'user',_0x7bdc('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x7bdc('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x7bdc('0xc'),'set':function(_0x33cbf9){this[_0x7bdc('0x7')](_0x7bdc('0xc'),_0x33cbf9);this[_0x7bdc('0x7')](_0x7bdc('0x12'),_0x33cbf9);this[_0x7bdc('0x7')](_0x7bdc('0xb'),util[_0x7bdc('0x13')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0x7bdc('0xa')),_0x33cbf9));}},'salt':{'type':Sequelize[_0x7bdc('0x5')]},'phone':{'type':Sequelize[_0x7bdc('0x5')]},'mobile':{'type':Sequelize[_0x7bdc('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x7bdc('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7bdc('0x5')]},'online':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x7bdc('0x15')]},'voicePause':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x7bdc('0x16')},'lastPauseAt':{'type':Sequelize[_0x7bdc('0x15')]},'chatCapacity':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x7bdc('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x7bdc('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![],'defaultValue':_0x7bdc('0x18')},'ipaddr':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x7bdc('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x19'),_0x7bdc('0x1a'),'peer'),'allowNull':!![],'defaultValue':_0x7bdc('0x19')},'context':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![],'defaultValue':_0x7bdc('0x1b')},'callingpres':{'type':Sequelize[_0x7bdc('0xe')]('ALLOWED_NOT_SCREENED',_0x7bdc('0x1c'),_0x7bdc('0x1d'),_0x7bdc('0x1e'),_0x7bdc('0x1f'),_0x7bdc('0x20'),_0x7bdc('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![],'defaultValue':_0x7bdc('0x22'),'set':function(_0x116dcd){this[_0x7bdc('0x7')](_0x7bdc('0x23'),_0x116dcd?_0x116dcd[_0x7bdc('0x24')](','):null);},'get':function(){return this[_0x7bdc('0x25')]('transport')?this[_0x7bdc('0x25')]('transport')[_0x7bdc('0x26')](','):null;},'comment':_0x7bdc('0x27')},'dtmfmode':{'type':Sequelize['ENUM'](_0x7bdc('0x28'),_0x7bdc('0x29'),_0x7bdc('0x2a'),'inband',_0x7bdc('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no',_0x7bdc('0x2d'),'update',_0x7bdc('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![],'defaultValue':_0x7bdc('0x2f'),'set':function(_0x2706c3){this[_0x7bdc('0x7')](_0x7bdc('0x30'),_0x2706c3?_0x2706c3[_0x7bdc('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x7bdc('0x30'))?this[_0x7bdc('0x25')](_0x7bdc('0x30'))[_0x7bdc('0x26')](','):null;},'comment':_0x7bdc('0x31')},'callgroup':{'type':Sequelize[_0x7bdc('0x5')]},'namedcallgroup':{'type':Sequelize[_0x7bdc('0x5')]},'pickupgroup':{'type':Sequelize[_0x7bdc('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7bdc('0x5')]},'disallow':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':![],'defaultValue':_0x7bdc('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7bdc('0x33'),'set':function(_0x224fd7){this[_0x7bdc('0x7')](_0x7bdc('0x34'),_0x224fd7?_0x224fd7['join'](';'):_0x7bdc('0x33'));},'get':function(){return this[_0x7bdc('0x25')](_0x7bdc('0x34'))?this[_0x7bdc('0x25')]('allow')[_0x7bdc('0x26')](';'):null;},'comment':_0x7bdc('0x35')},'autoframing':{'type':Sequelize[_0x7bdc('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![],'set':function(_0x153e7e){this[_0x7bdc('0x7')]('insecure',_0x153e7e?_0x153e7e[_0x7bdc('0x24')](','):null);},'get':function(){return this[_0x7bdc('0x25')](_0x7bdc('0x36'))?this['getDataValue']('insecure')[_0x7bdc('0x26')](','):null;},'comment':_0x7bdc('0x37')},'trustrpid':{'type':Sequelize['ENUM'](_0x7bdc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x7bdc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![],'defaultValue':_0x7bdc('0x38')},'amaflags':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x7bdc('0x2c')},'busylevel':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x7bdc('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x7bdc('0x2c'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x39'),_0x7bdc('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x3b'),_0x7bdc('0x3c')),'allowNull':!![],'defaultValue':_0x7bdc('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x7bdc('0x2c')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x3d'),_0x7bdc('0x3e'),_0x7bdc('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x7bdc('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x7bdc('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x7bdc('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no',_0x7bdc('0x2d'),_0x7bdc('0x40'),_0x7bdc('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x7bdc('0x15')]},'passwordResetAt':{'type':Sequelize[_0x7bdc('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x7bdc('0x42')]},'showWebBar':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0,'set':function(_0x4a1aa0){this[_0x7bdc('0x7')]('showWebBar',_0x4a1aa0);var _0x47e690=this['get']({'plain':!![]});switch(_0x4a1aa0){case 0x0:case 0x1:var _0x3e6b3b=_0x47e690[_0x7bdc('0x23')]?_['isArray'](_0x47e690[_0x7bdc('0x23')])?_0x47e690['transport'][_0x7bdc('0x24')]():_0x47e690[_0x7bdc('0x23')]:_0x7bdc('0x22');if(_0x3e6b3b===_0x7bdc('0x43')){_0x3e6b3b=_0x7bdc('0x22');}this[_0x7bdc('0x7')](_0x7bdc('0x23'),_0x3e6b3b);this[_0x7bdc('0x7')](_0x7bdc('0x44'),'no');this[_0x7bdc('0x7')](_0x7bdc('0x45'),null);this[_0x7bdc('0x7')](_0x7bdc('0x46'),null);this[_0x7bdc('0x7')](_0x7bdc('0x47'),null);this[_0x7bdc('0x7')]('dtlsenable',null);this[_0x7bdc('0x7')](_0x7bdc('0x48'),null);this['setDataValue'](_0x7bdc('0x49'),null);this[_0x7bdc('0x7')](_0x7bdc('0x4a'),null);this['setDataValue'](_0x7bdc('0x4b'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x7bdc('0x23'),_0x7bdc('0x43'));this['setDataValue'](_0x7bdc('0x44'),_0x7bdc('0x2c'));this[_0x7bdc('0x7')]('avpf',_0x7bdc('0x2c'));this[_0x7bdc('0x7')](_0x7bdc('0x46'),_0x7bdc('0x2c'));this[_0x7bdc('0x7')](_0x7bdc('0x47'),_0x7bdc('0x2c'));this[_0x7bdc('0x7')](_0x7bdc('0x4c'),_0x7bdc('0x2c'));this[_0x7bdc('0x7')](_0x7bdc('0x48'),'no');this[_0x7bdc('0x7')]('dtlssetup','actpass');this[_0x7bdc('0x7')](_0x7bdc('0x4a'),_0x47e690[_0x7bdc('0x4a')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x7bdc('0x4b'),_0x47e690[_0x7bdc('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x7bdc('0x7')](_0x7bdc('0x4d'),_0x7bdc('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x7bdc('0x42')],'set':function(_0x4b7a7f){this[_0x7bdc('0x7')]('permissions',_0x4b7a7f?_0x4b7a7f[_0x7bdc('0x24')](','):[]);},'get':function(){return this[_0x7bdc('0x25')](_0x7bdc('0x4e'))?_[_0x7bdc('0x4f')](this['getDataValue'](_0x7bdc('0x4e'))[_0x7bdc('0x26')](','),function(_0x5cda91){return parseInt(_0x5cda91,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x7bdc('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x7bdc('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x7bdc('0xe')](_0x7bdc('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x7bdc('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7bdc('0x25')](_0x7bdc('0x50'))?this[_0x7bdc('0x25')](_0x7bdc('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x7bdc('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x7bdc('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x264766){if(typeof _0x264766==='string'){var _0x26c7a3=_0x264766==='1'?!![]:_0x264766==='0'?![]:_0x264766===_0x7bdc('0x51')?!![]:_0x264766===_0x7bdc('0x52')?![]:![];this[_0x7bdc('0x7')](_0x7bdc('0x53'),_0x26c7a3);}else{this[_0x7bdc('0x7')](_0x7bdc('0x53'),_0x264766);}}},'blocked':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![],'set':function(_0x1eb414){this['setDataValue'](_0x7bdc('0x54'),_0x1eb414);if(_0x1eb414===!![]){this[_0x7bdc('0x7')]('blockedAt',moment());this[_0x7bdc('0x7')](_0x7bdc('0x55'),0x0);}else{this[_0x7bdc('0x7')](_0x7bdc('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x7bdc('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x7bdc('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x7bdc('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x7bdc('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 ca83a4a..075b48d 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 _0x736d=['all','show','params','merge','options','fax','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','VoiceMail','fullname','permissions','101','102','113','110','104','105','106','107','108','100','111','114','115','create','Unauthorized','userProfileId','UserProfileSection','Telephones','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','isEmpty','compact','changePassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','channel','online','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','interface','format','UserVoiceQueueRt','removeQueues','remove','Queue:remove','addAvatar','userpic','filename','getAvatar','join','root','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','Tags','tag','model','keys','Queue','rawAttributes','filters','intersection','fields','sort','get','Unknown\x20role','getVoiceQueuesRt','order','pick','getGroups','nolimit','getRecordings','VoiceRecording','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','UserId','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','LOGININPAUSE','logout','pause','QueuePause','getChannels','PAUSE','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','Team','addTeams','resolve','transaction','getAssociatedQueues','addAgent','getDataValue','Voice','upsert','UserVoicePrefix','removeTeams','isArray','flattenDeep','removeAgent','TeamVoicePrefix','VoicePrefixId','getLists','getAgents','getVoiceQueues','values','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$lt','$lte','$ne','$eq','$not','$notBetween','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','firstName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','unknown','ringing','queues','inbound','flatten','toString','lower','col','asc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','slice','charAt','toUpperCase','QueryTypes','select','field','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','squel','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APIForbiddenrror','handleError','socket.io-emitter','redis','localhost','status','end','offset','undefined','count','limit','Content-Range','json','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','role','agent','userNotification:recalc:','destroy','admin','Users','user','Agents','filter','ignore','value','find','name','stack','send','User','map','fieldName','type','password','salt','resetPasswordToken','resetPasswordExpires','index','getOptions','where','includeAll','query','userSetting','include','UserSetting','includes','attributes','push','findAll','rows','true','length','chat','dataValues','sms','mail','openchannel','whatsapp'];(function(_0x1090f4,_0xbb0d5f){var _0x141d87=function(_0x31d559){while(--_0x31d559){_0x1090f4['push'](_0x1090f4['shift']());}};_0x141d87(++_0xbb0d5f);}(_0x736d,0x142));var _0xd736=function(_0x389494,_0x4f820b){_0x389494=_0x389494-0x0;var _0x1e99d2=_0x736d[_0x389494];return _0x1e99d2;};'use strict';var moment=require(_0xd736('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0xd736('0x1'));var Redis=require(_0xd736('0x2'));var jayson=require(_0xd736('0x3'));var authService=require(_0xd736('0x4'));var contacts=require(_0xd736('0x5'));var qs=require(_0xd736('0x6'));var rta=require('../../components/realtime/agents');var logger=require('../../config/logger')(_0xd736('0x7'));var utils=require(_0xd736('0x8'));var config=require(_0xd736('0x9'));var licenseUtil=require(_0xd736('0xa'));var APIBadRequestError=require(_0xd736('0xb'))[_0xd736('0xc')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIForbiddenError=require(_0xd736('0xb'))[_0xd736('0xd')];var APIHandleError=require(_0xd736('0xb'))[_0xd736('0xe')];var db=require('../../mysqldb')['db'];var socket=require(_0xd736('0xf'))(new Redis(config[_0xd736('0x10')]));require('./user.socket')['register'](socket);config[_0xd736('0x10')]=_['defaults'](config['redis'],{'host':_0xd736('0x11'),'port':0x18eb});var amiClient=jayson['client']['http']({'port':0x232a});var values;function respondWithStatusCode(_0x328e3c,_0x2ee4fb){_0x2ee4fb=_0x2ee4fb||0xcc;return function(_0xa648a6){if(_0xa648a6){return _0x328e3c['sendStatus'](_0x2ee4fb);}return _0x328e3c[_0xd736('0x12')](_0x2ee4fb)[_0xd736('0x13')]();};}function respondWithResult(_0x1e4b4d,_0x3e9257){_0x3e9257=_0x3e9257||0xc8;return function(_0x115d55){if(_0x115d55){return _0x1e4b4d[_0xd736('0x12')](_0x3e9257)['json'](_0x115d55);}};}function respondWithFilteredResult(_0x4490de,_0xde6505){return function(_0xd3bb21){if(_0xd3bb21){var _0x565fd0=typeof _0xde6505[_0xd736('0x14')]===_0xd736('0x15')&&typeof _0xde6505['limit']===_0xd736('0x15');var _0x274e48=_0xd3bb21['count'];var _0x25ce08=_0x565fd0?0x0:_0xde6505[_0xd736('0x14')];var _0x299c98=_0x565fd0?_0xd3bb21[_0xd736('0x16')]:_0xde6505[_0xd736('0x14')]+_0xde6505[_0xd736('0x17')];var _0xea2678;if(_0x299c98>=_0x274e48){_0x299c98=_0x274e48;_0xea2678=0xc8;}else{_0xea2678=0xce;}_0x4490de[_0xd736('0x12')](_0xea2678);return _0x4490de['set'](_0xd736('0x18'),_0x25ce08+'-'+_0x299c98+'/'+_0x274e48)[_0xd736('0x19')](_0xd3bb21);}return null;};}function respondWithRpcPromise(_0x41d943,_0xbbae00,_0x3bd7e0,_0x3aa56f){return new Promise(function(_0x20b12e,_0x16e6b9){var _0x5a9953=_0x3aa56f||amiClient;return _0x5a9953[_0xd736('0x1a')](_0x41d943,_0x3bd7e0)[_0xd736('0x1b')](function(_0x5b313c){logger['info'](_0xd736('0x1c'),_0xbbae00,_0xd736('0x1d'));logger[_0xd736('0x1e')](_0xd736('0x1f'),_0xbbae00,'request\x20sent',JSON[_0xd736('0x20')](_0x5b313c));if(_0x5b313c[_0xd736('0x21')]){if(_0x5b313c[_0xd736('0x21')][_0xd736('0x22')]===0x1f4){logger['error'](_0xd736('0x1c'),_0xbbae00,_0x5b313c['error'][_0xd736('0x23')]);return _0x16e6b9(_0x5b313c['error'][_0xd736('0x23')]);}logger[_0xd736('0x21')](_0xd736('0x1c'),_0xbbae00,_0x5b313c['error'][_0xd736('0x23')]);return _0x20b12e(_0x5b313c[_0xd736('0x21')][_0xd736('0x23')]);}else{logger['info'](_0xd736('0x1c'),_0xbbae00,_0xd736('0x1d'));_0x20b12e(_0x5b313c[_0xd736('0x24')]['message']);}})[_0xd736('0x25')](function(_0x3c7057){logger[_0xd736('0x21')](_0xd736('0x1c'),_0xbbae00,_0x3c7057);_0x16e6b9(_0x3c7057);});});}function saveUpdates(_0x33c572){return function(_0x55b24d){if(_0x55b24d){return _0x55b24d[_0xd736('0x26')](_0x33c572)[_0xd736('0x1b')](function(_0x11c109){if(_0x11c109[_0xd736('0x27')]===_0xd736('0x28')){socket['emit'](_0xd736('0x29')+_0x11c109['id'],_0x11c109);}return _0x11c109;});}return null;};}function removeEntity(_0x489e79,_0x487748){return function(_0x585562){if(_0x585562){return _0x585562[_0xd736('0x2a')]({'transaction':_0x487748})[_0xd736('0x1b')](function(){var _0x17cfd9=_0x585562['get']({'plain':!![]});if(_0x17cfd9[_0xd736('0x27')]===_0xd736('0x2b'))return;var _0x18c440=[{'name':_0xd736('0x2c'),'value':_0xd736('0x2d'),'ignore':!![]},{'name':_0xd736('0x2e'),'value':_0xd736('0x28'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x450c52=_(_0x18c440)[_0xd736('0x2f')](_0xd736('0x30'))['map'](_0xd736('0x31'))[_0xd736('0x31')]();if(_['includes'](_0x450c52,_0x17cfd9[_0xd736('0x27')])){return;}var _0x3a99a2=_[_0xd736('0x32')](_0x18c440,[_0xd736('0x31'),_0x17cfd9['role']])[_0xd736('0x33')];return db['UserProfileResource'][_0xd736('0x2a')]({'where':{'type':_0x3a99a2,'resourceId':_0x17cfd9['id']},'transaction':_0x487748})[_0xd736('0x1b')](function(){return _0x585562;});})['then'](function(){_0x489e79['status'](0xcc)[_0xd736('0x13')]();});}};}function handleEntityNotFound(_0x561d55){return function(_0x5b988d){if(!_0x5b988d){_0x561d55['sendStatus'](0x194);}return _0x5b988d;};}function handleError(_0x4382b6,_0x225322){_0x225322=_0x225322||0x1f4;return function(_0x1419ae){logger[_0xd736('0x21')](_0x1419ae[_0xd736('0x34')]);if(_0x1419ae[_0xd736('0x33')]){delete _0x1419ae[_0xd736('0x33')];}_0x4382b6[_0xd736('0x12')](_0x225322)[_0xd736('0x35')](_0x1419ae);};}function getUserAttributes(){return _(db[_0xd736('0x36')]['rawAttributes'])[_0xd736('0x37')](function(_0xb0a552){return{'name':_0xb0a552[_0xd736('0x38')],'type':_0xb0a552[_0xd736('0x39')]['key']};})[_0xd736('0x2f')](function(_0x542c45){return![_0xd736('0x3a'),_0xd736('0x3b'),'previousPasswords',_0xd736('0x3c'),_0xd736('0x3d'),'md5secret']['includes'](_0x542c45[_0xd736('0x33')]);})[_0xd736('0x31')]();}exports[_0xd736('0x3e')]=function(_0xb360da,_0x5a36ae){var _0x539552={},_0x46491c={'count':0x0,'rows':[]};var _0x55dd80=getUserAttributes();_0x539552=qs[_0xd736('0x3f')](_0x55dd80,_0xb360da);var _0x81e5fd={'where':_0x539552[_0xd736('0x40')]};return db['User']['count'](_0x81e5fd)[_0xd736('0x1b')](function(_0x2e3a2c){_0x46491c[_0xd736('0x16')]=_0x2e3a2c;if(_0xb360da['query'][_0xd736('0x41')]){_0x539552['include']=[{'all':!![]}];}if(_0xb360da[_0xd736('0x42')][_0xd736('0x43')]==='true'){_0x539552[_0xd736('0x44')]=[{'model':db[_0xd736('0x45')],'as':_0xd736('0x43')}];}if(!_[_0xd736('0x46')](_0x539552[_0xd736('0x47')],'id')){_0x539552['attributes'][_0xd736('0x48')]('id');}return db[_0xd736('0x36')][_0xd736('0x49')](_0x539552);})['then'](function(_0x2583bc){_0x46491c[_0xd736('0x4a')]=_0x2583bc;if(_0xb360da[_0xd736('0x42')]['openTabs']===_0xd736('0x4b')){var _0x3e3bc9=[];for(var _0x41db2c=0x0;_0x41db2c<_0x46491c[_0xd736('0x4a')][_0xd736('0x4c')];_0x41db2c++){_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x4d'),_0x46491c[_0xd736('0x4a')][_0x41db2c][_0xd736('0x4e')]));_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x4f'),_0x46491c['rows'][_0x41db2c]['dataValues']));_0x3e3bc9[_0xd736('0x48')](get_open_tabs('fax',_0x46491c[_0xd736('0x4a')][_0x41db2c][_0xd736('0x4e')]));_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x50'),_0x46491c[_0xd736('0x4a')][_0x41db2c][_0xd736('0x4e')]));_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x51'),_0x46491c['rows'][_0x41db2c][_0xd736('0x4e')]));_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x52'),_0x46491c['rows'][_0x41db2c][_0xd736('0x4e')]));}return Promise[_0xd736('0x53')](_0x3e3bc9)[_0xd736('0x1b')](function(){return _0x46491c;});}else{return _0x46491c;}})[_0xd736('0x1b')](respondWithFilteredResult(_0x5a36ae,_0x539552))[_0xd736('0x25')](handleError(_0x5a36ae,null));};exports[_0xd736('0x54')]=function(_0x36afda,_0x5e303b){var _0x2ca81b=getUserAttributes();_0x36afda[_0xd736('0x42')]['id']=_0x36afda[_0xd736('0x55')]['id'];var _0x3a4b8d=qs[_0xd736('0x3f')](_0x2ca81b,_0x36afda);if(_0x36afda[_0xd736('0x42')][_0xd736('0x41')]){_0x3a4b8d[_0xd736('0x44')]=[{'all':!![]}];}if(_0x36afda[_0xd736('0x42')][_0xd736('0x43')]==='true'){_0x3a4b8d[_0xd736('0x44')]=[{'model':db[_0xd736('0x45')],'as':_0xd736('0x43')}];}_0x3a4b8d=_[_0xd736('0x56')]({},_0x3a4b8d,_0x36afda[_0xd736('0x57')]);if(!_[_0xd736('0x46')](_0x3a4b8d[_0xd736('0x47')],'id')){_0x3a4b8d['attributes'][_0xd736('0x48')]('id');}return db[_0xd736('0x36')]['find'](_0x3a4b8d)[_0xd736('0x1b')](handleEntityNotFound(_0x5e303b,null))['then'](function(_0x3300ce){var _0x324516=[];values=_0x3300ce;if(_0x36afda[_0xd736('0x42')]['openTabs']===_0xd736('0x4b')){_0x324516[_0xd736('0x48')](get_open_tabs(_0xd736('0x4d'),_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs('sms',_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs('openchannel',_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs('whatsapp',_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs(_0xd736('0x58'),_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs(_0xd736('0x50'),_0x3300ce[_0xd736('0x4e')]));return Promise[_0xd736('0x53')](_0x324516);}else{return values;}})[_0xd736('0x1b')](function(){return values;})[_0xd736('0x1b')](respondWithResult(_0x5e303b,null))['catch'](handleError(_0x5e303b,null));};exports[_0xd736('0x26')]=function(_0xcdb170,_0x2ab415){if(_0xcdb170[_0xd736('0x59')]['id']){delete _0xcdb170[_0xd736('0x59')]['id'];}delete _0xcdb170[_0xd736('0x59')]['role'];return db[_0xd736('0x36')][_0xd736('0x32')]({'where':{'id':_0xcdb170[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x2ab415,null))[_0xd736('0x1b')](saveUpdates(_0xcdb170[_0xd736('0x59')],null))[_0xd736('0x1b')](respondWithResult(_0x2ab415,null))[_0xd736('0x25')](handleError(_0x2ab415,null));};exports['describe']=function(_0xa3c017,_0x799ba){return db[_0xd736('0x36')][_0xd736('0x5a')]()[_0xd736('0x1b')](respondWithResult(_0x799ba,null))[_0xd736('0x25')](handleError(_0x799ba,null));};exports['addContacts']=function(_0x217513,_0x3256ea){return db[_0xd736('0x36')]['find']({'where':{'id':_0x217513[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x3256ea,null))[_0xd736('0x1b')](function(_0x36f393){if(_0x36f393){return _0x36f393[_0xd736('0x5b')](_0x217513[_0xd736('0x59')][_0xd736('0x5c')],_[_0xd736('0x5d')](_0x217513[_0xd736('0x59')],[_0xd736('0x5c'),'id'])||{});}})[_0xd736('0x1b')](respondWithResult(_0x3256ea,null))[_0xd736('0x25')](handleError(_0x3256ea,null));};function validateUser(_0x3ee138){return new Promise(function(_0x419975,_0x1d8e77){if(_0x3ee138[_0xd736('0x5e')])return _0x419975(_0x3ee138);return db[_0xd736('0x5f')][_0xd736('0x60')](0x1)[_0xd736('0x1b')](function(_0x5ab022){if(_0x5ab022[_0xd736('0x61')])authService[_0xd736('0x62')](_0x3ee138[_0xd736('0x3a')]);db[_0xd736('0x36')][_0xd736('0x63')](_0xd736('0x5e'))[_0xd736('0x1b')](function(_0x41ac1a){if(_[_0xd736('0x64')](_0x41ac1a)){_0x3ee138[_0xd736('0x5e')]=_0x5ab022[_0xd736('0x65')]||0x1;return;}if(_[_0xd736('0x64')](_0x5ab022[_0xd736('0x65')])||_0x5ab022[_0xd736('0x65')]===_0x41ac1a){_0x3ee138[_0xd736('0x5e')]=_0x41ac1a+0x1;return;}if(_0x5ab022[_0xd736('0x65')]>_0x41ac1a){_0x3ee138[_0xd736('0x5e')]=_0x5ab022[_0xd736('0x65')];return;}return db[_0xd736('0x66')][_0xd736('0x42')](_0xd736('0x67'),{'type':db[_0xd736('0x66')]['QueryTypes'][_0xd736('0x68')]})['then'](function(_0x464fe5){if(_0x464fe5&&_0x464fe5[_0xd736('0x4c')]){for(var _0x30fbf3=0x0,_0x23e298=_0x464fe5[_0xd736('0x4c')];_0x30fbf3<_0x23e298&&_[_0xd736('0x64')](_0x3ee138[_0xd736('0x5e')]);_0x30fbf3++){if(_0x5ab022[_0xd736('0x65')]<=_0x464fe5[_0x30fbf3][_0xd736('0x69')]){_0x3ee138[_0xd736('0x5e')]=_0x464fe5[_0x30fbf3][_0xd736('0x69')];}else if(_0x5ab022[_0xd736('0x65')]>_0x464fe5[_0x30fbf3][_0xd736('0x69')]&&_0x5ab022[_0xd736('0x65')]<=_0x464fe5[_0x30fbf3]['to']){_0x3ee138[_0xd736('0x5e')]=_0x5ab022['min_internal'];}}}if(_[_0xd736('0x64')](_0x3ee138[_0xd736('0x5e')])){_0x3ee138[_0xd736('0x5e')]=_0x41ac1a+0x1;}return _0x419975(_0x3ee138);});});})[_0xd736('0x25')](function(_0x5e794f){_0x1d8e77(_0x5e794f);});});}function updateUser(_0x1daf37){return new Promise(function(_0x2f830b,_0x590ee1){try{if(_0x1daf37[_0xd736('0x6a')]){_0x1daf37['mailbox']=_0x1daf37[_0xd736('0x5e')];_0x1daf37[_0xd736('0x6b')]={'mailbox':_0x1daf37['internal'],'password':_0x1daf37[_0xd736('0x3a')],'fullname':_0x1daf37[_0xd736('0x6c')],'email':_0x1daf37['email']};}if(_0x1daf37['role']===_0xd736('0x28')){if(!_0x1daf37['permissions'])_0x1daf37[_0xd736('0x6d')]=[_0xd736('0x6e'),_0xd736('0x6f'),'103',_0xd736('0x70'),_0xd736('0x71'),_0xd736('0x72'),_0xd736('0x73'),_0xd736('0x74'),_0xd736('0x75'),_0xd736('0x76'),'109',_0xd736('0x77'),_0xd736('0x78'),_0xd736('0x79'),_0xd736('0x7a')];}_0x2f830b(_0x1daf37);}catch(_0x4eea69){_0x590ee1(_0x4eea69);}});}exports[_0xd736('0x7b')]=function(_0x14a719,_0x3ecc00){if(_0x14a719[_0xd736('0x2d')]['role']==='agent')throw new Error(_0xd736('0x7c'));if(_0x14a719[_0xd736('0x59')][_0xd736('0x27')]===_0xd736('0x2d')&&_0x14a719[_0xd736('0x2d')][_0xd736('0x27')]!==_0xd736('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x14a719[_0xd736('0x59')]['role']===_0xd736('0x2b')&&_0x14a719[_0xd736('0x2d')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x14a719['body']])[_0xd736('0x1b')](function(){return validateUser(_0x14a719['body']);})[_0xd736('0x1b')](function(_0x2c5889){return updateUser(_0x2c5889)[_0xd736('0x1b')](function(_0x240ab9){if(_0x240ab9['role']==='admin'){_0x240ab9['settingsEnabled']=_0x14a719[_0xd736('0x2d')]['settingsEnabled'];delete _0x240ab9[_0xd736('0x7d')];}return _0x240ab9;});})[_0xd736('0x1b')](function(_0x2c6f98){return db[_0xd736('0x36')][_0xd736('0x7b')](_0x2c6f98,{'include':[{'model':db[_0xd736('0x6b')],'as':_0xd736('0x6b')}]});})['then'](function(_0x30c997){if(_0x14a719['body'][_0xd736('0x27')]===_0xd736('0x2d'))return _0x30c997;if(_0x14a719[_0xd736('0x2d')][_0xd736('0x27')]!==_0xd736('0x2d'))return _0x30c997;return db[_0xd736('0x7e')]['find']({'where':{'name':_0x30c997[_0xd736('0x27')]===_0xd736('0x28')?_0xd736('0x2e'):_0xd736('0x7f'),'userProfileId':_0x14a719[_0xd736('0x2d')][_0xd736('0x7d')]},'raw':!![]})[_0xd736('0x1b')](function(_0x4e6199){if(!_0x4e6199||_0x4e6199[_0xd736('0x80')]!=0x0)return _0x30c997;return db[_0xd736('0x81')][_0xd736('0x7b')]({'name':_0x30c997[_0xd736('0x33')],'resourceId':_0x30c997['id'],'type':_0x4e6199['name'],'sectionId':_0x4e6199['id']},{})[_0xd736('0x1b')](function(){return _0x30c997;});})[_0xd736('0x25')](function(_0x297f22){logger[_0xd736('0x21')](_0xd736('0x82'),_0x297f22);throw _0x297f22;});})[_0xd736('0x1b')](respondWithResult(_0x3ecc00,0xc9))['catch'](handleError(_0x3ecc00,null));};exports[_0xd736('0x83')]=function(_0x1b0791,_0x2e9bac){var _0x1c1db5=_0x1b0791[_0xd736('0x59')];var _0x16d33d=[];if(_0x1b0791[_0xd736('0x2d')][_0xd736('0x27')]===_0xd736('0x28'))throw new Error(_0xd736('0x7c'));if(_[_0xd736('0x84')](_0x1c1db5,['role','user'])&&_0x1b0791[_0xd736('0x2d')][_0xd736('0x27')]!==_0xd736('0x2b')){throw new Error(_0xd736('0x85'));}if(_['some'](_0x1c1db5,['role','admin'])&&_0x1b0791[_0xd736('0x2d')][_0xd736('0x27')]!=='admin'){throw new Error(_0xd736('0x86'));}return licenseUtil['checkUserLimits'](_0x1c1db5)['then'](function(){return validateUser(_0x1c1db5[0x0]);})['then'](function(){for(var _0x1e995f=0x1;_0x1e995f<_0x1c1db5[_0xd736('0x4c')];_0x1e995f++){var _0x39bf9a=_0x1c1db5[_0x1e995f-0x1][_0xd736('0x5e')];if(!_0x1c1db5[_0x1e995f]['internal'])_0x1c1db5[_0x1e995f]['internal']=_0x39bf9a+0x1;_0x16d33d['push'](validateUser(_0x1c1db5[_0x1e995f]));}return Promise['all'](_0x16d33d);})[_0xd736('0x1b')](function(){_0x16d33d=[];for(var _0x1434c7=0x0;_0x1434c7<_0x1c1db5[_0xd736('0x4c')];_0x1434c7++){_0x16d33d[_0xd736('0x48')](updateUser(_0x1c1db5[_0x1434c7]));}return Promise['all'](_0x16d33d);})[_0xd736('0x1b')](function(){_0x16d33d=_0x1c1db5[_0xd736('0x37')](function(_0xb3b8f5){return db[_0xd736('0x36')][_0xd736('0x7b')](_0xb3b8f5,{'include':[{'model':db[_0xd736('0x6b')],'as':'VoiceMail'}]})[_0xd736('0x1b')](function(_0x121884){_0xb3b8f5['id']=_0x121884['id'];return _0xb3b8f5;});});return Promise['all'](_0x16d33d);})[_0xd736('0x1b')](function(_0x2ad132){if(_0x1b0791[_0xd736('0x59')][_0xd736('0x27')]===_0xd736('0x2d'))return _0x2ad132;if(_0x1b0791[_0xd736('0x2d')][_0xd736('0x27')]!==_0xd736('0x2d'))return _0x2ad132;var _0x5230c2=_[_0xd736('0x84')](_0x2ad132,function(_0x310900){return _0x310900[_0xd736('0x27')]==='agent'||_0x310900[_0xd736('0x27')]===_0xd736('0x87');});if(!_0x5230c2)return _0x2ad132;return db[_0xd736('0x7e')][_0xd736('0x49')]({'where':{'name':{'$or':[_0xd736('0x2e'),_0xd736('0x7f')]},'userProfileId':_0x1b0791['user']['userProfileId']},'raw':!![]})['then'](function(_0x29024c){if(_[_0xd736('0x88')](_0x29024c)||!_['some'](_0x29024c,[_0xd736('0x80'),0x0]))return _0x2ad132;_0x16d33d=[];var _0x48bfab=_(_0x29024c)['map'](function(_0x427936){if(_0x427936[_0xd736('0x80')]===0x1)return;return _0x427936[_0xd736('0x33')]===_0xd736('0x2e')?_0xd736('0x28'):_0xd736('0x87');})[_0xd736('0x89')]()[_0xd736('0x31')]();for(var _0x153a0a=0x0;_0x153a0a<_0x2ad132[_0xd736('0x4c')];_0x153a0a++){if(!_['includes'](_0x48bfab,_0x2ad132[_0x153a0a][_0xd736('0x27')]))return;var _0x7bd4d9=_0x2ad132[_0x153a0a][_0xd736('0x27')]===_0xd736('0x28')?_0xd736('0x2e'):'Telephones';_0x16d33d[_0xd736('0x48')](db[_0xd736('0x81')][_0xd736('0x7b')]({'name':_0x2ad132[_0x153a0a][_0xd736('0x33')],'resourceId':_0x2ad132[_0x153a0a]['id'],'type':_0x7bd4d9,'sectionId':_[_0xd736('0x32')](_0x29024c,[_0xd736('0x33'),_0x7bd4d9])['id']},{}));}return Promise[_0xd736('0x53')](_0x16d33d);});})[_0xd736('0x1b')](respondWithResult(_0x2e9bac,0xc9))['catch'](handleError(_0x2e9bac,null));};exports[_0xd736('0x8a')]=function(_0x30f4b1,_0x1951cb){if(_0x30f4b1['body']['id']){delete _0x30f4b1[_0xd736('0x59')]['id'];}return db[_0xd736('0x36')]['find']({'where':{'id':_0x30f4b1[_0xd736('0x55')]['id']}})['then'](function(_0x5d4d09){if(!_0x5d4d09)return null;if(_0x5d4d09['id']===_0x30f4b1[_0xd736('0x2d')]['id']){if(!_0x30f4b1[_0xd736('0x59')]['oldPassword']||!_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')]){throw new db[(_0xd736('0x8c'))]['ValidationError'](_0xd736('0x8d'));}if(!_0x5d4d09[_0xd736('0x8e')](_0x30f4b1['body']['oldPassword'])){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))]('Wrong\x20credentials');}if(_0x30f4b1[_0xd736('0x59')][_0xd736('0x90')]===_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')]){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x91'));}}else if(_0x30f4b1[_0xd736('0x2d')]['role']==='admin'){if(!_0x30f4b1[_0xd736('0x59')]['newPassword']){throw new db[(_0xd736('0x8c'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x30f4b1[_0xd736('0x2d')][_0xd736('0x27')]===_0xd736('0x2d')){if(!_0x30f4b1['body'][_0xd736('0x8b')]){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x92'));}if(_0x5d4d09[_0xd736('0x27')]!=='agent'){throw new db[(_0xd736('0x8c'))]['ValidationError']('Unauthorized');}}else{throw new db['Sequelize'][(_0xd736('0x8f'))](_0xd736('0x7c'));}return _0x5d4d09;})[_0xd736('0x1b')](handleEntityNotFound(_0x1951cb,null))[_0xd736('0x1b')](function(_0x9cc63d){return db[_0xd736('0x5f')][_0xd736('0x93')]({'attributes':['id',_0xd736('0x61'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xd736('0x1b')](function(_0x3c26bb){if(_0x3c26bb[_0xd736('0x61')])authService[_0xd736('0x62')](_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')]);if(!_0x3c26bb[_0xd736('0x94')]||!_0x9cc63d[_0xd736('0x95')])return _0x9cc63d;authService[_0xd736('0x96')](_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')],_0x9cc63d['previousPasswords'],_0x3c26bb[_0xd736('0x97')]);return _0x9cc63d;})[_0xd736('0x1b')](saveUpdates({'password':_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')],'passwordResetAt':_0x30f4b1[_0xd736('0x2d')]['id']==_0x30f4b1[_0xd736('0x55')]['id']?moment():null,'previousPasswords':authService[_0xd736('0x98')](_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')],_0x9cc63d[_0xd736('0x95')])},null));})[_0xd736('0x1b')](respondWithResult(_0x1951cb,null))[_0xd736('0x25')](handleError(_0x1951cb,null));};exports['addQueues']=function(_0x36f782,_0x48226b){var _0xb10025=_0x36f782[_0xd736('0x59')][_0xd736('0x99')];return db['User'][_0xd736('0x32')]({'where':{'id':_0x36f782[_0xd736('0x55')]['id']},'attributes':['id','name',_0xd736('0x27'),_0xd736('0x9a'),'loginInPause',_0xd736('0x9b'),'interface']})['then'](handleEntityNotFound(_0x48226b,null))[_0xd736('0x1b')](function(_0x534653){if(_0x534653){if(!utils[_0xd736('0x9c')](_0xb10025)){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x9d'));}return _0x534653[_0xd736('0x9e')+_[_0xd736('0x9f')](_0xb10025[_0xd736('0xa0')]())+_0xd736('0xa1')](_0x36f782[_0xd736('0x59')][_0xd736('0x5c')],{'penalty':_0x36f782[_0xd736('0x59')][_0xd736('0xa2')]||0x0})[_0xd736('0xa3')](function(_0x1f1ba2){for(var _0x596269=0x0;_0x596269<_0x36f782['body']['ids'][_0xd736('0x4c')];_0x596269+=0x1){var _0x490280={'UserId':Number(_0x36f782[_0xd736('0x55')]['id'])};_0x490280[_[_0xd736('0x9f')](_0xb10025['toLowerCase']())+_0xd736('0xa4')]=Number(_0x36f782[_0xd736('0x59')]['ids'][_0x596269]);socket[_0xd736('0xa5')](_0xd736('0x2d')+_['capitalize'](_0xb10025['toLowerCase']())+_0xd736('0xa6'),_0x490280);}return _0x1f1ba2;})[_0xd736('0x1b')](function(){if(_0xb10025===_0xd736('0xa7')){return db['VoiceQueue'][_0xd736('0x49')]({'where':{'id':_0x36f782['body'][_0xd736('0x5c')]||[]},'raw':!![],'attributes':['id',_0xd736('0x33')]});}})['then'](function(_0x42626e){var _0x3120ad=_0x534653['get']({'plain':!![]});var _0x3a9798=[];if(_0xb10025==='voice'&&_0x3120ad[_0xd736('0x27')]===_0xd736('0x28')&&_0x3120ad['online']){for(let _0x124d51=0x0;_0x124d51<_0x42626e[_0xd736('0x4c')];_0x124d51+=0x1){_0x3a9798[_0xd736('0x48')]({'membername':_0x3120ad[_0xd736('0x33')],'UserId':_0x3120ad['id'],'queue_name':_0x42626e[_0x124d51][_0xd736('0x33')],'VoiceQueueId':_0x42626e[_0x124d51]['id'],'interface':_[_0xd736('0x64')](_0x3120ad[_0xd736('0xa8')])?util[_0xd736('0xa9')]('SIP/%s',_0x3120ad[_0xd736('0x33')]):_0x3120ad['interface'],'paused':_0x3120ad[_0xd736('0x9b')]||![],'penalty':_0x36f782['body'][_0xd736('0xa2')]||0x0});}return Promise[_0xd736('0x53')](_0x3a9798[_0xd736('0x37')](function(_0x538dcb){return db[_0xd736('0xaa')]['upsert'](_0x538dcb);}));}return _0x534653;});}})[_0xd736('0x1b')](respondWithStatusCode(_0x48226b,null))[_0xd736('0x25')](handleError(_0x48226b,null));};exports[_0xd736('0xab')]=function(_0x471c48,_0x4e492e){var _0x3b3b44,_0x56f35b;return db['User'][_0xd736('0x32')]({'where':{'id':_0x471c48[_0xd736('0x55')]['id']},'attributes':['id','name',_0xd736('0x27')]})[_0xd736('0x1b')](handleEntityNotFound(_0x4e492e,null))[_0xd736('0x1b')](function(_0xd1d7a0){if(_0xd1d7a0){_0x3b3b44=_0xd1d7a0;if(!_0x471c48[_0xd736('0x42')][_0xd736('0x99')]||!utils[_0xd736('0x9c')](_0x471c48[_0xd736('0x42')][_0xd736('0x99')])){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x9d'));}return _0xd1d7a0[_0xd736('0xac')+_[_0xd736('0x9f')](_0x471c48[_0xd736('0x42')]['channel'][_0xd736('0xa0')]())+_0xd736('0xa1')](_0x471c48['query']['ids']);}})['then'](function(_0x4c994a){if(_['isArray'](_0x471c48[_0xd736('0x42')][_0xd736('0x5c')])){for(var _0x3c112f=0x0;_0x3c112f<_0x471c48['query'][_0xd736('0x5c')][_0xd736('0x4c')];_0x3c112f+=0x1){_0x56f35b={'UserId':Number(_0x471c48[_0xd736('0x55')]['id'])};_0x56f35b[_['capitalize'](_0x471c48[_0xd736('0x42')][_0xd736('0x99')][_0xd736('0xa0')]())+_0xd736('0xa4')]=Number(_0x471c48[_0xd736('0x42')][_0xd736('0x5c')][_0x3c112f]);socket[_0xd736('0xa5')]('user'+_[_0xd736('0x9f')](_0x471c48[_0xd736('0x42')][_0xd736('0x99')][_0xd736('0xa0')]())+_0xd736('0xad'),_0x56f35b);}}else{_0x56f35b={'UserId':Number(_0x471c48[_0xd736('0x55')]['id'])};_0x56f35b[_['capitalize'](_0x471c48[_0xd736('0x42')][_0xd736('0x99')][_0xd736('0xa0')]())+_0xd736('0xa4')]=Number(_0x471c48[_0xd736('0x42')][_0xd736('0x5c')]);socket['emit'](_0xd736('0x2d')+_[_0xd736('0x9f')](_0x471c48[_0xd736('0x42')]['channel'][_0xd736('0xa0')]())+_0xd736('0xad'),_0x56f35b);}return _0x4c994a;})['then'](function(){if(_0x471c48[_0xd736('0x42')]['channel']===_0xd736('0xa7')){return db['UserVoiceQueueRt'][_0xd736('0x2a')]({'where':{'UserId':_0x471c48[_0xd736('0x55')]['id'],'VoiceQueueId':_0x471c48[_0xd736('0x42')][_0xd736('0x5c')]},'individualHooks':!![]})[_0xd736('0x1b')](function(){return _0x3b3b44;});}return _0x3b3b44;})[_0xd736('0x1b')](respondWithStatusCode(_0x4e492e,null))[_0xd736('0x25')](handleError(_0x4e492e,null));};exports[_0xd736('0xae')]=function(_0xe7790d,_0x2f2eb3){_0xe7790d[_0xd736('0x59')][_0xd736('0xaf')]=_0xe7790d['file'][_0xd736('0xb0')];return db[_0xd736('0x36')]['find']({'where':{'id':_0xe7790d[_0xd736('0x55')]['id']}})['then'](handleEntityNotFound(_0x2f2eb3,null))[_0xd736('0x1b')](saveUpdates(_0xe7790d['body'],null))[_0xd736('0x1b')](respondWithResult(_0x2f2eb3,null))['catch'](handleError(_0x2f2eb3,null));};exports[_0xd736('0xb1')]=function(_0x4a6239,_0x209920){var _0x52fac5=path[_0xd736('0xb2')](config[_0xd736('0xb3')],'server/files/images/logos/default_profile.png');return db[_0xd736('0x36')]['find']({'where':{'id':_0x4a6239[_0xd736('0x55')]['id']},'attributes':['id',_0xd736('0xaf')],'raw':!![]})[_0xd736('0x1b')](handleEntityNotFound(_0x209920,null))['then'](function(_0x36e1dd){if(_0x36e1dd){if(_['isNil'](_0x36e1dd['userpic'])){return _0x209920[_0xd736('0xb4')](_0x52fac5);}else{if(!fs[_0xd736('0xb5')](path[_0xd736('0xb2')](config[_0xd736('0xb3')],_0xd736('0xb6'),_0x36e1dd[_0xd736('0xaf')]))){return _0x209920[_0xd736('0xb4')](_0x52fac5);}return _0x209920[_0xd736('0xb4')](path[_0xd736('0xb2')](config[_0xd736('0xb3')],_0xd736('0xb6'),_0x36e1dd[_0xd736('0xaf')]));}}})[_0xd736('0x25')](handleError(_0x209920,null));};exports[_0xd736('0xb7')]=function(_0x5c0cdd,_0x42db94){return db[_0xd736('0x36')][_0xd736('0x32')]({'where':{'id':_0x5c0cdd['params']['id']},'attributes':['id']})[_0xd736('0x1b')](handleEntityNotFound(_0x42db94,null))[_0xd736('0x1b')](function(_0x5cb86b){var _0x487aec=[];values=_0x5cb86b[_0xd736('0x4e')];_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x4d'),_0x5cb86b[_0xd736('0x4e')]));_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x4f'),_0x5cb86b[_0xd736('0x4e')]));_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x51'),_0x5cb86b[_0xd736('0x4e')]));_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x52'),_0x5cb86b[_0xd736('0x4e')]));_0x487aec['push'](get_open_tabs(_0xd736('0x58'),_0x5cb86b['dataValues']));_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x50'),_0x5cb86b[_0xd736('0x4e')]));return Promise[_0xd736('0x53')](_0x487aec);})[_0xd736('0x1b')](function(_0x2db99f){if(_0x2db99f){var _0x5626d3=_[_0xd736('0x37')](values[_0xd736('0xb8')],function(_0x473a1d){return{'channel':_0xd736('0xb9'),'id':_0x473a1d['id'],'createdAt':_0x473a1d[_0xd736('0xba')]};});var _0x166cb9=_[_0xd736('0x37')](values[_0xd736('0xbb')],function(_0x49bb13){return{'channel':_0xd736('0xbc'),'id':_0x49bb13['id'],'createdAt':_0x49bb13['createdAt']};});var _0x5800d5=_[_0xd736('0x37')](values[_0xd736('0xbd')],function(_0x251242){return{'channel':_0xd736('0xbe'),'id':_0x251242['id'],'createdAt':_0x251242[_0xd736('0xba')]};});var _0x45e48d=_[_0xd736('0x37')](values[_0xd736('0xbf')],function(_0x504bb4){return{'channel':_0xd736('0xc0'),'id':_0x504bb4['id'],'createdAt':_0x504bb4[_0xd736('0xba')]};});var _0x11ae61=_[_0xd736('0x37')](values[_0xd736('0xc1')],function(_0x404cb8){return{'channel':_0xd736('0xc2'),'id':_0x404cb8['id'],'createdAt':_0x404cb8[_0xd736('0xba')]};});var _0x4985c6=_['map'](values[_0xd736('0xc3')],function(_0xd3c68f){return{'channel':_0xd736('0xc4'),'id':_0xd3c68f['id'],'createdAt':_0xd3c68f['createdAt']};});var _0x1a78ef=_[_0xd736('0xc5')](_0x5626d3,_0x166cb9,_0x5800d5,_0x45e48d,_0x11ae61,_0x4985c6);var _0x15cfad={'count':_0x1a78ef[_0xd736('0x4c')],'rows':_0x1a78ef};return _0x15cfad;}else return null;})[_0xd736('0x1b')](respondWithResult(_0x42db94,null))[_0xd736('0x25')](handleError(_0x42db94,null));};exports['getContacts']=function(_0x1cb80a,_0x162304){var _0x56b333={};return db['User'][_0xd736('0x93')]({'where':{'id':_0x1cb80a['params']['id']}})['then'](function(_0x4920de){if(!_0x4920de){throw new APINotFoundError(util[_0xd736('0xa9')](_0xd736('0xc6'),_0x1cb80a[_0xd736('0x55')]['id']));}return contacts['describe']();})[_0xd736('0x1b')](function(_0x42ade5){_0x1cb80a[_0xd736('0x42')]['User']=_0x1cb80a['params']['id'];_0x56b333=qs[_0xd736('0x3f')](_0x42ade5,_0x1cb80a);if(_0x1cb80a[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0x41'))){_0x56b333[_0xd736('0x44')]=[{'model':db[_0xd736('0xc8')],'as':'List','required':![]},{'model':db[_0xd736('0xc9')],'as':_0xd736('0xca'),'attributes':['id',_0xd736('0x33'),'color'],'where':_0x1cb80a[_0xd736('0x42')][_0xd736('0xcb')]?{'id':_0x1cb80a[_0xd736('0x42')][_0xd736('0xcb')]}:undefined,'required':_0x1cb80a[_0xd736('0x42')][_0xd736('0xcb')]?!![]:![]}];}return contacts[_0xd736('0x49')](_0x1cb80a[_0xd736('0x42')],_0x1cb80a[_0xd736('0x2d')],_0x56b333,_0x42ade5);})['then'](respondWithFilteredResult(_0x162304,_0x56b333))[_0xd736('0x25')](APIHandleError(_0x162304));};exports['getQueues']=function(_0x492d7e,_0xd46925){var _0x1415ea;var _0x2d8863={};var _0x46c2b1;return db[_0xd736('0x36')]['findOne']({'where':{'id':_0x492d7e['params']['id']},'attributes':['id','name',_0xd736('0x27')]})['then'](handleEntityNotFound(_0xd46925,null))['then'](function(_0x49bfd1){if(!utils[_0xd736('0x9c')](_0x492d7e[_0xd736('0x42')][_0xd736('0x99')])){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x9d'));}_0x1415ea=_0x49bfd1;var _0x4788d4={};_0x4788d4[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_[_0xd736('0x9f')](_0x492d7e['query'][_0xd736('0x99')])+_0xd736('0xce')][_0xd736('0xcf')]);_0x4788d4['query']=_['keys'](_0x492d7e[_0xd736('0x42')]);_0x4788d4[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x4788d4[_0xd736('0xcc')],_0x4788d4[_0xd736('0x42')]);_0x2d8863['attributes']=_[_0xd736('0xd1')](_0x4788d4[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x492d7e[_0xd736('0x42')]['fields']));_0x2d8863[_0xd736('0x47')]=_0x2d8863[_0xd736('0x47')][_0xd736('0x4c')]?_0x2d8863[_0xd736('0x47')]:_0x4788d4[_0xd736('0xcc')];_0x2d8863['order']=qs['sort'](_0x492d7e[_0xd736('0x42')][_0xd736('0xd3')]);_0x2d8863['where']=qs[_0xd736('0xd0')](_['pick'](_0x492d7e[_0xd736('0x42')],_0x4788d4[_0xd736('0xd0')]));if(_0x492d7e[_0xd736('0x42')][_0xd736('0x2f')]){_0x2d8863[_0xd736('0x40')]=_[_0xd736('0x56')](_0x2d8863[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x2d8863[_0xd736('0x47')],function(_0x934cb7){var _0x20dbcf={};_0x20dbcf[_0x934cb7]={'$like':'%'+_0x492d7e[_0xd736('0x42')]['filter']+'%'};return _0x20dbcf;})});}_0x2d8863=_['merge']({},_0x2d8863,_0x492d7e[_0xd736('0x57')]);switch(_0x1415ea[_0xd736('0x27')]){case _0xd736('0x2b'):return db[_[_0xd736('0x9f')](_0x492d7e[_0xd736('0x42')][_0xd736('0x99')])+_0xd736('0xce')]['findAll'](_0x2d8863);case'user':case'agent':return _0x1415ea[_0xd736('0xd4')+_[_0xd736('0x9f')](_0x492d7e[_0xd736('0x42')][_0xd736('0x99')])+_0xd736('0xa1')](_0x2d8863);default:throw new db['Sequelize'][(_0xd736('0x8f'))](_0xd736('0xd5'));}})[_0xd736('0x1b')](function(_0x8f30a){_0x46c2b1=_0x8f30a['length'];if(!_0x492d7e['query'][_0xd736('0xc7')]('nolimit')){_0x2d8863['limit']=qs[_0xd736('0x17')](_0x492d7e['query'][_0xd736('0x17')]);_0x2d8863[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x492d7e[_0xd736('0x42')][_0xd736('0x14')]);}switch(_0x1415ea[_0xd736('0x27')]){case'admin':return db[_[_0xd736('0x9f')](_0x492d7e['query'][_0xd736('0x99')])+_0xd736('0xce')][_0xd736('0x49')](_0x2d8863);case _0xd736('0x2d'):case _0xd736('0x28'):return _0x1415ea[_0xd736('0xd4')+_[_0xd736('0x9f')](_0x492d7e[_0xd736('0x42')]['channel'])+_0xd736('0xa1')](_0x2d8863);}})[_0xd736('0x1b')](function(_0x3b8ed0){return{'count':_0x46c2b1,'rows':_0x3b8ed0};})[_0xd736('0x1b')](respondWithResult(_0xd46925,null))[_0xd736('0x25')](handleError(_0xd46925,null));};exports[_0xd736('0xd6')]=function(_0x2b4162,_0x5a791a){var _0x1ac2c2={};var _0x159abf={};var _0x4d2bf0;var _0x1fcd9a;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x2b4162[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x5a791a,null))[_0xd736('0x1b')](function(_0x599333){if(_0x599333){_0x4d2bf0=_0x599333;_0x159abf[_0xd736('0xcc')]=_['keys'](db[_0xd736('0xaa')]['rawAttributes']);_0x159abf[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x2b4162['query']);_0x159abf[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x159abf[_0xd736('0xcc')],_0x159abf[_0xd736('0x42')]);_0x1ac2c2['attributes']=_[_0xd736('0xd1')](_0x159abf[_0xd736('0xcc')],qs['fields'](_0x2b4162[_0xd736('0x42')][_0xd736('0xd2')]));_0x1ac2c2['attributes']=_0x1ac2c2[_0xd736('0x47')][_0xd736('0x4c')]?_0x1ac2c2[_0xd736('0x47')]:_0x159abf['model'];_0x1ac2c2[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x2b4162['query'][_0xd736('0xd3')]);_0x1ac2c2[_0xd736('0x40')]=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x2b4162[_0xd736('0x42')],_0x159abf[_0xd736('0xd0')]));if(_0x2b4162[_0xd736('0x42')][_0xd736('0x2f')]){_0x1ac2c2['where']=_['merge'](_0x1ac2c2[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x1ac2c2[_0xd736('0x47')],function(_0xf1a203){var _0x50d69c={};_0x50d69c[_0xf1a203]={'$like':'%'+_0x2b4162['query'][_0xd736('0x2f')]+'%'};return _0x50d69c;})});}_0x1ac2c2=_[_0xd736('0x56')]({},_0x1ac2c2,_0x2b4162[_0xd736('0x57')]);return _0x4d2bf0[_0xd736('0xd6')](_0x1ac2c2);}})[_0xd736('0x1b')](function(_0x2fbe66){if(_0x2fbe66){_0x1fcd9a=_0x2fbe66[_0xd736('0x4c')];if(!_0x2b4162[_0xd736('0x42')][_0xd736('0xc7')]('nolimit')){_0x1ac2c2[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x2b4162[_0xd736('0x42')][_0xd736('0x17')]);_0x1ac2c2[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x2b4162['query'][_0xd736('0x14')]);}return _0x4d2bf0['getVoiceQueuesRt'](_0x1ac2c2);}})[_0xd736('0x1b')](function(_0x320726){if(_0x320726){return _0x320726?{'count':_0x1fcd9a,'rows':_0x320726}:null;}})[_0xd736('0x1b')](respondWithResult(_0x5a791a,null))[_0xd736('0x25')](handleError(_0x5a791a,null));};exports[_0xd736('0xd9')]=function(_0x1ac4d5,_0x303063){var _0x1f3663={};var _0x84987={};var _0x4911f8;var _0x3c2223;return db['User'][_0xd736('0x93')]({'where':{'id':_0x1ac4d5[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x303063,null))[_0xd736('0x1b')](function(_0x44d28c){if(_0x44d28c){_0x4911f8=_0x44d28c;_0x84987[_0xd736('0xcc')]=_[_0xd736('0xcd')](db['ChatGroup'][_0xd736('0xcf')]);_0x84987[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x1ac4d5['query']);_0x84987[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x84987['model'],_0x84987[_0xd736('0x42')]);_0x1f3663['attributes']=_[_0xd736('0xd1')](_0x84987[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x1ac4d5[_0xd736('0x42')][_0xd736('0xd2')]));_0x1f3663[_0xd736('0x47')]=_0x1f3663['attributes'][_0xd736('0x4c')]?_0x1f3663[_0xd736('0x47')]:_0x84987[_0xd736('0xcc')];_0x1f3663[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x1ac4d5[_0xd736('0x42')]['sort']);_0x1f3663['where']=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x1ac4d5[_0xd736('0x42')],_0x84987[_0xd736('0xd0')]));if(_0x1ac4d5[_0xd736('0x42')]['filter']){_0x1f3663[_0xd736('0x40')]=_[_0xd736('0x56')](_0x1f3663[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x1f3663['attributes'],function(_0x45d93b){var _0xee9880={};_0xee9880[_0x45d93b]={'$like':'%'+_0x1ac4d5[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0xee9880;})});}_0x1f3663=_['merge']({},_0x1f3663,_0x1ac4d5[_0xd736('0x57')]);return _0x4911f8[_0xd736('0xd9')](_0x1f3663);}})[_0xd736('0x1b')](function(_0x416194){if(_0x416194){_0x3c2223=_0x416194[_0xd736('0x4c')];if(!_0x1ac4d5[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0xda'))){_0x1f3663[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x1ac4d5[_0xd736('0x42')]['limit']);_0x1f3663['offset']=qs[_0xd736('0x14')](_0x1ac4d5[_0xd736('0x42')][_0xd736('0x14')]);}return _0x4911f8[_0xd736('0xd9')](_0x1f3663);}})[_0xd736('0x1b')](function(_0x57085c){if(_0x57085c){return _0x57085c?{'count':_0x3c2223,'rows':_0x57085c}:null;}})[_0xd736('0x1b')](respondWithResult(_0x303063,null))['catch'](handleError(_0x303063,null));};exports[_0xd736('0xdb')]=function(_0x5378d3,_0x345025){var _0xdf9fca={'raw':!![],'where':{}};var _0x17c49d={};var _0x42bf2b={'count':0x0,'rows':[]};return db[_0xd736('0x36')]['findOne']({'where':{'id':_0x5378d3[_0xd736('0x55')]['id']}})['then'](handleEntityNotFound(_0x345025,null))[_0xd736('0x1b')](function(_0x32446d){if(_0x32446d){_0x17c49d['model']=_[_0xd736('0xcd')](db[_0xd736('0xdc')][_0xd736('0xcf')]);_0x17c49d['query']=_[_0xd736('0xcd')](_0x5378d3[_0xd736('0x42')]);_0x17c49d[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x17c49d[_0xd736('0xcc')],_0x17c49d[_0xd736('0x42')]);_0xdf9fca[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x17c49d[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x5378d3[_0xd736('0x42')][_0xd736('0xd2')]));_0xdf9fca[_0xd736('0x47')]=_0xdf9fca[_0xd736('0x47')][_0xd736('0x4c')]?_0xdf9fca[_0xd736('0x47')]:_0x17c49d[_0xd736('0xcc')];if(!_0x5378d3['query'][_0xd736('0xc7')]('nolimit')){_0xdf9fca['limit']=qs['limit'](_0x5378d3[_0xd736('0x42')][_0xd736('0x17')]);_0xdf9fca[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x5378d3[_0xd736('0x42')][_0xd736('0x14')]);}_0xdf9fca[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x5378d3['query'][_0xd736('0xd3')]);_0xdf9fca[_0xd736('0x40')]=qs[_0xd736('0xd0')](_['pick'](_0x5378d3[_0xd736('0x42')],_0x17c49d[_0xd736('0xd0')]));_0xdf9fca[_0xd736('0x40')]['UserId']=_0x32446d['id'];if(_0x5378d3[_0xd736('0x42')][_0xd736('0x2f')]){_0xdf9fca[_0xd736('0x40')]=_['merge'](_0xdf9fca['where'],{'$or':_['map'](_0xdf9fca[_0xd736('0x47')],function(_0x346564){var _0x4fc2ab={};_0x4fc2ab[_0x346564]={'$like':'%'+_0x5378d3[_0xd736('0x42')]['filter']+'%'};return _0x4fc2ab;})});}_0xdf9fca=_[_0xd736('0x56')]({},_0xdf9fca,_0x5378d3[_0xd736('0x57')]);return db[_0xd736('0xdc')][_0xd736('0x16')]({'where':_0xdf9fca[_0xd736('0x40')]})[_0xd736('0x1b')](function(_0x37b929){_0x42bf2b[_0xd736('0x16')]=_0x37b929;if(_0x5378d3[_0xd736('0x42')][_0xd736('0x41')]){_0xdf9fca[_0xd736('0x44')]=[{'all':!![]}];}return db[_0xd736('0xdc')]['findAll'](_0xdf9fca);})['then'](function(_0x56eb27){_0x42bf2b[_0xd736('0x4a')]=_0x56eb27;return _0x42bf2b;});}})['then'](respondWithFilteredResult(_0x345025,_0xdf9fca))[_0xd736('0x25')](handleError(_0x345025,null));};exports['getScreenRecordings']=function(_0x568545,_0x259ca8){var _0x43afee={'raw':!![],'where':{}};var _0xe43949={};var _0x4eeab0={'count':0x0,'rows':[]};return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x568545['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x259ca8,null))[_0xd736('0x1b')](function(_0x164b58){if(_0x164b58){_0xe43949[_0xd736('0xcc')]=_['keys'](db['ScreenRecording'][_0xd736('0xcf')]);_0xe43949[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x568545[_0xd736('0x42')]);_0xe43949[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0xe43949[_0xd736('0xcc')],_0xe43949[_0xd736('0x42')]);_0x43afee[_0xd736('0x47')]=_[_0xd736('0xd1')](_0xe43949[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x568545['query'][_0xd736('0xd2')]));_0x43afee[_0xd736('0x47')]=_0x43afee['attributes'][_0xd736('0x4c')]?_0x43afee['attributes']:_0xe43949['model'];if(!_0x568545[_0xd736('0x42')]['hasOwnProperty'](_0xd736('0xda'))){_0x43afee['limit']=qs[_0xd736('0x17')](_0x568545['query'][_0xd736('0x17')]);_0x43afee[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x568545['query'][_0xd736('0x14')]);}_0x43afee['order']=qs[_0xd736('0xd3')](_0x568545[_0xd736('0x42')]['sort']);_0x43afee[_0xd736('0x40')]=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x568545[_0xd736('0x42')],_0xe43949[_0xd736('0xd0')]));_0x43afee['where']['UserId']=_0x164b58['id'];if(_0x568545[_0xd736('0x42')][_0xd736('0x2f')]){_0x43afee[_0xd736('0x40')]=_['merge'](_0x43afee['where'],{'$or':_[_0xd736('0x37')](_0x43afee['attributes'],function(_0x59ace6){var _0x17d5f8={};_0x17d5f8[_0x59ace6]={'$like':'%'+_0x568545['query']['filter']+'%'};return _0x17d5f8;})});}_0x43afee=_[_0xd736('0x56')]({},_0x43afee,_0x568545[_0xd736('0x57')]);return db[_0xd736('0xdd')][_0xd736('0x16')]({'where':_0x43afee['where']})['then'](function(_0x7e9c2e){_0x4eeab0[_0xd736('0x16')]=_0x7e9c2e;if(_0x568545[_0xd736('0x42')]['includeAll']){_0x43afee[_0xd736('0x44')]=[{'all':!![]}];}return db[_0xd736('0xdd')][_0xd736('0x49')](_0x43afee);})[_0xd736('0x1b')](function(_0x193e6a){_0x4eeab0[_0xd736('0x4a')]=_0x193e6a;return _0x4eeab0;});}})['then'](respondWithFilteredResult(_0x259ca8,_0x43afee))[_0xd736('0x25')](handleError(_0x259ca8,null));};exports[_0xd736('0xde')]=function(_0xd7c9b,_0x374924){var _0x1dc143={};var _0x58c39a={};var _0x168bce;var _0x2f9429;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0xd7c9b[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x374924,null))[_0xd736('0x1b')](function(_0x3b24d9){if(_0x3b24d9){_0x168bce=_0x3b24d9;_0x58c39a['model']=_[_0xd736('0xcd')](db[_0xd736('0xdf')]['rawAttributes']);_0x58c39a[_0xd736('0x42')]=_[_0xd736('0xcd')](_0xd7c9b[_0xd736('0x42')]);_0x58c39a['filters']=_[_0xd736('0xd1')](_0x58c39a[_0xd736('0xcc')],_0x58c39a['query']);_0x1dc143[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x58c39a[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0xd7c9b[_0xd736('0x42')][_0xd736('0xd2')]));_0x1dc143[_0xd736('0x47')]=_0x1dc143[_0xd736('0x47')][_0xd736('0x4c')]?_0x1dc143[_0xd736('0x47')]:_0x58c39a['model'];_0x1dc143['order']=qs[_0xd736('0xd3')](_0xd7c9b[_0xd736('0x42')]['sort']);_0x1dc143['where']=qs['filters'](_[_0xd736('0xd8')](_0xd7c9b['query'],_0x58c39a['filters']));if(_0xd7c9b['query'][_0xd736('0x2f')]){_0x1dc143[_0xd736('0x40')]=_['merge'](_0x1dc143[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x1dc143['attributes'],function(_0xc3ac4b){var _0x2826d4={};_0x2826d4[_0xc3ac4b]={'$like':'%'+_0xd7c9b[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x2826d4;})});}_0x1dc143=_[_0xd736('0x56')]({},_0x1dc143,_0xd7c9b[_0xd736('0x57')]);return _0x168bce['getChatInteractions'](_0x1dc143);}})[_0xd736('0x1b')](function(_0x39d855){if(_0x39d855){_0x2f9429=_0x39d855[_0xd736('0x4c')];if(!_0xd7c9b[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0xda'))){_0x1dc143[_0xd736('0x17')]=qs[_0xd736('0x17')](_0xd7c9b['query'][_0xd736('0x17')]);_0x1dc143[_0xd736('0x14')]=qs['offset'](_0xd7c9b['query']['offset']);}return _0x168bce[_0xd736('0xde')](_0x1dc143);}})['then'](function(_0x7f389d){if(_0x7f389d){return _0x7f389d?{'count':_0x2f9429,'rows':_0x7f389d}:null;}})['then'](respondWithResult(_0x374924,null))[_0xd736('0x25')](handleError(_0x374924,null));};exports[_0xd736('0xe0')]=function(_0x21ae54,_0x3adc61){var _0x2783ac={};var _0x4fca45={};var _0x1f0489;var _0x3ddc8a;return db[_0xd736('0x36')]['findOne']({'where':{'id':_0x21ae54['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x3adc61,null))[_0xd736('0x1b')](function(_0x45d380){if(_0x45d380){_0x1f0489=_0x45d380;_0x4fca45[_0xd736('0xcc')]=_['keys'](db[_0xd736('0xe1')][_0xd736('0xcf')]);_0x4fca45[_0xd736('0x42')]=_['keys'](_0x21ae54['query']);_0x4fca45[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x4fca45['model'],_0x4fca45[_0xd736('0x42')]);_0x2783ac[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x4fca45['model'],qs['fields'](_0x21ae54[_0xd736('0x42')][_0xd736('0xd2')]));_0x2783ac['attributes']=_0x2783ac[_0xd736('0x47')][_0xd736('0x4c')]?_0x2783ac[_0xd736('0x47')]:_0x4fca45['model'];_0x2783ac[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x21ae54[_0xd736('0x42')]['sort']);_0x2783ac[_0xd736('0x40')]=qs[_0xd736('0xd0')](_['pick'](_0x21ae54[_0xd736('0x42')],_0x4fca45[_0xd736('0xd0')]));if(_0x21ae54[_0xd736('0x42')][_0xd736('0x2f')]){_0x2783ac[_0xd736('0x40')]=_[_0xd736('0x56')](_0x2783ac[_0xd736('0x40')],{'$or':_['map'](_0x2783ac[_0xd736('0x47')],function(_0xe073a7){var _0xb65098={};_0xb65098[_0xe073a7]={'$like':'%'+_0x21ae54[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0xb65098;})});}_0x2783ac=_['merge']({},_0x2783ac,_0x21ae54[_0xd736('0x57')]);return _0x1f0489[_0xd736('0xe0')](_0x2783ac);}})[_0xd736('0x1b')](function(_0x2a87ee){if(_0x2a87ee){_0x3ddc8a=_0x2a87ee[_0xd736('0x4c')];if(!_0x21ae54['query'][_0xd736('0xc7')]('nolimit')){_0x2783ac[_0xd736('0x17')]=qs['limit'](_0x21ae54[_0xd736('0x42')][_0xd736('0x17')]);_0x2783ac[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x21ae54[_0xd736('0x42')][_0xd736('0x14')]);}return _0x1f0489[_0xd736('0xe0')](_0x2783ac);}})[_0xd736('0x1b')](function(_0x268920){if(_0x268920){return _0x268920?{'count':_0x3ddc8a,'rows':_0x268920}:null;}})['then'](respondWithResult(_0x3adc61,null))[_0xd736('0x25')](handleError(_0x3adc61,null));};exports['getMailInteractions']=function(_0x11f9bd,_0x55bda0){var _0x53880b={'raw':!![],'where':{}};var _0x238068={};var _0x1de9d={'count':0x0,'rows':[]};return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x11f9bd['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x55bda0,null))[_0xd736('0x1b')](function(_0x5dbc22){if(_0x5dbc22){_0x238068[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_0xd736('0xe2')][_0xd736('0xcf')]);_0x238068[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x11f9bd[_0xd736('0x42')]);_0x238068['filters']=_[_0xd736('0xd1')](_0x238068['model'],_0x238068[_0xd736('0x42')]);_0x53880b['attributes']=_[_0xd736('0xd1')](_0x238068[_0xd736('0xcc')],qs['fields'](_0x11f9bd[_0xd736('0x42')][_0xd736('0xd2')]));_0x53880b[_0xd736('0x47')]=_0x53880b[_0xd736('0x47')][_0xd736('0x4c')]?_0x53880b[_0xd736('0x47')]:_0x238068[_0xd736('0xcc')];if(!_0x11f9bd['query'][_0xd736('0xc7')](_0xd736('0xda'))){_0x53880b[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x11f9bd[_0xd736('0x42')][_0xd736('0x17')]);_0x53880b[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x11f9bd[_0xd736('0x42')]['offset']);}_0x53880b[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x11f9bd[_0xd736('0x42')][_0xd736('0xd3')]);_0x53880b[_0xd736('0x40')]=qs['filters'](_['pick'](_0x11f9bd[_0xd736('0x42')],_0x238068['filters']));_0x53880b['where'][_0xd736('0xe3')]=_0x5dbc22['id'];if(_0x11f9bd[_0xd736('0x42')][_0xd736('0x2f')]){_0x53880b[_0xd736('0x40')]=_[_0xd736('0x56')](_0x53880b['where'],{'$or':_[_0xd736('0x37')](_0x53880b[_0xd736('0x47')],function(_0x50212f){var _0x189cd6={};_0x189cd6[_0x50212f]={'$like':'%'+_0x11f9bd['query']['filter']+'%'};return _0x189cd6;})});}_0x53880b=_['merge']({},_0x53880b,_0x11f9bd[_0xd736('0x57')]);return db['MailInteraction'][_0xd736('0x16')]({'where':_0x53880b[_0xd736('0x40')]})[_0xd736('0x1b')](function(_0x137dc7){_0x1de9d[_0xd736('0x16')]=_0x137dc7;if(_0x11f9bd[_0xd736('0x42')]['includeAll']){_0x53880b[_0xd736('0x44')]=[{'all':!![]}];}return db['MailInteraction'][_0xd736('0x49')](_0x53880b);})[_0xd736('0x1b')](function(_0xb8d031){_0x1de9d['rows']=_0xb8d031;return _0x1de9d;});}})[_0xd736('0x1b')](respondWithFilteredResult(_0x55bda0,_0x53880b))[_0xd736('0x25')](handleError(_0x55bda0,null));};exports['getSmsInteractions']=function(_0x466084,_0x1be356){var _0x40e7fe={};var _0x343df7={};var _0x59eab8;var _0x376865;return db['User'][_0xd736('0x93')]({'where':{'id':_0x466084['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x1be356,null))[_0xd736('0x1b')](function(_0x5da004){if(_0x5da004){_0x59eab8=_0x5da004;_0x343df7[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_0xd736('0xe4')][_0xd736('0xcf')]);_0x343df7[_0xd736('0x42')]=_['keys'](_0x466084[_0xd736('0x42')]);_0x343df7['filters']=_[_0xd736('0xd1')](_0x343df7[_0xd736('0xcc')],_0x343df7[_0xd736('0x42')]);_0x40e7fe['attributes']=_[_0xd736('0xd1')](_0x343df7[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x466084[_0xd736('0x42')]['fields']));_0x40e7fe[_0xd736('0x47')]=_0x40e7fe[_0xd736('0x47')]['length']?_0x40e7fe[_0xd736('0x47')]:_0x343df7['model'];_0x40e7fe[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x466084[_0xd736('0x42')][_0xd736('0xd3')]);_0x40e7fe['where']=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x466084[_0xd736('0x42')],_0x343df7[_0xd736('0xd0')]));if(_0x466084[_0xd736('0x42')][_0xd736('0x2f')]){_0x40e7fe[_0xd736('0x40')]=_[_0xd736('0x56')](_0x40e7fe[_0xd736('0x40')],{'$or':_['map'](_0x40e7fe[_0xd736('0x47')],function(_0x30c22b){var _0x2fb4c4={};_0x2fb4c4[_0x30c22b]={'$like':'%'+_0x466084[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x2fb4c4;})});}_0x40e7fe=_[_0xd736('0x56')]({},_0x40e7fe,_0x466084[_0xd736('0x57')]);return _0x59eab8[_0xd736('0xe5')](_0x40e7fe);}})['then'](function(_0x25a38b){if(_0x25a38b){_0x376865=_0x25a38b[_0xd736('0x4c')];if(!_0x466084[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0xda'))){_0x40e7fe[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x466084[_0xd736('0x42')][_0xd736('0x17')]);_0x40e7fe[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x466084['query'][_0xd736('0x14')]);}return _0x59eab8['getSmsInteractions'](_0x40e7fe);}})['then'](function(_0x56d564){if(_0x56d564){return _0x56d564?{'count':_0x376865,'rows':_0x56d564}:null;}})[_0xd736('0x1b')](respondWithResult(_0x1be356,null))['catch'](handleError(_0x1be356,null));};exports['getFaxInteractions']=function(_0x4586d7,_0x5c48b6){var _0x147ca6={};var _0x4a004b={};var _0x483024;var _0x2771ee;return db[_0xd736('0x36')]['findOne']({'where':{'id':_0x4586d7[_0xd736('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c48b6,null))['then'](function(_0x7eb515){if(_0x7eb515){_0x483024=_0x7eb515;_0x4a004b[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_0xd736('0xe6')][_0xd736('0xcf')]);_0x4a004b[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x4586d7[_0xd736('0x42')]);_0x4a004b['filters']=_[_0xd736('0xd1')](_0x4a004b[_0xd736('0xcc')],_0x4a004b['query']);_0x147ca6[_0xd736('0x47')]=_['intersection'](_0x4a004b[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x4586d7['query']['fields']));_0x147ca6[_0xd736('0x47')]=_0x147ca6['attributes'][_0xd736('0x4c')]?_0x147ca6[_0xd736('0x47')]:_0x4a004b['model'];_0x147ca6[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x4586d7['query']['sort']);_0x147ca6[_0xd736('0x40')]=qs['filters'](_[_0xd736('0xd8')](_0x4586d7[_0xd736('0x42')],_0x4a004b[_0xd736('0xd0')]));if(_0x4586d7['query'][_0xd736('0x2f')]){_0x147ca6['where']=_[_0xd736('0x56')](_0x147ca6[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x147ca6[_0xd736('0x47')],function(_0x14fe62){var _0x5338f9={};_0x5338f9[_0x14fe62]={'$like':'%'+_0x4586d7[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x5338f9;})});}_0x147ca6=_[_0xd736('0x56')]({},_0x147ca6,_0x4586d7[_0xd736('0x57')]);return _0x483024[_0xd736('0xe7')](_0x147ca6);}})['then'](function(_0x456369){if(_0x456369){_0x2771ee=_0x456369[_0xd736('0x4c')];if(!_0x4586d7['query'][_0xd736('0xc7')]('nolimit')){_0x147ca6['limit']=qs[_0xd736('0x17')](_0x4586d7[_0xd736('0x42')][_0xd736('0x17')]);_0x147ca6['offset']=qs[_0xd736('0x14')](_0x4586d7['query']['offset']);}return _0x483024[_0xd736('0xe7')](_0x147ca6);}})[_0xd736('0x1b')](function(_0x1bab59){if(_0x1bab59){return _0x1bab59?{'count':_0x2771ee,'rows':_0x1bab59}:null;}})[_0xd736('0x1b')](respondWithResult(_0x5c48b6,null))[_0xd736('0x25')](handleError(_0x5c48b6,null));};exports[_0xd736('0xe8')]=function(_0x3f08b4,_0x7321f9){var _0xb29c9b={};var _0x50729d={};var _0x59987e;var _0x2f2fe4;return db['User'][_0xd736('0x93')]({'where':{'id':_0x3f08b4[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x7321f9,null))['then'](function(_0x5917f1){if(_0x5917f1){_0x59987e=_0x5917f1;_0x50729d[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_0xd736('0xe9')]['rawAttributes']);_0x50729d[_0xd736('0x42')]=_['keys'](_0x3f08b4[_0xd736('0x42')]);_0x50729d[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x50729d['model'],_0x50729d['query']);_0xb29c9b[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x50729d[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x3f08b4['query'][_0xd736('0xd2')]));_0xb29c9b[_0xd736('0x47')]=_0xb29c9b[_0xd736('0x47')][_0xd736('0x4c')]?_0xb29c9b[_0xd736('0x47')]:_0x50729d['model'];_0xb29c9b[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x3f08b4[_0xd736('0x42')]['sort']);_0xb29c9b[_0xd736('0x40')]=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x3f08b4['query'],_0x50729d[_0xd736('0xd0')]));if(_0x3f08b4[_0xd736('0x42')][_0xd736('0x2f')]){_0xb29c9b['where']=_[_0xd736('0x56')](_0xb29c9b[_0xd736('0x40')],{'$or':_['map'](_0xb29c9b[_0xd736('0x47')],function(_0x13ef72){var _0x500a90={};_0x500a90[_0x13ef72]={'$like':'%'+_0x3f08b4[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x500a90;})});}_0xb29c9b=_['merge']({},_0xb29c9b,_0x3f08b4['options']);return _0x59987e[_0xd736('0xe8')](_0xb29c9b);}})[_0xd736('0x1b')](function(_0x5d0c33){if(_0x5d0c33){_0x2f2fe4=_0x5d0c33[_0xd736('0x4c')];if(!_0x3f08b4[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0xda'))){_0xb29c9b[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x3f08b4[_0xd736('0x42')]['limit']);_0xb29c9b['offset']=qs['offset'](_0x3f08b4[_0xd736('0x42')][_0xd736('0x14')]);}return _0x59987e[_0xd736('0xe8')](_0xb29c9b);}})[_0xd736('0x1b')](function(_0x2f0faf){if(_0x2f0faf){return _0x2f0faf?{'count':_0x2f2fe4,'rows':_0x2f0faf}:null;}})[_0xd736('0x1b')](respondWithResult(_0x7321f9,null))[_0xd736('0x25')](handleError(_0x7321f9,null));};exports[_0xd736('0xea')]=function(_0x5db368,_0x3f132d,_0x579a48){var _0x427ab1;var _0x248828;var _0x57503e;var _0x3ef070=!_[_0xd736('0x64')](_0x5db368[_0xd736('0x55')]['id'])?_0x5db368[_0xd736('0x55')]['id']:!_[_0xd736('0x64')](_0x5db368[_0xd736('0x2d')]['id'])?_0x5db368[_0xd736('0x2d')]['id']:null;return db[_0xd736('0x36')][_0xd736('0x32')]({'where':{'id':_0x3ef070,'role':{'$or':['admin',_0xd736('0x2d'),_0xd736('0x28')]}},'attributes':['id',_0xd736('0x33'),_0xd736('0xeb'),_0xd736('0xec'),_0xd736('0x27'),_0xd736('0x5e'),_0xd736('0xed')]})[_0xd736('0x1b')](function(_0xfe4ec8){if(_0xfe4ec8){if(_0xfe4ec8[_0xd736('0x27')]===_0xd736('0x28')){_0x427ab1=_0xfe4ec8;if(_0x5db368['body'][_0xd736('0xa8')]){_0x57503e=util[_0xd736('0xa9')](_0xd736('0xee'),_0x427ab1[_0x5db368[_0xd736('0x59')][_0xd736('0xa8')]]);}else if(_0x5db368[_0xd736('0x59')][_0xd736('0xef')]){_0x57503e=util['format'](_0xd736('0xf0'),_0x5db368['body'][_0xd736('0xef')]);}else{_0x57503e=util[_0xd736('0xa9')](_0xd736('0xf0'),_0x427ab1[_0xd736('0x33')]);}socket['to'](util[_0xd736('0xa9')](_0xd736('0xf1'),_0x427ab1['name']))[_0xd736('0xa5')](_0xd736('0xf2'),{'user':{'id':_0x427ab1['id'],'name':_0x427ab1[_0xd736('0x33')]},'ip':_0x5db368[_0xd736('0xf3')][_0xd736('0xf4')]||_0x5db368['connection'][_0xd736('0xf5')]||_0x5db368[_0xd736('0xf6')][_0xd736('0xf5')]||_0x5db368[_0xd736('0xf7')][_0xd736('0xf6')]['remoteAddress']});return new Promise(function(_0x3ae0cd,_0x298ce1){db[_0xd736('0x66')]['transaction']()[_0xd736('0x1b')](_0x4b87a1=>{db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x427ab1[_0xd736('0x33')]},'individualHooks':!![]},{'transaction':_0x4b87a1})[_0xd736('0x1b')](function(){return _0x4b87a1[_0xd736('0xf8')]();})[_0xd736('0x1b')](_0x3ae0cd)['catch'](_0x298ce1);});});}}else{throw new db[(_0xd736('0x8c'))]['ValidationError'](_0xd736('0xf9'));}})[_0xd736('0x1b')](function(){if(_0x427ab1){return _0x427ab1['getVoiceQueues']({'raw':!![]});}})[_0xd736('0x1b')](function(_0x5b8b11){if(_0x427ab1){if(_0x5b8b11){_0x248828=_0x5b8b11;if(_0x248828[_0xd736('0x4c')]){var _0x288a10=_0x248828[_0xd736('0x37')](function(_0x343a71){return{'membername':_0x427ab1['name'],'UserId':_0x427ab1['id'],'queue_name':_0x343a71['name'],'VoiceQueueId':_0x343a71['id'],'interface':_0x57503e,'paused':_0x427ab1['loginInPause']||![],'penalty':_0x343a71[_0xd736('0xfa')]||0x0};});return db['UserVoiceQueueRt'][_0xd736('0x83')](_0x288a10);}}}})[_0xd736('0x1b')](function(){if(_0x427ab1){return db[_0xd736('0xfb')]['findAll']({'where':{'membername':_0x427ab1['name'],'exitAt':null}});}})[_0xd736('0x1b')](function(_0x2a41cd){if(_0x427ab1){var _0x38452d=[];_0x2a41cd[_0xd736('0xfc')](function(_0x10a581){_0x38452d['push'](_0x10a581['update']({'exitAt':moment()[_0xd736('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xd736('0x53')](_0x38452d);}})[_0xd736('0x1b')](function(){if(_0x427ab1){var _0x484514=[];var _0x823445=[];var _0xa1e0d8=utils['getChannels']();var _0x20498e={'membername':_0x427ab1[_0xd736('0x33')],'interface':_0x57503e,'enterAt':moment()[_0xd736('0xa9')](_0xd736('0xfd')),'role':_0x427ab1[_0xd736('0x27')],'internal':_0x427ab1['internal']};_0xa1e0d8[_0xd736('0xfc')](function(_0x649016){_0x484514['push'](_[_0xd736('0x56')]({'channel':_0x649016,'type':_0xd736('0xfe'),'data1':_0x5db368[_0xd736('0x59')][_0xd736('0xff')],'data2':_0x57503e},_0x20498e));if(_0x427ab1[_0xd736('0xed')]){_0x823445[_0xd736('0x48')](_[_0xd736('0x56')]({'channel':_0x649016,'type':'PAUSE','data1':'LOGININPAUSE'},_0x20498e));}});return db[_0xd736('0xfb')][_0xd736('0x83')](_0x484514[_0xd736('0xc5')](_0x823445),{'individualHooks':!![]});}})[_0xd736('0x1b')](function(){if(_0x427ab1){return _0x427ab1[_0xd736('0x26')]({'online':!![],'lastLoginAt':moment()[_0xd736('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x427ab1[_0xd736('0xed')]||![],'mailPause':_0x427ab1['loginInPause']||![],'chatPause':_0x427ab1[_0xd736('0xed')]||![],'faxPause':_0x427ab1[_0xd736('0xed')]||![],'smsPause':_0x427ab1[_0xd736('0xed')]||![],'openchannelPause':_0x427ab1['loginInPause']||![],'whatsappPause':_0x427ab1['loginInPause']||![],'pauseType':_0x427ab1[_0xd736('0xed')]?_0xd736('0x100'):null,'interface':_0x57503e,'lastPauseAt':moment()[_0xd736('0xa9')](_0xd736('0xfd'))});}})[_0xd736('0x1b')](function(_0x3bb29c){if(_0x5db368['isMiddleware']){return _0x579a48();}else{return Promise['resolve'](_0x3bb29c)[_0xd736('0x1b')](respondWithResult(_0x3f132d,null));}})[_0xd736('0x25')](handleError(_0x3f132d,null));};exports[_0xd736('0x101')]=function(_0x392277,_0x25a657){var _0x1b3680;return db['User'][_0xd736('0x32')]({'where':{'id':_0x392277[_0xd736('0x55')]['id'],'role':_0xd736('0x28')},'attributes':['id',_0xd736('0x33'),_0xd736('0x27')]})['then'](handleEntityNotFound(_0x25a657,null))[_0xd736('0x1b')](function(_0x219894){if(_0x219894){_0x1b3680=_0x219894;return db[_0xd736('0xaa')][_0xd736('0x2a')]({'where':{'membername':_0x1b3680[_0xd736('0x33')]},'individualHooks':!![]});}})['then'](function(){return db[_0xd736('0xfb')][_0xd736('0x49')]({'where':{'membername':_0x1b3680['name'],'exitAt':null}});})[_0xd736('0x1b')](function(_0x30a187){var _0x1346fb=[];_0x30a187[_0xd736('0xfc')](function(_0x15e79b){_0x1346fb[_0xd736('0x48')](_0x15e79b[_0xd736('0x26')]({'exitAt':moment()['format'](_0xd736('0xfd'))}));});return Promise[_0xd736('0x53')](_0x1346fb);})['then'](function(){return _0x1b3680[_0xd736('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x25a657,null))[_0xd736('0x25')](handleError(_0x25a657,null));};exports[_0xd736('0x102')]=function(_0x47f9f3,_0x3bce06){var _0xf50421;return db[_0xd736('0xaa')][_0xd736('0x26')]({'paused':0x1},{'where':{'UserId':_0x47f9f3[_0xd736('0x55')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xd736('0x36')]['find']({'where':{'id':_0x47f9f3[_0xd736('0x55')]['id'],'role':_0xd736('0x28')},'attributes':['id','name','role',_0xd736('0x5e'),_0xd736('0xa8'),_0xd736('0x9a')]});})[_0xd736('0x1b')](handleEntityNotFound(_0x3bce06,null))[_0xd736('0x1b')](function(_0x440c7d){if(_0x440c7d){_0xf50421=_0x440c7d;return respondWithRpcPromise(_0xd736('0x103'),_0xd736('0x102'),{'id':_0xf50421['id'],'name':_0xf50421[_0xd736('0x33')],'pause':!![]});}})['then'](function(){if(_0xf50421){return db[_0xd736('0xfb')][_0xd736('0x49')]({'where':{'membername':_0xf50421[_0xd736('0x33')],'type':'PAUSE','exitAt':null}});}})[_0xd736('0x1b')](function(_0x165264){if(_0x165264[_0xd736('0x4c')]){var _0x49010d=moment()[_0xd736('0xa9')](_0xd736('0xfd'));for(var _0x36daa6=0x0,_0x50a6bc=_0x165264[_0xd736('0x4c')];_0x36daa6<_0x50a6bc;_0x36daa6++){_0x165264[_0x36daa6]['updateAttributes']({'exitAt':_0x49010d});}}})[_0xd736('0x1b')](function(){var _0x4ee142=[];var _0x21f22e=utils[_0xd736('0x104')]();_0x21f22e[_0xd736('0xfc')](function(_0x5c1e7e){_0x4ee142[_0xd736('0x48')]({'channel':_0x5c1e7e,'membername':_0xf50421['name'],'interface':_[_0xd736('0x64')](_0xf50421[_0xd736('0xa8')])?util[_0xd736('0xa9')](_0xd736('0xf0'),_0xf50421[_0xd736('0x33')]):_0xf50421[_0xd736('0xa8')],'type':_0xd736('0x105'),'enterAt':moment()[_0xd736('0xa9')](_0xd736('0xfd')),'data1':_0x47f9f3['body'][_0xd736('0x39')]||_0xd736('0x106'),'role':_0xf50421[_0xd736('0x27')],'internal':_0xf50421['internal']});});return db[_0xd736('0xfb')]['bulkCreate'](_0x4ee142,{'individualHooks':!![]});})['then'](function(){return _0xf50421[_0xd736('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x47f9f3['body'][_0xd736('0x39')]||_0xd736('0x106'),'lastPauseAt':moment()[_0xd736('0xa9')](_0xd736('0xfd'))});})[_0xd736('0x1b')](respondWithResult(_0x3bce06,null))[_0xd736('0x25')](handleError(_0x3bce06,null));};exports[_0xd736('0x107')]=function(_0xef0ecd,_0x4dd7a4){if(_0xef0ecd[_0xd736('0x59')][_0xd736('0x99')]&&!utils[_0xd736('0x9c')](_0xef0ecd['body'][_0xd736('0x99')])){throw new APIBadRequestError(util[_0xd736('0xa9')](_0xd736('0x108'),_0xef0ecd[_0xd736('0x59')][_0xd736('0x99')]));}return db[_0xd736('0x36')]['find']({'where':{'id':_0xef0ecd[_0xd736('0x55')]['id']},'attributes':['id',_0xd736('0x33'),_0xd736('0x27'),_0xd736('0x5e'),_0xd736('0xa8'),_0xd736('0x9a'),_0xd736('0x9b'),_0xd736('0x109'),_0xd736('0x10a'),_0xd736('0x10b'),_0xd736('0x10c'),_0xd736('0x10d'),_0xd736('0x10e'),_0xd736('0x10f'),_0xd736('0x110')]})[_0xd736('0x1b')](function(_0x3c456a){if(!_0x3c456a){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0xef0ecd[_0xd736('0x55')]['id']));}return _0x3c456a[_0xd736('0x107')](_0xef0ecd[_0xd736('0x59')][_0xd736('0x99')]);})['then'](respondWithResult(_0x4dd7a4,null))[_0xd736('0x25')](APIHandleError(_0x4dd7a4));};exports['getTeams']=function(_0x503253,_0x455779){var _0x2d812c={};var _0x1cbbfe={};var _0x42a2c9;var _0x560151;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x503253[_0xd736('0x55')]['id']}})['then'](handleEntityNotFound(_0x455779,null))[_0xd736('0x1b')](function(_0x110cf2){if(_0x110cf2){_0x42a2c9=_0x110cf2;_0x1cbbfe['model']=_[_0xd736('0xcd')](db[_0xd736('0x111')][_0xd736('0xcf')]);_0x1cbbfe[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x503253[_0xd736('0x42')]);_0x1cbbfe[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x1cbbfe['model'],_0x1cbbfe['query']);_0x2d812c[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x1cbbfe[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x503253[_0xd736('0x42')][_0xd736('0xd2')]));_0x2d812c[_0xd736('0x47')]=_0x2d812c[_0xd736('0x47')][_0xd736('0x4c')]?_0x2d812c[_0xd736('0x47')]:_0x1cbbfe['model'];_0x2d812c[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x503253[_0xd736('0x42')][_0xd736('0xd3')]);_0x2d812c['where']=qs['filters'](_[_0xd736('0xd8')](_0x503253['query'],_0x1cbbfe['filters']));if(_0x503253[_0xd736('0x42')][_0xd736('0x2f')]){_0x2d812c[_0xd736('0x40')]=_[_0xd736('0x56')](_0x2d812c[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x2d812c[_0xd736('0x47')],function(_0x149fa0){var _0x10ce5f={};_0x10ce5f[_0x149fa0]={'$like':'%'+_0x503253['query'][_0xd736('0x2f')]+'%'};return _0x10ce5f;})});}_0x2d812c=_[_0xd736('0x56')]({},_0x2d812c,_0x503253[_0xd736('0x57')]);return _0x42a2c9['getTeams'](_0x2d812c);}})[_0xd736('0x1b')](function(_0x142e88){if(_0x142e88){_0x560151=_0x142e88[_0xd736('0x4c')];if(!_0x503253['query'][_0xd736('0xc7')](_0xd736('0xda'))){_0x2d812c[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x503253[_0xd736('0x42')][_0xd736('0x17')]);_0x2d812c[_0xd736('0x14')]=qs['offset'](_0x503253[_0xd736('0x42')][_0xd736('0x14')]);}return _0x42a2c9['getTeams'](_0x2d812c);}})[_0xd736('0x1b')](function(_0x3120ef){if(_0x3120ef){return _0x3120ef?{'count':_0x560151,'rows':_0x3120ef}:null;}})['then'](respondWithResult(_0x455779,null))[_0xd736('0x25')](handleError(_0x455779,null));};exports[_0xd736('0x112')]=function(_0x4388dc,_0xa5e31d){var _0x3c07ed=_0x4388dc[_0xd736('0x55')]['id'];var _0x2e7c86=_0x4388dc[_0xd736('0x59')]?_0x4388dc['body'][_0xd736('0x5c')]:null;var _0xbd18e6=[];return Promise[_0xd736('0x113')]()[_0xd736('0x1b')](function(){if(!_0x2e7c86)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd736('0x1b')](function(){return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x3c07ed}});})['then'](function(_0x1fabb5){if(!_0x1fabb5)throw new APINotFoundError(util[_0xd736('0xa9')](_0xd736('0xc6'),_0x4388dc[_0xd736('0x55')]['id']));return db[_0xd736('0x66')][_0xd736('0x114')](function(_0x40d0cc){return _0x1fabb5['addTeams'](_0x2e7c86,{'transaction':_0x40d0cc})['then'](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x2e7c86}}});})[_0xd736('0x1b')](function(_0x4b6896){var _0x29d0c2=_[_0xd736('0x37')](_0x4b6896,function(_0x27cb99){return _0x27cb99[_0xd736('0x115')]();});return Promise[_0xd736('0x53')](_0x29d0c2);})['then'](function(_0x400068){_0xbd18e6=_['flattenDeep'](_0x400068);var _0x190894=_['map'](_0xbd18e6,function(_0x3dbaac){return _0x3dbaac[_0xd736('0x116')](_0x1fabb5['id'],{'transaction':_0x40d0cc});});return Promise[_0xd736('0x53')](_0x190894);})['then'](function(){if(!_0x1fabb5[_0xd736('0x9a')])return;var _0x32f32c=_['filter'](_0xbd18e6,function(_0x1c2d13){return _0x1c2d13[_0xd736('0x117')](_0xd736('0x99'))===_0xd736('0x118');});var _0x2b16ba=_['map'](_0x32f32c,function(_0x55e7a7){return db[_0xd736('0xaa')][_0xd736('0x119')]({'membername':_0x1fabb5[_0xd736('0x33')],'UserId':_0x1fabb5['id'],'queue_name':_0x55e7a7[_0xd736('0x33')],'VoiceQueueId':_0x55e7a7['id'],'interface':_[_0xd736('0x64')](_0x1fabb5[_0xd736('0xa8')])?util['format'](_0xd736('0xf0'),_0x1fabb5[_0xd736('0x33')]):_0x1fabb5[_0xd736('0xa8')],'paused':_0x1fabb5[_0xd736('0x9b')]||![],'penalty':_0x1fabb5[_0xd736('0xa2')]},{'transaction':_0x40d0cc});});return Promise['all'](_0x2b16ba);})['then'](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x2e7c86}}});})[_0xd736('0x1b')](function(_0x25edce){var _0x606a4a=_[_0xd736('0x37')](_0x25edce,function(_0xf5d3a8){return db[_0xd736('0x11a')][_0xd736('0x7b')]({'UserId':_0x1fabb5['id'],'VoicePrefixId':_0xf5d3a8['VoicePrefixId']},{'transaction':_0x40d0cc});});return Promise['all'](_0x606a4a);});});})[_0xd736('0x1b')](function(){for(var _0x2a750a=0x0;_0x2a750a<_0xbd18e6[_0xd736('0x4c')];_0x2a750a++){var _0xf1cc61=_0xbd18e6[_0x2a750a]['getDataValue'](_0xd736('0x99'));var _0x4d0a48=_0xf1cc61+_0xd736('0xa4');socket['emit'](_0xd736('0x2d')+_0xf1cc61+_0xd736('0xa6'),{'UserId':_0x3c07ed,['queueField']:_0xbd18e6[_0x2a750a]['id']});}})[_0xd736('0x1b')](respondWithStatusCode(_0xa5e31d,null))['catch'](APIHandleError(_0xa5e31d));};exports[_0xd736('0x11b')]=function(_0x579f12,_0x310d08){var _0x991094=_0x579f12[_0xd736('0x55')]['id'];var _0xf484b2=null;if(_0x579f12[_0xd736('0x42')][_0xd736('0x5c')]){_0xf484b2=_[_0xd736('0x11c')](_0x579f12[_0xd736('0x42')][_0xd736('0x5c')])?_0x579f12[_0xd736('0x42')]['ids']:[_0x579f12[_0xd736('0x42')][_0xd736('0x5c')]];}var _0x46e84a=[];return Promise[_0xd736('0x113')]()['then'](function(){if(!_0xf484b2)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd736('0x1b')](function(){return db['User'][_0xd736('0x93')]({'where':{'id':_0x991094}});})['then'](function(_0x4c645e){if(!_0x4c645e)throw new APINotFoundError(util['format'](_0xd736('0xc6'),_0x579f12[_0xd736('0x55')]['id']));return db[_0xd736('0x66')][_0xd736('0x114')](function(_0x1b8e50){return _0x4c645e[_0xd736('0x11b')](_0xf484b2,{'transaction':_0x1b8e50})['then'](function(){return db[_0xd736('0x111')][_0xd736('0x49')]({'where':{'id':{'$in':_0xf484b2}}});})[_0xd736('0x1b')](function(_0x514c99){var _0x387466=_['map'](_0x514c99,function(_0x1af0ce){return _0x1af0ce['getAssociatedQueues']();});return Promise[_0xd736('0x53')](_0x387466);})[_0xd736('0x1b')](function(_0x728faa){_0x46e84a=_[_0xd736('0x11d')](_0x728faa);var _0x4a7ecb=_['map'](_0x46e84a,function(_0x37eb94){return _0x37eb94[_0xd736('0x11e')](_0x4c645e['id'],{'transaction':_0x1b8e50});});return Promise[_0xd736('0x53')](_0x4a7ecb);})[_0xd736('0x1b')](function(){if(!_0x4c645e[_0xd736('0x9a')])return;var _0x3dfdab=_[_0xd736('0x2f')](_0x46e84a,function(_0x5bb74d){return _0x5bb74d['getDataValue'](_0xd736('0x99'))==='Voice';});var _0x207f3b=_[_0xd736('0x37')](_0x3dfdab,function(_0x3a62ed){return db['UserVoiceQueueRt'][_0xd736('0x2a')]({'where':{'VoiceQueueId':_0x3a62ed['id'],'UserId':_0x4c645e['id']},'transaction':_0x1b8e50});});return Promise[_0xd736('0x53')](_0x207f3b);})['then'](function(){return db[_0xd736('0x11f')]['findAll']({'where':{'teamId':{'$in':_0xf484b2}}});})[_0xd736('0x1b')](function(_0x4861c1){var _0x1ad5ae=_[_0xd736('0x37')](_0x4861c1,function(_0x20d53e){return db[_0xd736('0x11a')][_0xd736('0x2a')]({'where':{'UserId':_0x4c645e['id'],'VoicePrefixId':_0x20d53e[_0xd736('0x120')]}},{'transaction':_0x1b8e50});});return Promise[_0xd736('0x53')](_0x1ad5ae);});});})[_0xd736('0x1b')](function(){for(var _0x3792f8=0x0;_0x3792f8<_0x46e84a[_0xd736('0x4c')];_0x3792f8++){var _0xa015c7=_0x46e84a[_0x3792f8]['getDataValue'](_0xd736('0x99'));var _0x15fc10=_0xa015c7+'QueueId';socket['emit']('user'+_0xa015c7+_0xd736('0xad'),{'UserId':_0x991094,['queueField']:_0x46e84a[_0x3792f8]['id']});}})[_0xd736('0x1b')](respondWithStatusCode(_0x310d08,null))[_0xd736('0x25')](APIHandleError(_0x310d08));};exports[_0xd736('0x121')]=function(_0x1704bd,_0x59c952){var _0x932f3c={};var _0x5521dc={};var _0x4be697;var _0x100c01;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x1704bd['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x59c952,null))[_0xd736('0x1b')](function(_0x1a5b34){if(_0x1a5b34){_0x4be697=_0x1a5b34;_0x5521dc[_0xd736('0xcc')]=_[_0xd736('0xcd')](db['CmList'][_0xd736('0xcf')]);_0x5521dc['query']=_[_0xd736('0xcd')](_0x1704bd['query']);_0x5521dc['filters']=_['intersection'](_0x5521dc[_0xd736('0xcc')],_0x5521dc[_0xd736('0x42')]);_0x932f3c['attributes']=_[_0xd736('0xd1')](_0x5521dc[_0xd736('0xcc')],qs['fields'](_0x1704bd[_0xd736('0x42')][_0xd736('0xd2')]));_0x932f3c['attributes']=_0x932f3c['attributes'][_0xd736('0x4c')]?_0x932f3c['attributes']:_0x5521dc[_0xd736('0xcc')];_0x932f3c['order']=qs['sort'](_0x1704bd[_0xd736('0x42')]['sort']);_0x932f3c[_0xd736('0x40')]=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x1704bd[_0xd736('0x42')],_0x5521dc[_0xd736('0xd0')]));if(_0x1704bd[_0xd736('0x42')]['filter']){_0x932f3c[_0xd736('0x40')]=_[_0xd736('0x56')](_0x932f3c[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x932f3c[_0xd736('0x47')],function(_0x3eb929){var _0x509fe8={};_0x509fe8[_0x3eb929]={'$like':'%'+_0x1704bd['query'][_0xd736('0x2f')]+'%'};return _0x509fe8;})});}_0x932f3c=_[_0xd736('0x56')]({},_0x932f3c,_0x1704bd[_0xd736('0x57')]);return _0x4be697[_0xd736('0x121')](_0x932f3c);}})[_0xd736('0x1b')](function(_0x2b698e){if(_0x2b698e){_0x100c01=_0x2b698e[_0xd736('0x4c')];if(!_0x1704bd[_0xd736('0x42')]['hasOwnProperty'](_0xd736('0xda'))){_0x932f3c[_0xd736('0x17')]=qs['limit'](_0x1704bd[_0xd736('0x42')][_0xd736('0x17')]);_0x932f3c['offset']=qs[_0xd736('0x14')](_0x1704bd[_0xd736('0x42')]['offset']);}return _0x4be697[_0xd736('0x121')](_0x932f3c);}})['then'](function(_0x3ad132){if(_0x3ad132){return _0x3ad132?{'count':_0x100c01,'rows':_0x3ad132}:null;}})['then'](respondWithResult(_0x59c952,null))[_0xd736('0x25')](handleError(_0x59c952,null));};exports[_0xd736('0x122')]=function(_0x4208bb,_0x1639f9){var _0x31076d={};var _0x5d7def={};var _0x40ae7a;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x4208bb['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x1639f9,null))[_0xd736('0x1b')](function(_0x5be96f){if(_0x5be96f){_0x40ae7a=_0x5be96f;_0x5d7def['model']=_[_0xd736('0xcd')](db[_0xd736('0x36')]['rawAttributes']);_0x5d7def['query']=_[_0xd736('0xcd')](_0x4208bb[_0xd736('0x42')]);_0x5d7def[_0xd736('0xd0')]=_['intersection'](_0x5d7def[_0xd736('0xcc')],_0x5d7def['query']);_0x31076d['attributes']=_[_0xd736('0xd1')](_0x5d7def[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x4208bb['query'][_0xd736('0xd2')]));_0x31076d[_0xd736('0x47')]=_0x31076d[_0xd736('0x47')][_0xd736('0x4c')]?_0x31076d[_0xd736('0x47')]:_0x5d7def['model'];_0x31076d[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x4208bb['query'][_0xd736('0xd3')]);_0x31076d['where']=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x4208bb[_0xd736('0x42')],_0x5d7def[_0xd736('0xd0')]));if(_0x4208bb[_0xd736('0x42')][_0xd736('0x2f')]){_0x31076d[_0xd736('0x40')]=_[_0xd736('0x56')](_0x31076d[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x31076d[_0xd736('0x47')],function(_0x17b79e){var _0x50f84f={};_0x50f84f[_0x17b79e]={'$like':'%'+_0x4208bb[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x50f84f;})});}_0x31076d[_0xd736('0xcc')]=db['User'];_0x31076d['as']=_0xd736('0x2e');_0x31076d=_['merge']({},_0x31076d,_0x4208bb['options']);return _0x40ae7a[_0xd736('0x123')]({'include':[_0x31076d]});}})[_0xd736('0x1b')](function(_0x4f44fa){if(_0x4f44fa){var _0x547e8a={},_0x14d409=[];for(var _0x942491=0x0;_0x942491<_0x4f44fa['length'];_0x942491+=0x1){for(var _0x1b08d6=0x0,_0x5d2dab;_0x1b08d6<_0x4f44fa[_0x942491][_0xd736('0x2e')][_0xd736('0x4c')];_0x1b08d6+=0x1){_0x5d2dab=_0x4f44fa[_0x942491][_0xd736('0x2e')][_0x1b08d6][_0xd736('0xd4')]({'plain':!![]});_0x547e8a[_0x5d2dab['id']]=_0x5d2dab;}}_0x547e8a=_[_0xd736('0x124')](_0x547e8a);for(var _0x5d4d74=qs['offset'](_0x4208bb[_0xd736('0x42')][_0xd736('0x14')]);_0x5d4d74<_0x547e8a['length']&&_0x14d409[_0xd736('0x4c')]=_0x3d5f98){_0xd91226=_0x3d5f98;_0x4b712e=0xc8;}else{_0x4b712e=0xce;}_0x24dd18[_0x2664('0x1a')](_0x4b712e);return _0x24dd18[_0x2664('0x1b')](_0x2664('0x1c'),_0x568b90+'-'+_0xd91226+'/'+_0x3d5f98)['json'](_0x3e80d0);}return null;};}function respondWithRpcPromise(_0x4e61be,_0x1b5b31,_0x3915f4,_0x56470d){return new Promise(function(_0x5abe9d,_0x488b1d){var _0xca479=_0x56470d||amiClient;return _0xca479['request'](_0x4e61be,_0x3915f4)[_0x2664('0x1d')](function(_0xe9783c){logger[_0x2664('0x1e')](_0x2664('0x1f'),_0x1b5b31,_0x2664('0x20'));logger[_0x2664('0x21')]('User,\x20%s,\x20%s,\x20%s',_0x1b5b31,_0x2664('0x20'),JSON['stringify'](_0xe9783c));if(_0xe9783c[_0x2664('0x22')]){if(_0xe9783c[_0x2664('0x22')][_0x2664('0x23')]===0x1f4){logger[_0x2664('0x22')]('User,\x20%s,\x20%s',_0x1b5b31,_0xe9783c[_0x2664('0x22')][_0x2664('0x24')]);return _0x488b1d(_0xe9783c[_0x2664('0x22')]['message']);}logger['error'](_0x2664('0x1f'),_0x1b5b31,_0xe9783c[_0x2664('0x22')][_0x2664('0x24')]);return _0x5abe9d(_0xe9783c[_0x2664('0x22')]['message']);}else{logger[_0x2664('0x1e')](_0x2664('0x1f'),_0x1b5b31,'request\x20sent');_0x5abe9d(_0xe9783c['result'][_0x2664('0x24')]);}})['catch'](function(_0xc4c3f2){logger[_0x2664('0x22')](_0x2664('0x1f'),_0x1b5b31,_0xc4c3f2);_0x488b1d(_0xc4c3f2);});});}function saveUpdates(_0x54b0c5){return function(_0x25e826){if(_0x25e826){return _0x25e826['update'](_0x54b0c5)[_0x2664('0x1d')](function(_0x3001e8){if(_0x3001e8[_0x2664('0x25')]===_0x2664('0x26')){socket[_0x2664('0x27')](_0x2664('0x28')+_0x3001e8['id'],_0x3001e8);}return _0x3001e8;});}return null;};}function removeEntity(_0x479c10,_0xa6d0ca){return function(_0x4ed40a){if(_0x4ed40a){return _0x4ed40a[_0x2664('0x29')]({'transaction':_0xa6d0ca})['then'](function(){var _0x3b2e55=_0x4ed40a[_0x2664('0x2a')]({'plain':!![]});if(_0x3b2e55[_0x2664('0x25')]==='admin')return;var _0xa933e=[{'name':_0x2664('0x2b'),'value':_0x2664('0x2c'),'ignore':!![]},{'name':'Agents','value':_0x2664('0x26'),'ignore':![]},{'name':_0x2664('0x2d'),'value':_0x2664('0x2e'),'ignore':![]}];var _0x2ec997=_(_0xa933e)[_0x2664('0x2f')](_0x2664('0x30'))[_0x2664('0x31')](_0x2664('0x32'))[_0x2664('0x32')]();if(_['includes'](_0x2ec997,_0x3b2e55[_0x2664('0x25')])){return;}var _0x4208ac=_['find'](_0xa933e,[_0x2664('0x32'),_0x3b2e55[_0x2664('0x25')]])[_0x2664('0x33')];return db[_0x2664('0x34')]['destroy']({'where':{'type':_0x4208ac,'resourceId':_0x3b2e55['id']},'transaction':_0xa6d0ca})[_0x2664('0x1d')](function(){return _0x4ed40a;});})[_0x2664('0x1d')](function(){_0x479c10['status'](0xcc)[_0x2664('0x15')]();});}};}function handleEntityNotFound(_0x30e098){return function(_0x2abc04){if(!_0x2abc04){_0x30e098[_0x2664('0x14')](0x194);}return _0x2abc04;};}function handleError(_0x1d9cf0,_0x314c35){_0x314c35=_0x314c35||0x1f4;return function(_0x5d8feb){logger[_0x2664('0x22')](_0x5d8feb[_0x2664('0x35')]);if(_0x5d8feb[_0x2664('0x33')]){delete _0x5d8feb[_0x2664('0x33')];}_0x1d9cf0[_0x2664('0x1a')](_0x314c35)['send'](_0x5d8feb);};}function getUserAttributes(){return _(db[_0x2664('0x36')]['rawAttributes'])[_0x2664('0x31')](function(_0x29ec9b){return{'name':_0x29ec9b[_0x2664('0x37')],'type':_0x29ec9b['type']['key']};})[_0x2664('0x2f')](function(_0x4f8dea){return!['password',_0x2664('0x38'),_0x2664('0x39'),_0x2664('0x3a'),'resetPasswordExpires',_0x2664('0x3b')]['includes'](_0x4f8dea[_0x2664('0x33')]);})['value']();}exports[_0x2664('0x3c')]=function(_0x1bc38e,_0x5c784d){var _0x50127b={},_0x4c66fd={'count':0x0,'rows':[]};var _0x4f6894=getUserAttributes();_0x50127b=qs[_0x2664('0x3d')](_0x4f6894,_0x1bc38e);var _0x434d70={'where':_0x50127b[_0x2664('0x3e')]};return db['User'][_0x2664('0x18')](_0x434d70)[_0x2664('0x1d')](function(_0x3a98c0){_0x4c66fd['count']=_0x3a98c0;if(_0x1bc38e[_0x2664('0x3f')][_0x2664('0x40')]){_0x50127b[_0x2664('0x41')]=[{'all':!![]}];}if(_0x1bc38e[_0x2664('0x3f')][_0x2664('0x42')]===_0x2664('0x43')){_0x50127b[_0x2664('0x41')]=[{'model':db[_0x2664('0x44')],'as':_0x2664('0x42')}];}if(!_['includes'](_0x50127b['attributes'],'id')){_0x50127b[_0x2664('0x45')][_0x2664('0x46')]('id');}return db[_0x2664('0x36')][_0x2664('0x47')](_0x50127b);})[_0x2664('0x1d')](function(_0x4743b6){_0x4c66fd[_0x2664('0x48')]=_0x4743b6;if(_0x1bc38e[_0x2664('0x3f')][_0x2664('0x49')]===_0x2664('0x43')){var _0x198406=[];for(var _0x5489a7=0x0;_0x5489a7<_0x4c66fd[_0x2664('0x48')][_0x2664('0x4a')];_0x5489a7++){_0x198406['push'](get_open_tabs('chat',_0x4c66fd[_0x2664('0x48')][_0x5489a7][_0x2664('0x4b')]));_0x198406[_0x2664('0x46')](get_open_tabs(_0x2664('0x4c'),_0x4c66fd[_0x2664('0x48')][_0x5489a7][_0x2664('0x4b')]));_0x198406[_0x2664('0x46')](get_open_tabs(_0x2664('0x4d'),_0x4c66fd[_0x2664('0x48')][_0x5489a7][_0x2664('0x4b')]));_0x198406[_0x2664('0x46')](get_open_tabs('mail',_0x4c66fd['rows'][_0x5489a7]['dataValues']));_0x198406[_0x2664('0x46')](get_open_tabs(_0x2664('0x4e'),_0x4c66fd[_0x2664('0x48')][_0x5489a7][_0x2664('0x4b')]));_0x198406['push'](get_open_tabs('whatsapp',_0x4c66fd['rows'][_0x5489a7]['dataValues']));}return Promise[_0x2664('0x4f')](_0x198406)[_0x2664('0x1d')](function(){return _0x4c66fd;});}else{return _0x4c66fd;}})[_0x2664('0x1d')](respondWithFilteredResult(_0x5c784d,_0x50127b))[_0x2664('0x50')](handleError(_0x5c784d,null));};exports['show']=function(_0x5de51d,_0x353bb2){var _0x4c6371=getUserAttributes();_0x5de51d[_0x2664('0x3f')]['id']=_0x5de51d[_0x2664('0x51')]['id'];var _0xf603e7=qs['getOptions'](_0x4c6371,_0x5de51d);if(_0x5de51d[_0x2664('0x3f')]['includeAll']){_0xf603e7['include']=[{'all':!![]}];}if(_0x5de51d[_0x2664('0x3f')][_0x2664('0x42')]===_0x2664('0x43')){_0xf603e7['include']=[{'model':db[_0x2664('0x44')],'as':_0x2664('0x42')}];}_0xf603e7=_[_0x2664('0x52')]({},_0xf603e7,_0x5de51d['options']);if(!_[_0x2664('0x53')](_0xf603e7[_0x2664('0x45')],'id')){_0xf603e7['attributes'][_0x2664('0x46')]('id');}return db[_0x2664('0x36')]['find'](_0xf603e7)[_0x2664('0x1d')](handleEntityNotFound(_0x353bb2,null))['then'](function(_0x5e4314){var _0x5171cc=[];values=_0x5e4314;if(_0x5de51d[_0x2664('0x3f')][_0x2664('0x49')]===_0x2664('0x43')){_0x5171cc[_0x2664('0x46')](get_open_tabs(_0x2664('0x54'),_0x5e4314[_0x2664('0x4b')]));_0x5171cc['push'](get_open_tabs(_0x2664('0x4c'),_0x5e4314[_0x2664('0x4b')]));_0x5171cc[_0x2664('0x46')](get_open_tabs(_0x2664('0x4e'),_0x5e4314['dataValues']));_0x5171cc['push'](get_open_tabs(_0x2664('0x55'),_0x5e4314[_0x2664('0x4b')]));_0x5171cc[_0x2664('0x46')](get_open_tabs(_0x2664('0x4d'),_0x5e4314[_0x2664('0x4b')]));_0x5171cc[_0x2664('0x46')](get_open_tabs(_0x2664('0x56'),_0x5e4314[_0x2664('0x4b')]));return Promise['all'](_0x5171cc);}else{return values;}})[_0x2664('0x1d')](function(){return values;})[_0x2664('0x1d')](respondWithResult(_0x353bb2,null))[_0x2664('0x50')](handleError(_0x353bb2,null));};exports[_0x2664('0x57')]=function(_0x1acc0e,_0x40c244){if(_0x1acc0e[_0x2664('0x58')]['id']){delete _0x1acc0e['body']['id'];}delete _0x1acc0e[_0x2664('0x58')]['role'];return db[_0x2664('0x36')][_0x2664('0x59')]({'where':{'id':_0x1acc0e[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x40c244,null))[_0x2664('0x1d')](saveUpdates(_0x1acc0e[_0x2664('0x58')],null))[_0x2664('0x1d')](respondWithResult(_0x40c244,null))[_0x2664('0x50')](handleError(_0x40c244,null));};exports[_0x2664('0x5a')]=function(_0x2410bd,_0x43181b){return db[_0x2664('0x36')]['describe']()[_0x2664('0x1d')](respondWithResult(_0x43181b,null))['catch'](handleError(_0x43181b,null));};exports[_0x2664('0x5b')]=function(_0x76aae1,_0x518d03){return db[_0x2664('0x36')][_0x2664('0x59')]({'where':{'id':_0x76aae1[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x518d03,null))['then'](function(_0x373ac8){if(_0x373ac8){return _0x373ac8[_0x2664('0x5b')](_0x76aae1['body'][_0x2664('0x5c')],_[_0x2664('0x5d')](_0x76aae1[_0x2664('0x58')],[_0x2664('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x518d03,null))['catch'](handleError(_0x518d03,null));};function validateUser(_0x274aaa){return new Promise(function(_0x46455b,_0x4a392c){if(_0x274aaa[_0x2664('0x5e')])return _0x46455b(_0x274aaa);return db[_0x2664('0x5f')][_0x2664('0x60')](0x1)[_0x2664('0x1d')](function(_0x55a30e){if(_0x55a30e['securePassword'])authService[_0x2664('0x61')](_0x274aaa[_0x2664('0x62')]);db['User'][_0x2664('0x63')](_0x2664('0x5e'))[_0x2664('0x1d')](function(_0x378dd3){if(_[_0x2664('0x64')](_0x378dd3)){_0x274aaa[_0x2664('0x5e')]=_0x55a30e[_0x2664('0x65')]||0x1;return;}if(_[_0x2664('0x64')](_0x55a30e[_0x2664('0x65')])||_0x55a30e[_0x2664('0x65')]===_0x378dd3){_0x274aaa[_0x2664('0x5e')]=_0x378dd3+0x1;return;}if(_0x55a30e[_0x2664('0x65')]>_0x378dd3){_0x274aaa[_0x2664('0x5e')]=_0x55a30e['min_internal'];return;}return db[_0x2664('0x66')][_0x2664('0x3f')](_0x2664('0x67'),{'type':db[_0x2664('0x66')][_0x2664('0x68')][_0x2664('0x69')]})['then'](function(_0x2a0b4a){if(_0x2a0b4a&&_0x2a0b4a['length']){for(var _0x4bdbaf=0x0,_0x3f8ead=_0x2a0b4a[_0x2664('0x4a')];_0x4bdbaf<_0x3f8ead&&_[_0x2664('0x64')](_0x274aaa[_0x2664('0x5e')]);_0x4bdbaf++){if(_0x55a30e['min_internal']<=_0x2a0b4a[_0x4bdbaf]['from']){_0x274aaa['internal']=_0x2a0b4a[_0x4bdbaf][_0x2664('0x6a')];}else if(_0x55a30e['min_internal']>_0x2a0b4a[_0x4bdbaf][_0x2664('0x6a')]&&_0x55a30e[_0x2664('0x65')]<=_0x2a0b4a[_0x4bdbaf]['to']){_0x274aaa[_0x2664('0x5e')]=_0x55a30e[_0x2664('0x65')];}}}if(_[_0x2664('0x64')](_0x274aaa['internal'])){_0x274aaa[_0x2664('0x5e')]=_0x378dd3+0x1;}return _0x46455b(_0x274aaa);});});})[_0x2664('0x50')](function(_0x44d91b){_0x4a392c(_0x44d91b);});});}function updateUser(_0x103de3){return new Promise(function(_0x54acc4,_0x1fb7b1){try{if(_0x103de3['voicemail']){_0x103de3[_0x2664('0x6b')]=_0x103de3[_0x2664('0x5e')];_0x103de3[_0x2664('0x6c')]={'mailbox':_0x103de3[_0x2664('0x5e')],'password':_0x103de3[_0x2664('0x62')],'fullname':_0x103de3[_0x2664('0x6d')],'email':_0x103de3['email']};}if(_0x103de3[_0x2664('0x25')]===_0x2664('0x26')){if(!_0x103de3[_0x2664('0x6e')])_0x103de3[_0x2664('0x6e')]=[_0x2664('0x6f'),_0x2664('0x70'),_0x2664('0x71'),_0x2664('0x72'),_0x2664('0x73'),_0x2664('0x74'),_0x2664('0x75'),'106',_0x2664('0x76'),_0x2664('0x77'),_0x2664('0x78'),_0x2664('0x79'),'111',_0x2664('0x7a'),_0x2664('0x7b')];}_0x54acc4(_0x103de3);}catch(_0x23889b){_0x1fb7b1(_0x23889b);}});}exports[_0x2664('0x7c')]=function(_0x325eb7,_0xf7edf9){if(_0x325eb7[_0x2664('0x2c')][_0x2664('0x25')]==='agent')throw new Error(_0x2664('0x7d'));if(_0x325eb7[_0x2664('0x58')][_0x2664('0x25')]==='user'&&_0x325eb7[_0x2664('0x2c')][_0x2664('0x25')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x325eb7[_0x2664('0x58')]['role']==='admin'&&_0x325eb7[_0x2664('0x2c')]['role']!==_0x2664('0x7e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x325eb7[_0x2664('0x58')]])[_0x2664('0x1d')](function(){return validateUser(_0x325eb7[_0x2664('0x58')]);})[_0x2664('0x1d')](function(_0x443153){return updateUser(_0x443153)[_0x2664('0x1d')](function(_0x532343){if(_0x532343[_0x2664('0x25')]===_0x2664('0x7e')){_0x532343[_0x2664('0x7f')]=_0x325eb7[_0x2664('0x2c')]['settingsEnabled'];delete _0x532343['userProfileId'];}return _0x532343;});})[_0x2664('0x1d')](function(_0x13f67a){return db[_0x2664('0x36')]['create'](_0x13f67a,{'include':[{'model':db[_0x2664('0x6c')],'as':_0x2664('0x6c')}]});})[_0x2664('0x1d')](function(_0x3f7979){if(_0x325eb7[_0x2664('0x58')][_0x2664('0x25')]==='user')return _0x3f7979;if(_0x325eb7[_0x2664('0x2c')][_0x2664('0x25')]!==_0x2664('0x2c'))return _0x3f7979;return db[_0x2664('0x80')][_0x2664('0x59')]({'where':{'name':_0x3f7979['role']===_0x2664('0x26')?_0x2664('0x81'):'Telephones','userProfileId':_0x325eb7[_0x2664('0x2c')][_0x2664('0x82')]},'raw':!![]})[_0x2664('0x1d')](function(_0x54b5d4){if(!_0x54b5d4||_0x54b5d4[_0x2664('0x83')]!=0x0)return _0x3f7979;return db[_0x2664('0x34')][_0x2664('0x7c')]({'name':_0x3f7979[_0x2664('0x33')],'resourceId':_0x3f7979['id'],'type':_0x54b5d4[_0x2664('0x33')],'sectionId':_0x54b5d4['id']},{})[_0x2664('0x1d')](function(){return _0x3f7979;});})['catch'](function(_0x2836d0){logger[_0x2664('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2836d0);throw _0x2836d0;});})[_0x2664('0x1d')](respondWithResult(_0xf7edf9,0xc9))[_0x2664('0x50')](handleError(_0xf7edf9,null));};exports['bulkCreate']=function(_0x105fd0,_0xa68af0){var _0x4ac3ed=_0x105fd0[_0x2664('0x58')];var _0x33eae9=[];if(_0x105fd0['user']['role']===_0x2664('0x26'))throw new Error(_0x2664('0x7d'));if(_[_0x2664('0x84')](_0x4ac3ed,[_0x2664('0x25'),_0x2664('0x2c')])&&_0x105fd0['user']['role']!==_0x2664('0x7e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x2664('0x84')](_0x4ac3ed,['role',_0x2664('0x7e')])&&_0x105fd0[_0x2664('0x2c')]['role']!=='admin'){throw new Error(_0x2664('0x85'));}return licenseUtil['checkUserLimits'](_0x4ac3ed)[_0x2664('0x1d')](function(){return validateUser(_0x4ac3ed[0x0]);})[_0x2664('0x1d')](function(){for(var _0x5aa01b=0x1;_0x5aa01b<_0x4ac3ed[_0x2664('0x4a')];_0x5aa01b++){var _0x1c7c13=_0x4ac3ed[_0x5aa01b-0x1][_0x2664('0x5e')];if(!_0x4ac3ed[_0x5aa01b][_0x2664('0x5e')])_0x4ac3ed[_0x5aa01b][_0x2664('0x5e')]=_0x1c7c13+0x1;_0x33eae9[_0x2664('0x46')](validateUser(_0x4ac3ed[_0x5aa01b]));}return Promise[_0x2664('0x4f')](_0x33eae9);})[_0x2664('0x1d')](function(){_0x33eae9=[];for(var _0x13e9ee=0x0;_0x13e9ee<_0x4ac3ed['length'];_0x13e9ee++){_0x33eae9['push'](updateUser(_0x4ac3ed[_0x13e9ee]));}return Promise[_0x2664('0x4f')](_0x33eae9);})[_0x2664('0x1d')](function(){_0x33eae9=_0x4ac3ed['map'](function(_0x51457b){return db[_0x2664('0x36')]['create'](_0x51457b,{'include':[{'model':db[_0x2664('0x6c')],'as':_0x2664('0x6c')}]})[_0x2664('0x1d')](function(_0x500728){_0x51457b['id']=_0x500728['id'];return _0x51457b;});});return Promise[_0x2664('0x4f')](_0x33eae9);})['then'](function(_0x4b5285){if(_0x105fd0[_0x2664('0x58')][_0x2664('0x25')]===_0x2664('0x2c'))return _0x4b5285;if(_0x105fd0[_0x2664('0x2c')][_0x2664('0x25')]!=='user')return _0x4b5285;var _0x21e404=_['some'](_0x4b5285,function(_0x1bb4a3){return _0x1bb4a3['role']===_0x2664('0x26')||_0x1bb4a3[_0x2664('0x25')]==='telephone';});if(!_0x21e404)return _0x4b5285;return db[_0x2664('0x80')][_0x2664('0x47')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x105fd0[_0x2664('0x2c')][_0x2664('0x82')]},'raw':!![]})[_0x2664('0x1d')](function(_0x3ff72f){if(_[_0x2664('0x86')](_0x3ff72f)||!_[_0x2664('0x84')](_0x3ff72f,['autoAssociation',0x0]))return _0x4b5285;_0x33eae9=[];var _0x74cf47=_(_0x3ff72f)[_0x2664('0x31')](function(_0x57e071){if(_0x57e071[_0x2664('0x83')]===0x1)return;return _0x57e071[_0x2664('0x33')]===_0x2664('0x81')?'agent':_0x2664('0x2e');})[_0x2664('0x87')]()[_0x2664('0x32')]();for(var _0x19802e=0x0;_0x19802e<_0x4b5285[_0x2664('0x4a')];_0x19802e++){if(!_['includes'](_0x74cf47,_0x4b5285[_0x19802e][_0x2664('0x25')]))return;var _0x4961ab=_0x4b5285[_0x19802e]['role']==='agent'?_0x2664('0x81'):_0x2664('0x2d');_0x33eae9['push'](db[_0x2664('0x34')]['create']({'name':_0x4b5285[_0x19802e][_0x2664('0x33')],'resourceId':_0x4b5285[_0x19802e]['id'],'type':_0x4961ab,'sectionId':_[_0x2664('0x59')](_0x3ff72f,[_0x2664('0x33'),_0x4961ab])['id']},{}));}return Promise['all'](_0x33eae9);});})[_0x2664('0x1d')](respondWithResult(_0xa68af0,0xc9))[_0x2664('0x50')](handleError(_0xa68af0,null));};exports[_0x2664('0x88')]=function(_0x464dd0,_0x20e800){if(_0x464dd0[_0x2664('0x58')]['id']){delete _0x464dd0[_0x2664('0x58')]['id'];}return db[_0x2664('0x36')][_0x2664('0x59')]({'where':{'id':_0x464dd0[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](function(_0x561d9b){if(!_0x561d9b)return null;if(_0x561d9b['id']===_0x464dd0['user']['id']){if(!_0x464dd0[_0x2664('0x58')][_0x2664('0x89')]||!_0x464dd0[_0x2664('0x58')][_0x2664('0x8a')]){throw new db[(_0x2664('0x8b'))][(_0x2664('0x8c'))](_0x2664('0x8d'));}if(!_0x561d9b['authenticate'](_0x464dd0[_0x2664('0x58')][_0x2664('0x89')])){throw new db[(_0x2664('0x8b'))]['ValidationError']('Wrong\x20credentials');}if(_0x464dd0[_0x2664('0x58')]['oldPassword']===_0x464dd0['body'][_0x2664('0x8a')]){throw new db['Sequelize'][(_0x2664('0x8c'))](_0x2664('0x8e'));}}else if(_0x464dd0[_0x2664('0x2c')][_0x2664('0x25')]===_0x2664('0x7e')){if(!_0x464dd0[_0x2664('0x58')][_0x2664('0x8a')]){throw new db[(_0x2664('0x8b'))][(_0x2664('0x8c'))](_0x2664('0x8f'));}}else if(_0x464dd0['user']['role']===_0x2664('0x2c')){if(!_0x464dd0['body'][_0x2664('0x8a')]){throw new db[(_0x2664('0x8b'))]['ValidationError'](_0x2664('0x8f'));}if(_0x561d9b[_0x2664('0x25')]!=='agent'){throw new db[(_0x2664('0x8b'))][(_0x2664('0x8c'))](_0x2664('0x7d'));}}else{throw new db[(_0x2664('0x8b'))][(_0x2664('0x8c'))](_0x2664('0x7d'));}return _0x561d9b;})[_0x2664('0x1d')](handleEntityNotFound(_0x20e800,null))[_0x2664('0x1d')](function(_0x223625){return db[_0x2664('0x5f')][_0x2664('0x90')]({'attributes':['id',_0x2664('0x91'),_0x2664('0x92'),_0x2664('0x93')]})['then'](function(_0x17590a){if(_0x17590a[_0x2664('0x91')])authService[_0x2664('0x61')](_0x464dd0[_0x2664('0x58')][_0x2664('0x8a')]);if(!_0x17590a[_0x2664('0x92')]||!_0x223625['previousPasswords'])return _0x223625;authService['validatePasswordHistory'](_0x464dd0['body'][_0x2664('0x8a')],_0x223625[_0x2664('0x39')],_0x17590a['passwordHistoryLimit']);return _0x223625;})[_0x2664('0x1d')](saveUpdates({'password':_0x464dd0[_0x2664('0x58')]['newPassword'],'passwordResetAt':_0x464dd0[_0x2664('0x2c')]['id']==_0x464dd0[_0x2664('0x51')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x464dd0['body']['newPassword'],_0x223625['previousPasswords'])},null));})[_0x2664('0x1d')](respondWithResult(_0x20e800,null))['catch'](handleError(_0x20e800,null));};exports[_0x2664('0x94')]=function(_0xbc165c,_0x2dca0d){var _0x31b603=_0xbc165c[_0x2664('0x58')]['channel'];return db['User'][_0x2664('0x59')]({'where':{'id':_0xbc165c[_0x2664('0x51')]['id']},'attributes':['id',_0x2664('0x33'),'role','online',_0x2664('0x95'),_0x2664('0x96'),_0x2664('0x97')]})[_0x2664('0x1d')](handleEntityNotFound(_0x2dca0d,null))[_0x2664('0x1d')](function(_0x280803){if(_0x280803){if(!utils[_0x2664('0x98')](_0x31b603)){throw new db['Sequelize']['ValidationError'](_0x2664('0x99'));}return _0x280803[_0x2664('0x9a')+_[_0x2664('0x9b')](_0x31b603[_0x2664('0x9c')]())+_0x2664('0x9d')](_0xbc165c['body'][_0x2664('0x5c')],{'penalty':_0xbc165c[_0x2664('0x58')][_0x2664('0x9e')]||0x0})['spread'](function(_0x2a8560){for(var _0x7c23a4=0x0;_0x7c23a4<_0xbc165c['body'][_0x2664('0x5c')][_0x2664('0x4a')];_0x7c23a4+=0x1){var _0x472f68={'UserId':Number(_0xbc165c[_0x2664('0x51')]['id'])};_0x472f68[_['capitalize'](_0x31b603['toLowerCase']())+_0x2664('0x9f')]=Number(_0xbc165c[_0x2664('0x58')][_0x2664('0x5c')][_0x7c23a4]);socket[_0x2664('0x27')](_0x2664('0x2c')+_[_0x2664('0x9b')](_0x31b603[_0x2664('0x9c')]())+_0x2664('0xa0'),_0x472f68);}return _0x2a8560;})['then'](function(){if(_0x31b603===_0x2664('0xa1')){return db[_0x2664('0xa2')][_0x2664('0x47')]({'where':{'id':_0xbc165c[_0x2664('0x58')]['ids']||[]},'raw':!![],'attributes':['id',_0x2664('0x33')]});}})[_0x2664('0x1d')](function(_0x24b82b){var _0x3ded5d=_0x280803[_0x2664('0x2a')]({'plain':!![]});var _0x18abff=[];if(_0x31b603===_0x2664('0xa1')&&_0x3ded5d[_0x2664('0x25')]===_0x2664('0x26')&&_0x3ded5d[_0x2664('0xa3')]){for(let _0x37164=0x0;_0x37164<_0x24b82b[_0x2664('0x4a')];_0x37164+=0x1){_0x18abff['push']({'membername':_0x3ded5d[_0x2664('0x33')],'UserId':_0x3ded5d['id'],'queue_name':_0x24b82b[_0x37164]['name'],'VoiceQueueId':_0x24b82b[_0x37164]['id'],'interface':_[_0x2664('0x64')](_0x3ded5d['interface'])?util[_0x2664('0xa4')](_0x2664('0xa5'),_0x3ded5d[_0x2664('0x33')]):_0x3ded5d[_0x2664('0x97')],'paused':_0x3ded5d[_0x2664('0x96')]||![],'penalty':_0xbc165c['body'][_0x2664('0x9e')]||0x0});}return Promise[_0x2664('0x4f')](_0x18abff['map'](function(_0x489d29){return db[_0x2664('0xa6')][_0x2664('0xa7')](_0x489d29);}));}return _0x280803;});}})[_0x2664('0x1d')](respondWithStatusCode(_0x2dca0d,null))[_0x2664('0x50')](handleError(_0x2dca0d,null));};exports['removeQueues']=function(_0x5d01a7,_0x31283e){var _0x400e5f,_0x5646e6;return db['User'][_0x2664('0x59')]({'where':{'id':_0x5d01a7['params']['id']},'attributes':['id',_0x2664('0x33'),'role']})[_0x2664('0x1d')](handleEntityNotFound(_0x31283e,null))[_0x2664('0x1d')](function(_0x4289da){if(_0x4289da){_0x400e5f=_0x4289da;if(!_0x5d01a7[_0x2664('0x3f')][_0x2664('0xa8')]||!utils[_0x2664('0x98')](_0x5d01a7[_0x2664('0x3f')]['channel'])){throw new db[(_0x2664('0x8b'))][(_0x2664('0x8c'))](_0x2664('0x99'));}return _0x4289da['remove'+_[_0x2664('0x9b')](_0x5d01a7['query'][_0x2664('0xa8')][_0x2664('0x9c')]())+_0x2664('0x9d')](_0x5d01a7['query'][_0x2664('0x5c')]);}})[_0x2664('0x1d')](function(_0x406b13){if(_[_0x2664('0xa9')](_0x5d01a7['query'][_0x2664('0x5c')])){for(var _0x480ef7=0x0;_0x480ef7<_0x5d01a7[_0x2664('0x3f')]['ids'][_0x2664('0x4a')];_0x480ef7+=0x1){_0x5646e6={'UserId':Number(_0x5d01a7[_0x2664('0x51')]['id'])};_0x5646e6[_[_0x2664('0x9b')](_0x5d01a7[_0x2664('0x3f')]['channel'][_0x2664('0x9c')]())+_0x2664('0x9f')]=Number(_0x5d01a7[_0x2664('0x3f')]['ids'][_0x480ef7]);socket[_0x2664('0x27')](_0x2664('0x2c')+_[_0x2664('0x9b')](_0x5d01a7[_0x2664('0x3f')][_0x2664('0xa8')]['toLowerCase']())+_0x2664('0xaa'),_0x5646e6);}}else{_0x5646e6={'UserId':Number(_0x5d01a7['params']['id'])};_0x5646e6[_[_0x2664('0x9b')](_0x5d01a7[_0x2664('0x3f')]['channel'][_0x2664('0x9c')]())+'QueueId']=Number(_0x5d01a7[_0x2664('0x3f')][_0x2664('0x5c')]);socket[_0x2664('0x27')](_0x2664('0x2c')+_[_0x2664('0x9b')](_0x5d01a7[_0x2664('0x3f')][_0x2664('0xa8')][_0x2664('0x9c')]())+_0x2664('0xaa'),_0x5646e6);}return _0x406b13;})['then'](function(){if(_0x5d01a7[_0x2664('0x3f')][_0x2664('0xa8')]===_0x2664('0xa1')){return db[_0x2664('0xa6')][_0x2664('0x29')]({'where':{'UserId':_0x5d01a7[_0x2664('0x51')]['id'],'VoiceQueueId':_0x5d01a7[_0x2664('0x3f')][_0x2664('0x5c')]},'individualHooks':!![]})[_0x2664('0x1d')](function(){return _0x400e5f;});}return _0x400e5f;})[_0x2664('0x1d')](respondWithStatusCode(_0x31283e,null))[_0x2664('0x50')](handleError(_0x31283e,null));};exports[_0x2664('0xab')]=function(_0x54e5a7,_0x291d62){_0x54e5a7[_0x2664('0x58')]['userpic']=_0x54e5a7[_0x2664('0xac')][_0x2664('0xad')];return db[_0x2664('0x36')][_0x2664('0x59')]({'where':{'id':_0x54e5a7['params']['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x291d62,null))[_0x2664('0x1d')](saveUpdates(_0x54e5a7[_0x2664('0x58')],null))[_0x2664('0x1d')](respondWithResult(_0x291d62,null))[_0x2664('0x50')](handleError(_0x291d62,null));};exports[_0x2664('0xae')]=function(_0x144d12,_0x57a378){var _0x11e2a4=path['join'](config[_0x2664('0xaf')],_0x2664('0xb0'));return db[_0x2664('0x36')][_0x2664('0x59')]({'where':{'id':_0x144d12['params']['id']},'attributes':['id',_0x2664('0xb1')],'raw':!![]})[_0x2664('0x1d')](handleEntityNotFound(_0x57a378,null))[_0x2664('0x1d')](function(_0x5bf102){if(_0x5bf102){if(_[_0x2664('0x64')](_0x5bf102[_0x2664('0xb1')])){return _0x57a378[_0x2664('0xb2')](_0x11e2a4);}else{if(!fs[_0x2664('0xb3')](path[_0x2664('0xb4')](config[_0x2664('0xaf')],'server/files/images/',_0x5bf102['userpic']))){return _0x57a378['download'](_0x11e2a4);}return _0x57a378[_0x2664('0xb2')](path[_0x2664('0xb4')](config[_0x2664('0xaf')],'server/files/images/',_0x5bf102[_0x2664('0xb1')]));}}})[_0x2664('0x50')](handleError(_0x57a378,null));};exports[_0x2664('0xb5')]=function(_0x2191ce,_0x5b6da9){return db[_0x2664('0x36')][_0x2664('0x59')]({'where':{'id':_0x2191ce[_0x2664('0x51')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x5b6da9,null))[_0x2664('0x1d')](function(_0x1069de){var _0x1911df=[];values=_0x1069de[_0x2664('0x4b')];_0x1911df[_0x2664('0x46')](get_open_tabs('chat',_0x1069de[_0x2664('0x4b')]));_0x1911df[_0x2664('0x46')](get_open_tabs(_0x2664('0x4c'),_0x1069de[_0x2664('0x4b')]));_0x1911df[_0x2664('0x46')](get_open_tabs('openchannel',_0x1069de[_0x2664('0x4b')]));_0x1911df['push'](get_open_tabs(_0x2664('0x55'),_0x1069de[_0x2664('0x4b')]));_0x1911df[_0x2664('0x46')](get_open_tabs('fax',_0x1069de[_0x2664('0x4b')]));_0x1911df[_0x2664('0x46')](get_open_tabs(_0x2664('0x56'),_0x1069de[_0x2664('0x4b')]));return Promise[_0x2664('0x4f')](_0x1911df);})[_0x2664('0x1d')](function(_0xf4f542){if(_0xf4f542){var _0x59359=_[_0x2664('0x31')](values[_0x2664('0xb6')],function(_0x4f46a7){return{'channel':_0x2664('0xb7'),'id':_0x4f46a7['id'],'createdAt':_0x4f46a7[_0x2664('0xb8')]};});var _0x22cb2c=_['map'](values['FaxOpenTabs'],function(_0x2bc516){return{'channel':_0x2664('0xb9'),'id':_0x2bc516['id'],'createdAt':_0x2bc516['createdAt']};});var _0xae66e7=_[_0x2664('0x31')](values[_0x2664('0xba')],function(_0x43fd15){return{'channel':_0x2664('0xbb'),'id':_0x43fd15['id'],'createdAt':_0x43fd15['createdAt']};});var _0x578c1d=_[_0x2664('0x31')](values[_0x2664('0xbc')],function(_0x190328){return{'channel':_0x2664('0xbd'),'id':_0x190328['id'],'createdAt':_0x190328[_0x2664('0xb8')]};});var _0x2372cd=_[_0x2664('0x31')](values[_0x2664('0xbe')],function(_0x1a3f7e){return{'channel':_0x2664('0xbf'),'id':_0x1a3f7e['id'],'createdAt':_0x1a3f7e[_0x2664('0xb8')]};});var _0x3a582a=_['map'](values[_0x2664('0xc0')],function(_0x436839){return{'channel':_0x2664('0xc1'),'id':_0x436839['id'],'createdAt':_0x436839[_0x2664('0xb8')]};});var _0x24417e=_[_0x2664('0xc2')](_0x59359,_0x22cb2c,_0xae66e7,_0x578c1d,_0x2372cd,_0x3a582a);var _0x3c0941={'count':_0x24417e[_0x2664('0x4a')],'rows':_0x24417e};return _0x3c0941;}else return null;})[_0x2664('0x1d')](respondWithResult(_0x5b6da9,null))[_0x2664('0x50')](handleError(_0x5b6da9,null));};exports[_0x2664('0xc3')]=function(_0x18e58e,_0x1d6f83){var _0x29b823={};return db['User']['findOne']({'where':{'id':_0x18e58e[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](function(_0x30b85a){if(!_0x30b85a){throw new APINotFoundError(util[_0x2664('0xa4')](_0x2664('0xc4'),_0x18e58e['params']['id']));}return contacts[_0x2664('0x5a')]();})[_0x2664('0x1d')](function(_0x998adf){_0x18e58e[_0x2664('0x3f')][_0x2664('0x36')]=_0x18e58e['params']['id'];_0x29b823=qs[_0x2664('0x3d')](_0x998adf,_0x18e58e);if(_0x18e58e[_0x2664('0x3f')][_0x2664('0xc5')]('includeAll')){_0x29b823[_0x2664('0x41')]=[{'model':db[_0x2664('0xc6')],'as':'List','required':![]},{'model':db[_0x2664('0xc7')],'as':_0x2664('0xc8'),'attributes':['id',_0x2664('0x33'),_0x2664('0xc9')],'where':_0x18e58e[_0x2664('0x3f')][_0x2664('0xca')]?{'id':_0x18e58e['query'][_0x2664('0xca')]}:undefined,'required':_0x18e58e[_0x2664('0x3f')][_0x2664('0xca')]?!![]:![]}];}return contacts[_0x2664('0x47')](_0x18e58e[_0x2664('0x3f')],_0x18e58e[_0x2664('0x2c')],_0x29b823,_0x998adf);})[_0x2664('0x1d')](respondWithFilteredResult(_0x1d6f83,_0x29b823))['catch'](APIHandleError(_0x1d6f83));};exports[_0x2664('0xcb')]=function(_0x15a13a,_0x54cc0b){var _0x36bce7;var _0x190106={};var _0x274a9b;return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0x15a13a[_0x2664('0x51')]['id']},'attributes':['id','name',_0x2664('0x25')]})[_0x2664('0x1d')](handleEntityNotFound(_0x54cc0b,null))['then'](function(_0x484d39){if(!utils[_0x2664('0x98')](_0x15a13a['query'][_0x2664('0xa8')])){throw new db[(_0x2664('0x8b'))]['ValidationError'](_0x2664('0x99'));}_0x36bce7=_0x484d39;var _0x151373={};_0x151373[_0x2664('0xcc')]=_[_0x2664('0xcd')](db[_[_0x2664('0x9b')](_0x15a13a[_0x2664('0x3f')][_0x2664('0xa8')])+_0x2664('0xce')][_0x2664('0xcf')]);_0x151373[_0x2664('0x3f')]=_[_0x2664('0xcd')](_0x15a13a[_0x2664('0x3f')]);_0x151373[_0x2664('0xd0')]=_['intersection'](_0x151373[_0x2664('0xcc')],_0x151373[_0x2664('0x3f')]);_0x190106[_0x2664('0x45')]=_[_0x2664('0xd1')](_0x151373['model'],qs[_0x2664('0xd2')](_0x15a13a[_0x2664('0x3f')]['fields']));_0x190106['attributes']=_0x190106['attributes'][_0x2664('0x4a')]?_0x190106[_0x2664('0x45')]:_0x151373[_0x2664('0xcc')];_0x190106[_0x2664('0xd3')]=qs[_0x2664('0xd4')](_0x15a13a[_0x2664('0x3f')]['sort']);_0x190106['where']=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0x15a13a['query'],_0x151373[_0x2664('0xd0')]));if(_0x15a13a['query'][_0x2664('0x2f')]){_0x190106['where']=_[_0x2664('0x52')](_0x190106['where'],{'$or':_['map'](_0x190106[_0x2664('0x45')],function(_0x51aa6b){var _0x30df8f={};_0x30df8f[_0x51aa6b]={'$like':'%'+_0x15a13a[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x30df8f;})});}_0x190106=_['merge']({},_0x190106,_0x15a13a['options']);switch(_0x36bce7[_0x2664('0x25')]){case _0x2664('0x7e'):return db[_[_0x2664('0x9b')](_0x15a13a[_0x2664('0x3f')][_0x2664('0xa8')])+_0x2664('0xce')][_0x2664('0x47')](_0x190106);case'user':case _0x2664('0x26'):return _0x36bce7['get'+_[_0x2664('0x9b')](_0x15a13a[_0x2664('0x3f')][_0x2664('0xa8')])+'Queues'](_0x190106);default:throw new db['Sequelize']['ValidationError'](_0x2664('0xd6'));}})['then'](function(_0x47b8e6){_0x274a9b=_0x47b8e6[_0x2664('0x4a')];if(!_0x15a13a[_0x2664('0x3f')][_0x2664('0xc5')](_0x2664('0xd7'))){_0x190106[_0x2664('0x19')]=qs[_0x2664('0x19')](_0x15a13a['query']['limit']);_0x190106[_0x2664('0x16')]=qs[_0x2664('0x16')](_0x15a13a[_0x2664('0x3f')][_0x2664('0x16')]);}switch(_0x36bce7['role']){case _0x2664('0x7e'):return db[_[_0x2664('0x9b')](_0x15a13a['query'][_0x2664('0xa8')])+_0x2664('0xce')]['findAll'](_0x190106);case _0x2664('0x2c'):case'agent':return _0x36bce7['get'+_[_0x2664('0x9b')](_0x15a13a[_0x2664('0x3f')][_0x2664('0xa8')])+'Queues'](_0x190106);}})['then'](function(_0x32328e){return{'count':_0x274a9b,'rows':_0x32328e};})[_0x2664('0x1d')](respondWithResult(_0x54cc0b,null))[_0x2664('0x50')](handleError(_0x54cc0b,null));};exports[_0x2664('0xd8')]=function(_0x5b194c,_0x1a6900){var _0x42292a={};var _0x14afab={};var _0x747689;var _0x41987b;return db[_0x2664('0x36')]['findOne']({'where':{'id':_0x5b194c[_0x2664('0x51')]['id']}})['then'](handleEntityNotFound(_0x1a6900,null))[_0x2664('0x1d')](function(_0x3e61b9){if(_0x3e61b9){_0x747689=_0x3e61b9;_0x14afab['model']=_[_0x2664('0xcd')](db[_0x2664('0xa6')]['rawAttributes']);_0x14afab[_0x2664('0x3f')]=_[_0x2664('0xcd')](_0x5b194c[_0x2664('0x3f')]);_0x14afab['filters']=_[_0x2664('0xd1')](_0x14afab[_0x2664('0xcc')],_0x14afab['query']);_0x42292a['attributes']=_[_0x2664('0xd1')](_0x14afab[_0x2664('0xcc')],qs[_0x2664('0xd2')](_0x5b194c['query'][_0x2664('0xd2')]));_0x42292a[_0x2664('0x45')]=_0x42292a[_0x2664('0x45')][_0x2664('0x4a')]?_0x42292a[_0x2664('0x45')]:_0x14afab[_0x2664('0xcc')];_0x42292a['order']=qs[_0x2664('0xd4')](_0x5b194c[_0x2664('0x3f')]['sort']);_0x42292a[_0x2664('0x3e')]=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0x5b194c[_0x2664('0x3f')],_0x14afab['filters']));if(_0x5b194c[_0x2664('0x3f')][_0x2664('0x2f')]){_0x42292a[_0x2664('0x3e')]=_[_0x2664('0x52')](_0x42292a['where'],{'$or':_[_0x2664('0x31')](_0x42292a[_0x2664('0x45')],function(_0x41959c){var _0x435daf={};_0x435daf[_0x41959c]={'$like':'%'+_0x5b194c[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x435daf;})});}_0x42292a=_[_0x2664('0x52')]({},_0x42292a,_0x5b194c[_0x2664('0xd9')]);return _0x747689[_0x2664('0xd8')](_0x42292a);}})[_0x2664('0x1d')](function(_0x1861e0){if(_0x1861e0){_0x41987b=_0x1861e0[_0x2664('0x4a')];if(!_0x5b194c[_0x2664('0x3f')][_0x2664('0xc5')](_0x2664('0xd7'))){_0x42292a['limit']=qs[_0x2664('0x19')](_0x5b194c[_0x2664('0x3f')]['limit']);_0x42292a['offset']=qs[_0x2664('0x16')](_0x5b194c[_0x2664('0x3f')][_0x2664('0x16')]);}return _0x747689[_0x2664('0xd8')](_0x42292a);}})[_0x2664('0x1d')](function(_0xbd8f0b){if(_0xbd8f0b){return _0xbd8f0b?{'count':_0x41987b,'rows':_0xbd8f0b}:null;}})[_0x2664('0x1d')](respondWithResult(_0x1a6900,null))[_0x2664('0x50')](handleError(_0x1a6900,null));};exports[_0x2664('0xda')]=function(_0x22bd68,_0x98dba6){var _0x1fbac7={};var _0x33a1f3={};var _0x590f6b;var _0x3391f2;return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0x22bd68[_0x2664('0x51')]['id']}})['then'](handleEntityNotFound(_0x98dba6,null))[_0x2664('0x1d')](function(_0x11bd5f){if(_0x11bd5f){_0x590f6b=_0x11bd5f;_0x33a1f3['model']=_[_0x2664('0xcd')](db[_0x2664('0xdb')][_0x2664('0xcf')]);_0x33a1f3[_0x2664('0x3f')]=_['keys'](_0x22bd68[_0x2664('0x3f')]);_0x33a1f3[_0x2664('0xd0')]=_[_0x2664('0xd1')](_0x33a1f3[_0x2664('0xcc')],_0x33a1f3[_0x2664('0x3f')]);_0x1fbac7['attributes']=_[_0x2664('0xd1')](_0x33a1f3['model'],qs[_0x2664('0xd2')](_0x22bd68[_0x2664('0x3f')][_0x2664('0xd2')]));_0x1fbac7[_0x2664('0x45')]=_0x1fbac7[_0x2664('0x45')][_0x2664('0x4a')]?_0x1fbac7[_0x2664('0x45')]:_0x33a1f3['model'];_0x1fbac7[_0x2664('0xd3')]=qs['sort'](_0x22bd68[_0x2664('0x3f')][_0x2664('0xd4')]);_0x1fbac7[_0x2664('0x3e')]=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0x22bd68[_0x2664('0x3f')],_0x33a1f3[_0x2664('0xd0')]));if(_0x22bd68[_0x2664('0x3f')]['filter']){_0x1fbac7['where']=_[_0x2664('0x52')](_0x1fbac7[_0x2664('0x3e')],{'$or':_[_0x2664('0x31')](_0x1fbac7[_0x2664('0x45')],function(_0x508722){var _0x53a7c1={};_0x53a7c1[_0x508722]={'$like':'%'+_0x22bd68[_0x2664('0x3f')]['filter']+'%'};return _0x53a7c1;})});}_0x1fbac7=_[_0x2664('0x52')]({},_0x1fbac7,_0x22bd68[_0x2664('0xd9')]);return _0x590f6b[_0x2664('0xda')](_0x1fbac7);}})['then'](function(_0x5b1754){if(_0x5b1754){_0x3391f2=_0x5b1754[_0x2664('0x4a')];if(!_0x22bd68[_0x2664('0x3f')][_0x2664('0xc5')](_0x2664('0xd7'))){_0x1fbac7[_0x2664('0x19')]=qs[_0x2664('0x19')](_0x22bd68['query']['limit']);_0x1fbac7[_0x2664('0x16')]=qs['offset'](_0x22bd68[_0x2664('0x3f')]['offset']);}return _0x590f6b['getGroups'](_0x1fbac7);}})['then'](function(_0x576b4d){if(_0x576b4d){return _0x576b4d?{'count':_0x3391f2,'rows':_0x576b4d}:null;}})[_0x2664('0x1d')](respondWithResult(_0x98dba6,null))[_0x2664('0x50')](handleError(_0x98dba6,null));};exports[_0x2664('0xdc')]=function(_0x32eaa4,_0x510153){var _0x49fc1c={'raw':!![],'where':{}};var _0x59a660={};var _0x546ff1={'count':0x0,'rows':[]};return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0x32eaa4[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x510153,null))['then'](function(_0x62e98a){if(_0x62e98a){_0x59a660[_0x2664('0xcc')]=_[_0x2664('0xcd')](db[_0x2664('0xdd')][_0x2664('0xcf')]);_0x59a660[_0x2664('0x3f')]=_[_0x2664('0xcd')](_0x32eaa4[_0x2664('0x3f')]);_0x59a660[_0x2664('0xd0')]=_[_0x2664('0xd1')](_0x59a660[_0x2664('0xcc')],_0x59a660[_0x2664('0x3f')]);_0x49fc1c[_0x2664('0x45')]=_['intersection'](_0x59a660[_0x2664('0xcc')],qs[_0x2664('0xd2')](_0x32eaa4['query'][_0x2664('0xd2')]));_0x49fc1c[_0x2664('0x45')]=_0x49fc1c[_0x2664('0x45')][_0x2664('0x4a')]?_0x49fc1c[_0x2664('0x45')]:_0x59a660[_0x2664('0xcc')];if(!_0x32eaa4['query'][_0x2664('0xc5')](_0x2664('0xd7'))){_0x49fc1c[_0x2664('0x19')]=qs[_0x2664('0x19')](_0x32eaa4[_0x2664('0x3f')][_0x2664('0x19')]);_0x49fc1c[_0x2664('0x16')]=qs['offset'](_0x32eaa4[_0x2664('0x3f')]['offset']);}_0x49fc1c[_0x2664('0xd3')]=qs[_0x2664('0xd4')](_0x32eaa4['query']['sort']);_0x49fc1c[_0x2664('0x3e')]=qs[_0x2664('0xd0')](_['pick'](_0x32eaa4['query'],_0x59a660[_0x2664('0xd0')]));_0x49fc1c[_0x2664('0x3e')]['UserId']=_0x62e98a['id'];if(_0x32eaa4[_0x2664('0x3f')][_0x2664('0x2f')]){_0x49fc1c[_0x2664('0x3e')]=_[_0x2664('0x52')](_0x49fc1c[_0x2664('0x3e')],{'$or':_[_0x2664('0x31')](_0x49fc1c[_0x2664('0x45')],function(_0x4704b9){var _0x3ac07f={};_0x3ac07f[_0x4704b9]={'$like':'%'+_0x32eaa4['query'][_0x2664('0x2f')]+'%'};return _0x3ac07f;})});}_0x49fc1c=_[_0x2664('0x52')]({},_0x49fc1c,_0x32eaa4[_0x2664('0xd9')]);return db[_0x2664('0xdd')]['count']({'where':_0x49fc1c['where']})['then'](function(_0x63e00d){_0x546ff1[_0x2664('0x18')]=_0x63e00d;if(_0x32eaa4[_0x2664('0x3f')][_0x2664('0x40')]){_0x49fc1c[_0x2664('0x41')]=[{'all':!![]}];}return db[_0x2664('0xdd')][_0x2664('0x47')](_0x49fc1c);})[_0x2664('0x1d')](function(_0x333f8e){_0x546ff1[_0x2664('0x48')]=_0x333f8e;return _0x546ff1;});}})[_0x2664('0x1d')](respondWithFilteredResult(_0x510153,_0x49fc1c))[_0x2664('0x50')](handleError(_0x510153,null));};exports[_0x2664('0xde')]=function(_0x440157,_0x2255e4){var _0x7a9928={'raw':!![],'where':{}};var _0x2090f2={};var _0x2b4c37={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x440157['params']['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x2255e4,null))[_0x2664('0x1d')](function(_0x58914d){if(_0x58914d){_0x2090f2[_0x2664('0xcc')]=_[_0x2664('0xcd')](db[_0x2664('0xdf')][_0x2664('0xcf')]);_0x2090f2['query']=_[_0x2664('0xcd')](_0x440157['query']);_0x2090f2['filters']=_['intersection'](_0x2090f2['model'],_0x2090f2[_0x2664('0x3f')]);_0x7a9928[_0x2664('0x45')]=_[_0x2664('0xd1')](_0x2090f2[_0x2664('0xcc')],qs['fields'](_0x440157['query'][_0x2664('0xd2')]));_0x7a9928['attributes']=_0x7a9928[_0x2664('0x45')][_0x2664('0x4a')]?_0x7a9928[_0x2664('0x45')]:_0x2090f2['model'];if(!_0x440157[_0x2664('0x3f')][_0x2664('0xc5')](_0x2664('0xd7'))){_0x7a9928[_0x2664('0x19')]=qs[_0x2664('0x19')](_0x440157['query'][_0x2664('0x19')]);_0x7a9928[_0x2664('0x16')]=qs[_0x2664('0x16')](_0x440157[_0x2664('0x3f')][_0x2664('0x16')]);}_0x7a9928[_0x2664('0xd3')]=qs[_0x2664('0xd4')](_0x440157[_0x2664('0x3f')]['sort']);_0x7a9928[_0x2664('0x3e')]=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0x440157[_0x2664('0x3f')],_0x2090f2['filters']));_0x7a9928[_0x2664('0x3e')][_0x2664('0xe0')]=_0x58914d['id'];if(_0x440157[_0x2664('0x3f')]['filter']){_0x7a9928[_0x2664('0x3e')]=_[_0x2664('0x52')](_0x7a9928[_0x2664('0x3e')],{'$or':_[_0x2664('0x31')](_0x7a9928[_0x2664('0x45')],function(_0x2a5127){var _0x101fdb={};_0x101fdb[_0x2a5127]={'$like':'%'+_0x440157['query'][_0x2664('0x2f')]+'%'};return _0x101fdb;})});}_0x7a9928=_[_0x2664('0x52')]({},_0x7a9928,_0x440157[_0x2664('0xd9')]);return db[_0x2664('0xdf')][_0x2664('0x18')]({'where':_0x7a9928[_0x2664('0x3e')]})[_0x2664('0x1d')](function(_0x287b49){_0x2b4c37[_0x2664('0x18')]=_0x287b49;if(_0x440157[_0x2664('0x3f')][_0x2664('0x40')]){_0x7a9928[_0x2664('0x41')]=[{'all':!![]}];}return db[_0x2664('0xdf')][_0x2664('0x47')](_0x7a9928);})[_0x2664('0x1d')](function(_0x39551f){_0x2b4c37[_0x2664('0x48')]=_0x39551f;return _0x2b4c37;});}})[_0x2664('0x1d')](respondWithFilteredResult(_0x2255e4,_0x7a9928))['catch'](handleError(_0x2255e4,null));};exports['getChatInteractions']=function(_0xcc7cda,_0x560927){var _0x3e14a3={};var _0x21626b={};var _0x3f7150;var _0x46f39c;return db[_0x2664('0x36')]['findOne']({'where':{'id':_0xcc7cda[_0x2664('0x51')]['id']}})['then'](handleEntityNotFound(_0x560927,null))['then'](function(_0x5189f9){if(_0x5189f9){_0x3f7150=_0x5189f9;_0x21626b[_0x2664('0xcc')]=_['keys'](db[_0x2664('0xe1')][_0x2664('0xcf')]);_0x21626b['query']=_[_0x2664('0xcd')](_0xcc7cda['query']);_0x21626b['filters']=_['intersection'](_0x21626b['model'],_0x21626b[_0x2664('0x3f')]);_0x3e14a3[_0x2664('0x45')]=_['intersection'](_0x21626b['model'],qs[_0x2664('0xd2')](_0xcc7cda[_0x2664('0x3f')][_0x2664('0xd2')]));_0x3e14a3[_0x2664('0x45')]=_0x3e14a3[_0x2664('0x45')][_0x2664('0x4a')]?_0x3e14a3['attributes']:_0x21626b[_0x2664('0xcc')];_0x3e14a3[_0x2664('0xd3')]=qs[_0x2664('0xd4')](_0xcc7cda[_0x2664('0x3f')][_0x2664('0xd4')]);_0x3e14a3[_0x2664('0x3e')]=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0xcc7cda[_0x2664('0x3f')],_0x21626b[_0x2664('0xd0')]));if(_0xcc7cda[_0x2664('0x3f')][_0x2664('0x2f')]){_0x3e14a3['where']=_[_0x2664('0x52')](_0x3e14a3['where'],{'$or':_[_0x2664('0x31')](_0x3e14a3[_0x2664('0x45')],function(_0x17f7b3){var _0x126933={};_0x126933[_0x17f7b3]={'$like':'%'+_0xcc7cda[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x126933;})});}_0x3e14a3=_['merge']({},_0x3e14a3,_0xcc7cda[_0x2664('0xd9')]);return _0x3f7150[_0x2664('0xe2')](_0x3e14a3);}})['then'](function(_0x207fdc){if(_0x207fdc){_0x46f39c=_0x207fdc[_0x2664('0x4a')];if(!_0xcc7cda['query'][_0x2664('0xc5')](_0x2664('0xd7'))){_0x3e14a3['limit']=qs[_0x2664('0x19')](_0xcc7cda[_0x2664('0x3f')]['limit']);_0x3e14a3[_0x2664('0x16')]=qs[_0x2664('0x16')](_0xcc7cda[_0x2664('0x3f')]['offset']);}return _0x3f7150[_0x2664('0xe2')](_0x3e14a3);}})[_0x2664('0x1d')](function(_0x5ba1f3){if(_0x5ba1f3){return _0x5ba1f3?{'count':_0x46f39c,'rows':_0x5ba1f3}:null;}})[_0x2664('0x1d')](respondWithResult(_0x560927,null))[_0x2664('0x50')](handleError(_0x560927,null));};exports[_0x2664('0xe3')]=function(_0x28e758,_0x1b033f){var _0x1a600f={};var _0x2afbc2={};var _0x7a2845;var _0x4e412f;return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0x28e758[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x1b033f,null))['then'](function(_0x449cec){if(_0x449cec){_0x7a2845=_0x449cec;_0x2afbc2[_0x2664('0xcc')]=_['keys'](db[_0x2664('0xe4')][_0x2664('0xcf')]);_0x2afbc2[_0x2664('0x3f')]=_[_0x2664('0xcd')](_0x28e758['query']);_0x2afbc2[_0x2664('0xd0')]=_['intersection'](_0x2afbc2[_0x2664('0xcc')],_0x2afbc2[_0x2664('0x3f')]);_0x1a600f[_0x2664('0x45')]=_[_0x2664('0xd1')](_0x2afbc2['model'],qs[_0x2664('0xd2')](_0x28e758[_0x2664('0x3f')][_0x2664('0xd2')]));_0x1a600f[_0x2664('0x45')]=_0x1a600f[_0x2664('0x45')][_0x2664('0x4a')]?_0x1a600f['attributes']:_0x2afbc2['model'];_0x1a600f[_0x2664('0xd3')]=qs[_0x2664('0xd4')](_0x28e758[_0x2664('0x3f')]['sort']);_0x1a600f['where']=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0x28e758['query'],_0x2afbc2[_0x2664('0xd0')]));if(_0x28e758[_0x2664('0x3f')][_0x2664('0x2f')]){_0x1a600f[_0x2664('0x3e')]=_[_0x2664('0x52')](_0x1a600f[_0x2664('0x3e')],{'$or':_['map'](_0x1a600f['attributes'],function(_0x3c2f08){var _0x256ae5={};_0x256ae5[_0x3c2f08]={'$like':'%'+_0x28e758[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x256ae5;})});}_0x1a600f=_[_0x2664('0x52')]({},_0x1a600f,_0x28e758[_0x2664('0xd9')]);return _0x7a2845[_0x2664('0xe3')](_0x1a600f);}})[_0x2664('0x1d')](function(_0x52e9e5){if(_0x52e9e5){_0x4e412f=_0x52e9e5['length'];if(!_0x28e758[_0x2664('0x3f')][_0x2664('0xc5')](_0x2664('0xd7'))){_0x1a600f['limit']=qs[_0x2664('0x19')](_0x28e758[_0x2664('0x3f')]['limit']);_0x1a600f['offset']=qs[_0x2664('0x16')](_0x28e758[_0x2664('0x3f')]['offset']);}return _0x7a2845[_0x2664('0xe3')](_0x1a600f);}})['then'](function(_0x378e57){if(_0x378e57){return _0x378e57?{'count':_0x4e412f,'rows':_0x378e57}:null;}})[_0x2664('0x1d')](respondWithResult(_0x1b033f,null))[_0x2664('0x50')](handleError(_0x1b033f,null));};exports[_0x2664('0xe5')]=function(_0x57c0b9,_0x540217){var _0x92602a={'raw':!![],'where':{}};var _0x34d7c1={};var _0x1947b3={'count':0x0,'rows':[]};return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0x57c0b9[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x540217,null))[_0x2664('0x1d')](function(_0xc9b500){if(_0xc9b500){_0x34d7c1[_0x2664('0xcc')]=_['keys'](db[_0x2664('0xe6')]['rawAttributes']);_0x34d7c1[_0x2664('0x3f')]=_[_0x2664('0xcd')](_0x57c0b9['query']);_0x34d7c1[_0x2664('0xd0')]=_['intersection'](_0x34d7c1['model'],_0x34d7c1[_0x2664('0x3f')]);_0x92602a[_0x2664('0x45')]=_[_0x2664('0xd1')](_0x34d7c1[_0x2664('0xcc')],qs['fields'](_0x57c0b9['query'][_0x2664('0xd2')]));_0x92602a['attributes']=_0x92602a[_0x2664('0x45')][_0x2664('0x4a')]?_0x92602a['attributes']:_0x34d7c1['model'];if(!_0x57c0b9[_0x2664('0x3f')][_0x2664('0xc5')](_0x2664('0xd7'))){_0x92602a[_0x2664('0x19')]=qs[_0x2664('0x19')](_0x57c0b9[_0x2664('0x3f')]['limit']);_0x92602a['offset']=qs[_0x2664('0x16')](_0x57c0b9[_0x2664('0x3f')][_0x2664('0x16')]);}_0x92602a['order']=qs['sort'](_0x57c0b9['query'][_0x2664('0xd4')]);_0x92602a[_0x2664('0x3e')]=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0x57c0b9[_0x2664('0x3f')],_0x34d7c1['filters']));_0x92602a[_0x2664('0x3e')][_0x2664('0xe0')]=_0xc9b500['id'];if(_0x57c0b9[_0x2664('0x3f')]['filter']){_0x92602a[_0x2664('0x3e')]=_[_0x2664('0x52')](_0x92602a[_0x2664('0x3e')],{'$or':_[_0x2664('0x31')](_0x92602a[_0x2664('0x45')],function(_0x10fc8d){var _0x75c55c={};_0x75c55c[_0x10fc8d]={'$like':'%'+_0x57c0b9[_0x2664('0x3f')]['filter']+'%'};return _0x75c55c;})});}_0x92602a=_[_0x2664('0x52')]({},_0x92602a,_0x57c0b9['options']);return db['MailInteraction'][_0x2664('0x18')]({'where':_0x92602a['where']})[_0x2664('0x1d')](function(_0x19026b){_0x1947b3['count']=_0x19026b;if(_0x57c0b9[_0x2664('0x3f')][_0x2664('0x40')]){_0x92602a[_0x2664('0x41')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x92602a);})['then'](function(_0x48c383){_0x1947b3[_0x2664('0x48')]=_0x48c383;return _0x1947b3;});}})['then'](respondWithFilteredResult(_0x540217,_0x92602a))[_0x2664('0x50')](handleError(_0x540217,null));};exports[_0x2664('0xe7')]=function(_0xdfd263,_0xcafeee){var _0x41c26f={};var _0x19e378={};var _0x583a70;var _0x4cec78;return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0xdfd263['params']['id']}})['then'](handleEntityNotFound(_0xcafeee,null))[_0x2664('0x1d')](function(_0x3511d7){if(_0x3511d7){_0x583a70=_0x3511d7;_0x19e378[_0x2664('0xcc')]=_[_0x2664('0xcd')](db['SmsInteraction'][_0x2664('0xcf')]);_0x19e378[_0x2664('0x3f')]=_[_0x2664('0xcd')](_0xdfd263[_0x2664('0x3f')]);_0x19e378[_0x2664('0xd0')]=_[_0x2664('0xd1')](_0x19e378[_0x2664('0xcc')],_0x19e378[_0x2664('0x3f')]);_0x41c26f['attributes']=_[_0x2664('0xd1')](_0x19e378[_0x2664('0xcc')],qs[_0x2664('0xd2')](_0xdfd263[_0x2664('0x3f')][_0x2664('0xd2')]));_0x41c26f[_0x2664('0x45')]=_0x41c26f[_0x2664('0x45')]['length']?_0x41c26f['attributes']:_0x19e378[_0x2664('0xcc')];_0x41c26f['order']=qs[_0x2664('0xd4')](_0xdfd263[_0x2664('0x3f')][_0x2664('0xd4')]);_0x41c26f['where']=qs['filters'](_[_0x2664('0xd5')](_0xdfd263[_0x2664('0x3f')],_0x19e378[_0x2664('0xd0')]));if(_0xdfd263[_0x2664('0x3f')][_0x2664('0x2f')]){_0x41c26f[_0x2664('0x3e')]=_[_0x2664('0x52')](_0x41c26f[_0x2664('0x3e')],{'$or':_[_0x2664('0x31')](_0x41c26f[_0x2664('0x45')],function(_0x206b80){var _0x2d0461={};_0x2d0461[_0x206b80]={'$like':'%'+_0xdfd263[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x2d0461;})});}_0x41c26f=_[_0x2664('0x52')]({},_0x41c26f,_0xdfd263[_0x2664('0xd9')]);return _0x583a70[_0x2664('0xe7')](_0x41c26f);}})[_0x2664('0x1d')](function(_0xcbceeb){if(_0xcbceeb){_0x4cec78=_0xcbceeb['length'];if(!_0xdfd263['query']['hasOwnProperty'](_0x2664('0xd7'))){_0x41c26f['limit']=qs[_0x2664('0x19')](_0xdfd263[_0x2664('0x3f')]['limit']);_0x41c26f[_0x2664('0x16')]=qs['offset'](_0xdfd263[_0x2664('0x3f')][_0x2664('0x16')]);}return _0x583a70[_0x2664('0xe7')](_0x41c26f);}})[_0x2664('0x1d')](function(_0x1fdb4b){if(_0x1fdb4b){return _0x1fdb4b?{'count':_0x4cec78,'rows':_0x1fdb4b}:null;}})[_0x2664('0x1d')](respondWithResult(_0xcafeee,null))['catch'](handleError(_0xcafeee,null));};exports[_0x2664('0xe8')]=function(_0x26c030,_0x33b67c){var _0x1cfcd3={};var _0xc248ab={};var _0x1d7920;var _0x132e54;return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0x26c030[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x33b67c,null))['then'](function(_0x86fc1e){if(_0x86fc1e){_0x1d7920=_0x86fc1e;_0xc248ab[_0x2664('0xcc')]=_[_0x2664('0xcd')](db[_0x2664('0xe9')][_0x2664('0xcf')]);_0xc248ab[_0x2664('0x3f')]=_[_0x2664('0xcd')](_0x26c030[_0x2664('0x3f')]);_0xc248ab[_0x2664('0xd0')]=_['intersection'](_0xc248ab['model'],_0xc248ab[_0x2664('0x3f')]);_0x1cfcd3[_0x2664('0x45')]=_['intersection'](_0xc248ab['model'],qs[_0x2664('0xd2')](_0x26c030[_0x2664('0x3f')][_0x2664('0xd2')]));_0x1cfcd3[_0x2664('0x45')]=_0x1cfcd3['attributes'][_0x2664('0x4a')]?_0x1cfcd3[_0x2664('0x45')]:_0xc248ab[_0x2664('0xcc')];_0x1cfcd3[_0x2664('0xd3')]=qs[_0x2664('0xd4')](_0x26c030[_0x2664('0x3f')][_0x2664('0xd4')]);_0x1cfcd3['where']=qs['filters'](_[_0x2664('0xd5')](_0x26c030[_0x2664('0x3f')],_0xc248ab[_0x2664('0xd0')]));if(_0x26c030[_0x2664('0x3f')]['filter']){_0x1cfcd3['where']=_[_0x2664('0x52')](_0x1cfcd3[_0x2664('0x3e')],{'$or':_[_0x2664('0x31')](_0x1cfcd3[_0x2664('0x45')],function(_0x4fbc45){var _0x1c4bd1={};_0x1c4bd1[_0x4fbc45]={'$like':'%'+_0x26c030[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x1c4bd1;})});}_0x1cfcd3=_[_0x2664('0x52')]({},_0x1cfcd3,_0x26c030[_0x2664('0xd9')]);return _0x1d7920[_0x2664('0xe8')](_0x1cfcd3);}})[_0x2664('0x1d')](function(_0x5db300){if(_0x5db300){_0x132e54=_0x5db300[_0x2664('0x4a')];if(!_0x26c030[_0x2664('0x3f')][_0x2664('0xc5')](_0x2664('0xd7'))){_0x1cfcd3[_0x2664('0x19')]=qs[_0x2664('0x19')](_0x26c030[_0x2664('0x3f')][_0x2664('0x19')]);_0x1cfcd3[_0x2664('0x16')]=qs[_0x2664('0x16')](_0x26c030[_0x2664('0x3f')]['offset']);}return _0x1d7920['getFaxInteractions'](_0x1cfcd3);}})[_0x2664('0x1d')](function(_0x3cdc41){if(_0x3cdc41){return _0x3cdc41?{'count':_0x132e54,'rows':_0x3cdc41}:null;}})[_0x2664('0x1d')](respondWithResult(_0x33b67c,null))[_0x2664('0x50')](handleError(_0x33b67c,null));};exports[_0x2664('0xea')]=function(_0x3f54d6,_0xb481c1){var _0x5b27a7={};var _0x589715={};var _0x1bc95c;var _0x40c9db;return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0x3f54d6[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0xb481c1,null))[_0x2664('0x1d')](function(_0x4e5172){if(_0x4e5172){_0x1bc95c=_0x4e5172;_0x589715['model']=_['keys'](db['WhatsappInteraction'][_0x2664('0xcf')]);_0x589715[_0x2664('0x3f')]=_[_0x2664('0xcd')](_0x3f54d6[_0x2664('0x3f')]);_0x589715[_0x2664('0xd0')]=_[_0x2664('0xd1')](_0x589715[_0x2664('0xcc')],_0x589715[_0x2664('0x3f')]);_0x5b27a7['attributes']=_['intersection'](_0x589715[_0x2664('0xcc')],qs['fields'](_0x3f54d6[_0x2664('0x3f')][_0x2664('0xd2')]));_0x5b27a7[_0x2664('0x45')]=_0x5b27a7['attributes'][_0x2664('0x4a')]?_0x5b27a7[_0x2664('0x45')]:_0x589715[_0x2664('0xcc')];_0x5b27a7['order']=qs[_0x2664('0xd4')](_0x3f54d6[_0x2664('0x3f')][_0x2664('0xd4')]);_0x5b27a7['where']=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0x3f54d6[_0x2664('0x3f')],_0x589715[_0x2664('0xd0')]));if(_0x3f54d6[_0x2664('0x3f')][_0x2664('0x2f')]){_0x5b27a7['where']=_[_0x2664('0x52')](_0x5b27a7[_0x2664('0x3e')],{'$or':_[_0x2664('0x31')](_0x5b27a7[_0x2664('0x45')],function(_0x1150b5){var _0x4f832={};_0x4f832[_0x1150b5]={'$like':'%'+_0x3f54d6[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x4f832;})});}_0x5b27a7=_[_0x2664('0x52')]({},_0x5b27a7,_0x3f54d6[_0x2664('0xd9')]);return _0x1bc95c[_0x2664('0xea')](_0x5b27a7);}})[_0x2664('0x1d')](function(_0x2c1005){if(_0x2c1005){_0x40c9db=_0x2c1005[_0x2664('0x4a')];if(!_0x3f54d6['query'][_0x2664('0xc5')](_0x2664('0xd7'))){_0x5b27a7[_0x2664('0x19')]=qs['limit'](_0x3f54d6['query'][_0x2664('0x19')]);_0x5b27a7[_0x2664('0x16')]=qs[_0x2664('0x16')](_0x3f54d6['query'][_0x2664('0x16')]);}return _0x1bc95c[_0x2664('0xea')](_0x5b27a7);}})[_0x2664('0x1d')](function(_0x58933b){if(_0x58933b){return _0x58933b?{'count':_0x40c9db,'rows':_0x58933b}:null;}})[_0x2664('0x1d')](respondWithResult(_0xb481c1,null))[_0x2664('0x50')](handleError(_0xb481c1,null));};exports['login']=function(_0x34e7a2,_0x29177e,_0x42a603){var _0x172bd0;var _0x2dbceb;var _0x5a81bb;var _0x572f5d=!_[_0x2664('0x64')](_0x34e7a2[_0x2664('0x51')]['id'])?_0x34e7a2['params']['id']:!_[_0x2664('0x64')](_0x34e7a2[_0x2664('0x2c')]['id'])?_0x34e7a2[_0x2664('0x2c')]['id']:null;return db['User'][_0x2664('0x59')]({'where':{'id':_0x572f5d,'role':{'$or':[_0x2664('0x7e'),_0x2664('0x2c'),_0x2664('0x26')]}},'attributes':['id',_0x2664('0x33'),_0x2664('0xeb'),_0x2664('0xec'),_0x2664('0x25'),'internal',_0x2664('0x95')]})[_0x2664('0x1d')](function(_0x1e8498){if(_0x1e8498){if(_0x1e8498['role']===_0x2664('0x26')){_0x172bd0=_0x1e8498;if(_0x34e7a2[_0x2664('0x58')][_0x2664('0x97')]){_0x5a81bb=util['format'](_0x2664('0xed'),_0x172bd0[_0x34e7a2[_0x2664('0x58')][_0x2664('0x97')]]);}else if(_0x34e7a2[_0x2664('0x58')][_0x2664('0xee')]){_0x5a81bb=util[_0x2664('0xa4')](_0x2664('0xa5'),_0x34e7a2['body'][_0x2664('0xee')]);}else{_0x5a81bb=util[_0x2664('0xa4')](_0x2664('0xa5'),_0x172bd0['name']);}socket['to'](util[_0x2664('0xa4')]('user:%s',_0x172bd0[_0x2664('0x33')]))[_0x2664('0x27')](_0x2664('0xef'),{'user':{'id':_0x172bd0['id'],'name':_0x172bd0[_0x2664('0x33')]},'ip':_0x34e7a2[_0x2664('0xf0')][_0x2664('0xf1')]||_0x34e7a2['connection'][_0x2664('0xf2')]||_0x34e7a2[_0x2664('0xf3')][_0x2664('0xf2')]||_0x34e7a2[_0x2664('0xf4')][_0x2664('0xf3')][_0x2664('0xf2')]});return new Promise(function(_0x3ed003,_0x11705f){db[_0x2664('0x66')][_0x2664('0xf5')]()[_0x2664('0x1d')](_0x322fd9=>{db['UserVoiceQueueRt'][_0x2664('0x29')]({'where':{'membername':_0x172bd0[_0x2664('0x33')]},'individualHooks':!![]},{'transaction':_0x322fd9})[_0x2664('0x1d')](function(){return _0x322fd9[_0x2664('0xf6')]();})[_0x2664('0x1d')](_0x3ed003)[_0x2664('0x50')](_0x11705f);});});}}else{throw new db[(_0x2664('0x8b'))][(_0x2664('0x8c'))](_0x2664('0xf7'));}})[_0x2664('0x1d')](function(){if(_0x172bd0){return _0x172bd0['getVoiceQueues']({'raw':!![]});}})[_0x2664('0x1d')](function(_0x5ea284){if(_0x172bd0){if(_0x5ea284){_0x2dbceb=_0x5ea284;if(_0x2dbceb[_0x2664('0x4a')]){var _0x4a04ad=_0x2dbceb[_0x2664('0x31')](function(_0x329fb8){return{'membername':_0x172bd0[_0x2664('0x33')],'UserId':_0x172bd0['id'],'queue_name':_0x329fb8[_0x2664('0x33')],'VoiceQueueId':_0x329fb8['id'],'interface':_0x5a81bb,'paused':_0x172bd0['loginInPause']||![],'penalty':_0x329fb8[_0x2664('0xf8')]||0x0};});return db['UserVoiceQueueRt'][_0x2664('0xf9')](_0x4a04ad);}}}})['then'](function(){if(_0x172bd0){return db['MemberReport'][_0x2664('0x47')]({'where':{'membername':_0x172bd0[_0x2664('0x33')],'exitAt':null}});}})['then'](function(_0x31e9e5){if(_0x172bd0){var _0x32abe0=[];_0x31e9e5[_0x2664('0xfa')](function(_0x673011){_0x32abe0['push'](_0x673011[_0x2664('0x57')]({'exitAt':moment()[_0x2664('0xa4')](_0x2664('0xfb'))}));});return Promise[_0x2664('0x4f')](_0x32abe0);}})[_0x2664('0x1d')](function(){if(_0x172bd0){var _0x8e8247=[];var _0x1f8421=[];var _0x492f35=utils[_0x2664('0xfc')]();var _0xd347a6={'membername':_0x172bd0[_0x2664('0x33')],'interface':_0x5a81bb,'enterAt':moment()[_0x2664('0xa4')](_0x2664('0xfb')),'role':_0x172bd0['role'],'internal':_0x172bd0[_0x2664('0x5e')]};_0x492f35[_0x2664('0xfa')](function(_0x57b665){_0x8e8247[_0x2664('0x46')](_[_0x2664('0x52')]({'channel':_0x57b665,'type':_0x2664('0xfd'),'data1':_0x34e7a2[_0x2664('0x58')]['device'],'data2':_0x5a81bb},_0xd347a6));if(_0x172bd0[_0x2664('0x95')]){_0x1f8421[_0x2664('0x46')](_['merge']({'channel':_0x57b665,'type':_0x2664('0xfe'),'data1':_0x2664('0xff')},_0xd347a6));}});return db[_0x2664('0x100')][_0x2664('0xf9')](_0x8e8247[_0x2664('0xc2')](_0x1f8421),{'individualHooks':!![]});}})[_0x2664('0x1d')](function(){if(_0x172bd0){return _0x172bd0['update']({'online':!![],'lastLoginAt':moment()[_0x2664('0xa4')](_0x2664('0xfb')),'voicePause':_0x172bd0[_0x2664('0x95')]||![],'mailPause':_0x172bd0[_0x2664('0x95')]||![],'chatPause':_0x172bd0['loginInPause']||![],'faxPause':_0x172bd0[_0x2664('0x95')]||![],'smsPause':_0x172bd0[_0x2664('0x95')]||![],'openchannelPause':_0x172bd0['loginInPause']||![],'whatsappPause':_0x172bd0[_0x2664('0x95')]||![],'pauseType':_0x172bd0['loginInPause']?_0x2664('0xff'):null,'interface':_0x5a81bb,'lastPauseAt':moment()['format'](_0x2664('0xfb'))});}})['then'](function(_0x31f248){if(_0x34e7a2[_0x2664('0x101')]){return _0x42a603();}else{return Promise[_0x2664('0x102')](_0x31f248)[_0x2664('0x1d')](respondWithResult(_0x29177e,null));}})[_0x2664('0x50')](handleError(_0x29177e,null));};exports[_0x2664('0x103')]=function(_0x3ddbb7,_0x4a55ae){var _0x572674;return db['User'][_0x2664('0x59')]({'where':{'id':_0x3ddbb7[_0x2664('0x51')]['id'],'role':'agent'},'attributes':['id',_0x2664('0x33'),_0x2664('0x25')]})[_0x2664('0x1d')](handleEntityNotFound(_0x4a55ae,null))['then'](function(_0x25a483){if(_0x25a483){_0x572674=_0x25a483;return db['UserVoiceQueueRt'][_0x2664('0x29')]({'where':{'membername':_0x572674['name']},'individualHooks':!![]});}})[_0x2664('0x1d')](function(){return db[_0x2664('0x100')][_0x2664('0x47')]({'where':{'membername':_0x572674[_0x2664('0x33')],'exitAt':null}});})['then'](function(_0x1e52ee){var _0x4ea64f=[];_0x1e52ee[_0x2664('0xfa')](function(_0x321fb9){_0x4ea64f[_0x2664('0x46')](_0x321fb9[_0x2664('0x57')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x2664('0x4f')](_0x4ea64f);})[_0x2664('0x1d')](function(){return _0x572674[_0x2664('0x57')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2664('0x1d')](respondWithResult(_0x4a55ae,null))[_0x2664('0x50')](handleError(_0x4a55ae,null));};exports['pause']=function(_0x35b54e,_0x337883){var _0x38c9e5;return db['UserVoiceQueueRt'][_0x2664('0x57')]({'paused':0x1},{'where':{'UserId':_0x35b54e[_0x2664('0x51')]['id']},'individualHooks':!![]})[_0x2664('0x1d')](function(){return db[_0x2664('0x36')][_0x2664('0x59')]({'where':{'id':_0x35b54e[_0x2664('0x51')]['id'],'role':_0x2664('0x26')},'attributes':['id',_0x2664('0x33'),'role',_0x2664('0x5e'),_0x2664('0x97'),_0x2664('0xa3')]});})[_0x2664('0x1d')](handleEntityNotFound(_0x337883,null))['then'](function(_0x5f050a){if(_0x5f050a){_0x38c9e5=_0x5f050a;return respondWithRpcPromise(_0x2664('0x104'),_0x2664('0x105'),{'id':_0x38c9e5['id'],'name':_0x38c9e5[_0x2664('0x33')],'pause':!![]});}})[_0x2664('0x1d')](function(){if(_0x38c9e5){return db['MemberReport']['findAll']({'where':{'membername':_0x38c9e5[_0x2664('0x33')],'type':_0x2664('0xfe'),'exitAt':null}});}})['then'](function(_0x528ed5){if(_0x528ed5[_0x2664('0x4a')]){var _0x551aec=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1227bd=0x0,_0x247509=_0x528ed5[_0x2664('0x4a')];_0x1227bd<_0x247509;_0x1227bd++){_0x528ed5[_0x1227bd][_0x2664('0x106')]({'exitAt':_0x551aec});}}})[_0x2664('0x1d')](function(){var _0x870181=[];var _0x820134=utils[_0x2664('0xfc')]();_0x820134[_0x2664('0xfa')](function(_0x4a3973){_0x870181[_0x2664('0x46')]({'channel':_0x4a3973,'membername':_0x38c9e5[_0x2664('0x33')],'interface':_[_0x2664('0x64')](_0x38c9e5[_0x2664('0x97')])?util[_0x2664('0xa4')]('SIP/%s',_0x38c9e5[_0x2664('0x33')]):_0x38c9e5[_0x2664('0x97')],'type':_0x2664('0xfe'),'enterAt':moment()[_0x2664('0xa4')](_0x2664('0xfb')),'data1':_0x35b54e[_0x2664('0x58')][_0x2664('0x107')]||'DEFAULT\x20PAUSE','role':_0x38c9e5[_0x2664('0x25')],'internal':_0x38c9e5['internal']});});return db[_0x2664('0x100')]['bulkCreate'](_0x870181,{'individualHooks':!![]});})[_0x2664('0x1d')](function(){return _0x38c9e5['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x35b54e[_0x2664('0x58')][_0x2664('0x107')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2664('0x1d')](respondWithResult(_0x337883,null))[_0x2664('0x50')](handleError(_0x337883,null));};exports[_0x2664('0x108')]=function(_0x149dfc,_0x1e205c){if(_0x149dfc[_0x2664('0x58')][_0x2664('0xa8')]&&!utils[_0x2664('0x98')](_0x149dfc[_0x2664('0x58')][_0x2664('0xa8')])){throw new APIBadRequestError(util[_0x2664('0xa4')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x149dfc[_0x2664('0x58')][_0x2664('0xa8')]));}return db[_0x2664('0x36')][_0x2664('0x59')]({'where':{'id':_0x149dfc['params']['id']},'attributes':['id',_0x2664('0x33'),_0x2664('0x25'),_0x2664('0x5e'),_0x2664('0x97'),'online','voicePause','mailPause','chatPause',_0x2664('0x109'),_0x2664('0x10a'),'smsPause','whatsappPause','pauseType','lastPauseAt']})[_0x2664('0x1d')](function(_0x318abf){if(!_0x318abf){throw new APINotFoundError(util[_0x2664('0xa4')](_0x2664('0xc4'),_0x149dfc['params']['id']));}return _0x318abf[_0x2664('0x108')](_0x149dfc[_0x2664('0x58')][_0x2664('0xa8')]);})[_0x2664('0x1d')](respondWithResult(_0x1e205c,null))[_0x2664('0x50')](APIHandleError(_0x1e205c));};exports[_0x2664('0x10b')]=function(_0x1a6499,_0x49f99a){var _0x233749={};var _0x3df97e={};var _0x22c615;var _0x2777db;return db['User'][_0x2664('0x90')]({'where':{'id':_0x1a6499[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x49f99a,null))[_0x2664('0x1d')](function(_0x229711){if(_0x229711){_0x22c615=_0x229711;_0x3df97e[_0x2664('0xcc')]=_[_0x2664('0xcd')](db[_0x2664('0x10c')][_0x2664('0xcf')]);_0x3df97e[_0x2664('0x3f')]=_['keys'](_0x1a6499[_0x2664('0x3f')]);_0x3df97e['filters']=_[_0x2664('0xd1')](_0x3df97e['model'],_0x3df97e[_0x2664('0x3f')]);_0x233749[_0x2664('0x45')]=_[_0x2664('0xd1')](_0x3df97e[_0x2664('0xcc')],qs[_0x2664('0xd2')](_0x1a6499['query'][_0x2664('0xd2')]));_0x233749[_0x2664('0x45')]=_0x233749[_0x2664('0x45')]['length']?_0x233749[_0x2664('0x45')]:_0x3df97e['model'];_0x233749[_0x2664('0xd3')]=qs[_0x2664('0xd4')](_0x1a6499['query'][_0x2664('0xd4')]);_0x233749[_0x2664('0x3e')]=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0x1a6499[_0x2664('0x3f')],_0x3df97e[_0x2664('0xd0')]));if(_0x1a6499[_0x2664('0x3f')]['filter']){_0x233749[_0x2664('0x3e')]=_[_0x2664('0x52')](_0x233749[_0x2664('0x3e')],{'$or':_['map'](_0x233749[_0x2664('0x45')],function(_0x1fc68b){var _0x65a6a9={};_0x65a6a9[_0x1fc68b]={'$like':'%'+_0x1a6499[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x65a6a9;})});}_0x233749=_[_0x2664('0x52')]({},_0x233749,_0x1a6499[_0x2664('0xd9')]);return _0x22c615['getTeams'](_0x233749);}})[_0x2664('0x1d')](function(_0x3e80a1){if(_0x3e80a1){_0x2777db=_0x3e80a1['length'];if(!_0x1a6499[_0x2664('0x3f')][_0x2664('0xc5')](_0x2664('0xd7'))){_0x233749[_0x2664('0x19')]=qs[_0x2664('0x19')](_0x1a6499['query'][_0x2664('0x19')]);_0x233749['offset']=qs['offset'](_0x1a6499[_0x2664('0x3f')][_0x2664('0x16')]);}return _0x22c615[_0x2664('0x10b')](_0x233749);}})[_0x2664('0x1d')](function(_0x2173e3){if(_0x2173e3){return _0x2173e3?{'count':_0x2777db,'rows':_0x2173e3}:null;}})[_0x2664('0x1d')](respondWithResult(_0x49f99a,null))[_0x2664('0x50')](handleError(_0x49f99a,null));};exports[_0x2664('0x10d')]=function(_0x1f09b5,_0x1aa122){var _0x5bef93=_0x1f09b5['params']['id'];var _0x9143ba=_0x1f09b5['body']?_0x1f09b5['body']['ids']:null;var _0x12d03a=[];return Promise['resolve']()['then'](function(){if(!_0x9143ba)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x2664('0x1d')](function(){return db[_0x2664('0x36')]['findOne']({'where':{'id':_0x5bef93}});})['then'](function(_0xc39e64){if(!_0xc39e64)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x1f09b5[_0x2664('0x51')]['id']));return db[_0x2664('0x66')][_0x2664('0xf5')](function(_0x4d8492){return _0xc39e64[_0x2664('0x10d')](_0x9143ba,{'transaction':_0x4d8492})[_0x2664('0x1d')](function(){return db[_0x2664('0x10c')][_0x2664('0x47')]({'where':{'id':{'$in':_0x9143ba}}});})[_0x2664('0x1d')](function(_0x832e9e){var _0x205478=_[_0x2664('0x31')](_0x832e9e,function(_0x2e8f4f){return _0x2e8f4f[_0x2664('0x10e')]();});return Promise[_0x2664('0x4f')](_0x205478);})[_0x2664('0x1d')](function(_0x53b47d){_0x12d03a=_[_0x2664('0x10f')](_0x53b47d);var _0x5af679=_['map'](_0x12d03a,function(_0x413d90){return _0x413d90[_0x2664('0x110')](_0xc39e64['id'],{'transaction':_0x4d8492});});return Promise[_0x2664('0x4f')](_0x5af679);})[_0x2664('0x1d')](function(){if(!_0xc39e64[_0x2664('0xa3')])return;var _0x496d73=_[_0x2664('0x2f')](_0x12d03a,function(_0x24113b){return _0x24113b[_0x2664('0x111')]('channel')===_0x2664('0x112');});var _0x595c56=_['map'](_0x496d73,function(_0x44f25e){return db[_0x2664('0xa6')]['upsert']({'membername':_0xc39e64[_0x2664('0x33')],'UserId':_0xc39e64['id'],'queue_name':_0x44f25e[_0x2664('0x33')],'VoiceQueueId':_0x44f25e['id'],'interface':_[_0x2664('0x64')](_0xc39e64[_0x2664('0x97')])?util[_0x2664('0xa4')](_0x2664('0xa5'),_0xc39e64[_0x2664('0x33')]):_0xc39e64[_0x2664('0x97')],'paused':_0xc39e64[_0x2664('0x96')]||![],'penalty':_0xc39e64[_0x2664('0x9e')]},{'transaction':_0x4d8492});});return Promise[_0x2664('0x4f')](_0x595c56);})[_0x2664('0x1d')](function(){return db[_0x2664('0x113')]['findAll']({'where':{'teamId':{'$in':_0x9143ba}}});})[_0x2664('0x1d')](function(_0x1d442e){var _0x173b08=_[_0x2664('0x31')](_0x1d442e,function(_0x4f6caa){return db[_0x2664('0x114')][_0x2664('0x7c')]({'UserId':_0xc39e64['id'],'VoicePrefixId':_0x4f6caa[_0x2664('0x115')]},{'transaction':_0x4d8492});});return Promise[_0x2664('0x4f')](_0x173b08);});});})[_0x2664('0x1d')](function(){for(var _0x5e52fc=0x0;_0x5e52fc<_0x12d03a[_0x2664('0x4a')];_0x5e52fc++){var _0x5c768d=_0x12d03a[_0x5e52fc][_0x2664('0x111')](_0x2664('0xa8'));var _0x3b8ae6=_0x5c768d+_0x2664('0x9f');socket[_0x2664('0x27')](_0x2664('0x2c')+_0x5c768d+_0x2664('0xa0'),{'UserId':_0x5bef93,['queueField']:_0x12d03a[_0x5e52fc]['id']});}})[_0x2664('0x1d')](respondWithStatusCode(_0x1aa122,null))['catch'](APIHandleError(_0x1aa122));};exports[_0x2664('0x116')]=function(_0x1e3429,_0x5b07de){var _0x133402=_0x1e3429[_0x2664('0x51')]['id'];var _0x472402=null;if(_0x1e3429[_0x2664('0x3f')][_0x2664('0x5c')]){_0x472402=_[_0x2664('0xa9')](_0x1e3429[_0x2664('0x3f')][_0x2664('0x5c')])?_0x1e3429[_0x2664('0x3f')]['ids']:[_0x1e3429[_0x2664('0x3f')][_0x2664('0x5c')]];}var _0x5dc365=[];return Promise[_0x2664('0x102')]()[_0x2664('0x1d')](function(){if(!_0x472402)throw new APIBadRequestError(_0x2664('0x117'));})['then'](function(){return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0x133402}});})[_0x2664('0x1d')](function(_0x3d9a91){if(!_0x3d9a91)throw new APINotFoundError(util[_0x2664('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1e3429[_0x2664('0x51')]['id']));return db[_0x2664('0x66')][_0x2664('0xf5')](function(_0x36060c){return _0x3d9a91[_0x2664('0x116')](_0x472402,{'transaction':_0x36060c})[_0x2664('0x1d')](function(){return db[_0x2664('0x10c')][_0x2664('0x47')]({'where':{'id':{'$in':_0x472402}}});})[_0x2664('0x1d')](function(_0x44fa04){var _0x4f8030=_['map'](_0x44fa04,function(_0x47d2eb){return _0x47d2eb['getAssociatedQueues']();});return Promise[_0x2664('0x4f')](_0x4f8030);})[_0x2664('0x1d')](function(_0x1e8085){_0x5dc365=_[_0x2664('0x10f')](_0x1e8085);var _0x386e1e=_[_0x2664('0x31')](_0x5dc365,function(_0x5e8044){return _0x5e8044[_0x2664('0x118')](_0x3d9a91['id'],{'transaction':_0x36060c});});return Promise[_0x2664('0x4f')](_0x386e1e);})[_0x2664('0x1d')](function(){if(!_0x3d9a91[_0x2664('0xa3')])return;var _0x481284=_[_0x2664('0x2f')](_0x5dc365,function(_0x44267c){return _0x44267c[_0x2664('0x111')](_0x2664('0xa8'))===_0x2664('0x112');});var _0xc69c9b=_[_0x2664('0x31')](_0x481284,function(_0x38d7ab){return db[_0x2664('0xa6')][_0x2664('0x29')]({'where':{'VoiceQueueId':_0x38d7ab['id'],'UserId':_0x3d9a91['id']},'transaction':_0x36060c});});return Promise[_0x2664('0x4f')](_0xc69c9b);})['then'](function(){return db[_0x2664('0x113')]['findAll']({'where':{'teamId':{'$in':_0x472402}}});})['then'](function(_0x2da84a){var _0x265eb1=_[_0x2664('0x31')](_0x2da84a,function(_0x46a0a0){return db['UserVoicePrefix'][_0x2664('0x29')]({'where':{'UserId':_0x3d9a91['id'],'VoicePrefixId':_0x46a0a0[_0x2664('0x115')]}},{'transaction':_0x36060c});});return Promise['all'](_0x265eb1);});});})[_0x2664('0x1d')](function(){for(var _0x27fff7=0x0;_0x27fff7<_0x5dc365['length'];_0x27fff7++){var _0x399aa7=_0x5dc365[_0x27fff7][_0x2664('0x111')](_0x2664('0xa8'));var _0x41fd4b=_0x399aa7+_0x2664('0x9f');socket[_0x2664('0x27')](_0x2664('0x2c')+_0x399aa7+_0x2664('0xaa'),{'UserId':_0x133402,['queueField']:_0x5dc365[_0x27fff7]['id']});}})['then'](respondWithStatusCode(_0x5b07de,null))[_0x2664('0x50')](APIHandleError(_0x5b07de));};exports[_0x2664('0x119')]=function(_0x498880,_0x2b0441){var _0x1ce5e8={};var _0x6a540a={};var _0x4adf5d;var _0x872193;return db[_0x2664('0x36')][_0x2664('0x90')]({'where':{'id':_0x498880[_0x2664('0x51')]['id']}})[_0x2664('0x1d')](handleEntityNotFound(_0x2b0441,null))[_0x2664('0x1d')](function(_0x142f57){if(_0x142f57){_0x4adf5d=_0x142f57;_0x6a540a['model']=_['keys'](db['CmList'][_0x2664('0xcf')]);_0x6a540a[_0x2664('0x3f')]=_[_0x2664('0xcd')](_0x498880[_0x2664('0x3f')]);_0x6a540a['filters']=_[_0x2664('0xd1')](_0x6a540a[_0x2664('0xcc')],_0x6a540a[_0x2664('0x3f')]);_0x1ce5e8[_0x2664('0x45')]=_['intersection'](_0x6a540a['model'],qs[_0x2664('0xd2')](_0x498880[_0x2664('0x3f')][_0x2664('0xd2')]));_0x1ce5e8[_0x2664('0x45')]=_0x1ce5e8[_0x2664('0x45')][_0x2664('0x4a')]?_0x1ce5e8[_0x2664('0x45')]:_0x6a540a['model'];_0x1ce5e8[_0x2664('0xd3')]=qs['sort'](_0x498880[_0x2664('0x3f')][_0x2664('0xd4')]);_0x1ce5e8[_0x2664('0x3e')]=qs['filters'](_[_0x2664('0xd5')](_0x498880[_0x2664('0x3f')],_0x6a540a[_0x2664('0xd0')]));if(_0x498880[_0x2664('0x3f')][_0x2664('0x2f')]){_0x1ce5e8[_0x2664('0x3e')]=_[_0x2664('0x52')](_0x1ce5e8['where'],{'$or':_[_0x2664('0x31')](_0x1ce5e8[_0x2664('0x45')],function(_0x3f40ec){var _0x40419c={};_0x40419c[_0x3f40ec]={'$like':'%'+_0x498880[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x40419c;})});}_0x1ce5e8=_[_0x2664('0x52')]({},_0x1ce5e8,_0x498880[_0x2664('0xd9')]);return _0x4adf5d[_0x2664('0x119')](_0x1ce5e8);}})[_0x2664('0x1d')](function(_0x3c0de0){if(_0x3c0de0){_0x872193=_0x3c0de0['length'];if(!_0x498880[_0x2664('0x3f')][_0x2664('0xc5')](_0x2664('0xd7'))){_0x1ce5e8['limit']=qs[_0x2664('0x19')](_0x498880['query'][_0x2664('0x19')]);_0x1ce5e8[_0x2664('0x16')]=qs[_0x2664('0x16')](_0x498880[_0x2664('0x3f')][_0x2664('0x16')]);}return _0x4adf5d[_0x2664('0x119')](_0x1ce5e8);}})[_0x2664('0x1d')](function(_0x58a974){if(_0x58a974){return _0x58a974?{'count':_0x872193,'rows':_0x58a974}:null;}})[_0x2664('0x1d')](respondWithResult(_0x2b0441,null))[_0x2664('0x50')](handleError(_0x2b0441,null));};exports[_0x2664('0x11a')]=function(_0x19d34f,_0x5774eb){var _0x294c82={};var _0x438c9c={};var _0x14e77d;return db[_0x2664('0x36')]['findOne']({'where':{'id':_0x19d34f[_0x2664('0x51')]['id']}})['then'](handleEntityNotFound(_0x5774eb,null))[_0x2664('0x1d')](function(_0x79b948){if(_0x79b948){_0x14e77d=_0x79b948;_0x438c9c['model']=_[_0x2664('0xcd')](db[_0x2664('0x36')][_0x2664('0xcf')]);_0x438c9c[_0x2664('0x3f')]=_['keys'](_0x19d34f['query']);_0x438c9c[_0x2664('0xd0')]=_[_0x2664('0xd1')](_0x438c9c['model'],_0x438c9c['query']);_0x294c82[_0x2664('0x45')]=_[_0x2664('0xd1')](_0x438c9c[_0x2664('0xcc')],qs[_0x2664('0xd2')](_0x19d34f[_0x2664('0x3f')][_0x2664('0xd2')]));_0x294c82[_0x2664('0x45')]=_0x294c82['attributes'][_0x2664('0x4a')]?_0x294c82[_0x2664('0x45')]:_0x438c9c[_0x2664('0xcc')];_0x294c82[_0x2664('0xd3')]=qs[_0x2664('0xd4')](_0x19d34f[_0x2664('0x3f')][_0x2664('0xd4')]);_0x294c82['where']=qs[_0x2664('0xd0')](_[_0x2664('0xd5')](_0x19d34f[_0x2664('0x3f')],_0x438c9c['filters']));if(_0x19d34f[_0x2664('0x3f')][_0x2664('0x2f')]){_0x294c82[_0x2664('0x3e')]=_[_0x2664('0x52')](_0x294c82[_0x2664('0x3e')],{'$or':_[_0x2664('0x31')](_0x294c82[_0x2664('0x45')],function(_0x4912d5){var _0x5f2441={};_0x5f2441[_0x4912d5]={'$like':'%'+_0x19d34f[_0x2664('0x3f')][_0x2664('0x2f')]+'%'};return _0x5f2441;})});}_0x294c82['model']=db[_0x2664('0x36')];_0x294c82['as']='Agents';_0x294c82=_[_0x2664('0x52')]({},_0x294c82,_0x19d34f['options']);return _0x14e77d['getVoiceQueues']({'include':[_0x294c82]});}})['then'](function(_0x361272){if(_0x361272){var _0x5b22fe={},_0x502c2a=[];for(var _0x3871a6=0x0;_0x3871a6<_0x361272[_0x2664('0x4a')];_0x3871a6+=0x1){for(var _0xce47e0=0x0,_0xe07d07;_0xce47e0<_0x361272[_0x3871a6][_0x2664('0x81')]['length'];_0xce47e0+=0x1){_0xe07d07=_0x361272[_0x3871a6]['Agents'][_0xce47e0]['get']({'plain':!![]});_0x5b22fe[_0xe07d07['id']]=_0xe07d07;}}_0x5b22fe=_[_0x2664('0x11b')](_0x5b22fe);for(var _0x460adf=qs[_0x2664('0x16')](_0x19d34f[_0x2664('0x3f')][_0x2664('0x16')]);_0x460adf<_0x5b22fe[_0x2664('0x4a')]&&_0x502c2a[_0x2664('0x4a')]=_0x3dda73[_0x1d41('0x50')]){throw new Error(_0x1d41('0x51'));}})[_0x1d41('0x1c')](function(){if(_0x558e45){return db[_0x1d41('0x45')]['destroy']({'where':{'membername':_0x558e45['name']},'individualHooks':!![]});}})[_0x1d41('0x1c')](function(){if(_0x558e45){return _0x558e45[_0x1d41('0x52')]({'raw':!![]});}})[_0x1d41('0x1c')](function(_0x303338){if(_0x558e45){if(_0x303338){var _0x34bf35=[];_0x6114a6=_0x303338;if(_0x6114a6[_0x1d41('0x28')]){for(var _0x4b08ae=0x0;_0x4b08ae<_0x6114a6['length'];_0x4b08ae++){_0x34bf35[_0x1d41('0x2e')](db[_0x1d41('0x45')][_0x1d41('0x53')]({'membername':_0x558e45[_0x1d41('0x20')],'UserId':_0x558e45['id'],'queue_name':_0x6114a6[_0x4b08ae][_0x1d41('0x20')],'VoiceQueueId':_0x6114a6[_0x4b08ae]['id'],'interface':_0x4ab927,'paused':_0x558e45[_0x1d41('0x4a')]||![],'penalty':_0x6114a6[_0x4b08ae][_0x1d41('0x54')]||0x0}));}return BPromise[_0x1d41('0x47')](_0x34bf35);}}}})[_0x1d41('0x1c')](function(){if(_0x558e45){return db['MemberReport'][_0x1d41('0xe')]({'where':{'membername':_0x558e45[_0x1d41('0x20')],'exitAt':null}});}})[_0x1d41('0x1c')](function(_0x19c64f){if(_0x558e45){if(_0x19c64f&&_0x19c64f[_0x1d41('0x28')]){var _0x19d50b=[];_0x19c64f['forEach'](function(_0x500577){_0x19d50b['push'](_0x500577[_0x1d41('0x25')]({'exitAt':moment()[_0x1d41('0x29')](_0x1d41('0x2a'))}));});return BPromise[_0x1d41('0x47')](_0x19d50b);}}})['then'](function(){if(_0x558e45){var _0x3e28ec=[];var _0x2f8c5d=[];var _0x1a0ef7=utils['getChannels']();var _0x550a34={'membername':_0x558e45['name'],'interface':_0x4ab927,'enterAt':moment()[_0x1d41('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x558e45['role'],'internal':_0x558e45[_0x1d41('0x22')]};_0x1a0ef7[_0x1d41('0x2d')](function(_0x43a172){_0x3e28ec['push'](_[_0x1d41('0x55')]({'channel':_0x43a172,'type':_0x1d41('0x56'),'data1':_0x1d41('0x57'),'data2':_0x4ab927},_0x550a34));if(_0x558e45[_0x1d41('0x4a')]){_0x2f8c5d[_0x1d41('0x2e')](_[_0x1d41('0x55')]({'channel':_0x43a172,'type':_0x1d41('0x27'),'data1':_0x1d41('0x58')},_0x550a34));}});return db[_0x1d41('0x26')][_0x1d41('0x35')](_0x3e28ec[_0x1d41('0x59')](_0x2f8c5d),{'individualHooks':!![]});}})[_0x1d41('0x1c')](function(){if(_0x558e45){return _0x558e45[_0x1d41('0x25')]({'online':!![],'lastLoginAt':moment()[_0x1d41('0x29')](_0x1d41('0x2a')),'voicePause':_0x558e45['loginInPause']||![],'mailPause':_0x558e45[_0x1d41('0x4a')]||![],'chatPause':_0x558e45['loginInPause']||![],'faxPause':_0x558e45[_0x1d41('0x4a')]||![],'smsPause':_0x558e45[_0x1d41('0x4a')]||![],'openchannelPause':_0x558e45[_0x1d41('0x4a')]||![],'pauseType':_0x558e45[_0x1d41('0x4a')]?_0x1d41('0x58'):null,'lastPauseAt':moment()[_0x1d41('0x29')](_0x1d41('0x2a')),'interface':_0x4ab927});}})[_0x1d41('0x1c')](function(_0x3bb73d){_0x4e62a3(_0x3bb73d);})[_0x1d41('0x17')](function(_0x2e0828){_0x1ff4d9(_0x25b17e['error'](0x1f4,_0x2e0828[_0x1d41('0x19')]));});});}; \ No newline at end of file +var _0x7d53=['socket.io-emitter','./user.socket','register','User','findAll','options','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowUser','raw','find','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','forEach','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','LOGIN','callysquare','merge','concat','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost'];(function(_0x4e486d,_0x3a7445){var _0x53aa6f=function(_0x3edb50){while(--_0x3edb50){_0x4e486d['push'](_0x4e486d['shift']());}};_0x53aa6f(++_0x3a7445);}(_0x7d53,0x161));var _0x37d5=function(_0x14b531,_0x5d9d8e){_0x14b531=_0x14b531-0x0;var _0x57b26e=_0x7d53[_0x14b531];return _0x57b26e;};'use strict';var _=require(_0x37d5('0x0'));var util=require(_0x37d5('0x1'));var moment=require('moment');var BPromise=require(_0x37d5('0x2'));var Redis=require(_0x37d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x37d5('0x4'));var logger=require(_0x37d5('0x5'))(_0x37d5('0x6'));var config=require(_0x37d5('0x7'));config[_0x37d5('0x8')]=_[_0x37d5('0x9')](config[_0x37d5('0x8')],{'host':_0x37d5('0xa'),'port':0x18eb});var socket=require(_0x37d5('0xb'))(new Redis(config[_0x37d5('0x8')]));require(_0x37d5('0xc'))[_0x37d5('0xd')](socket);exports['GetUser']=function(_0x14b550){var _0x44cfe0=this;return new Promise(function(_0x47de72,_0x4d5627){return db[_0x37d5('0xe')][_0x37d5('0xf')]({'raw':_0x14b550[_0x37d5('0x10')]?_0x14b550[_0x37d5('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x14b550[_0x37d5('0x10')]?_0x14b550[_0x37d5('0x10')][_0x37d5('0x11')]||null:null,'attributes':_0x14b550['options']?_0x14b550['options'][_0x37d5('0x12')]||null:null,'limit':_0x14b550['options']?_0x14b550[_0x37d5('0x10')][_0x37d5('0x13')]||null:null,'include':_0x14b550[_0x37d5('0x10')]?_0x14b550['options'][_0x37d5('0x14')]?_['map'](_0x14b550[_0x37d5('0x10')][_0x37d5('0x14')],function(_0x4f9a2e){return{'model':db[_0x4f9a2e[_0x37d5('0x15')]],'as':_0x4f9a2e['as'],'attributes':_0x4f9a2e['attributes'],'include':_0x4f9a2e[_0x37d5('0x14')]?_[_0x37d5('0x16')](_0x4f9a2e['include'],function(_0x3bd9d0){return{'model':db[_0x3bd9d0[_0x37d5('0x15')]],'as':_0x3bd9d0['as'],'attributes':_0x3bd9d0['attributes'],'include':_0x3bd9d0[_0x37d5('0x14')]?_['map'](_0x3bd9d0[_0x37d5('0x14')],function(_0x374ea3){return{'model':db[_0x374ea3[_0x37d5('0x15')]],'as':_0x374ea3['as'],'attributes':_0x374ea3[_0x37d5('0x12')]};}):[]};}):[]};}):[]:[]})[_0x37d5('0x17')](function(_0x5b4101){logger[_0x37d5('0x18')]('GetUser',_0x14b550);logger[_0x37d5('0x19')]('GetUser',_0x14b550,JSON[_0x37d5('0x1a')](_0x5b4101));_0x47de72(_0x5b4101);})[_0x37d5('0x1b')](function(_0x15a05a){logger[_0x37d5('0x1c')]('GetUser',_0x15a05a['message'],_0x14b550);_0x4d5627(_0x44cfe0['error'](0x1f4,_0x15a05a[_0x37d5('0x1d')]));});});};exports[_0x37d5('0x1e')]=function(_0x482f7b){var _0x4c2274=this;return new Promise(function(_0x35135c,_0x450e0f){return db['User']['find']({'raw':_0x482f7b[_0x37d5('0x10')]?_0x482f7b[_0x37d5('0x10')][_0x37d5('0x1f')]===undefined?!![]:![]:!![],'where':_0x482f7b['options']?_0x482f7b[_0x37d5('0x10')][_0x37d5('0x11')]||null:null,'attributes':_0x482f7b[_0x37d5('0x10')]?_0x482f7b[_0x37d5('0x10')][_0x37d5('0x12')]||null:null,'include':_0x482f7b[_0x37d5('0x10')]?_0x482f7b[_0x37d5('0x10')][_0x37d5('0x14')]?_[_0x37d5('0x16')](_0x482f7b[_0x37d5('0x10')][_0x37d5('0x14')],function(_0x4a8582){return{'model':db[_0x4a8582['model']],'as':_0x4a8582['as'],'attributes':_0x4a8582[_0x37d5('0x12')],'include':_0x4a8582[_0x37d5('0x14')]?_[_0x37d5('0x16')](_0x4a8582[_0x37d5('0x14')],function(_0x1fd89c){return{'model':db[_0x1fd89c[_0x37d5('0x15')]],'as':_0x1fd89c['as'],'attributes':_0x1fd89c[_0x37d5('0x12')],'include':_0x1fd89c[_0x37d5('0x14')]?_['map'](_0x1fd89c[_0x37d5('0x14')],function(_0x53b283){return{'model':db[_0x53b283[_0x37d5('0x15')]],'as':_0x53b283['as'],'attributes':_0x53b283[_0x37d5('0x12')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3442e6){logger[_0x37d5('0x18')](_0x37d5('0x1e'),_0x482f7b);logger[_0x37d5('0x19')](_0x37d5('0x1e'),_0x482f7b,JSON['stringify'](_0x3442e6));_0x35135c(_0x3442e6);})[_0x37d5('0x1b')](function(_0x37ee3c){logger[_0x37d5('0x1c')](_0x37d5('0x1e'),_0x37ee3c['message'],_0x482f7b);_0x450e0f(_0x4c2274['error'](0x1f4,_0x37ee3c['message']));});});};exports['PauseUser']=function(_0x548b28){var _0x4d16e0;return db[_0x37d5('0xe')][_0x37d5('0x20')]({'where':_0x548b28[_0x37d5('0x10')][_0x37d5('0x11')]||{},'attributes':['id',_0x37d5('0x21'),_0x37d5('0x22'),_0x37d5('0x23'),_0x37d5('0x24')]})['then'](function(_0x178def){if(!_0x178def){throw new Error(util[_0x37d5('0x25')](_0x37d5('0x26'),_0x548b28[_0x37d5('0x27')]['id']));}_0x4d16e0=_0x178def;return db[_0x37d5('0x28')][_0x37d5('0x29')]({'paused':0x1},{'where':{'UserId':_0x4d16e0['id']},'individualHooks':!![]});})[_0x37d5('0x17')](function(){return db['MemberReport'][_0x37d5('0xf')]({'where':{'membername':_0x4d16e0[_0x37d5('0x21')],'type':'PAUSE','exitAt':null}});})[_0x37d5('0x17')](function(_0x17d2bf){if(_0x17d2bf&&_0x17d2bf[_0x37d5('0x2a')]){var _0x553ce0=moment()[_0x37d5('0x25')](_0x37d5('0x2b'));for(var _0x56ef46=0x0,_0x27041b=_0x17d2bf[_0x37d5('0x2a')];_0x56ef46<_0x27041b;_0x56ef46++){_0x17d2bf[_0x56ef46][_0x37d5('0x2c')]({'exitAt':_0x553ce0});}}})[_0x37d5('0x17')](function(){var _0x68a9ff=[];var _0x5ec020=utils[_0x37d5('0x2d')]();_0x5ec020['forEach'](function(_0x573a4d){_0x68a9ff[_0x37d5('0x2e')]({'channel':_0x573a4d,'membername':_0x4d16e0[_0x37d5('0x21')],'interface':_['isNil'](_0x4d16e0['interface'])?util[_0x37d5('0x25')](_0x37d5('0x2f'),_0x4d16e0[_0x37d5('0x21')]):_0x4d16e0[_0x37d5('0x24')],'type':_0x37d5('0x30'),'enterAt':moment()[_0x37d5('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x548b28[_0x37d5('0x31')][_0x37d5('0x32')]||_0x37d5('0x33'),'role':_0x4d16e0[_0x37d5('0x22')],'internal':_0x4d16e0[_0x37d5('0x23')],'uniqueid':_0x548b28[_0x37d5('0x31')][_0x37d5('0x34')]||null});});return db[_0x37d5('0x35')][_0x37d5('0x36')](_0x68a9ff,{'individualHooks':!![]});})['then'](function(){return _0x4d16e0[_0x37d5('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x548b28[_0x37d5('0x31')]['type']||_0x37d5('0x33'),'lastPauseAt':moment()[_0x37d5('0x25')](_0x37d5('0x2b'))});})['catch'](function(_0x25277a){throw _0x25277a;});};exports[_0x37d5('0x37')]=function(_0x4f63a9){return Promise[_0x37d5('0x38')]()[_0x37d5('0x17')](function(){if(_0x4f63a9['body'][_0x37d5('0x39')]&&!utils[_0x37d5('0x3a')](_0x4f63a9[_0x37d5('0x31')][_0x37d5('0x39')])){throw new Error(util[_0x37d5('0x25')](_0x37d5('0x3b'),_0x4f63a9[_0x37d5('0x31')][_0x37d5('0x39')]));}return db[_0x37d5('0xe')][_0x37d5('0x3c')]({'where':_0x4f63a9[_0x37d5('0x10')][_0x37d5('0x11')]||{},'attributes':['id',_0x37d5('0x21'),'role',_0x37d5('0x23'),'interface',_0x37d5('0x3d'),'voicePause',_0x37d5('0x3e'),_0x37d5('0x3f'),'faxPause',_0x37d5('0x40'),_0x37d5('0x41'),_0x37d5('0x42'),_0x37d5('0x43'),_0x37d5('0x44')]});})[_0x37d5('0x17')](function(_0x241593){if(!_0x241593){throw new Error(util[_0x37d5('0x25')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4f63a9['params']['id']));}return _0x241593[_0x37d5('0x45')](_0x4f63a9[_0x37d5('0x31')][_0x37d5('0x39')],_0x37d5('0x46'));})[_0x37d5('0x1b')](function(_0x249a79){throw _0x249a79;});};exports[_0x37d5('0x47')]=function(_0x2aaab0){var _0x3c9eb5=this;return new Promise(function(_0x376674,_0x590584){var _0x591e3c;return db[_0x37d5('0xe')]['findOne']({'where':_0x2aaab0[_0x37d5('0x10')][_0x37d5('0x11')]||{},'attributes':['id',_0x37d5('0x21')]})[_0x37d5('0x17')](function(_0x164764){if(_0x164764){_0x591e3c=_0x164764;return db[_0x37d5('0x28')]['destroy']({'where':{'membername':_0x591e3c['name']},'individualHooks':!![]});}})[_0x37d5('0x17')](function(){if(_0x591e3c){return db[_0x37d5('0x35')][_0x37d5('0xf')]({'where':{'membername':_0x591e3c[_0x37d5('0x21')],'exitAt':null}});}})['then'](function(_0x3bd8d2){if(_0x591e3c){if(_0x3bd8d2&&_0x3bd8d2[_0x37d5('0x2a')]){var _0x5775f5=[];_0x3bd8d2[_0x37d5('0x48')](function(_0x6388df){_0x5775f5[_0x37d5('0x2e')](_0x6388df[_0x37d5('0x29')]({'exitAt':moment()['format'](_0x37d5('0x2b'))}));});return BPromise[_0x37d5('0x49')](_0x5775f5);}}})['then'](function(){if(_0x591e3c){return _0x591e3c[_0x37d5('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x37d5('0x17')](function(_0x27ef70){_0x376674(_0x27ef70);})[_0x37d5('0x1b')](function(_0x3d071e){_0x590584(_0x3c9eb5[_0x37d5('0x1c')](0x1f4,_0x3d071e['message']));});});};exports[_0x37d5('0x4a')]=function(_0x2539b3){var _0xd66835=this;return new Promise(function(_0x4dfbd9,_0x5148a1){var _0x460448;var _0x3baa62;var _0x4d6977;var _0x1aa446;return db[_0x37d5('0xe')]['findOne']({'where':_0x2539b3[_0x37d5('0x10')][_0x37d5('0x11')]||{},'attributes':['id',_0x37d5('0x21'),_0x37d5('0x22'),_0x37d5('0x4b'),_0x37d5('0x4c'),_0x37d5('0x23'),_0x37d5('0x4d'),_0x37d5('0x24')]})['then'](function(_0x3b8c8){if(_0x3b8c8){_0x460448=_0x3b8c8;_0x1aa446=_0x2539b3['body'][_0x37d5('0x24')]?_0x2539b3[_0x37d5('0x31')][_0x37d5('0x24')]:util[_0x37d5('0x25')]('SIP/%s',_0x460448['name']);return db[_0x37d5('0xe')][_0x37d5('0x4e')]({'where':{'role':_0x37d5('0x4f'),'online':!![],'id':{'$ne':_0x460448['id']}}});}})[_0x37d5('0x17')](function(_0x377288){if(_0x377288){_0x4d6977=_0x377288;return require(_0x37d5('0x50'))[_0x37d5('0x51')]();}})['then'](function(_0x4720ef){if(_0x4720ef&&_0x4720ef[_0x37d5('0x52')]&&_0x4d6977>=_0x4720ef['agents']){throw new Error(_0x37d5('0x53'));}})[_0x37d5('0x17')](function(){if(_0x460448){return db[_0x37d5('0x28')][_0x37d5('0x54')]({'where':{'membername':_0x460448['name']},'individualHooks':!![]});}})[_0x37d5('0x17')](function(){if(_0x460448){return _0x460448[_0x37d5('0x55')]({'raw':!![]});}})[_0x37d5('0x17')](function(_0x5cdaa8){if(_0x460448){if(_0x5cdaa8){var _0xf1b8f9=[];_0x3baa62=_0x5cdaa8;if(_0x3baa62[_0x37d5('0x2a')]){for(var _0x1c4272=0x0;_0x1c4272<_0x3baa62[_0x37d5('0x2a')];_0x1c4272++){_0xf1b8f9[_0x37d5('0x2e')](db['UserVoiceQueueRt'][_0x37d5('0x56')]({'membername':_0x460448[_0x37d5('0x21')],'UserId':_0x460448['id'],'queue_name':_0x3baa62[_0x1c4272]['name'],'VoiceQueueId':_0x3baa62[_0x1c4272]['id'],'interface':_0x1aa446,'paused':_0x460448['loginInPause']||![],'penalty':_0x3baa62[_0x1c4272]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x37d5('0x49')](_0xf1b8f9);}}}})[_0x37d5('0x17')](function(){if(_0x460448){return db[_0x37d5('0x35')][_0x37d5('0xf')]({'where':{'membername':_0x460448[_0x37d5('0x21')],'exitAt':null}});}})[_0x37d5('0x17')](function(_0x54fad9){if(_0x460448){if(_0x54fad9&&_0x54fad9[_0x37d5('0x2a')]){var _0x4b0c77=[];_0x54fad9['forEach'](function(_0x30f870){_0x4b0c77[_0x37d5('0x2e')](_0x30f870[_0x37d5('0x29')]({'exitAt':moment()['format'](_0x37d5('0x2b'))}));});return BPromise[_0x37d5('0x49')](_0x4b0c77);}}})[_0x37d5('0x17')](function(){if(_0x460448){var _0xa2884=[];var _0x4f9cb6=[];var _0x1588c7=utils['getChannels']();var _0xfd9596={'membername':_0x460448[_0x37d5('0x21')],'interface':_0x1aa446,'enterAt':moment()[_0x37d5('0x25')](_0x37d5('0x2b')),'role':_0x460448[_0x37d5('0x22')],'internal':_0x460448[_0x37d5('0x23')]};_0x1588c7[_0x37d5('0x48')](function(_0x19f5de){_0xa2884[_0x37d5('0x2e')](_['merge']({'channel':_0x19f5de,'type':_0x37d5('0x57'),'data1':_0x37d5('0x58'),'data2':_0x1aa446},_0xfd9596));if(_0x460448[_0x37d5('0x4d')]){_0x4f9cb6[_0x37d5('0x2e')](_[_0x37d5('0x59')]({'channel':_0x19f5de,'type':'PAUSE','data1':'LOGININPAUSE'},_0xfd9596));}});return db['MemberReport'][_0x37d5('0x36')](_0xa2884[_0x37d5('0x5a')](_0x4f9cb6),{'individualHooks':!![]});}})[_0x37d5('0x17')](function(){if(_0x460448){return _0x460448[_0x37d5('0x29')]({'online':!![],'lastLoginAt':moment()[_0x37d5('0x25')](_0x37d5('0x2b')),'voicePause':_0x460448[_0x37d5('0x4d')]||![],'mailPause':_0x460448[_0x37d5('0x4d')]||![],'chatPause':_0x460448['loginInPause']||![],'faxPause':_0x460448[_0x37d5('0x4d')]||![],'smsPause':_0x460448[_0x37d5('0x4d')]||![],'openchannelPause':_0x460448[_0x37d5('0x4d')]||![],'pauseType':_0x460448['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x37d5('0x25')](_0x37d5('0x2b')),'interface':_0x1aa446});}})[_0x37d5('0x17')](function(_0x5245e1){_0x4dfbd9(_0x5245e1);})[_0x37d5('0x1b')](function(_0x2a09eb){_0x5148a1(_0xd66835[_0x37d5('0x1c')](0x1f4,_0x2a09eb[_0x37d5('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e8f15ff..5b5d40d 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 _0xb9e7=['emit','removeListener','length','user:','./user.events','save','remove'];(function(_0x3adb44,_0x209d29){var _0x5328bf=function(_0x5cb877){while(--_0x5cb877){_0x3adb44['push'](_0x3adb44['shift']());}};_0x5328bf(++_0x209d29);}(_0xb9e7,0x193));var _0x7b9e=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0xb9e7[_0x2ecc65];return _0x103cc3;};'use strict';var UserEvents=require(_0x7b9e('0x0'));var events=[_0x7b9e('0x1'),_0x7b9e('0x2'),'update'];function createListener(_0x56674b,_0x527e6d){return function(_0x23e00f){_0x527e6d[_0x7b9e('0x3')](_0x56674b,_0x23e00f);};}function removeListener(_0x5121e3,_0x3df849){return function(){UserEvents[_0x7b9e('0x4')](_0x5121e3,_0x3df849);};}exports['register']=function(_0x5c70d7){for(var _0x5ceb81=0x0,_0x2d792f=events[_0x7b9e('0x5')];_0x5ceb81<_0x2d792f;_0x5ceb81++){var _0xf66339=events[_0x5ceb81];var _0x12302b=createListener(_0x7b9e('0x6')+_0xf66339,_0x5c70d7);UserEvents['on'](_0xf66339,_0x12302b);}}; \ No newline at end of file +var _0xe4ae=['user:','remove','update','emit','removeListener','register','length'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xe4ae,0x174));var _0xee4a=function(_0x21a777,_0x58b1e4){_0x21a777=_0x21a777-0x0;var _0x1cfb3f=_0xe4ae[_0x21a777];return _0x1cfb3f;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xee4a('0x0'),_0xee4a('0x1')];function createListener(_0x59a8dd,_0x3a7717){return function(_0x4afa15){_0x3a7717[_0xee4a('0x2')](_0x59a8dd,_0x4afa15);};}function removeListener(_0x1cf9d4,_0x30363e){return function(){UserEvents[_0xee4a('0x3')](_0x1cf9d4,_0x30363e);};}exports[_0xee4a('0x4')]=function(_0x1d70ee){for(var _0x2f411f=0x0,_0x1bf0e3=events[_0xee4a('0x5')];_0x2f411f<_0x1bf0e3;_0x2f411f++){var _0x53420c=events[_0x2f411f];var _0x3429bf=createListener(_0xee4a('0x6')+_0x53420c,_0x1d70ee);UserEvents['on'](_0x53420c,_0x3429bf);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9654c7e..672ba6d 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x269c90,_0xd91b24){var _0x52c634=function(_0x5bcf40){while(--_0x5bcf40){_0x269c90['push'](_0x269c90['shift']());}};_0x52c634(++_0xd91b24);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xcb91[_0x599e60];return _0x468e19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x551ece,_0x23d845){var _0x24ac88=function(_0x4d801a){while(--_0x4d801a){_0x551ece['push'](_0x551ece['shift']());}};_0x24ac88(++_0x23d845);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 29f1ae0..d50137c 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 _0x134d=['sequelize','INTEGER'];(function(_0x26daa0,_0x271f23){var _0x115b24=function(_0x42d5ac){while(--_0x42d5ac){_0x26daa0['push'](_0x26daa0['shift']());}};_0x115b24(++_0x271f23);}(_0x134d,0xfc));var _0xd134=function(_0x48eccc,_0x43cb41){_0x48eccc=_0x48eccc-0x0;var _0x5507be=_0x134d[_0x48eccc];return _0x5507be;};'use strict';var Sequelize=require(_0xd134('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd134('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8d3f=['INTEGER','sequelize','exports'];(function(_0x2032a8,_0xab3e67){var _0x4a9bff=function(_0x21831f){while(--_0x21831f){_0x2032a8['push'](_0x2032a8['shift']());}};_0x4a9bff(++_0xab3e67);}(_0x8d3f,0x1e4));var _0xf8d3=function(_0x3ab69c,_0xefe744){_0x3ab69c=_0x3ab69c-0x0;var _0x488551=_0x8d3f[_0x3ab69c];return _0x488551;};'use strict';var Sequelize=require(_0xf8d3('0x0'));module[_0xf8d3('0x1')]={'penalty':{'type':Sequelize[_0xf8d3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 615ed6c..7ec9c8b 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 _0xf1cb=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','UserChatQueue','lodash','util'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0xf1cb,0x1c0));var _0xbf1c=function(_0xf8b949,_0x38e38f){_0xf8b949=_0xf8b949-0x0;var _0xb009aa=_0xf1cb[_0xf8b949];return _0xb009aa;};'use strict';var _=require(_0xbf1c('0x0'));var util=require(_0xbf1c('0x1'));var logger=require(_0xbf1c('0x2'))(_0xbf1c('0x3'));var moment=require(_0xbf1c('0x4'));var BPromise=require(_0xbf1c('0x5'));var rp=require(_0xbf1c('0x6'));var fs=require('fs');var path=require(_0xbf1c('0x7'));var rimraf=require('rimraf');var config=require(_0xbf1c('0x8'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x2106b1,_0x3e5cab){return _0x2106b1['define'](_0xbf1c('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9458=['moment','request-promise','path','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x159969,_0x48b72a){var _0x21fb4b=function(_0x578e82){while(--_0x578e82){_0x159969['push'](_0x159969['shift']());}};_0x21fb4b(++_0x48b72a);}(_0x9458,0x1b8));var _0x8945=function(_0xf2ddb4,_0x480640){_0xf2ddb4=_0xf2ddb4-0x0;var _0x5b6d8d=_0x9458[_0xf2ddb4];return _0x5b6d8d;};'use strict';var _=require(_0x8945('0x0'));var util=require(_0x8945('0x1'));var logger=require(_0x8945('0x2'))(_0x8945('0x3'));var moment=require(_0x8945('0x4'));var BPromise=require('bluebird');var rp=require(_0x8945('0x5'));var fs=require('fs');var path=require(_0x8945('0x6'));var rimraf=require(_0x8945('0x7'));var config=require('../../config/environment');var attributes=require(_0x8945('0x8'));module['exports']=function(_0x53ab5a,_0x5357c4){return _0x53ab5a[_0x8945('0x9')](_0x8945('0xa'),attributes,{'tableName':_0x8945('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index fa400ec..7f99fdd 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 _0x6051=['rpc','../../config/environment','client','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2b00f8,_0x4874c9){var _0x4df6ee=function(_0x4f25a4){while(--_0x4f25a4){_0x2b00f8['push'](_0x2b00f8['shift']());}};_0x4df6ee(++_0x4874c9);}(_0x6051,0x1b0));var _0x1605=function(_0x16dced,_0x2f8d60){_0x16dced=_0x16dced-0x0;var _0x40e9d7=_0x6051[_0x16dced];return _0x40e9d7;};'use strict';var _=require(_0x1605('0x0'));var util=require(_0x1605('0x1'));var moment=require(_0x1605('0x2'));var BPromise=require(_0x1605('0x3'));var rs=require(_0x1605('0x4'));var fs=require('fs');var Redis=require(_0x1605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1605('0x6'));var logger=require(_0x1605('0x7'))(_0x1605('0x8'));var config=require(_0x1605('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1605('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eee84,_0x515b79,_0x53e609){return new BPromise(function(_0x218dd7,_0x2ee84b){return client['request'](_0x1eee84,_0x53e609)[_0x1605('0xb')](function(_0x33fd1b){logger[_0x1605('0xc')](_0x1605('0xd'),_0x515b79,_0x1605('0xe'));logger[_0x1605('0xf')](_0x1605('0x10'),_0x515b79,_0x1605('0xe'),JSON[_0x1605('0x11')](_0x33fd1b));if(_0x33fd1b['error']){if(_0x33fd1b['error'][_0x1605('0x12')]===0x1f4){logger[_0x1605('0x13')](_0x1605('0xd'),_0x515b79,_0x33fd1b[_0x1605('0x13')][_0x1605('0x14')]);return _0x2ee84b(_0x33fd1b[_0x1605('0x13')][_0x1605('0x14')]);}logger[_0x1605('0x13')](_0x1605('0xd'),_0x515b79,_0x33fd1b['error']['message']);return _0x218dd7(_0x33fd1b[_0x1605('0x13')]['message']);}else{logger[_0x1605('0xc')](_0x1605('0xd'),_0x515b79,_0x1605('0xe'));_0x218dd7(_0x33fd1b[_0x1605('0x15')][_0x1605('0x14')]);}})['catch'](function(_0x1a042b){logger[_0x1605('0x13')](_0x1605('0xd'),_0x515b79,_0x1a042b);_0x2ee84b(_0x1a042b);});});} \ No newline at end of file +var _0x6c72=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x501360,_0x418167){var _0x947be6=function(_0x5db7eb){while(--_0x5db7eb){_0x501360['push'](_0x501360['shift']());}};_0x947be6(++_0x418167);}(_0x6c72,0x1cd));var _0x26c7=function(_0x1e80c9,_0x5ed7fa){_0x1e80c9=_0x1e80c9-0x0;var _0x1ecf94=_0x6c72[_0x1e80c9];return _0x1ecf94;};'use strict';var _=require(_0x26c7('0x0'));var util=require(_0x26c7('0x1'));var moment=require('moment');var BPromise=require(_0x26c7('0x2'));var rs=require(_0x26c7('0x3'));var fs=require('fs');var Redis=require(_0x26c7('0x4'));var db=require(_0x26c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x26c7('0x6'))(_0x26c7('0x7'));var config=require(_0x26c7('0x8'));var jayson=require(_0x26c7('0x9'));var client=jayson[_0x26c7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b4c8a,_0x53d44a,_0x4e6b24){return new BPromise(function(_0x1f3b35,_0x1bd770){return client['request'](_0x1b4c8a,_0x4e6b24)[_0x26c7('0xb')](function(_0x5bbb4e){logger[_0x26c7('0xc')](_0x26c7('0xd'),_0x53d44a,_0x26c7('0xe'));logger[_0x26c7('0xf')](_0x26c7('0x10'),_0x53d44a,_0x26c7('0xe'),JSON[_0x26c7('0x11')](_0x5bbb4e));if(_0x5bbb4e[_0x26c7('0x12')]){if(_0x5bbb4e[_0x26c7('0x12')]['code']===0x1f4){logger[_0x26c7('0x12')](_0x26c7('0xd'),_0x53d44a,_0x5bbb4e[_0x26c7('0x12')]['message']);return _0x1bd770(_0x5bbb4e[_0x26c7('0x12')][_0x26c7('0x13')]);}logger[_0x26c7('0x12')](_0x26c7('0xd'),_0x53d44a,_0x5bbb4e[_0x26c7('0x12')][_0x26c7('0x13')]);return _0x1f3b35(_0x5bbb4e[_0x26c7('0x12')][_0x26c7('0x13')]);}else{logger[_0x26c7('0xc')](_0x26c7('0xd'),_0x53d44a,_0x26c7('0xe'));_0x1f3b35(_0x5bbb4e[_0x26c7('0x14')][_0x26c7('0x13')]);}})['catch'](function(_0x3fc86d){logger[_0x26c7('0x12')](_0x26c7('0xd'),_0x53d44a,_0x3fc86d);_0x1bd770(_0x3fc86d);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 6427fc9..0b11de2 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3e446d,_0x2e3494){var _0x90cac7=function(_0x40b3a9){while(--_0x40b3a9){_0x3e446d['push'](_0x3e446d['shift']());}};_0x90cac7(++_0x2e3494);}(_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(_0x28e172,_0x30909b){var _0x4ec0c5=function(_0x21c952){while(--_0x21c952){_0x28e172['push'](_0x28e172['shift']());}};_0x4ec0c5(++_0x30909b);}(_0xedd9,0xfc));var _0x9edd=function(_0x2da352,_0x5a2291){_0x2da352=_0x2da352-0x0;var _0x1ab378=_0xedd9[_0x2da352];return _0x1ab378;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index bb73a87..584e663 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 _0x8cab=['STRING','exports','INTEGER'];(function(_0x57e7d0,_0x37a0d2){var _0x7c49fe=function(_0x404b36){while(--_0x404b36){_0x57e7d0['push'](_0x57e7d0['shift']());}};_0x7c49fe(++_0x37a0d2);}(_0x8cab,0x85));var _0xb8ca=function(_0x5e4e7b,_0x37f3db){_0x5e4e7b=_0x5e4e7b-0x0;var _0x324eb2=_0x8cab[_0x5e4e7b];return _0x324eb2;};'use strict';var Sequelize=require('sequelize');module[_0xb8ca('0x0')]={'penalty':{'type':Sequelize[_0xb8ca('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb8ca('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb8ca('0x2')]}}; \ No newline at end of file +var _0x4125=['INTEGER','sequelize','exports'];(function(_0x856b44,_0x3ec510){var _0x4900ac=function(_0x39d49c){while(--_0x39d49c){_0x856b44['push'](_0x856b44['shift']());}};_0x4900ac(++_0x3ec510);}(_0x4125,0x15d));var _0x5412=function(_0x11ee6a,_0x516a1a){_0x11ee6a=_0x11ee6a-0x0;var _0x4e5e4c=_0x4125[_0x11ee6a];return _0x4e5e4c;};'use strict';var Sequelize=require(_0x5412('0x0'));module[_0x5412('0x1')]={'penalty':{'type':Sequelize[_0x5412('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5412('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d6a568f..7056377 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 _0x7963=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7963,0x14a));var _0x3796=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0x7963[_0x10d0f0];return _0x93e308;};'use strict';var _=require('lodash');var util=require(_0x3796('0x0'));var logger=require(_0x3796('0x1'))(_0x3796('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3796('0x3'));var fs=require('fs');var path=require(_0x3796('0x4'));var rimraf=require(_0x3796('0x5'));var config=require(_0x3796('0x6'));var attributes=require(_0x3796('0x7'));module[_0x3796('0x8')]=function(_0x458c07,_0xb535c7){return _0x458c07[_0x3796('0x9')](_0x3796('0xa'),attributes,{'tableName':_0x3796('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa850=['define','UserFaxQueue','user_has_fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0xa850,0x12f));var _0x0a85=function(_0x31e807,_0x4072d1){_0x31e807=_0x31e807-0x0;var _0x16d9a3=_0xa850[_0x31e807];return _0x16d9a3;};'use strict';var _=require(_0x0a85('0x0'));var util=require(_0x0a85('0x1'));var logger=require('../../config/logger')(_0x0a85('0x2'));var moment=require(_0x0a85('0x3'));var BPromise=require(_0x0a85('0x4'));var rp=require(_0x0a85('0x5'));var fs=require('fs');var path=require(_0x0a85('0x6'));var rimraf=require(_0x0a85('0x7'));var config=require(_0x0a85('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x5c6601,_0x2578f6){return _0x5c6601[_0x0a85('0x9')](_0x0a85('0xa'),attributes,{'tableName':_0x0a85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 1ac3098..e867bb6 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 _0x4e00=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x388e72,_0x3ea102){var _0x3dc3ae=function(_0x97c695){while(--_0x97c695){_0x388e72['push'](_0x388e72['shift']());}};_0x3dc3ae(++_0x3ea102);}(_0x4e00,0x104));var _0x04e0=function(_0x2a54d4,_0x32722a){_0x2a54d4=_0x2a54d4-0x0;var _0x1db786=_0x4e00[_0x2a54d4];return _0x1db786;};'use strict';var _=require(_0x04e0('0x0'));var util=require(_0x04e0('0x1'));var moment=require(_0x04e0('0x2'));var BPromise=require(_0x04e0('0x3'));var rs=require(_0x04e0('0x4'));var fs=require('fs');var Redis=require(_0x04e0('0x5'));var db=require(_0x04e0('0x6'))['db'];var utils=require(_0x04e0('0x7'));var logger=require(_0x04e0('0x8'))('rpc');var config=require(_0x04e0('0x9'));var jayson=require(_0x04e0('0xa'));var client=jayson[_0x04e0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24ae1d,_0x5e26c6,_0x135a38){return new BPromise(function(_0x4c8a59,_0x5c89a4){return client['request'](_0x24ae1d,_0x135a38)[_0x04e0('0xc')](function(_0x45f485){logger[_0x04e0('0xd')](_0x04e0('0xe'),_0x5e26c6,_0x04e0('0xf'));logger[_0x04e0('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5e26c6,_0x04e0('0xf'),JSON[_0x04e0('0x11')](_0x45f485));if(_0x45f485[_0x04e0('0x12')]){if(_0x45f485['error'][_0x04e0('0x13')]===0x1f4){logger[_0x04e0('0x12')](_0x04e0('0xe'),_0x5e26c6,_0x45f485['error'][_0x04e0('0x14')]);return _0x5c89a4(_0x45f485[_0x04e0('0x12')]['message']);}logger[_0x04e0('0x12')](_0x04e0('0xe'),_0x5e26c6,_0x45f485[_0x04e0('0x12')][_0x04e0('0x14')]);return _0x4c8a59(_0x45f485[_0x04e0('0x12')][_0x04e0('0x14')]);}else{logger['info'](_0x04e0('0xe'),_0x5e26c6,'request\x20sent');_0x4c8a59(_0x45f485['result']['message']);}})[_0x04e0('0x15')](function(_0x4c5201){logger[_0x04e0('0x12')](_0x04e0('0xe'),_0x5e26c6,_0x4c5201);_0x5c89a4(_0x4c5201);});});} \ No newline at end of file +var _0x16a1=['rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38e1c3,_0x40ed83){var _0x742afe=function(_0x36279f){while(--_0x36279f){_0x38e1c3['push'](_0x38e1c3['shift']());}};_0x742afe(++_0x40ed83);}(_0x16a1,0x122));var _0x116a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x16a1[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x116a('0x0'));var util=require(_0x116a('0x1'));var moment=require(_0x116a('0x2'));var BPromise=require(_0x116a('0x3'));var rs=require(_0x116a('0x4'));var fs=require('fs');var Redis=require(_0x116a('0x5'));var db=require(_0x116a('0x6'))['db'];var utils=require(_0x116a('0x7'));var logger=require(_0x116a('0x8'))(_0x116a('0x9'));var config=require(_0x116a('0xa'));var jayson=require(_0x116a('0xb'));var client=jayson[_0x116a('0xc')][_0x116a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x39ead2,_0x77f00a,_0x4a87c4){return new BPromise(function(_0x217a4f,_0x55222a){return client[_0x116a('0xe')](_0x39ead2,_0x4a87c4)['then'](function(_0x427625){logger[_0x116a('0xf')](_0x116a('0x10'),_0x77f00a,_0x116a('0x11'));logger['debug'](_0x116a('0x12'),_0x77f00a,_0x116a('0x11'),JSON[_0x116a('0x13')](_0x427625));if(_0x427625['error']){if(_0x427625['error']['code']===0x1f4){logger[_0x116a('0x14')](_0x116a('0x10'),_0x77f00a,_0x427625[_0x116a('0x14')][_0x116a('0x15')]);return _0x55222a(_0x427625[_0x116a('0x14')]['message']);}logger['error'](_0x116a('0x10'),_0x77f00a,_0x427625[_0x116a('0x14')][_0x116a('0x15')]);return _0x217a4f(_0x427625['error']['message']);}else{logger[_0x116a('0xf')](_0x116a('0x10'),_0x77f00a,_0x116a('0x11'));_0x217a4f(_0x427625[_0x116a('0x16')][_0x116a('0x15')]);}})['catch'](function(_0x163e36){logger[_0x116a('0x14')](_0x116a('0x10'),_0x77f00a,_0x163e36);_0x55222a(_0x163e36);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d47514e..4a5fd76 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x15c23e,_0x162305){var _0x4ed7d1=function(_0x3d65e7){while(--_0x3d65e7){_0x15c23e['push'](_0x15c23e['shift']());}};_0x4ed7d1(++_0x162305);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c1d1c31..4554bc5 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 _0xac85=['INTEGER','exports'];(function(_0xe9bde6,_0x4fd817){var _0x4104fb=function(_0x557f04){while(--_0x557f04){_0xe9bde6['push'](_0xe9bde6['shift']());}};_0x4104fb(++_0x4fd817);}(_0xac85,0x77));var _0x5ac8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xac85[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x5ac8('0x0')]={'penalty':{'type':Sequelize[_0x5ac8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5e00=['sequelize'];(function(_0x786d84,_0x562915){var _0x39ce67=function(_0xdc4111){while(--_0xdc4111){_0x786d84['push'](_0x786d84['shift']());}};_0x39ce67(++_0x562915);}(_0x5e00,0xd0));var _0x05e0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5e00[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x05e0('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index a2b5126..726d139 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 _0xa6f1=['UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x397741,_0x291896){var _0x3a81c3=function(_0x195c72){while(--_0x195c72){_0x397741['push'](_0x397741['shift']());}};_0x3a81c3(++_0x291896);}(_0xa6f1,0x113));var _0x1a6f=function(_0x503ec3,_0x5f851e){_0x503ec3=_0x503ec3-0x0;var _0x4ce7cf=_0xa6f1[_0x503ec3];return _0x4ce7cf;};'use strict';var _=require(_0x1a6f('0x0'));var util=require(_0x1a6f('0x1'));var logger=require(_0x1a6f('0x2'))(_0x1a6f('0x3'));var moment=require(_0x1a6f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a6f('0x5'));var rimraf=require(_0x1a6f('0x6'));var config=require(_0x1a6f('0x7'));var attributes=require(_0x1a6f('0x8'));module[_0x1a6f('0x9')]=function(_0x44a5df,_0x5bffa1){return _0x44a5df[_0x1a6f('0xa')](_0x1a6f('0xb'),attributes,{'tableName':_0x1a6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf8=['util','../../config/logger','moment','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0xbaf8,0x18c));var _0x8baf=function(_0x28e4ec,_0x22f691){_0x28e4ec=_0x28e4ec-0x0;var _0x161a64=_0xbaf8[_0x28e4ec];return _0x161a64;};'use strict';var _=require('lodash');var util=require(_0x8baf('0x0'));var logger=require(_0x8baf('0x1'))('api');var moment=require(_0x8baf('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8baf('0x3'));var rimraf=require(_0x8baf('0x4'));var config=require('../../config/environment');var attributes=require(_0x8baf('0x5'));module[_0x8baf('0x6')]=function(_0x52f7e5,_0x5bcda9){return _0x52f7e5[_0x8baf('0x7')](_0x8baf('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index d52cefe..663ada2 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1cb9,0x14e));var _0x91cb=function(_0x30017d,_0x29cfca){_0x30017d=_0x30017d-0x0;var _0x17f95e=_0x1cb9[_0x30017d];return _0x17f95e;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0xe49c26,_0xdb0fa0){var _0x38ff9d=function(_0xd848d7){while(--_0xd848d7){_0xe49c26['push'](_0xe49c26['shift']());}};_0x38ff9d(++_0xdb0fa0);}(_0x4b84,0x1cc));var _0x44b8=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0x4b84[_0x148c09];return _0x18e613;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index e807f8c..6b56ace 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 _0xb045=['post','isAuthenticated','sendUserNotification','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x57d7df,_0x25730a){var _0x3e125b=function(_0x5a29a9){while(--_0x5a29a9){_0x57d7df['push'](_0x57d7df['shift']());}};_0x3e125b(++_0x25730a);}(_0xb045,0x1f3));var _0x5b04=function(_0x722103,_0x5732f3){_0x722103=_0x722103-0x0;var _0x3e2435=_0xb045[_0x722103];return _0x3e2435;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5b04('0x0'));var express=require('express');var router=express[_0x5b04('0x1')]();var fs_extra=require(_0x5b04('0x2'));var auth=require(_0x5b04('0x3'));var interaction=require(_0x5b04('0x4'));var config=require(_0x5b04('0x5'));var controller=require(_0x5b04('0x6'));router[_0x5b04('0x7')]('/',auth[_0x5b04('0x8')](),controller[_0x5b04('0x9')]);module[_0x5b04('0xa')]=router; \ No newline at end of file +var _0xbc86=['exports','multer','path','connect-timeout','express','Router','fs-extra','./userNotification.controller','post','sendUserNotification'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbc86,0x191));var _0x6bc8=function(_0x4016d8,_0x1e839f){_0x4016d8=_0x4016d8-0x0;var _0x4549bb=_0xbc86[_0x4016d8];return _0x4549bb;};'use strict';var multer=require(_0x6bc8('0x0'));var util=require('util');var path=require(_0x6bc8('0x1'));var timeout=require(_0x6bc8('0x2'));var express=require(_0x6bc8('0x3'));var router=express[_0x6bc8('0x4')]();var fs_extra=require(_0x6bc8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6bc8('0x6'));router[_0x6bc8('0x7')]('/',auth['isAuthenticated'](),controller[_0x6bc8('0x8')]);module[_0x6bc8('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 53f6779..6639057 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 _0xec04=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4dfe51,_0x1b4fc9){var _0x3a0881=function(_0x557818){while(--_0x557818){_0x4dfe51['push'](_0x4dfe51['shift']());}};_0x3a0881(++_0x1b4fc9);}(_0xec04,0x19a));var _0x4ec0=function(_0x1ba6c6,_0xeb171a){_0x1ba6c6=_0x1ba6c6-0x0;var _0x5a6ba4=_0xec04[_0x1ba6c6];return _0x5a6ba4;};'use strict';var Sequelize=require(_0x4ec0('0x0'));module[_0x4ec0('0x1')]={'body':{'type':Sequelize[_0x4ec0('0x2')]},'senderName':{'type':Sequelize[_0x4ec0('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x4ec0('0x3')]},'beep':{'type':Sequelize[_0x4ec0('0x4')]}}; \ No newline at end of file +var _0xded1=['TEXT','sequelize','exports'];(function(_0x4d9baa,_0x56bf57){var _0xb245a7=function(_0x4668bf){while(--_0x4668bf){_0x4d9baa['push'](_0x4d9baa['shift']());}};_0xb245a7(++_0x56bf57);}(_0xded1,0x199));var _0x1ded=function(_0x3f4c67,_0x1a5f87){_0x3f4c67=_0x3f4c67-0x0;var _0x5c3777=_0xded1[_0x3f4c67];return _0x5c3777;};'use strict';var Sequelize=require(_0x1ded('0x0'));module[_0x1ded('0x1')]={'body':{'type':Sequelize[_0x1ded('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 7c82dff..22de469 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 _0x7d24=['SenderId','join','sequelize','UserNotification','forEach','recipient','userNotification:send','catch','Template','html','User','union','ids','includes','queue','replace','Queue','push','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x7d24,0x13c));var _0x47d2=function(_0x45d628,_0x1190fb){_0x45d628=_0x45d628-0x0;var _0x3675ad=_0x7d24[_0x45d628];return _0x3675ad;};'use strict';var emlformat=require(_0x47d2('0x0'));var rimraf=require(_0x47d2('0x1'));var zipdir=require(_0x47d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47d2('0x3'));var moment=require(_0x47d2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47d2('0x5'));var util=require(_0x47d2('0x6'));var path=require(_0x47d2('0x7'));var sox=require(_0x47d2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47d2('0x9'));var _=require(_0x47d2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x47d2('0xb'));var deskjs=require(_0x47d2('0xc'));var toCsv=require(_0x47d2('0xd'));var querystring=require(_0x47d2('0xe'));var Papa=require(_0x47d2('0xf'));var Redis=require(_0x47d2('0x10'));var authService=require(_0x47d2('0x11'));var qs=require(_0x47d2('0x12'));var as=require(_0x47d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47d2('0x14'))(_0x47d2('0x15'));var utils=require(_0x47d2('0x16'));var config=require(_0x47d2('0x17'));var licenseUtil=require(_0x47d2('0x18'));var db=require(_0x47d2('0x19'))['db'];config['redis']=_[_0x47d2('0x1a')](config['redis'],{'host':_0x47d2('0x1b'),'port':0x18eb});var socket=require(_0x47d2('0x1c'))(new Redis(config['redis']));require(_0x47d2('0x1d'))[_0x47d2('0x1e')](socket);function respondWithStatusCode(_0x521397,_0x404c50){_0x404c50=_0x404c50||0xcc;return function(_0x9048bd){if(_0x9048bd){return _0x521397[_0x47d2('0x1f')](_0x404c50);}return _0x521397[_0x47d2('0x20')](_0x404c50)[_0x47d2('0x21')]();};}function respondWithResult(_0x185eec,_0xc022bd){_0xc022bd=_0xc022bd||0xc8;return function(_0x29adb2){if(_0x29adb2){return _0x185eec[_0x47d2('0x20')](_0xc022bd)[_0x47d2('0x22')](_0x29adb2);}};}function respondWithFilteredResult(_0x5030d7,_0x2b67b6){return function(_0x297d26){if(_0x297d26){var _0x2aabc6=typeof _0x2b67b6['offset']===_0x47d2('0x23')&&typeof _0x2b67b6[_0x47d2('0x24')]===_0x47d2('0x23');var _0x2d7262=_0x297d26[_0x47d2('0x25')];var _0x31dd7b=_0x2aabc6?0x0:_0x2b67b6[_0x47d2('0x26')];var _0x56ca08=_0x2aabc6?_0x297d26[_0x47d2('0x25')]:_0x2b67b6[_0x47d2('0x26')]+_0x2b67b6[_0x47d2('0x24')];var _0x5f5888;if(_0x56ca08>=_0x2d7262){_0x56ca08=_0x2d7262;_0x5f5888=0xc8;}else{_0x5f5888=0xce;}_0x5030d7[_0x47d2('0x20')](_0x5f5888);return _0x5030d7[_0x47d2('0x27')]('Content-Range',_0x31dd7b+'-'+_0x56ca08+'/'+_0x2d7262)[_0x47d2('0x22')](_0x297d26);}return null;};}function patchUpdates(_0x2f1a97){return function(_0x5a5d9b){try{jsonpatch[_0x47d2('0x28')](_0x5a5d9b,_0x2f1a97,!![]);}catch(_0x208e3e){return BPromise['reject'](_0x208e3e);}return _0x5a5d9b['save']();};}function saveUpdates(_0x2ca25f,_0x1e2a51){return function(_0xc779f){if(_0xc779f){return _0xc779f['update'](_0x2ca25f)[_0x47d2('0x29')](function(_0x4f06e3){return _0x4f06e3;});}return null;};}function removeEntity(_0x37e2c5,_0x28c38e){return function(_0x3a9935){if(_0x3a9935){return _0x3a9935['destroy']()[_0x47d2('0x29')](function(){_0x37e2c5[_0x47d2('0x20')](0xcc)[_0x47d2('0x21')]();});}};}function handleEntityNotFound(_0x49c89e,_0x441c61){return function(_0x550d54){if(!_0x550d54){_0x49c89e['sendStatus'](0x194);}return _0x550d54;};}function handleError(_0x1bebeb,_0x488108){_0x488108=_0x488108||0x1f4;return function(_0xfd78b4){logger[_0x47d2('0x2a')](_0xfd78b4[_0x47d2('0x2b')]);if(_0xfd78b4[_0x47d2('0x2c')]){delete _0xfd78b4[_0x47d2('0x2c')];}_0x1bebeb[_0x47d2('0x20')](_0x488108)[_0x47d2('0x2d')](_0xfd78b4);};}exports[_0x47d2('0x2e')]=function(_0x1f31e5,_0x98e970,_0x571e29){if(!_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x31'))&&!_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x32'))){throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))](_0x47d2('0x35'));}else{if(_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x32'))&&!_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x36'))){throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))](_0x47d2('0x37'));}if(!_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x38'))){throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))](_0x47d2('0x39'));}else{try{var _0x502728=JSON[_0x47d2('0x3a')](_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x38')]);}catch(_0x497966){logger[_0x47d2('0x2a')](_0x497966);throw new db['Sequelize'][(_0x47d2('0x34'))](_0x47d2('0x3b'));}var _0x463628=[_0x47d2('0x3c'),_0x47d2('0x3d'),_0x47d2('0x3e'),_0x47d2('0x3f'),_0x47d2('0x40'),_0x47d2('0x41'),'whatsappqueue',_0x47d2('0x42'),_0x47d2('0x43')];if(_[_0x47d2('0x44')](_0x502728,function(_0xa547c5){return!_['includes'](_0x463628,_0xa547c5['model'][_0x47d2('0x45')]());})){throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))](_0x47d2('0x46'));}}}var _0x4fc103={};_0x4fc103[_0x47d2('0x47')]=_0x1f31e5['body'][_0x47d2('0x30')](_0x47d2('0x47'))?_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x47')]:_0x1f31e5[_0x47d2('0x43')][_0x47d2('0x48')];_0x4fc103[_0x47d2('0x49')]=_[_0x47d2('0x4a')](_0x1f31e5['body'][_0x47d2('0x49')])?null:_0x1f31e5['body'][_0x47d2('0x49')];_0x4fc103['beep']=_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x4b')]||![];_0x4fc103[_0x47d2('0x4c')]=_0x1f31e5[_0x47d2('0x43')]['id'];return getContent(_0x1f31e5[_0x47d2('0x2f')])[_0x47d2('0x29')](function(_0x5c1d3e){_0x4fc103['body']=_0x5c1d3e;return getRecipients(_0x502728);})['then'](function(_0x49980b){_0x4fc103['recipientsId']=_['sortBy'](_0x49980b)[_0x47d2('0x4d')](',');return db[_0x47d2('0x4e')]['transaction'](function(_0x339fad){return db[_0x47d2('0x4f')]['create'](_0x4fc103,{'raw':!![],'transaction':_0x339fad})[_0x47d2('0x29')](function(_0x233c65){var _0x42c75d={'sender':_0x4fc103['senderName'],'description':_0x4fc103['recipientsDescription'],'content':_0x4fc103[_0x47d2('0x2f')],'beep':_0x4fc103[_0x47d2('0x4b')]};_0x49980b[_0x47d2('0x50')](function(_0x320bc9){_0x42c75d[_0x47d2('0x51')]=_0x320bc9;socket['emit'](_0x47d2('0x52'),_0x42c75d);});return _0x233c65;});});})['then'](respondWithResult(_0x98e970,0xc9))[_0x47d2('0x53')](handleError(_0x98e970,null));};function getContent(_0x5246f9){return new BPromise(function(_0x47142e,_0x30a8f2){if(_0x5246f9['text']){_0x47142e(_0x5246f9['text']);return;}return db[_0x47d2('0x54')]['findOne']({'attributes':[_0x47d2('0x55')],'where':{'id':_0x5246f9['TemplateId']},'raw':!![]})['then'](function(_0x11eeb1){if(!_0x11eeb1)throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1e35ab=Mustache['render'](_0x11eeb1[_0x47d2('0x55')],_0x5246f9[_0x47d2('0x36')]);_0x47142e(_0x1e35ab);})[_0x47d2('0x53')](function(_0xf1b3a9){_0x30a8f2(_0xf1b3a9);});});}function getRecipients(_0x4b7133){return new BPromise(function(_0x265743,_0x52bd13){var _0xfbcb9c=[];var _0x1a6550=[];_0x4b7133['forEach'](function(_0x3022c7){var _0x309b61=_['startCase'](_0x3022c7['model']['toLowerCase']());if(_0x309b61===_0x47d2('0x56')){_0xfbcb9c=_[_0x47d2('0x57')](_0xfbcb9c,_0x3022c7[_0x47d2('0x58')]);}else{if(_[_0x47d2('0x59')](_0x309b61,_0x47d2('0x5a')))_0x309b61=_0x309b61[_0x47d2('0x5b')](_0x47d2('0x5a'),_0x47d2('0x5c'));_0x3022c7[_0x47d2('0x58')]['forEach'](function(_0x4fb9e5){_0x1a6550[_0x47d2('0x5d')](getAgents(_0x309b61,_0x4fb9e5));});}});return BPromise['all'](_0x1a6550)[_0x47d2('0x29')](function(_0x59b1fd){_0xfbcb9c=_['union'](_0xfbcb9c,_[_0x47d2('0x5e')](_0x59b1fd));_0x265743(_0xfbcb9c);})[_0x47d2('0x53')](function(_0x99c42){_0x52bd13(_0x99c42);});});}function getAgents(_0x20885a,_0x5154ca){return new BPromise(function(_0x18003e,_0x4fd124){return db[_0x20885a][_0x47d2('0x5f')]({'where':{'id':_0x5154ca}})[_0x47d2('0x29')](function(_0x6e076f){return _0x6e076f[_0x47d2('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5dc7eb){var _0x5e4e1a=_[_0x47d2('0x61')](_0x5dc7eb,'id');_0x18003e(_0x5e4e1a);});})[_0x47d2('0x53')](function(_0x41fbf7){_0x4fd124(_0x41fbf7);});});} \ No newline at end of file +var _0x48f9=['SenderId','recipientsId','sortBy','join','sequelize','recipient','emit','catch','Template','html','model','User','union','ids','queue','replace','Queue','push','flatten','map','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27recipients\x27\x20parameter','recipients','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep'];(function(_0x2adb2f,_0x2d9bff){var _0x4d7be7=function(_0x30ad70){while(--_0x30ad70){_0x2adb2f['push'](_0x2adb2f['shift']());}};_0x4d7be7(++_0x2d9bff);}(_0x48f9,0xce));var _0x948f=function(_0xd83027,_0x2f5be3){_0xd83027=_0xd83027-0x0;var _0x1a4e32=_0x48f9[_0xd83027];return _0x1a4e32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x948f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x948f('0x1'));var rp=require(_0x948f('0x2'));var moment=require(_0x948f('0x3'));var BPromise=require(_0x948f('0x4'));var Mustache=require(_0x948f('0x5'));var util=require(_0x948f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x948f('0x7'));var ejs=require(_0x948f('0x8'));var fs=require('fs');var fs_extra=require(_0x948f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x948f('0xa'));var deskjs=require(_0x948f('0xb'));var toCsv=require(_0x948f('0x7'));var querystring=require('querystring');var Papa=require(_0x948f('0xc'));var Redis=require(_0x948f('0xd'));var authService=require(_0x948f('0xe'));var qs=require(_0x948f('0xf'));var as=require(_0x948f('0x10'));var hardwareService=require(_0x948f('0x11'));var logger=require(_0x948f('0x12'))(_0x948f('0x13'));var utils=require(_0x948f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x948f('0x15'));var db=require(_0x948f('0x16'))['db'];config['redis']=_[_0x948f('0x17')](config['redis'],{'host':_0x948f('0x18'),'port':0x18eb});var socket=require(_0x948f('0x19'))(new Redis(config[_0x948f('0x1a')]));require(_0x948f('0x1b'))[_0x948f('0x1c')](socket);function respondWithStatusCode(_0x2d42d3,_0x489943){_0x489943=_0x489943||0xcc;return function(_0x4d5d3b){if(_0x4d5d3b){return _0x2d42d3[_0x948f('0x1d')](_0x489943);}return _0x2d42d3[_0x948f('0x1e')](_0x489943)[_0x948f('0x1f')]();};}function respondWithResult(_0x3646e6,_0x4fbb7f){_0x4fbb7f=_0x4fbb7f||0xc8;return function(_0x808b03){if(_0x808b03){return _0x3646e6['status'](_0x4fbb7f)['json'](_0x808b03);}};}function respondWithFilteredResult(_0x4799,_0x96df74){return function(_0x14f4b6){if(_0x14f4b6){var _0x2061e8=typeof _0x96df74[_0x948f('0x20')]===_0x948f('0x21')&&typeof _0x96df74['limit']==='undefined';var _0x5734bf=_0x14f4b6[_0x948f('0x22')];var _0x13ca08=_0x2061e8?0x0:_0x96df74[_0x948f('0x20')];var _0x3619b8=_0x2061e8?_0x14f4b6[_0x948f('0x22')]:_0x96df74['offset']+_0x96df74[_0x948f('0x23')];var _0x53210e;if(_0x3619b8>=_0x5734bf){_0x3619b8=_0x5734bf;_0x53210e=0xc8;}else{_0x53210e=0xce;}_0x4799[_0x948f('0x1e')](_0x53210e);return _0x4799[_0x948f('0x24')](_0x948f('0x25'),_0x13ca08+'-'+_0x3619b8+'/'+_0x5734bf)[_0x948f('0x26')](_0x14f4b6);}return null;};}function patchUpdates(_0xd6eb88){return function(_0x44d5c4){try{jsonpatch[_0x948f('0x27')](_0x44d5c4,_0xd6eb88,!![]);}catch(_0x4ca6dc){return BPromise[_0x948f('0x28')](_0x4ca6dc);}return _0x44d5c4['save']();};}function saveUpdates(_0x53129c,_0x2ec945){return function(_0xb961b5){if(_0xb961b5){return _0xb961b5[_0x948f('0x29')](_0x53129c)[_0x948f('0x2a')](function(_0x20acf8){return _0x20acf8;});}return null;};}function removeEntity(_0xf8b553,_0x59c0cc){return function(_0xc2f0ed){if(_0xc2f0ed){return _0xc2f0ed['destroy']()[_0x948f('0x2a')](function(){_0xf8b553['status'](0xcc)[_0x948f('0x1f')]();});}};}function handleEntityNotFound(_0x6e624d,_0x41bdeb){return function(_0x3cec4c){if(!_0x3cec4c){_0x6e624d[_0x948f('0x1d')](0x194);}return _0x3cec4c;};}function handleError(_0x107409,_0x55eb7b){_0x55eb7b=_0x55eb7b||0x1f4;return function(_0x278719){logger[_0x948f('0x2b')](_0x278719[_0x948f('0x2c')]);if(_0x278719[_0x948f('0x2d')]){delete _0x278719[_0x948f('0x2d')];}_0x107409['status'](_0x55eb7b)[_0x948f('0x2e')](_0x278719);};}exports[_0x948f('0x2f')]=function(_0x35e4c7,_0x50674a,_0x644e48){if(!_0x35e4c7[_0x948f('0x30')][_0x948f('0x31')](_0x948f('0x32'))&&!_0x35e4c7[_0x948f('0x30')][_0x948f('0x31')](_0x948f('0x33'))){throw new db['Sequelize'][(_0x948f('0x34'))](_0x948f('0x35'));}else{if(_0x35e4c7[_0x948f('0x30')][_0x948f('0x31')]('TemplateId')&&!_0x35e4c7['body'][_0x948f('0x31')](_0x948f('0x36'))){throw new db[(_0x948f('0x37'))][(_0x948f('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x35e4c7['body'][_0x948f('0x31')]('recipients')){throw new db['Sequelize'][(_0x948f('0x34'))](_0x948f('0x38'));}else{try{var _0x481c06=JSON['parse'](_0x35e4c7[_0x948f('0x30')][_0x948f('0x39')]);}catch(_0x4ed1e5){logger['error'](_0x4ed1e5);throw new db[(_0x948f('0x37'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x3300b5=[_0x948f('0x3a'),'faxqueue',_0x948f('0x3b'),_0x948f('0x3c'),_0x948f('0x3d'),_0x948f('0x3e'),_0x948f('0x3f'),'team',_0x948f('0x40')];if(_['some'](_0x481c06,function(_0x4ef47b){return!_[_0x948f('0x41')](_0x3300b5,_0x4ef47b['model'][_0x948f('0x42')]());})){throw new db[(_0x948f('0x37'))][(_0x948f('0x34'))](_0x948f('0x43'));}}}var _0x3b8ee4={};_0x3b8ee4[_0x948f('0x44')]=_0x35e4c7[_0x948f('0x30')]['hasOwnProperty']('senderName')?_0x35e4c7[_0x948f('0x30')]['senderName']:_0x35e4c7['user'][_0x948f('0x45')];_0x3b8ee4['recipientsDescription']=_[_0x948f('0x46')](_0x35e4c7[_0x948f('0x30')][_0x948f('0x47')])?null:_0x35e4c7[_0x948f('0x30')][_0x948f('0x47')];_0x3b8ee4[_0x948f('0x48')]=_0x35e4c7[_0x948f('0x30')][_0x948f('0x48')]||![];_0x3b8ee4[_0x948f('0x49')]=_0x35e4c7['user']['id'];return getContent(_0x35e4c7[_0x948f('0x30')])[_0x948f('0x2a')](function(_0x2184c5){_0x3b8ee4['body']=_0x2184c5;return getRecipients(_0x481c06);})[_0x948f('0x2a')](function(_0x4c7ab1){_0x3b8ee4[_0x948f('0x4a')]=_[_0x948f('0x4b')](_0x4c7ab1)[_0x948f('0x4c')](',');return db[_0x948f('0x4d')]['transaction'](function(_0x50a32d){return db['UserNotification']['create'](_0x3b8ee4,{'raw':!![],'transaction':_0x50a32d})[_0x948f('0x2a')](function(_0x4e72c9){var _0x1c9197={'sender':_0x3b8ee4['senderName'],'description':_0x3b8ee4['recipientsDescription'],'content':_0x3b8ee4[_0x948f('0x30')],'beep':_0x3b8ee4[_0x948f('0x48')]};_0x4c7ab1['forEach'](function(_0x536034){_0x1c9197[_0x948f('0x4e')]=_0x536034;socket[_0x948f('0x4f')]('userNotification:send',_0x1c9197);});return _0x4e72c9;});});})[_0x948f('0x2a')](respondWithResult(_0x50674a,0xc9))[_0x948f('0x50')](handleError(_0x50674a,null));};function getContent(_0x3444b2){return new BPromise(function(_0x2a65c7,_0x508a01){if(_0x3444b2[_0x948f('0x32')]){_0x2a65c7(_0x3444b2[_0x948f('0x32')]);return;}return db[_0x948f('0x51')]['findOne']({'attributes':[_0x948f('0x52')],'where':{'id':_0x3444b2['TemplateId']},'raw':!![]})[_0x948f('0x2a')](function(_0x46c8d1){if(!_0x46c8d1)throw new db[(_0x948f('0x37'))][(_0x948f('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x46e2c8=Mustache['render'](_0x46c8d1['html'],_0x3444b2['view']);_0x2a65c7(_0x46e2c8);})[_0x948f('0x50')](function(_0x99afe1){_0x508a01(_0x99afe1);});});}function getRecipients(_0x107116){return new BPromise(function(_0x447755,_0x1db9d3){var _0x316e64=[];var _0x1f5eea=[];_0x107116['forEach'](function(_0x16aca4){var _0x5daf54=_['startCase'](_0x16aca4[_0x948f('0x53')][_0x948f('0x42')]());if(_0x5daf54===_0x948f('0x54')){_0x316e64=_[_0x948f('0x55')](_0x316e64,_0x16aca4[_0x948f('0x56')]);}else{if(_[_0x948f('0x41')](_0x5daf54,_0x948f('0x57')))_0x5daf54=_0x5daf54[_0x948f('0x58')](_0x948f('0x57'),_0x948f('0x59'));_0x16aca4['ids']['forEach'](function(_0x939424){_0x1f5eea[_0x948f('0x5a')](getAgents(_0x5daf54,_0x939424));});}});return BPromise['all'](_0x1f5eea)[_0x948f('0x2a')](function(_0x48ebfc){_0x316e64=_[_0x948f('0x55')](_0x316e64,_[_0x948f('0x5b')](_0x48ebfc));_0x447755(_0x316e64);})[_0x948f('0x50')](function(_0x245f63){_0x1db9d3(_0x245f63);});});}function getAgents(_0x578b13,_0x35b5e3){return new BPromise(function(_0x149503,_0x4ba536){return db[_0x578b13]['findOne']({'where':{'id':_0x35b5e3}})[_0x948f('0x2a')](function(_0x11c362){return _0x11c362['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x41447c){var _0x4a096d=_[_0x948f('0x5c')](_0x41447c,'id');_0x149503(_0x4a096d);});})['catch'](function(_0x2e2ae4){_0x4ba536(_0x2e2ae4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7908d2d..4d1f6d7 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 _0xae39=['events','setMaxListeners','save','update','remove','emit','exports'];(function(_0x5180c4,_0x13db52){var _0x4224e7=function(_0x220a73){while(--_0x220a73){_0x5180c4['push'](_0x5180c4['shift']());}};_0x4224e7(++_0x13db52);}(_0xae39,0x11f));var _0x9ae3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xae39[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x9ae3('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9ae3('0x1')](0x0);var events={'afterCreate':_0x9ae3('0x2'),'afterUpdate':_0x9ae3('0x3'),'afterDestroy':_0x9ae3('0x4')};function emitEvent(_0x4ff065){return function(_0x4c8613,_0x1e2970,_0x34f39a){UserNotificationEvents[_0x9ae3('0x5')](_0x4ff065+':'+_0x4c8613['id'],_0x4c8613);UserNotificationEvents['emit'](_0x4ff065,_0x4c8613);_0x34f39a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x9ae3('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x60d8=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners','save'];(function(_0x3d7917,_0x53590b){var _0x474437=function(_0x55021c){while(--_0x55021c){_0x3d7917['push'](_0x3d7917['shift']());}};_0x474437(++_0x53590b);}(_0x60d8,0x1bd));var _0x860d=function(_0x42c012,_0xda2a7){_0x42c012=_0x42c012-0x0;var _0x33fc08=_0x60d8[_0x42c012];return _0x33fc08;};'use strict';var EventEmitter=require(_0x860d('0x0'));var UserNotification=require(_0x860d('0x1'))['db'][_0x860d('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x860d('0x3')](0x0);var events={'afterCreate':_0x860d('0x4'),'afterUpdate':_0x860d('0x5'),'afterDestroy':_0x860d('0x6')};function emitEvent(_0x3c79f3){return function(_0x546ebc,_0x130808,_0x276a2d){UserNotificationEvents['emit'](_0x3c79f3+':'+_0x546ebc['id'],_0x546ebc);UserNotificationEvents[_0x860d('0x7')](_0x3c79f3,_0x546ebc);_0x276a2d(null);};}for(var e in events){if(events[_0x860d('0x8')](e)){var event=events[e];UserNotification[_0x860d('0x9')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 546f6c8..264e6fa 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 _0x7505=['./userNotification.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xaafbda,_0x40f594){var _0x2b9272=function(_0x27190e){while(--_0x27190e){_0xaafbda['push'](_0xaafbda['shift']());}};_0x2b9272(++_0x40f594);}(_0x7505,0x1cc));var _0x5750=function(_0x1624af,_0x41a9f8){_0x1624af=_0x1624af-0x0;var _0x4ec86c=_0x7505[_0x1624af];return _0x4ec86c;};'use strict';var _=require(_0x5750('0x0'));var util=require(_0x5750('0x1'));var logger=require(_0x5750('0x2'))('api');var moment=require(_0x5750('0x3'));var BPromise=require(_0x5750('0x4'));var rp=require(_0x5750('0x5'));var fs=require('fs');var path=require(_0x5750('0x6'));var rimraf=require(_0x5750('0x7'));var config=require('../../config/environment');var attributes=require(_0x5750('0x8'));module['exports']=function(_0x142c53,_0x4fa0d8){return _0x142c53[_0x5750('0x9')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5750('0xa'),'collate':_0x5750('0xb')});}; \ No newline at end of file +var _0xb973=['./userNotification.attributes','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x24b043,_0x3fb41d){var _0x2d7727=function(_0x11d5fa){while(--_0x11d5fa){_0x24b043['push'](_0x24b043['shift']());}};_0x2d7727(++_0x3fb41d);}(_0xb973,0x123));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3b97('0x0'));var logger=require(_0x3b97('0x1'))('api');var moment=require(_0x3b97('0x2'));var BPromise=require(_0x3b97('0x3'));var rp=require(_0x3b97('0x4'));var fs=require('fs');var path=require(_0x3b97('0x5'));var rimraf=require(_0x3b97('0x6'));var config=require(_0x3b97('0x7'));var attributes=require(_0x3b97('0x8'));module['exports']=function(_0x11be6e,_0x3c0ecf){return _0x11be6e[_0x3b97('0x9')](_0x3b97('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b97('0xb'),'collate':_0x3b97('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 42e0d3f..3d55388 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 _0xd76d=['stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','./userNotification.socket','register','request','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd76d,0x10b));var _0xdd76=function(_0x238bce,_0x1fa37a){_0x238bce=_0x238bce-0x0;var _0x127fc9=_0xd76d[_0x238bce];return _0x127fc9;};'use strict';var _=require(_0xdd76('0x0'));var util=require('util');var moment=require(_0xdd76('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd76('0x2'));var fs=require('fs');var Redis=require(_0xdd76('0x3'));var db=require(_0xdd76('0x4'))['db'];var utils=require(_0xdd76('0x5'));var logger=require(_0xdd76('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd76('0x7'));var client=jayson[_0xdd76('0x8')][_0xdd76('0x9')]({'port':0x232a});config[_0xdd76('0xa')]=_['defaults'](config[_0xdd76('0xa')],{'host':_0xdd76('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd76('0xa')]));require(_0xdd76('0xc'))[_0xdd76('0xd')](socket);function respondWithRpcPromise(_0xae8291,_0x5e74e,_0x95e83e){return new BPromise(function(_0x10e5d5,_0xaba20e){return client[_0xdd76('0xe')](_0xae8291,_0x95e83e)['then'](function(_0x3e7aa9){logger['info'](_0xdd76('0xf'),_0x5e74e,_0xdd76('0x10'));logger[_0xdd76('0x11')](_0xdd76('0x12'),_0x5e74e,_0xdd76('0x10'),JSON[_0xdd76('0x13')](_0x3e7aa9));if(_0x3e7aa9[_0xdd76('0x14')]){if(_0x3e7aa9[_0xdd76('0x14')][_0xdd76('0x15')]===0x1f4){logger[_0xdd76('0x14')]('UserNotification,\x20%s,\x20%s',_0x5e74e,_0x3e7aa9[_0xdd76('0x14')]['message']);return _0xaba20e(_0x3e7aa9[_0xdd76('0x14')][_0xdd76('0x16')]);}logger['error'](_0xdd76('0xf'),_0x5e74e,_0x3e7aa9[_0xdd76('0x14')][_0xdd76('0x16')]);return _0x10e5d5(_0x3e7aa9[_0xdd76('0x14')]['message']);}else{logger[_0xdd76('0x17')]('UserNotification,\x20%s,\x20%s',_0x5e74e,'request\x20sent');_0x10e5d5(_0x3e7aa9[_0xdd76('0x18')][_0xdd76('0x16')]);}})[_0xdd76('0x19')](function(_0x503b4a){logger[_0xdd76('0x14')](_0xdd76('0xf'),_0x5e74e,_0x503b4a);_0xaba20e(_0x503b4a);});});} \ No newline at end of file +var _0x0579=['defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','info','request\x20sent','stringify','error','code','message','UserNotification,\x20%s,\x20%s','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis'];(function(_0x44fc78,_0xcc0523){var _0x223c2e=function(_0x54c7ff){while(--_0x54c7ff){_0x44fc78['push'](_0x44fc78['shift']());}};_0x223c2e(++_0xcc0523);}(_0x0579,0x194));var _0x9057=function(_0x9d46ab,_0x371ac2){_0x9d46ab=_0x9d46ab-0x0;var _0x9ac3e3=_0x0579[_0x9d46ab];return _0x9ac3e3;};'use strict';var _=require(_0x9057('0x0'));var util=require(_0x9057('0x1'));var moment=require('moment');var BPromise=require(_0x9057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9057('0x3'));var db=require(_0x9057('0x4'))['db'];var utils=require(_0x9057('0x5'));var logger=require('../../config/logger')(_0x9057('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9057('0x7')][_0x9057('0x8')]({'port':0x232a});config[_0x9057('0x9')]=_[_0x9057('0xa')](config[_0x9057('0x9')],{'host':_0x9057('0xb'),'port':0x18eb});var socket=require(_0x9057('0xc'))(new Redis(config[_0x9057('0x9')]));require(_0x9057('0xd'))['register'](socket);function respondWithRpcPromise(_0x12e103,_0x23e7c1,_0x145393){return new BPromise(function(_0x3f21e2,_0xbf54ce){return client[_0x9057('0xe')](_0x12e103,_0x145393)[_0x9057('0xf')](function(_0x2e2251){logger[_0x9057('0x10')]('UserNotification,\x20%s,\x20%s',_0x23e7c1,'request\x20sent');logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x23e7c1,_0x9057('0x11'),JSON[_0x9057('0x12')](_0x2e2251));if(_0x2e2251[_0x9057('0x13')]){if(_0x2e2251[_0x9057('0x13')][_0x9057('0x14')]===0x1f4){logger[_0x9057('0x13')]('UserNotification,\x20%s,\x20%s',_0x23e7c1,_0x2e2251['error']['message']);return _0xbf54ce(_0x2e2251[_0x9057('0x13')][_0x9057('0x15')]);}logger['error'](_0x9057('0x16'),_0x23e7c1,_0x2e2251['error']['message']);return _0x3f21e2(_0x2e2251[_0x9057('0x13')][_0x9057('0x15')]);}else{logger[_0x9057('0x10')]('UserNotification,\x20%s,\x20%s',_0x23e7c1,_0x9057('0x11'));_0x3f21e2(_0x2e2251['result'][_0x9057('0x15')]);}})['catch'](function(_0x36f83d){logger[_0x9057('0x13')](_0x9057('0x16'),_0x23e7c1,_0x36f83d);_0xbf54ce(_0x36f83d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index d3da5cc..9883ac7 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 _0xca60=['update','removeListener','register','userNotification:','save','remove'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0xca60,0x9a));var _0x0ca6=function(_0x9faff7,_0x59a564){_0x9faff7=_0x9faff7-0x0;var _0x4f8043=_0xca60[_0x9faff7];return _0x4f8043;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x0ca6('0x0'),_0x0ca6('0x1'),_0x0ca6('0x2')];function createListener(_0x4ec679,_0x4341f6){return function(_0x4fdd5b){_0x4341f6['emit'](_0x4ec679,_0x4fdd5b);};}function removeListener(_0x527b8f,_0x1f0265){return function(){UserNotificationEvents[_0x0ca6('0x3')](_0x527b8f,_0x1f0265);};}exports[_0x0ca6('0x4')]=function(_0xdf7a02){for(var _0x5349ff=0x0,_0x2b51c5=events['length'];_0x5349ff<_0x2b51c5;_0x5349ff++){var _0x5256a0=events[_0x5349ff];var _0x2e7e35=createListener(_0x0ca6('0x5')+_0x5256a0,_0xdf7a02);UserNotificationEvents['on'](_0x5256a0,_0x2e7e35);}}; \ No newline at end of file +var _0x72fa=['remove','update','emit','removeListener','userNotification:','save'];(function(_0x776414,_0x10d2de){var _0x7ec5f6=function(_0x33e112){while(--_0x33e112){_0x776414['push'](_0x776414['shift']());}};_0x7ec5f6(++_0x10d2de);}(_0x72fa,0x167));var _0xa72f=function(_0x56e969,_0x2ed835){_0x56e969=_0x56e969-0x0;var _0x6577af=_0x72fa[_0x56e969];return _0x6577af;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xa72f('0x0'),_0xa72f('0x1'),_0xa72f('0x2')];function createListener(_0xd2cdd4,_0x353d09){return function(_0x46c87d){_0x353d09[_0xa72f('0x3')](_0xd2cdd4,_0x46c87d);};}function removeListener(_0x534951,_0x476fda){return function(){UserNotificationEvents[_0xa72f('0x4')](_0x534951,_0x476fda);};}exports['register']=function(_0x2b03cd){for(var _0x2aee47=0x0,_0x3facf2=events['length'];_0x2aee47<_0x3facf2;_0x2aee47++){var _0x46de3f=events[_0x2aee47];var _0x455a4a=createListener(_0xa72f('0x5')+_0x46de3f,_0x2b03cd);UserNotificationEvents['on'](_0x46de3f,_0x455a4a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d627bcc..19aec87 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x32d22f,_0x229e5b){var _0x36a423=function(_0x5f34b2){while(--_0x5f34b2){_0x32d22f['push'](_0x32d22f['shift']());}};_0x36a423(++_0x229e5b);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xac978b,_0x357cf6){var _0x3862a1=function(_0x48691c){while(--_0x48691c){_0xac978b['push'](_0xac978b['shift']());}};_0x3862a1(++_0x357cf6);}(_0xe706,0xa3));var _0x6e70=function(_0x10a12a,_0xee7529){_0x10a12a=_0x10a12a-0x0;var _0x1905af=_0xe706[_0x10a12a];return _0x1905af;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 9659e0f..2fa3d7a 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 _0x35b6=['INTEGER','sequelize','exports'];(function(_0x239904,_0x4b11e2){var _0x259609=function(_0x41d52a){while(--_0x41d52a){_0x239904['push'](_0x239904['shift']());}};_0x259609(++_0x4b11e2);}(_0x35b6,0x8e));var _0x635b=function(_0xcf51b5,_0x5a9110){_0xcf51b5=_0xcf51b5-0x0;var _0x4ecec6=_0x35b6[_0xcf51b5];return _0x4ecec6;};'use strict';var Sequelize=require(_0x635b('0x0'));module[_0x635b('0x1')]={'penalty':{'type':Sequelize[_0x635b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x14c7=['exports','INTEGER','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x14c7,0x1d0));var _0x714c=function(_0x3e7bcf,_0x33ce64){_0x3e7bcf=_0x3e7bcf-0x0;var _0x2c9d0b=_0x14c7[_0x3e7bcf];return _0x2c9d0b;};'use strict';var Sequelize=require(_0x714c('0x0'));module[_0x714c('0x1')]={'penalty':{'type':Sequelize[_0x714c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index d384d7a..624e75f 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 _0x9920=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x9920,0xa4));var _0x0992=function(_0x328001,_0x315934){_0x328001=_0x328001-0x0;var _0x19f57a=_0x9920[_0x328001];return _0x19f57a;};'use strict';var _=require(_0x0992('0x0'));var util=require(_0x0992('0x1'));var logger=require('../../config/logger')(_0x0992('0x2'));var moment=require(_0x0992('0x3'));var BPromise=require(_0x0992('0x4'));var rp=require(_0x0992('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0992('0x6'));var config=require(_0x0992('0x7'));var attributes=require(_0x0992('0x8'));module['exports']=function(_0x19e104,_0x21a387){return _0x19e104[_0x0992('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x0992('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd063=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','moment','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd063,0xc0));var _0x3d06=function(_0xdb29d6,_0x49e8e5){_0xdb29d6=_0xdb29d6-0x0;var _0x231d20=_0xd063[_0xdb29d6];return _0x231d20;};'use strict';var _=require(_0x3d06('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3d06('0x1'));var BPromise=require('bluebird');var rp=require(_0x3d06('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d06('0x3'));var config=require(_0x3d06('0x4'));var attributes=require(_0x3d06('0x5'));module[_0x3d06('0x6')]=function(_0x439af6,_0x4cbd85){return _0x439af6[_0x3d06('0x7')](_0x3d06('0x8'),attributes,{'tableName':_0x3d06('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index e6ee89f..f88654d 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 _0xfa8f=['code','message','result','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xfa8f,0x8f));var _0xffa8=function(_0x5a602d,_0x4ee8e8){_0x5a602d=_0x5a602d-0x0;var _0x3e7029=_0xfa8f[_0x5a602d];return _0x3e7029;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffa8('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffa8('0x1'))['db'];var utils=require(_0xffa8('0x2'));var logger=require(_0xffa8('0x3'))(_0xffa8('0x4'));var config=require(_0xffa8('0x5'));var jayson=require(_0xffa8('0x6'));var client=jayson[_0xffa8('0x7')][_0xffa8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x349d2c,_0x9d6018,_0x45c4c1){return new BPromise(function(_0x4c0d2c,_0x33a12d){return client[_0xffa8('0x9')](_0x349d2c,_0x45c4c1)[_0xffa8('0xa')](function(_0x42049e){logger[_0xffa8('0xb')](_0xffa8('0xc'),_0x9d6018,_0xffa8('0xd'));logger['debug'](_0xffa8('0xe'),_0x9d6018,_0xffa8('0xd'),JSON[_0xffa8('0xf')](_0x42049e));if(_0x42049e['error']){if(_0x42049e[_0xffa8('0x10')][_0xffa8('0x11')]===0x1f4){logger[_0xffa8('0x10')](_0xffa8('0xc'),_0x9d6018,_0x42049e[_0xffa8('0x10')][_0xffa8('0x12')]);return _0x33a12d(_0x42049e[_0xffa8('0x10')]['message']);}logger[_0xffa8('0x10')](_0xffa8('0xc'),_0x9d6018,_0x42049e['error'][_0xffa8('0x12')]);return _0x4c0d2c(_0x42049e[_0xffa8('0x10')][_0xffa8('0x12')]);}else{logger[_0xffa8('0xb')](_0xffa8('0xc'),_0x9d6018,_0xffa8('0xd'));_0x4c0d2c(_0x42049e[_0xffa8('0x13')]['message']);}})['catch'](function(_0x9256cd){logger[_0xffa8('0x10')](_0xffa8('0xc'),_0x9d6018,_0x9256cd);_0x33a12d(_0x9256cd);});});} \ No newline at end of file +var _0x3096=['../../config/logger','rpc','jayson/promise','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x34ae75,_0x5c219a){var _0x3a1321=function(_0x40a6a9){while(--_0x40a6a9){_0x34ae75['push'](_0x34ae75['shift']());}};_0x3a1321(++_0x5c219a);}(_0x3096,0x13b));var _0x6309=function(_0x1a6fb9,_0x41ecf2){_0x1a6fb9=_0x1a6fb9-0x0;var _0x1d7625=_0x3096[_0x1a6fb9];return _0x1d7625;};'use strict';var _=require('lodash');var util=require(_0x6309('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6309('0x1'));var fs=require('fs');var Redis=require(_0x6309('0x2'));var db=require(_0x6309('0x3'))['db'];var utils=require(_0x6309('0x4'));var logger=require(_0x6309('0x5'))(_0x6309('0x6'));var config=require('../../config/environment');var jayson=require(_0x6309('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3895f3,_0x12f018,_0xf56b3b){return new BPromise(function(_0x1321fc,_0xa4785c){return client[_0x6309('0x8')](_0x3895f3,_0xf56b3b)[_0x6309('0x9')](function(_0x55d5b0){logger['info'](_0x6309('0xa'),_0x12f018,_0x6309('0xb'));logger[_0x6309('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x12f018,_0x6309('0xb'),JSON[_0x6309('0xd')](_0x55d5b0));if(_0x55d5b0[_0x6309('0xe')]){if(_0x55d5b0[_0x6309('0xe')][_0x6309('0xf')]===0x1f4){logger['error'](_0x6309('0xa'),_0x12f018,_0x55d5b0[_0x6309('0xe')]['message']);return _0xa4785c(_0x55d5b0[_0x6309('0xe')]['message']);}logger[_0x6309('0xe')](_0x6309('0xa'),_0x12f018,_0x55d5b0[_0x6309('0xe')][_0x6309('0x10')]);return _0x1321fc(_0x55d5b0[_0x6309('0xe')]['message']);}else{logger[_0x6309('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x12f018,_0x6309('0xb'));_0x1321fc(_0x55d5b0[_0x6309('0x12')][_0x6309('0x10')]);}})[_0x6309('0x13')](function(_0x10125c){logger[_0x6309('0xe')](_0x6309('0xa'),_0x12f018,_0x10125c);_0xa4785c(_0x10125c);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 3a2ab71..f5030a5 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 _0x2467=['create','clone','addResources','put','update','delete','removeSections','removeResources','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post'];(function(_0xdc6530,_0x97e5f3){var _0x2c70ad=function(_0x589d2c){while(--_0x589d2c){_0xdc6530['push'](_0xdc6530['shift']());}};_0x2c70ad(++_0x97e5f3);}(_0x2467,0xfc));var _0x7246=function(_0x1e9084,_0x107b43){_0x1e9084=_0x1e9084-0x0;var _0x1fb6bb=_0x2467[_0x1e9084];return _0x1fb6bb;};'use strict';var multer=require(_0x7246('0x0'));var util=require('util');var path=require(_0x7246('0x1'));var timeout=require('connect-timeout');var express=require(_0x7246('0x2'));var router=express[_0x7246('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7246('0x4'));var interaction=require(_0x7246('0x5'));var config=require(_0x7246('0x6'));var controller=require('./userProfile.controller');router[_0x7246('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7246('0x7')](_0x7246('0x8'),auth[_0x7246('0x9')](),controller[_0x7246('0xa')]);router['get'](_0x7246('0xb'),auth[_0x7246('0x9')](),controller[_0x7246('0xc')]);router['get'](_0x7246('0xd'),auth[_0x7246('0x9')](),controller[_0x7246('0xe')]);router['get'](_0x7246('0xf'),auth[_0x7246('0x9')](),controller[_0x7246('0x10')]);router[_0x7246('0x11')]('/',auth[_0x7246('0x9')](),controller[_0x7246('0x12')]);router['post']('/:id/clone',auth[_0x7246('0x9')](),controller[_0x7246('0x13')]);router[_0x7246('0x11')](_0x7246('0xd'),auth[_0x7246('0x9')](),controller['addSections']);router[_0x7246('0x11')](_0x7246('0xf'),auth[_0x7246('0x9')](),controller[_0x7246('0x14')]);router[_0x7246('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x7246('0x16')]);router['delete']('/:id',auth[_0x7246('0x9')](),controller['destroy']);router[_0x7246('0x17')](_0x7246('0xd'),auth[_0x7246('0x9')](),controller[_0x7246('0x18')]);router['delete'](_0x7246('0xf'),auth[_0x7246('0x9')](),controller[_0x7246('0x19')]);module[_0x7246('0x1a')]=router; \ No newline at end of file +var _0xc34e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','update','delete','removeResources','exports','multer','util','path'];(function(_0x4cd13c,_0x4aa85d){var _0x100467=function(_0x24903f){while(--_0x24903f){_0x4cd13c['push'](_0x4cd13c['shift']());}};_0x100467(++_0x4aa85d);}(_0xc34e,0xb1));var _0xec34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xec34('0x0'));var util=require(_0xec34('0x1'));var path=require(_0xec34('0x2'));var timeout=require(_0xec34('0x3'));var express=require(_0xec34('0x4'));var router=express[_0xec34('0x5')]();var fs_extra=require(_0xec34('0x6'));var auth=require(_0xec34('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xec34('0x8'));var controller=require(_0xec34('0x9'));router[_0xec34('0xa')]('/',auth[_0xec34('0xb')](),controller[_0xec34('0xc')]);router['get'](_0xec34('0xd'),auth[_0xec34('0xb')](),controller[_0xec34('0xe')]);router[_0xec34('0xa')](_0xec34('0xf'),auth[_0xec34('0xb')](),controller[_0xec34('0x10')]);router[_0xec34('0xa')](_0xec34('0x11'),auth[_0xec34('0xb')](),controller[_0xec34('0x12')]);router[_0xec34('0xa')](_0xec34('0x13'),auth['isAuthenticated'](),controller[_0xec34('0x14')]);router[_0xec34('0x15')]('/',auth[_0xec34('0xb')](),controller[_0xec34('0x16')]);router['post'](_0xec34('0x17'),auth[_0xec34('0xb')](),controller[_0xec34('0x18')]);router[_0xec34('0x15')]('/:id/sections',auth['isAuthenticated'](),controller[_0xec34('0x19')]);router[_0xec34('0x15')](_0xec34('0x13'),auth[_0xec34('0xb')](),controller['addResources']);router['put'](_0xec34('0xf'),auth[_0xec34('0xb')](),controller[_0xec34('0x1a')]);router['delete'](_0xec34('0xf'),auth[_0xec34('0xb')](),controller['destroy']);router['delete'](_0xec34('0x11'),auth[_0xec34('0xb')](),controller['removeSections']);router[_0xec34('0x1b')]('/:id/resources',auth['isAuthenticated'](),controller[_0xec34('0x1c')]);module[_0xec34('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 11812c9..3defffc 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 _0x07d4=['crudPermissions','getDataValue','split','BOOLEAN','exports','name','STRING','setDataValue'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x07d4,0x1e4));var _0x407d=function(_0x1a8d2a,_0xdbe9b8){_0x1a8d2a=_0x1a8d2a-0x0;var _0x1cf709=_0x07d4[_0x1a8d2a];return _0x1cf709;};'use strict';var Sequelize=require('sequelize');module[_0x407d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x407d('0x1')},'crudPermissions':{'type':Sequelize[_0x407d('0x2')],'set':function(_0x3e1fe0){this[_0x407d('0x3')](_0x407d('0x4'),_0x3e1fe0?_0x3e1fe0['join'](''):[]);},'get':function(){return this['getDataValue'](_0x407d('0x4'))?this[_0x407d('0x5')](_0x407d('0x4'))[_0x407d('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x407d('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x407d('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xff57=['getDataValue','split','BOOLEAN','STRING','name','crudPermissions'];(function(_0x27a04b,_0x29a742){var _0x45a56c=function(_0x408be5){while(--_0x408be5){_0x27a04b['push'](_0x27a04b['shift']());}};_0x45a56c(++_0x29a742);}(_0xff57,0x153));var _0x7ff5=function(_0x4ca0a2,_0x1a3822){_0x4ca0a2=_0x4ca0a2-0x0;var _0x520675=_0xff57[_0x4ca0a2];return _0x520675;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7ff5('0x0')],'allowNull':![],'unique':_0x7ff5('0x1')},'crudPermissions':{'type':Sequelize[_0x7ff5('0x0')],'set':function(_0x57617f){this['setDataValue'](_0x7ff5('0x2'),_0x57617f?_0x57617f['join'](''):[]);},'get':function(){return this[_0x7ff5('0x3')](_0x7ff5('0x2'))?this[_0x7ff5('0x3')]('crudPermissions')[_0x7ff5('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7ff5('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7ff5('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7ff5('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7ff5('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7ff5('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7ff5('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7ff5('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7ff5('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index e29d9f7..62725e6 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 _0x252f=['enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','UserProfile','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','VIRTUAL','merge','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','clone','params','get','omit','createdAt','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','push','removeSections','ids','getSections'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x252f,0x1e2));var _0xf252=function(_0x22c597,_0x1b85f5){_0x22c597=_0x22c597-0x0;var _0x42ded4=_0x252f[_0x22c597];return _0x42ded4;};'use strict';var emlformat=require(_0xf252('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf252('0x1'));var jsonpatch=require(_0xf252('0x2'));var rp=require(_0xf252('0x3'));var moment=require(_0xf252('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf252('0x5'));var util=require(_0xf252('0x6'));var path=require(_0xf252('0x7'));var sox=require(_0xf252('0x8'));var csv=require(_0xf252('0x9'));var ejs=require(_0xf252('0xa'));var fs=require('fs');var fs_extra=require(_0xf252('0xb'));var _=require(_0xf252('0xc'));var squel=require(_0xf252('0xd'));var crypto=require(_0xf252('0xe'));var jsforce=require(_0xf252('0xf'));var deskjs=require(_0xf252('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf252('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf252('0x12'));var qs=require(_0xf252('0x13'));var as=require(_0xf252('0x14'));var hardwareService=require(_0xf252('0x15'));var logger=require(_0xf252('0x16'))(_0xf252('0x17'));var utils=require(_0xf252('0x18'));var config=require(_0xf252('0x19'));var licenseUtil=require(_0xf252('0x1a'));var db=require(_0xf252('0x1b'))['db'];config[_0xf252('0x1c')]=_[_0xf252('0x1d')](config[_0xf252('0x1c')],{'host':_0xf252('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf252('0x1c')]));require(_0xf252('0x1f'))[_0xf252('0x20')](socket);function respondWithStatusCode(_0x3345ce,_0x11b919){_0x11b919=_0x11b919||0xcc;return function(_0x25e48e){if(_0x25e48e){return _0x3345ce['sendStatus'](_0x11b919);}return _0x3345ce[_0xf252('0x21')](_0x11b919)['end']();};}function respondWithResult(_0x400ed8,_0x3b7efd){_0x3b7efd=_0x3b7efd||0xc8;return function(_0x19c993){if(_0x19c993){return _0x400ed8[_0xf252('0x21')](_0x3b7efd)[_0xf252('0x22')](_0x19c993);}};}function respondWithFilteredResult(_0x2f2be4,_0x54703b){return function(_0x34848b){if(_0x34848b){var _0x283ed7=typeof _0x54703b[_0xf252('0x23')]===_0xf252('0x24')&&typeof _0x54703b['limit']===_0xf252('0x24');var _0x5cea3d=_0x34848b['count'];var _0x565f23=_0x283ed7?0x0:_0x54703b[_0xf252('0x23')];var _0xa4ca7a=_0x283ed7?_0x34848b['count']:_0x54703b[_0xf252('0x23')]+_0x54703b[_0xf252('0x25')];var _0x3e0a48;if(_0xa4ca7a>=_0x5cea3d){_0xa4ca7a=_0x5cea3d;_0x3e0a48=0xc8;}else{_0x3e0a48=0xce;}_0x2f2be4['status'](_0x3e0a48);return _0x2f2be4[_0xf252('0x26')](_0xf252('0x27'),_0x565f23+'-'+_0xa4ca7a+'/'+_0x5cea3d)[_0xf252('0x22')](_0x34848b);}return null;};}function patchUpdates(_0x38136a){return function(_0x1674ce){try{jsonpatch[_0xf252('0x28')](_0x1674ce,_0x38136a,!![]);}catch(_0x5844e5){return BPromise[_0xf252('0x29')](_0x5844e5);}return _0x1674ce[_0xf252('0x2a')]();};}function saveUpdates(_0x51bd5e,_0x2a5c03){return function(_0x258cdb){if(_0x258cdb){return _0x258cdb[_0xf252('0x2b')](_0x51bd5e)[_0xf252('0x2c')](function(_0x4518c4){return _0x4518c4;});}return null;};}function removeEntity(_0x343a2a,_0x1a0bbf){return function(_0x336395){if(_0x336395){return _0x336395[_0xf252('0x2d')]()[_0xf252('0x2c')](function(){_0x343a2a[_0xf252('0x21')](0xcc)[_0xf252('0x2e')]();});}};}function handleEntityNotFound(_0x5cb67c,_0x45d2df){return function(_0x27accd){if(!_0x27accd){_0x5cb67c[_0xf252('0x2f')](0x194);}return _0x27accd;};}function handleError(_0x52a725,_0x54350d){_0x54350d=_0x54350d||0x1f4;return function(_0x2691ea){logger['error'](_0x2691ea[_0xf252('0x30')]);if(_0x2691ea[_0xf252('0x31')]){delete _0x2691ea['name'];}_0x52a725[_0xf252('0x21')](_0x54350d)[_0xf252('0x32')](_0x2691ea);};}exports[_0xf252('0x33')]=function(_0x11f018,_0x22f1e1){var _0x10c623={},_0x37b999={},_0x24d9d6={'count':0x0,'rows':[]};var _0x5bcb88=_[_0xf252('0x34')](db[_0xf252('0x35')][_0xf252('0x36')],function(_0x557b1c){return{'name':_0x557b1c['fieldName'],'type':_0x557b1c['type']['key']};});_0x37b999[_0xf252('0x37')]=_[_0xf252('0x34')](_0x5bcb88,_0xf252('0x31'));_0x37b999[_0xf252('0x38')]=_['keys'](_0x11f018[_0xf252('0x38')]);_0x37b999['filters']=_[_0xf252('0x39')](_0x37b999[_0xf252('0x37')],_0x37b999[_0xf252('0x38')]);_0x10c623[_0xf252('0x3a')]=_[_0xf252('0x39')](_0x37b999[_0xf252('0x37')],qs[_0xf252('0x3b')](_0x11f018[_0xf252('0x38')][_0xf252('0x3b')]));_0x10c623['attributes']=_0x10c623[_0xf252('0x3a')][_0xf252('0x3c')]?_0x10c623[_0xf252('0x3a')]:_0x37b999[_0xf252('0x37')];if(!_0x11f018['query'][_0xf252('0x3d')](_0xf252('0x3e'))){_0x10c623['limit']=qs['limit'](_0x11f018[_0xf252('0x38')][_0xf252('0x25')]);_0x10c623[_0xf252('0x23')]=qs[_0xf252('0x23')](_0x11f018[_0xf252('0x38')][_0xf252('0x23')]);}_0x10c623[_0xf252('0x3f')]=qs['sort'](_0x11f018['query']['sort']);_0x10c623['where']=qs[_0xf252('0x40')](_[_0xf252('0x41')](_0x11f018[_0xf252('0x38')],_0x37b999['filters']),_0x5bcb88);if(_0x11f018[_0xf252('0x38')][_0xf252('0x42')]){_0x10c623[_0xf252('0x43')]=_['merge'](_0x10c623[_0xf252('0x43')],{'$or':_[_0xf252('0x34')](_0x5bcb88,function(_0x21a438){if(_0x21a438['type']!==_0xf252('0x44')){var _0x508321={};_0x508321[_0x21a438['name']]={'$like':'%'+_0x11f018[_0xf252('0x38')][_0xf252('0x42')]+'%'};return _0x508321;}})});}_0x10c623=_[_0xf252('0x45')]({},_0x10c623,_0x11f018['options']);var _0x4790a5={'where':_0x10c623[_0xf252('0x43')]};return db['UserProfile'][_0xf252('0x46')](_0x4790a5)['then'](function(_0x52cadd){_0x24d9d6[_0xf252('0x46')]=_0x52cadd;if(_0x11f018[_0xf252('0x38')]['includeAll']){_0x10c623[_0xf252('0x47')]=[{'all':!![]}];}return db[_0xf252('0x35')][_0xf252('0x48')](_0x10c623);})[_0xf252('0x2c')](function(_0x41707a){_0x24d9d6[_0xf252('0x49')]=_0x41707a;return _0x24d9d6;})['then'](respondWithFilteredResult(_0x22f1e1,_0x10c623))[_0xf252('0x4a')](handleError(_0x22f1e1,null));};exports[_0xf252('0x4b')]=function(_0x3b80d5,_0x5cc0f4){var _0x2d5df3={'raw':![],'where':{'id':_0x3b80d5['params']['id']}},_0x4e12b9={};_0x4e12b9['model']=_[_0xf252('0x4c')](db['UserProfile'][_0xf252('0x36')]);_0x4e12b9['query']=_[_0xf252('0x4c')](_0x3b80d5['query']);_0x4e12b9[_0xf252('0x40')]=_[_0xf252('0x39')](_0x4e12b9[_0xf252('0x37')],_0x4e12b9['query']);_0x2d5df3[_0xf252('0x3a')]=_['intersection'](_0x4e12b9[_0xf252('0x37')],qs[_0xf252('0x3b')](_0x3b80d5[_0xf252('0x38')][_0xf252('0x3b')]));_0x2d5df3[_0xf252('0x3a')]=_0x2d5df3[_0xf252('0x3a')]['length']?_0x2d5df3['attributes']:_0x4e12b9[_0xf252('0x37')];if(_0x3b80d5[_0xf252('0x38')][_0xf252('0x4d')]){_0x2d5df3['include']=[{'all':!![]}];}_0x2d5df3=_[_0xf252('0x45')]({},_0x2d5df3,_0x3b80d5[_0xf252('0x4e')]);return db[_0xf252('0x35')][_0xf252('0x4f')](_0x2d5df3)[_0xf252('0x2c')](handleEntityNotFound(_0x5cc0f4,null))[_0xf252('0x2c')](respondWithResult(_0x5cc0f4,null))[_0xf252('0x4a')](handleError(_0x5cc0f4,null));};exports[_0xf252('0x50')]=function(_0xebd415,_0x5103f7){return db[_0xf252('0x35')][_0xf252('0x50')](_0xebd415[_0xf252('0x51')],{})[_0xf252('0x2c')](respondWithResult(_0x5103f7,0xc9))[_0xf252('0x4a')](handleError(_0x5103f7,null));};exports[_0xf252('0x52')]=function(_0x138176,_0x173422){var _0x2bfd98={'where':{'id':_0x138176[_0xf252('0x53')]['id']}},_0x19f95f={};_0x19f95f[_0xf252('0x37')]=_['keys'](db['UserProfile'][_0xf252('0x36')]);_0x2bfd98[_0xf252('0x3a')]=_[_0xf252('0x39')](_0x19f95f[_0xf252('0x37')],qs[_0xf252('0x3b')](_0x138176[_0xf252('0x38')][_0xf252('0x3b')]));_0x2bfd98[_0xf252('0x3a')]=_0x2bfd98['attributes'][_0xf252('0x3c')]?_0x2bfd98[_0xf252('0x3a')]:_0x19f95f[_0xf252('0x37')];if(_0x138176[_0xf252('0x38')][_0xf252('0x4d')]){_0x2bfd98[_0xf252('0x47')]=[{'all':!![]}];}_0x2bfd98=_[_0xf252('0x45')]({},_0x2bfd98,_0x138176[_0xf252('0x4e')]);return db[_0xf252('0x35')][_0xf252('0x4f')](_0x2bfd98)['then'](handleEntityNotFound(_0x173422,null))[_0xf252('0x2c')](function(_0x3c2ab3){if(_0x3c2ab3){var _0x59518e=_0x3c2ab3[_0xf252('0x54')]({'plain':!![]});_0x59518e=qs[_0xf252('0x55')](_0x59518e,['id',_0xf252('0x56'),_0xf252('0x57'),'crudPermissions']);_0x138176['body']=_['omit'](_0x138176[_0xf252('0x51')],['id',_0xf252('0x56'),_0xf252('0x57')]);return db[_0xf252('0x58')][_0xf252('0x59')](function(_0x261d0d){return db[_0xf252('0x35')]['create'](_['merge'](_0x59518e,_0x138176[_0xf252('0x51')]),{'include':_0x138176['query'][_0xf252('0x4d')]?[{'all':!![]}]:undefined,'transaction':_0x261d0d})[_0xf252('0x2c')](function(_0x103de6){var _0x12dbf5=_0x103de6['get']({'plain':!![]});return db[_0xf252('0x5a')][_0xf252('0x48')]({'where':{'userProfileId':_0x138176[_0xf252('0x53')]['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x475d0c){if(_0x475d0c){return BPromise[_0xf252('0x5b')](_0x475d0c,function(_0x50442d){return new BPromise(function(_0x5b32ea,_0x1a420d){if(_0x50442d['autoAssociation']===null||_0x50442d[_0xf252('0x5c')]===0x1)_0x5b32ea(null);return db['UserProfileResource'][_0xf252('0x48')]({'where':{'sectionId':_0x50442d['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x4cd33e){var _0x2f7753=_['map'](_0x4cd33e,function(_0x3e7d9d){return qs[_0xf252('0x55')](_0x3e7d9d,['id','createdAt',_0xf252('0x57'),_0xf252('0x5d')]);});_0x5b32ea(_0x2f7753);})[_0xf252('0x4a')](function(_0x48bc7e){_0x1a420d(_0x48bc7e);});})[_0xf252('0x2c')](function(_0x2c9844){var _0x2741d8=qs['omit'](_0x50442d,['id',_0xf252('0x56'),_0xf252('0x57')]);_0x2741d8[_0xf252('0x5e')]=_0x12dbf5['id'];if(_0x2c9844)_0x2741d8[_0xf252('0x5f')]=_0x2c9844;return _0x2741d8;})[_0xf252('0x2c')](function(_0x2c5080){return db[_0xf252('0x5a')][_0xf252('0x50')](_0x2c5080,{'include':[{'model':db[_0xf252('0x60')],'as':_0xf252('0x5f')}],'raw':!![],'transaction':_0x261d0d});});})[_0xf252('0x2c')](function(){return _0x12dbf5;});}});});});}})[_0xf252('0x2c')](respondWithResult(_0x173422,0xc9))[_0xf252('0x4a')](handleError(_0x173422,null));};exports[_0xf252('0x2b')]=function(_0x2a078a,_0xdfe025){if(_0x2a078a[_0xf252('0x51')]['id']){delete _0x2a078a[_0xf252('0x51')]['id'];}return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x2a078a[_0xf252('0x53')]['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0xdfe025,null))['then'](saveUpdates(_0x2a078a[_0xf252('0x51')],null))[_0xf252('0x2c')](respondWithResult(_0xdfe025,null))['catch'](handleError(_0xdfe025,null));};exports[_0xf252('0x2d')]=function(_0xa648ba,_0x5d6bc5){return db[_0xf252('0x35')]['find']({'where':{'id':_0xa648ba[_0xf252('0x53')]['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0x5d6bc5,null))[_0xf252('0x2c')](removeEntity(_0x5d6bc5,null))[_0xf252('0x4a')](handleError(_0x5d6bc5,null));};exports[_0xf252('0x61')]=function(_0x428dd6,_0x1f60c1){return db[_0xf252('0x35')]['describe']()[_0xf252('0x2c')](respondWithResult(_0x1f60c1,null))[_0xf252('0x4a')](handleError(_0x1f60c1,null));};exports[_0xf252('0x62')]=function(_0x1d060a,_0x442729){var _0xa2d70a=_0x1d060a[_0xf252('0x51')];return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x1d060a['params']['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0x442729,null))[_0xf252('0x2c')](function(_0x15807e){if(_0x15807e){return db['sequelize'][_0xf252('0x59')](function(_0x50de5a){return db[_0xf252('0x5a')][_0xf252('0x2d')]({'where':{'userProfileId':_0x1d060a[_0xf252('0x53')]['id'],'sectionId':_[_0xf252('0x34')](_0xa2d70a,function(_0x2e7b02){return _0x2e7b02[_0xf252('0x5d')];})},'transaction':_0x50de5a})[_0xf252('0x2c')](function(){var _0x1cccbd=_['map'](_0xa2d70a,function(_0x3c8323){_0x3c8323[_0xf252('0x5e')]=_0x1d060a['params']['id'];return _0x3c8323;});var _0x47f2c7=[];return BPromise[_0xf252('0x5b')](_0x1cccbd,function(_0x45a750){return db[_0xf252('0x5a')][_0xf252('0x50')](_0x45a750,{'include':[{'model':db[_0xf252('0x60')],'as':'Resources'}],'raw':!![],'transaction':_0x50de5a})[_0xf252('0x2c')](function(_0x4f2ebb){_0x47f2c7[_0xf252('0x63')](_0x4f2ebb[_0xf252('0x54')]({'plain':!![]}));});})['then'](function(){return _0x47f2c7;});});});}})[_0xf252('0x2c')](function(_0x4bf930){return _0x4bf930;})['then'](respondWithResult(_0x442729,null))[_0xf252('0x4a')](handleError(_0x442729,null));};exports[_0xf252('0x64')]=function(_0x1bdc1e,_0x148d57){var _0x510ace;return db['UserProfile'][_0xf252('0x4f')]({'where':{'id':_0x1bdc1e['params']['id']},'attributes':['id',_0xf252('0x31')]})[_0xf252('0x2c')](handleEntityNotFound(_0x148d57,null))['then'](function(_0x10ab03){if(_0x10ab03){_0x510ace=_0x10ab03;return db[_0xf252('0x5a')][_0xf252('0x2d')]({'where':{'userProfileId':_0x1bdc1e[_0xf252('0x53')]['id'],'sectionId':_0x1bdc1e['query'][_0xf252('0x65')]}});}})['then'](function(){return _0x510ace;})[_0xf252('0x2c')](respondWithStatusCode(_0x148d57,null))[_0xf252('0x4a')](handleError(_0x148d57,null));};exports[_0xf252('0x66')]=function(_0x3191c5,_0x8a006f){var _0x51e6cc=[];var _0xeaca36=[];return db['UserProfileSection'][_0xf252('0x48')]({'where':{'userProfileId':_0x3191c5[_0xf252('0x53')]['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x4c96be){_0x51e6cc=_[_0xf252('0x42')](_0x4c96be,function(_0x348ed6){return _0x348ed6[_0xf252('0x67')]===0x1||_[_0xf252('0x68')]([0x3eb,0x709],_0x348ed6['sectionId']);});if(!_[_0xf252('0x69')](_0x51e6cc)){return _[_0xf252('0x34')](_0x51e6cc,function(_0x6167cb){return _0x6167cb[_0xf252('0x5d')];});}else{return;}})[_0xf252('0x2c')](function(_0x115811){if(_0x115811)_0xeaca36=_0x115811;if(_['includes'](_0xeaca36,0x64)){var _0x37dac5=_[_0xf252('0x4f')](_0x51e6cc,{'sectionId':0x64});return hasDefaultDashboard(_0x37dac5)[_0xf252('0x2c')](function(_0x1fea3d){return _[_0xf252('0x34')](_0x51e6cc,function(_0x5c6b2b){if(_0x5c6b2b[_0xf252('0x5d')]===0x64){_0x5c6b2b['subsections']=_0x1fea3d;}return _0x5c6b2b;});});}else{return;}})[_0xf252('0x2c')](function(_0x2d43cb){if(_0x2d43cb)_0x51e6cc=_0x2d43cb;if(_[_0xf252('0x68')](_0xeaca36,0x3eb)){var _0x23000e=_[_0xf252('0x4f')](_0x51e6cc,{'sectionId':0x3eb});return getCustomDashboards(_0x23000e)[_0xf252('0x2c')](function(_0x4882c7){return _[_0xf252('0x34')](_0x51e6cc,function(_0x114374){if(_0x23000e['enabled']){if(_0x114374[_0xf252('0x5d')]===0x3eb){_0x114374[_0xf252('0x6a')]=_0x4882c7;}}else{if(_0x114374[_0xf252('0x5d')]===0x64){if(!_0x114374[_0xf252('0x6a')]){_0x114374['subsections']=[];}_0x114374[_0xf252('0x6a')]=_0x114374[_0xf252('0x6a')][_0xf252('0x6b')](_0x4882c7);}}return _0x114374;});});}else{return;}})[_0xf252('0x2c')](function(_0x22c3a8){if(_0x22c3a8)_0x51e6cc=_0x22c3a8;if(_['includes'](_0xeaca36,0x709)){var _0x357a8a=_[_0xf252('0x4f')](_0x51e6cc,{'sectionId':0x709});return getPlugins(_0x357a8a)['then'](function(_0x30425e){if(_0x357a8a[_0xf252('0x67')]){return _[_0xf252('0x34')](_0x51e6cc,function(_0x2fc33b){if(_0x2fc33b[_0xf252('0x5d')]===0x709){_0x2fc33b[_0xf252('0x6a')]=_0x30425e;}return _0x2fc33b;});}else{var _0x20c90b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x30425e};var _0x301497=_[_0xf252('0x34')](_0x51e6cc);_0x301497['push'](_0x20c90b);return _0x301497;}});}else{return;}})[_0xf252('0x2c')](function(_0x1638af){if(_0x1638af)_0x51e6cc=_0x1638af;return _['filter'](_0x51e6cc,[_0xf252('0x67'),0x1]);})[_0xf252('0x2c')](respondWithResult(_0x8a006f,null))[_0xf252('0x4a')](handleError(_0x8a006f,null));};function hasDefaultDashboard(_0x4569d0){var _0xe9f759=[0x65];return new BPromise(function(_0x6decf9,_0x20f0ad){try{if(_0x4569d0[_0xf252('0x5c')]){_0x6decf9(_0xe9f759);}else{return db['UserProfileResource'][_0xf252('0x6c')]({'where':{'sectionId':_0x4569d0['id']},'raw':!![]})['then'](function(_0x54756e){_0x54756e?_0x6decf9(_0xe9f759):_0x6decf9();});}}catch(_0x46f493){_0x20f0ad(_0x46f493);}});}function getCustomDashboards(_0x510543){var _0x1238f5=[];return new BPromise(function(_0x5e5cde,_0x179647){try{if(_0x510543[_0xf252('0x5c')]){return db[_0xf252('0x6d')][_0xf252('0x48')]({'raw':!![]})[_0xf252('0x2c')](function(_0x4ddf82){_0x4ddf82[_0xf252('0x6e')](function(_0x778d7b){_0x1238f5[_0xf252('0x63')](_0x778d7b['id']+0x1869f);});_0x5e5cde(_0x1238f5);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x510543['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x2c2f36){_0x2c2f36[_0xf252('0x6e')](function(_0x559019){_0x1238f5[_0xf252('0x63')](_0x559019[_0xf252('0x6f')]+0x1869f);});_0x5e5cde(_0x1238f5);});}}catch(_0x57fd97){_0x179647(_0x57fd97);}});}function getPlugins(_0x57da34){var _0x9c2ae=[];return new BPromise(function(_0x590b06,_0x137355){try{if(_0x57da34['autoAssociation']){return db['Plugin'][_0xf252('0x48')]({'raw':!![]})[_0xf252('0x2c')](function(_0x31ad7d){_0x31ad7d['forEach'](function(_0x15c68b){_0x9c2ae['push'](_0x15c68b['id']+0x15b38);});_0x590b06(_0x9c2ae);});}else{return db[_0xf252('0x60')]['findAll']({'where':{'sectionId':_0x57da34['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x3bed83){_0x3bed83[_0xf252('0x6e')](function(_0x812767){_0x9c2ae[_0xf252('0x63')](_0x812767[_0xf252('0x6f')]+0x15b38);});_0x590b06(_0x9c2ae);});}}catch(_0x5e6c4f){_0x137355(_0x5e6c4f);}});}exports['addResources']=function(_0x798b04,_0x38d5bf){return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x798b04['params']['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0x38d5bf,null))[_0xf252('0x2c')](function(_0x4627f7){if(_0x4627f7){return db[_0xf252('0x58')][_0xf252('0x59')](function(_0xa9bba3){return db['UserProfileSection'][_0xf252('0x48')]({'where':{'userProfileId':_0x798b04[_0xf252('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0xf252('0x2c')](function(_0x17eead){if(_0x17eead){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x798b04['params']['id'],'id':_[_0xf252('0x34')](_0x17eead,function(_0x438400){return _0x438400['id'];})},'transaction':_0xa9bba3});}})[_0xf252('0x2c')](function(_0x550033){var _0x519fac=_[_0xf252('0x34')](_0x798b04['body'],function(_0xb74841){_0xb74841[_0xf252('0x5e')]=_0x798b04['params']['id'];return _0xb74841;});return db['UserProfileSection'][_0xf252('0x70')](_0x519fac,{'raw':!![],'transaction':_0xa9bba3});})[_0xf252('0x2c')](function(_0x16f24e){var _0x5a149f=_[_0xf252('0x42')](_[_0xf252('0x34')](_0x16f24e,function(_0x1bd764){return _0x1bd764[_0xf252('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x5a149f){return db[_0xf252('0x5a')][_0xf252('0x48')]({'where':{'userProfileId':_0x798b04[_0xf252('0x53')]['id'],'sectionId':_[_0xf252('0x34')](_0x5a149f,function(_0x48b103){return _0x48b103['sectionId'];})},'attributes':['id',_0xf252('0x5d')],'raw':!![]})['then'](function(_0x147c61){var _0x35c480=_[_0xf252('0x34')](_0x798b04[_0xf252('0x51')],function(_0x3bd2a5){_0x3bd2a5['userProfileId']=_0x798b04[_0xf252('0x53')]['id'];return _0x3bd2a5;});return db[_0xf252('0x60')][_0xf252('0x70')](_0x35c480,{'raw':!![],'transaction':_0xa9bba3});});}})[_0xf252('0x4a')](handleError(_0x38d5bf,null));});}})[_0xf252('0x2c')](function(_0x1d235b){var _0x1e57a9=_[_0xf252('0x34')](_0x1d235b,function(_0x4a2311){return _0x4a2311[_0xf252('0x54')]({'plain':!![]});});})[_0xf252('0x2c')](respondWithResult(_0x38d5bf,null))[_0xf252('0x4a')](handleError(_0x38d5bf,null));};exports[_0xf252('0x71')]=function(_0x1d3259,_0x294f08,_0x371c73){return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x1d3259[_0xf252('0x53')]['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0x294f08,null))['then'](function(_0x2a4a75){if(_0x2a4a75){return _0x2a4a75[_0xf252('0x71')](_0x1d3259[_0xf252('0x38')][_0xf252('0x65')]);}})[_0xf252('0x2c')](respondWithStatusCode(_0x294f08,null))[_0xf252('0x4a')](handleError(_0x294f08,null));};exports['getResources']=function(_0x43a0d3,_0x332f7d){var _0xda39ca={};if(!_0x43a0d3[_0xf252('0x38')][_0xf252('0x72')])throw new Error(_0xf252('0x73'));if(!_0x43a0d3[_0xf252('0x38')]['hasOwnProperty'](_0xf252('0x3e'))){_0xda39ca[_0xf252('0x25')]=qs[_0xf252('0x25')](_0x43a0d3[_0xf252('0x38')][_0xf252('0x25')]);_0xda39ca[_0xf252('0x23')]=qs[_0xf252('0x23')](_0x43a0d3[_0xf252('0x38')][_0xf252('0x23')]);}return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x43a0d3[_0xf252('0x53')]['id']}})[_0xf252('0x2c')](function(_0x5cabec){if(!_0x5cabec)throw new Error(_0xf252('0x74')+_0x43a0d3[_0xf252('0x53')]['id']);return db['UserProfile']['getResources'](_0x43a0d3);})[_0xf252('0x2c')](respondWithFilteredResult(_0x332f7d,_0xda39ca))[_0xf252('0x4a')](handleError(_0x332f7d,null));}; \ No newline at end of file +var _0x8e83=['keys','find','catch','create','body','clone','params','get','omit','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','updatedAt','userProfileId','Resources','describe','sequelize','sectionId','push','removeSections','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','name','UserProfile','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show'];(function(_0x348dae,_0x18d81b){var _0x34aadf=function(_0x1e82cb){while(--_0x1e82cb){_0x348dae['push'](_0x348dae['shift']());}};_0x34aadf(++_0x18d81b);}(_0x8e83,0x10a));var _0x38e8=function(_0x2370ed,_0x551215){_0x2370ed=_0x2370ed-0x0;var _0x39c6b9=_0x8e83[_0x2370ed];return _0x39c6b9;};'use strict';var emlformat=require(_0x38e8('0x0'));var rimraf=require(_0x38e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x38e8('0x2'));var moment=require(_0x38e8('0x3'));var BPromise=require(_0x38e8('0x4'));var Mustache=require(_0x38e8('0x5'));var util=require('util');var path=require(_0x38e8('0x6'));var sox=require(_0x38e8('0x7'));var csv=require(_0x38e8('0x8'));var ejs=require(_0x38e8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38e8('0xa'));var squel=require(_0x38e8('0xb'));var crypto=require(_0x38e8('0xc'));var jsforce=require(_0x38e8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x38e8('0xe'));var Papa=require('papaparse');var Redis=require(_0x38e8('0xf'));var authService=require(_0x38e8('0x10'));var qs=require(_0x38e8('0x11'));var as=require(_0x38e8('0x12'));var hardwareService=require(_0x38e8('0x13'));var logger=require(_0x38e8('0x14'))(_0x38e8('0x15'));var utils=require(_0x38e8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x38e8('0x17'));var db=require(_0x38e8('0x18'))['db'];config[_0x38e8('0x19')]=_[_0x38e8('0x1a')](config[_0x38e8('0x19')],{'host':_0x38e8('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38e8('0x19')]));require(_0x38e8('0x1c'))[_0x38e8('0x1d')](socket);function respondWithStatusCode(_0x2df9c1,_0x2d0c13){_0x2d0c13=_0x2d0c13||0xcc;return function(_0x29ea98){if(_0x29ea98){return _0x2df9c1[_0x38e8('0x1e')](_0x2d0c13);}return _0x2df9c1[_0x38e8('0x1f')](_0x2d0c13)[_0x38e8('0x20')]();};}function respondWithResult(_0x447c6c,_0x417641){_0x417641=_0x417641||0xc8;return function(_0x1d1b04){if(_0x1d1b04){return _0x447c6c[_0x38e8('0x1f')](_0x417641)['json'](_0x1d1b04);}};}function respondWithFilteredResult(_0x1c465a,_0x5a0394){return function(_0x2837c1){if(_0x2837c1){var _0x33f253=typeof _0x5a0394[_0x38e8('0x21')]===_0x38e8('0x22')&&typeof _0x5a0394['limit']===_0x38e8('0x22');var _0x1d3712=_0x2837c1[_0x38e8('0x23')];var _0x4af786=_0x33f253?0x0:_0x5a0394[_0x38e8('0x21')];var _0x3124c6=_0x33f253?_0x2837c1[_0x38e8('0x23')]:_0x5a0394['offset']+_0x5a0394[_0x38e8('0x24')];var _0x8d5528;if(_0x3124c6>=_0x1d3712){_0x3124c6=_0x1d3712;_0x8d5528=0xc8;}else{_0x8d5528=0xce;}_0x1c465a[_0x38e8('0x1f')](_0x8d5528);return _0x1c465a[_0x38e8('0x25')](_0x38e8('0x26'),_0x4af786+'-'+_0x3124c6+'/'+_0x1d3712)['json'](_0x2837c1);}return null;};}function patchUpdates(_0x15b392){return function(_0x3a413b){try{jsonpatch['apply'](_0x3a413b,_0x15b392,!![]);}catch(_0x440f96){return BPromise[_0x38e8('0x27')](_0x440f96);}return _0x3a413b[_0x38e8('0x28')]();};}function saveUpdates(_0x2a74f3,_0x326de4){return function(_0x44da98){if(_0x44da98){return _0x44da98[_0x38e8('0x29')](_0x2a74f3)[_0x38e8('0x2a')](function(_0x44813f){return _0x44813f;});}return null;};}function removeEntity(_0x5ad740,_0x4275d7){return function(_0x4daac2){if(_0x4daac2){return _0x4daac2[_0x38e8('0x2b')]()['then'](function(){_0x5ad740['status'](0xcc)[_0x38e8('0x20')]();});}};}function handleEntityNotFound(_0x47a785,_0x4171ad){return function(_0x20af88){if(!_0x20af88){_0x47a785[_0x38e8('0x1e')](0x194);}return _0x20af88;};}function handleError(_0x455af6,_0x1502f9){_0x1502f9=_0x1502f9||0x1f4;return function(_0x28432b){logger['error'](_0x28432b['stack']);if(_0x28432b[_0x38e8('0x2c')]){delete _0x28432b['name'];}_0x455af6[_0x38e8('0x1f')](_0x1502f9)['send'](_0x28432b);};}exports['index']=function(_0x180992,_0x289de2){var _0x14c0aa={},_0x4251e8={},_0x2f6fee={'count':0x0,'rows':[]};var _0x3a2c98=_['map'](db[_0x38e8('0x2d')][_0x38e8('0x2e')],function(_0x5d3c06){return{'name':_0x5d3c06[_0x38e8('0x2f')],'type':_0x5d3c06[_0x38e8('0x30')]['key']};});_0x4251e8['model']=_[_0x38e8('0x31')](_0x3a2c98,_0x38e8('0x2c'));_0x4251e8[_0x38e8('0x32')]=_['keys'](_0x180992[_0x38e8('0x32')]);_0x4251e8[_0x38e8('0x33')]=_[_0x38e8('0x34')](_0x4251e8[_0x38e8('0x35')],_0x4251e8[_0x38e8('0x32')]);_0x14c0aa['attributes']=_['intersection'](_0x4251e8['model'],qs[_0x38e8('0x36')](_0x180992[_0x38e8('0x32')][_0x38e8('0x36')]));_0x14c0aa[_0x38e8('0x37')]=_0x14c0aa['attributes'][_0x38e8('0x38')]?_0x14c0aa[_0x38e8('0x37')]:_0x4251e8['model'];if(!_0x180992[_0x38e8('0x32')][_0x38e8('0x39')]('nolimit')){_0x14c0aa[_0x38e8('0x24')]=qs['limit'](_0x180992[_0x38e8('0x32')][_0x38e8('0x24')]);_0x14c0aa[_0x38e8('0x21')]=qs['offset'](_0x180992[_0x38e8('0x32')][_0x38e8('0x21')]);}_0x14c0aa[_0x38e8('0x3a')]=qs[_0x38e8('0x3b')](_0x180992['query']['sort']);_0x14c0aa[_0x38e8('0x3c')]=qs[_0x38e8('0x33')](_[_0x38e8('0x3d')](_0x180992[_0x38e8('0x32')],_0x4251e8[_0x38e8('0x33')]),_0x3a2c98);if(_0x180992[_0x38e8('0x32')][_0x38e8('0x3e')]){_0x14c0aa['where']=_[_0x38e8('0x3f')](_0x14c0aa[_0x38e8('0x3c')],{'$or':_[_0x38e8('0x31')](_0x3a2c98,function(_0x1eaf72){if(_0x1eaf72['type']!=='VIRTUAL'){var _0x1d2c8e={};_0x1d2c8e[_0x1eaf72[_0x38e8('0x2c')]]={'$like':'%'+_0x180992[_0x38e8('0x32')][_0x38e8('0x3e')]+'%'};return _0x1d2c8e;}})});}_0x14c0aa=_['merge']({},_0x14c0aa,_0x180992[_0x38e8('0x40')]);var _0x2bd78b={'where':_0x14c0aa[_0x38e8('0x3c')]};return db[_0x38e8('0x2d')][_0x38e8('0x23')](_0x2bd78b)[_0x38e8('0x2a')](function(_0x366d85){_0x2f6fee[_0x38e8('0x23')]=_0x366d85;if(_0x180992[_0x38e8('0x32')][_0x38e8('0x41')]){_0x14c0aa[_0x38e8('0x42')]=[{'all':!![]}];}return db[_0x38e8('0x2d')][_0x38e8('0x43')](_0x14c0aa);})['then'](function(_0x4fdb50){_0x2f6fee[_0x38e8('0x44')]=_0x4fdb50;return _0x2f6fee;})[_0x38e8('0x2a')](respondWithFilteredResult(_0x289de2,_0x14c0aa))['catch'](handleError(_0x289de2,null));};exports[_0x38e8('0x45')]=function(_0x3fb1c4,_0x5a3a6f){var _0x519371={'raw':![],'where':{'id':_0x3fb1c4['params']['id']}},_0x57c729={};_0x57c729['model']=_[_0x38e8('0x46')](db[_0x38e8('0x2d')][_0x38e8('0x2e')]);_0x57c729['query']=_[_0x38e8('0x46')](_0x3fb1c4[_0x38e8('0x32')]);_0x57c729[_0x38e8('0x33')]=_['intersection'](_0x57c729[_0x38e8('0x35')],_0x57c729[_0x38e8('0x32')]);_0x519371['attributes']=_[_0x38e8('0x34')](_0x57c729[_0x38e8('0x35')],qs['fields'](_0x3fb1c4['query'][_0x38e8('0x36')]));_0x519371[_0x38e8('0x37')]=_0x519371[_0x38e8('0x37')][_0x38e8('0x38')]?_0x519371[_0x38e8('0x37')]:_0x57c729[_0x38e8('0x35')];if(_0x3fb1c4[_0x38e8('0x32')][_0x38e8('0x41')]){_0x519371[_0x38e8('0x42')]=[{'all':!![]}];}_0x519371=_[_0x38e8('0x3f')]({},_0x519371,_0x3fb1c4['options']);return db['UserProfile'][_0x38e8('0x47')](_0x519371)[_0x38e8('0x2a')](handleEntityNotFound(_0x5a3a6f,null))[_0x38e8('0x2a')](respondWithResult(_0x5a3a6f,null))[_0x38e8('0x48')](handleError(_0x5a3a6f,null));};exports[_0x38e8('0x49')]=function(_0x44a019,_0x3b7006){return db[_0x38e8('0x2d')][_0x38e8('0x49')](_0x44a019[_0x38e8('0x4a')],{})[_0x38e8('0x2a')](respondWithResult(_0x3b7006,0xc9))[_0x38e8('0x48')](handleError(_0x3b7006,null));};exports[_0x38e8('0x4b')]=function(_0xf98fa4,_0x5b2fa2){var _0xb0886e={'where':{'id':_0xf98fa4[_0x38e8('0x4c')]['id']}},_0x43c641={};_0x43c641[_0x38e8('0x35')]=_[_0x38e8('0x46')](db[_0x38e8('0x2d')][_0x38e8('0x2e')]);_0xb0886e[_0x38e8('0x37')]=_[_0x38e8('0x34')](_0x43c641[_0x38e8('0x35')],qs[_0x38e8('0x36')](_0xf98fa4[_0x38e8('0x32')]['fields']));_0xb0886e[_0x38e8('0x37')]=_0xb0886e[_0x38e8('0x37')][_0x38e8('0x38')]?_0xb0886e['attributes']:_0x43c641['model'];if(_0xf98fa4[_0x38e8('0x32')][_0x38e8('0x41')]){_0xb0886e['include']=[{'all':!![]}];}_0xb0886e=_[_0x38e8('0x3f')]({},_0xb0886e,_0xf98fa4[_0x38e8('0x40')]);return db[_0x38e8('0x2d')][_0x38e8('0x47')](_0xb0886e)[_0x38e8('0x2a')](handleEntityNotFound(_0x5b2fa2,null))['then'](function(_0x43cc77){if(_0x43cc77){var _0x1af946=_0x43cc77[_0x38e8('0x4d')]({'plain':!![]});_0x1af946=qs[_0x38e8('0x4e')](_0x1af946,['id','createdAt','updatedAt','crudPermissions']);_0xf98fa4[_0x38e8('0x4a')]=_['omit'](_0xf98fa4[_0x38e8('0x4a')],['id',_0x38e8('0x4f'),'updatedAt']);return db['sequelize'][_0x38e8('0x50')](function(_0x56f386){return db[_0x38e8('0x2d')][_0x38e8('0x49')](_[_0x38e8('0x3f')](_0x1af946,_0xf98fa4[_0x38e8('0x4a')]),{'include':_0xf98fa4[_0x38e8('0x32')][_0x38e8('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x56f386})['then'](function(_0x12aa0d){var _0x681e52=_0x12aa0d['get']({'plain':!![]});return db[_0x38e8('0x51')]['findAll']({'where':{'userProfileId':_0xf98fa4[_0x38e8('0x4c')]['id']},'raw':!![]})['then'](function(_0x487c9d){if(_0x487c9d){return BPromise[_0x38e8('0x52')](_0x487c9d,function(_0x57fac1){return new BPromise(function(_0x40cb53,_0x3333a0){if(_0x57fac1[_0x38e8('0x53')]===null||_0x57fac1[_0x38e8('0x53')]===0x1)_0x40cb53(null);return db[_0x38e8('0x54')][_0x38e8('0x43')]({'where':{'sectionId':_0x57fac1['id']},'raw':!![]})[_0x38e8('0x2a')](function(_0xcbfa75){var _0x35ebef=_['map'](_0xcbfa75,function(_0x31b7f9){return qs[_0x38e8('0x4e')](_0x31b7f9,['id',_0x38e8('0x4f'),'updatedAt','sectionId']);});_0x40cb53(_0x35ebef);})['catch'](function(_0x536c81){_0x3333a0(_0x536c81);});})[_0x38e8('0x2a')](function(_0x4d0455){var _0x363930=qs[_0x38e8('0x4e')](_0x57fac1,['id',_0x38e8('0x4f'),_0x38e8('0x55')]);_0x363930[_0x38e8('0x56')]=_0x681e52['id'];if(_0x4d0455)_0x363930[_0x38e8('0x57')]=_0x4d0455;return _0x363930;})[_0x38e8('0x2a')](function(_0x49325e){return db[_0x38e8('0x51')]['create'](_0x49325e,{'include':[{'model':db[_0x38e8('0x54')],'as':_0x38e8('0x57')}],'raw':!![],'transaction':_0x56f386});});})[_0x38e8('0x2a')](function(){return _0x681e52;});}});});});}})[_0x38e8('0x2a')](respondWithResult(_0x5b2fa2,0xc9))['catch'](handleError(_0x5b2fa2,null));};exports[_0x38e8('0x29')]=function(_0x39648d,_0x1700f6){if(_0x39648d[_0x38e8('0x4a')]['id']){delete _0x39648d[_0x38e8('0x4a')]['id'];}return db[_0x38e8('0x2d')][_0x38e8('0x47')]({'where':{'id':_0x39648d['params']['id']}})[_0x38e8('0x2a')](handleEntityNotFound(_0x1700f6,null))[_0x38e8('0x2a')](saveUpdates(_0x39648d[_0x38e8('0x4a')],null))[_0x38e8('0x2a')](respondWithResult(_0x1700f6,null))[_0x38e8('0x48')](handleError(_0x1700f6,null));};exports[_0x38e8('0x2b')]=function(_0x1a72c5,_0x15287a){return db[_0x38e8('0x2d')][_0x38e8('0x47')]({'where':{'id':_0x1a72c5[_0x38e8('0x4c')]['id']}})[_0x38e8('0x2a')](handleEntityNotFound(_0x15287a,null))[_0x38e8('0x2a')](removeEntity(_0x15287a,null))['catch'](handleError(_0x15287a,null));};exports[_0x38e8('0x58')]=function(_0x661ba2,_0x4d481d){return db[_0x38e8('0x2d')][_0x38e8('0x58')]()[_0x38e8('0x2a')](respondWithResult(_0x4d481d,null))['catch'](handleError(_0x4d481d,null));};exports['addSections']=function(_0x24f3ea,_0xaefea3){var _0x2acd03=_0x24f3ea[_0x38e8('0x4a')];return db[_0x38e8('0x2d')][_0x38e8('0x47')]({'where':{'id':_0x24f3ea[_0x38e8('0x4c')]['id']}})[_0x38e8('0x2a')](handleEntityNotFound(_0xaefea3,null))[_0x38e8('0x2a')](function(_0x7513f1){if(_0x7513f1){return db[_0x38e8('0x59')][_0x38e8('0x50')](function(_0x37cd1a){return db[_0x38e8('0x51')][_0x38e8('0x2b')]({'where':{'userProfileId':_0x24f3ea[_0x38e8('0x4c')]['id'],'sectionId':_['map'](_0x2acd03,function(_0x2e8495){return _0x2e8495[_0x38e8('0x5a')];})},'transaction':_0x37cd1a})[_0x38e8('0x2a')](function(){var _0x19fc0c=_[_0x38e8('0x31')](_0x2acd03,function(_0x31540f){_0x31540f[_0x38e8('0x56')]=_0x24f3ea[_0x38e8('0x4c')]['id'];return _0x31540f;});var _0x4961b3=[];return BPromise[_0x38e8('0x52')](_0x19fc0c,function(_0x16e147){return db[_0x38e8('0x51')][_0x38e8('0x49')](_0x16e147,{'include':[{'model':db[_0x38e8('0x54')],'as':_0x38e8('0x57')}],'raw':!![],'transaction':_0x37cd1a})[_0x38e8('0x2a')](function(_0x3b656a){_0x4961b3[_0x38e8('0x5b')](_0x3b656a[_0x38e8('0x4d')]({'plain':!![]}));});})[_0x38e8('0x2a')](function(){return _0x4961b3;});});});}})[_0x38e8('0x2a')](function(_0x356fdb){return _0x356fdb;})['then'](respondWithResult(_0xaefea3,null))[_0x38e8('0x48')](handleError(_0xaefea3,null));};exports[_0x38e8('0x5c')]=function(_0x33e336,_0x25e6ec){var _0x42e324;return db[_0x38e8('0x2d')][_0x38e8('0x47')]({'where':{'id':_0x33e336['params']['id']},'attributes':['id',_0x38e8('0x2c')]})[_0x38e8('0x2a')](handleEntityNotFound(_0x25e6ec,null))[_0x38e8('0x2a')](function(_0x2d4ebb){if(_0x2d4ebb){_0x42e324=_0x2d4ebb;return db[_0x38e8('0x51')][_0x38e8('0x2b')]({'where':{'userProfileId':_0x33e336[_0x38e8('0x4c')]['id'],'sectionId':_0x33e336['query']['ids']}});}})[_0x38e8('0x2a')](function(){return _0x42e324;})[_0x38e8('0x2a')](respondWithStatusCode(_0x25e6ec,null))[_0x38e8('0x48')](handleError(_0x25e6ec,null));};exports[_0x38e8('0x5d')]=function(_0x4042fc,_0x5542e1){var _0xfe8974=[];var _0xc4c3d0=[];return db[_0x38e8('0x51')][_0x38e8('0x43')]({'where':{'userProfileId':_0x4042fc['params']['id']},'raw':!![]})[_0x38e8('0x2a')](function(_0x4728f9){_0xfe8974=_[_0x38e8('0x3e')](_0x4728f9,function(_0x2442ff){return _0x2442ff[_0x38e8('0x5e')]===0x1||_[_0x38e8('0x5f')]([0x3eb,0x709],_0x2442ff[_0x38e8('0x5a')]);});if(!_[_0x38e8('0x60')](_0xfe8974)){return _[_0x38e8('0x31')](_0xfe8974,function(_0x3a475a){return _0x3a475a[_0x38e8('0x5a')];});}else{return;}})['then'](function(_0x535301){if(_0x535301)_0xc4c3d0=_0x535301;if(_['includes'](_0xc4c3d0,0x64)){var _0x3873f4=_[_0x38e8('0x47')](_0xfe8974,{'sectionId':0x64});return hasDefaultDashboard(_0x3873f4)[_0x38e8('0x2a')](function(_0x47ac5b){return _['map'](_0xfe8974,function(_0x196eaa){if(_0x196eaa['sectionId']===0x64){_0x196eaa[_0x38e8('0x61')]=_0x47ac5b;}return _0x196eaa;});});}else{return;}})[_0x38e8('0x2a')](function(_0x1ce04a){if(_0x1ce04a)_0xfe8974=_0x1ce04a;if(_[_0x38e8('0x5f')](_0xc4c3d0,0x3eb)){var _0x26eb7b=_['find'](_0xfe8974,{'sectionId':0x3eb});return getCustomDashboards(_0x26eb7b)[_0x38e8('0x2a')](function(_0x290ba2){return _[_0x38e8('0x31')](_0xfe8974,function(_0xba1fee){if(_0x26eb7b[_0x38e8('0x5e')]){if(_0xba1fee[_0x38e8('0x5a')]===0x3eb){_0xba1fee[_0x38e8('0x61')]=_0x290ba2;}}else{if(_0xba1fee[_0x38e8('0x5a')]===0x64){if(!_0xba1fee['subsections']){_0xba1fee[_0x38e8('0x61')]=[];}_0xba1fee[_0x38e8('0x61')]=_0xba1fee[_0x38e8('0x61')][_0x38e8('0x62')](_0x290ba2);}}return _0xba1fee;});});}else{return;}})[_0x38e8('0x2a')](function(_0x27f005){if(_0x27f005)_0xfe8974=_0x27f005;if(_[_0x38e8('0x5f')](_0xc4c3d0,0x709)){var _0x3d5113=_['find'](_0xfe8974,{'sectionId':0x709});return getPlugins(_0x3d5113)[_0x38e8('0x2a')](function(_0x1a3b2c){if(_0x3d5113[_0x38e8('0x5e')]){return _[_0x38e8('0x31')](_0xfe8974,function(_0x2d866e){if(_0x2d866e[_0x38e8('0x5a')]===0x709){_0x2d866e[_0x38e8('0x61')]=_0x1a3b2c;}return _0x2d866e;});}else{var _0x5b48fb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1a3b2c};var _0xf5af05=_[_0x38e8('0x31')](_0xfe8974);_0xf5af05[_0x38e8('0x5b')](_0x5b48fb);return _0xf5af05;}});}else{return;}})[_0x38e8('0x2a')](function(_0xa21b54){if(_0xa21b54)_0xfe8974=_0xa21b54;return _[_0x38e8('0x3e')](_0xfe8974,['enabled',0x1]);})['then'](respondWithResult(_0x5542e1,null))[_0x38e8('0x48')](handleError(_0x5542e1,null));};function hasDefaultDashboard(_0x3712c9){var _0x490097=[0x65];return new BPromise(function(_0x51e1fe,_0x37a9e1){try{if(_0x3712c9[_0x38e8('0x53')]){_0x51e1fe(_0x490097);}else{return db[_0x38e8('0x54')][_0x38e8('0x63')]({'where':{'sectionId':_0x3712c9['id']},'raw':!![]})['then'](function(_0x1a381d){_0x1a381d?_0x51e1fe(_0x490097):_0x51e1fe();});}}catch(_0x1fbdf1){_0x37a9e1(_0x1fbdf1);}});}function getCustomDashboards(_0x4c99a8){var _0x379212=[];return new BPromise(function(_0x5c9608,_0x91771){try{if(_0x4c99a8[_0x38e8('0x53')]){return db[_0x38e8('0x64')][_0x38e8('0x43')]({'raw':!![]})[_0x38e8('0x2a')](function(_0x2b1430){_0x2b1430[_0x38e8('0x65')](function(_0x1511dd){_0x379212['push'](_0x1511dd['id']+0x1869f);});_0x5c9608(_0x379212);});}else{return db[_0x38e8('0x54')][_0x38e8('0x43')]({'where':{'sectionId':_0x4c99a8['id']},'raw':!![]})[_0x38e8('0x2a')](function(_0x2ab551){_0x2ab551[_0x38e8('0x65')](function(_0x2f89f4){_0x379212[_0x38e8('0x5b')](_0x2f89f4[_0x38e8('0x66')]+0x1869f);});_0x5c9608(_0x379212);});}}catch(_0xbec74c){_0x91771(_0xbec74c);}});}function getPlugins(_0x9b1893){var _0x2190d9=[];return new BPromise(function(_0x447ad1,_0x84c488){try{if(_0x9b1893[_0x38e8('0x53')]){return db[_0x38e8('0x67')][_0x38e8('0x43')]({'raw':!![]})[_0x38e8('0x2a')](function(_0x5ec594){_0x5ec594[_0x38e8('0x65')](function(_0x17043e){_0x2190d9[_0x38e8('0x5b')](_0x17043e['id']+0x15b38);});_0x447ad1(_0x2190d9);});}else{return db[_0x38e8('0x54')][_0x38e8('0x43')]({'where':{'sectionId':_0x9b1893['id']},'raw':!![]})[_0x38e8('0x2a')](function(_0x59c311){_0x59c311[_0x38e8('0x65')](function(_0x641791){_0x2190d9[_0x38e8('0x5b')](_0x641791[_0x38e8('0x66')]+0x15b38);});_0x447ad1(_0x2190d9);});}}catch(_0x551375){_0x84c488(_0x551375);}});}exports[_0x38e8('0x68')]=function(_0x26d1f3,_0x38b463){return db['UserProfile'][_0x38e8('0x47')]({'where':{'id':_0x26d1f3[_0x38e8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x38b463,null))['then'](function(_0x708f96){if(_0x708f96){return db[_0x38e8('0x59')][_0x38e8('0x50')](function(_0x57a36c){return db[_0x38e8('0x51')][_0x38e8('0x43')]({'where':{'userProfileId':_0x26d1f3[_0x38e8('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x38e8('0x2a')](function(_0x3b1d7a){if(_0x3b1d7a){return db[_0x38e8('0x51')][_0x38e8('0x2b')]({'where':{'userProfileId':_0x26d1f3['params']['id'],'id':_[_0x38e8('0x31')](_0x3b1d7a,function(_0x27ecff){return _0x27ecff['id'];})},'transaction':_0x57a36c});}})[_0x38e8('0x2a')](function(_0x5ac1ea){var _0x5232b3=_[_0x38e8('0x31')](_0x26d1f3['body'],function(_0x4d7ca9){_0x4d7ca9[_0x38e8('0x56')]=_0x26d1f3[_0x38e8('0x4c')]['id'];return _0x4d7ca9;});return db['UserProfileSection'][_0x38e8('0x69')](_0x5232b3,{'raw':!![],'transaction':_0x57a36c});})[_0x38e8('0x2a')](function(_0x33a9b9){var _0x1ef5dc=_['filter'](_[_0x38e8('0x31')](_0x33a9b9,function(_0x4ddec0){return _0x4ddec0[_0x38e8('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x1ef5dc){return db[_0x38e8('0x51')][_0x38e8('0x43')]({'where':{'userProfileId':_0x26d1f3['params']['id'],'sectionId':_[_0x38e8('0x31')](_0x1ef5dc,function(_0x2fc902){return _0x2fc902[_0x38e8('0x5a')];})},'attributes':['id',_0x38e8('0x5a')],'raw':!![]})['then'](function(_0x214e8b){var _0x3a688d=_[_0x38e8('0x31')](_0x26d1f3['body'],function(_0x3874a5){_0x3874a5[_0x38e8('0x56')]=_0x26d1f3['params']['id'];return _0x3874a5;});return db[_0x38e8('0x54')]['bulkCreate'](_0x3a688d,{'raw':!![],'transaction':_0x57a36c});});}})[_0x38e8('0x48')](handleError(_0x38b463,null));});}})[_0x38e8('0x2a')](function(_0x418f81){var _0x4865c2=_[_0x38e8('0x31')](_0x418f81,function(_0x38d0fc){return _0x38d0fc[_0x38e8('0x4d')]({'plain':!![]});});})[_0x38e8('0x2a')](respondWithResult(_0x38b463,null))[_0x38e8('0x48')](handleError(_0x38b463,null));};exports[_0x38e8('0x6a')]=function(_0x3a5315,_0x237c34,_0x4fb225){return db[_0x38e8('0x2d')][_0x38e8('0x47')]({'where':{'id':_0x3a5315[_0x38e8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x237c34,null))[_0x38e8('0x2a')](function(_0x314a51){if(_0x314a51){return _0x314a51['removeResources'](_0x3a5315[_0x38e8('0x32')]['ids']);}})[_0x38e8('0x2a')](respondWithStatusCode(_0x237c34,null))[_0x38e8('0x48')](handleError(_0x237c34,null));};exports[_0x38e8('0x6b')]=function(_0x3f88b1,_0x506c41){var _0x177753={};if(!_0x3f88b1[_0x38e8('0x32')][_0x38e8('0x6c')])throw new Error(_0x38e8('0x6d'));if(!_0x3f88b1[_0x38e8('0x32')][_0x38e8('0x39')](_0x38e8('0x6e'))){_0x177753[_0x38e8('0x24')]=qs['limit'](_0x3f88b1['query'][_0x38e8('0x24')]);_0x177753[_0x38e8('0x21')]=qs['offset'](_0x3f88b1[_0x38e8('0x32')][_0x38e8('0x21')]);}return db[_0x38e8('0x2d')]['find']({'where':{'id':_0x3f88b1['params']['id']}})[_0x38e8('0x2a')](function(_0x59af85){if(!_0x59af85)throw new Error(_0x38e8('0x6f')+_0x3f88b1[_0x38e8('0x4c')]['id']);return db[_0x38e8('0x2d')][_0x38e8('0x6b')](_0x3f88b1);})[_0x38e8('0x2a')](respondWithFilteredResult(_0x506c41,_0x177753))[_0x38e8('0x48')](handleError(_0x506c41,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 4cd082f..7f9317f 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 _0x1b9b=['exports','events','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3688d5,_0x51d2b7){var _0x3013c4=function(_0x5b3b4c){while(--_0x5b3b4c){_0x3688d5['push'](_0x3688d5['shift']());}};_0x3013c4(++_0x51d2b7);}(_0x1b9b,0x89));var _0xb1b9=function(_0x1bc4bc,_0x35ca01){_0x1bc4bc=_0x1bc4bc-0x0;var _0x1f976e=_0x1b9b[_0x1bc4bc];return _0x1f976e;};'use strict';var EventEmitter=require(_0xb1b9('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xb1b9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb1b9('0x2')](0x0);var events={'afterCreate':_0xb1b9('0x3'),'afterUpdate':_0xb1b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38f77a){return function(_0x411464,_0x597f8f,_0x5c24be){UserProfileEvents['emit'](_0x38f77a+':'+_0x411464['id'],_0x411464);UserProfileEvents[_0xb1b9('0x5')](_0x38f77a,_0x411464);_0x5c24be(null);};}for(var e in events){if(events[_0xb1b9('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xb1b9('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xd943=['../../mysqldb','UserProfile','setMaxListeners','update','remove','emit','events'];(function(_0x7c3d8e,_0xe8589e){var _0xb20a7f=function(_0x1dc951){while(--_0x1dc951){_0x7c3d8e['push'](_0x7c3d8e['shift']());}};_0xb20a7f(++_0xe8589e);}(_0xd943,0x15d));var _0x3d94=function(_0x6e286,_0x3842af){_0x6e286=_0x6e286-0x0;var _0xbe3141=_0xd943[_0x6e286];return _0xbe3141;};'use strict';var EventEmitter=require(_0x3d94('0x0'));var UserProfile=require(_0x3d94('0x1'))['db'][_0x3d94('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3d94('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3d94('0x4'),'afterDestroy':_0x3d94('0x5')};function emitEvent(_0x38b5ca){return function(_0xc13b61,_0xaf8962,_0x5751f6){UserProfileEvents['emit'](_0x38b5ca+':'+_0xc13b61['id'],_0xc13b61);UserProfileEvents[_0x3d94('0x6')](_0x38b5ca,_0xc13b61);_0x5751f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 64ec339..fa57e57 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 _0xfd3a=['intersection','fields','attributes','nolimit','limit','offset','sort','pick','where','merge','key','VIRTUAL','foreignKey','forEach','include','DefaultReports','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','includeAll','color','tag','openTabs','true','dataValues','sms','fax','openchannel','whatsapp','lodash','exports','models','filter','field','map','model','findAll','then','associatedResources','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','catch','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','CmCompany','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','membername','User','role','agent','Telephones','telephone','VoiceQueues','inbound','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueue','QueueCampaigns','users','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Dashboard','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','from','_interactions','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','params','all','union','find','ignore','autoAssociation','rawAttributes','keys','filters'];(function(_0x22a58e,_0x55b7c2){var _0x3d522d=function(_0x3b9006){while(--_0x3b9006){_0x22a58e['push'](_0x22a58e['shift']());}};_0x3d522d(++_0x55b7c2);}(_0xfd3a,0xd7));var _0xafd3=function(_0x59dec,_0x4b079e){_0x59dec=_0x59dec-0x0;var _0x5e668f=_0xfd3a[_0x59dec];return _0x5e668f;};'use strict';var _=require(_0xafd3('0x0'));var attributes=require('./userProfile.attributes');var squel=require('squel');module[_0xafd3('0x1')]=function(_0xa5a0ff){var _0x35c2e6=_0xa5a0ff[_0xafd3('0x2')];function _0x379f9a(_0x355934,_0xdb35e5){return new Promise(function(_0x5ddba6,_0x2e068a){if(!_0xdb35e5)return _0x5ddba6(null);var _0xdd0ae5=_0xdb35e5[_0xafd3('0x3')]?{[_0xdb35e5[_0xafd3('0x3')][_0xafd3('0x4')]]:_0xdb35e5[_0xafd3('0x3')]['value']}:undefined;return _0x35c2e6[_0x355934]['findAll']({'where':_0xdd0ae5,'raw':!![]})['then'](function(_0x5702cc){_0xdb35e5['associatedResources']=_[_0xafd3('0x5')](_0x5702cc,'id');_0x5ddba6(_0xdb35e5);})['catch'](function(_0x4874db){_0x2e068a(_0x4874db);});});}function _0x315d54(_0x7b99d0,_0x57edac){return new Promise(function(_0x80c832,_0x3fa2ee){var _0xa27877=_0x7b99d0[_0xafd3('0x3')]?{[_0x7b99d0[_0xafd3('0x3')][_0xafd3('0x4')]]:_0x7b99d0['filter']['value']}:undefined;return _0x35c2e6[_0x7b99d0[_0xafd3('0x6')]][_0xafd3('0x7')]({'where':_0xa27877,'raw':!![]})[_0xafd3('0x8')](function(_0x3cf7c4){_0x57edac[_0xafd3('0x9')]=_[_0xafd3('0x5')](_0x3cf7c4,function(_0x1b1b06){return _0x1b1b06['name'];});_0x80c832(_0x57edac);})['catch'](function(_0x25780e){_0x3fa2ee(_0x25780e);});});}function _0x254dad(_0x7d3828,_0x265359,_0x48c3b8){if(!_0x265359)return Promise[_0xafd3('0xa')](null);return new Promise(function(_0x247e8b,_0x1c974a){return _0x35c2e6[_0xafd3('0xb')]['findAll']({'where':{'sectionId':_0x265359['id']},'raw':!![]})['then'](function(_0x4e1194){if(_0x7d3828[_0xafd3('0x4')]&&_0x7d3828[_0xafd3('0x4')]!=='id'){_0x265359[_0xafd3('0x9')]=_[_0xafd3('0x5')](_0x4e1194,function(_0x4514fc){return _0x4514fc[_0x7d3828[_0xafd3('0x4')]];});}else{if(_0x48c3b8===_0xafd3('0xc')){_0x265359[_0xafd3('0x9')]=_[_0xafd3('0x5')](_0x4e1194,function(_0x44d7e1){return{'id':_0x44d7e1[_0xafd3('0xd')],'type':_0x44d7e1[_0xafd3('0xe')]};});}else{_0x265359['associatedResources']=_[_0xafd3('0x5')](_0x4e1194,function(_0x25bbfa){return _0x25bbfa[_0xafd3('0xd')];});}}_0x247e8b(_0x265359);})[_0xafd3('0xf')](function(_0x197397){_0x1c974a(_0x197397);});});}function _0x47e5e1(_0x2c2674,_0x34de1b){var _0x4b21ac={'parentSections':[]};switch(_0x2c2674[_0xafd3('0x10')]()){case'squareprojects':_0x4b21ac['childModel']=_0xafd3('0x11');break;case _0xafd3('0x12'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x14');break;case'squarerecordings':_0x4b21ac['childModel']=_0xafd3('0x15');_0x4b21ac[_0xafd3('0x16')]=[{'name':_0xafd3('0x17'),'field':_0xafd3('0x18'),'foreignKey':_0xafd3('0x19')}];break;case _0xafd3('0x1a'):_0x4b21ac['childModel']=_0xafd3('0x1b');break;case _0xafd3('0x1c'):_0x4b21ac['childModel']='CmContact';_0x4b21ac[_0xafd3('0x16')]=[{'name':_0xafd3('0x1d'),'field':'id','foreignKey':_0xafd3('0x1e')}];break;case'lists':_0x4b21ac['childModel']=_0xafd3('0x1f');break;case'companies':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x20');break;case'globalcustomfields':_0x4b21ac['childModel']=_0xafd3('0x21');break;case _0xafd3('0x22'):_0x4b21ac[_0xafd3('0x13')]='ChatQueue';break;case _0xafd3('0x23'):_0x4b21ac['childModel']=_0xafd3('0x24');break;case _0xafd3('0x25'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x26');break;case'faxaccounts':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x27');break;case'inboundroutes':case _0xafd3('0x28'):case'outboundroutes':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x29');break;case _0xafd3('0x2a'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x2b');break;case _0xafd3('0x2c'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x2d');break;case'voicerecordings':_0x4b21ac[_0xafd3('0x13')]='VoiceRecording';_0x4b21ac['parentSections']=[{'name':'Agents','field':_0xafd3('0x18'),'foreignKey':_0xafd3('0x2e'),'model':_0xafd3('0x2f'),'filter':{'field':_0xafd3('0x30'),'value':[_0xafd3('0x31')]}},{'name':_0xafd3('0x32'),'field':'name','foreignKey':'membername','model':_0xafd3('0x2f'),'filter':{'field':_0xafd3('0x30'),'value':[_0xafd3('0x33')]}},{'name':_0xafd3('0x34'),'field':_0xafd3('0x18'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xafd3('0x35')]}},{'name':'QueueCampaigns','field':_0xafd3('0x18'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xafd3('0xe'),'value':[_0xafd3('0x36')]}}];break;case _0xafd3('0x37'):_0x4b21ac[_0xafd3('0x13')]='VoiceMusicOnHold';break;case _0xafd3('0x38'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x39');break;case _0xafd3('0x3a'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x3b');break;case _0xafd3('0x3c'):_0x4b21ac['childModel']='Campaign';break;case'mailqueues':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x3d');break;case _0xafd3('0x3e'):_0x4b21ac['childModel']=_0xafd3('0x3f');break;case _0xafd3('0x40'):_0x4b21ac['childModel']=_0xafd3('0x41');break;case'openchannelqueues':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x42');break;case'openchannelaccounts':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x43');break;case _0xafd3('0x44'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x45');break;case _0xafd3('0x46'):_0x4b21ac[_0xafd3('0x13')]='SmsAccount';break;case'whatsappqueues':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x47');break;case'whatsappaccounts':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x48');break;case _0xafd3('0x49'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x4a');break;case'voicequeues':case _0xafd3('0x4b'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x4c');if(_0x34de1b){_0x4b21ac[_0xafd3('0x16')]=[{'name':_0xafd3('0x34')},{'name':_0xafd3('0x4d')}];}break;case _0xafd3('0x4e'):case _0xafd3('0x4f'):case _0xafd3('0x50'):_0x4b21ac[_0xafd3('0x13')]='User';if(_0x34de1b){_0x4b21ac[_0xafd3('0x16')]=[{'name':_0xafd3('0x51'),'filter':{'field':'role','value':[_0xafd3('0x52'),_0xafd3('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x54');break;case _0xafd3('0x55'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x56');break;case'freshdeskaccounts':_0x4b21ac['childModel']=_0xafd3('0x57');break;case _0xafd3('0x58'):_0x4b21ac['childModel']=_0xafd3('0x59');break;case _0xafd3('0x5a'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x5b');break;case'zohoaccounts':_0x4b21ac['childModel']='ZohoAccount';break;case _0xafd3('0x5c'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x2f');break;case _0xafd3('0x5d'):_0x4b21ac['childModel']=_0xafd3('0x5e');break;case'dispositions':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x5f');break;case'customdashboards':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x60');break;case'intervals':_0x4b21ac['childModel']=_0xafd3('0x61');break;case _0xafd3('0x62'):_0x4b21ac['childModel']=_0xafd3('0x63');break;case'scheduler':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x64');break;case _0xafd3('0x65'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x66');break;case _0xafd3('0x67'):_0x4b21ac['childModel']=_0xafd3('0x68');break;case _0xafd3('0x69'):_0x4b21ac['childModel']='Template';break;case _0xafd3('0x6a'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x6b');break;case _0xafd3('0x6c'):_0x4b21ac['childModel']=_0xafd3('0x6d');break;case _0xafd3('0x6e'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x6f');break;case _0xafd3('0x70'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x71');break;case _0xafd3('0x72'):_0x4b21ac[_0xafd3('0x13')]='AnalyticExtractedReport';_0x4b21ac[_0xafd3('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0xafd3('0x73')}];break;case'metrics':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x74');break;}return _0x4b21ac;}function _0x1a93f5(_0x31a28d,_0x1fa558){var _0x234cf5=_0x31a28d[_0xafd3('0x75')](0x0)[_0xafd3('0x76')]()+_0x31a28d['slice'](0x1);var _0x2a787c={'type':_0x35c2e6[_0xafd3('0x77')][_0xafd3('0x78')][_0xafd3('0x79')],'raw':!![]};return new Promise(function(_0x43fe30,_0x3a9a56){var _0x5ba083=squel[_0xafd3('0x7a')]()[_0xafd3('0x4')]('ui.'+_0x234cf5+'InteractionId','id')[_0xafd3('0x4')]('ui.createdAt')[_0xafd3('0x7b')]('user_has_'+_0x31a28d+_0xafd3('0x7c'),'ui')['where']('ui.UserId\x20=\x20?',_0x1fa558['id']);return _0x35c2e6[_0xafd3('0x7d')]['query'](_0x5ba083[_0xafd3('0x7e')](),_0x2a787c)[_0xafd3('0x8')](function(_0x38ce00){_0x1fa558[_0x234cf5+_0xafd3('0x7f')]=_0x38ce00;_0x43fe30(_0x38ce00);})['catch'](function(_0x43ebd3){_0x3a9a56(_0x43ebd3);});});}return _0xa5a0ff[_0xafd3('0x80')](_0xafd3('0x81'),attributes,{'tableName':_0xafd3('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x197a9b){var _0x57cbc7=require(_0xafd3('0x83'));var _0x11b270={'raw':_0x197a9b[_0xafd3('0x84')][_0xafd3('0x85')],'where':{}};var _0x224c2c={};var _0x7aa7ce={'count':0x0,'rows':[]};var _0x444447=_0x197a9b[_0xafd3('0x84')][_0xafd3('0x86')];var _0x4f1e6f=_0x197a9b[_0xafd3('0x84')][_0xafd3('0x87')]||![];var _0x44392d=_0x47e5e1(_0x444447,_0x4f1e6f);if(!_0x44392d[_0xafd3('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x444447+'\x27');var _0x18465d=[{'name':_0x444447}];if(!_[_0xafd3('0x88')](_0x44392d['parentSections']))_0x18465d=_0x44392d[_0xafd3('0x16')];var _0x101767=[];for(var _0x5c3acc=0x0;_0x5c3acc<_0x18465d[_0xafd3('0x89')];_0x5c3acc++){_0x101767[_0xafd3('0x8a')](_0x35c2e6[_0xafd3('0x8b')]['find']({'where':{'userProfileId':_0x197a9b[_0xafd3('0x8c')]['id'],'name':_0x18465d[_0x5c3acc][_0xafd3('0x18')]},'raw':!![]}));}return Promise[_0xafd3('0x8d')](_0x101767)[_0xafd3('0x8')](function(_0x56b2c3){var _0x3b8652=_['filter'](_0x56b2c3,function(_0x5738fd){return _0x5738fd?_0x5738fd:undefined;});var _0x11d790=_[_0xafd3('0x3')](_0x18465d,['ignore',!![]]);var _0x336938=_[_0xafd3('0x88')](_0x3b8652)&&_['isEmpty'](_0x11d790)?null:_[_0xafd3('0x8e')](_0x11d790,_0x3b8652);if(!_0x336938)return null;var _0x4a10d0=[];for(var _0x3be5a0=0x0;_0x3be5a0<_0x336938['length'];_0x3be5a0++){var _0x473bc0=_[_0xafd3('0x8f')](_0x18465d,function(_0x20331b){return _0x336938[_0x3be5a0]?_0x20331b[_0xafd3('0x18')]===_0x336938[_0x3be5a0][_0xafd3('0x18')]:null;});if(_0x473bc0){if(_0x336938[_0x3be5a0][_0xafd3('0x90')]){_0x4a10d0[_0xafd3('0x8a')](_0x379f9a(_0x44392d[_0xafd3('0x13')],_0x336938[_0x3be5a0]));}else{if(!_0x336938[_0x3be5a0][_0xafd3('0x91')]){_0x4a10d0[_0xafd3('0x8a')](_0x254dad(_0x473bc0,_0x336938[_0x3be5a0],_0x44392d[_0xafd3('0x13')]));}else{if(_0x473bc0['model']){_0x4a10d0[_0xafd3('0x8a')](_0x315d54(_0x473bc0,_0x336938[_0x3be5a0]));}}}}}return Promise[_0xafd3('0x8d')](_0x4a10d0);})[_0xafd3('0x8')](function(_0x1a6919){var _0x24334f=_0x1a6919;var _0x2875d1=null;if(_0x24334f){_0x2875d1=_0x24334f[_0xafd3('0x89')]===0x1?_0x24334f[0x0]:null;}if(!_0x2875d1&&!_0x24334f)return _0x7aa7ce;var _0x4a4d8f=_0x35c2e6[_0x44392d[_0xafd3('0x13')]][_0xafd3('0x92')];_0x224c2c[_0xafd3('0x6')]=_[_0xafd3('0x93')](_0x4a4d8f);_0x224c2c[_0xafd3('0x84')]=_[_0xafd3('0x93')](_0x197a9b[_0xafd3('0x84')]);_0x224c2c[_0xafd3('0x94')]=_[_0xafd3('0x95')](_0x224c2c[_0xafd3('0x6')],_0x224c2c[_0xafd3('0x84')]);_0x11b270['attributes']=_[_0xafd3('0x95')](_0x224c2c[_0xafd3('0x6')],_0x57cbc7['fields'](_0x197a9b['query'][_0xafd3('0x96')]));_0x11b270['attributes']=_0x11b270['attributes']['length']?_0x11b270[_0xafd3('0x97')]:_0x224c2c[_0xafd3('0x6')];if(!_0x197a9b['query']['hasOwnProperty'](_0xafd3('0x98'))){_0x11b270[_0xafd3('0x99')]=_0x57cbc7[_0xafd3('0x99')](_0x197a9b[_0xafd3('0x84')][_0xafd3('0x99')]);_0x11b270[_0xafd3('0x9a')]=_0x57cbc7[_0xafd3('0x9a')](_0x197a9b[_0xafd3('0x84')]['offset']);}_0x11b270['order']=_0x57cbc7['sort'](_0x197a9b[_0xafd3('0x84')][_0xafd3('0x9b')]);_0x11b270['where']=_0x57cbc7['filters'](_[_0xafd3('0x9c')](_0x197a9b[_0xafd3('0x84')],_0x224c2c[_0xafd3('0x94')]));if(_0x197a9b[_0xafd3('0x84')]['filter']){_0x11b270[_0xafd3('0x9d')]=_[_0xafd3('0x9e')](_0x11b270[_0xafd3('0x9d')],{'$or':_[_0xafd3('0x5')](_0x4a4d8f,function(_0x518a1b){if(_0x518a1b['type'][_0xafd3('0x9f')]!==_0xafd3('0xa0')){var _0x4b672c={};_0x4b672c[_0x518a1b[_0xafd3('0x4')]]={'$like':'%'+_0x197a9b[_0xafd3('0x84')][_0xafd3('0x3')]+'%'};return _0x4b672c;}})});}var _0x4d7c21=[];var _0x3f9302=null;var _0x41c119={};if(_0x2875d1){_0x3f9302=_[_0xafd3('0x8f')](_0x18465d,[_0xafd3('0x18'),_0x2875d1[_0xafd3('0x18')]]);if(_0x3f9302[_0xafd3('0x4')]){_0x41c119={};if(_0x44392d[_0xafd3('0x13')]===_0xafd3('0xc')){_0x41c119[_0x3f9302[_0xafd3('0xa1')]]=_['map'](_0x2875d1['associatedResources'],'id');}else{_0x41c119[_0x3f9302['foreignKey']]=_0x2875d1['associatedResources'];}_0x4d7c21['push'](_0x41c119);}else{_0x11b270[_0xafd3('0x9d')]['id']=_0x2875d1[_0xafd3('0x9')];}}else{for(var _0x2fc430=0x0;_0x2fc430<_0x24334f[_0xafd3('0x89')];_0x2fc430++){_0x3f9302=_[_0xafd3('0x8f')](_0x18465d,['name',_0x24334f[_0x2fc430]['name']]);if(_0x3f9302[_0xafd3('0x4')]){_0x41c119={};_0x41c119[_0x3f9302[_0xafd3('0xa1')]]=_0x24334f[_0x2fc430][_0xafd3('0x9')];_0x4d7c21[_0xafd3('0x8a')](_0x41c119);}else{if(!_0x11b270['where']['id'])_0x11b270[_0xafd3('0x9d')]['id']=[];_0x24334f[_0x2fc430][_0xafd3('0x9')][_0xafd3('0xa2')](function(_0xc45166){_0x11b270[_0xafd3('0x9d')]['id'][_0xafd3('0x8a')](_0xc45166);});}}}if(!_[_0xafd3('0x88')](_0x4d7c21)){_0x11b270[_0xafd3('0x9d')]=_['merge'](_0x11b270[_0xafd3('0x9d')],{'$and':{'$or':_0x4d7c21}});}_0x11b270=_['merge']({},_0x11b270,_0x197a9b['options']);if(_0x2875d1&&!_0x2875d1[_0xafd3('0x91')]&&_0x44392d['childModel']===_0xafd3('0xc')){if(_0x197a9b[_0xafd3('0x84')]['includeAll']){_0x11b270[_0xafd3('0xa3')]=[{'all':!![]}];}return _0x35c2e6[_0x44392d[_0xafd3('0x13')]]['findAll'](_0x11b270)[_0xafd3('0x8')](function(_0x46868e){var _0x3e03e0=[];_0x46868e[_0xafd3('0xa2')](function(_0x122237){var _0x478d7d;switch(_0x122237['reportType']){case'default':_0x478d7d=_['find'](_0x2875d1['associatedResources'],function(_0x14958b){return _0x14958b['id']===_0x122237[_0xafd3('0x73')]&&_0x14958b['type']===_0xafd3('0xa4');});break;case'custom':_0x478d7d=_[_0xafd3('0x8f')](_0x2875d1[_0xafd3('0x9')],function(_0x23c80c){return _0x23c80c['id']===_0x122237['reportId']&&_0x23c80c['type']===_0xafd3('0xa5');});break;}if(_0x478d7d)_0x3e03e0['push'](_0x122237);});_0x7aa7ce[_0xafd3('0xa6')]=_0x3e03e0[_0xafd3('0x89')];_0x7aa7ce[_0xafd3('0xa7')]=_0x3e03e0;return _0x7aa7ce;});}else{if(!_[_0xafd3('0x88')](_0x197a9b[_0xafd3('0x84')][_0xafd3('0xa8')])){_0x11b270['where']['id']=_0x11b270[_0xafd3('0x9d')]['id']?_['intersection'](_0x11b270[_0xafd3('0x9d')]['id'],_0x197a9b['query'][_0xafd3('0xa8')]):_0x197a9b[_0xafd3('0x84')][_0xafd3('0xa8')];if(_0x197a9b[_0xafd3('0x84')][_0xafd3('0xa9')]){_0x11b270[_0xafd3('0xaa')]=_0x197a9b[_0xafd3('0x84')][_0xafd3('0xa9')];}}if(_0x197a9b[_0xafd3('0x84')]['extraQueryConditions']){_0x11b270[_0xafd3('0x9d')]=_['merge'](_0x11b270[_0xafd3('0x9d')],{'$and':_0x197a9b[_0xafd3('0x84')][_0xafd3('0xab')]});}return _0x35c2e6[_0x44392d['childModel']][_0xafd3('0xa6')]({'where':_0x11b270[_0xafd3('0x9d')]})['then'](function(_0x435879){_0x7aa7ce[_0xafd3('0xa6')]=_0x435879;if(_0x197a9b['query'][_0xafd3('0xac')]){if(_0x44392d['childModel']==='CmContact'){_0x11b270[_0xafd3('0xa3')]=[{'model':_0x35c2e6[_0xafd3('0x68')],'as':'Tags','attributes':['id',_0xafd3('0x18'),_0xafd3('0xad')],'required':_0x197a9b[_0xafd3('0x84')]['tag']?!![]:![]},{'model':_0x35c2e6[_0xafd3('0x68')],'as':'ThroughTags','attributes':['id',_0xafd3('0x18'),_0xafd3('0xad')],'through':_0x197a9b['query'][_0xafd3('0xae')]?{'attributes':[],'where':{'TagId':_0x197a9b[_0xafd3('0x84')][_0xafd3('0xae')]||undefined}}:{},'required':_0x197a9b[_0xafd3('0x84')][_0xafd3('0xae')]?!![]:![]}];}else{_0x11b270[_0xafd3('0xa3')]=[{'all':!![]}];}}return _0x35c2e6[_0x44392d[_0xafd3('0x13')]]['findAll'](_0x11b270);})[_0xafd3('0x8')](function(_0x441b48){_0x7aa7ce[_0xafd3('0xa7')]=_0x441b48;if(_0x444447==='Agents'&&_0x197a9b[_0xafd3('0x84')][_0xafd3('0xaf')]===_0xafd3('0xb0')){var _0x38432d=[];for(var _0x37b401=0x0;_0x37b401<_0x7aa7ce[_0xafd3('0xa7')][_0xafd3('0x89')];_0x37b401++){_0x38432d[_0xafd3('0x8a')](_0x1a93f5('chat',_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));_0x38432d[_0xafd3('0x8a')](_0x1a93f5(_0xafd3('0xb2'),_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));_0x38432d['push'](_0x1a93f5(_0xafd3('0xb3'),_0x7aa7ce[_0xafd3('0xa7')][_0x37b401]['dataValues']));_0x38432d[_0xafd3('0x8a')](_0x1a93f5('mail',_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));_0x38432d[_0xafd3('0x8a')](_0x1a93f5(_0xafd3('0xb4'),_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));_0x38432d[_0xafd3('0x8a')](_0x1a93f5(_0xafd3('0xb5'),_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));}return Promise['all'](_0x38432d)['then'](function(){return _0x7aa7ce;});}return _0x7aa7ce;});}});}}});}; \ No newline at end of file +var _0x539e=['limit','offset','sort','filters','where','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','order','extraQueryConditions','CmContact','Tags','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','squel','exports','filter','value','findAll','then','associatedResources','map','catch','field','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','Lists','ListId','lists','CmCompany','globalcustomfields','CmCustomField','ChatQueue','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','inbound','VoiceQueue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','QueueCampaigns','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','Pause','sounds','Sound','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','query','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','ignore','union','find','keys','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x1a688d,_0x201d1e){var _0x8991ce=function(_0x5b2546){while(--_0x5b2546){_0x1a688d['push'](_0x1a688d['shift']());}};_0x8991ce(++_0x201d1e);}(_0x539e,0x1b4));var _0xe539=function(_0x2cc077,_0x17b200){_0x2cc077=_0x2cc077-0x0;var _0xed00be=_0x539e[_0x2cc077];return _0xed00be;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require(_0xe539('0x0'));module[_0xe539('0x1')]=function(_0x13e3d4){var _0x459d65=_0x13e3d4['models'];function _0x3d4e88(_0x457532,_0xa909e6){return new Promise(function(_0x175430,_0x3439a4){if(!_0xa909e6)return _0x175430(null);var _0x8a302f=_0xa909e6[_0xe539('0x2')]?{[_0xa909e6['filter']['field']]:_0xa909e6[_0xe539('0x2')][_0xe539('0x3')]}:undefined;return _0x459d65[_0x457532][_0xe539('0x4')]({'where':_0x8a302f,'raw':!![]})[_0xe539('0x5')](function(_0x317b10){_0xa909e6[_0xe539('0x6')]=_[_0xe539('0x7')](_0x317b10,'id');_0x175430(_0xa909e6);})[_0xe539('0x8')](function(_0x186016){_0x3439a4(_0x186016);});});}function _0x3b1d50(_0x4b485a,_0x3c3f07){return new Promise(function(_0x2844f6,_0xcd241c){var _0x2b81f3=_0x4b485a[_0xe539('0x2')]?{[_0x4b485a['filter'][_0xe539('0x9')]]:_0x4b485a[_0xe539('0x2')][_0xe539('0x3')]}:undefined;return _0x459d65[_0x4b485a[_0xe539('0xa')]]['findAll']({'where':_0x2b81f3,'raw':!![]})[_0xe539('0x5')](function(_0x3222d1){_0x3c3f07[_0xe539('0x6')]=_['map'](_0x3222d1,function(_0x1c5a67){return _0x1c5a67[_0xe539('0xb')];});_0x2844f6(_0x3c3f07);})['catch'](function(_0x1ae9ab){_0xcd241c(_0x1ae9ab);});});}function _0x3b4e32(_0x4f80e4,_0xd7801,_0x1dbcc4){if(!_0xd7801)return Promise[_0xe539('0xc')](null);return new Promise(function(_0x2a21e3,_0x4e4b25){return _0x459d65[_0xe539('0xd')][_0xe539('0x4')]({'where':{'sectionId':_0xd7801['id']},'raw':!![]})[_0xe539('0x5')](function(_0x224ddf){if(_0x4f80e4['field']&&_0x4f80e4[_0xe539('0x9')]!=='id'){_0xd7801['associatedResources']=_['map'](_0x224ddf,function(_0x3589e8){return _0x3589e8[_0x4f80e4[_0xe539('0x9')]];});}else{if(_0x1dbcc4===_0xe539('0xe')){_0xd7801[_0xe539('0x6')]=_[_0xe539('0x7')](_0x224ddf,function(_0x4cc4d9){return{'id':_0x4cc4d9[_0xe539('0xf')],'type':_0x4cc4d9[_0xe539('0x10')]};});}else{_0xd7801[_0xe539('0x6')]=_[_0xe539('0x7')](_0x224ddf,function(_0x4f50e8){return _0x4f50e8[_0xe539('0xf')];});}}_0x2a21e3(_0xd7801);})[_0xe539('0x8')](function(_0x56334d){_0x4e4b25(_0x56334d);});});}function _0x1b3a8b(_0x56af82,_0x502085){var _0x11bdfe={'parentSections':[]};switch(_0x56af82[_0xe539('0x11')]()){case _0xe539('0x12'):_0x11bdfe['childModel']=_0xe539('0x13');break;case _0xe539('0x14'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x16');break;case _0xe539('0x17'):_0x11bdfe['childModel']=_0xe539('0x18');_0x11bdfe[_0xe539('0x19')]=[{'name':_0xe539('0x1a'),'field':_0xe539('0xb'),'foreignKey':'projectName'}];break;case _0xe539('0x1b'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x1c');break;case'contacts':_0x11bdfe[_0xe539('0x15')]='CmContact';_0x11bdfe[_0xe539('0x19')]=[{'name':_0xe539('0x1d'),'field':'id','foreignKey':_0xe539('0x1e')}];break;case _0xe539('0x1f'):_0x11bdfe[_0xe539('0x15')]='CmList';break;case'companies':_0x11bdfe[_0xe539('0x15')]=_0xe539('0x20');break;case _0xe539('0x21'):_0x11bdfe['childModel']=_0xe539('0x22');break;case'chatqueues':_0x11bdfe[_0xe539('0x15')]=_0xe539('0x23');break;case'chatwebsites':_0x11bdfe[_0xe539('0x15')]='ChatWebsite';break;case _0xe539('0x24'):_0x11bdfe['childModel']=_0xe539('0x25');break;case _0xe539('0x26'):_0x11bdfe[_0xe539('0x15')]='FaxAccount';break;case _0xe539('0x27'):case'internalroutes':case _0xe539('0x28'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x29');break;case _0xe539('0x2a'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x2b');break;case _0xe539('0x2c'):_0x11bdfe[_0xe539('0x15')]='VoiceMail';break;case _0xe539('0x2d'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x2e');_0x11bdfe[_0xe539('0x19')]=[{'name':_0xe539('0x2f'),'field':'name','foreignKey':'membername','model':_0xe539('0x30'),'filter':{'field':_0xe539('0x31'),'value':[_0xe539('0x32')]}},{'name':_0xe539('0x33'),'field':'name','foreignKey':_0xe539('0x34'),'model':'User','filter':{'field':_0xe539('0x31'),'value':[_0xe539('0x35')]}},{'name':_0xe539('0x36'),'field':_0xe539('0xb'),'foreignKey':_0xe539('0x37'),'model':'VoiceQueue','filter':{'field':_0xe539('0x10'),'value':[_0xe539('0x38')]}},{'name':'QueueCampaigns','field':_0xe539('0xb'),'foreignKey':_0xe539('0x37'),'model':_0xe539('0x39'),'filter':{'field':'type','value':['outbound']}}];break;case _0xe539('0x3a'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x3b');break;case _0xe539('0x3c'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x3d');break;case _0xe539('0x3e'):_0x11bdfe['childModel']='VoicePrefix';break;case _0xe539('0x3f'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x40');break;case _0xe539('0x41'):_0x11bdfe['childModel']=_0xe539('0x42');break;case _0xe539('0x43'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x44');break;case _0xe539('0x45'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x46');break;case _0xe539('0x47'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x48');break;case _0xe539('0x49'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x4a');break;case _0xe539('0x4b'):_0x11bdfe[_0xe539('0x15')]='SmsQueue';break;case'smsaccounts':_0x11bdfe[_0xe539('0x15')]=_0xe539('0x4c');break;case _0xe539('0x4d'):_0x11bdfe[_0xe539('0x15')]='WhatsappQueue';break;case _0xe539('0x4e'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x4f');break;case'teams':_0x11bdfe[_0xe539('0x15')]=_0xe539('0x50');break;case _0xe539('0x51'):case _0xe539('0x52'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x39');if(_0x502085){_0x11bdfe[_0xe539('0x19')]=[{'name':_0xe539('0x36')},{'name':_0xe539('0x53')}];}break;case'users':case _0xe539('0x54'):case _0xe539('0x55'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x30');if(_0x502085){_0x11bdfe[_0xe539('0x19')]=[{'name':_0xe539('0x56'),'filter':{'field':'role','value':[_0xe539('0x57'),_0xe539('0x58')]},'ignore':!![]},{'name':_0xe539('0x2f')},{'name':_0xe539('0x33')}];}break;case _0xe539('0x59'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x5a');break;case _0xe539('0x5b'):_0x11bdfe['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0x11bdfe[_0xe539('0x15')]=_0xe539('0x5c');break;case _0xe539('0x5d'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x5e');break;case'deskaccounts':_0x11bdfe[_0xe539('0x15')]=_0xe539('0x5f');break;case _0xe539('0x60'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x61');break;case _0xe539('0x62'):_0x11bdfe[_0xe539('0x15')]='User';break;case _0xe539('0x63'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x64');break;case'dispositions':_0x11bdfe['childModel']=_0xe539('0x65');break;case _0xe539('0x66'):_0x11bdfe[_0xe539('0x15')]='Dashboard';break;case _0xe539('0x67'):_0x11bdfe['childModel']=_0xe539('0x68');break;case _0xe539('0x69'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x6a');break;case'scheduler':_0x11bdfe[_0xe539('0x15')]='Schedule';break;case _0xe539('0x6b'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x6c');break;case _0xe539('0x6d'):_0x11bdfe['childModel']=_0xe539('0x6e');break;case'templates':_0x11bdfe[_0xe539('0x15')]=_0xe539('0x6f');break;case _0xe539('0x70'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x71');break;case _0xe539('0x72'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x73');break;case _0xe539('0x74'):_0x11bdfe['childModel']=_0xe539('0x75');break;case _0xe539('0x76'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x77');break;case _0xe539('0x78'):_0x11bdfe[_0xe539('0x15')]='AnalyticExtractedReport';_0x11bdfe[_0xe539('0x19')]=[{'name':_0xe539('0x79'),'field':'id','foreignKey':_0xe539('0x7a')}];break;case _0xe539('0x7b'):_0x11bdfe[_0xe539('0x15')]=_0xe539('0x7c');break;}return _0x11bdfe;}function _0x376236(_0x9e2333,_0x14b344){var _0xb3cfe7=_0x9e2333[_0xe539('0x7d')](0x0)[_0xe539('0x7e')]()+_0x9e2333[_0xe539('0x7f')](0x1);var _0x18b02d={'type':_0x459d65[_0xe539('0x80')]['QueryTypes'][_0xe539('0x81')],'raw':!![]};return new Promise(function(_0x4223f7,_0x2d5815){var _0x4b4ae0=squel[_0xe539('0x82')]()[_0xe539('0x9')](_0xe539('0x83')+_0xb3cfe7+'InteractionId','id')[_0xe539('0x9')](_0xe539('0x84'))[_0xe539('0x85')](_0xe539('0x86')+_0x9e2333+_0xe539('0x87'),'ui')['where'](_0xe539('0x88'),_0x14b344['id']);return _0x459d65[_0xe539('0x89')]['query'](_0x4b4ae0['toString'](),_0x18b02d)[_0xe539('0x5')](function(_0x3e3682){_0x14b344[_0xb3cfe7+_0xe539('0x8a')]=_0x3e3682;_0x4223f7(_0x3e3682);})[_0xe539('0x8')](function(_0x42a0de){_0x2d5815(_0x42a0de);});});}return _0x13e3d4['define'](_0xe539('0x8b'),attributes,{'tableName':_0xe539('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1ee05b){var _0x1c8cc8=require(_0xe539('0x8d'));var _0x293083={'raw':_0x1ee05b['query'][_0xe539('0x8e')],'where':{}};var _0x5d4df4={};var _0x2bb712={'count':0x0,'rows':[]};var _0x2654cf=_0x1ee05b[_0xe539('0x8f')]['section'];var _0x227fee=_0x1ee05b[_0xe539('0x8f')][_0xe539('0x90')]||![];var _0x26e269=_0x1b3a8b(_0x2654cf,_0x227fee);if(!_0x26e269[_0xe539('0x15')])throw new Error(_0xe539('0x91')+_0x2654cf+'\x27');var _0x4b5a7c=[{'name':_0x2654cf}];if(!_[_0xe539('0x92')](_0x26e269[_0xe539('0x19')]))_0x4b5a7c=_0x26e269[_0xe539('0x19')];var _0x5d2526=[];for(var _0x1970b9=0x0;_0x1970b9<_0x4b5a7c[_0xe539('0x93')];_0x1970b9++){_0x5d2526[_0xe539('0x94')](_0x459d65[_0xe539('0x95')]['find']({'where':{'userProfileId':_0x1ee05b[_0xe539('0x96')]['id'],'name':_0x4b5a7c[_0x1970b9]['name']},'raw':!![]}));}return Promise[_0xe539('0x97')](_0x5d2526)['then'](function(_0x1c09ad){var _0x126382=_[_0xe539('0x2')](_0x1c09ad,function(_0x5c818b){return _0x5c818b?_0x5c818b:undefined;});var _0x5c33fa=_[_0xe539('0x2')](_0x4b5a7c,[_0xe539('0x98'),!![]]);var _0x229a60=_['isEmpty'](_0x126382)&&_[_0xe539('0x92')](_0x5c33fa)?null:_[_0xe539('0x99')](_0x5c33fa,_0x126382);if(!_0x229a60)return null;var _0x23493a=[];for(var _0x227090=0x0;_0x227090<_0x229a60['length'];_0x227090++){var _0x13b3e5=_[_0xe539('0x9a')](_0x4b5a7c,function(_0x28155b){return _0x229a60[_0x227090]?_0x28155b[_0xe539('0xb')]===_0x229a60[_0x227090][_0xe539('0xb')]:null;});if(_0x13b3e5){if(_0x229a60[_0x227090]['ignore']){_0x23493a[_0xe539('0x94')](_0x3d4e88(_0x26e269[_0xe539('0x15')],_0x229a60[_0x227090]));}else{if(!_0x229a60[_0x227090]['autoAssociation']){_0x23493a[_0xe539('0x94')](_0x3b4e32(_0x13b3e5,_0x229a60[_0x227090],_0x26e269[_0xe539('0x15')]));}else{if(_0x13b3e5[_0xe539('0xa')]){_0x23493a['push'](_0x3b1d50(_0x13b3e5,_0x229a60[_0x227090]));}}}}}return Promise[_0xe539('0x97')](_0x23493a);})[_0xe539('0x5')](function(_0x217af5){var _0x2649e3=_0x217af5;var _0x45c499=null;if(_0x2649e3){_0x45c499=_0x2649e3[_0xe539('0x93')]===0x1?_0x2649e3[0x0]:null;}if(!_0x45c499&&!_0x2649e3)return _0x2bb712;var _0x22ca8d=_0x459d65[_0x26e269[_0xe539('0x15')]]['rawAttributes'];_0x5d4df4[_0xe539('0xa')]=_[_0xe539('0x9b')](_0x22ca8d);_0x5d4df4['query']=_[_0xe539('0x9b')](_0x1ee05b[_0xe539('0x8f')]);_0x5d4df4['filters']=_[_0xe539('0x9c')](_0x5d4df4[_0xe539('0xa')],_0x5d4df4[_0xe539('0x8f')]);_0x293083[_0xe539('0x9d')]=_['intersection'](_0x5d4df4[_0xe539('0xa')],_0x1c8cc8[_0xe539('0x9e')](_0x1ee05b[_0xe539('0x8f')]['fields']));_0x293083[_0xe539('0x9d')]=_0x293083['attributes'][_0xe539('0x93')]?_0x293083[_0xe539('0x9d')]:_0x5d4df4[_0xe539('0xa')];if(!_0x1ee05b['query'][_0xe539('0x9f')](_0xe539('0xa0'))){_0x293083['limit']=_0x1c8cc8[_0xe539('0xa1')](_0x1ee05b[_0xe539('0x8f')][_0xe539('0xa1')]);_0x293083[_0xe539('0xa2')]=_0x1c8cc8[_0xe539('0xa2')](_0x1ee05b['query'][_0xe539('0xa2')]);}_0x293083['order']=_0x1c8cc8[_0xe539('0xa3')](_0x1ee05b[_0xe539('0x8f')][_0xe539('0xa3')]);_0x293083['where']=_0x1c8cc8[_0xe539('0xa4')](_['pick'](_0x1ee05b['query'],_0x5d4df4[_0xe539('0xa4')]));if(_0x1ee05b[_0xe539('0x8f')]['filter']){_0x293083[_0xe539('0xa5')]=_[_0xe539('0xa6')](_0x293083[_0xe539('0xa5')],{'$or':_[_0xe539('0x7')](_0x22ca8d,function(_0x589247){if(_0x589247[_0xe539('0x10')][_0xe539('0xa7')]!==_0xe539('0xa8')){var _0x3c50aa={};_0x3c50aa[_0x589247['field']]={'$like':'%'+_0x1ee05b[_0xe539('0x8f')][_0xe539('0x2')]+'%'};return _0x3c50aa;}})});}var _0x1d8f07=[];var _0x1f68b3=null;var _0x3f23bb={};if(_0x45c499){_0x1f68b3=_[_0xe539('0x9a')](_0x4b5a7c,[_0xe539('0xb'),_0x45c499[_0xe539('0xb')]]);if(_0x1f68b3[_0xe539('0x9')]){_0x3f23bb={};if(_0x26e269[_0xe539('0x15')]==='AnalyticExtractedReport'){_0x3f23bb[_0x1f68b3[_0xe539('0xa9')]]=_[_0xe539('0x7')](_0x45c499[_0xe539('0x6')],'id');}else{_0x3f23bb[_0x1f68b3['foreignKey']]=_0x45c499[_0xe539('0x6')];}_0x1d8f07[_0xe539('0x94')](_0x3f23bb);}else{_0x293083[_0xe539('0xa5')]['id']=_0x45c499[_0xe539('0x6')];}}else{for(var _0x5d8399=0x0;_0x5d8399<_0x2649e3[_0xe539('0x93')];_0x5d8399++){_0x1f68b3=_[_0xe539('0x9a')](_0x4b5a7c,[_0xe539('0xb'),_0x2649e3[_0x5d8399][_0xe539('0xb')]]);if(_0x1f68b3[_0xe539('0x9')]){_0x3f23bb={};_0x3f23bb[_0x1f68b3[_0xe539('0xa9')]]=_0x2649e3[_0x5d8399]['associatedResources'];_0x1d8f07[_0xe539('0x94')](_0x3f23bb);}else{if(!_0x293083['where']['id'])_0x293083[_0xe539('0xa5')]['id']=[];_0x2649e3[_0x5d8399][_0xe539('0x6')][_0xe539('0xaa')](function(_0x4301e3){_0x293083[_0xe539('0xa5')]['id'][_0xe539('0x94')](_0x4301e3);});}}}if(!_[_0xe539('0x92')](_0x1d8f07)){_0x293083[_0xe539('0xa5')]=_[_0xe539('0xa6')](_0x293083[_0xe539('0xa5')],{'$and':{'$or':_0x1d8f07}});}_0x293083=_['merge']({},_0x293083,_0x1ee05b[_0xe539('0xab')]);if(_0x45c499&&!_0x45c499[_0xe539('0xac')]&&_0x26e269[_0xe539('0x15')]===_0xe539('0xe')){if(_0x1ee05b['query'][_0xe539('0xad')]){_0x293083[_0xe539('0xae')]=[{'all':!![]}];}return _0x459d65[_0x26e269[_0xe539('0x15')]]['findAll'](_0x293083)['then'](function(_0x1da510){var _0x21666a=[];_0x1da510[_0xe539('0xaa')](function(_0x13a9ad){var _0x110f69;switch(_0x13a9ad[_0xe539('0xaf')]){case _0xe539('0xb0'):_0x110f69=_[_0xe539('0x9a')](_0x45c499[_0xe539('0x6')],function(_0x38ac1e){return _0x38ac1e['id']===_0x13a9ad['reportId']&&_0x38ac1e['type']===_0xe539('0xb1');});break;case _0xe539('0xb2'):_0x110f69=_[_0xe539('0x9a')](_0x45c499[_0xe539('0x6')],function(_0x56aa10){return _0x56aa10['id']===_0x13a9ad[_0xe539('0x7a')]&&_0x56aa10[_0xe539('0x10')]==='CustomReports';});break;}if(_0x110f69)_0x21666a[_0xe539('0x94')](_0x13a9ad);});_0x2bb712[_0xe539('0xb3')]=_0x21666a['length'];_0x2bb712[_0xe539('0xb4')]=_0x21666a;return _0x2bb712;});}else{if(!_['isEmpty'](_0x1ee05b[_0xe539('0x8f')][_0xe539('0xb5')])){_0x293083[_0xe539('0xa5')]['id']=_0x293083['where']['id']?_[_0xe539('0x9c')](_0x293083[_0xe539('0xa5')]['id'],_0x1ee05b[_0xe539('0x8f')][_0xe539('0xb5')]):_0x1ee05b[_0xe539('0x8f')][_0xe539('0xb5')];if(_0x1ee05b[_0xe539('0x8f')][_0xe539('0xb6')]){_0x293083[_0xe539('0xb7')]=_0x1ee05b[_0xe539('0x8f')][_0xe539('0xb6')];}}if(_0x1ee05b['query']['extraQueryConditions']){_0x293083[_0xe539('0xa5')]=_[_0xe539('0xa6')](_0x293083[_0xe539('0xa5')],{'$and':_0x1ee05b[_0xe539('0x8f')][_0xe539('0xb8')]});}return _0x459d65[_0x26e269[_0xe539('0x15')]][_0xe539('0xb3')]({'where':_0x293083[_0xe539('0xa5')]})[_0xe539('0x5')](function(_0x51b691){_0x2bb712['count']=_0x51b691;if(_0x1ee05b[_0xe539('0x8f')][_0xe539('0xad')]){if(_0x26e269['childModel']===_0xe539('0xb9')){_0x293083['include']=[{'model':_0x459d65[_0xe539('0x6e')],'as':_0xe539('0xba'),'attributes':['id','name',_0xe539('0xbb')],'required':_0x1ee05b[_0xe539('0x8f')]['tag']?!![]:![]},{'model':_0x459d65['Tag'],'as':_0xe539('0xbc'),'attributes':['id',_0xe539('0xb'),_0xe539('0xbb')],'through':_0x1ee05b[_0xe539('0x8f')][_0xe539('0xbd')]?{'attributes':[],'where':{'TagId':_0x1ee05b['query']['tag']||undefined}}:{},'required':_0x1ee05b[_0xe539('0x8f')]['tag']?!![]:![]}];}else{_0x293083[_0xe539('0xae')]=[{'all':!![]}];}}return _0x459d65[_0x26e269[_0xe539('0x15')]][_0xe539('0x4')](_0x293083);})[_0xe539('0x5')](function(_0x12f680){_0x2bb712[_0xe539('0xb4')]=_0x12f680;if(_0x2654cf==='Agents'&&_0x1ee05b[_0xe539('0x8f')][_0xe539('0xbe')]===_0xe539('0xbf')){var _0x2c31d6=[];for(var _0x3380cf=0x0;_0x3380cf<_0x2bb712[_0xe539('0xb4')][_0xe539('0x93')];_0x3380cf++){_0x2c31d6[_0xe539('0x94')](_0x376236(_0xe539('0xc0'),_0x2bb712['rows'][_0x3380cf][_0xe539('0xc1')]));_0x2c31d6[_0xe539('0x94')](_0x376236(_0xe539('0xc2'),_0x2bb712['rows'][_0x3380cf][_0xe539('0xc1')]));_0x2c31d6[_0xe539('0x94')](_0x376236(_0xe539('0xc3'),_0x2bb712['rows'][_0x3380cf][_0xe539('0xc1')]));_0x2c31d6['push'](_0x376236(_0xe539('0xc4'),_0x2bb712[_0xe539('0xb4')][_0x3380cf][_0xe539('0xc1')]));_0x2c31d6[_0xe539('0x94')](_0x376236(_0xe539('0xc5'),_0x2bb712[_0xe539('0xb4')][_0x3380cf][_0xe539('0xc1')]));_0x2c31d6[_0xe539('0x94')](_0x376236(_0xe539('0xc6'),_0x2bb712[_0xe539('0xb4')][_0x3380cf][_0xe539('0xc1')]));}return Promise['all'](_0x2c31d6)[_0xe539('0x5')](function(){return _0x2bb712;});}return _0x2bb712;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index de29e73..a5b6727 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 _0x6691=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x6691,0x12d));var _0x1669=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6691[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var moment=require(_0x1669('0x2'));var BPromise=require(_0x1669('0x3'));var rs=require(_0x1669('0x4'));var fs=require('fs');var Redis=require(_0x1669('0x5'));var db=require(_0x1669('0x6'))['db'];var utils=require(_0x1669('0x7'));var logger=require(_0x1669('0x8'))(_0x1669('0x9'));var config=require('../../config/environment');var jayson=require(_0x1669('0xa'));var client=jayson[_0x1669('0xb')][_0x1669('0xc')]({'port':0x232a});config[_0x1669('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1669('0xe'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x56e0ee,_0x52b44f,_0x408538){return new BPromise(function(_0x93d633,_0xdf793d){return client[_0x1669('0xf')](_0x56e0ee,_0x408538)[_0x1669('0x10')](function(_0x3d6f5e){logger[_0x1669('0x11')](_0x1669('0x12'),_0x52b44f,_0x1669('0x13'));logger[_0x1669('0x14')](_0x1669('0x15'),_0x52b44f,_0x1669('0x13'),JSON[_0x1669('0x16')](_0x3d6f5e));if(_0x3d6f5e[_0x1669('0x17')]){if(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x18')]===0x1f4){logger[_0x1669('0x17')](_0x1669('0x12'),_0x52b44f,_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);return _0xdf793d(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);}logger[_0x1669('0x17')]('UserProfile,\x20%s,\x20%s',_0x52b44f,_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);return _0x93d633(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);}else{logger[_0x1669('0x11')]('UserProfile,\x20%s,\x20%s',_0x52b44f,'request\x20sent');_0x93d633(_0x3d6f5e[_0x1669('0x1a')][_0x1669('0x19')]);}})[_0x1669('0x1b')](function(_0x4fcf1c){logger[_0x1669('0x17')](_0x1669('0x12'),_0x52b44f,_0x4fcf1c);_0xdf793d(_0x4fcf1c);});});} \ No newline at end of file +var _0xa498=['result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4fa52e,_0x2dca12){var _0x128ee4=function(_0x5a0f9d){while(--_0x5a0f9d){_0x4fa52e['push'](_0x4fa52e['shift']());}};_0x128ee4(++_0x2dca12);}(_0xa498,0x1d6));var _0x8a49=function(_0x33670a,_0x55e188){_0x33670a=_0x33670a-0x0;var _0x36ad1d=_0xa498[_0x33670a];return _0x36ad1d;};'use strict';var _=require('lodash');var util=require(_0x8a49('0x0'));var moment=require(_0x8a49('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a49('0x2'));var db=require(_0x8a49('0x3'))['db'];var utils=require(_0x8a49('0x4'));var logger=require(_0x8a49('0x5'))(_0x8a49('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a49('0x7'));var client=jayson['client'][_0x8a49('0x8')]({'port':0x232a});config[_0x8a49('0x9')]=_[_0x8a49('0xa')](config['redis'],{'host':_0x8a49('0xb'),'port':0x18eb});var socket=require(_0x8a49('0xc'))(new Redis(config[_0x8a49('0x9')]));require(_0x8a49('0xd'))[_0x8a49('0xe')](socket);function respondWithRpcPromise(_0x688ffa,_0x595d79,_0x15e5b4){return new BPromise(function(_0x24bb85,_0x41674b){return client[_0x8a49('0xf')](_0x688ffa,_0x15e5b4)[_0x8a49('0x10')](function(_0x35f2b0){logger[_0x8a49('0x11')](_0x8a49('0x12'),_0x595d79,_0x8a49('0x13'));logger['debug'](_0x8a49('0x14'),_0x595d79,_0x8a49('0x13'),JSON[_0x8a49('0x15')](_0x35f2b0));if(_0x35f2b0['error']){if(_0x35f2b0[_0x8a49('0x16')]['code']===0x1f4){logger[_0x8a49('0x16')](_0x8a49('0x12'),_0x595d79,_0x35f2b0['error'][_0x8a49('0x17')]);return _0x41674b(_0x35f2b0[_0x8a49('0x16')][_0x8a49('0x17')]);}logger[_0x8a49('0x16')]('UserProfile,\x20%s,\x20%s',_0x595d79,_0x35f2b0['error'][_0x8a49('0x17')]);return _0x24bb85(_0x35f2b0[_0x8a49('0x16')][_0x8a49('0x17')]);}else{logger[_0x8a49('0x11')]('UserProfile,\x20%s,\x20%s',_0x595d79,_0x8a49('0x13'));_0x24bb85(_0x35f2b0[_0x8a49('0x18')][_0x8a49('0x17')]);}})[_0x8a49('0x19')](function(_0x441ab1){logger['error']('UserProfile,\x20%s,\x20%s',_0x595d79,_0x441ab1);_0x41674b(_0x441ab1);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6b839ce..7ea2482 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 _0x6c93=['update','emit','removeListener','length','userProfile:','save','remove'];(function(_0x356571,_0x6679fb){var _0x4de016=function(_0x527b64){while(--_0x527b64){_0x356571['push'](_0x356571['shift']());}};_0x4de016(++_0x6679fb);}(_0x6c93,0x1be));var _0x36c9=function(_0x2096b2,_0x53c8bd){_0x2096b2=_0x2096b2-0x0;var _0x540b16=_0x6c93[_0x2096b2];return _0x540b16;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x36c9('0x0'),_0x36c9('0x1'),_0x36c9('0x2')];function createListener(_0x27b0f6,_0x296922){return function(_0xfd6801){_0x296922[_0x36c9('0x3')](_0x27b0f6,_0xfd6801);};}function removeListener(_0xeee836,_0x37ba7c){return function(){UserProfileEvents[_0x36c9('0x4')](_0xeee836,_0x37ba7c);};}exports['register']=function(_0x487d8a){for(var _0x36fabb=0x0,_0x3ea4bd=events[_0x36c9('0x5')];_0x36fabb<_0x3ea4bd;_0x36fabb++){var _0x48a7bb=events[_0x36fabb];var _0x3c09e3=createListener(_0x36c9('0x6')+_0x48a7bb,_0x487d8a);UserProfileEvents['on'](_0x48a7bb,_0x3c09e3);}}; \ No newline at end of file +var _0x4091=['register','length','userProfile:','save','update','emit'];(function(_0x3f36ed,_0x32f6dc){var _0x38e38e=function(_0x1814f8){while(--_0x1814f8){_0x3f36ed['push'](_0x3f36ed['shift']());}};_0x38e38e(++_0x32f6dc);}(_0x4091,0x81));var _0x1409=function(_0x3ae06b,_0x9f7d1f){_0x3ae06b=_0x3ae06b-0x0;var _0x440a6c=_0x4091[_0x3ae06b];return _0x440a6c;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x1409('0x0'),'remove',_0x1409('0x1')];function createListener(_0x1cdbfc,_0x5b366b){return function(_0x15bc6f){_0x5b366b[_0x1409('0x2')](_0x1cdbfc,_0x15bc6f);};}function removeListener(_0x28255f,_0x35718d){return function(){UserProfileEvents['removeListener'](_0x28255f,_0x35718d);};}exports[_0x1409('0x3')]=function(_0x315e25){for(var _0x2af724=0x0,_0x5e8433=events[_0x1409('0x4')];_0x2af724<_0x5e8433;_0x2af724++){var _0x50986d=events[_0x2af724];var _0x46e158=createListener(_0x1409('0x5')+_0x50986d,_0x315e25);UserProfileEvents['on'](_0x50986d,_0x46e158);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c2c802b..f62bf32 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 _0xb1b6=['/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x365342,_0x422f85){var _0x8519d7=function(_0x25e14b){while(--_0x25e14b){_0x365342['push'](_0x365342['shift']());}};_0x8519d7(++_0x422f85);}(_0xb1b6,0x1c0));var _0x6b1b=function(_0xc9dde2,_0x64c991){_0xc9dde2=_0xc9dde2-0x0;var _0x2cfe65=_0xb1b6[_0xc9dde2];return _0x2cfe65;};'use strict';var multer=require(_0x6b1b('0x0'));var util=require(_0x6b1b('0x1'));var path=require('path');var timeout=require(_0x6b1b('0x2'));var express=require(_0x6b1b('0x3'));var router=express[_0x6b1b('0x4')]();var fs_extra=require(_0x6b1b('0x5'));var auth=require(_0x6b1b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b1b('0x7'));var controller=require(_0x6b1b('0x8'));router[_0x6b1b('0x9')]('/',auth['isAuthenticated'](),controller[_0x6b1b('0xa')]);router[_0x6b1b('0x9')](_0x6b1b('0xb'),auth[_0x6b1b('0xc')](),controller[_0x6b1b('0xd')]);router[_0x6b1b('0x9')](_0x6b1b('0xe'),auth['isAuthenticated'](),controller[_0x6b1b('0xf')]);router[_0x6b1b('0x10')]('/',auth[_0x6b1b('0xc')](),controller[_0x6b1b('0x11')]);router['put']('/:id',auth[_0x6b1b('0xc')](),controller[_0x6b1b('0x12')]);router[_0x6b1b('0x13')]('/:id',auth[_0x6b1b('0xc')](),controller[_0x6b1b('0x14')]);module[_0x6b1b('0x15')]=router; \ No newline at end of file +var _0x87a5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x18a7c6,_0x4bf5ed){var _0x316139=function(_0x481b75){while(--_0x481b75){_0x18a7c6['push'](_0x18a7c6['shift']());}};_0x316139(++_0x4bf5ed);}(_0x87a5,0x19d));var _0x587a=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x87a5[_0x1e3671];return _0x48d5f5;};'use strict';var multer=require(_0x587a('0x0'));var util=require(_0x587a('0x1'));var path=require('path');var timeout=require(_0x587a('0x2'));var express=require(_0x587a('0x3'));var router=express[_0x587a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x587a('0x5'));var interaction=require(_0x587a('0x6'));var config=require(_0x587a('0x7'));var controller=require(_0x587a('0x8'));router[_0x587a('0x9')]('/',auth[_0x587a('0xa')](),controller[_0x587a('0xb')]);router['get'](_0x587a('0xc'),auth[_0x587a('0xa')](),controller[_0x587a('0xd')]);router[_0x587a('0x9')](_0x587a('0xe'),auth[_0x587a('0xa')](),controller[_0x587a('0xf')]);router[_0x587a('0x10')]('/',auth[_0x587a('0xa')](),controller[_0x587a('0x11')]);router[_0x587a('0x12')]('/:id',auth[_0x587a('0xa')](),controller[_0x587a('0x13')]);router['delete']('/:id',auth[_0x587a('0xa')](),controller[_0x587a('0x14')]);module[_0x587a('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e0980ed..d824e8d 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 _0x1111=['sequelize','exports','STRING'];(function(_0x3d01a7,_0x48890f){var _0x20fd1f=function(_0x500e0b){while(--_0x500e0b){_0x3d01a7['push'](_0x3d01a7['shift']());}};_0x20fd1f(++_0x48890f);}(_0x1111,0x1c5));var _0x1111=function(_0x1f9bd4,_0x24363c){_0x1f9bd4=_0x1f9bd4-0x0;var _0x50a9e5=_0x1111[_0x1f9bd4];return _0x50a9e5;};'use strict';var Sequelize=require(_0x1111('0x0'));module[_0x1111('0x1')]={'name':{'type':Sequelize[_0x1111('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x1111('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x51aa=['exports','STRING','INTEGER','sequelize'];(function(_0x3aa779,_0x4a18c5){var _0x2fd150=function(_0x239bb1){while(--_0x239bb1){_0x3aa779['push'](_0x3aa779['shift']());}};_0x2fd150(++_0x4a18c5);}(_0x51aa,0x9f));var _0xa51a=function(_0xc608c8,_0x20d97c){_0xc608c8=_0xc608c8-0x0;var _0x5b3266=_0x51aa[_0xc608c8];return _0x5b3266;};'use strict';var Sequelize=require(_0xa51a('0x0'));module[_0xa51a('0x1')]={'name':{'type':Sequelize[_0xa51a('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa51a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa51a('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 77cdf2a..da4a286 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 _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0xacf4,0xe7));var _0x4acf=function(_0x4c79aa,_0x456fcd){_0x4c79aa=_0x4c79aa-0x0;var _0x28e73a=_0xacf4[_0x4c79aa];return _0x28e73a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['UserProfileResource'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['UserProfileResource']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file +var _0x1261=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','UserProfileResource','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1412d6,_0x3161bc){var _0x10cb32=function(_0x393871){while(--_0x393871){_0x1412d6['push'](_0x1412d6['shift']());}};_0x10cb32(++_0x3161bc);}(_0x1261,0x144));var _0x1126=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0x1261[_0x91d019];return _0x19de1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['UserProfileResource'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['UserProfileResource']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));};exports[_0x1126('0x45')]=function(_0x52a9a4,_0x3cb44c){return db[_0x1126('0x29')][_0x1126('0x45')]()[_0x1126('0x25')](respondWithResult(_0x3cb44c,null))['catch'](handleError(_0x3cb44c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 15791f4..b412c7a 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 _0x7ddf=['sectionId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7ddf,0x8d));var _0xf7dd=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7ddf[_0x5783f4];return _0x28e380;};'use strict';var _=require('lodash');var util=require(_0xf7dd('0x0'));var logger=require(_0xf7dd('0x1'))(_0xf7dd('0x2'));var moment=require(_0xf7dd('0x3'));var BPromise=require(_0xf7dd('0x4'));var rp=require(_0xf7dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7dd('0x6'));var config=require(_0xf7dd('0x7'));var attributes=require(_0xf7dd('0x8'));module[_0xf7dd('0x9')]=function(_0x180d32,_0x1f3674){return _0x180d32[_0xf7dd('0xa')]('UserProfileResource',attributes,{'tableName':_0xf7dd('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xf7dd('0xc'),_0xf7dd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba5a=['UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userProfileResource.attributes','exports','define'];(function(_0xdeab51,_0x5cb7ca){var _0x597a97=function(_0x53fe7e){while(--_0x53fe7e){_0xdeab51['push'](_0xdeab51['shift']());}};_0x597a97(++_0x5cb7ca);}(_0xba5a,0x17b));var _0xaba5=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xba5a[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0xaba5('0x0'));var util=require(_0xaba5('0x1'));var logger=require(_0xaba5('0x2'))(_0xaba5('0x3'));var moment=require(_0xaba5('0x4'));var BPromise=require(_0xaba5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaba5('0x6'));var rimraf=require('rimraf');var config=require(_0xaba5('0x7'));var attributes=require(_0xaba5('0x8'));module[_0xaba5('0x9')]=function(_0x1662c4,_0x3c7ca6){return _0x1662c4[_0xaba5('0xa')](_0xaba5('0xb'),attributes,{'tableName':_0xaba5('0xc'),'paranoid':![],'indexes':[{'name':_0xaba5('0xd'),'fields':[_0xaba5('0xe'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index bbc4622..6b3eeb1 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 _0x9afd=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x363473,_0x29eb80){var _0x135458=function(_0x4bf521){while(--_0x4bf521){_0x363473['push'](_0x363473['shift']());}};_0x135458(++_0x29eb80);}(_0x9afd,0xf9));var _0xd9af=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0x9afd[_0x274638];return _0x5755df;};'use strict';var _=require('lodash');var util=require(_0xd9af('0x0'));var moment=require(_0xd9af('0x1'));var BPromise=require(_0xd9af('0x2'));var rs=require(_0xd9af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9af('0x4'))['db'];var utils=require(_0xd9af('0x5'));var logger=require('../../config/logger')(_0xd9af('0x6'));var config=require(_0xd9af('0x7'));var jayson=require(_0xd9af('0x8'));var client=jayson['client'][_0xd9af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe00116,_0x323c46,_0x4f22bc){return new BPromise(function(_0x100a70,_0x1f1d8b){return client[_0xd9af('0xa')](_0xe00116,_0x4f22bc)[_0xd9af('0xb')](function(_0x123a64){logger[_0xd9af('0xc')](_0xd9af('0xd'),_0x323c46,_0xd9af('0xe'));logger['debug'](_0xd9af('0xf'),_0x323c46,_0xd9af('0xe'),JSON[_0xd9af('0x10')](_0x123a64));if(_0x123a64['error']){if(_0x123a64['error'][_0xd9af('0x11')]===0x1f4){logger['error'](_0xd9af('0xd'),_0x323c46,_0x123a64[_0xd9af('0x12')][_0xd9af('0x13')]);return _0x1f1d8b(_0x123a64[_0xd9af('0x12')][_0xd9af('0x13')]);}logger[_0xd9af('0x12')](_0xd9af('0xd'),_0x323c46,_0x123a64['error'][_0xd9af('0x13')]);return _0x100a70(_0x123a64['error'][_0xd9af('0x13')]);}else{logger['info'](_0xd9af('0xd'),_0x323c46,_0xd9af('0xe'));_0x100a70(_0x123a64[_0xd9af('0x14')]['message']);}})[_0xd9af('0x15')](function(_0x409a69){logger[_0xd9af('0x12')](_0xd9af('0xd'),_0x323c46,_0x409a69);_0x1f1d8b(_0x409a69);});});} \ No newline at end of file +var _0x709a=['UserProfileResource,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','stringify','error','code'];(function(_0x2b4a1b,_0x330f0d){var _0x94b62d=function(_0x41e625){while(--_0x41e625){_0x2b4a1b['push'](_0x2b4a1b['shift']());}};_0x94b62d(++_0x330f0d);}(_0x709a,0x1d0));var _0xa709=function(_0x19cfae,_0x5966ff){_0x19cfae=_0x19cfae-0x0;var _0x3d332d=_0x709a[_0x19cfae];return _0x3d332d;};'use strict';var _=require('lodash');var util=require(_0xa709('0x0'));var moment=require(_0xa709('0x1'));var BPromise=require(_0xa709('0x2'));var rs=require(_0xa709('0x3'));var fs=require('fs');var Redis=require(_0xa709('0x4'));var db=require(_0xa709('0x5'))['db'];var utils=require(_0xa709('0x6'));var logger=require(_0xa709('0x7'))(_0xa709('0x8'));var config=require('../../config/environment');var jayson=require(_0xa709('0x9'));var client=jayson[_0xa709('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x121cf7,_0x271c53,_0x2d4a76){return new BPromise(function(_0x126845,_0xeef823){return client['request'](_0x121cf7,_0x2d4a76)[_0xa709('0xb')](function(_0x27a0d5){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x271c53,_0xa709('0xc'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x271c53,_0xa709('0xc'),JSON[_0xa709('0xd')](_0x27a0d5));if(_0x27a0d5[_0xa709('0xe')]){if(_0x27a0d5['error'][_0xa709('0xf')]===0x1f4){logger['error'](_0xa709('0x10'),_0x271c53,_0x27a0d5['error'][_0xa709('0x11')]);return _0xeef823(_0x27a0d5[_0xa709('0xe')][_0xa709('0x11')]);}logger[_0xa709('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x271c53,_0x27a0d5[_0xa709('0xe')]['message']);return _0x126845(_0x27a0d5[_0xa709('0xe')][_0xa709('0x11')]);}else{logger['info'](_0xa709('0x10'),_0x271c53,_0xa709('0xc'));_0x126845(_0x27a0d5[_0xa709('0x12')][_0xa709('0x11')]);}})[_0xa709('0x13')](function(_0x54657b){logger[_0xa709('0xe')](_0xa709('0x10'),_0x271c53,_0x54657b);_0xeef823(_0x54657b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index f4d0d4e..4be26e1 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 _0xe248=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','multer','connect-timeout','express'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0xe248,0x18c));var _0x8e24=function(_0x325052,_0x54d125){_0x325052=_0x325052-0x0;var _0x1add5b=_0xe248[_0x325052];return _0x1add5b;};'use strict';var multer=require(_0x8e24('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8e24('0x1'));var express=require(_0x8e24('0x2'));var router=express[_0x8e24('0x3')]();var fs_extra=require(_0x8e24('0x4'));var auth=require(_0x8e24('0x5'));var interaction=require(_0x8e24('0x6'));var config=require('../../config/environment');var controller=require(_0x8e24('0x7'));router[_0x8e24('0x8')]('/',auth[_0x8e24('0x9')](),controller[_0x8e24('0xa')]);router[_0x8e24('0x8')]('/describe',auth[_0x8e24('0x9')](),controller[_0x8e24('0xb')]);router[_0x8e24('0x8')](_0x8e24('0xc'),auth[_0x8e24('0x9')](),controller[_0x8e24('0xd')]);router['post']('/',auth[_0x8e24('0x9')](),controller[_0x8e24('0xe')]);router[_0x8e24('0xf')]('/:id',auth[_0x8e24('0x9')](),controller[_0x8e24('0x10')]);router[_0x8e24('0x11')](_0x8e24('0xc'),auth[_0x8e24('0x9')](),controller[_0x8e24('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb068=['../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x45c957,_0x1762a2){var _0x455a3b=function(_0x56a531){while(--_0x56a531){_0x45c957['push'](_0x45c957['shift']());}};_0x455a3b(++_0x1762a2);}(_0xb068,0x1b4));var _0x8b06=function(_0x3d016e,_0x1c199c){_0x3d016e=_0x3d016e-0x0;var _0x47734d=_0xb068[_0x3d016e];return _0x47734d;};'use strict';var multer=require(_0x8b06('0x0'));var util=require(_0x8b06('0x1'));var path=require(_0x8b06('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b06('0x3'));var router=express['Router']();var fs_extra=require(_0x8b06('0x4'));var auth=require(_0x8b06('0x5'));var interaction=require(_0x8b06('0x6'));var config=require('../../config/environment');var controller=require(_0x8b06('0x7'));router[_0x8b06('0x8')]('/',auth[_0x8b06('0x9')](),controller['index']);router[_0x8b06('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8b06('0xa')]);router[_0x8b06('0x8')](_0x8b06('0xb'),auth[_0x8b06('0x9')](),controller[_0x8b06('0xc')]);router['post']('/',auth[_0x8b06('0x9')](),controller['create']);router[_0x8b06('0xd')](_0x8b06('0xb'),auth[_0x8b06('0x9')](),controller[_0x8b06('0xe')]);router[_0x8b06('0xf')](_0x8b06('0xb'),auth[_0x8b06('0x9')](),controller['destroy']);module[_0x8b06('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 4132253..3e4b52e 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 _0x9c00=['STRING','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0x9c00[_0x7880d2];return _0x35ebbe;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x09c0('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x09c0('0x4')],'set':function(_0x2c702c){this[_0x09c0('0x5')](_0x09c0('0x6'),_0x2c702c?_0x2c702c[_0x09c0('0x7')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x09c0('0x8')](_0x09c0('0x6'))[_0x09c0('0x9')](''):[];}}}; \ No newline at end of file +var _0xb574=['BOOLEAN','setDataValue','crudPermissions','sequelize','exports','STRING','INTEGER'];(function(_0x16286c,_0x1d02e3){var _0x770fcb=function(_0x39419d){while(--_0x39419d){_0x16286c['push'](_0x16286c['shift']());}};_0x770fcb(++_0x1d02e3);}(_0xb574,0x106));var _0x4b57=function(_0xbc35a8,_0xb6f658){_0xbc35a8=_0xbc35a8-0x0;var _0x29edef=_0xb574[_0xbc35a8];return _0x29edef;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4b57('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4b57('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4b57('0x2')],'set':function(_0x168524){this[_0x4b57('0x5')](_0x4b57('0x6'),_0x168524?_0x168524['join'](''):[]);},'get':function(){return this['getDataValue'](_0x4b57('0x6'))?this['getDataValue']('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 89bb02e..6f29fc4 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 _0xb5ee=['Content-Range','json','save','update','then','destroy','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','params','include','options','create','body','find','describe','eml-format','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5ee,0x199));var _0xeb5e=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0xb5ee[_0x3dc538];return _0x72c2fd;};'use strict';var emlformat=require(_0xeb5e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb5e('0x1'));var BPromise=require(_0xeb5e('0x2'));var Mustache=require(_0xeb5e('0x3'));var util=require(_0xeb5e('0x4'));var path=require(_0xeb5e('0x5'));var sox=require(_0xeb5e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb5e('0x7'));var _=require(_0xeb5e('0x8'));var squel=require('squel');var crypto=require(_0xeb5e('0x9'));var jsforce=require(_0xeb5e('0xa'));var deskjs=require(_0xeb5e('0xb'));var toCsv=require(_0xeb5e('0xc'));var querystring=require(_0xeb5e('0xd'));var Papa=require('papaparse');var Redis=require(_0xeb5e('0xe'));var authService=require(_0xeb5e('0xf'));var qs=require(_0xeb5e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb5e('0x11'));var logger=require(_0xeb5e('0x12'))(_0xeb5e('0x13'));var utils=require(_0xeb5e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xeb5e('0x15'));var db=require(_0xeb5e('0x16'))['db'];function respondWithStatusCode(_0xb7cdb5,_0x321111){_0x321111=_0x321111||0xcc;return function(_0x46ca77){if(_0x46ca77){return _0xb7cdb5['sendStatus'](_0x321111);}return _0xb7cdb5['status'](_0x321111)[_0xeb5e('0x17')]();};}function respondWithResult(_0x43d348,_0x29c844){_0x29c844=_0x29c844||0xc8;return function(_0x1ccb58){if(_0x1ccb58){return _0x43d348['status'](_0x29c844)['json'](_0x1ccb58);}};}function respondWithFilteredResult(_0x502c03,_0x497364){return function(_0x5e9e1d){if(_0x5e9e1d){var _0x23f2f=typeof _0x497364[_0xeb5e('0x18')]===_0xeb5e('0x19')&&typeof _0x497364[_0xeb5e('0x1a')]==='undefined';var _0x5b3a82=_0x5e9e1d[_0xeb5e('0x1b')];var _0x117a2a=_0x23f2f?0x0:_0x497364[_0xeb5e('0x18')];var _0x4c7dc3=_0x23f2f?_0x5e9e1d['count']:_0x497364['offset']+_0x497364[_0xeb5e('0x1a')];var _0x548fdc;if(_0x4c7dc3>=_0x5b3a82){_0x4c7dc3=_0x5b3a82;_0x548fdc=0xc8;}else{_0x548fdc=0xce;}_0x502c03[_0xeb5e('0x1c')](_0x548fdc);return _0x502c03['set'](_0xeb5e('0x1d'),_0x117a2a+'-'+_0x4c7dc3+'/'+_0x5b3a82)[_0xeb5e('0x1e')](_0x5e9e1d);}return null;};}function patchUpdates(_0x53c1d6){return function(_0x2bb5f5){try{jsonpatch['apply'](_0x2bb5f5,_0x53c1d6,!![]);}catch(_0x1f0670){return BPromise['reject'](_0x1f0670);}return _0x2bb5f5[_0xeb5e('0x1f')]();};}function saveUpdates(_0xbb5beb,_0x4e729d){return function(_0x5992aa){if(_0x5992aa){return _0x5992aa[_0xeb5e('0x20')](_0xbb5beb)[_0xeb5e('0x21')](function(_0x242d53){return _0x242d53;});}return null;};}function removeEntity(_0x3d5945,_0x1019e1){return function(_0x2bba33){if(_0x2bba33){return _0x2bba33[_0xeb5e('0x22')]()[_0xeb5e('0x21')](function(){_0x3d5945['status'](0xcc)[_0xeb5e('0x17')]();});}};}function handleEntityNotFound(_0x56becd,_0x3f1e69){return function(_0x354a41){if(!_0x354a41){_0x56becd['sendStatus'](0x194);}return _0x354a41;};}function handleError(_0x66f5f9,_0x5f5d1b){_0x5f5d1b=_0x5f5d1b||0x1f4;return function(_0x40647f){logger[_0xeb5e('0x23')](_0x40647f['stack']);if(_0x40647f[_0xeb5e('0x24')]){delete _0x40647f[_0xeb5e('0x24')];}_0x66f5f9[_0xeb5e('0x1c')](_0x5f5d1b)[_0xeb5e('0x25')](_0x40647f);};}exports[_0xeb5e('0x26')]=function(_0x3b8dba,_0x575011){var _0x3c86f1={},_0x21dcab={},_0x527900={'count':0x0,'rows':[]};var _0x10c563=_[_0xeb5e('0x27')](db[_0xeb5e('0x28')][_0xeb5e('0x29')],function(_0x3f609c){return{'name':_0x3f609c[_0xeb5e('0x2a')],'type':_0x3f609c[_0xeb5e('0x2b')][_0xeb5e('0x2c')]};});_0x21dcab[_0xeb5e('0x2d')]=_[_0xeb5e('0x27')](_0x10c563,_0xeb5e('0x24'));_0x21dcab['query']=_[_0xeb5e('0x2e')](_0x3b8dba[_0xeb5e('0x2f')]);_0x21dcab[_0xeb5e('0x30')]=_[_0xeb5e('0x31')](_0x21dcab[_0xeb5e('0x2d')],_0x21dcab['query']);_0x3c86f1[_0xeb5e('0x32')]=_[_0xeb5e('0x31')](_0x21dcab['model'],qs[_0xeb5e('0x33')](_0x3b8dba[_0xeb5e('0x2f')]['fields']));_0x3c86f1[_0xeb5e('0x32')]=_0x3c86f1[_0xeb5e('0x32')][_0xeb5e('0x34')]?_0x3c86f1[_0xeb5e('0x32')]:_0x21dcab[_0xeb5e('0x2d')];if(!_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x35')](_0xeb5e('0x36'))){_0x3c86f1[_0xeb5e('0x1a')]=qs[_0xeb5e('0x1a')](_0x3b8dba['query']['limit']);_0x3c86f1[_0xeb5e('0x18')]=qs[_0xeb5e('0x18')](_0x3b8dba[_0xeb5e('0x2f')]['offset']);}_0x3c86f1[_0xeb5e('0x37')]=qs[_0xeb5e('0x38')](_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x38')]);_0x3c86f1[_0xeb5e('0x39')]=qs['filters'](_[_0xeb5e('0x3a')](_0x3b8dba[_0xeb5e('0x2f')],_0x21dcab[_0xeb5e('0x30')]),_0x10c563);if(_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x3b')]){_0x3c86f1['where']=_['merge'](_0x3c86f1[_0xeb5e('0x39')],{'$or':_[_0xeb5e('0x27')](_0x10c563,function(_0x4450ee){if(_0x4450ee['type']!==_0xeb5e('0x3c')){var _0x11ca66={};_0x11ca66[_0x4450ee[_0xeb5e('0x24')]]={'$like':'%'+_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x3b')]+'%'};return _0x11ca66;}})});}_0x3c86f1=_[_0xeb5e('0x3d')]({},_0x3c86f1,_0x3b8dba['options']);var _0x3cca81={'where':_0x3c86f1[_0xeb5e('0x39')]};return db[_0xeb5e('0x28')][_0xeb5e('0x1b')](_0x3cca81)[_0xeb5e('0x21')](function(_0x538e5a){_0x527900[_0xeb5e('0x1b')]=_0x538e5a;if(_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x3e')]){_0x3c86f1['include']=[{'all':!![]}];}return db[_0xeb5e('0x28')][_0xeb5e('0x3f')](_0x3c86f1);})[_0xeb5e('0x21')](function(_0x5865b5){_0x527900[_0xeb5e('0x40')]=_0x5865b5;return _0x527900;})[_0xeb5e('0x21')](respondWithFilteredResult(_0x575011,_0x3c86f1))[_0xeb5e('0x41')](handleError(_0x575011,null));};exports['show']=function(_0x3ebcf3,_0x6ebc8d){var _0x5d5668={'raw':![],'where':{'id':_0x3ebcf3[_0xeb5e('0x42')]['id']}},_0x88de26={};_0x88de26[_0xeb5e('0x2d')]=_[_0xeb5e('0x2e')](db['UserProfileSection'][_0xeb5e('0x29')]);_0x88de26[_0xeb5e('0x2f')]=_[_0xeb5e('0x2e')](_0x3ebcf3[_0xeb5e('0x2f')]);_0x88de26['filters']=_[_0xeb5e('0x31')](_0x88de26[_0xeb5e('0x2d')],_0x88de26[_0xeb5e('0x2f')]);_0x5d5668[_0xeb5e('0x32')]=_['intersection'](_0x88de26[_0xeb5e('0x2d')],qs[_0xeb5e('0x33')](_0x3ebcf3[_0xeb5e('0x2f')][_0xeb5e('0x33')]));_0x5d5668['attributes']=_0x5d5668[_0xeb5e('0x32')][_0xeb5e('0x34')]?_0x5d5668[_0xeb5e('0x32')]:_0x88de26['model'];if(_0x3ebcf3['query']['includeAll']){_0x5d5668[_0xeb5e('0x43')]=[{'all':!![]}];}_0x5d5668=_[_0xeb5e('0x3d')]({},_0x5d5668,_0x3ebcf3[_0xeb5e('0x44')]);return db[_0xeb5e('0x28')]['find'](_0x5d5668)[_0xeb5e('0x21')](handleEntityNotFound(_0x6ebc8d,null))['then'](respondWithResult(_0x6ebc8d,null))[_0xeb5e('0x41')](handleError(_0x6ebc8d,null));};exports[_0xeb5e('0x45')]=function(_0x2b343e,_0x5d9ca0){return db[_0xeb5e('0x28')]['create'](_0x2b343e[_0xeb5e('0x46')],{})[_0xeb5e('0x21')](respondWithResult(_0x5d9ca0,0xc9))[_0xeb5e('0x41')](handleError(_0x5d9ca0,null));};exports[_0xeb5e('0x20')]=function(_0x36a48c,_0x405689){if(_0x36a48c[_0xeb5e('0x46')]['id']){delete _0x36a48c['body']['id'];}return db[_0xeb5e('0x28')][_0xeb5e('0x47')]({'where':{'id':_0x36a48c[_0xeb5e('0x42')]['id']}})[_0xeb5e('0x21')](handleEntityNotFound(_0x405689,null))['then'](saveUpdates(_0x36a48c[_0xeb5e('0x46')],null))[_0xeb5e('0x21')](respondWithResult(_0x405689,null))[_0xeb5e('0x41')](handleError(_0x405689,null));};exports[_0xeb5e('0x22')]=function(_0x57782b,_0x11fa56){return db[_0xeb5e('0x28')][_0xeb5e('0x47')]({'where':{'id':_0x57782b[_0xeb5e('0x42')]['id']}})[_0xeb5e('0x21')](handleEntityNotFound(_0x11fa56,null))[_0xeb5e('0x21')](removeEntity(_0x11fa56,null))[_0xeb5e('0x41')](handleError(_0x11fa56,null));};exports[_0xeb5e('0x48')]=function(_0x17a887,_0x54c1df){return db[_0xeb5e('0x28')][_0xeb5e('0x48')]()[_0xeb5e('0x21')](respondWithResult(_0x54c1df,null))[_0xeb5e('0x41')](handleError(_0x54c1df,null));}; \ No newline at end of file +var _0x3abe=['fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','UserProfileSection','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x34f69e,_0x4e2856){var _0x3581f7=function(_0x1f1f70){while(--_0x1f1f70){_0x34f69e['push'](_0x34f69e['shift']());}};_0x3581f7(++_0x4e2856);}(_0x3abe,0x8f));var _0xe3ab=function(_0x9bf8c0,_0x4c1a49){_0x9bf8c0=_0x9bf8c0-0x0;var _0x31b992=_0x3abe[_0x9bf8c0];return _0x31b992;};'use strict';var emlformat=require(_0xe3ab('0x0'));var rimraf=require(_0xe3ab('0x1'));var zipdir=require(_0xe3ab('0x2'));var jsonpatch=require(_0xe3ab('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe3ab('0x4'));var util=require(_0xe3ab('0x5'));var path=require('path');var sox=require(_0xe3ab('0x6'));var csv=require(_0xe3ab('0x7'));var ejs=require(_0xe3ab('0x8'));var fs=require('fs');var fs_extra=require(_0xe3ab('0x9'));var _=require(_0xe3ab('0xa'));var squel=require(_0xe3ab('0xb'));var crypto=require('crypto');var jsforce=require(_0xe3ab('0xc'));var deskjs=require(_0xe3ab('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe3ab('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe3ab('0xf'));var qs=require(_0xe3ab('0x10'));var as=require(_0xe3ab('0x11'));var hardwareService=require(_0xe3ab('0x12'));var logger=require(_0xe3ab('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe3ab('0x14'));var licenseUtil=require(_0xe3ab('0x15'));var db=require(_0xe3ab('0x16'))['db'];function respondWithStatusCode(_0x2a513f,_0x3a9c17){_0x3a9c17=_0x3a9c17||0xcc;return function(_0x1180cd){if(_0x1180cd){return _0x2a513f['sendStatus'](_0x3a9c17);}return _0x2a513f[_0xe3ab('0x17')](_0x3a9c17)[_0xe3ab('0x18')]();};}function respondWithResult(_0x1fb5f4,_0x407458){_0x407458=_0x407458||0xc8;return function(_0x134634){if(_0x134634){return _0x1fb5f4[_0xe3ab('0x17')](_0x407458)['json'](_0x134634);}};}function respondWithFilteredResult(_0x2ae7c7,_0x2cca82){return function(_0x587e66){if(_0x587e66){var _0x843565=typeof _0x2cca82[_0xe3ab('0x19')]===_0xe3ab('0x1a')&&typeof _0x2cca82['limit']===_0xe3ab('0x1a');var _0x2750cd=_0x587e66[_0xe3ab('0x1b')];var _0x387b6f=_0x843565?0x0:_0x2cca82[_0xe3ab('0x19')];var _0x5d2f2b=_0x843565?_0x587e66['count']:_0x2cca82[_0xe3ab('0x19')]+_0x2cca82[_0xe3ab('0x1c')];var _0x28c9c3;if(_0x5d2f2b>=_0x2750cd){_0x5d2f2b=_0x2750cd;_0x28c9c3=0xc8;}else{_0x28c9c3=0xce;}_0x2ae7c7[_0xe3ab('0x17')](_0x28c9c3);return _0x2ae7c7[_0xe3ab('0x1d')](_0xe3ab('0x1e'),_0x387b6f+'-'+_0x5d2f2b+'/'+_0x2750cd)['json'](_0x587e66);}return null;};}function patchUpdates(_0x43cf69){return function(_0x4676d3){try{jsonpatch[_0xe3ab('0x1f')](_0x4676d3,_0x43cf69,!![]);}catch(_0x2fa463){return BPromise[_0xe3ab('0x20')](_0x2fa463);}return _0x4676d3[_0xe3ab('0x21')]();};}function saveUpdates(_0x21f20e,_0x2299c8){return function(_0x708a94){if(_0x708a94){return _0x708a94[_0xe3ab('0x22')](_0x21f20e)[_0xe3ab('0x23')](function(_0x56af08){return _0x56af08;});}return null;};}function removeEntity(_0x4cbfb0,_0x2ec500){return function(_0x21de04){if(_0x21de04){return _0x21de04[_0xe3ab('0x24')]()[_0xe3ab('0x23')](function(){_0x4cbfb0[_0xe3ab('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ba773,_0x2e4821){return function(_0x4a4b0a){if(!_0x4a4b0a){_0x3ba773['sendStatus'](0x194);}return _0x4a4b0a;};}function handleError(_0x299e77,_0x5e893e){_0x5e893e=_0x5e893e||0x1f4;return function(_0xafcb8f){logger[_0xe3ab('0x25')](_0xafcb8f['stack']);if(_0xafcb8f[_0xe3ab('0x26')]){delete _0xafcb8f[_0xe3ab('0x26')];}_0x299e77[_0xe3ab('0x17')](_0x5e893e)['send'](_0xafcb8f);};}exports[_0xe3ab('0x27')]=function(_0x48c287,_0x99cf93){var _0x43ba0b={},_0x5e6f9f={},_0x567fdd={'count':0x0,'rows':[]};var _0x3abd6f=_['map'](db[_0xe3ab('0x28')][_0xe3ab('0x29')],function(_0x2f21c0){return{'name':_0x2f21c0[_0xe3ab('0x2a')],'type':_0x2f21c0['type']['key']};});_0x5e6f9f[_0xe3ab('0x2b')]=_[_0xe3ab('0x2c')](_0x3abd6f,_0xe3ab('0x26'));_0x5e6f9f[_0xe3ab('0x2d')]=_['keys'](_0x48c287['query']);_0x5e6f9f[_0xe3ab('0x2e')]=_[_0xe3ab('0x2f')](_0x5e6f9f[_0xe3ab('0x2b')],_0x5e6f9f[_0xe3ab('0x2d')]);_0x43ba0b[_0xe3ab('0x30')]=_[_0xe3ab('0x2f')](_0x5e6f9f[_0xe3ab('0x2b')],qs[_0xe3ab('0x31')](_0x48c287['query'][_0xe3ab('0x31')]));_0x43ba0b[_0xe3ab('0x30')]=_0x43ba0b[_0xe3ab('0x30')][_0xe3ab('0x32')]?_0x43ba0b[_0xe3ab('0x30')]:_0x5e6f9f['model'];if(!_0x48c287[_0xe3ab('0x2d')][_0xe3ab('0x33')](_0xe3ab('0x34'))){_0x43ba0b[_0xe3ab('0x1c')]=qs['limit'](_0x48c287[_0xe3ab('0x2d')][_0xe3ab('0x1c')]);_0x43ba0b['offset']=qs[_0xe3ab('0x19')](_0x48c287[_0xe3ab('0x2d')][_0xe3ab('0x19')]);}_0x43ba0b['order']=qs[_0xe3ab('0x35')](_0x48c287[_0xe3ab('0x2d')][_0xe3ab('0x35')]);_0x43ba0b['where']=qs[_0xe3ab('0x2e')](_[_0xe3ab('0x36')](_0x48c287[_0xe3ab('0x2d')],_0x5e6f9f['filters']),_0x3abd6f);if(_0x48c287[_0xe3ab('0x2d')][_0xe3ab('0x37')]){_0x43ba0b['where']=_[_0xe3ab('0x38')](_0x43ba0b[_0xe3ab('0x39')],{'$or':_[_0xe3ab('0x2c')](_0x3abd6f,function(_0xac7066){if(_0xac7066[_0xe3ab('0x3a')]!==_0xe3ab('0x3b')){var _0x5055a2={};_0x5055a2[_0xac7066['name']]={'$like':'%'+_0x48c287[_0xe3ab('0x2d')]['filter']+'%'};return _0x5055a2;}})});}_0x43ba0b=_[_0xe3ab('0x38')]({},_0x43ba0b,_0x48c287['options']);var _0x1de5c2={'where':_0x43ba0b[_0xe3ab('0x39')]};return db[_0xe3ab('0x28')][_0xe3ab('0x1b')](_0x1de5c2)[_0xe3ab('0x23')](function(_0x5c8a11){_0x567fdd['count']=_0x5c8a11;if(_0x48c287[_0xe3ab('0x2d')][_0xe3ab('0x3c')]){_0x43ba0b[_0xe3ab('0x3d')]=[{'all':!![]}];}return db[_0xe3ab('0x28')][_0xe3ab('0x3e')](_0x43ba0b);})[_0xe3ab('0x23')](function(_0x374947){_0x567fdd[_0xe3ab('0x3f')]=_0x374947;return _0x567fdd;})[_0xe3ab('0x23')](respondWithFilteredResult(_0x99cf93,_0x43ba0b))[_0xe3ab('0x40')](handleError(_0x99cf93,null));};exports[_0xe3ab('0x41')]=function(_0x472f30,_0x2c847b){var _0x1facb4={'raw':![],'where':{'id':_0x472f30[_0xe3ab('0x42')]['id']}},_0x37c407={};_0x37c407['model']=_['keys'](db[_0xe3ab('0x28')][_0xe3ab('0x29')]);_0x37c407[_0xe3ab('0x2d')]=_[_0xe3ab('0x43')](_0x472f30[_0xe3ab('0x2d')]);_0x37c407[_0xe3ab('0x2e')]=_[_0xe3ab('0x2f')](_0x37c407[_0xe3ab('0x2b')],_0x37c407[_0xe3ab('0x2d')]);_0x1facb4[_0xe3ab('0x30')]=_[_0xe3ab('0x2f')](_0x37c407[_0xe3ab('0x2b')],qs[_0xe3ab('0x31')](_0x472f30[_0xe3ab('0x2d')][_0xe3ab('0x31')]));_0x1facb4[_0xe3ab('0x30')]=_0x1facb4[_0xe3ab('0x30')][_0xe3ab('0x32')]?_0x1facb4[_0xe3ab('0x30')]:_0x37c407[_0xe3ab('0x2b')];if(_0x472f30[_0xe3ab('0x2d')][_0xe3ab('0x3c')]){_0x1facb4[_0xe3ab('0x3d')]=[{'all':!![]}];}_0x1facb4=_['merge']({},_0x1facb4,_0x472f30[_0xe3ab('0x44')]);return db[_0xe3ab('0x28')][_0xe3ab('0x45')](_0x1facb4)[_0xe3ab('0x23')](handleEntityNotFound(_0x2c847b,null))['then'](respondWithResult(_0x2c847b,null))[_0xe3ab('0x40')](handleError(_0x2c847b,null));};exports['create']=function(_0x150ff3,_0x10a673){return db['UserProfileSection'][_0xe3ab('0x46')](_0x150ff3['body'],{})[_0xe3ab('0x23')](respondWithResult(_0x10a673,0xc9))[_0xe3ab('0x40')](handleError(_0x10a673,null));};exports[_0xe3ab('0x22')]=function(_0x3a9ba1,_0x4fcdf5){if(_0x3a9ba1[_0xe3ab('0x47')]['id']){delete _0x3a9ba1[_0xe3ab('0x47')]['id'];}return db[_0xe3ab('0x28')][_0xe3ab('0x45')]({'where':{'id':_0x3a9ba1[_0xe3ab('0x42')]['id']}})[_0xe3ab('0x23')](handleEntityNotFound(_0x4fcdf5,null))['then'](saveUpdates(_0x3a9ba1[_0xe3ab('0x47')],null))[_0xe3ab('0x23')](respondWithResult(_0x4fcdf5,null))['catch'](handleError(_0x4fcdf5,null));};exports[_0xe3ab('0x24')]=function(_0x2d29e6,_0x29a61b){return db[_0xe3ab('0x28')][_0xe3ab('0x45')]({'where':{'id':_0x2d29e6[_0xe3ab('0x42')]['id']}})[_0xe3ab('0x23')](handleEntityNotFound(_0x29a61b,null))[_0xe3ab('0x23')](removeEntity(_0x29a61b,null))[_0xe3ab('0x40')](handleError(_0x29a61b,null));};exports[_0xe3ab('0x48')]=function(_0x11e14,_0x437223){return db[_0xe3ab('0x28')][_0xe3ab('0x48')]()[_0xe3ab('0x23')](respondWithResult(_0x437223,null))[_0xe3ab('0x40')](handleError(_0x437223,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2114a15..00a935c 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 _0xd7cf=['api','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','../../config/logger'];(function(_0x1c55d6,_0x590163){var _0x16bdb3=function(_0x3c5069){while(--_0x3c5069){_0x1c55d6['push'](_0x1c55d6['shift']());}};_0x16bdb3(++_0x590163);}(_0xd7cf,0x12b));var _0xfd7c=function(_0x328b40,_0x370642){_0x328b40=_0x328b40-0x0;var _0x556a56=_0xd7cf[_0x328b40];return _0x556a56;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd7c('0x0'))(_0xfd7c('0x1'));var moment=require('moment');var BPromise=require(_0xfd7c('0x2'));var rp=require(_0xfd7c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfd7c('0x4'));var attributes=require(_0xfd7c('0x5'));module[_0xfd7c('0x6')]=function(_0x12063a,_0x5c946b){return _0x12063a[_0xfd7c('0x7')](_0xfd7c('0x8'),attributes,{'tableName':_0xfd7c('0x9'),'paranoid':![],'indexes':[{'name':_0xfd7c('0xa'),'fields':['sectionId',_0xfd7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8751=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x8751,0x17b));var _0x1875=function(_0x3a7f9b,_0x3cce85){_0x3a7f9b=_0x3a7f9b-0x0;var _0x321723=_0x8751[_0x3a7f9b];return _0x321723;};'use strict';var _=require(_0x1875('0x0'));var util=require(_0x1875('0x1'));var logger=require(_0x1875('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1875('0x3'));var rp=require(_0x1875('0x4'));var fs=require('fs');var path=require(_0x1875('0x5'));var rimraf=require(_0x1875('0x6'));var config=require(_0x1875('0x7'));var attributes=require(_0x1875('0x8'));module[_0x1875('0x9')]=function(_0x17beaa,_0x3de4c0){return _0x17beaa[_0x1875('0xa')](_0x1875('0xb'),attributes,{'tableName':_0x1875('0xc'),'paranoid':![],'indexes':[{'name':_0x1875('0xd'),'fields':[_0x1875('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 56fe131..69c7202 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 _0x50e5=['jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x52e140,_0x274e0e){var _0x26c1aa=function(_0x50a8cb){while(--_0x50a8cb){_0x52e140['push'](_0x52e140['shift']());}};_0x26c1aa(++_0x274e0e);}(_0x50e5,0x66));var _0x550e=function(_0x448393,_0x4d03b1){_0x448393=_0x448393-0x0;var _0xe08eb6=_0x50e5[_0x448393];return _0xe08eb6;};'use strict';var _=require('lodash');var util=require(_0x550e('0x0'));var moment=require(_0x550e('0x1'));var BPromise=require(_0x550e('0x2'));var rs=require(_0x550e('0x3'));var fs=require('fs');var Redis=require(_0x550e('0x4'));var db=require(_0x550e('0x5'))['db'];var utils=require(_0x550e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x550e('0x7'));var jayson=require(_0x550e('0x8'));var client=jayson[_0x550e('0x9')][_0x550e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39c14a,_0x518407,_0x323f6b){return new BPromise(function(_0x335dfd,_0x1d3e85){return client[_0x550e('0xb')](_0x39c14a,_0x323f6b)[_0x550e('0xc')](function(_0x397398){logger['info'](_0x550e('0xd'),_0x518407,_0x550e('0xe'));logger[_0x550e('0xf')](_0x550e('0x10'),_0x518407,'request\x20sent',JSON['stringify'](_0x397398));if(_0x397398[_0x550e('0x11')]){if(_0x397398[_0x550e('0x11')][_0x550e('0x12')]===0x1f4){logger[_0x550e('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x518407,_0x397398[_0x550e('0x11')][_0x550e('0x13')]);return _0x1d3e85(_0x397398['error'][_0x550e('0x13')]);}logger[_0x550e('0x11')](_0x550e('0xd'),_0x518407,_0x397398[_0x550e('0x11')][_0x550e('0x13')]);return _0x335dfd(_0x397398[_0x550e('0x11')]['message']);}else{logger[_0x550e('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x518407,_0x550e('0xe'));_0x335dfd(_0x397398[_0x550e('0x15')][_0x550e('0x13')]);}})['catch'](function(_0xd9e8fe){logger[_0x550e('0x11')](_0x550e('0xd'),_0x518407,_0xd9e8fe);_0x1d3e85(_0xd9e8fe);});});} \ No newline at end of file +var _0xccc2=['info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0xccc2,0xa2));var _0x2ccc=function(_0x3b0285,_0x5be2af){_0x3b0285=_0x3b0285-0x0;var _0x41ca88=_0xccc2[_0x3b0285];return _0x41ca88;};'use strict';var _=require(_0x2ccc('0x0'));var util=require(_0x2ccc('0x1'));var moment=require('moment');var BPromise=require(_0x2ccc('0x2'));var rs=require(_0x2ccc('0x3'));var fs=require('fs');var Redis=require(_0x2ccc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ccc('0x5'));var logger=require(_0x2ccc('0x6'))('rpc');var config=require(_0x2ccc('0x7'));var jayson=require(_0x2ccc('0x8'));var client=jayson[_0x2ccc('0x9')][_0x2ccc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5834b3,_0x228391,_0x3fb6b2){return new BPromise(function(_0x418d27,_0x3f0826){return client[_0x2ccc('0xb')](_0x5834b3,_0x3fb6b2)['then'](function(_0x4764b6){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x228391,_0x2ccc('0xc'));logger['debug'](_0x2ccc('0xd'),_0x228391,_0x2ccc('0xc'),JSON[_0x2ccc('0xe')](_0x4764b6));if(_0x4764b6['error']){if(_0x4764b6[_0x2ccc('0xf')]['code']===0x1f4){logger[_0x2ccc('0xf')](_0x2ccc('0x10'),_0x228391,_0x4764b6[_0x2ccc('0xf')]['message']);return _0x3f0826(_0x4764b6['error'][_0x2ccc('0x11')]);}logger[_0x2ccc('0xf')](_0x2ccc('0x10'),_0x228391,_0x4764b6[_0x2ccc('0xf')][_0x2ccc('0x11')]);return _0x418d27(_0x4764b6['error'][_0x2ccc('0x11')]);}else{logger[_0x2ccc('0x12')](_0x2ccc('0x10'),_0x228391,_0x2ccc('0xc'));_0x418d27(_0x4764b6[_0x2ccc('0x13')][_0x2ccc('0x11')]);}})['catch'](function(_0x2a477e){logger[_0x2ccc('0xf')](_0x2ccc('0x10'),_0x228391,_0x2a477e);_0x3f0826(_0x2a477e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b90de33..9899787 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(_0x550d8f,_0x13a896){var _0x3b6492=function(_0xa66451){while(--_0xa66451){_0x550d8f['push'](_0x550d8f['shift']());}};_0x3b6492(++_0x13a896);}(_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(_0x350a4,_0x25d8f7){var _0x4d94e4=function(_0x39e828){while(--_0x39e828){_0x350a4['push'](_0x350a4['shift']());}};_0x4d94e4(++_0x25d8f7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0xcb91[_0x45313f];return _0x402910;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index fe5348d..977d406 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 _0x6324=['INTEGER','sequelize'];(function(_0xf31eca,_0x3fbeec){var _0x1b82a3=function(_0x52af39){while(--_0x52af39){_0xf31eca['push'](_0xf31eca['shift']());}};_0x1b82a3(++_0x3fbeec);}(_0x6324,0x13b));var _0x4632=function(_0x3c9e74,_0x4334c5){_0x3c9e74=_0x3c9e74-0x0;var _0x4fea21=_0x6324[_0x3c9e74];return _0x4fea21;};'use strict';var Sequelize=require(_0x4632('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4632('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbd19=['sequelize','exports','INTEGER'];(function(_0x4d770d,_0x5af4ce){var _0x11dc7a=function(_0x27d3f7){while(--_0x27d3f7){_0x4d770d['push'](_0x4d770d['shift']());}};_0x11dc7a(++_0x5af4ce);}(_0xbd19,0x9c));var _0x9bd1=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xbd19[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x9bd1('0x0'));module[_0x9bd1('0x1')]={'penalty':{'type':Sequelize[_0x9bd1('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 adc62dd..b9fcedf 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 _0x444e=['moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','../../config/logger'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x444e,0xe8));var _0xe444=function(_0xfac0f8,_0x2f8d2e){_0xfac0f8=_0xfac0f8-0x0;var _0x4703d3=_0x444e[_0xfac0f8];return _0x4703d3;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var logger=require(_0xe444('0x1'))('api');var moment=require(_0xe444('0x2'));var BPromise=require('bluebird');var rp=require(_0xe444('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var attributes=require(_0xe444('0x6'));module[_0xe444('0x7')]=function(_0x36ac3b,_0x1ddb27){return _0x36ac3b['define'](_0xe444('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3914=['path','rimraf','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','util','api','moment','request-promise'];(function(_0x2c8876,_0x481c19){var _0x57aa3b=function(_0x1ae828){while(--_0x1ae828){_0x2c8876['push'](_0x2c8876['shift']());}};_0x57aa3b(++_0x481c19);}(_0x3914,0xeb));var _0x4391=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0x3914[_0x412c8f];return _0x27c005;};'use strict';var _=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var logger=require('../../config/logger')(_0x4391('0x2'));var moment=require(_0x4391('0x3'));var BPromise=require('bluebird');var rp=require(_0x4391('0x4'));var fs=require('fs');var path=require(_0x4391('0x5'));var rimraf=require(_0x4391('0x6'));var config=require('../../config/environment');var attributes=require(_0x4391('0x7'));module[_0x4391('0x8')]=function(_0x540b62,_0x3717d5){return _0x540b62['define'](_0x4391('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 2824456..2cda8c4 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 _0x2c30=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x104a6a,_0x12e2c9){var _0xf7e3c0=function(_0x5c75e1){while(--_0x5c75e1){_0x104a6a['push'](_0x104a6a['shift']());}};_0xf7e3c0(++_0x12e2c9);}(_0x2c30,0x12f));var _0x02c3=function(_0x3b3672,_0x36c56b){_0x3b3672=_0x3b3672-0x0;var _0x3eee38=_0x2c30[_0x3b3672];return _0x3eee38;};'use strict';var _=require(_0x02c3('0x0'));var util=require(_0x02c3('0x1'));var moment=require(_0x02c3('0x2'));var BPromise=require(_0x02c3('0x3'));var rs=require(_0x02c3('0x4'));var fs=require('fs');var Redis=require(_0x02c3('0x5'));var db=require(_0x02c3('0x6'))['db'];var utils=require(_0x02c3('0x7'));var logger=require(_0x02c3('0x8'))(_0x02c3('0x9'));var config=require(_0x02c3('0xa'));var jayson=require(_0x02c3('0xb'));var client=jayson['client'][_0x02c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8cb87e,_0x143d4c,_0x15318f){return new BPromise(function(_0xbf8909,_0x1a72ba){return client[_0x02c3('0xd')](_0x8cb87e,_0x15318f)[_0x02c3('0xe')](function(_0x1ce9bd){logger[_0x02c3('0xf')](_0x02c3('0x10'),_0x143d4c,_0x02c3('0x11'));logger[_0x02c3('0x12')](_0x02c3('0x13'),_0x143d4c,_0x02c3('0x11'),JSON[_0x02c3('0x14')](_0x1ce9bd));if(_0x1ce9bd[_0x02c3('0x15')]){if(_0x1ce9bd['error']['code']===0x1f4){logger[_0x02c3('0x15')](_0x02c3('0x10'),_0x143d4c,_0x1ce9bd[_0x02c3('0x15')][_0x02c3('0x16')]);return _0x1a72ba(_0x1ce9bd[_0x02c3('0x15')][_0x02c3('0x16')]);}logger['error'](_0x02c3('0x10'),_0x143d4c,_0x1ce9bd[_0x02c3('0x15')][_0x02c3('0x16')]);return _0xbf8909(_0x1ce9bd[_0x02c3('0x15')][_0x02c3('0x16')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x143d4c,_0x02c3('0x11'));_0xbf8909(_0x1ce9bd['result'][_0x02c3('0x16')]);}})[_0x02c3('0x17')](function(_0x4627cc){logger[_0x02c3('0x15')](_0x02c3('0x10'),_0x143d4c,_0x4627cc);_0x1a72ba(_0x4627cc);});});} \ No newline at end of file +var _0x7def=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3a9707,_0x3d19c8){var _0x2fb6aa=function(_0x51947b){while(--_0x51947b){_0x3a9707['push'](_0x3a9707['shift']());}};_0x2fb6aa(++_0x3d19c8);}(_0x7def,0xd9));var _0xf7de=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7def[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xf7de('0x0'));var util=require(_0xf7de('0x1'));var moment=require('moment');var BPromise=require(_0xf7de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7de('0x3'));var db=require(_0xf7de('0x4'))['db'];var utils=require(_0xf7de('0x5'));var logger=require('../../config/logger')(_0xf7de('0x6'));var config=require(_0xf7de('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf7de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20bd0d,_0x504f7e,_0x1c4c8c){return new BPromise(function(_0x2338c2,_0x10df4a){return client[_0xf7de('0x9')](_0x20bd0d,_0x1c4c8c)[_0xf7de('0xa')](function(_0x1d6b3e){logger[_0xf7de('0xb')](_0xf7de('0xc'),_0x504f7e,'request\x20sent');logger['debug'](_0xf7de('0xd'),_0x504f7e,_0xf7de('0xe'),JSON[_0xf7de('0xf')](_0x1d6b3e));if(_0x1d6b3e[_0xf7de('0x10')]){if(_0x1d6b3e[_0xf7de('0x10')][_0xf7de('0x11')]===0x1f4){logger['error'](_0xf7de('0xc'),_0x504f7e,_0x1d6b3e['error'][_0xf7de('0x12')]);return _0x10df4a(_0x1d6b3e['error'][_0xf7de('0x12')]);}logger[_0xf7de('0x10')](_0xf7de('0xc'),_0x504f7e,_0x1d6b3e[_0xf7de('0x10')]['message']);return _0x2338c2(_0x1d6b3e[_0xf7de('0x10')][_0xf7de('0x12')]);}else{logger['info'](_0xf7de('0xc'),_0x504f7e,_0xf7de('0xe'));_0x2338c2(_0x1d6b3e[_0xf7de('0x13')]['message']);}})[_0xf7de('0x14')](function(_0x481608){logger[_0xf7de('0x10')](_0xf7de('0xc'),_0x504f7e,_0x481608);_0x10df4a(_0x481608);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index f4db9bf..797ba6a 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 _0x58aa=['sequelize'];(function(_0x587d73,_0x3566bf){var _0x3aaf5b=function(_0x45b214){while(--_0x45b214){_0x587d73['push'](_0x587d73['shift']());}};_0x3aaf5b(++_0x3566bf);}(_0x58aa,0x17e));var _0xa58a=function(_0x1d1ca6,_0x4d94fc){_0x1d1ca6=_0x1d1ca6-0x0;var _0x3c0755=_0x58aa[_0x1d1ca6];return _0x3c0755;};'use strict';var Sequelize=require(_0xa58a('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc9c6=['INTEGER','sequelize','exports'];(function(_0x2c099a,_0x5e7131){var _0x218a50=function(_0x40d873){while(--_0x40d873){_0x2c099a['push'](_0x2c099a['shift']());}};_0x218a50(++_0x5e7131);}(_0xc9c6,0x1a8));var _0x6c9c=function(_0x559b69,_0x5b98bd){_0x559b69=_0x559b69-0x0;var _0x2ff0eb=_0xc9c6[_0x559b69];return _0x2ff0eb;};'use strict';var Sequelize=require(_0x6c9c('0x0'));module[_0x6c9c('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x6c9c('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index bcc6c99..34abbe9 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(_0x43027b,_0x364b6b){var _0x2aba3b=function(_0x31b737){while(--_0x31b737){_0x43027b['push'](_0x43027b['shift']());}};_0x2aba3b(++_0x364b6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x4d4bbe,_0x22f1e5){var _0x4b0777=function(_0x2866b6){while(--_0x2866b6){_0x4d4bbe['push'](_0x4d4bbe['shift']());}};_0x4b0777(++_0x22f1e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 9ca21a2..f4b25d2 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5e4d99,_0x2ef5e9){var _0x1d9c27=function(_0x4cff85){while(--_0x4cff85){_0x5e4d99['push'](_0x5e4d99['shift']());}};_0x1d9c27(++_0x2ef5e9);}(_0x70e0,0x17b));var _0x070e=function(_0x4c1928,_0x40e0a0){_0x4c1928=_0x4c1928-0x0;var _0x227eb4=_0x70e0[_0x4c1928];return _0x227eb4;};'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(_0x37be00,_0x45514d){var _0x12b45f=function(_0x400632){while(--_0x400632){_0x37be00['push'](_0x37be00['shift']());}};_0x12b45f(++_0x45514d);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 67615ee..708fed8 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 _0xe10c=['sequelize','exports'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0xe10c,0x1f0));var _0xce10=function(_0x4aa474,_0x4885e3){_0x4aa474=_0x4aa474-0x0;var _0xd8af71=_0xe10c[_0x4aa474];return _0xd8af71;};'use strict';var Sequelize=require(_0xce10('0x0'));module[_0xce10('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa388=['exports','sequelize'];(function(_0x304bd5,_0xea943d){var _0x2bcd87=function(_0x53d3c5){while(--_0x53d3c5){_0x304bd5['push'](_0x304bd5['shift']());}};_0x2bcd87(++_0xea943d);}(_0xa388,0x189));var _0x8a38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa388[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8a38('0x0'));module[_0x8a38('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 566408c..ae4214c 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 _0xbc1b=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0xbc1b,0xb6));var _0xbbc1=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xbc1b[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0xbbc1('0x0'));var util=require(_0xbbc1('0x1'));var logger=require(_0xbbc1('0x2'))(_0xbbc1('0x3'));var moment=require('moment');var BPromise=require(_0xbbc1('0x4'));var rp=require(_0xbbc1('0x5'));var fs=require('fs');var path=require(_0xbbc1('0x6'));var rimraf=require(_0xbbc1('0x7'));var config=require(_0xbbc1('0x8'));var attributes=require(_0xbbc1('0x9'));module[_0xbbc1('0xa')]=function(_0x45ab76,_0x3c39ab){return _0x45ab76[_0xbbc1('0xb')](_0xbbc1('0xc'),attributes,{'tableName':_0xbbc1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8939=['bluebird','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8939,0x17c));var _0x9893=function(_0x146da3,_0xfff94f){_0x146da3=_0x146da3-0x0;var _0x188caf=_0x8939[_0x146da3];return _0x188caf;};'use strict';var _=require(_0x9893('0x0'));var util=require(_0x9893('0x1'));var logger=require('../../config/logger')(_0x9893('0x2'));var moment=require(_0x9893('0x3'));var BPromise=require(_0x9893('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9893('0x5'));var rimraf=require(_0x9893('0x6'));var config=require('../../config/environment');var attributes=require(_0x9893('0x7'));module[_0x9893('0x8')]=function(_0x22ad98,_0x52154f){return _0x22ad98[_0x9893('0x9')](_0x9893('0xa'),attributes,{'tableName':_0x9893('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index f3b7e54..4e5ec43 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 _0xb21a=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4ffb89,_0x17f6ee){var _0x433ad9=function(_0x18d01f){while(--_0x18d01f){_0x4ffb89['push'](_0x4ffb89['shift']());}};_0x433ad9(++_0x17f6ee);}(_0xb21a,0xed));var _0xab21=function(_0x39461d,_0x24b3f7){_0x39461d=_0x39461d-0x0;var _0x5976f8=_0xb21a[_0x39461d];return _0x5976f8;};'use strict';var _=require(_0xab21('0x0'));var util=require(_0xab21('0x1'));var moment=require(_0xab21('0x2'));var BPromise=require(_0xab21('0x3'));var rs=require(_0xab21('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab21('0x6'))(_0xab21('0x7'));var config=require('../../config/environment');var jayson=require(_0xab21('0x8'));var client=jayson[_0xab21('0x9')][_0xab21('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x596030,_0x589f0d,_0x3d7208){return new BPromise(function(_0x396e79,_0x23606d){return client[_0xab21('0xb')](_0x596030,_0x3d7208)[_0xab21('0xc')](function(_0x85e31){logger[_0xab21('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x589f0d,_0xab21('0xe'));logger[_0xab21('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x589f0d,_0xab21('0xe'),JSON[_0xab21('0x10')](_0x85e31));if(_0x85e31['error']){if(_0x85e31[_0xab21('0x11')][_0xab21('0x12')]===0x1f4){logger[_0xab21('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x589f0d,_0x85e31['error'][_0xab21('0x13')]);return _0x23606d(_0x85e31[_0xab21('0x11')][_0xab21('0x13')]);}logger['error'](_0xab21('0x14'),_0x589f0d,_0x85e31[_0xab21('0x11')][_0xab21('0x13')]);return _0x396e79(_0x85e31[_0xab21('0x11')]['message']);}else{logger[_0xab21('0xd')](_0xab21('0x14'),_0x589f0d,_0xab21('0xe'));_0x396e79(_0x85e31['result']['message']);}})[_0xab21('0x15')](function(_0x4aa39c){logger[_0xab21('0x11')](_0xab21('0x14'),_0x589f0d,_0x4aa39c);_0x23606d(_0x4aa39c);});});} \ No newline at end of file +var _0xcee4=['lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueue,\x20%s,\x20%s','message'];(function(_0x4d1d5e,_0x4dbf5e){var _0x1af41f=function(_0x47e2c7){while(--_0x47e2c7){_0x4d1d5e['push'](_0x4d1d5e['shift']());}};_0x1af41f(++_0x4dbf5e);}(_0xcee4,0x77));var _0x4cee=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcee4[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x4cee('0x0'));var util=require('util');var moment=require(_0x4cee('0x1'));var BPromise=require('bluebird');var rs=require(_0x4cee('0x2'));var fs=require('fs');var Redis=require(_0x4cee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cee('0x4'));var logger=require('../../config/logger')(_0x4cee('0x5'));var config=require(_0x4cee('0x6'));var jayson=require(_0x4cee('0x7'));var client=jayson['client'][_0x4cee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x436246,_0x4ebe6f,_0x4f7432){return new BPromise(function(_0x160dfc,_0x1b0097){return client['request'](_0x436246,_0x4f7432)['then'](function(_0x2b0219){logger[_0x4cee('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x4ebe6f,_0x4cee('0xa'));logger[_0x4cee('0xb')](_0x4cee('0xc'),_0x4ebe6f,_0x4cee('0xa'),JSON['stringify'](_0x2b0219));if(_0x2b0219[_0x4cee('0xd')]){if(_0x2b0219[_0x4cee('0xd')][_0x4cee('0xe')]===0x1f4){logger[_0x4cee('0xd')](_0x4cee('0xf'),_0x4ebe6f,_0x2b0219['error'][_0x4cee('0x10')]);return _0x1b0097(_0x2b0219[_0x4cee('0xd')][_0x4cee('0x10')]);}logger['error'](_0x4cee('0xf'),_0x4ebe6f,_0x2b0219['error'][_0x4cee('0x10')]);return _0x160dfc(_0x2b0219[_0x4cee('0xd')]['message']);}else{logger[_0x4cee('0x9')](_0x4cee('0xf'),_0x4ebe6f,_0x4cee('0xa'));_0x160dfc(_0x2b0219['result'][_0x4cee('0x10')]);}})['catch'](function(_0x3bafe8){logger[_0x4cee('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x4ebe6f,_0x3bafe8);_0x1b0097(_0x3bafe8);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f8fda90..e88e854 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x39384e,_0x2dfc4e){var _0x484390=function(_0x1db602){while(--_0x1db602){_0x39384e['push'](_0x39384e['shift']());}};_0x484390(++_0x2dfc4e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0xcb91[_0x42e4d7];return _0x346cd8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5c3ce9,_0x41f467){var _0xcde3c5=function(_0x4662d6){while(--_0x4662d6){_0x5c3ce9['push'](_0x5c3ce9['shift']());}};_0xcde3c5(++_0x41f467);}(_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 ed5c118..494b8d3 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 _0x169c=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x567ea1,_0x3cb026){var _0x20964d=function(_0x2a7102){while(--_0x2a7102){_0x567ea1['push'](_0x567ea1['shift']());}};_0x20964d(++_0x3cb026);}(_0x169c,0xe3));var _0xc169=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x169c[_0x2678d6];return _0x475503;};'use strict';var Sequelize=require(_0xc169('0x0'));module[_0xc169('0x1')]={'uniqueid':{'type':Sequelize[_0xc169('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc169('0x3')},'membername':{'type':Sequelize[_0xc169('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xc169('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc169('0x5'),'comment':_0xc169('0x3')},'VoiceQueueId':{'type':Sequelize[_0xc169('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc169('0x5'),'comment':_0xc169('0x3')},'penalty':{'type':Sequelize[_0xc169('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xc169('0x2')](0xb),'defaultValue':0x0,'comment':_0xc169('0x3')}}; \ No newline at end of file +var _0x6c47=['exports','Required\x20by\x20Asterisk','STRING','INTEGER','sequelize'];(function(_0x508a0a,_0x3ed316){var _0x4acf06=function(_0x9cea61){while(--_0x9cea61){_0x508a0a['push'](_0x508a0a['shift']());}};_0x4acf06(++_0x3ed316);}(_0x6c47,0xae));var _0x76c4=function(_0xfb017a,_0x2f663c){_0xfb017a=_0xfb017a-0x0;var _0x719111=_0x6c47[_0xfb017a];return _0x719111;};'use strict';var Sequelize=require(_0x76c4('0x0'));module[_0x76c4('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x76c4('0x2')},'membername':{'type':Sequelize[_0x76c4('0x3')],'allowNull':![],'comment':_0x76c4('0x2')},'UserId':{'type':Sequelize[_0x76c4('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x76c4('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x76c4('0x2')},'VoiceQueueId':{'type':Sequelize[_0x76c4('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x76c4('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x76c4('0x2')},'penalty':{'type':Sequelize[_0x76c4('0x4')](0xb),'defaultValue':0x0,'comment':_0x76c4('0x2')},'paused':{'type':Sequelize[_0x76c4('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 0730335..416d3a9 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 _0x0c41=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x5053ac,_0x792c41){var _0x23112e=function(_0x3dda9c){while(--_0x3dda9c){_0x5053ac['push'](_0x5053ac['shift']());}};_0x23112e(++_0x792c41);}(_0x0c41,0xbf));var _0x10c4=function(_0x33349d,_0x657447){_0x33349d=_0x33349d-0x0;var _0x1dfd22=_0x0c41[_0x33349d];return _0x1dfd22;};'use strict';var EventEmitter=require(_0x10c4('0x0'));var UserVoiceQueueRt=require(_0x10c4('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x10c4('0x2')](0x0);var events={'afterCreate':_0x10c4('0x3'),'afterUpdate':_0x10c4('0x4'),'afterDestroy':_0x10c4('0x5')};function emitEvent(_0xe2ff8d){return function(_0x13a34b,_0x25c990,_0x318e3e){UserVoiceQueueRtEvents['emit'](_0xe2ff8d+':'+_0x13a34b['id'],_0x13a34b);UserVoiceQueueRtEvents[_0x10c4('0x6')](_0xe2ff8d,_0x13a34b);_0x318e3e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x10c4('0x7')](e,emitEvent(event));}}module[_0x10c4('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x1965=['hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners','update','emit'];(function(_0x1c688b,_0x4df102){var _0x4d4577=function(_0x29a41b){while(--_0x29a41b){_0x1c688b['push'](_0x1c688b['shift']());}};_0x4d4577(++_0x4df102);}(_0x1965,0xdb));var _0x5196=function(_0x351c47,_0x2241a2){_0x351c47=_0x351c47-0x0;var _0x43be7f=_0x1965[_0x351c47];return _0x43be7f;};'use strict';var EventEmitter=require(_0x5196('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x5196('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5196('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5196('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f4563){return function(_0x1e130,_0x5f5bcc,_0x53413f){UserVoiceQueueRtEvents[_0x5196('0x4')](_0x2f4563+':'+_0x1e130['id'],_0x1e130);UserVoiceQueueRtEvents[_0x5196('0x4')](_0x2f4563,_0x1e130);_0x53413f(null);};}for(var e in events){if(events[_0x5196('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x5196('0x6')](e,emitEvent(event));}}module[_0x5196('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 46f3bc5..f33df05 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 _0x833c=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x833c,0x1e3));var _0xc833=function(_0x321ce5,_0x44ae68){_0x321ce5=_0x321ce5-0x0;var _0x20e647=_0x833c[_0x321ce5];return _0x20e647;};'use strict';var _=require(_0xc833('0x0'));var util=require(_0xc833('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc833('0x2'));var rimraf=require(_0xc833('0x3'));var config=require(_0xc833('0x4'));var attributes=require(_0xc833('0x5'));module[_0xc833('0x6')]=function(_0x350979,_0x42b932){return _0x350979[_0xc833('0x7')](_0xc833('0x8'),attributes,{'tableName':_0xc833('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x409f=['user_has_voice_queues_rt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x2f5729,_0x579506){var _0x1f456f=function(_0x141d08){while(--_0x141d08){_0x2f5729['push'](_0x2f5729['shift']());}};_0x1f456f(++_0x579506);}(_0x409f,0x9d));var _0xf409=function(_0x9ec2a0,_0x52ab6b){_0x9ec2a0=_0x9ec2a0-0x0;var _0x183700=_0x409f[_0x9ec2a0];return _0x183700;};'use strict';var _=require('lodash');var util=require(_0xf409('0x0'));var logger=require(_0xf409('0x1'))(_0xf409('0x2'));var moment=require(_0xf409('0x3'));var BPromise=require(_0xf409('0x4'));var rp=require(_0xf409('0x5'));var fs=require('fs');var path=require(_0xf409('0x6'));var rimraf=require(_0xf409('0x7'));var config=require(_0xf409('0x8'));var attributes=require(_0xf409('0x9'));module[_0xf409('0xa')]=function(_0x20c26f,_0x3ac54d){return _0x20c26f[_0xf409('0xb')]('UserVoiceQueueRt',attributes,{'tableName':_0xf409('0xc'),'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 ed5032f..2957919 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 _0xad80=['findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses'];(function(_0x4c9ca9,_0x39df16){var _0x204104=function(_0x4dd761){while(--_0x4dd761){_0x4c9ca9['push'](_0x4c9ca9['shift']());}};_0x204104(++_0x39df16);}(_0xad80,0x1eb));var _0x0ad8=function(_0x24c0db,_0x25e2ce){_0x24c0db=_0x24c0db-0x0;var _0x1441bf=_0xad80[_0x24c0db];return _0x1441bf;};'use strict';var _=require(_0x0ad8('0x0'));var util=require(_0x0ad8('0x1'));var moment=require(_0x0ad8('0x2'));var BPromise=require(_0x0ad8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ad8('0x4'));var db=require(_0x0ad8('0x5'))['db'];var utils=require(_0x0ad8('0x6'));var logger=require(_0x0ad8('0x7'))(_0x0ad8('0x8'));var config=require(_0x0ad8('0x9'));var jayson=require(_0x0ad8('0xa'));var client=jayson[_0x0ad8('0xb')][_0x0ad8('0xc')]({'port':0x232a});config[_0x0ad8('0xd')]=_[_0x0ad8('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0ad8('0xf'))(new Redis(config[_0x0ad8('0xd')]));require('./userVoiceQueueRt.socket')[_0x0ad8('0x10')](socket);function respondWithRpcPromise(_0x425a89,_0x1ce99e,_0x501854){return new BPromise(function(_0x2e00d2,_0x3016ec){return client[_0x0ad8('0x11')](_0x425a89,_0x501854)['then'](function(_0x409412){logger[_0x0ad8('0x12')](_0x0ad8('0x13'),_0x1ce99e,_0x0ad8('0x14'));logger['debug'](_0x0ad8('0x15'),_0x1ce99e,_0x0ad8('0x14'),JSON[_0x0ad8('0x16')](_0x409412));if(_0x409412['error']){if(_0x409412[_0x0ad8('0x17')][_0x0ad8('0x18')]===0x1f4){logger[_0x0ad8('0x17')](_0x0ad8('0x13'),_0x1ce99e,_0x409412[_0x0ad8('0x17')]['message']);return _0x3016ec(_0x409412[_0x0ad8('0x17')][_0x0ad8('0x19')]);}logger[_0x0ad8('0x17')](_0x0ad8('0x13'),_0x1ce99e,_0x409412[_0x0ad8('0x17')][_0x0ad8('0x19')]);return _0x2e00d2(_0x409412[_0x0ad8('0x17')][_0x0ad8('0x19')]);}else{logger[_0x0ad8('0x12')](_0x0ad8('0x13'),_0x1ce99e,_0x0ad8('0x14'));_0x2e00d2(_0x409412[_0x0ad8('0x1a')][_0x0ad8('0x19')]);}})[_0x0ad8('0x1b')](function(_0x2c58d4){logger[_0x0ad8('0x17')](_0x0ad8('0x13'),_0x1ce99e,_0x2c58d4);_0x3016ec(_0x2c58d4);});});}exports[_0x0ad8('0x1c')]=function(_0x44a8cd){var _0x5eb370=this;return new Promise(function(_0x29d68b,_0x273c60){return db['UserVoiceQueueRt'][_0x0ad8('0x1d')]({'raw':_0x44a8cd[_0x0ad8('0x1e')]?_0x44a8cd[_0x0ad8('0x1e')][_0x0ad8('0x1f')]===undefined?!![]:![]:!![],'where':_0x44a8cd['options']?_0x44a8cd[_0x0ad8('0x1e')][_0x0ad8('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x0ad8('0x21'),db[_0x0ad8('0x22')]['fn']('IF',db[_0x0ad8('0x22')][_0x0ad8('0x23')](_0x0ad8('0x24')))),_0x0ad8('0x25')]]})[_0x0ad8('0x26')](function(_0x48959c){logger[_0x0ad8('0x12')]('GetVoiceQueueRtPauses',_0x44a8cd);logger[_0x0ad8('0x27')]('GetVoiceQueueRtPauses',_0x44a8cd,JSON[_0x0ad8('0x16')](_0x48959c));_0x29d68b(_0x48959c);})[_0x0ad8('0x1b')](function(_0x31b542){logger['error'](_0x0ad8('0x1c'),_0x31b542[_0x0ad8('0x19')],_0x44a8cd);_0x273c60(_0x5eb370[_0x0ad8('0x17')](0x1f4,_0x31b542[_0x0ad8('0x19')]));});});}; \ No newline at end of file +var _0x2179=['message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c7e9f,_0x204da1){var _0x5beb22=function(_0x2bb1f1){while(--_0x2bb1f1){_0x1c7e9f['push'](_0x1c7e9f['shift']());}};_0x5beb22(++_0x204da1);}(_0x2179,0xf6));var _0x9217=function(_0x3dfa3e,_0x293558){_0x3dfa3e=_0x3dfa3e-0x0;var _0x3ff9ed=_0x2179[_0x3dfa3e];return _0x3ff9ed;};'use strict';var _=require(_0x9217('0x0'));var util=require(_0x9217('0x1'));var moment=require(_0x9217('0x2'));var BPromise=require(_0x9217('0x3'));var rs=require(_0x9217('0x4'));var fs=require('fs');var Redis=require(_0x9217('0x5'));var db=require(_0x9217('0x6'))['db'];var utils=require(_0x9217('0x7'));var logger=require(_0x9217('0x8'))('rpc');var config=require(_0x9217('0x9'));var jayson=require(_0x9217('0xa'));var client=jayson['client'][_0x9217('0xb')]({'port':0x232a});config['redis']=_[_0x9217('0xc')](config['redis'],{'host':_0x9217('0xd'),'port':0x18eb});var socket=require(_0x9217('0xe'))(new Redis(config[_0x9217('0xf')]));require(_0x9217('0x10'))[_0x9217('0x11')](socket);function respondWithRpcPromise(_0x1930eb,_0x5d7a88,_0x415928){return new BPromise(function(_0x57c2b6,_0x597073){return client[_0x9217('0x12')](_0x1930eb,_0x415928)[_0x9217('0x13')](function(_0x900ed){logger[_0x9217('0x14')](_0x9217('0x15'),_0x5d7a88,_0x9217('0x16'));logger[_0x9217('0x17')](_0x9217('0x18'),_0x5d7a88,_0x9217('0x16'),JSON[_0x9217('0x19')](_0x900ed));if(_0x900ed[_0x9217('0x1a')]){if(_0x900ed[_0x9217('0x1a')]['code']===0x1f4){logger[_0x9217('0x1a')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d7a88,_0x900ed[_0x9217('0x1a')][_0x9217('0x1b')]);return _0x597073(_0x900ed[_0x9217('0x1a')][_0x9217('0x1b')]);}logger[_0x9217('0x1a')](_0x9217('0x15'),_0x5d7a88,_0x900ed[_0x9217('0x1a')]['message']);return _0x57c2b6(_0x900ed['error'][_0x9217('0x1b')]);}else{logger[_0x9217('0x14')](_0x9217('0x15'),_0x5d7a88,'request\x20sent');_0x57c2b6(_0x900ed['result'][_0x9217('0x1b')]);}})[_0x9217('0x1c')](function(_0x4189f3){logger[_0x9217('0x1a')](_0x9217('0x15'),_0x5d7a88,_0x4189f3);_0x597073(_0x4189f3);});});}exports[_0x9217('0x1d')]=function(_0x198659){var _0x5d16a3=this;return new Promise(function(_0x256088,_0x3ce700){return db[_0x9217('0x1e')][_0x9217('0x1f')]({'raw':_0x198659[_0x9217('0x20')]?_0x198659[_0x9217('0x20')][_0x9217('0x21')]===undefined?!![]:![]:!![],'where':_0x198659[_0x9217('0x20')]?_0x198659[_0x9217('0x20')]['where']||null:null,'attributes':[[db[_0x9217('0x22')]['fn'](_0x9217('0x23'),db[_0x9217('0x22')]['fn']('IF',db[_0x9217('0x22')][_0x9217('0x24')](_0x9217('0x25')))),_0x9217('0x26')]]})[_0x9217('0x13')](function(_0x49c477){logger['info'](_0x9217('0x1d'),_0x198659);logger[_0x9217('0x17')](_0x9217('0x1d'),_0x198659,JSON[_0x9217('0x19')](_0x49c477));_0x256088(_0x49c477);})[_0x9217('0x1c')](function(_0x32058a){logger[_0x9217('0x1a')]('GetVoiceQueueRtPauses',_0x32058a[_0x9217('0x1b')],_0x198659);_0x3ce700(_0x5d16a3['error'](0x1f4,_0x32058a[_0x9217('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5e40a85..f70ef0f 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 _0xf483=['length','userVoiceQueueRt:','save','update','emit'];(function(_0x6d512f,_0x23a59a){var _0x130df8=function(_0x22ce27){while(--_0x22ce27){_0x6d512f['push'](_0x6d512f['shift']());}};_0x130df8(++_0x23a59a);}(_0xf483,0xf2));var _0x3f48=function(_0x313be9,_0x1de21d){_0x313be9=_0x313be9-0x0;var _0x2ebcd2=_0xf483[_0x313be9];return _0x2ebcd2;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x3f48('0x0'),'remove',_0x3f48('0x1')];function createListener(_0x1a8c22,_0x2f4d00){return function(_0x413bf0){_0x2f4d00[_0x3f48('0x2')](_0x1a8c22,_0x413bf0);};}function removeListener(_0x312d9c,_0x5deb61){return function(){UserVoiceQueueRtEvents['removeListener'](_0x312d9c,_0x5deb61);};}exports['register']=function(_0x1a3447){for(var _0x16905e=0x0,_0x524a4f=events[_0x3f48('0x3')];_0x16905e<_0x524a4f;_0x16905e++){var _0x2f1ca5=events[_0x16905e];var _0x1746fd=createListener(_0x3f48('0x4')+_0x2f1ca5,_0x1a3447);UserVoiceQueueRtEvents['on'](_0x2f1ca5,_0x1746fd);}}; \ No newline at end of file +var _0xe14a=['removeListener','register','length','userVoiceQueueRt:'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0xe14a,0x94));var _0xae14=function(_0xb1a272,_0x350492){_0xb1a272=_0xb1a272-0x0;var _0x3e95f1=_0xe14a[_0xb1a272];return _0x3e95f1;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save','remove','update'];function createListener(_0x4ed72e,_0x14d5a7){return function(_0xb92ae1){_0x14d5a7['emit'](_0x4ed72e,_0xb92ae1);};}function removeListener(_0x16bd5f,_0x2736f8){return function(){UserVoiceQueueRtEvents[_0xae14('0x0')](_0x16bd5f,_0x2736f8);};}exports[_0xae14('0x1')]=function(_0x2b5138){for(var _0x3a6279=0x0,_0xbdeb24=events[_0xae14('0x2')];_0x3a6279<_0xbdeb24;_0x3a6279++){var _0x19d9b8=events[_0x3a6279];var _0x1efd2c=createListener(_0xae14('0x3')+_0x19d9b8,_0x2b5138);UserVoiceQueueRtEvents['on'](_0x19d9b8,_0x1efd2c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3d35998..2ac197e 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2891f5,_0x2c38dc){var _0xe2c890=function(_0x58074c){while(--_0x58074c){_0x2891f5['push'](_0x2891f5['shift']());}};_0xe2c890(++_0x2c38dc);}(_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(_0x2eb234,_0x595d3e){var _0xbe265a=function(_0x19af72){while(--_0x19af72){_0x2eb234['push'](_0x2eb234['shift']());}};_0xbe265a(++_0x595d3e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xcb91[_0xf26c2e];return _0x46ecb4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9384977..b69437a 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 _0x345d=['INTEGER','sequelize'];(function(_0x802939,_0x4c49bc){var _0x269d03=function(_0xe41661){while(--_0xe41661){_0x802939['push'](_0x802939['shift']());}};_0x269d03(++_0x4c49bc);}(_0x345d,0x16f));var _0xd345=function(_0x230fd5,_0x4ae28c){_0x230fd5=_0x230fd5-0x0;var _0x3e2017=_0x345d[_0x230fd5];return _0x3e2017;};'use strict';var Sequelize=require(_0xd345('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd345('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0811=['exports','INTEGER','sequelize'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x0811,0xb9));var _0x1081=function(_0x501c32,_0x2f24c9){_0x501c32=_0x501c32-0x0;var _0x9bd372=_0x0811[_0x501c32];return _0x9bd372;};'use strict';var Sequelize=require(_0x1081('0x0'));module[_0x1081('0x1')]={'penalty':{'type':Sequelize[_0x1081('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 3fe8c5b..ddfa6c5 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 _0x018a=['../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e5d57,_0x45a777){var _0x584d7c=function(_0x1ff0b6){while(--_0x1ff0b6){_0x2e5d57['push'](_0x2e5d57['shift']());}};_0x584d7c(++_0x45a777);}(_0x018a,0xbb));var _0xa018=function(_0x18b73e,_0x39b3f2){_0x18b73e=_0x18b73e-0x0;var _0x25fa91=_0x018a[_0x18b73e];return _0x25fa91;};'use strict';var _=require(_0xa018('0x0'));var util=require(_0xa018('0x1'));var logger=require('../../config/logger')(_0xa018('0x2'));var moment=require(_0xa018('0x3'));var BPromise=require(_0xa018('0x4'));var rp=require(_0xa018('0x5'));var fs=require('fs');var path=require(_0xa018('0x6'));var rimraf=require(_0xa018('0x7'));var config=require(_0xa018('0x8'));var attributes=require(_0xa018('0x9'));module[_0xa018('0xa')]=function(_0x5d666e,_0x21c29f){return _0x5d666e[_0xa018('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0xa018('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28a7=['./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x43caf0,_0x44d398){var _0x57b291=function(_0x4a4913){while(--_0x4a4913){_0x43caf0['push'](_0x43caf0['shift']());}};_0x57b291(++_0x44d398);}(_0x28a7,0x1d8));var _0x728a=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x28a7[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x728a('0x0'))('api');var moment=require(_0x728a('0x1'));var BPromise=require(_0x728a('0x2'));var rp=require(_0x728a('0x3'));var fs=require('fs');var path=require(_0x728a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x728a('0x5'));module[_0x728a('0x6')]=function(_0x56d257,_0x3c2068){return _0x56d257[_0x728a('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0x728a('0x8'),'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 5f23b25..acfd263 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 _0x1a4b=['debug','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x38797a,_0x3dade2){var _0x289ca6=function(_0x3d28d9){while(--_0x3d28d9){_0x38797a['push'](_0x38797a['shift']());}};_0x289ca6(++_0x3dade2);}(_0x1a4b,0x1d1));var _0xb1a4=function(_0x3ebbea,_0x1a5fe6){_0x3ebbea=_0x3ebbea-0x0;var _0x4102a5=_0x1a4b[_0x3ebbea];return _0x4102a5;};'use strict';var _=require(_0xb1a4('0x0'));var util=require(_0xb1a4('0x1'));var moment=require('moment');var BPromise=require(_0xb1a4('0x2'));var rs=require(_0xb1a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1a4('0x4'))['db'];var utils=require(_0xb1a4('0x5'));var logger=require(_0xb1a4('0x6'))(_0xb1a4('0x7'));var config=require('../../config/environment');var jayson=require(_0xb1a4('0x8'));var client=jayson[_0xb1a4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25a2ee,_0x1540fd,_0x1dca32){return new BPromise(function(_0x5e73a4,_0x125e19){return client[_0xb1a4('0xa')](_0x25a2ee,_0x1dca32)[_0xb1a4('0xb')](function(_0x2395f5){logger[_0xb1a4('0xc')](_0xb1a4('0xd'),_0x1540fd,_0xb1a4('0xe'));logger[_0xb1a4('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1540fd,_0xb1a4('0xe'),JSON['stringify'](_0x2395f5));if(_0x2395f5[_0xb1a4('0x10')]){if(_0x2395f5[_0xb1a4('0x10')][_0xb1a4('0x11')]===0x1f4){logger['error'](_0xb1a4('0xd'),_0x1540fd,_0x2395f5[_0xb1a4('0x10')]['message']);return _0x125e19(_0x2395f5[_0xb1a4('0x10')]['message']);}logger[_0xb1a4('0x10')](_0xb1a4('0xd'),_0x1540fd,_0x2395f5[_0xb1a4('0x10')][_0xb1a4('0x12')]);return _0x5e73a4(_0x2395f5[_0xb1a4('0x10')][_0xb1a4('0x12')]);}else{logger['info'](_0xb1a4('0xd'),_0x1540fd,_0xb1a4('0xe'));_0x5e73a4(_0x2395f5[_0xb1a4('0x13')][_0xb1a4('0x12')]);}})['catch'](function(_0x2a91ae){logger[_0xb1a4('0x10')](_0xb1a4('0xd'),_0x1540fd,_0x2a91ae);_0x125e19(_0x2a91ae);});});} \ No newline at end of file +var _0x9d5b=['rpc','../../config/environment','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dcc78,_0x5a3972){var _0x4c173c=function(_0x2f675f){while(--_0x2f675f){_0x3dcc78['push'](_0x3dcc78['shift']());}};_0x4c173c(++_0x5a3972);}(_0x9d5b,0x98));var _0xb9d5=function(_0x28942f,_0x20eff0){_0x28942f=_0x28942f-0x0;var _0xcd9f6f=_0x9d5b[_0x28942f];return _0xcd9f6f;};'use strict';var _=require(_0xb9d5('0x0'));var util=require(_0xb9d5('0x1'));var moment=require(_0xb9d5('0x2'));var BPromise=require(_0xb9d5('0x3'));var rs=require(_0xb9d5('0x4'));var fs=require('fs');var Redis=require(_0xb9d5('0x5'));var db=require(_0xb9d5('0x6'))['db'];var utils=require(_0xb9d5('0x7'));var logger=require(_0xb9d5('0x8'))(_0xb9d5('0x9'));var config=require(_0xb9d5('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb9d5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x94507d,_0x11a523,_0x2c9a12){return new BPromise(function(_0x32d0f1,_0x397722){return client[_0xb9d5('0xc')](_0x94507d,_0x2c9a12)[_0xb9d5('0xd')](function(_0x9abd75){logger[_0xb9d5('0xe')](_0xb9d5('0xf'),_0x11a523,'request\x20sent');logger[_0xb9d5('0x10')](_0xb9d5('0x11'),_0x11a523,_0xb9d5('0x12'),JSON[_0xb9d5('0x13')](_0x9abd75));if(_0x9abd75['error']){if(_0x9abd75[_0xb9d5('0x14')][_0xb9d5('0x15')]===0x1f4){logger[_0xb9d5('0x14')](_0xb9d5('0xf'),_0x11a523,_0x9abd75['error']['message']);return _0x397722(_0x9abd75[_0xb9d5('0x14')][_0xb9d5('0x16')]);}logger[_0xb9d5('0x14')](_0xb9d5('0xf'),_0x11a523,_0x9abd75[_0xb9d5('0x14')]['message']);return _0x32d0f1(_0x9abd75[_0xb9d5('0x14')][_0xb9d5('0x16')]);}else{logger[_0xb9d5('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x11a523,_0xb9d5('0x12'));_0x32d0f1(_0x9abd75['result'][_0xb9d5('0x16')]);}})['catch'](function(_0x1c3039){logger['error'](_0xb9d5('0xf'),_0x11a523,_0x1c3039);_0x397722(_0x1c3039);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 32708f2..487eea5 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 _0x79a8=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','update','multer'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x79a8,0x1d0));var _0x879a=function(_0x4ed7,_0x14f3ba){_0x4ed7=_0x4ed7-0x0;var _0x584b32=_0x79a8[_0x4ed7];return _0x584b32;};'use strict';var multer=require(_0x879a('0x0'));var util=require('util');var path=require(_0x879a('0x1'));var timeout=require(_0x879a('0x2'));var express=require(_0x879a('0x3'));var router=express['Router']();var fs_extra=require(_0x879a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var controller=require(_0x879a('0x7'));router[_0x879a('0x8')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xa')]);router[_0x879a('0x8')](_0x879a('0xb'),auth['isAuthenticated'](),controller[_0x879a('0xc')]);router['post']('/',auth[_0x879a('0x9')](),controller[_0x879a('0xd')]);router['put'](_0x879a('0xb'),auth[_0x879a('0x9')](),controller[_0x879a('0xe')]);router['delete'](_0x879a('0xb'),auth[_0x879a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x544a=['./variable.controller','get','isAuthenticated','index','post','put','/:id','update','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x544a,0xbd));var _0xa544=function(_0x19daba,_0x2c57d7){_0x19daba=_0x19daba-0x0;var _0x3f7724=_0x544a[_0x19daba];return _0x3f7724;};'use strict';var multer=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var path=require(_0xa544('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa544('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa544('0x4'));var interaction=require(_0xa544('0x5'));var config=require('../../config/environment');var controller=require(_0xa544('0x6'));router[_0xa544('0x7')]('/',auth[_0xa544('0x8')](),controller[_0xa544('0x9')]);router[_0xa544('0x7')]('/:id',auth[_0xa544('0x8')](),controller['show']);router[_0xa544('0xa')]('/',auth[_0xa544('0x8')](),controller['create']);router[_0xa544('0xb')](_0xa544('0xc'),auth[_0xa544('0x8')](),controller[_0xa544('0xd')]);router['delete'](_0xa544('0xc'),auth[_0xa544('0x8')](),controller['destroy']);module[_0xa544('0xe')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index cb3ee2d..5b64758 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 _0xb079=['name','exports','STRING'];(function(_0x3bf97c,_0x4b2d2b){var _0x5c49bb=function(_0x49a20a){while(--_0x49a20a){_0x3bf97c['push'](_0x3bf97c['shift']());}};_0x5c49bb(++_0x4b2d2b);}(_0xb079,0x1c9));var _0x9b07=function(_0x117233,_0xb87fa){_0x117233=_0x117233-0x0;var _0x272e2f=_0xb079[_0x117233];return _0x272e2f;};'use strict';var Sequelize=require('sequelize');module[_0x9b07('0x0')]={'name':{'type':Sequelize[_0x9b07('0x1')],'unique':_0x9b07('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9b07('0x1')]}}; \ No newline at end of file +var _0x367c=['name','exports','STRING'];(function(_0x1abf72,_0x84067c){var _0x11ebc1=function(_0x4abe5f){while(--_0x4abe5f){_0x1abf72['push'](_0x1abf72['shift']());}};_0x11ebc1(++_0x84067c);}(_0x367c,0x1b4));var _0xc367=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x367c[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require('sequelize');module[_0xc367('0x0')]={'name':{'type':Sequelize[_0xc367('0x1')],'unique':_0xc367('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc367('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 8454ec0..0984407 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 _0xa45c=['squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','index','Variable','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2bdaf6,_0x5a48fe){var _0x33c743=function(_0x26e380){while(--_0x26e380){_0x2bdaf6['push'](_0x2bdaf6['shift']());}};_0x33c743(++_0x5a48fe);}(_0xa45c,0x1da));var _0xca45=function(_0x5bed4a,_0x568638){_0x5bed4a=_0x5bed4a-0x0;var _0x280d15=_0xa45c[_0x5bed4a];return _0x280d15;};'use strict';var emlformat=require(_0xca45('0x0'));var rimraf=require(_0xca45('0x1'));var zipdir=require(_0xca45('0x2'));var jsonpatch=require(_0xca45('0x3'));var rp=require(_0xca45('0x4'));var moment=require('moment');var BPromise=require(_0xca45('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xca45('0x6'));var sox=require(_0xca45('0x7'));var csv=require(_0xca45('0x8'));var ejs=require(_0xca45('0x9'));var fs=require('fs');var fs_extra=require(_0xca45('0xa'));var _=require(_0xca45('0xb'));var squel=require(_0xca45('0xc'));var crypto=require(_0xca45('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca45('0xe'));var Redis=require(_0xca45('0xf'));var authService=require(_0xca45('0x10'));var qs=require(_0xca45('0x11'));var as=require(_0xca45('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xca45('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xca45('0x14'))['db'];function respondWithStatusCode(_0x93e2e1,_0x57414b){_0x57414b=_0x57414b||0xcc;return function(_0x17bd34){if(_0x17bd34){return _0x93e2e1[_0xca45('0x15')](_0x57414b);}return _0x93e2e1['status'](_0x57414b)[_0xca45('0x16')]();};}function respondWithResult(_0x1c0b60,_0x569bed){_0x569bed=_0x569bed||0xc8;return function(_0x43aa37){if(_0x43aa37){return _0x1c0b60[_0xca45('0x17')](_0x569bed)[_0xca45('0x18')](_0x43aa37);}};}function respondWithFilteredResult(_0xeffc90,_0x589b97){return function(_0x46db54){if(_0x46db54){var _0x528a0c=typeof _0x589b97[_0xca45('0x19')]===_0xca45('0x1a')&&typeof _0x589b97[_0xca45('0x1b')]===_0xca45('0x1a');var _0x5375b3=_0x46db54[_0xca45('0x1c')];var _0x13aa16=_0x528a0c?0x0:_0x589b97[_0xca45('0x19')];var _0x1d999d=_0x528a0c?_0x46db54[_0xca45('0x1c')]:_0x589b97[_0xca45('0x19')]+_0x589b97[_0xca45('0x1b')];var _0x582ea2;if(_0x1d999d>=_0x5375b3){_0x1d999d=_0x5375b3;_0x582ea2=0xc8;}else{_0x582ea2=0xce;}_0xeffc90[_0xca45('0x17')](_0x582ea2);return _0xeffc90[_0xca45('0x1d')]('Content-Range',_0x13aa16+'-'+_0x1d999d+'/'+_0x5375b3)[_0xca45('0x18')](_0x46db54);}return null;};}function patchUpdates(_0x23f503){return function(_0x1f65bb){try{jsonpatch['apply'](_0x1f65bb,_0x23f503,!![]);}catch(_0x50790c){return BPromise[_0xca45('0x1e')](_0x50790c);}return _0x1f65bb[_0xca45('0x1f')]();};}function saveUpdates(_0x449306,_0x3c1842){return function(_0x4bf727){if(_0x4bf727){return _0x4bf727[_0xca45('0x20')](_0x449306)[_0xca45('0x21')](function(_0x55a0f5){return _0x55a0f5;});}return null;};}function removeEntity(_0x3b0957,_0x57a752){return function(_0x434515){if(_0x434515){return _0x434515['destroy']()['then'](function(){var _0x5560ca=_0x434515[_0xca45('0x22')]({'plain':!![]});var _0x41b885=_0xca45('0x23');return db[_0xca45('0x24')][_0xca45('0x25')]({'where':{'type':_0x41b885,'resourceId':_0x5560ca['id']}})[_0xca45('0x21')](function(){return _0x434515;});})[_0xca45('0x21')](function(){_0x3b0957['status'](0xcc)[_0xca45('0x16')]();});}};}function handleEntityNotFound(_0x28e73e,_0x2d7ccb){return function(_0x3a92bb){if(!_0x3a92bb){_0x28e73e[_0xca45('0x15')](0x194);}return _0x3a92bb;};}function handleError(_0x2d57f1,_0x1c3e27){_0x1c3e27=_0x1c3e27||0x1f4;return function(_0x31c9e7){logger[_0xca45('0x26')](_0x31c9e7[_0xca45('0x27')]);if(_0x31c9e7[_0xca45('0x28')]){delete _0x31c9e7[_0xca45('0x28')];}_0x2d57f1[_0xca45('0x17')](_0x1c3e27)['send'](_0x31c9e7);};}exports[_0xca45('0x29')]=function(_0x4c3939,_0x5beff2){var _0x514c55={},_0xe91a80={},_0x5ed454={'count':0x0,'rows':[]};var _0x38e20b=_['map'](db[_0xca45('0x2a')][_0xca45('0x2b')],function(_0x23e867){return{'name':_0x23e867[_0xca45('0x2c')],'type':_0x23e867['type'][_0xca45('0x2d')]};});_0xe91a80[_0xca45('0x2e')]=_[_0xca45('0x2f')](_0x38e20b,_0xca45('0x28'));_0xe91a80['query']=_[_0xca45('0x30')](_0x4c3939[_0xca45('0x31')]);_0xe91a80[_0xca45('0x32')]=_[_0xca45('0x33')](_0xe91a80[_0xca45('0x2e')],_0xe91a80[_0xca45('0x31')]);_0x514c55['attributes']=_[_0xca45('0x33')](_0xe91a80[_0xca45('0x2e')],qs[_0xca45('0x34')](_0x4c3939['query'][_0xca45('0x34')]));_0x514c55[_0xca45('0x35')]=_0x514c55[_0xca45('0x35')][_0xca45('0x36')]?_0x514c55[_0xca45('0x35')]:_0xe91a80[_0xca45('0x2e')];if(!_0x4c3939[_0xca45('0x31')][_0xca45('0x37')](_0xca45('0x38'))){_0x514c55['limit']=qs[_0xca45('0x1b')](_0x4c3939[_0xca45('0x31')][_0xca45('0x1b')]);_0x514c55[_0xca45('0x19')]=qs[_0xca45('0x19')](_0x4c3939[_0xca45('0x31')][_0xca45('0x19')]);}_0x514c55[_0xca45('0x39')]=qs['sort'](_0x4c3939['query'][_0xca45('0x3a')]);_0x514c55[_0xca45('0x3b')]=qs[_0xca45('0x32')](_[_0xca45('0x3c')](_0x4c3939[_0xca45('0x31')],_0xe91a80[_0xca45('0x32')]),_0x38e20b);if(_0x4c3939['query'][_0xca45('0x3d')]){_0x514c55[_0xca45('0x3b')]=_[_0xca45('0x3e')](_0x514c55[_0xca45('0x3b')],{'$or':_[_0xca45('0x2f')](_0x38e20b,function(_0x316c32){if(_0x316c32[_0xca45('0x3f')]!==_0xca45('0x40')){var _0xa10d19={};_0xa10d19[_0x316c32[_0xca45('0x28')]]={'$like':'%'+_0x4c3939['query'][_0xca45('0x3d')]+'%'};return _0xa10d19;}})});}_0x514c55=_[_0xca45('0x3e')]({},_0x514c55,_0x4c3939[_0xca45('0x41')]);var _0x2cede3={'where':_0x514c55['where']};return db[_0xca45('0x2a')]['count'](_0x2cede3)[_0xca45('0x21')](function(_0x4d15e2){_0x5ed454[_0xca45('0x1c')]=_0x4d15e2;if(_0x4c3939['query'][_0xca45('0x42')]){_0x514c55['include']=[{'all':!![]}];}return db[_0xca45('0x2a')][_0xca45('0x43')](_0x514c55);})[_0xca45('0x21')](function(_0x2c12f9){_0x5ed454['rows']=_0x2c12f9;return _0x5ed454;})['then'](respondWithFilteredResult(_0x5beff2,_0x514c55))[_0xca45('0x44')](handleError(_0x5beff2,null));};exports[_0xca45('0x45')]=function(_0x44ae5e,_0x390e0d){var _0x2a7f01={'raw':!![],'where':{'id':_0x44ae5e['params']['id']}},_0x147e7a={};_0x147e7a[_0xca45('0x2e')]=_[_0xca45('0x30')](db['Variable'][_0xca45('0x2b')]);_0x147e7a[_0xca45('0x31')]=_[_0xca45('0x30')](_0x44ae5e[_0xca45('0x31')]);_0x147e7a['filters']=_[_0xca45('0x33')](_0x147e7a['model'],_0x147e7a[_0xca45('0x31')]);_0x2a7f01[_0xca45('0x35')]=_[_0xca45('0x33')](_0x147e7a[_0xca45('0x2e')],qs[_0xca45('0x34')](_0x44ae5e['query'][_0xca45('0x34')]));_0x2a7f01['attributes']=_0x2a7f01[_0xca45('0x35')][_0xca45('0x36')]?_0x2a7f01[_0xca45('0x35')]:_0x147e7a[_0xca45('0x2e')];if(_0x44ae5e[_0xca45('0x31')][_0xca45('0x42')]){_0x2a7f01[_0xca45('0x46')]=[{'all':!![]}];}_0x2a7f01=_['merge']({},_0x2a7f01,_0x44ae5e['options']);return db[_0xca45('0x2a')][_0xca45('0x47')](_0x2a7f01)[_0xca45('0x21')](handleEntityNotFound(_0x390e0d,null))[_0xca45('0x21')](respondWithResult(_0x390e0d,null))[_0xca45('0x44')](handleError(_0x390e0d,null));};exports[_0xca45('0x48')]=function(_0x111406,_0x1e4107){return db[_0xca45('0x2a')]['create'](_0x111406[_0xca45('0x49')],{})[_0xca45('0x21')](function(_0x5d365f){var _0xe34772=_0x111406[_0xca45('0x4a')][_0xca45('0x22')]({'plain':!![]});if(!_0xe34772)throw new Error(_0xca45('0x4b'));if(_0xe34772[_0xca45('0x4c')]===_0xca45('0x4a')){var _0x3dd04b=_0x5d365f[_0xca45('0x22')]({'plain':!![]});var _0x3c0d61='Variables';return db[_0xca45('0x4d')][_0xca45('0x47')]({'where':{'name':_0x3c0d61,'userProfileId':_0xe34772['userProfileId']},'raw':!![]})[_0xca45('0x21')](function(_0x1a2df6){if(_0x1a2df6&&_0x1a2df6[_0xca45('0x4e')]===0x0){return db['UserProfileResource'][_0xca45('0x48')]({'name':_0x3dd04b[_0xca45('0x28')],'resourceId':_0x3dd04b['id'],'type':_0x1a2df6[_0xca45('0x28')],'sectionId':_0x1a2df6['id']},{})[_0xca45('0x21')](function(){return _0x5d365f;});}else{return _0x5d365f;}})[_0xca45('0x44')](function(_0x3be2f5){logger[_0xca45('0x26')](_0xca45('0x4f'),_0x3be2f5);throw _0x3be2f5;});}return _0x5d365f;})[_0xca45('0x21')](respondWithResult(_0x1e4107,0xc9))[_0xca45('0x44')](handleError(_0x1e4107,null));};exports['update']=function(_0x4d20,_0x24483a){if(_0x4d20[_0xca45('0x49')]['id']){delete _0x4d20[_0xca45('0x49')]['id'];}return db[_0xca45('0x2a')]['find']({'where':{'id':_0x4d20[_0xca45('0x50')]['id']}})[_0xca45('0x21')](handleEntityNotFound(_0x24483a,null))[_0xca45('0x21')](saveUpdates(_0x4d20[_0xca45('0x49')],null))[_0xca45('0x21')](respondWithResult(_0x24483a,null))[_0xca45('0x44')](handleError(_0x24483a,null));};exports[_0xca45('0x25')]=function(_0x4a1d7b,_0xadf64c){return db[_0xca45('0x2a')][_0xca45('0x47')]({'where':{'id':_0x4a1d7b[_0xca45('0x50')]['id']}})[_0xca45('0x21')](handleEntityNotFound(_0xadf64c,null))['then'](removeEntity(_0xadf64c,null))[_0xca45('0x44')](handleError(_0xadf64c,null));}; \ No newline at end of file +var _0xc5cc=['includeAll','include','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','Variables','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5cc,0x1ce));var _0xcc5c=function(_0x7d1b2c,_0x2d2bde){_0x7d1b2c=_0x7d1b2c-0x0;var _0x5a2136=_0xc5cc[_0x7d1b2c];return _0x5a2136;};'use strict';var emlformat=require(_0xcc5c('0x0'));var rimraf=require(_0xcc5c('0x1'));var zipdir=require(_0xcc5c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc5c('0x3'));var moment=require(_0xcc5c('0x4'));var BPromise=require(_0xcc5c('0x5'));var Mustache=require(_0xcc5c('0x6'));var util=require(_0xcc5c('0x7'));var path=require(_0xcc5c('0x8'));var sox=require('sox');var csv=require(_0xcc5c('0x9'));var ejs=require(_0xcc5c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcc5c('0xb'));var crypto=require(_0xcc5c('0xc'));var jsforce=require(_0xcc5c('0xd'));var deskjs=require(_0xcc5c('0xe'));var toCsv=require(_0xcc5c('0x9'));var querystring=require(_0xcc5c('0xf'));var Papa=require(_0xcc5c('0x10'));var Redis=require(_0xcc5c('0x11'));var authService=require(_0xcc5c('0x12'));var qs=require(_0xcc5c('0x13'));var as=require(_0xcc5c('0x14'));var hardwareService=require(_0xcc5c('0x15'));var logger=require(_0xcc5c('0x16'))(_0xcc5c('0x17'));var utils=require(_0xcc5c('0x18'));var config=require(_0xcc5c('0x19'));var licenseUtil=require(_0xcc5c('0x1a'));var db=require(_0xcc5c('0x1b'))['db'];function respondWithStatusCode(_0xf6ae86,_0x1ce410){_0x1ce410=_0x1ce410||0xcc;return function(_0x181249){if(_0x181249){return _0xf6ae86[_0xcc5c('0x1c')](_0x1ce410);}return _0xf6ae86[_0xcc5c('0x1d')](_0x1ce410)['end']();};}function respondWithResult(_0x538b21,_0x60ea26){_0x60ea26=_0x60ea26||0xc8;return function(_0x508329){if(_0x508329){return _0x538b21[_0xcc5c('0x1d')](_0x60ea26)[_0xcc5c('0x1e')](_0x508329);}};}function respondWithFilteredResult(_0x16adb9,_0x3af0c4){return function(_0x288c10){if(_0x288c10){var _0x5b4b61=typeof _0x3af0c4[_0xcc5c('0x1f')]==='undefined'&&typeof _0x3af0c4['limit']===_0xcc5c('0x20');var _0x22aa60=_0x288c10[_0xcc5c('0x21')];var _0x18e4af=_0x5b4b61?0x0:_0x3af0c4[_0xcc5c('0x1f')];var _0x1a3dab=_0x5b4b61?_0x288c10['count']:_0x3af0c4['offset']+_0x3af0c4[_0xcc5c('0x22')];var _0x483dd7;if(_0x1a3dab>=_0x22aa60){_0x1a3dab=_0x22aa60;_0x483dd7=0xc8;}else{_0x483dd7=0xce;}_0x16adb9[_0xcc5c('0x1d')](_0x483dd7);return _0x16adb9['set'](_0xcc5c('0x23'),_0x18e4af+'-'+_0x1a3dab+'/'+_0x22aa60)[_0xcc5c('0x1e')](_0x288c10);}return null;};}function patchUpdates(_0x121eaf){return function(_0x184c6e){try{jsonpatch[_0xcc5c('0x24')](_0x184c6e,_0x121eaf,!![]);}catch(_0x5c9495){return BPromise[_0xcc5c('0x25')](_0x5c9495);}return _0x184c6e[_0xcc5c('0x26')]();};}function saveUpdates(_0x44709a,_0x2c95f7){return function(_0x5971e3){if(_0x5971e3){return _0x5971e3[_0xcc5c('0x27')](_0x44709a)[_0xcc5c('0x28')](function(_0xbc1376){return _0xbc1376;});}return null;};}function removeEntity(_0x1edc7c,_0x1ccd78){return function(_0x116a2c){if(_0x116a2c){return _0x116a2c['destroy']()['then'](function(){var _0x5f2469=_0x116a2c['get']({'plain':!![]});var _0x4388a1=_0xcc5c('0x29');return db[_0xcc5c('0x2a')][_0xcc5c('0x2b')]({'where':{'type':_0x4388a1,'resourceId':_0x5f2469['id']}})[_0xcc5c('0x28')](function(){return _0x116a2c;});})[_0xcc5c('0x28')](function(){_0x1edc7c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2326db,_0x8f915e){return function(_0xa9a0d1){if(!_0xa9a0d1){_0x2326db[_0xcc5c('0x1c')](0x194);}return _0xa9a0d1;};}function handleError(_0x4930e5,_0x248034){_0x248034=_0x248034||0x1f4;return function(_0x151194){logger[_0xcc5c('0x2c')](_0x151194[_0xcc5c('0x2d')]);if(_0x151194[_0xcc5c('0x2e')]){delete _0x151194[_0xcc5c('0x2e')];}_0x4930e5['status'](_0x248034)[_0xcc5c('0x2f')](_0x151194);};}exports[_0xcc5c('0x30')]=function(_0x3c9cd0,_0x49f0ae){var _0x3269b3={},_0x7ab6cf={},_0x4491db={'count':0x0,'rows':[]};var _0x4c34b6=_[_0xcc5c('0x31')](db[_0xcc5c('0x32')][_0xcc5c('0x33')],function(_0x5a4fc7){return{'name':_0x5a4fc7[_0xcc5c('0x34')],'type':_0x5a4fc7[_0xcc5c('0x35')][_0xcc5c('0x36')]};});_0x7ab6cf['model']=_[_0xcc5c('0x31')](_0x4c34b6,_0xcc5c('0x2e'));_0x7ab6cf[_0xcc5c('0x37')]=_[_0xcc5c('0x38')](_0x3c9cd0['query']);_0x7ab6cf[_0xcc5c('0x39')]=_[_0xcc5c('0x3a')](_0x7ab6cf[_0xcc5c('0x3b')],_0x7ab6cf[_0xcc5c('0x37')]);_0x3269b3[_0xcc5c('0x3c')]=_[_0xcc5c('0x3a')](_0x7ab6cf['model'],qs['fields'](_0x3c9cd0['query'][_0xcc5c('0x3d')]));_0x3269b3[_0xcc5c('0x3c')]=_0x3269b3['attributes'][_0xcc5c('0x3e')]?_0x3269b3[_0xcc5c('0x3c')]:_0x7ab6cf[_0xcc5c('0x3b')];if(!_0x3c9cd0[_0xcc5c('0x37')][_0xcc5c('0x3f')](_0xcc5c('0x40'))){_0x3269b3[_0xcc5c('0x22')]=qs[_0xcc5c('0x22')](_0x3c9cd0[_0xcc5c('0x37')][_0xcc5c('0x22')]);_0x3269b3[_0xcc5c('0x1f')]=qs['offset'](_0x3c9cd0['query']['offset']);}_0x3269b3[_0xcc5c('0x41')]=qs[_0xcc5c('0x42')](_0x3c9cd0[_0xcc5c('0x37')]['sort']);_0x3269b3[_0xcc5c('0x43')]=qs[_0xcc5c('0x39')](_['pick'](_0x3c9cd0[_0xcc5c('0x37')],_0x7ab6cf[_0xcc5c('0x39')]),_0x4c34b6);if(_0x3c9cd0[_0xcc5c('0x37')][_0xcc5c('0x44')]){_0x3269b3[_0xcc5c('0x43')]=_['merge'](_0x3269b3[_0xcc5c('0x43')],{'$or':_['map'](_0x4c34b6,function(_0x39d7e0){if(_0x39d7e0['type']!==_0xcc5c('0x45')){var _0x1acefa={};_0x1acefa[_0x39d7e0[_0xcc5c('0x2e')]]={'$like':'%'+_0x3c9cd0[_0xcc5c('0x37')][_0xcc5c('0x44')]+'%'};return _0x1acefa;}})});}_0x3269b3=_[_0xcc5c('0x46')]({},_0x3269b3,_0x3c9cd0[_0xcc5c('0x47')]);var _0x1e7657={'where':_0x3269b3['where']};return db['Variable'][_0xcc5c('0x21')](_0x1e7657)['then'](function(_0x18265f){_0x4491db[_0xcc5c('0x21')]=_0x18265f;if(_0x3c9cd0[_0xcc5c('0x37')][_0xcc5c('0x48')]){_0x3269b3[_0xcc5c('0x49')]=[{'all':!![]}];}return db[_0xcc5c('0x32')][_0xcc5c('0x4a')](_0x3269b3);})[_0xcc5c('0x28')](function(_0x1ed23b){_0x4491db[_0xcc5c('0x4b')]=_0x1ed23b;return _0x4491db;})[_0xcc5c('0x28')](respondWithFilteredResult(_0x49f0ae,_0x3269b3))[_0xcc5c('0x4c')](handleError(_0x49f0ae,null));};exports[_0xcc5c('0x4d')]=function(_0x51526b,_0x53a432){var _0x3df574={'raw':!![],'where':{'id':_0x51526b['params']['id']}},_0x5afe0c={};_0x5afe0c[_0xcc5c('0x3b')]=_['keys'](db[_0xcc5c('0x32')][_0xcc5c('0x33')]);_0x5afe0c[_0xcc5c('0x37')]=_[_0xcc5c('0x38')](_0x51526b[_0xcc5c('0x37')]);_0x5afe0c['filters']=_[_0xcc5c('0x3a')](_0x5afe0c[_0xcc5c('0x3b')],_0x5afe0c['query']);_0x3df574[_0xcc5c('0x3c')]=_[_0xcc5c('0x3a')](_0x5afe0c['model'],qs[_0xcc5c('0x3d')](_0x51526b[_0xcc5c('0x37')][_0xcc5c('0x3d')]));_0x3df574['attributes']=_0x3df574[_0xcc5c('0x3c')][_0xcc5c('0x3e')]?_0x3df574[_0xcc5c('0x3c')]:_0x5afe0c[_0xcc5c('0x3b')];if(_0x51526b[_0xcc5c('0x37')]['includeAll']){_0x3df574[_0xcc5c('0x49')]=[{'all':!![]}];}_0x3df574=_['merge']({},_0x3df574,_0x51526b[_0xcc5c('0x47')]);return db[_0xcc5c('0x32')]['find'](_0x3df574)[_0xcc5c('0x28')](handleEntityNotFound(_0x53a432,null))[_0xcc5c('0x28')](respondWithResult(_0x53a432,null))[_0xcc5c('0x4c')](handleError(_0x53a432,null));};exports[_0xcc5c('0x4e')]=function(_0xb935fb,_0x59a7f7){return db[_0xcc5c('0x32')]['create'](_0xb935fb[_0xcc5c('0x4f')],{})['then'](function(_0x67d3d4){var _0x474e43=_0xb935fb['user']['get']({'plain':!![]});if(!_0x474e43)throw new Error(_0xcc5c('0x50'));if(_0x474e43[_0xcc5c('0x51')]===_0xcc5c('0x52')){var _0xa31e14=_0x67d3d4[_0xcc5c('0x53')]({'plain':!![]});var _0x4d8fba=_0xcc5c('0x29');return db[_0xcc5c('0x54')][_0xcc5c('0x55')]({'where':{'name':_0x4d8fba,'userProfileId':_0x474e43[_0xcc5c('0x56')]},'raw':!![]})[_0xcc5c('0x28')](function(_0x1676bd){if(_0x1676bd&&_0x1676bd[_0xcc5c('0x57')]===0x0){return db[_0xcc5c('0x2a')]['create']({'name':_0xa31e14['name'],'resourceId':_0xa31e14['id'],'type':_0x1676bd[_0xcc5c('0x2e')],'sectionId':_0x1676bd['id']},{})[_0xcc5c('0x28')](function(){return _0x67d3d4;});}else{return _0x67d3d4;}})['catch'](function(_0x34fec9){logger[_0xcc5c('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34fec9);throw _0x34fec9;});}return _0x67d3d4;})[_0xcc5c('0x28')](respondWithResult(_0x59a7f7,0xc9))[_0xcc5c('0x4c')](handleError(_0x59a7f7,null));};exports[_0xcc5c('0x27')]=function(_0x38177a,_0xd06a98){if(_0x38177a[_0xcc5c('0x4f')]['id']){delete _0x38177a[_0xcc5c('0x4f')]['id'];}return db[_0xcc5c('0x32')][_0xcc5c('0x55')]({'where':{'id':_0x38177a[_0xcc5c('0x58')]['id']}})[_0xcc5c('0x28')](handleEntityNotFound(_0xd06a98,null))[_0xcc5c('0x28')](saveUpdates(_0x38177a[_0xcc5c('0x4f')],null))[_0xcc5c('0x28')](respondWithResult(_0xd06a98,null))['catch'](handleError(_0xd06a98,null));};exports[_0xcc5c('0x2b')]=function(_0x46a7c3,_0x759239){return db['Variable']['find']({'where':{'id':_0x46a7c3['params']['id']}})[_0xcc5c('0x28')](handleEntityNotFound(_0x759239,null))[_0xcc5c('0x28')](removeEntity(_0x759239,null))['catch'](handleError(_0x759239,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 0d10971..3a3a0d5 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 _0xcf0b=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','Variable','lodash'];(function(_0x106be3,_0x254a6f){var _0x5d9705=function(_0x1cc554){while(--_0x1cc554){_0x106be3['push'](_0x106be3['shift']());}};_0x5d9705(++_0x254a6f);}(_0xcf0b,0xe6));var _0xbcf0=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0xcf0b[_0x241424];return _0x3da798;};'use strict';var _=require(_0xbcf0('0x0'));var util=require(_0xbcf0('0x1'));var logger=require(_0xbcf0('0x2'))(_0xbcf0('0x3'));var moment=require(_0xbcf0('0x4'));var BPromise=require(_0xbcf0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcf0('0x6'));var rimraf=require('rimraf');var config=require(_0xbcf0('0x7'));var attributes=require('./variable.attributes');module[_0xbcf0('0x8')]=function(_0xa4d8a6,_0x399b18){return _0xa4d8a6[_0xbcf0('0x9')](_0xbcf0('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe264=['Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x5e3bb1,_0x3cfe7c){var _0x4c1278=function(_0x124955){while(--_0x124955){_0x5e3bb1['push'](_0x5e3bb1['shift']());}};_0x4c1278(++_0x3cfe7c);}(_0xe264,0x1bc));var _0x4e26=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xe264[_0x53e3fa];return _0xe8584a;};'use strict';var _=require(_0x4e26('0x0'));var util=require(_0x4e26('0x1'));var logger=require(_0x4e26('0x2'))('api');var moment=require(_0x4e26('0x3'));var BPromise=require(_0x4e26('0x4'));var rp=require(_0x4e26('0x5'));var fs=require('fs');var path=require(_0x4e26('0x6'));var rimraf=require(_0x4e26('0x7'));var config=require(_0x4e26('0x8'));var attributes=require(_0x4e26('0x9'));module[_0x4e26('0xa')]=function(_0x43794f,_0x58d358){return _0x43794f['define'](_0x4e26('0xb'),attributes,{'tableName':_0x4e26('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 47d570a..f4c4d9d 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x873bc5,_0x4d6c7f){var _0x38e2fa=function(_0x5ae572){while(--_0x5ae572){_0x873bc5['push'](_0x873bc5['shift']());}};_0x38e2fa(++_0x4d6c7f);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0x55ca,0x126));var _0xa55c=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x55ca[_0x540133];return _0x26b6e9;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 764f2fa..3455431 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 _0x93ab=['fetch','/reset','isAuthenticated','reset','/pull','pull','/restart','/migrations','migrations','exports','express','Router','./version.controller','get','index','canUpdate'];(function(_0x37dbcf,_0x491470){var _0x36c3f0=function(_0x49a9a4){while(--_0x49a9a4){_0x37dbcf['push'](_0x37dbcf['shift']());}};_0x36c3f0(++_0x491470);}(_0x93ab,0x9a));var _0xb93a=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0x93ab[_0x2f6233];return _0x1c9c36;};'use strict';var express=require(_0xb93a('0x0'));var router=express[_0xb93a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xb93a('0x2'));router[_0xb93a('0x3')]('/',controller[_0xb93a('0x4')]);router[_0xb93a('0x3')]('/fetch',auth['isAuthenticated'](),auth[_0xb93a('0x5')](),controller[_0xb93a('0x6')]);router[_0xb93a('0x3')](_0xb93a('0x7'),auth[_0xb93a('0x8')](),auth[_0xb93a('0x5')](),controller[_0xb93a('0x9')]);router[_0xb93a('0x3')](_0xb93a('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xb93a('0xb')]);router[_0xb93a('0x3')](_0xb93a('0xc'),auth[_0xb93a('0x8')](),controller['restart']);router[_0xb93a('0x3')](_0xb93a('0xd'),controller[_0xb93a('0xe')]);module[_0xb93a('0xf')]=router; \ No newline at end of file +var _0xadf2=['restart','/migrations','exports','express','Router','../../components/auth/service','get','/fetch','fetch','/reset','isAuthenticated','canUpdate','reset','/pull','pull','/restart'];(function(_0x3dd861,_0x7675e0){var _0x12faa2=function(_0x36192a){while(--_0x36192a){_0x3dd861['push'](_0x3dd861['shift']());}};_0x12faa2(++_0x7675e0);}(_0xadf2,0x173));var _0x2adf=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xadf2[_0x342baa];return _0x1208f3;};'use strict';var express=require(_0x2adf('0x0'));var router=express[_0x2adf('0x1')]();var auth=require(_0x2adf('0x2'));var controller=require('./version.controller');router['get']('/',controller['index']);router[_0x2adf('0x3')](_0x2adf('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x2adf('0x5')]);router['get'](_0x2adf('0x6'),auth[_0x2adf('0x7')](),auth[_0x2adf('0x8')](),controller[_0x2adf('0x9')]);router['get'](_0x2adf('0xa'),auth[_0x2adf('0x7')](),auth[_0x2adf('0x8')](),controller[_0x2adf('0xb')]);router[_0x2adf('0x3')](_0x2adf('0xc'),auth[_0x2adf('0x7')](),controller[_0x2adf('0xd')]);router[_0x2adf('0x3')](_0x2adf('0xe'),controller['migrations']);module[_0x2adf('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 109610e..6940b6f 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 _0xb15e=['push','sort','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.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','exports','version','query','latest','fetch','tags','status','json','origin','master','error','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','info','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','root','server','replace'];(function(_0x5b8199,_0x29cabb){var _0x19071a=function(_0x4a789c){while(--_0x4a789c){_0x5b8199['push'](_0x5b8199['shift']());}};_0x19071a(++_0x29cabb);}(_0xb15e,0x7b));var _0xeb15=function(_0x3e61a5,_0x5e922d){_0x3e61a5=_0x3e61a5-0x0;var _0x44db12=_0xb15e[_0x3e61a5];return _0x44db12;};'use strict';var Umzug=require(_0xeb15('0x0'));var path=require(_0xeb15('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xeb15('0x2'))(module,'version');var compareVersions=require(_0xeb15('0x3'));var exec=require(_0xeb15('0x4'))[_0xeb15('0x5')];var db=require(_0xeb15('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0xeb15('0x7'));var logger=require(_0xeb15('0x8'))(_0xeb15('0x9'));var git=require(_0xeb15('0xa'))(config['root']);exports['index']=function(_0x54b770,_0x451f5c){var _0x1449a3={'current':module[_0xeb15('0xb')][_0xeb15('0xc')],'phonebar':0x2};if(_0x54b770[_0xeb15('0xd')]&&_0x54b770[_0xeb15('0xd')][_0xeb15('0xe')]){return git[_0xeb15('0xf')]()[_0xeb15('0x10')](function(_0x55cf3c,_0x40b665){_0x1449a3[_0xeb15('0xe')]=(_0x55cf3c?module[_0xeb15('0xb')]['version']:_0x40b665['latest'])||'2.0.0';return _0x451f5c[_0xeb15('0x11')](0xc8)['json'](_0x1449a3);});}else{return _0x451f5c['status'](0xc8)[_0xeb15('0x12')](_0x1449a3);}};exports['fetch']=function(_0x38a40f,_0xd3a096){return git[_0xeb15('0xf')]([_0xeb15('0x13'),_0xeb15('0x14')],function(_0x19754c){if(_0x19754c){logger[_0xeb15('0x15')](_0x19754c);return _0xd3a096[_0xeb15('0x11')](0x1f4)['json'](_0x19754c);}logger['info']('git\x20fetch');return _0xd3a096['status'](0xc8)[_0xeb15('0x12')]({'output':_0xeb15('0x16')});});};exports[_0xeb15('0x17')]=function(_0xdea086,_0x1ea0e7){return git[_0xeb15('0x17')]([_0xeb15('0x18'),_0xeb15('0x19')],function(_0x343aa1){if(_0x343aa1){logger['error'](_0x343aa1);return _0x1ea0e7['status'](0x1f4)[_0xeb15('0x12')](_0x343aa1);}logger['info'](_0xeb15('0x1a'));return _0x1ea0e7[_0xeb15('0x11')](0xc8)['json']({'output':_0xeb15('0x1b')});});};exports[_0xeb15('0x1c')]=function(_0x6e74e6,_0x3b7387){exec(_0xeb15('0x1d'),function(_0x321e0c,_0x19ea72,_0x56e87d){logger['info'](_0x19ea72);logger['info'](_0x56e87d);if(_0x321e0c){logger[_0xeb15('0x15')](_0x321e0c);return _0x3b7387[_0xeb15('0x11')](0x1f4)[_0xeb15('0x12')](_0x321e0c);}return _0x3b7387[_0xeb15('0x11')](0xc8)[_0xeb15('0x12')]({'output':_0x19ea72});});};exports[_0xeb15('0x1e')]=function(_0x1933e7,_0x46d7ff){return pm2[_0xeb15('0x1e')](_0xeb15('0x1f'))[_0xeb15('0x20')](function(_0x378234){logger[_0xeb15('0x21')](_0xeb15('0x22'),_0x378234);return _0x46d7ff['status'](0xc8)[_0xeb15('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xeb15('0x23')](function(_0x337724){logger[_0xeb15('0x15')](_0x337724);return _0x46d7ff[_0xeb15('0x11')](0x1f4)['json'](_0x337724);});};exports[_0xeb15('0x24')]=function(_0x50d3ee,_0x1bf899){var _0x4c1990=fs[_0xeb15('0x25')](path[_0xeb15('0x26')](config[_0xeb15('0x27')],_0xeb15('0x28'),'migrations'));var _0x267082=[];for(var _0x40de9c=0x0;_0x40de9c<_0x4c1990['length'];_0x40de9c++){var _0x3e87f7=_0x4c1990[_0x40de9c][_0xeb15('0x29')]('.js','');if(compareVersions(module[_0xeb15('0xb')][_0xeb15('0xc')],_0x3e87f7)===-0x1){_0x267082[_0xeb15('0x2a')](_0x3e87f7);}}if(_0x267082['length']){var _0x11bedf=_0x267082[_0xeb15('0x2b')](compareVersions);var _0x345788=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xeb15('0x2c')],'modelName':'Migration','columnName':_0xeb15('0xc')},'migrations':{'params':[db[_0xeb15('0x2d')][_0xeb15('0x2e')](),db[_0xeb15('0x2d')][_0xeb15('0x2f')],function(){throw new Error(_0xeb15('0x30'));}],'path':path['join'](config[_0xeb15('0x27')],_0xeb15('0x28'),'migrations'),'pattern':/\.js$/}});_0x345788['up']({'migrations':_[_0xeb15('0x31')](_0x11bedf,function(_0x111b55){return _0x111b55+_0xeb15('0x32');})})[_0xeb15('0x20')](function(){return _0x1bf899['status'](0xc8)[_0xeb15('0x12')]({'output':_0xeb15('0x33')+module[_0xeb15('0xb')][_0xeb15('0xc')]+'\x20to\x20'+_[_0xeb15('0x34')](_0x11bedf),'migrations':_[_0xeb15('0x26')](_0x11bedf)});})[_0xeb15('0x23')](function(_0x48810d){if(_0x48810d instanceof db['sequelize'][_0xeb15('0x35')]){return _0x1bf899['status'](0xc8)[_0xeb15('0x12')]({'output':_0xeb15('0x36')});}else{return _0x1bf899['status'](0x1f4)[_0xeb15('0x12')](_0x48810d);}});}else{return _0x1bf899[_0xeb15('0x11')](0xc8)['json']({'output':_0xeb15('0x36')});}}; \ No newline at end of file +var _0x9845=['2.0.0','status','origin','master','error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','migrations','readdirSync','root','length','replace','.js','push','sort','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','server','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','compare-versions','child_process','exec','../../config/logger','index','exports','version','query','latest','fetch'];(function(_0xe73ce3,_0x1a830e){var _0x488bcf=function(_0x20883f){while(--_0x20883f){_0xe73ce3['push'](_0xe73ce3['shift']());}};_0x488bcf(++_0x1a830e);}(_0x9845,0x89));var _0x5984=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x9845[_0x20d54d];return _0x516e8b;};'use strict';var Umzug=require('umzug');var path=require(_0x5984('0x0'));var fs=require('fs');var _=require(_0x5984('0x1'));var pkginfo=require(_0x5984('0x2'))(module,'version');var compareVersions=require(_0x5984('0x3'));var exec=require(_0x5984('0x4'))[_0x5984('0x5')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x5984('0x6'))('update');var git=require('simple-git')(config['root']);exports[_0x5984('0x7')]=function(_0x5c1722,_0x3a643b){var _0x4d1098={'current':module[_0x5984('0x8')][_0x5984('0x9')],'phonebar':0x2};if(_0x5c1722[_0x5984('0xa')]&&_0x5c1722[_0x5984('0xa')][_0x5984('0xb')]){return git[_0x5984('0xc')]()['tags'](function(_0x49e96a,_0xf6cc7b){_0x4d1098['latest']=(_0x49e96a?module[_0x5984('0x8')]['version']:_0xf6cc7b[_0x5984('0xb')])||_0x5984('0xd');return _0x3a643b['status'](0xc8)['json'](_0x4d1098);});}else{return _0x3a643b[_0x5984('0xe')](0xc8)['json'](_0x4d1098);}};exports[_0x5984('0xc')]=function(_0x447aea,_0x1a76e7){return git['fetch']([_0x5984('0xf'),_0x5984('0x10')],function(_0x4eb223){if(_0x4eb223){logger[_0x5984('0x11')](_0x4eb223);return _0x1a76e7[_0x5984('0xe')](0x1f4)[_0x5984('0x12')](_0x4eb223);}logger[_0x5984('0x13')](_0x5984('0x14'));return _0x1a76e7[_0x5984('0xe')](0xc8)[_0x5984('0x12')]({'output':_0x5984('0x15')});});};exports[_0x5984('0x16')]=function(_0x2a0643,_0x5d8834){return git[_0x5984('0x16')](['--hard',_0x5984('0x17')],function(_0x4d4f4d){if(_0x4d4f4d){logger[_0x5984('0x11')](_0x4d4f4d);return _0x5d8834[_0x5984('0xe')](0x1f4)['json'](_0x4d4f4d);}logger[_0x5984('0x13')](_0x5984('0x18'));return _0x5d8834[_0x5984('0xe')](0xc8)[_0x5984('0x12')]({'output':_0x5984('0x19')});});};exports[_0x5984('0x1a')]=function(_0x40ec3d,_0xd11511){exec(_0x5984('0x1b'),function(_0x42fd1e,_0x514dba,_0x164b45){logger['info'](_0x514dba);logger[_0x5984('0x13')](_0x164b45);if(_0x42fd1e){logger['error'](_0x42fd1e);return _0xd11511[_0x5984('0xe')](0x1f4)[_0x5984('0x12')](_0x42fd1e);}return _0xd11511[_0x5984('0xe')](0xc8)['json']({'output':_0x514dba});});};exports[_0x5984('0x1c')]=function(_0x482375,_0x34d53e){return pm2[_0x5984('0x1c')](_0x5984('0x1d'))[_0x5984('0x1e')](function(_0x4fbfd4){logger[_0x5984('0x13')]('pm2\x20restart\x20motion\x20%s',_0x4fbfd4);return _0x34d53e[_0x5984('0xe')](0xc8)[_0x5984('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x748d0){logger['error'](_0x748d0);return _0x34d53e['status'](0x1f4)['json'](_0x748d0);});};exports[_0x5984('0x1f')]=function(_0x403e23,_0x31ab54){var _0x2be695=fs[_0x5984('0x20')](path['join'](config[_0x5984('0x21')],'server',_0x5984('0x1f')));var _0x4e711d=[];for(var _0x5ce966=0x0;_0x5ce966<_0x2be695[_0x5984('0x22')];_0x5ce966++){var _0x264c86=_0x2be695[_0x5ce966][_0x5984('0x23')](_0x5984('0x24'),'');if(compareVersions(module[_0x5984('0x8')]['version'],_0x264c86)===-0x1){_0x4e711d[_0x5984('0x25')](_0x264c86);}}if(_0x4e711d[_0x5984('0x22')]){var _0x48cf29=_0x4e711d[_0x5984('0x26')](compareVersions);var _0xb96867=new Umzug({'storage':_0x5984('0x27'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x5984('0x9')},'migrations':{'params':[db[_0x5984('0x27')][_0x5984('0x28')](),db[_0x5984('0x27')][_0x5984('0x29')],function(){throw new Error(_0x5984('0x2a'));}],'path':path[_0x5984('0x2b')](config[_0x5984('0x21')],_0x5984('0x2c'),_0x5984('0x1f')),'pattern':/\.js$/}});_0xb96867['up']({'migrations':_['map'](_0x48cf29,function(_0x55823c){return _0x55823c+_0x5984('0x24');})})[_0x5984('0x1e')](function(){return _0x31ab54[_0x5984('0xe')](0xc8)[_0x5984('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x5984('0x8')][_0x5984('0x9')]+_0x5984('0x2d')+_[_0x5984('0x2e')](_0x48cf29),'migrations':_['join'](_0x48cf29)});})[_0x5984('0x2f')](function(_0x5148f6){if(_0x5148f6 instanceof db['sequelize'][_0x5984('0x30')]){return _0x31ab54[_0x5984('0xe')](0xc8)[_0x5984('0x12')]({'output':_0x5984('0x31')});}else{return _0x31ab54['status'](0x1f4)[_0x5984('0x12')](_0x5148f6);}});}else{return _0x31ab54[_0x5984('0xe')](0xc8)[_0x5984('0x12')]({'output':_0x5984('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 02351a0..c5cc934 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 _0xa37e=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','put'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xa37e,0x168));var _0xea37=function(_0x1afcf3,_0x195c95){_0x1afcf3=_0x1afcf3-0x0;var _0x21e192=_0xa37e[_0x1afcf3];return _0x21e192;};'use strict';var multer=require(_0xea37('0x0'));var util=require(_0xea37('0x1'));var path=require(_0xea37('0x2'));var timeout=require(_0xea37('0x3'));var express=require(_0xea37('0x4'));var router=express[_0xea37('0x5')]();var fs_extra=require(_0xea37('0x6'));var auth=require(_0xea37('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xea37('0x8'));var controller=require(_0xea37('0x9'));router['get']('/',auth[_0xea37('0xa')](),controller['index']);router['get'](_0xea37('0xb'),auth[_0xea37('0xa')](),controller[_0xea37('0xc')]);router[_0xea37('0xd')](_0xea37('0xe'),auth[_0xea37('0xa')](),controller[_0xea37('0xf')]);router[_0xea37('0x10')]('/',auth[_0xea37('0xa')](),controller['create']);router[_0xea37('0x11')](_0xea37('0xe'),auth[_0xea37('0xa')](),controller[_0xea37('0x12')]);router[_0xea37('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xea37('0x14')]=router; \ No newline at end of file +var _0x4552=['post','create','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0x4552,0x1eb));var _0x2455=function(_0x2193f4,_0x59db8f){_0x2193f4=_0x2193f4-0x0;var _0x3462d3=_0x4552[_0x2193f4];return _0x3462d3;};'use strict';var multer=require(_0x2455('0x0'));var util=require(_0x2455('0x1'));var path=require(_0x2455('0x2'));var timeout=require('connect-timeout');var express=require(_0x2455('0x3'));var router=express[_0x2455('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2455('0x5'));var interaction=require(_0x2455('0x6'));var config=require(_0x2455('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x2455('0x8')]('/',auth[_0x2455('0x9')](),controller[_0x2455('0xa')]);router[_0x2455('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2455('0x8')](_0x2455('0xb'),auth[_0x2455('0x9')](),controller[_0x2455('0xc')]);router[_0x2455('0xd')]('/',auth['isAuthenticated'](),controller[_0x2455('0xe')]);router['put'](_0x2455('0xb'),auth[_0x2455('0x9')](),controller['update']);router[_0x2455('0xf')](_0x2455('0xb'),auth['isAuthenticated'](),controller[_0x2455('0x10')]);module[_0x2455('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9993166..d078220 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 _0xba37=['BOOLEAN','INTEGER','sequelize','STRING','DATE'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xba37,0xb6));var _0x7ba3=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xba37[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require(_0x7ba3('0x0'));module['exports']={'type':{'type':Sequelize[_0x7ba3('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7ba3('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7ba3('0x1')]},'interface':{'type':Sequelize[_0x7ba3('0x1')]},'membername':{'type':Sequelize[_0x7ba3('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7ba3('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7ba3('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x7ba3('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7ba3('0x4')]},'agentacw':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7ba3('0x4')]},'reason':{'type':Sequelize[_0x7ba3('0x1')]},'lastevent':{'type':Sequelize[_0x7ba3('0x1')]},'channel':{'type':Sequelize[_0x7ba3('0x1')]},'channelstate':{'type':Sequelize[_0x7ba3('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7ba3('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7ba3('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7ba3('0x1')]},'accountcode':{'type':Sequelize[_0x7ba3('0x1')]},'context':{'type':Sequelize[_0x7ba3('0x1')]},'exten':{'type':Sequelize[_0x7ba3('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7ba3('0x1')]},'destchannelstate':{'type':Sequelize[_0x7ba3('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7ba3('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7ba3('0x1')]},'destcalleridname':{'type':Sequelize[_0x7ba3('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7ba3('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7ba3('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x7ba3('0x1')]},'destcontext':{'type':Sequelize[_0x7ba3('0x1')]},'destexten':{'type':Sequelize[_0x7ba3('0x1')]},'destpriority':{'type':Sequelize[_0x7ba3('0x1')]},'destuniqueid':{'type':Sequelize[_0x7ba3('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7ba3('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x7ba3('0x1')]},'transfer':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7ba3('0x1')]},'transferuniqueid':{'type':Sequelize[_0x7ba3('0x1')]},'agententerreason':{'type':Sequelize[_0x7ba3('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4ffa=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ffa,0x124));var _0xa4ff=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4ffa[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa4ff('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa4ff('0x0')]},'calleridname':{'type':Sequelize[_0xa4ff('0x0')]},'queue':{'type':Sequelize[_0xa4ff('0x0')]},'interface':{'type':Sequelize[_0xa4ff('0x0')]},'membername':{'type':Sequelize[_0xa4ff('0x0')]},'agentcalledAt':{'type':Sequelize[_0xa4ff('0x1')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xa4ff('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0xa4ff('0x1')]},'agentdumpAt':{'type':Sequelize[_0xa4ff('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xa4ff('0x2')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa4ff('0x2')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa4ff('0x3')]},'agentacw':{'type':Sequelize[_0xa4ff('0x2')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xa4ff('0x0')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa4ff('0x0')]},'connectedlinenum':{'type':Sequelize[_0xa4ff('0x0')]},'connectedlinename':{'type':Sequelize[_0xa4ff('0x0')]},'language':{'type':Sequelize[_0xa4ff('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa4ff('0x0')]},'exten':{'type':Sequelize[_0xa4ff('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xa4ff('0x0')]},'destchannelstate':{'type':Sequelize[_0xa4ff('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa4ff('0x0')]},'destcalleridname':{'type':Sequelize[_0xa4ff('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa4ff('0x0')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa4ff('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xa4ff('0x0')]},'destpriority':{'type':Sequelize[_0xa4ff('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa4ff('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0xa4ff('0x0')]},'transfer':{'type':Sequelize[_0xa4ff('0x2')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa4ff('0x0')],'comment':_0xa4ff('0x4')},'transferexten':{'type':Sequelize[_0xa4ff('0x0')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xa4ff('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 42bdb44..6e7925b 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(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 953eeef..2081529 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 _0x64f5=['path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','moment','request-promise'];(function(_0x3c2863,_0x1b2cee){var _0x2c3d27=function(_0x4f831b){while(--_0x4f831b){_0x3c2863['push'](_0x3c2863['shift']());}};_0x2c3d27(++_0x1b2cee);}(_0x64f5,0x17e));var _0x564f=function(_0x390368,_0x4af971){_0x390368=_0x390368-0x0;var _0x4da309=_0x64f5[_0x390368];return _0x4da309;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x564f('0x1'));var BPromise=require('bluebird');var rp=require(_0x564f('0x2'));var fs=require('fs');var path=require(_0x564f('0x3'));var rimraf=require('rimraf');var config=require(_0x564f('0x4'));var attributes=require(_0x564f('0x5'));module[_0x564f('0x6')]=function(_0x72b009,_0x4bbedf){return _0x72b009['define'](_0x564f('0x7'),attributes,{'tableName':_0x564f('0x8'),'paranoid':![],'indexes':[{'fields':[_0x564f('0x9'),_0x564f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5162=['../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','bluebird','request-promise','path','rimraf'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x5162,0x103));var _0x2516=function(_0x100519,_0x50dd2c){_0x100519=_0x100519-0x0;var _0x1dd752=_0x5162[_0x100519];return _0x1dd752;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2516('0x1'));var rp=require(_0x2516('0x2'));var fs=require('fs');var path=require(_0x2516('0x3'));var rimraf=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));module[_0x2516('0x7')]=function(_0x5b71b5,_0x48f411){return _0x5b71b5['define'](_0x2516('0x8'),attributes,{'tableName':_0x2516('0x9'),'paranoid':![],'indexes':[{'fields':[_0x2516('0xa'),_0x2516('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 edbec87..f6c82cb 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 _0x215c=['body','where','attributes','limit','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','options','raw','catch','UpdateVoiceAgentReport','update'];(function(_0x2ebebf,_0x372642){var _0x397306=function(_0x44f5a6){while(--_0x44f5a6){_0x2ebebf['push'](_0x2ebebf['shift']());}};_0x397306(++_0x372642);}(_0x215c,0xdd));var _0xc215=function(_0x2ad131,_0x19dbdc){_0x2ad131=_0x2ad131-0x0;var _0x5415ae=_0x215c[_0x2ad131];return _0x5415ae;};'use strict';var _=require(_0xc215('0x0'));var util=require(_0xc215('0x1'));var moment=require(_0xc215('0x2'));var BPromise=require('bluebird');var rs=require(_0xc215('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc215('0x4'));var logger=require(_0xc215('0x5'))(_0xc215('0x6'));var config=require(_0xc215('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc215('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5215f0,_0x197fce,_0x199549){return new BPromise(function(_0x58e26a,_0x45b418){return client['request'](_0x5215f0,_0x199549)[_0xc215('0x9')](function(_0xad90cd){logger[_0xc215('0xa')](_0xc215('0xb'),_0x197fce,_0xc215('0xc'));logger[_0xc215('0xd')](_0xc215('0xe'),_0x197fce,_0xc215('0xc'),JSON[_0xc215('0xf')](_0xad90cd));if(_0xad90cd[_0xc215('0x10')]){if(_0xad90cd[_0xc215('0x10')][_0xc215('0x11')]===0x1f4){logger[_0xc215('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x197fce,_0xad90cd[_0xc215('0x10')][_0xc215('0x12')]);return _0x45b418(_0xad90cd[_0xc215('0x10')][_0xc215('0x12')]);}logger['error'](_0xc215('0xb'),_0x197fce,_0xad90cd[_0xc215('0x10')][_0xc215('0x12')]);return _0x58e26a(_0xad90cd[_0xc215('0x10')]['message']);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x197fce,_0xc215('0xc'));_0x58e26a(_0xad90cd[_0xc215('0x13')][_0xc215('0x12')]);}})['catch'](function(_0x15c3f6){logger['error'](_0xc215('0xb'),_0x197fce,_0x15c3f6);_0x45b418(_0x15c3f6);});});}exports[_0xc215('0x14')]=function(_0xf9daa6){var _0x121a8f=this;return new Promise(function(_0x5df34f,_0x45877b){return db[_0xc215('0x15')]['create'](_0xf9daa6['body'],{'raw':_0xf9daa6[_0xc215('0x16')]?_0xf9daa6[_0xc215('0x16')][_0xc215('0x17')]===undefined?!![]:![]:!![]})[_0xc215('0x9')](function(_0x57f1dd){logger[_0xc215('0xa')](_0xc215('0x14'),_0xf9daa6);logger[_0xc215('0xd')]('CreateVoiceAgentReport',_0xf9daa6,JSON[_0xc215('0xf')](_0x57f1dd));_0x5df34f(_0x57f1dd);})[_0xc215('0x18')](function(_0x4ccc6c){logger['error'](_0xc215('0x14'),_0x4ccc6c[_0xc215('0x12')],_0xf9daa6);_0x45877b(_0x121a8f[_0xc215('0x10')](0x1f4,_0x4ccc6c[_0xc215('0x12')]));});});};exports[_0xc215('0x19')]=function(_0x141627){var _0x38af1e=this;return new Promise(function(_0x3a6f6f,_0x308269){return db[_0xc215('0x15')][_0xc215('0x1a')](_0x141627[_0xc215('0x1b')],{'raw':_0x141627[_0xc215('0x16')]?_0x141627[_0xc215('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x141627[_0xc215('0x16')]?_0x141627[_0xc215('0x16')][_0xc215('0x1c')]||null:null,'attributes':_0x141627[_0xc215('0x16')]?_0x141627[_0xc215('0x16')][_0xc215('0x1d')]||null:null,'limit':_0x141627[_0xc215('0x16')]?_0x141627[_0xc215('0x16')][_0xc215('0x1e')]||null:null})[_0xc215('0x9')](function(_0x4533a4){logger[_0xc215('0xa')]('UpdateVoiceAgentReport',_0x141627);logger[_0xc215('0xd')](_0xc215('0x19'),_0x141627,JSON['stringify'](_0x4533a4));_0x3a6f6f(_0x4533a4);})[_0xc215('0x18')](function(_0x2da801){logger[_0xc215('0x10')](_0xc215('0x19'),_0x2da801[_0xc215('0x12')],_0x141627);_0x308269(_0x38af1e['error'](0x1f4,_0x2da801['message']));});});}; \ No newline at end of file +var _0xddb1=['result','catch','CreateVoiceAgentReport','options','raw','then','UpdateVoiceAgentReport','VoiceAgentReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3f6a93,_0xe1ddde){var _0x500f6a=function(_0x4f5adb){while(--_0x4f5adb){_0x3f6a93['push'](_0x3f6a93['shift']());}};_0x500f6a(++_0xe1ddde);}(_0xddb1,0xc1));var _0x1ddb=function(_0x516d32,_0x47259f){_0x516d32=_0x516d32-0x0;var _0x4508bf=_0xddb1[_0x516d32];return _0x4508bf;};'use strict';var _=require(_0x1ddb('0x0'));var util=require(_0x1ddb('0x1'));var moment=require(_0x1ddb('0x2'));var BPromise=require(_0x1ddb('0x3'));var rs=require(_0x1ddb('0x4'));var fs=require('fs');var Redis=require(_0x1ddb('0x5'));var db=require(_0x1ddb('0x6'))['db'];var utils=require(_0x1ddb('0x7'));var logger=require(_0x1ddb('0x8'))(_0x1ddb('0x9'));var config=require(_0x1ddb('0xa'));var jayson=require(_0x1ddb('0xb'));var client=jayson[_0x1ddb('0xc')][_0x1ddb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x555dd7,_0x1f185f,_0x1b8e82){return new BPromise(function(_0x1f71cb,_0x3707b6){return client[_0x1ddb('0xe')](_0x555dd7,_0x1b8e82)['then'](function(_0x386094){logger[_0x1ddb('0xf')](_0x1ddb('0x10'),_0x1f185f,_0x1ddb('0x11'));logger[_0x1ddb('0x12')](_0x1ddb('0x13'),_0x1f185f,_0x1ddb('0x11'),JSON[_0x1ddb('0x14')](_0x386094));if(_0x386094[_0x1ddb('0x15')]){if(_0x386094['error']['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x1f185f,_0x386094[_0x1ddb('0x15')][_0x1ddb('0x16')]);return _0x3707b6(_0x386094[_0x1ddb('0x15')][_0x1ddb('0x16')]);}logger[_0x1ddb('0x15')](_0x1ddb('0x10'),_0x1f185f,_0x386094[_0x1ddb('0x15')][_0x1ddb('0x16')]);return _0x1f71cb(_0x386094[_0x1ddb('0x15')]['message']);}else{logger['info'](_0x1ddb('0x10'),_0x1f185f,_0x1ddb('0x11'));_0x1f71cb(_0x386094[_0x1ddb('0x17')][_0x1ddb('0x16')]);}})[_0x1ddb('0x18')](function(_0xd4b4f1){logger[_0x1ddb('0x15')](_0x1ddb('0x10'),_0x1f185f,_0xd4b4f1);_0x3707b6(_0xd4b4f1);});});}exports[_0x1ddb('0x19')]=function(_0x1a6752){var _0x1e0f3b=this;return new Promise(function(_0x1aa0f6,_0x2d3093){return db['VoiceAgentReport']['create'](_0x1a6752['body'],{'raw':_0x1a6752[_0x1ddb('0x1a')]?_0x1a6752[_0x1ddb('0x1a')][_0x1ddb('0x1b')]===undefined?!![]:![]:!![]})[_0x1ddb('0x1c')](function(_0x517882){logger['info']('CreateVoiceAgentReport',_0x1a6752);logger[_0x1ddb('0x12')](_0x1ddb('0x19'),_0x1a6752,JSON['stringify'](_0x517882));_0x1aa0f6(_0x517882);})[_0x1ddb('0x18')](function(_0x43f43f){logger[_0x1ddb('0x15')](_0x1ddb('0x19'),_0x43f43f[_0x1ddb('0x16')],_0x1a6752);_0x2d3093(_0x1e0f3b[_0x1ddb('0x15')](0x1f4,_0x43f43f['message']));});});};exports[_0x1ddb('0x1d')]=function(_0x28b084){var _0x4f1619=this;return new Promise(function(_0x1bd03e,_0x16e347){return db[_0x1ddb('0x1e')][_0x1ddb('0x1f')](_0x28b084[_0x1ddb('0x20')],{'raw':_0x28b084[_0x1ddb('0x1a')]?_0x28b084[_0x1ddb('0x1a')][_0x1ddb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28b084[_0x1ddb('0x1a')]?_0x28b084[_0x1ddb('0x1a')][_0x1ddb('0x21')]||null:null,'attributes':_0x28b084[_0x1ddb('0x1a')]?_0x28b084[_0x1ddb('0x1a')][_0x1ddb('0x22')]||null:null,'limit':_0x28b084[_0x1ddb('0x1a')]?_0x28b084[_0x1ddb('0x1a')][_0x1ddb('0x23')]||null:null})[_0x1ddb('0x1c')](function(_0xed8b92){logger['info'](_0x1ddb('0x1d'),_0x28b084);logger[_0x1ddb('0x12')](_0x1ddb('0x1d'),_0x28b084,JSON['stringify'](_0xed8b92));_0x1bd03e(_0xed8b92);})[_0x1ddb('0x18')](function(_0x226f12){logger[_0x1ddb('0x15')](_0x1ddb('0x1d'),_0x226f12[_0x1ddb('0x16')],_0x28b084);_0x16e347(_0x4f1619[_0x1ddb('0x15')](0x1f4,_0x226f12['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 3af8163..1393491 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 _0x38d5=['express','Router','../../components/auth/service','get','/describe','isAuthenticated','/:id','show','create','put','update','/with-retry/:id','delete','exports'];(function(_0x45aca6,_0x4b87ec){var _0x193635=function(_0x512686){while(--_0x512686){_0x45aca6['push'](_0x45aca6['shift']());}};_0x193635(++_0x4b87ec);}(_0x38d5,0xee));var _0x538d=function(_0x1b1f5b,_0x549bd4){_0x1b1f5b=_0x1b1f5b-0x0;var _0x43d1d7=_0x38d5[_0x1b1f5b];return _0x43d1d7;};'use strict';var express=require(_0x538d('0x0'));var router=express[_0x538d('0x1')]();var auth=require(_0x538d('0x2'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x538d('0x3')](_0x538d('0x4'),auth[_0x538d('0x5')](),controller['describe']);router['get'](_0x538d('0x6'),auth['isAuthenticated'](),controller[_0x538d('0x7')]);router['post']('/',auth[_0x538d('0x5')](),controller[_0x538d('0x8')]);router[_0x538d('0x9')](_0x538d('0x6'),auth[_0x538d('0x5')](),controller[_0x538d('0xa')]);router[_0x538d('0x9')](_0x538d('0xb'),auth[_0x538d('0x5')](),controller['updateWithRetry']);router[_0x538d('0xc')](_0x538d('0x6'),auth[_0x538d('0x5')](),controller['destroy']);module[_0x538d('0xd')]=router; \ No newline at end of file +var _0xe18e=['isAuthenticated','get','/describe','describe','/:id','show','post','create','put','updateWithRetry','delete','destroy','express','Router','../../components/auth/service'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0xe18e,0x66));var _0xee18=function(_0x395768,_0x1bc432){_0x395768=_0x395768-0x0;var _0x419806=_0xe18e[_0x395768];return _0x419806;};'use strict';var express=require(_0xee18('0x0'));var router=express[_0xee18('0x1')]();var auth=require(_0xee18('0x2'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xee18('0x3')](),controller['index']);router[_0xee18('0x4')](_0xee18('0x5'),auth['isAuthenticated'](),controller[_0xee18('0x6')]);router[_0xee18('0x4')](_0xee18('0x7'),auth['isAuthenticated'](),controller[_0xee18('0x8')]);router[_0xee18('0x9')]('/',auth[_0xee18('0x3')](),controller[_0xee18('0xa')]);router[_0xee18('0xb')](_0xee18('0x7'),auth[_0xee18('0x3')](),controller['update']);router[_0xee18('0xb')]('/with-retry/:id',auth['isAuthenticated'](),controller[_0xee18('0xc')]);router[_0xee18('0xd')](_0xee18('0x7'),auth[_0xee18('0x3')](),controller[_0xee18('0xe')]);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 e20419a..f7e76c8 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 _0x8e6d=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','TEXT'];(function(_0xf5952d,_0x319ef0){var _0xb2680e=function(_0x3d8deb){while(--_0x3d8deb){_0xf5952d['push'](_0xf5952d['shift']());}};_0xb2680e(++_0x319ef0);}(_0x8e6d,0x92));var _0xd8e6=function(_0x79f843,_0x3bf4e2){_0x79f843=_0x79f843-0x0;var _0x5b389c=_0x8e6d[_0x79f843];return _0x5b389c;};'use strict';var Sequelize=require(_0xd8e6('0x0'));module[_0xd8e6('0x1')]={'uniqueid':{'type':Sequelize[_0xd8e6('0x2')]},'type':{'type':Sequelize[_0xd8e6('0x3')](_0xd8e6('0x4'),_0xd8e6('0x5'),_0xd8e6('0x6'),_0xd8e6('0x7'),_0xd8e6('0x8'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd8e6('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xd8e6('0x2')]},'destinationcontext':{'type':Sequelize[_0xd8e6('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd8e6('0x2')]},'destinationchannel':{'type':Sequelize[_0xd8e6('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xd8e6('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd8e6('0xa')]},'endtime':{'type':Sequelize[_0xd8e6('0xa')]},'duration':{'type':Sequelize[_0xd8e6('0xb')]},'billableseconds':{'type':Sequelize[_0xd8e6('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xd8e6('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xd8e6('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xd8e6('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xd8e6('0xb')]},'sipcallid':{'type':Sequelize[_0xd8e6('0x2')]}}; \ No newline at end of file +var _0x8611=['exports','STRING','ENUM','internal','outbound','outbound-fax','DATE','INTEGER','sequelize'];(function(_0x536acf,_0x5e38ef){var _0x38ecf1=function(_0x53f227){while(--_0x53f227){_0x536acf['push'](_0x536acf['shift']());}};_0x38ecf1(++_0x5e38ef);}(_0x8611,0x143));var _0x1861=function(_0x4ba05e,_0x18ecff){_0x4ba05e=_0x4ba05e-0x0;var _0x44cc6d=_0x8611[_0x4ba05e];return _0x44cc6d;};'use strict';var Sequelize=require(_0x1861('0x0'));module[_0x1861('0x1')]={'uniqueid':{'type':Sequelize[_0x1861('0x2')]},'type':{'type':Sequelize[_0x1861('0x3')]('inbound',_0x1861('0x4'),_0x1861('0x5'),'inbound-fax',_0x1861('0x6'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1861('0x2')]},'source':{'type':Sequelize[_0x1861('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x1861('0x2')]},'callerid':{'type':Sequelize[_0x1861('0x2')]},'channel':{'type':Sequelize[_0x1861('0x2')]},'destinationchannel':{'type':Sequelize[_0x1861('0x2')]},'lastapplication':{'type':Sequelize[_0x1861('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x1861('0x7')]},'systemanswertime':{'type':Sequelize[_0x1861('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x1861('0x7')]},'duration':{'type':Sequelize[_0x1861('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x1861('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1861('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x1861('0x2')]},'userDisposition':{'type':Sequelize[_0x1861('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x1861('0x2')]},'note':{'type':Sequelize[_0x1861('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x1861('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8d17e5b..c09887e 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 _0xd1f8=['show','params','keys','rawAttributes','options','find','catch','create','describe','update','body','uniqueid','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','promise-retry','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','merge','filter','includeAll','include','User','findAll'];(function(_0x586f40,_0x4cb712){var _0xedde8d=function(_0x2e5cba){while(--_0x2e5cba){_0x586f40['push'](_0x586f40['shift']());}};_0xedde8d(++_0x4cb712);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0xd1f8[_0x2bf888];return _0x3038d6;};'use strict';var _=require(_0x8d1f('0x0'));var qs=require(_0x8d1f('0x1'));var logger=require(_0x8d1f('0x2'))(_0x8d1f('0x3'));var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x8d1f('0x4'));function respondWithResult(_0x53ae86,_0x1a317b){_0x1a317b=_0x1a317b||0xc8;return function(_0x4f68b2){if(_0x4f68b2){return _0x53ae86[_0x8d1f('0x5')](_0x1a317b)['json'](_0x4f68b2);}};}function respondWithFilteredResult(_0x3c0543,_0x26d2de){return function(_0x5a17b0){if(_0x5a17b0){var _0x8bd2b8=typeof _0x26d2de[_0x8d1f('0x6')]===_0x8d1f('0x7')&&typeof _0x26d2de[_0x8d1f('0x8')]===_0x8d1f('0x7');var _0x5950c6=_0x5a17b0[_0x8d1f('0x9')];var _0x426673=_0x8bd2b8?0x0:_0x26d2de['offset'];var _0x3044e7=_0x8bd2b8?_0x5a17b0[_0x8d1f('0x9')]:_0x26d2de[_0x8d1f('0x6')]+_0x26d2de[_0x8d1f('0x8')];var _0x10891a;if(_0x3044e7>=_0x5950c6){_0x3044e7=_0x5950c6;_0x10891a=0xc8;}else{_0x10891a=0xce;}_0x3c0543['status'](_0x10891a);return _0x3c0543['set'](_0x8d1f('0xa'),_0x426673+'-'+_0x3044e7+'/'+_0x5950c6)['json'](_0x5a17b0);}return null;};}function saveUpdates(_0x236eaf){return function(_0x38e8bb){if(_0x38e8bb){return _0x38e8bb['update'](_0x236eaf)[_0x8d1f('0xb')](function(_0x2052f6){return _0x2052f6;});}return null;};}function removeEntity(_0x50ccc){return function(_0x5e0805){if(_0x5e0805){return _0x5e0805[_0x8d1f('0xc')]()[_0x8d1f('0xb')](function(){_0x50ccc[_0x8d1f('0x5')](0xcc)[_0x8d1f('0xd')]();});}};}function handleEntityNotFound(_0x63f46a){return function(_0x3ea57a){if(!_0x3ea57a){_0x63f46a[_0x8d1f('0xe')](0x194);}return _0x3ea57a;};}function handleError(_0x1af7e2,_0x2463c9){_0x2463c9=_0x2463c9||0x1f4;return function(_0x2422d0){logger[_0x8d1f('0xf')](_0x2422d0[_0x8d1f('0x10')]);if(_0x2422d0[_0x8d1f('0x11')]){delete _0x2422d0[_0x8d1f('0x11')];}_0x1af7e2[_0x8d1f('0x5')](_0x2463c9)[_0x8d1f('0x12')](_0x2422d0);};}exports[_0x8d1f('0x13')]=function(_0x495655,_0x4c39d9){var _0x1f921a={},_0x44b02e={},_0x1cb538={'count':0x0,'rows':[]};var _0x11948d=_[_0x8d1f('0x14')](db[_0x8d1f('0x15')]['rawAttributes'],function(_0x194fe0){return{'name':_0x194fe0[_0x8d1f('0x16')],'type':_0x194fe0[_0x8d1f('0x17')][_0x8d1f('0x18')]};});_0x44b02e['model']=_['map'](_0x11948d,_0x8d1f('0x11'));_0x44b02e[_0x8d1f('0x19')]=_['keys'](_0x495655[_0x8d1f('0x19')]);_0x44b02e['filters']=_[_0x8d1f('0x1a')](_0x44b02e[_0x8d1f('0x1b')],_0x44b02e[_0x8d1f('0x19')]);_0x1f921a[_0x8d1f('0x1c')]=_[_0x8d1f('0x1a')](_0x44b02e[_0x8d1f('0x1b')],qs[_0x8d1f('0x1d')](_0x495655[_0x8d1f('0x19')][_0x8d1f('0x1d')]));_0x1f921a['attributes']=_0x1f921a[_0x8d1f('0x1c')][_0x8d1f('0x1e')]?_0x1f921a['attributes']:_0x44b02e[_0x8d1f('0x1b')];if(!_0x495655[_0x8d1f('0x19')]['hasOwnProperty'](_0x8d1f('0x1f'))){_0x1f921a[_0x8d1f('0x8')]=qs[_0x8d1f('0x8')](_0x495655['query'][_0x8d1f('0x8')]);_0x1f921a[_0x8d1f('0x6')]=qs[_0x8d1f('0x6')](_0x495655['query'][_0x8d1f('0x6')]);}_0x1f921a['order']=qs['sort'](_0x495655[_0x8d1f('0x19')][_0x8d1f('0x20')]);_0x1f921a[_0x8d1f('0x21')]=qs[_0x8d1f('0x22')](_[_0x8d1f('0x23')](_0x495655[_0x8d1f('0x19')],_0x44b02e[_0x8d1f('0x22')]),_0x11948d);if(_0x495655[_0x8d1f('0x19')]['filter']){_0x1f921a[_0x8d1f('0x21')]=_[_0x8d1f('0x24')](_0x1f921a[_0x8d1f('0x21')],{'$or':_[_0x8d1f('0x14')](_0x11948d,function(_0x1b8af6){if(_0x1b8af6[_0x8d1f('0x17')]!=='VIRTUAL'){var _0x340e44={};_0x340e44[_0x1b8af6[_0x8d1f('0x11')]]={'$like':'%'+_0x495655['query'][_0x8d1f('0x25')]+'%'};return _0x340e44;}})});}_0x1f921a=_[_0x8d1f('0x24')]({},_0x1f921a,_0x495655['options']);var _0x4c33e8={'where':_0x1f921a['where']};return db[_0x8d1f('0x15')][_0x8d1f('0x9')](_0x4c33e8)[_0x8d1f('0xb')](function(_0x24d865){_0x1cb538[_0x8d1f('0x9')]=_0x24d865;if(_0x495655[_0x8d1f('0x19')][_0x8d1f('0x26')]){_0x1f921a[_0x8d1f('0x27')]=[{'attributes':['id','name','fullname','alias'],'model':db[_0x8d1f('0x28')],'as':_0x8d1f('0x28')}];}return db[_0x8d1f('0x15')][_0x8d1f('0x29')](_0x1f921a);})[_0x8d1f('0xb')](function(_0x15e37f){_0x1cb538['rows']=_0x15e37f;return _0x1cb538;})[_0x8d1f('0xb')](respondWithFilteredResult(_0x4c39d9,_0x1f921a))['catch'](handleError(_0x4c39d9,null));};exports[_0x8d1f('0x2a')]=function(_0x256cd0,_0x508fd0){var _0x5cc82d={'raw':!![],'where':{'id':_0x256cd0[_0x8d1f('0x2b')]['id']}},_0x35c5ca={};_0x35c5ca[_0x8d1f('0x1b')]=_[_0x8d1f('0x2c')](db[_0x8d1f('0x15')][_0x8d1f('0x2d')]);_0x35c5ca['query']=_[_0x8d1f('0x2c')](_0x256cd0[_0x8d1f('0x19')]);_0x35c5ca[_0x8d1f('0x22')]=_[_0x8d1f('0x1a')](_0x35c5ca[_0x8d1f('0x1b')],_0x35c5ca[_0x8d1f('0x19')]);_0x5cc82d[_0x8d1f('0x1c')]=_[_0x8d1f('0x1a')](_0x35c5ca[_0x8d1f('0x1b')],qs[_0x8d1f('0x1d')](_0x256cd0[_0x8d1f('0x19')]['fields']));_0x5cc82d[_0x8d1f('0x1c')]=_0x5cc82d[_0x8d1f('0x1c')][_0x8d1f('0x1e')]?_0x5cc82d['attributes']:_0x35c5ca['model'];if(_0x256cd0['query'][_0x8d1f('0x26')]){_0x5cc82d[_0x8d1f('0x27')]=[{'all':!![]}];}_0x5cc82d=_['merge']({},_0x5cc82d,_0x256cd0[_0x8d1f('0x2e')]);return db[_0x8d1f('0x15')][_0x8d1f('0x2f')](_0x5cc82d)[_0x8d1f('0xb')](handleEntityNotFound(_0x508fd0,null))[_0x8d1f('0xb')](respondWithResult(_0x508fd0,null))[_0x8d1f('0x30')](handleError(_0x508fd0,null));};exports[_0x8d1f('0x31')]=function(_0x279e9a,_0x1b8186){return db[_0x8d1f('0x15')][_0x8d1f('0x31')](_0x279e9a['body'],{})[_0x8d1f('0xb')](respondWithResult(_0x1b8186,0xc9))[_0x8d1f('0x30')](handleError(_0x1b8186,null));};exports['destroy']=function(_0x5bf711,_0x396165){return db[_0x8d1f('0x15')][_0x8d1f('0x2f')]({'where':{'id':_0x5bf711['params']['id']}})['then'](handleEntityNotFound(_0x396165,null))['then'](removeEntity(_0x396165,null))['catch'](handleError(_0x396165,null));};exports[_0x8d1f('0x32')]=function(_0x42eee4,_0x581805){return db[_0x8d1f('0x15')]['describe']()['then'](respondWithResult(_0x581805,null))['catch'](handleError(_0x581805,null));};function findForUpdate(_0x295c93){return db[_0x8d1f('0x15')][_0x8d1f('0x2f')]({'where':{'uniqueid':_0x295c93[_0x8d1f('0x2b')]['id'],'UserId':{'$or':[null,_0x295c93['user']['id']]}}});}exports[_0x8d1f('0x33')]=function(_0x546efc,_0x48f639){if(_0x546efc[_0x8d1f('0x34')][_0x8d1f('0x35')]){delete _0x546efc[_0x8d1f('0x34')][_0x8d1f('0x35')];}return findForUpdate(_0x546efc)[_0x8d1f('0xb')](handleEntityNotFound(_0x48f639,null))[_0x8d1f('0xb')](saveUpdates(_0x546efc[_0x8d1f('0x34')],null))[_0x8d1f('0xb')](respondWithResult(_0x48f639,null))[_0x8d1f('0x30')](handleError(_0x48f639,null));};exports['updateWithRetry']=function(_0x8d0dba,_0x31e68d,_0x11cb18){if(_0x8d0dba[_0x8d1f('0x34')][_0x8d1f('0x35')]){delete _0x8d0dba[_0x8d1f('0x34')][_0x8d1f('0x35')];}promiseRetry(function(_0x1d5cce){return findForUpdate(_0x8d0dba)[_0x8d1f('0xb')](function(_0x1c8558){if(_0x1c8558!==null){return _0x1c8558;}else{_0x1d5cce(new Error(_0x8d1f('0x36')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x8d1f('0xb')](function(_0x4027d6){if(!_0x4027d6){return new Promise(function(_0x28114d){_0x28114d(handleEntityNotFound(_0x31e68d)());});}else{return _0x4027d6[_0x8d1f('0x33')](_0x8d0dba[_0x8d1f('0x34')])['then'](function(_0x21a44a){return respondWithResult(_0x31e68d)(_0x21a44a);});}},function(){handleEntityNotFound(_0x31e68d)();});}; \ No newline at end of file +var _0x794b=['updateWithRetry','uniqueid','lodash','../../components/parsers/qs','api','../../mysqldb','offset','undefined','count','limit','status','set','Content-Range','json','update','then','end','sendStatus','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','options','include','fullname','User','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','user'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x794b,0x1c2));var _0xb794=function(_0x118581,_0x1dae14){_0x118581=_0x118581-0x0;var _0x74df1d=_0x794b[_0x118581];return _0x74df1d;};'use strict';var _=require(_0xb794('0x0'));var qs=require(_0xb794('0x1'));var logger=require('../../config/logger')(_0xb794('0x2'));var db=require(_0xb794('0x3'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x4f97f5,_0xf9af2a){_0xf9af2a=_0xf9af2a||0xc8;return function(_0x241c85){if(_0x241c85){return _0x4f97f5['status'](_0xf9af2a)['json'](_0x241c85);}};}function respondWithFilteredResult(_0x323f52,_0x338e39){return function(_0xde33a5){if(_0xde33a5){var _0x20e4d4=typeof _0x338e39[_0xb794('0x4')]===_0xb794('0x5')&&typeof _0x338e39['limit']===_0xb794('0x5');var _0xa67b25=_0xde33a5[_0xb794('0x6')];var _0xc3dde7=_0x20e4d4?0x0:_0x338e39[_0xb794('0x4')];var _0xf87756=_0x20e4d4?_0xde33a5[_0xb794('0x6')]:_0x338e39[_0xb794('0x4')]+_0x338e39[_0xb794('0x7')];var _0x41eaaa;if(_0xf87756>=_0xa67b25){_0xf87756=_0xa67b25;_0x41eaaa=0xc8;}else{_0x41eaaa=0xce;}_0x323f52[_0xb794('0x8')](_0x41eaaa);return _0x323f52[_0xb794('0x9')](_0xb794('0xa'),_0xc3dde7+'-'+_0xf87756+'/'+_0xa67b25)[_0xb794('0xb')](_0xde33a5);}return null;};}function saveUpdates(_0x12b09e){return function(_0xe8442a){if(_0xe8442a){return _0xe8442a[_0xb794('0xc')](_0x12b09e)[_0xb794('0xd')](function(_0xd13441){return _0xd13441;});}return null;};}function removeEntity(_0x3b036b){return function(_0x20f84a){if(_0x20f84a){return _0x20f84a['destroy']()[_0xb794('0xd')](function(){_0x3b036b[_0xb794('0x8')](0xcc)[_0xb794('0xe')]();});}};}function handleEntityNotFound(_0xf1308e){return function(_0xac1f87){if(!_0xac1f87){_0xf1308e[_0xb794('0xf')](0x194);}return _0xac1f87;};}function handleError(_0x558bc1,_0x43bf13){_0x43bf13=_0x43bf13||0x1f4;return function(_0x33ac72){logger['error'](_0x33ac72[_0xb794('0x10')]);if(_0x33ac72[_0xb794('0x11')]){delete _0x33ac72['name'];}_0x558bc1[_0xb794('0x8')](_0x43bf13)[_0xb794('0x12')](_0x33ac72);};}exports[_0xb794('0x13')]=function(_0x518d3d,_0x722b1b){var _0xa0c655={},_0x5494e7={},_0x10d905={'count':0x0,'rows':[]};var _0x22d126=_[_0xb794('0x14')](db[_0xb794('0x15')][_0xb794('0x16')],function(_0x4fbb1c){return{'name':_0x4fbb1c[_0xb794('0x17')],'type':_0x4fbb1c[_0xb794('0x18')]['key']};});_0x5494e7[_0xb794('0x19')]=_[_0xb794('0x14')](_0x22d126,_0xb794('0x11'));_0x5494e7[_0xb794('0x1a')]=_[_0xb794('0x1b')](_0x518d3d[_0xb794('0x1a')]);_0x5494e7[_0xb794('0x1c')]=_[_0xb794('0x1d')](_0x5494e7[_0xb794('0x19')],_0x5494e7[_0xb794('0x1a')]);_0xa0c655[_0xb794('0x1e')]=_[_0xb794('0x1d')](_0x5494e7[_0xb794('0x19')],qs['fields'](_0x518d3d[_0xb794('0x1a')][_0xb794('0x1f')]));_0xa0c655[_0xb794('0x1e')]=_0xa0c655['attributes']['length']?_0xa0c655[_0xb794('0x1e')]:_0x5494e7['model'];if(!_0x518d3d[_0xb794('0x1a')][_0xb794('0x20')]('nolimit')){_0xa0c655['limit']=qs[_0xb794('0x7')](_0x518d3d[_0xb794('0x1a')][_0xb794('0x7')]);_0xa0c655['offset']=qs['offset'](_0x518d3d[_0xb794('0x1a')][_0xb794('0x4')]);}_0xa0c655[_0xb794('0x21')]=qs[_0xb794('0x22')](_0x518d3d[_0xb794('0x1a')][_0xb794('0x22')]);_0xa0c655['where']=qs['filters'](_['pick'](_0x518d3d[_0xb794('0x1a')],_0x5494e7[_0xb794('0x1c')]),_0x22d126);if(_0x518d3d[_0xb794('0x1a')]['filter']){_0xa0c655[_0xb794('0x23')]=_['merge'](_0xa0c655[_0xb794('0x23')],{'$or':_[_0xb794('0x14')](_0x22d126,function(_0x54f90f){if(_0x54f90f[_0xb794('0x18')]!=='VIRTUAL'){var _0x28e489={};_0x28e489[_0x54f90f[_0xb794('0x11')]]={'$like':'%'+_0x518d3d['query'][_0xb794('0x24')]+'%'};return _0x28e489;}})});}_0xa0c655=_[_0xb794('0x25')]({},_0xa0c655,_0x518d3d[_0xb794('0x26')]);var _0x2b83d8={'where':_0xa0c655[_0xb794('0x23')]};return db[_0xb794('0x15')][_0xb794('0x6')](_0x2b83d8)['then'](function(_0x226762){_0x10d905['count']=_0x226762;if(_0x518d3d[_0xb794('0x1a')]['includeAll']){_0xa0c655[_0xb794('0x27')]=[{'attributes':['id',_0xb794('0x11'),_0xb794('0x28'),'alias'],'model':db['User'],'as':_0xb794('0x29')}];}return db[_0xb794('0x15')][_0xb794('0x2a')](_0xa0c655);})['then'](function(_0x149608){_0x10d905[_0xb794('0x2b')]=_0x149608;return _0x10d905;})[_0xb794('0xd')](respondWithFilteredResult(_0x722b1b,_0xa0c655))[_0xb794('0x2c')](handleError(_0x722b1b,null));};exports[_0xb794('0x2d')]=function(_0x4c1137,_0x2cf4d0){var _0x18d872={'raw':!![],'where':{'id':_0x4c1137[_0xb794('0x2e')]['id']}},_0x14fb3a={};_0x14fb3a['model']=_[_0xb794('0x1b')](db[_0xb794('0x15')][_0xb794('0x16')]);_0x14fb3a['query']=_['keys'](_0x4c1137[_0xb794('0x1a')]);_0x14fb3a[_0xb794('0x1c')]=_['intersection'](_0x14fb3a[_0xb794('0x19')],_0x14fb3a[_0xb794('0x1a')]);_0x18d872[_0xb794('0x1e')]=_['intersection'](_0x14fb3a[_0xb794('0x19')],qs[_0xb794('0x1f')](_0x4c1137[_0xb794('0x1a')][_0xb794('0x1f')]));_0x18d872[_0xb794('0x1e')]=_0x18d872[_0xb794('0x1e')][_0xb794('0x2f')]?_0x18d872[_0xb794('0x1e')]:_0x14fb3a[_0xb794('0x19')];if(_0x4c1137['query']['includeAll']){_0x18d872[_0xb794('0x27')]=[{'all':!![]}];}_0x18d872=_['merge']({},_0x18d872,_0x4c1137[_0xb794('0x26')]);return db[_0xb794('0x15')][_0xb794('0x30')](_0x18d872)[_0xb794('0xd')](handleEntityNotFound(_0x2cf4d0,null))['then'](respondWithResult(_0x2cf4d0,null))[_0xb794('0x2c')](handleError(_0x2cf4d0,null));};exports['create']=function(_0x12c344,_0x8240e1){return db[_0xb794('0x15')][_0xb794('0x31')](_0x12c344[_0xb794('0x32')],{})['then'](respondWithResult(_0x8240e1,0xc9))[_0xb794('0x2c')](handleError(_0x8240e1,null));};exports[_0xb794('0x33')]=function(_0x3d3111,_0x8aaace){return db[_0xb794('0x15')][_0xb794('0x30')]({'where':{'id':_0x3d3111[_0xb794('0x2e')]['id']}})[_0xb794('0xd')](handleEntityNotFound(_0x8aaace,null))[_0xb794('0xd')](removeEntity(_0x8aaace,null))[_0xb794('0x2c')](handleError(_0x8aaace,null));};exports[_0xb794('0x34')]=function(_0x3b85de,_0x512b6a){return db['VoiceCallReport']['describe']()['then'](respondWithResult(_0x512b6a,null))[_0xb794('0x2c')](handleError(_0x512b6a,null));};function findForUpdate(_0x52996e){return db[_0xb794('0x15')][_0xb794('0x30')]({'where':{'uniqueid':_0x52996e[_0xb794('0x2e')]['id'],'UserId':{'$or':[null,_0x52996e[_0xb794('0x35')]['id']]}}});}exports['update']=function(_0x567294,_0xc5b454){if(_0x567294['body']['uniqueid']){delete _0x567294['body']['uniqueid'];}return findForUpdate(_0x567294)[_0xb794('0xd')](handleEntityNotFound(_0xc5b454,null))[_0xb794('0xd')](saveUpdates(_0x567294[_0xb794('0x32')],null))[_0xb794('0xd')](respondWithResult(_0xc5b454,null))[_0xb794('0x2c')](handleError(_0xc5b454,null));};exports[_0xb794('0x36')]=function(_0xbf47c5,_0x18a548,_0x4a08ec){if(_0xbf47c5['body'][_0xb794('0x37')]){delete _0xbf47c5['body'][_0xb794('0x37')];}promiseRetry(function(_0x2f472e){return findForUpdate(_0xbf47c5)[_0xb794('0xd')](function(_0x3f2e12){if(_0x3f2e12!==null){return _0x3f2e12;}else{_0x2f472e(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0xb794('0xd')](function(_0x572fe3){if(!_0x572fe3){return new Promise(function(_0x4ac196){_0x4ac196(handleEntityNotFound(_0x18a548)());});}else{return _0x572fe3[_0xb794('0xc')](_0xbf47c5['body'])['then'](function(_0x1c5609){return respondWithResult(_0x18a548)(_0x1c5609);});}},function(){handleEntityNotFound(_0x18a548)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3054842..7d20541 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 _0xad63=['path','../../config/environment','exports','report_call','uniqueid','lodash','util','../../config/logger','moment'];(function(_0xd1cf76,_0x1e667d){var _0x580cbf=function(_0x51dc24){while(--_0x51dc24){_0xd1cf76['push'](_0xd1cf76['shift']());}};_0x580cbf(++_0x1e667d);}(_0xad63,0xf8));var _0x3ad6=function(_0xdbe5a0,_0x123d8b){_0xdbe5a0=_0xdbe5a0-0x0;var _0x2463cc=_0xad63[_0xdbe5a0];return _0x2463cc;};'use strict';var _=require(_0x3ad6('0x0'));var util=require(_0x3ad6('0x1'));var logger=require(_0x3ad6('0x2'))('api');var moment=require(_0x3ad6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ad6('0x4'));var rimraf=require('rimraf');var config=require(_0x3ad6('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x3ad6('0x6')]=function(_0x1b973a,_0x3d31aa){return _0x1b973a['define']('VoiceCallReport',attributes,{'tableName':_0x3ad6('0x7'),'paranoid':![],'indexes':[{'fields':[_0x3ad6('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab64=['path','rimraf','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0xab64,0x18d));var _0x4ab6=function(_0x5eed61,_0x1cda13){_0x5eed61=_0x5eed61-0x0;var _0x19190e=_0xab64[_0x5eed61];return _0x19190e;};'use strict';var _=require(_0x4ab6('0x0'));var util=require(_0x4ab6('0x1'));var logger=require('../../config/logger')(_0x4ab6('0x2'));var moment=require(_0x4ab6('0x3'));var BPromise=require(_0x4ab6('0x4'));var rp=require(_0x4ab6('0x5'));var fs=require('fs');var path=require(_0x4ab6('0x6'));var rimraf=require(_0x4ab6('0x7'));var config=require('../../config/environment');var attributes=require(_0x4ab6('0x8'));module[_0x4ab6('0x9')]=function(_0x2cc8fb,_0x2063c1){return _0x2cc8fb[_0x4ab6('0xa')]('VoiceCallReport',attributes,{'tableName':_0x4ab6('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4ab6('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 150dbe8..37b7096 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 _0x0bc7=['UpdateVoiceCallReport','update','limit','util','moment','randomstring','ioredis','rpc','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','stringify','catch','CreateVoiceCallReport','body'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0x0bc7,0x1f2));var _0x70bc=function(_0x1bbff1,_0x542087){_0x1bbff1=_0x1bbff1-0x0;var _0x557ab6=_0x0bc7[_0x1bbff1];return _0x557ab6;};'use strict';var _=require('lodash');var util=require(_0x70bc('0x0'));var moment=require(_0x70bc('0x1'));var BPromise=require('bluebird');var rs=require(_0x70bc('0x2'));var fs=require('fs');var Redis=require(_0x70bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70bc('0x4'));var config=require('../../config/environment');var jayson=require(_0x70bc('0x5'));var client=jayson[_0x70bc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b9fb0,_0x27c56f,_0x40bf4b){return new BPromise(function(_0x1bb851,_0x32676f){return client[_0x70bc('0x7')](_0x2b9fb0,_0x40bf4b)[_0x70bc('0x8')](function(_0x71c1ea){logger[_0x70bc('0x9')](_0x70bc('0xa'),_0x27c56f,_0x70bc('0xb'));logger[_0x70bc('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x27c56f,_0x70bc('0xb'),JSON['stringify'](_0x71c1ea));if(_0x71c1ea[_0x70bc('0xd')]){if(_0x71c1ea[_0x70bc('0xd')][_0x70bc('0xe')]===0x1f4){logger[_0x70bc('0xd')](_0x70bc('0xa'),_0x27c56f,_0x71c1ea[_0x70bc('0xd')][_0x70bc('0xf')]);return _0x32676f(_0x71c1ea[_0x70bc('0xd')][_0x70bc('0xf')]);}logger[_0x70bc('0xd')](_0x70bc('0xa'),_0x27c56f,_0x71c1ea[_0x70bc('0xd')][_0x70bc('0xf')]);return _0x1bb851(_0x71c1ea['error'][_0x70bc('0xf')]);}else{logger['info'](_0x70bc('0xa'),_0x27c56f,_0x70bc('0xb'));_0x1bb851(_0x71c1ea['result'][_0x70bc('0xf')]);}})['catch'](function(_0x4efea9){logger[_0x70bc('0xd')](_0x70bc('0xa'),_0x27c56f,_0x4efea9);_0x32676f(_0x4efea9);});});}exports[_0x70bc('0x10')]=function(_0x1dd491){var _0x1146f2=this;return new Promise(function(_0x3dd4e0,_0x48afb3){return db[_0x70bc('0x11')][_0x70bc('0x12')]({'raw':_0x1dd491[_0x70bc('0x13')]?_0x1dd491[_0x70bc('0x13')][_0x70bc('0x14')]===undefined?!![]:![]:!![],'where':_0x1dd491[_0x70bc('0x13')]?_0x1dd491[_0x70bc('0x13')][_0x70bc('0x15')]||null:null,'attributes':_0x1dd491[_0x70bc('0x13')]?_0x1dd491['options'][_0x70bc('0x16')]||null:null,'limit':_0x1dd491[_0x70bc('0x13')]?_0x1dd491[_0x70bc('0x13')]['limit']||null:null,'include':_0x1dd491[_0x70bc('0x13')]?_0x1dd491[_0x70bc('0x13')][_0x70bc('0x17')]?_[_0x70bc('0x18')](_0x1dd491[_0x70bc('0x13')][_0x70bc('0x17')],function(_0x17d0b2){return{'model':db[_0x17d0b2['model']],'as':_0x17d0b2['as'],'attributes':_0x17d0b2['attributes'],'include':_0x17d0b2[_0x70bc('0x17')]?_['map'](_0x17d0b2['include'],function(_0x2111ae){return{'model':db[_0x2111ae[_0x70bc('0x19')]],'as':_0x2111ae['as'],'attributes':_0x2111ae[_0x70bc('0x16')],'include':_0x2111ae['include']?_[_0x70bc('0x18')](_0x2111ae[_0x70bc('0x17')],function(_0x24c62b){return{'model':db[_0x24c62b[_0x70bc('0x19')]],'as':_0x24c62b['as'],'attributes':_0x24c62b[_0x70bc('0x16')]};}):[]};}):[]};}):[]:[]})[_0x70bc('0x8')](function(_0x5c3997){logger[_0x70bc('0x9')]('GetVoiceCallReport',_0x1dd491);logger[_0x70bc('0xc')](_0x70bc('0x10'),_0x1dd491,JSON[_0x70bc('0x1a')](_0x5c3997));_0x3dd4e0(_0x5c3997);})[_0x70bc('0x1b')](function(_0x17f636){logger['error']('GetVoiceCallReport',_0x17f636[_0x70bc('0xf')],_0x1dd491);_0x48afb3(_0x1146f2['error'](0x1f4,_0x17f636[_0x70bc('0xf')]));});});};exports[_0x70bc('0x1c')]=function(_0x57ec58){var _0x5a6549=this;return new Promise(function(_0x5f00f5,_0x174f03){return db[_0x70bc('0x11')]['create'](_0x57ec58[_0x70bc('0x1d')],{'raw':_0x57ec58['options']?_0x57ec58[_0x70bc('0x13')][_0x70bc('0x14')]===undefined?!![]:![]:!![]})[_0x70bc('0x8')](function(_0x1c24bd){logger['info'](_0x70bc('0x1c'),_0x57ec58);logger['debug'](_0x70bc('0x1c'),_0x57ec58,JSON['stringify'](_0x1c24bd));_0x5f00f5(_0x1c24bd);})[_0x70bc('0x1b')](function(_0x56b4b6){logger[_0x70bc('0xd')](_0x70bc('0x1c'),_0x56b4b6[_0x70bc('0xf')],_0x57ec58);_0x174f03(_0x5a6549[_0x70bc('0xd')](0x1f4,_0x56b4b6[_0x70bc('0xf')]));});});};exports[_0x70bc('0x1e')]=function(_0x28f802){var _0x3125c8=this;return new Promise(function(_0x343ec3,_0x842aa9){return db[_0x70bc('0x11')][_0x70bc('0x1f')](_0x28f802[_0x70bc('0x1d')],{'raw':_0x28f802['options']?_0x28f802[_0x70bc('0x13')][_0x70bc('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28f802[_0x70bc('0x13')]?_0x28f802[_0x70bc('0x13')][_0x70bc('0x15')]||null:null,'attributes':_0x28f802[_0x70bc('0x13')]?_0x28f802[_0x70bc('0x13')][_0x70bc('0x16')]||null:null,'limit':_0x28f802['options']?_0x28f802[_0x70bc('0x13')][_0x70bc('0x20')]||null:null})['then'](function(_0x4379f4){logger[_0x70bc('0x9')](_0x70bc('0x1e'),_0x28f802);logger[_0x70bc('0xc')](_0x70bc('0x1e'),_0x28f802,JSON[_0x70bc('0x1a')](_0x4379f4));_0x343ec3(_0x4379f4);})['catch'](function(_0xa33510){logger[_0x70bc('0xd')](_0x70bc('0x1e'),_0xa33510[_0x70bc('0xf')],_0x28f802);_0x842aa9(_0x3125c8[_0x70bc('0xd')](0x1f4,_0xa33510[_0x70bc('0xf')]));});});}; \ No newline at end of file +var _0x9e16=['options','raw','where','attributes','include','map','model','then','CreateVoiceCallReport','VoiceCallReport','create','body','update','UpdateVoiceCallReport','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetVoiceCallReport','findAll'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x9e16,0x103));var _0x69e1=function(_0x447578,_0x1ebab2){_0x447578=_0x447578-0x0;var _0x5cdd4f=_0x9e16[_0x447578];return _0x5cdd4f;};'use strict';var _=require('lodash');var util=require(_0x69e1('0x0'));var moment=require(_0x69e1('0x1'));var BPromise=require(_0x69e1('0x2'));var rs=require(_0x69e1('0x3'));var fs=require('fs');var Redis=require(_0x69e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x69e1('0x5'))('rpc');var config=require(_0x69e1('0x6'));var jayson=require(_0x69e1('0x7'));var client=jayson['client'][_0x69e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3469fb,_0x49032e,_0x4fa4a7){return new BPromise(function(_0xfcd619,_0x41fb28){return client[_0x69e1('0x9')](_0x3469fb,_0x4fa4a7)['then'](function(_0x909648){logger['info'](_0x69e1('0xa'),_0x49032e,_0x69e1('0xb'));logger[_0x69e1('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x49032e,_0x69e1('0xb'),JSON[_0x69e1('0xd')](_0x909648));if(_0x909648[_0x69e1('0xe')]){if(_0x909648[_0x69e1('0xe')]['code']===0x1f4){logger[_0x69e1('0xe')](_0x69e1('0xa'),_0x49032e,_0x909648['error'][_0x69e1('0xf')]);return _0x41fb28(_0x909648[_0x69e1('0xe')]['message']);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x49032e,_0x909648[_0x69e1('0xe')]['message']);return _0xfcd619(_0x909648[_0x69e1('0xe')][_0x69e1('0xf')]);}else{logger[_0x69e1('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x49032e,_0x69e1('0xb'));_0xfcd619(_0x909648[_0x69e1('0x11')]['message']);}})[_0x69e1('0x12')](function(_0x99c33e){logger[_0x69e1('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x49032e,_0x99c33e);_0x41fb28(_0x99c33e);});});}exports[_0x69e1('0x13')]=function(_0x96f92e){var _0x8b8810=this;return new Promise(function(_0x275066,_0x285cc8){return db['VoiceCallReport'][_0x69e1('0x14')]({'raw':_0x96f92e['options']?_0x96f92e[_0x69e1('0x15')][_0x69e1('0x16')]===undefined?!![]:![]:!![],'where':_0x96f92e[_0x69e1('0x15')]?_0x96f92e[_0x69e1('0x15')][_0x69e1('0x17')]||null:null,'attributes':_0x96f92e[_0x69e1('0x15')]?_0x96f92e[_0x69e1('0x15')][_0x69e1('0x18')]||null:null,'limit':_0x96f92e[_0x69e1('0x15')]?_0x96f92e[_0x69e1('0x15')]['limit']||null:null,'include':_0x96f92e['options']?_0x96f92e['options'][_0x69e1('0x19')]?_[_0x69e1('0x1a')](_0x96f92e[_0x69e1('0x15')][_0x69e1('0x19')],function(_0x1c46c8){return{'model':db[_0x1c46c8['model']],'as':_0x1c46c8['as'],'attributes':_0x1c46c8[_0x69e1('0x18')],'include':_0x1c46c8['include']?_['map'](_0x1c46c8['include'],function(_0x4f3955){return{'model':db[_0x4f3955['model']],'as':_0x4f3955['as'],'attributes':_0x4f3955[_0x69e1('0x18')],'include':_0x4f3955['include']?_[_0x69e1('0x1a')](_0x4f3955[_0x69e1('0x19')],function(_0x515b85){return{'model':db[_0x515b85[_0x69e1('0x1b')]],'as':_0x515b85['as'],'attributes':_0x515b85[_0x69e1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x69e1('0x1c')](function(_0x46d27b){logger['info'](_0x69e1('0x13'),_0x96f92e);logger[_0x69e1('0xc')](_0x69e1('0x13'),_0x96f92e,JSON['stringify'](_0x46d27b));_0x275066(_0x46d27b);})[_0x69e1('0x12')](function(_0x57eb8c){logger[_0x69e1('0xe')]('GetVoiceCallReport',_0x57eb8c['message'],_0x96f92e);_0x285cc8(_0x8b8810[_0x69e1('0xe')](0x1f4,_0x57eb8c[_0x69e1('0xf')]));});});};exports[_0x69e1('0x1d')]=function(_0x425977){var _0x1cbc2a=this;return new Promise(function(_0x146ab8,_0x32b7d0){return db[_0x69e1('0x1e')][_0x69e1('0x1f')](_0x425977[_0x69e1('0x20')],{'raw':_0x425977['options']?_0x425977[_0x69e1('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x69e1('0x1c')](function(_0x9523a6){logger[_0x69e1('0x10')]('CreateVoiceCallReport',_0x425977);logger['debug'](_0x69e1('0x1d'),_0x425977,JSON[_0x69e1('0xd')](_0x9523a6));_0x146ab8(_0x9523a6);})[_0x69e1('0x12')](function(_0x2c223c){logger['error'](_0x69e1('0x1d'),_0x2c223c[_0x69e1('0xf')],_0x425977);_0x32b7d0(_0x1cbc2a[_0x69e1('0xe')](0x1f4,_0x2c223c[_0x69e1('0xf')]));});});};exports['UpdateVoiceCallReport']=function(_0x159cab){var _0x8e77ca=this;return new Promise(function(_0x2a958d,_0x132383){return db[_0x69e1('0x1e')][_0x69e1('0x21')](_0x159cab[_0x69e1('0x20')],{'raw':_0x159cab[_0x69e1('0x15')]?_0x159cab[_0x69e1('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x159cab['options']?_0x159cab[_0x69e1('0x15')][_0x69e1('0x17')]||null:null,'attributes':_0x159cab['options']?_0x159cab[_0x69e1('0x15')][_0x69e1('0x18')]||null:null,'limit':_0x159cab[_0x69e1('0x15')]?_0x159cab[_0x69e1('0x15')]['limit']||null:null})[_0x69e1('0x1c')](function(_0x3dff82){logger[_0x69e1('0x10')](_0x69e1('0x22'),_0x159cab);logger['debug'](_0x69e1('0x22'),_0x159cab,JSON['stringify'](_0x3dff82));_0x2a958d(_0x3dff82);})[_0x69e1('0x12')](function(_0x35cd86){logger[_0x69e1('0xe')](_0x69e1('0x22'),_0x35cd86['message'],_0x159cab);_0x132383(_0x8e77ca['error'](0x1f4,_0x35cd86['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9f1dd13..e87f4cd 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 _0x6d62=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','create','delete','multer','path'];(function(_0x3459d9,_0x49fa44){var _0x572281=function(_0x5242c1){while(--_0x5242c1){_0x3459d9['push'](_0x3459d9['shift']());}};_0x572281(++_0x49fa44);}(_0x6d62,0x85));var _0x26d6=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0x6d62[_0x11dc39];return _0x457277;};'use strict';var multer=require(_0x26d6('0x0'));var util=require('util');var path=require(_0x26d6('0x1'));var timeout=require(_0x26d6('0x2'));var express=require(_0x26d6('0x3'));var router=express[_0x26d6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x26d6('0x5'));var interaction=require(_0x26d6('0x6'));var config=require(_0x26d6('0x7'));var controller=require(_0x26d6('0x8'));router[_0x26d6('0x9')]('/',auth[_0x26d6('0xa')](),controller[_0x26d6('0xb')]);router['get'](_0x26d6('0xc'),auth[_0x26d6('0xa')](),controller['show']);router['post']('/',auth[_0x26d6('0xa')](),controller[_0x26d6('0xd')]);router['put'](_0x26d6('0xc'),auth[_0x26d6('0xa')](),controller['update']);router[_0x26d6('0xe')](_0x26d6('0xc'),auth[_0x26d6('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x80e3=['isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','/:id'];(function(_0x359f7c,_0x15ea3c){var _0x504b41=function(_0x17818d){while(--_0x17818d){_0x359f7c['push'](_0x359f7c['shift']());}};_0x504b41(++_0x15ea3c);}(_0x80e3,0x14b));var _0x380e=function(_0x72ac40,_0x5702ac){_0x72ac40=_0x72ac40-0x0;var _0x12e53c=_0x80e3[_0x72ac40];return _0x12e53c;};'use strict';var multer=require(_0x380e('0x0'));var util=require(_0x380e('0x1'));var path=require(_0x380e('0x2'));var timeout=require(_0x380e('0x3'));var express=require(_0x380e('0x4'));var router=express['Router']();var fs_extra=require(_0x380e('0x5'));var auth=require(_0x380e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x380e('0x7'));var controller=require(_0x380e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x380e('0x9')](_0x380e('0xa'),auth[_0x380e('0xb')](),controller[_0x380e('0xc')]);router[_0x380e('0xd')]('/',auth[_0x380e('0xb')](),controller[_0x380e('0xe')]);router['put'](_0x380e('0xa'),auth[_0x380e('0xb')](),controller[_0x380e('0xf')]);router[_0x380e('0x10')](_0x380e('0xa'),auth['isAuthenticated'](),controller[_0x380e('0x11')]);module[_0x380e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index bceec49..de98459 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 _0x9668=['split','BOOLEAN','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x27af74,_0x138538){var _0x22f288=function(_0x4699f5){while(--_0x4699f5){_0x27af74['push'](_0x27af74['shift']());}};_0x22f288(++_0x138538);}(_0x9668,0x185));var _0x8966=function(_0x23cc28,_0x357303){_0x23cc28=_0x23cc28-0x0;var _0x31402c=_0x9668[_0x23cc28];return _0x31402c;};'use strict';var Sequelize=require('sequelize');module[_0x8966('0x0')]={'name':{'type':Sequelize[_0x8966('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x8966('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x8966('0x1')],'set':function(_0x3ea1a3){this[_0x8966('0x3')](_0x8966('0x4'),_0x3ea1a3?_0x3ea1a3[_0x8966('0x5')](''):[]);},'get':function(){return this[_0x8966('0x6')](_0x8966('0x4'))?this[_0x8966('0x6')](_0x8966('0x4'))[_0x8966('0x7')](''):[];}},'auth':{'type':Sequelize[_0x8966('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x8966('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8966('0x1')]}}; \ No newline at end of file +var _0x5942=['STRING','options','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0xf9e6f6,_0x5c0767){var _0x73bae1=function(_0x13af6){while(--_0x13af6){_0xf9e6f6['push'](_0xf9e6f6['shift']());}};_0x73bae1(++_0x5c0767);}(_0x5942,0x17f));var _0x2594=function(_0x2f7100,_0x5f1e3c){_0x2f7100=_0x2f7100-0x0;var _0x1a7324=_0x5942[_0x2f7100];return _0x1a7324;};'use strict';var Sequelize=require(_0x2594('0x0'));module[_0x2594('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x2594('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x2594('0x2')],'set':function(_0x23f8d4){this['setDataValue'](_0x2594('0x3'),_0x23f8d4?_0x23f8d4['join'](''):[]);},'get':function(){return this[_0x2594('0x4')](_0x2594('0x3'))?this[_0x2594('0x4')]('options')[_0x2594('0x5')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x2594('0x2')]},'record':{'type':Sequelize[_0x2594('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2594('0x2')]},'description':{'type':Sequelize[_0x2594('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a644e34..15c9265 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 _0x8d53=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','get','ChanSpies','UserProfileResource','error','stack','send','index','VoiceChanSpy','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find'];(function(_0xa601a2,_0x47718e){var _0x54af8a=function(_0x20521c){while(--_0x20521c){_0xa601a2['push'](_0xa601a2['shift']());}};_0x54af8a(++_0x47718e);}(_0x8d53,0x1c2));var _0x38d5=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0x8d53[_0x58803c];return _0xf95b9b;};'use strict';var emlformat=require(_0x38d5('0x0'));var rimraf=require(_0x38d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38d5('0x2'));var rp=require(_0x38d5('0x3'));var moment=require(_0x38d5('0x4'));var BPromise=require(_0x38d5('0x5'));var Mustache=require(_0x38d5('0x6'));var util=require(_0x38d5('0x7'));var path=require(_0x38d5('0x8'));var sox=require(_0x38d5('0x9'));var csv=require('to-csv');var ejs=require(_0x38d5('0xa'));var fs=require('fs');var fs_extra=require(_0x38d5('0xb'));var _=require(_0x38d5('0xc'));var squel=require('squel');var crypto=require(_0x38d5('0xd'));var jsforce=require(_0x38d5('0xe'));var deskjs=require(_0x38d5('0xf'));var toCsv=require(_0x38d5('0x10'));var querystring=require(_0x38d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x38d5('0x12'));var authService=require(_0x38d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x38d5('0x14'));var hardwareService=require(_0x38d5('0x15'));var logger=require(_0x38d5('0x16'))(_0x38d5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x38d5('0x18'));var db=require(_0x38d5('0x19'))['db'];function respondWithStatusCode(_0x53c236,_0x421410){_0x421410=_0x421410||0xcc;return function(_0x4dbccf){if(_0x4dbccf){return _0x53c236[_0x38d5('0x1a')](_0x421410);}return _0x53c236[_0x38d5('0x1b')](_0x421410)[_0x38d5('0x1c')]();};}function respondWithResult(_0x413055,_0x217a90){_0x217a90=_0x217a90||0xc8;return function(_0x3115b5){if(_0x3115b5){return _0x413055['status'](_0x217a90)[_0x38d5('0x1d')](_0x3115b5);}};}function respondWithFilteredResult(_0x4c8f0f,_0xa455d1){return function(_0x53e995){if(_0x53e995){var _0x44cfa8=typeof _0xa455d1[_0x38d5('0x1e')]===_0x38d5('0x1f')&&typeof _0xa455d1['limit']===_0x38d5('0x1f');var _0x2a2b7d=_0x53e995[_0x38d5('0x20')];var _0xdc1374=_0x44cfa8?0x0:_0xa455d1[_0x38d5('0x1e')];var _0x380904=_0x44cfa8?_0x53e995['count']:_0xa455d1[_0x38d5('0x1e')]+_0xa455d1['limit'];var _0x55c0e1;if(_0x380904>=_0x2a2b7d){_0x380904=_0x2a2b7d;_0x55c0e1=0xc8;}else{_0x55c0e1=0xce;}_0x4c8f0f['status'](_0x55c0e1);return _0x4c8f0f[_0x38d5('0x21')](_0x38d5('0x22'),_0xdc1374+'-'+_0x380904+'/'+_0x2a2b7d)[_0x38d5('0x1d')](_0x53e995);}return null;};}function patchUpdates(_0x4c7ce3){return function(_0x48eb53){try{jsonpatch[_0x38d5('0x23')](_0x48eb53,_0x4c7ce3,!![]);}catch(_0x1c5289){return BPromise[_0x38d5('0x24')](_0x1c5289);}return _0x48eb53['save']();};}function saveUpdates(_0x3eb7d1,_0x58d42a){return function(_0x83a6be){if(_0x83a6be){return _0x83a6be[_0x38d5('0x25')](_0x3eb7d1)['then'](function(_0x567ef9){return _0x567ef9;});}return null;};}function removeEntity(_0x34d764,_0x4e1b5f){return function(_0x3d1c85){if(_0x3d1c85){return _0x3d1c85['destroy']()[_0x38d5('0x26')](function(){var _0x469c70=_0x3d1c85[_0x38d5('0x27')]({'plain':!![]});var _0x5b9552=_0x38d5('0x28');return db[_0x38d5('0x29')]['destroy']({'where':{'type':_0x5b9552,'resourceId':_0x469c70['id']}})[_0x38d5('0x26')](function(){return _0x3d1c85;});})[_0x38d5('0x26')](function(){_0x34d764[_0x38d5('0x1b')](0xcc)[_0x38d5('0x1c')]();});}};}function handleEntityNotFound(_0x3d8d86,_0x295591){return function(_0xbe992b){if(!_0xbe992b){_0x3d8d86[_0x38d5('0x1a')](0x194);}return _0xbe992b;};}function handleError(_0x1aed23,_0x2b4349){_0x2b4349=_0x2b4349||0x1f4;return function(_0x33d883){logger[_0x38d5('0x2a')](_0x33d883[_0x38d5('0x2b')]);if(_0x33d883['name']){delete _0x33d883['name'];}_0x1aed23['status'](_0x2b4349)[_0x38d5('0x2c')](_0x33d883);};}exports[_0x38d5('0x2d')]=function(_0x4ff0d4,_0x2f44be){var _0x21f708={},_0x2f18e4={},_0x1ad9ad={'count':0x0,'rows':[]};var _0x448e1b=_['map'](db[_0x38d5('0x2e')][_0x38d5('0x2f')],function(_0x37eb5c){return{'name':_0x37eb5c[_0x38d5('0x30')],'type':_0x37eb5c['type'][_0x38d5('0x31')]};});_0x2f18e4['model']=_[_0x38d5('0x32')](_0x448e1b,'name');_0x2f18e4[_0x38d5('0x33')]=_[_0x38d5('0x34')](_0x4ff0d4['query']);_0x2f18e4[_0x38d5('0x35')]=_[_0x38d5('0x36')](_0x2f18e4[_0x38d5('0x37')],_0x2f18e4['query']);_0x21f708[_0x38d5('0x38')]=_['intersection'](_0x2f18e4[_0x38d5('0x37')],qs[_0x38d5('0x39')](_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x39')]));_0x21f708['attributes']=_0x21f708[_0x38d5('0x38')][_0x38d5('0x3a')]?_0x21f708['attributes']:_0x2f18e4[_0x38d5('0x37')];if(!_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x3b')](_0x38d5('0x3c'))){_0x21f708[_0x38d5('0x3d')]=qs[_0x38d5('0x3d')](_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x3d')]);_0x21f708['offset']=qs[_0x38d5('0x1e')](_0x4ff0d4['query'][_0x38d5('0x1e')]);}_0x21f708[_0x38d5('0x3e')]=qs[_0x38d5('0x3f')](_0x4ff0d4['query']['sort']);_0x21f708[_0x38d5('0x40')]=qs[_0x38d5('0x35')](_[_0x38d5('0x41')](_0x4ff0d4['query'],_0x2f18e4['filters']),_0x448e1b);if(_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x42')]){_0x21f708[_0x38d5('0x40')]=_[_0x38d5('0x43')](_0x21f708['where'],{'$or':_[_0x38d5('0x32')](_0x448e1b,function(_0x36f391){if(_0x36f391[_0x38d5('0x44')]!==_0x38d5('0x45')){var _0x5c45da={};_0x5c45da[_0x36f391['name']]={'$like':'%'+_0x4ff0d4['query'][_0x38d5('0x42')]+'%'};return _0x5c45da;}})});}_0x21f708=_[_0x38d5('0x43')]({},_0x21f708,_0x4ff0d4[_0x38d5('0x46')]);var _0x19f46f={'where':_0x21f708[_0x38d5('0x40')]};return db[_0x38d5('0x2e')]['count'](_0x19f46f)[_0x38d5('0x26')](function(_0x2d8122){_0x1ad9ad[_0x38d5('0x20')]=_0x2d8122;if(_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x47')]){_0x21f708[_0x38d5('0x48')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x38d5('0x49')](_0x21f708);})[_0x38d5('0x26')](function(_0x48612c){_0x1ad9ad[_0x38d5('0x4a')]=_0x48612c;return _0x1ad9ad;})[_0x38d5('0x26')](respondWithFilteredResult(_0x2f44be,_0x21f708))[_0x38d5('0x4b')](handleError(_0x2f44be,null));};exports[_0x38d5('0x4c')]=function(_0xdfb5fb,_0x22dbf6){var _0x886d40={'raw':![],'where':{'id':_0xdfb5fb['params']['id']}},_0x26d79a={};_0x26d79a[_0x38d5('0x37')]=_['keys'](db['VoiceChanSpy'][_0x38d5('0x2f')]);_0x26d79a['query']=_['keys'](_0xdfb5fb['query']);_0x26d79a['filters']=_['intersection'](_0x26d79a['model'],_0x26d79a['query']);_0x886d40['attributes']=_[_0x38d5('0x36')](_0x26d79a[_0x38d5('0x37')],qs[_0x38d5('0x39')](_0xdfb5fb[_0x38d5('0x33')][_0x38d5('0x39')]));_0x886d40[_0x38d5('0x38')]=_0x886d40[_0x38d5('0x38')][_0x38d5('0x3a')]?_0x886d40[_0x38d5('0x38')]:_0x26d79a[_0x38d5('0x37')];if(_0xdfb5fb[_0x38d5('0x33')][_0x38d5('0x47')]){_0x886d40[_0x38d5('0x48')]=[{'all':!![]}];}_0x886d40=_[_0x38d5('0x43')]({},_0x886d40,_0xdfb5fb[_0x38d5('0x46')]);return db[_0x38d5('0x2e')][_0x38d5('0x4d')](_0x886d40)[_0x38d5('0x26')](handleEntityNotFound(_0x22dbf6,null))[_0x38d5('0x26')](respondWithResult(_0x22dbf6,null))['catch'](handleError(_0x22dbf6,null));};exports['create']=function(_0x4bdd78,_0x91cd1d){return db[_0x38d5('0x2e')][_0x38d5('0x4e')](_0x4bdd78[_0x38d5('0x4f')],{})[_0x38d5('0x26')](function(_0xe1cce1){var _0x83ccd6=_0x4bdd78[_0x38d5('0x50')][_0x38d5('0x27')]({'plain':!![]});if(!_0x83ccd6)throw new Error(_0x38d5('0x51'));if(_0x83ccd6[_0x38d5('0x52')]===_0x38d5('0x50')){var _0x2810c4=_0xe1cce1[_0x38d5('0x27')]({'plain':!![]});var _0x584829=_0x38d5('0x28');return db[_0x38d5('0x53')][_0x38d5('0x4d')]({'where':{'name':_0x584829,'userProfileId':_0x83ccd6[_0x38d5('0x54')]},'raw':!![]})['then'](function(_0x2140fe){if(_0x2140fe&&_0x2140fe['autoAssociation']===0x0){return db['UserProfileResource'][_0x38d5('0x4e')]({'name':_0x2810c4[_0x38d5('0x55')],'resourceId':_0x2810c4['id'],'type':_0x2140fe[_0x38d5('0x55')],'sectionId':_0x2140fe['id']},{})[_0x38d5('0x26')](function(){return _0xe1cce1;});}else{return _0xe1cce1;}})[_0x38d5('0x4b')](function(_0x50f422){logger[_0x38d5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50f422);throw _0x50f422;});}return _0xe1cce1;})[_0x38d5('0x26')](respondWithResult(_0x91cd1d,0xc9))[_0x38d5('0x4b')](handleError(_0x91cd1d,null));};exports['update']=function(_0x544f9c,_0x522d13){if(_0x544f9c[_0x38d5('0x4f')]['id']){delete _0x544f9c['body']['id'];}return db[_0x38d5('0x2e')][_0x38d5('0x4d')]({'where':{'id':_0x544f9c[_0x38d5('0x56')]['id']}})[_0x38d5('0x26')](handleEntityNotFound(_0x522d13,null))[_0x38d5('0x26')](saveUpdates(_0x544f9c[_0x38d5('0x4f')],null))[_0x38d5('0x26')](respondWithResult(_0x522d13,null))[_0x38d5('0x4b')](handleError(_0x522d13,null));};exports[_0x38d5('0x57')]=function(_0x53cea9,_0x303dd8){return db['VoiceChanSpy'][_0x38d5('0x4d')]({'where':{'id':_0x53cea9[_0x38d5('0x56')]['id']}})['then'](handleEntityNotFound(_0x303dd8,null))['then'](removeEntity(_0x303dd8,null))[_0x38d5('0x4b')](handleError(_0x303dd8,null));}; \ No newline at end of file +var _0x89f7=['findAll','catch','include','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','error','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll'];(function(_0x5d75ff,_0x5bc7ac){var _0x1c1894=function(_0x1fcade){while(--_0x1fcade){_0x5d75ff['push'](_0x5d75ff['shift']());}};_0x1c1894(++_0x5bc7ac);}(_0x89f7,0x105));var _0x789f=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0x89f7[_0x495b3d];return _0x4cb329;};'use strict';var emlformat=require(_0x789f('0x0'));var rimraf=require(_0x789f('0x1'));var zipdir=require(_0x789f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x789f('0x3'));var moment=require('moment');var BPromise=require(_0x789f('0x4'));var Mustache=require('mustache');var util=require(_0x789f('0x5'));var path=require(_0x789f('0x6'));var sox=require(_0x789f('0x7'));var csv=require(_0x789f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x789f('0x9'));var _=require(_0x789f('0xa'));var squel=require(_0x789f('0xb'));var crypto=require(_0x789f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x789f('0x8'));var querystring=require(_0x789f('0xd'));var Papa=require(_0x789f('0xe'));var Redis=require('ioredis');var authService=require(_0x789f('0xf'));var qs=require(_0x789f('0x10'));var as=require(_0x789f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x789f('0x12'));var licenseUtil=require(_0x789f('0x13'));var db=require(_0x789f('0x14'))['db'];function respondWithStatusCode(_0x137c31,_0x8819db){_0x8819db=_0x8819db||0xcc;return function(_0x3c9259){if(_0x3c9259){return _0x137c31['sendStatus'](_0x8819db);}return _0x137c31[_0x789f('0x15')](_0x8819db)[_0x789f('0x16')]();};}function respondWithResult(_0x103241,_0xe767ad){_0xe767ad=_0xe767ad||0xc8;return function(_0x4c16cb){if(_0x4c16cb){return _0x103241[_0x789f('0x15')](_0xe767ad)['json'](_0x4c16cb);}};}function respondWithFilteredResult(_0x7fd299,_0x511ca4){return function(_0x51207b){if(_0x51207b){var _0x264258=typeof _0x511ca4[_0x789f('0x17')]===_0x789f('0x18')&&typeof _0x511ca4[_0x789f('0x19')]===_0x789f('0x18');var _0x44058c=_0x51207b[_0x789f('0x1a')];var _0x509853=_0x264258?0x0:_0x511ca4[_0x789f('0x17')];var _0x678cfb=_0x264258?_0x51207b[_0x789f('0x1a')]:_0x511ca4[_0x789f('0x17')]+_0x511ca4[_0x789f('0x19')];var _0xe4bb84;if(_0x678cfb>=_0x44058c){_0x678cfb=_0x44058c;_0xe4bb84=0xc8;}else{_0xe4bb84=0xce;}_0x7fd299['status'](_0xe4bb84);return _0x7fd299[_0x789f('0x1b')](_0x789f('0x1c'),_0x509853+'-'+_0x678cfb+'/'+_0x44058c)[_0x789f('0x1d')](_0x51207b);}return null;};}function patchUpdates(_0x5f2999){return function(_0x2b2ab0){try{jsonpatch[_0x789f('0x1e')](_0x2b2ab0,_0x5f2999,!![]);}catch(_0x415c71){return BPromise[_0x789f('0x1f')](_0x415c71);}return _0x2b2ab0[_0x789f('0x20')]();};}function saveUpdates(_0x590d01,_0x2611d8){return function(_0x162855){if(_0x162855){return _0x162855['update'](_0x590d01)[_0x789f('0x21')](function(_0xf9781f){return _0xf9781f;});}return null;};}function removeEntity(_0x1a67f0,_0x8e445f){return function(_0x52e3c4){if(_0x52e3c4){return _0x52e3c4['destroy']()['then'](function(){var _0x15122a=_0x52e3c4[_0x789f('0x22')]({'plain':!![]});var _0x4c14bd=_0x789f('0x23');return db[_0x789f('0x24')][_0x789f('0x25')]({'where':{'type':_0x4c14bd,'resourceId':_0x15122a['id']}})['then'](function(){return _0x52e3c4;});})[_0x789f('0x21')](function(){_0x1a67f0[_0x789f('0x15')](0xcc)[_0x789f('0x16')]();});}};}function handleEntityNotFound(_0x4344ea,_0x558598){return function(_0x1550b){if(!_0x1550b){_0x4344ea[_0x789f('0x26')](0x194);}return _0x1550b;};}function handleError(_0x23037c,_0xa655be){_0xa655be=_0xa655be||0x1f4;return function(_0xd5a07){logger[_0x789f('0x27')](_0xd5a07['stack']);if(_0xd5a07[_0x789f('0x28')]){delete _0xd5a07[_0x789f('0x28')];}_0x23037c[_0x789f('0x15')](_0xa655be)[_0x789f('0x29')](_0xd5a07);};}exports[_0x789f('0x2a')]=function(_0x28c365,_0x4ff7d0){var _0x55d202={},_0x1e1421={},_0x47da54={'count':0x0,'rows':[]};var _0x34e5b7=_['map'](db[_0x789f('0x2b')][_0x789f('0x2c')],function(_0x2b626f){return{'name':_0x2b626f[_0x789f('0x2d')],'type':_0x2b626f[_0x789f('0x2e')][_0x789f('0x2f')]};});_0x1e1421[_0x789f('0x30')]=_['map'](_0x34e5b7,_0x789f('0x28'));_0x1e1421['query']=_[_0x789f('0x31')](_0x28c365['query']);_0x1e1421[_0x789f('0x32')]=_[_0x789f('0x33')](_0x1e1421[_0x789f('0x30')],_0x1e1421[_0x789f('0x34')]);_0x55d202[_0x789f('0x35')]=_[_0x789f('0x33')](_0x1e1421[_0x789f('0x30')],qs['fields'](_0x28c365[_0x789f('0x34')][_0x789f('0x36')]));_0x55d202[_0x789f('0x35')]=_0x55d202[_0x789f('0x35')][_0x789f('0x37')]?_0x55d202[_0x789f('0x35')]:_0x1e1421['model'];if(!_0x28c365['query'][_0x789f('0x38')](_0x789f('0x39'))){_0x55d202['limit']=qs[_0x789f('0x19')](_0x28c365[_0x789f('0x34')]['limit']);_0x55d202[_0x789f('0x17')]=qs[_0x789f('0x17')](_0x28c365[_0x789f('0x34')]['offset']);}_0x55d202[_0x789f('0x3a')]=qs[_0x789f('0x3b')](_0x28c365[_0x789f('0x34')]['sort']);_0x55d202[_0x789f('0x3c')]=qs['filters'](_[_0x789f('0x3d')](_0x28c365['query'],_0x1e1421[_0x789f('0x32')]),_0x34e5b7);if(_0x28c365[_0x789f('0x34')][_0x789f('0x3e')]){_0x55d202[_0x789f('0x3c')]=_['merge'](_0x55d202['where'],{'$or':_[_0x789f('0x3f')](_0x34e5b7,function(_0x418547){if(_0x418547[_0x789f('0x2e')]!==_0x789f('0x40')){var _0x13710e={};_0x13710e[_0x418547[_0x789f('0x28')]]={'$like':'%'+_0x28c365[_0x789f('0x34')][_0x789f('0x3e')]+'%'};return _0x13710e;}})});}_0x55d202=_[_0x789f('0x41')]({},_0x55d202,_0x28c365['options']);var _0xf8d12f={'where':_0x55d202[_0x789f('0x3c')]};return db['VoiceChanSpy'][_0x789f('0x1a')](_0xf8d12f)[_0x789f('0x21')](function(_0x31eecf){_0x47da54['count']=_0x31eecf;if(_0x28c365[_0x789f('0x34')][_0x789f('0x42')]){_0x55d202['include']=[{'all':!![]}];}return db[_0x789f('0x2b')][_0x789f('0x43')](_0x55d202);})[_0x789f('0x21')](function(_0x2c43ee){_0x47da54['rows']=_0x2c43ee;return _0x47da54;})['then'](respondWithFilteredResult(_0x4ff7d0,_0x55d202))[_0x789f('0x44')](handleError(_0x4ff7d0,null));};exports['show']=function(_0x25aa8d,_0x4e25f7){var _0x31b7bc={'raw':![],'where':{'id':_0x25aa8d['params']['id']}},_0xf491f4={};_0xf491f4['model']=_[_0x789f('0x31')](db['VoiceChanSpy']['rawAttributes']);_0xf491f4[_0x789f('0x34')]=_[_0x789f('0x31')](_0x25aa8d['query']);_0xf491f4['filters']=_['intersection'](_0xf491f4[_0x789f('0x30')],_0xf491f4['query']);_0x31b7bc['attributes']=_[_0x789f('0x33')](_0xf491f4[_0x789f('0x30')],qs[_0x789f('0x36')](_0x25aa8d[_0x789f('0x34')][_0x789f('0x36')]));_0x31b7bc[_0x789f('0x35')]=_0x31b7bc[_0x789f('0x35')][_0x789f('0x37')]?_0x31b7bc[_0x789f('0x35')]:_0xf491f4['model'];if(_0x25aa8d[_0x789f('0x34')][_0x789f('0x42')]){_0x31b7bc[_0x789f('0x45')]=[{'all':!![]}];}_0x31b7bc=_['merge']({},_0x31b7bc,_0x25aa8d[_0x789f('0x46')]);return db[_0x789f('0x2b')][_0x789f('0x47')](_0x31b7bc)[_0x789f('0x21')](handleEntityNotFound(_0x4e25f7,null))['then'](respondWithResult(_0x4e25f7,null))[_0x789f('0x44')](handleError(_0x4e25f7,null));};exports[_0x789f('0x48')]=function(_0x596c82,_0x218c5d){return db[_0x789f('0x2b')][_0x789f('0x48')](_0x596c82[_0x789f('0x49')],{})[_0x789f('0x21')](function(_0x55e340){var _0x3e1cb6=_0x596c82[_0x789f('0x4a')]['get']({'plain':!![]});if(!_0x3e1cb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1cb6[_0x789f('0x4b')]==='user'){var _0xfdba86=_0x55e340[_0x789f('0x22')]({'plain':!![]});var _0x1cdb86=_0x789f('0x23');return db[_0x789f('0x4c')][_0x789f('0x47')]({'where':{'name':_0x1cdb86,'userProfileId':_0x3e1cb6[_0x789f('0x4d')]},'raw':!![]})[_0x789f('0x21')](function(_0xa30f7){if(_0xa30f7&&_0xa30f7[_0x789f('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0xfdba86[_0x789f('0x28')],'resourceId':_0xfdba86['id'],'type':_0xa30f7[_0x789f('0x28')],'sectionId':_0xa30f7['id']},{})[_0x789f('0x21')](function(){return _0x55e340;});}else{return _0x55e340;}})[_0x789f('0x44')](function(_0x4d5700){logger[_0x789f('0x27')](_0x789f('0x4f'),_0x4d5700);throw _0x4d5700;});}return _0x55e340;})['then'](respondWithResult(_0x218c5d,0xc9))['catch'](handleError(_0x218c5d,null));};exports[_0x789f('0x50')]=function(_0x98ee83,_0x1418ef){if(_0x98ee83[_0x789f('0x49')]['id']){delete _0x98ee83[_0x789f('0x49')]['id'];}return db[_0x789f('0x2b')]['find']({'where':{'id':_0x98ee83['params']['id']}})[_0x789f('0x21')](handleEntityNotFound(_0x1418ef,null))[_0x789f('0x21')](saveUpdates(_0x98ee83[_0x789f('0x49')],null))[_0x789f('0x21')](respondWithResult(_0x1418ef,null))['catch'](handleError(_0x1418ef,null));};exports['destroy']=function(_0x347347,_0xc8f58){return db[_0x789f('0x2b')][_0x789f('0x47')]({'where':{'id':_0x347347[_0x789f('0x51')]['id']}})['then'](handleEntityNotFound(_0xc8f58,null))[_0x789f('0x21')](removeEntity(_0xc8f58,null))[_0x789f('0x44')](handleError(_0xc8f58,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 0e5a436..582707c 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 _0x71d0=['internal','name','findAll','agent','catch','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','then','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','push','Set','CDR(type)=%s','chanspy','record','merge','recordingFormat','auth','Authenticate','password','ChanSpy','options','join','StopMixMonitor','length','concat'];(function(_0x191b56,_0xfd47a6){var _0x21362a=function(_0x260cc7){while(--_0x260cc7){_0x191b56['push'](_0x191b56['shift']());}};_0x21362a(++_0xfd47a6);}(_0x71d0,0x1a4));var _0x071d=function(_0x4a4d71,_0x1d4d72){_0x4a4d71=_0x4a4d71-0x0;var _0x2f1f18=_0x71d0[_0x4a4d71];return _0x2f1f18;};'use strict';var _=require(_0x071d('0x0'));var util=require(_0x071d('0x1'));var BPromise=require(_0x071d('0x2'));var attributes=require(_0x071d('0x3'));var getUserApplications=function(_0x497afb,_0x4ffa27,_0x337cc7){var _0x8c1d18=0x1;var _0x57803a=[];var _0x5e2653={'context':_0x4ffa27[_0x071d('0x4')]||_0x071d('0x5'),'exten':util[_0x071d('0x6')](_0x071d('0x7'),_0x497afb['prefix'],_0x337cc7),'type':'system','isApp':![],'ChanSpyId':_0x497afb['id'],'UserId':_0x4ffa27['id']};_0x57803a[_0x071d('0x8')](_['merge']({'app':_0x071d('0x9'),'appdata':util['format'](_0x071d('0xa'),_0x071d('0xb')),'priority':_0x8c1d18++},_0x5e2653));if(_0x497afb[_0x071d('0xc')]){_0x57803a[_0x071d('0x8')](_[_0x071d('0xd')]({'app':'MixMonitor','appdata':util[_0x071d('0x6')]('${UNIQUEID}.%s,a',_0x497afb[_0x071d('0xe')]),'priority':_0x8c1d18++},_0x5e2653));}if(_0x497afb[_0x071d('0xf')]){_0x57803a[_0x071d('0x8')](_[_0x071d('0xd')]({'app':_0x071d('0x10'),'appdata':_0x497afb[_0x071d('0x11')],'priority':_0x8c1d18++},_0x5e2653));}_0x57803a['push'](_[_0x071d('0xd')]({'app':_0x071d('0x12'),'appdata':util[_0x071d('0x6')]('SIP/%s,%s',_0x4ffa27['name'],_0x497afb[_0x071d('0x13')]?_0x497afb[_0x071d('0x13')][_0x071d('0x14')](''):''),'priority':_0x8c1d18++},_0x5e2653));if(_0x497afb[_0x071d('0xc')]){_0x57803a[_0x071d('0x8')](_[_0x071d('0xd')]({'app':_0x071d('0x15'),'priority':_0x8c1d18++},_0x5e2653));}return _0x57803a;};var getChanSpyApplications=function(_0x3ed177,_0x340281){var _0x2fe427=[];for(var _0x2d10fb=0x0,_0xce8357=0x1;_0x2d10fb<_0x340281[_0x071d('0x16')];_0x2d10fb++,_0xce8357=0x1){_0x2fe427=_0x2fe427[_0x071d('0x17')](getUserApplications(_0x3ed177,_0x340281[_0x2d10fb],_0x340281[_0x2d10fb][_0x071d('0x18')]));if(_0x340281[_0x2d10fb]['internal']!=_0x340281[_0x2d10fb][_0x071d('0x19')]){_0x2fe427=_0x2fe427['concat'](getUserApplications(_0x3ed177,_0x340281[_0x2d10fb],_0x340281[_0x2d10fb]['name']));}}return _0x2fe427;};var getChanSpyPromise=function(_0xc5e580,_0x1b6966){return new BPromise(function(_0xda9680,_0x2fe1a9){return _0xc5e580['User'][_0x071d('0x1a')]({'attributes':['id','name',_0x071d('0x18')],'where':{'role':_0x071d('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x3718bb){if(_0x3718bb){return _0xda9680(getChanSpyApplications(_0x1b6966,_0x3718bb));}return _0xda9680([]);})[_0x071d('0x1c')](function(_0x152ba6){_0x2fe1a9(_0x152ba6);});});};module['exports']=function(_0x40b5e3,_0xe0d280){var _0x335a3f=_0x40b5e3[_0x071d('0x1d')];return _0x40b5e3[_0x071d('0x1e')](_0x071d('0x1f'),attributes,{'tableName':_0x071d('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d6125,_0x210659,_0x49d72a){return getChanSpyPromise(_0x335a3f,_0x5d6125)['then'](function(_0x438ade){if(_0x438ade&&_0x438ade[_0x071d('0x16')]){return _0x335a3f['VoiceExtension'][_0x071d('0x21')](_0x438ade);}})[_0x071d('0x22')](function(){_0x49d72a();})[_0x071d('0x1c')](function(_0x53c885){_0x49d72a(_0x53c885);});},'afterUpdate':function(_0x4d0a15,_0x29ef17,_0x255131){return _0x335a3f[_0x071d('0x23')][_0x071d('0x24')]({'where':{'ChanSpyId':_0x4d0a15['id']}})[_0x071d('0x22')](function(){return getChanSpyPromise(_0x335a3f,_0x4d0a15);})[_0x071d('0x22')](function(_0x1b91ca){if(_0x1b91ca&&_0x1b91ca['length']){return _0x335a3f[_0x071d('0x23')][_0x071d('0x21')](_0x1b91ca);}})[_0x071d('0x22')](function(){_0x255131();})[_0x071d('0x1c')](function(_0x6251fb){_0x255131(_0x6251fb);});},'afterDestroy':function(_0x38fd53,_0x4f3a3a,_0x500149){return _0x335a3f[_0x071d('0x23')]['destroy']({'where':{'ChanSpyId':_0x38fd53['id']}})[_0x071d('0x22')](function(){_0x500149();})[_0x071d('0x1c')](function(_0x314d21){_0x500149(_0x314d21);});}}});}; \ No newline at end of file +var _0x7dfc=['catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','merge','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','concat','internal','name','findAll','then','exports','models','VoiceChanSpy','length','VoiceExtension','bulkCreate'];(function(_0x56bcc1,_0x2b3e16){var _0x44cd89=function(_0x34d36d){while(--_0x34d36d){_0x56bcc1['push'](_0x56bcc1['shift']());}};_0x44cd89(++_0x2b3e16);}(_0x7dfc,0xfe));var _0xc7df=function(_0x2ca948,_0x54f129){_0x2ca948=_0x2ca948-0x0;var _0x178e3a=_0x7dfc[_0x2ca948];return _0x178e3a;};'use strict';var _=require(_0xc7df('0x0'));var util=require(_0xc7df('0x1'));var BPromise=require(_0xc7df('0x2'));var attributes=require(_0xc7df('0x3'));var getUserApplications=function(_0x4465b0,_0x4a009a,_0x47f017){var _0x10f97f=0x1;var _0x4cdb67=[];var _0x433e67={'context':_0x4a009a[_0xc7df('0x4')]||'from-sip','exten':util[_0xc7df('0x5')](_0xc7df('0x6'),_0x4465b0[_0xc7df('0x7')],_0x47f017),'type':_0xc7df('0x8'),'isApp':![],'ChanSpyId':_0x4465b0['id'],'UserId':_0x4a009a['id']};_0x4cdb67['push'](_[_0xc7df('0x9')]({'app':'Set','appdata':util[_0xc7df('0x5')]('CDR(type)=%s',_0xc7df('0xa')),'priority':_0x10f97f++},_0x433e67));if(_0x4465b0[_0xc7df('0xb')]){_0x4cdb67[_0xc7df('0xc')](_[_0xc7df('0x9')]({'app':_0xc7df('0xd'),'appdata':util[_0xc7df('0x5')](_0xc7df('0xe'),_0x4465b0[_0xc7df('0xf')]),'priority':_0x10f97f++},_0x433e67));}if(_0x4465b0[_0xc7df('0x10')]){_0x4cdb67[_0xc7df('0xc')](_[_0xc7df('0x9')]({'app':'Authenticate','appdata':_0x4465b0[_0xc7df('0x11')],'priority':_0x10f97f++},_0x433e67));}_0x4cdb67[_0xc7df('0xc')](_[_0xc7df('0x9')]({'app':_0xc7df('0x12'),'appdata':util[_0xc7df('0x5')](_0xc7df('0x13'),_0x4a009a['name'],_0x4465b0[_0xc7df('0x14')]?_0x4465b0[_0xc7df('0x14')][_0xc7df('0x15')](''):''),'priority':_0x10f97f++},_0x433e67));if(_0x4465b0[_0xc7df('0xb')]){_0x4cdb67[_0xc7df('0xc')](_[_0xc7df('0x9')]({'app':_0xc7df('0x16'),'priority':_0x10f97f++},_0x433e67));}return _0x4cdb67;};var getChanSpyApplications=function(_0x128d19,_0x238516){var _0x4c142a=[];for(var _0x717336=0x0,_0x476a53=0x1;_0x717336<_0x238516['length'];_0x717336++,_0x476a53=0x1){_0x4c142a=_0x4c142a[_0xc7df('0x17')](getUserApplications(_0x128d19,_0x238516[_0x717336],_0x238516[_0x717336][_0xc7df('0x18')]));if(_0x238516[_0x717336][_0xc7df('0x18')]!=_0x238516[_0x717336][_0xc7df('0x19')]){_0x4c142a=_0x4c142a['concat'](getUserApplications(_0x128d19,_0x238516[_0x717336],_0x238516[_0x717336][_0xc7df('0x19')]));}}return _0x4c142a;};var getChanSpyPromise=function(_0x3ae6c6,_0x39b88e){return new BPromise(function(_0x4ae4cb,_0x13fb2e){return _0x3ae6c6['User'][_0xc7df('0x1a')]({'attributes':['id','name',_0xc7df('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xc7df('0x1b')](function(_0x19fe40){if(_0x19fe40){return _0x4ae4cb(getChanSpyApplications(_0x39b88e,_0x19fe40));}return _0x4ae4cb([]);})['catch'](function(_0x278840){_0x13fb2e(_0x278840);});});};module[_0xc7df('0x1c')]=function(_0x10261f,_0x422b77){var _0x34ce5d=_0x10261f[_0xc7df('0x1d')];return _0x10261f['define'](_0xc7df('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x359f25,_0x2961ae,_0x3197d6){return getChanSpyPromise(_0x34ce5d,_0x359f25)['then'](function(_0x5df459){if(_0x5df459&&_0x5df459[_0xc7df('0x1f')]){return _0x34ce5d[_0xc7df('0x20')][_0xc7df('0x21')](_0x5df459);}})[_0xc7df('0x1b')](function(){_0x3197d6();})[_0xc7df('0x22')](function(_0x4cc717){_0x3197d6(_0x4cc717);});},'afterUpdate':function(_0x36fc81,_0x86dec6,_0xb8077a){return _0x34ce5d[_0xc7df('0x20')][_0xc7df('0x23')]({'where':{'ChanSpyId':_0x36fc81['id']}})[_0xc7df('0x1b')](function(){return getChanSpyPromise(_0x34ce5d,_0x36fc81);})[_0xc7df('0x1b')](function(_0x2f4049){if(_0x2f4049&&_0x2f4049[_0xc7df('0x1f')]){return _0x34ce5d['VoiceExtension'][_0xc7df('0x21')](_0x2f4049);}})[_0xc7df('0x1b')](function(){_0xb8077a();})[_0xc7df('0x22')](function(_0x5e5396){_0xb8077a(_0x5e5396);});},'afterDestroy':function(_0x5ec1fd,_0x1e7b7a,_0x12ac32){return _0x34ce5d['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x5ec1fd['id']}})[_0xc7df('0x1b')](function(){_0x12ac32();})[_0xc7df('0x22')](function(_0x11be58){_0x12ac32(_0x11be58);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 9f5d531..1d4bf7d 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 _0x1ba2=['message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var moment=require(_0x21ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x21ba('0x2'));var fs=require('fs');var Redis=require(_0x21ba('0x3'));var db=require(_0x21ba('0x4'))['db'];var utils=require(_0x21ba('0x5'));var logger=require(_0x21ba('0x6'))('rpc');var config=require(_0x21ba('0x7'));var jayson=require(_0x21ba('0x8'));var client=jayson['client'][_0x21ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53b3e0,_0x44eb71,_0x23c3b7){return new BPromise(function(_0x5c50aa,_0x17755a){return client['request'](_0x53b3e0,_0x23c3b7)[_0x21ba('0xa')](function(_0x261a15){logger['info'](_0x21ba('0xb'),_0x44eb71,_0x21ba('0xc'));logger[_0x21ba('0xd')](_0x21ba('0xe'),_0x44eb71,_0x21ba('0xc'),JSON[_0x21ba('0xf')](_0x261a15));if(_0x261a15[_0x21ba('0x10')]){if(_0x261a15[_0x21ba('0x10')][_0x21ba('0x11')]===0x1f4){logger[_0x21ba('0x10')](_0x21ba('0xb'),_0x44eb71,_0x261a15[_0x21ba('0x10')]['message']);return _0x17755a(_0x261a15['error'][_0x21ba('0x12')]);}logger[_0x21ba('0x10')](_0x21ba('0xb'),_0x44eb71,_0x261a15['error']['message']);return _0x5c50aa(_0x261a15[_0x21ba('0x10')]['message']);}else{logger[_0x21ba('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x44eb71,_0x21ba('0xc'));_0x5c50aa(_0x261a15[_0x21ba('0x14')][_0x21ba('0x12')]);}})[_0x21ba('0x15')](function(_0x10b9e6){logger['error'](_0x21ba('0xb'),_0x44eb71,_0x10b9e6);_0x17755a(_0x10b9e6);});});} \ No newline at end of file +var _0xc3fe=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0xc3fe,0xff));var _0xec3f=function(_0x34dde2,_0x526007){_0x34dde2=_0x34dde2-0x0;var _0x14eb46=_0xc3fe[_0x34dde2];return _0x14eb46;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var moment=require(_0xec3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xec3f('0x3'));var fs=require('fs');var Redis=require(_0xec3f('0x4'));var db=require(_0xec3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec3f('0x6'))(_0xec3f('0x7'));var config=require(_0xec3f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b0b84,_0x526183,_0x503775){return new BPromise(function(_0xcb8557,_0x5df7fc){return client[_0xec3f('0xa')](_0x3b0b84,_0x503775)[_0xec3f('0xb')](function(_0x12a7c5){logger[_0xec3f('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));logger[_0xec3f('0xe')](_0xec3f('0xf'),_0x526183,_0xec3f('0xd'),JSON[_0xec3f('0x10')](_0x12a7c5));if(_0x12a7c5[_0xec3f('0x11')]){if(_0x12a7c5['error'][_0xec3f('0x12')]===0x1f4){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0x12a7c5['error']['message']);return _0x5df7fc(_0x12a7c5[_0xec3f('0x11')]['message']);}logger['error'](_0xec3f('0x13'),_0x526183,_0x12a7c5[_0xec3f('0x11')][_0xec3f('0x14')]);return _0xcb8557(_0x12a7c5['error']['message']);}else{logger[_0xec3f('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));_0xcb8557(_0x12a7c5[_0xec3f('0x15')]['message']);}})[_0xec3f('0x16')](function(_0xb8ee6f){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0xb8ee6f);_0x5df7fc(_0xb8ee6f);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f19a516..930e6a1 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 _0x8ec1=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x1c7579,_0x857b0c){var _0x4773aa=function(_0x33525e){while(--_0x33525e){_0x1c7579['push'](_0x1c7579['shift']());}};_0x4773aa(++_0x857b0c);}(_0x8ec1,0x79));var _0x18ec=function(_0x4528cf,_0x3b1892){_0x4528cf=_0x4528cf-0x0;var _0x4bca53=_0x8ec1[_0x4528cf];return _0x4bca53;};'use strict';var multer=require(_0x18ec('0x0'));var util=require('util');var path=require(_0x18ec('0x1'));var timeout=require(_0x18ec('0x2'));var express=require(_0x18ec('0x3'));var router=express['Router']();var fs_extra=require(_0x18ec('0x4'));var auth=require(_0x18ec('0x5'));var interaction=require(_0x18ec('0x6'));var config=require(_0x18ec('0x7'));var controller=require('./voiceContext.controller');router[_0x18ec('0x8')]('/',auth['isAuthenticated'](),controller[_0x18ec('0x9')]);router[_0x18ec('0x8')](_0x18ec('0xa'),auth[_0x18ec('0xb')](),controller[_0x18ec('0xc')]);router[_0x18ec('0xd')]('/',auth[_0x18ec('0xb')](),controller[_0x18ec('0xe')]);router[_0x18ec('0xf')](_0x18ec('0xa'),auth['isAuthenticated'](),controller[_0x18ec('0x10')]);router[_0x18ec('0x11')](_0x18ec('0xa'),auth['isAuthenticated'](),controller[_0x18ec('0x12')]);module[_0x18ec('0x13')]=router; \ No newline at end of file +var _0xaa9c=['put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa9c,0xcb));var _0xcaa9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xaa9c[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xcaa9('0x0'));var util=require('util');var path=require(_0xcaa9('0x1'));var timeout=require(_0xcaa9('0x2'));var express=require('express');var router=express[_0xcaa9('0x3')]();var fs_extra=require(_0xcaa9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcaa9('0x5'));var config=require(_0xcaa9('0x6'));var controller=require('./voiceContext.controller');router[_0xcaa9('0x7')]('/',auth[_0xcaa9('0x8')](),controller[_0xcaa9('0x9')]);router[_0xcaa9('0x7')](_0xcaa9('0xa'),auth[_0xcaa9('0x8')](),controller[_0xcaa9('0xb')]);router['post']('/',auth[_0xcaa9('0x8')](),controller[_0xcaa9('0xc')]);router[_0xcaa9('0xd')](_0xcaa9('0xa'),auth[_0xcaa9('0x8')](),controller[_0xcaa9('0xe')]);router[_0xcaa9('0xf')](_0xcaa9('0xa'),auth['isAuthenticated'](),controller[_0xcaa9('0x10')]);module[_0xcaa9('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 21168d6..73191fa 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 _0x896e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4fb224,_0x5f382e){var _0x4b92d8=function(_0x478f54){while(--_0x478f54){_0x4fb224['push'](_0x4fb224['shift']());}};_0x4b92d8(++_0x5f382e);}(_0x896e,0x181));var _0xe896=function(_0x25a079,_0xe698ab){_0x25a079=_0x25a079-0x0;var _0x107706=_0x896e[_0x25a079];return _0x107706;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'name':{'type':Sequelize[_0xe896('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xe896('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe896('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x903b=['BOOLEAN','sequelize','name','STRING'];(function(_0x291b93,_0x44b715){var _0x4183c8=function(_0x228c59){while(--_0x228c59){_0x291b93['push'](_0x291b93['shift']());}};_0x4183c8(++_0x44b715);}(_0x903b,0x19d));var _0xb903=function(_0x1da09c,_0xe7b37d){_0x1da09c=_0x1da09c-0x0;var _0x34e180=_0x903b[_0x1da09c];return _0x34e180;};'use strict';var Sequelize=require(_0xb903('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb903('0x1')},'description':{'type':Sequelize[_0xb903('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb903('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 5c143a4..ae36ef6 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 _0x7f08=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','params','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','root'];(function(_0x37346b,_0x21b8b4){var _0x3ed354=function(_0x10194f){while(--_0x10194f){_0x37346b['push'](_0x37346b['shift']());}};_0x3ed354(++_0x21b8b4);}(_0x7f08,0x68));var _0x87f0=function(_0x3d84b2,_0x566767){_0x3d84b2=_0x3d84b2-0x0;var _0x4e6b72=_0x7f08[_0x3d84b2];return _0x4e6b72;};'use strict';var emlformat=require(_0x87f0('0x0'));var rimraf=require(_0x87f0('0x1'));var zipdir=require(_0x87f0('0x2'));var jsonpatch=require(_0x87f0('0x3'));var rp=require(_0x87f0('0x4'));var moment=require(_0x87f0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x87f0('0x6'));var sox=require(_0x87f0('0x7'));var csv=require(_0x87f0('0x8'));var ejs=require(_0x87f0('0x9'));var fs=require('fs');var fs_extra=require(_0x87f0('0xa'));var _=require(_0x87f0('0xb'));var squel=require(_0x87f0('0xc'));var crypto=require(_0x87f0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x87f0('0xe'));var toCsv=require(_0x87f0('0x8'));var querystring=require(_0x87f0('0xf'));var Papa=require(_0x87f0('0x10'));var Redis=require(_0x87f0('0x11'));var authService=require(_0x87f0('0x12'));var qs=require(_0x87f0('0x13'));var as=require(_0x87f0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87f0('0x15'))(_0x87f0('0x16'));var utils=require(_0x87f0('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x87f0('0x18'))['db'];var jayson=require(_0x87f0('0x19'));var client=jayson['client'][_0x87f0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x255335,_0x40fa5c,_0x498250,_0x49751d){return new BPromise(function(_0x436343,_0x469079){var _0x4cfbf0=_0x49751d||client;return _0x4cfbf0['request'](_0x255335,_0x498250)[_0x87f0('0x1b')](function(_0x27394c){logger[_0x87f0('0x1c')](_0x87f0('0x1d'),_0x40fa5c,_0x87f0('0x1e'));logger[_0x87f0('0x1f')](_0x87f0('0x20'),_0x40fa5c,_0x87f0('0x1e'),JSON[_0x87f0('0x21')](_0x27394c));if(_0x27394c[_0x87f0('0x22')]){if(_0x27394c[_0x87f0('0x22')][_0x87f0('0x23')]===0x1f4){logger[_0x87f0('0x22')](_0x87f0('0x1d'),_0x40fa5c,_0x27394c[_0x87f0('0x22')]['message']);return _0x469079(_0x27394c[_0x87f0('0x22')][_0x87f0('0x24')]);}logger[_0x87f0('0x22')](_0x87f0('0x1d'),_0x40fa5c,_0x27394c[_0x87f0('0x22')][_0x87f0('0x24')]);return _0x436343(_0x27394c[_0x87f0('0x22')]['message']);}else{logger[_0x87f0('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x40fa5c,_0x87f0('0x1e'));_0x436343(_0x27394c[_0x87f0('0x25')]['message']);}})[_0x87f0('0x26')](function(_0x33f0f6){logger[_0x87f0('0x22')](_0x87f0('0x1d'),_0x40fa5c,_0x33f0f6);_0x469079(_0x33f0f6);});});}function respondWithStatusCode(_0x3003e8,_0x186cad){_0x186cad=_0x186cad||0xcc;return function(_0x31ef1f){if(_0x31ef1f){return _0x3003e8[_0x87f0('0x27')](_0x186cad);}return _0x3003e8['status'](_0x186cad)[_0x87f0('0x28')]();};}function respondWithResult(_0x321c6c,_0x56c26f){_0x56c26f=_0x56c26f||0xc8;return function(_0x1da3a3){if(_0x1da3a3){return _0x321c6c[_0x87f0('0x29')](_0x56c26f)[_0x87f0('0x2a')](_0x1da3a3);}};}function respondWithFilteredResult(_0x17c1aa,_0x1ba52d){return function(_0x1bf105){if(_0x1bf105){var _0x3fb4db=typeof _0x1ba52d[_0x87f0('0x2b')]===_0x87f0('0x2c')&&typeof _0x1ba52d[_0x87f0('0x2d')]===_0x87f0('0x2c');var _0x162e67=_0x1bf105[_0x87f0('0x2e')];var _0x1b71af=_0x3fb4db?0x0:_0x1ba52d[_0x87f0('0x2b')];var _0x24dcb0=_0x3fb4db?_0x1bf105[_0x87f0('0x2e')]:_0x1ba52d[_0x87f0('0x2b')]+_0x1ba52d[_0x87f0('0x2d')];var _0x409b94;if(_0x24dcb0>=_0x162e67){_0x24dcb0=_0x162e67;_0x409b94=0xc8;}else{_0x409b94=0xce;}_0x17c1aa[_0x87f0('0x29')](_0x409b94);return _0x17c1aa[_0x87f0('0x2f')]('Content-Range',_0x1b71af+'-'+_0x24dcb0+'/'+_0x162e67)[_0x87f0('0x2a')](_0x1bf105);}return null;};}function patchUpdates(_0x25a18a){return function(_0x49408d){try{jsonpatch['apply'](_0x49408d,_0x25a18a,!![]);}catch(_0x4aebcc){return BPromise['reject'](_0x4aebcc);}return _0x49408d[_0x87f0('0x30')]();};}function saveUpdates(_0x2d8f49,_0x4c4386){return function(_0x70d774){if(_0x70d774){return _0x70d774[_0x87f0('0x31')](_0x2d8f49)[_0x87f0('0x1b')](function(_0x3dbdd3){return _0x3dbdd3;});}return null;};}function removeEntity(_0x323f84,_0x53793a){return function(_0x34da31){if(_0x34da31){return _0x34da31['destroy']()['then'](function(){var _0x5420f3=_0x34da31[_0x87f0('0x32')]({'plain':!![]});var _0xd05b58=_0x87f0('0x33');return db[_0x87f0('0x34')][_0x87f0('0x35')]({'where':{'type':_0xd05b58,'resourceId':_0x5420f3['id']}})[_0x87f0('0x1b')](function(){return _0x34da31;});})['then'](function(){_0x323f84[_0x87f0('0x29')](0xcc)[_0x87f0('0x28')]();});}};}function handleEntityNotFound(_0x356835,_0x5a833c){return function(_0xc80b96){if(!_0xc80b96){_0x356835[_0x87f0('0x27')](0x194);}return _0xc80b96;};}function handleError(_0x54b6bc,_0x54576e){_0x54576e=_0x54576e||0x1f4;return function(_0x16425d){logger[_0x87f0('0x22')](_0x16425d[_0x87f0('0x36')]);if(_0x16425d['name']){delete _0x16425d[_0x87f0('0x37')];}_0x54b6bc[_0x87f0('0x29')](_0x54576e)[_0x87f0('0x38')](_0x16425d);};}exports[_0x87f0('0x39')]=function(_0x6dadc1,_0xf99c91){var _0x252821={},_0x12077f={},_0x4de9cd={'count':0x0,'rows':[]};var _0x535a08=_[_0x87f0('0x3a')](db['VoiceContext'][_0x87f0('0x3b')],function(_0xbd2eb9){return{'name':_0xbd2eb9[_0x87f0('0x3c')],'type':_0xbd2eb9['type'][_0x87f0('0x3d')]};});_0x12077f[_0x87f0('0x3e')]=_[_0x87f0('0x3a')](_0x535a08,_0x87f0('0x37'));_0x12077f[_0x87f0('0x3f')]=_[_0x87f0('0x40')](_0x6dadc1['query']);_0x12077f['filters']=_[_0x87f0('0x41')](_0x12077f['model'],_0x12077f[_0x87f0('0x3f')]);_0x252821[_0x87f0('0x42')]=_['intersection'](_0x12077f[_0x87f0('0x3e')],qs[_0x87f0('0x43')](_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x43')]));_0x252821[_0x87f0('0x42')]=_0x252821[_0x87f0('0x42')][_0x87f0('0x44')]?_0x252821[_0x87f0('0x42')]:_0x12077f[_0x87f0('0x3e')];if(!_0x6dadc1[_0x87f0('0x3f')]['hasOwnProperty']('nolimit')){_0x252821[_0x87f0('0x2d')]=qs[_0x87f0('0x2d')](_0x6dadc1['query'][_0x87f0('0x2d')]);_0x252821[_0x87f0('0x2b')]=qs[_0x87f0('0x2b')](_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x2b')]);}_0x252821[_0x87f0('0x45')]=qs[_0x87f0('0x46')](_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x46')]);_0x252821['where']=qs[_0x87f0('0x47')](_[_0x87f0('0x48')](_0x6dadc1[_0x87f0('0x3f')],_0x12077f[_0x87f0('0x47')]),_0x535a08);if(_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x49')]){_0x252821[_0x87f0('0x4a')]=_[_0x87f0('0x4b')](_0x252821[_0x87f0('0x4a')],{'$or':_[_0x87f0('0x3a')](_0x535a08,function(_0x420a55){if(_0x420a55[_0x87f0('0x4c')]!==_0x87f0('0x4d')){var _0x2de940={};_0x2de940[_0x420a55[_0x87f0('0x37')]]={'$like':'%'+_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x49')]+'%'};return _0x2de940;}})});}_0x252821=_[_0x87f0('0x4b')]({},_0x252821,_0x6dadc1[_0x87f0('0x4e')]);var _0x8ed07c={'where':_0x252821[_0x87f0('0x4a')]};return db[_0x87f0('0x4f')][_0x87f0('0x2e')](_0x8ed07c)[_0x87f0('0x1b')](function(_0x266e5e){_0x4de9cd[_0x87f0('0x2e')]=_0x266e5e;if(_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x50')]){_0x252821[_0x87f0('0x51')]=[{'all':!![]}];}return db[_0x87f0('0x4f')][_0x87f0('0x52')](_0x252821);})['then'](function(_0x59998b){_0x4de9cd[_0x87f0('0x53')]=_0x59998b;return _0x4de9cd;})[_0x87f0('0x1b')](respondWithFilteredResult(_0xf99c91,_0x252821))['catch'](handleError(_0xf99c91,null));};exports[_0x87f0('0x54')]=function(_0x47d44b,_0x5c2b81){var _0x32e7cb={'raw':![],'where':{'id':_0x47d44b['params']['id']}},_0x50c0f4={};_0x50c0f4['model']=_['keys'](db[_0x87f0('0x4f')]['rawAttributes']);_0x50c0f4[_0x87f0('0x3f')]=_[_0x87f0('0x40')](_0x47d44b['query']);_0x50c0f4[_0x87f0('0x47')]=_['intersection'](_0x50c0f4['model'],_0x50c0f4[_0x87f0('0x3f')]);_0x32e7cb[_0x87f0('0x42')]=_[_0x87f0('0x41')](_0x50c0f4[_0x87f0('0x3e')],qs[_0x87f0('0x43')](_0x47d44b['query']['fields']));_0x32e7cb[_0x87f0('0x42')]=_0x32e7cb[_0x87f0('0x42')][_0x87f0('0x44')]?_0x32e7cb['attributes']:_0x50c0f4[_0x87f0('0x3e')];if(_0x47d44b[_0x87f0('0x3f')][_0x87f0('0x50')]){_0x32e7cb[_0x87f0('0x51')]=[{'all':!![]}];}_0x32e7cb=_[_0x87f0('0x4b')]({},_0x32e7cb,_0x47d44b['options']);return db[_0x87f0('0x4f')]['find'](_0x32e7cb)[_0x87f0('0x1b')](handleEntityNotFound(_0x5c2b81,null))[_0x87f0('0x1b')](respondWithResult(_0x5c2b81,null))[_0x87f0('0x26')](handleError(_0x5c2b81,null));};exports[_0x87f0('0x55')]=function(_0x29720d,_0x55fb79,_0xd5acc7){var _0x2a8bc3;return db[_0x87f0('0x4f')][_0x87f0('0x55')](_0x29720d[_0x87f0('0x56')],{'raw':!![]})[_0x87f0('0x1b')](function(_0x3764ff){_0x2a8bc3=_0x3764ff;return db[_0x87f0('0x4f')][_0x87f0('0x52')]({'raw':!![]});})[_0x87f0('0x1b')](function(_0xdc3e49){var _0xefeedb=fs[_0x87f0('0x57')](path[_0x87f0('0x58')](config['root'],_0x87f0('0x59')),_0x87f0('0x5a'));var _0x488b33=ejs[_0x87f0('0x5b')](_0xefeedb,{'contexts':_0xdc3e49||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x488b33);})['then'](function(){return respondWithRpcPromise(_0x87f0('0x5c'),'create',{'module':_0x87f0('0x5d')});})[_0x87f0('0x1b')](function(){var _0x2516d7=_0x29720d[_0x87f0('0x5e')][_0x87f0('0x32')]({'plain':!![]});if(!_0x2516d7)throw new Error(_0x87f0('0x5f'));if(_0x2516d7[_0x87f0('0x60')]==='user'){var _0x49bd48=_0x2a8bc3[_0x87f0('0x32')]({'plain':!![]});return db[_0x87f0('0x61')][_0x87f0('0x62')]({'where':{'name':_0x87f0('0x33'),'userProfileId':_0x2516d7['userProfileId']},'raw':!![]})['then'](function(_0x20fe62){if(_0x20fe62&&_0x20fe62[_0x87f0('0x63')]===0x0){return db[_0x87f0('0x34')][_0x87f0('0x55')]({'name':_0x49bd48[_0x87f0('0x37')],'resourceId':_0x49bd48['id'],'type':_0x20fe62[_0x87f0('0x37')],'sectionId':_0x20fe62['id']},{})[_0x87f0('0x1b')](function(){return _0x2a8bc3;});}else{return _0x2a8bc3;}})[_0x87f0('0x26')](function(_0x3cb914){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cb914);throw _0x3cb914;});}return _0x2a8bc3;})['then'](respondWithResult(_0x55fb79,0xc9))[_0x87f0('0x26')](handleError(_0x55fb79,null));};exports['update']=function(_0x3b3e1f,_0x5095b7,_0x41eb5c){var _0x1d5a24;return db[_0x87f0('0x4f')]['find']({'where':{'id':_0x3b3e1f[_0x87f0('0x64')]['id']}})[_0x87f0('0x1b')](handleEntityNotFound(_0x5095b7,null))[_0x87f0('0x1b')](saveUpdates(_0x3b3e1f['body'],null))[_0x87f0('0x1b')](function(_0x55c32c){if(_0x55c32c){_0x1d5a24=_0x55c32c;return db[_0x87f0('0x4f')]['findAll']({'raw':!![]});}})[_0x87f0('0x1b')](function(_0x15ac94){var _0x107066=fs[_0x87f0('0x57')](path[_0x87f0('0x58')](config['root'],_0x87f0('0x59')),_0x87f0('0x5a'));var _0x5eecd0=ejs[_0x87f0('0x5b')](_0x107066,{'contexts':_0x15ac94||[]});fs[_0x87f0('0x65')](_0x87f0('0x66'),_0x5eecd0);})[_0x87f0('0x1b')](function(){return respondWithRpcPromise(_0x87f0('0x5c'),_0x87f0('0x31'),{'module':_0x87f0('0x5d')});})[_0x87f0('0x1b')](function(){return _0x1d5a24;})[_0x87f0('0x1b')](respondWithResult(_0x5095b7,null))[_0x87f0('0x26')](handleError(_0x5095b7,null));};exports[_0x87f0('0x35')]=function(_0x4c8fcb,_0x114871,_0x320d8e){var _0xdc9874;return db[_0x87f0('0x4f')][_0x87f0('0x62')]({'where':{'id':_0x4c8fcb['params']['id']}})[_0x87f0('0x1b')](handleEntityNotFound(_0x114871,null))[_0x87f0('0x1b')](removeEntity(_0x114871,null))['then'](function(){return db[_0x87f0('0x4f')]['findAll']({'raw':!![]});})[_0x87f0('0x1b')](function(_0x2f93ce){var _0x520907=fs[_0x87f0('0x57')](path[_0x87f0('0x58')](config[_0x87f0('0x67')],_0x87f0('0x59')),_0x87f0('0x5a'));var _0x54347c=ejs[_0x87f0('0x5b')](_0x520907,{'contexts':_0x2f93ce});fs[_0x87f0('0x65')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x54347c);return respondWithRpcPromise(_0x87f0('0x5c'),_0x87f0('0x35'),{'module':_0x87f0('0x5d')});})[_0x87f0('0x26')](handleError(_0x114871,null));}; \ No newline at end of file +var _0x3731=['stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','join','server/files/templates/context.ejs','utf8','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','readFileSync','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','set','json','save','update','destroy','get','Contexts','UserProfileResource'];(function(_0x918033,_0x26a956){var _0x19337c=function(_0x2ee777){while(--_0x2ee777){_0x918033['push'](_0x918033['shift']());}};_0x19337c(++_0x26a956);}(_0x3731,0x158));var _0x1373=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3731[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x1373('0x0'));var rimraf=require(_0x1373('0x1'));var zipdir=require(_0x1373('0x2'));var jsonpatch=require(_0x1373('0x3'));var rp=require(_0x1373('0x4'));var moment=require(_0x1373('0x5'));var BPromise=require(_0x1373('0x6'));var Mustache=require(_0x1373('0x7'));var util=require(_0x1373('0x8'));var path=require(_0x1373('0x9'));var sox=require(_0x1373('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1373('0xb'));var squel=require('squel');var crypto=require(_0x1373('0xc'));var jsforce=require(_0x1373('0xd'));var deskjs=require(_0x1373('0xe'));var toCsv=require(_0x1373('0xf'));var querystring=require('querystring');var Papa=require(_0x1373('0x10'));var Redis=require('ioredis');var authService=require(_0x1373('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1373('0x12'));var logger=require(_0x1373('0x13'))(_0x1373('0x14'));var utils=require(_0x1373('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1373('0x16'))['db'];var jayson=require(_0x1373('0x17'));var client=jayson[_0x1373('0x18')][_0x1373('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2b5056,_0x2a60b0,_0x1d626c,_0xe802b9){return new BPromise(function(_0x44df0b,_0x152280){var _0x718bbd=_0xe802b9||client;return _0x718bbd['request'](_0x2b5056,_0x1d626c)[_0x1373('0x1a')](function(_0x30fd5e){logger[_0x1373('0x1b')](_0x1373('0x1c'),_0x2a60b0,'request\x20sent');logger[_0x1373('0x1d')](_0x1373('0x1e'),_0x2a60b0,_0x1373('0x1f'),JSON[_0x1373('0x20')](_0x30fd5e));if(_0x30fd5e[_0x1373('0x21')]){if(_0x30fd5e[_0x1373('0x21')][_0x1373('0x22')]===0x1f4){logger[_0x1373('0x21')](_0x1373('0x1c'),_0x2a60b0,_0x30fd5e['error'][_0x1373('0x23')]);return _0x152280(_0x30fd5e[_0x1373('0x21')][_0x1373('0x23')]);}logger[_0x1373('0x21')]('VoiceContext,\x20%s,\x20%s',_0x2a60b0,_0x30fd5e[_0x1373('0x21')]['message']);return _0x44df0b(_0x30fd5e[_0x1373('0x21')][_0x1373('0x23')]);}else{logger[_0x1373('0x1b')](_0x1373('0x1c'),_0x2a60b0,_0x1373('0x1f'));_0x44df0b(_0x30fd5e[_0x1373('0x24')][_0x1373('0x23')]);}})[_0x1373('0x25')](function(_0x192ffc){logger[_0x1373('0x21')](_0x1373('0x1c'),_0x2a60b0,_0x192ffc);_0x152280(_0x192ffc);});});}function respondWithStatusCode(_0x7d3d12,_0x560f4b){_0x560f4b=_0x560f4b||0xcc;return function(_0x47dce3){if(_0x47dce3){return _0x7d3d12[_0x1373('0x26')](_0x560f4b);}return _0x7d3d12[_0x1373('0x27')](_0x560f4b)[_0x1373('0x28')]();};}function respondWithResult(_0x35ee4b,_0x34a369){_0x34a369=_0x34a369||0xc8;return function(_0x2d04dd){if(_0x2d04dd){return _0x35ee4b[_0x1373('0x27')](_0x34a369)['json'](_0x2d04dd);}};}function respondWithFilteredResult(_0x350ff4,_0x557355){return function(_0x19552c){if(_0x19552c){var _0x43223c=typeof _0x557355[_0x1373('0x29')]==='undefined'&&typeof _0x557355[_0x1373('0x2a')]===_0x1373('0x2b');var _0x47ff2f=_0x19552c['count'];var _0x5deff4=_0x43223c?0x0:_0x557355[_0x1373('0x29')];var _0x3741ef=_0x43223c?_0x19552c['count']:_0x557355['offset']+_0x557355['limit'];var _0x4eb192;if(_0x3741ef>=_0x47ff2f){_0x3741ef=_0x47ff2f;_0x4eb192=0xc8;}else{_0x4eb192=0xce;}_0x350ff4[_0x1373('0x27')](_0x4eb192);return _0x350ff4[_0x1373('0x2c')]('Content-Range',_0x5deff4+'-'+_0x3741ef+'/'+_0x47ff2f)[_0x1373('0x2d')](_0x19552c);}return null;};}function patchUpdates(_0x167675){return function(_0x39c644){try{jsonpatch['apply'](_0x39c644,_0x167675,!![]);}catch(_0x3e8965){return BPromise['reject'](_0x3e8965);}return _0x39c644[_0x1373('0x2e')]();};}function saveUpdates(_0xc6a3bd,_0x4b38b1){return function(_0x1235a3){if(_0x1235a3){return _0x1235a3[_0x1373('0x2f')](_0xc6a3bd)['then'](function(_0x5ed291){return _0x5ed291;});}return null;};}function removeEntity(_0x5d3297,_0x4bb43b){return function(_0x10b8b8){if(_0x10b8b8){return _0x10b8b8[_0x1373('0x30')]()[_0x1373('0x1a')](function(){var _0x3245be=_0x10b8b8[_0x1373('0x31')]({'plain':!![]});var _0x5ab1e7=_0x1373('0x32');return db[_0x1373('0x33')][_0x1373('0x30')]({'where':{'type':_0x5ab1e7,'resourceId':_0x3245be['id']}})[_0x1373('0x1a')](function(){return _0x10b8b8;});})[_0x1373('0x1a')](function(){_0x5d3297['status'](0xcc)[_0x1373('0x28')]();});}};}function handleEntityNotFound(_0x3b202d,_0x19450e){return function(_0x1d9d60){if(!_0x1d9d60){_0x3b202d['sendStatus'](0x194);}return _0x1d9d60;};}function handleError(_0x2d5f2e,_0x893dce){_0x893dce=_0x893dce||0x1f4;return function(_0x3cf909){logger[_0x1373('0x21')](_0x3cf909[_0x1373('0x34')]);if(_0x3cf909[_0x1373('0x35')]){delete _0x3cf909[_0x1373('0x35')];}_0x2d5f2e[_0x1373('0x27')](_0x893dce)[_0x1373('0x36')](_0x3cf909);};}exports['index']=function(_0x26b8ac,_0x2d5a2c){var _0x36cff7={},_0x3486ee={},_0x56dfdc={'count':0x0,'rows':[]};var _0x1a089b=_[_0x1373('0x37')](db[_0x1373('0x38')][_0x1373('0x39')],function(_0x26b804){return{'name':_0x26b804[_0x1373('0x3a')],'type':_0x26b804[_0x1373('0x3b')]['key']};});_0x3486ee[_0x1373('0x3c')]=_[_0x1373('0x37')](_0x1a089b,'name');_0x3486ee['query']=_[_0x1373('0x3d')](_0x26b8ac[_0x1373('0x3e')]);_0x3486ee[_0x1373('0x3f')]=_[_0x1373('0x40')](_0x3486ee[_0x1373('0x3c')],_0x3486ee[_0x1373('0x3e')]);_0x36cff7['attributes']=_[_0x1373('0x40')](_0x3486ee[_0x1373('0x3c')],qs[_0x1373('0x41')](_0x26b8ac[_0x1373('0x3e')][_0x1373('0x41')]));_0x36cff7[_0x1373('0x42')]=_0x36cff7['attributes'][_0x1373('0x43')]?_0x36cff7[_0x1373('0x42')]:_0x3486ee[_0x1373('0x3c')];if(!_0x26b8ac[_0x1373('0x3e')][_0x1373('0x44')](_0x1373('0x45'))){_0x36cff7[_0x1373('0x2a')]=qs['limit'](_0x26b8ac['query'][_0x1373('0x2a')]);_0x36cff7['offset']=qs[_0x1373('0x29')](_0x26b8ac['query']['offset']);}_0x36cff7[_0x1373('0x46')]=qs[_0x1373('0x47')](_0x26b8ac[_0x1373('0x3e')][_0x1373('0x47')]);_0x36cff7['where']=qs[_0x1373('0x3f')](_['pick'](_0x26b8ac[_0x1373('0x3e')],_0x3486ee[_0x1373('0x3f')]),_0x1a089b);if(_0x26b8ac[_0x1373('0x3e')][_0x1373('0x48')]){_0x36cff7[_0x1373('0x49')]=_[_0x1373('0x4a')](_0x36cff7[_0x1373('0x49')],{'$or':_['map'](_0x1a089b,function(_0x522430){if(_0x522430[_0x1373('0x3b')]!==_0x1373('0x4b')){var _0x5c418c={};_0x5c418c[_0x522430['name']]={'$like':'%'+_0x26b8ac[_0x1373('0x3e')]['filter']+'%'};return _0x5c418c;}})});}_0x36cff7=_['merge']({},_0x36cff7,_0x26b8ac[_0x1373('0x4c')]);var _0x21da4f={'where':_0x36cff7[_0x1373('0x49')]};return db['VoiceContext'][_0x1373('0x4d')](_0x21da4f)['then'](function(_0x2421ec){_0x56dfdc['count']=_0x2421ec;if(_0x26b8ac[_0x1373('0x3e')][_0x1373('0x4e')]){_0x36cff7[_0x1373('0x4f')]=[{'all':!![]}];}return db[_0x1373('0x38')][_0x1373('0x50')](_0x36cff7);})[_0x1373('0x1a')](function(_0x33e919){_0x56dfdc[_0x1373('0x51')]=_0x33e919;return _0x56dfdc;})[_0x1373('0x1a')](respondWithFilteredResult(_0x2d5a2c,_0x36cff7))[_0x1373('0x25')](handleError(_0x2d5a2c,null));};exports[_0x1373('0x52')]=function(_0x875110,_0x5dab4e){var _0x4c4820={'raw':![],'where':{'id':_0x875110[_0x1373('0x53')]['id']}},_0x467b28={};_0x467b28['model']=_[_0x1373('0x3d')](db['VoiceContext'][_0x1373('0x39')]);_0x467b28[_0x1373('0x3e')]=_[_0x1373('0x3d')](_0x875110['query']);_0x467b28[_0x1373('0x3f')]=_[_0x1373('0x40')](_0x467b28[_0x1373('0x3c')],_0x467b28[_0x1373('0x3e')]);_0x4c4820[_0x1373('0x42')]=_[_0x1373('0x40')](_0x467b28[_0x1373('0x3c')],qs[_0x1373('0x41')](_0x875110[_0x1373('0x3e')][_0x1373('0x41')]));_0x4c4820[_0x1373('0x42')]=_0x4c4820[_0x1373('0x42')]['length']?_0x4c4820[_0x1373('0x42')]:_0x467b28[_0x1373('0x3c')];if(_0x875110[_0x1373('0x3e')][_0x1373('0x4e')]){_0x4c4820[_0x1373('0x4f')]=[{'all':!![]}];}_0x4c4820=_[_0x1373('0x4a')]({},_0x4c4820,_0x875110['options']);return db[_0x1373('0x38')][_0x1373('0x54')](_0x4c4820)[_0x1373('0x1a')](handleEntityNotFound(_0x5dab4e,null))[_0x1373('0x1a')](respondWithResult(_0x5dab4e,null))[_0x1373('0x25')](handleError(_0x5dab4e,null));};exports[_0x1373('0x55')]=function(_0x2c1449,_0x3fd5c4,_0x4650b6){var _0x9f15de;return db['VoiceContext']['create'](_0x2c1449[_0x1373('0x56')],{'raw':!![]})[_0x1373('0x1a')](function(_0x6decc6){_0x9f15de=_0x6decc6;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x1373('0x1a')](function(_0x321a1a){var _0x58f49a=fs['readFileSync'](path[_0x1373('0x57')](config['root'],_0x1373('0x58')),_0x1373('0x59'));var _0x3adfec=ejs['render'](_0x58f49a,{'contexts':_0x321a1a||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3adfec);})[_0x1373('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x1373('0x5a')});})[_0x1373('0x1a')](function(){var _0x402520=_0x2c1449['user'][_0x1373('0x31')]({'plain':!![]});if(!_0x402520)throw new Error(_0x1373('0x5b'));if(_0x402520[_0x1373('0x5c')]==='user'){var _0x3b8aff=_0x9f15de[_0x1373('0x31')]({'plain':!![]});return db['UserProfileSection'][_0x1373('0x54')]({'where':{'name':_0x1373('0x32'),'userProfileId':_0x402520['userProfileId']},'raw':!![]})['then'](function(_0x320e92){if(_0x320e92&&_0x320e92['autoAssociation']===0x0){return db[_0x1373('0x33')][_0x1373('0x55')]({'name':_0x3b8aff['name'],'resourceId':_0x3b8aff['id'],'type':_0x320e92['name'],'sectionId':_0x320e92['id']},{})[_0x1373('0x1a')](function(){return _0x9f15de;});}else{return _0x9f15de;}})[_0x1373('0x25')](function(_0x527c8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x527c8);throw _0x527c8;});}return _0x9f15de;})[_0x1373('0x1a')](respondWithResult(_0x3fd5c4,0xc9))[_0x1373('0x25')](handleError(_0x3fd5c4,null));};exports[_0x1373('0x2f')]=function(_0x4c064d,_0x407df0,_0xc4bfa6){var _0x44a0e2;return db[_0x1373('0x38')][_0x1373('0x54')]({'where':{'id':_0x4c064d[_0x1373('0x53')]['id']}})[_0x1373('0x1a')](handleEntityNotFound(_0x407df0,null))[_0x1373('0x1a')](saveUpdates(_0x4c064d[_0x1373('0x56')],null))[_0x1373('0x1a')](function(_0x1eb57b){if(_0x1eb57b){_0x44a0e2=_0x1eb57b;return db[_0x1373('0x38')][_0x1373('0x50')]({'raw':!![]});}})[_0x1373('0x1a')](function(_0x24ab80){var _0x64f631=fs[_0x1373('0x5d')](path[_0x1373('0x57')](config[_0x1373('0x5e')],_0x1373('0x58')),_0x1373('0x59'));var _0x5858c6=ejs[_0x1373('0x5f')](_0x64f631,{'contexts':_0x24ab80||[]});fs[_0x1373('0x60')](_0x1373('0x61'),_0x5858c6);})[_0x1373('0x1a')](function(){return respondWithRpcPromise(_0x1373('0x62'),_0x1373('0x2f'),{'module':_0x1373('0x5a')});})['then'](function(){return _0x44a0e2;})[_0x1373('0x1a')](respondWithResult(_0x407df0,null))[_0x1373('0x25')](handleError(_0x407df0,null));};exports[_0x1373('0x30')]=function(_0x4352d5,_0x8cb4b6,_0x1bb830){var _0x4e005b;return db[_0x1373('0x38')][_0x1373('0x54')]({'where':{'id':_0x4352d5[_0x1373('0x53')]['id']}})[_0x1373('0x1a')](handleEntityNotFound(_0x8cb4b6,null))['then'](removeEntity(_0x8cb4b6,null))[_0x1373('0x1a')](function(){return db[_0x1373('0x38')][_0x1373('0x50')]({'raw':!![]});})[_0x1373('0x1a')](function(_0x15e82b){var _0x594edf=fs[_0x1373('0x5d')](path['join'](config[_0x1373('0x5e')],_0x1373('0x58')),_0x1373('0x59'));var _0x3a29d2=ejs[_0x1373('0x5f')](_0x594edf,{'contexts':_0x15e82b});fs['writeFileSync'](_0x1373('0x61'),_0x3a29d2);return respondWithRpcPromise(_0x1373('0x62'),_0x1373('0x30'),{'module':_0x1373('0x5a')});})[_0x1373('0x25')](handleError(_0x8cb4b6,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d283f01..1e0165b 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 _0x09f1=['VoiceContext','voice_contexts','lodash','util','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0x09f1,0x138));var _0x109f=function(_0x3095b3,_0x41a0c7){_0x3095b3=_0x3095b3-0x0;var _0x262e46=_0x09f1[_0x3095b3];return _0x262e46;};'use strict';var _=require(_0x109f('0x0'));var util=require(_0x109f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x109f('0x2'));var BPromise=require(_0x109f('0x3'));var rp=require(_0x109f('0x4'));var fs=require('fs');var path=require(_0x109f('0x5'));var rimraf=require(_0x109f('0x6'));var config=require('../../config/environment');var attributes=require(_0x109f('0x7'));module['exports']=function(_0x25c358,_0x30ee50){return _0x25c358['define'](_0x109f('0x8'),attributes,{'tableName':_0x109f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc468=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xc468,0xd0));var _0x8c46=function(_0x3f1fcd,_0x267b28){_0x3f1fcd=_0x3f1fcd-0x0;var _0x43989b=_0xc468[_0x3f1fcd];return _0x43989b;};'use strict';var _=require(_0x8c46('0x0'));var util=require('util');var logger=require(_0x8c46('0x1'))(_0x8c46('0x2'));var moment=require(_0x8c46('0x3'));var BPromise=require(_0x8c46('0x4'));var rp=require(_0x8c46('0x5'));var fs=require('fs');var path=require(_0x8c46('0x6'));var rimraf=require(_0x8c46('0x7'));var config=require(_0x8c46('0x8'));var attributes=require(_0x8c46('0x9'));module['exports']=function(_0x3cd95e,_0x4b14c9){return _0x3cd95e[_0x8c46('0xa')](_0x8c46('0xb'),attributes,{'tableName':_0x8c46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 09de546..c0a3ef9 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 _0x184d=['stringify','error','message','result','catch','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x2c7ff5,_0x504abe){var _0x42fef4=function(_0x117eec){while(--_0x117eec){_0x2c7ff5['push'](_0x2c7ff5['shift']());}};_0x42fef4(++_0x504abe);}(_0x184d,0x1d0));var _0xd184=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x184d[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require('lodash');var util=require(_0xd184('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd184('0x1'))['db'];var utils=require(_0xd184('0x2'));var logger=require(_0xd184('0x3'))(_0xd184('0x4'));var config=require(_0xd184('0x5'));var jayson=require(_0xd184('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49f8e8,_0x1d8044,_0x4449a5){return new BPromise(function(_0x5b9977,_0x28a01a){return client['request'](_0x49f8e8,_0x4449a5)['then'](function(_0x197d02){logger[_0xd184('0x7')](_0xd184('0x8'),_0x1d8044,_0xd184('0x9'));logger[_0xd184('0xa')](_0xd184('0xb'),_0x1d8044,'request\x20sent',JSON[_0xd184('0xc')](_0x197d02));if(_0x197d02[_0xd184('0xd')]){if(_0x197d02[_0xd184('0xd')]['code']===0x1f4){logger[_0xd184('0xd')]('VoiceContext,\x20%s,\x20%s',_0x1d8044,_0x197d02[_0xd184('0xd')][_0xd184('0xe')]);return _0x28a01a(_0x197d02[_0xd184('0xd')][_0xd184('0xe')]);}logger[_0xd184('0xd')](_0xd184('0x8'),_0x1d8044,_0x197d02['error'][_0xd184('0xe')]);return _0x5b9977(_0x197d02[_0xd184('0xd')][_0xd184('0xe')]);}else{logger[_0xd184('0x7')](_0xd184('0x8'),_0x1d8044,_0xd184('0x9'));_0x5b9977(_0x197d02[_0xd184('0xf')][_0xd184('0xe')]);}})[_0xd184('0x10')](function(_0xf68691){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1d8044,_0xf68691);_0x28a01a(_0xf68691);});});} \ No newline at end of file +var _0x1cf6=['request','then','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x29d67f,_0x1c5643){var _0x1d8cfa=function(_0x5cf3bc){while(--_0x5cf3bc){_0x29d67f['push'](_0x29d67f['shift']());}};_0x1d8cfa(++_0x1c5643);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x41cab5,_0xe7ba9b){_0x41cab5=_0x41cab5-0x0;var _0xd45869=_0x1cf6[_0x41cab5];return _0xd45869;};'use strict';var _=require('lodash');var util=require(_0x61cf('0x0'));var moment=require(_0x61cf('0x1'));var BPromise=require(_0x61cf('0x2'));var rs=require(_0x61cf('0x3'));var fs=require('fs');var Redis=require(_0x61cf('0x4'));var db=require(_0x61cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x61cf('0x6'))(_0x61cf('0x7'));var config=require(_0x61cf('0x8'));var jayson=require(_0x61cf('0x9'));var client=jayson[_0x61cf('0xa')][_0x61cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53d574,_0x412305,_0x437945){return new BPromise(function(_0x3c0798,_0x235576){return client[_0x61cf('0xc')](_0x53d574,_0x437945)[_0x61cf('0xd')](function(_0x2ac503){logger[_0x61cf('0xe')](_0x61cf('0xf'),_0x412305,'request\x20sent');logger[_0x61cf('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x412305,_0x61cf('0x11'),JSON[_0x61cf('0x12')](_0x2ac503));if(_0x2ac503['error']){if(_0x2ac503[_0x61cf('0x13')][_0x61cf('0x14')]===0x1f4){logger[_0x61cf('0x13')](_0x61cf('0xf'),_0x412305,_0x2ac503[_0x61cf('0x13')]['message']);return _0x235576(_0x2ac503['error'][_0x61cf('0x15')]);}logger[_0x61cf('0x13')](_0x61cf('0xf'),_0x412305,_0x2ac503[_0x61cf('0x13')][_0x61cf('0x15')]);return _0x3c0798(_0x2ac503[_0x61cf('0x13')][_0x61cf('0x15')]);}else{logger['info'](_0x61cf('0xf'),_0x412305,_0x61cf('0x11'));_0x3c0798(_0x2ac503[_0x61cf('0x16')][_0x61cf('0x15')]);}})[_0x61cf('0x17')](function(_0x56150d){logger[_0x61cf('0x13')](_0x61cf('0xf'),_0x412305,_0x56150d);_0x235576(_0x56150d);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 1488172..702c813 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 _0xcf1c=['express','Router','fs-extra','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcf1c,0x18d));var _0xccf1=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0xcf1c[_0x17730a];return _0x485db1;};'use strict';var multer=require(_0xccf1('0x0'));var util=require(_0xccf1('0x1'));var path=require('path');var timeout=require(_0xccf1('0x2'));var express=require(_0xccf1('0x3'));var router=express[_0xccf1('0x4')]();var fs_extra=require(_0xccf1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xccf1('0x6'));router['get']('/',auth[_0xccf1('0x7')](),controller[_0xccf1('0x8')]);router[_0xccf1('0x9')](_0xccf1('0xa'),auth[_0xccf1('0x7')](),controller[_0xccf1('0xb')]);router[_0xccf1('0x9')](_0xccf1('0xc'),auth[_0xccf1('0x7')](),controller[_0xccf1('0xd')]);router[_0xccf1('0xe')]('/',auth[_0xccf1('0x7')](),controller[_0xccf1('0xf')]);router[_0xccf1('0x10')](_0xccf1('0xc'),auth[_0xccf1('0x7')](),controller[_0xccf1('0x11')]);router['delete']('/:id',auth[_0xccf1('0x7')](),controller[_0xccf1('0x12')]);module[_0xccf1('0x13')]=router; \ No newline at end of file +var _0x366a=['/:id','show','post','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x4f18da,_0x34dd74){var _0x36d46b=function(_0x54a58b){while(--_0x54a58b){_0x4f18da['push'](_0x4f18da['shift']());}};_0x36d46b(++_0x34dd74);}(_0x366a,0x85));var _0xa366=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0x366a[_0x30cd7e];return _0x462a02;};'use strict';var multer=require(_0xa366('0x0'));var util=require(_0xa366('0x1'));var path=require(_0xa366('0x2'));var timeout=require('connect-timeout');var express=require(_0xa366('0x3'));var router=express[_0xa366('0x4')]();var fs_extra=require(_0xa366('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa366('0x6'));var config=require(_0xa366('0x7'));var controller=require(_0xa366('0x8'));router['get']('/',auth[_0xa366('0x9')](),controller[_0xa366('0xa')]);router[_0xa366('0xb')](_0xa366('0xc'),auth[_0xa366('0x9')](),controller[_0xa366('0xd')]);router['get'](_0xa366('0xe'),auth[_0xa366('0x9')](),controller[_0xa366('0xf')]);router[_0xa366('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa366('0x11')](_0xa366('0xe'),auth[_0xa366('0x9')](),controller[_0xa366('0x12')]);router[_0xa366('0x13')](_0xa366('0xe'),auth['isAuthenticated'](),controller[_0xa366('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 43892ed..0425fdc 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 _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x46efe8,_0x162b4f){var _0x29f07e=function(_0xb45054){while(--_0xb45054){_0x46efe8['push'](_0x46efe8['shift']());}};_0x29f07e(++_0x162b4f);}(_0x81bd,0x7c));var _0xd81b=function(_0x166953,_0x214d3a){_0x166953=_0x166953-0x0;var _0x4a8baf=_0x81bd[_0x166953];return _0x4a8baf;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x560439,_0x5a4204){var _0x1727f=function(_0x455c32){while(--_0x455c32){_0x560439['push'](_0x560439['shift']());}};_0x1727f(++_0x5a4204);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0xf3cd[_0x333798];return _0x389f4e;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2b034cd..bdf8cb9 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 _0x4bf6=['json','offset','undefined','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2910da,_0xf00c37){var _0x5453c5=function(_0x2713a7){while(--_0x2713a7){_0x2910da['push'](_0x2910da['shift']());}};_0x5453c5(++_0xf00c37);}(_0x4bf6,0x1a8));var _0x64bf=function(_0xe90f41,_0x1c97a5){_0xe90f41=_0xe90f41-0x0;var _0x26cf7f=_0x4bf6[_0xe90f41];return _0x26cf7f;};'use strict';var emlformat=require(_0x64bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x64bf('0x1'));var jsonpatch=require(_0x64bf('0x2'));var rp=require(_0x64bf('0x3'));var moment=require('moment');var BPromise=require(_0x64bf('0x4'));var Mustache=require(_0x64bf('0x5'));var util=require('util');var path=require(_0x64bf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64bf('0x7'));var _=require(_0x64bf('0x8'));var squel=require(_0x64bf('0x9'));var crypto=require(_0x64bf('0xa'));var jsforce=require(_0x64bf('0xb'));var deskjs=require(_0x64bf('0xc'));var toCsv=require('to-csv');var querystring=require(_0x64bf('0xd'));var Papa=require('papaparse');var Redis=require(_0x64bf('0xe'));var authService=require(_0x64bf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x64bf('0x10'));var hardwareService=require(_0x64bf('0x11'));var logger=require('../../config/logger')(_0x64bf('0x12'));var utils=require(_0x64bf('0x13'));var config=require(_0x64bf('0x14'));var licenseUtil=require(_0x64bf('0x15'));var db=require(_0x64bf('0x16'))['db'];function respondWithStatusCode(_0x484847,_0x4ee4cc){_0x4ee4cc=_0x4ee4cc||0xcc;return function(_0x5ed1d7){if(_0x5ed1d7){return _0x484847[_0x64bf('0x17')](_0x4ee4cc);}return _0x484847[_0x64bf('0x18')](_0x4ee4cc)[_0x64bf('0x19')]();};}function respondWithResult(_0x521699,_0x119077){_0x119077=_0x119077||0xc8;return function(_0x2388f6){if(_0x2388f6){return _0x521699[_0x64bf('0x18')](_0x119077)[_0x64bf('0x1a')](_0x2388f6);}};}function respondWithFilteredResult(_0x4812a1,_0xbef71b){return function(_0x4a0920){if(_0x4a0920){var _0x163697=typeof _0xbef71b[_0x64bf('0x1b')]===_0x64bf('0x1c')&&typeof _0xbef71b['limit']==='undefined';var _0x575399=_0x4a0920['count'];var _0x2a9c31=_0x163697?0x0:_0xbef71b['offset'];var _0x109367=_0x163697?_0x4a0920['count']:_0xbef71b[_0x64bf('0x1b')]+_0xbef71b['limit'];var _0x3699c5;if(_0x109367>=_0x575399){_0x109367=_0x575399;_0x3699c5=0xc8;}else{_0x3699c5=0xce;}_0x4812a1[_0x64bf('0x18')](_0x3699c5);return _0x4812a1['set'](_0x64bf('0x1d'),_0x2a9c31+'-'+_0x109367+'/'+_0x575399)[_0x64bf('0x1a')](_0x4a0920);}return null;};}function patchUpdates(_0x5f5610){return function(_0x369fea){try{jsonpatch[_0x64bf('0x1e')](_0x369fea,_0x5f5610,!![]);}catch(_0x25590f){return BPromise[_0x64bf('0x1f')](_0x25590f);}return _0x369fea[_0x64bf('0x20')]();};}function saveUpdates(_0x503d54,_0x38d5fb){return function(_0x36327a){if(_0x36327a){return _0x36327a[_0x64bf('0x21')](_0x503d54)[_0x64bf('0x22')](function(_0x104498){return _0x104498;});}return null;};}function removeEntity(_0x5c46a3,_0x3b3bc9){return function(_0x1de2d2){if(_0x1de2d2){return _0x1de2d2[_0x64bf('0x23')]()[_0x64bf('0x22')](function(){_0x5c46a3[_0x64bf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15dd0d,_0x4fc75d){return function(_0x5bf225){if(!_0x5bf225){_0x15dd0d[_0x64bf('0x17')](0x194);}return _0x5bf225;};}function handleError(_0x70719d,_0x5a753f){_0x5a753f=_0x5a753f||0x1f4;return function(_0x4aa69f){logger[_0x64bf('0x24')](_0x4aa69f[_0x64bf('0x25')]);if(_0x4aa69f[_0x64bf('0x26')]){delete _0x4aa69f[_0x64bf('0x26')];}_0x70719d[_0x64bf('0x18')](_0x5a753f)[_0x64bf('0x27')](_0x4aa69f);};}exports[_0x64bf('0x28')]=function(_0x7fc87b,_0x34121c){var _0x282da3={},_0x230e6d={},_0x251fb1={'count':0x0,'rows':[]};var _0x36e102=_[_0x64bf('0x29')](db[_0x64bf('0x2a')][_0x64bf('0x2b')],function(_0x546327){return{'name':_0x546327['fieldName'],'type':_0x546327[_0x64bf('0x2c')][_0x64bf('0x2d')]};});_0x230e6d[_0x64bf('0x2e')]=_['map'](_0x36e102,_0x64bf('0x26'));_0x230e6d[_0x64bf('0x2f')]=_[_0x64bf('0x30')](_0x7fc87b[_0x64bf('0x2f')]);_0x230e6d[_0x64bf('0x31')]=_['intersection'](_0x230e6d[_0x64bf('0x2e')],_0x230e6d[_0x64bf('0x2f')]);_0x282da3[_0x64bf('0x32')]=_[_0x64bf('0x33')](_0x230e6d[_0x64bf('0x2e')],qs[_0x64bf('0x34')](_0x7fc87b[_0x64bf('0x2f')]['fields']));_0x282da3[_0x64bf('0x32')]=_0x282da3['attributes'][_0x64bf('0x35')]?_0x282da3[_0x64bf('0x32')]:_0x230e6d[_0x64bf('0x2e')];if(!_0x7fc87b[_0x64bf('0x2f')]['hasOwnProperty'](_0x64bf('0x36'))){_0x282da3['limit']=qs[_0x64bf('0x37')](_0x7fc87b[_0x64bf('0x2f')][_0x64bf('0x37')]);_0x282da3[_0x64bf('0x1b')]=qs[_0x64bf('0x1b')](_0x7fc87b[_0x64bf('0x2f')][_0x64bf('0x1b')]);}_0x282da3[_0x64bf('0x38')]=qs[_0x64bf('0x39')](_0x7fc87b['query'][_0x64bf('0x39')]);_0x282da3['where']=qs[_0x64bf('0x31')](_['pick'](_0x7fc87b[_0x64bf('0x2f')],_0x230e6d[_0x64bf('0x31')]),_0x36e102);if(_0x7fc87b[_0x64bf('0x2f')]['filter']){_0x282da3[_0x64bf('0x3a')]=_[_0x64bf('0x3b')](_0x282da3[_0x64bf('0x3a')],{'$or':_[_0x64bf('0x29')](_0x36e102,function(_0x53df0d){if(_0x53df0d[_0x64bf('0x2c')]!==_0x64bf('0x3c')){var _0x10ac09={};_0x10ac09[_0x53df0d['name']]={'$like':'%'+_0x7fc87b[_0x64bf('0x2f')][_0x64bf('0x3d')]+'%'};return _0x10ac09;}})});}_0x282da3=_[_0x64bf('0x3b')]({},_0x282da3,_0x7fc87b[_0x64bf('0x3e')]);var _0x268f79={'where':_0x282da3[_0x64bf('0x3a')]};return db[_0x64bf('0x2a')][_0x64bf('0x3f')](_0x268f79)[_0x64bf('0x22')](function(_0x24f422){_0x251fb1[_0x64bf('0x3f')]=_0x24f422;if(_0x7fc87b['query'][_0x64bf('0x40')]){_0x282da3[_0x64bf('0x41')]=[{'all':!![]}];}return db[_0x64bf('0x2a')][_0x64bf('0x42')](_0x282da3);})['then'](function(_0x4e522e){_0x251fb1[_0x64bf('0x43')]=_0x4e522e;return _0x251fb1;})[_0x64bf('0x22')](respondWithFilteredResult(_0x34121c,_0x282da3))[_0x64bf('0x44')](handleError(_0x34121c,null));};exports[_0x64bf('0x45')]=function(_0xffff49,_0x202b21){var _0x3ea9d3={'raw':!![],'where':{'id':_0xffff49[_0x64bf('0x46')]['id']}},_0x414608={};_0x414608[_0x64bf('0x2e')]=_['keys'](db[_0x64bf('0x2a')][_0x64bf('0x2b')]);_0x414608[_0x64bf('0x2f')]=_['keys'](_0xffff49['query']);_0x414608['filters']=_[_0x64bf('0x33')](_0x414608[_0x64bf('0x2e')],_0x414608[_0x64bf('0x2f')]);_0x3ea9d3['attributes']=_[_0x64bf('0x33')](_0x414608['model'],qs[_0x64bf('0x34')](_0xffff49[_0x64bf('0x2f')][_0x64bf('0x34')]));_0x3ea9d3[_0x64bf('0x32')]=_0x3ea9d3['attributes'][_0x64bf('0x35')]?_0x3ea9d3['attributes']:_0x414608[_0x64bf('0x2e')];if(_0xffff49[_0x64bf('0x2f')]['includeAll']){_0x3ea9d3[_0x64bf('0x41')]=[{'all':!![]}];}_0x3ea9d3=_['merge']({},_0x3ea9d3,_0xffff49[_0x64bf('0x3e')]);return db['VoiceDialReport'][_0x64bf('0x47')](_0x3ea9d3)[_0x64bf('0x22')](handleEntityNotFound(_0x202b21,null))['then'](respondWithResult(_0x202b21,null))[_0x64bf('0x44')](handleError(_0x202b21,null));};exports[_0x64bf('0x48')]=function(_0x20c63d,_0x2d648e){return db[_0x64bf('0x2a')][_0x64bf('0x48')](_0x20c63d[_0x64bf('0x49')],{})[_0x64bf('0x22')](respondWithResult(_0x2d648e,0xc9))[_0x64bf('0x44')](handleError(_0x2d648e,null));};exports[_0x64bf('0x21')]=function(_0x4fc463,_0x3864c5){if(_0x4fc463[_0x64bf('0x49')]['id']){delete _0x4fc463[_0x64bf('0x49')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x4fc463[_0x64bf('0x46')]['id']}})[_0x64bf('0x22')](handleEntityNotFound(_0x3864c5,null))['then'](saveUpdates(_0x4fc463[_0x64bf('0x49')],null))[_0x64bf('0x22')](respondWithResult(_0x3864c5,null))['catch'](handleError(_0x3864c5,null));};exports['destroy']=function(_0x370642,_0x3e8147){return db[_0x64bf('0x2a')]['find']({'where':{'id':_0x370642['params']['id']}})[_0x64bf('0x22')](handleEntityNotFound(_0x3e8147,null))['then'](removeEntity(_0x3e8147,null))[_0x64bf('0x44')](handleError(_0x3e8147,null));};exports[_0x64bf('0x4a')]=function(_0x26cf60,_0x5b59b7){return db[_0x64bf('0x2a')][_0x64bf('0x4a')]()[_0x64bf('0x22')](respondWithResult(_0x5b59b7,null))[_0x64bf('0x44')](handleError(_0x5b59b7,null));}; \ No newline at end of file +var _0xe039=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','rawAttributes','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x457b67,_0x24c9d3){var _0x2882e1=function(_0xbb168e){while(--_0xbb168e){_0x457b67['push'](_0x457b67['shift']());}};_0x2882e1(++_0x24c9d3);}(_0xe039,0x1de));var _0x9e03=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xe039[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require(_0x9e03('0x0'));var rimraf=require(_0x9e03('0x1'));var zipdir=require(_0x9e03('0x2'));var jsonpatch=require(_0x9e03('0x3'));var rp=require(_0x9e03('0x4'));var moment=require(_0x9e03('0x5'));var BPromise=require(_0x9e03('0x6'));var Mustache=require(_0x9e03('0x7'));var util=require(_0x9e03('0x8'));var path=require(_0x9e03('0x9'));var sox=require(_0x9e03('0xa'));var csv=require(_0x9e03('0xb'));var ejs=require(_0x9e03('0xc'));var fs=require('fs');var fs_extra=require(_0x9e03('0xd'));var _=require(_0x9e03('0xe'));var squel=require(_0x9e03('0xf'));var crypto=require(_0x9e03('0x10'));var jsforce=require(_0x9e03('0x11'));var deskjs=require(_0x9e03('0x12'));var toCsv=require(_0x9e03('0xb'));var querystring=require(_0x9e03('0x13'));var Papa=require(_0x9e03('0x14'));var Redis=require(_0x9e03('0x15'));var authService=require(_0x9e03('0x16'));var qs=require(_0x9e03('0x17'));var as=require(_0x9e03('0x18'));var hardwareService=require(_0x9e03('0x19'));var logger=require('../../config/logger')(_0x9e03('0x1a'));var utils=require(_0x9e03('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x9e03('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f987d,_0x5e4727){_0x5e4727=_0x5e4727||0xcc;return function(_0x413e0d){if(_0x413e0d){return _0x4f987d[_0x9e03('0x1d')](_0x5e4727);}return _0x4f987d[_0x9e03('0x1e')](_0x5e4727)[_0x9e03('0x1f')]();};}function respondWithResult(_0x1d66a4,_0x4426c2){_0x4426c2=_0x4426c2||0xc8;return function(_0x500025){if(_0x500025){return _0x1d66a4[_0x9e03('0x1e')](_0x4426c2)[_0x9e03('0x20')](_0x500025);}};}function respondWithFilteredResult(_0x42e136,_0x1eaff6){return function(_0x41e173){if(_0x41e173){var _0x204801=typeof _0x1eaff6[_0x9e03('0x21')]===_0x9e03('0x22')&&typeof _0x1eaff6[_0x9e03('0x23')]==='undefined';var _0x3b1895=_0x41e173['count'];var _0x139a7f=_0x204801?0x0:_0x1eaff6[_0x9e03('0x21')];var _0x489ecc=_0x204801?_0x41e173[_0x9e03('0x24')]:_0x1eaff6['offset']+_0x1eaff6[_0x9e03('0x23')];var _0x25bdb3;if(_0x489ecc>=_0x3b1895){_0x489ecc=_0x3b1895;_0x25bdb3=0xc8;}else{_0x25bdb3=0xce;}_0x42e136[_0x9e03('0x1e')](_0x25bdb3);return _0x42e136[_0x9e03('0x25')]('Content-Range',_0x139a7f+'-'+_0x489ecc+'/'+_0x3b1895)[_0x9e03('0x20')](_0x41e173);}return null;};}function patchUpdates(_0x1ea6ef){return function(_0x3d56a2){try{jsonpatch[_0x9e03('0x26')](_0x3d56a2,_0x1ea6ef,!![]);}catch(_0x116ac7){return BPromise[_0x9e03('0x27')](_0x116ac7);}return _0x3d56a2[_0x9e03('0x28')]();};}function saveUpdates(_0x2b5f7d,_0x49edc8){return function(_0x452062){if(_0x452062){return _0x452062[_0x9e03('0x29')](_0x2b5f7d)[_0x9e03('0x2a')](function(_0x1a151a){return _0x1a151a;});}return null;};}function removeEntity(_0x59ebf0,_0x47692a){return function(_0x42aadc){if(_0x42aadc){return _0x42aadc[_0x9e03('0x2b')]()['then'](function(){_0x59ebf0['status'](0xcc)[_0x9e03('0x1f')]();});}};}function handleEntityNotFound(_0x3bd1a8,_0x5d9af8){return function(_0xba9313){if(!_0xba9313){_0x3bd1a8[_0x9e03('0x1d')](0x194);}return _0xba9313;};}function handleError(_0x37b657,_0x26f3bc){_0x26f3bc=_0x26f3bc||0x1f4;return function(_0x3ced2d){logger[_0x9e03('0x2c')](_0x3ced2d['stack']);if(_0x3ced2d['name']){delete _0x3ced2d[_0x9e03('0x2d')];}_0x37b657[_0x9e03('0x1e')](_0x26f3bc)[_0x9e03('0x2e')](_0x3ced2d);};}exports[_0x9e03('0x2f')]=function(_0x15daf2,_0x1ca917){var _0x305388={},_0x3d3b4c={},_0x10cad8={'count':0x0,'rows':[]};var _0x582785=_[_0x9e03('0x30')](db['VoiceDialReport']['rawAttributes'],function(_0x452cab){return{'name':_0x452cab['fieldName'],'type':_0x452cab['type'][_0x9e03('0x31')]};});_0x3d3b4c[_0x9e03('0x32')]=_[_0x9e03('0x30')](_0x582785,_0x9e03('0x2d'));_0x3d3b4c[_0x9e03('0x33')]=_[_0x9e03('0x34')](_0x15daf2['query']);_0x3d3b4c[_0x9e03('0x35')]=_[_0x9e03('0x36')](_0x3d3b4c[_0x9e03('0x32')],_0x3d3b4c[_0x9e03('0x33')]);_0x305388[_0x9e03('0x37')]=_['intersection'](_0x3d3b4c[_0x9e03('0x32')],qs[_0x9e03('0x38')](_0x15daf2[_0x9e03('0x33')][_0x9e03('0x38')]));_0x305388[_0x9e03('0x37')]=_0x305388[_0x9e03('0x37')][_0x9e03('0x39')]?_0x305388[_0x9e03('0x37')]:_0x3d3b4c[_0x9e03('0x32')];if(!_0x15daf2[_0x9e03('0x33')][_0x9e03('0x3a')](_0x9e03('0x3b'))){_0x305388['limit']=qs[_0x9e03('0x23')](_0x15daf2[_0x9e03('0x33')][_0x9e03('0x23')]);_0x305388[_0x9e03('0x21')]=qs[_0x9e03('0x21')](_0x15daf2['query'][_0x9e03('0x21')]);}_0x305388[_0x9e03('0x3c')]=qs[_0x9e03('0x3d')](_0x15daf2[_0x9e03('0x33')][_0x9e03('0x3d')]);_0x305388[_0x9e03('0x3e')]=qs['filters'](_[_0x9e03('0x3f')](_0x15daf2[_0x9e03('0x33')],_0x3d3b4c[_0x9e03('0x35')]),_0x582785);if(_0x15daf2[_0x9e03('0x33')][_0x9e03('0x40')]){_0x305388['where']=_[_0x9e03('0x41')](_0x305388[_0x9e03('0x3e')],{'$or':_['map'](_0x582785,function(_0x367390){if(_0x367390[_0x9e03('0x42')]!==_0x9e03('0x43')){var _0x15b025={};_0x15b025[_0x367390[_0x9e03('0x2d')]]={'$like':'%'+_0x15daf2[_0x9e03('0x33')][_0x9e03('0x40')]+'%'};return _0x15b025;}})});}_0x305388=_[_0x9e03('0x41')]({},_0x305388,_0x15daf2[_0x9e03('0x44')]);var _0x2a677c={'where':_0x305388[_0x9e03('0x3e')]};return db[_0x9e03('0x45')]['count'](_0x2a677c)[_0x9e03('0x2a')](function(_0xfa4e9a){_0x10cad8[_0x9e03('0x24')]=_0xfa4e9a;if(_0x15daf2[_0x9e03('0x33')][_0x9e03('0x46')]){_0x305388[_0x9e03('0x47')]=[{'all':!![]}];}return db[_0x9e03('0x45')][_0x9e03('0x48')](_0x305388);})[_0x9e03('0x2a')](function(_0x43ea7a){_0x10cad8[_0x9e03('0x49')]=_0x43ea7a;return _0x10cad8;})[_0x9e03('0x2a')](respondWithFilteredResult(_0x1ca917,_0x305388))[_0x9e03('0x4a')](handleError(_0x1ca917,null));};exports[_0x9e03('0x4b')]=function(_0x1c5b98,_0x5e735a){var _0xb41394={'raw':!![],'where':{'id':_0x1c5b98['params']['id']}},_0x3ad7ce={};_0x3ad7ce['model']=_[_0x9e03('0x34')](db[_0x9e03('0x45')][_0x9e03('0x4c')]);_0x3ad7ce[_0x9e03('0x33')]=_['keys'](_0x1c5b98['query']);_0x3ad7ce['filters']=_[_0x9e03('0x36')](_0x3ad7ce['model'],_0x3ad7ce[_0x9e03('0x33')]);_0xb41394['attributes']=_[_0x9e03('0x36')](_0x3ad7ce[_0x9e03('0x32')],qs[_0x9e03('0x38')](_0x1c5b98[_0x9e03('0x33')][_0x9e03('0x38')]));_0xb41394[_0x9e03('0x37')]=_0xb41394[_0x9e03('0x37')][_0x9e03('0x39')]?_0xb41394[_0x9e03('0x37')]:_0x3ad7ce[_0x9e03('0x32')];if(_0x1c5b98[_0x9e03('0x33')][_0x9e03('0x46')]){_0xb41394[_0x9e03('0x47')]=[{'all':!![]}];}_0xb41394=_[_0x9e03('0x41')]({},_0xb41394,_0x1c5b98[_0x9e03('0x44')]);return db['VoiceDialReport'][_0x9e03('0x4d')](_0xb41394)[_0x9e03('0x2a')](handleEntityNotFound(_0x5e735a,null))[_0x9e03('0x2a')](respondWithResult(_0x5e735a,null))[_0x9e03('0x4a')](handleError(_0x5e735a,null));};exports['create']=function(_0x38b2eb,_0xa1274b){return db[_0x9e03('0x45')]['create'](_0x38b2eb[_0x9e03('0x4e')],{})[_0x9e03('0x2a')](respondWithResult(_0xa1274b,0xc9))[_0x9e03('0x4a')](handleError(_0xa1274b,null));};exports['update']=function(_0x318860,_0x1bcc4e){if(_0x318860['body']['id']){delete _0x318860[_0x9e03('0x4e')]['id'];}return db['VoiceDialReport'][_0x9e03('0x4d')]({'where':{'id':_0x318860[_0x9e03('0x4f')]['id']}})[_0x9e03('0x2a')](handleEntityNotFound(_0x1bcc4e,null))[_0x9e03('0x2a')](saveUpdates(_0x318860['body'],null))[_0x9e03('0x2a')](respondWithResult(_0x1bcc4e,null))[_0x9e03('0x4a')](handleError(_0x1bcc4e,null));};exports[_0x9e03('0x2b')]=function(_0x344fc9,_0x4601a5){return db[_0x9e03('0x45')][_0x9e03('0x4d')]({'where':{'id':_0x344fc9[_0x9e03('0x4f')]['id']}})[_0x9e03('0x2a')](handleEntityNotFound(_0x4601a5,null))['then'](removeEntity(_0x4601a5,null))[_0x9e03('0x4a')](handleError(_0x4601a5,null));};exports[_0x9e03('0x50')]=function(_0x3691eb,_0x43eb11){return db[_0x9e03('0x45')][_0x9e03('0x50')]()[_0x9e03('0x2a')](respondWithResult(_0x43eb11,null))[_0x9e03('0x4a')](handleError(_0x43eb11,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index da315a8..7f92a4e 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 _0x2b99=['VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./voiceDialReport.attributes','define'];(function(_0x5145fd,_0x8f267b){var _0x276aab=function(_0x35077d){while(--_0x35077d){_0x5145fd['push'](_0x5145fd['shift']());}};_0x276aab(++_0x8f267b);}(_0x2b99,0x1b3));var _0x92b9=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x2b99[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x92b9('0x0'));var util=require(_0x92b9('0x1'));var logger=require(_0x92b9('0x2'))('api');var moment=require(_0x92b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x92b9('0x4'));var fs=require('fs');var path=require(_0x92b9('0x5'));var rimraf=require('rimraf');var config=require(_0x92b9('0x6'));var attributes=require(_0x92b9('0x7'));module['exports']=function(_0xe4a56e,_0x1cce13){return _0xe4a56e[_0x92b9('0x8')](_0x92b9('0x9'),attributes,{'tableName':_0x92b9('0xa'),'paranoid':![],'indexes':[{'fields':[_0x92b9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc09=['uniqueid','lodash','util','../../config/logger','api','path','../../config/environment','define','report_dial'];(function(_0x895358,_0x32f914){var _0x26e26e=function(_0xf2da4a){while(--_0xf2da4a){_0x895358['push'](_0x895358['shift']());}};_0x26e26e(++_0x32f914);}(_0xcc09,0x196));var _0x9cc0=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcc09[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x9cc0('0x0'));var util=require(_0x9cc0('0x1'));var logger=require(_0x9cc0('0x2'))(_0x9cc0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cc0('0x4'));var rimraf=require('rimraf');var config=require(_0x9cc0('0x5'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x5b9016,_0x35edef){return _0x5b9016[_0x9cc0('0x6')]('VoiceDialReport',attributes,{'tableName':_0x9cc0('0x7'),'paranoid':![],'indexes':[{'fields':[_0x9cc0('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index c95e5c8..a98acca 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 _0x0046=['body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','VoiceDialReport','create'];(function(_0x1d8fa1,_0x18d00f){var _0x528467=function(_0x259e18){while(--_0x259e18){_0x1d8fa1['push'](_0x1d8fa1['shift']());}};_0x528467(++_0x18d00f);}(_0x0046,0x91));var _0x6004=function(_0x22c83b,_0x1d01b7){_0x22c83b=_0x22c83b-0x0;var _0x2fe73d=_0x0046[_0x22c83b];return _0x2fe73d;};'use strict';var _=require(_0x6004('0x0'));var util=require(_0x6004('0x1'));var moment=require(_0x6004('0x2'));var BPromise=require(_0x6004('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6004('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6004('0x5'));var logger=require('../../config/logger')(_0x6004('0x6'));var config=require(_0x6004('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6004('0x8')][_0x6004('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e8b13,_0x495ed7,_0x1f18e6){return new BPromise(function(_0x38865f,_0x577527){return client[_0x6004('0xa')](_0x3e8b13,_0x1f18e6)[_0x6004('0xb')](function(_0x59736b){logger[_0x6004('0xc')](_0x6004('0xd'),_0x495ed7,'request\x20sent');logger[_0x6004('0xe')](_0x6004('0xf'),_0x495ed7,'request\x20sent',JSON[_0x6004('0x10')](_0x59736b));if(_0x59736b[_0x6004('0x11')]){if(_0x59736b[_0x6004('0x11')][_0x6004('0x12')]===0x1f4){logger[_0x6004('0x11')](_0x6004('0xd'),_0x495ed7,_0x59736b[_0x6004('0x11')][_0x6004('0x13')]);return _0x577527(_0x59736b[_0x6004('0x11')]['message']);}logger[_0x6004('0x11')](_0x6004('0xd'),_0x495ed7,_0x59736b[_0x6004('0x11')][_0x6004('0x13')]);return _0x38865f(_0x59736b['error'][_0x6004('0x13')]);}else{logger[_0x6004('0xc')](_0x6004('0xd'),_0x495ed7,_0x6004('0x14'));_0x38865f(_0x59736b[_0x6004('0x15')][_0x6004('0x13')]);}})[_0x6004('0x16')](function(_0x1f6dff){logger[_0x6004('0x11')](_0x6004('0xd'),_0x495ed7,_0x1f6dff);_0x577527(_0x1f6dff);});});}exports['CreateVoiceDialReport']=function(_0x36e383){var _0x5d4770=this;return new Promise(function(_0x30d83b,_0x1a9b29){return db[_0x6004('0x17')][_0x6004('0x18')](_0x36e383[_0x6004('0x19')],{'raw':_0x36e383['options']?_0x36e383[_0x6004('0x1a')][_0x6004('0x1b')]===undefined?!![]:![]:!![]})[_0x6004('0xb')](function(_0x2405ea){logger[_0x6004('0xc')](_0x6004('0x1c'),_0x36e383);logger['debug'](_0x6004('0x1c'),_0x36e383,JSON[_0x6004('0x10')](_0x2405ea));_0x30d83b(_0x2405ea);})[_0x6004('0x16')](function(_0x1d0e5c){logger[_0x6004('0x11')](_0x6004('0x1c'),_0x1d0e5c['message'],_0x36e383);_0x1a9b29(_0x5d4770[_0x6004('0x11')](0x1f4,_0x1d0e5c[_0x6004('0x13')]));});});};exports[_0x6004('0x1d')]=function(_0x398d87){var _0x2a9243=this;return new Promise(function(_0x5515c6,_0x19fe1b){return db[_0x6004('0x17')][_0x6004('0x1e')](_0x398d87[_0x6004('0x19')],{'raw':_0x398d87[_0x6004('0x1a')]?_0x398d87[_0x6004('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x398d87[_0x6004('0x1a')]?_0x398d87['options'][_0x6004('0x1f')]||null:null,'attributes':_0x398d87['options']?_0x398d87[_0x6004('0x1a')][_0x6004('0x20')]||null:null,'limit':_0x398d87[_0x6004('0x1a')]?_0x398d87['options'][_0x6004('0x21')]||null:null})[_0x6004('0xb')](function(_0x47af73){logger[_0x6004('0xc')](_0x6004('0x1d'),_0x398d87);logger[_0x6004('0xe')]('UpdateVoiceDialReport',_0x398d87,JSON[_0x6004('0x10')](_0x47af73));_0x5515c6(_0x47af73);})[_0x6004('0x16')](function(_0x19b648){logger[_0x6004('0x11')](_0x6004('0x1d'),_0x19b648[_0x6004('0x13')],_0x398d87);_0x19fe1b(_0x2a9243[_0x6004('0x11')](0x1f4,_0x19b648[_0x6004('0x13')]));});});}; \ No newline at end of file +var _0x7f73=['http','request','then','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','request\x20sent','catch','CreateVoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client'];(function(_0x571c00,_0x3ae028){var _0x2887df=function(_0x5ebe70){while(--_0x5ebe70){_0x571c00['push'](_0x571c00['shift']());}};_0x2887df(++_0x3ae028);}(_0x7f73,0x10e));var _0x37f7=function(_0x352730,_0x48c10c){_0x352730=_0x352730-0x0;var _0x4428f8=_0x7f73[_0x352730];return _0x4428f8;};'use strict';var _=require(_0x37f7('0x0'));var util=require(_0x37f7('0x1'));var moment=require('moment');var BPromise=require(_0x37f7('0x2'));var rs=require(_0x37f7('0x3'));var fs=require('fs');var Redis=require(_0x37f7('0x4'));var db=require(_0x37f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x37f7('0x6'))('rpc');var config=require(_0x37f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x37f7('0x8')][_0x37f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb58e52,_0x113641,_0x2bd563){return new BPromise(function(_0x35900d,_0x350348){return client[_0x37f7('0xa')](_0xb58e52,_0x2bd563)[_0x37f7('0xb')](function(_0x38592f){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x113641,'request\x20sent');logger[_0x37f7('0xc')](_0x37f7('0xd'),_0x113641,'request\x20sent',JSON[_0x37f7('0xe')](_0x38592f));if(_0x38592f[_0x37f7('0xf')]){if(_0x38592f[_0x37f7('0xf')][_0x37f7('0x10')]===0x1f4){logger['error'](_0x37f7('0x11'),_0x113641,_0x38592f['error'][_0x37f7('0x12')]);return _0x350348(_0x38592f['error'][_0x37f7('0x12')]);}logger[_0x37f7('0xf')](_0x37f7('0x11'),_0x113641,_0x38592f[_0x37f7('0xf')][_0x37f7('0x12')]);return _0x35900d(_0x38592f[_0x37f7('0xf')][_0x37f7('0x12')]);}else{logger[_0x37f7('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x113641,_0x37f7('0x14'));_0x35900d(_0x38592f['result'][_0x37f7('0x12')]);}})[_0x37f7('0x15')](function(_0x42b39e){logger[_0x37f7('0xf')](_0x37f7('0x11'),_0x113641,_0x42b39e);_0x350348(_0x42b39e);});});}exports[_0x37f7('0x16')]=function(_0x2af452){var _0x2886ad=this;return new Promise(function(_0x4a3cc8,_0x245399){return db['VoiceDialReport'][_0x37f7('0x17')](_0x2af452[_0x37f7('0x18')],{'raw':_0x2af452['options']?_0x2af452[_0x37f7('0x19')][_0x37f7('0x1a')]===undefined?!![]:![]:!![]})[_0x37f7('0xb')](function(_0x4b95ba){logger[_0x37f7('0x13')](_0x37f7('0x16'),_0x2af452);logger[_0x37f7('0xc')]('CreateVoiceDialReport',_0x2af452,JSON[_0x37f7('0xe')](_0x4b95ba));_0x4a3cc8(_0x4b95ba);})['catch'](function(_0x138198){logger[_0x37f7('0xf')](_0x37f7('0x16'),_0x138198[_0x37f7('0x12')],_0x2af452);_0x245399(_0x2886ad[_0x37f7('0xf')](0x1f4,_0x138198['message']));});});};exports[_0x37f7('0x1b')]=function(_0x50fb02){var _0x44754c=this;return new Promise(function(_0x2296d2,_0x5b32f7){return db['VoiceDialReport'][_0x37f7('0x1c')](_0x50fb02[_0x37f7('0x18')],{'raw':_0x50fb02[_0x37f7('0x19')]?_0x50fb02['options'][_0x37f7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50fb02['options']?_0x50fb02[_0x37f7('0x19')][_0x37f7('0x1d')]||null:null,'attributes':_0x50fb02[_0x37f7('0x19')]?_0x50fb02[_0x37f7('0x19')][_0x37f7('0x1e')]||null:null,'limit':_0x50fb02['options']?_0x50fb02[_0x37f7('0x19')]['limit']||null:null})[_0x37f7('0xb')](function(_0x2b1d92){logger[_0x37f7('0x13')]('UpdateVoiceDialReport',_0x50fb02);logger[_0x37f7('0xc')](_0x37f7('0x1b'),_0x50fb02,JSON['stringify'](_0x2b1d92));_0x2296d2(_0x2b1d92);})[_0x37f7('0x15')](function(_0x1f4d9e){logger[_0x37f7('0xf')](_0x37f7('0x1b'),_0x1f4d9e[_0x37f7('0x12')],_0x50fb02);_0x5b32f7(_0x44754c[_0x37f7('0xf')](0x1f4,_0x1f4d9e[_0x37f7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7cb5db6..2ecb459 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 _0x08dd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','create','/:id/applications','addApplications','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3037d2,_0x70eac9){var _0x2b770c=function(_0x59972d){while(--_0x59972d){_0x3037d2['push'](_0x3037d2['shift']());}};_0x2b770c(++_0x70eac9);}(_0x08dd,0x1b1));var _0xd08d=function(_0x442b4e,_0x5e4c18){_0x442b4e=_0x442b4e-0x0;var _0x3e1ae4=_0x08dd[_0x442b4e];return _0x3e1ae4;};'use strict';var multer=require(_0xd08d('0x0'));var util=require(_0xd08d('0x1'));var path=require('path');var timeout=require(_0xd08d('0x2'));var express=require(_0xd08d('0x3'));var router=express[_0xd08d('0x4')]();var fs_extra=require(_0xd08d('0x5'));var auth=require(_0xd08d('0x6'));var interaction=require(_0xd08d('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xd08d('0x8')]('/',auth[_0xd08d('0x9')](),controller[_0xd08d('0xa')]);router[_0xd08d('0x8')](_0xd08d('0xb'),auth[_0xd08d('0x9')](),controller['show']);router['post']('/',auth[_0xd08d('0x9')](),controller[_0xd08d('0xc')]);router['post'](_0xd08d('0xd'),auth[_0xd08d('0x9')](),controller[_0xd08d('0xe')]);router[_0xd08d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd08d('0x10')]);router['delete']('/:id',auth[_0xd08d('0x9')](),controller[_0xd08d('0x11')]);module[_0xd08d('0x12')]=router; \ No newline at end of file +var _0xfaaf=['create','post','/:id/applications','addApplications','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show'];(function(_0x237587,_0x3922b7){var _0x485bd9=function(_0x26d5c3){while(--_0x26d5c3){_0x237587['push'](_0x237587['shift']());}};_0x485bd9(++_0x3922b7);}(_0xfaaf,0x148));var _0xffaa=function(_0x35f275,_0x5b78ab){_0x35f275=_0x35f275-0x0;var _0x5a4e2b=_0xfaaf[_0x35f275];return _0x5a4e2b;};'use strict';var multer=require('multer');var util=require(_0xffaa('0x0'));var path=require(_0xffaa('0x1'));var timeout=require(_0xffaa('0x2'));var express=require(_0xffaa('0x3'));var router=express[_0xffaa('0x4')]();var fs_extra=require(_0xffaa('0x5'));var auth=require(_0xffaa('0x6'));var interaction=require(_0xffaa('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xffaa('0x8')]('/',auth[_0xffaa('0x9')](),controller['index']);router['get'](_0xffaa('0xa'),auth[_0xffaa('0x9')](),controller[_0xffaa('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xffaa('0xc')]);router[_0xffaa('0xd')](_0xffaa('0xe'),auth[_0xffaa('0x9')](),controller[_0xffaa('0xf')]);router[_0xffaa('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xffaa('0x11')]('/:id',auth[_0xffaa('0x9')](),controller[_0xffaa('0x12')]);module[_0xffaa('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 384a372..3aaa20d 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 _0xb7e7=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x4dd26d,_0xedc830){var _0x593d9e=function(_0x41d9db){while(--_0x41d9db){_0x4dd26d['push'](_0x4dd26d['shift']());}};_0x593d9e(++_0xedc830);}(_0xb7e7,0x121));var _0x7b7e=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xb7e7[_0x24259d];return _0x5a701;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'inbound-fax',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'interval':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x9')},'IntervalId':{'type':Sequelize[_0x7b7e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7b7e('0xa')]},'recordingFormat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc')},'answer':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7b7e('0xd')],'get':function(){return this[_0x7b7e('0xe')]('exten');}}}; \ No newline at end of file +var _0xd8b0=['VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_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')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d8b('0x2')},'priority':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x0d8b('0x2')},'tag':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0d8b('0x4')](_0x0d8b('0x5'),_0x0d8b('0x6'),'internal',_0x0d8b('0x7'),_0x0d8b('0x8'),'system',_0x0d8b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0d8b('0x3')]},'interval':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':_0x0d8b('0xa')},'IntervalId':{'type':Sequelize[_0x0d8b('0xb')]},'isApp':{'type':Sequelize[_0x0d8b('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0d8b('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0xd')},'answer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a36eafd..5f4ae10 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 _0x0d98=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','VoiceExtension','includeAll','include','findAll','rows','catch','show','options','params','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OutboundRoutes','find','UserProfileSection','userProfileId','autoAssociation','context','description','recordingFormat','cutdigits','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','../../config/logger','api','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','map','value','includes','type','name','UserProfileResource','error','stack','send','index','rawAttributes','key','query','keys','filters','intersection'];(function(_0xdbf581,_0x5847d5){var _0x79e2ee=function(_0x57c5ba){while(--_0x57c5ba){_0xdbf581['push'](_0xdbf581['shift']());}};_0x79e2ee(++_0x5847d5);}(_0x0d98,0x8c));var _0x80d9=function(_0x45bb40,_0xcf43b4){_0x45bb40=_0x45bb40-0x0;var _0xdaa2e7=_0x0d98[_0x45bb40];return _0xdaa2e7;};'use strict';var _=require(_0x80d9('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x80d9('0x1'))(_0x80d9('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x80d9('0x3')]=_[_0x80d9('0x4')](config[_0x80d9('0x3')],{'host':_0x80d9('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x80d9('0x3')]));require('./voiceExtension.socket')[_0x80d9('0x6')](socket);function respondWithStatusCode(_0x23da24,_0x7e76f5){_0x7e76f5=_0x7e76f5||0xcc;return function(_0x4abc85){if(_0x4abc85){return _0x23da24[_0x80d9('0x7')](_0x7e76f5);}return _0x23da24[_0x80d9('0x8')](_0x7e76f5)[_0x80d9('0x9')]();};}function respondWithResult(_0x426a07,_0x514a41){_0x514a41=_0x514a41||0xc8;return function(_0x3fa0fb){if(_0x3fa0fb){return _0x426a07[_0x80d9('0x8')](_0x514a41)[_0x80d9('0xa')](_0x3fa0fb);}};}function respondWithFilteredResult(_0x48ae88,_0x57abc7){return function(_0x4274c9){if(_0x4274c9){var _0x5a47d4=typeof _0x57abc7[_0x80d9('0xb')]===_0x80d9('0xc')&&typeof _0x57abc7[_0x80d9('0xd')]===_0x80d9('0xc');var _0x43b218=_0x4274c9['count'];var _0x2245b3=_0x5a47d4?0x0:_0x57abc7['offset'];var _0x560d81=_0x5a47d4?_0x4274c9[_0x80d9('0xe')]:_0x57abc7[_0x80d9('0xb')]+_0x57abc7[_0x80d9('0xd')];var _0x43e4f7;if(_0x560d81>=_0x43b218){_0x560d81=_0x43b218;_0x43e4f7=0xc8;}else{_0x43e4f7=0xce;}_0x48ae88[_0x80d9('0x8')](_0x43e4f7);return _0x48ae88['set']('Content-Range',_0x2245b3+'-'+_0x560d81+'/'+_0x43b218)[_0x80d9('0xa')](_0x4274c9);}return null;};}function removeEntity(_0x17e3d8){return function(_0x590bb1){if(_0x590bb1){return _0x590bb1[_0x80d9('0xf')]()[_0x80d9('0x10')](function(){var _0x56fa41=_0x590bb1[_0x80d9('0x11')]({'plain':!![]});var _0x22329a=[{'name':_0x80d9('0x12'),'value':_0x80d9('0x13'),'ignore':![]},{'name':'OutboundRoutes','value':_0x80d9('0x14'),'ignore':![]},{'name':_0x80d9('0x15'),'value':_0x80d9('0x16'),'ignore':![]}];var _0x57aed5=_(_0x22329a)[_0x80d9('0x17')]('ignore')[_0x80d9('0x18')](_0x80d9('0x19'))[_0x80d9('0x19')]();if(_[_0x80d9('0x1a')](_0x57aed5,_0x56fa41[_0x80d9('0x1b')])){return;}var _0x4376c7=_['find'](_0x22329a,['value',_0x56fa41[_0x80d9('0x1b')]])[_0x80d9('0x1c')];return db[_0x80d9('0x1d')][_0x80d9('0xf')]({'where':{'type':_0x4376c7,'resourceId':_0x56fa41['id']}})[_0x80d9('0x10')](function(){return _0x590bb1;});})[_0x80d9('0x10')](function(){_0x17e3d8[_0x80d9('0x8')](0xcc)[_0x80d9('0x9')]();});}};}function handleEntityNotFound(_0x5904d5){return function(_0x8ef55e){if(!_0x8ef55e){_0x5904d5[_0x80d9('0x7')](0x194);}return _0x8ef55e;};}function handleError(_0x2083f3,_0x573970){_0x573970=_0x573970||0x1f4;return function(_0x29f810){logger[_0x80d9('0x1e')](_0x29f810[_0x80d9('0x1f')]);if(_0x29f810['name']){delete _0x29f810[_0x80d9('0x1c')];}_0x2083f3[_0x80d9('0x8')](_0x573970)[_0x80d9('0x20')](_0x29f810);};}exports[_0x80d9('0x21')]=function(_0x6c8b60,_0x183ab9){var _0x2b7b6e={},_0x2b091a={},_0x3c6df2={'count':0x0,'rows':[]};var _0x49dce4=_['map'](db['VoiceExtension'][_0x80d9('0x22')],function(_0x25c3a6){return{'name':_0x25c3a6['fieldName'],'type':_0x25c3a6[_0x80d9('0x1b')][_0x80d9('0x23')]};});_0x2b091a['model']=_['map'](_0x49dce4,_0x80d9('0x1c'));_0x2b091a[_0x80d9('0x24')]=_[_0x80d9('0x25')](_0x6c8b60[_0x80d9('0x24')]);_0x2b091a[_0x80d9('0x26')]=_[_0x80d9('0x27')](_0x2b091a[_0x80d9('0x28')],_0x2b091a[_0x80d9('0x24')]);_0x2b7b6e[_0x80d9('0x29')]=_[_0x80d9('0x27')](_0x2b091a[_0x80d9('0x28')],qs[_0x80d9('0x2a')](_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x2a')]));_0x2b7b6e[_0x80d9('0x29')]=_0x2b7b6e['attributes'][_0x80d9('0x2b')]?_0x2b7b6e['attributes']:_0x2b091a['model'];if(!_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x2c')](_0x80d9('0x2d'))){_0x2b7b6e[_0x80d9('0xd')]=qs[_0x80d9('0xd')](_0x6c8b60['query'][_0x80d9('0xd')]);_0x2b7b6e[_0x80d9('0xb')]=qs[_0x80d9('0xb')](_0x6c8b60['query'][_0x80d9('0xb')]);}_0x2b7b6e[_0x80d9('0x2e')]=qs[_0x80d9('0x2f')](_0x6c8b60[_0x80d9('0x24')]['sort']);_0x2b7b6e['where']=qs[_0x80d9('0x26')](_[_0x80d9('0x30')](_0x6c8b60[_0x80d9('0x24')],_0x2b091a[_0x80d9('0x26')]),_0x49dce4);if(_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x17')]){_0x2b7b6e[_0x80d9('0x31')]=_[_0x80d9('0x32')](_0x2b7b6e[_0x80d9('0x31')],{'$or':_[_0x80d9('0x18')](_0x49dce4,function(_0x5192d9){if(_0x5192d9[_0x80d9('0x1b')]!==_0x80d9('0x33')){var _0x472977={};_0x472977[_0x5192d9[_0x80d9('0x1c')]]={'$like':'%'+_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x17')]+'%'};return _0x472977;}})});}_0x2b7b6e=_[_0x80d9('0x32')]({},_0x2b7b6e,_0x6c8b60['options']);var _0x2621f={'where':_0x2b7b6e[_0x80d9('0x31')]};return db[_0x80d9('0x34')][_0x80d9('0xe')](_0x2621f)[_0x80d9('0x10')](function(_0x1ab522){_0x3c6df2['count']=_0x1ab522;if(_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x35')]){_0x2b7b6e[_0x80d9('0x36')]=[{'all':!![]}];}return db[_0x80d9('0x34')][_0x80d9('0x37')](_0x2b7b6e);})[_0x80d9('0x10')](function(_0x5bca4a){_0x3c6df2[_0x80d9('0x38')]=_0x5bca4a;return _0x3c6df2;})[_0x80d9('0x10')](respondWithFilteredResult(_0x183ab9,_0x2b7b6e))[_0x80d9('0x39')](handleError(_0x183ab9,null));};exports[_0x80d9('0x3a')]=function(_0x25e755,_0xe6e57f){var _0x274169={'raw':![],'where':{'id':_0x25e755['params']['id']}},_0x3dca39={};_0x3dca39[_0x80d9('0x28')]=_[_0x80d9('0x25')](db[_0x80d9('0x34')][_0x80d9('0x22')]);_0x3dca39['query']=_['keys'](_0x25e755[_0x80d9('0x24')]);_0x3dca39[_0x80d9('0x26')]=_['intersection'](_0x3dca39[_0x80d9('0x28')],_0x3dca39[_0x80d9('0x24')]);_0x274169[_0x80d9('0x29')]=_[_0x80d9('0x27')](_0x3dca39[_0x80d9('0x28')],qs[_0x80d9('0x2a')](_0x25e755['query'][_0x80d9('0x2a')]));_0x274169[_0x80d9('0x29')]=_0x274169[_0x80d9('0x29')]['length']?_0x274169['attributes']:_0x3dca39['model'];if(_0x25e755[_0x80d9('0x24')]['includeAll']){_0x274169[_0x80d9('0x36')]=[{'all':!![]}];}_0x274169=_[_0x80d9('0x32')]({},_0x274169,_0x25e755[_0x80d9('0x3b')]);return db[_0x80d9('0x34')]['find'](_0x274169)[_0x80d9('0x10')](handleEntityNotFound(_0xe6e57f,null))[_0x80d9('0x10')](respondWithResult(_0xe6e57f,null))[_0x80d9('0x39')](handleError(_0xe6e57f,null));};exports[_0x80d9('0xf')]=function(_0x2b8604,_0x38f73a){return db[_0x80d9('0x34')]['find']({'where':{'id':_0x2b8604[_0x80d9('0x3c')]['id']}})[_0x80d9('0x10')](handleEntityNotFound(_0x38f73a,null))[_0x80d9('0x10')](removeEntity(_0x38f73a,null))[_0x80d9('0x39')](handleError(_0x38f73a,null));};exports[_0x80d9('0x3d')]=function(_0x473e2b,_0x5c371c){if(_0x473e2b[_0x80d9('0x3e')][_0x80d9('0x1b')]==='outbound'&&!_[_0x80d9('0x3f')](_0x473e2b[_0x80d9('0x3e')]['exten'],'_')){_0x473e2b['body'][_0x80d9('0x40')]='_'[_0x80d9('0x41')](_0x473e2b[_0x80d9('0x3e')]['exten']);}return db[_0x80d9('0x34')][_0x80d9('0x3d')](_0x473e2b['body'],{'raw':![]})['then'](function(_0x170d41){var _0x2b676e=_0x473e2b['user'][_0x80d9('0x11')]({'plain':!![]});if(!_0x2b676e)throw new Error(_0x80d9('0x42'));if(_0x2b676e[_0x80d9('0x43')]===_0x80d9('0x44')){var _0x4f020d=_0x170d41[_0x80d9('0x11')]({'plain':!![]});var _0x389f21=[{'name':'InboundRoutes','value':_0x80d9('0x13')},{'name':_0x80d9('0x45'),'value':_0x80d9('0x14')},{'name':_0x80d9('0x15'),'value':_0x80d9('0x16')}];var _0x2e53b8=_[_0x80d9('0x46')](_0x389f21,[_0x80d9('0x19'),_0x4f020d['type']])[_0x80d9('0x1c')];return db[_0x80d9('0x47')]['find']({'where':{'name':_0x2e53b8,'userProfileId':_0x2b676e[_0x80d9('0x48')]},'raw':!![]})[_0x80d9('0x10')](function(_0x506b2c){if(_0x506b2c&&_0x506b2c[_0x80d9('0x49')]===0x0){return db[_0x80d9('0x1d')]['create']({'name':_0x4f020d[_0x80d9('0x1c')],'resourceId':_0x4f020d['id'],'type':_0x506b2c[_0x80d9('0x1c')],'sectionId':_0x506b2c['id']},{})[_0x80d9('0x10')](function(){return _0x170d41;});}else{return _0x170d41;}})[_0x80d9('0x39')](function(_0x22381c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22381c);throw _0x22381c;});}return _0x170d41;})[_0x80d9('0x10')](respondWithResult(_0x5c371c,0xc9))[_0x80d9('0x39')](handleError(_0x5c371c,null));};exports['update']=function(_0x1572e9,_0x3e5870){if(_0x1572e9[_0x80d9('0x3e')]['id']){delete _0x1572e9[_0x80d9('0x3e')]['id'];}return db['VoiceExtension'][_0x80d9('0x46')]({'where':{'id':_0x1572e9[_0x80d9('0x3c')]['id']}})[_0x80d9('0x10')](handleEntityNotFound(_0x3e5870,null))[_0x80d9('0x10')](function(_0xdcb5a8){if(_0xdcb5a8){return db[_0x80d9('0x34')]['update'](_[_0x80d9('0x30')](_0x1572e9[_0x80d9('0x3e')],['exten',_0x80d9('0x4a'),_0x80d9('0x4b'),_0x80d9('0x4c'),_0x80d9('0x4d'),'mandatoryDisposition','alias']),{'where':{'context':_0xdcb5a8[_0x80d9('0x4a')],'exten':_0xdcb5a8[_0x80d9('0x40')]},'individualHooks':!![]})[_0x80d9('0x10')](function(_0x210d8f){return _0x210d8f;});}return null;})[_0x80d9('0x10')](respondWithStatusCode(_0x3e5870,null))[_0x80d9('0x39')](handleError(_0x3e5870,null));};exports[_0x80d9('0x4e')]=function(_0xda252,_0x457179){var _0x81269d=_0xda252['params']['id'];var _0x4a40a7=_0xda252['body'];var _0x2ba641=0xc8;var _0x5bd256=null;return db[_0x80d9('0x4f')][_0x80d9('0x50')]({'isolationLevel':db[_0x80d9('0x4f')][_0x80d9('0x51')][_0x80d9('0x52')]['READ_COMMITTED']},function(_0x2bf8a4){return db['VoiceExtension'][_0x80d9('0x53')]({'where':{'id':_0x81269d},'transaction':_0x2bf8a4})['then'](function(_0x4f48fc){if(_0x4f48fc){return db[_0x80d9('0x34')][_0x80d9('0xf')]({'where':{'VoiceExtensionId':_0x81269d},'transaction':_0x2bf8a4})[_0x80d9('0x10')](function(){var _0x398114=_[_0x80d9('0x18')](_0x4a40a7,function(_0x142744){_0x142744[_0x80d9('0x54')]=_0x81269d;_0x142744[_0x80d9('0x55')]=!![];return _0x142744;});return _0x4f48fc[_0x80d9('0x56')](_0x398114);})[_0x80d9('0x10')](function(_0x4e06c1){return db[_0x80d9('0x34')][_0x80d9('0x57')](_0x4e06c1,{'transaction':_0x2bf8a4});});}else{_0x2ba641=0x194;_0x5bd256=[];}});})[_0x80d9('0x10')](function(){if(_0x2ba641!==0x194){return db[_0x80d9('0x34')][_0x80d9('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x81269d},'order':_0x80d9('0x59')})[_0x80d9('0x10')](function(_0x3a7163){_0x5bd256=_0x3a7163;});}})[_0x80d9('0x39')](function(_0x37be6c){_0x2ba641=0x1f4;logger[_0x80d9('0x1e')](_0x37be6c['stack']);if(_0x37be6c[_0x80d9('0x1c')]){delete _0x37be6c[_0x80d9('0x1c')];}_0x5bd256=_0x37be6c;})['finally'](function(){if(_0x5bd256===null){_0x457179[_0x80d9('0x7')](_0x2ba641);}else{if(_0x2ba641===0x1f4){_0x457179['status'](_0x2ba641)[_0x80d9('0x20')](_0x5bd256);}else{_0x457179[_0x80d9('0x8')](_0x2ba641)[_0x80d9('0xa')](_0x5bd256);}}});}; \ No newline at end of file +var _0x713f=['includes','find','type','name','UserProfileResource','end','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','length','nolimit','order','sort','where','pick','merge','options','VoiceExtension','findAll','rows','show','params','fields','includeAll','include','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','cast(priority\x20as\x20unsigned)','stack','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','value'];(function(_0xd07790,_0x3db009){var _0x32f10e=function(_0x1f4911){while(--_0x1f4911){_0xd07790['push'](_0xd07790['shift']());}};_0x32f10e(++_0x3db009);}(_0x713f,0x152));var _0xf713=function(_0x5007fd,_0xe9fe81){_0x5007fd=_0x5007fd-0x0;var _0xfd4950=_0x713f[_0x5007fd];return _0xfd4950;};'use strict';var _=require(_0xf713('0x0'));var Redis=require('ioredis');var qs=require(_0xf713('0x1'));var logger=require(_0xf713('0x2'))(_0xf713('0x3'));var config=require('../../config/environment');var db=require(_0xf713('0x4'))['db'];config[_0xf713('0x5')]=_[_0xf713('0x6')](config[_0xf713('0x5')],{'host':_0xf713('0x7'),'port':0x18eb});var socket=require(_0xf713('0x8'))(new Redis(config[_0xf713('0x5')]));require(_0xf713('0x9'))[_0xf713('0xa')](socket);function respondWithStatusCode(_0x429032,_0x1174bd){_0x1174bd=_0x1174bd||0xcc;return function(_0x17c63b){if(_0x17c63b){return _0x429032[_0xf713('0xb')](_0x1174bd);}return _0x429032[_0xf713('0xc')](_0x1174bd)['end']();};}function respondWithResult(_0x1737b5,_0x3f9d3d){_0x3f9d3d=_0x3f9d3d||0xc8;return function(_0x5a0929){if(_0x5a0929){return _0x1737b5[_0xf713('0xc')](_0x3f9d3d)[_0xf713('0xd')](_0x5a0929);}};}function respondWithFilteredResult(_0x47a436,_0x24a2aa){return function(_0x2ad2d9){if(_0x2ad2d9){var _0x45ef7e=typeof _0x24a2aa[_0xf713('0xe')]===_0xf713('0xf')&&typeof _0x24a2aa[_0xf713('0x10')]===_0xf713('0xf');var _0x5b9523=_0x2ad2d9[_0xf713('0x11')];var _0x2709df=_0x45ef7e?0x0:_0x24a2aa[_0xf713('0xe')];var _0x275c5f=_0x45ef7e?_0x2ad2d9[_0xf713('0x11')]:_0x24a2aa[_0xf713('0xe')]+_0x24a2aa[_0xf713('0x10')];var _0x508b99;if(_0x275c5f>=_0x5b9523){_0x275c5f=_0x5b9523;_0x508b99=0xc8;}else{_0x508b99=0xce;}_0x47a436[_0xf713('0xc')](_0x508b99);return _0x47a436[_0xf713('0x12')](_0xf713('0x13'),_0x2709df+'-'+_0x275c5f+'/'+_0x5b9523)[_0xf713('0xd')](_0x2ad2d9);}return null;};}function removeEntity(_0x4c08da){return function(_0x3c11b1){if(_0x3c11b1){return _0x3c11b1[_0xf713('0x14')]()[_0xf713('0x15')](function(){var _0x137aa7=_0x3c11b1[_0xf713('0x16')]({'plain':!![]});var _0x17b4b9=[{'name':_0xf713('0x17'),'value':'inbound','ignore':![]},{'name':_0xf713('0x18'),'value':_0xf713('0x19'),'ignore':![]},{'name':_0xf713('0x1a'),'value':_0xf713('0x1b'),'ignore':![]}];var _0x48f346=_(_0x17b4b9)[_0xf713('0x1c')]('ignore')['map'](_0xf713('0x1d'))['value']();if(_[_0xf713('0x1e')](_0x48f346,_0x137aa7['type'])){return;}var _0x67c59c=_[_0xf713('0x1f')](_0x17b4b9,['value',_0x137aa7[_0xf713('0x20')]])[_0xf713('0x21')];return db[_0xf713('0x22')]['destroy']({'where':{'type':_0x67c59c,'resourceId':_0x137aa7['id']}})[_0xf713('0x15')](function(){return _0x3c11b1;});})[_0xf713('0x15')](function(){_0x4c08da[_0xf713('0xc')](0xcc)[_0xf713('0x23')]();});}};}function handleEntityNotFound(_0x454185){return function(_0x57d0a1){if(!_0x57d0a1){_0x454185[_0xf713('0xb')](0x194);}return _0x57d0a1;};}function handleError(_0x131fc9,_0x4a1e11){_0x4a1e11=_0x4a1e11||0x1f4;return function(_0x1038fe){logger['error'](_0x1038fe['stack']);if(_0x1038fe[_0xf713('0x21')]){delete _0x1038fe['name'];}_0x131fc9[_0xf713('0xc')](_0x4a1e11)[_0xf713('0x24')](_0x1038fe);};}exports[_0xf713('0x25')]=function(_0x5b28f4,_0x2137f6){var _0x107904={},_0x4c4b21={},_0x318652={'count':0x0,'rows':[]};var _0x7f066c=_[_0xf713('0x26')](db['VoiceExtension'][_0xf713('0x27')],function(_0x56ed20){return{'name':_0x56ed20[_0xf713('0x28')],'type':_0x56ed20[_0xf713('0x20')][_0xf713('0x29')]};});_0x4c4b21['model']=_[_0xf713('0x26')](_0x7f066c,_0xf713('0x21'));_0x4c4b21[_0xf713('0x2a')]=_[_0xf713('0x2b')](_0x5b28f4['query']);_0x4c4b21[_0xf713('0x2c')]=_[_0xf713('0x2d')](_0x4c4b21['model'],_0x4c4b21[_0xf713('0x2a')]);_0x107904[_0xf713('0x2e')]=_[_0xf713('0x2d')](_0x4c4b21[_0xf713('0x2f')],qs['fields'](_0x5b28f4['query']['fields']));_0x107904[_0xf713('0x2e')]=_0x107904['attributes'][_0xf713('0x30')]?_0x107904[_0xf713('0x2e')]:_0x4c4b21['model'];if(!_0x5b28f4[_0xf713('0x2a')]['hasOwnProperty'](_0xf713('0x31'))){_0x107904[_0xf713('0x10')]=qs[_0xf713('0x10')](_0x5b28f4[_0xf713('0x2a')][_0xf713('0x10')]);_0x107904[_0xf713('0xe')]=qs[_0xf713('0xe')](_0x5b28f4['query'][_0xf713('0xe')]);}_0x107904[_0xf713('0x32')]=qs['sort'](_0x5b28f4[_0xf713('0x2a')][_0xf713('0x33')]);_0x107904[_0xf713('0x34')]=qs['filters'](_[_0xf713('0x35')](_0x5b28f4[_0xf713('0x2a')],_0x4c4b21[_0xf713('0x2c')]),_0x7f066c);if(_0x5b28f4[_0xf713('0x2a')]['filter']){_0x107904[_0xf713('0x34')]=_[_0xf713('0x36')](_0x107904[_0xf713('0x34')],{'$or':_[_0xf713('0x26')](_0x7f066c,function(_0x16b2e0){if(_0x16b2e0['type']!=='VIRTUAL'){var _0x1fdaf4={};_0x1fdaf4[_0x16b2e0[_0xf713('0x21')]]={'$like':'%'+_0x5b28f4[_0xf713('0x2a')][_0xf713('0x1c')]+'%'};return _0x1fdaf4;}})});}_0x107904=_['merge']({},_0x107904,_0x5b28f4[_0xf713('0x37')]);var _0xe5731d={'where':_0x107904[_0xf713('0x34')]};return db[_0xf713('0x38')][_0xf713('0x11')](_0xe5731d)[_0xf713('0x15')](function(_0x1a4eff){_0x318652[_0xf713('0x11')]=_0x1a4eff;if(_0x5b28f4[_0xf713('0x2a')]['includeAll']){_0x107904['include']=[{'all':!![]}];}return db[_0xf713('0x38')][_0xf713('0x39')](_0x107904);})[_0xf713('0x15')](function(_0x1b2cd1){_0x318652[_0xf713('0x3a')]=_0x1b2cd1;return _0x318652;})['then'](respondWithFilteredResult(_0x2137f6,_0x107904))['catch'](handleError(_0x2137f6,null));};exports[_0xf713('0x3b')]=function(_0x3135d2,_0x8575fa){var _0x27d4c8={'raw':![],'where':{'id':_0x3135d2[_0xf713('0x3c')]['id']}},_0x48918b={};_0x48918b['model']=_[_0xf713('0x2b')](db['VoiceExtension'][_0xf713('0x27')]);_0x48918b[_0xf713('0x2a')]=_[_0xf713('0x2b')](_0x3135d2[_0xf713('0x2a')]);_0x48918b['filters']=_[_0xf713('0x2d')](_0x48918b[_0xf713('0x2f')],_0x48918b[_0xf713('0x2a')]);_0x27d4c8[_0xf713('0x2e')]=_[_0xf713('0x2d')](_0x48918b[_0xf713('0x2f')],qs[_0xf713('0x3d')](_0x3135d2['query'][_0xf713('0x3d')]));_0x27d4c8['attributes']=_0x27d4c8[_0xf713('0x2e')][_0xf713('0x30')]?_0x27d4c8[_0xf713('0x2e')]:_0x48918b[_0xf713('0x2f')];if(_0x3135d2[_0xf713('0x2a')][_0xf713('0x3e')]){_0x27d4c8[_0xf713('0x3f')]=[{'all':!![]}];}_0x27d4c8=_[_0xf713('0x36')]({},_0x27d4c8,_0x3135d2[_0xf713('0x37')]);return db[_0xf713('0x38')][_0xf713('0x1f')](_0x27d4c8)[_0xf713('0x15')](handleEntityNotFound(_0x8575fa,null))[_0xf713('0x15')](respondWithResult(_0x8575fa,null))['catch'](handleError(_0x8575fa,null));};exports[_0xf713('0x14')]=function(_0x5d0036,_0xa8a68c){return db[_0xf713('0x38')][_0xf713('0x1f')]({'where':{'id':_0x5d0036['params']['id']}})['then'](handleEntityNotFound(_0xa8a68c,null))[_0xf713('0x15')](removeEntity(_0xa8a68c,null))['catch'](handleError(_0xa8a68c,null));};exports[_0xf713('0x40')]=function(_0x4971f1,_0x23f00b){if(_0x4971f1[_0xf713('0x41')]['type']===_0xf713('0x19')&&!_['startsWith'](_0x4971f1['body']['exten'],'_')){_0x4971f1['body'][_0xf713('0x42')]='_'[_0xf713('0x43')](_0x4971f1['body'][_0xf713('0x42')]);}return db[_0xf713('0x38')][_0xf713('0x40')](_0x4971f1[_0xf713('0x41')],{'raw':![]})[_0xf713('0x15')](function(_0x2bed66){var _0x5482b7=_0x4971f1[_0xf713('0x44')]['get']({'plain':!![]});if(!_0x5482b7)throw new Error(_0xf713('0x45'));if(_0x5482b7[_0xf713('0x46')]===_0xf713('0x44')){var _0x506f37=_0x2bed66['get']({'plain':!![]});var _0x474d2c=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xf713('0x18'),'value':_0xf713('0x19')},{'name':_0xf713('0x1a'),'value':_0xf713('0x1b')}];var _0x2d408b=_['find'](_0x474d2c,[_0xf713('0x1d'),_0x506f37[_0xf713('0x20')]])[_0xf713('0x21')];return db[_0xf713('0x47')][_0xf713('0x1f')]({'where':{'name':_0x2d408b,'userProfileId':_0x5482b7['userProfileId']},'raw':!![]})['then'](function(_0x13b167){if(_0x13b167&&_0x13b167['autoAssociation']===0x0){return db[_0xf713('0x22')][_0xf713('0x40')]({'name':_0x506f37['name'],'resourceId':_0x506f37['id'],'type':_0x13b167[_0xf713('0x21')],'sectionId':_0x13b167['id']},{})['then'](function(){return _0x2bed66;});}else{return _0x2bed66;}})[_0xf713('0x48')](function(_0x3282cc){logger[_0xf713('0x49')](_0xf713('0x4a'),_0x3282cc);throw _0x3282cc;});}return _0x2bed66;})['then'](respondWithResult(_0x23f00b,0xc9))[_0xf713('0x48')](handleError(_0x23f00b,null));};exports[_0xf713('0x4b')]=function(_0x3f4ffd,_0x40c4f5){if(_0x3f4ffd[_0xf713('0x41')]['id']){delete _0x3f4ffd[_0xf713('0x41')]['id'];}return db[_0xf713('0x38')][_0xf713('0x1f')]({'where':{'id':_0x3f4ffd[_0xf713('0x3c')]['id']}})[_0xf713('0x15')](handleEntityNotFound(_0x40c4f5,null))['then'](function(_0x4b34eb){if(_0x4b34eb){return db[_0xf713('0x38')][_0xf713('0x4b')](_[_0xf713('0x35')](_0x3f4ffd['body'],[_0xf713('0x42'),'context',_0xf713('0x4c'),_0xf713('0x4d'),'cutdigits',_0xf713('0x4e'),_0xf713('0x4f')]),{'where':{'context':_0x4b34eb['context'],'exten':_0x4b34eb[_0xf713('0x42')]},'individualHooks':!![]})[_0xf713('0x15')](function(_0x76a4dd){return _0x76a4dd;});}return null;})[_0xf713('0x15')](respondWithStatusCode(_0x40c4f5,null))[_0xf713('0x48')](handleError(_0x40c4f5,null));};exports[_0xf713('0x50')]=function(_0x5c3ce1,_0x19f494){var _0x88ad25=_0x5c3ce1[_0xf713('0x3c')]['id'];var _0x25f7fd=_0x5c3ce1[_0xf713('0x41')];var _0x2594a9=0xc8;var _0x721879=null;return db[_0xf713('0x51')][_0xf713('0x52')]({'isolationLevel':db[_0xf713('0x51')][_0xf713('0x53')][_0xf713('0x54')][_0xf713('0x55')]},function(_0x52d345){return db[_0xf713('0x38')][_0xf713('0x56')]({'where':{'id':_0x88ad25},'transaction':_0x52d345})[_0xf713('0x15')](function(_0x180ce4){if(_0x180ce4){return db[_0xf713('0x38')][_0xf713('0x14')]({'where':{'VoiceExtensionId':_0x88ad25},'transaction':_0x52d345})['then'](function(){var _0x2aa1ee=_[_0xf713('0x26')](_0x25f7fd,function(_0x232614){_0x232614[_0xf713('0x57')]=_0x88ad25;_0x232614['isApp']=!![];return _0x232614;});return _0x180ce4[_0xf713('0x58')](_0x2aa1ee);})[_0xf713('0x15')](function(_0x57e40c){return db[_0xf713('0x38')]['bulkCreate'](_0x57e40c,{'transaction':_0x52d345});});}else{_0x2594a9=0x194;_0x721879=[];}});})['then'](function(){if(_0x2594a9!==0x194){return db[_0xf713('0x38')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x88ad25},'order':_0xf713('0x59')})[_0xf713('0x15')](function(_0x1b65e7){_0x721879=_0x1b65e7;});}})[_0xf713('0x48')](function(_0x3c7102){_0x2594a9=0x1f4;logger[_0xf713('0x49')](_0x3c7102[_0xf713('0x5a')]);if(_0x3c7102[_0xf713('0x21')]){delete _0x3c7102[_0xf713('0x21')];}_0x721879=_0x3c7102;})[_0xf713('0x5b')](function(){if(_0x721879===null){_0x19f494[_0xf713('0xb')](_0x2594a9);}else{if(_0x2594a9===0x1f4){_0x19f494['status'](_0x2594a9)['send'](_0x721879);}else{_0x19f494[_0xf713('0xc')](_0x2594a9)[_0xf713('0xd')](_0x721879);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 5aad572..fc254ea 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 _0x49f6=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','emit'];(function(_0x59f1e6,_0xda13c5){var _0x2aada5=function(_0x5bf12c){while(--_0x5bf12c){_0x59f1e6['push'](_0x59f1e6['shift']());}};_0x2aada5(++_0xda13c5);}(_0x49f6,0x13e));var _0x649f=function(_0x2399ec,_0x45e036){_0x2399ec=_0x2399ec-0x0;var _0x21307a=_0x49f6[_0x2399ec];return _0x21307a;};'use strict';var EventEmitter=require(_0x649f('0x0'));var VoiceExtension=require(_0x649f('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x649f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x84c93f){return function(_0x2e4f96,_0x1abb7b,_0x3a75e0){VoiceExtensionEvents['emit'](_0x84c93f+':'+_0x2e4f96['id'],_0x2e4f96);VoiceExtensionEvents[_0x649f('0x3')](_0x84c93f,_0x2e4f96);_0x3a75e0(null);};}for(var e in events){if(events[_0x649f('0x4')](e)){var event=events[e];VoiceExtension[_0x649f('0x5')](e,emitEvent(event));}}module[_0x649f('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x7d49=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x35cc5a,_0x25f58f){var _0x510ce5=function(_0x1f476e){while(--_0x1f476e){_0x35cc5a['push'](_0x35cc5a['shift']());}};_0x510ce5(++_0x25f58f);}(_0x7d49,0x1b0));var _0x97d4=function(_0x57acf2,_0x37dbf8){_0x57acf2=_0x57acf2-0x0;var _0x44012a=_0x7d49[_0x57acf2];return _0x44012a;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x97d4('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x97d4('0x1')](0x0);var events={'afterCreate':_0x97d4('0x2'),'afterUpdate':_0x97d4('0x3'),'afterDestroy':_0x97d4('0x4')};function emitEvent(_0x1170b8){return function(_0x588b21,_0x1474dd,_0x3a5058){VoiceExtensionEvents[_0x97d4('0x5')](_0x1170b8+':'+_0x588b21['id'],_0x588b21);VoiceExtensionEvents['emit'](_0x1170b8,_0x588b21);_0x3a5058(null);};}for(var e in events){if(events[_0x97d4('0x6')](e)){var event=events[e];VoiceExtension[_0x97d4('0x7')](e,emitEvent(event));}}module[_0x97d4('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index af663f0..eb97ed4 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 _0x26cd=['toLowerCase','tag','CDR(tag)=','ExecIf','callerID','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','concat','catch','define','VoiceExtension','priority','Hangup','lodash','./voiceExtension.attributes','type','Set','CDR(type)=','context','exten','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','param','phone','prefix','SIP','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','interval','then','*,*,*,*','intervals','IntervalId','map','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26cd,0x14d));var _0xd26c=function(_0x1ae441,_0x5160e2){_0x1ae441=_0x1ae441-0x0;var _0x47b62c=_0x26cd[_0x1ae441];return _0x47b62c;};'use strict';var _=require(_0xd26c('0x0'));var attributes=require(_0xd26c('0x1'));module['exports']=function(_0x45f7cb){var _0x519085=_0x45f7cb['models'];function _0x508185(_0x316695){var _0xae8917=0x2;var _0x5445d5=[{'type':_0x316695[_0xd26c('0x2')],'app':_0xd26c('0x3'),'appdata':_0xd26c('0x4')+_0x316695[_0xd26c('0x2')],'context':_0x316695[_0xd26c('0x5')],'exten':_0x316695[_0xd26c('0x6')],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']}];if(_0x316695[_0xd26c('0x2')]===_0xd26c('0x7')){_0x5445d5[_0xd26c('0x8')]({'type':'inbound','app':_0xd26c('0x3'),'appdata':'CDR(routeid)='+_0x316695['id'],'context':_0x316695[_0xd26c('0x5')],'exten':_0x316695[_0xd26c('0x6')],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']});}_0x5445d5[_0xd26c('0x8')]({'type':_0x316695['type'],'app':_0xd26c('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x316695[_0xd26c('0x5')],'exten':_0x316695['exten'],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']},{'type':_0x316695['type'],'app':'Set','appdata':_0xd26c('0x9'),'context':_0x316695['context'],'exten':_0x316695[_0xd26c('0x6')],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']},{'type':_0x316695[_0xd26c('0x2')],'app':_0xd26c('0x3'),'appdata':_0xd26c('0xa'),'context':_0x316695['context'],'exten':_0x316695[_0xd26c('0x6')],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']});return _0x5445d5;}function _0x42aaa5(_0x39dcf8){var _0x516612=0x2;var _0x547b00=[{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0xc'),'context':_0x39dcf8['context'],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':'CDR(destination)='+(_0x39dcf8[_0xd26c('0xd')]?_0xd26c('0xe')+_0x39dcf8[_0xd26c('0xd')]+'}':'${EXTEN}'),'context':_0x39dcf8['context'],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':'outbound','app':_0xd26c('0x3'),'appdata':_0xd26c('0xf')+_0x39dcf8['id'],'context':_0x39dcf8['context'],'exten':_0x39dcf8['exten'],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':'ExecIf','appdata':_0xd26c('0x10')+(_0x516612+0x2)+_0xd26c('0x11')+(_0x516612+0x1)+')','context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':'Set','appdata':_0x39dcf8[_0xd26c('0xd')]?'CDR(prefix)=${EXTEN:0:'+_0x39dcf8[_0xd26c('0xd')]+'}':_0xd26c('0x12'),'context':_0x39dcf8['context'],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0x13'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8['exten'],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':'outbound','app':'Set','appdata':_0xd26c('0x9'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0xa'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8['exten'],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0x14')+_0x39dcf8['id'],'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']}];if(_0x39dcf8[_0xd26c('0x15')]('recordingFormat')&&_0x39dcf8[_0xd26c('0x16')]!=='none'){_0x547b00[_0xd26c('0x8')]({'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0x17'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x39dcf8[_0xd26c('0x16')]||_0xd26c('0x18'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']});}return _0x547b00;}function _0x8c74f6(_0x23073d,_0x257243){var _0x4b61e0=[{'name':_0xd26c('0x19'),'param':0x0},{'name':_0xd26c('0x1a'),'param':0x1},{'name':_0xd26c('0x1b'),'param':0x2},{'name':_0xd26c('0x1c'),'param':0x3}];var _0x343722={};var _0x2e7ea2=_0x257243[_0xd26c('0x1d')](',');var _0x55287f=[];for(var _0x2b6361=0x0;_0x2b6361<_0x4b61e0[_0xd26c('0x1e')];_0x2b6361++){switch(_0x4b61e0[_0x2b6361]['name']){case _0xd26c('0x19'):_0x343722[_0xd26c('0x19')]=_0x2e7ea2[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]][_0xd26c('0x1d')]('/')[0x1];_0x343722[_0xd26c('0x20')]=_0x2e7ea2[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]][_0xd26c('0x1d')]('/')[0x2];_0x343722[_0xd26c('0x21')]=_0x343722['phone']?_0x343722[_0xd26c('0x20')][_0xd26c('0x1d')]('$')[0x0]:undefined;_0x343722[_0xd26c('0x20')]=_0x23073d[_0xd26c('0xd')]?(_0x343722[_0xd26c('0x21')]||'')+'${EXTEN:'+_0x23073d[_0xd26c('0xd')]+'}':(_0x343722['prefix']||'')+'${EXTEN}';_0x55287f[_0x4b61e0[_0x2b6361]['param']]=[_0xd26c('0x22'),_0x343722[_0xd26c('0x19')],_0x343722[_0xd26c('0x20')]]['join']('/');break;case _0xd26c('0x1b'):_0x343722[_0xd26c('0x1b')]=_0x2e7ea2[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]];if(_0x23073d[_0xd26c('0x16')]!==_0xd26c('0x23')){if(_0x343722['options'][_0xd26c('0x24')](_0xd26c('0x25'))<0x0){_0x343722[_0xd26c('0x1b')]+='U(xcally-mixmonitor-context)';}}else{_0x343722[_0xd26c('0x1b')]=_0x343722[_0xd26c('0x1b')][_0xd26c('0x26')](_0xd26c('0x25'),'');}_0x55287f[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]]=_0x343722[_0xd26c('0x1b')];break;default:_0x55287f[_0x4b61e0[_0x2b6361]['param']]=_0x2e7ea2[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]];}}return _0x55287f['join'](',');}function _0x1012b8(_0x43d314,_0x26d3b5,_0x440077){return new Promise(function(_0x434cfa,_0x12452b){var _0x9a7d77=[];if(_[_0xd26c('0x27')](_0x26d3b5))return _0x434cfa(_0x9a7d77);_0x519085['Interval']['findAll']({'attributes':['id',_0xd26c('0x28'),'IntervalId'],'raw':!![]})[_0xd26c('0x29')](function(_0x552ed4){for(var _0x48e5e3=0x0,_0x3290b5=0x0;_0x48e5e3<_0x26d3b5[_0xd26c('0x1e')];_0x48e5e3++,_0x3290b5=0x0){var _0x42ad62=_0x26d3b5[_0x48e5e3];var _0x24191b=[];var _0x15a1d8=[];delete _0x42ad62['id'];if(_0x42ad62['interval']!==_0xd26c('0x2a')){_0x42ad62[_0xd26c('0x2b')]=[_0x42ad62[_0xd26c('0x28')]];}else{_0x42ad62[_0xd26c('0x2b')]=_0x42ad62[_0xd26c('0x2c')]?_[_0xd26c('0x2d')](_[_0xd26c('0x2e')](_0x552ed4,{'IntervalId':_0x42ad62[_0xd26c('0x2c')]}),_0xd26c('0x28')):[];}_0x42ad62['context']=_0x43d314[_0xd26c('0x5')];_0x42ad62[_0xd26c('0x6')]=_0x43d314['exten'];if(_0x42ad62[_0xd26c('0x2')])_0x42ad62['type']=_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')]();if(_0x43d314['type']===_0xd26c('0xb')){if(_0x42ad62[_0xd26c('0x15')](_0xd26c('0x30'))&&_0x42ad62['tag']&&_0x42ad62[_0xd26c('0x30')]!=='--'){_0x24191b['push']({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':_0xd26c('0x3'),'appdata':_0xd26c('0x31')+_0x42ad62[_0xd26c('0x30')],'context':_0x43d314['context'],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}_0x24191b['push']({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':_0xd26c('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x42ad62[_0xd26c('0x33')]?'Set(CALLERID(all)='+_0x42ad62[_0xd26c('0x33')]+')':_0xd26c('0x34')),'context':_0x43d314[_0xd26c('0x5')],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}else{if(_0x42ad62[_0xd26c('0x15')](_0xd26c('0x35'))){if(['queue',_0xd26c('0x36')][_0xd26c('0x37')](_0x42ad62[_0xd26c('0x38')][_0xd26c('0x2f')]())&&_0x42ad62[_0xd26c('0x39')]!==_0xd26c('0x3a')){if(_0x42ad62['answer']){_0x24191b[_0xd26c('0x8')]({'type':_0x42ad62['type'][_0xd26c('0x2f')](),'app':'ExecIf','appdata':_0xd26c('0x3b'),'context':_0x43d314[_0xd26c('0x5')],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62['intervals'][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});_0x24191b[_0xd26c('0x8')]({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':'Set','appdata':_0xd26c('0x3c'),'context':_0x43d314[_0xd26c('0x5')],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62['intervals'][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}else{_0x24191b['push']({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':_0xd26c('0x32'),'appdata':_0xd26c('0x3d'),'context':_0x43d314['context'],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});_0x24191b[_0xd26c('0x8')]({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':_0xd26c('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x43d314[_0xd26c('0x5')],'exten':_0x43d314['exten'],'priority':_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}}}}for(var _0x5cffbe=0x0;_0x5cffbe<_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')];_0x5cffbe++){var _0x3f6cf6=_0x440077+_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')];var _0x4bd784=_0x5cffbe===_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]-0x1?_0x440077+_0x24191b[_0xd26c('0x1e')]+_0x15a1d8[_0xd26c('0x1e')]+0x2:_0x440077+_0x5cffbe+0x1;_0x24191b[_0xd26c('0x3e')](_0x5cffbe,0x0,{'type':_0x43d314[_0xd26c('0x2')],'app':_0xd26c('0x3f'),'appdata':_0x42ad62[_0xd26c('0x2b')][_0x5cffbe]+'?'+_0x43d314[_0xd26c('0x5')]+_0xd26c('0x40')+_0x3f6cf6+':'+_0x43d314[_0xd26c('0x5')]+_0xd26c('0x40')+_0x4bd784,'exten':_0x43d314['exten'],'context':_0x43d314[_0xd26c('0x5')],'priority':_0x440077+_0x5cffbe,'VoiceExtensionId':_0x43d314['id']});}if(_0x42ad62[_0xd26c('0x39')]===_0xd26c('0x41')){_0x42ad62[_0xd26c('0x42')]=_0x8c74f6(_0x43d314,_0x42ad62[_0xd26c('0x42')]);}if(_0x42ad62[_0xd26c('0x39')]===_0xd26c('0x43')){_0x24191b[_0xd26c('0x8')]({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':'Set','appdata':_0xd26c('0x44'),'context':_0x43d314['context'],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62[_0xd26c('0x2b')]['length']+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}_0x42ad62['priority']=_0x24191b['length']?_[_0xd26c('0x45')](_0x24191b)['priority']+0x1:_0x440077;_0x9a7d77=_[_0xd26c('0x46')](_0x9a7d77,_0x24191b,[_0x42ad62],_0x15a1d8);_0x440077=_[_0xd26c('0x45')](_0x9a7d77)['priority']+0x1;}return _0x434cfa(_0x9a7d77);})[_0xd26c('0x47')](function(_0x56de14){_0x12452b(_0x56de14);});});}return _0x45f7cb[_0xd26c('0x48')](_0xd26c('0x49'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x38aecf){var _0x3ca7bc=this['get']({'plain':!![]});var _0x591c80=_0x3ca7bc[_0xd26c('0x2')]===_0xd26c('0xb')?_0x42aaa5(_0x3ca7bc):_0x508185(_0x3ca7bc);return _0x1012b8(_0x3ca7bc,_0x38aecf,_[_0xd26c('0x45')](_0x591c80)[_0xd26c('0x4a')]+0x1)['then'](function(_0x5d07ac){var _0x553a5e=_[_0xd26c('0x46')](_0x591c80,_0x5d07ac);_0x553a5e['push']({'type':_0x3ca7bc['type'],'app':_0xd26c('0x4b'),'exten':_0x3ca7bc['exten'],'context':_0x3ca7bc[_0xd26c('0x5')],'priority':_['last'](_0x553a5e)[_0xd26c('0x4a')]+0x1,'VoiceExtensionId':_0x3ca7bc['id']});return _0x553a5e;});}}});}; \ No newline at end of file +var _0x9274=['CDR(type)=','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','param','phone','prefix','${EXTEN}','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','tag','toLowerCase','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','concat','priority','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set'];(function(_0x38afd3,_0x7a39bd){var _0x465a56=function(_0x23c83f){while(--_0x23c83f){_0x38afd3['push'](_0x38afd3['shift']());}};_0x465a56(++_0x7a39bd);}(_0x9274,0x1e6));var _0x4927=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9274[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x4927('0x0'));var attributes=require(_0x4927('0x1'));module[_0x4927('0x2')]=function(_0x3e2b95){var _0x289b29=_0x3e2b95[_0x4927('0x3')];function _0x58cd12(_0x3b60a9){var _0x2854d9=0x2;var _0x51549b=[{'type':_0x3b60a9[_0x4927('0x4')],'app':_0x4927('0x5'),'appdata':_0x4927('0x6')+_0x3b60a9[_0x4927('0x4')],'context':_0x3b60a9[_0x4927('0x7')],'exten':_0x3b60a9[_0x4927('0x8')],'priority':_0x2854d9++,'VoiceExtensionId':_0x3b60a9['id']}];if(_0x3b60a9[_0x4927('0x4')]===_0x4927('0x9')){_0x51549b[_0x4927('0xa')]({'type':_0x4927('0x9'),'app':'Set','appdata':_0x4927('0xb')+_0x3b60a9['id'],'context':_0x3b60a9[_0x4927('0x7')],'exten':_0x3b60a9[_0x4927('0x8')],'priority':_0x2854d9++,'VoiceExtensionId':_0x3b60a9['id']});}_0x51549b[_0x4927('0xa')]({'type':_0x3b60a9['type'],'app':_0x4927('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3b60a9['context'],'exten':_0x3b60a9['exten'],'priority':_0x2854d9++,'VoiceExtensionId':_0x3b60a9['id']},{'type':_0x3b60a9[_0x4927('0x4')],'app':_0x4927('0x5'),'appdata':_0x4927('0xc'),'context':_0x3b60a9['context'],'exten':_0x3b60a9[_0x4927('0x8')],'priority':_0x2854d9++,'VoiceExtensionId':_0x3b60a9['id']},{'type':_0x3b60a9['type'],'app':_0x4927('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3b60a9['context'],'exten':_0x3b60a9[_0x4927('0x8')],'priority':_0x2854d9++,'VoiceExtensionId':_0x3b60a9['id']});return _0x51549b;}function _0x52281a(_0x34e17b){var _0x30593c=0x2;var _0x564a6f=[{'type':_0x4927('0xd'),'app':_0x4927('0x5'),'appdata':_0x4927('0xe'),'context':_0x34e17b['context'],'exten':_0x34e17b[_0x4927('0x8')],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']},{'type':_0x4927('0xd'),'app':_0x4927('0x5'),'appdata':'CDR(destination)='+(_0x34e17b[_0x4927('0xf')]?_0x4927('0x10')+_0x34e17b[_0x4927('0xf')]+'}':'${EXTEN}'),'context':_0x34e17b['context'],'exten':_0x34e17b[_0x4927('0x8')],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']},{'type':_0x4927('0xd'),'app':'Set','appdata':_0x4927('0xb')+_0x34e17b['id'],'context':_0x34e17b['context'],'exten':_0x34e17b['exten'],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']},{'type':_0x4927('0xd'),'app':_0x4927('0x11'),'appdata':_0x4927('0x12')+(_0x30593c+0x2)+_0x4927('0x13')+(_0x30593c+0x1)+')','context':_0x34e17b['context'],'exten':_0x34e17b[_0x4927('0x8')],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']},{'type':'outbound','app':_0x4927('0x5'),'appdata':_0x34e17b[_0x4927('0xf')]?_0x4927('0x14')+_0x34e17b['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x34e17b[_0x4927('0x7')],'exten':_0x34e17b['exten'],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']},{'type':_0x4927('0xd'),'app':_0x4927('0x5'),'appdata':_0x4927('0x15'),'context':_0x34e17b[_0x4927('0x7')],'exten':_0x34e17b[_0x4927('0x8')],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']},{'type':'outbound','app':_0x4927('0x5'),'appdata':_0x4927('0xc'),'context':_0x34e17b[_0x4927('0x7')],'exten':_0x34e17b['exten'],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']},{'type':_0x4927('0xd'),'app':_0x4927('0x5'),'appdata':_0x4927('0x16'),'context':_0x34e17b[_0x4927('0x7')],'exten':_0x34e17b['exten'],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']},{'type':_0x4927('0xd'),'app':_0x4927('0x5'),'appdata':_0x4927('0x17')+_0x34e17b['id'],'context':_0x34e17b[_0x4927('0x7')],'exten':_0x34e17b[_0x4927('0x8')],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']}];if(_0x34e17b[_0x4927('0x18')](_0x4927('0x19'))&&_0x34e17b['recordingFormat']!==_0x4927('0x1a')){_0x564a6f[_0x4927('0xa')]({'type':_0x4927('0xd'),'app':_0x4927('0x5'),'appdata':_0x4927('0x1b'),'context':_0x34e17b[_0x4927('0x7')],'exten':_0x34e17b[_0x4927('0x8')],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']},{'type':_0x4927('0xd'),'app':'Set','appdata':_0x4927('0x1c')+_0x34e17b[_0x4927('0x19')]||_0x4927('0x1d'),'context':_0x34e17b[_0x4927('0x7')],'exten':_0x34e17b['exten'],'priority':_0x30593c++,'VoiceExtensionId':_0x34e17b['id']});}return _0x564a6f;}function _0x2578cf(_0x134ed3,_0x35e69f){var _0x4b7c5c=[{'name':_0x4927('0x1e'),'param':0x0},{'name':_0x4927('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x4927('0x20'),'param':0x3}];var _0x3ea951={};var _0x269fd0=_0x35e69f[_0x4927('0x21')](',');var _0x332d3e=[];for(var _0x361baf=0x0;_0x361baf<_0x4b7c5c[_0x4927('0x22')];_0x361baf++){switch(_0x4b7c5c[_0x361baf]['name']){case _0x4927('0x1e'):_0x3ea951[_0x4927('0x1e')]=_0x269fd0[_0x4b7c5c[_0x361baf][_0x4927('0x23')]]['split']('/')[0x1];_0x3ea951[_0x4927('0x24')]=_0x269fd0[_0x4b7c5c[_0x361baf][_0x4927('0x23')]][_0x4927('0x21')]('/')[0x2];_0x3ea951['prefix']=_0x3ea951[_0x4927('0x24')]?_0x3ea951[_0x4927('0x24')][_0x4927('0x21')]('$')[0x0]:undefined;_0x3ea951['phone']=_0x134ed3[_0x4927('0xf')]?(_0x3ea951[_0x4927('0x25')]||'')+_0x4927('0x10')+_0x134ed3[_0x4927('0xf')]+'}':(_0x3ea951[_0x4927('0x25')]||'')+_0x4927('0x26');_0x332d3e[_0x4b7c5c[_0x361baf]['param']]=[_0x4927('0x27'),_0x3ea951[_0x4927('0x1e')],_0x3ea951[_0x4927('0x24')]][_0x4927('0x28')]('/');break;case'options':_0x3ea951[_0x4927('0x29')]=_0x269fd0[_0x4b7c5c[_0x361baf][_0x4927('0x23')]];if(_0x134ed3[_0x4927('0x19')]!==_0x4927('0x1a')){if(_0x3ea951[_0x4927('0x29')][_0x4927('0x2a')](_0x4927('0x2b'))<0x0){_0x3ea951[_0x4927('0x29')]+=_0x4927('0x2b');}}else{_0x3ea951[_0x4927('0x29')]=_0x3ea951[_0x4927('0x29')]['replace'](_0x4927('0x2b'),'');}_0x332d3e[_0x4b7c5c[_0x361baf][_0x4927('0x23')]]=_0x3ea951['options'];break;default:_0x332d3e[_0x4b7c5c[_0x361baf][_0x4927('0x23')]]=_0x269fd0[_0x4b7c5c[_0x361baf][_0x4927('0x23')]];}}return _0x332d3e[_0x4927('0x28')](',');}function _0x32074c(_0x2d27e0,_0x5889ad,_0x1ca27a){return new Promise(function(_0x1916b6,_0x387e8e){var _0x250d70=[];if(_[_0x4927('0x2c')](_0x5889ad))return _0x1916b6(_0x250d70);_0x289b29['Interval'][_0x4927('0x2d')]({'attributes':['id',_0x4927('0x2e'),_0x4927('0x2f')],'raw':!![]})[_0x4927('0x30')](function(_0x374577){for(var _0x1f138f=0x0,_0x5c8853=0x0;_0x1f138f<_0x5889ad[_0x4927('0x22')];_0x1f138f++,_0x5c8853=0x0){var _0xb09e3c=_0x5889ad[_0x1f138f];var _0xba6b70=[];var _0x1d8510=[];delete _0xb09e3c['id'];if(_0xb09e3c['interval']!==_0x4927('0x31')){_0xb09e3c[_0x4927('0x32')]=[_0xb09e3c[_0x4927('0x2e')]];}else{_0xb09e3c['intervals']=_0xb09e3c[_0x4927('0x2f')]?_['map'](_[_0x4927('0x33')](_0x374577,{'IntervalId':_0xb09e3c['IntervalId']}),_0x4927('0x2e')):[];}_0xb09e3c['context']=_0x2d27e0['context'];_0xb09e3c[_0x4927('0x8')]=_0x2d27e0[_0x4927('0x8')];if(_0xb09e3c[_0x4927('0x4')])_0xb09e3c['type']=_0xb09e3c[_0x4927('0x4')]['toLowerCase']();if(_0x2d27e0[_0x4927('0x4')]==='outbound'){if(_0xb09e3c[_0x4927('0x18')]('tag')&&_0xb09e3c[_0x4927('0x34')]&&_0xb09e3c[_0x4927('0x34')]!=='--'){_0xba6b70['push']({'type':_0xb09e3c[_0x4927('0x4')][_0x4927('0x35')](),'app':_0x4927('0x5'),'appdata':_0x4927('0x36')+_0xb09e3c[_0x4927('0x34')],'context':_0x2d27e0[_0x4927('0x7')],'exten':_0x2d27e0[_0x4927('0x8')],'priority':_0xb09e3c[_0x4927('0x32')]['length']+_0x1ca27a+_0x5c8853++,'VoiceExtensionId':_0x2d27e0['id']});}_0xba6b70[_0x4927('0xa')]({'type':_0xb09e3c[_0x4927('0x4')][_0x4927('0x35')](),'app':_0x4927('0x11'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0xb09e3c[_0x4927('0x37')]?_0x4927('0x38')+_0xb09e3c[_0x4927('0x37')]+')':_0x4927('0x39')),'context':_0x2d27e0['context'],'exten':_0x2d27e0[_0x4927('0x8')],'priority':_0xb09e3c[_0x4927('0x32')][_0x4927('0x22')]+_0x1ca27a+_0x5c8853++,'VoiceExtensionId':_0x2d27e0['id']});}else{if(_0xb09e3c['hasOwnProperty'](_0x4927('0x3a'))){if([_0x4927('0x3b'),'playback'][_0x4927('0x3c')](_0xb09e3c[_0x4927('0x3d')]['toLowerCase']())&&_0xb09e3c[_0x4927('0x3e')]!==_0x4927('0x3f')){if(_0xb09e3c[_0x4927('0x3a')]){_0xba6b70[_0x4927('0xa')]({'type':_0xb09e3c[_0x4927('0x4')][_0x4927('0x35')](),'app':_0x4927('0x11'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2d27e0[_0x4927('0x7')],'exten':_0x2d27e0[_0x4927('0x8')],'priority':_0xb09e3c[_0x4927('0x32')][_0x4927('0x22')]+_0x1ca27a+_0x5c8853++,'VoiceExtensionId':_0x2d27e0['id']});_0xba6b70['push']({'type':_0xb09e3c['type'][_0x4927('0x35')](),'app':_0x4927('0x5'),'appdata':_0x4927('0x40'),'context':_0x2d27e0[_0x4927('0x7')],'exten':_0x2d27e0['exten'],'priority':_0xb09e3c[_0x4927('0x32')][_0x4927('0x22')]+_0x1ca27a+_0x5c8853++,'VoiceExtensionId':_0x2d27e0['id']});}else{_0xba6b70[_0x4927('0xa')]({'type':_0xb09e3c['type'][_0x4927('0x35')](),'app':_0x4927('0x11'),'appdata':_0x4927('0x41'),'context':_0x2d27e0['context'],'exten':_0x2d27e0[_0x4927('0x8')],'priority':_0xb09e3c[_0x4927('0x32')]['length']+_0x1ca27a+_0x5c8853++,'VoiceExtensionId':_0x2d27e0['id']});_0xba6b70[_0x4927('0xa')]({'type':_0xb09e3c[_0x4927('0x4')][_0x4927('0x35')](),'app':_0x4927('0x5'),'appdata':_0x4927('0x42'),'context':_0x2d27e0[_0x4927('0x7')],'exten':_0x2d27e0[_0x4927('0x8')],'priority':_0xb09e3c[_0x4927('0x32')][_0x4927('0x22')]+_0x1ca27a+_0x5c8853++,'VoiceExtensionId':_0x2d27e0['id']});}}}}for(var _0x215f72=0x0;_0x215f72<_0xb09e3c[_0x4927('0x32')][_0x4927('0x22')];_0x215f72++){var _0x465589=_0x1ca27a+_0xb09e3c['intervals'][_0x4927('0x22')];var _0x384b71=_0x215f72===_0xb09e3c['intervals'][_0x4927('0x22')]-0x1?_0x1ca27a+_0xba6b70[_0x4927('0x22')]+_0x1d8510['length']+0x2:_0x1ca27a+_0x215f72+0x1;_0xba6b70[_0x4927('0x43')](_0x215f72,0x0,{'type':_0x2d27e0['type'],'app':_0x4927('0x44'),'appdata':_0xb09e3c['intervals'][_0x215f72]+'?'+_0x2d27e0[_0x4927('0x7')]+',${EXTEN},'+_0x465589+':'+_0x2d27e0[_0x4927('0x7')]+_0x4927('0x45')+_0x384b71,'exten':_0x2d27e0[_0x4927('0x8')],'context':_0x2d27e0[_0x4927('0x7')],'priority':_0x1ca27a+_0x215f72,'VoiceExtensionId':_0x2d27e0['id']});}if(_0xb09e3c[_0x4927('0x3e')]===_0x4927('0x46')){_0xb09e3c[_0x4927('0x47')]=_0x2578cf(_0x2d27e0,_0xb09e3c[_0x4927('0x47')]);}if(_0xb09e3c['appType']===_0x4927('0x48')){_0xba6b70[_0x4927('0xa')]({'type':_0xb09e3c[_0x4927('0x4')][_0x4927('0x35')](),'app':'Set','appdata':_0x4927('0x49'),'context':_0x2d27e0[_0x4927('0x7')],'exten':_0x2d27e0[_0x4927('0x8')],'priority':_0xb09e3c[_0x4927('0x32')]['length']+_0x1ca27a+_0x5c8853++,'VoiceExtensionId':_0x2d27e0['id']});}_0xb09e3c['priority']=_0xba6b70['length']?_[_0x4927('0x4a')](_0xba6b70)['priority']+0x1:_0x1ca27a;_0x250d70=_[_0x4927('0x4b')](_0x250d70,_0xba6b70,[_0xb09e3c],_0x1d8510);_0x1ca27a=_['last'](_0x250d70)[_0x4927('0x4c')]+0x1;}return _0x1916b6(_0x250d70);})['catch'](function(_0x3f1317){_0x387e8e(_0x3f1317);});});}return _0x3e2b95[_0x4927('0x4d')](_0x4927('0x4e'),attributes,{'tableName':_0x4927('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x24ed8e){var _0x3a8d7f=this[_0x4927('0x50')]({'plain':!![]});var _0x5eb989=_0x3a8d7f['type']===_0x4927('0xd')?_0x52281a(_0x3a8d7f):_0x58cd12(_0x3a8d7f);return _0x32074c(_0x3a8d7f,_0x24ed8e,_[_0x4927('0x4a')](_0x5eb989)[_0x4927('0x4c')]+0x1)[_0x4927('0x30')](function(_0x5e08bd){var _0x280a5d=_[_0x4927('0x4b')](_0x5eb989,_0x5e08bd);_0x280a5d[_0x4927('0xa')]({'type':_0x3a8d7f[_0x4927('0x4')],'app':_0x4927('0x51'),'exten':_0x3a8d7f['exten'],'context':_0x3a8d7f[_0x4927('0x7')],'priority':_[_0x4927('0x4a')](_0x280a5d)['priority']+0x1,'VoiceExtensionId':_0x3a8d7f['id']});return _0x280a5d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 48cbfda..5628c97 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 _0x07e8=['redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','options','raw','where','limit','include','model','attributes','map','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x4f710c,_0x368203){var _0x1a323d=function(_0x15c791){while(--_0x15c791){_0x4f710c['push'](_0x4f710c['shift']());}};_0x1a323d(++_0x368203);}(_0x07e8,0x10f));var _0x807e=function(_0x511b40,_0x4789d6){_0x511b40=_0x511b40-0x0;var _0x380d26=_0x07e8[_0x511b40];return _0x380d26;};'use strict';var _=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var moment=require(_0x807e('0x2'));var BPromise=require('bluebird');var rs=require(_0x807e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x807e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x807e('0x5'));var config=require(_0x807e('0x6'));var jayson=require(_0x807e('0x7'));var client=jayson['client'][_0x807e('0x8')]({'port':0x232a});config[_0x807e('0x9')]=_[_0x807e('0xa')](config[_0x807e('0x9')],{'host':_0x807e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x807e('0x9')]));require(_0x807e('0xc'))[_0x807e('0xd')](socket);function respondWithRpcPromise(_0x3c6c7a,_0x1c2fdd,_0x45e953){return new BPromise(function(_0x382931,_0x2f44db){return client[_0x807e('0xe')](_0x3c6c7a,_0x45e953)[_0x807e('0xf')](function(_0x2ca6f0){logger[_0x807e('0x10')](_0x807e('0x11'),_0x1c2fdd,_0x807e('0x12'));logger['debug'](_0x807e('0x13'),_0x1c2fdd,_0x807e('0x12'),JSON[_0x807e('0x14')](_0x2ca6f0));if(_0x2ca6f0[_0x807e('0x15')]){if(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x16')]===0x1f4){logger[_0x807e('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x1c2fdd,_0x2ca6f0['error'][_0x807e('0x17')]);return _0x2f44db(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);}logger[_0x807e('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x1c2fdd,_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);return _0x382931(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);}else{logger[_0x807e('0x10')](_0x807e('0x11'),_0x1c2fdd,'request\x20sent');_0x382931(_0x2ca6f0[_0x807e('0x18')]['message']);}})[_0x807e('0x19')](function(_0x328290){logger[_0x807e('0x15')](_0x807e('0x11'),_0x1c2fdd,_0x328290);_0x2f44db(_0x328290);});});}exports[_0x807e('0x1a')]=function(_0xad3e35){var _0x1e39ef=this;return new Promise(function(_0x40abbe,_0x3da4d6){return db['VoiceExtension']['findAll']({'raw':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')][_0x807e('0x1c')]===undefined?!![]:![]:!![],'where':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')][_0x807e('0x1d')]||null:null,'attributes':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')]['attributes']||null:null,'limit':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')][_0x807e('0x1e')]||null:null,'include':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')][_0x807e('0x1f')]?_['map'](_0xad3e35[_0x807e('0x1b')]['include'],function(_0x33ba88){return{'model':db[_0x33ba88[_0x807e('0x20')]],'as':_0x33ba88['as'],'attributes':_0x33ba88[_0x807e('0x21')],'include':_0x33ba88['include']?_[_0x807e('0x22')](_0x33ba88[_0x807e('0x1f')],function(_0x16530c){return{'model':db[_0x16530c[_0x807e('0x20')]],'as':_0x16530c['as'],'attributes':_0x16530c[_0x807e('0x21')],'include':_0x16530c[_0x807e('0x1f')]?_['map'](_0x16530c[_0x807e('0x1f')],function(_0x5211ce){return{'model':db[_0x5211ce[_0x807e('0x20')]],'as':_0x5211ce['as'],'attributes':_0x5211ce[_0x807e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x807e('0xf')](function(_0x546a04){logger[_0x807e('0x10')](_0x807e('0x1a'),_0xad3e35);logger['debug'](_0x807e('0x1a'),_0xad3e35,JSON[_0x807e('0x14')](_0x546a04));_0x40abbe(_0x546a04);})['catch'](function(_0x344eec){logger[_0x807e('0x15')](_0x807e('0x1a'),_0x344eec[_0x807e('0x17')],_0xad3e35);_0x3da4d6(_0x1e39ef[_0x807e('0x15')](0x1f4,_0x344eec[_0x807e('0x17')]));});});}; \ No newline at end of file +var _0x55c1=['../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x174253,_0x5ae43f){var _0x5c7680=function(_0x385847){while(--_0x385847){_0x174253['push'](_0x174253['shift']());}};_0x5c7680(++_0x5ae43f);}(_0x55c1,0x1e5));var _0x155c=function(_0x4e11e7,_0x42d0b6){_0x4e11e7=_0x4e11e7-0x0;var _0x1d7d39=_0x55c1[_0x4e11e7];return _0x1d7d39;};'use strict';var _=require(_0x155c('0x0'));var util=require(_0x155c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x155c('0x2'));var db=require(_0x155c('0x3'))['db'];var utils=require(_0x155c('0x4'));var logger=require(_0x155c('0x5'))(_0x155c('0x6'));var config=require('../../config/environment');var jayson=require(_0x155c('0x7'));var client=jayson[_0x155c('0x8')][_0x155c('0x9')]({'port':0x232a});config['redis']=_[_0x155c('0xa')](config[_0x155c('0xb')],{'host':_0x155c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0x155c('0xd')](socket);function respondWithRpcPromise(_0xb51331,_0x2bf577,_0x2194ff){return new BPromise(function(_0x4f95f0,_0x228de5){return client[_0x155c('0xe')](_0xb51331,_0x2194ff)['then'](function(_0x192182){logger[_0x155c('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x2bf577,_0x155c('0x10'));logger[_0x155c('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2bf577,_0x155c('0x10'),JSON[_0x155c('0x12')](_0x192182));if(_0x192182[_0x155c('0x13')]){if(_0x192182['error'][_0x155c('0x14')]===0x1f4){logger[_0x155c('0x13')](_0x155c('0x15'),_0x2bf577,_0x192182[_0x155c('0x13')][_0x155c('0x16')]);return _0x228de5(_0x192182['error'][_0x155c('0x16')]);}logger[_0x155c('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x2bf577,_0x192182[_0x155c('0x13')]['message']);return _0x4f95f0(_0x192182[_0x155c('0x13')][_0x155c('0x16')]);}else{logger[_0x155c('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x2bf577,_0x155c('0x10'));_0x4f95f0(_0x192182[_0x155c('0x17')][_0x155c('0x16')]);}})[_0x155c('0x18')](function(_0x43f537){logger[_0x155c('0x13')](_0x155c('0x15'),_0x2bf577,_0x43f537);_0x228de5(_0x43f537);});});}exports[_0x155c('0x19')]=function(_0x105206){var _0x137342=this;return new Promise(function(_0x32134a,_0xe422f6){return db[_0x155c('0x1a')][_0x155c('0x1b')]({'raw':_0x105206[_0x155c('0x1c')]?_0x105206[_0x155c('0x1c')][_0x155c('0x1d')]===undefined?!![]:![]:!![],'where':_0x105206['options']?_0x105206[_0x155c('0x1c')][_0x155c('0x1e')]||null:null,'attributes':_0x105206[_0x155c('0x1c')]?_0x105206[_0x155c('0x1c')][_0x155c('0x1f')]||null:null,'limit':_0x105206[_0x155c('0x1c')]?_0x105206['options']['limit']||null:null,'include':_0x105206[_0x155c('0x1c')]?_0x105206[_0x155c('0x1c')][_0x155c('0x20')]?_[_0x155c('0x21')](_0x105206[_0x155c('0x1c')][_0x155c('0x20')],function(_0x452175){return{'model':db[_0x452175[_0x155c('0x22')]],'as':_0x452175['as'],'attributes':_0x452175[_0x155c('0x1f')],'include':_0x452175[_0x155c('0x20')]?_[_0x155c('0x21')](_0x452175[_0x155c('0x20')],function(_0xf4e683){return{'model':db[_0xf4e683[_0x155c('0x22')]],'as':_0xf4e683['as'],'attributes':_0xf4e683[_0x155c('0x1f')],'include':_0xf4e683[_0x155c('0x20')]?_['map'](_0xf4e683[_0x155c('0x20')],function(_0x5a2004){return{'model':db[_0x5a2004['model']],'as':_0x5a2004['as'],'attributes':_0x5a2004['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x43608a){logger[_0x155c('0xf')](_0x155c('0x19'),_0x105206);logger['debug'](_0x155c('0x19'),_0x105206,JSON[_0x155c('0x12')](_0x43608a));_0x32134a(_0x43608a);})[_0x155c('0x18')](function(_0x595d47){logger['error']('GetVoiceExtension',_0x595d47[_0x155c('0x16')],_0x105206);_0xe422f6(_0x137342[_0x155c('0x13')](0x1f4,_0x595d47['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 9bd69cb..7739a37 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x19fc9f,_0x42bd9e){var _0x55dad9=function(_0x4013bb){while(--_0x4013bb){_0x19fc9f['push'](_0x19fc9f['shift']());}};_0x55dad9(++_0x42bd9e);}(_0xf494,0x1c6));var _0x4f49=function(_0x1134a0,_0x45ff2d){_0x1134a0=_0x1134a0-0x0;var _0xc025e5=_0xf494[_0x1134a0];return _0xc025e5;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x240f68,_0x10599e){var _0x4e2d1f=function(_0x3d6ac1){while(--_0x3d6ac1){_0x240f68['push'](_0x240f68['shift']());}};_0x4e2d1f(++_0x10599e);}(_0x4975,0x86));var _0x5497=function(_0x334971,_0x3e23cf){_0x334971=_0x334971-0x0;var _0x53e229=_0x4975[_0x334971];return _0x53e229;};'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 d713548..5f2871c 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 _0x4137=['getMessages','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','/:id/messages'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['show']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file +var _0x1893=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update'];(function(_0x54c0ca,_0x2b926c){var _0x4cf9ee=function(_0x4a5976){while(--_0x4a5976){_0x54c0ca['push'](_0x54c0ca['shift']());}};_0x4cf9ee(++_0x2b926c);}(_0x1893,0xa2));var _0x3189=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x1893[_0x4f431d];return _0x4f31e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3189('0x0'));var timeout=require(_0x3189('0x1'));var express=require(_0x3189('0x2'));var router=express[_0x3189('0x3')]();var fs_extra=require(_0x3189('0x4'));var auth=require(_0x3189('0x5'));var interaction=require(_0x3189('0x6'));var config=require('../../config/environment');var controller=require(_0x3189('0x7'));router[_0x3189('0x8')]('/',auth[_0x3189('0x9')](),controller[_0x3189('0xa')]);router[_0x3189('0x8')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0xc')]);router['get'](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0xe')]);router['post']('/',auth[_0x3189('0x9')](),controller[_0x3189('0xf')]);router[_0x3189('0x10')](_0x3189('0xb'),auth['isAuthenticated'](),controller[_0x3189('0x11')]);router[_0x3189('0x12')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c9e0228..feb660a 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 _0x53ba=['getDataValue','fullname','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x53ba,0x134));var _0xa53b=function(_0x54c0a4,_0x151d9f){_0x54c0a4=_0x54c0a4-0x0;var _0x2c9abe=_0x53ba[_0x54c0a4];return _0x2c9abe;};'use strict';var Sequelize=require(_0xa53b('0x0'));module[_0xa53b('0x1')]={'customer_id':{'type':Sequelize[_0xa53b('0x2')]},'context':{'type':Sequelize[_0xa53b('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xa53b('0x2')],'defaultValue':'','allowNull':![],'unique':_0xa53b('0x3')},'password':{'type':Sequelize[_0xa53b('0x2')]},'fullname':{'type':Sequelize[_0xa53b('0x2')]},'email':{'type':Sequelize[_0xa53b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x27c9c5){this[_0xa53b('0x4')](_0xa53b('0x5'),typeof _0x27c9c5===_0xa53b('0x6')&&_0x27c9c5[_0xa53b('0x7')]()?_0x27c9c5[_0xa53b('0x7')]():null);}},'pager':{'type':Sequelize[_0xa53b('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xa53b('0x8')},'attach':{'type':Sequelize[_0xa53b('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':_0xa53b('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa53b('0x2')]},'callback':{'type':Sequelize[_0xa53b('0x2')]},'review':{'type':Sequelize['ENUM'](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xa53b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':_0xa53b('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xa53b('0xc')},'emailsubject':{'type':Sequelize[_0xa53b('0x2')]},'emailbody':{'type':Sequelize[_0xa53b('0x2')]},'maxsecs':{'type':Sequelize[_0xa53b('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa53b('0xe')],'get':function(){return this[_0xa53b('0xf')](_0xa53b('0x10'))+'\x20-\x20'+this[_0xa53b('0xf')]('mailbox');}}}; \ No newline at end of file +var _0x1a9b=['setDataValue','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','contest_mailbox'];(function(_0x5a9166,_0x402b24){var _0x4874ad=function(_0x8fbc2b){while(--_0x8fbc2b){_0x5a9166['push'](_0x5a9166['shift']());}};_0x4874ad(++_0x402b24);}(_0x1a9b,0x12c));var _0xb1a9=function(_0x13c4f8,_0x433521){_0x13c4f8=_0x13c4f8-0x0;var _0x5a8f4b=_0x1a9b[_0x13c4f8];return _0x5a8f4b;};'use strict';var Sequelize=require(_0xb1a9('0x0'));module[_0xb1a9('0x1')]={'customer_id':{'type':Sequelize[_0xb1a9('0x2')]},'context':{'type':Sequelize[_0xb1a9('0x2')],'defaultValue':'from-voicemail','unique':_0xb1a9('0x3')},'mailbox':{'type':Sequelize[_0xb1a9('0x2')],'defaultValue':'','allowNull':![],'unique':_0xb1a9('0x3')},'password':{'type':Sequelize[_0xb1a9('0x2')]},'fullname':{'type':Sequelize[_0xb1a9('0x2')]},'email':{'type':Sequelize[_0xb1a9('0x2')],'validate':{'isEmail':!![]},'set':function(_0x6759e1){this[_0xb1a9('0x4')](_0xb1a9('0x5'),typeof _0x6759e1==='string'&&_0x6759e1[_0xb1a9('0x6')]()?_0x6759e1[_0xb1a9('0x6')]():null);}},'pager':{'type':Sequelize[_0xb1a9('0x2')]},'tz':{'type':Sequelize[_0xb1a9('0x2')],'defaultValue':_0xb1a9('0x7')},'attach':{'type':Sequelize[_0xb1a9('0x8')](_0xb1a9('0x9'),'no'),'defaultValue':_0xb1a9('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb1a9('0x8')]('yes','no'),'defaultValue':_0xb1a9('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xb1a9('0x2')]},'review':{'type':Sequelize['ENUM'](_0xb1a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xb1a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb1a9('0x8')](_0xb1a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb1a9('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb1a9('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb1a9('0x8')]('yes','no'),'defaultValue':_0xb1a9('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb1a9('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb1a9('0x8')](_0xb1a9('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xb1a9('0x9'),'no'),'defaultValue':_0xb1a9('0x9'),'allowNull':![]},'stamp':{'type':_0xb1a9('0xa')},'emailsubject':{'type':Sequelize[_0xb1a9('0x2')]},'emailbody':{'type':Sequelize[_0xb1a9('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb1a9('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xb1a9('0xc')],'get':function(){return this[_0xb1a9('0xd')](_0xb1a9('0xe'))+'\x20-\x20'+this[_0xb1a9('0xd')](_0xb1a9('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5ca629b..bb6440d 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 _0xd87e=['autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','hasOwnProperty','sort','mailbox','findAndCountAll','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','undefined','limit','count','set','Content-Range','save','then','destroy','get','Voicemails','UserProfileResource','error','name','map','VoiceMail','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x31ea9d,_0x475ab0){var _0x22a4ae=function(_0x48fb68){while(--_0x48fb68){_0x31ea9d['push'](_0x31ea9d['shift']());}};_0x22a4ae(++_0x475ab0);}(_0xd87e,0x1bf));var _0xed87=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0xd87e[_0x41b29e];return _0xacd517;};'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'];function respondWithStatusCode(_0x5e912e,_0x4ffc2d){_0x4ffc2d=_0x4ffc2d||0xcc;return function(_0x466f35){if(_0x466f35){return _0x5e912e[_0xed87('0x18')](_0x4ffc2d);}return _0x5e912e[_0xed87('0x19')](_0x4ffc2d)[_0xed87('0x1a')]();};}function respondWithResult(_0x16bfd6,_0x3865c5){_0x3865c5=_0x3865c5||0xc8;return function(_0x52dfe8){if(_0x52dfe8){return _0x16bfd6[_0xed87('0x19')](_0x3865c5)[_0xed87('0x1b')](_0x52dfe8);}};}function respondWithFilteredResult(_0x1722a6,_0x1e9a3d){return function(_0x2f2fd3){if(_0x2f2fd3){var _0xd34e0e=typeof _0x1e9a3d[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x1e9a3d[_0xed87('0x1e')]==='undefined';var _0x3db5ea=_0x2f2fd3[_0xed87('0x1f')];var _0x2c386a=_0xd34e0e?0x0:_0x1e9a3d[_0xed87('0x1c')];var _0x5f4076=_0xd34e0e?_0x2f2fd3[_0xed87('0x1f')]:_0x1e9a3d[_0xed87('0x1c')]+_0x1e9a3d[_0xed87('0x1e')];var _0x3f9e08;if(_0x5f4076>=_0x3db5ea){_0x5f4076=_0x3db5ea;_0x3f9e08=0xc8;}else{_0x3f9e08=0xce;}_0x1722a6[_0xed87('0x19')](_0x3f9e08);return _0x1722a6[_0xed87('0x20')](_0xed87('0x21'),_0x2c386a+'-'+_0x5f4076+'/'+_0x3db5ea)[_0xed87('0x1b')](_0x2f2fd3);}return null;};}function patchUpdates(_0x3b7981){return function(_0x52e81c){try{jsonpatch['apply'](_0x52e81c,_0x3b7981,!![]);}catch(_0x5db546){return BPromise['reject'](_0x5db546);}return _0x52e81c[_0xed87('0x22')]();};}function saveUpdates(_0x5d3ec8,_0x4191a7){return function(_0x2b0b98){if(_0x2b0b98){return _0x2b0b98['update'](_0x5d3ec8)[_0xed87('0x23')](function(_0x505733){return _0x505733;});}return null;};}function removeEntity(_0x3d1641,_0x24962e){return function(_0x27799a){if(_0x27799a){return _0x27799a[_0xed87('0x24')]()[_0xed87('0x23')](function(){var _0x5d15b3=_0x27799a[_0xed87('0x25')]({'plain':!![]});var _0x3c22b7=_0xed87('0x26');return db[_0xed87('0x27')][_0xed87('0x24')]({'where':{'type':_0x3c22b7,'resourceId':_0x5d15b3['id']}})[_0xed87('0x23')](function(){return _0x27799a;});})[_0xed87('0x23')](function(){_0x3d1641[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x38f5c,_0x469181){return function(_0x341a35){if(!_0x341a35){_0x38f5c[_0xed87('0x18')](0x194);}return _0x341a35;};}function handleError(_0x2b86e2,_0x4dfaf2){_0x4dfaf2=_0x4dfaf2||0x1f4;return function(_0xb32b1c){logger[_0xed87('0x28')](_0xb32b1c['stack']);if(_0xb32b1c[_0xed87('0x29')]){delete _0xb32b1c[_0xed87('0x29')];}_0x2b86e2[_0xed87('0x19')](_0x4dfaf2)['send'](_0xb32b1c);};}exports['index']=function(_0xd0efba,_0x428b75){var _0x21ab8a={},_0x549a19={},_0x37d45a={'count':0x0,'rows':[]};var _0x3b87e3=_[_0xed87('0x2a')](db[_0xed87('0x2b')][_0xed87('0x2c')],function(_0x46b9f9){return{'name':_0x46b9f9[_0xed87('0x2d')],'type':_0x46b9f9[_0xed87('0x2e')][_0xed87('0x2f')]};});_0x549a19['model']=_[_0xed87('0x2a')](_0x3b87e3,_0xed87('0x29'));_0x549a19['query']=_[_0xed87('0x30')](_0xd0efba['query']);_0x549a19[_0xed87('0x31')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],_0x549a19[_0xed87('0x34')]);_0x21ab8a[_0xed87('0x35')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],qs[_0xed87('0x36')](_0xd0efba[_0xed87('0x34')][_0xed87('0x36')]));_0x21ab8a[_0xed87('0x35')]=_0x21ab8a['attributes'][_0xed87('0x37')]?_0x21ab8a[_0xed87('0x35')]:_0x549a19['model'];if(!_0xd0efba[_0xed87('0x34')]['hasOwnProperty'](_0xed87('0x38'))){_0x21ab8a[_0xed87('0x1e')]=qs['limit'](_0xd0efba[_0xed87('0x34')][_0xed87('0x1e')]);_0x21ab8a[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0xd0efba[_0xed87('0x34')]['offset']);}_0x21ab8a[_0xed87('0x39')]=qs['sort'](_0xd0efba[_0xed87('0x34')]['sort']);_0x21ab8a[_0xed87('0x3a')]=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0xd0efba[_0xed87('0x34')],_0x549a19[_0xed87('0x31')]),_0x3b87e3);if(_0xd0efba[_0xed87('0x34')][_0xed87('0x3c')]){_0x21ab8a[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0x21ab8a['where'],{'$or':_['map'](_0x3b87e3,function(_0xa6714a){if(_0xa6714a[_0xed87('0x2e')]!==_0xed87('0x3e')){var _0x325112={};_0x325112[_0xa6714a[_0xed87('0x29')]]={'$like':'%'+_0xd0efba[_0xed87('0x34')]['filter']+'%'};return _0x325112;}})});}_0x21ab8a=_[_0xed87('0x3d')]({},_0x21ab8a,_0xd0efba[_0xed87('0x3f')]);var _0x1c49b0={'where':_0x21ab8a['where']};return db[_0xed87('0x2b')][_0xed87('0x1f')](_0x1c49b0)[_0xed87('0x23')](function(_0x1b0092){_0x37d45a[_0xed87('0x1f')]=_0x1b0092;if(_0xd0efba[_0xed87('0x34')][_0xed87('0x40')]){_0x21ab8a[_0xed87('0x41')]=[{'all':!![]}];}return db[_0xed87('0x2b')][_0xed87('0x42')](_0x21ab8a);})['then'](function(_0x7e6cbb){_0x37d45a[_0xed87('0x43')]=_0x7e6cbb;return _0x37d45a;})[_0xed87('0x23')](respondWithFilteredResult(_0x428b75,_0x21ab8a))['catch'](handleError(_0x428b75,null));};exports['show']=function(_0xa31eec,_0x7aa7fa){var _0x40cd98={'raw':!![],'where':{'id':_0xa31eec['params']['id']}},_0x41a658={};_0x41a658[_0xed87('0x33')]=_[_0xed87('0x30')](db['VoiceMail'][_0xed87('0x2c')]);_0x41a658[_0xed87('0x34')]=_[_0xed87('0x30')](_0xa31eec[_0xed87('0x34')]);_0x41a658[_0xed87('0x31')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],_0x41a658[_0xed87('0x34')]);_0x40cd98[_0xed87('0x35')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],qs['fields'](_0xa31eec[_0xed87('0x34')][_0xed87('0x36')]));_0x40cd98[_0xed87('0x35')]=_0x40cd98[_0xed87('0x35')][_0xed87('0x37')]?_0x40cd98[_0xed87('0x35')]:_0x41a658[_0xed87('0x33')];if(_0xa31eec[_0xed87('0x34')][_0xed87('0x40')]){_0x40cd98[_0xed87('0x41')]=[{'all':!![]}];}_0x40cd98=_[_0xed87('0x3d')]({},_0x40cd98,_0xa31eec[_0xed87('0x3f')]);return db[_0xed87('0x2b')][_0xed87('0x44')](_0x40cd98)[_0xed87('0x23')](handleEntityNotFound(_0x7aa7fa,null))[_0xed87('0x23')](respondWithResult(_0x7aa7fa,null))[_0xed87('0x45')](handleError(_0x7aa7fa,null));};exports['create']=function(_0x2c7bef,_0x1a68a7){return db[_0xed87('0x2b')]['create'](_0x2c7bef[_0xed87('0x46')],{})[_0xed87('0x23')](function(_0x54bc95){var _0x33e736=_0x2c7bef[_0xed87('0x47')][_0xed87('0x25')]({'plain':!![]});if(!_0x33e736)throw new Error(_0xed87('0x48'));if(_0x33e736['role']===_0xed87('0x47')){var _0x436e15=_0x54bc95[_0xed87('0x25')]({'plain':!![]});var _0x272a07=_0xed87('0x26');return db[_0xed87('0x49')][_0xed87('0x44')]({'where':{'name':_0x272a07,'userProfileId':_0x33e736[_0xed87('0x4a')]},'raw':!![]})[_0xed87('0x23')](function(_0x251d4e){if(_0x251d4e&&_0x251d4e[_0xed87('0x4b')]===0x0){return db[_0xed87('0x27')][_0xed87('0x4c')]({'name':_0x436e15['name'],'resourceId':_0x436e15['id'],'type':_0x251d4e[_0xed87('0x29')],'sectionId':_0x251d4e['id']},{})['then'](function(){return _0x54bc95;});}else{return _0x54bc95;}})[_0xed87('0x45')](function(_0x329973){logger[_0xed87('0x28')](_0xed87('0x4d'),_0x329973);throw _0x329973;});}return _0x54bc95;})[_0xed87('0x23')](respondWithResult(_0x1a68a7,0xc9))[_0xed87('0x45')](handleError(_0x1a68a7,null));};exports[_0xed87('0x4e')]=function(_0xccdbb6,_0x3b413d){if(_0xccdbb6[_0xed87('0x46')]['id']){delete _0xccdbb6['body']['id'];}return db[_0xed87('0x2b')][_0xed87('0x44')]({'where':{'id':_0xccdbb6[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x3b413d,null))[_0xed87('0x23')](saveUpdates(_0xccdbb6[_0xed87('0x46')],null))[_0xed87('0x23')](respondWithResult(_0x3b413d,null))[_0xed87('0x45')](handleError(_0x3b413d,null));};exports[_0xed87('0x24')]=function(_0x367ff4,_0x32db1f){return db['VoiceMail']['find']({'where':{'id':_0x367ff4[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x32db1f,null))[_0xed87('0x23')](removeEntity(_0x32db1f,null))[_0xed87('0x45')](handleError(_0x32db1f,null));};exports[_0xed87('0x50')]=function(_0x4dd840,_0x7e6738,_0x1ddd72){return db[_0xed87('0x2b')][_0xed87('0x51')]({'where':{'id':_0x4dd840[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x7e6738,null))[_0xed87('0x23')](function(_0x1391a2){var _0x2ffffa;var _0xf4ec55={},_0x3feebb={};_0x3feebb[_0xed87('0x33')]=_[_0xed87('0x30')](db[_0xed87('0x52')]['rawAttributes']);_0x3feebb[_0xed87('0x34')]=_[_0xed87('0x30')](_0x4dd840[_0xed87('0x34')]);_0x3feebb[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3feebb[_0xed87('0x33')],_0x3feebb[_0xed87('0x34')]);_0xf4ec55[_0xed87('0x35')]=_['intersection'](_0x3feebb[_0xed87('0x33')],qs[_0xed87('0x36')](_0x4dd840[_0xed87('0x34')][_0xed87('0x36')]));_0xf4ec55[_0xed87('0x35')]=_0xf4ec55[_0xed87('0x35')]['length']?_0xf4ec55['attributes']:_0x3feebb[_0xed87('0x33')];if(!_0x4dd840[_0xed87('0x34')][_0xed87('0x53')](_0xed87('0x38'))){_0xf4ec55[_0xed87('0x1e')]=qs[_0xed87('0x1e')](_0x4dd840[_0xed87('0x34')][_0xed87('0x1e')]);_0xf4ec55['offset']=qs[_0xed87('0x1c')](_0x4dd840['query'][_0xed87('0x1c')]);}_0xf4ec55[_0xed87('0x39')]=qs['sort'](_0x4dd840[_0xed87('0x34')][_0xed87('0x54')]);_0xf4ec55['where']=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0x4dd840[_0xed87('0x34')],_0x3feebb[_0xed87('0x31')]));if(_0x4dd840[_0xed87('0x34')]['filter']){_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'$or':_[_0xed87('0x2a')](_0xf4ec55['attributes'],function(_0x58279a){var _0x3a6ab6={};_0x3a6ab6[_0x58279a]={'$like':'%'+_0x4dd840[_0xed87('0x34')]['filter']+'%'};return _0x3a6ab6;})});}_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'mailboxuser':_0x1391a2[_0xed87('0x55')]});_0xf4ec55=_[_0xed87('0x3d')]({},_0xf4ec55,_0x4dd840[_0xed87('0x3f')]);return db[_0xed87('0x52')][_0xed87('0x56')](_0xf4ec55)[_0xed87('0x23')](respondWithFilteredResult(_0x7e6738,_0xf4ec55));})[_0xed87('0x45')](handleError(_0x7e6738,null));}; \ No newline at end of file +var _0x4cf8=['UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','VoiceMail','include','findAll','catch','find','create','body','user','UserProfileSection','userProfileId','params','getMessages','findOne','VoiceMailMessage','mailbox','options','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x4cf8[_0xe73080];return _0x12cbc4;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){var _0x1c7747=_0x4c9d1c[_0x84cf('0x27')]({'plain':!![]});var _0x1d220a=_0x84cf('0x28');return db[_0x84cf('0x29')][_0x84cf('0x26')]({'where':{'type':_0x1d220a,'resourceId':_0x1c7747['id']}})[_0x84cf('0x25')](function(){return _0x4c9d1c;});})[_0x84cf('0x25')](function(){_0x29e9e1['status'](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x17bc92,_0x2a4973){return function(_0x41a5db){if(!_0x41a5db){_0x17bc92['sendStatus'](0x194);}return _0x41a5db;};}function handleError(_0x1595dd,_0x5a428c){_0x5a428c=_0x5a428c||0x1f4;return function(_0x29455e){logger[_0x84cf('0x2a')](_0x29455e[_0x84cf('0x2b')]);if(_0x29455e[_0x84cf('0x2c')]){delete _0x29455e[_0x84cf('0x2c')];}_0x1595dd[_0x84cf('0x19')](_0x5a428c)[_0x84cf('0x2d')](_0x29455e);};}exports[_0x84cf('0x2e')]=function(_0x1bfa56,_0xb4fc5a){var _0x31dbf5={},_0x308f8f={},_0x18243d={'count':0x0,'rows':[]};var _0x44f16e=_['map'](db['VoiceMail'][_0x84cf('0x2f')],function(_0x25de3a){return{'name':_0x25de3a[_0x84cf('0x30')],'type':_0x25de3a[_0x84cf('0x31')][_0x84cf('0x32')]};});_0x308f8f[_0x84cf('0x33')]=_[_0x84cf('0x34')](_0x44f16e,_0x84cf('0x2c'));_0x308f8f['query']=_[_0x84cf('0x35')](_0x1bfa56[_0x84cf('0x36')]);_0x308f8f['filters']=_[_0x84cf('0x37')](_0x308f8f['model'],_0x308f8f[_0x84cf('0x36')]);_0x31dbf5[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x308f8f[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x1bfa56['query'][_0x84cf('0x39')]));_0x31dbf5['attributes']=_0x31dbf5['attributes'][_0x84cf('0x3a')]?_0x31dbf5[_0x84cf('0x38')]:_0x308f8f['model'];if(!_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x3b')](_0x84cf('0x3c'))){_0x31dbf5[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x1bfa56[_0x84cf('0x36')]['limit']);_0x31dbf5[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x1c')]);}_0x31dbf5[_0x84cf('0x3e')]=qs[_0x84cf('0x3f')](_0x1bfa56['query'][_0x84cf('0x3f')]);_0x31dbf5['where']=qs[_0x84cf('0x40')](_[_0x84cf('0x41')](_0x1bfa56[_0x84cf('0x36')],_0x308f8f[_0x84cf('0x40')]),_0x44f16e);if(_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x42')]){_0x31dbf5[_0x84cf('0x43')]=_[_0x84cf('0x44')](_0x31dbf5[_0x84cf('0x43')],{'$or':_['map'](_0x44f16e,function(_0x44e6f0){if(_0x44e6f0['type']!==_0x84cf('0x45')){var _0xc75386={};_0xc75386[_0x44e6f0['name']]={'$like':'%'+_0x1bfa56[_0x84cf('0x36')]['filter']+'%'};return _0xc75386;}})});}_0x31dbf5=_[_0x84cf('0x44')]({},_0x31dbf5,_0x1bfa56['options']);var _0x3fc160={'where':_0x31dbf5['where']};return db[_0x84cf('0x46')][_0x84cf('0x1e')](_0x3fc160)['then'](function(_0x847ce9){_0x18243d[_0x84cf('0x1e')]=_0x847ce9;if(_0x1bfa56[_0x84cf('0x36')]['includeAll']){_0x31dbf5[_0x84cf('0x47')]=[{'all':!![]}];}return db['VoiceMail'][_0x84cf('0x48')](_0x31dbf5);})['then'](function(_0x56b0e5){_0x18243d['rows']=_0x56b0e5;return _0x18243d;})[_0x84cf('0x25')](respondWithFilteredResult(_0xb4fc5a,_0x31dbf5))[_0x84cf('0x49')](handleError(_0xb4fc5a,null));};exports['show']=function(_0x2b737e,_0x56b623){var _0x191ad8={'raw':!![],'where':{'id':_0x2b737e['params']['id']}},_0x3fe8c1={};_0x3fe8c1[_0x84cf('0x33')]=_['keys'](db[_0x84cf('0x46')]['rawAttributes']);_0x3fe8c1['query']=_['keys'](_0x2b737e['query']);_0x3fe8c1['filters']=_['intersection'](_0x3fe8c1['model'],_0x3fe8c1[_0x84cf('0x36')]);_0x191ad8[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x3fe8c1[_0x84cf('0x33')],qs['fields'](_0x2b737e[_0x84cf('0x36')]['fields']));_0x191ad8[_0x84cf('0x38')]=_0x191ad8[_0x84cf('0x38')][_0x84cf('0x3a')]?_0x191ad8[_0x84cf('0x38')]:_0x3fe8c1[_0x84cf('0x33')];if(_0x2b737e[_0x84cf('0x36')]['includeAll']){_0x191ad8[_0x84cf('0x47')]=[{'all':!![]}];}_0x191ad8=_[_0x84cf('0x44')]({},_0x191ad8,_0x2b737e['options']);return db[_0x84cf('0x46')][_0x84cf('0x4a')](_0x191ad8)[_0x84cf('0x25')](handleEntityNotFound(_0x56b623,null))['then'](respondWithResult(_0x56b623,null))['catch'](handleError(_0x56b623,null));};exports['create']=function(_0x1cf3f6,_0x104421){return db[_0x84cf('0x46')][_0x84cf('0x4b')](_0x1cf3f6[_0x84cf('0x4c')],{})[_0x84cf('0x25')](function(_0x51d725){var _0x350985=_0x1cf3f6['user'][_0x84cf('0x27')]({'plain':!![]});if(!_0x350985)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x350985['role']===_0x84cf('0x4d')){var _0xb1c3a8=_0x51d725[_0x84cf('0x27')]({'plain':!![]});var _0x55e24e='Voicemails';return db[_0x84cf('0x4e')][_0x84cf('0x4a')]({'where':{'name':_0x55e24e,'userProfileId':_0x350985[_0x84cf('0x4f')]},'raw':!![]})[_0x84cf('0x25')](function(_0x401ced){if(_0x401ced&&_0x401ced['autoAssociation']===0x0){return db[_0x84cf('0x29')][_0x84cf('0x4b')]({'name':_0xb1c3a8['name'],'resourceId':_0xb1c3a8['id'],'type':_0x401ced[_0x84cf('0x2c')],'sectionId':_0x401ced['id']},{})['then'](function(){return _0x51d725;});}else{return _0x51d725;}})['catch'](function(_0x147194){logger[_0x84cf('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147194);throw _0x147194;});}return _0x51d725;})['then'](respondWithResult(_0x104421,0xc9))[_0x84cf('0x49')](handleError(_0x104421,null));};exports[_0x84cf('0x24')]=function(_0x2f739a,_0x1e2676){if(_0x2f739a[_0x84cf('0x4c')]['id']){delete _0x2f739a[_0x84cf('0x4c')]['id'];}return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x2f739a['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x1e2676,null))[_0x84cf('0x25')](saveUpdates(_0x2f739a['body'],null))['then'](respondWithResult(_0x1e2676,null))[_0x84cf('0x49')](handleError(_0x1e2676,null));};exports[_0x84cf('0x26')]=function(_0x3912cb,_0x2a4f20){return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x3912cb[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a4f20,null))[_0x84cf('0x25')](removeEntity(_0x2a4f20,null))['catch'](handleError(_0x2a4f20,null));};exports[_0x84cf('0x51')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){return db['VoiceMail'][_0x84cf('0x52')]({'where':{'id':_0x5c0122[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a60bc,null))[_0x84cf('0x25')](function(_0x53bfb8){var _0x577d55;var _0x5cc371={},_0x50cde2={};_0x50cde2[_0x84cf('0x33')]=_[_0x84cf('0x35')](db[_0x84cf('0x53')][_0x84cf('0x2f')]);_0x50cde2['query']=_[_0x84cf('0x35')](_0x5c0122[_0x84cf('0x36')]);_0x50cde2['filters']=_[_0x84cf('0x37')](_0x50cde2[_0x84cf('0x33')],_0x50cde2[_0x84cf('0x36')]);_0x5cc371[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x50cde2[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x5c0122[_0x84cf('0x36')]['fields']));_0x5cc371[_0x84cf('0x38')]=_0x5cc371['attributes'][_0x84cf('0x3a')]?_0x5cc371[_0x84cf('0x38')]:_0x50cde2[_0x84cf('0x33')];if(!_0x5c0122[_0x84cf('0x36')][_0x84cf('0x3b')]('nolimit')){_0x5cc371[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x5c0122[_0x84cf('0x36')]['limit']);_0x5cc371[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x5c0122['query'][_0x84cf('0x1c')]);}_0x5cc371['order']=qs[_0x84cf('0x3f')](_0x5c0122[_0x84cf('0x36')]['sort']);_0x5cc371[_0x84cf('0x43')]=qs[_0x84cf('0x40')](_['pick'](_0x5c0122[_0x84cf('0x36')],_0x50cde2[_0x84cf('0x40')]));if(_0x5c0122[_0x84cf('0x36')][_0x84cf('0x42')]){_0x5cc371['where']=_[_0x84cf('0x44')](_0x5cc371[_0x84cf('0x43')],{'$or':_['map'](_0x5cc371['attributes'],function(_0x4d40e2){var _0x1b000c={};_0x1b000c[_0x4d40e2]={'$like':'%'+_0x5c0122[_0x84cf('0x36')][_0x84cf('0x42')]+'%'};return _0x1b000c;})});}_0x5cc371['where']=_['merge'](_0x5cc371[_0x84cf('0x43')],{'mailboxuser':_0x53bfb8[_0x84cf('0x54')]});_0x5cc371=_[_0x84cf('0x44')]({},_0x5cc371,_0x5c0122[_0x84cf('0x55')]);return db[_0x84cf('0x53')][_0x84cf('0x56')](_0x5cc371)[_0x84cf('0x25')](respondWithFilteredResult(_0x2a60bc,_0x5cc371));})[_0x84cf('0x49')](handleError(_0x2a60bc,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5444755..23312ad 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 _0xff48=['exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x16f7c3,_0x7cc6bd){var _0x259a52=function(_0x5d494a){while(--_0x5d494a){_0x16f7c3['push'](_0x16f7c3['shift']());}};_0x259a52(++_0x7cc6bd);}(_0xff48,0x167));var _0x8ff4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xff48[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ff4('0x0'));var util=require(_0x8ff4('0x1'));var logger=require(_0x8ff4('0x2'))(_0x8ff4('0x3'));var moment=require(_0x8ff4('0x4'));var BPromise=require(_0x8ff4('0x5'));var rp=require(_0x8ff4('0x6'));var fs=require('fs');var path=require(_0x8ff4('0x7'));var rimraf=require(_0x8ff4('0x8'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x8ff4('0x9')]=function(_0x56918a,_0x25fcc4){return _0x56918a[_0x8ff4('0xa')](_0x8ff4('0xb'),attributes,{'tableName':_0x8ff4('0xc'),'paranoid':![],'indexes':[{'name':_0x8ff4('0xd'),'fields':[_0x8ff4('0xe'),_0x8ff4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2769=['request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xe254d7,_0xcd1347){var _0x13b791=function(_0x55798f){while(--_0x55798f){_0xe254d7['push'](_0xe254d7['shift']());}};_0x13b791(++_0xcd1347);}(_0x2769,0x1ea));var _0x9276=function(_0x2ee500,_0x4f6d20){_0x2ee500=_0x2ee500-0x0;var _0x1da789=_0x2769[_0x2ee500];return _0x1da789;};'use strict';var _=require(_0x9276('0x0'));var util=require(_0x9276('0x1'));var logger=require(_0x9276('0x2'))(_0x9276('0x3'));var moment=require(_0x9276('0x4'));var BPromise=require(_0x9276('0x5'));var rp=require(_0x9276('0x6'));var fs=require('fs');var path=require(_0x9276('0x7'));var rimraf=require('rimraf');var config=require(_0x9276('0x8'));var attributes=require(_0x9276('0x9'));module[_0x9276('0xa')]=function(_0x382d60,_0x3d3c18){return _0x382d60[_0x9276('0xb')](_0x9276('0xc'),attributes,{'tableName':_0x9276('0xd'),'paranoid':![],'indexes':[{'name':_0x9276('0xe'),'fields':[_0x9276('0xf'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 2dfe6e7..e06fb25 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 _0x5cdc=['request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3bcbe2,_0x42bf6c){var _0x102cd0=function(_0x3b1d93){while(--_0x3b1d93){_0x3bcbe2['push'](_0x3bcbe2['shift']());}};_0x102cd0(++_0x42bf6c);}(_0x5cdc,0x154));var _0xc5cd=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x5cdc[_0x420513];return _0x1b44ec;};'use strict';var _=require(_0xc5cd('0x0'));var util=require(_0xc5cd('0x1'));var moment=require(_0xc5cd('0x2'));var BPromise=require(_0xc5cd('0x3'));var rs=require(_0xc5cd('0x4'));var fs=require('fs');var Redis=require(_0xc5cd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc5cd('0x6'))(_0xc5cd('0x7'));var config=require(_0xc5cd('0x8'));var jayson=require(_0xc5cd('0x9'));var client=jayson[_0xc5cd('0xa')][_0xc5cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21e8ef,_0x4faebd,_0x6caf41){return new BPromise(function(_0x54f6ce,_0xee4933){return client[_0xc5cd('0xc')](_0x21e8ef,_0x6caf41)['then'](function(_0x38eb6b){logger[_0xc5cd('0xd')](_0xc5cd('0xe'),_0x4faebd,_0xc5cd('0xf'));logger['debug'](_0xc5cd('0x10'),_0x4faebd,'request\x20sent',JSON[_0xc5cd('0x11')](_0x38eb6b));if(_0x38eb6b[_0xc5cd('0x12')]){if(_0x38eb6b[_0xc5cd('0x12')]['code']===0x1f4){logger[_0xc5cd('0x12')](_0xc5cd('0xe'),_0x4faebd,_0x38eb6b[_0xc5cd('0x12')]['message']);return _0xee4933(_0x38eb6b[_0xc5cd('0x12')][_0xc5cd('0x13')]);}logger['error'](_0xc5cd('0xe'),_0x4faebd,_0x38eb6b[_0xc5cd('0x12')][_0xc5cd('0x13')]);return _0x54f6ce(_0x38eb6b[_0xc5cd('0x12')]['message']);}else{logger['info'](_0xc5cd('0xe'),_0x4faebd,_0xc5cd('0xf'));_0x54f6ce(_0x38eb6b[_0xc5cd('0x14')][_0xc5cd('0x13')]);}})[_0xc5cd('0x15')](function(_0x5b0f2b){logger['error'](_0xc5cd('0xe'),_0x4faebd,_0x5b0f2b);_0xee4933(_0x5b0f2b);});});} \ No newline at end of file +var _0x691b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x51b936,_0x3a4b19){var _0x549f7e=function(_0x5c164f){while(--_0x5c164f){_0x51b936['push'](_0x51b936['shift']());}};_0x549f7e(++_0x3a4b19);}(_0x691b,0x12f));var _0xb691=function(_0x12fae7,_0x100e30){_0x12fae7=_0x12fae7-0x0;var _0x23a0f2=_0x691b[_0x12fae7];return _0x23a0f2;};'use strict';var _=require('lodash');var util=require(_0xb691('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb691('0x1'));var fs=require('fs');var Redis=require(_0xb691('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb691('0x3'));var logger=require(_0xb691('0x4'))(_0xb691('0x5'));var config=require(_0xb691('0x6'));var jayson=require(_0xb691('0x7'));var client=jayson[_0xb691('0x8')][_0xb691('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ce9d5,_0x36d642,_0x2d5c82){return new BPromise(function(_0x390117,_0x1ca3d3){return client[_0xb691('0xa')](_0x3ce9d5,_0x2d5c82)[_0xb691('0xb')](function(_0x1e067e){logger[_0xb691('0xc')]('VoiceMail,\x20%s,\x20%s',_0x36d642,_0xb691('0xd'));logger[_0xb691('0xe')](_0xb691('0xf'),_0x36d642,'request\x20sent',JSON['stringify'](_0x1e067e));if(_0x1e067e[_0xb691('0x10')]){if(_0x1e067e[_0xb691('0x10')][_0xb691('0x11')]===0x1f4){logger[_0xb691('0x10')](_0xb691('0x12'),_0x36d642,_0x1e067e[_0xb691('0x10')][_0xb691('0x13')]);return _0x1ca3d3(_0x1e067e[_0xb691('0x10')][_0xb691('0x13')]);}logger['error'](_0xb691('0x12'),_0x36d642,_0x1e067e[_0xb691('0x10')][_0xb691('0x13')]);return _0x390117(_0x1e067e[_0xb691('0x10')][_0xb691('0x13')]);}else{logger[_0xb691('0xc')]('VoiceMail,\x20%s,\x20%s',_0x36d642,_0xb691('0xd'));_0x390117(_0x1e067e[_0xb691('0x14')][_0xb691('0x13')]);}})[_0xb691('0x15')](function(_0x3febab){logger[_0xb691('0x10')](_0xb691('0x12'),_0x36d642,_0x3febab);_0x1ca3d3(_0x3febab);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index c396cc5..34d5f9b 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 _0xed5e=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','/:id','update'];(function(_0x5e4476,_0x456500){var _0x374cb8=function(_0x4a1625){while(--_0x4a1625){_0x5e4476['push'](_0x5e4476['shift']());}};_0x374cb8(++_0x456500);}(_0xed5e,0x8f));var _0xeed5=function(_0x16dacd,_0x4d8722){_0x16dacd=_0x16dacd-0x0;var _0x1f8166=_0xed5e[_0x16dacd];return _0x1f8166;};'use strict';var multer=require(_0xeed5('0x0'));var util=require(_0xeed5('0x1'));var path=require(_0xeed5('0x2'));var timeout=require(_0xeed5('0x3'));var express=require(_0xeed5('0x4'));var router=express[_0xeed5('0x5')]();var fs_extra=require(_0xeed5('0x6'));var auth=require(_0xeed5('0x7'));var interaction=require(_0xeed5('0x8'));var config=require(_0xeed5('0x9'));var controller=require('./voiceMailMessage.controller');router[_0xeed5('0xa')]('/',auth[_0xeed5('0xb')](),controller[_0xeed5('0xc')]);router[_0xeed5('0xa')]('/:id',auth[_0xeed5('0xb')](),controller[_0xeed5('0xd')]);router['get'](_0xeed5('0xe'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xeed5('0xb')](),controller['create']);router['put'](_0xeed5('0xf'),auth[_0xeed5('0xb')](),controller[_0xeed5('0x10')]);router[_0xeed5('0x11')](_0xeed5('0xf'),auth[_0xeed5('0xb')](),controller[_0xeed5('0x12')]);module[_0xeed5('0x13')]=router; \ No newline at end of file +var _0xcd48=['Router','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','/:id/download','post','create','put','destroy','exports','util','connect-timeout','express'];(function(_0x40e90d,_0x5cb236){var _0x1e903f=function(_0x2d318f){while(--_0x2d318f){_0x40e90d['push'](_0x40e90d['shift']());}};_0x1e903f(++_0x5cb236);}(_0xcd48,0x1d9));var _0x8cd4=function(_0x48f119,_0x3242ac){_0x48f119=_0x48f119-0x0;var _0x4a17f4=_0xcd48[_0x48f119];return _0x4a17f4;};'use strict';var multer=require('multer');var util=require(_0x8cd4('0x0'));var path=require('path');var timeout=require(_0x8cd4('0x1'));var express=require(_0x8cd4('0x2'));var router=express[_0x8cd4('0x3')]();var fs_extra=require(_0x8cd4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8cd4('0x5'));var config=require('../../config/environment');var controller=require(_0x8cd4('0x6'));router['get']('/',auth[_0x8cd4('0x7')](),controller[_0x8cd4('0x8')]);router[_0x8cd4('0x9')](_0x8cd4('0xa'),auth[_0x8cd4('0x7')](),controller['show']);router[_0x8cd4('0x9')](_0x8cd4('0xb'),auth[_0x8cd4('0x7')](),controller['download']);router[_0x8cd4('0xc')]('/',auth[_0x8cd4('0x7')](),controller[_0x8cd4('0xd')]);router[_0x8cd4('0xe')](_0x8cd4('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8cd4('0xf')]);module[_0x8cd4('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 8516ef6..bbf3d5c 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 _0x30e1=['literal','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x30e1,0x160));var _0x130e=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x30e1[_0x1793de];return _0x4f0309;};'use strict';var Sequelize=require(_0x130e('0x0'));module[_0x130e('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x53bf00){return this[_0x130e('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x130e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x130e('0x5')](_0x130e('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'stamp':{'type':_0x130e('0x7'),'defaultValue':Sequelize[_0x130e('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x3f36=['long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','STRING','BLOB'];(function(_0x4b3de2,_0x428dad){var _0x4a8e98=function(_0x2aac34){while(--_0x2aac34){_0x4b3de2['push'](_0x4b3de2['shift']());}};_0x4a8e98(++_0x428dad);}(_0x3f36,0x163));var _0x63f3=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x3f36[_0x35a274];return _0x40d905;};'use strict';var Sequelize=require(_0x63f3('0x0'));module[_0x63f3('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2c8d5f){return this[_0x63f3('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x63f3('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x63f3('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x63f3('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x63f3('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x63f3('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x63f3('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x63f3('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x63f3('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x63f3('0x4')](_0x63f3('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x63f3('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x63f3('0x6'),'defaultValue':Sequelize['literal'](_0x63f3('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 77c469e..9ea0729 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 _0x6de1=['map','VoiceMailMessage','rawAttributes','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','count','status','set','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x6de1,0xd4));var _0x16de=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x6de1[_0x212a37];return _0x5d0bf9;};'use strict';var emlformat=require(_0x16de('0x0'));var rimraf=require(_0x16de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x16de('0x2'));var rp=require(_0x16de('0x3'));var moment=require(_0x16de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x16de('0x5'));var util=require(_0x16de('0x6'));var path=require(_0x16de('0x7'));var sox=require(_0x16de('0x8'));var csv=require(_0x16de('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x16de('0xa'));var _=require(_0x16de('0xb'));var squel=require(_0x16de('0xc'));var crypto=require(_0x16de('0xd'));var jsforce=require(_0x16de('0xe'));var deskjs=require(_0x16de('0xf'));var toCsv=require(_0x16de('0x9'));var querystring=require('querystring');var Papa=require(_0x16de('0x10'));var Redis=require(_0x16de('0x11'));var authService=require(_0x16de('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16de('0x13'));var logger=require(_0x16de('0x14'))(_0x16de('0x15'));var utils=require(_0x16de('0x16'));var config=require(_0x16de('0x17'));var licenseUtil=require(_0x16de('0x18'));var db=require(_0x16de('0x19'))['db'];function respondWithStatusCode(_0x2f0d12,_0x2ae853){_0x2ae853=_0x2ae853||0xcc;return function(_0x2f6c3c){if(_0x2f6c3c){return _0x2f0d12[_0x16de('0x1a')](_0x2ae853);}return _0x2f0d12['status'](_0x2ae853)[_0x16de('0x1b')]();};}function respondWithResult(_0x262086,_0x5eede8){_0x5eede8=_0x5eede8||0xc8;return function(_0x1f5da6){if(_0x1f5da6){return _0x262086['status'](_0x5eede8)[_0x16de('0x1c')](_0x1f5da6);}};}function respondWithFilteredResult(_0x304f4e,_0x2e15c3){return function(_0x2048f3){if(_0x2048f3){var _0x11c058=typeof _0x2e15c3[_0x16de('0x1d')]==='undefined'&&typeof _0x2e15c3['limit']==='undefined';var _0x430724=_0x2048f3[_0x16de('0x1e')];var _0x111e35=_0x11c058?0x0:_0x2e15c3[_0x16de('0x1d')];var _0x2f67a4=_0x11c058?_0x2048f3[_0x16de('0x1e')]:_0x2e15c3[_0x16de('0x1d')]+_0x2e15c3['limit'];var _0x2aaaaf;if(_0x2f67a4>=_0x430724){_0x2f67a4=_0x430724;_0x2aaaaf=0xc8;}else{_0x2aaaaf=0xce;}_0x304f4e[_0x16de('0x1f')](_0x2aaaaf);return _0x304f4e[_0x16de('0x20')]('Content-Range',_0x111e35+'-'+_0x2f67a4+'/'+_0x430724)[_0x16de('0x1c')](_0x2048f3);}return null;};}function patchUpdates(_0x2536e5){return function(_0xb690dc){try{jsonpatch['apply'](_0xb690dc,_0x2536e5,!![]);}catch(_0x51e3df){return BPromise[_0x16de('0x21')](_0x51e3df);}return _0xb690dc[_0x16de('0x22')]();};}function saveUpdates(_0x569b55,_0x2da1d9){return function(_0x11b8f2){if(_0x11b8f2){return _0x11b8f2[_0x16de('0x23')](_0x569b55)[_0x16de('0x24')](function(_0x53fd69){return _0x53fd69;});}return null;};}function removeEntity(_0x5c8fd4,_0x5c5109){return function(_0x3a93f6){if(_0x3a93f6){return _0x3a93f6[_0x16de('0x25')]()['then'](function(){_0x5c8fd4['status'](0xcc)[_0x16de('0x1b')]();});}};}function handleEntityNotFound(_0x116cfa,_0x1ffe79){return function(_0x4e6370){if(!_0x4e6370){_0x116cfa['sendStatus'](0x194);}return _0x4e6370;};}function handleError(_0x219419,_0x2abdc5){_0x2abdc5=_0x2abdc5||0x1f4;return function(_0xa0128d){logger[_0x16de('0x26')](_0xa0128d[_0x16de('0x27')]);if(_0xa0128d[_0x16de('0x28')]){delete _0xa0128d[_0x16de('0x28')];}_0x219419[_0x16de('0x1f')](_0x2abdc5)[_0x16de('0x29')](_0xa0128d);};}exports[_0x16de('0x2a')]=function(_0x173407,_0x55663b){var _0x4f1549={},_0x41a8dd={},_0x35b038={'count':0x0,'rows':[]};var _0x302730=_[_0x16de('0x2b')](db[_0x16de('0x2c')][_0x16de('0x2d')],function(_0x2c335c){return{'name':_0x2c335c['fieldName'],'type':_0x2c335c['type'][_0x16de('0x2e')]};});_0x41a8dd[_0x16de('0x2f')]=_[_0x16de('0x30')](_[_0x16de('0x2b')](_0x302730,_0x16de('0x28')),[_0x16de('0x28')]);_0x41a8dd[_0x16de('0x31')]=_[_0x16de('0x32')](_0x173407[_0x16de('0x31')]);_0x41a8dd[_0x16de('0x33')]=_[_0x16de('0x34')](_0x41a8dd[_0x16de('0x2f')],_0x41a8dd[_0x16de('0x31')]);_0x4f1549[_0x16de('0x35')]=_['intersection'](_0x41a8dd['model'],qs[_0x16de('0x36')](_0x173407[_0x16de('0x31')]['fields']));_0x4f1549[_0x16de('0x35')]=_0x4f1549[_0x16de('0x35')][_0x16de('0x37')]?_0x4f1549[_0x16de('0x35')]:_0x41a8dd[_0x16de('0x2f')];if(!_0x173407[_0x16de('0x31')][_0x16de('0x38')](_0x16de('0x39'))){_0x4f1549[_0x16de('0x3a')]=qs['limit'](_0x173407[_0x16de('0x31')][_0x16de('0x3a')]);_0x4f1549['offset']=qs[_0x16de('0x1d')](_0x173407[_0x16de('0x31')][_0x16de('0x1d')]);}_0x4f1549[_0x16de('0x3b')]=qs[_0x16de('0x3c')](_0x173407[_0x16de('0x31')][_0x16de('0x3c')]);_0x4f1549[_0x16de('0x3d')]=qs[_0x16de('0x33')](_[_0x16de('0x3e')](_0x173407['query'],_0x41a8dd[_0x16de('0x33')]),_0x302730);if(_0x173407[_0x16de('0x31')][_0x16de('0x3f')]){_0x4f1549[_0x16de('0x3d')]=_[_0x16de('0x40')](_0x4f1549[_0x16de('0x3d')],{'$or':_[_0x16de('0x2b')](_0x302730,function(_0x500c80){if(_0x500c80[_0x16de('0x41')]!==_0x16de('0x42')){var _0x483ec2={};_0x483ec2[_0x500c80[_0x16de('0x28')]]={'$like':'%'+_0x173407[_0x16de('0x31')][_0x16de('0x3f')]+'%'};return _0x483ec2;}})});}_0x4f1549=_[_0x16de('0x40')]({},_0x4f1549,_0x173407[_0x16de('0x43')]);var _0x3720db={'where':_0x4f1549[_0x16de('0x3d')]};return db[_0x16de('0x2c')][_0x16de('0x1e')](_0x3720db)[_0x16de('0x24')](function(_0x37806d){_0x35b038[_0x16de('0x1e')]=_0x37806d;if(_0x173407[_0x16de('0x31')][_0x16de('0x44')]){_0x4f1549['include']=[{'all':!![]}];}return db[_0x16de('0x2c')][_0x16de('0x45')](_0x4f1549);})[_0x16de('0x24')](function(_0x168194){_0x35b038[_0x16de('0x46')]=_0x168194;return _0x35b038;})[_0x16de('0x24')](respondWithFilteredResult(_0x55663b,_0x4f1549))[_0x16de('0x47')](handleError(_0x55663b,null));};exports[_0x16de('0x48')]=function(_0x53dae1,_0x3783ff){var _0x221b4d={'raw':!![],'where':{'id':_0x53dae1[_0x16de('0x49')]['id']}},_0x2acc52={};_0x2acc52[_0x16de('0x2f')]=_[_0x16de('0x32')](db['VoiceMailMessage'][_0x16de('0x2d')]);_0x2acc52[_0x16de('0x31')]=_[_0x16de('0x32')](_0x53dae1[_0x16de('0x31')]);_0x2acc52[_0x16de('0x33')]=_[_0x16de('0x34')](_0x2acc52[_0x16de('0x2f')],_0x2acc52['query']);_0x221b4d['attributes']=_[_0x16de('0x34')](_0x2acc52[_0x16de('0x2f')],qs['fields'](_0x53dae1['query']['fields']));_0x221b4d[_0x16de('0x35')]=_0x221b4d[_0x16de('0x35')]['length']?_0x221b4d['attributes']:_0x2acc52[_0x16de('0x2f')];if(_0x53dae1[_0x16de('0x31')][_0x16de('0x44')]){_0x221b4d[_0x16de('0x4a')]=[{'all':!![]}];}_0x221b4d=_[_0x16de('0x40')]({},_0x221b4d,_0x53dae1[_0x16de('0x43')]);return db[_0x16de('0x2c')][_0x16de('0x4b')](_0x221b4d)['then'](handleEntityNotFound(_0x3783ff,null))[_0x16de('0x24')](respondWithResult(_0x3783ff,null))[_0x16de('0x47')](handleError(_0x3783ff,null));};exports[_0x16de('0x4c')]=function(_0x32be2e,_0x41c32f){return db[_0x16de('0x2c')][_0x16de('0x4c')](_0x32be2e['body'],{})[_0x16de('0x24')](respondWithResult(_0x41c32f,0xc9))[_0x16de('0x47')](handleError(_0x41c32f,null));};exports[_0x16de('0x23')]=function(_0x591ef0,_0x4102e0){if(_0x591ef0[_0x16de('0x4d')]['id']){delete _0x591ef0[_0x16de('0x4d')]['id'];}return db[_0x16de('0x2c')]['find']({'where':{'id':_0x591ef0[_0x16de('0x49')]['id']}})['then'](handleEntityNotFound(_0x4102e0,null))[_0x16de('0x24')](saveUpdates(_0x591ef0[_0x16de('0x4d')],null))['then'](respondWithResult(_0x4102e0,null))[_0x16de('0x47')](handleError(_0x4102e0,null));};exports[_0x16de('0x25')]=function(_0x14e668,_0x58e6e7){return db[_0x16de('0x2c')][_0x16de('0x4b')]({'where':{'id':_0x14e668[_0x16de('0x49')]['id']}})[_0x16de('0x24')](handleEntityNotFound(_0x58e6e7,null))['then'](removeEntity(_0x58e6e7,null))[_0x16de('0x47')](handleError(_0x58e6e7,null));};exports[_0x16de('0x4e')]=function(_0x3d6e43,_0x36938e,_0x13e79a){return db[_0x16de('0x2c')][_0x16de('0x4b')]({'where':{'id':_0x3d6e43[_0x16de('0x49')]['id']},'attributes':['id','recording',_0x16de('0x4f')]})[_0x16de('0x24')](handleEntityNotFound(_0x36938e,null))['then'](function(_0x5c5050){if(_0x5c5050){if(!_0x5c5050[_0x16de('0x50')]){throw new db['Sequelize'][(_0x16de('0x51'))](_0x16de('0x52'));}var _0x4e0e00={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x5c5050[_0x16de('0x4f')]){_0x4e0e00[_0x16de('0x53')]=_0x16de('0x54')+_0x5c5050[_0x16de('0x4f')]+'.wav\x22';}_0x36938e[_0x16de('0x20')](_0x4e0e00);return _0x36938e[_0x16de('0x29')](new Buffer(_0x5c5050[_0x16de('0x50')]));}})[_0x16de('0x47')](handleError(_0x36938e,null));}; \ No newline at end of file +var _0x07dd=['keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','set','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query'];(function(_0x35c57f,_0x1af110){var _0x2dc039=function(_0x16e149){while(--_0x16e149){_0x35c57f['push'](_0x35c57f['shift']());}};_0x2dc039(++_0x1af110);}(_0x07dd,0xc0));var _0xd07d=function(_0x436be4,_0x3939fb){_0x436be4=_0x436be4-0x0;var _0x1330c3=_0x07dd[_0x436be4];return _0x1330c3;};'use strict';var emlformat=require(_0xd07d('0x0'));var rimraf=require(_0xd07d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd07d('0x2'));var rp=require(_0xd07d('0x3'));var moment=require('moment');var BPromise=require(_0xd07d('0x4'));var Mustache=require(_0xd07d('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd07d('0x6'));var csv=require('to-csv');var ejs=require(_0xd07d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd07d('0x8'));var squel=require('squel');var crypto=require(_0xd07d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd07d('0xa'));var toCsv=require(_0xd07d('0xb'));var querystring=require('querystring');var Papa=require(_0xd07d('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd07d('0xd'));var hardwareService=require(_0xd07d('0xe'));var logger=require(_0xd07d('0xf'))(_0xd07d('0x10'));var utils=require('../../config/utils');var config=require(_0xd07d('0x11'));var licenseUtil=require(_0xd07d('0x12'));var db=require(_0xd07d('0x13'))['db'];function respondWithStatusCode(_0x453144,_0x52260f){_0x52260f=_0x52260f||0xcc;return function(_0x7a4108){if(_0x7a4108){return _0x453144[_0xd07d('0x14')](_0x52260f);}return _0x453144[_0xd07d('0x15')](_0x52260f)[_0xd07d('0x16')]();};}function respondWithResult(_0xc7d740,_0x34bdbe){_0x34bdbe=_0x34bdbe||0xc8;return function(_0x220b7f){if(_0x220b7f){return _0xc7d740[_0xd07d('0x15')](_0x34bdbe)[_0xd07d('0x17')](_0x220b7f);}};}function respondWithFilteredResult(_0x1129fc,_0x18225a){return function(_0x1cf01f){if(_0x1cf01f){var _0x3863fd=typeof _0x18225a['offset']===_0xd07d('0x18')&&typeof _0x18225a[_0xd07d('0x19')]===_0xd07d('0x18');var _0x145284=_0x1cf01f[_0xd07d('0x1a')];var _0x41d8b0=_0x3863fd?0x0:_0x18225a[_0xd07d('0x1b')];var _0x54f2ce=_0x3863fd?_0x1cf01f[_0xd07d('0x1a')]:_0x18225a['offset']+_0x18225a[_0xd07d('0x19')];var _0x2155e2;if(_0x54f2ce>=_0x145284){_0x54f2ce=_0x145284;_0x2155e2=0xc8;}else{_0x2155e2=0xce;}_0x1129fc[_0xd07d('0x15')](_0x2155e2);return _0x1129fc['set']('Content-Range',_0x41d8b0+'-'+_0x54f2ce+'/'+_0x145284)[_0xd07d('0x17')](_0x1cf01f);}return null;};}function patchUpdates(_0xbebb8f){return function(_0x17e456){try{jsonpatch[_0xd07d('0x1c')](_0x17e456,_0xbebb8f,!![]);}catch(_0x2bce7f){return BPromise[_0xd07d('0x1d')](_0x2bce7f);}return _0x17e456[_0xd07d('0x1e')]();};}function saveUpdates(_0x4237db,_0x1f1c53){return function(_0x4aad93){if(_0x4aad93){return _0x4aad93[_0xd07d('0x1f')](_0x4237db)['then'](function(_0x46af55){return _0x46af55;});}return null;};}function removeEntity(_0x69db0d,_0x34ccbf){return function(_0xd24ecb){if(_0xd24ecb){return _0xd24ecb['destroy']()[_0xd07d('0x20')](function(){_0x69db0d[_0xd07d('0x15')](0xcc)[_0xd07d('0x16')]();});}};}function handleEntityNotFound(_0x8bf8a7,_0x8472c9){return function(_0x5901fd){if(!_0x5901fd){_0x8bf8a7[_0xd07d('0x14')](0x194);}return _0x5901fd;};}function handleError(_0x479a00,_0x344d15){_0x344d15=_0x344d15||0x1f4;return function(_0x32ab00){logger[_0xd07d('0x21')](_0x32ab00['stack']);if(_0x32ab00[_0xd07d('0x22')]){delete _0x32ab00[_0xd07d('0x22')];}_0x479a00['status'](_0x344d15)[_0xd07d('0x23')](_0x32ab00);};}exports[_0xd07d('0x24')]=function(_0x5dcc2e,_0x33f774){var _0x1c9338={},_0x3fa545={},_0x2dc132={'count':0x0,'rows':[]};var _0x287d45=_[_0xd07d('0x25')](db[_0xd07d('0x26')][_0xd07d('0x27')],function(_0x175da3){return{'name':_0x175da3['fieldName'],'type':_0x175da3[_0xd07d('0x28')][_0xd07d('0x29')]};});_0x3fa545[_0xd07d('0x2a')]=_[_0xd07d('0x2b')](_['map'](_0x287d45,'name'),[_0xd07d('0x22')]);_0x3fa545[_0xd07d('0x2c')]=_[_0xd07d('0x2d')](_0x5dcc2e[_0xd07d('0x2c')]);_0x3fa545[_0xd07d('0x2e')]=_[_0xd07d('0x2f')](_0x3fa545[_0xd07d('0x2a')],_0x3fa545[_0xd07d('0x2c')]);_0x1c9338[_0xd07d('0x30')]=_['intersection'](_0x3fa545[_0xd07d('0x2a')],qs['fields'](_0x5dcc2e[_0xd07d('0x2c')][_0xd07d('0x31')]));_0x1c9338[_0xd07d('0x30')]=_0x1c9338[_0xd07d('0x30')]['length']?_0x1c9338[_0xd07d('0x30')]:_0x3fa545[_0xd07d('0x2a')];if(!_0x5dcc2e['query']['hasOwnProperty'](_0xd07d('0x32'))){_0x1c9338[_0xd07d('0x19')]=qs['limit'](_0x5dcc2e[_0xd07d('0x2c')]['limit']);_0x1c9338[_0xd07d('0x1b')]=qs[_0xd07d('0x1b')](_0x5dcc2e[_0xd07d('0x2c')][_0xd07d('0x1b')]);}_0x1c9338[_0xd07d('0x33')]=qs[_0xd07d('0x34')](_0x5dcc2e[_0xd07d('0x2c')][_0xd07d('0x34')]);_0x1c9338[_0xd07d('0x35')]=qs['filters'](_[_0xd07d('0x36')](_0x5dcc2e['query'],_0x3fa545['filters']),_0x287d45);if(_0x5dcc2e['query']['filter']){_0x1c9338[_0xd07d('0x35')]=_[_0xd07d('0x37')](_0x1c9338['where'],{'$or':_[_0xd07d('0x25')](_0x287d45,function(_0x1b18b7){if(_0x1b18b7[_0xd07d('0x28')]!==_0xd07d('0x38')){var _0x373bf8={};_0x373bf8[_0x1b18b7['name']]={'$like':'%'+_0x5dcc2e[_0xd07d('0x2c')][_0xd07d('0x39')]+'%'};return _0x373bf8;}})});}_0x1c9338=_[_0xd07d('0x37')]({},_0x1c9338,_0x5dcc2e['options']);var _0x309608={'where':_0x1c9338['where']};return db[_0xd07d('0x26')][_0xd07d('0x1a')](_0x309608)['then'](function(_0x47d555){_0x2dc132['count']=_0x47d555;if(_0x5dcc2e[_0xd07d('0x2c')][_0xd07d('0x3a')]){_0x1c9338[_0xd07d('0x3b')]=[{'all':!![]}];}return db[_0xd07d('0x26')][_0xd07d('0x3c')](_0x1c9338);})[_0xd07d('0x20')](function(_0x3c3cde){_0x2dc132[_0xd07d('0x3d')]=_0x3c3cde;return _0x2dc132;})['then'](respondWithFilteredResult(_0x33f774,_0x1c9338))[_0xd07d('0x3e')](handleError(_0x33f774,null));};exports[_0xd07d('0x3f')]=function(_0x4fcc26,_0x22cb40){var _0x466860={'raw':!![],'where':{'id':_0x4fcc26[_0xd07d('0x40')]['id']}},_0x333c04={};_0x333c04[_0xd07d('0x2a')]=_[_0xd07d('0x2d')](db[_0xd07d('0x26')][_0xd07d('0x27')]);_0x333c04[_0xd07d('0x2c')]=_[_0xd07d('0x2d')](_0x4fcc26[_0xd07d('0x2c')]);_0x333c04[_0xd07d('0x2e')]=_[_0xd07d('0x2f')](_0x333c04[_0xd07d('0x2a')],_0x333c04[_0xd07d('0x2c')]);_0x466860[_0xd07d('0x30')]=_[_0xd07d('0x2f')](_0x333c04[_0xd07d('0x2a')],qs[_0xd07d('0x31')](_0x4fcc26['query'][_0xd07d('0x31')]));_0x466860[_0xd07d('0x30')]=_0x466860[_0xd07d('0x30')][_0xd07d('0x41')]?_0x466860[_0xd07d('0x30')]:_0x333c04[_0xd07d('0x2a')];if(_0x4fcc26[_0xd07d('0x2c')][_0xd07d('0x3a')]){_0x466860[_0xd07d('0x3b')]=[{'all':!![]}];}_0x466860=_['merge']({},_0x466860,_0x4fcc26['options']);return db[_0xd07d('0x26')][_0xd07d('0x42')](_0x466860)[_0xd07d('0x20')](handleEntityNotFound(_0x22cb40,null))[_0xd07d('0x20')](respondWithResult(_0x22cb40,null))[_0xd07d('0x3e')](handleError(_0x22cb40,null));};exports[_0xd07d('0x43')]=function(_0x18f061,_0x5d3375){return db[_0xd07d('0x26')][_0xd07d('0x43')](_0x18f061[_0xd07d('0x44')],{})[_0xd07d('0x20')](respondWithResult(_0x5d3375,0xc9))[_0xd07d('0x3e')](handleError(_0x5d3375,null));};exports[_0xd07d('0x1f')]=function(_0x1368ad,_0x2fcc40){if(_0x1368ad[_0xd07d('0x44')]['id']){delete _0x1368ad[_0xd07d('0x44')]['id'];}return db['VoiceMailMessage'][_0xd07d('0x42')]({'where':{'id':_0x1368ad[_0xd07d('0x40')]['id']}})['then'](handleEntityNotFound(_0x2fcc40,null))[_0xd07d('0x20')](saveUpdates(_0x1368ad[_0xd07d('0x44')],null))['then'](respondWithResult(_0x2fcc40,null))[_0xd07d('0x3e')](handleError(_0x2fcc40,null));};exports[_0xd07d('0x45')]=function(_0x27803b,_0xb45dd0){return db[_0xd07d('0x26')][_0xd07d('0x42')]({'where':{'id':_0x27803b['params']['id']}})[_0xd07d('0x20')](handleEntityNotFound(_0xb45dd0,null))[_0xd07d('0x20')](removeEntity(_0xb45dd0,null))[_0xd07d('0x3e')](handleError(_0xb45dd0,null));};exports[_0xd07d('0x46')]=function(_0x12f74b,_0x1328db,_0x25d17b){return db[_0xd07d('0x26')][_0xd07d('0x42')]({'where':{'id':_0x12f74b[_0xd07d('0x40')]['id']},'attributes':['id',_0xd07d('0x47'),'msg_id']})[_0xd07d('0x20')](handleEntityNotFound(_0x1328db,null))['then'](function(_0x63ce8d){if(_0x63ce8d){if(!_0x63ce8d['recording']){throw new db[(_0xd07d('0x48'))]['ValidationError'](_0xd07d('0x49'));}var _0x52a009={'Content-Type':_0xd07d('0x4a'),'Content-Disposition':_0xd07d('0x4b')};if(_0x63ce8d[_0xd07d('0x4c')]){_0x52a009[_0xd07d('0x4d')]='attachment;\x20filename=\x22'+_0x63ce8d[_0xd07d('0x4c')]+'.wav\x22';}_0x1328db[_0xd07d('0x4e')](_0x52a009);return _0x1328db['send'](new Buffer(_0x63ce8d[_0xd07d('0x47')]));}})[_0xd07d('0x3e')](handleError(_0x1328db,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ae73916..c024595 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 _0x5da6=['request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x35ed1a,_0x57d996){var _0x12f640=function(_0xb1fef2){while(--_0xb1fef2){_0x35ed1a['push'](_0x35ed1a['shift']());}};_0x12f640(++_0x57d996);}(_0x5da6,0x124));var _0x65da=function(_0x5d1696,_0x1a2f5b){_0x5d1696=_0x5d1696-0x0;var _0x49d673=_0x5da6[_0x5d1696];return _0x49d673;};'use strict';var _=require(_0x65da('0x0'));var util=require(_0x65da('0x1'));var logger=require(_0x65da('0x2'))(_0x65da('0x3'));var moment=require(_0x65da('0x4'));var BPromise=require('bluebird');var rp=require(_0x65da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65da('0x6'));var config=require(_0x65da('0x7'));var attributes=require(_0x65da('0x8'));module['exports']=function(_0x77ba9c,_0x19e757){return _0x77ba9c['define']('VoiceMailMessage',attributes,{'tableName':_0x65da('0x9'),'paranoid':![],'indexes':[{'name':_0x65da('0xa'),'fields':[_0x65da('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb69f=['moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0xb69f,0x1e7));var _0xfb69=function(_0x4198b6,_0x3662a9){_0x4198b6=_0x4198b6-0x0;var _0x2dc860=_0xb69f[_0x4198b6];return _0x2dc860;};'use strict';var _=require(_0xfb69('0x0'));var util=require('util');var logger=require(_0xfb69('0x1'))(_0xfb69('0x2'));var moment=require(_0xfb69('0x3'));var BPromise=require(_0xfb69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb69('0x5'));var rimraf=require(_0xfb69('0x6'));var config=require(_0xfb69('0x7'));var attributes=require(_0xfb69('0x8'));module[_0xfb69('0x9')]=function(_0x3138e2,_0x351cee){return _0x3138e2[_0xfb69('0xa')](_0xfb69('0xb'),attributes,{'tableName':_0xfb69('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xfb69('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0cbd4ff..e9920e8 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 _0x8b69=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3c0583,_0x406a6d){var _0x2ec458=function(_0x574725){while(--_0x574725){_0x3c0583['push'](_0x3c0583['shift']());}};_0x2ec458(++_0x406a6d);}(_0x8b69,0x1e6));var _0x98b6=function(_0x22cebb,_0x3265e2){_0x22cebb=_0x22cebb-0x0;var _0x32f4cd=_0x8b69[_0x22cebb];return _0x32f4cd;};'use strict';var _=require('lodash');var util=require(_0x98b6('0x0'));var moment=require(_0x98b6('0x1'));var BPromise=require(_0x98b6('0x2'));var rs=require(_0x98b6('0x3'));var fs=require('fs');var Redis=require(_0x98b6('0x4'));var db=require(_0x98b6('0x5'))['db'];var utils=require(_0x98b6('0x6'));var logger=require(_0x98b6('0x7'))('rpc');var config=require(_0x98b6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98b6('0x9')][_0x98b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fcddc,_0x4946f1,_0x3c5509){return new BPromise(function(_0x31055a,_0x27e8c8){return client[_0x98b6('0xb')](_0x3fcddc,_0x3c5509)[_0x98b6('0xc')](function(_0x44316e){logger[_0x98b6('0xd')](_0x98b6('0xe'),_0x4946f1,_0x98b6('0xf'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4946f1,_0x98b6('0xf'),JSON[_0x98b6('0x10')](_0x44316e));if(_0x44316e[_0x98b6('0x11')]){if(_0x44316e[_0x98b6('0x11')][_0x98b6('0x12')]===0x1f4){logger[_0x98b6('0x11')](_0x98b6('0xe'),_0x4946f1,_0x44316e[_0x98b6('0x11')][_0x98b6('0x13')]);return _0x27e8c8(_0x44316e[_0x98b6('0x11')][_0x98b6('0x13')]);}logger['error'](_0x98b6('0xe'),_0x4946f1,_0x44316e[_0x98b6('0x11')][_0x98b6('0x13')]);return _0x31055a(_0x44316e[_0x98b6('0x11')]['message']);}else{logger['info'](_0x98b6('0xe'),_0x4946f1,'request\x20sent');_0x31055a(_0x44316e[_0x98b6('0x14')]['message']);}})[_0x98b6('0x15')](function(_0x5704a9){logger['error'](_0x98b6('0xe'),_0x4946f1,_0x5704a9);_0x27e8c8(_0x5704a9);});});} \ No newline at end of file +var _0x9829=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x5356ab,_0xe1a471){var _0x366faa=function(_0x422329){while(--_0x422329){_0x5356ab['push'](_0x5356ab['shift']());}};_0x366faa(++_0xe1a471);}(_0x9829,0x1b1));var _0x9982=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0x9829[_0x237f8b];return _0x423f94;};'use strict';var _=require('lodash');var util=require(_0x9982('0x0'));var moment=require(_0x9982('0x1'));var BPromise=require(_0x9982('0x2'));var rs=require(_0x9982('0x3'));var fs=require('fs');var Redis=require(_0x9982('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9982('0x5'))(_0x9982('0x6'));var config=require(_0x9982('0x7'));var jayson=require(_0x9982('0x8'));var client=jayson[_0x9982('0x9')][_0x9982('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41db9e,_0x4996b0,_0x10b236){return new BPromise(function(_0x1d77d2,_0x1b4b62){return client[_0x9982('0xb')](_0x41db9e,_0x10b236)[_0x9982('0xc')](function(_0x53ed2a){logger[_0x9982('0xd')](_0x9982('0xe'),_0x4996b0,_0x9982('0xf'));logger[_0x9982('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4996b0,'request\x20sent',JSON[_0x9982('0x11')](_0x53ed2a));if(_0x53ed2a[_0x9982('0x12')]){if(_0x53ed2a[_0x9982('0x12')][_0x9982('0x13')]===0x1f4){logger[_0x9982('0x12')](_0x9982('0xe'),_0x4996b0,_0x53ed2a[_0x9982('0x12')][_0x9982('0x14')]);return _0x1b4b62(_0x53ed2a[_0x9982('0x12')][_0x9982('0x14')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4996b0,_0x53ed2a[_0x9982('0x12')][_0x9982('0x14')]);return _0x1d77d2(_0x53ed2a['error'][_0x9982('0x14')]);}else{logger[_0x9982('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x4996b0,_0x9982('0xf'));_0x1d77d2(_0x53ed2a['result']['message']);}})[_0x9982('0x15')](function(_0xeab547){logger[_0x9982('0x12')](_0x9982('0xe'),_0x4996b0,_0xeab547);_0x1b4b62(_0xeab547);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 85a4b1a..70f43ff 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 _0xfcea=['destroy','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','/:id','show','get','/:id/sounds','getSounds','post','addSound','put','update','delete'];(function(_0x28e4ec,_0x22f691){var _0x161a64=function(_0x4214c6){while(--_0x4214c6){_0x28e4ec['push'](_0x28e4ec['shift']());}};_0x161a64(++_0x22f691);}(_0xfcea,0x1b9));var _0xafce=function(_0x2b72fe,_0x5b98b0){_0x2b72fe=_0x2b72fe-0x0;var _0x463d0a=_0xfcea[_0x2b72fe];return _0x463d0a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xafce('0x0'));var timeout=require(_0xafce('0x1'));var express=require(_0xafce('0x2'));var router=express[_0xafce('0x3')]();var fs_extra=require(_0xafce('0x4'));var auth=require(_0xafce('0x5'));var interaction=require(_0xafce('0x6'));var config=require('../../config/environment');var controller=require(_0xafce('0x7'));router['get']('/',auth[_0xafce('0x8')](),controller['index']);router['get'](_0xafce('0x9'),auth[_0xafce('0x8')](),controller[_0xafce('0xa')]);router[_0xafce('0xb')](_0xafce('0xc'),auth[_0xafce('0x8')](),controller[_0xafce('0xd')]);router[_0xafce('0xe')]('/',auth[_0xafce('0x8')](),controller['create']);router['post'](_0xafce('0xc'),auth[_0xafce('0x8')](),controller[_0xafce('0xf')]);router[_0xafce('0x10')](_0xafce('0x9'),auth['isAuthenticated'](),controller[_0xafce('0x11')]);router[_0xafce('0x12')](_0xafce('0x9'),auth[_0xafce('0x8')](),controller[_0xafce('0x13')]);router[_0xafce('0x12')](_0xafce('0x14'),auth[_0xafce('0x8')](),controller[_0xafce('0x15')]);module[_0xafce('0x16')]=router; \ No newline at end of file +var _0x6183=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6183,0x1f4));var _0x3618=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0x6183[_0x838813];return _0x2bd32d;};'use strict';var multer=require(_0x3618('0x0'));var util=require(_0x3618('0x1'));var path=require('path');var timeout=require(_0x3618('0x2'));var express=require(_0x3618('0x3'));var router=express[_0x3618('0x4')]();var fs_extra=require(_0x3618('0x5'));var auth=require(_0x3618('0x6'));var interaction=require(_0x3618('0x7'));var config=require(_0x3618('0x8'));var controller=require(_0x3618('0x9'));router['get']('/',auth[_0x3618('0xa')](),controller['index']);router[_0x3618('0xb')](_0x3618('0xc'),auth['isAuthenticated'](),controller[_0x3618('0xd')]);router['get']('/:id/sounds',auth[_0x3618('0xa')](),controller[_0x3618('0xe')]);router[_0x3618('0xf')]('/',auth[_0x3618('0xa')](),controller[_0x3618('0x10')]);router['post'](_0x3618('0x11'),auth[_0x3618('0xa')](),controller[_0x3618('0x12')]);router[_0x3618('0x13')](_0x3618('0xc'),auth['isAuthenticated'](),controller[_0x3618('0x14')]);router[_0x3618('0x15')](_0x3618('0xc'),auth[_0x3618('0xa')](),controller['destroy']);router[_0x3618('0x15')](_0x3618('0x16'),auth[_0x3618('0xa')](),controller[_0x3618('0x17')]);module[_0x3618('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 6d4b5d7..291bdf9 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 _0x93dd=['exports','STRING','name','ENUM','custom','files','quietmp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x247b5e,_0x4e0735){var _0x281873=function(_0x36e0ed){while(--_0x36e0ed){_0x247b5e['push'](_0x247b5e['shift']());}};_0x281873(++_0x4e0735);}(_0x93dd,0x173));var _0xd93d=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x93dd[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0xd93d('0x0'));module[_0xd93d('0x1')]={'name':{'type':Sequelize[_0xd93d('0x2')],'allowNull':![],'unique':_0xd93d('0x3')},'mode':{'type':Sequelize[_0xd93d('0x4')](_0xd93d('0x5'),_0xd93d('0x6'),'mp3nb',_0xd93d('0x7'),_0xd93d('0x8'),_0xd93d('0x9')),'allowNull':!![],'defaultValue':_0xd93d('0x6')},'directory':{'type':Sequelize[_0xd93d('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xd93d('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd93d('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xd93d('0x2')],'allowNull':!![]},'stamp':{'type':_0xd93d('0xa')},'defaultEntry':{'type':Sequelize[_0xd93d('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x89c0=['name','ENUM','files','mp3nb','quietmp3nb','alpha','BOOLEAN','sequelize','exports','STRING'];(function(_0x4a2962,_0x4bc0af){var _0x4afe6e=function(_0x45fe93){while(--_0x45fe93){_0x4a2962['push'](_0x4a2962['shift']());}};_0x4afe6e(++_0x4bc0af);}(_0x89c0,0x13d));var _0x089c=function(_0x160bed,_0xa36ed9){_0x160bed=_0x160bed-0x0;var _0x4dfc6e=_0x89c0[_0x160bed];return _0x4dfc6e;};'use strict';var Sequelize=require(_0x089c('0x0'));module[_0x089c('0x1')]={'name':{'type':Sequelize[_0x089c('0x2')],'allowNull':![],'unique':_0x089c('0x3')},'mode':{'type':Sequelize[_0x089c('0x4')]('custom',_0x089c('0x5'),_0x089c('0x6'),_0x089c('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x089c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x089c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x089c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x089c('0x2')],'allowNull':!![],'defaultValue':_0x089c('0x8')},'format':{'type':Sequelize[_0x089c('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x089c('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 99cb6a7..0f38291 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 _0x2f91=['id2','unlinkSync','order','getSounds','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','filter','merge','options','includeAll','rows','catch','show','params','include','find','update','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','UserProfileResource','error','forEach','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','ValidationError','removeSound'];(function(_0x2e7d64,_0x22215c){var _0x4626b1=function(_0x5c827e){while(--_0x5c827e){_0x2e7d64['push'](_0x2e7d64['shift']());}};_0x4626b1(++_0x22215c);}(_0x2f91,0x1cd));var _0x12f9=function(_0x1c92e7,_0xee3ba3){_0x1c92e7=_0x1c92e7-0x0;var _0x3be7e7=_0x2f91[_0x1c92e7];return _0x3be7e7;};'use strict';var emlformat=require(_0x12f9('0x0'));var rimraf=require(_0x12f9('0x1'));var zipdir=require(_0x12f9('0x2'));var jsonpatch=require(_0x12f9('0x3'));var rp=require('request-promise');var moment=require(_0x12f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x12f9('0x5'));var util=require(_0x12f9('0x6'));var path=require(_0x12f9('0x7'));var sox=require(_0x12f9('0x8'));var csv=require(_0x12f9('0x9'));var ejs=require(_0x12f9('0xa'));var fs=require('fs');var fs_extra=require(_0x12f9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x12f9('0xc'));var jsforce=require(_0x12f9('0xd'));var deskjs=require(_0x12f9('0xe'));var toCsv=require(_0x12f9('0x9'));var querystring=require('querystring');var Papa=require(_0x12f9('0xf'));var Redis=require(_0x12f9('0x10'));var authService=require(_0x12f9('0x11'));var qs=require(_0x12f9('0x12'));var as=require(_0x12f9('0x13'));var hardwareService=require(_0x12f9('0x14'));var logger=require(_0x12f9('0x15'))(_0x12f9('0x16'));var utils=require(_0x12f9('0x17'));var config=require(_0x12f9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x12f9('0x19'))['db'];function respondWithStatusCode(_0x54a6d6,_0x1a1ad3){_0x1a1ad3=_0x1a1ad3||0xcc;return function(_0x3ad1c7){if(_0x3ad1c7){return _0x54a6d6['sendStatus'](_0x1a1ad3);}return _0x54a6d6['status'](_0x1a1ad3)[_0x12f9('0x1a')]();};}function respondWithResult(_0x29f525,_0x20a64c){_0x20a64c=_0x20a64c||0xc8;return function(_0x3125c6){if(_0x3125c6){return _0x29f525['status'](_0x20a64c)[_0x12f9('0x1b')](_0x3125c6);}};}function respondWithFilteredResult(_0x3f6414,_0x5637bc){return function(_0x54ea06){if(_0x54ea06){var _0x4aaf10=typeof _0x5637bc['offset']===_0x12f9('0x1c')&&typeof _0x5637bc['limit']===_0x12f9('0x1c');var _0x44d6f2=_0x54ea06[_0x12f9('0x1d')];var _0x58720f=_0x4aaf10?0x0:_0x5637bc[_0x12f9('0x1e')];var _0x1fe55f=_0x4aaf10?_0x54ea06[_0x12f9('0x1d')]:_0x5637bc[_0x12f9('0x1e')]+_0x5637bc[_0x12f9('0x1f')];var _0xcfd869;if(_0x1fe55f>=_0x44d6f2){_0x1fe55f=_0x44d6f2;_0xcfd869=0xc8;}else{_0xcfd869=0xce;}_0x3f6414[_0x12f9('0x20')](_0xcfd869);return _0x3f6414[_0x12f9('0x21')](_0x12f9('0x22'),_0x58720f+'-'+_0x1fe55f+'/'+_0x44d6f2)[_0x12f9('0x1b')](_0x54ea06);}return null;};}function patchUpdates(_0x52814b){return function(_0x3c89a6){try{jsonpatch[_0x12f9('0x23')](_0x3c89a6,_0x52814b,!![]);}catch(_0xdf8d11){return BPromise['reject'](_0xdf8d11);}return _0x3c89a6['save']();};}function saveUpdates(_0x4572c9,_0x1f4c6b){return function(_0x331ae0){if(_0x331ae0){return _0x331ae0['update'](_0x4572c9)[_0x12f9('0x24')](function(_0x5926db){return _0x5926db;});}return null;};}function removeEntity(_0x69645f,_0x1a6a5b){return function(_0x20e286){if(_0x20e286){return _0x20e286[_0x12f9('0x25')]()['then'](function(){var _0x79b14e=_0x20e286['get']({'plain':!![]});var _0xad7cc4='MusicOnHolds';return db['UserProfileResource']['destroy']({'where':{'type':_0xad7cc4,'resourceId':_0x79b14e['id']}})[_0x12f9('0x24')](function(){return _0x20e286;});})['then'](function(){_0x69645f[_0x12f9('0x20')](0xcc)[_0x12f9('0x1a')]();});}};}function handleEntityNotFound(_0x4100b8,_0x2df43e){return function(_0x345d9e){if(!_0x345d9e){_0x4100b8[_0x12f9('0x26')](0x194);}return _0x345d9e;};}function handleError(_0x547ac1,_0x4799ee){_0x4799ee=_0x4799ee||0x1f4;return function(_0x830a6c){logger['error'](_0x830a6c[_0x12f9('0x27')]);if(_0x830a6c[_0x12f9('0x28')]){delete _0x830a6c[_0x12f9('0x28')];}_0x547ac1[_0x12f9('0x20')](_0x4799ee)[_0x12f9('0x29')](_0x830a6c);};}exports[_0x12f9('0x2a')]=function(_0x210ac0,_0x5e0f21){var _0x3cf425={},_0xcfa81b={},_0x1efbdc={'count':0x0,'rows':[]};var _0x2d2612=_[_0x12f9('0x2b')](db[_0x12f9('0x2c')][_0x12f9('0x2d')],function(_0x115596){return{'name':_0x115596[_0x12f9('0x2e')],'type':_0x115596[_0x12f9('0x2f')][_0x12f9('0x30')]};});_0xcfa81b[_0x12f9('0x31')]=_[_0x12f9('0x2b')](_0x2d2612,_0x12f9('0x28'));_0xcfa81b[_0x12f9('0x32')]=_[_0x12f9('0x33')](_0x210ac0[_0x12f9('0x32')]);_0xcfa81b[_0x12f9('0x34')]=_[_0x12f9('0x35')](_0xcfa81b['model'],_0xcfa81b[_0x12f9('0x32')]);_0x3cf425[_0x12f9('0x36')]=_[_0x12f9('0x35')](_0xcfa81b[_0x12f9('0x31')],qs['fields'](_0x210ac0[_0x12f9('0x32')][_0x12f9('0x37')]));_0x3cf425[_0x12f9('0x36')]=_0x3cf425[_0x12f9('0x36')][_0x12f9('0x38')]?_0x3cf425[_0x12f9('0x36')]:_0xcfa81b[_0x12f9('0x31')];if(!_0x210ac0[_0x12f9('0x32')]['hasOwnProperty'](_0x12f9('0x39'))){_0x3cf425[_0x12f9('0x1f')]=qs['limit'](_0x210ac0[_0x12f9('0x32')][_0x12f9('0x1f')]);_0x3cf425['offset']=qs[_0x12f9('0x1e')](_0x210ac0[_0x12f9('0x32')][_0x12f9('0x1e')]);}_0x3cf425['order']=qs['sort'](_0x210ac0[_0x12f9('0x32')][_0x12f9('0x3a')]);delete _0x210ac0[_0x12f9('0x32')][_0x12f9('0x3a')];_0x3cf425['where']=qs[_0x12f9('0x34')](_[_0x12f9('0x3b')](_0x210ac0[_0x12f9('0x32')],_0xcfa81b['filters']),_0x2d2612);if(_0x210ac0[_0x12f9('0x32')]['filter']){_0x3cf425[_0x12f9('0x3c')]=_['merge'](_0x3cf425[_0x12f9('0x3c')],{'$or':_['map'](_0x2d2612,function(_0x177266){if(_0x177266[_0x12f9('0x2f')]!=='VIRTUAL'){var _0x327ff1={};_0x327ff1[_0x177266[_0x12f9('0x28')]]={'$like':'%'+_0x210ac0['query'][_0x12f9('0x3d')]+'%'};return _0x327ff1;}})});}_0x3cf425=_[_0x12f9('0x3e')]({},_0x3cf425,_0x210ac0[_0x12f9('0x3f')]);var _0xdf2ce7={'where':_0x3cf425[_0x12f9('0x3c')]};return db[_0x12f9('0x2c')][_0x12f9('0x1d')](_0xdf2ce7)[_0x12f9('0x24')](function(_0x331664){_0x1efbdc[_0x12f9('0x1d')]=_0x331664;if(_0x210ac0[_0x12f9('0x32')][_0x12f9('0x40')]){_0x3cf425['include']=[{'all':!![]}];}return db[_0x12f9('0x2c')]['findAll'](_0x3cf425);})[_0x12f9('0x24')](function(_0x1ca190){_0x1efbdc[_0x12f9('0x41')]=_0x1ca190;return _0x1efbdc;})[_0x12f9('0x24')](respondWithFilteredResult(_0x5e0f21,_0x3cf425))[_0x12f9('0x42')](handleError(_0x5e0f21,null));};exports[_0x12f9('0x43')]=function(_0x320f3e,_0x3ff715){var _0x305ccd={'raw':![],'where':{'id':_0x320f3e[_0x12f9('0x44')]['id']}},_0x242478={};_0x242478[_0x12f9('0x31')]=_['keys'](db[_0x12f9('0x2c')]['rawAttributes']);_0x242478[_0x12f9('0x32')]=_['keys'](_0x320f3e[_0x12f9('0x32')]);_0x242478['filters']=_['intersection'](_0x242478[_0x12f9('0x31')],_0x242478['query']);_0x305ccd[_0x12f9('0x36')]=_['intersection'](_0x242478[_0x12f9('0x31')],qs['fields'](_0x320f3e[_0x12f9('0x32')]['fields']));_0x305ccd[_0x12f9('0x36')]=_0x305ccd[_0x12f9('0x36')][_0x12f9('0x38')]?_0x305ccd['attributes']:_0x242478['model'];if(_0x320f3e[_0x12f9('0x32')][_0x12f9('0x40')]){_0x305ccd[_0x12f9('0x45')]=[{'all':!![]}];}_0x305ccd=_['merge']({},_0x305ccd,_0x320f3e[_0x12f9('0x3f')]);return db['VoiceMusicOnHold'][_0x12f9('0x46')](_0x305ccd)['then'](handleEntityNotFound(_0x3ff715,null))['then'](respondWithResult(_0x3ff715,null))['catch'](handleError(_0x3ff715,null));};exports[_0x12f9('0x47')]=function(_0x1b39d3,_0x2b0ae0){if(_0x1b39d3[_0x12f9('0x48')]['id']){delete _0x1b39d3[_0x12f9('0x48')]['id'];}return db[_0x12f9('0x2c')][_0x12f9('0x46')]({'where':{'id':_0x1b39d3[_0x12f9('0x44')]['id']}})[_0x12f9('0x24')](handleEntityNotFound(_0x2b0ae0,null))['then'](saveUpdates(_0x1b39d3[_0x12f9('0x48')],null))[_0x12f9('0x24')](respondWithResult(_0x2b0ae0,null))[_0x12f9('0x42')](handleError(_0x2b0ae0,null));};exports[_0x12f9('0x49')]=function(_0x4418f0,_0x46a216,_0x3660da){return db[_0x12f9('0x4a')][_0x12f9('0x4b')](function(_0x15372f){if(_0x4418f0[_0x12f9('0x48')][_0x12f9('0x4c')]===_0x12f9('0x4d')){_0x4418f0[_0x12f9('0x48')]['directory']=path[_0x12f9('0x4e')](config[_0x12f9('0x4f')],_0x12f9('0x50'),_0x4418f0[_0x12f9('0x48')][_0x12f9('0x28')]);}return db['VoiceMusicOnHold'][_0x12f9('0x49')](_0x4418f0[_0x12f9('0x48')],{'transaction':_0x15372f})[_0x12f9('0x24')](function(_0x1edd87){if(_0x4418f0[_0x12f9('0x48')]['mode']===_0x12f9('0x4d')){fs[_0x12f9('0x51')](_0x1edd87[_0x12f9('0x52')],parseInt('0777',0x8));}var _0x2290d8=_0x4418f0[_0x12f9('0x53')][_0x12f9('0x54')]({'plain':!![]});if(!_0x2290d8)throw new Error(_0x12f9('0x55'));if(_0x2290d8[_0x12f9('0x56')]===_0x12f9('0x53')){var _0x23bf47=_0x1edd87['get']({'plain':!![]});return db[_0x12f9('0x57')][_0x12f9('0x46')]({'where':{'name':_0x12f9('0x58'),'userProfileId':_0x2290d8[_0x12f9('0x59')]},'raw':!![]})[_0x12f9('0x24')](function(_0x564c5e){if(_0x564c5e&&_0x564c5e['autoAssociation']===0x0){return db[_0x12f9('0x5a')][_0x12f9('0x49')]({'name':_0x23bf47['name'],'resourceId':_0x23bf47['id'],'type':_0x564c5e['name'],'sectionId':_0x564c5e['id']},{})['then'](function(){return _0x1edd87;});}else{return _0x1edd87;}})['catch'](function(_0x4f145a){logger[_0x12f9('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f145a);});}return _0x1edd87;});})['then'](respondWithResult(_0x46a216,0xc9))['catch'](handleError(_0x46a216,null));};exports[_0x12f9('0x25')]=function(_0x33bf2f,_0x33fcaa,_0x200a3a){var _0x543c31;return db[_0x12f9('0x2c')][_0x12f9('0x46')]({'where':{'id':_0x33bf2f[_0x12f9('0x44')]['id']}})[_0x12f9('0x24')](function(_0x16c596){if(_0x16c596){return db[_0x12f9('0x4a')][_0x12f9('0x4b')](function(_0x47e400){return _0x16c596['destroy']({'transaction':_0x47e400,'raw':!![]})[_0x12f9('0x24')](function(_0x2f1c4b){if(_0x2f1c4b['directory']){fs['readdirSync'](_0x2f1c4b[_0x12f9('0x52')])[_0x12f9('0x5c')](function(_0xccf890){fs['unlinkSync'](path[_0x12f9('0x4e')](_0x2f1c4b[_0x12f9('0x52')],_0xccf890));});fs[_0x12f9('0x5d')](_0x2f1c4b[_0x12f9('0x52')]);}return _0x2f1c4b;});})['catch'](function(_0x4043c1){throw new db[(_0x12f9('0x5e'))]['ValidationError'](_0x4043c1[_0x12f9('0x5f')]);});}})[_0x12f9('0x24')](handleEntityNotFound(_0x33fcaa,null))[_0x12f9('0x24')](removeEntity(_0x33fcaa,null))[_0x12f9('0x42')](handleError(_0x33fcaa,null));};exports['addSound']=function(_0x17f5bf,_0x523530,_0x1ca2e5){return db[_0x12f9('0x4a')][_0x12f9('0x4b')](function(_0x15d7b0){var _0x14a0e4;return db['VoiceMusicOnHold'][_0x12f9('0x46')]({'where':{'id':_0x17f5bf['params']['id']}})[_0x12f9('0x24')](function(_0x45c6fb){if(_0x45c6fb){_0x14a0e4=_0x45c6fb;return _0x45c6fb[_0x12f9('0x60')](_0x17f5bf[_0x12f9('0x48')]['id'],{'transaction':_0x15d7b0});}})[_0x12f9('0x24')](function(_0x242a9f){if(_0x242a9f){return db[_0x12f9('0x61')][_0x12f9('0x62')]({'where':{'id':_0x17f5bf['body']['id']},'attributes':['id',_0x12f9('0x28'),_0x12f9('0x63'),_0x12f9('0x64'),_0x12f9('0x65')],'raw':!![]});}})[_0x12f9('0x24')](function(_0x5da3e7){if(_0x5da3e7){var _0x34544a=path[_0x12f9('0x4e')](config[_0x12f9('0x4f')],_0x12f9('0x66'),util[_0x12f9('0x67')](_0x12f9('0x68'),path[_0x12f9('0x69')](_0x5da3e7[_0x12f9('0x63')],path['extname'](_0x5da3e7[_0x12f9('0x63')])),_0x5da3e7[_0x12f9('0x64')]));var _0x3a9b04=path[_0x12f9('0x4e')](config[_0x12f9('0x4f')],_0x12f9('0x50'),_0x14a0e4[_0x12f9('0x28')],util[_0x12f9('0x67')](_0x12f9('0x68'),_0x5da3e7['name'],_0x5da3e7[_0x12f9('0x64')]));fs[_0x12f9('0x6a')](_0x34544a,_0x3a9b04);return _0x5da3e7;}})[_0x12f9('0x42')](function(_0x556091){throw new db[(_0x12f9('0x5e'))][(_0x12f9('0x6b'))](_0x556091[_0x12f9('0x5f')]);});})[_0x12f9('0x24')](handleEntityNotFound(_0x523530,null))[_0x12f9('0x24')](respondWithResult(_0x523530,0xc9))[_0x12f9('0x42')](handleError(_0x523530,null));};exports[_0x12f9('0x6c')]=function(_0x50c79f,_0x54bfca,_0x327502){return db['sequelize']['transaction'](function(_0x44c81c){var _0x66fdad;return db[_0x12f9('0x2c')][_0x12f9('0x62')]({'where':{'id':_0x50c79f[_0x12f9('0x44')]['id']}})[_0x12f9('0x24')](handleEntityNotFound(_0x54bfca,null))['then'](function(_0xd68ae4){if(_0xd68ae4){_0x66fdad=_0xd68ae4;return _0xd68ae4[_0x12f9('0x6c')](_0x50c79f[_0x12f9('0x44')][_0x12f9('0x6d')]);}})['then'](function(_0x30f056){if(_0x30f056){return db[_0x12f9('0x61')][_0x12f9('0x62')]({'where':{'id':_0x50c79f[_0x12f9('0x44')][_0x12f9('0x6d')]},'attributes':['id',_0x12f9('0x28'),'save_name',_0x12f9('0x64'),_0x12f9('0x65')],'raw':!![]});}})[_0x12f9('0x24')](function(_0x1bf324){if(_0x1bf324){fs[_0x12f9('0x6e')](path[_0x12f9('0x4e')](_0x66fdad[_0x12f9('0x52')],util[_0x12f9('0x67')](_0x12f9('0x68'),_0x1bf324[_0x12f9('0x28')],_0x1bf324[_0x12f9('0x64')])));return _0x1bf324;}})[_0x12f9('0x42')](function(_0x584bab){throw new db['Sequelize'][(_0x12f9('0x6b'))](_0x584bab['message']);});})[_0x12f9('0x24')](handleEntityNotFound(_0x54bfca,null))[_0x12f9('0x24')](respondWithStatusCode(_0x54bfca,0xcc))[_0x12f9('0x42')](handleError(_0x54bfca,null));};exports['getSounds']=function(_0x9a8f14,_0x1aabbc,_0x510e01){var _0x298668={};var _0x1969ef={};var _0x4c2630;var _0xa036ae;return db[_0x12f9('0x2c')][_0x12f9('0x62')]({'where':{'id':_0x9a8f14[_0x12f9('0x44')]['id']}})[_0x12f9('0x24')](handleEntityNotFound(_0x1aabbc,null))[_0x12f9('0x24')](function(_0x525945){if(_0x525945){_0x4c2630=_0x525945;_0x1969ef[_0x12f9('0x31')]=_['keys'](db['Sound']['rawAttributes']);_0x1969ef[_0x12f9('0x32')]=_[_0x12f9('0x33')](_0x9a8f14[_0x12f9('0x32')]);_0x1969ef['filters']=_[_0x12f9('0x35')](_0x1969ef[_0x12f9('0x31')],_0x1969ef['query']);_0x298668[_0x12f9('0x36')]=_[_0x12f9('0x35')](_0x1969ef[_0x12f9('0x31')],qs[_0x12f9('0x37')](_0x9a8f14['query']['fields']));_0x298668[_0x12f9('0x36')]=_0x298668[_0x12f9('0x36')][_0x12f9('0x38')]?_0x298668[_0x12f9('0x36')]:_0x1969ef[_0x12f9('0x31')];_0x298668[_0x12f9('0x6f')]=qs[_0x12f9('0x3a')](_0x9a8f14[_0x12f9('0x32')]['sort']);_0x298668['where']=qs['filters'](_[_0x12f9('0x3b')](_0x9a8f14[_0x12f9('0x32')],_0x1969ef[_0x12f9('0x34')]));if(_0x9a8f14[_0x12f9('0x32')][_0x12f9('0x3d')]){_0x298668[_0x12f9('0x3c')]=_['merge'](_0x298668[_0x12f9('0x3c')],{'$or':_['map'](_0x298668['attributes'],function(_0x54707b){var _0x41580e={};_0x41580e[_0x54707b]={'$like':'%'+_0x9a8f14[_0x12f9('0x32')][_0x12f9('0x3d')]+'%'};return _0x41580e;})});}_0x298668=_[_0x12f9('0x3e')]({},_0x298668,_0x9a8f14['options']);return _0x4c2630[_0x12f9('0x70')](_0x298668);}})[_0x12f9('0x24')](function(_0x1cd197){if(_0x1cd197){_0xa036ae=_0x1cd197[_0x12f9('0x38')];if(!_0x9a8f14['query'][_0x12f9('0x71')](_0x12f9('0x39'))){_0x298668[_0x12f9('0x1f')]=qs[_0x12f9('0x1f')](_0x9a8f14[_0x12f9('0x32')][_0x12f9('0x1f')]);_0x298668[_0x12f9('0x1e')]=qs[_0x12f9('0x1e')](_0x9a8f14[_0x12f9('0x32')]['offset']);}return _0x4c2630[_0x12f9('0x70')](_0x298668);}})[_0x12f9('0x24')](function(_0x1ffb5f){if(_0x1ffb5f){return _0x1ffb5f?{'count':_0xa036ae,'rows':_0x1ffb5f}:null;}})[_0x12f9('0x24')](respondWithResult(_0x1aabbc,null))[_0x12f9('0x42')](handleError(_0x1aabbc,null));}; \ No newline at end of file +var _0xdc4e=['root','server/files/sounds/converted','extname','symlinkSync','removeSound','id2','Sound','format','getSounds','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','MusicOnHolds','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','map','keys','intersection','model','fields','query','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','filters','catch','body','create','mode','files','directory','server/files/moh','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','sequelize','transaction','readdirSync','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt'];(function(_0x2ba9e8,_0x5893d5){var _0x440e97=function(_0x3c1915){while(--_0x3c1915){_0x2ba9e8['push'](_0x2ba9e8['shift']());}};_0x440e97(++_0x5893d5);}(_0xdc4e,0x80));var _0xedc4=function(_0x1e9bf3,_0x4e14f5){_0x1e9bf3=_0x1e9bf3-0x0;var _0x4864c1=_0xdc4e[_0x1e9bf3];return _0x4864c1;};'use strict';var emlformat=require(_0xedc4('0x0'));var rimraf=require(_0xedc4('0x1'));var zipdir=require(_0xedc4('0x2'));var jsonpatch=require(_0xedc4('0x3'));var rp=require(_0xedc4('0x4'));var moment=require(_0xedc4('0x5'));var BPromise=require(_0xedc4('0x6'));var Mustache=require(_0xedc4('0x7'));var util=require(_0xedc4('0x8'));var path=require(_0xedc4('0x9'));var sox=require(_0xedc4('0xa'));var csv=require(_0xedc4('0xb'));var ejs=require(_0xedc4('0xc'));var fs=require('fs');var fs_extra=require(_0xedc4('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xedc4('0xe'));var jsforce=require(_0xedc4('0xf'));var deskjs=require(_0xedc4('0x10'));var toCsv=require(_0xedc4('0xb'));var querystring=require(_0xedc4('0x11'));var Papa=require('papaparse');var Redis=require(_0xedc4('0x12'));var authService=require(_0xedc4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xedc4('0x14'));var hardwareService=require(_0xedc4('0x15'));var logger=require(_0xedc4('0x16'))(_0xedc4('0x17'));var utils=require(_0xedc4('0x18'));var config=require(_0xedc4('0x19'));var licenseUtil=require(_0xedc4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x483676,_0x31b678){_0x31b678=_0x31b678||0xcc;return function(_0x376d08){if(_0x376d08){return _0x483676[_0xedc4('0x1b')](_0x31b678);}return _0x483676[_0xedc4('0x1c')](_0x31b678)[_0xedc4('0x1d')]();};}function respondWithResult(_0x5792ef,_0x46f2b9){_0x46f2b9=_0x46f2b9||0xc8;return function(_0x15324d){if(_0x15324d){return _0x5792ef['status'](_0x46f2b9)[_0xedc4('0x1e')](_0x15324d);}};}function respondWithFilteredResult(_0x57e7bc,_0x3e5449){return function(_0x1fb140){if(_0x1fb140){var _0x15dec0=typeof _0x3e5449['offset']==='undefined'&&typeof _0x3e5449[_0xedc4('0x1f')]===_0xedc4('0x20');var _0x245aba=_0x1fb140[_0xedc4('0x21')];var _0x1dca32=_0x15dec0?0x0:_0x3e5449[_0xedc4('0x22')];var _0x548743=_0x15dec0?_0x1fb140['count']:_0x3e5449[_0xedc4('0x22')]+_0x3e5449[_0xedc4('0x1f')];var _0x298efe;if(_0x548743>=_0x245aba){_0x548743=_0x245aba;_0x298efe=0xc8;}else{_0x298efe=0xce;}_0x57e7bc[_0xedc4('0x1c')](_0x298efe);return _0x57e7bc[_0xedc4('0x23')](_0xedc4('0x24'),_0x1dca32+'-'+_0x548743+'/'+_0x245aba)['json'](_0x1fb140);}return null;};}function patchUpdates(_0x2404e6){return function(_0x2f0bcb){try{jsonpatch[_0xedc4('0x25')](_0x2f0bcb,_0x2404e6,!![]);}catch(_0x202ebe){return BPromise[_0xedc4('0x26')](_0x202ebe);}return _0x2f0bcb['save']();};}function saveUpdates(_0x41314e,_0x4f6a7d){return function(_0x26dc51){if(_0x26dc51){return _0x26dc51[_0xedc4('0x27')](_0x41314e)[_0xedc4('0x28')](function(_0x4a2483){return _0x4a2483;});}return null;};}function removeEntity(_0x46b3cb,_0x133ca1){return function(_0x2ce153){if(_0x2ce153){return _0x2ce153[_0xedc4('0x29')]()[_0xedc4('0x28')](function(){var _0x332c5b=_0x2ce153['get']({'plain':!![]});var _0x13fb09=_0xedc4('0x2a');return db['UserProfileResource'][_0xedc4('0x29')]({'where':{'type':_0x13fb09,'resourceId':_0x332c5b['id']}})[_0xedc4('0x28')](function(){return _0x2ce153;});})['then'](function(){_0x46b3cb[_0xedc4('0x1c')](0xcc)[_0xedc4('0x1d')]();});}};}function handleEntityNotFound(_0x2a00e6,_0x5b85b8){return function(_0xbb52df){if(!_0xbb52df){_0x2a00e6[_0xedc4('0x1b')](0x194);}return _0xbb52df;};}function handleError(_0x54e4b1,_0x4b5fe6){_0x4b5fe6=_0x4b5fe6||0x1f4;return function(_0x290e06){logger['error'](_0x290e06[_0xedc4('0x2b')]);if(_0x290e06[_0xedc4('0x2c')]){delete _0x290e06[_0xedc4('0x2c')];}_0x54e4b1[_0xedc4('0x1c')](_0x4b5fe6)[_0xedc4('0x2d')](_0x290e06);};}exports[_0xedc4('0x2e')]=function(_0x5a08ed,_0x4bafa4){var _0x3522c1={},_0x592931={},_0x1a23c7={'count':0x0,'rows':[]};var _0x2b1a46=_['map'](db[_0xedc4('0x2f')][_0xedc4('0x30')],function(_0x10f387){return{'name':_0x10f387[_0xedc4('0x31')],'type':_0x10f387[_0xedc4('0x32')][_0xedc4('0x33')]};});_0x592931['model']=_[_0xedc4('0x34')](_0x2b1a46,_0xedc4('0x2c'));_0x592931['query']=_[_0xedc4('0x35')](_0x5a08ed['query']);_0x592931['filters']=_[_0xedc4('0x36')](_0x592931[_0xedc4('0x37')],_0x592931['query']);_0x3522c1['attributes']=_[_0xedc4('0x36')](_0x592931[_0xedc4('0x37')],qs[_0xedc4('0x38')](_0x5a08ed[_0xedc4('0x39')][_0xedc4('0x38')]));_0x3522c1[_0xedc4('0x3a')]=_0x3522c1[_0xedc4('0x3a')][_0xedc4('0x3b')]?_0x3522c1[_0xedc4('0x3a')]:_0x592931['model'];if(!_0x5a08ed[_0xedc4('0x39')][_0xedc4('0x3c')]('nolimit')){_0x3522c1[_0xedc4('0x1f')]=qs['limit'](_0x5a08ed[_0xedc4('0x39')][_0xedc4('0x1f')]);_0x3522c1[_0xedc4('0x22')]=qs[_0xedc4('0x22')](_0x5a08ed[_0xedc4('0x39')][_0xedc4('0x22')]);}_0x3522c1[_0xedc4('0x3d')]=qs[_0xedc4('0x3e')](_0x5a08ed['query']['sort']);delete _0x5a08ed[_0xedc4('0x39')][_0xedc4('0x3e')];_0x3522c1[_0xedc4('0x3f')]=qs['filters'](_[_0xedc4('0x40')](_0x5a08ed[_0xedc4('0x39')],_0x592931['filters']),_0x2b1a46);if(_0x5a08ed[_0xedc4('0x39')][_0xedc4('0x41')]){_0x3522c1[_0xedc4('0x3f')]=_[_0xedc4('0x42')](_0x3522c1[_0xedc4('0x3f')],{'$or':_['map'](_0x2b1a46,function(_0x2fe46f){if(_0x2fe46f['type']!==_0xedc4('0x43')){var _0x4be5b6={};_0x4be5b6[_0x2fe46f[_0xedc4('0x2c')]]={'$like':'%'+_0x5a08ed[_0xedc4('0x39')][_0xedc4('0x41')]+'%'};return _0x4be5b6;}})});}_0x3522c1=_[_0xedc4('0x42')]({},_0x3522c1,_0x5a08ed[_0xedc4('0x44')]);var _0x56edaf={'where':_0x3522c1['where']};return db[_0xedc4('0x2f')][_0xedc4('0x21')](_0x56edaf)[_0xedc4('0x28')](function(_0x3ea26e){_0x1a23c7[_0xedc4('0x21')]=_0x3ea26e;if(_0x5a08ed[_0xedc4('0x39')][_0xedc4('0x45')]){_0x3522c1['include']=[{'all':!![]}];}return db[_0xedc4('0x2f')][_0xedc4('0x46')](_0x3522c1);})['then'](function(_0x4c5009){_0x1a23c7[_0xedc4('0x47')]=_0x4c5009;return _0x1a23c7;})[_0xedc4('0x28')](respondWithFilteredResult(_0x4bafa4,_0x3522c1))['catch'](handleError(_0x4bafa4,null));};exports[_0xedc4('0x48')]=function(_0x3048c4,_0x30f706){var _0x59132b={'raw':![],'where':{'id':_0x3048c4['params']['id']}},_0x54079d={};_0x54079d[_0xedc4('0x37')]=_[_0xedc4('0x35')](db[_0xedc4('0x2f')][_0xedc4('0x30')]);_0x54079d[_0xedc4('0x39')]=_[_0xedc4('0x35')](_0x3048c4[_0xedc4('0x39')]);_0x54079d[_0xedc4('0x49')]=_['intersection'](_0x54079d[_0xedc4('0x37')],_0x54079d[_0xedc4('0x39')]);_0x59132b[_0xedc4('0x3a')]=_[_0xedc4('0x36')](_0x54079d[_0xedc4('0x37')],qs[_0xedc4('0x38')](_0x3048c4[_0xedc4('0x39')][_0xedc4('0x38')]));_0x59132b[_0xedc4('0x3a')]=_0x59132b[_0xedc4('0x3a')]['length']?_0x59132b['attributes']:_0x54079d[_0xedc4('0x37')];if(_0x3048c4[_0xedc4('0x39')]['includeAll']){_0x59132b['include']=[{'all':!![]}];}_0x59132b=_[_0xedc4('0x42')]({},_0x59132b,_0x3048c4[_0xedc4('0x44')]);return db[_0xedc4('0x2f')]['find'](_0x59132b)[_0xedc4('0x28')](handleEntityNotFound(_0x30f706,null))[_0xedc4('0x28')](respondWithResult(_0x30f706,null))[_0xedc4('0x4a')](handleError(_0x30f706,null));};exports[_0xedc4('0x27')]=function(_0x4f94c7,_0x37d281){if(_0x4f94c7[_0xedc4('0x4b')]['id']){delete _0x4f94c7[_0xedc4('0x4b')]['id'];}return db[_0xedc4('0x2f')]['find']({'where':{'id':_0x4f94c7['params']['id']}})[_0xedc4('0x28')](handleEntityNotFound(_0x37d281,null))[_0xedc4('0x28')](saveUpdates(_0x4f94c7[_0xedc4('0x4b')],null))[_0xedc4('0x28')](respondWithResult(_0x37d281,null))['catch'](handleError(_0x37d281,null));};exports[_0xedc4('0x4c')]=function(_0x1ee7e6,_0x1c4238,_0x420269){return db['sequelize']['transaction'](function(_0xa753b4){if(_0x1ee7e6['body'][_0xedc4('0x4d')]===_0xedc4('0x4e')){_0x1ee7e6[_0xedc4('0x4b')][_0xedc4('0x4f')]=path['join'](config['root'],_0xedc4('0x50'),_0x1ee7e6[_0xedc4('0x4b')][_0xedc4('0x2c')]);}return db[_0xedc4('0x2f')][_0xedc4('0x4c')](_0x1ee7e6[_0xedc4('0x4b')],{'transaction':_0xa753b4})[_0xedc4('0x28')](function(_0x4612b0){if(_0x1ee7e6['body']['mode']===_0xedc4('0x4e')){fs[_0xedc4('0x51')](_0x4612b0['directory'],parseInt(_0xedc4('0x52'),0x8));}var _0x2a5b0e=_0x1ee7e6[_0xedc4('0x53')][_0xedc4('0x54')]({'plain':!![]});if(!_0x2a5b0e)throw new Error(_0xedc4('0x55'));if(_0x2a5b0e[_0xedc4('0x56')]==='user'){var _0x466d00=_0x4612b0['get']({'plain':!![]});return db['UserProfileSection'][_0xedc4('0x57')]({'where':{'name':'MusicOnHolds','userProfileId':_0x2a5b0e[_0xedc4('0x58')]},'raw':!![]})[_0xedc4('0x28')](function(_0x49e6d1){if(_0x49e6d1&&_0x49e6d1[_0xedc4('0x59')]===0x0){return db[_0xedc4('0x5a')]['create']({'name':_0x466d00['name'],'resourceId':_0x466d00['id'],'type':_0x49e6d1['name'],'sectionId':_0x49e6d1['id']},{})[_0xedc4('0x28')](function(){return _0x4612b0;});}else{return _0x4612b0;}})['catch'](function(_0x3b7fca){logger[_0xedc4('0x5b')](_0xedc4('0x5c'),_0x3b7fca);});}return _0x4612b0;});})[_0xedc4('0x28')](respondWithResult(_0x1c4238,0xc9))[_0xedc4('0x4a')](handleError(_0x1c4238,null));};exports[_0xedc4('0x29')]=function(_0x35c49b,_0x53e2fb,_0xe067f2){var _0x6bef2b;return db[_0xedc4('0x2f')][_0xedc4('0x57')]({'where':{'id':_0x35c49b[_0xedc4('0x5d')]['id']}})[_0xedc4('0x28')](function(_0x35110e){if(_0x35110e){return db[_0xedc4('0x5e')][_0xedc4('0x5f')](function(_0x4459e4){return _0x35110e['destroy']({'transaction':_0x4459e4,'raw':!![]})[_0xedc4('0x28')](function(_0x33e26f){if(_0x33e26f[_0xedc4('0x4f')]){fs[_0xedc4('0x60')](_0x33e26f[_0xedc4('0x4f')])['forEach'](function(_0x175941){fs[_0xedc4('0x61')](path[_0xedc4('0x62')](_0x33e26f[_0xedc4('0x4f')],_0x175941));});fs[_0xedc4('0x63')](_0x33e26f[_0xedc4('0x4f')]);}return _0x33e26f;});})['catch'](function(_0x5ac66e){throw new db[(_0xedc4('0x64'))][(_0xedc4('0x65'))](_0x5ac66e[_0xedc4('0x66')]);});}})[_0xedc4('0x28')](handleEntityNotFound(_0x53e2fb,null))[_0xedc4('0x28')](removeEntity(_0x53e2fb,null))[_0xedc4('0x4a')](handleError(_0x53e2fb,null));};exports[_0xedc4('0x67')]=function(_0x206e5e,_0x31d85d,_0x32defc){return db[_0xedc4('0x5e')][_0xedc4('0x5f')](function(_0x4f09ec){var _0x28394e;return db[_0xedc4('0x2f')][_0xedc4('0x57')]({'where':{'id':_0x206e5e[_0xedc4('0x5d')]['id']}})[_0xedc4('0x28')](function(_0x2d1776){if(_0x2d1776){_0x28394e=_0x2d1776;return _0x2d1776[_0xedc4('0x67')](_0x206e5e[_0xedc4('0x4b')]['id'],{'transaction':_0x4f09ec});}})[_0xedc4('0x28')](function(_0x29de74){if(_0x29de74){return db['Sound'][_0xedc4('0x68')]({'where':{'id':_0x206e5e[_0xedc4('0x4b')]['id']},'attributes':['id',_0xedc4('0x2c'),_0xedc4('0x69'),_0xedc4('0x6a'),_0xedc4('0x6b')],'raw':!![]});}})[_0xedc4('0x28')](function(_0x570821){if(_0x570821){var _0x166501=path[_0xedc4('0x62')](config[_0xedc4('0x6c')],_0xedc4('0x6d'),util['format']('%s.%s',path['basename'](_0x570821['save_name'],path[_0xedc4('0x6e')](_0x570821[_0xedc4('0x69')])),_0x570821[_0xedc4('0x6a')]));var _0x59fa3c=path[_0xedc4('0x62')](config[_0xedc4('0x6c')],'server/files/moh',_0x28394e[_0xedc4('0x2c')],util['format']('%s.%s',_0x570821[_0xedc4('0x2c')],_0x570821['converted_format']));fs[_0xedc4('0x6f')](_0x166501,_0x59fa3c);return _0x570821;}})[_0xedc4('0x4a')](function(_0x2146a0){throw new db[(_0xedc4('0x64'))][(_0xedc4('0x65'))](_0x2146a0[_0xedc4('0x66')]);});})['then'](handleEntityNotFound(_0x31d85d,null))[_0xedc4('0x28')](respondWithResult(_0x31d85d,0xc9))[_0xedc4('0x4a')](handleError(_0x31d85d,null));};exports['removeSound']=function(_0x239ca0,_0x1d848e,_0x2be500){return db[_0xedc4('0x5e')][_0xedc4('0x5f')](function(_0x44b464){var _0x2634be;return db[_0xedc4('0x2f')][_0xedc4('0x68')]({'where':{'id':_0x239ca0[_0xedc4('0x5d')]['id']}})[_0xedc4('0x28')](handleEntityNotFound(_0x1d848e,null))[_0xedc4('0x28')](function(_0x546dd4){if(_0x546dd4){_0x2634be=_0x546dd4;return _0x546dd4[_0xedc4('0x70')](_0x239ca0[_0xedc4('0x5d')][_0xedc4('0x71')]);}})[_0xedc4('0x28')](function(_0x16feb6){if(_0x16feb6){return db[_0xedc4('0x72')][_0xedc4('0x68')]({'where':{'id':_0x239ca0[_0xedc4('0x5d')][_0xedc4('0x71')]},'attributes':['id',_0xedc4('0x2c'),_0xedc4('0x69'),_0xedc4('0x6a'),_0xedc4('0x6b')],'raw':!![]});}})[_0xedc4('0x28')](function(_0x46e039){if(_0x46e039){fs[_0xedc4('0x61')](path[_0xedc4('0x62')](_0x2634be['directory'],util[_0xedc4('0x73')]('%s.%s',_0x46e039[_0xedc4('0x2c')],_0x46e039['converted_format'])));return _0x46e039;}})[_0xedc4('0x4a')](function(_0x3bda1c){throw new db['Sequelize'][(_0xedc4('0x65'))](_0x3bda1c[_0xedc4('0x66')]);});})[_0xedc4('0x28')](handleEntityNotFound(_0x1d848e,null))[_0xedc4('0x28')](respondWithStatusCode(_0x1d848e,0xcc))[_0xedc4('0x4a')](handleError(_0x1d848e,null));};exports[_0xedc4('0x74')]=function(_0x44f4c9,_0x41d1f3,_0x177614){var _0xb94996={};var _0x2cd53b={};var _0x3aeb6a;var _0x43cc66;return db['VoiceMusicOnHold'][_0xedc4('0x68')]({'where':{'id':_0x44f4c9[_0xedc4('0x5d')]['id']}})[_0xedc4('0x28')](handleEntityNotFound(_0x41d1f3,null))['then'](function(_0x5aca45){if(_0x5aca45){_0x3aeb6a=_0x5aca45;_0x2cd53b[_0xedc4('0x37')]=_['keys'](db[_0xedc4('0x72')][_0xedc4('0x30')]);_0x2cd53b['query']=_[_0xedc4('0x35')](_0x44f4c9[_0xedc4('0x39')]);_0x2cd53b['filters']=_[_0xedc4('0x36')](_0x2cd53b[_0xedc4('0x37')],_0x2cd53b[_0xedc4('0x39')]);_0xb94996['attributes']=_[_0xedc4('0x36')](_0x2cd53b['model'],qs[_0xedc4('0x38')](_0x44f4c9[_0xedc4('0x39')]['fields']));_0xb94996[_0xedc4('0x3a')]=_0xb94996[_0xedc4('0x3a')][_0xedc4('0x3b')]?_0xb94996[_0xedc4('0x3a')]:_0x2cd53b[_0xedc4('0x37')];_0xb94996['order']=qs[_0xedc4('0x3e')](_0x44f4c9[_0xedc4('0x39')][_0xedc4('0x3e')]);_0xb94996[_0xedc4('0x3f')]=qs[_0xedc4('0x49')](_[_0xedc4('0x40')](_0x44f4c9[_0xedc4('0x39')],_0x2cd53b[_0xedc4('0x49')]));if(_0x44f4c9[_0xedc4('0x39')][_0xedc4('0x41')]){_0xb94996[_0xedc4('0x3f')]=_[_0xedc4('0x42')](_0xb94996[_0xedc4('0x3f')],{'$or':_['map'](_0xb94996['attributes'],function(_0x36b1d7){var _0x171f46={};_0x171f46[_0x36b1d7]={'$like':'%'+_0x44f4c9[_0xedc4('0x39')][_0xedc4('0x41')]+'%'};return _0x171f46;})});}_0xb94996=_[_0xedc4('0x42')]({},_0xb94996,_0x44f4c9[_0xedc4('0x44')]);return _0x3aeb6a[_0xedc4('0x74')](_0xb94996);}})['then'](function(_0x39ae99){if(_0x39ae99){_0x43cc66=_0x39ae99[_0xedc4('0x3b')];if(!_0x44f4c9[_0xedc4('0x39')]['hasOwnProperty'](_0xedc4('0x75'))){_0xb94996[_0xedc4('0x1f')]=qs[_0xedc4('0x1f')](_0x44f4c9[_0xedc4('0x39')][_0xedc4('0x1f')]);_0xb94996[_0xedc4('0x22')]=qs[_0xedc4('0x22')](_0x44f4c9[_0xedc4('0x39')][_0xedc4('0x22')]);}return _0x3aeb6a[_0xedc4('0x74')](_0xb94996);}})[_0xedc4('0x28')](function(_0x2cfa89){if(_0x2cfa89){return _0x2cfa89?{'count':_0x43cc66,'rows':_0x2cfa89}:null;}})[_0xedc4('0x28')](respondWithResult(_0x41d1f3,null))[_0xedc4('0x4a')](handleError(_0x41d1f3,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c4b0850..48f4a40 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 _0x881e=['moment','bluebird','request-promise','path','rimraf','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','api'];(function(_0x5e2886,_0x1fa7f3){var _0x319399=function(_0x182039){while(--_0x182039){_0x5e2886['push'](_0x5e2886['shift']());}};_0x319399(++_0x1fa7f3);}(_0x881e,0xa3));var _0xe881=function(_0x23225e,_0x41939c){_0x23225e=_0x23225e-0x0;var _0x76b8d3=_0x881e[_0x23225e];return _0x76b8d3;};'use strict';var _=require(_0xe881('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe881('0x1'));var moment=require(_0xe881('0x2'));var BPromise=require(_0xe881('0x3'));var rp=require(_0xe881('0x4'));var fs=require('fs');var path=require(_0xe881('0x5'));var rimraf=require(_0xe881('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0xe881('0x7')]=function(_0x4dce2c,_0x337eb8){return _0x4dce2c[_0xe881('0x8')](_0xe881('0x9'),attributes,{'tableName':_0xe881('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d85=['VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x7d85,0xaa));var _0x57d8=function(_0x276860,_0x2860b7){_0x276860=_0x276860-0x0;var _0x7edf78=_0x7d85[_0x276860];return _0x7edf78;};'use strict';var _=require(_0x57d8('0x0'));var util=require(_0x57d8('0x1'));var logger=require('../../config/logger')(_0x57d8('0x2'));var moment=require(_0x57d8('0x3'));var BPromise=require('bluebird');var rp=require(_0x57d8('0x4'));var fs=require('fs');var path=require(_0x57d8('0x5'));var rimraf=require(_0x57d8('0x6'));var config=require('../../config/environment');var attributes=require(_0x57d8('0x7'));module[_0x57d8('0x8')]=function(_0x146617,_0x592379){return _0x146617[_0x57d8('0x9')](_0x57d8('0xa'),attributes,{'tableName':_0x57d8('0xb'),'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 23a6eab..a392a5c 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x261404,_0x484b0b){var _0x2e765e=function(_0x27c907){while(--_0x27c907){_0x261404['push'](_0x261404['shift']());}};_0x2e765e(++_0x484b0b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x201587,_0x4bc5f4){var _0x92e6dc=function(_0x192c6f){while(--_0x192c6f){_0x201587['push'](_0x201587['shift']());}};_0x92e6dc(++_0x4bc5f4);}(_0xedd9,0xfc));var _0x9edd=function(_0x500555,_0xd44425){_0x500555=_0x500555-0x0;var _0x237092=_0xedd9[_0x500555];return _0x237092;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 6001b28..f3bed7c 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 _0x55ca=['addTeams','put','update','destroy','delete','removeAgents','removeTeams','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create'];(function(_0x259c99,_0x28fc7b){var _0x589fef=function(_0x3fd915){while(--_0x3fd915){_0x259c99['push'](_0x259c99['shift']());}};_0x589fef(++_0x28fc7b);}(_0x55ca,0x126));var _0xa55c=function(_0x4ede04,_0x58132b){_0x4ede04=_0x4ede04-0x0;var _0x49ccfc=_0x55ca[_0x4ede04];return _0x49ccfc;};'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('0x10')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router['post']('/:id/users',auth[_0xa55c('0x8')](),controller['addAgents']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x12')]);router[_0xa55c('0x13')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x16')](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x17')]);router[_0xa55c('0x16')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x379e=['addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/users','getAgents','getTeams','post','addAgents','/:id/teams'];(function(_0x2dc3fe,_0x54c24e){var _0x1e77f6=function(_0x154687){while(--_0x154687){_0x2dc3fe['push'](_0x2dc3fe['shift']());}};_0x1e77f6(++_0x54c24e);}(_0x379e,0x104));var _0xe379=function(_0x28955d,_0x31e4fd){_0x28955d=_0x28955d-0x0;var _0x4ed229=_0x379e[_0x28955d];return _0x4ed229;};'use strict';var multer=require(_0xe379('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe379('0x1'));var router=express[_0xe379('0x2')]();var fs_extra=require(_0xe379('0x3'));var auth=require(_0xe379('0x4'));var interaction=require(_0xe379('0x5'));var config=require(_0xe379('0x6'));var controller=require(_0xe379('0x7'));router['get']('/',auth[_0xe379('0x8')](),controller[_0xe379('0x9')]);router[_0xe379('0xa')](_0xe379('0xb'),auth[_0xe379('0x8')](),controller['describe']);router[_0xe379('0xa')](_0xe379('0xc'),auth[_0xe379('0x8')](),controller[_0xe379('0xd')]);router[_0xe379('0xa')](_0xe379('0xe'),auth[_0xe379('0x8')](),controller[_0xe379('0xf')]);router[_0xe379('0xa')]('/:id/teams',auth[_0xe379('0x8')](),controller[_0xe379('0x10')]);router[_0xe379('0x11')]('/',auth[_0xe379('0x8')](),controller['create']);router['post'](_0xe379('0xe'),auth[_0xe379('0x8')](),controller[_0xe379('0x12')]);router[_0xe379('0x11')](_0xe379('0x13'),auth[_0xe379('0x8')](),controller[_0xe379('0x14')]);router[_0xe379('0x15')]('/:id',auth[_0xe379('0x8')](),controller[_0xe379('0x16')]);router[_0xe379('0x17')](_0xe379('0xc'),auth[_0xe379('0x8')](),controller[_0xe379('0x18')]);router['delete'](_0xe379('0xe'),auth['isAuthenticated'](),controller[_0xe379('0x19')]);router['delete'](_0xe379('0x13'),auth[_0xe379('0x8')](),controller[_0xe379('0x1a')]);module[_0xe379('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 5230d25..5fa00ec 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 _0xeb17=['getDataValue','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x4a2217,_0x9c653a){var _0x24cb1c=function(_0x35155e){while(--_0x35155e){_0x4a2217['push'](_0x4a2217['shift']());}};_0x24cb1c(++_0x9c653a);}(_0xeb17,0x73));var _0x7eb1=function(_0x145abc,_0x5a6073){_0x145abc=_0x145abc-0x0;var _0x3b031a=_0xeb17[_0x145abc];return _0x3b031a;};'use strict';var Sequelize=require(_0x7eb1('0x0'));module['exports']={'name':{'type':Sequelize[_0x7eb1('0x1')],'allowNull':![],'unique':_0x7eb1('0x2')},'prefix':{'type':Sequelize[_0x7eb1('0x3')],'get':function(_0x413acd){return _0x7eb1('0x4')+this[_0x7eb1('0x5')](_0x7eb1('0x2'))+'-';}},'description':{'type':Sequelize[_0x7eb1('0x1')]},'callerIdAll':{'type':Sequelize[_0x7eb1('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8433=['name','VIRTUAL','system-','STRING','INTEGER','sequelize'];(function(_0x214b8a,_0x4684e2){var _0x29729c=function(_0x21b69c){while(--_0x21b69c){_0x214b8a['push'](_0x214b8a['shift']());}};_0x29729c(++_0x4684e2);}(_0x8433,0x18b));var _0x3843=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x8433[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require(_0x3843('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3843('0x1')},'prefix':{'type':Sequelize[_0x3843('0x2')],'get':function(_0x5db95b){return _0x3843('0x3')+this['getDataValue'](_0x3843('0x1'))+'-';}},'description':{'type':Sequelize[_0x3843('0x4')]},'callerIdAll':{'type':Sequelize[_0x3843('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x3843('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 302fd2f..be71e04 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 _0xdd4f=['lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','describe','create','transaction','body','VoiceExtension','find','VoiceExtensionId','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','charAt','update','system-','sequelize','findById','addAgents','spread','ids','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','findOne','rawAttributes','order','getTeams','Team','nolimit','findAll','User','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeTeams','userVoicePrefix:remove','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x5b136e,_0xb0d839){var _0x1dcbaf=function(_0x4d2797){while(--_0x4d2797){_0x5b136e['push'](_0x5b136e['shift']());}};_0x1dcbaf(++_0xb0d839);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1e463c,_0x44cee9){_0x1e463c=_0x1e463c-0x0;var _0x3b84d6=_0xdd4f[_0x1e463c];return _0x3b84d6;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];config[_0xfdd4('0x17')]=_[_0xfdd4('0x18')](config[_0xfdd4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdd4('0x19'))(new Redis(config[_0xfdd4('0x17')]));require(_0xfdd4('0x1a'))['register'](socket);function respondWithStatusCode(_0x1b7da1,_0x4aaeee){_0x4aaeee=_0x4aaeee||0xcc;return function(_0x467824){if(_0x467824){return _0x1b7da1[_0xfdd4('0x1b')](_0x4aaeee);}return _0x1b7da1[_0xfdd4('0x1c')](_0x4aaeee)[_0xfdd4('0x1d')]();};}function respondWithResult(_0x37b05f,_0x52cf2c){_0x52cf2c=_0x52cf2c||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0x37b05f['status'](_0x52cf2c)[_0xfdd4('0x1e')](_0x47ed1d);}};}function respondWithFilteredResult(_0x216c7e,_0x2eb174){return function(_0x2ccc88){if(_0x2ccc88){var _0x32b5f7=typeof _0x2eb174[_0xfdd4('0x1f')]===_0xfdd4('0x20')&&typeof _0x2eb174[_0xfdd4('0x21')]===_0xfdd4('0x20');var _0x52ce34=_0x2ccc88[_0xfdd4('0x22')];var _0x3e8eac=_0x32b5f7?0x0:_0x2eb174[_0xfdd4('0x1f')];var _0x36e611=_0x32b5f7?_0x2ccc88[_0xfdd4('0x22')]:_0x2eb174[_0xfdd4('0x1f')]+_0x2eb174[_0xfdd4('0x21')];var _0x34dfa8;if(_0x36e611>=_0x52ce34){_0x36e611=_0x52ce34;_0x34dfa8=0xc8;}else{_0x34dfa8=0xce;}_0x216c7e['status'](_0x34dfa8);return _0x216c7e[_0xfdd4('0x23')](_0xfdd4('0x24'),_0x3e8eac+'-'+_0x36e611+'/'+_0x52ce34)[_0xfdd4('0x1e')](_0x2ccc88);}return null;};}function patchUpdates(_0x16e81b){return function(_0xb7856d){try{jsonpatch[_0xfdd4('0x25')](_0xb7856d,_0x16e81b,!![]);}catch(_0x451767){return BPromise[_0xfdd4('0x26')](_0x451767);}return _0xb7856d['save']();};}function saveUpdates(_0x1e14da,_0x1112e8){return function(_0x4397a3){if(_0x4397a3){return _0x4397a3['update'](_0x1e14da)[_0xfdd4('0x27')](function(_0x39b712){return _0x39b712;});}return null;};}function removeEntity(_0xf9c346,_0x2f8268){return function(_0x1ade42){if(_0x1ade42){return _0x1ade42['destroy']()[_0xfdd4('0x27')](function(){var _0x2c88ad=_0x1ade42[_0xfdd4('0x28')]({'plain':!![]});var _0x31e053=_0xfdd4('0x29');return db[_0xfdd4('0x2a')][_0xfdd4('0x2b')]({'where':{'type':_0x31e053,'resourceId':_0x2c88ad['id']}})[_0xfdd4('0x27')](function(){return _0x1ade42;});})['then'](function(){_0xf9c346[_0xfdd4('0x1c')](0xcc)[_0xfdd4('0x1d')]();});}};}function handleEntityNotFound(_0x385a68,_0xef012e){return function(_0x2207ae){if(!_0x2207ae){_0x385a68['sendStatus'](0x194);}return _0x2207ae;};}function handleError(_0xd127b1,_0x3372d2){_0x3372d2=_0x3372d2||0x1f4;return function(_0xbf38b4){logger[_0xfdd4('0x2c')](_0xbf38b4[_0xfdd4('0x2d')]);if(_0xbf38b4['name']){delete _0xbf38b4[_0xfdd4('0x2e')];}_0xd127b1[_0xfdd4('0x1c')](_0x3372d2)[_0xfdd4('0x2f')](_0xbf38b4);};}exports['index']=function(_0x3fd07a,_0x502776){var _0x2a65c8={},_0x2b22f9={},_0x4aa4f2={'count':0x0,'rows':[]};var _0x50b748=_[_0xfdd4('0x30')](db[_0xfdd4('0x31')]['rawAttributes'],function(_0x557d7b){return{'name':_0x557d7b[_0xfdd4('0x32')],'type':_0x557d7b[_0xfdd4('0x33')][_0xfdd4('0x34')]};});_0x2b22f9[_0xfdd4('0x35')]=_[_0xfdd4('0x30')](_0x50b748,_0xfdd4('0x2e'));_0x2b22f9[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x3fd07a[_0xfdd4('0x36')]);_0x2b22f9[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],_0x2b22f9[_0xfdd4('0x36')]);_0x2a65c8[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x2a65c8[_0xfdd4('0x3a')]=_0x2a65c8[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x2a65c8[_0xfdd4('0x3a')]:_0x2b22f9[_0xfdd4('0x35')];if(!_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x2a65c8[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x2a65c8[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x3fd07a['query'][_0xfdd4('0x1f')]);}_0x2a65c8['order']=qs[_0xfdd4('0x3e')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3e')]);_0x2a65c8[_0xfdd4('0x3f')]=qs['filters'](_[_0xfdd4('0x40')](_0x3fd07a[_0xfdd4('0x36')],_0x2b22f9[_0xfdd4('0x38')]),_0x50b748);if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x2a65c8[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x2a65c8[_0xfdd4('0x3f')],{'$or':_[_0xfdd4('0x30')](_0x50b748,function(_0x83673d){if(_0x83673d['type']!==_0xfdd4('0x43')){var _0x2196f={};_0x2196f[_0x83673d[_0xfdd4('0x2e')]]={'$like':'%'+_0x3fd07a[_0xfdd4('0x36')]['filter']+'%'};return _0x2196f;}})});}_0x2a65c8=_[_0xfdd4('0x42')]({},_0x2a65c8,_0x3fd07a[_0xfdd4('0x44')]);var _0x30524f={'where':_0x2a65c8[_0xfdd4('0x3f')]};return db[_0xfdd4('0x31')]['count'](_0x30524f)[_0xfdd4('0x27')](function(_0x23af2a){_0x4aa4f2[_0xfdd4('0x22')]=_0x23af2a;if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x2a65c8[_0xfdd4('0x46')]=[{'all':!![]}];}return db[_0xfdd4('0x31')]['findAll'](_0x2a65c8);})[_0xfdd4('0x27')](function(_0x586713){_0x4aa4f2[_0xfdd4('0x47')]=_0x586713;return _0x4aa4f2;})[_0xfdd4('0x27')](respondWithFilteredResult(_0x502776,_0x2a65c8))[_0xfdd4('0x48')](handleError(_0x502776,null));};exports[_0xfdd4('0x49')]=function(_0x5367aa,_0x419578){var _0x11e90a={'raw':![],'where':{'id':_0x5367aa[_0xfdd4('0x4a')]['id']}},_0x4d1dfe={};_0x4d1dfe[_0xfdd4('0x35')]=_['keys'](db[_0xfdd4('0x31')]['rawAttributes']);_0x4d1dfe['query']=_['keys'](_0x5367aa[_0xfdd4('0x36')]);_0x4d1dfe[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x4d1dfe['model'],_0x4d1dfe[_0xfdd4('0x36')]);_0x11e90a[_0xfdd4('0x3a')]=_['intersection'](_0x4d1dfe[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x11e90a[_0xfdd4('0x3a')]=_0x11e90a[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x11e90a[_0xfdd4('0x3a')]:_0x4d1dfe[_0xfdd4('0x35')];if(_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x11e90a[_0xfdd4('0x46')]=[{'all':!![]}];}_0x11e90a=_[_0xfdd4('0x42')]({},_0x11e90a,_0x5367aa[_0xfdd4('0x44')]);return db['VoicePrefix']['find'](_0x11e90a)[_0xfdd4('0x27')](handleEntityNotFound(_0x419578,null))[_0xfdd4('0x27')](respondWithResult(_0x419578,null))[_0xfdd4('0x48')](handleError(_0x419578,null));};exports[_0xfdd4('0x2b')]=function(_0x507bf5,_0x3c6828){return db[_0xfdd4('0x31')]['find']({'where':{'id':_0x507bf5['params']['id']}})['then'](handleEntityNotFound(_0x3c6828,null))['then'](removeEntity(_0x3c6828,null))['catch'](handleError(_0x3c6828,null));};exports[_0xfdd4('0x4b')]=function(_0x88e9ef,_0x3a4202){return db[_0xfdd4('0x31')][_0xfdd4('0x4b')]()[_0xfdd4('0x27')](respondWithResult(_0x3a4202,null))['catch'](handleError(_0x3a4202,null));};exports[_0xfdd4('0x4c')]=function(_0x1f521a,_0x1dd417){var _0x2355b5;return db['sequelize'][_0xfdd4('0x4d')](function(_0x8aa0ea){return db['VoicePrefix'][_0xfdd4('0x4c')](_0x1f521a[_0xfdd4('0x4e')],{'transaction':_0x8aa0ea})['then'](function(_0x5467d1){_0x2355b5=_0x5467d1[_0xfdd4('0x28')]({'plain':!![]});return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x2355b5[_0xfdd4('0x51')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x1b9979){return createVoicePrefixExtensions(_0x2355b5,_0x1b9979,_0x8aa0ea);});});})[_0xfdd4('0x27')](function(){var _0x3de4fd=_0x1f521a['user'][_0xfdd4('0x28')]({'plain':!![]});if(!_0x3de4fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3de4fd['role']===_0xfdd4('0x52')){var _0x1d9a8d=_0x2355b5;return db['UserProfileSection']['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x3de4fd[_0xfdd4('0x53')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x4dc113){if(_0x4dc113&&_0x4dc113[_0xfdd4('0x54')]===0x0){return db[_0xfdd4('0x2a')][_0xfdd4('0x4c')]({'name':_0x1d9a8d[_0xfdd4('0x2e')],'resourceId':_0x1d9a8d['id'],'type':_0x4dc113[_0xfdd4('0x2e')],'sectionId':_0x4dc113['id']},{})['then'](function(){return _0x2355b5;});}else{return _0x2355b5;}})['catch'](function(_0x483942){logger['error'](_0xfdd4('0x55'),_0x483942);throw _0x483942;});}return _0x2355b5;})[_0xfdd4('0x27')](respondWithResult(_0x1dd417,null))['catch'](handleError(_0x1dd417,null));};function Extension(_0x1eee3d,_0x2abe50,_0x4d4304,_0x45dcc8){this[_0xfdd4('0x56')]='from-sip';this[_0xfdd4('0x57')]=_0x1eee3d;this[_0xfdd4('0x58')]=_0x4d4304;this[_0xfdd4('0x33')]='system';this[_0xfdd4('0x59')]=_0xfdd4('0x5a');this[_0xfdd4('0x5b')]=_0x2abe50;this[_0xfdd4('0x5c')]=_0x45dcc8;}function createVoicePrefixExtensions(_0x5c7be,_0x562417,_0x2cc3e2){return new BPromise(function(_0x2ee4b6,_0x3be4d5){var _0x202124=new Extension(formatPrefixName(_0x5c7be[_0xfdd4('0x5d')]),0x1,_0xfdd4('0x5e'),_0xfdd4('0x5f'));_0x202124[_0xfdd4('0x60')]=_0x5c7be['id'];return db[_0xfdd4('0x4f')]['create'](_0x202124,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x2799b2){var _0x4483e1=_0x2799b2[_0xfdd4('0x28')]({'plain':!![]});var _0x3096fa=_['map'](addVoicePrefixExtensions(_0x5c7be,_0x562417),function(_0x46e7eb){_0x46e7eb[_0xfdd4('0x51')]=_0x4483e1['id'];_0x46e7eb[_0xfdd4('0x60')]=_0x5c7be['id'];return _0x46e7eb;});return db[_0xfdd4('0x4f')][_0xfdd4('0x61')](_0x3096fa,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x180ad9){if(!_0x180ad9){return _0x3be4d5(_0xfdd4('0x62'));}else{return _0x2ee4b6(_0x180ad9);}})[_0xfdd4('0x48')](function(_0x2a0dd8){return _0x3be4d5(_0x2a0dd8);});});;});};function addVoicePrefixExtensions(_0x2fff30,_0x2792c4){var _0x1205b8=[];var _0x527068=formatPrefixName(_0x2fff30[_0xfdd4('0x5d')]);_0x1205b8['push'](new Extension(_0x527068,0x2,_0xfdd4('0x63'),_0xfdd4('0x64')+_0x2fff30[_0xfdd4('0x2e')]));if(_0x2fff30[_0xfdd4('0x65')]){_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x63'),_0xfdd4('0x67')+_0x2fff30[_0xfdd4('0x65')]));}else{_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x5e'),_0xfdd4('0x68')));}_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x4,'goto',_0x2792c4['context']+','+'${EXTEN:'+(0x8+_0x2fff30[_0xfdd4('0x2e')][_0xfdd4('0x3c')])+'}'+','+0x1));return _0x1205b8;}function formatPrefixName(_0x4bb18b){var _0x3a367c='_';for(var _0x3f027b=0x0;_0x3f027b<_0x4bb18b[_0xfdd4('0x3c')];_0x3f027b++){if(_0x4bb18b[_0xfdd4('0x69')](_0x3f027b)=='-'){_0x3a367c+=_0x4bb18b[_0xfdd4('0x69')](_0x3f027b);}else{_0x3a367c+='['+_0x4bb18b['charAt'](_0x3f027b)+']';}}_0x3a367c+='.';return _0x3a367c;}exports[_0xfdd4('0x6a')]=function(_0x297432,_0x3958cd,_0x523085){var _0x366f1c=_0x297432['body'];_0x366f1c[_0xfdd4('0x5d')]=_0xfdd4('0x6b')+_0x366f1c[_0xfdd4('0x2e')]+'-';return db[_0xfdd4('0x6c')]['transaction'](function(_0x2351b6){return db[_0xfdd4('0x31')]['update'](_0x366f1c,{'where':{'id':_0x366f1c['id']},'transaction':_0x2351b6})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x2b')]({'where':{'VoicePrefixId':_0x366f1c['id']},'transaction':_0x2351b6})['then'](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x366f1c[_0xfdd4('0x51')]},'raw':!![]})['then'](function(_0x3f4337){return createVoicePrefixExtensions(_0x366f1c,_0x3f4337,_0x2351b6);});});});})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x31')][_0xfdd4('0x6d')](_0x366f1c['id']);})[_0xfdd4('0x27')](respondWithResult(_0x3958cd,null))[_0xfdd4('0x48')](handleError(_0x3958cd,null));};exports[_0xfdd4('0x6e')]=function(_0x539d3b,_0x147d54,_0x36b615){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x539d3b[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x147d54,null))[_0xfdd4('0x27')](function(_0x4987d6){if(_0x4987d6){return _0x4987d6['addAgents'](_0x539d3b[_0xfdd4('0x4e')]['ids'],_['omit'](_0x539d3b[_0xfdd4('0x4e')],['ids','id'])||{})[_0xfdd4('0x6f')](function(_0x51711a){for(var _0x4576ce=0x0;_0x4576ce<_0x539d3b[_0xfdd4('0x4e')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0x4576ce+=0x1){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':Number(_0x539d3b[_0xfdd4('0x4e')]['ids'][_0x4576ce]),'VoicePrefixId':Number(_0x539d3b['params']['id'])});}return _0x51711a;});}})[_0xfdd4('0x27')](respondWithResult(_0x147d54,null))['catch'](handleError(_0x147d54,null));};exports[_0xfdd4('0x73')]=function(_0x1a82ee,_0x3b205f,_0x1d57f8){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x1a82ee[_0xfdd4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b205f,null))['then'](function(_0x37a342){if(_0x37a342){return _0x37a342[_0xfdd4('0x73')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])[_0xfdd4('0x27')](function(){if(_[_0xfdd4('0x74')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])){for(var _0xf78c69=0x0;_0xf78c69<_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0xf78c69+=0x1){socket[_0xfdd4('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee['query'][_0xfdd4('0x70')][_0xf78c69]),'VoicePrefixId':Number(_0x1a82ee[_0xfdd4('0x4a')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')]),'VoicePrefixId':Number(_0x1a82ee['params']['id'])});}});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x3b205f,null))[_0xfdd4('0x48')](handleError(_0x3b205f,null));};exports[_0xfdd4('0x75')]=function(_0x11db43,_0x5ec62b,_0x25c078){var _0x5d356c={};var _0x3924c7={};var _0x2f65d7;var _0x4783b9;return db[_0xfdd4('0x31')][_0xfdd4('0x76')]({'where':{'id':_0x11db43[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x5ec62b,null))[_0xfdd4('0x27')](function(_0x575bc2){if(_0x575bc2){_0x2f65d7=_0x575bc2;_0x3924c7['model']=_[_0xfdd4('0x37')](db['User'][_0xfdd4('0x77')]);_0x3924c7[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x11db43[_0xfdd4('0x36')]);_0x3924c7[_0xfdd4('0x38')]=_['intersection'](_0x3924c7['model'],_0x3924c7[_0xfdd4('0x36')]);_0x5d356c['attributes']=_[_0xfdd4('0x39')](_0x3924c7['model'],qs[_0xfdd4('0x3b')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x5d356c[_0xfdd4('0x3a')]=_0x5d356c[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x5d356c[_0xfdd4('0x3a')]:_0x3924c7[_0xfdd4('0x35')];_0x5d356c[_0xfdd4('0x78')]=qs[_0xfdd4('0x3e')](_0x11db43[_0xfdd4('0x36')]['sort']);_0x5d356c[_0xfdd4('0x3f')]=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x11db43[_0xfdd4('0x36')],_0x3924c7[_0xfdd4('0x38')]));if(_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x5d356c[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x5d356c['where'],{'$or':_['map'](_0x5d356c[_0xfdd4('0x3a')],function(_0x244d6d){var _0x30bd32={};_0x30bd32[_0x244d6d]={'$like':'%'+_0x11db43['query'][_0xfdd4('0x41')]+'%'};return _0x30bd32;})});}_0x5d356c=_[_0xfdd4('0x42')]({},_0x5d356c,_0x11db43[_0xfdd4('0x44')]);return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})['then'](function(_0x5868e6){if(_0x5868e6){_0x4783b9=_0x5868e6[_0xfdd4('0x3c')];if(!_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x5d356c[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x5d356c[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x11db43['query']['offset']);}return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})[_0xfdd4('0x27')](function(_0x6a1410){if(_0x6a1410){return _0x6a1410?{'count':_0x4783b9,'rows':_0x6a1410}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x5ec62b,null))[_0xfdd4('0x48')](handleError(_0x5ec62b,null));};exports[_0xfdd4('0x79')]=function(_0x46edc9,_0x2a4366,_0x5d1a3f){var _0x218d83={};var _0x547c4c={};var _0x464eb0;var _0x1871d6;return db['VoicePrefix'][_0xfdd4('0x76')]({'where':{'id':_0x46edc9[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x2a4366,null))[_0xfdd4('0x27')](function(_0x3cd7ae){if(_0x3cd7ae){_0x464eb0=_0x3cd7ae;_0x547c4c[_0xfdd4('0x35')]=_[_0xfdd4('0x37')](db[_0xfdd4('0x7a')][_0xfdd4('0x77')]);_0x547c4c['query']=_[_0xfdd4('0x37')](_0x46edc9['query']);_0x547c4c[_0xfdd4('0x38')]=_['intersection'](_0x547c4c['model'],_0x547c4c[_0xfdd4('0x36')]);_0x218d83[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x547c4c[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x46edc9['query'][_0xfdd4('0x3b')]));_0x218d83[_0xfdd4('0x3a')]=_0x218d83[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x218d83[_0xfdd4('0x3a')]:_0x547c4c[_0xfdd4('0x35')];_0x218d83['order']=qs[_0xfdd4('0x3e')](_0x46edc9[_0xfdd4('0x36')]['sort']);_0x218d83['where']=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x46edc9[_0xfdd4('0x36')],_0x547c4c['filters']));if(_0x46edc9['query'][_0xfdd4('0x41')]){_0x218d83[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x218d83['where'],{'$or':_['map'](_0x218d83[_0xfdd4('0x3a')],function(_0xd6eb47){var _0x1927ed={};_0x1927ed[_0xd6eb47]={'$like':'%'+_0x46edc9['query'][_0xfdd4('0x41')]+'%'};return _0x1927ed;})});}_0x218d83=_['merge']({},_0x218d83,_0x46edc9[_0xfdd4('0x44')]);return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x4e1dbc){if(_0x4e1dbc){_0x1871d6=_0x4e1dbc[_0xfdd4('0x3c')];if(!_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x3d')](_0xfdd4('0x7b'))){_0x218d83[_0xfdd4('0x21')]=qs['limit'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x218d83[_0xfdd4('0x1f')]=qs['offset'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x1f')]);}return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x56e5d3){if(_0x56e5d3){return _0x56e5d3?{'count':_0x1871d6,'rows':_0x56e5d3}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x2a4366,null))['catch'](handleError(_0x2a4366,null));};exports['addTeams']=function(_0x528004,_0x206a59,_0x545475){var _0x5e5362=_0x528004['body'][_0xfdd4('0x70')];var _0x728e25;return db[_0xfdd4('0x7a')][_0xfdd4('0x7c')]({'where':{'id':_0x5e5362},'attributes':['id'],'include':[{'model':db[_0xfdd4('0x7d')],'as':_0xfdd4('0x7e'),'attributes':['id',_0xfdd4('0x2e'),_0xfdd4('0x7f'),_0xfdd4('0x80'),_0xfdd4('0x81')],'raw':!![]}]})[_0xfdd4('0x27')](function(_0x2911ca){if(_0x2911ca){_0x728e25=_0x2911ca;var _0x31303f=_[_0xfdd4('0x82')](_0x2911ca,function(_0x46b927){var _0x450c67=_0x46b927[_0xfdd4('0x28')]({'plain':!![]});return _0x450c67[_0xfdd4('0x7e')];});return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x528004[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](function(_0x189baf){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x22f93b){return _0x189baf['addTeams'](_0x5e5362,{'transaction':_0x22f93b})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x728e25,function(_0xaef5e2){return db[_0xfdd4('0x84')][_0xfdd4('0x85')]({'TeamId':_0xaef5e2['id'],'VoicePrefixId':_0x528004['params']['id']},{'transaction':_0x22f93b});});})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x31303f,function(_0x19b679){return db[_0xfdd4('0x86')][_0xfdd4('0x87')]({'where':{'UserId':_0x19b679['id'],'VoicePrefixId':_0x528004[_0xfdd4('0x4a')]['id']},'transaction':_0x22f93b});});})['then'](function(){_0x31303f[_0xfdd4('0x88')](function(_0x1a9e62){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':_0x1a9e62['id'],'VoicePrefixId':_0x189baf['id']});});});});});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x206a59,null))[_0xfdd4('0x48')](handleError(_0x206a59,null));};exports['removeTeams']=function(_0x2a6a0d,_0x3d82d1,_0x17d272){return db['Team'][_0xfdd4('0x7c')]({'where':{'id':_0x2a6a0d[_0xfdd4('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfdd4('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xfdd4('0x27')](handleEntityNotFound(_0x3d82d1,null))[_0xfdd4('0x27')](function(_0xd07645){var _0x5a3249=_[_0xfdd4('0x30')](_0xd07645,'id');var _0x5b22b1=[];var _0xc9955e=[];var _0x42204a=squel[_0xfdd4('0x89')]();_0x42204a[_0xfdd4('0x8a')](_0xfdd4('0x8b'))[_0xfdd4('0x8c')](_0xfdd4('0x8d'),'tq')[_0xfdd4('0x8e')](_0xfdd4('0x8f'),'ut',_0xfdd4('0x90'))[_0xfdd4('0x3f')]('VoicePrefixId\x20=\x20?',_0x2a6a0d[_0xfdd4('0x4a')]['id']);for(var _0x42a3dc=0x0;_0x42a3dc<_0xd07645[_0xfdd4('0x3c')];_0x42a3dc+=0x1){let _0x26316c=_0xd07645[_0x42a3dc];for(var _0x1e7bbb=0x0;_0x1e7bbb<_0x26316c[_0xfdd4('0x7e')]['length'];_0x1e7bbb+=0x1){let _0xfd0c1=_0x26316c[_0xfdd4('0x7e')][_0x1e7bbb];var _0x2ae92=_0x42204a[_0xfdd4('0x91')]();_0x2ae92['where'](_0xfdd4('0x92'),_0xfd0c1['id']);_0xc9955e[_0xfdd4('0x66')](db['sequelize'][_0xfdd4('0x36')](_0x2ae92[_0xfdd4('0x93')](),{'type':db[_0xfdd4('0x6c')][_0xfdd4('0x94')][_0xfdd4('0x95')]})[_0xfdd4('0x27')](function(_0x191ab6){if(_0x191ab6[_0xfdd4('0x3c')]===0x1){return _0xfd0c1['id'];}else{var _0x1d460f=_[_0xfdd4('0x96')](_[_0xfdd4('0x30')](_0x191ab6,_0xfdd4('0x97')),function(_0x25c508){return _[_0xfdd4('0x98')](_0x5a3249,_0x25c508);});if(_0x1d460f){return _0xfd0c1['id'];}}}));}}return BPromise['all'](_0xc9955e)[_0xfdd4('0x27')](function(_0x349fc6){_0x5b22b1=_(_0x5b22b1)[_0xfdd4('0x99')](_0x349fc6)[_0xfdd4('0x9a')]()['value']();return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x2a6a0d['params']['id']}})[_0xfdd4('0x27')](function(_0x401681){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x5a7c85){return _0x401681[_0xfdd4('0x9b')](_0x2a6a0d['query'][_0xfdd4('0x70')],{'transaction':_0x5a7c85})[_0xfdd4('0x27')](function(){if(!_['isEmpty'](_0x5b22b1)){return _0x401681[_0xfdd4('0x73')](_0x5b22b1,{'transaction':_0x5a7c85});}})['then'](function(){_0x5b22b1['forEach'](function(_0x10a396){socket[_0xfdd4('0x71')](_0xfdd4('0x9c'),{'UserId':_0x10a396,'VoicePrefixId':_0x401681['id']});});});});});});})[_0xfdd4('0x27')](respondWithStatusCode(_0x3d82d1,null))['catch'](handleError(_0x3d82d1,null));}; \ No newline at end of file +var _0xd4a2=['appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','nolimit','getTeams','Team','Agents','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','isEmpty','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','show','include','options','find','catch','params','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4a2,0x173));var _0x2d4a=function(_0x551681,_0x4d2431){_0x551681=_0x551681-0x0;var _0x44c33d=_0xd4a2[_0x551681];return _0x44c33d;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];config[_0x2d4a('0x17')]=_[_0x2d4a('0x18')](config[_0x2d4a('0x17')],{'host':_0x2d4a('0x19'),'port':0x18eb});var socket=require(_0x2d4a('0x1a'))(new Redis(config[_0x2d4a('0x17')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x2a1d0f,_0x5b6c4f){_0x5b6c4f=_0x5b6c4f||0xcc;return function(_0x11c64a){if(_0x11c64a){return _0x2a1d0f[_0x2d4a('0x1b')](_0x5b6c4f);}return _0x2a1d0f[_0x2d4a('0x1c')](_0x5b6c4f)[_0x2d4a('0x1d')]();};}function respondWithResult(_0x4c5287,_0x5f825d){_0x5f825d=_0x5f825d||0xc8;return function(_0x5a6378){if(_0x5a6378){return _0x4c5287[_0x2d4a('0x1c')](_0x5f825d)['json'](_0x5a6378);}};}function respondWithFilteredResult(_0x435687,_0xd1dd52){return function(_0x2188b2){if(_0x2188b2){var _0x388371=typeof _0xd1dd52['offset']==='undefined'&&typeof _0xd1dd52['limit']===_0x2d4a('0x1e');var _0x1966d1=_0x2188b2[_0x2d4a('0x1f')];var _0x419df5=_0x388371?0x0:_0xd1dd52[_0x2d4a('0x20')];var _0x2e4069=_0x388371?_0x2188b2['count']:_0xd1dd52['offset']+_0xd1dd52[_0x2d4a('0x21')];var _0x1f3e17;if(_0x2e4069>=_0x1966d1){_0x2e4069=_0x1966d1;_0x1f3e17=0xc8;}else{_0x1f3e17=0xce;}_0x435687[_0x2d4a('0x1c')](_0x1f3e17);return _0x435687[_0x2d4a('0x22')](_0x2d4a('0x23'),_0x419df5+'-'+_0x2e4069+'/'+_0x1966d1)[_0x2d4a('0x24')](_0x2188b2);}return null;};}function patchUpdates(_0x22dd0b){return function(_0xa43fb1){try{jsonpatch['apply'](_0xa43fb1,_0x22dd0b,!![]);}catch(_0x26e7b8){return BPromise[_0x2d4a('0x25')](_0x26e7b8);}return _0xa43fb1[_0x2d4a('0x26')]();};}function saveUpdates(_0x42d813,_0x2c845c){return function(_0xed2822){if(_0xed2822){return _0xed2822[_0x2d4a('0x27')](_0x42d813)[_0x2d4a('0x28')](function(_0x54c910){return _0x54c910;});}return null;};}function removeEntity(_0x544b9b,_0x5cc7d8){return function(_0x2bb9f0){if(_0x2bb9f0){return _0x2bb9f0['destroy']()[_0x2d4a('0x28')](function(){var _0x3a2fd3=_0x2bb9f0[_0x2d4a('0x29')]({'plain':!![]});var _0x1d2fa6=_0x2d4a('0x2a');return db[_0x2d4a('0x2b')][_0x2d4a('0x2c')]({'where':{'type':_0x1d2fa6,'resourceId':_0x3a2fd3['id']}})[_0x2d4a('0x28')](function(){return _0x2bb9f0;});})['then'](function(){_0x544b9b[_0x2d4a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221602,_0x9bac28){return function(_0xc497ce){if(!_0xc497ce){_0x221602[_0x2d4a('0x1b')](0x194);}return _0xc497ce;};}function handleError(_0x101382,_0x1dfc5d){_0x1dfc5d=_0x1dfc5d||0x1f4;return function(_0x25ac5c){logger[_0x2d4a('0x2d')](_0x25ac5c['stack']);if(_0x25ac5c[_0x2d4a('0x2e')]){delete _0x25ac5c[_0x2d4a('0x2e')];}_0x101382[_0x2d4a('0x1c')](_0x1dfc5d)[_0x2d4a('0x2f')](_0x25ac5c);};}exports[_0x2d4a('0x30')]=function(_0x57bf71,_0x217653){var _0x31d8ae={},_0x27015d={},_0x24bcc2={'count':0x0,'rows':[]};var _0x2bb93d=_['map'](db[_0x2d4a('0x31')][_0x2d4a('0x32')],function(_0x46b623){return{'name':_0x46b623[_0x2d4a('0x33')],'type':_0x46b623[_0x2d4a('0x34')][_0x2d4a('0x35')]};});_0x27015d['model']=_[_0x2d4a('0x36')](_0x2bb93d,_0x2d4a('0x2e'));_0x27015d[_0x2d4a('0x37')]=_[_0x2d4a('0x38')](_0x57bf71[_0x2d4a('0x37')]);_0x27015d['filters']=_[_0x2d4a('0x39')](_0x27015d[_0x2d4a('0x3a')],_0x27015d['query']);_0x31d8ae[_0x2d4a('0x3b')]=_[_0x2d4a('0x39')](_0x27015d[_0x2d4a('0x3a')],qs[_0x2d4a('0x3c')](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x3c')]));_0x31d8ae['attributes']=_0x31d8ae[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x31d8ae[_0x2d4a('0x3b')]:_0x27015d[_0x2d4a('0x3a')];if(!_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x3e')]('nolimit')){_0x31d8ae['limit']=qs[_0x2d4a('0x21')](_0x57bf71['query'][_0x2d4a('0x21')]);_0x31d8ae[_0x2d4a('0x20')]=qs['offset'](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x20')]);}_0x31d8ae[_0x2d4a('0x3f')]=qs[_0x2d4a('0x40')](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x40')]);_0x31d8ae[_0x2d4a('0x41')]=qs[_0x2d4a('0x42')](_[_0x2d4a('0x43')](_0x57bf71[_0x2d4a('0x37')],_0x27015d[_0x2d4a('0x42')]),_0x2bb93d);if(_0x57bf71['query'][_0x2d4a('0x44')]){_0x31d8ae[_0x2d4a('0x41')]=_[_0x2d4a('0x45')](_0x31d8ae[_0x2d4a('0x41')],{'$or':_[_0x2d4a('0x36')](_0x2bb93d,function(_0x483a40){if(_0x483a40['type']!=='VIRTUAL'){var _0x5af510={};_0x5af510[_0x483a40[_0x2d4a('0x2e')]]={'$like':'%'+_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x44')]+'%'};return _0x5af510;}})});}_0x31d8ae=_[_0x2d4a('0x45')]({},_0x31d8ae,_0x57bf71['options']);var _0x155f2d={'where':_0x31d8ae[_0x2d4a('0x41')]};return db['VoicePrefix'][_0x2d4a('0x1f')](_0x155f2d)[_0x2d4a('0x28')](function(_0x8a9375){_0x24bcc2[_0x2d4a('0x1f')]=_0x8a9375;if(_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x46')]){_0x31d8ae['include']=[{'all':!![]}];}return db[_0x2d4a('0x31')][_0x2d4a('0x47')](_0x31d8ae);})[_0x2d4a('0x28')](function(_0x365399){_0x24bcc2[_0x2d4a('0x48')]=_0x365399;return _0x24bcc2;})[_0x2d4a('0x28')](respondWithFilteredResult(_0x217653,_0x31d8ae))['catch'](handleError(_0x217653,null));};exports[_0x2d4a('0x49')]=function(_0x1f08a3,_0x10b723){var _0x4e1901={'raw':![],'where':{'id':_0x1f08a3['params']['id']}},_0x2585db={};_0x2585db[_0x2d4a('0x3a')]=_[_0x2d4a('0x38')](db[_0x2d4a('0x31')][_0x2d4a('0x32')]);_0x2585db[_0x2d4a('0x37')]=_['keys'](_0x1f08a3['query']);_0x2585db[_0x2d4a('0x42')]=_[_0x2d4a('0x39')](_0x2585db['model'],_0x2585db[_0x2d4a('0x37')]);_0x4e1901['attributes']=_[_0x2d4a('0x39')](_0x2585db[_0x2d4a('0x3a')],qs[_0x2d4a('0x3c')](_0x1f08a3['query'][_0x2d4a('0x3c')]));_0x4e1901['attributes']=_0x4e1901[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x4e1901[_0x2d4a('0x3b')]:_0x2585db[_0x2d4a('0x3a')];if(_0x1f08a3[_0x2d4a('0x37')][_0x2d4a('0x46')]){_0x4e1901[_0x2d4a('0x4a')]=[{'all':!![]}];}_0x4e1901=_[_0x2d4a('0x45')]({},_0x4e1901,_0x1f08a3[_0x2d4a('0x4b')]);return db[_0x2d4a('0x31')][_0x2d4a('0x4c')](_0x4e1901)['then'](handleEntityNotFound(_0x10b723,null))[_0x2d4a('0x28')](respondWithResult(_0x10b723,null))[_0x2d4a('0x4d')](handleError(_0x10b723,null));};exports[_0x2d4a('0x2c')]=function(_0x1467ab,_0x2d2e24){return db['VoicePrefix'][_0x2d4a('0x4c')]({'where':{'id':_0x1467ab[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x2d2e24,null))[_0x2d4a('0x28')](removeEntity(_0x2d2e24,null))[_0x2d4a('0x4d')](handleError(_0x2d2e24,null));};exports['describe']=function(_0x4b9a52,_0x43e74a){return db[_0x2d4a('0x31')]['describe']()[_0x2d4a('0x28')](respondWithResult(_0x43e74a,null))[_0x2d4a('0x4d')](handleError(_0x43e74a,null));};exports[_0x2d4a('0x4f')]=function(_0x19109b,_0x52a468){var _0x31576d;return db['sequelize'][_0x2d4a('0x50')](function(_0x3fe91b){return db[_0x2d4a('0x31')][_0x2d4a('0x4f')](_0x19109b[_0x2d4a('0x51')],{'transaction':_0x3fe91b})[_0x2d4a('0x28')](function(_0x25fb59){_0x31576d=_0x25fb59[_0x2d4a('0x29')]({'plain':!![]});return db['VoiceExtension'][_0x2d4a('0x4c')]({'where':{'id':_0x31576d[_0x2d4a('0x52')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x67ddff){return createVoicePrefixExtensions(_0x31576d,_0x67ddff,_0x3fe91b);});});})[_0x2d4a('0x28')](function(){var _0x334d6a=_0x19109b[_0x2d4a('0x53')][_0x2d4a('0x29')]({'plain':!![]});if(!_0x334d6a)throw new Error(_0x2d4a('0x54'));if(_0x334d6a[_0x2d4a('0x55')]===_0x2d4a('0x53')){var _0x113bc4=_0x31576d;return db[_0x2d4a('0x56')][_0x2d4a('0x4c')]({'where':{'name':_0x2d4a('0x2a'),'userProfileId':_0x334d6a[_0x2d4a('0x57')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x4cce5e){if(_0x4cce5e&&_0x4cce5e[_0x2d4a('0x58')]===0x0){return db[_0x2d4a('0x2b')]['create']({'name':_0x113bc4[_0x2d4a('0x2e')],'resourceId':_0x113bc4['id'],'type':_0x4cce5e[_0x2d4a('0x2e')],'sectionId':_0x4cce5e['id']},{})[_0x2d4a('0x28')](function(){return _0x31576d;});}else{return _0x31576d;}})[_0x2d4a('0x4d')](function(_0x165c00){logger[_0x2d4a('0x2d')](_0x2d4a('0x59'),_0x165c00);throw _0x165c00;});}return _0x31576d;})[_0x2d4a('0x28')](respondWithResult(_0x52a468,null))[_0x2d4a('0x4d')](handleError(_0x52a468,null));};function Extension(_0x352b50,_0x346f2b,_0x302323,_0x5c7cf9){this[_0x2d4a('0x5a')]=_0x2d4a('0x5b');this['exten']=_0x352b50;this[_0x2d4a('0x5c')]=_0x302323;this[_0x2d4a('0x34')]=_0x2d4a('0x5d');this[_0x2d4a('0x5e')]=_0x2d4a('0x5f');this[_0x2d4a('0x60')]=_0x346f2b;this[_0x2d4a('0x61')]=_0x5c7cf9;}function createVoicePrefixExtensions(_0x43e6a6,_0x1034d2,_0x282df8){return new BPromise(function(_0x5bbc96,_0x2bd137){var _0x8ae6bd=new Extension(formatPrefixName(_0x43e6a6[_0x2d4a('0x62')]),0x1,'NoOp',_0x2d4a('0x63'));_0x8ae6bd[_0x2d4a('0x64')]=_0x43e6a6['id'];return db[_0x2d4a('0x65')][_0x2d4a('0x4f')](_0x8ae6bd,{'transaction':_0x282df8})[_0x2d4a('0x28')](function(_0x278bbc){var _0x7e2699=_0x278bbc[_0x2d4a('0x29')]({'plain':!![]});var _0x1ed616=_['map'](addVoicePrefixExtensions(_0x43e6a6,_0x1034d2),function(_0x21b8e9){_0x21b8e9[_0x2d4a('0x52')]=_0x7e2699['id'];_0x21b8e9[_0x2d4a('0x64')]=_0x43e6a6['id'];return _0x21b8e9;});return db[_0x2d4a('0x65')][_0x2d4a('0x66')](_0x1ed616,{'transaction':_0x282df8})[_0x2d4a('0x28')](function(_0x53f52b){if(!_0x53f52b){return _0x2bd137(_0x2d4a('0x67'));}else{return _0x5bbc96(_0x53f52b);}})[_0x2d4a('0x4d')](function(_0x22707f){return _0x2bd137(_0x22707f);});});;});};function addVoicePrefixExtensions(_0x4809af,_0x465c89){var _0x442691=[];var _0x4f4a09=formatPrefixName(_0x4809af[_0x2d4a('0x62')]);_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x2,'Set',_0x2d4a('0x69')+_0x4809af['name']));if(_0x4809af['callerIdAll']){_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x3,_0x2d4a('0x6a'),_0x2d4a('0x6b')+_0x4809af[_0x2d4a('0x6c')]));}else{_0x442691['push'](new Extension(_0x4f4a09,0x3,_0x2d4a('0x6d'),_0x2d4a('0x6e')));}_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x4,_0x2d4a('0x6f'),_0x465c89['context']+','+'${EXTEN:'+(0x8+_0x4809af[_0x2d4a('0x2e')][_0x2d4a('0x3d')])+'}'+','+0x1));return _0x442691;}function formatPrefixName(_0x2a2441){var _0x2aa9e8='_';for(var _0x9e6321=0x0;_0x9e6321<_0x2a2441[_0x2d4a('0x3d')];_0x9e6321++){if(_0x2a2441[_0x2d4a('0x70')](_0x9e6321)=='-'){_0x2aa9e8+=_0x2a2441['charAt'](_0x9e6321);}else{_0x2aa9e8+='['+_0x2a2441[_0x2d4a('0x70')](_0x9e6321)+']';}}_0x2aa9e8+='.';return _0x2aa9e8;}exports[_0x2d4a('0x27')]=function(_0xf3d514,_0x398439,_0x59810d){var _0x299bdf=_0xf3d514[_0x2d4a('0x51')];_0x299bdf[_0x2d4a('0x62')]=_0x2d4a('0x71')+_0x299bdf['name']+'-';return db[_0x2d4a('0x72')][_0x2d4a('0x50')](function(_0x55d565){return db[_0x2d4a('0x31')][_0x2d4a('0x27')](_0x299bdf,{'where':{'id':_0x299bdf['id']},'transaction':_0x55d565})[_0x2d4a('0x28')](function(){return db['VoiceExtension'][_0x2d4a('0x2c')]({'where':{'VoicePrefixId':_0x299bdf['id']},'transaction':_0x55d565})[_0x2d4a('0x28')](function(){return db[_0x2d4a('0x65')][_0x2d4a('0x4c')]({'where':{'id':_0x299bdf[_0x2d4a('0x52')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x3bc965){return createVoicePrefixExtensions(_0x299bdf,_0x3bc965,_0x55d565);});});});})['then'](function(){return db[_0x2d4a('0x31')][_0x2d4a('0x73')](_0x299bdf['id']);})[_0x2d4a('0x28')](respondWithResult(_0x398439,null))[_0x2d4a('0x4d')](handleError(_0x398439,null));};exports[_0x2d4a('0x74')]=function(_0x55ebbb,_0x38e623,_0x5aead3){return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x55ebbb[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x38e623,null))[_0x2d4a('0x28')](function(_0x2ba9c2){if(_0x2ba9c2){return _0x2ba9c2[_0x2d4a('0x74')](_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')],_[_0x2d4a('0x76')](_0x55ebbb['body'],[_0x2d4a('0x75'),'id'])||{})['spread'](function(_0x3d7d7d){for(var _0x3c284d=0x0;_0x3c284d<_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')][_0x2d4a('0x3d')];_0x3c284d+=0x1){socket[_0x2d4a('0x77')](_0x2d4a('0x78'),{'UserId':Number(_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')][_0x3c284d]),'VoicePrefixId':Number(_0x55ebbb['params']['id'])});}return _0x3d7d7d;});}})[_0x2d4a('0x28')](respondWithResult(_0x38e623,null))[_0x2d4a('0x4d')](handleError(_0x38e623,null));};exports[_0x2d4a('0x79')]=function(_0xcdf787,_0x574285,_0x36d253){return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0xcdf787[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x574285,null))[_0x2d4a('0x28')](function(_0x5769be){if(_0x5769be){return _0x5769be[_0x2d4a('0x79')](_0xcdf787[_0x2d4a('0x37')]['ids'])[_0x2d4a('0x28')](function(){if(_[_0x2d4a('0x7a')](_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')])){for(var _0x429579=0x0;_0x429579<_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')][_0x2d4a('0x3d')];_0x429579+=0x1){socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':Number(_0xcdf787['query'][_0x2d4a('0x75')][_0x429579]),'VoicePrefixId':Number(_0xcdf787['params']['id'])});}}else{socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':Number(_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')]),'VoicePrefixId':Number(_0xcdf787[_0x2d4a('0x4e')]['id'])});}});}})[_0x2d4a('0x28')](respondWithStatusCode(_0x574285,null))[_0x2d4a('0x4d')](handleError(_0x574285,null));};exports['getAgents']=function(_0x119c59,_0x2ebb9e,_0xc11b2e){var _0xfc7b53={};var _0x47377e={};var _0x5e7f23;var _0x4ebda1;return db['VoicePrefix'][_0x2d4a('0x7c')]({'where':{'id':_0x119c59[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x2ebb9e,null))['then'](function(_0x135f58){if(_0x135f58){_0x5e7f23=_0x135f58;_0x47377e[_0x2d4a('0x3a')]=_[_0x2d4a('0x38')](db[_0x2d4a('0x7d')][_0x2d4a('0x32')]);_0x47377e[_0x2d4a('0x37')]=_['keys'](_0x119c59[_0x2d4a('0x37')]);_0x47377e['filters']=_[_0x2d4a('0x39')](_0x47377e[_0x2d4a('0x3a')],_0x47377e['query']);_0xfc7b53[_0x2d4a('0x3b')]=_['intersection'](_0x47377e['model'],qs['fields'](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x3c')]));_0xfc7b53[_0x2d4a('0x3b')]=_0xfc7b53['attributes'][_0x2d4a('0x3d')]?_0xfc7b53[_0x2d4a('0x3b')]:_0x47377e[_0x2d4a('0x3a')];_0xfc7b53[_0x2d4a('0x3f')]=qs['sort'](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x40')]);_0xfc7b53['where']=qs[_0x2d4a('0x42')](_[_0x2d4a('0x43')](_0x119c59['query'],_0x47377e[_0x2d4a('0x42')]));if(_0x119c59['query']['filter']){_0xfc7b53[_0x2d4a('0x41')]=_['merge'](_0xfc7b53[_0x2d4a('0x41')],{'$or':_[_0x2d4a('0x36')](_0xfc7b53[_0x2d4a('0x3b')],function(_0x44d3b3){var _0x5e939f={};_0x5e939f[_0x44d3b3]={'$like':'%'+_0x119c59[_0x2d4a('0x37')]['filter']+'%'};return _0x5e939f;})});}_0xfc7b53=_[_0x2d4a('0x45')]({},_0xfc7b53,_0x119c59[_0x2d4a('0x4b')]);return _0x5e7f23[_0x2d4a('0x7e')](_0xfc7b53);}})[_0x2d4a('0x28')](function(_0x45f6b7){if(_0x45f6b7){_0x4ebda1=_0x45f6b7['length'];if(!_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x3e')](_0x2d4a('0x7f'))){_0xfc7b53['limit']=qs[_0x2d4a('0x21')](_0x119c59['query']['limit']);_0xfc7b53[_0x2d4a('0x20')]=qs[_0x2d4a('0x20')](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x20')]);}return _0x5e7f23[_0x2d4a('0x7e')](_0xfc7b53);}})[_0x2d4a('0x28')](function(_0x2bffb4){if(_0x2bffb4){return _0x2bffb4?{'count':_0x4ebda1,'rows':_0x2bffb4}:null;}})[_0x2d4a('0x28')](respondWithResult(_0x2ebb9e,null))[_0x2d4a('0x4d')](handleError(_0x2ebb9e,null));};exports[_0x2d4a('0x80')]=function(_0x5ecf3e,_0x16c4fd,_0x2b29b1){var _0x4647cb={};var _0x10d86c={};var _0x36b067;var _0x1cb5b3;return db[_0x2d4a('0x31')][_0x2d4a('0x7c')]({'where':{'id':_0x5ecf3e['params']['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x16c4fd,null))[_0x2d4a('0x28')](function(_0xa4c947){if(_0xa4c947){_0x36b067=_0xa4c947;_0x10d86c['model']=_[_0x2d4a('0x38')](db['Team'][_0x2d4a('0x32')]);_0x10d86c[_0x2d4a('0x37')]=_[_0x2d4a('0x38')](_0x5ecf3e[_0x2d4a('0x37')]);_0x10d86c['filters']=_[_0x2d4a('0x39')](_0x10d86c['model'],_0x10d86c[_0x2d4a('0x37')]);_0x4647cb[_0x2d4a('0x3b')]=_[_0x2d4a('0x39')](_0x10d86c['model'],qs[_0x2d4a('0x3c')](_0x5ecf3e['query'][_0x2d4a('0x3c')]));_0x4647cb[_0x2d4a('0x3b')]=_0x4647cb[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x4647cb[_0x2d4a('0x3b')]:_0x10d86c[_0x2d4a('0x3a')];_0x4647cb[_0x2d4a('0x3f')]=qs[_0x2d4a('0x40')](_0x5ecf3e[_0x2d4a('0x37')]['sort']);_0x4647cb['where']=qs['filters'](_[_0x2d4a('0x43')](_0x5ecf3e['query'],_0x10d86c[_0x2d4a('0x42')]));if(_0x5ecf3e['query'][_0x2d4a('0x44')]){_0x4647cb[_0x2d4a('0x41')]=_['merge'](_0x4647cb['where'],{'$or':_[_0x2d4a('0x36')](_0x4647cb['attributes'],function(_0x279c26){var _0x643012={};_0x643012[_0x279c26]={'$like':'%'+_0x5ecf3e[_0x2d4a('0x37')]['filter']+'%'};return _0x643012;})});}_0x4647cb=_[_0x2d4a('0x45')]({},_0x4647cb,_0x5ecf3e[_0x2d4a('0x4b')]);return _0x36b067[_0x2d4a('0x80')](_0x4647cb);}})[_0x2d4a('0x28')](function(_0x1c3c0f){if(_0x1c3c0f){_0x1cb5b3=_0x1c3c0f[_0x2d4a('0x3d')];if(!_0x5ecf3e[_0x2d4a('0x37')][_0x2d4a('0x3e')](_0x2d4a('0x7f'))){_0x4647cb[_0x2d4a('0x21')]=qs[_0x2d4a('0x21')](_0x5ecf3e[_0x2d4a('0x37')]['limit']);_0x4647cb[_0x2d4a('0x20')]=qs[_0x2d4a('0x20')](_0x5ecf3e[_0x2d4a('0x37')]['offset']);}return _0x36b067[_0x2d4a('0x80')](_0x4647cb);}})[_0x2d4a('0x28')](function(_0x250a9c){if(_0x250a9c){return _0x250a9c?{'count':_0x1cb5b3,'rows':_0x250a9c}:null;}})[_0x2d4a('0x28')](respondWithResult(_0x16c4fd,null))[_0x2d4a('0x4d')](handleError(_0x16c4fd,null));};exports['addTeams']=function(_0x438769,_0x1483af,_0x5413c1){var _0x2d5122=_0x438769['body'][_0x2d4a('0x75')];var _0x1cd7fd;return db[_0x2d4a('0x81')][_0x2d4a('0x47')]({'where':{'id':_0x2d5122},'attributes':['id'],'include':[{'model':db[_0x2d4a('0x7d')],'as':_0x2d4a('0x82'),'attributes':['id',_0x2d4a('0x2e'),'online',_0x2d4a('0x83'),_0x2d4a('0x84')],'raw':!![]}]})[_0x2d4a('0x28')](function(_0x1e5be2){if(_0x1e5be2){_0x1cd7fd=_0x1e5be2;var _0x139e4e=_[_0x2d4a('0x85')](_0x1e5be2,function(_0x58b196){var _0x23577f=_0x58b196[_0x2d4a('0x29')]({'plain':!![]});return _0x23577f[_0x2d4a('0x82')];});return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x438769['params']['id']}})['then'](function(_0x3e276d){return db[_0x2d4a('0x72')][_0x2d4a('0x50')](function(_0x2fee11){return _0x3e276d[_0x2d4a('0x86')](_0x2d5122,{'transaction':_0x2fee11})[_0x2d4a('0x28')](function(){return BPromise[_0x2d4a('0x87')](_0x1cd7fd,function(_0x1adcbc){return db[_0x2d4a('0x88')]['upsert']({'TeamId':_0x1adcbc['id'],'VoicePrefixId':_0x438769['params']['id']},{'transaction':_0x2fee11});});})[_0x2d4a('0x28')](function(){return BPromise[_0x2d4a('0x87')](_0x139e4e,function(_0x3b4585){return db[_0x2d4a('0x89')][_0x2d4a('0x8a')]({'where':{'UserId':_0x3b4585['id'],'VoicePrefixId':_0x438769[_0x2d4a('0x4e')]['id']},'transaction':_0x2fee11});});})[_0x2d4a('0x28')](function(){_0x139e4e[_0x2d4a('0x8b')](function(_0x12914d){socket[_0x2d4a('0x77')](_0x2d4a('0x78'),{'UserId':_0x12914d['id'],'VoicePrefixId':_0x3e276d['id']});});});});});}})[_0x2d4a('0x28')](respondWithStatusCode(_0x1483af,null))['catch'](handleError(_0x1483af,null));};exports['removeTeams']=function(_0x51cba2,_0x448b4d,_0x4cefec){return db['Team'][_0x2d4a('0x47')]({'where':{'id':_0x51cba2[_0x2d4a('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2d4a('0x28')](handleEntityNotFound(_0x448b4d,null))[_0x2d4a('0x28')](function(_0x1e05c5){var _0x3e199a=_[_0x2d4a('0x36')](_0x1e05c5,'id');var _0x357dfc=[];var _0xd80165=[];var _0x448664=squel[_0x2d4a('0x8c')]();_0x448664[_0x2d4a('0x8d')]('tq.TeamId')[_0x2d4a('0x8e')](_0x2d4a('0x8f'),'tq')[_0x2d4a('0x90')](_0x2d4a('0x91'),'ut',_0x2d4a('0x92'))[_0x2d4a('0x41')]('VoicePrefixId\x20=\x20?',_0x51cba2[_0x2d4a('0x4e')]['id']);for(var _0x3030e1=0x0;_0x3030e1<_0x1e05c5['length'];_0x3030e1+=0x1){let _0xc5500=_0x1e05c5[_0x3030e1];for(var _0xe198b=0x0;_0xe198b<_0xc5500['Agents']['length'];_0xe198b+=0x1){let _0x497b03=_0xc5500['Agents'][_0xe198b];var _0xb81202=_0x448664['clone']();_0xb81202[_0x2d4a('0x41')](_0x2d4a('0x93'),_0x497b03['id']);_0xd80165[_0x2d4a('0x68')](db[_0x2d4a('0x72')][_0x2d4a('0x37')](_0xb81202[_0x2d4a('0x94')](),{'type':db[_0x2d4a('0x72')]['QueryTypes'][_0x2d4a('0x95')]})['then'](function(_0x2b6040){if(_0x2b6040[_0x2d4a('0x3d')]===0x1){return _0x497b03['id'];}else{var _0x137c57=_[_0x2d4a('0x96')](_[_0x2d4a('0x36')](_0x2b6040,_0x2d4a('0x97')),function(_0x29108f){return _['includes'](_0x3e199a,_0x29108f);});if(_0x137c57){return _0x497b03['id'];}}}));}}return BPromise[_0x2d4a('0x98')](_0xd80165)['then'](function(_0x1d4cc3){_0x357dfc=_(_0x357dfc)[_0x2d4a('0x99')](_0x1d4cc3)[_0x2d4a('0x9a')]()['value']();return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x51cba2[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](function(_0x108cd1){return db[_0x2d4a('0x72')]['transaction'](function(_0x29a294){return _0x108cd1['removeTeams'](_0x51cba2[_0x2d4a('0x37')]['ids'],{'transaction':_0x29a294})['then'](function(){if(!_[_0x2d4a('0x9b')](_0x357dfc)){return _0x108cd1['removeAgents'](_0x357dfc,{'transaction':_0x29a294});}})['then'](function(){_0x357dfc[_0x2d4a('0x8b')](function(_0x206717){socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':_0x206717,'VoicePrefixId':_0x108cd1['id']});});});});});});})[_0x2d4a('0x28')](respondWithStatusCode(_0x448b4d,null))[_0x2d4a('0x4d')](handleError(_0x448b4d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b269216..03a1cb8 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 _0x4eb5=['../../mysqldb','VoicePrefix','setMaxListeners','remove','emit','hook','exports'];(function(_0x4d73bf,_0x49736c){var _0x529da7=function(_0x174a34){while(--_0x174a34){_0x4d73bf['push'](_0x4d73bf['shift']());}};_0x529da7(++_0x49736c);}(_0x4eb5,0x150));var _0x54eb=function(_0x3ad227,_0x5abebe){_0x3ad227=_0x3ad227-0x0;var _0x41d5d5=_0x4eb5[_0x3ad227];return _0x41d5d5;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x54eb('0x0'))['db'][_0x54eb('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x54eb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x54eb('0x3')};function emitEvent(_0x59e4f4){return function(_0x434466,_0xb67579,_0x37b4b5){VoicePrefixEvents[_0x54eb('0x4')](_0x59e4f4+':'+_0x434466['id'],_0x434466);VoicePrefixEvents['emit'](_0x59e4f4,_0x434466);_0x37b4b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x54eb('0x5')](e,emitEvent(event));}}module[_0x54eb('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0x61cb=['exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4da372,_0x1d51b7){var _0x2e4d0e=function(_0x39fad4){while(--_0x39fad4){_0x4da372['push'](_0x4da372['shift']());}};_0x2e4d0e(++_0x1d51b7);}(_0x61cb,0x18d));var _0xb61c=function(_0x4ffa11,_0x120051){_0x4ffa11=_0x4ffa11-0x0;var _0x1f669d=_0x61cb[_0x4ffa11];return _0x1f669d;};'use strict';var EventEmitter=require(_0xb61c('0x0'));var VoicePrefix=require(_0xb61c('0x1'))['db'][_0xb61c('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb61c('0x3')](0x0);var events={'afterCreate':_0xb61c('0x4'),'afterUpdate':_0xb61c('0x5'),'afterDestroy':_0xb61c('0x6')};function emitEvent(_0x3ad53a){return function(_0x11913d,_0xb0fa7b,_0x5aa693){VoicePrefixEvents[_0xb61c('0x7')](_0x3ad53a+':'+_0x11913d['id'],_0x11913d);VoicePrefixEvents['emit'](_0x3ad53a,_0x11913d);_0x5aa693(null);};}for(var e in events){if(events[_0xb61c('0x8')](e)){var event=events[e];VoicePrefix[_0xb61c('0x9')](e,emitEvent(event));}}module[_0xb61c('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index bce4366..9f3a27d 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 _0x89fc=['voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x4ac8ef,_0x5c2c6e){var _0x3a9239=function(_0x3d004e){while(--_0x3d004e){_0x4ac8ef['push'](_0x4ac8ef['shift']());}};_0x3a9239(++_0x5c2c6e);}(_0x89fc,0xaa));var _0xc89f=function(_0x50b85,_0x1fa97e){_0x50b85=_0x50b85-0x0;var _0x2a4a75=_0x89fc[_0x50b85];return _0x2a4a75;};'use strict';var _=require(_0xc89f('0x0'));var util=require(_0xc89f('0x1'));var logger=require(_0xc89f('0x2'))(_0xc89f('0x3'));var moment=require(_0xc89f('0x4'));var BPromise=require(_0xc89f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc89f('0x6'));var config=require(_0xc89f('0x7'));var attributes=require(_0xc89f('0x8'));module[_0xc89f('0x9')]=function(_0xedc13d,_0x41ae2f){return _0xedc13d[_0xc89f('0xa')](_0xc89f('0xb'),attributes,{'tableName':_0xc89f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0eec=['./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x343329,_0x2a2570){var _0x343948=function(_0x2a936a){while(--_0x2a936a){_0x343329['push'](_0x343329['shift']());}};_0x343948(++_0x2a2570);}(_0x0eec,0xd5));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require(_0xc0ee('0x1'));var logger=require(_0xc0ee('0x2'))(_0xc0ee('0x3'));var moment=require(_0xc0ee('0x4'));var BPromise=require('bluebird');var rp=require(_0xc0ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0ee('0x6'));var config=require('../../config/environment');var attributes=require(_0xc0ee('0x7'));module[_0xc0ee('0x8')]=function(_0x5c9a1b,_0x501726){return _0x5c9a1b[_0xc0ee('0x9')](_0xc0ee('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index ba5a3f0..fd54d21 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 _0xdeb3=['request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xdeb3,0xb7));var _0x3deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var moment=require(_0x3deb('0x1'));var BPromise=require(_0x3deb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3deb('0x3'))['db'];var utils=require(_0x3deb('0x4'));var logger=require(_0x3deb('0x5'))(_0x3deb('0x6'));var config=require(_0x3deb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3deb('0x8')]['http']({'port':0x232a});config[_0x3deb('0x9')]=_['defaults'](config[_0x3deb('0x9')],{'host':_0x3deb('0xa'),'port':0x18eb});var socket=require(_0x3deb('0xb'))(new Redis(config[_0x3deb('0x9')]));require(_0x3deb('0xc'))[_0x3deb('0xd')](socket);function respondWithRpcPromise(_0x2cd00a,_0x1d628e,_0x36c78a){return new BPromise(function(_0x54b603,_0x5a50f5){return client[_0x3deb('0xe')](_0x2cd00a,_0x36c78a)[_0x3deb('0xf')](function(_0x756238){logger['info'](_0x3deb('0x10'),_0x1d628e,_0x3deb('0x11'));logger[_0x3deb('0x12')](_0x3deb('0x13'),_0x1d628e,'request\x20sent',JSON['stringify'](_0x756238));if(_0x756238['error']){if(_0x756238[_0x3deb('0x14')][_0x3deb('0x15')]===0x1f4){logger[_0x3deb('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x1d628e,_0x756238[_0x3deb('0x14')][_0x3deb('0x16')]);return _0x5a50f5(_0x756238['error'][_0x3deb('0x16')]);}logger[_0x3deb('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x1d628e,_0x756238[_0x3deb('0x14')]['message']);return _0x54b603(_0x756238[_0x3deb('0x14')]['message']);}else{logger['info'](_0x3deb('0x10'),_0x1d628e,_0x3deb('0x11'));_0x54b603(_0x756238[_0x3deb('0x17')][_0x3deb('0x16')]);}})[_0x3deb('0x18')](function(_0x145d16){logger['error'](_0x3deb('0x10'),_0x1d628e,_0x145d16);_0x5a50f5(_0x145d16);});});} \ No newline at end of file +var _0x58c9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird'];(function(_0x570b67,_0x5d27d3){var _0x2bb6ce=function(_0x2a44b8){while(--_0x2a44b8){_0x570b67['push'](_0x570b67['shift']());}};_0x2bb6ce(++_0x5d27d3);}(_0x58c9,0x1bc));var _0x958c=function(_0x38c879,_0x2c6a26){_0x38c879=_0x38c879-0x0;var _0x20439e=_0x58c9[_0x38c879];return _0x20439e;};'use strict';var _=require(_0x958c('0x0'));var util=require(_0x958c('0x1'));var moment=require(_0x958c('0x2'));var BPromise=require(_0x958c('0x3'));var rs=require(_0x958c('0x4'));var fs=require('fs');var Redis=require(_0x958c('0x5'));var db=require(_0x958c('0x6'))['db'];var utils=require(_0x958c('0x7'));var logger=require(_0x958c('0x8'))(_0x958c('0x9'));var config=require(_0x958c('0xa'));var jayson=require(_0x958c('0xb'));var client=jayson[_0x958c('0xc')]['http']({'port':0x232a});config[_0x958c('0xd')]=_[_0x958c('0xe')](config[_0x958c('0xd')],{'host':_0x958c('0xf'),'port':0x18eb});var socket=require(_0x958c('0x10'))(new Redis(config[_0x958c('0xd')]));require(_0x958c('0x11'))[_0x958c('0x12')](socket);function respondWithRpcPromise(_0x86f976,_0xac53f0,_0xba69db){return new BPromise(function(_0x553f00,_0x34bb7e){return client[_0x958c('0x13')](_0x86f976,_0xba69db)[_0x958c('0x14')](function(_0x1140e7){logger[_0x958c('0x15')](_0x958c('0x16'),_0xac53f0,_0x958c('0x17'));logger['debug'](_0x958c('0x18'),_0xac53f0,_0x958c('0x17'),JSON['stringify'](_0x1140e7));if(_0x1140e7[_0x958c('0x19')]){if(_0x1140e7[_0x958c('0x19')]['code']===0x1f4){logger[_0x958c('0x19')](_0x958c('0x16'),_0xac53f0,_0x1140e7['error']['message']);return _0x34bb7e(_0x1140e7[_0x958c('0x19')]['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0xac53f0,_0x1140e7[_0x958c('0x19')][_0x958c('0x1a')]);return _0x553f00(_0x1140e7[_0x958c('0x19')][_0x958c('0x1a')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0xac53f0,'request\x20sent');_0x553f00(_0x1140e7['result']['message']);}})[_0x958c('0x1b')](function(_0xfc649a){logger[_0x958c('0x19')](_0x958c('0x16'),_0xac53f0,_0xfc649a);_0x34bb7e(_0xfc649a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a9de19b..055a08c 100644 --- a/server/api/voicePrefix/voicePrefix.socket.js +++ b/server/api/voicePrefix/voicePrefix.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x902b=['register','./voicePrefix.events','remove','update','emit'];(function(_0x34069a,_0x133e7b){var _0xddca94=function(_0x15df2a){while(--_0x15df2a){_0x34069a['push'](_0x34069a['shift']());}};_0xddca94(++_0x133e7b);}(_0x902b,0x6a));var _0xb902=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x902b[_0x4b2436];return _0x4f5ab2;};'use strict';var VoicePrefixEvents=require(_0xb902('0x0'));var events=['save',_0xb902('0x1'),_0xb902('0x2')];function createListener(_0x26d7c7,_0x20a412){return function(_0xa2acb9){_0x20a412[_0xb902('0x3')](_0x26d7c7,_0xa2acb9);};}function removeListener(_0x492bd4,_0x1af7b5){return function(){VoicePrefixEvents['removeListener'](_0x492bd4,_0x1af7b5);};}exports[_0xb902('0x4')]=function(_0x5d38bb){for(var _0x157e14=0x0,_0x5e7240=events['length'];_0x157e14<_0x5e7240;_0x157e14++){var _0x5b0b74=events[_0x157e14];var _0x55331d=createListener('voicePrefix:'+_0x5b0b74,_0x5d38bb);VoicePrefixEvents['on'](_0x5b0b74,_0x55331d);}}; \ No newline at end of file +var _0xe130=['voicePrefix:','./voicePrefix.events','save','update','emit','removeListener','register'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xe130,0x127));var _0x0e13=function(_0x2a623f,_0x284496){_0x2a623f=_0x2a623f-0x0;var _0x61f3fc=_0xe130[_0x2a623f];return _0x61f3fc;};'use strict';var VoicePrefixEvents=require(_0x0e13('0x0'));var events=[_0x0e13('0x1'),'remove',_0x0e13('0x2')];function createListener(_0x3cbccc,_0x1dd4fa){return function(_0x360489){_0x1dd4fa[_0x0e13('0x3')](_0x3cbccc,_0x360489);};}function removeListener(_0x504f15,_0x1489a9){return function(){VoicePrefixEvents[_0x0e13('0x4')](_0x504f15,_0x1489a9);};}exports[_0x0e13('0x5')]=function(_0xcd92e){for(var _0x50a80e=0x0,_0x1774a5=events['length'];_0x50a80e<_0x1774a5;_0x50a80e++){var _0x567031=events[_0x50a80e];var _0x5aaa22=createListener(_0x0e13('0x6')+_0x567031,_0xcd92e);VoicePrefixEvents['on'](_0x567031,_0x5aaa22);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 36a4b0a..fae931f 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(_0x316d59,_0x46390a){var _0x53770b=function(_0x607d30){while(--_0x607d30){_0x316d59['push'](_0x316d59['shift']());}};_0x53770b(++_0x46390a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0xb10b,0x12a));var _0xbb10=function(_0x2425ed,_0x3a6637){_0x2425ed=_0x2425ed-0x0;var _0x8ce321=_0xb10b[_0x2425ed];return _0x8ce321;};'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 5f6b1ba..ff7d91a 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 _0x4374=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','STRING','ENUM','outbound','ringall','leastrecent','random','rrmemory','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','join','periodic_announce','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','power','predictive','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x281349,_0xa48276){var _0x42b4f3=function(_0x34c59b){while(--_0x34c59b){_0x281349['push'](_0x281349['shift']());}};_0x42b4f3(++_0xa48276);}(_0x4374,0x192));var _0x4437=function(_0x4dec04,_0x210072){_0x4dec04=_0x4dec04-0x0;var _0x226ede=_0x4374[_0x4dec04];return _0x226ede;};'use strict';var Sequelize=require(_0x4437('0x0'));module[_0x4437('0x1')]={'name':{'type':Sequelize[_0x4437('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4437('0x3')]('inbound',_0x4437('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x4437('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x4437('0x5'),_0x4437('0x6'),'fewestcalls',_0x4437('0x7'),_0x4437('0x8'),'linear','wrandom',_0x4437('0x9')),'allowNull':![],'defaultValue':'ringall','set':function(_0x11b319){this[_0x4437('0xa')](_0x4437('0xb'),_0x11b319?_0x11b319:'rrmemory');},'get':function(){var _0x525b69=this['getDataValue']('type');var _0x4f422e=this[_0x4437('0xc')](_0x4437('0xd'));var _0x51fefc=this[_0x4437('0xc')](_0x4437('0xb'));if(_0x525b69===_0x4437('0x4')){if(_0x4f422e===_0x4437('0xe')){return null;}if(_0x4f422e===_0x4437('0xf')&&![_0x4437('0x8'),_0x4437('0x10')][_0x4437('0x11')](_0x51fefc)){this[_0x4437('0xa')](_0x4437('0xb'),'rrmemory');}}return _0x51fefc;}},'servicelevel':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x4437('0x12')](0xb)},'timeout':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x4437('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4437('0x3')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no',_0x4437('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4437('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x4437('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x4437('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x4437('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x4437('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4437('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4437('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x4437('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x4437('0x13'),'no',_0x4437('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4437('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x4437('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4437('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4437('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4437('0x2')]},'queue_youarenext':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4437('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x4437('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x4437('0x16')],'set':function(_0x51b6aa){this[_0x4437('0xa')]('periodic_announce',_0x51b6aa?_0x51b6aa[_0x4437('0x17')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this['getDataValue'](_0x4437('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x4437('0x13'),'set':function(_0x304ce9){this[_0x4437('0xa')](_0x4437('0x19'),_0x304ce9?_0x304ce9[_0x4437('0x17')](','):undefined);},'get':function(){return this[_0x4437('0xc')](_0x4437('0x19'))?this['getDataValue']('joinempty')[_0x4437('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4437('0x2')],'defaultValue':'no','set':function(_0x28f970){this[_0x4437('0xa')]('leavewhenempty',_0x28f970?_0x28f970[_0x4437('0x17')](','):undefined);},'get':function(){return this[_0x4437('0xc')](_0x4437('0x1b'))?this[_0x4437('0xc')](_0x4437('0x1b'))[_0x4437('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4437('0x2')]},'description':{'type':Sequelize[_0x4437('0x2')]},'acw':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':0x0,'set':function(_0x152212){this[_0x4437('0xa')](_0x4437('0x1d'),_0x152212);if(_0x152212){if(this[_0x4437('0xc')](_0x4437('0x1e'))<0x2){this[_0x4437('0xa')](_0x4437('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x4437('0xe'),'progressive',_0x4437('0x1f'),_0x4437('0x20'),_0x4437('0xf')),'defaultValue':_0x4437('0x21'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x4437('0x12')](0x4)[_0x4437('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4437('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4437('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x4437('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x4437('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x26'),_0x4437('0x27')),'defaultValue':_0x4437('0x27'),'comment':_0x4437('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4437('0x29')](0x2)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4437('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4437('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4437('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4437('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x4437('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x4437('0x2')],'comment':_0x4437('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x4437('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4437('0x33')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4437('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4437('0x34'),'never',_0x4437('0x35')),'defaultValue':_0x4437('0x34')},'dialAMDActive':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':0x0,'comment':_0x4437('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x4437('0x12')](0x9)[_0x4437('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4437('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x4437('0x12')](0x9)[_0x4437('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4437('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4437('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4437('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4437('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x4437('0x12')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4437('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4437('0x12')](0x9)[_0x4437('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4437('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4437('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4437('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4437('0x12')](0x9)[_0x4437('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4437('0x3d')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x3e'),_0x4437('0x3f')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x4437('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4437('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x41')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x43')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4437('0x12')],'allowNull':!![],'comment':_0x4437('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5aec89){if(!_0x5aec89)this[_0x4437('0xa')]('mandatoryDispositionPauseId',null);this[_0x4437('0xa')](_0x4437('0x4c'),_0x5aec89);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0xec1f=['agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\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','#AMD\x20Initial\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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','sequelize','exports','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','INTEGER','yes','once','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'];(function(_0x371640,_0x5ebd3f){var _0x3e20e3=function(_0x509b83){while(--_0x509b83){_0x371640['push'](_0x371640['shift']());}};_0x3e20e3(++_0x5ebd3f);}(_0xec1f,0x11e));var _0xfec1=function(_0x45376f,_0xab263a){_0x45376f=_0x45376f-0x0;var _0x1fec32=_0xec1f[_0x45376f];return _0x1fec32;};'use strict';var Sequelize=require(_0xfec1('0x0'));module[_0xfec1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x3'),_0xfec1('0x4')),'allowNull':![],'defaultValue':_0xfec1('0x3')},'musiconhold':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':_0xfec1('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xfec1('0x2')]('rr',_0xfec1('0x7'),_0xfec1('0x8'),_0xfec1('0x9'),_0xfec1('0xa'),_0xfec1('0xb'),_0xfec1('0xc'),_0xfec1('0xd'),_0xfec1('0xe')),'allowNull':![],'defaultValue':_0xfec1('0x7'),'set':function(_0x413af4){this[_0xfec1('0xf')](_0xfec1('0x10'),_0x413af4?_0x413af4:'rrmemory');},'get':function(){var _0x426da3=this[_0xfec1('0x11')](_0xfec1('0x12'));var _0x21a454=this[_0xfec1('0x11')](_0xfec1('0x13'));var _0x5deeb5=this[_0xfec1('0x11')]('strategy');if(_0x426da3==='outbound'){if(_0x21a454===_0xfec1('0x14')){return null;}if(_0x21a454===_0xfec1('0x15')&&![_0xfec1('0xb'),'roundrobin']['includes'](_0x5deeb5)){this['setDataValue'](_0xfec1('0x10'),_0xfec1('0xb'));}}return _0x5deeb5;}},'servicelevel':{'type':Sequelize[_0xfec1('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfec1('0x16')](0xb)},'timeout':{'type':Sequelize[_0xfec1('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xfec1('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xfec1('0x5')]},'weight':{'type':Sequelize[_0xfec1('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x17'),'no'),'defaultValue':_0xfec1('0x17')},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfec1('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfec1('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfec1('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfec1('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xfec1('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xfec1('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xfec1('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfec1('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xfec1('0x17'),'no'),'defaultValue':_0xfec1('0x17')},'announce_holdtime':{'type':Sequelize[_0xfec1('0x2')]('yes','no',_0xfec1('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xfec1('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfec1('0x5')]},'queue_youarenext':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xfec1('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xfec1('0x5')]},'queue_quantity2':{'type':Sequelize[_0xfec1('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0xfec1('0x5')]},'queue_less_than':{'type':Sequelize[_0xfec1('0x5')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x348750){this[_0xfec1('0xf')](_0xfec1('0x19'),_0x348750?_0x348750[_0xfec1('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xfec1('0x19'))?this[_0xfec1('0x11')](_0xfec1('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':_0xfec1('0x17'),'set':function(_0x4ad404){this[_0xfec1('0xf')](_0xfec1('0x1b'),_0x4ad404?_0x4ad404[_0xfec1('0x1a')](','):undefined);},'get':function(){return this[_0xfec1('0x11')](_0xfec1('0x1b'))?this[_0xfec1('0x11')](_0xfec1('0x1b'))[_0xfec1('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x877278){this[_0xfec1('0xf')](_0xfec1('0x1d'),_0x877278?_0x877278[_0xfec1('0x1a')](','):undefined);},'get':function(){return this[_0xfec1('0x11')](_0xfec1('0x1d'))?this[_0xfec1('0x11')](_0xfec1('0x1d'))[_0xfec1('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xfec1('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xfec1('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfec1('0x5')]},'acw':{'type':Sequelize[_0xfec1('0x1e')],'defaultValue':0x0,'set':function(_0x36555e){this[_0xfec1('0xf')](_0xfec1('0x1f'),_0x36555e);if(_0x36555e){if(this['getDataValue'](_0xfec1('0x20'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfec1('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfec1('0x1e')],'defaultValue':0x0,'comment':_0xfec1('0x21')},'dialMethod':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x14'),_0xfec1('0x22'),'power',_0xfec1('0x23'),_0xfec1('0x15')),'defaultValue':_0xfec1('0x22'),'comment':_0xfec1('0x24')},'dialLimitChannel':{'type':Sequelize[_0xfec1('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfec1('0x25')},'dialLimitQueue':{'type':Sequelize[_0xfec1('0x16')](0x4)[_0xfec1('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfec1('0x27')},'dialPowerLevel':{'type':Sequelize[_0xfec1('0x28')](0x2)[_0xfec1('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xfec1('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xfec1('0x2a'),_0xfec1('0x2b')),'defaultValue':_0xfec1('0x2b'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xfec1('0x28')](0x2)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfec1('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xfec1('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfec1('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xfec1('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfec1('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xfec1('0x2e'),'comment':_0xfec1('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xfec1('0x16')](0x3)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xfec1('0x5')],'comment':_0xfec1('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfec1('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfec1('0x16')](0x5)[_0xfec1('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfec1('0x32')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfec1('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfec1('0x16')](0x5)[_0xfec1('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfec1('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfec1('0x26')],'defaultValue':0x3,'comment':_0xfec1('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfec1('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfec1('0x36')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfec1('0x37')},'dialTimezone':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xfec1('0x38')},'dialPrefix':{'type':Sequelize[_0xfec1('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xfec1('0x39'),'never',_0xfec1('0x3a')),'defaultValue':_0xfec1('0x39')},'dialAMDActive':{'type':Sequelize[_0xfec1('0x1e')],'defaultValue':0x0,'comment':_0xfec1('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xfec1('0x16')](0x9)[_0xfec1('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfec1('0x3c')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfec1('0x16')](0x9)[_0xfec1('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xfec1('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xfec1('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfec1('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfec1('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfec1('0x16')](0x9)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfec1('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfec1('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfec1('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfec1('0x16')](0x9)[_0xfec1('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfec1('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0xfec1('0x16')](0x5)[_0xfec1('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfec1('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xfec1('0x1e')],'defaultValue':0x0,'comment':_0xfec1('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0xfec1('0x2')](_0xfec1('0x43'),_0xfec1('0x44')),'defaultValue':_0xfec1('0x43')},'dialQueueProject2':{'type':Sequelize[_0xfec1('0x5')],'comment':_0xfec1('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfec1('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xfec1('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfec1('0x45')},'dialCutDigit':{'type':Sequelize[_0xfec1('0x16')](0x3)[_0xfec1('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfec1('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfec1('0x16')](0x3)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfec1('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfec1('0x16')](0x5)[_0xfec1('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfec1('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0xfec1('0x16')](0x3)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfec1('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfec1('0x16')](0x3)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfec1('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfec1('0x16')](0x5)[_0xfec1('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfec1('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0xfec1('0x16')](0x3)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfec1('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfec1('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfec1('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfec1('0x16')](0x3)[_0xfec1('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfec1('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfec1('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfec1('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfec1('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfec1('0x50'),'set':function(_0x15c8f7){if(!_0x15c8f7)this['setDataValue'](_0xfec1('0x51'),null);this['setDataValue']('mandatoryDisposition',_0x15c8f7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfec1('0x16')](0x3)[_0xfec1('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xfec1('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xfec1('0x16')](0x3)[_0xfec1('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfec1('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 39d3253..808998f 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 _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(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x4b84[_0x118139];return _0x2fece9;};'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 +var _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x30499e,_0x5e021c){var _0xfde7af=function(_0x1e8594){while(--_0x1e8594){_0x30499e['push'](_0x30499e['shift']());}};_0xfde7af(++_0x5e021c);}(_0xa41a,0x6b));var _0xaa41=function(_0x57f02b,_0xb4aa24){_0x57f02b=_0x57f02b-0x0;var _0x64f03b=_0xa41a[_0x57f02b];return _0x64f03b;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1ac369e..39b43c1 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 _0xc393=['remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0xf7f62c,_0x34e3e9){var _0x1fa89e=function(_0x59236c){while(--_0x59236c){_0xf7f62c['push'](_0xf7f62c['shift']());}};_0x1fa89e(++_0x34e3e9);}(_0xc393,0x8c));var _0x3c39=function(_0x5e83ec,_0x5abaaf){_0x5e83ec=_0x5e83ec-0x0;var _0x43c08c=_0xc393[_0x5e83ec];return _0x43c08c;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x3c39('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3c39('0x1')](0x0);var events={'afterCreate':_0x3c39('0x2'),'afterUpdate':_0x3c39('0x3'),'afterDestroy':_0x3c39('0x4')};function emitEvent(_0x1ede98){return function(_0x26bbb2,_0x5595a8,_0x4f2fa7){VoiceQueueEvents['emit'](_0x1ede98+':'+_0x26bbb2['id'],_0x26bbb2);VoiceQueueEvents[_0x3c39('0x5')](_0x1ede98,_0x26bbb2);_0x4f2fa7(null);};}for(var e in events){if(events[_0x3c39('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x3c39('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xe1bc=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0xe1bc,0x1a9));var _0xce1b=function(_0x21eb41,_0x5511de){_0x21eb41=_0x21eb41-0x0;var _0x477aa5=_0xe1bc[_0x21eb41];return _0x477aa5;};'use strict';var EventEmitter=require(_0xce1b('0x0'));var VoiceQueue=require(_0xce1b('0x1'))['db'][_0xce1b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xce1b('0x3')](0x0);var events={'afterCreate':_0xce1b('0x4'),'afterUpdate':_0xce1b('0x5'),'afterDestroy':_0xce1b('0x6')};function emitEvent(_0x4c857b){return function(_0x151a17,_0x3774f6,_0xc696c7){VoiceQueueEvents[_0xce1b('0x7')](_0x4c857b+':'+_0x151a17['id'],_0x151a17);VoiceQueueEvents[_0xce1b('0x7')](_0x4c857b,_0x151a17);_0xc696c7(null);};}for(var e in events){if(events[_0xce1b('0x8')](e)){var event=events[e];VoiceQueue[_0xce1b('0x9')](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 f0cfa04..b97c565 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4c7464,_0x54475d){var _0x1d48f9=function(_0x5d03b6){while(--_0x5d03b6){_0x4c7464['push'](_0x4c7464['shift']());}};_0x1d48f9(++_0x54475d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x2af622,_0x2909fb){var _0x5ef991=function(_0x53bd64){while(--_0x53bd64){_0x2af622['push'](_0x2af622['shift']());}};_0x5ef991(++_0x2909fb);}(_0x34e8,0x12c));var _0x834e=function(_0x57a25a,_0x59d1b4){_0x57a25a=_0x57a25a-0x0;var _0x1c79d8=_0x34e8[_0x57a25a];return _0x1c79d8;};'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/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 4b6552a..ce59f90 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 _0xb643=['request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','attributes','model','debug','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket'];(function(_0x1c8258,_0x508592){var _0x5dae8d=function(_0x51f6c9){while(--_0x51f6c9){_0x1c8258['push'](_0x1c8258['shift']());}};_0x5dae8d(++_0x508592);}(_0xb643,0x1bd));var _0x3b64=function(_0x728761,_0x4132a6){_0x728761=_0x728761-0x0;var _0xe26006=_0xb643[_0x728761];return _0xe26006;};'use strict';var _=require(_0x3b64('0x0'));var util=require(_0x3b64('0x1'));var moment=require('moment');var BPromise=require(_0x3b64('0x2'));var rs=require(_0x3b64('0x3'));var fs=require('fs');var Redis=require(_0x3b64('0x4'));var db=require(_0x3b64('0x5'))['db'];var utils=require(_0x3b64('0x6'));var logger=require(_0x3b64('0x7'))(_0x3b64('0x8'));var config=require(_0x3b64('0x9'));var jayson=require(_0x3b64('0xa'));var client=jayson['client'][_0x3b64('0xb')]({'port':0x232a});config[_0x3b64('0xc')]=_[_0x3b64('0xd')](config[_0x3b64('0xc')],{'host':_0x3b64('0xe'),'port':0x18eb});var socket=require(_0x3b64('0xf'))(new Redis(config['redis']));require(_0x3b64('0x10'))['register'](socket);function respondWithRpcPromise(_0x461fe8,_0x3e90e6,_0x18c9c7){return new BPromise(function(_0xe37d36,_0xb75d03){return client[_0x3b64('0x11')](_0x461fe8,_0x18c9c7)[_0x3b64('0x12')](function(_0x4cad0a){logger[_0x3b64('0x13')](_0x3b64('0x14'),_0x3e90e6,'request\x20sent');logger['debug'](_0x3b64('0x15'),_0x3e90e6,_0x3b64('0x16'),JSON[_0x3b64('0x17')](_0x4cad0a));if(_0x4cad0a['error']){if(_0x4cad0a['error'][_0x3b64('0x18')]===0x1f4){logger['error'](_0x3b64('0x14'),_0x3e90e6,_0x4cad0a['error'][_0x3b64('0x19')]);return _0xb75d03(_0x4cad0a['error'][_0x3b64('0x19')]);}logger[_0x3b64('0x1a')](_0x3b64('0x14'),_0x3e90e6,_0x4cad0a[_0x3b64('0x1a')]['message']);return _0xe37d36(_0x4cad0a[_0x3b64('0x1a')][_0x3b64('0x19')]);}else{logger[_0x3b64('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x3e90e6,_0x3b64('0x16'));_0xe37d36(_0x4cad0a[_0x3b64('0x1b')]['message']);}})[_0x3b64('0x1c')](function(_0x117c10){logger[_0x3b64('0x1a')]('VoiceQueue,\x20%s,\x20%s',_0x3e90e6,_0x117c10);_0xb75d03(_0x117c10);});});}exports[_0x3b64('0x1d')]=function(_0x1330cf){var _0x198aa3=this;return new Promise(function(_0x4a144c,_0x3c0ebd){return db[_0x3b64('0x1e')][_0x3b64('0x1f')]({'raw':_0x1330cf[_0x3b64('0x20')]?_0x1330cf[_0x3b64('0x20')][_0x3b64('0x21')]===undefined?!![]:![]:!![],'where':_0x1330cf[_0x3b64('0x20')]?_0x1330cf['options'][_0x3b64('0x22')]||null:null,'attributes':_0x1330cf['options']?_0x1330cf[_0x3b64('0x20')]['attributes']||null:null,'limit':_0x1330cf['options']?_0x1330cf[_0x3b64('0x20')][_0x3b64('0x23')]||null:null,'include':_0x1330cf[_0x3b64('0x20')]?_0x1330cf['options'][_0x3b64('0x24')]?_[_0x3b64('0x25')](_0x1330cf[_0x3b64('0x20')]['include'],function(_0xdf92da){return{'model':db[_0xdf92da['model']],'as':_0xdf92da['as'],'attributes':_0xdf92da[_0x3b64('0x26')],'include':_0xdf92da[_0x3b64('0x24')]?_[_0x3b64('0x25')](_0xdf92da[_0x3b64('0x24')],function(_0x476d54){return{'model':db[_0x476d54['model']],'as':_0x476d54['as'],'attributes':_0x476d54[_0x3b64('0x26')],'include':_0x476d54[_0x3b64('0x24')]?_['map'](_0x476d54[_0x3b64('0x24')],function(_0x4d25bf){return{'model':db[_0x4d25bf[_0x3b64('0x27')]],'as':_0x4d25bf['as'],'attributes':_0x4d25bf[_0x3b64('0x26')]};}):[]};}):[]};}):[]:[]})[_0x3b64('0x12')](function(_0x42c195){logger[_0x3b64('0x13')](_0x3b64('0x1d'),_0x1330cf);logger[_0x3b64('0x28')]('GetVoiceQueue',_0x1330cf,JSON[_0x3b64('0x17')](_0x42c195));_0x4a144c(_0x42c195);})[_0x3b64('0x1c')](function(_0x19fc07){logger[_0x3b64('0x1a')](_0x3b64('0x1d'),_0x19fc07[_0x3b64('0x19')],_0x1330cf);_0x3c0ebd(_0x198aa3[_0x3b64('0x1a')](0x1f4,_0x19fc07[_0x3b64('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x2cfd49){var _0x1025bc=this;return new Promise(function(_0x52336c,_0x2e97a3){return db[_0x3b64('0x1e')]['find']({'raw':_0x2cfd49[_0x3b64('0x20')]?_0x2cfd49['options'][_0x3b64('0x21')]===undefined?!![]:![]:!![],'where':_0x2cfd49[_0x3b64('0x20')]?_0x2cfd49[_0x3b64('0x20')][_0x3b64('0x22')]||null:null,'attributes':_0x2cfd49[_0x3b64('0x20')]?_0x2cfd49['options'][_0x3b64('0x26')]||null:null,'include':_0x2cfd49[_0x3b64('0x20')]?_0x2cfd49['options']['include']?_['map'](_0x2cfd49[_0x3b64('0x20')]['include'],function(_0x96fbe2){return{'model':db[_0x96fbe2[_0x3b64('0x27')]],'as':_0x96fbe2['as'],'attributes':_0x96fbe2[_0x3b64('0x26')],'include':_0x96fbe2[_0x3b64('0x24')]?_[_0x3b64('0x25')](_0x96fbe2[_0x3b64('0x24')],function(_0x313e63){return{'model':db[_0x313e63[_0x3b64('0x27')]],'as':_0x313e63['as'],'attributes':_0x313e63[_0x3b64('0x26')],'include':_0x313e63[_0x3b64('0x24')]?_[_0x3b64('0x25')](_0x313e63[_0x3b64('0x24')],function(_0x2b548f){return{'model':db[_0x2b548f[_0x3b64('0x27')]],'as':_0x2b548f['as'],'attributes':_0x2b548f[_0x3b64('0x26')]};}):[]};}):[]};}):[]:[]})[_0x3b64('0x12')](function(_0x25a72b){logger[_0x3b64('0x13')](_0x3b64('0x29'),_0x2cfd49);logger[_0x3b64('0x28')](_0x3b64('0x29'),_0x2cfd49,JSON[_0x3b64('0x17')](_0x25a72b));_0x52336c(_0x25a72b);})['catch'](function(_0x46123a){logger[_0x3b64('0x1a')](_0x3b64('0x29'),_0x46123a[_0x3b64('0x19')],_0x2cfd49);_0x2e97a3(_0x1025bc[_0x3b64('0x1a')](0x1f4,_0x46123a[_0x3b64('0x19')]));});});}; \ No newline at end of file +var _0x17c8=['client','http','redis','localhost','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','findAll','options','raw','where','include','model','attributes','map','info','debug','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0x17c8,0x1a1));var _0x817c=function(_0x2df2ed,_0x32949d){_0x2df2ed=_0x2df2ed-0x0;var _0x99abea=_0x17c8[_0x2df2ed];return _0x99abea;};'use strict';var _=require(_0x817c('0x0'));var util=require(_0x817c('0x1'));var moment=require(_0x817c('0x2'));var BPromise=require(_0x817c('0x3'));var rs=require(_0x817c('0x4'));var fs=require('fs');var Redis=require(_0x817c('0x5'));var db=require(_0x817c('0x6'))['db'];var utils=require(_0x817c('0x7'));var logger=require(_0x817c('0x8'))(_0x817c('0x9'));var config=require(_0x817c('0xa'));var jayson=require(_0x817c('0xb'));var client=jayson[_0x817c('0xc')][_0x817c('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x817c('0xe')],{'host':_0x817c('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x817c('0xe')]));require('./voiceQueue.socket')[_0x817c('0x10')](socket);function respondWithRpcPromise(_0x449648,_0x2358dd,_0x248139){return new BPromise(function(_0x49a1fa,_0x4fb9b5){return client[_0x817c('0x11')](_0x449648,_0x248139)[_0x817c('0x12')](function(_0x278d72){logger['info'](_0x817c('0x13'),_0x2358dd,'request\x20sent');logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2358dd,_0x817c('0x14'),JSON[_0x817c('0x15')](_0x278d72));if(_0x278d72['error']){if(_0x278d72[_0x817c('0x16')][_0x817c('0x17')]===0x1f4){logger[_0x817c('0x16')](_0x817c('0x13'),_0x2358dd,_0x278d72[_0x817c('0x16')][_0x817c('0x18')]);return _0x4fb9b5(_0x278d72[_0x817c('0x16')][_0x817c('0x18')]);}logger[_0x817c('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2358dd,_0x278d72[_0x817c('0x16')][_0x817c('0x18')]);return _0x49a1fa(_0x278d72[_0x817c('0x16')][_0x817c('0x18')]);}else{logger['info'](_0x817c('0x13'),_0x2358dd,_0x817c('0x14'));_0x49a1fa(_0x278d72[_0x817c('0x19')][_0x817c('0x18')]);}})[_0x817c('0x1a')](function(_0x2dd4b8){logger['error'](_0x817c('0x13'),_0x2358dd,_0x2dd4b8);_0x4fb9b5(_0x2dd4b8);});});}exports[_0x817c('0x1b')]=function(_0x1b85cf){var _0x51fcda=this;return new Promise(function(_0x2c7f9f,_0x3c5174){return db['VoiceQueue'][_0x817c('0x1c')]({'raw':_0x1b85cf[_0x817c('0x1d')]?_0x1b85cf['options'][_0x817c('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b85cf[_0x817c('0x1d')]?_0x1b85cf[_0x817c('0x1d')][_0x817c('0x1f')]||null:null,'attributes':_0x1b85cf['options']?_0x1b85cf[_0x817c('0x1d')]['attributes']||null:null,'limit':_0x1b85cf[_0x817c('0x1d')]?_0x1b85cf[_0x817c('0x1d')]['limit']||null:null,'include':_0x1b85cf[_0x817c('0x1d')]?_0x1b85cf[_0x817c('0x1d')]['include']?_['map'](_0x1b85cf[_0x817c('0x1d')][_0x817c('0x20')],function(_0x24516d){return{'model':db[_0x24516d[_0x817c('0x21')]],'as':_0x24516d['as'],'attributes':_0x24516d[_0x817c('0x22')],'include':_0x24516d[_0x817c('0x20')]?_[_0x817c('0x23')](_0x24516d[_0x817c('0x20')],function(_0x483ffa){return{'model':db[_0x483ffa[_0x817c('0x21')]],'as':_0x483ffa['as'],'attributes':_0x483ffa[_0x817c('0x22')],'include':_0x483ffa[_0x817c('0x20')]?_[_0x817c('0x23')](_0x483ffa[_0x817c('0x20')],function(_0x1c3fb0){return{'model':db[_0x1c3fb0[_0x817c('0x21')]],'as':_0x1c3fb0['as'],'attributes':_0x1c3fb0['attributes']};}):[]};}):[]};}):[]:[]})[_0x817c('0x12')](function(_0x4733ac){logger[_0x817c('0x24')](_0x817c('0x1b'),_0x1b85cf);logger[_0x817c('0x25')](_0x817c('0x1b'),_0x1b85cf,JSON[_0x817c('0x15')](_0x4733ac));_0x2c7f9f(_0x4733ac);})[_0x817c('0x1a')](function(_0xf1618b){logger[_0x817c('0x16')]('GetVoiceQueue',_0xf1618b[_0x817c('0x18')],_0x1b85cf);_0x3c5174(_0x51fcda[_0x817c('0x16')](0x1f4,_0xf1618b[_0x817c('0x18')]));});});};exports[_0x817c('0x26')]=function(_0x2ae222){var _0x5688fa=this;return new Promise(function(_0xedd293,_0xc85dbc){return db['VoiceQueue']['find']({'raw':_0x2ae222[_0x817c('0x1d')]?_0x2ae222['options'][_0x817c('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ae222[_0x817c('0x1d')]?_0x2ae222['options'][_0x817c('0x1f')]||null:null,'attributes':_0x2ae222[_0x817c('0x1d')]?_0x2ae222[_0x817c('0x1d')][_0x817c('0x22')]||null:null,'include':_0x2ae222[_0x817c('0x1d')]?_0x2ae222[_0x817c('0x1d')][_0x817c('0x20')]?_['map'](_0x2ae222['options'][_0x817c('0x20')],function(_0x32dcba){return{'model':db[_0x32dcba[_0x817c('0x21')]],'as':_0x32dcba['as'],'attributes':_0x32dcba['attributes'],'include':_0x32dcba[_0x817c('0x20')]?_[_0x817c('0x23')](_0x32dcba['include'],function(_0x765780){return{'model':db[_0x765780[_0x817c('0x21')]],'as':_0x765780['as'],'attributes':_0x765780[_0x817c('0x22')],'include':_0x765780[_0x817c('0x20')]?_['map'](_0x765780[_0x817c('0x20')],function(_0x3a9754){return{'model':db[_0x3a9754[_0x817c('0x21')]],'as':_0x3a9754['as'],'attributes':_0x3a9754['attributes']};}):[]};}):[]};}):[]:[]})[_0x817c('0x12')](function(_0x4a6cfd){logger[_0x817c('0x24')](_0x817c('0x26'),_0x2ae222);logger[_0x817c('0x25')]('ShowVoiceQueue',_0x2ae222,JSON[_0x817c('0x15')](_0x4a6cfd));_0xedd293(_0x4a6cfd);})[_0x817c('0x1a')](function(_0x2ed4c5){logger[_0x817c('0x16')](_0x817c('0x26'),_0x2ed4c5['message'],_0x2ae222);_0xc85dbc(_0x5688fa['error'](0x1f4,_0x2ed4c5[_0x817c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4f0a0e3..bd19f55 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 _0x4ce5=['remove','emit','removeListener','register','length','voiceQueue:','save'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x4ce5,0x156));var _0x54ce=function(_0x237303,_0x24caba){_0x237303=_0x237303-0x0;var _0x175af1=_0x4ce5[_0x237303];return _0x175af1;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x54ce('0x0'),_0x54ce('0x1'),'update'];function createListener(_0x59f37e,_0x1abb5e){return function(_0x380104){_0x1abb5e[_0x54ce('0x2')](_0x59f37e,_0x380104);};}function removeListener(_0x3ff2c7,_0x52bf70){return function(){VoiceQueueEvents[_0x54ce('0x3')](_0x3ff2c7,_0x52bf70);};}exports[_0x54ce('0x4')]=function(_0x322a3e){for(var _0x1c0da0=0x0,_0x519db8=events[_0x54ce('0x5')];_0x1c0da0<_0x519db8;_0x1c0da0++){var _0x208ef8=events[_0x1c0da0];var _0x55ee98=createListener(_0x54ce('0x6')+_0x208ef8,_0x322a3e);VoiceQueueEvents['on'](_0x208ef8,_0x55ee98);}}; \ No newline at end of file +var _0x9a4a=['removeListener','length','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x9a4a,0x1c3));var _0xa9a4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a4a[_0x2641f9];return _0x585741;};'use strict';var VoiceQueueEvents=require(_0xa9a4('0x0'));var events=[_0xa9a4('0x1'),_0xa9a4('0x2'),_0xa9a4('0x3')];function createListener(_0x5a2a23,_0x3c8005){return function(_0x9cce27){_0x3c8005['emit'](_0x5a2a23,_0x9cce27);};}function removeListener(_0x5241d1,_0xd4db22){return function(){VoiceQueueEvents[_0xa9a4('0x4')](_0x5241d1,_0xd4db22);};}exports['register']=function(_0x553872){for(var _0x2b122b=0x0,_0x9ea55a=events[_0xa9a4('0x5')];_0x2b122b<_0x9ea55a;_0x2b122b++){var _0x4b418d=events[_0x2b122b];var _0x1bd57c=createListener(_0xa9a4('0x6')+_0x4b418d,_0x553872);VoiceQueueEvents['on'](_0x4b418d,_0x1bd57c);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 167a2f0..4ab699c 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 _0x9f8b=['./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','show','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dab20,_0x38ca19){var _0x30f7da=function(_0x251e65){while(--_0x251e65){_0x3dab20['push'](_0x3dab20['shift']());}};_0x30f7da(++_0x38ca19);}(_0x9f8b,0x1f3));var _0xb9f8=function(_0x46f7f0,_0x4ef418){_0x46f7f0=_0x46f7f0-0x0;var _0x783786=_0x9f8b[_0x46f7f0];return _0x783786;};'use strict';var multer=require(_0xb9f8('0x0'));var util=require(_0xb9f8('0x1'));var path=require('path');var timeout=require(_0xb9f8('0x2'));var express=require(_0xb9f8('0x3'));var router=express[_0xb9f8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb9f8('0x5'));var interaction=require(_0xb9f8('0x6'));var config=require('../../config/environment');var controller=require(_0xb9f8('0x7'));router[_0xb9f8('0x8')]('/',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xa')]);router[_0xb9f8('0x8')]('/describe',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xb')]);router[_0xb9f8('0x8')](_0xb9f8('0xc'),auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xd')]);router[_0xb9f8('0x8')]('/:id',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb9f8('0xf')]);router[_0xb9f8('0x10')]('/:id',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0x11')]);router[_0xb9f8('0x12')](_0xb9f8('0x13'),auth[_0xb9f8('0x9')](),controller[_0xb9f8('0x14')]);module[_0xb9f8('0x15')]=router; \ No newline at end of file +var _0x3bf0=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x3739f7,_0x35bb86){var _0x1db6b9=function(_0x43ea42){while(--_0x43ea42){_0x3739f7['push'](_0x3739f7['shift']());}};_0x1db6b9(++_0x35bb86);}(_0x3bf0,0xe7));var _0x03bf=function(_0xea963f,_0x937887){_0xea963f=_0xea963f-0x0;var _0x53b2a7=_0x3bf0[_0xea963f];return _0x53b2a7;};'use strict';var multer=require(_0x03bf('0x0'));var util=require(_0x03bf('0x1'));var path=require('path');var timeout=require(_0x03bf('0x2'));var express=require('express');var router=express[_0x03bf('0x3')]();var fs_extra=require(_0x03bf('0x4'));var auth=require(_0x03bf('0x5'));var interaction=require(_0x03bf('0x6'));var config=require(_0x03bf('0x7'));var controller=require(_0x03bf('0x8'));router[_0x03bf('0x9')]('/',auth[_0x03bf('0xa')](),controller[_0x03bf('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x03bf('0x9')](_0x03bf('0xc'),auth[_0x03bf('0xa')](),controller['getVoiceQueuesReport']);router[_0x03bf('0x9')](_0x03bf('0xd'),auth[_0x03bf('0xa')](),controller['show']);router[_0x03bf('0xe')]('/',auth[_0x03bf('0xa')](),controller[_0x03bf('0xf')]);router[_0x03bf('0x10')](_0x03bf('0xd'),auth[_0x03bf('0xa')](),controller[_0x03bf('0x11')]);router[_0x03bf('0x12')](_0x03bf('0xd'),auth[_0x03bf('0xa')](),controller[_0x03bf('0x13')]);module[_0x03bf('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a6cf090..a7c7fec 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 _0xb7b7=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER'];(function(_0xe00bb8,_0x4e5e0a){var _0x5278f4=function(_0x3c2dbf){while(--_0x3c2dbf){_0xe00bb8['push'](_0xe00bb8['shift']());}};_0x5278f4(++_0x4e5e0a);}(_0xb7b7,0x136));var _0x7b7b=function(_0x5b4a16,_0x56e5c7){_0x5b4a16=_0x5b4a16-0x0;var _0x3a2ad0=_0xb7b7[_0x5b4a16];return _0x3a2ad0;};'use strict';var Sequelize=require(_0x7b7b('0x0'));var moment=require('moment');module[_0x7b7b('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7b('0x2')]},'calleridnum':{'type':Sequelize[_0x7b7b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7b7b('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x7b7b('0x3')],'set':function(_0x246762){var _0x2329cf=moment(_0x246762);var _0x1c97e0=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x7b7b('0x4'));var _0x13fa0a=_0x2329cf[_0x7b7b('0x5')](_0x1c97e0,'seconds');this['setDataValue']('queuecallerleaveAt',_0x246762);this[_0x7b7b('0x6')](_0x7b7b('0x7'),_0x13fa0a||null);}},'position':{'type':Sequelize[_0x7b7b('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x7b7b('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7b('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7b('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7b('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7b('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x7b7b('0x8')]},'channel':{'type':Sequelize[_0x7b7b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7b('0x2')]},'connectedlinename':{'type':Sequelize[_0x7b7b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7b7b('0x2')]},'exten':{'type':Sequelize[_0x7b7b('0x2')]},'priority':{'type':Sequelize[_0x7b7b('0x2')]},'holdtime':{'type':Sequelize[_0x7b7b('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7b('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7b('0x2')]},'transfer':{'type':Sequelize[_0x7b7b('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7b('0xa')},'transferexten':{'type':Sequelize[_0x7b7b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x7b7b('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7b7b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7b('0x8')],'defaultValue':0x0},'note':{'type':Sequelize[_0x7b7b('0x2')]}}; \ No newline at end of file +var _0xb279=['diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x37fb03,_0x41fabb){var _0x54a762=function(_0x5dbcae){while(--_0x5dbcae){_0x37fb03['push'](_0x37fb03['shift']());}};_0x54a762(++_0x41fabb);}(_0xb279,0x69));var _0x9b27=function(_0x21badc,_0x3a6b73){_0x21badc=_0x21badc-0x0;var _0x9e9735=_0xb279[_0x21badc];return _0x9e9735;};'use strict';var Sequelize=require(_0x9b27('0x0'));var moment=require('moment');module[_0x9b27('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9b27('0x2')]},'calleridnum':{'type':Sequelize[_0x9b27('0x2')]},'calleridname':{'type':Sequelize[_0x9b27('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x9b27('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x9b27('0x3')],'set':function(_0x2faa97){var _0x117604=moment(_0x2faa97);var _0x584eb5=moment(this['getDataValue'](_0x9b27('0x4')))[_0x9b27('0x5')](_0x9b27('0x6'));var _0x5d60d1=_0x117604[_0x9b27('0x7')](_0x584eb5,_0x9b27('0x8'));this[_0x9b27('0x9')](_0x9b27('0xa'),_0x2faa97);this[_0x9b27('0x9')](_0x9b27('0xb'),_0x5d60d1||null);}},'position':{'type':Sequelize[_0x9b27('0xc')]},'count':{'type':Sequelize[_0x9b27('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9b27('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x9b27('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9b27('0x3')]},'queuecallerexit':{'type':Sequelize[_0x9b27('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x9b27('0x2')],'comment':_0x9b27('0xe')},'originalposition':{'type':Sequelize[_0x9b27('0xc')]},'channel':{'type':Sequelize[_0x9b27('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9b27('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9b27('0x2')]},'context':{'type':Sequelize[_0x9b27('0x2')]},'exten':{'type':Sequelize[_0x9b27('0x2')]},'priority':{'type':Sequelize[_0x9b27('0x2')]},'holdtime':{'type':Sequelize[_0x9b27('0xc')]},'mohtime':{'type':Sequelize[_0x9b27('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9b27('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9b27('0x2')]},'transfer':{'type':Sequelize[_0x9b27('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9b27('0x2')],'comment':_0x9b27('0xf')},'transferexten':{'type':Sequelize[_0x9b27('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9b27('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9b27('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x9b27('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9b27('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index f853923..e4c853a 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 _0x3a25=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','show','params','rawAttributes','include','options','find','catch','create','body','update','describe','getVoiceQueuesReport','keys','findAll','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key'];(function(_0x2a7528,_0x5c95ce){var _0x1149d6=function(_0x10fa39){while(--_0x10fa39){_0x2a7528['push'](_0x2a7528['shift']());}};_0x1149d6(++_0x5c95ce);}(_0x3a25,0x109));var _0x53a2=function(_0x110c0d,_0x3eb336){_0x110c0d=_0x110c0d-0x0;var _0xa3fa7d=_0x3a25[_0x110c0d];return _0xa3fa7d;};'use strict';var emlformat=require(_0x53a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53a2('0x1'));var jsonpatch=require(_0x53a2('0x2'));var rp=require(_0x53a2('0x3'));var moment=require(_0x53a2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53a2('0x5'));var util=require(_0x53a2('0x6'));var path=require('path');var sox=require(_0x53a2('0x7'));var csv=require(_0x53a2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53a2('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x53a2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53a2('0x8'));var querystring=require(_0x53a2('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x53a2('0xc'));var as=require(_0x53a2('0xd'));var hardwareService=require(_0x53a2('0xe'));var logger=require(_0x53a2('0xf'))(_0x53a2('0x10'));var utils=require(_0x53a2('0x11'));var config=require(_0x53a2('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x53a2('0x13'))['db'];config[_0x53a2('0x14')]=_[_0x53a2('0x15')](config['redis'],{'host':_0x53a2('0x16'),'port':0x18eb});var socket=require(_0x53a2('0x17'))(new Redis(config[_0x53a2('0x14')]));require('./voiceQueueReport.socket')[_0x53a2('0x18')](socket);function respondWithStatusCode(_0x1203d5,_0x2319a1){_0x2319a1=_0x2319a1||0xcc;return function(_0x47dff9){if(_0x47dff9){return _0x1203d5[_0x53a2('0x19')](_0x2319a1);}return _0x1203d5['status'](_0x2319a1)['end']();};}function respondWithResult(_0x302bc6,_0x2ff605){_0x2ff605=_0x2ff605||0xc8;return function(_0x1f291b){if(_0x1f291b){return _0x302bc6[_0x53a2('0x1a')](_0x2ff605)[_0x53a2('0x1b')](_0x1f291b);}};}function respondWithFilteredResult(_0x335a29,_0x479145){return function(_0x17f8eb){if(_0x17f8eb){var _0x1356af=typeof _0x479145[_0x53a2('0x1c')]==='undefined'&&typeof _0x479145[_0x53a2('0x1d')]===_0x53a2('0x1e');var _0x1bf894=_0x17f8eb[_0x53a2('0x1f')];var _0x54bf17=_0x1356af?0x0:_0x479145['offset'];var _0x3af7e3=_0x1356af?_0x17f8eb['count']:_0x479145[_0x53a2('0x1c')]+_0x479145[_0x53a2('0x1d')];var _0x3e2b07;if(_0x3af7e3>=_0x1bf894){_0x3af7e3=_0x1bf894;_0x3e2b07=0xc8;}else{_0x3e2b07=0xce;}_0x335a29['status'](_0x3e2b07);return _0x335a29['set'](_0x53a2('0x20'),_0x54bf17+'-'+_0x3af7e3+'/'+_0x1bf894)[_0x53a2('0x1b')](_0x17f8eb);}return null;};}function patchUpdates(_0xce3fbf){return function(_0x2287bf){try{jsonpatch[_0x53a2('0x21')](_0x2287bf,_0xce3fbf,!![]);}catch(_0x5024b1){return BPromise[_0x53a2('0x22')](_0x5024b1);}return _0x2287bf['save']();};}function saveUpdates(_0x35cd99,_0x3faed9){return function(_0x5eaf27){if(_0x5eaf27){return _0x5eaf27['update'](_0x35cd99)[_0x53a2('0x23')](function(_0x357492){return _0x357492;});}return null;};}function removeEntity(_0x2bea78,_0x1386af){return function(_0x209cce){if(_0x209cce){return _0x209cce[_0x53a2('0x24')]()[_0x53a2('0x23')](function(){_0x2bea78[_0x53a2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c053,_0x507044){return function(_0x386750){if(!_0x386750){_0x53c053['sendStatus'](0x194);}return _0x386750;};}function handleError(_0x5f2348,_0x4eb061){_0x4eb061=_0x4eb061||0x1f4;return function(_0x598bd4){logger[_0x53a2('0x25')](_0x598bd4[_0x53a2('0x26')]);if(_0x598bd4[_0x53a2('0x27')]){delete _0x598bd4['name'];}_0x5f2348[_0x53a2('0x1a')](_0x4eb061)[_0x53a2('0x28')](_0x598bd4);};}exports[_0x53a2('0x29')]=function(_0x5c3674,_0x91f072){var _0x148811={},_0x115e21={},_0x5dad1b={'count':0x0,'rows':[]};var _0x2c0b9f=_[_0x53a2('0x2a')](db[_0x53a2('0x2b')]['rawAttributes'],function(_0x35210a){return{'name':_0x35210a[_0x53a2('0x2c')],'type':_0x35210a[_0x53a2('0x2d')][_0x53a2('0x2e')]};});_0x115e21[_0x53a2('0x2f')]=_[_0x53a2('0x2a')](_0x2c0b9f,_0x53a2('0x27'));_0x115e21[_0x53a2('0x30')]=_['keys'](_0x5c3674[_0x53a2('0x30')]);_0x115e21[_0x53a2('0x31')]=_[_0x53a2('0x32')](_0x115e21['model'],_0x115e21[_0x53a2('0x30')]);_0x148811[_0x53a2('0x33')]=_[_0x53a2('0x32')](_0x115e21[_0x53a2('0x2f')],qs[_0x53a2('0x34')](_0x5c3674['query']['fields']));_0x148811[_0x53a2('0x33')]=_0x148811[_0x53a2('0x33')][_0x53a2('0x35')]?_0x148811[_0x53a2('0x33')]:_0x115e21[_0x53a2('0x2f')];if(!_0x5c3674[_0x53a2('0x30')][_0x53a2('0x36')](_0x53a2('0x37'))){_0x148811['limit']=qs['limit'](_0x5c3674[_0x53a2('0x30')]['limit']);_0x148811[_0x53a2('0x1c')]=qs['offset'](_0x5c3674[_0x53a2('0x30')]['offset']);}_0x148811[_0x53a2('0x38')]=qs[_0x53a2('0x39')](_0x5c3674[_0x53a2('0x30')][_0x53a2('0x39')]);_0x148811[_0x53a2('0x3a')]=qs['filters'](_[_0x53a2('0x3b')](_0x5c3674[_0x53a2('0x30')],_0x115e21[_0x53a2('0x31')]),_0x2c0b9f);if(_0x5c3674['query'][_0x53a2('0x3c')]){_0x148811[_0x53a2('0x3a')]=_['merge'](_0x148811[_0x53a2('0x3a')],{'$or':_[_0x53a2('0x2a')](_0x2c0b9f,function(_0x5783bd){if(_0x5783bd[_0x53a2('0x2d')]!=='VIRTUAL'){var _0xcc66e7={};_0xcc66e7[_0x5783bd[_0x53a2('0x27')]]={'$like':'%'+_0x5c3674[_0x53a2('0x30')]['filter']+'%'};return _0xcc66e7;}})});}_0x148811=_[_0x53a2('0x3d')]({},_0x148811,_0x5c3674['options']);var _0x20acd7={'where':_0x148811[_0x53a2('0x3a')]};return db['VoiceQueueReport'][_0x53a2('0x1f')](_0x20acd7)[_0x53a2('0x23')](function(_0x583dbd){_0x5dad1b[_0x53a2('0x1f')]=_0x583dbd;if(_0x5c3674['query'][_0x53a2('0x3e')]){_0x148811['include']=[{'all':!![]}];}return db[_0x53a2('0x2b')]['findAll'](_0x148811);})['then'](function(_0x1fd3c2){_0x5dad1b['rows']=_0x1fd3c2;return _0x5dad1b;})[_0x53a2('0x23')](respondWithFilteredResult(_0x91f072,_0x148811))['catch'](handleError(_0x91f072,null));};exports[_0x53a2('0x3f')]=function(_0x4c5f12,_0xff2c86){var _0x36e0d5={'raw':![],'where':{'id':_0x4c5f12[_0x53a2('0x40')]['id']}},_0x1cc212={};_0x1cc212[_0x53a2('0x2f')]=_['keys'](db[_0x53a2('0x2b')][_0x53a2('0x41')]);_0x1cc212[_0x53a2('0x30')]=_['keys'](_0x4c5f12[_0x53a2('0x30')]);_0x1cc212[_0x53a2('0x31')]=_[_0x53a2('0x32')](_0x1cc212[_0x53a2('0x2f')],_0x1cc212[_0x53a2('0x30')]);_0x36e0d5[_0x53a2('0x33')]=_[_0x53a2('0x32')](_0x1cc212[_0x53a2('0x2f')],qs[_0x53a2('0x34')](_0x4c5f12[_0x53a2('0x30')]['fields']));_0x36e0d5[_0x53a2('0x33')]=_0x36e0d5[_0x53a2('0x33')][_0x53a2('0x35')]?_0x36e0d5['attributes']:_0x1cc212[_0x53a2('0x2f')];if(_0x4c5f12[_0x53a2('0x30')][_0x53a2('0x3e')]){_0x36e0d5[_0x53a2('0x42')]=[{'all':!![]}];}_0x36e0d5=_[_0x53a2('0x3d')]({},_0x36e0d5,_0x4c5f12[_0x53a2('0x43')]);return db[_0x53a2('0x2b')][_0x53a2('0x44')](_0x36e0d5)[_0x53a2('0x23')](handleEntityNotFound(_0xff2c86,null))[_0x53a2('0x23')](respondWithResult(_0xff2c86,null))[_0x53a2('0x45')](handleError(_0xff2c86,null));};exports[_0x53a2('0x46')]=function(_0x49e7b6,_0x5745ff){return db[_0x53a2('0x2b')]['create'](_0x49e7b6[_0x53a2('0x47')],{})['then'](respondWithResult(_0x5745ff,0xc9))[_0x53a2('0x45')](handleError(_0x5745ff,null));};exports[_0x53a2('0x48')]=function(_0xba43f1,_0x1bcd5c){if(_0xba43f1['body']['id']){delete _0xba43f1[_0x53a2('0x47')]['id'];}return db[_0x53a2('0x2b')][_0x53a2('0x44')]({'where':{'id':_0xba43f1[_0x53a2('0x40')]['id']}})[_0x53a2('0x23')](handleEntityNotFound(_0x1bcd5c,null))[_0x53a2('0x23')](saveUpdates(_0xba43f1[_0x53a2('0x47')],null))[_0x53a2('0x23')](respondWithResult(_0x1bcd5c,null))[_0x53a2('0x45')](handleError(_0x1bcd5c,null));};exports[_0x53a2('0x24')]=function(_0x3d4639,_0x1461af){return db['VoiceQueueReport'][_0x53a2('0x44')]({'where':{'id':_0x3d4639['params']['id']}})[_0x53a2('0x23')](handleEntityNotFound(_0x1461af,null))['then'](removeEntity(_0x1461af,null))[_0x53a2('0x45')](handleError(_0x1461af,null));};exports[_0x53a2('0x49')]=function(_0x192a49,_0x299a84){return db['VoiceQueueReport'][_0x53a2('0x49')]()['then'](respondWithResult(_0x299a84,null))['catch'](handleError(_0x299a84,null));};exports[_0x53a2('0x4a')]=function(_0x4282a5,_0x203048){var _0x4abc0b={},_0x24d7e6={},_0x6c03a5={'count':0x0,'rows':[]};_0x24d7e6[_0x53a2('0x2f')]=_['keys'](db['VoiceQueueReport'][_0x53a2('0x41')]);_0x24d7e6[_0x53a2('0x30')]=_[_0x53a2('0x4b')](_0x4282a5['query']);_0x24d7e6[_0x53a2('0x31')]=_[_0x53a2('0x32')](_0x24d7e6[_0x53a2('0x2f')],_0x24d7e6[_0x53a2('0x30')]);_0x4abc0b['attributes']=_[_0x53a2('0x32')](_0x24d7e6[_0x53a2('0x2f')],qs[_0x53a2('0x34')](_0x4282a5['query'][_0x53a2('0x34')]));_0x4abc0b['attributes']=_0x4abc0b['attributes'][_0x53a2('0x35')]?_0x4abc0b[_0x53a2('0x33')]:_0x24d7e6[_0x53a2('0x2f')];if(!_0x4282a5[_0x53a2('0x30')][_0x53a2('0x36')](_0x53a2('0x37'))){_0x4abc0b[_0x53a2('0x1d')]=qs['limit'](_0x4282a5[_0x53a2('0x30')][_0x53a2('0x1d')]);_0x4abc0b[_0x53a2('0x1c')]=qs['offset'](_0x4282a5['query'][_0x53a2('0x1c')]);}_0x4abc0b['order']=qs[_0x53a2('0x39')](_0x4282a5[_0x53a2('0x30')][_0x53a2('0x39')]);_0x4abc0b['where']=qs['filters'](_[_0x53a2('0x3b')](_0x4282a5[_0x53a2('0x30')],_0x24d7e6['filters']));if(_0x4282a5[_0x53a2('0x30')][_0x53a2('0x3c')]){_0x4abc0b['where']=_[_0x53a2('0x3d')](_0x4abc0b['where'],{'$or':_[_0x53a2('0x2a')](_0x4abc0b[_0x53a2('0x33')],function(_0x30df21){var _0x2c7f45={};_0x2c7f45[_0x30df21]={'$like':'%'+_0x4282a5['query'][_0x53a2('0x3c')]+'%'};return _0x2c7f45;})});}_0x4abc0b=_[_0x53a2('0x3d')]({},_0x4abc0b,_0x4282a5[_0x53a2('0x43')]);var _0x5449b2={'where':_0x4abc0b[_0x53a2('0x3a')]};return db[_0x53a2('0x2b')]['count'](_0x5449b2)['then'](function(_0x31c8f4){_0x6c03a5['count']=_0x31c8f4;if(_0x4282a5[_0x53a2('0x30')][_0x53a2('0x3e')]){_0x4abc0b[_0x53a2('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x53a2('0x4c')](_0x4abc0b);})[_0x53a2('0x23')](function(_0x464e2d){_0x6c03a5[_0x53a2('0x4d')]=_0x464e2d;return _0x6c03a5;})[_0x53a2('0x23')](respondWithFilteredResult(_0x203048,_0x4abc0b,_0x53a2('0x4a')))[_0x53a2('0x45')](handleError(_0x203048,null,_0x53a2('0x4a')));}; \ No newline at end of file +var _0x9004=['offset','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','getVoiceQueuesReport','length','hasOwnProperty','pick','filter','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','undefined','limit','count'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x9004,0x170));var _0x4900=function(_0xc62924,_0x399bd0){_0xc62924=_0xc62924-0x0;var _0x4e5c13=_0x9004[_0xc62924];return _0x4e5c13;};'use strict';var emlformat=require(_0x4900('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4900('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4900('0x2'));var moment=require('moment');var BPromise=require(_0x4900('0x3'));var Mustache=require(_0x4900('0x4'));var util=require(_0x4900('0x5'));var path=require(_0x4900('0x6'));var sox=require(_0x4900('0x7'));var csv=require(_0x4900('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4900('0x9'));var _=require('lodash');var squel=require(_0x4900('0xa'));var crypto=require(_0x4900('0xb'));var jsforce=require(_0x4900('0xc'));var deskjs=require(_0x4900('0xd'));var toCsv=require(_0x4900('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4900('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4900('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4900('0x10'))(_0x4900('0x11'));var utils=require(_0x4900('0x12'));var config=require(_0x4900('0x13'));var licenseUtil=require(_0x4900('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4900('0x15')](config[_0x4900('0x16')],{'host':_0x4900('0x17'),'port':0x18eb});var socket=require(_0x4900('0x18'))(new Redis(config[_0x4900('0x16')]));require(_0x4900('0x19'))[_0x4900('0x1a')](socket);function respondWithStatusCode(_0x5d9d41,_0x540706){_0x540706=_0x540706||0xcc;return function(_0x378d21){if(_0x378d21){return _0x5d9d41['sendStatus'](_0x540706);}return _0x5d9d41[_0x4900('0x1b')](_0x540706)['end']();};}function respondWithResult(_0x16c7b9,_0x8cd6e){_0x8cd6e=_0x8cd6e||0xc8;return function(_0x4fce8a){if(_0x4fce8a){return _0x16c7b9['status'](_0x8cd6e)[_0x4900('0x1c')](_0x4fce8a);}};}function respondWithFilteredResult(_0xbcaa48,_0x3372b3){return function(_0x5b9b22){if(_0x5b9b22){var _0x4e73dc=typeof _0x3372b3['offset']===_0x4900('0x1d')&&typeof _0x3372b3[_0x4900('0x1e')]===_0x4900('0x1d');var _0x2cfaa2=_0x5b9b22[_0x4900('0x1f')];var _0x4507b4=_0x4e73dc?0x0:_0x3372b3['offset'];var _0x194ac5=_0x4e73dc?_0x5b9b22[_0x4900('0x1f')]:_0x3372b3[_0x4900('0x20')]+_0x3372b3[_0x4900('0x1e')];var _0x35fe76;if(_0x194ac5>=_0x2cfaa2){_0x194ac5=_0x2cfaa2;_0x35fe76=0xc8;}else{_0x35fe76=0xce;}_0xbcaa48[_0x4900('0x1b')](_0x35fe76);return _0xbcaa48[_0x4900('0x21')](_0x4900('0x22'),_0x4507b4+'-'+_0x194ac5+'/'+_0x2cfaa2)[_0x4900('0x1c')](_0x5b9b22);}return null;};}function patchUpdates(_0x9280ea){return function(_0x5bae54){try{jsonpatch[_0x4900('0x23')](_0x5bae54,_0x9280ea,!![]);}catch(_0x4b2c73){return BPromise['reject'](_0x4b2c73);}return _0x5bae54[_0x4900('0x24')]();};}function saveUpdates(_0x392587,_0x534d7a){return function(_0xb31d27){if(_0xb31d27){return _0xb31d27[_0x4900('0x25')](_0x392587)['then'](function(_0x34e966){return _0x34e966;});}return null;};}function removeEntity(_0x288a86,_0x1eedb0){return function(_0x4c38a2){if(_0x4c38a2){return _0x4c38a2[_0x4900('0x26')]()[_0x4900('0x27')](function(){_0x288a86['status'](0xcc)[_0x4900('0x28')]();});}};}function handleEntityNotFound(_0x29b4cb,_0x235293){return function(_0x4da06e){if(!_0x4da06e){_0x29b4cb['sendStatus'](0x194);}return _0x4da06e;};}function handleError(_0x505420,_0x47b804){_0x47b804=_0x47b804||0x1f4;return function(_0x323e11){logger[_0x4900('0x29')](_0x323e11[_0x4900('0x2a')]);if(_0x323e11[_0x4900('0x2b')]){delete _0x323e11[_0x4900('0x2b')];}_0x505420[_0x4900('0x1b')](_0x47b804)[_0x4900('0x2c')](_0x323e11);};}exports[_0x4900('0x2d')]=function(_0x258207,_0x3e9186){var _0x54dc6e={},_0x637db3={},_0x20ff24={'count':0x0,'rows':[]};var _0x8e10f6=_[_0x4900('0x2e')](db[_0x4900('0x2f')][_0x4900('0x30')],function(_0x476ece){return{'name':_0x476ece['fieldName'],'type':_0x476ece[_0x4900('0x31')]['key']};});_0x637db3[_0x4900('0x32')]=_['map'](_0x8e10f6,_0x4900('0x2b'));_0x637db3['query']=_[_0x4900('0x33')](_0x258207[_0x4900('0x34')]);_0x637db3[_0x4900('0x35')]=_[_0x4900('0x36')](_0x637db3[_0x4900('0x32')],_0x637db3[_0x4900('0x34')]);_0x54dc6e[_0x4900('0x37')]=_['intersection'](_0x637db3[_0x4900('0x32')],qs[_0x4900('0x38')](_0x258207[_0x4900('0x34')][_0x4900('0x38')]));_0x54dc6e[_0x4900('0x37')]=_0x54dc6e[_0x4900('0x37')]['length']?_0x54dc6e['attributes']:_0x637db3[_0x4900('0x32')];if(!_0x258207[_0x4900('0x34')]['hasOwnProperty'](_0x4900('0x39'))){_0x54dc6e[_0x4900('0x1e')]=qs[_0x4900('0x1e')](_0x258207[_0x4900('0x34')]['limit']);_0x54dc6e[_0x4900('0x20')]=qs[_0x4900('0x20')](_0x258207[_0x4900('0x34')][_0x4900('0x20')]);}_0x54dc6e[_0x4900('0x3a')]=qs[_0x4900('0x3b')](_0x258207[_0x4900('0x34')][_0x4900('0x3b')]);_0x54dc6e['where']=qs[_0x4900('0x35')](_['pick'](_0x258207[_0x4900('0x34')],_0x637db3[_0x4900('0x35')]),_0x8e10f6);if(_0x258207[_0x4900('0x34')]['filter']){_0x54dc6e['where']=_[_0x4900('0x3c')](_0x54dc6e[_0x4900('0x3d')],{'$or':_['map'](_0x8e10f6,function(_0x20b4ea){if(_0x20b4ea[_0x4900('0x31')]!==_0x4900('0x3e')){var _0x5108de={};_0x5108de[_0x20b4ea[_0x4900('0x2b')]]={'$like':'%'+_0x258207[_0x4900('0x34')]['filter']+'%'};return _0x5108de;}})});}_0x54dc6e=_[_0x4900('0x3c')]({},_0x54dc6e,_0x258207[_0x4900('0x3f')]);var _0x4b4d1b={'where':_0x54dc6e[_0x4900('0x3d')]};return db[_0x4900('0x2f')][_0x4900('0x1f')](_0x4b4d1b)[_0x4900('0x27')](function(_0x37f9a6){_0x20ff24[_0x4900('0x1f')]=_0x37f9a6;if(_0x258207[_0x4900('0x34')]['includeAll']){_0x54dc6e[_0x4900('0x40')]=[{'all':!![]}];}return db[_0x4900('0x2f')][_0x4900('0x41')](_0x54dc6e);})[_0x4900('0x27')](function(_0x3e01f3){_0x20ff24[_0x4900('0x42')]=_0x3e01f3;return _0x20ff24;})[_0x4900('0x27')](respondWithFilteredResult(_0x3e9186,_0x54dc6e))[_0x4900('0x43')](handleError(_0x3e9186,null));};exports[_0x4900('0x44')]=function(_0x12f559,_0x4837f7){var _0x46deb8={'raw':![],'where':{'id':_0x12f559[_0x4900('0x45')]['id']}},_0x4ff513={};_0x4ff513[_0x4900('0x32')]=_[_0x4900('0x33')](db['VoiceQueueReport'][_0x4900('0x30')]);_0x4ff513[_0x4900('0x34')]=_[_0x4900('0x33')](_0x12f559[_0x4900('0x34')]);_0x4ff513[_0x4900('0x35')]=_['intersection'](_0x4ff513['model'],_0x4ff513['query']);_0x46deb8[_0x4900('0x37')]=_['intersection'](_0x4ff513[_0x4900('0x32')],qs[_0x4900('0x38')](_0x12f559[_0x4900('0x34')][_0x4900('0x38')]));_0x46deb8[_0x4900('0x37')]=_0x46deb8[_0x4900('0x37')]['length']?_0x46deb8[_0x4900('0x37')]:_0x4ff513['model'];if(_0x12f559[_0x4900('0x34')][_0x4900('0x46')]){_0x46deb8[_0x4900('0x40')]=[{'all':!![]}];}_0x46deb8=_['merge']({},_0x46deb8,_0x12f559[_0x4900('0x3f')]);return db['VoiceQueueReport'][_0x4900('0x47')](_0x46deb8)[_0x4900('0x27')](handleEntityNotFound(_0x4837f7,null))[_0x4900('0x27')](respondWithResult(_0x4837f7,null))['catch'](handleError(_0x4837f7,null));};exports[_0x4900('0x48')]=function(_0x3da842,_0x586e5c){return db[_0x4900('0x2f')][_0x4900('0x48')](_0x3da842[_0x4900('0x49')],{})[_0x4900('0x27')](respondWithResult(_0x586e5c,0xc9))[_0x4900('0x43')](handleError(_0x586e5c,null));};exports['update']=function(_0x1bec6d,_0x60a9fc){if(_0x1bec6d[_0x4900('0x49')]['id']){delete _0x1bec6d['body']['id'];}return db[_0x4900('0x2f')][_0x4900('0x47')]({'where':{'id':_0x1bec6d[_0x4900('0x45')]['id']}})['then'](handleEntityNotFound(_0x60a9fc,null))[_0x4900('0x27')](saveUpdates(_0x1bec6d['body'],null))['then'](respondWithResult(_0x60a9fc,null))['catch'](handleError(_0x60a9fc,null));};exports['destroy']=function(_0xc96fd3,_0x2422b9){return db[_0x4900('0x2f')][_0x4900('0x47')]({'where':{'id':_0xc96fd3['params']['id']}})[_0x4900('0x27')](handleEntityNotFound(_0x2422b9,null))['then'](removeEntity(_0x2422b9,null))[_0x4900('0x43')](handleError(_0x2422b9,null));};exports[_0x4900('0x4a')]=function(_0x1e242f,_0x19362b){return db[_0x4900('0x2f')][_0x4900('0x4a')]()['then'](respondWithResult(_0x19362b,null))[_0x4900('0x43')](handleError(_0x19362b,null));};exports[_0x4900('0x4b')]=function(_0x3801e2,_0x21dbf5){var _0xbc56c1={},_0xb255a3={},_0x464fb9={'count':0x0,'rows':[]};_0xb255a3['model']=_[_0x4900('0x33')](db[_0x4900('0x2f')]['rawAttributes']);_0xb255a3[_0x4900('0x34')]=_[_0x4900('0x33')](_0x3801e2['query']);_0xb255a3[_0x4900('0x35')]=_[_0x4900('0x36')](_0xb255a3[_0x4900('0x32')],_0xb255a3['query']);_0xbc56c1[_0x4900('0x37')]=_[_0x4900('0x36')](_0xb255a3[_0x4900('0x32')],qs[_0x4900('0x38')](_0x3801e2[_0x4900('0x34')][_0x4900('0x38')]));_0xbc56c1['attributes']=_0xbc56c1['attributes'][_0x4900('0x4c')]?_0xbc56c1[_0x4900('0x37')]:_0xb255a3[_0x4900('0x32')];if(!_0x3801e2['query'][_0x4900('0x4d')]('nolimit')){_0xbc56c1[_0x4900('0x1e')]=qs[_0x4900('0x1e')](_0x3801e2['query']['limit']);_0xbc56c1[_0x4900('0x20')]=qs['offset'](_0x3801e2[_0x4900('0x34')][_0x4900('0x20')]);}_0xbc56c1['order']=qs['sort'](_0x3801e2[_0x4900('0x34')][_0x4900('0x3b')]);_0xbc56c1[_0x4900('0x3d')]=qs['filters'](_[_0x4900('0x4e')](_0x3801e2[_0x4900('0x34')],_0xb255a3['filters']));if(_0x3801e2[_0x4900('0x34')][_0x4900('0x4f')]){_0xbc56c1[_0x4900('0x3d')]=_[_0x4900('0x3c')](_0xbc56c1['where'],{'$or':_[_0x4900('0x2e')](_0xbc56c1[_0x4900('0x37')],function(_0x4994fd){var _0x22cf5c={};_0x22cf5c[_0x4994fd]={'$like':'%'+_0x3801e2[_0x4900('0x34')]['filter']+'%'};return _0x22cf5c;})});}_0xbc56c1=_[_0x4900('0x3c')]({},_0xbc56c1,_0x3801e2[_0x4900('0x3f')]);var _0xad9b7a={'where':_0xbc56c1['where']};return db[_0x4900('0x2f')][_0x4900('0x1f')](_0xad9b7a)[_0x4900('0x27')](function(_0x43b6f2){_0x464fb9[_0x4900('0x1f')]=_0x43b6f2;if(_0x3801e2['query']['includeAll']){_0xbc56c1[_0x4900('0x40')]=[{'all':!![]}];}return db[_0x4900('0x2f')]['findAll'](_0xbc56c1);})[_0x4900('0x27')](function(_0x48683c){_0x464fb9['rows']=_0x48683c;return _0x464fb9;})[_0x4900('0x27')](respondWithFilteredResult(_0x21dbf5,_0xbc56c1,_0x4900('0x4b')))['catch'](handleError(_0x21dbf5,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 14f6e9e..7bfb427 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 _0x4a32=['hook','exports','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0x4a32,0x10a));var _0x24a3=function(_0x18655b,_0xbf5752){_0x18655b=_0x18655b-0x0;var _0x56477e=_0x4a32[_0x18655b];return _0x56477e;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x24a3('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x24a3('0x1')](0x0);var events={'afterCreate':_0x24a3('0x2'),'afterUpdate':_0x24a3('0x3'),'afterDestroy':_0x24a3('0x4')};function emitEvent(_0x477e8e){return function(_0x5d5440,_0x140e4c,_0x568c10){VoiceQueueReportEvents[_0x24a3('0x5')](_0x477e8e+':'+_0x5d5440['id'],_0x5d5440);VoiceQueueReportEvents[_0x24a3('0x5')](_0x477e8e,_0x5d5440);_0x568c10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x24a3('0x6')](e,emitEvent(event));}}module[_0x24a3('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x8467=['events','VoiceQueueReport','setMaxListeners','update','remove','emit','exports'];(function(_0x4dcac4,_0x10e48a){var _0x2a238d=function(_0x25c6fc){while(--_0x25c6fc){_0x4dcac4['push'](_0x4dcac4['shift']());}};_0x2a238d(++_0x10e48a);}(_0x8467,0x17a));var _0x7846=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x8467[_0x55abd9];return _0x3e5669;};'use strict';var EventEmitter=require(_0x7846('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x7846('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7846('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7846('0x3'),'afterDestroy':_0x7846('0x4')};function emitEvent(_0x2d4933){return function(_0x1e1aeb,_0x5d2cd8,_0x270fcb){VoiceQueueReportEvents[_0x7846('0x5')](_0x2d4933+':'+_0x1e1aeb['id'],_0x1e1aeb);VoiceQueueReportEvents['emit'](_0x2d4933,_0x1e1aeb);_0x270fcb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x7846('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3c1b82c..9acb60c 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 _0xa7cc=['rimraf','../../config/environment','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1e99d1,_0x38250c){var _0x3ae329=function(_0x2db617){while(--_0x2db617){_0x1e99d1['push'](_0x1e99d1['shift']());}};_0x3ae329(++_0x38250c);}(_0xa7cc,0x1f2));var _0xca7c=function(_0x726624,_0x21f598){_0x726624=_0x726624-0x0;var _0x14fb9f=_0xa7cc[_0x726624];return _0x14fb9f;};'use strict';var _=require('lodash');var util=require(_0xca7c('0x0'));var logger=require(_0xca7c('0x1'))('api');var moment=require(_0xca7c('0x2'));var BPromise=require(_0xca7c('0x3'));var rp=require(_0xca7c('0x4'));var fs=require('fs');var path=require(_0xca7c('0x5'));var rimraf=require(_0xca7c('0x6'));var config=require(_0xca7c('0x7'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x33f519,_0x2315b4){return _0x33f519['define'](_0xca7c('0x8'),attributes,{'tableName':_0xca7c('0x9'),'paranoid':![],'indexes':[{'fields':[_0xca7c('0xa')]},{'fields':[_0xca7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef7=['../../config/environment','VoiceQueueReport','uniqueid','calleridnum','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x422175,_0x3cfb95){var _0x2e4d93=function(_0x39ae79){while(--_0x39ae79){_0x422175['push'](_0x422175['shift']());}};_0x2e4d93(++_0x3cfb95);}(_0x8ef7,0xa4));var _0x78ef=function(_0x57ced3,_0x26b306){_0x57ced3=_0x57ced3-0x0;var _0xbf848d=_0x8ef7[_0x57ced3];return _0xbf848d;};'use strict';var _=require('lodash');var util=require(_0x78ef('0x0'));var logger=require(_0x78ef('0x1'))('api');var moment=require(_0x78ef('0x2'));var BPromise=require('bluebird');var rp=require(_0x78ef('0x3'));var fs=require('fs');var path=require(_0x78ef('0x4'));var rimraf=require(_0x78ef('0x5'));var config=require(_0x78ef('0x6'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x486bc6,_0x34b365){return _0x486bc6['define'](_0x78ef('0x7'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x78ef('0x8')]},{'fields':[_0x78ef('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 5b8fcda..2c4ccda 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 _0xdb5e=['request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueueReport','debug','CreateVoiceQueueReport','create','body','raw','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket'];(function(_0x2a358f,_0x5aa90d){var _0x1341b4=function(_0x3e18f7){while(--_0x3e18f7){_0x2a358f['push'](_0x2a358f['shift']());}};_0x1341b4(++_0x5aa90d);}(_0xdb5e,0x9e));var _0xedb5=function(_0x162434,_0x18cf20){_0x162434=_0x162434-0x0;var _0x8bc76d=_0xdb5e[_0x162434];return _0x8bc76d;};'use strict';var _=require(_0xedb5('0x0'));var util=require(_0xedb5('0x1'));var moment=require(_0xedb5('0x2'));var BPromise=require('bluebird');var rs=require(_0xedb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedb5('0x4'))['db'];var utils=require(_0xedb5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xedb5('0x6'));var jayson=require(_0xedb5('0x7'));var client=jayson[_0xedb5('0x8')][_0xedb5('0x9')]({'port':0x232a});config[_0xedb5('0xa')]=_[_0xedb5('0xb')](config[_0xedb5('0xa')],{'host':_0xedb5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedb5('0xa')]));require(_0xedb5('0xd'))['register'](socket);function respondWithRpcPromise(_0x18fb94,_0x5a4fac,_0x8291cb){return new BPromise(function(_0x67ba07,_0x222f6d){return client[_0xedb5('0xe')](_0x18fb94,_0x8291cb)[_0xedb5('0xf')](function(_0x4602b5){logger[_0xedb5('0x10')](_0xedb5('0x11'),_0x5a4fac,'request\x20sent');logger['debug'](_0xedb5('0x12'),_0x5a4fac,'request\x20sent',JSON['stringify'](_0x4602b5));if(_0x4602b5[_0xedb5('0x13')]){if(_0x4602b5['error'][_0xedb5('0x14')]===0x1f4){logger[_0xedb5('0x13')](_0xedb5('0x11'),_0x5a4fac,_0x4602b5[_0xedb5('0x13')]['message']);return _0x222f6d(_0x4602b5['error']['message']);}logger['error'](_0xedb5('0x11'),_0x5a4fac,_0x4602b5[_0xedb5('0x13')]['message']);return _0x67ba07(_0x4602b5['error'][_0xedb5('0x15')]);}else{logger[_0xedb5('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x5a4fac,_0xedb5('0x16'));_0x67ba07(_0x4602b5[_0xedb5('0x17')][_0xedb5('0x15')]);}})[_0xedb5('0x18')](function(_0x10065b){logger[_0xedb5('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x5a4fac,_0x10065b);_0x222f6d(_0x10065b);});});}exports['GetVoiceQueueReport']=function(_0x3eca53){var _0x75374c=this;return new Promise(function(_0x34a1e0,_0x547fe8){return db[_0xedb5('0x19')][_0xedb5('0x1a')]({'raw':_0x3eca53[_0xedb5('0x1b')]?_0x3eca53['options']['raw']===undefined?!![]:![]:!![],'where':_0x3eca53[_0xedb5('0x1b')]?_0x3eca53[_0xedb5('0x1b')][_0xedb5('0x1c')]||null:null,'attributes':_0x3eca53['options']?_0x3eca53['options'][_0xedb5('0x1d')]||null:null,'limit':_0x3eca53[_0xedb5('0x1b')]?_0x3eca53[_0xedb5('0x1b')][_0xedb5('0x1e')]||null:null,'include':_0x3eca53[_0xedb5('0x1b')]?_0x3eca53[_0xedb5('0x1b')][_0xedb5('0x1f')]?_[_0xedb5('0x20')](_0x3eca53[_0xedb5('0x1b')][_0xedb5('0x1f')],function(_0x274d68){return{'model':db[_0x274d68[_0xedb5('0x21')]],'as':_0x274d68['as'],'attributes':_0x274d68[_0xedb5('0x1d')],'include':_0x274d68[_0xedb5('0x1f')]?_['map'](_0x274d68['include'],function(_0x1f636e){return{'model':db[_0x1f636e[_0xedb5('0x21')]],'as':_0x1f636e['as'],'attributes':_0x1f636e[_0xedb5('0x1d')],'include':_0x1f636e[_0xedb5('0x1f')]?_[_0xedb5('0x20')](_0x1f636e[_0xedb5('0x1f')],function(_0x5aca82){return{'model':db[_0x5aca82[_0xedb5('0x21')]],'as':_0x5aca82['as'],'attributes':_0x5aca82['attributes']};}):[]};}):[]};}):[]:[]})[_0xedb5('0xf')](function(_0x2cb932){logger[_0xedb5('0x10')](_0xedb5('0x22'),_0x3eca53);logger[_0xedb5('0x23')](_0xedb5('0x22'),_0x3eca53,JSON['stringify'](_0x2cb932));_0x34a1e0(_0x2cb932);})[_0xedb5('0x18')](function(_0x348d19){logger['error']('GetVoiceQueueReport',_0x348d19[_0xedb5('0x15')],_0x3eca53);_0x547fe8(_0x75374c[_0xedb5('0x13')](0x1f4,_0x348d19[_0xedb5('0x15')]));});});};exports[_0xedb5('0x24')]=function(_0x4ff3a2){var _0x19b00f=this;return new Promise(function(_0x2a5b8e,_0x2c4109){return db[_0xedb5('0x19')][_0xedb5('0x25')](_0x4ff3a2[_0xedb5('0x26')],{'raw':_0x4ff3a2[_0xedb5('0x1b')]?_0x4ff3a2[_0xedb5('0x1b')][_0xedb5('0x27')]===undefined?!![]:![]:!![]})[_0xedb5('0xf')](function(_0x26c994){logger[_0xedb5('0x10')](_0xedb5('0x24'),_0x4ff3a2);logger[_0xedb5('0x23')](_0xedb5('0x24'),_0x4ff3a2,JSON[_0xedb5('0x28')](_0x26c994));_0x2a5b8e(_0x26c994);})[_0xedb5('0x18')](function(_0x414d04){logger[_0xedb5('0x13')](_0xedb5('0x24'),_0x414d04[_0xedb5('0x15')],_0x4ff3a2);_0x2c4109(_0x19b00f[_0xedb5('0x13')](0x1f4,_0x414d04[_0xedb5('0x15')]));});});};exports[_0xedb5('0x29')]=function(_0x3f5bf9){var _0x141727=this;return new Promise(function(_0x1ee4cc,_0x58e7de){return db[_0xedb5('0x19')][_0xedb5('0x2a')](_0x3f5bf9[_0xedb5('0x26')],{'raw':_0x3f5bf9[_0xedb5('0x1b')]?_0x3f5bf9[_0xedb5('0x1b')][_0xedb5('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f5bf9[_0xedb5('0x1b')]?_0x3f5bf9[_0xedb5('0x1b')]['where']||null:null,'attributes':_0x3f5bf9[_0xedb5('0x1b')]?_0x3f5bf9[_0xedb5('0x1b')][_0xedb5('0x1d')]||null:null,'limit':_0x3f5bf9[_0xedb5('0x1b')]?_0x3f5bf9[_0xedb5('0x1b')][_0xedb5('0x1e')]||null:null})[_0xedb5('0xf')](function(_0x5915a8){logger[_0xedb5('0x10')](_0xedb5('0x29'),_0x3f5bf9);logger['debug'](_0xedb5('0x29'),_0x3f5bf9,JSON[_0xedb5('0x28')](_0x5915a8));_0x1ee4cc(_0x5915a8);})['catch'](function(_0x530052){logger['error'](_0xedb5('0x29'),_0x530052[_0xedb5('0x15')],_0x3f5bf9);_0x58e7de(_0x141727['error'](0x1f4,_0x530052[_0xedb5('0x15')]));});});}; \ No newline at end of file +var _0xf7f0=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceQueueReport','findAll','raw','options','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis'];(function(_0x38a261,_0x5d9082){var _0x23a465=function(_0x164869){while(--_0x164869){_0x38a261['push'](_0x38a261['shift']());}};_0x23a465(++_0x5d9082);}(_0xf7f0,0xfd));var _0x0f7f=function(_0x2b94b0,_0x539b20){_0x2b94b0=_0x2b94b0-0x0;var _0x259f9d=_0xf7f0[_0x2b94b0];return _0x259f9d;};'use strict';var _=require('lodash');var util=require(_0x0f7f('0x0'));var moment=require(_0x0f7f('0x1'));var BPromise=require(_0x0f7f('0x2'));var rs=require(_0x0f7f('0x3'));var fs=require('fs');var Redis=require(_0x0f7f('0x4'));var db=require(_0x0f7f('0x5'))['db'];var utils=require(_0x0f7f('0x6'));var logger=require(_0x0f7f('0x7'))(_0x0f7f('0x8'));var config=require('../../config/environment');var jayson=require(_0x0f7f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0f7f('0xa')]=_[_0x0f7f('0xb')](config[_0x0f7f('0xa')],{'host':_0x0f7f('0xc'),'port':0x18eb});var socket=require(_0x0f7f('0xd'))(new Redis(config[_0x0f7f('0xa')]));require(_0x0f7f('0xe'))['register'](socket);function respondWithRpcPromise(_0x4950a3,_0xc74791,_0x5d3652){return new BPromise(function(_0x7d88fd,_0x2ab583){return client['request'](_0x4950a3,_0x5d3652)[_0x0f7f('0xf')](function(_0xfc9247){logger['info'](_0x0f7f('0x10'),_0xc74791,_0x0f7f('0x11'));logger[_0x0f7f('0x12')](_0x0f7f('0x13'),_0xc74791,_0x0f7f('0x11'),JSON[_0x0f7f('0x14')](_0xfc9247));if(_0xfc9247[_0x0f7f('0x15')]){if(_0xfc9247[_0x0f7f('0x15')][_0x0f7f('0x16')]===0x1f4){logger[_0x0f7f('0x15')](_0x0f7f('0x10'),_0xc74791,_0xfc9247['error'][_0x0f7f('0x17')]);return _0x2ab583(_0xfc9247[_0x0f7f('0x15')]['message']);}logger[_0x0f7f('0x15')](_0x0f7f('0x10'),_0xc74791,_0xfc9247[_0x0f7f('0x15')][_0x0f7f('0x17')]);return _0x7d88fd(_0xfc9247[_0x0f7f('0x15')][_0x0f7f('0x17')]);}else{logger[_0x0f7f('0x18')](_0x0f7f('0x10'),_0xc74791,_0x0f7f('0x11'));_0x7d88fd(_0xfc9247[_0x0f7f('0x19')]['message']);}})[_0x0f7f('0x1a')](function(_0x2f4d2c){logger['error'](_0x0f7f('0x10'),_0xc74791,_0x2f4d2c);_0x2ab583(_0x2f4d2c);});});}exports['GetVoiceQueueReport']=function(_0x31282d){var _0x2cdc91=this;return new Promise(function(_0x1f3a3a,_0x44acf4){return db[_0x0f7f('0x1b')][_0x0f7f('0x1c')]({'raw':_0x31282d['options']?_0x31282d['options'][_0x0f7f('0x1d')]===undefined?!![]:![]:!![],'where':_0x31282d['options']?_0x31282d[_0x0f7f('0x1e')][_0x0f7f('0x1f')]||null:null,'attributes':_0x31282d[_0x0f7f('0x1e')]?_0x31282d[_0x0f7f('0x1e')][_0x0f7f('0x20')]||null:null,'limit':_0x31282d['options']?_0x31282d[_0x0f7f('0x1e')][_0x0f7f('0x21')]||null:null,'include':_0x31282d[_0x0f7f('0x1e')]?_0x31282d[_0x0f7f('0x1e')][_0x0f7f('0x22')]?_[_0x0f7f('0x23')](_0x31282d[_0x0f7f('0x1e')]['include'],function(_0x34c80d){return{'model':db[_0x34c80d[_0x0f7f('0x24')]],'as':_0x34c80d['as'],'attributes':_0x34c80d[_0x0f7f('0x20')],'include':_0x34c80d[_0x0f7f('0x22')]?_[_0x0f7f('0x23')](_0x34c80d['include'],function(_0xd3ad12){return{'model':db[_0xd3ad12['model']],'as':_0xd3ad12['as'],'attributes':_0xd3ad12[_0x0f7f('0x20')],'include':_0xd3ad12[_0x0f7f('0x22')]?_['map'](_0xd3ad12[_0x0f7f('0x22')],function(_0x408866){return{'model':db[_0x408866[_0x0f7f('0x24')]],'as':_0x408866['as'],'attributes':_0x408866[_0x0f7f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0f7f('0xf')](function(_0x1e89c9){logger[_0x0f7f('0x18')](_0x0f7f('0x25'),_0x31282d);logger['debug'](_0x0f7f('0x25'),_0x31282d,JSON[_0x0f7f('0x14')](_0x1e89c9));_0x1f3a3a(_0x1e89c9);})['catch'](function(_0x810baf){logger[_0x0f7f('0x15')]('GetVoiceQueueReport',_0x810baf[_0x0f7f('0x17')],_0x31282d);_0x44acf4(_0x2cdc91[_0x0f7f('0x15')](0x1f4,_0x810baf[_0x0f7f('0x17')]));});});};exports[_0x0f7f('0x26')]=function(_0x3f4e43){var _0x2f20ea=this;return new Promise(function(_0x1ec4b4,_0x533bd0){return db['VoiceQueueReport'][_0x0f7f('0x27')](_0x3f4e43[_0x0f7f('0x28')],{'raw':_0x3f4e43[_0x0f7f('0x1e')]?_0x3f4e43[_0x0f7f('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x102988){logger[_0x0f7f('0x18')](_0x0f7f('0x26'),_0x3f4e43);logger[_0x0f7f('0x12')](_0x0f7f('0x26'),_0x3f4e43,JSON['stringify'](_0x102988));_0x1ec4b4(_0x102988);})[_0x0f7f('0x1a')](function(_0x3b4326){logger[_0x0f7f('0x15')]('CreateVoiceQueueReport',_0x3b4326[_0x0f7f('0x17')],_0x3f4e43);_0x533bd0(_0x2f20ea[_0x0f7f('0x15')](0x1f4,_0x3b4326[_0x0f7f('0x17')]));});});};exports[_0x0f7f('0x29')]=function(_0x153d76){var _0x36a408=this;return new Promise(function(_0x2f5788,_0x485e2e){return db['VoiceQueueReport'][_0x0f7f('0x2a')](_0x153d76[_0x0f7f('0x28')],{'raw':_0x153d76['options']?_0x153d76[_0x0f7f('0x1e')][_0x0f7f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153d76['options']?_0x153d76[_0x0f7f('0x1e')][_0x0f7f('0x1f')]||null:null,'attributes':_0x153d76['options']?_0x153d76['options'][_0x0f7f('0x20')]||null:null,'limit':_0x153d76[_0x0f7f('0x1e')]?_0x153d76['options'][_0x0f7f('0x21')]||null:null})[_0x0f7f('0xf')](function(_0xc68fa){logger[_0x0f7f('0x18')](_0x0f7f('0x29'),_0x153d76);logger[_0x0f7f('0x12')]('UpdateVoiceQueueReport',_0x153d76,JSON['stringify'](_0xc68fa));_0x2f5788(_0xc68fa);})['catch'](function(_0x4e880b){logger['error']('UpdateVoiceQueueReport',_0x4e880b['message'],_0x153d76);_0x485e2e(_0x36a408[_0x0f7f('0x15')](0x1f4,_0x4e880b[_0x0f7f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 7e0be95..1eeb36b 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 _0x872a=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x1643e3,_0x31d511){var _0x32a2bf=function(_0x2b34da){while(--_0x2b34da){_0x1643e3['push'](_0x1643e3['shift']());}};_0x32a2bf(++_0x31d511);}(_0x872a,0x100));var _0xa872=function(_0x1bfc1f,_0x4d31d8){_0x1bfc1f=_0x1bfc1f-0x0;var _0x387328=_0x872a[_0x1bfc1f];return _0x387328;};'use strict';var VoiceQueueReportEvents=require(_0xa872('0x0'));var events=[_0xa872('0x1'),_0xa872('0x2'),_0xa872('0x3')];function createListener(_0x4a2170,_0x48294d){return function(_0x4c6509){_0x48294d[_0xa872('0x4')](_0x4a2170,_0x4c6509);};}function removeListener(_0x58715a,_0x2854a7){return function(){VoiceQueueReportEvents[_0xa872('0x5')](_0x58715a,_0x2854a7);};}exports[_0xa872('0x6')]=function(_0x1c8d2f){for(var _0x3e3cd4=0x0,_0x4aab9d=events[_0xa872('0x7')];_0x3e3cd4<_0x4aab9d;_0x3e3cd4++){var _0x1b87b7=events[_0x3e3cd4];var _0x1e0c05=createListener(_0xa872('0x8')+_0x1b87b7,_0x1c8d2f);VoiceQueueReportEvents['on'](_0x1b87b7,_0x1e0c05);}}; \ No newline at end of file +var _0x00bb=['removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit'];(function(_0x5ba46a,_0x582fe0){var _0x5cbf4f=function(_0x22349b){while(--_0x22349b){_0x5ba46a['push'](_0x5ba46a['shift']());}};_0x5cbf4f(++_0x582fe0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x00bb[_0x4e9628];return _0x27bc8c;};'use strict';var VoiceQueueReportEvents=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(){VoiceQueueReportEvents[_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);VoiceQueueReportEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 28d8f19..a5f6d38 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 _0x1a1c=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','index','get','/:id','show','post','isAuthenticated','put','update','delete'];(function(_0x110ea8,_0x5b76b0){var _0x10c4af=function(_0x2a5c76){while(--_0x2a5c76){_0x110ea8['push'](_0x110ea8['shift']());}};_0x10c4af(++_0x5b76b0);}(_0x1a1c,0xfe));var _0xc1a1=function(_0x9482d9,_0x5b2e18){_0x9482d9=_0x9482d9-0x0;var _0xeb58d9=_0x1a1c[_0x9482d9];return _0xeb58d9;};'use strict';var multer=require(_0xc1a1('0x0'));var util=require(_0xc1a1('0x1'));var path=require(_0xc1a1('0x2'));var timeout=require(_0xc1a1('0x3'));var express=require('express');var router=express[_0xc1a1('0x4')]();var fs_extra=require(_0xc1a1('0x5'));var auth=require(_0xc1a1('0x6'));var interaction=require(_0xc1a1('0x7'));var config=require(_0xc1a1('0x8'));var controller=require(_0xc1a1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1a1('0xa')]);router[_0xc1a1('0xb')](_0xc1a1('0xc'),auth['isAuthenticated'](),controller[_0xc1a1('0xd')]);router[_0xc1a1('0xe')]('/',auth[_0xc1a1('0xf')](),controller['create']);router[_0xc1a1('0x10')](_0xc1a1('0xc'),auth['isAuthenticated'](),controller[_0xc1a1('0x11')]);router[_0xc1a1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xc1a1('0x13')]);module[_0xc1a1('0x14')]=router; \ No newline at end of file +var _0xeb1a=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xeb1a,0x102));var _0xaeb1=function(_0x434ddc,_0x1f9e59){_0x434ddc=_0x434ddc-0x0;var _0x283bf5=_0xeb1a[_0x434ddc];return _0x283bf5;};'use strict';var multer=require(_0xaeb1('0x0'));var util=require(_0xaeb1('0x1'));var path=require(_0xaeb1('0x2'));var timeout=require(_0xaeb1('0x3'));var express=require(_0xaeb1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaeb1('0x5'));var interaction=require(_0xaeb1('0x6'));var config=require(_0xaeb1('0x7'));var controller=require(_0xaeb1('0x8'));router[_0xaeb1('0x9')]('/',auth['isAuthenticated'](),controller[_0xaeb1('0xa')]);router[_0xaeb1('0x9')]('/:id',auth[_0xaeb1('0xb')](),controller[_0xaeb1('0xc')]);router[_0xaeb1('0xd')]('/',auth[_0xaeb1('0xb')](),controller[_0xaeb1('0xe')]);router[_0xaeb1('0xf')](_0xaeb1('0x10'),auth[_0xaeb1('0xb')](),controller[_0xaeb1('0x11')]);router['delete'](_0xaeb1('0x10'),auth[_0xaeb1('0xb')](),controller[_0xaeb1('0x12')]);module[_0xaeb1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 199e45f..d47b667 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 _0x390f=['exports','STRING','DATE','literal','sequelize','moment'];(function(_0x8b953b,_0x132acf){var _0x1943d5=function(_0xc250b9){while(--_0xc250b9){_0x8b953b['push'](_0x8b953b['shift']());}};_0x1943d5(++_0x132acf);}(_0x390f,0x148));var _0xf390=function(_0x3c51af,_0x1991ce){_0x3c51af=_0x3c51af-0x0;var _0xeb10d9=_0x390f[_0x3c51af];return _0xeb10d9;};'use strict';var Sequelize=require(_0xf390('0x0'));var moment=require(_0xf390('0x1'));module[_0xf390('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xf390('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xf390('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x4a1c=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x11b80c,_0x3e8447){var _0x3b0d75=function(_0x6381d5){while(--_0x6381d5){_0x11b80c['push'](_0x11b80c['shift']());}};_0x3b0d75(++_0x3e8447);}(_0x4a1c,0x1ef));var _0xc4a1=function(_0x2f1f08,_0x158f35){_0x2f1f08=_0x2f1f08-0x0;var _0x32f365=_0x4a1c[_0x2f1f08];return _0x32f365;};'use strict';var Sequelize=require(_0xc4a1('0x0'));var moment=require(_0xc4a1('0x1'));module[_0xc4a1('0x2')]={'time':{'type':Sequelize[_0xc4a1('0x3')]},'callid':{'type':Sequelize[_0xc4a1('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc4a1('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc4a1('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc4a1('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc4a1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc4a1('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc4a1('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc4a1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc4a1('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xc4a1('0x4')](_0xc4a1('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 09c14f7..6dd5f72 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 _0x754d=['bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','map','VoiceQueuesLog','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','rawAttributes','include','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x754d,0x110));var _0xd754=function(_0x4cb317,_0x32efc7){_0x4cb317=_0x4cb317-0x0;var _0x106329=_0x754d[_0x4cb317];return _0x106329;};'use strict';var emlformat=require(_0xd754('0x0'));var rimraf=require(_0xd754('0x1'));var zipdir=require(_0xd754('0x2'));var jsonpatch=require(_0xd754('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd754('0x4'));var Mustache=require(_0xd754('0x5'));var util=require(_0xd754('0x6'));var path=require('path');var sox=require(_0xd754('0x7'));var csv=require('to-csv');var ejs=require(_0xd754('0x8'));var fs=require('fs');var fs_extra=require(_0xd754('0x9'));var _=require(_0xd754('0xa'));var squel=require(_0xd754('0xb'));var crypto=require(_0xd754('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd754('0xd'));var Papa=require('papaparse');var Redis=require(_0xd754('0xe'));var authService=require(_0xd754('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd754('0x10'));var licenseUtil=require(_0xd754('0x11'));var db=require(_0xd754('0x12'))['db'];function respondWithStatusCode(_0x234aa0,_0x4d31cb){_0x4d31cb=_0x4d31cb||0xcc;return function(_0x1627ae){if(_0x1627ae){return _0x234aa0['sendStatus'](_0x4d31cb);}return _0x234aa0[_0xd754('0x13')](_0x4d31cb)[_0xd754('0x14')]();};}function respondWithResult(_0x19b1b5,_0x267cb7){_0x267cb7=_0x267cb7||0xc8;return function(_0x583741){if(_0x583741){return _0x19b1b5[_0xd754('0x13')](_0x267cb7)[_0xd754('0x15')](_0x583741);}};}function respondWithFilteredResult(_0x1abde5,_0xc65eac){return function(_0x4a78d9){if(_0x4a78d9){var _0x5cd743=typeof _0xc65eac[_0xd754('0x16')]===_0xd754('0x17')&&typeof _0xc65eac[_0xd754('0x18')]===_0xd754('0x17');var _0x488ed4=_0x4a78d9[_0xd754('0x19')];var _0x3e87ee=_0x5cd743?0x0:_0xc65eac[_0xd754('0x16')];var _0x20d6a0=_0x5cd743?_0x4a78d9[_0xd754('0x19')]:_0xc65eac[_0xd754('0x16')]+_0xc65eac[_0xd754('0x18')];var _0x4ac283;if(_0x20d6a0>=_0x488ed4){_0x20d6a0=_0x488ed4;_0x4ac283=0xc8;}else{_0x4ac283=0xce;}_0x1abde5[_0xd754('0x13')](_0x4ac283);return _0x1abde5[_0xd754('0x1a')](_0xd754('0x1b'),_0x3e87ee+'-'+_0x20d6a0+'/'+_0x488ed4)[_0xd754('0x15')](_0x4a78d9);}return null;};}function patchUpdates(_0x56ce7a){return function(_0x513766){try{jsonpatch['apply'](_0x513766,_0x56ce7a,!![]);}catch(_0x11409a){return BPromise[_0xd754('0x1c')](_0x11409a);}return _0x513766[_0xd754('0x1d')]();};}function saveUpdates(_0x88669b,_0x1e7cf1){return function(_0x594699){if(_0x594699){return _0x594699[_0xd754('0x1e')](_0x88669b)[_0xd754('0x1f')](function(_0x290b37){return _0x290b37;});}return null;};}function removeEntity(_0xa886cb,_0x19b8a6){return function(_0x524aeb){if(_0x524aeb){return _0x524aeb['destroy']()[_0xd754('0x1f')](function(){_0xa886cb[_0xd754('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3611aa,_0x5e6426){return function(_0x29cdfb){if(!_0x29cdfb){_0x3611aa[_0xd754('0x20')](0x194);}return _0x29cdfb;};}function handleError(_0x5015af,_0x2892dd){_0x2892dd=_0x2892dd||0x1f4;return function(_0x1b1dab){logger[_0xd754('0x21')](_0x1b1dab[_0xd754('0x22')]);if(_0x1b1dab[_0xd754('0x23')]){delete _0x1b1dab[_0xd754('0x23')];}_0x5015af[_0xd754('0x13')](_0x2892dd)[_0xd754('0x24')](_0x1b1dab);};}exports['index']=function(_0x28fda4,_0x563fdf){var _0x3df989={},_0x3a15a0={},_0x27a8c2={'count':0x0,'rows':[]};var _0x41c28b=_[_0xd754('0x25')](db[_0xd754('0x26')]['rawAttributes'],function(_0xb66b3c){return{'name':_0xb66b3c[_0xd754('0x27')],'type':_0xb66b3c[_0xd754('0x28')]['key']};});_0x3a15a0[_0xd754('0x29')]=_[_0xd754('0x25')](_0x41c28b,_0xd754('0x23'));_0x3a15a0[_0xd754('0x2a')]=_[_0xd754('0x2b')](_0x28fda4[_0xd754('0x2a')]);_0x3a15a0['filters']=_['intersection'](_0x3a15a0['model'],_0x3a15a0[_0xd754('0x2a')]);_0x3df989[_0xd754('0x2c')]=_[_0xd754('0x2d')](_0x3a15a0[_0xd754('0x29')],qs[_0xd754('0x2e')](_0x28fda4['query'][_0xd754('0x2e')]));_0x3df989[_0xd754('0x2c')]=_0x3df989['attributes'][_0xd754('0x2f')]?_0x3df989[_0xd754('0x2c')]:_0x3a15a0['model'];if(!_0x28fda4[_0xd754('0x2a')][_0xd754('0x30')](_0xd754('0x31'))){_0x3df989[_0xd754('0x18')]=qs[_0xd754('0x18')](_0x28fda4[_0xd754('0x2a')][_0xd754('0x18')]);_0x3df989[_0xd754('0x16')]=qs[_0xd754('0x16')](_0x28fda4[_0xd754('0x2a')][_0xd754('0x16')]);}_0x3df989[_0xd754('0x32')]=qs['sort'](_0x28fda4['query'][_0xd754('0x33')]);_0x3df989[_0xd754('0x34')]=qs[_0xd754('0x35')](_['pick'](_0x28fda4[_0xd754('0x2a')],_0x3a15a0[_0xd754('0x35')]),_0x41c28b);if(_0x28fda4[_0xd754('0x2a')]['filter']){_0x3df989[_0xd754('0x34')]=_[_0xd754('0x36')](_0x3df989['where'],{'$or':_[_0xd754('0x25')](_0x41c28b,function(_0x358828){if(_0x358828[_0xd754('0x28')]!==_0xd754('0x37')){var _0xa26766={};_0xa26766[_0x358828['name']]={'$like':'%'+_0x28fda4['query'][_0xd754('0x38')]+'%'};return _0xa26766;}})});}_0x3df989=_['merge']({},_0x3df989,_0x28fda4[_0xd754('0x39')]);var _0x8f9971={'where':_0x3df989[_0xd754('0x34')]};return db[_0xd754('0x26')][_0xd754('0x19')](_0x8f9971)[_0xd754('0x1f')](function(_0xef2eac){_0x27a8c2[_0xd754('0x19')]=_0xef2eac;if(_0x28fda4[_0xd754('0x2a')][_0xd754('0x3a')]){_0x3df989['include']=[{'all':!![]}];}return db[_0xd754('0x26')]['findAll'](_0x3df989);})[_0xd754('0x1f')](function(_0x551768){_0x27a8c2[_0xd754('0x3b')]=_0x551768;return _0x27a8c2;})[_0xd754('0x1f')](respondWithFilteredResult(_0x563fdf,_0x3df989))[_0xd754('0x3c')](handleError(_0x563fdf,null));};exports[_0xd754('0x3d')]=function(_0x42fb9b,_0x2288bf){var _0x2b6010={'raw':!![],'where':{'id':_0x42fb9b['params']['id']}},_0x59e2f0={};_0x59e2f0['model']=_['keys'](db[_0xd754('0x26')][_0xd754('0x3e')]);_0x59e2f0[_0xd754('0x2a')]=_[_0xd754('0x2b')](_0x42fb9b['query']);_0x59e2f0['filters']=_['intersection'](_0x59e2f0[_0xd754('0x29')],_0x59e2f0[_0xd754('0x2a')]);_0x2b6010['attributes']=_[_0xd754('0x2d')](_0x59e2f0[_0xd754('0x29')],qs[_0xd754('0x2e')](_0x42fb9b[_0xd754('0x2a')][_0xd754('0x2e')]));_0x2b6010[_0xd754('0x2c')]=_0x2b6010[_0xd754('0x2c')][_0xd754('0x2f')]?_0x2b6010[_0xd754('0x2c')]:_0x59e2f0['model'];if(_0x42fb9b[_0xd754('0x2a')][_0xd754('0x3a')]){_0x2b6010[_0xd754('0x3f')]=[{'all':!![]}];}_0x2b6010=_[_0xd754('0x36')]({},_0x2b6010,_0x42fb9b[_0xd754('0x39')]);return db[_0xd754('0x26')][_0xd754('0x40')](_0x2b6010)['then'](handleEntityNotFound(_0x2288bf,null))[_0xd754('0x1f')](respondWithResult(_0x2288bf,null))['catch'](handleError(_0x2288bf,null));};exports[_0xd754('0x41')]=function(_0x1d7b9e,_0x2fb6b5){return db[_0xd754('0x26')][_0xd754('0x41')](_0x1d7b9e[_0xd754('0x42')],{})[_0xd754('0x1f')](respondWithResult(_0x2fb6b5,0xc9))[_0xd754('0x3c')](handleError(_0x2fb6b5,null));};exports[_0xd754('0x1e')]=function(_0x5597e6,_0x1dc1cc){if(_0x5597e6[_0xd754('0x42')]['id']){delete _0x5597e6[_0xd754('0x42')]['id'];}return db[_0xd754('0x26')][_0xd754('0x40')]({'where':{'id':_0x5597e6[_0xd754('0x43')]['id']}})[_0xd754('0x1f')](handleEntityNotFound(_0x1dc1cc,null))[_0xd754('0x1f')](saveUpdates(_0x5597e6['body'],null))[_0xd754('0x1f')](respondWithResult(_0x1dc1cc,null))[_0xd754('0x3c')](handleError(_0x1dc1cc,null));};exports[_0xd754('0x44')]=function(_0x2a59f5,_0x34cfc2){return db[_0xd754('0x26')][_0xd754('0x40')]({'where':{'id':_0x2a59f5[_0xd754('0x43')]['id']}})['then'](handleEntityNotFound(_0x34cfc2,null))['then'](removeEntity(_0x34cfc2,null))[_0xd754('0x3c')](handleError(_0x34cfc2,null));}; \ No newline at end of file +var _0x6980=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','json','reject','save','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','rimraf','request-promise','moment','mustache'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x6980,0x82));var _0x0698=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0x6980[_0xd2e2ab];return _0x1703a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0698('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0698('0x1'));var moment=require(_0x0698('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0698('0x3'));var util=require('util');var path=require(_0x0698('0x4'));var sox=require(_0x0698('0x5'));var csv=require(_0x0698('0x6'));var ejs=require(_0x0698('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0698('0x8'));var squel=require(_0x0698('0x9'));var crypto=require(_0x0698('0xa'));var jsforce=require(_0x0698('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0698('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0698('0xc'));var qs=require(_0x0698('0xd'));var as=require(_0x0698('0xe'));var hardwareService=require(_0x0698('0xf'));var logger=require(_0x0698('0x10'))(_0x0698('0x11'));var utils=require('../../config/utils');var config=require(_0x0698('0x12'));var licenseUtil=require(_0x0698('0x13'));var db=require(_0x0698('0x14'))['db'];function respondWithStatusCode(_0x197dd9,_0x50ed78){_0x50ed78=_0x50ed78||0xcc;return function(_0x7135e9){if(_0x7135e9){return _0x197dd9[_0x0698('0x15')](_0x50ed78);}return _0x197dd9[_0x0698('0x16')](_0x50ed78)[_0x0698('0x17')]();};}function respondWithResult(_0x55bfef,_0x5ad276){_0x5ad276=_0x5ad276||0xc8;return function(_0x37ed02){if(_0x37ed02){return _0x55bfef['status'](_0x5ad276)['json'](_0x37ed02);}};}function respondWithFilteredResult(_0xe15576,_0x7ef66a){return function(_0x8f4c06){if(_0x8f4c06){var _0x50c0a7=typeof _0x7ef66a['offset']===_0x0698('0x18')&&typeof _0x7ef66a['limit']===_0x0698('0x18');var _0x19641c=_0x8f4c06['count'];var _0x231477=_0x50c0a7?0x0:_0x7ef66a[_0x0698('0x19')];var _0x3098a1=_0x50c0a7?_0x8f4c06[_0x0698('0x1a')]:_0x7ef66a[_0x0698('0x19')]+_0x7ef66a[_0x0698('0x1b')];var _0x23bedb;if(_0x3098a1>=_0x19641c){_0x3098a1=_0x19641c;_0x23bedb=0xc8;}else{_0x23bedb=0xce;}_0xe15576[_0x0698('0x16')](_0x23bedb);return _0xe15576[_0x0698('0x1c')]('Content-Range',_0x231477+'-'+_0x3098a1+'/'+_0x19641c)[_0x0698('0x1d')](_0x8f4c06);}return null;};}function patchUpdates(_0x48d07a){return function(_0x563cbc){try{jsonpatch['apply'](_0x563cbc,_0x48d07a,!![]);}catch(_0x5c0a18){return BPromise[_0x0698('0x1e')](_0x5c0a18);}return _0x563cbc[_0x0698('0x1f')]();};}function saveUpdates(_0x2f1390,_0x3e9539){return function(_0x468535){if(_0x468535){return _0x468535['update'](_0x2f1390)[_0x0698('0x20')](function(_0x4981a8){return _0x4981a8;});}return null;};}function removeEntity(_0x468bd7,_0x1c27c9){return function(_0x2b9caf){if(_0x2b9caf){return _0x2b9caf[_0x0698('0x21')]()[_0x0698('0x20')](function(){_0x468bd7[_0x0698('0x16')](0xcc)[_0x0698('0x17')]();});}};}function handleEntityNotFound(_0x5cc7bb,_0x50836b){return function(_0x520155){if(!_0x520155){_0x5cc7bb[_0x0698('0x15')](0x194);}return _0x520155;};}function handleError(_0x149020,_0x2d4d93){_0x2d4d93=_0x2d4d93||0x1f4;return function(_0x3b725d){logger[_0x0698('0x22')](_0x3b725d[_0x0698('0x23')]);if(_0x3b725d['name']){delete _0x3b725d[_0x0698('0x24')];}_0x149020['status'](_0x2d4d93)[_0x0698('0x25')](_0x3b725d);};}exports[_0x0698('0x26')]=function(_0x2c173b,_0x23216d){var _0x56e67e={},_0x250a68={},_0x4b8db5={'count':0x0,'rows':[]};var _0x5949cb=_[_0x0698('0x27')](db[_0x0698('0x28')][_0x0698('0x29')],function(_0x466235){return{'name':_0x466235['fieldName'],'type':_0x466235[_0x0698('0x2a')]['key']};});_0x250a68[_0x0698('0x2b')]=_[_0x0698('0x27')](_0x5949cb,'name');_0x250a68[_0x0698('0x2c')]=_[_0x0698('0x2d')](_0x2c173b['query']);_0x250a68['filters']=_[_0x0698('0x2e')](_0x250a68[_0x0698('0x2b')],_0x250a68['query']);_0x56e67e['attributes']=_[_0x0698('0x2e')](_0x250a68[_0x0698('0x2b')],qs[_0x0698('0x2f')](_0x2c173b[_0x0698('0x2c')][_0x0698('0x2f')]));_0x56e67e['attributes']=_0x56e67e[_0x0698('0x30')][_0x0698('0x31')]?_0x56e67e['attributes']:_0x250a68[_0x0698('0x2b')];if(!_0x2c173b[_0x0698('0x2c')]['hasOwnProperty']('nolimit')){_0x56e67e[_0x0698('0x1b')]=qs[_0x0698('0x1b')](_0x2c173b[_0x0698('0x2c')]['limit']);_0x56e67e[_0x0698('0x19')]=qs[_0x0698('0x19')](_0x2c173b[_0x0698('0x2c')][_0x0698('0x19')]);}_0x56e67e['order']=qs['sort'](_0x2c173b[_0x0698('0x2c')][_0x0698('0x32')]);_0x56e67e[_0x0698('0x33')]=qs[_0x0698('0x34')](_['pick'](_0x2c173b[_0x0698('0x2c')],_0x250a68['filters']),_0x5949cb);if(_0x2c173b[_0x0698('0x2c')][_0x0698('0x35')]){_0x56e67e[_0x0698('0x33')]=_[_0x0698('0x36')](_0x56e67e[_0x0698('0x33')],{'$or':_[_0x0698('0x27')](_0x5949cb,function(_0x3831cc){if(_0x3831cc[_0x0698('0x2a')]!==_0x0698('0x37')){var _0x58a373={};_0x58a373[_0x3831cc[_0x0698('0x24')]]={'$like':'%'+_0x2c173b['query'][_0x0698('0x35')]+'%'};return _0x58a373;}})});}_0x56e67e=_[_0x0698('0x36')]({},_0x56e67e,_0x2c173b['options']);var _0x57cd07={'where':_0x56e67e['where']};return db[_0x0698('0x28')][_0x0698('0x1a')](_0x57cd07)[_0x0698('0x20')](function(_0x10e909){_0x4b8db5[_0x0698('0x1a')]=_0x10e909;if(_0x2c173b[_0x0698('0x2c')][_0x0698('0x38')]){_0x56e67e[_0x0698('0x39')]=[{'all':!![]}];}return db[_0x0698('0x28')][_0x0698('0x3a')](_0x56e67e);})[_0x0698('0x20')](function(_0x2b060c){_0x4b8db5[_0x0698('0x3b')]=_0x2b060c;return _0x4b8db5;})[_0x0698('0x20')](respondWithFilteredResult(_0x23216d,_0x56e67e))[_0x0698('0x3c')](handleError(_0x23216d,null));};exports[_0x0698('0x3d')]=function(_0xbbe8db,_0x1cc375){var _0x5c5dba={'raw':!![],'where':{'id':_0xbbe8db[_0x0698('0x3e')]['id']}},_0x3816c6={};_0x3816c6[_0x0698('0x2b')]=_['keys'](db[_0x0698('0x28')][_0x0698('0x29')]);_0x3816c6[_0x0698('0x2c')]=_[_0x0698('0x2d')](_0xbbe8db[_0x0698('0x2c')]);_0x3816c6['filters']=_[_0x0698('0x2e')](_0x3816c6[_0x0698('0x2b')],_0x3816c6['query']);_0x5c5dba[_0x0698('0x30')]=_[_0x0698('0x2e')](_0x3816c6[_0x0698('0x2b')],qs['fields'](_0xbbe8db[_0x0698('0x2c')][_0x0698('0x2f')]));_0x5c5dba['attributes']=_0x5c5dba[_0x0698('0x30')][_0x0698('0x31')]?_0x5c5dba[_0x0698('0x30')]:_0x3816c6[_0x0698('0x2b')];if(_0xbbe8db[_0x0698('0x2c')]['includeAll']){_0x5c5dba[_0x0698('0x39')]=[{'all':!![]}];}_0x5c5dba=_[_0x0698('0x36')]({},_0x5c5dba,_0xbbe8db['options']);return db[_0x0698('0x28')]['find'](_0x5c5dba)[_0x0698('0x20')](handleEntityNotFound(_0x1cc375,null))[_0x0698('0x20')](respondWithResult(_0x1cc375,null))[_0x0698('0x3c')](handleError(_0x1cc375,null));};exports[_0x0698('0x3f')]=function(_0x28db57,_0x2c9d7e){return db['VoiceQueuesLog']['create'](_0x28db57['body'],{})['then'](respondWithResult(_0x2c9d7e,0xc9))[_0x0698('0x3c')](handleError(_0x2c9d7e,null));};exports[_0x0698('0x40')]=function(_0xb91de0,_0xee1e37){if(_0xb91de0[_0x0698('0x41')]['id']){delete _0xb91de0['body']['id'];}return db[_0x0698('0x28')][_0x0698('0x42')]({'where':{'id':_0xb91de0[_0x0698('0x3e')]['id']}})[_0x0698('0x20')](handleEntityNotFound(_0xee1e37,null))[_0x0698('0x20')](saveUpdates(_0xb91de0[_0x0698('0x41')],null))[_0x0698('0x20')](respondWithResult(_0xee1e37,null))[_0x0698('0x3c')](handleError(_0xee1e37,null));};exports['destroy']=function(_0x5103a0,_0x8b514b){return db[_0x0698('0x28')][_0x0698('0x42')]({'where':{'id':_0x5103a0[_0x0698('0x3e')]['id']}})[_0x0698('0x20')](handleEntityNotFound(_0x8b514b,null))[_0x0698('0x20')](removeEntity(_0x8b514b,null))[_0x0698('0x3c')](handleError(_0x8b514b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 04e7620..2e5a99a 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 _0x42cf=['dtm','lodash','util','api','moment','request-promise','rimraf','../../config/environment','define','event_dtm','event'];(function(_0x44e284,_0x5153ae){var _0x1cf8ab=function(_0x24a5aa){while(--_0x24a5aa){_0x44e284['push'](_0x44e284['shift']());}};_0x1cf8ab(++_0x5153ae);}(_0x42cf,0x11f));var _0xf42c=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x42cf[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xf42c('0x0'));var util=require(_0xf42c('0x1'));var logger=require('../../config/logger')(_0xf42c('0x2'));var moment=require(_0xf42c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf42c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf42c('0x5'));var config=require(_0xf42c('0x6'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x1cb366,_0x51292c){return _0x1cb366[_0xf42c('0x7')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xf42c('0x8'),'fields':[_0xf42c('0x9'),_0xf42c('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6e9b=['define','VoiceQueuesLog','voice_queues_log','event','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x1e6480,_0x372195){var _0x5b1848=function(_0x4495a7){while(--_0x4495a7){_0x1e6480['push'](_0x1e6480['shift']());}};_0x5b1848(++_0x372195);}(_0x6e9b,0x1e4));var _0xb6e9=function(_0x524a80,_0x50a874){_0x524a80=_0x524a80-0x0;var _0x129a91=_0x6e9b[_0x524a80];return _0x129a91;};'use strict';var _=require(_0xb6e9('0x0'));var util=require(_0xb6e9('0x1'));var logger=require('../../config/logger')(_0xb6e9('0x2'));var moment=require(_0xb6e9('0x3'));var BPromise=require(_0xb6e9('0x4'));var rp=require(_0xb6e9('0x5'));var fs=require('fs');var path=require(_0xb6e9('0x6'));var rimraf=require(_0xb6e9('0x7'));var config=require(_0xb6e9('0x8'));var attributes=require(_0xb6e9('0x9'));module[_0xb6e9('0xa')]=function(_0x4b64ce,_0x216e08){return _0x4b64ce[_0xb6e9('0xb')](_0xb6e9('0xc'),attributes,{'tableName':_0xb6e9('0xd'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xb6e9('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 7e95d13..efc43c2 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 _0x30ec=['http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x56f0ca,_0x22cd77){var _0x5e857d=function(_0x329f14){while(--_0x329f14){_0x56f0ca['push'](_0x56f0ca['shift']());}};_0x5e857d(++_0x22cd77);}(_0x30ec,0x11c));var _0xc30e=function(_0x3aeea1,_0x4cfbb9){_0x3aeea1=_0x3aeea1-0x0;var _0x424cc1=_0x30ec[_0x3aeea1];return _0x424cc1;};'use strict';var _=require(_0xc30e('0x0'));var util=require(_0xc30e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc30e('0x2'));var fs=require('fs');var Redis=require(_0xc30e('0x3'));var db=require(_0xc30e('0x4'))['db'];var utils=require(_0xc30e('0x5'));var logger=require(_0xc30e('0x6'))(_0xc30e('0x7'));var config=require(_0xc30e('0x8'));var jayson=require(_0xc30e('0x9'));var client=jayson['client'][_0xc30e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59bfbc,_0x2c7197,_0x2af6f1){return new BPromise(function(_0x40b63d,_0x5d1166){return client[_0xc30e('0xb')](_0x59bfbc,_0x2af6f1)[_0xc30e('0xc')](function(_0xb676e1){logger[_0xc30e('0xd')](_0xc30e('0xe'),_0x2c7197,'request\x20sent');logger[_0xc30e('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2c7197,_0xc30e('0x10'),JSON['stringify'](_0xb676e1));if(_0xb676e1['error']){if(_0xb676e1[_0xc30e('0x11')][_0xc30e('0x12')]===0x1f4){logger['error'](_0xc30e('0xe'),_0x2c7197,_0xb676e1[_0xc30e('0x11')][_0xc30e('0x13')]);return _0x5d1166(_0xb676e1[_0xc30e('0x11')][_0xc30e('0x13')]);}logger['error'](_0xc30e('0xe'),_0x2c7197,_0xb676e1[_0xc30e('0x11')][_0xc30e('0x13')]);return _0x40b63d(_0xb676e1[_0xc30e('0x11')][_0xc30e('0x13')]);}else{logger[_0xc30e('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2c7197,_0xc30e('0x10'));_0x40b63d(_0xb676e1[_0xc30e('0x14')][_0xc30e('0x13')]);}})['catch'](function(_0x507ce7){logger[_0xc30e('0x11')](_0xc30e('0xe'),_0x2c7197,_0x507ce7);_0x5d1166(_0x507ce7);});});} \ No newline at end of file +var _0xf197=['moment','ioredis','rpc','client','http','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x275746,_0x37c6ed){var _0x5f1900=function(_0x2a6555){while(--_0x2a6555){_0x275746['push'](_0x275746['shift']());}};_0x5f1900(++_0x37c6ed);}(_0xf197,0x130));var _0x7f19=function(_0x5cc826,_0xb263b){_0x5cc826=_0x5cc826-0x0;var _0x48df9e=_0xf197[_0x5cc826];return _0x48df9e;};'use strict';var _=require(_0x7f19('0x0'));var util=require(_0x7f19('0x1'));var moment=require(_0x7f19('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f19('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f19('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7f19('0x5')][_0x7f19('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x39b5b1,_0x1851e3,_0x39c494){return new BPromise(function(_0x2ebbfb,_0x3c349c){return client['request'](_0x39b5b1,_0x39c494)[_0x7f19('0x7')](function(_0x116b95){logger[_0x7f19('0x8')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1851e3,_0x7f19('0x9'));logger[_0x7f19('0xa')](_0x7f19('0xb'),_0x1851e3,_0x7f19('0x9'),JSON['stringify'](_0x116b95));if(_0x116b95[_0x7f19('0xc')]){if(_0x116b95['error'][_0x7f19('0xd')]===0x1f4){logger[_0x7f19('0xc')](_0x7f19('0xe'),_0x1851e3,_0x116b95['error']['message']);return _0x3c349c(_0x116b95[_0x7f19('0xc')][_0x7f19('0xf')]);}logger[_0x7f19('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1851e3,_0x116b95[_0x7f19('0xc')][_0x7f19('0xf')]);return _0x2ebbfb(_0x116b95['error'][_0x7f19('0xf')]);}else{logger[_0x7f19('0x8')](_0x7f19('0xe'),_0x1851e3,'request\x20sent');_0x2ebbfb(_0x116b95[_0x7f19('0x10')]['message']);}})[_0x7f19('0x11')](function(_0x2cc098){logger[_0x7f19('0xc')](_0x7f19('0xe'),_0x1851e3,_0x2cc098);_0x3c349c(_0x2cc098);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index cb0bfc1..7789847 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 _0x155e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','create','runTranscribe','put','/:id','update','delete','util'];(function(_0x27c48a,_0x130c3e){var _0x146018=function(_0x4fb521){while(--_0x4fb521){_0x27c48a['push'](_0x27c48a['shift']());}};_0x146018(++_0x130c3e);}(_0x155e,0x77));var _0xe155=function(_0x37bb51,_0x2ec7a5){_0x37bb51=_0x37bb51-0x0;var _0x2e19f6=_0x155e[_0x37bb51];return _0x2e19f6;};'use strict';var multer=require('multer');var util=require(_0xe155('0x0'));var path=require('path');var timeout=require(_0xe155('0x1'));var express=require(_0xe155('0x2'));var router=express[_0xe155('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe155('0x4'));var interaction=require(_0xe155('0x5'));var config=require(_0xe155('0x6'));var controller=require(_0xe155('0x7'));router[_0xe155('0x8')]('/',auth['isAuthenticated'](),controller[_0xe155('0x9')]);router[_0xe155('0x8')](_0xe155('0xa'),auth[_0xe155('0xb')](),controller['describe']);router[_0xe155('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe155('0xc')]);router[_0xe155('0x8')](_0xe155('0xd'),auth['isAuthenticated'](),controller[_0xe155('0xe')]);router[_0xe155('0x8')](_0xe155('0xf'),controller[_0xe155('0x10')]);router[_0xe155('0x8')](_0xe155('0x11'),auth[_0xe155('0xb')](),controller['downloadTranscribe']);router['post']('/',auth[_0xe155('0xb')](),controller[_0xe155('0x12')]);router['post']('/:id/transcribe',auth[_0xe155('0xb')](),controller[_0xe155('0x13')]);router[_0xe155('0x14')](_0xe155('0x15'),auth[_0xe155('0xb')](),controller[_0xe155('0x16')]);router[_0xe155('0x17')](_0xe155('0x15'),auth[_0xe155('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x161b=['downloads','/:id/transcribe','downloadTranscribe','create','post','put','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','/:id','show','/:id/download'];(function(_0x433ad8,_0xb25381){var _0x153b46=function(_0x46514c){while(--_0x46514c){_0x433ad8['push'](_0x433ad8['shift']());}};_0x153b46(++_0xb25381);}(_0x161b,0x133));var _0xb161=function(_0x15f5bf,_0xbf82c4){_0x15f5bf=_0x15f5bf-0x0;var _0x46f8f4=_0x161b[_0x15f5bf];return _0x46f8f4;};'use strict';var multer=require(_0xb161('0x0'));var util=require(_0xb161('0x1'));var path=require('path');var timeout=require(_0xb161('0x2'));var express=require('express');var router=express[_0xb161('0x3')]();var fs_extra=require(_0xb161('0x4'));var auth=require(_0xb161('0x5'));var interaction=require(_0xb161('0x6'));var config=require(_0xb161('0x7'));var controller=require(_0xb161('0x8'));router[_0xb161('0x9')]('/',auth[_0xb161('0xa')](),controller['index']);router[_0xb161('0x9')](_0xb161('0xb'),auth[_0xb161('0xa')](),controller['describe']);router[_0xb161('0x9')](_0xb161('0xc'),auth[_0xb161('0xa')](),controller[_0xb161('0xd')]);router[_0xb161('0x9')](_0xb161('0xe'),auth[_0xb161('0xa')](),controller['download']);router[_0xb161('0x9')]('/:id/downloads',controller[_0xb161('0xf')]);router[_0xb161('0x9')](_0xb161('0x10'),auth[_0xb161('0xa')](),controller[_0xb161('0x11')]);router['post']('/',auth[_0xb161('0xa')](),controller[_0xb161('0x12')]);router[_0xb161('0x13')](_0xb161('0x10'),auth[_0xb161('0xa')](),controller['runTranscribe']);router[_0xb161('0x14')](_0xb161('0xc'),auth[_0xb161('0xa')](),controller['update']);router[_0xb161('0x15')](_0xb161('0xc'),auth[_0xb161('0xa')](),controller['destroy']);module[_0xb161('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 6710b98..93359df 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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 8db3151..20e2754 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 _0x92bf=['Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','describe','type','uniqueid','value','decryptFile','secrets','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','token','$and','push','%s.cypher','recording','ValidationError','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','end','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','language'];(function(_0x580d1b,_0x492f8d){var _0x4c2e49=function(_0x452f8b){while(--_0x452f8b){_0x580d1b['push'](_0x580d1b['shift']());}};_0x4c2e49(++_0x492f8d);}(_0x92bf,0xb0));var _0xf92b=function(_0x1299ee,_0x420b82){_0x1299ee=_0x1299ee-0x0;var _0x38ca62=_0x92bf[_0x1299ee];return _0x38ca62;};'use strict';var emlformat=require(_0xf92b('0x0'));var rimraf=require(_0xf92b('0x1'));var zipdir=require(_0xf92b('0x2'));var jsonpatch=require(_0xf92b('0x3'));var rp=require('request-promise');var moment=require(_0xf92b('0x4'));var BPromise=require(_0xf92b('0x5'));var Mustache=require('mustache');var util=require(_0xf92b('0x6'));var path=require(_0xf92b('0x7'));var sox=require(_0xf92b('0x8'));var csv=require(_0xf92b('0x9'));var ejs=require(_0xf92b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf92b('0xb'));var deskjs=require(_0xf92b('0xc'));var toCsv=require(_0xf92b('0x9'));var querystring=require(_0xf92b('0xd'));var Papa=require('papaparse');var AWS=require(_0xf92b('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0xf92b('0xf'));var authService=require(_0xf92b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf92b('0x11'));var hardwareService=require(_0xf92b('0x12'));var logger=require(_0xf92b('0x13'))(_0xf92b('0x14'));var utils=require(_0xf92b('0x15'));var config=require(_0xf92b('0x16'));var licenseUtil=require(_0xf92b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a6771,_0x3d1973){_0x3d1973=_0x3d1973||0xcc;return function(_0x5f4aa6){if(_0x5f4aa6){return _0x1a6771['sendStatus'](_0x3d1973);}return _0x1a6771[_0xf92b('0x18')](_0x3d1973)['end']();};}function respondWithResult(_0x3588cb,_0x868e7a){_0x868e7a=_0x868e7a||0xc8;return function(_0x365a6a){if(_0x365a6a){return _0x3588cb[_0xf92b('0x18')](_0x868e7a)['json'](_0x365a6a);}};}function respondWithFilteredResult(_0x113f28,_0x48b1a2){return function(_0x5de23e){if(_0x5de23e){var _0x105f83=typeof _0x48b1a2[_0xf92b('0x19')]==='undefined'&&typeof _0x48b1a2[_0xf92b('0x1a')]===_0xf92b('0x1b');var _0x1a20a2=_0x5de23e[_0xf92b('0x1c')];var _0x3af3ab=_0x105f83?0x0:_0x48b1a2['offset'];var _0x36ac37=_0x105f83?_0x5de23e[_0xf92b('0x1c')]:_0x48b1a2[_0xf92b('0x19')]+_0x48b1a2[_0xf92b('0x1a')];var _0x3bb464;if(_0x36ac37>=_0x1a20a2){_0x36ac37=_0x1a20a2;_0x3bb464=0xc8;}else{_0x3bb464=0xce;}_0x113f28[_0xf92b('0x18')](_0x3bb464);return _0x113f28[_0xf92b('0x1d')](_0xf92b('0x1e'),_0x3af3ab+'-'+_0x36ac37+'/'+_0x1a20a2)[_0xf92b('0x1f')](_0x5de23e);}return null;};}function patchUpdates(_0x3c0308){return function(_0x459ed8){try{jsonpatch[_0xf92b('0x20')](_0x459ed8,_0x3c0308,!![]);}catch(_0x29f699){return BPromise[_0xf92b('0x21')](_0x29f699);}return _0x459ed8[_0xf92b('0x22')]();};}function saveUpdates(_0x5a3f91,_0xccf1c1){return function(_0x452bb4){if(_0x452bb4){return _0x452bb4[_0xf92b('0x23')](_0x5a3f91)['then'](function(_0x53359a){return _0x53359a;});}return null;};}function removeEntity(_0x229131,_0x572f71){return function(_0x1cdd38){if(_0x1cdd38){return _0x1cdd38[_0xf92b('0x24')]()[_0xf92b('0x25')](function(){_0x229131['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47024f,_0x46be4e){return function(_0x59a064){if(!_0x59a064){_0x47024f[_0xf92b('0x26')](0x194);}return _0x59a064;};}function handleError(_0x57c16c,_0xd2578f){_0xd2578f=_0xd2578f||0x1f4;return function(_0x4e3aa4){logger['error'](_0x4e3aa4[_0xf92b('0x27')]);if(_0x4e3aa4['name']){delete _0x4e3aa4[_0xf92b('0x28')];}_0x57c16c[_0xf92b('0x18')](_0xd2578f)[_0xf92b('0x29')](_0x4e3aa4);};}exports['index']=function(_0x3488a0,_0xf1f836){var _0xd08ae3={},_0x4dcaee={},_0x5851f6={'count':0x0,'rows':[]};var _0x54804e=_[_0xf92b('0x2a')](db['VoiceRecording'][_0xf92b('0x2b')],function(_0x2540f4){return{'name':_0x2540f4[_0xf92b('0x2c')],'type':_0x2540f4['type'][_0xf92b('0x2d')]};});_0x4dcaee[_0xf92b('0x2e')]=_[_0xf92b('0x2f')](_[_0xf92b('0x2a')](_0x54804e,_0xf92b('0x28')),[_0xf92b('0x30')]);_0x4dcaee[_0xf92b('0x31')]=_[_0xf92b('0x32')](_0x3488a0[_0xf92b('0x31')]);_0x4dcaee['filters']=_[_0xf92b('0x33')](_0x4dcaee[_0xf92b('0x2e')],_0x4dcaee['query']);_0xd08ae3[_0xf92b('0x34')]=_['intersection'](_0x4dcaee[_0xf92b('0x2e')],qs[_0xf92b('0x35')](_0x3488a0[_0xf92b('0x31')][_0xf92b('0x35')]));_0xd08ae3['attributes']=_0xd08ae3[_0xf92b('0x34')]['length']?_0xd08ae3[_0xf92b('0x34')]:_0x4dcaee[_0xf92b('0x2e')];if(!_0x3488a0['query'][_0xf92b('0x36')](_0xf92b('0x37'))){_0xd08ae3[_0xf92b('0x1a')]=qs['limit'](_0x3488a0[_0xf92b('0x31')][_0xf92b('0x1a')]);_0xd08ae3[_0xf92b('0x19')]=qs[_0xf92b('0x19')](_0x3488a0[_0xf92b('0x31')][_0xf92b('0x19')]);}_0xd08ae3[_0xf92b('0x38')]=qs[_0xf92b('0x39')](_0x3488a0[_0xf92b('0x31')][_0xf92b('0x39')]);_0xd08ae3[_0xf92b('0x3a')]=qs['filters'](_[_0xf92b('0x3b')](_0x3488a0[_0xf92b('0x31')],_0x4dcaee['filters']),_0x54804e);if(_0x3488a0[_0xf92b('0x31')][_0xf92b('0x3c')]){_0xd08ae3[_0xf92b('0x3a')]=_[_0xf92b('0x3d')](_0xd08ae3[_0xf92b('0x3a')],{'$or':_[_0xf92b('0x2a')](_0x54804e,function(_0x508e12){if(_0x508e12['type']!==_0xf92b('0x3e')){var _0x5dd739={};_0x5dd739[_0x508e12['name']]={'$like':'%'+_0x3488a0[_0xf92b('0x31')]['filter']+'%'};return _0x5dd739;}})});}_0xd08ae3=_[_0xf92b('0x3d')]({},_0xd08ae3,_0x3488a0[_0xf92b('0x3f')]);var _0x24b1cd={'where':_0xd08ae3[_0xf92b('0x3a')]};return db[_0xf92b('0x40')][_0xf92b('0x1c')](_0x24b1cd)[_0xf92b('0x25')](function(_0x432b4c){_0x5851f6[_0xf92b('0x1c')]=_0x432b4c;if(_0x3488a0[_0xf92b('0x31')][_0xf92b('0x41')]){_0xd08ae3[_0xf92b('0x42')]=[{'all':!![]}];}return db[_0xf92b('0x40')][_0xf92b('0x43')](_0xd08ae3);})[_0xf92b('0x25')](function(_0x1c2c54){_0x5851f6[_0xf92b('0x44')]=_0x1c2c54;return _0x5851f6;})[_0xf92b('0x25')](respondWithFilteredResult(_0xf1f836,_0xd08ae3))[_0xf92b('0x45')](handleError(_0xf1f836,null));};exports[_0xf92b('0x46')]=function(_0x977825,_0x284b2f){var _0x1fce00={'raw':![],'where':{'id':_0x977825[_0xf92b('0x47')]['id']}},_0xcba68e={};_0xcba68e[_0xf92b('0x2e')]=_[_0xf92b('0x32')](db['VoiceRecording'][_0xf92b('0x2b')]);_0xcba68e[_0xf92b('0x31')]=_['keys'](_0x977825[_0xf92b('0x31')]);_0xcba68e[_0xf92b('0x48')]=_[_0xf92b('0x33')](_0xcba68e[_0xf92b('0x2e')],_0xcba68e[_0xf92b('0x31')]);_0x1fce00[_0xf92b('0x34')]=_[_0xf92b('0x33')](_0xcba68e[_0xf92b('0x2e')],qs['fields'](_0x977825[_0xf92b('0x31')]['fields']));_0x1fce00['attributes']=_0x1fce00[_0xf92b('0x34')][_0xf92b('0x49')]?_0x1fce00[_0xf92b('0x34')]:_0xcba68e[_0xf92b('0x2e')];if(_0x977825[_0xf92b('0x31')][_0xf92b('0x41')]){_0x1fce00[_0xf92b('0x42')]=[{'all':!![]}];}_0x1fce00=_['merge']({},_0x1fce00,_0x977825['options']);return db[_0xf92b('0x40')][_0xf92b('0x4a')](_0x1fce00)['then'](handleEntityNotFound(_0x284b2f,null))[_0xf92b('0x25')](respondWithResult(_0x284b2f,null))['catch'](handleError(_0x284b2f,null));};exports[_0xf92b('0x4b')]=function(_0x4ec31c,_0x331514){return db[_0xf92b('0x40')][_0xf92b('0x4b')](_0x4ec31c[_0xf92b('0x4c')],{})[_0xf92b('0x25')](respondWithResult(_0x331514,0xc9))['catch'](handleError(_0x331514,null));};exports[_0xf92b('0x23')]=function(_0x2518e3,_0x10ebaa){if(_0x2518e3[_0xf92b('0x4c')]['id']){delete _0x2518e3['body']['id'];}return db[_0xf92b('0x40')][_0xf92b('0x4a')]({'where':{'id':_0x2518e3['params']['id']}})['then'](handleEntityNotFound(_0x10ebaa,null))[_0xf92b('0x25')](saveUpdates(_0x2518e3[_0xf92b('0x4c')],null))[_0xf92b('0x25')](respondWithResult(_0x10ebaa,null))[_0xf92b('0x45')](handleError(_0x10ebaa,null));};exports[_0xf92b('0x4d')]=function(_0xd29b1d,_0x25c1be){return db['VoiceRecording'][_0xf92b('0x4d')]()['then'](respondWithResult(_0x25c1be,null))[_0xf92b('0x45')](handleError(_0x25c1be,null));};exports['download']=function(_0x27f95e,_0x401d2c,_0x2df916){var _0x50eb0b=require('../../components/encryptor');var _0x343e87=![];var _0x25ee20={};if(_0x27f95e[_0xf92b('0x31')][_0xf92b('0x4e')]&&_0x27f95e[_0xf92b('0x31')]['type']===_0xf92b('0x4f')){_0x25ee20['uniqueid']=_0x27f95e[_0xf92b('0x47')]['id'];}else{_0x25ee20['id']=_0x27f95e[_0xf92b('0x47')]['id'];}return db[_0xf92b('0x40')][_0xf92b('0x4a')]({'where':_0x25ee20,'attributes':['id',_0xf92b('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x401d2c,null))[_0xf92b('0x25')](function(_0x17e232){if(_0x17e232){var _0xeb4a0f=_0x17e232[_0xf92b('0x50')];var _0x4af414=util[_0xf92b('0x30')]('%s.cypher',_0xeb4a0f);if(fs['existsSync'](_0x4af414)){_0x343e87=!![];return _0x50eb0b[_0xf92b('0x51')](_0x4af414,_0xeb4a0f,config[_0xf92b('0x52')]['recording'])['then'](function(){return _0x17e232;});}return _0x17e232;}})['then'](function(_0x4f55bc){if(_0x4f55bc){var _0x389c0a=_0x4f55bc[_0xf92b('0x50')];if(!fs[_0xf92b('0x53')](_0x389c0a)){throw new db[(_0xf92b('0x54'))]['ValidationError'](_0xf92b('0x55'));}if(_0x4f55bc[_0xf92b('0x56')]){return _0x401d2c[_0xf92b('0x57')](_0x389c0a,_0x4f55bc['filename']+path[_0xf92b('0x58')](_0x389c0a),function(){if(_0x343e87){fs['unlink'](_0x389c0a);}});}else{return _0x401d2c[_0xf92b('0x57')](_0x389c0a,function(_0x487ca7){if(_0x343e87){fs[_0xf92b('0x59')](_0x389c0a);}});}}})['catch'](function(_0x3b02b9){if(_0x3b02b9[_0xf92b('0x5a')]===_0xf92b('0x55')){_0x401d2c['status'](0x194)[_0xf92b('0x29')](_0xf92b('0x5b'));}else{return handleError(_0x401d2c,null);}});};exports[_0xf92b('0x5c')]=function(_0x672bce,_0x4d74d8,_0x3a4841){var _0x21cf5e=require(_0xf92b('0x5d'));var _0x353d69=![];var _0x2c0ab0={'$and':[db[_0xf92b('0x5e')][_0xf92b('0x3a')](db[_0xf92b('0x5e')]['fn']('MD5',db['sequelize']['col'](_0xf92b('0x4f'))),_0x672bce[_0xf92b('0x31')][_0xf92b('0x5f')])]};if(_0x672bce[_0xf92b('0x31')][_0xf92b('0x4e')]&&_0x672bce['query']['type']===_0xf92b('0x4f')){_0x2c0ab0[_0xf92b('0x60')][_0xf92b('0x61')]({'uniqueid':_0x672bce[_0xf92b('0x47')]['id']});}else{_0x2c0ab0['$and'][_0xf92b('0x61')]({'id':_0x672bce[_0xf92b('0x47')]['id']});}return db['VoiceRecording'][_0xf92b('0x4a')]({'where':_0x2c0ab0,'attributes':['id','value'],'raw':!![]})[_0xf92b('0x25')](handleEntityNotFound(_0x4d74d8,null))['then'](function(_0x162b0b){if(_0x162b0b){var _0x5ec8c4=util[_0xf92b('0x30')](_0xf92b('0x62'),_0x162b0b[_0xf92b('0x50')]);if(fs[_0xf92b('0x53')](_0x5ec8c4)){_0x353d69=!![];return _0x21cf5e[_0xf92b('0x51')](_0x5ec8c4,_0x162b0b[_0xf92b('0x50')],config['secrets'][_0xf92b('0x63')])[_0xf92b('0x25')](function(){return _0x162b0b;});}return _0x162b0b;}})[_0xf92b('0x25')](function(_0x3bf063){if(_0x3bf063){if(!fs[_0xf92b('0x53')](_0x3bf063['value'])){throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))](_0xf92b('0x55'));}if(_0x3bf063[_0xf92b('0x56')]){return _0x4d74d8[_0xf92b('0x57')](_0x3bf063['value'],_0x3bf063[_0xf92b('0x56')]+path[_0xf92b('0x58')](_0x3bf063['value']),function(){if(_0x353d69){fs['unlink'](_0x3bf063[_0xf92b('0x50')]);}});}else{return _0x4d74d8[_0xf92b('0x57')](_0x3bf063[_0xf92b('0x50')],function(_0x45f7fa){if(_0x353d69){fs[_0xf92b('0x59')](_0x3bf063[_0xf92b('0x50')]);}});}}})[_0xf92b('0x45')](handleError(_0x4d74d8,null));};exports[_0xf92b('0x24')]=function(_0x192254,_0x46204e){return db[_0xf92b('0x40')][_0xf92b('0x4a')]({'where':{'id':_0x192254[_0xf92b('0x47')]['id']}})[_0xf92b('0x25')](function(_0x36066c){if(_[_0xf92b('0x65')](_0x36066c)){throw new ReferenceError(_0xf92b('0x66'));}return _0x36066c;})[_0xf92b('0x25')](function(_0x33f554){var _0x15db36=_0x33f554['value'];logger['info'](_0xf92b('0x67'),_0x15db36);if(!_[_0xf92b('0x65')](_0x33f554['value'])&&fs[_0xf92b('0x53')](_0x15db36)){logger[_0xf92b('0x68')]('File:\x20\x22'+_0x15db36+_0xf92b('0x69'));fs[_0xf92b('0x6a')](_0x15db36);}_0x15db36=_0x15db36+'.cypher';if(!_[_0xf92b('0x65')](_0x33f554['value'])&&fs[_0xf92b('0x53')](_0x15db36)){logger[_0xf92b('0x68')](_0xf92b('0x6b')+_0x15db36+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x15db36);}return _0x33f554;})[_0xf92b('0x25')](function(_0x10af40){if(!_0x10af40)throw new InternalError();return _0x10af40[_0xf92b('0x24')]();})['then'](function(){_0x46204e[_0xf92b('0x18')](0xcc)[_0xf92b('0x6c')]();})[_0xf92b('0x45')](handleError(_0x46204e,null));};function getBucketslist(_0x4c8ab8,_0x3d2048,_0x2945d6){return new Promise(function(_0x54eb6d,_0x1f76c3){var _0x53bef5=new AWS['S3']({'accessKeyId':_0x3d2048,'secretAccessKey':_0x4c8ab8,'region':_0x2945d6});_0x53bef5[_0xf92b('0x6d')]({},function(_0x2d94c6,_0x5c84f5){if(_0x2d94c6){return _0x1f76c3(_0x2d94c6);}else{return _0x54eb6d(_0x5c84f5);}});});}function createBucket(_0x4aac8b,_0x5c75b5,_0x580bd2,_0x3f58ae){return new Promise(function(_0x44224c,_0x43c5b7){var _0x403d1d=new AWS['S3']({'accessKeyId':_0x5c75b5,'secretAccessKey':_0x4aac8b,'region':_0x580bd2});_0x403d1d[_0xf92b('0x6e')]({'Bucket':_0x3f58ae},function(_0x312b6c,_0x444bd3){if(_0x312b6c){return _0x43c5b7(_0x312b6c);}else{return _0x44224c(_0x444bd3);}});});}function uploadFile(_0x3c1f45,_0x291a3b,_0x5b7350,_0x358613,_0xa9ff5f,_0x368315){return new Promise(function(_0x2ef94d,_0x511a41){var _0x534bfc=new AWS['S3']({'accessKeyId':_0x291a3b,'secretAccessKey':_0x3c1f45,'region':_0x5b7350});_0x534bfc['upload']({'Bucket':_0x358613,'Key':_0xa9ff5f,'Body':_0x368315},function(_0x3c9d36,_0x8fe691){if(_0x3c9d36){return _0x511a41(_0x3c9d36);}else{return _0x2ef94d(_0x8fe691);}});});}function startTranscribe(_0x3ebb01,_0x256f35,_0x26f5e0,_0x1bcd25,_0x22f69c,_0x1c6bb6){return new Promise(function(_0x4d1ef0,_0x416633){var _0x555960=new AWS['TranscribeService']({'accessKeyId':_0x256f35,'secretAccessKey':_0x3ebb01,'region':_0x26f5e0});_0x555960[_0xf92b('0x6f')]({'TranscriptionJobName':_0x1bcd25,'LanguageCode':_0x22f69c,'Media':{'MediaFileUri':_0x1c6bb6}},function(_0x563606,_0x3828fa){if(_0x563606){return _0x416633(_0x563606);}else{return _0x4d1ef0(_0x3828fa);}});});}function transcribe(_0x383012,_0x1efd7b,_0x2aceab,_0x584233,_0x2eed6f,_0x17ae7a,_0x1d4665){return new Promise(function(_0x5bbe51,_0x1316cb){var _0x1d225d={};logger[_0xf92b('0x68')](util[_0xf92b('0x30')](_0xf92b('0x70'),_0x383012,_0x2eed6f));return uploadFile(_0x1efd7b,_0x2aceab,_0x584233,_0x2eed6f,path[_0xf92b('0x71')](_0x17ae7a),fs[_0xf92b('0x72')](_0x17ae7a))[_0xf92b('0x25')](function(_0x33e98e){logger['info'](util[_0xf92b('0x30')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x383012,_0x2eed6f,_0x33e98e[_0xf92b('0x73')]));_0x1d225d[_0xf92b('0x74')]=_0x33e98e[_0xf92b('0x75')];_0x1d225d[_0xf92b('0x76')]=_0x33e98e[_0xf92b('0x73')];logger[_0xf92b('0x68')](util[_0xf92b('0x30')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x383012));return startTranscribe(_0x1efd7b,_0x2aceab,_0x584233,uuidv4(),_0x1d4665,_0x33e98e[_0xf92b('0x73')]);})['then'](function(_0x11782a){logger['info'](util[_0xf92b('0x30')](_0xf92b('0x77'),_0x383012,_0x11782a[_0xf92b('0x78')][_0xf92b('0x79')]));_0x1d225d['transcribeName']=_0x11782a[_0xf92b('0x78')][_0xf92b('0x79')];_0x1d225d[_0xf92b('0x7a')]=_0x11782a[_0xf92b('0x78')][_0xf92b('0x7b')];return _0x5bbe51(_0x1d225d);})[_0xf92b('0x45')](function(_0x4878be){return _0x1316cb(_0x4878be);});});}exports[_0xf92b('0x7c')]=function(_0x5b567e,_0x24f900,_0x1a670b){var _0x2c8774;var _0x282e29;var _0x44b228;var _0x4b73f1=require(_0xf92b('0x5d'));return db['VoiceRecording'][_0xf92b('0x7d')]({'where':{'id':_0x5b567e[_0xf92b('0x47')]['id']}})[_0xf92b('0x25')](function(_0x3c301b){if(_0x3c301b){var _0x15eefe=util[_0xf92b('0x30')]('%s.cypher',_0x3c301b[_0xf92b('0x50')]);if(fs[_0xf92b('0x53')](_0x15eefe)){cypher=!![];return _0x4b73f1[_0xf92b('0x51')](_0x15eefe,_0x3c301b[_0xf92b('0x50')],config[_0xf92b('0x52')][_0xf92b('0x63')])[_0xf92b('0x25')](function(){return _0x3c301b;});}return _0x3c301b;}})[_0xf92b('0x25')](function(_0x580a17){if(!_0x580a17){throw new db[(_0xf92b('0x54'))]['ValidationError'](_0xf92b('0x7e'));}_0x282e29=_0x580a17;return db[_0xf92b('0x7f')][_0xf92b('0x7d')]({'where':{'id':0x1}});})[_0xf92b('0x25')](handleEntityNotFound(_0x24f900,null))[_0xf92b('0x25')](function(_0x2b7371){if(_0x2b7371){_0x2c8774=_0x2b7371;if(!_0x2c8774[_0xf92b('0x80')]||!_0x2c8774['transcribeAccountId']||!_0x2c8774['transcribeRegion']||!_0x2c8774[_0xf92b('0x81')]||!_0x2c8774[_0xf92b('0x74')]){throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))](_0xf92b('0x82'));}if(_0x5b567e[_0xf92b('0x4c')][_0xf92b('0x83')]&&(!_0x2c8774['sentiment']||!_0x2c8774[_0xf92b('0x84')]||!_0x2c8774[_0xf92b('0x85')]||!_0x2c8774['language']||!_0x2c8774['bucket'])){throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))](_0xf92b('0x86'));}return db[_0xf92b('0x87')][_0xf92b('0x7d')]({'where':{'id':_0x2c8774[_0xf92b('0x88')]}});}})[_0xf92b('0x25')](function(_0x3c3e3e){if(!_0x3c3e3e){throw new db['Sequelize'][(_0xf92b('0x64'))](_0xf92b('0x89'));}if(!_0x3c3e3e[_0xf92b('0x8a')]||!_0x3c3e3e['data2']){throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))](_0xf92b('0x8b'));}_0x44b228=_0x3c3e3e;return getBucketslist(_0x44b228['data1'],_0x44b228[_0xf92b('0x8c')],_0x2c8774[_0xf92b('0x8d')]);})[_0xf92b('0x25')](function(_0x48bcaf){if(_0x48bcaf&&_0x48bcaf[_0xf92b('0x8e')]){var _0x33dda2=_[_0xf92b('0x4a')](_0x48bcaf[_0xf92b('0x8e')],function(_0x509d53){return _0x509d53[_0xf92b('0x8f')]===_0x2c8774['bucket'];});if(!_0x33dda2){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5b567e[_0xf92b('0x47')]['id'],_0x2c8774['bucket']));return createBucket(_0x44b228[_0xf92b('0x8a')],_0x44b228[_0xf92b('0x8c')],_0x2c8774[_0xf92b('0x8d')],_0x2c8774[_0xf92b('0x74')]);}logger[_0xf92b('0x68')](util[_0xf92b('0x30')](_0xf92b('0x90'),_0x5b567e[_0xf92b('0x47')]['id'],_0x2c8774['bucket']));return;}})[_0xf92b('0x25')](function(_0x97d91){if(_0x282e29[_0xf92b('0x7a')]===_0xf92b('0x91')){return transcribe(_0x5b567e[_0xf92b('0x47')]['id'],_0x44b228['data1'],_0x44b228[_0xf92b('0x8c')],_0x2c8774[_0xf92b('0x8d')],_0x2c8774[_0xf92b('0x74')],_0x282e29[_0xf92b('0x50')],_0x2c8774['language']);}else{logger[_0xf92b('0x68')](util[_0xf92b('0x30')](_0xf92b('0x92'),_0x5b567e[_0xf92b('0x47')]['id']));return{'transcribeStatus':_0xf92b('0x93')};}})[_0xf92b('0x25')](function(_0xccb188){if(_0xccb188){_0xccb188['tempSentiment']=_0x5b567e[_0xf92b('0x4c')][_0xf92b('0x83')];return _0x282e29[_0xf92b('0x94')](_0xccb188);}})[_0xf92b('0x25')](respondWithResult(_0x24f900,null))[_0xf92b('0x45')](handleError(_0x24f900,null));};function writeFile(_0x2ab1d0,_0x57f35b){return new Promise(function(_0x1a5596,_0x1db1ce){fs[_0xf92b('0x95')](_0x57f35b,_0x2ab1d0,function(_0x5a91f1,_0x2b361b){if(_0x5a91f1){return _0x1db1ce(_0x5a91f1);}else{return _0x1a5596(_0x2b361b);}});});}exports['downloadTranscribe']=function(_0x1282ee,_0x58687d,_0x43255a){return db['VoiceRecording']['findOne']({'where':{'id':_0x1282ee[_0xf92b('0x47')]['id']}})[_0xf92b('0x25')](handleEntityNotFound(_0x58687d))[_0xf92b('0x25')](function(_0x5e2825){if(_0x5e2825&&_0x5e2825[_0xf92b('0x96')]){var _0x410329=_0x5e2825[_0xf92b('0x96')];var _0x5938ff=config[_0xf92b('0x97')]+_0xf92b('0x98')+_0x5e2825['id']+'.txt';if(fs[_0xf92b('0x53')](_0x5938ff)){return _0x5938ff;}return writeFile(_0x410329,_0x5938ff)['then'](function(){return _0x5938ff;});}else{throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))]('Transcript\x20not\x20available');}})[_0xf92b('0x25')](function(_0x696cce){return _0x58687d['download'](_0x696cce);})[_0xf92b('0x45')](handleError(_0x58687d));}; \ No newline at end of file +var _0x1a24=['VoiceRecording\x20not\x20found','filename','extname','unlink','message','sequelize','MD5','col','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','../../components/encryptor','findOne','Sequelize','transcribeAccountId','transcribeRegion','runSentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','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','tempSentiment','updateAttributes','writeFile','fileText','root','.txt','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','update','destroy','then','end','sendStatus','name','send','index','map','VoiceRecording','rawAttributes','type','key','differenceBy','format','query','keys','intersection','model','attributes','fields','length','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError'];(function(_0x40c2f5,_0x27440d){var _0x1d0873=function(_0x4a1919){while(--_0x4a1919){_0x40c2f5['push'](_0x40c2f5['shift']());}};_0x1d0873(++_0x27440d);}(_0x1a24,0xd0));var _0x41a2=function(_0x127074,_0x3bd855){_0x127074=_0x127074-0x0;var _0x4c9463=_0x1a24[_0x127074];return _0x4c9463;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x41a2('0x0'));var jsonpatch=require(_0x41a2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x41a2('0x2'));var Mustache=require(_0x41a2('0x3'));var util=require(_0x41a2('0x4'));var path=require(_0x41a2('0x5'));var sox=require('sox');var csv=require(_0x41a2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41a2('0x7'));var _=require(_0x41a2('0x8'));var squel=require(_0x41a2('0x9'));var crypto=require(_0x41a2('0xa'));var jsforce=require(_0x41a2('0xb'));var deskjs=require(_0x41a2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x41a2('0xd'));var Papa=require(_0x41a2('0xe'));var AWS=require(_0x41a2('0xf'));var uuidv4=require(_0x41a2('0x10'));var Redis=require(_0x41a2('0x11'));var authService=require(_0x41a2('0x12'));var qs=require(_0x41a2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41a2('0x14'));var logger=require(_0x41a2('0x15'))(_0x41a2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x41a2('0x17'));var db=require(_0x41a2('0x18'))['db'];function respondWithStatusCode(_0x70a40f,_0x5b2ee2){_0x5b2ee2=_0x5b2ee2||0xcc;return function(_0x408519){if(_0x408519){return _0x70a40f['sendStatus'](_0x5b2ee2);}return _0x70a40f[_0x41a2('0x19')](_0x5b2ee2)['end']();};}function respondWithResult(_0x342580,_0x4a968d){_0x4a968d=_0x4a968d||0xc8;return function(_0x3f447c){if(_0x3f447c){return _0x342580[_0x41a2('0x19')](_0x4a968d)[_0x41a2('0x1a')](_0x3f447c);}};}function respondWithFilteredResult(_0x479a3e,_0x4b6375){return function(_0x1ddfbd){if(_0x1ddfbd){var _0x5778a4=typeof _0x4b6375[_0x41a2('0x1b')]===_0x41a2('0x1c')&&typeof _0x4b6375[_0x41a2('0x1d')]===_0x41a2('0x1c');var _0x1f600d=_0x1ddfbd[_0x41a2('0x1e')];var _0x44198f=_0x5778a4?0x0:_0x4b6375[_0x41a2('0x1b')];var _0xf12c80=_0x5778a4?_0x1ddfbd[_0x41a2('0x1e')]:_0x4b6375[_0x41a2('0x1b')]+_0x4b6375[_0x41a2('0x1d')];var _0xa178d4;if(_0xf12c80>=_0x1f600d){_0xf12c80=_0x1f600d;_0xa178d4=0xc8;}else{_0xa178d4=0xce;}_0x479a3e['status'](_0xa178d4);return _0x479a3e['set']('Content-Range',_0x44198f+'-'+_0xf12c80+'/'+_0x1f600d)['json'](_0x1ddfbd);}return null;};}function patchUpdates(_0x3293a7){return function(_0x21fc18){try{jsonpatch[_0x41a2('0x1f')](_0x21fc18,_0x3293a7,!![]);}catch(_0x2e9e69){return BPromise[_0x41a2('0x20')](_0x2e9e69);}return _0x21fc18['save']();};}function saveUpdates(_0x2e821a,_0x535b92){return function(_0x2ad8a1){if(_0x2ad8a1){return _0x2ad8a1[_0x41a2('0x21')](_0x2e821a)['then'](function(_0x336d1d){return _0x336d1d;});}return null;};}function removeEntity(_0x2a8f3f,_0x5c40ec){return function(_0x2b673d){if(_0x2b673d){return _0x2b673d[_0x41a2('0x22')]()[_0x41a2('0x23')](function(){_0x2a8f3f[_0x41a2('0x19')](0xcc)[_0x41a2('0x24')]();});}};}function handleEntityNotFound(_0x38b850,_0x3910be){return function(_0x11ea94){if(!_0x11ea94){_0x38b850[_0x41a2('0x25')](0x194);}return _0x11ea94;};}function handleError(_0x3a49c4,_0x5336f7){_0x5336f7=_0x5336f7||0x1f4;return function(_0x32d8bc){logger['error'](_0x32d8bc['stack']);if(_0x32d8bc[_0x41a2('0x26')]){delete _0x32d8bc['name'];}_0x3a49c4['status'](_0x5336f7)[_0x41a2('0x27')](_0x32d8bc);};}exports[_0x41a2('0x28')]=function(_0x59f9b9,_0x2bacc6){var _0x42636f={},_0x1f2582={},_0x3fc155={'count':0x0,'rows':[]};var _0x50d83c=_[_0x41a2('0x29')](db[_0x41a2('0x2a')][_0x41a2('0x2b')],function(_0x2afd9c){return{'name':_0x2afd9c['fieldName'],'type':_0x2afd9c[_0x41a2('0x2c')][_0x41a2('0x2d')]};});_0x1f2582['model']=_[_0x41a2('0x2e')](_['map'](_0x50d83c,_0x41a2('0x26')),[_0x41a2('0x2f')]);_0x1f2582[_0x41a2('0x30')]=_[_0x41a2('0x31')](_0x59f9b9['query']);_0x1f2582['filters']=_[_0x41a2('0x32')](_0x1f2582[_0x41a2('0x33')],_0x1f2582['query']);_0x42636f[_0x41a2('0x34')]=_['intersection'](_0x1f2582[_0x41a2('0x33')],qs[_0x41a2('0x35')](_0x59f9b9[_0x41a2('0x30')][_0x41a2('0x35')]));_0x42636f[_0x41a2('0x34')]=_0x42636f['attributes'][_0x41a2('0x36')]?_0x42636f[_0x41a2('0x34')]:_0x1f2582[_0x41a2('0x33')];if(!_0x59f9b9[_0x41a2('0x30')]['hasOwnProperty']('nolimit')){_0x42636f[_0x41a2('0x1d')]=qs[_0x41a2('0x1d')](_0x59f9b9[_0x41a2('0x30')]['limit']);_0x42636f['offset']=qs['offset'](_0x59f9b9[_0x41a2('0x30')][_0x41a2('0x1b')]);}_0x42636f[_0x41a2('0x37')]=qs['sort'](_0x59f9b9[_0x41a2('0x30')]['sort']);_0x42636f[_0x41a2('0x38')]=qs[_0x41a2('0x39')](_[_0x41a2('0x3a')](_0x59f9b9[_0x41a2('0x30')],_0x1f2582[_0x41a2('0x39')]),_0x50d83c);if(_0x59f9b9[_0x41a2('0x30')][_0x41a2('0x3b')]){_0x42636f[_0x41a2('0x38')]=_[_0x41a2('0x3c')](_0x42636f[_0x41a2('0x38')],{'$or':_['map'](_0x50d83c,function(_0x44aa3c){if(_0x44aa3c[_0x41a2('0x2c')]!==_0x41a2('0x3d')){var _0x53ecfe={};_0x53ecfe[_0x44aa3c[_0x41a2('0x26')]]={'$like':'%'+_0x59f9b9[_0x41a2('0x30')][_0x41a2('0x3b')]+'%'};return _0x53ecfe;}})});}_0x42636f=_['merge']({},_0x42636f,_0x59f9b9[_0x41a2('0x3e')]);var _0x48782a={'where':_0x42636f[_0x41a2('0x38')]};return db['VoiceRecording'][_0x41a2('0x1e')](_0x48782a)[_0x41a2('0x23')](function(_0x5d18ad){_0x3fc155[_0x41a2('0x1e')]=_0x5d18ad;if(_0x59f9b9[_0x41a2('0x30')][_0x41a2('0x3f')]){_0x42636f[_0x41a2('0x40')]=[{'all':!![]}];}return db[_0x41a2('0x2a')]['findAll'](_0x42636f);})['then'](function(_0x539d94){_0x3fc155[_0x41a2('0x41')]=_0x539d94;return _0x3fc155;})['then'](respondWithFilteredResult(_0x2bacc6,_0x42636f))['catch'](handleError(_0x2bacc6,null));};exports[_0x41a2('0x42')]=function(_0x22f8f8,_0x4412e8){var _0x5dda54={'raw':![],'where':{'id':_0x22f8f8[_0x41a2('0x43')]['id']}},_0x24a10f={};_0x24a10f[_0x41a2('0x33')]=_[_0x41a2('0x31')](db['VoiceRecording'][_0x41a2('0x2b')]);_0x24a10f[_0x41a2('0x30')]=_[_0x41a2('0x31')](_0x22f8f8[_0x41a2('0x30')]);_0x24a10f['filters']=_[_0x41a2('0x32')](_0x24a10f[_0x41a2('0x33')],_0x24a10f['query']);_0x5dda54['attributes']=_[_0x41a2('0x32')](_0x24a10f[_0x41a2('0x33')],qs[_0x41a2('0x35')](_0x22f8f8['query'][_0x41a2('0x35')]));_0x5dda54[_0x41a2('0x34')]=_0x5dda54[_0x41a2('0x34')]['length']?_0x5dda54['attributes']:_0x24a10f[_0x41a2('0x33')];if(_0x22f8f8[_0x41a2('0x30')]['includeAll']){_0x5dda54['include']=[{'all':!![]}];}_0x5dda54=_[_0x41a2('0x3c')]({},_0x5dda54,_0x22f8f8[_0x41a2('0x3e')]);return db['VoiceRecording'][_0x41a2('0x44')](_0x5dda54)[_0x41a2('0x23')](handleEntityNotFound(_0x4412e8,null))[_0x41a2('0x23')](respondWithResult(_0x4412e8,null))[_0x41a2('0x45')](handleError(_0x4412e8,null));};exports[_0x41a2('0x46')]=function(_0x1c2461,_0x55a435){return db[_0x41a2('0x2a')][_0x41a2('0x46')](_0x1c2461[_0x41a2('0x47')],{})['then'](respondWithResult(_0x55a435,0xc9))[_0x41a2('0x45')](handleError(_0x55a435,null));};exports[_0x41a2('0x21')]=function(_0x2cb612,_0xa5231d){if(_0x2cb612[_0x41a2('0x47')]['id']){delete _0x2cb612[_0x41a2('0x47')]['id'];}return db[_0x41a2('0x2a')]['find']({'where':{'id':_0x2cb612[_0x41a2('0x43')]['id']}})[_0x41a2('0x23')](handleEntityNotFound(_0xa5231d,null))[_0x41a2('0x23')](saveUpdates(_0x2cb612[_0x41a2('0x47')],null))['then'](respondWithResult(_0xa5231d,null))[_0x41a2('0x45')](handleError(_0xa5231d,null));};exports[_0x41a2('0x48')]=function(_0x10e00a,_0x2c9804){return db['VoiceRecording'][_0x41a2('0x48')]()['then'](respondWithResult(_0x2c9804,null))['catch'](handleError(_0x2c9804,null));};exports[_0x41a2('0x49')]=function(_0x4c82ab,_0x175276,_0x240ed0){var _0x5d86ab=require('../../components/encryptor');var _0x2b5178=![];var _0x347cf6={};if(_0x4c82ab[_0x41a2('0x30')][_0x41a2('0x2c')]&&_0x4c82ab[_0x41a2('0x30')][_0x41a2('0x2c')]===_0x41a2('0x4a')){_0x347cf6[_0x41a2('0x4a')]=_0x4c82ab[_0x41a2('0x43')]['id'];}else{_0x347cf6['id']=_0x4c82ab[_0x41a2('0x43')]['id'];}return db[_0x41a2('0x2a')]['find']({'where':_0x347cf6,'attributes':['id',_0x41a2('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x175276,null))['then'](function(_0x31b9b7){if(_0x31b9b7){var _0x481442=_0x31b9b7[_0x41a2('0x4b')];var _0x31b233=util['format'](_0x41a2('0x4c'),_0x481442);if(fs[_0x41a2('0x4d')](_0x31b233)){_0x2b5178=!![];return _0x5d86ab[_0x41a2('0x4e')](_0x31b233,_0x481442,config[_0x41a2('0x4f')][_0x41a2('0x50')])[_0x41a2('0x23')](function(){return _0x31b9b7;});}return _0x31b9b7;}})[_0x41a2('0x23')](function(_0x59b8f4){if(_0x59b8f4){var _0x5899fc=_0x59b8f4[_0x41a2('0x4b')];if(!fs[_0x41a2('0x4d')](_0x5899fc)){throw new db['Sequelize'][(_0x41a2('0x51'))](_0x41a2('0x52'));}if(_0x59b8f4[_0x41a2('0x53')]){return _0x175276[_0x41a2('0x49')](_0x5899fc,_0x59b8f4[_0x41a2('0x53')]+path[_0x41a2('0x54')](_0x5899fc),function(){if(_0x2b5178){fs[_0x41a2('0x55')](_0x5899fc);}});}else{return _0x175276['download'](_0x5899fc,function(_0xc615cd){if(_0x2b5178){fs[_0x41a2('0x55')](_0x5899fc);}});}}})[_0x41a2('0x45')](function(_0x2eaa38){if(_0x2eaa38[_0x41a2('0x56')]===_0x41a2('0x52')){_0x175276[_0x41a2('0x19')](0x194)[_0x41a2('0x27')]('Not\x20found');}else{return handleError(_0x175276,null);}});};exports['downloads']=function(_0x4a866a,_0xa1ade,_0x5d0a04){var _0x3472eb=require('../../components/encryptor');var _0xabb9e9=![];var _0x5b3dfa={'$and':[db['sequelize'][_0x41a2('0x38')](db[_0x41a2('0x57')]['fn'](_0x41a2('0x58'),db[_0x41a2('0x57')][_0x41a2('0x59')](_0x41a2('0x4a'))),_0x4a866a[_0x41a2('0x30')]['token'])]};if(_0x4a866a[_0x41a2('0x30')][_0x41a2('0x2c')]&&_0x4a866a[_0x41a2('0x30')][_0x41a2('0x2c')]===_0x41a2('0x4a')){_0x5b3dfa[_0x41a2('0x5a')][_0x41a2('0x5b')]({'uniqueid':_0x4a866a[_0x41a2('0x43')]['id']});}else{_0x5b3dfa['$and']['push']({'id':_0x4a866a[_0x41a2('0x43')]['id']});}return db[_0x41a2('0x2a')][_0x41a2('0x44')]({'where':_0x5b3dfa,'attributes':['id',_0x41a2('0x4b')],'raw':!![]})[_0x41a2('0x23')](handleEntityNotFound(_0xa1ade,null))[_0x41a2('0x23')](function(_0x3155eb){if(_0x3155eb){var _0x31111a=util['format'](_0x41a2('0x4c'),_0x3155eb[_0x41a2('0x4b')]);if(fs[_0x41a2('0x4d')](_0x31111a)){_0xabb9e9=!![];return _0x3472eb[_0x41a2('0x4e')](_0x31111a,_0x3155eb[_0x41a2('0x4b')],config[_0x41a2('0x4f')]['recording'])[_0x41a2('0x23')](function(){return _0x3155eb;});}return _0x3155eb;}})['then'](function(_0x44f8fd){if(_0x44f8fd){if(!fs['existsSync'](_0x44f8fd[_0x41a2('0x4b')])){throw new db['Sequelize'][(_0x41a2('0x51'))](_0x41a2('0x52'));}if(_0x44f8fd['filename']){return _0xa1ade[_0x41a2('0x49')](_0x44f8fd[_0x41a2('0x4b')],_0x44f8fd['filename']+path[_0x41a2('0x54')](_0x44f8fd[_0x41a2('0x4b')]),function(){if(_0xabb9e9){fs[_0x41a2('0x55')](_0x44f8fd[_0x41a2('0x4b')]);}});}else{return _0xa1ade['download'](_0x44f8fd[_0x41a2('0x4b')],function(_0x16c8da){if(_0xabb9e9){fs['unlink'](_0x44f8fd['value']);}});}}})[_0x41a2('0x45')](handleError(_0xa1ade,null));};exports[_0x41a2('0x22')]=function(_0x3d86c5,_0x2bfd5f){return db[_0x41a2('0x2a')][_0x41a2('0x44')]({'where':{'id':_0x3d86c5[_0x41a2('0x43')]['id']}})['then'](function(_0x1bcace){if(_[_0x41a2('0x5c')](_0x1bcace)){throw new ReferenceError(_0x41a2('0x5d'));}return _0x1bcace;})['then'](function(_0x336d63){var _0x1cafd8=_0x336d63['value'];logger[_0x41a2('0x5e')](_0x41a2('0x5f'),_0x1cafd8);if(!_['isNil'](_0x336d63[_0x41a2('0x4b')])&&fs[_0x41a2('0x4d')](_0x1cafd8)){logger[_0x41a2('0x5e')](_0x41a2('0x60')+_0x1cafd8+_0x41a2('0x61'));fs['unlinkSync'](_0x1cafd8);}_0x1cafd8=_0x1cafd8+'.cypher';if(!_[_0x41a2('0x5c')](_0x336d63[_0x41a2('0x4b')])&&fs[_0x41a2('0x4d')](_0x1cafd8)){logger['info'](_0x41a2('0x60')+_0x1cafd8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x41a2('0x62')](_0x1cafd8);}return _0x336d63;})[_0x41a2('0x23')](function(_0x5ad6be){if(!_0x5ad6be)throw new InternalError();return _0x5ad6be[_0x41a2('0x22')]();})[_0x41a2('0x23')](function(){_0x2bfd5f[_0x41a2('0x19')](0xcc)[_0x41a2('0x24')]();})['catch'](handleError(_0x2bfd5f,null));};function getBucketslist(_0x67bda,_0x9e33ce,_0x2bc792){return new Promise(function(_0x54f0d0,_0xb0ab58){var _0x908eae=new AWS['S3']({'accessKeyId':_0x9e33ce,'secretAccessKey':_0x67bda,'region':_0x2bc792});_0x908eae[_0x41a2('0x63')]({},function(_0x11703c,_0x188218){if(_0x11703c){return _0xb0ab58(_0x11703c);}else{return _0x54f0d0(_0x188218);}});});}function createBucket(_0x5d53e6,_0xec38dc,_0x578828,_0x15b51c){return new Promise(function(_0x5239c8,_0x34fc81){var _0xcbd9cd=new AWS['S3']({'accessKeyId':_0xec38dc,'secretAccessKey':_0x5d53e6,'region':_0x578828});_0xcbd9cd[_0x41a2('0x64')]({'Bucket':_0x15b51c},function(_0xb955c4,_0x25fb3c){if(_0xb955c4){return _0x34fc81(_0xb955c4);}else{return _0x5239c8(_0x25fb3c);}});});}function uploadFile(_0x51f7ce,_0x260481,_0x4e9189,_0x41c4bb,_0x18d56f,_0x83a5c0){return new Promise(function(_0x5c3c71,_0x1a4f90){var _0x59c95d=new AWS['S3']({'accessKeyId':_0x260481,'secretAccessKey':_0x51f7ce,'region':_0x4e9189});_0x59c95d[_0x41a2('0x65')]({'Bucket':_0x41c4bb,'Key':_0x18d56f,'Body':_0x83a5c0},function(_0x4f4983,_0x1ec69d){if(_0x4f4983){return _0x1a4f90(_0x4f4983);}else{return _0x5c3c71(_0x1ec69d);}});});}function startTranscribe(_0x98b440,_0x57732d,_0x59ae5b,_0x40b7bf,_0x5cb99f,_0x4c8d39){return new Promise(function(_0x25cc51,_0x5cc5de){var _0x2e3c2f=new AWS[(_0x41a2('0x66'))]({'accessKeyId':_0x57732d,'secretAccessKey':_0x98b440,'region':_0x59ae5b});_0x2e3c2f[_0x41a2('0x67')]({'TranscriptionJobName':_0x40b7bf,'LanguageCode':_0x5cb99f,'Media':{'MediaFileUri':_0x4c8d39}},function(_0x4dcfad,_0x1c8500){if(_0x4dcfad){return _0x5cc5de(_0x4dcfad);}else{return _0x25cc51(_0x1c8500);}});});}function transcribe(_0x5b3973,_0x499bcc,_0x1d8029,_0x2f68a6,_0x3290a7,_0x2add6e,_0x4706ab){return new Promise(function(_0x11b9fb,_0x4cbede){var _0x504bd0={};logger[_0x41a2('0x5e')](util['format'](_0x41a2('0x68'),_0x5b3973,_0x3290a7));return uploadFile(_0x499bcc,_0x1d8029,_0x2f68a6,_0x3290a7,path[_0x41a2('0x69')](_0x2add6e),fs[_0x41a2('0x6a')](_0x2add6e))[_0x41a2('0x23')](function(_0x448352){logger[_0x41a2('0x5e')](util[_0x41a2('0x2f')](_0x41a2('0x6b'),_0x5b3973,_0x3290a7,_0x448352['Location']));_0x504bd0[_0x41a2('0x6c')]=_0x448352[_0x41a2('0x6d')];_0x504bd0[_0x41a2('0x6e')]=_0x448352[_0x41a2('0x6f')];logger[_0x41a2('0x5e')](util[_0x41a2('0x2f')](_0x41a2('0x70'),_0x5b3973));return startTranscribe(_0x499bcc,_0x1d8029,_0x2f68a6,uuidv4(),_0x4706ab,_0x448352[_0x41a2('0x6f')]);})[_0x41a2('0x23')](function(_0x39f938){logger[_0x41a2('0x5e')](util[_0x41a2('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x5b3973,_0x39f938[_0x41a2('0x71')][_0x41a2('0x72')]));_0x504bd0[_0x41a2('0x73')]=_0x39f938[_0x41a2('0x71')][_0x41a2('0x72')];_0x504bd0[_0x41a2('0x74')]=_0x39f938['TranscriptionJob'][_0x41a2('0x75')];return _0x11b9fb(_0x504bd0);})[_0x41a2('0x45')](function(_0x56e63c){return _0x4cbede(_0x56e63c);});});}exports['runTranscribe']=function(_0x54627c,_0x4aa822,_0x556400){var _0x4f997f;var _0x4289c6;var _0x38c6fb;var _0x45ffe6=require(_0x41a2('0x76'));return db[_0x41a2('0x2a')][_0x41a2('0x77')]({'where':{'id':_0x54627c[_0x41a2('0x43')]['id']}})[_0x41a2('0x23')](function(_0x11e5e3){if(_0x11e5e3){var _0x5eb7b3=util[_0x41a2('0x2f')](_0x41a2('0x4c'),_0x11e5e3[_0x41a2('0x4b')]);if(fs['existsSync'](_0x5eb7b3)){cypher=!![];return _0x45ffe6[_0x41a2('0x4e')](_0x5eb7b3,_0x11e5e3[_0x41a2('0x4b')],config[_0x41a2('0x4f')][_0x41a2('0x50')])['then'](function(){return _0x11e5e3;});}return _0x11e5e3;}})[_0x41a2('0x23')](function(_0x3a9088){if(!_0x3a9088){throw new db[(_0x41a2('0x78'))][(_0x41a2('0x51'))]('Voice\x20Recording\x20not\x20found');}_0x4289c6=_0x3a9088;return db['Setting'][_0x41a2('0x77')]({'where':{'id':0x1}});})[_0x41a2('0x23')](handleEntityNotFound(_0x4aa822,null))[_0x41a2('0x23')](function(_0x54510d){if(_0x54510d){_0x4f997f=_0x54510d;if(!_0x4f997f['transcribe']||!_0x4f997f[_0x41a2('0x79')]||!_0x4f997f[_0x41a2('0x7a')]||!_0x4f997f['language']||!_0x4f997f[_0x41a2('0x6c')]){throw new db[(_0x41a2('0x78'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x54627c[_0x41a2('0x47')][_0x41a2('0x7b')]&&(!_0x4f997f['sentiment']||!_0x4f997f[_0x41a2('0x7c')]||!_0x4f997f['sentimentRegion']||!_0x4f997f[_0x41a2('0x7d')]||!_0x4f997f[_0x41a2('0x6c')])){throw new db[(_0x41a2('0x78'))][(_0x41a2('0x51'))](_0x41a2('0x7e'));}return db[_0x41a2('0x7f')][_0x41a2('0x77')]({'where':{'id':_0x4f997f['transcribeAccountId']}});}})[_0x41a2('0x23')](function(_0x4b7f4f){if(!_0x4b7f4f){throw new db[(_0x41a2('0x78'))]['ValidationError'](_0x41a2('0x80'));}if(!_0x4b7f4f['data1']||!_0x4b7f4f['data2']){throw new db[(_0x41a2('0x78'))][(_0x41a2('0x51'))](_0x41a2('0x81'));}_0x38c6fb=_0x4b7f4f;return getBucketslist(_0x38c6fb[_0x41a2('0x82')],_0x38c6fb[_0x41a2('0x83')],_0x4f997f['transcribeRegion']);})[_0x41a2('0x23')](function(_0x28e058){if(_0x28e058&&_0x28e058[_0x41a2('0x84')]){var _0x294702=_[_0x41a2('0x44')](_0x28e058['Buckets'],function(_0x3b1d62){return _0x3b1d62[_0x41a2('0x85')]===_0x4f997f[_0x41a2('0x6c')];});if(!_0x294702){logger[_0x41a2('0x5e')](util['format'](_0x41a2('0x86'),_0x54627c['params']['id'],_0x4f997f['bucket']));return createBucket(_0x38c6fb[_0x41a2('0x82')],_0x38c6fb[_0x41a2('0x83')],_0x4f997f['transcribeRegion'],_0x4f997f[_0x41a2('0x6c')]);}logger[_0x41a2('0x5e')](util[_0x41a2('0x2f')](_0x41a2('0x87'),_0x54627c[_0x41a2('0x43')]['id'],_0x4f997f[_0x41a2('0x6c')]));return;}})[_0x41a2('0x23')](function(_0x5b114c){if(_0x4289c6['transcribeStatus']===_0x41a2('0x88')){return transcribe(_0x54627c[_0x41a2('0x43')]['id'],_0x38c6fb[_0x41a2('0x82')],_0x38c6fb[_0x41a2('0x83')],_0x4f997f['transcribeRegion'],_0x4f997f[_0x41a2('0x6c')],_0x4289c6[_0x41a2('0x4b')],_0x4f997f[_0x41a2('0x7d')]);}else{logger[_0x41a2('0x5e')](util[_0x41a2('0x2f')](_0x41a2('0x89'),_0x54627c['params']['id']));return{'transcribeStatus':_0x41a2('0x8a')};}})[_0x41a2('0x23')](function(_0x520218){if(_0x520218){_0x520218[_0x41a2('0x8b')]=_0x54627c[_0x41a2('0x47')][_0x41a2('0x7b')];return _0x4289c6[_0x41a2('0x8c')](_0x520218);}})['then'](respondWithResult(_0x4aa822,null))[_0x41a2('0x45')](handleError(_0x4aa822,null));};function writeFile(_0x3e5388,_0x462a49){return new Promise(function(_0x579885,_0x5cd23e){fs[_0x41a2('0x8d')](_0x462a49,_0x3e5388,function(_0x3ca542,_0x5551ee){if(_0x3ca542){return _0x5cd23e(_0x3ca542);}else{return _0x579885(_0x5551ee);}});});}exports['downloadTranscribe']=function(_0x56f2a7,_0x17a082,_0x54f44a){return db['VoiceRecording'][_0x41a2('0x77')]({'where':{'id':_0x56f2a7[_0x41a2('0x43')]['id']}})[_0x41a2('0x23')](handleEntityNotFound(_0x17a082))[_0x41a2('0x23')](function(_0x4c1fa1){if(_0x4c1fa1&&_0x4c1fa1[_0x41a2('0x8e')]){var _0xac174b=_0x4c1fa1[_0x41a2('0x8e')];var _0x3c3f3c=config[_0x41a2('0x8f')]+'/server/files/transcribes/transcribe_'+_0x4c1fa1['id']+_0x41a2('0x90');if(fs['existsSync'](_0x3c3f3c)){return _0x3c3f3c;}return writeFile(_0xac174b,_0x3c3f3c)[_0x41a2('0x23')](function(){return _0x3c3f3c;});}else{throw new db['Sequelize'][(_0x41a2('0x51'))]('Transcript\x20not\x20available');}})[_0x41a2('0x23')](function(_0x35a30b){return _0x17a082[_0x41a2('0x49')](_0x35a30b);})['catch'](handleError(_0x17a082));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8e0aef5..9f65e2c 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 _0xb07f=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x4e3a2d,_0x318755){var _0x590fb5=function(_0x390ccf){while(--_0x390ccf){_0x4e3a2d['push'](_0x4e3a2d['shift']());}};_0x590fb5(++_0x318755);}(_0xb07f,0x109));var _0xfb07=function(_0x5b55ab,_0x2c03ab){_0x5b55ab=_0x5b55ab-0x0;var _0x3d9432=_0xb07f[_0x5b55ab];return _0x3d9432;};'use strict';var attributes=require(_0xfb07('0x0'));module[_0xfb07('0x1')]=function(_0x3088a0,_0xdf10d4){return _0x3088a0[_0xfb07('0x2')](_0xfb07('0x3'),attributes,{'tableName':_0xfb07('0x4'),'paranoid':![],'indexes':[{'name':_0xfb07('0x5'),'fields':[_0xfb07('0x5')]},{'name':_0xfb07('0x6'),'fields':[_0xfb07('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25a3=['transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid'];(function(_0x3febb0,_0x1071b8){var _0x414170=function(_0x3a8128){while(--_0x3a8128){_0x3febb0['push'](_0x3febb0['shift']());}};_0x414170(++_0x1071b8);}(_0x25a3,0x121));var _0x325a=function(_0x32be23,_0x595af5){_0x32be23=_0x32be23-0x0;var _0x223e2b=_0x25a3[_0x32be23];return _0x223e2b;};'use strict';var attributes=require(_0x325a('0x0'));module[_0x325a('0x1')]=function(_0x236732,_0x505c03){return _0x236732[_0x325a('0x2')]('VoiceRecording',attributes,{'tableName':_0x325a('0x3'),'paranoid':![],'indexes':[{'name':_0x325a('0x4'),'fields':[_0x325a('0x4')]},{'name':'transcribeStatus','fields':[_0x325a('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 696bad1..248a33b 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 _0x9582=['UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','VoiceRecording','body','options','where','attributes','limit','then'];(function(_0x593c49,_0x585d4b){var _0x3fc112=function(_0xdc7a23){while(--_0xdc7a23){_0x593c49['push'](_0x593c49['shift']());}};_0x3fc112(++_0x585d4b);}(_0x9582,0x95));var _0x2958=function(_0x2a6675,_0x45ad4b){_0x2a6675=_0x2a6675-0x0;var _0x1070a5=_0x9582[_0x2a6675];return _0x1070a5;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x309525,_0xa385ec,_0x2e571b){return new BPromise(function(_0x56ca85,_0x5ec1b3){return client[_0x2958('0xd')](_0x309525,_0x2e571b)['then'](function(_0x10db1e){logger['info'](_0x2958('0xe'),_0xa385ec,'request\x20sent');logger[_0x2958('0xf')](_0x2958('0x10'),_0xa385ec,_0x2958('0x11'),JSON[_0x2958('0x12')](_0x10db1e));if(_0x10db1e[_0x2958('0x13')]){if(_0x10db1e['error'][_0x2958('0x14')]===0x1f4){logger[_0x2958('0x13')](_0x2958('0xe'),_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x5ec1b3(_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);}logger[_0x2958('0x13')]('VoiceRecording,\x20%s,\x20%s',_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x56ca85(_0x10db1e['error']['message']);}else{logger[_0x2958('0x16')](_0x2958('0xe'),_0xa385ec,'request\x20sent');_0x56ca85(_0x10db1e[_0x2958('0x17')]['message']);}})['catch'](function(_0x429d42){logger[_0x2958('0x13')]('VoiceRecording,\x20%s,\x20%s',_0xa385ec,_0x429d42);_0x5ec1b3(_0x429d42);});});}exports['UpdateVoiceRecording']=function(_0x28a92c){var _0x160949=this;return new Promise(function(_0x310d07,_0x42bb99){return db[_0x2958('0x18')]['update'](_0x28a92c[_0x2958('0x19')],{'raw':_0x28a92c[_0x2958('0x1a')]?_0x28a92c[_0x2958('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28a92c[_0x2958('0x1a')]?_0x28a92c['options'][_0x2958('0x1b')]||null:null,'attributes':_0x28a92c['options']?_0x28a92c['options'][_0x2958('0x1c')]||null:null,'limit':_0x28a92c[_0x2958('0x1a')]?_0x28a92c[_0x2958('0x1a')][_0x2958('0x1d')]||null:null})[_0x2958('0x1e')](function(_0x412e42){logger[_0x2958('0x16')](_0x2958('0x1f'),_0x28a92c);logger[_0x2958('0xf')](_0x2958('0x1f'),_0x28a92c,JSON[_0x2958('0x12')](_0x412e42));_0x310d07(_0x412e42);})[_0x2958('0x20')](function(_0x119242){logger[_0x2958('0x13')](_0x2958('0x1f'),_0x119242['message'],_0x28a92c);_0x42bb99(_0x160949['error'](0x1f4,_0x119242[_0x2958('0x15')]));});});};exports[_0x2958('0x21')]=function(_0x28c1f5){var _0x43cf73=this;return new Promise(function(_0x52bd32,_0x2bd1ac){var _0x57ae96=require(_0x2958('0x22'));var _0x40adce;return db[_0x2958('0x23')][_0x2958('0x24')]({'attributes':['id',_0x2958('0x25')],'where':{'id':0x1},'raw':!![]})[_0x2958('0x1e')](function(_0x153958){_0x40adce=_0x153958;return db['VoiceRecording'][_0x2958('0x26')](_0x28c1f5['body']);})['then'](function(_0x28ee09){if(_0x40adce[_0x2958('0x25')]&&fs[_0x2958('0x27')](_0x28ee09[_0x2958('0x28')])){var _0x584179=util[_0x2958('0x29')](_0x2958('0x2a'),_0x28ee09[_0x2958('0x28')]);return _0x57ae96['encryptFile'](_0x28ee09[_0x2958('0x28')],_0x584179,config[_0x2958('0x2b')]['recording'])[_0x2958('0x1e')](function(){fs['unlink'](_0x28ee09[_0x2958('0x28')]);logger['info'](_0x2958('0x2c'));return _0x28ee09;});}return _0x28ee09;})['then'](function(_0x4477b5){logger[_0x2958('0x16')](_0x2958('0x21'),_0x28c1f5);logger[_0x2958('0xf')](_0x2958('0x21'),_0x28c1f5,JSON[_0x2958('0x12')](_0x4477b5));_0x52bd32(_0x4477b5);})[_0x2958('0x20')](function(_0x58f9b4){logger[_0x2958('0x13')]('CreateVoiceRecording',_0x58f9b4[_0x2958('0x15')],_0x28c1f5);_0x2bd1ac(_0x43cf73['error'](0x1f4,_0x58f9b4[_0x2958('0x15')]));});});}; \ No newline at end of file +var _0x1893=['http','request','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','then','existsSync','value','format','%s.cypher','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5a2a75,_0xe3a29e){var _0x4109c3=function(_0x5b77f8){while(--_0x5b77f8){_0x5a2a75['push'](_0x5a2a75['shift']());}};_0x4109c3(++_0xe3a29e);}(_0x1893,0xa2));var _0x3189=function(_0x2418e0,_0x7215b0){_0x2418e0=_0x2418e0-0x0;var _0x55ffbf=_0x1893[_0x2418e0];return _0x55ffbf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});}exports[_0x3189('0x15')]=function(_0xf8aed7){var _0x22c7ba=this;return new Promise(function(_0x9905c4,_0x4c4d9b){return db[_0x3189('0x16')][_0x3189('0x17')](_0xf8aed7[_0x3189('0x18')],{'raw':_0xf8aed7['options']?_0xf8aed7[_0x3189('0x19')][_0x3189('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf8aed7[_0x3189('0x19')]?_0xf8aed7[_0x3189('0x19')][_0x3189('0x1b')]||null:null,'attributes':_0xf8aed7['options']?_0xf8aed7[_0x3189('0x19')][_0x3189('0x1c')]||null:null,'limit':_0xf8aed7[_0x3189('0x19')]?_0xf8aed7['options'][_0x3189('0x1d')]||null:null})['then'](function(_0x4bfc03){logger[_0x3189('0x14')](_0x3189('0x15'),_0xf8aed7);logger[_0x3189('0xe')](_0x3189('0x15'),_0xf8aed7,JSON[_0x3189('0x10')](_0x4bfc03));_0x9905c4(_0x4bfc03);})['catch'](function(_0x4b03ad){logger[_0x3189('0x11')](_0x3189('0x15'),_0x4b03ad[_0x3189('0x13')],_0xf8aed7);_0x4c4d9b(_0x22c7ba[_0x3189('0x11')](0x1f4,_0x4b03ad[_0x3189('0x13')]));});});};exports[_0x3189('0x1e')]=function(_0xdda38b){var _0x379a48=this;return new Promise(function(_0x17b540,_0x5ec0ac){var _0x5ce5f5=require('../../components/encryptor');var _0x5aa34a;return db[_0x3189('0x1f')][_0x3189('0x20')]({'attributes':['id',_0x3189('0x21')],'where':{'id':0x1},'raw':!![]})[_0x3189('0x22')](function(_0x36b258){_0x5aa34a=_0x36b258;return db[_0x3189('0x16')]['create'](_0xdda38b[_0x3189('0x18')]);})[_0x3189('0x22')](function(_0x4bd677){if(_0x5aa34a[_0x3189('0x21')]&&fs[_0x3189('0x23')](_0x4bd677[_0x3189('0x24')])){var _0x5c7a36=util[_0x3189('0x25')](_0x3189('0x26'),_0x4bd677[_0x3189('0x24')]);return _0x5ce5f5['encryptFile'](_0x4bd677[_0x3189('0x24')],_0x5c7a36,config[_0x3189('0x27')]['recording'])[_0x3189('0x22')](function(){fs[_0x3189('0x28')](_0x4bd677[_0x3189('0x24')]);logger[_0x3189('0x14')](_0x3189('0x29'));return _0x4bd677;});}return _0x4bd677;})['then'](function(_0x544c49){logger[_0x3189('0x14')]('CreateVoiceRecording',_0xdda38b);logger[_0x3189('0xe')](_0x3189('0x1e'),_0xdda38b,JSON[_0x3189('0x10')](_0x544c49));_0x17b540(_0x544c49);})[_0x3189('0x2a')](function(_0x231d72){logger[_0x3189('0x11')](_0x3189('0x1e'),_0x231d72[_0x3189('0x13')],_0xdda38b);_0x5ec0ac(_0x379a48[_0x3189('0x11')](0x1f4,_0x231d72['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index fc8c8bd..0e8f8de 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 _0xcf9a=['/describe','describe','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x5a7de2,_0x2c0c67){var _0x4c5a8e=function(_0x123d79){while(--_0x123d79){_0x5a7de2['push'](_0x5a7de2['shift']());}};_0x4c5a8e(++_0x2c0c67);}(_0xcf9a,0xbe));var _0xacf9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcf9a[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xacf9('0x0'));var timeout=require(_0xacf9('0x1'));var express=require(_0xacf9('0x2'));var router=express[_0xacf9('0x3')]();var fs_extra=require(_0xacf9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacf9('0x5'));var config=require(_0xacf9('0x6'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xacf9('0x7')](),controller[_0xacf9('0x8')]);router[_0xacf9('0x9')](_0xacf9('0xa'),auth['isAuthenticated'](),controller[_0xacf9('0xb')]);router[_0xacf9('0x9')](_0xacf9('0xc'),auth[_0xacf9('0x7')](),controller[_0xacf9('0xd')]);router[_0xacf9('0xe')]('/',auth[_0xacf9('0x7')](),controller[_0xacf9('0xf')]);router['put'](_0xacf9('0xc'),auth[_0xacf9('0x7')](),controller[_0xacf9('0x10')]);router[_0xacf9('0x11')](_0xacf9('0xc'),auth[_0xacf9('0x7')](),controller[_0xacf9('0x12')]);module[_0xacf9('0x13')]=router; \ No newline at end of file +var _0xdf4c=['./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2bd7c0,_0x3359df){var _0x66cacd=function(_0x34d3e7){while(--_0x34d3e7){_0x2bd7c0['push'](_0x2bd7c0['shift']());}};_0x66cacd(++_0x3359df);}(_0xdf4c,0x183));var _0xcdf4=function(_0x4828f3,_0x5774b6){_0x4828f3=_0x4828f3-0x0;var _0x8a2a6=_0xdf4c[_0x4828f3];return _0x8a2a6;};'use strict';var multer=require(_0xcdf4('0x0'));var util=require(_0xcdf4('0x1'));var path=require(_0xcdf4('0x2'));var timeout=require(_0xcdf4('0x3'));var express=require('express');var router=express[_0xcdf4('0x4')]();var fs_extra=require(_0xcdf4('0x5'));var auth=require(_0xcdf4('0x6'));var interaction=require(_0xcdf4('0x7'));var config=require(_0xcdf4('0x8'));var controller=require(_0xcdf4('0x9'));router[_0xcdf4('0xa')]('/',auth[_0xcdf4('0xb')](),controller[_0xcdf4('0xc')]);router[_0xcdf4('0xa')](_0xcdf4('0xd'),auth['isAuthenticated'](),controller[_0xcdf4('0xe')]);router[_0xcdf4('0xa')]('/:id',auth[_0xcdf4('0xb')](),controller[_0xcdf4('0xf')]);router[_0xcdf4('0x10')]('/',auth[_0xcdf4('0xb')](),controller[_0xcdf4('0x11')]);router['put'](_0xcdf4('0x12'),auth['isAuthenticated'](),controller[_0xcdf4('0x13')]);router[_0xcdf4('0x14')](_0xcdf4('0x12'),auth[_0xcdf4('0xb')](),controller[_0xcdf4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 3901def..4a1169a 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 _0xe181=['STRING','Yes','sequelize','moment','blind','attended'];(function(_0x2c2b99,_0x678db5){var _0x3e5b17=function(_0xf0a121){while(--_0xf0a121){_0x2c2b99['push'](_0x2c2b99['shift']());}};_0x3e5b17(++_0x678db5);}(_0xe181,0x68));var _0x1e18=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xe181[_0x23be51];return _0x47a26d;};'use strict';var Sequelize=require(_0x1e18('0x0'));var moment=require(_0x1e18('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x1e18('0x2'),_0x1e18('0x3'))},'result':{'type':Sequelize[_0x1e18('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x1e18('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x1e18('0x4')]},'transferercontext':{'type':Sequelize[_0x1e18('0x4')]},'transfererexten':{'type':Sequelize[_0x1e18('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x1e18('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1e18('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1e18('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1e18('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x1e18('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1e18('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x1e18('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x1e18('0x5'),'No')},'context':{'type':Sequelize[_0x1e18('0x4')]},'extension':{'type':Sequelize[_0x1e18('0x4')]}}; \ No newline at end of file +var _0x3864=['Yes','moment','exports','ENUM','blind','attended','STRING'];(function(_0x2b950c,_0x57cc37){var _0x592648=function(_0x20b1f6){while(--_0x20b1f6){_0x2b950c['push'](_0x2b950c['shift']());}};_0x592648(++_0x57cc37);}(_0x3864,0x1c8));var _0x4386=function(_0x2de095,_0x801aff){_0x2de095=_0x2de095-0x0;var _0x1d9a32=_0x3864[_0x2de095];return _0x1d9a32;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4386('0x0'));module[_0x4386('0x1')]={'type':{'type':Sequelize[_0x4386('0x2')](_0x4386('0x3'),_0x4386('0x4'))},'result':{'type':Sequelize[_0x4386('0x5')]},'transfererchannel':{'type':Sequelize[_0x4386('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x4386('0x5')]},'transferercalleridname':{'type':Sequelize[_0x4386('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x4386('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x4386('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x4386('0x5')]},'transferercontext':{'type':Sequelize[_0x4386('0x5')]},'transfererexten':{'type':Sequelize[_0x4386('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x4386('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x4386('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x4386('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x4386('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x4386('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x4386('0x5')]},'transfereecontext':{'type':Sequelize[_0x4386('0x5')]},'transfereeexten':{'type':Sequelize[_0x4386('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x4386('0x5')]},'isexternal':{'type':Sequelize[_0x4386('0x2')](_0x4386('0x6'),'No')},'context':{'type':Sequelize[_0x4386('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 97c796f..6f4d3de 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 _0x3770=['VoiceTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','includeAll','include','findAll','params','merge','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0x3770,0xf7));var _0x0377=function(_0x459a95,_0x33ff87){_0x459a95=_0x459a95-0x0;var _0x501d62=_0x3770[_0x459a95];return _0x501d62;};'use strict';var emlformat=require(_0x0377('0x0'));var rimraf=require(_0x0377('0x1'));var zipdir=require(_0x0377('0x2'));var jsonpatch=require(_0x0377('0x3'));var rp=require(_0x0377('0x4'));var moment=require('moment');var BPromise=require(_0x0377('0x5'));var Mustache=require(_0x0377('0x6'));var util=require(_0x0377('0x7'));var path=require(_0x0377('0x8'));var sox=require('sox');var csv=require(_0x0377('0x9'));var ejs=require(_0x0377('0xa'));var fs=require('fs');var fs_extra=require(_0x0377('0xb'));var _=require('lodash');var squel=require(_0x0377('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0377('0xd'));var toCsv=require(_0x0377('0x9'));var querystring=require('querystring');var Papa=require(_0x0377('0xe'));var Redis=require('ioredis');var authService=require(_0x0377('0xf'));var qs=require(_0x0377('0x10'));var as=require(_0x0377('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0377('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0377('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b5c7c,_0xd7aaf){_0xd7aaf=_0xd7aaf||0xcc;return function(_0x2a86ea){if(_0x2a86ea){return _0x3b5c7c[_0x0377('0x14')](_0xd7aaf);}return _0x3b5c7c[_0x0377('0x15')](_0xd7aaf)[_0x0377('0x16')]();};}function respondWithResult(_0x275349,_0x5e53bf){_0x5e53bf=_0x5e53bf||0xc8;return function(_0x3b4148){if(_0x3b4148){return _0x275349[_0x0377('0x15')](_0x5e53bf)[_0x0377('0x17')](_0x3b4148);}};}function respondWithFilteredResult(_0x5b1363,_0x5353c6){return function(_0xc57764){if(_0xc57764){var _0x4c1907=typeof _0x5353c6['offset']==='undefined'&&typeof _0x5353c6[_0x0377('0x18')]===_0x0377('0x19');var _0x8227ff=_0xc57764['count'];var _0x2e5965=_0x4c1907?0x0:_0x5353c6[_0x0377('0x1a')];var _0x43ed36=_0x4c1907?_0xc57764[_0x0377('0x1b')]:_0x5353c6[_0x0377('0x1a')]+_0x5353c6[_0x0377('0x18')];var _0x10e4ac;if(_0x43ed36>=_0x8227ff){_0x43ed36=_0x8227ff;_0x10e4ac=0xc8;}else{_0x10e4ac=0xce;}_0x5b1363[_0x0377('0x15')](_0x10e4ac);return _0x5b1363[_0x0377('0x1c')](_0x0377('0x1d'),_0x2e5965+'-'+_0x43ed36+'/'+_0x8227ff)[_0x0377('0x17')](_0xc57764);}return null;};}function patchUpdates(_0x26d5fc){return function(_0x51ca6c){try{jsonpatch[_0x0377('0x1e')](_0x51ca6c,_0x26d5fc,!![]);}catch(_0x592ea2){return BPromise[_0x0377('0x1f')](_0x592ea2);}return _0x51ca6c[_0x0377('0x20')]();};}function saveUpdates(_0x204d0c,_0x232e0a){return function(_0x531274){if(_0x531274){return _0x531274[_0x0377('0x21')](_0x204d0c)[_0x0377('0x22')](function(_0x406159){return _0x406159;});}return null;};}function removeEntity(_0x483a02,_0x561811){return function(_0x43d636){if(_0x43d636){return _0x43d636[_0x0377('0x23')]()[_0x0377('0x22')](function(){_0x483a02[_0x0377('0x15')](0xcc)[_0x0377('0x16')]();});}};}function handleEntityNotFound(_0x3f6455,_0x462f76){return function(_0x4923fb){if(!_0x4923fb){_0x3f6455[_0x0377('0x14')](0x194);}return _0x4923fb;};}function handleError(_0x27a6e1,_0x3a4fe4){_0x3a4fe4=_0x3a4fe4||0x1f4;return function(_0xa838f){logger[_0x0377('0x24')](_0xa838f[_0x0377('0x25')]);if(_0xa838f[_0x0377('0x26')]){delete _0xa838f['name'];}_0x27a6e1[_0x0377('0x15')](_0x3a4fe4)['send'](_0xa838f);};}exports[_0x0377('0x27')]=function(_0x15a9e6,_0x8f45f1){var _0x3510c9={},_0x414ae5={},_0x494800={'count':0x0,'rows':[]};var _0x49899a=_[_0x0377('0x28')](db[_0x0377('0x29')][_0x0377('0x2a')],function(_0x1d241f){return{'name':_0x1d241f[_0x0377('0x2b')],'type':_0x1d241f[_0x0377('0x2c')][_0x0377('0x2d')]};});_0x414ae5['model']=_[_0x0377('0x28')](_0x49899a,_0x0377('0x26'));_0x414ae5['query']=_[_0x0377('0x2e')](_0x15a9e6[_0x0377('0x2f')]);_0x414ae5[_0x0377('0x30')]=_[_0x0377('0x31')](_0x414ae5[_0x0377('0x32')],_0x414ae5[_0x0377('0x2f')]);_0x3510c9[_0x0377('0x33')]=_['intersection'](_0x414ae5[_0x0377('0x32')],qs[_0x0377('0x34')](_0x15a9e6[_0x0377('0x2f')][_0x0377('0x34')]));_0x3510c9[_0x0377('0x33')]=_0x3510c9[_0x0377('0x33')][_0x0377('0x35')]?_0x3510c9[_0x0377('0x33')]:_0x414ae5['model'];if(!_0x15a9e6[_0x0377('0x2f')]['hasOwnProperty'](_0x0377('0x36'))){_0x3510c9[_0x0377('0x18')]=qs[_0x0377('0x18')](_0x15a9e6['query'][_0x0377('0x18')]);_0x3510c9[_0x0377('0x1a')]=qs['offset'](_0x15a9e6['query'][_0x0377('0x1a')]);}_0x3510c9[_0x0377('0x37')]=qs[_0x0377('0x38')](_0x15a9e6[_0x0377('0x2f')][_0x0377('0x38')]);_0x3510c9['where']=qs['filters'](_[_0x0377('0x39')](_0x15a9e6[_0x0377('0x2f')],_0x414ae5[_0x0377('0x30')]),_0x49899a);if(_0x15a9e6[_0x0377('0x2f')]['filter']){_0x3510c9[_0x0377('0x3a')]=_['merge'](_0x3510c9[_0x0377('0x3a')],{'$or':_['map'](_0x49899a,function(_0x11559d){if(_0x11559d['type']!==_0x0377('0x3b')){var _0x5332ea={};_0x5332ea[_0x11559d[_0x0377('0x26')]]={'$like':'%'+_0x15a9e6['query'][_0x0377('0x3c')]+'%'};return _0x5332ea;}})});}_0x3510c9=_['merge']({},_0x3510c9,_0x15a9e6['options']);var _0x53d3a9={'where':_0x3510c9[_0x0377('0x3a')]};return db[_0x0377('0x29')][_0x0377('0x1b')](_0x53d3a9)[_0x0377('0x22')](function(_0x337771){_0x494800['count']=_0x337771;if(_0x15a9e6['query'][_0x0377('0x3d')]){_0x3510c9[_0x0377('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x0377('0x3f')](_0x3510c9);})['then'](function(_0xb40e7){_0x494800['rows']=_0xb40e7;return _0x494800;})[_0x0377('0x22')](respondWithFilteredResult(_0x8f45f1,_0x3510c9))['catch'](handleError(_0x8f45f1,null));};exports['show']=function(_0x157c3d,_0x3cdadd){var _0x597339={'raw':!![],'where':{'id':_0x157c3d[_0x0377('0x40')]['id']}},_0x114e0f={};_0x114e0f['model']=_[_0x0377('0x2e')](db[_0x0377('0x29')][_0x0377('0x2a')]);_0x114e0f[_0x0377('0x2f')]=_[_0x0377('0x2e')](_0x157c3d[_0x0377('0x2f')]);_0x114e0f[_0x0377('0x30')]=_[_0x0377('0x31')](_0x114e0f['model'],_0x114e0f[_0x0377('0x2f')]);_0x597339[_0x0377('0x33')]=_[_0x0377('0x31')](_0x114e0f[_0x0377('0x32')],qs[_0x0377('0x34')](_0x157c3d[_0x0377('0x2f')]['fields']));_0x597339[_0x0377('0x33')]=_0x597339[_0x0377('0x33')][_0x0377('0x35')]?_0x597339[_0x0377('0x33')]:_0x114e0f[_0x0377('0x32')];if(_0x157c3d[_0x0377('0x2f')][_0x0377('0x3d')]){_0x597339['include']=[{'all':!![]}];}_0x597339=_[_0x0377('0x41')]({},_0x597339,_0x157c3d[_0x0377('0x42')]);return db[_0x0377('0x29')][_0x0377('0x43')](_0x597339)['then'](handleEntityNotFound(_0x3cdadd,null))[_0x0377('0x22')](respondWithResult(_0x3cdadd,null))[_0x0377('0x44')](handleError(_0x3cdadd,null));};exports[_0x0377('0x45')]=function(_0x26e6f7,_0x2d1116){return db[_0x0377('0x29')][_0x0377('0x45')](_0x26e6f7[_0x0377('0x46')],{})[_0x0377('0x22')](respondWithResult(_0x2d1116,0xc9))[_0x0377('0x44')](handleError(_0x2d1116,null));};exports[_0x0377('0x21')]=function(_0x565db3,_0x4d8c0f){if(_0x565db3[_0x0377('0x46')]['id']){delete _0x565db3[_0x0377('0x46')]['id'];}return db['VoiceTransferReport'][_0x0377('0x43')]({'where':{'id':_0x565db3[_0x0377('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d8c0f,null))[_0x0377('0x22')](saveUpdates(_0x565db3[_0x0377('0x46')],null))[_0x0377('0x22')](respondWithResult(_0x4d8c0f,null))[_0x0377('0x44')](handleError(_0x4d8c0f,null));};exports[_0x0377('0x23')]=function(_0x412997,_0x3c3178){return db[_0x0377('0x29')][_0x0377('0x43')]({'where':{'id':_0x412997[_0x0377('0x40')]['id']}})[_0x0377('0x22')](handleEntityNotFound(_0x3c3178,null))[_0x0377('0x22')](removeEntity(_0x3c3178,null))[_0x0377('0x44')](handleError(_0x3c3178,null));};exports['describe']=function(_0x5c9791,_0x387e89){return db[_0x0377('0x29')][_0x0377('0x47')]()['then'](respondWithResult(_0x387e89,null))[_0x0377('0x44')](handleError(_0x387e89,null));}; \ No newline at end of file +var _0xb099=['length','include','find','catch','create','body','update','destroy','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','keys'];(function(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_0xb099,0x136));var _0x9b09=function(_0x5cbe76,_0x43ae08){_0x5cbe76=_0x5cbe76-0x0;var _0x1cae5c=_0xb099[_0x5cbe76];return _0x1cae5c;};'use strict';var emlformat=require(_0x9b09('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b09('0x1'));var rp=require(_0x9b09('0x2'));var moment=require(_0x9b09('0x3'));var BPromise=require(_0x9b09('0x4'));var Mustache=require(_0x9b09('0x5'));var util=require(_0x9b09('0x6'));var path=require(_0x9b09('0x7'));var sox=require(_0x9b09('0x8'));var csv=require(_0x9b09('0x9'));var ejs=require(_0x9b09('0xa'));var fs=require('fs');var fs_extra=require(_0x9b09('0xb'));var _=require(_0x9b09('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b09('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9b09('0x9'));var querystring=require(_0x9b09('0xe'));var Papa=require('papaparse');var Redis=require(_0x9b09('0xf'));var authService=require(_0x9b09('0x10'));var qs=require(_0x9b09('0x11'));var as=require(_0x9b09('0x12'));var hardwareService=require(_0x9b09('0x13'));var logger=require(_0x9b09('0x14'))(_0x9b09('0x15'));var utils=require(_0x9b09('0x16'));var config=require(_0x9b09('0x17'));var licenseUtil=require(_0x9b09('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x387ae6,_0x5a2baf){_0x5a2baf=_0x5a2baf||0xcc;return function(_0x136856){if(_0x136856){return _0x387ae6[_0x9b09('0x19')](_0x5a2baf);}return _0x387ae6[_0x9b09('0x1a')](_0x5a2baf)['end']();};}function respondWithResult(_0x4b58ad,_0x4bbe3b){_0x4bbe3b=_0x4bbe3b||0xc8;return function(_0x54c056){if(_0x54c056){return _0x4b58ad['status'](_0x4bbe3b)[_0x9b09('0x1b')](_0x54c056);}};}function respondWithFilteredResult(_0x46230f,_0x5e6175){return function(_0x1d09e9){if(_0x1d09e9){var _0x173796=typeof _0x5e6175[_0x9b09('0x1c')]===_0x9b09('0x1d')&&typeof _0x5e6175[_0x9b09('0x1e')]===_0x9b09('0x1d');var _0x165789=_0x1d09e9[_0x9b09('0x1f')];var _0xbb28f7=_0x173796?0x0:_0x5e6175[_0x9b09('0x1c')];var _0x1fb7e6=_0x173796?_0x1d09e9[_0x9b09('0x1f')]:_0x5e6175[_0x9b09('0x1c')]+_0x5e6175[_0x9b09('0x1e')];var _0x1eae4d;if(_0x1fb7e6>=_0x165789){_0x1fb7e6=_0x165789;_0x1eae4d=0xc8;}else{_0x1eae4d=0xce;}_0x46230f[_0x9b09('0x1a')](_0x1eae4d);return _0x46230f[_0x9b09('0x20')](_0x9b09('0x21'),_0xbb28f7+'-'+_0x1fb7e6+'/'+_0x165789)['json'](_0x1d09e9);}return null;};}function patchUpdates(_0x4d3eaf){return function(_0x2cc67f){try{jsonpatch[_0x9b09('0x22')](_0x2cc67f,_0x4d3eaf,!![]);}catch(_0x2458ae){return BPromise[_0x9b09('0x23')](_0x2458ae);}return _0x2cc67f['save']();};}function saveUpdates(_0x1a60bd,_0x110238){return function(_0x48623b){if(_0x48623b){return _0x48623b['update'](_0x1a60bd)[_0x9b09('0x24')](function(_0x3b7ede){return _0x3b7ede;});}return null;};}function removeEntity(_0x3c61da,_0x2d5c74){return function(_0x54a827){if(_0x54a827){return _0x54a827['destroy']()['then'](function(){_0x3c61da[_0x9b09('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3edf07,_0x33dfa5){return function(_0x268be8){if(!_0x268be8){_0x3edf07[_0x9b09('0x19')](0x194);}return _0x268be8;};}function handleError(_0x519229,_0x55879e){_0x55879e=_0x55879e||0x1f4;return function(_0x2354b2){logger['error'](_0x2354b2[_0x9b09('0x25')]);if(_0x2354b2[_0x9b09('0x26')]){delete _0x2354b2[_0x9b09('0x26')];}_0x519229['status'](_0x55879e)[_0x9b09('0x27')](_0x2354b2);};}exports[_0x9b09('0x28')]=function(_0x365af1,_0xe3786){var _0x557395={},_0x3ed9d6={},_0x2ecf71={'count':0x0,'rows':[]};var _0x238933=_[_0x9b09('0x29')](db[_0x9b09('0x2a')][_0x9b09('0x2b')],function(_0x115851){return{'name':_0x115851['fieldName'],'type':_0x115851[_0x9b09('0x2c')][_0x9b09('0x2d')]};});_0x3ed9d6[_0x9b09('0x2e')]=_['map'](_0x238933,_0x9b09('0x26'));_0x3ed9d6[_0x9b09('0x2f')]=_['keys'](_0x365af1[_0x9b09('0x2f')]);_0x3ed9d6['filters']=_[_0x9b09('0x30')](_0x3ed9d6[_0x9b09('0x2e')],_0x3ed9d6['query']);_0x557395[_0x9b09('0x31')]=_[_0x9b09('0x30')](_0x3ed9d6[_0x9b09('0x2e')],qs[_0x9b09('0x32')](_0x365af1[_0x9b09('0x2f')][_0x9b09('0x32')]));_0x557395[_0x9b09('0x31')]=_0x557395[_0x9b09('0x31')]['length']?_0x557395[_0x9b09('0x31')]:_0x3ed9d6[_0x9b09('0x2e')];if(!_0x365af1['query'][_0x9b09('0x33')]('nolimit')){_0x557395['limit']=qs[_0x9b09('0x1e')](_0x365af1[_0x9b09('0x2f')][_0x9b09('0x1e')]);_0x557395['offset']=qs[_0x9b09('0x1c')](_0x365af1[_0x9b09('0x2f')][_0x9b09('0x1c')]);}_0x557395[_0x9b09('0x34')]=qs[_0x9b09('0x35')](_0x365af1[_0x9b09('0x2f')][_0x9b09('0x35')]);_0x557395[_0x9b09('0x36')]=qs[_0x9b09('0x37')](_[_0x9b09('0x38')](_0x365af1[_0x9b09('0x2f')],_0x3ed9d6['filters']),_0x238933);if(_0x365af1['query'][_0x9b09('0x39')]){_0x557395[_0x9b09('0x36')]=_[_0x9b09('0x3a')](_0x557395[_0x9b09('0x36')],{'$or':_[_0x9b09('0x29')](_0x238933,function(_0x380791){if(_0x380791[_0x9b09('0x2c')]!==_0x9b09('0x3b')){var _0x107d86={};_0x107d86[_0x380791[_0x9b09('0x26')]]={'$like':'%'+_0x365af1[_0x9b09('0x2f')]['filter']+'%'};return _0x107d86;}})});}_0x557395=_[_0x9b09('0x3a')]({},_0x557395,_0x365af1[_0x9b09('0x3c')]);var _0x34b6e8={'where':_0x557395[_0x9b09('0x36')]};return db[_0x9b09('0x2a')][_0x9b09('0x1f')](_0x34b6e8)['then'](function(_0x136927){_0x2ecf71[_0x9b09('0x1f')]=_0x136927;if(_0x365af1[_0x9b09('0x2f')][_0x9b09('0x3d')]){_0x557395['include']=[{'all':!![]}];}return db[_0x9b09('0x2a')]['findAll'](_0x557395);})[_0x9b09('0x24')](function(_0x385a9d){_0x2ecf71[_0x9b09('0x3e')]=_0x385a9d;return _0x2ecf71;})['then'](respondWithFilteredResult(_0xe3786,_0x557395))['catch'](handleError(_0xe3786,null));};exports[_0x9b09('0x3f')]=function(_0x4d7f59,_0x103777){var _0x940dff={'raw':!![],'where':{'id':_0x4d7f59['params']['id']}},_0x492c4f={};_0x492c4f['model']=_['keys'](db['VoiceTransferReport'][_0x9b09('0x2b')]);_0x492c4f['query']=_[_0x9b09('0x40')](_0x4d7f59[_0x9b09('0x2f')]);_0x492c4f[_0x9b09('0x37')]=_[_0x9b09('0x30')](_0x492c4f[_0x9b09('0x2e')],_0x492c4f[_0x9b09('0x2f')]);_0x940dff[_0x9b09('0x31')]=_[_0x9b09('0x30')](_0x492c4f[_0x9b09('0x2e')],qs[_0x9b09('0x32')](_0x4d7f59[_0x9b09('0x2f')][_0x9b09('0x32')]));_0x940dff[_0x9b09('0x31')]=_0x940dff[_0x9b09('0x31')][_0x9b09('0x41')]?_0x940dff[_0x9b09('0x31')]:_0x492c4f[_0x9b09('0x2e')];if(_0x4d7f59[_0x9b09('0x2f')]['includeAll']){_0x940dff[_0x9b09('0x42')]=[{'all':!![]}];}_0x940dff=_[_0x9b09('0x3a')]({},_0x940dff,_0x4d7f59[_0x9b09('0x3c')]);return db['VoiceTransferReport'][_0x9b09('0x43')](_0x940dff)[_0x9b09('0x24')](handleEntityNotFound(_0x103777,null))[_0x9b09('0x24')](respondWithResult(_0x103777,null))[_0x9b09('0x44')](handleError(_0x103777,null));};exports['create']=function(_0x24c02c,_0xbe054e){return db[_0x9b09('0x2a')][_0x9b09('0x45')](_0x24c02c[_0x9b09('0x46')],{})['then'](respondWithResult(_0xbe054e,0xc9))[_0x9b09('0x44')](handleError(_0xbe054e,null));};exports[_0x9b09('0x47')]=function(_0x5dfb3b,_0x24f50a){if(_0x5dfb3b[_0x9b09('0x46')]['id']){delete _0x5dfb3b['body']['id'];}return db[_0x9b09('0x2a')][_0x9b09('0x43')]({'where':{'id':_0x5dfb3b['params']['id']}})[_0x9b09('0x24')](handleEntityNotFound(_0x24f50a,null))[_0x9b09('0x24')](saveUpdates(_0x5dfb3b[_0x9b09('0x46')],null))['then'](respondWithResult(_0x24f50a,null))[_0x9b09('0x44')](handleError(_0x24f50a,null));};exports[_0x9b09('0x48')]=function(_0x38e36e,_0xec069f){return db[_0x9b09('0x2a')][_0x9b09('0x43')]({'where':{'id':_0x38e36e[_0x9b09('0x49')]['id']}})[_0x9b09('0x24')](handleEntityNotFound(_0xec069f,null))[_0x9b09('0x24')](removeEntity(_0xec069f,null))[_0x9b09('0x44')](handleError(_0xec069f,null));};exports[_0x9b09('0x4a')]=function(_0x201e5e,_0x2cf7a9){return db['VoiceTransferReport'][_0x9b09('0x4a')]()[_0x9b09('0x24')](respondWithResult(_0x2cf7a9,null))[_0x9b09('0x44')](handleError(_0x2cf7a9,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 297fb7b..b613523 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 _0x4165=['define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5efb7f,_0x5e86f7){var _0x5b7e94=function(_0xf1c161){while(--_0xf1c161){_0x5efb7f['push'](_0x5efb7f['shift']());}};_0x5b7e94(++_0x5e86f7);}(_0x4165,0x157));var _0x5416=function(_0x453437,_0x3dc51e){_0x453437=_0x453437-0x0;var _0x428fb6=_0x4165[_0x453437];return _0x428fb6;};'use strict';var _=require(_0x5416('0x0'));var util=require(_0x5416('0x1'));var logger=require(_0x5416('0x2'))(_0x5416('0x3'));var moment=require(_0x5416('0x4'));var BPromise=require(_0x5416('0x5'));var rp=require(_0x5416('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5416('0x7'));var config=require(_0x5416('0x8'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0xb1785e,_0x14f6cc){return _0xb1785e[_0x5416('0x9')](_0x5416('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c63=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x11ac58,_0x49e9ef){var _0x99427c=function(_0x131dd8){while(--_0x131dd8){_0x11ac58['push'](_0x11ac58['shift']());}};_0x99427c(++_0x49e9ef);}(_0x1c63,0xa1));var _0x31c6=function(_0x3167b1,_0x5ad266){_0x3167b1=_0x3167b1-0x0;var _0x362152=_0x1c63[_0x3167b1];return _0x362152;};'use strict';var _=require(_0x31c6('0x0'));var util=require(_0x31c6('0x1'));var logger=require(_0x31c6('0x2'))('api');var moment=require(_0x31c6('0x3'));var BPromise=require(_0x31c6('0x4'));var rp=require(_0x31c6('0x5'));var fs=require('fs');var path=require(_0x31c6('0x6'));var rimraf=require(_0x31c6('0x7'));var config=require(_0x31c6('0x8'));var attributes=require(_0x31c6('0x9'));module[_0x31c6('0xa')]=function(_0x16621b,_0x4d3386){return _0x16621b[_0x31c6('0xb')](_0x31c6('0xc'),attributes,{'tableName':_0x31c6('0xd'),'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 ba5651c..85fa0d0 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 _0x2957=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceTransferReport','create','options','raw','CreateVoiceTransferReport','stringify','catch','util','moment'];(function(_0x2b62f8,_0x30ef35){var _0x26f877=function(_0x77cad4){while(--_0x77cad4){_0x2b62f8['push'](_0x2b62f8['shift']());}};_0x26f877(++_0x30ef35);}(_0x2957,0x116));var _0x7295=function(_0x1da42f,_0x9980b8){_0x1da42f=_0x1da42f-0x0;var _0x2257b5=_0x2957[_0x1da42f];return _0x2257b5;};'use strict';var _=require('lodash');var util=require(_0x7295('0x0'));var moment=require(_0x7295('0x1'));var BPromise=require(_0x7295('0x2'));var rs=require(_0x7295('0x3'));var fs=require('fs');var Redis=require(_0x7295('0x4'));var db=require(_0x7295('0x5'))['db'];var utils=require(_0x7295('0x6'));var logger=require(_0x7295('0x7'))(_0x7295('0x8'));var config=require(_0x7295('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7295('0xa')][_0x7295('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b259c,_0x5753c6,_0x26beac){return new BPromise(function(_0x186da9,_0x328379){return client['request'](_0x3b259c,_0x26beac)[_0x7295('0xc')](function(_0x199ce3){logger[_0x7295('0xd')](_0x7295('0xe'),_0x5753c6,_0x7295('0xf'));logger['debug'](_0x7295('0x10'),_0x5753c6,'request\x20sent',JSON['stringify'](_0x199ce3));if(_0x199ce3[_0x7295('0x11')]){if(_0x199ce3[_0x7295('0x11')][_0x7295('0x12')]===0x1f4){logger['error'](_0x7295('0xe'),_0x5753c6,_0x199ce3[_0x7295('0x11')][_0x7295('0x13')]);return _0x328379(_0x199ce3[_0x7295('0x11')]['message']);}logger[_0x7295('0x11')](_0x7295('0xe'),_0x5753c6,_0x199ce3[_0x7295('0x11')][_0x7295('0x13')]);return _0x186da9(_0x199ce3[_0x7295('0x11')][_0x7295('0x13')]);}else{logger[_0x7295('0xd')](_0x7295('0xe'),_0x5753c6,_0x7295('0xf'));_0x186da9(_0x199ce3[_0x7295('0x14')]['message']);}})['catch'](function(_0x8c0984){logger[_0x7295('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x5753c6,_0x8c0984);_0x328379(_0x8c0984);});});}exports['CreateVoiceTransferReport']=function(_0x5515e9){var _0x40173c=this;return new Promise(function(_0x31d303,_0x17c0b){return db[_0x7295('0x15')][_0x7295('0x16')](_0x5515e9['body'],{'raw':_0x5515e9[_0x7295('0x17')]?_0x5515e9['options'][_0x7295('0x18')]===undefined?!![]:![]:!![]})[_0x7295('0xc')](function(_0xd910d6){logger[_0x7295('0xd')]('CreateVoiceTransferReport',_0x5515e9);logger['debug'](_0x7295('0x19'),_0x5515e9,JSON[_0x7295('0x1a')](_0xd910d6));_0x31d303(_0xd910d6);})[_0x7295('0x1b')](function(_0x4bdd13){logger[_0x7295('0x11')](_0x7295('0x19'),_0x4bdd13[_0x7295('0x13')],_0x5515e9);_0x17c0b(_0x40173c[_0x7295('0x11')](0x1f4,_0x4bdd13['message']));});});}; \ No newline at end of file +var _0x627e=['CreateVoiceTransferReport','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x627e,0x19b));var _0xe627=function(_0x5dee1b,_0x3f44a0){_0x5dee1b=_0x5dee1b-0x0;var _0x28ae10=_0x627e[_0x5dee1b];return _0x28ae10;};'use strict';var _=require(_0xe627('0x0'));var util=require('util');var moment=require(_0xe627('0x1'));var BPromise=require(_0xe627('0x2'));var rs=require(_0xe627('0x3'));var fs=require('fs');var Redis=require(_0xe627('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe627('0x5'));var logger=require(_0xe627('0x6'))('rpc');var config=require(_0xe627('0x7'));var jayson=require(_0xe627('0x8'));var client=jayson[_0xe627('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e6557,_0x2f2d94,_0x32a4a8){return new BPromise(function(_0x31fad3,_0x5d3f1c){return client[_0xe627('0xa')](_0x2e6557,_0x32a4a8)[_0xe627('0xb')](function(_0x2ad318){logger[_0xe627('0xc')](_0xe627('0xd'),_0x2f2d94,_0xe627('0xe'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2f2d94,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x2ad318));if(_0x2ad318[_0xe627('0x10')]){if(_0x2ad318['error'][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x2f2d94,_0x2ad318[_0xe627('0x10')][_0xe627('0x12')]);return _0x5d3f1c(_0x2ad318[_0xe627('0x10')]['message']);}logger[_0xe627('0x10')](_0xe627('0xd'),_0x2f2d94,_0x2ad318[_0xe627('0x10')][_0xe627('0x12')]);return _0x31fad3(_0x2ad318[_0xe627('0x10')][_0xe627('0x12')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x2f2d94,_0xe627('0xe'));_0x31fad3(_0x2ad318[_0xe627('0x13')][_0xe627('0x12')]);}})[_0xe627('0x14')](function(_0x3192ae){logger[_0xe627('0x10')](_0xe627('0xd'),_0x2f2d94,_0x3192ae);_0x5d3f1c(_0x3192ae);});});}exports[_0xe627('0x15')]=function(_0x595014){var _0x47728f=this;return new Promise(function(_0x20c15b,_0x2de925){return db['VoiceTransferReport'][_0xe627('0x16')](_0x595014[_0xe627('0x17')],{'raw':_0x595014[_0xe627('0x18')]?_0x595014[_0xe627('0x18')][_0xe627('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3037ac){logger[_0xe627('0xc')](_0xe627('0x15'),_0x595014);logger[_0xe627('0x1a')](_0xe627('0x15'),_0x595014,JSON[_0xe627('0xf')](_0x3037ac));_0x20c15b(_0x3037ac);})[_0xe627('0x14')](function(_0x1f2a95){logger[_0xe627('0x10')]('CreateVoiceTransferReport',_0x1f2a95[_0xe627('0x12')],_0x595014);_0x2de925(_0x47728f[_0xe627('0x10')](0x1f4,_0x1f2a95['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 012f23a..eef2078 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 _0xbdb7=['../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router'];(function(_0x334d1f,_0x4990a0){var _0x1c3f34=function(_0x33d0f2){while(--_0x33d0f2){_0x334d1f['push'](_0x334d1f['shift']());}};_0x1c3f34(++_0x4990a0);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xbdb7[_0x49052b];return _0x48c045;};'use strict';var express=require(_0x7bdb('0x0'));var router=express[_0x7bdb('0x1')]();var auth=require(_0x7bdb('0x2'));var controller=require(_0x7bdb('0x3'));router[_0x7bdb('0x4')](_0x7bdb('0x5'),auth[_0x7bdb('0x6')](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0x8')]);router['post'](_0x7bdb('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0x4')]('/answer',auth['isAuthenticated'](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0xb')]);router['post']('/hold',auth[_0x7bdb('0x6')](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0x4')](_0x7bdb('0xd'),auth[_0x7bdb('0x6')](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0xe')]);router['post']('/calls',auth['isAuthenticated'](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0xf')]);router['post'](_0x7bdb('0x10'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x7bdb('0x11')]);module[_0x7bdb('0x12')]=router; \ No newline at end of file +var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0x4b5409,_0x472b71){var _0x90b623=function(_0x596445){while(--_0x596445){_0x4b5409['push'](_0x4b5409['shift']());}};_0x90b623(++_0x472b71);}(_0x34e8,0x12c));var _0x834e=function(_0x3a6676,_0x50a5ea){_0x3a6676=_0x3a6676-0x0;var _0x1c6a3f=_0x34e8[_0x3a6676];return _0x1c6a3f;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 48f7983..0682806 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 _0x7b19=['conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','info','emit','log','handleError:','error','stack','status','request','then','code','result','catch','findOne','agent','VoiceChannels','rows','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','name','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','format','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','filter','UserId'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7b19,0x1b7));var _0x97b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b19[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x97b1('0x0'));var db=require(_0x97b1('0x1'))['db'];var config=require(_0x97b1('0x2'));var util=require('util');var BPromise=require(_0x97b1('0x3'));var jayson=require(_0x97b1('0x4'));var amiClient=jayson[_0x97b1('0x5')][_0x97b1('0x6')]({'port':0x232a});var logger=require(_0x97b1('0x7'))(_0x97b1('0x8'));var Redis=require(_0x97b1('0x9'));config[_0x97b1('0xa')]=_['defaults'](config[_0x97b1('0xa')],{'host':_0x97b1('0xb'),'port':0x18eb});var io=require(_0x97b1('0xc'))(new Redis(config[_0x97b1('0xa')]));var Schema=require(_0x97b1('0xd'));var originateValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x97b1('0xf')]},'callerId':{'type':_0x97b1('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':_0x97b1('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x97b1('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':_0x97b1('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':_0x97b1('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x97b1('0x11')]}});function emit(_0x4ee206,_0x22d677,_0x5c9e4f){logger[_0x97b1('0x12')](_0x4ee206,_0x22d677,JSON['stringify'](_0x5c9e4f));io['to'](_0x4ee206)[_0x97b1('0x13')](_0x22d677,_0x5c9e4f);}function handleError(_0x2669e9){return function(_0x2860c4){console[_0x97b1('0x14')](_0x97b1('0x15'),_0x2860c4,_0x2860c4 instanceof RangeError);logger[_0x97b1('0x16')](_0x2860c4[_0x97b1('0x17')]);if(_0x2860c4 instanceof RangeError){if(_0x2860c4['name']){delete _0x2860c4['name'];}_0x2669e9[_0x97b1('0x18')](0x194)['send'](_0x2860c4);}else{if(_0x2860c4['name']){delete _0x2860c4['name'];}_0x2669e9[_0x97b1('0x18')](0x1f4)['send'](_0x2860c4);}};}function checkError(){return function(_0x3cd1fa){if(!_0x3cd1fa){throw new RangeError('NotFound');}return _0x3cd1fa;};}function respondWithRpcPromise(_0x248057,_0x16c9c0){return new BPromise(function(_0x5cbcb2,_0x129eec){var _0x20b3ff=amiClient;return _0x20b3ff[_0x97b1('0x19')](_0x248057,_0x16c9c0)[_0x97b1('0x1a')](function(_0x1c5108){if(_0x1c5108[_0x97b1('0x16')]){if(_0x1c5108[_0x97b1('0x16')][_0x97b1('0x1b')]===0x1f4){return _0x129eec(_0x1c5108[_0x97b1('0x16')]['message']);}return _0x5cbcb2(_0x1c5108[_0x97b1('0x16')]['message']);}else{_0x5cbcb2(_0x1c5108[_0x97b1('0x1c')]);}})[_0x97b1('0x1d')](function(_0x5bd2dd){_0x129eec(_0x5bd2dd);});});}function getAgent(_0x24e394){return db['User'][_0x97b1('0x1e')]({'where':{'id':_0x24e394,'role':_0x97b1('0x1f')}})[_0x97b1('0x1a')](checkError());}function getAgentCheckSession(_0x11e29e,_0x262809){return new BPromise(function(_0x4f3760,_0x120a0c){var _0x988004=respondWithRpcPromise(_0x97b1('0x20'));var _0x21f810=getAgent(_0x11e29e);Promise['all']([_0x988004,_0x21f810])['then'](function(_0x18fb67){var _0x200836=_0x18fb67[0x0];var _0x3b3093=_0x18fb67[0x1];var _0x96e07d=_['filter'](_0x200836[_0x97b1('0x21')],function(_0x2fb7e1){return _0x2fb7e1['UserId']==_0x3b3093['id']&&_0x2fb7e1[_0x97b1('0x22')]==_0x262809;});if(_0x96e07d[_0x97b1('0x23')]==0x1){_0x4f3760(_0x3b3093);}else{_0x120a0c(new RangeError('sessionId\x20'+_0x262809+_0x97b1('0x24')));}});});}exports[_0x97b1('0x25')]=function(_0x361b9c,_0x439bf5){logger[_0x97b1('0x12')](_0x97b1('0x26'),_0x361b9c[_0x97b1('0x27')]);var _0x38c2ba=originateValidation[_0x97b1('0xd')](_0x361b9c[_0x97b1('0x27')]);if(_0x38c2ba['length']>0x0){return _0x439bf5['status'](0x190)[_0x97b1('0x28')](_0x38c2ba);}var _0x25f769=_0x361b9c[_0x97b1('0x27')][_0x97b1('0x29')];var _0x1fe42a=_0x361b9c[_0x97b1('0x27')][_0x97b1('0x2a')];var _0x2ead5c=_0x361b9c[_0x97b1('0x27')]['callerId'];var _0x41fe5d=_0x361b9c[_0x97b1('0x27')][_0x97b1('0x2b')];return getAgent(_0x25f769)[_0x97b1('0x1a')](function(_0x308593){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0x308593[_0x97b1('0x2d')]);emit(util['format'](_0x97b1('0x2e'),_0x308593[_0x97b1('0x2d')]),'webbar:originate',{'callNumber':_0x1fe42a,'callerId':_0x2ead5c,'callbackUrl':_0x41fe5d});return _0x439bf5[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x2f')});})[_0x97b1('0x1d')](handleError(_0x439bf5));};exports[_0x97b1('0x30')]=function(_0x43ffbb,_0x4b2843){logger[_0x97b1('0x12')](_0x97b1('0x31'),_0x43ffbb['body']);var _0x116087=hangupValidation[_0x97b1('0xd')](_0x43ffbb['body']);if(_0x116087[_0x97b1('0x23')]>0x0){return _0x4b2843['status'](0x190)[_0x97b1('0x28')](_0x116087);}var _0x411c50=_0x43ffbb[_0x97b1('0x27')][_0x97b1('0x29')];var _0x539e62=_0x43ffbb['body']['sessionId'];return getAgent(_0x411c50)['then'](function(_0xe6a4f8){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0xe6a4f8[_0x97b1('0x2d')]);emit(util['format']('user:%s',_0xe6a4f8[_0x97b1('0x2d')]),_0x97b1('0x32'),{'sessionId':_0x539e62});return _0x4b2843[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x33')});})[_0x97b1('0x1d')](handleError(_0x4b2843));};exports[_0x97b1('0x34')]=function(_0x590cf2,_0x329b08){logger[_0x97b1('0x12')](_0x97b1('0x35'),_0x590cf2['body']);var _0x382a97=answerValidation['validate'](_0x590cf2[_0x97b1('0x27')]);if(_0x382a97[_0x97b1('0x23')]>0x0){return _0x329b08['status'](0x190)[_0x97b1('0x28')](_0x382a97);}var _0x397b81=_0x590cf2['body']['userId'];var _0x2b6027=_0x590cf2['body'][_0x97b1('0x22')];return getAgent(_0x397b81)['then'](function(_0x1e4c55){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0x1e4c55[_0x97b1('0x2d')]);emit(util['format']('user:%s',_0x1e4c55[_0x97b1('0x2d')]),_0x97b1('0x36'),{'sessionId':_0x2b6027});return _0x329b08[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x37')});})['catch'](handleError(_0x329b08));};exports[_0x97b1('0x38')]=function(_0xb0a8c8,_0x410399){logger[_0x97b1('0x12')]('hold\x20fired:',_0xb0a8c8['body']);var _0x29a6dc=holdValidation[_0x97b1('0xd')](_0xb0a8c8[_0x97b1('0x27')]);if(_0x29a6dc[_0x97b1('0x23')]>0x0){return _0x410399[_0x97b1('0x18')](0x190)[_0x97b1('0x28')](_0x29a6dc);}var _0xd8bfce=_0xb0a8c8[_0x97b1('0x27')][_0x97b1('0x29')];var _0xbfa94b=_0xb0a8c8[_0x97b1('0x27')][_0x97b1('0x22')];return getAgent(_0xd8bfce)['then'](function(_0x3c7692){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0x3c7692['name']);emit(util[_0x97b1('0x39')]('user:%s',_0x3c7692[_0x97b1('0x2d')]),_0x97b1('0x3a'),{'sessionId':_0xbfa94b});return _0x410399[_0x97b1('0x18')](0xc8)['json']({'error':![],'message':_0x97b1('0x3b')});})[_0x97b1('0x1d')](handleError(_0x410399));};exports['unhold']=function(_0x7042fd,_0x54f54f){logger['info'](_0x97b1('0x3c'),_0x7042fd[_0x97b1('0x27')]);var _0x1c905f=unholdValidation[_0x97b1('0xd')](_0x7042fd[_0x97b1('0x27')]);if(_0x1c905f[_0x97b1('0x23')]>0x0){return _0x54f54f['status'](0x190)[_0x97b1('0x28')](_0x1c905f);}var _0x310df0=_0x7042fd['body'][_0x97b1('0x29')];var _0x4d8d25=_0x7042fd[_0x97b1('0x27')][_0x97b1('0x22')];return getAgent(_0x310df0)[_0x97b1('0x1a')](function(_0x4539b0){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0x4539b0[_0x97b1('0x2d')]);emit(util['format']('user:%s',_0x4539b0[_0x97b1('0x2d')]),_0x97b1('0x3d'),{'sessionId':_0x4d8d25});return _0x54f54f[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x3e')});})[_0x97b1('0x1d')](handleError(_0x54f54f));};exports['calls']=function(_0x55de2e,_0x3f3602){logger['info']('calls\x20fired:',_0x3f3602[_0x97b1('0x27')]);var _0x89be1=callsValidation[_0x97b1('0xd')](_0x55de2e[_0x97b1('0x27')]);if(_0x89be1[_0x97b1('0x23')]>0x0){return _0x3f3602[_0x97b1('0x18')](0x190)[_0x97b1('0x28')](_0x89be1);}var _0x11746e=_0x55de2e[_0x97b1('0x27')][_0x97b1('0x29')];var _0x36ee01=respondWithRpcPromise(_0x97b1('0x20'));var _0x54c495=getAgent(_0x11746e);return Promise['all']([_0x36ee01,_0x54c495])[_0x97b1('0x1a')](function(_0x48670a){var _0x2af9d7=_0x48670a[0x0];var _0x1c173c=_0x48670a[0x1];var _0x3b99fa=_[_0x97b1('0x3f')](_0x2af9d7[_0x97b1('0x21')],function(_0x5a09cd){return _0x5a09cd[_0x97b1('0x40')]==_0x1c173c['id'];});return _0x3f3602[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'count':_0x3b99fa['length'],'rows':_0x3b99fa});})[_0x97b1('0x1d')](handleError(_0x3f3602));};exports[_0x97b1('0x41')]=function(_0x5be89a,_0x2525dc){logger[_0x97b1('0x12')]('conference\x20fired:',_0x5be89a[_0x97b1('0x27')]);var _0x2ca4af=conferenceValidation[_0x97b1('0xd')](_0x5be89a['body']);if(_0x2ca4af[_0x97b1('0x23')]>0x0){return _0x2525dc[_0x97b1('0x18')](0x190)[_0x97b1('0x28')](_0x2ca4af);}var _0x5866de=_0x5be89a[_0x97b1('0x27')]['userId'];return getAgent(_0x5866de)['then'](function(_0x4ffc0b){logger['info'](_0x97b1('0x2c'),_0x4ffc0b['name']);emit(util[_0x97b1('0x39')](_0x97b1('0x2e'),_0x4ffc0b[_0x97b1('0x2d')]),_0x97b1('0x42'));return _0x2525dc[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x43')});})[_0x97b1('0x1d')](handleError(_0x2525dc));};exports['transfer']=function(_0x454504,_0x464584){logger[_0x97b1('0x12')](_0x97b1('0x44'),_0x454504[_0x97b1('0x27')]);var _0x5d19b5=transferValidation['validate'](_0x454504[_0x97b1('0x27')]);if(_0x5d19b5[_0x97b1('0x23')]>0x0){return _0x464584[_0x97b1('0x18')](0x190)[_0x97b1('0x28')](_0x5d19b5);}var _0x4f784e=_0x454504['body'][_0x97b1('0x29')];var _0x445986=_0x454504['body'][_0x97b1('0x22')];var _0x317eb6=_0x454504[_0x97b1('0x27')][_0x97b1('0x45')];return getAgent(_0x4f784e)[_0x97b1('0x1a')](function(_0xcfc47a){logger[_0x97b1('0x12')]('entityFound:',_0xcfc47a[_0x97b1('0x2d')]);emit(util['format'](_0x97b1('0x2e'),_0xcfc47a[_0x97b1('0x2d')]),_0x97b1('0x46'),{'sessionId':_0x445986,'transferNumber':_0x317eb6});return _0x464584[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x47')});})['catch'](handleError(_0x464584));}; \ No newline at end of file +var _0x6b3f=['validate','json','entityFound:','format','originate\x20executed!','catch','hangup','hangup\x20fired:','userId','webbar:hangup','answer\x20fired:','user:%s','webbar:answer','hold','hold\x20fired:','sessionId','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','VoiceChannels','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','info','log','handleError:','name','send','status','then','error','code','message','result','User','findOne','agent','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body'];(function(_0x393785,_0x30bbb5){var _0x1c2276=function(_0x526fbf){while(--_0x526fbf){_0x393785['push'](_0x393785['shift']());}};_0x1c2276(++_0x30bbb5);}(_0x6b3f,0x1b4));var _0xf6b3=function(_0x66f3e0,_0x2d1388){_0x66f3e0=_0x66f3e0-0x0;var _0x45870a=_0x6b3f[_0x66f3e0];return _0x45870a;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf6b3('0x0'));var db=require(_0xf6b3('0x1'))['db'];var config=require('../../config/environment');var util=require(_0xf6b3('0x2'));var BPromise=require(_0xf6b3('0x3'));var jayson=require(_0xf6b3('0x4'));var amiClient=jayson[_0xf6b3('0x5')][_0xf6b3('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0xf6b3('0x7'));var Redis=require(_0xf6b3('0x8'));config[_0xf6b3('0x9')]=_[_0xf6b3('0xa')](config[_0xf6b3('0x9')],{'host':_0xf6b3('0xb'),'port':0x18eb});var io=require(_0xf6b3('0xc'))(new Redis(config[_0xf6b3('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf6b3('0xd'),'required':[!![],_0xf6b3('0xe')]},'callNumber':{'type':_0xf6b3('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xf6b3('0xf')},'callbackUrl':{'type':_0xf6b3('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xf6b3('0xd'),'required':[!![],_0xf6b3('0xe')]},'sessionId':{'type':_0xf6b3('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf6b3('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf6b3('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf6b3('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf6b3('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xf6b3('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf6b3('0xe')]},'sessionId':{'type':_0xf6b3('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf6b3('0xd'),'required':[!![],_0xf6b3('0xe')]},'sessionId':{'type':_0xf6b3('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf6b3('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf6b3('0xd'),'required':[!![],_0xf6b3('0xe')]}});function emit(_0x8f18b,_0xbe3774,_0x42bd8c){logger[_0xf6b3('0x10')](_0x8f18b,_0xbe3774,JSON['stringify'](_0x42bd8c));io['to'](_0x8f18b)['emit'](_0xbe3774,_0x42bd8c);}function handleError(_0xe17993){return function(_0x5710f0){console[_0xf6b3('0x11')](_0xf6b3('0x12'),_0x5710f0,_0x5710f0 instanceof RangeError);logger['error'](_0x5710f0['stack']);if(_0x5710f0 instanceof RangeError){if(_0x5710f0[_0xf6b3('0x13')]){delete _0x5710f0[_0xf6b3('0x13')];}_0xe17993['status'](0x194)[_0xf6b3('0x14')](_0x5710f0);}else{if(_0x5710f0[_0xf6b3('0x13')]){delete _0x5710f0[_0xf6b3('0x13')];}_0xe17993[_0xf6b3('0x15')](0x1f4)[_0xf6b3('0x14')](_0x5710f0);}};}function checkError(){return function(_0x14c5ee){if(!_0x14c5ee){throw new RangeError('NotFound');}return _0x14c5ee;};}function respondWithRpcPromise(_0x78c394,_0x82e96b){return new BPromise(function(_0x130ddf,_0x415e53){var _0x3b1784=amiClient;return _0x3b1784['request'](_0x78c394,_0x82e96b)[_0xf6b3('0x16')](function(_0xec662){if(_0xec662[_0xf6b3('0x17')]){if(_0xec662[_0xf6b3('0x17')][_0xf6b3('0x18')]===0x1f4){return _0x415e53(_0xec662[_0xf6b3('0x17')][_0xf6b3('0x19')]);}return _0x130ddf(_0xec662[_0xf6b3('0x17')][_0xf6b3('0x19')]);}else{_0x130ddf(_0xec662[_0xf6b3('0x1a')]);}})['catch'](function(_0x265946){_0x415e53(_0x265946);});});}function getAgent(_0x1e86ce){return db[_0xf6b3('0x1b')][_0xf6b3('0x1c')]({'where':{'id':_0x1e86ce,'role':_0xf6b3('0x1d')}})[_0xf6b3('0x16')](checkError());}function getAgentCheckSession(_0x1b66af,_0x22cc61){return new BPromise(function(_0x4f298b,_0x2db1a5){var _0x4cc4aa=respondWithRpcPromise('VoiceChannels');var _0x4c6c4f=getAgent(_0x1b66af);Promise[_0xf6b3('0x1e')]([_0x4cc4aa,_0x4c6c4f])[_0xf6b3('0x16')](function(_0x58e232){var _0x100fd0=_0x58e232[0x0];var _0x225657=_0x58e232[0x1];var _0x3ac344=_[_0xf6b3('0x1f')](_0x100fd0[_0xf6b3('0x20')],function(_0x1f4196){return _0x1f4196[_0xf6b3('0x21')]==_0x225657['id']&&_0x1f4196['sessionId']==_0x22cc61;});if(_0x3ac344[_0xf6b3('0x22')]==0x1){_0x4f298b(_0x225657);}else{_0x2db1a5(new RangeError(_0xf6b3('0x23')+_0x22cc61+_0xf6b3('0x24')));}});});}exports[_0xf6b3('0x25')]=function(_0x4d9a7e,_0x166dc7){logger[_0xf6b3('0x10')](_0xf6b3('0x26'),_0x4d9a7e[_0xf6b3('0x27')]);var _0x20126b=originateValidation[_0xf6b3('0x28')](_0x4d9a7e[_0xf6b3('0x27')]);if(_0x20126b[_0xf6b3('0x22')]>0x0){return _0x166dc7[_0xf6b3('0x15')](0x190)[_0xf6b3('0x29')](_0x20126b);}var _0xf0c765=_0x4d9a7e[_0xf6b3('0x27')]['userId'];var _0x14e67a=_0x4d9a7e[_0xf6b3('0x27')]['callNumber'];var _0x5182c2=_0x4d9a7e[_0xf6b3('0x27')]['callerId'];var _0x536d62=_0x4d9a7e['body']['callbackUrl'];return getAgent(_0xf0c765)[_0xf6b3('0x16')](function(_0x6b57b5){logger[_0xf6b3('0x10')](_0xf6b3('0x2a'),_0x6b57b5[_0xf6b3('0x13')]);emit(util[_0xf6b3('0x2b')]('user:%s',_0x6b57b5['name']),'webbar:originate',{'callNumber':_0x14e67a,'callerId':_0x5182c2,'callbackUrl':_0x536d62});return _0x166dc7[_0xf6b3('0x15')](0xc8)['json']({'error':![],'message':_0xf6b3('0x2c')});})[_0xf6b3('0x2d')](handleError(_0x166dc7));};exports[_0xf6b3('0x2e')]=function(_0x3b3994,_0x132a24){logger[_0xf6b3('0x10')](_0xf6b3('0x2f'),_0x3b3994[_0xf6b3('0x27')]);var _0x17e55b=hangupValidation[_0xf6b3('0x28')](_0x3b3994[_0xf6b3('0x27')]);if(_0x17e55b[_0xf6b3('0x22')]>0x0){return _0x132a24[_0xf6b3('0x15')](0x190)[_0xf6b3('0x29')](_0x17e55b);}var _0xa97cc8=_0x3b3994[_0xf6b3('0x27')][_0xf6b3('0x30')];var _0x53e75e=_0x3b3994[_0xf6b3('0x27')]['sessionId'];return getAgent(_0xa97cc8)[_0xf6b3('0x16')](function(_0xa7bc6f){logger['info'](_0xf6b3('0x2a'),_0xa7bc6f[_0xf6b3('0x13')]);emit(util[_0xf6b3('0x2b')]('user:%s',_0xa7bc6f['name']),_0xf6b3('0x31'),{'sessionId':_0x53e75e});return _0x132a24[_0xf6b3('0x15')](0xc8)[_0xf6b3('0x29')]({'error':![],'message':'hangup\x20executed!'});})[_0xf6b3('0x2d')](handleError(_0x132a24));};exports['answer']=function(_0x32b14,_0x569106){logger[_0xf6b3('0x10')](_0xf6b3('0x32'),_0x32b14[_0xf6b3('0x27')]);var _0x15a175=answerValidation['validate'](_0x32b14[_0xf6b3('0x27')]);if(_0x15a175[_0xf6b3('0x22')]>0x0){return _0x569106[_0xf6b3('0x15')](0x190)[_0xf6b3('0x29')](_0x15a175);}var _0x5b85fa=_0x32b14[_0xf6b3('0x27')]['userId'];var _0x4b031f=_0x32b14[_0xf6b3('0x27')]['sessionId'];return getAgent(_0x5b85fa)[_0xf6b3('0x16')](function(_0x18f68c){logger['info'](_0xf6b3('0x2a'),_0x18f68c[_0xf6b3('0x13')]);emit(util[_0xf6b3('0x2b')](_0xf6b3('0x33'),_0x18f68c[_0xf6b3('0x13')]),_0xf6b3('0x34'),{'sessionId':_0x4b031f});return _0x569106['status'](0xc8)[_0xf6b3('0x29')]({'error':![],'message':'answer\x20executed!'});})[_0xf6b3('0x2d')](handleError(_0x569106));};exports[_0xf6b3('0x35')]=function(_0x4a8992,_0x248c59){logger[_0xf6b3('0x10')](_0xf6b3('0x36'),_0x4a8992[_0xf6b3('0x27')]);var _0x51ca93=holdValidation[_0xf6b3('0x28')](_0x4a8992[_0xf6b3('0x27')]);if(_0x51ca93[_0xf6b3('0x22')]>0x0){return _0x248c59[_0xf6b3('0x15')](0x190)[_0xf6b3('0x29')](_0x51ca93);}var _0x3497c5=_0x4a8992['body']['userId'];var _0xd170db=_0x4a8992[_0xf6b3('0x27')][_0xf6b3('0x37')];return getAgent(_0x3497c5)['then'](function(_0x231831){logger[_0xf6b3('0x10')](_0xf6b3('0x2a'),_0x231831[_0xf6b3('0x13')]);emit(util[_0xf6b3('0x2b')](_0xf6b3('0x33'),_0x231831[_0xf6b3('0x13')]),_0xf6b3('0x38'),{'sessionId':_0xd170db});return _0x248c59[_0xf6b3('0x15')](0xc8)[_0xf6b3('0x29')]({'error':![],'message':_0xf6b3('0x39')});})[_0xf6b3('0x2d')](handleError(_0x248c59));};exports[_0xf6b3('0x3a')]=function(_0x16ab6f,_0x53225a){logger[_0xf6b3('0x10')](_0xf6b3('0x3b'),_0x16ab6f[_0xf6b3('0x27')]);var _0x5f658b=unholdValidation[_0xf6b3('0x28')](_0x16ab6f[_0xf6b3('0x27')]);if(_0x5f658b[_0xf6b3('0x22')]>0x0){return _0x53225a[_0xf6b3('0x15')](0x190)[_0xf6b3('0x29')](_0x5f658b);}var _0x33c386=_0x16ab6f['body'][_0xf6b3('0x30')];var _0x42452c=_0x16ab6f['body'][_0xf6b3('0x37')];return getAgent(_0x33c386)['then'](function(_0x5cae57){logger[_0xf6b3('0x10')]('entityFound:',_0x5cae57['name']);emit(util[_0xf6b3('0x2b')]('user:%s',_0x5cae57['name']),'webbar:unhold',{'sessionId':_0x42452c});return _0x53225a[_0xf6b3('0x15')](0xc8)[_0xf6b3('0x29')]({'error':![],'message':'unhold\x20executed!'});})[_0xf6b3('0x2d')](handleError(_0x53225a));};exports[_0xf6b3('0x3c')]=function(_0x51ec4c,_0x503fac){logger[_0xf6b3('0x10')]('calls\x20fired:',_0x503fac['body']);var _0x46b7c2=callsValidation[_0xf6b3('0x28')](_0x51ec4c['body']);if(_0x46b7c2[_0xf6b3('0x22')]>0x0){return _0x503fac[_0xf6b3('0x15')](0x190)[_0xf6b3('0x29')](_0x46b7c2);}var _0x2df219=_0x51ec4c[_0xf6b3('0x27')]['userId'];var _0x5d5974=respondWithRpcPromise(_0xf6b3('0x3d'));var _0x3e5b26=getAgent(_0x2df219);return Promise['all']([_0x5d5974,_0x3e5b26])[_0xf6b3('0x16')](function(_0x2873a9){var _0x3a54b3=_0x2873a9[0x0];var _0x3f80c6=_0x2873a9[0x1];var _0x2c541d=_['filter'](_0x3a54b3[_0xf6b3('0x20')],function(_0x542004){return _0x542004['UserId']==_0x3f80c6['id'];});return _0x503fac[_0xf6b3('0x15')](0xc8)[_0xf6b3('0x29')]({'count':_0x2c541d[_0xf6b3('0x22')],'rows':_0x2c541d});})[_0xf6b3('0x2d')](handleError(_0x503fac));};exports[_0xf6b3('0x3e')]=function(_0x145350,_0x4ac66b){logger[_0xf6b3('0x10')](_0xf6b3('0x3f'),_0x145350[_0xf6b3('0x27')]);var _0x54eb7a=conferenceValidation[_0xf6b3('0x28')](_0x145350[_0xf6b3('0x27')]);if(_0x54eb7a[_0xf6b3('0x22')]>0x0){return _0x4ac66b[_0xf6b3('0x15')](0x190)[_0xf6b3('0x29')](_0x54eb7a);}var _0x222fc6=_0x145350['body'][_0xf6b3('0x30')];return getAgent(_0x222fc6)[_0xf6b3('0x16')](function(_0x452615){logger[_0xf6b3('0x10')]('entityFound:',_0x452615['name']);emit(util[_0xf6b3('0x2b')]('user:%s',_0x452615['name']),_0xf6b3('0x40'));return _0x4ac66b[_0xf6b3('0x15')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0xf6b3('0x2d')](handleError(_0x4ac66b));};exports[_0xf6b3('0x41')]=function(_0x1398a5,_0xb59ea8){logger[_0xf6b3('0x10')](_0xf6b3('0x42'),_0x1398a5[_0xf6b3('0x27')]);var _0x4f918f=transferValidation[_0xf6b3('0x28')](_0x1398a5[_0xf6b3('0x27')]);if(_0x4f918f[_0xf6b3('0x22')]>0x0){return _0xb59ea8[_0xf6b3('0x15')](0x190)[_0xf6b3('0x29')](_0x4f918f);}var _0x49a836=_0x1398a5['body']['userId'];var _0x48d8c1=_0x1398a5[_0xf6b3('0x27')][_0xf6b3('0x37')];var _0x4968fa=_0x1398a5[_0xf6b3('0x27')]['transferNumber'];return getAgent(_0x49a836)[_0xf6b3('0x16')](function(_0x2903a6){logger[_0xf6b3('0x10')](_0xf6b3('0x2a'),_0x2903a6['name']);emit(util[_0xf6b3('0x2b')](_0xf6b3('0x33'),_0x2903a6[_0xf6b3('0x13')]),'webbar:transfer',{'sessionId':_0x48d8c1,'transferNumber':_0x4968fa});return _0xb59ea8[_0xf6b3('0x15')](0xc8)[_0xf6b3('0x29')]({'error':![],'message':_0xf6b3('0x43')});})[_0xf6b3('0x2d')](handleError(_0xb59ea8));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 5573c0e..4b5fa5a 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 _0x392b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','/describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express'];(function(_0x5b02f1,_0x498631){var _0x584317=function(_0x50c507){while(--_0x50c507){_0x5b02f1['push'](_0x5b02f1['shift']());}};_0x584317(++_0x498631);}(_0x392b,0x1e6));var _0xb392=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x392b[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xb392('0x0'));var path=require(_0xb392('0x1'));var timeout=require(_0xb392('0x2'));var express=require(_0xb392('0x3'));var router=express[_0xb392('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb392('0x5'));var interaction=require(_0xb392('0x6'));var config=require(_0xb392('0x7'));var controller=require(_0xb392('0x8'));router['get']('/',auth[_0xb392('0x9')](),controller['index']);router['get'](_0xb392('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xb392('0xb')](_0xb392('0xc'),auth[_0xb392('0x9')](),controller[_0xb392('0xd')]);router[_0xb392('0xb')](_0xb392('0xe'),auth[_0xb392('0x9')](),controller[_0xb392('0xf')]);router['get'](_0xb392('0x10'),auth[_0xb392('0x9')](),controller['getAnswers']);router[_0xb392('0xb')](_0xb392('0x11'),auth[_0xb392('0x9')](),controller[_0xb392('0x12')]);router[_0xb392('0xb')](_0xb392('0x13'),auth['isAuthenticated'](),controller[_0xb392('0x14')]);router[_0xb392('0x15')]('/',auth[_0xb392('0x9')](),controller['create']);router[_0xb392('0x15')](_0xb392('0xe'),auth['isAuthenticated'](),controller[_0xb392('0x16')]);router['post'](_0xb392('0x10'),auth[_0xb392('0x9')](),controller[_0xb392('0x17')]);router['post'](_0xb392('0x11'),auth[_0xb392('0x9')](),controller[_0xb392('0x18')]);router[_0xb392('0x15')](_0xb392('0x13'),auth[_0xb392('0x9')](),controller['addApplications']);router['post']('/:id/notify',controller[_0xb392('0x19')]);router[_0xb392('0x15')](_0xb392('0x1a'),auth['isAuthenticated'](),controller[_0xb392('0x1b')]);router[_0xb392('0x1c')](_0xb392('0xc'),auth[_0xb392('0x9')](),controller[_0xb392('0x1d')]);router[_0xb392('0x1e')](_0xb392('0xc'),auth[_0xb392('0x9')](),controller[_0xb392('0x1f')]);router[_0xb392('0x1e')](_0xb392('0xe'),auth[_0xb392('0x9')](),controller[_0xb392('0x20')]);router[_0xb392('0x1e')](_0xb392('0x10'),auth[_0xb392('0x9')](),controller[_0xb392('0x21')]);router['delete'](_0xb392('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb392('0x22')]=router; \ No newline at end of file +var _0x1bb3=['getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users'];(function(_0x314672,_0x370d21){var _0xae423c=function(_0xf91275){while(--_0xf91275){_0x314672['push'](_0x314672['shift']());}};_0xae423c(++_0x370d21);}(_0x1bb3,0xa5));var _0x31bb=function(_0x569e95,_0x41785b){_0x569e95=_0x569e95-0x0;var _0x30fa10=_0x1bb3[_0x569e95];return _0x30fa10;};'use strict';var multer=require(_0x31bb('0x0'));var util=require(_0x31bb('0x1'));var path=require('path');var timeout=require(_0x31bb('0x2'));var express=require('express');var router=express[_0x31bb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x31bb('0x4'));var config=require(_0x31bb('0x5'));var controller=require(_0x31bb('0x6'));router[_0x31bb('0x7')]('/',auth[_0x31bb('0x8')](),controller[_0x31bb('0x9')]);router[_0x31bb('0x7')]('/describe',auth[_0x31bb('0x8')](),controller[_0x31bb('0xa')]);router[_0x31bb('0x7')]('/:id',auth[_0x31bb('0x8')](),controller[_0x31bb('0xb')]);router['get'](_0x31bb('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x31bb('0x7')](_0x31bb('0xd'),auth[_0x31bb('0x8')](),controller['getAnswers']);router['get'](_0x31bb('0xe'),auth[_0x31bb('0x8')](),controller[_0x31bb('0xf')]);router[_0x31bb('0x7')](_0x31bb('0x10'),auth['isAuthenticated'](),controller[_0x31bb('0x11')]);router[_0x31bb('0x12')]('/',auth[_0x31bb('0x8')](),controller[_0x31bb('0x13')]);router[_0x31bb('0x12')](_0x31bb('0xc'),auth[_0x31bb('0x8')](),controller[_0x31bb('0x14')]);router['post'](_0x31bb('0xd'),auth[_0x31bb('0x8')](),controller[_0x31bb('0x15')]);router[_0x31bb('0x12')](_0x31bb('0xe'),auth[_0x31bb('0x8')](),controller[_0x31bb('0x16')]);router['post'](_0x31bb('0x10'),auth[_0x31bb('0x8')](),controller[_0x31bb('0x17')]);router[_0x31bb('0x12')](_0x31bb('0x18'),controller[_0x31bb('0x19')]);router[_0x31bb('0x12')](_0x31bb('0x1a'),auth[_0x31bb('0x8')](),controller[_0x31bb('0x1b')]);router[_0x31bb('0x1c')](_0x31bb('0x1d'),auth[_0x31bb('0x8')](),controller[_0x31bb('0x1e')]);router[_0x31bb('0x1f')](_0x31bb('0x1d'),auth[_0x31bb('0x8')](),controller[_0x31bb('0x20')]);router[_0x31bb('0x1f')]('/:id/dispositions',auth[_0x31bb('0x8')](),controller[_0x31bb('0x21')]);router[_0x31bb('0x1f')](_0x31bb('0xd'),auth[_0x31bb('0x8')](),controller[_0x31bb('0x22')]);router['delete']('/:id/users',auth[_0x31bb('0x8')](),controller[_0x31bb('0x23')]);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 7674e4a..2582577 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 _0xbbea=['ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate'];(function(_0x3109b1,_0xbfa978){var _0x38dfd2=function(_0x519813){while(--_0x519813){_0x3109b1['push'](_0x3109b1['shift']());}};_0x38dfd2(++_0xbfa978);}(_0xbbea,0xda));var _0xabbe=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbbea[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xabbe('0x0'));var rs=require(_0xabbe('0x1'));module[_0xabbe('0x2')]={'name':{'type':Sequelize[_0xabbe('0x3')],'unique':_0xabbe('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xabbe('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xabbe('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xabbe('0x3')],'defaultValue':function(){return rs[_0xabbe('0x5')]();}},'phone':{'type':Sequelize[_0xabbe('0x3')]},'type':{'type':Sequelize[_0xabbe('0x6')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0xabbe('0x3')]},'baseUrl':{'type':Sequelize[_0xabbe('0x3')]},'authToken':{'type':Sequelize[_0xabbe('0x3')]},'notificationTemplate':{'type':Sequelize[_0xabbe('0x7')],'defaultValue':function(){return _0xabbe('0x8');}},'notificationSound':{'type':Sequelize[_0xabbe('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xabbe('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xabbe('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xabbe('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xabbe('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xabbe('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xabbe('0xa')],'comment':_0xabbe('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xabbe('0x9')],'defaultValue':![],'comment':_0xabbe('0xc'),'set':function(_0x356133){if(!_0x356133){this[_0xabbe('0xd')](_0xabbe('0xe'),null);}this[_0xabbe('0xd')](_0xabbe('0xf'),_0x356133);}},'description':{'type':Sequelize[_0xabbe('0x3')]}}; \ No newline at end of file +var _0xc104=['generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name'];(function(_0x29716b,_0x510662){var _0x137daa=function(_0x258bad){while(--_0x258bad){_0x29716b['push'](_0x29716b['shift']());}};_0x137daa(++_0x510662);}(_0xc104,0x17b));var _0x4c10=function(_0x1f98e4,_0x48bb7d){_0x1f98e4=_0x1f98e4-0x0;var _0x2838e1=_0xc104[_0x1f98e4];return _0x2838e1;};'use strict';var Sequelize=require(_0x4c10('0x0'));var rs=require(_0x4c10('0x1'));module[_0x4c10('0x2')]={'name':{'type':Sequelize[_0x4c10('0x3')],'unique':_0x4c10('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x4c10('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x4c10('0x3')],'defaultValue':function(){return rs[_0x4c10('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4c10('0x6')](_0x4c10('0x7'),_0x4c10('0x8'))},'accountSid':{'type':Sequelize[_0x4c10('0x3')]},'baseUrl':{'type':Sequelize[_0x4c10('0x3')]},'authToken':{'type':Sequelize[_0x4c10('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4c10('0x9')],'defaultValue':function(){return _0x4c10('0xa');}},'notificationSound':{'type':Sequelize[_0x4c10('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4c10('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4c10('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4c10('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4c10('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c10('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4c10('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4c10('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4c10('0xb')],'defaultValue':![],'comment':_0x4c10('0xd'),'set':function(_0x388a5c){if(!_0x388a5c){this[_0x4c10('0xe')](_0x4c10('0xf'),null);}this[_0x4c10('0xe')]('mandatoryDisposition',_0x388a5c);}},'description':{'type':Sequelize[_0x4c10('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index b1b298f..19067ab 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 _0x26e4=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','CmContact','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','info','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','List','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','pick','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','sendStatus','send','getApplications','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','applications','orderBy','Applications','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','from','From','whatsapp:','Body','messageId','MessageSid','notifications','isNil','Sequelize','from\x20is\x20mandatory'];(function(_0x1c2142,_0x35e016){var _0x10c2a7=function(_0xde4dfc){while(--_0xde4dfc){_0x1c2142['push'](_0x1c2142['shift']());}};_0x10c2a7(++_0x35e016);}(_0x26e4,0xec));var _0x426e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x26e4[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x426e('0x0'));var zipdir=require(_0x426e('0x1'));var jsonpatch=require(_0x426e('0x2'));var rp=require(_0x426e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x426e('0x4'));var util=require(_0x426e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x426e('0x6'));var ejs=require(_0x426e('0x7'));var fs=require('fs');var fs_extra=require(_0x426e('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x426e('0x9'));var deskjs=require(_0x426e('0xa'));var toCsv=require(_0x426e('0x6'));var querystring=require(_0x426e('0xb'));var Papa=require('papaparse');var Redis=require(_0x426e('0xc'));var authService=require(_0x426e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x426e('0xe'));var hardwareService=require(_0x426e('0xf'));var logger=require(_0x426e('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x426e('0x11'));var db=require(_0x426e('0x12'))['db'];config[_0x426e('0x13')]=_[_0x426e('0x14')](config[_0x426e('0x13')],{'host':_0x426e('0x15'),'port':0x18eb});var socket=require(_0x426e('0x16'))(new Redis(config[_0x426e('0x13')]));require(_0x426e('0x17'))[_0x426e('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x426e('0x19')][_0x426e('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0xdca847,_0x5f0c56,_0x263a6e,_0x5e5a15){return new BPromise(function(_0x2981d6,_0x4ea621){var _0x1e9e38=_0x5e5a15||client;return _0x1e9e38[_0x426e('0x1b')](_0xdca847,_0x263a6e)[_0x426e('0x1c')](function(_0x3c4e36){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5f0c56,_0x426e('0x1d'));logger['debug'](_0x426e('0x1e'),_0x5f0c56,_0x426e('0x1d'),JSON[_0x426e('0x1f')](_0x3c4e36));if(_0x3c4e36['error']){if(_0x3c4e36[_0x426e('0x20')][_0x426e('0x21')]===0x1f4){logger[_0x426e('0x20')](_0x426e('0x22'),_0x5f0c56,_0x3c4e36[_0x426e('0x20')][_0x426e('0x23')]);return _0x4ea621(_0x3c4e36['error'][_0x426e('0x23')]);}logger[_0x426e('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x5f0c56,_0x3c4e36[_0x426e('0x20')]['message']);return _0x2981d6(_0x3c4e36[_0x426e('0x20')][_0x426e('0x23')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5f0c56,'request\x20sent');_0x2981d6(_0x3c4e36[_0x426e('0x24')][_0x426e('0x23')]);}})['catch'](function(_0x280973){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5f0c56,_0x280973);_0x4ea621(_0x280973);});});}function respondWithStatusCode(_0x4f9ad1,_0x28cac6){_0x28cac6=_0x28cac6||0xcc;return function(_0x450fc8){if(_0x450fc8){return _0x4f9ad1['sendStatus'](_0x28cac6);}return _0x4f9ad1[_0x426e('0x25')](_0x28cac6)['end']();};}function respondWithResult(_0x5083ca,_0x191d4a){_0x191d4a=_0x191d4a||0xc8;return function(_0x45c60c){if(_0x45c60c){return _0x5083ca['status'](_0x191d4a)[_0x426e('0x26')](_0x45c60c);}};}function respondWithFilteredResult(_0x5d6252,_0x380962){return function(_0x91fde4){if(_0x91fde4){var _0x50c510=typeof _0x380962['offset']==='undefined'&&typeof _0x380962[_0x426e('0x27')]==='undefined';var _0x19037c=_0x91fde4[_0x426e('0x28')];var _0x293bcf=_0x50c510?0x0:_0x380962[_0x426e('0x29')];var _0x56b09a=_0x50c510?_0x91fde4[_0x426e('0x28')]:_0x380962[_0x426e('0x29')]+_0x380962[_0x426e('0x27')];var _0xa14e20;if(_0x56b09a>=_0x19037c){_0x56b09a=_0x19037c;_0xa14e20=0xc8;}else{_0xa14e20=0xce;}_0x5d6252[_0x426e('0x25')](_0xa14e20);return _0x5d6252[_0x426e('0x2a')](_0x426e('0x2b'),_0x293bcf+'-'+_0x56b09a+'/'+_0x19037c)['json'](_0x91fde4);}return null;};}function patchUpdates(_0x3c5592){return function(_0x31bb67){try{jsonpatch[_0x426e('0x2c')](_0x31bb67,_0x3c5592,!![]);}catch(_0x4b4ce6){return BPromise[_0x426e('0x2d')](_0x4b4ce6);}return _0x31bb67[_0x426e('0x2e')]();};}function saveUpdates(_0x386688,_0xf9fb0){return function(_0x41cfaa){if(_0x41cfaa){return _0x41cfaa[_0x426e('0x2f')](_0x386688)[_0x426e('0x1c')](function(_0x3a72c4){return _0x3a72c4;});}return null;};}function removeEntity(_0x5e96e6,_0x38242a){return function(_0x5ab2f9){if(_0x5ab2f9){return _0x5ab2f9[_0x426e('0x30')]()[_0x426e('0x1c')](function(){var _0x208229=_0x5ab2f9[_0x426e('0x31')]({'plain':!![]});var _0x218cab=_0x426e('0x32');return db[_0x426e('0x33')][_0x426e('0x30')]({'where':{'type':_0x218cab,'resourceId':_0x208229['id']}})['then'](function(){return _0x5ab2f9;});})[_0x426e('0x1c')](function(){_0x5e96e6[_0x426e('0x25')](0xcc)[_0x426e('0x34')]();});}};}function handleEntityNotFound(_0x4d8e59,_0x592027){return function(_0x4fe3bf){if(!_0x4fe3bf){_0x4d8e59['sendStatus'](0x194);}return _0x4fe3bf;};}function handleError(_0x47f864,_0x298629){_0x298629=_0x298629||0x1f4;return function(_0x102777){logger[_0x426e('0x20')](_0x102777['stack']);if(_0x102777['name']){delete _0x102777['name'];}_0x47f864[_0x426e('0x25')](_0x298629)['send'](_0x102777);};}exports[_0x426e('0x35')]=function(_0x1d77c8,_0x1c243a){var _0x4aacb6={'include':[{'model':db[_0x426e('0x36')],'as':_0x426e('0x37')}]},_0x93faef={},_0x24f108={'count':0x0,'rows':[]};var _0x598dd5=_[_0x426e('0x38')](db['WhatsappAccount'][_0x426e('0x39')],function(_0x3cdf0e){return{'name':_0x3cdf0e[_0x426e('0x3a')],'type':_0x3cdf0e[_0x426e('0x3b')]['key']};});_0x93faef[_0x426e('0x3c')]=_[_0x426e('0x38')](_0x598dd5,_0x426e('0x3d'));_0x93faef[_0x426e('0x3e')]=_[_0x426e('0x3f')](_0x1d77c8[_0x426e('0x3e')]);_0x93faef[_0x426e('0x40')]=_[_0x426e('0x41')](_0x93faef['model'],_0x93faef[_0x426e('0x3e')]);_0x4aacb6['attributes']=_[_0x426e('0x41')](_0x93faef[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x1d77c8['query'][_0x426e('0x42')]));_0x4aacb6['attributes']=_0x4aacb6[_0x426e('0x43')][_0x426e('0x44')]?_0x4aacb6[_0x426e('0x43')]:_0x93faef[_0x426e('0x3c')];if(!_0x1d77c8[_0x426e('0x3e')][_0x426e('0x45')](_0x426e('0x46'))){_0x4aacb6[_0x426e('0x27')]=qs[_0x426e('0x27')](_0x1d77c8['query'][_0x426e('0x27')]);_0x4aacb6['offset']=qs[_0x426e('0x29')](_0x1d77c8[_0x426e('0x3e')]['offset']);}_0x4aacb6[_0x426e('0x47')]=qs[_0x426e('0x48')](_0x1d77c8[_0x426e('0x3e')][_0x426e('0x48')]);_0x4aacb6[_0x426e('0x49')]=qs['filters'](_['pick'](_0x1d77c8['query'],_0x93faef[_0x426e('0x40')]),_0x598dd5);if(_0x1d77c8[_0x426e('0x3e')][_0x426e('0x4a')]){_0x4aacb6[_0x426e('0x49')]=_[_0x426e('0x4b')](_0x4aacb6[_0x426e('0x49')],{'$or':_[_0x426e('0x38')](_0x598dd5,function(_0x19df4c){if(_0x19df4c[_0x426e('0x3b')]!==_0x426e('0x4c')){var _0x967139={};_0x967139[_0x19df4c[_0x426e('0x3d')]]={'$like':'%'+_0x1d77c8[_0x426e('0x3e')]['filter']+'%'};return _0x967139;}})});}_0x4aacb6=_[_0x426e('0x4b')]({},_0x4aacb6,_0x1d77c8[_0x426e('0x4d')]);var _0x2e193f={'where':_0x4aacb6[_0x426e('0x49')]};return db[_0x426e('0x4e')][_0x426e('0x28')](_0x2e193f)[_0x426e('0x1c')](function(_0x22c152){_0x24f108[_0x426e('0x28')]=_0x22c152;if(_0x1d77c8['query'][_0x426e('0x4f')]){_0x4aacb6[_0x426e('0x50')]=[{'all':!![]}];}return db[_0x426e('0x4e')][_0x426e('0x51')](_0x4aacb6);})[_0x426e('0x1c')](function(_0xbc741e){_0x24f108[_0x426e('0x52')]=_0xbc741e;return _0x24f108;})[_0x426e('0x1c')](respondWithFilteredResult(_0x1c243a,_0x4aacb6))[_0x426e('0x53')](handleError(_0x1c243a,null));};exports[_0x426e('0x54')]=function(_0x30794e,_0x2ff1e3){var _0x57ca3b={'raw':![],'where':{'id':_0x30794e['params']['id']},'include':[{'model':db[_0x426e('0x36')],'as':'mandatoryDispositionPause'}]},_0x49bdc7={};_0x49bdc7[_0x426e('0x3c')]=_[_0x426e('0x3f')](db[_0x426e('0x4e')][_0x426e('0x39')]);_0x49bdc7['query']=_[_0x426e('0x3f')](_0x30794e['query']);_0x49bdc7['filters']=_[_0x426e('0x41')](_0x49bdc7[_0x426e('0x3c')],_0x49bdc7[_0x426e('0x3e')]);_0x57ca3b['attributes']=_[_0x426e('0x41')](_0x49bdc7[_0x426e('0x3c')],qs['fields'](_0x30794e[_0x426e('0x3e')][_0x426e('0x42')]));_0x57ca3b['attributes']=_0x57ca3b[_0x426e('0x43')][_0x426e('0x44')]?_0x57ca3b['attributes']:_0x49bdc7[_0x426e('0x3c')];if(_0x30794e[_0x426e('0x3e')][_0x426e('0x4f')]){_0x57ca3b[_0x426e('0x50')]=[{'all':!![]}];}_0x57ca3b=_[_0x426e('0x4b')]({},_0x57ca3b,_0x30794e[_0x426e('0x4d')]);return db['WhatsappAccount'][_0x426e('0x55')](_0x57ca3b)[_0x426e('0x1c')](handleEntityNotFound(_0x2ff1e3,null))['then'](respondWithResult(_0x2ff1e3,null))[_0x426e('0x53')](handleError(_0x2ff1e3,null));};exports[_0x426e('0x56')]=function(_0x2ad931,_0x1b220d){return db[_0x426e('0x4e')][_0x426e('0x56')](_0x2ad931['body'],{})[_0x426e('0x1c')](function(_0x290474){var _0x8fd615=_0x2ad931[_0x426e('0x57')][_0x426e('0x31')]({'plain':!![]});if(!_0x8fd615)throw new Error(_0x426e('0x58'));if(_0x8fd615[_0x426e('0x59')]==='user'){var _0x1ecfe5=_0x290474['get']({'plain':!![]});var _0x18284c=_0x426e('0x32');return db[_0x426e('0x5a')][_0x426e('0x55')]({'where':{'name':_0x18284c,'userProfileId':_0x8fd615['userProfileId']},'raw':!![]})['then'](function(_0x33d0ef){if(_0x33d0ef&&_0x33d0ef['autoAssociation']===0x0){return db[_0x426e('0x33')][_0x426e('0x56')]({'name':_0x1ecfe5['name'],'resourceId':_0x1ecfe5['id'],'type':_0x33d0ef['name'],'sectionId':_0x33d0ef['id']},{})[_0x426e('0x1c')](function(){return _0x290474;});}else{return _0x290474;}})[_0x426e('0x53')](function(_0x4a669d){logger[_0x426e('0x20')](_0x426e('0x5b'),_0x4a669d);throw _0x4a669d;});}return _0x290474;})[_0x426e('0x1c')](respondWithResult(_0x1b220d,0xc9))[_0x426e('0x53')](handleError(_0x1b220d,null));};exports['update']=function(_0x4b0257,_0x2c7061){if(_0x4b0257[_0x426e('0x5c')]['id']){delete _0x4b0257['body']['id'];}return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x4b0257['params']['id']},'include':[{'model':db[_0x426e('0x36')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2c7061,null))[_0x426e('0x1c')](saveUpdates(_0x4b0257[_0x426e('0x5c')],null))['then'](respondWithResult(_0x2c7061,null))[_0x426e('0x53')](handleError(_0x2c7061,null));};exports['destroy']=function(_0x431129,_0x25b0a1){return db['WhatsappAccount'][_0x426e('0x55')]({'where':{'id':_0x431129[_0x426e('0x5d')]['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x25b0a1,null))[_0x426e('0x1c')](removeEntity(_0x25b0a1,null))[_0x426e('0x53')](handleError(_0x25b0a1,null));};exports['describe']=function(_0x361c90,_0x5b8388){return db['WhatsappAccount'][_0x426e('0x5e')]()['then'](respondWithResult(_0x5b8388,null))['catch'](handleError(_0x5b8388,null));};exports[_0x426e('0x5f')]=function(_0x2c31b7,_0x90f53a,_0x5c8bad){if(_0x2c31b7[_0x426e('0x5c')]['id']){delete _0x2c31b7[_0x426e('0x5c')]['id'];}return db['WhatsappAccount'][_0x426e('0x55')]({'where':{'id':_0x2c31b7[_0x426e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x90f53a,null))[_0x426e('0x1c')](function(_0x141a74){if(_0x141a74){_0x2c31b7[_0x426e('0x5c')][_0x426e('0x60')]=_0x141a74['id'];return db[_0x426e('0x61')]['create'](_0x2c31b7[_0x426e('0x5c')]);}})[_0x426e('0x1c')](respondWithResult(_0x90f53a,null))[_0x426e('0x53')](handleError(_0x90f53a,null));};exports[_0x426e('0x62')]=function(_0x4ed96c,_0x4ec18c,_0x4c5496){var _0x44c258={'raw':![],'where':{}};var _0x22ea7b={};var _0x1e9d38={'count':0x0,'rows':[]};return db[_0x426e('0x4e')][_0x426e('0x63')]({'where':{'id':_0x4ed96c[_0x426e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4ec18c,null))[_0x426e('0x1c')](function(_0x596065){if(_0x596065){_0x22ea7b[_0x426e('0x3c')]=_[_0x426e('0x3f')](db['Disposition'][_0x426e('0x39')]);_0x22ea7b[_0x426e('0x3e')]=_[_0x426e('0x3f')](_0x4ed96c['query']);_0x22ea7b[_0x426e('0x40')]=_['intersection'](_0x22ea7b['model'],_0x22ea7b[_0x426e('0x3e')]);_0x44c258[_0x426e('0x43')]=_[_0x426e('0x41')](_0x22ea7b[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x4ed96c[_0x426e('0x3e')][_0x426e('0x42')]));_0x44c258[_0x426e('0x43')]=_0x44c258[_0x426e('0x43')][_0x426e('0x44')]?_0x44c258[_0x426e('0x43')]:_0x22ea7b[_0x426e('0x3c')];if(!_0x4ed96c['query'][_0x426e('0x45')]('nolimit')){_0x44c258[_0x426e('0x27')]=qs[_0x426e('0x27')](_0x4ed96c[_0x426e('0x3e')][_0x426e('0x27')]);_0x44c258[_0x426e('0x29')]=qs[_0x426e('0x29')](_0x4ed96c[_0x426e('0x3e')]['offset']);}_0x44c258[_0x426e('0x47')]=qs['sort'](_0x4ed96c[_0x426e('0x3e')]['sort']);_0x44c258[_0x426e('0x49')]=qs[_0x426e('0x40')](_['pick'](_0x4ed96c[_0x426e('0x3e')],_0x22ea7b[_0x426e('0x40')]));_0x44c258['where'][_0x426e('0x60')]=_0x596065['id'];if(_0x4ed96c[_0x426e('0x3e')][_0x426e('0x4a')]){_0x44c258[_0x426e('0x49')]=_[_0x426e('0x4b')](_0x44c258[_0x426e('0x49')],{'$or':_[_0x426e('0x38')](_0x44c258[_0x426e('0x43')],function(_0x29fe7c){var _0x2fc34a={};_0x2fc34a[_0x29fe7c]={'$like':'%'+_0x4ed96c[_0x426e('0x3e')][_0x426e('0x4a')]+'%'};return _0x2fc34a;})});}_0x44c258=_[_0x426e('0x4b')]({},_0x44c258,_0x4ed96c[_0x426e('0x4d')]);return db[_0x426e('0x61')][_0x426e('0x28')]({'where':_0x44c258['where']})[_0x426e('0x1c')](function(_0x1be878){_0x1e9d38[_0x426e('0x28')]=_0x1be878;if(_0x4ed96c[_0x426e('0x3e')]['includeAll']){_0x44c258[_0x426e('0x50')]=[{'all':!![]}];}return db[_0x426e('0x61')]['findAll'](_0x44c258);})[_0x426e('0x1c')](function(_0x46bf7c){_0x1e9d38[_0x426e('0x52')]=_0x46bf7c;return _0x1e9d38;});}})[_0x426e('0x1c')](respondWithFilteredResult(_0x4ec18c,_0x44c258))[_0x426e('0x53')](handleError(_0x4ec18c,null));};exports[_0x426e('0x64')]=function(_0x269b34,_0x44caa5,_0x206d10){return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x269b34[_0x426e('0x5d')]['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x44caa5,null))[_0x426e('0x1c')](function(_0x3d4eed){if(_0x3d4eed){return _0x3d4eed[_0x426e('0x64')](_0x269b34[_0x426e('0x3e')][_0x426e('0x65')]);}})['then'](respondWithStatusCode(_0x44caa5,null))['catch'](handleError(_0x44caa5,null));};exports[_0x426e('0x66')]=function(_0x49a1bd,_0x533335,_0x3d80eb){if(_0x49a1bd[_0x426e('0x5c')]['id']){delete _0x49a1bd['body']['id'];}return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x49a1bd['params']['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x533335,null))[_0x426e('0x1c')](function(_0x29f1a9){if(_0x29f1a9){_0x49a1bd[_0x426e('0x5c')]['WhatsappAccountId']=_0x29f1a9['id'];return db['CannedAnswer']['create'](_0x49a1bd[_0x426e('0x5c')]);}})[_0x426e('0x1c')](respondWithResult(_0x533335,null))[_0x426e('0x53')](handleError(_0x533335,null));};exports[_0x426e('0x67')]=function(_0x3017a8,_0x2a3842,_0x1ceec4){var _0x3244d4={'raw':![],'where':{}};var _0x7b12eb={};var _0x57c2b5={'count':0x0,'rows':[]};return db[_0x426e('0x4e')][_0x426e('0x63')]({'where':{'id':_0x3017a8[_0x426e('0x5d')]['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x2a3842,null))['then'](function(_0x1becec){if(_0x1becec){_0x7b12eb[_0x426e('0x3c')]=_[_0x426e('0x3f')](db[_0x426e('0x68')]['rawAttributes']);_0x7b12eb[_0x426e('0x3e')]=_['keys'](_0x3017a8[_0x426e('0x3e')]);_0x7b12eb['filters']=_[_0x426e('0x41')](_0x7b12eb[_0x426e('0x3c')],_0x7b12eb[_0x426e('0x3e')]);_0x3244d4['attributes']=_[_0x426e('0x41')](_0x7b12eb[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x3017a8['query'][_0x426e('0x42')]));_0x3244d4[_0x426e('0x43')]=_0x3244d4[_0x426e('0x43')][_0x426e('0x44')]?_0x3244d4[_0x426e('0x43')]:_0x7b12eb['model'];if(!_0x3017a8['query']['hasOwnProperty'](_0x426e('0x46'))){_0x3244d4['limit']=qs['limit'](_0x3017a8[_0x426e('0x3e')][_0x426e('0x27')]);_0x3244d4[_0x426e('0x29')]=qs['offset'](_0x3017a8['query']['offset']);}_0x3244d4[_0x426e('0x47')]=qs[_0x426e('0x48')](_0x3017a8[_0x426e('0x3e')][_0x426e('0x48')]);_0x3244d4['where']=qs['filters'](_[_0x426e('0x69')](_0x3017a8[_0x426e('0x3e')],_0x7b12eb['filters']));_0x3244d4[_0x426e('0x49')][_0x426e('0x60')]=_0x1becec['id'];if(_0x3017a8[_0x426e('0x3e')][_0x426e('0x4a')]){_0x3244d4[_0x426e('0x49')]=_[_0x426e('0x4b')](_0x3244d4[_0x426e('0x49')],{'$or':_[_0x426e('0x38')](_0x3244d4[_0x426e('0x43')],function(_0x39f637){var _0x445fee={};_0x445fee[_0x39f637]={'$like':'%'+_0x3017a8[_0x426e('0x3e')][_0x426e('0x4a')]+'%'};return _0x445fee;})});}_0x3244d4=_[_0x426e('0x4b')]({},_0x3244d4,_0x3017a8[_0x426e('0x4d')]);return db[_0x426e('0x68')][_0x426e('0x28')]({'where':_0x3244d4[_0x426e('0x49')]})[_0x426e('0x1c')](function(_0x5e47de){_0x57c2b5[_0x426e('0x28')]=_0x5e47de;if(_0x3017a8[_0x426e('0x3e')]['includeAll']){_0x3244d4[_0x426e('0x50')]=[{'all':!![]}];}return db[_0x426e('0x68')][_0x426e('0x51')](_0x3244d4);})[_0x426e('0x1c')](function(_0x39a95f){_0x57c2b5['rows']=_0x39a95f;return _0x57c2b5;});}})[_0x426e('0x1c')](respondWithFilteredResult(_0x2a3842,_0x3244d4))[_0x426e('0x53')](handleError(_0x2a3842,null));};exports[_0x426e('0x6a')]=function(_0x24ad23,_0x4c92e6,_0x95d306){return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x24ad23['params']['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x4c92e6,null))[_0x426e('0x1c')](function(_0x439b93){if(_0x439b93){return _0x439b93[_0x426e('0x6a')](_0x24ad23[_0x426e('0x3e')]['ids']);}})[_0x426e('0x1c')](respondWithStatusCode(_0x4c92e6,null))['catch'](handleError(_0x4c92e6,null));};exports[_0x426e('0x6b')]=function(_0x42da22,_0x27bd2f,_0x32f2b6){return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x42da22['params']['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x27bd2f,null))[_0x426e('0x1c')](function(_0x477422){if(_0x477422){return _0x477422[_0x426e('0x6b')](_0x42da22[_0x426e('0x5c')][_0x426e('0x65')],_['omit'](_0x42da22['body'],[_0x426e('0x65'),'id'])||{})['spread'](function(_0x799034){for(var _0x18c897=0x0;_0x18c897<_0x42da22[_0x426e('0x5c')]['ids'][_0x426e('0x44')];_0x18c897+=0x1){socket[_0x426e('0x6c')](_0x426e('0x6d'),{'UserId':Number(_0x42da22['body'][_0x426e('0x65')][_0x18c897]),'WhatsappAccountId':Number(_0x42da22[_0x426e('0x5d')]['id'])});}return _0x799034;});}})[_0x426e('0x1c')](respondWithResult(_0x27bd2f,null))[_0x426e('0x53')](handleError(_0x27bd2f,null));};exports[_0x426e('0x6e')]=function(_0x5c1d0f,_0xfc31ff,_0x7cd679){return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x5c1d0f[_0x426e('0x5d')]['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0xfc31ff,null))[_0x426e('0x1c')](function(_0x3c9fec){if(_0x3c9fec){return _0x3c9fec[_0x426e('0x6e')](_0x5c1d0f[_0x426e('0x3e')][_0x426e('0x65')])['then'](function(){if(_[_0x426e('0x6f')](_0x5c1d0f[_0x426e('0x3e')][_0x426e('0x65')])){for(var _0x539d75=0x0;_0x539d75<_0x5c1d0f[_0x426e('0x3e')][_0x426e('0x65')][_0x426e('0x44')];_0x539d75+=0x1){socket[_0x426e('0x6c')]('userWhatsappAccount:remove',{'UserId':Number(_0x5c1d0f['query']['ids'][_0x539d75]),'WhatsappAccountId':Number(_0x5c1d0f[_0x426e('0x5d')]['id'])});}}else{socket['emit'](_0x426e('0x70'),{'UserId':Number(_0x5c1d0f[_0x426e('0x3e')][_0x426e('0x65')]),'WhatsappAccountId':Number(_0x5c1d0f['params']['id'])});}});}})[_0x426e('0x1c')](respondWithStatusCode(_0xfc31ff,null))[_0x426e('0x53')](handleError(_0xfc31ff,null));};exports[_0x426e('0x71')]=function(_0x35f1da,_0x18bfd9,_0x3519af){var _0x2c09b7={};var _0x5a954d={};var _0x19db0f;var _0xe6e654;return db[_0x426e('0x4e')][_0x426e('0x63')]({'where':{'id':_0x35f1da[_0x426e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x18bfd9,null))[_0x426e('0x1c')](function(_0x108274){if(_0x108274){_0x19db0f=_0x108274;_0x5a954d[_0x426e('0x3c')]=_['keys'](db[_0x426e('0x72')][_0x426e('0x39')]);_0x5a954d[_0x426e('0x3e')]=_[_0x426e('0x3f')](_0x35f1da[_0x426e('0x3e')]);_0x5a954d[_0x426e('0x40')]=_[_0x426e('0x41')](_0x5a954d[_0x426e('0x3c')],_0x5a954d['query']);_0x2c09b7[_0x426e('0x43')]=_['intersection'](_0x5a954d[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x35f1da[_0x426e('0x3e')][_0x426e('0x42')]));_0x2c09b7['attributes']=_0x2c09b7['attributes']['length']?_0x2c09b7[_0x426e('0x43')]:_0x5a954d['model'];_0x2c09b7['order']=qs[_0x426e('0x48')](_0x35f1da[_0x426e('0x3e')][_0x426e('0x48')]);_0x2c09b7[_0x426e('0x49')]=qs[_0x426e('0x40')](_['pick'](_0x35f1da['query'],_0x5a954d[_0x426e('0x40')]));if(_0x35f1da['query'][_0x426e('0x4a')]){_0x2c09b7[_0x426e('0x49')]=_['merge'](_0x2c09b7[_0x426e('0x49')],{'$or':_[_0x426e('0x38')](_0x2c09b7['attributes'],function(_0x2aef22){var _0x7ea6a6={};_0x7ea6a6[_0x2aef22]={'$like':'%'+_0x35f1da[_0x426e('0x3e')][_0x426e('0x4a')]+'%'};return _0x7ea6a6;})});}_0x2c09b7=_[_0x426e('0x4b')]({},_0x2c09b7,_0x35f1da[_0x426e('0x4d')]);return _0x19db0f[_0x426e('0x71')](_0x2c09b7);}})['then'](function(_0x120be1){if(_0x120be1){_0xe6e654=_0x120be1[_0x426e('0x44')];if(!_0x35f1da[_0x426e('0x3e')]['hasOwnProperty'](_0x426e('0x46'))){_0x2c09b7[_0x426e('0x27')]=qs[_0x426e('0x27')](_0x35f1da[_0x426e('0x3e')][_0x426e('0x27')]);_0x2c09b7[_0x426e('0x29')]=qs[_0x426e('0x29')](_0x35f1da['query'][_0x426e('0x29')]);}return _0x19db0f[_0x426e('0x71')](_0x2c09b7);}})[_0x426e('0x1c')](function(_0x3f6d8d){if(_0x3f6d8d){return _0x3f6d8d?{'count':_0xe6e654,'rows':_0x3f6d8d}:null;}})[_0x426e('0x1c')](respondWithResult(_0x18bfd9,null))[_0x426e('0x53')](handleError(_0x18bfd9,null));};exports[_0x426e('0x73')]=function(_0x27a362,_0x5a8706){var _0x395aed=_0x27a362[_0x426e('0x5d')]['id'];var _0x2d95d3=_0x27a362[_0x426e('0x5c')];var _0x400602=0xc8;var _0x60198f=null;return db['sequelize'][_0x426e('0x74')]({'isolationLevel':db['sequelize'][_0x426e('0x75')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x58d797){return db[_0x426e('0x4e')][_0x426e('0x63')]({'where':{'id':_0x395aed},'transaction':_0x58d797})[_0x426e('0x1c')](function(_0x285250){if(_0x285250){return db[_0x426e('0x76')]['destroy']({'where':{'WhatsappAccountId':_0x395aed},'transaction':_0x58d797})[_0x426e('0x1c')](function(){var _0x3c9c36=_[_0x426e('0x38')](_0x2d95d3,function(_0x2a664a){_0x2a664a[_0x426e('0x60')]=_0x395aed;return _0x2a664a;});return db[_0x426e('0x76')][_0x426e('0x77')](_0x3c9c36,{'transaction':_0x58d797});});}else{_0x400602=0x194;_0x60198f=[];}});})[_0x426e('0x1c')](function(){if(_0x400602!==0x194){return db['WhatsappApplication'][_0x426e('0x78')]({'where':{'WhatsappAccountId':_0x395aed},'order':_0x426e('0x79')})[_0x426e('0x1c')](function(_0x547786){_0x60198f=_0x547786;});}})['catch'](function(_0x5ce772){_0x400602=0x1f4;logger[_0x426e('0x20')](_0x5ce772[_0x426e('0x7a')]);if(_0x5ce772['name']){delete _0x5ce772['name'];}_0x60198f=_0x5ce772;})[_0x426e('0x7b')](function(){if(_0x60198f===null){_0x5a8706[_0x426e('0x7c')](_0x400602);}else{if(_0x400602===0x1f4){_0x5a8706[_0x426e('0x25')](_0x400602)[_0x426e('0x7d')](_0x60198f);}else{_0x5a8706[_0x426e('0x25')](_0x400602)['json'](_0x60198f);}}});};exports[_0x426e('0x7e')]=function(_0x193262,_0x5558aa,_0x4df3fb){var _0x3413dd={};var _0x2b2fe2={};var _0x305836;var _0x2c0252;return db[_0x426e('0x4e')]['findOne']({'where':{'id':_0x193262['params']['id']}})['then'](handleEntityNotFound(_0x5558aa,null))['then'](function(_0x33bf5f){if(_0x33bf5f){_0x305836=_0x33bf5f;_0x2b2fe2[_0x426e('0x3c')]=_[_0x426e('0x3f')](db['WhatsappApplication'][_0x426e('0x39')]);_0x2b2fe2[_0x426e('0x3e')]=_[_0x426e('0x3f')](_0x193262['query']);_0x2b2fe2[_0x426e('0x40')]=_[_0x426e('0x41')](_0x2b2fe2[_0x426e('0x3c')],_0x2b2fe2[_0x426e('0x3e')]);_0x3413dd[_0x426e('0x43')]=_[_0x426e('0x41')](_0x2b2fe2[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x193262[_0x426e('0x3e')][_0x426e('0x42')]));_0x3413dd['attributes']=_0x3413dd[_0x426e('0x43')][_0x426e('0x44')]?_0x3413dd[_0x426e('0x43')]:_0x2b2fe2[_0x426e('0x3c')];_0x3413dd[_0x426e('0x47')]=qs[_0x426e('0x48')](_0x193262[_0x426e('0x3e')][_0x426e('0x48')]);_0x3413dd[_0x426e('0x49')]=qs['filters'](_[_0x426e('0x69')](_0x193262[_0x426e('0x3e')],_0x2b2fe2[_0x426e('0x40')]));if(_0x193262[_0x426e('0x3e')][_0x426e('0x4a')]){_0x3413dd[_0x426e('0x49')]=_[_0x426e('0x4b')](_0x3413dd['where'],{'$or':_[_0x426e('0x38')](_0x3413dd['attributes'],function(_0x2bfe8e){var _0x2168f0={};_0x2168f0[_0x2bfe8e]={'$like':'%'+_0x193262['query'][_0x426e('0x4a')]+'%'};return _0x2168f0;})});}_0x3413dd=_[_0x426e('0x4b')]({},_0x3413dd,_0x193262['options']);return _0x305836[_0x426e('0x7e')](_0x3413dd);}})[_0x426e('0x1c')](function(_0x403b93){if(_0x403b93){_0x2c0252=_0x403b93[_0x426e('0x44')];if(!_0x193262['query'][_0x426e('0x45')](_0x426e('0x46'))){_0x3413dd[_0x426e('0x27')]=qs['limit'](_0x193262[_0x426e('0x3e')][_0x426e('0x27')]);_0x3413dd[_0x426e('0x29')]=qs[_0x426e('0x29')](_0x193262['query'][_0x426e('0x29')]);}return _0x305836[_0x426e('0x7e')](_0x3413dd);}})[_0x426e('0x1c')](function(_0x21fccf){if(_0x21fccf){return _0x21fccf?{'count':_0x2c0252,'rows':_0x21fccf}:null;}})[_0x426e('0x1c')](respondWithResult(_0x5558aa,null))[_0x426e('0x53')](handleError(_0x5558aa,null));};exports['notify']=function(_0x345c57,_0x141242,_0x275a54){var _0x3c7e37={'channel':_0x426e('0x7f')};var _0x50fee5=[];var _0x38201e=[];var _0xd63a6a={};return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x345c57['params']['id']},'include':[{'model':db[_0x426e('0x76')],'as':'Applications'}]})[_0x426e('0x1c')](handleEntityNotFound(_0x141242,null))['then'](function(_0x14e123){_0x3c7e37['account']=_0x14e123;if(_0x3c7e37[_0x426e('0x80')]&&_0x3c7e37[_0x426e('0x80')][_0x426e('0x3b')]===_0x426e('0x81')&&_0x345c57[_0x426e('0x5c')][_0x426e('0x82')]){if(_0x345c57[_0x426e('0x5c')]['statuses'][_0x426e('0x44')]===0x0)return;if(_0x345c57[_0x426e('0x5c')][_0x426e('0x82')][0x0][_0x426e('0x83')]!==_0x426e('0x84'))return;return db[_0x426e('0x85')][_0x426e('0x2f')]({'read':!![],'readAt':_0x345c57[_0x426e('0x5c')][_0x426e('0x82')][0x0]['timestamp']},{'where':{'messageId':_0x345c57[_0x426e('0x5c')][_0x426e('0x82')][0x0]['message_id']},'individualHooks':!![]})[_0x426e('0x1c')](function(_0x43ea1f){return _0x141242['status'](0xc8)[_0x426e('0x26')](_0x43ea1f);});}_0x3c7e37[_0x426e('0x86')]=_[_0x426e('0x87')](_0x14e123[_0x426e('0x88')],[_0x426e('0x79')],['asc']);if(_0x3c7e37[_0x426e('0x80')][_0x426e('0x88')]){delete _0x3c7e37[_0x426e('0x80')]['Applications'];}return db['CmContact'][_0x426e('0x5e')]()[_0x426e('0x1c')](function(_0x32ea0b){if(!_0x32ea0b){throw new db['Sequelize'][(_0x426e('0x89'))](_0x426e('0x8a'));}_0x50fee5=_[_0x426e('0x8b')](_[_0x426e('0x3f')](_0x32ea0b),['createdAt',_0x426e('0x8c')]);_0x38201e=_[_0x426e('0x8b')](_[_0x426e('0x3f')](_0x32ea0b),[_0x426e('0x8d'),'updatedAt','CompanyId',_0x426e('0x8e')]);_0x3c7e37['body']={'mapKey':_0x426e('0x8f')};if(_0x3c7e37[_0x426e('0x80')]&&_0x3c7e37['account'][_0x426e('0x3b')]==='twilio'){_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')]=_0x345c57[_0x426e('0x5c')][_0x426e('0x91')]['replace'](_0x426e('0x92'),'');_0x3c7e37['body'][_0x426e('0x5c')]=_0x345c57[_0x426e('0x5c')][_0x426e('0x93')];_0x3c7e37[_0x426e('0x5c')][_0x426e('0x94')]=_0x345c57[_0x426e('0x5c')][_0x426e('0x95')];}if(_0x3c7e37[_0x426e('0x80')]&&_0x3c7e37[_0x426e('0x80')][_0x426e('0x3b')]===_0x426e('0x81')){_0x3c7e37[_0x426e('0x5c')]['from']=_0x345c57[_0x426e('0x5c')][_0x426e('0x96')][0x0][_0x426e('0x90')];_0x3c7e37['body'][_0x426e('0x5c')]=_0x345c57['body'][_0x426e('0x96')][0x0]['message'][_0x426e('0x5c')];_0x3c7e37[_0x426e('0x5c')][_0x426e('0x94')]=_0x345c57[_0x426e('0x5c')][_0x426e('0x96')][0x0]['message_id'];}if(_0x3c7e37[_0x426e('0x5c')]['id']){delete _0x3c7e37[_0x426e('0x5c')]['id'];}if(_[_0x426e('0x97')](_0x3c7e37['body'][_0x426e('0x90')])){throw new db[(_0x426e('0x98'))][(_0x426e('0x89'))](_0x426e('0x99'));}if(_[_0x426e('0x97')](_0x3c7e37[_0x426e('0x5c')]['body'])||_0x3c7e37['body'][_0x426e('0x5c')]===''){throw new db[(_0x426e('0x98'))]['ValidationError'](_0x426e('0x9a'));}if(_[_0x426e('0x97')](_0x3c7e37['body'][_0x426e('0x9b')])){throw new db[(_0x426e('0x98'))]['ValidationError'](_0x426e('0x9c')+_0x38201e);}if(!_['includes'](_0x38201e,_0x3c7e37[_0x426e('0x5c')][_0x426e('0x9b')])){throw new db[(_0x426e('0x98'))][(_0x426e('0x89'))](_0x426e('0x9d')+_0x38201e);}_0xd63a6a[_0x3c7e37[_0x426e('0x5c')][_0x426e('0x9b')]]=_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')];return db[_0x426e('0x9e')][_0x426e('0x55')]({'where':{'id':_0x3c7e37[_0x426e('0x80')][_0x426e('0x8e')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xd63a6a,'limit':0x1,'order':[['updatedAt',_0x426e('0x9f')]]}]});})['then'](handleEntityNotFound(_0x141242,null))[_0x426e('0x1c')](function(_0x46e567){if(_0x46e567){_0x3c7e37[_0x426e('0xa0')]=_[_0x426e('0xa1')](_0x46e567,['Contacts']);if(_0x46e567['Contacts']['length']){return _0x46e567[_0x426e('0xa2')][0x0];}var _0xe85f73=_[_0x426e('0x14')](_0x3c7e37[_0x426e('0x5c')],{'firstName':_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')],'ListId':_0x46e567['id']});_0xe85f73[_0x3c7e37[_0x426e('0x5c')]['mapKey']]=_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')];return db[_0x426e('0xa3')][_0x426e('0x56')](_0xe85f73,{'fields':_0x50fee5,'raw':!![]});}})[_0x426e('0x1c')](handleEntityNotFound(_0x141242,null))['then'](function(_0x1e1a63){if(_0x1e1a63){_0x3c7e37[_0x426e('0xa4')]=_0x1e1a63;var _0x421247={'ContactId':_0x1e1a63['id'],'phone':_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')],'WhatsappAccountId':_0x345c57[_0x426e('0x5d')]['id']};var _0x59d2ec={'ContactId':_0x1e1a63['id'],'WhatsappAccountId':_0x345c57[_0x426e('0x5d')]['id'],'closed':![]};return db[_0x426e('0xa5')][_0x426e('0x55')]({'where':_0x59d2ec})[_0x426e('0x1c')](function(_0x2d6168){if(_0x2d6168){return[_0x2d6168,![]];}return db[_0x426e('0xa5')][_0x426e('0x56')](_0x421247)['then'](function(_0x329b3b){return[_0x329b3b,!![]];});});}})[_0x426e('0xa6')](function(_0x3d3971,_0x4d302e){_0x3c7e37[_0x426e('0xa7')]=_0x3d3971[_0x426e('0x31')]({'plain':!![]});_0x3c7e37[_0x426e('0xa7')][_0x426e('0xa8')]=![];if(_0x4d302e){if(_0x3c7e37[_0x426e('0x80')][_0x426e('0xa9')]){_0x3c7e37[_0x426e('0x86')][_0x426e('0xaa')]({'id':0x0,'priority':_0x3c7e37[_0x426e('0x86')]['length']+0x1,'app':_0x426e('0xab'),'appdata':_0x426e('0xac'),'interval':_0x426e('0xad')});}_0x3c7e37[_0x426e('0xa7')][_0x426e('0xa8')]=!![];}return db[_0x426e('0x85')]['create']({'phone':_0x3c7e37['body'][_0x426e('0x90')],'messageId':_0x3c7e37[_0x426e('0x5c')][_0x426e('0x94')],'body':_0x3c7e37[_0x426e('0x5c')][_0x426e('0x5c')],'WhatsappAccountId':_0x345c57[_0x426e('0x5d')]['id'],'WhatsappInteractionId':_0x3d3971['id'],'direction':'in','ContactId':_0x3d3971[_0x426e('0xae')],'AttachmentId':_0x3c7e37['body'][_0x426e('0xaf')]});})[_0x426e('0x1c')](function(_0x2ddc6d){_0x3c7e37['message']=_0x2ddc6d;if(!_0x3c7e37['interaction'][_0x426e('0xb0')])return;return db[_0x426e('0x72')][_0x426e('0x55')]({'attributes':['id',_0x426e('0x3d')],'where':{'id':_0x3c7e37[_0x426e('0xa7')][_0x426e('0xb0')]}});})[_0x426e('0x1c')](function(_0x301aad){if(_0x301aad){_0x3c7e37['applications'][_0x426e('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x301aad[_0x426e('0x3d')]+','+(_0x3c7e37[_0x426e('0x80')][_0x426e('0xb2')]||0xa),'interval':_0x426e('0xad')});}if(!_0x3c7e37[_0x426e('0xa7')][_0x426e('0xb3')])return;return db['WhatsappQueue'][_0x426e('0x55')]({'attributes':['id','name'],'where':{'id':_0x3c7e37[_0x426e('0xa7')][_0x426e('0xb3')]}});})[_0x426e('0x1c')](function(_0x5b8705){if(_0x5b8705){_0x3c7e37[_0x426e('0x86')]['unshift']({'id':0x0,'priority':0x1,'app':_0x426e('0xb4'),'appdata':_0x5b8705[_0x426e('0x3d')]+','+(_0x3c7e37[_0x426e('0x80')][_0x426e('0xb5')]||0x12c),'interval':_0x426e('0xad')});}return respondWithRpcPromise(_0x426e('0xb6'),_0x426e('0xb7'),_0x3c7e37);})[_0x426e('0x1c')](function(_0x4bfb58){if(_0x4bfb58){var _0x337f1b=0xc8;var _0x356292='receiveMessage';logger[_0x426e('0xb8')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x356292,_0x337f1b,_0x426e('0xb9'));logger[_0x426e('0xba')](_0x426e('0xbb'),_0x356292,_0x337f1b,_0x426e('0xb9'),JSON[_0x426e('0x1f')](_0x4bfb58));if(_0x3c7e37[_0x426e('0x80')]['type']===_0x426e('0xbc')){return _0x141242[_0x426e('0x25')](_0x337f1b)[_0x426e('0x2a')](_0x426e('0xbd'),_0x426e('0xbe'))[_0x426e('0x7d')](_0x426e('0xbf'));}else{return _0x141242[_0x426e('0x25')](_0x337f1b)[_0x426e('0x26')](_0x4bfb58);}}});})[_0x426e('0x53')](handleError(_0x141242,null));};exports['send']=function(_0x1935b0,_0x643207,_0x219bcd){var _0x4cb010,_0x1b8a35,_0x422de7;if(_[_0x426e('0x97')](_0x1935b0[_0x426e('0x5c')][_0x426e('0x5c')])||_0x1935b0[_0x426e('0x5c')][_0x426e('0x5c')]===''){throw new db[(_0x426e('0x98'))][(_0x426e('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x426e('0x97')](_0x1935b0['body']['to'])){throw new db['Sequelize'][(_0x426e('0x89'))]('to\x20is\x20mandatory');}_0x4cb010=_0x1935b0[_0x426e('0x5c')]['to'];return db['WhatsappAccount'][_0x426e('0x55')]({'where':{'id':_0x1935b0['params']['id']},'include':[{'model':db[_0x426e('0x9e')],'as':_0x426e('0xc0'),'include':[{'model':db[_0x426e('0xa3')],'as':_0x426e('0xa2'),'where':{'mobile':_0x4cb010},'limit':0x1,'order':[[_0x426e('0x8c'),'DESC']]}]}]})[_0x426e('0x1c')](handleEntityNotFound(_0x643207,null))['then'](function(_0x55e516){if(_0x55e516&&_0x55e516['List']){_0x1b8a35=_0x55e516[_0x426e('0x31')]({'plain':!![]});if(_0x1b8a35[_0x426e('0xc0')]&&_0x1b8a35['List'][_0x426e('0xa2')][_0x426e('0x44')]){return _0x1b8a35[_0x426e('0xc0')][_0x426e('0xa2')][0x0];}return db['CmContact'][_0x426e('0x56')](_['defaults'](_0x1935b0[_0x426e('0x5c')],{'firstName':_0x4cb010,'mobile':_0x4cb010,'phone':_0x4cb010,'ListId':_0x1b8a35[_0x426e('0x8e')]}));}})[_0x426e('0x1c')](handleEntityNotFound(_0x643207,null))[_0x426e('0x1c')](function(_0x30ab7c){if(_0x30ab7c){_0x422de7=_0x30ab7c;return db[_0x426e('0xa5')][_0x426e('0x55')]({'where':{'ContactId':_0x422de7['id'],'closed':![],'WhatsappAccountId':_0x1b8a35['id']}})[_0x426e('0x1c')](function(_0x132dee){if(_0x132dee){return[_0x132dee,![]];}return db[_0x426e('0xa5')][_0x426e('0x56')]({'UserId':_0x1935b0[_0x426e('0x57')]['id'],'ContactId':_0x422de7['id'],'WhatsappAccountId':_0x1b8a35['id'],'phone':_0x4cb010,'firstMsgDirection':'out','Messages':[_[_0x426e('0x4b')](_0x1935b0[_0x426e('0x5c')],{'read':![],'body':_0x1935b0['body']['body'],'phone':_0x4cb010,'WhatsappAccountId':_0x1b8a35['id'],'UserId':_0x1935b0['user']['id'],'ContactId':_0x422de7['id']})]},{'include':[{'model':db[_0x426e('0x85')],'as':_0x426e('0xc1')}]})['then'](function(_0x56f77f){return[_0x56f77f,!![]];});});}})['spread'](function(_0x3fc6da,_0x3f7d8f){if(_0x3f7d8f){return _0x3fc6da;}return db['WhatsappMessage']['create'](_['merge'](_0x1935b0[_0x426e('0x5c')],{'read':![],'body':_0x1935b0[_0x426e('0x5c')][_0x426e('0x5c')],'phone':_0x4cb010,'WhatsappAccountId':_0x1b8a35['id'],'WhatsappInteractionId':_0x3fc6da['id'],'UserId':_0x1935b0[_0x426e('0x57')]['id'],'ContactId':_0x422de7['id']}))[_0x426e('0x1c')](function(_0x49cb58){_0x3fc6da[_0x426e('0xc2')][_0x426e('0xc1')]=[];_0x3fc6da[_0x426e('0xc2')][_0x426e('0xc1')]['push'](_0x49cb58[_0x426e('0xc2')]);return _0x3fc6da;});})['then'](respondWithResult(_0x643207,null))[_0x426e('0x53')](handleError(_0x643207,null));}; \ No newline at end of file +var _0xd89e=['message','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','Pause','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','addAgents','omit','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','applications','asc','CmContact','Sequelize','ValidationError','createdAt','difference','updatedAt','CompanyId','from','From','replace','whatsapp:','Body','messageId','notifications','message_id','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','created','autoclose','push','unmanaged','*,*,*,*','ContactId','interaction','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','Start','startRouting','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','\x0a','List','ListId','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd89e,0x16b));var _0xed89=function(_0x5f4a41,_0x2b5338){_0x5f4a41=_0x5f4a41-0x0;var _0x100c35=_0xd89e[_0x5f4a41];return _0x100c35;};'use strict';var emlformat=require(_0xed89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed89('0x1'));var rp=require(_0xed89('0x2'));var moment=require(_0xed89('0x3'));var BPromise=require(_0xed89('0x4'));var Mustache=require(_0xed89('0x5'));var util=require(_0xed89('0x6'));var path=require(_0xed89('0x7'));var sox=require(_0xed89('0x8'));var csv=require(_0xed89('0x9'));var ejs=require(_0xed89('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed89('0xb'));var squel=require(_0xed89('0xc'));var crypto=require(_0xed89('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed89('0xe'));var Papa=require(_0xed89('0xf'));var Redis=require(_0xed89('0x10'));var authService=require(_0xed89('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xed89('0x12'));var hardwareService=require(_0xed89('0x13'));var logger=require(_0xed89('0x14'))(_0xed89('0x15'));var utils=require(_0xed89('0x16'));var config=require(_0xed89('0x17'));var licenseUtil=require(_0xed89('0x18'));var db=require(_0xed89('0x19'))['db'];config[_0xed89('0x1a')]=_[_0xed89('0x1b')](config[_0xed89('0x1a')],{'host':_0xed89('0x1c'),'port':0x18eb});var socket=require(_0xed89('0x1d'))(new Redis(config[_0xed89('0x1a')]));require(_0xed89('0x1e'))['register'](socket);var jayson=require(_0xed89('0x1f'));var client=jayson[_0xed89('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x590931,_0x48e9a8,_0x2545ca,_0x329e6a){return new BPromise(function(_0x35d724,_0x288531){var _0x52ce6e=_0x329e6a||client;return _0x52ce6e[_0xed89('0x21')](_0x590931,_0x2545ca)[_0xed89('0x22')](function(_0x18fe11){logger[_0xed89('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x48e9a8,_0xed89('0x24'));logger['debug'](_0xed89('0x25'),_0x48e9a8,_0xed89('0x24'),JSON['stringify'](_0x18fe11));if(_0x18fe11[_0xed89('0x26')]){if(_0x18fe11['error'][_0xed89('0x27')]===0x1f4){logger['error'](_0xed89('0x28'),_0x48e9a8,_0x18fe11[_0xed89('0x26')][_0xed89('0x29')]);return _0x288531(_0x18fe11['error']['message']);}logger[_0xed89('0x26')](_0xed89('0x28'),_0x48e9a8,_0x18fe11[_0xed89('0x26')][_0xed89('0x29')]);return _0x35d724(_0x18fe11['error'][_0xed89('0x29')]);}else{logger[_0xed89('0x23')](_0xed89('0x28'),_0x48e9a8,_0xed89('0x24'));_0x35d724(_0x18fe11['result'][_0xed89('0x29')]);}})['catch'](function(_0x202307){logger['error'](_0xed89('0x28'),_0x48e9a8,_0x202307);_0x288531(_0x202307);});});}function respondWithStatusCode(_0x28ffe3,_0x8209c8){_0x8209c8=_0x8209c8||0xcc;return function(_0x809468){if(_0x809468){return _0x28ffe3[_0xed89('0x2a')](_0x8209c8);}return _0x28ffe3[_0xed89('0x2b')](_0x8209c8)[_0xed89('0x2c')]();};}function respondWithResult(_0x3fe055,_0x2707d8){_0x2707d8=_0x2707d8||0xc8;return function(_0x3d270d){if(_0x3d270d){return _0x3fe055[_0xed89('0x2b')](_0x2707d8)[_0xed89('0x2d')](_0x3d270d);}};}function respondWithFilteredResult(_0x3dfff9,_0x4c2bed){return function(_0x31f087){if(_0x31f087){var _0x1c17f5=typeof _0x4c2bed[_0xed89('0x2e')]===_0xed89('0x2f')&&typeof _0x4c2bed[_0xed89('0x30')]===_0xed89('0x2f');var _0xf5f88e=_0x31f087[_0xed89('0x31')];var _0x44bbfd=_0x1c17f5?0x0:_0x4c2bed[_0xed89('0x2e')];var _0x4b1612=_0x1c17f5?_0x31f087['count']:_0x4c2bed[_0xed89('0x2e')]+_0x4c2bed[_0xed89('0x30')];var _0x4e8145;if(_0x4b1612>=_0xf5f88e){_0x4b1612=_0xf5f88e;_0x4e8145=0xc8;}else{_0x4e8145=0xce;}_0x3dfff9['status'](_0x4e8145);return _0x3dfff9[_0xed89('0x32')]('Content-Range',_0x44bbfd+'-'+_0x4b1612+'/'+_0xf5f88e)[_0xed89('0x2d')](_0x31f087);}return null;};}function patchUpdates(_0x2ad17e){return function(_0x439cb7){try{jsonpatch[_0xed89('0x33')](_0x439cb7,_0x2ad17e,!![]);}catch(_0x5856f0){return BPromise[_0xed89('0x34')](_0x5856f0);}return _0x439cb7[_0xed89('0x35')]();};}function saveUpdates(_0x2d2396,_0x270e94){return function(_0xcb2326){if(_0xcb2326){return _0xcb2326[_0xed89('0x36')](_0x2d2396)[_0xed89('0x22')](function(_0x44f5fc){return _0x44f5fc;});}return null;};}function removeEntity(_0x563df9,_0x11e0af){return function(_0x553cb7){if(_0x553cb7){return _0x553cb7[_0xed89('0x37')]()[_0xed89('0x22')](function(){var _0x10fa71=_0x553cb7[_0xed89('0x38')]({'plain':!![]});var _0x5b27db=_0xed89('0x39');return db[_0xed89('0x3a')]['destroy']({'where':{'type':_0x5b27db,'resourceId':_0x10fa71['id']}})[_0xed89('0x22')](function(){return _0x553cb7;});})[_0xed89('0x22')](function(){_0x563df9[_0xed89('0x2b')](0xcc)[_0xed89('0x2c')]();});}};}function handleEntityNotFound(_0x10c2a1,_0x17963d){return function(_0x314fce){if(!_0x314fce){_0x10c2a1[_0xed89('0x2a')](0x194);}return _0x314fce;};}function handleError(_0x24be45,_0x3ca44c){_0x3ca44c=_0x3ca44c||0x1f4;return function(_0x47f620){logger['error'](_0x47f620[_0xed89('0x3b')]);if(_0x47f620[_0xed89('0x3c')]){delete _0x47f620['name'];}_0x24be45[_0xed89('0x2b')](_0x3ca44c)[_0xed89('0x3d')](_0x47f620);};}exports[_0xed89('0x3e')]=function(_0x2a898c,_0x1fb0f5){var _0x2f2cc2={'include':[{'model':db['Pause'],'as':_0xed89('0x3f')}]},_0x5e5866={},_0x9dbdb={'count':0x0,'rows':[]};var _0x50f4a3=_[_0xed89('0x40')](db[_0xed89('0x41')]['rawAttributes'],function(_0x1a4981){return{'name':_0x1a4981[_0xed89('0x42')],'type':_0x1a4981[_0xed89('0x43')][_0xed89('0x44')]};});_0x5e5866[_0xed89('0x45')]=_[_0xed89('0x40')](_0x50f4a3,_0xed89('0x3c'));_0x5e5866['query']=_[_0xed89('0x46')](_0x2a898c[_0xed89('0x47')]);_0x5e5866['filters']=_[_0xed89('0x48')](_0x5e5866[_0xed89('0x45')],_0x5e5866[_0xed89('0x47')]);_0x2f2cc2['attributes']=_[_0xed89('0x48')](_0x5e5866['model'],qs[_0xed89('0x49')](_0x2a898c[_0xed89('0x47')][_0xed89('0x49')]));_0x2f2cc2[_0xed89('0x4a')]=_0x2f2cc2[_0xed89('0x4a')][_0xed89('0x4b')]?_0x2f2cc2[_0xed89('0x4a')]:_0x5e5866['model'];if(!_0x2a898c[_0xed89('0x47')][_0xed89('0x4c')](_0xed89('0x4d'))){_0x2f2cc2[_0xed89('0x30')]=qs[_0xed89('0x30')](_0x2a898c['query']['limit']);_0x2f2cc2[_0xed89('0x2e')]=qs['offset'](_0x2a898c['query'][_0xed89('0x2e')]);}_0x2f2cc2[_0xed89('0x4e')]=qs[_0xed89('0x4f')](_0x2a898c['query']['sort']);_0x2f2cc2[_0xed89('0x50')]=qs[_0xed89('0x51')](_['pick'](_0x2a898c[_0xed89('0x47')],_0x5e5866[_0xed89('0x51')]),_0x50f4a3);if(_0x2a898c[_0xed89('0x47')]['filter']){_0x2f2cc2[_0xed89('0x50')]=_[_0xed89('0x52')](_0x2f2cc2[_0xed89('0x50')],{'$or':_[_0xed89('0x40')](_0x50f4a3,function(_0x3ce215){if(_0x3ce215[_0xed89('0x43')]!==_0xed89('0x53')){var _0x19813b={};_0x19813b[_0x3ce215[_0xed89('0x3c')]]={'$like':'%'+_0x2a898c['query']['filter']+'%'};return _0x19813b;}})});}_0x2f2cc2=_['merge']({},_0x2f2cc2,_0x2a898c[_0xed89('0x54')]);var _0x5bf769={'where':_0x2f2cc2['where']};return db[_0xed89('0x41')][_0xed89('0x31')](_0x5bf769)['then'](function(_0x2b510f){_0x9dbdb[_0xed89('0x31')]=_0x2b510f;if(_0x2a898c[_0xed89('0x47')][_0xed89('0x55')]){_0x2f2cc2['include']=[{'all':!![]}];}return db[_0xed89('0x41')][_0xed89('0x56')](_0x2f2cc2);})['then'](function(_0x31d20f){_0x9dbdb[_0xed89('0x57')]=_0x31d20f;return _0x9dbdb;})['then'](respondWithFilteredResult(_0x1fb0f5,_0x2f2cc2))[_0xed89('0x58')](handleError(_0x1fb0f5,null));};exports[_0xed89('0x59')]=function(_0x3e90c1,_0x5a1562){var _0x59db7d={'raw':![],'where':{'id':_0x3e90c1[_0xed89('0x5a')]['id']},'include':[{'model':db[_0xed89('0x5b')],'as':'mandatoryDispositionPause'}]},_0x226345={};_0x226345[_0xed89('0x45')]=_['keys'](db[_0xed89('0x41')][_0xed89('0x5c')]);_0x226345[_0xed89('0x47')]=_['keys'](_0x3e90c1[_0xed89('0x47')]);_0x226345['filters']=_['intersection'](_0x226345[_0xed89('0x45')],_0x226345[_0xed89('0x47')]);_0x59db7d[_0xed89('0x4a')]=_[_0xed89('0x48')](_0x226345[_0xed89('0x45')],qs['fields'](_0x3e90c1[_0xed89('0x47')][_0xed89('0x49')]));_0x59db7d[_0xed89('0x4a')]=_0x59db7d[_0xed89('0x4a')][_0xed89('0x4b')]?_0x59db7d[_0xed89('0x4a')]:_0x226345['model'];if(_0x3e90c1['query'][_0xed89('0x55')]){_0x59db7d[_0xed89('0x5d')]=[{'all':!![]}];}_0x59db7d=_['merge']({},_0x59db7d,_0x3e90c1['options']);return db['WhatsappAccount'][_0xed89('0x5e')](_0x59db7d)[_0xed89('0x22')](handleEntityNotFound(_0x5a1562,null))[_0xed89('0x22')](respondWithResult(_0x5a1562,null))[_0xed89('0x58')](handleError(_0x5a1562,null));};exports[_0xed89('0x5f')]=function(_0x3e3c75,_0x1fe244){return db[_0xed89('0x41')][_0xed89('0x5f')](_0x3e3c75['body'],{})[_0xed89('0x22')](function(_0x2dd728){var _0x4b1198=_0x3e3c75[_0xed89('0x60')]['get']({'plain':!![]});if(!_0x4b1198)throw new Error(_0xed89('0x61'));if(_0x4b1198[_0xed89('0x62')]==='user'){var _0x5b8b29=_0x2dd728[_0xed89('0x38')]({'plain':!![]});var _0x6cb2cf=_0xed89('0x39');return db[_0xed89('0x63')][_0xed89('0x5e')]({'where':{'name':_0x6cb2cf,'userProfileId':_0x4b1198[_0xed89('0x64')]},'raw':!![]})[_0xed89('0x22')](function(_0x309a91){if(_0x309a91&&_0x309a91[_0xed89('0x65')]===0x0){return db[_0xed89('0x3a')][_0xed89('0x5f')]({'name':_0x5b8b29[_0xed89('0x3c')],'resourceId':_0x5b8b29['id'],'type':_0x309a91[_0xed89('0x3c')],'sectionId':_0x309a91['id']},{})[_0xed89('0x22')](function(){return _0x2dd728;});}else{return _0x2dd728;}})[_0xed89('0x58')](function(_0x368e29){logger[_0xed89('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368e29);throw _0x368e29;});}return _0x2dd728;})[_0xed89('0x22')](respondWithResult(_0x1fe244,0xc9))[_0xed89('0x58')](handleError(_0x1fe244,null));};exports[_0xed89('0x36')]=function(_0x56c5ec,_0x42e494){if(_0x56c5ec[_0xed89('0x66')]['id']){delete _0x56c5ec[_0xed89('0x66')]['id'];}return db[_0xed89('0x41')][_0xed89('0x5e')]({'where':{'id':_0x56c5ec[_0xed89('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xed89('0x22')](handleEntityNotFound(_0x42e494,null))[_0xed89('0x22')](saveUpdates(_0x56c5ec['body'],null))['then'](respondWithResult(_0x42e494,null))[_0xed89('0x58')](handleError(_0x42e494,null));};exports[_0xed89('0x37')]=function(_0x37bcf8,_0x5a560b){return db['WhatsappAccount'][_0xed89('0x5e')]({'where':{'id':_0x37bcf8[_0xed89('0x5a')]['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x5a560b,null))[_0xed89('0x22')](removeEntity(_0x5a560b,null))['catch'](handleError(_0x5a560b,null));};exports[_0xed89('0x67')]=function(_0x38b431,_0x1d1f8f){return db['WhatsappAccount'][_0xed89('0x67')]()[_0xed89('0x22')](respondWithResult(_0x1d1f8f,null))[_0xed89('0x58')](handleError(_0x1d1f8f,null));};exports[_0xed89('0x68')]=function(_0x500048,_0x37d68c,_0x7b12e7){if(_0x500048['body']['id']){delete _0x500048[_0xed89('0x66')]['id'];}return db[_0xed89('0x41')]['find']({'where':{'id':_0x500048[_0xed89('0x5a')]['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x37d68c,null))[_0xed89('0x22')](function(_0xb6aee5){if(_0xb6aee5){_0x500048[_0xed89('0x66')]['WhatsappAccountId']=_0xb6aee5['id'];return db[_0xed89('0x69')]['create'](_0x500048[_0xed89('0x66')]);}})[_0xed89('0x22')](respondWithResult(_0x37d68c,null))['catch'](handleError(_0x37d68c,null));};exports[_0xed89('0x6a')]=function(_0x195df,_0x562298,_0x37f0e9){var _0x2c1147={'raw':![],'where':{}};var _0x3a6138={};var _0x422e81={'count':0x0,'rows':[]};return db[_0xed89('0x41')][_0xed89('0x6b')]({'where':{'id':_0x195df[_0xed89('0x5a')]['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x562298,null))[_0xed89('0x22')](function(_0x31a2f2){if(_0x31a2f2){_0x3a6138['model']=_[_0xed89('0x46')](db[_0xed89('0x69')][_0xed89('0x5c')]);_0x3a6138[_0xed89('0x47')]=_['keys'](_0x195df[_0xed89('0x47')]);_0x3a6138[_0xed89('0x51')]=_[_0xed89('0x48')](_0x3a6138[_0xed89('0x45')],_0x3a6138['query']);_0x2c1147['attributes']=_['intersection'](_0x3a6138[_0xed89('0x45')],qs[_0xed89('0x49')](_0x195df[_0xed89('0x47')][_0xed89('0x49')]));_0x2c1147[_0xed89('0x4a')]=_0x2c1147['attributes'][_0xed89('0x4b')]?_0x2c1147[_0xed89('0x4a')]:_0x3a6138[_0xed89('0x45')];if(!_0x195df[_0xed89('0x47')][_0xed89('0x4c')](_0xed89('0x4d'))){_0x2c1147[_0xed89('0x30')]=qs[_0xed89('0x30')](_0x195df[_0xed89('0x47')][_0xed89('0x30')]);_0x2c1147[_0xed89('0x2e')]=qs[_0xed89('0x2e')](_0x195df[_0xed89('0x47')]['offset']);}_0x2c1147[_0xed89('0x4e')]=qs[_0xed89('0x4f')](_0x195df['query'][_0xed89('0x4f')]);_0x2c1147[_0xed89('0x50')]=qs['filters'](_['pick'](_0x195df[_0xed89('0x47')],_0x3a6138[_0xed89('0x51')]));_0x2c1147[_0xed89('0x50')][_0xed89('0x6c')]=_0x31a2f2['id'];if(_0x195df['query'][_0xed89('0x6d')]){_0x2c1147[_0xed89('0x50')]=_[_0xed89('0x52')](_0x2c1147['where'],{'$or':_[_0xed89('0x40')](_0x2c1147['attributes'],function(_0x5a1ae3){var _0x42d46f={};_0x42d46f[_0x5a1ae3]={'$like':'%'+_0x195df[_0xed89('0x47')]['filter']+'%'};return _0x42d46f;})});}_0x2c1147=_[_0xed89('0x52')]({},_0x2c1147,_0x195df[_0xed89('0x54')]);return db['Disposition'][_0xed89('0x31')]({'where':_0x2c1147[_0xed89('0x50')]})[_0xed89('0x22')](function(_0x45cc83){_0x422e81[_0xed89('0x31')]=_0x45cc83;if(_0x195df[_0xed89('0x47')][_0xed89('0x55')]){_0x2c1147[_0xed89('0x5d')]=[{'all':!![]}];}return db[_0xed89('0x69')][_0xed89('0x56')](_0x2c1147);})[_0xed89('0x22')](function(_0x13cb34){_0x422e81[_0xed89('0x57')]=_0x13cb34;return _0x422e81;});}})[_0xed89('0x22')](respondWithFilteredResult(_0x562298,_0x2c1147))[_0xed89('0x58')](handleError(_0x562298,null));};exports[_0xed89('0x6e')]=function(_0x446566,_0x162a43,_0x5487f0){return db[_0xed89('0x41')][_0xed89('0x5e')]({'where':{'id':_0x446566[_0xed89('0x5a')]['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x162a43,null))[_0xed89('0x22')](function(_0x1b2d41){if(_0x1b2d41){return _0x1b2d41[_0xed89('0x6e')](_0x446566[_0xed89('0x47')][_0xed89('0x6f')]);}})[_0xed89('0x22')](respondWithStatusCode(_0x162a43,null))[_0xed89('0x58')](handleError(_0x162a43,null));};exports[_0xed89('0x70')]=function(_0x4153ac,_0x361399,_0x33ec42){if(_0x4153ac['body']['id']){delete _0x4153ac[_0xed89('0x66')]['id'];}return db[_0xed89('0x41')][_0xed89('0x5e')]({'where':{'id':_0x4153ac['params']['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x361399,null))[_0xed89('0x22')](function(_0x29b250){if(_0x29b250){_0x4153ac[_0xed89('0x66')]['WhatsappAccountId']=_0x29b250['id'];return db[_0xed89('0x71')][_0xed89('0x5f')](_0x4153ac[_0xed89('0x66')]);}})[_0xed89('0x22')](respondWithResult(_0x361399,null))['catch'](handleError(_0x361399,null));};exports[_0xed89('0x72')]=function(_0x4228e8,_0x4c679,_0x1639c1){var _0x443798={'raw':![],'where':{}};var _0x293fbe={};var _0x345943={'count':0x0,'rows':[]};return db[_0xed89('0x41')]['findOne']({'where':{'id':_0x4228e8[_0xed89('0x5a')]['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x4c679,null))[_0xed89('0x22')](function(_0x2ab35d){if(_0x2ab35d){_0x293fbe['model']=_['keys'](db[_0xed89('0x71')]['rawAttributes']);_0x293fbe[_0xed89('0x47')]=_['keys'](_0x4228e8['query']);_0x293fbe[_0xed89('0x51')]=_['intersection'](_0x293fbe[_0xed89('0x45')],_0x293fbe[_0xed89('0x47')]);_0x443798['attributes']=_['intersection'](_0x293fbe[_0xed89('0x45')],qs[_0xed89('0x49')](_0x4228e8[_0xed89('0x47')][_0xed89('0x49')]));_0x443798[_0xed89('0x4a')]=_0x443798[_0xed89('0x4a')]['length']?_0x443798['attributes']:_0x293fbe[_0xed89('0x45')];if(!_0x4228e8[_0xed89('0x47')][_0xed89('0x4c')]('nolimit')){_0x443798[_0xed89('0x30')]=qs[_0xed89('0x30')](_0x4228e8[_0xed89('0x47')][_0xed89('0x30')]);_0x443798['offset']=qs[_0xed89('0x2e')](_0x4228e8[_0xed89('0x47')][_0xed89('0x2e')]);}_0x443798[_0xed89('0x4e')]=qs[_0xed89('0x4f')](_0x4228e8['query'][_0xed89('0x4f')]);_0x443798[_0xed89('0x50')]=qs[_0xed89('0x51')](_[_0xed89('0x73')](_0x4228e8[_0xed89('0x47')],_0x293fbe[_0xed89('0x51')]));_0x443798['where'][_0xed89('0x6c')]=_0x2ab35d['id'];if(_0x4228e8[_0xed89('0x47')]['filter']){_0x443798['where']=_['merge'](_0x443798[_0xed89('0x50')],{'$or':_[_0xed89('0x40')](_0x443798[_0xed89('0x4a')],function(_0x3577e6){var _0xd7f38={};_0xd7f38[_0x3577e6]={'$like':'%'+_0x4228e8[_0xed89('0x47')][_0xed89('0x6d')]+'%'};return _0xd7f38;})});}_0x443798=_[_0xed89('0x52')]({},_0x443798,_0x4228e8['options']);return db['CannedAnswer']['count']({'where':_0x443798['where']})[_0xed89('0x22')](function(_0x121b80){_0x345943[_0xed89('0x31')]=_0x121b80;if(_0x4228e8[_0xed89('0x47')][_0xed89('0x55')]){_0x443798['include']=[{'all':!![]}];}return db[_0xed89('0x71')][_0xed89('0x56')](_0x443798);})['then'](function(_0x1f08ff){_0x345943[_0xed89('0x57')]=_0x1f08ff;return _0x345943;});}})['then'](respondWithFilteredResult(_0x4c679,_0x443798))[_0xed89('0x58')](handleError(_0x4c679,null));};exports[_0xed89('0x74')]=function(_0x124637,_0x15c301,_0x27cabc){return db['WhatsappAccount'][_0xed89('0x5e')]({'where':{'id':_0x124637[_0xed89('0x5a')]['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x15c301,null))[_0xed89('0x22')](function(_0x219f1c){if(_0x219f1c){return _0x219f1c[_0xed89('0x74')](_0x124637[_0xed89('0x47')]['ids']);}})[_0xed89('0x22')](respondWithStatusCode(_0x15c301,null))['catch'](handleError(_0x15c301,null));};exports[_0xed89('0x75')]=function(_0x23e695,_0x1f1a15,_0x5f4c95){return db[_0xed89('0x41')]['find']({'where':{'id':_0x23e695['params']['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x1f1a15,null))['then'](function(_0x53a8d5){if(_0x53a8d5){return _0x53a8d5[_0xed89('0x75')](_0x23e695[_0xed89('0x66')]['ids'],_[_0xed89('0x76')](_0x23e695['body'],[_0xed89('0x6f'),'id'])||{})['spread'](function(_0x620e2b){for(var _0x38f3ff=0x0;_0x38f3ff<_0x23e695[_0xed89('0x66')][_0xed89('0x6f')]['length'];_0x38f3ff+=0x1){socket['emit'](_0xed89('0x77'),{'UserId':Number(_0x23e695[_0xed89('0x66')][_0xed89('0x6f')][_0x38f3ff]),'WhatsappAccountId':Number(_0x23e695[_0xed89('0x5a')]['id'])});}return _0x620e2b;});}})[_0xed89('0x22')](respondWithResult(_0x1f1a15,null))['catch'](handleError(_0x1f1a15,null));};exports[_0xed89('0x78')]=function(_0x49a12d,_0x5cd599,_0x2fb887){return db[_0xed89('0x41')][_0xed89('0x5e')]({'where':{'id':_0x49a12d[_0xed89('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5cd599,null))[_0xed89('0x22')](function(_0x1dae8b){if(_0x1dae8b){return _0x1dae8b[_0xed89('0x78')](_0x49a12d[_0xed89('0x47')][_0xed89('0x6f')])['then'](function(){if(_['isArray'](_0x49a12d[_0xed89('0x47')][_0xed89('0x6f')])){for(var _0x32d068=0x0;_0x32d068<_0x49a12d['query']['ids']['length'];_0x32d068+=0x1){socket[_0xed89('0x79')](_0xed89('0x7a'),{'UserId':Number(_0x49a12d[_0xed89('0x47')][_0xed89('0x6f')][_0x32d068]),'WhatsappAccountId':Number(_0x49a12d['params']['id'])});}}else{socket[_0xed89('0x79')](_0xed89('0x7a'),{'UserId':Number(_0x49a12d[_0xed89('0x47')]['ids']),'WhatsappAccountId':Number(_0x49a12d['params']['id'])});}});}})[_0xed89('0x22')](respondWithStatusCode(_0x5cd599,null))[_0xed89('0x58')](handleError(_0x5cd599,null));};exports[_0xed89('0x7b')]=function(_0x20cd3a,_0x34d717,_0xfcd96f){var _0xeff3f4={};var _0xa86c0c={};var _0x260fb7;var _0x219756;return db[_0xed89('0x41')][_0xed89('0x6b')]({'where':{'id':_0x20cd3a['params']['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x34d717,null))[_0xed89('0x22')](function(_0x4b0651){if(_0x4b0651){_0x260fb7=_0x4b0651;_0xa86c0c[_0xed89('0x45')]=_[_0xed89('0x46')](db['User'][_0xed89('0x5c')]);_0xa86c0c[_0xed89('0x47')]=_[_0xed89('0x46')](_0x20cd3a[_0xed89('0x47')]);_0xa86c0c[_0xed89('0x51')]=_[_0xed89('0x48')](_0xa86c0c[_0xed89('0x45')],_0xa86c0c[_0xed89('0x47')]);_0xeff3f4[_0xed89('0x4a')]=_[_0xed89('0x48')](_0xa86c0c[_0xed89('0x45')],qs['fields'](_0x20cd3a[_0xed89('0x47')][_0xed89('0x49')]));_0xeff3f4[_0xed89('0x4a')]=_0xeff3f4[_0xed89('0x4a')][_0xed89('0x4b')]?_0xeff3f4[_0xed89('0x4a')]:_0xa86c0c[_0xed89('0x45')];_0xeff3f4[_0xed89('0x4e')]=qs[_0xed89('0x4f')](_0x20cd3a[_0xed89('0x47')]['sort']);_0xeff3f4['where']=qs[_0xed89('0x51')](_[_0xed89('0x73')](_0x20cd3a[_0xed89('0x47')],_0xa86c0c[_0xed89('0x51')]));if(_0x20cd3a[_0xed89('0x47')][_0xed89('0x6d')]){_0xeff3f4[_0xed89('0x50')]=_[_0xed89('0x52')](_0xeff3f4[_0xed89('0x50')],{'$or':_[_0xed89('0x40')](_0xeff3f4['attributes'],function(_0x229ef5){var _0x4552d8={};_0x4552d8[_0x229ef5]={'$like':'%'+_0x20cd3a[_0xed89('0x47')][_0xed89('0x6d')]+'%'};return _0x4552d8;})});}_0xeff3f4=_[_0xed89('0x52')]({},_0xeff3f4,_0x20cd3a[_0xed89('0x54')]);return _0x260fb7[_0xed89('0x7b')](_0xeff3f4);}})[_0xed89('0x22')](function(_0x45846){if(_0x45846){_0x219756=_0x45846[_0xed89('0x4b')];if(!_0x20cd3a[_0xed89('0x47')][_0xed89('0x4c')](_0xed89('0x4d'))){_0xeff3f4['limit']=qs[_0xed89('0x30')](_0x20cd3a[_0xed89('0x47')][_0xed89('0x30')]);_0xeff3f4[_0xed89('0x2e')]=qs[_0xed89('0x2e')](_0x20cd3a['query'][_0xed89('0x2e')]);}return _0x260fb7[_0xed89('0x7b')](_0xeff3f4);}})['then'](function(_0x1dd5c0){if(_0x1dd5c0){return _0x1dd5c0?{'count':_0x219756,'rows':_0x1dd5c0}:null;}})[_0xed89('0x22')](respondWithResult(_0x34d717,null))[_0xed89('0x58')](handleError(_0x34d717,null));};exports[_0xed89('0x7c')]=function(_0x33bdde,_0x481a93){var _0x341012=_0x33bdde['params']['id'];var _0xe82d60=_0x33bdde['body'];var _0x13c796=0xc8;var _0x29aa7f=null;return db[_0xed89('0x7d')][_0xed89('0x7e')]({'isolationLevel':db[_0xed89('0x7d')][_0xed89('0x7f')][_0xed89('0x80')][_0xed89('0x81')]},function(_0x265936){return db[_0xed89('0x41')]['findOne']({'where':{'id':_0x341012},'transaction':_0x265936})[_0xed89('0x22')](function(_0x9b5b3b){if(_0x9b5b3b){return db[_0xed89('0x82')][_0xed89('0x37')]({'where':{'WhatsappAccountId':_0x341012},'transaction':_0x265936})[_0xed89('0x22')](function(){var _0x3accc0=_[_0xed89('0x40')](_0xe82d60,function(_0x53e9be){_0x53e9be[_0xed89('0x6c')]=_0x341012;return _0x53e9be;});return db[_0xed89('0x82')]['bulkCreate'](_0x3accc0,{'transaction':_0x265936});});}else{_0x13c796=0x194;_0x29aa7f=[];}});})[_0xed89('0x22')](function(){if(_0x13c796!==0x194){return db[_0xed89('0x82')][_0xed89('0x83')]({'where':{'WhatsappAccountId':_0x341012},'order':_0xed89('0x84')})['then'](function(_0x31429a){_0x29aa7f=_0x31429a;});}})['catch'](function(_0x459f7b){_0x13c796=0x1f4;logger[_0xed89('0x26')](_0x459f7b[_0xed89('0x3b')]);if(_0x459f7b['name']){delete _0x459f7b[_0xed89('0x3c')];}_0x29aa7f=_0x459f7b;})['finally'](function(){if(_0x29aa7f===null){_0x481a93['sendStatus'](_0x13c796);}else{if(_0x13c796===0x1f4){_0x481a93[_0xed89('0x2b')](_0x13c796)[_0xed89('0x3d')](_0x29aa7f);}else{_0x481a93[_0xed89('0x2b')](_0x13c796)[_0xed89('0x2d')](_0x29aa7f);}}});};exports[_0xed89('0x85')]=function(_0x3f92c0,_0x278e76,_0x38e63f){var _0xdfb335={};var _0x5d79e6={};var _0x86ac08;var _0x20e62f;return db[_0xed89('0x41')]['findOne']({'where':{'id':_0x3f92c0[_0xed89('0x5a')]['id']}})[_0xed89('0x22')](handleEntityNotFound(_0x278e76,null))[_0xed89('0x22')](function(_0x3eb55f){if(_0x3eb55f){_0x86ac08=_0x3eb55f;_0x5d79e6[_0xed89('0x45')]=_[_0xed89('0x46')](db[_0xed89('0x82')][_0xed89('0x5c')]);_0x5d79e6[_0xed89('0x47')]=_[_0xed89('0x46')](_0x3f92c0['query']);_0x5d79e6['filters']=_[_0xed89('0x48')](_0x5d79e6[_0xed89('0x45')],_0x5d79e6[_0xed89('0x47')]);_0xdfb335[_0xed89('0x4a')]=_['intersection'](_0x5d79e6[_0xed89('0x45')],qs[_0xed89('0x49')](_0x3f92c0[_0xed89('0x47')]['fields']));_0xdfb335[_0xed89('0x4a')]=_0xdfb335[_0xed89('0x4a')]['length']?_0xdfb335[_0xed89('0x4a')]:_0x5d79e6['model'];_0xdfb335[_0xed89('0x4e')]=qs['sort'](_0x3f92c0[_0xed89('0x47')][_0xed89('0x4f')]);_0xdfb335[_0xed89('0x50')]=qs[_0xed89('0x51')](_[_0xed89('0x73')](_0x3f92c0[_0xed89('0x47')],_0x5d79e6[_0xed89('0x51')]));if(_0x3f92c0['query'][_0xed89('0x6d')]){_0xdfb335['where']=_[_0xed89('0x52')](_0xdfb335[_0xed89('0x50')],{'$or':_['map'](_0xdfb335[_0xed89('0x4a')],function(_0x5519c8){var _0x5993a7={};_0x5993a7[_0x5519c8]={'$like':'%'+_0x3f92c0['query']['filter']+'%'};return _0x5993a7;})});}_0xdfb335=_['merge']({},_0xdfb335,_0x3f92c0[_0xed89('0x54')]);return _0x86ac08['getApplications'](_0xdfb335);}})[_0xed89('0x22')](function(_0x3d49f6){if(_0x3d49f6){_0x20e62f=_0x3d49f6[_0xed89('0x4b')];if(!_0x3f92c0[_0xed89('0x47')]['hasOwnProperty']('nolimit')){_0xdfb335['limit']=qs[_0xed89('0x30')](_0x3f92c0[_0xed89('0x47')]['limit']);_0xdfb335[_0xed89('0x2e')]=qs[_0xed89('0x2e')](_0x3f92c0[_0xed89('0x47')][_0xed89('0x2e')]);}return _0x86ac08[_0xed89('0x85')](_0xdfb335);}})[_0xed89('0x22')](function(_0x189dc3){if(_0x189dc3){return _0x189dc3?{'count':_0x20e62f,'rows':_0x189dc3}:null;}})[_0xed89('0x22')](respondWithResult(_0x278e76,null))['catch'](handleError(_0x278e76,null));};exports[_0xed89('0x86')]=function(_0x31797d,_0x465924,_0x6e5486){var _0x10819e={'channel':_0xed89('0x87')};var _0x498d15=[];var _0x36bc60=[];var _0x44abc2={};return db['WhatsappAccount'][_0xed89('0x5e')]({'where':{'id':_0x31797d[_0xed89('0x5a')]['id']},'include':[{'model':db[_0xed89('0x82')],'as':_0xed89('0x88')}]})[_0xed89('0x22')](handleEntityNotFound(_0x465924,null))[_0xed89('0x22')](function(_0x3709cc){_0x10819e['account']=_0x3709cc;if(_0x10819e['account']&&_0x10819e[_0xed89('0x89')][_0xed89('0x43')]===_0xed89('0x8a')&&_0x31797d[_0xed89('0x66')][_0xed89('0x8b')]){if(_0x31797d[_0xed89('0x66')][_0xed89('0x8b')][_0xed89('0x4b')]===0x0)return;if(_0x31797d[_0xed89('0x66')]['statuses'][0x0][_0xed89('0x8c')]!==_0xed89('0x8d'))return;return db[_0xed89('0x8e')][_0xed89('0x36')]({'read':!![],'readAt':_0x31797d[_0xed89('0x66')][_0xed89('0x8b')][0x0]['timestamp']},{'where':{'messageId':_0x31797d[_0xed89('0x66')][_0xed89('0x8b')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x52860d){return _0x465924['status'](0xc8)[_0xed89('0x2d')](_0x52860d);});}_0x10819e[_0xed89('0x8f')]=_['orderBy'](_0x3709cc[_0xed89('0x88')],['priority'],[_0xed89('0x90')]);if(_0x10819e[_0xed89('0x89')][_0xed89('0x88')]){delete _0x10819e[_0xed89('0x89')][_0xed89('0x88')];}return db[_0xed89('0x91')][_0xed89('0x67')]()['then'](function(_0x15c339){if(!_0x15c339){throw new db[(_0xed89('0x92'))][(_0xed89('0x93'))]('no\x20available\x20attributes');}_0x498d15=_['difference'](_['keys'](_0x15c339),[_0xed89('0x94'),'updatedAt']);_0x36bc60=_[_0xed89('0x95')](_[_0xed89('0x46')](_0x15c339),[_0xed89('0x94'),_0xed89('0x96'),_0xed89('0x97'),'ListId']);_0x10819e['body']={'mapKey':'mobile'};if(_0x10819e['account']&&_0x10819e[_0xed89('0x89')][_0xed89('0x43')]==='twilio'){_0x10819e[_0xed89('0x66')][_0xed89('0x98')]=_0x31797d[_0xed89('0x66')][_0xed89('0x99')][_0xed89('0x9a')](_0xed89('0x9b'),'');_0x10819e[_0xed89('0x66')]['body']=_0x31797d[_0xed89('0x66')][_0xed89('0x9c')];_0x10819e[_0xed89('0x66')][_0xed89('0x9d')]=_0x31797d[_0xed89('0x66')]['MessageSid'];}if(_0x10819e['account']&&_0x10819e['account'][_0xed89('0x43')]===_0xed89('0x8a')){_0x10819e[_0xed89('0x66')]['from']=_0x31797d['body'][_0xed89('0x9e')][0x0][_0xed89('0x98')];_0x10819e['body'][_0xed89('0x66')]=_0x31797d[_0xed89('0x66')]['notifications'][0x0][_0xed89('0x29')][_0xed89('0x66')];_0x10819e[_0xed89('0x66')][_0xed89('0x9d')]=_0x31797d[_0xed89('0x66')]['notifications'][0x0][_0xed89('0x9f')];}if(_0x10819e[_0xed89('0x66')]['id']){delete _0x10819e[_0xed89('0x66')]['id'];}if(_['isNil'](_0x10819e[_0xed89('0x66')][_0xed89('0x98')])){throw new db['Sequelize'][(_0xed89('0x93'))](_0xed89('0xa0'));}if(_['isNil'](_0x10819e[_0xed89('0x66')]['body'])||_0x10819e[_0xed89('0x66')][_0xed89('0x66')]===''){throw new db[(_0xed89('0x92'))]['ValidationError'](_0xed89('0xa1'));}if(_[_0xed89('0xa2')](_0x10819e[_0xed89('0x66')][_0xed89('0xa3')])){throw new db[(_0xed89('0x92'))][(_0xed89('0x93'))](_0xed89('0xa4')+_0x36bc60);}if(!_[_0xed89('0xa5')](_0x36bc60,_0x10819e[_0xed89('0x66')]['mapKey'])){throw new db[(_0xed89('0x92'))]['ValidationError'](_0xed89('0xa6')+_0x36bc60);}_0x44abc2[_0x10819e[_0xed89('0x66')][_0xed89('0xa3')]]=_0x10819e[_0xed89('0x66')][_0xed89('0x98')];return db[_0xed89('0xa7')][_0xed89('0x5e')]({'where':{'id':_0x10819e[_0xed89('0x89')]['ListId']},'include':[{'model':db[_0xed89('0x91')],'as':_0xed89('0xa8'),'where':_0x44abc2,'limit':0x1,'order':[[_0xed89('0x96'),_0xed89('0xa9')]]}]});})[_0xed89('0x22')](handleEntityNotFound(_0x465924,null))['then'](function(_0x2c350d){if(_0x2c350d){_0x10819e[_0xed89('0xaa')]=_[_0xed89('0x76')](_0x2c350d,[_0xed89('0xa8')]);if(_0x2c350d[_0xed89('0xa8')]['length']){return _0x2c350d['Contacts'][0x0];}var _0x467bf0=_[_0xed89('0x1b')](_0x10819e[_0xed89('0x66')],{'firstName':_0x10819e['body']['from'],'ListId':_0x2c350d['id']});_0x467bf0[_0x10819e[_0xed89('0x66')]['mapKey']]=_0x10819e[_0xed89('0x66')][_0xed89('0x98')];return db['CmContact']['create'](_0x467bf0,{'fields':_0x498d15,'raw':!![]});}})[_0xed89('0x22')](handleEntityNotFound(_0x465924,null))[_0xed89('0x22')](function(_0xd77965){if(_0xd77965){_0x10819e[_0xed89('0xab')]=_0xd77965;var _0x40f726={'ContactId':_0xd77965['id'],'phone':_0x10819e[_0xed89('0x66')][_0xed89('0x98')],'WhatsappAccountId':_0x31797d[_0xed89('0x5a')]['id']};var _0x63eafa={'ContactId':_0xd77965['id'],'WhatsappAccountId':_0x31797d[_0xed89('0x5a')]['id'],'closed':![]};return db[_0xed89('0xac')]['find']({'where':_0x63eafa})[_0xed89('0x22')](function(_0x383e65){if(_0x383e65){return[_0x383e65,![]];}return db['WhatsappInteraction']['create'](_0x40f726)[_0xed89('0x22')](function(_0x4acb3c){return[_0x4acb3c,!![]];});});}})[_0xed89('0xad')](function(_0x49a97a,_0x17c8d2){_0x10819e['interaction']=_0x49a97a[_0xed89('0x38')]({'plain':!![]});_0x10819e['interaction'][_0xed89('0xae')]=![];if(_0x17c8d2){if(_0x10819e[_0xed89('0x89')][_0xed89('0xaf')]){_0x10819e['applications'][_0xed89('0xb0')]({'id':0x0,'priority':_0x10819e[_0xed89('0x8f')]['length']+0x1,'app':'close','appdata':_0xed89('0xb1'),'interval':_0xed89('0xb2')});}_0x10819e['interaction']['created']=!![];}return db['WhatsappMessage'][_0xed89('0x5f')]({'phone':_0x10819e[_0xed89('0x66')]['from'],'messageId':_0x10819e[_0xed89('0x66')][_0xed89('0x9d')],'body':_0x10819e['body'][_0xed89('0x66')],'WhatsappAccountId':_0x31797d[_0xed89('0x5a')]['id'],'WhatsappInteractionId':_0x49a97a['id'],'direction':'in','ContactId':_0x49a97a[_0xed89('0xb3')],'AttachmentId':_0x10819e[_0xed89('0x66')]['AttachmentId']});})[_0xed89('0x22')](function(_0x43c00a){_0x10819e[_0xed89('0x29')]=_0x43c00a;if(!_0x10819e[_0xed89('0xb4')][_0xed89('0xb5')])return;return db[_0xed89('0xb6')][_0xed89('0x5e')]({'attributes':['id',_0xed89('0x3c')],'where':{'id':_0x10819e['interaction']['UserId']}});})[_0xed89('0x22')](function(_0x59436e){if(_0x59436e){_0x10819e[_0xed89('0x8f')][_0xed89('0xb7')]({'id':0x0,'priority':0x0,'app':_0xed89('0xb8'),'appdata':_0x59436e['name']+','+(_0x10819e['account'][_0xed89('0xb9')]||0xa),'interval':_0xed89('0xb2')});}if(!_0x10819e[_0xed89('0xb4')][_0xed89('0xba')])return;return db[_0xed89('0xbb')][_0xed89('0x5e')]({'attributes':['id',_0xed89('0x3c')],'where':{'id':_0x10819e[_0xed89('0xb4')][_0xed89('0xba')]}});})[_0xed89('0x22')](function(_0x4cd7f2){if(_0x4cd7f2){_0x10819e[_0xed89('0x8f')][_0xed89('0xb7')]({'id':0x0,'priority':0x1,'app':_0xed89('0xbc'),'appdata':_0x4cd7f2[_0xed89('0x3c')]+','+(_0x10819e[_0xed89('0x89')]['waitForTheAssignedQueue']||0x12c),'interval':_0xed89('0xb2')});}return respondWithRpcPromise(_0xed89('0xbd'),_0xed89('0xbe'),_0x10819e);})[_0xed89('0x22')](function(_0x22eeef){if(_0x22eeef){var _0x3f9c39=0xc8;var _0x44d622='receiveMessage';logger[_0xed89('0x23')](_0xed89('0x25'),_0x44d622,_0x3f9c39,'entity\x20found');logger[_0xed89('0xbf')](_0xed89('0xc0'),_0x44d622,_0x3f9c39,_0xed89('0xc1'),JSON['stringify'](_0x22eeef));if(_0x10819e[_0xed89('0x89')][_0xed89('0x43')]===_0xed89('0xc2')){return _0x465924[_0xed89('0x2b')](_0x3f9c39)['set'](_0xed89('0xc3'),'text/xml')[_0xed89('0x3d')](_0xed89('0xc4'));}else{return _0x465924['status'](_0x3f9c39)[_0xed89('0x2d')](_0x22eeef);}}});})[_0xed89('0x58')](handleError(_0x465924,null));};exports['send']=function(_0x602ca5,_0x5f02d1,_0x107221){var _0x4c5b10,_0x3f51ab,_0x49aa3d;if(_[_0xed89('0xa2')](_0x602ca5[_0xed89('0x66')][_0xed89('0x66')])||_0x602ca5[_0xed89('0x66')][_0xed89('0x66')]===''){throw new db['Sequelize'][(_0xed89('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xed89('0xa2')](_0x602ca5[_0xed89('0x66')]['to'])){throw new db[(_0xed89('0x92'))][(_0xed89('0x93'))]('to\x20is\x20mandatory');}_0x4c5b10=_0x602ca5[_0xed89('0x66')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x602ca5[_0xed89('0x5a')]['id']},'include':[{'model':db[_0xed89('0xa7')],'as':'List','include':[{'model':db[_0xed89('0x91')],'as':_0xed89('0xa8'),'where':{'mobile':_0x4c5b10},'limit':0x1,'order':[[_0xed89('0x96'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x5f02d1,null))[_0xed89('0x22')](function(_0x4fa317){if(_0x4fa317&&_0x4fa317['List']){_0x3f51ab=_0x4fa317[_0xed89('0x38')]({'plain':!![]});if(_0x3f51ab[_0xed89('0xc5')]&&_0x3f51ab[_0xed89('0xc5')][_0xed89('0xa8')][_0xed89('0x4b')]){return _0x3f51ab['List'][_0xed89('0xa8')][0x0];}return db[_0xed89('0x91')][_0xed89('0x5f')](_['defaults'](_0x602ca5[_0xed89('0x66')],{'firstName':_0x4c5b10,'mobile':_0x4c5b10,'phone':_0x4c5b10,'ListId':_0x3f51ab[_0xed89('0xc6')]}));}})[_0xed89('0x22')](handleEntityNotFound(_0x5f02d1,null))['then'](function(_0xffb269){if(_0xffb269){_0x49aa3d=_0xffb269;return db[_0xed89('0xac')][_0xed89('0x5e')]({'where':{'ContactId':_0x49aa3d['id'],'closed':![],'WhatsappAccountId':_0x3f51ab['id']}})[_0xed89('0x22')](function(_0x38f557){if(_0x38f557){return[_0x38f557,![]];}return db['WhatsappInteraction'][_0xed89('0x5f')]({'UserId':_0x602ca5[_0xed89('0x60')]['id'],'ContactId':_0x49aa3d['id'],'WhatsappAccountId':_0x3f51ab['id'],'phone':_0x4c5b10,'firstMsgDirection':_0xed89('0xc7'),'Messages':[_[_0xed89('0x52')](_0x602ca5['body'],{'read':![],'body':_0x602ca5[_0xed89('0x66')]['body'],'phone':_0x4c5b10,'WhatsappAccountId':_0x3f51ab['id'],'UserId':_0x602ca5[_0xed89('0x60')]['id'],'ContactId':_0x49aa3d['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xed89('0xc8')}]})['then'](function(_0x510f19){return[_0x510f19,!![]];});});}})['spread'](function(_0x3c4051,_0x2cbfd7){if(_0x2cbfd7){return _0x3c4051;}return db[_0xed89('0x8e')]['create'](_[_0xed89('0x52')](_0x602ca5[_0xed89('0x66')],{'read':![],'body':_0x602ca5['body'][_0xed89('0x66')],'phone':_0x4c5b10,'WhatsappAccountId':_0x3f51ab['id'],'WhatsappInteractionId':_0x3c4051['id'],'UserId':_0x602ca5[_0xed89('0x60')]['id'],'ContactId':_0x49aa3d['id']}))[_0xed89('0x22')](function(_0x528376){_0x3c4051['dataValues'][_0xed89('0xc8')]=[];_0x3c4051[_0xed89('0xc9')][_0xed89('0xc8')][_0xed89('0xb0')](_0x528376[_0xed89('0xc9')]);return _0x3c4051;});})['then'](respondWithResult(_0x5f02d1,null))[_0xed89('0x58')](handleError(_0x5f02d1,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 025995a..f896b1b 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 _0xad7b=['save','remove','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xad7b,0x131));var _0xbad7=function(_0x41b01d,_0x384ae5){_0x41b01d=_0x41b01d-0x0;var _0x4d4393=_0xad7b[_0x41b01d];return _0x4d4393;};'use strict';var EventEmitter=require(_0xbad7('0x0'));var WhatsappAccount=require(_0xbad7('0x1'))['db'][_0xbad7('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbad7('0x3'),'afterUpdate':'update','afterDestroy':_0xbad7('0x4')};function emitEvent(_0x3de13d){return function(_0x56e6dc,_0x2ed0df,_0x198262){WhatsappAccountEvents['emit'](_0x3de13d+':'+_0x56e6dc['id'],_0x56e6dc);WhatsappAccountEvents['emit'](_0x3de13d,_0x56e6dc);_0x198262(null);};}for(var e in events){if(events[_0xbad7('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xbad7('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0xddb5=['../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x17ef7e,_0x577e24){var _0x55a982=function(_0x3d4f70){while(--_0x3d4f70){_0x17ef7e['push'](_0x17ef7e['shift']());}};_0x55a982(++_0x577e24);}(_0xddb5,0x194));var _0x5ddb=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xddb5[_0x13d07a];return _0x5ee0ee;};'use strict';var EventEmitter=require(_0x5ddb('0x0'));var WhatsappAccount=require(_0x5ddb('0x1'))['db'][_0x5ddb('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5ddb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5ddb('0x4'),'afterDestroy':_0x5ddb('0x5')};function emitEvent(_0x218c7c){return function(_0x3892f6,_0x16cc7f,_0x20aa63){WhatsappAccountEvents[_0x5ddb('0x6')](_0x218c7c+':'+_0x3892f6['id'],_0x3892f6);WhatsappAccountEvents['emit'](_0x218c7c,_0x3892f6);_0x20aa63(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x5ddb('0x7')](e,emitEvent(event));}}module[_0x5ddb('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f0202e3..b160dbe 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 _0x26b3=['api','bluebird','path','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x5856d0,_0x296932){var _0x57c019=function(_0x12689b){while(--_0x12689b){_0x5856d0['push'](_0x5856d0['shift']());}};_0x57c019(++_0x296932);}(_0x26b3,0xbb));var _0x326b=function(_0x179190,_0xf3ee46){_0x179190=_0x179190-0x0;var _0xcac7f0=_0x26b3[_0x179190];return _0xcac7f0;};'use strict';var _=require(_0x326b('0x0'));var util=require(_0x326b('0x1'));var logger=require(_0x326b('0x2'))(_0x326b('0x3'));var moment=require('moment');var BPromise=require(_0x326b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x326b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x326b('0x6'));module[_0x326b('0x7')]=function(_0x2b358a,_0x33a23d){return _0x2b358a[_0x326b('0x8')]('WhatsappAccount',attributes,{'tableName':_0x326b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8661=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x3c8757,_0x3bde2b){var _0x3baee9=function(_0x27a947){while(--_0x27a947){_0x3c8757['push'](_0x3c8757['shift']());}};_0x3baee9(++_0x3bde2b);}(_0x8661,0x12a));var _0x1866=function(_0x3c7594,_0x3b9dc8){_0x3c7594=_0x3c7594-0x0;var _0x5bf950=_0x8661[_0x3c7594];return _0x5bf950;};'use strict';var _=require(_0x1866('0x0'));var util=require(_0x1866('0x1'));var logger=require(_0x1866('0x2'))('api');var moment=require(_0x1866('0x3'));var BPromise=require(_0x1866('0x4'));var rp=require(_0x1866('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1866('0x6'));var config=require(_0x1866('0x7'));var attributes=require(_0x1866('0x8'));module[_0x1866('0x9')]=function(_0x536a8a,_0x15e6fe){return _0x536a8a[_0x1866('0xa')](_0x1866('0xb'),attributes,{'tableName':_0x1866('0xc'),'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 80af84a..eea077e 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 _0xccd8=['request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','find','raw','options','where','attributes','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xccd8,0x10b));var _0x8ccd=function(_0x39ac23,_0x41cb30){_0x39ac23=_0x39ac23-0x0;var _0x1870a2=_0xccd8[_0x39ac23];return _0x1870a2;};'use strict';var _=require(_0x8ccd('0x0'));var util=require(_0x8ccd('0x1'));var moment=require(_0x8ccd('0x2'));var BPromise=require(_0x8ccd('0x3'));var rs=require(_0x8ccd('0x4'));var fs=require('fs');var Redis=require(_0x8ccd('0x5'));var db=require(_0x8ccd('0x6'))['db'];var utils=require(_0x8ccd('0x7'));var logger=require(_0x8ccd('0x8'))(_0x8ccd('0x9'));var config=require(_0x8ccd('0xa'));var jayson=require(_0x8ccd('0xb'));var client=jayson[_0x8ccd('0xc')][_0x8ccd('0xd')]({'port':0x232a});config[_0x8ccd('0xe')]=_[_0x8ccd('0xf')](config[_0x8ccd('0xe')],{'host':_0x8ccd('0x10'),'port':0x18eb});var socket=require(_0x8ccd('0x11'))(new Redis(config[_0x8ccd('0xe')]));require(_0x8ccd('0x12'))[_0x8ccd('0x13')](socket);function respondWithRpcPromise(_0x572726,_0x3d0639,_0x5a5595){return new BPromise(function(_0x485cd7,_0x57054a){return client[_0x8ccd('0x14')](_0x572726,_0x5a5595)['then'](function(_0x3c8423){logger[_0x8ccd('0x15')](_0x8ccd('0x16'),_0x3d0639,_0x8ccd('0x17'));logger[_0x8ccd('0x18')](_0x8ccd('0x19'),_0x3d0639,_0x8ccd('0x17'),JSON[_0x8ccd('0x1a')](_0x3c8423));if(_0x3c8423[_0x8ccd('0x1b')]){if(_0x3c8423[_0x8ccd('0x1b')][_0x8ccd('0x1c')]===0x1f4){logger[_0x8ccd('0x1b')](_0x8ccd('0x16'),_0x3d0639,_0x3c8423[_0x8ccd('0x1b')][_0x8ccd('0x1d')]);return _0x57054a(_0x3c8423['error'][_0x8ccd('0x1d')]);}logger[_0x8ccd('0x1b')](_0x8ccd('0x16'),_0x3d0639,_0x3c8423[_0x8ccd('0x1b')][_0x8ccd('0x1d')]);return _0x485cd7(_0x3c8423['error'][_0x8ccd('0x1d')]);}else{logger['info'](_0x8ccd('0x16'),_0x3d0639,'request\x20sent');_0x485cd7(_0x3c8423[_0x8ccd('0x1e')][_0x8ccd('0x1d')]);}})['catch'](function(_0x5ab325){logger[_0x8ccd('0x1b')](_0x8ccd('0x16'),_0x3d0639,_0x5ab325);_0x57054a(_0x5ab325);});});}exports[_0x8ccd('0x1f')]=function(_0x5ef41b){var _0x4bc62f=this;return new Promise(function(_0x5832c0,_0x3da385){return db['WhatsappAccount'][_0x8ccd('0x20')]({'raw':_0x5ef41b['options']?_0x5ef41b['options'][_0x8ccd('0x21')]===undefined?!![]:![]:!![],'where':_0x5ef41b[_0x8ccd('0x22')]?_0x5ef41b[_0x8ccd('0x22')][_0x8ccd('0x23')]||null:null,'attributes':_0x5ef41b['options']?_0x5ef41b[_0x8ccd('0x22')][_0x8ccd('0x24')]||null:null,'include':_0x5ef41b[_0x8ccd('0x22')]?_0x5ef41b['options']['include']?_[_0x8ccd('0x25')](_0x5ef41b[_0x8ccd('0x22')]['include'],function(_0xf3c955){return{'model':db[_0xf3c955['model']],'as':_0xf3c955['as'],'attributes':_0xf3c955[_0x8ccd('0x24')],'include':_0xf3c955['include']?_[_0x8ccd('0x25')](_0xf3c955[_0x8ccd('0x26')],function(_0x229e01){return{'model':db[_0x229e01['model']],'as':_0x229e01['as'],'attributes':_0x229e01[_0x8ccd('0x24')],'include':_0x229e01[_0x8ccd('0x26')]?_[_0x8ccd('0x25')](_0x229e01[_0x8ccd('0x26')],function(_0x424e95){return{'model':db[_0x424e95[_0x8ccd('0x27')]],'as':_0x424e95['as'],'attributes':_0x424e95[_0x8ccd('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8ccd('0x28')](function(_0x450c91){logger[_0x8ccd('0x15')](_0x8ccd('0x1f'),_0x5ef41b);logger['debug'](_0x8ccd('0x1f'),_0x5ef41b,JSON[_0x8ccd('0x1a')](_0x450c91));_0x5832c0(_0x450c91);})['catch'](function(_0x41f9d8){logger[_0x8ccd('0x1b')]('ShowWhatsappAccount',_0x41f9d8[_0x8ccd('0x1d')],_0x5ef41b);_0x3da385(_0x4bc62f[_0x8ccd('0x1b')](0x1f4,_0x41f9d8['message']));});});}; \ No newline at end of file +var _0xa3df=['request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','model','map','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','then','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa3df,0x144));var _0xfa3d=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa3df[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfa3d('0x0'));var rs=require(_0xfa3d('0x1'));var fs=require('fs');var Redis=require(_0xfa3d('0x2'));var db=require(_0xfa3d('0x3'))['db'];var utils=require(_0xfa3d('0x4'));var logger=require(_0xfa3d('0x5'))('rpc');var config=require(_0xfa3d('0x6'));var jayson=require(_0xfa3d('0x7'));var client=jayson['client'][_0xfa3d('0x8')]({'port':0x232a});config[_0xfa3d('0x9')]=_[_0xfa3d('0xa')](config[_0xfa3d('0x9')],{'host':_0xfa3d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa3d('0x9')]));require('./whatsappAccount.socket')[_0xfa3d('0xc')](socket);function respondWithRpcPromise(_0x1ed9b0,_0x4c34e9,_0x25348d){return new BPromise(function(_0xca585c,_0x446592){return client[_0xfa3d('0xd')](_0x1ed9b0,_0x25348d)[_0xfa3d('0xe')](function(_0x339a7c){logger[_0xfa3d('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x4c34e9,_0xfa3d('0x10'));logger[_0xfa3d('0x11')](_0xfa3d('0x12'),_0x4c34e9,_0xfa3d('0x10'),JSON[_0xfa3d('0x13')](_0x339a7c));if(_0x339a7c[_0xfa3d('0x14')]){if(_0x339a7c['error'][_0xfa3d('0x15')]===0x1f4){logger['error'](_0xfa3d('0x16'),_0x4c34e9,_0x339a7c['error'][_0xfa3d('0x17')]);return _0x446592(_0x339a7c[_0xfa3d('0x14')][_0xfa3d('0x17')]);}logger[_0xfa3d('0x14')](_0xfa3d('0x16'),_0x4c34e9,_0x339a7c['error']['message']);return _0xca585c(_0x339a7c['error']['message']);}else{logger[_0xfa3d('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x4c34e9,_0xfa3d('0x10'));_0xca585c(_0x339a7c['result']['message']);}})[_0xfa3d('0x18')](function(_0x19c2c1){logger[_0xfa3d('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x4c34e9,_0x19c2c1);_0x446592(_0x19c2c1);});});}exports[_0xfa3d('0x19')]=function(_0x11d670){var _0x21b050=this;return new Promise(function(_0x3dcb61,_0x47f6b0){return db[_0xfa3d('0x1a')][_0xfa3d('0x1b')]({'raw':_0x11d670[_0xfa3d('0x1c')]?_0x11d670[_0xfa3d('0x1c')][_0xfa3d('0x1d')]===undefined?!![]:![]:!![],'where':_0x11d670[_0xfa3d('0x1c')]?_0x11d670['options']['where']||null:null,'attributes':_0x11d670[_0xfa3d('0x1c')]?_0x11d670[_0xfa3d('0x1c')][_0xfa3d('0x1e')]||null:null,'include':_0x11d670[_0xfa3d('0x1c')]?_0x11d670[_0xfa3d('0x1c')][_0xfa3d('0x1f')]?_['map'](_0x11d670['options']['include'],function(_0x2828ba){return{'model':db[_0x2828ba[_0xfa3d('0x20')]],'as':_0x2828ba['as'],'attributes':_0x2828ba['attributes'],'include':_0x2828ba[_0xfa3d('0x1f')]?_['map'](_0x2828ba[_0xfa3d('0x1f')],function(_0x5884a1){return{'model':db[_0x5884a1['model']],'as':_0x5884a1['as'],'attributes':_0x5884a1['attributes'],'include':_0x5884a1[_0xfa3d('0x1f')]?_[_0xfa3d('0x21')](_0x5884a1['include'],function(_0x1f8727){return{'model':db[_0x1f8727[_0xfa3d('0x20')]],'as':_0x1f8727['as'],'attributes':_0x1f8727['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa3d('0xe')](function(_0x3b9815){logger[_0xfa3d('0xf')](_0xfa3d('0x19'),_0x11d670);logger[_0xfa3d('0x11')](_0xfa3d('0x19'),_0x11d670,JSON['stringify'](_0x3b9815));_0x3dcb61(_0x3b9815);})[_0xfa3d('0x18')](function(_0x33711a){logger[_0xfa3d('0x14')](_0xfa3d('0x19'),_0x33711a[_0xfa3d('0x17')],_0x11d670);_0x47f6b0(_0x21b050[_0xfa3d('0x14')](0x1f4,_0x33711a[_0xfa3d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 248f093..385bf95 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 _0xbd98=['./whatsappAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0xbd98,0x120));var _0x8bd9=function(_0x120694,_0x24aaba){_0x120694=_0x120694-0x0;var _0x188da3=_0xbd98[_0x120694];return _0x188da3;};'use strict';var WhatsappAccountEvents=require(_0x8bd9('0x0'));var events=[_0x8bd9('0x1'),_0x8bd9('0x2'),_0x8bd9('0x3')];function createListener(_0x59876f,_0x47e560){return function(_0x369848){_0x47e560[_0x8bd9('0x4')](_0x59876f,_0x369848);};}function removeListener(_0x1b2f02,_0x55df61){return function(){WhatsappAccountEvents[_0x8bd9('0x5')](_0x1b2f02,_0x55df61);};}exports[_0x8bd9('0x6')]=function(_0x46e824){for(var _0x4edde0=0x0,_0x1792b0=events[_0x8bd9('0x7')];_0x4edde0<_0x1792b0;_0x4edde0++){var _0x2128c3=events[_0x4edde0];var _0x27bafb=createListener('whatsappAccount:'+_0x2128c3,_0x46e824);WhatsappAccountEvents['on'](_0x2128c3,_0x27bafb);}}; \ No newline at end of file +var _0x2b4b=['save','emit','removeListener','register','length','whatsappAccount:'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x2b4b,0x7e));var _0xb2b4=function(_0xb69b0d,_0x1debfa){_0xb69b0d=_0xb69b0d-0x0;var _0xee0a1e=_0x2b4b[_0xb69b0d];return _0xee0a1e;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xb2b4('0x0'),'remove','update'];function createListener(_0x292b59,_0x488ac6){return function(_0x3516fb){_0x488ac6[_0xb2b4('0x1')](_0x292b59,_0x3516fb);};}function removeListener(_0x5ea9da,_0x49f150){return function(){WhatsappAccountEvents[_0xb2b4('0x2')](_0x5ea9da,_0x49f150);};}exports[_0xb2b4('0x3')]=function(_0x28ca5c){for(var _0x252849=0x0,_0x39c81e=events[_0xb2b4('0x4')];_0x252849<_0x39c81e;_0x252849++){var _0x3e73bb=events[_0x252849];var _0x5df137=createListener(_0xb2b4('0x5')+_0x3e73bb,_0x28ca5c);WhatsappAccountEvents['on'](_0x3e73bb,_0x5df137);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 30303e2..38f6ac4 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 _0x952f=['show','post','put','update','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id'];(function(_0x532f4f,_0x2ef9be){var _0x38bcd7=function(_0x2b6f90){while(--_0x2b6f90){_0x532f4f['push'](_0x532f4f['shift']());}};_0x38bcd7(++_0x2ef9be);}(_0x952f,0x1c4));var _0xf952=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x952f[_0x44268d];return _0x4be92d;};'use strict';var multer=require('multer');var util=require(_0xf952('0x0'));var path=require(_0xf952('0x1'));var timeout=require(_0xf952('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf952('0x3'));var auth=require(_0xf952('0x4'));var interaction=require(_0xf952('0x5'));var config=require(_0xf952('0x6'));var controller=require(_0xf952('0x7'));router['get']('/',auth[_0xf952('0x8')](),controller[_0xf952('0x9')]);router[_0xf952('0xa')](_0xf952('0xb'),auth[_0xf952('0x8')](),controller[_0xf952('0xc')]);router[_0xf952('0xd')]('/',auth[_0xf952('0x8')](),controller['create']);router[_0xf952('0xe')](_0xf952('0xb'),auth['isAuthenticated'](),controller[_0xf952('0xf')]);router['delete']('/:id',auth[_0xf952('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2cfb=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','put','/:id','update','delete','destroy','exports'];(function(_0x15e94a,_0x4778a1){var _0x2ec150=function(_0x3d1475){while(--_0x3d1475){_0x15e94a['push'](_0x15e94a['shift']());}};_0x2ec150(++_0x4778a1);}(_0x2cfb,0x7e));var _0xb2cf=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x2cfb[_0x344a3f];return _0x264712;};'use strict';var multer=require(_0xb2cf('0x0'));var util=require('util');var path=require(_0xb2cf('0x1'));var timeout=require(_0xb2cf('0x2'));var express=require(_0xb2cf('0x3'));var router=express[_0xb2cf('0x4')]();var fs_extra=require(_0xb2cf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb2cf('0x6'));var config=require(_0xb2cf('0x7'));var controller=require('./whatsappApplication.controller');router[_0xb2cf('0x8')]('/',auth[_0xb2cf('0x9')](),controller[_0xb2cf('0xa')]);router[_0xb2cf('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb2cf('0xb')]);router['post']('/',auth[_0xb2cf('0x9')](),controller['create']);router[_0xb2cf('0xc')](_0xb2cf('0xd'),auth['isAuthenticated'](),controller[_0xb2cf('0xe')]);router[_0xb2cf('0xf')]('/:id',auth[_0xb2cf('0x9')](),controller[_0xb2cf('0x10')]);module[_0xb2cf('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 55a8496..1d22254 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 _0x34e4=['INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x29db87,_0x73748){var _0x69d994=function(_0x134370){while(--_0x134370){_0x29db87['push'](_0x29db87['shift']());}};_0x69d994(++_0x73748);}(_0x34e4,0x18a));var _0x434e=function(_0x2f3d0e,_0x1d79a0){_0x2f3d0e=_0x2f3d0e-0x0;var _0x23c683=_0x34e4[_0x2f3d0e];return _0x23c683;};'use strict';var Sequelize=require(_0x434e('0x0'));module['exports']={'priority':{'type':Sequelize[_0x434e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x434e('0x2')],'allowNull':![],'defaultValue':_0x434e('0x3')},'appdata':{'type':Sequelize[_0x434e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x434e('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xdecf=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4985e2,_0x248572){var _0x2db0e6=function(_0x13d534){while(--_0x13d534){_0x4985e2['push'](_0x4985e2['shift']());}};_0x2db0e6(++_0x248572);}(_0xdecf,0x14d));var _0xfdec=function(_0x510ad5,_0x43d8de){_0x510ad5=_0x510ad5-0x0;var _0x579aae=_0xdecf[_0x510ad5];return _0x579aae;};'use strict';var Sequelize=require(_0xfdec('0x0'));module[_0xfdec('0x1')]={'priority':{'type':Sequelize[_0xfdec('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfdec('0x3')],'allowNull':![],'defaultValue':_0xfdec('0x4')},'appdata':{'type':Sequelize[_0xfdec('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfdec('0x3')],'defaultValue':_0xfdec('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 898ea76..b926e0d 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 _0x6b19=['name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x2896f6,_0x180922){var _0x42d237=function(_0x3fa515){while(--_0x3fa515){_0x2896f6['push'](_0x2896f6['shift']());}};_0x42d237(++_0x180922);}(_0x6b19,0xf4));var _0x96b1=function(_0x50907b,_0xceb784){_0x50907b=_0x50907b-0x0;var _0x36739c=_0x6b19[_0x50907b];return _0x36739c;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96b1('0x1'));var jsonpatch=require(_0x96b1('0x2'));var rp=require('request-promise');var moment=require(_0x96b1('0x3'));var BPromise=require(_0x96b1('0x4'));var Mustache=require(_0x96b1('0x5'));var util=require(_0x96b1('0x6'));var path=require('path');var sox=require(_0x96b1('0x7'));var csv=require(_0x96b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96b1('0x9'));var squel=require(_0x96b1('0xa'));var crypto=require('crypto');var jsforce=require(_0x96b1('0xb'));var deskjs=require(_0x96b1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x96b1('0xd'));var Papa=require(_0x96b1('0xe'));var Redis=require(_0x96b1('0xf'));var authService=require(_0x96b1('0x10'));var qs=require(_0x96b1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96b1('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x96b1('0x13'));var db=require(_0x96b1('0x14'))['db'];function respondWithStatusCode(_0x16ee32,_0x1d942a){_0x1d942a=_0x1d942a||0xcc;return function(_0x2d7569){if(_0x2d7569){return _0x16ee32['sendStatus'](_0x1d942a);}return _0x16ee32[_0x96b1('0x15')](_0x1d942a)[_0x96b1('0x16')]();};}function respondWithResult(_0xe809b6,_0x2dbaac){_0x2dbaac=_0x2dbaac||0xc8;return function(_0x28b596){if(_0x28b596){return _0xe809b6[_0x96b1('0x15')](_0x2dbaac)[_0x96b1('0x17')](_0x28b596);}};}function respondWithFilteredResult(_0x1e5fdf,_0x3ba832){return function(_0x5772d3){if(_0x5772d3){var _0x2e9615=typeof _0x3ba832[_0x96b1('0x18')]===_0x96b1('0x19')&&typeof _0x3ba832[_0x96b1('0x1a')]===_0x96b1('0x19');var _0x23852a=_0x5772d3[_0x96b1('0x1b')];var _0x41227b=_0x2e9615?0x0:_0x3ba832[_0x96b1('0x18')];var _0x44cc44=_0x2e9615?_0x5772d3[_0x96b1('0x1b')]:_0x3ba832['offset']+_0x3ba832['limit'];var _0x151178;if(_0x44cc44>=_0x23852a){_0x44cc44=_0x23852a;_0x151178=0xc8;}else{_0x151178=0xce;}_0x1e5fdf['status'](_0x151178);return _0x1e5fdf['set'](_0x96b1('0x1c'),_0x41227b+'-'+_0x44cc44+'/'+_0x23852a)[_0x96b1('0x17')](_0x5772d3);}return null;};}function patchUpdates(_0x2bb819){return function(_0x4f0d78){try{jsonpatch[_0x96b1('0x1d')](_0x4f0d78,_0x2bb819,!![]);}catch(_0x3954e3){return BPromise[_0x96b1('0x1e')](_0x3954e3);}return _0x4f0d78[_0x96b1('0x1f')]();};}function saveUpdates(_0x1e1436,_0x276919){return function(_0x416022){if(_0x416022){return _0x416022[_0x96b1('0x20')](_0x1e1436)[_0x96b1('0x21')](function(_0x3a17d3){return _0x3a17d3;});}return null;};}function removeEntity(_0x2acd58,_0x1b0f88){return function(_0x295f05){if(_0x295f05){return _0x295f05[_0x96b1('0x22')]()[_0x96b1('0x21')](function(){_0x2acd58[_0x96b1('0x15')](0xcc)[_0x96b1('0x16')]();});}};}function handleEntityNotFound(_0x5b19b6,_0x3f5049){return function(_0x226603){if(!_0x226603){_0x5b19b6[_0x96b1('0x23')](0x194);}return _0x226603;};}function handleError(_0x321863,_0x3b7492){_0x3b7492=_0x3b7492||0x1f4;return function(_0x2ad760){logger['error'](_0x2ad760['stack']);if(_0x2ad760[_0x96b1('0x24')]){delete _0x2ad760['name'];}_0x321863[_0x96b1('0x15')](_0x3b7492)[_0x96b1('0x25')](_0x2ad760);};}exports[_0x96b1('0x26')]=function(_0x106864,_0x4e4426){var _0x59fc7c={},_0x45c20e={},_0x9fc960={'count':0x0,'rows':[]};var _0x5a9332=_[_0x96b1('0x27')](db[_0x96b1('0x28')][_0x96b1('0x29')],function(_0x2262ad){return{'name':_0x2262ad[_0x96b1('0x2a')],'type':_0x2262ad[_0x96b1('0x2b')]['key']};});_0x45c20e[_0x96b1('0x2c')]=_[_0x96b1('0x27')](_0x5a9332,_0x96b1('0x24'));_0x45c20e[_0x96b1('0x2d')]=_[_0x96b1('0x2e')](_0x106864[_0x96b1('0x2d')]);_0x45c20e[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x45c20e['model'],_0x45c20e[_0x96b1('0x2d')]);_0x59fc7c[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x45c20e[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x59fc7c[_0x96b1('0x31')]=_0x59fc7c['attributes'][_0x96b1('0x33')]?_0x59fc7c[_0x96b1('0x31')]:_0x45c20e[_0x96b1('0x2c')];if(!_0x106864['query']['hasOwnProperty'](_0x96b1('0x34'))){_0x59fc7c[_0x96b1('0x1a')]=qs['limit'](_0x106864['query']['limit']);_0x59fc7c[_0x96b1('0x18')]=qs[_0x96b1('0x18')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x18')]);}_0x59fc7c[_0x96b1('0x35')]=qs[_0x96b1('0x36')](_0x106864[_0x96b1('0x2d')]['sort']);_0x59fc7c[_0x96b1('0x37')]=qs['filters'](_['pick'](_0x106864[_0x96b1('0x2d')],_0x45c20e[_0x96b1('0x2f')]),_0x5a9332);if(_0x106864['query'][_0x96b1('0x38')]){_0x59fc7c[_0x96b1('0x37')]=_[_0x96b1('0x39')](_0x59fc7c[_0x96b1('0x37')],{'$or':_[_0x96b1('0x27')](_0x5a9332,function(_0x49a5d7){if(_0x49a5d7[_0x96b1('0x2b')]!==_0x96b1('0x3a')){var _0x35ea21={};_0x35ea21[_0x49a5d7['name']]={'$like':'%'+_0x106864[_0x96b1('0x2d')]['filter']+'%'};return _0x35ea21;}})});}_0x59fc7c=_[_0x96b1('0x39')]({},_0x59fc7c,_0x106864['options']);var _0x53e072={'where':_0x59fc7c[_0x96b1('0x37')]};return db[_0x96b1('0x28')][_0x96b1('0x1b')](_0x53e072)[_0x96b1('0x21')](function(_0x4833c0){_0x9fc960[_0x96b1('0x1b')]=_0x4833c0;if(_0x106864[_0x96b1('0x2d')][_0x96b1('0x3b')]){_0x59fc7c[_0x96b1('0x3c')]=[{'all':!![]}];}return db[_0x96b1('0x28')][_0x96b1('0x3d')](_0x59fc7c);})[_0x96b1('0x21')](function(_0x52c232){_0x9fc960[_0x96b1('0x3e')]=_0x52c232;return _0x9fc960;})[_0x96b1('0x21')](respondWithFilteredResult(_0x4e4426,_0x59fc7c))[_0x96b1('0x3f')](handleError(_0x4e4426,null));};exports[_0x96b1('0x40')]=function(_0x50949f,_0x101253){var _0x40adda={'raw':!![],'where':{'id':_0x50949f[_0x96b1('0x41')]['id']}},_0x40a022={};_0x40a022[_0x96b1('0x2c')]=_[_0x96b1('0x2e')](db[_0x96b1('0x28')]['rawAttributes']);_0x40a022[_0x96b1('0x2d')]=_['keys'](_0x50949f[_0x96b1('0x2d')]);_0x40a022[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],_0x40a022[_0x96b1('0x2d')]);_0x40adda[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x50949f[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x40adda[_0x96b1('0x31')]=_0x40adda['attributes']['length']?_0x40adda[_0x96b1('0x31')]:_0x40a022['model'];if(_0x50949f['query'][_0x96b1('0x3b')]){_0x40adda['include']=[{'all':!![]}];}_0x40adda=_[_0x96b1('0x39')]({},_0x40adda,_0x50949f[_0x96b1('0x42')]);return db[_0x96b1('0x28')]['find'](_0x40adda)[_0x96b1('0x21')](handleEntityNotFound(_0x101253,null))[_0x96b1('0x21')](respondWithResult(_0x101253,null))[_0x96b1('0x3f')](handleError(_0x101253,null));};exports[_0x96b1('0x43')]=function(_0x584582,_0x27be9f){return db['WhatsappApplication'][_0x96b1('0x43')](_0x584582[_0x96b1('0x44')],{})[_0x96b1('0x21')](respondWithResult(_0x27be9f,0xc9))[_0x96b1('0x3f')](handleError(_0x27be9f,null));};exports[_0x96b1('0x20')]=function(_0x3070da,_0x248844){if(_0x3070da[_0x96b1('0x44')]['id']){delete _0x3070da['body']['id'];}return db[_0x96b1('0x28')][_0x96b1('0x45')]({'where':{'id':_0x3070da['params']['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x248844,null))[_0x96b1('0x21')](saveUpdates(_0x3070da[_0x96b1('0x44')],null))[_0x96b1('0x21')](respondWithResult(_0x248844,null))[_0x96b1('0x3f')](handleError(_0x248844,null));};exports[_0x96b1('0x22')]=function(_0x404848,_0x2159ba){return db[_0x96b1('0x28')]['find']({'where':{'id':_0x404848[_0x96b1('0x41')]['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x2159ba,null))[_0x96b1('0x21')](removeEntity(_0x2159ba,null))[_0x96b1('0x3f')](handleError(_0x2159ba,null));}; \ No newline at end of file +var _0x751c=['destroy','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','options','count','includeAll','include','findAll','catch','params','merge','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','reject','save','update','then'];(function(_0x48ccc1,_0x55e9cb){var _0x9ffe13=function(_0x323a36){while(--_0x323a36){_0x48ccc1['push'](_0x48ccc1['shift']());}};_0x9ffe13(++_0x55e9cb);}(_0x751c,0x69));var _0xc751=function(_0x4c135d,_0x2b9de7){_0x4c135d=_0x4c135d-0x0;var _0x2e352d=_0x751c[_0x4c135d];return _0x2e352d;};'use strict';var emlformat=require(_0xc751('0x0'));var rimraf=require(_0xc751('0x1'));var zipdir=require(_0xc751('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc751('0x3'));var moment=require('moment');var BPromise=require(_0xc751('0x4'));var Mustache=require('mustache');var util=require(_0xc751('0x5'));var path=require(_0xc751('0x6'));var sox=require(_0xc751('0x7'));var csv=require(_0xc751('0x8'));var ejs=require(_0xc751('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc751('0xa'));var squel=require(_0xc751('0xb'));var crypto=require('crypto');var jsforce=require(_0xc751('0xc'));var deskjs=require(_0xc751('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc751('0xe'));var Papa=require(_0xc751('0xf'));var Redis=require(_0xc751('0x10'));var authService=require(_0xc751('0x11'));var qs=require(_0xc751('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc751('0x13'));var utils=require('../../config/utils');var config=require(_0xc751('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc751('0x15'))['db'];function respondWithStatusCode(_0x21cfff,_0x4221ce){_0x4221ce=_0x4221ce||0xcc;return function(_0x490214){if(_0x490214){return _0x21cfff[_0xc751('0x16')](_0x4221ce);}return _0x21cfff['status'](_0x4221ce)[_0xc751('0x17')]();};}function respondWithResult(_0x497cf7,_0x3dafe4){_0x3dafe4=_0x3dafe4||0xc8;return function(_0x405e49){if(_0x405e49){return _0x497cf7[_0xc751('0x18')](_0x3dafe4)[_0xc751('0x19')](_0x405e49);}};}function respondWithFilteredResult(_0x17af51,_0x5a7d75){return function(_0x3ca29d){if(_0x3ca29d){var _0x184f0e=typeof _0x5a7d75[_0xc751('0x1a')]===_0xc751('0x1b')&&typeof _0x5a7d75[_0xc751('0x1c')]===_0xc751('0x1b');var _0x49411d=_0x3ca29d['count'];var _0x6884e0=_0x184f0e?0x0:_0x5a7d75[_0xc751('0x1a')];var _0x1e98f1=_0x184f0e?_0x3ca29d['count']:_0x5a7d75[_0xc751('0x1a')]+_0x5a7d75[_0xc751('0x1c')];var _0x5a074b;if(_0x1e98f1>=_0x49411d){_0x1e98f1=_0x49411d;_0x5a074b=0xc8;}else{_0x5a074b=0xce;}_0x17af51[_0xc751('0x18')](_0x5a074b);return _0x17af51['set']('Content-Range',_0x6884e0+'-'+_0x1e98f1+'/'+_0x49411d)[_0xc751('0x19')](_0x3ca29d);}return null;};}function patchUpdates(_0x55bd5c){return function(_0x2cef60){try{jsonpatch['apply'](_0x2cef60,_0x55bd5c,!![]);}catch(_0x350090){return BPromise[_0xc751('0x1d')](_0x350090);}return _0x2cef60[_0xc751('0x1e')]();};}function saveUpdates(_0x419794,_0x3ad3e7){return function(_0x3be4eb){if(_0x3be4eb){return _0x3be4eb[_0xc751('0x1f')](_0x419794)[_0xc751('0x20')](function(_0x154625){return _0x154625;});}return null;};}function removeEntity(_0x37c921,_0x4df4a4){return function(_0x5b9413){if(_0x5b9413){return _0x5b9413[_0xc751('0x21')]()['then'](function(){_0x37c921['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3210a4,_0x446d23){return function(_0xf61b04){if(!_0xf61b04){_0x3210a4['sendStatus'](0x194);}return _0xf61b04;};}function handleError(_0x2a3052,_0x394a7d){_0x394a7d=_0x394a7d||0x1f4;return function(_0x2f64b9){logger[_0xc751('0x22')](_0x2f64b9['stack']);if(_0x2f64b9[_0xc751('0x23')]){delete _0x2f64b9[_0xc751('0x23')];}_0x2a3052['status'](_0x394a7d)['send'](_0x2f64b9);};}exports[_0xc751('0x24')]=function(_0x212385,_0x37b573){var _0x4286e0={},_0xbf05e={},_0x3a5f89={'count':0x0,'rows':[]};var _0x1e3a07=_[_0xc751('0x25')](db[_0xc751('0x26')][_0xc751('0x27')],function(_0x4d01ab){return{'name':_0x4d01ab[_0xc751('0x28')],'type':_0x4d01ab[_0xc751('0x29')][_0xc751('0x2a')]};});_0xbf05e[_0xc751('0x2b')]=_[_0xc751('0x25')](_0x1e3a07,_0xc751('0x23'));_0xbf05e['query']=_[_0xc751('0x2c')](_0x212385[_0xc751('0x2d')]);_0xbf05e['filters']=_[_0xc751('0x2e')](_0xbf05e[_0xc751('0x2b')],_0xbf05e[_0xc751('0x2d')]);_0x4286e0[_0xc751('0x2f')]=_['intersection'](_0xbf05e['model'],qs[_0xc751('0x30')](_0x212385[_0xc751('0x2d')]['fields']));_0x4286e0[_0xc751('0x2f')]=_0x4286e0[_0xc751('0x2f')][_0xc751('0x31')]?_0x4286e0[_0xc751('0x2f')]:_0xbf05e[_0xc751('0x2b')];if(!_0x212385[_0xc751('0x2d')][_0xc751('0x32')](_0xc751('0x33'))){_0x4286e0[_0xc751('0x1c')]=qs[_0xc751('0x1c')](_0x212385['query'][_0xc751('0x1c')]);_0x4286e0['offset']=qs[_0xc751('0x1a')](_0x212385[_0xc751('0x2d')][_0xc751('0x1a')]);}_0x4286e0[_0xc751('0x34')]=qs['sort'](_0x212385['query'][_0xc751('0x35')]);_0x4286e0['where']=qs[_0xc751('0x36')](_['pick'](_0x212385[_0xc751('0x2d')],_0xbf05e[_0xc751('0x36')]),_0x1e3a07);if(_0x212385[_0xc751('0x2d')][_0xc751('0x37')]){_0x4286e0[_0xc751('0x38')]=_['merge'](_0x4286e0[_0xc751('0x38')],{'$or':_['map'](_0x1e3a07,function(_0x3e4377){if(_0x3e4377[_0xc751('0x29')]!==_0xc751('0x39')){var _0x38c35c={};_0x38c35c[_0x3e4377['name']]={'$like':'%'+_0x212385['query'][_0xc751('0x37')]+'%'};return _0x38c35c;}})});}_0x4286e0=_['merge']({},_0x4286e0,_0x212385[_0xc751('0x3a')]);var _0x35adde={'where':_0x4286e0[_0xc751('0x38')]};return db[_0xc751('0x26')]['count'](_0x35adde)[_0xc751('0x20')](function(_0x31c795){_0x3a5f89[_0xc751('0x3b')]=_0x31c795;if(_0x212385[_0xc751('0x2d')][_0xc751('0x3c')]){_0x4286e0[_0xc751('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xc751('0x3e')](_0x4286e0);})['then'](function(_0x433d4d){_0x3a5f89['rows']=_0x433d4d;return _0x3a5f89;})[_0xc751('0x20')](respondWithFilteredResult(_0x37b573,_0x4286e0))[_0xc751('0x3f')](handleError(_0x37b573,null));};exports['show']=function(_0x35fb80,_0x132935){var _0x2b5a52={'raw':!![],'where':{'id':_0x35fb80[_0xc751('0x40')]['id']}},_0x4d30f9={};_0x4d30f9[_0xc751('0x2b')]=_['keys'](db[_0xc751('0x26')][_0xc751('0x27')]);_0x4d30f9[_0xc751('0x2d')]=_['keys'](_0x35fb80[_0xc751('0x2d')]);_0x4d30f9['filters']=_['intersection'](_0x4d30f9[_0xc751('0x2b')],_0x4d30f9[_0xc751('0x2d')]);_0x2b5a52[_0xc751('0x2f')]=_['intersection'](_0x4d30f9[_0xc751('0x2b')],qs[_0xc751('0x30')](_0x35fb80[_0xc751('0x2d')][_0xc751('0x30')]));_0x2b5a52[_0xc751('0x2f')]=_0x2b5a52[_0xc751('0x2f')]['length']?_0x2b5a52[_0xc751('0x2f')]:_0x4d30f9[_0xc751('0x2b')];if(_0x35fb80[_0xc751('0x2d')]['includeAll']){_0x2b5a52[_0xc751('0x3d')]=[{'all':!![]}];}_0x2b5a52=_[_0xc751('0x41')]({},_0x2b5a52,_0x35fb80[_0xc751('0x3a')]);return db[_0xc751('0x26')][_0xc751('0x42')](_0x2b5a52)['then'](handleEntityNotFound(_0x132935,null))[_0xc751('0x20')](respondWithResult(_0x132935,null))[_0xc751('0x3f')](handleError(_0x132935,null));};exports['create']=function(_0x544e79,_0x1273fe){return db[_0xc751('0x26')][_0xc751('0x43')](_0x544e79['body'],{})[_0xc751('0x20')](respondWithResult(_0x1273fe,0xc9))[_0xc751('0x3f')](handleError(_0x1273fe,null));};exports[_0xc751('0x1f')]=function(_0x1b3e07,_0x210095){if(_0x1b3e07[_0xc751('0x44')]['id']){delete _0x1b3e07['body']['id'];}return db[_0xc751('0x26')][_0xc751('0x42')]({'where':{'id':_0x1b3e07[_0xc751('0x40')]['id']}})['then'](handleEntityNotFound(_0x210095,null))['then'](saveUpdates(_0x1b3e07['body'],null))['then'](respondWithResult(_0x210095,null))['catch'](handleError(_0x210095,null));};exports[_0xc751('0x21')]=function(_0x3082f4,_0x192607){return db[_0xc751('0x26')][_0xc751('0x42')]({'where':{'id':_0x3082f4[_0xc751('0x40')]['id']}})[_0xc751('0x20')](handleEntityNotFound(_0x192607,null))['then'](removeEntity(_0x192607,null))[_0xc751('0x3f')](handleError(_0x192607,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b6f9dc7..682af83 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 _0xac31=['request-promise','rimraf','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x402eff,_0x2525f2){var _0x2eb371=function(_0x15e9b3){while(--_0x15e9b3){_0x402eff['push'](_0x402eff['shift']());}};_0x2eb371(++_0x2525f2);}(_0xac31,0xca));var _0x1ac3=function(_0x428b98,_0x117fe3){_0x428b98=_0x428b98-0x0;var _0x59b23f=_0xac31[_0x428b98];return _0x59b23f;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1ac3('0xc')});}; \ No newline at end of file +var _0x3edc=['request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3edc,0x1ae));var _0xc3ed=function(_0xafceaf,_0x5c65ad){_0xafceaf=_0xafceaf-0x0;var _0x3684e4=_0x3edc[_0xafceaf];return _0x3684e4;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require(_0xc3ed('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ed('0x6'));var config=require(_0xc3ed('0x7'));var attributes=require(_0xc3ed('0x8'));module[_0xc3ed('0x9')]=function(_0x3f8468,_0x50b95c){return _0x3f8468[_0xc3ed('0xa')](_0xc3ed('0xb'),attributes,{'tableName':_0xc3ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc3ed('0xd'),'collate':_0xc3ed('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 798e3c4..b0aa1cb 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 _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x511faa,_0x46a144){var _0x1a3c23=function(_0x2148b7){while(--_0x2148b7){_0x511faa['push'](_0x511faa['shift']());}};_0x1a3c23(++_0x46a144);}(_0x668b,0x140));var _0xb668=function(_0x2742db,_0x58e00c){_0x2742db=_0x2742db-0x0;var _0x18659e=_0x668b[_0x2742db];return _0x18659e;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file +var _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x44fbdc,_0x418c5e){var _0x5cc4a9=function(_0x414e67){while(--_0x414e67){_0x44fbdc['push'](_0x44fbdc['shift']());}};_0x5cc4a9(++_0x418c5e);}(_0x207c,0x1e8));var _0xc207=function(_0x402baa,_0x713d8d){_0x402baa=_0x402baa-0x0;var _0x11fcaa=_0x207c[_0x402baa];return _0x11fcaa;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 995a2ee..9ee6240 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 _0x4745=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4785ea,_0x5b3f4e){var _0xa46dae=function(_0x5dd34e){while(--_0x5dd34e){_0x4785ea['push'](_0x4785ea['shift']());}};_0xa46dae(++_0x5b3f4e);}(_0x4745,0x1e7));var _0x5474=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4745[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var path=require(_0x5474('0x2'));var timeout=require(_0x5474('0x3'));var express=require(_0x5474('0x4'));var router=express[_0x5474('0x5')]();var fs_extra=require(_0x5474('0x6'));var auth=require(_0x5474('0x7'));var interaction=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var controller=require(_0x5474('0xa'));router[_0x5474('0xb')]('/',auth['isAuthenticated'](),controller[_0x5474('0xc')]);router[_0x5474('0xb')]('/describe',auth[_0x5474('0xd')](),controller['describe']);router[_0x5474('0xb')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0xf')]);router[_0x5474('0xb')](_0x5474('0x10'),auth[_0x5474('0xd')](),controller[_0x5474('0x11')]);router[_0x5474('0xb')](_0x5474('0x12'),auth[_0x5474('0xd')](),controller['download']);router[_0x5474('0x13')]('/',auth[_0x5474('0xd')](),controller[_0x5474('0x14')]);router[_0x5474('0x13')](_0x5474('0x10'),auth[_0x5474('0xd')](),controller[_0x5474('0x15')]);router[_0x5474('0x13')](_0x5474('0x16'),auth['isAuthenticated'](),interaction[_0x5474('0x17')](_0x5474('0x18'),_0x5474('0x19')),controller[_0x5474('0x1a')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x5474('0x18'),_0x5474('0x1b')),controller[_0x5474('0x1c')]);router['delete'](_0x5474('0xe'),auth[_0x5474('0xd')](),interaction['tracked'](_0x5474('0x18'),_0x5474('0x1d')),controller[_0x5474('0x1e')]);router[_0x5474('0x1f')](_0x5474('0x16'),auth['isAuthenticated'](),controller[_0x5474('0x20')]);module['exports']=router; \ No newline at end of file +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(_0x1ca5fa,_0xdff97a){var _0x2c963f=function(_0x5adb2c){while(--_0x5adb2c){_0x1ca5fa['push'](_0x1ca5fa['shift']());}};_0x2c963f(++_0xdff97a);}(_0x326f,0xd1));var _0xf326=function(_0x1fde12,_0x43fc5f){_0x1fde12=_0x1fde12-0x0;var _0x15f743=_0x326f[_0x1fde12];return _0x15f743;};'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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index a8ee500..e0fcfd6 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 _0x352e=['moment','exports','BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize'];(function(_0x16cd0f,_0x1c7184){var _0x595bac=function(_0x2ce8b4){while(--_0x2ce8b4){_0x16cd0f['push'](_0x16cd0f['shift']());}};_0x595bac(++_0x1c7184);}(_0x352e,0x1a6));var _0xe352=function(_0x467d9a,_0x43d804){_0x467d9a=_0x467d9a-0x0;var _0x2b4d2d=_0x352e[_0x467d9a];return _0x2b4d2d;};'use strict';var Sequelize=require(_0xe352('0x0'));var moment=require(_0xe352('0x1'));module[_0xe352('0x2')]={'closed':{'type':Sequelize[_0xe352('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe352('0x4')]},'disposition':{'type':Sequelize[_0xe352('0x5')]},'secondDisposition':{'type':Sequelize[_0xe352('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe352('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe352('0x5')]},'read1stAt':{'type':Sequelize[_0xe352('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe352('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe352('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe352('0x7')]('in',_0xe352('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe352('0x8')]}}; \ No newline at end of file +var _0xc7da=['out','INTEGER','sequelize','moment','exports','DATE','STRING','ENUM'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xc7da,0xf2));var _0xac7d=function(_0x1c7d9d,_0x5332e1){_0x1c7d9d=_0x1c7d9d-0x0;var _0x19be17=_0xc7da[_0x1c7d9d];return _0x19be17;};'use strict';var Sequelize=require(_0xac7d('0x0'));var moment=require(_0xac7d('0x1'));module[_0xac7d('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xac7d('0x3')]},'disposition':{'type':Sequelize[_0xac7d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xac7d('0x4')]},'note':{'type':Sequelize[_0xac7d('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xac7d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xac7d('0x5')]('in',_0xac7d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xac7d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xac7d('0x5')]('in',_0xac7d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xac7d('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ac2fc4a..6ffd0a6 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 _0x376f=['../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','model','keys','intersection','fields','attributes','merge','options','create','body','find','params','describe','addMessage','ids','omit','findOne','WhatsappMessage','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','spread','Tag','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','attachments','Attachment','Messages','direction','read','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','createdAt','out','System','lastName','secret','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','bluebird','util','ejs','lodash','ioredis'];(function(_0x4da313,_0x2c8e1f){var _0x1d133b=function(_0x49846f){while(--_0x49846f){_0x4da313['push'](_0x4da313['shift']());}};_0x1d133b(++_0x2c8e1f);}(_0x376f,0x78));var _0xf376=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x376f[_0x1cc8fe];return _0x230054;};'use strict';var rimraf=require(_0xf376('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xf376('0x1'));var util=require(_0xf376('0x2'));var path=require('path');var ejs=require(_0xf376('0x3'));var fs=require('fs');var _=require(_0xf376('0x4'));var Redis=require(_0xf376('0x5'));var interaction=require(_0xf376('0x6'));var qs=require(_0xf376('0x7'));var pdf=require(_0xf376('0x8'));var logger=require(_0xf376('0x9'))('api');var config=require(_0xf376('0xa'));var db=require(_0xf376('0xb'))['db'];config[_0xf376('0xc')]=_['defaults'](config[_0xf376('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf376('0xd'))(new Redis(config['redis']));require(_0xf376('0xe'))[_0xf376('0xf')](socket);function respondWithStatusCode(_0x2d8d85,_0xdf4fe1){_0xdf4fe1=_0xdf4fe1||0xcc;return function(_0x4b7d47){if(_0x4b7d47){return _0x2d8d85[_0xf376('0x10')](_0xdf4fe1);}return _0x2d8d85[_0xf376('0x11')](_0xdf4fe1)[_0xf376('0x12')]();};}function respondWithResult(_0x22ab84,_0x5f2660){_0x5f2660=_0x5f2660||0xc8;return function(_0x205872){if(_0x205872){return _0x22ab84[_0xf376('0x11')](_0x5f2660)[_0xf376('0x13')](_0x205872);}};}function respondWithFilteredResult(_0x4dca87,_0x12489c){return function(_0xdabd66){if(_0xdabd66){var _0x259933=typeof _0x12489c[_0xf376('0x14')]===_0xf376('0x15')&&typeof _0x12489c[_0xf376('0x16')]===_0xf376('0x15');var _0x5562b7=_0xdabd66[_0xf376('0x17')];var _0x69c83c=_0x259933?0x0:_0x12489c['offset'];var _0x36ed42=_0x259933?_0xdabd66[_0xf376('0x17')]:_0x12489c[_0xf376('0x14')]+_0x12489c[_0xf376('0x16')];var _0x52c6e1;if(_0x36ed42>=_0x5562b7){_0x36ed42=_0x5562b7;_0x52c6e1=0xc8;}else{_0x52c6e1=0xce;}_0x4dca87[_0xf376('0x11')](_0x52c6e1);return _0x4dca87['set'](_0xf376('0x18'),_0x69c83c+'-'+_0x36ed42+'/'+_0x5562b7)[_0xf376('0x13')](_0xdabd66);}return null;};}function saveUpdates(_0x5a8701){return function(_0x45a86a){if(_0x45a86a){return _0x45a86a[_0xf376('0x19')](_0x5a8701)[_0xf376('0x1a')](function(_0x5cbf32){return _0x5cbf32;});}return null;};}function removeEntity(_0x2583f4){return function(_0x4017fe){if(_0x4017fe){return _0x4017fe[_0xf376('0x1b')]()[_0xf376('0x1a')](function(){_0x2583f4['status'](0xcc)[_0xf376('0x12')]();});}};}function handleEntityNotFound(_0xba9748){return function(_0x5cfadf){if(!_0x5cfadf){_0xba9748[_0xf376('0x10')](0x194);}return _0x5cfadf;};}function handleError(_0x1fe1e3,_0x56a08a){_0x56a08a=_0x56a08a||0x1f4;return function(_0x31bb2a){logger[_0xf376('0x1c')](_0x31bb2a[_0xf376('0x1d')]);if(_0x31bb2a[_0xf376('0x1e')]){delete _0x31bb2a['name'];}_0x1fe1e3[_0xf376('0x11')](_0x56a08a)[_0xf376('0x1f')](_0x31bb2a);};}exports[_0xf376('0x20')]=function(_0x5ef0b8,_0x1a8e94){var _0xf0a79b={};var _0x21c7ba=_[_0xf376('0x21')](db[_0xf376('0x22')][_0xf376('0x23')],function(_0x564746){return{'name':_0x564746[_0xf376('0x24')],'type':_0x564746[_0xf376('0x25')][_0xf376('0x26')]};});_0xf0a79b=qs[_0xf376('0x27')](_0x21c7ba,_0x5ef0b8);return interaction[_0xf376('0x28')](_0xf376('0x29'),_0x5ef0b8[_0xf376('0x2a')],_0x5ef0b8[_0xf376('0x2b')],_0xf0a79b,_0x21c7ba)[_0xf376('0x1a')](respondWithFilteredResult(_0x1a8e94,_0xf0a79b))[_0xf376('0x2c')](handleError(_0x1a8e94,null));};exports['show']=function(_0x29d2c6,_0x47a1bc){var _0x2efa59={'raw':![],'where':{'id':_0x29d2c6['params']['id']}},_0x5b1612={};_0x5b1612[_0xf376('0x2d')]=_['keys'](db[_0xf376('0x22')][_0xf376('0x23')]);_0x5b1612['query']=_[_0xf376('0x2e')](_0x29d2c6['query']);_0x5b1612['filters']=_[_0xf376('0x2f')](_0x5b1612['model'],_0x5b1612[_0xf376('0x2a')]);_0x2efa59['attributes']=_[_0xf376('0x2f')](_0x5b1612[_0xf376('0x2d')],qs[_0xf376('0x30')](_0x29d2c6[_0xf376('0x2a')][_0xf376('0x30')]));_0x2efa59[_0xf376('0x31')]=_0x2efa59[_0xf376('0x31')]['length']?_0x2efa59[_0xf376('0x31')]:_0x5b1612[_0xf376('0x2d')];if(_0x29d2c6['query']['includeAll']){_0x2efa59['include']=[{'all':!![]}];}_0x2efa59=_[_0xf376('0x32')]({},_0x2efa59,_0x29d2c6[_0xf376('0x33')]);return db[_0xf376('0x22')]['find'](_0x2efa59)[_0xf376('0x1a')](handleEntityNotFound(_0x47a1bc,null))[_0xf376('0x1a')](respondWithResult(_0x47a1bc,null))[_0xf376('0x2c')](handleError(_0x47a1bc,null));};exports[_0xf376('0x34')]=function(_0x123227,_0x6855d4){return db[_0xf376('0x22')][_0xf376('0x34')](_0x123227[_0xf376('0x35')],{})[_0xf376('0x1a')](respondWithResult(_0x6855d4,0xc9))[_0xf376('0x2c')](handleError(_0x6855d4,null));};exports['update']=function(_0x13d1a2,_0x287ccd){if(_0x13d1a2[_0xf376('0x35')]['id']){delete _0x13d1a2[_0xf376('0x35')]['id'];}return db[_0xf376('0x22')][_0xf376('0x36')]({'where':{'id':_0x13d1a2[_0xf376('0x37')]['id']}})[_0xf376('0x1a')](handleEntityNotFound(_0x287ccd,null))[_0xf376('0x1a')](saveUpdates(_0x13d1a2[_0xf376('0x35')],null))[_0xf376('0x1a')](respondWithResult(_0x287ccd,null))['catch'](handleError(_0x287ccd,null));};exports['destroy']=function(_0x57f216,_0x4f4240){return db[_0xf376('0x22')][_0xf376('0x36')]({'where':{'id':_0x57f216[_0xf376('0x37')]['id']}})[_0xf376('0x1a')](handleEntityNotFound(_0x4f4240,null))[_0xf376('0x1a')](removeEntity(_0x4f4240,null))[_0xf376('0x2c')](handleError(_0x4f4240,null));};exports[_0xf376('0x38')]=function(_0x48be8a,_0x3ee085){return db[_0xf376('0x22')][_0xf376('0x38')]()[_0xf376('0x1a')](respondWithResult(_0x3ee085,null))[_0xf376('0x2c')](handleError(_0x3ee085,null));};exports['addMessage']=function(_0xcac266,_0x155347){return db['WhatsappMessage']['find']({'where':{'id':_0xcac266[_0xf376('0x37')]['id']}})['then'](handleEntityNotFound(_0x155347,null))[_0xf376('0x1a')](function(_0x15e69f){if(_0x15e69f){return _0x15e69f[_0xf376('0x39')](_0xcac266['body'][_0xf376('0x3a')],_[_0xf376('0x3b')](_0xcac266['body'],[_0xf376('0x3a'),'id'])||{});}})[_0xf376('0x1a')](respondWithResult(_0x155347,null))[_0xf376('0x2c')](handleError(_0x155347,null));};exports['getMessages']=function(_0x42f77f,_0x1a1261){var _0x163463={'raw':![],'where':{}};var _0x2d5964={};var _0x252627={'count':0x0,'rows':[]};return db[_0xf376('0x22')][_0xf376('0x3c')]({'where':{'id':_0x42f77f[_0xf376('0x37')]['id']}})[_0xf376('0x1a')](handleEntityNotFound(_0x1a1261,null))['then'](function(_0x315cc7){if(_0x315cc7){_0x2d5964[_0xf376('0x2d')]=_[_0xf376('0x2e')](db[_0xf376('0x3d')][_0xf376('0x23')]);_0x2d5964[_0xf376('0x2a')]=_[_0xf376('0x2e')](_0x42f77f[_0xf376('0x2a')]);_0x2d5964['filters']=_[_0xf376('0x2f')](_0x2d5964[_0xf376('0x2d')],_0x2d5964['query']);_0x163463['attributes']=_[_0xf376('0x2f')](_0x2d5964[_0xf376('0x2d')],qs[_0xf376('0x30')](_0x42f77f['query'][_0xf376('0x30')]));_0x163463[_0xf376('0x31')]=_0x163463['attributes'][_0xf376('0x3e')]?_0x163463[_0xf376('0x31')]:_0x2d5964['model'];if(!_0x42f77f[_0xf376('0x2a')][_0xf376('0x3f')](_0xf376('0x40'))){_0x163463[_0xf376('0x16')]=qs[_0xf376('0x16')](_0x42f77f[_0xf376('0x2a')][_0xf376('0x16')]);_0x163463[_0xf376('0x14')]=qs[_0xf376('0x14')](_0x42f77f[_0xf376('0x2a')][_0xf376('0x14')]);}_0x163463[_0xf376('0x41')]=qs[_0xf376('0x42')](_0x42f77f[_0xf376('0x2a')][_0xf376('0x42')]);_0x163463[_0xf376('0x43')]=qs[_0xf376('0x44')](_[_0xf376('0x45')](_0x42f77f['query'],_0x2d5964[_0xf376('0x44')]));_0x163463[_0xf376('0x43')]['WhatsappInteractionId']=_0x315cc7['id'];if(_0x42f77f[_0xf376('0x2a')][_0xf376('0x46')]){_0x163463[_0xf376('0x43')]=_['merge'](_0x163463[_0xf376('0x43')],{'$or':_['map'](_0x163463['attributes'],function(_0x259762){var _0x2fb94c={};_0x2fb94c[_0x259762]={'$like':'%'+_0x42f77f[_0xf376('0x2a')]['filter']+'%'};return _0x2fb94c;})});}if(_0x42f77f[_0xf376('0x2a')]['$gte']){var _0x27de46=_0x42f77f[_0xf376('0x2a')][_0xf376('0x47')][_0xf376('0x48')](',');var _0x1bf836={};_0x1bf836[_0x27de46[0x0]]={'$gte':moment(_0x27de46[0x1])[_0xf376('0x49')](_0xf376('0x4a'))};_0x163463[_0xf376('0x43')]=_[_0xf376('0x32')](_0x163463[_0xf376('0x43')],_0x1bf836);}_0x163463=_[_0xf376('0x32')]({},_0x163463,_0x42f77f[_0xf376('0x33')]);return db[_0xf376('0x3d')][_0xf376('0x17')]({'where':_0x163463[_0xf376('0x43')]})[_0xf376('0x1a')](function(_0x49d789){_0x252627[_0xf376('0x17')]=_0x49d789;if(_0x42f77f[_0xf376('0x2a')][_0xf376('0x4b')]){_0x163463['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xf376('0x28')](_0x163463);})['then'](function(_0x27a7d2){_0x252627[_0xf376('0x4c')]=_0x27a7d2;return _0x252627;});}})[_0xf376('0x1a')](respondWithFilteredResult(_0x1a1261,_0x163463))[_0xf376('0x2c')](handleError(_0x1a1261,null));};exports['addTags']=function(_0x11e794,_0x30bdf1){return db[_0xf376('0x22')][_0xf376('0x36')]({'where':{'id':_0x11e794[_0xf376('0x37')]['id']}})['then'](handleEntityNotFound(_0x30bdf1,null))[_0xf376('0x1a')](function(_0x489e3b){if(_0x489e3b){return _0x489e3b[_0xf376('0x4d')](_0x11e794[_0xf376('0x35')][_0xf376('0x3a')],_[_0xf376('0x3b')](_0x11e794[_0xf376('0x35')],[_0xf376('0x3a'),'id'])||{})[_0xf376('0x4e')](function(){return db[_0xf376('0x4f')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x11e794[_0xf376('0x35')][_0xf376('0x3a')]}});})[_0xf376('0x1a')](function(_0x9e912){socket['emit'](_0xf376('0x50'),{'id':Number(_0x11e794[_0xf376('0x37')]['id']),'tags':_0x9e912||[]});return{'id':Number(_0x11e794[_0xf376('0x37')]['id']),'tags':_0x9e912||[]};});}})[_0xf376('0x1a')](respondWithResult(_0x30bdf1,null))[_0xf376('0x2c')](handleError(_0x30bdf1,null));};exports[_0xf376('0x51')]=function(_0x14017c,_0x5ee4b2){return db['WhatsappInteraction'][_0xf376('0x36')]({'where':{'id':_0x14017c['params']['id']}})[_0xf376('0x1a')](handleEntityNotFound(_0x5ee4b2,null))[_0xf376('0x1a')](function(_0x3e9cbd){if(_0x3e9cbd){return _0x3e9cbd['removeTags'](_0x14017c[_0xf376('0x2a')][_0xf376('0x3a')]);}})[_0xf376('0x1a')](respondWithStatusCode(_0x5ee4b2,null))['catch'](handleError(_0x5ee4b2,null));};exports[_0xf376('0x52')]=function(_0x2235f1,_0x23a335){var _0x4281b6=moment()['unix']()[_0xf376('0x53')]();var _0x3d3837=path[_0xf376('0x54')](config[_0xf376('0x55')],_0xf376('0x56'),_0xf376('0x57'),_0xf376('0x58'));var _0x47839c=path['join'](config[_0xf376('0x55')],_0xf376('0x56'),_0xf376('0x57'),'attachments');var _0x47fde2=path[_0xf376('0x54')](_0x3d3837,_0x4281b6);var _0x303de7=util[_0xf376('0x49')](_0xf376('0x59'),_0x2235f1[_0xf376('0x37')]['id'],_0x4281b6);var _0x3a3fea=path[_0xf376('0x54')](_0x3d3837,_0x303de7);var _0x4fce6b=[];_0x4fce6b[_0xf376('0x5a')]({'model':db[_0xf376('0x5b')],'as':_0xf376('0x5b'),'attributes':['id',_0xf376('0x5c')],'raw':!![]});_0x4fce6b['push']({'model':db['CmContact'],'as':_0xf376('0x5d'),'attributes':['id',_0xf376('0x5e'),'lastName'],'raw':!![]});if(_0x2235f1[_0xf376('0x2a')][_0xf376('0x5f')]){_0x4fce6b[_0xf376('0x5a')]({'model':db[_0xf376('0x60')],'as':'Attachment','raw':!![]});}var _0x409d90=[{'model':db[_0xf376('0x3d')],'as':_0xf376('0x61'),'attributes':['id',_0xf376('0x35'),'createdAt',_0xf376('0x62'),'secret',_0xf376('0x63')],'include':_0x4fce6b}];_0x409d90['push']({'model':db[_0xf376('0x64')],'as':_0xf376('0x65'),'attributes':['id',_0xf376('0x1e')]});_0x409d90[_0xf376('0x5a')]({'model':db['User'],'as':_0xf376('0x66'),'attributes':['id',_0xf376('0x5c')]});return db[_0xf376('0x22')][_0xf376('0x36')]({'where':{'id':_0x2235f1[_0xf376('0x37')]['id']},'include':_0x409d90})['then'](handleEntityNotFound(_0x23a335,null))['then'](function(_0x544c3f){if(_0x544c3f){var _0x48ed92=_0x544c3f['get']({'plain':!![]});fs[_0xf376('0x67')](_0x47fde2);var _0x5204d3={'channel':_0xf376('0x68'),'account':_0x48ed92[_0xf376('0x65')][_0xf376('0x1e')],'agent':_0x48ed92['Owner']?_0x48ed92[_0xf376('0x66')]['fullname']:_0xf376('0x69'),'createdAt':moment(_0x48ed92['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xf376('0x53')](),'closedAt':_0x48ed92[_0xf376('0x6a')]?moment(_0x48ed92[_0xf376('0x6b')])[_0xf376('0x49')](_0xf376('0x4a'))[_0xf376('0x53')]():'','disposition':_0x48ed92[_0xf376('0x6c')],'messages':_(_0x48ed92['Messages'])['filter']({'secret':![]})['map'](function(_0x3833d5){if(_0x3833d5['Attachment']){var _0x1e9f3c=path[_0xf376('0x54')](_0x47839c,_0x3833d5[_0xf376('0x60')][_0xf376('0x6d')]);if(fs[_0xf376('0x6e')](_0x1e9f3c)){fs[_0xf376('0x6f')](_0x1e9f3c)[_0xf376('0x70')](fs[_0xf376('0x71')](path[_0xf376('0x54')](_0x47fde2,_0x3833d5[_0xf376('0x60')][_0xf376('0x6d')])));}}return{'date':moment(_0x3833d5[_0xf376('0x72')])[_0xf376('0x49')](_0xf376('0x4a'))['toString'](),'sender':_0x3833d5[_0xf376('0x62')]===_0xf376('0x73')?_0x3833d5[_0xf376('0x5b')]?_0x3833d5[_0xf376('0x5b')][_0xf376('0x5c')]:_0xf376('0x74'):_0x3833d5[_0xf376('0x5d')][_0xf376('0x5e')]+(_0x3833d5[_0xf376('0x5d')]['lastName']?'\x20'+_0x3833d5[_0xf376('0x5d')][_0xf376('0x75')]:''),'body':_0x3833d5[_0xf376('0x60')]?_0x3833d5[_0xf376('0x60')]['basename']:_0x3833d5[_0xf376('0x35')],'direction':_0x3833d5[_0xf376('0x62')]===_0xf376('0x73')?'A':'C','secret':_0x3833d5[_0xf376('0x76')],'read':_0x3833d5[_0xf376('0x63')],'attachment':_0x3833d5[_0xf376('0x60')]};})[_0xf376('0x77')]()};return ejs['renderFile'](path[_0xf376('0x54')](config['root'],_0xf376('0x56'),'views',_0xf376('0x78')),{'interaction':_0x5204d3})[_0xf376('0x1a')](function(_0xaa755){var _0x4e7c11=path[_0xf376('0x54')](_0x47fde2,_0xf376('0x79')+_0x48ed92['id']+'-'+_0x4281b6+_0xf376('0x7a'));var _0x360415={'path':_0x4e7c11,'channel':'Whatsapp','interactionId':_0x48ed92['id']};return pdf[_0xf376('0x7b')](_0xaa755,_0x360415);})[_0xf376('0x1a')](function(){return new BPromise(function(_0x4ea48c,_0x262a84){zipdir(_0x47fde2,{'saveTo':_0x3a3fea},function(_0x246766,_0x17f84e){if(_0x246766)return _0x262a84(_0x246766);return _0x4ea48c(_0x17f84e);});})['then'](function(){return new BPromise(function(_0xda6b79,_0x29e8ad){rimraf(_0x47fde2,function(_0x453006){if(_0x453006)_0x29e8ad(_0x453006);return _0xda6b79();});});})[_0xf376('0x1a')](function(){return _0x23a335[_0xf376('0x52')](_0x3a3fea,_0x303de7,function(_0xfea21a){if(_0xfea21a){console[_0xf376('0x7c')](_0xf376('0x7d'),_0xfea21a);}else{fs['unlinkSync'](_0x3a3fea);}});});});}else{return _0x23a335[_0xf376('0x10')](0xc8);}})[_0xf376('0x2c')](handleError(_0x23a335,null));}; \ No newline at end of file +var _0x3117=['format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','rows','addTags','Tag','color','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','read','value','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where','pick','WhatsappInteractionId','filter','merge','$gte','split'];(function(_0x19bd30,_0x4d6713){var _0x2fa9c2=function(_0x57dc02){while(--_0x57dc02){_0x19bd30['push'](_0x19bd30['shift']());}};_0x2fa9c2(++_0x4d6713);}(_0x3117,0x1af));var _0x7311=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x3117[_0x2c7dc6];return _0x10002b;};'use strict';var rimraf=require(_0x7311('0x0'));var zipdir=require('zip-dir');var moment=require(_0x7311('0x1'));var BPromise=require('bluebird');var util=require(_0x7311('0x2'));var path=require(_0x7311('0x3'));var ejs=require(_0x7311('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x7311('0x5'));var interaction=require(_0x7311('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x7311('0x7'));var logger=require('../../config/logger')(_0x7311('0x8'));var config=require(_0x7311('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x7311('0xa')],{'host':_0x7311('0xb'),'port':0x18eb});var socket=require(_0x7311('0xc'))(new Redis(config[_0x7311('0xa')]));require(_0x7311('0xd'))['register'](socket);function respondWithStatusCode(_0x15d8a9,_0x2dad9d){_0x2dad9d=_0x2dad9d||0xcc;return function(_0x360bb1){if(_0x360bb1){return _0x15d8a9[_0x7311('0xe')](_0x2dad9d);}return _0x15d8a9[_0x7311('0xf')](_0x2dad9d)[_0x7311('0x10')]();};}function respondWithResult(_0x385c12,_0x3fd06a){_0x3fd06a=_0x3fd06a||0xc8;return function(_0x1b83c0){if(_0x1b83c0){return _0x385c12[_0x7311('0xf')](_0x3fd06a)['json'](_0x1b83c0);}};}function respondWithFilteredResult(_0x14c2be,_0x39855d){return function(_0x145b6a){if(_0x145b6a){var _0xa333ec=typeof _0x39855d[_0x7311('0x11')]===_0x7311('0x12')&&typeof _0x39855d[_0x7311('0x13')]==='undefined';var _0x173e4c=_0x145b6a[_0x7311('0x14')];var _0x514336=_0xa333ec?0x0:_0x39855d[_0x7311('0x11')];var _0x1b4d5a=_0xa333ec?_0x145b6a[_0x7311('0x14')]:_0x39855d['offset']+_0x39855d[_0x7311('0x13')];var _0x31457b;if(_0x1b4d5a>=_0x173e4c){_0x1b4d5a=_0x173e4c;_0x31457b=0xc8;}else{_0x31457b=0xce;}_0x14c2be[_0x7311('0xf')](_0x31457b);return _0x14c2be[_0x7311('0x15')](_0x7311('0x16'),_0x514336+'-'+_0x1b4d5a+'/'+_0x173e4c)['json'](_0x145b6a);}return null;};}function saveUpdates(_0x2c2cff){return function(_0x99b7){if(_0x99b7){return _0x99b7[_0x7311('0x17')](_0x2c2cff)[_0x7311('0x18')](function(_0x3fb8b7){return _0x3fb8b7;});}return null;};}function removeEntity(_0xca56cc){return function(_0x26ec62){if(_0x26ec62){return _0x26ec62['destroy']()[_0x7311('0x18')](function(){_0xca56cc[_0x7311('0xf')](0xcc)[_0x7311('0x10')]();});}};}function handleEntityNotFound(_0x3b8f71){return function(_0x2870eb){if(!_0x2870eb){_0x3b8f71[_0x7311('0xe')](0x194);}return _0x2870eb;};}function handleError(_0x2c6dad,_0x2f983b){_0x2f983b=_0x2f983b||0x1f4;return function(_0x3617ff){logger[_0x7311('0x19')](_0x3617ff[_0x7311('0x1a')]);if(_0x3617ff[_0x7311('0x1b')]){delete _0x3617ff[_0x7311('0x1b')];}_0x2c6dad[_0x7311('0xf')](_0x2f983b)[_0x7311('0x1c')](_0x3617ff);};}exports[_0x7311('0x1d')]=function(_0x2892f0,_0x30c6a2){var _0xd16445={};var _0x292151=_[_0x7311('0x1e')](db[_0x7311('0x1f')][_0x7311('0x20')],function(_0x41d7dd){return{'name':_0x41d7dd[_0x7311('0x21')],'type':_0x41d7dd[_0x7311('0x22')][_0x7311('0x23')]};});_0xd16445=qs[_0x7311('0x24')](_0x292151,_0x2892f0);return interaction[_0x7311('0x25')](_0x7311('0x26'),_0x2892f0[_0x7311('0x27')],_0x2892f0[_0x7311('0x28')],_0xd16445,_0x292151)[_0x7311('0x18')](respondWithFilteredResult(_0x30c6a2,_0xd16445))[_0x7311('0x29')](handleError(_0x30c6a2,null));};exports['show']=function(_0x1cd7b7,_0x5c1146){var _0x336436={'raw':![],'where':{'id':_0x1cd7b7[_0x7311('0x2a')]['id']}},_0xf2c94a={};_0xf2c94a[_0x7311('0x2b')]=_[_0x7311('0x2c')](db[_0x7311('0x1f')][_0x7311('0x20')]);_0xf2c94a[_0x7311('0x27')]=_[_0x7311('0x2c')](_0x1cd7b7[_0x7311('0x27')]);_0xf2c94a[_0x7311('0x2d')]=_[_0x7311('0x2e')](_0xf2c94a[_0x7311('0x2b')],_0xf2c94a[_0x7311('0x27')]);_0x336436['attributes']=_[_0x7311('0x2e')](_0xf2c94a['model'],qs[_0x7311('0x2f')](_0x1cd7b7[_0x7311('0x27')][_0x7311('0x2f')]));_0x336436['attributes']=_0x336436[_0x7311('0x30')][_0x7311('0x31')]?_0x336436['attributes']:_0xf2c94a[_0x7311('0x2b')];if(_0x1cd7b7[_0x7311('0x27')][_0x7311('0x32')]){_0x336436[_0x7311('0x33')]=[{'all':!![]}];}_0x336436=_['merge']({},_0x336436,_0x1cd7b7[_0x7311('0x34')]);return db[_0x7311('0x1f')][_0x7311('0x35')](_0x336436)[_0x7311('0x18')](handleEntityNotFound(_0x5c1146,null))[_0x7311('0x18')](respondWithResult(_0x5c1146,null))[_0x7311('0x29')](handleError(_0x5c1146,null));};exports[_0x7311('0x36')]=function(_0x5a2ab4,_0x58ae63){return db[_0x7311('0x1f')][_0x7311('0x36')](_0x5a2ab4[_0x7311('0x37')],{})[_0x7311('0x18')](respondWithResult(_0x58ae63,0xc9))[_0x7311('0x29')](handleError(_0x58ae63,null));};exports[_0x7311('0x17')]=function(_0x13b42b,_0xc33f69){if(_0x13b42b[_0x7311('0x37')]['id']){delete _0x13b42b[_0x7311('0x37')]['id'];}return db[_0x7311('0x1f')][_0x7311('0x35')]({'where':{'id':_0x13b42b[_0x7311('0x2a')]['id']}})['then'](handleEntityNotFound(_0xc33f69,null))[_0x7311('0x18')](saveUpdates(_0x13b42b[_0x7311('0x37')],null))[_0x7311('0x18')](respondWithResult(_0xc33f69,null))[_0x7311('0x29')](handleError(_0xc33f69,null));};exports[_0x7311('0x38')]=function(_0x503be1,_0x2e1086){return db[_0x7311('0x1f')]['find']({'where':{'id':_0x503be1[_0x7311('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2e1086,null))['then'](removeEntity(_0x2e1086,null))[_0x7311('0x29')](handleError(_0x2e1086,null));};exports[_0x7311('0x39')]=function(_0x109880,_0x2361b6){return db[_0x7311('0x1f')][_0x7311('0x39')]()[_0x7311('0x18')](respondWithResult(_0x2361b6,null))[_0x7311('0x29')](handleError(_0x2361b6,null));};exports[_0x7311('0x3a')]=function(_0x260cbb,_0x123209){return db['WhatsappMessage'][_0x7311('0x35')]({'where':{'id':_0x260cbb[_0x7311('0x2a')]['id']}})['then'](handleEntityNotFound(_0x123209,null))[_0x7311('0x18')](function(_0x4c998c){if(_0x4c998c){return _0x4c998c[_0x7311('0x3a')](_0x260cbb['body'][_0x7311('0x3b')],_[_0x7311('0x3c')](_0x260cbb['body'],[_0x7311('0x3b'),'id'])||{});}})[_0x7311('0x18')](respondWithResult(_0x123209,null))[_0x7311('0x29')](handleError(_0x123209,null));};exports[_0x7311('0x3d')]=function(_0x24fd80,_0x29f7e2){var _0x443da0={'raw':![],'where':{}};var _0x129a61={};var _0x6681f={'count':0x0,'rows':[]};return db[_0x7311('0x1f')][_0x7311('0x3e')]({'where':{'id':_0x24fd80[_0x7311('0x2a')]['id']}})[_0x7311('0x18')](handleEntityNotFound(_0x29f7e2,null))[_0x7311('0x18')](function(_0x5c9445){if(_0x5c9445){_0x129a61[_0x7311('0x2b')]=_[_0x7311('0x2c')](db['WhatsappMessage'][_0x7311('0x20')]);_0x129a61[_0x7311('0x27')]=_['keys'](_0x24fd80[_0x7311('0x27')]);_0x129a61[_0x7311('0x2d')]=_[_0x7311('0x2e')](_0x129a61['model'],_0x129a61['query']);_0x443da0[_0x7311('0x30')]=_[_0x7311('0x2e')](_0x129a61['model'],qs[_0x7311('0x2f')](_0x24fd80[_0x7311('0x27')][_0x7311('0x2f')]));_0x443da0[_0x7311('0x30')]=_0x443da0[_0x7311('0x30')][_0x7311('0x31')]?_0x443da0[_0x7311('0x30')]:_0x129a61[_0x7311('0x2b')];if(!_0x24fd80[_0x7311('0x27')][_0x7311('0x3f')]('nolimit')){_0x443da0[_0x7311('0x13')]=qs[_0x7311('0x13')](_0x24fd80[_0x7311('0x27')][_0x7311('0x13')]);_0x443da0[_0x7311('0x11')]=qs[_0x7311('0x11')](_0x24fd80[_0x7311('0x27')][_0x7311('0x11')]);}_0x443da0[_0x7311('0x40')]=qs['sort'](_0x24fd80[_0x7311('0x27')][_0x7311('0x41')]);_0x443da0[_0x7311('0x42')]=qs[_0x7311('0x2d')](_[_0x7311('0x43')](_0x24fd80[_0x7311('0x27')],_0x129a61[_0x7311('0x2d')]));_0x443da0['where'][_0x7311('0x44')]=_0x5c9445['id'];if(_0x24fd80[_0x7311('0x27')][_0x7311('0x45')]){_0x443da0[_0x7311('0x42')]=_[_0x7311('0x46')](_0x443da0[_0x7311('0x42')],{'$or':_[_0x7311('0x1e')](_0x443da0[_0x7311('0x30')],function(_0xa99c35){var _0x57f511={};_0x57f511[_0xa99c35]={'$like':'%'+_0x24fd80[_0x7311('0x27')][_0x7311('0x45')]+'%'};return _0x57f511;})});}if(_0x24fd80[_0x7311('0x27')][_0x7311('0x47')]){var _0x315e04=_0x24fd80[_0x7311('0x27')][_0x7311('0x47')][_0x7311('0x48')](',');var _0x46a7b0={};_0x46a7b0[_0x315e04[0x0]]={'$gte':moment(_0x315e04[0x1])[_0x7311('0x49')](_0x7311('0x4a'))};_0x443da0[_0x7311('0x42')]=_[_0x7311('0x46')](_0x443da0[_0x7311('0x42')],_0x46a7b0);}_0x443da0=_[_0x7311('0x46')]({},_0x443da0,_0x24fd80['options']);return db[_0x7311('0x4b')][_0x7311('0x14')]({'where':_0x443da0['where']})['then'](function(_0x111fa6){_0x6681f['count']=_0x111fa6;if(_0x24fd80[_0x7311('0x27')][_0x7311('0x32')]){_0x443da0[_0x7311('0x33')]=[{'all':!![]}];}return db[_0x7311('0x4b')]['findAll'](_0x443da0);})['then'](function(_0x3c5a8b){_0x6681f[_0x7311('0x4c')]=_0x3c5a8b;return _0x6681f;});}})[_0x7311('0x18')](respondWithFilteredResult(_0x29f7e2,_0x443da0))[_0x7311('0x29')](handleError(_0x29f7e2,null));};exports[_0x7311('0x4d')]=function(_0x5af206,_0x5c3a5e){return db[_0x7311('0x1f')][_0x7311('0x35')]({'where':{'id':_0x5af206[_0x7311('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5c3a5e,null))[_0x7311('0x18')](function(_0x3f253d){if(_0x3f253d){return _0x3f253d['setTags'](_0x5af206['body'][_0x7311('0x3b')],_[_0x7311('0x3c')](_0x5af206[_0x7311('0x37')],[_0x7311('0x3b'),'id'])||{})['spread'](function(){return db[_0x7311('0x4e')]['findAll']({'attributes':['id',_0x7311('0x1b'),_0x7311('0x4f')],'where':{'id':_0x5af206[_0x7311('0x37')][_0x7311('0x3b')]}});})[_0x7311('0x18')](function(_0x1a8ca1){socket['emit'](_0x7311('0x50'),{'id':Number(_0x5af206['params']['id']),'tags':_0x1a8ca1||[]});return{'id':Number(_0x5af206[_0x7311('0x2a')]['id']),'tags':_0x1a8ca1||[]};});}})[_0x7311('0x18')](respondWithResult(_0x5c3a5e,null))[_0x7311('0x29')](handleError(_0x5c3a5e,null));};exports[_0x7311('0x51')]=function(_0x41dbc5,_0x308d2e){return db[_0x7311('0x1f')][_0x7311('0x35')]({'where':{'id':_0x41dbc5[_0x7311('0x2a')]['id']}})[_0x7311('0x18')](handleEntityNotFound(_0x308d2e,null))[_0x7311('0x18')](function(_0x4e499f){if(_0x4e499f){return _0x4e499f[_0x7311('0x51')](_0x41dbc5[_0x7311('0x27')]['ids']);}})[_0x7311('0x18')](respondWithStatusCode(_0x308d2e,null))[_0x7311('0x29')](handleError(_0x308d2e,null));};exports[_0x7311('0x52')]=function(_0x266515,_0x218ed9){var _0x2db6be=moment()['unix']()[_0x7311('0x53')]();var _0x4492b0=path[_0x7311('0x54')](config[_0x7311('0x55')],_0x7311('0x56'),'files',_0x7311('0x57'));var _0x5f01e0=path['join'](config[_0x7311('0x55')],_0x7311('0x56'),_0x7311('0x58'),_0x7311('0x59'));var _0x215998=path[_0x7311('0x54')](_0x4492b0,_0x2db6be);var _0x238639=util[_0x7311('0x49')](_0x7311('0x5a'),_0x266515[_0x7311('0x2a')]['id'],_0x2db6be);var _0x390421=path[_0x7311('0x54')](_0x4492b0,_0x238639);var _0x22e35b=[];_0x22e35b[_0x7311('0x5b')]({'model':db['User'],'as':_0x7311('0x5c'),'attributes':['id',_0x7311('0x5d')],'raw':!![]});_0x22e35b[_0x7311('0x5b')]({'model':db[_0x7311('0x5e')],'as':_0x7311('0x5f'),'attributes':['id',_0x7311('0x60'),_0x7311('0x61')],'raw':!![]});if(_0x266515[_0x7311('0x27')][_0x7311('0x59')]){_0x22e35b[_0x7311('0x5b')]({'model':db[_0x7311('0x62')],'as':_0x7311('0x62'),'raw':!![]});}var _0x4db540=[{'model':db[_0x7311('0x4b')],'as':_0x7311('0x63'),'attributes':['id',_0x7311('0x37'),_0x7311('0x64'),_0x7311('0x65'),_0x7311('0x66'),'read'],'include':_0x22e35b}];_0x4db540[_0x7311('0x5b')]({'model':db[_0x7311('0x67')],'as':_0x7311('0x68'),'attributes':['id',_0x7311('0x1b')]});_0x4db540['push']({'model':db[_0x7311('0x5c')],'as':_0x7311('0x69'),'attributes':['id',_0x7311('0x5d')]});return db[_0x7311('0x1f')][_0x7311('0x35')]({'where':{'id':_0x266515[_0x7311('0x2a')]['id']},'include':_0x4db540})[_0x7311('0x18')](handleEntityNotFound(_0x218ed9,null))[_0x7311('0x18')](function(_0x35dea7){if(_0x35dea7){var _0x46f63b=_0x35dea7['get']({'plain':!![]});fs['mkdirSync'](_0x215998);var _0x3971a2={'channel':_0x7311('0x6a'),'account':_0x46f63b[_0x7311('0x68')][_0x7311('0x1b')],'agent':_0x46f63b[_0x7311('0x69')]?_0x46f63b[_0x7311('0x69')][_0x7311('0x5d')]:_0x7311('0x6b'),'createdAt':moment(_0x46f63b[_0x7311('0x64')])['format'](_0x7311('0x4a'))[_0x7311('0x53')](),'closedAt':_0x46f63b[_0x7311('0x6c')]?moment(_0x46f63b[_0x7311('0x6d')])['format'](_0x7311('0x4a'))[_0x7311('0x53')]():'','disposition':_0x46f63b[_0x7311('0x6e')],'messages':_(_0x46f63b[_0x7311('0x63')])['filter']({'secret':![]})[_0x7311('0x1e')](function(_0xf42237){if(_0xf42237[_0x7311('0x62')]){var _0x10faac=path[_0x7311('0x54')](_0x5f01e0,_0xf42237[_0x7311('0x62')][_0x7311('0x6f')]);if(fs[_0x7311('0x70')](_0x10faac)){fs[_0x7311('0x71')](_0x10faac)['pipe'](fs[_0x7311('0x72')](path[_0x7311('0x54')](_0x215998,_0xf42237[_0x7311('0x62')]['basename'])));}}return{'date':moment(_0xf42237[_0x7311('0x64')])[_0x7311('0x49')](_0x7311('0x4a'))[_0x7311('0x53')](),'sender':_0xf42237['direction']===_0x7311('0x73')?_0xf42237[_0x7311('0x5c')]?_0xf42237[_0x7311('0x5c')][_0x7311('0x5d')]:_0x7311('0x74'):_0xf42237[_0x7311('0x5f')]['firstName']+(_0xf42237[_0x7311('0x5f')][_0x7311('0x61')]?'\x20'+_0xf42237['Contact']['lastName']:''),'body':_0xf42237[_0x7311('0x62')]?_0xf42237[_0x7311('0x62')][_0x7311('0x6f')]:_0xf42237[_0x7311('0x37')],'direction':_0xf42237[_0x7311('0x65')]===_0x7311('0x73')?'A':'C','secret':_0xf42237['secret'],'read':_0xf42237[_0x7311('0x75')],'attachment':_0xf42237['Attachment']};})[_0x7311('0x76')]()};return ejs[_0x7311('0x77')](path[_0x7311('0x54')](config[_0x7311('0x55')],'server','views',_0x7311('0x78')),{'interaction':_0x3971a2})['then'](function(_0x534ec1){var _0x1d75d1=path[_0x7311('0x54')](_0x215998,'transcript-'+_0x46f63b['id']+'-'+_0x2db6be+_0x7311('0x79'));var _0x11234d={'path':_0x1d75d1,'channel':_0x7311('0x6a'),'interactionId':_0x46f63b['id']};return pdf[_0x7311('0x7a')](_0x534ec1,_0x11234d);})['then'](function(){return new BPromise(function(_0x3f0e05,_0x4ffbc7){zipdir(_0x215998,{'saveTo':_0x390421},function(_0x235971,_0xa9832){if(_0x235971)return _0x4ffbc7(_0x235971);return _0x3f0e05(_0xa9832);});})['then'](function(){return new BPromise(function(_0x31acd7,_0x523ad6){rimraf(_0x215998,function(_0x19a865){if(_0x19a865)_0x523ad6(_0x19a865);return _0x31acd7();});});})[_0x7311('0x18')](function(){return _0x218ed9[_0x7311('0x52')](_0x390421,_0x238639,function(_0x3e1bce){if(_0x3e1bce){console[_0x7311('0x7b')](_0x7311('0x7c'),_0x3e1bce);}else{fs[_0x7311('0x7d')](_0x390421);}});});});}else{return _0x218ed9[_0x7311('0xe')](0xc8);}})[_0x7311('0x29')](handleError(_0x218ed9,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 2d1bda4..f1b4a0f 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 _0x9861=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','hasOwnProperty','events'];(function(_0x57a8f8,_0x5faefc){var _0x55670a=function(_0x2ab259){while(--_0x2ab259){_0x57a8f8['push'](_0x57a8f8['shift']());}};_0x55670a(++_0x5faefc);}(_0x9861,0x176));var _0x1986=function(_0x360e44,_0xd75765){_0x360e44=_0x360e44-0x0;var _0x4c3875=_0x9861[_0x360e44];return _0x4c3875;};'use strict';var EventEmitter=require(_0x1986('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x1986('0x1'))['db'][_0x1986('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1986('0x3')](0x0);var events={'afterCreate':_0x1986('0x4'),'afterUpdate':_0x1986('0x5'),'afterDestroy':_0x1986('0x6')};function emitEvent(_0x5462a7){return function(_0xe033ef,_0x279741,_0x1b56d6){_0xe033ef[_0x1986('0x7')]({'attributes':['id'],'raw':!![]})[_0x1986('0x8')](function(_0xc5e066){_0xe033ef[_0x1986('0x9')](_0x1986('0xa'),_0xc5e066[_0x1986('0xb')](function(_0x1432d5){return{'id':_0x1432d5['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xe033ef['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1986('0x8')](function(_0x1578f9){_0xe033ef[_0x1986('0x9')](_0x1986('0xc'),_0x1578f9['length']);WhatsappInteractionEvents[_0x1986('0xd')](_0x5462a7+':'+_0xe033ef['id'],_0xe033ef);WhatsappInteractionEvents[_0x1986('0xd')](_0x5462a7,_0xe033ef);_0x1b56d6(null);})['catch'](_0x1b56d6(null));};}for(var e in events){if(events[_0x1986('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x7d98=['WhatsappMessage','setMaxListeners','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb'];(function(_0x5b0b56,_0x292268){var _0x2f2194=function(_0x1f9479){while(--_0x1f9479){_0x5b0b56['push'](_0x5b0b56['shift']());}};_0x2f2194(++_0x292268);}(_0x7d98,0xe7));var _0x87d9=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x7d98[_0xbe40ad];return _0x50fac9;};'use strict';var EventEmitter=require(_0x87d9('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x87d9('0x1')];var WhatsappMessage=require(_0x87d9('0x2'))['db'][_0x87d9('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x87d9('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x87d9('0x5'),'afterDestroy':_0x87d9('0x6')};function emitEvent(_0x4b4f58){return function(_0x127fa8,_0x589ad8,_0x5ed6d2){_0x127fa8['getUsers']({'attributes':['id'],'raw':!![]})[_0x87d9('0x7')](function(_0x24c05f){_0x127fa8[_0x87d9('0x8')]('Users',_0x24c05f[_0x87d9('0x9')](function(_0x7107a0){return{'id':_0x7107a0['id']};}));return WhatsappMessage[_0x87d9('0xa')]({'where':{'WhatsappInteractionId':_0x127fa8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x22bc16){_0x127fa8[_0x87d9('0x8')](_0x87d9('0xb'),_0x22bc16[_0x87d9('0xc')]);WhatsappInteractionEvents[_0x87d9('0xd')](_0x4b4f58+':'+_0x127fa8['id'],_0x127fa8);WhatsappInteractionEvents[_0x87d9('0xd')](_0x4b4f58,_0x127fa8);_0x5ed6d2(null);})[_0x87d9('0xe')](_0x5ed6d2(null));};}for(var e in events){if(events[_0x87d9('0xf')](e)){var event=events[e];WhatsappInteraction[_0x87d9('0x10')](e,emitEvent(event));}}module[_0x87d9('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 4975199..5c5a3a0 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 _0x20cc=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x20cc,0x196));var _0xc20c=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x20cc[_0x5416db];return _0x243e35;};'use strict';var _=require(_0xc20c('0x0'));var util=require(_0xc20c('0x1'));var logger=require(_0xc20c('0x2'))('api');var moment=require(_0xc20c('0x3'));var BPromise=require(_0xc20c('0x4'));var rp=require(_0xc20c('0x5'));var fs=require('fs');var path=require(_0xc20c('0x6'));var rimraf=require(_0xc20c('0x7'));var config=require(_0xc20c('0x8'));var attributes=require(_0xc20c('0x9'));module[_0xc20c('0xa')]=function(_0xaa5fce,_0x34f9ac){return _0xaa5fce[_0xc20c('0xb')](_0xc20c('0xc'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bdd17,_0x3e23fa,_0x4c36b7){if(_0x3bdd17[_0xc20c('0xd')](_0xc20c('0xe'))){_0x3bdd17['closedAt']=moment()[_0xc20c('0xf')](_0xc20c('0x10'));}_0x4c36b7(null,_0x3bdd17);}}});}; \ No newline at end of file +var _0x47c1=['define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise','rimraf','./whatsappInteraction.attributes','exports'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x47c1,0x142));var _0x147c=function(_0x3acb0f,_0x422e6f){_0x3acb0f=_0x3acb0f-0x0;var _0x5bdb4f=_0x47c1[_0x3acb0f];return _0x5bdb4f;};'use strict';var _=require(_0x147c('0x0'));var util=require('util');var logger=require(_0x147c('0x1'))(_0x147c('0x2'));var moment=require('moment');var BPromise=require(_0x147c('0x3'));var rp=require(_0x147c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x147c('0x5'));var config=require('../../config/environment');var attributes=require(_0x147c('0x6'));module[_0x147c('0x7')]=function(_0x728345,_0x51429d){return _0x728345[_0x147c('0x8')](_0x147c('0x9'),attributes,{'tableName':_0x147c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6ace1d,_0x48677f,_0x37dbfe){if(_0x6ace1d['changed'](_0x147c('0xb'))){_0x6ace1d[_0x147c('0xc')]=moment()[_0x147c('0xd')](_0x147c('0xe'));}_0x37dbfe(null,_0x6ace1d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c46fa6f..1a4919a 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 _0x0441=['ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','body','options','where','attributes','limit','UpdateWhatsappInteraction','stringify','then','addTags','omit'];(function(_0x3174d4,_0x2b9f59){var _0x71d869=function(_0x1d5078){while(--_0x1d5078){_0x3174d4['push'](_0x3174d4['shift']());}};_0x71d869(++_0x2b9f59);}(_0x0441,0x16b));var _0x1044=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x0441[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0x1044('0x0'));var util=require(_0x1044('0x1'));var moment=require(_0x1044('0x2'));var BPromise=require(_0x1044('0x3'));var rs=require(_0x1044('0x4'));var fs=require('fs');var Redis=require(_0x1044('0x5'));var db=require(_0x1044('0x6'))['db'];var utils=require(_0x1044('0x7'));var logger=require(_0x1044('0x8'))(_0x1044('0x9'));var config=require('../../config/environment');var jayson=require(_0x1044('0xa'));var client=jayson['client'][_0x1044('0xb')]({'port':0x232a});config[_0x1044('0xc')]=_[_0x1044('0xd')](config[_0x1044('0xc')],{'host':_0x1044('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1044('0xc')]));require(_0x1044('0xf'))[_0x1044('0x10')](socket);function respondWithRpcPromise(_0x1db04e,_0x5ccfe0,_0x43cadf){return new BPromise(function(_0x1f7f33,_0x5067d3){return client[_0x1044('0x11')](_0x1db04e,_0x43cadf)['then'](function(_0x147bb9){logger[_0x1044('0x12')](_0x1044('0x13'),_0x5ccfe0,_0x1044('0x14'));logger[_0x1044('0x15')](_0x1044('0x16'),_0x5ccfe0,'request\x20sent',JSON['stringify'](_0x147bb9));if(_0x147bb9[_0x1044('0x17')]){if(_0x147bb9[_0x1044('0x17')]['code']===0x1f4){logger['error'](_0x1044('0x13'),_0x5ccfe0,_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);return _0x5067d3(_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x5ccfe0,_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);return _0x1f7f33(_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);}else{logger[_0x1044('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x5ccfe0,_0x1044('0x14'));_0x1f7f33(_0x147bb9[_0x1044('0x19')][_0x1044('0x18')]);}})[_0x1044('0x1a')](function(_0x303f84){logger['error'](_0x1044('0x13'),_0x5ccfe0,_0x303f84);_0x5067d3(_0x303f84);});});}exports['UpdateWhatsappInteraction']=function(_0x2f7fba){var _0xa5905=this;return new Promise(function(_0x2b7370,_0x1075dc){return db['WhatsappInteraction']['update'](_0x2f7fba[_0x1044('0x1b')],{'raw':_0x2f7fba[_0x1044('0x1c')]?_0x2f7fba[_0x1044('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f7fba[_0x1044('0x1c')]?_0x2f7fba['options'][_0x1044('0x1d')]||null:null,'attributes':_0x2f7fba['options']?_0x2f7fba[_0x1044('0x1c')][_0x1044('0x1e')]||null:null,'limit':_0x2f7fba[_0x1044('0x1c')]?_0x2f7fba[_0x1044('0x1c')][_0x1044('0x1f')]||null:null})['then'](function(_0x4ffa96){logger[_0x1044('0x12')]('UpdateWhatsappInteraction',_0x2f7fba);logger['debug'](_0x1044('0x20'),_0x2f7fba,JSON[_0x1044('0x21')](_0x4ffa96));_0x2b7370(_0x4ffa96);})[_0x1044('0x1a')](function(_0x45a8a9){logger[_0x1044('0x17')](_0x1044('0x20'),_0x45a8a9[_0x1044('0x18')],_0x2f7fba);_0x1075dc(_0xa5905[_0x1044('0x17')](0x1f4,_0x45a8a9[_0x1044('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x242eb2){return new Promise(function(_0xf36ee4,_0x58e79c){return db['WhatsappInteraction']['find']({'where':_0x242eb2[_0x1044('0x1c')]?_0x242eb2[_0x1044('0x1c')][_0x1044('0x1d')]||null:null})[_0x1044('0x22')](function(_0x9570fd){if(_0x9570fd){return _0x9570fd[_0x1044('0x23')](_0x242eb2[_0x1044('0x1b')]['ids'],_[_0x1044('0x24')](_0x242eb2[_0x1044('0x1b')],[_0x1044('0x25'),'id'])||{});}})[_0x1044('0x26')](function(_0x249f9c){logger['info'](_0x1044('0x27'),_0x242eb2);logger[_0x1044('0x15')](_0x1044('0x27'),_0x242eb2,JSON[_0x1044('0x21')](_0x249f9c));_0xf36ee4(_0x249f9c);})['catch'](function(_0xda4a56){logger[_0x1044('0x17')](_0x1044('0x27'),_0xda4a56[_0x1044('0x18')],_0x242eb2);_0x58e79c(_this[_0x1044('0x17')](0x1f4,_0xda4a56[_0x1044('0x18')]));});});}; \ No newline at end of file +var _0xbf08=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./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','body','raw','options','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','ids','AddTags','util','moment','bluebird','randomstring'];(function(_0x55c8f6,_0x8badfc){var _0x4949df=function(_0x13b756){while(--_0x13b756){_0x55c8f6['push'](_0x55c8f6['shift']());}};_0x4949df(++_0x8badfc);}(_0xbf08,0xc4));var _0x8bf0=function(_0xa90eea,_0x1262af){_0xa90eea=_0xa90eea-0x0;var _0x5f383a=_0xbf08[_0xa90eea];return _0x5f383a;};'use strict';var _=require('lodash');var util=require(_0x8bf0('0x0'));var moment=require(_0x8bf0('0x1'));var BPromise=require(_0x8bf0('0x2'));var rs=require(_0x8bf0('0x3'));var fs=require('fs');var Redis=require(_0x8bf0('0x4'));var db=require(_0x8bf0('0x5'))['db'];var utils=require(_0x8bf0('0x6'));var logger=require(_0x8bf0('0x7'))('rpc');var config=require(_0x8bf0('0x8'));var jayson=require(_0x8bf0('0x9'));var client=jayson['client'][_0x8bf0('0xa')]({'port':0x232a});config[_0x8bf0('0xb')]=_[_0x8bf0('0xc')](config[_0x8bf0('0xb')],{'host':_0x8bf0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bf0('0xb')]));require(_0x8bf0('0xe'))[_0x8bf0('0xf')](socket);function respondWithRpcPromise(_0x2eb9fc,_0x2c3a8e,_0x346c3f){return new BPromise(function(_0x4256cb,_0x4a2e42){return client[_0x8bf0('0x10')](_0x2eb9fc,_0x346c3f)[_0x8bf0('0x11')](function(_0x196c79){logger[_0x8bf0('0x12')](_0x8bf0('0x13'),_0x2c3a8e,_0x8bf0('0x14'));logger[_0x8bf0('0x15')](_0x8bf0('0x16'),_0x2c3a8e,_0x8bf0('0x14'),JSON[_0x8bf0('0x17')](_0x196c79));if(_0x196c79['error']){if(_0x196c79['error'][_0x8bf0('0x18')]===0x1f4){logger[_0x8bf0('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c3a8e,_0x196c79[_0x8bf0('0x19')][_0x8bf0('0x1a')]);return _0x4a2e42(_0x196c79[_0x8bf0('0x19')][_0x8bf0('0x1a')]);}logger[_0x8bf0('0x19')](_0x8bf0('0x13'),_0x2c3a8e,_0x196c79[_0x8bf0('0x19')][_0x8bf0('0x1a')]);return _0x4256cb(_0x196c79[_0x8bf0('0x19')]['message']);}else{logger[_0x8bf0('0x12')](_0x8bf0('0x13'),_0x2c3a8e,_0x8bf0('0x14'));_0x4256cb(_0x196c79['result'][_0x8bf0('0x1a')]);}})[_0x8bf0('0x1b')](function(_0x1d99dd){logger[_0x8bf0('0x19')](_0x8bf0('0x13'),_0x2c3a8e,_0x1d99dd);_0x4a2e42(_0x1d99dd);});});}exports[_0x8bf0('0x1c')]=function(_0x5d08b8){var _0x5c14e4=this;return new Promise(function(_0x235edc,_0x5e3690){return db['WhatsappInteraction']['update'](_0x5d08b8[_0x8bf0('0x1d')],{'raw':_0x5d08b8['options']?_0x5d08b8['options'][_0x8bf0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d08b8['options']?_0x5d08b8[_0x8bf0('0x1f')][_0x8bf0('0x20')]||null:null,'attributes':_0x5d08b8['options']?_0x5d08b8[_0x8bf0('0x1f')][_0x8bf0('0x21')]||null:null,'limit':_0x5d08b8['options']?_0x5d08b8[_0x8bf0('0x1f')][_0x8bf0('0x22')]||null:null})[_0x8bf0('0x11')](function(_0x2009ab){logger[_0x8bf0('0x12')](_0x8bf0('0x1c'),_0x5d08b8);logger[_0x8bf0('0x15')](_0x8bf0('0x1c'),_0x5d08b8,JSON[_0x8bf0('0x17')](_0x2009ab));_0x235edc(_0x2009ab);})['catch'](function(_0x403c42){logger[_0x8bf0('0x19')](_0x8bf0('0x1c'),_0x403c42['message'],_0x5d08b8);_0x5e3690(_0x5c14e4[_0x8bf0('0x19')](0x1f4,_0x403c42[_0x8bf0('0x1a')]));});});};exports[_0x8bf0('0x23')]=function(_0x48775f){return new Promise(function(_0x15576f,_0x3dc41a){return db[_0x8bf0('0x24')][_0x8bf0('0x25')]({'where':_0x48775f['options']?_0x48775f[_0x8bf0('0x1f')][_0x8bf0('0x20')]||null:null})[_0x8bf0('0x11')](function(_0x2c99bb){if(_0x2c99bb){return _0x2c99bb['addTags'](_0x48775f[_0x8bf0('0x1d')][_0x8bf0('0x26')],_['omit'](_0x48775f[_0x8bf0('0x1d')],[_0x8bf0('0x26'),'id'])||{});}})['spread'](function(_0xd59b88){logger[_0x8bf0('0x12')](_0x8bf0('0x27'),_0x48775f);logger['debug'](_0x8bf0('0x27'),_0x48775f,JSON[_0x8bf0('0x17')](_0xd59b88));_0x15576f(_0xd59b88);})['catch'](function(_0x4eca65){logger['error'](_0x8bf0('0x27'),_0x4eca65[_0x8bf0('0x1a')],_0x48775f);_0x3dc41a(_this[_0x8bf0('0x19')](0x1f4,_0x4eca65[_0x8bf0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index aabdcc0..bace0d1 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 _0x7f0c=['whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x7f0c,0x141));var _0xc7f0=function(_0x51a85c,_0x2660a3){_0x51a85c=_0x51a85c-0x0;var _0x55001f=_0x7f0c[_0x51a85c];return _0x55001f;};'use strict';var WhatsappInteractionEvents=require(_0xc7f0('0x0'));var events=['save',_0xc7f0('0x1'),_0xc7f0('0x2')];function createListener(_0x5d7760,_0x40014d){return function(_0x25cc13){_0x40014d[_0xc7f0('0x3')](_0x5d7760,_0x25cc13);};}function removeListener(_0x492b6e,_0x53dc7f){return function(){WhatsappInteractionEvents[_0xc7f0('0x4')](_0x492b6e,_0x53dc7f);};}exports[_0xc7f0('0x5')]=function(_0x1c3308){for(var _0x51f317=0x0,_0x5c459b=events[_0xc7f0('0x6')];_0x51f317<_0x5c459b;_0x51f317++){var _0x52b9e5=events[_0x51f317];var _0x241c8c=createListener(_0xc7f0('0x7')+_0x52b9e5,_0x1c3308);WhatsappInteractionEvents['on'](_0x52b9e5,_0x241c8c);}}; \ No newline at end of file +var _0x3b34=['./whatsappInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x4145e7,_0x643693){var _0xc7ab02=function(_0x411ca7){while(--_0x411ca7){_0x4145e7['push'](_0x4145e7['shift']());}};_0xc7ab02(++_0x643693);}(_0x3b34,0x165));var _0x43b3=function(_0x262d35,_0x55e9f9){_0x262d35=_0x262d35-0x0;var _0x190660=_0x3b34[_0x262d35];return _0x190660;};'use strict';var WhatsappInteractionEvents=require(_0x43b3('0x0'));var events=[_0x43b3('0x1'),'remove',_0x43b3('0x2')];function createListener(_0x21fcd1,_0x4824a7){return function(_0x225e26){_0x4824a7[_0x43b3('0x3')](_0x21fcd1,_0x225e26);};}function removeListener(_0x1bbad2,_0x1dd693){return function(){WhatsappInteractionEvents[_0x43b3('0x4')](_0x1bbad2,_0x1dd693);};}exports[_0x43b3('0x5')]=function(_0x1b1cb4){for(var _0x28e50a=0x0,_0x1849f1=events[_0x43b3('0x6')];_0x28e50a<_0x1849f1;_0x28e50a++){var _0x5e5ead=events[_0x28e50a];var _0x164816=createListener('whatsappInteraction:'+_0x5e5ead,_0x1b1cb4);WhatsappInteractionEvents['on'](_0x5e5ead,_0x164816);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 56ae48c..8403924 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 _0x71cb=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','tracked','whatsapp','create','/:id/status','accept','/:id/reject','reject','destroy','multer','util','connect-timeout','express','Router'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x71cb,0x1c9));var _0xb71c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x71cb[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xb71c('0x0'));var util=require(_0xb71c('0x1'));var path=require('path');var timeout=require(_0xb71c('0x2'));var express=require(_0xb71c('0x3'));var router=express[_0xb71c('0x4')]();var fs_extra=require(_0xb71c('0x5'));var auth=require(_0xb71c('0x6'));var interaction=require(_0xb71c('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xb71c('0x8')]('/',auth[_0xb71c('0x9')](),controller[_0xb71c('0xa')]);router[_0xb71c('0x8')]('/describe',auth[_0xb71c('0x9')](),controller['describe']);router[_0xb71c('0x8')](_0xb71c('0xb'),auth[_0xb71c('0x9')](),controller[_0xb71c('0xc')]);router[_0xb71c('0xd')]('/',auth[_0xb71c('0x9')](),interaction[_0xb71c('0xe')](_0xb71c('0xf'),'whatsappmessage:create'),controller[_0xb71c('0x10')]);router[_0xb71c('0xd')](_0xb71c('0x11'),controller['status']);router['put'](_0xb71c('0xb'),auth[_0xb71c('0x9')](),controller['update']);router['put']('/:id/accept',auth[_0xb71c('0x9')](),controller[_0xb71c('0x12')]);router['put'](_0xb71c('0x13'),auth['isAuthenticated'](),controller[_0xb71c('0x14')]);router['delete'](_0xb71c('0xb'),auth['isAuthenticated'](),controller[_0xb71c('0x15')]);module['exports']=router; \ No newline at end of file +var _0xee0d=['create','post','/:id/status','status','put','update','accept','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','whatsapp','whatsappmessage:create'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xee0d,0x14e));var _0xdee0=function(_0x45fd90,_0x3bdb57){_0x45fd90=_0x45fd90-0x0;var _0x5ec055=_0xee0d[_0x45fd90];return _0x5ec055;};'use strict';var multer=require(_0xdee0('0x0'));var util=require('util');var path=require(_0xdee0('0x1'));var timeout=require(_0xdee0('0x2'));var express=require(_0xdee0('0x3'));var router=express[_0xdee0('0x4')]();var fs_extra=require(_0xdee0('0x5'));var auth=require(_0xdee0('0x6'));var interaction=require(_0xdee0('0x7'));var config=require(_0xdee0('0x8'));var controller=require(_0xdee0('0x9'));router[_0xdee0('0xa')]('/',auth[_0xdee0('0xb')](),controller[_0xdee0('0xc')]);router[_0xdee0('0xa')](_0xdee0('0xd'),auth[_0xdee0('0xb')](),controller['describe']);router[_0xdee0('0xa')](_0xdee0('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xdee0('0xf'),_0xdee0('0x10')),controller[_0xdee0('0x11')]);router[_0xdee0('0x12')](_0xdee0('0x13'),controller[_0xdee0('0x14')]);router[_0xdee0('0x15')]('/:id',auth[_0xdee0('0xb')](),controller[_0xdee0('0x16')]);router[_0xdee0('0x15')]('/:id/accept',auth[_0xdee0('0xb')](),controller[_0xdee0('0x17')]);router['put']('/:id/reject',auth[_0xdee0('0xb')](),controller['reject']);router[_0xdee0('0x18')](_0xdee0('0xe'),auth[_0xdee0('0xb')](),controller[_0xdee0('0x19')]);module[_0xdee0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2110a1e..273c69a 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 _0x68f5=['STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x8f7cb6,_0xf929c8){var _0xf4d3a1=function(_0x3e3d31){while(--_0x3e3d31){_0x8f7cb6['push'](_0x8f7cb6['shift']());}};_0xf4d3a1(++_0xf929c8);}(_0x68f5,0x11a));var _0x568f=function(_0x5a4056,_0x468183){_0x5a4056=_0x5a4056-0x0;var _0x1c3045=_0x68f5[_0x5a4056];return _0x1c3045;};'use strict';var Sequelize=require(_0x568f('0x0'));module[_0x568f('0x1')]={'body':{'type':Sequelize[_0x568f('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x568f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x568f('0x4')]('in',_0x568f('0x5')),'defaultValue':_0x568f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x568f('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x568f('0x7')]},'secret':{'type':Sequelize[_0x568f('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x568f('0x6')]},'providerResponse':{'type':Sequelize[_0x568f('0x2')]}}; \ No newline at end of file +var _0xc439=['BOOLEAN','ENUM','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xc439,0x174));var _0x9c43=function(_0x3029e1,_0xc87a7e){_0x3029e1=_0x3029e1-0x0;var _0x9b5559=_0xc439[_0x3029e1];return _0x9b5559;};'use strict';var Sequelize=require(_0x9c43('0x0'));module[_0x9c43('0x1')]={'body':{'type':Sequelize[_0x9c43('0x2')](_0x9c43('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9c43('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9c43('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9c43('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9c43('0x6')]},'readAt':{'type':Sequelize[_0x9c43('0x7')]},'secret':{'type':Sequelize[_0x9c43('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9c43('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c7b51ba..1d3c1e4 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 _0xce9a=['messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','whatsapp-interactions','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','sendStatus','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','name','filter','options','WhatsappMessage','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','accept','acceptMessage','reject','UserId','user','agent','get','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','RejectMessage','ContactId','sequelize','QueryTypes','contact','User','internal','format','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','twilio','MessageSid'];(function(_0xe8cf75,_0x2a2ce2){var _0x579504=function(_0x2465a5){while(--_0x2465a5){_0xe8cf75['push'](_0xe8cf75['shift']());}};_0x579504(++_0x2a2ce2);}(_0xce9a,0xdb));var _0xace9=function(_0x5a3601,_0x355890){_0x5a3601=_0x5a3601-0x0;var _0x1e2b08=_0xce9a[_0x5a3601];return _0x1e2b08;};'use strict';var util=require('util');var _=require(_0xace9('0x0'));var Redis=require(_0xace9('0x1'));var interactionService=require(_0xace9('0x2'));var qs=require(_0xace9('0x3'));var logger=require(_0xace9('0x4'))(_0xace9('0x5'));var config=require(_0xace9('0x6'));var db=require(_0xace9('0x7'))['db'];config[_0xace9('0x8')]=_[_0xace9('0x9')](config[_0xace9('0x8')],{'host':_0xace9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xace9('0x8')]));require(_0xace9('0xb'))[_0xace9('0xc')](socket);var jayson=require(_0xace9('0xd'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xace9('0xe')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0xace9('0xf'));function respondWithRpcPromise(_0x1da37b,_0x1375dd,_0x26bb41,_0x182371){return new Promise(function(_0x217e26,_0x936c1b){var _0x304de0=_0x182371||client;return _0x304de0[_0xace9('0x10')](_0x1da37b,_0x26bb41)[_0xace9('0x11')](function(_0x55f3dc){logger[_0xace9('0x12')](_0xace9('0x13'),_0x1375dd,'request\x20sent');logger[_0xace9('0x14')](_0xace9('0x15'),_0x1375dd,_0xace9('0x16'),JSON['stringify'](_0x55f3dc));if(_0x55f3dc['error']){if(_0x55f3dc[_0xace9('0x17')]['code']===0x1f4){logger[_0xace9('0x17')](_0xace9('0x13'),_0x1375dd,_0x55f3dc['error'][_0xace9('0x18')]);return _0x936c1b(_0x55f3dc[_0xace9('0x17')][_0xace9('0x18')]);}logger[_0xace9('0x17')](_0xace9('0x13'),_0x1375dd,_0x55f3dc[_0xace9('0x17')][_0xace9('0x18')]);return _0x217e26(_0x55f3dc[_0xace9('0x17')]['message']);}else{logger['info'](_0xace9('0x13'),_0x1375dd,_0xace9('0x16'));_0x217e26(_0x55f3dc['result'][_0xace9('0x18')]);}})['catch'](function(_0x121959){logger[_0xace9('0x17')](_0xace9('0x13'),_0x1375dd,_0x121959);_0x936c1b(_0x121959);});});}function respondWithResult(_0x1aede3,_0x4e8932){_0x4e8932=_0x4e8932||0xc8;return function(_0x543b7f){if(_0x543b7f){return _0x1aede3[_0xace9('0x19')](_0x4e8932)[_0xace9('0x1a')](_0x543b7f);}};}function respondWithFilteredResult(_0x56cf78,_0x9d296d){return function(_0x4ba15d){if(_0x4ba15d){var _0x5bcc5d=typeof _0x9d296d[_0xace9('0x1b')]===_0xace9('0x1c')&&typeof _0x9d296d[_0xace9('0x1d')]===_0xace9('0x1c');var _0x6a752e=_0x4ba15d[_0xace9('0x1e')];var _0x2ade04=_0x5bcc5d?0x0:_0x9d296d['offset'];var _0x2dfcf8=_0x5bcc5d?_0x4ba15d[_0xace9('0x1e')]:_0x9d296d[_0xace9('0x1b')]+_0x9d296d[_0xace9('0x1d')];var _0xe78f1d;if(_0x2dfcf8>=_0x6a752e){_0x2dfcf8=_0x6a752e;_0xe78f1d=0xc8;}else{_0xe78f1d=0xce;}_0x56cf78[_0xace9('0x19')](_0xe78f1d);return _0x56cf78['set'](_0xace9('0x1f'),_0x2ade04+'-'+_0x2dfcf8+'/'+_0x6a752e)['json'](_0x4ba15d);}return null;};}function saveUpdates(_0x4f3b59){return function(_0x4f5d6a){if(_0x4f5d6a){return _0x4f5d6a[_0xace9('0x20')](_0x4f3b59)[_0xace9('0x11')](function(_0x1931dc){return _0x1931dc;});}return null;};}function removeEntity(_0x2449a1){return function(_0x2fbbc9){if(_0x2fbbc9){return _0x2fbbc9[_0xace9('0x21')]()['then'](function(){_0x2449a1[_0xace9('0x19')](0xcc)[_0xace9('0x22')]();});}};}function handleEntityNotFound(_0x2828a8){return function(_0x3d9bfb){if(!_0x3d9bfb){_0x2828a8[_0xace9('0x23')](0x194);}return _0x3d9bfb;};}function handleError(_0x4b2312,_0x13b369){_0x13b369=_0x13b369||0x1f4;return function(_0x2b3804){logger[_0xace9('0x17')](_0x2b3804['stack']);if(_0x2b3804['name']){delete _0x2b3804['name'];}_0x4b2312['status'](_0x13b369)['send'](_0x2b3804);};}exports[_0xace9('0x24')]=function(_0x4eb139,_0x48ad93){var _0xfcb65b={},_0x4df463={},_0x3dd945={'count':0x0,'rows':[]};var _0x2e18f8=_[_0xace9('0x25')](db['WhatsappMessage'][_0xace9('0x26')],function(_0x2aaf0a){return{'name':_0x2aaf0a[_0xace9('0x27')],'type':_0x2aaf0a['type'][_0xace9('0x28')]};});_0x4df463[_0xace9('0x29')]=_['map'](_0x2e18f8,'name');_0x4df463[_0xace9('0x2a')]=_[_0xace9('0x2b')](_0x4eb139[_0xace9('0x2a')]);_0x4df463['filters']=_[_0xace9('0x2c')](_0x4df463['model'],_0x4df463[_0xace9('0x2a')]);_0xfcb65b[_0xace9('0x2d')]=_[_0xace9('0x2c')](_0x4df463[_0xace9('0x29')],qs[_0xace9('0x2e')](_0x4eb139[_0xace9('0x2a')][_0xace9('0x2e')]));_0xfcb65b[_0xace9('0x2d')]=_0xfcb65b[_0xace9('0x2d')]['length']?_0xfcb65b[_0xace9('0x2d')]:_0x4df463['model'];if(!_0x4eb139[_0xace9('0x2a')][_0xace9('0x2f')](_0xace9('0x30'))){_0xfcb65b['limit']=qs[_0xace9('0x1d')](_0x4eb139['query'][_0xace9('0x1d')]);_0xfcb65b[_0xace9('0x1b')]=qs[_0xace9('0x1b')](_0x4eb139[_0xace9('0x2a')][_0xace9('0x1b')]);}_0xfcb65b[_0xace9('0x31')]=qs[_0xace9('0x32')](_0x4eb139[_0xace9('0x2a')][_0xace9('0x32')]);_0xfcb65b['where']=qs[_0xace9('0x33')](_['pick'](_0x4eb139[_0xace9('0x2a')],_0x4df463[_0xace9('0x33')]),_0x2e18f8);if(_0x4eb139[_0xace9('0x2a')]['filter']){_0xfcb65b[_0xace9('0x34')]=_[_0xace9('0x35')](_0xfcb65b[_0xace9('0x34')],{'$or':_['map'](_0x2e18f8,function(_0x4bbda1){if(_0x4bbda1['type']!==_0xace9('0x36')){var _0x4ea642={};_0x4ea642[_0x4bbda1[_0xace9('0x37')]]={'$like':'%'+_0x4eb139[_0xace9('0x2a')][_0xace9('0x38')]+'%'};return _0x4ea642;}})});}_0xfcb65b=_[_0xace9('0x35')]({},_0xfcb65b,_0x4eb139[_0xace9('0x39')]);var _0x4e53d3={'where':_0xfcb65b[_0xace9('0x34')]};return db[_0xace9('0x3a')][_0xace9('0x1e')](_0x4e53d3)[_0xace9('0x11')](function(_0x3014a9){_0x3dd945[_0xace9('0x1e')]=_0x3014a9;if(_0x4eb139['query'][_0xace9('0x3b')]){_0xfcb65b[_0xace9('0x3c')]=[{'all':!![]}];}return db[_0xace9('0x3a')][_0xace9('0x3d')](_0xfcb65b);})[_0xace9('0x11')](function(_0x132bd3){_0x3dd945[_0xace9('0x3e')]=_0x132bd3;return _0x3dd945;})['then'](respondWithFilteredResult(_0x48ad93,_0xfcb65b))[_0xace9('0x3f')](handleError(_0x48ad93,null));};exports['show']=function(_0x3f6556,_0x35704b){var _0x3c572b={'raw':!![],'where':{'id':_0x3f6556['params']['id']}},_0xdc692a={};_0xdc692a[_0xace9('0x29')]=_[_0xace9('0x2b')](db['WhatsappMessage']['rawAttributes']);_0xdc692a[_0xace9('0x2a')]=_['keys'](_0x3f6556['query']);_0xdc692a['filters']=_['intersection'](_0xdc692a['model'],_0xdc692a[_0xace9('0x2a')]);_0x3c572b['attributes']=_[_0xace9('0x2c')](_0xdc692a[_0xace9('0x29')],qs['fields'](_0x3f6556['query'][_0xace9('0x2e')]));_0x3c572b['attributes']=_0x3c572b['attributes'][_0xace9('0x40')]?_0x3c572b[_0xace9('0x2d')]:_0xdc692a[_0xace9('0x29')];if(_0x3f6556['query'][_0xace9('0x3b')]){_0x3c572b[_0xace9('0x3c')]=[{'all':!![]}];}_0x3c572b=_['merge']({},_0x3c572b,_0x3f6556[_0xace9('0x39')]);return db[_0xace9('0x3a')][_0xace9('0x41')](_0x3c572b)[_0xace9('0x11')](handleEntityNotFound(_0x35704b,null))['then'](respondWithResult(_0x35704b,null))[_0xace9('0x3f')](handleError(_0x35704b,null));};exports[_0xace9('0x42')]=function(_0x5a4227,_0x2e4ed9){return db[_0xace9('0x3a')][_0xace9('0x42')](_0x5a4227[_0xace9('0x43')],{})['then'](respondWithResult(_0x2e4ed9,0xc9))[_0xace9('0x3f')](handleError(_0x2e4ed9,null));};exports[_0xace9('0x20')]=function(_0x1b9a3f,_0x10788d){if(_0x1b9a3f[_0xace9('0x43')]['id']){delete _0x1b9a3f[_0xace9('0x43')]['id'];}return db[_0xace9('0x3a')]['find']({'where':{'id':_0x1b9a3f['params']['id']}})[_0xace9('0x11')](handleEntityNotFound(_0x10788d,null))[_0xace9('0x11')](saveUpdates(_0x1b9a3f[_0xace9('0x43')],null))[_0xace9('0x11')](respondWithResult(_0x10788d,null))[_0xace9('0x3f')](handleError(_0x10788d,null));};exports[_0xace9('0x21')]=function(_0xec3cff,_0x2aa693){return db[_0xace9('0x3a')][_0xace9('0x41')]({'where':{'id':_0xec3cff[_0xace9('0x44')]['id']}})[_0xace9('0x11')](handleEntityNotFound(_0x2aa693,null))[_0xace9('0x11')](removeEntity(_0x2aa693,null))[_0xace9('0x3f')](handleError(_0x2aa693,null));};exports[_0xace9('0x45')]=function(_0x2c7709,_0x2f972c){return db[_0xace9('0x3a')][_0xace9('0x45')]()[_0xace9('0x11')](respondWithResult(_0x2f972c,null))[_0xace9('0x3f')](handleError(_0x2f972c,null));};exports[_0xace9('0x46')]=function(_0x1dda8b,_0x5c465f){var _0xc26070='whatsapp';return interactionService[_0xace9('0x47')](_0x1dda8b,_0xc26070)[_0xace9('0x11')](respondWithResult(_0x5c465f,null))[_0xace9('0x3f')](handleError(_0x5c465f,null));};exports[_0xace9('0x48')]=function(_0x3b6500,_0xc6e47b){var _0x42f9e0={'agent':{},'channel':'whatsapp'};if(_0x3b6500[_0xace9('0x43')]['id']){delete _0x3b6500[_0xace9('0x43')]['id'];}_0x3b6500[_0xace9('0x43')][_0xace9('0x49')]=_0x3b6500['body']['UserId']||_0x3b6500[_0xace9('0x4a')]['id'];_0x42f9e0[_0xace9('0x4b')]['id']=_0x3b6500[_0xace9('0x43')][_0xace9('0x49')];return db[_0xace9('0x3a')][_0xace9('0x41')]({'where':{'id':_0x3b6500[_0xace9('0x44')]['id'],'UserId':null}})[_0xace9('0x11')](handleEntityNotFound(_0xc6e47b,null))['then'](function(_0x2fc6a6){if(_0x2fc6a6){_0x42f9e0[_0xace9('0x18')]=_0x2fc6a6[_0xace9('0x4c')]({'plain':!![]});return db['WhatsappInteraction'][_0xace9('0x41')]({'where':{'id':_0x2fc6a6[_0xace9('0x4d')]}});}return null;})[_0xace9('0x11')](handleEntityNotFound(_0xc6e47b,null))[_0xace9('0x11')](function(_0x298ec4){if(_0x298ec4){_0x42f9e0[_0xace9('0x4e')]=_0x298ec4[_0xace9('0x4c')]({'plain':!![]});interaction_log['info'](_0xace9('0x4f'),_0x3b6500[_0xace9('0x4a')]['id'],_0x3b6500[_0xace9('0x4a')][_0xace9('0x37')],_0x3b6500[_0xace9('0x4a')]['role'],_0x42f9e0[_0xace9('0x4e')]['id'],_0x3b6500[_0xace9('0x43')]?JSON[_0xace9('0x50')](_0x3b6500['body']):_0xace9('0x51'));return respondWithRpcPromise(_0xace9('0x52'),'rejectMessage',_0x42f9e0);}return null;})['then'](function(_0x2b9b86){var _0x1d1eba='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b9b86[_0xace9('0x18')][_0xace9('0x53')];return db[_0xace9('0x54')][_0xace9('0x2a')](_0x1d1eba,{'type':db['Sequelize'][_0xace9('0x55')]['SELECT'],'raw':!![]})[_0xace9('0x11')](function(_0x442cde){return _0x442cde;});})[_0xace9('0x11')](function(_0x3b6ff9){if(_0x3b6ff9){_0x42f9e0[_0xace9('0x18')][_0xace9('0x56')]=_0x3b6ff9[0x0];if(!_0x3b6500[_0xace9('0x43')][_0xace9('0x49')])return;return db[_0xace9('0x57')][_0xace9('0x41')]({'where':{'id':_0x3b6500[_0xace9('0x43')][_0xace9('0x49')],'role':_0xace9('0x4b')},'attributes':['id',_0xace9('0x37'),'fullname','email',_0xace9('0x58')],'raw':!![]});}return null;})[_0xace9('0x11')](function(_0x4ae20d){if(!_0x4ae20d)return null;_0x42f9e0[_0xace9('0x18')]['agent']=_0x4ae20d;return _0x42f9e0;})[_0xace9('0x11')](function(_0x559388){if(_0x559388){_0x559388['message']['interface']=util[_0xace9('0x59')]('SIP/%s',_0x3b6500[_0xace9('0x4a')][_0xace9('0x37')]);_0x559388[_0xace9('0x18')]['channel']=_0x42f9e0[_0xace9('0x5a')];_0x559388[_0xace9('0x18')][_0xace9('0x5b')]=_0x42f9e0['channel'];_0x559388[_0xace9('0x18')][_0xace9('0x5c')]=_0xace9('0x48');respondWithRpcPromise(_0xace9('0x5d'),_0xace9('0x5d'),{'event':_0xace9('0x5e'),'message':_0x559388[_0xace9('0x18')]},client9002);return _0x42f9e0;}return null;})['then'](respondWithResult(_0xc6e47b,null))[_0xace9('0x3f')](handleError(_0xc6e47b,null));};exports[_0xace9('0x19')]=function(_0x474cfd,_0x7289ba){if(_0x474cfd[_0xace9('0x43')]['id']){delete _0x474cfd[_0xace9('0x43')]['id'];}var _0x57091c;return db['WhatsappMessage']['find']({'where':{'id':_0x474cfd[_0xace9('0x44')]['id']}})['then'](handleEntityNotFound(_0x7289ba,null))[_0xace9('0x11')](function(_0x20172a){if(_0x20172a){_0x57091c=_0x20172a;return db[_0xace9('0x5f')]['find']({'where':{'id':_0x20172a[_0xace9('0x60')]}});}})[_0xace9('0x11')](handleEntityNotFound(_0x7289ba,null))[_0xace9('0x11')](function(_0x45f321){if(_0x45f321){logger[_0xace9('0x14')](_0xace9('0x61'),_0xace9('0x19'),_0xace9('0x62'),_0x45f321[_0xace9('0x63')],util['inspect'](_0x474cfd[_0xace9('0x43')],{'showHidden':![],'depth':null}));switch(_0x45f321[_0xace9('0x63')]){case _0xace9('0x64'):if(_0x474cfd[_0xace9('0x43')]['MessageSid']&&_0x474cfd[_0xace9('0x43')][_0xace9('0x65')]===_0x57091c[_0xace9('0x66')]&&_0x474cfd[_0xace9('0x43')][_0xace9('0x67')]&&_0x474cfd[_0xace9('0x43')][_0xace9('0x67')]===_0xace9('0x68')){return _0x57091c[_0xace9('0x20')]({'read':!![]});}else{logger['error'](_0xace9('0x69'),'status',_0xace9('0x64'),util[_0xace9('0x6a')](_0x474cfd[_0xace9('0x43')],{'showHidden':![],'depth':null}));}break;}return _0x57091c;}})[_0xace9('0x11')](respondWithResult(_0x7289ba,null))[_0xace9('0x3f')](handleError(_0x7289ba,null));}; \ No newline at end of file +var _0x7431=['merge','find','create','destroy','describe','accept','whatsapp','reject','body','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','interaction','get','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','channel','motionChannel','EventManager','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','./whatsappMessage.socket','register','jayson/promise','client','http','../../config/logger','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','json','offset','undefined','limit','count','Content-Range','update','status','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','where','filters','pick','VIRTUAL','options','WhatsappMessage','include','findAll','params','includeAll'];(function(_0x2f9800,_0x1a4774){var _0x5c5a86=function(_0x567cf9){while(--_0x567cf9){_0x2f9800['push'](_0x2f9800['shift']());}};_0x5c5a86(++_0x1a4774);}(_0x7431,0x16d));var _0x1743=function(_0x349570,_0x40be36){_0x349570=_0x349570-0x0;var _0x13f81a=_0x7431[_0x349570];return _0x13f81a;};'use strict';var util=require(_0x1743('0x0'));var _=require(_0x1743('0x1'));var Redis=require(_0x1743('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x1743('0x3'));var logger=require('../../config/logger')(_0x1743('0x4'));var config=require(_0x1743('0x5'));var db=require(_0x1743('0x6'))['db'];config[_0x1743('0x7')]=_[_0x1743('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1743('0x7')]));require(_0x1743('0x9'))[_0x1743('0xa')](socket);var jayson=require(_0x1743('0xb'));var client=jayson[_0x1743('0xc')][_0x1743('0xd')]({'port':0x232c});var client9002=jayson[_0x1743('0xc')][_0x1743('0xd')]({'port':0x232a});var interaction_log=require(_0x1743('0xe'))('whatsapp-interactions');function respondWithRpcPromise(_0x4998f8,_0x396af2,_0x4a9169,_0x43df4c){return new Promise(function(_0x470899,_0x439c70){var _0x49af90=_0x43df4c||client;return _0x49af90['request'](_0x4998f8,_0x4a9169)[_0x1743('0xf')](function(_0x1a35e0){logger['info'](_0x1743('0x10'),_0x396af2,_0x1743('0x11'));logger['debug'](_0x1743('0x12'),_0x396af2,_0x1743('0x11'),JSON[_0x1743('0x13')](_0x1a35e0));if(_0x1a35e0['error']){if(_0x1a35e0[_0x1743('0x14')][_0x1743('0x15')]===0x1f4){logger[_0x1743('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x396af2,_0x1a35e0[_0x1743('0x14')][_0x1743('0x16')]);return _0x439c70(_0x1a35e0[_0x1743('0x14')][_0x1743('0x16')]);}logger[_0x1743('0x14')](_0x1743('0x10'),_0x396af2,_0x1a35e0[_0x1743('0x14')][_0x1743('0x16')]);return _0x470899(_0x1a35e0[_0x1743('0x14')][_0x1743('0x16')]);}else{logger[_0x1743('0x17')](_0x1743('0x10'),_0x396af2,_0x1743('0x11'));_0x470899(_0x1a35e0[_0x1743('0x18')][_0x1743('0x16')]);}})[_0x1743('0x19')](function(_0x294275){logger[_0x1743('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x396af2,_0x294275);_0x439c70(_0x294275);});});}function respondWithResult(_0x570f83,_0x2f20a7){_0x2f20a7=_0x2f20a7||0xc8;return function(_0x13e7ae){if(_0x13e7ae){return _0x570f83['status'](_0x2f20a7)[_0x1743('0x1a')](_0x13e7ae);}};}function respondWithFilteredResult(_0x431923,_0x128d44){return function(_0x2578e5){if(_0x2578e5){var _0x10fba3=typeof _0x128d44[_0x1743('0x1b')]===_0x1743('0x1c')&&typeof _0x128d44[_0x1743('0x1d')]===_0x1743('0x1c');var _0x464e67=_0x2578e5[_0x1743('0x1e')];var _0x444ff9=_0x10fba3?0x0:_0x128d44[_0x1743('0x1b')];var _0x41faa4=_0x10fba3?_0x2578e5[_0x1743('0x1e')]:_0x128d44[_0x1743('0x1b')]+_0x128d44[_0x1743('0x1d')];var _0xf87723;if(_0x41faa4>=_0x464e67){_0x41faa4=_0x464e67;_0xf87723=0xc8;}else{_0xf87723=0xce;}_0x431923['status'](_0xf87723);return _0x431923['set'](_0x1743('0x1f'),_0x444ff9+'-'+_0x41faa4+'/'+_0x464e67)['json'](_0x2578e5);}return null;};}function saveUpdates(_0x420305){return function(_0x90a40b){if(_0x90a40b){return _0x90a40b[_0x1743('0x20')](_0x420305)[_0x1743('0xf')](function(_0x292426){return _0x292426;});}return null;};}function removeEntity(_0x294c90){return function(_0x51c479){if(_0x51c479){return _0x51c479['destroy']()[_0x1743('0xf')](function(){_0x294c90[_0x1743('0x21')](0xcc)[_0x1743('0x22')]();});}};}function handleEntityNotFound(_0x322cd0){return function(_0x54186){if(!_0x54186){_0x322cd0[_0x1743('0x23')](0x194);}return _0x54186;};}function handleError(_0xa557d7,_0x3bcef5){_0x3bcef5=_0x3bcef5||0x1f4;return function(_0x25c3e2){logger[_0x1743('0x14')](_0x25c3e2[_0x1743('0x24')]);if(_0x25c3e2[_0x1743('0x25')]){delete _0x25c3e2[_0x1743('0x25')];}_0xa557d7[_0x1743('0x21')](_0x3bcef5)[_0x1743('0x26')](_0x25c3e2);};}exports[_0x1743('0x27')]=function(_0x109def,_0x2ba9f1){var _0x2dd1b9={},_0x110907={},_0x454e90={'count':0x0,'rows':[]};var _0x3626c2=_[_0x1743('0x28')](db['WhatsappMessage'][_0x1743('0x29')],function(_0x508df6){return{'name':_0x508df6[_0x1743('0x2a')],'type':_0x508df6[_0x1743('0x2b')][_0x1743('0x2c')]};});_0x110907[_0x1743('0x2d')]=_[_0x1743('0x28')](_0x3626c2,_0x1743('0x25'));_0x110907[_0x1743('0x2e')]=_[_0x1743('0x2f')](_0x109def[_0x1743('0x2e')]);_0x110907['filters']=_['intersection'](_0x110907['model'],_0x110907[_0x1743('0x2e')]);_0x2dd1b9[_0x1743('0x30')]=_[_0x1743('0x31')](_0x110907[_0x1743('0x2d')],qs[_0x1743('0x32')](_0x109def[_0x1743('0x2e')][_0x1743('0x32')]));_0x2dd1b9[_0x1743('0x30')]=_0x2dd1b9[_0x1743('0x30')][_0x1743('0x33')]?_0x2dd1b9['attributes']:_0x110907['model'];if(!_0x109def['query']['hasOwnProperty']('nolimit')){_0x2dd1b9[_0x1743('0x1d')]=qs[_0x1743('0x1d')](_0x109def[_0x1743('0x2e')]['limit']);_0x2dd1b9['offset']=qs[_0x1743('0x1b')](_0x109def[_0x1743('0x2e')]['offset']);}_0x2dd1b9[_0x1743('0x34')]=qs['sort'](_0x109def['query']['sort']);_0x2dd1b9[_0x1743('0x35')]=qs[_0x1743('0x36')](_[_0x1743('0x37')](_0x109def[_0x1743('0x2e')],_0x110907[_0x1743('0x36')]),_0x3626c2);if(_0x109def[_0x1743('0x2e')]['filter']){_0x2dd1b9[_0x1743('0x35')]=_['merge'](_0x2dd1b9['where'],{'$or':_[_0x1743('0x28')](_0x3626c2,function(_0x3077e3){if(_0x3077e3[_0x1743('0x2b')]!==_0x1743('0x38')){var _0x59edfb={};_0x59edfb[_0x3077e3['name']]={'$like':'%'+_0x109def[_0x1743('0x2e')]['filter']+'%'};return _0x59edfb;}})});}_0x2dd1b9=_['merge']({},_0x2dd1b9,_0x109def[_0x1743('0x39')]);var _0x4e63bf={'where':_0x2dd1b9['where']};return db[_0x1743('0x3a')]['count'](_0x4e63bf)[_0x1743('0xf')](function(_0x29f7a2){_0x454e90['count']=_0x29f7a2;if(_0x109def[_0x1743('0x2e')]['includeAll']){_0x2dd1b9[_0x1743('0x3b')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x1743('0x3c')](_0x2dd1b9);})['then'](function(_0xb6aaf3){_0x454e90['rows']=_0xb6aaf3;return _0x454e90;})[_0x1743('0xf')](respondWithFilteredResult(_0x2ba9f1,_0x2dd1b9))['catch'](handleError(_0x2ba9f1,null));};exports['show']=function(_0x1d258a,_0x64da9){var _0x3ffd05={'raw':!![],'where':{'id':_0x1d258a[_0x1743('0x3d')]['id']}},_0x338b4a={};_0x338b4a[_0x1743('0x2d')]=_[_0x1743('0x2f')](db[_0x1743('0x3a')][_0x1743('0x29')]);_0x338b4a[_0x1743('0x2e')]=_[_0x1743('0x2f')](_0x1d258a[_0x1743('0x2e')]);_0x338b4a[_0x1743('0x36')]=_[_0x1743('0x31')](_0x338b4a[_0x1743('0x2d')],_0x338b4a[_0x1743('0x2e')]);_0x3ffd05['attributes']=_[_0x1743('0x31')](_0x338b4a[_0x1743('0x2d')],qs[_0x1743('0x32')](_0x1d258a[_0x1743('0x2e')][_0x1743('0x32')]));_0x3ffd05['attributes']=_0x3ffd05[_0x1743('0x30')][_0x1743('0x33')]?_0x3ffd05[_0x1743('0x30')]:_0x338b4a[_0x1743('0x2d')];if(_0x1d258a[_0x1743('0x2e')][_0x1743('0x3e')]){_0x3ffd05[_0x1743('0x3b')]=[{'all':!![]}];}_0x3ffd05=_[_0x1743('0x3f')]({},_0x3ffd05,_0x1d258a[_0x1743('0x39')]);return db[_0x1743('0x3a')][_0x1743('0x40')](_0x3ffd05)['then'](handleEntityNotFound(_0x64da9,null))[_0x1743('0xf')](respondWithResult(_0x64da9,null))[_0x1743('0x19')](handleError(_0x64da9,null));};exports[_0x1743('0x41')]=function(_0x3066ba,_0x16aab0){return db[_0x1743('0x3a')]['create'](_0x3066ba['body'],{})[_0x1743('0xf')](respondWithResult(_0x16aab0,0xc9))[_0x1743('0x19')](handleError(_0x16aab0,null));};exports[_0x1743('0x20')]=function(_0x557c62,_0x237446){if(_0x557c62['body']['id']){delete _0x557c62['body']['id'];}return db[_0x1743('0x3a')]['find']({'where':{'id':_0x557c62[_0x1743('0x3d')]['id']}})[_0x1743('0xf')](handleEntityNotFound(_0x237446,null))[_0x1743('0xf')](saveUpdates(_0x557c62['body'],null))['then'](respondWithResult(_0x237446,null))[_0x1743('0x19')](handleError(_0x237446,null));};exports[_0x1743('0x42')]=function(_0x31e13a,_0x4f304f){return db['WhatsappMessage'][_0x1743('0x40')]({'where':{'id':_0x31e13a[_0x1743('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4f304f,null))['then'](removeEntity(_0x4f304f,null))[_0x1743('0x19')](handleError(_0x4f304f,null));};exports['describe']=function(_0x3ab685,_0x9ba9cd){return db[_0x1743('0x3a')][_0x1743('0x43')]()[_0x1743('0xf')](respondWithResult(_0x9ba9cd,null))[_0x1743('0x19')](handleError(_0x9ba9cd,null));};exports[_0x1743('0x44')]=function(_0x3bc2d9,_0x2c3cd5){var _0x5ba98f=_0x1743('0x45');return interactionService['acceptMessage'](_0x3bc2d9,_0x5ba98f)[_0x1743('0xf')](respondWithResult(_0x2c3cd5,null))[_0x1743('0x19')](handleError(_0x2c3cd5,null));};exports[_0x1743('0x46')]=function(_0x1b0164,_0x5e6f9a){var _0x4a454b={'agent':{},'channel':_0x1743('0x45')};if(_0x1b0164[_0x1743('0x47')]['id']){delete _0x1b0164[_0x1743('0x47')]['id'];}_0x1b0164[_0x1743('0x47')][_0x1743('0x48')]=_0x1b0164['body'][_0x1743('0x48')]||_0x1b0164[_0x1743('0x49')]['id'];_0x4a454b[_0x1743('0x4a')]['id']=_0x1b0164[_0x1743('0x47')]['UserId'];return db['WhatsappMessage'][_0x1743('0x40')]({'where':{'id':_0x1b0164['params']['id'],'UserId':null}})[_0x1743('0xf')](handleEntityNotFound(_0x5e6f9a,null))[_0x1743('0xf')](function(_0x4182c5){if(_0x4182c5){_0x4a454b[_0x1743('0x16')]=_0x4182c5['get']({'plain':!![]});return db[_0x1743('0x4b')][_0x1743('0x40')]({'where':{'id':_0x4182c5[_0x1743('0x4c')]}});}return null;})['then'](handleEntityNotFound(_0x5e6f9a,null))[_0x1743('0xf')](function(_0x18b00a){if(_0x18b00a){_0x4a454b[_0x1743('0x4d')]=_0x18b00a[_0x1743('0x4e')]({'plain':!![]});interaction_log[_0x1743('0x17')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b0164[_0x1743('0x49')]['id'],_0x1b0164[_0x1743('0x49')]['name'],_0x1b0164[_0x1743('0x49')][_0x1743('0x4f')],_0x4a454b[_0x1743('0x4d')]['id'],_0x1b0164[_0x1743('0x47')]?JSON[_0x1743('0x13')](_0x1b0164[_0x1743('0x47')]):_0x1743('0x50'));return respondWithRpcPromise(_0x1743('0x51'),_0x1743('0x52'),_0x4a454b);}return null;})[_0x1743('0xf')](function(_0x3c3553){var _0x12ea05='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c3553[_0x1743('0x16')][_0x1743('0x53')];return db[_0x1743('0x54')][_0x1743('0x2e')](_0x12ea05,{'type':db[_0x1743('0x55')][_0x1743('0x56')][_0x1743('0x57')],'raw':!![]})[_0x1743('0xf')](function(_0x15649c){return _0x15649c;});})[_0x1743('0xf')](function(_0x2f6895){if(_0x2f6895){_0x4a454b[_0x1743('0x16')][_0x1743('0x58')]=_0x2f6895[0x0];if(!_0x1b0164['body']['UserId'])return;return db[_0x1743('0x59')]['find']({'where':{'id':_0x1b0164[_0x1743('0x47')]['UserId'],'role':'agent'},'attributes':['id','name',_0x1743('0x5a'),'email',_0x1743('0x5b')],'raw':!![]});}return null;})['then'](function(_0x264f3e){if(!_0x264f3e)return null;_0x4a454b[_0x1743('0x16')][_0x1743('0x4a')]=_0x264f3e;return _0x4a454b;})['then'](function(_0x11b308){if(_0x11b308){_0x11b308['message'][_0x1743('0x5c')]=util['format']('SIP/%s',_0x1b0164[_0x1743('0x49')][_0x1743('0x25')]);_0x11b308[_0x1743('0x16')][_0x1743('0x5d')]=_0x4a454b['channel'];_0x11b308['message'][_0x1743('0x5e')]=_0x4a454b[_0x1743('0x5d')];_0x11b308[_0x1743('0x16')]['event']=_0x1743('0x46');respondWithRpcPromise(_0x1743('0x5f'),_0x1743('0x5f'),{'event':'rejectmessage','message':_0x11b308['message']},client9002);return _0x4a454b;}return null;})[_0x1743('0xf')](respondWithResult(_0x5e6f9a,null))[_0x1743('0x19')](handleError(_0x5e6f9a,null));};exports[_0x1743('0x21')]=function(_0x6ea311,_0x1da381){if(_0x6ea311[_0x1743('0x47')]['id']){delete _0x6ea311['body']['id'];}var _0x13fd70;return db[_0x1743('0x3a')]['find']({'where':{'id':_0x6ea311[_0x1743('0x3d')]['id']}})[_0x1743('0xf')](handleEntityNotFound(_0x1da381,null))['then'](function(_0x2bd38d){if(_0x2bd38d){_0x13fd70=_0x2bd38d;return db['WhatsappAccount']['find']({'where':{'id':_0x2bd38d[_0x1743('0x60')]}});}})[_0x1743('0xf')](handleEntityNotFound(_0x1da381,null))[_0x1743('0xf')](function(_0x15a64d){if(_0x15a64d){logger[_0x1743('0x61')](_0x1743('0x62'),'status',_0x1743('0x63'),_0x15a64d[_0x1743('0x2b')],util['inspect'](_0x6ea311[_0x1743('0x47')],{'showHidden':![],'depth':null}));switch(_0x15a64d[_0x1743('0x2b')]){case _0x1743('0x64'):if(_0x6ea311[_0x1743('0x47')]['MessageSid']&&_0x6ea311[_0x1743('0x47')][_0x1743('0x65')]===_0x13fd70[_0x1743('0x66')]&&_0x6ea311[_0x1743('0x47')][_0x1743('0x67')]&&_0x6ea311[_0x1743('0x47')][_0x1743('0x67')]===_0x1743('0x68')){return _0x13fd70[_0x1743('0x20')]({'read':!![]});}else{logger[_0x1743('0x14')](_0x1743('0x69'),_0x1743('0x21'),_0x1743('0x64'),util[_0x1743('0x6a')](_0x6ea311[_0x1743('0x47')],{'showHidden':![],'depth':null}));}break;}return _0x13fd70;}})[_0x1743('0xf')](respondWithResult(_0x1da381,null))[_0x1743('0x19')](handleError(_0x1da381,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 0a87d68..5aa7298 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 _0xa25c=['WhatsappMessage','setMaxListeners','save','update','remove','hasOwnProperty','exports','../../mysqldb'];(function(_0x20b380,_0x28fe70){var _0x29061c=function(_0x4983c8){while(--_0x4983c8){_0x20b380['push'](_0x20b380['shift']());}};_0x29061c(++_0x28fe70);}(_0xa25c,0x13f));var _0xca25=function(_0x33cfe6,_0x3e215c){_0x33cfe6=_0x33cfe6-0x0;var _0x34b6cf=_0xa25c[_0x33cfe6];return _0x34b6cf;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xca25('0x0'))['db'][_0xca25('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xca25('0x2')](0x0);var events={'afterCreate':_0xca25('0x3'),'afterUpdate':_0xca25('0x4'),'afterDestroy':_0xca25('0x5')};function emitEvent(_0x2cc2d6){return function(_0x336741,_0x498b8e,_0x41d208){WhatsappMessageEvents['emit'](_0x2cc2d6+':'+_0x336741['id'],_0x336741);WhatsappMessageEvents['emit'](_0x2cc2d6,_0x336741);_0x41d208(null);};}for(var e in events){if(events[_0xca25('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xca25('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xefda=['save','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x54dbd4,_0x507c85){var _0x128055=function(_0x27dbed){while(--_0x27dbed){_0x54dbd4['push'](_0x54dbd4['shift']());}};_0x128055(++_0x507c85);}(_0xefda,0x96));var _0xaefd=function(_0x568c1b,_0x2dc6d0){_0x568c1b=_0x568c1b-0x0;var _0x4ffb2c=_0xefda[_0x568c1b];return _0x4ffb2c;};'use strict';var EventEmitter=require(_0xaefd('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xaefd('0x1')](0x0);var events={'afterCreate':_0xaefd('0x2'),'afterUpdate':'update','afterDestroy':_0xaefd('0x3')};function emitEvent(_0x1c65db){return function(_0x2ade44,_0x22df24,_0x1ef6b4){WhatsappMessageEvents[_0xaefd('0x4')](_0x1c65db+':'+_0x2ade44['id'],_0x2ade44);WhatsappMessageEvents['emit'](_0x1c65db,_0x2ade44);_0x1ef6b4(null);};}for(var e in events){if(events[_0xaefd('0x5')](e)){var event=events[e];WhatsappMessage[_0xaefd('0x6')](e,emitEvent(event));}}module[_0xaefd('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 7900726..dddea0f 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 _0xc305=['../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','then','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','twilio','authToken','accountSid','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','node-fetch','path','rimraf'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0xc305,0x1d9));var _0x5c30=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xc305[_0x590a38];return _0xf36626;};'use strict';var _=require('lodash');var util=require(_0x5c30('0x0'));var logger=require('../../config/logger')(_0x5c30('0x1'));var moment=require('moment');var BPromise=require(_0x5c30('0x2'));var rp=require(_0x5c30('0x3'));var fetch=require(_0x5c30('0x4'));var fs=require('fs');var path=require(_0x5c30('0x5'));var rimraf=require(_0x5c30('0x6'));var config=require(_0x5c30('0x7'));var attributes=require(_0x5c30('0x8'));module['exports']=function(_0xc27fee,_0x3aa577){return _0xc27fee[_0x5c30('0x9')]('WhatsappMessage',attributes,{'tableName':_0x5c30('0xa'),'paranoid':![],'indexes':[{'name':_0x5c30('0xb'),'fields':['messageId']},{'name':_0x5c30('0xc'),'fields':[_0x5c30('0xd')],'type':_0x5c30('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x248246,_0x428a35,_0x27a423){var _0x4dd28d=_0xc27fee[_0x5c30('0xf')];var _0x15e82f=_0x248246[_0x5c30('0x10')]({'plain':!![]});if(_0x15e82f[_0x5c30('0x11')][_0x5c30('0x12')]()==='in'||_0x15e82f[_0x5c30('0x11')][_0x5c30('0x12')]()==='out'&&!_0x15e82f[_0x5c30('0x13')]&&!_[_0x5c30('0x14')](_0x15e82f[_0x5c30('0x15')])){_0x4dd28d[_0x5c30('0x16')][_0x5c30('0x17')]({'where':{'id':_0x15e82f['WhatsappInteractionId']}})[_0x5c30('0x18')](function(_0x527c8d){if(_0x527c8d){_0x527c8d['update']({'lastMsgAt':_0x15e82f[_0x5c30('0x19')],'lastMsgDirection':_0x15e82f['direction'][_0x5c30('0x12')]()});}})[_0x5c30('0x1a')](function(_0x2cd017){console[_0x5c30('0x1b')](_0x2cd017);});}if(_0x15e82f['direction']===_0x5c30('0x1c')&&!_0x15e82f[_0x5c30('0x13')]){var _0xb336f9;_0x4dd28d[_0x5c30('0x1d')][_0x5c30('0x1e')]({'where':{'id':_0x15e82f[_0x5c30('0x1f')]},'raw':!![]})[_0x5c30('0x18')](function(_0x489f95){_0xb336f9=_0x489f95;if(_0xb336f9&&_0xb336f9['type']){switch(_0xb336f9['type']){case _0x5c30('0x20'):var _0x5806f2=require(_0x5c30('0x20'));if(_0xb336f9['accountSid']&&_0xb336f9[_0x5c30('0x21')]&&_0xb336f9['phone']){var _0x4850ae=new _0x5806f2(_0xb336f9[_0x5c30('0x22')],_0xb336f9['authToken']);_0x4850ae[_0x5c30('0x23')][_0x5c30('0x24')]({'body':_0x15e82f[_0x5c30('0xd')],'to':_0x5c30('0x25')+_0x15e82f[_0x5c30('0x26')],'from':'whatsapp:'+_0xb336f9[_0x5c30('0x26')],'statusCallback':_0xb336f9[_0x5c30('0x27')]+_0x5c30('0x28')+_0x15e82f['id']+_0x5c30('0x29')+_0xb336f9[_0x5c30('0x2a')]})[_0x5c30('0x18')](function(_0xde9e45){if(_0xde9e45[_0x5c30('0x2b')]){return _0x248246[_0x5c30('0x2c')]({'messageId':_0xde9e45[_0x5c30('0x2b')]});}})[_0x5c30('0x1a')](function(_0x291b64){logger[_0x5c30('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5c30('0x2d'),_0x5c30('0x20'),util[_0x5c30('0x2e')](_0x291b64,{'showHidden':![],'depth':null}));});}else{logger[_0x5c30('0x1b')](_0x5c30('0x2f'),_0x5c30('0x2d'),_0x5c30('0x20'),_0x5c30('0x30'));}break;case _0x5c30('0x31'):var _0x508aa1=_0xb336f9[_0x5c30('0x22')];var _0x2343bf=_0xb336f9[_0x5c30('0x21')];var _0x1b34e9=_0xb336f9[_0x5c30('0x32')]+_0x5c30('0x33')+_0x508aa1+_0x5c30('0x34');var _0x273924={'to':[_0x15e82f['phone']],'message':{'type':'text','text':_0x15e82f[_0x5c30('0xd')]}};var _0x402bdf={'method':_0x5c30('0x35'),'uri':_0x1b34e9,'headers':{'Authorization':_0x5c30('0x36')+_0x2343bf,'Content-Type':'application/json'},'body':_0x273924,'json':!![]};rp(_0x402bdf)['then'](function(_0x2f0c97){if(_0x2f0c97['statuses'][0x0][_0x5c30('0x37')]){return _0x248246[_0x5c30('0x2c')]({'messageId':_0x2f0c97['statuses'][0x0]['message_id']});}})[_0x5c30('0x1a')](function(_0x1761f7){logger[_0x5c30('0x38')](_0x5c30('0x39'),_0x1761f7);});break;}}})['finally'](function(){_0x27a423();});}else{_0x27a423();}}},'charset':_0x5c30('0x3a'),'collate':_0x5c30('0x3b')});}; \ No newline at end of file +var _0x6981=['update','catch','error','secret','WhatsappAccount','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','toLowerCase','direction','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then'];(function(_0x1ea904,_0x943c2a){var _0x24ac2e=function(_0x1ac3e1){while(--_0x1ac3e1){_0x1ea904['push'](_0x1ea904['shift']());}};_0x24ac2e(++_0x943c2a);}(_0x6981,0x14d));var _0x1698=function(_0x5734fa,_0x4fd0bf){_0x5734fa=_0x5734fa-0x0;var _0x58b5a7=_0x6981[_0x5734fa];return _0x58b5a7;};'use strict';var _=require(_0x1698('0x0'));var util=require(_0x1698('0x1'));var logger=require(_0x1698('0x2'))(_0x1698('0x3'));var moment=require('moment');var BPromise=require(_0x1698('0x4'));var rp=require(_0x1698('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x1698('0x6'));var rimraf=require(_0x1698('0x7'));var config=require(_0x1698('0x8'));var attributes=require(_0x1698('0x9'));module[_0x1698('0xa')]=function(_0x3daa0a,_0x40591a){return _0x3daa0a['define'](_0x1698('0xb'),attributes,{'tableName':_0x1698('0xc'),'paranoid':![],'indexes':[{'name':_0x1698('0xd'),'fields':[_0x1698('0xd')]},{'name':_0x1698('0xe'),'fields':[_0x1698('0xf')],'type':_0x1698('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x237884,_0x926653,_0x2ca130){var _0x28e9e8=_0x3daa0a['models'];var _0x3f987f=_0x237884[_0x1698('0x11')]({'plain':!![]});if(_0x3f987f['direction'][_0x1698('0x12')]()==='in'||_0x3f987f[_0x1698('0x13')][_0x1698('0x12')]()===_0x1698('0x14')&&!_0x3f987f['secret']&&!_[_0x1698('0x15')](_0x3f987f[_0x1698('0x16')])){_0x28e9e8[_0x1698('0x17')][_0x1698('0x18')]({'where':{'id':_0x3f987f[_0x1698('0x19')]}})[_0x1698('0x1a')](function(_0x3a35ae){if(_0x3a35ae){_0x3a35ae[_0x1698('0x1b')]({'lastMsgAt':_0x3f987f['createdAt'],'lastMsgDirection':_0x3f987f[_0x1698('0x13')][_0x1698('0x12')]()});}})[_0x1698('0x1c')](function(_0x3a8183){console[_0x1698('0x1d')](_0x3a8183);});}if(_0x3f987f['direction']===_0x1698('0x14')&&!_0x3f987f[_0x1698('0x1e')]){var _0x47e8e9;_0x28e9e8[_0x1698('0x1f')]['find']({'where':{'id':_0x3f987f['WhatsappAccountId']},'raw':!![]})['then'](function(_0x575c64){_0x47e8e9=_0x575c64;if(_0x47e8e9&&_0x47e8e9[_0x1698('0x20')]){switch(_0x47e8e9[_0x1698('0x20')]){case _0x1698('0x21'):var _0x2b096a=require(_0x1698('0x21'));if(_0x47e8e9[_0x1698('0x22')]&&_0x47e8e9['authToken']&&_0x47e8e9[_0x1698('0x23')]){var _0x403457=new _0x2b096a(_0x47e8e9[_0x1698('0x22')],_0x47e8e9[_0x1698('0x24')]);_0x403457[_0x1698('0x25')][_0x1698('0x26')]({'body':_0x3f987f[_0x1698('0xf')],'to':_0x1698('0x27')+_0x3f987f[_0x1698('0x23')],'from':_0x1698('0x27')+_0x47e8e9[_0x1698('0x23')],'statusCallback':_0x47e8e9[_0x1698('0x28')]+_0x1698('0x29')+_0x3f987f['id']+_0x1698('0x2a')+_0x47e8e9[_0x1698('0x2b')]})[_0x1698('0x1a')](function(_0x3973a9){if(_0x3973a9['sid']){return _0x237884[_0x1698('0x1b')]({'messageId':_0x3973a9[_0x1698('0x2c')]});}})[_0x1698('0x1c')](function(_0x14833b){logger[_0x1698('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1698('0x2d'),_0x1698('0x21'),util['inspect'](_0x14833b,{'showHidden':![],'depth':null}));});}else{logger[_0x1698('0x1d')](_0x1698('0x2e'),_0x1698('0x2d'),_0x1698('0x21'),_0x1698('0x2f'));}break;case _0x1698('0x30'):var _0x373d59=_0x47e8e9[_0x1698('0x22')];var _0x7064b3=_0x47e8e9[_0x1698('0x24')];var _0x59a0d9=_0x47e8e9[_0x1698('0x31')]+_0x1698('0x32')+_0x373d59+_0x1698('0x33');var _0x5ee4dd={'to':[_0x3f987f[_0x1698('0x23')]],'message':{'type':_0x1698('0x34'),'text':_0x3f987f[_0x1698('0xf')]}};var _0xc30892={'method':_0x1698('0x35'),'uri':_0x59a0d9,'headers':{'Authorization':'Bearer\x20'+_0x7064b3,'Content-Type':_0x1698('0x36')},'body':_0x5ee4dd,'json':!![]};rp(_0xc30892)[_0x1698('0x1a')](function(_0x58fb5c){if(_0x58fb5c[_0x1698('0x37')][0x0][_0x1698('0x38')]){return _0x237884[_0x1698('0x1b')]({'messageId':_0x58fb5c[_0x1698('0x37')][0x0][_0x1698('0x38')]});}})[_0x1698('0x1c')](function(_0x177f0f){logger[_0x1698('0x39')]('WhatsappMessage,\x20%s',_0x177f0f);});break;}}})['finally'](function(){_0x2ca130();});}else{_0x2ca130();}}},'charset':_0x1698('0x3a'),'collate':_0x1698('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1eb0284..911673d 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 _0x3824=['../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','debug','request\x20sent','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','WhatsappMessage','body','options','raw','then','CreateWhatsappMessage','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e775a,_0x57eaaa){var _0x191794=function(_0xf883ca){while(--_0xf883ca){_0x5e775a['push'](_0x5e775a['shift']());}};_0x191794(++_0x57eaaa);}(_0x3824,0xaf));var _0x4382=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x3824[_0x33bc64];return _0x3fdd34;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4382('0x0'));var rs=require(_0x4382('0x1'));var fs=require('fs');var Redis=require(_0x4382('0x2'));var db=require(_0x4382('0x3'))['db'];var utils=require(_0x4382('0x4'));var logger=require(_0x4382('0x5'))(_0x4382('0x6'));var config=require(_0x4382('0x7'));var jayson=require(_0x4382('0x8'));var client=jayson['client'][_0x4382('0x9')]({'port':0x232a});config['redis']=_[_0x4382('0xa')](config[_0x4382('0xb')],{'host':_0x4382('0xc'),'port':0x18eb});var socket=require(_0x4382('0xd'))(new Redis(config[_0x4382('0xb')]));require('./whatsappMessage.socket')[_0x4382('0xe')](socket);function respondWithRpcPromise(_0x126552,_0x49ad5b,_0xe5a3b0){return new BPromise(function(_0x37ae66,_0x502235){return client[_0x4382('0xf')](_0x126552,_0xe5a3b0)['then'](function(_0x162357){logger[_0x4382('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x49ad5b,'request\x20sent');logger[_0x4382('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x49ad5b,_0x4382('0x12'),JSON['stringify'](_0x162357));if(_0x162357['error']){if(_0x162357[_0x4382('0x13')][_0x4382('0x14')]===0x1f4){logger['error'](_0x4382('0x15'),_0x49ad5b,_0x162357['error'][_0x4382('0x16')]);return _0x502235(_0x162357[_0x4382('0x13')]['message']);}logger[_0x4382('0x13')](_0x4382('0x15'),_0x49ad5b,_0x162357[_0x4382('0x13')][_0x4382('0x16')]);return _0x37ae66(_0x162357[_0x4382('0x13')][_0x4382('0x16')]);}else{logger['info'](_0x4382('0x15'),_0x49ad5b,_0x4382('0x12'));_0x37ae66(_0x162357[_0x4382('0x17')]['message']);}})['catch'](function(_0x318f80){logger['error'](_0x4382('0x15'),_0x49ad5b,_0x318f80);_0x502235(_0x318f80);});});}exports['CreateWhatsappMessage']=function(_0x52407c){var _0x25bf48=this;return new Promise(function(_0x5aaa41,_0x3b2aa2){return db[_0x4382('0x18')]['create'](_0x52407c[_0x4382('0x19')],{'raw':_0x52407c[_0x4382('0x1a')]?_0x52407c[_0x4382('0x1a')][_0x4382('0x1b')]===undefined?!![]:![]:!![]})[_0x4382('0x1c')](function(_0x518bf8){logger['info'](_0x4382('0x1d'),_0x52407c);logger[_0x4382('0x11')](_0x4382('0x1d'),_0x52407c,JSON['stringify'](_0x518bf8));_0x5aaa41(_0x518bf8);})['catch'](function(_0x3a81c7){logger[_0x4382('0x13')]('CreateWhatsappMessage',_0x3a81c7[_0x4382('0x16')],_0x52407c);_0x3b2aa2(_0x25bf48[_0x4382('0x13')](0x1f4,_0x3a81c7[_0x4382('0x16')]));});});}; \ No newline at end of file +var _0x9381=['request\x20sent','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x33d60b,_0x49540f){var _0x55f78a=function(_0x3a0d01){while(--_0x3a0d01){_0x33d60b['push'](_0x33d60b['shift']());}};_0x55f78a(++_0x49540f);}(_0x9381,0x19a));var _0x1938=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x9381[_0x30033a];return _0x5e3518;};'use strict';var _=require(_0x1938('0x0'));var util=require(_0x1938('0x1'));var moment=require('moment');var BPromise=require(_0x1938('0x2'));var rs=require(_0x1938('0x3'));var fs=require('fs');var Redis=require(_0x1938('0x4'));var db=require(_0x1938('0x5'))['db'];var utils=require(_0x1938('0x6'));var logger=require(_0x1938('0x7'))(_0x1938('0x8'));var config=require(_0x1938('0x9'));var jayson=require(_0x1938('0xa'));var client=jayson[_0x1938('0xb')][_0x1938('0xc')]({'port':0x232a});config[_0x1938('0xd')]=_[_0x1938('0xe')](config['redis'],{'host':_0x1938('0xf'),'port':0x18eb});var socket=require(_0x1938('0x10'))(new Redis(config[_0x1938('0xd')]));require('./whatsappMessage.socket')[_0x1938('0x11')](socket);function respondWithRpcPromise(_0x4cfdcf,_0x1f03ef,_0x830c09){return new BPromise(function(_0x5ebb9c,_0x453eb8){return client[_0x1938('0x12')](_0x4cfdcf,_0x830c09)[_0x1938('0x13')](function(_0x159e1e){logger['info'](_0x1938('0x14'),_0x1f03ef,'request\x20sent');logger['debug'](_0x1938('0x15'),_0x1f03ef,_0x1938('0x16'),JSON[_0x1938('0x17')](_0x159e1e));if(_0x159e1e['error']){if(_0x159e1e[_0x1938('0x18')][_0x1938('0x19')]===0x1f4){logger[_0x1938('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x1f03ef,_0x159e1e[_0x1938('0x18')][_0x1938('0x1a')]);return _0x453eb8(_0x159e1e[_0x1938('0x18')][_0x1938('0x1a')]);}logger[_0x1938('0x18')](_0x1938('0x14'),_0x1f03ef,_0x159e1e[_0x1938('0x18')]['message']);return _0x5ebb9c(_0x159e1e[_0x1938('0x18')][_0x1938('0x1a')]);}else{logger[_0x1938('0x1b')](_0x1938('0x14'),_0x1f03ef,_0x1938('0x16'));_0x5ebb9c(_0x159e1e[_0x1938('0x1c')]['message']);}})[_0x1938('0x1d')](function(_0x29e11c){logger[_0x1938('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x1f03ef,_0x29e11c);_0x453eb8(_0x29e11c);});});}exports[_0x1938('0x1e')]=function(_0xef19eb){var _0x3ea74a=this;return new Promise(function(_0x399314,_0x2eeb7b){return db[_0x1938('0x1f')][_0x1938('0x20')](_0xef19eb['body'],{'raw':_0xef19eb[_0x1938('0x21')]?_0xef19eb[_0x1938('0x21')][_0x1938('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x2116ed){logger[_0x1938('0x1b')](_0x1938('0x1e'),_0xef19eb);logger[_0x1938('0x23')](_0x1938('0x1e'),_0xef19eb,JSON[_0x1938('0x17')](_0x2116ed));_0x399314(_0x2116ed);})[_0x1938('0x1d')](function(_0x317094){logger[_0x1938('0x18')]('CreateWhatsappMessage',_0x317094[_0x1938('0x1a')],_0xef19eb);_0x2eeb7b(_0x3ea74a[_0x1938('0x18')](0x1f4,_0x317094[_0x1938('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6731c35..710b3b8 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 _0x9992=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x5a746f,_0x5b3a87){var _0x2e685c=function(_0x1f838e){while(--_0x1f838e){_0x5a746f['push'](_0x5a746f['shift']());}};_0x2e685c(++_0x5b3a87);}(_0x9992,0xfc));var _0x2999=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x9992[_0x7148a3];return _0x52f31d;};'use strict';var WhatsappMessageEvents=require(_0x2999('0x0'));var events=[_0x2999('0x1'),'remove',_0x2999('0x2')];function createListener(_0x5f0da5,_0x3dbe7a){return function(_0x5010b5){_0x3dbe7a[_0x2999('0x3')](_0x5f0da5,_0x5010b5);};}function removeListener(_0x525ca9,_0x5ac4cd){return function(){WhatsappMessageEvents[_0x2999('0x4')](_0x525ca9,_0x5ac4cd);};}exports[_0x2999('0x5')]=function(_0x266389){for(var _0x38265c=0x0,_0x384827=events[_0x2999('0x6')];_0x38265c<_0x384827;_0x38265c++){var _0x42f02b=events[_0x38265c];var _0x3c9046=createListener(_0x2999('0x7')+_0x42f02b,_0x266389);WhatsappMessageEvents['on'](_0x42f02b,_0x3c9046);}}; \ No newline at end of file +var _0x06c0=['emit','removeListener','register','length','./whatsappMessage.events','save','remove','update'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x06c0,0x114));var _0x006c=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x06c0[_0xea8947];return _0x2455e9;};'use strict';var WhatsappMessageEvents=require(_0x006c('0x0'));var events=[_0x006c('0x1'),_0x006c('0x2'),_0x006c('0x3')];function createListener(_0x14687d,_0x4f0b9a){return function(_0x229fd6){_0x4f0b9a[_0x006c('0x4')](_0x14687d,_0x229fd6);};}function removeListener(_0x4c0698,_0x123fa8){return function(){WhatsappMessageEvents[_0x006c('0x5')](_0x4c0698,_0x123fa8);};}exports[_0x006c('0x6')]=function(_0x2c37a3){for(var _0x58307f=0x0,_0x85be0f=events[_0x006c('0x7')];_0x58307f<_0x85be0f;_0x58307f++){var _0x1f6d7c=events[_0x58307f];var _0xeb1653=createListener('whatsappMessage:'+_0x1f6d7c,_0x2c37a3);WhatsappMessageEvents['on'](_0x1f6d7c,_0xeb1653);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e0ea2c0..7961276 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 _0xb6ec=['../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5afd7e,_0x53002f){var _0x2b0626=function(_0x9e1b0){while(--_0x9e1b0){_0x5afd7e['push'](_0x5afd7e['shift']());}};_0x2b0626(++_0x53002f);}(_0xb6ec,0x1e7));var _0xcb6e=function(_0x9e6b05,_0x402640){_0x9e6b05=_0x9e6b05-0x0;var _0x1db966=_0xb6ec[_0x9e6b05];return _0x1db966;};'use strict';var multer=require(_0xcb6e('0x0'));var util=require('util');var path=require(_0xcb6e('0x1'));var timeout=require(_0xcb6e('0x2'));var express=require(_0xcb6e('0x3'));var router=express[_0xcb6e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb6e('0x5'));var interaction=require(_0xcb6e('0x6'));var config=require('../../config/environment');var controller=require(_0xcb6e('0x7'));router[_0xcb6e('0x8')]('/',auth[_0xcb6e('0x9')](),controller['index']);router[_0xcb6e('0x8')](_0xcb6e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xcb6e('0x8')](_0xcb6e('0xb'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xc')]);router[_0xcb6e('0x8')]('/:id/members',auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xd')]);router[_0xcb6e('0x8')](_0xcb6e('0xe'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xf')]);router[_0xcb6e('0x8')](_0xcb6e('0x10'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0x11')]);router[_0xcb6e('0x12')]('/',auth['isAuthenticated'](),controller[_0xcb6e('0x13')]);router[_0xcb6e('0x12')](_0xcb6e('0xe'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0x14')]);router[_0xcb6e('0x12')](_0xcb6e('0x10'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0x15')]);router[_0xcb6e('0x16')](_0xcb6e('0xb'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0x17')]);router[_0xcb6e('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xcb6e('0x19')]);router[_0xcb6e('0x18')](_0xcb6e('0xe'),auth['isAuthenticated'](),controller[_0xcb6e('0x1a')]);router[_0xcb6e('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xcb6e('0x1b')]);module[_0xcb6e('0x1c')]=router; \ No newline at end of file +var _0x9831=['get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9831,0x189));var _0x1983=function(_0xb10caa,_0x3a96fd){_0xb10caa=_0xb10caa-0x0;var _0x1d8653=_0x9831[_0xb10caa];return _0x1d8653;};'use strict';var multer=require(_0x1983('0x0'));var util=require(_0x1983('0x1'));var path=require(_0x1983('0x2'));var timeout=require('connect-timeout');var express=require(_0x1983('0x3'));var router=express[_0x1983('0x4')]();var fs_extra=require(_0x1983('0x5'));var auth=require(_0x1983('0x6'));var interaction=require(_0x1983('0x7'));var config=require(_0x1983('0x8'));var controller=require(_0x1983('0x9'));router[_0x1983('0xa')]('/',auth[_0x1983('0xb')](),controller[_0x1983('0xc')]);router[_0x1983('0xa')](_0x1983('0xd'),auth['isAuthenticated'](),controller[_0x1983('0xe')]);router[_0x1983('0xa')](_0x1983('0xf'),auth[_0x1983('0xb')](),controller[_0x1983('0x10')]);router['get']('/:id/members',auth[_0x1983('0xb')](),controller[_0x1983('0x11')]);router[_0x1983('0xa')](_0x1983('0x12'),auth['isAuthenticated'](),controller[_0x1983('0x13')]);router[_0x1983('0xa')](_0x1983('0x14'),auth['isAuthenticated'](),controller[_0x1983('0x15')]);router[_0x1983('0x16')]('/',auth[_0x1983('0xb')](),controller[_0x1983('0x17')]);router[_0x1983('0x16')]('/:id/teams',auth[_0x1983('0xb')](),controller[_0x1983('0x18')]);router['post']('/:id/users',auth[_0x1983('0xb')](),controller[_0x1983('0x19')]);router[_0x1983('0x1a')](_0x1983('0xf'),auth[_0x1983('0xb')](),controller[_0x1983('0x1b')]);router[_0x1983('0x1c')](_0x1983('0xf'),auth[_0x1983('0xb')](),controller['destroy']);router[_0x1983('0x1c')](_0x1983('0x12'),auth[_0x1983('0xb')](),controller[_0x1983('0x1d')]);router['delete']('/:id/users',auth[_0x1983('0xb')](),controller[_0x1983('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 3b817f7..ced7897 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 _0x4ef1=['STRING','sequelize','exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x4ef1,0xeb));var _0x14ef=function(_0x14af87,_0x149ac3){_0x14af87=_0x14af87-0x0;var _0x4ff770=_0x4ef1[_0x14af87];return _0x4ff770;};'use strict';var Sequelize=require(_0x14ef('0x0'));module[_0x14ef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x14ef('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x14ef('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x14ef('0x4')](_0x14ef('0x5'),_0x14ef('0x6'),_0x14ef('0x7'))},'description':{'type':Sequelize[_0x14ef('0x8')]}}; \ No newline at end of file +var _0xe87e=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5d7463,_0x3dbc4a){var _0x316d29=function(_0x1b7708){while(--_0x1b7708){_0x5d7463['push'](_0x5d7463['shift']());}};_0x316d29(++_0x3dbc4a);}(_0xe87e,0x17d));var _0xee87=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xe87e[_0x3ba924];return _0x4cc1df;};'use strict';var Sequelize=require(_0xee87('0x0'));module[_0xee87('0x1')]={'name':{'type':Sequelize[_0xee87('0x2')],'unique':_0xee87('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xee87('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xee87('0x5'),_0xee87('0x6'),_0xee87('0x7'))},'description':{'type':Sequelize[_0xee87('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 50b797f..685fbaf 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 _0x2133=['agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','nolimit','addTeams','ids','Agents','interface','sequelize','each','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','SELECT','every','TeamId','all','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','getAgents','hasOwnProperty','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','then','destroy','get','WhatsappQueues','UserProfileResource','name','index','map','WhatsappQueue','rawAttributes','type','key','include','query','findAll','rows','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','error','describe','findOne','UserWhatsappQueue','order','sort','where','pick','WhatsappQueueId','filter','User'];(function(_0x19d988,_0x294a0f){var _0x5f2138=function(_0x2a142c){while(--_0x2a142c){_0x19d988['push'](_0x19d988['shift']());}};_0x5f2138(++_0x294a0f);}(_0x2133,0x96));var _0x3213=function(_0x5ba0b2,_0x8563d4){_0x5ba0b2=_0x5ba0b2-0x0;var _0x209397=_0x2133[_0x5ba0b2];return _0x209397;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3213('0x0'));var squel=require(_0x3213('0x1'));var Redis=require(_0x3213('0x2'));var qs=require(_0x3213('0x3'));var logger=require(_0x3213('0x4'))(_0x3213('0x5'));var config=require(_0x3213('0x6'));var db=require(_0x3213('0x7'))['db'];config[_0x3213('0x8')]=_[_0x3213('0x9')](config[_0x3213('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3213('0xa'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x3213('0xb')](socket);function respondWithStatusCode(_0x23c899,_0x2f438a){_0x2f438a=_0x2f438a||0xcc;return function(_0x860c6c){if(_0x860c6c){return _0x23c899[_0x3213('0xc')](_0x2f438a);}return _0x23c899[_0x3213('0xd')](_0x2f438a)[_0x3213('0xe')]();};}function respondWithResult(_0x57bf7d,_0xa92b55){_0xa92b55=_0xa92b55||0xc8;return function(_0x2f564b){if(_0x2f564b){return _0x57bf7d[_0x3213('0xd')](_0xa92b55)['json'](_0x2f564b);}};}function respondWithFilteredResult(_0x30b7e3,_0x3f466e){return function(_0xccc64f){if(_0xccc64f){var _0x1d8d6b=typeof _0x3f466e['offset']==='undefined'&&typeof _0x3f466e['limit']===_0x3213('0xf');var _0x3a7409=_0xccc64f[_0x3213('0x10')];var _0x407b48=_0x1d8d6b?0x0:_0x3f466e[_0x3213('0x11')];var _0x48ff5b=_0x1d8d6b?_0xccc64f[_0x3213('0x10')]:_0x3f466e[_0x3213('0x11')]+_0x3f466e[_0x3213('0x12')];var _0x45fc89;if(_0x48ff5b>=_0x3a7409){_0x48ff5b=_0x3a7409;_0x45fc89=0xc8;}else{_0x45fc89=0xce;}_0x30b7e3[_0x3213('0xd')](_0x45fc89);return _0x30b7e3[_0x3213('0x13')](_0x3213('0x14'),_0x407b48+'-'+_0x48ff5b+'/'+_0x3a7409)['json'](_0xccc64f);}return null;};}function saveUpdates(_0x506200){return function(_0x199f3b){if(_0x199f3b){return _0x199f3b['update'](_0x506200)[_0x3213('0x15')](function(_0x30d5e5){return _0x30d5e5;});}return null;};}function removeEntity(_0x503d28){return function(_0x35824e){if(_0x35824e){return _0x35824e[_0x3213('0x16')]()[_0x3213('0x15')](function(){var _0x804633=_0x35824e[_0x3213('0x17')]({'plain':!![]});var _0x4a7b33=_0x3213('0x18');return db[_0x3213('0x19')]['destroy']({'where':{'type':_0x4a7b33,'resourceId':_0x804633['id']}})[_0x3213('0x15')](function(){return _0x35824e;});})[_0x3213('0x15')](function(){_0x503d28[_0x3213('0xd')](0xcc)[_0x3213('0xe')]();});}};}function handleEntityNotFound(_0x4b2435){return function(_0x3b3379){if(!_0x3b3379){_0x4b2435['sendStatus'](0x194);}return _0x3b3379;};}function handleError(_0x1781d9,_0x255e03){_0x255e03=_0x255e03||0x1f4;return function(_0x1be6e8){logger['error'](_0x1be6e8['stack']);if(_0x1be6e8[_0x3213('0x1a')]){delete _0x1be6e8[_0x3213('0x1a')];}_0x1781d9[_0x3213('0xd')](_0x255e03)['send'](_0x1be6e8);};}exports[_0x3213('0x1b')]=function(_0x1e77ef,_0x2c90bd){var _0x2e8c90={};var _0x169ad8={'count':0x0,'rows':[]};var _0x23c388=_[_0x3213('0x1c')](db[_0x3213('0x1d')][_0x3213('0x1e')],function(_0x3104a5){return{'name':_0x3104a5['fieldName'],'type':_0x3104a5[_0x3213('0x1f')][_0x3213('0x20')]};});_0x2e8c90=qs['getOptions'](_0x23c388,_0x1e77ef);var _0x3fffc4={'where':_0x2e8c90['where']};return db['WhatsappQueue'][_0x3213('0x10')](_0x3fffc4)[_0x3213('0x15')](function(_0x140221){_0x169ad8[_0x3213('0x10')]=_0x140221;_0x2e8c90[_0x3213('0x21')]=qs[_0x3213('0x21')](_0x1e77ef[_0x3213('0x22')]);return db['WhatsappQueue'][_0x3213('0x23')](_0x2e8c90);})[_0x3213('0x15')](function(_0x3ea5f4){_0x169ad8[_0x3213('0x24')]=_0x3ea5f4;return _0x169ad8;})['then'](respondWithFilteredResult(_0x2c90bd,_0x2e8c90))['catch'](handleError(_0x2c90bd,null));};exports[_0x3213('0x25')]=function(_0x3d899d,_0x4e6eea){var _0x544514={'raw':!![],'where':{'id':_0x3d899d[_0x3213('0x26')]['id']}},_0x1fde27={};_0x1fde27[_0x3213('0x27')]=_[_0x3213('0x28')](db[_0x3213('0x1d')]['rawAttributes']);_0x1fde27[_0x3213('0x22')]=_[_0x3213('0x28')](_0x3d899d[_0x3213('0x22')]);_0x1fde27[_0x3213('0x29')]=_[_0x3213('0x2a')](_0x1fde27[_0x3213('0x27')],_0x1fde27[_0x3213('0x22')]);_0x544514[_0x3213('0x2b')]=_['intersection'](_0x1fde27[_0x3213('0x27')],qs[_0x3213('0x2c')](_0x3d899d[_0x3213('0x22')][_0x3213('0x2c')]));_0x544514[_0x3213('0x2b')]=_0x544514[_0x3213('0x2b')][_0x3213('0x2d')]?_0x544514[_0x3213('0x2b')]:_0x1fde27[_0x3213('0x27')];if(_0x3d899d[_0x3213('0x22')][_0x3213('0x2e')]){_0x544514[_0x3213('0x21')]=[{'all':!![]}];}_0x544514=_[_0x3213('0x2f')]({},_0x544514,_0x3d899d[_0x3213('0x30')]);return db[_0x3213('0x1d')][_0x3213('0x31')](_0x544514)[_0x3213('0x15')](handleEntityNotFound(_0x4e6eea,null))[_0x3213('0x15')](respondWithResult(_0x4e6eea,null))[_0x3213('0x32')](handleError(_0x4e6eea,null));};exports[_0x3213('0x33')]=function(_0x4d2ac8,_0x5e5c12){return db[_0x3213('0x1d')][_0x3213('0x33')](_0x4d2ac8[_0x3213('0x34')],{})[_0x3213('0x15')](function(_0x317e0c){var _0x24ba25=_0x4d2ac8['user']['get']({'plain':!![]});if(!_0x24ba25)throw new Error(_0x3213('0x35'));if(_0x24ba25[_0x3213('0x36')]===_0x3213('0x37')){var _0x26e8ff=_0x317e0c[_0x3213('0x17')]({'plain':!![]});var _0x32de0d=_0x3213('0x18');return db['UserProfileSection'][_0x3213('0x31')]({'where':{'name':_0x32de0d,'userProfileId':_0x24ba25['userProfileId']},'raw':!![]})[_0x3213('0x15')](function(_0x46a76c){if(_0x46a76c&&_0x46a76c[_0x3213('0x38')]===0x0){return db[_0x3213('0x19')]['create']({'name':_0x26e8ff[_0x3213('0x1a')],'resourceId':_0x26e8ff['id'],'type':_0x46a76c[_0x3213('0x1a')],'sectionId':_0x46a76c['id']},{})[_0x3213('0x15')](function(){return _0x317e0c;});}else{return _0x317e0c;}})[_0x3213('0x32')](function(_0x5b0b17){logger[_0x3213('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b0b17);throw _0x5b0b17;});}return _0x317e0c;})[_0x3213('0x15')](respondWithResult(_0x5e5c12,0xc9))['catch'](handleError(_0x5e5c12,null));};exports['update']=function(_0x41d236,_0x2cc66c){if(_0x41d236['body']['id']){delete _0x41d236[_0x3213('0x34')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x41d236[_0x3213('0x26')]['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x2cc66c,null))['then'](saveUpdates(_0x41d236['body'],null))[_0x3213('0x15')](respondWithResult(_0x2cc66c,null))[_0x3213('0x32')](handleError(_0x2cc66c,null));};exports[_0x3213('0x16')]=function(_0x2dc0e7,_0x4963dd){return db[_0x3213('0x1d')][_0x3213('0x31')]({'where':{'id':_0x2dc0e7['params']['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x4963dd,null))[_0x3213('0x15')](removeEntity(_0x4963dd,null))[_0x3213('0x32')](handleError(_0x4963dd,null));};exports[_0x3213('0x3a')]=function(_0x2c8b50,_0x47cab9){return db[_0x3213('0x1d')]['describe']()[_0x3213('0x15')](respondWithResult(_0x47cab9,null))[_0x3213('0x32')](handleError(_0x47cab9,null));};exports['getMembers']=function(_0xb2967e,_0x506eee){var _0x43176a={'raw':!![],'where':{}},_0xce23e0={},_0x25909b;return db[_0x3213('0x1d')][_0x3213('0x3b')]({'where':{'id':_0xb2967e['params']['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x506eee,null))[_0x3213('0x15')](function(_0x22d5d5){if(_0x22d5d5){_0x25909b=_0x22d5d5[_0x3213('0x17')]({'plain':!![]});_0xce23e0[_0x3213('0x27')]=_[_0x3213('0x28')](db[_0x3213('0x3c')][_0x3213('0x1e')]);_0xce23e0[_0x3213('0x22')]=_[_0x3213('0x28')](_0xb2967e[_0x3213('0x22')]);_0xce23e0[_0x3213('0x29')]=_[_0x3213('0x2a')](_0xce23e0[_0x3213('0x27')],_0xce23e0[_0x3213('0x22')]);_0x43176a['attributes']=_[_0x3213('0x2a')](_0xce23e0[_0x3213('0x27')],qs[_0x3213('0x2c')](_0xb2967e['query'][_0x3213('0x2c')]));_0x43176a[_0x3213('0x2b')]=_0x43176a[_0x3213('0x2b')][_0x3213('0x2d')]?_0x43176a[_0x3213('0x2b')]:_0xce23e0[_0x3213('0x27')];if(!_0xb2967e[_0x3213('0x22')]['hasOwnProperty']('nolimit')){_0x43176a[_0x3213('0x12')]=qs['limit'](_0xb2967e[_0x3213('0x22')][_0x3213('0x12')]);_0x43176a[_0x3213('0x11')]=qs[_0x3213('0x11')](_0xb2967e[_0x3213('0x22')]['offset']);}_0x43176a[_0x3213('0x3d')]=qs['sort'](_0xb2967e[_0x3213('0x22')][_0x3213('0x3e')]);_0x43176a[_0x3213('0x3f')]=qs[_0x3213('0x29')](_[_0x3213('0x40')](_0xb2967e[_0x3213('0x22')],_0xce23e0[_0x3213('0x29')]));_0x43176a[_0x3213('0x3f')][_0x3213('0x41')]=_0x22d5d5['id'];if(_0xb2967e[_0x3213('0x22')][_0x3213('0x42')]){_0x43176a[_0x3213('0x3f')]=_[_0x3213('0x2f')](_0x43176a[_0x3213('0x3f')],{'$or':_[_0x3213('0x1c')](_0x43176a['attributes'],function(_0x2c268c){var _0xbd69fe={};_0xbd69fe[_0x2c268c]={'$like':'%'+_0xb2967e[_0x3213('0x22')][_0x3213('0x42')]+'%'};return _0xbd69fe;})});}_0x43176a=_['merge']({},_0x43176a,_0xb2967e[_0x3213('0x30')]);return db['UserWhatsappQueue'][_0x3213('0x23')](_0x43176a);}})[_0x3213('0x15')](function(_0x179ece){if(_0x179ece){return db[_0x3213('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x179ece,'UserId'),'role':_0x3213('0x44')},'attributes':['id',_0x3213('0x1a'),_0x3213('0x45'),_0x3213('0x46'),'createdAt']});}})[_0x3213('0x15')](function(_0x1cd5a9){if(_0x1cd5a9){return{'count':_0x1cd5a9[_0x3213('0x10')],'rows':_[_0x3213('0x1c')](_0x1cd5a9['rows'],function(_0x322653){return{'membername':_0x322653['name'],'UserId':_0x322653['id'],'queue_name':_0x25909b[_0x3213('0x1a')],'WhatsappQueueId':_0x25909b['id'],'interface':util[_0x3213('0x47')](_0x3213('0x48'),_0x3213('0x49'),_0x322653[_0x3213('0x1a')]),'penalty':0x0,'paused':_0x322653['whatsappPause'],'createdAt':_0x322653[_0x3213('0x4a')],'updatedAt':_0x322653[_0x3213('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x506eee,_0x43176a))[_0x3213('0x32')](handleError(_0x506eee,null));};exports[_0x3213('0x4b')]=function(_0x3b1cea,_0x2b646c){var _0xd05418={};var _0x5306c7={};var _0x17c3f6;var _0x4242df;return db['WhatsappQueue'][_0x3213('0x3b')]({'where':{'id':_0x3b1cea['params']['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x2b646c,null))[_0x3213('0x15')](function(_0xfa4d52){if(_0xfa4d52){_0x17c3f6=_0xfa4d52;_0x5306c7[_0x3213('0x27')]=_['keys'](db[_0x3213('0x4c')]['rawAttributes']);_0x5306c7[_0x3213('0x22')]=_[_0x3213('0x28')](_0x3b1cea[_0x3213('0x22')]);_0x5306c7[_0x3213('0x29')]=_[_0x3213('0x2a')](_0x5306c7['model'],_0x5306c7[_0x3213('0x22')]);_0xd05418[_0x3213('0x2b')]=_[_0x3213('0x2a')](_0x5306c7[_0x3213('0x27')],qs[_0x3213('0x2c')](_0x3b1cea[_0x3213('0x22')][_0x3213('0x2c')]));_0xd05418[_0x3213('0x2b')]=_0xd05418['attributes'][_0x3213('0x2d')]?_0xd05418[_0x3213('0x2b')]:_0x5306c7[_0x3213('0x27')];_0xd05418[_0x3213('0x3d')]=qs[_0x3213('0x3e')](_0x3b1cea[_0x3213('0x22')][_0x3213('0x3e')]);_0xd05418['where']=qs[_0x3213('0x29')](_[_0x3213('0x40')](_0x3b1cea[_0x3213('0x22')],_0x5306c7[_0x3213('0x29')]));if(_0x3b1cea[_0x3213('0x22')][_0x3213('0x42')]){_0xd05418['where']=_[_0x3213('0x2f')](_0xd05418['where'],{'$or':_[_0x3213('0x1c')](_0xd05418['attributes'],function(_0x1137c1){var _0x5eafec={};_0x5eafec[_0x1137c1]={'$like':'%'+_0x3b1cea[_0x3213('0x22')][_0x3213('0x42')]+'%'};return _0x5eafec;})});}_0xd05418=_[_0x3213('0x2f')]({},_0xd05418,_0x3b1cea[_0x3213('0x30')]);return _0x17c3f6[_0x3213('0x4b')](_0xd05418);}})['then'](function(_0x557d09){if(_0x557d09){_0x4242df=_0x557d09['length'];if(!_0x3b1cea[_0x3213('0x22')]['hasOwnProperty'](_0x3213('0x4d'))){_0xd05418['limit']=qs[_0x3213('0x12')](_0x3b1cea[_0x3213('0x22')][_0x3213('0x12')]);_0xd05418[_0x3213('0x11')]=qs[_0x3213('0x11')](_0x3b1cea[_0x3213('0x22')]['offset']);}return _0x17c3f6[_0x3213('0x4b')](_0xd05418);}})['then'](function(_0x12a40d){if(_0x12a40d){return _0x12a40d?{'count':_0x4242df,'rows':_0x12a40d}:null;}})[_0x3213('0x15')](respondWithResult(_0x2b646c,null))[_0x3213('0x32')](handleError(_0x2b646c,null));};exports[_0x3213('0x4e')]=function(_0x428830,_0x37d876){var _0x3ef30f=_0x428830[_0x3213('0x34')][_0x3213('0x4f')];return db[_0x3213('0x4c')][_0x3213('0x23')]({'where':{'id':_0x3ef30f},'attributes':['id'],'include':[{'model':db[_0x3213('0x43')],'as':_0x3213('0x50'),'attributes':['id',_0x3213('0x1a'),'online','voicePause',_0x3213('0x51')],'raw':!![]}]})[_0x3213('0x15')](function(_0x5f5b42){if(_0x5f5b42){var _0x2de1c8=_['flatMap'](_0x5f5b42,function(_0xeb3759){var _0x1fcc0a=_0xeb3759[_0x3213('0x17')]({'plain':!![]});return _0x1fcc0a['Agents'];});return db['WhatsappQueue'][_0x3213('0x31')]({'where':{'id':_0x428830[_0x3213('0x26')]['id']}})['then'](function(_0x405b47){return db[_0x3213('0x52')]['transaction'](function(_0x45d24a){return _0x405b47[_0x3213('0x4e')](_0x3ef30f,{'transaction':_0x45d24a})[_0x3213('0x15')](function(){return BPromise[_0x3213('0x53')](_0x2de1c8,function(_0x5ebb32){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x5ebb32['id'],'WhatsappQueueId':_0x428830[_0x3213('0x26')]['id']},'transaction':_0x45d24a});});})[_0x3213('0x15')](function(){_0x2de1c8[_0x3213('0x54')](function(_0x29a742){socket[_0x3213('0x55')]('userWhatsappQueue:save',{'UserId':_0x29a742['id'],'WhatsappQueueId':_0x405b47['id']});});});});});}})[_0x3213('0x15')](respondWithStatusCode(_0x37d876,null))[_0x3213('0x32')](handleError(_0x37d876,null));};exports[_0x3213('0x56')]=function(_0x1a3f07,_0x377a99){return db[_0x3213('0x4c')][_0x3213('0x23')]({'where':{'id':_0x1a3f07[_0x3213('0x22')][_0x3213('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x3213('0x43')],'as':_0x3213('0x50'),'attributes':['id'],'raw':!![]}]})[_0x3213('0x15')](handleEntityNotFound(_0x377a99,null))[_0x3213('0x15')](function(_0x39c965){var _0x2c760d=_['map'](_0x39c965,'id');var _0x130391=[];var _0x48571b=[];var _0x4bfa6a=squel[_0x3213('0x57')]();_0x4bfa6a[_0x3213('0x58')](_0x3213('0x59'))[_0x3213('0x5a')](_0x3213('0x5b'),'tq')['join'](_0x3213('0x5c'),'ut',_0x3213('0x5d'))['where']('WhatsappQueueId\x20=\x20?',_0x1a3f07[_0x3213('0x26')]['id']);for(var _0x2705b2=0x0;_0x2705b2<_0x39c965['length'];_0x2705b2+=0x1){let _0x208bfa=_0x39c965[_0x2705b2];for(var _0x3e2ba4=0x0;_0x3e2ba4<_0x208bfa[_0x3213('0x50')][_0x3213('0x2d')];_0x3e2ba4+=0x1){let _0x53fe2a=_0x208bfa[_0x3213('0x50')][_0x3e2ba4];var _0x18b73b=_0x4bfa6a['clone']();_0x18b73b[_0x3213('0x3f')]('ut.UserId\x20=\x20?',_0x53fe2a['id']);_0x48571b[_0x3213('0x5e')](db[_0x3213('0x52')]['query'](_0x18b73b[_0x3213('0x5f')](),{'type':db['sequelize']['QueryTypes'][_0x3213('0x60')]})[_0x3213('0x15')](function(_0x26fd43){if(_0x26fd43['length']===0x1){return _0x53fe2a['id'];}else{var _0x3040e2=_[_0x3213('0x61')](_['map'](_0x26fd43,_0x3213('0x62')),function(_0x39ce0e){return _['includes'](_0x2c760d,_0x39ce0e);});if(_0x3040e2){return _0x53fe2a['id'];}}}));}}return BPromise[_0x3213('0x63')](_0x48571b)[_0x3213('0x15')](function(_0x23b095){_0x130391=_(_0x130391)['union'](_0x23b095)[_0x3213('0x64')]()['value']();return db[_0x3213('0x1d')]['find']({'where':{'id':_0x1a3f07[_0x3213('0x26')]['id']}})['then'](function(_0x328b0a){return db[_0x3213('0x52')]['transaction'](function(_0x5e7e11){return _0x328b0a[_0x3213('0x56')](_0x1a3f07[_0x3213('0x22')]['ids'],{'transaction':_0x5e7e11})[_0x3213('0x15')](function(){if(!_[_0x3213('0x65')](_0x130391)){return _0x328b0a[_0x3213('0x66')](_0x130391,{'transaction':_0x5e7e11});}})[_0x3213('0x15')](function(){_0x130391['forEach'](function(_0xe67f3e){socket[_0x3213('0x55')](_0x3213('0x67'),{'UserId':_0xe67f3e,'WhatsappQueueId':_0x328b0a['id']});});});});});});})[_0x3213('0x15')](respondWithStatusCode(_0x377a99,null))['catch'](handleError(_0x377a99,null));};exports[_0x3213('0x68')]=function(_0x9828d1,_0x18bb48){return db[_0x3213('0x1d')]['find']({'where':{'id':_0x9828d1[_0x3213('0x26')]['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x18bb48,null))[_0x3213('0x15')](function(_0xd07856){if(_0xd07856){return _0xd07856[_0x3213('0x68')](_0x9828d1[_0x3213('0x34')][_0x3213('0x4f')],_[_0x3213('0x69')](_0x9828d1[_0x3213('0x34')],['ids','id'])||{})['spread'](function(_0x5b8ab0){for(var _0x337672=0x0;_0x337672<_0x9828d1[_0x3213('0x34')]['ids']['length'];_0x337672+=0x1){socket[_0x3213('0x55')](_0x3213('0x6a'),{'UserId':Number(_0x9828d1[_0x3213('0x34')][_0x3213('0x4f')][_0x337672]),'WhatsappQueueId':Number(_0x9828d1[_0x3213('0x26')]['id'])});}return _0x5b8ab0;});}})[_0x3213('0x15')](respondWithResult(_0x18bb48,null))['catch'](handleError(_0x18bb48,null));};exports[_0x3213('0x66')]=function(_0x323ea3,_0x39bd26){return db['WhatsappQueue'][_0x3213('0x31')]({'where':{'id':_0x323ea3[_0x3213('0x26')]['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x39bd26,null))['then'](function(_0x3aa589){if(_0x3aa589){return _0x3aa589[_0x3213('0x66')](_0x323ea3['query'][_0x3213('0x4f')])[_0x3213('0x15')](function(){if(_['isArray'](_0x323ea3[_0x3213('0x22')][_0x3213('0x4f')])){for(var _0x39e45b=0x0;_0x39e45b<_0x323ea3[_0x3213('0x22')][_0x3213('0x4f')][_0x3213('0x2d')];_0x39e45b+=0x1){socket[_0x3213('0x55')]('userWhatsappQueue:remove',{'UserId':Number(_0x323ea3['query'][_0x3213('0x4f')][_0x39e45b]),'WhatsappQueueId':Number(_0x323ea3['params']['id'])});}}else{socket[_0x3213('0x55')](_0x3213('0x67'),{'UserId':Number(_0x323ea3[_0x3213('0x22')]['ids']),'WhatsappQueueId':Number(_0x323ea3['params']['id'])});}});}})[_0x3213('0x15')](respondWithStatusCode(_0x39bd26,null))[_0x3213('0x32')](handleError(_0x39bd26,null));};exports[_0x3213('0x6b')]=function(_0x2b0f54,_0x37a75c){var _0x52b396={};var _0x2bbb9a={};var _0x901188;var _0x40c22f;return db['WhatsappQueue'][_0x3213('0x3b')]({'where':{'id':_0x2b0f54[_0x3213('0x26')]['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x37a75c,null))['then'](function(_0x589720){if(_0x589720){_0x901188=_0x589720;_0x2bbb9a[_0x3213('0x27')]=_[_0x3213('0x28')](db[_0x3213('0x43')][_0x3213('0x1e')]);_0x2bbb9a[_0x3213('0x22')]=_[_0x3213('0x28')](_0x2b0f54['query']);_0x2bbb9a[_0x3213('0x29')]=_['intersection'](_0x2bbb9a[_0x3213('0x27')],_0x2bbb9a[_0x3213('0x22')]);_0x52b396[_0x3213('0x2b')]=_['intersection'](_0x2bbb9a[_0x3213('0x27')],qs[_0x3213('0x2c')](_0x2b0f54[_0x3213('0x22')][_0x3213('0x2c')]));_0x52b396[_0x3213('0x2b')]=_0x52b396[_0x3213('0x2b')][_0x3213('0x2d')]?_0x52b396[_0x3213('0x2b')]:_0x2bbb9a[_0x3213('0x27')];_0x52b396[_0x3213('0x3d')]=qs[_0x3213('0x3e')](_0x2b0f54[_0x3213('0x22')][_0x3213('0x3e')]);_0x52b396[_0x3213('0x3f')]=qs['filters'](_[_0x3213('0x40')](_0x2b0f54[_0x3213('0x22')],_0x2bbb9a['filters']));if(_0x2b0f54['query'][_0x3213('0x42')]){_0x52b396[_0x3213('0x3f')]=_[_0x3213('0x2f')](_0x52b396['where'],{'$or':_[_0x3213('0x1c')](_0x52b396['attributes'],function(_0x102fdf){var _0x10316c={};_0x10316c[_0x102fdf]={'$like':'%'+_0x2b0f54[_0x3213('0x22')][_0x3213('0x42')]+'%'};return _0x10316c;})});}_0x52b396=_[_0x3213('0x2f')]({},_0x52b396,_0x2b0f54[_0x3213('0x30')]);return _0x901188['getAgents'](_0x52b396);}})['then'](function(_0x441b6a){if(_0x441b6a){_0x40c22f=_0x441b6a[_0x3213('0x2d')];if(!_0x2b0f54[_0x3213('0x22')][_0x3213('0x6c')](_0x3213('0x4d'))){_0x52b396[_0x3213('0x12')]=qs[_0x3213('0x12')](_0x2b0f54[_0x3213('0x22')]['limit']);_0x52b396[_0x3213('0x11')]=qs[_0x3213('0x11')](_0x2b0f54[_0x3213('0x22')][_0x3213('0x11')]);}return _0x901188[_0x3213('0x6b')](_0x52b396);}})['then'](function(_0x2244c5){if(_0x2244c5){return _0x2244c5?{'count':_0x40c22f,'rows':_0x2244c5}:null;}})[_0x3213('0x15')](respondWithResult(_0x37a75c,null))[_0x3213('0x32')](handleError(_0x37a75c,null));}; \ No newline at end of file +var _0x564c=['undefined','limit','count','set','Content-Range','update','destroy','then','WhatsappQueues','UserProfileResource','end','sendStatus','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','getOptions','where','include','query','rows','catch','show','params','keys','filters','model','attributes','intersection','fields','length','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','nolimit','sort','filter','UserWhatsappQueue','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','findAll','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','order','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','status','offset'];(function(_0xa9577a,_0x225996){var _0xa5abb8=function(_0x1f6b33){while(--_0x1f6b33){_0xa9577a['push'](_0xa9577a['shift']());}};_0xa5abb8(++_0x225996);}(_0x564c,0xef));var _0xc564=function(_0x203cf5,_0x8421e0){_0x203cf5=_0x203cf5-0x0;var _0x17a51d=_0x564c[_0x203cf5];return _0x17a51d;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var squel=require(_0xc564('0x0'));var Redis=require(_0xc564('0x1'));var qs=require(_0xc564('0x2'));var logger=require(_0xc564('0x3'))('api');var config=require(_0xc564('0x4'));var db=require(_0xc564('0x5'))['db'];config[_0xc564('0x6')]=_[_0xc564('0x7')](config[_0xc564('0x6')],{'host':_0xc564('0x8'),'port':0x18eb});var socket=require(_0xc564('0x9'))(new Redis(config['redis']));require(_0xc564('0xa'))['register'](socket);function respondWithStatusCode(_0x5490d6,_0x46d0a8){_0x46d0a8=_0x46d0a8||0xcc;return function(_0x53c3be){if(_0x53c3be){return _0x5490d6['sendStatus'](_0x46d0a8);}return _0x5490d6[_0xc564('0xb')](_0x46d0a8)['end']();};}function respondWithResult(_0x4725c5,_0xf1e536){_0xf1e536=_0xf1e536||0xc8;return function(_0x479248){if(_0x479248){return _0x4725c5[_0xc564('0xb')](_0xf1e536)['json'](_0x479248);}};}function respondWithFilteredResult(_0x16a5f0,_0x5ba0fc){return function(_0x39a660){if(_0x39a660){var _0x30789d=typeof _0x5ba0fc[_0xc564('0xc')]===_0xc564('0xd')&&typeof _0x5ba0fc[_0xc564('0xe')]===_0xc564('0xd');var _0x1d8610=_0x39a660[_0xc564('0xf')];var _0x1600dd=_0x30789d?0x0:_0x5ba0fc['offset'];var _0x2e4480=_0x30789d?_0x39a660[_0xc564('0xf')]:_0x5ba0fc[_0xc564('0xc')]+_0x5ba0fc[_0xc564('0xe')];var _0x298aa1;if(_0x2e4480>=_0x1d8610){_0x2e4480=_0x1d8610;_0x298aa1=0xc8;}else{_0x298aa1=0xce;}_0x16a5f0[_0xc564('0xb')](_0x298aa1);return _0x16a5f0[_0xc564('0x10')](_0xc564('0x11'),_0x1600dd+'-'+_0x2e4480+'/'+_0x1d8610)['json'](_0x39a660);}return null;};}function saveUpdates(_0x100fcd){return function(_0x4ad9a2){if(_0x4ad9a2){return _0x4ad9a2[_0xc564('0x12')](_0x100fcd)['then'](function(_0x432f78){return _0x432f78;});}return null;};}function removeEntity(_0x408524){return function(_0x1ad9f3){if(_0x1ad9f3){return _0x1ad9f3[_0xc564('0x13')]()[_0xc564('0x14')](function(){var _0x1b4221=_0x1ad9f3['get']({'plain':!![]});var _0x2bb5fd=_0xc564('0x15');return db[_0xc564('0x16')][_0xc564('0x13')]({'where':{'type':_0x2bb5fd,'resourceId':_0x1b4221['id']}})[_0xc564('0x14')](function(){return _0x1ad9f3;});})['then'](function(){_0x408524[_0xc564('0xb')](0xcc)[_0xc564('0x17')]();});}};}function handleEntityNotFound(_0x2975b2){return function(_0x17035c){if(!_0x17035c){_0x2975b2[_0xc564('0x18')](0x194);}return _0x17035c;};}function handleError(_0x2148c6,_0x50a8e9){_0x50a8e9=_0x50a8e9||0x1f4;return function(_0x427083){logger['error'](_0x427083[_0xc564('0x19')]);if(_0x427083[_0xc564('0x1a')]){delete _0x427083[_0xc564('0x1a')];}_0x2148c6[_0xc564('0xb')](_0x50a8e9)[_0xc564('0x1b')](_0x427083);};}exports[_0xc564('0x1c')]=function(_0x3afd29,_0x2395c4){var _0x4daa65={};var _0x3d693d={'count':0x0,'rows':[]};var _0x3bcf5d=_[_0xc564('0x1d')](db[_0xc564('0x1e')][_0xc564('0x1f')],function(_0x21a57d){return{'name':_0x21a57d['fieldName'],'type':_0x21a57d[_0xc564('0x20')][_0xc564('0x21')]};});_0x4daa65=qs[_0xc564('0x22')](_0x3bcf5d,_0x3afd29);var _0x46c0ec={'where':_0x4daa65[_0xc564('0x23')]};return db[_0xc564('0x1e')][_0xc564('0xf')](_0x46c0ec)[_0xc564('0x14')](function(_0x5a0e90){_0x3d693d[_0xc564('0xf')]=_0x5a0e90;_0x4daa65[_0xc564('0x24')]=qs[_0xc564('0x24')](_0x3afd29[_0xc564('0x25')]);return db[_0xc564('0x1e')]['findAll'](_0x4daa65);})[_0xc564('0x14')](function(_0x16a48f){_0x3d693d[_0xc564('0x26')]=_0x16a48f;return _0x3d693d;})['then'](respondWithFilteredResult(_0x2395c4,_0x4daa65))[_0xc564('0x27')](handleError(_0x2395c4,null));};exports[_0xc564('0x28')]=function(_0x139d66,_0x50b239){var _0x519ecf={'raw':!![],'where':{'id':_0x139d66[_0xc564('0x29')]['id']}},_0x14d8a6={};_0x14d8a6['model']=_['keys'](db[_0xc564('0x1e')]['rawAttributes']);_0x14d8a6['query']=_[_0xc564('0x2a')](_0x139d66[_0xc564('0x25')]);_0x14d8a6[_0xc564('0x2b')]=_['intersection'](_0x14d8a6[_0xc564('0x2c')],_0x14d8a6[_0xc564('0x25')]);_0x519ecf[_0xc564('0x2d')]=_[_0xc564('0x2e')](_0x14d8a6['model'],qs[_0xc564('0x2f')](_0x139d66[_0xc564('0x25')][_0xc564('0x2f')]));_0x519ecf[_0xc564('0x2d')]=_0x519ecf[_0xc564('0x2d')][_0xc564('0x30')]?_0x519ecf[_0xc564('0x2d')]:_0x14d8a6[_0xc564('0x2c')];if(_0x139d66[_0xc564('0x25')]['includeAll']){_0x519ecf['include']=[{'all':!![]}];}_0x519ecf=_[_0xc564('0x31')]({},_0x519ecf,_0x139d66[_0xc564('0x32')]);return db[_0xc564('0x1e')][_0xc564('0x33')](_0x519ecf)['then'](handleEntityNotFound(_0x50b239,null))[_0xc564('0x14')](respondWithResult(_0x50b239,null))[_0xc564('0x27')](handleError(_0x50b239,null));};exports[_0xc564('0x34')]=function(_0x2661c4,_0x283af7){return db['WhatsappQueue']['create'](_0x2661c4['body'],{})['then'](function(_0x332871){var _0x23978d=_0x2661c4[_0xc564('0x35')]['get']({'plain':!![]});if(!_0x23978d)throw new Error(_0xc564('0x36'));if(_0x23978d[_0xc564('0x37')]===_0xc564('0x35')){var _0x2cb1d4=_0x332871[_0xc564('0x38')]({'plain':!![]});var _0x322bdc=_0xc564('0x15');return db[_0xc564('0x39')][_0xc564('0x33')]({'where':{'name':_0x322bdc,'userProfileId':_0x23978d[_0xc564('0x3a')]},'raw':!![]})['then'](function(_0x3449be){if(_0x3449be&&_0x3449be[_0xc564('0x3b')]===0x0){return db[_0xc564('0x16')][_0xc564('0x34')]({'name':_0x2cb1d4[_0xc564('0x1a')],'resourceId':_0x2cb1d4['id'],'type':_0x3449be[_0xc564('0x1a')],'sectionId':_0x3449be['id']},{})[_0xc564('0x14')](function(){return _0x332871;});}else{return _0x332871;}})['catch'](function(_0x530b4b){logger[_0xc564('0x3c')](_0xc564('0x3d'),_0x530b4b);throw _0x530b4b;});}return _0x332871;})['then'](respondWithResult(_0x283af7,0xc9))[_0xc564('0x27')](handleError(_0x283af7,null));};exports[_0xc564('0x12')]=function(_0x3c3647,_0x2f0f21){if(_0x3c3647['body']['id']){delete _0x3c3647[_0xc564('0x3e')]['id'];}return db[_0xc564('0x1e')]['find']({'where':{'id':_0x3c3647[_0xc564('0x29')]['id']}})[_0xc564('0x14')](handleEntityNotFound(_0x2f0f21,null))['then'](saveUpdates(_0x3c3647[_0xc564('0x3e')],null))[_0xc564('0x14')](respondWithResult(_0x2f0f21,null))[_0xc564('0x27')](handleError(_0x2f0f21,null));};exports['destroy']=function(_0x42046d,_0x4378fc){return db[_0xc564('0x1e')][_0xc564('0x33')]({'where':{'id':_0x42046d[_0xc564('0x29')]['id']}})[_0xc564('0x14')](handleEntityNotFound(_0x4378fc,null))['then'](removeEntity(_0x4378fc,null))[_0xc564('0x27')](handleError(_0x4378fc,null));};exports[_0xc564('0x3f')]=function(_0x281153,_0x283391){return db['WhatsappQueue'][_0xc564('0x3f')]()[_0xc564('0x14')](respondWithResult(_0x283391,null))['catch'](handleError(_0x283391,null));};exports[_0xc564('0x40')]=function(_0x2f8e58,_0x37dfdc){var _0x214895={'raw':!![],'where':{}},_0xd14cb0={},_0x4bb91b;return db['WhatsappQueue'][_0xc564('0x41')]({'where':{'id':_0x2f8e58[_0xc564('0x29')]['id']}})[_0xc564('0x14')](handleEntityNotFound(_0x37dfdc,null))[_0xc564('0x14')](function(_0x556df5){if(_0x556df5){_0x4bb91b=_0x556df5[_0xc564('0x38')]({'plain':!![]});_0xd14cb0['model']=_[_0xc564('0x2a')](db['UserWhatsappQueue']['rawAttributes']);_0xd14cb0['query']=_['keys'](_0x2f8e58[_0xc564('0x25')]);_0xd14cb0[_0xc564('0x2b')]=_[_0xc564('0x2e')](_0xd14cb0[_0xc564('0x2c')],_0xd14cb0[_0xc564('0x25')]);_0x214895['attributes']=_[_0xc564('0x2e')](_0xd14cb0[_0xc564('0x2c')],qs[_0xc564('0x2f')](_0x2f8e58[_0xc564('0x25')]['fields']));_0x214895['attributes']=_0x214895[_0xc564('0x2d')][_0xc564('0x30')]?_0x214895[_0xc564('0x2d')]:_0xd14cb0[_0xc564('0x2c')];if(!_0x2f8e58['query'][_0xc564('0x42')](_0xc564('0x43'))){_0x214895['limit']=qs[_0xc564('0xe')](_0x2f8e58[_0xc564('0x25')][_0xc564('0xe')]);_0x214895[_0xc564('0xc')]=qs[_0xc564('0xc')](_0x2f8e58['query'][_0xc564('0xc')]);}_0x214895['order']=qs[_0xc564('0x44')](_0x2f8e58['query'][_0xc564('0x44')]);_0x214895['where']=qs['filters'](_['pick'](_0x2f8e58[_0xc564('0x25')],_0xd14cb0[_0xc564('0x2b')]));_0x214895[_0xc564('0x23')]['WhatsappQueueId']=_0x556df5['id'];if(_0x2f8e58[_0xc564('0x25')][_0xc564('0x45')]){_0x214895[_0xc564('0x23')]=_['merge'](_0x214895[_0xc564('0x23')],{'$or':_['map'](_0x214895[_0xc564('0x2d')],function(_0x29562c){var _0x1cfd9b={};_0x1cfd9b[_0x29562c]={'$like':'%'+_0x2f8e58[_0xc564('0x25')][_0xc564('0x45')]+'%'};return _0x1cfd9b;})});}_0x214895=_[_0xc564('0x31')]({},_0x214895,_0x2f8e58['options']);return db[_0xc564('0x46')]['findAll'](_0x214895);}})[_0xc564('0x14')](function(_0x3e9c40){if(_0x3e9c40){return db['User']['findAndCountAll']({'where':{'id':_[_0xc564('0x1d')](_0x3e9c40,_0xc564('0x47')),'role':_0xc564('0x48')},'attributes':['id',_0xc564('0x1a'),_0xc564('0x49'),_0xc564('0x4a'),_0xc564('0x4b')]});}})['then'](function(_0x2643f2){if(_0x2643f2){return{'count':_0x2643f2['count'],'rows':_[_0xc564('0x1d')](_0x2643f2['rows'],function(_0x555752){return{'membername':_0x555752['name'],'UserId':_0x555752['id'],'queue_name':_0x4bb91b['name'],'WhatsappQueueId':_0x4bb91b['id'],'interface':util[_0xc564('0x4c')](_0xc564('0x4d'),_0xc564('0x4e'),_0x555752[_0xc564('0x1a')]),'penalty':0x0,'paused':_0x555752[_0xc564('0x49')],'createdAt':_0x555752['createdAt'],'updatedAt':_0x555752['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x37dfdc,_0x214895))[_0xc564('0x27')](handleError(_0x37dfdc,null));};exports[_0xc564('0x4f')]=function(_0x222fb0,_0x5e615a){var _0x1beb3e={};var _0x7d667b={};var _0x1714f3;var _0x5f08cf;return db[_0xc564('0x1e')][_0xc564('0x41')]({'where':{'id':_0x222fb0['params']['id']}})['then'](handleEntityNotFound(_0x5e615a,null))['then'](function(_0xec8bd2){if(_0xec8bd2){_0x1714f3=_0xec8bd2;_0x7d667b['model']=_[_0xc564('0x2a')](db[_0xc564('0x50')]['rawAttributes']);_0x7d667b[_0xc564('0x25')]=_['keys'](_0x222fb0[_0xc564('0x25')]);_0x7d667b['filters']=_[_0xc564('0x2e')](_0x7d667b[_0xc564('0x2c')],_0x7d667b[_0xc564('0x25')]);_0x1beb3e[_0xc564('0x2d')]=_['intersection'](_0x7d667b[_0xc564('0x2c')],qs['fields'](_0x222fb0['query']['fields']));_0x1beb3e[_0xc564('0x2d')]=_0x1beb3e[_0xc564('0x2d')][_0xc564('0x30')]?_0x1beb3e[_0xc564('0x2d')]:_0x7d667b['model'];_0x1beb3e['order']=qs[_0xc564('0x44')](_0x222fb0[_0xc564('0x25')][_0xc564('0x44')]);_0x1beb3e[_0xc564('0x23')]=qs[_0xc564('0x2b')](_[_0xc564('0x51')](_0x222fb0['query'],_0x7d667b['filters']));if(_0x222fb0[_0xc564('0x25')]['filter']){_0x1beb3e[_0xc564('0x23')]=_[_0xc564('0x31')](_0x1beb3e['where'],{'$or':_['map'](_0x1beb3e['attributes'],function(_0x1cfdc8){var _0x1a7144={};_0x1a7144[_0x1cfdc8]={'$like':'%'+_0x222fb0[_0xc564('0x25')][_0xc564('0x45')]+'%'};return _0x1a7144;})});}_0x1beb3e=_[_0xc564('0x31')]({},_0x1beb3e,_0x222fb0[_0xc564('0x32')]);return _0x1714f3[_0xc564('0x4f')](_0x1beb3e);}})[_0xc564('0x14')](function(_0x2fbea9){if(_0x2fbea9){_0x5f08cf=_0x2fbea9[_0xc564('0x30')];if(!_0x222fb0[_0xc564('0x25')][_0xc564('0x42')]('nolimit')){_0x1beb3e[_0xc564('0xe')]=qs[_0xc564('0xe')](_0x222fb0['query']['limit']);_0x1beb3e['offset']=qs[_0xc564('0xc')](_0x222fb0[_0xc564('0x25')][_0xc564('0xc')]);}return _0x1714f3[_0xc564('0x4f')](_0x1beb3e);}})[_0xc564('0x14')](function(_0x283c2d){if(_0x283c2d){return _0x283c2d?{'count':_0x5f08cf,'rows':_0x283c2d}:null;}})[_0xc564('0x14')](respondWithResult(_0x5e615a,null))['catch'](handleError(_0x5e615a,null));};exports[_0xc564('0x52')]=function(_0x18537d,_0x5142a4){var _0xfc297f=_0x18537d[_0xc564('0x3e')][_0xc564('0x53')];return db[_0xc564('0x50')][_0xc564('0x54')]({'where':{'id':_0xfc297f},'attributes':['id'],'include':[{'model':db[_0xc564('0x55')],'as':_0xc564('0x56'),'attributes':['id',_0xc564('0x1a'),_0xc564('0x57'),_0xc564('0x58'),_0xc564('0x59')],'raw':!![]}]})[_0xc564('0x14')](function(_0x26030d){if(_0x26030d){var _0xd7451d=_[_0xc564('0x5a')](_0x26030d,function(_0x569608){var _0x4cd33f=_0x569608[_0xc564('0x38')]({'plain':!![]});return _0x4cd33f[_0xc564('0x56')];});return db[_0xc564('0x1e')][_0xc564('0x33')]({'where':{'id':_0x18537d[_0xc564('0x29')]['id']}})[_0xc564('0x14')](function(_0x57214a){return db[_0xc564('0x5b')][_0xc564('0x5c')](function(_0x117c9b){return _0x57214a[_0xc564('0x52')](_0xfc297f,{'transaction':_0x117c9b})[_0xc564('0x14')](function(){return BPromise[_0xc564('0x5d')](_0xd7451d,function(_0x11c91d){return db['UserWhatsappQueue'][_0xc564('0x5e')]({'where':{'UserId':_0x11c91d['id'],'WhatsappQueueId':_0x18537d[_0xc564('0x29')]['id']},'transaction':_0x117c9b});});})[_0xc564('0x14')](function(){_0xd7451d['forEach'](function(_0x10929f){socket[_0xc564('0x5f')](_0xc564('0x60'),{'UserId':_0x10929f['id'],'WhatsappQueueId':_0x57214a['id']});});});});});}})[_0xc564('0x14')](respondWithStatusCode(_0x5142a4,null))['catch'](handleError(_0x5142a4,null));};exports[_0xc564('0x61')]=function(_0x5e040a,_0x2e69d1){return db[_0xc564('0x50')][_0xc564('0x54')]({'where':{'id':_0x5e040a[_0xc564('0x25')][_0xc564('0x53')]},'attributes':['id'],'include':[{'model':db[_0xc564('0x55')],'as':_0xc564('0x56'),'attributes':['id'],'raw':!![]}]})[_0xc564('0x14')](handleEntityNotFound(_0x2e69d1,null))['then'](function(_0x342eb1){var _0x46ce63=_['map'](_0x342eb1,'id');var _0xe1dece=[];var _0x40e8e1=[];var _0x1ddc6f=squel[_0xc564('0x62')]();_0x1ddc6f[_0xc564('0x63')]('tq.TeamId')[_0xc564('0x64')](_0xc564('0x65'),'tq')[_0xc564('0x66')](_0xc564('0x67'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc564('0x23')](_0xc564('0x68'),_0x5e040a[_0xc564('0x29')]['id']);for(var _0x31e125=0x0;_0x31e125<_0x342eb1['length'];_0x31e125+=0x1){let _0x4d20fc=_0x342eb1[_0x31e125];for(var _0xcf3022=0x0;_0xcf3022<_0x4d20fc[_0xc564('0x56')]['length'];_0xcf3022+=0x1){let _0x4b7db5=_0x4d20fc[_0xc564('0x56')][_0xcf3022];var _0x1e4361=_0x1ddc6f['clone']();_0x1e4361['where'](_0xc564('0x69'),_0x4b7db5['id']);_0x40e8e1[_0xc564('0x6a')](db[_0xc564('0x5b')][_0xc564('0x25')](_0x1e4361[_0xc564('0x6b')](),{'type':db[_0xc564('0x5b')][_0xc564('0x6c')][_0xc564('0x6d')]})['then'](function(_0xb9fef4){if(_0xb9fef4[_0xc564('0x30')]===0x1){return _0x4b7db5['id'];}else{var _0x33c44a=_[_0xc564('0x6e')](_[_0xc564('0x1d')](_0xb9fef4,_0xc564('0x6f')),function(_0x5248be){return _['includes'](_0x46ce63,_0x5248be);});if(_0x33c44a){return _0x4b7db5['id'];}}}));}}return BPromise[_0xc564('0x70')](_0x40e8e1)['then'](function(_0x1478b6){_0xe1dece=_(_0xe1dece)[_0xc564('0x71')](_0x1478b6)[_0xc564('0x72')]()[_0xc564('0x73')]();return db[_0xc564('0x1e')][_0xc564('0x33')]({'where':{'id':_0x5e040a[_0xc564('0x29')]['id']}})[_0xc564('0x14')](function(_0x35c948){return db[_0xc564('0x5b')][_0xc564('0x5c')](function(_0x2cf199){return _0x35c948[_0xc564('0x61')](_0x5e040a[_0xc564('0x25')]['ids'],{'transaction':_0x2cf199})[_0xc564('0x14')](function(){if(!_[_0xc564('0x74')](_0xe1dece)){return _0x35c948[_0xc564('0x75')](_0xe1dece,{'transaction':_0x2cf199});}})[_0xc564('0x14')](function(){_0xe1dece[_0xc564('0x76')](function(_0x3426a2){socket[_0xc564('0x5f')](_0xc564('0x77'),{'UserId':_0x3426a2,'WhatsappQueueId':_0x35c948['id']});});});});});});})[_0xc564('0x14')](respondWithStatusCode(_0x2e69d1,null))['catch'](handleError(_0x2e69d1,null));};exports['addAgents']=function(_0x2340f3,_0x5bb715){return db[_0xc564('0x1e')][_0xc564('0x33')]({'where':{'id':_0x2340f3[_0xc564('0x29')]['id']}})[_0xc564('0x14')](handleEntityNotFound(_0x5bb715,null))[_0xc564('0x14')](function(_0x5d3195){if(_0x5d3195){return _0x5d3195[_0xc564('0x78')](_0x2340f3['body'][_0xc564('0x53')],_[_0xc564('0x79')](_0x2340f3['body'],[_0xc564('0x53'),'id'])||{})[_0xc564('0x7a')](function(_0xd5180c){for(var _0x4585dc=0x0;_0x4585dc<_0x2340f3[_0xc564('0x3e')][_0xc564('0x53')][_0xc564('0x30')];_0x4585dc+=0x1){socket['emit'](_0xc564('0x60'),{'UserId':Number(_0x2340f3[_0xc564('0x3e')][_0xc564('0x53')][_0x4585dc]),'WhatsappQueueId':Number(_0x2340f3[_0xc564('0x29')]['id'])});}return _0xd5180c;});}})[_0xc564('0x14')](respondWithResult(_0x5bb715,null))[_0xc564('0x27')](handleError(_0x5bb715,null));};exports[_0xc564('0x75')]=function(_0x1e4590,_0x3b74cf){return db[_0xc564('0x1e')]['find']({'where':{'id':_0x1e4590[_0xc564('0x29')]['id']}})[_0xc564('0x14')](handleEntityNotFound(_0x3b74cf,null))['then'](function(_0x3ef72c){if(_0x3ef72c){return _0x3ef72c[_0xc564('0x75')](_0x1e4590['query'][_0xc564('0x53')])[_0xc564('0x14')](function(){if(_[_0xc564('0x7b')](_0x1e4590['query']['ids'])){for(var _0x2ae494=0x0;_0x2ae494<_0x1e4590[_0xc564('0x25')]['ids'][_0xc564('0x30')];_0x2ae494+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1e4590[_0xc564('0x25')][_0xc564('0x53')][_0x2ae494]),'WhatsappQueueId':Number(_0x1e4590[_0xc564('0x29')]['id'])});}}else{socket['emit'](_0xc564('0x77'),{'UserId':Number(_0x1e4590[_0xc564('0x25')][_0xc564('0x53')]),'WhatsappQueueId':Number(_0x1e4590[_0xc564('0x29')]['id'])});}});}})[_0xc564('0x14')](respondWithStatusCode(_0x3b74cf,null))[_0xc564('0x27')](handleError(_0x3b74cf,null));};exports[_0xc564('0x7c')]=function(_0x51b08f,_0x3d3b6a){var _0x33cba6={};var _0x414091={};var _0x2a07ce;var _0x165e74;return db[_0xc564('0x1e')][_0xc564('0x41')]({'where':{'id':_0x51b08f[_0xc564('0x29')]['id']}})[_0xc564('0x14')](handleEntityNotFound(_0x3d3b6a,null))[_0xc564('0x14')](function(_0x496557){if(_0x496557){_0x2a07ce=_0x496557;_0x414091[_0xc564('0x2c')]=_['keys'](db[_0xc564('0x55')]['rawAttributes']);_0x414091[_0xc564('0x25')]=_['keys'](_0x51b08f[_0xc564('0x25')]);_0x414091[_0xc564('0x2b')]=_['intersection'](_0x414091['model'],_0x414091[_0xc564('0x25')]);_0x33cba6['attributes']=_['intersection'](_0x414091[_0xc564('0x2c')],qs[_0xc564('0x2f')](_0x51b08f['query'][_0xc564('0x2f')]));_0x33cba6[_0xc564('0x2d')]=_0x33cba6[_0xc564('0x2d')][_0xc564('0x30')]?_0x33cba6[_0xc564('0x2d')]:_0x414091['model'];_0x33cba6[_0xc564('0x7d')]=qs[_0xc564('0x44')](_0x51b08f[_0xc564('0x25')][_0xc564('0x44')]);_0x33cba6[_0xc564('0x23')]=qs['filters'](_[_0xc564('0x51')](_0x51b08f[_0xc564('0x25')],_0x414091[_0xc564('0x2b')]));if(_0x51b08f[_0xc564('0x25')][_0xc564('0x45')]){_0x33cba6[_0xc564('0x23')]=_[_0xc564('0x31')](_0x33cba6[_0xc564('0x23')],{'$or':_[_0xc564('0x1d')](_0x33cba6[_0xc564('0x2d')],function(_0x481f56){var _0x3582a6={};_0x3582a6[_0x481f56]={'$like':'%'+_0x51b08f[_0xc564('0x25')]['filter']+'%'};return _0x3582a6;})});}_0x33cba6=_[_0xc564('0x31')]({},_0x33cba6,_0x51b08f[_0xc564('0x32')]);return _0x2a07ce[_0xc564('0x7c')](_0x33cba6);}})[_0xc564('0x14')](function(_0xfe286f){if(_0xfe286f){_0x165e74=_0xfe286f[_0xc564('0x30')];if(!_0x51b08f['query'][_0xc564('0x42')]('nolimit')){_0x33cba6[_0xc564('0xe')]=qs[_0xc564('0xe')](_0x51b08f[_0xc564('0x25')]['limit']);_0x33cba6[_0xc564('0xc')]=qs[_0xc564('0xc')](_0x51b08f[_0xc564('0x25')]['offset']);}return _0x2a07ce[_0xc564('0x7c')](_0x33cba6);}})[_0xc564('0x14')](function(_0x50ba87){if(_0x50ba87){return _0x50ba87?{'count':_0x165e74,'rows':_0x50ba87}:null;}})[_0xc564('0x14')](respondWithResult(_0x3d3b6a,null))[_0xc564('0x27')](handleError(_0x3d3b6a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 31b89c1..7ceb0d1 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 _0x2157=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2157,0x96));var _0x7215=function(_0x4e7e3f,_0x2f149b){_0x4e7e3f=_0x4e7e3f-0x0;var _0x1ffc45=_0x2157[_0x4e7e3f];return _0x1ffc45;};'use strict';var EventEmitter=require(_0x7215('0x0'));var WhatsappQueue=require(_0x7215('0x1'))['db'][_0x7215('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7215('0x3')](0x0);var events={'afterCreate':_0x7215('0x4'),'afterUpdate':_0x7215('0x5'),'afterDestroy':_0x7215('0x6')};function emitEvent(_0xc61a0e){return function(_0x37c174,_0x4cf262,_0x1927e7){WhatsappQueueEvents[_0x7215('0x7')](_0xc61a0e+':'+_0x37c174['id'],_0x37c174);WhatsappQueueEvents[_0x7215('0x7')](_0xc61a0e,_0x37c174);_0x1927e7(null);};}for(var e in events){if(events[_0x7215('0x8')](e)){var event=events[e];WhatsappQueue[_0x7215('0x9')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xde88=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x4454b2,_0x3f408b){var _0x50b8f1=function(_0x5bdbe8){while(--_0x5bdbe8){_0x4454b2['push'](_0x4454b2['shift']());}};_0x50b8f1(++_0x3f408b);}(_0xde88,0x87));var _0x8de8=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0xde88[_0x47623f];return _0x282ce8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x8de8('0x0'))['db'][_0x8de8('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8de8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8de8('0x3'),'afterDestroy':_0x8de8('0x4')};function emitEvent(_0x3fbc94){return function(_0x107679,_0x1b21b8,_0x42bab8){WhatsappQueueEvents[_0x8de8('0x5')](_0x3fbc94+':'+_0x107679['id'],_0x107679);WhatsappQueueEvents['emit'](_0x3fbc94,_0x107679);_0x42bab8(null);};}for(var e in events){if(events[_0x8de8('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x8de8('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 21bccf0..2be09c3 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 _0xb3b0=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3a3495,_0x13f120){var _0xfd4b45=function(_0x4dccaa){while(--_0x4dccaa){_0x3a3495['push'](_0x3a3495['shift']());}};_0xfd4b45(++_0x13f120);}(_0xb3b0,0x1ce));var _0x0b3b=function(_0x358c57,_0x1add01){_0x358c57=_0x358c57-0x0;var _0x333dcd=_0xb3b0[_0x358c57];return _0x333dcd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b3b('0x0'))(_0x0b3b('0x1'));var moment=require(_0x0b3b('0x2'));var BPromise=require('bluebird');var rp=require(_0x0b3b('0x3'));var fs=require('fs');var path=require(_0x0b3b('0x4'));var rimraf=require(_0x0b3b('0x5'));var config=require(_0x0b3b('0x6'));var attributes=require(_0x0b3b('0x7'));module[_0x0b3b('0x8')]=function(_0x21c0d5,_0x2f7fce){return _0x21c0d5[_0x0b3b('0x9')](_0x0b3b('0xa'),attributes,{'tableName':_0x0b3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd59=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','util','api','moment','bluebird'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0xbd59,0x164));var _0x9bd5=function(_0x465a22,_0x6bfa46){_0x465a22=_0x465a22-0x0;var _0x5ad9da=_0xbd59[_0x465a22];return _0x5ad9da;};'use strict';var _=require('lodash');var util=require(_0x9bd5('0x0'));var logger=require('../../config/logger')(_0x9bd5('0x1'));var moment=require(_0x9bd5('0x2'));var BPromise=require(_0x9bd5('0x3'));var rp=require(_0x9bd5('0x4'));var fs=require('fs');var path=require(_0x9bd5('0x5'));var rimraf=require(_0x9bd5('0x6'));var config=require(_0x9bd5('0x7'));var attributes=require(_0x9bd5('0x8'));module[_0x9bd5('0x9')]=function(_0x45589f,_0x29b210){return _0x45589f['define'](_0x9bd5('0xa'),attributes,{'tableName':_0x9bd5('0xb'),'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 262a51a..55b2a1e 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 _0x9a28=['./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueue,\x20%s,\x20%s','message','catch','GetWhatsappQueue','findAll','options','raw','where','include','map','model','attributes','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost'];(function(_0x29f699,_0x5ba40e){var _0x5e4b51=function(_0x5c4a27){while(--_0x5c4a27){_0x29f699['push'](_0x29f699['shift']());}};_0x5e4b51(++_0x5ba40e);}(_0x9a28,0xb5));var _0x89a2=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x9a28[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x89a2('0x0'));var util=require(_0x89a2('0x1'));var moment=require(_0x89a2('0x2'));var BPromise=require(_0x89a2('0x3'));var rs=require(_0x89a2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x89a2('0x5'));var logger=require(_0x89a2('0x6'))(_0x89a2('0x7'));var config=require(_0x89a2('0x8'));var jayson=require(_0x89a2('0x9'));var client=jayson[_0x89a2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x89a2('0xb')](config[_0x89a2('0xc')],{'host':_0x89a2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x89a2('0xe'))[_0x89a2('0xf')](socket);function respondWithRpcPromise(_0x78a057,_0x1f66a8,_0x5da43e){return new BPromise(function(_0x16cd52,_0x1d2f81){return client[_0x89a2('0x10')](_0x78a057,_0x5da43e)[_0x89a2('0x11')](function(_0x273357){logger[_0x89a2('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x1f66a8,_0x89a2('0x13'));logger[_0x89a2('0x14')](_0x89a2('0x15'),_0x1f66a8,_0x89a2('0x13'),JSON[_0x89a2('0x16')](_0x273357));if(_0x273357['error']){if(_0x273357['error'][_0x89a2('0x17')]===0x1f4){logger[_0x89a2('0x18')](_0x89a2('0x19'),_0x1f66a8,_0x273357[_0x89a2('0x18')][_0x89a2('0x1a')]);return _0x1d2f81(_0x273357[_0x89a2('0x18')][_0x89a2('0x1a')]);}logger['error'](_0x89a2('0x19'),_0x1f66a8,_0x273357[_0x89a2('0x18')][_0x89a2('0x1a')]);return _0x16cd52(_0x273357[_0x89a2('0x18')][_0x89a2('0x1a')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1f66a8,_0x89a2('0x13'));_0x16cd52(_0x273357['result']['message']);}})[_0x89a2('0x1b')](function(_0x1b91bd){logger[_0x89a2('0x18')](_0x89a2('0x19'),_0x1f66a8,_0x1b91bd);_0x1d2f81(_0x1b91bd);});});}exports[_0x89a2('0x1c')]=function(_0x132e0d){var _0x2a533c=this;return new Promise(function(_0x1db0f4,_0x4d89f8){return db['WhatsappQueue'][_0x89a2('0x1d')]({'raw':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d[_0x89a2('0x1e')][_0x89a2('0x1f')]===undefined?!![]:![]:!![],'where':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d[_0x89a2('0x1e')][_0x89a2('0x20')]||null:null,'attributes':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d['options']['attributes']||null:null,'limit':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d[_0x89a2('0x1e')]['limit']||null:null,'include':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d[_0x89a2('0x1e')][_0x89a2('0x21')]?_[_0x89a2('0x22')](_0x132e0d['options'][_0x89a2('0x21')],function(_0x2c19b1){return{'model':db[_0x2c19b1[_0x89a2('0x23')]],'as':_0x2c19b1['as'],'attributes':_0x2c19b1[_0x89a2('0x24')],'include':_0x2c19b1['include']?_[_0x89a2('0x22')](_0x2c19b1['include'],function(_0x23bd1c){return{'model':db[_0x23bd1c[_0x89a2('0x23')]],'as':_0x23bd1c['as'],'attributes':_0x23bd1c[_0x89a2('0x24')],'include':_0x23bd1c[_0x89a2('0x21')]?_[_0x89a2('0x22')](_0x23bd1c[_0x89a2('0x21')],function(_0x33a3f0){return{'model':db[_0x33a3f0[_0x89a2('0x23')]],'as':_0x33a3f0['as'],'attributes':_0x33a3f0[_0x89a2('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56cfca){logger[_0x89a2('0x12')]('GetWhatsappQueue',_0x132e0d);logger[_0x89a2('0x14')]('GetWhatsappQueue',_0x132e0d,JSON[_0x89a2('0x16')](_0x56cfca));_0x1db0f4(_0x56cfca);})[_0x89a2('0x1b')](function(_0x5a2af3){logger[_0x89a2('0x18')](_0x89a2('0x1c'),_0x5a2af3[_0x89a2('0x1a')],_0x132e0d);_0x4d89f8(_0x2a533c['error'](0x1f4,_0x5a2af3['message']));});});};exports[_0x89a2('0x25')]=function(_0x41eca3){var _0x8b6958=this;return new Promise(function(_0x26f638,_0x4f2605){return db['WhatsappQueue'][_0x89a2('0x26')]({'raw':_0x41eca3['options']?_0x41eca3['options'][_0x89a2('0x1f')]===undefined?!![]:![]:!![],'where':_0x41eca3[_0x89a2('0x1e')]?_0x41eca3['options']['where']||null:null,'attributes':_0x41eca3[_0x89a2('0x1e')]?_0x41eca3[_0x89a2('0x1e')][_0x89a2('0x24')]||null:null,'include':_0x41eca3[_0x89a2('0x1e')]?_0x41eca3[_0x89a2('0x1e')]['include']?_[_0x89a2('0x22')](_0x41eca3['options'][_0x89a2('0x21')],function(_0x477719){return{'model':db[_0x477719['model']],'as':_0x477719['as'],'attributes':_0x477719['attributes'],'include':_0x477719['include']?_[_0x89a2('0x22')](_0x477719[_0x89a2('0x21')],function(_0x7d871a){return{'model':db[_0x7d871a['model']],'as':_0x7d871a['as'],'attributes':_0x7d871a[_0x89a2('0x24')],'include':_0x7d871a[_0x89a2('0x21')]?_[_0x89a2('0x22')](_0x7d871a[_0x89a2('0x21')],function(_0x223f5e){return{'model':db[_0x223f5e[_0x89a2('0x23')]],'as':_0x223f5e['as'],'attributes':_0x223f5e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x123524){logger[_0x89a2('0x12')](_0x89a2('0x25'),_0x41eca3);logger['debug'](_0x89a2('0x25'),_0x41eca3,JSON['stringify'](_0x123524));_0x26f638(_0x123524);})[_0x89a2('0x1b')](function(_0x4ac713){logger[_0x89a2('0x18')](_0x89a2('0x25'),_0x4ac713[_0x89a2('0x1a')],_0x41eca3);_0x4f2605(_0x8b6958[_0x89a2('0x18')](0x1f4,_0x4ac713[_0x89a2('0x1a')]));});});}; \ No newline at end of file +var _0x2e66=['GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x42b84a,_0x3b6f4e){var _0x495201=function(_0x58c46f){while(--_0x58c46f){_0x42b84a['push'](_0x42b84a['shift']());}};_0x495201(++_0x3b6f4e);}(_0x2e66,0x116));var _0x62e6=function(_0x55feb0,_0x4ec101){_0x55feb0=_0x55feb0-0x0;var _0x1cec9b=_0x2e66[_0x55feb0];return _0x1cec9b;};'use strict';var _=require('lodash');var util=require(_0x62e6('0x0'));var moment=require('moment');var BPromise=require(_0x62e6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62e6('0x2'));var db=require(_0x62e6('0x3'))['db'];var utils=require(_0x62e6('0x4'));var logger=require(_0x62e6('0x5'))(_0x62e6('0x6'));var config=require(_0x62e6('0x7'));var jayson=require(_0x62e6('0x8'));var client=jayson[_0x62e6('0x9')][_0x62e6('0xa')]({'port':0x232a});config['redis']=_[_0x62e6('0xb')](config['redis'],{'host':_0x62e6('0xc'),'port':0x18eb});var socket=require(_0x62e6('0xd'))(new Redis(config['redis']));require(_0x62e6('0xe'))[_0x62e6('0xf')](socket);function respondWithRpcPromise(_0x3261b6,_0x31e3ba,_0x3720a1){return new BPromise(function(_0x1ddea8,_0x16bef5){return client['request'](_0x3261b6,_0x3720a1)[_0x62e6('0x10')](function(_0x3ee1e8){logger[_0x62e6('0x11')](_0x62e6('0x12'),_0x31e3ba,'request\x20sent');logger[_0x62e6('0x13')](_0x62e6('0x14'),_0x31e3ba,'request\x20sent',JSON[_0x62e6('0x15')](_0x3ee1e8));if(_0x3ee1e8[_0x62e6('0x16')]){if(_0x3ee1e8[_0x62e6('0x16')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x31e3ba,_0x3ee1e8['error'][_0x62e6('0x17')]);return _0x16bef5(_0x3ee1e8['error'][_0x62e6('0x17')]);}logger[_0x62e6('0x16')](_0x62e6('0x12'),_0x31e3ba,_0x3ee1e8[_0x62e6('0x16')]['message']);return _0x1ddea8(_0x3ee1e8[_0x62e6('0x16')][_0x62e6('0x17')]);}else{logger[_0x62e6('0x11')](_0x62e6('0x12'),_0x31e3ba,'request\x20sent');_0x1ddea8(_0x3ee1e8[_0x62e6('0x18')]['message']);}})[_0x62e6('0x19')](function(_0x407648){logger[_0x62e6('0x16')](_0x62e6('0x12'),_0x31e3ba,_0x407648);_0x16bef5(_0x407648);});});}exports[_0x62e6('0x1a')]=function(_0x29285c){var _0x301fde=this;return new Promise(function(_0x3e2499,_0x7a3656){return db[_0x62e6('0x1b')]['findAll']({'raw':_0x29285c[_0x62e6('0x1c')]?_0x29285c[_0x62e6('0x1c')][_0x62e6('0x1d')]===undefined?!![]:![]:!![],'where':_0x29285c[_0x62e6('0x1c')]?_0x29285c['options'][_0x62e6('0x1e')]||null:null,'attributes':_0x29285c[_0x62e6('0x1c')]?_0x29285c['options'][_0x62e6('0x1f')]||null:null,'limit':_0x29285c[_0x62e6('0x1c')]?_0x29285c[_0x62e6('0x1c')][_0x62e6('0x20')]||null:null,'include':_0x29285c[_0x62e6('0x1c')]?_0x29285c[_0x62e6('0x1c')][_0x62e6('0x21')]?_[_0x62e6('0x22')](_0x29285c['options'][_0x62e6('0x21')],function(_0x12e49e){return{'model':db[_0x12e49e[_0x62e6('0x23')]],'as':_0x12e49e['as'],'attributes':_0x12e49e[_0x62e6('0x1f')],'include':_0x12e49e[_0x62e6('0x21')]?_['map'](_0x12e49e[_0x62e6('0x21')],function(_0x351866){return{'model':db[_0x351866[_0x62e6('0x23')]],'as':_0x351866['as'],'attributes':_0x351866['attributes'],'include':_0x351866[_0x62e6('0x21')]?_['map'](_0x351866[_0x62e6('0x21')],function(_0x207210){return{'model':db[_0x207210['model']],'as':_0x207210['as'],'attributes':_0x207210[_0x62e6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x62e6('0x10')](function(_0xe6ac1){logger['info']('GetWhatsappQueue',_0x29285c);logger[_0x62e6('0x13')](_0x62e6('0x1a'),_0x29285c,JSON[_0x62e6('0x15')](_0xe6ac1));_0x3e2499(_0xe6ac1);})[_0x62e6('0x19')](function(_0x4ea6d1){logger['error']('GetWhatsappQueue',_0x4ea6d1[_0x62e6('0x17')],_0x29285c);_0x7a3656(_0x301fde[_0x62e6('0x16')](0x1f4,_0x4ea6d1['message']));});});};exports[_0x62e6('0x24')]=function(_0x451c5a){var _0x33d663=this;return new Promise(function(_0x57c196,_0x32a6df){return db[_0x62e6('0x1b')][_0x62e6('0x25')]({'raw':_0x451c5a[_0x62e6('0x1c')]?_0x451c5a[_0x62e6('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x451c5a[_0x62e6('0x1c')]?_0x451c5a['options']['where']||null:null,'attributes':_0x451c5a['options']?_0x451c5a[_0x62e6('0x1c')][_0x62e6('0x1f')]||null:null,'include':_0x451c5a['options']?_0x451c5a[_0x62e6('0x1c')][_0x62e6('0x21')]?_[_0x62e6('0x22')](_0x451c5a[_0x62e6('0x1c')][_0x62e6('0x21')],function(_0x10b048){return{'model':db[_0x10b048[_0x62e6('0x23')]],'as':_0x10b048['as'],'attributes':_0x10b048[_0x62e6('0x1f')],'include':_0x10b048[_0x62e6('0x21')]?_[_0x62e6('0x22')](_0x10b048[_0x62e6('0x21')],function(_0x3eb54b){return{'model':db[_0x3eb54b[_0x62e6('0x23')]],'as':_0x3eb54b['as'],'attributes':_0x3eb54b[_0x62e6('0x1f')],'include':_0x3eb54b[_0x62e6('0x21')]?_['map'](_0x3eb54b['include'],function(_0x1eee91){return{'model':db[_0x1eee91[_0x62e6('0x23')]],'as':_0x1eee91['as'],'attributes':_0x1eee91['attributes']};}):[]};}):[]};}):[]:[]})[_0x62e6('0x10')](function(_0x137f45){logger[_0x62e6('0x11')]('ShowWhatsappQueue',_0x451c5a);logger[_0x62e6('0x13')](_0x62e6('0x24'),_0x451c5a,JSON[_0x62e6('0x15')](_0x137f45));_0x57c196(_0x137f45);})[_0x62e6('0x19')](function(_0x3eb73b){logger[_0x62e6('0x16')](_0x62e6('0x24'),_0x3eb73b[_0x62e6('0x17')],_0x451c5a);_0x32a6df(_0x33d663[_0x62e6('0x16')](0x1f4,_0x3eb73b[_0x62e6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 71bb1fb..500d579 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 _0x82d3=['remove','update','emit','removeListener','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x556504,_0x3d5bb1){var _0x27c977=function(_0x2f6143){while(--_0x2f6143){_0x556504['push'](_0x556504['shift']());}};_0x27c977(++_0x3d5bb1);}(_0x82d3,0x6e));var _0x382d=function(_0x10c22e,_0x5d8b23){_0x10c22e=_0x10c22e-0x0;var _0x2d2b3f=_0x82d3[_0x10c22e];return _0x2d2b3f;};'use strict';var WhatsappQueueEvents=require(_0x382d('0x0'));var events=[_0x382d('0x1'),_0x382d('0x2'),_0x382d('0x3')];function createListener(_0x47ac0d,_0x572d1b){return function(_0x250083){_0x572d1b[_0x382d('0x4')](_0x47ac0d,_0x250083);};}function removeListener(_0x40d33c,_0x488d00){return function(){WhatsappQueueEvents[_0x382d('0x5')](_0x40d33c,_0x488d00);};}exports['register']=function(_0x1cde3f){for(var _0x3ad629=0x0,_0xefc518=events['length'];_0x3ad629<_0xefc518;_0x3ad629++){var _0x24915f=events[_0x3ad629];var _0x185226=createListener(_0x382d('0x6')+_0x24915f,_0x1cde3f);WhatsappQueueEvents['on'](_0x24915f,_0x185226);}}; \ No newline at end of file +var _0x881d=['save','update','emit','removeListener','length','whatsappQueue:'];(function(_0x3d6425,_0x27060c){var _0x3615df=function(_0x33964e){while(--_0x33964e){_0x3d6425['push'](_0x3d6425['shift']());}};_0x3615df(++_0x27060c);}(_0x881d,0x12c));var _0xd881=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x881d[_0x257642];return _0x3d813b;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xd881('0x0'),'remove',_0xd881('0x1')];function createListener(_0x5cd87f,_0x16ebfb){return function(_0x5d5f30){_0x16ebfb[_0xd881('0x2')](_0x5cd87f,_0x5d5f30);};}function removeListener(_0x46a11a,_0x137974){return function(){WhatsappQueueEvents[_0xd881('0x3')](_0x46a11a,_0x137974);};}exports['register']=function(_0x7bfa0a){for(var _0xa80dfb=0x0,_0x3a35f2=events[_0xd881('0x4')];_0xa80dfb<_0x3a35f2;_0xa80dfb++){var _0x5512e5=events[_0xa80dfb];var _0x52e643=createListener(_0xd881('0x5')+_0x5512e5,_0x7bfa0a);WhatsappQueueEvents['on'](_0x5512e5,_0x52e643);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 1847a4f..976e160 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 _0x3181=['/:id','show','post','create','put','delete','destroy','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x5a0d85,_0x866217){var _0x4ff869=function(_0x115a82){while(--_0x115a82){_0x5a0d85['push'](_0x5a0d85['shift']());}};_0x4ff869(++_0x866217);}(_0x3181,0x7f));var _0x1318=function(_0x2697d9,_0x26806a){_0x2697d9=_0x2697d9-0x0;var _0x25e6ae=_0x3181[_0x2697d9];return _0x25e6ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1318('0x0'));var timeout=require('connect-timeout');var express=require(_0x1318('0x1'));var router=express['Router']();var fs_extra=require(_0x1318('0x2'));var auth=require(_0x1318('0x3'));var interaction=require(_0x1318('0x4'));var config=require(_0x1318('0x5'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x1318('0x6')](),controller['index']);router[_0x1318('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1318('0x7')](_0x1318('0x8'),auth[_0x1318('0x6')](),controller[_0x1318('0x9')]);router[_0x1318('0xa')]('/',auth[_0x1318('0x6')](),controller[_0x1318('0xb')]);router[_0x1318('0xc')](_0x1318('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x1318('0xd')](_0x1318('0x8'),auth['isAuthenticated'](),controller[_0x1318('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd2f1=['show','post','put','update','delete','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x3c5ba5,_0x3e618b){var _0x36b753=function(_0x79ed6){while(--_0x79ed6){_0x3c5ba5['push'](_0x3c5ba5['shift']());}};_0x36b753(++_0x3e618b);}(_0xd2f1,0x12d));var _0x1d2f=function(_0x164237,_0x504ccd){_0x164237=_0x164237-0x0;var _0x14c38b=_0xd2f1[_0x164237];return _0x14c38b;};'use strict';var multer=require(_0x1d2f('0x0'));var util=require('util');var path=require(_0x1d2f('0x1'));var timeout=require(_0x1d2f('0x2'));var express=require(_0x1d2f('0x3'));var router=express['Router']();var fs_extra=require(_0x1d2f('0x4'));var auth=require(_0x1d2f('0x5'));var interaction=require(_0x1d2f('0x6'));var config=require(_0x1d2f('0x7'));var controller=require(_0x1d2f('0x8'));router['get']('/',auth[_0x1d2f('0x9')](),controller[_0x1d2f('0xa')]);router[_0x1d2f('0xb')](_0x1d2f('0xc'),auth['isAuthenticated'](),controller[_0x1d2f('0xd')]);router[_0x1d2f('0xb')]('/:id',auth[_0x1d2f('0x9')](),controller[_0x1d2f('0xe')]);router[_0x1d2f('0xf')]('/',auth[_0x1d2f('0x9')](),controller['create']);router[_0x1d2f('0x10')]('/:id',auth[_0x1d2f('0x9')](),controller[_0x1d2f('0x11')]);router[_0x1d2f('0x12')](_0x1d2f('0x13'),auth[_0x1d2f('0x9')](),controller[_0x1d2f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index becf81b..96278e9 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5590a0,_0x1bc76b){var _0xbbf177=function(_0x216fd7){while(--_0x216fd7){_0x5590a0['push'](_0x5590a0['shift']());}};_0xbbf177(++_0x1bc76b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x286e1d,_0x3299ed){var _0x25ad68=function(_0x40f0b3){while(--_0x40f0b3){_0x286e1d['push'](_0x286e1d['shift']());}};_0x25ad68(++_0x3299ed);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index dda319e..6f904b4 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 _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir'];(function(_0x5447f4,_0x20401b){var _0x1ab515=function(_0xf9d58e){while(--_0xf9d58e){_0x5447f4['push'](_0x5447f4['shift']());}};_0x1ab515(++_0x20401b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5eee1c,_0x3817d8){_0x5eee1c=_0x5eee1c-0x0;var _0x5f2ea1=_0xb10b[_0x5eee1c];return _0x5f2ea1;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['WhatsappQueueReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x1c7fae){_0x2e0249[_0xbb10('0x43')]=_0x1c7fae;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x44')]=function(_0x331751,_0x23dc18){var _0x403beb={'raw':!![],'where':{'id':_0x331751[_0xbb10('0x45')]['id']}},_0x5e2cfa={};_0x5e2cfa[_0xbb10('0x2f')]=_['keys'](db['WhatsappQueueReport'][_0xbb10('0x2c')]);_0x5e2cfa['query']=_[_0xbb10('0x30')](_0x331751[_0xbb10('0x31')]);_0x5e2cfa['filters']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],_0x5e2cfa[_0xbb10('0x31')]);_0x403beb['attributes']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x331751[_0xbb10('0x31')][_0xbb10('0x34')]));_0x403beb[_0xbb10('0x33')]=_0x403beb[_0xbb10('0x33')][_0xbb10('0x35')]?_0x403beb[_0xbb10('0x33')]:_0x5e2cfa[_0xbb10('0x2f')];if(_0x331751[_0xbb10('0x31')][_0xbb10('0x41')]){_0x403beb['include']=[{'all':!![]}];}_0x403beb=_[_0xbb10('0x3e')]({},_0x403beb,_0x331751[_0xbb10('0x3f')]);return db['WhatsappQueueReport'][_0xbb10('0x46')](_0x403beb)[_0xbb10('0x23')](handleEntityNotFound(_0x23dc18,null))[_0xbb10('0x23')](respondWithResult(_0x23dc18,null))[_0xbb10('0x47')](handleError(_0x23dc18,null));};exports[_0xbb10('0x48')]=function(_0x39f0de,_0x3e06b0){return db['WhatsappQueueReport']['create'](_0x39f0de[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x3e06b0,0xc9))[_0xbb10('0x47')](handleError(_0x3e06b0,null));};exports['update']=function(_0x5f0c12,_0x3cd6f3){if(_0x5f0c12[_0xbb10('0x49')]['id']){delete _0x5f0c12[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x5f0c12[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x23')](saveUpdates(_0x5f0c12[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,null))['catch'](handleError(_0x3cd6f3,null));};exports['destroy']=function(_0x412e13,_0x467dba){return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x412e13[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x467dba,null))[_0xbb10('0x23')](removeEntity(_0x467dba,null))[_0xbb10('0x47')](handleError(_0x467dba,null));};exports[_0xbb10('0x4a')]=function(_0x1214f7,_0x19ca3e){return db[_0xbb10('0x40')][_0xbb10('0x4a')]()[_0xbb10('0x23')](respondWithResult(_0x19ca3e,null))[_0xbb10('0x47')](handleError(_0x19ca3e,null));}; \ No newline at end of file +var _0x1775=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2ff4b6,_0x51065e){var _0xe0679a=function(_0x5b7e11){while(--_0x5b7e11){_0x2ff4b6['push'](_0x2ff4b6['shift']());}};_0xe0679a(++_0x51065e);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x564139,_0x19a0c2){return function(_0x15cb93){if(!_0x15cb93){_0x564139['sendStatus'](0x194);}return _0x15cb93;};}function handleError(_0x3285b3,_0x4eba3a){_0x4eba3a=_0x4eba3a||0x1f4;return function(_0x231d35){logger[_0x5177('0x2a')](_0x231d35['stack']);if(_0x231d35[_0x5177('0x2b')]){delete _0x231d35[_0x5177('0x2b')];}_0x3285b3[_0x5177('0x1d')](_0x4eba3a)[_0x5177('0x2c')](_0x231d35);};}exports[_0x5177('0x2d')]=function(_0x1cef5d,_0x5577bb){var _0x498fcd={},_0x45cf20={},_0x1c660e={'count':0x0,'rows':[]};var _0x7dae59=_[_0x5177('0x2e')](db[_0x5177('0x2f')][_0x5177('0x30')],function(_0x31eb9f){return{'name':_0x31eb9f[_0x5177('0x31')],'type':_0x31eb9f['type'][_0x5177('0x32')]};});_0x45cf20[_0x5177('0x33')]=_['map'](_0x7dae59,_0x5177('0x2b'));_0x45cf20['query']=_[_0x5177('0x34')](_0x1cef5d[_0x5177('0x35')]);_0x45cf20[_0x5177('0x36')]=_['intersection'](_0x45cf20['model'],_0x45cf20[_0x5177('0x35')]);_0x498fcd[_0x5177('0x37')]=_[_0x5177('0x38')](_0x45cf20[_0x5177('0x33')],qs[_0x5177('0x39')](_0x1cef5d[_0x5177('0x35')][_0x5177('0x39')]));_0x498fcd[_0x5177('0x37')]=_0x498fcd['attributes'][_0x5177('0x3a')]?_0x498fcd[_0x5177('0x37')]:_0x45cf20['model'];if(!_0x1cef5d[_0x5177('0x35')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x498fcd[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x1cef5d[_0x5177('0x35')]['limit']);_0x498fcd[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x1cef5d[_0x5177('0x35')][_0x5177('0x20')]);}_0x498fcd[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x1cef5d[_0x5177('0x35')]['sort']);_0x498fcd[_0x5177('0x40')]=qs[_0x5177('0x36')](_['pick'](_0x1cef5d['query'],_0x45cf20[_0x5177('0x36')]),_0x7dae59);if(_0x1cef5d[_0x5177('0x35')][_0x5177('0x41')]){_0x498fcd[_0x5177('0x40')]=_[_0x5177('0x42')](_0x498fcd[_0x5177('0x40')],{'$or':_[_0x5177('0x2e')](_0x7dae59,function(_0x24fd92){if(_0x24fd92[_0x5177('0x43')]!==_0x5177('0x44')){var _0x16fabc={};_0x16fabc[_0x24fd92[_0x5177('0x2b')]]={'$like':'%'+_0x1cef5d[_0x5177('0x35')]['filter']+'%'};return _0x16fabc;}})});}_0x498fcd=_[_0x5177('0x42')]({},_0x498fcd,_0x1cef5d[_0x5177('0x45')]);var _0x4e3677={'where':_0x498fcd[_0x5177('0x40')]};return db['WhatsappQueueReport'][_0x5177('0x22')](_0x4e3677)[_0x5177('0x28')](function(_0x3f02f1){_0x1c660e['count']=_0x3f02f1;if(_0x1cef5d['query'][_0x5177('0x46')]){_0x498fcd[_0x5177('0x47')]=[{'all':!![]}];}return db[_0x5177('0x2f')][_0x5177('0x48')](_0x498fcd);})[_0x5177('0x28')](function(_0x3e710d){_0x1c660e[_0x5177('0x49')]=_0x3e710d;return _0x1c660e;})[_0x5177('0x28')](respondWithFilteredResult(_0x5577bb,_0x498fcd))['catch'](handleError(_0x5577bb,null));};exports[_0x5177('0x4a')]=function(_0x51ecc0,_0x5e3d30){var _0x30e4f3={'raw':!![],'where':{'id':_0x51ecc0['params']['id']}},_0x17dc98={};_0x17dc98[_0x5177('0x33')]=_['keys'](db['WhatsappQueueReport'][_0x5177('0x30')]);_0x17dc98[_0x5177('0x35')]=_[_0x5177('0x34')](_0x51ecc0[_0x5177('0x35')]);_0x17dc98[_0x5177('0x36')]=_[_0x5177('0x38')](_0x17dc98[_0x5177('0x33')],_0x17dc98['query']);_0x30e4f3['attributes']=_[_0x5177('0x38')](_0x17dc98['model'],qs[_0x5177('0x39')](_0x51ecc0[_0x5177('0x35')][_0x5177('0x39')]));_0x30e4f3[_0x5177('0x37')]=_0x30e4f3['attributes'][_0x5177('0x3a')]?_0x30e4f3[_0x5177('0x37')]:_0x17dc98[_0x5177('0x33')];if(_0x51ecc0[_0x5177('0x35')][_0x5177('0x46')]){_0x30e4f3[_0x5177('0x47')]=[{'all':!![]}];}_0x30e4f3=_[_0x5177('0x42')]({},_0x30e4f3,_0x51ecc0[_0x5177('0x45')]);return db[_0x5177('0x2f')][_0x5177('0x4b')](_0x30e4f3)[_0x5177('0x28')](handleEntityNotFound(_0x5e3d30,null))['then'](respondWithResult(_0x5e3d30,null))[_0x5177('0x4c')](handleError(_0x5e3d30,null));};exports['create']=function(_0x58a4e6,_0x5bda8a){return db[_0x5177('0x2f')][_0x5177('0x4d')](_0x58a4e6['body'],{})[_0x5177('0x28')](respondWithResult(_0x5bda8a,0xc9))[_0x5177('0x4c')](handleError(_0x5bda8a,null));};exports[_0x5177('0x4e')]=function(_0x4891fe,_0x1d4ae4){if(_0x4891fe['body']['id']){delete _0x4891fe['body']['id'];}return db['WhatsappQueueReport'][_0x5177('0x4b')]({'where':{'id':_0x4891fe[_0x5177('0x4f')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x1d4ae4,null))['then'](saveUpdates(_0x4891fe['body'],null))[_0x5177('0x28')](respondWithResult(_0x1d4ae4,null))['catch'](handleError(_0x1d4ae4,null));};exports[_0x5177('0x29')]=function(_0x9dd7a2,_0x430e8e){return db[_0x5177('0x2f')][_0x5177('0x4b')]({'where':{'id':_0x9dd7a2[_0x5177('0x4f')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x430e8e,null))[_0x5177('0x28')](removeEntity(_0x430e8e,null))[_0x5177('0x4c')](handleError(_0x430e8e,null));};exports[_0x5177('0x50')]=function(_0x89fe3a,_0xb08267){return db[_0x5177('0x2f')]['describe']()['then'](respondWithResult(_0xb08267,null))[_0x5177('0x4c')](handleError(_0xb08267,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 6f77342..948f11d 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 _0xceec=['./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x37a092,_0xfe8c6){var _0x4f6c4b=function(_0x155a4f){while(--_0x155a4f){_0x37a092['push'](_0x37a092['shift']());}};_0x4f6c4b(++_0xfe8c6);}(_0xceec,0x198));var _0xccee=function(_0x10251d,_0x47a579){_0x10251d=_0x10251d-0x0;var _0x24ef8f=_0xceec[_0x10251d];return _0x24ef8f;};'use strict';var _=require(_0xccee('0x0'));var util=require(_0xccee('0x1'));var logger=require(_0xccee('0x2'))('api');var moment=require(_0xccee('0x3'));var BPromise=require(_0xccee('0x4'));var rp=require(_0xccee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccee('0x6'));var config=require(_0xccee('0x7'));var attributes=require(_0xccee('0x8'));module['exports']=function(_0x1e223c,_0x1fecb9){return _0x1e223c[_0xccee('0x9')](_0xccee('0xa'),attributes,{'tableName':_0xccee('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xccee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad7a=['../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x3c16ae,_0x5b7cfd){var _0x3c34d0=function(_0x54fa5){while(--_0x54fa5){_0x3c16ae['push'](_0x3c16ae['shift']());}};_0x3c34d0(++_0x5b7cfd);}(_0xad7a,0x10a));var _0xaad7=function(_0x5633ab,_0x2dfdcf){_0x5633ab=_0x5633ab-0x0;var _0x1439bd=_0xad7a[_0x5633ab];return _0x1439bd;};'use strict';var _=require(_0xaad7('0x0'));var util=require(_0xaad7('0x1'));var logger=require(_0xaad7('0x2'))(_0xaad7('0x3'));var moment=require(_0xaad7('0x4'));var BPromise=require('bluebird');var rp=require(_0xaad7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaad7('0x6'));var config=require(_0xaad7('0x7'));var attributes=require(_0xaad7('0x8'));module[_0xaad7('0x9')]=function(_0x4ab9c6,_0x3bcc37){return _0x4ab9c6['define'](_0xaad7('0xa'),attributes,{'tableName':_0xaad7('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaad7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index ae1f372..c9f5b4d 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 _0x04b0=['code','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x47160e,_0x5ccd75){var _0x248f20=function(_0x4cf7e3){while(--_0x4cf7e3){_0x47160e['push'](_0x47160e['shift']());}};_0x248f20(++_0x5ccd75);}(_0x04b0,0xdb));var _0x004b=function(_0x47fb6c,_0x2a639b){_0x47fb6c=_0x47fb6c-0x0;var _0x69f720=_0x04b0[_0x47fb6c];return _0x69f720;};'use strict';var _=require(_0x004b('0x0'));var util=require(_0x004b('0x1'));var moment=require(_0x004b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x004b('0x3'));var db=require(_0x004b('0x4'))['db'];var utils=require(_0x004b('0x5'));var logger=require('../../config/logger')(_0x004b('0x6'));var config=require(_0x004b('0x7'));var jayson=require(_0x004b('0x8'));var client=jayson[_0x004b('0x9')][_0x004b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9bb2,_0x4ba365,_0x3ea164){return new BPromise(function(_0x26405f,_0x56a506){return client[_0x004b('0xb')](_0x2a9bb2,_0x3ea164)[_0x004b('0xc')](function(_0x3626e4){logger['info'](_0x004b('0xd'),_0x4ba365,_0x004b('0xe'));logger[_0x004b('0xf')](_0x004b('0x10'),_0x4ba365,_0x004b('0xe'),JSON[_0x004b('0x11')](_0x3626e4));if(_0x3626e4[_0x004b('0x12')]){if(_0x3626e4['error'][_0x004b('0x13')]===0x1f4){logger[_0x004b('0x12')](_0x004b('0xd'),_0x4ba365,_0x3626e4[_0x004b('0x12')][_0x004b('0x14')]);return _0x56a506(_0x3626e4[_0x004b('0x12')][_0x004b('0x14')]);}logger[_0x004b('0x12')](_0x004b('0xd'),_0x4ba365,_0x3626e4[_0x004b('0x12')][_0x004b('0x14')]);return _0x26405f(_0x3626e4[_0x004b('0x12')][_0x004b('0x14')]);}else{logger[_0x004b('0x15')](_0x004b('0xd'),_0x4ba365,_0x004b('0xe'));_0x26405f(_0x3626e4[_0x004b('0x16')][_0x004b('0x14')]);}})[_0x004b('0x17')](function(_0x2d570b){logger[_0x004b('0x12')](_0x004b('0xd'),_0x4ba365,_0x2d570b);_0x56a506(_0x2d570b);});});}exports[_0x004b('0x18')]=function(_0x5570f8){var _0x52b1a4=this;return new Promise(function(_0x53573f,_0x124010){return db[_0x004b('0x19')][_0x004b('0x1a')](_0x5570f8[_0x004b('0x1b')],{'raw':_0x5570f8[_0x004b('0x1c')]?_0x5570f8[_0x004b('0x1c')][_0x004b('0x1d')]===undefined?!![]:![]:!![]})[_0x004b('0xc')](function(_0x3ce2a2){logger[_0x004b('0x15')](_0x004b('0x18'),_0x5570f8);logger[_0x004b('0xf')](_0x004b('0x18'),_0x5570f8,JSON['stringify'](_0x3ce2a2));_0x53573f(_0x3ce2a2);})['catch'](function(_0x5db808){logger['error']('CreateWhatsappQueueReport',_0x5db808[_0x004b('0x14')],_0x5570f8);_0x124010(_0x52b1a4['error'](0x1f4,_0x5db808['message']));});});};exports[_0x004b('0x1e')]=function(_0x3cd8a2){var _0x17d676=this;return new Promise(function(_0x4dc33b,_0x6fae0f){return db['WhatsappQueueReport'][_0x004b('0x1f')](_0x3cd8a2[_0x004b('0x1b')],{'raw':_0x3cd8a2[_0x004b('0x1c')]?_0x3cd8a2['options'][_0x004b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cd8a2[_0x004b('0x1c')]?_0x3cd8a2[_0x004b('0x1c')]['where']||null:null,'attributes':_0x3cd8a2['options']?_0x3cd8a2[_0x004b('0x1c')][_0x004b('0x20')]||null:null,'limit':_0x3cd8a2['options']?_0x3cd8a2[_0x004b('0x1c')][_0x004b('0x21')]||null:null})['then'](function(_0x1711e9){logger[_0x004b('0x15')](_0x004b('0x1e'),_0x3cd8a2);logger[_0x004b('0xf')](_0x004b('0x1e'),_0x3cd8a2,JSON[_0x004b('0x11')](_0x1711e9));_0x4dc33b(_0x1711e9);})[_0x004b('0x17')](function(_0x186a4b){logger[_0x004b('0x12')](_0x004b('0x1e'),_0x186a4b[_0x004b('0x14')],_0x3cd8a2);_0x6fae0f(_0x17d676['error'](0x1f4,_0x186a4b[_0x004b('0x14')]));});});}; \ No newline at end of file +var _0x9ce9=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','WhatsappQueueReport','create','body','options','raw','then','CreateWhatsappQueueReport','update','attributes','UpdateWhatsappQueueReport'];(function(_0xfcd7cf,_0x4df388){var _0x1b25b6=function(_0x44321f){while(--_0x44321f){_0xfcd7cf['push'](_0xfcd7cf['shift']());}};_0x1b25b6(++_0x4df388);}(_0x9ce9,0x16c));var _0x99ce=function(_0x166964,_0x37e407){_0x166964=_0x166964-0x0;var _0x1cf2d2=_0x9ce9[_0x166964];return _0x1cf2d2;};'use strict';var _=require(_0x99ce('0x0'));var util=require(_0x99ce('0x1'));var moment=require(_0x99ce('0x2'));var BPromise=require(_0x99ce('0x3'));var rs=require(_0x99ce('0x4'));var fs=require('fs');var Redis=require(_0x99ce('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x99ce('0x6'));var logger=require('../../config/logger')(_0x99ce('0x7'));var config=require(_0x99ce('0x8'));var jayson=require(_0x99ce('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x82f622,_0x5f1e76,_0x502822){return new BPromise(function(_0x5eb79f,_0x2e32d8){return client['request'](_0x82f622,_0x502822)['then'](function(_0x30428b){logger['info'](_0x99ce('0xa'),_0x5f1e76,_0x99ce('0xb'));logger[_0x99ce('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5f1e76,_0x99ce('0xb'),JSON[_0x99ce('0xd')](_0x30428b));if(_0x30428b['error']){if(_0x30428b['error'][_0x99ce('0xe')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x5f1e76,_0x30428b[_0x99ce('0xf')]['message']);return _0x2e32d8(_0x30428b[_0x99ce('0xf')][_0x99ce('0x10')]);}logger[_0x99ce('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5f1e76,_0x30428b[_0x99ce('0xf')][_0x99ce('0x10')]);return _0x5eb79f(_0x30428b[_0x99ce('0xf')]['message']);}else{logger['info'](_0x99ce('0xa'),_0x5f1e76,_0x99ce('0xb'));_0x5eb79f(_0x30428b['result'][_0x99ce('0x10')]);}})[_0x99ce('0x11')](function(_0x35c646){logger[_0x99ce('0xf')](_0x99ce('0xa'),_0x5f1e76,_0x35c646);_0x2e32d8(_0x35c646);});});}exports['CreateWhatsappQueueReport']=function(_0x2ee63e){var _0x2ec24f=this;return new Promise(function(_0x43a652,_0x5dd632){return db[_0x99ce('0x12')][_0x99ce('0x13')](_0x2ee63e[_0x99ce('0x14')],{'raw':_0x2ee63e[_0x99ce('0x15')]?_0x2ee63e[_0x99ce('0x15')][_0x99ce('0x16')]===undefined?!![]:![]:!![]})[_0x99ce('0x17')](function(_0x35bb2f){logger['info']('CreateWhatsappQueueReport',_0x2ee63e);logger[_0x99ce('0xc')](_0x99ce('0x18'),_0x2ee63e,JSON[_0x99ce('0xd')](_0x35bb2f));_0x43a652(_0x35bb2f);})[_0x99ce('0x11')](function(_0x18fb36){logger['error'](_0x99ce('0x18'),_0x18fb36[_0x99ce('0x10')],_0x2ee63e);_0x5dd632(_0x2ec24f['error'](0x1f4,_0x18fb36[_0x99ce('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x57a3ae){var _0x565e45=this;return new Promise(function(_0x5ee2f6,_0x25648b){return db[_0x99ce('0x12')][_0x99ce('0x19')](_0x57a3ae[_0x99ce('0x14')],{'raw':_0x57a3ae['options']?_0x57a3ae['options'][_0x99ce('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57a3ae[_0x99ce('0x15')]?_0x57a3ae[_0x99ce('0x15')]['where']||null:null,'attributes':_0x57a3ae[_0x99ce('0x15')]?_0x57a3ae[_0x99ce('0x15')][_0x99ce('0x1a')]||null:null,'limit':_0x57a3ae[_0x99ce('0x15')]?_0x57a3ae[_0x99ce('0x15')]['limit']||null:null})[_0x99ce('0x17')](function(_0x13fab8){logger['info'](_0x99ce('0x1b'),_0x57a3ae);logger[_0x99ce('0xc')](_0x99ce('0x1b'),_0x57a3ae,JSON[_0x99ce('0xd')](_0x13fab8));_0x5ee2f6(_0x13fab8);})[_0x99ce('0x11')](function(_0x56ae51){logger['error'](_0x99ce('0x1b'),_0x56ae51[_0x99ce('0x10')],_0x57a3ae);_0x25648b(_0x565e45['error'](0x1f4,_0x56ae51['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index d126aa4..dfe8461 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 _0xa812=['index','describe','show','post','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x4d770d,_0x5af4ce){var _0x11dc7a=function(_0x27d3f7){while(--_0x27d3f7){_0x4d770d['push'](_0x4d770d['shift']());}};_0x11dc7a(++_0x5af4ce);}(_0xa812,0x15d));var _0x2a81=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xa812[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0x2a81('0x0'));var path=require(_0x2a81('0x1'));var timeout=require(_0x2a81('0x2'));var express=require(_0x2a81('0x3'));var router=express[_0x2a81('0x4')]();var fs_extra=require(_0x2a81('0x5'));var auth=require(_0x2a81('0x6'));var interaction=require(_0x2a81('0x7'));var config=require('../../config/environment');var controller=require(_0x2a81('0x8'));router[_0x2a81('0x9')]('/',auth[_0x2a81('0xa')](),controller[_0x2a81('0xb')]);router['get']('/describe',auth[_0x2a81('0xa')](),controller[_0x2a81('0xc')]);router[_0x2a81('0x9')]('/:id',auth[_0x2a81('0xa')](),controller[_0x2a81('0xd')]);router[_0x2a81('0xe')]('/',auth['isAuthenticated'](),controller[_0x2a81('0xf')]);router[_0x2a81('0x10')](_0x2a81('0x11'),auth[_0x2a81('0xa')](),controller[_0x2a81('0x12')]);router[_0x2a81('0x13')](_0x2a81('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdd43=['isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe'];(function(_0x28e472,_0x2ef88c){var _0x4b126e=function(_0x50af2d){while(--_0x50af2d){_0x28e472['push'](_0x28e472['shift']());}};_0x4b126e(++_0x2ef88c);}(_0xdd43,0x179));var _0x3dd4=function(_0x44592e,_0x52bd83){_0x44592e=_0x44592e-0x0;var _0x14e79a=_0xdd43[_0x44592e];return _0x14e79a;};'use strict';var multer=require(_0x3dd4('0x0'));var util=require(_0x3dd4('0x1'));var path=require(_0x3dd4('0x2'));var timeout=require(_0x3dd4('0x3'));var express=require(_0x3dd4('0x4'));var router=express[_0x3dd4('0x5')]();var fs_extra=require(_0x3dd4('0x6'));var auth=require(_0x3dd4('0x7'));var interaction=require(_0x3dd4('0x8'));var config=require(_0x3dd4('0x9'));var controller=require(_0x3dd4('0xa'));router[_0x3dd4('0xb')]('/',auth['isAuthenticated'](),controller[_0x3dd4('0xc')]);router['get'](_0x3dd4('0xd'),auth[_0x3dd4('0xe')](),controller['describe']);router[_0x3dd4('0xb')](_0x3dd4('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x3dd4('0x10')]('/',auth[_0x3dd4('0xe')](),controller[_0x3dd4('0x11')]);router[_0x3dd4('0x12')](_0x3dd4('0xf'),auth[_0x3dd4('0xe')](),controller[_0x3dd4('0x13')]);router[_0x3dd4('0x14')](_0x3dd4('0xf'),auth[_0x3dd4('0xe')](),controller[_0x3dd4('0x15')]);module[_0x3dd4('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 4d622c0..d2cab35 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 _0x1131=['DATE','exports','agent','queue'];(function(_0x558914,_0x20488a){var _0x3e8bbf=function(_0x3cc6cf){while(--_0x3cc6cf){_0x558914['push'](_0x558914['shift']());}};_0x3e8bbf(++_0x20488a);}(_0x1131,0x71));var _0x1113=function(_0x22266d,_0x504bcf){_0x22266d=_0x22266d-0x0;var _0x208d55=_0x1131[_0x22266d];return _0x208d55;};'use strict';var Sequelize=require('sequelize');module[_0x1113('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x1113('0x1'),_0x1113('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x1113('0x3')]}}; \ No newline at end of file +var _0xcae2=['queue','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x23bda3,_0x232c73){var _0x7b3791=function(_0x5a79f4){while(--_0x5a79f4){_0x23bda3['push'](_0x23bda3['shift']());}};_0x7b3791(++_0x232c73);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2cae('0x0'));module[_0x2cae('0x1')]={'uniqueid':{'type':Sequelize[_0x2cae('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2cae('0x3')](_0x2cae('0x4'),_0x2cae('0x5'),_0x2cae('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 c5ebfb9..4991bf0 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 _0x9a55=['catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','WhatsappTransferReport','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find'];(function(_0x1ee72a,_0x22998b){var _0x26a531=function(_0x153e7b){while(--_0x153e7b){_0x1ee72a['push'](_0x1ee72a['shift']());}};_0x26a531(++_0x22998b);}(_0x9a55,0xe2));var _0x59a5=function(_0x7108d5,_0x384f84){_0x7108d5=_0x7108d5-0x0;var _0x2b8ae9=_0x9a55[_0x7108d5];return _0x2b8ae9;};'use strict';var emlformat=require(_0x59a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59a5('0x1'));var jsonpatch=require(_0x59a5('0x2'));var rp=require(_0x59a5('0x3'));var moment=require('moment');var BPromise=require(_0x59a5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x59a5('0x5'));var sox=require('sox');var csv=require(_0x59a5('0x6'));var ejs=require(_0x59a5('0x7'));var fs=require('fs');var fs_extra=require(_0x59a5('0x8'));var _=require(_0x59a5('0x9'));var squel=require(_0x59a5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x59a5('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x59a5('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x59a5('0xd'));var as=require(_0x59a5('0xe'));var hardwareService=require(_0x59a5('0xf'));var logger=require(_0x59a5('0x10'))(_0x59a5('0x11'));var utils=require(_0x59a5('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x59a5('0x13'))['db'];function respondWithStatusCode(_0x427a03,_0x72199){_0x72199=_0x72199||0xcc;return function(_0x324a86){if(_0x324a86){return _0x427a03[_0x59a5('0x14')](_0x72199);}return _0x427a03[_0x59a5('0x15')](_0x72199)[_0x59a5('0x16')]();};}function respondWithResult(_0x387581,_0x5a9eb5){_0x5a9eb5=_0x5a9eb5||0xc8;return function(_0x2ed149){if(_0x2ed149){return _0x387581[_0x59a5('0x15')](_0x5a9eb5)[_0x59a5('0x17')](_0x2ed149);}};}function respondWithFilteredResult(_0x312f16,_0x619724){return function(_0x18e5fb){if(_0x18e5fb){var _0x25b019=typeof _0x619724[_0x59a5('0x18')]===_0x59a5('0x19')&&typeof _0x619724['limit']===_0x59a5('0x19');var _0xe4fee1=_0x18e5fb[_0x59a5('0x1a')];var _0x44ef9a=_0x25b019?0x0:_0x619724['offset'];var _0x415f38=_0x25b019?_0x18e5fb[_0x59a5('0x1a')]:_0x619724[_0x59a5('0x18')]+_0x619724[_0x59a5('0x1b')];var _0x46a0f8;if(_0x415f38>=_0xe4fee1){_0x415f38=_0xe4fee1;_0x46a0f8=0xc8;}else{_0x46a0f8=0xce;}_0x312f16['status'](_0x46a0f8);return _0x312f16[_0x59a5('0x1c')](_0x59a5('0x1d'),_0x44ef9a+'-'+_0x415f38+'/'+_0xe4fee1)[_0x59a5('0x17')](_0x18e5fb);}return null;};}function patchUpdates(_0x4feb84){return function(_0x4bbe3f){try{jsonpatch[_0x59a5('0x1e')](_0x4bbe3f,_0x4feb84,!![]);}catch(_0x51fe04){return BPromise[_0x59a5('0x1f')](_0x51fe04);}return _0x4bbe3f[_0x59a5('0x20')]();};}function saveUpdates(_0x2ab3e1,_0x3c6208){return function(_0x536339){if(_0x536339){return _0x536339[_0x59a5('0x21')](_0x2ab3e1)[_0x59a5('0x22')](function(_0x285a62){return _0x285a62;});}return null;};}function removeEntity(_0x26007d,_0x3a9ab0){return function(_0x53865c){if(_0x53865c){return _0x53865c[_0x59a5('0x23')]()[_0x59a5('0x22')](function(){_0x26007d[_0x59a5('0x15')](0xcc)[_0x59a5('0x16')]();});}};}function handleEntityNotFound(_0x5b8f10,_0x5981c0){return function(_0x1667a4){if(!_0x1667a4){_0x5b8f10[_0x59a5('0x14')](0x194);}return _0x1667a4;};}function handleError(_0x4e46f5,_0x3fb821){_0x3fb821=_0x3fb821||0x1f4;return function(_0x4e43cd){logger[_0x59a5('0x24')](_0x4e43cd[_0x59a5('0x25')]);if(_0x4e43cd[_0x59a5('0x26')]){delete _0x4e43cd[_0x59a5('0x26')];}_0x4e46f5[_0x59a5('0x15')](_0x3fb821)['send'](_0x4e43cd);};}exports['index']=function(_0x5bd23f,_0x456049){var _0x2c9160={},_0x5eacd6={},_0x5d93c3={'count':0x0,'rows':[]};var _0x4d37f5=_[_0x59a5('0x27')](db[_0x59a5('0x28')]['rawAttributes'],function(_0x39da62){return{'name':_0x39da62[_0x59a5('0x29')],'type':_0x39da62[_0x59a5('0x2a')][_0x59a5('0x2b')]};});_0x5eacd6[_0x59a5('0x2c')]=_[_0x59a5('0x27')](_0x4d37f5,_0x59a5('0x26'));_0x5eacd6['query']=_[_0x59a5('0x2d')](_0x5bd23f[_0x59a5('0x2e')]);_0x5eacd6[_0x59a5('0x2f')]=_['intersection'](_0x5eacd6['model'],_0x5eacd6[_0x59a5('0x2e')]);_0x2c9160[_0x59a5('0x30')]=_[_0x59a5('0x31')](_0x5eacd6[_0x59a5('0x2c')],qs[_0x59a5('0x32')](_0x5bd23f[_0x59a5('0x2e')][_0x59a5('0x32')]));_0x2c9160['attributes']=_0x2c9160[_0x59a5('0x30')]['length']?_0x2c9160[_0x59a5('0x30')]:_0x5eacd6[_0x59a5('0x2c')];if(!_0x5bd23f['query'][_0x59a5('0x33')](_0x59a5('0x34'))){_0x2c9160['limit']=qs[_0x59a5('0x1b')](_0x5bd23f[_0x59a5('0x2e')][_0x59a5('0x1b')]);_0x2c9160[_0x59a5('0x18')]=qs[_0x59a5('0x18')](_0x5bd23f[_0x59a5('0x2e')]['offset']);}_0x2c9160[_0x59a5('0x35')]=qs[_0x59a5('0x36')](_0x5bd23f[_0x59a5('0x2e')][_0x59a5('0x36')]);_0x2c9160['where']=qs[_0x59a5('0x2f')](_[_0x59a5('0x37')](_0x5bd23f[_0x59a5('0x2e')],_0x5eacd6[_0x59a5('0x2f')]),_0x4d37f5);if(_0x5bd23f['query'][_0x59a5('0x38')]){_0x2c9160[_0x59a5('0x39')]=_[_0x59a5('0x3a')](_0x2c9160[_0x59a5('0x39')],{'$or':_[_0x59a5('0x27')](_0x4d37f5,function(_0x5b6c87){if(_0x5b6c87[_0x59a5('0x2a')]!==_0x59a5('0x3b')){var _0xab0cfa={};_0xab0cfa[_0x5b6c87['name']]={'$like':'%'+_0x5bd23f[_0x59a5('0x2e')]['filter']+'%'};return _0xab0cfa;}})});}_0x2c9160=_[_0x59a5('0x3a')]({},_0x2c9160,_0x5bd23f[_0x59a5('0x3c')]);var _0x4afb12={'where':_0x2c9160[_0x59a5('0x39')]};return db[_0x59a5('0x28')][_0x59a5('0x1a')](_0x4afb12)[_0x59a5('0x22')](function(_0x936088){_0x5d93c3[_0x59a5('0x1a')]=_0x936088;if(_0x5bd23f[_0x59a5('0x2e')][_0x59a5('0x3d')]){_0x2c9160[_0x59a5('0x3e')]=[{'all':!![]}];}return db[_0x59a5('0x28')][_0x59a5('0x3f')](_0x2c9160);})[_0x59a5('0x22')](function(_0x5d4c3f){_0x5d93c3[_0x59a5('0x40')]=_0x5d4c3f;return _0x5d93c3;})[_0x59a5('0x22')](respondWithFilteredResult(_0x456049,_0x2c9160))['catch'](handleError(_0x456049,null));};exports[_0x59a5('0x41')]=function(_0x1d1d97,_0x5169e3){var _0x599409={'raw':!![],'where':{'id':_0x1d1d97[_0x59a5('0x42')]['id']}},_0x331cde={};_0x331cde[_0x59a5('0x2c')]=_[_0x59a5('0x2d')](db[_0x59a5('0x28')][_0x59a5('0x43')]);_0x331cde[_0x59a5('0x2e')]=_['keys'](_0x1d1d97[_0x59a5('0x2e')]);_0x331cde[_0x59a5('0x2f')]=_['intersection'](_0x331cde[_0x59a5('0x2c')],_0x331cde[_0x59a5('0x2e')]);_0x599409[_0x59a5('0x30')]=_['intersection'](_0x331cde['model'],qs[_0x59a5('0x32')](_0x1d1d97[_0x59a5('0x2e')][_0x59a5('0x32')]));_0x599409[_0x59a5('0x30')]=_0x599409[_0x59a5('0x30')][_0x59a5('0x44')]?_0x599409[_0x59a5('0x30')]:_0x331cde[_0x59a5('0x2c')];if(_0x1d1d97['query']['includeAll']){_0x599409[_0x59a5('0x3e')]=[{'all':!![]}];}_0x599409=_[_0x59a5('0x3a')]({},_0x599409,_0x1d1d97[_0x59a5('0x3c')]);return db['WhatsappTransferReport'][_0x59a5('0x45')](_0x599409)[_0x59a5('0x22')](handleEntityNotFound(_0x5169e3,null))[_0x59a5('0x22')](respondWithResult(_0x5169e3,null))[_0x59a5('0x46')](handleError(_0x5169e3,null));};exports['create']=function(_0x8dab8e,_0x430999){return db[_0x59a5('0x28')][_0x59a5('0x47')](_0x8dab8e[_0x59a5('0x48')],{})['then'](respondWithResult(_0x430999,0xc9))[_0x59a5('0x46')](handleError(_0x430999,null));};exports['update']=function(_0x23ee0e,_0x4e191e){if(_0x23ee0e[_0x59a5('0x48')]['id']){delete _0x23ee0e['body']['id'];}return db[_0x59a5('0x28')][_0x59a5('0x45')]({'where':{'id':_0x23ee0e[_0x59a5('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e191e,null))['then'](saveUpdates(_0x23ee0e[_0x59a5('0x48')],null))[_0x59a5('0x22')](respondWithResult(_0x4e191e,null))[_0x59a5('0x46')](handleError(_0x4e191e,null));};exports[_0x59a5('0x23')]=function(_0x4c3e00,_0x192a5a){return db[_0x59a5('0x28')][_0x59a5('0x45')]({'where':{'id':_0x4c3e00[_0x59a5('0x42')]['id']}})[_0x59a5('0x22')](handleEntityNotFound(_0x192a5a,null))[_0x59a5('0x22')](removeEntity(_0x192a5a,null))[_0x59a5('0x46')](handleError(_0x192a5a,null));};exports['describe']=function(_0x416d3f,_0x2d8771){return db[_0x59a5('0x28')][_0x59a5('0x49')]()[_0x59a5('0x22')](respondWithResult(_0x2d8771,null))[_0x59a5('0x46')](handleError(_0x2d8771,null));}; \ No newline at end of file +var _0x55cf=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','findAll','rows','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','update','destroy','then','stack','name','send','index','map','fieldName','type','key','model','query','keys'];(function(_0x24d658,_0x4e87d1){var _0x4b180a=function(_0x503e99){while(--_0x503e99){_0x24d658['push'](_0x24d658['shift']());}};_0x4b180a(++_0x4e87d1);}(_0x55cf,0xab));var _0xf55c=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x55cf[_0x43776a];return _0x18eb8f;};'use strict';var emlformat=require(_0xf55c('0x0'));var rimraf=require(_0xf55c('0x1'));var zipdir=require(_0xf55c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf55c('0x3'));var BPromise=require(_0xf55c('0x4'));var Mustache=require(_0xf55c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf55c('0x6'));var csv=require(_0xf55c('0x7'));var ejs=require(_0xf55c('0x8'));var fs=require('fs');var fs_extra=require(_0xf55c('0x9'));var _=require(_0xf55c('0xa'));var squel=require(_0xf55c('0xb'));var crypto=require(_0xf55c('0xc'));var jsforce=require(_0xf55c('0xd'));var deskjs=require(_0xf55c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf55c('0xf'));var Papa=require(_0xf55c('0x10'));var Redis=require(_0xf55c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf55c('0x12'));var as=require(_0xf55c('0x13'));var hardwareService=require(_0xf55c('0x14'));var logger=require('../../config/logger')(_0xf55c('0x15'));var utils=require(_0xf55c('0x16'));var config=require(_0xf55c('0x17'));var licenseUtil=require(_0xf55c('0x18'));var db=require(_0xf55c('0x19'))['db'];function respondWithStatusCode(_0x5eeb54,_0x521c4c){_0x521c4c=_0x521c4c||0xcc;return function(_0x2c96c4){if(_0x2c96c4){return _0x5eeb54[_0xf55c('0x1a')](_0x521c4c);}return _0x5eeb54[_0xf55c('0x1b')](_0x521c4c)[_0xf55c('0x1c')]();};}function respondWithResult(_0x1c3822,_0x46d720){_0x46d720=_0x46d720||0xc8;return function(_0x52a584){if(_0x52a584){return _0x1c3822['status'](_0x46d720)[_0xf55c('0x1d')](_0x52a584);}};}function respondWithFilteredResult(_0x2adb0a,_0x230d5d){return function(_0x526007){if(_0x526007){var _0x3759cf=typeof _0x230d5d[_0xf55c('0x1e')]===_0xf55c('0x1f')&&typeof _0x230d5d[_0xf55c('0x20')]===_0xf55c('0x1f');var _0x56771e=_0x526007[_0xf55c('0x21')];var _0xb258f7=_0x3759cf?0x0:_0x230d5d[_0xf55c('0x1e')];var _0x49eb14=_0x3759cf?_0x526007[_0xf55c('0x21')]:_0x230d5d['offset']+_0x230d5d[_0xf55c('0x20')];var _0x3878ff;if(_0x49eb14>=_0x56771e){_0x49eb14=_0x56771e;_0x3878ff=0xc8;}else{_0x3878ff=0xce;}_0x2adb0a[_0xf55c('0x1b')](_0x3878ff);return _0x2adb0a['set']('Content-Range',_0xb258f7+'-'+_0x49eb14+'/'+_0x56771e)[_0xf55c('0x1d')](_0x526007);}return null;};}function patchUpdates(_0xb83cce){return function(_0x2bee46){try{jsonpatch['apply'](_0x2bee46,_0xb83cce,!![]);}catch(_0x20b76a){return BPromise['reject'](_0x20b76a);}return _0x2bee46['save']();};}function saveUpdates(_0x35a44f,_0x4c2b0e){return function(_0x4b4104){if(_0x4b4104){return _0x4b4104[_0xf55c('0x22')](_0x35a44f)['then'](function(_0x3d1340){return _0x3d1340;});}return null;};}function removeEntity(_0x21dd96,_0x52947c){return function(_0x4a3186){if(_0x4a3186){return _0x4a3186[_0xf55c('0x23')]()[_0xf55c('0x24')](function(){_0x21dd96[_0xf55c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x105499,_0x3aad65){return function(_0x1ea861){if(!_0x1ea861){_0x105499[_0xf55c('0x1a')](0x194);}return _0x1ea861;};}function handleError(_0x1ac237,_0x10f9a7){_0x10f9a7=_0x10f9a7||0x1f4;return function(_0x1b330e){logger['error'](_0x1b330e[_0xf55c('0x25')]);if(_0x1b330e[_0xf55c('0x26')]){delete _0x1b330e[_0xf55c('0x26')];}_0x1ac237[_0xf55c('0x1b')](_0x10f9a7)[_0xf55c('0x27')](_0x1b330e);};}exports[_0xf55c('0x28')]=function(_0x3ee341,_0x2bc092){var _0x328341={},_0x14ea50={},_0x378081={'count':0x0,'rows':[]};var _0x1c1199=_[_0xf55c('0x29')](db['WhatsappTransferReport']['rawAttributes'],function(_0x2a4b77){return{'name':_0x2a4b77[_0xf55c('0x2a')],'type':_0x2a4b77[_0xf55c('0x2b')][_0xf55c('0x2c')]};});_0x14ea50[_0xf55c('0x2d')]=_[_0xf55c('0x29')](_0x1c1199,'name');_0x14ea50[_0xf55c('0x2e')]=_[_0xf55c('0x2f')](_0x3ee341[_0xf55c('0x2e')]);_0x14ea50[_0xf55c('0x30')]=_[_0xf55c('0x31')](_0x14ea50[_0xf55c('0x2d')],_0x14ea50[_0xf55c('0x2e')]);_0x328341['attributes']=_[_0xf55c('0x31')](_0x14ea50[_0xf55c('0x2d')],qs['fields'](_0x3ee341['query'][_0xf55c('0x32')]));_0x328341[_0xf55c('0x33')]=_0x328341[_0xf55c('0x33')]['length']?_0x328341[_0xf55c('0x33')]:_0x14ea50['model'];if(!_0x3ee341[_0xf55c('0x2e')][_0xf55c('0x34')](_0xf55c('0x35'))){_0x328341[_0xf55c('0x20')]=qs[_0xf55c('0x20')](_0x3ee341[_0xf55c('0x2e')][_0xf55c('0x20')]);_0x328341[_0xf55c('0x1e')]=qs[_0xf55c('0x1e')](_0x3ee341[_0xf55c('0x2e')][_0xf55c('0x1e')]);}_0x328341[_0xf55c('0x36')]=qs['sort'](_0x3ee341[_0xf55c('0x2e')]['sort']);_0x328341['where']=qs[_0xf55c('0x30')](_[_0xf55c('0x37')](_0x3ee341['query'],_0x14ea50[_0xf55c('0x30')]),_0x1c1199);if(_0x3ee341[_0xf55c('0x2e')][_0xf55c('0x38')]){_0x328341[_0xf55c('0x39')]=_[_0xf55c('0x3a')](_0x328341[_0xf55c('0x39')],{'$or':_[_0xf55c('0x29')](_0x1c1199,function(_0x18278f){if(_0x18278f[_0xf55c('0x2b')]!==_0xf55c('0x3b')){var _0x26f6dc={};_0x26f6dc[_0x18278f['name']]={'$like':'%'+_0x3ee341['query']['filter']+'%'};return _0x26f6dc;}})});}_0x328341=_[_0xf55c('0x3a')]({},_0x328341,_0x3ee341[_0xf55c('0x3c')]);var _0x51adff={'where':_0x328341[_0xf55c('0x39')]};return db[_0xf55c('0x3d')][_0xf55c('0x21')](_0x51adff)['then'](function(_0x4b5d82){_0x378081[_0xf55c('0x21')]=_0x4b5d82;if(_0x3ee341[_0xf55c('0x2e')][_0xf55c('0x3e')]){_0x328341['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xf55c('0x3f')](_0x328341);})[_0xf55c('0x24')](function(_0x29d0cb){_0x378081[_0xf55c('0x40')]=_0x29d0cb;return _0x378081;})['then'](respondWithFilteredResult(_0x2bc092,_0x328341))[_0xf55c('0x41')](handleError(_0x2bc092,null));};exports['show']=function(_0x9b8439,_0x1698ba){var _0x5d3c23={'raw':!![],'where':{'id':_0x9b8439[_0xf55c('0x42')]['id']}},_0x20bd34={};_0x20bd34['model']=_[_0xf55c('0x2f')](db[_0xf55c('0x3d')]['rawAttributes']);_0x20bd34['query']=_[_0xf55c('0x2f')](_0x9b8439[_0xf55c('0x2e')]);_0x20bd34[_0xf55c('0x30')]=_[_0xf55c('0x31')](_0x20bd34[_0xf55c('0x2d')],_0x20bd34[_0xf55c('0x2e')]);_0x5d3c23[_0xf55c('0x33')]=_['intersection'](_0x20bd34['model'],qs['fields'](_0x9b8439[_0xf55c('0x2e')][_0xf55c('0x32')]));_0x5d3c23[_0xf55c('0x33')]=_0x5d3c23[_0xf55c('0x33')][_0xf55c('0x43')]?_0x5d3c23[_0xf55c('0x33')]:_0x20bd34[_0xf55c('0x2d')];if(_0x9b8439['query'][_0xf55c('0x3e')]){_0x5d3c23[_0xf55c('0x44')]=[{'all':!![]}];}_0x5d3c23=_['merge']({},_0x5d3c23,_0x9b8439[_0xf55c('0x3c')]);return db[_0xf55c('0x3d')][_0xf55c('0x45')](_0x5d3c23)['then'](handleEntityNotFound(_0x1698ba,null))['then'](respondWithResult(_0x1698ba,null))['catch'](handleError(_0x1698ba,null));};exports[_0xf55c('0x46')]=function(_0xde2667,_0x263c27){return db['WhatsappTransferReport'][_0xf55c('0x46')](_0xde2667[_0xf55c('0x47')],{})['then'](respondWithResult(_0x263c27,0xc9))[_0xf55c('0x41')](handleError(_0x263c27,null));};exports[_0xf55c('0x22')]=function(_0x13bc18,_0x12a3a2){if(_0x13bc18['body']['id']){delete _0x13bc18[_0xf55c('0x47')]['id'];}return db['WhatsappTransferReport'][_0xf55c('0x45')]({'where':{'id':_0x13bc18['params']['id']}})[_0xf55c('0x24')](handleEntityNotFound(_0x12a3a2,null))[_0xf55c('0x24')](saveUpdates(_0x13bc18[_0xf55c('0x47')],null))['then'](respondWithResult(_0x12a3a2,null))[_0xf55c('0x41')](handleError(_0x12a3a2,null));};exports[_0xf55c('0x23')]=function(_0x14671c,_0x1e1e6d){return db[_0xf55c('0x3d')][_0xf55c('0x45')]({'where':{'id':_0x14671c[_0xf55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1e6d,null))[_0xf55c('0x24')](removeEntity(_0x1e1e6d,null))['catch'](handleError(_0x1e1e6d,null));};exports[_0xf55c('0x48')]=function(_0x1af709,_0x4e18f5){return db[_0xf55c('0x3d')][_0xf55c('0x48')]()['then'](respondWithResult(_0x4e18f5,null))['catch'](handleError(_0x4e18f5,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 7bf9809..41b5b06 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 _0x9942=['moment','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x9942,0x64));var _0x2994=function(_0x22d19d,_0x379051){_0x22d19d=_0x22d19d-0x0;var _0x103fc2=_0x9942[_0x22d19d];return _0x103fc2;};'use strict';var _=require(_0x2994('0x0'));var util=require(_0x2994('0x1'));var logger=require(_0x2994('0x2'))(_0x2994('0x3'));var moment=require(_0x2994('0x4'));var BPromise=require('bluebird');var rp=require(_0x2994('0x5'));var fs=require('fs');var path=require(_0x2994('0x6'));var rimraf=require(_0x2994('0x7'));var config=require('../../config/environment');var attributes=require(_0x2994('0x8'));module[_0x2994('0x9')]=function(_0x44a27d,_0x545c78){return _0x44a27d[_0x2994('0xa')]('WhatsappTransferReport',attributes,{'tableName':_0x2994('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2994('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc500=['WhatsappTransferReport','uniqueid','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x32ee51,_0x26d577){var _0x57d860=function(_0x55b534){while(--_0x55b534){_0x32ee51['push'](_0x32ee51['shift']());}};_0x57d860(++_0x26d577);}(_0xc500,0x1a0));var _0x0c50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc500[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0c50('0x0'));var moment=require('moment');var BPromise=require(_0x0c50('0x1'));var rp=require(_0x0c50('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c50('0x3'));var config=require(_0x0c50('0x4'));var attributes=require('./whatsappTransferReport.attributes');module[_0x0c50('0x5')]=function(_0x1636c7,_0x2b2a44){return _0x1636c7[_0x0c50('0x6')](_0x0c50('0x7'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x0c50('0x8'),'fields':[_0x0c50('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d0a8fbc..f604b3d 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 _0x70ce=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','bluebird'];(function(_0x582ab9,_0x5f08b6){var _0x3732d3=function(_0x12b0d2){while(--_0x12b0d2){_0x582ab9['push'](_0x582ab9['shift']());}};_0x3732d3(++_0x5f08b6);}(_0x70ce,0x177));var _0xe70c=function(_0x107f17,_0x198f8c){_0x107f17=_0x107f17-0x0;var _0x1c7074=_0x70ce[_0x107f17];return _0x1c7074;};'use strict';var _=require(_0xe70c('0x0'));var util=require('util');var moment=require(_0xe70c('0x1'));var BPromise=require(_0xe70c('0x2'));var rs=require(_0xe70c('0x3'));var fs=require('fs');var Redis=require(_0xe70c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe70c('0x5'));var logger=require(_0xe70c('0x6'))(_0xe70c('0x7'));var config=require(_0xe70c('0x8'));var jayson=require(_0xe70c('0x9'));var client=jayson[_0xe70c('0xa')][_0xe70c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bf6cc,_0x10f943,_0x1fadab){return new BPromise(function(_0x16c0c8,_0x45a7a2){return client['request'](_0x3bf6cc,_0x1fadab)['then'](function(_0x723342){logger['info'](_0xe70c('0xc'),_0x10f943,_0xe70c('0xd'));logger[_0xe70c('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x10f943,_0xe70c('0xd'),JSON[_0xe70c('0xf')](_0x723342));if(_0x723342[_0xe70c('0x10')]){if(_0x723342[_0xe70c('0x10')]['code']===0x1f4){logger[_0xe70c('0x10')](_0xe70c('0xc'),_0x10f943,_0x723342[_0xe70c('0x10')][_0xe70c('0x11')]);return _0x45a7a2(_0x723342[_0xe70c('0x10')][_0xe70c('0x11')]);}logger[_0xe70c('0x10')](_0xe70c('0xc'),_0x10f943,_0x723342[_0xe70c('0x10')]['message']);return _0x16c0c8(_0x723342[_0xe70c('0x10')][_0xe70c('0x11')]);}else{logger[_0xe70c('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x10f943,_0xe70c('0xd'));_0x16c0c8(_0x723342[_0xe70c('0x13')][_0xe70c('0x11')]);}})[_0xe70c('0x14')](function(_0x25119f){logger[_0xe70c('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x10f943,_0x25119f);_0x45a7a2(_0x25119f);});});} \ No newline at end of file +var _0x94f8=['../../config/utils','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x15fdaa,_0x3d0dec){var _0x593626=function(_0x230114){while(--_0x230114){_0x15fdaa['push'](_0x15fdaa['shift']());}};_0x593626(++_0x3d0dec);}(_0x94f8,0x94));var _0x894f=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x94f8[_0x1597e2];return _0x4c8c0a;};'use strict';var _=require(_0x894f('0x0'));var util=require(_0x894f('0x1'));var moment=require(_0x894f('0x2'));var BPromise=require(_0x894f('0x3'));var rs=require(_0x894f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x894f('0x5'))['db'];var utils=require(_0x894f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x894f('0x7'));var jayson=require(_0x894f('0x8'));var client=jayson[_0x894f('0x9')][_0x894f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bbdc6,_0x34ed27,_0x5e448c){return new BPromise(function(_0x18867e,_0x4ce537){return client[_0x894f('0xb')](_0x3bbdc6,_0x5e448c)['then'](function(_0x185dbe){logger[_0x894f('0xc')](_0x894f('0xd'),_0x34ed27,_0x894f('0xe'));logger[_0x894f('0xf')](_0x894f('0x10'),_0x34ed27,_0x894f('0xe'),JSON[_0x894f('0x11')](_0x185dbe));if(_0x185dbe['error']){if(_0x185dbe[_0x894f('0x12')][_0x894f('0x13')]===0x1f4){logger['error'](_0x894f('0xd'),_0x34ed27,_0x185dbe[_0x894f('0x12')][_0x894f('0x14')]);return _0x4ce537(_0x185dbe['error'][_0x894f('0x14')]);}logger[_0x894f('0x12')](_0x894f('0xd'),_0x34ed27,_0x185dbe[_0x894f('0x12')][_0x894f('0x14')]);return _0x18867e(_0x185dbe[_0x894f('0x12')][_0x894f('0x14')]);}else{logger[_0x894f('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x34ed27,_0x894f('0xe'));_0x18867e(_0x185dbe['result']['message']);}})[_0x894f('0x15')](function(_0x41c136){logger[_0x894f('0x12')](_0x894f('0xd'),_0x34ed27,_0x41c136);_0x4ce537(_0x41c136);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index eaea764..1ba9b8d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['start','exitCode','number','length','map','name','info','Online\x20apps:','online','join','Offline\x20apps:','filter','None','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen'];(function(_0x43ce41,_0x5203a1){var _0x11c797=function(_0x177251){while(--_0x177251){_0x43ce41['push'](_0x43ce41['shift']());}};_0x11c797(++_0x5203a1);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x5eb8[_0x270a54];return _0x4d07d0;};'use strict';var _=require('lodash');var db=require(_0x85eb('0x0'))['db'];var seedDb=require(_0x85eb('0x1'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0x85eb('0x2'));var logger=require(_0x85eb('0x3'))('app');var pm2=require(_0x85eb('0x4'));var pm2Config=require(_0x85eb('0x5'));var schedule=require(_0x85eb('0x6'));var chat=require(_0x85eb('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x85eb('0x8'));var provider=require(_0x85eb('0x9'));function main(){return db[_0x85eb('0xa')][_0x85eb('0xb')]()[_0x85eb('0xc')](function(){if(config['seedDB']){return seedDb[_0x85eb('0xd')]();}})['then'](function(){return checkLicense['default']();})[_0x85eb('0xc')](function(){return rpc[_0x85eb('0xe')]();})['then'](function(_0x51b041){logger['info'](_0x51b041);return chat['start']();})[_0x85eb('0xc')](function(){return whatsapp['start']();})[_0x85eb('0xc')](function(){return schedule[_0x85eb('0xf')]();})[_0x85eb('0xc')](function(){return transcribe[_0x85eb('0xf')]();})['then'](function(){return provider[_0x85eb('0xf')]();})[_0x85eb('0xc')](function(_0x5b2e91){logger['info'](_0x5b2e91);return pm2['start'](pm2Config);})['then'](function(_0x15f959){var _0x48e45f=_0x15f959['filter'](function(_0x4cec4e){return typeof _0x4cec4e[_0x85eb('0x10')]===_0x85eb('0x11')&&_0x4cec4e[_0x85eb('0x10')]>=0x0;});if(_0x48e45f['length']>0x0){throw new Error(_0x48e45f[_0x85eb('0x12')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x85eb('0x13')](_0x48e45f,function(_0x50aa0d){return'\x22'+_0x50aa0d['pm2_env'][_0x85eb('0x14')]+'\x22';}));}logger[_0x85eb('0x15')](_0x85eb('0x16'),_['map'](_['filter'](_0x15f959,{'status':_0x85eb('0x17')}),_0x85eb('0x14'))[_0x85eb('0x18')]());logger['info'](_0x85eb('0x19'),_[_0x85eb('0x13')](_[_0x85eb('0x1a')](_0x15f959,function(_0x3a8be6){return _0x3a8be6['status']!=='online';}),'name')[_0x85eb('0x18')]()||_0x85eb('0x1b'));console[_0x85eb('0x1c')]('App\x20Ready!');})['catch'](function(_0x4607ce){console[_0x85eb('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x4607ce);logger[_0x85eb('0x1d')](_0x85eb('0x1e'),_0x4607ce);process[_0x85eb('0x1f')](0x1);});}main(); \ No newline at end of file +var _0xf961=['start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','name','join','Offline\x20apps:','status','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0xf961,0x1cf));var _0x1f96=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xf961[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x1f96('0x0'));var db=require(_0x1f96('0x1'))['db'];var seedDb=require(_0x1f96('0x2'));var checkLicense=require(_0x1f96('0x3'));var rpc=require('./rpc');var config=require(_0x1f96('0x4'));var logger=require(_0x1f96('0x5'))(_0x1f96('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0x1f96('0x7'));var schedule=require(_0x1f96('0x8'));var chat=require(_0x1f96('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x1f96('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x1f96('0xb')][_0x1f96('0xc')]()[_0x1f96('0xd')](function(){if(config[_0x1f96('0xe')]){return seedDb[_0x1f96('0xf')]();}})[_0x1f96('0xd')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x1f96('0x10')]();})['then'](function(_0x32b621){logger[_0x1f96('0x11')](_0x32b621);return chat[_0x1f96('0x12')]();})[_0x1f96('0xd')](function(){return whatsapp['start']();})[_0x1f96('0xd')](function(){return schedule[_0x1f96('0x12')]();})[_0x1f96('0xd')](function(){return transcribe['start']();})[_0x1f96('0xd')](function(){return provider[_0x1f96('0x12')]();})[_0x1f96('0xd')](function(_0xe69e8c){logger[_0x1f96('0x11')](_0xe69e8c);return pm2[_0x1f96('0x12')](pm2Config);})['then'](function(_0x11d22d){var _0x43e677=_0x11d22d[_0x1f96('0x13')](function(_0xf77194){return typeof _0xf77194['exitCode']===_0x1f96('0x14')&&_0xf77194[_0x1f96('0x15')]>=0x0;});if(_0x43e677[_0x1f96('0x16')]>0x0){throw new Error(_0x43e677[_0x1f96('0x16')]+_0x1f96('0x17')+_[_0x1f96('0x18')](_0x43e677,function(_0x16e9c4){return'\x22'+_0x16e9c4[_0x1f96('0x19')]['name']+'\x22';}));}logger[_0x1f96('0x11')](_0x1f96('0x1a'),_['map'](_[_0x1f96('0x13')](_0x11d22d,{'status':_0x1f96('0x1b')}),_0x1f96('0x1c'))[_0x1f96('0x1d')]());logger[_0x1f96('0x11')](_0x1f96('0x1e'),_['map'](_[_0x1f96('0x13')](_0x11d22d,function(_0x47f3e6){return _0x47f3e6[_0x1f96('0x1f')]!==_0x1f96('0x1b');}),_0x1f96('0x1c'))[_0x1f96('0x1d')]()||'None');console[_0x1f96('0x20')](_0x1f96('0x21'));})['catch'](function(_0x4e965a){console[_0x1f96('0x20')](_0x1f96('0x22'),_0x4e965a);logger[_0x1f96('0x23')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4e965a);process[_0x1f96('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ed2c376..c70c4bf 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 _0x5a74=['bluebird','util','moment','secrets','fullname','name','email','userpic','permissions','md5secret','voicePause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','then','closed','forceDownload','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','find','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','user','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','role','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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.','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','payload','promisify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x5a74,0x118));var _0x45a7=function(_0x37b624,_0x28c3aa){_0x37b624=_0x37b624-0x0;var _0x44abd9=_0x5a74[_0x37b624];return _0x44abd9;};'use strict';var db=require(_0x45a7('0x0'))['db'];var config=require(_0x45a7('0x1'));var hardwareConf=require(_0x45a7('0x2'));var licenseUtil=require(_0x45a7('0x3'));var encryptor=require(_0x45a7('0x4'));var _=require('lodash');var jwt=require(_0x45a7('0x5'));var expressJwt=require(_0x45a7('0x6'));var compose=require(_0x45a7('0x7'));var basicAuth=require(_0x45a7('0x8'));var crypto=require(_0x45a7('0x9'));var BPromise=require(_0x45a7('0xa'));var util=require(_0x45a7('0xb'));var moment=require(_0x45a7('0xc'));var validateJwt=expressJwt({'secret':config[_0x45a7('0xd')]['session']});var userAttributes=['id','role',_0x45a7('0xe'),_0x45a7('0xf'),'internal',_0x45a7('0x10'),_0x45a7('0x11'),_0x45a7('0x12'),_0x45a7('0x13'),_0x45a7('0x14'),'chatPause',_0x45a7('0x15'),'faxPause',_0x45a7('0x16'),'openchannelPause',_0x45a7('0x17'),_0x45a7('0x18'),_0x45a7('0x19'),'lastPauseAt',_0x45a7('0x1a'),_0x45a7('0x1b'),'passwordResetAt','alias',_0x45a7('0x1c'),_0x45a7('0x1d'),_0x45a7('0x1e'),_0x45a7('0x1f'),_0x45a7('0x20'),_0x45a7('0x21'),_0x45a7('0x22'),_0x45a7('0x23'),_0x45a7('0x24'),_0x45a7('0x25'),_0x45a7('0x26'),_0x45a7('0x27'),_0x45a7('0x28'),'privacyEnabled',_0x45a7('0x29'),_0x45a7('0x2a'),'downloadVoiceRecordings',_0x45a7('0x2b'),_0x45a7('0x2c'),_0x45a7('0x2d'),_0x45a7('0x2e'),'chatAutoanswer',_0x45a7('0x2f'),_0x45a7('0x30'),_0x45a7('0x31'),_0x45a7('0x32'),_0x45a7('0x33'),_0x45a7('0x34'),_0x45a7('0x35'),_0x45a7('0x36'),'faxAutoanswerDelay',_0x45a7('0x37'),_0x45a7('0x38'),'messengerSoundNotification'];exports[_0x45a7('0x39')]=function(){return this[_0x45a7('0x3a')](!![])[_0x45a7('0x3b')](function(_0x2839c7,_0x296889,_0x5cf64f){if(_0x2839c7['user']){_0x5cf64f();}else{return db[_0x45a7('0x3c')][_0x45a7('0x3d')]({'where':{'id':_0x2839c7[_0x45a7('0x3e')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x45a7('0x3f')](function(_0x1a25dc){if(_0x1a25dc&&_0x1a25dc[_0x45a7('0x40')]&&!_0x2839c7['query'][_0x45a7('0x41')]){return _0x296889[_0x45a7('0x42')](_0x1a25dc[_0x45a7('0x43')]==='unmanaged'?0x195:0x193)['json']({'message':_0x1a25dc['disposition']===_0x45a7('0x44')?_0x45a7('0x45'):_0x45a7('0x46')});}else{_0x5cf64f();}})[_0x45a7('0x47')](function(_0x4b3eeb){_0x5cf64f(_0x4b3eeb);});}});};exports[_0x45a7('0x3a')]=function isAuthenticated(_0x1dce9e){return compose()['use'](function(_0x250b11,_0x206468,_0x387c32){var _0x3ea770;if(_0x250b11[_0x45a7('0x48')][_0x45a7('0x49')]){if(_[_0x45a7('0x4a')](_0x250b11[_0x45a7('0x48')][_0x45a7('0x49')],'Basic')){var _0x56974f=basicAuth(_0x250b11);db['User'][_0x45a7('0x4b')]({'where':{'name':_0x56974f['name']}})[_0x45a7('0x3f')](function(_0x51d712){if(!_0x51d712||!_0x51d712['authenticate'](_0x56974f[_0x45a7('0x4c')])){return _0x206468['status'](0x191)[_0x45a7('0x4d')]({'message':'Wrong\x20credentials.'});}_0x250b11['user']={'id':_0x51d712['id']};_0x387c32();})[_0x45a7('0x47')](function(_0x2a7dd1){_0x387c32(_0x2a7dd1);});}else if(_[_0x45a7('0x4a')](_0x250b11['headers'][_0x45a7('0x49')],_0x45a7('0x4e'))){validateJwt(_0x250b11,_0x206468,_0x387c32);}else{if(_0x1dce9e){_0x387c32();}else{return _0x206468[_0x45a7('0x42')](0x193)[_0x45a7('0x4d')]({'message':_0x45a7('0x4f')});}}}else if(_0x250b11[_0x45a7('0x50')][_0x45a7('0x51')]){try{var _0x51f348={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x45a7('0x52')]()};verifyJwt(_0x250b11[_0x45a7('0x50')][_0x45a7('0x51')],_0x51f348)['then'](function(_0x4a7262){return db[_0x45a7('0x53')]['find']({'where':{'id':_0x4a7262[_0x45a7('0x54')]}})['then'](function(_0x21b699){_0x3ea770=_0x21b699;return db[_0x45a7('0x55')][_0x45a7('0x3d')]({'where':{'id':0x1},'attributes':[_0x45a7('0x56'),_0x45a7('0x57')],'raw':!![]});})['then'](function(_0x389ecc){if(!_0x3ea770||!_[_0x45a7('0x58')](_0x3ea770[_0x45a7('0x59')],_0x4a7262[_0x45a7('0x5a')])){return _0x206468[_0x45a7('0x42')](0x191)[_0x45a7('0x4d')]({'message':_0x45a7('0x5b')});}if(_0x3ea770[_0x45a7('0x5c')]){return _0x206468[_0x45a7('0x42')](0x191)[_0x45a7('0x4d')]({'message':_0x45a7('0x5d')});}if(_0x3ea770[_0x45a7('0x5e')]){if(_0x389ecc[_0x45a7('0x57')]>0x0){if(moment(_0x3ea770[_0x45a7('0x5f')])['add'](_0x389ecc[_0x45a7('0x57')],'minutes')>moment()){return _0x206468['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x206468['status'](0x191)[_0x45a7('0x4d')]({'message':_0x45a7('0x5d')});}}_0x250b11['user']={'id':_0x3ea770['id']};_0x387c32();});})[_0x45a7('0x47')](function(){return _0x206468['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x5c536c){_0x387c32(_0x5c536c);}}else if(_0x1dce9e){_0x387c32();}else{return _0x206468[_0x45a7('0x42')](0x193)[_0x45a7('0x4d')]({'message':_0x45a7('0x4f')});}})[_0x45a7('0x3b')](function(_0x5804af,_0x375776,_0x2ba199){if(_0x5804af[_0x45a7('0x60')]){db[_0x45a7('0x53')]['find']({'where':{'id':_0x5804af['user']['id']},'attributes':userAttributes})[_0x45a7('0x3f')](function(_0x11644b){if(!_0x11644b){return _0x375776[_0x45a7('0x42')](0x194)[_0x45a7('0x4d')]({'message':_0x45a7('0x61')});}_0x5804af[_0x45a7('0x60')]=_0x11644b;_0x2ba199();})[_0x45a7('0x47')](function(_0x17e330){_0x2ba199(_0x17e330);});}else if(_0x1dce9e){_0x2ba199();}else{return _0x375776['status'](0x194)[_0x45a7('0x4d')]({'message':_0x45a7('0x62')});}});};exports[_0x45a7('0x63')]=function canUpdate(){return compose()[_0x45a7('0x3b')](function(_0x3d9c8b,_0x87ffc2,_0x5c66b4){return licenseUtil[_0x45a7('0x64')]()[_0x45a7('0x3f')](function(_0x84fddd){if(_0x84fddd[_0x45a7('0x65')]){_0x5c66b4();}else{return _0x87ffc2['status'](0x193)[_0x45a7('0x4d')]({'message':'Forbidden'});}})[_0x45a7('0x47')](function(_0x4ad853){_0x5c66b4(_0x4ad853);});});};exports[_0x45a7('0x66')]=function isWebrtcLicence(){return compose()[_0x45a7('0x3b')](function(_0x289987,_0x1e0d82,_0x4d2de9){return licenseUtil[_0x45a7('0x64')]()[_0x45a7('0x3f')](function(_0x473651){if(_0x473651['webrtc']){_0x4d2de9();}else{return _0x1e0d82['status'](0x193)[_0x45a7('0x4d')]({'message':_0x45a7('0x67')});}})[_0x45a7('0x47')](function(_0x198f1){_0x4d2de9(_0x198f1);});});};exports[_0x45a7('0x68')]=function(_0x24fab2,_0x321a89,_0x5e4db3){_0x24fab2[_0x45a7('0x68')]=!![];return _0x5e4db3();};exports[_0x45a7('0x69')]=function signToken(_0x3ca3f2){return signJwt(_0x3ca3f2);};exports[_0x45a7('0x6a')]=function(_0x302273,_0xdb77d9){if(!_0x302273[_0x45a7('0x60')]){return _0xdb77d9['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x403dd4={'payload':{'id':_0x302273[_0x45a7('0x60')]['id'],'role':_0x302273[_0x45a7('0x60')][_0x45a7('0x6b')]},'options':{'expiresIn':0x15180}};return signJwt(_0x403dd4)[_0x45a7('0x3f')](function(_0x3428e1){_0xdb77d9[_0x45a7('0x6c')](_0x45a7('0x6d'),_0x3428e1);_0xdb77d9[_0x45a7('0x6e')](_0x45a7('0x6f'));})[_0x45a7('0x47')](function(_0x37e035){return _0xdb77d9[_0x45a7('0x42')](0x1f4)['send'](_0x37e035);});};exports[_0x45a7('0x70')]=function(_0xb45c03){if(_[_0x45a7('0x71')](_0xb45c03[_0x45a7('0x59')])||_['isNil'](_0xb45c03[_0x45a7('0x72')])){return null;}else{return createJwt(_0xb45c03);}};exports[_0x45a7('0x73')]=function(_0x2a98ab){_0x2a98ab[_0x45a7('0x59')]=generateNonce();_0x2a98ab[_0x45a7('0x72')]=generateIssuedAt();return createJwt(_0x2a98ab);};exports[_0x45a7('0x74')]=function(_0x2f96a7,_0x2cc0c7){var _0x1ec5e9=_0x2f96a7[_0x45a7('0x50')][_0x45a7('0x51')];if(_0x1ec5e9){var _0x2a8b06={'nonce':_0x2cc0c7[_0x45a7('0x59')],'iat':_0x2cc0c7['apiKeyIat'],'audience':hardwareConf[_0x45a7('0x52')](),'issuer':hardwareConf[_0x45a7('0x52')]()};return verifyJwt(_0x1ec5e9,_0x2a8b06)['then'](function(){return generateApiKey(_0x2cc0c7);});}else{throw{'message':_0x45a7('0x75')};}};exports['validatePasswordPattern']=function(_0x3aae98){var _0x2fe731=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2fe731[_0x45a7('0x76')](_0x3aae98))throw new db[(_0x45a7('0x77'))][(_0x45a7('0x78'))](_0x45a7('0x79'));return;};exports[_0x45a7('0x7a')]=function(_0xd3f9c9,_0x2b8e8b,_0x56a24c){var _0xfe57aa=encryptor[_0x45a7('0x7b')](_0x2b8e8b)[_0x45a7('0x7c')](',');for(var _0x206c35=0x0;_0x206c35<_0x56a24c;_0x206c35++){if(!_0xfe57aa[_0x206c35])break;if(_0xd3f9c9[_0x45a7('0x7d')]()===_0xfe57aa[_0x206c35]['toLowerCase']()){var _0x505b65=util[_0x45a7('0x7e')](_0x45a7('0x7f'),_0x56a24c);if(_0x56a24c===0x1){_0x505b65='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x45a7('0x77'))][(_0x45a7('0x78'))](_0x505b65);}}return;};exports[_0x45a7('0x80')]=function(_0x20ab2c,_0x520867){var _0x2ec6d4=_0x520867?encryptor[_0x45a7('0x7b')](_0x520867)['split'](','):[];if(_0x2ec6d4[_0x45a7('0x81')]===0x5){_0x2ec6d4[_0x45a7('0x82')](-0x1,0x1);}_0x2ec6d4[_0x45a7('0x83')](_0x20ab2c);return encryptor[_0x45a7('0x84')](_0x2ec6d4[_0x45a7('0x85')](','));};function signJwt(_0x19149d){var _0x549ba3=BPromise['promisify'](jwt[_0x45a7('0x86')],{'context':jwt});var _0x9a415e=_0x19149d[_0x45a7('0x87')]||config['secrets'][_0x45a7('0x88')];return new BPromise(function(_0x2ac7eb,_0x2a850f){_0x549ba3(_0x19149d[_0x45a7('0x89')],_0x9a415e,_0x19149d['options'])[_0x45a7('0x3f')](function(_0x3fb616){_0x2ac7eb(_0x3fb616);})[_0x45a7('0x47')](function(_0x4f3aff){_0x2a850f(_0x4f3aff);});});}function verifyJwt(_0x4a7df0,_0x1c864b,_0x5061da){var _0x2c66b8=BPromise[_0x45a7('0x8a')](jwt['verify'],{'context':jwt});var _0x401139=_0x5061da||config[_0x45a7('0xd')]['session'];return new BPromise(function(_0x608d83,_0x1fbf41){_0x2c66b8(_0x4a7df0,_0x401139,_0x1c864b)['then'](function(_0x7ae26f){_0x608d83(_0x7ae26f);})[_0x45a7('0x47')](function(_0x4c47bb){_0x1fbf41(_0x4c47bb);});});}function generateNonce(){return crypto[_0x45a7('0x8b')](0x10)[_0x45a7('0x8c')](_0x45a7('0x8d'));}function generateIssuedAt(){return Math[_0x45a7('0x8e')](Date[_0x45a7('0x8f')]()/0x3e8)[_0x45a7('0x8c')]();}function createJwt(_0x3e9829){var _0x4009f6={'payload':{'iat':_0x3e9829['apiKeyIat'],'nonce':_0x3e9829[_0x45a7('0x59')]},'options':{'algorithm':_0x45a7('0x90'),'subject':_0x3e9829['id'][_0x45a7('0x8c')](),'issuer':hardwareConf[_0x45a7('0x52')](),'audience':hardwareConf[_0x45a7('0x52')]()}};return signJwt(_0x4009f6)[_0x45a7('0x3f')](function(_0x4ef08d){return{'iat':_0x3e9829[_0x45a7('0x72')],'nonce':_0x3e9829['apiKeyNonce'],'token':_0x4ef08d};});} \ No newline at end of file +var _0x8e71=['unshift','encryptString','join','promisify','sign','options','verify','randomBytes','toString','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','query','forceDownload','status','unmanaged','json','Forbidden.','catch','headers','startsWith','User','find','Wrong\x20credentials.','authorization','Bearer','Unknown\x20authorization\x20format','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockDuration','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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','updatePasswordsHistory','length'];(function(_0x232618,_0x11bed1){var _0x21f835=function(_0x14f839){while(--_0x14f839){_0x232618['push'](_0x232618['shift']());}};_0x21f835(++_0x11bed1);}(_0x8e71,0x1ab));var _0x18e7=function(_0x1bd230,_0x1da01e){_0x1bd230=_0x1bd230-0x0;var _0x19a3e3=_0x8e71[_0x1bd230];return _0x19a3e3;};'use strict';var db=require(_0x18e7('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x18e7('0x1'));var licenseUtil=require(_0x18e7('0x2'));var encryptor=require('../encryptor');var _=require(_0x18e7('0x3'));var jwt=require(_0x18e7('0x4'));var expressJwt=require(_0x18e7('0x5'));var compose=require(_0x18e7('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x18e7('0x7'));var BPromise=require(_0x18e7('0x8'));var util=require(_0x18e7('0x9'));var moment=require(_0x18e7('0xa'));var validateJwt=expressJwt({'secret':config[_0x18e7('0xb')][_0x18e7('0xc')]});var userAttributes=['id',_0x18e7('0xd'),_0x18e7('0xe'),_0x18e7('0xf'),_0x18e7('0x10'),_0x18e7('0x11'),_0x18e7('0x12'),_0x18e7('0x13'),_0x18e7('0x14'),'voicePause',_0x18e7('0x15'),_0x18e7('0x16'),_0x18e7('0x17'),_0x18e7('0x18'),_0x18e7('0x19'),'pauseType','showWebBar',_0x18e7('0x1a'),_0x18e7('0x1b'),_0x18e7('0x1c'),'allowmessenger',_0x18e7('0x1d'),_0x18e7('0x1e'),_0x18e7('0x1f'),_0x18e7('0x20'),_0x18e7('0x21'),_0x18e7('0x22'),_0x18e7('0x23'),_0x18e7('0x24'),_0x18e7('0x25'),_0x18e7('0x26'),_0x18e7('0x27'),'phoneBarRemoteControlPort',_0x18e7('0x28'),_0x18e7('0x29'),'userProfileId',_0x18e7('0x2a'),_0x18e7('0x2b'),_0x18e7('0x2c'),_0x18e7('0x2d'),_0x18e7('0x2e'),_0x18e7('0x2f'),_0x18e7('0x30'),_0x18e7('0x31'),_0x18e7('0x32'),_0x18e7('0x33'),'emailAutoanswer',_0x18e7('0x34'),_0x18e7('0x35'),_0x18e7('0x36'),_0x18e7('0x37'),_0x18e7('0x38'),_0x18e7('0x39'),_0x18e7('0x3a'),_0x18e7('0x3b'),'whatsappAutoanswerDelay',_0x18e7('0x3c')];exports[_0x18e7('0x3d')]=function(){return this[_0x18e7('0x3e')](!![])[_0x18e7('0x3f')](function(_0x4e7326,_0x218637,_0x1e4db8){if(_0x4e7326[_0x18e7('0x40')]){_0x1e4db8();}else{return db[_0x18e7('0x41')][_0x18e7('0x42')]({'where':{'id':_0x4e7326[_0x18e7('0x43')]['id']},'attributes':['id',_0x18e7('0x44'),_0x18e7('0x45')],'raw':!![]})[_0x18e7('0x46')](function(_0x125663){if(_0x125663&&_0x125663[_0x18e7('0x44')]&&!_0x4e7326[_0x18e7('0x47')][_0x18e7('0x48')]){return _0x218637[_0x18e7('0x49')](_0x125663[_0x18e7('0x45')]===_0x18e7('0x4a')?0x195:0x193)[_0x18e7('0x4b')]({'message':_0x125663[_0x18e7('0x45')]==='unmanaged'?'Unmanaged.':_0x18e7('0x4c')});}else{_0x1e4db8();}})[_0x18e7('0x4d')](function(_0x3f6374){_0x1e4db8(_0x3f6374);});}});};exports[_0x18e7('0x3e')]=function isAuthenticated(_0x516489){return compose()[_0x18e7('0x3f')](function(_0x18bdcc,_0x26a2cf,_0x51f27a){var _0x26e6fa;if(_0x18bdcc[_0x18e7('0x4e')]['authorization']){if(_[_0x18e7('0x4f')](_0x18bdcc[_0x18e7('0x4e')]['authorization'],'Basic')){var _0x4592b5=basicAuth(_0x18bdcc);db[_0x18e7('0x50')][_0x18e7('0x51')]({'where':{'name':_0x4592b5['name']}})[_0x18e7('0x46')](function(_0x495881){if(!_0x495881||!_0x495881['authenticate'](_0x4592b5['pass'])){return _0x26a2cf[_0x18e7('0x49')](0x191)[_0x18e7('0x4b')]({'message':_0x18e7('0x52')});}_0x18bdcc['user']={'id':_0x495881['id']};_0x51f27a();})[_0x18e7('0x4d')](function(_0x4c1bd7){_0x51f27a(_0x4c1bd7);});}else if(_[_0x18e7('0x4f')](_0x18bdcc[_0x18e7('0x4e')][_0x18e7('0x53')],_0x18e7('0x54'))){validateJwt(_0x18bdcc,_0x26a2cf,_0x51f27a);}else{if(_0x516489){_0x51f27a();}else{return _0x26a2cf[_0x18e7('0x49')](0x193)['json']({'message':_0x18e7('0x55')});}}}else if(_0x18bdcc[_0x18e7('0x47')]['apikey']){try{var _0x4529fc={'audience':hardwareConf[_0x18e7('0x56')](),'issuer':hardwareConf[_0x18e7('0x56')]()};verifyJwt(_0x18bdcc[_0x18e7('0x47')][_0x18e7('0x57')],_0x4529fc)['then'](function(_0x16a355){return db['User'][_0x18e7('0x51')]({'where':{'id':_0x16a355[_0x18e7('0x58')]}})['then'](function(_0x352594){_0x26e6fa=_0x352594;return db[_0x18e7('0x59')][_0x18e7('0x42')]({'where':{'id':0x1},'attributes':[_0x18e7('0x5a'),'blockDuration'],'raw':!![]});})['then'](function(_0x58e6e0){if(!_0x26e6fa||!_['isEqual'](_0x26e6fa[_0x18e7('0x5b')],_0x16a355[_0x18e7('0x5c')])){return _0x26a2cf[_0x18e7('0x49')](0x191)['json']({'message':_0x18e7('0x5d')});}if(_0x26e6fa['disabled']){return _0x26a2cf[_0x18e7('0x49')](0x191)['json']({'message':_0x18e7('0x5e')});}if(_0x26e6fa['blocked']){if(_0x58e6e0[_0x18e7('0x5f')]>0x0){if(moment(_0x26e6fa['blockedAt'])[_0x18e7('0x60')](_0x58e6e0['blockDuration'],_0x18e7('0x61'))>moment()){return _0x26a2cf[_0x18e7('0x49')](0x191)[_0x18e7('0x4b')]({'message':_0x18e7('0x5e')});}}else{return _0x26a2cf[_0x18e7('0x49')](0x191)[_0x18e7('0x4b')]({'message':_0x18e7('0x5e')});}}_0x18bdcc[_0x18e7('0x40')]={'id':_0x26e6fa['id']};_0x51f27a();});})['catch'](function(){return _0x26a2cf[_0x18e7('0x49')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x12efcd){_0x51f27a(_0x12efcd);}}else if(_0x516489){_0x51f27a();}else{return _0x26a2cf[_0x18e7('0x49')](0x193)['json']({'message':_0x18e7('0x55')});}})[_0x18e7('0x3f')](function(_0x52e479,_0x502576,_0x5e869a){if(_0x52e479[_0x18e7('0x40')]){db[_0x18e7('0x50')][_0x18e7('0x51')]({'where':{'id':_0x52e479['user']['id']},'attributes':userAttributes})[_0x18e7('0x46')](function(_0x266b30){if(!_0x266b30){return _0x502576[_0x18e7('0x49')](0x194)[_0x18e7('0x4b')]({'message':_0x18e7('0x62')});}_0x52e479[_0x18e7('0x40')]=_0x266b30;_0x5e869a();})[_0x18e7('0x4d')](function(_0x2c882a){_0x5e869a(_0x2c882a);});}else if(_0x516489){_0x5e869a();}else{return _0x502576['status'](0x194)['json']({'message':_0x18e7('0x63')});}});};exports[_0x18e7('0x64')]=function canUpdate(){return compose()[_0x18e7('0x3f')](function(_0x528f69,_0x14b12d,_0x93fe1c){return licenseUtil['getLicense']()[_0x18e7('0x46')](function(_0xca80f7){if(_0xca80f7[_0x18e7('0x65')]){_0x93fe1c();}else{return _0x14b12d['status'](0x193)[_0x18e7('0x4b')]({'message':_0x18e7('0x66')});}})[_0x18e7('0x4d')](function(_0x2966a9){_0x93fe1c(_0x2966a9);});});};exports[_0x18e7('0x67')]=function isWebrtcLicence(){return compose()[_0x18e7('0x3f')](function(_0x32cd80,_0x4077fc,_0x49ef3f){return licenseUtil[_0x18e7('0x68')]()['then'](function(_0x75c87f){if(_0x75c87f[_0x18e7('0x69')]){_0x49ef3f();}else{return _0x4077fc[_0x18e7('0x49')](0x193)[_0x18e7('0x4b')]({'message':_0x18e7('0x66')});}})[_0x18e7('0x4d')](function(_0x98e4bc){_0x49ef3f(_0x98e4bc);});});};exports['isMiddleware']=function(_0x3759e,_0xf2afc1,_0x1c5cf8){_0x3759e[_0x18e7('0x6a')]=!![];return _0x1c5cf8();};exports[_0x18e7('0x6b')]=function signToken(_0xf91d26){return signJwt(_0xf91d26);};exports[_0x18e7('0x6c')]=function(_0xbbc48d,_0x3981b3){if(!_0xbbc48d[_0x18e7('0x40')]){return _0x3981b3['status'](0x194)['json']({'message':_0x18e7('0x6d')});}var _0x4a2c3e={'payload':{'id':_0xbbc48d[_0x18e7('0x40')]['id'],'role':_0xbbc48d[_0x18e7('0x40')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4a2c3e)[_0x18e7('0x46')](function(_0x5d9922){_0x3981b3[_0x18e7('0x6e')](_0x18e7('0x6f'),_0x5d9922);_0x3981b3['redirect'](_0x18e7('0x70'));})[_0x18e7('0x4d')](function(_0x3e01d3){return _0x3981b3[_0x18e7('0x49')](0x1f4)[_0x18e7('0x71')](_0x3e01d3);});};exports['retrieveApiKey']=function(_0x159bd8){if(_[_0x18e7('0x72')](_0x159bd8['apiKeyNonce'])||_[_0x18e7('0x72')](_0x159bd8['apiKeyIat'])){return null;}else{return createJwt(_0x159bd8);}};exports[_0x18e7('0x73')]=function(_0x5caa88){_0x5caa88[_0x18e7('0x5b')]=generateNonce();_0x5caa88['apiKeyIat']=generateIssuedAt();return createJwt(_0x5caa88);};exports[_0x18e7('0x74')]=function(_0x50e56a,_0x31fbf9){var _0x4c8e99=_0x50e56a[_0x18e7('0x47')][_0x18e7('0x57')];if(_0x4c8e99){var _0x3d19a={'nonce':_0x31fbf9[_0x18e7('0x5b')],'iat':_0x31fbf9[_0x18e7('0x75')],'audience':hardwareConf[_0x18e7('0x56')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x4c8e99,_0x3d19a)['then'](function(){return generateApiKey(_0x31fbf9);});}else{throw{'message':_0x18e7('0x76')};}};exports['validatePasswordPattern']=function(_0x4e1bf1){var _0x384f40=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x384f40['test'](_0x4e1bf1))throw new db[(_0x18e7('0x77'))][(_0x18e7('0x78'))](_0x18e7('0x79'));return;};exports[_0x18e7('0x7a')]=function(_0x3fe52b,_0x4619fd,_0x21c022){var _0x210879=encryptor[_0x18e7('0x7b')](_0x4619fd)[_0x18e7('0x7c')](',');for(var _0x463a01=0x0;_0x463a01<_0x21c022;_0x463a01++){if(!_0x210879[_0x463a01])break;if(_0x3fe52b[_0x18e7('0x7d')]()===_0x210879[_0x463a01][_0x18e7('0x7d')]()){var _0x345347=util[_0x18e7('0x7e')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x21c022);if(_0x21c022===0x1){_0x345347='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x345347);}}return;};exports[_0x18e7('0x7f')]=function(_0x257bce,_0x4d2cee){var _0x2f7de9=_0x4d2cee?encryptor[_0x18e7('0x7b')](_0x4d2cee)[_0x18e7('0x7c')](','):[];if(_0x2f7de9[_0x18e7('0x80')]===0x5){_0x2f7de9['splice'](-0x1,0x1);}_0x2f7de9[_0x18e7('0x81')](_0x257bce);return encryptor[_0x18e7('0x82')](_0x2f7de9[_0x18e7('0x83')](','));};function signJwt(_0x2f7fa8){var _0x198ef0=BPromise[_0x18e7('0x84')](jwt[_0x18e7('0x85')],{'context':jwt});var _0x47caac=_0x2f7fa8['secret']||config['secrets'][_0x18e7('0xc')];return new BPromise(function(_0x4c80e9,_0x2d7197){_0x198ef0(_0x2f7fa8['payload'],_0x47caac,_0x2f7fa8[_0x18e7('0x86')])[_0x18e7('0x46')](function(_0x4c43dd){_0x4c80e9(_0x4c43dd);})[_0x18e7('0x4d')](function(_0x4f7aec){_0x2d7197(_0x4f7aec);});});}function verifyJwt(_0xfbfc14,_0x16b5bd,_0x34e1c2){var _0x4dddc2=BPromise[_0x18e7('0x84')](jwt[_0x18e7('0x87')],{'context':jwt});var _0x39604d=_0x34e1c2||config[_0x18e7('0xb')][_0x18e7('0xc')];return new BPromise(function(_0x17eabf,_0x5db7d4){_0x4dddc2(_0xfbfc14,_0x39604d,_0x16b5bd)[_0x18e7('0x46')](function(_0x10de3c){_0x17eabf(_0x10de3c);})[_0x18e7('0x4d')](function(_0x234a3){_0x5db7d4(_0x234a3);});});}function generateNonce(){return crypto[_0x18e7('0x88')](0x10)[_0x18e7('0x89')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)['toString']();}function createJwt(_0x30cfa1){var _0x57379e={'payload':{'iat':_0x30cfa1[_0x18e7('0x75')],'nonce':_0x30cfa1[_0x18e7('0x5b')]},'options':{'algorithm':_0x18e7('0x8a'),'subject':_0x30cfa1['id'][_0x18e7('0x89')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x57379e)['then'](function(_0xab96b9){return{'iat':_0x30cfa1[_0x18e7('0x75')],'nonce':_0x30cfa1[_0x18e7('0x5b')],'token':_0xab96b9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 3a50dbe..d9f0c64 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 _0xe3bc=['user','clause','tags','checkListsRestrictions','then','ids','tag','countFilteredContacts','count','fields','rows','catch','describe','CmContact','keys','startsWith','CmCustomField','findOne','slice','all','cf_','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter'];(function(_0x54ed8e,_0x3106ab){var _0x12443e=function(_0x43832e){while(--_0x43832e){_0x54ed8e['push'](_0x54ed8e['shift']());}};_0x12443e(++_0x3106ab);}(_0xe3bc,0x1de));var _0xce3b=function(_0x41c74e,_0x1917d7){_0x41c74e=_0x41c74e-0x0;var _0x4f5f6a=_0xe3bc[_0x41c74e];return _0x4f5f6a;};'use strict';var _=require(_0xce3b('0x0'));var sqlUtils=require(_0xce3b('0x1'));var db=require(_0xce3b('0x2'))['db'];exports[_0xce3b('0x3')]=function(_0x5e06bf,_0x59fdd3,_0x4b9468,_0x4f6fbd){var _0x174210={'count':0x0,'rows':[]};var _0x6d98d9=sqlUtils[_0xce3b('0x4')](_0x59fdd3,_0x5e06bf);if(_0x6d98d9){return Promise['resolve'](_0x174210);}var _0x4e1fe8=sqlUtils['getContactsSubquery']();var _0x53c18d={};var _0x55d3b6=![];var _0x286a87=![];return Promise[_0xce3b('0x5')]()['then'](function(){if(_0x5e06bf[_0xce3b('0x6')]){return sqlUtils[_0xce3b('0x7')](_0x5e06bf['search'],_0x4f6fbd);}else{return sqlUtils[_0xce3b('0x8')](_0x5e06bf,_0x4f6fbd);}})['then'](function(_0x59c760){_0x4e1fe8[_0xce3b('0x9')](_0x59c760[_0xce3b('0xa')]);_0x4e1fe8[_0xce3b('0x9')](_0x59c760['fields']);_0x4e1fe8[_0xce3b('0x9')](_0x59c760[_0xce3b('0xb')]);_0x4e1fe8[_0xce3b('0x9')](_0x59c760[_0xce3b('0xc')][_0xce3b('0xd')]);_0x53c18d=_0x59c760[_0xce3b('0xe')];_0x286a87=_0x59c760[_0xce3b('0xc')]['skip'];return sqlUtils[_0xce3b('0xf')](_0x59fdd3,_0x5e06bf,_0x286a87);})[_0xce3b('0x10')](function(_0xb4b727){_0x4e1fe8[_0xce3b('0x9')](_0xb4b727);var _0x51d502=_0x5e06bf[_0xce3b('0x6')]?_0x53c18d[_0xce3b('0x11')]:_0x5e06bf[_0xce3b('0x12')];_0x55d3b6=_0x51d502?!![]:![];return sqlUtils[_0xce3b('0x13')](_0x4e1fe8,_0x51d502);})['then'](function(_0x260b5b){_0x174210[_0xce3b('0x14')]=_0x260b5b;if(_0x174210[_0xce3b('0x14')]===0x0){return;}if(_0x5e06bf['User']){_0x286a87=!![];}return sqlUtils['buildContactsQuery'](_0x4e1fe8,_0x5e06bf[_0xce3b('0x15')],_0x4b9468,_0x55d3b6,_0x53c18d['clause'],_0x286a87);})['then'](function(_0x2c2457){if(!_0x2c2457){return[];}return sqlUtils['getFilteredContacts'](_0x2c2457,_0x5e06bf,_0x4b9468);})[_0xce3b('0x10')](function(_0x2d9c83){_0x174210[_0xce3b('0x16')]=_0x2d9c83;return _0x174210;})[_0xce3b('0x17')](function(_0x389b4e){throw _0x389b4e;});};exports[_0xce3b('0x18')]=function(){var _0x55d0d1={};var _0xfd4ad0=[];return db[_0xce3b('0x19')][_0xce3b('0x18')]()[_0xce3b('0x10')](function(_0x30bf9b){_0x55d0d1=_0x30bf9b;var _0x464cf7=Object[_0xce3b('0x1a')](_0x55d0d1)[_0xce3b('0xb')](function(_0x1231f8){return _[_0xce3b('0x1b')](_0x1231f8,'cf_')?_0x1231f8:undefined;});var _0x3c1ce1=_0x464cf7['map'](function(_0xec9369){return db[_0xce3b('0x1c')][_0xce3b('0x1d')]({'where':{'id':_0xec9369[_0xce3b('0x1e')](0x3)},'raw':!![]});});return Promise[_0xce3b('0x1f')](_0x3c1ce1);})[_0xce3b('0x10')](function(_0x5f23c5){for(var _0x1ee300=0x0;_0x1ee300<_0x5f23c5['length'];_0x1ee300++){if(_0x5f23c5[_0x1ee300]){var _0xd000bf=_0xce3b('0x20')+_0x5f23c5[_0x1ee300]['id'];_0x55d0d1[_0xd000bf][_0xce3b('0x21')]=_0x5f23c5[_0x1ee300][_0xce3b('0x22')];}}_0xfd4ad0=_['map'](Object[_0xce3b('0x1a')](_0x55d0d1),function(_0x44cce){return{'name':_0x44cce,'type':_0x55d0d1[_0x44cce][_0xce3b('0x22')]};});return _0xfd4ad0;})[_0xce3b('0x17')](function(_0x555c93){throw _0x555c93;});}; \ No newline at end of file +var _0x3c67=['User','buildContactsQuery','clause','getFilteredContacts','rows','catch','describe','CmContact','keys','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','lodash','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','tags','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0x3c67,0xaa));var _0x73c6=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x3c67[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x73c6('0x0'));var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0x73c6('0x1')]=function(_0x15dfc0,_0x4fd42a,_0x2eb4b1,_0x465d8f){var _0x27bd0d={'count':0x0,'rows':[]};var _0x2e248f=sqlUtils[_0x73c6('0x2')](_0x4fd42a,_0x15dfc0);if(_0x2e248f){return Promise[_0x73c6('0x3')](_0x27bd0d);}var _0x3d4c8e=sqlUtils[_0x73c6('0x4')]();var _0xddb6b9={};var _0x3603ef=![];var _0x85ce69=![];return Promise[_0x73c6('0x3')]()[_0x73c6('0x5')](function(){if(_0x15dfc0['search']){return sqlUtils[_0x73c6('0x6')](_0x15dfc0[_0x73c6('0x7')],_0x465d8f);}else{return sqlUtils[_0x73c6('0x8')](_0x15dfc0,_0x465d8f);}})[_0x73c6('0x5')](function(_0x4c0d6c){_0x3d4c8e[_0x73c6('0x9')](_0x4c0d6c[_0x73c6('0xa')]);_0x3d4c8e[_0x73c6('0x9')](_0x4c0d6c[_0x73c6('0xb')]);_0x3d4c8e[_0x73c6('0x9')](_0x4c0d6c[_0x73c6('0xc')]);_0x3d4c8e[_0x73c6('0x9')](_0x4c0d6c['user']['clause']);_0xddb6b9=_0x4c0d6c[_0x73c6('0xd')];_0x85ce69=_0x4c0d6c[_0x73c6('0xe')][_0x73c6('0xf')];return sqlUtils[_0x73c6('0x10')](_0x4fd42a,_0x15dfc0,_0x85ce69);})[_0x73c6('0x5')](function(_0x594c67){_0x3d4c8e[_0x73c6('0x9')](_0x594c67);var _0x3b6bb3=_0x15dfc0[_0x73c6('0x7')]?_0xddb6b9[_0x73c6('0x11')]:_0x15dfc0[_0x73c6('0x12')];_0x3603ef=_0x3b6bb3?!![]:![];return sqlUtils[_0x73c6('0x13')](_0x3d4c8e,_0x3b6bb3);})[_0x73c6('0x5')](function(_0x214462){_0x27bd0d['count']=_0x214462;if(_0x27bd0d['count']===0x0){return;}if(_0x15dfc0[_0x73c6('0x14')]){_0x85ce69=!![];}return sqlUtils[_0x73c6('0x15')](_0x3d4c8e,_0x15dfc0[_0x73c6('0xb')],_0x2eb4b1,_0x3603ef,_0xddb6b9[_0x73c6('0x16')],_0x85ce69);})[_0x73c6('0x5')](function(_0x130659){if(!_0x130659){return[];}return sqlUtils[_0x73c6('0x17')](_0x130659,_0x15dfc0,_0x2eb4b1);})['then'](function(_0x2746a3){_0x27bd0d[_0x73c6('0x18')]=_0x2746a3;return _0x27bd0d;})[_0x73c6('0x19')](function(_0x4f643b){throw _0x4f643b;});};exports[_0x73c6('0x1a')]=function(){var _0x39cc00={};var _0x10e247=[];return db[_0x73c6('0x1b')][_0x73c6('0x1a')]()[_0x73c6('0x5')](function(_0x1dbf61){_0x39cc00=_0x1dbf61;var _0x1a97b8=Object[_0x73c6('0x1c')](_0x39cc00)['filter'](function(_0x60d26){return _['startsWith'](_0x60d26,_0x73c6('0x1d'))?_0x60d26:undefined;});var _0x387097=_0x1a97b8[_0x73c6('0x1e')](function(_0x291028){return db[_0x73c6('0x1f')][_0x73c6('0x20')]({'where':{'id':_0x291028[_0x73c6('0x21')](0x3)},'raw':!![]});});return Promise[_0x73c6('0x22')](_0x387097);})['then'](function(_0x13399a){for(var _0x1ebf70=0x0;_0x1ebf70<_0x13399a[_0x73c6('0x23')];_0x1ebf70++){if(_0x13399a[_0x1ebf70]){var _0x151c6c='cf_'+_0x13399a[_0x1ebf70]['id'];_0x39cc00[_0x151c6c][_0x73c6('0x24')]=_0x13399a[_0x1ebf70][_0x73c6('0x25')];}}_0x10e247=_[_0x73c6('0x1e')](Object['keys'](_0x39cc00),function(_0x29228a){return{'name':_0x29228a,'type':_0x39cc00[_0x29228a][_0x73c6('0x25')]};});return _0x10e247;})['catch'](function(_0x539868){throw _0x539868;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index b14d108..338ed88 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 _0x4578=['castTo','buildExpression','type','text','start','end','Tag','value','map','clause','and','ids','user','skip','keys','some','compact','Contact','push','User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','fields','tag','then','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','ListId','true','select','where','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime'];(function(_0x5dd9d1,_0x52619f){var _0x4a773c=function(_0x5abd68){while(--_0x5abd68){_0x5dd9d1['push'](_0x5dd9d1['shift']());}};_0x4a773c(++_0x52619f);}(_0x4578,0x1f3));var _0x8457=function(_0x3231e8,_0x41df58){_0x3231e8=_0x3231e8-0x0;var _0x13a897=_0x4578[_0x3231e8];return _0x13a897;};'use strict';var _=require(_0x8457('0x0'));var squel=require('squel');var as=require(_0x8457('0x1'));var qs=require(_0x8457('0x2'));var utils=require(_0x8457('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x10357d,_0x47e2be){var _0x3dc3a8=![];if(_0x10357d['role']===_0x8457('0x4')&&!_0x47e2be['search']&&!_0x47e2be[_0x8457('0x5')]&&_0x47e2be['autocomplete']!==_0x8457('0x6')){_0x3dc3a8=!![];}return _0x3dc3a8;}function getContactsSubquery(){return squel[_0x8457('0x7')]()['from']('cm_contacts','c')[_0x8457('0x8')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0xd5896,_0x568a04){var _0x5e6c36=_0x568a04?'c':_0x8457('0x9');_0xd5896['left_join'](_0x8457('0xa'),'uc',_0x8457('0xb')+_0x5e6c36+_0x8457('0xc'))[_0x8457('0xd')](_0x8457('0xe'),'ct',_0x8457('0xf')+_0x5e6c36+_0x8457('0xc'))['left_join'](_0x8457('0x10'),'t',_0x8457('0x11'));return _0xd5896;}function addFieldsToQuery(_0x2d5ef0,_0x10a4ad,_0x2502d9,_0x135c4a,_0x447fea){var _0x1b1f6d=_0x447fea?'c':'subqry';if(!_0x10a4ad){_0x10a4ad=['id',_0x8457('0x12'),_0x8457('0x13'),_0x8457('0x14'),_0x8457('0x15'),_0x8457('0x16'),'email',_0x8457('0x5'),_0x8457('0x17'),_0x8457('0x18'),_0x8457('0x19'),_0x8457('0x1a'),_0x8457('0x1b')];}else if(!_0x10a4ad[_0x8457('0x1c')]('id')){_0x10a4ad['push']('id');}var _0x16f1c6=_0x2502d9&&_0x447fea||!_0x2502d9&&!_0x447fea;if(_0x135c4a){_0x16f1c6=_0x135c4a&&_0x447fea||!_0x135c4a&&!_0x447fea;}_0x10a4ad[_0x8457('0x1d')](function(_0x1b0feb){if(_0x1b0feb===_0x8457('0x1b')){if(_0x16f1c6){_0x2d5ef0[_0x8457('0x1e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1b0feb);}else if(_0x2502d9||_0x135c4a){_0x2d5ef0[_0x8457('0x1e')](_0x1b1f6d+'.'+_0x1b0feb);}}else{_0x2d5ef0['field'](_0x1b1f6d+'.'+_0x1b0feb);}});return _0x2d5ef0;}function getSqlClauses(){var _0x4d885d={'default':squel[_0x8457('0x1f')](),'fields':squel['expr'](),'filter':squel[_0x8457('0x1f')](),'tags':{'clause':squel[_0x8457('0x1f')](),'ids':null},'user':{'clause':squel[_0x8457('0x1f')](),'skip':![]}};return _0x4d885d;}function parseTagParameter(_0xdafe6f){var _0x4f4dcf=squel['expr']();if(_0xdafe6f){var _0x1fdd72=utils[_0x8457('0x20')](_0xdafe6f);_0x1fdd72[_0x8457('0x1d')](function(_0x2960da){_0x4f4dcf['or'](_0x8457('0x21'),'%,'+_0x2960da+',%');});}return _0x4f4dcf;}function parseSearchFilter(_0x52d809){var _0x1e0904=squel[_0x8457('0x1f')]();if(_0x52d809){var _0x3e47a8=_0x52d809[_0x8457('0x22')]('\x5c','\x5c\x5c')[_0x8457('0x22')](/'/g,'\x27\x27');var _0x3b08d1=qs[_0x8457('0x23')](_0x3e47a8);if(_0x3e47a8[_0x8457('0x24')]('\x20')[_0x8457('0x25')]>0x1){_0x1e0904['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8457('0x26')](_0x3e47a8,!![]),null);}else{if(qs['isNumeric'](_0x3e47a8)){_0x1e0904['or'](_0x8457('0x27'),_0x3b08d1+'%');_0x1e0904['or']('c.phone\x20LIKE\x20?',_0x3b08d1+'%');_0x1e0904['or'](_0x8457('0x28'),_0x3b08d1+'%');_0x1e0904['or']('c.fax\x20LIKE\x20?',_0x3b08d1+'%');}else if(qs[_0x8457('0x29')](_0x3e47a8)){_0x1e0904['or']('c.email\x20LIKE\x20?',_0x3b08d1+'%');}else{_0x1e0904['or'](_0x8457('0x2a'),'%'+_0x3b08d1+'%');_0x1e0904['or']('c.lastName\x20LIKE\x20?','%'+_0x3b08d1+'%');_0x1e0904['or'](_0x8457('0x2b'),'%'+_0x3b08d1+'%');}}}return _0x1e0904;}function parseAdvancedSearchFilter(_0x5d6a47,_0x119c27){var _0x3c1d3f=getSqlClauses();var _0x1125ae=as[_0x8457('0x2c')](_0x5d6a47);var _0x4663fc=_0x1125ae['sqlOperator'];for(var _0x76bc88=0x0;_0x76bc88<_0x1125ae[_0x8457('0x2d')][_0x8457('0x25')];_0x76bc88++){var _0x12481d=_0x1125ae[_0x8457('0x2d')][_0x76bc88];var _0x47fa8b='c';var _0x2b45ca=_[_0x8457('0x2e')](_0x119c27,[_0x8457('0x2f'),_0x12481d[_0x8457('0x1e')]]);if(_0x2b45ca){if(_0x12481d['field']===_0x8457('0x30')||_0x2b45ca[_0x8457('0x31')]===_0x8457('0x32')){_0x12481d[_0x8457('0x33')]='DATE';}var _0xcdf9a6=as[_0x8457('0x34')](_0x47fa8b,_0x2b45ca[_0x8457('0x35')],_0x12481d);_0x3c1d3f['default'][_0x4663fc](_0xcdf9a6[_0x8457('0x36')],_0xcdf9a6['value'][_0x8457('0x37')],_0xcdf9a6['value'][_0x8457('0x38')]);}else{if(_0x12481d[_0x8457('0x1e')]===_0x8457('0x39')){var _0xaefd0d=_0x12481d[_0x8457('0x3a')][_0x8457('0x24')](',')[_0x8457('0x3b')](function(_0x3cf3d5){return Number(_0x3cf3d5);});var _0x2d4c9d=parseTagParameter(_0xaefd0d);_0x3c1d3f['tags'][_0x8457('0x3c')][_0x8457('0x3d')](_0x2d4c9d);_0x3c1d3f['tags'][_0x8457('0x3e')]=_0xaefd0d;}else if(_0x12481d[_0x8457('0x1e')]==='User'){_0x3c1d3f['user'][_0x8457('0x3c')][_0x8457('0x3d')]('uc.UserId\x20=\x20?',_0x12481d[_0x8457('0x3a')]);_0x3c1d3f[_0x8457('0x3f')][_0x8457('0x40')]=!![];}}}return _0x3c1d3f;}function parseModelFields(_0xc9a2e3,_0x3d75cc){var _0x588102=squel['expr']();var _0x6cc823=_(_0xc9a2e3)[_0x8457('0x41')]()['map'](function(_0x204779){return _[_0x8457('0x42')](_0x3d75cc,[_0x8457('0x2f'),_0x204779])?_0x204779:undefined;})[_0x8457('0x43')]()[_0x8457('0x3a')]();if(_0xc9a2e3[_0x8457('0x44')]){_0x6cc823[_0x8457('0x45')]('Contact');}if(_0xc9a2e3[_0x8457('0x46')]){_0x6cc823['push'](_0x8457('0x46'));}if(_0x6cc823['length']>0x0){_0x6cc823[_0x8457('0x1d')](function(_0x45b8f1){if(_0x45b8f1===_0x8457('0x5')){_0x588102['and'](_0x8457('0x47'),[][_0x8457('0x48')](_0xc9a2e3[_0x45b8f1]));}else if(_0x45b8f1==='Contact'){var _0x28b6cb='%'+_0xc9a2e3[_0x45b8f1]+'%';_0x588102['and'](_0x8457('0x49'),_0x28b6cb);}else if(_0x45b8f1===_0x8457('0x46')){_0x588102[_0x8457('0x3d')]('uc.UserId\x20=\x20?',_0xc9a2e3[_0x45b8f1]);}else{_0x588102[_0x8457('0x3d')]('c.'+_0x45b8f1+_0x8457('0x4a'),_0xc9a2e3[_0x45b8f1]);}});}return _0x588102;}function parseQueryParameters(_0x22d78b,_0x113db2){var _0x435b77=getSqlClauses();return Promise[_0x8457('0x4b')]()['then'](function(){return parseModelFields(_0x22d78b,_0x113db2);})['then'](function(_0xfd0fa5){_0x435b77[_0x8457('0x4c')][_0x8457('0x3d')](_0xfd0fa5);return parseTagParameter(_0x22d78b[_0x8457('0x4d')]);})[_0x8457('0x4e')](function(_0x2eb950){_0x435b77['tags'][_0x8457('0x3c')][_0x8457('0x3d')](_0x2eb950);return parseSearchFilter(_0x22d78b['filter']);})[_0x8457('0x4e')](function(_0x4a1f3c){_0x435b77[_0x8457('0x4f')]=_0x4a1f3c;return _0x435b77;});}function checkListsRestrictions(_0x18fbb5,_0x195915,_0x3a0298){var _0x293fa6=squel['expr']();return Promise[_0x8457('0x4b')]()[_0x8457('0x4e')](function(){if(_0x195915[_0x8457('0x50')]&&_0x18fbb5['role']==='agent'&&!_0x3a0298){return _0x18fbb5[_0x8457('0x51')]({'attributes':['id'],'raw':!![]});}})[_0x8457('0x4e')](function(_0x333bb1){if(_0x333bb1){if(_0x333bb1['length']===0x0){_0x293fa6[_0x8457('0x3d')](_0x8457('0x52'));}else{_0x293fa6[_0x8457('0x3d')](_0x8457('0x47'),_[_0x8457('0x3b')](_0x333bb1,'id'));}}})['then'](function(){return _0x293fa6;});}function buildContactsQuery(_0x240935,_0x10091d,_0x46448a,_0x3c1108,_0x2587e4,_0x166a4d){if(_0x10091d){_0x10091d=_0x46448a[_0x8457('0x53')];}_0x240935=addFieldsToQuery(_0x240935,_0x10091d,_0x3c1108,_0x166a4d,!![]);var _0x54f67f=squel['select']();_0x54f67f=addFieldsToQuery(_0x54f67f,_0x10091d,_0x3c1108,_0x166a4d,![]);if(_0x3c1108||_0x166a4d){_0x240935=applyJoinClauses(_0x240935,!![]);_0x240935[_0x8457('0x54')](_0x8457('0x55'));if(_0x46448a['limit']){_0x54f67f['limit'](_0x46448a[_0x8457('0x56')]);}if(_0x46448a[_0x8457('0x57')]){_0x54f67f[_0x8457('0x57')](_0x46448a[_0x8457('0x57')]);}}else{_0x54f67f=applyJoinClauses(_0x54f67f,![]);_0x54f67f[_0x8457('0x54')](_0x8457('0x58'));if(_0x46448a[_0x8457('0x56')]){_0x240935[_0x8457('0x56')](_0x46448a['limit']);}if(_0x46448a[_0x8457('0x57')]){_0x240935['offset'](_0x46448a['offset']);}}_0x54f67f[_0x8457('0x59')](_0x2587e4);if(_0x46448a[_0x8457('0x5a')]){_0x46448a['order'][_0x8457('0x1d')](function(_0x2b5f45){_0x240935[_0x8457('0x5a')]('c.'+_0x2b5f45[0x0],_0x2b5f45[0x1]===_0x8457('0x5b')?![]:!![]);_0x54f67f['order'](_0x8457('0x5c')+_0x2b5f45[0x0],_0x2b5f45[0x1]==='DESC'?![]:!![]);});}_0x54f67f[_0x8457('0x5d')](_0x240935,_0x8457('0x9'));return _0x54f67f;}function getFilteredContacts(_0x11cb5e){var _0x53b83c=[];return db[_0x8457('0x39')][_0x8457('0x5e')]({'attributes':['id',_0x8457('0x2f'),_0x8457('0x5f')],'raw':!![]})[_0x8457('0x4e')](function(_0xe7a7b1){_0x53b83c=_[_0x8457('0x60')](_0xe7a7b1,'id');var _0xfa3813={'type':db[_0x8457('0x61')][_0x8457('0x62')][_0x8457('0x63')],'model':db[_0x8457('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x8457('0x65')][_0x8457('0x66')](_0x11cb5e[_0x8457('0x67')](),_0xfa3813);})[_0x8457('0x4e')](function(_0x438d84){_0x438d84[_0x8457('0x1d')](function(_0x2a7c34){if(_0x2a7c34[_0x8457('0x1b')]){_0x2a7c34[_0x8457('0x68')]=[];_0x2a7c34['TagIds'][_0x8457('0x24')](',')[_0x8457('0x1d')](function(_0x23a074){_0x2a7c34[_0x8457('0x68')][_0x8457('0x45')](_0x53b83c[_0x23a074]);});}delete _0x2a7c34['TagIds'];});return _0x438d84;});}function countFilteredContacts(_0x4a6bd1,_0x255d71){var _0x226f77=_0x4a6bd1[_0x8457('0x69')]();_0x226f77['field'](_0x8457('0x6a'));_0x226f77=applyJoinClauses(_0x226f77,!![]);_0x4a6bd1[_0x8457('0x54')]('c.id');var _0x1628aa=utils['getSelectedTags'](_0x255d71);if(!_[_0x8457('0x6b')](_0x1628aa)){_0x226f77[_0x8457('0x8')](_0x8457('0x6c'),_0x1628aa);}var _0x14dfdb={'type':db['Sequelize'][_0x8457('0x62')][_0x8457('0x63')],'raw':!![]};return db[_0x8457('0x65')][_0x8457('0x66')](_0x226f77[_0x8457('0x67')](),_0x14dfdb)[_0x8457('0x4e')](function(_0x2767c5){return _0x2767c5[0x0][_0x8457('0x6a')];});}module[_0x8457('0x6d')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xd783=['order','subqry.','DESC','from','Tag','QueryTypes','SELECT','CmContact','sequelize','query','Tags','getSelectedTags','isEmpty','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','cm_contacts','where','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','TagIds','includes','push','forEach','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','dateOfBirth','fieldType','buildExpression','type','default','start','value','end','split','clause','tags','ids','and','uc.UserId\x20=\x20?','user','skip','keys','map','some','name','compact','Contact','User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IS\x20NULL','c.id','limit','offset','group','subqry.id','having'];(function(_0x213364,_0x1c96b6){var _0x46b6d5=function(_0x14e023){while(--_0x14e023){_0x213364['push'](_0x213364['shift']());}};_0x46b6d5(++_0x1c96b6);}(_0xd783,0x1ab));var _0x3d78=function(_0x118c30,_0x7eb1eb){_0x118c30=_0x118c30-0x0;var _0x569999=_0xd783[_0x118c30];return _0x569999;};'use strict';var _=require(_0x3d78('0x0'));var squel=require(_0x3d78('0x1'));var as=require(_0x3d78('0x2'));var qs=require('../parsers/qs');var utils=require(_0x3d78('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x3ffb63,_0x1e517){var _0x20b150=![];if(_0x3ffb63[_0x3d78('0x4')]===_0x3d78('0x5')&&!_0x1e517[_0x3d78('0x6')]&&!_0x1e517[_0x3d78('0x7')]&&_0x1e517[_0x3d78('0x8')]!==_0x3d78('0x9')){_0x20b150=!![];}return _0x20b150;}function getContactsSubquery(){return squel[_0x3d78('0xa')]()['from'](_0x3d78('0xb'),'c')[_0x3d78('0xc')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x10a461,_0x1a412d){var _0x5e1492=_0x1a412d?'c':_0x3d78('0xd');_0x10a461[_0x3d78('0xe')]('cm_user_has_contacts','uc',_0x3d78('0xf')+_0x5e1492+_0x3d78('0x10'))['left_join'](_0x3d78('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x5e1492+'.id')[_0x3d78('0xe')]('tools_tags','t',_0x3d78('0x12'));return _0x10a461;}function addFieldsToQuery(_0x17d979,_0x18970c,_0x524dfa,_0x3b2509,_0xb2de98){var _0x3e0da0=_0xb2de98?'c':_0x3d78('0xd');if(!_0x18970c){_0x18970c=['id',_0x3d78('0x13'),_0x3d78('0x14'),_0x3d78('0x15'),_0x3d78('0x16'),_0x3d78('0x17'),_0x3d78('0x18'),_0x3d78('0x7'),_0x3d78('0x19'),_0x3d78('0x1a'),_0x3d78('0x1b'),'deletedAt',_0x3d78('0x1c')];}else if(!_0x18970c[_0x3d78('0x1d')]('id')){_0x18970c[_0x3d78('0x1e')]('id');}var _0x272107=_0x524dfa&&_0xb2de98||!_0x524dfa&&!_0xb2de98;if(_0x3b2509){_0x272107=_0x3b2509&&_0xb2de98||!_0x3b2509&&!_0xb2de98;}_0x18970c[_0x3d78('0x1f')](function(_0xa9068e){if(_0xa9068e===_0x3d78('0x1c')){if(_0x272107){_0x17d979['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa9068e);}else if(_0x524dfa||_0x3b2509){_0x17d979['field'](_0x3e0da0+'.'+_0xa9068e);}}else{_0x17d979[_0x3d78('0x20')](_0x3e0da0+'.'+_0xa9068e);}});return _0x17d979;}function getSqlClauses(){var _0x234a4a={'default':squel[_0x3d78('0x21')](),'fields':squel[_0x3d78('0x21')](),'filter':squel[_0x3d78('0x21')](),'tags':{'clause':squel[_0x3d78('0x21')](),'ids':null},'user':{'clause':squel[_0x3d78('0x21')](),'skip':![]}};return _0x234a4a;}function parseTagParameter(_0x550e4a){var _0x1359ff=squel['expr']();if(_0x550e4a){var _0x438a2b=utils['getSelectedTags'](_0x550e4a);_0x438a2b['forEach'](function(_0x3e762b){_0x1359ff['or'](_0x3d78('0x22'),'%,'+_0x3e762b+',%');});}return _0x1359ff;}function parseSearchFilter(_0x415d26){var _0x512cca=squel[_0x3d78('0x21')]();if(_0x415d26){var _0x20fd02=_0x415d26[_0x3d78('0x23')]('\x5c','\x5c\x5c')[_0x3d78('0x23')](/'/g,'\x27\x27');var _0x57c4dc=qs[_0x3d78('0x24')](_0x20fd02);if(_0x20fd02['split']('\x20')[_0x3d78('0x25')]>0x1){_0x512cca['or'](_0x3d78('0x26'),qs[_0x3d78('0x27')](_0x20fd02,!![]),null);}else{if(qs[_0x3d78('0x28')](_0x20fd02)){_0x512cca['or']('c.id\x20LIKE\x20?',_0x57c4dc+'%');_0x512cca['or'](_0x3d78('0x29'),_0x57c4dc+'%');_0x512cca['or']('c.mobile\x20LIKE\x20?',_0x57c4dc+'%');_0x512cca['or'](_0x3d78('0x2a'),_0x57c4dc+'%');}else if(qs[_0x3d78('0x2b')](_0x20fd02)){_0x512cca['or'](_0x3d78('0x2c'),_0x57c4dc+'%');}else{_0x512cca['or'](_0x3d78('0x2d'),'%'+_0x57c4dc+'%');_0x512cca['or']('c.lastName\x20LIKE\x20?','%'+_0x57c4dc+'%');_0x512cca['or'](_0x3d78('0x2c'),'%'+_0x57c4dc+'%');}}}return _0x512cca;}function parseAdvancedSearchFilter(_0x444908,_0x39d97b){var _0x41bee9=getSqlClauses();var _0xee9a3e=as[_0x3d78('0x2e')](_0x444908);var _0x557ead=_0xee9a3e[_0x3d78('0x2f')];for(var _0x382574=0x0;_0x382574<_0xee9a3e[_0x3d78('0x30')][_0x3d78('0x25')];_0x382574++){var _0x54507f=_0xee9a3e[_0x3d78('0x30')][_0x382574];var _0x12d004='c';var _0x18ce1e=_['find'](_0x39d97b,['name',_0x54507f[_0x3d78('0x20')]]);if(_0x18ce1e){if(_0x54507f[_0x3d78('0x20')]===_0x3d78('0x31')||_0x18ce1e[_0x3d78('0x32')]==='datetime'){_0x54507f['castTo']='DATE';}var _0x485c51=as[_0x3d78('0x33')](_0x12d004,_0x18ce1e[_0x3d78('0x34')],_0x54507f);_0x41bee9[_0x3d78('0x35')][_0x557ead](_0x485c51['text'],_0x485c51['value'][_0x3d78('0x36')],_0x485c51[_0x3d78('0x37')][_0x3d78('0x38')]);}else{if(_0x54507f[_0x3d78('0x20')]==='Tag'){var _0x489d89=_0x54507f['value'][_0x3d78('0x39')](',')['map'](function(_0x2b6450){return Number(_0x2b6450);});var _0x28cd44=parseTagParameter(_0x489d89);_0x41bee9['tags'][_0x3d78('0x3a')]['and'](_0x28cd44);_0x41bee9[_0x3d78('0x3b')][_0x3d78('0x3c')]=_0x489d89;}else if(_0x54507f['field']==='User'){_0x41bee9['user'][_0x3d78('0x3a')][_0x3d78('0x3d')](_0x3d78('0x3e'),_0x54507f['value']);_0x41bee9[_0x3d78('0x3f')][_0x3d78('0x40')]=!![];}}}return _0x41bee9;}function parseModelFields(_0x4f85f8,_0x4b5029){var _0x2792ef=squel[_0x3d78('0x21')]();var _0x588f9b=_(_0x4f85f8)[_0x3d78('0x41')]()[_0x3d78('0x42')](function(_0x36b9d4){return _[_0x3d78('0x43')](_0x4b5029,[_0x3d78('0x44'),_0x36b9d4])?_0x36b9d4:undefined;})[_0x3d78('0x45')]()[_0x3d78('0x37')]();if(_0x4f85f8['Contact']){_0x588f9b[_0x3d78('0x1e')](_0x3d78('0x46'));}if(_0x4f85f8[_0x3d78('0x47')]){_0x588f9b['push'](_0x3d78('0x47'));}if(_0x588f9b[_0x3d78('0x25')]>0x0){_0x588f9b[_0x3d78('0x1f')](function(_0x2ec24b){if(_0x2ec24b===_0x3d78('0x7')){_0x2792ef[_0x3d78('0x3d')](_0x3d78('0x48'),[][_0x3d78('0x49')](_0x4f85f8[_0x2ec24b]));}else if(_0x2ec24b===_0x3d78('0x46')){var _0x1f8e10='%'+_0x4f85f8[_0x2ec24b]+'%';_0x2792ef[_0x3d78('0x3d')](_0x3d78('0x4a'),_0x1f8e10);}else if(_0x2ec24b===_0x3d78('0x47')){_0x2792ef[_0x3d78('0x3d')]('uc.UserId\x20=\x20?',_0x4f85f8[_0x2ec24b]);}else{_0x2792ef[_0x3d78('0x3d')]('c.'+_0x2ec24b+_0x3d78('0x4b'),_0x4f85f8[_0x2ec24b]);}});}return _0x2792ef;}function parseQueryParameters(_0x4f3d26,_0x531a3c){var _0x5fb7a8=getSqlClauses();return Promise[_0x3d78('0x4c')]()[_0x3d78('0x4d')](function(){return parseModelFields(_0x4f3d26,_0x531a3c);})[_0x3d78('0x4d')](function(_0x14a91d){_0x5fb7a8[_0x3d78('0x4e')][_0x3d78('0x3d')](_0x14a91d);return parseTagParameter(_0x4f3d26['tag']);})[_0x3d78('0x4d')](function(_0x52a67b){_0x5fb7a8['tags'][_0x3d78('0x3a')][_0x3d78('0x3d')](_0x52a67b);return parseSearchFilter(_0x4f3d26[_0x3d78('0x4f')]);})[_0x3d78('0x4d')](function(_0x3a7376){_0x5fb7a8[_0x3d78('0x4f')]=_0x3a7376;return _0x5fb7a8;});}function checkListsRestrictions(_0x26fc54,_0x34f912,_0x1f0221){var _0x3c58f3=squel['expr']();return Promise[_0x3d78('0x4c')]()[_0x3d78('0x4d')](function(){if(_0x34f912[_0x3d78('0x6')]&&_0x26fc54['role']==='agent'&&!_0x1f0221){return _0x26fc54[_0x3d78('0x50')]({'attributes':['id'],'raw':!![]});}})[_0x3d78('0x4d')](function(_0x516aeb){if(_0x516aeb){if(_0x516aeb[_0x3d78('0x25')]===0x0){_0x3c58f3[_0x3d78('0x3d')](_0x3d78('0x51'));}else{_0x3c58f3[_0x3d78('0x3d')](_0x3d78('0x48'),_[_0x3d78('0x42')](_0x516aeb,'id'));}}})[_0x3d78('0x4d')](function(){return _0x3c58f3;});}function buildContactsQuery(_0x18e25a,_0x31f9c0,_0x291cfe,_0x475b10,_0x47407d,_0xffb5ef){if(_0x31f9c0){_0x31f9c0=_0x291cfe['attributes'];}_0x18e25a=addFieldsToQuery(_0x18e25a,_0x31f9c0,_0x475b10,_0xffb5ef,!![]);var _0x147a03=squel['select']();_0x147a03=addFieldsToQuery(_0x147a03,_0x31f9c0,_0x475b10,_0xffb5ef,![]);if(_0x475b10||_0xffb5ef){_0x18e25a=applyJoinClauses(_0x18e25a,!![]);_0x18e25a['group'](_0x3d78('0x52'));if(_0x291cfe['limit']){_0x147a03[_0x3d78('0x53')](_0x291cfe[_0x3d78('0x53')]);}if(_0x291cfe[_0x3d78('0x54')]){_0x147a03[_0x3d78('0x54')](_0x291cfe[_0x3d78('0x54')]);}}else{_0x147a03=applyJoinClauses(_0x147a03,![]);_0x147a03[_0x3d78('0x55')](_0x3d78('0x56'));if(_0x291cfe[_0x3d78('0x53')]){_0x18e25a['limit'](_0x291cfe['limit']);}if(_0x291cfe[_0x3d78('0x54')]){_0x18e25a[_0x3d78('0x54')](_0x291cfe[_0x3d78('0x54')]);}}_0x147a03[_0x3d78('0x57')](_0x47407d);if(_0x291cfe[_0x3d78('0x58')]){_0x291cfe[_0x3d78('0x58')]['forEach'](function(_0x32a4d9){_0x18e25a[_0x3d78('0x58')]('c.'+_0x32a4d9[0x0],_0x32a4d9[0x1]==='DESC'?![]:!![]);_0x147a03[_0x3d78('0x58')](_0x3d78('0x59')+_0x32a4d9[0x0],_0x32a4d9[0x1]===_0x3d78('0x5a')?![]:!![]);});}_0x147a03[_0x3d78('0x5b')](_0x18e25a,_0x3d78('0xd'));return _0x147a03;}function getFilteredContacts(_0xc4752b){var _0x331142=[];return db[_0x3d78('0x5c')]['findAll']({'attributes':['id',_0x3d78('0x44'),'color'],'raw':!![]})[_0x3d78('0x4d')](function(_0x4b9d21){_0x331142=_['keyBy'](_0x4b9d21,'id');var _0x448452={'type':db['Sequelize'][_0x3d78('0x5d')][_0x3d78('0x5e')],'model':db[_0x3d78('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x3d78('0x60')][_0x3d78('0x61')](_0xc4752b['toString'](),_0x448452);})[_0x3d78('0x4d')](function(_0x4c9d13){_0x4c9d13['forEach'](function(_0x101a6a){if(_0x101a6a[_0x3d78('0x1c')]){_0x101a6a[_0x3d78('0x62')]=[];_0x101a6a['TagIds'][_0x3d78('0x39')](',')['forEach'](function(_0x10d89a){_0x101a6a[_0x3d78('0x62')][_0x3d78('0x1e')](_0x331142[_0x10d89a]);});}delete _0x101a6a['TagIds'];});return _0x4c9d13;});}function countFilteredContacts(_0xc03874,_0x34abbe){var _0x5770e4=_0xc03874['clone']();_0x5770e4[_0x3d78('0x20')]('COUNT(*)');_0x5770e4=applyJoinClauses(_0x5770e4,!![]);_0xc03874['group'](_0x3d78('0x52'));var _0x257aa6=utils[_0x3d78('0x63')](_0x34abbe);if(!_[_0x3d78('0x64')](_0x257aa6)){_0x5770e4['where']('t.id\x20IN\x20?',_0x257aa6);}var _0x2ec337={'type':db[_0x3d78('0x65')]['QueryTypes'][_0x3d78('0x5e')],'raw':!![]};return db['sequelize'][_0x3d78('0x61')](_0x5770e4['toString'](),_0x2ec337)[_0x3d78('0x4d')](function(_0x373160){return _0x373160[0x0]['COUNT(*)'];});}module[_0x3d78('0x66')]={'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 e48f27b..eee3eb5 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 _0x40e8=['encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','write','end','final','binary','close','decryptFile','data','unlink','secret','utf8','base64','decryptString','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192'];(function(_0x4f712f,_0x595559){var _0x238bce=function(_0x3b3f22){while(--_0x3b3f22){_0x4f712f['push'](_0x4f712f['shift']());}};_0x238bce(++_0x595559);}(_0x40e8,0x183));var _0x840e=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x40e8[_0x879e31];return _0x3467e8;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x840e('0x0'));var _=require(_0x840e('0x1'));var config=require(_0x840e('0x2'));var logger=require(_0x840e('0x3'))(_0x840e('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x840e('0x5')][_0x840e('0x6')],'algorithm':_0x840e('0x7')};const fileOptions={'algorithm':_0x840e('0x8')};if(config['encrypt']&&config[_0x840e('0x9')][_0x840e('0xa')]){var isSupported=isAlgorithmSupported(config[_0x840e('0x9')]['algorithm']);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x840e('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x840e('0xb')](',\x20');logger[_0x840e('0xc')](config[_0x840e('0x9')][_0x840e('0xa')],_0x840e('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x58b7f1){return AES_SUPPORTED_RX[_0x840e('0xe')](_0x58b7f1);}function getSupportedCiphers(){return crypto[_0x840e('0xf')]()[_0x840e('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x168493){return getSupportedCiphers()[_0x840e('0x11')](_0x168493)>-0x1;}function combineOptions(_0x373b26){var _0x2c3393={};for(var _0x192cb6 in fileOptions){if(fileOptions['hasOwnProperty'](_0x192cb6)){_0x2c3393[_0x192cb6]=fileOptions[_0x192cb6];}}if(_0x373b26){for(var _0x4ced7b in _0x373b26){if(_0x373b26[_0x840e('0x12')](_0x4ced7b)){_0x2c3393[_0x4ced7b]=_0x373b26[_0x4ced7b];}}}return _0x2c3393;}exports[_0x840e('0x13')]=function(_0xbe8fa5,_0x2209a8,_0x429033,_0x29bde9){return new BPromise(function(_0x2b9286,_0x53eb86){_0x29bde9=combineOptions(_0x29bde9);var _0x4a9586=new Buffer(_0x429033);var _0x2ea09b=fs[_0x840e('0x14')](_0xbe8fa5);var _0x2b8da1=fs[_0x840e('0x15')](_0x2209a8);var _0x463626=crypto[_0x840e('0x16')](_0x29bde9[_0x840e('0xa')],_0x4a9586);_0x2ea09b['on']('data',function(_0x3265c8){var _0x48b034=new Buffer(_0x463626[_0x840e('0x17')](_0x3265c8),'binary');_0x2b8da1[_0x840e('0x18')](_0x48b034);});_0x2ea09b['on'](_0x840e('0x19'),function(){try{var _0x373a65=new Buffer(_0x463626[_0x840e('0x1a')](_0x840e('0x1b')),_0x840e('0x1b'));_0x2b8da1[_0x840e('0x18')](_0x373a65);_0x2b8da1['end']();_0x2b8da1['on'](_0x840e('0x1c'),function(){return _0x2b9286(_0x2209a8);});}catch(_0x50394c){fs['unlink'](_0x2209a8);return _0x53eb86(_0x50394c);}});});};exports[_0x840e('0x1d')]=function(_0x156e63,_0x5aa0b8,_0x4a16a4,_0xa4a4cf){return new BPromise(function(_0xbae24e,_0x2754fa){_0xa4a4cf=combineOptions(_0xa4a4cf);var _0x4effab=new Buffer(_0x4a16a4);var _0x4bfbe0=fs['createReadStream'](_0x156e63);var _0x243023=fs[_0x840e('0x15')](_0x5aa0b8);var _0x2c0fb6=crypto['createDecipher'](_0xa4a4cf['algorithm'],_0x4effab);_0x4bfbe0['on'](_0x840e('0x1e'),function(_0x219dec){var _0x5e62c1=new Buffer(_0x2c0fb6[_0x840e('0x17')](_0x219dec),_0x840e('0x1b'));_0x243023['write'](_0x5e62c1);});_0x4bfbe0['on'](_0x840e('0x19'),function(){try{var _0x2ad549=new Buffer(_0x2c0fb6[_0x840e('0x1a')](_0x840e('0x1b')),_0x840e('0x1b'));_0x243023['write'](_0x2ad549);_0x243023[_0x840e('0x19')]();_0x243023['on'](_0x840e('0x1c'),function(){return _0xbae24e(_0x5aa0b8);});}catch(_0x25dcff){fs[_0x840e('0x1f')](_0x5aa0b8);return _0x2754fa(_0x25dcff);}});});};exports['encryptString']=function(_0x4cf7a7,_0x5906d6,_0xd51799){var _0x497bd9=_0xd51799||stringOptions[_0x840e('0xa')];var _0x5c2811=_0x5906d6||stringOptions[_0x840e('0x20')];var _0x28444a=crypto[_0x840e('0x16')](_0x497bd9,_0x5c2811);var _0x5c8b20=_0x28444a[_0x840e('0x17')](_0x4cf7a7,_0x840e('0x21'),_0x840e('0x22'));_0x5c8b20+=_0x28444a['final'](_0x840e('0x22'));return _0x5c8b20;};exports[_0x840e('0x23')]=function(_0x3965aa,_0x1c8e8e,_0xfaac97){var _0x12a8f9=_0xfaac97||stringOptions[_0x840e('0xa')];var _0xadc6ab=_0x1c8e8e||stringOptions[_0x840e('0x20')];var _0x1de639=crypto['createDecipher'](_0x12a8f9,_0xadc6ab);var _0x3dff86=_0x1de639[_0x840e('0x17')](_0x3965aa,'base64',_0x840e('0x21'));_0x3dff86+=_0x1de639[_0x840e('0x1a')](_0x840e('0x21'));return _0x3dff86;}; \ No newline at end of file +var _0xc032=['secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','encryptFile','createWriteStream','createCipher','data','update','binary','end','final','write','close','decryptFile','createReadStream','createDecipher','unlink','encryptString'];(function(_0x714224,_0x77eeae){var _0x334a45=function(_0x549be0){while(--_0x549be0){_0x714224['push'](_0x714224['shift']());}};_0x334a45(++_0x77eeae);}(_0xc032,0x8c));var _0x2c03=function(_0x1f96f5,_0x101fa4){_0x1f96f5=_0x1f96f5-0x0;var _0x3617c9=_0xc032[_0x1f96f5];return _0x3617c9;};'use strict';var crypto=require(_0x2c03('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x2c03('0x1'));var config=require(_0x2c03('0x2'));var logger=require(_0x2c03('0x3'))(_0x2c03('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2c03('0x5')][_0x2c03('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x2c03('0x7')]&&config[_0x2c03('0x7')][_0x2c03('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x2c03('0x8')]);if(isSupported){fileOptions[_0x2c03('0x8')]=config[_0x2c03('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2c03('0x9')](',\x20');logger[_0x2c03('0xa')](config[_0x2c03('0x7')][_0x2c03('0x8')],_0x2c03('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x31e566){return AES_SUPPORTED_RX[_0x2c03('0xc')](_0x31e566);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x2c03('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x185ffe){return getSupportedCiphers()[_0x2c03('0xe')](_0x185ffe)>-0x1;}function combineOptions(_0x429fdd){var _0x2af388={};for(var _0x759380 in fileOptions){if(fileOptions['hasOwnProperty'](_0x759380)){_0x2af388[_0x759380]=fileOptions[_0x759380];}}if(_0x429fdd){for(var _0x7da538 in _0x429fdd){if(_0x429fdd['hasOwnProperty'](_0x7da538)){_0x2af388[_0x7da538]=_0x429fdd[_0x7da538];}}}return _0x2af388;}exports[_0x2c03('0xf')]=function(_0x684405,_0x5b28c2,_0x1451da,_0x5acdda){return new BPromise(function(_0x1ab7b1,_0x506aca){_0x5acdda=combineOptions(_0x5acdda);var _0x53f066=new Buffer(_0x1451da);var _0x42c7ba=fs['createReadStream'](_0x684405);var _0x16dfe8=fs[_0x2c03('0x10')](_0x5b28c2);var _0x55f740=crypto[_0x2c03('0x11')](_0x5acdda[_0x2c03('0x8')],_0x53f066);_0x42c7ba['on'](_0x2c03('0x12'),function(_0x590266){var _0xab37dd=new Buffer(_0x55f740[_0x2c03('0x13')](_0x590266),_0x2c03('0x14'));_0x16dfe8['write'](_0xab37dd);});_0x42c7ba['on'](_0x2c03('0x15'),function(){try{var _0x125508=new Buffer(_0x55f740[_0x2c03('0x16')](_0x2c03('0x14')),_0x2c03('0x14'));_0x16dfe8[_0x2c03('0x17')](_0x125508);_0x16dfe8['end']();_0x16dfe8['on'](_0x2c03('0x18'),function(){return _0x1ab7b1(_0x5b28c2);});}catch(_0x1e2d97){fs['unlink'](_0x5b28c2);return _0x506aca(_0x1e2d97);}});});};exports[_0x2c03('0x19')]=function(_0x4f3d7f,_0x22a4e5,_0xe9c3cc,_0x4557c2){return new BPromise(function(_0x3c9b87,_0x4352fe){_0x4557c2=combineOptions(_0x4557c2);var _0x12937d=new Buffer(_0xe9c3cc);var _0x26b98e=fs[_0x2c03('0x1a')](_0x4f3d7f);var _0x2ed182=fs[_0x2c03('0x10')](_0x22a4e5);var _0x4fdb8a=crypto[_0x2c03('0x1b')](_0x4557c2[_0x2c03('0x8')],_0x12937d);_0x26b98e['on'](_0x2c03('0x12'),function(_0x3000a8){var _0x1298f5=new Buffer(_0x4fdb8a['update'](_0x3000a8),_0x2c03('0x14'));_0x2ed182[_0x2c03('0x17')](_0x1298f5);});_0x26b98e['on'](_0x2c03('0x15'),function(){try{var _0x346613=new Buffer(_0x4fdb8a[_0x2c03('0x16')]('binary'),'binary');_0x2ed182[_0x2c03('0x17')](_0x346613);_0x2ed182[_0x2c03('0x15')]();_0x2ed182['on'](_0x2c03('0x18'),function(){return _0x3c9b87(_0x22a4e5);});}catch(_0x1acf62){fs[_0x2c03('0x1c')](_0x22a4e5);return _0x4352fe(_0x1acf62);}});});};exports[_0x2c03('0x1d')]=function(_0x5289a2,_0x3300d5,_0x500014){var _0x5bdeb6=_0x500014||stringOptions[_0x2c03('0x8')];var _0x5ed62e=_0x3300d5||stringOptions[_0x2c03('0x1e')];var _0x5bc603=crypto[_0x2c03('0x11')](_0x5bdeb6,_0x5ed62e);var _0xbec1c9=_0x5bc603['update'](_0x5289a2,_0x2c03('0x1f'),'base64');_0xbec1c9+=_0x5bc603['final'](_0x2c03('0x20'));return _0xbec1c9;};exports[_0x2c03('0x21')]=function(_0x4ef501,_0x1d2e32,_0x9a7a81){var _0x33b54d=_0x9a7a81||stringOptions['algorithm'];var _0x93407e=_0x1d2e32||stringOptions[_0x2c03('0x1e')];var _0x5c3fdb=crypto[_0x2c03('0x1b')](_0x33b54d,_0x93407e);var _0x5d112d=_0x5c3fdb[_0x2c03('0x13')](_0x4ef501,_0x2c03('0x20'),'utf8');_0x5d112d+=_0x5c3fdb[_0x2c03('0x16')]('utf8');return _0x5d112d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 21fa07a..54bb773 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 _0xac7d=['SELECT','dirname','basename','.csv','length','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','isInteger','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x3503e5,_0x490a96){var _0x2059fa=function(_0x6e735f){while(--_0x6e735f){_0x3503e5['push'](_0x3503e5['shift']());}};_0x2059fa(++_0x490a96);}(_0xac7d,0x6f));var _0xdac7=function(_0x2e73e5,_0x2ef23b){_0x2e73e5=_0x2e73e5-0x0;var _0x104540=_0xac7d[_0x2e73e5];return _0x104540;};'use strict';var util=require('util');var path=require(_0xdac7('0x0'));var _=require('lodash');var csv=require(_0xdac7('0x1'));var fs=require('fs');var BPromise=require(_0xdac7('0x2'));var zipdir=require(_0xdac7('0x3'));var rimraf=require('rimraf');var db=require(_0xdac7('0x4'))['db'];var dbH=require(_0xdac7('0x4'))[_0xdac7('0x5')];var logger=require('../../config/logger')(_0xdac7('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xdac7('0x7')][0x3];var PATH=process[_0xdac7('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e40ce,_0x2d2c87){var _0x38b581={'status':_0x2e40ce};var _0x243ba9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d2c87){_0x38b581[_0xdac7('0x8')]=_0x2d2c87;}return db[_0xdac7('0x9')][_0xdac7('0xa')](_0x38b581,_0x243ba9);}function main(){var _0x3b2961=0x1388;var _0x5e23d0;logger[_0xdac7('0xb')](util['format'](_0xdac7('0xc'),EXTRACTED_REPORT_ID,_0xdac7('0xd')));return db[_0xdac7('0xe')][_0xdac7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdac7('0x10'),'splitSizeCsv']})[_0xdac7('0x11')](function(_0x1e80db){if(_0x1e80db){_0x5e23d0=_0x1e80db;_0x3b2961=_0x5e23d0[_0xdac7('0x12')]||0x1388;}})[_0xdac7('0x11')](function(){return dbH[_0xdac7('0x13')][_0xdac7('0x14')](util[_0xdac7('0x15')](_0xdac7('0x16'),QUERY),{'type':dbH[_0xdac7('0x13')][_0xdac7('0x17')]['SELECT']});})[_0xdac7('0x11')](function(_0x3edf5f){if(!_0x3edf5f[0x0]['num']){return analyticExtractedReport(_0xdac7('0x18'));}var _0x3ce6fc=[];var _0x1194d4=0x0;if(_0x5e23d0[_0xdac7('0x10')]){if(_0x3edf5f&&_0x3edf5f['length']){var _0x34f6b2=_['range'](_0x3edf5f[0x0]['num']/_0x3b2961);var _0x29db15=Number[_0xdac7('0x19')](_0x3edf5f[0x0][_0xdac7('0x1a')]/_0x3b2961)?_0x3edf5f[0x0][_0xdac7('0x1a')]%_0x3b2961:0x0;_0x34f6b2[_0xdac7('0x1b')](function(_0x583bc5){if(_0x583bc5>0x0){_0x1194d4+=_0x3b2961;}_0x3ce6fc[_0xdac7('0x1c')](dbH['sequelize'][_0xdac7('0x14')](util[_0xdac7('0x15')](_0xdac7('0x1d'),QUERY,_0x3b2961,_0x1194d4),{'type':dbH[_0xdac7('0x13')]['QueryTypes'][_0xdac7('0x1e')]}));});if(_0x29db15>0x0){_0x1194d4+=_0x3b2961;_0x3ce6fc[_0xdac7('0x1c')](dbH['sequelize']['query'](util[_0xdac7('0x15')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x29db15,_0x1194d4),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x3ce6fc[_0xdac7('0x1c')](dbH[_0xdac7('0x13')][_0xdac7('0x14')](QUERY,{'type':dbH[_0xdac7('0x13')]['QueryTypes'][_0xdac7('0x1e')]}));}var _0x20e532=path[_0xdac7('0x1f')](PATH);var _0x139a92=path[_0xdac7('0x20')](PATH,_0xdac7('0x21'));var _0x4a3ed5=_0x5e23d0[_0xdac7('0x10')]&&_0x3ce6fc[_0xdac7('0x22')]>0x1;var _0x13a8e=[];if(!fs[_0xdac7('0x23')](path['join'](_0x20e532,_0x139a92))&&_0x4a3ed5){fs[_0xdac7('0x24')](path['join'](_0x20e532,_0x139a92));}return BPromise['each'](_0x3ce6fc,function(_0x483355){_0x13a8e['push'](_0x483355);})['then'](function(){for(var _0x3dd863=0x0;_0x3dd863<_0x13a8e[_0xdac7('0x22')];_0x3dd863+=0x1){var _0x11fc28;var _0x5152fd=_0x13a8e[_0x3dd863];if(_0x4a3ed5){_0x11fc28=path[_0xdac7('0x25')](_0x20e532,_0x139a92,util[_0xdac7('0x15')](_0xdac7('0x26'),_0x139a92,_0x3dd863,_0xdac7('0x27')));}else{_0x11fc28=path[_0xdac7('0x25')](_0x20e532,util[_0xdac7('0x15')](_0xdac7('0x28'),_0x139a92,_0xdac7('0x27')));}fs['writeFileSync'](_0x11fc28,csv(_0x5152fd));}})[_0xdac7('0x11')](function(){if(_0x4a3ed5){return new Promise(function(_0xf1a047){zipdir(path[_0xdac7('0x25')](_0x20e532,_0x139a92),{'saveTo':path[_0xdac7('0x25')](_0x20e532,util[_0xdac7('0x15')]('%s.%s',_0x139a92,_0xdac7('0x29')))},function(_0x5c8126,_0x58b855){rimraf(path[_0xdac7('0x25')](_0x20e532,_0x139a92),function(){});_0xf1a047('zip\x20finished');});});}})[_0xdac7('0x11')](function(){logger[_0xdac7('0xb')](util[_0xdac7('0x15')](_0xdac7('0x2a'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x4a3ed5?util[_0xdac7('0x15')]('%s.%s',_0x139a92,_0x4a3ed5?_0xdac7('0x29'):_0xdac7('0x27')):null);});})[_0xdac7('0x2b')](function(_0x461923){logger[_0xdac7('0xb')](util[_0xdac7('0x15')](_0xdac7('0x2c'),EXTRACTED_REPORT_ID,_0xdac7('0xd')),util[_0xdac7('0x2d')](_0x461923,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdac7('0x2e'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6341=['bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','then','num','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','join','each','csv','%s.%s','zip','zip\x20finished','Completed','catch','inspect','Failed','finally','exit','util','path','to-csv'];(function(_0x4ae1f9,_0x234135){var _0xa72f18=function(_0x33c0dd){while(--_0x33c0dd){_0x4ae1f9['push'](_0x4ae1f9['shift']());}};_0xa72f18(++_0x234135);}(_0x6341,0x165));var _0x1634=function(_0x131d66,_0x3345c9){_0x131d66=_0x131d66-0x0;var _0x3771d7=_0x6341[_0x131d66];return _0x3771d7;};'use strict';var util=require(_0x1634('0x0'));var path=require(_0x1634('0x1'));var _=require('lodash');var csv=require(_0x1634('0x2'));var fs=require('fs');var BPromise=require(_0x1634('0x3'));var zipdir=require(_0x1634('0x4'));var rimraf=require(_0x1634('0x5'));var db=require(_0x1634('0x6'))['db'];var dbH=require(_0x1634('0x6'))[_0x1634('0x7')];var logger=require(_0x1634('0x8'))(_0x1634('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1634('0xa')][0x3];var PATH=process[_0x1634('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xf9f10f,_0x23c24d){var _0x4372a5={'status':_0xf9f10f};var _0xdf9b8f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x23c24d){_0x4372a5[_0x1634('0xb')]=_0x23c24d;}return db['AnalyticExtractedReport'][_0x1634('0xc')](_0x4372a5,_0xdf9b8f);}function main(){var _0x564ebe=0x1388;var _0x5f0f31;logger[_0x1634('0xd')](util['format'](_0x1634('0xe'),EXTRACTED_REPORT_ID,_0x1634('0xf')));return db[_0x1634('0x10')][_0x1634('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1634('0x12')]})['then'](function(_0x1477a2){if(_0x1477a2){_0x5f0f31=_0x1477a2;_0x564ebe=_0x5f0f31[_0x1634('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x1634('0x13')](util[_0x1634('0x14')](_0x1634('0x15'),QUERY),{'type':dbH[_0x1634('0x16')][_0x1634('0x17')][_0x1634('0x18')]});})[_0x1634('0x19')](function(_0x2cd92d){if(!_0x2cd92d[0x0][_0x1634('0x1a')]){return analyticExtractedReport('Empty');}var _0x21b350=[];var _0x1435f2=0x0;if(_0x5f0f31['split']){if(_0x2cd92d&&_0x2cd92d[_0x1634('0x1b')]){var _0x3ea66c=_['range'](_0x2cd92d[0x0]['num']/_0x564ebe);var _0x157a19=Number[_0x1634('0x1c')](_0x2cd92d[0x0][_0x1634('0x1a')]/_0x564ebe)?_0x2cd92d[0x0][_0x1634('0x1a')]%_0x564ebe:0x0;_0x3ea66c['forEach'](function(_0x5c0f4f){if(_0x5c0f4f>0x0){_0x1435f2+=_0x564ebe;}_0x21b350[_0x1634('0x1d')](dbH[_0x1634('0x16')]['query'](util[_0x1634('0x14')](_0x1634('0x1e'),QUERY,_0x564ebe,_0x1435f2),{'type':dbH['sequelize'][_0x1634('0x17')][_0x1634('0x18')]}));});if(_0x157a19>0x0){_0x1435f2+=_0x564ebe;_0x21b350[_0x1634('0x1d')](dbH[_0x1634('0x16')][_0x1634('0x13')](util[_0x1634('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x157a19,_0x1435f2),{'type':dbH[_0x1634('0x16')][_0x1634('0x17')][_0x1634('0x18')]}));}}}else{_0x21b350['push'](dbH['sequelize'][_0x1634('0x13')](QUERY,{'type':dbH[_0x1634('0x16')][_0x1634('0x17')][_0x1634('0x18')]}));}var _0x379f0b=path['dirname'](PATH);var _0xe818c4=path[_0x1634('0x1f')](PATH,_0x1634('0x20'));var _0x36fa08=_0x5f0f31['split']&&_0x21b350[_0x1634('0x1b')]>0x1;var _0x32a1a4=[];if(!fs['existsSync'](path[_0x1634('0x21')](_0x379f0b,_0xe818c4))&&_0x36fa08){fs['mkdirSync'](path[_0x1634('0x21')](_0x379f0b,_0xe818c4));}return BPromise[_0x1634('0x22')](_0x21b350,function(_0x1aa26e){_0x32a1a4[_0x1634('0x1d')](_0x1aa26e);})[_0x1634('0x19')](function(){for(var _0x3d1db8=0x0;_0x3d1db8<_0x32a1a4['length'];_0x3d1db8+=0x1){var _0x3df66c;var _0x1e38a4=_0x32a1a4[_0x3d1db8];if(_0x36fa08){_0x3df66c=path['join'](_0x379f0b,_0xe818c4,util['format']('%s%d.%s',_0xe818c4,_0x3d1db8,_0x1634('0x23')));}else{_0x3df66c=path['join'](_0x379f0b,util[_0x1634('0x14')](_0x1634('0x24'),_0xe818c4,_0x1634('0x23')));}fs['writeFileSync'](_0x3df66c,csv(_0x1e38a4));}})[_0x1634('0x19')](function(){if(_0x36fa08){return new Promise(function(_0x9e0b82){zipdir(path[_0x1634('0x21')](_0x379f0b,_0xe818c4),{'saveTo':path['join'](_0x379f0b,util[_0x1634('0x14')](_0x1634('0x24'),_0xe818c4,_0x1634('0x25')))},function(_0x370fb1,_0x4d51f0){rimraf(path[_0x1634('0x21')](_0x379f0b,_0xe818c4),function(){});_0x9e0b82(_0x1634('0x26'));});});}})[_0x1634('0x19')](function(){logger[_0x1634('0xd')](util[_0x1634('0x14')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x1634('0x27'),_0x36fa08?util[_0x1634('0x14')](_0x1634('0x24'),_0xe818c4,_0x36fa08?'zip':_0x1634('0x23')):null);});})[_0x1634('0x28')](function(_0x5ebe3f){logger[_0x1634('0xd')](util[_0x1634('0x14')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1634('0xf')),util[_0x1634('0x29')](_0x5ebe3f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1634('0x2a'));})[_0x1634('0x2b')](function(){process[_0x1634('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6a7f37b..d1200de 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 _0x792d=['Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','query','basename','.pdf','mkdirSync','join','flatten','pdf','all','%s.%s','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','/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','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','before','margin','landscape','\x20/\x20','footer'];(function(_0x2c7eb4,_0x37591e){var _0xe2dedc=function(_0x2ccac0){while(--_0x2ccac0){_0x2c7eb4['push'](_0x2c7eb4['shift']());}};_0xe2dedc(++_0x37591e);}(_0x792d,0x141));var _0xd792=function(_0x218733,_0x5e1bf1){_0x218733=_0x218733-0x0;var _0x3c80fa=_0x792d[_0x218733];return _0x3c80fa;};'use strict';var _=require(_0xd792('0x0'));var fs=require('fs');var util=require(_0xd792('0x1'));var path=require(_0xd792('0x2'));var moment=require(_0xd792('0x3'));var htmlToPdfmake=require(_0xd792('0x4'));var PdfPrinter=require(_0xd792('0x5'));var zipdir=require(_0xd792('0x6'));var rimraf=require(_0xd792('0x7'));var JSDOM=require(_0xd792('0x8'))[_0xd792('0x9')];var window=new JSDOM('')['window'];var BPromise=require(_0xd792('0xa'));var db=require(_0xd792('0xb'))['db'];var dbH=require(_0xd792('0xb'))[_0xd792('0xc')];var logger=require(_0xd792('0xd'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd792('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd792('0xe')][0x4];var NAME=process[_0xd792('0xe')][0x5];var FORMAT=_0xd792('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x236456,_0x1b2579){var _0x59e4f7={'status':_0x236456};var _0x3bc46d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b2579){_0x59e4f7[_0xd792('0x10')]=_0x1b2579;}return db[_0xd792('0x11')][_0xd792('0x12')](_0x59e4f7,_0x3bc46d);}function getHeaders(_0x36376f){return _[_0xd792('0x13')](_0x36376f,function(_0xff7f63){return{'text':_0xff7f63,'style':_0xd792('0x14')};});}function getRows(_0x4a7b6c,_0x4d9f79){return _['map'](_0x4d9f79,function(_0x2e022e){return _(_0x2e022e)[_0xd792('0x15')](_0x4a7b6c)[_0xd792('0x13')](function(_0x503968){return _0x503968?_[_0xd792('0x16')](_0x503968):'';})[_0xd792('0x17')]();});}function createTable(_0x15a290,_0x467cc1){var _0x3419f0={'widths':_[_0xd792('0x18')](Array(_0x15a290[_0xd792('0x19')]),0x91),'heights':function(_0x1f562b){return _0x1f562b===0x0?_0xd792('0x1a'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1a3d5c=getHeaders(_0x15a290);_0x3419f0[_0xd792('0x1b')][_0xd792('0x1c')](_0x1a3d5c);var _0x1993fa=getRows(_0x15a290,_0x467cc1);_0x3419f0[_0xd792('0x1b')]=_0x3419f0[_0xd792('0x1b')][_0xd792('0x1d')](_0x1993fa);return _0x3419f0;}function createTables(_0x5b3fb4){var _0x1141d3=[];var _0x45ad6e=_[_0xd792('0x1e')](Object[_0xd792('0x1f')](_0x5b3fb4[0x0]),0x5);_0x45ad6e[_0xd792('0x20')](function(_0x443ba2){_0x1141d3[_0xd792('0x1c')](createTable(_0x443ba2,_0x5b3fb4));});return _0x1141d3;}function getPDFDocDefinition(_0x492e8c){var _0x3b133c=util[_0xd792('0x21')](_0xd792('0x22'),NAME,EXTRACTED_REPORT[_0xd792('0x23')],moment(EXTRACTED_REPORT[_0xd792('0x24')])[_0xd792('0x21')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xd792('0x21')](FORMAT));var _0x53d80a=[];for(var _0x29b060=0x0;_0x29b060<_0x492e8c[_0xd792('0x19')];_0x29b060++){var _0x371f20=[];if(_0x29b060===0x0){_0x371f20[_0xd792('0x1c')]({'text':_0x3b133c,'style':_0xd792('0x25')});}var _0x2c0ade={'table':_0x492e8c[_0x29b060]};if(_0x29b060>0x0){_0x2c0ade['pageBreak']=_0xd792('0x26');_0x2c0ade[_0xd792('0x27')]=[0x0,0x46,0x0,0x0];}_0x371f20['push'](_0x2c0ade);_0x53d80a[_0xd792('0x1c')](_0x371f20);}return{'pageSize':'A4','pageOrientation':_0xd792('0x28'),'content':_0x53d80a,'footer':function(_0x244b3a,_0x545ea8){return{'text':_0x244b3a[_0xd792('0x16')]()+_0xd792('0x29')+_0x545ea8,'style':_0xd792('0x2a')};},'defaultStyle':{'font':_0xd792('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd792('0x2c')},'footer':{'alignment':_0xd792('0x2d'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x27f44c){var _0x4585b1=0x1388;var _0x52d4cf;if(!_0x27f44c[0x0][_0xd792('0x2e')]){return analyticExtractedReport(_0xd792('0x2f'));}return db[_0xd792('0x30')][_0xd792('0x31')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd792('0x32'),_0xd792('0x33')]})[_0xd792('0x34')](function(_0x5e41f8){if(_0x5e41f8){_0x52d4cf=_0x5e41f8;_0x4585b1=_0x52d4cf[_0xd792('0x33')]||0x3e8;}})[_0xd792('0x34')](function(){var _0x40bdca=[];var _0x3055f0=0x0;if(_0x52d4cf['split']){if(_0x27f44c&&_0x27f44c[_0xd792('0x19')]){var _0x288fde=_['range'](_0x27f44c[0x0]['num']/_0x4585b1);var _0x4d396a=Number['isInteger'](_0x27f44c[0x0][_0xd792('0x2e')]/_0x4585b1)?_0x27f44c[0x0][_0xd792('0x2e')]%_0x4585b1:0x0;_0x288fde['forEach'](function(_0x26a2e1){if(_0x26a2e1>0x0){_0x3055f0+=_0x4585b1;}_0x40bdca[_0xd792('0x1c')](dbH[_0xd792('0x35')]['query'](util[_0xd792('0x21')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4585b1,_0x3055f0),{'type':dbH[_0xd792('0x35')][_0xd792('0x36')][_0xd792('0x37')]}));});if(_0x4d396a>0x0){_0x3055f0+=_0x4585b1;_0x40bdca[_0xd792('0x1c')](dbH[_0xd792('0x35')]['query'](util[_0xd792('0x21')](_0xd792('0x38'),QUERY,_0x4d396a,_0x3055f0),{'type':dbH['sequelize'][_0xd792('0x36')][_0xd792('0x37')]}));}}}else{_0x40bdca[_0xd792('0x1c')](dbH[_0xd792('0x35')][_0xd792('0x39')](QUERY,{'type':dbH[_0xd792('0x35')]['QueryTypes'][_0xd792('0x37')]}));}var _0x4b4a9e=path['dirname'](PATH);var _0x1b9fb8=path[_0xd792('0x3a')](PATH,_0xd792('0x3b'));var _0xd7fb8d=_0x52d4cf[_0xd792('0x32')]&&_0x40bdca[_0xd792('0x19')]>0x1;var _0x52e857=[];if(!fs['existsSync'](path['join'](_0x4b4a9e,_0x1b9fb8))&&_0xd7fb8d){fs[_0xd792('0x3c')](path[_0xd792('0x3d')](_0x4b4a9e,_0x1b9fb8));}return BPromise['each'](_0x40bdca,function(_0x41e3d6){_0x52e857['push'](_0x41e3d6);})[_0xd792('0x34')](function(){var _0x124f8a=[];for(var _0x2344ab=0x0;_0x2344ab<_0x52e857[_0xd792('0x19')];_0x2344ab+=0x1){var _0x2ff013=_0x52e857[_0x2344ab];var _0x1d5925=createTables(_[_0xd792('0x3e')](_0x2ff013));var _0x4a2b9d;var _0x4986d7=getPDFDocDefinition(_0x1d5925);var _0x22f8d7=getPDFPrinter();var _0x41e01c=_0x22f8d7['createPdfKitDocument'](_0x4986d7);if(_0xd7fb8d){_0x4a2b9d=path[_0xd792('0x3d')](_0x4b4a9e,_0x1b9fb8,util[_0xd792('0x21')]('%s%d.%s',_0x1b9fb8,_0x2344ab,_0xd792('0x3f')));}else{_0x4a2b9d=path['join'](_0x4b4a9e,util[_0xd792('0x21')]('%s.%s',_0x1b9fb8,'pdf'));}_0x124f8a[_0xd792('0x1c')](writePDFDocument(_0x41e01c,_0x4a2b9d));}return Promise[_0xd792('0x40')](_0x124f8a);})[_0xd792('0x34')](function(){if(_0xd7fb8d){return new Promise(function(_0x186dbb){zipdir(path['join'](_0x4b4a9e,_0x1b9fb8),{'saveTo':path[_0xd792('0x3d')](_0x4b4a9e,util[_0xd792('0x21')](_0xd792('0x41'),_0x1b9fb8,_0xd792('0x42')))},function(){rimraf(path['join'](_0x4b4a9e,_0x1b9fb8),function(){});_0x186dbb(_0xd792('0x43'));});});}})[_0xd792('0x34')](function(){if(!_0xd7fb8d)return;rimraf(path[_0xd792('0x3d')](_0x4b4a9e,_0x1b9fb8),function(){});})['then'](function(){logger[_0xd792('0x44')](util[_0xd792('0x21')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd792('0x45')));return analyticExtractedReport(_0xd792('0x46'),_0xd7fb8d?util[_0xd792('0x21')]('%s.%s',_0x1b9fb8,_0xd7fb8d?_0xd792('0x42'):_0xd792('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xd792('0x21')](_0xd792('0x47'),EXTRACTED_REPORT_ID,_0xd792('0x45')));return db[_0xd792('0x11')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd792('0x34')](function(_0x4b5a5a){EXTRACTED_REPORT=_0x4b5a5a;return dbH[_0xd792('0x35')][_0xd792('0x39')](util[_0xd792('0x21')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd792('0x35')]['QueryTypes'][_0xd792('0x37')]});})[_0xd792('0x34')](extractReport)[_0xd792('0x48')](function(_0x273a3d){logger[_0xd792('0x44')](util[_0xd792('0x21')](_0xd792('0x49'),EXTRACTED_REPORT_ID,_0xd792('0x45')),util['inspect'](_0x273a3d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd792('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x57f407=new PdfPrinter({'Arial':{'normal':__dirname+_0xd792('0x4b'),'bold':__dirname+_0xd792('0x4c'),'italics':__dirname+_0xd792('0x4d'),'bolditalics':__dirname+_0xd792('0x4e')}});return _0x57f407;}function getPDFDocDefinitionFromHTML(_0x5010fc,_0x13b02f){var _0x3091d4=util[_0xd792('0x21')]('%s\x20#%d',_0x13b02f[_0xd792('0x4f')],_0x13b02f[_0xd792('0x50')]);var _0xe50f53=moment()[_0xd792('0x21')](_0xd792('0x51'))[_0xd792('0x16')]();var _0x448f84=htmlToPdfmake(_0x5010fc,{'window':window,'tableAutoSize':!![]});return{'content':[_0x448f84],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd792('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd792('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd792('0x52')}},'header':function(){return[{'text':_0xd792('0x53'),'style':_0xd792('0x25')}];},'footer':function(_0x560519,_0x1eeef0){return[{'text':util[_0xd792('0x21')](_0xd792('0x54'),_0x3091d4,_0x560519,_0x1eeef0,_0xe50f53),'style':_0xd792('0x2a')}];}};}function writePDFDocument(_0x4ac9b1,_0x171c2e){return new Promise(function(_0x1a9e47,_0x37c4da){var _0x2a8aa9=_0x4ac9b1['pipe'](fs[_0xd792('0x55')](_0x171c2e));_0x2a8aa9['on'](_0xd792('0x56'),function(){_0x1a9e47(_0xd792('0x56'));});_0x2a8aa9['on'](_0xd792('0x57'),function(_0x2b6241){_0x37c4da(_0x2b6241);});_0x4ac9b1[_0xd792('0x58')]();});}exports[_0xd792('0x59')]=function(_0x3e6955,_0x2e8261){var _0x167ff7=getPDFPrinter();var _0x2f49c7=getPDFDocDefinitionFromHTML(_0x3e6955,_0x2e8261);var _0x3d083d=_0x167ff7[_0xd792('0x5a')](_0x2f49c7);return writePDFDocument(_0x3d083d,_0x2e8261[_0xd792('0x2')])[_0xd792('0x48')](function(_0x5091ec){throw _0x5091ec;});}; \ No newline at end of file +var _0x70b4=['footer','Arial','black','num','Empty','Setting','split','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','join','mkdirSync','each','%s%d.%s','pdf','%s.%s','all','zip','Completed','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','finish','error','end','createPdfFromHTML','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','toString','value','length','auto','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','landscape','\x20/\x20'];(function(_0xff9f49,_0x47dec4){var _0x59793d=function(_0x48197e){while(--_0x48197e){_0xff9f49['push'](_0xff9f49['shift']());}};_0x59793d(++_0x47dec4);}(_0x70b4,0x125));var _0x470b=function(_0x2f516f,_0x10197){_0x2f516f=_0x2f516f-0x0;var _0x5a57f1=_0x70b4[_0x2f516f];return _0x5a57f1;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x470b('0x0'));var path=require(_0x470b('0x1'));var moment=require(_0x470b('0x2'));var htmlToPdfmake=require(_0x470b('0x3'));var PdfPrinter=require(_0x470b('0x4'));var zipdir=require(_0x470b('0x5'));var rimraf=require(_0x470b('0x6'));var JSDOM=require('jsdom')[_0x470b('0x7')];var window=new JSDOM('')[_0x470b('0x8')];var BPromise=require('bluebird');var db=require(_0x470b('0x9'))['db'];var dbH=require('../../mysqldb')[_0x470b('0xa')];var logger=require(_0x470b('0xb'))(_0x470b('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x470b('0xd')][0x2]);var QUERY=process[_0x470b('0xd')][0x3];var PATH=process[_0x470b('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4953ae,_0x56e6b5){var _0xcc186c={'status':_0x4953ae};var _0x142150={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x56e6b5){_0xcc186c[_0x470b('0xe')]=_0x56e6b5;}return db[_0x470b('0xf')][_0x470b('0x10')](_0xcc186c,_0x142150);}function getHeaders(_0x19665d){return _['map'](_0x19665d,function(_0x9c0a0c){return{'text':_0x9c0a0c,'style':'tableHeader'};});}function getRows(_0x6ee049,_0x4c2ea5){return _['map'](_0x4c2ea5,function(_0xc7f5e2){return _(_0xc7f5e2)['pick'](_0x6ee049)[_0x470b('0x11')](function(_0xe9e573){return _0xe9e573?_[_0x470b('0x12')](_0xe9e573):'';})[_0x470b('0x13')]();});}function createTable(_0x3577f6,_0x735fbe){var _0x21d8c4={'widths':_['fill'](Array(_0x3577f6[_0x470b('0x14')]),0x91),'heights':function(_0x3bc64c){return _0x3bc64c===0x0?_0x470b('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5d8086=getHeaders(_0x3577f6);_0x21d8c4[_0x470b('0x16')][_0x470b('0x17')](_0x5d8086);var _0x493c5a=getRows(_0x3577f6,_0x735fbe);_0x21d8c4[_0x470b('0x16')]=_0x21d8c4[_0x470b('0x16')]['concat'](_0x493c5a);return _0x21d8c4;}function createTables(_0x2fe175){var _0x55cbb3=[];var _0xc1090c=_[_0x470b('0x18')](Object['keys'](_0x2fe175[0x0]),0x5);_0xc1090c[_0x470b('0x19')](function(_0x438eed){_0x55cbb3[_0x470b('0x17')](createTable(_0x438eed,_0x2fe175));});return _0x55cbb3;}function getPDFDocDefinition(_0x5f3c7c){var _0x36a414=util[_0x470b('0x1a')](_0x470b('0x1b'),NAME,EXTRACTED_REPORT[_0x470b('0x1c')],moment(EXTRACTED_REPORT[_0x470b('0x1d')])[_0x470b('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x470b('0x1a')](FORMAT));var _0x3c08f1=[];for(var _0xc9408c=0x0;_0xc9408c<_0x5f3c7c[_0x470b('0x14')];_0xc9408c++){var _0xa562f8=[];if(_0xc9408c===0x0){_0xa562f8[_0x470b('0x17')]({'text':_0x36a414,'style':_0x470b('0x1e')});}var _0x4f1ef0={'table':_0x5f3c7c[_0xc9408c]};if(_0xc9408c>0x0){_0x4f1ef0[_0x470b('0x1f')]=_0x470b('0x20');_0x4f1ef0['margin']=[0x0,0x46,0x0,0x0];}_0xa562f8[_0x470b('0x17')](_0x4f1ef0);_0x3c08f1[_0x470b('0x17')](_0xa562f8);}return{'pageSize':'A4','pageOrientation':_0x470b('0x21'),'content':_0x3c08f1,'footer':function(_0x164f4f,_0x158df8){return{'text':_0x164f4f[_0x470b('0x12')]()+_0x470b('0x22')+_0x158df8,'style':_0x470b('0x23')};},'defaultStyle':{'font':_0x470b('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x470b('0x25')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x11f49f){var _0x5c5913=0x1388;var _0x5aea96;if(!_0x11f49f[0x0][_0x470b('0x26')]){return analyticExtractedReport(_0x470b('0x27'));}return db[_0x470b('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x470b('0x29'),'splitSizePdf']})[_0x470b('0x2a')](function(_0x5d8ab5){if(_0x5d8ab5){_0x5aea96=_0x5d8ab5;_0x5c5913=_0x5aea96['splitSizePdf']||0x3e8;}})['then'](function(){var _0x5ec3d0=[];var _0x43ba16=0x0;if(_0x5aea96[_0x470b('0x29')]){if(_0x11f49f&&_0x11f49f[_0x470b('0x14')]){var _0x1183bd=_[_0x470b('0x2b')](_0x11f49f[0x0][_0x470b('0x26')]/_0x5c5913);var _0x588d51=Number[_0x470b('0x2c')](_0x11f49f[0x0][_0x470b('0x26')]/_0x5c5913)?_0x11f49f[0x0][_0x470b('0x26')]%_0x5c5913:0x0;_0x1183bd[_0x470b('0x19')](function(_0x5bd9b4){if(_0x5bd9b4>0x0){_0x43ba16+=_0x5c5913;}_0x5ec3d0[_0x470b('0x17')](dbH[_0x470b('0x2d')][_0x470b('0x2e')](util[_0x470b('0x1a')](_0x470b('0x2f'),QUERY,_0x5c5913,_0x43ba16),{'type':dbH[_0x470b('0x2d')][_0x470b('0x30')][_0x470b('0x31')]}));});if(_0x588d51>0x0){_0x43ba16+=_0x5c5913;_0x5ec3d0[_0x470b('0x17')](dbH[_0x470b('0x2d')][_0x470b('0x2e')](util['format'](_0x470b('0x2f'),QUERY,_0x588d51,_0x43ba16),{'type':dbH[_0x470b('0x2d')][_0x470b('0x30')][_0x470b('0x31')]}));}}}else{_0x5ec3d0[_0x470b('0x17')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x470b('0x2d')][_0x470b('0x30')][_0x470b('0x31')]}));}var _0x3ac59e=path[_0x470b('0x32')](PATH);var _0x271e52=path['basename'](PATH,_0x470b('0x33'));var _0x47cec2=_0x5aea96[_0x470b('0x29')]&&_0x5ec3d0[_0x470b('0x14')]>0x1;var _0x461ecd=[];if(!fs['existsSync'](path[_0x470b('0x34')](_0x3ac59e,_0x271e52))&&_0x47cec2){fs[_0x470b('0x35')](path[_0x470b('0x34')](_0x3ac59e,_0x271e52));}return BPromise[_0x470b('0x36')](_0x5ec3d0,function(_0x4be1e0){_0x461ecd[_0x470b('0x17')](_0x4be1e0);})[_0x470b('0x2a')](function(){var _0xc6365d=[];for(var _0x5f403b=0x0;_0x5f403b<_0x461ecd[_0x470b('0x14')];_0x5f403b+=0x1){var _0x5acd13=_0x461ecd[_0x5f403b];var _0x46798d=createTables(_['flatten'](_0x5acd13));var _0x4c8fcc;var _0xffefa5=getPDFDocDefinition(_0x46798d);var _0x544574=getPDFPrinter();var _0x2b726e=_0x544574['createPdfKitDocument'](_0xffefa5);if(_0x47cec2){_0x4c8fcc=path[_0x470b('0x34')](_0x3ac59e,_0x271e52,util[_0x470b('0x1a')](_0x470b('0x37'),_0x271e52,_0x5f403b,_0x470b('0x38')));}else{_0x4c8fcc=path[_0x470b('0x34')](_0x3ac59e,util[_0x470b('0x1a')](_0x470b('0x39'),_0x271e52,_0x470b('0x38')));}_0xc6365d[_0x470b('0x17')](writePDFDocument(_0x2b726e,_0x4c8fcc));}return Promise[_0x470b('0x3a')](_0xc6365d);})['then'](function(){if(_0x47cec2){return new Promise(function(_0x4ca902){zipdir(path[_0x470b('0x34')](_0x3ac59e,_0x271e52),{'saveTo':path[_0x470b('0x34')](_0x3ac59e,util[_0x470b('0x1a')](_0x470b('0x39'),_0x271e52,_0x470b('0x3b')))},function(){rimraf(path['join'](_0x3ac59e,_0x271e52),function(){});_0x4ca902('zip\x20finished');});});}})[_0x470b('0x2a')](function(){if(!_0x47cec2)return;rimraf(path[_0x470b('0x34')](_0x3ac59e,_0x271e52),function(){});})[_0x470b('0x2a')](function(){logger['info'](util[_0x470b('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x470b('0x3c'),_0x47cec2?util['format'](_0x470b('0x39'),_0x271e52,_0x47cec2?_0x470b('0x3b'):_0x470b('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x470b('0x1a')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x470b('0x3d')));return db[_0x470b('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x470b('0x2a')](function(_0x341ce2){EXTRACTED_REPORT=_0x341ce2;return dbH[_0x470b('0x2d')][_0x470b('0x2e')](util[_0x470b('0x1a')](_0x470b('0x3e'),QUERY),{'type':dbH[_0x470b('0x2d')][_0x470b('0x30')][_0x470b('0x31')]});})[_0x470b('0x2a')](extractReport)[_0x470b('0x3f')](function(_0x552b02){logger[_0x470b('0x40')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x470b('0x3d')),util['inspect'](_0x552b02,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x470b('0x41'));})[_0x470b('0x42')](function(){process[_0x470b('0x43')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3189c7=new PdfPrinter({'Arial':{'normal':__dirname+_0x470b('0x44'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x470b('0x45'),'bolditalics':__dirname+_0x470b('0x46')}});return _0x3189c7;}function getPDFDocDefinitionFromHTML(_0x3b1bc2,_0x33bcad){var _0x528275=util[_0x470b('0x1a')](_0x470b('0x47'),_0x33bcad[_0x470b('0x48')],_0x33bcad[_0x470b('0x49')]);var _0x15a13c=moment()['format'](_0x470b('0x4a'))[_0x470b('0x12')]();var _0x52fc53=htmlToPdfmake(_0x3b1bc2,{'window':window,'tableAutoSize':!![]});return{'content':[_0x52fc53],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x470b('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x470b('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x470b('0x4b')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x470b('0x1e')}];},'footer':function(_0x377917,_0x20c0ed){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x528275,_0x377917,_0x20c0ed,_0x15a13c),'style':_0x470b('0x23')}];}};}function writePDFDocument(_0x20a0d4,_0x4ae607){return new Promise(function(_0x273cf9,_0x592a4f){var _0x19c9e3=_0x20a0d4[_0x470b('0x4c')](fs[_0x470b('0x4d')](_0x4ae607));_0x19c9e3['on']('finish',function(){_0x273cf9(_0x470b('0x4e'));});_0x19c9e3['on'](_0x470b('0x4f'),function(_0x3a5840){_0x592a4f(_0x3a5840);});_0x20a0d4[_0x470b('0x50')]();});}exports[_0x470b('0x51')]=function(_0x40e645,_0x475e95){var _0x220d3f=getPDFPrinter();var _0x33cb38=getPDFDocDefinitionFromHTML(_0x40e645,_0x475e95);var _0x23c35c=_0x220d3f['createPdfKitDocument'](_0x33cb38);return writePDFDocument(_0x23c35c,_0x475e95[_0x470b('0x1')])['catch'](function(_0x5a6134){throw _0x5a6134;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index fa6b9fa..5580dd6 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 _0xe423=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','mkdirSync','%s%d.%s','xlsx','writeFileSync','binary','zip\x20finished','Completed','inspect','exit','util','path','lodash','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','then','splitSizeXlsx','sequelize','query'];(function(_0x1d949f,_0x3a914e){var _0x50a59e=function(_0x10ccfb){while(--_0x10ccfb){_0x1d949f['push'](_0x1d949f['shift']());}};_0x50a59e(++_0x3a914e);}(_0xe423,0xf4));var _0x3e42=function(_0x1ba05a,_0x3460fd){_0x1ba05a=_0x1ba05a-0x0;var _0x5b9908=_0xe423[_0x1ba05a];return _0x5b9908;};'use strict';var util=require(_0x3e42('0x0'));var path=require(_0x3e42('0x1'));var _=require(_0x3e42('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x3e42('0x3'));var db=require(_0x3e42('0x4'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x3e42('0x5'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3e42('0x6')][0x3];var PATH=process[_0x3e42('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1d848a,_0x111edf){var _0x5e1d96={'status':_0x1d848a};var _0x48cd63={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x111edf){_0x5e1d96[_0x3e42('0x7')]=_0x111edf;}return db[_0x3e42('0x8')][_0x3e42('0x9')](_0x5e1d96,_0x48cd63);}function main(){var _0x1dca1e=0x1388;var _0x53a1ad;logger[_0x3e42('0xa')](util[_0x3e42('0xb')](_0x3e42('0xc'),EXTRACTED_REPORT_ID,_0x3e42('0xd')));return db['Setting'][_0x3e42('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3e42('0xf'),'splitSizeXlsx']})[_0x3e42('0x10')](function(_0x36e3c6){if(_0x36e3c6){_0x53a1ad=_0x36e3c6;_0x1dca1e=_0x53a1ad[_0x3e42('0x11')]||0x1388;}})[_0x3e42('0x10')](function(){return dbH[_0x3e42('0x12')][_0x3e42('0x13')](util[_0x3e42('0xb')](_0x3e42('0x14'),QUERY),{'type':dbH[_0x3e42('0x12')][_0x3e42('0x15')][_0x3e42('0x16')]});})['then'](function(_0x39cc83){if(!_0x39cc83[0x0]['num']){return analyticExtractedReport(_0x3e42('0x17'));}var _0x91c3cf=[];var _0x475c28=0x0;if(_0x53a1ad[_0x3e42('0xf')]){if(_0x39cc83&&_0x39cc83[_0x3e42('0x18')]){var _0x45ef97=_[_0x3e42('0x19')](_0x39cc83[0x0][_0x3e42('0x1a')]/_0x1dca1e);var _0x108f87=Number[_0x3e42('0x1b')](_0x39cc83[0x0][_0x3e42('0x1a')]/_0x1dca1e)?_0x39cc83[0x0][_0x3e42('0x1a')]%_0x1dca1e:0x0;_0x45ef97[_0x3e42('0x1c')](function(_0xdbeb7d){if(_0xdbeb7d>0x0){_0x475c28+=_0x1dca1e;}_0x91c3cf['push'](dbH[_0x3e42('0x12')][_0x3e42('0x13')](util['format'](_0x3e42('0x1d'),QUERY,_0x1dca1e,_0x475c28),{'type':dbH['sequelize'][_0x3e42('0x15')]['SELECT']}));});if(_0x108f87>0x0){_0x475c28+=_0x1dca1e;_0x91c3cf[_0x3e42('0x1e')](dbH[_0x3e42('0x12')][_0x3e42('0x13')](util[_0x3e42('0xb')](_0x3e42('0x1d'),QUERY,_0x108f87,_0x475c28),{'type':dbH[_0x3e42('0x12')][_0x3e42('0x15')]['SELECT']}));}}}else{_0x91c3cf['push'](dbH['sequelize'][_0x3e42('0x13')](QUERY,{'type':dbH['sequelize'][_0x3e42('0x15')][_0x3e42('0x16')]}));}var _0x12b6a5=path[_0x3e42('0x1f')](PATH);var _0x120012=path[_0x3e42('0x20')](PATH,_0x3e42('0x21'));var _0x4cdc10=_0x53a1ad['split']&&_0x91c3cf[_0x3e42('0x18')]>0x1;var _0xbb709a=[];if(!fs['existsSync'](path[_0x3e42('0x22')](_0x12b6a5,_0x120012))&&_0x4cdc10){fs[_0x3e42('0x23')](path[_0x3e42('0x22')](_0x12b6a5,_0x120012));}return BPromise['each'](_0x91c3cf,function(_0x3e5a7f){_0xbb709a[_0x3e42('0x1e')](_0x3e5a7f);})[_0x3e42('0x10')](function(){for(var _0x243a76=0x0;_0x243a76<_0xbb709a[_0x3e42('0x18')];_0x243a76+=0x1){var _0x2e951b;var _0x522128=_0xbb709a[_0x243a76];if(_0x4cdc10){_0x2e951b=path[_0x3e42('0x22')](_0x12b6a5,_0x120012,util['format'](_0x3e42('0x24'),_0x120012,_0x243a76,_0x3e42('0x25')));}else{_0x2e951b=path[_0x3e42('0x22')](_0x12b6a5,util[_0x3e42('0xb')]('%s.%s',_0x120012,'xlsx'));}fs[_0x3e42('0x26')](_0x2e951b,json2xls(_0x522128),_0x3e42('0x27'));}})['then'](function(){if(_0x4cdc10){return new Promise(function(_0x415ca8){zipdir(path['join'](_0x12b6a5,_0x120012),{'saveTo':path['join'](_0x12b6a5,util['format']('%s.%s',_0x120012,'zip'))},function(_0x3a2046,_0x2fe2b8){rimraf(path[_0x3e42('0x22')](_0x12b6a5,_0x120012),function(){});_0x415ca8(_0x3e42('0x28'));});});}})[_0x3e42('0x10')](function(){logger[_0x3e42('0xa')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3e42('0xd')));return analyticExtractedReport(_0x3e42('0x29'),_0x4cdc10?util[_0x3e42('0xb')]('%s.%s',_0x120012,_0x4cdc10?'zip':_0x3e42('0x25')):null);});})['catch'](function(_0x2e5f55){logger[_0x3e42('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3e42('0xd')),util[_0x3e42('0x2a')](_0x2e5f55,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x3e42('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2d75=['splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','path','lodash','json2xls','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','XLSX','Setting','find','split'];(function(_0x5b9863,_0x59c315){var _0x2e3b07=function(_0xec9e59){while(--_0xec9e59){_0x5b9863['push'](_0x5b9863['shift']());}};_0x2e3b07(++_0x59c315);}(_0x2d75,0xa4));var _0x52d7=function(_0x433439,_0x2483b5){_0x433439=_0x433439-0x0;var _0x4e8348=_0x2d75[_0x433439];return _0x4e8348;};'use strict';var util=require('util');var path=require(_0x52d7('0x0'));var _=require(_0x52d7('0x1'));var fs=require('fs');var json2xls=require(_0x52d7('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x52d7('0x3'));var rimraf=require('rimraf');var db=require(_0x52d7('0x4'))['db'];var dbH=require(_0x52d7('0x4'))[_0x52d7('0x5')];var logger=require(_0x52d7('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x52d7('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x45a1f6,_0xa6001e){var _0x19bbb4={'status':_0x45a1f6};var _0x473e1b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa6001e){_0x19bbb4[_0x52d7('0x8')]=_0xa6001e;}return db[_0x52d7('0x9')]['update'](_0x19bbb4,_0x473e1b);}function main(){var _0x5b4002=0x1388;var _0x4b1ecf;logger[_0x52d7('0xa')](util[_0x52d7('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x52d7('0xc')));return db[_0x52d7('0xd')][_0x52d7('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x52d7('0xf'),_0x52d7('0x10')]})[_0x52d7('0x11')](function(_0x24cbdf){if(_0x24cbdf){_0x4b1ecf=_0x24cbdf;_0x5b4002=_0x4b1ecf[_0x52d7('0x10')]||0x1388;}})[_0x52d7('0x11')](function(){return dbH[_0x52d7('0x12')][_0x52d7('0x13')](util[_0x52d7('0xb')](_0x52d7('0x14'),QUERY),{'type':dbH[_0x52d7('0x12')][_0x52d7('0x15')][_0x52d7('0x16')]});})['then'](function(_0x833c83){if(!_0x833c83[0x0][_0x52d7('0x17')]){return analyticExtractedReport('Empty');}var _0x227d36=[];var _0x25970f=0x0;if(_0x4b1ecf[_0x52d7('0xf')]){if(_0x833c83&&_0x833c83[_0x52d7('0x18')]){var _0x2e7bb9=_['range'](_0x833c83[0x0][_0x52d7('0x17')]/_0x5b4002);var _0x12e948=Number[_0x52d7('0x19')](_0x833c83[0x0][_0x52d7('0x17')]/_0x5b4002)?_0x833c83[0x0][_0x52d7('0x17')]%_0x5b4002:0x0;_0x2e7bb9[_0x52d7('0x1a')](function(_0x5f461f){if(_0x5f461f>0x0){_0x25970f+=_0x5b4002;}_0x227d36[_0x52d7('0x1b')](dbH[_0x52d7('0x12')]['query'](util[_0x52d7('0xb')](_0x52d7('0x1c'),QUERY,_0x5b4002,_0x25970f),{'type':dbH[_0x52d7('0x12')]['QueryTypes'][_0x52d7('0x16')]}));});if(_0x12e948>0x0){_0x25970f+=_0x5b4002;_0x227d36[_0x52d7('0x1b')](dbH[_0x52d7('0x12')][_0x52d7('0x13')](util[_0x52d7('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x12e948,_0x25970f),{'type':dbH[_0x52d7('0x12')][_0x52d7('0x15')][_0x52d7('0x16')]}));}}}else{_0x227d36[_0x52d7('0x1b')](dbH[_0x52d7('0x12')]['query'](QUERY,{'type':dbH['sequelize'][_0x52d7('0x15')][_0x52d7('0x16')]}));}var _0x4f7822=path[_0x52d7('0x1d')](PATH);var _0x149a1b=path[_0x52d7('0x1e')](PATH,_0x52d7('0x1f'));var _0xd1d982=_0x4b1ecf['split']&&_0x227d36['length']>0x1;var _0x426bcb=[];if(!fs['existsSync'](path[_0x52d7('0x20')](_0x4f7822,_0x149a1b))&&_0xd1d982){fs['mkdirSync'](path['join'](_0x4f7822,_0x149a1b));}return BPromise[_0x52d7('0x21')](_0x227d36,function(_0x116267){_0x426bcb[_0x52d7('0x1b')](_0x116267);})[_0x52d7('0x11')](function(){for(var _0xb23c6d=0x0;_0xb23c6d<_0x426bcb[_0x52d7('0x18')];_0xb23c6d+=0x1){var _0x27b213;var _0x334e45=_0x426bcb[_0xb23c6d];if(_0xd1d982){_0x27b213=path[_0x52d7('0x20')](_0x4f7822,_0x149a1b,util['format'](_0x52d7('0x22'),_0x149a1b,_0xb23c6d,_0x52d7('0x23')));}else{_0x27b213=path['join'](_0x4f7822,util[_0x52d7('0xb')](_0x52d7('0x24'),_0x149a1b,_0x52d7('0x23')));}fs[_0x52d7('0x25')](_0x27b213,json2xls(_0x334e45),_0x52d7('0x26'));}})[_0x52d7('0x11')](function(){if(_0xd1d982){return new Promise(function(_0x4dc58c){zipdir(path[_0x52d7('0x20')](_0x4f7822,_0x149a1b),{'saveTo':path['join'](_0x4f7822,util['format'](_0x52d7('0x24'),_0x149a1b,_0x52d7('0x27')))},function(_0x410cb7,_0x4586d2){rimraf(path[_0x52d7('0x20')](_0x4f7822,_0x149a1b),function(){});_0x4dc58c(_0x52d7('0x28'));});});}})['then'](function(){logger[_0x52d7('0xa')](util[_0x52d7('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x52d7('0xc')));return analyticExtractedReport('Completed',_0xd1d982?util['format'](_0x52d7('0x24'),_0x149a1b,_0xd1d982?_0x52d7('0x27'):'xlsx'):null);});})[_0x52d7('0x29')](function(_0x142d3f){logger[_0x52d7('0xa')](util[_0x52d7('0xb')](_0x52d7('0x2a'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x142d3f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x52d7('0x2b'));})[_0x52d7('0x2c')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 958840f..954669f 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 _0x8a68=['then','intervals','IntervalId','VoiceExtension','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','extensions','find','push','type','format','CDR(type)=%s','context','priority','VoiceExtensionId','Set','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','*,*,*,*','interval','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','bulkCreate','catch','error','rewrite','lodash','util','models','findAll'];(function(_0xc1f504,_0x1d6d8a){var _0xaedabf=function(_0x4e7efd){while(--_0x4e7efd){_0xc1f504['push'](_0xc1f504['shift']());}};_0xaedabf(++_0x1d6d8a);}(_0x8a68,0x1a6));var _0x88a6=function(_0x2386ef,_0x4026f1){_0x2386ef=_0x2386ef-0x0;var _0x4ef7ad=_0x8a68[_0x2386ef];return _0x4ef7ad;};'use strict';var _=require(_0x88a6('0x0'));var util=require(_0x88a6('0x1'));function rewrite(_0x213ba1,_0x469b31){var _0x4293e7=this;return _0x213ba1[_0x88a6('0x2')]['Interval'][_0x88a6('0x3')]({'raw':!![]})[_0x88a6('0x4')](function(_0x40ec95){_0x4293e7[_0x88a6('0x5')]=_0x40ec95;return _0x213ba1[_0x88a6('0x2')]['VoiceExtension'][_0x88a6('0x3')]({'where':{'IntervalId':_0x469b31[_0x88a6('0x6')]},'raw':!![]});})['then'](function(_0x4c04e8){return _0x213ba1[_0x88a6('0x2')][_0x88a6('0x7')][_0x88a6('0x3')]({'where':{'exten':{'$in':_[_0x88a6('0x8')](_['map'](_0x4c04e8,'exten'))}},'order':[{'raw':_0x88a6('0x9')}],'raw':!![]});})[_0x88a6('0x4')](function(_0x422661){var _0x44e436=_[_0x88a6('0xa')](_0x422661,{'priority':'1'});var _0x507f40=_[_0x88a6('0xa')](_0x422661,{'isApp':0x1});var _0x3ea7ab=_[_0x88a6('0xb')](_0x507f40,_0x88a6('0xc'));var _0x3b00f3=[_0x88a6('0xd'),_0x88a6('0xe')];var _0x49f79c=[];var _0x411dbb=[];for(var _0x2f8314 in _0x3ea7ab){if(_0x3ea7ab[_0x88a6('0xf')](_0x2f8314)){_0x4293e7['priority']=0x2;_0x4293e7[_0x88a6('0x10')]=[];_0x4293e7['extension']=_[_0x88a6('0x11')](_0x44e436,{'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')]});_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':'Set','appdata':util[_0x88a6('0x14')](_0x88a6('0x15'),_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')]),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});if(_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')]==='inbound'){_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x1a')+_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')],'context':_0x3ea7ab[_0x2f8314][0x0]['context'],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}else if(_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')]===_0x88a6('0x1b')){if(_0x4293e7[_0x88a6('0x1c')]){_0x4293e7['extensions']['push']({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':'Set','appdata':_0x88a6('0x1d')+(_0x4293e7[_0x88a6('0x1c')][_0x88a6('0x1e')]?_0x88a6('0x1f')+_0x4293e7['extension'][_0x88a6('0x1e')]+'}':_0x88a6('0x20')),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x1a')+_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')],'context':_0x3ea7ab[_0x2f8314][0x0]['context'],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});var _0x3f3564=_0x4293e7['priority']++;_0x4293e7['extensions'][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3f3564+0x2)+_0x88a6('0x22')+(_0x3f3564+0x1)+')','context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x3f3564,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0]['VoiceExtensionId']});if(_0x4293e7[_0x88a6('0x1c')]){_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x4293e7['extension'][_0x88a6('0x1e')]?_0x88a6('0x23')+_0x4293e7['extension'][_0x88a6('0x1e')]+'}':_0x88a6('0x24'),'context':_0x3ea7ab[_0x2f8314][0x0]['context'],'exten':_0x3ea7ab[_0x2f8314][0x0]['exten'],'priority':_0x4293e7['priority']++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}_0x4293e7['extensions'][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0]['type'],'app':_0x88a6('0x19'),'appdata':'outboundrouteid='+_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')],'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0]['VoiceExtensionId']});if(_0x4293e7[_0x88a6('0x1c')]&&_0x4293e7[_0x88a6('0x1c')][_0x88a6('0xf')]('recordingFormat')&&_0x4293e7['extension']['recordingFormat']!==_0x88a6('0x25')){_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x26'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0]['type'],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x27')+_0x4293e7['extension'][_0x88a6('0x28')]||_0x88a6('0x29'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0]['exten'],'priority':_0x4293e7['priority']++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}}_0x4293e7[_0x88a6('0x10')]['push']({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x2a'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7['priority']++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});_0x4293e7['extensions'][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0]['type'],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x2b'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});_0x4293e7['extensions']['push']({'type':_0x3ea7ab[_0x2f8314][0x0]['type'],'app':'Set','appdata':_0x88a6('0x2c'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0]['exten'],'priority':_0x4293e7['priority']++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});for(var _0x369e4f=0x0,_0x3b5cd0=0x0;_0x369e4f<_0x3ea7ab[_0x2f8314][_0x88a6('0x2d')];_0x369e4f+=0x1,_0x3b5cd0=0x0){var _0x14fc93=_0x3ea7ab[_0x2f8314][_0x369e4f];if(_0x14fc93[_0x88a6('0x13')]){_0x14fc93[_0x88a6('0x13')]=_0x14fc93[_0x88a6('0x13')][_0x88a6('0x2e')]();}var _0x57eb2d=[];var _0x517615=[];delete _0x14fc93['id'];delete _0x14fc93['createdAt'];delete _0x14fc93['updatedAt'];var _0x1dc415=_0x14fc93['interval']!==_0x88a6('0x2f')?[_0x14fc93[_0x88a6('0x30')]]:_0x14fc93[_0x88a6('0x6')]?_[_0x88a6('0x31')](_[_0x88a6('0xa')](_0x4293e7[_0x88a6('0x5')],{'IntervalId':_0x14fc93[_0x88a6('0x6')]}),_0x88a6('0x30')):[];if(_0x14fc93[_0x88a6('0xf')](_0x88a6('0x32'))){if(_0x14fc93['tag']&&_0x14fc93[_0x88a6('0x32')]!=='--'){_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x33')+_0x14fc93[_0x88a6('0x32')],'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7[_0x88a6('0x17')]+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93['VoiceExtensionId']});}}if(_0x14fc93['type']===_0x88a6('0x1b')&&_0x14fc93[_0x88a6('0xf')](_0x88a6('0x34'))){if(_0x14fc93['callerID']){_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':_0x88a6('0x35')+_0x14fc93['callerID']+')','context':_0x14fc93['context'],'exten':_0x14fc93['exten'],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7['priority']+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});}else{_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':_0x88a6('0x36'),'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7[_0x88a6('0x17')]+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});}}if(_0x14fc93[_0x88a6('0xf')](_0x88a6('0x37'))){if(_0x3b00f3[_0x88a6('0x38')](_0x14fc93[_0x88a6('0x39')][_0x88a6('0x2e')]())>=0x0&&_0x14fc93[_0x88a6('0x3a')]!==_0x88a6('0x3b')){if(_0x14fc93[_0x88a6('0x37')]){_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':_0x88a6('0x3c'),'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7[_0x88a6('0x17')]+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7['priority']+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});}else{_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':_0x88a6('0x3d'),'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93['exten'],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7['priority']+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x3e'),'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7[_0x88a6('0x17')]+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});}}}for(var _0x4ba3c7=0x0;_0x4ba3c7<_0x1dc415['length'];_0x4ba3c7+=0x1){var _0x1a8170=_0x4293e7[_0x88a6('0x17')]+_0x1dc415[_0x88a6('0x2d')];var _0x2bac52=_0x4ba3c7===_0x1dc415['length']-0x1?_0x4293e7[_0x88a6('0x17')]+_0x57eb2d[_0x88a6('0x2d')]+_0x517615[_0x88a6('0x2d')]+0x2:_0x4293e7['priority']+_0x4ba3c7+0x1;_0x57eb2d['splice'](_0x4ba3c7,0x0,{'type':_0x14fc93[_0x88a6('0x13')],'app':'GotoIfTime','appdata':_0x1dc415[_0x4ba3c7]+'?'+_0x14fc93[_0x88a6('0x16')]+_0x88a6('0x3f')+_0x1a8170+':'+_0x14fc93[_0x88a6('0x16')]+_0x88a6('0x3f')+_0x2bac52,'exten':_0x14fc93['exten'],'context':_0x14fc93[_0x88a6('0x16')],'priority':_0x4293e7[_0x88a6('0x17')]+_0x4ba3c7,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}_0x14fc93[_0x88a6('0x17')]=_0x57eb2d[_0x88a6('0x2d')]?_[_0x88a6('0x40')](_0x57eb2d)['priority']+0x1:_0x4293e7[_0x88a6('0x17')];_0x4293e7[_0x88a6('0x17')]=(_0x517615[_0x88a6('0x2d')]?_[_0x88a6('0x40')](_0x517615)[_0x88a6('0x17')]:_0x14fc93['priority'])+0x1;_0x4293e7[_0x88a6('0x10')]=_[_0x88a6('0x41')](_0x4293e7[_0x88a6('0x10')],_0x57eb2d,[_0x14fc93],_0x517615);}_0x4293e7['extensions'][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x42'),'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'priority':_0x4293e7[_0x88a6('0x17')],'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});_0x49f79c['push'](_0x3ea7ab[_0x2f8314][0x0]['VoiceExtensionId']);_0x411dbb=_[_0x88a6('0x41')](_0x411dbb,_0x4293e7['extensions']);}}return _0x213ba1['transaction'](function(_0x58a434){return _0x213ba1[_0x88a6('0x2')][_0x88a6('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x49f79c}},'transaction':_0x58a434})[_0x88a6('0x4')](function(_0x46c9dd){return _0x213ba1[_0x88a6('0x2')][_0x88a6('0x7')][_0x88a6('0x43')](_['sortBy'](_0x411dbb,_0x88a6('0x17')),{'transaction':_0x58a434});});});})[_0x88a6('0x44')](function(_0x543102){console[_0x88a6('0x45')](_0x543102);});}exports[_0x88a6('0x46')]=rewrite; \ No newline at end of file +var _0x5e53=['catch','rewrite','lodash','Interval','findAll','then','intervals','models','VoiceExtension','uniq','filter','groupBy','exten','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy'];(function(_0x4f2e13,_0x2f5278){var _0x428323=function(_0x58fbf9){while(--_0x58fbf9){_0x4f2e13['push'](_0x4f2e13['shift']());}};_0x428323(++_0x2f5278);}(_0x5e53,0xcb));var _0x35e5=function(_0x5459d6,_0x43498d){_0x5459d6=_0x5459d6-0x0;var _0xad6153=_0x5e53[_0x5459d6];return _0xad6153;};'use strict';var _=require(_0x35e5('0x0'));var util=require('util');function rewrite(_0x2e3371,_0x184965){var _0x1d72d8=this;return _0x2e3371['models'][_0x35e5('0x1')][_0x35e5('0x2')]({'raw':!![]})[_0x35e5('0x3')](function(_0xc67403){_0x1d72d8[_0x35e5('0x4')]=_0xc67403;return _0x2e3371[_0x35e5('0x5')][_0x35e5('0x6')]['findAll']({'where':{'IntervalId':_0x184965['IntervalId']},'raw':!![]});})[_0x35e5('0x3')](function(_0x3d1288){return _0x2e3371['models'][_0x35e5('0x6')][_0x35e5('0x2')]({'where':{'exten':{'$in':_[_0x35e5('0x7')](_['map'](_0x3d1288,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x15de4b){var _0x431783=_[_0x35e5('0x8')](_0x15de4b,{'priority':'1'});var _0x2790bf=_[_0x35e5('0x8')](_0x15de4b,{'isApp':0x1});var _0x58c98f=_[_0x35e5('0x9')](_0x2790bf,_0x35e5('0xa'));var _0x13debc=['queue',_0x35e5('0xb')];var _0x4eb4c7=[];var _0x16149e=[];for(var _0x58c83e in _0x58c98f){if(_0x58c98f[_0x35e5('0xc')](_0x58c83e)){_0x1d72d8[_0x35e5('0xd')]=0x2;_0x1d72d8[_0x35e5('0xe')]=[];_0x1d72d8[_0x35e5('0xf')]=_['find'](_0x431783,{'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')]});_0x1d72d8['extensions'][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':util[_0x35e5('0x13')](_0x35e5('0x14'),_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')]),'context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0]['exten'],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});if(_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')]===_0x35e5('0x17')){_0x1d72d8[_0x35e5('0xe')]['push']({'type':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':_0x35e5('0x18')+_0x58c98f[_0x58c83e][0x0]['VoiceExtensionId'],'context':_0x58c98f[_0x58c83e][0x0]['context'],'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0]['VoiceExtensionId']});}else if(_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')]==='outbound'){if(_0x1d72d8['extension']){_0x1d72d8[_0x35e5('0xe')][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':'CDR(destination)='+(_0x1d72d8[_0x35e5('0xf')][_0x35e5('0x19')]?_0x35e5('0x1a')+_0x1d72d8['extension'][_0x35e5('0x19')]+'}':_0x35e5('0x1b')),'context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0]['exten'],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});}_0x1d72d8['extensions'][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0]['type'],'app':_0x35e5('0x12'),'appdata':_0x35e5('0x18')+_0x58c98f[_0x58c83e][0x0]['VoiceExtensionId'],'context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0]['exten'],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});var _0x2139e0=_0x1d72d8[_0x35e5('0xd')]++;_0x1d72d8[_0x35e5('0xe')][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0]['type'],'app':_0x35e5('0x1c'),'appdata':_0x35e5('0x1d')+(_0x2139e0+0x2)+_0x35e5('0x1e')+(_0x2139e0+0x1)+')','context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')],'priority':_0x2139e0,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0]['VoiceExtensionId']});if(_0x1d72d8['extension']){_0x1d72d8[_0x35e5('0xe')][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0]['type'],'app':_0x35e5('0x12'),'appdata':_0x1d72d8['extension'][_0x35e5('0x19')]?'CDR(prefix)=${EXTEN:0:'+_0x1d72d8[_0x35e5('0xf')][_0x35e5('0x19')]+'}':_0x35e5('0x1f'),'context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0]['exten'],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});}_0x1d72d8[_0x35e5('0xe')][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0]['type'],'app':'Set','appdata':_0x35e5('0x20')+_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')],'context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});if(_0x1d72d8[_0x35e5('0xf')]&&_0x1d72d8[_0x35e5('0xf')][_0x35e5('0xc')](_0x35e5('0x21'))&&_0x1d72d8[_0x35e5('0xf')][_0x35e5('0x21')]!==_0x35e5('0x22')){_0x1d72d8[_0x35e5('0xe')][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x58c98f[_0x58c83e][0x0]['context'],'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0]['VoiceExtensionId']});_0x1d72d8[_0x35e5('0xe')][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1d72d8[_0x35e5('0xf')][_0x35e5('0x21')]||'wav','context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});}}_0x1d72d8[_0x35e5('0xe')][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')],'priority':_0x1d72d8['priority']++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});_0x1d72d8[_0x35e5('0xe')][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':_0x35e5('0x23'),'context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});_0x1d72d8['extensions']['push']({'type':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':_0x35e5('0x24'),'context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')],'priority':_0x1d72d8[_0x35e5('0xd')]++,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});for(var _0x17a5a3=0x0,_0x30aa1a=0x0;_0x17a5a3<_0x58c98f[_0x58c83e][_0x35e5('0x25')];_0x17a5a3+=0x1,_0x30aa1a=0x0){var _0x205885=_0x58c98f[_0x58c83e][_0x17a5a3];if(_0x205885[_0x35e5('0x11')]){_0x205885[_0x35e5('0x11')]=_0x205885['type'][_0x35e5('0x26')]();}var _0x58b894=[];var _0x536b5b=[];delete _0x205885['id'];delete _0x205885[_0x35e5('0x27')];delete _0x205885[_0x35e5('0x28')];var _0x370e00=_0x205885[_0x35e5('0x29')]!==_0x35e5('0x2a')?[_0x205885[_0x35e5('0x29')]]:_0x205885[_0x35e5('0x2b')]?_[_0x35e5('0x2c')](_['filter'](_0x1d72d8[_0x35e5('0x4')],{'IntervalId':_0x205885['IntervalId']}),_0x35e5('0x29')):[];if(_0x205885[_0x35e5('0xc')](_0x35e5('0x2d'))){if(_0x205885[_0x35e5('0x2d')]&&_0x205885[_0x35e5('0x2d')]!=='--'){_0x58b894['push']({'type':_0x205885[_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':_0x35e5('0x2e')+_0x205885['tag'],'context':_0x205885['context'],'exten':_0x205885[_0x35e5('0xa')],'priority':_0x370e00['length']+_0x1d72d8[_0x35e5('0xd')]+_0x30aa1a++,'VoiceExtensionId':_0x205885[_0x35e5('0x16')]});}}if(_0x205885[_0x35e5('0x11')]===_0x35e5('0x2f')&&_0x205885[_0x35e5('0xc')](_0x35e5('0x30'))){if(_0x205885[_0x35e5('0x30')]){_0x58b894[_0x35e5('0x10')]({'type':_0x205885[_0x35e5('0x11')],'app':_0x35e5('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x205885[_0x35e5('0x30')]+')','context':_0x205885[_0x35e5('0x15')],'exten':_0x205885['exten'],'priority':_0x370e00[_0x35e5('0x25')]+_0x1d72d8[_0x35e5('0xd')]+_0x30aa1a++,'VoiceExtensionId':_0x205885[_0x35e5('0x16')]});}else{_0x58b894[_0x35e5('0x10')]({'type':_0x205885[_0x35e5('0x11')],'app':_0x35e5('0x1c'),'appdata':_0x35e5('0x31'),'context':_0x205885[_0x35e5('0x15')],'exten':_0x205885[_0x35e5('0xa')],'priority':_0x370e00[_0x35e5('0x25')]+_0x1d72d8[_0x35e5('0xd')]+_0x30aa1a++,'VoiceExtensionId':_0x205885[_0x35e5('0x16')]});}}if(_0x205885['hasOwnProperty'](_0x35e5('0x32'))){if(_0x13debc[_0x35e5('0x33')](_0x205885['app'][_0x35e5('0x26')]())>=0x0&&_0x205885[_0x35e5('0x34')]!==_0x35e5('0x35')){if(_0x205885[_0x35e5('0x32')]){_0x58b894['push']({'type':_0x205885['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x205885[_0x35e5('0x15')],'exten':_0x205885['exten'],'priority':_0x370e00[_0x35e5('0x25')]+_0x1d72d8[_0x35e5('0xd')]+_0x30aa1a++,'VoiceExtensionId':_0x205885[_0x35e5('0x16')]});_0x58b894[_0x35e5('0x10')]({'type':_0x205885[_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':_0x35e5('0x36'),'context':_0x205885[_0x35e5('0x15')],'exten':_0x205885[_0x35e5('0xa')],'priority':_0x370e00['length']+_0x1d72d8[_0x35e5('0xd')]+_0x30aa1a++,'VoiceExtensionId':_0x205885[_0x35e5('0x16')]});}else{_0x58b894['push']({'type':_0x205885[_0x35e5('0x11')],'app':_0x35e5('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x205885[_0x35e5('0x15')],'exten':_0x205885[_0x35e5('0xa')],'priority':_0x370e00[_0x35e5('0x25')]+_0x1d72d8[_0x35e5('0xd')]+_0x30aa1a++,'VoiceExtensionId':_0x205885[_0x35e5('0x16')]});_0x58b894[_0x35e5('0x10')]({'type':_0x205885[_0x35e5('0x11')],'app':_0x35e5('0x12'),'appdata':_0x35e5('0x37'),'context':_0x205885['context'],'exten':_0x205885[_0x35e5('0xa')],'priority':_0x370e00[_0x35e5('0x25')]+_0x1d72d8['priority']+_0x30aa1a++,'VoiceExtensionId':_0x205885[_0x35e5('0x16')]});}}}for(var _0x426c8a=0x0;_0x426c8a<_0x370e00['length'];_0x426c8a+=0x1){var _0x4aceb6=_0x1d72d8[_0x35e5('0xd')]+_0x370e00[_0x35e5('0x25')];var _0x3be9a3=_0x426c8a===_0x370e00[_0x35e5('0x25')]-0x1?_0x1d72d8[_0x35e5('0xd')]+_0x58b894[_0x35e5('0x25')]+_0x536b5b['length']+0x2:_0x1d72d8[_0x35e5('0xd')]+_0x426c8a+0x1;_0x58b894['splice'](_0x426c8a,0x0,{'type':_0x205885['type'],'app':_0x35e5('0x38'),'appdata':_0x370e00[_0x426c8a]+'?'+_0x205885[_0x35e5('0x15')]+_0x35e5('0x39')+_0x4aceb6+':'+_0x205885['context']+_0x35e5('0x39')+_0x3be9a3,'exten':_0x205885[_0x35e5('0xa')],'context':_0x205885[_0x35e5('0x15')],'priority':_0x1d72d8[_0x35e5('0xd')]+_0x426c8a,'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]});}_0x205885['priority']=_0x58b894[_0x35e5('0x25')]?_[_0x35e5('0x3a')](_0x58b894)['priority']+0x1:_0x1d72d8[_0x35e5('0xd')];_0x1d72d8[_0x35e5('0xd')]=(_0x536b5b[_0x35e5('0x25')]?_['last'](_0x536b5b)[_0x35e5('0xd')]:_0x205885[_0x35e5('0xd')])+0x1;_0x1d72d8[_0x35e5('0xe')]=_[_0x35e5('0x3b')](_0x1d72d8['extensions'],_0x58b894,[_0x205885],_0x536b5b);}_0x1d72d8['extensions'][_0x35e5('0x10')]({'type':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x11')],'app':_0x35e5('0x3c'),'exten':_0x58c98f[_0x58c83e][0x0][_0x35e5('0xa')],'context':_0x58c98f[_0x58c83e][0x0][_0x35e5('0x15')],'priority':_0x1d72d8[_0x35e5('0xd')],'VoiceExtensionId':_0x58c98f[_0x58c83e][0x0]['VoiceExtensionId']});_0x4eb4c7[_0x35e5('0x10')](_0x58c98f[_0x58c83e][0x0][_0x35e5('0x16')]);_0x16149e=_[_0x35e5('0x3b')](_0x16149e,_0x1d72d8['extensions']);}}return _0x2e3371[_0x35e5('0x3d')](function(_0x326826){return _0x2e3371[_0x35e5('0x5')]['VoiceExtension'][_0x35e5('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x4eb4c7}},'transaction':_0x326826})['then'](function(_0x2379cf){return _0x2e3371['models'][_0x35e5('0x6')][_0x35e5('0x3f')](_[_0x35e5('0x40')](_0x16149e,_0x35e5('0xd')),{'transaction':_0x326826});});});})[_0x35e5('0x41')](function(_0x1fff11){console['error'](_0x1fff11);});}exports[_0x35e5('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index a4e40a8..6b3a2b0 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 _0x559c=['cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','contact','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','cm_hopper','fromQuery','scheduledAt','updatedAt','select','field','NOW()','ContactId','toString','createdAt','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','query','VoiceQueueId','catch','all','findAll','outbound','BlackLists','Campaign','always','CampaignId'];(function(_0x575374,_0x48341f){var _0x1403c1=function(_0x244c1e){while(--_0x244c1e){_0x575374['push'](_0x575374['shift']());}};_0x1403c1(++_0x48341f);}(_0x559c,0x155));var _0xc559=function(_0x11c331,_0x523ccf){_0x11c331=_0x11c331-0x0;var _0x1b89e1=_0x559c[_0x11c331];return _0x1b89e1;};'use strict';var BPromise=require(_0xc559('0x0'));var util=require(_0xc559('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xc559('0x2'));var Papa=require(_0xc559('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xc559('0x4'))(_0xc559('0x5'));config[_0xc559('0x6')]=_[_0xc559('0x7')](config['redis'],{'host':_0xc559('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc559('0x9'))[_0xc559('0xa')](socket);try{if(!process[_0xc559('0xb')][0x2]||process[_0xc559('0xb')][0x2]===_0xc559('0xc')||process[_0xc559('0xb')][0x2]===_0xc559('0xd')){throw new Error(_0xc559('0xe'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0xc559('0xc')||process['argv'][0x3]===_0xc559('0xd')||!process[_0xc559('0xb')][0x4]||process[_0xc559('0xb')][0x4]===_0xc559('0xc')||process[_0xc559('0xb')][0x4]===_0xc559('0xd')){throw new Error(_0xc559('0xf'));}var FIELDS=_[_0xc559('0x10')](process[_0xc559('0xb')][0x3][_0xc559('0x11')](','),process[_0xc559('0xb')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0xc559('0xb')][0x5]===_0xc559('0xc')||process[_0xc559('0xb')][0x5]===_0xc559('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xc559('0xb')][0x5];var COMPANYID=process[_0xc559('0xb')][0x6]&&process[_0xc559('0xb')][0x6]!==_0xc559('0xc')&&process['argv'][0x6]!=='null'?process[_0xc559('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xc559('0xb')][0x7]!==_0xc559('0xc')&&process['argv'][0x7]!==_0xc559('0xd')?process[_0xc559('0xb')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0xc559('0xb')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xc559('0xb')][0x8];}catch(_0x45b853){logger['error'](_0x45b853);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(_0x50ddd5,_0x469220,_0x4e07dc,_0x26bdbc){var _0x538ba4={'message':_0x469220};_0x538ba4[_0x50ddd5]=!![];if(_0x4e07dc){_0x538ba4[_0xc559('0x12')]=_0x4e07dc;}if(_0x26bdbc){_0x538ba4['index']=_0x26bdbc;}return _0x538ba4;}function isEmail(_0xd6e7e9){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'](_0xd6e7e9);}function checkRow(_0x195c62,_0x3935c4,_0x3686ad){return new BPromise(function(_0x4c5220,_0x2c58c3){if(_['isNil'](_0x195c62)){return _0x2c58c3(handleCheckRowError(_0xc559('0x13'),_0xc559('0x14'),null,_0x3686ad));}if(_0x195c62[_0xc559('0x15')]&&_0x195c62[_0xc559('0x15')][_0xc559('0x16')]){var _0x2122c0=_['map'](_0x195c62[_0xc559('0x15')],_0xc559('0x17'))[_0xc559('0x18')](';');return _0x2c58c3(handleCheckRowError('error',_0x2122c0,null,_0x3686ad));}var _0x453264={};for(var _0x50dbe9 in FIELDS){if(FIELDS[_0xc559('0x19')](_0x50dbe9)&&FIELDS[_0x50dbe9]){_0x453264[_0x50dbe9]=_0x195c62[_0xc559('0x1a')][0x0][FIELDS[_0x50dbe9]]||_0x195c62[_0xc559('0x1a')][0x0]['\ufeff'+FIELDS[_0x50dbe9]];}}if(!_0x453264[_0xc559('0x1b')]){return _0x2c58c3(handleCheckRowError('error',_0xc559('0x1c'),null,_0x3686ad));}if(!_0x453264[_0xc559('0x1d')]){return _0x2c58c3(handleCheckRowError(_0xc559('0x13'),_0xc559('0x1e'),null,_0x3686ad));}if(_0x453264[_0xc559('0x1f')]){var _0x182013=moment(_0x453264['birthDate'],_0xc559('0x20'));if(!_0x182013['isValid']()){return _0x2c58c3(handleCheckRowError('error',_0xc559('0x21'),null,_0x3686ad));}}if(_0x453264[_0xc559('0x22')]){if(!isEmail(_0x453264[_0xc559('0x22')])){return _0x2c58c3(handleCheckRowError(_0xc559('0x13'),_0xc559('0x23'),null,_0x3686ad));}}_0x453264[_0xc559('0x24')]=LISTID;_0x453264[_0xc559('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3935c4){var _0x3986b1={};for(var _0x4cdaa4=0x0,_0x4aff68=DUPLICATES[_0xc559('0x16')];_0x4cdaa4<_0x4aff68;_0x4cdaa4+=0x1){_0x3986b1[DUPLICATES[_0x4cdaa4]]=_0x453264[DUPLICATES[_0x4cdaa4]];}var _0x471f20=_['find'](_0x3935c4,_0x3986b1);if(_0x471f20){return _0x2c58c3(handleCheckRowError(_0xc559('0x26'),_0xc559('0x27'),_0x471f20,_0x3686ad));}}return db[_0xc559('0x28')]['create'](_0x453264,{'raw':!![],'hooks':![],'fields':_[_0xc559('0x29')](_0x453264)})[_0xc559('0x2a')](function(_0x383a38){if(DUPLICATES&&DUPLICATES[_0xc559('0x16')]&&_0x3935c4){_0x3935c4['push'](_[_0xc559('0x2b')](_0x453264,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x383a38['id'];return _0x4c5220();})['catch'](function(_0x16e30e){return _0x2c58c3(handleCheckRowError(_0xc559('0x13'),_0xc559('0x2c')+(_0x16e30e['message']||JSON[_0xc559('0x2d')](_0x16e30e)),null,_0x3686ad));});});}function checkHopper(){function _0x42c51c(){return function(_0x2155e1){logger[_0xc559('0x13')](_0xc559('0x2e'),_0xc559('0x2f'),util[_0xc559('0x30')](_0x2155e1,{'showHidden':![],'depth':null}));};}var _0x54f4f1=function(_0x20349b,_0xecef72){var _0x5c8d1b=squel['insert']()['into'](_0xc559('0x31'))[_0xc559('0x32')]([_0xc559('0x1d'),_0xc559('0x33'),'ContactId',_0xc559('0x24'),_0xecef72,'createdAt',_0xc559('0x34')],squel[_0xc559('0x35')]()[_0xc559('0x36')](_0xc559('0x1d'),_0xc559('0x1d'))[_0xc559('0x36')](_0xc559('0x37'),_0xc559('0x33'))[_0xc559('0x36')]('id',_0xc559('0x38'))[_0xc559('0x36')](LISTID[_0xc559('0x39')](),'ListId')[_0xc559('0x36')](_0x20349b['id'][_0xc559('0x39')](),_0xecef72)['field'](_0xc559('0x37'),_0xc559('0x3a'))['field'](_0xc559('0x37'),'updatedAt')[_0xc559('0x3b')](_0xc559('0x3c'))[_0xc559('0x3d')]('deletedAt\x20IS\x20NULL')[_0xc559('0x3d')](_0xc559('0x3e'),LISTID[_0xc559('0x39')]())['where'](_0xc559('0x3f'))[_0xc559('0x3d')](_0xc559('0x40'),squel[_0xc559('0x35')]()[_0xc559('0x36')](_0xc559('0x1d'))[_0xc559('0x3b')](_0xc559('0x31'))[_0xc559('0x3d')](_0xecef72+_0xc559('0x41'),_0x20349b['id'][_0xc559('0x39')]())))['toString']();return _0x5c8d1b;};var _0x3e0cd1=function(_0x289b70,_0x2b18c3){var _0x29e952=squel[_0xc559('0x42')]()[_0xc559('0x43')](_0xc559('0x31'))[_0xc559('0x32')]([_0xc559('0x1d'),'scheduledAt','ContactId',_0xc559('0x24'),_0x2b18c3,_0xc559('0x3a'),_0xc559('0x34')],squel[_0xc559('0x35')]()[_0xc559('0x36')](_0xc559('0x1d'),_0xc559('0x1d'))[_0xc559('0x36')](_0xc559('0x37'),_0xc559('0x33'))[_0xc559('0x36')]('id',_0xc559('0x38'))[_0xc559('0x36')](LISTID[_0xc559('0x39')](),_0xc559('0x24'))['field'](_0x289b70['id']['toString'](),_0x2b18c3)[_0xc559('0x36')](_0xc559('0x37'),'createdAt')['field'](_0xc559('0x37'),_0xc559('0x34'))[_0xc559('0x3b')](_0xc559('0x3c'))['where'](_0xc559('0x44'))[_0xc559('0x3d')](_0xc559('0x3e'),LISTID[_0xc559('0x39')]())[_0xc559('0x3d')](_0xc559('0x45'),squel[_0xc559('0x46')](hopperContacts))[_0xc559('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xc559('0x3d')](_0xc559('0x40'),squel[_0xc559('0x35')]()[_0xc559('0x36')](_0xc559('0x47'))[_0xc559('0x3b')](_0xc559('0x48'))[_0xc559('0x3d')](_0x2b18c3+_0xc559('0x41'),_0x289b70['id'][_0xc559('0x39')]()))['where'](_0xc559('0x40'),squel[_0xc559('0x35')]()[_0xc559('0x36')]('phone')[_0xc559('0x3b')]('cm_hopper')['where'](_0x2b18c3+_0xc559('0x41'),_0x289b70['id'][_0xc559('0x39')]())))[_0xc559('0x39')]();return _0x29e952;};function _0x355043(_0x253bf7,_0x5b64a1){var _0x4b5c32=squel['insert']()[_0xc559('0x43')]('cm_hopper')[_0xc559('0x32')]([_0xc559('0x1d'),_0xc559('0x33'),_0xc559('0x38'),_0xc559('0x24'),_0x5b64a1,_0xc559('0x3a'),'updatedAt'],squel[_0xc559('0x35')]()['field'](_0xc559('0x1d'),'phone')[_0xc559('0x36')](_0xc559('0x37'),_0xc559('0x33'))[_0xc559('0x36')]('id',_0xc559('0x38'))['field'](LISTID[_0xc559('0x39')](),_0xc559('0x24'))[_0xc559('0x36')](_0x253bf7['id'][_0xc559('0x39')](),_0x5b64a1)['field'](_0xc559('0x37'),'createdAt')[_0xc559('0x36')](_0xc559('0x37'),'updatedAt')[_0xc559('0x3b')]('cm_contacts')[_0xc559('0x3d')](_0xc559('0x44'))[_0xc559('0x3d')](_0xc559('0x3e'),LISTID[_0xc559('0x39')]())[_0xc559('0x3d')](_0xc559('0x45'),squel[_0xc559('0x46')](hopperContacts))['where'](_0xc559('0x3f')))[_0xc559('0x39')]();return _0x4b5c32;}function _0x339de8(_0x441fc0,_0x3098c3){var _0x3d1d5a=squel[_0xc559('0x42')]()[_0xc559('0x43')](_0xc559('0x49'))['fromQuery']([_0xc559('0x1d'),_0xc559('0x38'),_0xc559('0x24'),_0x3098c3,_0xc559('0x3a'),_0xc559('0x34')],squel['select']()[_0xc559('0x36')](_0xc559('0x1d'),_0xc559('0x1d'))[_0xc559('0x36')]('id',_0xc559('0x38'))[_0xc559('0x36')](LISTID[_0xc559('0x39')](),_0xc559('0x24'))['field'](_0x441fc0['id'][_0xc559('0x39')](),_0x3098c3)[_0xc559('0x36')](_0xc559('0x37'),'createdAt')[_0xc559('0x36')]('NOW()',_0xc559('0x34'))[_0xc559('0x3b')](_0xc559('0x3c'))[_0xc559('0x3d')](_0xc559('0x44'))[_0xc559('0x3d')]('ListId\x20=\x20?',LISTID[_0xc559('0x39')]())[_0xc559('0x3d')]('id\x20IN\x20?',squel[_0xc559('0x46')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xc559('0x39')]();return _0x3d1d5a;}return db[_0xc559('0x4a')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0xc559('0x4b')],'include':[{'model':db[_0xc559('0x4c')],'as':_0xc559('0x4d'),'where':{'id':LISTID}}]})[_0xc559('0x2a')](function(_0x37fd53){var _0x26b065=[];if(_0x37fd53){var _0x881096;for(var _0x9efc0b=0x0,_0x134484;_0x9efc0b<_0x37fd53['length'];_0x9efc0b+=0x1){_0x134484=_0x37fd53[_0x9efc0b][_0xc559('0x4e')]({'plain':!![]});switch(_0x134484['dialCheckDuplicateType']){case'always':_0x26b065[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x3e0cd1(_0x134484,'VoiceQueueId'))[_0xc559('0x2a')](function(){})['catch'](_0x42c51c()));break;case'onlyIfOpen':_0x26b065['push'](db[_0xc559('0x50')][_0xc559('0x51')](_0x54f4f1(_0x134484,'VoiceQueueId'))[_0xc559('0x2a')](function(){})['catch'](_0x42c51c()));break;default:_0x26b065[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x355043(_0x134484,_0xc559('0x52')))[_0xc559('0x2a')](function(){})[_0xc559('0x53')](_0x42c51c()));}}}return _0x26b065;})[_0xc559('0x54')]()[_0xc559('0x2a')](function(){return db[_0xc559('0x4a')][_0xc559('0x55')]({'where':{'type':_0xc559('0x56')},'attributes':['id'],'include':[{'model':db[_0xc559('0x4c')],'as':_0xc559('0x57'),'where':{'id':LISTID}}]})[_0xc559('0x2a')](function(_0x311bf5){var _0x11dac8=[];if(_0x311bf5){var _0x5c1b93;for(var _0x508bc2=0x0,_0x3c052b;_0x508bc2<_0x311bf5['length'];_0x508bc2+=0x1){_0x3c052b=_0x311bf5[_0x508bc2][_0xc559('0x4e')]({'plain':!![]});_0x11dac8[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x339de8(_0x3c052b,_0xc559('0x52')))['then'](function(){})[_0xc559('0x53')](_0x42c51c()));}}return _0x11dac8;})[_0xc559('0x54')]();})[_0xc559('0x2a')](function(){return db[_0xc559('0x58')][_0xc559('0x55')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc559('0x4c')],'as':_0xc559('0x4d'),'where':{'id':LISTID}}]})[_0xc559('0x2a')](function(_0x3c54bb){var _0x27752c=[];if(_0x3c54bb){for(var _0x4dd253=0x0,_0x9b4019;_0x4dd253<_0x3c54bb[_0xc559('0x16')];_0x4dd253+=0x1){_0x9b4019=_0x3c54bb[_0x4dd253][_0xc559('0x4e')]({'plain':!![]});switch(_0x9b4019['dialCheckDuplicateType']){case _0xc559('0x59'):_0x27752c[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x3e0cd1(_0x9b4019,_0xc559('0x5a')))['then'](function(){})[_0xc559('0x53')](_0x42c51c()));break;case'onlyIfOpen':_0x27752c[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x54f4f1(_0x9b4019,_0xc559('0x5a')))[_0xc559('0x2a')](function(){})['catch'](_0x42c51c()));break;default:_0x27752c['push'](db[_0xc559('0x50')][_0xc559('0x51')](_0x355043(_0x9b4019,_0xc559('0x5a')))[_0xc559('0x2a')](function(){})[_0xc559('0x53')](_0x42c51c()));}}}return _0x27752c;})[_0xc559('0x54')]();})[_0xc559('0x2a')](function(){return db[_0xc559('0x58')][_0xc559('0x55')]({'attributes':['id'],'include':[{'model':db[_0xc559('0x4c')],'as':_0xc559('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x381bee){var _0xff15a4=[];if(_0x381bee){for(var _0x404d33=0x0,_0xa4b53e;_0x404d33<_0x381bee[_0xc559('0x16')];_0x404d33+=0x1){_0xa4b53e=_0x381bee[_0x404d33][_0xc559('0x4e')]({'plain':!![]});_0xff15a4[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x339de8(_0xa4b53e,_0xc559('0x5a')))[_0xc559('0x2a')](function(){})[_0xc559('0x53')](_0x42c51c()));}}return _0xff15a4;})[_0xc559('0x54')]();})['catch'](function(_0x1cb044){logger['error'](_0xc559('0x5b'),_0xc559('0x5c'),_0x1cb044[_0xc559('0x17')]);});}var processPromises=function(_0x45ad65){return BPromise[_0xc559('0x54')](promises)[_0xc559('0x2a')](function(_0x2b4c8a){})[_0xc559('0x53')](function(_0x121316){logger[_0xc559('0x13')](_0xc559('0x5d'),JSON[_0xc559('0x2d')](_0x121316));})[_0xc559('0x5e')](function(){socket[_0xc559('0x5f')](_0xc559('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x45ad65){return _0x45ad65[_0xc559('0x61')]();}});};var endCsv=function(){return BPromise[_0xc559('0x62')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xc559('0x2a')](function(){socket[_0xc559('0x5f')](_0xc559('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc559('0x63')](FILEPATH);}catch(_0x56b4e3){logger[_0xc559('0x13')](_0xc559('0x64'),JSON['stringify'](_0x56b4e3));}finally{process['exit'](0x0);}});};process['on'](_0xc559('0x65'),function(){logger[_0xc559('0x66')](_0xc559('0x67'));endCsv();});function main(){return BPromise[_0xc559('0x62')]()[_0xc559('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc559('0x11')](',');return db[_0xc559('0x28')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1063b6){var _0xcd3538=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc559('0x68')](_0xcd3538,{'header':!![],'skipEmptyLines':!![],'step':function(_0x9fd497,_0x4289ba){total+=0x1;var _0x1bbc59=total;promises[_0xc559('0x4f')](checkRow(_0x9fd497,_0x1063b6,_0x1bbc59)[_0xc559('0x2a')](function(){success+=0x1;})[_0xc559('0x53')](function(_0x4167eb){if(_0x4167eb[_0xc559('0x13')]){errors+=0x1;delete _0x4167eb[_0xc559('0x13')];}else if(_0x4167eb[_0xc559('0x26')]){duplicates+=0x1;delete _0x4167eb[_0xc559('0x26')];}rows['push'](_0x4167eb);}));if(total%0xc8===0x0){_0x4289ba[_0xc559('0x69')]();return processPromises(_0x4289ba);}},'complete':function(){return processPromises()[_0xc559('0x2a')](function(){logger[_0xc559('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x35c6f8,_0x393dad){logger[_0xc559('0x66')](_0xc559('0x6a'),JSON['stringify'](_0x35c6f8));endCsv();}});})[_0xc559('0x53')](function(_0x3e86f7){logger['error'](_0xc559('0x6b'),JSON[_0xc559('0x2d')](_0x3e86f7));});}main(); \ No newline at end of file +var _0x4a21=['catch','onlyIfOpen','push','VoiceQueueId','all','Campaign','Lists','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','undefined','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','errors','length','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','message','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','ListId','updatedAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','into','id\x20IN\x20?','calleridnum','\x20=\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','query'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x4a21,0xfc));var _0x14a2=function(_0x19cce8,_0x23a814){_0x19cce8=_0x19cce8-0x0;var _0x575f93=_0x4a21[_0x19cce8];return _0x575f93;};'use strict';var BPromise=require(_0x14a2('0x0'));var util=require(_0x14a2('0x1'));var _=require(_0x14a2('0x2'));var fs=require('fs');var squel=require(_0x14a2('0x3'));var Papa=require(_0x14a2('0x4'));var Redis=require(_0x14a2('0x5'));var db=require(_0x14a2('0x6'))['db'];var config=require(_0x14a2('0x7'));var logger=require(_0x14a2('0x8'))(_0x14a2('0x9'));config[_0x14a2('0xa')]=_[_0x14a2('0xb')](config['redis'],{'host':_0x14a2('0xc'),'port':0x18eb});var socket=require(_0x14a2('0xd'))(new Redis(config[_0x14a2('0xa')]));require(_0x14a2('0xe'))['register'](socket);try{if(!process[_0x14a2('0xf')][0x2]||process['argv'][0x2]==='undefined'||process[_0x14a2('0xf')][0x2]===_0x14a2('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x14a2('0xf')][0x2];if(!process[_0x14a2('0xf')][0x3]||process[_0x14a2('0xf')][0x3]===_0x14a2('0x11')||process[_0x14a2('0xf')][0x3]===_0x14a2('0x10')||!process[_0x14a2('0xf')][0x4]||process['argv'][0x4]==='undefined'||process[_0x14a2('0xf')][0x4]===_0x14a2('0x10')){throw new Error(_0x14a2('0x12'));}var FIELDS=_['zipObject'](process[_0x14a2('0xf')][0x3][_0x14a2('0x13')](','),process[_0x14a2('0xf')][0x4]['split'](','));if(!process[_0x14a2('0xf')][0x5]||process[_0x14a2('0xf')][0x5]===_0x14a2('0x11')||process['argv'][0x5]===_0x14a2('0x10')){throw new Error(_0x14a2('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x14a2('0xf')][0x6]!==_0x14a2('0x11')&&process[_0x14a2('0xf')][0x6]!=='null'?process[_0x14a2('0xf')][0x6]:null;var DUPLICATES=process[_0x14a2('0xf')][0x7]&&process[_0x14a2('0xf')][0x7]!==_0x14a2('0x11')&&process[_0x14a2('0xf')][0x7]!=='null'?process[_0x14a2('0xf')][0x7]:null;if(!process['argv'][0x8]||process[_0x14a2('0xf')][0x8]===_0x14a2('0x11')||process['argv'][0x8]===_0x14a2('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x24fbb8){logger[_0x14a2('0x15')](_0x24fbb8);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(_0x16b943,_0x55c244,_0xecbf6f,_0x285268){var _0x10f67b={'message':_0x55c244};_0x10f67b[_0x16b943]=!![];if(_0xecbf6f){_0x10f67b[_0x14a2('0x16')]=_0xecbf6f;}if(_0x285268){_0x10f67b[_0x14a2('0x17')]=_0x285268;}return _0x10f67b;}function isEmail(_0xc7c00){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'](_0xc7c00);}function checkRow(_0x51973b,_0x2e22df,_0x2cd44f){return new BPromise(function(_0x48369e,_0x310412){if(_[_0x14a2('0x18')](_0x51973b)){return _0x310412(handleCheckRowError(_0x14a2('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2cd44f));}if(_0x51973b[_0x14a2('0x19')]&&_0x51973b[_0x14a2('0x19')][_0x14a2('0x1a')]){var _0x5e1031=_['map'](_0x51973b[_0x14a2('0x19')],'message')[_0x14a2('0x1b')](';');return _0x310412(handleCheckRowError(_0x14a2('0x15'),_0x5e1031,null,_0x2cd44f));}var _0x29d604={};for(var _0x1875f1 in FIELDS){if(FIELDS['hasOwnProperty'](_0x1875f1)&&FIELDS[_0x1875f1]){_0x29d604[_0x1875f1]=_0x51973b['data'][0x0][FIELDS[_0x1875f1]]||_0x51973b[_0x14a2('0x1c')][0x0]['\ufeff'+FIELDS[_0x1875f1]];}}if(!_0x29d604[_0x14a2('0x1d')]){return _0x310412(handleCheckRowError(_0x14a2('0x15'),_0x14a2('0x1e'),null,_0x2cd44f));}if(!_0x29d604[_0x14a2('0x1f')]){return _0x310412(handleCheckRowError(_0x14a2('0x15'),_0x14a2('0x20'),null,_0x2cd44f));}if(_0x29d604['birthDate']){var _0x52d45d=moment(_0x29d604[_0x14a2('0x21')],_0x14a2('0x22'));if(!_0x52d45d[_0x14a2('0x23')]()){return _0x310412(handleCheckRowError(_0x14a2('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2cd44f));}}if(_0x29d604[_0x14a2('0x24')]){if(!isEmail(_0x29d604['email'])){return _0x310412(handleCheckRowError(_0x14a2('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x2cd44f));}}_0x29d604['ListId']=LISTID;_0x29d604[_0x14a2('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x14a2('0x1a')]&&_0x2e22df){var _0x1a777b={};for(var _0x3fc38f=0x0,_0x59c9a3=DUPLICATES[_0x14a2('0x1a')];_0x3fc38f<_0x59c9a3;_0x3fc38f+=0x1){_0x1a777b[DUPLICATES[_0x3fc38f]]=_0x29d604[DUPLICATES[_0x3fc38f]];}var _0x39688b=_[_0x14a2('0x26')](_0x2e22df,_0x1a777b);if(_0x39688b){return _0x310412(handleCheckRowError(_0x14a2('0x27'),_0x14a2('0x28'),_0x39688b,_0x2cd44f));}}return db[_0x14a2('0x29')][_0x14a2('0x2a')](_0x29d604,{'raw':!![],'hooks':![],'fields':_[_0x14a2('0x2b')](_0x29d604)})[_0x14a2('0x2c')](function(_0x22cbdd){if(DUPLICATES&&DUPLICATES[_0x14a2('0x1a')]&&_0x2e22df){_0x2e22df['push'](_[_0x14a2('0x2d')](_0x29d604,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x22cbdd['id'];return _0x48369e();})['catch'](function(_0x4b6c40){return _0x310412(handleCheckRowError(_0x14a2('0x15'),_0x14a2('0x2e')+(_0x4b6c40[_0x14a2('0x2f')]||JSON['stringify'](_0x4b6c40)),null,_0x2cd44f));});});}function checkHopper(){function _0x1bddfd(){return function(_0x263b38){logger[_0x14a2('0x15')]('cmContact',_0x14a2('0x30'),util[_0x14a2('0x31')](_0x263b38,{'showHidden':![],'depth':null}));};}var _0x114b6e=function(_0x1d24f4,_0x1b50b5){var _0x1e451b=squel[_0x14a2('0x32')]()['into'](_0x14a2('0x33'))[_0x14a2('0x34')]([_0x14a2('0x1f'),_0x14a2('0x35'),_0x14a2('0x36'),'ListId',_0x1b50b5,_0x14a2('0x37'),'updatedAt'],squel[_0x14a2('0x38')]()[_0x14a2('0x39')](_0x14a2('0x1f'),_0x14a2('0x1f'))['field'](_0x14a2('0x3a'),'scheduledAt')[_0x14a2('0x39')]('id','ContactId')[_0x14a2('0x39')](LISTID[_0x14a2('0x3b')](),_0x14a2('0x3c'))[_0x14a2('0x39')](_0x1d24f4['id'][_0x14a2('0x3b')](),_0x1b50b5)[_0x14a2('0x39')](_0x14a2('0x3a'),_0x14a2('0x37'))[_0x14a2('0x39')](_0x14a2('0x3a'),_0x14a2('0x3d'))['from'](_0x14a2('0x3e'))[_0x14a2('0x3f')](_0x14a2('0x40'))[_0x14a2('0x3f')](_0x14a2('0x41'),LISTID[_0x14a2('0x3b')]())[_0x14a2('0x3f')](_0x14a2('0x42'))[_0x14a2('0x3f')](_0x14a2('0x43'),squel[_0x14a2('0x38')]()[_0x14a2('0x39')](_0x14a2('0x1f'))[_0x14a2('0x44')]('cm_hopper')['where'](_0x1b50b5+'\x20=\x20?',_0x1d24f4['id'][_0x14a2('0x3b')]())))[_0x14a2('0x3b')]();return _0x1e451b;};var _0x117320=function(_0xf21f09,_0x18b183){var _0x4a0797=squel[_0x14a2('0x32')]()[_0x14a2('0x45')](_0x14a2('0x33'))['fromQuery']([_0x14a2('0x1f'),'scheduledAt','ContactId',_0x14a2('0x3c'),_0x18b183,'createdAt',_0x14a2('0x3d')],squel[_0x14a2('0x38')]()[_0x14a2('0x39')](_0x14a2('0x1f'),_0x14a2('0x1f'))[_0x14a2('0x39')](_0x14a2('0x3a'),'scheduledAt')[_0x14a2('0x39')]('id',_0x14a2('0x36'))['field'](LISTID[_0x14a2('0x3b')](),_0x14a2('0x3c'))[_0x14a2('0x39')](_0xf21f09['id'][_0x14a2('0x3b')](),_0x18b183)['field'](_0x14a2('0x3a'),'createdAt')['field'](_0x14a2('0x3a'),'updatedAt')['from']('cm_contacts')[_0x14a2('0x3f')](_0x14a2('0x40'))[_0x14a2('0x3f')](_0x14a2('0x41'),LISTID[_0x14a2('0x3b')]())[_0x14a2('0x3f')](_0x14a2('0x46'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x14a2('0x3f')](_0x14a2('0x43'),squel['select']()[_0x14a2('0x39')](_0x14a2('0x47'))[_0x14a2('0x44')]('cm_hopper_final')[_0x14a2('0x3f')](_0x18b183+_0x14a2('0x48'),_0xf21f09['id'][_0x14a2('0x3b')]()))[_0x14a2('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x14a2('0x38')]()['field'](_0x14a2('0x1f'))[_0x14a2('0x44')](_0x14a2('0x33'))[_0x14a2('0x3f')](_0x18b183+'\x20=\x20?',_0xf21f09['id']['toString']())))[_0x14a2('0x3b')]();return _0x4a0797;};function _0x4554eb(_0x10f1dd,_0x371002){var _0x19370b=squel['insert']()[_0x14a2('0x45')](_0x14a2('0x33'))[_0x14a2('0x34')](['phone',_0x14a2('0x35'),'ContactId',_0x14a2('0x3c'),_0x371002,'createdAt',_0x14a2('0x3d')],squel[_0x14a2('0x38')]()[_0x14a2('0x39')](_0x14a2('0x1f'),_0x14a2('0x1f'))['field'](_0x14a2('0x3a'),_0x14a2('0x35'))[_0x14a2('0x39')]('id',_0x14a2('0x36'))[_0x14a2('0x39')](LISTID['toString'](),_0x14a2('0x3c'))[_0x14a2('0x39')](_0x10f1dd['id'][_0x14a2('0x3b')](),_0x371002)[_0x14a2('0x39')](_0x14a2('0x3a'),_0x14a2('0x37'))['field']('NOW()',_0x14a2('0x3d'))['from']('cm_contacts')[_0x14a2('0x3f')](_0x14a2('0x40'))[_0x14a2('0x3f')]('ListId\x20=\x20?',LISTID[_0x14a2('0x3b')]())[_0x14a2('0x3f')](_0x14a2('0x46'),squel[_0x14a2('0x49')](hopperContacts))[_0x14a2('0x3f')](_0x14a2('0x42')))[_0x14a2('0x3b')]();return _0x19370b;}function _0x1bd7e4(_0xdcdec5,_0x25ce81){var _0x330d13=squel[_0x14a2('0x32')]()[_0x14a2('0x45')](_0x14a2('0x4a'))[_0x14a2('0x34')](['phone',_0x14a2('0x36'),_0x14a2('0x3c'),_0x25ce81,_0x14a2('0x37'),_0x14a2('0x3d')],squel[_0x14a2('0x38')]()[_0x14a2('0x39')](_0x14a2('0x1f'),'phone')[_0x14a2('0x39')]('id',_0x14a2('0x36'))[_0x14a2('0x39')](LISTID[_0x14a2('0x3b')](),_0x14a2('0x3c'))[_0x14a2('0x39')](_0xdcdec5['id']['toString'](),_0x25ce81)[_0x14a2('0x39')]('NOW()',_0x14a2('0x37'))['field']('NOW()',_0x14a2('0x3d'))[_0x14a2('0x44')](_0x14a2('0x3e'))['where'](_0x14a2('0x40'))['where']('ListId\x20=\x20?',LISTID[_0x14a2('0x3b')]())[_0x14a2('0x3f')](_0x14a2('0x46'),squel[_0x14a2('0x49')](hopperContacts))[_0x14a2('0x3f')](_0x14a2('0x42')))[_0x14a2('0x3b')]();return _0x330d13;}return db[_0x14a2('0x4b')][_0x14a2('0x4c')]({'where':{'type':_0x14a2('0x4d')},'attributes':['id',_0x14a2('0x4e')],'include':[{'model':db[_0x14a2('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0x14a2('0x2c')](function(_0x3d8730){var _0x8a9fa7=[];if(_0x3d8730){var _0x528490;for(var _0x14c1ba=0x0,_0x94e0d8;_0x14c1ba<_0x3d8730['length'];_0x14c1ba+=0x1){_0x94e0d8=_0x3d8730[_0x14c1ba][_0x14a2('0x50')]({'plain':!![]});switch(_0x94e0d8[_0x14a2('0x4e')]){case _0x14a2('0x51'):_0x8a9fa7['push'](db[_0x14a2('0x52')][_0x14a2('0x53')](_0x117320(_0x94e0d8,'VoiceQueueId'))[_0x14a2('0x2c')](function(){})[_0x14a2('0x54')](_0x1bddfd()));break;case _0x14a2('0x55'):_0x8a9fa7[_0x14a2('0x56')](db[_0x14a2('0x52')][_0x14a2('0x53')](_0x114b6e(_0x94e0d8,_0x14a2('0x57')))['then'](function(){})['catch'](_0x1bddfd()));break;default:_0x8a9fa7[_0x14a2('0x56')](db[_0x14a2('0x52')][_0x14a2('0x53')](_0x4554eb(_0x94e0d8,'VoiceQueueId'))['then'](function(){})['catch'](_0x1bddfd()));}}}return _0x8a9fa7;})[_0x14a2('0x58')]()[_0x14a2('0x2c')](function(){return db[_0x14a2('0x4b')][_0x14a2('0x4c')]({'where':{'type':_0x14a2('0x4d')},'attributes':['id'],'include':[{'model':db[_0x14a2('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x14a2('0x2c')](function(_0x5d7686){var _0x3671a9=[];if(_0x5d7686){var _0x2984f1;for(var _0x21f89a=0x0,_0xd3427d;_0x21f89a<_0x5d7686[_0x14a2('0x1a')];_0x21f89a+=0x1){_0xd3427d=_0x5d7686[_0x21f89a][_0x14a2('0x50')]({'plain':!![]});_0x3671a9[_0x14a2('0x56')](db['sequelize'][_0x14a2('0x53')](_0x1bd7e4(_0xd3427d,_0x14a2('0x57')))['then'](function(){})[_0x14a2('0x54')](_0x1bddfd()));}}return _0x3671a9;})[_0x14a2('0x58')]();})[_0x14a2('0x2c')](function(){return db[_0x14a2('0x59')][_0x14a2('0x4c')]({'attributes':['id',_0x14a2('0x4e')],'include':[{'model':db[_0x14a2('0x4f')],'as':_0x14a2('0x5a'),'where':{'id':LISTID}}]})[_0x14a2('0x2c')](function(_0x3abd4a){var _0x29d309=[];if(_0x3abd4a){for(var _0x32e973=0x0,_0x13b5e0;_0x32e973<_0x3abd4a[_0x14a2('0x1a')];_0x32e973+=0x1){_0x13b5e0=_0x3abd4a[_0x32e973][_0x14a2('0x50')]({'plain':!![]});switch(_0x13b5e0['dialCheckDuplicateType']){case _0x14a2('0x51'):_0x29d309['push'](db['sequelize'][_0x14a2('0x53')](_0x117320(_0x13b5e0,_0x14a2('0x5b')))[_0x14a2('0x2c')](function(){})['catch'](_0x1bddfd()));break;case'onlyIfOpen':_0x29d309[_0x14a2('0x56')](db['sequelize'][_0x14a2('0x53')](_0x114b6e(_0x13b5e0,'CampaignId'))[_0x14a2('0x2c')](function(){})['catch'](_0x1bddfd()));break;default:_0x29d309[_0x14a2('0x56')](db['sequelize']['query'](_0x4554eb(_0x13b5e0,_0x14a2('0x5b')))['then'](function(){})[_0x14a2('0x54')](_0x1bddfd()));}}}return _0x29d309;})[_0x14a2('0x58')]();})[_0x14a2('0x2c')](function(){return db[_0x14a2('0x59')][_0x14a2('0x4c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x14a2('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x5c47b1){var _0x54c089=[];if(_0x5c47b1){for(var _0x2fe23c=0x0,_0x4be5a1;_0x2fe23c<_0x5c47b1[_0x14a2('0x1a')];_0x2fe23c+=0x1){_0x4be5a1=_0x5c47b1[_0x2fe23c][_0x14a2('0x50')]({'plain':!![]});_0x54c089[_0x14a2('0x56')](db[_0x14a2('0x52')]['query'](_0x1bd7e4(_0x4be5a1,_0x14a2('0x5b')))[_0x14a2('0x2c')](function(){})[_0x14a2('0x54')](_0x1bddfd()));}}return _0x54c089;})[_0x14a2('0x58')]();})[_0x14a2('0x54')](function(_0x141952){logger['error'](_0x14a2('0x5d'),_0x14a2('0x5e'),_0x141952[_0x14a2('0x2f')]);});}var processPromises=function(_0x5edf4c){return BPromise['all'](promises)[_0x14a2('0x2c')](function(_0x2cc9a3){})['catch'](function(_0x2504cd){logger['error'](_0x14a2('0x5f'),JSON[_0x14a2('0x60')](_0x2504cd));})[_0x14a2('0x61')](function(){socket['emit'](_0x14a2('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5edf4c){return _0x5edf4c[_0x14a2('0x63')]();}});};var endCsv=function(){return BPromise[_0x14a2('0x64')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x14a2('0x2c')](function(){socket[_0x14a2('0x65')](_0x14a2('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x14a2('0x66')](FILEPATH);}catch(_0x28b086){logger[_0x14a2('0x15')](_0x14a2('0x67'),JSON[_0x14a2('0x60')](_0x28b086));}finally{process[_0x14a2('0x68')](0x0);}});};process['on'](_0x14a2('0x69'),function(){logger[_0x14a2('0x6a')](_0x14a2('0x6b'));endCsv();});function main(){return BPromise[_0x14a2('0x64')]()[_0x14a2('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x14a2('0x13')](',');return db[_0x14a2('0x29')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x14a2('0x2c')](function(_0x24d167){var _0x32cf81=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x14a2('0x6c')](_0x32cf81,{'header':!![],'skipEmptyLines':!![],'step':function(_0x338dda,_0xcbed3d){total+=0x1;var _0x26586e=total;promises[_0x14a2('0x56')](checkRow(_0x338dda,_0x24d167,_0x26586e)[_0x14a2('0x2c')](function(){success+=0x1;})['catch'](function(_0xffb5db){if(_0xffb5db[_0x14a2('0x15')]){errors+=0x1;delete _0xffb5db['error'];}else if(_0xffb5db[_0x14a2('0x27')]){duplicates+=0x1;delete _0xffb5db[_0x14a2('0x27')];}rows[_0x14a2('0x56')](_0xffb5db);}));if(total%0xc8===0x0){_0xcbed3d[_0x14a2('0x6d')]();return processPromises(_0xcbed3d);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x14a2('0x6e'));endCsv();});},'error':function(_0x4871af,_0x1a3890){logger['info'](_0x14a2('0x6f'),JSON['stringify'](_0x4871af));endCsv();}});})[_0x14a2('0x54')](function(_0x9c3bc7){logger[_0x14a2('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x9c3bc7));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7bc9315..8cb2a98 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 _0x3886=['createdAt','priority','UserId','recallme','select','fields','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_contacts.updatedAt','cm_hopper_black','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','into','updatedAt','cm_contacts','\x22onlyIfOpen\x22','insert','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','id\x20IN\x20?','MIN(id)','min_id','group','info','message','exit','code','sequelize','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','query','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','dialTimezone','main','stringify','send','clone','socket_timestamp','root','server/files/tmp','keys','includes','header','name','_description','writeFileSync','parse','createReadStream','data','rows','errors','find','hasOwnProperty','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','trim','description','replace','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','arguments\x20\x20\x20','argv','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','localhost','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','\x20=\x20','join','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','filter','CmContactHasItem','update','updated','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId'];(function(_0x1343dc,_0x3ff82c){var _0x48a00c=function(_0x1c1325){while(--_0x1c1325){_0x1343dc['push'](_0x1343dc['shift']());}};_0x48a00c(++_0x3ff82c);}(_0x3886,0x13e));var _0x6388=function(_0x4869d4,_0x175984){_0x4869d4=_0x4869d4-0x0;var _0x2b6d92=_0x3886[_0x4869d4];return _0x2b6d92;};'use strict';var fs=require('fs');var path=require(_0x6388('0x0'));var _=require(_0x6388('0x1'));var Papa=require(_0x6388('0x2'));var util=require(_0x6388('0x3'));var BPromise=require('bluebird');var moment=require(_0x6388('0x4'));var squel=require(_0x6388('0x5'));var Redis=require(_0x6388('0x6'));var db=require(_0x6388('0x7'))['db'];var config=require(_0x6388('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x6388('0x9'))(_0x6388('0xa'));config['redis']=_[_0x6388('0xb')](config['redis'],{'host':_0x6388('0xc'),'port':0x18eb});var socket=require(_0x6388('0xd'))(new Redis(config[_0x6388('0xe')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6388('0xf')](_0x6388('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6388('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x1c120d){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))*$/[_0x6388('0x11')](_0x1c120d);}function selectNotIn(_0x7b32a6,_0x4b7f76,_0x551ac2,_0xe71346,_0x3ca0cd){return squel['select']()[_0x6388('0x12')](_0x6388('0x13'))[_0x6388('0x14')](_0xe71346)['join'](_0x4b7f76,null,_0x4b7f76+'.id\x20=\x20'+_0xe71346+'.'+_0x551ac2)['where'](_0xe71346+'.'+_0x551ac2+_0x6388('0x15')+_0x7b32a6+'.'+_0x551ac2)['where'](_0x4b7f76+'.dialCheckDuplicateType\x20IN\x20('+_0x3ca0cd[_0x6388('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x57a57f,_0x148d73){promisesAdditionalPhones=[];return db[_0x6388('0x17')][_0x6388('0x18')]({'raw':!![],'attributes':['id',_0x6388('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6388('0x1a')](function(_0xdfcb90){if(_0xdfcb90!==null){var _0x29bc09=[];for(var _0x3894e6=0x0;_0x3894e6<_0xdfcb90['length'];_0x3894e6++){var _0x5981f6=_0xdfcb90[_0x3894e6];_0x29bc09[_0x6388('0x1b')](insertAdditionalPhones(_0x5981f6));}}Promise[_0x6388('0x1c')](_0x29bc09)[_0x6388('0x1a')](function(){_0x57a57f({'val':0x1});});});});}function insertAdditionalPhones(_0x2d581f){return new Promise(function(_0x230e42,_0x43e971){var _0xd65e58=_0x2d581f[_0x6388('0x19')];var _0x1206ba=_0xd65e58[_0x6388('0x1d')](';');var _0x288151=[];orderBy=0x0;for(var _0x2b66b4=0x0;_0x2b66b4<_0x1206ba[_0x6388('0x1e')];_0x2b66b4++){_0x288151[_0x6388('0x1b')](splitAdditionalPhone(_0x2d581f['id'],_0x1206ba[_0x2b66b4]));}Promise['all'](_0x288151)['then'](function(){_0x230e42({'val':_0x1206ba[_0x6388('0x1e')]});});});}function splitAdditionalPhone(_0xd1832,_0x4100b7){return new Promise(function(_0x554cfa,_0x3546a7){var _0x362456=_0x4100b7[_0x6388('0x1d')](':');var _0x5b2559=_0x362456[0x0];var _0x4227ac=_0x362456[0x1];if(!_[_0x6388('0x1f')](_0x4227ac)){var _0x4a9bee=_0x4227ac[_0x6388('0x1d')]('|');var _0x3222b5=[];for(var _0x2bcebb=0x0;_0x2bcebb<_0x4a9bee[_0x6388('0x1e')];_0x2bcebb++){if(_0x4a9bee[_0x2bcebb]!==''){var _0x1b455c=_[_0x6388('0x20')](promisesAdditionalPhones,{'contactId':_0xd1832,'phone':_0x4a9bee[_0x2bcebb]});if(_0x1b455c[_0x6388('0x1e')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xd1832,'contactTypeId':_0x5b2559,'phone':_0x4a9bee[_0x2bcebb],'orderBy':orderBy});}}}_0x554cfa({'ok':0x1});}else _0x554cfa({'res':0x0});});}function createAdditionalPhone(_0x972efe,_0x3d850d,_0x4de78c,_0x3af0f2){var _0x3ad53f='';var _0x149397='';var _0x27fce5=_0x4de78c[_0x6388('0x1d')]('§');_0x3ad53f=_0x27fce5[0x0];if(_0x27fce5[_0x6388('0x1e')]==0x2)_0x149397=_0x27fce5[0x1];return new Promise(function(_0x311653,_0x3139f6){return db[_0x6388('0x21')]['findOne']({'where':{'CmContactId':_0x972efe,'item':_0x3ad53f}})['then'](function(_0x111aec){if(_0x111aec){return db[_0x6388('0x21')][_0x6388('0x22')]({'ItemTypeId':_0x3d850d,'description':_0x149397,'OrderBy':_0x3af0f2},{'where':{'CmContactId':_0x972efe,'item':_0x3ad53f}})[_0x6388('0x1a')](function(_0x311470){_0x311653({'res':_0x6388('0x23')});});}else{return db[_0x6388('0x21')]['create']({'CmContactId':_0x972efe,'item':_0x3ad53f,'description':_0x149397,'ItemTypeId':_0x3d850d,'OrderBy':_0x3af0f2,'ItemClass':'PHONE'})[_0x6388('0x1a')](function(_0x12af85){_0x311653({'res':_0x6388('0x24')});});}});});}function insertCmHopper(_0x54931d,_0xcf9b41,_0x19310f,_0x5d7147,_0x1656bb){var _0x7a5f3d=['cm_contacts.phone',_0x6388('0x25'),_0x6388('0x26'),_0x6388('0x27'),_0xcf9b41+'.'+_0x5d7147,_0x6388('0x28'),'cm_contacts.updatedAt',_0x6388('0x29'),_0x6388('0x2a'),'\x22'+_0x1656bb+'\x22'];return squel['insert']()['into'](_0x6388('0x2b'))[_0x6388('0x2c')]([_0x6388('0x13'),_0x6388('0x2d'),_0x6388('0x2e'),_0x6388('0x2f'),_0x5d7147,_0x6388('0x30'),'updatedAt',_0x6388('0x31'),_0x6388('0x32'),_0x6388('0x33')],squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x7a5f3d)['from'](_0xcf9b41)[_0x6388('0x16')]('cm_contacts',null,_0x6388('0x36')+_0xcf9b41+_0x6388('0x37'))[_0x6388('0x16')](_0x19310f,null,_0x19310f+_0x6388('0x38')+_0xcf9b41+'.'+_0x5d7147)[_0x6388('0x39')](_0xcf9b41+_0x6388('0x3a'),_0x54931d)[_0x6388('0x39')](_0x6388('0x3b'),NOW)[_0x6388('0x39')](_0x6388('0x3c'),selectNotIn(_0xcf9b41,_0x19310f,_0x5d7147,_0x6388('0x2b'),[_0x6388('0x3d'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xcf9b41,_0x19310f,_0x5d7147,'cm_hopper',[_0x6388('0x3d')])))[_0x6388('0x3e')]();}function insertCmHopperBlack(_0x25e49c,_0x4efef3,_0x5b719e,_0xa2deac){var _0x239200=[_0x6388('0x3f'),_0x6388('0x26'),_0x6388('0x27'),_0x4efef3+'.'+_0xa2deac,'cm_contacts.createdAt',_0x6388('0x40')];return squel['insert']()['into'](_0x6388('0x41'))[_0x6388('0x2c')]([_0x6388('0x13'),'ContactId','ListId',_0xa2deac,_0x6388('0x30'),'updatedAt'],squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x239200)['from'](_0x4efef3)[_0x6388('0x16')]('cm_contacts',null,_0x6388('0x36')+_0x4efef3+_0x6388('0x37'))[_0x6388('0x16')](_0x5b719e,null,_0x5b719e+_0x6388('0x38')+_0x4efef3+'.'+_0xa2deac)['where'](_0x4efef3+'.CmListId\x20=\x20?',_0x25e49c)[_0x6388('0x39')](_0x6388('0x3b'),NOW)[_0x6388('0x39')](_0x6388('0x3c'),squel['select']()[_0x6388('0x12')](_0x6388('0x13'))[_0x6388('0x14')](_0x6388('0x41'))[_0x6388('0x39')](_0x6388('0x42'),_0x25e49c)[_0x6388('0x39')](_0xa2deac+_0x6388('0x15')+_0x4efef3+'.'+_0xa2deac)))[_0x6388('0x3e')]();}function insertTzCmHopper(_0x4dbf8d,_0x3fc23c,_0x55be06,_0x26ebd3,_0x409018,_0x37d19f){var _0x3aadcb=[_0x6388('0x3f'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x37d19f+_0x6388('0x43'),_0x6388('0x26'),_0x6388('0x27'),_0x3fc23c+'.'+_0x26ebd3,'cm_contacts.createdAt',_0x6388('0x40'),'cm_contacts.priority',_0x6388('0x2a'),'\x22'+_0x409018+'\x22'];var _0x2842aa=squel['insert']()[_0x6388('0x44')]('cm_hopper')[_0x6388('0x2c')]([_0x6388('0x13'),_0x6388('0x2d'),_0x6388('0x2e'),_0x6388('0x2f'),_0x26ebd3,_0x6388('0x30'),_0x6388('0x45'),'priority','UserId','recallme'],squel['select']()[_0x6388('0x35')](_0x3aadcb)['from'](_0x3fc23c)[_0x6388('0x16')](_0x6388('0x46'),null,_0x6388('0x36')+_0x3fc23c+_0x6388('0x37'))[_0x6388('0x16')](_0x55be06,null,_0x55be06+_0x6388('0x38')+_0x3fc23c+'.'+_0x26ebd3)[_0x6388('0x16')](_0x37d19f,null,_0x37d19f+_0x6388('0x38')+_0x3fc23c+'.'+_0x26ebd3)[_0x6388('0x39')](_0x3fc23c+_0x6388('0x3a'),_0x4dbf8d)[_0x6388('0x39')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3fc23c,_0x55be06,_0x26ebd3,_0x6388('0x2b'),[_0x6388('0x3d'),_0x6388('0x47')]))[_0x6388('0x39')](_0x6388('0x3c'),selectNotIn(_0x3fc23c,_0x55be06,_0x26ebd3,'cm_hopper',[_0x6388('0x3d')])))['toString']();return _0x2842aa;}function insertTzCmHopperBlack(_0x7b0c58,_0x26339b,_0x147b51,_0x3352ef){var _0x394cd1=[_0x6388('0x3f'),_0x6388('0x26'),_0x6388('0x27'),_0x26339b+'.'+_0x3352ef,_0x6388('0x28'),'cm_contacts.updatedAt'];return squel[_0x6388('0x48')]()[_0x6388('0x44')]('cm_hopper_black')[_0x6388('0x2c')]([_0x6388('0x13'),_0x6388('0x2e'),_0x6388('0x2f'),_0x3352ef,_0x6388('0x30'),_0x6388('0x45')],squel['select']()[_0x6388('0x35')](_0x394cd1)[_0x6388('0x14')](_0x26339b)[_0x6388('0x16')](_0x6388('0x46'),null,'cm_contacts.ListId\x20=\x20'+_0x26339b+_0x6388('0x37'))[_0x6388('0x16')](_0x147b51,null,_0x147b51+_0x6388('0x38')+_0x26339b+'.'+_0x3352ef)[_0x6388('0x39')](_0x26339b+_0x6388('0x3a'),_0x7b0c58)[_0x6388('0x39')](_0x6388('0x3b'),NOW)[_0x6388('0x39')](_0x6388('0x3c'),squel[_0x6388('0x34')]()[_0x6388('0x12')]('phone')[_0x6388('0x14')](_0x6388('0x41'))['where']('ListId\x20=\x20?',_0x7b0c58)['where'](_0x3352ef+'\x20=\x20'+_0x26339b+'.'+_0x3352ef)))['toString']();}function insertCmHopperAdditionalPhones(_0x9544b5){var _0x4a425a=[_0x6388('0x49'),_0x6388('0x4a'),_0x6388('0x4b'),_0x6388('0x4c'),_0x6388('0x4d')];return squel[_0x6388('0x48')]()[_0x6388('0x44')]('cm_hopper_additional_phones')[_0x6388('0x2c')]([_0x6388('0x4e'),_0x6388('0x13'),_0x6388('0x4f'),_0x6388('0x30'),_0x6388('0x45')],squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x4a425a)[_0x6388('0x14')]('cm_hopper')['join'](_0x6388('0x46'),null,_0x6388('0x50'))[_0x6388('0x16')]('cm_contact_has_items',null,_0x6388('0x51'))[_0x6388('0x39')](_0x6388('0x52'),_0x9544b5)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x6388('0x3e')]();}function insertCmContact(_0x4180b5,_0x41173e,_0x2895f8,_0x3c9159){var _0x35df3e=_[_0x6388('0x53')](_['keys'](_0x3c9159),[_0x6388('0x2f'),'CompanyId',_0x6388('0x30'),_0x6388('0x45'),'scheduledAt']);return squel[_0x6388('0x48')]()[_0x6388('0x44')](_0x6388('0x46'))[_0x6388('0x2c')](_0x35df3e,squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x35df3e)[_0x6388('0x14')](_0x41173e)[_0x6388('0x39')]('('+_0x2895f8[_0x6388('0x16')](',')+')\x20NOT\x20IN\x20?',squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x2895f8)[_0x6388('0x14')](_0x6388('0x46'))[_0x6388('0x39')]('ListId\x20=\x20?',_0x4180b5)[_0x6388('0x39')]('deletedAt\x20IS\x20NULL'))[_0x6388('0x39')](_0x6388('0x54'),squel[_0x6388('0x34')]()[_0x6388('0x12')](_0x6388('0x55'),_0x6388('0x56'))[_0x6388('0x14')](_0x41173e)[_0x6388('0x57')](_0x2895f8['join'](','))))['toString']();}function handleStop(){logger[_0x6388('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4a570c){logger['error'](_0x4a570c[_0x6388('0x59')]);process[_0x6388('0x5a')](0x1);}function handleError(_0x2a845c,_0x137aea){stats['errors'][_0x6388('0x1b')]({'name':_0x137aea[_0x6388('0x5b')],'message':_0x137aea[_0x6388('0x59')],'row':_0x2a845c});}function handleQuery(_0x524ef3){logger['info'](_0x524ef3);return db[_0x6388('0x5c')]['query'](_0x524ef3)['spread'](function(_0x1ca752){results[_0x6388('0x1b')](_0x1ca752);})[_0x6388('0x5d')](function(_0x3ebe12){logger[_0x6388('0x5e')](_0x3ebe12[_0x6388('0x59')]);});}function updateTzCampaigns(_0x731584){return new Promise(function(_0x37e732,_0x44d9f3){var _0x2a8c05=squel['select']()['fields']([_0x6388('0x5f'),_0x6388('0x60')])['from'](_0x6388('0x61'))['join'](_0x6388('0x62'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x6388('0x39')](_0x6388('0x63')+_0x731584);db['sequelize'][_0x6388('0x64')](_0x2a8c05['toString']())[_0x6388('0x65')](function(_0xacd6b){var _0x3ac3d8=[];for(var _0x2cf7ed=0x0;_0x2cf7ed<_0xacd6b[_0x6388('0x1e')];_0x2cf7ed++){_0x3ac3d8['push'](getTimezoneData(_0xacd6b[_0x2cf7ed],tmp_campaigns));}BPromise[_0x6388('0x1c')](_0x3ac3d8)[_0x6388('0x1a')](function(){_0x37e732({'val':0x1});});})[_0x6388('0x5d')](function(_0x39d777){logger[_0x6388('0x5e')](_0x39d777[_0x6388('0x59')]);_0x37e732({'val':0x0});});});}function updateTzVoiceQueues(_0x42ce5b){return new Promise(function(_0x1d6d98,_0x58d1aa){var _0x360e94=squel['select']()['fields']([_0x6388('0x66'),_0x6388('0x67')])[_0x6388('0x14')]('voice_queues')[_0x6388('0x16')](_0x6388('0x68'),null,_0x6388('0x69'))[_0x6388('0x39')](_0x6388('0x6a')+_0x42ce5b);db['sequelize'][_0x6388('0x64')](_0x360e94[_0x6388('0x3e')]())[_0x6388('0x65')](function(_0x137f3e){var _0x3746bd=[];for(var _0x2c2fc1=0x0;_0x2c2fc1<_0x137f3e[_0x6388('0x1e')];_0x2c2fc1++){_0x3746bd[_0x6388('0x1b')](getTimezoneData(_0x137f3e[_0x2c2fc1],tmp_voice_queues));}BPromise[_0x6388('0x1c')](_0x3746bd)['then'](function(){_0x1d6d98({'val':0x1});});})[_0x6388('0x5d')](function(_0x5dc11a){logger[_0x6388('0x5e')](_0x5dc11a['message']);_0x1d6d98({'val':0x0});});});}function getTimezoneData(_0x44f797,_0x24a68b){return new Promise(function(_0x5d1406,_0x4c560a){var _0x390cd8=shared[_0x6388('0x6b')];var _0xc4bbca=_0x390cd8[_0x44f797['dialTimezone']];if(_['isNil'](_0xc4bbca)){_0x5d1406({'ret':0x1});}else{var _0x5822da=_0xc4bbca[_0x6388('0x6c')];var _0x53691c=squel['insert']()['into'](_0x24a68b)[_0x6388('0x6d')]('id',_0x44f797['id'])['set']('offset',_0x5822da)['set'](_0x6388('0x6e'),_0x44f797[_0x6388('0x6e')])[_0x6388('0x3e')]();return db[_0x6388('0x5c')]['query'](_0x53691c)[_0x6388('0x65')](function(_0x54c6b3){_0x5d1406({'ret':0x1});})[_0x6388('0x5d')](function(_0x2511a5){logger[_0x6388('0x5e')](_0x2511a5[_0x6388('0x59')]);_0x4c560a({'ret':0x1});});}});}function handleTZQuery(_0x5ad4de){logger[_0x6388('0x58')](_0x5ad4de);return db['sequelize'][_0x6388('0x64')](_0x5ad4de)[_0x6388('0x65')](function(_0x5390d6){})[_0x6388('0x5d')](function(_0x20b363){logger[_0x6388('0x5e')](_0x20b363[_0x6388('0x59')]);});}function main(_0x2d8363,_0x488427,_0xa9b5a5,_0x59d3b0){logger[_0x6388('0x58')](_0x6388('0x6f'),_0x2d8363,JSON[_0x6388('0x70')](_0x488427));process[_0x6388('0x71')]('start');var _0x236061=_0x488427['binding'];var _0x18b4a8=_[_0x6388('0x72')](_0x236061);var _0x4d531b=_0x488427[_0x6388('0x73')];var _0x1d190f=path[_0x6388('0x16')](config[_0x6388('0x74')],_0x6388('0x75'),_0x4d531b+'.csv');hasTZ=_[_0x6388('0x76')](_0x236061)[_0x6388('0x77')](_0x6388('0x6e'));var _0x45cba8=_[_0x6388('0x76')](_0x236061)[_0x6388('0x16')]();logger[_0x6388('0x58')](_0x6388('0x78'),_0x45cba8);db['ContactItemType'][_0x6388('0x18')]({'raw':!![],'attributes':['id',_0x6388('0x79')]})[_0x6388('0x1a')](function(_0xc4ef0a){for(var _0x6d4fc=0x0;_0x6d4fc<_0xc4ef0a['length'];_0x6d4fc++){if(_0xc4ef0a[_0x6d4fc]['name']in _0x236061){contactItemTypes['push'](_0xc4ef0a[_0x6d4fc]);delete _0x18b4a8[_0xc4ef0a[_0x6d4fc]['name']];hasAdditionalPhones=!![];}for(var _0x360aab in _0x236061){if(_0xc4ef0a[_0x6d4fc]['name']+_0x6388('0x7a')===_0x360aab){phoneDescriptions['push']({'itemTypeId':_0xc4ef0a[_0x6d4fc]['id'],'description':_0x360aab});delete _0x18b4a8[_0x360aab];}}}if(hasAdditionalPhones)_0x18b4a8[_0x6388('0x19')]='';var _0x3d29e5=_[_0x6388('0x76')](_0x18b4a8)[_0x6388('0x16')]();logger[_0x6388('0x58')](_0x6388('0x78'),_0x3d29e5);fs[_0x6388('0x7b')](_0x1d190f,_0x3d29e5+'\x0a');Papa[_0x6388('0x7c')](fs[_0x6388('0x7d')](_0x2d8363),{'header':!![],'skipEmptyLines':!![],'step':function(_0x20dcd3,_0xdc2de6){try{for(var _0xc8bce5=0x0,_0xf62aee=[];_0xc8bce5<_0x20dcd3[_0x6388('0x7e')][_0x6388('0x1e')];_0xc8bce5++){stats[_0x6388('0x7f')]+=0x1;if(_0x20dcd3[_0x6388('0x80')][_0xc8bce5]){handleError(_0x20dcd3[_0x6388('0x7e')][_0xc8bce5],_0x20dcd3['errors'][_0xc8bce5]);}else{var _0x31d1e3=[];var _0x84af50=[];var _0x5a0171={};for(var _0x1d11f5 in _0x236061){let _0x3be217=contactItemTypes[_0x6388('0x81')](_0x585bd4=>_0x585bd4[_0x6388('0x79')]===_0x1d11f5);let _0x44bcfd=contactItemTypes['find'](_0x36b40e=>_0x36b40e[_0x6388('0x79')]+'_description'===_0x1d11f5);if(_[_0x6388('0x1f')](_0x3be217)&&_[_0x6388('0x1f')](_0x44bcfd)){if(_0x236061[_0x6388('0x82')](_0x1d11f5)){if(_0x20dcd3[_0x6388('0x7e')][_0xc8bce5][_0x236061[_0x1d11f5]]){var _0xb8d7a8=_['trim'](_0x20dcd3[_0x6388('0x7e')][_0xc8bce5][_0x236061[_0x1d11f5]]['replace'](/"/g,'\x27'));switch(_0x1d11f5){case'scheduledat':var _0x59be8f=moment(_0xb8d7a8,_0x6388('0x10'),!![]);if(_0x59be8f[_0x6388('0x83')]()){_0xf62aee[_0x6388('0x1b')]('\x22'+_0xb8d7a8+'\x22');}else{_0x31d1e3[_0x6388('0x1b')](_0x6388('0x84'));}break;case _0x6388('0x31'):var _0x13ee29=parseInt(_0xb8d7a8);_0xb8d7a8=_[_0x6388('0x85')](_0x13ee29)||_0x13ee29<0x0||_0x13ee29>0x4?_0x59d3b0?0x3:0x2:_0x13ee29;_0xf62aee[_0x6388('0x1b')]('\x22'+_0xb8d7a8+'\x22');break;case'UserId':var _0x1612ef=parseInt(_0xb8d7a8);if(_[_0x6388('0x86')](_0x1612ef)&&_[_0x6388('0x77')](_0xa9b5a5,_0x1612ef)){_0xf62aee[_0x6388('0x1b')]('\x22'+_0x1612ef+'\x22');}else{_0x31d1e3['push']('agent\x20not\x20exists');}break;case _0x6388('0x87'):if(isEmail(_0xb8d7a8)){_0xf62aee[_0x6388('0x1b')]('\x22'+_0xb8d7a8+'\x22');}else{_0x31d1e3[_0x6388('0x1b')]('email\x20wrong\x20format');}break;case _0x6388('0x88'):var _0x393732=moment(_0xb8d7a8,'YYYY-MM-DD',!![]);if(_0x393732['isValid']()){_0xf62aee['push']('\x22'+_0xb8d7a8+'\x22');}else{_0x31d1e3[_0x6388('0x1b')](_0x6388('0x89'));}break;case'dialTimezone':var _0x4ebcc4=shared[_0x6388('0x6b')];var _0x486681=_0x4ebcc4[_0xb8d7a8];if(!_[_0x6388('0x1f')](_0x486681)){var _0x263f67=_0x486681[_0x6388('0x6c')];_0xf62aee['push']('\x22'+_0xb8d7a8+'\x22');_0xf62aee['push']('\x22'+_0x263f67+'\x22');}break;default:_0xf62aee[_0x6388('0x1b')]('\x22'+_0xb8d7a8+'\x22');}}else{switch(_0x1d11f5){case _0x6388('0x8a'):case'phone':_0x31d1e3['push'](_0x1d11f5+_0x6388('0x8b'));break;default:_0xf62aee['push']('\x22\x22');}}}}else{var _0x1af0a1='';if(!_[_0x6388('0x1f')](_0x3be217)){if(!_0x5a0171['hasOwnProperty'](_0x3be217['id'])){if(!_[_0x6388('0x1f')](_0x20dcd3['data'][_0xc8bce5][_0x236061[_0x1d11f5]])){var _0xb8d7a8=_['trim'](_0x20dcd3['data'][_0xc8bce5][_0x236061[_0x1d11f5]]['replace'](/"/g,'\x27'));var _0x2f5b8d=phoneDescriptions[_0x6388('0x81')](_0xad7361=>_0xad7361[_0x6388('0x8c')]===_0x3be217['id']);if(!_[_0x6388('0x1f')](_0x2f5b8d)){var _0x152157=_[_0x6388('0x8d')](_0x20dcd3[_0x6388('0x7e')][_0xc8bce5][_0x236061[_0x2f5b8d[_0x6388('0x8e')]]][_0x6388('0x8f')](/"/g,'\x27'));if(!_[_0x6388('0x1f')](_0x152157))_0xb8d7a8=_0xb8d7a8+'§'+_0x152157;}if(_0x1af0a1=='')_0x1af0a1=_0xb8d7a8;else _0x1af0a1+='|'+_0xb8d7a8;}_0x84af50[_0x6388('0x1b')](_0x3be217['id']+':'+_0x1af0a1);_0x5a0171[_0x3be217['id']]=0x1;}}}}if(hasAdditionalPhones){_0xf62aee['push']('\x22'+_0x84af50[_0x6388('0x16')](';')+'\x22');}if(_0x31d1e3[_0x6388('0x1e')]){handleError(_0x20dcd3[_0x6388('0x7e')][_0xc8bce5],{'code':_0x6388('0x90'),'message':_0x31d1e3[_0x6388('0x16')]()});}else{fs[_0x6388('0x91')](_0x1d190f,_0xf62aee[_0x6388('0x16')]()+'\x0a');}_0xf62aee=[];}if(!(stats[_0x6388('0x7f')]%0xc8)){socket[_0x6388('0x92')](_0x6388('0x93')+_0x4d531b,stats);stats['errors']=[];}}if(stopped){logger[_0x6388('0x58')](_0x6388('0x94'));_0xdc2de6[_0x6388('0x95')]();}}catch(_0xaebc0){handleError(_0x20dcd3['data'][_0xc8bce5],{'code':_0x6388('0x96'),'message':_0xaebc0[_0x6388('0x59')]});logger[_0x6388('0x5e')](_0x6388('0x97'),_0xaebc0['message']);}},'complete':function(){try{var _0x294f27=[];var _0xfe2130=[];var _0x15211e='cm_contacts';if(_0x488427[_0x6388('0x98')]&&_0x488427['duplicates'][_0x6388('0x1e')]){_0x15211e='cm_contacts_'+_0x4d531b;_0x294f27[_0x6388('0x1b')](_0x6388('0x99')+_0x15211e+_0x6388('0x9a'));}tmp_campaigns=_0x6388('0x9b')+_0x4d531b;tmp_voice_queues=_0x6388('0x9c')+_0x4d531b;_0xfe2130[_0x6388('0x1b')](_0x6388('0x99')+tmp_campaigns+_0x6388('0x9d'));_0xfe2130['push'](_0x6388('0x99')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x6388('0x9e')](_0xfe2130,handleTZQuery)[_0x6388('0x1a')](function(_0x5bf670){updateTzCampaigns(_0x488427[_0x6388('0x2f')])[_0x6388('0x1a')](function(_0x5abc95){updateTzVoiceQueues(_0x488427['ListId'])[_0x6388('0x1a')](function(_0x197e8a){if(hasTZ)_0x3d29e5=_0x3d29e5[_0x6388('0x8f')](_0x6388('0x6e'),_0x6388('0x9f'));var _0x296f14=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x1d190f,_0x15211e,_0x3d29e5,_0x488427[_0x6388('0x2f')],_0x488427[_0x6388('0xa0')]||null,NOW,NOW);if(_[_0x6388('0x1f')](_0x236061[_0x6388('0x2d')])){_0x296f14+=_0x6388('0xa1');}_0x294f27[_0x6388('0x1b')](_0x296f14);if(_0x488427[_0x6388('0x98')]&&_0x488427[_0x6388('0x98')][_0x6388('0x1e')]){_0x294f27['push'](insertCmContact(_0x488427[_0x6388('0x2f')],_0x15211e,_0x488427[_0x6388('0x98')],_0x236061));_0x294f27[_0x6388('0x1b')](_0x6388('0xa2')+_0x15211e+';');}BPromise[_0x6388('0x9e')](_0x294f27,handleQuery)[_0x6388('0x1a')](function(_0x7c6e1d){BPromise[_0x6388('0x1c')]([handleAdditionalPhones()])[_0x6388('0x1a')](function(){_0x294f27=[];for(var _0x270725=0x0;_0x270725\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','select','field','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','then','length','push','all','AdditionalPhones','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x3e67,0x1ef));var _0x73e6=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x3e67[_0xe8129c];return _0x709fc5;};'use strict';var fs=require('fs');var path=require(_0x73e6('0x0'));var _=require(_0x73e6('0x1'));var Papa=require(_0x73e6('0x2'));var util=require(_0x73e6('0x3'));var BPromise=require(_0x73e6('0x4'));var moment=require(_0x73e6('0x5'));var squel=require(_0x73e6('0x6'));var Redis=require('ioredis');var db=require(_0x73e6('0x7'))['db'];var config=require(_0x73e6('0x8'));var shared=require(_0x73e6('0x9'));var logger=require(_0x73e6('0xa'))(_0x73e6('0xb'));config['redis']=_['defaults'](config[_0x73e6('0xc')],{'host':_0x73e6('0xd'),'port':0x18eb});var socket=require(_0x73e6('0xe'))(new Redis(config[_0x73e6('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x73e6('0xf')]('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()[_0x73e6('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x51f1f4){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'](_0x51f1f4);}function selectNotIn(_0x19ce18,_0x23588d,_0x48c7b6,_0x534e89,_0xcda523){return squel[_0x73e6('0x10')]()[_0x73e6('0x11')]('phone')[_0x73e6('0x12')](_0x534e89)[_0x73e6('0x13')](_0x23588d,null,_0x23588d+'.id\x20=\x20'+_0x534e89+'.'+_0x48c7b6)[_0x73e6('0x14')](_0x534e89+'.'+_0x48c7b6+_0x73e6('0x15')+_0x19ce18+'.'+_0x48c7b6)[_0x73e6('0x14')](_0x23588d+_0x73e6('0x16')+_0xcda523['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2309b1,_0x1c45ca){promisesAdditionalPhones=[];return db['CmContact'][_0x73e6('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x73e6('0x18')](function(_0x146716){if(_0x146716!==null){var _0x5aa688=[];for(var _0x27d6e9=0x0;_0x27d6e9<_0x146716[_0x73e6('0x19')];_0x27d6e9++){var _0x548d32=_0x146716[_0x27d6e9];_0x5aa688[_0x73e6('0x1a')](insertAdditionalPhones(_0x548d32));}}Promise[_0x73e6('0x1b')](_0x5aa688)[_0x73e6('0x18')](function(){_0x2309b1({'val':0x1});});});});}function insertAdditionalPhones(_0x3d1f62){return new Promise(function(_0x284c5d,_0x33438d){var _0xb1d912=_0x3d1f62[_0x73e6('0x1c')];var _0x5c1ab2=_0xb1d912[_0x73e6('0x1d')](';');var _0x48c10d=[];orderBy=0x0;for(var _0x249d2e=0x0;_0x249d2e<_0x5c1ab2['length'];_0x249d2e++){_0x48c10d['push'](splitAdditionalPhone(_0x3d1f62['id'],_0x5c1ab2[_0x249d2e]));}Promise[_0x73e6('0x1b')](_0x48c10d)[_0x73e6('0x18')](function(){_0x284c5d({'val':_0x5c1ab2[_0x73e6('0x19')]});});});}function splitAdditionalPhone(_0x504b16,_0x66f76){return new Promise(function(_0x45d7db,_0x4533e3){var _0x777ac2=_0x66f76['split'](':');var _0x22a67a=_0x777ac2[0x0];var _0x5286a5=_0x777ac2[0x1];if(!_[_0x73e6('0x1e')](_0x5286a5)){var _0x576939=_0x5286a5['split']('|');var _0x1f728f=[];for(var _0x5b057b=0x0;_0x5b057b<_0x576939[_0x73e6('0x19')];_0x5b057b++){if(_0x576939[_0x5b057b]!==''){var _0x32987e=_[_0x73e6('0x1f')](promisesAdditionalPhones,{'contactId':_0x504b16,'phone':_0x576939[_0x5b057b]});if(_0x32987e[_0x73e6('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x73e6('0x1a')]({'contactId':_0x504b16,'contactTypeId':_0x22a67a,'phone':_0x576939[_0x5b057b],'orderBy':orderBy});}}}_0x45d7db({'ok':0x1});}else _0x45d7db({'res':0x0});});}function createAdditionalPhone(_0x87268c,_0x4d1d4d,_0xaff4c1,_0x3d56b5){var _0x418964='';var _0xbc8c2d='';var _0x24b0cc=_0xaff4c1[_0x73e6('0x1d')]('§');_0x418964=_0x24b0cc[0x0];if(_0x24b0cc[_0x73e6('0x19')]==0x2)_0xbc8c2d=_0x24b0cc[0x1];return new Promise(function(_0x49fd67,_0x1d7a18){return db[_0x73e6('0x20')][_0x73e6('0x21')]({'where':{'CmContactId':_0x87268c,'item':_0x418964}})[_0x73e6('0x18')](function(_0xb0ed87){if(_0xb0ed87){return db[_0x73e6('0x20')][_0x73e6('0x22')]({'ItemTypeId':_0x4d1d4d,'description':_0xbc8c2d,'OrderBy':_0x3d56b5},{'where':{'CmContactId':_0x87268c,'item':_0x418964}})[_0x73e6('0x18')](function(_0x205d41){_0x49fd67({'res':_0x73e6('0x23')});});}else{return db['CmContactHasItem'][_0x73e6('0x24')]({'CmContactId':_0x87268c,'item':_0x418964,'description':_0xbc8c2d,'ItemTypeId':_0x4d1d4d,'OrderBy':_0x3d56b5,'ItemClass':_0x73e6('0x25')})[_0x73e6('0x18')](function(_0x410214){_0x49fd67({'res':'inserted'});});}});});}function insertCmHopper(_0x528b7f,_0x19b8ba,_0x2f221b,_0x236d74,_0x53fff2){var _0x2750d2=['cm_contacts.phone',_0x73e6('0x26'),_0x73e6('0x27'),_0x73e6('0x28'),_0x19b8ba+'.'+_0x236d74,_0x73e6('0x29'),_0x73e6('0x2a'),_0x73e6('0x2b'),'cm_contacts.UserId','\x22'+_0x53fff2+'\x22'];return squel['insert']()[_0x73e6('0x2c')](_0x73e6('0x2d'))[_0x73e6('0x2e')](['phone',_0x73e6('0x2f'),_0x73e6('0x30'),_0x73e6('0x31'),_0x236d74,_0x73e6('0x32'),_0x73e6('0x33'),_0x73e6('0x34'),_0x73e6('0x35'),'recallme'],squel['select']()[_0x73e6('0x36')](_0x2750d2)[_0x73e6('0x12')](_0x19b8ba)['join']('cm_contacts',null,_0x73e6('0x37')+_0x19b8ba+_0x73e6('0x38'))[_0x73e6('0x13')](_0x2f221b,null,_0x2f221b+_0x73e6('0x39')+_0x19b8ba+'.'+_0x236d74)[_0x73e6('0x14')](_0x19b8ba+_0x73e6('0x3a'),_0x528b7f)[_0x73e6('0x14')](_0x73e6('0x3b'),NOW)[_0x73e6('0x14')](_0x73e6('0x3c'),selectNotIn(_0x19b8ba,_0x2f221b,_0x236d74,'cm_hopper',['\x22always\x22',_0x73e6('0x3d')]))[_0x73e6('0x14')](_0x73e6('0x3c'),selectNotIn(_0x19b8ba,_0x2f221b,_0x236d74,_0x73e6('0x2d'),[_0x73e6('0x3e')])))[_0x73e6('0x3f')]();}function insertCmHopperBlack(_0xbac9a6,_0xc3ce28,_0x2dbb6c,_0x33fc39){var _0x77f26a=[_0x73e6('0x40'),_0x73e6('0x27'),_0x73e6('0x28'),_0xc3ce28+'.'+_0x33fc39,_0x73e6('0x29'),_0x73e6('0x2a')];return squel[_0x73e6('0x41')]()[_0x73e6('0x2c')](_0x73e6('0x42'))[_0x73e6('0x2e')]([_0x73e6('0x43'),_0x73e6('0x30'),_0x73e6('0x31'),_0x33fc39,'createdAt',_0x73e6('0x33')],squel[_0x73e6('0x10')]()[_0x73e6('0x36')](_0x77f26a)[_0x73e6('0x12')](_0xc3ce28)[_0x73e6('0x13')](_0x73e6('0x44'),null,_0x73e6('0x37')+_0xc3ce28+_0x73e6('0x38'))[_0x73e6('0x13')](_0x2dbb6c,null,_0x2dbb6c+'.id\x20=\x20'+_0xc3ce28+'.'+_0x33fc39)[_0x73e6('0x14')](_0xc3ce28+_0x73e6('0x3a'),_0xbac9a6)['where'](_0x73e6('0x3b'),NOW)[_0x73e6('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x73e6('0x10')]()['field'](_0x73e6('0x43'))[_0x73e6('0x12')](_0x73e6('0x42'))[_0x73e6('0x14')](_0x73e6('0x45'),_0xbac9a6)[_0x73e6('0x14')](_0x33fc39+_0x73e6('0x15')+_0xc3ce28+'.'+_0x33fc39)))['toString']();}function insertTzCmHopper(_0x480491,_0x583a5a,_0x2f19ba,_0x17f88e,_0x4e4fbd,_0x10d8db){var _0x65bc57=['cm_contacts.phone',_0x73e6('0x46')+_0x10d8db+_0x73e6('0x47'),_0x73e6('0x27'),_0x73e6('0x28'),_0x583a5a+'.'+_0x17f88e,'cm_contacts.createdAt',_0x73e6('0x2a'),_0x73e6('0x2b'),'cm_contacts.UserId','\x22'+_0x4e4fbd+'\x22'];var _0x472d7d=squel[_0x73e6('0x41')]()[_0x73e6('0x2c')](_0x73e6('0x2d'))[_0x73e6('0x2e')]([_0x73e6('0x43'),_0x73e6('0x2f'),'ContactId',_0x73e6('0x31'),_0x17f88e,_0x73e6('0x32'),_0x73e6('0x33'),'priority',_0x73e6('0x35'),'recallme'],squel[_0x73e6('0x10')]()['fields'](_0x65bc57)['from'](_0x583a5a)[_0x73e6('0x13')](_0x73e6('0x44'),null,_0x73e6('0x37')+_0x583a5a+_0x73e6('0x38'))['join'](_0x2f19ba,null,_0x2f19ba+_0x73e6('0x39')+_0x583a5a+'.'+_0x17f88e)[_0x73e6('0x13')](_0x10d8db,null,_0x10d8db+_0x73e6('0x39')+_0x583a5a+'.'+_0x17f88e)[_0x73e6('0x14')](_0x583a5a+_0x73e6('0x3a'),_0x480491)[_0x73e6('0x14')](_0x73e6('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x583a5a,_0x2f19ba,_0x17f88e,_0x73e6('0x2d'),[_0x73e6('0x3e'),'\x22onlyIfOpen\x22']))[_0x73e6('0x14')](_0x73e6('0x3c'),selectNotIn(_0x583a5a,_0x2f19ba,_0x17f88e,_0x73e6('0x2d'),['\x22always\x22'])))[_0x73e6('0x3f')]();return _0x472d7d;}function insertTzCmHopperBlack(_0x19134a,_0x4076a8,_0x3f183f,_0x80b5e1){var _0x433fd0=['cm_contacts.phone',_0x73e6('0x27'),'cm_contacts.ListId',_0x4076a8+'.'+_0x80b5e1,_0x73e6('0x29'),_0x73e6('0x2a')];return squel[_0x73e6('0x41')]()[_0x73e6('0x2c')](_0x73e6('0x42'))[_0x73e6('0x2e')](['phone',_0x73e6('0x30'),_0x73e6('0x31'),_0x80b5e1,_0x73e6('0x32'),_0x73e6('0x33')],squel[_0x73e6('0x10')]()[_0x73e6('0x36')](_0x433fd0)[_0x73e6('0x12')](_0x4076a8)[_0x73e6('0x13')](_0x73e6('0x44'),null,_0x73e6('0x37')+_0x4076a8+_0x73e6('0x38'))[_0x73e6('0x13')](_0x3f183f,null,_0x3f183f+_0x73e6('0x39')+_0x4076a8+'.'+_0x80b5e1)[_0x73e6('0x14')](_0x4076a8+_0x73e6('0x3a'),_0x19134a)['where'](_0x73e6('0x3b'),NOW)[_0x73e6('0x14')](_0x73e6('0x3c'),squel[_0x73e6('0x10')]()['field'](_0x73e6('0x43'))[_0x73e6('0x12')]('cm_hopper_black')[_0x73e6('0x14')]('ListId\x20=\x20?',_0x19134a)[_0x73e6('0x14')](_0x80b5e1+_0x73e6('0x15')+_0x4076a8+'.'+_0x80b5e1)))[_0x73e6('0x3f')]();}function insertCmHopperAdditionalPhones(_0x518824){var _0x3ddf8a=[_0x73e6('0x48'),_0x73e6('0x49'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x73e6('0x41')]()[_0x73e6('0x2c')]('cm_hopper_additional_phones')[_0x73e6('0x2e')]([_0x73e6('0x4a'),_0x73e6('0x43'),'OrderBy',_0x73e6('0x32'),_0x73e6('0x33')],squel['select']()[_0x73e6('0x36')](_0x3ddf8a)[_0x73e6('0x12')]('cm_hopper')['join'](_0x73e6('0x44'),null,_0x73e6('0x4b'))['join'](_0x73e6('0x4c'),null,_0x73e6('0x4d'))[_0x73e6('0x14')](_0x73e6('0x4e'),_0x518824)['where'](_0x73e6('0x3b'),NOW))[_0x73e6('0x3f')]();}function insertCmContact(_0x41615f,_0xf119e2,_0x14e79d,_0x4cd771){var _0x4ad011=_[_0x73e6('0x4f')](_[_0x73e6('0x50')](_0x4cd771),['ListId',_0x73e6('0x51'),_0x73e6('0x32'),_0x73e6('0x33'),'scheduledAt']);return squel['insert']()[_0x73e6('0x2c')](_0x73e6('0x44'))[_0x73e6('0x2e')](_0x4ad011,squel['select']()[_0x73e6('0x36')](_0x4ad011)[_0x73e6('0x12')](_0xf119e2)[_0x73e6('0x14')]('('+_0x14e79d[_0x73e6('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x73e6('0x10')]()[_0x73e6('0x36')](_0x14e79d)[_0x73e6('0x12')](_0x73e6('0x44'))[_0x73e6('0x14')](_0x73e6('0x45'),_0x41615f)[_0x73e6('0x14')](_0x73e6('0x52')))[_0x73e6('0x14')](_0x73e6('0x53'),squel[_0x73e6('0x10')]()[_0x73e6('0x11')]('MIN(id)',_0x73e6('0x54'))[_0x73e6('0x12')](_0xf119e2)[_0x73e6('0x55')](_0x14e79d[_0x73e6('0x13')](','))))[_0x73e6('0x3f')]();}function handleStop(){logger[_0x73e6('0x56')](_0x73e6('0x57'));stopped=!![];}function handleUncaughtException(_0x1f8990){logger[_0x73e6('0x58')](_0x1f8990[_0x73e6('0x59')]);process[_0x73e6('0x5a')](0x1);}function handleError(_0x479543,_0x56b137){stats[_0x73e6('0x5b')][_0x73e6('0x1a')]({'name':_0x56b137[_0x73e6('0x5c')],'message':_0x56b137[_0x73e6('0x59')],'row':_0x479543});}function handleQuery(_0x444257){logger[_0x73e6('0x56')](_0x444257);return db[_0x73e6('0x5d')]['query'](_0x444257)[_0x73e6('0x5e')](function(_0x359e13){results[_0x73e6('0x1a')](_0x359e13);})[_0x73e6('0x5f')](function(_0x4552e4){logger['error'](_0x4552e4[_0x73e6('0x59')]);});}function updateTzCampaigns(_0xc776c5){return new Promise(function(_0x124751,_0x33e6ad){var _0x3dbf2c=squel['select']()[_0x73e6('0x36')]([_0x73e6('0x60'),_0x73e6('0x61')])[_0x73e6('0x12')](_0x73e6('0x62'))[_0x73e6('0x13')](_0x73e6('0x63'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x73e6('0x14')](_0x73e6('0x64')+_0xc776c5);db['sequelize'][_0x73e6('0x65')](_0x3dbf2c[_0x73e6('0x3f')]())[_0x73e6('0x5e')](function(_0x351717){var _0x46da7d=[];for(var _0x28d478=0x0;_0x28d478<_0x351717[_0x73e6('0x19')];_0x28d478++){_0x46da7d[_0x73e6('0x1a')](getTimezoneData(_0x351717[_0x28d478],tmp_campaigns));}BPromise[_0x73e6('0x1b')](_0x46da7d)[_0x73e6('0x18')](function(){_0x124751({'val':0x1});});})[_0x73e6('0x5f')](function(_0x4e2631){logger[_0x73e6('0x58')](_0x4e2631[_0x73e6('0x59')]);_0x124751({'val':0x0});});});}function updateTzVoiceQueues(_0x5575ef){return new Promise(function(_0x4eb8b6,_0x4d0c97){var _0x38d0b1=squel['select']()['fields']([_0x73e6('0x66'),_0x73e6('0x67')])[_0x73e6('0x12')](_0x73e6('0x68'))[_0x73e6('0x13')]('voice_queues_has_cm_lists',null,_0x73e6('0x69'))[_0x73e6('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x5575ef);db[_0x73e6('0x5d')]['query'](_0x38d0b1['toString']())[_0x73e6('0x5e')](function(_0x613c84){var _0xf96249=[];for(var _0x48057a=0x0;_0x48057a<_0x613c84[_0x73e6('0x19')];_0x48057a++){_0xf96249[_0x73e6('0x1a')](getTimezoneData(_0x613c84[_0x48057a],tmp_voice_queues));}BPromise[_0x73e6('0x1b')](_0xf96249)[_0x73e6('0x18')](function(){_0x4eb8b6({'val':0x1});});})[_0x73e6('0x5f')](function(_0x2a80f7){logger[_0x73e6('0x58')](_0x2a80f7[_0x73e6('0x59')]);_0x4eb8b6({'val':0x0});});});}function getTimezoneData(_0x484bcc,_0x17936c){return new Promise(function(_0x7bb51a,_0x111ebf){var _0xf28e78=shared['timezones'];var _0x478b89=_0xf28e78[_0x484bcc['dialTimezone']];if(_[_0x73e6('0x1e')](_0x478b89)){_0x7bb51a({'ret':0x1});}else{var _0x3efb41=_0x478b89[_0x73e6('0x6a')];var _0x38a584=squel[_0x73e6('0x41')]()[_0x73e6('0x2c')](_0x17936c)[_0x73e6('0x6b')]('id',_0x484bcc['id'])[_0x73e6('0x6b')](_0x73e6('0x6c'),_0x3efb41)[_0x73e6('0x6b')](_0x73e6('0x6d'),_0x484bcc['dialTimezone'])['toString']();return db[_0x73e6('0x5d')][_0x73e6('0x65')](_0x38a584)[_0x73e6('0x5e')](function(_0x3139e6){_0x7bb51a({'ret':0x1});})['catch'](function(_0x25406e){logger['error'](_0x25406e['message']);_0x111ebf({'ret':0x1});});}});}function handleTZQuery(_0x62ace7){logger[_0x73e6('0x56')](_0x62ace7);return db[_0x73e6('0x5d')][_0x73e6('0x65')](_0x62ace7)['spread'](function(_0x37fc27){})[_0x73e6('0x5f')](function(_0x208435){logger[_0x73e6('0x58')](_0x208435[_0x73e6('0x59')]);});}function main(_0x3b1513,_0x3a78da,_0x3287f8,_0x574e4f){logger[_0x73e6('0x56')](_0x73e6('0x6e'),_0x3b1513,JSON[_0x73e6('0x6f')](_0x3a78da));process['send'](_0x73e6('0x70'));var _0xa77ebb=_0x3a78da[_0x73e6('0x71')];var _0x4c7dcf=_[_0x73e6('0x72')](_0xa77ebb);var _0x444282=_0x3a78da[_0x73e6('0x73')];var _0x127d2e=path['join'](config[_0x73e6('0x74')],'server/files/tmp',_0x444282+_0x73e6('0x75'));hasTZ=_['keys'](_0xa77ebb)['includes'](_0x73e6('0x6d'));var _0x1a19bd=_['keys'](_0xa77ebb)[_0x73e6('0x13')]();logger[_0x73e6('0x56')](_0x73e6('0x76'),_0x1a19bd);db[_0x73e6('0x77')][_0x73e6('0x17')]({'raw':!![],'attributes':['id','name']})[_0x73e6('0x18')](function(_0x32cdb7){for(var _0x153b9d=0x0;_0x153b9d<_0x32cdb7[_0x73e6('0x19')];_0x153b9d++){if(_0x32cdb7[_0x153b9d][_0x73e6('0x78')]in _0xa77ebb){contactItemTypes['push'](_0x32cdb7[_0x153b9d]);delete _0x4c7dcf[_0x32cdb7[_0x153b9d][_0x73e6('0x78')]];hasAdditionalPhones=!![];}for(var _0x4b677d in _0xa77ebb){if(_0x32cdb7[_0x153b9d][_0x73e6('0x78')]+_0x73e6('0x79')===_0x4b677d){phoneDescriptions[_0x73e6('0x1a')]({'itemTypeId':_0x32cdb7[_0x153b9d]['id'],'description':_0x4b677d});delete _0x4c7dcf[_0x4b677d];}}}if(hasAdditionalPhones)_0x4c7dcf[_0x73e6('0x1c')]='';var _0x3e3357=_[_0x73e6('0x50')](_0x4c7dcf)[_0x73e6('0x13')]();logger['info'](_0x73e6('0x76'),_0x3e3357);fs[_0x73e6('0x7a')](_0x127d2e,_0x3e3357+'\x0a');Papa[_0x73e6('0x7b')](fs[_0x73e6('0x7c')](_0x3b1513),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1d420f,_0x2a3a53){try{for(var _0x346bc3=0x0,_0x517a65=[];_0x346bc3<_0x1d420f[_0x73e6('0x7d')][_0x73e6('0x19')];_0x346bc3++){stats[_0x73e6('0x7e')]+=0x1;if(_0x1d420f[_0x73e6('0x5b')][_0x346bc3]){handleError(_0x1d420f[_0x73e6('0x7d')][_0x346bc3],_0x1d420f['errors'][_0x346bc3]);}else{var _0x5739d7=[];var _0x3579bc=[];var _0x484b9c={};for(var _0x39d0f0 in _0xa77ebb){let _0x25213a=contactItemTypes[_0x73e6('0x7f')](_0x11f8b8=>_0x11f8b8[_0x73e6('0x78')]===_0x39d0f0);let _0x4dc8bd=contactItemTypes['find'](_0x2e014d=>_0x2e014d[_0x73e6('0x78')]+_0x73e6('0x79')===_0x39d0f0);if(_[_0x73e6('0x1e')](_0x25213a)&&_[_0x73e6('0x1e')](_0x4dc8bd)){if(_0xa77ebb[_0x73e6('0x80')](_0x39d0f0)){if(_0x1d420f['data'][_0x346bc3][_0xa77ebb[_0x39d0f0]]){var _0x586e03=_[_0x73e6('0x81')](_0x1d420f[_0x73e6('0x7d')][_0x346bc3][_0xa77ebb[_0x39d0f0]][_0x73e6('0x82')](/"/g,'\x27'));switch(_0x39d0f0){case _0x73e6('0x2f'):var _0x513496=moment(_0x586e03,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x513496['isValid']()){_0x517a65['push']('\x22'+_0x586e03+'\x22');}else{_0x5739d7[_0x73e6('0x1a')](_0x73e6('0x83'));}break;case _0x73e6('0x34'):var _0x349f4d=parseInt(_0x586e03);_0x586e03=_['isNaN'](_0x349f4d)||_0x349f4d<0x0||_0x349f4d>0x4?_0x574e4f?0x3:0x2:_0x349f4d;_0x517a65[_0x73e6('0x1a')]('\x22'+_0x586e03+'\x22');break;case _0x73e6('0x35'):var _0x20e545=parseInt(_0x586e03);if(_[_0x73e6('0x84')](_0x20e545)&&_[_0x73e6('0x85')](_0x3287f8,_0x20e545)){_0x517a65[_0x73e6('0x1a')]('\x22'+_0x20e545+'\x22');}else{_0x5739d7[_0x73e6('0x1a')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x586e03)){_0x517a65['push']('\x22'+_0x586e03+'\x22');}else{_0x5739d7[_0x73e6('0x1a')](_0x73e6('0x86'));}break;case _0x73e6('0x87'):var _0xc18e24=moment(_0x586e03,_0x73e6('0x88'),!![]);if(_0xc18e24[_0x73e6('0x89')]()){_0x517a65['push']('\x22'+_0x586e03+'\x22');}else{_0x5739d7[_0x73e6('0x1a')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x2f6198=shared[_0x73e6('0x8a')];var _0x5f1538=_0x2f6198[_0x586e03];if(!_['isNil'](_0x5f1538)){var _0x7293c7=_0x5f1538['utcOffset'];_0x517a65[_0x73e6('0x1a')]('\x22'+_0x586e03+'\x22');_0x517a65[_0x73e6('0x1a')]('\x22'+_0x7293c7+'\x22');}break;default:_0x517a65[_0x73e6('0x1a')]('\x22'+_0x586e03+'\x22');}}else{switch(_0x39d0f0){case _0x73e6('0x8b'):case'phone':_0x5739d7[_0x73e6('0x1a')](_0x39d0f0+_0x73e6('0x8c'));break;default:_0x517a65[_0x73e6('0x1a')]('\x22\x22');}}}}else{var _0x7c4e07='';if(!_['isNil'](_0x25213a)){if(!_0x484b9c['hasOwnProperty'](_0x25213a['id'])){if(!_[_0x73e6('0x1e')](_0x1d420f['data'][_0x346bc3][_0xa77ebb[_0x39d0f0]])){var _0x586e03=_[_0x73e6('0x81')](_0x1d420f['data'][_0x346bc3][_0xa77ebb[_0x39d0f0]][_0x73e6('0x82')](/"/g,'\x27'));var _0x7c112=phoneDescriptions[_0x73e6('0x7f')](_0x55c128=>_0x55c128['itemTypeId']===_0x25213a['id']);if(!_[_0x73e6('0x1e')](_0x7c112)){var _0x26d301=_['trim'](_0x1d420f['data'][_0x346bc3][_0xa77ebb[_0x7c112['description']]][_0x73e6('0x82')](/"/g,'\x27'));if(!_[_0x73e6('0x1e')](_0x26d301))_0x586e03=_0x586e03+'§'+_0x26d301;}if(_0x7c4e07=='')_0x7c4e07=_0x586e03;else _0x7c4e07+='|'+_0x586e03;}_0x3579bc[_0x73e6('0x1a')](_0x25213a['id']+':'+_0x7c4e07);_0x484b9c[_0x25213a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x517a65[_0x73e6('0x1a')]('\x22'+_0x3579bc[_0x73e6('0x13')](';')+'\x22');}if(_0x5739d7[_0x73e6('0x19')]){handleError(_0x1d420f['data'][_0x346bc3],{'code':_0x73e6('0x8d'),'message':_0x5739d7['join']()});}else{fs[_0x73e6('0x8e')](_0x127d2e,_0x517a65[_0x73e6('0x13')]()+'\x0a');}_0x517a65=[];}if(!(stats[_0x73e6('0x7e')]%0xc8)){socket[_0x73e6('0x8f')](_0x73e6('0x90')+_0x444282,stats);stats[_0x73e6('0x5b')]=[];}}if(stopped){logger[_0x73e6('0x56')](_0x73e6('0x91'));_0x2a3a53[_0x73e6('0x92')]();}}catch(_0x2e5767){handleError(_0x1d420f['data'][_0x346bc3],{'code':_0x73e6('0x93'),'message':_0x2e5767['message']});logger[_0x73e6('0x58')]('step',_0x2e5767[_0x73e6('0x59')]);}},'complete':function(){try{var _0x505846=[];var _0x143102=[];var _0x9af7ac=_0x73e6('0x44');if(_0x3a78da[_0x73e6('0x94')]&&_0x3a78da['duplicates'][_0x73e6('0x19')]){_0x9af7ac=_0x73e6('0x95')+_0x444282;_0x505846[_0x73e6('0x1a')]('CREATE\x20TABLE\x20'+_0x9af7ac+_0x73e6('0x96'));}tmp_campaigns=_0x73e6('0x97')+_0x444282;tmp_voice_queues=_0x73e6('0x98')+_0x444282;_0x143102[_0x73e6('0x1a')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x73e6('0x99'));_0x143102[_0x73e6('0x1a')](_0x73e6('0x9a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x73e6('0x9b')](_0x143102,handleTZQuery)[_0x73e6('0x18')](function(_0xdd6278){updateTzCampaigns(_0x3a78da[_0x73e6('0x31')])[_0x73e6('0x18')](function(_0x200c64){updateTzVoiceQueues(_0x3a78da['ListId'])['then'](function(_0xd12a8c){if(hasTZ)_0x3e3357=_0x3e3357[_0x73e6('0x82')](_0x73e6('0x6d'),_0x73e6('0x9c'));var _0x334e03=util[_0x73e6('0xf')](_0x73e6('0x9d'),_0x127d2e,_0x9af7ac,_0x3e3357,_0x3a78da[_0x73e6('0x31')],_0x3a78da[_0x73e6('0x51')]||null,NOW,NOW);if(_[_0x73e6('0x1e')](_0xa77ebb['scheduledat'])){_0x334e03+=_0x73e6('0x9e');}_0x505846[_0x73e6('0x1a')](_0x334e03);if(_0x3a78da['duplicates']&&_0x3a78da[_0x73e6('0x94')]['length']){_0x505846[_0x73e6('0x1a')](insertCmContact(_0x3a78da[_0x73e6('0x31')],_0x9af7ac,_0x3a78da[_0x73e6('0x94')],_0xa77ebb));_0x505846[_0x73e6('0x1a')](_0x73e6('0x9f')+_0x9af7ac+';');}BPromise[_0x73e6('0x9b')](_0x505846,handleQuery)[_0x73e6('0x18')](function(_0x389416){BPromise[_0x73e6('0x1b')]([handleAdditionalPhones()])[_0x73e6('0x18')](function(){_0x505846=[];for(var _0x4d08a0=0x0;_0x4d08a0\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x63cc06,_0x6fe5d8){var _0x43a143=function(_0x41fe49){while(--_0x41fe49){_0x63cc06['push'](_0x63cc06['shift']());}};_0x43a143(++_0x6fe5d8);}(_0xdfb1,0x8c));var _0x1dfb=function(_0xe62b9f,_0x4be658){_0xe62b9f=_0xe62b9f-0x0;var _0x33a712=_0xdfb1[_0xe62b9f];return _0x33a712;};'use strict';var fs=require('fs');var path=require(_0x1dfb('0x0'));var _=require(_0x1dfb('0x1'));var Papa=require(_0x1dfb('0x2'));var util=require(_0x1dfb('0x3'));var BPromise=require('bluebird');var moment=require(_0x1dfb('0x4'));var squel=require(_0x1dfb('0x5'));var Redis=require(_0x1dfb('0x6'));var db=require(_0x1dfb('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('import');config[_0x1dfb('0x8')]=_[_0x1dfb('0x9')](config[_0x1dfb('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1dfb('0xa'))(new Redis(config[_0x1dfb('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x1dfb('0xb')](_0x1dfb('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x1dfb('0xb')](_0x1dfb('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x191d87){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'](_0x191d87);}function selectNotIn(_0xd747ac,_0x6a43eb,_0x449e56,_0x224c3c,_0x3a0366){return squel[_0x1dfb('0xe')]()[_0x1dfb('0xf')](_0x1dfb('0x10'))[_0x1dfb('0x11')](_0x224c3c)['join'](_0x6a43eb,null,_0x6a43eb+_0x1dfb('0x12')+_0x224c3c+'.'+_0x449e56)[_0x1dfb('0x13')](_0x224c3c+'.'+_0x449e56+'\x20=\x20'+_0xd747ac+'.'+_0x449e56)[_0x1dfb('0x13')](_0x6a43eb+_0x1dfb('0x14')+_0x3a0366[_0x1dfb('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4ea317,_0xd9413b){promisesAdditionalPhones=[];promisesContact=[];return db[_0x1dfb('0x16')][_0x1dfb('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0x1dfb('0x18')](function(_0x2d4287){if(_0x2d4287!==null){var _0x425fa9=[];for(var _0x5535ad=0x0;_0x5535ad<_0x2d4287[_0x1dfb('0x19')];_0x5535ad++){var _0x2a146f=_0x2d4287[_0x5535ad];if(!_[_0x1dfb('0x1a')](_0x2a146f['phone'])){if(!_['isNil'](_0x2a146f[_0x1dfb('0x1b')]))_0x425fa9[_0x1dfb('0x1c')](insertAdditionalPhones(_0x2a146f));promisesContact[_0x1dfb('0x1c')]({'contact':_0x2a146f});}}}Promise[_0x1dfb('0x1d')](_0x425fa9)['then'](function(){_0x4ea317({'val':0x1});});})[_0x1dfb('0x1e')](function(_0x33f6e5){logger[_0x1dfb('0x1f')](_0x33f6e5[_0x1dfb('0x20')]);});});}function insertAdditionalPhones(_0x3fde47){return new Promise(function(_0x4dff46,_0x18ee9a){var _0x5c9f21=_0x3fde47['AdditionalPhones'];if(_['isNil'](_0x5c9f21))_0x18ee9a({'val':0x0});else{var _0x546c06=_0x5c9f21[_0x1dfb('0x21')](';');var _0x3cb51e=[];orderBy=0x0;for(var _0x5ab2f8=0x0;_0x5ab2f8<_0x546c06['length'];_0x5ab2f8++){_0x3cb51e['push'](splitAdditionalPhone(_0x3fde47['id'],_0x546c06[_0x5ab2f8]));}Promise[_0x1dfb('0x1d')](_0x3cb51e)[_0x1dfb('0x22')](function(){_0x4dff46({'val':_0x546c06[_0x1dfb('0x19')]});});}});}function splitAdditionalPhone(_0x1250c4,_0x128cc6){return new Promise(function(_0x55da8b,_0x136a7d){var _0x1162b3=_0x128cc6[_0x1dfb('0x21')](':');var _0x52601a=_0x1162b3[0x0];var _0x5111eb=_0x1162b3[0x1];if(_0x5111eb!==''){var _0x386911=_0x5111eb[_0x1dfb('0x21')]('|');var _0x4c9c81=[];for(var _0x520ac8=0x0;_0x520ac8<_0x386911['length'];_0x520ac8++){if(_0x386911[_0x520ac8]!==''){var _0x36bda8=_[_0x1dfb('0x23')](promisesAdditionalPhones,{'contactId':_0x1250c4,'phone':_0x386911[_0x520ac8]});if(_0x36bda8['length']==0x0){orderBy++;promisesAdditionalPhones[_0x1dfb('0x1c')]({'contactId':_0x1250c4,'contactTypeId':_0x52601a,'phone':_0x386911[_0x520ac8],'orderBy':orderBy});}}}_0x55da8b({'ok':0x1});}else _0x55da8b({'res':0x0});});}function createAdditionalPhone(_0x47be04,_0x47518e,_0x18d254,_0x51b2e9){var _0x1bc2c3='';var _0x417f71='';var _0x292c2d=_0x18d254['split']('§');_0x1bc2c3=_0x292c2d[0x0];if(_0x292c2d[_0x1dfb('0x19')]==0x2)_0x417f71=_0x292c2d[0x1];return new Promise(function(_0x82339a,_0x2dfa60){return db[_0x1dfb('0x24')][_0x1dfb('0x25')]({'where':{'CmContactId':_0x47be04,'item':_0x1bc2c3}})['then'](function(_0x2bcc56){if(_0x2bcc56){return db[_0x1dfb('0x24')]['update']({'ItemTypeId':_0x47518e,'description':_0x417f71,'OrderBy':_0x51b2e9},{'where':{'CmContactId':_0x47be04,'item':_0x1bc2c3}})[_0x1dfb('0x22')](function(_0x2572b7){_0x82339a({'res':'updated'});});}else{return db[_0x1dfb('0x24')][_0x1dfb('0x26')]({'CmContactId':_0x47be04,'item':_0x1bc2c3,'ItemTypeId':_0x47518e,'description':_0x417f71,'OrderBy':_0x51b2e9,'ItemClass':_0x1dfb('0x27')})[_0x1dfb('0x22')](function(_0xdcb715){_0x82339a({'res':_0x1dfb('0x28')});});}});});}function updateContact(_0x1960d0){return new Promise(function(_0x3c6252,_0x193cc8){var _0x8b1da8=_0x1960d0['id'];delete _0x1960d0['id'];return db['CmContact'][_0x1dfb('0x29')](_0x1960d0,{'where':{'id':_0x8b1da8}})[_0x1dfb('0x22')](function(_0x450cec){updatedRows+=0x1;return db['CmHopper'][_0x1dfb('0x29')]({'phone':_0x1960d0[_0x1dfb('0x10')]},{'where':{'ContactId':_0x8b1da8}})[_0x1dfb('0x22')](function(_0x5a614c){_0x3c6252({'ret':'OK'});});});});}function insertCmHopper(_0x4bb473,_0x3deb39,_0x34503c,_0x572423,_0x288254){var _0x2b95d0=[_0x1dfb('0x2a'),'cm_contacts.scheduledat',_0x1dfb('0x2b'),_0x1dfb('0x2c'),_0x3deb39+'.'+_0x572423,_0x1dfb('0x2d'),_0x1dfb('0x2e'),'cm_contacts.priority',_0x1dfb('0x2f'),'\x22'+_0x288254+'\x22'];return squel[_0x1dfb('0x30')]()['into']('cm_hopper')[_0x1dfb('0x31')](['phone',_0x1dfb('0x32'),'ContactId','ListId',_0x572423,_0x1dfb('0x33'),_0x1dfb('0x34'),_0x1dfb('0x35'),_0x1dfb('0x36'),_0x1dfb('0x37')],squel['select']()[_0x1dfb('0x38')](_0x2b95d0)[_0x1dfb('0x11')](_0x3deb39)[_0x1dfb('0x15')](_0x1dfb('0x39'),null,_0x1dfb('0x3a')+_0x3deb39+_0x1dfb('0x3b'))['join'](_0x34503c,null,_0x34503c+'.id\x20=\x20'+_0x3deb39+'.'+_0x572423)[_0x1dfb('0x13')](_0x3deb39+_0x1dfb('0x3c'),_0x4bb473)[_0x1dfb('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x1dfb('0x3d'),selectNotIn(_0x3deb39,_0x34503c,_0x572423,_0x1dfb('0x3e'),['\x22always\x22',_0x1dfb('0x3f')]))[_0x1dfb('0x13')](_0x1dfb('0x3d'),selectNotIn(_0x3deb39,_0x34503c,_0x572423,_0x1dfb('0x3e'),[_0x1dfb('0x40')])))[_0x1dfb('0x41')]();}function insertCmHopperBlack(_0x477b29,_0x49ed09,_0x42a010,_0x22345e){var _0x36ef53=[_0x1dfb('0x2a'),'cm_contacts.id','cm_contacts.ListId',_0x49ed09+'.'+_0x22345e,_0x1dfb('0x2d'),'cm_contacts.updatedAt'];return squel[_0x1dfb('0x30')]()[_0x1dfb('0x42')]('cm_hopper_black')[_0x1dfb('0x31')](['phone','ContactId','ListId',_0x22345e,_0x1dfb('0x33'),_0x1dfb('0x34')],squel[_0x1dfb('0xe')]()['fields'](_0x36ef53)['from'](_0x49ed09)['join'](_0x1dfb('0x39'),null,_0x1dfb('0x3a')+_0x49ed09+_0x1dfb('0x3b'))[_0x1dfb('0x15')](_0x42a010,null,_0x42a010+_0x1dfb('0x12')+_0x49ed09+'.'+_0x22345e)[_0x1dfb('0x13')](_0x49ed09+_0x1dfb('0x3c'),_0x477b29)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1dfb('0x13')](_0x1dfb('0x3d'),squel[_0x1dfb('0xe')]()['field'](_0x1dfb('0x10'))[_0x1dfb('0x11')](_0x1dfb('0x43'))[_0x1dfb('0x13')](_0x1dfb('0x44'),_0x477b29)['where'](_0x22345e+_0x1dfb('0x45'),_0x49ed09+'.'+_0x22345e)))[_0x1dfb('0x41')]();}function insertCmHopperAdditionalPhones(_0x49acd1){var _0x370d5e=[_0x1dfb('0x46'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x1dfb('0x47')];return squel[_0x1dfb('0x30')]()[_0x1dfb('0x42')](_0x1dfb('0x48'))[_0x1dfb('0x31')]([_0x1dfb('0x49'),_0x1dfb('0x10'),'OrderBy',_0x1dfb('0x33'),_0x1dfb('0x34')],squel[_0x1dfb('0xe')]()['fields'](_0x370d5e)[_0x1dfb('0x11')](_0x1dfb('0x3e'))['join'](_0x1dfb('0x39'),null,_0x1dfb('0x4a'))[_0x1dfb('0x15')](_0x1dfb('0x4b'),null,_0x1dfb('0x4c'))[_0x1dfb('0x13')](_0x1dfb('0x4d'),_0x49acd1)[_0x1dfb('0x13')](_0x1dfb('0x4e'),NOW))['toString']();}function insertCmContact(_0x193683,_0x39f405,_0x3f8e55,_0x556de4){var _0x380cc3=_[_0x1dfb('0x4f')](_[_0x1dfb('0x50')](_0x556de4),[_0x1dfb('0x51'),_0x1dfb('0x52'),'createdAt',_0x1dfb('0x34')]);return squel['insert']()['into']('cm_contacts')['fromQuery'](_0x380cc3,squel[_0x1dfb('0xe')]()[_0x1dfb('0x38')](_0x380cc3)[_0x1dfb('0x11')](_0x39f405)[_0x1dfb('0x13')]('('+_0x3f8e55[_0x1dfb('0x15')](',')+_0x1dfb('0x53'),squel[_0x1dfb('0xe')]()[_0x1dfb('0x38')](_0x3f8e55)[_0x1dfb('0x11')](_0x1dfb('0x39'))[_0x1dfb('0x13')]('ListId\x20=\x20?',_0x193683))[_0x1dfb('0x13')](_0x1dfb('0x54'),squel['select']()[_0x1dfb('0xf')](_0x1dfb('0x55'),_0x1dfb('0x56'))[_0x1dfb('0x11')](_0x39f405)[_0x1dfb('0x57')](_0x3f8e55[_0x1dfb('0x15')](','))))['toString']();}function handleStop(){logger['info'](_0x1dfb('0x58'));stopped=!![];}function handleUncaughtException(_0x1d397e){logger['error'](_0x1d397e[_0x1dfb('0x20')]);process['exit'](0x1);}function handleError(_0x3c16b2,_0x555c77){stats[_0x1dfb('0x59')][_0x1dfb('0x1c')]({'name':_0x555c77[_0x1dfb('0x5a')],'message':_0x555c77[_0x1dfb('0x20')],'row':_0x3c16b2});}function handleQuery(_0x452e18){logger[_0x1dfb('0x5b')](_0x452e18);return db[_0x1dfb('0x16')][_0x1dfb('0x17')](_0x452e18)['spread'](function(_0x14a384){results['push'](_0x14a384);})[_0x1dfb('0x1e')](function(_0x123e5e){logger[_0x1dfb('0x1f')](_0x123e5e['message']);});}function main(_0x545f5b,_0x240167,_0xabb993,_0x576c22){logger[_0x1dfb('0x5b')](_0x1dfb('0x5c'),_0x545f5b,JSON[_0x1dfb('0x5d')](_0x240167));process[_0x1dfb('0x5e')](_0x1dfb('0x5f'));var _0x1aea50=_0x240167[_0x1dfb('0x60')];var _0x293522=_['clone'](_0x1aea50);var _0x1d0c6c=_0x240167[_0x1dfb('0x61')];var _0x28176e=path[_0x1dfb('0x15')](config['root'],_0x1dfb('0x62'),_0x1d0c6c+_0x1dfb('0x63'));logger[_0x1dfb('0x5b')](_0x1dfb('0x64'),_0x240167);db[_0x1dfb('0x65')][_0x1dfb('0x66')]({'raw':!![],'attributes':['id','name']})[_0x1dfb('0x22')](function(_0x54356c){for(var _0x36ac8e=0x0;_0x36ac8e<_0x54356c[_0x1dfb('0x19')];_0x36ac8e++){if(_0x54356c[_0x36ac8e][_0x1dfb('0x67')]in _0x1aea50){contactItemTypes[_0x1dfb('0x1c')](_0x54356c[_0x36ac8e]);delete _0x293522[_0x54356c[_0x36ac8e][_0x1dfb('0x67')]];hasAdditionalPhones=!![];}for(var _0x5cb4bd in _0x1aea50){if(_0x54356c[_0x36ac8e]['name']+_0x1dfb('0x68')===_0x5cb4bd){phoneDescriptions['push']({'itemTypeId':_0x54356c[_0x36ac8e]['id'],'description':_0x5cb4bd});delete _0x293522[_0x5cb4bd];}}}if(hasAdditionalPhones)_0x293522[_0x1dfb('0x1b')]='';var _0x548b2c=_[_0x1dfb('0x50')](_0x293522)[_0x1dfb('0x15')]();logger[_0x1dfb('0x5b')]('header',_0x548b2c);fs[_0x1dfb('0x69')](_0x28176e,_0x548b2c+'\x0a');Papa[_0x1dfb('0x6a')](fs[_0x1dfb('0x6b')](_0x545f5b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x160c35,_0x367404){try{for(var _0x135c42=0x0,_0x5488e1=[];_0x135c42<_0x160c35['data'][_0x1dfb('0x19')];_0x135c42++){stats[_0x1dfb('0x6c')]+=0x1;if(_0x160c35[_0x1dfb('0x59')][_0x135c42]){handleError(_0x160c35[_0x1dfb('0x6d')][_0x135c42],_0x160c35[_0x1dfb('0x59')][_0x135c42]);}else{var _0x1ed96c=[];var _0x482ead=[];var _0x498153={};for(var _0x31cfba in _0x1aea50){let _0x36c4da=contactItemTypes['find'](_0x97bd16=>_0x97bd16[_0x1dfb('0x67')]===_0x31cfba);let _0x3b975a=contactItemTypes[_0x1dfb('0x6e')](_0x2b92e5=>_0x2b92e5['name']+_0x1dfb('0x68')===_0x31cfba);if(_[_0x1dfb('0x1a')](_0x36c4da)&&_['isNil'](_0x3b975a)){if(_0x1aea50[_0x1dfb('0x6f')](_0x31cfba)){if(_0x160c35[_0x1dfb('0x6d')][_0x135c42][_0x1aea50[_0x31cfba]]){var _0x48dc86=_[_0x1dfb('0x70')](_0x160c35[_0x1dfb('0x6d')][_0x135c42][_0x1aea50[_0x31cfba]][_0x1dfb('0x71')](/"/g,'\x27'));switch(_0x31cfba){case _0x1dfb('0x32'):var _0x5408fc=moment(_0x48dc86,_0x1dfb('0xc'),!![]);if(_0x5408fc[_0x1dfb('0x72')]()){_0x5488e1[_0x1dfb('0x1c')]('\x22'+_0x48dc86+'\x22');}else{_0x1ed96c[_0x1dfb('0x1c')](_0x1dfb('0x73'));}break;case'priority':var _0x389fc6=parseInt(_0x48dc86);_0x48dc86=_['isNaN'](_0x389fc6)||_0x389fc6<0x0||_0x389fc6>0x4?_0x576c22?0x3:0x2:_0x389fc6;_0x5488e1['push']('\x22'+_0x48dc86+'\x22');break;case'UserId':var _0x991a8c=parseInt(_0x48dc86);if(_['isNumber'](_0x991a8c)&&_[_0x1dfb('0x74')](_0xabb993,_0x991a8c)){_0x5488e1[_0x1dfb('0x1c')]('\x22'+_0x991a8c+'\x22');}else{_0x1ed96c['push']('agent\x20not\x20exists');}break;case _0x1dfb('0x75'):if(isEmail(_0x48dc86)){_0x5488e1[_0x1dfb('0x1c')]('\x22'+_0x48dc86+'\x22');}else{_0x1ed96c[_0x1dfb('0x1c')](_0x1dfb('0x76'));}break;case'dateOfBirth':var _0x484a40=moment(_0x48dc86,'YYYY-MM-DD',!![]);if(_0x484a40[_0x1dfb('0x72')]()){_0x5488e1['push']('\x22'+_0x48dc86+'\x22');}else{_0x1ed96c[_0x1dfb('0x1c')](_0x1dfb('0x77'));}break;default:_0x5488e1[_0x1dfb('0x1c')]('\x22'+_0x48dc86+'\x22');}}else{switch(_0x31cfba){case _0x1dfb('0x78'):case _0x1dfb('0x10'):_0x1ed96c[_0x1dfb('0x1c')](_0x31cfba+_0x1dfb('0x79'));break;default:_0x5488e1[_0x1dfb('0x1c')]('\x22\x22');}}}}else{var _0x2fcf39='';if(!_[_0x1dfb('0x1a')](_0x36c4da)){if(!_0x498153[_0x1dfb('0x6f')](_0x36c4da['id'])){for(var _0x58c5db=0x0;_0x58c5db<_0x1aea50[_0x31cfba]['length'];_0x58c5db++){var _0x48dc86=_[_0x1dfb('0x70')](_0x160c35[_0x1dfb('0x6d')][_0x135c42][_0x1aea50[_0x31cfba][_0x58c5db]][_0x1dfb('0x71')](/"/g,'\x27'));var _0x28202c=phoneDescriptions['find'](_0x19564c=>_0x19564c[_0x1dfb('0x7a')]===_0x36c4da['id']);if(!_[_0x1dfb('0x1a')](_0x28202c)){var _0x2bae51=_['trim'](_0x160c35[_0x1dfb('0x6d')][_0x135c42][_0x1aea50[_0x28202c['description']][0x0]][_0x1dfb('0x71')](/"/g,'\x27'));if(!_['isNil'](_0x2bae51))_0x48dc86=_0x48dc86+'§'+_0x2bae51;}if(_0x2fcf39=='')_0x2fcf39=_0x48dc86;else _0x2fcf39+='|'+_0x48dc86;}_0x482ead[_0x1dfb('0x1c')](_0x36c4da['id']+':'+_0x2fcf39);_0x498153[_0x36c4da['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5488e1['push']('\x22'+_0x482ead['join'](';')+'\x22');}if(_0x1ed96c['length']){handleError(_0x160c35[_0x1dfb('0x6d')][_0x135c42],{'code':_0x1dfb('0x7b'),'message':_0x1ed96c[_0x1dfb('0x15')]()});}else{fs[_0x1dfb('0x7c')](_0x28176e,_0x5488e1[_0x1dfb('0x15')]()+'\x0a');}_0x5488e1=[];}if(!(stats['rows']%0xc8)){socket[_0x1dfb('0x7d')](_0x1dfb('0x7e')+_0x1d0c6c,stats);stats[_0x1dfb('0x59')]=[];}}if(stopped){logger['info'](_0x1dfb('0x7f'));_0x367404[_0x1dfb('0x80')]();}}catch(_0x1181a0){handleError(_0x160c35[_0x1dfb('0x6d')][_0x135c42],{'code':_0x1dfb('0x81'),'message':_0x1181a0[_0x1dfb('0x20')]});logger['error'](_0x1dfb('0x82'),_0x1181a0[_0x1dfb('0x20')]);}},'complete':function(){try{var _0x329ea0=[];var _0x32124a=tempTableName;_0x329ea0[_0x1dfb('0x1c')]('CREATE\x20TABLE\x20'+_0x32124a+_0x1dfb('0x83'));logger[_0x1dfb('0x5b')]('CIS\x20len',contactItemTypes[_0x1dfb('0x19')]);var _0x17af11=util[_0x1dfb('0xb')](_0x1dfb('0x84'),_0x28176e,_0x32124a,_0x548b2c,_0x240167['ListId'],_0x240167[_0x1dfb('0x52')]||null,NOW,NOW);if(_[_0x1dfb('0x1a')](_0x1aea50[_0x1dfb('0x32')])){_0x17af11+=_0x1dfb('0x85');}_0x329ea0[_0x1dfb('0x1c')](_0x17af11);BPromise[_0x1dfb('0x86')](_0x329ea0,handleQuery)['then'](function(_0x2f80a5){BPromise[_0x1dfb('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x329ea0=[];for(var _0x2cd97f=0x0;_0x2cd97f\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','field','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','query','select\x20*\x20from\x20','spread','phone','isNil','AdditionalPhones','then','catch','message','split','push','all','length','CmContactHasItem','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','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?','MIN(id)','min_id','info','error','errors','stringify','send','start','binding','socket_timestamp','root','.csv','ContactItemType','findAll','name','header','writeFileSync'];(function(_0x36eb8a,_0x428d6a){var _0x231adf=function(_0x4b9d42){while(--_0x4b9d42){_0x36eb8a['push'](_0x36eb8a['shift']());}};_0x231adf(++_0x428d6a);}(_0xb982,0x15e));var _0x2b98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb982[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x2b98('0x0'));var util=require(_0x2b98('0x1'));var BPromise=require(_0x2b98('0x2'));var moment=require(_0x2b98('0x3'));var squel=require(_0x2b98('0x4'));var Redis=require(_0x2b98('0x5'));var db=require(_0x2b98('0x6'))['db'];var config=require(_0x2b98('0x7'));var logger=require(_0x2b98('0x8'))(_0x2b98('0x9'));config['redis']=_[_0x2b98('0xa')](config[_0x2b98('0xb')],{'host':_0x2b98('0xc'),'port':0x18eb});var socket=require(_0x2b98('0xd'))(new Redis(config[_0x2b98('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x2b98('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x2b98('0xf')+moment()[_0x2b98('0xe')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x8e30c5){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'](_0x8e30c5);}function selectNotIn(_0x3f8ef6,_0x17d985,_0x457b35,_0x200725,_0xbb4274){return squel['select']()[_0x2b98('0x10')]('phone')[_0x2b98('0x11')](_0x200725)[_0x2b98('0x12')](_0x17d985,null,_0x17d985+_0x2b98('0x13')+_0x200725+'.'+_0x457b35)[_0x2b98('0x14')](_0x200725+'.'+_0x457b35+_0x2b98('0x15')+_0x3f8ef6+'.'+_0x457b35)[_0x2b98('0x14')](_0x17d985+'.dialCheckDuplicateType\x20IN\x20('+_0xbb4274[_0x2b98('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x268fc3,_0x13d46d){promisesAdditionalPhones=[];promisesContact=[];return db[_0x2b98('0x16')][_0x2b98('0x17')](_0x2b98('0x18')+tempTableName)[_0x2b98('0x19')](function(_0x4eab53){if(_0x4eab53!==null){var _0xc2478a=[];for(var _0x27fb07=0x0;_0x27fb07<_0x4eab53['length'];_0x27fb07++){var _0x33614e=_0x4eab53[_0x27fb07];if(!_['isNil'](_0x33614e[_0x2b98('0x1a')])){if(!_[_0x2b98('0x1b')](_0x33614e[_0x2b98('0x1c')]))_0xc2478a['push'](insertAdditionalPhones(_0x33614e));promisesContact['push']({'contact':_0x33614e});}}}Promise['all'](_0xc2478a)[_0x2b98('0x1d')](function(){_0x268fc3({'val':0x1});});})[_0x2b98('0x1e')](function(_0x58a1f3){logger['error'](_0x58a1f3[_0x2b98('0x1f')]);});});}function insertAdditionalPhones(_0x15c747){return new Promise(function(_0x41c7de,_0x5b75de){var _0x1878f4=_0x15c747[_0x2b98('0x1c')];if(_[_0x2b98('0x1b')](_0x1878f4))_0x5b75de({'val':0x0});else{var _0x280caa=_0x1878f4[_0x2b98('0x20')](';');var _0x349a8d=[];orderBy=0x0;for(var _0x51db51=0x0;_0x51db51<_0x280caa['length'];_0x51db51++){_0x349a8d[_0x2b98('0x21')](splitAdditionalPhone(_0x15c747['id'],_0x280caa[_0x51db51]));}Promise[_0x2b98('0x22')](_0x349a8d)[_0x2b98('0x1d')](function(){_0x41c7de({'val':_0x280caa[_0x2b98('0x23')]});});}});}function splitAdditionalPhone(_0x3bdfa3,_0x404a3c){return new Promise(function(_0x274c1a,_0x4981ba){var _0x40c613=_0x404a3c[_0x2b98('0x20')](':');var _0x154f06=_0x40c613[0x0];var _0x112d71=_0x40c613[0x1];if(_0x112d71!==''){var _0x28e79a=_0x112d71['split']('|');var _0xccda69=[];for(var _0x54b0c3=0x0;_0x54b0c3<_0x28e79a['length'];_0x54b0c3++){if(_0x28e79a[_0x54b0c3]!==''){var _0x27811d=_['filter'](promisesAdditionalPhones,{'contactId':_0x3bdfa3,'phone':_0x28e79a[_0x54b0c3]});if(_0x27811d[_0x2b98('0x23')]==0x0){orderBy++;promisesAdditionalPhones[_0x2b98('0x21')]({'contactId':_0x3bdfa3,'contactTypeId':_0x154f06,'phone':_0x28e79a[_0x54b0c3],'orderBy':orderBy});}}}_0x274c1a({'ok':0x1});}else _0x274c1a({'res':0x0});});}function createAdditionalPhone(_0x17b7db,_0x596c25,_0x5467a4,_0x3e506f){var _0x2769a7='';var _0x2208b1='';var _0x8cf049=_0x5467a4['split']('§');_0x2769a7=_0x8cf049[0x0];if(_0x8cf049['length']==0x2)_0x2208b1=_0x8cf049[0x1];return new Promise(function(_0x268786,_0x4a40fc){return db[_0x2b98('0x24')]['findOne']({'where':{'CmContactId':_0x17b7db,'item':_0x2769a7}})['then'](function(_0x3962ce){if(_0x3962ce){return db[_0x2b98('0x24')][_0x2b98('0x25')]({'ItemTypeId':_0x596c25,'description':_0x2208b1,'OrderBy':_0x3e506f},{'where':{'CmContactId':_0x17b7db,'item':_0x2769a7}})[_0x2b98('0x1d')](function(_0x4fef06){_0x268786({'res':_0x2b98('0x26')});});}else{return db[_0x2b98('0x24')][_0x2b98('0x27')]({'CmContactId':_0x17b7db,'item':_0x2769a7,'ItemTypeId':_0x596c25,'description':_0x2208b1,'OrderBy':_0x3e506f,'ItemClass':_0x2b98('0x28')})[_0x2b98('0x1d')](function(_0x1d4b95){_0x268786({'res':_0x2b98('0x29')});});}});});}function updateContact(_0x9409e7){return new Promise(function(_0x2eaa8e,_0x350f52){var _0x1d9d07=_0x9409e7['id'];delete _0x9409e7['id'];return db['CmContact'][_0x2b98('0x25')](_0x9409e7,{'where':{'id':_0x1d9d07}})['then'](function(_0x3e38d0){updatedRows+=0x1;return db[_0x2b98('0x2a')][_0x2b98('0x25')]({'phone':_0x9409e7[_0x2b98('0x1a')]},{'where':{'ContactId':_0x1d9d07}})[_0x2b98('0x1d')](function(_0x1d0255){_0x2eaa8e({'ret':'OK'});});});});}function insertCmHopper(_0x5af738,_0x35b0cc,_0x5bc473,_0x3f75aa,_0x2cdb9e){var _0x403a96=[_0x2b98('0x2b'),_0x2b98('0x2c'),_0x2b98('0x2d'),_0x2b98('0x2e'),_0x35b0cc+'.'+_0x3f75aa,_0x2b98('0x2f'),'cm_contacts.updatedAt','cm_contacts.priority',_0x2b98('0x30'),'\x22'+_0x2cdb9e+'\x22'];return squel[_0x2b98('0x31')]()[_0x2b98('0x32')](_0x2b98('0x33'))[_0x2b98('0x34')]([_0x2b98('0x1a'),'scheduledat',_0x2b98('0x35'),_0x2b98('0x36'),_0x3f75aa,_0x2b98('0x37'),_0x2b98('0x38'),_0x2b98('0x39'),'UserId',_0x2b98('0x3a')],squel[_0x2b98('0x3b')]()[_0x2b98('0x3c')](_0x403a96)['from'](_0x35b0cc)[_0x2b98('0x12')](_0x2b98('0x3d'),null,_0x2b98('0x3e')+_0x35b0cc+_0x2b98('0x3f'))['join'](_0x5bc473,null,_0x5bc473+_0x2b98('0x13')+_0x35b0cc+'.'+_0x3f75aa)['where'](_0x35b0cc+_0x2b98('0x40'),_0x5af738)[_0x2b98('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x2b98('0x41'),selectNotIn(_0x35b0cc,_0x5bc473,_0x3f75aa,_0x2b98('0x33'),[_0x2b98('0x42'),_0x2b98('0x43')]))[_0x2b98('0x14')](_0x2b98('0x41'),selectNotIn(_0x35b0cc,_0x5bc473,_0x3f75aa,_0x2b98('0x33'),['\x22always\x22'])))[_0x2b98('0x44')]();}function insertCmHopperBlack(_0x1d0277,_0x569fc4,_0x511ea2,_0xf68abc){var _0x1a4031=['cm_contacts.phone',_0x2b98('0x2d'),_0x2b98('0x2e'),_0x569fc4+'.'+_0xf68abc,_0x2b98('0x2f'),_0x2b98('0x45')];return squel['insert']()[_0x2b98('0x32')](_0x2b98('0x46'))[_0x2b98('0x34')]([_0x2b98('0x1a'),_0x2b98('0x35'),_0x2b98('0x36'),_0xf68abc,_0x2b98('0x37'),'updatedAt'],squel[_0x2b98('0x3b')]()[_0x2b98('0x3c')](_0x1a4031)['from'](_0x569fc4)[_0x2b98('0x12')](_0x2b98('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0x569fc4+_0x2b98('0x3f'))['join'](_0x511ea2,null,_0x511ea2+'.id\x20=\x20'+_0x569fc4+'.'+_0xf68abc)[_0x2b98('0x14')](_0x569fc4+_0x2b98('0x40'),_0x1d0277)[_0x2b98('0x14')](_0x2b98('0x47'),NOW)['where'](_0x2b98('0x41'),squel['select']()[_0x2b98('0x10')](_0x2b98('0x1a'))[_0x2b98('0x11')](_0x2b98('0x46'))[_0x2b98('0x14')](_0x2b98('0x48'),_0x1d0277)[_0x2b98('0x14')](_0xf68abc+_0x2b98('0x49'),_0x569fc4+'.'+_0xf68abc)))[_0x2b98('0x44')]();}function insertCmHopperAdditionalPhones(_0x9d4c9e){var _0x443b38=[_0x2b98('0x4a'),_0x2b98('0x4b'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x2b98('0x4c')];return squel[_0x2b98('0x31')]()[_0x2b98('0x32')]('cm_hopper_additional_phones')[_0x2b98('0x34')]([_0x2b98('0x4d'),_0x2b98('0x1a'),_0x2b98('0x4e'),_0x2b98('0x37'),_0x2b98('0x38')],squel['select']()['fields'](_0x443b38)[_0x2b98('0x11')](_0x2b98('0x33'))[_0x2b98('0x12')](_0x2b98('0x3d'),null,_0x2b98('0x4f'))['join'](_0x2b98('0x50'),null,_0x2b98('0x51'))[_0x2b98('0x14')](_0x2b98('0x52'),_0x9d4c9e)[_0x2b98('0x14')](_0x2b98('0x47'),NOW))[_0x2b98('0x44')]();}function insertCmContact(_0x4a0fa7,_0x4d1cfa,_0x13f7b3,_0x5e9b51){var _0x391dea=_['concat'](_['keys'](_0x5e9b51),['ListId','CompanyId',_0x2b98('0x37'),_0x2b98('0x38')]);return squel[_0x2b98('0x31')]()['into']('cm_contacts')[_0x2b98('0x34')](_0x391dea,squel[_0x2b98('0x3b')]()[_0x2b98('0x3c')](_0x391dea)[_0x2b98('0x11')](_0x4d1cfa)[_0x2b98('0x14')]('('+_0x13f7b3['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x2b98('0x3b')]()[_0x2b98('0x3c')](_0x13f7b3)['from'](_0x2b98('0x3d'))[_0x2b98('0x14')](_0x2b98('0x48'),_0x4a0fa7))[_0x2b98('0x14')]('id\x20IN\x20?',squel[_0x2b98('0x3b')]()[_0x2b98('0x10')](_0x2b98('0x53'),_0x2b98('0x54'))[_0x2b98('0x11')](_0x4d1cfa)['group'](_0x13f7b3[_0x2b98('0x12')](','))))[_0x2b98('0x44')]();}function handleStop(){logger[_0x2b98('0x55')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x40fe74){logger[_0x2b98('0x56')](_0x40fe74['message']);process['exit'](0x1);}function handleError(_0x4270eb,_0x4d5644){stats[_0x2b98('0x57')][_0x2b98('0x21')]({'name':_0x4d5644['code'],'message':_0x4d5644[_0x2b98('0x1f')],'row':_0x4270eb});}function handleQuery(_0x26798b){logger[_0x2b98('0x55')](_0x26798b);return db[_0x2b98('0x16')]['query'](_0x26798b)['spread'](function(_0x4f884d){results[_0x2b98('0x21')](_0x4f884d);})['catch'](function(_0x25de95){logger['error'](_0x25de95[_0x2b98('0x1f')]);});}function main(_0x2440c9,_0x228822,_0x23fbdd,_0x36abfa){logger[_0x2b98('0x55')]('main',_0x2440c9,JSON[_0x2b98('0x58')](_0x228822));process[_0x2b98('0x59')](_0x2b98('0x5a'));var _0xbc251f=_0x228822[_0x2b98('0x5b')];var _0x236a4d=_['clone'](_0xbc251f);var _0x31319d=_0x228822[_0x2b98('0x5c')];var _0x147b72=path['join'](config[_0x2b98('0x5d')],'server/files/tmp',_0x31319d+_0x2b98('0x5e'));logger['info']('body',_0x228822);db[_0x2b98('0x5f')][_0x2b98('0x60')]({'raw':!![],'attributes':['id',_0x2b98('0x61')]})[_0x2b98('0x1d')](function(_0x3eb3e4){for(var _0x24225e=0x0;_0x24225e<_0x3eb3e4[_0x2b98('0x23')];_0x24225e++){if(_0x3eb3e4[_0x24225e]['name']in _0xbc251f){contactItemTypes[_0x2b98('0x21')](_0x3eb3e4[_0x24225e]);delete _0x236a4d[_0x3eb3e4[_0x24225e][_0x2b98('0x61')]];hasAdditionalPhones=!![];}for(var _0x25679c in _0xbc251f){if(_0x3eb3e4[_0x24225e][_0x2b98('0x61')]+'_description'===_0x25679c){phoneDescriptions['push']({'itemTypeId':_0x3eb3e4[_0x24225e]['id'],'description':_0x25679c});delete _0x236a4d[_0x25679c];}}}if(hasAdditionalPhones)_0x236a4d[_0x2b98('0x1c')]='';var _0x25e97c=_['keys'](_0x236a4d)['join']();logger[_0x2b98('0x55')](_0x2b98('0x62'),_0x25e97c);fs[_0x2b98('0x63')](_0x147b72,_0x25e97c+'\x0a');Papa[_0x2b98('0x64')](fs[_0x2b98('0x65')](_0x2440c9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3feea,_0x3ea623){try{for(var _0x1e04e9=0x0,_0x45a8ee=[];_0x1e04e9<_0x3feea['data'][_0x2b98('0x23')];_0x1e04e9++){stats['rows']+=0x1;if(_0x3feea[_0x2b98('0x57')][_0x1e04e9]){handleError(_0x3feea[_0x2b98('0x66')][_0x1e04e9],_0x3feea[_0x2b98('0x57')][_0x1e04e9]);}else{var _0x30f140=[];var _0x5461a8=[];var _0x55b229={};for(var _0x42e5da in _0xbc251f){let _0x47810f=contactItemTypes[_0x2b98('0x67')](_0x2103c2=>_0x2103c2[_0x2b98('0x61')]===_0x42e5da);let _0x50b85f=contactItemTypes[_0x2b98('0x67')](_0x36beec=>_0x36beec[_0x2b98('0x61')]+'_description'===_0x42e5da);if(_['isNil'](_0x47810f)&&_['isNil'](_0x50b85f)){if(_0xbc251f['hasOwnProperty'](_0x42e5da)){if(_0x3feea['data'][_0x1e04e9][_0xbc251f[_0x42e5da]]){var _0x5abfa7=_[_0x2b98('0x68')](_0x3feea['data'][_0x1e04e9][_0xbc251f[_0x42e5da]][_0x2b98('0x69')](/"/g,'\x27'));switch(_0x42e5da){case _0x2b98('0x6a'):var _0x108d61=moment(_0x5abfa7,_0x2b98('0x6b'),!![]);if(_0x108d61[_0x2b98('0x6c')]()){_0x45a8ee[_0x2b98('0x21')]('\x22'+_0x5abfa7+'\x22');}else{_0x30f140['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2b98('0x39'):var _0x11474f=parseInt(_0x5abfa7);_0x5abfa7=_[_0x2b98('0x6d')](_0x11474f)||_0x11474f<0x0||_0x11474f>0x4?_0x36abfa?0x3:0x2:_0x11474f;_0x45a8ee[_0x2b98('0x21')]('\x22'+_0x5abfa7+'\x22');break;case _0x2b98('0x6e'):var _0x466137=parseInt(_0x5abfa7);if(_[_0x2b98('0x6f')](_0x466137)&&_['includes'](_0x23fbdd,_0x466137)){_0x45a8ee[_0x2b98('0x21')]('\x22'+_0x466137+'\x22');}else{_0x30f140[_0x2b98('0x21')](_0x2b98('0x70'));}break;case _0x2b98('0x71'):if(isEmail(_0x5abfa7)){_0x45a8ee[_0x2b98('0x21')]('\x22'+_0x5abfa7+'\x22');}else{_0x30f140[_0x2b98('0x21')](_0x2b98('0x72'));}break;case _0x2b98('0x73'):var _0x3f2701=moment(_0x5abfa7,_0x2b98('0x74'),!![]);if(_0x3f2701[_0x2b98('0x6c')]()){_0x45a8ee['push']('\x22'+_0x5abfa7+'\x22');}else{_0x30f140[_0x2b98('0x21')](_0x2b98('0x75'));}break;default:_0x45a8ee[_0x2b98('0x21')]('\x22'+_0x5abfa7+'\x22');}}else{switch(_0x42e5da){case _0x2b98('0x76'):case _0x2b98('0x1a'):_0x30f140['push'](_0x42e5da+_0x2b98('0x77'));break;default:_0x45a8ee[_0x2b98('0x21')]('\x22\x22');}}}}else{var _0x217edb='';if(!_[_0x2b98('0x1b')](_0x47810f)){if(!_0x55b229[_0x2b98('0x78')](_0x47810f['id'])){for(var _0x3ad411=0x0;_0x3ad411<_0xbc251f[_0x42e5da][_0x2b98('0x23')];_0x3ad411++){var _0x5abfa7=_[_0x2b98('0x68')](_0x3feea[_0x2b98('0x66')][_0x1e04e9][_0xbc251f[_0x42e5da][_0x3ad411]][_0x2b98('0x69')](/"/g,'\x27'));var _0x5d266f=phoneDescriptions[_0x2b98('0x67')](_0x47cbc1=>_0x47cbc1['itemTypeId']===_0x47810f['id']);if(!_['isNil'](_0x5d266f)){var _0x23a187=_[_0x2b98('0x68')](_0x3feea[_0x2b98('0x66')][_0x1e04e9][_0xbc251f[_0x5d266f[_0x2b98('0x79')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x23a187))_0x5abfa7=_0x5abfa7+'§'+_0x23a187;}if(_0x217edb=='')_0x217edb=_0x5abfa7;else _0x217edb+='|'+_0x5abfa7;}_0x5461a8[_0x2b98('0x21')](_0x47810f['id']+':'+_0x217edb);_0x55b229[_0x47810f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45a8ee[_0x2b98('0x21')]('\x22'+_0x5461a8[_0x2b98('0x12')](';')+'\x22');}if(_0x30f140[_0x2b98('0x23')]){handleError(_0x3feea[_0x2b98('0x66')][_0x1e04e9],{'code':_0x2b98('0x7a'),'message':_0x30f140[_0x2b98('0x12')]()});}else{fs[_0x2b98('0x7b')](_0x147b72,_0x45a8ee[_0x2b98('0x12')]()+'\x0a');}_0x45a8ee=[];}if(!(stats[_0x2b98('0x7c')]%0xc8)){socket[_0x2b98('0x7d')]('contact:import:'+_0x31319d,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x2b98('0x7e'));_0x3ea623['abort']();}}catch(_0x3c89b1){handleError(_0x3feea[_0x2b98('0x66')][_0x1e04e9],{'code':'SystemError','message':_0x3c89b1[_0x2b98('0x1f')]});logger[_0x2b98('0x56')](_0x2b98('0x7f'),_0x3c89b1[_0x2b98('0x1f')]);}},'complete':function(){try{var _0x45aa8d=[];var _0x3875ae=tempTableName;_0x45aa8d[_0x2b98('0x21')]('CREATE\x20TABLE\x20'+_0x3875ae+'\x20LIKE\x20cm_contacts;');logger[_0x2b98('0x55')](_0x2b98('0x80'),contactItemTypes[_0x2b98('0x23')]);var _0x20c536=util[_0x2b98('0xe')](_0x2b98('0x81'),_0x147b72,_0x3875ae,_0x25e97c,_0x228822[_0x2b98('0x36')],_0x228822[_0x2b98('0x82')]||null,NOW,NOW);if(_['isNil'](_0xbc251f[_0x2b98('0x6a')])){_0x20c536+=_0x2b98('0x83');}_0x45aa8d['push'](_0x20c536);BPromise[_0x2b98('0x84')](_0x45aa8d,handleQuery)[_0x2b98('0x1d')](function(_0xc042b8){BPromise[_0x2b98('0x22')]([handleAdditionalPhones()])['then'](function(){_0x45aa8d=[];for(var _0x1bc025=0x0;_0x1bc025\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.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','name','color','tools_tags','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionFK','interactions','o.id\x20=\x20i.UserId','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','sms','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)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','buildExpression','type','text','value','end','unreadMessages','read','and','Contact','split','contact','ContactId','start','Tag','tags','ids','user','body','plainBody','some','compact','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','tag','clause','filter','capitalize','chat','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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'];(function(_0x171a62,_0x303a59){var _0x13e4c1=function(_0x433474){while(--_0x433474){_0x171a62['push'](_0x171a62['shift']());}};_0x13e4c1(++_0x303a59);}(_0x02e6,0x180));var _0x602e=function(_0x20a714,_0x5ee64a){_0x20a714=_0x20a714-0x0;var _0x3b3f8c=_0x02e6[_0x20a714];return _0x3b3f8c;};'use strict';var _=require(_0x602e('0x0'));var squel=require(_0x602e('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x602e('0x2'));var updateInteraction=require(_0x602e('0x3'))[_0x602e('0x4')];var utils=require(_0x602e('0x5'));var db=require(_0x602e('0x6'))['db'];function skipInteractionsQuery(_0x30119f,_0xfeccc1,_0x542b5d){var _0x510764=![];var _0x3a6f31=utils[_0x602e('0x7')](_0x30119f);if(_0xfeccc1['role']===_0x602e('0x8')&&!_0x542b5d[_0x602e('0x9')]&&!_0x542b5d[_0x3a6f31]){_0x510764=!![];}return _0x510764;}function getTagsQuery(){return squel[_0x602e('0xa')]()['field']('id')[_0x602e('0xb')](_0x602e('0xc'))[_0x602e('0xb')](_0x602e('0xd'))['from'](_0x602e('0xe'));}function getUsersQuery(_0x5b4e52,_0x11e1d2){var _0x15736f=utils['getInteractionFK'](_0x5b4e52);var _0x20d728='user_has_'+_0x5b4e52+'_interactions';var _0x515e48=squel[_0x602e('0xa')]()[_0x602e('0xb')](_0x602e('0xf'))['field'](_0x602e('0x10'))['field'](_0x602e('0x11')+_0x15736f)[_0x602e('0x12')](_0x20d728,'ui')[_0x602e('0x13')](_0x602e('0x14'),'u',_0x602e('0x15'));if(_0x11e1d2[_0x602e('0x16')]>0x0){_0x515e48[_0x602e('0x17')](_0x602e('0x11')+_0x15736f+_0x602e('0x18'),_[_0x602e('0x19')](_0x11e1d2,'id'));}return _0x515e48;}function getInteractionsQuery(_0xfb7bc0){var _0x1745ff=utils['getInteractionsTables'](_0xfb7bc0);var _0x1119a9=utils[_0x602e('0x7')](_0xfb7bc0);var _0x5572fc=utils[_0x602e('0x1a')](_0xfb7bc0);return squel[_0x602e('0xa')]()[_0x602e('0x12')](_0x1745ff[_0x602e('0x1b')],'i')[_0x602e('0x13')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x602e('0x13')]('users','o',_0x602e('0x1c'))[_0x602e('0x13')](_0x1745ff['accounts'],'a','a.id\x20=\x20i.'+_0x1119a9)[_0x602e('0x13')](_0x1745ff[_0x602e('0x1d')],'me',_0x602e('0x1e')+_0x5572fc+_0x602e('0x1f'))[_0x602e('0x13')](_0x1745ff[_0x602e('0x20')],'it',_0x602e('0x21')+_0x5572fc+'\x20=\x20i.id')[_0x602e('0x13')](_0x602e('0xe'),'t',_0x602e('0x22'));}function getSqlClauses(){var _0xf4d8a1={'body':squel[_0x602e('0x23')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x602e('0x23')](),'filter':squel[_0x602e('0x23')](),'read':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x602e('0x23')]()};return _0xf4d8a1;}function parseTagParameter(_0x1682a5){var _0x2b48c0=squel[_0x602e('0x23')]();if(_0x1682a5){var _0x33793f=utils[_0x602e('0x24')](_0x1682a5);_0x33793f[_0x602e('0x25')](function(_0x4a6b5f){_0x2b48c0['or'](_0x602e('0x26'),'%,'+_0x4a6b5f+',%');});}return _0x2b48c0;}function parseReadParameter(_0x5686b4){var _0x4795b1='';if(_0x5686b4){_0x4795b1='unreadMessages\x20{OPERATOR}\x200';if(_0x5686b4==='1'){_0x4795b1=_0x4795b1[_0x602e('0x27')](_0x602e('0x28'),'=');}else{_0x4795b1=_0x4795b1[_0x602e('0x27')](_0x602e('0x28'),'>');}}return _0x4795b1;}function parseSearchFilter(_0x3a6605,_0x19bb1a){var _0x44f4a8=squel['expr']();if(_0x19bb1a){var _0x55db33=_0x19bb1a[_0x602e('0x27')]('\x5c','\x5c\x5c')[_0x602e('0x27')](/'/g,'\x27\x27');var _0x5452d8=qs[_0x602e('0x29')](_0x55db33);if(qs[_0x602e('0x2a')](_0x55db33)){_0x44f4a8['or']('i.id\x20LIKE\x20?',_0x5452d8+'%');if([_0x602e('0x2b'),'whatsapp'][_0x602e('0x2c')](_0x3a6605)){_0x44f4a8['or'](_0x602e('0x2d'),_0x5452d8+'%');}else if(_0x3a6605===_0x602e('0x2e')){_0x44f4a8['or'](_0x602e('0x2f'),_0x5452d8+'%');}else if(_0x3a6605===_0x602e('0x30')){_0x44f4a8['or'](_0x602e('0x31'),_0x5452d8+'%');}}else if(_0x3a6605===_0x602e('0x32')&&qs[_0x602e('0x33')](_0x55db33)){_0x44f4a8['or'](_0x602e('0x34'),_0x5452d8+'%');}else{if(_0x3a6605===_0x602e('0x32')){_0x44f4a8['or'](_0x602e('0x35'),qs[_0x602e('0x36')](_0x55db33,!![]))['or'](_0x602e('0x37'),qs['getFullTextValue'](_0x55db33));}else if(_0x3a6605!==_0x602e('0x2e')){_0x44f4a8['or'](_0x602e('0x38'),qs[_0x602e('0x36')](_0x55db33));}_0x44f4a8['or'](_0x602e('0x39'),qs[_0x602e('0x36')](_0x55db33,!![]),null);}}return _0x44f4a8;}function parseAdvancedSearchFilter(_0xc207a0,_0x35bb3e){var _0x13e2bc=getSqlClauses();var _0x513ba8=as[_0x602e('0x3a')](_0xc207a0);var _0x30e6e7=_0x513ba8['sqlOperator'];for(var _0x4516bd=0x0;_0x4516bd<_0x513ba8['conditions'][_0x602e('0x16')];_0x4516bd++){var _0x2a30eb=_0x513ba8[_0x602e('0x3b')][_0x4516bd];var _0x1e1219='i';var _0x1d4584=_[_0x602e('0x3c')](_0x35bb3e,[_0x602e('0xc'),_0x2a30eb[_0x602e('0xb')]]);if(_0x1d4584){var _0x363d47=as[_0x602e('0x3d')](_0x1e1219,_0x1d4584[_0x602e('0x3e')],_0x2a30eb);_0x13e2bc['default'][_0x30e6e7](_0x363d47[_0x602e('0x3f')],_0x363d47['value']['start'],_0x363d47[_0x602e('0x40')][_0x602e('0x41')]);}else{switch(_0x2a30eb[_0x602e('0xb')]){case _0x602e('0x42'):var _0x19ddc1=parseReadParameter(_0x2a30eb['value']);_0x13e2bc[_0x602e('0x43')][_0x602e('0x44')](_0x19ddc1);break;case _0x602e('0x45'):if(_0x2a30eb['operator']==='$substring'){if(_0x2a30eb[_0x602e('0x40')][_0x602e('0x46')]('\x20')[_0x602e('0x16')]>0x1){_0x13e2bc[_0x602e('0x47')][_0x30e6e7](_0x602e('0x39'),qs[_0x602e('0x36')](_0x2a30eb[_0x602e('0x40')],!![]),null);}else{var _0x5deeb4='%'+_0x2a30eb[_0x602e('0x40')]+'%';_0x13e2bc[_0x602e('0x47')][_0x30e6e7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5deeb4,_0x5deeb4,_0x5deeb4);}}else{_0x1d4584=_['find'](_0x35bb3e,[_0x602e('0xc'),_0x602e('0x48')]);_0x2a30eb[_0x602e('0xb')]=_0x602e('0x48');_0x363d47=as[_0x602e('0x3d')](_0x1e1219,_0x1d4584[_0x602e('0x3e')],_0x2a30eb);_0x13e2bc[_0x602e('0x47')][_0x30e6e7](_0x363d47['text'],_0x363d47[_0x602e('0x40')][_0x602e('0x49')],_0x363d47[_0x602e('0x40')]['end']);}break;case _0x602e('0x4a'):var _0x59e454=_0x2a30eb['value'][_0x602e('0x46')](',')[_0x602e('0x19')](function(_0x26dda2){return Number(_0x26dda2);});var _0x5bee32=parseTagParameter(_0x59e454);_0x13e2bc[_0x602e('0x4b')]['clause'][_0x602e('0x44')](_0x5bee32);_0x13e2bc['tags'][_0x602e('0x4c')]=_0x59e454;break;case'User':if(_0x2a30eb['operator']==='$substring'){_0x13e2bc[_0x602e('0x4d')][_0x30e6e7]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x2a30eb[_0x602e('0x40')]+'%',null);}else{_0x1d4584=_[_0x602e('0x3c')](_0x35bb3e,['name','UserId']);_0x2a30eb[_0x602e('0xb')]='UserId';_0x363d47=as['buildExpression'](_0x1e1219,_0x1d4584[_0x602e('0x3e')],_0x2a30eb);_0x13e2bc[_0x602e('0x4d')][_0x30e6e7](_0x363d47[_0x602e('0x3f')],_0x363d47[_0x602e('0x40')][_0x602e('0x49')],_0x363d47[_0x602e('0x40')][_0x602e('0x41')]);}break;case _0x602e('0x4e'):case _0x602e('0x4f'):_0x363d47=as[_0x602e('0x3d')]('me',null,_0x2a30eb);_0x13e2bc[_0x602e('0x4e')][_0x30e6e7](_0x363d47['text'],_0x363d47[_0x602e('0x40')][_0x602e('0x49')],_0x363d47[_0x602e('0x40')][_0x602e('0x41')]);break;}}}return _0x13e2bc;}function parseModelFields(_0x2bee95,_0x3cb9b6,_0x56c6ae){var _0x353fea=utils[_0x602e('0x7')](_0x2bee95);var _0x371e99=squel[_0x602e('0x23')]();var _0x26b5e7=_(_0x3cb9b6)['keys']()['map'](function(_0x634bd4){return _[_0x602e('0x50')](_0x56c6ae,[_0x602e('0xc'),_0x634bd4])?_0x634bd4:undefined;})[_0x602e('0x51')]()['value']();if(_0x26b5e7[_0x602e('0x16')]>0x0){_0x26b5e7[_0x602e('0x25')](function(_0x2ad69c){if(_0x2ad69c===_0x353fea){_0x371e99['and']('i.'+_0x353fea+_0x602e('0x18'),[]['concat'](_0x3cb9b6[_0x2ad69c]));}else if(_0x2ad69c===_0x602e('0x52')){var _0x59a69e=JSON[_0x602e('0x53')](_0x3cb9b6[_0x2ad69c])[_0x602e('0x54')];var _0x3aad20=JSON['parse'](_0x3cb9b6[_0x2ad69c])['$lte'];_0x371e99[_0x602e('0x44')](_0x602e('0x55'),_0x59a69e,_0x3aad20);}else{if(_0x3cb9b6[_0x2ad69c]===_0x602e('0x56')){_0x371e99['and']('i.'+_0x2ad69c+'\x20IS\x20NULL');}else{_0x371e99[_0x602e('0x44')]('i.'+_0x2ad69c+_0x602e('0x57'),_0x3cb9b6[_0x2ad69c]);}}});}return _0x371e99;}function parseQueryParameters(_0x5eba6b,_0x4aadd2,_0x3c97fd){var _0x638ffb=getSqlClauses();return Promise[_0x602e('0x58')]()['then'](function(){return parseModelFields(_0x5eba6b,_0x4aadd2,_0x3c97fd);})[_0x602e('0x59')](function(_0x960032){_0x638ffb[_0x602e('0x5a')]['and'](_0x960032);return parseReadParameter(_0x4aadd2[_0x602e('0x43')]);})[_0x602e('0x59')](function(_0x59e954){_0x638ffb[_0x602e('0x43')][_0x602e('0x44')](_0x59e954);return parseTagParameter(_0x4aadd2[_0x602e('0x5b')]);})[_0x602e('0x59')](function(_0x50c511){_0x638ffb['tags'][_0x602e('0x5c')][_0x602e('0x44')](_0x50c511);return parseSearchFilter(_0x5eba6b,_0x4aadd2[_0x602e('0x5d')]);})[_0x602e('0x59')](function(_0x562c99){_0x638ffb[_0x602e('0x5d')]=_0x562c99;return _0x638ffb;});}function checkAccountsRestrictions(_0x527224,_0x3bc72b,_0x20c9b3){var _0x12ec74=utils[_0x602e('0x7')](_0x527224);var _0x55d7e2='get'+_[_0x602e('0x5e')](_0x527224)+(_0x527224===_0x602e('0x5f')?_0x602e('0x60'):_0x602e('0x61'));var _0x33ed84=squel[_0x602e('0x23')]();return Promise[_0x602e('0x58')]()[_0x602e('0x59')](function(){if(_0x20c9b3[_0x602e('0x9')]&&_0x3bc72b[_0x602e('0x62')]===_0x602e('0x8')){return _0x3bc72b[_0x55d7e2]({'attributes':['id'],'raw':!![]});}})[_0x602e('0x59')](function(_0x483b76){if(_0x483b76){if(_0x483b76[_0x602e('0x16')]===0x0){_0x33ed84['and']('i.'+_0x12ec74+'\x20IS\x20NULL');}else{_0x33ed84[_0x602e('0x44')]('i.'+_0x12ec74+_0x602e('0x18'),_[_0x602e('0x19')](_0x483b76,'id'));}}else if(!_0x20c9b3[_0x12ec74]){_0x33ed84[_0x602e('0x44')]('i.'+_0x12ec74+_0x602e('0x63'));}})[_0x602e('0x59')](function(){return _0x33ed84;});}function getClosedOrderClause(_0x226a3e,_0xfe67bc){var _0x287fa5='';var _0xa8c307=[_0x602e('0x64'),_0x602e('0x65'),_0x602e('0x66')];if(_0x226a3e==='mail'){_0xa8c307[_0x602e('0x67')](_0x602e('0x68'));}if(_0xfe67bc[_0x602e('0x69')]==='0'&&_0x226a3e===_0x602e('0x32')){_0x287fa5=_0x602e('0x68');}else{if(_0xfe67bc[_0x602e('0x69')]==='1'){_0xa8c307[_0x602e('0x6a')]();}_0x287fa5=_0x602e('0x6b')+_0xa8c307[_0x602e('0x6c')](',\x20')+')';}return _0x287fa5;}function getFilteredInteractions(_0x358573,_0x5c1541,_0x24249a,_0x3691f0){var _0x5e6a81=utils[_0x602e('0x1a')](_0x358573);var _0xc400b2=_[_0x602e('0x5e')](_0x358573)+_0x602e('0x6d');var _0x3a3f8a=[];var _0x14bea6=getTagsQuery();var _0x10149c={'type':db[_0x602e('0x6e')][_0x602e('0x6f')][_0x602e('0x70')],'raw':!![]};var _0x5012e8=[];var _0x444d3c=[];return db[_0x602e('0x71')][_0x602e('0x72')](_0x14bea6['toString'](),_0x10149c)['then'](function(_0x2177f3){_0x3a3f8a=_[_0x602e('0x73')](_0x2177f3,'id');_0x10149c=_[_0x602e('0x74')](_0x10149c,{'model':db[_0xc400b2],'mapToModel':!![],'nest':!![]});if(_0x24249a[_0x602e('0x5a')]){_0x3691f0[_0x602e('0x75')]['forEach'](function(_0x125b93){_0x5c1541[_0x602e('0xb')]('i.'+_0x125b93);});}else{_0x5c1541[_0x602e('0xb')](_0x602e('0x76'),'unreadMessages');_0x5c1541[_0x602e('0xb')](_0x602e('0x77'),_0x602e('0x78'));_0x5c1541[_0x602e('0xb')](_0x602e('0x79'),_0x602e('0x7a'));if(_0x358573===_0x602e('0x32')){_0x5c1541[_0x602e('0xb')]('a.email',_0x602e('0x7b'));_0x5c1541[_0x602e('0xb')](_0x602e('0x7c'),_0x602e('0x7d'));_0x5c1541[_0x602e('0xb')](_0x602e('0x7e'));_0x5c1541['field'](_0x602e('0x7f'));_0x5c1541[_0x602e('0xb')](_0x602e('0x80'));_0x5c1541[_0x602e('0xb')](_0x602e('0x81'));_0x5c1541[_0x602e('0xb')](_0x602e('0x82'));_0x5c1541[_0x602e('0xb')](_0x602e('0x83'));_0x5c1541[_0x602e('0xb')](_0x602e('0x84'));_0x5c1541[_0x602e('0xb')](_0x602e('0x85'));_0x5c1541['field']('i.subject');_0x5c1541[_0x602e('0xb')]('i.disposition');_0x5c1541['field']('i.secondDisposition');_0x5c1541[_0x602e('0xb')](_0x602e('0x64'));_0x5c1541[_0x602e('0xb')](_0x602e('0x68'));_0x5c1541['field'](_0x602e('0x86'));_0x5c1541['field'](_0x602e('0x87'));_0x5c1541[_0x602e('0xb')](_0x602e('0x88'));_0x5c1541[_0x602e('0xb')](_0x602e('0x89'));}else if(_0x358573===_0x602e('0x30')){_0x5c1541[_0x602e('0xb')](_0x602e('0x8a'),_0x602e('0x7d'));}else{_0x5c1541['field'](_0x602e('0x8b'),_0x602e('0x7d'));}if(_0x358573!==_0x602e('0x32')){_0x5c1541[_0x602e('0xb')](_0x602e('0x8c'));}_0x5c1541[_0x602e('0xb')](_0x602e('0x8d'),_0x602e('0x8e'));_0x5c1541[_0x602e('0xb')](_0x602e('0x8f'),_0x602e('0x90'));_0x5c1541[_0x602e('0xb')](_0x602e('0x91'),_0x602e('0x92'));_0x5c1541['field'](_0x602e('0x93'),_0x602e('0x94'));_0x5c1541['field'](_0x602e('0x95'),_0x602e('0x96'));_0x5c1541[_0x602e('0xb')](_0x602e('0x97'),_0x602e('0x98'));_0x5c1541['field']('o.fullname',_0x602e('0x99'));_0x5c1541[_0x602e('0xb')](_0x602e('0x9a'),'Owner.internal');_0x5c1541[_0x602e('0xb')](_0x602e('0x9b'),_0x602e('0x9c'));}if(_0x3691f0['limit']){_0x5c1541['limit'](_0x3691f0[_0x602e('0x9d')]);}if(_0x3691f0[_0x602e('0x9e')]){_0x5c1541['offset'](_0x3691f0[_0x602e('0x9e')]);}return db[_0x602e('0x71')]['query'](_0x5c1541[_0x602e('0x9f')](),_0x10149c);})[_0x602e('0x59')](function(_0x446616){_0x5012e8=_0x446616;var _0x511666=getUsersQuery(_0x358573,_0x5012e8);return db[_0x602e('0x71')]['query'](_0x511666[_0x602e('0x9f')](),_0x10149c);})['then'](function(_0xb336b6){_0x444d3c=_[_0x602e('0xa0')](_0xb336b6,_0x5e6a81);if(_0x358573===_0x602e('0x32')){return db[_0x602e('0xa1')][_0x602e('0xa2')]({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x593285){var _0x1a51bc=_0x593285?_0x593285[_0x602e('0xa3')]:undefined;var _0x2891d6=_0x5012e8[_0x602e('0x19')](function(_0x1c2456){return updateInteraction(_0x1c2456,_0x3a3f8a,_0x444d3c,_0x1a51bc);});return Promise[_0x602e('0xa4')](_0x2891d6);});}function countFilteredInteractions(_0x464e0d,_0x2e249b){var _0x3df745=_0x464e0d[_0x602e('0xa5')]();_0x3df745[_0x602e('0xb')](_0x602e('0xa6'));_0x3df745[_0x602e('0xb')](_0x602e('0x76'),_0x602e('0x42'));var _0x4051e9=utils[_0x602e('0x24')](_0x2e249b);if(!_[_0x602e('0xa7')](_0x4051e9)){_0x3df745[_0x602e('0x17')](_0x602e('0xa8'),_0x4051e9);}var _0x405fa9={'type':db[_0x602e('0x6e')][_0x602e('0x6f')][_0x602e('0x70')],'raw':!![]};return db['sequelize'][_0x602e('0x72')](_0x3df745[_0x602e('0x9f')](),_0x405fa9);}module[_0x602e('0xa9')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x105c=['c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','user_has_','u.id','u.fullname','ui.','left_join','length','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','buildExpression','type','default','start','value','unreadMessages','read','and','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','end','split','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','keys','some','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','then','fields','capitalize','chat','Accounts','resolve','\x20IS\x20NOT\x20NULL','i.thirdDisposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','sequelize','toString','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.email','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','i.*'];(function(_0x391a6c,_0x3c7945){var _0x2a60b6=function(_0x213307){while(--_0x213307){_0x391a6c['push'](_0x391a6c['shift']());}};_0x2a60b6(++_0x3c7945);}(_0x105c,0x1e6));var _0xc105=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0x105c[_0x1e6659];return _0x4d16e4;};'use strict';var _=require(_0xc105('0x0'));var squel=require('squel');var as=require(_0xc105('0x1'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require(_0xc105('0x2'));var db=require(_0xc105('0x3'))['db'];function skipInteractionsQuery(_0x1cca98,_0x4e2f92,_0x991594){var _0x4d386a=![];var _0x121db1=utils[_0xc105('0x4')](_0x1cca98);if(_0x4e2f92[_0xc105('0x5')]===_0xc105('0x6')&&!_0x991594[_0xc105('0x7')]&&!_0x991594[_0x121db1]){_0x4d386a=!![];}return _0x4d386a;}function getTagsQuery(){return squel[_0xc105('0x8')]()['field']('id')[_0xc105('0x9')](_0xc105('0xa'))[_0xc105('0x9')](_0xc105('0xb'))[_0xc105('0xc')](_0xc105('0xd'));}function getUsersQuery(_0x5c1256,_0x23cda5){var _0x14b8de=utils['getInteractionFK'](_0x5c1256);var _0x44203d=_0xc105('0xe')+_0x5c1256+'_interactions';var _0x3f2c41=squel[_0xc105('0x8')]()['field'](_0xc105('0xf'))['field'](_0xc105('0x10'))[_0xc105('0x9')](_0xc105('0x11')+_0x14b8de)[_0xc105('0xc')](_0x44203d,'ui')[_0xc105('0x12')]('users','u','u.id\x20=\x20ui.UserId');if(_0x23cda5[_0xc105('0x13')]>0x0){_0x3f2c41['where'](_0xc105('0x11')+_0x14b8de+_0xc105('0x14'),_[_0xc105('0x15')](_0x23cda5,'id'));}return _0x3f2c41;}function getInteractionsQuery(_0x355ba2){var _0x303d17=utils[_0xc105('0x16')](_0x355ba2);var _0xc6840e=utils[_0xc105('0x4')](_0x355ba2);var _0x1f7909=utils[_0xc105('0x17')](_0x355ba2);return squel[_0xc105('0x8')]()['from'](_0x303d17['interactions'],'i')[_0xc105('0x12')](_0xc105('0x18'),'c',_0xc105('0x19'))[_0xc105('0x12')](_0xc105('0x1a'),'o',_0xc105('0x1b'))[_0xc105('0x12')](_0x303d17['accounts'],'a',_0xc105('0x1c')+_0xc6840e)[_0xc105('0x12')](_0x303d17[_0xc105('0x1d')],'me','me.'+_0x1f7909+_0xc105('0x1e'))['left_join'](_0x303d17[_0xc105('0x1f')],'it',_0xc105('0x20')+_0x1f7909+_0xc105('0x1e'))[_0xc105('0x12')](_0xc105('0xd'),'t',_0xc105('0x21'));}function getSqlClauses(){var _0x42ff49={'body':squel[_0xc105('0x22')](),'contact':squel[_0xc105('0x22')](),'default':squel['expr'](),'fields':squel[_0xc105('0x22')](),'filter':squel[_0xc105('0x22')](),'read':squel['expr'](),'tags':{'clause':squel[_0xc105('0x22')](),'ids':null},'user':squel[_0xc105('0x22')]()};return _0x42ff49;}function parseTagParameter(_0x1dcbc0){var _0x144339=squel[_0xc105('0x22')]();if(_0x1dcbc0){var _0x457ba1=utils[_0xc105('0x23')](_0x1dcbc0);_0x457ba1[_0xc105('0x24')](function(_0x43f33d){_0x144339['or'](_0xc105('0x25'),'%,'+_0x43f33d+',%');});}return _0x144339;}function parseReadParameter(_0xd47f1d){var _0x299c06='';if(_0xd47f1d){_0x299c06='unreadMessages\x20{OPERATOR}\x200';if(_0xd47f1d==='1'){_0x299c06=_0x299c06['replace'](_0xc105('0x26'),'=');}else{_0x299c06=_0x299c06[_0xc105('0x27')]('{OPERATOR}','>');}}return _0x299c06;}function parseSearchFilter(_0x12e77f,_0x2fcd98){var _0x2aadc0=squel['expr']();if(_0x2fcd98){var _0x2a014a=_0x2fcd98[_0xc105('0x27')]('\x5c','\x5c\x5c')[_0xc105('0x27')](/'/g,'\x27\x27');var _0x27b373=qs[_0xc105('0x28')](_0x2a014a);if(qs[_0xc105('0x29')](_0x2a014a)){_0x2aadc0['or'](_0xc105('0x2a'),_0x27b373+'%');if([_0xc105('0x2b'),_0xc105('0x2c')][_0xc105('0x2d')](_0x12e77f)){_0x2aadc0['or'](_0xc105('0x2e'),_0x27b373+'%');}else if(_0x12e77f==='fax'){_0x2aadc0['or']('i.fax\x20LIKE\x20?',_0x27b373+'%');}else if(_0x12e77f==='openchannel'){_0x2aadc0['or'](_0xc105('0x2f'),_0x27b373+'%');}}else if(_0x12e77f==='mail'&&qs['isEmail'](_0x2a014a)){_0x2aadc0['or'](_0xc105('0x30'),_0x27b373+'%');}else{if(_0x12e77f===_0xc105('0x31')){_0x2aadc0['or'](_0xc105('0x32'),qs[_0xc105('0x33')](_0x2a014a,!![]))['or'](_0xc105('0x34'),qs[_0xc105('0x33')](_0x2a014a));}else if(_0x12e77f!==_0xc105('0x35')){_0x2aadc0['or'](_0xc105('0x36'),qs[_0xc105('0x33')](_0x2a014a));}_0x2aadc0['or'](_0xc105('0x37'),qs[_0xc105('0x33')](_0x2a014a,!![]),null);}}return _0x2aadc0;}function parseAdvancedSearchFilter(_0x1122e7,_0x3971e5){var _0x283050=getSqlClauses();var _0x2c3d5e=as[_0xc105('0x38')](_0x1122e7);var _0x44bf4d=_0x2c3d5e[_0xc105('0x39')];for(var _0x303784=0x0;_0x303784<_0x2c3d5e[_0xc105('0x3a')][_0xc105('0x13')];_0x303784++){var _0x3bf87a=_0x2c3d5e[_0xc105('0x3a')][_0x303784];var _0x59c958='i';var _0x4e11dc=_['find'](_0x3971e5,[_0xc105('0xa'),_0x3bf87a[_0xc105('0x9')]]);if(_0x4e11dc){var _0x2633e4=as[_0xc105('0x3b')](_0x59c958,_0x4e11dc[_0xc105('0x3c')],_0x3bf87a);_0x283050[_0xc105('0x3d')][_0x44bf4d](_0x2633e4['text'],_0x2633e4['value'][_0xc105('0x3e')],_0x2633e4[_0xc105('0x3f')]['end']);}else{switch(_0x3bf87a[_0xc105('0x9')]){case _0xc105('0x40'):var _0x2b2397=parseReadParameter(_0x3bf87a[_0xc105('0x3f')]);_0x283050[_0xc105('0x41')][_0xc105('0x42')](_0x2b2397);break;case'Contact':if(_0x3bf87a[_0xc105('0x43')]===_0xc105('0x44')){if(_0x3bf87a['value']['split']('\x20')[_0xc105('0x13')]>0x1){_0x283050['contact'][_0x44bf4d](_0xc105('0x37'),qs['getFullTextValue'](_0x3bf87a[_0xc105('0x3f')],!![]),null);}else{var _0x5afe1c='%'+_0x3bf87a[_0xc105('0x3f')]+'%';_0x283050[_0xc105('0x45')][_0x44bf4d](_0xc105('0x46'),_0x5afe1c,_0x5afe1c,_0x5afe1c);}}else{_0x4e11dc=_[_0xc105('0x47')](_0x3971e5,[_0xc105('0xa'),_0xc105('0x48')]);_0x3bf87a['field']=_0xc105('0x48');_0x2633e4=as[_0xc105('0x3b')](_0x59c958,_0x4e11dc[_0xc105('0x3c')],_0x3bf87a);_0x283050[_0xc105('0x45')][_0x44bf4d](_0x2633e4[_0xc105('0x49')],_0x2633e4[_0xc105('0x3f')][_0xc105('0x3e')],_0x2633e4['value'][_0xc105('0x4a')]);}break;case'Tag':var _0x2e4f76=_0x3bf87a['value'][_0xc105('0x4b')](',')[_0xc105('0x15')](function(_0x27c4f6){return Number(_0x27c4f6);});var _0x45254e=parseTagParameter(_0x2e4f76);_0x283050['tags'][_0xc105('0x4c')][_0xc105('0x42')](_0x45254e);_0x283050['tags']['ids']=_0x2e4f76;break;case _0xc105('0x4d'):if(_0x3bf87a[_0xc105('0x43')]===_0xc105('0x44')){_0x283050[_0xc105('0x4e')][_0x44bf4d](_0xc105('0x4f'),'%'+_0x3bf87a['value']+'%',null);}else{_0x4e11dc=_[_0xc105('0x47')](_0x3971e5,['name','UserId']);_0x3bf87a[_0xc105('0x9')]=_0xc105('0x50');_0x2633e4=as[_0xc105('0x3b')](_0x59c958,_0x4e11dc[_0xc105('0x3c')],_0x3bf87a);_0x283050['user'][_0x44bf4d](_0x2633e4[_0xc105('0x49')],_0x2633e4[_0xc105('0x3f')][_0xc105('0x3e')],_0x2633e4[_0xc105('0x3f')][_0xc105('0x4a')]);}break;case _0xc105('0x51'):case'plainBody':_0x2633e4=as[_0xc105('0x3b')]('me',null,_0x3bf87a);_0x283050[_0xc105('0x51')][_0x44bf4d](_0x2633e4[_0xc105('0x49')],_0x2633e4[_0xc105('0x3f')]['start'],_0x2633e4[_0xc105('0x3f')]['end']);break;}}}return _0x283050;}function parseModelFields(_0x3c59c5,_0x2af247,_0x37447a){var _0x12d79f=utils[_0xc105('0x4')](_0x3c59c5);var _0x1678de=squel[_0xc105('0x22')]();var _0x4c8c2e=_(_0x2af247)[_0xc105('0x52')]()[_0xc105('0x15')](function(_0x1b2b6d){return _[_0xc105('0x53')](_0x37447a,[_0xc105('0xa'),_0x1b2b6d])?_0x1b2b6d:undefined;})[_0xc105('0x54')]()[_0xc105('0x3f')]();if(_0x4c8c2e[_0xc105('0x13')]>0x0){_0x4c8c2e['forEach'](function(_0x5876e3){if(_0x5876e3===_0x12d79f){_0x1678de['and']('i.'+_0x12d79f+_0xc105('0x14'),[][_0xc105('0x55')](_0x2af247[_0x5876e3]));}else if(_0x5876e3===_0xc105('0x56')){var _0x37d89b=JSON[_0xc105('0x57')](_0x2af247[_0x5876e3])[_0xc105('0x58')];var _0xcc78dd=JSON['parse'](_0x2af247[_0x5876e3])[_0xc105('0x59')];_0x1678de['and'](_0xc105('0x5a'),_0x37d89b,_0xcc78dd);}else{if(_0x2af247[_0x5876e3]===_0xc105('0x5b')){_0x1678de['and']('i.'+_0x5876e3+_0xc105('0x5c'));}else{_0x1678de[_0xc105('0x42')]('i.'+_0x5876e3+'\x20=\x20?',_0x2af247[_0x5876e3]);}}});}return _0x1678de;}function parseQueryParameters(_0x3b60bc,_0x38e580,_0x5c9499){var _0x2606df=getSqlClauses();return Promise['resolve']()[_0xc105('0x5d')](function(){return parseModelFields(_0x3b60bc,_0x38e580,_0x5c9499);})[_0xc105('0x5d')](function(_0x3b6bc3){_0x2606df[_0xc105('0x5e')]['and'](_0x3b6bc3);return parseReadParameter(_0x38e580[_0xc105('0x41')]);})[_0xc105('0x5d')](function(_0x2d837a){_0x2606df[_0xc105('0x41')][_0xc105('0x42')](_0x2d837a);return parseTagParameter(_0x38e580['tag']);})['then'](function(_0x47291e){_0x2606df['tags'][_0xc105('0x4c')]['and'](_0x47291e);return parseSearchFilter(_0x3b60bc,_0x38e580['filter']);})[_0xc105('0x5d')](function(_0x513a9b){_0x2606df['filter']=_0x513a9b;return _0x2606df;});}function checkAccountsRestrictions(_0x447475,_0x3ff6a6,_0x58f559){var _0x72fe6b=utils[_0xc105('0x4')](_0x447475);var _0xc7afc5='get'+_[_0xc105('0x5f')](_0x447475)+(_0x447475===_0xc105('0x60')?'Websites':_0xc105('0x61'));var _0x158985=squel[_0xc105('0x22')]();return Promise[_0xc105('0x62')]()[_0xc105('0x5d')](function(){if(_0x58f559[_0xc105('0x7')]&&_0x3ff6a6[_0xc105('0x5')]===_0xc105('0x6')){return _0x3ff6a6[_0xc7afc5]({'attributes':['id'],'raw':!![]});}})[_0xc105('0x5d')](function(_0x3088fd){if(_0x3088fd){if(_0x3088fd[_0xc105('0x13')]===0x0){_0x158985[_0xc105('0x42')]('i.'+_0x72fe6b+_0xc105('0x5c'));}else{_0x158985[_0xc105('0x42')]('i.'+_0x72fe6b+_0xc105('0x14'),_[_0xc105('0x15')](_0x3088fd,'id'));}}else if(!_0x58f559[_0x72fe6b]){_0x158985[_0xc105('0x42')]('i.'+_0x72fe6b+_0xc105('0x63'));}})[_0xc105('0x5d')](function(){return _0x158985;});}function getClosedOrderClause(_0x6bf83c,_0x32e275){var _0x3091d5='';var _0x4e7060=[_0xc105('0x64'),'i.secondDisposition','i.disposition'];if(_0x6bf83c==='mail'){_0x4e7060[_0xc105('0x65')](_0xc105('0x66'));}if(_0x32e275[_0xc105('0x67')]==='0'&&_0x6bf83c===_0xc105('0x31')){_0x3091d5=_0xc105('0x66');}else{if(_0x32e275['closed']==='1'){_0x4e7060[_0xc105('0x68')]();}_0x3091d5=_0xc105('0x69')+_0x4e7060['join'](',\x20')+')';}return _0x3091d5;}function getFilteredInteractions(_0x1f5ba2,_0x2884f6,_0xa3159d,_0x1ad029){var _0x1d8c06=utils[_0xc105('0x17')](_0x1f5ba2);var _0x42a355=_[_0xc105('0x5f')](_0x1f5ba2)+_0xc105('0x6a');var _0x5a5a4a=[];var _0x474471=getTagsQuery();var _0x2ae1b9={'type':db[_0xc105('0x6b')][_0xc105('0x6c')][_0xc105('0x6d')],'raw':!![]};var _0x228cf4=[];var _0x588b9c=[];return db[_0xc105('0x6e')]['query'](_0x474471[_0xc105('0x6f')](),_0x2ae1b9)[_0xc105('0x5d')](function(_0x3ff4ad){_0x5a5a4a=_[_0xc105('0x70')](_0x3ff4ad,'id');_0x2ae1b9=_['merge'](_0x2ae1b9,{'model':db[_0x42a355],'mapToModel':!![],'nest':!![]});if(_0xa3159d[_0xc105('0x5e')]){_0x1ad029[_0xc105('0x71')][_0xc105('0x24')](function(_0x1f18f4){_0x2884f6['field']('i.'+_0x1f18f4);});}else{_0x2884f6[_0xc105('0x9')](_0xc105('0x72'),_0xc105('0x40'));_0x2884f6[_0xc105('0x9')](_0xc105('0x73'),_0xc105('0x74'));_0x2884f6[_0xc105('0x9')](_0xc105('0x75'),'Account.mandatoryDisposition');if(_0x1f5ba2===_0xc105('0x31')){_0x2884f6['field']('a.email',_0xc105('0x76'));_0x2884f6[_0xc105('0x9')]('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',_0xc105('0x77'));_0x2884f6[_0xc105('0x9')](_0xc105('0x78'));_0x2884f6[_0xc105('0x9')](_0xc105('0x79'));_0x2884f6['field']('i.updatedAt');_0x2884f6['field'](_0xc105('0x7a'));_0x2884f6['field'](_0xc105('0x7b'));_0x2884f6['field'](_0xc105('0x7c'));_0x2884f6[_0xc105('0x9')]('i.lastMsgAt');_0x2884f6[_0xc105('0x9')](_0xc105('0x7d'));_0x2884f6[_0xc105('0x9')]('i.subject');_0x2884f6[_0xc105('0x9')](_0xc105('0x7e'));_0x2884f6[_0xc105('0x9')](_0xc105('0x7f'));_0x2884f6[_0xc105('0x9')](_0xc105('0x64'));_0x2884f6[_0xc105('0x9')](_0xc105('0x66'));_0x2884f6[_0xc105('0x9')](_0xc105('0x80'));_0x2884f6[_0xc105('0x9')](_0xc105('0x81'));_0x2884f6[_0xc105('0x9')](_0xc105('0x82'));_0x2884f6[_0xc105('0x9')](_0xc105('0x83'));}else if(_0x1f5ba2===_0xc105('0x84')){_0x2884f6[_0xc105('0x9')]('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',_0xc105('0x77'));}else{_0x2884f6['field']('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',_0xc105('0x77'));}if(_0x1f5ba2!==_0xc105('0x31')){_0x2884f6[_0xc105('0x9')](_0xc105('0x85'));}_0x2884f6[_0xc105('0x9')](_0xc105('0x86'),_0xc105('0x87'));_0x2884f6[_0xc105('0x9')](_0xc105('0x88'),_0xc105('0x89'));_0x2884f6[_0xc105('0x9')]('c.email',_0xc105('0x8a'));_0x2884f6[_0xc105('0x9')]('c.phone',_0xc105('0x8b'));_0x2884f6[_0xc105('0x9')]('c.mobile',_0xc105('0x8c'));_0x2884f6[_0xc105('0x9')](_0xc105('0x8d'),_0xc105('0x8e'));_0x2884f6[_0xc105('0x9')](_0xc105('0x8f'),_0xc105('0x90'));_0x2884f6[_0xc105('0x9')](_0xc105('0x91'),'Owner.internal');_0x2884f6['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc105('0x92'));}if(_0x1ad029['limit']){_0x2884f6[_0xc105('0x93')](_0x1ad029[_0xc105('0x93')]);}if(_0x1ad029[_0xc105('0x94')]){_0x2884f6[_0xc105('0x94')](_0x1ad029[_0xc105('0x94')]);}return db['sequelize'][_0xc105('0x95')](_0x2884f6[_0xc105('0x6f')](),_0x2ae1b9);})[_0xc105('0x5d')](function(_0x2e0e0b){_0x228cf4=_0x2e0e0b;var _0x48b5c4=getUsersQuery(_0x1f5ba2,_0x228cf4);return db['sequelize'][_0xc105('0x95')](_0x48b5c4[_0xc105('0x6f')](),_0x2ae1b9);})['then'](function(_0xd32f05){_0x588b9c=_[_0xc105('0x96')](_0xd32f05,_0x1d8c06);if(_0x1f5ba2==='mail'){return db['Setting'][_0xc105('0x97')]({'attributes':[_0xc105('0x98')],'raw':!![]});}})['then'](function(_0x4bee97){var _0x16fa9b=_0x4bee97?_0x4bee97[_0xc105('0x98')]:undefined;var _0x38e422=_0x228cf4[_0xc105('0x15')](function(_0x4e9b07){return updateInteraction(_0x4e9b07,_0x5a5a4a,_0x588b9c,_0x16fa9b);});return Promise['all'](_0x38e422);});}function countFilteredInteractions(_0x227dd,_0x9044fd){var _0x585a64=_0x227dd['clone']();_0x585a64[_0xc105('0x9')]('COUNT(*)');_0x585a64[_0xc105('0x9')](_0xc105('0x72'),_0xc105('0x40'));var _0x597bc1=utils[_0xc105('0x23')](_0x9044fd);if(!_['isEmpty'](_0x597bc1)){_0x585a64['where'](_0xc105('0x99'),_0x597bc1);}var _0x34136b={'type':db[_0xc105('0x6b')]['QueryTypes'][_0xc105('0x6d')],'raw':!![]};return db['sequelize'][_0xc105('0x95')](_0x585a64['toString'](),_0x34136b);}module[_0xc105('0x9a')]={'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 7a4678d..f290722 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 _0x1e6b=['MailMessage','findOne','out','-id','then','lastMsgText','trimStart','plainBody','updateInteraction','Tags','TagIds','catch','lodash','map','fullname','split','forEach','push','waiting','talking','answered','total','closed','disposition','UserId'];(function(_0x4cf9f9,_0x175b3b){var _0xb18c4=function(_0x252e08){while(--_0x252e08){_0x4cf9f9['push'](_0x4cf9f9['shift']());}};_0xb18c4(++_0x175b3b);}(_0x1e6b,0x11f));var _0xb1e6=function(_0x3e3d9f,_0x29b853){_0x3e3d9f=_0x3e3d9f-0x0;var _0xb82f4e=_0x1e6b[_0x3e3d9f];return _0xb82f4e;};'use strict';var _=require(_0xb1e6('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x18aff6,_0x5b758b){return new Promise(function(_0x467cb6,_0x30e813){try{var _0x325dbd=[];if(_0x5b758b[_0x18aff6]){_0x325dbd=_0x5b758b[_0x18aff6][_0xb1e6('0x1')](function(_0x3deeae){return{'id':_0x3deeae['id'],'fullname':_0x3deeae[_0xb1e6('0x2')]};});}return _0x467cb6(_0x325dbd);}catch(_0x291015){_0x30e813(_0x291015);}});}function getInteractionTags(_0x7c845b,_0x5a691a){var _0x6c42f5=[];if(_0x7c845b){_0x7c845b[_0xb1e6('0x3')](',')[_0xb1e6('0x4')](function(_0x315d1a){_0x6c42f5[_0xb1e6('0x5')](_0x5a691a[_0x315d1a]);});}return _0x6c42f5;}function updateWaitingCounter(_0x181d22){if(_0x181d22['waiting']){_0x181d22[_0xb1e6('0x6')]-=0x1;}}function updateInteractionCounters(_0x1602e7){_0x1602e7[_0xb1e6('0x6')]=0x0;_0x1602e7[_0xb1e6('0x7')]=0x0;_0x1602e7[_0xb1e6('0x8')]=0x0;_0x1602e7['unmanaged']=0x0;_0x1602e7['abandoned']=0x0;_0x1602e7[_0xb1e6('0x9')]=0x0;if(_0x1602e7[_0xb1e6('0xa')]){if(_0x1602e7[_0xb1e6('0xb')]==='abandoned'){_0x1602e7['abandoned']+=0x1;updateWaitingCounter(_0x1602e7);}if(_0x1602e7[_0xb1e6('0xc')]){_0x1602e7[_0xb1e6('0x8')]+=0x1;if(_0x1602e7['talking']){_0x1602e7[_0xb1e6('0x7')]-=0x1;}}else{if(_0x1602e7['disposition']){_0x1602e7['unmanaged']+=0x1;updateWaitingCounter(_0x1602e7);}}}else{if(!_0x1602e7['UserId']){_0x1602e7[_0xb1e6('0x6')]+=0x1;}if(_0x1602e7[_0xb1e6('0xc')]){_0x1602e7[_0xb1e6('0x7')]+=0x1;updateWaitingCounter(_0x1602e7);}}_0x1602e7[_0xb1e6('0x9')]+=0x1;return _0x1602e7;}function getLastMessageText(_0x3ee31f){return db[_0xb1e6('0xd')][_0xb1e6('0xe')]({'where':{'$and':[{'MailInteractionId':_0x3ee31f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb1e6('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xb1e6('0x10'),'raw':!![]})[_0xb1e6('0x11')](function(_0x5d4cfb){if(_0x5d4cfb&&_0x5d4cfb['plainBody']){_0x3ee31f[_0xb1e6('0x12')]=_[_0xb1e6('0x13')](_0x5d4cfb[_0xb1e6('0x14')]);}return _0x3ee31f;})['catch'](function(_0x2a7ec3){throw _0x2a7ec3;});}exports[_0xb1e6('0x15')]=function(_0x2e5262,_0x4fdd1a,_0x312e69,_0x2ec2e8){return new Promise(function(_0x494a0e,_0x499991){return getInteractionUsers(_0x2e5262['id'],_0x312e69)[_0xb1e6('0x11')](function(_0x4780a1){_0x2e5262['Users']=_0x4780a1;return getInteractionTags(_0x2e5262['TagIds'],_0x4fdd1a);})[_0xb1e6('0x11')](function(_0x4d580f){_0x2e5262[_0xb1e6('0x16')]=_0x4d580f;delete _0x2e5262[_0xb1e6('0x17')];return updateInteractionCounters(_0x2e5262);})[_0xb1e6('0x11')](function(_0x224f8d){if(_0x2ec2e8){return getLastMessageText(_0x224f8d);}else{return _0x224f8d;}})['then'](function(_0x3e7941){_0x494a0e(_0x3e7941);})[_0xb1e6('0x18')](function(_0x17fd53){_0x499991(_0x17fd53);});});}; \ No newline at end of file +var _0x69b3=['disposition','answered','UserId','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','updateInteraction','then','Users','Tags','TagIds','catch','../../mysqldb','split','forEach','push','waiting','talking','unmanaged','abandoned','total'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x69b3,0x16e));var _0x369b=function(_0xf7e7e,_0x2cbca7){_0xf7e7e=_0xf7e7e-0x0;var _0x322267=_0x69b3[_0xf7e7e];return _0x322267;};'use strict';var _=require('lodash');var db=require(_0x369b('0x0'))['db'];function getInteractionUsers(_0x129950,_0x1ac7a1){return new Promise(function(_0x4eab9d,_0x48e30f){try{var _0x3a2689=[];if(_0x1ac7a1[_0x129950]){_0x3a2689=_0x1ac7a1[_0x129950]['map'](function(_0x39d1cc){return{'id':_0x39d1cc['id'],'fullname':_0x39d1cc['fullname']};});}return _0x4eab9d(_0x3a2689);}catch(_0x44b206){_0x48e30f(_0x44b206);}});}function getInteractionTags(_0x2c0275,_0xf6cf9a){var _0xb1baba=[];if(_0x2c0275){_0x2c0275[_0x369b('0x1')](',')[_0x369b('0x2')](function(_0x4d9229){_0xb1baba[_0x369b('0x3')](_0xf6cf9a[_0x4d9229]);});}return _0xb1baba;}function updateWaitingCounter(_0xbbb80b){if(_0xbbb80b[_0x369b('0x4')]){_0xbbb80b[_0x369b('0x4')]-=0x1;}}function updateInteractionCounters(_0xc82009){_0xc82009[_0x369b('0x4')]=0x0;_0xc82009[_0x369b('0x5')]=0x0;_0xc82009['answered']=0x0;_0xc82009[_0x369b('0x6')]=0x0;_0xc82009[_0x369b('0x7')]=0x0;_0xc82009[_0x369b('0x8')]=0x0;if(_0xc82009['closed']){if(_0xc82009[_0x369b('0x9')]===_0x369b('0x7')){_0xc82009[_0x369b('0x7')]+=0x1;updateWaitingCounter(_0xc82009);}if(_0xc82009['UserId']){_0xc82009[_0x369b('0xa')]+=0x1;if(_0xc82009[_0x369b('0x5')]){_0xc82009[_0x369b('0x5')]-=0x1;}}else{if(_0xc82009[_0x369b('0x9')]){_0xc82009[_0x369b('0x6')]+=0x1;updateWaitingCounter(_0xc82009);}}}else{if(!_0xc82009[_0x369b('0xb')]){_0xc82009['waiting']+=0x1;}if(_0xc82009[_0x369b('0xb')]){_0xc82009[_0x369b('0x5')]+=0x1;updateWaitingCounter(_0xc82009);}}_0xc82009['total']+=0x1;return _0xc82009;}function getLastMessageText(_0x19a9c8){return db[_0x369b('0xc')][_0x369b('0xd')]({'where':{'$and':[{'MailInteractionId':_0x19a9c8['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x369b('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x369b('0xf'),'raw':!![]})['then'](function(_0x5731bb){if(_0x5731bb&&_0x5731bb[_0x369b('0x10')]){_0x19a9c8[_0x369b('0x11')]=_[_0x369b('0x12')](_0x5731bb[_0x369b('0x10')]);}return _0x19a9c8;})['catch'](function(_0x4bc75b){throw _0x4bc75b;});}exports[_0x369b('0x13')]=function(_0xb30456,_0x168ee0,_0x176d37,_0x3445b6){return new Promise(function(_0x280790,_0x2f3cad){return getInteractionUsers(_0xb30456['id'],_0x176d37)[_0x369b('0x14')](function(_0x30b0c8){_0xb30456[_0x369b('0x15')]=_0x30b0c8;return getInteractionTags(_0xb30456['TagIds'],_0x168ee0);})[_0x369b('0x14')](function(_0x4881a4){_0xb30456[_0x369b('0x16')]=_0x4881a4;delete _0xb30456[_0x369b('0x17')];return updateInteractionCounters(_0xb30456);})['then'](function(_0x45e1fc){if(_0x3445b6){return getLastMessageText(_0x45e1fc);}else{return _0x45e1fc;}})[_0x369b('0x14')](function(_0x46b334){_0x280790(_0x46b334);})[_0x369b('0x18')](function(_0x19f4c4){_0x2f3cad(_0x19f4c4);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index e291ca2..86c8026 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 _0x5bce=['_interactions','_interaction_has_tags','_messages','toLowerCase','toUpperCase','name','null','Interaction','findOne','then','update','info','catch','error','role','stringify','MESSAGE:ACCEPT]\x20id=','\x20interaction=','\x20body=','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','upperFirst','InteractionId','unknown','chat','websites','accounts'];(function(_0x1ece2d,_0x26fd2b){var _0x20199a=function(_0x462c9d){while(--_0x462c9d){_0x1ece2d['push'](_0x1ece2d['shift']());}};_0x20199a(++_0x26fd2b);}(_0x5bce,0x160));var _0xe5bc=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x5bce[_0x4b12ae];return _0x16957b;};'use strict';var _=require(_0xe5bc('0x0'));var db=require(_0xe5bc('0x1'))['db'];var loggers={'openchannel':require(_0xe5bc('0x2'))(_0xe5bc('0x3')),'mail':require(_0xe5bc('0x2'))(_0xe5bc('0x4')),'fax':require(_0xe5bc('0x2'))(_0xe5bc('0x5')),'sms':require(_0xe5bc('0x2'))(_0xe5bc('0x6')),'chat':require(_0xe5bc('0x2'))(_0xe5bc('0x7')),'whatsapp':require(_0xe5bc('0x2'))(_0xe5bc('0x8'))};function getAccountFK(_0x211bea){return _[_0xe5bc('0x9')](_0x211bea)+(_0x211bea==='chat'?_0xe5bc('0xa'):_0xe5bc('0xb'))+'Id';}function getInteractionFK(_0x19d13f){return _[_0xe5bc('0x9')](_0x19d13f)+'InteractionId';}function getInteractionId(_0x368ba3,_0x3e8e56,_0x4b2ac8){if(_0x368ba3&&_0x368ba3[_[_0xe5bc('0xc')](_0x4b2ac8)+_0xe5bc('0xd')]){return _0x368ba3[_[_0xe5bc('0xc')](_0x4b2ac8)+_0xe5bc('0xd')];}else if(_0x368ba3&&_0x368ba3['id']){return _0x368ba3['id'];}else if(_0x3e8e56&&_0x3e8e56['id']){return _0x3e8e56['id'];}else{return _0xe5bc('0xe');}}function getInteractionsTables(_0x4f25db){return{'accounts':_0x4f25db+'_'+(_0x4f25db===_0xe5bc('0xf')?_0xe5bc('0x10'):_0xe5bc('0x11')),'interactions':_0x4f25db+_0xe5bc('0x12'),'interactionsTags':_0x4f25db+_0xe5bc('0x13'),'messages':_0x4f25db+_0xe5bc('0x14'),'userInteractions':'user_has_'+_0x4f25db+_0xe5bc('0x12')};}function getSelectedTags(_0x5d0c35){var _0x57d566=[];if(_0x5d0c35){_0x57d566=Array['isArray'](_0x5d0c35)?_0x5d0c35:[_0x5d0c35];}return _0x57d566;}function log(_0x4efe5e,_0x19d608,_0xb8ca25,_0x56e0f5,_0x31efbd,_0x5159ae){loggers[_0x31efbd[_0xe5bc('0x15')]()][_0x4efe5e]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5159ae[_0xe5bc('0x16')](),_0x19d608?_0x19d608['id']:null,_0x19d608?_0x19d608[_0xe5bc('0x17')]:null,_0x19d608?_0x19d608['role']:null,getInteractionId(_0xb8ca25,_0x56e0f5,_0x31efbd),_0xb8ca25?JSON['stringify'](_0xb8ca25):_0xe5bc('0x18'));}function updateUser(_0xc051ad,_0x1e2b7d,_0x2c218d,_0x31a1dc,_0x940c30){db[_['upperFirst'](_0x31a1dc)+_0xe5bc('0x19')][_0xe5bc('0x1a')]({'where':{'id':getInteractionId(_0x1e2b7d,_0x2c218d,_0x31a1dc)}})[_0xe5bc('0x1b')](function(_0x42570c){if(_0x42570c){return _0x42570c[_0xe5bc('0x1c')]({'UserId':_0xc051ad?_0xc051ad['id']:null});}})['then'](function(_0x15057b){if(_0x15057b){log(_0xe5bc('0x1d'),_0xc051ad,_0x1e2b7d,_0x2c218d,_0x31a1dc,_0x940c30);}})[_0xe5bc('0x1e')](function(){log(_0xe5bc('0x1f'),_0xc051ad,_0x1e2b7d,_0x2c218d,_0x31a1dc,_0x940c30);});}function logAcceptMessage(_0x211761,_0x1b06d5,_0x3efdb5,_0x4e8db5){var _0x4d5a51=loggers[_0x211761[_0xe5bc('0x15')]()];var _0x4c51a9=_0x1b06d5['id'];var _0x22fc26=_0x1b06d5[_0xe5bc('0x17')];var _0x10b803=_0x1b06d5[_0xe5bc('0x20')];var _0x53adb5=JSON[_0xe5bc('0x21')](_0x4e8db5||null);_0x4d5a51['info']('['+_0x211761['toUpperCase']()+_0xe5bc('0x22')+_0x4c51a9+'\x20name='+_0x22fc26+'\x20role='+_0x10b803+_0xe5bc('0x23')+_0x3efdb5+_0xe5bc('0x24')+_0x53adb5);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0xdb78=['../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','chat','Website','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','update','then','info','error','name','role','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20interaction=','\x20body=','exports','lodash','../../mysqldb','openchannel-interactions'];(function(_0x4eee8d,_0x2cef66){var _0x29b4eb=function(_0xd15efe){while(--_0xd15efe){_0x4eee8d['push'](_0x4eee8d['shift']());}};_0x29b4eb(++_0x2cef66);}(_0xdb78,0x19f));var _0x8db7=function(_0x56fc45,_0x396951){_0x56fc45=_0x56fc45-0x0;var _0x359570=_0xdb78[_0x56fc45];return _0x359570;};'use strict';var _=require(_0x8db7('0x0'));var db=require(_0x8db7('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x8db7('0x2')),'mail':require(_0x8db7('0x3'))(_0x8db7('0x4')),'fax':require(_0x8db7('0x3'))(_0x8db7('0x5')),'sms':require('../../config/logger')(_0x8db7('0x6')),'chat':require(_0x8db7('0x3'))('chat-interactions'),'whatsapp':require(_0x8db7('0x3'))(_0x8db7('0x7'))};function getAccountFK(_0x268f05){return _['capitalize'](_0x268f05)+(_0x268f05===_0x8db7('0x8')?_0x8db7('0x9'):'Account')+'Id';}function getInteractionFK(_0xe0e02b){return _['capitalize'](_0xe0e02b)+_0x8db7('0xa');}function getInteractionId(_0x11c2e1,_0x357adb,_0x2373b7){if(_0x11c2e1&&_0x11c2e1[_[_0x8db7('0xb')](_0x2373b7)+_0x8db7('0xa')]){return _0x11c2e1[_[_0x8db7('0xb')](_0x2373b7)+_0x8db7('0xa')];}else if(_0x11c2e1&&_0x11c2e1['id']){return _0x11c2e1['id'];}else if(_0x357adb&&_0x357adb['id']){return _0x357adb['id'];}else{return _0x8db7('0xc');}}function getInteractionsTables(_0x4449b6){return{'accounts':_0x4449b6+'_'+(_0x4449b6===_0x8db7('0x8')?_0x8db7('0xd'):_0x8db7('0xe')),'interactions':_0x4449b6+_0x8db7('0xf'),'interactionsTags':_0x4449b6+_0x8db7('0x10'),'messages':_0x4449b6+_0x8db7('0x11'),'userInteractions':_0x8db7('0x12')+_0x4449b6+_0x8db7('0xf')};}function getSelectedTags(_0x3cc81c){var _0xc668f8=[];if(_0x3cc81c){_0xc668f8=Array[_0x8db7('0x13')](_0x3cc81c)?_0x3cc81c:[_0x3cc81c];}return _0xc668f8;}function log(_0x4ad13a,_0x4a7cba,_0x16cbb3,_0x337843,_0x3fb845,_0x334eea){loggers[_0x3fb845[_0x8db7('0x14')]()][_0x4ad13a](_0x8db7('0x15'),_0x334eea[_0x8db7('0x16')](),_0x4a7cba?_0x4a7cba['id']:null,_0x4a7cba?_0x4a7cba['name']:null,_0x4a7cba?_0x4a7cba['role']:null,getInteractionId(_0x16cbb3,_0x337843,_0x3fb845),_0x16cbb3?JSON[_0x8db7('0x17')](_0x16cbb3):_0x8db7('0x18'));}function updateUser(_0x1da50a,_0x50f0d1,_0x37eb8a,_0x43e47b,_0x42bb3d){db[_[_0x8db7('0xb')](_0x43e47b)+_0x8db7('0x19')]['findOne']({'where':{'id':getInteractionId(_0x50f0d1,_0x37eb8a,_0x43e47b)}})['then'](function(_0x1b445b){if(_0x1b445b){return _0x1b445b[_0x8db7('0x1a')]({'UserId':_0x1da50a?_0x1da50a['id']:null});}})[_0x8db7('0x1b')](function(_0xf1d9b0){if(_0xf1d9b0){log(_0x8db7('0x1c'),_0x1da50a,_0x50f0d1,_0x37eb8a,_0x43e47b,_0x42bb3d);}})['catch'](function(){log(_0x8db7('0x1d'),_0x1da50a,_0x50f0d1,_0x37eb8a,_0x43e47b,_0x42bb3d);});}function logAcceptMessage(_0x5c2f90,_0x2b6532,_0x22415d,_0x35aded){var _0x1e3d13=loggers[_0x5c2f90[_0x8db7('0x14')]()];var _0x17a426=_0x2b6532['id'];var _0x15c6b4=_0x2b6532[_0x8db7('0x1e')];var _0x19efac=_0x2b6532[_0x8db7('0x1f')];var _0x397ec0=JSON[_0x8db7('0x17')](_0x35aded||null);_0x1e3d13[_0x8db7('0x1c')]('['+_0x5c2f90['toUpperCase']()+_0x8db7('0x20')+_0x17a426+_0x8db7('0x21')+_0x15c6b4+_0x8db7('0x22')+_0x19efac+_0x8db7('0x23')+_0x22415d+_0x8db7('0x24')+_0x397ec0);}module[_0x8db7('0x25')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index d1681e5..2cd6ddc 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 _0x5d7d=['data1','license','createDecipher','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','License','findOne','then','catch','users','User','admin','isUserLimit','util','composable-middleware'];(function(_0x2410db,_0x2f7f33){var _0x1b1f22=function(_0xf04143){while(--_0xf04143){_0x2410db['push'](_0x2410db['shift']());}};_0x1b1f22(++_0x2f7f33);}(_0x5d7d,0x1cc));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var util=require(_0xd5d7('0x0'));var compose=require(_0xd5d7('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x7a1321,_0x228b32){if(_0x7a1321&&_0x228b32){if(_0x228b32[_0xd5d7('0x2')]&&_0x228b32[_0xd5d7('0x3')]){var _0x196831=_0x228b32['data1'];var _0x2d6071=_0x228b32[_0xd5d7('0x3')];var _0x3f8f52=_0x196831['split']('-')[0x4];var _0x4f2afe=_0x196831['split']('-')[0x0];var _0x4763ff=crypto[_0xd5d7('0x4')]('aes-256-ctr',util['format'](_0xd5d7('0x5'),_0x3f8f52,_0x196831,_0x4f2afe));var _0x50360e=_0x4763ff[_0xd5d7('0x6')](_0x2d6071,_0xd5d7('0x7'),'utf8');_0x50360e+=_0x4763ff[_0xd5d7('0x8')](_0xd5d7('0x9'));var _0x12e43e=JSON[_0xd5d7('0xa')](_0x50360e);return _0x12e43e[_0xd5d7('0xb')](_0x7a1321)?_0x12e43e[_0x7a1321]:null;}}return null;}function isLimit(_0x40858e,_0x3d38e2,_0x1267c1,_0x366f45){var _0x3773e4=_0x3d38e2;return compose()[_0xd5d7('0xc')](function(_0x40faf6,_0x30e48b,_0x316a33){return db[_0xd5d7('0xd')][_0xd5d7('0xe')]({'where':{'id':0x1},'raw':!![]})[_0xd5d7('0xf')](function(_0x2134e3){var _0x547e63=getValueFromLicense(_0x40858e,_0x2134e3);return _0x547e63?_0x547e63:_0x3773e4;})[_0xd5d7('0xf')](function(_0x164ff9){_0x3773e4=_0x164ff9;return _0x1267c1['count'](_0x366f45);})[_0xd5d7('0xf')](function(_0x163470){if(_0x163470>=_0x3773e4){return _0x30e48b['status'](0x193)['json']({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x40858e)});}_0x316a33();})[_0xd5d7('0x10')](function(_0xfb7848){_0x316a33(_0xfb7848);});});}function isUserLimit(){return isLimit(_0xd5d7('0x11'),0x1,db[_0xd5d7('0x12')],{'where':{'$or':[{'role':_0xd5d7('0x13')},{'role':'user'}]}});}exports[_0xd5d7('0x14')]=isUserLimit; \ No newline at end of file +var _0x4b41=['parse','hasOwnProperty','use','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','crypto','util','../../config/environment','data1','license','split','format','%s:%s:%s','update','base64','utf8'];(function(_0x5ef328,_0x3bc088){var _0x443f60=function(_0x347a25){while(--_0x347a25){_0x5ef328['push'](_0x5ef328['shift']());}};_0x443f60(++_0x3bc088);}(_0x4b41,0x165));var _0x14b4=function(_0x317a11,_0x576232){_0x317a11=_0x317a11-0x0;var _0x34749f=_0x4b41[_0x317a11];return _0x34749f;};'use strict';var crypto=require(_0x14b4('0x0'));var util=require(_0x14b4('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x14b4('0x2'));function getValueFromLicense(_0x1d40c3,_0xb31b09){if(_0x1d40c3&&_0xb31b09){if(_0xb31b09[_0x14b4('0x3')]&&_0xb31b09[_0x14b4('0x4')]){var _0x2ff32d=_0xb31b09[_0x14b4('0x3')];var _0x2dc56d=_0xb31b09[_0x14b4('0x4')];var _0x19f79d=_0x2ff32d['split']('-')[0x4];var _0x16ac84=_0x2ff32d[_0x14b4('0x5')]('-')[0x0];var _0x7df2a7=crypto['createDecipher']('aes-256-ctr',util[_0x14b4('0x6')](_0x14b4('0x7'),_0x19f79d,_0x2ff32d,_0x16ac84));var _0x503a21=_0x7df2a7[_0x14b4('0x8')](_0x2dc56d,_0x14b4('0x9'),_0x14b4('0xa'));_0x503a21+=_0x7df2a7['final'](_0x14b4('0xa'));var _0x3d18ea=JSON[_0x14b4('0xb')](_0x503a21);return _0x3d18ea[_0x14b4('0xc')](_0x1d40c3)?_0x3d18ea[_0x1d40c3]:null;}}return null;}function isLimit(_0x97965a,_0x34c702,_0x8440bb,_0x284fe6){var _0x5544a2=_0x34c702;return compose()[_0x14b4('0xd')](function(_0x16f854,_0x4a64bb,_0x1561cb){return db['License'][_0x14b4('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x14b4('0xf')](function(_0x7ed1c9){var _0x9a0975=getValueFromLicense(_0x97965a,_0x7ed1c9);return _0x9a0975?_0x9a0975:_0x5544a2;})[_0x14b4('0xf')](function(_0xc43514){_0x5544a2=_0xc43514;return _0x8440bb[_0x14b4('0x10')](_0x284fe6);})[_0x14b4('0xf')](function(_0x2b2584){if(_0x2b2584>=_0x5544a2){return _0x4a64bb['status'](0x193)[_0x14b4('0x11')]({'message':util[_0x14b4('0x6')](_0x14b4('0x12'),_0x97965a)});}_0x1561cb();})[_0x14b4('0x13')](function(_0x10f073){_0x1561cb(_0x10f073);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x14b4('0x14')],{'where':{'$or':[{'role':_0x14b4('0x15')},{'role':_0x14b4('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9436dce..845ab64 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 _0x2fb2=['push','buildExpression','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','text','CAST(','\x20AS\x20','castTo','$ne','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','pop','DATE','utcOffset','minutes','seconds','lodash','moment','parseSearch','startsWith','replace','[$and]','split','forEach','shift','match','filter','indexOf','map'];(function(_0xcdb8b5,_0x1be02c){var _0x355d78=function(_0xcff49a){while(--_0xcff49a){_0xcdb8b5['push'](_0xcdb8b5['shift']());}};_0x355d78(++_0x1be02c);}(_0x2fb2,0xcf));var _0x22fb=function(_0x732a07,_0x10a02c){_0x732a07=_0x732a07-0x0;var _0x1d412e=_0x2fb2[_0x732a07];return _0x1d412e;};'use strict';var _=require(_0x22fb('0x0'));var moment=require(_0x22fb('0x1'));exports[_0x22fb('0x2')]=function(_0x3f81f8){var _0x2024fe={'conditions':[]};_0x2024fe['sqlOperator']=_[_0x22fb('0x3')](_0x3f81f8,'[$or]')?'or':'and';var _0x36af99=_0x3f81f8[_0x22fb('0x4')](_0x22fb('0x5'),'')[_0x22fb('0x4')]('[$or]','')['split']('||');for(var _0x40d22f=0x0;_0x40d22f<_0x36af99['length'];_0x40d22f++){var _0xf8b0d0=_0x36af99[_0x40d22f][_0x22fb('0x6')](':=');var _0x368dd8=_0xf8b0d0[0x0];var _0x158733=_0xf8b0d0['slice'](0x1);_0x158733[_0x22fb('0x7')](function(_0x1463e6){var _0x4ff393=_0x1463e6['split']('[')[_0x22fb('0x8')]();var _0x5f0877=_0x1463e6[_0x22fb('0x9')](/\[(.*?)\]/g);_0x5f0877[_0x22fb('0x7')](function(_0x306959){var _0x578221=_0x306959[_0x22fb('0x6')]('[')[_0x22fb('0xa')](function(_0x4058bf){return _0x4058bf[_0x22fb('0xb')](']')>-0x1;})[_0x22fb('0xc')](function(_0x5b545a){return _0x5b545a[_0x22fb('0x6')](']')[0x0];})[0x0];_0x2024fe['conditions'][_0x22fb('0xd')]({'field':_0x368dd8,'operator':_0x4ff393,'value':_0x578221});});});}return _0x2024fe;};exports[_0x22fb('0xe')]=function(_0x59c3d5,_0x176a07,_0x49bf4b){var _0x1fa027={};if(_0x176a07==='DATE'){if(_0x49bf4b[_0x22fb('0xf')]===_0x22fb('0x10')){_0x49bf4b[_0x22fb('0xf')]=_0x22fb('0x11');_0x49bf4b[_0x22fb('0x12')]+=','+_0x49bf4b[_0x22fb('0x12')];}else if(_[_0x22fb('0x13')](['$gt',_0x22fb('0x14')],_0x49bf4b[_0x22fb('0xf')])){_0x49bf4b['value']=moment(_0x49bf4b[_0x22fb('0x12')])[_0x22fb('0x15')](0x1,_0x22fb('0x16'))[_0x22fb('0x17')](_0x22fb('0x18'));}}if(_0x49bf4b['castTo']){_0x176a07=_0x49bf4b['castTo'];_0x1fa027[_0x22fb('0x19')]=_0x22fb('0x1a')+_0x59c3d5+'.'+_0x49bf4b['field']+_0x22fb('0x1b')+_0x49bf4b[_0x22fb('0x1c')]+')\x20'+parseOperator(_0x49bf4b[_0x22fb('0xf')]);}else{_0x1fa027['text']=_0x59c3d5+'.'+_0x49bf4b['field']+'\x20'+parseOperator(_0x49bf4b[_0x22fb('0xf')]);}if(_[_0x22fb('0x13')]([_0x22fb('0x1d'),_0x22fb('0x1e')],_0x49bf4b['operator']))_0x1fa027[_0x22fb('0x19')]='('+_0x1fa027['text']+_0x22fb('0x1f')+_0x59c3d5+'.'+_0x49bf4b[_0x22fb('0x20')]+_0x22fb('0x21');_0x1fa027[_0x22fb('0x12')]=parseValue(_0x176a07,_0x49bf4b[_0x22fb('0xf')],_0x49bf4b[_0x22fb('0x12')]);return _0x1fa027;};function parseOperator(_0x27e201){var _0x2691f0;switch(_0x27e201){case'$in':_0x2691f0='IN\x20?';break;case _0x22fb('0x1e'):_0x2691f0=_0x22fb('0x22');break;case'$eq':_0x2691f0=_0x22fb('0x23');break;case _0x22fb('0x1d'):_0x2691f0=_0x22fb('0x24');break;case _0x22fb('0x25'):case _0x22fb('0x26'):case _0x22fb('0x27'):_0x2691f0=_0x22fb('0x28');break;case _0x22fb('0x29'):_0x2691f0=_0x22fb('0x2a');break;case _0x22fb('0x2b'):_0x2691f0=_0x22fb('0x2c');break;case _0x22fb('0x14'):_0x2691f0='<=\x20?';break;case _0x22fb('0x2d'):_0x2691f0=_0x22fb('0x2e');break;case _0x22fb('0x11'):_0x2691f0=_0x22fb('0x2f');break;}return _0x2691f0;}function parseValue(_0xb6d037,_0x4f718f,_0xad6d95){var _0x14b98b={'start':undefined,'end':undefined};switch(_0x4f718f){case _0x22fb('0x30'):case _0x22fb('0x1e'):_0x14b98b['start']=_0xad6d95[_0x22fb('0x6')](',');break;case'$substring':_0x14b98b['start']='%'+_0xad6d95+'%';break;case'$startsWith':_0x14b98b[_0x22fb('0x31')]=_0xad6d95+'%';break;case _0x22fb('0x27'):_0x14b98b['start']='%'+_0xad6d95;break;case _0x22fb('0x11'):var _0xb72e4b=_0xad6d95[_0x22fb('0x6')](',');var _0xad6d95=_0xb72e4b[_0x22fb('0x8')]();var _0x55b7ef=_0xb72e4b[_0x22fb('0x32')]();if(_0xb6d037===_0x22fb('0x33')){_0xad6d95=moment(_0xad6d95)['utcOffset'](0x0,!![])[_0x22fb('0x17')]();_0x55b7ef=moment(_0x55b7ef)[_0x22fb('0x34')](0x0,!![])[_0x22fb('0x15')](0x17,'hours')['add'](0x3b,_0x22fb('0x35'))[_0x22fb('0x15')](0x3b,_0x22fb('0x36'))[_0x22fb('0x17')]();}_0x14b98b={'start':_0xad6d95,'end':_0x55b7ef};break;default:_0x14b98b[_0x22fb('0x31')]=_0xad6d95;break;}return _0x14b98b;} \ No newline at end of file +var _0x244e=['NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','<\x20?','$lte','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','seconds','sqlOperator','startsWith','[$and]','replace','[$or]','length','slice','forEach','split','shift','match','filter','map','conditions','push','buildExpression','DATE','$eq','operator','$between','value','$gt','add','days','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?'];(function(_0x4d0ee8,_0x28acb8){var _0x3e41b2=function(_0x169561){while(--_0x169561){_0x4d0ee8['push'](_0x4d0ee8['shift']());}};_0x3e41b2(++_0x28acb8);}(_0x244e,0xe8));var _0xe244=function(_0x524bb0,_0x326327){_0x524bb0=_0x524bb0-0x0;var _0x2fb947=_0x244e[_0x524bb0];return _0x2fb947;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x34b5f3){var _0x183f72={'conditions':[]};_0x183f72[_0xe244('0x0')]=_[_0xe244('0x1')](_0x34b5f3,'[$or]')?'or':'and';var _0x25f789=_0x34b5f3['replace'](_0xe244('0x2'),'')[_0xe244('0x3')](_0xe244('0x4'),'')['split']('||');for(var _0x213d79=0x0;_0x213d79<_0x25f789[_0xe244('0x5')];_0x213d79++){var _0x3aba82=_0x25f789[_0x213d79]['split'](':=');var _0x1d1660=_0x3aba82[0x0];var _0x4d196f=_0x3aba82[_0xe244('0x6')](0x1);_0x4d196f[_0xe244('0x7')](function(_0x248654){var _0x451dd1=_0x248654[_0xe244('0x8')]('[')[_0xe244('0x9')]();var _0x3485fb=_0x248654[_0xe244('0xa')](/\[(.*?)\]/g);_0x3485fb[_0xe244('0x7')](function(_0x21d07f){var _0x3b480a=_0x21d07f['split']('[')[_0xe244('0xb')](function(_0x4471c9){return _0x4471c9['indexOf'](']')>-0x1;})[_0xe244('0xc')](function(_0x1b2fa6){return _0x1b2fa6[_0xe244('0x8')](']')[0x0];})[0x0];_0x183f72[_0xe244('0xd')][_0xe244('0xe')]({'field':_0x1d1660,'operator':_0x451dd1,'value':_0x3b480a});});});}return _0x183f72;};exports[_0xe244('0xf')]=function(_0x79ea0,_0x492dd9,_0x1d477c){var _0x5d07dc={};if(_0x492dd9===_0xe244('0x10')){if(_0x1d477c['operator']===_0xe244('0x11')){_0x1d477c[_0xe244('0x12')]=_0xe244('0x13');_0x1d477c[_0xe244('0x14')]+=','+_0x1d477c['value'];}else if(_['includes']([_0xe244('0x15'),'$lte'],_0x1d477c[_0xe244('0x12')])){_0x1d477c['value']=moment(_0x1d477c[_0xe244('0x14')])[_0xe244('0x16')](0x1,_0xe244('0x17'))[_0xe244('0x18')](_0xe244('0x19'));}}if(_0x1d477c[_0xe244('0x1a')]){_0x492dd9=_0x1d477c[_0xe244('0x1a')];_0x5d07dc['text']=_0xe244('0x1b')+_0x79ea0+'.'+_0x1d477c[_0xe244('0x1c')]+_0xe244('0x1d')+_0x1d477c[_0xe244('0x1a')]+')\x20'+parseOperator(_0x1d477c[_0xe244('0x12')]);}else{_0x5d07dc[_0xe244('0x1e')]=_0x79ea0+'.'+_0x1d477c[_0xe244('0x1c')]+'\x20'+parseOperator(_0x1d477c[_0xe244('0x12')]);}if(_[_0xe244('0x1f')]([_0xe244('0x20'),_0xe244('0x21')],_0x1d477c[_0xe244('0x12')]))_0x5d07dc[_0xe244('0x1e')]='('+_0x5d07dc[_0xe244('0x1e')]+_0xe244('0x22')+_0x79ea0+'.'+_0x1d477c[_0xe244('0x1c')]+_0xe244('0x23');_0x5d07dc[_0xe244('0x14')]=parseValue(_0x492dd9,_0x1d477c[_0xe244('0x12')],_0x1d477c[_0xe244('0x14')]);return _0x5d07dc;};function parseOperator(_0x336a39){var _0x3d1f94;switch(_0x336a39){case _0xe244('0x24'):_0x3d1f94=_0xe244('0x25');break;case _0xe244('0x21'):_0x3d1f94=_0xe244('0x26');break;case _0xe244('0x11'):_0x3d1f94=_0xe244('0x27');break;case _0xe244('0x20'):_0x3d1f94=_0xe244('0x28');break;case'$substring':case _0xe244('0x29'):case _0xe244('0x2a'):_0x3d1f94=_0xe244('0x2b');break;case'$lt':_0x3d1f94=_0xe244('0x2c');break;case _0xe244('0x15'):_0x3d1f94='>\x20?';break;case _0xe244('0x2d'):_0x3d1f94=_0xe244('0x2e');break;case'$gte':_0x3d1f94=_0xe244('0x2f');break;case _0xe244('0x13'):_0x3d1f94=_0xe244('0x30');break;}return _0x3d1f94;}function parseValue(_0x27e608,_0x448bfe,_0x4c4dac){var _0x90664a={'start':undefined,'end':undefined};switch(_0x448bfe){case _0xe244('0x24'):case'$notIn':_0x90664a[_0xe244('0x31')]=_0x4c4dac[_0xe244('0x8')](',');break;case'$substring':_0x90664a[_0xe244('0x31')]='%'+_0x4c4dac+'%';break;case _0xe244('0x29'):_0x90664a[_0xe244('0x31')]=_0x4c4dac+'%';break;case _0xe244('0x2a'):_0x90664a[_0xe244('0x31')]='%'+_0x4c4dac;break;case _0xe244('0x13'):var _0x5047b0=_0x4c4dac[_0xe244('0x8')](',');var _0x4c4dac=_0x5047b0[_0xe244('0x9')]();var _0x32dcbf=_0x5047b0[_0xe244('0x32')]();if(_0x27e608==='DATE'){_0x4c4dac=moment(_0x4c4dac)[_0xe244('0x33')](0x0,!![])[_0xe244('0x18')]();_0x32dcbf=moment(_0x32dcbf)[_0xe244('0x33')](0x0,!![])[_0xe244('0x16')](0x17,_0xe244('0x34'))[_0xe244('0x16')](0x3b,'minutes')[_0xe244('0x16')](0x3b,_0xe244('0x35'))[_0xe244('0x18')]();}_0x90664a={'start':_0x4c4dac,'end':_0x32dcbf};break;default:_0x90664a['start']=_0x4c4dac;break;}return _0x90664a;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6f36534..1537195 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 _0xd093=['sequelize','moment','parse','keys','includes','model','fields','raw','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','offset','sort','map','indexOf','cast','col','priority','substr','unsigned','ASC','omit','length','isObject','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','replace','trim','forEach','{EXPR}','join','getOptions','query','$id','intersection','attributes','nolimit','limit','order','where','pick','filter','value','VIRTUAL','lower','include','includeAll','escapeLIKESpecialChars','lodash'];(function(_0x532749,_0x2fdabf){var _0x37c09e=function(_0x228041){while(--_0x228041){_0x532749['push'](_0x532749['shift']());}};_0x37c09e(++_0x2fdabf);}(_0xd093,0x185));var _0x3d09=function(_0x5a8cd4,_0x58b4b7){_0x5a8cd4=_0x5a8cd4-0x0;var _0x1967e6=_0xd093[_0x5a8cd4];return _0x1967e6;};'use strict';var _=require(_0x3d09('0x0'));var sequelize=require(_0x3d09('0x1'));var moment=require(_0x3d09('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xf7bc64){var _0x247a2b=['ne'];try{var _0x5df45e=JSON[_0x3d09('0x3')](_0xf7bc64);var _0x3a54e7=Object[_0x3d09('0x4')](_0x5df45e)[0x0];return _0x247a2b[_0x3d09('0x5')](_0x3a54e7);}catch(_0x185784){return![];}}function getOperatorValue(_0x5af835){var _0x5cf216=JSON[_0x3d09('0x3')](_0x5af835);var _0x45ecc6=Object['keys'](_0x5cf216)[0x0];var _0x6c76ed=_0x5cf216[_0x45ecc6];return{['$'+_0x45ecc6]:_0x6c76ed};}function parseIncludeModel(_0x489d2d){var _0xadaf0b=JSON[_0x3d09('0x3')](_0x489d2d);return{'model':db[_0xadaf0b[_0x3d09('0x6')]],'as':_0xadaf0b['alias'],'attributes':_0xadaf0b[_0x3d09('0x7')],'raw':_0xadaf0b[_0x3d09('0x8')]};}exports[_0x3d09('0x7')]=function(_0x2b2831){var _0x11e006=null;if(_0x2b2831){_0x11e006=_0x2b2831[_0x3d09('0x9')](',');}return _0x11e006;};exports[_0x3d09('0xa')]=function(_0x4d977b,_0x40cf01){var _0x21439a={};if(!_[_0x3d09('0xb')](_0x4d977b)){_[_0x3d09('0xc')](_0x4d977b,function(_0x2df4f9,_0x839da2){try{if(_0x40cf01){var _0x8fc6a5=_[_0x3d09('0xd')](_0x40cf01,{'name':_0x839da2})||{};if(hasSequelizeOperator(_0x2df4f9)){_0x21439a[_0x839da2]=getOperatorValue(_0x2df4f9);}else if(_0x8fc6a5[_0x3d09('0xe')]==='DATE'&&_[_0x3d09('0xf')](_0x2df4f9)){var _0x48f0c1=JSON['parse'](_0x2df4f9);var _0x445659={'$gte':moment(moment(_0x48f0c1[_0x3d09('0x10')])[_0x3d09('0x11')](_0x3d09('0x12')))[_0x3d09('0x13')]()[_0x3d09('0x11')](),'$lte':moment(moment(_0x48f0c1[_0x3d09('0x14')])[_0x3d09('0x11')]('YYYY-MM-DD'))[_0x3d09('0x13')]()[_0x3d09('0x15')](0x1,'s')[_0x3d09('0x11')]()};_0x21439a[_0x839da2]=_0x445659;}else if(_0x8fc6a5[_0x3d09('0x16')]==='uniqueid'){_0x21439a[_0x839da2]=_0x2df4f9;}else{_0x21439a[_0x839da2]=_[_0x3d09('0x17')](_0x2df4f9)?_0x2df4f9:JSON[_0x3d09('0x3')](_0x2df4f9);}}else{_0x21439a[_0x839da2]=_['isArray'](_0x2df4f9)?_0x2df4f9:JSON[_0x3d09('0x3')](_0x2df4f9);}}catch(_0x4ead8c){_0x21439a[_0x839da2]=_0x2df4f9[_0x3d09('0x9')](',');}});}return _0x21439a;};exports['limit']=function(_0x519d35){_0x519d35=parseInt(_0x519d35,0xa);if(!_0x519d35||_0x519d35<0x0){_0x519d35=LIMIT_VALUE;}return _0x519d35;};exports[_0x3d09('0x18')]=function(_0x3fbd56){_0x3fbd56=parseInt(_0x3fbd56,0xa);if(!_0x3fbd56||_0x3fbd56<0x0){_0x3fbd56=0x0;}return _0x3fbd56;};exports[_0x3d09('0x19')]=function(_0x24d5b8){var _0x3f0b55,_0x579ffc=null;if(_0x24d5b8){_0x3f0b55=_0x24d5b8['split'](',');_0x579ffc=_[_0x3d09('0x1a')](_0x3f0b55,function(_0x44cb98){if(_0x44cb98[_0x3d09('0x1b')]('-')===0x0){return[_0x44cb98==='priority'?sequelize[_0x3d09('0x1c')](sequelize[_0x3d09('0x1d')](_0x3d09('0x1e')),'unsigned'):_0x44cb98[_0x3d09('0x1f')](0x1),'DESC'];}else{return[_0x44cb98===_0x3d09('0x1e')?sequelize[_0x3d09('0x1c')](sequelize[_0x3d09('0x1d')](_0x3d09('0x1e')),_0x3d09('0x20')):_0x44cb98,_0x3d09('0x21')];}});}return _0x579ffc;};exports[_0x3d09('0x22')]=function(_0x38a713,_0x3ec9b1){if(_[_0x3d09('0xb')](_0x38a713)){return _0x38a713;}if(_['isArray'](_0x38a713)){for(var _0x5824dc=0x0;_0x5824dc<_0x38a713[_0x3d09('0x23')];_0x5824dc+=0x1){_0x38a713[_0x5824dc]=this[_0x3d09('0x22')](_0x38a713[_0x5824dc],_0x3ec9b1);}return _0x38a713;}if(!_[_0x3d09('0x24')](_0x38a713)){return _0x38a713;}if(_['isString'](_0x3ec9b1)){_0x3ec9b1=[_0x3ec9b1];}if(!_[_0x3d09('0x17')](_0x3ec9b1)){return _0x38a713;}for(var _0x1382ab=0x0;_0x1382ab<_0x3ec9b1[_0x3d09('0x23')];_0x1382ab+=0x1){_[_0x3d09('0x25')](_0x38a713,_0x3ec9b1[_0x1382ab]);}for(var _0x272eff in _0x38a713){if(_0x38a713[_0x3d09('0x26')](_0x272eff)){_0x38a713[_0x272eff]=this[_0x3d09('0x22')](_0x38a713[_0x272eff],_0x3ec9b1);}}return _0x38a713;};exports['isNumeric']=function(_0x50204a){return _0x50204a[_0x3d09('0x27')](RegExp(_0x3d09('0x28')))?!![]:![];};exports[_0x3d09('0x29')]=function(_0x3f0a9d){return _0x3f0a9d[_0x3d09('0x27')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x25f4dd,_0x52137d){var _0x201933=[];var _0x2eda6a=/([^:]")"+/g;var _0x105259=/[*<>~@-]/g;var _0x5ce2f4=/[ `!@#$%^&*()_\-?~<>]/;var _0x569d0e=/[ ,]+/;var _0x11e34e=_0x52137d?_0x3d09('0x2a'):'{EXPR}';if(_0x52137d){_0x25f4dd=_0x25f4dd[_0x3d09('0x2b')](_0x105259,'\x20')[_0x3d09('0x2c')]();}_0x25f4dd[_0x3d09('0x9')](_0x569d0e)[_0x3d09('0x2d')](function(_0x786247){_0x786247=_0x786247['replace'](_0x2eda6a,'$1');_0x786247='+'+_0x786247+'*';var _0x47f1a9=_0x786247[_0x3d09('0x27')](_0x5ce2f4);if(_0x47f1a9){_0x786247='\x22'+_0x786247+'\x22';}_0x201933['push'](_0x786247);});_0x11e34e=_0x11e34e[_0x3d09('0x2b')](_0x3d09('0x2e'),_0x201933[_0x3d09('0x2f')]('\x20'));return _0x11e34e;};exports[_0x3d09('0x30')]=function(_0x3349ea,_0x809b90,_0xc1918d){var _0x4eee92={},_0x24f89f={};if(_0x809b90[_0x3d09('0x31')][_0x3d09('0x32')]){_0x809b90[_0x3d09('0x31')]['id']=_0x809b90[_0x3d09('0x31')][_0x3d09('0x32')];delete _0x809b90[_0x3d09('0x31')]['$id'];}_0x4eee92[_0x3d09('0x6')]=_['map'](_0x3349ea,_0x3d09('0x16'));_0x4eee92[_0x3d09('0x31')]=_[_0x3d09('0x4')](_0x809b90[_0x3d09('0x31')]);_0x4eee92[_0x3d09('0xa')]=_[_0x3d09('0x33')](_0x4eee92[_0x3d09('0x6')],_0x4eee92[_0x3d09('0x31')]);_0x24f89f[_0x3d09('0x34')]=_[_0x3d09('0x33')](_0x4eee92['model'],this[_0x3d09('0x7')](_0x809b90[_0x3d09('0x31')][_0x3d09('0x7')]));_0x24f89f[_0x3d09('0x34')]=_0x24f89f[_0x3d09('0x34')][_0x3d09('0x23')]?_0x24f89f[_0x3d09('0x34')]:_0x4eee92['model'];if(!_0x809b90[_0x3d09('0x31')][_0x3d09('0x26')](_0x3d09('0x35'))){_0x24f89f['limit']=this[_0x3d09('0x36')](_0x809b90[_0x3d09('0x31')][_0x3d09('0x36')]);_0x24f89f[_0x3d09('0x18')]=this[_0x3d09('0x18')](_0x809b90['query']['offset']);}_0x24f89f[_0x3d09('0x37')]=this['sort'](_0x809b90[_0x3d09('0x31')][_0x3d09('0x19')]);_0x24f89f[_0x3d09('0x38')]=this['filters'](_[_0x3d09('0x39')](_0x809b90[_0x3d09('0x31')],_0x4eee92[_0x3d09('0xa')]),_0x3349ea);if(_0x809b90['query'][_0x3d09('0x3a')]){var _0x66f922=_0x3349ea;var _0x2b0d6b=_0x809b90['query'][_0x3d09('0x3a')];if(typeof _0x2b0d6b==='object'){_0x66f922=_['filter'](_0x3349ea,function(_0x22f037){return _[_0x3d09('0x5')](_0x2b0d6b['columns'],_0x22f037[_0x3d09('0x16')]);});_0x2b0d6b=_0x2b0d6b[_0x3d09('0x3b')];}_0x24f89f[_0x3d09('0x38')]=_['merge'](_0x24f89f[_0x3d09('0x38')],{'$or':_[_0x3d09('0x1a')](_0x66f922,function(_0x2954c6){if(_0x2954c6[_0x3d09('0xe')]!==_0x3d09('0x3c')){if(_0xc1918d){return sequelize[_0x3d09('0x38')](sequelize['fn'](_0x3d09('0x3d'),sequelize[_0x3d09('0x1d')](_0x2954c6[_0x3d09('0x16')])),{'$like':sequelize['fn'](_0x3d09('0x3d'),'%'+_0x809b90['query'][_0x3d09('0x3a')]+'%')});}else{var _0x319b3c={};_0x319b3c[_0x2954c6['name']]={'$like':'%'+_0x809b90[_0x3d09('0x31')][_0x3d09('0x3a')]+'%'};return _0x319b3c;}}})});}_0x24f89f=_['merge']({},_0x24f89f,_0x809b90['options']);return _0x24f89f;};exports[_0x3d09('0x3e')]=function(_0x5f1827){var _0x1bc3c5=[];if(_0x5f1827[_0x3d09('0x3f')]){_0x1bc3c5['push']({'all':!![]});}else if(_0x5f1827[_0x3d09('0x3e')]){if(Array[_0x3d09('0x17')](_0x5f1827[_0x3d09('0x3e')])){_0x1bc3c5=Object[_0x3d09('0x4')](_0x5f1827[_0x3d09('0x3e')])[_0x3d09('0x1a')](function(_0x4fca8a){return parseIncludeModel(_0x5f1827[_0x3d09('0x3e')][_0x4fca8a]);});}else{var _0x2900c3=parseIncludeModel(_0x5f1827['include']);_0x1bc3c5['push'](_0x2900c3);}}return _0x1bc3c5;};exports[_0x3d09('0x40')]=function(_0x732a35){return _0x732a35['replace'](/[%_^-]/g,function(_0x532427){return'\x5c'+_0x532427;});}; \ No newline at end of file +var _0x3b98=['intersection','attributes','nolimit','limit','order','where','filter','columns','value','VIRTUAL','lower','merge','options','include','escapeLIKESpecialChars','sequelize','parse','keys','includes','model','fields','split','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','sort','map','cast','col','priority','substr','DESC','unsigned','ASC','omit','isEmpty','isObject','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','trim','push','query','$id','filters'];(function(_0x585e84,_0x1d8489){var _0x39f3c4=function(_0x1855a3){while(--_0x1855a3){_0x585e84['push'](_0x585e84['shift']());}};_0x39f3c4(++_0x1d8489);}(_0x3b98,0x17d));var _0x83b9=function(_0x25dde4,_0x4d2c2d){_0x25dde4=_0x25dde4-0x0;var _0x55906b=_0x3b98[_0x25dde4];return _0x55906b;};'use strict';var _=require('lodash');var sequelize=require(_0x83b9('0x0'));var moment=require('moment');var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x137c76){var _0x389b55=['ne'];try{var _0x38fe4d=JSON[_0x83b9('0x1')](_0x137c76);var _0xc05c20=Object[_0x83b9('0x2')](_0x38fe4d)[0x0];return _0x389b55[_0x83b9('0x3')](_0xc05c20);}catch(_0x619b80){return![];}}function getOperatorValue(_0x1ee607){var _0x376c10=JSON['parse'](_0x1ee607);var _0x5e7fff=Object[_0x83b9('0x2')](_0x376c10)[0x0];var _0x5a63b=_0x376c10[_0x5e7fff];return{['$'+_0x5e7fff]:_0x5a63b};}function parseIncludeModel(_0x2afe13){var _0x80a3c9=JSON[_0x83b9('0x1')](_0x2afe13);return{'model':db[_0x80a3c9[_0x83b9('0x4')]],'as':_0x80a3c9['alias'],'attributes':_0x80a3c9[_0x83b9('0x5')],'raw':_0x80a3c9['raw']};}exports[_0x83b9('0x5')]=function(_0x28748b){var _0x51bdcb=null;if(_0x28748b){_0x51bdcb=_0x28748b[_0x83b9('0x6')](',');}return _0x51bdcb;};exports['filters']=function(_0x5cbfc9,_0x1232da){var _0x8cabf1={};if(!_['isEmpty'](_0x5cbfc9)){_['forOwn'](_0x5cbfc9,function(_0x7f7976,_0x397f2d){try{if(_0x1232da){var _0x56c8f4=_['find'](_0x1232da,{'name':_0x397f2d})||{};if(hasSequelizeOperator(_0x7f7976)){_0x8cabf1[_0x397f2d]=getOperatorValue(_0x7f7976);}else if(_0x56c8f4[_0x83b9('0x7')]===_0x83b9('0x8')&&_[_0x83b9('0x9')](_0x7f7976)){var _0x30af36=JSON[_0x83b9('0x1')](_0x7f7976);var _0x4ee1e2={'$gte':moment(moment(_0x30af36[_0x83b9('0xa')])[_0x83b9('0xb')](_0x83b9('0xc')))[_0x83b9('0xd')]()[_0x83b9('0xb')](),'$lte':moment(moment(_0x30af36[_0x83b9('0xe')])['format'](_0x83b9('0xc')))[_0x83b9('0xd')]()[_0x83b9('0xf')](0x1,'s')['format']()};_0x8cabf1[_0x397f2d]=_0x4ee1e2;}else if(_0x56c8f4[_0x83b9('0x10')]===_0x83b9('0x11')){_0x8cabf1[_0x397f2d]=_0x7f7976;}else{_0x8cabf1[_0x397f2d]=_[_0x83b9('0x12')](_0x7f7976)?_0x7f7976:JSON[_0x83b9('0x1')](_0x7f7976);}}else{_0x8cabf1[_0x397f2d]=_[_0x83b9('0x12')](_0x7f7976)?_0x7f7976:JSON[_0x83b9('0x1')](_0x7f7976);}}catch(_0x5dbc40){_0x8cabf1[_0x397f2d]=_0x7f7976['split'](',');}});}return _0x8cabf1;};exports['limit']=function(_0x17379){_0x17379=parseInt(_0x17379,0xa);if(!_0x17379||_0x17379<0x0){_0x17379=LIMIT_VALUE;}return _0x17379;};exports[_0x83b9('0x13')]=function(_0x19fc14){_0x19fc14=parseInt(_0x19fc14,0xa);if(!_0x19fc14||_0x19fc14<0x0){_0x19fc14=0x0;}return _0x19fc14;};exports[_0x83b9('0x14')]=function(_0x3910a1){var _0x12e464,_0x5a08ae=null;if(_0x3910a1){_0x12e464=_0x3910a1[_0x83b9('0x6')](',');_0x5a08ae=_[_0x83b9('0x15')](_0x12e464,function(_0x14f5d7){if(_0x14f5d7['indexOf']('-')===0x0){return[_0x14f5d7==='priority'?sequelize[_0x83b9('0x16')](sequelize[_0x83b9('0x17')](_0x83b9('0x18')),'unsigned'):_0x14f5d7[_0x83b9('0x19')](0x1),_0x83b9('0x1a')];}else{return[_0x14f5d7===_0x83b9('0x18')?sequelize[_0x83b9('0x16')](sequelize[_0x83b9('0x17')]('priority'),_0x83b9('0x1b')):_0x14f5d7,_0x83b9('0x1c')];}});}return _0x5a08ae;};exports[_0x83b9('0x1d')]=function(_0x20ea53,_0x48cde6){if(_[_0x83b9('0x1e')](_0x20ea53)){return _0x20ea53;}if(_[_0x83b9('0x12')](_0x20ea53)){for(var _0x2e5692=0x0;_0x2e5692<_0x20ea53['length'];_0x2e5692+=0x1){_0x20ea53[_0x2e5692]=this[_0x83b9('0x1d')](_0x20ea53[_0x2e5692],_0x48cde6);}return _0x20ea53;}if(!_[_0x83b9('0x1f')](_0x20ea53)){return _0x20ea53;}if(_['isString'](_0x48cde6)){_0x48cde6=[_0x48cde6];}if(!_['isArray'](_0x48cde6)){return _0x20ea53;}for(var _0x3de4f8=0x0;_0x3de4f8<_0x48cde6['length'];_0x3de4f8+=0x1){_[_0x83b9('0x20')](_0x20ea53,_0x48cde6[_0x3de4f8]);}for(var _0xf6b74d in _0x20ea53){if(_0x20ea53[_0x83b9('0x21')](_0xf6b74d)){_0x20ea53[_0xf6b74d]=this['omit'](_0x20ea53[_0xf6b74d],_0x48cde6);}}return _0x20ea53;};exports['isNumeric']=function(_0xa0de96){return _0xa0de96[_0x83b9('0x22')](RegExp(_0x83b9('0x23')))?!![]:![];};exports[_0x83b9('0x24')]=function(_0x2bacf2){return _0x2bacf2[_0x83b9('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x83b9('0x25')]=function(_0x53292,_0x4921e0){var _0x49dc17=[];var _0x3341e8=/([^:]")"+/g;var _0x16026c=/[*<>~@-]/g;var _0x4acc1e=/[ `!@#$%^&*()_\-?~<>]/;var _0x5222da=/[ ,]+/;var _0x3e4b08=_0x4921e0?_0x83b9('0x26'):_0x83b9('0x27');if(_0x4921e0){_0x53292=_0x53292[_0x83b9('0x28')](_0x16026c,'\x20')[_0x83b9('0x29')]();}_0x53292[_0x83b9('0x6')](_0x5222da)['forEach'](function(_0x47dc00){_0x47dc00=_0x47dc00['replace'](_0x3341e8,'$1');_0x47dc00='+'+_0x47dc00+'*';var _0xdb744c=_0x47dc00[_0x83b9('0x22')](_0x4acc1e);if(_0xdb744c){_0x47dc00='\x22'+_0x47dc00+'\x22';}_0x49dc17[_0x83b9('0x2a')](_0x47dc00);});_0x3e4b08=_0x3e4b08[_0x83b9('0x28')](_0x83b9('0x27'),_0x49dc17['join']('\x20'));return _0x3e4b08;};exports['getOptions']=function(_0x2e7b9e,_0x5a8ce8,_0x30bb17){var _0x394460={},_0x1f5ad0={};if(_0x5a8ce8[_0x83b9('0x2b')][_0x83b9('0x2c')]){_0x5a8ce8['query']['id']=_0x5a8ce8[_0x83b9('0x2b')][_0x83b9('0x2c')];delete _0x5a8ce8[_0x83b9('0x2b')][_0x83b9('0x2c')];}_0x394460['model']=_[_0x83b9('0x15')](_0x2e7b9e,'name');_0x394460[_0x83b9('0x2b')]=_[_0x83b9('0x2')](_0x5a8ce8[_0x83b9('0x2b')]);_0x394460[_0x83b9('0x2d')]=_[_0x83b9('0x2e')](_0x394460[_0x83b9('0x4')],_0x394460[_0x83b9('0x2b')]);_0x1f5ad0[_0x83b9('0x2f')]=_[_0x83b9('0x2e')](_0x394460[_0x83b9('0x4')],this[_0x83b9('0x5')](_0x5a8ce8['query']['fields']));_0x1f5ad0[_0x83b9('0x2f')]=_0x1f5ad0[_0x83b9('0x2f')]['length']?_0x1f5ad0[_0x83b9('0x2f')]:_0x394460[_0x83b9('0x4')];if(!_0x5a8ce8[_0x83b9('0x2b')][_0x83b9('0x21')](_0x83b9('0x30'))){_0x1f5ad0[_0x83b9('0x31')]=this[_0x83b9('0x31')](_0x5a8ce8[_0x83b9('0x2b')][_0x83b9('0x31')]);_0x1f5ad0[_0x83b9('0x13')]=this['offset'](_0x5a8ce8['query'][_0x83b9('0x13')]);}_0x1f5ad0[_0x83b9('0x32')]=this['sort'](_0x5a8ce8[_0x83b9('0x2b')][_0x83b9('0x14')]);_0x1f5ad0[_0x83b9('0x33')]=this[_0x83b9('0x2d')](_['pick'](_0x5a8ce8[_0x83b9('0x2b')],_0x394460[_0x83b9('0x2d')]),_0x2e7b9e);if(_0x5a8ce8['query']['filter']){var _0x3968cc=_0x2e7b9e;var _0x23be93=_0x5a8ce8['query'][_0x83b9('0x34')];if(typeof _0x23be93==='object'){_0x3968cc=_[_0x83b9('0x34')](_0x2e7b9e,function(_0x1ec025){return _[_0x83b9('0x3')](_0x23be93[_0x83b9('0x35')],_0x1ec025[_0x83b9('0x10')]);});_0x23be93=_0x23be93[_0x83b9('0x36')];}_0x1f5ad0[_0x83b9('0x33')]=_['merge'](_0x1f5ad0[_0x83b9('0x33')],{'$or':_[_0x83b9('0x15')](_0x3968cc,function(_0x4ca8bc){if(_0x4ca8bc['type']!==_0x83b9('0x37')){if(_0x30bb17){return sequelize[_0x83b9('0x33')](sequelize['fn'](_0x83b9('0x38'),sequelize[_0x83b9('0x17')](_0x4ca8bc[_0x83b9('0x10')])),{'$like':sequelize['fn'](_0x83b9('0x38'),'%'+_0x5a8ce8[_0x83b9('0x2b')]['filter']+'%')});}else{var _0x205d9b={};_0x205d9b[_0x4ca8bc[_0x83b9('0x10')]]={'$like':'%'+_0x5a8ce8[_0x83b9('0x2b')]['filter']+'%'};return _0x205d9b;}}})});}_0x1f5ad0=_[_0x83b9('0x39')]({},_0x1f5ad0,_0x5a8ce8[_0x83b9('0x3a')]);return _0x1f5ad0;};exports[_0x83b9('0x3b')]=function(_0x2e96a0){var _0x3442c0=[];if(_0x2e96a0['includeAll']){_0x3442c0['push']({'all':!![]});}else if(_0x2e96a0[_0x83b9('0x3b')]){if(Array[_0x83b9('0x12')](_0x2e96a0[_0x83b9('0x3b')])){_0x3442c0=Object['keys'](_0x2e96a0['include'])[_0x83b9('0x15')](function(_0x2abc50){return parseIncludeModel(_0x2e96a0[_0x83b9('0x3b')][_0x2abc50]);});}else{var _0x385b7c=parseIncludeModel(_0x2e96a0[_0x83b9('0x3b')]);_0x3442c0['push'](_0x385b7c);}}return _0x3442c0;};exports[_0x83b9('0x3c')]=function(_0x5b8b34){return _0x5b8b34[_0x83b9('0x28')](/[%_^-]/g,function(_0x51b801){return'\x5c'+_0x51b801;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index ad2e908..8385d86 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 _0x63a5=['../../mysqldb','http','mailPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','error','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','busy','getAgentStatus','isArray','Queue','map','findOne','then','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','chatPause','faxPause','openchannelPause','find','merge','globalStatus','catch','fields','startsWith','ASC','getUpdatedSortOptions','fullname,internal','substring','indexOf','fullname','internal','validateSortParameter','sort','pauseType','toLowerCase','DESC','sortAgentsByStatus','userpic','lastPauseAt','address','whatsappPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatusTime','smsStatusTime','whatsappStatusTime','queue','destconnectedlinenum','online','omit','pick','filterAgentAttributes','name','role','lastLoginAt','faxStatusTime','openchannelStatusTime','voiceStatusTime','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise'];(function(_0x2903a2,_0x5e54c4){var _0x119ad9=function(_0x35fca9){while(--_0x35fca9){_0x2903a2['push'](_0x2903a2['shift']());}};_0x119ad9(++_0x5e54c4);}(_0x63a5,0x18e));var _0x563a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x63a5[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x563a('0x0'));var jayson=require(_0x563a('0x1'));var db=require(_0x563a('0x2'))['db'];var amiClient=jayson['client'][_0x563a('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x563a('0x3')]({'port':0x232c});function isAgentPaused(_0x13195e,_0x386400){var _0x37e617=[_0x13195e['chatPause'],_0x13195e['faxPause'],_0x13195e[_0x563a('0x4')],_0x13195e['openchannelPause'],_0x13195e[_0x563a('0x5')],_0x13195e[_0x563a('0x6')],_0x13195e['whatsappPause']];if(!_0x386400)return _['every'](_0x37e617);var _0xff1f59=_[_0x563a('0x7')](_0x37e617);return _0xff1f59[_0x563a('0x8')]>0x0&&_0xff1f59[_0x563a('0x8')]<_0x37e617[_0x563a('0x8')]?!![]:![];}function isIdle(_0xa61ffa){return _0xa61ffa===_0x563a('0x9')||_0xa61ffa===_0x563a('0xa')||_0xa61ffa===_0x563a('0xb')||_0xa61ffa===_0x563a('0xc')||_[_0x563a('0xd')](_0xa61ffa);}function isAgentIdle(_0x2361dd){if(_0x2361dd[_0x563a('0xe')]!==_0x563a('0x9')&&_0x2361dd['voicePause']){_0x2361dd[_0x563a('0xe')]=_0x563a('0xf');return![];}return _[_0x563a('0x10')]([_0x2361dd[_0x563a('0x11')],_0x2361dd[_0x563a('0x12')],_0x2361dd[_0x563a('0x13')],_0x2361dd['openchannelStatus'],_0x2361dd[_0x563a('0x14')],_0x2361dd[_0x563a('0xe')],_0x2361dd[_0x563a('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x563a('0x16')]('Agents',{})['then'](function(_0x414535){if(_0x414535[_0x563a('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x2ade24=_0x414535[_0x563a('0x18')];return routingClient[_0x563a('0x16')](_0x563a('0x19'),{})['then'](function(_0x598693){if(_0x598693[_0x563a('0x17')]){throw new Error(_0x563a('0x1a'));}var _0x54a3b4=_0x598693['result'];return _['merge']({},_0x2ade24,_0x54a3b4);});})['catch'](function(_0x4c15c1){throw _0x4c15c1;});}exports[_0x563a('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x300956){var _0x26061f=_0x563a('0xa');if(isAgentPaused(_0x300956))_0x26061f='pause';else if(isAgentPaused(_0x300956,!![]))_0x26061f='*pause';else if(isAgentIdle(_0x300956))_0x26061f=_0x563a('0x9');else _0x26061f=_0x563a('0x1c');return _0x26061f;}exports[_0x563a('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x2beccb,_0x1bf502){var _0x2dc7e2=_[_0x563a('0x1e')](_0x2beccb)?_0x2beccb:[_0x2beccb];var _0x563378=_['startCase'](_0x1bf502)+_0x563a('0x1f');var _0x5422f6=_[_0x563a('0x20')](_0x2dc7e2,function(_0xd3e0ae){return db[_0x563378][_0x563a('0x21')]({'where':{'id':_0xd3e0ae}})[_0x563a('0x22')](function(_0x113ebc){if(!_0x113ebc)return[];return _0x113ebc[_0x563a('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x563a('0x24')](_0x5422f6)[_0x563a('0x22')](function(_0x4de4c3){var _0x146ea0=_(_0x4de4c3)[_0x563a('0x25')]()[_0x563a('0x20')]('id')[_0x563a('0x26')]()[_0x563a('0x27')]();return _0x146ea0;});}exports[_0x563a('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1afdff,_0x199045,_0x249db8){try{if(_0x199045[_0x563a('0x8')]>0x0){_0x1afdff=_0x1afdff[_0x563a('0x7')](function(_0x24d1a8){return _0x199045[_0x563a('0x29')](_0x24d1a8['id']);});}var _0x7696c2=_0x1afdff['filter'](function(_0x43379c){var _0x3c16d0=_0x563a('0x1c');if(isAgentIdle(_0x43379c)){_0x3c16d0='idle';}return _0x3c16d0===_0x249db8;});return _[_0x563a('0x20')](_0x7696c2,'id');}catch(_0x2e5c4b){throw _0x2e5c4b;}}exports[_0x563a('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x28a8f6,_0x166f89,_0x1f81f6){return Promise[_0x563a('0x2b')]()['then'](function(){if(_0x166f89[_0x563a('0x8')]>0x0){_0x28a8f6=_0x28a8f6[_0x563a('0x7')](function(_0x4259f6){return _0x166f89[_0x563a('0x29')](_0x4259f6['id']);});}return _0x28a8f6;})[_0x563a('0x22')](function(){return db['User']['findAll']({'attributes':['id','name','fullname',_0x563a('0x2c'),_0x563a('0x2d'),_0x563a('0x4'),_0x563a('0x2e'),_0x563a('0x5'),_0x563a('0x6'),'whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x563a('0x20')](_0x28a8f6,'id')}},'raw':!![]});})[_0x563a('0x22')](function(_0x10f667){return _0x10f667[_0x563a('0x20')](function(_0x10d5d0){var _0x172289=_[_0x563a('0x2f')](_0x28a8f6,['id',_0x10d5d0['id']]);var _0x29dbc7=filterAgentAttributes(_0x172289);_[_0x563a('0x30')](_0x10d5d0,_0x29dbc7);_0x10d5d0[_0x563a('0x31')]=getAgentStatus(_0x10d5d0);return _0x10d5d0;});})[_0x563a('0x22')](function(_0x246a6){var _0x251a98=sortAgentsByStatus(_0x246a6,_0x1f81f6);return _[_0x563a('0x20')](_0x251a98,'id');})[_0x563a('0x32')](function(_0x17da2b){throw _0x17da2b;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x34b51c){var _0x733924={'fields':[],'order':null};var _0x28ac6c=_0x34b51c['split'](',');_0x733924[_0x563a('0x33')]=_['filter'](_0x28ac6c,function(_0x2c8dec){if(!_0x2c8dec[_0x563a('0x29')]('globalStatus')){return!![];}_0x733924['order']=_[_0x563a('0x34')](_0x2c8dec,'-')?'DESC':_0x563a('0x35');return![];});return _0x733924;}exports[_0x563a('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x441bb0){if(!_0x441bb0){_0x441bb0=_0x563a('0x37');}if(_0x441bb0['includes']('fullname')&&!_0x441bb0[_0x563a('0x29')]('internal')){var _0x46d471=_0x441bb0[_0x563a('0x38')](0x0,_0x441bb0[_0x563a('0x39')](_0x563a('0x3a')));_0x441bb0+=','+_0x46d471+_0x563a('0x3b');}return _0x441bb0;}exports[_0x563a('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x4bf555,_0x8f260c){var _0x4c71df=_0x4bf555[_0x563a('0x3d')](function(_0x480d67,_0x20c142){if(_0x480d67[_0x563a('0x31')]===_0x20c142[_0x563a('0x31')]){if(_0x480d67[_0x563a('0x31')]==='pause'){if(_0x8f260c==='DESC'){return(_0x480d67['pauseType']||'')<(_0x20c142[_0x563a('0x3e')]||'')||_0x480d67[_0x563a('0x3a')][_0x563a('0x3f')]()>_0x20c142[_0x563a('0x3a')][_0x563a('0x3f')]()?0x1:-0x1;}else{return(_0x480d67[_0x563a('0x3e')]||'')<(_0x20c142[_0x563a('0x3e')]||'')||_0x480d67[_0x563a('0x3a')][_0x563a('0x3f')]()>_0x20c142[_0x563a('0x3a')][_0x563a('0x3f')]()?-0x1:0x1;}}else{if(_0x8f260c===_0x563a('0x40')){return _0x480d67[_0x563a('0x3a')][_0x563a('0x3f')]()<_0x20c142[_0x563a('0x3a')][_0x563a('0x3f')]()?0x1:-0x1;}else{return _0x480d67[_0x563a('0x3a')][_0x563a('0x3f')]()<_0x20c142[_0x563a('0x3a')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x8f260c==='DESC'){return _0x480d67[_0x563a('0x31')]<_0x20c142[_0x563a('0x31')]?0x1:-0x1;}else{return _0x480d67[_0x563a('0x31')]<_0x20c142[_0x563a('0x31')]?-0x1:0x1;}}});return _0x4c71df;}exports[_0x563a('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x29b55a){var _0x9ee047=[_0x563a('0x42'),'online','lastLoginAt',_0x563a('0x43'),_0x563a('0x3e'),_0x563a('0x43'),_0x563a('0x3b'),_0x563a('0x44'),_0x563a('0x2c'),_0x563a('0x2e'),_0x563a('0x4'),'smsPause',_0x563a('0x45'),_0x563a('0x2d'),'voicePause',_0x563a('0x46'),'openchannelCapacity',_0x563a('0x47'),_0x563a('0x48'),_0x563a('0x49'),'faxCapacity',_0x563a('0x4a'),_0x563a('0x4b'),_0x563a('0x4c'),_0x563a('0x4d'),_0x563a('0x4e'),_0x563a('0x4f'),_0x563a('0x11'),_0x563a('0x50'),_0x563a('0x13'),_0x563a('0x14'),_0x563a('0x15'),_0x563a('0x12'),_0x563a('0xe'),'chatStatusTime','openchannelStatusTime',_0x563a('0x51'),_0x563a('0x52'),_0x563a('0x53'),'faxStatusTime','voiceStatusTime',_0x563a('0x54'),_0x563a('0x55'),'screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording'];var _0x1a957e=[_0x563a('0x2c'),_0x563a('0x2e'),_0x563a('0x4'),_0x563a('0x5'),_0x563a('0x45'),'faxPause','voicePause',_0x563a('0x56')];var _0x48271e=_(_0x29b55a)[_0x563a('0x57')](_0x1a957e)[_0x563a('0x58')](_0x9ee047)[_0x563a('0x27')]();return _0x48271e;}exports[_0x563a('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x563a('0x5a'),_0x563a('0x3a'),_0x563a('0x5b'),'internal',_0x563a('0x56'),_0x563a('0x31'),'userpic',_0x563a('0x5c'),_0x563a('0x3e'),_0x563a('0x43'),_0x563a('0x2d'),_0x563a('0x2c'),_0x563a('0x4'),_0x563a('0x2e'),_0x563a('0x5'),_0x563a('0x6'),_0x563a('0x45'),'chatStatus',_0x563a('0x12'),_0x563a('0x13'),'openchannelStatus','smsStatus',_0x563a('0xe'),_0x563a('0x15'),'chatStatusTime',_0x563a('0x5d'),'mailStatusTime',_0x563a('0x5e'),_0x563a('0x52'),_0x563a('0x5f'),_0x563a('0x53'),_0x563a('0x46'),'faxCapacity','mailCapacity','openchannelCapacity','smsCapacity',_0x563a('0x49'),'chatCurrentCapacity',_0x563a('0x4f'),'mailCurrentCapacity',_0x563a('0x4b'),_0x563a('0x4d'),_0x563a('0x4e'),_0x563a('0x60'),_0x563a('0x61'),'destconnectedlinenum',_0x563a('0x62'),'queue','screenrecording'];}exports[_0x563a('0x63')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x6901=['chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','all','uniq','value','getAgentIdsByQueues','filter','resolve','includes','findAll','name','fullname','faxPause','mailPause','pauseType','find','globalStatus','catch','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastPauseAt','address','chatCapacity','mailCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','filterAgentAttributes','chatStatusTime','faxStatusTime','voiceStatusTime','openchannelCapacity','chatCurrentCapacity','destconnectedlinenum','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','ringing','isNil','voiceStatus','pause'];(function(_0x43ae3d,_0x141651){var _0x5d8c10=function(_0x341ec9){while(--_0x341ec9){_0x43ae3d['push'](_0x43ae3d['shift']());}};_0x5d8c10(++_0x141651);}(_0x6901,0x100));var _0x1690=function(_0x1fd242,_0x3f0e97){_0x1fd242=_0x1fd242-0x0;var _0xb9b2f7=_0x6901[_0x1fd242];return _0xb9b2f7;};'use strict';var _=require(_0x1690('0x0'));var jayson=require('jayson/promise');var db=require(_0x1690('0x1'))['db'];var amiClient=jayson[_0x1690('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x1690('0x3')]({'port':0x232c});function isAgentPaused(_0x198e19,_0x540bb3){var _0x53771c=[_0x198e19[_0x1690('0x4')],_0x198e19['faxPause'],_0x198e19['mailPause'],_0x198e19[_0x1690('0x5')],_0x198e19[_0x1690('0x6')],_0x198e19[_0x1690('0x7')],_0x198e19[_0x1690('0x8')]];if(!_0x540bb3)return _[_0x1690('0x9')](_0x53771c);var _0x888ca9=_['filter'](_0x53771c);return _0x888ca9[_0x1690('0xa')]>0x0&&_0x888ca9[_0x1690('0xa')]<_0x53771c[_0x1690('0xa')]?!![]:![];}function isIdle(_0x2a82ae){return _0x2a82ae===_0x1690('0xb')||_0x2a82ae===_0x1690('0xc')||_0x2a82ae==='unavailable'||_0x2a82ae===_0x1690('0xd')||_[_0x1690('0xe')](_0x2a82ae);}function isAgentIdle(_0x49dc93){if(_0x49dc93[_0x1690('0xf')]!==_0x1690('0xb')&&_0x49dc93[_0x1690('0x7')]){_0x49dc93[_0x1690('0xf')]=_0x1690('0x10');return![];}return _[_0x1690('0x9')]([_0x49dc93[_0x1690('0x11')],_0x49dc93[_0x1690('0x12')],_0x49dc93[_0x1690('0x13')],_0x49dc93[_0x1690('0x14')],_0x49dc93['smsStatus'],_0x49dc93[_0x1690('0xf')],_0x49dc93[_0x1690('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x1690('0x16')]('Agents',{})['then'](function(_0x2d5617){if(_0x2d5617['error']){throw new Error(_0x1690('0x17'));}var _0x5295b6=_0x2d5617['result'];return routingClient[_0x1690('0x16')]('Agents',{})[_0x1690('0x18')](function(_0x2e1696){if(_0x2e1696['error']){throw new Error(_0x1690('0x19'));}var _0x2817a8=_0x2e1696[_0x1690('0x1a')];return _[_0x1690('0x1b')]({},_0x5295b6,_0x2817a8);});})['catch'](function(_0xcd6b2e){throw _0xcd6b2e;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x3b5eb0){var _0x2be44b=_0x1690('0xc');if(isAgentPaused(_0x3b5eb0))_0x2be44b=_0x1690('0x10');else if(isAgentPaused(_0x3b5eb0,!![]))_0x2be44b=_0x1690('0x1c');else if(isAgentIdle(_0x3b5eb0))_0x2be44b=_0x1690('0xb');else _0x2be44b=_0x1690('0x1d');return _0x2be44b;}exports[_0x1690('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x1a050b,_0xa7d053){var _0x74cb9=_[_0x1690('0x1f')](_0x1a050b)?_0x1a050b:[_0x1a050b];var _0xb7276e=_[_0x1690('0x20')](_0xa7d053)+_0x1690('0x21');var _0x4033c1=_[_0x1690('0x22')](_0x74cb9,function(_0x1b7fc1){return db[_0xb7276e]['findOne']({'where':{'id':_0x1b7fc1}})[_0x1690('0x18')](function(_0x272209){if(!_0x272209)return[];return _0x272209['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x1690('0x23')](_0x4033c1)[_0x1690('0x18')](function(_0x252e88){var _0x136567=_(_0x252e88)['flatten']()[_0x1690('0x22')]('id')[_0x1690('0x24')]()[_0x1690('0x25')]();return _0x136567;});}exports[_0x1690('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x214679,_0x2d04d1,_0x4fb78c){try{if(_0x2d04d1['length']>0x0){_0x214679=_0x214679[_0x1690('0x27')](function(_0x536c54){return _0x2d04d1['includes'](_0x536c54['id']);});}var _0x49bd71=_0x214679[_0x1690('0x27')](function(_0x40ee73){var _0x308e72=_0x1690('0x1d');if(isAgentIdle(_0x40ee73)){_0x308e72=_0x1690('0xb');}return _0x308e72===_0x4fb78c;});return _[_0x1690('0x22')](_0x49bd71,'id');}catch(_0x2ff0d5){throw _0x2ff0d5;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3ead2e,_0x45cddb,_0x93128){return Promise[_0x1690('0x28')]()[_0x1690('0x18')](function(){if(_0x45cddb[_0x1690('0xa')]>0x0){_0x3ead2e=_0x3ead2e[_0x1690('0x27')](function(_0x56ea8d){return _0x45cddb[_0x1690('0x29')](_0x56ea8d['id']);});}return _0x3ead2e;})[_0x1690('0x18')](function(){return db['User'][_0x1690('0x2a')]({'attributes':['id',_0x1690('0x2b'),_0x1690('0x2c'),_0x1690('0x4'),_0x1690('0x2d'),_0x1690('0x2e'),_0x1690('0x5'),_0x1690('0x6'),'voicePause',_0x1690('0x8'),_0x1690('0x2f')],'where':{'id':{'$in':_[_0x1690('0x22')](_0x3ead2e,'id')}},'raw':!![]});})[_0x1690('0x18')](function(_0x59ebda){return _0x59ebda['map'](function(_0x2958e1){var _0x29e8a8=_[_0x1690('0x30')](_0x3ead2e,['id',_0x2958e1['id']]);var _0x24a128=filterAgentAttributes(_0x29e8a8);_[_0x1690('0x1b')](_0x2958e1,_0x24a128);_0x2958e1[_0x1690('0x31')]=getAgentStatus(_0x2958e1);return _0x2958e1;});})['then'](function(_0x3526ab){var _0x2e34c8=sortAgentsByStatus(_0x3526ab,_0x93128);return _['map'](_0x2e34c8,'id');})[_0x1690('0x32')](function(_0x537218){throw _0x537218;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2a8137){var _0x211563={'fields':[],'order':null};var _0x486448=_0x2a8137['split'](',');_0x211563[_0x1690('0x33')]=_[_0x1690('0x27')](_0x486448,function(_0x39fc1e){if(!_0x39fc1e[_0x1690('0x29')](_0x1690('0x31'))){return!![];}_0x211563[_0x1690('0x34')]=_[_0x1690('0x35')](_0x39fc1e,'-')?_0x1690('0x36'):'ASC';return![];});return _0x211563;}exports[_0x1690('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x5a85f1){if(!_0x5a85f1){_0x5a85f1=_0x1690('0x38');}if(_0x5a85f1[_0x1690('0x29')](_0x1690('0x2c'))&&!_0x5a85f1['includes'](_0x1690('0x39'))){var _0x9b3489=_0x5a85f1[_0x1690('0x3a')](0x0,_0x5a85f1['indexOf'](_0x1690('0x2c')));_0x5a85f1+=','+_0x9b3489+_0x1690('0x39');}return _0x5a85f1;}exports[_0x1690('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x37f620,_0x491bc9){var _0x54ffba=_0x37f620[_0x1690('0x3c')](function(_0x34fd2a,_0x2a39c2){if(_0x34fd2a[_0x1690('0x31')]===_0x2a39c2['globalStatus']){if(_0x34fd2a[_0x1690('0x31')]===_0x1690('0x10')){if(_0x491bc9===_0x1690('0x36')){return(_0x34fd2a[_0x1690('0x2f')]||'')<(_0x2a39c2['pauseType']||'')||_0x34fd2a['fullname']['toLowerCase']()>_0x2a39c2[_0x1690('0x2c')][_0x1690('0x3d')]()?0x1:-0x1;}else{return(_0x34fd2a[_0x1690('0x2f')]||'')<(_0x2a39c2['pauseType']||'')||_0x34fd2a[_0x1690('0x2c')][_0x1690('0x3d')]()>_0x2a39c2['fullname'][_0x1690('0x3d')]()?-0x1:0x1;}}else{if(_0x491bc9===_0x1690('0x36')){return _0x34fd2a['fullname'][_0x1690('0x3d')]()<_0x2a39c2['fullname'][_0x1690('0x3d')]()?0x1:-0x1;}else{return _0x34fd2a[_0x1690('0x2c')][_0x1690('0x3d')]()<_0x2a39c2[_0x1690('0x2c')][_0x1690('0x3d')]()?-0x1:0x1;}}}else{if(_0x491bc9===_0x1690('0x36')){return _0x34fd2a[_0x1690('0x31')]<_0x2a39c2[_0x1690('0x31')]?0x1:-0x1;}else{return _0x34fd2a[_0x1690('0x31')]<_0x2a39c2[_0x1690('0x31')]?-0x1:0x1;}}});return _0x54ffba;}exports[_0x1690('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x379549){var _0xbd978c=[_0x1690('0x3f'),'online','lastLoginAt',_0x1690('0x40'),'pauseType',_0x1690('0x40'),_0x1690('0x39'),_0x1690('0x41'),_0x1690('0x4'),'openchannelPause',_0x1690('0x2e'),_0x1690('0x6'),_0x1690('0x8'),_0x1690('0x2d'),'voicePause',_0x1690('0x42'),'openchannelCapacity',_0x1690('0x43'),'smsCapacity','whatsappCapacity',_0x1690('0x44'),'chatCurrentCapacity',_0x1690('0x45'),_0x1690('0x46'),_0x1690('0x47'),_0x1690('0x48'),_0x1690('0x49'),_0x1690('0x11'),_0x1690('0x14'),_0x1690('0x13'),'smsStatus','whatsappStatus',_0x1690('0x12'),'voiceStatus','chatStatusTime',_0x1690('0x4a'),_0x1690('0x4b'),_0x1690('0x4c'),'whatsappStatusTime','faxStatusTime','voiceStatusTime',_0x1690('0x4d'),'destconnectedlinenum',_0x1690('0x4e'),_0x1690('0x4f'),_0x1690('0x50')];var _0x2ac80c=[_0x1690('0x4'),'openchannelPause',_0x1690('0x2e'),_0x1690('0x6'),_0x1690('0x8'),_0x1690('0x2d'),_0x1690('0x7'),_0x1690('0x51')];var _0x13da6b=_(_0x379549)['omit'](_0x2ac80c)['pick'](_0xbd978c)['value']();return _0x13da6b;}exports[_0x1690('0x52')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x1690('0x2b'),'fullname','role',_0x1690('0x39'),'online',_0x1690('0x31'),_0x1690('0x3f'),'lastLoginAt',_0x1690('0x2f'),_0x1690('0x40'),'faxPause',_0x1690('0x4'),_0x1690('0x2e'),_0x1690('0x5'),'smsPause',_0x1690('0x7'),_0x1690('0x8'),_0x1690('0x11'),'faxStatus',_0x1690('0x13'),'openchannelStatus','smsStatus',_0x1690('0xf'),_0x1690('0x15'),_0x1690('0x53'),_0x1690('0x54'),_0x1690('0x4b'),_0x1690('0x4a'),_0x1690('0x4c'),_0x1690('0x55'),'whatsappStatusTime',_0x1690('0x42'),_0x1690('0x44'),_0x1690('0x43'),_0x1690('0x56'),'smsCapacity','whatsappCapacity',_0x1690('0x57'),'faxCurrentCapacity',_0x1690('0x46'),_0x1690('0x45'),_0x1690('0x47'),_0x1690('0x48'),'phoneBarEnableScreenRecordingByAgent',_0x1690('0x50'),_0x1690('0x58'),_0x1690('0x59'),_0x1690('0x4d'),'screenrecording'];}exports[_0x1690('0x5a')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index de70dbf..ec2481d 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 _0xc6d0=['concat','outbound','map','get','paused','available','find','merge','pick','jayson/promise','util','client','http','loggedIn','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','unavailable','pTalking','originated','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound'];(function(_0x18b32d,_0x5b5432){var _0x11a467=function(_0x54aea4){while(--_0x54aea4){_0x18b32d['push'](_0x18b32d['shift']());}};_0x11a467(++_0x5b5432);}(_0xc6d0,0xa2));var _0x0c6d=function(_0x4a6262,_0x4bfb8c){_0x4a6262=_0x4a6262-0x0;var _0x10385a=_0xc6d0[_0x4a6262];return _0x10385a;};'use strict';var _=require('lodash');var jayson=require(_0x0c6d('0x0'));var util=require(_0x0c6d('0x1'));var amiClient=jayson[_0x0c6d('0x2')][_0x0c6d('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x0c6d('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x0c6d('0x4'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x0c6d('0x5'),_0x0c6d('0x6'),_0x0c6d('0x7'),_0x0c6d('0x8'),_0x0c6d('0x9'),_0x0c6d('0xa'),_0x0c6d('0xb'),'ringInUse','talking',_0x0c6d('0xc'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x0c6d('0xd'),_0x0c6d('0xe'),'message',_0x0c6d('0xf'),_0x0c6d('0x10'),'dialMethod',_0x0c6d('0x11'),_0x0c6d('0x12'),_0x0c6d('0x13'),_0x0c6d('0x14'),_0x0c6d('0x15'),'erlangAbandonmentRate',_0x0c6d('0x16'),_0x0c6d('0x17'),'dialPredictiveIntervalMaxThreshold',_0x0c6d('0x18'),_0x0c6d('0x19'),_0x0c6d('0x1a'),_0x0c6d('0x1b'),_0x0c6d('0x1c'),_0x0c6d('0x1d'),_0x0c6d('0x1e'),_0x0c6d('0x1f')];function getRealtimeQueues(_0x83acb0,_0x539821){var _0x203e25=_0x539821===_0x0c6d('0x20')?amiClient:routingClient;return _0x203e25[_0x0c6d('0x21')](_[_0x0c6d('0x22')](_0x539821)+'Queues',_0x83acb0)[_0x0c6d('0x23')](function(_0xec92ce){if(_0xec92ce[_0x0c6d('0x24')])throw new Error(util[_0x0c6d('0x25')](_0x0c6d('0x26'),_0x539821));return _0xec92ce[_0x0c6d('0x27')];})[_0x0c6d('0x28')](function(_0x2ec5e2){throw _0x2ec5e2;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1eb4aa,_0x1ccb75,_0x446b6c,_0x57d35c){var _0x2dd3f8=DEFAULT_QUEUE_ATTRIBUTES;if(_0x446b6c===_0x0c6d('0x20')){if(_0x57d35c===_0x0c6d('0x29')){_0x2dd3f8=_0x2dd3f8[_0x0c6d('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x57d35c===_0x0c6d('0x2b')){_0x2dd3f8=_0x2dd3f8['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1eb4aa[_0x0c6d('0x2c')](function(_0x87417c){var _0x2563de=_0x87417c[_0x0c6d('0x2d')]({'plain':!![]});_0x2563de[_0x0c6d('0x2e')]=0x0;_0x2563de[_0x0c6d('0x8')]=0x0;_0x2563de['loggedIn']=0x0;_0x2563de[_0x0c6d('0x2f')]=0x0;_0x2563de['waiting']=0x0;if(_0x446b6c===_0x0c6d('0x20')){_0x2563de['talking']=0x0;_0x2563de[_0x0c6d('0x5')]=0x0;if(_0x57d35c===_0x0c6d('0x2b')){_0x2563de['pTalking']=0x0;_0x2563de[_0x0c6d('0xe')]=0x0;}}var _0x460608=_[_0x0c6d('0x30')](_0x1ccb75,['id',_0x2563de['id']]);if(_0x460608){_[_0x0c6d('0x31')](_0x2563de,_[_0x0c6d('0x32')](_0x460608,_0x2dd3f8));}return _0x2563de;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0xf39d=['catch','getRealtimeQueues','voice','concat','outbound','map','loggedIn','waiting','pTalking','find','merge','lodash','jayson/promise','client','http','busy','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','originated','statusMessage','dialActive','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf39d,0x183));var _0xdf39=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xf39d[_0xe0b81f];return _0x290e5e;};'use strict';var _=require(_0xdf39('0x0'));var jayson=require(_0xdf39('0x1'));var util=require('util');var amiClient=jayson[_0xdf39('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xdf39('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn','paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xdf39('0x4'),'inUse',_0xdf39('0x5'),_0xdf39('0x6'),_0xdf39('0x7'),_0xdf39('0x8'),_0xdf39('0x9'),_0xdf39('0xa'),_0xdf39('0xb'),'unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xdf39('0xc'),'message',_0xdf39('0xd'),_0xdf39('0xe'),'dialMethod','Trunk',_0xdf39('0xf'),_0xdf39('0x10'),'erlangCalls',_0xdf39('0x11'),_0xdf39('0x12'),_0xdf39('0x13'),_0xdf39('0x14'),_0xdf39('0x15'),_0xdf39('0x16'),_0xdf39('0x17'),_0xdf39('0x18'),_0xdf39('0x19'),_0xdf39('0x1a'),'predictiveIntervalDroppedCallsCallersExit',_0xdf39('0x1b'),_0xdf39('0x1c')];function getRealtimeQueues(_0x3e1ec6,_0x2f5d25){var _0x4bf033=_0x2f5d25==='voice'?amiClient:routingClient;return _0x4bf033[_0xdf39('0x1d')](_[_0xdf39('0x1e')](_0x2f5d25)+_0xdf39('0x1f'),_0x3e1ec6)['then'](function(_0xd0b472){if(_0xd0b472[_0xdf39('0x20')])throw new Error(util[_0xdf39('0x21')](_0xdf39('0x22'),_0x2f5d25));return _0xd0b472[_0xdf39('0x23')];})[_0xdf39('0x24')](function(_0x367998){throw _0x367998;});}exports[_0xdf39('0x25')]=getRealtimeQueues;function initializeQueues(_0x227761,_0x1da8ff,_0x2f7390,_0x216e4b){var _0x5d695e=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2f7390===_0xdf39('0x26')){if(_0x216e4b==='inbound'){_0x5d695e=_0x5d695e[_0xdf39('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x216e4b===_0xdf39('0x28')){_0x5d695e=_0x5d695e['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x227761[_0xdf39('0x29')](function(_0x16615e){var _0x52478d=_0x16615e['get']({'plain':!![]});_0x52478d['paused']=0x0;_0x52478d['loggedInDb']=0x0;_0x52478d[_0xdf39('0x2a')]=0x0;_0x52478d['available']=0x0;_0x52478d[_0xdf39('0x2b')]=0x0;if(_0x2f7390===_0xdf39('0x26')){_0x52478d[_0xdf39('0xb')]=0x0;_0x52478d[_0xdf39('0x4')]=0x0;if(_0x216e4b===_0xdf39('0x28')){_0x52478d[_0xdf39('0x2c')]=0x0;_0x52478d[_0xdf39('0xc')]=0x0;}}var _0x3225a5=_[_0xdf39('0x2d')](_0x1da8ff,['id',_0x52478d['id']]);if(_0x3225a5){_[_0xdf39('0x2e')](_0x52478d,_['pick'](_0x3225a5,_0x5d695e));}return _0x52478d;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 229bb5a..5c89d22 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(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x3f817e,_0x538f27){var _0x3c5602=function(_0x148aca){while(--_0x148aca){_0x3f817e['push'](_0x3f817e['shift']());}};_0x3c5602(++_0x538f27);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 15268c5..671d814 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 _0x6913=['ipAddress','update','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','filter','IPv4','concat','head','mac','address','getFirstInterface','map','model','join','createHash','md5','hex','getUuid','platform','licenseToken','test','win32','utf8','hostname','macAddress'];(function(_0x1b94c1,_0x3b4769){var _0x38c1ad=function(_0x1bca2f){while(--_0x1bca2f){_0x1b94c1['push'](_0x1b94c1['shift']());}};_0x38c1ad(++_0x3b4769);}(_0x6913,0x190));var _0x3691=function(_0x221035,_0x15a7e7){_0x221035=_0x221035-0x0;var _0x181c2b=_0x6913[_0x221035];return _0x181c2b;};'use strict';var _=require(_0x3691('0x0'));var os=require('os');var crypto=require(_0x3691('0x1'));var machine=require(_0x3691('0x2'));var exec=require(_0x3691('0x3'))[_0x3691('0x4')];var config=require('../environment');function getInterfaces(){var _0x1bf592=[];var _0xa31cae=os[_0x3691('0x5')]();var _0x2ab518=_[_0x3691('0x6')](_['keys'](_0xa31cae));for(var _0x4682b7=0x0;_0x4682b7<_0x2ab518[_0x3691('0x7')];_0x4682b7++){var _0x23fed0=_0xa31cae[_0x2ab518[_0x4682b7]][_0x3691('0x8')](function(_0x3dfb1c){return _0x3dfb1c['family']===_0x3691('0x9')&&_0x3dfb1c['internal']===![];});_0x1bf592=_0x1bf592[_0x3691('0xa')](_0x23fed0);}return _0x1bf592;}function getFirstInterface(){var _0x1116da=_[_0x3691('0xb')](getInterfaces());return{'macAddress':_0x1116da&&_0x1116da[_0x3691('0xc')]?_0x1116da[_0x3691('0xc')]:'00:00:00:00:00:00','ipAddress':_0x1116da&&_0x1116da[_0x3691('0xd')]?_0x1116da[_0x3691('0xd')]:'127.0.0.1'};}exports[_0x3691('0xe')]=getFirstInterface;function getCPUhash(){var _0x281ef8=_[_0x3691('0x6')](os['cpus']()[_0x3691('0xf')](function(_0x311dc2){return _0x311dc2[_0x3691('0x10')];}))[_0x3691('0x11')](':');return crypto[_0x3691('0x12')](_0x3691('0x13'))['update'](_0x281ef8)['digest'](_0x3691('0x14'));}exports[_0x3691('0x15')]=function(){var _0x11b156=os[_0x3691('0x16')]();var _0x404867=/[0-9a-f-]{36}/;if(config[_0x3691('0x17')]&&_0x404867[_0x3691('0x18')](config[_0x3691('0x17')])){return config['licenseToken'];}else if(_0x11b156===_0x3691('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x3691('0x1a')})['replace']('\x0d\x0a','');}else{var _0x588450=getFirstInterface();var _0x3b568f=getCPUhash();var _0x1b3ace=_0x3b568f+'|'+os[_0x3691('0x1b')]()+'|'+_0x588450[_0x3691('0x1c')]+'|'+_0x588450[_0x3691('0x1d')];var _0x4b1df5=crypto[_0x3691('0x12')](_0x3691('0x13'))[_0x3691('0x1e')](_0x1b3ace)[_0x3691('0x1f')](_0x3691('0x14'));return _0x4b1df5[_0x3691('0x20')](0x0,0x8)+'-'+_0x4b1df5['substring'](0x8,0xc)+'-'+_0x4b1df5['substring'](0xc,0x10)+'-'+_0x4b1df5[_0x3691('0x20')](0x10,0x14)+'-'+_0x4b1df5[_0x3691('0x20')](0x14);}}; \ No newline at end of file +var _0xb071=['family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','join','createHash','md5','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','substring','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','keys','length'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb071,0x122));var _0x1b07=function(_0x1fd450,_0x42cbf6){_0x1fd450=_0x1fd450-0x0;var _0x4cb0a5=_0xb071[_0x1fd450];return _0x4cb0a5;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x1b07('0x0'));var machine=require(_0x1b07('0x1'));var exec=require('child_process')[_0x1b07('0x2')];var config=require(_0x1b07('0x3'));function getInterfaces(){var _0x4cf33d=[];var _0x1b2946=os[_0x1b07('0x4')]();var _0xbbc141=_['orderBy'](_[_0x1b07('0x5')](_0x1b2946));for(var _0xeb83f9=0x0;_0xeb83f9<_0xbbc141[_0x1b07('0x6')];_0xeb83f9++){var _0x131462=_0x1b2946[_0xbbc141[_0xeb83f9]]['filter'](function(_0x224bff){return _0x224bff[_0x1b07('0x7')]===_0x1b07('0x8')&&_0x224bff[_0x1b07('0x9')]===![];});_0x4cf33d=_0x4cf33d['concat'](_0x131462);}return _0x4cf33d;}function getFirstInterface(){var _0x31d6e2=_[_0x1b07('0xa')](getInterfaces());return{'macAddress':_0x31d6e2&&_0x31d6e2[_0x1b07('0xb')]?_0x31d6e2[_0x1b07('0xb')]:_0x1b07('0xc'),'ipAddress':_0x31d6e2&&_0x31d6e2['address']?_0x31d6e2[_0x1b07('0xd')]:_0x1b07('0xe')};}exports[_0x1b07('0xf')]=getFirstInterface;function getCPUhash(){var _0x1e74e3=_['orderBy'](os['cpus']()[_0x1b07('0x10')](function(_0x4bb347){return _0x4bb347['model'];}))[_0x1b07('0x11')](':');return crypto[_0x1b07('0x12')](_0x1b07('0x13'))[_0x1b07('0x14')](_0x1e74e3)[_0x1b07('0x15')](_0x1b07('0x16'));}exports['getUuid']=function(){var _0x112a6b=os[_0x1b07('0x17')]();var _0x6eaa6b=/[0-9a-f-]{36}/;if(config[_0x1b07('0x18')]&&_0x6eaa6b[_0x1b07('0x19')](config[_0x1b07('0x18')])){return config[_0x1b07('0x18')];}else if(_0x112a6b===_0x1b07('0x1a')){return exec(_0x1b07('0x1b'),{'encoding':_0x1b07('0x1c')})[_0x1b07('0x1d')]('\x0d\x0a','');}else{var _0x36d294=getFirstInterface();var _0x1c7525=getCPUhash();var _0x19ba2b=_0x1c7525+'|'+os[_0x1b07('0x1e')]()+'|'+_0x36d294['macAddress']+'|'+_0x36d294[_0x1b07('0x1f')];var _0x394689=crypto[_0x1b07('0x12')]('md5')['update'](_0x19ba2b)[_0x1b07('0x15')](_0x1b07('0x16'));return _0x394689['substring'](0x0,0x8)+'-'+_0x394689[_0x1b07('0x20')](0x8,0xc)+'-'+_0x394689[_0x1b07('0x20')](0xc,0x10)+'-'+_0x394689['substring'](0x10,0x14)+'-'+_0x394689[_0x1b07('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 67b8398..79a764a 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 _0x1c5a=['decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','YYYY-MM-DD\x20HH:mm'];(function(_0x5834ca,_0x3c0256){var _0x202321=function(_0x35e4ed){while(--_0x35e4ed){_0x5834ca['push'](_0x5834ca['shift']());}};_0x202321(++_0x3c0256);}(_0x1c5a,0xcd));var _0xa1c5=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x1c5a[_0x13b02f];return _0x12e9a6;};'use strict';var util=require('util');var moment=require(_0xa1c5('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0xa1c5('0x1'))(module,_0xa1c5('0x2'));var db=require(_0xa1c5('0x3'))['db'];var encryptor=require(_0xa1c5('0x4'));var hardware=require(_0xa1c5('0x5'));var logger=require('../logger')(_0xa1c5('0x6'));var HOST=_0xa1c5('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1c9aa6){return new BPromise(function(_0x4be64a,_0x12ff71){var _0x4a29aa=util[_0xa1c5('0x8')](_0xa1c5('0x9'),HOST,_0x1c9aa6,module[_0xa1c5('0xa')][_0xa1c5('0x2')]);if(oldToken){_0x4a29aa=util[_0xa1c5('0x8')](_0xa1c5('0xb'),HOST,_0x1c9aa6,module[_0xa1c5('0xa')]['version'],oldToken);}var _0x12b22b={'uri':_0x4a29aa,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x12b22b)[_0xa1c5('0xc')](function(_0x3dda1d){_0x4be64a(_0x3dda1d);})[_0xa1c5('0xd')](function(_0x47592b){_0x12ff71(_0x47592b);});});}function manageLicense(_0x8b2f36,_0x12ef99){var _0x4fb0e7=_0x12ef99[_0xa1c5('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x4fb0e7[_0xa1c5('0xf')]!==_0x8b2f36&&!_0x4fb0e7['data2']){oldToken=_0x4fb0e7['data1'];}httpRequest(_0x8b2f36)[_0xa1c5('0xc')](function(_0x6aabc4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x6aabc4[_0xa1c5('0x10')]){isOldTokenSent=![];if(!_0x4fb0e7[_0xa1c5('0x6')]&&_0x4fb0e7[_0xa1c5('0x6')]!=_0x6aabc4[_0xa1c5('0x6')]||_0x4fb0e7['license']&&_0x4fb0e7[_0xa1c5('0x11')]){logger[_0xa1c5('0x12')](_0xa1c5('0x13'));}if(_0x4fb0e7['license']&&!_0x4fb0e7[_0xa1c5('0x11')]&&_0x4fb0e7[_0xa1c5('0x6')]!=_0x6aabc4[_0xa1c5('0x6')]){logger['info'](_0xa1c5('0x14'));}if(_0x4fb0e7[_0xa1c5('0x6')]&&!_0x4fb0e7[_0xa1c5('0x11')]&&_0x4fb0e7[_0xa1c5('0x6')]==_0x6aabc4['license']){return _0x12ef99;}return _0x12ef99[_0xa1c5('0x15')]({'data1':_0x8b2f36,'data2':null,'license':_0x6aabc4[_0xa1c5('0x6')]});}else{if(_0x6aabc4[_0xa1c5('0x6')]||_0x4fb0e7[_0xa1c5('0x6')]){if(!_0x4fb0e7[_0xa1c5('0x11')]){if(_0x4fb0e7['data1']==_0x8b2f36){GRAY_PERIOD_REASON=_0xa1c5('0x16');logger[_0xa1c5('0x12')](_0xa1c5('0x17'));}else{GRAY_PERIOD_REASON=_0xa1c5('0x18');logger[_0xa1c5('0x12')](_0xa1c5('0x19'),_0x4fb0e7['data1'],_0x8b2f36);}logger['info'](_0xa1c5('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xa1c5('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x12ef99[_0xa1c5('0x15')]({'data2':encryptor[_0xa1c5('0x1b')](moment()['format'](_0xa1c5('0x1c')))});}else{if(moment()['diff'](encryptor[_0xa1c5('0x1d')](_0x4fb0e7['data2']),_0xa1c5('0x1e'))>DAYS){logger[_0xa1c5('0x12')](_0xa1c5('0x1f'),moment()[_0xa1c5('0x8')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x12ef99[_0xa1c5('0x15')]({'data1':_0x8b2f36,'data2':null,'license':null});}}}else{if(_0x4fb0e7['data1']!=_0x8b2f36){logger[_0xa1c5('0x12')](_0xa1c5('0x19'),_0x4fb0e7['data1'],_0x8b2f36);return _0x12ef99[_0xa1c5('0x15')]({'data1':_0x8b2f36,'data2':null,'license':null});}}}return _0x12ef99;})['then'](function(_0x2b16e2){_0x12ef99=_0x2b16e2;})[_0xa1c5('0xd')](function(_0xbfea6e){logger[_0xa1c5('0x20')](_0xbfea6e[_0xa1c5('0x21')]);})[_0xa1c5('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xa1c5('0x23')](),_0x12ef99);},TIME);});}function defaultLicense(){var _0x55c586=hardware[_0xa1c5('0x23')]();if(_0x55c586){return db['License'][_0xa1c5('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x55c586}})[_0xa1c5('0x25')](function(_0x3917a7,_0x39da08){logger[_0xa1c5('0x12')](_0xa1c5('0x26'),_0x55c586);manageLicense(_0x55c586,_0x3917a7);})[_0xa1c5('0xd')](function(_0x394339){logger[_0xa1c5('0x20')](_0x394339[_0xa1c5('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x50b8=['request-promise','bluebird','pkginfo','version','../../mysqldb','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment'];(function(_0x9cd01b,_0x568ca3){var _0x51cd28=function(_0xee7454){while(--_0xee7454){_0x9cd01b['push'](_0x9cd01b['shift']());}};_0x51cd28(++_0x568ca3);}(_0x50b8,0x108));var _0x850b=function(_0x29ea76,_0x48d7f6){_0x29ea76=_0x29ea76-0x0;var _0x475d30=_0x50b8[_0x29ea76];return _0x475d30;};'use strict';var util=require(_0x850b('0x0'));var moment=require(_0x850b('0x1'));var rp=require(_0x850b('0x2'));var BPromise=require(_0x850b('0x3'));var pkginfo=require(_0x850b('0x4'))(module,_0x850b('0x5'));var db=require(_0x850b('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require('../logger')(_0x850b('0x7'));var HOST=_0x850b('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5e5f90){return new BPromise(function(_0x1a2e44,_0x92e4b4){var _0x5d54dd=util[_0x850b('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x5e5f90,module[_0x850b('0xa')][_0x850b('0x5')]);if(oldToken){_0x5d54dd=util[_0x850b('0x9')](_0x850b('0xb'),HOST,_0x5e5f90,module[_0x850b('0xa')][_0x850b('0x5')],oldToken);}var _0x351f2c={'uri':_0x5d54dd,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x351f2c)[_0x850b('0xc')](function(_0x4c1958){_0x1a2e44(_0x4c1958);})[_0x850b('0xd')](function(_0x152b53){_0x92e4b4(_0x152b53);});});}function manageLicense(_0x44dd17,_0x3a8a6e){var _0x4c4db5=_0x3a8a6e[_0x850b('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x4c4db5[_0x850b('0xf')]!==_0x44dd17&&!_0x4c4db5[_0x850b('0x10')]){oldToken=_0x4c4db5[_0x850b('0xf')];}httpRequest(_0x44dd17)[_0x850b('0xc')](function(_0x4ad249){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4ad249[_0x850b('0x11')]){isOldTokenSent=![];if(!_0x4c4db5['license']&&_0x4c4db5[_0x850b('0x7')]!=_0x4ad249[_0x850b('0x7')]||_0x4c4db5[_0x850b('0x7')]&&_0x4c4db5[_0x850b('0x10')]){logger['info'](_0x850b('0x12'));}if(_0x4c4db5['license']&&!_0x4c4db5[_0x850b('0x10')]&&_0x4c4db5[_0x850b('0x7')]!=_0x4ad249[_0x850b('0x7')]){logger[_0x850b('0x13')](_0x850b('0x14'));}if(_0x4c4db5[_0x850b('0x7')]&&!_0x4c4db5['data2']&&_0x4c4db5[_0x850b('0x7')]==_0x4ad249['license']){return _0x3a8a6e;}return _0x3a8a6e[_0x850b('0x15')]({'data1':_0x44dd17,'data2':null,'license':_0x4ad249[_0x850b('0x7')]});}else{if(_0x4ad249[_0x850b('0x7')]||_0x4c4db5[_0x850b('0x7')]){if(!_0x4c4db5['data2']){if(_0x4c4db5[_0x850b('0xf')]==_0x44dd17){GRAY_PERIOD_REASON='Disabled';logger[_0x850b('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0x850b('0x16'),_0x4c4db5[_0x850b('0xf')],_0x44dd17);}logger[_0x850b('0x13')](_0x850b('0x17'),GRAY_PERIOD_REASON[_0x850b('0x18')](),moment()[_0x850b('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x3a8a6e[_0x850b('0x15')]({'data2':encryptor[_0x850b('0x19')](moment()[_0x850b('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x850b('0x1a')](encryptor[_0x850b('0x1b')](_0x4c4db5[_0x850b('0x10')]),'days')>DAYS){logger[_0x850b('0x13')](_0x850b('0x1c'),moment()['format'](_0x850b('0x1d')));isOldTokenSent=![];return _0x3a8a6e['update']({'data1':_0x44dd17,'data2':null,'license':null});}}}else{if(_0x4c4db5[_0x850b('0xf')]!=_0x44dd17){logger[_0x850b('0x13')](_0x850b('0x16'),_0x4c4db5[_0x850b('0xf')],_0x44dd17);return _0x3a8a6e[_0x850b('0x15')]({'data1':_0x44dd17,'data2':null,'license':null});}}}return _0x3a8a6e;})[_0x850b('0xc')](function(_0x2db24b){_0x3a8a6e=_0x2db24b;})[_0x850b('0xd')](function(_0xb07260){logger[_0x850b('0x1e')](_0xb07260[_0x850b('0x1f')]);})[_0x850b('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x850b('0x21')](),_0x3a8a6e);},TIME);});}function defaultLicense(){var _0x5dd0e3=hardware['getUuid']();if(_0x5dd0e3){return db[_0x850b('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x5dd0e3}})[_0x850b('0x23')](function(_0x659595,_0x2b029b){logger['info'](_0x850b('0x24'),_0x5dd0e3);manageLicense(_0x5dd0e3,_0x659595);})[_0x850b('0xd')](function(_0x3f63aa){logger[_0x850b('0x1e')](_0x3f63aa[_0x850b('0x1f')]);});}}exports[_0x850b('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6a7107e..27532f8 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 _0x8a61=['telephone','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','deadline','days','format','changed','disabled','message','User','findAll','sequelize','COUNT','role','count','admin','user'];(function(_0x3dae0d,_0x3ecfdb){var _0x1e7d06=function(_0x4312b2){while(--_0x4312b2){_0x3dae0d['push'](_0x3dae0d['shift']());}};_0x1e7d06(++_0x3ecfdb);}(_0x8a61,0x1f4));var _0x18a6=function(_0x212e7a,_0x32e0d){_0x212e7a=_0x212e7a-0x0;var _0x445799=_0x8a61[_0x212e7a];return _0x445799;};'use strict';var util=require(_0x18a6('0x0'));var _=require(_0x18a6('0x1'));var moment=require(_0x18a6('0x2'));var BPromise=require(_0x18a6('0x3'));var hardware=require('./hardware');var encryptor=require(_0x18a6('0x4'));var db=require(_0x18a6('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x18a6('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x18a6('0x7'),'machineUuid':hardware[_0x18a6('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x18a6('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x18a6('0x9'),'machineUuid':hardware[_0x18a6('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x528e5a){return new BPromise(function(_0x523824,_0x3d8213){return db[_0x18a6('0xa')][_0x18a6('0xb')](_[_0x18a6('0xc')](_0x528e5a,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x222300){return checkLicense(_0x222300,null);})[_0x18a6('0xd')](function(_0x5a7e2a){_0x523824(_0x5a7e2a);return;})[_0x18a6('0xe')](function(_0x8a13bd){_0x3d8213(_0x8a13bd);});});}function checkLicense(_0x5eb7ed,_0x184b5e){if(!_0x5eb7ed){demoLicense[_0x18a6('0xf')]=_0x5eb7ed[_0x18a6('0x10')];return demoLicense;}try{var _0x521f14=_0x184b5e||_0x5eb7ed['license'];if(_['isEmpty'](_0x521f14)){throw new Error(_0x18a6('0x11'));}var _0x14e7e1=_0x5eb7ed[_0x18a6('0x10')];var _0x48528d=_0x5eb7ed[_0x18a6('0x12')];var _0x566f82=_0x14e7e1[_0x18a6('0x13')]('-')[0x4];var _0x597a8a=_0x14e7e1['split']('-')[0x0];var _0x1638fe=encryptor['decryptString'](_0x521f14,util['format'](_0x18a6('0x14'),_0x566f82,_0x14e7e1,_0x597a8a));var _0x533b5a=JSON[_0x18a6('0x15')](_0x1638fe);_0x533b5a[_0x18a6('0x16')]=![];_0x533b5a[_0x18a6('0xf')]=_0x14e7e1;_0x533b5a[_0x18a6('0x17')]=hardware['getUuid']();if(_0x48528d){var _0x29482a=encryptor[_0x18a6('0x18')](_0x48528d);_0x533b5a[_0x18a6('0x19')]=_0x29482a;_0x533b5a[_0x18a6('0x1a')]=moment(_0x29482a)['add'](0x7,_0x18a6('0x1b'))[_0x18a6('0x1c')]();_0x533b5a['grayReason']=_0x533b5a['uuid']!=_0x533b5a[_0x18a6('0x17')]?_0x18a6('0x1d'):_0x18a6('0x1e');}return _0x533b5a;}catch(_0x27a7a6){breakingLicense[_0x18a6('0xf')]=_0x5eb7ed['data1'];breakingLicense[_0x18a6('0x1f')]=_0x27a7a6[_0x18a6('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x303ef5,_0x585487){getLicense()[_0x18a6('0xd')](function(_0x1f4d03){return db[_0x18a6('0x20')][_0x18a6('0x21')]({'attributes':['role',[db[_0x18a6('0x22')]['fn'](_0x18a6('0x23'),db[_0x18a6('0x22')]['col'](_0x18a6('0x24'))),_0x18a6('0x25')]],'group':_0x18a6('0x24'),'where':{'role':{'$or':[_0x18a6('0x26'),_0x18a6('0x27'),_0x18a6('0x28')]}},'raw':!![]})[_0x18a6('0xd')](function(_0x1129fd){var _0x45ac50={'user':_0x1f4d03['users']||0x0,'telephone':_0x1f4d03['telephones']||0x0};_0x1129fd['forEach'](function(_0x1c64b7){var _0x180ada=_0x1c64b7[_0x18a6('0x24')]===_0x18a6('0x26')?_0x18a6('0x27'):_0x1c64b7[_0x18a6('0x24')];_0x45ac50[_0x180ada]-=_0x1c64b7[_0x18a6('0x25')];if(_0x45ac50[_0x180ada]<0x0)_0x45ac50[_0x180ada]=0x0;});_0x303ef5(_0x45ac50);return;});})[_0x18a6('0xe')](function(_0x12d275){_0x585487(_0x12d275);});});}function checkUserLimits(_0x5d2038){return new BPromise(function(_0x4cc22d,_0xe38499){getLimits()['then'](function(_0x46d7ae){var _0x3d22fc=_[_0x18a6('0x29')](_[_0x18a6('0x2a')](_0x5d2038,_0x18a6('0x24')),[_0x18a6('0x26'),_0x18a6('0x27'),'telephone']);var _0x3e57e1=(_0x3d22fc[_0x18a6('0x26')]||0x0)+(_0x3d22fc[_0x18a6('0x27')]||0x0);var _0x2e9dfd=_0x3d22fc[_0x18a6('0x28')]||0x0;if(_0x3e57e1>_0x46d7ae[_0x18a6('0x27')])return _0xe38499(_0x18a6('0x2b'));if(_0x2e9dfd>_0x46d7ae['telephone'])return _0xe38499('License\x20limit\x20reached\x20for\x20telephones');return _0x4cc22d();})[_0x18a6('0xe')](function(_0x651bfc){_0xe38499(_0x651bfc);});});}module[_0x18a6('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xb62b=['catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid','getUuid','gray','deadline','add','days','format','grayReason','disabled','User','role','sequelize','COUNT','count','admin','user','telephone','users','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','find','then'];(function(_0x414166,_0x5e87f3){var _0x373505=function(_0x1cd5b1){while(--_0x1cd5b1){_0x414166['push'](_0x414166['shift']());}};_0x373505(++_0x5e87f3);}(_0xb62b,0x9f));var _0xbb62=function(_0x732f5,_0x309d36){_0x732f5=_0x732f5-0x0;var _0x19c049=_0xb62b[_0x732f5];return _0x19c049;};'use strict';var util=require(_0xbb62('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xbb62('0x1'));var hardware=require(_0xbb62('0x2'));var encryptor=require(_0xbb62('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbb62('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbb62('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbb62('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x585443){return new BPromise(function(_0x10da28,_0x45e6b7){return db['License'][_0xbb62('0x7')](_['defaults'](_0x585443,{'raw':!![],'where':{'id':0x1}}))[_0xbb62('0x8')](function(_0x4bcded){return checkLicense(_0x4bcded,null);})['then'](function(_0x599980){_0x10da28(_0x599980);return;})[_0xbb62('0x9')](function(_0x1e5417){_0x45e6b7(_0x1e5417);});});}function checkLicense(_0x28932c,_0x220602){if(!_0x28932c){demoLicense[_0xbb62('0xa')]=_0x28932c[_0xbb62('0xb')];return demoLicense;}try{var _0x551759=_0x220602||_0x28932c[_0xbb62('0xc')];if(_['isEmpty'](_0x551759)){throw new Error(_0xbb62('0xd'));}var _0x3b6ae3=_0x28932c[_0xbb62('0xb')];var _0x2ef0c6=_0x28932c[_0xbb62('0xe')];var _0x5c94e6=_0x3b6ae3[_0xbb62('0xf')]('-')[0x4];var _0x48ff6c=_0x3b6ae3[_0xbb62('0xf')]('-')[0x0];var _0x1b439e=encryptor[_0xbb62('0x10')](_0x551759,util['format'](_0xbb62('0x11'),_0x5c94e6,_0x3b6ae3,_0x48ff6c));var _0x1981a7=JSON[_0xbb62('0x12')](_0x1b439e);_0x1981a7[_0xbb62('0x13')]=![];_0x1981a7[_0xbb62('0xa')]=_0x3b6ae3;_0x1981a7[_0xbb62('0x14')]=hardware[_0xbb62('0x15')]();if(_0x2ef0c6){var _0x2fa5e2=encryptor[_0xbb62('0x10')](_0x2ef0c6);_0x1981a7[_0xbb62('0x16')]=_0x2fa5e2;_0x1981a7[_0xbb62('0x17')]=moment(_0x2fa5e2)[_0xbb62('0x18')](0x7,_0xbb62('0x19'))[_0xbb62('0x1a')]();_0x1981a7[_0xbb62('0x1b')]=_0x1981a7[_0xbb62('0xa')]!=_0x1981a7[_0xbb62('0x14')]?'changed':_0xbb62('0x1c');}return _0x1981a7;}catch(_0x5d8d69){breakingLicense[_0xbb62('0xa')]=_0x28932c[_0xbb62('0xb')];breakingLicense['message']=_0x5d8d69['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x31659a,_0x3ca51b){getLicense()[_0xbb62('0x8')](function(_0x17631f){return db[_0xbb62('0x1d')]['findAll']({'attributes':[_0xbb62('0x1e'),[db[_0xbb62('0x1f')]['fn'](_0xbb62('0x20'),db[_0xbb62('0x1f')]['col'](_0xbb62('0x1e'))),_0xbb62('0x21')]],'group':_0xbb62('0x1e'),'where':{'role':{'$or':[_0xbb62('0x22'),_0xbb62('0x23'),_0xbb62('0x24')]}},'raw':!![]})['then'](function(_0x144e49){var _0x458e9d={'user':_0x17631f[_0xbb62('0x25')]||0x0,'telephone':_0x17631f['telephones']||0x0};_0x144e49['forEach'](function(_0x212f4a){var _0x346495=_0x212f4a[_0xbb62('0x1e')]===_0xbb62('0x22')?'user':_0x212f4a[_0xbb62('0x1e')];_0x458e9d[_0x346495]-=_0x212f4a['count'];if(_0x458e9d[_0x346495]<0x0)_0x458e9d[_0x346495]=0x0;});_0x31659a(_0x458e9d);return;});})[_0xbb62('0x9')](function(_0x4b8c35){_0x3ca51b(_0x4b8c35);});});}function checkUserLimits(_0x2b2726){return new BPromise(function(_0x2ac12b,_0x19c0b8){getLimits()[_0xbb62('0x8')](function(_0x5a387f){var _0x4b9b7b=_[_0xbb62('0x26')](_[_0xbb62('0x27')](_0x2b2726,'role'),[_0xbb62('0x22'),_0xbb62('0x23'),_0xbb62('0x24')]);var _0x5c04cb=(_0x4b9b7b[_0xbb62('0x22')]||0x0)+(_0x4b9b7b[_0xbb62('0x23')]||0x0);var _0x5ca1d0=_0x4b9b7b[_0xbb62('0x24')]||0x0;if(_0x5c04cb>_0x5a387f[_0xbb62('0x23')])return _0x19c0b8(_0xbb62('0x28'));if(_0x5ca1d0>_0x5a387f[_0xbb62('0x24')])return _0x19c0b8('License\x20limit\x20reached\x20for\x20telephones');return _0x2ac12b();})[_0xbb62('0x9')](function(_0x287f86){_0x19c0b8(_0x287f86);});});}module[_0xbb62('0x29')]={'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 c661081..6dd3cfa 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 _0xfb11=['exports','myappanuglar-secret','app-id'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xfb11[_0x550d12];return _0x12103d;};'use strict';module[_0x1fb1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1fb1('0x1'),'GOOGLE_ID':_0x1fb1('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x236c=['secret','exports','myappanuglar-secret','app-id'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x236c,0x155));var _0xc236=function(_0x873f52,_0x8ae80b){_0x873f52=_0x873f52-0x0;var _0x28a83e=_0x236c[_0x873f52];return _0x28a83e;};'use strict';module[_0xc236('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xc236('0x1'),'GOOGLE_ID':_0xc236('0x2'),'GOOGLE_SECRET':_0xc236('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1977fef..65b5a3b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26b5=['fileLogger','exports'];(function(_0x1f2c8c,_0x14e047){var _0x15086b=function(_0x406d4e){while(--_0x406d4e){_0x1f2c8c['push'](_0x1f2c8c['shift']());}};_0x15086b(++_0x14e047);}(_0x26b5,0x1d6));var _0x526b=function(_0x356123,_0x5c816f){_0x356123=_0x356123-0x0;var _0xc89fd9=_0x26b5[_0x356123];return _0xc89fd9;};'use strict';var fileLogger=require('../utils/loggers')[_0x526b('0x0')];module[_0x526b('0x1')]=fileLogger; \ No newline at end of file +'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 4c41915..a848f4b 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 _0xc4a3=['exports','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0xafa225,_0xd29c03){var _0x4f546a=function(_0x565b3f){while(--_0x565b3f){_0xafa225['push'](_0xafa225['shift']());}};_0x4f546a(++_0xd29c03);}(_0xc4a3,0x1dd));var _0x3c4a=function(_0x8ae1c9,_0x1c61ab){_0x8ae1c9=_0x8ae1c9-0x0;var _0x18b221=_0xc4a3[_0x8ae1c9];return _0x18b221;};'use strict';var path=require('path');var cfg=require(_0x3c4a('0x0'));var env={'NODE_PATH':path[_0x3c4a('0x1')](path[_0x3c4a('0x2')](cfg[_0x3c4a('0x3')],_0x3c4a('0x4')))};var pm2config={'apps':[{'name':_0x3c4a('0x5'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0x6')),'env':env},{'name':_0x3c4a('0x7'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0x8')),'env':env},{'name':'agi','script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0x9')),'env':env},{'name':_0x3c4a('0xa'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0xb')),'env':env},{'name':_0x3c4a('0xc'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0xd')),'env':env},{'name':_0x3c4a('0xe'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0xf')),'env':env}]};module[_0x3c4a('0x10')]=pm2config; \ No newline at end of file +var _0x058d=['exports','path','join','root','express','../../services/express/index.js','agi','email','../../services/email/index.js','routing','../../services/xdr/index.js'];(function(_0x11bd37,_0xe5ba1){var _0x15be3=function(_0xc825f3){while(--_0xc825f3){_0x11bd37['push'](_0x11bd37['shift']());}};_0x15be3(++_0xe5ba1);}(_0x058d,0x11f));var _0xd058=function(_0x270130,_0x384df3){_0x270130=_0x270130-0x0;var _0x268659=_0x058d[_0x270130];return _0x268659;};'use strict';var path=require(_0xd058('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path[_0xd058('0x1')](cfg[_0xd058('0x2')],'legacy-libs'))};var pm2config={'apps':[{'name':_0xd058('0x3'),'script':path['join'](__dirname,_0xd058('0x4')),'env':env},{'name':'ami','script':path[_0xd058('0x1')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xd058('0x5'),'script':path[_0xd058('0x1')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xd058('0x6'),'script':path[_0xd058('0x1')](__dirname,_0xd058('0x7')),'env':env},{'name':_0xd058('0x8'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path[_0xd058('0x1')](__dirname,_0xd058('0x9')),'env':env}]};module[_0xd058('0xa')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e87ce1c..22743a9 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 _0x99a0=['delete','dump','pm2','bluebird','connected','then','start','disconnect','stop','restart','list','describe'];(function(_0x2d6726,_0x5bdc68){var _0x156978=function(_0x104163){while(--_0x104163){_0x2d6726['push'](_0x2d6726['shift']());}};_0x156978(++_0x5bdc68);}(_0x99a0,0x9e));var _0x099a=function(_0x1e0d90,_0x379210){_0x1e0d90=_0x1e0d90-0x0;var _0x5efe91=_0x99a0[_0x1e0d90];return _0x5efe91;};'use strict';var pm2=require(_0x099a('0x0'));var BPromise=require(_0x099a('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x1217f1,_0x324516){return pm2['connect'](function(_0x1a05ad){if(_0x1a05ad){return _0x324516(_0x1a05ad);}return _0x1217f1(_0x099a('0x2'));});});};exports['start']=function(_0xa411d3){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x2594e0,_0x3c4389){return pm2[_0x099a('0x4')](_0xa411d3,function(_0x1af84e,_0x30c92e){if(_0x1af84e){return _0x3c4389(_0x1af84e);}pm2[_0x099a('0x5')]();return _0x2594e0(_0x30c92e);});});});};exports[_0x099a('0x6')]=function(_0x412028){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x5cc427,_0x3b141b){return pm2[_0x099a('0x6')](_0x412028,function(_0x48a676,_0x7f1dbe){if(_0x48a676){return _0x3b141b(_0x48a676);}pm2['disconnect']();return _0x5cc427(_0x7f1dbe);});});});};exports[_0x099a('0x7')]=function(_0x4438ca){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x50b948,_0xe20ef7){return pm2[_0x099a('0x7')](_0x4438ca,function(_0x3b6441,_0x48d0d4){if(_0x3b6441){return _0xe20ef7(_0x3b6441);}pm2[_0x099a('0x5')]();return _0x50b948(_0x48d0d4);});});});};exports[_0x099a('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x387714,_0x250c69){return pm2['list'](function(_0x4437bf,_0x3213a6){if(_0x4437bf){return _0x250c69(_0x4437bf);}pm2['disconnect']();return _0x387714(_0x3213a6);});});});};exports[_0x099a('0x9')]=function(_0x5b1647){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x299b4b,_0x2138c0){return pm2['describe'](_0x5b1647,function(_0x4c7f8a,_0x379c72){if(_0x4c7f8a){return _0x2138c0(_0x4c7f8a);}pm2['disconnect']();return _0x299b4b(_0x379c72);});});});};exports[_0x099a('0xa')]=function(_0x2019aa){return connect()['then'](function(){return new BPromise(function(_0x476fbd,_0x3855f9){return pm2[_0x099a('0xa')](_0x2019aa,function(_0xa0b020,_0x4254c6){if(_0xa0b020){return _0x3855f9(_0xa0b020);}pm2['disconnect']();return _0x476fbd(_0x4254c6);});});});};exports[_0x099a('0xb')]=function(){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x4ec0fc,_0x29d411){return pm2[_0x099a('0xb')](function(_0x3c513c){if(_0x3c513c){return _0x29d411(_0x3c513c);}return _0x4ec0fc('saved');});});});}; \ No newline at end of file +var _0x6f93=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x28d9bf,_0x48f6ae){var _0x1cb7eb=function(_0x2e8fe8){while(--_0x2e8fe8){_0x28d9bf['push'](_0x28d9bf['shift']());}};_0x1cb7eb(++_0x48f6ae);}(_0x6f93,0x84));var _0x36f9=function(_0x15c830,_0x1e7a57){_0x15c830=_0x15c830-0x0;var _0xb2ca14=_0x6f93[_0x15c830];return _0xb2ca14;};'use strict';var pm2=require(_0x36f9('0x0'));var BPromise=require(_0x36f9('0x1'));var config=require(_0x36f9('0x2'));function connect(){return new BPromise(function(_0x744cd7,_0x9f93a1){return pm2[_0x36f9('0x3')](function(_0x4a1bc0){if(_0x4a1bc0){return _0x9f93a1(_0x4a1bc0);}return _0x744cd7(_0x36f9('0x4'));});});};exports[_0x36f9('0x5')]=function(_0x1f413c){return connect()[_0x36f9('0x6')](function(){return new BPromise(function(_0x584e68,_0x4028d4){return pm2[_0x36f9('0x5')](_0x1f413c,function(_0x1946d4,_0x3f9fee){if(_0x1946d4){return _0x4028d4(_0x1946d4);}pm2[_0x36f9('0x7')]();return _0x584e68(_0x3f9fee);});});});};exports[_0x36f9('0x8')]=function(_0x45e101){return connect()[_0x36f9('0x6')](function(){return new BPromise(function(_0x17aa95,_0x597c73){return pm2['stop'](_0x45e101,function(_0x50debc,_0x114261){if(_0x50debc){return _0x597c73(_0x50debc);}pm2[_0x36f9('0x7')]();return _0x17aa95(_0x114261);});});});};exports[_0x36f9('0x9')]=function(_0xe91520){return connect()['then'](function(){return new BPromise(function(_0x1ca58a,_0x5527f7){return pm2[_0x36f9('0x9')](_0xe91520,function(_0x36201b,_0x12ba18){if(_0x36201b){return _0x5527f7(_0x36201b);}pm2[_0x36f9('0x7')]();return _0x1ca58a(_0x12ba18);});});});};exports['list']=function(){return connect()[_0x36f9('0x6')](function(){return new BPromise(function(_0x97507c,_0x4c67ac){return pm2[_0x36f9('0xa')](function(_0xa20fcb,_0xcfa91a){if(_0xa20fcb){return _0x4c67ac(_0xa20fcb);}pm2[_0x36f9('0x7')]();return _0x97507c(_0xcfa91a);});});});};exports[_0x36f9('0xb')]=function(_0x36ad18){return connect()[_0x36f9('0x6')](function(){return new BPromise(function(_0x2e8aa9,_0x57e26d){return pm2[_0x36f9('0xb')](_0x36ad18,function(_0x314689,_0x2b51e2){if(_0x314689){return _0x57e26d(_0x314689);}pm2[_0x36f9('0x7')]();return _0x2e8aa9(_0x2b51e2);});});});};exports[_0x36f9('0xc')]=function(_0x289dd9){return connect()[_0x36f9('0x6')](function(){return new BPromise(function(_0x119032,_0x1c5266){return pm2['delete'](_0x289dd9,function(_0x2ca735,_0x7dff85){if(_0x2ca735){return _0x1c5266(_0x2ca735);}pm2[_0x36f9('0x7')]();return _0x119032(_0x7dff85);});});});};exports[_0x36f9('0xd')]=function(){return connect()[_0x36f9('0x6')](function(){return new BPromise(function(_0x232f18,_0x2dd0cd){return pm2[_0x36f9('0xd')](function(_0x4e882d){if(_0x4e882d){return _0x2dd0cd(_0x4e882d);}return _0x232f18(_0x36f9('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 8eff55b..d98e50d 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 _0xaf3e=['then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','timeout','format','emit','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','Setting','chatTimeout'];(function(_0x38485f,_0x61ffb1){var _0x3f6813=function(_0x38bc83){while(--_0x38bc83){_0x38485f['push'](_0x38485f['shift']());}};_0x3f6813(++_0x61ffb1);}(_0xaf3e,0x1ed));var _0xeaf3=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xaf3e[_0x3f7598];return _0x51fb16;};'use strict';var _=require('lodash');var moment=require(_0xeaf3('0x0'));var Redis=require(_0xeaf3('0x1'));var util=require(_0xeaf3('0x2'));var config=require(_0xeaf3('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xeaf3('0x4'))(_0xeaf3('0x5'));config[_0xeaf3('0x6')]=_['defaults'](config[_0xeaf3('0x6')],{'host':_0xeaf3('0x7'),'port':0x18eb});var io=require(_0xeaf3('0x8'))(new Redis(config[_0xeaf3('0x6')]));function closeInteractions(){var _0x50f2b6=0x0;var _0x493a87=[];return db[_0xeaf3('0x9')]['find']({'raw':!![],'attributes':['id',_0xeaf3('0xa')],'where':{'id':0x1}})[_0xeaf3('0xb')](function(_0x27e660){_0x50f2b6=_0x27e660[_0xeaf3('0xa')];if(_0x50f2b6){return db[_0xeaf3('0xc')][_0xeaf3('0xd')]({'raw':!![],'attributes':['id',_0xeaf3('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xeaf3('0xf')](_0x27e660[_0xeaf3('0xa')],_0xeaf3('0x10'))}}});}else{return[];}})[_0xeaf3('0xb')](function(_0x3b2055){if(_0x3b2055&&_0x3b2055[_0xeaf3('0x11')]){_0x493a87=_[_0xeaf3('0x12')](_0x3b2055||[],'id');logger[_0xeaf3('0x13')](_0xeaf3('0x14'),_0x493a87['join']());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0xeaf3('0x15'),'closed':!![],'closedAt':moment()[_0xeaf3('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x493a87}});}})[_0xeaf3('0xb')](function(){if(_0x493a87&&_0x493a87[_0xeaf3('0x11')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x493a87['join']());for(var _0x7deac3=0x0;_0x7deac3<_0x493a87[_0xeaf3('0x11')];_0x7deac3++){io[_0xeaf3('0x17')]('chatInteraction:update',{'id':_0x493a87[_0x7deac3],'closed':!![]});}}})['catch'](function(_0x40c09e){logger[_0xeaf3('0x18')](_0xeaf3('0x19'),_0x40c09e?util[_0xeaf3('0x1a')](_0x40c09e,{'showHidden':![],'depth':null}):'');});}exports[_0xeaf3('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3db5=['../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','Setting','find','chatTimeout','findAll','lastMsgAt','minutes','then','info','join','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis'];(function(_0x3c1c57,_0x23297c){var _0x155573=function(_0x52b7a0){while(--_0x52b7a0){_0x3c1c57['push'](_0x3c1c57['shift']());}};_0x155573(++_0x23297c);}(_0x3db5,0x93));var _0x53db=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0x3db5[_0xa4928c];return _0x27cc29;};'use strict';var _=require(_0x53db('0x0'));var moment=require(_0x53db('0x1'));var Redis=require(_0x53db('0x2'));var util=require('util');var config=require(_0x53db('0x3'));var db=require(_0x53db('0x4'))['db'];var logger=require(_0x53db('0x5'))(_0x53db('0x6'));config[_0x53db('0x7')]=_['defaults'](config[_0x53db('0x7')],{'host':_0x53db('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x53db('0x7')]));function closeInteractions(){var _0x3dacb5=0x0;var _0x150360=[];return db[_0x53db('0x9')][_0x53db('0xa')]({'raw':!![],'attributes':['id',_0x53db('0xb')],'where':{'id':0x1}})['then'](function(_0x5048c5){_0x3dacb5=_0x5048c5[_0x53db('0xb')];if(_0x3dacb5){return db['ChatInteraction'][_0x53db('0xc')]({'raw':!![],'attributes':['id',_0x53db('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5048c5['chatTimeout'],_0x53db('0xe'))}}});}else{return[];}})[_0x53db('0xf')](function(_0x323290){if(_0x323290&&_0x323290['length']){_0x150360=_['map'](_0x323290||[],'id');logger[_0x53db('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x150360[_0x53db('0x11')]());return db[_0x53db('0x12')][_0x53db('0x13')]({'closeReason':_0x53db('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x53db('0x15')](_0x53db('0x16'))},{'where':{'id':_0x150360}});}})[_0x53db('0xf')](function(){if(_0x150360&&_0x150360[_0x53db('0x17')]){logger[_0x53db('0x10')](_0x53db('0x18'),_0x150360[_0x53db('0x11')]());for(var _0x475015=0x0;_0x475015<_0x150360[_0x53db('0x17')];_0x475015++){io['emit']('chatInteraction:update',{'id':_0x150360[_0x475015],'closed':!![]});}}})[_0x53db('0x19')](function(_0x35f07b){logger[_0x53db('0x1a')](_0x53db('0x1b'),_0x35f07b?util[_0x53db('0x1c')](_0x35f07b,{'showHidden':![],'depth':null}):'');});}exports[_0x53db('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index c84bdf9..82678aa 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 _0x8b71=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x39157f,_0x3d8c1e){var _0x1ae4e2=function(_0x3429af){while(--_0x3429af){_0x39157f['push'](_0x39157f['shift']());}};_0x1ae4e2(++_0x3d8c1e);}(_0x8b71,0x13b));var _0x18b7=function(_0x35e169,_0x3e6b0f){_0x35e169=_0x35e169-0x0;var _0xf0313b=_0x8b71[_0x35e169];return _0xf0313b;};'use strict';function start(){var _0x28d299=require(_0x18b7('0x0'));return _0x28d299[_0x18b7('0x1')]();}module[_0x18b7('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x0fcb=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0fcb,0x1cf));var _0xb0fc=function(_0x2bbc98,_0x809be8){_0x2bbc98=_0x2bbc98-0x0;var _0x4f4a90=_0x0fcb[_0x2bbc98];return _0x4f4a90;};'use strict';function start(){var _0x20bea3=require(_0xb0fc('0x0'));return _0x20bea3[_0xb0fc('0x1')]();}module[_0xb0fc('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5f9da46..b6f454a 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 _0xdb75=['stop\x20cron','startAt','endAt','update','update\x20cron','run','util','path','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','then','catch','error','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','format','subtractUnit','join','savename','basename','extname','zip','existsSync','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20failed','Unrecognized\x20status:','entity','dataValues','attempt','report\x20status:','subtractNumber','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','intersection','difference','exists','delete\x20cron','length','resolve','run\x20job','cron','active','isBetween','start','add\x20cron','deleteJob'];(function(_0x3fc3c0,_0x313d37){var _0x16ed79=function(_0x5e25e6){while(--_0x5e25e6){_0x3fc3c0['push'](_0x3fc3c0['shift']());}};_0x16ed79(++_0x313d37);}(_0xdb75,0x144));var _0x5db7=function(_0x33f6ae,_0x499448){_0x33f6ae=_0x33f6ae-0x0;var _0x16ec5c=_0xdb75[_0x33f6ae];return _0x16ec5c;};'use strict';var fs=require('fs');var util=require(_0x5db7('0x0'));var path=require(_0x5db7('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x5db7('0x2'));var jayson=require(_0x5db7('0x3'));var BPromise=require(_0x5db7('0x4'));var logger=require(_0x5db7('0x5'))('schedule');var db=require(_0x5db7('0x6'))['db'];const retry=require(_0x5db7('0x7'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x5db7('0x8'));var client=jayson['client'][_0x5db7('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0xbe6527){const _0x3a105b={};if(typeof _0xbe6527===_0x5db7('0xa')){_0x3a105b['id']=_0xbe6527;}return db['AnalyticExtractedReport']['findOne']({'where':_0x3a105b})[_0x5db7('0xb')](function(_0x57d816){return _0x57d816;})[_0x5db7('0xc')](function(_0x2c57ce){logger[_0x5db7('0xd')](_0x2c57ce);});}function handleSendEmail(_0x14828e,_0x5ebcbe){logger['info'](_0x5db7('0xe'),_0x14828e[_0x5db7('0xf')]);var _0x4bdd20=!![];var _0x19a72b=_0x14828e['MailAccount'][_0x5db7('0x10')]();var _0x4ff274={'account':_0x19a72b,'message':{'from':util['format'](_0x5db7('0x11'),_0x14828e[_0x5db7('0x12')][_0x5db7('0x13')],_0x14828e[_0x5db7('0x12')][_0x5db7('0xf')]||_0x14828e['MailAccount'][_0x5db7('0x14')][_0x5db7('0x15')]),'to':_0x14828e[_0x5db7('0xf')],'cc':_0x14828e['cc'],'bcc':_0x14828e['bcc'],'subject':util[_0x5db7('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x5ebcbe[_0x5db7('0x13')],_0x14828e['subtractNumber'],_0x14828e[_0x5db7('0x17')])}};var _0x436da2=path[_0x5db7('0x18')](__dirname,'../../files/reports');var _0x1a4246=_0x5ebcbe[_0x5db7('0x19')];var _0x5ac52f=util[_0x5db7('0x16')]('%s.%s',path[_0x5db7('0x1a')](_0x5ebcbe[_0x5db7('0x19')],path[_0x5db7('0x1b')](_0x5ebcbe[_0x5db7('0x19')])),_0x5db7('0x1c'));var _0x4e3634=path[_0x5db7('0x18')](_0x436da2,_0x1a4246);var _0x56bc5f=path[_0x5db7('0x18')](_0x436da2,_0x5ac52f);if(fs[_0x5db7('0x1d')](_0x4e3634)){_0x5ebcbe['status']=_0x5db7('0x1e');_0x4ff274[_0x5db7('0x1f')]['attachments']=[{'filename':_0x1a4246,'path':_0x4e3634}];_0x4ff274['message'][_0x5db7('0x20')]=util[_0x5db7('0x16')](_0x5db7('0x21'),JSON[_0x5db7('0x22')](_0x5ebcbe,null,0x2));}else if(fs[_0x5db7('0x1d')](_0x56bc5f)){_0x5ebcbe['status']='Sent';_0x4ff274[_0x5db7('0x1f')][_0x5db7('0x23')]=[{'filename':_0x5ac52f,'path':_0x56bc5f}];}else{if(_0x5ebcbe[_0x5db7('0x24')]==='Empty'){_0x4ff274[_0x5db7('0x1f')][_0x5db7('0x20')]=_0x5db7('0x25');if(!_0x14828e[_0x5db7('0x26')]){_0x4bdd20=![];logger[_0x5db7('0x27')](_0x5db7('0x28'));}}else if(_0x5ebcbe[_0x5db7('0x24')]===_0x5db7('0x29')){_0x4ff274['message'][_0x5db7('0x20')]=_0x5db7('0x2a');}else if(_0x5ebcbe['status']===_0x5db7('0x2b')){_0x4ff274[_0x5db7('0x1f')][_0x5db7('0x20')]=_0x5db7('0x2c');}else if(_0x5ebcbe[_0x5db7('0x24')]===_0x5db7('0x2d')){_0x4ff274[_0x5db7('0x1f')][_0x5db7('0x20')]=_0x5db7('0x2e');}else{logger[_0x5db7('0xd')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x5ebcbe[_0x5db7('0x24')]);}}if(_0x4bdd20){return client['request'](_0x5db7('0x2f'),_0x4ff274)[_0x5db7('0xb')](function(_0xba410c){if(_0xba410c[_0x5db7('0xd')]){return logger[_0x5db7('0xd')](_0x5db7('0x30'),JSON[_0x5db7('0x22')](_0xba410c));}return logger[_0x5db7('0x27')](_0x5db7('0x31'));})['catch'](function(_0x15e9f7){return logger[_0x5db7('0xd')](_0x5db7('0x30'),JSON[_0x5db7('0x22')](_0x15e9f7));});}}function handleError(){return function(_0x261d53){return logger[_0x5db7('0xd')](JSON[_0x5db7('0x22')](_0x261d53));};}function loading(_0x2b9f41){logger[_0x5db7('0x27')](_0x5db7('0x32'));if(_0x2b9f41[_0x5db7('0x33')]===_0x2b9f41[_0x5db7('0x34')][_0x5db7('0x35')]){handleSendEmail(_0x2b9f41[_0x5db7('0x36')],_0x2b9f41[_0x5db7('0x37')]);_0x2b9f41[_0x5db7('0x38')][_0x5db7('0x39')]();}else{_0x2b9f41['operation'][_0x5db7('0x7')](_0x5db7('0x3a'));}}function completed(_0x556700){logger[_0x5db7('0x27')](_0x5db7('0x3b'));handleSendEmail(_0x556700[_0x5db7('0x36')],_0x556700[_0x5db7('0x37')]);_0x556700[_0x5db7('0x38')]['stop']();}function empty(_0x18ef03){logger['info']('case\x20empty');handleSendEmail(_0x18ef03[_0x5db7('0x36')],_0x18ef03[_0x5db7('0x37')]);_0x18ef03['operation'][_0x5db7('0x39')]();}function failed(_0x1aa0df){logger[_0x5db7('0x27')](_0x5db7('0x3c'));handleSendEmail(_0x1aa0df[_0x5db7('0x36')],_0x1aa0df['data']);_0x1aa0df[_0x5db7('0x38')][_0x5db7('0x39')]();}function urecognized(_0x19c5f6){logger[_0x5db7('0xd')](_0x5db7('0x3d'),_0x19c5f6[_0x5db7('0x3e')][_0x5db7('0x3f')][_0x5db7('0x24')]);_0x19c5f6['operation']['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x55c63f,_0x25f399){const _0x576c8c={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x2bc384=retry[_0x5db7('0x38')](_0x576c8c);_0x2bc384[_0x5db7('0x40')](_0xf2825c=>{logger[_0x5db7('0x27')]('Job\x20ID\x20'+_0x55c63f['id']+'\x20Attempt\x20#:'+_0xf2825c);try{getReportData(_0x25f399['id'])['then'](function(_0x5646e6){_0x25f399=_0x5646e6;logger[_0x5db7('0x27')](_0x5db7('0x41'),_0x5646e6['dataValues']['status']);if(!reportStatusStrategies[_0x5646e6[_0x5db7('0x3f')][_0x5db7('0x24')]]){logger[_0x5db7('0xd')](_0x5db7('0x41'),_0x5646e6[_0x5db7('0x3f')][_0x5db7('0x24')]);_0x2bc384[_0x5db7('0x7')]();}reportStatusStrategies[_0x5646e6[_0x5db7('0x3f')][_0x5db7('0x24')]]({'operation':_0x2bc384,'currentAttempt':_0xf2825c,'retryOptions':_0x576c8c,'job':_0x55c63f,'data':_0x25f399,'entity':_0x5646e6});});}catch(_0x10bed3){_0x2bc384[_0x5db7('0x7')](_0x10bed3);}});}function handleResult(_0x3bd4ef){return function(_0x187e92){if(_0x3bd4ef['sendMail']&&_0x3bd4ef[_0x5db7('0x12')]&&_0x3bd4ef['MailAccount'][_0x5db7('0x14')]&&!_['isNil'](_0x3bd4ef['email'])){retryer(_0x3bd4ef,_0x187e92);}};}function handleJob(_0x2ad740){return function(){try{if(_['isNil'](_0x2ad740[_0x5db7('0x42')])){return logger[_0x5db7('0x27')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x5db7('0x43')](_0x2ad740[_0x5db7('0x17')])){return logger[_0x5db7('0x27')](_0x5db7('0x44'));}var _0x54f499={'startDate':moment()[_0x5db7('0x45')](_0x2ad740[_0x5db7('0x42')],_0x2ad740['subtractUnit'])['format'](_0x5db7('0x46')),'endDate':moment()[_0x5db7('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x5db7('0x47'),'output':_0x2ad740[_0x5db7('0x48')],'name':_0x2ad740[_0x5db7('0x13')]};if(!_[_0x5db7('0x43')](_0x2ad740['DefaultReportId'])){logger[_0x5db7('0x27')](_0x5db7('0x49'),_0x2ad740['DefaultReportId']);return analyticDefaultReportController[_0x5db7('0x4a')]({'id':_0x2ad740[_0x5db7('0x4b')]},_0x54f499)[_0x5db7('0xb')](handleResult(_0x2ad740))[_0x5db7('0xc')](handleError());}if(!_[_0x5db7('0x43')](_0x2ad740['CustomReportId'])){logger[_0x5db7('0x27')]('exec\x20custom\x20report\x20id:%s',_0x2ad740[_0x5db7('0x4c')]);return analyticCustomReportController['runReport']({'id':_0x2ad740[_0x5db7('0x4c')]},_0x54f499)[_0x5db7('0xb')](handleResult(_0x2ad740))[_0x5db7('0xc')](handleError());}}catch(_0x122cec){logger[_0x5db7('0xd')](JSON[_0x5db7('0x22')](_0x122cec));}return logger[_0x5db7('0x27')](_0x5db7('0x4d'));};}function getJobs(_0x2f55f4){var _0x4257c3={};if(_0x2f55f4){_0x4257c3['id']=_0x2f55f4;}return db[_0x5db7('0x4e')][_0x5db7('0x4f')]({'where':_0x4257c3,'include':[{'model':db[_0x5db7('0x12')],'attributes':['id',_0x5db7('0x13'),_0x5db7('0xf')],'include':[{'model':db[_0x5db7('0x50')],'as':_0x5db7('0x14'),'include':[{'model':db[_0x5db7('0x51')],'as':_0x5db7('0x51')}]}]}]})[_0x5db7('0xb')](function(_0x38eaec){var _0x4014e4=_[_0x5db7('0x52')](manager[_0x5db7('0x53')]);var _0x2e5ae6=_[_0x5db7('0x54')](_0x38eaec,function(_0x4e5bfa){return _0x4e5bfa['id'][_0x5db7('0x55')]();});var _0x21646f=_[_0x5db7('0x56')](_0x38eaec,function(_0xc33f83){return _0xc33f83['id']['toString']();});var _0x59aefa=_0x2f55f4?_0x2e5ae6:_['difference'](_0x2e5ae6,_0x4014e4);var _0x33af22=_[_0x5db7('0x57')](_0x2e5ae6,_0x4014e4);var _0x437a28=_[_0x5db7('0x58')](_0x4014e4,_0x2e5ae6);var _0x3df4fd;var _0x5a3215;for(_0x3df4fd=0x0;_0x3df4fd<_0x437a28['length']&&!_0x2f55f4;_0x3df4fd+=0x1){_0x5a3215=_0x437a28[_0x3df4fd]['toString']();if(manager[_0x5db7('0x59')](_0x5a3215)){manager[_0x5db7('0x39')](_0x5a3215);manager['deleteJob'](_0x5a3215);logger[_0x5db7('0x27')](_0x5db7('0x5a'),_0x5a3215);}}logger[_0x5db7('0x27')]('toRun',JSON['stringify'](_0x59aefa));for(_0x3df4fd=0x0;_0x3df4fd<_0x59aefa[_0x5db7('0x5b')];_0x3df4fd+=0x1){_0x5a3215=_0x59aefa[_0x3df4fd][_0x5db7('0x55')]();if(_0x2f55f4){logger[_0x5db7('0x27')](JSON[_0x5db7('0x22')](_0x21646f[_0x5a3215]));BPromise[_0x5db7('0x5c')]()['then'](handleJob(_0x21646f[_0x5a3215]));logger[_0x5db7('0x27')](_0x5db7('0x5d'),_0x21646f[_0x5a3215][_0x5db7('0x13')],_0x21646f[_0x5a3215][_0x5db7('0x5e')]);}else if(_0x21646f[_0x5a3215]['cron']&&_0x21646f[_0x5a3215][_0x5db7('0x5f')]&&moment()[_0x5db7('0x60')](_0x21646f[_0x5a3215]['startAt'],_0x21646f[_0x5a3215]['endAt'])){manager['add'](_0x5a3215,_0x21646f[_0x5a3215][_0x5db7('0x5e')],handleJob(_0x21646f[_0x5a3215]));manager[_0x5db7('0x61')](_0x5a3215);logger[_0x5db7('0x27')](_0x5db7('0x62'),_0x21646f[_0x5a3215][_0x5db7('0x13')],_0x21646f[_0x5a3215]['cron']);}else if(manager[_0x5db7('0x59')](_0x5a3215)){manager[_0x5db7('0x39')](_0x5a3215);manager[_0x5db7('0x63')](_0x5a3215);logger[_0x5db7('0x27')](_0x5db7('0x64'),_0x21646f[_0x5a3215]['name'],_0x21646f[_0x5a3215][_0x5db7('0x5e')]);}}for(_0x3df4fd=0x0,_0x5a3215;_0x3df4fd<_0x33af22[_0x5db7('0x5b')]&&!_0x2f55f4;_0x3df4fd+=0x1){_0x5a3215=_0x33af22[_0x3df4fd][_0x5db7('0x55')]();if(manager['exists'](_0x5a3215)){if(_0x21646f[_0x5a3215]['cron']&&_0x21646f[_0x5a3215][_0x5db7('0x5f')]&&moment()[_0x5db7('0x60')](_0x21646f[_0x5a3215][_0x5db7('0x65')],_0x21646f[_0x5a3215][_0x5db7('0x66')])){manager[_0x5db7('0x67')](_0x5a3215,_0x21646f[_0x5a3215][_0x5db7('0x5e')],handleJob(_0x21646f[_0x5a3215]));logger[_0x5db7('0x27')](_0x5db7('0x68'),_0x21646f[_0x5a3215][_0x5db7('0x13')],_0x21646f[_0x5a3215][_0x5db7('0x5e')]);}else{manager[_0x5db7('0x39')](_0x5a3215);manager[_0x5db7('0x63')](_0x5a3215);logger[_0x5db7('0x27')]('stop\x20cron',_0x21646f[_0x5a3215][_0x5db7('0x13')],_0x21646f[_0x5a3215][_0x5db7('0x5e')]);}}}})['catch'](function(_0x5b8e00){logger[_0x5db7('0xd')](JSON[_0x5db7('0x22')](_0x5b8e00));});}exports[_0x5db7('0x69')]=function(_0x29b27c){return getJobs(_0x29b27c);};exports[_0x5db7('0x61')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe72e=['toRun','length','resolve','run\x20job','active','isBetween','endAt','add','cron','start','add\x20cron','stop\x20cron','startAt','update','update\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Sent','Empty','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','Loading','Completed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','stringify','email\x20sent','error\x20mail','case\x20loading','currentAttempt','retryOptions','data','stop','operation','still\x20loading','case\x20completed','job','case\x20empty','entity','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','dataValues','sendMail','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','exists','deleteJob'];(function(_0x31081f,_0x24916a){var _0x4cdd11=function(_0x38e782){while(--_0x38e782){_0x31081f['push'](_0x31081f['shift']());}};_0x4cdd11(++_0x24916a);}(_0xe72e,0xec));var _0xee72=function(_0x1949ac,_0x4a206e){_0x1949ac=_0x1949ac-0x0;var _0x7c5f8b=_0xe72e[_0x1949ac];return _0x7c5f8b;};'use strict';var fs=require('fs');var util=require(_0xee72('0x0'));var path=require(_0xee72('0x1'));var _=require('lodash');var moment=require(_0xee72('0x2'));var CronJobManager=require(_0xee72('0x3'));var jayson=require(_0xee72('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0xee72('0x5'));var db=require(_0xee72('0x6'))['db'];const retry=require(_0xee72('0x7'));var analyticCustomReportController=require(_0xee72('0x8'));var analyticDefaultReportController=require(_0xee72('0x9'));var client=jayson[_0xee72('0xa')][_0xee72('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x4d7b79){const _0x52352e={};if(typeof _0x4d7b79===_0xee72('0xc')){_0x52352e['id']=_0x4d7b79;}return db[_0xee72('0xd')]['findOne']({'where':_0x52352e})[_0xee72('0xe')](function(_0x39c6cb){return _0x39c6cb;})[_0xee72('0xf')](function(_0x144fdb){logger[_0xee72('0x10')](_0x144fdb);});}function handleSendEmail(_0x53b72b,_0x5b3a34){logger[_0xee72('0x11')](_0xee72('0x12'),_0x53b72b[_0xee72('0x13')]);var _0x1d5b52=!![];var _0x20552d=_0x53b72b[_0xee72('0x14')][_0xee72('0x15')]();var _0x32a8f9={'account':_0x20552d,'message':{'from':util['format'](_0xee72('0x16'),_0x53b72b['MailAccount'][_0xee72('0x17')],_0x53b72b[_0xee72('0x14')][_0xee72('0x13')]||_0x53b72b[_0xee72('0x14')][_0xee72('0x18')][_0xee72('0x19')]),'to':_0x53b72b['email'],'cc':_0x53b72b['cc'],'bcc':_0x53b72b[_0xee72('0x1a')],'subject':util[_0xee72('0x1b')](_0xee72('0x1c'),_0x5b3a34[_0xee72('0x17')],_0x53b72b[_0xee72('0x1d')],_0x53b72b[_0xee72('0x1e')])}};var _0x2244c8=path[_0xee72('0x1f')](__dirname,_0xee72('0x20'));var _0x211dde=_0x5b3a34[_0xee72('0x21')];var _0x2553b1=util[_0xee72('0x1b')](_0xee72('0x22'),path[_0xee72('0x23')](_0x5b3a34['savename'],path[_0xee72('0x24')](_0x5b3a34[_0xee72('0x21')])),'zip');var _0x2fc53c=path[_0xee72('0x1f')](_0x2244c8,_0x211dde);var _0x17f7f6=path[_0xee72('0x1f')](_0x2244c8,_0x2553b1);if(fs[_0xee72('0x25')](_0x2fc53c)){_0x5b3a34[_0xee72('0x26')]='Sent';_0x32a8f9[_0xee72('0x27')][_0xee72('0x28')]=[{'filename':_0x211dde,'path':_0x2fc53c}];_0x32a8f9[_0xee72('0x27')]['text']=util['format'](_0xee72('0x29'),JSON['stringify'](_0x5b3a34,null,0x2));}else if(fs[_0xee72('0x25')](_0x17f7f6)){_0x5b3a34[_0xee72('0x26')]=_0xee72('0x2a');_0x32a8f9[_0xee72('0x27')][_0xee72('0x28')]=[{'filename':_0x2553b1,'path':_0x17f7f6}];}else{if(_0x5b3a34[_0xee72('0x26')]===_0xee72('0x2b')){_0x32a8f9[_0xee72('0x27')][_0xee72('0x2c')]=_0xee72('0x2d');if(!_0x53b72b['sendIfEmpty']){_0x1d5b52=![];logger[_0xee72('0x11')](_0xee72('0x2e'));}}else if(_0x5b3a34[_0xee72('0x26')]===_0xee72('0x2f')){_0x32a8f9[_0xee72('0x27')][_0xee72('0x2c')]='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x5b3a34['status']===_0xee72('0x30')){_0x32a8f9['message']['text']='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x5b3a34['status']==='Failed'){_0x32a8f9[_0xee72('0x27')][_0xee72('0x2c')]=_0xee72('0x31');}else{logger[_0xee72('0x10')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x5b3a34[_0xee72('0x26')]);}}if(_0x1d5b52){return client[_0xee72('0x32')](_0xee72('0x33'),_0x32a8f9)[_0xee72('0xe')](function(_0x23d4ec){if(_0x23d4ec[_0xee72('0x10')]){return logger[_0xee72('0x10')]('error\x20mail',JSON[_0xee72('0x34')](_0x23d4ec));}return logger[_0xee72('0x11')](_0xee72('0x35'));})['catch'](function(_0x2b673c){return logger[_0xee72('0x10')](_0xee72('0x36'),JSON[_0xee72('0x34')](_0x2b673c));});}}function handleError(){return function(_0xb5b57){return logger[_0xee72('0x10')](JSON[_0xee72('0x34')](_0xb5b57));};}function loading(_0x4b7eaf){logger[_0xee72('0x11')](_0xee72('0x37'));if(_0x4b7eaf[_0xee72('0x38')]===_0x4b7eaf[_0xee72('0x39')]['retries']){handleSendEmail(_0x4b7eaf['job'],_0x4b7eaf[_0xee72('0x3a')]);_0x4b7eaf['operation'][_0xee72('0x3b')]();}else{_0x4b7eaf[_0xee72('0x3c')][_0xee72('0x7')](_0xee72('0x3d'));}}function completed(_0xcf30a9){logger['info'](_0xee72('0x3e'));handleSendEmail(_0xcf30a9[_0xee72('0x3f')],_0xcf30a9[_0xee72('0x3a')]);_0xcf30a9[_0xee72('0x3c')][_0xee72('0x3b')]();}function empty(_0x37188a){logger[_0xee72('0x11')](_0xee72('0x40'));handleSendEmail(_0x37188a[_0xee72('0x3f')],_0x37188a[_0xee72('0x3a')]);_0x37188a[_0xee72('0x3c')][_0xee72('0x3b')]();}function failed(_0xcc9e6f){logger['info']('case\x20failed');handleSendEmail(_0xcc9e6f[_0xee72('0x3f')],_0xcc9e6f['data']);_0xcc9e6f[_0xee72('0x3c')][_0xee72('0x3b')]();}function urecognized(_0x367e64){logger[_0xee72('0x10')]('Unrecognized\x20status:',_0x367e64[_0xee72('0x41')]['dataValues'][_0xee72('0x26')]);_0x367e64[_0xee72('0x3c')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x3f0cb9,_0x115ba0){const _0x1db42d={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x3a7da1=retry['operation'](_0x1db42d);_0x3a7da1[_0xee72('0x42')](_0x445929=>{logger[_0xee72('0x11')](_0xee72('0x43')+_0x3f0cb9['id']+_0xee72('0x44')+_0x445929);try{getReportData(_0x115ba0['id'])[_0xee72('0xe')](function(_0x3d9e6a){_0x115ba0=_0x3d9e6a;logger[_0xee72('0x11')](_0xee72('0x45'),_0x3d9e6a[_0xee72('0x46')][_0xee72('0x26')]);if(!reportStatusStrategies[_0x3d9e6a['dataValues'][_0xee72('0x26')]]){logger[_0xee72('0x10')](_0xee72('0x45'),_0x3d9e6a[_0xee72('0x46')][_0xee72('0x26')]);_0x3a7da1['retry']();}reportStatusStrategies[_0x3d9e6a[_0xee72('0x46')][_0xee72('0x26')]]({'operation':_0x3a7da1,'currentAttempt':_0x445929,'retryOptions':_0x1db42d,'job':_0x3f0cb9,'data':_0x115ba0,'entity':_0x3d9e6a});});}catch(_0x56d6dc){_0x3a7da1['retry'](_0x56d6dc);}});}function handleResult(_0xc83746){return function(_0x51789){if(_0xc83746[_0xee72('0x47')]&&_0xc83746[_0xee72('0x14')]&&_0xc83746[_0xee72('0x14')][_0xee72('0x18')]&&!_[_0xee72('0x48')](_0xc83746['email'])){retryer(_0xc83746,_0x51789);}};}function handleJob(_0x45ba77){return function(){try{if(_[_0xee72('0x48')](_0x45ba77[_0xee72('0x1d')])){return logger[_0xee72('0x11')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xee72('0x48')](_0x45ba77[_0xee72('0x1e')])){return logger[_0xee72('0x11')](_0xee72('0x49'));}var _0x269282={'startDate':moment()[_0xee72('0x4a')](_0x45ba77[_0xee72('0x1d')],_0x45ba77[_0xee72('0x1e')])[_0xee72('0x1b')](_0xee72('0x4b')),'endDate':moment()[_0xee72('0x1b')](_0xee72('0x4b')),'type':'scheduled','output':_0x45ba77['output'],'name':_0x45ba77[_0xee72('0x17')]};if(!_[_0xee72('0x48')](_0x45ba77[_0xee72('0x4c')])){logger[_0xee72('0x11')](_0xee72('0x4d'),_0x45ba77['DefaultReportId']);return analyticDefaultReportController[_0xee72('0x4e')]({'id':_0x45ba77[_0xee72('0x4c')]},_0x269282)[_0xee72('0xe')](handleResult(_0x45ba77))['catch'](handleError());}if(!_[_0xee72('0x48')](_0x45ba77[_0xee72('0x4f')])){logger[_0xee72('0x11')]('exec\x20custom\x20report\x20id:%s',_0x45ba77[_0xee72('0x4f')]);return analyticCustomReportController[_0xee72('0x4e')]({'id':_0x45ba77[_0xee72('0x4f')]},_0x269282)[_0xee72('0xe')](handleResult(_0x45ba77))['catch'](handleError());}}catch(_0x479cce){logger[_0xee72('0x10')](JSON['stringify'](_0x479cce));}return logger['info'](_0xee72('0x50'));};}function getJobs(_0x3ca13a){var _0x671c7d={};if(_0x3ca13a){_0x671c7d['id']=_0x3ca13a;}return db[_0xee72('0x51')][_0xee72('0x52')]({'where':_0x671c7d,'include':[{'model':db[_0xee72('0x14')],'attributes':['id','name',_0xee72('0x13')],'include':[{'model':db[_0xee72('0x53')],'as':_0xee72('0x18'),'include':[{'model':db[_0xee72('0x54')],'as':_0xee72('0x54')}]}]}]})[_0xee72('0xe')](function(_0x2db7a6){var _0x1d094c=_[_0xee72('0x55')](manager[_0xee72('0x56')]);var _0x327d71=_[_0xee72('0x57')](_0x2db7a6,function(_0xf37ca8){return _0xf37ca8['id']['toString']();});var _0x5b65ab=_[_0xee72('0x58')](_0x2db7a6,function(_0x3a7a23){return _0x3a7a23['id'][_0xee72('0x59')]();});var _0x599267=_0x3ca13a?_0x327d71:_[_0xee72('0x5a')](_0x327d71,_0x1d094c);var _0x540198=_[_0xee72('0x5b')](_0x327d71,_0x1d094c);var _0x403172=_[_0xee72('0x5a')](_0x1d094c,_0x327d71);var _0x14649;var _0x4927c2;for(_0x14649=0x0;_0x14649<_0x403172['length']&&!_0x3ca13a;_0x14649+=0x1){_0x4927c2=_0x403172[_0x14649][_0xee72('0x59')]();if(manager[_0xee72('0x5c')](_0x4927c2)){manager[_0xee72('0x3b')](_0x4927c2);manager[_0xee72('0x5d')](_0x4927c2);logger['info']('delete\x20cron',_0x4927c2);}}logger[_0xee72('0x11')](_0xee72('0x5e'),JSON['stringify'](_0x599267));for(_0x14649=0x0;_0x14649<_0x599267[_0xee72('0x5f')];_0x14649+=0x1){_0x4927c2=_0x599267[_0x14649][_0xee72('0x59')]();if(_0x3ca13a){logger[_0xee72('0x11')](JSON[_0xee72('0x34')](_0x5b65ab[_0x4927c2]));BPromise[_0xee72('0x60')]()[_0xee72('0xe')](handleJob(_0x5b65ab[_0x4927c2]));logger[_0xee72('0x11')](_0xee72('0x61'),_0x5b65ab[_0x4927c2][_0xee72('0x17')],_0x5b65ab[_0x4927c2]['cron']);}else if(_0x5b65ab[_0x4927c2]['cron']&&_0x5b65ab[_0x4927c2][_0xee72('0x62')]&&moment()[_0xee72('0x63')](_0x5b65ab[_0x4927c2]['startAt'],_0x5b65ab[_0x4927c2][_0xee72('0x64')])){manager[_0xee72('0x65')](_0x4927c2,_0x5b65ab[_0x4927c2][_0xee72('0x66')],handleJob(_0x5b65ab[_0x4927c2]));manager[_0xee72('0x67')](_0x4927c2);logger[_0xee72('0x11')](_0xee72('0x68'),_0x5b65ab[_0x4927c2][_0xee72('0x17')],_0x5b65ab[_0x4927c2]['cron']);}else if(manager[_0xee72('0x5c')](_0x4927c2)){manager[_0xee72('0x3b')](_0x4927c2);manager[_0xee72('0x5d')](_0x4927c2);logger[_0xee72('0x11')](_0xee72('0x69'),_0x5b65ab[_0x4927c2][_0xee72('0x17')],_0x5b65ab[_0x4927c2][_0xee72('0x66')]);}}for(_0x14649=0x0,_0x4927c2;_0x14649<_0x540198['length']&&!_0x3ca13a;_0x14649+=0x1){_0x4927c2=_0x540198[_0x14649]['toString']();if(manager[_0xee72('0x5c')](_0x4927c2)){if(_0x5b65ab[_0x4927c2][_0xee72('0x66')]&&_0x5b65ab[_0x4927c2][_0xee72('0x62')]&&moment()[_0xee72('0x63')](_0x5b65ab[_0x4927c2][_0xee72('0x6a')],_0x5b65ab[_0x4927c2][_0xee72('0x64')])){manager[_0xee72('0x6b')](_0x4927c2,_0x5b65ab[_0x4927c2]['cron'],handleJob(_0x5b65ab[_0x4927c2]));logger['info'](_0xee72('0x6c'),_0x5b65ab[_0x4927c2][_0xee72('0x17')],_0x5b65ab[_0x4927c2][_0xee72('0x66')]);}else{manager[_0xee72('0x3b')](_0x4927c2);manager[_0xee72('0x5d')](_0x4927c2);logger[_0xee72('0x11')](_0xee72('0x69'),_0x5b65ab[_0x4927c2][_0xee72('0x17')],_0x5b65ab[_0x4927c2]['cron']);}}}})[_0xee72('0xf')](function(_0x241780){logger[_0xee72('0x10')](JSON[_0xee72('0x34')](_0x241780));});}exports[_0xee72('0x6d')]=function(_0x42810c){return getJobs(_0x42810c);};exports[_0xee72('0x67')]=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 9e4bd3a..4c9213f 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 _0x93ed=['Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','FAILED','resolve','Sentiment\x20Analysis\x20not\x20requested','bucket','Cloud\x20Provider\x20not\x20configured','Sentiment','Negative','Neutral','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','push','all','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','TranscribeService','Comprehend','detectSentiment','substring','transcribeName','data1','data2','info','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0x17bfef,_0x4feee7){var _0x26e71e=function(_0xcc8568){while(--_0xcc8568){_0x17bfef['push'](_0x17bfef['shift']());}};_0x26e71e(++_0x4feee7);}(_0x93ed,0xfe));var _0xd93e=function(_0x1c6e10,_0x5ae23c){_0x1c6e10=_0x1c6e10-0x0;var _0x2a5924=_0x93ed[_0x1c6e10];return _0x2a5924;};var _=require(_0xd93e('0x0'));var AWS=require(_0xd93e('0x1'));var rp=require(_0xd93e('0x2'));var util=require(_0xd93e('0x3'));var BPromise=require(_0xd93e('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xd93e('0x5'))('transcribe');function getTranscriptionJob(_0x5a6206,_0x812267,_0x5a4150,_0x462444){return new Promise(function(_0x3481fa,_0x462ab2){var _0x478305=new AWS[(_0xd93e('0x6'))]({'accessKeyId':_0x812267,'secretAccessKey':_0x5a6206,'region':_0x5a4150});_0x478305['getTranscriptionJob']({'TranscriptionJobName':_0x462444},function(_0x4ef1a1,_0x466fca){if(_0x4ef1a1){return _0x462ab2(_0x4ef1a1);}else{return _0x3481fa(_0x466fca);}});});}function sentiment(_0x3b1527,_0x8ff0d1,_0x14fc46,_0x561e6d,_0x4bb433){return new Promise(function(_0x25b7c0,_0x5d916b){var _0x3f3f19=new AWS[(_0xd93e('0x7'))]({'accessKeyId':_0x8ff0d1,'secretAccessKey':_0x3b1527,'region':_0x14fc46});_0x3f3f19[_0xd93e('0x8')]({'Text':_0x561e6d,'LanguageCode':_0x4bb433[_0xd93e('0x9')](0x0,0x2)},function(_0x1f9ad3,_0x5993e5){if(_0x1f9ad3){return _0x5d916b(_0x1f9ad3);}else{return _0x25b7c0(_0x5993e5);}});});}function checkTranscribeJob(_0x652ac9,_0x256f8a,_0x444b08){var _0x2e4284;return new BPromise(function(_0x2032c7,_0x55aeec){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x652ac9['id'],_0x652ac9[_0xd93e('0xa')]));return getTranscriptionJob(_0x444b08[_0xd93e('0xb')],_0x444b08[_0xd93e('0xc')],_0x256f8a['transcribeRegion'],_0x652ac9[_0xd93e('0xa')])['then'](function(_0x1826b8){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0xf'),_0x652ac9['id'],_0x652ac9[_0xd93e('0xa')],_0x1826b8[_0xd93e('0x10')][_0xd93e('0x11')]));if(!_0x652ac9['fileText']){switch(_0x1826b8['TranscriptionJob']['TranscriptionJobStatus']){case _0xd93e('0x12'):var _0x9896c8={'transcribeStatus':_0x1826b8[_0xd93e('0x10')]['TranscriptionJobStatus'],'fileUri':_0x1826b8['TranscriptionJob'][_0xd93e('0x13')][_0xd93e('0x14')]};logger[_0xd93e('0xd')](util[_0xd93e('0xe')]('[RECORDING:%d]\x20Get\x20transcript',_0x652ac9['id']));return rp({'uri':_0x1826b8[_0xd93e('0x10')][_0xd93e('0x13')][_0xd93e('0x14')],'json':!![]})[_0xd93e('0x15')](function(_0x25193b){logger['info'](util['format'](_0xd93e('0x16'),_0x652ac9['id']));if(_0x25193b&&_0x25193b[_0xd93e('0x17')]&&_0x25193b[_0xd93e('0x17')][_0xd93e('0x18')]&&_0x25193b[_0xd93e('0x17')][_0xd93e('0x18')][_0xd93e('0x19')]){_0x9896c8[_0xd93e('0x1a')]='';for(var _0x47487c=0x0;_0x47487c<_0x25193b[_0xd93e('0x17')][_0xd93e('0x18')]['length'];_0x47487c++){_0x9896c8[_0xd93e('0x1a')]+=_0x25193b['results']['transcripts'][_0x47487c][_0xd93e('0x1b')]+'';}}return _0x652ac9[_0xd93e('0x1c')](_0x9896c8);})['then'](function(){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0x1d'),_0x652ac9['id']));if(!_0x652ac9['tempSentiment']){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x256f8a[_0xd93e('0x20')]||!_0x256f8a[_0xd93e('0x21')]||!_0x256f8a[_0xd93e('0x22')]||!_0x256f8a[_0xd93e('0x23')]||!_0x256f8a['bucket']){throw new db['Sequelize']['ValidationError'](_0xd93e('0x24'));}if(!_0x9896c8[_0xd93e('0x1a')]){throw new Error(_0xd93e('0x25'));}if(_0x256f8a[_0xd93e('0x21')]===_0x444b08['id']){return _0x444b08;}else{return db[_0xd93e('0x26')][_0xd93e('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd93e('0x15')](function(_0x48289c){if(!_0x48289c){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x28'));}if(!_0x48289c[_0xd93e('0xb')]||!_0x48289c[_0xd93e('0xc')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2e4284=_0x48289c;logger['info'](util['format'](_0xd93e('0x29'),_0x652ac9['id']));return sentiment(_0x2e4284[_0xd93e('0xb')],_0x2e4284[_0xd93e('0xc')],_0x256f8a['sentimentRegion'],_0x9896c8[_0xd93e('0x1a')],_0x256f8a['language']);})['then'](function(_0x136176){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0x2a'),_0x652ac9['id']));return _0x652ac9['update']({'sentiment':_0x136176['Sentiment'],'sPositive':_0x136176[_0xd93e('0x2b')][_0xd93e('0x2c')],'sNegative':_0x136176[_0xd93e('0x2b')]['Negative'],'sMixed':_0x136176[_0xd93e('0x2b')][_0xd93e('0x2d')],'sNeutral':_0x136176['SentimentScore']['Neutral']});})['then'](function(){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0x1d'),_0x652ac9['id']));_0x2032c7();});case _0xd93e('0x2e'):return _0x652ac9[_0xd93e('0x1c')]({'transcribeStatus':_0xd93e('0x2e'),'failureReason':_0x1826b8[_0xd93e('0x10')]['FailureReason']})[_0xd93e('0x15')](function(){logger['info'](util[_0xd93e('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x652ac9['id']));_0x2032c7();});default:logger[_0xd93e('0xd')](util[_0xd93e('0xe')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x652ac9['id']));break;}}else{return BPromise[_0xd93e('0x2f')]()[_0xd93e('0x15')](function(){if(!_0x652ac9['tempSentiment']){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x30'));}if(!_0x256f8a['sentiment']||!_0x256f8a['sentimentAccountId']||!_0x256f8a['sentimentRegion']||!_0x256f8a[_0xd93e('0x23')]||!_0x256f8a[_0xd93e('0x31')]){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x24'));}if(!_0x652ac9[_0xd93e('0x1a')]){throw new Error(_0xd93e('0x25'));}if(_0x256f8a[_0xd93e('0x21')]===_0x444b08['id']){return _0x444b08;}else{return db['CloudProvider'][_0xd93e('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd93e('0x15')](function(_0x3919e4){if(!_0x3919e4){throw new db['Sequelize'][(_0xd93e('0x1f'))](_0xd93e('0x28'));}if(!_0x3919e4[_0xd93e('0xb')]||!_0x3919e4[_0xd93e('0xc')]){throw new db[(_0xd93e('0x1e'))]['ValidationError'](_0xd93e('0x32'));}_0x2e4284=_0x3919e4;logger[_0xd93e('0xd')](util[_0xd93e('0xe')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x652ac9['id']));return sentiment(_0x2e4284[_0xd93e('0xb')],_0x2e4284['data2'],_0x256f8a['sentimentRegion'],_0x652ac9[_0xd93e('0x1a')],_0x256f8a[_0xd93e('0x23')]);})[_0xd93e('0x15')](function(_0x4a3772){logger['info'](util[_0xd93e('0xe')](_0xd93e('0x2a'),_0x652ac9['id']));return _0x652ac9[_0xd93e('0x1c')]({'sentiment':_0x4a3772[_0xd93e('0x33')],'sPositive':_0x4a3772['SentimentScore']['Positive'],'sNegative':_0x4a3772[_0xd93e('0x2b')][_0xd93e('0x34')],'sMixed':_0x4a3772[_0xd93e('0x2b')][_0xd93e('0x2d')],'sNeutral':_0x4a3772[_0xd93e('0x2b')][_0xd93e('0x35')],'transcribeStatus':_0xd93e('0x12')});})[_0xd93e('0x15')](function(){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0x1d'),_0x652ac9['id']));_0x2032c7();});}})[_0xd93e('0x36')](function(_0x3c92fb){if(_0x3c92fb){if(!_0x3c92fb[_0xd93e('0x37')]||_0x3c92fb[_0xd93e('0x37')]!==_0xd93e('0x38')){logger['error'](util[_0xd93e('0xe')](_0xd93e('0x39'),_0x652ac9['id']),util[_0xd93e('0x3a')](_0x3c92fb,{'showHidden':![],'depth':null}));}}_0x2032c7();});});}function checkTranscribe(){var _0x7e330e;var _0x59a718;var _0x15fc29;return db['VoiceRecording'][_0xd93e('0x3b')]({'where':{'transcribeStatus':_0xd93e('0x3c')}})[_0xd93e('0x15')](function(_0xd1c085){if(!_0xd1c085||!_0xd1c085[_0xd93e('0x19')]){throw new db['Sequelize'][(_0xd93e('0x1f'))](_0xd93e('0x3d'));}_0x7e330e=_0xd1c085;return db[_0xd93e('0x3e')][_0xd93e('0x27')]({'where':{'id':0x1}});})[_0xd93e('0x15')](function(_0x4d9073){if(!_0x4d9073){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x3f'));}_0x59a718=_0x4d9073;if(!_0x59a718[_0xd93e('0x40')]||!_0x59a718['transcribeAccountId']||!_0x59a718['transcribeRegion']||!_0x59a718[_0xd93e('0x23')]||!_0x59a718[_0xd93e('0x31')]){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x41'));}return db[_0xd93e('0x26')][_0xd93e('0x27')]({'where':{'id':_0x59a718[_0xd93e('0x42')]}});})['then'](function(_0x4c6eaa){if(!_0x4c6eaa){throw new db[(_0xd93e('0x1e'))]['ValidationError'](_0xd93e('0x28'));}if(!_0x4c6eaa[_0xd93e('0xb')]||!_0x4c6eaa[_0xd93e('0xc')]){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x15fc29=_0x4c6eaa;var _0x21230d=[];_0x7e330e['forEach'](function(_0x1cf398){_0x21230d[_0xd93e('0x43')](checkTranscribeJob(_0x1cf398,_0x59a718,_0x15fc29));});return BPromise[_0xd93e('0x44')](_0x21230d);})['catch'](function(_0x36ddc2){if(_0x36ddc2){if(!_0x36ddc2['name']||_0x36ddc2['name']!==_0xd93e('0x38')){logger[_0xd93e('0x45')](util[_0xd93e('0x3a')](_0x36ddc2,{'showHidden':![],'depth':null}));}}});}exports[_0xd93e('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x68a5=['results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Positive','Negative','SentimentScore','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','findOne','Neutral','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded'];(function(_0x2e2d5b,_0x57c5ab){var _0x43e6ec=function(_0xd77e52){while(--_0xd77e52){_0x2e2d5b['push'](_0x2e2d5b['shift']());}};_0x43e6ec(++_0x57c5ab);}(_0x68a5,0xfc));var _0x568a=function(_0x5c4c1e,_0x2550da){_0x5c4c1e=_0x5c4c1e-0x0;var _0x29d08b=_0x68a5[_0x5c4c1e];return _0x29d08b;};var _=require(_0x568a('0x0'));var AWS=require('aws-sdk');var rp=require(_0x568a('0x1'));var util=require(_0x568a('0x2'));var BPromise=require('bluebird');var db=require(_0x568a('0x3'))['db'];var logger=require(_0x568a('0x4'))(_0x568a('0x5'));function getTranscriptionJob(_0x2d4dce,_0x53dca3,_0xac8b08,_0x55e328){return new Promise(function(_0x26db0e,_0x467a4f){var _0x2d36ec=new AWS[(_0x568a('0x6'))]({'accessKeyId':_0x53dca3,'secretAccessKey':_0x2d4dce,'region':_0xac8b08});_0x2d36ec['getTranscriptionJob']({'TranscriptionJobName':_0x55e328},function(_0x172efd,_0x56deb6){if(_0x172efd){return _0x467a4f(_0x172efd);}else{return _0x26db0e(_0x56deb6);}});});}function sentiment(_0x131e5b,_0x24f56d,_0x335ecd,_0x453707,_0x51f43e){return new Promise(function(_0x4e39d0,_0x3cbe63){var _0x3011b9=new AWS['Comprehend']({'accessKeyId':_0x24f56d,'secretAccessKey':_0x131e5b,'region':_0x335ecd});_0x3011b9[_0x568a('0x7')]({'Text':_0x453707,'LanguageCode':_0x51f43e['substring'](0x0,0x2)},function(_0x39d69c,_0x214be5){if(_0x39d69c){return _0x3cbe63(_0x39d69c);}else{return _0x4e39d0(_0x214be5);}});});}function checkTranscribeJob(_0xea9341,_0x22bc5b,_0x365871){var _0x26901e;return new BPromise(function(_0x23e286,_0x3a325a){logger[_0x568a('0x8')](util[_0x568a('0x9')](_0x568a('0xa'),_0xea9341['id'],_0xea9341[_0x568a('0xb')]));return getTranscriptionJob(_0x365871[_0x568a('0xc')],_0x365871[_0x568a('0xd')],_0x22bc5b[_0x568a('0xe')],_0xea9341[_0x568a('0xb')])[_0x568a('0xf')](function(_0x4e6f9a){logger[_0x568a('0x8')](util['format'](_0x568a('0x10'),_0xea9341['id'],_0xea9341[_0x568a('0xb')],_0x4e6f9a['TranscriptionJob'][_0x568a('0x11')]));if(!_0xea9341['fileText']){switch(_0x4e6f9a[_0x568a('0x12')][_0x568a('0x11')]){case _0x568a('0x13'):var _0x16a7c5={'transcribeStatus':_0x4e6f9a['TranscriptionJob'][_0x568a('0x11')],'fileUri':_0x4e6f9a['TranscriptionJob'][_0x568a('0x14')][_0x568a('0x15')]};logger[_0x568a('0x8')](util[_0x568a('0x9')](_0x568a('0x16'),_0xea9341['id']));return rp({'uri':_0x4e6f9a[_0x568a('0x12')][_0x568a('0x14')][_0x568a('0x15')],'json':!![]})['then'](function(_0x3171d8){logger[_0x568a('0x8')](util['format'](_0x568a('0x17'),_0xea9341['id']));if(_0x3171d8&&_0x3171d8[_0x568a('0x18')]&&_0x3171d8[_0x568a('0x18')]['transcripts']&&_0x3171d8[_0x568a('0x18')][_0x568a('0x19')][_0x568a('0x1a')]){_0x16a7c5[_0x568a('0x1b')]='';for(var _0xdb83a1=0x0;_0xdb83a1<_0x3171d8[_0x568a('0x18')][_0x568a('0x19')][_0x568a('0x1a')];_0xdb83a1++){_0x16a7c5[_0x568a('0x1b')]+=_0x3171d8['results'][_0x568a('0x19')][_0xdb83a1][_0x568a('0x1c')]+'';}}return _0xea9341[_0x568a('0x1d')](_0x16a7c5);})[_0x568a('0xf')](function(){logger[_0x568a('0x8')](util[_0x568a('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xea9341['id']));if(!_0xea9341[_0x568a('0x1e')]){throw new db[(_0x568a('0x1f'))][(_0x568a('0x20'))](_0x568a('0x21'));}if(!_0x22bc5b[_0x568a('0x22')]||!_0x22bc5b['sentimentAccountId']||!_0x22bc5b[_0x568a('0x23')]||!_0x22bc5b[_0x568a('0x24')]||!_0x22bc5b[_0x568a('0x25')]){throw new db[(_0x568a('0x1f'))][(_0x568a('0x20'))](_0x568a('0x26'));}if(!_0x16a7c5[_0x568a('0x1b')]){throw new Error(_0x568a('0x27'));}if(_0x22bc5b[_0x568a('0x28')]===_0x365871['id']){return _0x365871;}else{return db[_0x568a('0x29')]['findOne']({'where':{'id':_settings[_0x568a('0x28')]}});}})[_0x568a('0xf')](function(_0x43842e){if(!_0x43842e){throw new db[(_0x568a('0x1f'))][(_0x568a('0x20'))](_0x568a('0x2a'));}if(!_0x43842e['data1']||!_0x43842e['data2']){throw new db['Sequelize'][(_0x568a('0x20'))](_0x568a('0x2b'));}_0x26901e=_0x43842e;logger[_0x568a('0x8')](util[_0x568a('0x9')](_0x568a('0x2c'),_0xea9341['id']));return sentiment(_0x26901e['data1'],_0x26901e['data2'],_0x22bc5b[_0x568a('0x23')],_0x16a7c5[_0x568a('0x1b')],_0x22bc5b[_0x568a('0x24')]);})[_0x568a('0xf')](function(_0x4664c7){logger['info'](util[_0x568a('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xea9341['id']));return _0xea9341[_0x568a('0x1d')]({'sentiment':_0x4664c7[_0x568a('0x2d')],'sPositive':_0x4664c7['SentimentScore'][_0x568a('0x2e')],'sNegative':_0x4664c7['SentimentScore'][_0x568a('0x2f')],'sMixed':_0x4664c7[_0x568a('0x30')][_0x568a('0x31')],'sNeutral':_0x4664c7['SentimentScore']['Neutral']});})[_0x568a('0xf')](function(){logger[_0x568a('0x8')](util[_0x568a('0x9')](_0x568a('0x32'),_0xea9341['id']));_0x23e286();});case _0x568a('0x33'):return _0xea9341[_0x568a('0x1d')]({'transcribeStatus':_0x568a('0x33'),'failureReason':_0x4e6f9a['TranscriptionJob']['FailureReason']})[_0x568a('0xf')](function(){logger[_0x568a('0x8')](util[_0x568a('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xea9341['id']));_0x23e286();});default:logger['info'](util[_0x568a('0x9')](_0x568a('0x34'),_0xea9341['id']));break;}}else{return BPromise['resolve']()[_0x568a('0xf')](function(){if(!_0xea9341[_0x568a('0x1e')]){throw new db['Sequelize'][(_0x568a('0x20'))](_0x568a('0x21'));}if(!_0x22bc5b[_0x568a('0x22')]||!_0x22bc5b[_0x568a('0x28')]||!_0x22bc5b[_0x568a('0x23')]||!_0x22bc5b[_0x568a('0x24')]||!_0x22bc5b['bucket']){throw new db['Sequelize'][(_0x568a('0x20'))](_0x568a('0x26'));}if(!_0xea9341[_0x568a('0x1b')]){throw new Error(_0x568a('0x27'));}if(_0x22bc5b[_0x568a('0x28')]===_0x365871['id']){return _0x365871;}else{return db[_0x568a('0x29')][_0x568a('0x35')]({'where':{'id':_settings[_0x568a('0x28')]}});}})['then'](function(_0x1266bb){if(!_0x1266bb){throw new db[(_0x568a('0x1f'))][(_0x568a('0x20'))](_0x568a('0x2a'));}if(!_0x1266bb[_0x568a('0xc')]||!_0x1266bb['data2']){throw new db[(_0x568a('0x1f'))]['ValidationError'](_0x568a('0x2b'));}_0x26901e=_0x1266bb;logger[_0x568a('0x8')](util[_0x568a('0x9')](_0x568a('0x2c'),_0xea9341['id']));return sentiment(_0x26901e[_0x568a('0xc')],_0x26901e[_0x568a('0xd')],_0x22bc5b[_0x568a('0x23')],_0xea9341['fileText'],_0x22bc5b[_0x568a('0x24')]);})[_0x568a('0xf')](function(_0x17bbbf){logger['info'](util[_0x568a('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xea9341['id']));return _0xea9341['update']({'sentiment':_0x17bbbf[_0x568a('0x2d')],'sPositive':_0x17bbbf['SentimentScore'][_0x568a('0x2e')],'sNegative':_0x17bbbf[_0x568a('0x30')]['Negative'],'sMixed':_0x17bbbf[_0x568a('0x30')][_0x568a('0x31')],'sNeutral':_0x17bbbf[_0x568a('0x30')][_0x568a('0x36')],'transcribeStatus':_0x568a('0x13')});})['then'](function(){logger[_0x568a('0x8')](util[_0x568a('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xea9341['id']));_0x23e286();});}})[_0x568a('0x37')](function(_0x72cbbe){if(_0x72cbbe){if(!_0x72cbbe[_0x568a('0x38')]||_0x72cbbe[_0x568a('0x38')]!==_0x568a('0x39')){logger[_0x568a('0x3a')](util[_0x568a('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0xea9341['id']),util[_0x568a('0x3b')](_0x72cbbe,{'showHidden':![],'depth':null}));}}_0x23e286();});});}function checkTranscribe(){var _0x6404ec;var _0x4ef7fe;var _0x387c29;return db[_0x568a('0x3c')]['findAll']({'where':{'transcribeStatus':_0x568a('0x3d')}})['then'](function(_0x41cbe4){if(!_0x41cbe4||!_0x41cbe4[_0x568a('0x1a')]){throw new db[(_0x568a('0x1f'))][(_0x568a('0x20'))](_0x568a('0x3e'));}_0x6404ec=_0x41cbe4;return db['Setting'][_0x568a('0x35')]({'where':{'id':0x1}});})[_0x568a('0xf')](function(_0x48a906){if(!_0x48a906){throw new db[(_0x568a('0x1f'))][(_0x568a('0x20'))](_0x568a('0x3f'));}_0x4ef7fe=_0x48a906;if(!_0x4ef7fe[_0x568a('0x5')]||!_0x4ef7fe['transcribeAccountId']||!_0x4ef7fe[_0x568a('0xe')]||!_0x4ef7fe[_0x568a('0x24')]||!_0x4ef7fe[_0x568a('0x25')]){throw new db[(_0x568a('0x1f'))][(_0x568a('0x20'))](_0x568a('0x40'));}return db[_0x568a('0x29')][_0x568a('0x35')]({'where':{'id':_0x4ef7fe['transcribeAccountId']}});})[_0x568a('0xf')](function(_0x1a153b){if(!_0x1a153b){throw new db[(_0x568a('0x1f'))][(_0x568a('0x20'))](_0x568a('0x2a'));}if(!_0x1a153b['data1']||!_0x1a153b[_0x568a('0xd')]){throw new db[(_0x568a('0x1f'))][(_0x568a('0x20'))](_0x568a('0x2b'));}_0x387c29=_0x1a153b;var _0x459f28=[];_0x6404ec[_0x568a('0x41')](function(_0x53a971){_0x459f28[_0x568a('0x42')](checkTranscribeJob(_0x53a971,_0x4ef7fe,_0x387c29));});return BPromise[_0x568a('0x43')](_0x459f28);})[_0x568a('0x37')](function(_0x3dff8e){if(_0x3dff8e){if(!_0x3dff8e[_0x568a('0x38')]||_0x3dff8e[_0x568a('0x38')]!==_0x568a('0x39')){logger[_0x568a('0x3a')](util[_0x568a('0x3b')](_0x3dff8e,{'showHidden':![],'depth':null}));}}});}exports[_0x568a('0x44')]=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 9e20b3f..9afeaa1 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 _0x5706=['redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','info','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger'];(function(_0x42a0ec,_0x5a45cb){var _0x173d4f=function(_0x39ecc0){while(--_0x39ecc0){_0x42a0ec['push'](_0x42a0ec['shift']());}};_0x173d4f(++_0x5a45cb);}(_0x5706,0x8a));var _0x6570=function(_0x4fe585,_0xaebe86){_0x4fe585=_0x4fe585-0x0;var _0x7d612=_0x5706[_0x4fe585];return _0x7d612;};'use strict';var _=require(_0x6570('0x0'));var moment=require(_0x6570('0x1'));var Redis=require(_0x6570('0x2'));var util=require(_0x6570('0x3'));var config=require(_0x6570('0x4'));var db=require(_0x6570('0x5'))['db'];var logger=require(_0x6570('0x6'))('schedule');config[_0x6570('0x7')]=_['defaults'](config[_0x6570('0x7')],{'host':_0x6570('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x278218=[];return db[_0x6570('0x9')][_0x6570('0xa')]({'raw':!![],'attributes':['id',_0x6570('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6570('0xc')](0x18,'hours')}}})[_0x6570('0xd')](function(_0x5d42fb){if(_0x5d42fb&&_0x5d42fb[_0x6570('0xe')]){_0x278218=_[_0x6570('0xf')](_0x5d42fb||[],'id');logger[_0x6570('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x278218[_0x6570('0x11')]());return db[_0x6570('0x9')]['update']({'closeReason':_0x6570('0x12'),'disposition':_0x6570('0x13'),'closed':!![],'closedAt':moment()[_0x6570('0x14')](_0x6570('0x15'))},{'where':{'id':_0x278218}});}})[_0x6570('0xd')](function(){if(_0x278218&&_0x278218[_0x6570('0xe')]){logger[_0x6570('0x10')](_0x6570('0x16'),_0x278218[_0x6570('0x11')]());for(var _0x14863e=0x0;_0x14863e<_0x278218[_0x6570('0xe')];_0x14863e++){io[_0x6570('0x17')](_0x6570('0x18'),{'id':_0x278218[_0x14863e],'closed':!![]});}}})[_0x6570('0x19')](function(_0x12ecec){logger[_0x6570('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x12ecec?util[_0x6570('0x1b')](_0x12ecec,{'showHidden':![],'depth':null}):'');});}exports[_0x6570('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x974f=['subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','WhatsappInteraction','findAll'];(function(_0x14cc9d,_0xc4abc1){var _0x2659da=function(_0x30d2f7){while(--_0x30d2f7){_0x14cc9d['push'](_0x14cc9d['shift']());}};_0x2659da(++_0xc4abc1);}(_0x974f,0x98));var _0xf974=function(_0x5e7bc6,_0x110bbe){_0x5e7bc6=_0x5e7bc6-0x0;var _0x3e4f89=_0x974f[_0x5e7bc6];return _0x3e4f89;};'use strict';var _=require(_0xf974('0x0'));var moment=require(_0xf974('0x1'));var Redis=require(_0xf974('0x2'));var util=require(_0xf974('0x3'));var config=require(_0xf974('0x4'));var db=require(_0xf974('0x5'))['db'];var logger=require('../logger')(_0xf974('0x6'));config['redis']=_['defaults'](config[_0xf974('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x39b2f6=[];return db[_0xf974('0x8')][_0xf974('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf974('0xa')](0x18,_0xf974('0xb'))}}})[_0xf974('0xc')](function(_0x572bd1){if(_0x572bd1&&_0x572bd1[_0xf974('0xd')]){_0x39b2f6=_['map'](_0x572bd1||[],'id');logger[_0xf974('0xe')](_0xf974('0xf'),_0x39b2f6['join']());return db[_0xf974('0x8')][_0xf974('0x10')]({'closeReason':'system','disposition':_0xf974('0x11'),'closed':!![],'closedAt':moment()[_0xf974('0x12')](_0xf974('0x13'))},{'where':{'id':_0x39b2f6}});}})[_0xf974('0xc')](function(){if(_0x39b2f6&&_0x39b2f6[_0xf974('0xd')]){logger[_0xf974('0xe')](_0xf974('0x14'),_0x39b2f6[_0xf974('0x15')]());for(var _0x246f71=0x0;_0x246f71<_0x39b2f6[_0xf974('0xd')];_0x246f71++){io[_0xf974('0x16')](_0xf974('0x17'),{'id':_0x39b2f6[_0x246f71],'closed':!![]});}}})[_0xf974('0x18')](function(_0x1746dd){logger['error'](_0xf974('0x19'),_0x1746dd?util[_0xf974('0x1a')](_0x1746dd,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 78b4f6d..e705d20 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4639=['innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','then','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo'];(function(_0x23e049,_0x306845){var _0xeaaa15=function(_0x1047cf){while(--_0x1047cf){_0x23e049['push'](_0x23e049['shift']());}};_0xeaaa15(++_0x306845);}(_0x4639,0x19f));var _0x9463=function(_0xa14d8c,_0x14759b){_0xa14d8c=_0xa14d8c-0x0;var _0x3facda=_0x4639[_0xa14d8c];return _0x3facda;};'use strict';var util=require(_0x9463('0x0'));var db=require(_0x9463('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9463('0x2')]({'id':i,'firstName':_0x9463('0x3')+i,'lastName':_0x9463('0x4')+i,'phone':0xf879fb460+i,'email':_0x9463('0x5')+i+_0x9463('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9463('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9463('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9463('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9463('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9463('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9463('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9463('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9463('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9463('0x7')]()});}db[_0x9463('0x8')]['destroy']({'where':{}})['then'](function(){return db[_0x9463('0x8')][_0x9463('0x9')](contacts);})['then'](function(){console[_0x9463('0xa')](_0x9463('0xb'),_0x9463('0xc'));return db[_0x9463('0xd')][_0x9463('0xe')]({'where':{}});})[_0x9463('0xf')](function(){return db[_0x9463('0xd')][_0x9463('0x9')](hopper);})[_0x9463('0xf')](function(){console['log']('finished\x20populating',_0x9463('0x10'));return db[_0x9463('0x8')][_0x9463('0x9')](contacts2);})[_0x9463('0xf')](function(){console['log']('finished\x20populating',_0x9463('0x11'));return db['CmHopper'][_0x9463('0x9')](hopper2);})['then'](function(){console[_0x9463('0xa')](_0x9463('0xb'),_0x9463('0x12'));})[_0x9463('0x13')](function(_0x39cab3){console['log'](_0x39cab3);}); \ No newline at end of file +var _0x4eb4=['finished\x20populating','hopper1','contacts2','hopper2','catch','util','Innocenzo','now','Biondo','innocenzo.biondo','@xcally.com','push','CmContact','destroy','bulkCreate','then','log','contacts1','CmHopper'];(function(_0x4eeb0a,_0x24dad3){var _0x33dca9=function(_0x1201f9){while(--_0x1201f9){_0x4eeb0a['push'](_0x4eeb0a['shift']());}};_0x33dca9(++_0x24dad3);}(_0x4eb4,0x1cd));var _0x44eb=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0x4eb4[_0x148879];return _0x4f7027;};'use strict';var util=require(_0x44eb('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x44eb('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x44eb('0x2')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x44eb('0x2')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x44eb('0x1')+i,'lastName':_0x44eb('0x3')+i,'phone':0xf879fb460+i,'email':_0x44eb('0x4')+i+_0x44eb('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x44eb('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x44eb('0x2')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x44eb('0x2')](),'updatedAt':Date[_0x44eb('0x2')]()});}db[_0x44eb('0x7')][_0x44eb('0x8')]({'where':{}})['then'](function(){return db['CmContact'][_0x44eb('0x9')](contacts);})[_0x44eb('0xa')](function(){console[_0x44eb('0xb')]('finished\x20populating',_0x44eb('0xc'));return db[_0x44eb('0xd')]['destroy']({'where':{}});})[_0x44eb('0xa')](function(){return db['CmHopper'][_0x44eb('0x9')](hopper);})['then'](function(){console['log'](_0x44eb('0xe'),_0x44eb('0xf'));return db[_0x44eb('0x7')][_0x44eb('0x9')](contacts2);})['then'](function(){console[_0x44eb('0xb')]('finished\x20populating',_0x44eb('0x10'));return db[_0x44eb('0xd')][_0x44eb('0x9')](hopper2);})['then'](function(){console[_0x44eb('0xb')](_0x44eb('0xe'),_0x44eb('0x11'));})[_0x44eb('0x12')](function(_0xf433ef){console[_0x44eb('0xb')](_0xf433ef);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index de6570e..841903c 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fd4=['all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','%s%s','format','agent','%s%s@xcally.com','password','friend','wss'];(function(_0x594e7a,_0x5455af){var _0x14369d=function(_0x3f4e84){while(--_0x3f4e84){_0x594e7a['push'](_0x594e7a['shift']());}};_0x14369d(++_0x5455af);}(_0x6fd4,0xd3));var _0x46fd=function(_0x1d6fc6,_0x857c7){_0x1d6fc6=_0x1d6fc6-0x0;var _0x595a5a=_0x6fd4[_0x1d6fc6];return _0x595a5a;};'use strict';var util=require(_0x46fd('0x0'));var db=require(_0x46fd('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x46fd('0x2'),'agent',i),'fullname':util[_0x46fd('0x3')](_0x46fd('0x2'),_0x46fd('0x4'),i),'email':util[_0x46fd('0x3')](_0x46fd('0x5'),_0x46fd('0x4'),i),'role':'agent','password':_0x46fd('0x6'),'internal':0xfa0+i,'type':_0x46fd('0x7'),'transport':['udp','ws',_0x46fd('0x8')],'disallow':[_0x46fd('0x9')],'allow':[_0x46fd('0xa')],'defaultuser':util[_0x46fd('0x3')](_0x46fd('0x2'),_0x46fd('0x4'),i),'encryption':_0x46fd('0xb'),'avpf':_0x46fd('0xb'),'force_avp':_0x46fd('0xb'),'icesupport':_0x46fd('0xb'),'dtlsenable':_0x46fd('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x46fd('0xc'),'dtlssetup':_0x46fd('0xd'),'callerid':util['format'](_0x46fd('0xe'),util[_0x46fd('0x3')](_0x46fd('0x2'),'agent',i),0xfa0+i)});}db[_0x46fd('0xf')]['bulkCreate'](users)[_0x46fd('0x10')](function(){console[_0x46fd('0x11')](_0x46fd('0x12'));})[_0x46fd('0x13')](function(_0x547d14){console[_0x46fd('0x11')](_0x547d14);}); \ No newline at end of file +var _0xd38c=['actpass','\x22%s\x22\x20<%s>','%s%s','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s@xcally.com','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x1a50f5,_0x2895ef){var _0x4afc82=function(_0x97a47e){while(--_0x97a47e){_0x1a50f5['push'](_0x1a50f5['shift']());}};_0x4afc82(++_0x2895ef);}(_0xd38c,0x1ab));var _0xcd38=function(_0xc10d17,_0x5b6554){_0xc10d17=_0xc10d17-0x0;var _0x1ed8fb=_0xd38c[_0xc10d17];return _0x1ed8fb;};'use strict';var util=require(_0xcd38('0x0'));var db=require(_0xcd38('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcd38('0x2')]({'name':util['format']('%s%s','agent',i),'fullname':util[_0xcd38('0x3')]('%s%s',_0xcd38('0x4'),i),'email':util[_0xcd38('0x3')](_0xcd38('0x5'),_0xcd38('0x4'),i),'role':'agent','password':_0xcd38('0x6'),'internal':0xfa0+i,'type':_0xcd38('0x7'),'transport':['udp','ws',_0xcd38('0x8')],'disallow':[_0xcd38('0x9')],'allow':[_0xcd38('0xa')],'defaultuser':util[_0xcd38('0x3')]('%s%s',_0xcd38('0x4'),i),'encryption':_0xcd38('0xb'),'avpf':_0xcd38('0xb'),'force_avp':_0xcd38('0xb'),'icesupport':_0xcd38('0xb'),'dtlsenable':_0xcd38('0xb'),'dtlsverify':'no','dtlscertfile':_0xcd38('0xc'),'dtlsprivatekey':_0xcd38('0xd'),'dtlssetup':_0xcd38('0xe'),'callerid':util[_0xcd38('0x3')](_0xcd38('0xf'),util[_0xcd38('0x3')](_0xcd38('0x10'),_0xcd38('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0xcd38('0x11')](function(){console[_0xcd38('0x12')](_0xcd38('0x13'));})[_0xcd38('0x14')](function(_0x33e390){console[_0xcd38('0x12')](_0x33e390);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index ee61876..873977c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda20=['findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','role','Campaign','format','%s:queue:%s','length','user:%s','Agents','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','VoiceQueues','userProfileId','VoiceQueue','ChatQueues','SmsQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','name','User','agent','type','ivr'];(function(_0x2312ad,_0x142f8a){var _0x34d760=function(_0x417e01){while(--_0x417e01){_0x2312ad['push'](_0x2312ad['shift']());}};_0x34d760(++_0x142f8a);}(_0xda20,0x1d9));var _0x0da2=function(_0x1b2ca6,_0x2bbea5){_0x1b2ca6=_0x1b2ca6-0x0;var _0x35e3eb=_0xda20[_0x1b2ca6];return _0x35e3eb;};'use strict';var _=require(_0x0da2('0x0'));var util=require('util');var BPromise=require(_0x0da2('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x0da2('0x2')],'include':[{'as':'Agents','model':db[_0x0da2('0x3')],'attributes':['id',_0x0da2('0x2'),'role'],'raw':!![],'where':{'role':_0x0da2('0x4')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0da2('0x2')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x0da2('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x0da2('0x2')],'where':{'role':_0x0da2('0x4')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0da2('0x2'),_0x0da2('0x5')],'where':{'type':_0x0da2('0x6')}};function getAssociatedResources(_0x3e76ad,_0x131fa8,_0x248bce){return db['UserProfileSection'][_0x0da2('0x7')]({'where':{'name':_0x3e76ad,'userProfileId':_0x131fa8},'raw':!![]})[_0x0da2('0x8')](function(_0x18ff2b){if(_0x18ff2b){if(_0x18ff2b[_0x0da2('0x9')]){switch(_0x3e76ad){case'VoiceQueues':case'ChatQueues':case _0x0da2('0xa'):case _0x0da2('0xb'):case _0x0da2('0xc'):case _0x0da2('0xd'):case _0x0da2('0xe'):return db[_0x248bce][_0x0da2('0xf')](queryQueues);case _0x0da2('0x10'):return db[_0x248bce]['findAll'](queryTelephones);case _0x0da2('0x11'):return db[_0x248bce]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x248bce]['findAll'](queryCampaigns);}}else{return db[_0x0da2('0x12')]['findAll']({'attributes':[_0x0da2('0x13')],'where':{'sectionId':_0x18ff2b['id']},'raw':!![]})[_0x0da2('0x8')](function(_0x5d0f4e){if(_0x5d0f4e){var _0xa0613c={'where':{'id':_[_0x0da2('0x14')](_0x5d0f4e,'resourceId')},'raw':!![]};switch(_0x248bce){case _0x0da2('0x3'):_0xa0613c[_0x0da2('0x15')][_0x0da2('0x16')]='telephone';break;case _0x0da2('0x17'):_0xa0613c[_0x0da2('0x15')]['type']='ivr';break;}return db[_0x248bce][_0x0da2('0xf')](_0xa0613c);}else{return[];}});}}else{return[];}})['then'](function(_0x16e7ab){return _0x16e7ab;});}function joinOrLeaveQueues(_0x569834,_0x522b89,_0x495311,_0x5cf40a){_0x569834[_0x522b89](util[_0x0da2('0x18')](_0x0da2('0x19'),_0x495311,_0x5cf40a[_0x0da2('0x2')]));if(_0x5cf40a['Agents']){for(var _0x5304af=0x0;_0x5304af<_0x5cf40a['Agents'][_0x0da2('0x1a')];_0x5304af+=0x1){_0x569834[_0x522b89](util[_0x0da2('0x18')](_0x0da2('0x1b'),_0x5cf40a[_0x0da2('0x1c')][_0x5304af][_0x0da2('0x2')]));}}}function joinOrLeave(_0x51786b,_0x7a3708,_0x113c40){var _0x1c3ab0;if(_0x51786b[_0x0da2('0x1d')][_0x0da2('0x1e')]['id']){db[_0x0da2('0x3')][_0x0da2('0x1f')]({'attributes':['id',_0x0da2('0x2'),_0x0da2('0x16'),'userProfileId'],'where':{'id':_0x51786b[_0x0da2('0x1d')]['query']['id']},'include':[{'model':db[_0x0da2('0x20')],'as':_0x0da2('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x0da2('0x22')],'as':_0x0da2('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x0da2('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x0da2('0x25')],'as':_0x0da2('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x0da2('0x27')],'as':_0x0da2('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x0da2('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x525dc){if(_0x525dc){_0x1c3ab0=_0x525dc;_0x51786b[_0x7a3708](util[_0x0da2('0x18')](_0x0da2('0x1b'),_0x525dc[_0x0da2('0x2')]));var _0x1d17ad=[];switch(_0x525dc[_0x0da2('0x16')]){case _0x0da2('0x2a'):_0x51786b[_0x7a3708](_0x0da2('0x2b'));_0x51786b[_0x7a3708](_0x0da2('0x2c'));if(queryQueues[_0x0da2('0x2d')](_0x0da2('0x2e'))){delete queryQueues['include'];}_0x1d17ad['push'](db['VoiceQueue'][_0x0da2('0xf')](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db['ChatQueue']['findAll'](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x30')][_0x0da2('0xf')](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db['SmsQueue'][_0x0da2('0xf')](queryQueues));_0x1d17ad['push'](db[_0x0da2('0x31')][_0x0da2('0xf')](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x32')][_0x0da2('0xf')](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x33')]['findAll'](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x3')][_0x0da2('0xf')](queryTelephones));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x34')][_0x0da2('0xf')](queryTrunks));_0x1d17ad['push'](db[_0x0da2('0x17')][_0x0da2('0xf')](queryCampaigns));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x3')]['findAll'](queryAgents));break;case'user':_0x51786b[_0x7a3708](_0x0da2('0x2b'));_0x51786b[_0x7a3708](_0x0da2('0x2c'));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0x35'),_0x525dc[_0x0da2('0x36')],_0x0da2('0x37')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0x38'),_0x525dc[_0x0da2('0x36')],'ChatQueue'));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0xa'),_0x525dc[_0x0da2('0x36')],_0x0da2('0x30')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0xb'),_0x525dc[_0x0da2('0x36')],_0x0da2('0x39')));_0x1d17ad['push'](getAssociatedResources(_0x0da2('0xc'),_0x525dc['userProfileId'],'MailQueue'));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources('OpenchannelQueues',_0x525dc[_0x0da2('0x36')],_0x0da2('0x32')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0xe'),_0x525dc['userProfileId'],_0x0da2('0x33')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0x10'),_0x525dc[_0x0da2('0x36')],_0x0da2('0x3')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0x11'),_0x525dc[_0x0da2('0x36')],'Trunk'));_0x1d17ad['push'](getAssociatedResources(_0x0da2('0x3a'),_0x525dc['userProfileId'],_0x0da2('0x17')));_0x1d17ad['push'](db[_0x0da2('0x3')]['findAll'](queryAgents));break;case'agent':_0x51786b[_0x7a3708]('voice:inbound');_0x51786b[_0x7a3708](_0x0da2('0x2c'));_0x1d17ad[_0x0da2('0x2f')](_0x525dc[_0x0da2('0x3b')]({'attributes':['id',_0x0da2('0x2')]}));_0x1d17ad['push'](_0x525dc[_0x0da2('0x3c')]({'attributes':['id','name']}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc[_0x0da2('0x3d')]({'attributes':['id','name']}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc[_0x0da2('0x3e')]({'attributes':['id',_0x0da2('0x2')]}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc['getMailQueues']({'attributes':['id',_0x0da2('0x2')]}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc['getOpenchannelQueues']({'attributes':['id',_0x0da2('0x2')]}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc[_0x0da2('0x3f')]({'attributes':['id',_0x0da2('0x2')]}));break;}return BPromise['all'](_0x1d17ad);}})[_0x0da2('0x8')](function(_0x5265f2){if(_0x5265f2&&_0x5265f2[_0x0da2('0x1a')]){for(var _0x971567=0x0;_0x971567<_0x5265f2[_0x0da2('0x1a')];_0x971567+=0x1){for(var _0x19fc01=0x0;_0x19fc01<_0x5265f2[_0x971567][_0x0da2('0x1a')];_0x19fc01+=0x1){switch(_0x971567){case 0x0:joinOrLeaveQueues(_0x51786b,_0x7a3708,'voice',_0x5265f2[_0x971567][_0x19fc01]);break;case 0x1:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x40'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x2:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x41'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x3:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x42'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x4:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x43'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x5:joinOrLeaveQueues(_0x51786b,_0x7a3708,'openchannel',_0x5265f2[_0x971567][_0x19fc01]);break;case 0x6:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x44'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x7:if(_0x1c3ab0[_0x0da2('0x16')]!==_0x0da2('0x4'))_0x51786b[_0x7a3708](util[_0x0da2('0x18')](_0x0da2('0x45'),_0x5265f2[_0x971567][_0x19fc01]['name']));break;case 0x8:if(_0x1c3ab0[_0x0da2('0x16')]!==_0x0da2('0x4'))_0x51786b[_0x7a3708](util[_0x0da2('0x18')](_0x0da2('0x46'),_0x5265f2[_0x971567][_0x19fc01][_0x0da2('0x2')]));break;case 0x9:if(_0x1c3ab0[_0x0da2('0x16')]!==_0x0da2('0x4'))_0x51786b[_0x7a3708](util['format'](_0x0da2('0x47'),_0x5265f2[_0x971567][_0x19fc01]['type'],_0x5265f2[_0x971567][_0x19fc01]['name']));break;case 0xa:_0x51786b[_0x7a3708](util['format'](_0x0da2('0x1b'),_0x5265f2[_0x971567][_0x19fc01][_0x0da2('0x2')]));break;}}}}})[_0x0da2('0x8')](function(){if(_0x7a3708===_0x0da2('0x48')){var _0x5537e4=_[_0x0da2('0x14')](_0x1c3ab0['ChatInteractions'],'id');return _0x1c3ab0['removeChatInteractions'](_0x5537e4)['then'](function(){for(var _0x34ddb1=0x0;_0x34ddb1<_0x5537e4[_0x0da2('0x1a')];_0x34ddb1+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x4a'),{'ChatInteractionId':Number(_0x5537e4[_0x34ddb1]),'UserId':Number(_0x1c3ab0['id'])});}});}})['then'](function(){if(_0x7a3708===_0x0da2('0x48')){var _0x42dcd9=_[_0x0da2('0x14')](_0x1c3ab0[_0x0da2('0x23')],'id');return _0x1c3ab0[_0x0da2('0x4b')](_0x42dcd9)[_0x0da2('0x8')](function(){for(var _0x44e99a=0x0;_0x44e99a<_0x42dcd9['length'];_0x44e99a+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x4c'),{'MailInteractionId':Number(_0x42dcd9[_0x44e99a]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x8')](function(){if(_0x7a3708===_0x0da2('0x48')){var _0x11ad94=_['map'](_0x1c3ab0['FaxInteractions'],'id');return _0x1c3ab0[_0x0da2('0x4d')](_0x11ad94)[_0x0da2('0x8')](function(){for(var _0x53b355=0x0;_0x53b355<_0x11ad94['length'];_0x53b355+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x4e'),{'FaxInteractionId':Number(_0x11ad94[_0x53b355]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x8')](function(){if(_0x7a3708===_0x0da2('0x48')){var _0x8c48d6=_[_0x0da2('0x14')](_0x1c3ab0[_0x0da2('0x26')],'id');return _0x1c3ab0[_0x0da2('0x4f')](_0x8c48d6)[_0x0da2('0x8')](function(){for(var _0x2e0236=0x0;_0x2e0236<_0x8c48d6[_0x0da2('0x1a')];_0x2e0236+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x50'),{'SmsInteractionId':Number(_0x8c48d6[_0x2e0236]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x8')](function(){if(_0x7a3708==='leave'){var _0x10cda4=_['map'](_0x1c3ab0['OpenchannelInteractions'],'id');return _0x1c3ab0[_0x0da2('0x51')](_0x10cda4)[_0x0da2('0x8')](function(){for(var _0x33e12e=0x0;_0x33e12e<_0x10cda4[_0x0da2('0x1a')];_0x33e12e+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x52'),{'OpenchannelInteractionId':Number(_0x10cda4[_0x33e12e]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x8')](function(){if(_0x7a3708==='leave'){var _0x50abf1=_[_0x0da2('0x14')](_0x1c3ab0['WhatsappInteractions'],'id');return _0x1c3ab0['removeWhatsappInteractions'](_0x50abf1)[_0x0da2('0x8')](function(){for(var _0x3527cd=0x0;_0x3527cd<_0x50abf1[_0x0da2('0x1a')];_0x3527cd+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x53'),{'WhatsappInteractionId':Number(_0x50abf1[_0x3527cd]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x54')](function(_0x571728){_0x51786b[_0x0da2('0x55')](_0x571728);});}}function onDisconnect(_0xd2d895,_0x1cfc42){joinOrLeave(_0xd2d895,_0x0da2('0x48'),_0x1cfc42);}function onConnect(_0x4d2cf9){joinOrLeave(_0x4d2cf9,_0x0da2('0x56'));}exports[_0x0da2('0x57')]=function(_0x49ef1d){_0x49ef1d['on'](_0x0da2('0x58'),function(_0x5984ab){_0x5984ab[_0x0da2('0x59')](0x0);_0x5984ab[_0x0da2('0x5a')]=_0x5984ab[_0x0da2('0x5b')][_0x0da2('0x58')][_0x0da2('0x5c')]+':'+_0x5984ab[_0x0da2('0x5b')]['connection']['remotePort'];_0x5984ab['connectedAt']=new Date();_0x5984ab[_0x0da2('0x55')]=function(_0x3313b2){console[_0x0da2('0x55')]('SocketIO\x20'+_0x5984ab['nsp'][_0x0da2('0x2')]+'['+_0x5984ab['address']+']',_0x3313b2);};_0x5984ab['on'](_0x0da2('0x5d'),function(){onDisconnect(_0x5984ab,_0x49ef1d);_0x5984ab[_0x0da2('0x55')](_0x0da2('0x5e'));});onConnect(_0x5984ab);_0x5984ab[_0x0da2('0x55')](_0x0da2('0x5f'));});}; \ No newline at end of file +var _0xd663=['find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','OpenchannelQueues','IvrCampaigns','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','agent','telephone:%s','trunk:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remotePort','connectedAt','SocketIO\x20','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','then','telephone','Campaign','where','format','%s:queue:%s','length','user:%s','handshake','query'];(function(_0x3b3bf5,_0x434b70){var _0x1bd291=function(_0x566db3){while(--_0x566db3){_0x3b3bf5['push'](_0x3b3bf5['shift']());}};_0x1bd291(++_0x434b70);}(_0xd663,0x1ed));var _0x3d66=function(_0x3f7e9e,_0x393695){_0x3f7e9e=_0x3f7e9e-0x0;var _0x4432d7=_0xd663[_0x3f7e9e];return _0x4432d7;};'use strict';var _=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var BPromise=require('bluebird');var db=require(_0x3d66('0x2'))['db'];var config=require(_0x3d66('0x3'));var queryQueues={'attributes':['id',_0x3d66('0x4')],'include':[{'as':_0x3d66('0x5'),'model':db[_0x3d66('0x6')],'attributes':['id','name',_0x3d66('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x3d66('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x3d66('0x8')],'where':{'type':_0x3d66('0x9')}};function getAssociatedResources(_0x335b61,_0x11becc,_0x8cc498){return db[_0x3d66('0xa')][_0x3d66('0xb')]({'where':{'name':_0x335b61,'userProfileId':_0x11becc},'raw':!![]})['then'](function(_0x35b2ab){if(_0x35b2ab){if(_0x35b2ab[_0x3d66('0xc')]){switch(_0x335b61){case _0x3d66('0xd'):case'ChatQueues':case _0x3d66('0xe'):case _0x3d66('0xf'):case _0x3d66('0x10'):case'OpenchannelQueues':case _0x3d66('0x11'):return db[_0x8cc498][_0x3d66('0x12')](queryQueues);case _0x3d66('0x13'):return db[_0x8cc498][_0x3d66('0x12')](queryTelephones);case'Trunks':return db[_0x8cc498][_0x3d66('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x8cc498][_0x3d66('0x12')](queryCampaigns);}}else{return db[_0x3d66('0x14')][_0x3d66('0x12')]({'attributes':[_0x3d66('0x15')],'where':{'sectionId':_0x35b2ab['id']},'raw':!![]})[_0x3d66('0x16')](function(_0x153b88){if(_0x153b88){var _0x5628ae={'where':{'id':_['map'](_0x153b88,_0x3d66('0x15'))},'raw':!![]};switch(_0x8cc498){case _0x3d66('0x6'):_0x5628ae['where'][_0x3d66('0x7')]=_0x3d66('0x17');break;case _0x3d66('0x18'):_0x5628ae[_0x3d66('0x19')][_0x3d66('0x8')]=_0x3d66('0x9');break;}return db[_0x8cc498][_0x3d66('0x12')](_0x5628ae);}else{return[];}});}}else{return[];}})[_0x3d66('0x16')](function(_0x1accfb){return _0x1accfb;});}function joinOrLeaveQueues(_0x3902f1,_0x3bf534,_0x353c5f,_0x46e35c){_0x3902f1[_0x3bf534](util[_0x3d66('0x1a')](_0x3d66('0x1b'),_0x353c5f,_0x46e35c['name']));if(_0x46e35c[_0x3d66('0x5')]){for(var _0x5e1516=0x0;_0x5e1516<_0x46e35c[_0x3d66('0x5')][_0x3d66('0x1c')];_0x5e1516+=0x1){_0x3902f1[_0x3bf534](util[_0x3d66('0x1a')](_0x3d66('0x1d'),_0x46e35c[_0x3d66('0x5')][_0x5e1516][_0x3d66('0x4')]));}}}function joinOrLeave(_0x1c851f,_0x1bfa81,_0x1eb922){var _0x4e2c42;if(_0x1c851f[_0x3d66('0x1e')][_0x3d66('0x1f')]['id']){db[_0x3d66('0x6')][_0x3d66('0x20')]({'attributes':['id','name',_0x3d66('0x7'),_0x3d66('0x21')],'where':{'id':_0x1c851f[_0x3d66('0x1e')][_0x3d66('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x3d66('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x3d66('0x23')],'as':_0x3d66('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x3d66('0x25')],'as':_0x3d66('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x3d66('0x27')],'as':_0x3d66('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x3d66('0x29')],'as':_0x3d66('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x3d66('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x3d66('0x16')](function(_0x1dff3b){if(_0x1dff3b){_0x4e2c42=_0x1dff3b;_0x1c851f[_0x1bfa81](util[_0x3d66('0x1a')](_0x3d66('0x1d'),_0x1dff3b[_0x3d66('0x4')]));var _0x41bf36=[];switch(_0x1dff3b[_0x3d66('0x7')]){case _0x3d66('0x2c'):_0x1c851f[_0x1bfa81](_0x3d66('0x2d'));_0x1c851f[_0x1bfa81](_0x3d66('0x2e'));if(queryQueues[_0x3d66('0x2f')]('include')){delete queryQueues['include'];}_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x31')][_0x3d66('0x12')](queryQueues));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x32')][_0x3d66('0x12')](queryQueues));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x33')][_0x3d66('0x12')](queryQueues));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x34')][_0x3d66('0x12')](queryQueues));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x35')][_0x3d66('0x12')](queryQueues));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x36')][_0x3d66('0x12')](queryQueues));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x37')][_0x3d66('0x12')](queryQueues));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x6')]['findAll'](queryTelephones));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x38')][_0x3d66('0x12')](queryTrunks));_0x41bf36['push'](db[_0x3d66('0x18')]['findAll'](queryCampaigns));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x6')]['findAll'](queryAgents));break;case _0x3d66('0x39'):_0x1c851f[_0x1bfa81](_0x3d66('0x2d'));_0x1c851f[_0x1bfa81]('voice:outbound');_0x41bf36[_0x3d66('0x30')](getAssociatedResources(_0x3d66('0xd'),_0x1dff3b['userProfileId'],_0x3d66('0x31')));_0x41bf36[_0x3d66('0x30')](getAssociatedResources(_0x3d66('0x3a'),_0x1dff3b[_0x3d66('0x21')],'ChatQueue'));_0x41bf36[_0x3d66('0x30')](getAssociatedResources('FaxQueues',_0x1dff3b[_0x3d66('0x21')],'FaxQueue'));_0x41bf36[_0x3d66('0x30')](getAssociatedResources(_0x3d66('0xf'),_0x1dff3b[_0x3d66('0x21')],'SmsQueue'));_0x41bf36[_0x3d66('0x30')](getAssociatedResources(_0x3d66('0x10'),_0x1dff3b[_0x3d66('0x21')],_0x3d66('0x35')));_0x41bf36[_0x3d66('0x30')](getAssociatedResources(_0x3d66('0x3b'),_0x1dff3b[_0x3d66('0x21')],_0x3d66('0x36')));_0x41bf36[_0x3d66('0x30')](getAssociatedResources(_0x3d66('0x11'),_0x1dff3b[_0x3d66('0x21')],_0x3d66('0x37')));_0x41bf36[_0x3d66('0x30')](getAssociatedResources('Telephones',_0x1dff3b[_0x3d66('0x21')],_0x3d66('0x6')));_0x41bf36[_0x3d66('0x30')](getAssociatedResources('Trunks',_0x1dff3b['userProfileId'],_0x3d66('0x38')));_0x41bf36[_0x3d66('0x30')](getAssociatedResources(_0x3d66('0x3c'),_0x1dff3b[_0x3d66('0x21')],_0x3d66('0x18')));_0x41bf36[_0x3d66('0x30')](db[_0x3d66('0x6')][_0x3d66('0x12')](queryAgents));break;case'agent':_0x1c851f[_0x1bfa81](_0x3d66('0x2d'));_0x1c851f[_0x1bfa81](_0x3d66('0x2e'));_0x41bf36[_0x3d66('0x30')](_0x1dff3b['getVoiceQueues']({'attributes':['id','name']}));_0x41bf36[_0x3d66('0x30')](_0x1dff3b[_0x3d66('0x3d')]({'attributes':['id',_0x3d66('0x4')]}));_0x41bf36[_0x3d66('0x30')](_0x1dff3b[_0x3d66('0x3e')]({'attributes':['id',_0x3d66('0x4')]}));_0x41bf36[_0x3d66('0x30')](_0x1dff3b[_0x3d66('0x3f')]({'attributes':['id','name']}));_0x41bf36[_0x3d66('0x30')](_0x1dff3b['getMailQueues']({'attributes':['id',_0x3d66('0x4')]}));_0x41bf36[_0x3d66('0x30')](_0x1dff3b[_0x3d66('0x40')]({'attributes':['id','name']}));_0x41bf36[_0x3d66('0x30')](_0x1dff3b[_0x3d66('0x41')]({'attributes':['id',_0x3d66('0x4')]}));break;}return BPromise[_0x3d66('0x42')](_0x41bf36);}})['then'](function(_0x5cb410){if(_0x5cb410&&_0x5cb410[_0x3d66('0x1c')]){for(var _0x52e237=0x0;_0x52e237<_0x5cb410['length'];_0x52e237+=0x1){for(var _0x2b467e=0x0;_0x2b467e<_0x5cb410[_0x52e237][_0x3d66('0x1c')];_0x2b467e+=0x1){switch(_0x52e237){case 0x0:joinOrLeaveQueues(_0x1c851f,_0x1bfa81,_0x3d66('0x43'),_0x5cb410[_0x52e237][_0x2b467e]);break;case 0x1:joinOrLeaveQueues(_0x1c851f,_0x1bfa81,_0x3d66('0x44'),_0x5cb410[_0x52e237][_0x2b467e]);break;case 0x2:joinOrLeaveQueues(_0x1c851f,_0x1bfa81,_0x3d66('0x45'),_0x5cb410[_0x52e237][_0x2b467e]);break;case 0x3:joinOrLeaveQueues(_0x1c851f,_0x1bfa81,_0x3d66('0x46'),_0x5cb410[_0x52e237][_0x2b467e]);break;case 0x4:joinOrLeaveQueues(_0x1c851f,_0x1bfa81,_0x3d66('0x47'),_0x5cb410[_0x52e237][_0x2b467e]);break;case 0x5:joinOrLeaveQueues(_0x1c851f,_0x1bfa81,'openchannel',_0x5cb410[_0x52e237][_0x2b467e]);break;case 0x6:joinOrLeaveQueues(_0x1c851f,_0x1bfa81,_0x3d66('0x48'),_0x5cb410[_0x52e237][_0x2b467e]);break;case 0x7:if(_0x4e2c42[_0x3d66('0x7')]!==_0x3d66('0x49'))_0x1c851f[_0x1bfa81](util[_0x3d66('0x1a')](_0x3d66('0x4a'),_0x5cb410[_0x52e237][_0x2b467e]['name']));break;case 0x8:if(_0x4e2c42[_0x3d66('0x7')]!==_0x3d66('0x49'))_0x1c851f[_0x1bfa81](util[_0x3d66('0x1a')](_0x3d66('0x4b'),_0x5cb410[_0x52e237][_0x2b467e][_0x3d66('0x4')]));break;case 0x9:if(_0x4e2c42[_0x3d66('0x7')]!==_0x3d66('0x49'))_0x1c851f[_0x1bfa81](util['format']('campaign:%s:%s',_0x5cb410[_0x52e237][_0x2b467e]['type'],_0x5cb410[_0x52e237][_0x2b467e][_0x3d66('0x4')]));break;case 0xa:_0x1c851f[_0x1bfa81](util[_0x3d66('0x1a')]('user:%s',_0x5cb410[_0x52e237][_0x2b467e][_0x3d66('0x4')]));break;}}}}})[_0x3d66('0x16')](function(){if(_0x1bfa81===_0x3d66('0x4c')){var _0x362058=_[_0x3d66('0x4d')](_0x4e2c42[_0x3d66('0x22')],'id');return _0x4e2c42[_0x3d66('0x4e')](_0x362058)[_0x3d66('0x16')](function(){for(var _0x30e223=0x0;_0x30e223<_0x362058['length'];_0x30e223+=0x1){_0x1eb922['emit'](_0x3d66('0x4f'),{'ChatInteractionId':Number(_0x362058[_0x30e223]),'UserId':Number(_0x4e2c42['id'])});}});}})['then'](function(){if(_0x1bfa81==='leave'){var _0x36b148=_[_0x3d66('0x4d')](_0x4e2c42[_0x3d66('0x24')],'id');return _0x4e2c42[_0x3d66('0x50')](_0x36b148)[_0x3d66('0x16')](function(){for(var _0x4863d5=0x0;_0x4863d5<_0x36b148[_0x3d66('0x1c')];_0x4863d5+=0x1){_0x1eb922[_0x3d66('0x51')](_0x3d66('0x52'),{'MailInteractionId':Number(_0x36b148[_0x4863d5]),'UserId':Number(_0x4e2c42['id'])});}});}})[_0x3d66('0x16')](function(){if(_0x1bfa81==='leave'){var _0x312181=_[_0x3d66('0x4d')](_0x4e2c42[_0x3d66('0x26')],'id');return _0x4e2c42['removeFaxInteractions'](_0x312181)['then'](function(){for(var _0x4f6ffa=0x0;_0x4f6ffa<_0x312181[_0x3d66('0x1c')];_0x4f6ffa+=0x1){_0x1eb922[_0x3d66('0x51')](_0x3d66('0x53'),{'FaxInteractionId':Number(_0x312181[_0x4f6ffa]),'UserId':Number(_0x4e2c42['id'])});}});}})[_0x3d66('0x16')](function(){if(_0x1bfa81==='leave'){var _0x2ca662=_[_0x3d66('0x4d')](_0x4e2c42['SmsInteractions'],'id');return _0x4e2c42[_0x3d66('0x54')](_0x2ca662)[_0x3d66('0x16')](function(){for(var _0xcb079b=0x0;_0xcb079b<_0x2ca662[_0x3d66('0x1c')];_0xcb079b+=0x1){_0x1eb922[_0x3d66('0x51')](_0x3d66('0x55'),{'SmsInteractionId':Number(_0x2ca662[_0xcb079b]),'UserId':Number(_0x4e2c42['id'])});}});}})[_0x3d66('0x16')](function(){if(_0x1bfa81==='leave'){var _0x5981ad=_['map'](_0x4e2c42[_0x3d66('0x2a')],'id');return _0x4e2c42[_0x3d66('0x56')](_0x5981ad)[_0x3d66('0x16')](function(){for(var _0x32c159=0x0;_0x32c159<_0x5981ad['length'];_0x32c159+=0x1){_0x1eb922[_0x3d66('0x51')](_0x3d66('0x57'),{'OpenchannelInteractionId':Number(_0x5981ad[_0x32c159]),'UserId':Number(_0x4e2c42['id'])});}});}})[_0x3d66('0x16')](function(){if(_0x1bfa81===_0x3d66('0x4c')){var _0x174bca=_[_0x3d66('0x4d')](_0x4e2c42[_0x3d66('0x58')],'id');return _0x4e2c42[_0x3d66('0x59')](_0x174bca)['then'](function(){for(var _0x46ade2=0x0;_0x46ade2<_0x174bca['length'];_0x46ade2+=0x1){_0x1eb922['emit'](_0x3d66('0x5a'),{'WhatsappInteractionId':Number(_0x174bca[_0x46ade2]),'UserId':Number(_0x4e2c42['id'])});}});}})[_0x3d66('0x5b')](function(_0x172d4e){_0x1c851f[_0x3d66('0x5c')](_0x172d4e);});}}function onDisconnect(_0x85c072,_0x233719){joinOrLeave(_0x85c072,_0x3d66('0x4c'),_0x233719);}function onConnect(_0x2172ac){joinOrLeave(_0x2172ac,_0x3d66('0x5d'));}exports[_0x3d66('0x5e')]=function(_0x279b47){_0x279b47['on'](_0x3d66('0x5f'),function(_0x4cea34){_0x4cea34[_0x3d66('0x60')](0x0);_0x4cea34['address']=_0x4cea34[_0x3d66('0x61')]['connection']['remoteAddress']+':'+_0x4cea34[_0x3d66('0x61')][_0x3d66('0x5f')][_0x3d66('0x62')];_0x4cea34[_0x3d66('0x63')]=new Date();_0x4cea34[_0x3d66('0x5c')]=function(_0x13d75f){console[_0x3d66('0x5c')](_0x3d66('0x64')+_0x4cea34['nsp'][_0x3d66('0x4')]+'['+_0x4cea34[_0x3d66('0x65')]+']',_0x13d75f);};_0x4cea34['on'](_0x3d66('0x66'),function(){onDisconnect(_0x4cea34,_0x279b47);_0x4cea34['log'](_0x3d66('0x67'));});onConnect(_0x4cea34);_0x4cea34[_0x3d66('0x5c')](_0x3d66('0x68'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 9676ee6..3a1139b 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 _0x5536=['Sequelize','contact','interface','changed','closed','substatus','User','fullname','email','internal','default','length','model','hook','callback','toLowerCase','condition','../../mysqldb','jayson/promise','triggers','client','http','Chat','afterCreate','newinteraction','afterUpdate','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','info','Trigger,\x20%s','error','code','get','channel','motionChannel','direction','resolve','then','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','undefined','UserId','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','catch','AfterCreateMessage','offlineMessage','event','ContactId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5536,0x131));var _0x6553=function(_0x5161c4,_0x174ccf){_0x5161c4=_0x5161c4-0x0;var _0x5548d9=_0x5536[_0x5161c4];return _0x5548d9;};'use strict';var util=require('util');var db=require(_0x6553('0x0'))['db'];var jayson=require(_0x6553('0x1'));var logger=require('../logger')(_0x6553('0x2'));var client=jayson[_0x6553('0x3')][_0x6553('0x4')]({'port':0x232a});var triggers=[{'channel':_0x6553('0x5'),'model':'ChatInteraction','event':_0x6553('0x6'),'condition':_0x6553('0x7'),'callback':afterCreate},{'channel':_0x6553('0x5'),'model':'ChatInteraction','event':_0x6553('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6553('0x5'),'model':'ChatMessage','event':_0x6553('0x6'),'condition':_0x6553('0x9'),'callback':afterCreateMessage},{'channel':_0x6553('0x5'),'model':'ChatOfflineMessage','event':_0x6553('0x6'),'condition':_0x6553('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0x6553('0xa'),'model':_0x6553('0xb'),'event':_0x6553('0x6'),'condition':_0x6553('0x7'),'callback':afterCreate},{'channel':_0x6553('0xa'),'model':_0x6553('0xb'),'event':_0x6553('0x8'),'condition':_0x6553('0xc'),'callback':afterUpdate},{'channel':_0x6553('0xa'),'model':_0x6553('0xd'),'event':_0x6553('0x6'),'condition':_0x6553('0x9'),'callback':afterCreateMessage},{'channel':_0x6553('0xe'),'model':_0x6553('0xf'),'event':_0x6553('0x6'),'condition':_0x6553('0x7'),'callback':afterCreate},{'channel':_0x6553('0xe'),'model':_0x6553('0xf'),'event':_0x6553('0x8'),'condition':_0x6553('0xc'),'callback':afterUpdate},{'channel':_0x6553('0xe'),'model':_0x6553('0x10'),'event':_0x6553('0x6'),'condition':_0x6553('0x9'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x6553('0x11'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x6553('0x12'),'model':'FaxInteraction','event':_0x6553('0x8'),'condition':_0x6553('0xc'),'callback':afterUpdate},{'channel':_0x6553('0x12'),'model':_0x6553('0x13'),'event':_0x6553('0x6'),'condition':_0x6553('0x9'),'callback':afterCreateMessage},{'channel':_0x6553('0x14'),'model':_0x6553('0x15'),'event':_0x6553('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0x6553('0x15'),'event':_0x6553('0x8'),'condition':_0x6553('0xc'),'callback':afterUpdate},{'channel':'Mail','model':_0x6553('0x16'),'event':_0x6553('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x6553('0x17'),'model':_0x6553('0x18'),'event':_0x6553('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6553('0x17'),'model':'OpenchannelInteraction','event':_0x6553('0x8'),'condition':_0x6553('0xc'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x6553('0x6'),'condition':_0x6553('0x9'),'callback':afterCreateMessage}];function request(_0x3a1107){return client[_0x6553('0x19')](_0x6553('0x1a'),_0x3a1107)['then'](function(_0x530f61){logger[_0x6553('0x1b')](_0x6553('0x1c'),_0x6553('0x1a'),_0x530f61);if(_0x530f61['error']){if(_0x530f61[_0x6553('0x1d')][_0x6553('0x1e')]===0x1f4){logger[_0x6553('0x1d')](_0x6553('0x1c'),'EventManager',_0x530f61[_0x6553('0x1d')]);}}})['catch'](function(_0x3a60fc){logger[_0x6553('0x1d')](_0x6553('0x1c'),'EventManager',_0x3a60fc);});}function afterCreateMessage(_0x20027c){return function(_0x195486){_0x195486=_0x195486[_0x6553('0x1f')]({'plain':!![]});_0x195486[_0x6553('0x20')]=_0x20027c;_0x195486[_0x6553('0x21')]=_0x20027c;_0x195486['event']=_0x195486[_0x6553('0x22')];Promise[_0x6553('0x23')]()[_0x6553('0x24')](function(){if(typeof _0x195486['ContactId']==='undefined')return null;var _0x49643c=_0x6553('0x25')+_0x195486['ContactId'];return db[_0x6553('0x26')][_0x6553('0x27')](_0x49643c,{'type':db['Sequelize'][_0x6553('0x28')][_0x6553('0x29')],'raw':!![]});})['then'](function(_0x1dcd6d){if(_0x1dcd6d){_0x195486['contact']=_0x1dcd6d[0x0];}if(typeof _0x195486['UserId']===_0x6553('0x2a'))return;return getAgent(_0x195486[_0x6553('0x2b')]);})[_0x6553('0x24')](function(_0x417935){if(_0x417935){_0x195486['interface']=util[_0x6553('0x2c')](_0x6553('0x2d'),_0x417935[_0x6553('0x2e')]);_0x195486[_0x6553('0x2f')]=_0x417935;_0x195486['channel']=_0x20027c;return request({'event':_0x6553('0x30'),'message':_0x195486});}else{return request({'event':_0x6553('0x31'),'message':_0x195486});}})[_0x6553('0x32')](function(_0x57486b){logger[_0x6553('0x1d')]('Trigger,\x20%s',_0x6553('0x33'),_0x57486b);});};}function afterCreateOfflineMessage(_0x451445){return function(_0x337ea0){_0x337ea0=_0x337ea0[_0x6553('0x1f')]({'plain':!![]});_0x337ea0[_0x6553('0x20')]=_0x451445;_0x337ea0['motionChannel']=_0x451445;_0x337ea0['event']=_0x6553('0x34');return request({'event':_0x337ea0[_0x6553('0x35')],'message':_0x337ea0});};}function afterCreate(_0x44088e,_0x3a3cb9){return function(_0x71ba1d){var _0x259bbf=_0x71ba1d['get']({'plain':!![]});_0x259bbf[_0x6553('0x20')]=_0x44088e;_0x259bbf[_0x6553('0x21')]=_0x44088e;_0x259bbf[_0x6553('0x35')]='opened';Promise[_0x6553('0x23')]()[_0x6553('0x24')](function(){var _0x15c557=_0x6553('0x25')+_0x259bbf[_0x6553('0x36')];return db[_0x6553('0x26')][_0x6553('0x27')](_0x15c557,{'type':db[_0x6553('0x37')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x6553('0x24')](function(_0x4cdc07){if(_0x4cdc07){_0x259bbf[_0x6553('0x38')]=_0x4cdc07[0x0];}if(_0x259bbf[_0x6553('0x2b')]){return getAgent(_0x259bbf[_0x6553('0x2b')]);}return;})['then'](function(_0x2ac220){if(_0x2ac220){_0x259bbf[_0x6553('0x39')]=util[_0x6553('0x2c')](_0x6553('0x2d'),_0x2ac220['name']);_0x259bbf[_0x6553('0x2f')]=_0x2ac220;}return request({'event':_0x3a3cb9,'message':_0x259bbf});})[_0x6553('0x32')](function(_0x5b2119){logger[_0x6553('0x1d')](_0x6553('0x1c'),'AfterCreate',_0x5b2119);});};}function afterUpdate(_0xe0e464){return function(_0x173632){var _0xfd7319=_0x173632[_0x6553('0x3a')](_0x6553('0x3b'))&&_0x173632['closed'];var _0x485f18=_0x173632['changed'](_0x6553('0x3c'));if(_0xfd7319||_0x485f18){var _0x573333=_0xfd7319?'closedinteraction':_0x6553('0x3c');var _0x1a50af=_0x173632[_0x6553('0x1f')]({'plain':!![]});_0x1a50af[_0x6553('0x20')]=_0xe0e464;_0x1a50af['motionChannel']=_0xe0e464;_0x1a50af[_0x6553('0x35')]=_0xfd7319?'closed':_0x6553('0x3c');var _0x1868b4=_0x6553('0x25')+_0x1a50af[_0x6553('0x36')];return db[_0x6553('0x26')][_0x6553('0x27')](_0x1868b4,{'type':db[_0x6553('0x37')][_0x6553('0x28')][_0x6553('0x29')],'raw':!![]})['then'](function(_0x55ec51){if(_0x55ec51){_0x1a50af[_0x6553('0x38')]=_0x55ec51[0x0];}if(typeof _0x1a50af['UserId']===_0x6553('0x2a'))return;return getAgent(_0x1a50af[_0x6553('0x2b')]);})[_0x6553('0x24')](function(_0x190721){if(_0x190721){_0x1a50af['interface']=util['format'](_0x6553('0x2d'),_0x190721[_0x6553('0x2e')]);_0x1a50af[_0x6553('0x2f')]=_0x190721;}return request({'event':_0x573333,'message':_0x1a50af});})[_0x6553('0x32')](function(_0x697800){logger[_0x6553('0x1d')]('Trigger,\x20%s','AfterUpdate',_0x697800);});}};}function getAgent(_0x2c4631){return db[_0x6553('0x3d')]['find']({'where':{'id':_0x2c4631},'attributes':['id',_0x6553('0x2e'),_0x6553('0x3e'),_0x6553('0x3f'),_0x6553('0x40')],'raw':!![]})[_0x6553('0x24')](function(_0x57f579){return _0x57f579;});}exports[_0x6553('0x41')]=function(){for(var _0x50652b=0x0;_0x50652b=_0x59156b[_0x4b52('0x14')]){throw Error(_0x4b52('0x15'));}_0x253e66(_0x1f8e99);})['catch'](function(_0x506a1c){_0x558f1b(_0x506a1c);});});}; \ No newline at end of file +var _0x6a57=['chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','../mysqldb','./license/util','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a57,0x13f));var _0x76a5=function(_0x21b0ef,_0x2bec64){_0x21b0ef=_0x21b0ef-0x0;var _0x135500=_0x6a57[_0x21b0ef];return _0x135500;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x76a5('0x0'))['db'];var util=require(_0x76a5('0x1'));var channels=[_0x76a5('0x2'),'mail',_0x76a5('0x3'),_0x76a5('0x4'),_0x76a5('0x5'),_0x76a5('0x6'),_0x76a5('0x7')];exports[_0x76a5('0x8')]=function(){return channels;};exports[_0x76a5('0x9')]=function(_0x1d9376){_0x1d9376=_0x1d9376['toLowerCase']();return _[_0x76a5('0xa')](channels,_0x1d9376);};exports[_0x76a5('0xb')]=function(_0xe8a53b,_0x221bbb,_0x3f9182,_0xa76b06){var _0x192ac9={'loginAttempts':_0x221bbb,'blocked':_0x3f9182};if(!_[_0x76a5('0xc')](_0xa76b06)){_0x192ac9[_0x76a5('0xd')]=_0xa76b06;}return _0xe8a53b[_0x76a5('0xe')](_0x192ac9);};exports[_0x76a5('0xf')]=function(_0x3fa01a){return new BPromise(function(_0x28b026,_0x11b619){var _0x3977e9=0x0;if(_0x3fa01a[_0x76a5('0x10')]!=='agent'){_0x28b026(_0x3fa01a);}db['User'][_0x76a5('0x11')]({'where':{'role':_0x76a5('0x12'),'online':!![],'id':{'$ne':_0x3fa01a['id']}}})[_0x76a5('0x13')](function(_0x1df477){_0x3977e9=_0x1df477;return util[_0x76a5('0xf')]();})['then'](function(_0x11814a){if(_0x11814a&&_0x11814a[_0x76a5('0x14')]&&_0x3977e9>=_0x11814a[_0x76a5('0x14')]){throw Error(_0x76a5('0x15'));}_0x28b026(_0x3fa01a);})[_0x76a5('0x16')](function(_0x350452){_0x11b619(_0x350452);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 2bf95a7..df65a38 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea82=['api','message','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','statusMessage','util'];(function(_0x4641b3,_0xad3d46){var _0xbcd73b=function(_0x47fe25){while(--_0x47fe25){_0x4641b3['push'](_0x4641b3['shift']());}};_0xbcd73b(++_0xad3d46);}(_0xea82,0x131));var _0x2ea8=function(_0x5d93a4,_0x10fca8){_0x5d93a4=_0x5d93a4-0x0;var _0x17b491=_0xea82[_0x5d93a4];return _0x17b491;};'use strict';var util=require(_0x2ea8('0x0'));var logger=require('../config/logger')(_0x2ea8('0x1'));var APIError=function(_0x1e5c10,_0x2a74f7){this[_0x2ea8('0x2')]=_0x1e5c10||'Internal\x20Server\x20Error';this[_0x2ea8('0x3')]=_0x2a74f7||'Error';util[_0x2ea8('0x4')](APIError,Error);};var APIBadRequestError=function(_0x19148){this[_0x2ea8('0x2')]=_0x19148||_0x2ea8('0x5');this[_0x2ea8('0x3')]=_0x2ea8('0x5');util[_0x2ea8('0x4')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x13aa3b){this[_0x2ea8('0x2')]=_0x13aa3b||_0x2ea8('0x6');this[_0x2ea8('0x3')]=_0x2ea8('0x6');util[_0x2ea8('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x5895f1){this['message']=_0x5895f1||_0x2ea8('0x7');this[_0x2ea8('0x3')]=_0x2ea8('0x8');util[_0x2ea8('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xfee93b){this[_0x2ea8('0x2')]=_0xfee93b||_0x2ea8('0x9');this['name']=_0x2ea8('0xa');this[_0x2ea8('0xb')]=0x193;this[_0x2ea8('0xc')]={'type':_0x2ea8('0xd')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x49c729){this[_0x2ea8('0x2')]=_0x49c729||_0x2ea8('0xe');this[_0x2ea8('0x3')]=_0x2ea8('0xf');util[_0x2ea8('0x4')](APIBadRequestError,APIError);};function getStatusCode(_0x3fd813){switch(_0x3fd813){case _0x2ea8('0x5'):return 0x190;case _0x2ea8('0x6'),_0x2ea8('0xa'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1afc64){if(_0x1afc64==='Out\x20Of\x20Interval')return _0x1afc64;return null;}function handleError(_0x106528){return function(_0xb1e33f){logger[_0x2ea8('0x10')](_0xb1e33f['stack']);var _0x17c724=getStatusCode(_0xb1e33f['name']);var _0x312ca7=getCustomStatusMessage(_0xb1e33f[_0x2ea8('0x3')]);if(_0xb1e33f['name']){delete _0xb1e33f['name'];}if(_0x312ca7){_0x106528[_0x2ea8('0x11')]=_0x312ca7;}return _0x106528['status'](_0x17c724)['send'](_0xb1e33f);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x2ead=['send','exports','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Out\x20Of\x20Interval','code','details','OutOfInterval','stack','statusMessage'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0x2ead,0xdf));var _0xd2ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ead[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var logger=require(_0xd2ea('0x0'))(_0xd2ea('0x1'));var APIError=function(_0x122772,_0x5afe18){this[_0xd2ea('0x2')]=_0x122772||'Internal\x20Server\x20Error';this[_0xd2ea('0x3')]=_0x5afe18||_0xd2ea('0x4');util[_0xd2ea('0x5')](APIError,Error);};var APIBadRequestError=function(_0x55c37b){this[_0xd2ea('0x2')]=_0x55c37b||_0xd2ea('0x6');this[_0xd2ea('0x3')]=_0xd2ea('0x6');util[_0xd2ea('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x53ea93){this[_0xd2ea('0x2')]=_0x53ea93||_0xd2ea('0x7');this[_0xd2ea('0x3')]=_0xd2ea('0x7');util[_0xd2ea('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x3c273f){this[_0xd2ea('0x2')]=_0x3c273f||_0xd2ea('0x8');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2b17db){this[_0xd2ea('0x2')]=_0x2b17db||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this['name']=_0xd2ea('0x9');this[_0xd2ea('0xa')]=0x193;this[_0xd2ea('0xb')]={'type':_0xd2ea('0xc')};util[_0xd2ea('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x2ca59a){this[_0xd2ea('0x2')]=_0x2ca59a||'Resource\x20Conflict';this[_0xd2ea('0x3')]='Conflict';util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x398d6d){switch(_0x398d6d){case'Bad\x20Request':return 0x190;case _0xd2ea('0x7'),_0xd2ea('0x9'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1fed33){if(_0x1fed33==='Out\x20Of\x20Interval')return _0x1fed33;return null;}function handleError(_0x16e169){return function(_0x5adf88){logger['error'](_0x5adf88[_0xd2ea('0xd')]);var _0x33e7da=getStatusCode(_0x5adf88[_0xd2ea('0x3')]);var _0x28e039=getCustomStatusMessage(_0x5adf88['name']);if(_0x5adf88[_0xd2ea('0x3')]){delete _0x5adf88[_0xd2ea('0x3')];}if(_0x28e039){_0x16e169[_0xd2ea('0xe')]=_0x28e039;}return _0x16e169['status'](_0x33e7da)[_0xd2ea('0xf')](_0x5adf88);};}module[_0xd2ea('0x10')]={'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 2bb9f86..663a4ed 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcece=['status','render','json','send'];(function(_0x47ae6c,_0x268531){var _0x360bdd=function(_0x4e6534){while(--_0x4e6534){_0x47ae6c['push'](_0x47ae6c['shift']());}};_0x360bdd(++_0x268531);}(_0xcece,0x1f4));var _0xecec=function(_0x11f854,_0x1e3488){_0x11f854=_0x11f854-0x0;var _0x5cfb7e=_0xcece[_0x11f854];return _0x5cfb7e;};'use strict';module['exports'][0x194]=function pageNotFound(_0x31c68c,_0x616db7){var _0x27a19a='404';var _0x2fd38a=0x194;var _0x4e01ab={'status':_0x2fd38a};_0x616db7[_0xecec('0x0')](_0x4e01ab[_0xecec('0x0')]);_0x616db7[_0xecec('0x1')](_0x27a19a,{},function(_0x372ee1,_0x3ee8b3){if(_0x372ee1){return _0x616db7[_0xecec('0x0')](_0x4e01ab[_0xecec('0x0')])[_0xecec('0x2')](_0x4e01ab);}_0x616db7[_0xecec('0x3')](_0x3ee8b3);});}; \ No newline at end of file +var _0x9d05=['send','exports','404','status','json'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x9d05,0x1cd));var _0x59d0=function(_0x5d348c,_0x1f5b82){_0x5d348c=_0x5d348c-0x0;var _0x374822=_0x9d05[_0x5d348c];return _0x374822;};'use strict';module[_0x59d0('0x0')][0x194]=function pageNotFound(_0xd5846,_0x5245a6){var _0x12414a=_0x59d0('0x1');var _0x58bd4b=0x194;var _0x59068b={'status':_0x58bd4b};_0x5245a6[_0x59d0('0x2')](_0x59068b[_0x59d0('0x2')]);_0x5245a6['render'](_0x12414a,{},function(_0x7b2996,_0xc63c80){if(_0x7b2996){return _0x5245a6[_0x59d0('0x2')](_0x59068b[_0x59d0('0x2')])[_0x59d0('0x3')](_0x59068b);}_0x5245a6[_0x59d0('0x4')](_0xc63c80);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 14e3043..407d47e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4b2=['UserFaxQueue','team_has_fax_queues','SmsAccountId','Answers','SmsMessage','mandatoryDispositionPause','IntervalId','sms_interaction_has_tags','ThroughTags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Members','CompanyId','Phones','CmContactId','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','moh_has_sounds','ItemType','Hopper','AllConditions','AllCondition','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','SugarcrmAccount','DeskAccount','DeskField','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','FreshsalesField','FromId','ToId','SessionId','JscriptyProject','ProjectId','team_has_mail_queues','team_has_chat_queues','team_has_sms_queues','team_has_whatsapp_queues','VoicePrefix','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','ToChatQueueId','ToQueue','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','whatsapp_interaction_has_tags','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','determine','motion2','xcall','xC@LL1234','mysql','name','utf8','utf8_general_ci','127.0.0.1','utf8mb4','database','password','options','sequelizeHistory','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','../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/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','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','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/integration/integration.model','Network','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','UserId','userSetting','cascade','hasMany','Recordings','Extensions','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','CmHopper','Hoppers','belongsTo','userProfileId','belongsToMany','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','VoiceContext','Applications','Sounds','VoiceQueueId','HopperFinals','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPauseId','Agents','Teams','BlackLists','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','CloudProviderId','restrict','MailServerOut','MailAccount','MailAccountId','Imap','Smtp','Dispositions','Messages','Interactions','Template','TemplateId','user_has_mail_accounts','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','Users','user_has_mail_interactions','Attachment','Attachments','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','List','ListId','Dashboard','FaxAccountId','FaxApplication','FaxInteractionId','fax_interaction_has_tags','Interaction','AttachmentId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa4b2,0x80));var _0x2a4b=function(_0x5c5c3e,_0x45f203){_0x5c5c3e=_0x5c5c3e-0x0;var _0x34b64=_0xa4b2[_0x5c5c3e];return _0x34b64;};'use strict';var config=require(_0x2a4b('0x0'));var Sequelize=require(_0x2a4b('0x1'));var _=require(_0x2a4b('0x2'));var jstz=require('jstz');var timezone=jstz[_0x2a4b('0x3')]();config[_0x2a4b('0x1')]=_['defaultsDeep'](config[_0x2a4b('0x1')],{'database':_0x2a4b('0x4'),'username':_0x2a4b('0x5'),'password':_0x2a4b('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x2a4b('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x2a4b('0x8')](),'define':{'charset':_0x2a4b('0x9'),'collate':_0x2a4b('0xa')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x2a4b('0x4'),'username':_0x2a4b('0x5'),'password':_0x2a4b('0x6'),'options':{'host':_0x2a4b('0xb'),'port':0xcea,'dialect':_0x2a4b('0x7'),'dialectOptions':{'charset':_0x2a4b('0xc')},'logging':![],'timezone':timezone[_0x2a4b('0x8')](),'define':{'charset':'utf8','collate':_0x2a4b('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x2a4b('0xd')],config[_0x2a4b('0x1')]['username'],config[_0x2a4b('0x1')][_0x2a4b('0xe')],config[_0x2a4b('0x1')][_0x2a4b('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2a4b('0x10')][_0x2a4b('0xd')],config['sequelizeHistory']['username'],config[_0x2a4b('0x10')][_0x2a4b('0xe')],config['sequelizeHistory'][_0x2a4b('0xf')])};db[_0x2a4b('0x11')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x12'));db[_0x2a4b('0x13')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x15'));db['VoiceContext']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x16'));db[_0x2a4b('0x17')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x18'));db[_0x2a4b('0x19')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x1a'));db[_0x2a4b('0x1b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0x2a4b('0x1c')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0x2a4b('0x1d')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x1e'));db[_0x2a4b('0x1f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x20'));db[_0x2a4b('0x21')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x22'));db[_0x2a4b('0x23')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x24'));db['VoiceDialReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x25'));db[_0x2a4b('0x26')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x27'));db[_0x2a4b('0x28')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x29'));db['MemberReport']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x2a'));db[_0x2a4b('0x2b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x2c'));db[_0x2a4b('0x2d')]=db['sequelize']['import'](_0x2a4b('0x2e'));db[_0x2a4b('0x2f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x30'));db[_0x2a4b('0x31')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x32'));db[_0x2a4b('0x33')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x34'));db[_0x2a4b('0x35')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x36'));db['UserFaxQueue']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x37'));db['UserSmsQueue']=db['sequelize']['import'](_0x2a4b('0x38'));db[_0x2a4b('0x39')]=db['sequelize'][_0x2a4b('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x2a4b('0x3a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x3b'));db[_0x2a4b('0x3c')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x3d'));db['MailAccount']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x3e'));db[_0x2a4b('0x3f')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x40'));db[_0x2a4b('0x41')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x42'));db[_0x2a4b('0x43')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x44'));db[_0x2a4b('0x45')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x46'));db[_0x2a4b('0x47')]=db['sequelize'][_0x2a4b('0x14')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x48'));db[_0x2a4b('0x49')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x4a'));db[_0x2a4b('0x4b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x4c'));db['FaxApplication']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x4d'));db[_0x2a4b('0x4e')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x4f'));db[_0x2a4b('0x50')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x51'));db[_0x2a4b('0x52')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x53'));db[_0x2a4b('0x54')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x55'));db[_0x2a4b('0x56')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/smsApplication/smsApplication.model');db[_0x2a4b('0x57')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x58'));db['SmsMessage']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x59'));db[_0x2a4b('0x5a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x5b'));db[_0x2a4b('0x5c')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x5d'));db[_0x2a4b('0x5e')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x5f'));db[_0x2a4b('0x60')]=db[_0x2a4b('0x1')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x2a4b('0x61')]=db['sequelize']['import'](_0x2a4b('0x62'));db[_0x2a4b('0x63')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x64'));db[_0x2a4b('0x65')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x66'));db['OpenchannelQueueReport']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x67'));db[_0x2a4b('0x68')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x69'));db[_0x2a4b('0x6a')]=db[_0x2a4b('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x2a4b('0x6b')]=db['sequelize'][_0x2a4b('0x14')]('../api/chatMessage/chatMessage.model');db[_0x2a4b('0x6c')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x6d'));db[_0x2a4b('0x6e')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x6f'));db[_0x2a4b('0x70')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/chatGroup/chatGroup.model');db[_0x2a4b('0x71')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x72'));db[_0x2a4b('0x73')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x74'));db['CmContact']=db[_0x2a4b('0x1')]['import']('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x75'));db[_0x2a4b('0x76')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x77'));db[_0x2a4b('0x78')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x79'));db[_0x2a4b('0x7a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x2a4b('0x7b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x7c'));db[_0x2a4b('0x7d')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x7e'));db[_0x2a4b('0x7f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/action/action.model');db[_0x2a4b('0x80')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x81'));db[_0x2a4b('0x82')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x83'));db[_0x2a4b('0x84')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x85'));db[_0x2a4b('0x86')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x87'));db['Interval']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/interval/interval.model');db[_0x2a4b('0x88')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x89'));db['Cdr']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x8a'));db[_0x2a4b('0x8b')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x8c'));db[_0x2a4b('0x8d')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x8e'));db[_0x2a4b('0x8f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x90'));db['Tag']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x91'));db[_0x2a4b('0x92')]=db['sequelize']['import'](_0x2a4b('0x93'));db[_0x2a4b('0x94')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x95'));db[_0x2a4b('0x96')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x97'));db[_0x2a4b('0x98')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x99'));db[_0x2a4b('0x9a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/variable/variable.model');db[_0x2a4b('0x9b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/integration/integration.model');db[_0x2a4b('0x9c')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x9d'));db['AnalyticCustomReport']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x9e'));db[_0x2a4b('0x9f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xa0'));db[_0x2a4b('0xa1')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xa2'));db['AnalyticMetric']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xa3'));db[_0x2a4b('0xa4')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xa5'));db['AnalyticTreeReport']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xa6'));db[_0x2a4b('0xa7')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xa8'));db[_0x2a4b('0xa9')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xaa'));db[_0x2a4b('0xab')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xac'));db['SugarcrmAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xad'));db[_0x2a4b('0xae')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xaf'));db[_0x2a4b('0xb0')]=db['sequelize']['import'](_0x2a4b('0xb1'));db['DeskAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0x2a4b('0xb2')]=db['sequelize'][_0x2a4b('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xb3'));db['ZohoAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xb4'));db[_0x2a4b('0xb5')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xb6'));db[_0x2a4b('0xb7')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/intZohoField/intZohoField.model');db[_0x2a4b('0xb8')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xb9'));db[_0x2a4b('0xba')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xbb'));db[_0x2a4b('0xbc')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xbd'));db[_0x2a4b('0xbe')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xbf'));db[_0x2a4b('0xc0')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x2a4b('0xc1')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xc2'));db[_0x2a4b('0xc3')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xc4'));db['VtigerConfiguration']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xc5'));db[_0x2a4b('0xc6')]=db['sequelize']['import'](_0x2a4b('0xc7'));db['ServicenowAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xc8'));db[_0x2a4b('0xc9')]=db[_0x2a4b('0x1')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x2a4b('0xca')]=db[_0x2a4b('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x2a4b('0xcb')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xcc'));db[_0x2a4b('0xcd')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x2a4b('0xce')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xcf'));db[_0x2a4b('0xd0')]=db['sequelize'][_0x2a4b('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x2a4b('0xd1')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xd2'));db['FreshsalesField']=db[_0x2a4b('0x1')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xd3'));db[_0x2a4b('0xd4')]=db['sequelize'][_0x2a4b('0x14')]('../api/network/network.model');db[_0x2a4b('0xd5')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x2a4b('0xd6')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xd7'));db[_0x2a4b('0xd8')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xd9'));db[_0x2a4b('0xda')]=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xdb'));db[_0x2a4b('0xdc')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xdd'));db[_0x2a4b('0xde')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xdf'));db['SquareDetailsReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xe0'));db[_0x2a4b('0xe1')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xe2'));db[_0x2a4b('0xe3')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x2a4b('0xe4')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xe5'));db[_0x2a4b('0xe6')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0xe7'));db[_0x2a4b('0xe8')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/squareMessage/squareMessage.model');db[_0x2a4b('0xe9')]=db['sequelize']['import'](_0x2a4b('0xea'));db['License']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xeb'));db['Campaign']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0xec'));db[_0x2a4b('0xed')]=db[_0x2a4b('0x1')]['import']('../api/migration/migration.model');db['Attachment']=db['sequelize']['import'](_0x2a4b('0xee'));db[_0x2a4b('0xef')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0x2a4b('0xf0')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xf1'));db[_0x2a4b('0xf2')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xf3'));db['OpenchannelTransferReport']=db['sequelize'][_0x2a4b('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0xf4'));db[_0x2a4b('0xf5')]=db['sequelize'][_0x2a4b('0x14')]('../api/cmList/cmList.model');db['VoicePrefix']=db['sequelize']['import'](_0x2a4b('0xf6'));db[_0x2a4b('0xf7')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/userProfile/userProfile.model');db[_0x2a4b('0xf8')]=db['sequelize'][_0x2a4b('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x2a4b('0xf9')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xfa'));db[_0x2a4b('0xfb')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xfc'));db[_0x2a4b('0xfd')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xfe'));db[_0x2a4b('0xff')]=db['sequelize']['import'](_0x2a4b('0x100'));db[_0x2a4b('0x101')]=db['sequelize'][_0x2a4b('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x102'));db[_0x2a4b('0x103')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x104'));db[_0x2a4b('0x105')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x2a4b('0x106')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x107'));db[_0x2a4b('0x108')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x109'));db[_0x2a4b('0x10a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x2a4b('0x10b')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x10c'));db[_0x2a4b('0x10d')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x10e'));db[_0x2a4b('0x10f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x110'));db[_0x2a4b('0x111')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x112'));db[_0x2a4b('0x11')][_0x2a4b('0x113')](db['VoiceMail'],{'as':_0x2a4b('0x1f'),'onDelete':'cascade','foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x113')](db['UserSetting'],{'as':_0x2a4b('0x115'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db[_0x2a4b('0x1c')],{'as':_0x2a4b('0x118'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')]['hasMany'](db[_0x2a4b('0x2f')],{'as':'VoiceQueuesRt','foreignKey':_0x2a4b('0x114')});db['User'][_0x2a4b('0x117')](db[_0x2a4b('0x17')],{'as':_0x2a4b('0x119'),'onDelete':_0x2a4b('0x116'),'hooks':!![]});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db['CmHopperHistory'],{'as':_0x2a4b('0x11a'),'foreignKey':'UserId'});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db[_0x2a4b('0x7b')],{'as':_0x2a4b('0x7b'),'foreignKey':_0x2a4b('0x114')});db['User']['hasMany'](db[_0x2a4b('0x60')],{'as':_0x2a4b('0x11b'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db[_0x2a4b('0x6a')],{'as':_0x2a4b('0x11c'),'foreignKey':_0x2a4b('0x114')});db['User'][_0x2a4b('0x117')](db[_0x2a4b('0x57')],{'as':_0x2a4b('0x11d'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db[_0x2a4b('0x4e')],{'as':_0x2a4b('0x11e'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db['MailInteraction'],{'as':_0x2a4b('0x11f'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x2a4b('0x114')});db['User']['hasMany'](db[_0x2a4b('0xfb')],{'as':_0x2a4b('0x120'),'foreignKey':'SenderId'});db[_0x2a4b('0x11')]['hasMany'](db[_0x2a4b('0x121')],{'as':_0x2a4b('0x122'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x2a4b('0x11')][_0x2a4b('0x123')](db[_0x2a4b('0xf7')],{'as':_0x2a4b('0xf7'),'foreignKey':_0x2a4b('0x124')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db['ChatGroup'],{'as':'Groups','through':_0x2a4b('0x126')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x128'),'through':_0x2a4b('0x129')});db[_0x2a4b('0x11')]['belongsToMany'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x12a'),'through':'cm_user_has_lists'});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':_0x2a4b('0x12b')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x43')],{'as':_0x2a4b('0x11f'),'through':'user_has_mail_interactions'});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0x6a')],{'as':'ChatInteractions','through':_0x2a4b('0x12c')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x4e')],{'as':_0x2a4b('0x11e'),'through':_0x2a4b('0x12d')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x57')],{'as':_0x2a4b('0x11d'),'through':_0x2a4b('0x12e')});db[_0x2a4b('0x11')]['belongsToMany'](db[_0x2a4b('0x60')],{'as':_0x2a4b('0x11b'),'through':'user_has_openchannel_interactions'});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x2a4b('0x12f')});db[_0x2a4b('0x11')]['belongsToMany'](db['VoiceQueue'],{'as':_0x2a4b('0x130'),'through':_0x2a4b('0x31'),'required':![]});db[_0x2a4b('0x11')]['belongsToMany'](db['VoicePrefix'],{'as':_0x2a4b('0x131'),'through':_0x2a4b('0x10d'),'required':![]});db['User']['belongsToMany'](db[_0x2a4b('0x3f')],{'as':_0x2a4b('0x132'),'through':_0x2a4b('0x35'),'required':![]});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x6e')],{'as':_0x2a4b('0x133'),'through':_0x2a4b('0x33'),'required':![],'hooks':!![]});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0x52')],{'as':_0x2a4b('0x134'),'through':'UserFaxQueue','required':![]});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0x5a')],{'as':_0x2a4b('0x135'),'through':_0x2a4b('0x136'),'required':![]});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x63')],{'as':_0x2a4b('0x137'),'through':_0x2a4b('0x39'),'required':![]});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x106')],{'as':_0x2a4b('0x138'),'through':_0x2a4b('0x3a'),'required':![]});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0xf5')],{'through':_0x2a4b('0x139')});db[_0x2a4b('0x11')]['belongsToMany'](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x2a4b('0x13a')});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0x4b')],{'as':_0x2a4b('0x13b'),'through':_0x2a4b('0x13c')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db['MailAccount'],{'as':_0x2a4b('0x13d'),'through':'user_has_mail_accounts'});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x5c')],{'as':_0x2a4b('0x13e'),'through':_0x2a4b('0x13f')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x140')],{'as':_0x2a4b('0x141'),'through':_0x2a4b('0x142')});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0xfd')],{'as':'WhatsappAccounts','through':_0x2a4b('0x143')});db[_0x2a4b('0x13')]['hasMany'](db[_0x2a4b('0x17')],{'as':'SpiedAgents','onDelete':_0x2a4b('0x116'),'foreignKey':'ChanSpyId'});db[_0x2a4b('0x144')]['hasMany'](db[_0x2a4b('0x17')],{'onDelete':'cascade'});db[_0x2a4b('0x17')]['hasMany'](db['VoiceExtension'],{'as':_0x2a4b('0x145'),'onDelete':_0x2a4b('0x116')});db['VoiceMusicOnHold']['belongsToMany'](db[_0x2a4b('0x8f')],{'as':_0x2a4b('0x146'),'through':'moh_has_sounds'});db[_0x2a4b('0x1b')][_0x2a4b('0x117')](db[_0x2a4b('0x2f')],{'as':'Members','foreignKey':_0x2a4b('0x147')});db['VoiceQueue']['hasMany'](db[_0x2a4b('0x121')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x2a4b('0x117')](db[_0x2a4b('0x78')],{'as':_0x2a4b('0x148'),'foreignKey':'VoiceQueueId'});db[_0x2a4b('0x1b')]['hasMany'](db[_0x2a4b('0x7a')],{'as':'HopperHistories','foreignKey':_0x2a4b('0x147')});db['VoiceQueue'][_0x2a4b('0x117')](db[_0x2a4b('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x2a4b('0x147')});db[_0x2a4b('0x1b')]['hasMany'](db[_0x2a4b('0x76')],{'as':_0x2a4b('0x149'),'foreignKey':'VoiceQueueId'});db[_0x2a4b('0x1b')]['hasMany'](db[_0x2a4b('0x14a')],{'as':_0x2a4b('0x14b'),'foreignKey':_0x2a4b('0x147')});db['VoiceQueue'][_0x2a4b('0x123')](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x2b'),'foreignKey':_0x2a4b('0x14c')});db['VoiceQueue'][_0x2a4b('0x123')](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x14d'),'foreignKey':_0x2a4b('0x14e')});db[_0x2a4b('0x1b')][_0x2a4b('0x123')](db['Interval'],{'as':_0x2a4b('0x14f'),'foreignKey':'IntervalId'});db['VoiceQueue']['belongsTo'](db[_0x2a4b('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x2a4b('0x150')});db['VoiceQueue'][_0x2a4b('0x125')](db[_0x2a4b('0xf5')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x2a4b('0x1b')]['belongsToMany'](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x31')});db[_0x2a4b('0x1b')]['belongsToMany'](db['Team'],{'as':_0x2a4b('0x152'),'through':_0x2a4b('0x10a')});db['VoiceQueue'][_0x2a4b('0x125')](db['CmList'],{'as':_0x2a4b('0x153'),'through':'voice_queues_has_cm_blacklists'});db[_0x2a4b('0x1c')][_0x2a4b('0x123')](db['User'],{'as':'User','foreignKey':'UserId'});db[_0x2a4b('0x1d')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x11'),'foreignKey':'UserId'});db[_0x2a4b('0x1f')][_0x2a4b('0x117')](db[_0x2a4b('0x21')],{'as':'Messages','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x154'),'sourceKey':_0x2a4b('0x155')});db[_0x2a4b('0x21')]['belongsTo'](db[_0x2a4b('0x1f')],{'foreignKey':_0x2a4b('0x154'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x2a4b('0x117')](db[_0x2a4b('0x28')],{'as':'QueueCalls','foreignKey':_0x2a4b('0x156'),'constraints':![]});db[_0x2a4b('0x23')]['hasMany'](db['VoiceAgentReport'],{'as':_0x2a4b('0x157'),'foreignKey':_0x2a4b('0x156'),'constraints':![]});db[_0x2a4b('0x23')][_0x2a4b('0x123')](db['User'],{'as':_0x2a4b('0x11'),'foreignKey':_0x2a4b('0x114')});db['VoiceCallReport'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x3c')][_0x2a4b('0x123')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x2a4b('0x3c')][_0x2a4b('0x123')](db[_0x2a4b('0x108')],{'as':_0x2a4b('0x108'),'foreignKey':_0x2a4b('0x15a'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x15c')][_0x2a4b('0x123')](db['MailAccount'],{'as':_0x2a4b('0x15d'),'foreignKey':_0x2a4b('0x15e')});db['MailServerOut'][_0x2a4b('0x123')](db[_0x2a4b('0x108')],{'as':_0x2a4b('0x108'),'foreignKey':_0x2a4b('0x15a'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x15d')][_0x2a4b('0x113')](db[_0x2a4b('0x3c')],{'as':_0x2a4b('0x15f'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x15d')]['hasOne'](db['MailServerOut'],{'as':_0x2a4b('0x160'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x15d')][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x15e'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x2a4b('0x82')],{'as':'Answers','foreignKey':_0x2a4b('0x15e')});db[_0x2a4b('0x15d')][_0x2a4b('0x117')](db['MailMessage'],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x15e')});db[_0x2a4b('0x15d')]['hasMany'](db[_0x2a4b('0x43')],{'as':_0x2a4b('0x163')});db[_0x2a4b('0x15d')][_0x2a4b('0x117')](db[_0x2a4b('0x47')],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x15e'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x15d')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':'List','foreignKey':'ListId'});db['MailAccount']['belongsTo'](db[_0x2a4b('0x164')],{'as':_0x2a4b('0x164'),'foreignKey':_0x2a4b('0x165')});db['MailAccount'][_0x2a4b('0x123')](db[_0x2a4b('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x2a4b('0x150')});db[_0x2a4b('0x15d')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x166')});db[_0x2a4b('0x3f')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x35')});db['MailQueue']['belongsToMany'](db[_0x2a4b('0xe9')],{'through':'team_has_mail_queues','as':_0x2a4b('0x152')});db[_0x2a4b('0x43')][_0x2a4b('0x117')](db[_0x2a4b('0x45')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2a4b('0x167')});db['MailInteraction'][_0x2a4b('0x123')](db[_0x2a4b('0x15d')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x15e')});db['MailInteraction'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x43')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x43')]['belongsToMany'](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x16b'),'as':_0x2a4b('0x16c')});db['MailInteraction'][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x2a4b('0x43')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x16d'),'through':_0x2a4b('0x16e'),'foreignKey':_0x2a4b('0x167')});db[_0x2a4b('0x45')]['hasMany'](db[_0x2a4b('0x16f')],{'as':_0x2a4b('0x170'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x45')]['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x11')});db[_0x2a4b('0x45')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'onDelete':'cascade','as':_0x2a4b('0x158')});db[_0x2a4b('0x45')]['belongsTo'](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x2a4b('0x167')});db['MailMessage']['belongsTo'](db[_0x2a4b('0x15d')],{'as':'Account','foreignKey':_0x2a4b('0x15e')});db['MailMessage']['belongsTo'](db[_0x2a4b('0x65')],{'as':'ChatWebsite','foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x45')][_0x2a4b('0x123')](db[_0x2a4b('0x6c')],{'as':_0x2a4b('0x6c'),'foreignKey':_0x2a4b('0x172')});db[_0x2a4b('0x47')]['belongsTo'](db[_0x2a4b('0x11')],{'onDelete':'restrict'});db[_0x2a4b('0x47')][_0x2a4b('0x123')](db['MailQueue'],{'onDelete':_0x2a4b('0x15b')});db['MailApplication'][_0x2a4b('0x123')](db[_0x2a4b('0x15d')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x47')]['belongsTo'](db['Interval'],{'onDelete':_0x2a4b('0x15b'),'foreignKey':'IntervalId'});db[_0x2a4b('0x47')][_0x2a4b('0x123')](db[_0x2a4b('0x16a')],{'onDelete':'restrict','foreignKey':_0x2a4b('0x173')});db[_0x2a4b('0x174')][_0x2a4b('0x123')](db['MailAccount'],{});db[_0x2a4b('0x174')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x174')][_0x2a4b('0x123')](db[_0x2a4b('0x43')],{});db['MailQueueReport'][_0x2a4b('0x123')](db['MailMessage'],{});db[_0x2a4b('0x174')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{});db[_0x2a4b('0x174')][_0x2a4b('0x123')](db['MailQueue'],{});db[_0x2a4b('0x177')][_0x2a4b('0x117')](db[_0x2a4b('0x49')],{'as':'Items','onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x4b')][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x4b')]['hasMany'](db[_0x2a4b('0x82')],{'as':'Answers','foreignKey':_0x2a4b('0x178')});db['FaxAccount']['hasMany'](db['FaxInteraction'],{'as':_0x2a4b('0x163')});db[_0x2a4b('0x4b')][_0x2a4b('0x117')](db[_0x2a4b('0x179')],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x178'),'onDelete':'cascade'});db[_0x2a4b('0x4b')][_0x2a4b('0x117')](db[_0x2a4b('0x17')],{'as':'Exntensions','onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x4b')][_0x2a4b('0x117')](db[_0x2a4b('0x50')],{'as':_0x2a4b('0x162')});db[_0x2a4b('0x4b')][_0x2a4b('0x123')](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x2b')});db[_0x2a4b('0x4b')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':'ListId'});db[_0x2a4b('0x4b')][_0x2a4b('0x123')](db[_0x2a4b('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x2a4b('0x150')});db['FaxAccount'][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x13c')});db[_0x2a4b('0x179')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x15b')});db['FaxApplication'][_0x2a4b('0x123')](db[_0x2a4b('0x52')],{'onDelete':'restrict'});db[_0x2a4b('0x179')][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x179')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x2a4b('0x173')});db['FaxInteraction'][_0x2a4b('0x117')](db[_0x2a4b('0x50')],{'as':_0x2a4b('0x162'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x17a')});db[_0x2a4b('0x4e')][_0x2a4b('0x123')](db['FaxAccount'],{'as':_0x2a4b('0x168'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db['FaxInteraction'][_0x2a4b('0x123')](db['User'],{'as':_0x2a4b('0x169'),'foreignKey':'UserId'});db[_0x2a4b('0x4e')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':'fax_interaction_has_tags','as':_0x2a4b('0x16c')});db[_0x2a4b('0x4e')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x17b'),'as':'ThroughTags'});db[_0x2a4b('0x4e')][_0x2a4b('0x125')](db['User'],{'as':'Users','through':_0x2a4b('0x12d'),'foreignKey':'FaxInteractionId'});db[_0x2a4b('0x50')]['belongsTo'](db['User'],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x11')});db[_0x2a4b('0x50')][_0x2a4b('0x123')](db[_0x2a4b('0x4e')],{'as':_0x2a4b('0x17c'),'foreignKey':_0x2a4b('0x17a')});db[_0x2a4b('0x50')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158')});db['FaxMessage'][_0x2a4b('0x123')](db[_0x2a4b('0x16f')],{'as':_0x2a4b('0x16f'),'foreignKey':_0x2a4b('0x17d')});db[_0x2a4b('0x50')][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x178')});db[_0x2a4b('0x52')][_0x2a4b('0x125')](db['User'],{'as':'Agents','through':_0x2a4b('0x17e')});db['FaxQueue'][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':_0x2a4b('0x17f'),'as':_0x2a4b('0x152')});db[_0x2a4b('0x54')][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{});db[_0x2a4b('0x54')]['belongsTo'](db['CmList'],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0x54')]['belongsTo'](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x54')][_0x2a4b('0x123')](db[_0x2a4b('0x4e')],{});db['FaxQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x50')],{});db[_0x2a4b('0x54')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{});db[_0x2a4b('0x54')]['belongsTo'](db[_0x2a4b('0x52')],{});db[_0x2a4b('0x140')]['hasMany'](db[_0x2a4b('0x84')],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x180'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x140')][_0x2a4b('0x117')](db[_0x2a4b('0x82')],{'as':_0x2a4b('0x181'),'foreignKey':_0x2a4b('0x180')});db['SmsAccount']['hasMany'](db[_0x2a4b('0x182')],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x180')});db[_0x2a4b('0x140')][_0x2a4b('0x117')](db[_0x2a4b('0x57')],{'as':'Interactions'});db[_0x2a4b('0x140')][_0x2a4b('0x117')](db[_0x2a4b('0x56')],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x180'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x140')][_0x2a4b('0x123')](db['CmList'],{'as':_0x2a4b('0x175'),'foreignKey':'ListId'});db[_0x2a4b('0x140')][_0x2a4b('0x123')](db['Pause'],{'as':_0x2a4b('0x183'),'foreignKey':_0x2a4b('0x150')});db[_0x2a4b('0x140')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x142')});db[_0x2a4b('0x56')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x56')][_0x2a4b('0x123')](db[_0x2a4b('0x5a')],{'onDelete':'restrict'});db[_0x2a4b('0x56')]['belongsTo'](db[_0x2a4b('0x140')],{'onDelete':'restrict'});db[_0x2a4b('0x56')]['belongsTo'](db[_0x2a4b('0x14f')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x184')});db['SmsApplication'][_0x2a4b('0x123')](db[_0x2a4b('0x16a')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x173')});db['SmsInteraction'][_0x2a4b('0x117')](db['SmsMessage'],{'as':'Messages','onDelete':_0x2a4b('0x116'),'foreignKey':'SmsInteractionId'});db[_0x2a4b('0x57')][_0x2a4b('0x123')](db[_0x2a4b('0x140')],{'as':'Account','foreignKey':_0x2a4b('0x180')});db['SmsInteraction'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x57')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db['SmsInteraction'][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':'sms_interaction_has_tags','as':_0x2a4b('0x16c')});db[_0x2a4b('0x57')][_0x2a4b('0x125')](db['Tag'],{'through':_0x2a4b('0x185'),'as':_0x2a4b('0x186')});db[_0x2a4b('0x57')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x16d'),'through':_0x2a4b('0x12e'),'foreignKey':_0x2a4b('0x187')});db[_0x2a4b('0x182')]['belongsTo'](db[_0x2a4b('0x11')],{'as':'User'});db[_0x2a4b('0x182')][_0x2a4b('0x123')](db['CmContact'],{'onDelete':_0x2a4b('0x116'),'as':'Contact'});db[_0x2a4b('0x182')]['belongsTo'](db[_0x2a4b('0x57')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x17c'),'foreignKey':_0x2a4b('0x187')});db['SmsMessage'][_0x2a4b('0x123')](db[_0x2a4b('0x140')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x2a4b('0x5a')]['belongsToMany'](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x136'),'foreignKey':_0x2a4b('0x188')});db['SmsQueue'][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':'team_has_sms_queues','as':_0x2a4b('0x152')});db['OpenchannelAccount'][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':'Dispositions','foreignKey':_0x2a4b('0x189'),'onDelete':_0x2a4b('0x116')});db['OpenchannelAccount'][_0x2a4b('0x117')](db[_0x2a4b('0x82')],{'as':'Answers','foreignKey':_0x2a4b('0x189')});db[_0x2a4b('0x5c')][_0x2a4b('0x117')](db[_0x2a4b('0x60')],{'as':_0x2a4b('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x2a4b('0x5c')][_0x2a4b('0x117')](db[_0x2a4b('0x61')],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x189')});db[_0x2a4b('0x5c')][_0x2a4b('0x117')](db['OpenchannelApplication'],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x189'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x5c')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':'List','foreignKey':'ListId'});db[_0x2a4b('0x5c')][_0x2a4b('0x123')](db['Pause'],{'as':_0x2a4b('0x183'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2a4b('0x5c')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':'user_has_openchannel_accounts'});db[_0x2a4b('0x5e')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x5e')][_0x2a4b('0x123')](db[_0x2a4b('0x63')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x18a')});db[_0x2a4b('0x5e')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x189')});db[_0x2a4b('0x5e')][_0x2a4b('0x123')](db[_0x2a4b('0x14f')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0x5e')]['belongsTo'](db['Tag'],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x173')});db[_0x2a4b('0x60')][_0x2a4b('0x117')](db[_0x2a4b('0x61')],{'as':'Messages','onDelete':_0x2a4b('0x116'),'foreignKey':'OpenchannelInteractionId'});db[_0x2a4b('0x60')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{'as':_0x2a4b('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x2a4b('0x60')]['belongsTo'](db['CmContact'],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x60')]['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x60')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x18b'),'as':_0x2a4b('0x16c')});db[_0x2a4b('0x60')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x18b'),'as':_0x2a4b('0x186')});db[_0x2a4b('0x60')][_0x2a4b('0x125')](db['User'],{'as':_0x2a4b('0x16d'),'through':'user_has_openchannel_interactions','foreignKey':_0x2a4b('0x18c')});db[_0x2a4b('0x61')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':'cascade','as':_0x2a4b('0x11')});db[_0x2a4b('0x61')]['belongsTo'](db[_0x2a4b('0x127')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158')});db[_0x2a4b('0x61')][_0x2a4b('0x123')](db[_0x2a4b('0x60')],{'onDelete':_0x2a4b('0x116'),'as':'Interaction','foreignKey':_0x2a4b('0x18c')});db[_0x2a4b('0x61')][_0x2a4b('0x123')](db[_0x2a4b('0x16f')],{'as':_0x2a4b('0x16f'),'foreignKey':_0x2a4b('0x17d')});db[_0x2a4b('0x61')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{'as':'Account','foreignKey':_0x2a4b('0x189')});db['OpenchannelQueue']['belongsToMany'](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x39'),'foreignKey':_0x2a4b('0x18a')});db[_0x2a4b('0x63')]['belongsToMany'](db['Team'],{'through':_0x2a4b('0x18d'),'as':'Teams'});db[_0x2a4b('0x65')]['hasMany'](db['Disposition'],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x171'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x65')][_0x2a4b('0x117')](db[_0x2a4b('0x82')],{'as':_0x2a4b('0x181'),'foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x65')]['hasMany'](db[_0x2a4b('0x71')],{'as':_0x2a4b('0x18e')});db[_0x2a4b('0x65')]['hasMany'](db['ChatInteraction'],{'as':_0x2a4b('0x163')});db[_0x2a4b('0x65')]['hasMany'](db['ChatApplication'],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x171'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x65')][_0x2a4b('0x117')](db[_0x2a4b('0x6b')],{'as':_0x2a4b('0x162')});db[_0x2a4b('0x65')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db['ChatWebsite']['belongsTo'](db[_0x2a4b('0x14f')],{'as':_0x2a4b('0x14f'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0x65')][_0x2a4b('0x123')](db[_0x2a4b('0x15d')],{'as':_0x2a4b('0x15d'),'foreignKey':'MailAccountId'});db[_0x2a4b('0x65')]['belongsTo'](db[_0x2a4b('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x2a4b('0x150')});db['ChatWebsite'][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x13a')});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db['OpenchannelQueueReport'][_0x2a4b('0x123')](db['CmContact'],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0x60')],{});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0x61')],{});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db['User'],{});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0x63')],{});db[_0x2a4b('0x68')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x190'),'foreignKey':_0x2a4b('0x114'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x68')][_0x2a4b('0x123')](db[_0x2a4b('0x6e')],{'as':_0x2a4b('0x191'),'foreignKey':_0x2a4b('0x192'),'onDelete':'restrict'});db[_0x2a4b('0x68')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{'as':'Website','foreignKey':_0x2a4b('0x171'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x68')]['belongsTo'](db[_0x2a4b('0x16a')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':'TagId'});db['ChatInteraction'][_0x2a4b('0x117')](db[_0x2a4b('0x6b')],{'as':_0x2a4b('0x162'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x193')});db[_0x2a4b('0x6a')][_0x2a4b('0x123')](db['ChatWebsite'],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x6a')]['belongsTo'](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x6a')]['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x6a')][_0x2a4b('0x125')](db['Tag'],{'through':_0x2a4b('0x194'),'as':_0x2a4b('0x16c')});db['ChatInteraction'][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x194'),'as':'ThroughTags'});db[_0x2a4b('0x6a')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x2a4b('0x193')});db[_0x2a4b('0x6b')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x11')});db['ChatMessage'][_0x2a4b('0x123')](db['CmContact'],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x6b')][_0x2a4b('0x123')](db[_0x2a4b('0x6a')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x17c'),'foreignKey':_0x2a4b('0x193')});db['ChatMessage'][_0x2a4b('0x123')](db['Attachment'],{'as':_0x2a4b('0x16f'),'foreignKey':_0x2a4b('0x17d')});db['ChatMessage'][_0x2a4b('0x123')](db['ChatWebsite'],{'as':_0x2a4b('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x2a4b('0x6c')][_0x2a4b('0x117')](db[_0x2a4b('0x16f')],{'as':'Attachments','foreignKey':_0x2a4b('0x172'),'onDelete':'cascade','hooks':!![]});db[_0x2a4b('0x6c')]['belongsTo'](db['CmContact'],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x6c')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x6e')][_0x2a4b('0x125')](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x33'),'hooks':!![]});db['ChatQueue'][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':'team_has_chat_queues','as':_0x2a4b('0x152')});db[_0x2a4b('0x70')]['hasMany'](db[_0x2a4b('0xd6')],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x195'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x70')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x196'),'through':_0x2a4b('0x126')});db[_0x2a4b('0x71')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{'as':'Website','foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x73')]['hasMany'](db['CmContact'],{'as':_0x2a4b('0x128'),'foreignKey':_0x2a4b('0x197')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db['CmContactHasItem'],{'as':_0x2a4b('0x198'),'foreignKey':_0x2a4b('0x199')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x121')],{'as':_0x2a4b('0x122'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x127')]['hasMany'](db['CmHopperFinal'],{'as':_0x2a4b('0x148'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x127')]['hasMany'](db[_0x2a4b('0x7a')],{'as':_0x2a4b('0x19a'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x7b')],{'as':_0x2a4b('0x7b'),'foreignKey':'ContactId'});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x14a')],{'as':_0x2a4b('0x14b'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x60')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x127')]['hasMany'](db['ChatInteraction'],{'as':_0x2a4b('0x11c'),'foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db['SmsInteraction'],{'as':_0x2a4b('0x11d'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x4e')],{'as':'FaxInteractions','foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x15b')});db['CmContact'][_0x2a4b('0x117')](db[_0x2a4b('0x43')],{'as':_0x2a4b('0x11f'),'foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x127')][_0x2a4b('0x123')](db[_0x2a4b('0x73')],{'as':_0x2a4b('0x19b'),'foreignKey':'CompanyId'});db[_0x2a4b('0x127')][_0x2a4b('0x123')](db['CmList'],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176'),'onDelete':'cascade'});db[_0x2a4b('0x127')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x16d'),'through':_0x2a4b('0x129')});db[_0x2a4b('0x127')]['belongsToMany'](db[_0x2a4b('0x16a')],{'as':_0x2a4b('0x16c'),'through':_0x2a4b('0x19c')});db['CmContact'][_0x2a4b('0x125')](db['Tag'],{'through':_0x2a4b('0x19c'),'as':_0x2a4b('0x186')});db[_0x2a4b('0x121')]['hasMany'](db[_0x2a4b('0x96')],{'as':_0x2a4b('0x19d'),'foreignKey':_0x2a4b('0x19e')});db[_0x2a4b('0x121')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x116')});db['CmHopper'][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176'),'onDelete':_0x2a4b('0x116')});db['CmHopper']['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x190'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x121')][_0x2a4b('0x123')](db[_0x2a4b('0x1b')],{'as':_0x2a4b('0x191'),'foreignKey':_0x2a4b('0x147'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x121')][_0x2a4b('0x123')](db[_0x2a4b('0x19f')],{'as':_0x2a4b('0x19f'),'foreignKey':_0x2a4b('0x1a0'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x121')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x1a1')});db[_0x2a4b('0x76')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x116')});db['CmHopperBlack'][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176'),'onDelete':'cascade'});db[_0x2a4b('0x76')][_0x2a4b('0x123')](db[_0x2a4b('0x1b')],{'as':'Queue','foreignKey':_0x2a4b('0x147'),'onDelete':_0x2a4b('0x116')});db['CmHopperBlack'][_0x2a4b('0x123')](db['Campaign'],{'as':_0x2a4b('0x19f'),'foreignKey':_0x2a4b('0x1a0'),'onDelete':_0x2a4b('0x116')});db['Automation'][_0x2a4b('0x117')](db[_0x2a4b('0x86')],{'as':{'plural':'All','singular':_0x2a4b('0x1a2')},'foreignKey':_0x2a4b('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0x2a4b('0x80')][_0x2a4b('0x117')](db['Condition'],{'as':{'plural':_0x2a4b('0x1a4'),'singular':_0x2a4b('0x1a5')},'foreignKey':_0x2a4b('0x1a6'),'onDelete':'cascade','hooks':!![]});db[_0x2a4b('0x80')][_0x2a4b('0x117')](db[_0x2a4b('0x7f')],{'as':'Actions','foreignKey':_0x2a4b('0x1a7'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x1a8'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x14f')][_0x2a4b('0x117')](db['Interval'],{'as':_0x2a4b('0x1a9'),'foreignKey':_0x2a4b('0x184'),'onDelete':_0x2a4b('0x116'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0x2a4b('0x119'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x2a4b('0x14f')][_0x2a4b('0x117')](db[_0x2a4b('0x47')],{'as':_0x2a4b('0x1aa'),'foreignKey':'IntervalId'});db[_0x2a4b('0x14f')][_0x2a4b('0x117')](db[_0x2a4b('0x68')],{'as':_0x2a4b('0x1ab'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0x14f')][_0x2a4b('0x117')](db[_0x2a4b('0x179')],{'as':_0x2a4b('0x1ac'),'foreignKey':_0x2a4b('0x184')});db['Interval'][_0x2a4b('0x117')](db['SmsApplication'],{'as':_0x2a4b('0x1ad'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0x8d')]['belongsTo'](db[_0x2a4b('0x15d')],{});db[_0x2a4b('0x8d')]['belongsTo'](db[_0x2a4b('0x9f')],{'foreignKey':_0x2a4b('0x1ae')});db[_0x2a4b('0x8d')][_0x2a4b('0x123')](db[_0x2a4b('0x1af')],{'foreignKey':_0x2a4b('0x1b0')});db[_0x2a4b('0x8f')][_0x2a4b('0x125')](db[_0x2a4b('0x19')],{'as':'Mohs','through':_0x2a4b('0x1b1'),'onDelete':'restrict'});db['Tag'][_0x2a4b('0x125')](db['CmContact'],{'through':_0x2a4b('0x19c')});db[_0x2a4b('0x16a')][_0x2a4b('0x125')](db[_0x2a4b('0x6a')],{'through':_0x2a4b('0x194')});db['Tag'][_0x2a4b('0x125')](db[_0x2a4b('0x43')],{'through':_0x2a4b('0x16b')});db[_0x2a4b('0x16a')][_0x2a4b('0x125')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db['Tag'][_0x2a4b('0x125')](db['FaxInteraction'],{'through':_0x2a4b('0x17b')});db[_0x2a4b('0x16a')][_0x2a4b('0x125')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x2a4b('0x16a')]['belongsToMany'](db[_0x2a4b('0x101')],{'through':'whatsapp_interaction_has_tags'});db[_0x2a4b('0x94')][_0x2a4b('0x123')](db[_0x2a4b('0x92')],{'as':_0x2a4b('0x1b2'),'foreignKey':'ItemTypeId'});db[_0x2a4b('0x96')]['belongsTo'](db[_0x2a4b('0x121')],{'as':_0x2a4b('0x1b3'),'foreignKey':_0x2a4b('0x19e')});db[_0x2a4b('0x94')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':'CmContactId'});db[_0x2a4b('0x98')][_0x2a4b('0x117')](db['Condition'],{'as':{'plural':_0x2a4b('0x1b4'),'singular':_0x2a4b('0x1b5')},'foreignKey':'TriggerAllId','onDelete':_0x2a4b('0x116'),'hooks':!![]});db[_0x2a4b('0x98')][_0x2a4b('0x117')](db[_0x2a4b('0x86')],{'as':{'plural':'AnyConditions','singular':_0x2a4b('0x1b6')},'foreignKey':_0x2a4b('0x1b7'),'onDelete':_0x2a4b('0x116'),'hooks':!![]});db[_0x2a4b('0x98')][_0x2a4b('0x117')](db['Action'],{'as':_0x2a4b('0x1b8'),'foreignKey':_0x2a4b('0x1b9'),'onDelete':_0x2a4b('0x116'),'hooks':!![]});db[_0x2a4b('0x1af')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x2a4b('0x1ba'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x2a4b('0x9f')][_0x2a4b('0x117')](db[_0x2a4b('0xa4')],{'as':_0x2a4b('0x1ba'),'onDelete':'cascade','foreignKey':_0x2a4b('0x1ae')});db[_0x2a4b('0x1bb')][_0x2a4b('0x117')](db['AnalyticFieldReport'],{'as':_0x2a4b('0x1ba'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1bc')});db[_0x2a4b('0xa4')][_0x2a4b('0x123')](db[_0x2a4b('0x1bb')],{'foreignKey':_0x2a4b('0x1bc')});db['SalesforceAccount']['hasMany'](db[_0x2a4b('0xa9')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xa9')][_0x2a4b('0x117')](db[_0x2a4b('0xab')],{'as':_0x2a4b('0x1bf'),'onDelete':_0x2a4b('0x116'),'foreignKey':'SubjectId'});db[_0x2a4b('0xa9')][_0x2a4b('0x117')](db['SalesforceField'],{'as':_0x2a4b('0x1c0'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xa9')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2a4b('0x1c2')});db['SalesforceConfiguration'][_0x2a4b('0x123')](db[_0x2a4b('0xa7')],{'as':'Account','foreignKey':_0x2a4b('0x1be')});db['SalesforceField'][_0x2a4b('0x117')](db[_0x2a4b('0xab')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xab')]['hasMany'](db[_0x2a4b('0xab')],{'as':_0x2a4b('0x1c5'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xab')][_0x2a4b('0x117')](db['SalesforceField'],{'as':_0x2a4b('0x1c6'),'foreignKey':'FieldId'});db['SalesforceField'][_0x2a4b('0x123')](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0x1c8')][_0x2a4b('0x117')](db['SugarcrmConfiguration'],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xae')]['hasMany'](db[_0x2a4b('0xb0')],{'as':_0x2a4b('0x1bf'),'onDelete':'cascade','foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xae')][_0x2a4b('0x117')](db[_0x2a4b('0xb0')],{'as':'Descriptions','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xae')][_0x2a4b('0x117')](db[_0x2a4b('0xb0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xae')][_0x2a4b('0x123')](db[_0x2a4b('0x1c8')],{'as':'Account','foreignKey':_0x2a4b('0x1be')});db['SugarcrmField'][_0x2a4b('0x117')](db['SugarcrmField'],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xb0')][_0x2a4b('0x117')](db['SugarcrmField'],{'as':_0x2a4b('0x1c5'),'foreignKey':_0x2a4b('0x1c1')});db['SugarcrmField'][_0x2a4b('0x117')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xb0')][_0x2a4b('0x123')](db['Variable'],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0x1c9')]['hasMany'](db[_0x2a4b('0xb2')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x2a4b('0x117')](db['DeskField'],{'as':_0x2a4b('0x1bf'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x2a4b('0xb2')][_0x2a4b('0x117')](db[_0x2a4b('0x1ca')],{'as':'Descriptions','onDelete':_0x2a4b('0x116'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xb2')]['hasMany'](db[_0x2a4b('0x1ca')],{'as':'Fields','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xb2')][_0x2a4b('0x123')](db[_0x2a4b('0x1c9')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xb2')][_0x2a4b('0x125')](db['Tag'],{'through':_0x2a4b('0x1cb')});db[_0x2a4b('0x1ca')][_0x2a4b('0x117')](db[_0x2a4b('0x1ca')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db['DeskField'][_0x2a4b('0x117')](db[_0x2a4b('0x1ca')],{'as':_0x2a4b('0x1c5'),'foreignKey':'DescriptionId'});db[_0x2a4b('0x1ca')][_0x2a4b('0x117')](db[_0x2a4b('0x1ca')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0x1ca')][_0x2a4b('0x123')](db['Variable'],{'as':_0x2a4b('0x9a'),'foreignKey':'VariableId'});db[_0x2a4b('0x1cc')][_0x2a4b('0x117')](db[_0x2a4b('0xb5')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db['ZohoConfiguration'][_0x2a4b('0x117')](db[_0x2a4b('0xb7')],{'as':_0x2a4b('0x1bf'),'onDelete':_0x2a4b('0x116'),'foreignKey':'SubjectId'});db[_0x2a4b('0xb5')][_0x2a4b('0x117')](db[_0x2a4b('0xb7')],{'as':'Descriptions','onDelete':_0x2a4b('0x116'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xb5')]['hasMany'](db[_0x2a4b('0xb7')],{'as':'Fields','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xb5')][_0x2a4b('0x123')](db[_0x2a4b('0x1cc')],{'as':'Account','foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xb7')][_0x2a4b('0x117')](db[_0x2a4b('0xb7')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xb7')][_0x2a4b('0x117')](db['ZohoField'],{'as':_0x2a4b('0x1c5'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xb7')]['hasMany'](db[_0x2a4b('0xb7')],{'as':_0x2a4b('0x1c6'),'foreignKey':'FieldId'});db[_0x2a4b('0xb7')][_0x2a4b('0x123')](db['Variable'],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db['ZendeskAccount'][_0x2a4b('0x117')](db[_0x2a4b('0xba')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':'AccountId'});db[_0x2a4b('0xba')][_0x2a4b('0x117')](db['ZendeskField'],{'as':_0x2a4b('0x1bf'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xba')][_0x2a4b('0x117')](db[_0x2a4b('0xbc')],{'as':_0x2a4b('0x1c0'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xba')][_0x2a4b('0x117')](db[_0x2a4b('0xbc')],{'as':_0x2a4b('0x1ba'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xba')][_0x2a4b('0x123')](db['ZendeskAccount'],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db['ZendeskConfiguration'][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x1cd')});db[_0x2a4b('0xbc')]['hasMany'](db[_0x2a4b('0xbc')],{'as':_0x2a4b('0x1c3'),'foreignKey':'SubjectId'});db[_0x2a4b('0xbc')][_0x2a4b('0x117')](db[_0x2a4b('0xbc')],{'as':'Description','foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xbc')][_0x2a4b('0x117')](db[_0x2a4b('0xbc')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xbc')]['belongsTo'](db[_0x2a4b('0x9a')],{'as':'Variable','foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0xbe')]['hasMany'](db[_0x2a4b('0xc0')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xc0')][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':_0x2a4b('0x1bf'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c4')});db['FreshdeskConfiguration'][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':'Descriptions','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xc0')][_0x2a4b('0x117')](db['FreshdeskField'],{'as':_0x2a4b('0x1ba'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xc0')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xc0')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x1ce')});db[_0x2a4b('0xc1')][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':'Subject','foreignKey':_0x2a4b('0x1c4')});db['FreshdeskField'][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':'Description','foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xc1')][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':'Field','foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xc1')][_0x2a4b('0x123')](db['Variable'],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0xc3')]['hasMany'](db[_0x2a4b('0x1cf')],{'as':_0x2a4b('0x1bd'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x2a4b('0x1cf')]['hasMany'](db['VtigerField'],{'as':_0x2a4b('0x1bf'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0x1cf')]['hasMany'](db[_0x2a4b('0xc6')],{'as':_0x2a4b('0x1c0'),'foreignKey':_0x2a4b('0x1c1')});db['VtigerConfiguration'][_0x2a4b('0x117')](db[_0x2a4b('0xc6')],{'as':_0x2a4b('0x1ba'),'foreignKey':_0x2a4b('0x1c2')});db['VtigerConfiguration'][_0x2a4b('0x123')](db['VtigerAccount'],{'as':_0x2a4b('0x168'),'foreignKey':'AccountId'});db[_0x2a4b('0xc6')][_0x2a4b('0x117')](db[_0x2a4b('0xc6')],{'as':'Subject','foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xc6')]['hasMany'](db[_0x2a4b('0xc6')],{'as':_0x2a4b('0x1c5'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xc6')][_0x2a4b('0x117')](db[_0x2a4b('0xc6')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xc6')]['belongsTo'](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db['ServicenowAccount'][_0x2a4b('0x117')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x2a4b('0x116'),'foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db[_0x2a4b('0xca')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x2a4b('0xc9')][_0x2a4b('0x117')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xc9')][_0x2a4b('0x117')](db[_0x2a4b('0xca')],{'as':_0x2a4b('0x1ba'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xc9')]['belongsTo'](db[_0x2a4b('0x1d0')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xca')][_0x2a4b('0x117')](db[_0x2a4b('0xca')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xca')][_0x2a4b('0x117')](db['ServicenowField'],{'as':_0x2a4b('0x1c5'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xca')][_0x2a4b('0x117')](db[_0x2a4b('0xca')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db['ServicenowField'][_0x2a4b('0x123')](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0xcb')][_0x2a4b('0x117')](db['Dynamics365Configuration'],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db['Dynamics365Account'][_0x2a4b('0x123')](db[_0x2a4b('0x108')],{'as':_0x2a4b('0x108'),'foreignKey':_0x2a4b('0x15a')});db[_0x2a4b('0xcd')][_0x2a4b('0x117')](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1bf'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xcd')][_0x2a4b('0x117')](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1c0'),'onDelete':_0x2a4b('0x116'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xcd')]['hasMany'](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1ba'),'onDelete':_0x2a4b('0x116'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x2a4b('0x123')](db[_0x2a4b('0xcb')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xce')][_0x2a4b('0x117')](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db['Dynamics365Field'][_0x2a4b('0x117')](db['Dynamics365Field'],{'as':_0x2a4b('0x1c5'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xce')][_0x2a4b('0x117')](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xce')][_0x2a4b('0x123')](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0xd0')]['hasMany'](db[_0x2a4b('0xd1')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':'AccountId'});db[_0x2a4b('0xd1')][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1bf'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xd1')][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1c0'),'foreignKey':_0x2a4b('0x1c1')});db['FreshsalesConfiguration'][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1ba'),'foreignKey':'FieldId'});db[_0x2a4b('0xd1')][_0x2a4b('0x123')](db[_0x2a4b('0xd0')],{'as':_0x2a4b('0x168'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x2a4b('0x1c5'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0x1d1')][_0x2a4b('0x123')](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':'VariableId'});db[_0x2a4b('0xd5')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{});db['ChatQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':'ListId'});db[_0x2a4b('0xd5')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':'Contact','foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0xd5')]['belongsTo'](db[_0x2a4b('0x6a')],{});db[_0x2a4b('0xd5')]['belongsTo'](db[_0x2a4b('0x6b')],{});db[_0x2a4b('0xd5')]['belongsTo'](db['User'],{});db[_0x2a4b('0xd5')][_0x2a4b('0x123')](db[_0x2a4b('0x6e')],{});db[_0x2a4b('0xd6')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1d2')});db[_0x2a4b('0xd6')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1d3')});db[_0x2a4b('0x14a')][_0x2a4b('0x117')](db[_0x2a4b('0xda')],{'foreignKey':_0x2a4b('0x1d4'),'onDelete':_0x2a4b('0x116')});db['JscriptySessionReport'][_0x2a4b('0x117')](db[_0x2a4b('0xd8')],{'foreignKey':_0x2a4b('0x1d4'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0xdc')][_0x2a4b('0x123')](db[_0x2a4b('0x140')],{});db[_0x2a4b('0xdc')][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db['SmsQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db['SmsQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x57')],{});db[_0x2a4b('0xdc')][_0x2a4b('0x123')](db['SmsMessage'],{});db[_0x2a4b('0xdc')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{});db['SmsQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x5a')],{});db[_0x2a4b('0x1d5')][_0x2a4b('0x117')](db[_0x2a4b('0x14a')],{'foreignKey':_0x2a4b('0x1d6')});db[_0x2a4b('0x1d5')][_0x2a4b('0x117')](db[_0x2a4b('0xda')],{'foreignKey':_0x2a4b('0x1d6')});db[_0x2a4b('0x1d5')]['hasMany'](db[_0x2a4b('0xd8')],{'foreignKey':_0x2a4b('0x1d6')});db[_0x2a4b('0xe9')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':'Agents','through':'user_has_teams'});db['Team'][_0x2a4b('0x125')](db[_0x2a4b('0x1b')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0x2a4b('0xe9')]['belongsToMany'](db[_0x2a4b('0x3f')],{'through':_0x2a4b('0x1d7'),'as':_0x2a4b('0x132')});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db['ChatQueue'],{'through':_0x2a4b('0x1d8'),'as':_0x2a4b('0x133')});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db[_0x2a4b('0x52')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x2a4b('0xe9')]['belongsToMany'](db[_0x2a4b('0x5a')],{'through':_0x2a4b('0x1d9'),'as':'SmsQueues'});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db[_0x2a4b('0x63')],{'through':_0x2a4b('0x18d'),'as':_0x2a4b('0x137')});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db[_0x2a4b('0x106')],{'through':_0x2a4b('0x1da'),'as':_0x2a4b('0x138')});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db[_0x2a4b('0x1db')],{'through':_0x2a4b('0x10b'),'as':_0x2a4b('0x131')});db[_0x2a4b('0x19f')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x2a4b('0x1a0')});db['Campaign']['hasMany'](db[_0x2a4b('0x78')],{'as':'HopperFinals','foreignKey':_0x2a4b('0x1a0')});db[_0x2a4b('0x19f')][_0x2a4b('0x117')](db[_0x2a4b('0x7a')],{'as':_0x2a4b('0x19a'),'foreignKey':_0x2a4b('0x1a0')});db[_0x2a4b('0x19f')][_0x2a4b('0x117')](db[_0x2a4b('0x76')],{'as':_0x2a4b('0x149'),'foreignKey':_0x2a4b('0x1a0')});db['Campaign']['belongsTo'](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x2b'),'foreignKey':_0x2a4b('0x14c')});db[_0x2a4b('0x19f')][_0x2a4b('0x123')](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x14d'),'foreignKey':'TrunkBackupId'});db[_0x2a4b('0x19f')][_0x2a4b('0x123')](db[_0x2a4b('0x14f')],{'as':_0x2a4b('0x14f'),'foreignKey':'IntervalId'});db[_0x2a4b('0x19f')][_0x2a4b('0x123')](db['SquareProject'],{'as':_0x2a4b('0xe4'),'foreignKey':_0x2a4b('0x1dc')});db[_0x2a4b('0x19f')][_0x2a4b('0x125')](db['CmList'],{'as':_0x2a4b('0x12a'),'through':'campaigns_has_cm_lists'});db[_0x2a4b('0x19f')]['belongsToMany'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x153'),'through':_0x2a4b('0x1dd')});db[_0x2a4b('0x16f')][_0x2a4b('0x123')](db[_0x2a4b('0x6c')],{'as':_0x2a4b('0x6c'),'foreignKey':_0x2a4b('0x172')});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db['MailMessage'],{});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db[_0x2a4b('0x43')],{});db[_0x2a4b('0x1de')]['belongsTo'](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0x2a4b('0x1df')});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e2'),'as':_0x2a4b('0x1e3')});db[_0x2a4b('0x1de')]['belongsTo'](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db['MailAccount'],{'foreignKey':_0x2a4b('0x1e4'),'as':_0x2a4b('0x1e5')});db['ChatTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x6b')],{});db[_0x2a4b('0xf0')][_0x2a4b('0x123')](db[_0x2a4b('0x6a')],{});db[_0x2a4b('0xf0')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x2a4b('0xf0')]['belongsTo'](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db[_0x2a4b('0xf0')][_0x2a4b('0x123')](db['User'],{'foreignKey':_0x2a4b('0x1e2'),'as':_0x2a4b('0x1e3')});db['ChatTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x6e')],{'foreignKey':_0x2a4b('0x1e6'),'as':_0x2a4b('0x1e7')});db[_0x2a4b('0xf0')]['belongsTo'](db[_0x2a4b('0x65')],{'foreignKey':'ToChatWebsiteId','as':_0x2a4b('0x1e5')});db[_0x2a4b('0xf2')][_0x2a4b('0x123')](db[_0x2a4b('0x50')],{});db['FaxTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x4e')],{});db['FaxTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{'foreignKey':_0x2a4b('0x1e8'),'as':_0x2a4b('0x1df')});db[_0x2a4b('0xf2')]['belongsTo'](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db['FaxTransferReport'][_0x2a4b('0x123')](db['User'],{'foreignKey':_0x2a4b('0x1e2'),'as':_0x2a4b('0x1e3')});db[_0x2a4b('0xf2')]['belongsTo'](db[_0x2a4b('0x52')],{'foreignKey':_0x2a4b('0x1e9'),'as':_0x2a4b('0x1e7')});db[_0x2a4b('0xf2')][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{'foreignKey':_0x2a4b('0x1ea'),'as':_0x2a4b('0x1e5')});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db['OpenchannelMessage'],{});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db[_0x2a4b('0x60')],{});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{'foreignKey':_0x2a4b('0x1ec'),'as':_0x2a4b('0x1df')});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db['OpenchannelTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e2'),'as':'ToAgent'});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db[_0x2a4b('0x63')],{'foreignKey':_0x2a4b('0x1ed'),'as':_0x2a4b('0x1e7')});db[_0x2a4b('0x1eb')]['belongsTo'](db[_0x2a4b('0x5c')],{'foreignKey':_0x2a4b('0x1ee'),'as':_0x2a4b('0x1e5')});db[_0x2a4b('0x1ef')][_0x2a4b('0x123')](db[_0x2a4b('0x182')],{});db[_0x2a4b('0x1ef')][_0x2a4b('0x123')](db[_0x2a4b('0x57')],{});db['SmsTransferReport']['belongsTo'](db[_0x2a4b('0x140')],{'foreignKey':'FromSmsAccountId','as':_0x2a4b('0x1df')});db[_0x2a4b('0x1ef')]['belongsTo'](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db[_0x2a4b('0x1ef')][_0x2a4b('0x123')](db['User'],{'foreignKey':'ToUserId','as':_0x2a4b('0x1e3')});db[_0x2a4b('0x1ef')][_0x2a4b('0x123')](db[_0x2a4b('0x5a')],{'foreignKey':_0x2a4b('0x1f0'),'as':_0x2a4b('0x1e7')});db['SmsTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x140')],{'foreignKey':_0x2a4b('0x1f1'),'as':_0x2a4b('0x1e5')});db[_0x2a4b('0xf5')][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':'Dispositions','foreignKey':'ListId','onDelete':_0x2a4b('0x116')});db[_0x2a4b('0xf5')]['hasMany'](db[_0x2a4b('0x7d')],{'as':_0x2a4b('0x1f2'),'foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0xf5')][_0x2a4b('0x117')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x128'),'onDelete':_0x2a4b('0x116'),'foreignKey':'ListId'});db[_0x2a4b('0xf5')][_0x2a4b('0x117')](db[_0x2a4b('0x78')],{'as':_0x2a4b('0x148'),'foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0xf5')]['hasMany'](db[_0x2a4b('0x7a')],{'as':'HopperHistory','foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0xf5')][_0x2a4b('0x117')](db[_0x2a4b('0x7b')],{'as':_0x2a4b('0x7b'),'foreignKey':_0x2a4b('0x176')});db['CmList'][_0x2a4b('0x125')](db[_0x2a4b('0x1b')],{'as':_0x2a4b('0x1f3'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x2a4b('0x125')](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x139')});db[_0x2a4b('0x1db')][_0x2a4b('0x117')](db[_0x2a4b('0x17')],{'as':_0x2a4b('0x119'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x1db')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x10d')});db['VoicePrefix'][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':'TeamVoicePrefix','as':'Teams'});db[_0x2a4b('0xf7')][_0x2a4b('0x117')](db['User'],{'as':_0x2a4b('0x16d'),'foreignKey':_0x2a4b('0x124')});db[_0x2a4b('0xf7')][_0x2a4b('0x117')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x2a4b('0x124'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0xf8')][_0x2a4b('0x117')](db[_0x2a4b('0xf9')],{'as':_0x2a4b('0x1f4'),'foreignKey':_0x2a4b('0x1f5'),'onDelete':_0x2a4b('0x116')});db['WhatsappAccount'][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x1f6'),'onDelete':'cascade'});db[_0x2a4b('0xfd')][_0x2a4b('0x117')](db[_0x2a4b('0x82')],{'as':_0x2a4b('0x181'),'foreignKey':_0x2a4b('0x1f6')});db[_0x2a4b('0xfd')][_0x2a4b('0x117')](db['WhatsappMessage'],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x1f6')});db[_0x2a4b('0xfd')][_0x2a4b('0x117')](db[_0x2a4b('0x101')],{'as':_0x2a4b('0x163')});db[_0x2a4b('0xfd')][_0x2a4b('0x117')](db[_0x2a4b('0xff')],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x1f6'),'onDelete':'cascade'});db[_0x2a4b('0xfd')][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0xfd')][_0x2a4b('0x123')](db[_0x2a4b('0x88')],{'as':_0x2a4b('0x183'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2a4b('0xfd')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x143')});db[_0x2a4b('0xff')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0xff')][_0x2a4b('0x123')](db[_0x2a4b('0x106')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x2a4b('0x123')](db['WhatsappAccount'],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0xff')][_0x2a4b('0x123')](db[_0x2a4b('0x14f')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0xff')][_0x2a4b('0x123')](db['Tag'],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x173')});db[_0x2a4b('0x101')][_0x2a4b('0x117')](db[_0x2a4b('0x1f7')],{'as':_0x2a4b('0x162'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1f8')});db[_0x2a4b('0x101')][_0x2a4b('0x123')](db[_0x2a4b('0xfd')],{'as':'Account','foreignKey':_0x2a4b('0x1f6')});db[_0x2a4b('0x101')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x101')]['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x101')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x1f9'),'as':_0x2a4b('0x16c')});db[_0x2a4b('0x101')]['belongsToMany'](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x1f9'),'as':_0x2a4b('0x186')});db[_0x2a4b('0x101')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x16d'),'through':_0x2a4b('0x12f'),'foreignKey':_0x2a4b('0x1f8')});db[_0x2a4b('0x1f7')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':'User'});db[_0x2a4b('0x1f7')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158')});db[_0x2a4b('0x1f7')][_0x2a4b('0x123')](db[_0x2a4b('0x101')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x17c'),'foreignKey':'WhatsappInteractionId'});db[_0x2a4b('0x1f7')][_0x2a4b('0x123')](db[_0x2a4b('0xfd')],{'as':_0x2a4b('0x168'),'foreignKey':'WhatsappAccountId'});db[_0x2a4b('0x103')][_0x2a4b('0x123')](db[_0x2a4b('0xfd')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x2a4b('0xf5')],{'as':'List','foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0x103')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x103')][_0x2a4b('0x123')](db[_0x2a4b('0x101')],{});db['WhatsappQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x106')],{});db[_0x2a4b('0x103')][_0x2a4b('0x123')](db[_0x2a4b('0x1f7')],{});db['WhatsappQueueReport']['belongsTo'](db['User'],{});db[_0x2a4b('0x105')][_0x2a4b('0x123')](db[_0x2a4b('0x1f7')],{});db['WhatsappTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x101')],{});db[_0x2a4b('0x105')]['belongsTo'](db[_0x2a4b('0xfd')],{'foreignKey':'FromWhatsappAccountId','as':_0x2a4b('0x1df')});db[_0x2a4b('0x105')][_0x2a4b('0x123')](db[_0x2a4b('0xfd')],{'foreignKey':_0x2a4b('0x1fa'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x106')],{'foreignKey':'ToQueueId','as':_0x2a4b('0x1e7')});db[_0x2a4b('0x105')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db[_0x2a4b('0x105')]['belongsTo'](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e2'),'as':'ToAgent'});db[_0x2a4b('0x106')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x3a'),'foreignKey':_0x2a4b('0x1fb')});db[_0x2a4b('0x106')][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':_0x2a4b('0x1da'),'as':_0x2a4b('0x152')});db[_0x2a4b('0x10f')][_0x2a4b('0x123')](db['User'],{'as':_0x2a4b('0x1fc'),'foreignKey':_0x2a4b('0x114'),'onDelete':'cascade','hooks':!![]});db[_0x2a4b('0x108')]['hasOne'](db[_0x2a4b('0xcb')],{'as':_0x2a4b('0xcb'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x108')][_0x2a4b('0x113')](db[_0x2a4b('0x3c')],{'as':'Imap','onDelete':_0x2a4b('0x15b')});db['CloudProvider']['hasOne'](db[_0x2a4b('0x15c')],{'as':_0x2a4b('0x160'),'onDelete':_0x2a4b('0x15b')});module[_0x2a4b('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf0e4=['CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','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','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','VoiceMail','cascade','UserId','User','UserSetting','hasMany','Recordings','HopperFinals','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','Hoppers','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','Team','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteraction','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SpiedAgents','ChanSpyId','VoiceContext','Applications','VoiceMusicOnHold','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','Account','ChatWebsiteId','TagId','DashboardItem','Items','FaxAccountId','Exntensions','fax_interaction_has_tags','FaxInteractionId','FaxMessage','AttachmentId','UserFaxQueue','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteraction','user_has_sms_accounts','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessage','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Website','CompanyId','CmContactId','Company','cm_contact_has_tags','CmHopperAdditionalPhone','CmHopperId','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','Fields','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','SugarcrmConfiguration','Field','DeskAccount','VariableId','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowConfiguration','ServicenowField','Dynamics365Configuration','ChatQueueReport','FromId','SessionId','ProjectId','team_has_whatsapp_queues','TeamVoicePrefix','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','user','Imap','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','name','utf8','database','username','password','options','../api/user/user.model','VoiceChanSpy','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','import','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','../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','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../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','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0xf0e4,0x198));var _0x4f0e=function(_0x1bb981,_0x3951f7){_0x1bb981=_0x1bb981-0x0;var _0x2cdb5e=_0xf0e4[_0x1bb981];return _0x2cdb5e;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x4f0e('0x0'));var timezone=jstz[_0x4f0e('0x1')]();config[_0x4f0e('0x2')]=_[_0x4f0e('0x3')](config[_0x4f0e('0x2')],{'database':_0x4f0e('0x4'),'username':_0x4f0e('0x5'),'password':_0x4f0e('0x6'),'options':{'host':_0x4f0e('0x7'),'port':0xcea,'dialect':_0x4f0e('0x8'),'dialectOptions':{'charset':_0x4f0e('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x4f0e('0xa')}}});config[_0x4f0e('0xb')]=_[_0x4f0e('0x3')](config[_0x4f0e('0xb')],{'database':'motion2','username':_0x4f0e('0x5'),'password':_0x4f0e('0x6'),'options':{'host':_0x4f0e('0x7'),'port':0xcea,'dialect':_0x4f0e('0x8'),'dialectOptions':{'charset':_0x4f0e('0x9')},'logging':![],'timezone':timezone[_0x4f0e('0xc')](),'define':{'charset':_0x4f0e('0xd'),'collate':_0x4f0e('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x4f0e('0xe')],config[_0x4f0e('0x2')][_0x4f0e('0xf')],config[_0x4f0e('0x2')][_0x4f0e('0x10')],config[_0x4f0e('0x2')][_0x4f0e('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x4f0e('0xe')],config[_0x4f0e('0xb')]['username'],config[_0x4f0e('0xb')][_0x4f0e('0x10')],config['sequelizeHistory']['options'])};db['User']=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x12'));db[_0x4f0e('0x13')]=db['sequelize']['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0x4f0e('0x2')]['import']('../api/voiceContext/voiceContext.model');db[_0x4f0e('0x14')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x15'));db['VoiceMusicOnHold']=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x16'));db[_0x4f0e('0x17')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x18'));db[_0x4f0e('0x19')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x1b'));db['ScreenRecording']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x1c'));db['VoiceMail']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x1d'));db['VoiceMailMessage']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x1e'));db[_0x4f0e('0x1f')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x20'));db['VoiceAgentReport']=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x21'));db[_0x4f0e('0x22')]=db['sequelize']['import'](_0x4f0e('0x23'));db[_0x4f0e('0x24')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x25'));db[_0x4f0e('0x26')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x27'));db[_0x4f0e('0x28')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x4f0e('0x29')]=db['sequelize'][_0x4f0e('0x1a')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x4f0e('0x2a')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x2b'));db[_0x4f0e('0x2c')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/userChatQueue/userChatQueue.model');db[_0x4f0e('0x2d')]=db['sequelize']['import'](_0x4f0e('0x2e'));db['UserFaxQueue']=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x2f'));db[_0x4f0e('0x30')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x31'));db['UserOpenchannelQueue']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x32'));db['UserWhatsappQueue']=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x33'));db[_0x4f0e('0x34')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x35'));db[_0x4f0e('0x36')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x37'));db[_0x4f0e('0x38')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x39'));db[_0x4f0e('0x3a')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x3b'));db[_0x4f0e('0x3c')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x3d'));db[_0x4f0e('0x3e')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x3f'));db[_0x4f0e('0x40')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x41'));db[_0x4f0e('0x42')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/mailApplication/mailApplication.model');db[_0x4f0e('0x43')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x44'));db[_0x4f0e('0x45')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x46'));db['DashboardItem']=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x47'));db['FaxAccount']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x48'));db[_0x4f0e('0x49')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x4a'));db[_0x4f0e('0x4b')]=db['sequelize']['import'](_0x4f0e('0x4c'));db['FaxMessage']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x4d'));db[_0x4f0e('0x4e')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x4f'));db['FaxQueueReport']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x50'));db[_0x4f0e('0x51')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x52'));db['SmsApplication']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x53'));db['SmsInteraction']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x54'));db[_0x4f0e('0x55')]=db['sequelize']['import'](_0x4f0e('0x56'));db['SmsQueue']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x57'));db[_0x4f0e('0x58')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x59'));db[_0x4f0e('0x5a')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x5b'));db['OpenchannelInteraction']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x5c'));db[_0x4f0e('0x5d')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x5e'));db[_0x4f0e('0x5f')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x60'));db['ChatWebsite']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/chatWebsite/chatWebsite.model');db[_0x4f0e('0x61')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x4f0e('0x62')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/chatApplication/chatApplication.model');db[_0x4f0e('0x63')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x64'));db[_0x4f0e('0x65')]=db['sequelize']['import'](_0x4f0e('0x66'));db['ChatOfflineMessage']=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x67'));db[_0x4f0e('0x68')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x69'));db[_0x4f0e('0x6a')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x6b'));db[_0x4f0e('0x6c')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x6d'));db[_0x4f0e('0x6e')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x6f'));db[_0x4f0e('0x70')]=db['sequelize'][_0x4f0e('0x1a')]('../api/cmContact/cmContact.model');db[_0x4f0e('0x71')]=db[_0x4f0e('0x2')]['import']('../api/cmHopper/cmHopper.model');db[_0x4f0e('0x72')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x73'));db[_0x4f0e('0x74')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x75'));db[_0x4f0e('0x76')]=db['sequelize']['import'](_0x4f0e('0x77'));db['ReportAgentPreview']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x78'));db[_0x4f0e('0x79')]=db['sequelize']['import']('../api/cmCustomField/cmCustomField.model');db[_0x4f0e('0x7a')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x7b'));db[_0x4f0e('0x7c')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x7d'));db[_0x4f0e('0x7e')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/cannedAnswer/cannedAnswer.model');db[_0x4f0e('0x7f')]=db['sequelize'][_0x4f0e('0x1a')]('../api/disposition/disposition.model');db[_0x4f0e('0x80')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x81'));db[_0x4f0e('0x82')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x83'));db['Pause']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x84'));db[_0x4f0e('0x85')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x86'));db[_0x4f0e('0x87')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x4f0e('0x88')]=db['sequelize'][_0x4f0e('0x1a')]('../api/schedule/schedule.model');db['Sound']=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x89'));db[_0x4f0e('0x8a')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x8b'));db[_0x4f0e('0x8c')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/contactItemType/contactItemType.model');db[_0x4f0e('0x8d')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x8e'));db['CmHopperAdditionalPhone']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x8f'));db[_0x4f0e('0x90')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0x91'));db[_0x4f0e('0x92')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x93'));db[_0x4f0e('0x94')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/variable/variable.model');db[_0x4f0e('0x95')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x96'));db['IntegrationReport']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x97'));db[_0x4f0e('0x98')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x99'));db[_0x4f0e('0x9a')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x9b'));db[_0x4f0e('0x9c')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x4f0e('0x9d')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x9e'));db[_0x4f0e('0x9f')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xa0'));db['AnalyticTreeReport']=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0xa1'));db[_0x4f0e('0xa2')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xa3'));db[_0x4f0e('0xa4')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xa5'));db[_0x4f0e('0xa6')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xa7'));db[_0x4f0e('0xa8')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xa9'));db['SugarcrmConfiguration']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xaa'));db[_0x4f0e('0xab')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xac'));db['DeskAccount']=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xad'));db[_0x4f0e('0xae')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xaf'));db[_0x4f0e('0xb0')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xb1'));db[_0x4f0e('0xb2')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/intZohoAccount/intZohoAccount.model');db[_0x4f0e('0xb3')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0xb4'));db[_0x4f0e('0xb5')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/intZohoField/intZohoField.model');db[_0x4f0e('0xb6')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xb7'));db[_0x4f0e('0xb8')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xb9'));db[_0x4f0e('0xba')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xbb'));db[_0x4f0e('0xbc')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x4f0e('0xbd')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xbe'));db['FreshdeskField']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x4f0e('0xbf')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xc0'));db['VtigerConfiguration']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xc1'));db['VtigerField']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xc2'));db[_0x4f0e('0xc3')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xc4'));db['ServicenowField']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xc5'));db[_0x4f0e('0xc6')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xc7'));db['Dynamics365Configuration']=db['sequelize']['import'](_0x4f0e('0xc8'));db[_0x4f0e('0xc9')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xca'));db[_0x4f0e('0xcb')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xcc'));db[_0x4f0e('0xcd')]=db[_0x4f0e('0x2')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x4f0e('0xce')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xcf'));db[_0x4f0e('0x95')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x96'));db['Network']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/network/network.model');db['ChatQueueReport']=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xd0'));db['ChatInternalMessage']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xd1'));db[_0x4f0e('0xd2')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xd3'));db[_0x4f0e('0xd4')]=db[_0x4f0e('0x2')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x4f0e('0xd5')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xd6'));db[_0x4f0e('0xd7')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xd8'));db['SquareReport']=db['sequelize']['import'](_0x4f0e('0xd9'));db[_0x4f0e('0xda')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xdb'));db[_0x4f0e('0xdc')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/jscriptyProject/jscriptyProject.model');db[_0x4f0e('0xdd')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xde'));db[_0x4f0e('0xdf')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xe0'));db[_0x4f0e('0xe1')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0xe2'));db[_0x4f0e('0xe3')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0xe4'));db[_0x4f0e('0xe5')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xe6'));db['Team']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xe7'));db[_0x4f0e('0xe8')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xe9'));db[_0x4f0e('0xea')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xeb'));db[_0x4f0e('0xec')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xed'));db[_0x4f0e('0xee')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xef'));db[_0x4f0e('0xf0')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xf1'));db[_0x4f0e('0xf2')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xf3'));db[_0x4f0e('0xf4')]=db[_0x4f0e('0x2')]['import'](_0x4f0e('0xf5'));db[_0x4f0e('0xf6')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xf7'));db['OpenchannelTransferReport']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xf8'));db['SmsTransferReport']=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0xf9'));db[_0x4f0e('0xfa')]=db['sequelize']['import']('../api/cmList/cmList.model');db[_0x4f0e('0xfb')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0xfc'));db[_0x4f0e('0xfd')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0xfe'));db[_0x4f0e('0xff')]=db[_0x4f0e('0x2')]['import']('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x100'));db[_0x4f0e('0x101')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x102'));db[_0x4f0e('0x103')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x104'));db[_0x4f0e('0x105')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x106'));db['WhatsappInteraction']=db[_0x4f0e('0x2')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x4f0e('0x107')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x108'));db[_0x4f0e('0x109')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x10a'));db[_0x4f0e('0x10b')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x10c'));db[_0x4f0e('0x10d')]=db[_0x4f0e('0x2')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0x4f0e('0x10e')]=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x4f0e('0x2')][_0x4f0e('0x1a')](_0x4f0e('0x10f'));db[_0x4f0e('0x110')]=db['sequelize'][_0x4f0e('0x1a')](_0x4f0e('0x111'));db['UserSetting']=db[_0x4f0e('0x2')]['import']('../api/user-setting/user-setting.model');db[_0x4f0e('0x112')]=db['sequelize']['import'](_0x4f0e('0x113'));db['User'][_0x4f0e('0x114')](db['VoiceMail'],{'as':_0x4f0e('0x115'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')][_0x4f0e('0x114')](db[_0x4f0e('0x119')],{'as':'userSetting','onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')][_0x4f0e('0x11a')](db[_0x4f0e('0x19')],{'as':_0x4f0e('0x11b'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')][_0x4f0e('0x11a')](db[_0x4f0e('0x29')],{'as':'VoiceQueuesRt','foreignKey':_0x4f0e('0x117')});db['User'][_0x4f0e('0x11a')](db[_0x4f0e('0x14')],{'as':'Extensions','onDelete':_0x4f0e('0x116'),'hooks':!![]});db[_0x4f0e('0x118')]['hasMany'](db['CmHopperFinal'],{'as':_0x4f0e('0x11c'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')]['hasMany'](db[_0x4f0e('0x76')],{'as':'HopperHistory','foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')]['hasMany'](db[_0x4f0e('0x11d')],{'as':_0x4f0e('0x11d'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')][_0x4f0e('0x11a')](db['OpenchannelInteraction'],{'as':_0x4f0e('0x11e'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')][_0x4f0e('0x11a')](db['ChatInteraction'],{'as':_0x4f0e('0x11f'),'foreignKey':'UserId'});db['User'][_0x4f0e('0x11a')](db['SmsInteraction'],{'as':_0x4f0e('0x120'),'foreignKey':'UserId'});db[_0x4f0e('0x118')]['hasMany'](db[_0x4f0e('0x4b')],{'as':_0x4f0e('0x121'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')][_0x4f0e('0x11a')](db[_0x4f0e('0x3e')],{'as':_0x4f0e('0x122'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')]['hasMany'](db[_0x4f0e('0x123')],{'as':'WhatsappInteractions','foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x118')][_0x4f0e('0x11a')](db[_0x4f0e('0x101')],{'as':_0x4f0e('0x124'),'foreignKey':_0x4f0e('0x125')});db[_0x4f0e('0x118')][_0x4f0e('0x11a')](db[_0x4f0e('0x71')],{'as':_0x4f0e('0x126'),'foreignKey':_0x4f0e('0x117'),'onDelete':'SET\x20NULL'});db[_0x4f0e('0x118')][_0x4f0e('0x127')](db[_0x4f0e('0xfd')],{'as':_0x4f0e('0xfd'),'foreignKey':_0x4f0e('0x128')});db['User'][_0x4f0e('0x129')](db[_0x4f0e('0x6a')],{'as':_0x4f0e('0x12a'),'through':_0x4f0e('0x12b')});db['User']['belongsToMany'](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x12c'),'through':_0x4f0e('0x12d')});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db['CmList'],{'as':_0x4f0e('0x12e'),'through':'cm_user_has_lists'});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db[_0x4f0e('0x12f')],{'through':_0x4f0e('0x130')});db['User'][_0x4f0e('0x129')](db['MailInteraction'],{'as':_0x4f0e('0x122'),'through':_0x4f0e('0x131')});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db[_0x4f0e('0x63')],{'as':_0x4f0e('0x11f'),'through':'user_has_chat_interactions'});db['User'][_0x4f0e('0x129')](db['FaxInteraction'],{'as':_0x4f0e('0x121'),'through':_0x4f0e('0x132')});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db['SmsInteraction'],{'as':_0x4f0e('0x120'),'through':_0x4f0e('0x133')});db[_0x4f0e('0x118')]['belongsToMany'](db[_0x4f0e('0x134')],{'as':_0x4f0e('0x11e'),'through':_0x4f0e('0x135')});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db[_0x4f0e('0x123')],{'as':'WhatsappInteractions','through':_0x4f0e('0x136')});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db['VoiceQueue'],{'as':_0x4f0e('0x137'),'through':_0x4f0e('0x2a'),'required':![]});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db[_0x4f0e('0xfb')],{'as':_0x4f0e('0x138'),'through':_0x4f0e('0x110'),'required':![]});db['User']['belongsToMany'](db['MailQueue'],{'as':_0x4f0e('0x139'),'through':_0x4f0e('0x2d'),'required':![]});db[_0x4f0e('0x118')]['belongsToMany'](db[_0x4f0e('0x68')],{'as':_0x4f0e('0x13a'),'through':_0x4f0e('0x2c'),'required':![],'hooks':!![]});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db[_0x4f0e('0x4e')],{'as':_0x4f0e('0x13b'),'through':'UserFaxQueue','required':![]});db['User'][_0x4f0e('0x129')](db[_0x4f0e('0x13c')],{'as':_0x4f0e('0x13d'),'through':_0x4f0e('0x30'),'required':![]});db['User'][_0x4f0e('0x129')](db[_0x4f0e('0x5f')],{'as':_0x4f0e('0x13e'),'through':_0x4f0e('0x13f'),'required':![]});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db[_0x4f0e('0x10d')],{'as':_0x4f0e('0x140'),'through':'UserWhatsappQueue','required':![]});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db['CmList'],{'through':_0x4f0e('0x141')});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db[_0x4f0e('0x142')],{'as':_0x4f0e('0x143'),'through':_0x4f0e('0x144')});db['User'][_0x4f0e('0x129')](db[_0x4f0e('0x145')],{'as':'FaxAccounts','through':_0x4f0e('0x146')});db['User'][_0x4f0e('0x129')](db[_0x4f0e('0x38')],{'as':_0x4f0e('0x147'),'through':_0x4f0e('0x148')});db[_0x4f0e('0x118')]['belongsToMany'](db[_0x4f0e('0x58')],{'as':_0x4f0e('0x149'),'through':_0x4f0e('0x14a')});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db[_0x4f0e('0x51')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x4f0e('0x118')][_0x4f0e('0x129')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x4f0e('0x13')][_0x4f0e('0x11a')](db['VoiceExtension'],{'as':_0x4f0e('0x14b'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x14c')});db[_0x4f0e('0x14d')]['hasMany'](db[_0x4f0e('0x14')],{'onDelete':_0x4f0e('0x116')});db['VoiceExtension'][_0x4f0e('0x11a')](db['VoiceExtension'],{'as':_0x4f0e('0x14e'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x14f')][_0x4f0e('0x129')](db[_0x4f0e('0x150')],{'as':_0x4f0e('0x151'),'through':_0x4f0e('0x152')});db['VoiceQueue']['hasMany'](db[_0x4f0e('0x29')],{'as':_0x4f0e('0x153'),'foreignKey':_0x4f0e('0x154')});db[_0x4f0e('0x17')]['hasMany'](db[_0x4f0e('0x71')],{'as':_0x4f0e('0x126'),'foreignKey':_0x4f0e('0x154')});db[_0x4f0e('0x17')][_0x4f0e('0x11a')](db[_0x4f0e('0x74')],{'as':'HopperFinals','foreignKey':_0x4f0e('0x154')});db[_0x4f0e('0x17')][_0x4f0e('0x11a')](db[_0x4f0e('0x76')],{'as':_0x4f0e('0x155'),'foreignKey':_0x4f0e('0x154')});db[_0x4f0e('0x17')][_0x4f0e('0x11a')](db[_0x4f0e('0x11d')],{'as':_0x4f0e('0x11d'),'foreignKey':_0x4f0e('0x154')});db[_0x4f0e('0x17')]['hasMany'](db[_0x4f0e('0x72')],{'as':_0x4f0e('0x156'),'foreignKey':'VoiceQueueId'});db[_0x4f0e('0x17')][_0x4f0e('0x11a')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x4f0e('0x154')});db[_0x4f0e('0x17')][_0x4f0e('0x127')](db[_0x4f0e('0x26')],{'as':'Trunk','foreignKey':_0x4f0e('0x157')});db['VoiceQueue'][_0x4f0e('0x127')](db[_0x4f0e('0x26')],{'as':'TrunkBackup','foreignKey':_0x4f0e('0x158')});db['VoiceQueue'][_0x4f0e('0x127')](db[_0x4f0e('0x82')],{'as':_0x4f0e('0x82'),'foreignKey':_0x4f0e('0x159')});db[_0x4f0e('0x17')][_0x4f0e('0x127')](db[_0x4f0e('0x15a')],{'as':'mandatoryDispositionPause','foreignKey':_0x4f0e('0x15b')});db[_0x4f0e('0x17')][_0x4f0e('0x129')](db[_0x4f0e('0xfa')],{'as':'Lists','through':_0x4f0e('0x15c')});db[_0x4f0e('0x17')][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':'UserVoiceQueue'});db[_0x4f0e('0x17')][_0x4f0e('0x129')](db['Team'],{'as':_0x4f0e('0x15e'),'through':_0x4f0e('0x15f')});db[_0x4f0e('0x17')]['belongsToMany'](db[_0x4f0e('0xfa')],{'as':_0x4f0e('0x160'),'through':_0x4f0e('0x161')});db[_0x4f0e('0x19')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':'User','foreignKey':'UserId'});db['ScreenRecording'][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x118'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x115')][_0x4f0e('0x11a')](db[_0x4f0e('0x162')],{'as':_0x4f0e('0x163'),'onDelete':'cascade','foreignKey':_0x4f0e('0x164'),'sourceKey':_0x4f0e('0x165')});db[_0x4f0e('0x162')][_0x4f0e('0x127')](db[_0x4f0e('0x115')],{'foreignKey':_0x4f0e('0x164'),'targetKey':_0x4f0e('0x165')});db[_0x4f0e('0x166')][_0x4f0e('0x11a')](db[_0x4f0e('0x22')],{'as':'QueueCalls','foreignKey':_0x4f0e('0x167'),'constraints':![]});db[_0x4f0e('0x166')][_0x4f0e('0x11a')](db[_0x4f0e('0x168')],{'as':_0x4f0e('0x169'),'foreignKey':'uniqueid','constraints':![]});db[_0x4f0e('0x166')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x118'),'foreignKey':'UserId'});db[_0x4f0e('0x166')][_0x4f0e('0x127')](db['CmContact'],{'as':_0x4f0e('0x16a'),'foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x34')][_0x4f0e('0x127')](db[_0x4f0e('0x38')],{'as':_0x4f0e('0x38'),'foreignKey':_0x4f0e('0x16c')});db['MailServerIn'][_0x4f0e('0x127')](db[_0x4f0e('0x10e')],{'as':'CloudProvider','foreignKey':_0x4f0e('0x16d'),'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x36')][_0x4f0e('0x127')](db['MailAccount'],{'as':_0x4f0e('0x38'),'foreignKey':_0x4f0e('0x16c')});db[_0x4f0e('0x36')][_0x4f0e('0x127')](db[_0x4f0e('0x10e')],{'as':_0x4f0e('0x10e'),'foreignKey':_0x4f0e('0x16d'),'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x38')][_0x4f0e('0x114')](db['MailServerIn'],{'as':'Imap','onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x38')]['hasOne'](db[_0x4f0e('0x36')],{'as':_0x4f0e('0x16f'),'onDelete':_0x4f0e('0x116')});db['MailAccount'][_0x4f0e('0x11a')](db[_0x4f0e('0x7f')],{'as':_0x4f0e('0x170'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x4f0e('0x38')]['hasMany'](db[_0x4f0e('0x7e')],{'as':_0x4f0e('0x171'),'foreignKey':'MailAccountId'});db[_0x4f0e('0x38')][_0x4f0e('0x11a')](db[_0x4f0e('0x40')],{'as':_0x4f0e('0x163'),'foreignKey':_0x4f0e('0x16c')});db[_0x4f0e('0x38')][_0x4f0e('0x11a')](db[_0x4f0e('0x3e')],{'as':_0x4f0e('0x172')});db[_0x4f0e('0x38')][_0x4f0e('0x11a')](db[_0x4f0e('0x42')],{'as':_0x4f0e('0x14e'),'foreignKey':_0x4f0e('0x16c'),'onDelete':_0x4f0e('0x116')});db['MailAccount']['belongsTo'](db[_0x4f0e('0xfa')],{'as':_0x4f0e('0x173'),'foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0x38')][_0x4f0e('0x127')](db['Template'],{'as':'Template','foreignKey':_0x4f0e('0x175')});db['MailAccount']['belongsTo'](db[_0x4f0e('0x15a')],{'as':_0x4f0e('0x176'),'foreignKey':_0x4f0e('0x15b')});db[_0x4f0e('0x38')][_0x4f0e('0x129')](db['User'],{'as':_0x4f0e('0x15d'),'through':'user_has_mail_accounts'});db[_0x4f0e('0x3a')][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':_0x4f0e('0x2d')});db[_0x4f0e('0x3a')][_0x4f0e('0x129')](db[_0x4f0e('0x12f')],{'through':_0x4f0e('0x177'),'as':_0x4f0e('0x15e')});db['MailInteraction'][_0x4f0e('0x11a')](db[_0x4f0e('0x40')],{'as':'Messages','onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x178')});db[_0x4f0e('0x3e')][_0x4f0e('0x127')](db[_0x4f0e('0x38')],{'as':'Account','foreignKey':_0x4f0e('0x16c')});db[_0x4f0e('0x3e')][_0x4f0e('0x127')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x4f0e('0x3e')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x179'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x3e')][_0x4f0e('0x129')](db['Tag'],{'through':_0x4f0e('0x17a'),'as':_0x4f0e('0x17b')});db[_0x4f0e('0x3e')][_0x4f0e('0x129')](db[_0x4f0e('0x8a')],{'through':_0x4f0e('0x17a'),'as':_0x4f0e('0x17c')});db[_0x4f0e('0x3e')][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x17d'),'through':_0x4f0e('0x131'),'foreignKey':_0x4f0e('0x178')});db['MailMessage']['hasMany'](db['Attachment'],{'as':_0x4f0e('0x17e'),'onDelete':'cascade'});db['MailMessage'][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x118')});db[_0x4f0e('0x40')]['belongsTo'](db[_0x4f0e('0x70')],{'onDelete':'cascade','as':_0x4f0e('0x16a')});db[_0x4f0e('0x40')]['belongsTo'](db[_0x4f0e('0x3e')],{'as':_0x4f0e('0x17f'),'foreignKey':_0x4f0e('0x178')});db[_0x4f0e('0x40')][_0x4f0e('0x127')](db[_0x4f0e('0x38')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x16c')});db[_0x4f0e('0x40')][_0x4f0e('0x127')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0x4f0e('0x181')});db[_0x4f0e('0x40')][_0x4f0e('0x127')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'onDelete':_0x4f0e('0x16e')});db['MailApplication'][_0x4f0e('0x127')](db[_0x4f0e('0x3a')],{'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x42')]['belongsTo'](db[_0x4f0e('0x38')],{'onDelete':_0x4f0e('0x16e')});db['MailApplication'][_0x4f0e('0x127')](db[_0x4f0e('0x82')],{'onDelete':'restrict','foreignKey':_0x4f0e('0x159')});db[_0x4f0e('0x42')]['belongsTo'](db[_0x4f0e('0x8a')],{'onDelete':_0x4f0e('0x16e'),'foreignKey':_0x4f0e('0x182')});db[_0x4f0e('0x43')]['belongsTo'](db[_0x4f0e('0x38')],{});db[_0x4f0e('0x43')]['belongsTo'](db[_0x4f0e('0xfa')],{'as':_0x4f0e('0x173'),'foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0x43')][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x16a'),'foreignKey':_0x4f0e('0x16b')});db['MailQueueReport'][_0x4f0e('0x127')](db['MailInteraction'],{});db[_0x4f0e('0x43')][_0x4f0e('0x127')](db[_0x4f0e('0x40')],{});db['MailQueueReport']['belongsTo'](db['User'],{});db[_0x4f0e('0x43')][_0x4f0e('0x127')](db['MailQueue'],{});db[_0x4f0e('0x45')][_0x4f0e('0x11a')](db[_0x4f0e('0x183')],{'as':_0x4f0e('0x184'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x145')][_0x4f0e('0x11a')](db[_0x4f0e('0x7f')],{'as':_0x4f0e('0x170'),'foreignKey':_0x4f0e('0x185'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x145')]['hasMany'](db['CannedAnswer'],{'as':_0x4f0e('0x171'),'foreignKey':_0x4f0e('0x185')});db[_0x4f0e('0x145')][_0x4f0e('0x11a')](db[_0x4f0e('0x4b')],{'as':_0x4f0e('0x172')});db[_0x4f0e('0x145')][_0x4f0e('0x11a')](db[_0x4f0e('0x49')],{'as':_0x4f0e('0x14e'),'foreignKey':_0x4f0e('0x185'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x145')][_0x4f0e('0x11a')](db['VoiceExtension'],{'as':_0x4f0e('0x186'),'onDelete':_0x4f0e('0x116')});db['FaxAccount'][_0x4f0e('0x11a')](db['FaxMessage'],{'as':'Messages'});db[_0x4f0e('0x145')][_0x4f0e('0x127')](db[_0x4f0e('0x26')],{'as':'Trunk'});db[_0x4f0e('0x145')][_0x4f0e('0x127')](db[_0x4f0e('0xfa')],{'as':_0x4f0e('0x173'),'foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0x145')][_0x4f0e('0x127')](db['Pause'],{'as':_0x4f0e('0x176'),'foreignKey':_0x4f0e('0x15b')});db['FaxAccount'][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':_0x4f0e('0x146')});db[_0x4f0e('0x49')]['belongsTo'](db['User'],{'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x49')][_0x4f0e('0x127')](db[_0x4f0e('0x4e')],{'onDelete':'restrict'});db[_0x4f0e('0x49')][_0x4f0e('0x127')](db['FaxAccount'],{'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x49')]['belongsTo'](db[_0x4f0e('0x8a')],{'onDelete':_0x4f0e('0x16e'),'foreignKey':_0x4f0e('0x182')});db[_0x4f0e('0x4b')]['hasMany'](db['FaxMessage'],{'as':_0x4f0e('0x163'),'onDelete':_0x4f0e('0x116'),'foreignKey':'FaxInteractionId'});db[_0x4f0e('0x4b')][_0x4f0e('0x127')](db[_0x4f0e('0x145')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x185')});db['FaxInteraction'][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x16a'),'foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x4b')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':'Owner','foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x4b')][_0x4f0e('0x129')](db[_0x4f0e('0x8a')],{'through':_0x4f0e('0x187'),'as':_0x4f0e('0x17b')});db[_0x4f0e('0x4b')][_0x4f0e('0x129')](db[_0x4f0e('0x8a')],{'through':_0x4f0e('0x187'),'as':'ThroughTags'});db[_0x4f0e('0x4b')][_0x4f0e('0x129')](db['User'],{'as':_0x4f0e('0x17d'),'through':_0x4f0e('0x132'),'foreignKey':_0x4f0e('0x188')});db[_0x4f0e('0x189')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'onDelete':_0x4f0e('0x116'),'as':_0x4f0e('0x118')});db[_0x4f0e('0x189')][_0x4f0e('0x127')](db[_0x4f0e('0x4b')],{'as':'Interaction','foreignKey':_0x4f0e('0x188')});db['FaxMessage'][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'onDelete':_0x4f0e('0x116'),'as':'Contact'});db[_0x4f0e('0x189')][_0x4f0e('0x127')](db[_0x4f0e('0xee')],{'as':'Attachment','foreignKey':_0x4f0e('0x18a')});db['FaxMessage'][_0x4f0e('0x127')](db[_0x4f0e('0x145')],{'as':'Account','foreignKey':_0x4f0e('0x185')});db[_0x4f0e('0x4e')][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':_0x4f0e('0x18b')});db[_0x4f0e('0x4e')][_0x4f0e('0x129')](db[_0x4f0e('0x12f')],{'through':_0x4f0e('0x18c'),'as':_0x4f0e('0x15e')});db[_0x4f0e('0x18d')][_0x4f0e('0x127')](db[_0x4f0e('0x145')],{});db[_0x4f0e('0x18d')][_0x4f0e('0x127')](db['CmList'],{'as':'List','foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0x18d')][_0x4f0e('0x127')](db['CmContact'],{'as':_0x4f0e('0x16a'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x4f0e('0x127')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x4f0e('0x127')](db[_0x4f0e('0x189')],{});db[_0x4f0e('0x18d')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{});db[_0x4f0e('0x18d')][_0x4f0e('0x127')](db[_0x4f0e('0x4e')],{});db[_0x4f0e('0x51')]['hasMany'](db[_0x4f0e('0x7f')],{'as':'Dispositions','foreignKey':_0x4f0e('0x18e'),'onDelete':'cascade'});db[_0x4f0e('0x51')]['hasMany'](db[_0x4f0e('0x7e')],{'as':_0x4f0e('0x171'),'foreignKey':'SmsAccountId'});db[_0x4f0e('0x51')][_0x4f0e('0x11a')](db[_0x4f0e('0x55')],{'as':_0x4f0e('0x163'),'foreignKey':_0x4f0e('0x18e')});db[_0x4f0e('0x51')]['hasMany'](db[_0x4f0e('0x18f')],{'as':_0x4f0e('0x172')});db[_0x4f0e('0x51')][_0x4f0e('0x11a')](db['SmsApplication'],{'as':_0x4f0e('0x14e'),'foreignKey':_0x4f0e('0x18e'),'onDelete':_0x4f0e('0x116')});db['SmsAccount']['belongsTo'](db[_0x4f0e('0xfa')],{'as':'List','foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0x51')][_0x4f0e('0x127')](db[_0x4f0e('0x15a')],{'as':'mandatoryDispositionPause','foreignKey':_0x4f0e('0x15b')});db['SmsAccount'][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':_0x4f0e('0x190')});db[_0x4f0e('0x191')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x191')][_0x4f0e('0x127')](db['SmsQueue'],{'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x191')][_0x4f0e('0x127')](db[_0x4f0e('0x51')],{'onDelete':'restrict'});db[_0x4f0e('0x191')]['belongsTo'](db[_0x4f0e('0x82')],{'onDelete':'restrict','foreignKey':_0x4f0e('0x159')});db[_0x4f0e('0x191')]['belongsTo'](db[_0x4f0e('0x8a')],{'onDelete':_0x4f0e('0x16e'),'foreignKey':'TagId'});db[_0x4f0e('0x18f')][_0x4f0e('0x11a')](db[_0x4f0e('0x55')],{'as':_0x4f0e('0x163'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x192')});db['SmsInteraction'][_0x4f0e('0x127')](db[_0x4f0e('0x51')],{'as':'Account','foreignKey':_0x4f0e('0x18e')});db['SmsInteraction']['belongsTo'](db['CmContact'],{'as':_0x4f0e('0x16a'),'foreignKey':'ContactId'});db[_0x4f0e('0x18f')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x179'),'foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x18f')]['belongsToMany'](db['Tag'],{'through':_0x4f0e('0x193'),'as':_0x4f0e('0x17b')});db[_0x4f0e('0x18f')]['belongsToMany'](db[_0x4f0e('0x8a')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x4f0e('0x18f')][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x17d'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0x4f0e('0x55')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x118')});db[_0x4f0e('0x55')][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'onDelete':_0x4f0e('0x116'),'as':_0x4f0e('0x16a')});db[_0x4f0e('0x55')][_0x4f0e('0x127')](db['SmsInteraction'],{'onDelete':_0x4f0e('0x116'),'as':_0x4f0e('0x17f'),'foreignKey':_0x4f0e('0x192')});db[_0x4f0e('0x55')][_0x4f0e('0x127')](db[_0x4f0e('0x51')],{'as':'Account','foreignKey':_0x4f0e('0x18e')});db[_0x4f0e('0x13c')]['belongsToMany'](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':'UserSmsQueue','foreignKey':_0x4f0e('0x194')});db[_0x4f0e('0x13c')][_0x4f0e('0x129')](db['Team'],{'through':_0x4f0e('0x195'),'as':_0x4f0e('0x15e')});db[_0x4f0e('0x58')][_0x4f0e('0x11a')](db[_0x4f0e('0x7f')],{'as':_0x4f0e('0x170'),'foreignKey':_0x4f0e('0x196'),'onDelete':_0x4f0e('0x116')});db['OpenchannelAccount'][_0x4f0e('0x11a')](db[_0x4f0e('0x7e')],{'as':_0x4f0e('0x171'),'foreignKey':_0x4f0e('0x196')});db[_0x4f0e('0x58')]['hasMany'](db[_0x4f0e('0x134')],{'as':_0x4f0e('0x172'),'foreignKey':_0x4f0e('0x196')});db['OpenchannelAccount'][_0x4f0e('0x11a')](db['OpenchannelMessage'],{'as':_0x4f0e('0x163'),'foreignKey':_0x4f0e('0x196')});db[_0x4f0e('0x58')]['hasMany'](db[_0x4f0e('0x5a')],{'as':_0x4f0e('0x14e'),'foreignKey':_0x4f0e('0x196'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x58')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x4f0e('0x174')});db['OpenchannelAccount']['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x4f0e('0x15b')});db[_0x4f0e('0x58')][_0x4f0e('0x129')](db['User'],{'as':'Agents','through':_0x4f0e('0x14a')});db[_0x4f0e('0x5a')]['belongsTo'](db[_0x4f0e('0x118')],{'onDelete':'restrict'});db[_0x4f0e('0x5a')][_0x4f0e('0x127')](db['OpenchannelQueue'],{'onDelete':_0x4f0e('0x16e'),'foreignKey':_0x4f0e('0x197')});db['OpenchannelApplication'][_0x4f0e('0x127')](db['OpenchannelAccount'],{'onDelete':_0x4f0e('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0x4f0e('0x5a')]['belongsTo'](db[_0x4f0e('0x82')],{'onDelete':'restrict','foreignKey':_0x4f0e('0x159')});db[_0x4f0e('0x5a')][_0x4f0e('0x127')](db[_0x4f0e('0x8a')],{'onDelete':_0x4f0e('0x16e'),'foreignKey':'TagId'});db[_0x4f0e('0x134')][_0x4f0e('0x11a')](db[_0x4f0e('0x5d')],{'as':_0x4f0e('0x163'),'onDelete':'cascade','foreignKey':_0x4f0e('0x198')});db[_0x4f0e('0x134')][_0x4f0e('0x127')](db[_0x4f0e('0x58')],{'as':'Account','foreignKey':_0x4f0e('0x196')});db[_0x4f0e('0x134')][_0x4f0e('0x127')](db['CmContact'],{'as':_0x4f0e('0x16a'),'foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x134')][_0x4f0e('0x127')](db['User'],{'as':'Owner','foreignKey':_0x4f0e('0x117')});db[_0x4f0e('0x134')][_0x4f0e('0x129')](db[_0x4f0e('0x8a')],{'through':_0x4f0e('0x199'),'as':_0x4f0e('0x17b')});db['OpenchannelInteraction']['belongsToMany'](db[_0x4f0e('0x8a')],{'through':_0x4f0e('0x199'),'as':_0x4f0e('0x17c')});db[_0x4f0e('0x134')][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x17d'),'through':_0x4f0e('0x135'),'foreignKey':_0x4f0e('0x198')});db[_0x4f0e('0x5d')]['belongsTo'](db[_0x4f0e('0x118')],{'onDelete':_0x4f0e('0x116'),'as':_0x4f0e('0x118')});db[_0x4f0e('0x5d')][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'onDelete':'cascade','as':_0x4f0e('0x16a')});db[_0x4f0e('0x5d')][_0x4f0e('0x127')](db[_0x4f0e('0x134')],{'onDelete':_0x4f0e('0x116'),'as':_0x4f0e('0x17f'),'foreignKey':_0x4f0e('0x198')});db['OpenchannelMessage'][_0x4f0e('0x127')](db[_0x4f0e('0xee')],{'as':_0x4f0e('0xee'),'foreignKey':_0x4f0e('0x18a')});db[_0x4f0e('0x5d')][_0x4f0e('0x127')](db[_0x4f0e('0x58')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x196')});db['OpenchannelQueue']['belongsToMany'](db['User'],{'as':_0x4f0e('0x15d'),'through':_0x4f0e('0x13f'),'foreignKey':'OpenchannelQueueId'});db[_0x4f0e('0x5f')][_0x4f0e('0x129')](db[_0x4f0e('0x12f')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x4f0e('0x142')]['hasMany'](db[_0x4f0e('0x7f')],{'as':_0x4f0e('0x170'),'foreignKey':_0x4f0e('0x181'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x142')][_0x4f0e('0x11a')](db[_0x4f0e('0x7e')],{'as':_0x4f0e('0x171'),'foreignKey':'ChatWebsiteId'});db[_0x4f0e('0x142')][_0x4f0e('0x11a')](db[_0x4f0e('0x6c')],{'as':_0x4f0e('0x19a')});db[_0x4f0e('0x142')]['hasMany'](db[_0x4f0e('0x63')],{'as':_0x4f0e('0x172')});db['ChatWebsite'][_0x4f0e('0x11a')](db[_0x4f0e('0x62')],{'as':_0x4f0e('0x14e'),'foreignKey':'ChatWebsiteId','onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x142')][_0x4f0e('0x11a')](db['ChatMessage'],{'as':'Messages'});db[_0x4f0e('0x142')][_0x4f0e('0x127')](db[_0x4f0e('0xfa')],{'as':_0x4f0e('0x173'),'foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0x142')][_0x4f0e('0x127')](db[_0x4f0e('0x82')],{'as':_0x4f0e('0x82'),'foreignKey':_0x4f0e('0x159')});db['ChatWebsite'][_0x4f0e('0x127')](db[_0x4f0e('0x38')],{'as':_0x4f0e('0x38'),'foreignKey':_0x4f0e('0x16c')});db[_0x4f0e('0x142')]['belongsTo'](db[_0x4f0e('0x15a')],{'as':_0x4f0e('0x176'),'foreignKey':_0x4f0e('0x15b')});db['ChatWebsite'][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':'Agents','through':_0x4f0e('0x144')});db[_0x4f0e('0x61')][_0x4f0e('0x127')](db[_0x4f0e('0x58')],{});db[_0x4f0e('0x61')][_0x4f0e('0x127')](db[_0x4f0e('0xfa')],{'as':_0x4f0e('0x173'),'foreignKey':_0x4f0e('0x174')});db['OpenchannelQueueReport']['belongsTo'](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x16a'),'foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x61')]['belongsTo'](db[_0x4f0e('0x134')],{});db[_0x4f0e('0x61')][_0x4f0e('0x127')](db[_0x4f0e('0x5d')],{});db[_0x4f0e('0x61')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{});db[_0x4f0e('0x61')][_0x4f0e('0x127')](db[_0x4f0e('0x5f')],{});db[_0x4f0e('0x62')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':'Agent','foreignKey':_0x4f0e('0x117'),'onDelete':_0x4f0e('0x16e')});db['ChatApplication'][_0x4f0e('0x127')](db['ChatQueue'],{'as':_0x4f0e('0x19b'),'foreignKey':_0x4f0e('0x19c'),'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x62')]['belongsTo'](db['ChatWebsite'],{'as':'Website','foreignKey':_0x4f0e('0x181'),'onDelete':_0x4f0e('0x16e')});db['ChatApplication']['belongsTo'](db['Tag'],{'onDelete':_0x4f0e('0x16e'),'foreignKey':_0x4f0e('0x182')});db['ChatInteraction']['hasMany'](db[_0x4f0e('0x65')],{'as':_0x4f0e('0x163'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x19d')});db[_0x4f0e('0x63')]['belongsTo'](db[_0x4f0e('0x142')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x181')});db[_0x4f0e('0x63')][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x16a'),'foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x63')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x179'),'foreignKey':'UserId'});db[_0x4f0e('0x63')][_0x4f0e('0x129')](db['Tag'],{'through':_0x4f0e('0x19e'),'as':_0x4f0e('0x17b')});db[_0x4f0e('0x63')][_0x4f0e('0x129')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x4f0e('0x17c')});db[_0x4f0e('0x63')][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x17d'),'through':_0x4f0e('0x19f'),'foreignKey':'ChatInteractionId'});db[_0x4f0e('0x65')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'onDelete':_0x4f0e('0x116'),'as':_0x4f0e('0x118')});db[_0x4f0e('0x65')][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'onDelete':_0x4f0e('0x116'),'as':'Contact','foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x65')][_0x4f0e('0x127')](db[_0x4f0e('0x63')],{'onDelete':_0x4f0e('0x116'),'as':_0x4f0e('0x17f'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x4f0e('0x127')](db[_0x4f0e('0xee')],{'as':_0x4f0e('0xee'),'foreignKey':_0x4f0e('0x18a')});db[_0x4f0e('0x65')][_0x4f0e('0x127')](db[_0x4f0e('0x142')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x181')});db[_0x4f0e('0x1a0')]['hasMany'](db['Attachment'],{'as':_0x4f0e('0x17e'),'foreignKey':_0x4f0e('0x1a1'),'onDelete':_0x4f0e('0x116'),'hooks':!![]});db['ChatOfflineMessage'][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0x4f0e('0x1a0')][_0x4f0e('0x127')](db[_0x4f0e('0x142')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x181')});db[_0x4f0e('0x68')]['belongsToMany'](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':_0x4f0e('0x2c'),'hooks':!![]});db[_0x4f0e('0x68')][_0x4f0e('0x129')](db[_0x4f0e('0x12f')],{'through':_0x4f0e('0x1a2'),'as':_0x4f0e('0x15e')});db[_0x4f0e('0x6a')][_0x4f0e('0x11a')](db[_0x4f0e('0x1a3')],{'as':_0x4f0e('0x163'),'foreignKey':_0x4f0e('0x1a4'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x6a')][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x153'),'through':_0x4f0e('0x12b')});db['ChatProactiveAction'][_0x4f0e('0x127')](db[_0x4f0e('0x142')],{'as':_0x4f0e('0x1a5'),'foreignKey':_0x4f0e('0x181')});db[_0x4f0e('0x6e')][_0x4f0e('0x11a')](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x12c'),'foreignKey':_0x4f0e('0x1a6')});db['CmContact'][_0x4f0e('0x11a')](db[_0x4f0e('0x8d')],{'as':'Phones','foreignKey':_0x4f0e('0x1a7')});db[_0x4f0e('0x70')][_0x4f0e('0x11a')](db[_0x4f0e('0x71')],{'as':'Hoppers','foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x70')][_0x4f0e('0x11a')](db['CmHopperFinal'],{'as':_0x4f0e('0x11c'),'foreignKey':_0x4f0e('0x16b')});db['CmContact'][_0x4f0e('0x11a')](db[_0x4f0e('0x76')],{'as':_0x4f0e('0x155'),'foreignKey':'ContactId'});db[_0x4f0e('0x70')][_0x4f0e('0x11a')](db[_0x4f0e('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x70')][_0x4f0e('0x11a')](db[_0x4f0e('0xd5')],{'as':'JscriptySessions','foreignKey':_0x4f0e('0x16b')});db['CmContact'][_0x4f0e('0x11a')](db[_0x4f0e('0x134')],{'as':_0x4f0e('0x11e'),'foreignKey':_0x4f0e('0x16b'),'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x70')][_0x4f0e('0x11a')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x4f0e('0x16b'),'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x70')][_0x4f0e('0x11a')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x4f0e('0x16b'),'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x70')]['hasMany'](db['FaxInteraction'],{'as':_0x4f0e('0x121'),'foreignKey':'ContactId','onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x70')][_0x4f0e('0x11a')](db[_0x4f0e('0x3e')],{'as':_0x4f0e('0x122'),'foreignKey':_0x4f0e('0x16b'),'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x70')][_0x4f0e('0x127')](db[_0x4f0e('0x6e')],{'as':_0x4f0e('0x1a8'),'foreignKey':_0x4f0e('0x1a6')});db['CmContact'][_0x4f0e('0x127')](db['CmList'],{'as':_0x4f0e('0x173'),'foreignKey':_0x4f0e('0x174'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x70')]['belongsToMany'](db[_0x4f0e('0x118')],{'as':'Users','through':_0x4f0e('0x12d')});db[_0x4f0e('0x70')]['belongsToMany'](db[_0x4f0e('0x8a')],{'as':_0x4f0e('0x17b'),'through':'cm_contact_has_tags'});db[_0x4f0e('0x70')][_0x4f0e('0x129')](db[_0x4f0e('0x8a')],{'through':_0x4f0e('0x1a9'),'as':_0x4f0e('0x17c')});db[_0x4f0e('0x71')][_0x4f0e('0x11a')](db[_0x4f0e('0x1aa')],{'as':'AdditionalPhones','foreignKey':_0x4f0e('0x1ab')});db[_0x4f0e('0x71')][_0x4f0e('0x127')](db['CmContact'],{'as':'Contact','foreignKey':_0x4f0e('0x16b'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x71')][_0x4f0e('0x127')](db[_0x4f0e('0xfa')],{'as':'List','foreignKey':_0x4f0e('0x174'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x71')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':'Agent','foreignKey':_0x4f0e('0x117')});db['CmHopper'][_0x4f0e('0x127')](db[_0x4f0e('0x17')],{'as':_0x4f0e('0x19b'),'foreignKey':_0x4f0e('0x154'),'onDelete':_0x4f0e('0x116')});db['CmHopper'][_0x4f0e('0x127')](db['Campaign'],{'as':_0x4f0e('0xea'),'foreignKey':_0x4f0e('0x1ac'),'onDelete':'cascade'});db[_0x4f0e('0x71')]['belongsTo'](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x179'),'foreignKey':_0x4f0e('0x1ad')});db[_0x4f0e('0x72')][_0x4f0e('0x127')](db['CmContact'],{'as':_0x4f0e('0x16a'),'foreignKey':'ContactId','onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x72')][_0x4f0e('0x127')](db[_0x4f0e('0xfa')],{'as':'List','foreignKey':_0x4f0e('0x174'),'onDelete':_0x4f0e('0x116')});db['CmHopperBlack'][_0x4f0e('0x127')](db[_0x4f0e('0x17')],{'as':_0x4f0e('0x19b'),'foreignKey':_0x4f0e('0x154'),'onDelete':'cascade'});db[_0x4f0e('0x72')][_0x4f0e('0x127')](db[_0x4f0e('0xea')],{'as':_0x4f0e('0xea'),'foreignKey':_0x4f0e('0x1ac'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x7c')][_0x4f0e('0x11a')](db[_0x4f0e('0x80')],{'as':{'plural':_0x4f0e('0x1ae'),'singular':_0x4f0e('0x1af')},'foreignKey':_0x4f0e('0x1b0'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x4f0e('0x11a')](db[_0x4f0e('0x80')],{'as':{'plural':_0x4f0e('0x1b1'),'singular':_0x4f0e('0x1b2')},'foreignKey':_0x4f0e('0x1b3'),'onDelete':_0x4f0e('0x116'),'hooks':!![]});db[_0x4f0e('0x7c')]['hasMany'](db[_0x4f0e('0x7a')],{'as':_0x4f0e('0x1b4'),'foreignKey':_0x4f0e('0x1b5'),'onDelete':_0x4f0e('0x116'),'hooks':!![]});db[_0x4f0e('0x7f')][_0x4f0e('0x11a')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x4f0e('0x1b6'),'onDelete':'cascade'});db[_0x4f0e('0x82')][_0x4f0e('0x11a')](db[_0x4f0e('0x82')],{'as':'Intervals','foreignKey':_0x4f0e('0x159'),'onDelete':_0x4f0e('0x116'),'hooks':!![],'required':![]});db[_0x4f0e('0x82')][_0x4f0e('0x11a')](db[_0x4f0e('0x14')],{'as':_0x4f0e('0x1b7'),'foreignKey':_0x4f0e('0x159'),'onDelete':'restrict'});db[_0x4f0e('0x82')]['hasMany'](db[_0x4f0e('0x42')],{'as':_0x4f0e('0x1b8'),'foreignKey':_0x4f0e('0x159')});db['Interval'][_0x4f0e('0x11a')](db[_0x4f0e('0x62')],{'as':_0x4f0e('0x1b9'),'foreignKey':_0x4f0e('0x159')});db[_0x4f0e('0x82')]['hasMany'](db[_0x4f0e('0x49')],{'as':_0x4f0e('0x1ba'),'foreignKey':'IntervalId'});db[_0x4f0e('0x82')][_0x4f0e('0x11a')](db[_0x4f0e('0x191')],{'as':_0x4f0e('0x1bb'),'foreignKey':'IntervalId'});db[_0x4f0e('0x88')][_0x4f0e('0x127')](db[_0x4f0e('0x38')],{});db[_0x4f0e('0x88')][_0x4f0e('0x127')](db['AnalyticDefaultReport'],{'foreignKey':_0x4f0e('0x1bc')});db[_0x4f0e('0x88')][_0x4f0e('0x127')](db[_0x4f0e('0x98')],{'foreignKey':_0x4f0e('0x1bd')});db[_0x4f0e('0x150')][_0x4f0e('0x129')](db[_0x4f0e('0x14f')],{'as':_0x4f0e('0x1be'),'through':'moh_has_sounds','onDelete':_0x4f0e('0x16e')});db['Tag'][_0x4f0e('0x129')](db['CmContact'],{'through':_0x4f0e('0x1a9')});db[_0x4f0e('0x8a')][_0x4f0e('0x129')](db[_0x4f0e('0x63')],{'through':_0x4f0e('0x19e')});db[_0x4f0e('0x8a')][_0x4f0e('0x129')](db['MailInteraction'],{'through':_0x4f0e('0x17a')});db[_0x4f0e('0x8a')][_0x4f0e('0x129')](db['SmsInteraction'],{'through':_0x4f0e('0x193')});db[_0x4f0e('0x8a')][_0x4f0e('0x129')](db['FaxInteraction'],{'through':_0x4f0e('0x187')});db['Tag'][_0x4f0e('0x129')](db[_0x4f0e('0x134')],{'through':_0x4f0e('0x199')});db['Tag']['belongsToMany'](db[_0x4f0e('0x123')],{'through':_0x4f0e('0x1bf')});db[_0x4f0e('0x8d')][_0x4f0e('0x127')](db['ContactItemType'],{'as':_0x4f0e('0x1c0'),'foreignKey':_0x4f0e('0x1c1')});db['CmHopperAdditionalPhone'][_0x4f0e('0x127')](db['CmHopper'],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0x4f0e('0x8d')][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x16a'),'foreignKey':_0x4f0e('0x1a7')});db[_0x4f0e('0x92')][_0x4f0e('0x11a')](db[_0x4f0e('0x80')],{'as':{'plural':_0x4f0e('0x1c2'),'singular':_0x4f0e('0x1c3')},'foreignKey':_0x4f0e('0x1c4'),'onDelete':_0x4f0e('0x116'),'hooks':!![]});db['Trigger'][_0x4f0e('0x11a')](db[_0x4f0e('0x80')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x4f0e('0x1c5'),'onDelete':_0x4f0e('0x116'),'hooks':!![]});db[_0x4f0e('0x92')]['hasMany'](db[_0x4f0e('0x7a')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x4f0e('0x116'),'hooks':!![]});db[_0x4f0e('0x98')][_0x4f0e('0x11a')](db['AnalyticFieldReport'],{'as':_0x4f0e('0x1c6'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1bd'),'hooks':!![]});db[_0x4f0e('0x9a')][_0x4f0e('0x11a')](db[_0x4f0e('0x9f')],{'as':_0x4f0e('0x1c6'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1bc')});db[_0x4f0e('0x9d')][_0x4f0e('0x11a')](db[_0x4f0e('0x9f')],{'as':_0x4f0e('0x1c6'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1c7')});db[_0x4f0e('0x9f')]['belongsTo'](db[_0x4f0e('0x9d')],{'foreignKey':_0x4f0e('0x1c7')});db[_0x4f0e('0xa2')][_0x4f0e('0x11a')](db[_0x4f0e('0xa4')],{'as':_0x4f0e('0x1c8'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xa4')][_0x4f0e('0x11a')](db[_0x4f0e('0xa6')],{'as':_0x4f0e('0x1ca'),'onDelete':_0x4f0e('0x116'),'foreignKey':'SubjectId'});db[_0x4f0e('0xa4')][_0x4f0e('0x11a')](db[_0x4f0e('0xa6')],{'as':_0x4f0e('0x1cb'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1cc')});db['SalesforceConfiguration'][_0x4f0e('0x11a')](db[_0x4f0e('0xa6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0xa4')][_0x4f0e('0x127')](db[_0x4f0e('0xa2')],{'as':'Account','foreignKey':_0x4f0e('0x1c9')});db['SalesforceField'][_0x4f0e('0x11a')](db[_0x4f0e('0xa6')],{'as':_0x4f0e('0x1ce'),'foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0xa6')]['hasMany'](db['SalesforceField'],{'as':_0x4f0e('0x1d0'),'foreignKey':_0x4f0e('0x1cc')});db['SalesforceField']['hasMany'](db[_0x4f0e('0xa6')],{'as':'Field','foreignKey':_0x4f0e('0x1cd')});db['SalesforceField']['belongsTo'](db[_0x4f0e('0x94')],{'as':'Variable','foreignKey':'VariableId'});db[_0x4f0e('0xa8')][_0x4f0e('0x11a')](db[_0x4f0e('0x1d1')],{'as':_0x4f0e('0x1c8'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0x1d1')][_0x4f0e('0x11a')](db[_0x4f0e('0xab')],{'as':_0x4f0e('0x1ca'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0x1d1')]['hasMany'](db['SugarcrmField'],{'as':_0x4f0e('0x1cb'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0x1d1')][_0x4f0e('0x11a')](db['SugarcrmField'],{'as':'Fields','onDelete':_0x4f0e('0x116'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x4f0e('0x127')](db['SugarcrmAccount'],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xab')][_0x4f0e('0x11a')](db[_0x4f0e('0xab')],{'as':_0x4f0e('0x1ce'),'foreignKey':_0x4f0e('0x1cf')});db['SugarcrmField'][_0x4f0e('0x11a')](db[_0x4f0e('0xab')],{'as':_0x4f0e('0x1d0'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0xab')][_0x4f0e('0x11a')](db[_0x4f0e('0xab')],{'as':_0x4f0e('0x1d2'),'foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0xab')][_0x4f0e('0x127')](db[_0x4f0e('0x94')],{'as':_0x4f0e('0x94'),'foreignKey':'VariableId'});db[_0x4f0e('0x1d3')][_0x4f0e('0x11a')](db[_0x4f0e('0xae')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xae')][_0x4f0e('0x11a')](db['DeskField'],{'as':_0x4f0e('0x1ca'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0xae')][_0x4f0e('0x11a')](db[_0x4f0e('0xb0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x4f0e('0x11a')](db[_0x4f0e('0xb0')],{'as':_0x4f0e('0x1c6'),'onDelete':'cascade','foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0xae')][_0x4f0e('0x127')](db[_0x4f0e('0x1d3')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xae')]['belongsToMany'](db['Tag'],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x4f0e('0x11a')](db[_0x4f0e('0xb0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4f0e('0xb0')][_0x4f0e('0x11a')](db[_0x4f0e('0xb0')],{'as':_0x4f0e('0x1d0'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0xb0')][_0x4f0e('0x11a')](db['DeskField'],{'as':_0x4f0e('0x1d2'),'foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0xb0')][_0x4f0e('0x127')](db[_0x4f0e('0x94')],{'as':_0x4f0e('0x94'),'foreignKey':_0x4f0e('0x1d4')});db['ZohoAccount'][_0x4f0e('0x11a')](db[_0x4f0e('0xb3')],{'as':_0x4f0e('0x1c8'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xb3')]['hasMany'](db[_0x4f0e('0xb5')],{'as':_0x4f0e('0x1ca'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0xb3')][_0x4f0e('0x11a')](db[_0x4f0e('0xb5')],{'as':_0x4f0e('0x1cb'),'onDelete':'cascade','foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0xb3')]['hasMany'](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x4f0e('0xb3')][_0x4f0e('0x127')](db[_0x4f0e('0xb2')],{'as':_0x4f0e('0x180'),'foreignKey':'AccountId'});db[_0x4f0e('0xb5')][_0x4f0e('0x11a')](db[_0x4f0e('0xb5')],{'as':_0x4f0e('0x1ce'),'foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0xb5')][_0x4f0e('0x11a')](db[_0x4f0e('0xb5')],{'as':_0x4f0e('0x1d0'),'foreignKey':_0x4f0e('0x1cc')});db['ZohoField'][_0x4f0e('0x11a')](db[_0x4f0e('0xb5')],{'as':_0x4f0e('0x1d2'),'foreignKey':_0x4f0e('0x1cd')});db['ZohoField'][_0x4f0e('0x127')](db[_0x4f0e('0x94')],{'as':_0x4f0e('0x94'),'foreignKey':_0x4f0e('0x1d4')});db['ZendeskAccount'][_0x4f0e('0x11a')](db[_0x4f0e('0xb8')],{'as':_0x4f0e('0x1c8'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xb8')][_0x4f0e('0x11a')](db[_0x4f0e('0xba')],{'as':_0x4f0e('0x1ca'),'foreignKey':_0x4f0e('0x1cf')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x4f0e('0x1cb'),'foreignKey':_0x4f0e('0x1cc')});db['ZendeskConfiguration'][_0x4f0e('0x11a')](db[_0x4f0e('0xba')],{'as':_0x4f0e('0x1c6'),'foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0xb8')][_0x4f0e('0x127')](db[_0x4f0e('0xb6')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xb8')][_0x4f0e('0x129')](db['Tag'],{'through':_0x4f0e('0x1d5')});db['ZendeskField'][_0x4f0e('0x11a')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0xba')][_0x4f0e('0x11a')](db[_0x4f0e('0xba')],{'as':'Description','foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0xba')][_0x4f0e('0x11a')](db[_0x4f0e('0xba')],{'as':'Field','foreignKey':'FieldId'});db[_0x4f0e('0xba')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x4f0e('0xbc')]['hasMany'](db[_0x4f0e('0xbd')],{'as':_0x4f0e('0x1c8'),'onDelete':_0x4f0e('0x116'),'foreignKey':'AccountId'});db[_0x4f0e('0xbd')]['hasMany'](db[_0x4f0e('0x1d6')],{'as':_0x4f0e('0x1ca'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0xbd')]['hasMany'](db['FreshdeskField'],{'as':_0x4f0e('0x1cb'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0xbd')][_0x4f0e('0x11a')](db['FreshdeskField'],{'as':_0x4f0e('0x1c6'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0xbd')][_0x4f0e('0x127')](db[_0x4f0e('0xbc')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xbd')]['belongsToMany'](db['Tag'],{'through':_0x4f0e('0x1d7')});db[_0x4f0e('0x1d6')][_0x4f0e('0x11a')](db['FreshdeskField'],{'as':_0x4f0e('0x1ce'),'foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0x1d6')]['hasMany'](db[_0x4f0e('0x1d6')],{'as':_0x4f0e('0x1d0'),'foreignKey':_0x4f0e('0x1cc')});db['FreshdeskField'][_0x4f0e('0x11a')](db[_0x4f0e('0x1d6')],{'as':_0x4f0e('0x1d2'),'foreignKey':'FieldId'});db[_0x4f0e('0x1d6')][_0x4f0e('0x127')](db[_0x4f0e('0x94')],{'as':_0x4f0e('0x94'),'foreignKey':_0x4f0e('0x1d4')});db[_0x4f0e('0xbf')][_0x4f0e('0x11a')](db[_0x4f0e('0x1d8')],{'as':_0x4f0e('0x1c8'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1c9')});db['VtigerConfiguration'][_0x4f0e('0x11a')](db[_0x4f0e('0x1d9')],{'as':_0x4f0e('0x1ca'),'foreignKey':_0x4f0e('0x1cf')});db['VtigerConfiguration'][_0x4f0e('0x11a')](db[_0x4f0e('0x1d9')],{'as':_0x4f0e('0x1cb'),'foreignKey':'DescriptionId'});db[_0x4f0e('0x1d8')][_0x4f0e('0x11a')](db[_0x4f0e('0x1d9')],{'as':_0x4f0e('0x1c6'),'foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0x1d8')]['belongsTo'](db[_0x4f0e('0xbf')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0x1d9')]['hasMany'](db[_0x4f0e('0x1d9')],{'as':_0x4f0e('0x1ce'),'foreignKey':'SubjectId'});db[_0x4f0e('0x1d9')]['hasMany'](db[_0x4f0e('0x1d9')],{'as':_0x4f0e('0x1d0'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0x1d9')][_0x4f0e('0x11a')](db[_0x4f0e('0x1d9')],{'as':_0x4f0e('0x1d2'),'foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0x1d9')][_0x4f0e('0x127')](db['Variable'],{'as':_0x4f0e('0x94'),'foreignKey':_0x4f0e('0x1d4')});db[_0x4f0e('0xc3')][_0x4f0e('0x11a')](db[_0x4f0e('0x1da')],{'as':_0x4f0e('0x1c8'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0x1da')][_0x4f0e('0x11a')](db[_0x4f0e('0x1db')],{'as':_0x4f0e('0x1ca'),'foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0x1da')][_0x4f0e('0x11a')](db[_0x4f0e('0x1db')],{'as':_0x4f0e('0x1cb'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0x1da')][_0x4f0e('0x11a')](db[_0x4f0e('0x1db')],{'as':_0x4f0e('0x1c6'),'foreignKey':'FieldId'});db[_0x4f0e('0x1da')][_0x4f0e('0x127')](db[_0x4f0e('0xc3')],{'as':_0x4f0e('0x180'),'foreignKey':'AccountId'});db[_0x4f0e('0x1db')][_0x4f0e('0x11a')](db[_0x4f0e('0x1db')],{'as':'Subject','foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0x1db')]['hasMany'](db[_0x4f0e('0x1db')],{'as':_0x4f0e('0x1d0'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0x1db')]['hasMany'](db[_0x4f0e('0x1db')],{'as':'Field','foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0x1db')]['belongsTo'](db[_0x4f0e('0x94')],{'as':_0x4f0e('0x94'),'foreignKey':'VariableId'});db[_0x4f0e('0xc6')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x4f0e('0x1c8'),'onDelete':_0x4f0e('0x116'),'foreignKey':'AccountId'});db[_0x4f0e('0xc6')][_0x4f0e('0x127')](db[_0x4f0e('0x10e')],{'as':_0x4f0e('0x10e'),'foreignKey':_0x4f0e('0x16d')});db[_0x4f0e('0x1dc')][_0x4f0e('0x11a')](db['Dynamics365Field'],{'as':_0x4f0e('0x1ca'),'onDelete':_0x4f0e('0x116'),'foreignKey':'SubjectId'});db[_0x4f0e('0x1dc')]['hasMany'](db['Dynamics365Field'],{'as':_0x4f0e('0x1cb'),'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0x1dc')][_0x4f0e('0x11a')](db[_0x4f0e('0xc9')],{'as':'Fields','onDelete':_0x4f0e('0x116'),'foreignKey':'FieldId'});db[_0x4f0e('0x1dc')][_0x4f0e('0x127')](db[_0x4f0e('0xc6')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xc9')][_0x4f0e('0x11a')](db[_0x4f0e('0xc9')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4f0e('0xc9')][_0x4f0e('0x11a')](db[_0x4f0e('0xc9')],{'as':_0x4f0e('0x1d0'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0xc9')]['hasMany'](db[_0x4f0e('0xc9')],{'as':_0x4f0e('0x1d2'),'foreignKey':_0x4f0e('0x1cd')});db[_0x4f0e('0xc9')][_0x4f0e('0x127')](db[_0x4f0e('0x94')],{'as':_0x4f0e('0x94'),'foreignKey':_0x4f0e('0x1d4')});db[_0x4f0e('0xcb')][_0x4f0e('0x11a')](db['FreshsalesConfiguration'],{'as':_0x4f0e('0x1c8'),'onDelete':_0x4f0e('0x116'),'foreignKey':'AccountId'});db[_0x4f0e('0xcd')]['hasMany'](db[_0x4f0e('0xce')],{'as':_0x4f0e('0x1ca'),'foreignKey':_0x4f0e('0x1cf')});db['FreshsalesConfiguration']['hasMany'](db[_0x4f0e('0xce')],{'as':_0x4f0e('0x1cb'),'foreignKey':_0x4f0e('0x1cc')});db[_0x4f0e('0xcd')]['hasMany'](db[_0x4f0e('0xce')],{'as':_0x4f0e('0x1c6'),'foreignKey':'FieldId'});db[_0x4f0e('0xcd')][_0x4f0e('0x127')](db[_0x4f0e('0xcb')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x1c9')});db[_0x4f0e('0xce')][_0x4f0e('0x11a')](db[_0x4f0e('0xce')],{'as':_0x4f0e('0x1ce'),'foreignKey':_0x4f0e('0x1cf')});db[_0x4f0e('0xce')][_0x4f0e('0x11a')](db[_0x4f0e('0xce')],{'as':_0x4f0e('0x1d0'),'foreignKey':'DescriptionId'});db[_0x4f0e('0xce')][_0x4f0e('0x11a')](db[_0x4f0e('0xce')],{'as':_0x4f0e('0x1d2'),'foreignKey':'FieldId'});db['FreshsalesField'][_0x4f0e('0x127')](db[_0x4f0e('0x94')],{'as':_0x4f0e('0x94'),'foreignKey':_0x4f0e('0x1d4')});db[_0x4f0e('0x1dd')][_0x4f0e('0x127')](db['ChatWebsite'],{});db[_0x4f0e('0x1dd')]['belongsTo'](db[_0x4f0e('0xfa')],{'as':_0x4f0e('0x173'),'foreignKey':'ListId'});db[_0x4f0e('0x1dd')][_0x4f0e('0x127')](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x16a'),'foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x1dd')]['belongsTo'](db[_0x4f0e('0x63')],{});db[_0x4f0e('0x1dd')][_0x4f0e('0x127')](db[_0x4f0e('0x65')],{});db[_0x4f0e('0x1dd')]['belongsTo'](db[_0x4f0e('0x118')],{});db[_0x4f0e('0x1dd')][_0x4f0e('0x127')](db[_0x4f0e('0x68')],{});db[_0x4f0e('0x1a3')][_0x4f0e('0x127')](db['User'],{'onDelete':_0x4f0e('0x116'),'foreignKey':_0x4f0e('0x1de')});db[_0x4f0e('0x1a3')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x4f0e('0xd5')][_0x4f0e('0x11a')](db[_0x4f0e('0xd4')],{'foreignKey':_0x4f0e('0x1df'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0xd5')][_0x4f0e('0x11a')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x4f0e('0x116')});db['SmsQueueReport']['belongsTo'](db[_0x4f0e('0x51')],{});db[_0x4f0e('0xd7')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db['SmsQueueReport'][_0x4f0e('0x127')](db['CmContact'],{'as':'Contact','foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0xd7')]['belongsTo'](db[_0x4f0e('0x18f')],{});db[_0x4f0e('0xd7')][_0x4f0e('0x127')](db[_0x4f0e('0x55')],{});db[_0x4f0e('0xd7')][_0x4f0e('0x127')](db['User'],{});db[_0x4f0e('0xd7')][_0x4f0e('0x127')](db[_0x4f0e('0x13c')],{});db[_0x4f0e('0xdc')][_0x4f0e('0x11a')](db[_0x4f0e('0xd5')],{'foreignKey':_0x4f0e('0x1e0')});db[_0x4f0e('0xdc')]['hasMany'](db[_0x4f0e('0xd4')],{'foreignKey':_0x4f0e('0x1e0')});db[_0x4f0e('0xdc')][_0x4f0e('0x11a')](db[_0x4f0e('0xd2')],{'foreignKey':_0x4f0e('0x1e0')});db['Team'][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':'user_has_teams'});db[_0x4f0e('0x12f')][_0x4f0e('0x129')](db[_0x4f0e('0x17')],{'through':'TeamVoiceQueue','as':_0x4f0e('0x137')});db[_0x4f0e('0x12f')][_0x4f0e('0x129')](db[_0x4f0e('0x3a')],{'through':'team_has_mail_queues','as':_0x4f0e('0x139')});db[_0x4f0e('0x12f')]['belongsToMany'](db['ChatQueue'],{'through':_0x4f0e('0x1a2'),'as':_0x4f0e('0x13a')});db[_0x4f0e('0x12f')][_0x4f0e('0x129')](db['FaxQueue'],{'through':_0x4f0e('0x18c'),'as':_0x4f0e('0x13b')});db[_0x4f0e('0x12f')][_0x4f0e('0x129')](db[_0x4f0e('0x13c')],{'through':_0x4f0e('0x195'),'as':'SmsQueues'});db[_0x4f0e('0x12f')][_0x4f0e('0x129')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x4f0e('0x13e')});db['Team']['belongsToMany'](db[_0x4f0e('0x10d')],{'through':_0x4f0e('0x1e1'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':_0x4f0e('0x1e2'),'as':_0x4f0e('0x138')});db['Campaign'][_0x4f0e('0x11a')](db[_0x4f0e('0x71')],{'as':_0x4f0e('0x126'),'foreignKey':'CampaignId'});db[_0x4f0e('0xea')][_0x4f0e('0x11a')](db[_0x4f0e('0x74')],{'as':_0x4f0e('0x11c'),'foreignKey':_0x4f0e('0x1ac')});db[_0x4f0e('0xea')][_0x4f0e('0x11a')](db[_0x4f0e('0x76')],{'as':_0x4f0e('0x155'),'foreignKey':_0x4f0e('0x1ac')});db[_0x4f0e('0xea')][_0x4f0e('0x11a')](db[_0x4f0e('0x72')],{'as':'HopperBlacks','foreignKey':_0x4f0e('0x1ac')});db['Campaign'][_0x4f0e('0x127')](db[_0x4f0e('0x26')],{'as':_0x4f0e('0x26'),'foreignKey':_0x4f0e('0x157')});db[_0x4f0e('0xea')]['belongsTo'](db[_0x4f0e('0x26')],{'as':_0x4f0e('0x1e3'),'foreignKey':_0x4f0e('0x158')});db[_0x4f0e('0xea')][_0x4f0e('0x127')](db['Interval'],{'as':_0x4f0e('0x82'),'foreignKey':'IntervalId'});db[_0x4f0e('0xea')][_0x4f0e('0x127')](db[_0x4f0e('0xe1')],{'as':_0x4f0e('0xe1'),'foreignKey':_0x4f0e('0x1e4')});db[_0x4f0e('0xea')][_0x4f0e('0x129')](db[_0x4f0e('0xfa')],{'as':_0x4f0e('0x12e'),'through':_0x4f0e('0x1e5')});db[_0x4f0e('0xea')]['belongsToMany'](db[_0x4f0e('0xfa')],{'as':'BlackLists','through':_0x4f0e('0x1e6')});db[_0x4f0e('0xee')][_0x4f0e('0x127')](db[_0x4f0e('0x1a0')],{'as':_0x4f0e('0x1a0'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x4f0e('0x127')](db[_0x4f0e('0x40')],{});db[_0x4f0e('0xf2')]['belongsTo'](db[_0x4f0e('0x3e')],{});db[_0x4f0e('0xf2')][_0x4f0e('0x127')](db[_0x4f0e('0x38')],{'foreignKey':_0x4f0e('0x1e7'),'as':_0x4f0e('0x1e8')});db[_0x4f0e('0xf2')]['belongsTo'](db['User'],{'foreignKey':_0x4f0e('0x1e9'),'as':_0x4f0e('0x1ea')});db[_0x4f0e('0xf2')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x4f0e('0xf2')]['belongsTo'](db[_0x4f0e('0x3a')],{'foreignKey':_0x4f0e('0x1eb'),'as':'ToQueue'});db[_0x4f0e('0xf2')][_0x4f0e('0x127')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x4f0e('0x1ec')});db[_0x4f0e('0xf4')][_0x4f0e('0x127')](db['ChatMessage'],{});db[_0x4f0e('0xf4')][_0x4f0e('0x127')](db[_0x4f0e('0x63')],{});db[_0x4f0e('0xf4')][_0x4f0e('0x127')](db[_0x4f0e('0x142')],{'foreignKey':_0x4f0e('0x1ed'),'as':'FromAccount'});db[_0x4f0e('0xf4')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'foreignKey':_0x4f0e('0x1e9'),'as':'FromAgent'});db[_0x4f0e('0xf4')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'foreignKey':_0x4f0e('0x1ee'),'as':_0x4f0e('0x1ef')});db[_0x4f0e('0xf4')][_0x4f0e('0x127')](db[_0x4f0e('0x68')],{'foreignKey':_0x4f0e('0x1f0'),'as':'ToQueue'});db[_0x4f0e('0xf4')]['belongsTo'](db[_0x4f0e('0x142')],{'foreignKey':_0x4f0e('0x1f1'),'as':_0x4f0e('0x1ec')});db[_0x4f0e('0xf6')][_0x4f0e('0x127')](db[_0x4f0e('0x189')],{});db[_0x4f0e('0xf6')][_0x4f0e('0x127')](db['FaxInteraction'],{});db[_0x4f0e('0xf6')]['belongsTo'](db[_0x4f0e('0x145')],{'foreignKey':_0x4f0e('0x1f2'),'as':_0x4f0e('0x1e8')});db[_0x4f0e('0xf6')][_0x4f0e('0x127')](db['User'],{'foreignKey':_0x4f0e('0x1e9'),'as':_0x4f0e('0x1ea')});db[_0x4f0e('0xf6')]['belongsTo'](db['User'],{'foreignKey':_0x4f0e('0x1ee'),'as':_0x4f0e('0x1ef')});db['FaxTransferReport'][_0x4f0e('0x127')](db[_0x4f0e('0x4e')],{'foreignKey':_0x4f0e('0x1f3'),'as':_0x4f0e('0x1f4')});db['FaxTransferReport']['belongsTo'](db[_0x4f0e('0x145')],{'foreignKey':'ToFaxAccountId','as':_0x4f0e('0x1ec')});db[_0x4f0e('0x1f5')][_0x4f0e('0x127')](db[_0x4f0e('0x5d')],{});db[_0x4f0e('0x1f5')][_0x4f0e('0x127')](db[_0x4f0e('0x134')],{});db[_0x4f0e('0x1f5')]['belongsTo'](db[_0x4f0e('0x58')],{'foreignKey':_0x4f0e('0x1f6'),'as':_0x4f0e('0x1e8')});db[_0x4f0e('0x1f5')]['belongsTo'](db[_0x4f0e('0x118')],{'foreignKey':_0x4f0e('0x1e9'),'as':_0x4f0e('0x1ea')});db['OpenchannelTransferReport']['belongsTo'](db[_0x4f0e('0x118')],{'foreignKey':_0x4f0e('0x1ee'),'as':_0x4f0e('0x1ef')});db[_0x4f0e('0x1f5')][_0x4f0e('0x127')](db[_0x4f0e('0x5f')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x4f0e('0x1f5')]['belongsTo'](db[_0x4f0e('0x58')],{'foreignKey':_0x4f0e('0x1f7'),'as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db['SmsMessage'],{});db[_0x4f0e('0x1f8')][_0x4f0e('0x127')](db[_0x4f0e('0x18f')],{});db[_0x4f0e('0x1f8')]['belongsTo'](db[_0x4f0e('0x51')],{'foreignKey':_0x4f0e('0x1f9'),'as':_0x4f0e('0x1e8')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x4f0e('0x1ea')});db[_0x4f0e('0x1f8')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'foreignKey':'ToUserId','as':_0x4f0e('0x1ef')});db[_0x4f0e('0x1f8')][_0x4f0e('0x127')](db['SmsQueue'],{'foreignKey':_0x4f0e('0x1fa'),'as':_0x4f0e('0x1f4')});db['SmsTransferReport'][_0x4f0e('0x127')](db[_0x4f0e('0x51')],{'foreignKey':_0x4f0e('0x1fb'),'as':'ToAccount'});db[_0x4f0e('0xfa')][_0x4f0e('0x11a')](db['Disposition'],{'as':_0x4f0e('0x170'),'foreignKey':'ListId','onDelete':_0x4f0e('0x116')});db['CmList'][_0x4f0e('0x11a')](db['CmCustomField'],{'as':_0x4f0e('0x1fc'),'foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0xfa')][_0x4f0e('0x11a')](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x12c'),'onDelete':'cascade','foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0xfa')]['hasMany'](db[_0x4f0e('0x74')],{'as':_0x4f0e('0x11c'),'foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0xfa')][_0x4f0e('0x11a')](db[_0x4f0e('0x76')],{'as':'HopperHistory','foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0xfa')][_0x4f0e('0x11a')](db[_0x4f0e('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0xfa')][_0x4f0e('0x129')](db['VoiceQueue'],{'as':_0x4f0e('0x1fd'),'through':'voice_queues_has_cm_lists'});db[_0x4f0e('0xfa')]['belongsToMany'](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':'cm_user_has_lists'});db[_0x4f0e('0xfb')]['hasMany'](db[_0x4f0e('0x14')],{'as':_0x4f0e('0x1b7'),'onDelete':'cascade'});db[_0x4f0e('0xfb')][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':_0x4f0e('0x110')});db[_0x4f0e('0xfb')]['belongsToMany'](db[_0x4f0e('0x12f')],{'through':'TeamVoicePrefix','as':_0x4f0e('0x15e')});db[_0x4f0e('0xfd')][_0x4f0e('0x11a')](db['User'],{'as':_0x4f0e('0x17d'),'foreignKey':_0x4f0e('0x128')});db[_0x4f0e('0xfd')][_0x4f0e('0x11a')](db[_0x4f0e('0xff')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x4f0e('0x116')});db[_0x4f0e('0xff')][_0x4f0e('0x11a')](db['UserProfileResource'],{'as':_0x4f0e('0x1fe'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x4f0e('0x103')][_0x4f0e('0x11a')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x4f0e('0x1ff'),'onDelete':'cascade'});db['WhatsappAccount'][_0x4f0e('0x11a')](db[_0x4f0e('0x7e')],{'as':_0x4f0e('0x171'),'foreignKey':_0x4f0e('0x1ff')});db['WhatsappAccount'][_0x4f0e('0x11a')](db[_0x4f0e('0x107')],{'as':_0x4f0e('0x163'),'foreignKey':'WhatsappAccountId'});db[_0x4f0e('0x103')][_0x4f0e('0x11a')](db[_0x4f0e('0x123')],{'as':'Interactions'});db[_0x4f0e('0x103')]['hasMany'](db[_0x4f0e('0x105')],{'as':_0x4f0e('0x14e'),'foreignKey':_0x4f0e('0x1ff'),'onDelete':_0x4f0e('0x116')});db[_0x4f0e('0x103')][_0x4f0e('0x127')](db[_0x4f0e('0xfa')],{'as':_0x4f0e('0x173'),'foreignKey':_0x4f0e('0x174')});db[_0x4f0e('0x103')][_0x4f0e('0x127')](db['Pause'],{'as':_0x4f0e('0x176'),'foreignKey':_0x4f0e('0x15b')});db['WhatsappAccount'][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':_0x4f0e('0x200')});db['WhatsappApplication'][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'onDelete':_0x4f0e('0x16e')});db['WhatsappApplication'][_0x4f0e('0x127')](db[_0x4f0e('0x10d')],{'onDelete':_0x4f0e('0x16e')});db['WhatsappApplication'][_0x4f0e('0x127')](db[_0x4f0e('0x103')],{'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x105')][_0x4f0e('0x127')](db[_0x4f0e('0x82')],{'onDelete':_0x4f0e('0x16e'),'foreignKey':_0x4f0e('0x159')});db[_0x4f0e('0x105')][_0x4f0e('0x127')](db[_0x4f0e('0x8a')],{'onDelete':_0x4f0e('0x16e'),'foreignKey':_0x4f0e('0x182')});db['WhatsappInteraction']['hasMany'](db['WhatsappMessage'],{'as':_0x4f0e('0x163'),'onDelete':_0x4f0e('0x116'),'foreignKey':'WhatsappInteractionId'});db[_0x4f0e('0x123')][_0x4f0e('0x127')](db['WhatsappAccount'],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x1ff')});db['WhatsappInteraction'][_0x4f0e('0x127')](db['CmContact'],{'as':'Contact','foreignKey':_0x4f0e('0x16b')});db['WhatsappInteraction'][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x179'),'foreignKey':'UserId'});db[_0x4f0e('0x123')]['belongsToMany'](db['Tag'],{'through':_0x4f0e('0x1bf'),'as':_0x4f0e('0x17b')});db[_0x4f0e('0x123')][_0x4f0e('0x129')](db['Tag'],{'through':_0x4f0e('0x1bf'),'as':_0x4f0e('0x17c')});db['WhatsappInteraction'][_0x4f0e('0x129')](db[_0x4f0e('0x118')],{'as':'Users','through':_0x4f0e('0x136'),'foreignKey':_0x4f0e('0x201')});db[_0x4f0e('0x107')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x118')});db[_0x4f0e('0x107')]['belongsTo'](db[_0x4f0e('0x70')],{'onDelete':_0x4f0e('0x116'),'as':_0x4f0e('0x16a')});db[_0x4f0e('0x107')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x4f0e('0x116'),'as':_0x4f0e('0x17f'),'foreignKey':_0x4f0e('0x201')});db[_0x4f0e('0x107')]['belongsTo'](db[_0x4f0e('0x103')],{'as':_0x4f0e('0x180'),'foreignKey':_0x4f0e('0x1ff')});db[_0x4f0e('0x109')][_0x4f0e('0x127')](db['WhatsappAccount'],{});db[_0x4f0e('0x109')][_0x4f0e('0x127')](db[_0x4f0e('0xfa')],{'as':'List','foreignKey':_0x4f0e('0x174')});db['WhatsappQueueReport']['belongsTo'](db[_0x4f0e('0x70')],{'as':_0x4f0e('0x16a'),'foreignKey':_0x4f0e('0x16b')});db[_0x4f0e('0x109')][_0x4f0e('0x127')](db[_0x4f0e('0x123')],{});db[_0x4f0e('0x109')]['belongsTo'](db['WhatsappQueue'],{});db[_0x4f0e('0x109')][_0x4f0e('0x127')](db['WhatsappMessage'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x4f0e('0x118')],{});db[_0x4f0e('0x10b')][_0x4f0e('0x127')](db['WhatsappMessage'],{});db[_0x4f0e('0x10b')][_0x4f0e('0x127')](db['WhatsappInteraction'],{});db[_0x4f0e('0x10b')][_0x4f0e('0x127')](db['WhatsappAccount'],{'foreignKey':_0x4f0e('0x202'),'as':_0x4f0e('0x1e8')});db[_0x4f0e('0x10b')][_0x4f0e('0x127')](db[_0x4f0e('0x103')],{'foreignKey':_0x4f0e('0x203'),'as':_0x4f0e('0x1ec')});db['WhatsappTransferReport'][_0x4f0e('0x127')](db[_0x4f0e('0x10d')],{'foreignKey':_0x4f0e('0x204'),'as':'ToQueue'});db[_0x4f0e('0x10b')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'foreignKey':_0x4f0e('0x1e9'),'as':_0x4f0e('0x1ea')});db[_0x4f0e('0x10b')][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'foreignKey':_0x4f0e('0x1ee'),'as':_0x4f0e('0x1ef')});db['WhatsappQueue']['belongsToMany'](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x15d'),'through':_0x4f0e('0x205'),'foreignKey':_0x4f0e('0x206')});db[_0x4f0e('0x10d')][_0x4f0e('0x129')](db[_0x4f0e('0x12f')],{'through':_0x4f0e('0x1e1'),'as':_0x4f0e('0x15e')});db['UserSetting'][_0x4f0e('0x127')](db[_0x4f0e('0x118')],{'as':_0x4f0e('0x207'),'foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x4f0e('0x10e')][_0x4f0e('0x114')](db[_0x4f0e('0xc6')],{'as':'Dynamics365Account','onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x10e')][_0x4f0e('0x114')](db[_0x4f0e('0x34')],{'as':_0x4f0e('0x208'),'onDelete':_0x4f0e('0x16e')});db[_0x4f0e('0x10e')][_0x4f0e('0x114')](db[_0x4f0e('0x36')],{'as':_0x4f0e('0x16f'),'onDelete':_0x4f0e('0x16e')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e14b350..e83b634 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/webbar','/apidoc','static','join','root','/www','/demo','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x4975,0x86));var _0x5497=function(_0x211f1a,_0x140249){_0x211f1a=_0x211f1a-0x0;var _0x74234f=_0x4975[_0x211f1a];return _0x74234f;};'use strict';var path=require(_0x5497('0x0'));var express=require('express');var errors=require(_0x5497('0x1'));var config=require(_0x5497('0x2'));var setupLoggers=require(_0x5497('0x3'))[_0x5497('0x4')];var clientSideLogs=require(_0x5497('0x5'));exports[_0x5497('0x6')]=function(_0x14cecb){return setupLoggers(_0x14cecb)[_0x5497('0x7')](function(){_0x14cecb[_0x5497('0x8')](_0x5497('0x9'),require('./api/user'));_0x14cecb[_0x5497('0x8')]('/api/voice/chanspy',require(_0x5497('0xa')));_0x14cecb[_0x5497('0x8')](_0x5497('0xb'),require('./api/voiceContext'));_0x14cecb[_0x5497('0x8')]('/api/voice/extensions',require(_0x5497('0xc')));_0x14cecb[_0x5497('0x8')](_0x5497('0xd'),require(_0x5497('0xe')));_0x14cecb[_0x5497('0x8')](_0x5497('0xf'),require(_0x5497('0x10')));_0x14cecb[_0x5497('0x8')]('/api/voice/recordings',require('./api/voiceRecording'));_0x14cecb['use'](_0x5497('0x11'),require(_0x5497('0x12')));_0x14cecb[_0x5497('0x8')](_0x5497('0x13'),require(_0x5497('0x14')));_0x14cecb[_0x5497('0x8')](_0x5497('0x15'),require(_0x5497('0x16')));_0x14cecb[_0x5497('0x8')](_0x5497('0x17'),require('./api/voiceCallReport'));_0x14cecb[_0x5497('0x8')]('/api/voice/dials/reports',require(_0x5497('0x18')));_0x14cecb[_0x5497('0x8')](_0x5497('0x19'),require(_0x5497('0x1a')));_0x14cecb[_0x5497('0x8')](_0x5497('0x1b'),require(_0x5497('0x1c')));_0x14cecb['use']('/api/members/reports',require(_0x5497('0x1d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x1e'),require('./api/trunk'));_0x14cecb[_0x5497('0x8')](_0x5497('0x1f'),require(_0x5497('0x20')));_0x14cecb[_0x5497('0x8')](_0x5497('0x21'),require(_0x5497('0x22')));_0x14cecb[_0x5497('0x8')](_0x5497('0x23'),require(_0x5497('0x24')));_0x14cecb[_0x5497('0x8')](_0x5497('0x25'),require('./api/mailQueue'));_0x14cecb[_0x5497('0x8')]('/api/mail/substatuses',require(_0x5497('0x26')));_0x14cecb[_0x5497('0x8')](_0x5497('0x27'),require(_0x5497('0x28')));_0x14cecb[_0x5497('0x8')](_0x5497('0x29'),require('./api/mailMessage'));_0x14cecb['use'](_0x5497('0x2a'),require(_0x5497('0x2b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x2c'),require('./api/mailQueueReport'));_0x14cecb[_0x5497('0x8')]('/api/dashboards',require(_0x5497('0x2d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x2e'),require(_0x5497('0x2f')));_0x14cecb[_0x5497('0x8')](_0x5497('0x30'),require('./api/faxAccount'));_0x14cecb[_0x5497('0x8')]('/api/fax/applications',require('./api/faxApplication'));_0x14cecb['use'](_0x5497('0x31'),require('./api/faxInteraction'));_0x14cecb['use'](_0x5497('0x32'),require(_0x5497('0x33')));_0x14cecb[_0x5497('0x8')]('/api/fax/queues',require('./api/faxQueue'));_0x14cecb['use'](_0x5497('0x34'),require(_0x5497('0x35')));_0x14cecb[_0x5497('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0x14cecb['use'](_0x5497('0x36'),require('./api/smsApplication'));_0x14cecb[_0x5497('0x8')](_0x5497('0x37'),require(_0x5497('0x38')));_0x14cecb['use'](_0x5497('0x39'),require(_0x5497('0x3a')));_0x14cecb['use'](_0x5497('0x3b'),require(_0x5497('0x3c')));_0x14cecb[_0x5497('0x8')]('/api/openchannel/accounts',require(_0x5497('0x3d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x3e'),require(_0x5497('0x3f')));_0x14cecb[_0x5497('0x8')]('/api/openchannel/interactions',require(_0x5497('0x40')));_0x14cecb[_0x5497('0x8')]('/api/openchannel/messages',require(_0x5497('0x41')));_0x14cecb[_0x5497('0x8')](_0x5497('0x42'),require(_0x5497('0x43')));_0x14cecb[_0x5497('0x8')](_0x5497('0x44'),require('./api/chatWebsite'));_0x14cecb[_0x5497('0x8')]('/api/openchannel/reports/queue',require(_0x5497('0x45')));_0x14cecb[_0x5497('0x8')](_0x5497('0x46'),require('./api/chatApplication'));_0x14cecb['use'](_0x5497('0x47'),require(_0x5497('0x48')));_0x14cecb[_0x5497('0x8')](_0x5497('0x49'),require(_0x5497('0x4a')));_0x14cecb[_0x5497('0x8')]('/api/chat/offline_messages',require(_0x5497('0x4b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x4c'),require(_0x5497('0x4d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x4e'),require(_0x5497('0x4f')));_0x14cecb[_0x5497('0x8')](_0x5497('0x50'),require('./api/chatProactiveAction'));_0x14cecb[_0x5497('0x8')](_0x5497('0x51'),require(_0x5497('0x52')));_0x14cecb[_0x5497('0x8')](_0x5497('0x53'),require(_0x5497('0x54')));_0x14cecb[_0x5497('0x8')]('/api/cm/hopper',require(_0x5497('0x55')));_0x14cecb[_0x5497('0x8')](_0x5497('0x56'),require(_0x5497('0x57')));_0x14cecb[_0x5497('0x8')](_0x5497('0x58'),require(_0x5497('0x59')));_0x14cecb['use'](_0x5497('0x5a'),require(_0x5497('0x5b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x5c'),require(_0x5497('0x5d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x5e'),require(_0x5497('0x5f')));_0x14cecb[_0x5497('0x8')](_0x5497('0x60'),require('./api/automation'));_0x14cecb[_0x5497('0x8')]('/api/canned_answers',require(_0x5497('0x61')));_0x14cecb[_0x5497('0x8')](_0x5497('0x62'),require(_0x5497('0x63')));_0x14cecb[_0x5497('0x8')]('/api/conditions',require(_0x5497('0x64')));_0x14cecb[_0x5497('0x8')]('/api/intervals',require(_0x5497('0x65')));_0x14cecb['use'](_0x5497('0x66'),require('./api/pause'));_0x14cecb[_0x5497('0x8')](_0x5497('0x67'),require(_0x5497('0x68')));_0x14cecb[_0x5497('0x8')](_0x5497('0x69'),require('./api/voiceQueuesLog'));_0x14cecb['use']('/api/schedules',require('./api/schedule'));_0x14cecb[_0x5497('0x8')](_0x5497('0x6a'),require(_0x5497('0x6b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x6c'),require(_0x5497('0x6d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x6e'),require(_0x5497('0x6f')));_0x14cecb['use'](_0x5497('0x70'),require(_0x5497('0x71')));_0x14cecb[_0x5497('0x8')]('/api/cm_hopper_additional_phones',require(_0x5497('0x72')));_0x14cecb['use'](_0x5497('0x73'),require(_0x5497('0x74')));_0x14cecb[_0x5497('0x8')]('/api/triggers',require(_0x5497('0x75')));_0x14cecb[_0x5497('0x8')]('/api/variables',require(_0x5497('0x76')));_0x14cecb['use'](_0x5497('0x77'),require('./api/integration'));_0x14cecb[_0x5497('0x8')](_0x5497('0x78'),require(_0x5497('0x79')));_0x14cecb[_0x5497('0x8')](_0x5497('0x7a'),require(_0x5497('0x7b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x7c'),require('./api/analyticDefaultReport'));_0x14cecb[_0x5497('0x8')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x14cecb[_0x5497('0x8')](_0x5497('0x7d'),require('./api/analyticMetric'));_0x14cecb[_0x5497('0x8')](_0x5497('0x7e'),require(_0x5497('0x7f')));_0x14cecb[_0x5497('0x8')]('/api/analytics/tree_reports',require(_0x5497('0x80')));_0x14cecb['use']('/api/integrations/salesforce/accounts',require(_0x5497('0x81')));_0x14cecb[_0x5497('0x8')](_0x5497('0x82'),require('./api/intSalesforceConfiguration'));_0x14cecb['use'](_0x5497('0x83'),require('./api/intSalesforceField'));_0x14cecb[_0x5497('0x8')]('/api/integrations/sugarcrm/accounts',require(_0x5497('0x84')));_0x14cecb['use'](_0x5497('0x85'),require(_0x5497('0x86')));_0x14cecb['use'](_0x5497('0x87'),require('./api/intSugarcrmField'));_0x14cecb['use'](_0x5497('0x88'),require(_0x5497('0x89')));_0x14cecb['use'](_0x5497('0x8a'),require(_0x5497('0x8b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x8c'),require(_0x5497('0x8d')));_0x14cecb[_0x5497('0x8')]('/api/integrations/zoho/accounts',require(_0x5497('0x8e')));_0x14cecb['use']('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x14cecb[_0x5497('0x8')](_0x5497('0x8f'),require(_0x5497('0x90')));_0x14cecb['use'](_0x5497('0x91'),require('./api/intZendeskAccount'));_0x14cecb['use'](_0x5497('0x92'),require(_0x5497('0x93')));_0x14cecb[_0x5497('0x8')](_0x5497('0x94'),require(_0x5497('0x95')));_0x14cecb[_0x5497('0x8')]('/api/integrations/freshdesk/accounts',require(_0x5497('0x96')));_0x14cecb[_0x5497('0x8')](_0x5497('0x97'),require(_0x5497('0x98')));_0x14cecb['use'](_0x5497('0x99'),require(_0x5497('0x9a')));_0x14cecb[_0x5497('0x8')](_0x5497('0x9b'),require('./api/intVtigerAccount'));_0x14cecb[_0x5497('0x8')](_0x5497('0x9c'),require(_0x5497('0x9d')));_0x14cecb['use'](_0x5497('0x9e'),require('./api/intVtigerField'));_0x14cecb['use']('/api/integrations/servicenow/accounts',require(_0x5497('0x9f')));_0x14cecb[_0x5497('0x8')](_0x5497('0xa0'),require('./api/intServicenowConfiguration'));_0x14cecb[_0x5497('0x8')](_0x5497('0xa1'),require(_0x5497('0xa2')));_0x14cecb[_0x5497('0x8')]('/api/integrations/dynamics365/accounts',require(_0x5497('0xa3')));_0x14cecb[_0x5497('0x8')](_0x5497('0xa4'),require('./api/intDynamics365Configuration'));_0x14cecb[_0x5497('0x8')](_0x5497('0xa5'),require(_0x5497('0xa6')));_0x14cecb[_0x5497('0x8')](_0x5497('0xa7'),require(_0x5497('0xa8')));_0x14cecb[_0x5497('0x8')]('/api/integrations/freshsales/configurations',require(_0x5497('0xa9')));_0x14cecb[_0x5497('0x8')](_0x5497('0xaa'),require(_0x5497('0xab')));_0x14cecb['use']('/api/networks',require('./api/network'));_0x14cecb[_0x5497('0x8')](_0x5497('0xac'),require(_0x5497('0xad')));_0x14cecb['use'](_0x5497('0xae'),require(_0x5497('0xaf')));_0x14cecb[_0x5497('0x8')](_0x5497('0xb0'),require(_0x5497('0xb1')));_0x14cecb[_0x5497('0x8')](_0x5497('0xb2'),require(_0x5497('0xb3')));_0x14cecb[_0x5497('0x8')](_0x5497('0xb4'),require(_0x5497('0xb5')));_0x14cecb['use'](_0x5497('0xb6'),require(_0x5497('0xb7')));_0x14cecb[_0x5497('0x8')]('/api/square/reports',require(_0x5497('0xb8')));_0x14cecb['use'](_0x5497('0xb9'),require(_0x5497('0xba')));_0x14cecb['use'](_0x5497('0xbb'),require(_0x5497('0xbc')));_0x14cecb[_0x5497('0x8')](_0x5497('0xbd'),require('./api/setting'));_0x14cecb[_0x5497('0x8')](_0x5497('0xbe'),require(_0x5497('0xbf')));_0x14cecb['use'](_0x5497('0xc0'),require(_0x5497('0xc1')));_0x14cecb['use'](_0x5497('0xc2'),require(_0x5497('0xc3')));_0x14cecb[_0x5497('0x8')]('/api/square/messages',require('./api/squareMessage'));_0x14cecb[_0x5497('0x8')](_0x5497('0xc4'),require(_0x5497('0xc5')));_0x14cecb[_0x5497('0x8')](_0x5497('0xc6'),require(_0x5497('0xc7')));_0x14cecb[_0x5497('0x8')]('/api/campaigns',require('./api/campaign'));_0x14cecb[_0x5497('0x8')](_0x5497('0xc8'),require('./api/migration'));_0x14cecb[_0x5497('0x8')](_0x5497('0xc9'),require(_0x5497('0xca')));_0x14cecb['use'](_0x5497('0xcb'),require(_0x5497('0xcc')));_0x14cecb['use'](_0x5497('0xcd'),require(_0x5497('0xce')));_0x14cecb[_0x5497('0x8')](_0x5497('0xcf'),require(_0x5497('0xd0')));_0x14cecb['use'](_0x5497('0xd1'),require(_0x5497('0xd2')));_0x14cecb[_0x5497('0x8')](_0x5497('0xd3'),require(_0x5497('0xd4')));_0x14cecb['use'](_0x5497('0xd5'),require(_0x5497('0xd6')));_0x14cecb[_0x5497('0x8')](_0x5497('0xd7'),require('./api/cmList'));_0x14cecb[_0x5497('0x8')](_0x5497('0xd8'),require('./api/voicePrefix'));_0x14cecb[_0x5497('0x8')](_0x5497('0xd9'),require(_0x5497('0xda')));_0x14cecb[_0x5497('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x14cecb['use']('/api/userProfile/resources',require('./api/userProfileResource'));_0x14cecb[_0x5497('0x8')](_0x5497('0xdb'),require(_0x5497('0xdc')));_0x14cecb[_0x5497('0x8')](_0x5497('0xdd'),require('./api/whatsappAccount'));_0x14cecb['use'](_0x5497('0xde'),require(_0x5497('0xdf')));_0x14cecb[_0x5497('0x8')](_0x5497('0xe0'),require(_0x5497('0xe1')));_0x14cecb[_0x5497('0x8')](_0x5497('0xe2'),require(_0x5497('0xe3')));_0x14cecb[_0x5497('0x8')](_0x5497('0xe4'),require('./api/whatsappQueueReport'));_0x14cecb[_0x5497('0x8')](_0x5497('0xe5'),require(_0x5497('0xe6')));_0x14cecb[_0x5497('0x8')](_0x5497('0xe7'),require(_0x5497('0xe8')));_0x14cecb['use'](_0x5497('0xe9'),require('./api/cloudProvider'));_0x14cecb[_0x5497('0x8')](_0x5497('0xea'),require(_0x5497('0xeb')));_0x14cecb['use']('/api/user-settings',require(_0x5497('0xec')));_0x14cecb[_0x5497('0x8')](_0x5497('0xed'),require(_0x5497('0xee')));_0x14cecb[_0x5497('0x8')](_0x5497('0xef'),require(_0x5497('0xf0')));_0x14cecb[_0x5497('0x8')]('/api/auth/google',require('./api/authGoogle'));_0x14cecb['use'](_0x5497('0xf1'),require(_0x5497('0xf2')));_0x14cecb[_0x5497('0x8')](_0x5497('0xf3'),require('./api/jira'));_0x14cecb['use'](_0x5497('0xf4'),require(_0x5497('0xf5')));_0x14cecb['use'](_0x5497('0xf6'),require(_0x5497('0xf7')));_0x14cecb[_0x5497('0x8')](_0x5497('0xf8'),require('./api/system'));_0x14cecb['use']('/api/pm2',require('./api/pm2'));_0x14cecb['use'](_0x5497('0xf9'),require('./api/webbar'));_0x14cecb[_0x5497('0x8')]('/api/logs',clientSideLogs);_0x14cecb[_0x5497('0x8')](_0x5497('0xfa'),express[_0x5497('0xfb')](path[_0x5497('0xfc')](config[_0x5497('0xfd')],_0x5497('0xfa'))));_0x14cecb['use'](_0x5497('0xfe'),express['static'](path[_0x5497('0xfc')](config[_0x5497('0xfd')],_0x5497('0xfe'))));_0x14cecb[_0x5497('0x8')](_0x5497('0xff'),express[_0x5497('0xfb')](path[_0x5497('0xfc')](config[_0x5497('0xfd')],_0x5497('0xff'))));_0x14cecb[_0x5497('0x8')]('/snippet',express[_0x5497('0xfb')](path['join'](config[_0x5497('0xfd')],_0x5497('0x100'),'3.13.0')));_0x14cecb[_0x5497('0x8')](_0x5497('0x101'),express[_0x5497('0xfb')](path[_0x5497('0xfc')](config[_0x5497('0xfd')],_0x5497('0x102'))));_0x14cecb[_0x5497('0x103')](_0x5497('0x104'))[_0x5497('0x105')](errors[0x194]);_0x14cecb[_0x5497('0x103')]('/*')[_0x5497('0x105')](function(_0x926bc1,_0x38d9fe){_0x38d9fe[_0x5497('0x106')](path['resolve'](_0x14cecb[_0x5497('0x105')](_0x5497('0x107'))+_0x5497('0x108')));});return _0x14cecb;});}; \ No newline at end of file +var _0xe5af=['/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerConfiguration','./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/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','./api/mailInteractionHasTag','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','/api/logs','/apidoc','join','/www','static','/demo','root','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','/api/users','./api/user','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','./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/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xe5af,0x9c));var _0xfe5a=function(_0xb256af,_0x29a3e2){_0xb256af=_0xb256af-0x0;var _0xd2806d=_0xe5af[_0xb256af];return _0xd2806d;};'use strict';var path=require('path');var express=require(_0xfe5a('0x0'));var errors=require(_0xfe5a('0x1'));var config=require('./config/environment');var setupLoggers=require(_0xfe5a('0x2'))[_0xfe5a('0x3')];var clientSideLogs=require(_0xfe5a('0x4'));exports['default']=function(_0x1165e3){return setupLoggers(_0x1165e3)['then'](function(){_0x1165e3['use'](_0xfe5a('0x5'),require(_0xfe5a('0x6')));_0x1165e3['use']('/api/voice/chanspy',require(_0xfe5a('0x7')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x9'),require(_0xfe5a('0xa')));_0x1165e3['use'](_0xfe5a('0xb'),require('./api/voiceExtension'));_0x1165e3['use'](_0xfe5a('0xc'),require(_0xfe5a('0xd')));_0x1165e3['use'](_0xfe5a('0xe'),require(_0xfe5a('0xf')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x10'),require(_0xfe5a('0x11')));_0x1165e3['use'](_0xfe5a('0x12'),require(_0xfe5a('0x13')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x14'),require(_0xfe5a('0x15')));_0x1165e3['use'](_0xfe5a('0x16'),require(_0xfe5a('0x17')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x18'),require(_0xfe5a('0x19')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x1a'),require(_0xfe5a('0x1b')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x1c'),require(_0xfe5a('0x1d')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x1e'),require(_0xfe5a('0x1f')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x20'),require('./api/memberReport'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x21'),require('./api/trunk'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x22'),require(_0xfe5a('0x23')));_0x1165e3['use']('/api/mail/out_servers',require(_0xfe5a('0x24')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x25'),require(_0xfe5a('0x26')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x27'),require('./api/mailQueue'));_0x1165e3[_0xfe5a('0x8')]('/api/mail/substatuses',require(_0xfe5a('0x28')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x29'),require('./api/mailInteraction'));_0x1165e3['use'](_0xfe5a('0x2a'),require(_0xfe5a('0x2b')));_0x1165e3['use'](_0xfe5a('0x2c'),require(_0xfe5a('0x2d')));_0x1165e3['use'](_0xfe5a('0x2e'),require(_0xfe5a('0x2f')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x30'),require('./api/dashboard'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x31'),require(_0xfe5a('0x32')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x33'),require(_0xfe5a('0x34')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x35'),require('./api/faxApplication'));_0x1165e3['use'](_0xfe5a('0x36'),require('./api/faxInteraction'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x37'),require(_0xfe5a('0x38')));_0x1165e3['use']('/api/fax/queues',require('./api/faxQueue'));_0x1165e3[_0xfe5a('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x1165e3['use'](_0xfe5a('0x39'),require(_0xfe5a('0x3a')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x3b'),require(_0xfe5a('0x3c')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x3d'),require(_0xfe5a('0x3e')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x3f'),require(_0xfe5a('0x40')));_0x1165e3['use'](_0xfe5a('0x41'),require(_0xfe5a('0x42')));_0x1165e3['use'](_0xfe5a('0x43'),require(_0xfe5a('0x44')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x45'),require(_0xfe5a('0x46')));_0x1165e3['use']('/api/openchannel/interactions',require(_0xfe5a('0x47')));_0x1165e3['use'](_0xfe5a('0x48'),require(_0xfe5a('0x49')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x4a'),require('./api/openchannelQueue'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x4b'),require(_0xfe5a('0x4c')));_0x1165e3['use'](_0xfe5a('0x4d'),require(_0xfe5a('0x4e')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x4f'),require('./api/chatApplication'));_0x1165e3[_0xfe5a('0x8')]('/api/chat/interactions',require(_0xfe5a('0x50')));_0x1165e3[_0xfe5a('0x8')]('/api/chat/messages',require(_0xfe5a('0x51')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x52'),require(_0xfe5a('0x53')));_0x1165e3['use'](_0xfe5a('0x54'),require(_0xfe5a('0x55')));_0x1165e3[_0xfe5a('0x8')]('/api/chat/groups',require(_0xfe5a('0x56')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x57'),require(_0xfe5a('0x58')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x59'),require(_0xfe5a('0x5a')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x5b'),require(_0xfe5a('0x5c')));_0x1165e3[_0xfe5a('0x8')]('/api/cm/hopper',require(_0xfe5a('0x5d')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x5e'),require(_0xfe5a('0x5f')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x60'),require(_0xfe5a('0x61')));_0x1165e3['use'](_0xfe5a('0x62'),require(_0xfe5a('0x63')));_0x1165e3['use']('/api/cm/custom_fields',require(_0xfe5a('0x64')));_0x1165e3['use']('/api/actions',require(_0xfe5a('0x65')));_0x1165e3[_0xfe5a('0x8')]('/api/automations',require(_0xfe5a('0x66')));_0x1165e3['use'](_0xfe5a('0x67'),require(_0xfe5a('0x68')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x69'),require(_0xfe5a('0x6a')));_0x1165e3[_0xfe5a('0x8')]('/api/conditions',require(_0xfe5a('0x6b')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x6c'),require(_0xfe5a('0x6d')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x6e'),require(_0xfe5a('0x6f')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x70'),require(_0xfe5a('0x71')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x72'),require(_0xfe5a('0x73')));_0x1165e3[_0xfe5a('0x8')]('/api/schedules',require(_0xfe5a('0x74')));_0x1165e3[_0xfe5a('0x8')]('/api/sounds',require('./api/sound'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x75'),require(_0xfe5a('0x76')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x77'),require(_0xfe5a('0x78')));_0x1165e3[_0xfe5a('0x8')]('/api/cm_contact_has_items',require(_0xfe5a('0x79')));_0x1165e3['use'](_0xfe5a('0x7a'),require('./api/cmHopperAdditionalPhone'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x7b'),require(_0xfe5a('0x7c')));_0x1165e3[_0xfe5a('0x8')]('/api/triggers',require(_0xfe5a('0x7d')));_0x1165e3[_0xfe5a('0x8')]('/api/variables',require(_0xfe5a('0x7e')));_0x1165e3['use']('/api/integrations',require(_0xfe5a('0x7f')));_0x1165e3['use'](_0xfe5a('0x80'),require(_0xfe5a('0x81')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x82'),require('./api/analyticCustomReport'));_0x1165e3[_0xfe5a('0x8')]('/api/analytics/default_reports',require(_0xfe5a('0x83')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x84'),require('./api/analyticExtractedReport'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x85'),require('./api/analyticMetric'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x86'),require(_0xfe5a('0x87')));_0x1165e3['use'](_0xfe5a('0x88'),require(_0xfe5a('0x89')));_0x1165e3[_0xfe5a('0x8')]('/api/integrations/salesforce/accounts',require(_0xfe5a('0x8a')));_0x1165e3[_0xfe5a('0x8')]('/api/integrations/salesforce/configurations',require(_0xfe5a('0x8b')));_0x1165e3['use'](_0xfe5a('0x8c'),require(_0xfe5a('0x8d')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x8e'),require(_0xfe5a('0x8f')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x90'),require(_0xfe5a('0x91')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x92'),require(_0xfe5a('0x93')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x94'),require(_0xfe5a('0x95')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x96'),require('./api/intDeskConfiguration'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x97'),require(_0xfe5a('0x98')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x99'),require(_0xfe5a('0x9a')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x9b'),require(_0xfe5a('0x9c')));_0x1165e3[_0xfe5a('0x8')]('/api/integrations/zoho/fields',require(_0xfe5a('0x9d')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x9e'),require('./api/intZendeskAccount'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x9f'),require('./api/intZendeskConfiguration'));_0x1165e3[_0xfe5a('0x8')]('/api/integrations/zendesk/fields',require(_0xfe5a('0xa0')));_0x1165e3['use'](_0xfe5a('0xa1'),require('./api/intFreshdeskAccount'));_0x1165e3['use']('/api/integrations/freshdesk/configurations',require(_0xfe5a('0xa2')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xa3'),require(_0xfe5a('0xa4')));_0x1165e3[_0xfe5a('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x1165e3[_0xfe5a('0x8')]('/api/integrations/vtiger/configurations',require(_0xfe5a('0xa5')));_0x1165e3[_0xfe5a('0x8')]('/api/integrations/vtiger/fields',require(_0xfe5a('0xa6')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xa7'),require(_0xfe5a('0xa8')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xa9'),require('./api/intServicenowConfiguration'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xaa'),require(_0xfe5a('0xab')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xac'),require(_0xfe5a('0xad')));_0x1165e3[_0xfe5a('0x8')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x1165e3['use'](_0xfe5a('0xae'),require('./api/intDynamics365Field'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xaf'),require('./api/intFreshsalesAccount'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xb0'),require(_0xfe5a('0xb1')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xb2'),require('./api/intFreshsalesField'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xb3'),require('./api/network'));_0x1165e3['use'](_0xfe5a('0xb4'),require('./api/chatQueueReport'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xb5'),require(_0xfe5a('0xb6')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xb7'),require(_0xfe5a('0xb8')));_0x1165e3[_0xfe5a('0x8')]('/api/jscripty/questions/reports',require(_0xfe5a('0xb9')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xba'),require(_0xfe5a('0xbb')));_0x1165e3[_0xfe5a('0x8')]('/api/sms/reports/queue',require(_0xfe5a('0xbc')));_0x1165e3[_0xfe5a('0x8')]('/api/square/reports',require(_0xfe5a('0xbd')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xbe'),require('./api/squareReportDetail'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xbf'),require('./api/jscriptyProject'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xc0'),require('./api/setting'));_0x1165e3[_0xfe5a('0x8')]('/api/square/odbc',require(_0xfe5a('0xc1')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xc2'),require(_0xfe5a('0xc3')));_0x1165e3['use'](_0xfe5a('0xc4'),require('./api/squareRecording'));_0x1165e3['use'](_0xfe5a('0xc5'),require(_0xfe5a('0xc6')));_0x1165e3[_0xfe5a('0x8')]('/api/teams',require(_0xfe5a('0xc7')));_0x1165e3['use'](_0xfe5a('0xc8'),require(_0xfe5a('0xc9')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xca'),require('./api/campaign'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xcb'),require('./api/migration'));_0x1165e3[_0xfe5a('0x8')]('/api/attachments',require('./api/attachment'));_0x1165e3[_0xfe5a('0x8')]('/api/plugins',require(_0xfe5a('0xcc')));_0x1165e3['use'](_0xfe5a('0xcd'),require(_0xfe5a('0xce')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xcf'),require(_0xfe5a('0xd0')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xd1'),require(_0xfe5a('0xd2')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xd3'),require(_0xfe5a('0xd4')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xd5'),require(_0xfe5a('0xd6')));_0x1165e3['use'](_0xfe5a('0xd7'),require(_0xfe5a('0xd8')));_0x1165e3['use'](_0xfe5a('0xd9'),require('./api/voicePrefix'));_0x1165e3[_0xfe5a('0x8')]('/api/userProfiles',require(_0xfe5a('0xda')));_0x1165e3['use'](_0xfe5a('0xdb'),require(_0xfe5a('0xdc')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xdd'),require(_0xfe5a('0xde')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xdf'),require(_0xfe5a('0xe0')));_0x1165e3[_0xfe5a('0x8')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xe1'),require(_0xfe5a('0xe2')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xe3'),require(_0xfe5a('0xe4')));_0x1165e3[_0xfe5a('0x8')]('/api/whatsapp/messages',require(_0xfe5a('0xe5')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xe6'),require(_0xfe5a('0xe7')));_0x1165e3[_0xfe5a('0x8')]('/api/whatsapp/reports/transfer',require(_0xfe5a('0xe8')));_0x1165e3[_0xfe5a('0x8')]('/api/whatsapp/queues',require(_0xfe5a('0xe9')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xea'),require(_0xfe5a('0xeb')));_0x1165e3[_0xfe5a('0x8')]('/api/realtime',require(_0xfe5a('0xec')));_0x1165e3[_0xfe5a('0x8')]('/api/user-settings',require('./api/user-setting'));_0x1165e3['use']('/api/mail_interaction_has_tags',require(_0xfe5a('0xed')));_0x1165e3[_0xfe5a('0x8')]('/api/auth/local',require('./api/authLocal'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xee'),require(_0xfe5a('0xef')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xf0'),require(_0xfe5a('0xf1')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xf2'),require('./api/jira'));_0x1165e3['use'](_0xfe5a('0xf3'),require(_0xfe5a('0xf4')));_0x1165e3['use'](_0xfe5a('0xf5'),require(_0xfe5a('0xf6')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xf7'),require(_0xfe5a('0xf8')));_0x1165e3[_0xfe5a('0x8')]('/api/pm2',require(_0xfe5a('0xf9')));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xfa'),require('./api/webbar'));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xfb'),clientSideLogs);_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xfc'),express['static'](path[_0xfe5a('0xfd')](config['root'],_0xfe5a('0xfc'))));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0xfe'),express[_0xfe5a('0xff')](path[_0xfe5a('0xfd')](config['root'],_0xfe5a('0xfe'))));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x100'),express[_0xfe5a('0xff')](path[_0xfe5a('0xfd')](config[_0xfe5a('0x101')],_0xfe5a('0x100'))));_0x1165e3['use'](_0xfe5a('0x102'),express[_0xfe5a('0xff')](path[_0xfe5a('0xfd')](config[_0xfe5a('0x101')],_0xfe5a('0x103'),_0xfe5a('0x104'))));_0x1165e3[_0xfe5a('0x8')](_0xfe5a('0x105'),express[_0xfe5a('0xff')](path[_0xfe5a('0xfd')](config[_0xfe5a('0x101')],_0xfe5a('0x106'))));_0x1165e3[_0xfe5a('0x107')](_0xfe5a('0x108'))[_0xfe5a('0x109')](errors[0x194]);_0x1165e3[_0xfe5a('0x107')]('/*')[_0xfe5a('0x109')](function(_0x58ffea,_0x5e8efb){_0x5e8efb[_0xfe5a('0x10a')](path[_0xfe5a('0x10b')](_0x1165e3[_0xfe5a('0x109')](_0xfe5a('0x10c'))+_0xfe5a('0x10d')));});return _0x1165e3;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 953c864..f63b3ce 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80aa=['../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/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.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/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x80aa,0x1ec));var _0xa80a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80aa[_0x14add3];return _0x4a174f;};'use strict';var jayson=require('jayson/promise');var _=require(_0xa80a('0x0'));var config=require(_0xa80a('0x1'));exports[_0xa80a('0x2')]=function(){return new Promise(function(_0x3f0702,_0x511cd3){var _0xb8e2db={};_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x3')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x5')));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/voiceQueue/voiceQueue.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x6')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x7')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x8')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x9')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/memberReport/memberReport.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xa')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xb')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xc')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xd')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xe')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0xf')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x10')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x11')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x12')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x13')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/faxAccount/faxAccount.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/faxApplication/faxApplication.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x14')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x15')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x16')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x17')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x18')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x19')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1a')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1b')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1c')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1d')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1e')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1f')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x20')));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/chatInteraction/chatInteraction.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x21')));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/chatQueue/chatQueue.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x22')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x23')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x24')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x25')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x26')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x27')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x28')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x29')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x2a')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x2b')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x2c')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x2d')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x2e')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x2f')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x30')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x31')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x32')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x33')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x34')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x35')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x36')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/squareReport/squareReport.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/setting/setting.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x37')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x38')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x39')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3a')));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/campaign/campaign.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3b')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/plugin/plugin.rpc'));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x3c')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3d')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3e')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3f')));var _0x5b9a40=jayson[_0xa80a('0x40')](_0xb8e2db)[_0xa80a('0x41')]();var _0x566f57=config[_0xa80a('0x42')][_0xa80a('0x43')]||config[_0xa80a('0x43')]+0x1;var _0x2e2596=config[_0xa80a('0x42')]['ip']||_0xa80a('0x44');_0x5b9a40['on']('error',function(_0x36e104){return _0x511cd3(_0x36e104);});_0x5b9a40[_0xa80a('0x2')](_0x566f57,_0x2e2596,function(){console['log'](_0xa80a('0x45'),_0x2e2596,_0x566f57);require(_0xa80a('0x46'))['default']();return _0x3f0702(_0xa80a('0x47')+_0x2e2596+':'+_0x566f57);});});}; \ No newline at end of file +var _0x2b7e=['error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.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/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.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/squareProject/squareProject.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc'];(function(_0x3f3bb3,_0x55deed){var _0x46cb4c=function(_0x11605c){while(--_0x11605c){_0x3f3bb3['push'](_0x3f3bb3['shift']());}};_0x46cb4c(++_0x55deed);}(_0x2b7e,0x1b4));var _0xe2b7=function(_0x457772,_0x2acb15){_0x457772=_0x457772-0x0;var _0x37a52f=_0x2b7e[_0x457772];return _0x37a52f;};'use strict';var jayson=require(_0xe2b7('0x0'));var _=require(_0xe2b7('0x1'));var config=require(_0xe2b7('0x2'));exports[_0xe2b7('0x3')]=function(){return new Promise(function(_0x15555f,_0x1686cd){var _0x395dc6={};_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x5')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x6')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x7')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x8')));_0x395dc6=_['merge'](_0x395dc6,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x9')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0xa')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/trunk/trunk.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0xb')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0xc')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0xd')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0xe')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0xf')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x10')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x11')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x12')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/faxAccount/faxAccount.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x13')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x14')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x15')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x16')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x17')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x18')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x19')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x1a')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x1b')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x1c')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x1d')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x1e')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x1f')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x20')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x21')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x22')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x23')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x24')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x25')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x26')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x27')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x28')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/pause/pause.rpc'));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x29')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x2a')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/template/template.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x2b')));_0x395dc6=_['merge'](_0x395dc6,require('../api/variable/variable.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x2c')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x2d')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x2e')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x2f')));_0x395dc6=_['merge'](_0x395dc6,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x30')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x31')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x32')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x33')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x34')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x35')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x36')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x37')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x38')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x39')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/squareRecording/squareRecording.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/squareMessage/squareMessage.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require('../api/campaign/campaign.rpc'));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x3a')));_0x395dc6=_['merge'](_0x395dc6,require('../api/plugin/plugin.rpc'));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x3b')));_0x395dc6=_['merge'](_0x395dc6,require(_0xe2b7('0x3c')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x3d')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x3e')));_0x395dc6=_[_0xe2b7('0x4')](_0x395dc6,require(_0xe2b7('0x3f')));var _0x4fae5e=jayson[_0xe2b7('0x40')](_0x395dc6)[_0xe2b7('0x41')]();var _0x4decb5=config['rpc']['port']||config[_0xe2b7('0x42')]+0x1;var _0x2e8881=config[_0xe2b7('0x43')]['ip']||'localhost';_0x4fae5e['on'](_0xe2b7('0x44'),function(_0xa40fc6){return _0x1686cd(_0xa40fc6);});_0x4fae5e[_0xe2b7('0x3')](_0x4decb5,_0x2e8881,function(){console[_0xe2b7('0x45')](_0xe2b7('0x46'),_0x2e8881,_0x4decb5);require('../config/triggers')[_0xe2b7('0x47')]();return _0x15555f('RPC\x20listening\x20on\x20'+_0x2e8881+':'+_0x4decb5);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 599cf1d..c9eec53 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 _0x2f5e=['BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','WAIT','label','exports','lodash','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','sendRequest','prototype','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','join','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav'];(function(_0x358393,_0x32a76d){var _0x3758e4=function(_0x108983){while(--_0x108983){_0x358393['push'](_0x358393['shift']());}};_0x3758e4(++_0x32a76d);}(_0x2f5e,0xe0));var _0xe2f5=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0x2f5e[_0x189c9e];return _0x3f38ca;};'use strict';var util=require('util');var _=require(_0xe2f5('0x0'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0xe2f5('0x1'));var AGIError=require(_0xe2f5('0x2'));function AGIChannel(_0x868bd0){var _0x30f212=this,_0x92ee5f=new AGIReply(),_0x51f475=![],_0x3ad654={};EventEmitter[_0xe2f5('0x3')](_0x30f212);_0x868bd0['setEncoding'](_0xe2f5('0x4'));_0x868bd0[_0xe2f5('0x5')](0x8*0x3c*0x3c*0x3e8);_0x92ee5f[_0xe2f5('0x6')]('utf8');_0x92ee5f['on'](_0xe2f5('0x7'),function(_0x2562a3){for(var _0x49edc0 in _0x2562a3){_0x30f212[_0x49edc0]=_0x2562a3[_0x49edc0];}_0x30f212[_0xe2f5('0x8')](_0xe2f5('0x9'));});_0x92ee5f['on'](_0xe2f5('0xa'),function(_0x5f060b){if(_0x5f060b[_0xe2f5('0xb')]()==_0xe2f5('0xc')){_0x30f212[_0xe2f5('0x8')](_0xe2f5('0xc'));return;}if(_0x5f060b['substring'](0x0,0xb)==_0xe2f5('0xd')){_0x51f475=!![];}if(_0x51f475){_0x3ad654['rx']+=_0x5f060b+'\x0a';if(_0x5f060b[_0xe2f5('0xe')](_0xe2f5('0xf'))!=-0x1){_0x51f475=![];}}else{_0x3ad654['rx']=_0x5f060b;}if(_0x51f475){return;}if(typeof _0x3ad654['cb']==_0xe2f5('0x10')){var _0x24ccca=_0x3ad654['rx'][_0xe2f5('0x11')](0x0,0x3),_0x80ba59=null,_0x5bf4c1=null;_0x24ccca=parseInt(_0x24ccca);if(isNaN(_0x24ccca)){_0x3ad654['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe2f5('0x12')});return;}if(_0x24ccca!=0xc8){_0x3ad654['cb'](null,{'code':_0x24ccca,'result':-0x1,'extra':'KO'});return;}_0x80ba59=_0x3ad654['rx']['substring'](0x4)[_0xe2f5('0x13')](_0xe2f5('0x14'),'');if(_0x80ba59[_0xe2f5('0x15')]('\x20')!=-0x1){_0x80ba59=_0x80ba59[_0xe2f5('0x16')](0x0,_0x80ba59[_0xe2f5('0x15')]('\x20'));}if(_[_0xe2f5('0x17')](_0x80ba59,'-1')){_0x80ba59=parseInt(_0x80ba59);}_0x5bf4c1=_0x3ad654['rx']['split']('\x20');if(_0x5bf4c1[_0xe2f5('0x18')]==0x3){_0x5bf4c1=_0x5bf4c1[0x2][_0xe2f5('0x11')](0x1,_0x5bf4c1[0x2][_0xe2f5('0x18')]-0x1);}else if(_0x5bf4c1['length']>0x3){var _0x4c3824=/\((.+)\)/;var _0x1da730=_0x3ad654['rx']['match'](_0x4c3824);if(_0x1da730){_0x5bf4c1=_0x1da730[0x1];}else{_0x5bf4c1=null;}}else{_0x5bf4c1=null;}_0x3ad654['cb'](null,{'code':_0x24ccca,'result':_0x80ba59,'extra':_0x5bf4c1});}});_0x868bd0['on'](_0xe2f5('0x19'),function(_0x56ab1c){_0x30f212[_0xe2f5('0x8')](_0xe2f5('0x19'),new AGIError(_0xe2f5('0x1a'),_0x56ab1c['code']));});_0x868bd0['on'](_0xe2f5('0x1b'),function(){_0x30f212[_0xe2f5('0x8')](_0xe2f5('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x868bd0['on'](_0xe2f5('0x1c'),function(){_0x30f212['emit'](_0xe2f5('0x1c'),new AGIError(_0xe2f5('0x1d')));_0x868bd0[_0xe2f5('0x1e')]();});_0x868bd0['pipe'](_0x92ee5f);this[_0xe2f5('0x1f')]=function(_0xc56a88,_0xd31609){var _0xc56a88=_0xc56a88||'',_0xd31609=typeof _0xd31609==_0xe2f5('0x10')?_0xd31609:new Function();_0x3ad654={'tx':_0xc56a88,'rx':'','cb':_0xd31609};_0x868bd0[_0xe2f5('0x20')](_0xc56a88+'\x0a');},this['close']=function(){_0x868bd0[_0xe2f5('0x1e')]();};}util[_0xe2f5('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xe2f5('0x22')]=function(_0x583fe6){return this[_0xe2f5('0x1f')]['sync'](this,_0x583fe6);};AGIChannel[_0xe2f5('0x23')]['answer']=function(){return this[_0xe2f5('0x22')](_0xe2f5('0x24'));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x25')]=function(_0xd8dac4,_0x3b956d,_0x222e21){_0xd8dac4=_0xd8dac4===undefined?_0xe2f5('0x26'):_0xd8dac4;_0x3b956d=_0x3b956d===undefined?'5':_0x3b956d;_0x222e21=_0x222e21===undefined?'1':_0x222e21;return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xd8dac4,_0x3b956d*0x3e8,_0x222e21));};AGIChannel['prototype'][_0xe2f5('0x28')]=function(_0x4d666d){_0x4d666d=_0x4d666d||_0xe2f5('0x29');return this[_0xe2f5('0x22')](util['format'](_0xe2f5('0x2a'),_0x4d666d));};AGIChannel[_0xe2f5('0x23')]['exec']=function(_0x5c7f28,_0x2af100){if(_['isArray'](_0x2af100)){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')](_0xe2f5('0x2b'),_0x5c7f28,_0x2af100[_0xe2f5('0x2c')](',')));}return this['sendRequest'](util[_0xe2f5('0x27')]('EXEC\x20%s\x20%s',_0x5c7f28,_0x2af100));};AGIChannel[_0xe2f5('0x23')]['setContext']=function(_0x54e89a){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('SET\x20CONTEXT\x20%s',_0x54e89a));};AGIChannel[_0xe2f5('0x23')]['setExtension']=function(_0x89a5ec){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('SET\x20EXTENSION\x20%s',_0x89a5ec));};AGIChannel[_0xe2f5('0x23')]['setPriority']=function(_0x497384){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')](_0xe2f5('0x2d'),_0x497384));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0xc')]=function(){return this[_0xe2f5('0x22')](_0xe2f5('0x2e'));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x2f')]=function(_0x29c588,_0x40c661){var _0x5f6c81=_[_0xe2f5('0x30')](_0x40c661)||_['isNumber'](_0x40c661)?_0x40c661[_0xe2f5('0x31')]():_0x40c661;return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x29c588,_0x5f6c81?_0x5f6c81[_0xe2f5('0x31')]()[_0xe2f5('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x32')]=function(_0xd52970,_0x21c7ce){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0xd52970,_0x21c7ce));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x33')]=function(_0x43fbff,_0x1cbacf){return this[_0xe2f5('0x22')](util['format'](_0xe2f5('0x34'),_0x43fbff,_0x1cbacf));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x35')]=function(_0x59df8f,_0x3701d9){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')](_0xe2f5('0x36'),_0x59df8f,_0x3701d9));};AGIChannel['prototype'][_0xe2f5('0x37')]=function(_0x55d3f3,_0x340e33,_0x548a09){_0x340e33=_0x340e33||this['extension'];_0x548a09=_0x548a09||0x1;this[_0xe2f5('0x38')](_0x55d3f3);this[_0xe2f5('0x39')](_0x340e33);this[_0xe2f5('0x3a')](_0x548a09);return this[_0xe2f5('0x28')](util[_0xe2f5('0x27')](_0xe2f5('0x3b'),_0x55d3f3,_0x340e33,_0x548a09));};AGIChannel['prototype'][_0xe2f5('0x3c')]=function(_0x3628be){return this['sendRequest'](util[_0xe2f5('0x27')](_0xe2f5('0x3d'),_0x3628be));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x3e')]=function(_0x359357,_0x52efa8,_0x1a1dd2,_0x1f7c15,_0x38e108,_0x2bc4b9){_0x52efa8=_0x52efa8||_0xe2f5('0x3f');_0x1a1dd2=_0x1a1dd2||'';_0x1f7c15=_0x1f7c15===undefined?-0x1:_0x1f7c15==='-1'?-0x1:_0x1f7c15*0x3e8;_0x38e108=_0x38e108===undefined?'':'s='+_0x38e108;_0x2bc4b9=_0x2bc4b9?_0xe2f5('0x40'):'';return this['sendRequest'](util[_0xe2f5('0x27')](_0xe2f5('0x41'),_0x359357,_0x52efa8,_0x1a1dd2,_0x1f7c15,_0x2bc4b9,_0x38e108));};AGIChannel[_0xe2f5('0x23')]['streamFile']=function(_0x121ac5,_0x49c332){_0x49c332=_0x49c332||'';return this[_0xe2f5('0x22')](util['format'](_0xe2f5('0x42'),_0x121ac5,_0x49c332));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x43')]=function(_0x16881e){return this[_0xe2f5('0x44')]('AGI',_0x16881e);};AGIChannel[_0xe2f5('0x23')]['wait']=function(_0x45bbae){return this[_0xe2f5('0x44')](_0xe2f5('0x45'),_0x45bbae);};AGIChannel[_0xe2f5('0x23')]['error']=function(_0x406bf7,_0x5c19b5){this[_0xe2f5('0x28')](util[_0xe2f5('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x406bf7['id'],_0x406bf7[_0xe2f5('0x46')],_0x5c19b5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe2f5('0x47')]=AGIChannel; \ No newline at end of file +var _0xd6bc=['HANGUP','isBoolean','isNumber','toString','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','toLowerCase','emit','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','command','write','destroy','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','hangup'];(function(_0x152d5b,_0x3db8e7){var _0x2a9c77=function(_0x204323){while(--_0x204323){_0x152d5b['push'](_0x152d5b['shift']());}};_0x2a9c77(++_0x3db8e7);}(_0xd6bc,0x1a0));var _0xcd6b=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xd6bc[_0x1beef3];return _0x5af964;};'use strict';var util=require(_0xcd6b('0x0'));var _=require(_0xcd6b('0x1'));var EventEmitter=require(_0xcd6b('0x2'))[_0xcd6b('0x3')];var AGIReply=require(_0xcd6b('0x4'));var AGIError=require(_0xcd6b('0x5'));function AGIChannel(_0x53b212){var _0x57a49d=this,_0x78e4d3=new AGIReply(),_0x55fc31=![],_0x50caf4={};EventEmitter[_0xcd6b('0x6')](_0x57a49d);_0x53b212[_0xcd6b('0x7')](_0xcd6b('0x8'));_0x53b212[_0xcd6b('0x9')](0x8*0x3c*0x3c*0x3e8);_0x78e4d3[_0xcd6b('0x7')](_0xcd6b('0x8'));_0x78e4d3['on'](_0xcd6b('0xa'),function(_0x3a2111){for(var _0x2ff2e4 in _0x3a2111){_0x57a49d[_0x2ff2e4]=_0x3a2111[_0x2ff2e4];}_0x57a49d['emit']('ready');});_0x78e4d3['on']('line',function(_0x20cf5a){if(_0x20cf5a[_0xcd6b('0xb')]()=='hangup'){_0x57a49d[_0xcd6b('0xc')]('hangup');return;}if(_0x20cf5a[_0xcd6b('0xd')](0x0,0xb)=='520-Invalid'){_0x55fc31=!![];}if(_0x55fc31){_0x50caf4['rx']+=_0x20cf5a+'\x0a';if(_0x20cf5a[_0xcd6b('0xe')](_0xcd6b('0xf'))!=-0x1){_0x55fc31=![];}}else{_0x50caf4['rx']=_0x20cf5a;}if(_0x55fc31){return;}if(typeof _0x50caf4['cb']==_0xcd6b('0x10')){var _0x263912=_0x50caf4['rx']['substring'](0x0,0x3),_0x4cb87c=null,_0x5c4f06=null;_0x263912=parseInt(_0x263912);if(isNaN(_0x263912)){_0x50caf4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xcd6b('0x11')});return;}if(_0x263912!=0xc8){_0x50caf4['cb'](null,{'code':_0x263912,'result':-0x1,'extra':'KO'});return;}_0x4cb87c=_0x50caf4['rx'][_0xcd6b('0xd')](0x4)[_0xcd6b('0x12')](_0xcd6b('0x13'),'');if(_0x4cb87c['indexOf']('\x20')!=-0x1){_0x4cb87c=_0x4cb87c[_0xcd6b('0x14')](0x0,_0x4cb87c[_0xcd6b('0x15')]('\x20'));}if(_['startsWith'](_0x4cb87c,'-1')){_0x4cb87c=parseInt(_0x4cb87c);}_0x5c4f06=_0x50caf4['rx'][_0xcd6b('0x16')]('\x20');if(_0x5c4f06[_0xcd6b('0x17')]==0x3){_0x5c4f06=_0x5c4f06[0x2][_0xcd6b('0xd')](0x1,_0x5c4f06[0x2][_0xcd6b('0x17')]-0x1);}else if(_0x5c4f06[_0xcd6b('0x17')]>0x3){var _0xdc016f=/\((.+)\)/;var _0x594781=_0x50caf4['rx']['match'](_0xdc016f);if(_0x594781){_0x5c4f06=_0x594781[0x1];}else{_0x5c4f06=null;}}else{_0x5c4f06=null;}_0x50caf4['cb'](null,{'code':_0x263912,'result':_0x4cb87c,'extra':_0x5c4f06});}});_0x53b212['on'](_0xcd6b('0x18'),function(_0x55d18c){_0x57a49d[_0xcd6b('0xc')](_0xcd6b('0x18'),new AGIError(_0xcd6b('0x19'),_0x55d18c[_0xcd6b('0x1a')]));});_0x53b212['on']('close',function(){_0x57a49d[_0xcd6b('0xc')](_0xcd6b('0x1b'),new AGIError(_0xcd6b('0x1c')));});_0x53b212['on'](_0xcd6b('0x1d'),function(){_0x57a49d[_0xcd6b('0xc')](_0xcd6b('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x53b212['destroy']();});_0x53b212['pipe'](_0x78e4d3);this[_0xcd6b('0x1e')]=function(_0x203b8e,_0xe359f3){var _0x203b8e=_0x203b8e||'',_0xe359f3=typeof _0xe359f3==_0xcd6b('0x10')?_0xe359f3:new Function();_0x50caf4={'tx':_0x203b8e,'rx':'','cb':_0xe359f3};_0x53b212[_0xcd6b('0x1f')](_0x203b8e+'\x0a');},this[_0xcd6b('0x1b')]=function(){_0x53b212[_0xcd6b('0x20')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x22')]=function(_0x5c096c){return this['command'][_0xcd6b('0x23')](this,_0x5c096c);};AGIChannel['prototype'][_0xcd6b('0x24')]=function(){return this[_0xcd6b('0x22')]('ANSWER');};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x25')]=function(_0x26dfb8,_0x254b82,_0x2dd9ee){_0x26dfb8=_0x26dfb8===undefined?_0xcd6b('0x26'):_0x26dfb8;_0x254b82=_0x254b82===undefined?'5':_0x254b82;_0x2dd9ee=_0x2dd9ee===undefined?'1':_0x2dd9ee;return this[_0xcd6b('0x22')](util[_0xcd6b('0x27')](_0xcd6b('0x28'),_0x26dfb8,_0x254b82*0x3e8,_0x2dd9ee));};AGIChannel[_0xcd6b('0x21')]['noop']=function(_0x1ce049){_0x1ce049=_0x1ce049||_0xcd6b('0x29');return this['sendRequest'](util[_0xcd6b('0x27')]('VERBOSE\x20\x22%s\x22',_0x1ce049));};AGIChannel['prototype'][_0xcd6b('0x2a')]=function(_0x580985,_0x15a79d){if(_[_0xcd6b('0x2b')](_0x15a79d)){return this[_0xcd6b('0x22')](util['format'](_0xcd6b('0x2c'),_0x580985,_0x15a79d[_0xcd6b('0x2d')](',')));}return this[_0xcd6b('0x22')](util[_0xcd6b('0x27')](_0xcd6b('0x2c'),_0x580985,_0x15a79d));};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x2e')]=function(_0x4de31a){return this[_0xcd6b('0x22')](util['format'](_0xcd6b('0x2f'),_0x4de31a));};AGIChannel['prototype'][_0xcd6b('0x30')]=function(_0x1dccd8){return this['sendRequest'](util[_0xcd6b('0x27')](_0xcd6b('0x31'),_0x1dccd8));};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x32')]=function(_0x595bdb){return this['sendRequest'](util[_0xcd6b('0x27')]('SET\x20PRIORITY\x20%s',_0x595bdb));};AGIChannel['prototype'][_0xcd6b('0x33')]=function(){return this[_0xcd6b('0x22')](_0xcd6b('0x34'));};AGIChannel[_0xcd6b('0x21')]['setVariable']=function(_0x2529d5,_0x1ef667){var _0x4a9cad=_[_0xcd6b('0x35')](_0x1ef667)||_[_0xcd6b('0x36')](_0x1ef667)?_0x1ef667[_0xcd6b('0x37')]():_0x1ef667;return this['sendRequest'](util[_0xcd6b('0x27')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x2529d5,_0x4a9cad?_0x4a9cad[_0xcd6b('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x38')]=function(_0x16ef00,_0x59bfa2){return this['sendRequest'](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x16ef00,_0x59bfa2));};AGIChannel['prototype'][_0xcd6b('0x39')]=function(_0x458aee,_0x5f0846){return this['sendRequest'](util[_0xcd6b('0x27')](_0xcd6b('0x3a'),_0x458aee,_0x5f0846));};AGIChannel['prototype'][_0xcd6b('0x3b')]=function(_0x4fe39b,_0x3b1d5a){return this[_0xcd6b('0x22')](util[_0xcd6b('0x27')](_0xcd6b('0x3c'),_0x4fe39b,_0x3b1d5a));};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x3d')]=function(_0x76b852,_0xc3b20c,_0x35f951){_0xc3b20c=_0xc3b20c||this[_0xcd6b('0x3e')];_0x35f951=_0x35f951||0x1;this[_0xcd6b('0x2e')](_0x76b852);this[_0xcd6b('0x30')](_0xc3b20c);this['setPriority'](_0x35f951);return this[_0xcd6b('0x3f')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x76b852,_0xc3b20c,_0x35f951));};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x40')]=function(_0x28b178){return this[_0xcd6b('0x22')](util[_0xcd6b('0x27')](_0xcd6b('0x41'),_0x28b178));};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x42')]=function(_0x3d865c,_0x39d74e,_0x4f6293,_0x8da2f6,_0x3971e9,_0x44102a){_0x39d74e=_0x39d74e||_0xcd6b('0x43');_0x4f6293=_0x4f6293||'';_0x8da2f6=_0x8da2f6===undefined?-0x1:_0x8da2f6==='-1'?-0x1:_0x8da2f6*0x3e8;_0x3971e9=_0x3971e9===undefined?'':'s='+_0x3971e9;_0x44102a=_0x44102a?'BEEP':'';return this[_0xcd6b('0x22')](util[_0xcd6b('0x27')](_0xcd6b('0x44'),_0x3d865c,_0x39d74e,_0x4f6293,_0x8da2f6,_0x44102a,_0x3971e9));};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x45')]=function(_0xa086ae,_0x48ac8a){_0x48ac8a=_0x48ac8a||'';return this[_0xcd6b('0x22')](util['format'](_0xcd6b('0x46'),_0xa086ae,_0x48ac8a));};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x47')]=function(_0x1a4218){return this[_0xcd6b('0x2a')](_0xcd6b('0x48'),_0x1a4218);};AGIChannel[_0xcd6b('0x21')][_0xcd6b('0x49')]=function(_0x562ee6){return this[_0xcd6b('0x2a')](_0xcd6b('0x4a'),_0x562ee6);};AGIChannel[_0xcd6b('0x21')]['error']=function(_0x9ff0f9,_0x510b89){this[_0xcd6b('0x3f')](util['format'](_0xcd6b('0x4b'),_0x9ff0f9['id'],_0x9ff0f9[_0xcd6b('0x4c')],_0x510b89));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xcd6b('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index bcf18f7..114eeef 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 _0x6c57=['message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply'];(function(_0x3ab6e8,_0x1eaeb6){var _0x54186f=function(_0x290fac){while(--_0x290fac){_0x3ab6e8['push'](_0x3ab6e8['shift']());}};_0x54186f(++_0x1eaeb6);}(_0x6c57,0xc6));var _0x76c5=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x6c57[_0x5c351c];return _0x26f3b3;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x76c5('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x76c5('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x76c5('0x2'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x76c5('0x3'),'E_AGI_SOCKET_TIMEOUT':_0x76c5('0x4'),'E_AGI_COMMAND_EMPTY':_0x76c5('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x76c5('0x6'),'E_AGI_IVR_ENTRY':_0x76c5('0x7')};function AGIError(_0x425f3d){var _0x425f3d=_0x425f3d||null,_0x3cde66=_0x3cde66||[],_0x273b99=0x1,_0x9d5fc3='';if(!error[_0x425f3d]){_0x425f3d=_0x76c5('0x8');}_0x3cde66[_0x76c5('0x9')](error[_0x425f3d]);while(arguments[_0x273b99]){_0x3cde66[_0x76c5('0x9')](arguments[_0x273b99]);_0x273b99++;}_0x9d5fc3=util[_0x76c5('0xa')][_0x76c5('0xb')](util,_0x3cde66);this[_0x76c5('0xc')]=_0x9d5fc3;this[_0x76c5('0xd')]=_0x425f3d;}module[_0x76c5('0xe')]=AGIError; \ No newline at end of file +var _0x7058=['message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0x7058,0x1df));var _0x8705=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x7058[_0x47aa64];return _0x549c7a;};'use strict';var util=require(_0x8705('0x0'));var error={'E_AGI_UNDEFINED':_0x8705('0x1'),'E_AGI_ARGUMENT_PORT':_0x8705('0x2'),'E_AGI_SERVER_ERROR':_0x8705('0x3'),'E_AGI_SERVER_CLOSE':_0x8705('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x8705('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8705('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x8705('0x7'),'E_AGI_COMMAND_EMPTY':_0x8705('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8705('0x9'),'E_AGI_IVR_ENTRY':_0x8705('0xa')};function AGIError(_0x4bbff5){var _0x4bbff5=_0x4bbff5||null,_0x56e0dc=_0x56e0dc||[],_0x528abf=0x1,_0x2a7894='';if(!error[_0x4bbff5]){_0x4bbff5=_0x8705('0xb');}_0x56e0dc[_0x8705('0xc')](error[_0x4bbff5]);while(arguments[_0x528abf]){_0x56e0dc[_0x8705('0xc')](arguments[_0x528abf]);_0x528abf++;}_0x2a7894=util[_0x8705('0xd')]['apply'](util,_0x56e0dc);this[_0x8705('0xe')]=_0x2a7894;this[_0x8705('0xf')]=_0x4bbff5;}module[_0x8705('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 6ec0bb6..a425a7a 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 _0xca74=['defaults','agi','error','E_AGI_SERVER_ERROR','message','parse','emit','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis'];(function(_0x14fb34,_0x174afb){var _0x1ff44d=function(_0x2065a1){while(--_0x2065a1){_0x14fb34['push'](_0x14fb34['shift']());}};_0x1ff44d(++_0x174afb);}(_0xca74,0x1ac));var _0x4ca7=function(_0x208c01,_0x2dd63d){_0x208c01=_0x208c01-0x0;var _0x54a5fc=_0xca74[_0x208c01];return _0x54a5fc;};'use strict';var _=require(_0x4ca7('0x0'));var EventEmitter=require(_0x4ca7('0x1'))[_0x4ca7('0x2')];var Redis=require(_0x4ca7('0x3'));var AGIError=require(_0x4ca7('0x4'));var config=require(_0x4ca7('0x5'));config[_0x4ca7('0x6')]=_[_0x4ca7('0x7')](config[_0x4ca7('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x4ca7('0x6')]);sub['subscribe'](_0x4ca7('0x8'),function(_0x5b6cfc){if(_0x5b6cfc)return eventEmitter['emit'](_0x4ca7('0x9'),new AGIError(_0x4ca7('0xa'),_0x5b6cfc));});sub['on'](_0x4ca7('0xb'),function(_0x566e00,_0x4851c4){if(_0x566e00!=='agi')return;try{var _0x4740d2=JSON[_0x4ca7('0xc')](_0x4851c4);eventEmitter[_0x4ca7('0xd')]('projectUpdate',_0x4740d2);}catch(_0x2c1eae){eventEmitter[_0x4ca7('0xd')]('error',new AGIError(_0x4ca7('0xa'),_0x2c1eae));}});module[_0x4ca7('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x39d4=['emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','error','exports','events','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe','agi'];(function(_0x2934b7,_0x3a094d){var _0x3f8313=function(_0x26ef7e){while(--_0x26ef7e){_0x2934b7['push'](_0x2934b7['shift']());}};_0x3f8313(++_0x3a094d);}(_0x39d4,0x187));var _0x439d=function(_0x16481d,_0x4958f4){_0x16481d=_0x16481d-0x0;var _0x31abbc=_0x39d4[_0x16481d];return _0x31abbc;};'use strict';var _=require('lodash');var EventEmitter=require(_0x439d('0x0'))[_0x439d('0x1')];var Redis=require(_0x439d('0x2'));var AGIError=require(_0x439d('0x3'));var config=require(_0x439d('0x4'));config[_0x439d('0x5')]=_['defaults'](config[_0x439d('0x5')],{'host':_0x439d('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x439d('0x5')]);sub[_0x439d('0x7')](_0x439d('0x8'),function(_0x3f5ea2){if(_0x3f5ea2)return eventEmitter[_0x439d('0x9')]('error',new AGIError(_0x439d('0xa'),_0x3f5ea2));});sub['on'](_0x439d('0xb'),function(_0x1ff6ac,_0x126c92){if(_0x1ff6ac!==_0x439d('0x8'))return;try{var _0x5d1018=JSON[_0x439d('0xc')](_0x126c92);eventEmitter['emit'](_0x439d('0xd'),_0x5d1018);}catch(_0x2b893a){eventEmitter['emit'](_0x439d('0xe'),new AGIError(_0x439d('0xa'),_0x2b893a));}});module[_0x439d('0xf')]={'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 3016a7e..d3b256c 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 _0x2f03=['max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','vswitch','target','default','agicommand','default\x20on\x20switch\x20not\x20found'];(function(_0x22c6f7,_0xb0fc7b){var _0x29015e=function(_0x35d0d9){while(--_0x35d0d9){_0x22c6f7['push'](_0x22c6f7['shift']());}};_0x29015e(++_0xb0fc7b);}(_0x2f03,0x137));var _0x32f0=function(_0x40e0b2,_0x28a9c2){_0x40e0b2=_0x40e0b2-0x0;var _0x5e46a0=_0x2f03[_0x40e0b2];return _0x5e46a0;};'use strict';var _=require(_0x32f0('0x0'));var logger=require(_0x32f0('0x1'))(_0x32f0('0x2'));var verticesWithRetry=['menu',_0x32f0('0x3'),_0x32f0('0x4')];var Graph=function(){this[_0x32f0('0x5')]={};this[_0x32f0('0x6')]={};this[_0x32f0('0x7')]=0x0;};Graph[_0x32f0('0x8')]['addVertex']=function(_0x25962d){this['vertices'][_0x25962d['id']]=_0x25962d;this[_0x32f0('0x6')][_0x25962d['id']]=[];};Graph[_0x32f0('0x8')][_0x32f0('0x9')]=function(_0x2d0716,_0x3be797,_0x34fb1d){this[_0x32f0('0x6')][_0x2d0716][_0x32f0('0xa')]({'target':_0x3be797,'condition':_0x34fb1d});this[_0x32f0('0x7')]+=0x1;};Graph[_0x32f0('0x8')][_0x32f0('0xb')]=function(){return _[_0x32f0('0xb')](this[_0x32f0('0x5')]);};Graph[_0x32f0('0x8')]['relations']=function(){return this['numberOfEdges'];};Graph[_0x32f0('0x8')][_0x32f0('0xc')]=function(_0x48995b){return this['vertices'][_0x48995b];};Graph[_0x32f0('0x8')][_0x32f0('0xd')]=function(_0x44a60f,_0x1f2dae){if(!this['vertices'][_0x44a60f]){return logger['info'](_0x32f0('0xe'));}var _0x40acd6=_0x1f2dae(this[_0x32f0('0x5')][_0x44a60f]);if(!_0x40acd6){return logger[_0x32f0('0xf')](_0x32f0('0x10'));}if(this[_0x32f0('0x6')][_0x44a60f][_0x32f0('0x11')]===0x0){return logger[_0x32f0('0xf')](_0x32f0('0x12'));}for(var _0xf90a71=0x0,_0x4a9729=[],_0xce28eb=![];_0xf90a71\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleUnpublished','initialize','getLicense'];(function(_0x304043,_0x40bffb){var _0x3b8e06=function(_0x42a127){while(--_0x42a127){_0x304043['push'](_0x304043['shift']());}};_0x3b8e06(++_0x40bffb);}(_0x042d,0xdc));var _0xd042=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x042d[_0x2c7dc6];return _0x10002b;};'use strict';var _=require(_0xd042('0x0'));var syncho=require(_0xd042('0x1'));var util=require(_0xd042('0x2'));var config=require(_0xd042('0x3'));var logger=require(_0xd042('0x4'))('agi');var utilLicense=require(_0xd042('0x5'));var rpc=require(_0xd042('0x6'));var Project=require(_0xd042('0x7'));var AGIEmitter=require(_0xd042('0x8'))[_0xd042('0x9')];var projects=[];config[_0xd042('0xa')]=_[_0xd042('0xb')](config[_0xd042('0xa')],{'ip':_0xd042('0xc'),'port':0x11dd});AGIEmitter['on'](_0xd042('0xd'),projectUpdateHandler);function connectionHandler(_0x8b37d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x8b37d);agiHandler(_0x8b37d);}catch(_0x42ffa2){logger[_0xd042('0xe')](_0x42ffa2[_0xd042('0xf')]);}});});}function projectUpdateHandler(_0x23377f){try{var _0x15ec9c=_['findIndex'](projects,['id',_0x23377f['id']]);if(_0x15ec9c>-0x1){if(_0x23377f[_0xd042('0x10')]===!![]){projects['splice'](_0x15ec9c,0x1);}else{projects[_0x15ec9c]=_0x23377f;}}else{projects['push'](_0x23377f);}}catch(_0x214d41){logger[_0xd042('0xe')](_0x214d41['stack']);}}function listeningHandler(){var _0x2f05b3=config[_0xd042('0x11')]===_0xd042('0x12')||![];console[_0xd042('0x13')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xd042('0x14')]);logger[_0xd042('0x15')](util[_0xd042('0x16')](_0xd042('0x17'),_0x2f05b3?config[_0xd042('0xa')]['ip']:_0xd042('0x18'),config[_0xd042('0xa')][_0xd042('0x14')]));}function errorHandler(_0x116d55){if(_0x116d55&&_0x116d55['name']&&_0x116d55[_0xd042('0x19')]){logger['error'](util['format'](_0xd042('0x1a'),_0x116d55[_0xd042('0x1b')],_0x116d55[_0xd042('0x19')]));}else{logger[_0xd042('0xe')](util[_0xd042('0x16')](_0xd042('0x1c'),_0x116d55[_0xd042('0xf')]));}}function closeHandler(){logger[_0xd042('0x15')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd042('0x1d')],this[_0xd042('0x1e')],this[_0xd042('0x1f')],this[_0xd042('0x20')],this[_0xd042('0x21')]));try{createSquareReport(this);}catch(_0x280f10){logger[_0xd042('0xe')](_0x280f10[_0xd042('0xf')]);}}function timeoutHandler(){logger[_0xd042('0x15')](util[_0xd042('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd042('0x1d')],this['calleridname'],this['callerid'],this[_0xd042('0x20')],this[_0xd042('0x21')]));}function hangupHandler(){logger[_0xd042('0x15')](util[_0xd042('0x16')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xd042('0x1e')],this[_0xd042('0x1f')],this[_0xd042('0x20')],this[_0xd042('0x21')]));this['evtHangup']=!![];}function createSquareReport(_0x232038,_0x263f66){rpc[_0xd042('0x22')](_0x232038)['then'](function(_0x33c24f){if(_0x263f66){_0x263f66(null,_0x33c24f);}})['catch'](function(_0x295950){if(_0x263f66){_0x263f66(null,_0x295950);}});}function setChannelVariables(_0x59dd11){for(var _0x53cebf in _0x59dd11){if(_0x59dd11['hasOwnProperty'](_0x53cebf)){if(_0x53cebf[_0xd042('0x23')]('agi_')===0x0){_0x59dd11[_0x53cebf[_0xd042('0x24')](0x4)]=_0x59dd11[_0x53cebf];delete _0x59dd11[_0x53cebf];}}}}function agiHandler(_0x1c0196){logger[_0xd042('0x25')]('variables',JSON['stringify'](_0x1c0196,null,0x2));logger[_0xd042('0x15')](util['format'](_0xd042('0x26'),_0x1c0196[_0xd042('0x1d')],_0x1c0196[_0xd042('0x1e')],_0x1c0196['callerid'],_0x1c0196[_0xd042('0x20')],_0x1c0196[_0xd042('0x21')]));_0x1c0196['on'](_0xd042('0xe'),errorHandler);_0x1c0196['on'](_0xd042('0x27'),closeHandler);_0x1c0196['on'](_0xd042('0x28'),timeoutHandler);_0x1c0196['evtHangup']=![];_0x1c0196['on'](_0xd042('0x29'),hangupHandler);var _0x7e0952=_['find'](projects,[_0xd042('0x1b'),_0x1c0196[_0xd042('0x1d')]]);if(!_0x7e0952)return Project['handleNotFound'](_0x1c0196);if(!_0x7e0952[_0xd042('0x12')])return Project[_0xd042('0x2a')](_0x1c0196);return Project[_0xd042('0x2b')](_0x7e0952,_0x1c0196);}function main(){var _0x1dded3;return utilLicense[_0xd042('0x2c')]()['then'](function(_0x33e992){if(!_0x33e992)return;if(_0x33e992[_0xd042('0x2d')]){if(_0x33e992[_0xd042('0x2e')]&&_0x33e992[_0xd042('0x2e')]>0x0){logger[_0xd042('0x15')](util[_0xd042('0x16')](_0xd042('0x2f'),_0x33e992['callysquare']));_0x1dded3=_0x33e992[_0xd042('0x2e')];}else{logger[_0xd042('0x15')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xd042('0x15')](_0xd042('0x30'));_0x1dded3=-0x1;}})[_0xd042('0x31')](function(){return Project['getAll']();})[_0xd042('0x31')](function(_0x2ba9ab){projects=_0x2ba9ab;return;})[_0xd042('0x32')](function(_0x385693){logger[_0xd042('0xe')]('[LICENSE]',_0x385693[_0xd042('0xf')]);})[_0xd042('0x33')](function(){var _0x17f1b4=require('./server')(config[_0xd042('0xa')][_0xd042('0x14')],config[_0xd042('0xa')]['ip'],_0x1dded3);_0x17f1b4['on'](_0xd042('0xe'),errorHandler);_0x17f1b4['on']('listening',listeningHandler);_0x17f1b4['on'](_0xd042('0x34'),connectionHandler);_0x17f1b4['on'](_0xd042('0x27'),closeHandler);});}main(); \ No newline at end of file +var _0x9f39=['[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','find','handleNotFound','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/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','defaults','127.0.0.1','projectUpdate','error','stack','splice','env','production','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','name','[ERROR]\x20%s'];(function(_0x14909f,_0xe25f2e){var _0x19698c=function(_0x126280){while(--_0x126280){_0x14909f['push'](_0x14909f['shift']());}};_0x19698c(++_0xe25f2e);}(_0x9f39,0xa0));var _0x99f3=function(_0x384e1e,_0xe637b9){_0x384e1e=_0x384e1e-0x0;var _0x14d92c=_0x9f39[_0x384e1e];return _0x14d92c;};'use strict';var _=require(_0x99f3('0x0'));var syncho=require(_0x99f3('0x1'));var util=require(_0x99f3('0x2'));var config=require(_0x99f3('0x3'));var logger=require(_0x99f3('0x4'))(_0x99f3('0x5'));var utilLicense=require(_0x99f3('0x6'));var rpc=require(_0x99f3('0x7'));var Project=require(_0x99f3('0x8'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0x99f3('0x5')]=_[_0x99f3('0x9')](config[_0x99f3('0x5')],{'ip':_0x99f3('0xa'),'port':0x11dd});AGIEmitter['on'](_0x99f3('0xb'),projectUpdateHandler);function connectionHandler(_0x2ff7b2){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2ff7b2);agiHandler(_0x2ff7b2);}catch(_0x1954ac){logger[_0x99f3('0xc')](_0x1954ac[_0x99f3('0xd')]);}});});}function projectUpdateHandler(_0x5c11ec){try{var _0x21ceec=_['findIndex'](projects,['id',_0x5c11ec['id']]);if(_0x21ceec>-0x1){if(_0x5c11ec['deleted']===!![]){projects[_0x99f3('0xe')](_0x21ceec,0x1);}else{projects[_0x21ceec]=_0x5c11ec;}}else{projects['push'](_0x5c11ec);}}catch(_0x655735){logger['error'](_0x655735[_0x99f3('0xd')]);}}function listeningHandler(){var _0x224c4d=config[_0x99f3('0xf')]===_0x99f3('0x10')||![];console[_0x99f3('0x11')](_0x99f3('0x12'),config[_0x99f3('0x5')][_0x99f3('0x13')]);logger[_0x99f3('0x14')](util[_0x99f3('0x15')](_0x99f3('0x16'),_0x224c4d?config[_0x99f3('0x5')]['ip']:'host.docker.internal',config[_0x99f3('0x5')][_0x99f3('0x13')]));}function errorHandler(_0x2605af){if(_0x2605af&&_0x2605af['name']&&_0x2605af['message']){logger[_0x99f3('0xc')](util[_0x99f3('0x15')](_0x99f3('0x17'),_0x2605af[_0x99f3('0x18')],_0x2605af['message']));}else{logger[_0x99f3('0xc')](util[_0x99f3('0x15')](_0x99f3('0x19'),_0x2605af[_0x99f3('0xd')]));}}function closeHandler(){logger[_0x99f3('0x14')](util['format'](_0x99f3('0x1a'),this['arg_1'],this[_0x99f3('0x1b')],this[_0x99f3('0x1c')],this[_0x99f3('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x22543e){logger[_0x99f3('0xc')](_0x22543e['stack']);}}function timeoutHandler(){logger['info'](util[_0x99f3('0x15')](_0x99f3('0x1e'),this[_0x99f3('0x1f')],this[_0x99f3('0x1b')],this[_0x99f3('0x1c')],this[_0x99f3('0x1d')],this[_0x99f3('0x20')]));}function hangupHandler(){logger[_0x99f3('0x14')](util['format'](_0x99f3('0x21'),this[_0x99f3('0x1f')],this['calleridname'],this[_0x99f3('0x1c')],this[_0x99f3('0x1d')],this[_0x99f3('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0x48f01f,_0x149644){rpc[_0x99f3('0x22')](_0x48f01f)[_0x99f3('0x23')](function(_0x5f2f82){if(_0x149644){_0x149644(null,_0x5f2f82);}})[_0x99f3('0x24')](function(_0x12215c){if(_0x149644){_0x149644(null,_0x12215c);}});}function setChannelVariables(_0x429cda){for(var _0x1d4bcc in _0x429cda){if(_0x429cda[_0x99f3('0x25')](_0x1d4bcc)){if(_0x1d4bcc[_0x99f3('0x26')](_0x99f3('0x27'))===0x0){_0x429cda[_0x1d4bcc[_0x99f3('0x28')](0x4)]=_0x429cda[_0x1d4bcc];delete _0x429cda[_0x1d4bcc];}}}}function agiHandler(_0x108689){logger[_0x99f3('0x29')](_0x99f3('0x2a'),JSON[_0x99f3('0x2b')](_0x108689,null,0x2));logger[_0x99f3('0x14')](util[_0x99f3('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x108689[_0x99f3('0x1f')],_0x108689[_0x99f3('0x1b')],_0x108689[_0x99f3('0x1c')],_0x108689[_0x99f3('0x1d')],_0x108689[_0x99f3('0x20')]));_0x108689['on']('error',errorHandler);_0x108689['on'](_0x99f3('0x2c'),closeHandler);_0x108689['on'](_0x99f3('0x2d'),timeoutHandler);_0x108689['evtHangup']=![];_0x108689['on']('hangup',hangupHandler);var _0x25e789=_[_0x99f3('0x2e')](projects,[_0x99f3('0x18'),_0x108689[_0x99f3('0x1f')]]);if(!_0x25e789)return Project[_0x99f3('0x2f')](_0x108689);if(!_0x25e789[_0x99f3('0x10')])return Project[_0x99f3('0x30')](_0x108689);return Project[_0x99f3('0x31')](_0x25e789,_0x108689);}function main(){var _0x3c1def;return utilLicense[_0x99f3('0x32')]()['then'](function(_0x443f42){if(!_0x443f42)return;if(_0x443f42[_0x99f3('0x33')]){if(_0x443f42[_0x99f3('0x34')]&&_0x443f42[_0x99f3('0x34')]>0x0){logger[_0x99f3('0x14')](util[_0x99f3('0x15')](_0x99f3('0x35'),_0x443f42['callysquare']));_0x3c1def=_0x443f42[_0x99f3('0x34')];}else{logger[_0x99f3('0x14')](_0x99f3('0x36'));}}else{logger['info'](_0x99f3('0x37'));_0x3c1def=-0x1;}})[_0x99f3('0x23')](function(){return Project[_0x99f3('0x38')]();})['then'](function(_0x27bc3e){projects=_0x27bc3e;return;})[_0x99f3('0x24')](function(_0xfcd45f){logger[_0x99f3('0xc')](_0x99f3('0x39'),_0xfcd45f[_0x99f3('0xd')]);})[_0x99f3('0x3a')](function(){var _0x5bbf2b=require(_0x99f3('0x3b'))(config[_0x99f3('0x5')][_0x99f3('0x13')],config[_0x99f3('0x5')]['ip'],_0x3c1def);_0x5bbf2b['on'](_0x99f3('0xc'),errorHandler);_0x5bbf2b['on'](_0x99f3('0x3c'),listeningHandler);_0x5bbf2b['on'](_0x99f3('0x3d'),connectionHandler);_0x5bbf2b['on']('close',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 074adc7..87acb0e 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 _0x65f6=['message','catch','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x467436,_0x201bf1){var _0x4d6334=function(_0x579f8e){while(--_0x579f8e){_0x467436['push'](_0x467436['shift']());}};_0x4d6334(++_0x201bf1);}(_0x65f6,0x80));var _0x665f=function(_0x57e496,_0x1fa5e1){_0x57e496=_0x57e496-0x0;var _0x168769=_0x65f6[_0x57e496];return _0x168769;};'use strict';var BPromise=require(_0x665f('0x0'));var jayson=require(_0x665f('0x1'));var client=jayson[_0x665f('0x2')][_0x665f('0x3')]({'port':0x232b});function request(_0x2ae060,_0x2cb8cc){return new BPromise(function(_0x2da693,_0x36bd36){return client[_0x665f('0x4')](_0x2ae060,_0x2cb8cc)[_0x665f('0x5')](function(_0x4568fe){if(_0x4568fe[_0x665f('0x6')]){return _0x36bd36(_0x4568fe[_0x665f('0x6')][_0x665f('0x7')]);}else{return _0x2da693(_0x4568fe['result']);}})[_0x665f('0x8')](function(_0x31ef99){return _0x36bd36(_0x31ef99);});});}exports['sendMailMessage']=function(_0x5cfb8a,_0x548cf0){return request('SendMail',{'account':_0x5cfb8a,'message':_0x548cf0});}; \ No newline at end of file +var _0xf95e=['message','result','sendMailMessage','SendMail','jayson/promise','client','http','request','then','error'];(function(_0x1ff3ec,_0x319426){var _0x5a9385=function(_0x5b44fb){while(--_0x5b44fb){_0x1ff3ec['push'](_0x1ff3ec['shift']());}};_0x5a9385(++_0x319426);}(_0xf95e,0xae));var _0xef95=function(_0x17ce42,_0x376f5d){_0x17ce42=_0x17ce42-0x0;var _0x149b51=_0xf95e[_0x17ce42];return _0x149b51;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xef95('0x0'));var client=jayson[_0xef95('0x1')][_0xef95('0x2')]({'port':0x232b});function request(_0x2554ad,_0x5aea4b){return new BPromise(function(_0xe2fa6,_0x43247d){return client[_0xef95('0x3')](_0x2554ad,_0x5aea4b)[_0xef95('0x4')](function(_0x37c83c){if(_0x37c83c[_0xef95('0x5')]){return _0x43247d(_0x37c83c[_0xef95('0x5')][_0xef95('0x6')]);}else{return _0xe2fa6(_0x37c83c[_0xef95('0x7')]);}})['catch'](function(_0x47dcac){return _0x43247d(_0x47dcac);});});}exports[_0xef95('0x8')]=function(_0x1233c1,_0xa02df0){return request(_0xef95('0x9'),{'account':_0x1233c1,'message':_0xa02df0});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 932a70d..99c480e 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 _0x631c=['moment','xml2json','util','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','omit','hasOwnProperty','length','addEdge','source','target','value','toJson','production','start','debug','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','evtHangup','response','isUndefined','result','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','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash'];(function(_0x230ebb,_0x1609b2){var _0x4b1e42=function(_0x1cd0fc){while(--_0x1cd0fc){_0x230ebb['push'](_0x230ebb['shift']());}};_0x4b1e42(++_0x1609b2);}(_0x631c,0xeb));var _0xc631=function(_0x3212b1,_0x3e9262){_0x3212b1=_0x3212b1-0x0;var _0xc2c9f3=_0x631c[_0x3212b1];return _0xc2c9f3;};'use strict';var _=require(_0xc631('0x0'));var moment=require(_0xc631('0x1'));var parser=require(_0xc631('0x2'));var util=require(_0xc631('0x3'));var logger=require('../../config/logger')('agi');var rpc=require('./rpc');var mailRpc=require(_0xc631('0x4'));var Graph=require(_0xc631('0x5'));var Vertices=require(_0xc631('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xc631('0x7')]()[_0xc631('0x8')](function(_0xd8aae3){logger[_0xc631('0x9')](_0xc631('0xa'),_0xd8aae3[_0xc631('0xb')]);return[];});}function addVertex(_0x54d091,_0x66a492,_0x2762be){_0x66a492[_0xc631('0xc')]=_0x2762be;if(_0x66a492['hasOwnProperty'](_0xc631('0xd'))){_0x66a492['maxRetry']=parseInt(_0x66a492[_0xc631('0xd')],0xa);}_0x54d091['addVertex'](_[_0xc631('0xe')](_0x66a492,'mxCell'));}function initGraph(_0x508765,_0x21057d){var _0x49d175=new Graph();for(var _0xabf7cc in _0x508765){if(_0x508765[_0xc631('0xf')](_0xabf7cc)){if(_['isArray'](_0x508765[_0xabf7cc])){for(var _0x4b590a=0x0;_0x4b590a<_0x508765[_0xabf7cc]['length'];_0x4b590a+=0x1){addVertex(_0x49d175,_0x508765[_0xabf7cc][_0x4b590a],_0xabf7cc);}}else{addVertex(_0x49d175,_0x508765[_0xabf7cc],_0xabf7cc);}}}for(var _0x3d4a80=0x0;_0x3d4a80<_0x21057d[_0xc631('0x10')];_0x3d4a80+=0x1){if(_0x21057d[_0x3d4a80]['source']&&_0x21057d[_0x3d4a80]['target']){_0x49d175[_0xc631('0x11')](_0x21057d[_0x3d4a80][_0xc631('0x12')],_0x21057d[_0x3d4a80][_0xc631('0x13')],_0x21057d[_0x3d4a80][_0xc631('0x14')]);}}return _0x49d175;}function getRoot(_0x5394e6){return parser[_0xc631('0x15')](_0x5394e6,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x527258){return util['inspect'](_0x527258,{'showHidden':![],'depth':null});}function initialize(_0x182893,_0x54a3a8){var _0x25998a=getRoot(_0x182893[_0xc631('0x16')]);if(!_0x25998a||!_0x25998a[_0xc631('0x17')])return;var _0x523c76,_0x2dd7b,_0x4f193a;logger[_0xc631('0x18')]('root',JSON['stringify'](_0x25998a,null,0x2));_0x54a3a8['joinAt']=moment()[_0xc631('0x19')](_0xc631('0x1a'));_0x523c76=initGraph(_[_0xc631('0xe')](_0x25998a,_0xc631('0x1b')),_0x25998a['mxCell']);_0x2dd7b=new Vertices(_0x54a3a8,rpc,mailRpc);logger[_0xc631('0x1c')](util[_0xc631('0x19')](_0xc631('0x1d'),_0x54a3a8[_0xc631('0x1e')],_0x54a3a8[_0xc631('0x1f')],_0x54a3a8[_0xc631('0x20')],_0x54a3a8['dnid'],_0x54a3a8[_0xc631('0x21')]));_0x523c76[_0xc631('0x22')](_0x25998a[_0xc631('0x17')]['id'],function(_0xddd771){try{_0xddd771=_0x2dd7b[_0xc631('0x23')](_0xddd771);logger[_0xc631('0x18')](_0xc631('0x24'),JSON[_0xc631('0x25')](_0xddd771,null,0x2));if(_0xddd771[_0xc631('0xc')]===_0xc631('0x26')){logger[_0xc631('0x1c')](_0xc631('0x27'));_0x54a3a8[_0xc631('0x28')]=_0xddd771['context']||_0x54a3a8[_0xc631('0x28')];_0x54a3a8[_0xc631('0x29')]=_0xddd771['extension'];_0x54a3a8[_0xc631('0x2a')]=_0xddd771[_0xc631('0x2a')]?_0xddd771[_0xc631('0x2a')]-0x1:0x1;return null;}else if(_0xddd771&&_0x2dd7b[_0xddd771['agicommand']]){_0x4f193a=_0x2dd7b[_0xddd771[_0xc631('0xc')]](_0xddd771);logger[_0xc631('0x1c')]('response',JSON[_0xc631('0x25')](_0x4f193a,null,0x2));if(_0x4f193a&&_0x4f193a[_0xc631('0x2b')]===AGI_CODE_SUCCESS&&_0x4f193a['result']!==AGI_RESULT_ERROR&&!_0x54a3a8[_0xc631('0x2c')]){logger[_0xc631('0x18')](_0xc631('0x2d'),inspect(_0x4f193a));return _[_0xc631('0x2e')](_0x4f193a['result'])?null:_0x4f193a[_0xc631('0x2f')][_0xc631('0x30')]();}else{logger[_0xc631('0x9')](_0xc631('0x2d'),inspect(_0x4f193a));return null;}}else{logger[_0xc631('0x9')](_0xc631('0x31'));return null;}}catch(_0x31ddb5){logger[_0xc631('0x9')](_0x31ddb5['stack']);return null;}});if(_0x25998a[_0xc631('0x32')]){logger[_0xc631('0x1c')](util[_0xc631('0x19')](_0xc631('0x33'),_0x54a3a8[_0xc631('0x1e')],_0x54a3a8['calleridname'],_0x54a3a8[_0xc631('0x20')],_0x54a3a8[_0xc631('0x34')],_0x54a3a8[_0xc631('0x21')]));_0x523c76[_0xc631('0x22')](_0x25998a['finally']['id'],function(_0x8bdd69){try{_0x8bdd69=_0x2dd7b[_0xc631('0x23')](_0x8bdd69);logger['debug']('vertex',JSON[_0xc631('0x25')](_0x8bdd69,null,0x2));if(_0x8bdd69&&_0x2dd7b[_0x8bdd69[_0xc631('0xc')]]){_0x4f193a=_0x2dd7b[_0x8bdd69[_0xc631('0xc')]](_0x8bdd69);if(_0x4f193a){logger['debug'](_0xc631('0x2d'),inspect(_0x4f193a));return _[_0xc631('0x2e')](_0x4f193a[_0xc631('0x2f')])?null:_0x4f193a[_0xc631('0x2f')][_0xc631('0x30')]();}else{logger[_0xc631('0x9')](_0xc631('0x2d'),inspect(_0x4f193a));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x5fb713){logger['error'](_0x5fb713[_0xc631('0xb')]);return null;}});}logger['info'](util[_0xc631('0x19')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x54a3a8['arg_1'],_0x54a3a8['calleridname'],_0x54a3a8[_0xc631('0x20')],_0x54a3a8[_0xc631('0x34')],_0x54a3a8[_0xc631('0x21')]));logger[_0xc631('0x1c')](util['format'](_0xc631('0x35'),_0x54a3a8['context'],_0x54a3a8[_0xc631('0x29')],parseInt(_0x54a3a8[_0xc631('0x2a')],0xa)+0x1));_0x54a3a8[_0xc631('0x36')](_0x54a3a8[_0xc631('0x28')],_0x54a3a8['extension'],parseInt(_0x54a3a8[_0xc631('0x2a')],0xa)+0x1);_0x54a3a8[_0xc631('0x37')]();}function handleNotFound(_0x12d668){logger[_0xc631('0x9')](util[_0xc631('0x19')](_0xc631('0x38'),_0x12d668[_0xc631('0x1e')]));_0x12d668[_0xc631('0x36')](_0x12d668['context'],_0x12d668[_0xc631('0x29')],parseInt(_0x12d668['priority'],0xa)+0x1);_0x12d668[_0xc631('0x37')]();}function handleUnpublished(_0x47b888){logger[_0xc631('0x9')](util[_0xc631('0x19')](_0xc631('0x39'),_0x47b888[_0xc631('0x1e')]));_0x47b888[_0xc631('0x36')](_0x47b888[_0xc631('0x28')],_0x47b888[_0xc631('0x29')],parseInt(_0x47b888[_0xc631('0x2a')],0xa)+0x1);_0x47b888['close']();}module[_0xc631('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x0eda=['Project\x20%s\x20not\x20published','lodash','util','./rpc','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','stringify','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0eda,0x75));var _0xa0ed=function(_0x300a67,_0x3f4577){_0x300a67=_0x300a67-0x0;var _0x2b5b5f=_0x0eda[_0x300a67];return _0x2b5b5f;};'use strict';var _=require(_0xa0ed('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require(_0xa0ed('0x1'));var logger=require('../../config/logger')('agi');var rpc=require(_0xa0ed('0x2'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xa0ed('0x3'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xa0ed('0x4')](function(_0x1f73a6){logger[_0xa0ed('0x5')](_0xa0ed('0x6'),_0x1f73a6[_0xa0ed('0x7')]);return[];});}function addVertex(_0x553990,_0x1e501c,_0x348e54){_0x1e501c['agicommand']=_0x348e54;if(_0x1e501c[_0xa0ed('0x8')](_0xa0ed('0x9'))){_0x1e501c[_0xa0ed('0xa')]=parseInt(_0x1e501c['retry'],0xa);}_0x553990[_0xa0ed('0xb')](_['omit'](_0x1e501c,_0xa0ed('0xc')));}function initGraph(_0x2dcdf8,_0x2c0073){var _0x597781=new Graph();for(var _0x2cab2b in _0x2dcdf8){if(_0x2dcdf8['hasOwnProperty'](_0x2cab2b)){if(_[_0xa0ed('0xd')](_0x2dcdf8[_0x2cab2b])){for(var _0x4f97cf=0x0;_0x4f97cf<_0x2dcdf8[_0x2cab2b][_0xa0ed('0xe')];_0x4f97cf+=0x1){addVertex(_0x597781,_0x2dcdf8[_0x2cab2b][_0x4f97cf],_0x2cab2b);}}else{addVertex(_0x597781,_0x2dcdf8[_0x2cab2b],_0x2cab2b);}}}for(var _0x2f1bc5=0x0;_0x2f1bc5<_0x2c0073[_0xa0ed('0xe')];_0x2f1bc5+=0x1){if(_0x2c0073[_0x2f1bc5]['source']&&_0x2c0073[_0x2f1bc5][_0xa0ed('0xf')]){_0x597781[_0xa0ed('0x10')](_0x2c0073[_0x2f1bc5]['source'],_0x2c0073[_0x2f1bc5][_0xa0ed('0xf')],_0x2c0073[_0x2f1bc5][_0xa0ed('0x11')]);}}return _0x597781;}function getRoot(_0x4d8f60){return parser[_0xa0ed('0x12')](_0x4d8f60,{'object':!![]})[_0xa0ed('0x13')][_0xa0ed('0x14')];}function inspect(_0x2a5e0f){return util[_0xa0ed('0x15')](_0x2a5e0f,{'showHidden':![],'depth':null});}function initialize(_0x38026f,_0x1c6871){var _0x38c6bc=getRoot(_0x38026f[_0xa0ed('0x16')]);if(!_0x38c6bc||!_0x38c6bc[_0xa0ed('0x17')])return;var _0x23281b,_0x5536d2,_0x599732;logger[_0xa0ed('0x18')](_0xa0ed('0x14'),JSON['stringify'](_0x38c6bc,null,0x2));_0x1c6871[_0xa0ed('0x19')]=moment()[_0xa0ed('0x1a')](_0xa0ed('0x1b'));_0x23281b=initGraph(_[_0xa0ed('0x1c')](_0x38c6bc,_0xa0ed('0xc')),_0x38c6bc[_0xa0ed('0xc')]);_0x5536d2=new Vertices(_0x1c6871,rpc,mailRpc);logger[_0xa0ed('0x1d')](util[_0xa0ed('0x1a')](_0xa0ed('0x1e'),_0x1c6871[_0xa0ed('0x1f')],_0x1c6871[_0xa0ed('0x20')],_0x1c6871[_0xa0ed('0x21')],_0x1c6871[_0xa0ed('0x22')],_0x1c6871[_0xa0ed('0x23')]));_0x23281b[_0xa0ed('0x24')](_0x38c6bc[_0xa0ed('0x17')]['id'],function(_0x6594d1){try{_0x6594d1=_0x5536d2[_0xa0ed('0x25')](_0x6594d1);logger[_0xa0ed('0x18')]('vertex',JSON[_0xa0ed('0x26')](_0x6594d1,null,0x2));if(_0x6594d1[_0xa0ed('0x27')]==='gotoc'){logger[_0xa0ed('0x1d')](_0xa0ed('0x28'));_0x1c6871[_0xa0ed('0x29')]=_0x6594d1['context']||_0x1c6871[_0xa0ed('0x29')];_0x1c6871[_0xa0ed('0x2a')]=_0x6594d1['extension'];_0x1c6871[_0xa0ed('0x2b')]=_0x6594d1[_0xa0ed('0x2b')]?_0x6594d1[_0xa0ed('0x2b')]-0x1:0x1;return null;}else if(_0x6594d1&&_0x5536d2[_0x6594d1['agicommand']]){_0x599732=_0x5536d2[_0x6594d1[_0xa0ed('0x27')]](_0x6594d1);logger['info'](_0xa0ed('0x2c'),JSON[_0xa0ed('0x26')](_0x599732,null,0x2));if(_0x599732&&_0x599732[_0xa0ed('0x2d')]===AGI_CODE_SUCCESS&&_0x599732['result']!==AGI_RESULT_ERROR&&!_0x1c6871[_0xa0ed('0x2e')]){logger['debug'](_0xa0ed('0x2c'),inspect(_0x599732));return _[_0xa0ed('0x2f')](_0x599732[_0xa0ed('0x30')])?null:_0x599732[_0xa0ed('0x30')][_0xa0ed('0x31')]();}else{logger[_0xa0ed('0x5')]('response',inspect(_0x599732));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x19a01c){logger[_0xa0ed('0x5')](_0x19a01c[_0xa0ed('0x7')]);return null;}});if(_0x38c6bc[_0xa0ed('0x32')]){logger[_0xa0ed('0x1d')](util[_0xa0ed('0x1a')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1c6871[_0xa0ed('0x1f')],_0x1c6871[_0xa0ed('0x20')],_0x1c6871[_0xa0ed('0x21')],_0x1c6871['dnid'],_0x1c6871[_0xa0ed('0x23')]));_0x23281b['traverseBFS'](_0x38c6bc['finally']['id'],function(_0x537a02){try{_0x537a02=_0x5536d2[_0xa0ed('0x25')](_0x537a02);logger[_0xa0ed('0x18')](_0xa0ed('0x33'),JSON['stringify'](_0x537a02,null,0x2));if(_0x537a02&&_0x5536d2[_0x537a02[_0xa0ed('0x27')]]){_0x599732=_0x5536d2[_0x537a02[_0xa0ed('0x27')]](_0x537a02);if(_0x599732){logger[_0xa0ed('0x18')]('response',inspect(_0x599732));return _['isUndefined'](_0x599732[_0xa0ed('0x30')])?null:_0x599732['result'][_0xa0ed('0x31')]();}else{logger[_0xa0ed('0x5')](_0xa0ed('0x2c'),inspect(_0x599732));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x3b6e7f){logger[_0xa0ed('0x5')](_0x3b6e7f[_0xa0ed('0x7')]);return null;}});}logger[_0xa0ed('0x1d')](util[_0xa0ed('0x1a')](_0xa0ed('0x34'),_0x1c6871[_0xa0ed('0x1f')],_0x1c6871[_0xa0ed('0x20')],_0x1c6871[_0xa0ed('0x21')],_0x1c6871['dnid'],_0x1c6871[_0xa0ed('0x23')]));logger['info'](util[_0xa0ed('0x1a')](_0xa0ed('0x35'),_0x1c6871[_0xa0ed('0x29')],_0x1c6871[_0xa0ed('0x2a')],parseInt(_0x1c6871[_0xa0ed('0x2b')],0xa)+0x1));_0x1c6871[_0xa0ed('0x36')](_0x1c6871['context'],_0x1c6871[_0xa0ed('0x2a')],parseInt(_0x1c6871[_0xa0ed('0x2b')],0xa)+0x1);_0x1c6871[_0xa0ed('0x37')]();}function handleNotFound(_0x184854){logger[_0xa0ed('0x5')](util[_0xa0ed('0x1a')](_0xa0ed('0x38'),_0x184854[_0xa0ed('0x1f')]));_0x184854[_0xa0ed('0x36')](_0x184854['context'],_0x184854[_0xa0ed('0x2a')],parseInt(_0x184854[_0xa0ed('0x2b')],0xa)+0x1);_0x184854[_0xa0ed('0x37')]();}function handleUnpublished(_0x511eb1){logger[_0xa0ed('0x5')](util['format'](_0xa0ed('0x39'),_0x511eb1[_0xa0ed('0x1f')]));_0x511eb1[_0xa0ed('0x36')](_0x511eb1[_0xa0ed('0x29')],_0x511eb1['extension'],parseInt(_0x511eb1[_0xa0ed('0x2b')],0xa)+0x1);_0x511eb1[_0xa0ed('0x37')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6c728e4..d1e9fdd 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 _0x3436=['_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','util','stream','Transform','call'];(function(_0x132e49,_0x3f04be){var _0x88b9ff=function(_0x387e34){while(--_0x387e34){_0x132e49['push'](_0x132e49['shift']());}};_0x88b9ff(++_0x3f04be);}(_0x3436,0x1b6));var _0x6343=function(_0x22a58f,_0x4b7ee3){_0x22a58f=_0x22a58f-0x0;var _0x3cc8a3=_0x3436[_0x22a58f];return _0x3cc8a3;};'use strict';var util=require(_0x6343('0x0'));var Transform=require(_0x6343('0x1'))[_0x6343('0x2')];function AGIReply(_0x3ddd3b){Transform[_0x6343('0x3')](this,_0x3ddd3b);this[_0x6343('0x4')]='';this[_0x6343('0x5')]=![];}util[_0x6343('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x2d7e6c,_0x19c4db,_0x5c1c3a){var _0x473b1d='\x0a',_0x16d117=['\x0a\x0a',_0x6343('0x7')],_0x2f658e=-0x1,_0x313ee5=-0x1,_0x1832bd='',_0xf57b31=0x0,_0x1d8b8c='',_0x47356c='';this[_0x6343('0x4')]+=_0x2d7e6c[_0x6343('0x8')]();_0x1d8b8c=this[_0x6343('0x4')];if(!this[_0x6343('0x5')]){_0xf57b31=0x0;while(_0x16d117[_0xf57b31]){while((_0x313ee5=_0x1d8b8c[_0x6343('0x9')](_0x16d117[_0xf57b31]))!=-0x1){_0x1832bd=_0x16d117[_0xf57b31];_0x47356c=_0x1d8b8c[_0x6343('0xa')](0x0,_0x313ee5);_0x1d8b8c=_0x1d8b8c[_0x6343('0xa')](_0x313ee5+_0x1832bd[_0x6343('0xb')]);var _0x27c2d3=_0x47356c[_0x6343('0xc')](_0x473b1d),_0x114ebf=0x0,_0x1f38fe={},_0x4d530c='',_0x5aedca='',_0x378abf=-0x1;while(_0x27c2d3[_0x114ebf]){_0x378abf=_0x27c2d3[_0x114ebf]['indexOf'](':');if(_0x378abf!=-0x1){_0x4d530c=_0x27c2d3[_0x114ebf]['slice'](0x0,_0x378abf)['trim']();_0x5aedca=_0x27c2d3[_0x114ebf][_0x6343('0xd')](_0x378abf+0x1)[_0x6343('0xe')]();if(_0x4d530c[_0x6343('0xb')]>0x0){_0x1f38fe[_0x4d530c]=_0x5aedca;}}else{}_0x114ebf++;}this[_0x6343('0xf')](_0x6343('0x10'),_0x1f38fe);this[_0x6343('0x5')]=!![];}_0xf57b31++;}this[_0x6343('0x4')]=_0x1d8b8c;}else{while((_0x2f658e=_0x1d8b8c[_0x6343('0x9')](_0x473b1d))!=-0x1){_0x47356c=_0x1d8b8c[_0x6343('0xa')](0x0,_0x2f658e);this[_0x6343('0xf')]('line',_0x47356c);_0x1d8b8c=_0x1d8b8c[_0x6343('0xa')](_0x2f658e+_0x473b1d['length']);}this[_0x6343('0x4')]=_0x1d8b8c;}_0x5c1c3a();};module['exports']=AGIReply; \ No newline at end of file +var _0xe791=['toString','indexOf','length','trim','emit','headers','substring','exports','util','stream','Transform','call','_localBuffer','_inBody','prototype'];(function(_0x24a09b,_0x3a3b1f){var _0xb74413=function(_0x542a1c){while(--_0x542a1c){_0x24a09b['push'](_0x24a09b['shift']());}};_0xb74413(++_0x3a3b1f);}(_0xe791,0x161));var _0x1e79=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe791[_0x199572];return _0x13cfa3;};'use strict';var util=require(_0x1e79('0x0'));var Transform=require(_0x1e79('0x1'))[_0x1e79('0x2')];function AGIReply(_0x896548){Transform[_0x1e79('0x3')](this,_0x896548);this[_0x1e79('0x4')]='';this[_0x1e79('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x1e79('0x6')]['_transform']=function(_0x2c503d,_0x3b8773,_0x462a79){var _0x1c3d03='\x0a',_0x381c3d=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3d7ec3=-0x1,_0x430bc5=-0x1,_0x370a84='',_0x1f0282=0x0,_0x2f80f9='',_0x17fe02='';this['_localBuffer']+=_0x2c503d[_0x1e79('0x7')]();_0x2f80f9=this[_0x1e79('0x4')];if(!this['_inBody']){_0x1f0282=0x0;while(_0x381c3d[_0x1f0282]){while((_0x430bc5=_0x2f80f9[_0x1e79('0x8')](_0x381c3d[_0x1f0282]))!=-0x1){_0x370a84=_0x381c3d[_0x1f0282];_0x17fe02=_0x2f80f9['substring'](0x0,_0x430bc5);_0x2f80f9=_0x2f80f9['substring'](_0x430bc5+_0x370a84[_0x1e79('0x9')]);var _0x3790fc=_0x17fe02['split'](_0x1c3d03),_0x49e852=0x0,_0x191bce={},_0x256c11='',_0x1fef89='',_0x1f2cbd=-0x1;while(_0x3790fc[_0x49e852]){_0x1f2cbd=_0x3790fc[_0x49e852][_0x1e79('0x8')](':');if(_0x1f2cbd!=-0x1){_0x256c11=_0x3790fc[_0x49e852]['slice'](0x0,_0x1f2cbd)[_0x1e79('0xa')]();_0x1fef89=_0x3790fc[_0x49e852]['slice'](_0x1f2cbd+0x1)['trim']();if(_0x256c11[_0x1e79('0x9')]>0x0){_0x191bce[_0x256c11]=_0x1fef89;}}else{}_0x49e852++;}this[_0x1e79('0xb')](_0x1e79('0xc'),_0x191bce);this['_inBody']=!![];}_0x1f0282++;}this[_0x1e79('0x4')]=_0x2f80f9;}else{while((_0x3d7ec3=_0x2f80f9['indexOf'](_0x1c3d03))!=-0x1){_0x17fe02=_0x2f80f9[_0x1e79('0xd')](0x0,_0x3d7ec3);this[_0x1e79('0xb')]('line',_0x17fe02);_0x2f80f9=_0x2f80f9[_0x1e79('0xd')](_0x3d7ec3+_0x1c3d03[_0x1e79('0x9')]);}this[_0x1e79('0x4')]=_0x2f80f9;}_0x462a79();};module[_0x1e79('0xe')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 253e18b..b6b71a3 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 _0xfa2b=['getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','message','result','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','dsn','getUserById','ShowUser'];(function(_0x214648,_0x16265d){var _0x520e6f=function(_0x3af627){while(--_0x3af627){_0x214648['push'](_0x214648['shift']());}};_0x520e6f(++_0x16265d);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x23ef99,_0x43cd61){_0x23ef99=_0x23ef99-0x0;var _0x2680a8=_0xfa2b[_0x23ef99];return _0x2680a8;};'use strict';var _=require(_0xbfa2('0x0'));var moment=require(_0xbfa2('0x1'));var jayson=require(_0xbfa2('0x2'));var client=jayson[_0xbfa2('0x3')][_0xbfa2('0x4')]({'port':0x2329});function request(_0x41d712,_0xa0aa2f){return new Promise(function(_0x1103cf,_0x116ab4){return client[_0xbfa2('0x5')](_0x41d712,_0xa0aa2f)[_0xbfa2('0x6')](function(_0x2e8f3b){if(_0x2e8f3b[_0xbfa2('0x7')]){return _0x116ab4(_0x2e8f3b[_0xbfa2('0x7')][_0xbfa2('0x8')]);}else{return _0x1103cf(_0x2e8f3b[_0xbfa2('0x9')]);}})['catch'](function(_0x46a151){return _0x116ab4(_0x46a151);});});}exports['getSquareProjects']=function(){return request(_0xbfa2('0xa'),{'options':{'raw':![],'attributes':['id',_0xbfa2('0xb'),_0xbfa2('0xc')]}});};exports[_0xbfa2('0xd')]=function(_0x35ad85){return request(_0xbfa2('0xe'),{'options':{'raw':![],'where':{'name':_0x35ad85},'attributes':[_0xbfa2('0xc')]}});};exports[_0xbfa2('0xf')]=function(_0xbcc412){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0xbcc412},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xbfa2('0x10'),'as':_0xbfa2('0x10')}]}],'attributes':['id',_0xbfa2('0xb'),_0xbfa2('0x11')],'smtp':!![]}});};exports[_0xbfa2('0x12')]=function(_0xd9bec2){return request('ShowSquareProject',{'options':{'where':{'id':_0xd9bec2},'attributes':[_0xbfa2('0xb')]}});};exports[_0xbfa2('0x13')]=function(_0x458653){return request(_0xbfa2('0x14'),{'options':{'where':{'id':_0x458653},'attributes':[_0xbfa2('0xb')]}});};exports['getVariableById']=function(_0xa988cc){return request('ShowVariable',{'options':{'where':{'id':_0xa988cc},'attributes':['name']}});};exports[_0xbfa2('0x15')]=function(_0x55c9fe){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x55c9fe},'attributes':[_0xbfa2('0x16')]}});};exports[_0xbfa2('0x17')]=function(_0x54cdb2){return request(_0xbfa2('0x18'),{'options':{'where':{'id':_0x54cdb2},'attributes':[_0xbfa2('0xb')]}});};exports[_0xbfa2('0x19')]=function(_0x4088c5){return request(_0xbfa2('0x1a'),{'options':{'where':{'phone':_0x4088c5[_0xbfa2('0x1b')]},'attributes':['id']}});};exports[_0xbfa2('0x1c')]=function(_0x5c3123){return request(_0xbfa2('0x1d'),{'options':{'where':{'id':_0x5c3123},'attributes':[_0xbfa2('0xb')]}});};exports[_0xbfa2('0x1e')]=function(_0x479af0){return request(_0xbfa2('0x1f'),{'options':{'where':{'id':_0x479af0},'attributes':[_0xbfa2('0x20')]}});};exports['getIntervalById']=function(_0xd5760d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0xd5760d},'include':[{'model':'Interval','as':_0xbfa2('0x21')}]}});};exports[_0xbfa2('0x22')]=function(_0x1ec19f){return request(_0xbfa2('0x23'),{'options':{'where':{'id':_0x1ec19f},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x599df2){return request(_0xbfa2('0x24'),{'body':_0x599df2});};exports['createSquareDetailsReport']=function(_0x1a5249){return request('CreateSquareDetailsReport',{'body':_0x1a5249});};exports[_0xbfa2('0x25')]=function(_0x4db5af){return request(_0xbfa2('0x26'),{'body':_[_0xbfa2('0x27')](_0x4db5af,{'project_name':_0x4db5af[_0xbfa2('0x28')],'prev_project_name':_0x4db5af[_0xbfa2('0x29')]||'','is_subproject':_0x4db5af[_0xbfa2('0x29')]?!![]:![],'leaveAt':moment()['format'](_0xbfa2('0x2a'))})});};exports[_0xbfa2('0x2b')]=function(_0x4f782b){return request(_0xbfa2('0x2c'),{'body':_0x4f782b});};exports[_0xbfa2('0x2d')]=function(_0x4ccdb5){return request(_0xbfa2('0x2e'),{'body':_0x4ccdb5});};exports['createCmContact']=function(_0x16bc84){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x16bc84[_0xbfa2('0x1b')],'ListId':_0x16bc84[_0xbfa2('0x2f')]}}})[_0xbfa2('0x6')](function(_0x33e5af){if(_0x33e5af){return _0x33e5af;}return request('CreateCmContact',{'body':_0x16bc84});});};exports[_0xbfa2('0x30')]=function(_0x4aac4e){return request(_0xbfa2('0x31'),{'options':{'where':{'id':_0x4aac4e},'attributes':[_0xbfa2('0xb')]}});};exports[_0xbfa2('0x32')]=function(_0x5e3831,_0x1b8fe6){return request(_0xbfa2('0x33'),{'body':{'interface':_0x1b8fe6},'options':{'where':_0x5e3831}});};exports[_0xbfa2('0x34')]=function(_0x5db6ae,_0x47fd5a,_0x5aa051){return request(_0xbfa2('0x35'),{'body':{'type':_0x47fd5a,'uniqueid':_0x5aa051},'options':{'where':_0x5db6ae}});};exports[_0xbfa2('0x36')]=function(_0x55e318){return request(_0xbfa2('0x37'),{'body':{},'options':{'where':_0x55e318}});};exports[_0xbfa2('0x38')]=function(_0x39d1ce){return request(_0xbfa2('0x39'),{'body':{},'options':{'where':_0x39d1ce}});}; \ No newline at end of file +var _0x0506=['save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','lodash','moment','jayson/promise','request','error','message','result','catch','getSquareProjects','GetSquareProjects','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','phone','getSoundById'];(function(_0x2daddd,_0x1f6d29){var _0x5ed9bd=function(_0x38510b){while(--_0x38510b){_0x2daddd['push'](_0x2daddd['shift']());}};_0x5ed9bd(++_0x1f6d29);}(_0x0506,0x1d1));var _0x6050=function(_0x5ce015,_0x455ecd){_0x5ce015=_0x5ce015-0x0;var _0x352ed5=_0x0506[_0x5ce015];return _0x352ed5;};'use strict';var _=require(_0x6050('0x0'));var moment=require(_0x6050('0x1'));var jayson=require(_0x6050('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x5139c7,_0x49a1ca){return new Promise(function(_0x229b5f,_0x58e2a9){return client[_0x6050('0x3')](_0x5139c7,_0x49a1ca)['then'](function(_0x57de09){if(_0x57de09[_0x6050('0x4')]){return _0x58e2a9(_0x57de09[_0x6050('0x4')][_0x6050('0x5')]);}else{return _0x229b5f(_0x57de09[_0x6050('0x6')]);}})[_0x6050('0x7')](function(_0xf64de5){return _0x58e2a9(_0xf64de5);});});}exports[_0x6050('0x8')]=function(){return request(_0x6050('0x9'),{'options':{'raw':![],'attributes':['id','name',_0x6050('0xa')]}});};exports['getSquareProject']=function(_0x15ad99){return request(_0x6050('0xb'),{'options':{'raw':![],'where':{'name':_0x15ad99},'attributes':[_0x6050('0xa')]}});};exports[_0x6050('0xc')]=function(_0x35c0c0){return request(_0x6050('0xd'),{'options':{'raw':![],'where':{'id':_0x35c0c0},'include':[{'model':_0x6050('0xe'),'as':_0x6050('0xf'),'include':[{'model':_0x6050('0x10'),'as':_0x6050('0x10')}]}],'attributes':['id','name',_0x6050('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x2fbd8a){return request(_0x6050('0xb'),{'options':{'where':{'id':_0x2fbd8a},'attributes':[_0x6050('0x12')]}});};exports[_0x6050('0x13')]=function(_0x4b5503){return request(_0x6050('0x14'),{'options':{'where':{'id':_0x4b5503},'attributes':['name']}});};exports[_0x6050('0x15')]=function(_0x2229f5){return request(_0x6050('0x16'),{'options':{'where':{'id':_0x2229f5},'attributes':[_0x6050('0x12')]}});};exports[_0x6050('0x17')]=function(_0x25976e){return request(_0x6050('0x18'),{'options':{'where':{'id':_0x25976e},'attributes':[_0x6050('0x19')]}});};exports[_0x6050('0x1a')]=function(_0x1d1bfa){return request(_0x6050('0x1b'),{'options':{'where':{'id':_0x1d1bfa},'attributes':[_0x6050('0x12')]}});};exports['getContactByPhone']=function(_0x1dd507){return request(_0x6050('0x1c'),{'options':{'where':{'phone':_0x1dd507[_0x6050('0x1d')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x4ed245){return request('ShowTrunk',{'options':{'where':{'id':_0x4ed245},'attributes':['name']}});};exports[_0x6050('0x1e')]=function(_0x259e5f){return request('ShowSound',{'options':{'where':{'id':_0x259e5f},'attributes':[_0x6050('0x1f')]}});};exports[_0x6050('0x20')]=function(_0x354ced){return request(_0x6050('0x21'),{'options':{'raw':![],'where':{'id':_0x354ced},'include':[{'model':_0x6050('0x22'),'as':_0x6050('0x23')}]}});};exports['getSmsAccountById']=function(_0x3b6e2f){return request(_0x6050('0x24'),{'options':{'where':{'id':_0x3b6e2f},'attributes':['id',_0x6050('0x12')]}});};exports[_0x6050('0x25')]=function(_0x19602f){return request(_0x6050('0x26'),{'body':_0x19602f});};exports[_0x6050('0x27')]=function(_0x238a73){return request('CreateSquareDetailsReport',{'body':_0x238a73});};exports[_0x6050('0x28')]=function(_0x48d9fd){return request(_0x6050('0x29'),{'body':_[_0x6050('0x2a')](_0x48d9fd,{'project_name':_0x48d9fd[_0x6050('0x2b')],'prev_project_name':_0x48d9fd[_0x6050('0x2c')]||'','is_subproject':_0x48d9fd[_0x6050('0x2c')]?!![]:![],'leaveAt':moment()[_0x6050('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x6050('0x2e')]=function(_0x436d39){return request(_0x6050('0x2f'),{'body':_0x436d39});};exports[_0x6050('0x30')]=function(_0x526877){return request(_0x6050('0x31'),{'body':_0x526877});};exports[_0x6050('0x32')]=function(_0x1698fa){return request(_0x6050('0x33'),{'options':{'raw':![],'where':{'phone':_0x1698fa[_0x6050('0x1d')],'ListId':_0x1698fa[_0x6050('0x34')]}}})[_0x6050('0x35')](function(_0x4e3393){if(_0x4e3393){return _0x4e3393;}return request(_0x6050('0x36'),{'body':_0x1698fa});});};exports[_0x6050('0x37')]=function(_0x231947){return request(_0x6050('0x38'),{'options':{'where':{'id':_0x231947},'attributes':[_0x6050('0x12')]}});};exports[_0x6050('0x39')]=function(_0x2a5313,_0x412279){return request(_0x6050('0x3a'),{'body':{'interface':_0x412279},'options':{'where':_0x2a5313}});};exports['agentPause']=function(_0xa85eb9,_0x5c6e90,_0x5542fa){return request(_0x6050('0x3b'),{'body':{'type':_0x5c6e90,'uniqueid':_0x5542fa},'options':{'where':_0xa85eb9}});};exports[_0x6050('0x3c')]=function(_0x1442f2){return request('UnpauseUser',{'body':{},'options':{'where':_0x1442f2}});};exports[_0x6050('0x3d')]=function(_0x5295ad){return request('LogoutUser',{'body':{},'options':{'where':_0x5295ad}});}; \ 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 8473285..a19a529 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 _0x2d95=['./polly','exports'];(function(_0x7c2406,_0x610a0f){var _0x21280a=function(_0x4cb399){while(--_0x4cb399){_0x7c2406['push'](_0x7c2406['shift']());}};_0x21280a(++_0x610a0f);}(_0x2d95,0xca));var _0x52d9=function(_0x101f50,_0x3f68ef){_0x101f50=_0x101f50-0x0;var _0x208060=_0x2d95[_0x101f50];return _0x208060;};var polly=require(_0x52d9('0x0'));var lex=require('./lex');module[_0x52d9('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x6657=['exports','./polly'];(function(_0x5d3559,_0x1a70f0){var _0x233137=function(_0x3c4fdd){while(--_0x3c4fdd){_0x5d3559['push'](_0x5d3559['shift']());}};_0x233137(++_0x1a70f0);}(_0x6657,0x17f));var _0x7665=function(_0x45dc60,_0x5b6ac7){_0x45dc60=_0x45dc60-0x0;var _0x3765ba=_0x6657[_0x45dc60];return _0x3765ba;};var polly=require(_0x7665('0x0'));var lex=require('./lex');module[_0x7665('0x1')]={'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 346152a..4a86afe 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 _0x5b02=['exports','./lib/api'];(function(_0xdf5f28,_0x1fb72e){var _0x52ec5c=function(_0x411986){while(--_0x411986){_0xdf5f28['push'](_0xdf5f28['shift']());}};_0x52ec5c(++_0x1fb72e);}(_0x5b02,0xe9));var _0x25b0=function(_0x15c097,_0x37def2){_0x15c097=_0x15c097-0x0;var _0x4550e6=_0x5b02[_0x15c097];return _0x4550e6;};'use strict';var lex=require(_0x25b0('0x0'));module[_0x25b0('0x1')]=function(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e){return lex(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e);}; \ No newline at end of file +var _0xb4e6=['./lib/api'];(function(_0x19c788,_0x2cf31d){var _0x364e70=function(_0x4106ce){while(--_0x4106ce){_0x19c788['push'](_0x19c788['shift']());}};_0x364e70(++_0x2cf31d);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xb4e6[_0x13cab0];return _0x38804f;};'use strict';var lex=require(_0x6b4e('0x0'));module['exports']=function(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad){return lex(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad);}; \ 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 6e382fa..f1ec42a 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(_0x21f425,_0x327226){var _0x4eaa83=function(_0x6580cc){while(--_0x6580cc){_0x21f425['push'](_0x21f425['shift']());}};_0x4eaa83(++_0x327226);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x720f58,_0x51ad3d){var _0x4a7755=function(_0x21db74){while(--_0x21db74){_0x720f58['push'](_0x720f58['shift']());}};_0x4a7755(++_0x51ad3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 ef6f39a..f1a4630 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 _0x0d25=['./lib/api','exports'];(function(_0xf7f96f,_0x132272){var _0x324a98=function(_0x22ebd3){while(--_0x22ebd3){_0xf7f96f['push'](_0xf7f96f['shift']());}};_0x324a98(++_0x132272);}(_0x0d25,0x16c));var _0x50d2=function(_0x494315,_0x2d42bd){_0x494315=_0x494315-0x0;var _0x49cc18=_0x0d25[_0x494315];return _0x49cc18;};'use strict';var polly=require(_0x50d2('0x0'));module[_0x50d2('0x1')]=function(_0x58ec66,_0x276bff,_0x271456,_0x1d94d5,_0x227353,_0x149b70,_0x41c00a){return polly(_0x58ec66,_0x276bff,_0x271456,_0x1d94d5,_0x227353,_0x149b70,_0x41c00a);}; \ No newline at end of file +var _0xa136=['./lib/api','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa136,0xa4));var _0x6a13=function(_0x5d07bb,_0x271464){_0x5d07bb=_0x5d07bb-0x0;var _0x42960a=_0xa136[_0x5d07bb];return _0x42960a;};'use strict';var polly=require(_0x6a13('0x0'));module[_0x6a13('0x1')]=function(_0x986d39,_0xc3f289,_0x11218e,_0x33deb8,_0x4e1846,_0x2abf46,_0x248e0d){return polly(_0x986d39,_0xc3f289,_0x11218e,_0x33deb8,_0x4e1846,_0x2abf46,_0x248e0d);}; \ 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 53e429c..c537a7b 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 _0x2d23=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x437e9d,_0x1ad7c0){var _0x6349f2=function(_0x5d9d20){while(--_0x5d9d20){_0x437e9d['push'](_0x437e9d['shift']());}};_0x6349f2(++_0x1ad7c0);}(_0x2d23,0x1c7));var _0x32d2=function(_0xcb65be,_0x551ddd){_0xcb65be=_0xcb65be-0x0;var _0x4b7824=_0x2d23[_0xcb65be];return _0x4b7824;};'use strict';var fs=require('fs');var path=require(_0x32d2('0x0'));var BPromise=require(_0x32d2('0x1'));var rs=require(_0x32d2('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x391254,_0x3b2213,_0x115f6d){return new BPromise(function(_0x3a2aea,_0x1b6efd){_0x391254[_0x32d2('0x3')](_0x3b2213,function(_0x5a0057,_0x5dd676){if(_0x5a0057){_0x1b6efd(_0x5a0057);}else if(_0x5dd676){if(_0x5dd676[_0x32d2('0x4')]instanceof Buffer){fs[_0x32d2('0x5')](_0x115f6d,_0x5dd676[_0x32d2('0x4')],function(_0x31a7ef){if(_0x31a7ef){_0x1b6efd(_0x31a7ef);}else{_0x3a2aea();}});}else{_0x1b6efd(new Error(_0x32d2('0x6')));}}else{_0x1b6efd(new Error(_0x32d2('0x7')));}});});}module['exports']=function(_0x37819d,_0x2bd6a6,_0x5d333b,_0x508134,_0x1e9874,_0x3b4644,_0x5533ec){var _0x35e492=new AWS[(_0x32d2('0x8'))]({'accessKeyId':_0x37819d,'secretAccessKey':_0x2bd6a6,'region':_0x5d333b});var _0x3e4c91={'Text':_0x1e9874,'TextType':_0x3b4644||_0x32d2('0x9'),'OutputFormat':_0x32d2('0xa'),'VoiceId':_0x508134};return pollyResult(_0x35e492,_0x3e4c91,_0x5533ec);}; \ No newline at end of file +var _0x991d=['exports','Polly','mp3','bluebird','randomstring','aws-sdk','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x408296,_0x3dfeb5){var _0xf24464=function(_0x3c7a8a){while(--_0x3c7a8a){_0x408296['push'](_0x408296['shift']());}};_0xf24464(++_0x3dfeb5);}(_0x991d,0xdb));var _0xd991=function(_0x243725,_0x31b87b){_0x243725=_0x243725-0x0;var _0x446789=_0x991d[_0x243725];return _0x446789;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xd991('0x0'));var rs=require(_0xd991('0x1'));var AWS=require(_0xd991('0x2'));function pollyResult(_0x5c75a0,_0x789d06,_0x5a2dc6){return new BPromise(function(_0x3bf53a,_0x3d8893){_0x5c75a0['synthesizeSpeech'](_0x789d06,function(_0x1dd167,_0x3243ef){if(_0x1dd167){_0x3d8893(_0x1dd167);}else if(_0x3243ef){if(_0x3243ef['AudioStream']instanceof Buffer){fs[_0xd991('0x3')](_0x5a2dc6,_0x3243ef['AudioStream'],function(_0x5a34eb){if(_0x5a34eb){_0x3d8893(_0x5a34eb);}else{_0x3bf53a();}});}else{_0x3d8893(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3d8893(new Error(_0xd991('0x4')));}});});}module[_0xd991('0x5')]=function(_0x5b204f,_0x318bbd,_0x428e94,_0x3652fb,_0x5db814,_0x1f68e5,_0x2fba21){var _0x348492=new AWS[(_0xd991('0x6'))]({'accessKeyId':_0x5b204f,'secretAccessKey':_0x318bbd,'region':_0x428e94});var _0x2a0f19={'Text':_0x5db814,'TextType':_0x1f68e5||'text','OutputFormat':_0xd991('0x7'),'VoiceId':_0x3652fb};return pollyResult(_0x348492,_0x2a0f19,_0x2fba21);}; \ 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 3107f05..0eef4fd 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 _0x178e=['./lib/api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x178e,0x71));var _0xe178=function(_0x1b664d,_0x1d8695){_0x1b664d=_0x1b664d-0x0;var _0x43af6b=_0x178e[_0x1b664d];return _0x43af6b;};'use strict';var asr=require(_0xe178('0x0'));module['exports']=function(_0xf1c6c9,_0x1447ce,_0x2d5267,_0x311b4a){return asr(_0xf1c6c9,_0x1447ce,_0x2d5267);}; \ No newline at end of file +var _0x4afb=['./lib/api','exports'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x4afb,0x1a2));var _0xb4af=function(_0x389de8,_0x13a131){_0x389de8=_0x389de8-0x0;var _0x5ed099=_0x4afb[_0x389de8];return _0x5ed099;};'use strict';var asr=require(_0xb4af('0x0'));module[_0xb4af('0x1')]=function(_0x2783bf,_0x149495,_0x4d7be3,_0x429c5f){return asr(_0x2783bf,_0x149495,_0x4d7be3);}; \ 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 d607ca5..9c8c20e 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 _0x9221=['toString','base64','/v1/speech:recognize?key=','LINEAR16','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x42780d,_0x21fc28){var _0x4d8dae=function(_0x177fe2){while(--_0x177fe2){_0x42780d['push'](_0x42780d['shift']());}};_0x4d8dae(++_0x21fc28);}(_0x9221,0x64));var _0x1922=function(_0x2a4692,_0x5db910){_0x2a4692=_0x2a4692-0x0;var _0x370e6b=_0x9221[_0x2a4692];return _0x370e6b;};'use strict';var url=require('url');var BPromise=require(_0x1922('0x0'));var fs=require('fs');var host=_0x1922('0x1');module['exports']=function(_0x23df25,_0x1099ca,_0x5f14f2){return new BPromise(function(_0x309b6b,_0x43c8a3){var _0x459eee;if(typeof _0x23df25!==_0x1922('0x2')||_0x23df25[_0x1922('0x3')]===0x0){return _0x43c8a3(_0x1922('0x4'));}if(typeof _0x1099ca!==_0x1922('0x2')||_0x1099ca['length']===0x0){return _0x43c8a3(_0x1922('0x5'));}if(typeof _0x5f14f2!==_0x1922('0x6')&&(typeof _0x5f14f2!==_0x1922('0x2')||_0x5f14f2['length']===0x0)){return _0x43c8a3(_0x1922('0x7'));}try{_0x459eee=fs['readFileSync'](_0x23df25)[_0x1922('0x8')](_0x1922('0x9'));}catch(_0x1082d8){return _0x43c8a3(_0x1082d8);}return _0x309b6b({'method':'POST','uri':host+_0x1922('0xa')+_0x1099ca,'body':{'config':{'encoding':_0x1922('0xb'),'sampleRateHertz':'8000','languageCode':_0x5f14f2},'audio':{'content':_0x459eee}},'json':!![]});});}; \ No newline at end of file +var _0x54ef=['https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird'];(function(_0x333366,_0x31a443){var _0x4f5e60=function(_0x1667d9){while(--_0x1667d9){_0x333366['push'](_0x333366['shift']());}};_0x4f5e60(++_0x31a443);}(_0x54ef,0x112));var _0xf54e=function(_0x206b54,_0xebf339){_0x206b54=_0x206b54-0x0;var _0x488714=_0x54ef[_0x206b54];return _0x488714;};'use strict';var url=require(_0xf54e('0x0'));var BPromise=require(_0xf54e('0x1'));var fs=require('fs');var host=_0xf54e('0x2');module['exports']=function(_0xd936f7,_0x18b7d6,_0x18b1cf){return new BPromise(function(_0x42b9b2,_0x8b6bb6){var _0x431e36;if(typeof _0xd936f7!==_0xf54e('0x3')||_0xd936f7['length']===0x0){return _0x8b6bb6('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x18b7d6!==_0xf54e('0x3')||_0x18b7d6[_0xf54e('0x4')]===0x0){return _0x8b6bb6(_0xf54e('0x5'));}if(typeof _0x18b1cf!=='undefined'&&(typeof _0x18b1cf!==_0xf54e('0x3')||_0x18b1cf['length']===0x0)){return _0x8b6bb6(_0xf54e('0x6'));}try{_0x431e36=fs[_0xf54e('0x7')](_0xd936f7)['toString'](_0xf54e('0x8'));}catch(_0xefa1c0){return _0x8b6bb6(_0xefa1c0);}return _0x42b9b2({'method':_0xf54e('0x9'),'uri':host+_0xf54e('0xa')+_0x18b7d6,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf54e('0xb'),'languageCode':_0x18b1cf},'audio':{'content':_0x431e36}},'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 5c77c7b..10cb4be 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 _0x9a9b=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a9b,0x80));var _0xb9a9=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x9a9b[_0x352e09];return _0x1b7094;};var asr=require('./asr');module[_0xb9a9('0x0')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'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 6473a6b..8dda050 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 _0x67c7=['?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','asr','results','alternatives','transcript','join','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','result','resolvedQuery','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','detectIntent','length','queryResult','action','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','sestekNDA','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','https:','WHAT_EVER','get','\x20failed,\x20status\x20code\x20=\x20','data','end','transcode','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','777','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/'];(function(_0x51a3cc,_0x16a5ef){var _0x151fc=function(_0x1498a2){while(--_0x1498a2){_0x51a3cc['push'](_0x51a3cc['shift']());}};_0x151fc(++_0x16a5ef);}(_0x67c7,0xdc));var _0x767c=function(_0x243bba,_0x1ea69f){_0x243bba=_0x243bba-0x0;var _0x12e696=_0x67c7[_0x243bba];return _0x12e696;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x767c('0x0'));var dialogflow=require(_0x767c('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x767c('0x2'));var md5=require(_0x767c('0x3'));var path=require(_0x767c('0x4'));var querystring=require(_0x767c('0x5'));var rp=require(_0x767c('0x6'));var rs=require(_0x767c('0x7'));var sox=require(_0x767c('0x8'));var tts=require(_0x767c('0x9'));var urlParse=require('url')[_0x767c('0xa')];var util=require(_0x767c('0xb'));var aws=require(_0x767c('0xc'));var google=require(_0x767c('0xd'));var sestek=require('./sestek');var tilde=require(_0x767c('0xe'));var logger=require(_0x767c('0xf'))(_0x767c('0x10'));var ISPEECH_API=_0x767c('0x11');function downloadFile(_0x2f7e21,_0x3e6d32){return new BPromise(function(_0x5c29b7,_0x5287bd){var _0xeec530=urlParse(_0x2f7e21);var _0x36cddd=_0xeec530[_0x767c('0x12')]==='https:'?https:http;var _0x1f9a9c={'host':_0xeec530[_0x767c('0x13')],'path':_0xeec530[_0x767c('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x36cddd['get'](_0x1f9a9c,function(_0x1696bc){if(_0x1696bc[_0x767c('0x14')]!==0xc8){logger['error']('request\x20to\x20'+_0x2f7e21+'\x20failed,\x20status\x20code\x20=\x20'+_0x1696bc[_0x767c('0x14')]+'\x20('+_0x1696bc[_0x767c('0x15')]+')');_0x5287bd(new Error('request\x20to\x20'+_0x2f7e21+'\x20failed,\x20status\x20code\x20=\x20'+_0x1696bc[_0x767c('0x14')]+'\x20('+_0x1696bc[_0x767c('0x15')]+')'));return;}var _0x1bedce=fs['createWriteStream'](_0x3e6d32);_0x1bedce['on'](_0x767c('0x16'),function(){logger[_0x767c('0x17')](_0x767c('0x18'));_0x1bedce[_0x767c('0x19')](_0x5c29b7);});_0x1bedce['on'](_0x767c('0x1a'),function(_0xa468b4){fs[_0x767c('0x1b')](_0x3e6d32);logger['error'](_0x767c('0x1c'),_0xa468b4);_0x5287bd(_0xa468b4);});_0x1696bc[_0x767c('0x1d')](_0x1bedce);})['on'](_0x767c('0x1a'),function(_0x201135){logger[_0x767c('0x1a')](_0x201135);_0x5287bd(_0x201135);})['end']();});}function uploadFile(_0x2e4aa1){return new BPromise(function(_0x5a0008,_0x25c800){var _0x5a3a6a=urlParse(_0x2e4aa1);var _0x634812=_0x5a3a6a[_0x767c('0x12')]===_0x767c('0x1e')?https:http;var _0xaa5862={'host':_0x5a3a6a[_0x767c('0x13')],'path':_0x5a3a6a['path'],'headers':{'user-agent':_0x767c('0x1f')}};_0x634812[_0x767c('0x20')](_0xaa5862,function(_0x20ac2f){if(_0x20ac2f[_0x767c('0x14')]!==0xc8){_0x25c800(new Error('request\x20to\x20'+_0x2e4aa1+_0x767c('0x21')+_0x20ac2f[_0x767c('0x14')]+'\x20('+_0x20ac2f[_0x767c('0x15')]+')'));return;}var _0x34dd2e='';_0x20ac2f['on'](_0x767c('0x22'),function(_0x34e079){_0x34dd2e+=_0x34e079;});_0x20ac2f['on']('end',function(){_0x5a0008(_0x34dd2e);});})['on'](_0x767c('0x1a'),function(_0x52f892){_0x25c800(_0x52f892);})[_0x767c('0x23')]();});}function convertFile(_0x21db9e,_0x420c8e){return new BPromise(function(_0x9e4243,_0x5c583c){var _0x45f68e=sox[_0x767c('0x24')](_0x21db9e,_0x420c8e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45f68e['on'](_0x767c('0x1a'),function(_0x15ec07){logger['error'](_0x767c('0x25'),_0x15ec07);_0x5c583c(_0x15ec07);});_0x45f68e['on'](_0x767c('0x23'),function(){logger[_0x767c('0x17')]('finish\x20to\x20convert');_0x9e4243();});_0x45f68e[_0x767c('0x26')]();});}function base64Decode(_0xf712f8,_0x1fada1){var _0x1631ed=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+_0x767c('0x2a'));fs[_0x767c('0x2b')](_0x1631ed,_0xf712f8,'base64');return convertFile(_0x1631ed,_0x1fada1)[_0x767c('0x2c')](function(){try{fs['unlink'](_0x1631ed);fs['chmodSync'](_0x1fada1,_0x767c('0x2d'));}catch(_0x2f8116){logger['error'](_0x2f8116);}return _0x1fada1['split']('.')[0x0];});}function base64Encode(_0x39565c){var _0x499f88=fs['readFileSync'](_0x39565c);return new Buffer(_0x499f88)[_0x767c('0x2e')](_0x767c('0x2f'));}exports[_0x767c('0x30')]=function(_0xba291,_0x54c49b,_0x198ccb,_0x1ef67a,_0xda0e45,_0x3468c5){var _0x217e15,_0x1f8c5e;var _0x432cc0=_0x767c('0x31');var _0x49e7f1=_0x767c('0x32')+_0xba291;var _0x30a0f0={};if(_0x54c49b===_0x767c('0x33')){_0x30a0f0[_0x767c('0x34')]={'ssml':_0x198ccb};}else{_0x30a0f0['input']={'text':_0x198ccb};};_0x30a0f0[_0x767c('0x35')]={'languageCode':_0x1ef67a,'ssmlGender':_0xda0e45};_0x30a0f0[_0x767c('0x36')]={'audioEncoding':_0x767c('0x37'),'sampleRateHertz':0x1f40};var _0x1d2e37={'url':_0x432cc0+_0x767c('0x38')+_0x49e7f1,'method':_0x767c('0x39'),'json':!![],'body':_0x30a0f0};return rp(_0x1d2e37)[_0x767c('0x2c')](function(_0x73eca9){return new BPromise(function(_0x48e62b,_0x48f22c){_0x217e15=path['resolve'](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+'.mp3');var _0x215a2d=Buffer[_0x767c('0x3a')](_0x73eca9[_0x767c('0x3b')],_0x767c('0x2f'));return fs[_0x767c('0x3c')](_0x217e15,_0x215a2d,function(_0x25e722){_0x48f22c(_0x25e722);},function(_0x149eaa){fs['chmodSync'](_0x217e15,'777');_0x48e62b(_0x149eaa);});});})[_0x767c('0x2c')](function(_0x3b4c6c){_0x1f8c5e=path['resolve'](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+_0x767c('0x2a'));return convertFile(_0x217e15,_0x1f8c5e);})[_0x767c('0x2c')](function(){try{fs['unlink'](_0x217e15);fs[_0x767c('0x3d')](_0x1f8c5e,_0x767c('0x2d'));}catch(_0x537002){logger['error'](_0x537002);}logger[_0x767c('0x17')](_0x767c('0x3e'),_0x1f8c5e['split']('.')[0x0]);return _0x1f8c5e[_0x767c('0x3f')]('.')[0x0];});};exports[_0x767c('0x40')]=function(_0x2db72c,_0x161a9e){var _0x1e2d0c=_0x767c('0x41');var _0x307d49,_0x450bf5;var _0x550186;var _0x30003a={'encoding':_0x767c('0x42'),'method':_0x767c('0x39'),'timeout':0x2710,'url':_0x1e2d0c,'headers':{'Content-Type':_0x767c('0x43')},'body':_0x767c('0x44')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x767c('0x45')]([_0x2db72c,_0x161a9e||'en',![],_0x767c('0x46')]),null,_0x767c('0x47')]]]))};return rp(_0x30003a)[_0x767c('0x2c')](function(_0x587d16){try{_0x550186=eval(_0x587d16['slice'](0x5))[0x0][0x2];}catch(_0x4c49d2){throw new Error('parse\x20response\x20failed:\x0a'+_0x587d16['data']);}if(!_0x550186){if(_0x2db72c['length']>0xc8){throw new Error(_0x767c('0x48'));}else{throw new Error(_0x767c('0x49')+_0x161a9e+_0x767c('0x4a'));}}try{_0x550186=eval(_0x550186)[0x0];}catch(_0x4e6b90){throw new Error(_0x767c('0x4b')+res[_0x767c('0x22')]);}const _0x11cbf1=_0x550186;_0x307d49=path['resolve'](__dirname,_0x767c('0x28'),rs['generate'](0x4)+_0x767c('0x4c'));fs[_0x767c('0x2b')](_0x307d49,_0x550186,{'encoding':'base64'});_0x450bf5=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs['generate'](0x4)+_0x767c('0x2a'));return convertFile(_0x307d49,_0x450bf5);})[_0x767c('0x2c')](function(){try{fs[_0x767c('0x1b')](_0x307d49);fs['chmodSync'](_0x450bf5,_0x767c('0x2d'));}catch(_0x57daca){logger[_0x767c('0x1a')](_0x57daca);}logger['info'](_0x767c('0x4d'),_0x450bf5['split']('.')[0x0]);return _0x450bf5[_0x767c('0x3f')]('.')[0x0];});};exports['googleASR']=function(_0x2a63c8,_0xd1cac2,_0x53f673){return google[_0x767c('0x4e')](_0x2a63c8,_0xd1cac2,_0x53f673)['then'](function(_0x36f4e2){logger[_0x767c('0x17')](_0x36f4e2['uri']);return rp(_0x36f4e2);})['then'](function(_0x2ebce6){var _0x8410b2='';var _0x193353=0x0;try{fs['unlink'](_0x2a63c8);}catch(_0x14487e){logger['error'](_0x14487e);}if(_0x2ebce6&&_0x2ebce6[_0x767c('0x4f')]){_0x8410b2=_0x2ebce6['results']['map'](function(_0x422f81){return _0x422f81&&_0x422f81[_0x767c('0x50')][0x0]&&_0x422f81['alternatives'][0x0][_0x767c('0x51')]?_0x422f81[_0x767c('0x50')][0x0][_0x767c('0x51')]:'';})[_0x767c('0x52')]('\x0a');_0x193353=_0x2ebce6['results']['map'](function(_0x523b5b){return _0x523b5b&&_0x523b5b[_0x767c('0x50')][0x0]&&_0x523b5b['alternatives'][0x0]['confidence']?_0x523b5b[_0x767c('0x50')][0x0]['confidence']:0x0;})[_0x767c('0x52')]('\x0a');}logger[_0x767c('0x17')](_0x767c('0x53'),_0x8410b2);logger[_0x767c('0x17')]('googleASR\x20confidence',_0x193353);return{'transcript':_0x8410b2,'confidence':_0x193353};})[_0x767c('0x54')](function(_0x9c50fb){logger['error']('[%s]\x20%s:%s',_0x9c50fb['statusCode'],_0x9c50fb[_0x767c('0x55')],_0x9c50fb[_0x767c('0x56')]);});};exports[_0x767c('0x57')]=function(_0x5e720b,_0x5f2e2f,_0x346126,_0x39596b){var _0x90ef72=apiai(_0x5f2e2f,{'language':_0x39596b||'en'});return _0x90ef72[_0x767c('0x58')](_0x346126,{'sessionId':md5(_0x5e720b)})['then'](function(_0x92cf42){logger['info'](JSON[_0x767c('0x45')](_0x92cf42));return{'source':_0x92cf42[_0x767c('0x59')]['source'],'resolvedQuery':_0x92cf42['result'][_0x767c('0x5a')],'action':_0x92cf42['result']['action'],'actionIncomplete':_0x92cf42[_0x767c('0x59')]['actionIncomplete'],'speech':_0x92cf42['result'][_0x767c('0x5b')][_0x767c('0x5c')],'score':_0x92cf42['result'][_0x767c('0x5d')],'statusCode':_0x92cf42[_0x767c('0x5e')][_0x767c('0x5f')],'endConversation':_0x92cf42[_0x767c('0x59')]['metadata'][_0x767c('0x60')]||![],'isFallbackIntent':_0x92cf42[_0x767c('0x59')][_0x767c('0x61')][_0x767c('0x62')]};});};exports[_0x767c('0x63')]=function(_0x9da79,_0x5e2516,_0xc624d6,_0x3e6132,_0x235930,_0x445048){var _0x3fcf8a=_0x3e6132[_0x767c('0x64')](/\\n/g,'\x0a');var _0x47db3e={'credentials':{'private_key':_0x3fcf8a,'client_email':_0xc624d6}};var _0x11740f=new dialogflow['SessionsClient'](_0x47db3e);var _0x4dba92=_0x11740f['sessionPath'](_0x5e2516,md5(_0x9da79));var _0x46f4d8={'session':_0x4dba92,'queryInput':{'text':{'text':_0x235930,'languageCode':_0x445048}}};return _0x11740f[_0x767c('0x65')](_0x46f4d8)[_0x767c('0x2c')](function(_0x2ca53b){if(_0x2ca53b&&_0x2ca53b[_0x767c('0x66')]){logger[_0x767c('0x17')]('Dialogflow\x20V2\x20response:',JSON[_0x767c('0x45')](_0x2ca53b));var _0x3f2f7e=_0x2ca53b[0x0];if(_0x3f2f7e){var _0x543cf={'action':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x68')],'allRequiredParamsPresent':_0x3f2f7e[_0x767c('0x67')]['allRequiredParamsPresent'],'endConversation':_0x3f2f7e['queryResult'][_0x767c('0x69')]&&_0x3f2f7e[_0x767c('0x67')][_0x767c('0x69')][_0x767c('0x6a')]?_0x3f2f7e[_0x767c('0x67')][_0x767c('0x69')][_0x767c('0x6a')][_0x767c('0x6b')][_0x767c('0x6c')]:![],'fulfillmentText':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x6d')],'intentName':_0x3f2f7e['queryResult'][_0x767c('0x6e')][_0x767c('0x55')],'intentDisplayName':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x6e')][_0x767c('0x6f')],'isFallbackIntent':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x6e')][_0x767c('0x70')],'languageCode':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x71')],'queryText':_0x3f2f7e[_0x767c('0x67')]['queryText'],'responseId':_0x3f2f7e[_0x767c('0x72')],'score':_0x3f2f7e[_0x767c('0x67')]['intentDetectionConfidence'],'speech':_0x3f2f7e[_0x767c('0x67')]['fulfillmentText'],'providerResponse':JSON[_0x767c('0x45')](_0x2ca53b)};return _0x543cf;}}});};exports[_0x767c('0x73')]=function(_0x246d3e,_0x4dfd71,_0x561e73,_0xfd98b9){return tilde['asr'](_0x246d3e,_0x4dfd71,_0x561e73,_0xfd98b9)[_0x767c('0x2c')](function(_0x50ec67){try{fs[_0x767c('0x1b')](_0x246d3e);}catch(_0x43546d){logger[_0x767c('0x1a')](_0x43546d);}logger[_0x767c('0x17')](_0x767c('0x74'),_0x50ec67['transcript']);logger['info'](_0x767c('0x75'),_0x50ec67[_0x767c('0x76')]);return _0x50ec67;});};exports[_0x767c('0x77')]=function(_0x1d0c42,_0x23ac36,_0x170eed,_0x18c0e1,_0x3da9b0,_0x167e5f){var _0x34804b=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs['generate'](0x4)+_0x767c('0x4c'));var _0xe0ee78;return aws[_0x767c('0x78')](_0x1d0c42,_0x23ac36,_0x170eed,_0x18c0e1,_0x3da9b0,_0x167e5f,_0x34804b)[_0x767c('0x2c')](function(){_0xe0ee78=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+_0x767c('0x2a'));return convertFile(_0x34804b,_0xe0ee78);})[_0x767c('0x2c')](function(){try{fs['unlink'](_0x34804b);fs[_0x767c('0x3d')](_0xe0ee78,_0x767c('0x2d'));}catch(_0xe0ebdb){logger[_0x767c('0x1a')](_0xe0ebdb);}return _0xe0ee78['split']('.')[0x0];});};exports[_0x767c('0x79')]=function(_0x5f5ca4,_0x471356,_0x2c3a41,_0x4f3bfb,_0x49665e,_0x2b1349){return aws[_0x767c('0x7a')](_0x5f5ca4,_0x471356,_0x2c3a41,_0x4f3bfb,_0x49665e,_0x2b1349)['then'](function(_0x592d0d){logger[_0x767c('0x17')](JSON[_0x767c('0x45')](_0x592d0d));return _0x592d0d;});};exports['ispeechTTS']=function(_0x4a563f,_0x544a2b,_0x9649e5,_0x4bfb6c){var _0x187512=util[_0x767c('0x7b')](_0x767c('0x7c'),ISPEECH_API,_0x4a563f,encodeURIComponent(_0x544a2b),_0x9649e5,_0x4bfb6c);var _0x353473=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+_0x767c('0x4c'));var _0x1490d6;return downloadFile(_0x187512,_0x353473)[_0x767c('0x2c')](function(){_0x1490d6=path[_0x767c('0x27')](__dirname,'tmp',rs[_0x767c('0x29')](0x4)+'.wav');return convertFile(_0x353473,_0x1490d6);})[_0x767c('0x2c')](function(){try{fs[_0x767c('0x1b')](_0x353473);fs['chmodSync'](_0x1490d6,_0x767c('0x2d'));}catch(_0x5097d5){logger[_0x767c('0x1a')](_0x5097d5);}return _0x1490d6[_0x767c('0x3f')]('.')[0x0];});};exports[_0x767c('0x7d')]=function(_0xcfbfcd,_0x3628de,_0x560e24,_0x1d5a2c){var _0x213c99=util[_0x767c('0x7b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3628de,_0x560e24,base64Encode(_0xcfbfcd),_0x1d5a2c?util[_0x767c('0x7b')](_0x767c('0x7e'),encodeURIComponent(_0x1d5a2c)):'freeform=3');return uploadFile(_0x213c99)[_0x767c('0x2c')](function(_0x4206f5){return querystring[_0x767c('0xa')](_0x4206f5);});};exports[_0x767c('0x7f')]=function(_0x21462c,_0x10a32a){return sestek['nda'](_0x21462c,_0x10a32a)['then'](function(_0x490807){logger[_0x767c('0x17')](JSON['stringify'](_0x490807));var _0x54c15f={'speech':_0x490807[_0x767c('0x80')],'action':_0x490807['channelData']?_0x490807[_0x767c('0x81')][_0x767c('0x82')]:undefined,'actiondata':_0x490807[_0x767c('0x81')]?_0x490807['channelData']['CustomActionData']:undefined};if(_0x490807[_0x767c('0x81')]&&_0x490807[_0x767c('0x81')][_0x767c('0x83')]){return base64Decode(_0x490807['channelData']['AudioFromTts'][_0x767c('0x84')],path[_0x767c('0x27')](__dirname,'tmp',rs[_0x767c('0x29')](0x4)+'.wav'))['then'](function(_0x3961ce){_0x54c15f[_0x767c('0x85')]=_0x3961ce;return _0x54c15f;});}return _0x54c15f;});};exports[_0x767c('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0xb4c1=['text','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','statusCode','createWriteStream','finish','info','close','error','unlink','download\x20error','pipe','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','status','metadata','endConversation','replace','SessionsClient','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','model=%s','freeform=3','sestekNDA','nda'];(function(_0x14e3b8,_0xff4ac0){var _0x5c4b8a=function(_0xea8b47){while(--_0xea8b47){_0x14e3b8['push'](_0x14e3b8['shift']());}};_0x5c4b8a(++_0xff4ac0);}(_0xb4c1,0x11a));var _0x1b4c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb4c1[_0x46e363];return _0x3fb059;};'use strict';var apiai=require(_0x1b4c('0x0'));var BPromise=require(_0x1b4c('0x1'));var dialogflow=require(_0x1b4c('0x2'));var fs=require('fs');var http=require(_0x1b4c('0x3'));var https=require(_0x1b4c('0x4'));var md5=require('md5');var path=require('path');var querystring=require(_0x1b4c('0x5'));var rp=require(_0x1b4c('0x6'));var rs=require(_0x1b4c('0x7'));var sox=require(_0x1b4c('0x8'));var tts=require(_0x1b4c('0x9'));var urlParse=require(_0x1b4c('0xa'))[_0x1b4c('0xb')];var util=require(_0x1b4c('0xc'));var aws=require(_0x1b4c('0xd'));var google=require(_0x1b4c('0xe'));var sestek=require('./sestek');var tilde=require(_0x1b4c('0xf'));var logger=require(_0x1b4c('0x10'))(_0x1b4c('0x11'));var ISPEECH_API=_0x1b4c('0x12');function downloadFile(_0x16fce6,_0x3eb0e4){return new BPromise(function(_0x41a461,_0x11dbbe){var _0x3b10e2=urlParse(_0x16fce6);var _0x3e71f5=_0x3b10e2[_0x1b4c('0x13')]===_0x1b4c('0x14')?https:http;var _0x463da4={'host':_0x3b10e2[_0x1b4c('0x15')],'path':_0x3b10e2[_0x1b4c('0x16')],'headers':{'user-agent':_0x1b4c('0x17')}};_0x3e71f5[_0x1b4c('0x18')](_0x463da4,function(_0x366806){if(_0x366806['statusCode']!==0xc8){logger['error'](_0x1b4c('0x19')+_0x16fce6+_0x1b4c('0x1a')+_0x366806['statusCode']+'\x20('+_0x366806[_0x1b4c('0x1b')]+')');_0x11dbbe(new Error(_0x1b4c('0x19')+_0x16fce6+_0x1b4c('0x1a')+_0x366806[_0x1b4c('0x1c')]+'\x20('+_0x366806[_0x1b4c('0x1b')]+')'));return;}var _0x5a8175=fs[_0x1b4c('0x1d')](_0x3eb0e4);_0x5a8175['on'](_0x1b4c('0x1e'),function(){logger[_0x1b4c('0x1f')]('finish\x20download\x20file');_0x5a8175[_0x1b4c('0x20')](_0x41a461);});_0x5a8175['on'](_0x1b4c('0x21'),function(_0x1f6796){fs[_0x1b4c('0x22')](_0x3eb0e4);logger[_0x1b4c('0x21')](_0x1b4c('0x23'),_0x1f6796);_0x11dbbe(_0x1f6796);});_0x366806[_0x1b4c('0x24')](_0x5a8175);})['on'](_0x1b4c('0x21'),function(_0x46ef4e){logger['error'](_0x46ef4e);_0x11dbbe(_0x46ef4e);})['end']();});}function uploadFile(_0x287707){return new BPromise(function(_0x28bf93,_0x440793){var _0x1da61c=urlParse(_0x287707);var _0x59c71b=_0x1da61c[_0x1b4c('0x13')]===_0x1b4c('0x14')?https:http;var _0xc4a13={'host':_0x1da61c[_0x1b4c('0x15')],'path':_0x1da61c[_0x1b4c('0x16')],'headers':{'user-agent':_0x1b4c('0x17')}};_0x59c71b[_0x1b4c('0x18')](_0xc4a13,function(_0x258f5e){if(_0x258f5e[_0x1b4c('0x1c')]!==0xc8){_0x440793(new Error(_0x1b4c('0x19')+_0x287707+'\x20failed,\x20status\x20code\x20=\x20'+_0x258f5e['statusCode']+'\x20('+_0x258f5e[_0x1b4c('0x1b')]+')'));return;}var _0x2fe61b='';_0x258f5e['on'](_0x1b4c('0x25'),function(_0x41cf63){_0x2fe61b+=_0x41cf63;});_0x258f5e['on']('end',function(){_0x28bf93(_0x2fe61b);});})['on']('error',function(_0x2e648d){_0x440793(_0x2e648d);})[_0x1b4c('0x26')]();});}function convertFile(_0x21ed6a,_0x4aa571){return new BPromise(function(_0x8c6d26,_0x2517b8){var _0x3d6a01=sox[_0x1b4c('0x27')](_0x21ed6a,_0x4aa571,{'sampleRate':0x1f40,'format':_0x1b4c('0x28'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3d6a01['on'](_0x1b4c('0x21'),function(_0x298517){logger[_0x1b4c('0x21')](_0x1b4c('0x29'),_0x298517);_0x2517b8(_0x298517);});_0x3d6a01['on']('end',function(){logger['info'](_0x1b4c('0x2a'));_0x8c6d26();});_0x3d6a01['start']();});}function base64Decode(_0x39d8ec,_0x8d5a55){var _0x4bc4cb=path[_0x1b4c('0x2b')](__dirname,_0x1b4c('0x2c'),rs[_0x1b4c('0x2d')](0x4)+_0x1b4c('0x2e'));fs[_0x1b4c('0x2f')](_0x4bc4cb,_0x39d8ec,_0x1b4c('0x30'));return convertFile(_0x4bc4cb,_0x8d5a55)['then'](function(){try{fs[_0x1b4c('0x22')](_0x4bc4cb);fs[_0x1b4c('0x31')](_0x8d5a55,_0x1b4c('0x32'));}catch(_0x4df2cc){logger[_0x1b4c('0x21')](_0x4df2cc);}return _0x8d5a55[_0x1b4c('0x33')]('.')[0x0];});}function base64Encode(_0x364962){var _0xe31b60=fs[_0x1b4c('0x34')](_0x364962);return new Buffer(_0xe31b60)[_0x1b4c('0x35')]('base64');}exports[_0x1b4c('0x36')]=function(_0x23cfc3,_0x3728b7,_0x16e058,_0x947021,_0x23a130,_0x1c9c89){var _0x187a75,_0xad737c;var _0x578fcb='https://texttospeech.googleapis.com/v1/';var _0x5088f8=_0x1b4c('0x37')+_0x23cfc3;var _0x2ff3e7={};if(_0x3728b7==='ssml'){_0x2ff3e7[_0x1b4c('0x38')]={'ssml':_0x16e058};}else{_0x2ff3e7['input']={'text':_0x16e058};};_0x2ff3e7[_0x1b4c('0x39')]={'languageCode':_0x947021,'ssmlGender':_0x23a130};_0x2ff3e7[_0x1b4c('0x3a')]={'audioEncoding':_0x1b4c('0x3b'),'sampleRateHertz':0x1f40};var _0x47e7ac={'url':_0x578fcb+_0x1b4c('0x3c')+_0x5088f8,'method':_0x1b4c('0x3d'),'json':!![],'body':_0x2ff3e7};return rp(_0x47e7ac)[_0x1b4c('0x3e')](function(_0x437491){return new BPromise(function(_0x45fdaf,_0x40a75e){_0x187a75=path[_0x1b4c('0x2b')](__dirname,_0x1b4c('0x2c'),rs[_0x1b4c('0x2d')](0x4)+_0x1b4c('0x3f'));var _0x3dec91=Buffer['from'](_0x437491['audioContent'],_0x1b4c('0x30'));return fs[_0x1b4c('0x40')](_0x187a75,_0x3dec91,function(_0x5cfdc7){_0x40a75e(_0x5cfdc7);},function(_0x22dec5){fs['chmodSync'](_0x187a75,_0x1b4c('0x32'));_0x45fdaf(_0x22dec5);});});})[_0x1b4c('0x3e')](function(_0x4b9d9e){_0xad737c=path[_0x1b4c('0x2b')](__dirname,_0x1b4c('0x2c'),rs[_0x1b4c('0x2d')](0x4)+_0x1b4c('0x2e'));return convertFile(_0x187a75,_0xad737c);})['then'](function(){try{fs['unlink'](_0x187a75);fs[_0x1b4c('0x31')](_0xad737c,_0x1b4c('0x32'));}catch(_0x1e80b4){logger[_0x1b4c('0x21')](_0x1e80b4);}logger['info'](_0x1b4c('0x41'),_0xad737c[_0x1b4c('0x33')]('.')[0x0]);return _0xad737c[_0x1b4c('0x33')]('.')[0x0];});};exports['googleTTS']=function(_0x514e27,_0x284061){var _0x3e53a8=_0x1b4c('0x42');var _0x2e089a,_0x5429f0;var _0x440f8a;var _0x4c5313={'encoding':_0x1b4c('0x43'),'method':_0x1b4c('0x3d'),'timeout':0x2710,'url':_0x3e53a8,'headers':{'Content-Type':_0x1b4c('0x44')},'body':_0x1b4c('0x45')+encodeURIComponent(JSON['stringify']([[[_0x1b4c('0x46'),JSON[_0x1b4c('0x47')]([_0x514e27,_0x284061||'en',![],'null']),null,'generic']]]))};return rp(_0x4c5313)[_0x1b4c('0x3e')](function(_0x23c064){try{_0x440f8a=eval(_0x23c064[_0x1b4c('0x48')](0x5))[0x0][0x2];}catch(_0x46dde9){throw new Error(_0x1b4c('0x49')+_0x23c064[_0x1b4c('0x25')]);}if(!_0x440f8a){if(_0x514e27[_0x1b4c('0x4a')]>0xc8){throw new Error(_0x1b4c('0x4b'));}else{throw new Error(_0x1b4c('0x4c')+_0x284061+_0x1b4c('0x4d'));}}try{_0x440f8a=eval(_0x440f8a)[0x0];}catch(_0xa23ed9){throw new Error(_0x1b4c('0x49')+res[_0x1b4c('0x25')]);}const _0x59139f=_0x440f8a;_0x2e089a=path[_0x1b4c('0x2b')](__dirname,_0x1b4c('0x2c'),rs[_0x1b4c('0x2d')](0x4)+'.mp3');fs[_0x1b4c('0x2f')](_0x2e089a,_0x440f8a,{'encoding':_0x1b4c('0x30')});_0x5429f0=path[_0x1b4c('0x2b')](__dirname,_0x1b4c('0x2c'),rs['generate'](0x4)+_0x1b4c('0x2e'));return convertFile(_0x2e089a,_0x5429f0);})[_0x1b4c('0x3e')](function(){try{fs[_0x1b4c('0x22')](_0x2e089a);fs['chmodSync'](_0x5429f0,_0x1b4c('0x32'));}catch(_0x31ee55){logger[_0x1b4c('0x21')](_0x31ee55);}logger['info'](_0x1b4c('0x4e'),_0x5429f0[_0x1b4c('0x33')]('.')[0x0]);return _0x5429f0[_0x1b4c('0x33')]('.')[0x0];});};exports[_0x1b4c('0x4f')]=function(_0x5f0ca5,_0x1c8833,_0x32a62f){return google[_0x1b4c('0x50')](_0x5f0ca5,_0x1c8833,_0x32a62f)[_0x1b4c('0x3e')](function(_0x5a7dee){logger['info'](_0x5a7dee[_0x1b4c('0x51')]);return rp(_0x5a7dee);})[_0x1b4c('0x3e')](function(_0x833a2f){var _0x512024='';var _0x42e3b9=0x0;try{fs[_0x1b4c('0x22')](_0x5f0ca5);}catch(_0x17a9fd){logger[_0x1b4c('0x21')](_0x17a9fd);}if(_0x833a2f&&_0x833a2f[_0x1b4c('0x52')]){_0x512024=_0x833a2f['results'][_0x1b4c('0x53')](function(_0x49846a){return _0x49846a&&_0x49846a['alternatives'][0x0]&&_0x49846a[_0x1b4c('0x54')][0x0]['transcript']?_0x49846a['alternatives'][0x0][_0x1b4c('0x55')]:'';})[_0x1b4c('0x56')]('\x0a');_0x42e3b9=_0x833a2f['results'][_0x1b4c('0x53')](function(_0x4b23cd){return _0x4b23cd&&_0x4b23cd[_0x1b4c('0x54')][0x0]&&_0x4b23cd[_0x1b4c('0x54')][0x0][_0x1b4c('0x57')]?_0x4b23cd['alternatives'][0x0][_0x1b4c('0x57')]:0x0;})[_0x1b4c('0x56')]('\x0a');}logger[_0x1b4c('0x1f')](_0x1b4c('0x58'),_0x512024);logger['info'](_0x1b4c('0x59'),_0x42e3b9);return{'transcript':_0x512024,'confidence':_0x42e3b9};})[_0x1b4c('0x5a')](function(_0x37c5f2){logger[_0x1b4c('0x21')](_0x1b4c('0x5b'),_0x37c5f2[_0x1b4c('0x1c')],_0x37c5f2[_0x1b4c('0x5c')],_0x37c5f2[_0x1b4c('0x5d')]);});};exports[_0x1b4c('0x5e')]=function(_0x5ae0c4,_0x27bc64,_0x2e52e4,_0x1cc2b0){var _0x5bc585=apiai(_0x27bc64,{'language':_0x1cc2b0||'en'});return _0x5bc585[_0x1b4c('0x5f')](_0x2e52e4,{'sessionId':md5(_0x5ae0c4)})['then'](function(_0x1419f0){logger[_0x1b4c('0x1f')](JSON[_0x1b4c('0x47')](_0x1419f0));return{'source':_0x1419f0['result'][_0x1b4c('0x60')],'resolvedQuery':_0x1419f0[_0x1b4c('0x61')][_0x1b4c('0x62')],'action':_0x1419f0[_0x1b4c('0x61')][_0x1b4c('0x63')],'actionIncomplete':_0x1419f0[_0x1b4c('0x61')]['actionIncomplete'],'speech':_0x1419f0[_0x1b4c('0x61')][_0x1b4c('0x64')]['speech'],'score':_0x1419f0[_0x1b4c('0x61')]['score'],'statusCode':_0x1419f0[_0x1b4c('0x65')]['code'],'endConversation':_0x1419f0[_0x1b4c('0x61')][_0x1b4c('0x66')][_0x1b4c('0x67')]||![],'isFallbackIntent':_0x1419f0['result'][_0x1b4c('0x66')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x441045,_0x370e21,_0x3c501e,_0xdd7501,_0x2ba828,_0x68a057){var _0x13b4f5=_0xdd7501[_0x1b4c('0x68')](/\\n/g,'\x0a');var _0x154e1d={'credentials':{'private_key':_0x13b4f5,'client_email':_0x3c501e}};var _0x1ffa40=new dialogflow[(_0x1b4c('0x69'))](_0x154e1d);var _0x3865b5=_0x1ffa40['sessionPath'](_0x370e21,md5(_0x441045));var _0x139a60={'session':_0x3865b5,'queryInput':{'text':{'text':_0x2ba828,'languageCode':_0x68a057}}};return _0x1ffa40['detectIntent'](_0x139a60)['then'](function(_0x575c0b){if(_0x575c0b&&_0x575c0b[_0x1b4c('0x4a')]){logger[_0x1b4c('0x1f')](_0x1b4c('0x6a'),JSON[_0x1b4c('0x47')](_0x575c0b));var _0x1ec2f5=_0x575c0b[0x0];if(_0x1ec2f5){var _0x5c28d6={'action':_0x1ec2f5[_0x1b4c('0x6b')][_0x1b4c('0x63')],'allRequiredParamsPresent':_0x1ec2f5[_0x1b4c('0x6b')][_0x1b4c('0x6c')],'endConversation':_0x1ec2f5[_0x1b4c('0x6b')]['diagnosticInfo']&&_0x1ec2f5[_0x1b4c('0x6b')][_0x1b4c('0x6d')]['fields']?_0x1ec2f5['queryResult'][_0x1b4c('0x6d')][_0x1b4c('0x6e')][_0x1b4c('0x6f')]['boolValue']:![],'fulfillmentText':_0x1ec2f5[_0x1b4c('0x6b')][_0x1b4c('0x70')],'intentName':_0x1ec2f5[_0x1b4c('0x6b')][_0x1b4c('0x71')][_0x1b4c('0x5c')],'intentDisplayName':_0x1ec2f5[_0x1b4c('0x6b')][_0x1b4c('0x71')][_0x1b4c('0x72')],'isFallbackIntent':_0x1ec2f5[_0x1b4c('0x6b')][_0x1b4c('0x71')][_0x1b4c('0x73')],'languageCode':_0x1ec2f5[_0x1b4c('0x6b')][_0x1b4c('0x74')],'queryText':_0x1ec2f5['queryResult'][_0x1b4c('0x75')],'responseId':_0x1ec2f5[_0x1b4c('0x76')],'score':_0x1ec2f5[_0x1b4c('0x6b')][_0x1b4c('0x77')],'speech':_0x1ec2f5[_0x1b4c('0x6b')]['fulfillmentText'],'providerResponse':JSON[_0x1b4c('0x47')](_0x575c0b)};return _0x5c28d6;}}});};exports['tildeASR']=function(_0x5e2add,_0x42c29a,_0x4d008c,_0x150bc0){return tilde['asr'](_0x5e2add,_0x42c29a,_0x4d008c,_0x150bc0)[_0x1b4c('0x3e')](function(_0xb03c75){try{fs[_0x1b4c('0x22')](_0x5e2add);}catch(_0x139824){logger['error'](_0x139824);}logger[_0x1b4c('0x1f')](_0x1b4c('0x78'),_0xb03c75['transcript']);logger[_0x1b4c('0x1f')](_0x1b4c('0x79'),_0xb03c75['confidence']);return _0xb03c75;});};exports[_0x1b4c('0x7a')]=function(_0x3cc4b3,_0x1bbeda,_0xbf5ccd,_0x47eadf,_0x3daf63,_0x36fe78){var _0x360ecf=path[_0x1b4c('0x2b')](__dirname,_0x1b4c('0x2c'),rs[_0x1b4c('0x2d')](0x4)+'.mp3');var _0x306dd0;return aws[_0x1b4c('0x7b')](_0x3cc4b3,_0x1bbeda,_0xbf5ccd,_0x47eadf,_0x3daf63,_0x36fe78,_0x360ecf)[_0x1b4c('0x3e')](function(){_0x306dd0=path['resolve'](__dirname,_0x1b4c('0x2c'),rs[_0x1b4c('0x2d')](0x4)+'.wav');return convertFile(_0x360ecf,_0x306dd0);})[_0x1b4c('0x3e')](function(){try{fs[_0x1b4c('0x22')](_0x360ecf);fs[_0x1b4c('0x31')](_0x306dd0,'777');}catch(_0x3ad8bb){logger[_0x1b4c('0x21')](_0x3ad8bb);}return _0x306dd0['split']('.')[0x0];});};exports[_0x1b4c('0x7c')]=function(_0x36c517,_0x5eed33,_0x83abe,_0x4cff92,_0x458a8e,_0x2684cf){return aws[_0x1b4c('0x7d')](_0x36c517,_0x5eed33,_0x83abe,_0x4cff92,_0x458a8e,_0x2684cf)[_0x1b4c('0x3e')](function(_0x1a1f58){logger[_0x1b4c('0x1f')](JSON[_0x1b4c('0x47')](_0x1a1f58));return _0x1a1f58;});};exports[_0x1b4c('0x7e')]=function(_0x4bed98,_0x5d1f12,_0x51ae96,_0x2737e7){var _0x2741e6=util[_0x1b4c('0x7f')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4bed98,encodeURIComponent(_0x5d1f12),_0x51ae96,_0x2737e7);var _0x5afe16=path[_0x1b4c('0x2b')](__dirname,_0x1b4c('0x2c'),rs[_0x1b4c('0x2d')](0x4)+'.mp3');var _0x5bfc4e;return downloadFile(_0x2741e6,_0x5afe16)['then'](function(){_0x5bfc4e=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x5afe16,_0x5bfc4e);})[_0x1b4c('0x3e')](function(){try{fs[_0x1b4c('0x22')](_0x5afe16);fs['chmodSync'](_0x5bfc4e,_0x1b4c('0x32'));}catch(_0x56fdf2){logger[_0x1b4c('0x21')](_0x56fdf2);}return _0x5bfc4e[_0x1b4c('0x33')]('.')[0x0];});};exports['ispeechASR']=function(_0x3fa554,_0x4c2f5c,_0x2fb641,_0x3392e7){var _0x5a24da=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4c2f5c,_0x2fb641,base64Encode(_0x3fa554),_0x3392e7?util[_0x1b4c('0x7f')](_0x1b4c('0x80'),encodeURIComponent(_0x3392e7)):_0x1b4c('0x81'));return uploadFile(_0x5a24da)[_0x1b4c('0x3e')](function(_0x3b51ac){return querystring[_0x1b4c('0xb')](_0x3b51ac);});};exports[_0x1b4c('0x82')]=function(_0x35f961,_0x594425){return sestek[_0x1b4c('0x83')](_0x35f961,_0x594425)[_0x1b4c('0x3e')](function(_0x3300da){logger[_0x1b4c('0x1f')](JSON['stringify'](_0x3300da));var _0x431adc={'speech':_0x3300da[_0x1b4c('0x84')],'action':_0x3300da[_0x1b4c('0x85')]?_0x3300da['channelData'][_0x1b4c('0x86')]:undefined,'actiondata':_0x3300da[_0x1b4c('0x85')]?_0x3300da[_0x1b4c('0x85')]['CustomActionData']:undefined};if(_0x3300da[_0x1b4c('0x85')]&&_0x3300da['channelData'][_0x1b4c('0x87')]){return base64Decode(_0x3300da[_0x1b4c('0x85')][_0x1b4c('0x87')]['Data'],path[_0x1b4c('0x2b')](__dirname,_0x1b4c('0x2c'),rs[_0x1b4c('0x2d')](0x4)+_0x1b4c('0x2e')))['then'](function(_0x162095){_0x431adc[_0x1b4c('0x88')]=_0x162095;return _0x431adc;});}return _0x431adc;});};exports[_0x1b4c('0x89')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index aa6ea79..b52b960 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 _0x0909=['./nda','exports'];(function(_0x5e3f4d,_0x501fb5){var _0x360e1b=function(_0x1f4bc8){while(--_0x1f4bc8){_0x5e3f4d['push'](_0x5e3f4d['shift']());}};_0x360e1b(++_0x501fb5);}(_0x0909,0x150));var _0x9090=function(_0x4060eb,_0x12b228){_0x4060eb=_0x4060eb-0x0;var _0x2ee246=_0x0909[_0x4060eb];return _0x2ee246;};var nda=require(_0x9090('0x0'));module[_0x9090('0x1')]={'nda':nda}; \ No newline at end of file +var _0xb027=['./nda','exports'];(function(_0x8b1a5e,_0x2744eb){var _0x1146b1=function(_0x5a9f50){while(--_0x5a9f50){_0x8b1a5e['push'](_0x8b1a5e['shift']());}};_0x1146b1(++_0x2744eb);}(_0xb027,0x15a));var _0x7b02=function(_0xe1066,_0x263690){_0xe1066=_0xe1066-0x0;var _0x5a731f=_0xb027[_0xe1066];return _0x5a731f;};var nda=require(_0x7b02('0x0'));module[_0x7b02('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 fa89e90..6709435 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 _0x8721=['then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','body','CustomAction','CustomActionData','info','request-promise','url','../../../../../config/logger','resolve','ndauth_url','/token','password'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x8721,0xd9));var _0x1872=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x8721[_0x35d4e9];return _0x5c2770;};'use strict';var rp=require(_0x1872('0x0'));var url=require(_0x1872('0x1'));var logger=require(_0x1872('0x2'))('agi');module['exports']=function(_0x43f8e9,_0x532ce1){var _0x4e2e8f={'method':'POST','uri':url[_0x1872('0x3')](_0x532ce1[_0x1872('0x4')],_0x1872('0x5')),'form':{'grant_type':'password','username':_0x532ce1['username'],'password':_0x532ce1[_0x1872('0x6')]},'json':!![]};return rp(_0x4e2e8f)[_0x1872('0x7')](function(_0x4230d7){var _0x4d019e={'method':_0x1872('0x8'),'uri':url[_0x1872('0x3')](_0x532ce1[_0x1872('0x9')],_0x1872('0xa')),'body':{'type':_0x532ce1[_0x1872('0xb')]||_0x1872('0xc'),'channelId':_0x1872('0xd'),'conversation':{'id':_0x43f8e9[_0x1872('0xe')]},'from':{'id':_0x43f8e9[_0x1872('0xf')],'name':_0x43f8e9[_0x1872('0x10')]},'recipient':{'id':_0x43f8e9[_0x1872('0x11')],'name':_0x43f8e9['extension']},'text':_0x532ce1[_0x1872('0x12')],'channelData':{}},'headers':{'Authorization':_0x1872('0x13')+_0x4230d7[_0x1872('0x14')]},'json':!![]};if(_0x532ce1[_0x1872('0x15')]){_0x4d019e['body'][_0x1872('0x16')][_0x1872('0x17')]=_0x532ce1[_0x1872('0x15')];}if(_0x532ce1[_0x1872('0x18')]=='1'){_0x4d019e['body']['channelData'][_0x1872('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1872('0x1a')};}if(_0x532ce1[_0x1872('0x1b')]){_0x4d019e[_0x1872('0x1c')][_0x1872('0x16')][_0x1872('0x1d')]=_0x532ce1['custom_action'];if(_0x532ce1['custom_action_data']){_0x4d019e[_0x1872('0x1c')][_0x1872('0x16')][_0x1872('0x1e')]=_0x532ce1['custom_action_data'];}}logger[_0x1872('0x1f')](JSON['stringify'](_0x4d019e));return rp(_0x4d019e);});}; \ No newline at end of file +var _0x1978=['ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','project','ProjectName','ndagenerate_audio','body','channelData','audio/wav','CustomAction','custom_action_data','CustomActionData','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x46561f,_0x287831){var _0x3dcc63=function(_0x562ed7){while(--_0x562ed7){_0x46561f['push'](_0x46561f['shift']());}};_0x3dcc63(++_0x287831);}(_0x1978,0x174));var _0x8197=function(_0x47776c,_0x2778cb){_0x47776c=_0x47776c-0x0;var _0x3fa1ef=_0x1978[_0x47776c];return _0x3fa1ef;};'use strict';var rp=require('request-promise');var url=require(_0x8197('0x0'));var logger=require(_0x8197('0x1'))(_0x8197('0x2'));module[_0x8197('0x3')]=function(_0x203bf1,_0x2828d2){var _0x38fffe={'method':_0x8197('0x4'),'uri':url[_0x8197('0x5')](_0x2828d2[_0x8197('0x6')],'/token'),'form':{'grant_type':_0x8197('0x7'),'username':_0x2828d2[_0x8197('0x8')],'password':_0x2828d2[_0x8197('0x7')]},'json':!![]};return rp(_0x38fffe)[_0x8197('0x9')](function(_0x3e8799){var _0x1bc265={'method':_0x8197('0x4'),'uri':url[_0x8197('0x5')](_0x2828d2[_0x8197('0xa')],_0x8197('0xb')),'body':{'type':_0x2828d2[_0x8197('0xc')]||_0x8197('0xd'),'channelId':_0x8197('0xe'),'conversation':{'id':_0x203bf1[_0x8197('0xf')]},'from':{'id':_0x203bf1[_0x8197('0x10')],'name':_0x203bf1['calleridname']},'recipient':{'id':_0x203bf1[_0x8197('0x11')],'name':_0x203bf1[_0x8197('0x12')]},'text':_0x2828d2[_0x8197('0x13')],'channelData':{}},'headers':{'Authorization':_0x8197('0x14')+_0x3e8799[_0x8197('0x15')]},'json':!![]};if(_0x2828d2[_0x8197('0x16')]){_0x1bc265['body']['channelData'][_0x8197('0x17')]=_0x2828d2[_0x8197('0x16')];}if(_0x2828d2[_0x8197('0x18')]=='1'){_0x1bc265[_0x8197('0x19')][_0x8197('0x1a')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8197('0x1b')};}if(_0x2828d2['custom_action']){_0x1bc265[_0x8197('0x19')]['channelData'][_0x8197('0x1c')]=_0x2828d2['custom_action'];if(_0x2828d2[_0x8197('0x1d')]){_0x1bc265[_0x8197('0x19')]['channelData'][_0x8197('0x1e')]=_0x2828d2['custom_action_data'];}}logger['info'](JSON[_0x8197('0x1f')](_0x1bc265));return rp(_0x1bc265);});}; \ 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 25a968b..dda0510 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 _0x6971=['exports'];(function(_0x1e1218,_0x218085){var _0x4e8a0c=function(_0x339898){while(--_0x339898){_0x1e1218['push'](_0x1e1218['shift']());}};_0x4e8a0c(++_0x218085);}(_0x6971,0xbc));var _0x1697=function(_0x5a0112,_0x44f7d2){_0x5a0112=_0x5a0112-0x0;var _0x3bb9f8=_0x6971[_0x5a0112];return _0x3bb9f8;};'use strict';var asr=require('./lib/api');module[_0x1697('0x0')]=function(_0x26f046,_0x1118c3,_0x40a2fd,_0x333dd7){return asr(_0x26f046,_0x1118c3,_0x40a2fd,_0x333dd7);}; \ No newline at end of file +var _0x0eb4=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0eb4,0x191));var _0x40eb=function(_0x17be96,_0x526bbf){_0x17be96=_0x17be96-0x0;var _0x485de1=_0x0eb4[_0x17be96];return _0x485de1;};'use strict';var asr=require(_0x40eb('0x0'));module[_0x40eb('0x1')]=function(_0x3b9f87,_0x529120,_0xc380f1,_0x522991){return asr(_0x3b9f87,_0x529120,_0xc380f1,_0x522991);}; \ 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 40c1db3..3c318b9 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 _0x449b=['lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','createReadStream','data','Tilde\x20ASR\x20send\x20error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','stringify','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','close','bluebird'];(function(_0xce287c,_0x533fe7){var _0x53cae7=function(_0x15068e){while(--_0x15068e){_0xce287c['push'](_0xce287c['shift']());}};_0x53cae7(++_0x533fe7);}(_0x449b,0x1bb));var _0xb449=function(_0x516ca1,_0x51ac46){_0x516ca1=_0x516ca1-0x0;var _0x572a65=_0x449b[_0x516ca1];return _0x572a65;};'use strict';var BPromise=require(_0xb449('0x0'));var _=require(_0xb449('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb449('0x2'));var crypto=require(_0xb449('0x3'));var logger=require(_0xb449('0x4'))(_0xb449('0x5'));module[_0xb449('0x6')]=function(_0x2a6961,_0x4907c2,_0x17c4e6,_0x3e2b09){return new BPromise(function(_0x29025d,_0x28b11a){logger[_0xb449('0x7')](_0xb449('0x8'),_0x3e2b09||_0xb449('0x9'));var _0x20c32a=new WebSocket(_0x3e2b09||_0xb449('0x9'),{'perMessageDeflate':![]});var _0x572809='';var _0x17ec23='0';var _0x401c52='1';var _0x168f25='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5d7b8e(_0x511740){var _0x5d2304=crypto[_0xb449('0xa')](_0xb449('0xb'));_0x5d2304[_0xb449('0xc')](_0x511740);return _0x5d2304[_0xb449('0xd')]('hex');}function _0x40c17d(){try{logger[_0xb449('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x539e40=moment()['unix']();var _0x253a45=_0x5d7b8e(_0x539e40+_0x4907c2+_0x17c4e6);_0x20c32a['send'](JSON['stringify']({'appID':_0x4907c2,'timestamp':_0x539e40,'appKey':_0x253a45}));var _0x5d5dbc=fs[_0xb449('0xe')](_0x2a6961);_0x5d5dbc['on'](_0xb449('0xf'),function(_0x53c1f7){_0x20c32a['send'](_0x53c1f7);});_0x5d5dbc['on']('close',function(){_0x20c32a['send']('EOS');});}catch(_0xf79b68){logger['error'](_0xb449('0x10'),JSON['stringify'](_0xf79b68));_0x20c32a['terminate']();}}function _0x12b857(_0x4f2e27){try{if(_0x4f2e27){var _0x222d2d=JSON['parse'](_0x4f2e27);switch(_0x222d2d[_0xb449('0x11')]){case 0x0:if(_0x222d2d[_0xb449('0x12')]){if(_0x222d2d['result'][_0xb449('0x13')]){logger['info'](_0xb449('0x14'),JSON['stringify'](_0x222d2d['result'][_0xb449('0x15')]));_0x572809=_0x222d2d[_0xb449('0x12')][_0xb449('0x15')][0x0]['transcript'];_0x17ec23=_0x222d2d['result'][_0xb449('0x15')][0x0]['likelihood'];_0x401c52='0';_0x168f25=_0xb449('0x16');_0x20c32a['terminate']();}}break;case 0x1:logger[_0xb449('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x401c52='1';_0x168f25=_0xb449('0x17');break;case 0x2:logger['info'](_0xb449('0x18'));_0x401c52='2';_0x168f25='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xb449('0x7')](_0xb449('0x19'));_0x401c52='9';_0x168f25=_0xb449('0x19');break;case 0xa:logger[_0xb449('0x7')]('Authentication\x20failed.');_0x401c52='10';_0x168f25=_0xb449('0x1a');break;case 0xb:logger[_0xb449('0x7')](_0xb449('0x1b'));_0x401c52='11';_0x168f25='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x14d47f){logger['error'](_0xb449('0x1c'),JSON[_0xb449('0x1d')](_0x14d47f));_0x20c32a['terminate']();}}function _0x237371(){logger[_0xb449('0x7')](_0xb449('0x1e'));_0x29025d({'transcript':_0x572809,'confidence':_0x17ec23,'status':_0x401c52,'status_message':_0x168f25});}function _0x1a35dc(_0x2e0feb){logger[_0xb449('0x1f')](_0xb449('0x20'));if(!_['isNil'](_0x2e0feb)){logger['error'](_[_0xb449('0x21')](_0x2e0feb)?JSON['stringify'](_0x2e0feb):_0x2e0feb);}}_0x20c32a['on'](_0xb449('0x22'),_0x40c17d);_0x20c32a['on'](_0xb449('0x23'),_0x12b857);_0x20c32a['on'](_0xb449('0x24'),_0x237371);_0x20c32a['on'](_0xb449('0x1f'),_0x1a35dc);});}; \ No newline at end of file +var _0x908a=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','message','bluebird','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','unix','send','data','close','EOS','Tilde\x20ASR\x20send\x20error','stringify','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.'];(function(_0x25622f,_0x4fb9f9){var _0x44f990=function(_0x38626e){while(--_0x38626e){_0x25622f['push'](_0x25622f['shift']());}};_0x44f990(++_0x4fb9f9);}(_0x908a,0x1a8));var _0xa908=function(_0x17c260,_0x53028c){_0x17c260=_0x17c260-0x0;var _0x518453=_0x908a[_0x17c260];return _0x518453;};'use strict';var BPromise=require(_0xa908('0x0'));var _=require(_0xa908('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa908('0x2'));var crypto=require(_0xa908('0x3'));var logger=require('../../../../../../config/logger')(_0xa908('0x4'));module[_0xa908('0x5')]=function(_0x5c75ef,_0x563506,_0x42bc87,_0x314cb7){return new BPromise(function(_0x18c374,_0x231674){logger[_0xa908('0x6')](_0xa908('0x7'),_0x314cb7||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1cee85=new WebSocket(_0x314cb7||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x362fc3='';var _0x41e91a='0';var _0x4deb37='1';var _0x3bac08=_0xa908('0x8');function _0x323064(_0x511e07){var _0x367351=crypto[_0xa908('0x9')](_0xa908('0xa'));_0x367351['update'](_0x511e07);return _0x367351[_0xa908('0xb')]('hex');}function _0x2f2ce5(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x4e56fa=moment()[_0xa908('0xc')]();var _0x41d8d3=_0x323064(_0x4e56fa+_0x563506+_0x42bc87);_0x1cee85[_0xa908('0xd')](JSON['stringify']({'appID':_0x563506,'timestamp':_0x4e56fa,'appKey':_0x41d8d3}));var _0x4f83da=fs['createReadStream'](_0x5c75ef);_0x4f83da['on'](_0xa908('0xe'),function(_0x37b3cb){_0x1cee85[_0xa908('0xd')](_0x37b3cb);});_0x4f83da['on'](_0xa908('0xf'),function(){_0x1cee85[_0xa908('0xd')](_0xa908('0x10'));});}catch(_0xa594af){logger['error'](_0xa908('0x11'),JSON[_0xa908('0x12')](_0xa594af));_0x1cee85[_0xa908('0x13')]();}}function _0x911ad4(_0x1f8cd9){try{if(_0x1f8cd9){var _0x534943=JSON[_0xa908('0x14')](_0x1f8cd9);switch(_0x534943[_0xa908('0x15')]){case 0x0:if(_0x534943[_0xa908('0x16')]){if(_0x534943['result'][_0xa908('0x17')]){logger[_0xa908('0x6')](_0xa908('0x18'),JSON[_0xa908('0x12')](_0x534943[_0xa908('0x16')][_0xa908('0x19')]));_0x362fc3=_0x534943[_0xa908('0x16')][_0xa908('0x19')][0x0][_0xa908('0x1a')];_0x41e91a=_0x534943['result'][_0xa908('0x19')][0x0][_0xa908('0x1b')];_0x4deb37='0';_0x3bac08=_0xa908('0x1c');_0x1cee85[_0xa908('0x13')]();}}break;case 0x1:logger[_0xa908('0x6')](_0xa908('0x8'));_0x4deb37='1';_0x3bac08='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0xa908('0x1d'));_0x4deb37='2';_0x3bac08='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xa908('0x6')](_0xa908('0x1e'));_0x4deb37='9';_0x3bac08=_0xa908('0x1e');break;case 0xa:logger['info']('Authentication\x20failed.');_0x4deb37='10';_0x3bac08=_0xa908('0x1f');break;case 0xb:logger['info'](_0xa908('0x20'));_0x4deb37='11';_0x3bac08='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x6e6e54){logger[_0xa908('0x21')](_0xa908('0x22'),JSON['stringify'](_0x6e6e54));_0x1cee85[_0xa908('0x13')]();}}function _0x189863(){logger[_0xa908('0x6')](_0xa908('0x23'));_0x18c374({'transcript':_0x362fc3,'confidence':_0x41e91a,'status':_0x4deb37,'status_message':_0x3bac08});}function _0x3e3570(_0x2f97cd){logger[_0xa908('0x21')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x2f97cd)){logger[_0xa908('0x21')](_[_0xa908('0x24')](_0x2f97cd)?JSON[_0xa908('0x12')](_0x2f97cd):_0x2f97cd);}}_0x1cee85['on']('open',_0x2f2ce5);_0x1cee85['on'](_0xa908('0x25'),_0x911ad4);_0x1cee85['on'](_0xa908('0xf'),_0x189863);_0x1cee85['on'](_0xa908('0x21'),_0x3e3570);});}; \ 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 be596ca..de776eb 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 _0x6020=['exports','./asr'];(function(_0x2738e9,_0x5bf2f8){var _0x3dda42=function(_0x30ccf2){while(--_0x30ccf2){_0x2738e9['push'](_0x2738e9['shift']());}};_0x3dda42(++_0x5bf2f8);}(_0x6020,0x69));var _0x0602=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x6020[_0x3ee1fe];return _0x1ae57a;};var asr=require(_0x0602('0x0'));module[_0x0602('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0b6b=['./asr'];(function(_0x24d137,_0x5bf0b2){var _0x522295=function(_0xa3356e){while(--_0xa3356e){_0x24d137['push'](_0x24d137['shift']());}};_0x522295(++_0x5bf0b2);}(_0x0b6b,0xf8));var _0xb0b6=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x0b6b[_0x31ced5];return _0x10d9e5;};var asr=require(_0xb0b6('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 e445fda..8f4bd12 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(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x3266c1,_0x42d54e){var _0x180226=function(_0x504974){while(--_0x504974){_0x3266c1['push'](_0x3266c1['shift']());}};_0x180226(++_0x42d54e);}(_0x34e8,0x12c));var _0x834e=function(_0x319e79,_0x142f12){_0x319e79=_0x319e79-0x0;var _0x453e3a=_0x34e8[_0x319e79];return _0x453e3a;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 340ea2d..81ca6d8 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 _0xfd28=['sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_voice','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','length','isPlainObject','isArray','saveRestApiResult','%s.%s','replaceObjectAllVariables','split','replaceAll','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','sip_id','getUser','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','.wav','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','opts','url','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','variable_id','getData','response','test','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','no\x20find\x20by\x20configured','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','indexOf','XMCS-QUEUE','toLowerCase','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','number','replace','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','Smtp','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','randomstring','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','mailRpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','rpc','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','isNil','agentUnpause','agent','agentLogout','agentLogin','LOCAL','shellCommand','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','method','timeout','includes','POST','PUT','toUpperCase','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','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language'];(function(_0x5cce01,_0x176354){var _0x4693ca=function(_0x37ca44){while(--_0x37ca44){_0x5cce01['push'](_0x5cce01['shift']());}};_0x4693ca(++_0x176354);}(_0xfd28,0x148));var _0x8fd2=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xfd28[_0xa148b7];return _0x51efd3;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x8fd2('0x0'));var sh=require(_0x8fd2('0x1'));var odbc=require('odbc')();var rs=require(_0x8fd2('0x2'));var moment=require('moment');var Mustache=require(_0x8fd2('0x3'));var rp=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('agi');var config=require(_0x8fd2('0x6'));var scripts=require(_0x8fd2('0x7'));var FILES_PATH=_0x8fd2('0x8');var recursiveMapAttributes=[_0x8fd2('0x9'),_0x8fd2('0xa')];var verticesWithRetry=['menu','getdigits',_0x8fd2('0xb')];var AGIVertices=function(_0x466c3d,_0x5c7e16,_0x4d794a){this[_0x8fd2('0xc')]=_0x466c3d;this['rpc']=_0x5c7e16;this[_0x8fd2('0xd')]=_0x4d794a;};AGIVertices['prototype'][_0x8fd2('0xe')]=function(_0x4fdf0b,_0x1ca2a1){this['rpc'][_0x8fd2('0xf')](_0x4fdf0b)['then'](function(_0x4706b2){_0x1ca2a1(null,_0x4706b2?_0x4706b2[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0xa6d7ca){_0x1ca2a1(_0xa6d7ca);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x13')]=function(_0x1e214c,_0xf22ae){this[_0x8fd2('0x14')][_0x8fd2('0x15')](_0x1e214c)[_0x8fd2('0x16')](function(_0x6b8ef){_0xf22ae(null,_0x6b8ef?_0x6b8ef[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0xa65b4){_0xf22ae(_0xa65b4);});};AGIVertices['prototype'][_0x8fd2('0x17')]=function(_0x5ef478,_0x4f0b17){this['rpc'][_0x8fd2('0x18')](_0x5ef478)[_0x8fd2('0x16')](function(_0x1ced10){_0x4f0b17(null,_0x1ced10?_0x1ced10[_0x8fd2('0x10')]:![]);})['catch'](function(_0xabbeb4){_0x4f0b17(_0xabbeb4);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x19')]=function(_0x36e675,_0x14641a){this['rpc']['getSquareOdbcById'](_0x36e675)[_0x8fd2('0x16')](function(_0x4a2002){_0x14641a(null,_0x4a2002?_0x4a2002[_0x8fd2('0x1a')]:![]);})['catch'](function(_0x1631c6){_0x14641a(_0x1631c6);});};AGIVertices[_0x8fd2('0x12')]['getUser']=function(_0x122b60,_0x4c2be8){this[_0x8fd2('0x14')][_0x8fd2('0x1b')](_0x122b60)['then'](function(_0x1c925c){_0x4c2be8(null,_0x1c925c?_0x1c925c[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0x490ea5){_0x4c2be8(_0x490ea5);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x1c')]=function(_0x27d03b,_0x4742cf){this[_0x8fd2('0x14')][_0x8fd2('0x1d')](_0x27d03b)[_0x8fd2('0x16')](function(_0x398925){_0x4742cf(null,_0x398925?_0x398925[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0x3392fb){_0x4742cf(_0x3392fb);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x1e')]=function(_0x512e5a,_0x4c6af7){var _0x345bc3=this;this[_0x8fd2('0x14')][_0x8fd2('0x1f')](_0x512e5a)['then'](function(_0x2f26ae){_0x4c6af7(null,_0x2f26ae?_0x345bc3[_0x8fd2('0x20')](_0x2f26ae[_0x8fd2('0x21')]):![]);})[_0x8fd2('0x11')](function(_0x119439){_0x4c6af7(_0x119439);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x22')]=function(_0x5bfaa4,_0xe76676){this[_0x8fd2('0x14')][_0x8fd2('0x23')](_0x5bfaa4)[_0x8fd2('0x16')](function(_0x313902){_0xe76676(null,_0x313902?_0x313902:![]);})[_0x8fd2('0x11')](function(_0x39df3a){_0xe76676(_0x39df3a);});};AGIVertices['prototype']['sendMailMessage']=function(_0x5144ba,_0x422f3c,_0x216350){this[_0x8fd2('0xd')][_0x8fd2('0x24')](_0x5144ba,_0x422f3c)['then'](function(){_0x216350(null);})['catch'](function(_0x3ebeab){_0x216350(_0x3ebeab);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x25')]=function(_0x18fe4e,_0x121fd4){this['rpc'][_0x8fd2('0x26')](_0x18fe4e)['then'](function(_0x20a9d0){if(_0x20a9d0){if(_0x20a9d0['IntervalId']){_0x121fd4(null,[_0x20a9d0[_0x8fd2('0x27')]]);}else{_0x121fd4(null,_['map'](_0x20a9d0[_0x8fd2('0x28')],_0x8fd2('0x27')));}}else{_0x121fd4(null,![]);}})[_0x8fd2('0x11')](function(_0x52422c){_0x121fd4(_0x52422c);});};AGIVertices[_0x8fd2('0x12')]['getSoundPath']=function(_0x11a71d){return util[_0x8fd2('0x29')](_0x8fd2('0x2a'),FILES_PATH,_0x11a71d);};AGIVertices['prototype'][_0x8fd2('0x2b')]=function(_0x199a85,_0x21adc6,_0x58ce31){odbc[_0x8fd2('0x2c')](_0x199a85,function(_0x1f4428){if(_0x1f4428){logger[_0x8fd2('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x1f4428);_0x58ce31(_0x1f4428);}else{logger[_0x8fd2('0x2e')](_0x8fd2('0x2f'));odbc['query'](_0x21adc6,function(_0x16b1f3,_0x130072){if(_0x16b1f3){logger[_0x8fd2('0x2e')](_0x8fd2('0x30'),_0x21adc6);_0x58ce31(_0x16b1f3);}else{logger[_0x8fd2('0x2e')](_0x8fd2('0x31'),_0x21adc6);odbc[_0x8fd2('0x32')](function(_0x5e6140){if(_0x5e6140){logger[_0x8fd2('0x2d')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5e6140);}_0x58ce31(null,_0x130072);});}});}});};AGIVertices['prototype'][_0x8fd2('0x33')]=function(_0xb2c8cc,_0x467f71){this[_0x8fd2('0x14')][_0x8fd2('0x34')](_0xb2c8cc)[_0x8fd2('0x16')](function(_0x5d3727){_0x467f71(null,_0x5d3727?_0x5d3727:![]);})['catch'](function(_0x2df1da){_0x467f71(_0x2df1da);});};AGIVertices['prototype']['createSmsMessage']=function(_0x1c9962,_0x346d93){this[_0x8fd2('0x14')][_0x8fd2('0x35')](_0x1c9962)['then'](function(_0x39cd8e){_0x346d93(null,_0x39cd8e);})[_0x8fd2('0x11')](function(_0x1530ac){_0x346d93(_0x1530ac);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x36')]=function(_0x1de9aa,_0xb1938a,_0x5a60e6){this[_0x8fd2('0x14')][_0x8fd2('0x36')]({'uniqueid':this[_0x8fd2('0xc')][_0x8fd2('0x37')],'node':_0x1de9aa[_0x8fd2('0x38')],'application':_0x1de9aa[_0x8fd2('0x39')],'data':_0xb1938a||null,'project_name':this[_0x8fd2('0xc')]['arg_1'],'callerid':this[_0x8fd2('0xc')][_0x8fd2('0x3a')]})[_0x8fd2('0x16')](function(_0x3ca3dd){if(_0x5a60e6){_0x5a60e6(null,_0x3ca3dd);}})[_0x8fd2('0x11')](function(_0x3fa3be){if(_0x5a60e6){_0x5a60e6(_0x3fa3be);}});};AGIVertices[_0x8fd2('0x12')]['createSquareRecording']=function(_0x383964,_0x515f66,_0x43017d,_0x5c7440){this[_0x8fd2('0x14')][_0x8fd2('0x3b')]({'uniqueid':this[_0x8fd2('0xc')]['uniqueid'],'callerid':this[_0x8fd2('0xc')][_0x8fd2('0x3a')],'calleridname':this[_0x8fd2('0xc')]['calleridname'],'context':this[_0x8fd2('0xc')]['context'],'extension':this[_0x8fd2('0xc')][_0x8fd2('0x3c')],'priority':this[_0x8fd2('0xc')][_0x8fd2('0x3d')],'accountcode':this[_0x8fd2('0xc')][_0x8fd2('0x3e')],'dnid':this[_0x8fd2('0xc')][_0x8fd2('0x3f')],'projectName':this[_0x8fd2('0xc')][_0x8fd2('0x40')],'saveName':_0x515f66,'filename':_0x383964[_0x8fd2('0x41')]||_0x515f66,'savePath':_0x43017d})[_0x8fd2('0x16')](function(_0xd3d8cb){_0x5c7440(null,_0xd3d8cb);})[_0x8fd2('0x11')](function(_0x109d49){_0x5c7440(_0x109d49);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x42')]=function(_0x2a2c69,_0x2fdbe5,_0x57084b,_0x50f894,_0x43a9a8){this[_0x8fd2('0x14')][_0x8fd2('0x42')]({'uniqueid':this['channel']['uniqueid'],'body':_0x2a2c69,'direction':_0x2fdbe5,'providerName':_0x57084b,'providerResponse':_0x50f894})[_0x8fd2('0x16')](function(_0x5603e9){if(_0x43a9a8){_0x43a9a8(null,_0x5603e9);}})[_0x8fd2('0x11')](function(_0x1295c4){if(_0x43a9a8){_0x43a9a8(_0x1295c4);}});};AGIVertices[_0x8fd2('0x12')]['createCmContact']=function(_0x2251d9,_0x1ec30e){this['rpc'][_0x8fd2('0x43')]({'firstName':_[_0x8fd2('0x44')](_0x2251d9[_0x8fd2('0x10')])||_['isNil'](_0x2251d9[_0x8fd2('0x10')])?_0x8fd2('0x45')+Math[_0x8fd2('0x46')]():_0x2251d9[_0x8fd2('0x10')],'lastName':_[_0x8fd2('0x44')](_0x2251d9[_0x8fd2('0x47')])||_['isNil'](_0x2251d9['lastName'])?null:_0x2251d9[_0x8fd2('0x47')],'phone':_0x2251d9[_0x8fd2('0x48')],'ListId':_0x2251d9['list_id'],'scheduledat':_0x2251d9[_0x8fd2('0x49')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x8fd2('0x4a'),'description':_0x8fd2('0x4b')+_0x2251d9[_0x8fd2('0x49')][_0x8fd2('0x4c')](),'priority':_0x2251d9[_0x8fd2('0x4d')]})[_0x8fd2('0x16')](function(_0x52c912){_0x1ec30e(null,_0x52c912);})[_0x8fd2('0x11')](function(_0x1a2ffc){_0x1ec30e(_0x1a2ffc);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x4e')]=function(_0x24260f,_0x51b586){this['rpc']['getPauseById'](_0x24260f)['then'](function(_0x57b8f6){_0x51b586(null,_0x57b8f6?_0x57b8f6[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0x18ee30){_0x51b586(_0x18ee30);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x4f')]=function(_0x25abdc,_0x460f31,_0x4a81ab){var _0x5e5f79={'role':'agent'};_0x5e5f79[_0x25abdc]=this[_0x8fd2('0xc')][_0x8fd2('0x3a')];this['rpc']['agentPause'](_0x5e5f79,_0x460f31,this[_0x8fd2('0xc')][_0x8fd2('0x37')])[_0x8fd2('0x16')](function(_0x30a952){_0x4a81ab(null,_[_0x8fd2('0x50')](_0x30a952)?![]:!![]);})['catch'](function(_0x2196d3){logger[_0x8fd2('0x2d')](_0x2196d3);_0x4a81ab(null,![]);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x51')]=function(_0x5446e0,_0x9c5a26){var _0x3bd8ce={'role':_0x8fd2('0x52')};_0x3bd8ce[_0x5446e0]=this[_0x8fd2('0xc')]['callerid'];this['rpc']['agentUnpause'](_0x3bd8ce)[_0x8fd2('0x16')](function(_0x19e68d){_0x9c5a26(null,_[_0x8fd2('0x50')](_0x19e68d)?![]:!![]);})[_0x8fd2('0x11')](function(_0x116a1d){logger['error'](_0x116a1d);_0x9c5a26(null,![]);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x53')]=function(_0x538236,_0x25123f){var _0x164991={'role':_0x8fd2('0x52')};_0x164991[_0x538236]=this[_0x8fd2('0xc')][_0x8fd2('0x3a')];this['rpc'][_0x8fd2('0x53')](_0x164991)[_0x8fd2('0x16')](function(_0x21f1a7){_0x25123f(null,_[_0x8fd2('0x50')](_0x21f1a7)?![]:!![]);})[_0x8fd2('0x11')](function(_0x268724){logger[_0x8fd2('0x2d')](_0x268724);_0x25123f(null,![]);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x54')]=function(_0x4680f0,_0xf7c83a){var _0x4d0402={'role':_0x8fd2('0x52')};_0x4d0402[_0x4680f0]=this['channel'][_0x8fd2('0x3a')];var _0x237756=_0x4680f0!='internal'?util['format']('%s/%s@from-sip/n',_0x8fd2('0x55'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')]):undefined;this[_0x8fd2('0x14')][_0x8fd2('0x54')](_0x4d0402,_0x237756)[_0x8fd2('0x16')](function(_0x52a332){_0xf7c83a(null,_[_0x8fd2('0x50')](_0x52a332)?![]:!![]);})[_0x8fd2('0x11')](function(_0x510553){logger[_0x8fd2('0x2d')](_0x510553);_0xf7c83a(null,![]);});};AGIVertices['prototype'][_0x8fd2('0x56')]=function(_0x25d69d,_0x9eccb3){sh[_0x8fd2('0x57')](_[_0x8fd2('0x58')](_0x25d69d),function(_0x4aaa16,_0x1a1b40){var _0xfb0041=_0x1a1b40['replace'](/(\r\n|\n|\r)/gm,'');_0x9eccb3(null,_0xfb0041);});};AGIVertices[_0x8fd2('0x12')]['googleCloudTTS']=function(_0x50c6a6,_0x433912){scripts[_0x8fd2('0x59')](_0x50c6a6['apiKey'],_0x50c6a6[_0x8fd2('0x5a')]||_0x8fd2('0x5b'),_0x50c6a6[_0x8fd2('0x5b')],_0x50c6a6['languageCode']||_0x8fd2('0x5c'),_0x50c6a6[_0x8fd2('0x5d')]||_0x8fd2('0x5e'),_0x50c6a6[_0x8fd2('0x5f')]||_0x8fd2('0x60'))[_0x8fd2('0x16')](function(_0x33603c){_0x433912(null,_0x33603c);})['catch'](function(_0x55f13b){_0x433912(_0x55f13b);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x61')]=function(_0x549af8,_0x500678){scripts['googleTTS'](_0x549af8['text'],_0x549af8['google_tts_language']||'en',0x1)[_0x8fd2('0x16')](function(_0x3b2d1a){_0x500678(null,_0x3b2d1a);})[_0x8fd2('0x11')](function(_0x37ad5c){_0x500678(_0x37ad5c);});};AGIVertices[_0x8fd2('0x12')]['restAPI']=function(_0x2fba70,_0x181634){var _0x3b94f9={'uri':_0x2fba70['url'],'method':_0x2fba70[_0x8fd2('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2fba70[_0x8fd2('0x63')])==='number'&&parseInt(_0x2fba70[_0x8fd2('0x63')])>=0x1?parseInt(_0x2fba70[_0x8fd2('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x8fd2('0x64')]([_0x8fd2('0x65'),_0x8fd2('0x66')],_0x3b94f9[_0x8fd2('0x62')][_0x8fd2('0x67')]())){try{_0x3b94f9['body']=_0x2fba70[_0x8fd2('0xa')]?JSON[_0x8fd2('0x68')](_0x2fba70[_0x8fd2('0xa')]):{};}catch(_0x1a924f){logger[_0x8fd2('0x2d')](_0x8fd2('0x69'),_0x1a924f);}}try{_0x3b94f9[_0x8fd2('0x6a')]=_0x2fba70['rawHeaders']?JSON[_0x8fd2('0x68')](_0x2fba70[_0x8fd2('0x9')]):{};}catch(_0x5dba4a){logger[_0x8fd2('0x2d')](_0x8fd2('0x6b'),_0x5dba4a);}if(_0x2fba70[_0x8fd2('0x6c')]){try{var _0x131ee8=require(_0x2fba70[_0x8fd2('0x6c')])[_0x8fd2('0x6d')](this,_0x3b94f9);_0x3b94f9[_0x8fd2('0x6e')]=Mustache[_0x8fd2('0x6f')](_0x2fba70['url'],_0x131ee8,{},['$$','$$']);if(_0x3b94f9[_0x8fd2('0x6a')]){_0x3b94f9['headers']=JSON['parse'](Mustache['render'](JSON[_0x8fd2('0x70')](_0x3b94f9['headers']),_0x131ee8,{},['$$','$$']));}if(_0x3b94f9[_0x8fd2('0x71')]){_0x3b94f9['body']=JSON['parse'](Mustache[_0x8fd2('0x6f')](JSON[_0x8fd2('0x70')](_0x3b94f9['body']),_0x131ee8,{},['$$','$$']));}}catch(_0x40fc80){logger[_0x8fd2('0x2d')](_0x8fd2('0x72'),_0x40fc80);}}rp(_0x3b94f9)[_0x8fd2('0x16')](function(_0x570b06){var _0x4ff263={'statusCode':_0x570b06[_0x8fd2('0x73')]||0xc8,'statusMessage':_0x570b06['statusMessage']||'OK','headers':_0x570b06[_0x8fd2('0x6a')]||{},'body':_0x570b06[_0x8fd2('0x71')]||{}};_0x181634(null,_0x4ff263);})['catch'](function(_0x1a96f7){var _0xc60005={'statusCode':_0x1a96f7[_0x8fd2('0x73')]||0x1f4,'statusMessage':_0x1a96f7[_0x8fd2('0x74')]||_0x8fd2('0x75'),'headers':_0x1a96f7[_0x8fd2('0x76')][_0x8fd2('0x6a')]||{},'body':_0x1a96f7['options'][_0x8fd2('0x71')]||{}};_0x181634(null,_0xc60005);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x77')]=function(_0x192f30,_0x47ac94){scripts[_0x8fd2('0x77')](this[_0x8fd2('0xc')][_0x8fd2('0x37')],_0x192f30[_0x8fd2('0x78')],_0x192f30['text'],_0x192f30['dialogflow_language']||'en')[_0x8fd2('0x16')](function(_0x5d3a54){_0x47ac94(null,_0x5d3a54);})['catch'](function(_0x2167ce){_0x47ac94(_0x2167ce);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x2710a5,_0x1f2770){scripts[_0x8fd2('0x79')](this[_0x8fd2('0xc')][_0x8fd2('0x37')],_0x2710a5[_0x8fd2('0x7a')],_0x2710a5[_0x8fd2('0x7b')],_0x2710a5['private_key'],_0x2710a5[_0x8fd2('0x5b')],_0x2710a5[_0x8fd2('0x7c')]||'en')[_0x8fd2('0x16')](function(_0x42f29e){_0x1f2770(null,_0x42f29e);})['catch'](function(_0x2a62b0){_0x1f2770(_0x2a62b0);});};AGIVertices['prototype']['sestekNDA']=function(_0x1a45d8,_0x23932a){scripts[_0x8fd2('0x7d')](this[_0x8fd2('0xc')],_0x1a45d8)[_0x8fd2('0x16')](function(_0xe90905){_0x23932a(null,_0xe90905);})[_0x8fd2('0x11')](function(_0x3e0d5f){_0x23932a(_0x3e0d5f);});};AGIVertices['prototype']['ispeechTTS']=function(_0x3a851e,_0xa32605){scripts[_0x8fd2('0x7e')](_0x3a851e[_0x8fd2('0x78')],_0x3a851e['text'],_0x3a851e[_0x8fd2('0x7f')]||_0x8fd2('0x5c'),_0x3a851e['speed'])[_0x8fd2('0x16')](function(_0x31128d){_0xa32605(null,_0x31128d);})['catch'](function(_0x191333){_0xa32605(_0x191333);});};AGIVertices[_0x8fd2('0x12')]['ispeechASR']=function(_0xb0d4a6,_0x26ffac,_0x2d2e4f){scripts[_0x8fd2('0x80')](_0x26ffac,_0xb0d4a6[_0x8fd2('0x78')],_0xb0d4a6[_0x8fd2('0x81')]||'en-US',this[_0x8fd2('0x82')](_0xb0d4a6[_0x8fd2('0x83')])?_0xb0d4a6[_0x8fd2('0x83')]:undefined)[_0x8fd2('0x16')](function(_0x36c809){_0x2d2e4f(null,_0x36c809);})[_0x8fd2('0x11')](function(_0x411a45){_0x2d2e4f(_0x411a45);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x84')]=function(_0x4640ba,_0x226b9d){scripts['awsPolly'](_0x4640ba['aws_access_key_id'],_0x4640ba[_0x8fd2('0x85')],_0x4640ba['aws_polly_region'],_0x4640ba[_0x8fd2('0x86')]||'Amy',_0x4640ba[_0x8fd2('0x5b')],_0x4640ba['aws_text_type']||'text')[_0x8fd2('0x16')](function(_0x3fbe9a){_0x226b9d(null,_0x3fbe9a);})[_0x8fd2('0x11')](function(_0x142937){_0x226b9d(_0x142937);});};AGIVertices['prototype']['awsLex']=function(_0x4c95b2,_0x3c89cf){scripts[_0x8fd2('0x87')](this[_0x8fd2('0xc')]['uniqueid'],_0x4c95b2[_0x8fd2('0x88')],_0x4c95b2[_0x8fd2('0x85')],_0x4c95b2['aws_lex_region'],_0x4c95b2['text'],_0x4c95b2[_0x8fd2('0x89')])['then'](function(_0x48eb26){_0x3c89cf(null,_0x48eb26);})[_0x8fd2('0x11')](function(_0x2ca20d){_0x3c89cf(_0x2ca20d);});};AGIVertices['prototype']['googleASR']=function(_0x39be64,_0x232b1d,_0x5f4bbf){scripts[_0x8fd2('0x8a')](_0x232b1d,_0x39be64[_0x8fd2('0x78')],_0x39be64[_0x8fd2('0x8b')]||_0x8fd2('0x5c'))[_0x8fd2('0x16')](function(_0x16846b){_0x5f4bbf(null,_0x16846b);})['catch'](function(_0x371f08){_0x5f4bbf(_0x371f08);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x8c')]=function(_0x17279f,_0x42bb94,_0x1c7dd9){scripts['tildeASR'](_0x42bb94,_0x17279f['appid'],_0x17279f[_0x8fd2('0x8d')],_0x17279f[_0x8fd2('0x6e')])[_0x8fd2('0x16')](function(_0x214be5){_0x1c7dd9(null,_0x214be5);})[_0x8fd2('0x11')](function(_0x4ec574){_0x1c7dd9(_0x4ec574);});};AGIVertices['prototype'][_0x8fd2('0x8e')]=function(_0x444ad3){var _0x241dd1=_['includes'](verticesWithRetry,_0x444ad3['agicommand'])?_0x444ad3:_[_0x8fd2('0x8f')](_0x444ad3);for(var _0x4df822 in _0x241dd1){if(_0x241dd1[_0x8fd2('0x90')](_0x4df822)){if(_0x241dd1[_0x4df822]&&_[_0x8fd2('0x91')](_0x241dd1[_0x4df822])){if(_['includes'](recursiveMapAttributes,_0x4df822)){_0x241dd1[_0x4df822]=this['replaceObjectAllVariables'](_0x241dd1[_0x4df822]);}else{_0x241dd1[_0x4df822]=this[_0x8fd2('0x92')](_0x241dd1[_0x4df822]);}}}}return _0x241dd1;};AGIVertices['prototype'][_0x8fd2('0x93')]=function(_0x479a35){for(var _0x1dc0bb in _0x479a35){if(_0x479a35[_0x8fd2('0x90')](_0x1dc0bb)){if(_['isPlainObject'](_0x479a35[_0x1dc0bb])){this['recursiveNodeIndex'](_0x479a35[_0x1dc0bb]);}else if(_['isArray'](_0x479a35[_0x1dc0bb])){for(var _0x3f3ddf=0x0;_0x3f3ddf<_0x479a35[_0x1dc0bb][_0x8fd2('0x94')];_0x3f3ddf++){this[_0x8fd2('0x93')](_0x479a35[_0x1dc0bb][_0x3f3ddf]);}}else if(_[_0x8fd2('0x91')](_0x479a35[_0x1dc0bb])){_0x479a35[_0x1dc0bb]=this[_0x8fd2('0x92')](_0x479a35[_0x1dc0bb]);}}}};AGIVertices[_0x8fd2('0x12')]['saveRestApiResult']=function(_0xe676a0,_0x445c80){for(var _0x512e07 in _0xe676a0){if(_0xe676a0[_0x8fd2('0x90')](_0x512e07)){if(_[_0x8fd2('0x95')](_0xe676a0[_0x512e07])){if(!_[_0x8fd2('0x44')](_0xe676a0[_0x512e07])){this['saveRestApiResult'](_0xe676a0[_0x512e07],util[_0x8fd2('0x29')]('%s.%s',_0x445c80,_0x512e07));}}else if(_[_0x8fd2('0x96')](_0xe676a0[_0x512e07])){for(var _0x4bff03=0x0;_0x4bff03<_0xe676a0[_0x512e07][_0x8fd2('0x94')];_0x4bff03++){this[_0x8fd2('0x97')](_0xe676a0[_0x512e07][_0x4bff03],util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x445c80,_0x512e07+'['+_0x4bff03+']'));}}else{if(!_[_0x8fd2('0x50')](_0xe676a0[_0x512e07])){this[_0x8fd2('0xc')]['setVariable'](util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x445c80,_0x512e07),_0xe676a0[_0x512e07]);}}}}};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x99')]=function(_0x496091){try{var _0x116e85=JSON[_0x8fd2('0x68')](_0x496091);this[_0x8fd2('0x93')](_0x116e85);return JSON[_0x8fd2('0x70')](_0x116e85);}catch(_0x2053a2){return this[_0x8fd2('0x92')](_0x496091);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x1a7d31){var _0x27ae56=_0x1a7d31[_0x8fd2('0x9a')]('{');for(var _0x25ef96=0x1;_0x25ef96<_0x27ae56[_0x8fd2('0x94')];_0x25ef96+=0x1){var _0x21ec91=_0x27ae56[_0x25ef96][_0x8fd2('0x9a')]('}');if(_0x21ec91['length']>0x1){_0x1a7d31=_0x1a7d31[_0x8fd2('0x9b')]('{'+_0x21ec91[0x0]+'}',this[_0x8fd2('0xc')][_0x8fd2('0xe')](_0x21ec91[0x0])['extra']||_0x21ec91[0x0]);}}if(_0x27ae56['length']===0x1){return _0x1a7d31[_0x8fd2('0x4c')]();}return this[_0x8fd2('0x92')](_0x1a7d31);};AGIVertices[_0x8fd2('0x12')]['getAndSetVariable']=function(_0x34daa0,_0x555944){var _0x423d02=this[_0x8fd2('0xc')]['getVariable'](_0x34daa0);if(_0x423d02[_0x8fd2('0x9c')]===-0x1){return _0x423d02;}logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x9d'),_0x555944,_0x423d02['extra']));return this['channel']['setVariable'](_0x555944,_0x423d02[_0x8fd2('0x9e')]);};AGIVertices['prototype'][_0x8fd2('0x82')]=function(_0x3c8ec8){return _0x3c8ec8&&_0x3c8ec8!=='0'&&_0x3c8ec8!=='-1'&&_0x3c8ec8!=='';};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x9f')]=function(_0x12d53f){this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x12d53f,'-');_0x12d53f[_0x8fd2('0xa0')]=_0x12d53f[_0x8fd2('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xa1')]=function(_0xa8cc27){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0xa2'),_0xa8cc27['label']));if(!this[_0x8fd2('0x82')](_0xa8cc27[_0x8fd2('0x5b')])){return this['channel'][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}var _0x1dee46='\x22'+_0xa8cc27[_0x8fd2('0x5b')]+'\x22';if(this[_0x8fd2('0x82')](_0xa8cc27['options'])){_0x1dee46+=','+_0xa8cc27[_0x8fd2('0x76')];}var _0x4246c9=this[_0x8fd2('0xc')][_0x8fd2('0x57')]('MRCPSynth',_0x1dee46);if(_0x4246c9[_0x8fd2('0x9c')]===-0x1){return _0x4246c9;}return this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0xa5'),_0x1dee46));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xa6')]=function(_0x38ae2a){logger['info'](util['format'](_0x8fd2('0xa7'),_0x38ae2a[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x38ae2a['grammar'])){return this['channel'][_0x8fd2('0xa3')]('no\x20grammar\x20configured');}var _0x4bca9c=_0x38ae2a['grammar'];if(this[_0x8fd2('0x82')](_0x38ae2a[_0x8fd2('0x76')])){_0x4bca9c+=','+_0x38ae2a['options'];}var _0x25049c=this[_0x8fd2('0xc')][_0x8fd2('0x57')](_0x8fd2('0xa8'),_0x4bca9c);if(_0x25049c[_0x8fd2('0x9c')]===-0x1){return _0x25049c;}var _0x3480e1=this[_0x8fd2('0xa9')](_0x8fd2('0xaa'),_0x8fd2('0xab'));if(_0x3480e1[_0x8fd2('0x9c')]===-0x1){return _0x3480e1;}var _0x28970d=this[_0x8fd2('0xa9')](_0x8fd2('0xac'),_0x8fd2('0xad'));if(_0x28970d['result']===-0x1){return _0x28970d;}var _0x484d2b=this[_0x8fd2('0xa9')](_0x8fd2('0xae'),_0x8fd2('0xaf'));if(_0x484d2b['result']===-0x1){return _0x484d2b;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xb0'),_0x4bca9c));};AGIVertices['prototype']['agi']=function(_0x17fa53){logger[_0x8fd2('0x2e')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x17fa53[_0x8fd2('0x38')]));return this['channel'][_0x8fd2('0xb1')]([_0x17fa53['command'],_0x17fa53[_0x8fd2('0xb2')]]);};AGIVertices['prototype'][_0x8fd2('0xb3')]=function(_0x50b70e){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x50b70e[_0x8fd2('0x38')]));if(this[_0x8fd2('0x82')](_0x50b70e['timeout'])){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0xb4'),_0x50b70e[_0x8fd2('0x63')]));var _0x1b102f=this[_0x8fd2('0xc')][_0x8fd2('0xb5')](_0x50b70e[_0x8fd2('0x63')]);if(_0x1b102f['result']===-0x1){return _0x1b102f;}}return this[_0x8fd2('0xc')][_0x8fd2('0xb3')]();};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x4a')]=function(_0x1eda84){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0xb6'),_0x1eda84[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x1eda84['list_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x1eda84,_0x8fd2('0xb7'));}_0x1eda84['scheduledAt']=moment();if(this[_0x8fd2('0x82')](_0x1eda84['delay'])){_0x1eda84[_0x8fd2('0x49')]=moment()[_0x8fd2('0xb8')](_0x1eda84[_0x8fd2('0xb9')],_0x8fd2('0xba'));}if(!this[_0x8fd2('0x82')](_0x1eda84[_0x8fd2('0x4d')])){_0x1eda84[_0x8fd2('0x4d')]=0x2;}this['createCmContact'][_0x8fd2('0x6d')](this,_0x1eda84);return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xbb'),_0x1eda84[_0x8fd2('0x48')],_0x1eda84[_0x8fd2('0xbc')],_0x1eda84[_0x8fd2('0x49')]));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xbd')]=function(_0x5d3434){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x5d3434['label']));var _0xb18a98=this[_0x8fd2('0xc')][_0x8fd2('0x57')](_0x5d3434[_0x8fd2('0xbe')],_0x5d3434[_0x8fd2('0x76')]);if(_0xb18a98[_0x8fd2('0x9c')]===-0x1){return _0xb18a98;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('Executed\x20command\x20%s\x20%s',_0x5d3434['application'],_0x5d3434[_0x8fd2('0x76')]));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xbf')]=function(_0x6e4d7){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0xc0'),_0x6e4d7[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x6e4d7[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}var _0x7224a6='\x22'+_0x6e4d7[_0x8fd2('0x5b')]+'\x22';if(this['isConfigured'](_0x6e4d7[_0x8fd2('0x76')])){_0x7224a6+=','+_0x6e4d7['options'];}var _0x9fce77=this['channel'][_0x8fd2('0x57')]('MRCPSynth',_0x7224a6);if(_0x9fce77[_0x8fd2('0x9c')]===-0x1){return _0x9fce77;}return this['channel'][_0x8fd2('0xa3')](util['format'](_0x8fd2('0xa5'),_0x7224a6));};AGIVertices[_0x8fd2('0x12')]['sestektts']=function(_0x18e3d9){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0xc1'),_0x18e3d9[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x18e3d9[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')]('no\x20text\x20configured');}var _0x34be96='\x22'+_0x18e3d9[_0x8fd2('0x5b')]+'\x22';if(this[_0x8fd2('0x82')](_0x18e3d9['options'])){_0x34be96+=','+_0x18e3d9[_0x8fd2('0x76')];}var _0x52c3ca=this[_0x8fd2('0xc')]['exec'](_0x8fd2('0xc2'),_0x34be96);if(_0x52c3ca[_0x8fd2('0x9c')]===-0x1){return _0x52c3ca;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xa5'),_0x34be96));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xc3')]=function(_0x1f2f56){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0xc4'),_0x1f2f56['label']));if(!this[_0x8fd2('0x82')](_0x1f2f56[_0x8fd2('0xc5')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x1717d3=_0x1f2f56[_0x8fd2('0xc5')];if(this[_0x8fd2('0x82')](_0x1f2f56[_0x8fd2('0x76')])){_0x1717d3+=','+_0x1f2f56[_0x8fd2('0x76')];}var _0x181544=this['channel'][_0x8fd2('0x57')](_0x8fd2('0xa8'),_0x1717d3);if(_0x181544[_0x8fd2('0x9c')]===-0x1){return _0x181544;}var _0x3feffb=this['getAndSetVariable'](_0x8fd2('0xaa'),_0x8fd2('0xc6'));if(_0x3feffb['result']===-0x1){return _0x3feffb;}var _0x35c044=this[_0x8fd2('0xa9')](_0x8fd2('0xac'),_0x8fd2('0xc7'));if(_0x35c044[_0x8fd2('0x9c')]===-0x1){return _0x35c044;}var _0x245472=this[_0x8fd2('0xa9')](_0x8fd2('0xae'),_0x8fd2('0xc8'));if(_0x245472[_0x8fd2('0x9c')]===-0x1){return _0x245472;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1717d3));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xc9')]=function(_0x2bc578){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0xca'),_0x2bc578[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x2bc578[_0x8fd2('0xc5')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xcb'));}var _0x3c0947=_0x2bc578[_0x8fd2('0xc5')];if(this[_0x8fd2('0x82')](_0x2bc578[_0x8fd2('0x76')])){_0x3c0947+=','+_0x2bc578[_0x8fd2('0x76')];}var _0x395e93=this[_0x8fd2('0xc')][_0x8fd2('0x57')]('MRCPRecog',_0x3c0947);if(_0x395e93[_0x8fd2('0x9c')]===-0x1){return _0x395e93;}var _0x49ecbb=this[_0x8fd2('0xa9')](_0x8fd2('0xaa'),_0x8fd2('0xcc'));if(_0x49ecbb[_0x8fd2('0x9c')]===-0x1){return _0x49ecbb;}var _0xec467=this['getAndSetVariable'](_0x8fd2('0xac'),_0x8fd2('0xcd'));if(_0xec467['result']===-0x1){return _0xec467;}var _0xb90437=this[_0x8fd2('0xa9')](_0x8fd2('0xae'),_0x8fd2('0xce'));if(_0xb90437['result']===-0x1){return _0xb90437;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xb0'),_0x3c0947));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xcf')]=function(_0x54d96b){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0xd0'),_0x54d96b[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x54d96b['odbc_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x54d96b,_0x8fd2('0xd1'));}var _0x5ee794=this[_0x8fd2('0x19')][_0x8fd2('0x6d')](this,_0x54d96b[_0x8fd2('0xd2')]);if(!_0x5ee794){return this[_0x8fd2('0xc')]['error'](_0x54d96b,_0x8fd2('0xd3'));}if(!this[_0x8fd2('0x82')](_0x54d96b[_0x8fd2('0xd4')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x54d96b,_0x8fd2('0xd5'));}var _0x35117e=_0x54d96b[_0x8fd2('0xd4')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('query:\x20%s',_0x35117e));var _0x49afed=this[_0x8fd2('0x2b')][_0x8fd2('0x6d')](this,_0x5ee794,_0x35117e);this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x54d96b,_0x35117e);if(!this['isConfigured'](_0x54d96b['variable_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xd6'));}var _0x378206=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x54d96b['variable_id']);if(!_0x378206){return this[_0x8fd2('0xc')]['error'](_0x54d96b,'no\x20variable\x20found');}var _0x583692=this;_0x49afed[_0x8fd2('0xd7')](function(_0x471afc,_0x5ca097){Object[_0x8fd2('0xd8')](_0x471afc)[_0x8fd2('0xd7')](function(_0x35413b){_0x583692['channel'][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0xda'),_0x378206,_0x5ca097,_0x35413b),_0x471afc[_0x35413b]);});});this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0xdb'),_0x378206),_0x49afed[_0x8fd2('0x94')]);return this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('variable\x20%s\x20set',_0x378206));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xdc')]=function(_0xe1cd1d){logger[_0x8fd2('0xdd')](util[_0x8fd2('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xe1cd1d['label']));if(!this[_0x8fd2('0x82')](_0xe1cd1d[_0x8fd2('0xde')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0xe1cd1d,'no\x20user\x20selected');}var _0x267489=this[_0x8fd2('0xdf')][_0x8fd2('0x6d')](this,_0xe1cd1d[_0x8fd2('0xde')]);if(!_0x267489){return this['channel'][_0x8fd2('0x2d')](_0xe1cd1d,'no\x20user\x20found');}var _0x14a41a=this[_0x8fd2('0xc')][_0x8fd2('0x57')](_0x8fd2('0xe0'),[util['format']('SIP/%s',_0x267489),_0xe1cd1d['timeout'],_0xe1cd1d['opts'],_0xe1cd1d['url']]);if(_0x14a41a[_0x8fd2('0x9c')]===-0x1){return _0x14a41a;}return this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xe1'),_0x8fd2('0xe0')));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xe2')]=function(_0x105022){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0xe3'),_0x105022[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x105022[_0x8fd2('0x78')])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0xe4'));}if(!this[_0x8fd2('0x82')](_0x105022[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xe5')]=!![];this[_0x8fd2('0x36')](_0x105022);this['createSquareMessage'](_0x105022[_0x8fd2('0x5b')],'in','','');this['channel']['noop'](util[_0x8fd2('0x29')](_0x8fd2('0xe6'),_0x105022['text']));var _0x375ca6=this['googleDialogflow'][_0x8fd2('0x6d')](this,_0x105022);if(_0x375ca6){for(var _0x568e1a in _0x375ca6){if(_0x375ca6[_0x8fd2('0x90')](_0x568e1a)){this['channel'][_0x8fd2('0xd9')](util['format'](_0x8fd2('0xe7'),_0x568e1a[_0x8fd2('0x67')]()),_0x375ca6[_0x568e1a]);}}this[_0x8fd2('0x42')](_0x375ca6['speech'],_0x8fd2('0xe8'),_0x8fd2('0xe2'),'');return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0xe9'),_0x375ca6[_0x8fd2('0xea')]));}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x105022,_0x8fd2('0xeb'));};AGIVertices[_0x8fd2('0x12')]['dialogflowV2']=function(_0x2cbadb){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2cbadb[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x2cbadb[_0x8fd2('0x7a')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xec'));}if(!this[_0x8fd2('0x82')](_0x2cbadb['client_email'])){return this['channel'][_0x8fd2('0xa3')](_0x8fd2('0xed'));}if(!this[_0x8fd2('0x82')](_0x2cbadb['private_key'])){return this['channel']['noop'](_0x8fd2('0xee'));}if(!this[_0x8fd2('0x82')](_0x2cbadb[_0x8fd2('0x7c')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xef'));}if(!this['isConfigured'](_0x2cbadb[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xe5')]=!![];this['createSquareDetailsReport'](_0x2cbadb);this['createSquareMessage'](_0x2cbadb['text'],'in','','');this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x2cbadb['text']));var _0x3266ae=this[_0x8fd2('0x79')][_0x8fd2('0x6d')](this,_0x2cbadb);if(_0x3266ae){for(var _0x1d7c3c in _0x3266ae){if(_0x3266ae[_0x8fd2('0x90')](_0x1d7c3c)){if(_0x1d7c3c!==_0x8fd2('0xf0')){this[_0x8fd2('0xc')]['setVariable'](util[_0x8fd2('0x29')](_0x8fd2('0xe7'),_0x1d7c3c[_0x8fd2('0x67')]()),_0x3266ae[_0x1d7c3c]);}}}this['createSquareMessage'](_0x3266ae[_0x8fd2('0xea')],'out','dialogflowV2',_0x3266ae[_0x8fd2('0xf0')]);return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xf1'),_0x3266ae[_0x8fd2('0xea')]));}return this['channel'][_0x8fd2('0x2d')](_0x2cbadb,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x8fd2('0xf2')]=function(_0x314293){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0xf3'),_0x314293[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x314293['ndauth_url'])){return this['channel'][_0x8fd2('0xa3')](_0x8fd2('0xf4'));}if(!this[_0x8fd2('0x82')](_0x314293[_0x8fd2('0xf5')])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0xf6'));}if(!this[_0x8fd2('0x82')](_0x314293[_0x8fd2('0xf7')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xf8'));}if(!this[_0x8fd2('0x82')](_0x314293[_0x8fd2('0xf9')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')]('no\x20text\x20configured');}this['channel'][_0x8fd2('0xe5')]=!![];this['createSquareDetailsReport'](_0x314293);this['createSquareMessage'](_0x314293['text'],'in','','');this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xfa'),_0x314293[_0x8fd2('0x5b')]));var _0x58b2ad=this['sestekNDA']['sync'](this,_0x314293);if(_0x58b2ad){for(var _0x34a0a9 in _0x58b2ad){if(_0x58b2ad[_0x8fd2('0x90')](_0x34a0a9)){this['channel'][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0xfb'),_0x34a0a9[_0x8fd2('0x67')]()),_0x58b2ad[_0x34a0a9]);}}this[_0x8fd2('0x42')](_0x58b2ad[_0x8fd2('0xea')],_0x8fd2('0xe8'),_0x8fd2('0xf2'),'');if(_0x58b2ad['audiofile']){this['channel']['noop'](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x58b2ad[_0x8fd2('0xfc')]));var _0x3e0cf5=this['channel'][_0x8fd2('0xfd')](_0x58b2ad['audiofile']);try{fs['unlink'](_0x58b2ad[_0x8fd2('0xfc')]+_0x8fd2('0xfe'));}catch(_0x6f5edc){logger['error'](_0x6f5edc);}return _0x3e0cf5;}else{return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('SestekNDA\x20Result\x20%s',_0x58b2ad[_0x8fd2('0xea')]));}}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x314293,_0x8fd2('0xff'));};AGIVertices['prototype'][_0x8fd2('0x100')]=function(_0x2576b6){logger['info'](util['format'](_0x8fd2('0x101'),_0x2576b6[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x100'));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x102')]=function(_0x381595){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x103'),_0x381595['label']));var _0x5bbb9c='';if(_0x381595[_0x8fd2('0x104')]){if(!this['isConfigured'](_0x381595['trunk_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x381595,'no\x20trunk\x20selected');}else{var _0x4b5d57=parseInt(_0x381595[_0x8fd2('0x104')],0xa);if(isNaN(_0x4b5d57)){_0x5bbb9c=_0x381595[_0x8fd2('0x104')];}else{_0x5bbb9c=this['getTrunk'][_0x8fd2('0x6d')](this,_0x381595[_0x8fd2('0x104')]);if(!_0x5bbb9c){return this[_0x8fd2('0xc')]['error'](_0x381595,_0x8fd2('0x105'));}}}}else if(_0x381595[_0x8fd2('0x106')]){_0x5bbb9c=_0x381595['trunk_name'];}else{return this['channel'][_0x8fd2('0x2d')](_0x381595,_0x8fd2('0x107'));}var _0x1c7189=this['channel'][_0x8fd2('0x57')](_0x8fd2('0xe0'),[util[_0x8fd2('0x29')]('SIP/%s/%s',_0x5bbb9c,_0x381595[_0x8fd2('0x48')]),_0x381595[_0x8fd2('0x63')],_0x381595[_0x8fd2('0x108')],_0x381595[_0x8fd2('0x109')]]);if(_0x1c7189[_0x8fd2('0x9c')]===-0x1){return _0x1c7189;}return this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0xe1'),_0x8fd2('0xe0')));};AGIVertices['prototype'][_0x8fd2('0x10a')]=function(_0x5118be){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x10b'),_0x5118be[_0x8fd2('0x38')]));return this['channel'][_0x8fd2('0xa3')]('finally');};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x10c')]=function(_0x27d20f){logger['info'](util['format'](_0x8fd2('0x10d'),_0x27d20f[_0x8fd2('0x38')]));if(_0x27d20f[_0x8fd2('0xa0')]===0x0){return this[_0x8fd2('0x9f')](_0x27d20f);}_0x27d20f[_0x8fd2('0xa0')]-=0x1;if(!this['isConfigured'](_0x27d20f['file_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x27d20f,_0x8fd2('0x10e'));}var _0x3c9a5c=this[_0x8fd2('0x1e')][_0x8fd2('0x6d')](this,_0x27d20f[_0x8fd2('0x10f')]);if(!_0x3c9a5c){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x27d20f,'no\x20file\x20audio\x20found');}if(!this[_0x8fd2('0x82')](_0x27d20f[_0x8fd2('0x110')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x8fd2('0xd6'));}var _0x22c8bb=this['channel'][_0x8fd2('0x111')](_0x3c9a5c,_0x27d20f[_0x8fd2('0x112')],_0x27d20f['maxdigit']);var _0x187046=_0x22c8bb[_0x8fd2('0x9c')]?_0x22c8bb[_0x8fd2('0x9c')][_0x8fd2('0x4c')]():'';logger[_0x8fd2('0x2e')](_0x8fd2('0x113'),JSON['stringify'](_0x22c8bb));if(_0x22c8bb[_0x8fd2('0x9c')]===-0x1){this[_0x8fd2('0x36')]['sync'](this,_0x27d20f,_0x187046);return _0x22c8bb;}else if(_0x22c8bb[_0x8fd2('0x9e')]==='timeout'){_0x22c8bb[_0x8fd2('0x9c')]=_0x187046[_0x8fd2('0x94')]>=parseInt(_0x27d20f['mindigit'])?'x':'i';}else{_0x22c8bb[_0x8fd2('0x9c')]=_0x187046[_0x8fd2('0x94')]>=parseInt(_0x27d20f[_0x8fd2('0x114')])&&_0x187046[_0x8fd2('0x94')]<=parseInt(_0x27d20f[_0x8fd2('0x115')])?'x':'i';}var _0x2a0f64=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x27d20f[_0x8fd2('0x110')]);if(!_0x2a0f64){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x27d20f,_0x8fd2('0x116'));}this['channel'][_0x8fd2('0xd9')](_0x2a0f64,_0x187046);if(this[_0x8fd2('0x82')](_0x27d20f[_0x8fd2('0x117')])){var _0x14edbd=parseInt(_0x27d20f['hiddendigitsnum'],0xa);var _0x45f33b=rs[_0x8fd2('0x118')]({'charset':'*','length':_0x14edbd});var _0x4f7b73=_0x187046[_0x8fd2('0x94')];if(_0x4f7b73>0x0){if(_0x4f7b73>_0x14edbd){this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x27d20f,_0x27d20f[_0x8fd2('0x119')]===_0x8fd2('0x11a')?_0x45f33b+_0x187046['substr'](_0x14edbd):_0x187046['substr'](0x0,_0x4f7b73-_0x14edbd)+_0x45f33b);}else{this['createSquareDetailsReport'][_0x8fd2('0x6d')](this,_0x27d20f,rs[_0x8fd2('0x118')]({'charset':'*','length':_0x4f7b73}));}}else{this['createSquareDetailsReport']['sync'](this,_0x27d20f,'');}}else{this['createSquareDetailsReport'][_0x8fd2('0x6d')](this,_0x27d20f,_0x187046);}return _0x22c8bb;};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xb')]=function(_0x40f452){logger['info'](util[_0x8fd2('0x29')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x40f452[_0x8fd2('0x38')]));return this[_0x8fd2('0x10c')](_0x40f452);};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x11b')]=function(_0x5d33b1){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x11c'),_0x5d33b1['label']));this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x5d33b1,_0x5d33b1[_0x8fd2('0x11d')]);return this['channel']['noop'](util[_0x8fd2('0x29')]('GOAL\x20%s',_0x5d33b1[_0x8fd2('0x11d')]));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x11e')]=function(_0x2c9454){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x11f'),_0x2c9454[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x2c9454['aws_access_key_id'])||!this[_0x8fd2('0x82')](_0x2c9454['aws_secret_access_key'])){return this['channel']['noop'](_0x8fd2('0x120'));}if(!this[_0x8fd2('0x82')](_0x2c9454['text'])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x121'),_0x2c9454[_0x8fd2('0x5b')]));var _0x2c6c03=this[_0x8fd2('0x84')]['sync'](this,_0x2c9454);if(_0x2c6c03){this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x2c6c03));var _0x487a92=this[_0x8fd2('0xc')]['streamFile'](_0x2c6c03);try{fs[_0x8fd2('0x122')](_0x2c6c03+_0x8fd2('0xfe'));}catch(_0x3bdf96){logger['error'](_0x3bdf96);}return _0x487a92;}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x2c9454,_0x8fd2('0x123'));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x124')]=function(_0x4b9a10){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x125'),_0x4b9a10[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x4b9a10[_0x8fd2('0x88')])||!this['isConfigured'](_0x4b9a10['aws_secret_access_key'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x120'));}if(!this[_0x8fd2('0x82')](_0x4b9a10[_0x8fd2('0x89')])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0x126'));}if(!this[_0x8fd2('0x82')](_0x4b9a10['text'])){return this['channel'][_0x8fd2('0xa3')]('no\x20text\x20configured');}this[_0x8fd2('0xc')][_0x8fd2('0xe5')]=!![];this[_0x8fd2('0x36')](_0x4b9a10);this[_0x8fd2('0x42')](_0x4b9a10[_0x8fd2('0x5b')],'in','','');this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x127'),_0x4b9a10[_0x8fd2('0x5b')]));var _0x4a88d4=this[_0x8fd2('0x87')][_0x8fd2('0x6d')](this,_0x4b9a10);if(_0x4a88d4){for(var _0x4265cb in _0x4a88d4){if(_0x4a88d4[_0x8fd2('0x90')](_0x4265cb)&&_['isString'](_0x4a88d4[_0x4265cb])){this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0x128'),_0x4265cb[_0x8fd2('0x67')]()),_0x4a88d4[_0x4265cb]);}}if(_[_0x8fd2('0x50')](_0x4a88d4[_0x8fd2('0x74')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x129'));}else{this['createSquareMessage'](_0x4a88d4[_0x8fd2('0x74')],_0x8fd2('0xe8'),_0x8fd2('0x12a'),'');return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x12b'),_0x4a88d4[_0x8fd2('0x74')]));}}return this[_0x8fd2('0xc')]['error'](_0x4b9a10,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0x8fd2('0x12c')]=function(_0x5bd308){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5bd308[_0x8fd2('0x38')],_0x5bd308['timeout']));if(!this[_0x8fd2('0x82')](_0x5bd308[_0x8fd2('0x78')])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0xe4'));}var _0x3fc833=_0x8fd2('0x12d');var _0x5ad311=util[_0x8fd2('0x29')](_0x8fd2('0x12e'),FILES_PATH,rs[_0x8fd2('0x118')](0x4));var _0xadab84=util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x5ad311,_0x3fc833);var _0x268b9e=!![];if(_0x5bd308['beep']===_0x8fd2('0x12f')){_0x268b9e=![];}var _0x29a479=this['channel'][_0x8fd2('0x130')](_0x5ad311,_0x3fc833,_0x5bd308[_0x8fd2('0x131')],_0x5bd308['timeout'],undefined,_0x268b9e);if(_0x29a479['result']!==-0x1){this[_0x8fd2('0xc')]['noop'](util['format'](_0x8fd2('0x132'),_0xadab84));var _0x1766f3=this[_0x8fd2('0x8a')]['sync'](this,_0x5bd308,_0xadab84);if(_0x1766f3){for(var _0x4799be in _0x1766f3){if(_0x1766f3[_0x8fd2('0x90')](_0x4799be)){this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0x133'),_0x4799be[_0x8fd2('0x67')]()),_0x1766f3[_0x4799be]);}}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x134'),JSON['stringify'](_0x1766f3)));}}return _0x29a479;};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x135')]=function(_0x4ec48f){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x136'),_0x4ec48f[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x4ec48f['appid'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x137'));}if(!this[_0x8fd2('0x82')](_0x4ec48f[_0x8fd2('0x8d')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x138'));}var _0x31fd85=_0x8fd2('0x12d');var _0x286ac5=util['format'](_0x8fd2('0x12e'),FILES_PATH,rs[_0x8fd2('0x118')](0x4));var _0x1d148a=util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x286ac5,_0x31fd85);var _0x4a21c6=!![];if(_0x4ec48f['beep']===_0x8fd2('0x12f')){_0x4a21c6=![];}var _0x591353=this[_0x8fd2('0xc')][_0x8fd2('0x130')](_0x286ac5,_0x31fd85,_0x4ec48f['intKey'],_0x4ec48f[_0x8fd2('0x63')],undefined,_0x4a21c6);if(_0x591353[_0x8fd2('0x9c')]!==-0x1){this['channel'][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x139'),_0x1d148a));var _0x1738fa=this['tildeASR']['sync'](this,_0x4ec48f,_0x1d148a);if(_0x1738fa){for(var _0x20b546 in _0x1738fa){if(_0x1738fa[_0x8fd2('0x90')](_0x20b546)){this[_0x8fd2('0xc')]['setVariable'](util[_0x8fd2('0x29')](_0x8fd2('0x13a'),_0x20b546[_0x8fd2('0x67')]()),_0x1738fa[_0x20b546]);}}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('TildeASR\x20Result\x20%s',JSON[_0x8fd2('0x70')](_0x1738fa)));}}return _0x591353;};AGIVertices['prototype'][_0x8fd2('0x13b')]=function(_0x16f7bb){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x13c'),_0x16f7bb['label']));return this[_0x8fd2('0xc')][_0x8fd2('0x13d')](_0x16f7bb['context'],_0x16f7bb['extension'],_0x16f7bb[_0x8fd2('0x3d')]);};AGIVertices['prototype'][_0x8fd2('0x13e')]=function(_0x3af676){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x13f'),_0x3af676[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x3af676[_0x8fd2('0x140')])){return this['channel'][_0x8fd2('0x2d')](_0x3af676,_0x8fd2('0x141'));}try{var _0x53c6ed=eval(_0x3af676[_0x8fd2('0x140')])?_0x8fd2('0x142'):_0x8fd2('0x143');this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x144'),_0x3af676['condition'],_0x53c6ed));return{'code':0xc8,'result':_0x53c6ed};}catch(_0x5c4eb9){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x145')]=function(_0x29bfc6){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x146'),_0x29bfc6[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x29bfc6[_0x8fd2('0x147')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x29bfc6,'no\x20interval\x20configured');}var _0x5e5cb4=this[_0x8fd2('0x25')][_0x8fd2('0x6d')](this,_0x29bfc6['interval_id']);if(!_0x5e5cb4){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x29bfc6,'no\x20intervals\x20found');}for(var _0x1a68d6=0x0;_0x1a68d6<_0x5e5cb4[_0x8fd2('0x94')];_0x1a68d6+=0x1){var _0x12a6eb=this['channel'][_0x8fd2('0xe')](util[_0x8fd2('0x29')](_0x8fd2('0x148'),_0x5e5cb4[_0x1a68d6]));if(_0x12a6eb[_0x8fd2('0x9c')]===-0x1){return _0x12a6eb;}logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x149'),_0x5e5cb4[_0x1a68d6],_0x12a6eb[_0x8fd2('0x9e')]));if(_0x12a6eb['extra']===_0x8fd2('0x142')){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x149'),_0x5e5cb4[_0x1a68d6],'true'));this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format']('IFTIME\x20%s\x20%s',_0x5e5cb4[_0x1a68d6],_0x8fd2('0x142')));return{'code':0xc8,'result':_0x8fd2('0x142')};}else{logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('IFTIME\x20%s\x20%s',_0x5e5cb4[_0x1a68d6],_0x8fd2('0x143')));this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x149'),_0x5e5cb4[_0x1a68d6],_0x8fd2('0x143')));}}return{'code':0xc8,'result':_0x8fd2('0x143')};};AGIVertices[_0x8fd2('0x12')]['hangup']=function(_0x182ab3){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x182ab3[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0x14a')]();};AGIVertices['prototype'][_0x8fd2('0x14b')]=function(_0x7d43d7){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x14c'),_0x7d43d7[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x7d43d7[_0x8fd2('0x78')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xe4'));}var _0x2ee4d8=_0x8fd2('0x12d');var _0x52356c=util['format'](_0x8fd2('0x12e'),FILES_PATH,rs[_0x8fd2('0x118')](0x4));var _0x2587ec=util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x52356c,_0x2ee4d8);var _0x3b02d6=!![];if(_0x7d43d7[_0x8fd2('0x14d')]==='NOBEEP'){_0x3b02d6=![];}var _0x163382=this[_0x8fd2('0xc')][_0x8fd2('0x130')](_0x52356c,_0x2ee4d8,_0x7d43d7[_0x8fd2('0x131')],_0x7d43d7['timeout'],undefined,_0x3b02d6);if(_0x163382[_0x8fd2('0x9c')]!==-0x1){this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x14e'),_0x2587ec));var _0x40e428=this[_0x8fd2('0x80')][_0x8fd2('0x6d')](this,_0x7d43d7,_0x2587ec);if(_0x40e428){for(var _0x1fbfb3 in _0x40e428){if(_0x40e428['hasOwnProperty'](_0x1fbfb3)){this[_0x8fd2('0xc')]['setVariable'](util[_0x8fd2('0x29')]('ISPEECH_ASR_%s',_0x1fbfb3[_0x8fd2('0x67')]()),_0x40e428[_0x1fbfb3]);}}return this[_0x8fd2('0xc')]['noop'](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x8fd2('0x70')](_0x40e428)));}}return _0x163382;};AGIVertices[_0x8fd2('0x12')]['ispeechtts']=function(_0x53c617){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x14f'),_0x53c617[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x53c617['key'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x53c617['text'])){return this['channel'][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x150'),_0x53c617[_0x8fd2('0x5b')]));var _0x29cc9a=this['ispeechTTS'][_0x8fd2('0x6d')](this,_0x53c617);if(_0x29cc9a){this[_0x8fd2('0xc')]['noop'](util['format'](_0x8fd2('0x14e'),_0x29cc9a));var _0x45edad=this[_0x8fd2('0xc')][_0x8fd2('0xfd')](_0x29cc9a,_0x53c617[_0x8fd2('0x131')]);try{fs[_0x8fd2('0x122')](_0x29cc9a+'.wav');}catch(_0x37f8e0){logger[_0x8fd2('0x2d')](_0x37f8e0);}return _0x45edad;}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x53c617,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x151')]=function(_0xd9713a){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x152'),_0xd9713a[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0xd9713a[_0x8fd2('0x153')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0xd9713a,'no\x20find\x20by\x20configured');}logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x154'),this[_0x8fd2('0xc')]['callerid'],_0xd9713a[_0x8fd2('0x153')]));var _0x509935=this['agentLogin']['sync'](this,_0xd9713a[_0x8fd2('0x153')]);if(_0x509935){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x155'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0xd9713a[_0x8fd2('0x153')]));this[_0x8fd2('0xc')]['noop'](util['format'](_0x8fd2('0x155'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0xd9713a[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x156')};}else{logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0xd9713a[_0x8fd2('0x153')]));this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x157'),this[_0x8fd2('0xc')]['callerid'],_0xd9713a['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8fd2('0x12')]['logout']=function(_0x12734d){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x12734d[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x12734d[_0x8fd2('0x153')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x12734d,_0x8fd2('0x158'));}logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x154'),this['channel']['callerid'],_0x12734d[_0x8fd2('0x153')]));var _0x2c4721=this[_0x8fd2('0x53')][_0x8fd2('0x6d')](this,_0x12734d[_0x8fd2('0x153')]);if(_0x2c4721){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x155'),this['channel'][_0x8fd2('0x3a')],_0x12734d[_0x8fd2('0x153')]));this[_0x8fd2('0xc')]['noop'](util['format'](_0x8fd2('0x155'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x12734d[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x156')};}else{logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x157'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x12734d[_0x8fd2('0x153')]));this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x12734d[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x159')};}};AGIVertices[_0x8fd2('0x12')]['math']=function(_0x415592){logger['info'](util['format'](_0x8fd2('0x15a'),_0x415592[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x415592[_0x8fd2('0x15b')])){return this['channel'][_0x8fd2('0x2d')](_0x415592,_0x8fd2('0x15c'));}this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x15d'),_0x415592[_0x8fd2('0x15b')]));var _0x6e7844=eval(_0x415592[_0x8fd2('0x15b')]);if(!this[_0x8fd2('0x82')](_0x415592[_0x8fd2('0x110')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xd6'));}var _0x4826b0=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x415592[_0x8fd2('0x110')]);if(!_0x4826b0){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x415592,_0x8fd2('0x116'));}if(_[_0x8fd2('0x96')](_0x6e7844)){var _0x1f8fee=this;_0x6e7844[_0x8fd2('0xd7')](function(_0xd8fdd4,_0x31749d){_0x1f8fee['channel'][_0x8fd2('0xd9')](util['format']('%s[%s]',_0x4826b0,_0x31749d),_0xd8fdd4);});return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x15e'),_0x4826b0));}else{return this[_0x8fd2('0xc')][_0x8fd2('0xd9')](_0x4826b0,_0x6e7844);}};AGIVertices['prototype']['menu']=function(_0x57f316){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x57f316['label']));if(_0x57f316[_0x8fd2('0xa0')]===0x0){return this['maxRetry'](_0x57f316);}_0x57f316[_0x8fd2('0xa0')]-=0x1;if(!this[_0x8fd2('0x82')](_0x57f316[_0x8fd2('0x10f')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x57f316,_0x8fd2('0x10e'));}var _0x20135f=this[_0x8fd2('0x1e')][_0x8fd2('0x6d')](this,_0x57f316[_0x8fd2('0x10f')]);if(!_0x20135f){return this['channel']['error'](_0x57f316,'no\x20file\x20audio\x20found');}var _0xd42fd6=this['channel']['getData'](_0x20135f,_0x57f316[_0x8fd2('0x112')],_0x57f316['digit']);var _0xf3b6e9=_0xd42fd6['result'];if(_0xd42fd6['result']===-0x1){this[_0x8fd2('0x36')]['sync'](this,_0x57f316,'-1');return _0xd42fd6;}else if(_0xd42fd6[_0x8fd2('0x9e')]===_0x8fd2('0x63')){_0xd42fd6[_0x8fd2('0x9c')]=_0xd42fd6['result'][_0x8fd2('0x94')]>0x0?_0xd42fd6[_0x8fd2('0x9c')]:'t';}else if(_['isEmpty'](_0xd42fd6[_0x8fd2('0x9c')])){_0xd42fd6[_0x8fd2('0x9c')]='#';_0xf3b6e9='#';}if(!this[_0x8fd2('0x82')](_0x57f316['variable_id'])){this['channel']['noop'](_0x8fd2('0xd6'));}else{var _0x80b8a2=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x57f316[_0x8fd2('0x110')]);if(!_0x80b8a2){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x57f316,_0x8fd2('0x116'));}this[_0x8fd2('0xc')]['setVariable'](_0x80b8a2,_0xf3b6e9);}this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x57f316,_0xf3b6e9);return _0xd42fd6;};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xa3')]=function(_0x1b1a6a){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x15f'),_0x1b1a6a['label']));return this['channel'][_0x8fd2('0xa3')](_0x1b1a6a[_0x8fd2('0x160')]||_0x1b1a6a['label']);};AGIVertices['prototype'][_0x8fd2('0x161')]=function(_0x2e5fe7){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2e5fe7[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x2e5fe7[_0x8fd2('0x153')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x2e5fe7,_0x8fd2('0x158'));}logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x2e5fe7[_0x8fd2('0x153')]));var _0x365bf8=this['getPause']['sync'](this,_0x2e5fe7['pause_id']);var _0xa0f25=this[_0x8fd2('0x4f')]['sync'](this,_0x2e5fe7[_0x8fd2('0x153')],_0x365bf8);if(_0xa0f25){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x155'),this['channel'][_0x8fd2('0x3a')],_0x2e5fe7['findBy']));this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x155'),this[_0x8fd2('0xc')]['callerid'],_0x2e5fe7[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x156')};}else{logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x157'),this[_0x8fd2('0xc')]['callerid'],_0x2e5fe7[_0x8fd2('0x153')]));this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x2e5fe7[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x159')};}};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x162')]=function(_0x397a70){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x163'),_0x397a70[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x397a70[_0x8fd2('0x10f')])){return this[_0x8fd2('0xc')]['error'](_0x397a70,'no\x20file\x20audio\x20selected');}var _0x1402d6=this['getSound'][_0x8fd2('0x6d')](this,_0x397a70['file_id']);if(!_0x1402d6){return this[_0x8fd2('0xc')]['error'](_0x397a70,_0x8fd2('0x164'));}var _0x4120ec=this['channel'][_0x8fd2('0x57')](_0x8fd2('0x165'),[_0x1402d6,_0x397a70['opts']]);if(_0x4120ec[_0x8fd2('0x9c')]===-0x1){return _0x4120ec;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x166'),_0x8fd2('0x165'),_0x1402d6));};AGIVertices['prototype'][_0x8fd2('0x167')]=function(_0x31aedf){logger['info'](util['format'](_0x8fd2('0x168'),_0x31aedf[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x31aedf['queue_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x31aedf,'no\x20queue\x20selected');}var _0x3440f3='';var _0x21e9d2=parseInt(_0x31aedf['queue_id'],0xa);if(isNaN(_0x21e9d2)){_0x3440f3=_0x31aedf['queue_id'];}else{_0x3440f3=this[_0x8fd2('0x13')][_0x8fd2('0x6d')](this,_0x31aedf['queue_id']);if(!_0x3440f3){return this[_0x8fd2('0xc')]['error'](_0x31aedf,'no\x20queue\x20found');}}var _0x2ef134='';if(this[_0x8fd2('0x82')](_0x31aedf[_0x8fd2('0x10f')])){var _0x5a7d44=this[_0x8fd2('0x1e')][_0x8fd2('0x6d')](this,_0x31aedf[_0x8fd2('0x10f')]);if(_0x5a7d44){_0x2ef134=_0x5a7d44;}}this['createSquareDetailsReport'][_0x8fd2('0x6d')](this,_0x31aedf,_0x3440f3);if(_0x31aedf[_0x8fd2('0x108')][_0x8fd2('0x169')]('x')<0x0){_0x31aedf[_0x8fd2('0x108')]+='x';}if(_0x31aedf[_0x8fd2('0x108')][_0x8fd2('0x169')]('X')<0x0){_0x31aedf[_0x8fd2('0x108')]+='X';}this[_0x8fd2('0xc')][_0x8fd2('0xd9')](_0x8fd2('0x16a'),_0x3440f3?_0x3440f3[_0x8fd2('0x16b')]():'');var _0x3826ab=this['channel']['exec']('QUEUE',[_0x3440f3,_0x31aedf[_0x8fd2('0x108')],_0x31aedf[_0x8fd2('0x109')],_0x2ef134,_0x31aedf['timeout'],_0x31aedf[_0x8fd2('0xb1')],_0x31aedf['macro'],_0x31aedf['gosub'],'',_0x31aedf[_0x8fd2('0x16c')]]);if(_0x3826ab[_0x8fd2('0x9c')]===-0x1){return _0x3826ab;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x166'),_0x8fd2('0x16d'),_0x3440f3));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x16e')]=function(_0x3245d9){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x16f'),_0x3245d9[_0x8fd2('0x38')]));var _0x5c7038=_0x3245d9[_0x8fd2('0x170')]||_0x8fd2('0x12d');var _0x511598=util[_0x8fd2('0x29')](_0x8fd2('0x171'),this[_0x8fd2('0xc')][_0x8fd2('0x37')],rs[_0x8fd2('0x118')](0x5));var _0x4f9a7c=util[_0x8fd2('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x511598,_0x5c7038);var _0x35c594=util['format'](_0x8fd2('0x12e'),FILES_PATH,_0x511598);this['createSquareRecording'][_0x8fd2('0x6d')](this,_0x3245d9,_0x511598,_0x4f9a7c);this['channel'][_0x8fd2('0xd9')](_0x8fd2('0x172'),_0x511598);logger['info'](_0x8fd2('0x173'),_0x35c594,_0x5c7038,_0x3245d9[_0x8fd2('0x174')],_0x3245d9[_0x8fd2('0x63')]);return this['channel']['recordFile'](_0x35c594,_0x5c7038,_0x3245d9[_0x8fd2('0x174')],_0x3245d9['timeout'],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x360612){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x175'),_0x360612['label']));if(!this[_0x8fd2('0x82')](_0x360612[_0x8fd2('0x109')])){return this['channel'][_0x8fd2('0xa3')]('no\x20url\x20configured');}var _0x330f93=this[_0x8fd2('0x176')][_0x8fd2('0x6d')](this,_0x360612);logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x177'),util['inspect'](_0x330f93,{'showHidden':![],'depth':null})));if(!this[_0x8fd2('0x82')](_0x360612[_0x8fd2('0x110')])){return this['channel'][_0x8fd2('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x23a739=this[_0x8fd2('0xe')]['sync'](this,_0x360612['variable_id']);if(!_0x23a739){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x360612,_0x8fd2('0x116'));}this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0x178'),_0x23a739),_0x330f93[_0x8fd2('0x73')]?_0x330f93[_0x8fd2('0x73')]:_0x8fd2('0x179'));this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0x17a'),_0x23a739),_0x330f93[_0x8fd2('0x17b')]?_0x330f93[_0x8fd2('0x17b')]:'OK');if(_0x330f93[_0x8fd2('0x71')]){try{this['saveRestApiResult'](_0x330f93['body'],_0x23a739);}catch(_0x40811a){logger[_0x8fd2('0x2d')](util[_0x8fd2('0x29')](_0x8fd2('0x17c'),_0x23a739));}}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x17d'),_0x23a739));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x17e')]=function(_0x268b71){logger['info'](util['format'](_0x8fd2('0x17f'),_0x268b71[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0x180')](_0x268b71[_0x8fd2('0x181')]['replace'](/\s+/g,''),_0x268b71['escape_digits']);};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x182')]=function(_0xad7f08){logger['info'](util[_0x8fd2('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xad7f08[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0x183')](_0xad7f08[_0x8fd2('0x184')][_0x8fd2('0x185')](/\s+/g,''),_0xad7f08[_0x8fd2('0x174')]);};AGIVertices[_0x8fd2('0x12')]['sayphonetic']=function(_0x39e0f5){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x186'),_0x39e0f5[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0x187')](_0x39e0f5['text'],_0x39e0f5[_0x8fd2('0x174')]);};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x188')]=function(_0x317e69){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x189'),_0x317e69['label']));if(!this[_0x8fd2('0x82')](_0x317e69[_0x8fd2('0x18a')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x18b'));}var _0x2a2507=this[_0x8fd2('0x22')][_0x8fd2('0x6d')](this,_0x317e69[_0x8fd2('0x18a')]);if(!_0x2a2507||!_0x2a2507['Smtp']){return this['channel'][_0x8fd2('0x2d')](_0x317e69,_0x8fd2('0x18c'));}var _0x2e2ebc={'from':util[_0x8fd2('0x29')](_0x8fd2('0x18d'),_0x2a2507[_0x8fd2('0x10')],_0x2a2507['email']||_0x2a2507[_0x8fd2('0x18e')][_0x8fd2('0x18f')]),'to':_0x317e69['to']||'','cc':_0x317e69['cc']||'','bcc':_0x317e69[_0x8fd2('0x190')]||'','subject':_0x317e69['subject'],'html':_0x317e69[_0x8fd2('0x5b')],'text':_0x317e69[_0x8fd2('0x5b')]};if(this[_0x8fd2('0x82')](_0x317e69[_0x8fd2('0x191')])){}logger[_0x8fd2('0xdd')]('sendMail\x20message',JSON[_0x8fd2('0x70')](_0x2e2ebc));this['createSquareDetailsReport']['sync'](this,_0x317e69,_0x317e69['account_id']);this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x192'),_0x2a2507[_0x8fd2('0x10')]));this[_0x8fd2('0x24')]['sync'](this,_0x2a2507[_0x8fd2('0x193')],_0x2e2ebc);return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x194'));};AGIVertices[_0x8fd2('0x12')]['sendFax']=function(_0x5d4720){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x195'),_0x5d4720[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0x196'));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x197')]=function(_0x1963fa){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x198'),_0x1963fa['label']));if(!this[_0x8fd2('0x82')](_0x1963fa['sms_account_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x199'));}var _0x51b249=this[_0x8fd2('0x33')][_0x8fd2('0x6d')](this,_0x1963fa[_0x8fd2('0x19a')]);if(!_0x51b249){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x1963fa,_0x8fd2('0x19b'));}var _0xe8e497={'body':_0x1963fa[_0x8fd2('0x19c')],'phone':_0x1963fa['to']||'','SmsAccountId':_0x51b249['id']};logger['debug'](_0x8fd2('0x19d'),JSON[_0x8fd2('0x70')](_0xe8e497));this[_0x8fd2('0x36')]['sync'](this,_0x1963fa,_0x1963fa[_0x8fd2('0x19a')]);this['channel']['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x19e'),_0x51b249[_0x8fd2('0x10')]));this[_0x8fd2('0x35')][_0x8fd2('0x6d')](this,_0xe8e497);return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x19f'));};AGIVertices['prototype']['set']=function(_0x5944f2){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x1a0'),_0x5944f2[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x5944f2['variable_id'])){return this['channel'][_0x8fd2('0x2d')](_0x5944f2,_0x8fd2('0x1a1'));}var _0x18329d=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x5944f2[_0x8fd2('0x110')]);if(!_0x18329d){return this['channel']['error'](_0x5944f2,'no\x20variable\x20found');}return this[_0x8fd2('0xc')]['setVariable'](_0x18329d,_0x5944f2[_0x8fd2('0x1a2')]);};AGIVertices['prototype'][_0x8fd2('0x1a3')]=function(_0x3c66c2){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x1a4'),_0x3c66c2[_0x8fd2('0x38')]));this[_0x8fd2('0xc')][_0x8fd2('0xa3')]('START\x20CALLY\x20SQUARE');var _0x1a83e6=this['channel'][_0x8fd2('0xe')](_0x8fd2('0x1a5'));if(!_['isEmpty'](_0x1a83e6[_0x8fd2('0x9e')])){this['channel'][_0x8fd2('0x37')]=_0x1a83e6[_0x8fd2('0x9e')];}if(_0x3c66c2['answer']===_0x8fd2('0x1a6')){this[_0x8fd2('0xc')]['noop'](_0x8fd2('0x1a7'));return this[_0x8fd2('0xc')][_0x8fd2('0xb3')]();}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x1a8'));};AGIVertices['prototype'][_0x8fd2('0x1a9')]=function(_0x57f84e){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x1aa'),_0x57f84e[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x57f84e[_0x8fd2('0x1ab')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x57f84e,_0x8fd2('0x1ac'));}var _0x55399e=this[_0x8fd2('0x17')][_0x8fd2('0x6d')](this,_0x57f84e[_0x8fd2('0x1ab')]);if(!this['isConfigured'](_0x55399e)){return this[_0x8fd2('0xc')]['error'](_0x57f84e,util[_0x8fd2('0x29')](_0x8fd2('0x1ad'),_0x57f84e[_0x8fd2('0x1ab')]));}if(_0x55399e===this[_0x8fd2('0xc')][_0x8fd2('0x40')]){return this['channel'][_0x8fd2('0x2d')](_0x57f84e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x57f84e,_0x55399e);var _0x1b48dd=this[_0x8fd2('0xc')][_0x8fd2('0x57')]('AGI',util[_0x8fd2('0x29')](_0x8fd2('0x1ae'),config[_0x8fd2('0xb1')][_0x8fd2('0x1af')]||_0x8fd2('0x1b0'),_0x55399e,this[_0x8fd2('0xc')][_0x8fd2('0x40')]));if(_0x1b48dd[_0x8fd2('0x9c')]===-0x1){return _0x1b48dd;}return this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x166'),_0x8fd2('0x1b1'),_0x55399e));};AGIVertices['prototype'][_0x8fd2('0x1b2')]=function(_0x11c97e){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x11c97e[_0x8fd2('0x38')]));var _0x15a434=this[_0x8fd2('0x56')][_0x8fd2('0x6d')](this,_0x11c97e[_0x8fd2('0x1b3')]);this[_0x8fd2('0x36')]['sync'](this,_0x11c97e,_0x11c97e[_0x8fd2('0x1b3')]);if(this[_0x8fd2('0x82')](_0x11c97e[_0x8fd2('0x110')])){var _0x326ca0=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x11c97e[_0x8fd2('0x110')]);if(_0x326ca0){this[_0x8fd2('0xc')]['setVariable'](_0x326ca0,_0x15a434);return this['channel']['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x1b4'),_0x11c97e[_0x8fd2('0x1b3')],_0x326ca0));}}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x1b5'),_0x11c97e['command']));};AGIVertices['prototype'][_0x8fd2('0x1b6')]=function(_0x2d639d){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2d639d[_0x8fd2('0x38')]));_0x2d639d['text']=_0x2d639d[_0x8fd2('0x5b')][_0x8fd2('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8fd2('0x82')](_0x2d639d[_0x8fd2('0x1b7')])){return this[_0x8fd2('0xc')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x8fd2('0x82')](_0x2d639d['text'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x1b8'),_0x2d639d[_0x8fd2('0x5b')]));var _0x111a61=this[_0x8fd2('0x59')][_0x8fd2('0x6d')](this,_0x2d639d);if(_0x111a61){this['channel']['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x111a61));var _0xe03c73=this[_0x8fd2('0xc')][_0x8fd2('0xfd')](_0x111a61);try{fs['unlink'](_0x111a61+_0x8fd2('0xfe'));}catch(_0x2d13bf){logger[_0x8fd2('0x2d')](_0x2d13bf);}return _0xe03c73;}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x2d639d,_0x8fd2('0x1b9'));};AGIVertices['prototype']['tts']=function(_0x11a65a){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x11a65a[_0x8fd2('0x38')]));_0x11a65a[_0x8fd2('0x5b')]=_0x11a65a[_0x8fd2('0x5b')][_0x8fd2('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8fd2('0x82')](_0x11a65a[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x1ba'),_0x11a65a[_0x8fd2('0x5b')]));var _0x1b63aa=this[_0x8fd2('0x61')][_0x8fd2('0x6d')](this,_0x11a65a);if(_0x1b63aa){this['channel']['noop'](util[_0x8fd2('0x29')]('Google\x20TTS\x20%s\x20file\x20created',_0x1b63aa));var _0x3ae159=this[_0x8fd2('0xc')][_0x8fd2('0xfd')](_0x1b63aa);try{fs[_0x8fd2('0x122')](_0x1b63aa+_0x8fd2('0xfe'));}catch(_0x39f817){logger['error'](_0x39f817);}return _0x3ae159;}return this[_0x8fd2('0xc')]['error'](_0x11a65a,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x1bb')]=function(_0x3b5248){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x1bc'),_0x3b5248['label']));if(!this[_0x8fd2('0x82')](_0x3b5248[_0x8fd2('0x153')])){return this['channel'][_0x8fd2('0x2d')](_0x3b5248,_0x8fd2('0x158'));}logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x154'),this['channel'][_0x8fd2('0x3a')],_0x3b5248[_0x8fd2('0x153')]));var _0x1547df=this['agentUnpause']['sync'](this,_0x3b5248[_0x8fd2('0x153')]);if(_0x1547df){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x3b5248['findBy']));this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x155'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x3b5248[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x156')};}else{logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x157'),this['channel']['callerid'],_0x3b5248['findBy']));this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x157'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x3b5248[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x159')};}};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x1bd')]=function(_0x271a55){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x1be'),_0x271a55[_0x8fd2('0x38')]));var _0x42634f=this[_0x8fd2('0xc')]['exec']('VOICEMAIL',[_0x271a55[_0x8fd2('0x1bf')],_0x271a55[_0x8fd2('0x76')]]);if(_0x42634f[_0x8fd2('0x9c')]===-0x1){return _0x42634f;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x166'),_0x8fd2('0x1c0'),_0x271a55[_0x8fd2('0x1bf')]));};AGIVertices['prototype'][_0x8fd2('0x1c1')]=function(_0x6bfeef){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x1c2'),_0x6bfeef[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x6bfeef[_0x8fd2('0x110')])){return this[_0x8fd2('0xc')]['error'](_0x6bfeef,_0x8fd2('0x1a1'));}var _0x3e3612=this[_0x8fd2('0xe')]['sync'](this,_0x6bfeef[_0x8fd2('0x110')]);if(!_0x3e3612){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x6bfeef,_0x8fd2('0x116'));}var _0x4b7d0a=this[_0x8fd2('0xc')][_0x8fd2('0xe')](_0x3e3612);return{'code':0xc8,'result':_0x4b7d0a[_0x8fd2('0x9e')]?_0x4b7d0a[_0x8fd2('0x9e')]:'-'};};String[_0x8fd2('0x12')][_0x8fd2('0x9b')]=function(_0x1fe874,_0x3e70bd){return this[_0x8fd2('0x9a')](_0x1fe874)[_0x8fd2('0x1c3')](_0x3e70bd);};module[_0x8fd2('0x1c4')]=AGIVertices; \ No newline at end of file +var _0xa8a8=['forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','false','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','math\x20%s','isArray','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','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','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','replace','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunkById','getSound','getSoundPath','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','awsLex','aws_secret_access_key','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','agicommand','clone','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','length','isString','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','options','exec','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','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','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','RECOG_CONFIDENCE()','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','variable_id','no\x20variable\x20found','keys'];(function(_0x3edec8,_0x563a6f){var _0x2bebf7=function(_0xe51ba1){while(--_0xe51ba1){_0x3edec8['push'](_0x3edec8['shift']());}};_0x2bebf7(++_0x563a6f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2cd6de,_0x38904a){_0x2cd6de=_0x2cd6de-0x0;var _0x4f6113=_0xa8a8[_0x2cd6de];return _0x4f6113;};'use strict';var fs=require('fs');var util=require(_0x8a8a('0x0'));var _=require(_0x8a8a('0x1'));var sh=require(_0x8a8a('0x2'));var odbc=require(_0x8a8a('0x3'))();var rs=require('randomstring');var moment=require(_0x8a8a('0x4'));var Mustache=require(_0x8a8a('0x5'));var rp=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var scripts=require(_0x8a8a('0xa'));var FILES_PATH=_0x8a8a('0xb');var recursiveMapAttributes=[_0x8a8a('0xc'),_0x8a8a('0xd')];var verticesWithRetry=[_0x8a8a('0xe'),_0x8a8a('0xf'),_0x8a8a('0x10')];var AGIVertices=function(_0xecaa6f,_0x3287f5,_0x58a2f8){this['channel']=_0xecaa6f;this[_0x8a8a('0x11')]=_0x3287f5;this['mailRpc']=_0x58a2f8;};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x13')]=function(_0x532621,_0x118380){this[_0x8a8a('0x11')][_0x8a8a('0x14')](_0x532621)['then'](function(_0x679da2){_0x118380(null,_0x679da2?_0x679da2[_0x8a8a('0x15')]:![]);})[_0x8a8a('0x16')](function(_0x234481){_0x118380(_0x234481);});};AGIVertices['prototype'][_0x8a8a('0x17')]=function(_0x4e5d74,_0x25e1d5){this[_0x8a8a('0x11')][_0x8a8a('0x18')](_0x4e5d74)[_0x8a8a('0x19')](function(_0x2ac893){_0x25e1d5(null,_0x2ac893?_0x2ac893[_0x8a8a('0x15')]:![]);})[_0x8a8a('0x16')](function(_0x51ce75){_0x25e1d5(_0x51ce75);});};AGIVertices[_0x8a8a('0x12')]['getSquareProject']=function(_0x1f36b6,_0x3046ae){this[_0x8a8a('0x11')][_0x8a8a('0x1a')](_0x1f36b6)[_0x8a8a('0x19')](function(_0x5dd616){_0x3046ae(null,_0x5dd616?_0x5dd616[_0x8a8a('0x15')]:![]);})[_0x8a8a('0x16')](function(_0x262ca9){_0x3046ae(_0x262ca9);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x1b')]=function(_0x22e611,_0x4d7a45){this['rpc']['getSquareOdbcById'](_0x22e611)['then'](function(_0x4a6601){_0x4d7a45(null,_0x4a6601?_0x4a6601[_0x8a8a('0x1c')]:![]);})[_0x8a8a('0x16')](function(_0xe0f449){_0x4d7a45(_0xe0f449);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x1d')]=function(_0x2f6af2,_0x242bac){this[_0x8a8a('0x11')][_0x8a8a('0x1e')](_0x2f6af2)[_0x8a8a('0x19')](function(_0xb9db78){_0x242bac(null,_0xb9db78?_0xb9db78[_0x8a8a('0x15')]:![]);})[_0x8a8a('0x16')](function(_0x625c1b){_0x242bac(_0x625c1b);});};AGIVertices[_0x8a8a('0x12')]['getTrunk']=function(_0x3c096f,_0x16c55b){this[_0x8a8a('0x11')][_0x8a8a('0x1f')](_0x3c096f)[_0x8a8a('0x19')](function(_0x251315){_0x16c55b(null,_0x251315?_0x251315[_0x8a8a('0x15')]:![]);})['catch'](function(_0x31d21a){_0x16c55b(_0x31d21a);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x20')]=function(_0x54ff7e,_0x58f42b){var _0x2dafcd=this;this[_0x8a8a('0x11')]['getSoundById'](_0x54ff7e)['then'](function(_0x4b3bc5){_0x58f42b(null,_0x4b3bc5?_0x2dafcd[_0x8a8a('0x21')](_0x4b3bc5['save_name']):![]);})[_0x8a8a('0x16')](function(_0xdd6221){_0x58f42b(_0xdd6221);});};AGIVertices['prototype'][_0x8a8a('0x22')]=function(_0x2c8f27,_0x250852){this[_0x8a8a('0x11')][_0x8a8a('0x23')](_0x2c8f27)[_0x8a8a('0x19')](function(_0x3e73b1){_0x250852(null,_0x3e73b1?_0x3e73b1:![]);})[_0x8a8a('0x16')](function(_0x5768a6){_0x250852(_0x5768a6);});};AGIVertices['prototype']['sendMailMessage']=function(_0x2a00a7,_0x3bf77d,_0x5f301e){this[_0x8a8a('0x24')][_0x8a8a('0x25')](_0x2a00a7,_0x3bf77d)['then'](function(){_0x5f301e(null);})[_0x8a8a('0x16')](function(_0x431b3a){_0x5f301e(_0x431b3a);});};AGIVertices[_0x8a8a('0x12')]['getIntervals']=function(_0x5bee53,_0x8457a0){this['rpc'][_0x8a8a('0x26')](_0x5bee53)[_0x8a8a('0x19')](function(_0x3ecbca){if(_0x3ecbca){if(_0x3ecbca[_0x8a8a('0x27')]){_0x8457a0(null,[_0x3ecbca[_0x8a8a('0x28')]]);}else{_0x8457a0(null,_[_0x8a8a('0x29')](_0x3ecbca[_0x8a8a('0x2a')],_0x8a8a('0x28')));}}else{_0x8457a0(null,![]);}})[_0x8a8a('0x16')](function(_0xf7d4d7){_0x8457a0(_0xf7d4d7);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x21')]=function(_0x17a36c){return util[_0x8a8a('0x2b')](_0x8a8a('0x2c'),FILES_PATH,_0x17a36c);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x2d')]=function(_0x29d187,_0x4c8003,_0x4cc605){odbc['open'](_0x29d187,function(_0x34db33){if(_0x34db33){logger[_0x8a8a('0x2e')](_0x8a8a('0x2f'),_0x34db33);_0x4cc605(_0x34db33);}else{logger[_0x8a8a('0x30')](_0x8a8a('0x31'));odbc['query'](_0x4c8003,function(_0x4ee92e,_0x8d8481){if(_0x4ee92e){logger['info'](_0x8a8a('0x32'),_0x4c8003);_0x4cc605(_0x4ee92e);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x4c8003);odbc[_0x8a8a('0x33')](function(_0x1ac761){if(_0x1ac761){logger[_0x8a8a('0x2e')](_0x8a8a('0x34'),_0x1ac761);}_0x4cc605(null,_0x8d8481);});}});}});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x35')]=function(_0x20584a,_0x503989){this[_0x8a8a('0x11')][_0x8a8a('0x36')](_0x20584a)[_0x8a8a('0x19')](function(_0x53f66e){_0x503989(null,_0x53f66e?_0x53f66e:![]);})[_0x8a8a('0x16')](function(_0x323f89){_0x503989(_0x323f89);});};AGIVertices[_0x8a8a('0x12')]['createSmsMessage']=function(_0x3fda48,_0x7a37ae){this[_0x8a8a('0x11')][_0x8a8a('0x37')](_0x3fda48)[_0x8a8a('0x19')](function(_0x3e5b15){_0x7a37ae(null,_0x3e5b15);})['catch'](function(_0x4fe325){_0x7a37ae(_0x4fe325);});};AGIVertices[_0x8a8a('0x12')]['createSquareDetailsReport']=function(_0x13e0d4,_0x1aa8b5,_0x5151f8){this['rpc'][_0x8a8a('0x38')]({'uniqueid':this[_0x8a8a('0x39')][_0x8a8a('0x3a')],'node':_0x13e0d4[_0x8a8a('0x3b')],'application':_0x13e0d4['agicommand'],'data':_0x1aa8b5||null,'project_name':this[_0x8a8a('0x39')]['arg_1'],'callerid':this[_0x8a8a('0x39')][_0x8a8a('0x3c')]})['then'](function(_0x3b5f93){if(_0x5151f8){_0x5151f8(null,_0x3b5f93);}})[_0x8a8a('0x16')](function(_0x2836de){if(_0x5151f8){_0x5151f8(_0x2836de);}});};AGIVertices['prototype'][_0x8a8a('0x3d')]=function(_0x3a6b97,_0x35683e,_0x4ad0ad,_0x5466d4){this[_0x8a8a('0x11')][_0x8a8a('0x3d')]({'uniqueid':this[_0x8a8a('0x39')]['uniqueid'],'callerid':this[_0x8a8a('0x39')][_0x8a8a('0x3c')],'calleridname':this[_0x8a8a('0x39')][_0x8a8a('0x3e')],'context':this[_0x8a8a('0x39')][_0x8a8a('0x3f')],'extension':this[_0x8a8a('0x39')][_0x8a8a('0x40')],'priority':this[_0x8a8a('0x39')][_0x8a8a('0x41')],'accountcode':this[_0x8a8a('0x39')]['accountcode'],'dnid':this[_0x8a8a('0x39')][_0x8a8a('0x42')],'projectName':this[_0x8a8a('0x39')][_0x8a8a('0x43')],'saveName':_0x35683e,'filename':_0x3a6b97[_0x8a8a('0x44')]||_0x35683e,'savePath':_0x4ad0ad})[_0x8a8a('0x19')](function(_0x565a49){_0x5466d4(null,_0x565a49);})[_0x8a8a('0x16')](function(_0x396ffd){_0x5466d4(_0x396ffd);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x45')]=function(_0x494df8,_0x1faad3,_0x3333ff,_0x44e00c,_0x5220c0){this['rpc'][_0x8a8a('0x45')]({'uniqueid':this[_0x8a8a('0x39')][_0x8a8a('0x3a')],'body':_0x494df8,'direction':_0x1faad3,'providerName':_0x3333ff,'providerResponse':_0x44e00c})[_0x8a8a('0x19')](function(_0x393a4a){if(_0x5220c0){_0x5220c0(null,_0x393a4a);}})[_0x8a8a('0x16')](function(_0x1d1b5c){if(_0x5220c0){_0x5220c0(_0x1d1b5c);}});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x46')]=function(_0x4ab312,_0x4c1f1a){this[_0x8a8a('0x11')][_0x8a8a('0x46')]({'firstName':_['isEmpty'](_0x4ab312['name'])||_[_0x8a8a('0x47')](_0x4ab312['name'])?_0x8a8a('0x48')+Math['random']():_0x4ab312[_0x8a8a('0x15')],'lastName':_[_0x8a8a('0x49')](_0x4ab312[_0x8a8a('0x4a')])||_[_0x8a8a('0x47')](_0x4ab312[_0x8a8a('0x4a')])?null:_0x4ab312[_0x8a8a('0x4a')],'phone':_0x4ab312[_0x8a8a('0x4b')],'ListId':_0x4ab312[_0x8a8a('0x4c')],'scheduledat':_0x4ab312[_0x8a8a('0x4d')],'callbackUniqueid':this[_0x8a8a('0x39')]['uniqueid'],'tags':_0x8a8a('0x4e'),'description':_0x8a8a('0x4f')+_0x4ab312[_0x8a8a('0x4d')][_0x8a8a('0x50')](),'priority':_0x4ab312[_0x8a8a('0x51')]})['then'](function(_0x428d57){_0x4c1f1a(null,_0x428d57);})[_0x8a8a('0x16')](function(_0x4da3f9){_0x4c1f1a(_0x4da3f9);});};AGIVertices['prototype'][_0x8a8a('0x52')]=function(_0x3c3f3d,_0x322b4c){this[_0x8a8a('0x11')][_0x8a8a('0x53')](_0x3c3f3d)[_0x8a8a('0x19')](function(_0x5ed59c){_0x322b4c(null,_0x5ed59c?_0x5ed59c['name']:![]);})['catch'](function(_0x414aa4){_0x322b4c(_0x414aa4);});};AGIVertices['prototype'][_0x8a8a('0x54')]=function(_0xb84ee7,_0x4e1ca8,_0x225801){var _0x38ba9f={'role':_0x8a8a('0x55')};_0x38ba9f[_0xb84ee7]=this[_0x8a8a('0x39')]['callerid'];this[_0x8a8a('0x11')]['agentPause'](_0x38ba9f,_0x4e1ca8,this[_0x8a8a('0x39')][_0x8a8a('0x3a')])['then'](function(_0x254e4c){_0x225801(null,_[_0x8a8a('0x47')](_0x254e4c)?![]:!![]);})[_0x8a8a('0x16')](function(_0x183015){logger['error'](_0x183015);_0x225801(null,![]);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x56')]=function(_0x46c03d,_0x5b029e){var _0x4fe07d={'role':_0x8a8a('0x55')};_0x4fe07d[_0x46c03d]=this['channel']['callerid'];this['rpc'][_0x8a8a('0x56')](_0x4fe07d)[_0x8a8a('0x19')](function(_0x5bdbd3){_0x5b029e(null,_[_0x8a8a('0x47')](_0x5bdbd3)?![]:!![]);})['catch'](function(_0x4aa202){logger[_0x8a8a('0x2e')](_0x4aa202);_0x5b029e(null,![]);});};AGIVertices[_0x8a8a('0x12')]['agentLogout']=function(_0x44d150,_0x184e96){var _0x45097b={'role':_0x8a8a('0x55')};_0x45097b[_0x44d150]=this[_0x8a8a('0x39')][_0x8a8a('0x3c')];this['rpc'][_0x8a8a('0x57')](_0x45097b)[_0x8a8a('0x19')](function(_0x587ea8){_0x184e96(null,_[_0x8a8a('0x47')](_0x587ea8)?![]:!![]);})[_0x8a8a('0x16')](function(_0x1d0300){logger[_0x8a8a('0x2e')](_0x1d0300);_0x184e96(null,![]);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x58')]=function(_0x81c1dd,_0x34a079){var _0x331979={'role':_0x8a8a('0x55')};_0x331979[_0x81c1dd]=this['channel'][_0x8a8a('0x3c')];var _0x2f7537=_0x81c1dd!='internal'?util[_0x8a8a('0x2b')](_0x8a8a('0x59'),_0x8a8a('0x5a'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')]):undefined;this['rpc'][_0x8a8a('0x58')](_0x331979,_0x2f7537)[_0x8a8a('0x19')](function(_0x3edc54){_0x34a079(null,_[_0x8a8a('0x47')](_0x3edc54)?![]:!![]);})[_0x8a8a('0x16')](function(_0x224ec2){logger[_0x8a8a('0x2e')](_0x224ec2);_0x34a079(null,![]);});};AGIVertices['prototype'][_0x8a8a('0x5b')]=function(_0x260a6b,_0x35ed30){sh['exec'](_[_0x8a8a('0x5c')](_0x260a6b),function(_0x54c7c1,_0x15b2e7){var _0x27a8bc=_0x15b2e7['replace'](/(\r\n|\n|\r)/gm,'');_0x35ed30(null,_0x27a8bc);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x5d')]=function(_0x2449a9,_0x25ec2f){scripts[_0x8a8a('0x5d')](_0x2449a9[_0x8a8a('0x5e')],_0x2449a9[_0x8a8a('0x5f')]||_0x8a8a('0x60'),_0x2449a9[_0x8a8a('0x60')],_0x2449a9[_0x8a8a('0x61')]||_0x8a8a('0x62'),_0x2449a9[_0x8a8a('0x63')]||_0x8a8a('0x64'),_0x2449a9[_0x8a8a('0x65')]||_0x8a8a('0x66'))[_0x8a8a('0x19')](function(_0xb703d1){_0x25ec2f(null,_0xb703d1);})[_0x8a8a('0x16')](function(_0x4fc451){_0x25ec2f(_0x4fc451);});};AGIVertices[_0x8a8a('0x12')]['googleTTS']=function(_0x33f5c8,_0x45d20f){scripts[_0x8a8a('0x67')](_0x33f5c8['text'],_0x33f5c8['google_tts_language']||'en',0x1)[_0x8a8a('0x19')](function(_0x428b99){_0x45d20f(null,_0x428b99);})[_0x8a8a('0x16')](function(_0x4b3db2){_0x45d20f(_0x4b3db2);});};AGIVertices['prototype'][_0x8a8a('0x68')]=function(_0x17514e,_0x46a556){var _0x155cc4={'uri':_0x17514e[_0x8a8a('0x69')],'method':_0x17514e[_0x8a8a('0x6a')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x17514e[_0x8a8a('0x6b')])===_0x8a8a('0x6c')&&parseInt(_0x17514e['timeout'])>=0x1?parseInt(_0x17514e[_0x8a8a('0x6b')])*0x3e8:0x5*0x3e8};if(_[_0x8a8a('0x6d')](['POST',_0x8a8a('0x6e')],_0x155cc4[_0x8a8a('0x6a')][_0x8a8a('0x6f')]())){try{_0x155cc4[_0x8a8a('0x70')]=_0x17514e[_0x8a8a('0xd')]?JSON[_0x8a8a('0x71')](_0x17514e['rawBody']):{};}catch(_0x2924a4){logger[_0x8a8a('0x2e')](_0x8a8a('0x72'),_0x2924a4);}}try{_0x155cc4[_0x8a8a('0x73')]=_0x17514e[_0x8a8a('0xc')]?JSON['parse'](_0x17514e[_0x8a8a('0xc')]):{};}catch(_0x430c83){logger[_0x8a8a('0x2e')](_0x8a8a('0x74'),_0x430c83);}if(_0x17514e[_0x8a8a('0x75')]){try{var _0x16ced2=require(_0x17514e[_0x8a8a('0x75')])[_0x8a8a('0x76')](this,_0x155cc4);_0x155cc4[_0x8a8a('0x77')]=Mustache[_0x8a8a('0x78')](_0x17514e['url'],_0x16ced2,{},['$$','$$']);if(_0x155cc4[_0x8a8a('0x73')]){_0x155cc4[_0x8a8a('0x73')]=JSON[_0x8a8a('0x71')](Mustache[_0x8a8a('0x78')](JSON[_0x8a8a('0x79')](_0x155cc4['headers']),_0x16ced2,{},['$$','$$']));}if(_0x155cc4['body']){_0x155cc4[_0x8a8a('0x70')]=JSON[_0x8a8a('0x71')](Mustache[_0x8a8a('0x78')](JSON['stringify'](_0x155cc4[_0x8a8a('0x70')]),_0x16ced2,{},['$$','$$']));}}catch(_0x312350){logger[_0x8a8a('0x2e')](_0x8a8a('0x7a'),_0x312350);}}rp(_0x155cc4)['then'](function(_0x13504b){var _0x90bb92={'statusCode':_0x13504b[_0x8a8a('0x7b')]||0xc8,'statusMessage':_0x13504b['statusMessage']||'OK','headers':_0x13504b['headers']||{},'body':_0x13504b['body']||{}};_0x46a556(null,_0x90bb92);})[_0x8a8a('0x16')](function(_0x57f22c){var _0x20540c={'statusCode':_0x57f22c['statusCode']||0x1f4,'statusMessage':_0x57f22c['message']||_0x8a8a('0x7c'),'headers':_0x57f22c['options']['headers']||{},'body':_0x57f22c['options'][_0x8a8a('0x70')]||{}};_0x46a556(null,_0x20540c);});};AGIVertices['prototype']['googleDialogflow']=function(_0x1d4823,_0x482fa4){scripts[_0x8a8a('0x7d')](this['channel'][_0x8a8a('0x3a')],_0x1d4823[_0x8a8a('0x7e')],_0x1d4823[_0x8a8a('0x60')],_0x1d4823[_0x8a8a('0x7f')]||'en')['then'](function(_0x1b5553){_0x482fa4(null,_0x1b5553);})[_0x8a8a('0x16')](function(_0x485cc4){_0x482fa4(_0x485cc4);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x80')]=function(_0x913e4c,_0x468669){scripts['googleDialogflowV2'](this['channel'][_0x8a8a('0x3a')],_0x913e4c[_0x8a8a('0x81')],_0x913e4c[_0x8a8a('0x82')],_0x913e4c['private_key'],_0x913e4c[_0x8a8a('0x60')],_0x913e4c[_0x8a8a('0x83')]||'en')[_0x8a8a('0x19')](function(_0x4acabe){_0x468669(null,_0x4acabe);})[_0x8a8a('0x16')](function(_0x3070ce){_0x468669(_0x3070ce);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x84')]=function(_0x277bd6,_0x5e3b50){scripts[_0x8a8a('0x84')](this[_0x8a8a('0x39')],_0x277bd6)[_0x8a8a('0x19')](function(_0x161c44){_0x5e3b50(null,_0x161c44);})[_0x8a8a('0x16')](function(_0x208c11){_0x5e3b50(_0x208c11);});};AGIVertices[_0x8a8a('0x12')]['ispeechTTS']=function(_0x586abb,_0xe8ce42){scripts[_0x8a8a('0x85')](_0x586abb[_0x8a8a('0x7e')],_0x586abb['text'],_0x586abb[_0x8a8a('0x86')]||_0x8a8a('0x62'),_0x586abb[_0x8a8a('0x87')])[_0x8a8a('0x19')](function(_0x3f9669){_0xe8ce42(null,_0x3f9669);})[_0x8a8a('0x16')](function(_0x3a0e27){_0xe8ce42(_0x3a0e27);});};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x88')]=function(_0xae3b7a,_0x5e9ecb,_0x217e95){scripts[_0x8a8a('0x88')](_0x5e9ecb,_0xae3b7a[_0x8a8a('0x7e')],_0xae3b7a['ispeech_asr_language']||_0x8a8a('0x62'),this[_0x8a8a('0x89')](_0xae3b7a[_0x8a8a('0x8a')])?_0xae3b7a['model']:undefined)['then'](function(_0x1f409b){_0x217e95(null,_0x1f409b);})[_0x8a8a('0x16')](function(_0x2319a4){_0x217e95(_0x2319a4);});};AGIVertices[_0x8a8a('0x12')]['awsPolly']=function(_0x2fa27b,_0x368294){scripts[_0x8a8a('0x8b')](_0x2fa27b[_0x8a8a('0x8c')],_0x2fa27b['aws_secret_access_key'],_0x2fa27b['aws_polly_region'],_0x2fa27b[_0x8a8a('0x8d')]||_0x8a8a('0x8e'),_0x2fa27b[_0x8a8a('0x60')],_0x2fa27b['aws_text_type']||_0x8a8a('0x60'))[_0x8a8a('0x19')](function(_0x2affff){_0x368294(null,_0x2affff);})[_0x8a8a('0x16')](function(_0x31f2e6){_0x368294(_0x31f2e6);});};AGIVertices['prototype'][_0x8a8a('0x8f')]=function(_0x5d727e,_0x239be1){scripts[_0x8a8a('0x8f')](this[_0x8a8a('0x39')][_0x8a8a('0x3a')],_0x5d727e[_0x8a8a('0x8c')],_0x5d727e[_0x8a8a('0x90')],_0x5d727e['aws_lex_region'],_0x5d727e[_0x8a8a('0x60')],_0x5d727e[_0x8a8a('0x91')])['then'](function(_0x5b4fa9){_0x239be1(null,_0x5b4fa9);})[_0x8a8a('0x16')](function(_0x15eb58){_0x239be1(_0x15eb58);});};AGIVertices['prototype'][_0x8a8a('0x92')]=function(_0x5c4e71,_0x4a774d,_0x2ca0ce){scripts[_0x8a8a('0x92')](_0x4a774d,_0x5c4e71[_0x8a8a('0x7e')],_0x5c4e71['google_asr_language']||_0x8a8a('0x62'))[_0x8a8a('0x19')](function(_0x86cab6){_0x2ca0ce(null,_0x86cab6);})[_0x8a8a('0x16')](function(_0x232ab9){_0x2ca0ce(_0x232ab9);});};AGIVertices[_0x8a8a('0x12')]['tildeASR']=function(_0x595809,_0x482cce,_0x24798d){scripts[_0x8a8a('0x93')](_0x482cce,_0x595809[_0x8a8a('0x94')],_0x595809[_0x8a8a('0x95')],_0x595809[_0x8a8a('0x77')])[_0x8a8a('0x19')](function(_0x29627c){_0x24798d(null,_0x29627c);})[_0x8a8a('0x16')](function(_0x3afd87){_0x24798d(_0x3afd87);});};AGIVertices['prototype'][_0x8a8a('0x96')]=function(_0x41180e){var _0x2f3fb5=_[_0x8a8a('0x6d')](verticesWithRetry,_0x41180e[_0x8a8a('0x97')])?_0x41180e:_[_0x8a8a('0x98')](_0x41180e);for(var _0x514522 in _0x2f3fb5){if(_0x2f3fb5['hasOwnProperty'](_0x514522)){if(_0x2f3fb5[_0x514522]&&_['isString'](_0x2f3fb5[_0x514522])){if(_[_0x8a8a('0x6d')](recursiveMapAttributes,_0x514522)){_0x2f3fb5[_0x514522]=this['replaceObjectAllVariables'](_0x2f3fb5[_0x514522]);}else{_0x2f3fb5[_0x514522]=this[_0x8a8a('0x99')](_0x2f3fb5[_0x514522]);}}}}return _0x2f3fb5;};AGIVertices['prototype'][_0x8a8a('0x9a')]=function(_0x48922c){for(var _0x1f1c12 in _0x48922c){if(_0x48922c[_0x8a8a('0x9b')](_0x1f1c12)){if(_['isPlainObject'](_0x48922c[_0x1f1c12])){this[_0x8a8a('0x9a')](_0x48922c[_0x1f1c12]);}else if(_['isArray'](_0x48922c[_0x1f1c12])){for(var _0x48c4a8=0x0;_0x48c4a8<_0x48922c[_0x1f1c12][_0x8a8a('0x9c')];_0x48c4a8++){this['recursiveNodeIndex'](_0x48922c[_0x1f1c12][_0x48c4a8]);}}else if(_[_0x8a8a('0x9d')](_0x48922c[_0x1f1c12])){_0x48922c[_0x1f1c12]=this['replaceAllVariables'](_0x48922c[_0x1f1c12]);}}}};AGIVertices[_0x8a8a('0x12')]['saveRestApiResult']=function(_0x34aa82,_0x41cb65){for(var _0x2ac5c1 in _0x34aa82){if(_0x34aa82[_0x8a8a('0x9b')](_0x2ac5c1)){if(_['isPlainObject'](_0x34aa82[_0x2ac5c1])){if(!_[_0x8a8a('0x49')](_0x34aa82[_0x2ac5c1])){this[_0x8a8a('0x9e')](_0x34aa82[_0x2ac5c1],util[_0x8a8a('0x2b')](_0x8a8a('0x9f'),_0x41cb65,_0x2ac5c1));}}else if(_['isArray'](_0x34aa82[_0x2ac5c1])){for(var _0x19804c=0x0;_0x19804c<_0x34aa82[_0x2ac5c1][_0x8a8a('0x9c')];_0x19804c++){this[_0x8a8a('0x9e')](_0x34aa82[_0x2ac5c1][_0x19804c],util['format'](_0x8a8a('0x9f'),_0x41cb65,_0x2ac5c1+'['+_0x19804c+']'));}}else{if(!_[_0x8a8a('0x47')](_0x34aa82[_0x2ac5c1])){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')]('%s.%s',_0x41cb65,_0x2ac5c1),_0x34aa82[_0x2ac5c1]);}}}}};AGIVertices['prototype'][_0x8a8a('0xa1')]=function(_0x2dd542){try{var _0x372891=JSON['parse'](_0x2dd542);this[_0x8a8a('0x9a')](_0x372891);return JSON[_0x8a8a('0x79')](_0x372891);}catch(_0x559f13){return this['replaceAllVariables'](_0x2dd542);}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x99')]=function(_0x144e48){var _0x55a1b1=_0x144e48[_0x8a8a('0xa2')]('{');for(var _0x2f3aa6=0x1;_0x2f3aa6<_0x55a1b1['length'];_0x2f3aa6+=0x1){var _0x313eac=_0x55a1b1[_0x2f3aa6][_0x8a8a('0xa2')]('}');if(_0x313eac['length']>0x1){_0x144e48=_0x144e48[_0x8a8a('0xa3')]('{'+_0x313eac[0x0]+'}',this['channel'][_0x8a8a('0x13')](_0x313eac[0x0])[_0x8a8a('0xa4')]||_0x313eac[0x0]);}}if(_0x55a1b1['length']===0x1){return _0x144e48[_0x8a8a('0x50')]();}return this[_0x8a8a('0x99')](_0x144e48);};AGIVertices['prototype'][_0x8a8a('0xa5')]=function(_0x50a788,_0x226094){var _0x444cbe=this['channel'][_0x8a8a('0x13')](_0x50a788);if(_0x444cbe[_0x8a8a('0xa6')]===-0x1){return _0x444cbe;}logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0xa7'),_0x226094,_0x444cbe['extra']));return this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x226094,_0x444cbe[_0x8a8a('0xa4')]);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x89')]=function(_0x54ad37){return _0x54ad37&&_0x54ad37!=='0'&&_0x54ad37!=='-1'&&_0x54ad37!=='';};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xa8')]=function(_0x4f9c61){this[_0x8a8a('0x38')][_0x8a8a('0x76')](this,_0x4f9c61,'-');_0x4f9c61[_0x8a8a('0xa9')]=_0x4f9c61['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x8a8a('0xaa')]=function(_0x1cb3aa){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xab'),_0x1cb3aa[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1cb3aa['text'])){return this['channel']['noop'](_0x8a8a('0xac'));}var _0x24c56f='\x22'+_0x1cb3aa[_0x8a8a('0x60')]+'\x22';if(this['isConfigured'](_0x1cb3aa[_0x8a8a('0xad')])){_0x24c56f+=','+_0x1cb3aa[_0x8a8a('0xad')];}var _0x39d705=this[_0x8a8a('0x39')][_0x8a8a('0xae')]('MRCPSynth',_0x24c56f);if(_0x39d705[_0x8a8a('0xa6')]===-0x1){return _0x39d705;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0xb0'),_0x24c56f));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xb1')]=function(_0x541c4b){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0xb2'),_0x541c4b[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x541c4b[_0x8a8a('0xb3')])){return this[_0x8a8a('0x39')]['noop'](_0x8a8a('0xb4'));}var _0x79c5d8=_0x541c4b['grammar'];if(this[_0x8a8a('0x89')](_0x541c4b['options'])){_0x79c5d8+=','+_0x541c4b['options'];}var _0x2a8210=this[_0x8a8a('0x39')]['exec']('MRCPRecog',_0x79c5d8);if(_0x2a8210['result']===-0x1){return _0x2a8210;}var _0x43757f=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x8a8a('0xb5'));if(_0x43757f[_0x8a8a('0xa6')]===-0x1){return _0x43757f;}var _0x58ac24=this[_0x8a8a('0xa5')](_0x8a8a('0xb6'),_0x8a8a('0xb7'));if(_0x58ac24[_0x8a8a('0xa6')]===-0x1){return _0x58ac24;}var _0x46b408=this['getAndSetVariable'](_0x8a8a('0xb8'),'MRCP_RECOG_INSTANCE');if(_0x46b408[_0x8a8a('0xa6')]===-0x1){return _0x46b408;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x79c5d8));};AGIVertices['prototype'][_0x8a8a('0x8')]=function(_0x390e6f){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0xb9'),_0x390e6f['label']));return this[_0x8a8a('0x39')][_0x8a8a('0x8')]([_0x390e6f[_0x8a8a('0xba')],_0x390e6f['args']]);};AGIVertices['prototype'][_0x8a8a('0xbb')]=function(_0x4d9d70){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0xbc'),_0x4d9d70['label']));if(this['isConfigured'](_0x4d9d70['timeout'])){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0xbd'),_0x4d9d70[_0x8a8a('0x6b')]));var _0x5d955f=this[_0x8a8a('0x39')][_0x8a8a('0xbe')](_0x4d9d70[_0x8a8a('0x6b')]);if(_0x5d955f[_0x8a8a('0xa6')]===-0x1){return _0x5d955f;}}return this[_0x8a8a('0x39')][_0x8a8a('0xbb')]();};AGIVertices[_0x8a8a('0x12')]['callback']=function(_0x4df369){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xbf'),_0x4df369['label']));if(!this[_0x8a8a('0x89')](_0x4df369[_0x8a8a('0x4c')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x4df369,'no\x20list\x20selected');}_0x4df369['scheduledAt']=moment();if(this[_0x8a8a('0x89')](_0x4df369[_0x8a8a('0xc0')])){_0x4df369[_0x8a8a('0x4d')]=moment()[_0x8a8a('0xc1')](_0x4df369[_0x8a8a('0xc0')],_0x8a8a('0xc2'));}if(!this[_0x8a8a('0x89')](_0x4df369[_0x8a8a('0x51')])){_0x4df369[_0x8a8a('0x51')]=0x2;}this[_0x8a8a('0x46')][_0x8a8a('0x76')](this,_0x4df369);return this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc3'),_0x4df369[_0x8a8a('0x4b')],_0x4df369[_0x8a8a('0x4c')],_0x4df369[_0x8a8a('0x4d')]));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xc4')]=function(_0x39f201){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x39f201[_0x8a8a('0x3b')]));var _0x211dfc=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x39f201['application'],_0x39f201[_0x8a8a('0xad')]);if(_0x211dfc[_0x8a8a('0xa6')]===-0x1){return _0x211dfc;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x39f201['application'],_0x39f201[_0x8a8a('0xad')]));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xc6')]=function(_0x3e2fe8){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xc7'),_0x3e2fe8[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x3e2fe8[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}var _0x140f63='\x22'+_0x3e2fe8[_0x8a8a('0x60')]+'\x22';if(this[_0x8a8a('0x89')](_0x3e2fe8[_0x8a8a('0xad')])){_0x140f63+=','+_0x3e2fe8[_0x8a8a('0xad')];}var _0x53bf85=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0xc8'),_0x140f63);if(_0x53bf85[_0x8a8a('0xa6')]===-0x1){return _0x53bf85;}return this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0xb0'),_0x140f63));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xc9')]=function(_0x3e8d6f){logger['info'](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3e8d6f[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x3e8d6f[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}var _0x4d9461='\x22'+_0x3e8d6f[_0x8a8a('0x60')]+'\x22';if(this[_0x8a8a('0x89')](_0x3e8d6f[_0x8a8a('0xad')])){_0x4d9461+=','+_0x3e8d6f['options'];}var _0x421d3a=this[_0x8a8a('0x39')][_0x8a8a('0xae')]('MRCPSynth',_0x4d9461);if(_0x421d3a[_0x8a8a('0xa6')]===-0x1){return _0x421d3a;}return this[_0x8a8a('0x39')]['noop'](util['format'](_0x8a8a('0xb0'),_0x4d9461));};AGIVertices['prototype']['lumenvoxasr']=function(_0x54ce27){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xca'),_0x54ce27[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x54ce27[_0x8a8a('0xb3')])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0xb4'));}var _0x4fe68d=_0x54ce27[_0x8a8a('0xb3')];if(this[_0x8a8a('0x89')](_0x54ce27['options'])){_0x4fe68d+=','+_0x54ce27[_0x8a8a('0xad')];}var _0x14cc59=this['channel'][_0x8a8a('0xae')](_0x8a8a('0xcb'),_0x4fe68d);if(_0x14cc59[_0x8a8a('0xa6')]===-0x1){return _0x14cc59;}var _0x5ac2e2=this[_0x8a8a('0xa5')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x5ac2e2[_0x8a8a('0xa6')]===-0x1){return _0x5ac2e2;}var _0x4684ca=this['getAndSetVariable'](_0x8a8a('0xb6'),_0x8a8a('0xcc'));if(_0x4684ca[_0x8a8a('0xa6')]===-0x1){return _0x4684ca;}var _0x188109=this[_0x8a8a('0xa5')](_0x8a8a('0xb8'),_0x8a8a('0xcd'));if(_0x188109[_0x8a8a('0xa6')]===-0x1){return _0x188109;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xce'),_0x4fe68d));};AGIVertices[_0x8a8a('0x12')]['sestekasr']=function(_0x36ddee){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x36ddee[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x36ddee[_0x8a8a('0xb3')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xb4'));}var _0x13890f=_0x36ddee[_0x8a8a('0xb3')];if(this[_0x8a8a('0x89')](_0x36ddee[_0x8a8a('0xad')])){_0x13890f+=','+_0x36ddee[_0x8a8a('0xad')];}var _0x5c9358=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0xcb'),_0x13890f);if(_0x5c9358[_0x8a8a('0xa6')]===-0x1){return _0x5c9358;}var _0x2562cf=this[_0x8a8a('0xa5')](_0x8a8a('0xcf'),'SESTEK_ASR_CONFIDENCE');if(_0x2562cf[_0x8a8a('0xa6')]===-0x1){return _0x2562cf;}var _0x1180fd=this['getAndSetVariable'](_0x8a8a('0xb6'),'SESTEK_ASR_TRANSCRIPT');if(_0x1180fd[_0x8a8a('0xa6')]===-0x1){return _0x1180fd;}var _0x680d70=this['getAndSetVariable'](_0x8a8a('0xb8'),_0x8a8a('0xd0'));if(_0x680d70['result']===-0x1){return _0x680d70;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0xce'),_0x13890f));};AGIVertices['prototype'][_0x8a8a('0xd1')]=function(_0x148b86){logger[_0x8a8a('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x148b86[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x148b86[_0x8a8a('0xd2')])){return this['channel']['error'](_0x148b86,_0x8a8a('0xd3'));}var _0x496c28=this['getSquareOdbc'][_0x8a8a('0x76')](this,_0x148b86[_0x8a8a('0xd2')]);if(!_0x496c28){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x148b86,_0x8a8a('0xd4'));}if(!this['isConfigured'](_0x148b86[_0x8a8a('0xd5')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x148b86,'no\x20query\x20configured');}var _0x3e63d4=_0x148b86['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x8a8a('0xaf')](util['format']('query:\x20%s',_0x3e63d4));var _0x484cc6=this[_0x8a8a('0x2d')][_0x8a8a('0x76')](this,_0x496c28,_0x3e63d4);this[_0x8a8a('0x38')][_0x8a8a('0x76')](this,_0x148b86,_0x3e63d4);if(!this['isConfigured'](_0x148b86[_0x8a8a('0xd6')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x186c2c=this['getVariable']['sync'](this,_0x148b86[_0x8a8a('0xd6')]);if(!_0x186c2c){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x148b86,_0x8a8a('0xd7'));}var _0xe5a7a1=this;_0x484cc6['forEach'](function(_0x268d50,_0x33e008){Object[_0x8a8a('0xd8')](_0x268d50)[_0x8a8a('0xd9')](function(_0x18b99c){_0xe5a7a1[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0xda'),_0x186c2c,_0x33e008,_0x18b99c),_0x268d50[_0x18b99c]);});});this['channel'][_0x8a8a('0xa0')](util['format'](_0x8a8a('0xdb'),_0x186c2c),_0x484cc6[_0x8a8a('0x9c')]);return this['channel']['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0xdc'),_0x186c2c));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xdd')]=function(_0x1ddc95){logger[_0x8a8a('0xde')](util[_0x8a8a('0x2b')](_0x8a8a('0xdf'),_0x1ddc95[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1ddc95[_0x8a8a('0xe0')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1ddc95,'no\x20user\x20selected');}var _0x14fee6=this[_0x8a8a('0x1d')][_0x8a8a('0x76')](this,_0x1ddc95[_0x8a8a('0xe0')]);if(!_0x14fee6){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1ddc95,_0x8a8a('0xe1'));}var _0x43445a=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0xe2'),[util[_0x8a8a('0x2b')](_0x8a8a('0xe3'),_0x14fee6),_0x1ddc95[_0x8a8a('0x6b')],_0x1ddc95[_0x8a8a('0xe4')],_0x1ddc95[_0x8a8a('0x69')]]);if(_0x43445a[_0x8a8a('0xa6')]===-0x1){return _0x43445a;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xe5'),_0x8a8a('0xe2')));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xe6')]=function(_0x3f064c){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xe7'),_0x3f064c[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x3f064c[_0x8a8a('0x7e')])){return this['channel']['noop'](_0x8a8a('0xe8'));}if(!this['isConfigured'](_0x3f064c[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}this['channel'][_0x8a8a('0xe9')]=!![];this[_0x8a8a('0x38')](_0x3f064c);this[_0x8a8a('0x45')](_0x3f064c[_0x8a8a('0x60')],'in','','');this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xea'),_0x3f064c[_0x8a8a('0x60')]));var _0x9415d6=this[_0x8a8a('0x7d')]['sync'](this,_0x3f064c);if(_0x9415d6){for(var _0x1c4d94 in _0x9415d6){if(_0x9415d6[_0x8a8a('0x9b')](_0x1c4d94)){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0xeb'),_0x1c4d94[_0x8a8a('0x6f')]()),_0x9415d6[_0x1c4d94]);}}this[_0x8a8a('0x45')](_0x9415d6[_0x8a8a('0xec')],_0x8a8a('0xed'),_0x8a8a('0xe6'),'');return this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xee'),_0x9415d6[_0x8a8a('0xec')]));}return this[_0x8a8a('0x39')]['error'](_0x3f064c,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xef')]=function(_0x37d14e){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x37d14e[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x37d14e[_0x8a8a('0x81')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xf0'));}if(!this[_0x8a8a('0x89')](_0x37d14e['client_email'])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xf1'));}if(!this[_0x8a8a('0x89')](_0x37d14e[_0x8a8a('0xf2')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xf3'));}if(!this[_0x8a8a('0x89')](_0x37d14e[_0x8a8a('0x83')])){return this[_0x8a8a('0x39')]['noop'](_0x8a8a('0xf4'));}if(!this[_0x8a8a('0x89')](_0x37d14e[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20text\x20configured');}this['channel'][_0x8a8a('0xe9')]=!![];this[_0x8a8a('0x38')](_0x37d14e);this['createSquareMessage'](_0x37d14e[_0x8a8a('0x60')],'in','','');this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0xf5'),_0x37d14e[_0x8a8a('0x60')]));var _0x17d76c=this['googleDialogflowV2'][_0x8a8a('0x76')](this,_0x37d14e);if(_0x17d76c){for(var _0x37de79 in _0x17d76c){if(_0x17d76c[_0x8a8a('0x9b')](_0x37de79)){if(_0x37de79!==_0x8a8a('0xf6')){this['channel'][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')]('DIALOGFLOW_%s',_0x37de79[_0x8a8a('0x6f')]()),_0x17d76c[_0x37de79]);}}}this[_0x8a8a('0x45')](_0x17d76c[_0x8a8a('0xec')],_0x8a8a('0xed'),_0x8a8a('0xef'),_0x17d76c[_0x8a8a('0xf6')]);return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xf7'),_0x17d76c[_0x8a8a('0xec')]));}return this[_0x8a8a('0x39')]['error'](_0x37d14e,_0x8a8a('0xf8'));};AGIVertices['prototype'][_0x8a8a('0xf9')]=function(_0x4b334b){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0xfa'),_0x4b334b[_0x8a8a('0x3b')]));if(!this['isConfigured'](_0x4b334b[_0x8a8a('0xfb')])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0xfc'));}if(!this[_0x8a8a('0x89')](_0x4b334b[_0x8a8a('0xfd')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xfe'));}if(!this[_0x8a8a('0x89')](_0x4b334b['password'])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0xff'));}if(!this[_0x8a8a('0x89')](_0x4b334b[_0x8a8a('0x100')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}this[_0x8a8a('0x39')][_0x8a8a('0xe9')]=!![];this[_0x8a8a('0x38')](_0x4b334b);this['createSquareMessage'](_0x4b334b['text'],'in','','');this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0x101'),_0x4b334b[_0x8a8a('0x60')]));var _0x39f4a8=this['sestekNDA'][_0x8a8a('0x76')](this,_0x4b334b);if(_0x39f4a8){for(var _0x2fda48 in _0x39f4a8){if(_0x39f4a8[_0x8a8a('0x9b')](_0x2fda48)){this['channel']['setVariable'](util[_0x8a8a('0x2b')](_0x8a8a('0x102'),_0x2fda48[_0x8a8a('0x6f')]()),_0x39f4a8[_0x2fda48]);}}this[_0x8a8a('0x45')](_0x39f4a8[_0x8a8a('0xec')],_0x8a8a('0xed'),_0x8a8a('0xf9'),'');if(_0x39f4a8['audiofile']){this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x39f4a8[_0x8a8a('0x103')]));var _0x5a177b=this['channel']['streamFile'](_0x39f4a8[_0x8a8a('0x103')]);try{fs[_0x8a8a('0x104')](_0x39f4a8[_0x8a8a('0x103')]+_0x8a8a('0x105'));}catch(_0xcfd82f){logger[_0x8a8a('0x2e')](_0xcfd82f);}return _0x5a177b;}else{return this['channel']['noop'](util['format'](_0x8a8a('0x106'),_0x39f4a8[_0x8a8a('0xec')]));}}return this[_0x8a8a('0x39')]['error'](_0x4b334b,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x8a8a('0x107')]=function(_0x5168b5){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x5168b5[_0x8a8a('0x3b')]));return this['channel']['noop'](_0x8a8a('0x107'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x108')]=function(_0x4a4566){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4a4566[_0x8a8a('0x3b')]));var _0x25701d='';if(_0x4a4566[_0x8a8a('0x109')]){if(!this[_0x8a8a('0x89')](_0x4a4566[_0x8a8a('0x109')])){return this[_0x8a8a('0x39')]['error'](_0x4a4566,_0x8a8a('0x10a'));}else{var _0x2e5aff=parseInt(_0x4a4566[_0x8a8a('0x109')],0xa);if(isNaN(_0x2e5aff)){_0x25701d=_0x4a4566[_0x8a8a('0x109')];}else{_0x25701d=this[_0x8a8a('0x10b')]['sync'](this,_0x4a4566[_0x8a8a('0x109')]);if(!_0x25701d){return this['channel'][_0x8a8a('0x2e')](_0x4a4566,_0x8a8a('0x10c'));}}}}else if(_0x4a4566[_0x8a8a('0x10d')]){_0x25701d=_0x4a4566[_0x8a8a('0x10d')];}else{return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x4a4566,'no\x20trunk\x20selected');}var _0x5147d6=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0xe2'),[util[_0x8a8a('0x2b')](_0x8a8a('0x10e'),_0x25701d,_0x4a4566[_0x8a8a('0x4b')]),_0x4a4566[_0x8a8a('0x6b')],_0x4a4566[_0x8a8a('0xe4')],_0x4a4566[_0x8a8a('0x69')]]);if(_0x5147d6[_0x8a8a('0xa6')]===-0x1){return _0x5147d6;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0xe5'),'DIAL'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x10f')]=function(_0x23ecfd){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x110'),_0x23ecfd[_0x8a8a('0x3b')]));return this['channel'][_0x8a8a('0xaf')]('finally');};AGIVertices[_0x8a8a('0x12')]['getdigits']=function(_0x117aac){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x111'),_0x117aac['label']));if(_0x117aac['retry']===0x0){return this[_0x8a8a('0xa8')](_0x117aac);}_0x117aac[_0x8a8a('0xa9')]-=0x1;if(!this['isConfigured'](_0x117aac[_0x8a8a('0x112')])){return this['channel']['error'](_0x117aac,_0x8a8a('0x113'));}var _0x44eca1=this[_0x8a8a('0x20')]['sync'](this,_0x117aac[_0x8a8a('0x112')]);if(!_0x44eca1){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x117aac,'no\x20file\x20audio\x20found');}if(!this[_0x8a8a('0x89')](_0x117aac[_0x8a8a('0xd6')])){return this['channel']['error'](_0x8a8a('0x114'));}var _0x2b7030=this[_0x8a8a('0x39')][_0x8a8a('0x115')](_0x44eca1,_0x117aac[_0x8a8a('0x116')],_0x117aac['maxdigit']);var _0x113d31=_0x2b7030['result']?_0x2b7030['result'][_0x8a8a('0x50')]():'';logger[_0x8a8a('0x30')](_0x8a8a('0x117'),JSON[_0x8a8a('0x79')](_0x2b7030));if(_0x2b7030[_0x8a8a('0xa6')]===-0x1){this[_0x8a8a('0x38')]['sync'](this,_0x117aac,_0x113d31);return _0x2b7030;}else if(_0x2b7030[_0x8a8a('0xa4')]===_0x8a8a('0x6b')){_0x2b7030[_0x8a8a('0xa6')]=_0x113d31[_0x8a8a('0x9c')]>=parseInt(_0x117aac[_0x8a8a('0x118')])?'x':'i';}else{_0x2b7030['result']=_0x113d31[_0x8a8a('0x9c')]>=parseInt(_0x117aac['mindigit'])&&_0x113d31[_0x8a8a('0x9c')]<=parseInt(_0x117aac['maxdigit'])?'x':'i';}var _0x59e5ef=this[_0x8a8a('0x13')][_0x8a8a('0x76')](this,_0x117aac[_0x8a8a('0xd6')]);if(!_0x59e5ef){return this['channel'][_0x8a8a('0x2e')](_0x117aac,'no\x20variable\x20found');}this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x59e5ef,_0x113d31);if(this[_0x8a8a('0x89')](_0x117aac[_0x8a8a('0x119')])){var _0x12e9ba=parseInt(_0x117aac[_0x8a8a('0x119')],0xa);var _0x430b64=rs[_0x8a8a('0x11a')]({'charset':'*','length':_0x12e9ba});var _0x3d5bf0=_0x113d31[_0x8a8a('0x9c')];if(_0x3d5bf0>0x0){if(_0x3d5bf0>_0x12e9ba){this[_0x8a8a('0x38')]['sync'](this,_0x117aac,_0x117aac['hiddendigitspos']===_0x8a8a('0x11b')?_0x430b64+_0x113d31[_0x8a8a('0x11c')](_0x12e9ba):_0x113d31[_0x8a8a('0x11c')](0x0,_0x3d5bf0-_0x12e9ba)+_0x430b64);}else{this['createSquareDetailsReport']['sync'](this,_0x117aac,rs[_0x8a8a('0x11a')]({'charset':'*','length':_0x3d5bf0}));}}else{this[_0x8a8a('0x38')]['sync'](this,_0x117aac,'');}}else{this['createSquareDetailsReport'][_0x8a8a('0x76')](this,_0x117aac,_0x113d31);}return _0x2b7030;};AGIVertices[_0x8a8a('0x12')]['getsecretdigits']=function(_0x5e618d){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x11d'),_0x5e618d['label']));return this[_0x8a8a('0xf')](_0x5e618d);};AGIVertices['prototype']['goal']=function(_0x589389){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x11e'),_0x589389[_0x8a8a('0x3b')]));this[_0x8a8a('0x38')]['sync'](this,_0x589389,_0x589389['goalname']);return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('GOAL\x20%s',_0x589389[_0x8a8a('0x11f')]));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x120')]=function(_0x5e4abc){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5e4abc[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x5e4abc[_0x8a8a('0x8c')])||!this[_0x8a8a('0x89')](_0x5e4abc[_0x8a8a('0x90')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x8a8a('0x89')](_0x5e4abc[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')]['noop'](_0x8a8a('0xac'));}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0x121'),_0x5e4abc[_0x8a8a('0x60')]));var _0x10e059=this[_0x8a8a('0x8b')][_0x8a8a('0x76')](this,_0x5e4abc);if(_0x10e059){this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x122'),_0x10e059));var _0x3a0fd0=this[_0x8a8a('0x39')][_0x8a8a('0x123')](_0x10e059);try{fs[_0x8a8a('0x104')](_0x10e059+_0x8a8a('0x105'));}catch(_0xa120ef){logger[_0x8a8a('0x2e')](_0xa120ef);}return _0x3a0fd0;}return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x5e4abc,_0x8a8a('0x124'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x125')]=function(_0x3a60dc){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x126'),_0x3a60dc[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x3a60dc[_0x8a8a('0x8c')])||!this[_0x8a8a('0x89')](_0x3a60dc[_0x8a8a('0x90')])){return this[_0x8a8a('0x39')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x8a8a('0x89')](_0x3a60dc[_0x8a8a('0x91')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20bot\x20name\x20configured');}if(!this[_0x8a8a('0x89')](_0x3a60dc[_0x8a8a('0x60')])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0xac'));}this[_0x8a8a('0x39')][_0x8a8a('0xe9')]=!![];this['createSquareDetailsReport'](_0x3a60dc);this[_0x8a8a('0x45')](_0x3a60dc[_0x8a8a('0x60')],'in','','');this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x127'),_0x3a60dc[_0x8a8a('0x60')]));var _0x1db5e4=this[_0x8a8a('0x8f')][_0x8a8a('0x76')](this,_0x3a60dc);if(_0x1db5e4){for(var _0x268030 in _0x1db5e4){if(_0x1db5e4['hasOwnProperty'](_0x268030)&&_[_0x8a8a('0x9d')](_0x1db5e4[_0x268030])){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util['format'](_0x8a8a('0x128'),_0x268030[_0x8a8a('0x6f')]()),_0x1db5e4[_0x268030]);}}if(_[_0x8a8a('0x47')](_0x1db5e4[_0x8a8a('0x129')])){return this[_0x8a8a('0x39')]['noop'](_0x8a8a('0x12a'));}else{this['createSquareMessage'](_0x1db5e4[_0x8a8a('0x129')],_0x8a8a('0xed'),_0x8a8a('0x12b'),'');return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x12c'),_0x1db5e4[_0x8a8a('0x129')]));}}return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3a60dc,_0x8a8a('0x12d'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x12e')]=function(_0x59a279){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x12f'),_0x59a279['label'],_0x59a279[_0x8a8a('0x6b')]));if(!this[_0x8a8a('0x89')](_0x59a279[_0x8a8a('0x7e')])){return this[_0x8a8a('0x39')]['noop']('no\x20key\x20configured');}var _0x13e934=_0x8a8a('0x130');var _0x578863=util[_0x8a8a('0x2b')](_0x8a8a('0x131'),FILES_PATH,rs[_0x8a8a('0x11a')](0x4));var _0x398350=util['format'](_0x8a8a('0x9f'),_0x578863,_0x13e934);var _0x1e995b=!![];if(_0x59a279[_0x8a8a('0x132')]==='NOBEEP'){_0x1e995b=![];}var _0x4525f3=this['channel'][_0x8a8a('0x133')](_0x578863,_0x13e934,_0x59a279['intKey'],_0x59a279['timeout'],undefined,_0x1e995b);if(_0x4525f3[_0x8a8a('0xa6')]!==-0x1){this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x134'),_0x398350));var _0x2754ce=this[_0x8a8a('0x92')]['sync'](this,_0x59a279,_0x398350);if(_0x2754ce){for(var _0x337ddf in _0x2754ce){if(_0x2754ce[_0x8a8a('0x9b')](_0x337ddf)){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0x135'),_0x337ddf['toUpperCase']()),_0x2754ce[_0x337ddf]);}}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x136'),JSON[_0x8a8a('0x79')](_0x2754ce)));}}return _0x4525f3;};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x137')]=function(_0xf6c9fa){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x138'),_0xf6c9fa['label']));if(!this['isConfigured'](_0xf6c9fa['appid'])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x139'));}if(!this['isConfigured'](_0xf6c9fa['appsecret'])){return this[_0x8a8a('0x39')]['noop']('no\x20appsecret\x20configured');}var _0x4f6f49=_0x8a8a('0x130');var _0x4f9afe=util[_0x8a8a('0x2b')](_0x8a8a('0x131'),FILES_PATH,rs[_0x8a8a('0x11a')](0x4));var _0x757d7=util['format'](_0x8a8a('0x9f'),_0x4f9afe,_0x4f6f49);var _0x4262ff=!![];if(_0xf6c9fa['beep']==='NOBEEP'){_0x4262ff=![];}var _0x2d0600=this[_0x8a8a('0x39')][_0x8a8a('0x133')](_0x4f9afe,_0x4f6f49,_0xf6c9fa['intKey'],_0xf6c9fa[_0x8a8a('0x6b')],undefined,_0x4262ff);if(_0x2d0600[_0x8a8a('0xa6')]!==-0x1){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x13a'),_0x757d7));var _0x1c2806=this[_0x8a8a('0x93')][_0x8a8a('0x76')](this,_0xf6c9fa,_0x757d7);if(_0x1c2806){for(var _0x436232 in _0x1c2806){if(_0x1c2806[_0x8a8a('0x9b')](_0x436232)){this['channel'][_0x8a8a('0xa0')](util['format'](_0x8a8a('0x13b'),_0x436232['toUpperCase']()),_0x1c2806[_0x436232]);}}return this['channel'][_0x8a8a('0xaf')](util['format']('TildeASR\x20Result\x20%s',JSON['stringify'](_0x1c2806)));}}return _0x2d0600;};AGIVertices['prototype'][_0x8a8a('0x13c')]=function(_0x3a1604){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x13d'),_0x3a1604[_0x8a8a('0x3b')]));return this[_0x8a8a('0x39')][_0x8a8a('0x13e')](_0x3a1604[_0x8a8a('0x3f')],_0x3a1604[_0x8a8a('0x40')],_0x3a1604[_0x8a8a('0x41')]);};AGIVertices['prototype'][_0x8a8a('0x13f')]=function(_0x596653){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x140'),_0x596653[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x596653[_0x8a8a('0x141')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x596653,_0x8a8a('0x142'));}try{var _0x363878=eval(_0x596653[_0x8a8a('0x141')])?'true':'false';this['channel'][_0x8a8a('0xaf')](util['format'](_0x8a8a('0x143'),_0x596653[_0x8a8a('0x141')],_0x363878));return{'code':0xc8,'result':_0x363878};}catch(_0xa9c8f4){return{'code':0xc8,'result':_0x8a8a('0x144')};}};AGIVertices[_0x8a8a('0x12')]['gotoiftime']=function(_0x1db7f1){logger['info'](util[_0x8a8a('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1db7f1[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1db7f1[_0x8a8a('0x145')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1db7f1,_0x8a8a('0x146'));}var _0x2406f1=this['getIntervals'][_0x8a8a('0x76')](this,_0x1db7f1['interval_id']);if(!_0x2406f1){return this['channel']['error'](_0x1db7f1,'no\x20intervals\x20found');}for(var _0x4b873d=0x0;_0x4b873d<_0x2406f1[_0x8a8a('0x9c')];_0x4b873d+=0x1){var _0x3cff27=this[_0x8a8a('0x39')][_0x8a8a('0x13')](util[_0x8a8a('0x2b')](_0x8a8a('0x147'),_0x2406f1[_0x4b873d]));if(_0x3cff27[_0x8a8a('0xa6')]===-0x1){return _0x3cff27;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x2406f1[_0x4b873d],_0x3cff27[_0x8a8a('0xa4')]));if(_0x3cff27[_0x8a8a('0xa4')]===_0x8a8a('0x148')){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x149'),_0x2406f1[_0x4b873d],'true'));this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('IFTIME\x20%s\x20%s',_0x2406f1[_0x4b873d],_0x8a8a('0x148')));return{'code':0xc8,'result':_0x8a8a('0x148')};}else{logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x149'),_0x2406f1[_0x4b873d],_0x8a8a('0x144')));this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x149'),_0x2406f1[_0x4b873d],_0x8a8a('0x144')));}}return{'code':0xc8,'result':_0x8a8a('0x144')};};AGIVertices['prototype']['hangup']=function(_0x858111){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x858111['label']));return this['channel']['hangup']();};AGIVertices['prototype'][_0x8a8a('0x14a')]=function(_0x56e90a){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x14b'),_0x56e90a['label']));if(!this[_0x8a8a('0x89')](_0x56e90a[_0x8a8a('0x7e')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20key\x20configured');}var _0x54ab2e=_0x8a8a('0x130');var _0x2dec51=util['format'](_0x8a8a('0x131'),FILES_PATH,rs['generate'](0x4));var _0x1a403e=util[_0x8a8a('0x2b')]('%s.%s',_0x2dec51,_0x54ab2e);var _0x3cdabc=!![];if(_0x56e90a['beep']===_0x8a8a('0x14c')){_0x3cdabc=![];}var _0x44efa2=this[_0x8a8a('0x39')][_0x8a8a('0x133')](_0x2dec51,_0x54ab2e,_0x56e90a[_0x8a8a('0x14d')],_0x56e90a['timeout'],undefined,_0x3cdabc);if(_0x44efa2[_0x8a8a('0xa6')]!==-0x1){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x14e'),_0x1a403e));var _0x13b237=this[_0x8a8a('0x88')][_0x8a8a('0x76')](this,_0x56e90a,_0x1a403e);if(_0x13b237){for(var _0x246301 in _0x13b237){if(_0x13b237['hasOwnProperty'](_0x246301)){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0x14f'),_0x246301[_0x8a8a('0x6f')]()),_0x13b237[_0x246301]);}}return this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x150'),JSON['stringify'](_0x13b237)));}}return _0x44efa2;};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x151')]=function(_0x2f5102){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2f5102[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x2f5102[_0x8a8a('0x7e')])){return this['channel']['noop'](_0x8a8a('0xe8'));}if(!this[_0x8a8a('0x89')](_0x2f5102['text'])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0xac'));}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x2f5102['text']));var _0x3e4875=this['ispeechTTS'][_0x8a8a('0x76')](this,_0x2f5102);if(_0x3e4875){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x14e'),_0x3e4875));var _0x56220c=this[_0x8a8a('0x39')][_0x8a8a('0x123')](_0x3e4875,_0x2f5102['intKey']);try{fs[_0x8a8a('0x104')](_0x3e4875+_0x8a8a('0x105'));}catch(_0x3d49d3){logger[_0x8a8a('0x2e')](_0x3d49d3);}return _0x56220c;}return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x2f5102,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x8a8a('0x152')]=function(_0x328d96){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x153'),_0x328d96[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x328d96[_0x8a8a('0x154')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x328d96,_0x8a8a('0x155'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x328d96[_0x8a8a('0x154')]));var _0x197553=this[_0x8a8a('0x58')]['sync'](this,_0x328d96[_0x8a8a('0x154')]);if(_0x197553){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x328d96[_0x8a8a('0x154')]));this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x328d96['findBy']));return{'code':0xc8,'result':_0x8a8a('0x157')};}else{logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x328d96[_0x8a8a('0x154')]));this['channel'][_0x8a8a('0xaf')](util['format'](_0x8a8a('0x158'),this['channel']['callerid'],_0x328d96[_0x8a8a('0x154')]));return{'code':0xc8,'result':_0x8a8a('0x159')};}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x15a')]=function(_0x2d99d3){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x15b'),_0x2d99d3[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x2d99d3[_0x8a8a('0x154')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x2d99d3,_0x8a8a('0x155'));}logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x15c'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x2d99d3[_0x8a8a('0x154')]));var _0x2d3f1c=this[_0x8a8a('0x57')]['sync'](this,_0x2d99d3['findBy']);if(_0x2d3f1c){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')]['callerid'],_0x2d99d3[_0x8a8a('0x154')]));this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x2d99d3[_0x8a8a('0x154')]));return{'code':0xc8,'result':_0x8a8a('0x157')};}else{logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this[_0x8a8a('0x39')]['callerid'],_0x2d99d3[_0x8a8a('0x154')]));this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this['channel'][_0x8a8a('0x3c')],_0x2d99d3[_0x8a8a('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x15d')]=function(_0x3d62d4){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3d62d4['label']));if(!this[_0x8a8a('0x89')](_0x3d62d4[_0x8a8a('0x15e')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3d62d4,'no\x20operation\x20configured');}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x15f'),_0x3d62d4[_0x8a8a('0x15e')]));var _0x21cd36=eval(_0x3d62d4[_0x8a8a('0x15e')]);if(!this[_0x8a8a('0x89')](_0x3d62d4[_0x8a8a('0xd6')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x114'));}var _0xfc8f8e=this[_0x8a8a('0x13')]['sync'](this,_0x3d62d4[_0x8a8a('0xd6')]);if(!_0xfc8f8e){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3d62d4,_0x8a8a('0xd7'));}if(_[_0x8a8a('0x160')](_0x21cd36)){var _0x221ac6=this;_0x21cd36[_0x8a8a('0xd9')](function(_0xd6b4cd,_0x4fc5e4){_0x221ac6[_0x8a8a('0x39')][_0x8a8a('0xa0')](util['format']('%s[%s]',_0xfc8f8e,_0x4fc5e4),_0xd6b4cd);});return this['channel']['noop'](util[_0x8a8a('0x2b')]('variable\x20%s[key]\x20set',_0xfc8f8e));}else{return this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0xfc8f8e,_0x21cd36);}};AGIVertices[_0x8a8a('0x12')]['menu']=function(_0x162dd9){logger['info'](util['format'](_0x8a8a('0x161'),_0x162dd9['label']));if(_0x162dd9[_0x8a8a('0xa9')]===0x0){return this[_0x8a8a('0xa8')](_0x162dd9);}_0x162dd9[_0x8a8a('0xa9')]-=0x1;if(!this['isConfigured'](_0x162dd9['file_id'])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x162dd9,'no\x20file\x20audio\x20selected');}var _0xe8b3c0=this['getSound'][_0x8a8a('0x76')](this,_0x162dd9[_0x8a8a('0x112')]);if(!_0xe8b3c0){return this['channel']['error'](_0x162dd9,_0x8a8a('0x162'));}var _0x15f25f=this[_0x8a8a('0x39')][_0x8a8a('0x115')](_0xe8b3c0,_0x162dd9[_0x8a8a('0x116')],_0x162dd9[_0x8a8a('0x163')]);var _0x2d4a9a=_0x15f25f['result'];if(_0x15f25f[_0x8a8a('0xa6')]===-0x1){this[_0x8a8a('0x38')]['sync'](this,_0x162dd9,'-1');return _0x15f25f;}else if(_0x15f25f['extra']===_0x8a8a('0x6b')){_0x15f25f[_0x8a8a('0xa6')]=_0x15f25f['result'][_0x8a8a('0x9c')]>0x0?_0x15f25f[_0x8a8a('0xa6')]:'t';}else if(_['isEmpty'](_0x15f25f[_0x8a8a('0xa6')])){_0x15f25f['result']='#';_0x2d4a9a='#';}if(!this[_0x8a8a('0x89')](_0x162dd9[_0x8a8a('0xd6')])){this[_0x8a8a('0x39')]['noop'](_0x8a8a('0x114'));}else{var _0x50fbda=this[_0x8a8a('0x13')][_0x8a8a('0x76')](this,_0x162dd9[_0x8a8a('0xd6')]);if(!_0x50fbda){return this['channel']['error'](_0x162dd9,_0x8a8a('0xd7'));}this['channel']['setVariable'](_0x50fbda,_0x2d4a9a);}this['createSquareDetailsReport'][_0x8a8a('0x76')](this,_0x162dd9,_0x2d4a9a);return _0x15f25f;};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0xaf')]=function(_0x46768a){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x46768a['label']));return this['channel'][_0x8a8a('0xaf')](_0x46768a[_0x8a8a('0x164')]||_0x46768a['label']);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x165')]=function(_0x3efaa1){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x166'),_0x3efaa1[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x3efaa1[_0x8a8a('0x154')])){return this[_0x8a8a('0x39')]['error'](_0x3efaa1,_0x8a8a('0x155'));}logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x3efaa1[_0x8a8a('0x154')]));var _0x47f489=this['getPause'][_0x8a8a('0x76')](this,_0x3efaa1[_0x8a8a('0x167')]);var _0x1a6603=this[_0x8a8a('0x54')]['sync'](this,_0x3efaa1[_0x8a8a('0x154')],_0x47f489);if(_0x1a6603){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x3efaa1[_0x8a8a('0x154')]));this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')]['callerid'],_0x3efaa1[_0x8a8a('0x154')]));return{'code':0xc8,'result':_0x8a8a('0x157')};}else{logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x158'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x3efaa1[_0x8a8a('0x154')]));this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8a8a('0x3c')],_0x3efaa1[_0x8a8a('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x168')]=function(_0x3cf0c9){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x169'),_0x3cf0c9['label']));if(!this[_0x8a8a('0x89')](_0x3cf0c9[_0x8a8a('0x112')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3cf0c9,_0x8a8a('0x113'));}var _0x46ea59=this[_0x8a8a('0x20')][_0x8a8a('0x76')](this,_0x3cf0c9[_0x8a8a('0x112')]);if(!_0x46ea59){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x3cf0c9,'no\x20file\x20audio\x20found');}var _0x41e8e6=this['channel'][_0x8a8a('0xae')](_0x8a8a('0x16a'),[_0x46ea59,_0x3cf0c9[_0x8a8a('0xe4')]]);if(_0x41e8e6[_0x8a8a('0xa6')]===-0x1){return _0x41e8e6;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x8a8a('0x16a'),_0x46ea59));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x16b')]=function(_0x1d2fb2){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x16c'),_0x1d2fb2[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1d2fb2[_0x8a8a('0x16d')])){return this[_0x8a8a('0x39')]['error'](_0x1d2fb2,_0x8a8a('0x16e'));}var _0x20ae19='';var _0x14b499=parseInt(_0x1d2fb2[_0x8a8a('0x16d')],0xa);if(isNaN(_0x14b499)){_0x20ae19=_0x1d2fb2['queue_id'];}else{_0x20ae19=this['getVoiceQueue'][_0x8a8a('0x76')](this,_0x1d2fb2['queue_id']);if(!_0x20ae19){return this['channel'][_0x8a8a('0x2e')](_0x1d2fb2,_0x8a8a('0x16f'));}}var _0x2d6bdc='';if(this[_0x8a8a('0x89')](_0x1d2fb2[_0x8a8a('0x112')])){var _0x36a548=this['getSound']['sync'](this,_0x1d2fb2[_0x8a8a('0x112')]);if(_0x36a548){_0x2d6bdc=_0x36a548;}}this['createSquareDetailsReport'][_0x8a8a('0x76')](this,_0x1d2fb2,_0x20ae19);if(_0x1d2fb2['opts']['indexOf']('x')<0x0){_0x1d2fb2[_0x8a8a('0xe4')]+='x';}if(_0x1d2fb2[_0x8a8a('0xe4')]['indexOf']('X')<0x0){_0x1d2fb2[_0x8a8a('0xe4')]+='X';}this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x8a8a('0x170'),_0x20ae19?_0x20ae19[_0x8a8a('0x171')]():'');var _0x39892a=this[_0x8a8a('0x39')][_0x8a8a('0xae')](_0x8a8a('0x172'),[_0x20ae19,_0x1d2fb2[_0x8a8a('0xe4')],_0x1d2fb2[_0x8a8a('0x69')],_0x2d6bdc,_0x1d2fb2[_0x8a8a('0x6b')],_0x1d2fb2[_0x8a8a('0x8')],_0x1d2fb2[_0x8a8a('0x173')],_0x1d2fb2[_0x8a8a('0x174')],'',_0x1d2fb2[_0x8a8a('0x175')]]);if(_0x39892a['result']===-0x1){return _0x39892a;}return this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x8a8a('0x172'),_0x20ae19));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x176')]=function(_0xeab9db){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x177'),_0xeab9db[_0x8a8a('0x3b')]));var _0x4de9f1=_0xeab9db[_0x8a8a('0x178')]||_0x8a8a('0x130');var _0x138cb2=util[_0x8a8a('0x2b')](_0x8a8a('0x179'),this[_0x8a8a('0x39')][_0x8a8a('0x3a')],rs[_0x8a8a('0x11a')](0x5));var _0x2ccdb4=util[_0x8a8a('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x138cb2,_0x4de9f1);var _0x3aadb0=util[_0x8a8a('0x2b')](_0x8a8a('0x131'),FILES_PATH,_0x138cb2);this[_0x8a8a('0x3d')][_0x8a8a('0x76')](this,_0xeab9db,_0x138cb2,_0x2ccdb4);this['channel'][_0x8a8a('0xa0')](_0x8a8a('0x17a'),_0x138cb2);logger[_0x8a8a('0x30')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x3aadb0,_0x4de9f1,_0xeab9db[_0x8a8a('0x17b')],_0xeab9db['timeout']);return this[_0x8a8a('0x39')][_0x8a8a('0x133')](_0x3aadb0,_0x4de9f1,_0xeab9db['escape_digits'],_0xeab9db[_0x8a8a('0x6b')],undefined,!![]);};AGIVertices[_0x8a8a('0x12')]['restapi']=function(_0x1e41fa){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x17c'),_0x1e41fa['label']));if(!this[_0x8a8a('0x89')](_0x1e41fa[_0x8a8a('0x69')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20url\x20configured');}var _0x194cfb=this[_0x8a8a('0x68')][_0x8a8a('0x76')](this,_0x1e41fa);logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x17d'),util[_0x8a8a('0x17e')](_0x194cfb,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1e41fa['variable_id'])){return this['channel'][_0x8a8a('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x1e119e=this[_0x8a8a('0x13')][_0x8a8a('0x76')](this,_0x1e41fa[_0x8a8a('0xd6')]);if(!_0x1e119e){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1e41fa,'no\x20variable\x20found');}this[_0x8a8a('0x39')][_0x8a8a('0xa0')](util[_0x8a8a('0x2b')](_0x8a8a('0x17f'),_0x1e119e),_0x194cfb[_0x8a8a('0x7b')]?_0x194cfb[_0x8a8a('0x7b')]:_0x8a8a('0x180'));this['channel']['setVariable'](util['format'](_0x8a8a('0x181'),_0x1e119e),_0x194cfb[_0x8a8a('0x182')]?_0x194cfb[_0x8a8a('0x182')]:'OK');if(_0x194cfb[_0x8a8a('0x70')]){try{this['saveRestApiResult'](_0x194cfb[_0x8a8a('0x70')],_0x1e119e);}catch(_0x14ed3b){logger[_0x8a8a('0x2e')](util[_0x8a8a('0x2b')](_0x8a8a('0x183'),_0x1e119e));}}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format'](_0x8a8a('0xdc'),_0x1e119e));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x184')]=function(_0x5a17a0){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5a17a0['label']));return this[_0x8a8a('0x39')][_0x8a8a('0x185')](_0x5a17a0[_0x8a8a('0x186')]['replace'](/\s+/g,''),_0x5a17a0['escape_digits']);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x187')]=function(_0x238293){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x188'),_0x238293['label']));return this[_0x8a8a('0x39')][_0x8a8a('0x189')](_0x238293[_0x8a8a('0x6c')]['replace'](/\s+/g,''),_0x238293['escape_digits']);};AGIVertices[_0x8a8a('0x12')]['sayphonetic']=function(_0x4bea09){logger['info'](util[_0x8a8a('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4bea09[_0x8a8a('0x3b')]));return this[_0x8a8a('0x39')][_0x8a8a('0x18a')](_0x4bea09[_0x8a8a('0x60')],_0x4bea09[_0x8a8a('0x17b')]);};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x18b')]=function(_0x4e12a8){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x18c'),_0x4e12a8[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x4e12a8['account_id'])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0x18d'));}var _0x56856a=this['getMailAccount'][_0x8a8a('0x76')](this,_0x4e12a8[_0x8a8a('0x18e')]);if(!_0x56856a||!_0x56856a[_0x8a8a('0x18f')]){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x4e12a8,'no\x20mail\x20account\x20found');}var _0x50da5f={'from':util[_0x8a8a('0x2b')](_0x8a8a('0x190'),_0x56856a[_0x8a8a('0x15')],_0x56856a[_0x8a8a('0x191')]||_0x56856a[_0x8a8a('0x18f')][_0x8a8a('0x192')]),'to':_0x4e12a8['to']||'','cc':_0x4e12a8['cc']||'','bcc':_0x4e12a8[_0x8a8a('0x193')]||'','subject':_0x4e12a8[_0x8a8a('0x194')],'html':_0x4e12a8['text'],'text':_0x4e12a8[_0x8a8a('0x60')]};if(this[_0x8a8a('0x89')](_0x4e12a8['template_id'])){}logger[_0x8a8a('0xde')]('sendMail\x20message',JSON[_0x8a8a('0x79')](_0x50da5f));this[_0x8a8a('0x38')]['sync'](this,_0x4e12a8,_0x4e12a8['account_id']);this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x195'),_0x56856a[_0x8a8a('0x15')]));this[_0x8a8a('0x25')]['sync'](this,_0x56856a[_0x8a8a('0x196')],_0x50da5f);return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0x197'));};AGIVertices[_0x8a8a('0x12')]['sendFax']=function(_0x21e551){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x198'),_0x21e551['label']));return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x199'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x19a')]=function(_0x556f8e){logger['info'](util[_0x8a8a('0x2b')](_0x8a8a('0x19b'),_0x556f8e[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x556f8e[_0x8a8a('0x19c')])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0x19d'));}var _0x4e3e71=this[_0x8a8a('0x35')][_0x8a8a('0x76')](this,_0x556f8e[_0x8a8a('0x19c')]);if(!_0x4e3e71){return this['channel'][_0x8a8a('0x2e')](_0x556f8e,_0x8a8a('0x19e'));}var _0x54416e={'body':_0x556f8e['sms_text'],'phone':_0x556f8e['to']||'','SmsAccountId':_0x4e3e71['id']};logger[_0x8a8a('0xde')](_0x8a8a('0x19f'),JSON[_0x8a8a('0x79')](_0x54416e));this['createSquareDetailsReport'][_0x8a8a('0x76')](this,_0x556f8e,_0x556f8e[_0x8a8a('0x19c')]);this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x1a0'),_0x4e3e71['name']));this['createSmsMessage'][_0x8a8a('0x76')](this,_0x54416e);return this['channel']['noop'](_0x8a8a('0x1a1'));};AGIVertices['prototype'][_0x8a8a('0x1a2')]=function(_0xc44131){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0xc44131[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0xc44131[_0x8a8a('0xd6')])){return this['channel'][_0x8a8a('0x2e')](_0xc44131,_0x8a8a('0x1a3'));}var _0x1d34df=this[_0x8a8a('0x13')]['sync'](this,_0xc44131[_0x8a8a('0xd6')]);if(!_0x1d34df){return this['channel'][_0x8a8a('0x2e')](_0xc44131,_0x8a8a('0xd7'));}return this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x1d34df,_0xc44131[_0x8a8a('0x1a4')]);};AGIVertices[_0x8a8a('0x12')]['start']=function(_0x41fc5b){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1a5'),_0x41fc5b[_0x8a8a('0x3b')]));this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x1a6'));var _0x258f76=this[_0x8a8a('0x39')][_0x8a8a('0x13')](_0x8a8a('0x1a7'));if(!_['isEmpty'](_0x258f76[_0x8a8a('0xa4')])){this[_0x8a8a('0x39')][_0x8a8a('0x3a')]=_0x258f76[_0x8a8a('0xa4')];}if(_0x41fc5b[_0x8a8a('0xbb')]===_0x8a8a('0x1a8')){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x1a9'));return this[_0x8a8a('0x39')][_0x8a8a('0xbb')]();}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](_0x8a8a('0x1aa'));};AGIVertices[_0x8a8a('0x12')]['subproject']=function(_0x1394c7){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1ab'),_0x1394c7[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x1394c7[_0x8a8a('0x1ac')])){return this[_0x8a8a('0x39')]['error'](_0x1394c7,_0x8a8a('0x1ad'));}var _0x5eb730=this[_0x8a8a('0x1ae')][_0x8a8a('0x76')](this,_0x1394c7[_0x8a8a('0x1ac')]);if(!this[_0x8a8a('0x89')](_0x5eb730)){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1394c7,util['format'](_0x8a8a('0x1af'),_0x1394c7[_0x8a8a('0x1ac')]));}if(_0x5eb730===this[_0x8a8a('0x39')]['arg_1']){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x1394c7,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x8a8a('0x38')][_0x8a8a('0x76')](this,_0x1394c7,_0x5eb730);var _0x492bf4=this['channel'][_0x8a8a('0xae')](_0x8a8a('0x1b0'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x8a8a('0x1b1')]||_0x8a8a('0x1b2'),_0x5eb730,this[_0x8a8a('0x39')][_0x8a8a('0x43')]));if(_0x492bf4[_0x8a8a('0xa6')]===-0x1){return _0x492bf4;}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x8a8a('0x1b0'),_0x5eb730));};AGIVertices['prototype'][_0x8a8a('0x1b3')]=function(_0x185ac6){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1b4'),_0x185ac6['label']));var _0x9f9c74=this['shellCommand']['sync'](this,_0x185ac6[_0x8a8a('0xba')]);this[_0x8a8a('0x38')][_0x8a8a('0x76')](this,_0x185ac6,_0x185ac6[_0x8a8a('0xba')]);if(this[_0x8a8a('0x89')](_0x185ac6[_0x8a8a('0xd6')])){var _0x1df0dc=this[_0x8a8a('0x13')][_0x8a8a('0x76')](this,_0x185ac6[_0x8a8a('0xd6')]);if(_0x1df0dc){this[_0x8a8a('0x39')][_0x8a8a('0xa0')](_0x1df0dc,_0x9f9c74);return this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x1b5'),_0x185ac6[_0x8a8a('0xba')],_0x1df0dc));}}return this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x1b6'),_0x185ac6[_0x8a8a('0xba')]));};AGIVertices[_0x8a8a('0x12')]['google_cloud_tts']=function(_0x26f923){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1b7'),_0x26f923[_0x8a8a('0x3b')]));_0x26f923[_0x8a8a('0x60')]=_0x26f923['text'][_0x8a8a('0x1b8')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x26f923['apiKey'])){return this['channel'][_0x8a8a('0xaf')](_0x8a8a('0x1b9'));}if(!this[_0x8a8a('0x89')](_0x26f923[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')]['noop']('no\x20text\x20configured');}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x26f923['text']));var _0xec63ff=this[_0x8a8a('0x5d')][_0x8a8a('0x76')](this,_0x26f923);if(_0xec63ff){this['channel']['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x1ba'),_0xec63ff));var _0x431688=this[_0x8a8a('0x39')][_0x8a8a('0x123')](_0xec63ff);try{fs[_0x8a8a('0x104')](_0xec63ff+_0x8a8a('0x105'));}catch(_0x39bc6f){logger[_0x8a8a('0x2e')](_0x39bc6f);}return _0x431688;}return this[_0x8a8a('0x39')]['error'](_0x26f923,_0x8a8a('0x1bb'));};AGIVertices[_0x8a8a('0x12')]['tts']=function(_0x46bc3e){logger['info'](util[_0x8a8a('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x46bc3e['label']));_0x46bc3e[_0x8a8a('0x60')]=_0x46bc3e[_0x8a8a('0x60')][_0x8a8a('0x1b8')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x46bc3e[_0x8a8a('0x60')])){return this[_0x8a8a('0x39')][_0x8a8a('0xaf')]('no\x20text\x20configured');}this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x1bc'),_0x46bc3e[_0x8a8a('0x60')]));var _0x535b86=this['googleTTS']['sync'](this,_0x46bc3e);if(_0x535b86){this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x535b86));var _0x58df96=this[_0x8a8a('0x39')][_0x8a8a('0x123')](_0x535b86);try{fs['unlink'](_0x535b86+'.wav');}catch(_0x3e5b28){logger[_0x8a8a('0x2e')](_0x3e5b28);}return _0x58df96;}return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x46bc3e,_0x8a8a('0x1bd'));};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x1be')]=function(_0x17243d){logger[_0x8a8a('0x30')](util['format'](_0x8a8a('0x1bf'),_0x17243d[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x17243d[_0x8a8a('0x154')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x17243d,_0x8a8a('0x155'));}logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x17243d['findBy']));var _0x412a6c=this['agentUnpause'][_0x8a8a('0x76')](this,_0x17243d['findBy']);if(_0x412a6c){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this[_0x8a8a('0x39')][_0x8a8a('0x3c')],_0x17243d['findBy']));this[_0x8a8a('0x39')]['noop'](util[_0x8a8a('0x2b')](_0x8a8a('0x156'),this['channel'][_0x8a8a('0x3c')],_0x17243d[_0x8a8a('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this[_0x8a8a('0x39')]['callerid'],_0x17243d['findBy']));this[_0x8a8a('0x39')][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0x158'),this[_0x8a8a('0x39')]['callerid'],_0x17243d[_0x8a8a('0x154')]));return{'code':0xc8,'result':_0x8a8a('0x159')};}};AGIVertices[_0x8a8a('0x12')][_0x8a8a('0x1c0')]=function(_0x22031f){logger[_0x8a8a('0x30')](util[_0x8a8a('0x2b')](_0x8a8a('0x1c1'),_0x22031f[_0x8a8a('0x3b')]));var _0x4af5ad=this[_0x8a8a('0x39')]['exec'](_0x8a8a('0x1c2'),[_0x22031f[_0x8a8a('0x1c3')],_0x22031f[_0x8a8a('0xad')]]);if(_0x4af5ad[_0x8a8a('0xa6')]===-0x1){return _0x4af5ad;}return this['channel'][_0x8a8a('0xaf')](util[_0x8a8a('0x2b')](_0x8a8a('0xc5'),_0x8a8a('0x1c2'),_0x22031f[_0x8a8a('0x1c3')]));};AGIVertices['prototype'][_0x8a8a('0x1c4')]=function(_0x37ef41){logger[_0x8a8a('0x30')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x37ef41[_0x8a8a('0x3b')]));if(!this[_0x8a8a('0x89')](_0x37ef41[_0x8a8a('0xd6')])){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x37ef41,_0x8a8a('0x1a3'));}var _0x55bba4=this['getVariable'][_0x8a8a('0x76')](this,_0x37ef41[_0x8a8a('0xd6')]);if(!_0x55bba4){return this[_0x8a8a('0x39')][_0x8a8a('0x2e')](_0x37ef41,_0x8a8a('0xd7'));}var _0x8dc11=this['channel']['getVariable'](_0x55bba4);return{'code':0xc8,'result':_0x8dc11[_0x8a8a('0xa4')]?_0x8dc11[_0x8a8a('0xa4')]:'-'};};String['prototype'][_0x8a8a('0xa3')]=function(_0x470c8a,_0x3fb8a3){return this[_0x8a8a('0xa2')](_0x470c8a)['join'](_0x3fb8a3);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index bab3370..a2ac5f3 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 _0x6094=['[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','catch','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','attended','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid'];(function(_0x286b00,_0x72775a){var _0x3559fd=function(_0x305944){while(--_0x305944){_0x286b00['push'](_0x286b00['shift']());}};_0x3559fd(++_0x72775a);}(_0x6094,0x108));var _0x4609=function(_0x4606e5,_0x5a4b6d){_0x4606e5=_0x4606e5-0x0;var _0x387b17=_0x6094[_0x4606e5];return _0x387b17;};'use strict';var _=require(_0x4609('0x0'));var moment=require(_0x4609('0x1'));var ami=require('../ami');var logger=require(_0x4609('0x2'))(_0x4609('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x4609('0x4'));function Acw(_0x4bcd69){this[_0x4609('0x5')]=_0x4bcd69[_0x4609('0x5')];this[_0x4609('0x6')]=_0x4bcd69['agents'];this[_0x4609('0x7')]=_0x4bcd69[_0x4609('0x7')];this[_0x4609('0x8')]={};ami['on'](_0x4609('0x9'),this['syncAgentConnect'][_0x4609('0xa')](this));ami['on'](_0x4609('0xb'),this[_0x4609('0xc')][_0x4609('0xa')](this));ami['on'](_0x4609('0xd'),this['syncHangup'][_0x4609('0xa')](this));ami['on']('agentringnoanswer',this[_0x4609('0xe')]['bind'](this));ami['on'](_0x4609('0xf'),this[_0x4609('0x10')][_0x4609('0xa')](this));ami['on']('blindtransfer',this[_0x4609('0x11')]['bind'](this));ami['on'](_0x4609('0x12'),this[_0x4609('0x13')][_0x4609('0xa')](this));}function getDiff(_0x59c190){var _0x4dab88=moment()[_0x4609('0x14')](0x0);var _0x36aad5=moment(_0x59c190)[_0x4609('0x14')](0x0);return _0x4dab88[_0x4609('0x15')](_0x36aad5,'seconds');}Acw[_0x4609('0x16')][_0x4609('0x17')]=function(_0x283426,_0x47108c){var _0x575668=this;var _0x4f262a=getDiff(_0x575668[_0x4609('0x7')][_0x283426]['lastPauseAt']);clearTimeout(_0x575668[_0x4609('0x7')][_0x283426][_0x4609('0x18')]);_0x575668[_0x4609('0x7')][_0x283426][_0x4609('0x18')]=![];return RpcVoiceAgentReport[_0x4609('0x19')]({'acwtime':_0x4f262a},_0x575668[_0x4609('0x7')][_0x283426][_0x4609('0x1a')],_0x283426)['then'](function(_0x727509){logger[_0x4609('0x1b')](_0x4609('0x1c'),_0x47108c,_0x4f262a,_0x727509);})['catch'](function(_0x1af5e5){logger['error'](_0x4609('0x1d'),_0x47108c,_0x1af5e5);})[_0x4609('0x1e')](function(){delete _0x575668[_0x4609('0x7')][_0x283426];});};Acw['prototype']['startAcw']=function(_0x2834b8){try{var _0x570416=this;var _0x1b996a=this['channels'][_0x2834b8][_0x4609('0x1f')];var _0x479407=this[_0x4609('0x8')][_0x2834b8][_0x4609('0x20')];var _0x555a5c=this[_0x4609('0x5')][_0x479407];var _0x1ad127=![];var _0x34c2a5=_0x4609('0x21');if(_0x555a5c[_0x4609('0x22')]&&_0x555a5c[_0x4609('0x23')]['name']){_0x1ad127=!![];_0x34c2a5=_0x555a5c[_0x4609('0x23')][_0x4609('0x24')];}return ami[_0x4609('0x25')]({'action':_0x4609('0x26'),'interface':_0x1b996a,'paused':!![],'reason':_0x34c2a5})[_0x4609('0x27')](function(){if(_0x570416['agents'][_0x1b996a]){return RpcUser[_0x4609('0x28')](_0x570416[_0x4609('0x6')][_0x1b996a]['id'])[_0x4609('0x27')](function(_0x410ee9){if(!_0x410ee9||_0x410ee9[_0x4609('0x29')]){logger[_0x4609('0x1b')](_0x4609('0x2a'),_0x2834b8,_0x1b996a,_0x479407);return;}logger[_0x4609('0x1b')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2834b8,_0x1b996a,_0x479407);var _0x40fa30=_0x570416['channels'][_0x2834b8]['attended']&&_0x570416[_0x4609('0x8')][_0x2834b8][_0x4609('0x2b')]?_0x570416[_0x4609('0x8')][_0x2834b8]['destlinkedid']:_0x2834b8;return RpcUser[_0x4609('0x2c')](_0x570416[_0x4609('0x6')][_0x1b996a],_0x34c2a5,_0x40fa30)[_0x4609('0x27')](function(_0x57071a){_0x570416[_0x4609('0x5')][_0x479407][_0x4609('0x2d')]-=0x1;_0x570416['voiceQueues'][_0x479407]['paused']+=0x1;return _0x57071a;});})[_0x4609('0x27')](function(_0x163420){if(_0x1ad127||!_0x163420){return;}_0x570416[_0x4609('0x7')][_0x1b996a]={};logger[_0x4609('0x1b')](_0x4609('0x2e'),_0x2834b8,_0x570416[_0x4609('0x5')][_0x479407][_0x4609('0x2f')],_0x1b996a,_0x479407);_0x570416[_0x4609('0x7')][_0x1b996a][_0x4609('0x18')]=setTimeout(_0x570416[_0x4609('0x30')]['bind'](_0x570416,_0x1b996a),_0x570416[_0x4609('0x5')][_0x479407][_0x4609('0x2f')]*0x3e8);_0x570416[_0x4609('0x7')][_0x1b996a][_0x4609('0x31')]=moment()[_0x4609('0x32')](_0x4609('0x33'));_0x570416['timers'][_0x1b996a]['uniqueid']=_0x2834b8;_0x570416['timers'][_0x1b996a][_0x4609('0x20')]=_0x479407;_0x570416[_0x4609('0x7')][_0x1b996a][_0x4609('0x17')]=_0x570416['updateAcw']['bind'](_0x570416,_0x1b996a,_0x2834b8);});}})[_0x4609('0x34')](function(){logger[_0x4609('0x35')](_0x4609('0x2e'),_0x2834b8,_0x570416[_0x4609('0x5')][_0x479407][_0x4609('0x2f')],_0x1b996a,_0x479407);})[_0x4609('0x1e')](function(){delete _0x570416[_0x4609('0x8')][_0x2834b8];});}catch(_0x303dba){logger[_0x4609('0x35')](_0x4609('0x36'),_0x303dba[_0x4609('0x37')]);}};Acw['prototype'][_0x4609('0x30')]=function(_0x196fe6){try{var _0x15e104=this;if(_0x15e104[_0x4609('0x7')][_0x196fe6]){_0x15e104[_0x4609('0x7')][_0x196fe6][_0x4609('0x18')]=![];var _0x8c1c16=_0x15e104[_0x4609('0x7')][_0x196fe6]['uniqueid'];var _0x19dfc5=_0x15e104['timers'][_0x196fe6][_0x4609('0x20')];var _0x412bf9=_0x15e104[_0x4609('0x5')][_0x19dfc5][_0x4609('0x2f')];logger['info'](_0x4609('0x38'),_0x8c1c16,_0x196fe6);RpcUser[_0x4609('0x28')](this[_0x4609('0x6')][_0x196fe6]['id'])[_0x4609('0x27')](function(_0x200c9d){if(_0x200c9d[_0x4609('0x39')]==='ACW'){return RpcUser[_0x4609('0x3a')](_0x15e104[_0x4609('0x6')][_0x196fe6]);}});RpcVoiceAgentReport['update']({'acwtime':_0x412bf9,'agentacw':!![]},_0x8c1c16,_0x196fe6)[_0x4609('0x27')](function(_0x54ccc6){logger[_0x4609('0x1b')](_0x4609('0x1c'),_0x8c1c16,_0x412bf9,_0x54ccc6);})['catch'](function(_0x1e30c0){logger['error'](_0x4609('0x1d'),_0x8c1c16,_0x1e30c0);});}else{logger['error'](_0x4609('0x3b'),_0x196fe6);if(_0x15e104[_0x4609('0x7')]){logger[_0x4609('0x1b')](_0x4609('0x3c'),JSON[_0x4609('0x3d')](_0x15e104[_0x4609('0x7')]));}}}catch(_0x22f30a){logger[_0x4609('0x35')]('[ACW][STOP]\x20%s',_0x22f30a[_0x4609('0x37')]);}};Acw[_0x4609('0x16')]['syncAgentConnect']=function(_0x57d09b){try{if(this[_0x4609('0x5')][_0x57d09b[_0x4609('0x20')]]&&(this[_0x4609('0x5')][_0x57d09b[_0x4609('0x20')]][_0x4609('0x3')]||this[_0x4609('0x5')][_0x57d09b['queue']][_0x4609('0x22')])){if(this[_0x4609('0x6')][_0x57d09b['interface']]){this[_0x4609('0x8')][_0x57d09b[_0x4609('0x1a')]]={'queue':_0x57d09b[_0x4609('0x20')],'interface':_0x57d09b['interface'],'destlinkedid':_0x57d09b['destlinkedid']};}}}catch(_0x24c7a1){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x24c7a1[_0x4609('0x37')]);}};Acw[_0x4609('0x16')][_0x4609('0x13')]=function(_0x159ece){try{if(this['voiceQueues'][_0x159ece[_0x4609('0x20')]]&&(this[_0x4609('0x5')][_0x159ece['queue']][_0x4609('0x3')]||this[_0x4609('0x5')][_0x159ece[_0x4609('0x20')]][_0x4609('0x22')])){if(this[_0x4609('0x6')][_0x159ece['interface']]){this['channels'][_0x159ece[_0x4609('0x1a')]]={'queue':_0x159ece['queue'],'interface':_0x159ece[_0x4609('0x1f')]};}}}catch(_0x509ae2){logger[_0x4609('0x35')](_0x4609('0x3e'),_0x509ae2['message']);}};Acw[_0x4609('0x16')][_0x4609('0xc')]=function(_0x5bd500){try{if(this[_0x4609('0x8')][_0x5bd500[_0x4609('0x1a')]]&&_[_0x4609('0x3f')](this[_0x4609('0x8')][_0x5bd500[_0x4609('0x1a')]]['attended'])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x5bd500[_0x4609('0x1a')]);this[_0x4609('0x40')](_0x5bd500[_0x4609('0x1a')]);}else if(this[_0x4609('0x8')][_0x5bd500[_0x4609('0x41')]]&&_[_0x4609('0x3f')](this[_0x4609('0x8')][_0x5bd500[_0x4609('0x41')]][_0x4609('0x42')])){logger[_0x4609('0x1b')]('[%s][HANGUP:LINKEDID]',_0x5bd500[_0x4609('0x41')]);this['startAcw'](_0x5bd500[_0x4609('0x41')]);}}catch(_0x388c14){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x388c14[_0x4609('0x37')]);}};Acw[_0x4609('0x16')][_0x4609('0x43')]=function(_0x5d4ef1){try{if(this['channels'][_0x5d4ef1[_0x4609('0x1a')]]&&this['channels'][_0x5d4ef1[_0x4609('0x1a')]][_0x4609('0x42')]){logger[_0x4609('0x1b')](_0x4609('0x44'),_0x5d4ef1[_0x4609('0x1a')]);this['startAcw'](_0x5d4ef1['uniqueid']);}else if(this[_0x4609('0x8')][_0x5d4ef1[_0x4609('0x41')]]&&this['channels'][_0x5d4ef1[_0x4609('0x41')]][_0x4609('0x42')]){logger[_0x4609('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5d4ef1['linkedid']);this[_0x4609('0x40')](_0x5d4ef1[_0x4609('0x41')]);}}catch(_0x2095f2){logger[_0x4609('0x35')](_0x4609('0x45'),_0x2095f2[_0x4609('0x37')]);}};Acw[_0x4609('0x16')]['syncAttendedTransfer']=function(_0x5e9db7){try{if(!_[_0x4609('0x46')](this[_0x4609('0x8')][_0x5e9db7[_0x4609('0x47')]])){this[_0x4609('0x40')](_0x5e9db7[_0x4609('0x47')]);if(this[_0x4609('0x8')][_0x5e9db7['secondtransfereruniqueid']]){this[_0x4609('0x8')][_0x5e9db7[_0x4609('0x48')]]['attended']=!![];this[_0x4609('0x8')][_0x5e9db7[_0x4609('0x49')]]=this['channels'][_0x5e9db7[_0x4609('0x48')]];this[_0x4609('0x4a')](_0x5e9db7[_0x4609('0x48')]);}}else if(!_['isNil'](this[_0x4609('0x8')][_0x5e9db7[_0x4609('0x49')]])){this[_0x4609('0x40')](_0x5e9db7[_0x4609('0x49')]);if(this[_0x4609('0x8')][_0x5e9db7['origtransfereruniqueid']]){this[_0x4609('0x8')][_0x5e9db7['origtransfereruniqueid']][_0x4609('0x42')]=!![];this['channels'][_0x5e9db7[_0x4609('0x47')]]=this[_0x4609('0x8')][_0x5e9db7['origtransfereruniqueid']];this[_0x4609('0x4a')](_0x5e9db7[_0x4609('0x4b')]);}}}catch(_0x40aab3){logger[_0x4609('0x35')](_0x4609('0x4c'),_0x40aab3[_0x4609('0x37')]);}};Acw[_0x4609('0x16')][_0x4609('0x11')]=function(_0x456e1e){try{if(this[_0x4609('0x8')][_0x456e1e[_0x4609('0x4d')]]){logger[_0x4609('0x1b')](_0x4609('0x4e'),JSON[_0x4609('0x3d')](_0x456e1e[_0x4609('0x4d')]));this[_0x4609('0x40')](_0x456e1e[_0x4609('0x4d')]);}else if(this[_0x4609('0x8')][_0x456e1e[_0x4609('0x4f')]]){logger[_0x4609('0x1b')](_0x4609('0x50'),JSON['stringify'](_0x456e1e['transfererlinkedid']));this[_0x4609('0x40')](_0x456e1e[_0x4609('0x4f')]);}}catch(_0x5d47f0){logger[_0x4609('0x35')](_0x4609('0x51'),_0x5d47f0['message']);}};Acw['prototype'][_0x4609('0xe')]=function(_0x235559){try{if(this['voiceQueues'][_0x235559[_0x4609('0x20')]]&&this[_0x4609('0x5')][_0x235559[_0x4609('0x20')]][_0x4609('0x52')]==='all'){if(this[_0x4609('0x6')][_0x235559[_0x4609('0x1f')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x235559[_0x4609('0x1a')],_0x235559['interface'],_0x235559[_0x4609('0x20')]);return RpcUser[_0x4609('0x2c')](this[_0x4609('0x6')][_0x235559[_0x4609('0x1f')]],_0x4609('0x53'),_0x235559[_0x4609('0x1a')]);}}}catch(_0x35802a){logger[_0x4609('0x35')](_0x4609('0x54'),_0x35802a[_0x4609('0x37')]);}};Acw[_0x4609('0x16')][_0x4609('0x4a')]=function(_0x5c3ef7,_0xa8b4b4=0x2710){if(this['channels'][_0x5c3ef7]){setTimeout(()=>{delete this[_0x4609('0x8')][_0x5c3ef7];},_0xa8b4b4);}};module[_0x4609('0x55')]=Acw; \ No newline at end of file +var _0x73b4=['acwTimeout','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','prototype','stopAcw','pauseType','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','message','syncAgentConnect','mandatoryDisposition','uniqueid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','lastPauseAt','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]'];(function(_0x2be240,_0x1e119d){var _0x123543=function(_0x580bf4){while(--_0x580bf4){_0x2be240['push'](_0x2be240['shift']());}};_0x123543(++_0x1e119d);}(_0x73b4,0x1e4));var _0x473b=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x73b4[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0x473b('0x0'));var moment=require(_0x473b('0x1'));var ami=require('../ami');var logger=require(_0x473b('0x2'))(_0x473b('0x3'));var RpcUser=require(_0x473b('0x4'));var RpcVoiceAgentReport=require(_0x473b('0x5'));function Acw(_0x45b643){this[_0x473b('0x6')]=_0x45b643[_0x473b('0x6')];this[_0x473b('0x7')]=_0x45b643[_0x473b('0x7')];this['timers']=_0x45b643[_0x473b('0x8')];this[_0x473b('0x9')]={};ami['on'](_0x473b('0xa'),this['syncAgentConnect'][_0x473b('0xb')](this));ami['on'](_0x473b('0xc'),this['syncHangupRequest'][_0x473b('0xb')](this));ami['on']('hangup',this[_0x473b('0xd')][_0x473b('0xb')](this));ami['on'](_0x473b('0xe'),this[_0x473b('0xf')]['bind'](this));ami['on'](_0x473b('0x10'),this['syncAttendedTransfer'][_0x473b('0xb')](this));ami['on'](_0x473b('0x11'),this[_0x473b('0x12')][_0x473b('0xb')](this));ami['on'](_0x473b('0x13'),this[_0x473b('0x14')][_0x473b('0xb')](this));}function getDiff(_0x1042b7){var _0x5d70e2=moment()[_0x473b('0x15')](0x0);var _0x2dea79=moment(_0x1042b7)['milliseconds'](0x0);return _0x5d70e2[_0x473b('0x16')](_0x2dea79,_0x473b('0x17'));}Acw['prototype'][_0x473b('0x18')]=function(_0x1a1283,_0x59086a){var _0x366aa1=this;var _0x2a4614=getDiff(_0x366aa1[_0x473b('0x8')][_0x1a1283][_0x473b('0x19')]);clearTimeout(_0x366aa1[_0x473b('0x8')][_0x1a1283][_0x473b('0x1a')]);_0x366aa1[_0x473b('0x8')][_0x1a1283][_0x473b('0x1a')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x2a4614},_0x366aa1['timers'][_0x1a1283]['uniqueid'],_0x1a1283)['then'](function(_0x39e008){logger['info'](_0x473b('0x1b'),_0x59086a,_0x2a4614,_0x39e008);})[_0x473b('0x1c')](function(_0x715859){logger[_0x473b('0x1d')](_0x473b('0x1e'),_0x59086a,_0x715859);})[_0x473b('0x1f')](function(){delete _0x366aa1[_0x473b('0x8')][_0x1a1283];});};Acw['prototype'][_0x473b('0x20')]=function(_0x169cdc){try{var _0x313b70=this;var _0x19b6ce=this[_0x473b('0x9')][_0x169cdc][_0x473b('0x21')];var _0x4fa09a=this[_0x473b('0x9')][_0x169cdc][_0x473b('0x22')];var _0x82d4d7=this[_0x473b('0x6')][_0x4fa09a];var _0x9e41c5=![];var _0x167aaf=_0x473b('0x23');if(_0x82d4d7['mandatoryDisposition']&&_0x82d4d7['mandatoryDispositionPause'][_0x473b('0x24')]){_0x9e41c5=!![];_0x167aaf=_0x82d4d7[_0x473b('0x25')][_0x473b('0x24')];}return ami[_0x473b('0x26')]({'action':_0x473b('0x27'),'interface':_0x19b6ce,'paused':!![],'reason':_0x167aaf})[_0x473b('0x28')](function(){if(_0x313b70['agents'][_0x19b6ce]){return RpcUser[_0x473b('0x29')](_0x313b70[_0x473b('0x7')][_0x19b6ce]['id'])[_0x473b('0x28')](function(_0x1c719d){if(!_0x1c719d||_0x1c719d['voicePause']){logger[_0x473b('0x2a')](_0x473b('0x2b'),_0x169cdc,_0x19b6ce,_0x4fa09a);return;}logger[_0x473b('0x2a')](_0x473b('0x2c'),_0x169cdc,_0x19b6ce,_0x4fa09a);var _0x5e8d03=_0x313b70[_0x473b('0x9')][_0x169cdc][_0x473b('0x2d')]&&_0x313b70[_0x473b('0x9')][_0x169cdc][_0x473b('0x2e')]?_0x313b70[_0x473b('0x9')][_0x169cdc][_0x473b('0x2e')]:_0x169cdc;return RpcUser[_0x473b('0x2f')](_0x313b70[_0x473b('0x7')][_0x19b6ce],_0x167aaf,_0x5e8d03)['then'](function(_0xa430ee){_0x313b70['voiceQueues'][_0x4fa09a][_0x473b('0x30')]-=0x1;_0x313b70[_0x473b('0x6')][_0x4fa09a]['paused']+=0x1;return _0xa430ee;});})[_0x473b('0x28')](function(_0x2ca82c){if(_0x9e41c5||!_0x2ca82c){return;}_0x313b70['timers'][_0x19b6ce]={};logger[_0x473b('0x2a')](_0x473b('0x31'),_0x169cdc,_0x313b70['voiceQueues'][_0x4fa09a][_0x473b('0x32')],_0x19b6ce,_0x4fa09a);_0x313b70[_0x473b('0x8')][_0x19b6ce][_0x473b('0x1a')]=setTimeout(_0x313b70['stopAcw']['bind'](_0x313b70,_0x19b6ce),_0x313b70['voiceQueues'][_0x4fa09a]['acwTimeout']*0x3e8);_0x313b70[_0x473b('0x8')][_0x19b6ce][_0x473b('0x19')]=moment()['format'](_0x473b('0x33'));_0x313b70[_0x473b('0x8')][_0x19b6ce]['uniqueid']=_0x169cdc;_0x313b70['timers'][_0x19b6ce][_0x473b('0x22')]=_0x4fa09a;_0x313b70['timers'][_0x19b6ce]['updateAcw']=_0x313b70[_0x473b('0x18')][_0x473b('0xb')](_0x313b70,_0x19b6ce,_0x169cdc);});}})[_0x473b('0x1c')](function(){logger['error'](_0x473b('0x31'),_0x169cdc,_0x313b70['voiceQueues'][_0x4fa09a][_0x473b('0x32')],_0x19b6ce,_0x4fa09a);})[_0x473b('0x1f')](function(){delete _0x313b70[_0x473b('0x9')][_0x169cdc];});}catch(_0xdf5b83){logger[_0x473b('0x1d')](_0x473b('0x34'),_0xdf5b83['message']);}};Acw[_0x473b('0x35')][_0x473b('0x36')]=function(_0xb880d5){try{var _0x422244=this;if(_0x422244[_0x473b('0x8')][_0xb880d5]){_0x422244[_0x473b('0x8')][_0xb880d5]['timer']=![];var _0x4d20d9=_0x422244[_0x473b('0x8')][_0xb880d5]['uniqueid'];var _0x18d8d4=_0x422244[_0x473b('0x8')][_0xb880d5][_0x473b('0x22')];var _0x5563bb=_0x422244[_0x473b('0x6')][_0x18d8d4][_0x473b('0x32')];logger[_0x473b('0x2a')]('[%s][TIMER][STOP][AGENT:%s]',_0x4d20d9,_0xb880d5);RpcUser[_0x473b('0x29')](this[_0x473b('0x7')][_0xb880d5]['id'])[_0x473b('0x28')](function(_0x2b27f4){if(_0x2b27f4[_0x473b('0x37')]===_0x473b('0x23')){return RpcUser[_0x473b('0x38')](_0x422244['agents'][_0xb880d5]);}});RpcVoiceAgentReport[_0x473b('0x39')]({'acwtime':_0x5563bb,'agentacw':!![]},_0x4d20d9,_0xb880d5)[_0x473b('0x28')](function(_0x401db6){logger[_0x473b('0x2a')]('[%s][UPDATE][ACWTIME:%s]',_0x4d20d9,_0x5563bb,_0x401db6);})['catch'](function(_0x4cfa9f){logger['error'](_0x473b('0x1e'),_0x4d20d9,_0x4cfa9f);});}else{logger[_0x473b('0x1d')](_0x473b('0x3a'),_0xb880d5);if(_0x422244[_0x473b('0x8')]){logger[_0x473b('0x2a')](_0x473b('0x3b'),JSON['stringify'](_0x422244[_0x473b('0x8')]));}}}catch(_0x3d4024){logger['error'](_0x473b('0x3c'),_0x3d4024[_0x473b('0x3d')]);}};Acw[_0x473b('0x35')][_0x473b('0x3e')]=function(_0x4309ab){try{if(this[_0x473b('0x6')][_0x4309ab['queue']]&&(this[_0x473b('0x6')][_0x4309ab[_0x473b('0x22')]][_0x473b('0x3')]||this[_0x473b('0x6')][_0x4309ab['queue']][_0x473b('0x3f')])){if(this[_0x473b('0x7')][_0x4309ab['interface']]){this[_0x473b('0x9')][_0x4309ab[_0x473b('0x40')]]={'queue':_0x4309ab[_0x473b('0x22')],'interface':_0x4309ab[_0x473b('0x21')],'destlinkedid':_0x4309ab['destlinkedid']};}}}catch(_0x16318b){logger[_0x473b('0x1d')](_0x473b('0x41'),_0x16318b[_0x473b('0x3d')]);}};Acw[_0x473b('0x35')][_0x473b('0x14')]=function(_0x15a4d4){try{if(this[_0x473b('0x6')][_0x15a4d4[_0x473b('0x22')]]&&(this['voiceQueues'][_0x15a4d4[_0x473b('0x22')]][_0x473b('0x3')]||this[_0x473b('0x6')][_0x15a4d4[_0x473b('0x22')]][_0x473b('0x3f')])){if(this[_0x473b('0x7')][_0x15a4d4['interface']]){this[_0x473b('0x9')][_0x15a4d4['uniqueid']]={'queue':_0x15a4d4[_0x473b('0x22')],'interface':_0x15a4d4[_0x473b('0x21')]};}}}catch(_0x52f5c8){logger[_0x473b('0x1d')](_0x473b('0x42'),_0x52f5c8[_0x473b('0x3d')]);}};Acw['prototype']['syncHangupRequest']=function(_0x150f0e){try{if(this[_0x473b('0x9')][_0x150f0e[_0x473b('0x40')]]&&_[_0x473b('0x43')](this[_0x473b('0x9')][_0x150f0e[_0x473b('0x40')]]['attended'])){logger['info'](_0x473b('0x44'),_0x150f0e[_0x473b('0x40')]);this['startAcw'](_0x150f0e['uniqueid']);}else if(this[_0x473b('0x9')][_0x150f0e[_0x473b('0x45')]]&&_[_0x473b('0x43')](this[_0x473b('0x9')][_0x150f0e[_0x473b('0x45')]][_0x473b('0x2d')])){logger[_0x473b('0x2a')](_0x473b('0x46'),_0x150f0e[_0x473b('0x45')]);this['startAcw'](_0x150f0e[_0x473b('0x45')]);}}catch(_0x236db1){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x236db1[_0x473b('0x3d')]);}};Acw[_0x473b('0x35')][_0x473b('0xd')]=function(_0x568ed9){try{if(this['channels'][_0x568ed9[_0x473b('0x40')]]&&this[_0x473b('0x9')][_0x568ed9[_0x473b('0x40')]][_0x473b('0x2d')]){logger[_0x473b('0x2a')](_0x473b('0x47'),_0x568ed9[_0x473b('0x40')]);this[_0x473b('0x20')](_0x568ed9[_0x473b('0x40')]);}else if(this[_0x473b('0x9')][_0x568ed9[_0x473b('0x45')]]&&this[_0x473b('0x9')][_0x568ed9[_0x473b('0x45')]][_0x473b('0x2d')]){logger['info'](_0x473b('0x48'),_0x568ed9['linkedid']);this[_0x473b('0x20')](_0x568ed9['linkedid']);}}catch(_0xaa280b){logger[_0x473b('0x1d')]('[ACW][syncHangup]\x20%s',_0xaa280b[_0x473b('0x3d')]);}};Acw['prototype'][_0x473b('0x49')]=function(_0xd42f95){try{if(!_[_0x473b('0x4a')](this['channels'][_0xd42f95[_0x473b('0x4b')]])){this[_0x473b('0x20')](_0xd42f95['transfereeuniqueid']);if(this['channels'][_0xd42f95[_0x473b('0x4c')]]){this['channels'][_0xd42f95[_0x473b('0x4c')]][_0x473b('0x2d')]=!![];this['channels'][_0xd42f95[_0x473b('0x4d')]]=this[_0x473b('0x9')][_0xd42f95[_0x473b('0x4c')]];this[_0x473b('0x4e')](_0xd42f95[_0x473b('0x4c')]);}}else if(!_[_0x473b('0x4a')](this[_0x473b('0x9')][_0xd42f95['transfertargetuniqueid']])){this[_0x473b('0x20')](_0xd42f95[_0x473b('0x4d')]);if(this['channels'][_0xd42f95[_0x473b('0x4f')]]){this[_0x473b('0x9')][_0xd42f95[_0x473b('0x4f')]][_0x473b('0x2d')]=!![];this[_0x473b('0x9')][_0xd42f95['transfereeuniqueid']]=this[_0x473b('0x9')][_0xd42f95[_0x473b('0x4f')]];this['deleteChannelAfterTimeout'](_0xd42f95[_0x473b('0x4f')]);}}}catch(_0x282519){logger[_0x473b('0x1d')](_0x473b('0x50'),_0x282519[_0x473b('0x3d')]);}};Acw[_0x473b('0x35')]['syncBlindTransfer']=function(_0x147a8b){try{if(this['channels'][_0x147a8b['transfereruniqueid']]){logger[_0x473b('0x2a')](_0x473b('0x51'),JSON[_0x473b('0x52')](_0x147a8b['transfereruniqueid']));this[_0x473b('0x20')](_0x147a8b['transfereruniqueid']);}else if(this['channels'][_0x147a8b['transfererlinkedid']]){logger[_0x473b('0x2a')](_0x473b('0x53'),JSON['stringify'](_0x147a8b[_0x473b('0x54')]));this['startAcw'](_0x147a8b[_0x473b('0x54')]);}}catch(_0x563ceb){logger[_0x473b('0x1d')](_0x473b('0x55'),_0x563ceb['message']);}};Acw[_0x473b('0x35')][_0x473b('0xf')]=function(_0x1a41ad){try{if(this['voiceQueues'][_0x1a41ad['queue']]&&this[_0x473b('0x6')][_0x1a41ad[_0x473b('0x22')]][_0x473b('0x56')]==='all'){if(this['agents'][_0x1a41ad['interface']]){logger[_0x473b('0x2a')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1a41ad[_0x473b('0x40')],_0x1a41ad['interface'],_0x1a41ad[_0x473b('0x22')]);return RpcUser['savePause'](this[_0x473b('0x7')][_0x1a41ad[_0x473b('0x21')]],_0x473b('0x57'),_0x1a41ad[_0x473b('0x40')]);}}}catch(_0x331a45){logger['error'](_0x473b('0x58'),_0x331a45[_0x473b('0x3d')]);}};Acw[_0x473b('0x35')][_0x473b('0x4e')]=function(_0x3573b5,_0xcf6982=0x2710){if(this['channels'][_0x3573b5]){setTimeout(()=>{delete this['channels'][_0x3573b5];},_0xcf6982);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1971ff2..8c73d72 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 _0x8d88=['username','password','keepConnected','Action','action','error','format','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','[ami.js][fullybooted]','exports','util','../../config/logger','ami','../../config/environment','asterisk'];(function(_0x268db5,_0x3408a0){var _0x5c0a20=function(_0x4b6445){while(--_0x4b6445){_0x268db5['push'](_0x268db5['shift']());}};_0x5c0a20(++_0x3408a0);}(_0x8d88,0x14f));var _0x88d8=function(_0x476392,_0x43d678){_0x476392=_0x476392-0x0;var _0x25d9f4=_0x8d88[_0x476392];return _0x25d9f4;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x88d8('0x0'));var logger=require(_0x88d8('0x1'))(_0x88d8('0x2'));var config=require(_0x88d8('0x3'));var ami=new Manager(config['asterisk']['port'],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')][_0x88d8('0x5')],config[_0x88d8('0x4')][_0x88d8('0x6')],!![]);ami[_0x88d8('0x7')]();ami[_0x88d8('0x8')]=BPromise['promisify'](ami[_0x88d8('0x9')]);function error(_0x2048bf){logger[_0x88d8('0xa')](util[_0x88d8('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x88d8('0x5')],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')][_0x88d8('0xc')],util['inspect'](_0x2048bf,![],null)));}function close(){logger['error'](util['format'](_0x88d8('0xd'),config[_0x88d8('0x4')][_0x88d8('0x5')],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')]['port']));}ami[_0x88d8('0xe')]=function(){return function(){return ami[_0x88d8('0x8')]({'action':'sipshowregistry'});};};ami[_0x88d8('0xf')]=function(){return function(){return ami[_0x88d8('0x8')]({'action':_0x88d8('0x10')});};};ami[_0x88d8('0x11')]=function(){return function(){return ami[_0x88d8('0x8')]({'action':_0x88d8('0x12')});};};ami[_0x88d8('0x13')]=function(){return function(){return ami[_0x88d8('0x8')]({'action':_0x88d8('0x14')});};};ami[_0x88d8('0x15')]=function(){return function(){return ami['Action']({'action':_0x88d8('0x16')});};};function connect(){logger['info'](util[_0x88d8('0xb')](_0x88d8('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x88d8('0x4')][_0x88d8('0xc')]));ami[_0x88d8('0x18')](_0x88d8('0xa'),error);ami[_0x88d8('0x18')](_0x88d8('0x19'),close);}ami['on']('connect',connect);ami['on'](_0x88d8('0x1a'),function(_0x3bf740){logger[_0x88d8('0x1b')](util[_0x88d8('0xb')](_0x88d8('0x1c'),config['asterisk'][_0x88d8('0x5')],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')][_0x88d8('0xc')],util[_0x88d8('0x1d')](_0x3bf740,![],null)));});ami['on']('fullybooted',function(){logger[_0x88d8('0x1b')](util[_0x88d8('0xb')](_0x88d8('0x1e'),config[_0x88d8('0x4')][_0x88d8('0x5')],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')][_0x88d8('0xc')]));return Promise['resolve']()[_0x88d8('0x1f')](ami[_0x88d8('0xe')]())[_0x88d8('0x1f')](ami[_0x88d8('0xf')]())[_0x88d8('0x1f')](ami[_0x88d8('0x11')]())[_0x88d8('0x1f')](ami[_0x88d8('0x13')]())[_0x88d8('0x1f')](ami[_0x88d8('0x15')]())['catch'](function(_0x2e427c){logger[_0x88d8('0xa')](_0x88d8('0x20'),util[_0x88d8('0x1d')](_0x2e427c,{'showHidden':![],'depth':null}));});});ami[_0x88d8('0x18')](_0x88d8('0xa'),error);ami[_0x88d8('0x18')](_0x88d8('0x19'),close);module[_0x88d8('0x21')]=ami; \ No newline at end of file +var _0x58c5=['format','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','coreshowchannels','info','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','catch','exports','asterisk-manager','util','../../config/logger','ami','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','error','inspect'];(function(_0x49347a,_0x409326){var _0x3404d2=function(_0x404f5c){while(--_0x404f5c){_0x49347a['push'](_0x49347a['shift']());}};_0x3404d2(++_0x409326);}(_0x58c5,0x1c1));var _0x558c=function(_0x526bdd,_0x56689f){_0x526bdd=_0x526bdd-0x0;var _0x3bac18=_0x58c5[_0x526bdd];return _0x3bac18;};'use strict';var Manager=require(_0x558c('0x0'));var BPromise=require('bluebird');var util=require(_0x558c('0x1'));var logger=require(_0x558c('0x2'))(_0x558c('0x3'));var config=require(_0x558c('0x4'));var ami=new Manager(config[_0x558c('0x5')][_0x558c('0x6')],config[_0x558c('0x5')]['ip'],config[_0x558c('0x5')][_0x558c('0x7')],config[_0x558c('0x5')]['password'],!![]);ami[_0x558c('0x8')]();ami[_0x558c('0x9')]=BPromise[_0x558c('0xa')](ami['action']);function error(_0x472a77){logger[_0x558c('0xb')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x558c('0x5')][_0x558c('0x7')],config[_0x558c('0x5')]['ip'],config[_0x558c('0x5')][_0x558c('0x6')],util[_0x558c('0xc')](_0x472a77,![],null)));}function close(){logger['error'](util[_0x558c('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x558c('0x5')][_0x558c('0x7')],config['asterisk']['ip'],config[_0x558c('0x5')]['port']));}ami[_0x558c('0xe')]=function(){return function(){return ami[_0x558c('0x9')]({'action':_0x558c('0xf')});};};ami[_0x558c('0x10')]=function(){return function(){return ami['Action']({'action':_0x558c('0x11')});};};ami[_0x558c('0x12')]=function(){return function(){return ami[_0x558c('0x9')]({'action':_0x558c('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x558c('0x9')]({'action':_0x558c('0x14')});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0x558c('0x15')});};};function connect(){logger[_0x558c('0x16')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x558c('0x5')][_0x558c('0x7')],config[_0x558c('0x5')]['ip'],config['asterisk']['port']));ami[_0x558c('0x17')](_0x558c('0xb'),error);ami[_0x558c('0x17')](_0x558c('0x18'),close);}ami['on'](_0x558c('0x19'),connect);ami['on'](_0x558c('0x1a'),function(_0x8e603b){logger['info'](util[_0x558c('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x558c('0x7')],config['asterisk']['ip'],config[_0x558c('0x5')][_0x558c('0x6')],util['inspect'](_0x8e603b,![],null)));});ami['on'](_0x558c('0x1b'),function(){logger[_0x558c('0x16')](util[_0x558c('0xd')](_0x558c('0x1c'),config[_0x558c('0x5')]['username'],config[_0x558c('0x5')]['ip'],config[_0x558c('0x5')]['port']));return Promise['resolve']()['then'](ami[_0x558c('0xe')]())[_0x558c('0x1d')](ami[_0x558c('0x10')]())[_0x558c('0x1d')](ami[_0x558c('0x12')]())['then'](ami[_0x558c('0x1e')]())[_0x558c('0x1d')](ami['actionCoreShowChannels']())[_0x558c('0x1f')](function(_0xe4c459){logger['error']('[ami.js][fullybooted]',util[_0x558c('0xc')](_0xe4c459,{'showHidden':![],'depth':null}));});});ami[_0x558c('0x17')](_0x558c('0xb'),error);ami[_0x558c('0x17')](_0x558c('0x18'),close);module[_0x558c('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 67fe911..4df3846 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xb7e7[_0x174ef5];return _0x1cc379;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 6b5edeb..bfcd5f9 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 _0x1847=['syncCampaigns','undefined','isIVRCampaignActive','resolve','dialTimezone','checkIfTimeIntervals','launchHandleIvr','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','OVERTIME_GLOBAL_INTERVAL','\x20Interval\x20is\x20overtime:\x20','silly','isGlobal','AMI\x20IfTime','syncAgentConnect','uniqueId','type','decrementOriginate','queue','[syncAgentConnect]','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','ivr','[syncQueueCallerAbandon]','droptime','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','rescheduleContact','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','syncQueueStatusComplete','preview','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','finally','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','getQueue','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','exten','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','reason19\x20machine....','[syncHangup]','ivrAnswerCallsDay','cause-txt','[syncAgentCompleteIvr]','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','[syncHangup2]','Normal\x20Clearing','outboundUnknownCallsDay','[syncHangup][createHistory]','queuesSummary','running','isPreviewCampaign','statusMessage','inUse','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','[emptyContact]','UserId','Agent','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','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','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','predictiveIntervalHitRate','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','handleIvr','temp','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[handleIvr]','[getContactCampaign2]','available','dialLimitQueue','pTalking','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','ACTIVE','checkIsBlackList','[actionOriginate]','[handlePower]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','optionPredictive','startProgressive','ivrOriginated','queueBooked','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','queuemember','loopCampaigns','loopClearZombieChannels','then','isUndefined','emit','outbound','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','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','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','stringify','pick','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','INACTIVE','isIVRCampaign','format','campaign:ivr:%s','campaign:save','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','Error','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','indexOf','true','catch','content','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1847,0x185));var _0x7184=function(_0x459baf,_0x332707){_0x459baf=_0x459baf-0x0;var _0x4a5970=_0x1847[_0x459baf];return _0x4a5970;};'use strict';var util=require(_0x7184('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0x7184('0x1'));var utils=require(_0x7184('0x2'));var hopperUtils=require(_0x7184('0x3'));var ut=require(_0x7184('0x4'));var config=require('../../../config/environment/');var logger=require(_0x7184('0x5'))(_0x7184('0x6'));var loggerBooked=require(_0x7184('0x5'))(_0x7184('0x7'));var loggerPredictive=require(_0x7184('0x5'))(_0x7184('0x8'));var loggerPredictiveCalls=require(_0x7184('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x7184('0x5'))(_0x7184('0x9'));var ami=require(_0x7184('0xa'));config[_0x7184('0xb')]=_[_0x7184('0xc')](config[_0x7184('0xb')],{'host':_0x7184('0xd'),'port':0x18eb});var io=require(_0x7184('0xe'))(new Redis(config[_0x7184('0xb')]));var cmHopper=require(_0x7184('0xf'));var voiceQueueRt=require(_0x7184('0x10'));var RpcSetting=require(_0x7184('0x11'));var Interval=require(_0x7184('0x12'));var Action=require(_0x7184('0x13'));var History=require(_0x7184('0x14'));var Final=require(_0x7184('0x15'));var AgentComplete=require(_0x7184('0x16'));var QueueCallerAbandon=require(_0x7184('0x17'));var Hangup=require(_0x7184('0x18'));var ipAgi=process[_0x7184('0x19')][_0x7184('0x1a')]||_0x7184('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7184('0x1c')][_0x7184('0x1d')]=function(_0x31edaa){this['tail']=this[_0x7184('0x1e')]?this[_0x7184('0x1e')]['finally'](_0x31edaa):_0x31edaa();};function Dialer(_0x4135ee,_0x5790ec){this[_0x7184('0x1f')]=new Sequence();this['preview']=_0x5790ec;this[_0x7184('0x20')]=_0x4135ee[_0x7184('0x20')];this[_0x7184('0x21')]=_0x4135ee[_0x7184('0x21')];this[_0x7184('0x22')]=_0x4135ee['agents'];this[_0x7184('0x23')]=_0x4135ee['trunks'];this['maxNumberOriginate']=config[_0x7184('0x24')]||0x2;this['channels']={};this['actions']={};this[_0x7184('0x25')]={};this['uniqueId']={};this[_0x7184('0x26')]={};this['startPredictive']={};this[_0x7184('0x27')]={};this[_0x7184('0x28')]={};this[_0x7184('0x29')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on']('queuecallerabandon',this[_0x7184('0x2a')][_0x7184('0x2b')](this));ami['on'](_0x7184('0x2c'),this[_0x7184('0x2d')][_0x7184('0x2b')](this));ami['on'](_0x7184('0x2e'),this[_0x7184('0x2f')][_0x7184('0x2b')](this));ami['on']('custom:queuesummary',this[_0x7184('0x9')][_0x7184('0x2b')](this));ami['on'](_0x7184('0x30'),this[_0x7184('0x31')][_0x7184('0x2b')](this));ami['on'](_0x7184('0x32'),this[_0x7184('0x33')]['bind'](this));ami['on'](_0x7184('0x34'),this[_0x7184('0x35')][_0x7184('0x2b')](this));ami['on']('varset',this['syncVarSet'][_0x7184('0x2b')](this));ami['on'](_0x7184('0x36'),this['syncQueueMember'][_0x7184('0x2b')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x7184('0x2b')](this));this[_0x7184('0x37')]();this[_0x7184('0x38')]();RpcSetting['getSettings']()[_0x7184('0x39')](function(_0x14cd0b){previewRecallmeReminderInterval=_0x14cd0b['previewRecallmeReminderInterval'];});}function isNotNull(_0x1c6be6){return _0x1c6be6!==null&&!_[_0x7184('0x3a')](_0x1c6be6);}function msgResponse(_0x2b3457,_0x168f5d,_0x4a5f96){return{'action':_0x2b3457,'response':_0x168f5d,'message':_0x4a5f96,'stack':_0x4a5f96};}function emit(_0x5becd2,_0x1d1abe,_0x4fcd57){io['to'](_0x5becd2)[_0x7184('0x3b')](_0x1d1abe,_0x4fcd57);}function emitOutboundVoiceQueueSummary(_0x457907){if(_0x457907['type']===_0x7184('0x3c')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x7184('0x3d')](_0x457907,{'showHidden':![],'depth':null}));emit(util['format'](_0x7184('0x3e'),_0x457907[_0x7184('0x3f')]),_0x7184('0x40'),_0x457907);}}function checkGetDataPredictive(_0x2ac0ea){if(isNotNull(_0x2ac0ea)&&!_[_0x7184('0x41')](_0x2ac0ea)){loggerPredictive[_0x7184('0x42')](_0x7184('0x43'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ac0ea[_0x7184('0x44')]);loggerPredictive[_0x7184('0x42')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ac0ea[_0x7184('0x45')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x46'),_0x2ac0ea[_0x7184('0x47')]);loggerPredictive[_0x7184('0x42')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ac0ea[_0x7184('0x48')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x49'),_0x2ac0ea[_0x7184('0x4a')]);loggerPredictive['info'](_0x7184('0x4b'),_0x2ac0ea[_0x7184('0x4c')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x4d'));if(_0x2ac0ea[_0x7184('0x44')]>0x0){if(!_[_0x7184('0x3a')](_0x2ac0ea[_0x7184('0x4c')])&&_0x2ac0ea[_0x7184('0x4c')]>0x0){return!![];}loggerPredictive[_0x7184('0x42')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x7184('0x3a')](_0x2ac0ea[_0x7184('0x4a')])&&_0x2ac0ea['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x7184('0x42')](_0x7184('0x4e'));}else{loggerPredictive[_0x7184('0x42')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x7184('0x42')](_0x7184('0x4f'));}return![];}function mergeDataErlangB(_0x388424){return function(_0xb48d34){loggerPredictive[_0x7184('0x42')](_0x7184('0x50'));loggerPredictive[_0x7184('0x42')](_0x7184('0x51'),_0xb48d34[_0x7184('0x52')]);loggerPredictive['info'](_0x7184('0x53'),_0xb48d34[_0x7184('0x54')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x55'),_0xb48d34[_0x7184('0x56')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x57'),_0xb48d34[_0x7184('0x58')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x55'),_0xb48d34['erlangAbandonmentRate']);loggerPredictive[_0x7184('0x42')](_0x7184('0x4d'));_[_0x7184('0x59')](_0x388424,_0xb48d34);};}function ifInterval(_0xe6f80c,_0x5e2a2d){if(_[_0x7184('0x3a')](_0x5e2a2d)){return![];}return utils['getSeconds'](undefined,_0x5e2a2d)<_0xe6f80c*0x3c;}function clearPredictiveAttributes(_0x3e5ac0){if(_0x3e5ac0[_0x7184('0x27')]){_0x3e5ac0[_0x7184('0x27')]=undefined;loggerPredictive[_0x7184('0x5a')](_0x3e5ac0[_0x7184('0x3f')],_0x7184('0x5b'));}if(_0x3e5ac0[_0x7184('0x5c')]){_0x3e5ac0['startPredictive']=undefined;loggerPredictive[_0x7184('0x5a')](_0x3e5ac0[_0x7184('0x3f')],_0x7184('0x5d'));}if(_0x3e5ac0['handlePredictive']){clearInterval(_0x3e5ac0[_0x7184('0x5e')]);_0x3e5ac0[_0x7184('0x5e')]=undefined;loggerPredictive[_0x7184('0x5a')](_0x3e5ac0[_0x7184('0x3f')],_0x7184('0x5f'));}}function loggerCatchPredictive(_0x148d3f,_0x4b784b){return function(_0x5ea3d4){loggerPredictive[_0x7184('0x60')](_0x4b784b[_0x7184('0x3f')],_0x148d3f);loggerPredictive['error'](_0x5ea3d4['stack']);clearPredictiveAttributes(_0x4b784b);};}function loggerCatch(_0x584ca5){return function(_0x93d642){logger[_0x7184('0x60')](_0x584ca5,util['inspect'](_0x93d642,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x478f4f){return function(_0x341db9){if(isNotNull(_0x341db9)&&isNotNull(_0x341db9[0x0])){if(_0x341db9[0x0][_0x7184('0x61')]>0x0){_0x478f4f[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x64')];logger['info'](_0x7184('0x65')+_0x478f4f[_0x7184('0x3f')],_0x341db9[0x0][_0x7184('0x61')],_0x7184('0x66'));}else{_0x478f4f[_0x7184('0x62')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x7184('0x42')](_0x7184('0x67')+_0x478f4f[_0x7184('0x3f')]);}}};}function createObjHistory(_0x1be476,_0x43365b,_0x3e3d57,_0xcfc6b3,_0xcb42e){_0x1be476[_0x7184('0x62')]=_0x3e3d57;var _0x4d0dc8=new Action(_0x1be476,_0x43365b);var _0x436666=new History(_0x4d0dc8);_0x436666[_0x7184('0x68')]=_0xcfc6b3;_0x436666[_0x7184('0x69')]=_0xcb42e;_0x436666[_0x7184('0x6a')]=_0x4d0dc8[_0x7184('0x6b')];return _0x436666;}function unlockQueueStatus(_0x1fd94b,_0x5c33ee){setTimeout(function(){if(_[_0x7184('0x3a')](_0x1fd94b['queueStatusComplete'])){loggerBooked['error'](_0x7184('0x6c'),_0x5c33ee);}_0x1fd94b[_0x7184('0x6d')]=!![];loggerBooked[_0x7184('0x42')]('[booked][unlockQueueStatus]',_0x5c33ee,JSON[_0x7184('0x6e')](_[_0x7184('0x6f')](_0x1fd94b,[_0x7184('0x3f'),_0x7184('0x6d')])));},0x1f3);}function checkInterval(_0x8e99ba){return function(){if(!isNotNull(_0x8e99ba['Interval'])){_0x8e99ba[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x70')];throw _0x8e99ba[_0x7184('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x8e99ba[_0x7184('0x71')][_0x7184('0x72')])){_0x8e99ba[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x70')];throw _0x8e99ba[_0x7184('0x3f')]+_0x7184('0x73');}if(!isNotNull(_[_0x7184('0x41')](_0x8e99ba[_0x7184('0x71')][_0x7184('0x72')]))){_0x8e99ba[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x70')];throw _0x8e99ba[_0x7184('0x3f')]+_0x7184('0x73');}};}function checkIsIVRCampaignActive(_0x3a6bb4){return function(){if(!utils['isIVRCampaignActive'](_0x3a6bb4)){_0x3a6bb4[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x74')];throw _0x3a6bb4['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x28783f){if(utils[_0x7184('0x75')](_0x28783f)){emit(util[_0x7184('0x76')](_0x7184('0x77'),_0x28783f[_0x7184('0x3f')]),_0x7184('0x78'),_0x28783f);}}function loggerCatchQueueSummary(_0x4d5e0b,_0x323e8e){return function(_0x5c2054){clearPredictiveAttributes(_0x323e8e);emitCampaignSummary(_0x323e8e);loggerSyncQueueSummary[_0x7184('0x5a')](_0x4d5e0b,util[_0x7184('0x3d')](_0x5c2054,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1f85d2){if(_0x1f85d2['sendMessageOneNotActive']){if(_0x1f85d2[_0x7184('0x79')]===0x0){_0x1f85d2['sendMessageOneNotActive']=![];_0x1f85d2[_0x7184('0x62')]=utils['CAMPAIGN_STATUS'][_0x7184('0x74')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1f85d2[_0x7184('0x3f')],_0x7184('0x7a'));}else{_0x1f85d2[_0x7184('0x62')]=utils['CAMPAIGN_STATUS'][_0x7184('0x7b')];loggerSyncQueueSummary[_0x7184('0x5a')](_0x7184('0x7c'),_0x1f85d2[_0x7184('0x3f')],'is\x20deactivated');}emitCampaignSummary(_0x1f85d2);}}function myreject(_0x439865){return function(_0x37f2da){return _0x439865(msgResponse(_0x7184('0x7d'),_0x7184('0x7e'),JSON[_0x7184('0x6e')](_0x37f2da)));};}Dialer['prototype']['isTrunkReachable']=function(_0x4367c6){return!_['isUndefined'](_0x4367c6)&&_0x4367c6&&!_[_0x7184('0x3a')](_0x4367c6['name'])&&!_[_0x7184('0x3a')](_0x4367c6[_0x7184('0x7f')])&&_0x4367c6['active']&&(this[_0x7184('0x23')][util[_0x7184('0x76')]('SIP/%s',_0x4367c6['name'])][_0x7184('0x80')]===_0x7184('0x81')||this[_0x7184('0x23')][util['format'](_0x7184('0x82'),_0x4367c6[_0x7184('0x3f')])][_0x7184('0x80')]===_0x7184('0x83'));};Dialer[_0x7184('0x1c')][_0x7184('0x84')]=function(_0x180aeb){var _0x158d04=this;return function(){if(!_0x158d04[_0x7184('0x85')](_0x180aeb[_0x7184('0x86')])){if(!_0x158d04[_0x7184('0x85')](_0x180aeb[_0x7184('0x87')])){_0x180aeb['message']=utils['CAMPAIGN_STATUS'][_0x7184('0x88')];throw _0x180aeb[_0x7184('0x3f')]+_0x7184('0x89');}}};};Dialer[_0x7184('0x1c')][_0x7184('0x8a')]=function(_0x152d64,_0x5733fb,_0x513a9e,_0x53049a){var _0x478f95=this;return function(){var _0x1a04d4=!![];return _0x478f95[_0x7184('0x8b')](_0x152d64,_0x5733fb,_0x513a9e,_0x53049a,_0x1a04d4);};};Dialer[_0x7184('0x1c')]['checkIfTimeIntervals']=function(_0x381de7,_0x518ba9,_0x20cbb7,_0x54f6c1){var _0x552c77=this;return function(){var _0x53e2fe=![];return _0x552c77[_0x7184('0x8b')](_0x381de7[_0x7184('0x72')],_0x518ba9,_0x20cbb7,_0x54f6c1,_0x53e2fe);};};Dialer[_0x7184('0x1c')]['ifTimeIvr']=function(_0x384f3e,_0x3c6bd6,_0xf1c091,_0x351881,_0x4a5ad0){var _0x369f87=[];return new Promise(function(_0x1bbaab,_0x244b6a){if(!isNotNull(_0x384f3e)){_0x351881[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x70')];return _0x244b6a(msgResponse(_0x7184('0x8c'),_0x7184('0x8d'),_0xf1c091+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x384f3e)){_0x351881[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x8e')];return _0x244b6a(msgResponse(_0x7184('0x8c'),_0x7184('0x8d'),_0xf1c091+_0x7184('0x8f')));}if(_0x3c6bd6&&_[_0x7184('0x3a')](config[_0x7184('0x90')][_0x3c6bd6])){_0x351881[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x91')];return _0x244b6a(msgResponse('ifTime',_0x7184('0x8d'),_0xf1c091+_0x7184('0x92')+_0x3c6bd6));}if(_[_0x7184('0x93')](_0x384f3e)){for(var _0x20cb84=0x0;_0x20cb84<_0x384f3e[_0x7184('0x94')];_0x20cb84+=0x1){_0x369f87[_0x7184('0x95')](ami[_0x7184('0x96')]({'action':_0x7184('0x97'),'command':util[_0x7184('0x76')](_0x7184('0x98'),_0x384f3e[_0x20cb84][_0x7184('0x99')],!_[_0x7184('0x3a')](config[_0x7184('0x90')][_0x3c6bd6])?_0x3c6bd6:'')})[_0x7184('0x39')](function(_0x556860){return _0x556860['content'][_0x7184('0x9a')](_0x7184('0x9b'))>=0x0;})[_0x7184('0x9c')](myreject(_0x244b6a)));}}else{_0x369f87[_0x7184('0x95')](ami[_0x7184('0x96')]({'action':_0x7184('0x97'),'command':util['format'](_0x7184('0x98'),_0x384f3e,!_[_0x7184('0x3a')](config[_0x7184('0x90')][_0x3c6bd6])?_0x3c6bd6:'')})[_0x7184('0x39')](function(_0x18485d){return _0x18485d[_0x7184('0x9d')][_0x7184('0x9a')](_0x7184('0x9b'))>=0x0;})[_0x7184('0x9c')](myreject(_0x244b6a)));}Promise['all'](_0x369f87)[_0x7184('0x39')](function(_0x8b0e1){var _0x219ec7=_['some'](_0x8b0e1);if(_0x219ec7){return _0x1bbaab(_0x219ec7);}else{_0x351881[_0x7184('0x62')]=_0x4a5ad0?utils[_0x7184('0x63')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x7184('0x9e')];return _0x244b6a(msgResponse(_0x7184('0x9f'),_0x7184('0x8d'),_0x7184('0xa0')+_0x4a5ad0+'\x20'+_0xf1c091+'\x20Interval\x20is\x20overtime:\x20'+util[_0x7184('0x3d')](_0x384f3e,{'showHidden':![],'depth':null})+_0x7184('0xa1')+_0x3c6bd6));}})[_0x7184('0x9c')](function(_0x56c5b3){return _0x244b6a(msgResponse('ifTime',_0x7184('0x8d'),JSON[_0x7184('0x6e')](_0x56c5b3)));});});};Dialer[_0x7184('0x1c')]['loopCampaigns']=function(){var _0x1bbe29=this;return cmHopper[_0x7184('0xa2')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x1bbe29['syncCampaigns']();},0x3e8);});};Dialer[_0x7184('0x1c')][_0x7184('0xa3')]=function(){var _0x303533=this;var _0x57fe4c;for(var _0x2d4540 in this[_0x7184('0x21')]){if(typeof this[_0x7184('0x21')][_0x2d4540]!==_0x7184('0xa4')){_0x57fe4c=this[_0x7184('0x21')][_0x2d4540];if(utils['isIVRCampaign'](_0x57fe4c)&&utils[_0x7184('0xa5')](_0x57fe4c)){_0x57fe4c['sendMessageOneNotActive']=!![];Promise[_0x7184('0xa6')]()['then'](checkIsIVRCampaignActive(_0x57fe4c))[_0x7184('0x39')](checkInterval(_0x57fe4c))[_0x7184('0x39')](_0x303533['checkIsTrunkReachable'](_0x57fe4c))[_0x7184('0x39')](_0x303533[_0x7184('0x8a')](_0x57fe4c['dialGlobalInterval'],_0x57fe4c[_0x7184('0xa7')],_0x57fe4c[_0x7184('0x3f')],_0x57fe4c))[_0x7184('0x39')](_0x303533[_0x7184('0xa8')](_0x57fe4c[_0x7184('0x71')],_0x57fe4c[_0x7184('0xa7')],_0x57fe4c[_0x7184('0x3f')],_0x57fe4c))[_0x7184('0x39')](_0x303533[_0x7184('0xa9')](_0x57fe4c))[_0x7184('0x9c')](loggerCatchQueueSummary('[syncCampaigns]',_0x57fe4c));}else{notSendMessagesCampaign(_0x57fe4c);}}}};Dialer['prototype'][_0x7184('0xaa')]=function(_0x5a1c74){if(_0x5a1c74[_0x7184('0xab')]!==_0x7184('0x8')){clearPredictiveAttributes(_0x5a1c74);}switch(_0x5a1c74[_0x7184('0xab')]){case _0x7184('0xac'):this['handlePower'](_0x5a1c74,0x1);break;case _0x7184('0xad'):this[_0x7184('0xae')](_0x5a1c74,_0x5a1c74[_0x7184('0xaf')]);break;case _0x7184('0x8'):this['predictive'](_0x5a1c74);break;case'booked':this['handlePower'](_0x5a1c74,0x1);break;default:logger[_0x7184('0x60')](_0x7184('0xb0'),_0x5a1c74[_0x7184('0x3f')],_0x7184('0xb1'));}};Dialer[_0x7184('0x1c')]['ifTime']=function(_0x34cf5f,_0x504a73){var _0x997de1=_0x34cf5f[_0x7184('0xa7')];var _0x23a1f1=_0x504a73?_0x34cf5f[_0x7184('0xb2')]:_0x34cf5f[_0x7184('0x71')][_0x7184('0x72')];logger['silly'](_0x7184('0xb3'),_0x23a1f1,_0x997de1,_0x34cf5f['name'],util[_0x7184('0x76')](_0x7184('0xb4'),_0x34cf5f[_0x7184('0x3f')],_0x34cf5f['id']));var _0x598a2f=null;return Interval['intervalIftime'](_0x23a1f1,_0x997de1)[_0x7184('0x39')](function(_0xfd34e5){if(_0xfd34e5===!![]){return _0xfd34e5;}else{_0x34cf5f[_0x7184('0x62')]=_0x504a73?utils['CAMPAIGN_STATUS'][_0x7184('0xb5')]:utils[_0x7184('0x63')][_0x7184('0x9e')];_0x598a2f=msgResponse(_0x7184('0x9f'),_0x7184('0x8d'),_0x7184('0xa0')+_0x504a73+'\x20'+_0x34cf5f[_0x7184('0x3f')]+_0x7184('0xb6')+util['inspect'](_0x23a1f1,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x997de1);}if(_0x598a2f!==null){logger[_0x7184('0xb7')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x598a2f);_0x598a2f[_0x7184('0xb8')]=_0x504a73;throw _0x598a2f;}})[_0x7184('0x9c')](function(_0x2907c0){logger[_0x7184('0x60')](_0x7184('0xb9'),_0x2907c0);throw msgResponse(_0x7184('0x7d'),_0x7184('0x7e'),util[_0x7184('0x3d')](_0x2907c0,{'showHidden':![],'depth':null}));});};Dialer[_0x7184('0x1c')][_0x7184('0xba')]=function(_0x3ba9ba){if(this[_0x7184('0x20')][_0x3ba9ba['queue']]){if(this['uniqueId'][_0x3ba9ba['uniqueid']]&&this[_0x7184('0xbb')][_0x3ba9ba['uniqueid']][_0x7184('0xbc')]!=='ivr'){utils[_0x7184('0xbd')](this[_0x7184('0x20')][_0x3ba9ba[_0x7184('0xbe')]],_0x7184('0xbf'));this[_0x7184('0xbb')][_0x3ba9ba[_0x7184('0xc0')]][_0x7184('0xc1')]=moment()[_0x7184('0x76')](_0x7184('0xc2'));}}};Dialer[_0x7184('0x1c')][_0x7184('0x2f')]=function(_0x5aa5c0){var _0x28b50e=this[_0x7184('0xbb')][_0x5aa5c0[_0x7184('0xc0')]];if(this[_0x7184('0x20')][_0x5aa5c0[_0x7184('0xbe')]]){if(_0x28b50e&&_0x28b50e[_0x7184('0xbc')]!=='ivr'){delete this[_0x7184('0xbb')][_0x5aa5c0[_0x7184('0xc0')]];this[_0x7184('0x20')][_0x5aa5c0[_0x7184('0xbe')]]['outboundAnswerCallsDay']+=0x1;var _0x354e0c=new AgentComplete(_0x28b50e,_0x5aa5c0);if(_0x5aa5c0[_0x7184('0xc3')]===_0x7184('0xc4')){_0x354e0c[_0x7184('0xc5')]=this[_0x7184('0x20')][_0x5aa5c0[_0x7184('0xbe')]]['dialQueueProject2']&&this[_0x7184('0x20')][_0x5aa5c0[_0x7184('0xbe')]][_0x7184('0xc6')]?moment()[_0x7184('0x76')](_0x7184('0xc2')):undefined;}hopperUtils[_0x7184('0xc7')](_0x354e0c)[_0x7184('0x9c')](loggerCatch(_0x7184('0xc8')));hopperUtils[_0x7184('0xc9')](_0x354e0c)[_0x7184('0x9c')](loggerCatch(_0x7184('0xca')));}}};Dialer[_0x7184('0x1c')][_0x7184('0x2a')]=function(_0x1f0eb6){var _0x2b243d=this[_0x7184('0xbb')][_0x1f0eb6[_0x7184('0xc0')]];var _0x5e616a=this;var _0x4ea0f7=![];var _0x1ff6ae;var _0x59c2c7;if(this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]){if(_0x2b243d&&_0x2b243d[_0x7184('0xbc')]!==_0x7184('0xcb')){delete this[_0x7184('0xbb')][_0x1f0eb6[_0x7184('0xc0')]];utils[_0x7184('0xbd')](this[_0x7184('0x20')][_0x1f0eb6['queue']],_0x7184('0xcc'));_0x2b243d[_0x7184('0xcd')]=moment()[_0x7184('0x76')](_0x7184('0xc2'));var _0x4cd065=new QueueCallerAbandon(_0x2b243d,_0x1f0eb6);if(utils[_0x7184('0xce')](_0x2b243d[_0x7184('0xcd')],_0x2b243d[_0x7184('0xcf')])>=_0x2b243d[_0x7184('0xd0')]){this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x7184('0x20')][_0x1f0eb6['queue']][_0x7184('0xd1')]+=0x1;this['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xd2')]+=0x1;_0x4cd065['state']=0xa;_0x4cd065[_0x7184('0x69')]=_0x7184('0xd3');_0x4cd065[_0x7184('0xd4')]=_0x7184('0xd5');_0x4cd065[_0x7184('0xc5')]=this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]['dialQueueProject2']?moment()[_0x7184('0x76')](_0x7184('0xc2')):undefined;_0x4cd065['countdropretry']+=0x1;_0x4cd065[_0x7184('0xd6')]+=0x1;_0x1ff6ae=this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]['dialDropRetryFrequency'];_0x59c2c7=this['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xd7')];hopperUtils[_0x7184('0xd8')](_0x4cd065,_0x4cd065[_0x7184('0x68')],_0x2b243d[_0x7184('0xd9')])['then'](function(_0x4e022a){_0x4ea0f7=_0x4e022a[_0x7184('0xda')]==0x1;if(_0x4cd065[_0x7184('0xdb')]>=_0x5e616a['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xdc')]){_0x5e616a[_0x7184('0xdd')](_0x4cd065,_0x4e022a[_0x7184('0xda')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4cd065[_0x7184('0xdb')],'scheduledat':moment()['add'](_0x5e616a['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xde')],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b243d[_0x7184('0xe0')],'ListId':_0x2b243d[_0x7184('0xe1')],'VoiceQueueId':_0x2b243d[_0x7184('0xe2')]||undefined,'CampaignId':_0x2b243d[_0x7184('0xe3')]||undefined})['catch'](loggerCatch(_0x7184('0xe4')));var _0x16f818=new History(_0x4cd065);_0x16f818[_0x7184('0x68')]=0xa;_0x16f818[_0x7184('0x69')]=_0x7184('0xd3');_0x16f818[_0x7184('0x6b')]=moment()[_0x7184('0x76')](_0x7184('0xc2'));_0x16f818[_0x7184('0x6a')]=_0x16f818[_0x7184('0x6b')];_0x16f818[_0x7184('0xe5')]=_0x4cd065[_0x7184('0xe5')];_0x16f818['calleridnum']=_0x4cd065[_0x7184('0xe6')];hopperUtils[_0x7184('0xc7')](_0x16f818)['catch'](loggerCatch(_0x7184('0xe7')));}})[_0x7184('0x39')](function(){if(_0x4ea0f7)hopperUtils[_0x7184('0xe8')](_0x4cd065,_0x1ff6ae,_0x59c2c7)[_0x7184('0x39')](function(){return 0x1;});});}else{this[_0x7184('0x20')][_0x1f0eb6['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xe9')]+=0x1;_0x4cd065['state']=0xb;_0x4cd065[_0x7184('0x69')]='Abandoned';_0x4cd065[_0x7184('0xd4')]=_0x7184('0xea');_0x4cd065[_0x7184('0xeb')]+=0x1;_0x4cd065[_0x7184('0xd6')]+=0x1;_0x1ff6ae=this['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]]['dialAbandonedRetryFrequency'];_0x59c2c7=this[_0x7184('0x20')][_0x1f0eb6['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x7184('0xd8')](_0x4cd065,_0x4cd065[_0x7184('0x68')],_0x2b243d[_0x7184('0xd9')])[_0x7184('0x39')](function(_0x2ba6dd){if(_0x4cd065['countabandonedretry']>=_0x5e616a[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]['dialAbandonedMaxRetry']){_0x5e616a[_0x7184('0xdd')](_0x4cd065,_0x2ba6dd[_0x7184('0xda')]);}else{hopperUtils[_0x7184('0xec')]({'active':![],'countabandonedretry':_0x4cd065[_0x7184('0xeb')],'scheduledat':moment()['add'](_0x5e616a[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xed')],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b243d[_0x7184('0xe0')],'ListId':_0x2b243d[_0x7184('0xe1')],'VoiceQueueId':_0x2b243d[_0x7184('0xe2')]||undefined,'CampaignId':_0x2b243d['CampaignId']||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0xee')));var _0x5dc9e8=new History(_0x4cd065);_0x5dc9e8[_0x7184('0x68')]=0xb;_0x5dc9e8[_0x7184('0x69')]='Abandoned';_0x5dc9e8['starttime']=moment()[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x5dc9e8[_0x7184('0x6a')]=_0x5dc9e8[_0x7184('0x6b')];_0x5dc9e8[_0x7184('0xe5')]=_0x4cd065[_0x7184('0xe5')];_0x5dc9e8[_0x7184('0xe6')]=_0x4cd065[_0x7184('0xe6')];hopperUtils['createHistory'](_0x5dc9e8)[_0x7184('0x9c')](loggerCatch(_0x7184('0xef')));}})[_0x7184('0x39')](function(){if(_0x4ea0f7)hopperUtils[_0x7184('0xe8')](_0x4cd065,_0x1ff6ae,_0x59c2c7)[_0x7184('0x39')](function(){return 0x1;});});}}}};Dialer[_0x7184('0x1c')][_0x7184('0x35')]=function(_0x548ddc){if(this[_0x7184('0xf0')][_0x548ddc[_0x7184('0xc0')]]){this[_0x7184('0xf0')][_0x548ddc[_0x7184('0xc0')]][_0x7184('0xf1')]=_0x548ddc[_0x7184('0xf1')];}if(this['uniqueId'][_0x548ddc[_0x7184('0xc0')]]){this[_0x7184('0xbb')][_0x548ddc[_0x7184('0xc0')]][_0x7184('0xf1')]=_0x548ddc[_0x7184('0xf1')];}};Dialer[_0x7184('0x1c')][_0x7184('0xf2')]=function(_0x5bfbae){if(!this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]]){return;}var _0x4b1ad9=this['voiceQueues'][this['actions'][_0x5bfbae[_0x7184('0xf3')]][_0x7184('0xbe')]][_0x7184('0xf4')]||_0x7184('0xf5');if(_0x4b1ad9===_0x7184('0xf6')){if(this['actions'][_0x5bfbae['actionid']]&&_[_0x7184('0xf7')](this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]][_0x7184('0xf8')])&&_0x5bfbae['status']==='1'&&_0x5bfbae[_0x7184('0xf9')]==='0'){if(this[_0x7184('0x22')][_0x5bfbae[_0x7184('0xfa')]]){if(!this[_0x7184('0x22')][_0x5bfbae[_0x7184('0xfa')]]['locked']){this['agents'][_0x5bfbae[_0x7184('0xfa')]][_0x7184('0xf8')]=!![];this['actions'][_0x5bfbae['actionid']][_0x7184('0xf8')]=!![];this['actions'][_0x5bfbae[_0x7184('0xf3')]]['stateinterface']=_0x5bfbae['stateinterface'];}}}}else if(_0x4b1ad9===_0x7184('0xf5')){if(this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]]){if(this['agents'][_0x5bfbae[_0x7184('0xfa')]]){this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]][_0x7184('0xfa')]=_0x5bfbae[_0x7184('0xfa')];if(_[_0x7184('0xf7')](this[_0x7184('0x29')][this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]]['queue']])){this['queueBooked'][this[_0x7184('0xf0')][_0x5bfbae['actionid']][_0x7184('0xbe')]]=[];}this[_0x7184('0x29')][this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]]['queue']][_0x7184('0x95')](_[_0x7184('0x59')](_[_0x7184('0x6f')](this[_0x7184('0xf0')][_0x5bfbae['actionid']],[_0x7184('0xfb'),'stateinterface']),{'status':_0x5bfbae[_0x7184('0x80')],'paused':_0x5bfbae[_0x7184('0xf9')]}));}}}};Dialer[_0x7184('0x1c')][_0x7184('0xfc')]=function(_0x3abbcd){if(!this['actions'][_0x3abbcd['actionid']]){return;}var _0x54f9f3=this;var _0x50e20b=this[_0x7184('0x20')][this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]];var _0x252d2b=_0x50e20b['strategy']||_0x7184('0xf5');if(_0x252d2b===_0x7184('0xf6')){if(this[_0x7184('0xf0')][_0x3abbcd['actionid']]&&this['actions'][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xfa')]){this[_0x7184('0xfd')][_0x7184('0xfe')](this['actions'][_0x3abbcd['actionid']][_0x7184('0xfb')],this['actions'][_0x3abbcd['actionid']][_0x7184('0xfa')])[_0x7184('0x9c')](function(_0x57193e){logger[_0x7184('0x60')](_0x7184('0xff'),util['inspect'](_0x57193e,{'showHidden':![],'depth':null}));})['finally'](function(){utils[_0x7184('0xbd')](_0x54f9f3[_0x7184('0x20')][_0x54f9f3['actions'][_0x3abbcd[_0x7184('0xf3')]]['queue']],_0x7184('0x100'));_0x54f9f3['agents'][_0x54f9f3[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]]['stateinterface']][_0x7184('0xf8')]=![];delete _0x54f9f3[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]];unlockQueueStatus(_0x50e20b);});}else{utils[_0x7184('0xbd')](this['voiceQueues'][this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]],_0x7184('0x100'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xe0')],'ListId':this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xe1')],'VoiceQueueId':this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x7184('0xf0')][_0x3abbcd['actionid']];unlockQueueStatus(_0x50e20b);}}else if(_0x252d2b===_0x7184('0xf5')){var _0x292994;if(this['actions'][_0x3abbcd[_0x7184('0xf3')]]&&!_[_0x7184('0x41')](this[_0x7184('0x29')][this[_0x7184('0xf0')][_0x3abbcd['actionid']][_0x7184('0xbe')]])){if(this[_0x7184('0x101')][_0x54f9f3[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]]){this[_0x7184('0x101')][_0x54f9f3[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]]=this[_0x7184('0x101')][this[_0x7184('0xf0')][_0x3abbcd['actionid']][_0x7184('0xbe')]]?this[_0x7184('0x101')][this['actions'][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]]:this[_0x7184('0x29')][this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]]?this[_0x7184('0x29')][this['actions'][_0x3abbcd['actionid']]['queue']]['_rr']||0x0:0x0;}this[_0x7184('0x29')][this['actions'][_0x3abbcd[_0x7184('0xf3')]]['queue']][_0x7184('0x102')]=this[_0x7184('0x101')][this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]];for(var _0x20e3af=0x0;_0x20e3af=_0x2401d9['dialGlobalMaxRetry']){_0xdcc304[_0x7184('0x127')](_0x446b8a,_0x517953,_0x4fa899,'reason19\x20machine....');}else{if(_0x446b8a[_0x7184('0x122')]>=_0x2401d9[_0x7184('0x128')]){_0xdcc304[_0x7184('0x129')](_0x446b8a,_0x517953,_0x4fa899,_0x7184('0x12a'));}else{hopperUtils[_0x7184('0xec')]({'active':![],'countmachineretry':_0x446b8a['countmachineretry'],'scheduledat':moment()[_0x7184('0x12b')](_0x2401d9[_0x7184('0x12c')],_0x7184('0xdf'))[_0x7184('0x76')](_0x7184('0xc2')),'ContactId':_0x446b8a['ContactId'],'ListId':_0x446b8a['ListId'],'VoiceQueueId':_0x446b8a[_0x7184('0xe2')]||undefined,'CampaignId':_0x446b8a[_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch('[rescheduleContact][Machine]'));_0x517953({'reschedule':0x1});}}});}if(_0x33d973[_0x7184('0xbc')]===_0x7184('0xcb')&&this[_0x7184('0x21')][_0x33d973['queue']][_0x7184('0x113')]&&_0x12382d[_0x7184('0x114')]==='HANGUP'){delete this[_0x7184('0xbb')][_0x12382d[_0x7184('0xc0')]];utils['decrementOriginate'](this[_0x7184('0x21')][_0x33d973[_0x7184('0xbe')]],_0x7184('0x116'));_0x2c9e1a=new Hangup(_0x33d973,_0x12382d);_0x2c9e1a[_0x7184('0x68')]=0x12;_0x2c9e1a[_0x7184('0x69')]='HangupInAMD';_0x2c9e1a[_0x7184('0x11a')]=_0x7184('0x11b');ami['emit']('custom:amd',ut[_0x7184('0x11d')](_0x2c9e1a,'amd'));this[_0x7184('0x12d')](_0x2c9e1a,_0x7184('0x12e'),_0x7184('0x12f'));}if(_0x33d973[_0x7184('0xbc')]===_0x7184('0xcb')&&this[_0x7184('0x21')][_0x33d973[_0x7184('0xbe')]][_0x7184('0x113')]&&_0x12382d[_0x7184('0x114')]===_0x7184('0x120')){return new Promise(function(_0x40e26c,_0x4ae597){delete _0xdcc304[_0x7184('0xbb')][_0x12382d[_0x7184('0xc0')]];utils[_0x7184('0xbd')](_0xdcc304[_0x7184('0x21')][_0x33d973[_0x7184('0xbe')]],_0x7184('0x116'));_0xdcc304[_0x7184('0x21')][_0x33d973[_0x7184('0xbe')]][_0x7184('0x117')]+=0x1;_0xdcc304[_0x7184('0x21')][_0x33d973['queue']][_0x7184('0x118')]+=0x1;var _0xf88953=_0xdcc304[_0x7184('0x21')][_0x33d973['queue']];var _0x1cb92e=new Hangup(_0x33d973,_0x12382d);_0x1cb92e[_0x7184('0x68')]=0x13;_0x1cb92e['statedesc']=_0x7184('0x121');_0x1cb92e[_0x7184('0x11a')]=_0x7184('0x11b');_0x1cb92e[_0x7184('0x122')]+=0x1;_0x1cb92e[_0x7184('0xd6')]+=0x1;_0x1cb92e[_0x7184('0x11e')]=!![];ami[_0x7184('0x3b')](_0x7184('0x11c'),ut[_0x7184('0x11d')](_0x1cb92e,_0x7184('0x11e')));hopperUtils[_0x7184('0xc7')](_0x1cb92e)[_0x7184('0x9c')](loggerCatch(_0x7184('0x130')));if(_0x1cb92e[_0x7184('0x123')]+_0x1cb92e[_0x7184('0x124')]+_0x1cb92e[_0x7184('0x125')]+_0x1cb92e[_0x7184('0x131')]+_0x1cb92e[_0x7184('0xdb')]+_0x1cb92e[_0x7184('0xeb')]+_0x1cb92e[_0x7184('0x122')]+_0x1cb92e[_0x7184('0x126')]>=_0xf88953['dialGlobalMaxRetry']){_0xdcc304['stateGlobal'](_0x1cb92e,_0x40e26c,_0x4ae597,_0x7184('0x132'));}else{if(_0x1cb92e['countmachineretry']>=_0xf88953[_0x7184('0x128')]){_0xdcc304[_0x7184('0x129')](_0x1cb92e,_0x40e26c,_0x4ae597,_0x7184('0x12a'));}else{hopperUtils[_0x7184('0xec')]({'active':![],'countmachineretry':_0x1cb92e['countmachineretry'],'scheduledat':moment()[_0x7184('0x12b')](_0xf88953[_0x7184('0x12c')],'minutes')[_0x7184('0x76')](_0x7184('0xc2')),'ContactId':_0x1cb92e['ContactId'],'ListId':_0x1cb92e['ListId'],'VoiceQueueId':_0x1cb92e[_0x7184('0xe2')]||undefined,'CampaignId':_0x1cb92e['CampaignId']||undefined})[_0x7184('0x9c')](loggerCatch('[rescheduleContact][Machine]'));_0x40e26c({'reschedule':0x1});}}});}}};Dialer[_0x7184('0x1c')][_0x7184('0x33')]=function(_0x2bcfb4){var _0x5b5938=this['uniqueId'][_0x2bcfb4[_0x7184('0xc0')]];var _0x3c90cc;if(!_0x5b5938){return;}if(_0x5b5938[_0x7184('0xbc')]===_0x7184('0xcb')){delete this[_0x7184('0xbb')][_0x2bcfb4[_0x7184('0xc0')]];utils['decrementOriginate'](this[_0x7184('0x21')][_0x5b5938['queue']],_0x7184('0x133'));this['campaigns'][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x134')]+=0x1;if(_0x2bcfb4[_0x7184('0x135')]==='Normal\x20Clearing'){const _0x5ca507=new AgentComplete(_0x5b5938,_0x2bcfb4);_0x5ca507[_0x7184('0xe3')]=this[_0x7184('0x21')][_0x5b5938['queue']]['id'];hopperUtils[_0x7184('0xc7')](_0x5ca507)[_0x7184('0x9c')](loggerCatch('[syncAgentCompleteIvr][createHistory]'));hopperUtils[_0x7184('0xc9')](_0x5ca507)[_0x7184('0x9c')](loggerCatch(_0x7184('0x136')));}else{_0x3c90cc=new Hangup(_0x5b5938,_0x2bcfb4);hopperUtils[_0x7184('0xc7')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7184('0xc9')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch(_0x7184('0x137')));}}else{if(isNotNull(this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x138')])){delete this[_0x7184('0xbb')][_0x2bcfb4[_0x7184('0xc0')]];utils[_0x7184('0xbd')](this[_0x7184('0x20')][_0x5b5938['queue']],_0x7184('0x133'));this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x117')]+=0x1;this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x118')]+=0x1;_0x3c90cc=new Hangup(_0x5b5938,_0x2bcfb4);_0x3c90cc[_0x7184('0x68')]=0x10;_0x3c90cc[_0x7184('0x69')]='AnswerAGI';_0x3c90cc[_0x7184('0x11a')]=_0x7184('0x139');hopperUtils[_0x7184('0xc7')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch(_0x7184('0x13a')));hopperUtils[_0x7184('0xc9')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch(_0x7184('0x137')));}else{delete this['uniqueId'][_0x2bcfb4[_0x7184('0xc0')]];utils[_0x7184('0xbd')](this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]],_0x7184('0x13b'));if(_0x2bcfb4['cause-txt']===_0x7184('0x13c')){this[_0x7184('0x20')][_0x5b5938['queue']][_0x7184('0x117')]+=0x1;const _0x43be6c=new AgentComplete(_0x5b5938,_0x2bcfb4);_0x43be6c[_0x7184('0xe2')]=this['voiceQueues'][_0x5b5938['queue']]['id'];hopperUtils[_0x7184('0xc7')](_0x43be6c)['catch'](loggerCatch(_0x7184('0xc8')));hopperUtils['moveContactManagedDialer'](_0x43be6c)['catch'](loggerCatch(_0x7184('0xca')));}else{this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x13d')]+=0x1;_0x3c90cc=new Hangup(_0x5b5938,_0x2bcfb4);_0x3c90cc['state']=0xc;_0x3c90cc['statedesc']=_0x2bcfb4[_0x7184('0x135')];_0x3c90cc[_0x7184('0x11a')]='Unknown';hopperUtils[_0x7184('0xc7')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch(_0x7184('0x13e')));hopperUtils[_0x7184('0xc9')](_0x3c90cc)['catch'](loggerCatch(_0x7184('0x133')));}}}};Dialer[_0x7184('0x1c')][_0x7184('0x9')]=function(_0x5e5076){var _0xa7e220=this;if(!_0xa7e220[_0x7184('0x13f')][_0x5e5076[_0x7184('0x3f')]]){_0xa7e220[_0x7184('0x13f')][_0x5e5076[_0x7184('0x3f')]]={'running':![]};}else if(_0xa7e220['queuesSummary'][_0x5e5076[_0x7184('0x3f')]]['running']===!![]){return;}else if(_0xa7e220['queuesSummary'][_0x5e5076[_0x7184('0x3f')]][_0x7184('0x140')]===![]){_0xa7e220[_0x7184('0x13f')][_0x5e5076[_0x7184('0x3f')]][_0x7184('0x140')]=!![];}var _0x5979c2=_0xa7e220['voiceQueues'][_0x5e5076[_0x7184('0x3f')]];var _0x4c5dc5=_0x5979c2[_0x7184('0x62')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x28f05d=utils[_0x7184('0x141')](_0x5979c2);_0x5979c2['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x5979c2,_0xa7e220['trunks']);Promise[_0x7184('0xa6')]()[_0x7184('0x39')](function(){if(_0x5979c2[_0x7184('0x142')]===utils[_0x7184('0x63')][_0x7184('0x74')]){if(_0x4c5dc5){clearPredictiveAttributes(_0x5979c2);_0x5e5076[_0x7184('0x5c')]=undefined;_0x5e5076['startProgressive']=undefined;}if(_0x5979c2['statusMessage']===utils[_0x7184('0x63')][_0x7184('0x74')]){_0x5e5076['available']=0x0;_0x5e5076[_0x7184('0xf9')]=0x0;_0x5e5076[_0x7184('0x143')]=0x0;_0x5e5076['talking']=0x0;_0x5e5076['pTalking']=0x0;}}else if(_0x5979c2[_0x7184('0x142')]===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x28f05d){return _0xa7e220['ifTime'](_0x5979c2,!![])['then'](function(){return _0xa7e220['ifTime'](_0x5979c2,![]);})[_0x7184('0x39')](function(){return _0xa7e220[_0x7184('0xaa')](_0x5979c2);})['catch'](function(_0xd97538){loggerSyncQueueSummary['debug'](_0x7184('0x144'),util[_0x7184('0x3d')](_0xd97538,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5979c2);});}else{clearPredictiveAttributes(_0x5979c2);}})[_0x7184('0x39')](function(){var _0x43fccb=_0x5e5076[_0x7184('0x145')](_0x5979c2);if(_0x43fccb||_0x5979c2[_0x7184('0x146')]){_0x5979c2[_0x7184('0x146')]=![];_0x5e5076[_0x7184('0x147')](_0x5979c2);Object[_0x7184('0x148')](_0x5979c2,_0x5e5076);emitOutboundVoiceQueueSummary(_0x5e5076);}_0xa7e220[_0x7184('0x13f')][_0x5979c2[_0x7184('0x3f')]]['running']=![];})['catch'](function(_0x24f28f){logger[_0x7184('0x60')](_0x7184('0x144'),util[_0x7184('0x3d')](_0x24f28f,{'showHidden':![],'depth':null}));_0xa7e220[_0x7184('0x13f')][_0x5979c2[_0x7184('0x3f')]][_0x7184('0x140')]=![];});};Dialer[_0x7184('0x1c')][_0x7184('0x31')]=_[_0x7184('0x149')](function(){var _0x2f1f7e=_[_0x7184('0x14a')](this['voiceQueues'],function(_0x5abe08){return _0x5abe08[_0x7184('0x14b')];});var _0x50695d=_[_0x7184('0x14a')](this[_0x7184('0x22')],function(_0x1eb28a){return _0x1eb28a['online']&&_0x1eb28a[_0x7184('0x80')]===_0x7184('0x81');});if(_0x2f1f7e[_0x7184('0x94')]>0x0&&_0x50695d[_0x7184('0x94')]>0x0){return Promise['resolve']()[_0x7184('0x39')](cmHopper[_0x7184('0x14c')](_[_0x7184('0x14d')](_0x2f1f7e,'id'),previewRecallmeReminderInterval,_[_0x7184('0x14d')](_0x50695d,'id')))[_0x7184('0x39')](function(_0x2606be){for(var _0x5cbed9=0x0;_0x5cbed9<_0x2606be[_0x7184('0x94')];_0x5cbed9++){var _0x2edb80=_0x2606be[_0x5cbed9]['Agent'][_0x7184('0x3f')];if(_0x2edb80)io['to'](util['format'](_0x7184('0x14e'),_0x2edb80))['emit'](_0x7184('0x14f'),{'hopper':_0x2606be[_0x5cbed9]});}})[_0x7184('0x9c')](function(_0x410fe6){logger[_0x7184('0x60')](_0x7184('0x150'),_0x410fe6);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7184('0x1c')][_0x7184('0x38')]=function(){var _0x4dd117=this;setInterval(function(){_0x4dd117[_0x7184('0x151')](_0x4dd117[_0x7184('0xbb')],'[uniqueid]');_0x4dd117['clearZombieChannels'](_0x4dd117['actions'],_0x7184('0x152'));},0x32c8);};Dialer[_0x7184('0x1c')][_0x7184('0x151')]=function(_0x1b0380,_0x24371d){var _0xd50c06=this;for(var _0x1d838f in _0x1b0380){if(typeof _0x1b0380[_0x1d838f]!=='undefined'){this[_0x7184('0x1f')][_0x7184('0x1d')](function(){if(!_[_0x7184('0xf7')](_0x1b0380[_0x1d838f])){return ami[_0x7184('0x96')]({'action':_0x7184('0x80'),'channel':_0x1b0380[_0x1d838f][_0x7184('0xf1')]})[_0x7184('0x9c')](function(_0x179b02){if(_0x179b02['message']===_0x7184('0x153')){setTimeout(function(){if(_0x1b0380[_0x1d838f]&&_0x1b0380[_0x1d838f][_0x7184('0xbc')]!==_0x7184('0xcb')){utils[_0x7184('0xbd')](_0xd50c06[_0x7184('0x20')][_0x1b0380[_0x1d838f]['queue']],_0x7184('0x154'));logger['error'](_0x7184('0x155'),_0x24371d,_0x1d838f,_0x1b0380[_0x1d838f][_0x7184('0xbe')]);delete _0x1b0380[_0x1d838f];}if(_0x1b0380[_0x1d838f]&&_0x1b0380[_0x1d838f]['type']===_0x7184('0xcb')){utils[_0x7184('0xbd')](_0xd50c06[_0x7184('0x21')][_0x1b0380[_0x1d838f]['queue']],_0x7184('0x154'));logger['error']('[Dialer][checkChannel][ivr]',_0x24371d,_0x1d838f,_0x1b0380[_0x1d838f][_0x7184('0xbe')]);delete _0x1b0380[_0x1d838f];}},0x2328);}});}});}}};Dialer['prototype'][_0x7184('0x156')]=function(_0x1ea144){return Promise[_0x7184('0xa6')]()[_0x7184('0x39')](voiceQueueRt[_0x7184('0x156')](_0x1ea144))[_0x7184('0x9c')](loggerCatch(_0x7184('0x157')));};Dialer['prototype'][_0x7184('0x158')]=function(_0x171c68,_0x39b19e,_0x205b27){var _0x38832d={'state':0x19,'statedesc':'notFound'};utils['decrementOriginate'](_0x39b19e,_0x7184('0x159')+_0x171c68);this['saveInDb'](_[_0x7184('0x59')](_0x38832d,_[_0x7184('0x6f')](_0x205b27,[_0x7184('0xe0'),_0x7184('0xe1'),_0x7184('0x15a'),'VoiceQueueId',_0x7184('0xe3')])),'[emptyContact][createHistory]',_0x7184('0x159'));logger[_0x7184('0x60')](_0x171c68);};Dialer[_0x7184('0x1c')][_0x7184('0x12d')]=function(_0x5bc374,_0x189d2f,_0x2d1bb2){hopperUtils[_0x7184('0xc7')](_0x5bc374)['catch'](loggerCatch(_0x189d2f));hopperUtils['moveContactManagedDialer'](_0x5bc374)['catch'](loggerCatch(_0x2d1bb2));};Dialer[_0x7184('0x1c')][_0x7184('0xdd')]=function(_0x44e77e,_0x315cb0){hopperUtils['createHistory'](_0x44e77e)['catch'](loggerCatch(_0x7184('0xc8')));if(_0x315cb0==0x0){hopperUtils['moveContactManagedDialer'](_0x44e77e)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0x7184('0x150')]=function(_0x4fd038){return Promise[_0x7184('0xa6')]()[_0x7184('0x39')](cmHopper[_0x7184('0x14c')](_0x4fd038['id'],previewRecallmeReminderInterval))[_0x7184('0x39')](function(_0x1f97db){for(var _0x194e1d=0x0;_0x194e1d<_0x1f97db[_0x7184('0x94')];_0x194e1d++){var _0x3001bd=_0x1f97db[_0x194e1d][_0x7184('0x15b')][_0x7184('0x3f')];if(_0x3001bd)io['to'](util['format']('user:%s',_0x3001bd))['emit'](_0x7184('0x14f'),{'hopper':_0x1f97db[_0x194e1d]});}})[_0x7184('0x9c')](function(){});};Dialer[_0x7184('0x1c')]['launchHandleIvr']=function(_0x17d9d0){var _0x3bf92c=this;return function(){_0x3bf92c['handleIvr'](_0x17d9d0);};};Dialer[_0x7184('0x1c')][_0x7184('0x15c')]=function(_0x628754,_0x1db506){var _0x3d4cd7=this;var _0x2c4ae9=uuid['v4']();this['actions'][_0x2c4ae9]=new Action(_0x628754,_0x1db506,_0x2c4ae9);return new Promise(function(_0x4babcc,_0x200659){if(_[_0x7184('0x3a')](_0x628754)&&typeof _0x628754!==_0x7184('0x15d')){return _0x200659(msgResponse(_0x7184('0x15e'),_0x7184('0x8d'),_0x7184('0x15f')));}if(_[_0x7184('0x3a')](_0x1db506[_0x7184('0x160')])||_0x1db506['phone']===null){return _0x200659(msgResponse('originate',_0x7184('0x8d'),'contact\x20is\x20undefine'));}var _0x40c91e={'XMD-CALLERID':_0x3d4cd7[_0x7184('0xf0')][_0x2c4ae9][_0x7184('0x161')](),'XMD-AGI':_0x628754[_0x7184('0x138')]?util[_0x7184('0x76')](_0x7184('0x162'),ipAgi,_0x628754[_0x7184('0x138')]):_0x7184('0x163'),'XMD-AGIAFTER':_0x628754[_0x7184('0x164')]?util['format'](_0x7184('0x162'),ipAgi,_0x628754[_0x7184('0x164')]):_0x7184('0x163'),'XMD-QUEUE':utils[_0x7184('0x165')](_0x628754)?util[_0x7184('0x76')](_0x7184('0x166'),_0x628754[_0x7184('0x3f')],_0x628754[_0x7184('0x167')]||'',_0x628754[_0x7184('0xc6')]?'c':'',_0x628754[_0x7184('0xd0')]||0x3):_0x7184('0x163'),'XMD-CONTACTID':_0x1db506[_0x7184('0xe0')],'XMD-CDRTYPE':_0x7184('0x6'),'CALLERID(all)':_0x3d4cd7['actions'][_0x2c4ae9][_0x7184('0x161')](),'XMD-AMD':_0x628754[_0x7184('0x113')]?'ACTIVE':_0x7184('0x163'),'XMD-DESTINATION':_0x7184('0x168')};if(_0x628754[_0x7184('0x113')]){_0x40c91e[_0x7184('0x169')]=_0x628754['dialAMDInitialSilence']||0x9c4;_0x40c91e['XMD-AMDGREETING']=_0x628754[_0x7184('0x16a')]||0x5dc;_0x40c91e[_0x7184('0x16b')]=_0x628754[_0x7184('0x16c')]||0x320;_0x40c91e[_0x7184('0x16d')]=_0x628754[_0x7184('0x16e')]||0x1388;_0x40c91e[_0x7184('0x16f')]=_0x628754[_0x7184('0x170')]||0x64;_0x40c91e[_0x7184('0x171')]=_0x628754['dialAMDBetweenWordsSilence']||0x32;_0x40c91e[_0x7184('0x172')]=_0x628754['dialAMDMaximumNumberOfWords']||0x3;_0x40c91e[_0x7184('0x173')]=_0x628754[_0x7184('0x174')]||0x100;_0x40c91e[_0x7184('0x175')]=_0x628754[_0x7184('0x176')]||0x1388;}if(utils['isOutboundQueue'](_0x628754)){_0x40c91e[_0x7184('0x177')]=_0x1db506[_0x7184('0xe2')];}else{_0x40c91e[_0x7184('0x178')]=_0x1db506['CampaignId'];}var _0x13ffd6=utils[_0x7184('0x179')](_0x1db506[_0x7184('0x17a')]);Object['assign'](_0x40c91e,_0x13ffd6);var _0x2f7613=_0x3d4cd7[_0x7184('0x85')](_0x628754[_0x7184('0x86')])?utils[_0x7184('0x17b')](_0x628754[_0x7184('0x86')][_0x7184('0x17c')],_0x628754[_0x7184('0x17d')],_0x628754[_0x7184('0x17e')]>0x0?utils[_0x7184('0x17f')](_0x628754[_0x7184('0x180')],_0x628754['dialRandomLastDigitCallerIdNumber']):_0x628754['dialOriginateCallerIdNumber']):utils[_0x7184('0x17b')](_['isNil'](_0x628754[_0x7184('0x87')])?_0x628754['Trunk'][_0x7184('0x17c')]:_0x628754[_0x7184('0x87')]['callerid'],_0x628754['dialOriginateCallerIdName'],_0x628754[_0x7184('0x17e')]>0x0?utils[_0x7184('0x17f')](_0x628754[_0x7184('0x180')],_0x628754['dialRandomLastDigitCallerIdNumber']):_0x628754[_0x7184('0x180')]);if(_0x2f7613){_0x40c91e[_0x7184('0x181')]=_0x3d4cd7[_0x7184('0xf0')][_0x2c4ae9][_0x7184('0x182')]=utils[_0x7184('0x183')](_0x2f7613);_0x40c91e[_0x7184('0x184')]=_0x1db506[_0x7184('0x160')];}_0x628754[_0x7184('0x185')]=_0x40c91e;return ami['Action']({'actionid':_0x2c4ae9,'action':_0x7184('0x15e'),'channel':_0x3d4cd7[_0x7184('0x85')](_0x628754[_0x7184('0x86')])?util[_0x7184('0x76')](_0x7184('0x186'),_0x628754[_0x7184('0x86')]['name'],isNotNull(_0x628754[_0x7184('0x187')])?_0x628754[_0x7184('0x187')][_0x7184('0x188')]()||'':'',_0x628754[_0x7184('0x189')]>0x0?_0x1db506[_0x7184('0x160')]['substring'](_0x628754[_0x7184('0x189')]):_0x1db506[_0x7184('0x160')]):util[_0x7184('0x76')](_0x7184('0x186'),_[_0x7184('0xf7')](_0x628754[_0x7184('0x87')])?_0x628754[_0x7184('0x86')][_0x7184('0x3f')]:_0x628754['TrunkBackup'][_0x7184('0x3f')],isNotNull(_0x628754['dialPrefix'])?_0x628754[_0x7184('0x187')][_0x7184('0x188')]()||'':'',_0x628754[_0x7184('0x189')]>0x0?_0x1db506[_0x7184('0x160')][_0x7184('0x18a')](_0x628754[_0x7184('0x189')]):_0x1db506[_0x7184('0x160')]),'callerid':_0x2f7613,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x40c91e,'timeout':(_0x628754['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2c4ae9})[_0x7184('0x39')](function(_0x3e3e6c){return _0x4babcc(_0x3e3e6c);})[_0x7184('0x9c')](function(_0xe9b0af){_0x628754[_0x7184('0x18b')]+=0x1;var _0x156aa9=new History(_0x3d4cd7[_0x7184('0xf0')][_0x2c4ae9]);logger[_0x7184('0x60')](util['format'](_0x7184('0x18c'),JSON[_0x7184('0x6e')](_0xe9b0af)));_0x156aa9['state']=0xe;_0x156aa9[_0x7184('0x69')]=_0x7184('0x18d');_0x156aa9[_0x7184('0x6b')]=moment()[_0x7184('0x76')](_0x7184('0xc2'));_0x156aa9[_0x7184('0x6a')]=_0x156aa9[_0x7184('0x6b')];hopperUtils['createHistory'](_0x156aa9)[_0x7184('0x9c')](loggerCatch(_0x7184('0x18e')));_0x3d4cd7[_0x7184('0xc9')](_0x156aa9)[_0x7184('0x9c')](loggerCatch(_0x7184('0x18e')))[_0x7184('0x107')](function(){delete _0x3d4cd7[_0x7184('0xf0')][_0x2c4ae9];return _0x200659(msgResponse('originate','Error',_0x7184('0x18f')));});});});};Dialer[_0x7184('0x1c')][_0x7184('0x190')]=function(_0x12eb71,_0x2a1175,_0xcf3ce){var _0x1c1a56=new History(_0x2a1175);if(_0x1c1a56[_0x7184('0x123')]+_0x1c1a56[_0x7184('0x124')]+_0x1c1a56[_0x7184('0x125')]+_0x1c1a56['countnosuchnumberretry']+_0x1c1a56['countdropretry']+_0x1c1a56[_0x7184('0xeb')]+_0x1c1a56[_0x7184('0x122')]+_0x1c1a56[_0x7184('0x126')]>=_0xcf3ce[_0x7184('0x191')]-0x1){return!![];}switch(_0x12eb71){case 0x3:if(_0x1c1a56[_0x7184('0x125')]>=_0xcf3ce[_0x7184('0x192')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1c1a56[_0x7184('0x125')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce['dialNoAnswerRetryFrequency'],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c1a56['ContactId'],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})['catch'](loggerCatch(_0x7184('0x193')));break;case 0x5:if(_0x1c1a56['countbusyretry']>=_0xcf3ce[_0x7184('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x1c1a56[_0x7184('0x123')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0x195')],'minutes')['format'](_0x7184('0xc2')),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})['catch'](loggerCatch(_0x7184('0x196')));break;case 0x8:if(_0x1c1a56[_0x7184('0x124')]>=_0xcf3ce[_0x7184('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1c1a56[_0x7184('0x124')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce['dialCongestionRetryFrequency'],_0x7184('0xdf'))[_0x7184('0x76')](_0x7184('0xc2')),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56['ListId'],'VoiceQueueId':_0x1c1a56['VoiceQueueId']||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0x198')));break;case 0x0:if(_0x1c1a56[_0x7184('0x131')]>=_0xcf3ce[_0x7184('0x199')]-0x1){return!![];}else{hopperUtils[_0x7184('0xec')]({'active':![],'countnosuchnumberretry':_0x1c1a56[_0x7184('0x131')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0x19a')],_0x7184('0xdf'))['format'](_0x7184('0xc2')),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56['VoiceQueueId']||undefined,'CampaignId':_0x1c1a56['CampaignId']||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0x19b')));}break;case 0xa:if(_0x1c1a56[_0x7184('0xdb')]>=_0xcf3ce['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x7184('0xec')]({'active':![],'countdropretry':_0x1c1a56['countdropretry']+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce['dialDropRetryFrequency'],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56['ListId'],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56['CampaignId']||undefined})['catch'](loggerCatch(_0x7184('0xe4')));break;case 0xb:if(_0x1c1a56[_0x7184('0xeb')]>=_0xcf3ce[_0x7184('0x19c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1c1a56[_0x7184('0xeb')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0xed')],_0x7184('0xdf'))[_0x7184('0x76')](_0x7184('0xc2')),'ContactId':_0x1c1a56['ContactId'],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x1c1a56[_0x7184('0x122')]>=_0xcf3ce[_0x7184('0x128')]-0x1){return!![];}hopperUtils[_0x7184('0xec')]({'active':![],'countmachineretry':_0x1c1a56[_0x7184('0x122')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0x12c')],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56['VoiceQueueId']||undefined,'CampaignId':_0x1c1a56['CampaignId']||undefined})['catch'](loggerCatch(_0x7184('0x19d')));break;case 0x14:if(_0x1c1a56[_0x7184('0x126')]>=_0xcf3ce[_0x7184('0x19e')]-0x1){return!![];}hopperUtils[_0x7184('0xec')]({'active':![],'countagentrejectretry':_0x1c1a56[_0x7184('0x126')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0x19f')],_0x7184('0xdf'))['format'](_0x7184('0xc2')),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})['catch'](loggerCatch(_0x7184('0x1a0')));break;default:return!![];}};Dialer[_0x7184('0x1c')]['callProgressDetecting']=function(_0x45c99d,_0x2cfcc7,_0x3df6d5){var _0x473a48=this;var _0x4cf2af=new History(_0x45c99d);var _0x3f8ea9=![];var _0x53eb79;var _0x2783b0;return new Promise(function(_0x1ec0d0,_0x47bb83){if(_[_0x7184('0x3a')](_0x2cfcc7)&&typeof _0x2cfcc7!==_0x7184('0x15d')){return _0x47bb83(msgResponse(_0x7184('0x1a1'),'Failure','entity\x20is\x20undefine'));}if(_[_0x7184('0x3a')](_0x3df6d5)&&typeof _0x3df6d5!==_0x7184('0x15d')){return _0x47bb83(msgResponse('[callProgressDetecting]',_0x7184('0x8d'),_0x7184('0x1a2')));}hopperUtils[_0x7184('0xd8')](_0x4cf2af,_0x3df6d5[_0x7184('0xc3')],_0x2cfcc7)['then'](function(_0x253ba4){if(_0x253ba4['additional']==0x1)_0x3f8ea9=!![];switch(_0x3df6d5[_0x7184('0xc3')]){case'0':_0x2cfcc7[_0x7184('0x1a3')]+=0x1;_0x4cf2af[_0x7184('0x68')]=0x0;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1a4');_0x4cf2af[_0x7184('0x131')]+=0x1;_0x4cf2af[_0x7184('0xd6')]+=0x1;ami[_0x7184('0x3b')](_0x7184('0x1a5'),ut[_0x7184('0x11d')](_0x45c99d,_0x7184('0x1a6')));_0x53eb79=_0x2cfcc7['dialNoSuchNumberRetryFrequency'];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils[_0x7184('0xc7')](_0x4cf2af)[_0x7184('0x9c')](loggerCatch(_0x7184('0x130')));if(_0x473a48['checkRetriveMax'](0x0,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x131')]>=_0x2cfcc7['dialNoSuchNumberMaxRetry']){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1a7'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1a7'));}}break;case'3':_0x2cfcc7['outboundNoAnswerCallsDay']+=0x1;_0x4cf2af[_0x7184('0x68')]=0x3;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1a8');_0x4cf2af[_0x7184('0x125')]+=0x1;_0x4cf2af[_0x7184('0xd6')]+=0x1;var _0x5d916e=ut[_0x7184('0x1a9')](_0x45c99d,_0x2cfcc7);ami[_0x7184('0x3b')](_0x7184('0x1aa'),_0x5d916e);_0x53eb79=_0x2cfcc7['dialNoAnswerRetryFrequency'];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils['createHistory'](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x473a48['checkRetriveMax'](0x3,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af['countnoanswerretry']>=_0x2cfcc7[_0x7184('0x192')]){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1ab'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1ab'));}}break;case'5':_0x2cfcc7[_0x7184('0x1ac')]+=0x1;_0x4cf2af['state']=0x5;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1ad');_0x4cf2af[_0x7184('0x123')]+=0x1;_0x4cf2af[_0x7184('0xd6')]+=0x1;ami[_0x7184('0x3b')](_0x7184('0x1ae'),ut[_0x7184('0x11d')](_0x45c99d,_0x7184('0x1af')));_0x53eb79=_0x2cfcc7['dialBusyRetryFrequency'];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils['createHistory'](_0x4cf2af)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x473a48[_0x7184('0x190')](0x5,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x123')]>=_0x2cfcc7[_0x7184('0x194')]){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1b0'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,'reason\x205\x20busy');}}break;case'8':_0x2cfcc7[_0x7184('0x1b1')]+=0x1;_0x4cf2af['state']=0x8;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1b2');_0x4cf2af[_0x7184('0x124')]+=0x1;_0x4cf2af[_0x7184('0xd6')]+=0x1;_0x53eb79=_0x2cfcc7[_0x7184('0x1b3')];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];ami[_0x7184('0x3b')]('custom:agentcongestion',ut['buildObj'](_0x45c99d,'congestion'));hopperUtils[_0x7184('0xc7')](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x473a48[_0x7184('0x190')](0x8,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x124')]>=_0x2cfcc7['dialCongestionMaxRetry']){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1b4'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1b4'));}}break;case'11':_0x2cfcc7[_0x7184('0x1b5')]+=0x1;_0x4cf2af[_0x7184('0x68')]=0xb;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1b6');_0x4cf2af['countabandonedretry']+=0x1;_0x4cf2af['countglobal']+=0x1;_0x53eb79=_0x2cfcc7['dialAbandonedRetryFrequency'];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils[_0x7184('0xc7')](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x473a48[_0x7184('0x190')](0xb,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0xeb')]>=_0x2cfcc7[_0x7184('0x19c')]){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1b7'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,'reason\x2011\x20abandoned');}}break;case'20':_0x2cfcc7[_0x7184('0x1b8')]+=0x1;_0x4cf2af[_0x7184('0x68')]=0x14;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1b9');_0x4cf2af[_0x7184('0x126')]+=0x1;_0x4cf2af['countglobal']+=0x1;_0x53eb79=_0x2cfcc7[_0x7184('0x19f')];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];ami[_0x7184('0x3b')](_0x7184('0x1ba'),ut['buildObj'](_0x45c99d,'agentreject'));hopperUtils['createHistory'](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x473a48[_0x7184('0x190')](0x14,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x126')]>=_0x2cfcc7[_0x7184('0x19e')]){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1bb'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1bb'));}}break;default:_0x2cfcc7['outboundUnknownCallsDay']+=0x1;_0x4cf2af[_0x7184('0x68')]=0xc;_0x4cf2af[_0x7184('0x69')]=_0x3df6d5[_0x7184('0xc3')];_0x53eb79=_0x2cfcc7[_0x7184('0x19f')];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils['createHistory'](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x473a48[_0x7184('0x190')](_0x3df6d5[_0x7184('0xc3')],_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x123')]+_0x4cf2af[_0x7184('0x124')]+_0x4cf2af['countnoanswerretry']+_0x4cf2af[_0x7184('0x131')]+_0x4cf2af[_0x7184('0xdb')]+_0x4cf2af[_0x7184('0xeb')]+_0x4cf2af[_0x7184('0x122')]+_0x4cf2af[_0x7184('0x126')]>=_0x2cfcc7[_0x7184('0x191')]){_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x3df6d5['reason']);}else{_0x473a48['createStateFinal'](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x3df6d5['reason']);}}}})[_0x7184('0x39')](function(){if(_0x3f8ea9){hopperUtils[_0x7184('0xe8')](_0x4cf2af,_0x53eb79,_0x2783b0)[_0x7184('0x39')](function(){return _0x1ec0d0(0x1);});}});});};Dialer[_0x7184('0x1c')][_0x7184('0x127')]=function(_0x1566a9,_0x57e3ae,_0x5538f7,_0x257b36){var _0x1addc1=new Final(_0x1566a9);_0x1addc1[_0x7184('0x68')]=0xf;_0x1addc1[_0x7184('0x69')]=_0x7184('0x1bc');this[_0x7184('0x129')](_0x1addc1,_0x57e3ae,_0x5538f7,_0x257b36);};Dialer[_0x7184('0x1c')][_0x7184('0x129')]=function(_0x2f6641,_0x5a9921,_0x375542,_0x1996ba){hopperUtils[_0x7184('0xc9')](_0x2f6641)[_0x7184('0x39')](function(){return _0x5a9921(msgResponse(_0x7184('0x1a1'),'Success',_0x1996ba));})['catch'](function(){return _0x375542(msgResponse(_0x7184('0x1bd'),_0x7184('0x8d'),_0x7184('0x1be')));});};Dialer[_0x7184('0x1c')][_0x7184('0x8')]=function(_0x19fc56){var _0x4ccc75=_0x19fc56[_0x7184('0x1bf')]/0x64;var _0x4c6951=_0x19fc56[_0x7184('0xd1')]/(_0x19fc56[_0x7184('0xd1')]+_0x19fc56['outboundAnswerCallsDay']);var _0x15ad03=Math[_0x7184('0x1c0')](_0x19fc56['predictiveIntervalAvailable']*(_0x19fc56[_0x7184('0x1c1')]/0x64));var _0x81d954=Math['round'](_0x19fc56[_0x7184('0x1c2')]*(_0x19fc56[_0x7184('0x1c3')]/0x64));var _0x240217=_0x19fc56['available']+_0x19fc56[_0x7184('0x1c4')];var _0x322ec8=Math[_0x7184('0x1c5')](_0x19fc56[_0x7184('0x52')]*_0x19fc56['erlangAbandonmentRate']*_0x19fc56['predictiveIntervalHitRate']*_0x19fc56[_0x7184('0x1c6')]);if(_['isUndefined'](_0x19fc56[_0x7184('0x27')])){if(!_[_0x7184('0x3a')](_0x19fc56['startPredictive'])){_0x19fc56[_0x7184('0x5c')]=undefined;loggerPredictive[_0x7184('0x60')](_0x7184('0x1c7'),_0x7184('0x1c8'));}if(!_[_0x7184('0x3a')](_0x19fc56[_0x7184('0x5e')])){loggerPredictive['error'](_0x7184('0x1c7'),_0x7184('0x1c9'));clearInterval(_0x19fc56[_0x7184('0x5e')]);_0x19fc56[_0x7184('0x5e')]=undefined;}_0x19fc56['startProgressive']=moment()[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1ca'),_0x19fc56['startProgressive']);this[_0x7184('0xae')](_0x19fc56,0x1);}else if(ifInterval(_0x19fc56[_0x7184('0x1cb')],_0x19fc56['startProgressive'])){this[_0x7184('0xae')](_0x19fc56,0x1);loggerPredictiveCalls[_0x7184('0x42')](_0x7184('0x1cc'),_0x19fc56['startProgressive'],_0x19fc56[_0x7184('0x3f')]);_0x19fc56['erlangCalls']=0x0;_0x19fc56[_0x7184('0xd2')]=0x0;}else if(_0x4ccc75<_0x4c6951&&_0x19fc56[_0x7184('0x1cd')]===_0x7184('0x1ce')){clearPredictiveAttributes(_0x19fc56);loggerPredictive[_0x7184('0x42')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7184('0x1cf'),_0x4c6951,'startProgressive',_0x19fc56[_0x7184('0x3f')]);}else if(_0x322ec8<_0x19fc56[_0x7184('0xd2')]&&_0x19fc56[_0x7184('0x1cd')]===_0x7184('0x1ce')){clearPredictiveAttributes(_0x19fc56);loggerPredictive[_0x7184('0x42')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x7184('0x1d0'),_0x322ec8,_0x7184('0x1d1'),_0x19fc56[_0x7184('0xd2')],'startProgressive',_0x19fc56[_0x7184('0x3f')]);}else if(!ifInterval(_0x19fc56['dialPredictiveInterval'],_0x19fc56[_0x7184('0x27')])&&_[_0x7184('0x3a')](_0x19fc56['startPredictive'])&&!_['isUndefined'](_0x19fc56[_0x7184('0x27')])){_0x19fc56[_0x7184('0x5c')]=moment()['format'](_0x7184('0xc2'));loggerPredictive[_0x7184('0x42')](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1d2'),_0x19fc56[_0x7184('0x5c')]);hopperUtils[_0x7184('0x1d3')](_0x19fc56[_0x7184('0x1cb')])['then'](this[_0x7184('0x1d4')](_0x19fc56))['then'](mergeDataErlangB(_0x19fc56))[_0x7184('0x39')](this[_0x7184('0x1d5')](_0x19fc56))[_0x7184('0x9c')](loggerCatchPredictive(_0x7184('0x1d6'),_0x19fc56));}else if(!ifInterval(_0x19fc56['dialPredictiveInterval'],_0x19fc56[_0x7184('0x5c')])){_0x19fc56[_0x7184('0xd2')]=0x0;_0x19fc56['startPredictive']=moment()[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x7184('0x42')](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1d7'),_0x19fc56[_0x7184('0x5c')]);clearInterval(_0x19fc56[_0x7184('0x5e')]);_0x19fc56[_0x7184('0x5e')]=undefined;hopperUtils['avgHandleTime'](_0x19fc56[_0x7184('0x1cb')])[_0x7184('0x39')](this[_0x7184('0x1d4')](_0x19fc56))['then'](mergeDataErlangB(_0x19fc56))[_0x7184('0x39')](this[_0x7184('0x1d5')](_0x19fc56))[_0x7184('0x9c')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x19fc56));}else if(_0x19fc56['predictiveIntervalAvailable']&&_0x240217<_0x19fc56[_0x7184('0x1c2')]-_0x81d954){clearPredictiveAttributes(_0x19fc56);loggerPredictive[_0x7184('0x42')](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1d8'),_0x240217,')\x20are\x20less\x20than\x20threshold\x20(',_0x19fc56['predictiveIntervalAvailable'],'-',_0x81d954,'=',_0x19fc56['predictiveIntervalAvailable']-_0x81d954,')');}else if(_0x19fc56[_0x7184('0x1c2')]&&_0x240217>_0x19fc56[_0x7184('0x1c2')]+_0x15ad03){clearPredictiveAttributes(_0x19fc56);loggerPredictive[_0x7184('0x42')](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1d8'),_0x240217,_0x7184('0x1d9'),_0x19fc56[_0x7184('0x1c2')],'+',_0x15ad03,'=',_0x19fc56['predictiveIntervalAvailable']+_0x15ad03,')');}};Dialer[_0x7184('0x1c')][_0x7184('0x1d4')]=function(_0x5146d4){var _0x3de0f5=this;return function(_0x3c39dc){return new Promise(function(_0x10cae8,_0x48c971){_[_0x7184('0x59')](_0x5146d4,_0x3c39dc[0x0]);if(checkGetDataPredictive(_0x3c39dc[0x0])){var _0x5d6320=_0x5146d4[_0x7184('0x1c2')]=_0x5146d4[_0x7184('0x1c4')]+_0x5146d4['available'];var _0x3a3b1f=_0x5146d4[_0x7184('0x1cb')]*0x3c;var _0x5ab1a0=_0x3c39dc[0x0]['predictiveIntervalAvgTalktime']+_0x3c39dc[0x0][_0x7184('0x4a')];var _0xba9311=(_0x3c39dc[0x0]['predictiveIntervalAnsweredCalls']+_0x3c39dc[0x0][_0x7184('0x47')]+_0x3c39dc[0x0][_0x7184('0x48')])/_0x3c39dc[0x0][_0x7184('0x44')];_0x5146d4['predictiveIntervalHitRate']=_0xba9311>0x0?_0xba9311:0x1;switch(_0x5146d4['dialPredictiveOptimization']){case _0x7184('0x1ce'):var _0x247531=_0x5146d4[_0x7184('0x1bf')]/0x64;return _0x3de0f5['abandonmentRate'](_0x5d6320,_0x3a3b1f,_0x5ab1a0,_0xba9311,_0x247531)['then'](function(_0x5b0a46){return _0x10cae8(_0x5b0a46);});case _0x7184('0x1da'):var _0x231c9e=_0x5146d4[_0x7184('0x1bf')]/0x64;return _0x3de0f5[_0x7184('0x1db')](_0x5d6320,_0x3a3b1f,_0x5ab1a0,_0xba9311,_0x231c9e)[_0x7184('0x39')](function(_0x394ef4){return _0x10cae8(_0x394ef4);});default:return _0x48c971(msgResponse(_0x7184('0x1dc'),'Failure',_0x7184('0x1dd')));}}else{return _0x48c971(msgResponse('[getDataPredictive]',_0x7184('0x8d'),_0x7184('0x1de')));}});};};Dialer[_0x7184('0x1c')][_0x7184('0x1df')]=function(_0x2eea75){var _0x3175c4=this;return function(_0x41b02c){return new Promise(function(_0x178935,_0x3db5bc){_[_0x7184('0x59')](_0x2eea75,_0x41b02c[0x0]);if(checkGetDataPredictive(_0x41b02c[0x0])){loggerPredictive[_0x7184('0x42')](JSON[_0x7184('0x6e')](_0x41b02c[0x0]));if(_0x2eea75[_0x7184('0x1cd')]===_0x7184('0x1ce')){return _0x3175c4[_0x7184('0x156')](_0x2eea75['id'])[_0x7184('0x39')](function(_0x14c2b6){var _0x53b5bf=_0x2eea75[_0x7184('0x1e0')]-_0x14c2b6[0x0][_0x7184('0x1e1')];var _0x482d24=_0x2eea75[_0x7184('0x1cb')]*0x3c;var _0x331073=_0x41b02c[0x0][_0x7184('0x4c')]+_0x41b02c[0x0][_0x7184('0x4a')];var _0x5c9d1c=(_0x41b02c[0x0]['predictiveIntervalAnsweredCalls']+_0x41b02c[0x0][_0x7184('0x47')]+_0x41b02c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x41b02c[0x0][_0x7184('0x44')];var _0x51541a=_0x2eea75[_0x7184('0x1bf')]/0x64;_0x2eea75[_0x7184('0x1e2')]=_0x14c2b6[0x0][_0x7184('0x1e1')]||0x0;_0x2eea75['predictiveIntervalHitRate']=_0x5c9d1c>0x0?_0x5c9d1c:0x1;return _0x3175c4[_0x7184('0x1e3')](_0x53b5bf,_0x482d24,_0x331073,_0x5c9d1c,_0x51541a);})[_0x7184('0x39')](function(_0x5a8f78){return _0x178935(_0x5a8f78);})[_0x7184('0x9c')](function(_0x7d8427){return _0x3db5bc(msgResponse(_0x7184('0x1e4'),_0x7184('0x8d'),JSON[_0x7184('0x6e')](_0x7d8427)));});}if(_0x2eea75[_0x7184('0x1cd')]==='agentBusyFactor'){return _0x3175c4[_0x7184('0x156')](_0x2eea75['id'])[_0x7184('0x39')](function(_0x506137){var _0x1d0961=_0x2eea75[_0x7184('0x1e0')]-_0x506137[0x0][_0x7184('0x1e1')];var _0x41fa29=_0x2eea75[_0x7184('0x1cb')]*0x3c;var _0x3ba4f9=_0x41b02c[0x0][_0x7184('0x4c')]+_0x41b02c[0x0][_0x7184('0x4a')];var _0x1adf0e=(_0x41b02c[0x0][_0x7184('0x45')]+_0x41b02c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x41b02c[0x0][_0x7184('0x48')])/_0x41b02c[0x0][_0x7184('0x44')];var _0x45ced2=_0x2eea75[_0x7184('0x1bf')]/0x64;_0x2eea75[_0x7184('0x1e2')]=_0x506137[0x0][_0x7184('0x1e1')]||0x0;_0x2eea75[_0x7184('0x1e5')]=_0x1adf0e>0x0?_0x1adf0e:0x1;return _0x3175c4[_0x7184('0x1db')](_0x1d0961,_0x41fa29,_0x3ba4f9,_0x1adf0e,_0x45ced2);})[_0x7184('0x39')](function(_0x4c0e54){return _0x178935(_0x4c0e54);})[_0x7184('0x9c')](function(_0x2124a9){return _0x3db5bc(msgResponse(_0x7184('0x1e4'),_0x7184('0x8d'),JSON[_0x7184('0x6e')](_0x2124a9)));});}}else{return _0x3db5bc(msgResponse(_0x7184('0x1dc'),'Failure',_0x7184('0x1de')));}});};};Dialer[_0x7184('0x1c')][_0x7184('0x1d5')]=function(_0x9285b){var _0x367d52=this;return function(){var _0x1eaa37=0x0;var _0x13b260=Math['floor'](_0x9285b['erlangCallToSecond']*0x3e8);if(_0x13b260>0x0){_0x13b260=_0x13b260<0x64?0x64:_0x13b260;loggerPredictive[_0x7184('0x42')](_0x9285b[_0x7184('0x3f')],'one\x20call\x20every:',_0x13b260,'milliseconds');_0x9285b['handlePredictive']=setInterval(function(){_0x367d52['handlePredictive'](_0x9285b);loggerPredictiveCalls[_0x7184('0x42')](_0x7184('0x1e6'),_0x1eaa37+=0x1);},_0x13b260);}else{loggerPredictive['info'](_0x9285b[_0x7184('0x3f')],_0x7184('0x1e7'));}};};Dialer['prototype']['checkContactBlack']=function(_0x1971c6,_0x3c41fa){var _0x295fda=this;return function(_0x5d7f49){if(_[_0x7184('0x41')](_0x5d7f49)){if(_['isNil'](_0x3c41fa['UserId'])||!_0x3c41fa[_0x7184('0x1e8')]){if(_0x1971c6['dialMethod']==='booked'){_0x1971c6[_0x7184('0x6d')]=_[_0x7184('0x3a')](_0x1971c6['queueStatusComplete'])?!![]:_0x1971c6[_0x7184('0x6d')];var _0x4505a8=uuid['v4']();_0x295fda['actions'][_0x4505a8]=new Action(_0x1971c6,_0x3c41fa,_0x4505a8);loggerBooked[_0x7184('0x42')](_0x7184('0x1e9'),_0x4505a8,_0x7184('0x1ea'),JSON[_0x7184('0x6e')](_0x1971c6['queueStatusComplete']),_0x7184('0x1eb'),_0x1971c6[_0x7184('0x3f')]);if(_0x1971c6[_0x7184('0x6d')]){_0x1971c6[_0x7184('0x6d')]=![];_0x295fda['queueBooked'][_0x295fda[_0x7184('0xf0')][_0x4505a8][_0x7184('0xbe')]]=[];ami[_0x7184('0x96')]({'actionid':_0x4505a8,'action':_0x7184('0x1ec'),'queue':_0x1971c6[_0x7184('0x3f')]})[_0x7184('0x9c')](function(){utils[_0x7184('0xbd')](_0x1971c6,_0x7184('0x1ed'));hopperUtils[_0x7184('0xec')]({'active':![],'ContactId':_0x295fda[_0x7184('0xf0')][_0x4505a8]['ContactId'],'ListId':_0x295fda[_0x7184('0xf0')][_0x4505a8][_0x7184('0xe1')],'VoiceQueueId':_0x295fda['actions'][_0x4505a8][_0x7184('0xe2')]||undefined,'CampaignId':_0x295fda['actions'][_0x4505a8][_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0x1ee')));delete _0x295fda['actions'][_0x4505a8];});}else{loggerBooked[_0x7184('0x42')]('[booked][checkContactBlack][else]',JSON[_0x7184('0x6e')](_0x1971c6[_0x7184('0x6d')]),_0x7184('0x1eb'),_0x1971c6[_0x7184('0x3f')]);utils[_0x7184('0xbd')](_0x1971c6,_0x7184('0x1ed'));hopperUtils[_0x7184('0xec')]({'active':![],'ContactId':_0x295fda[_0x7184('0xf0')][_0x4505a8][_0x7184('0xe0')],'ListId':_0x295fda['actions'][_0x4505a8][_0x7184('0xe1')],'VoiceQueueId':_0x295fda['actions'][_0x4505a8][_0x7184('0xe2')]||undefined,'CampaignId':_0x295fda[_0x7184('0xf0')][_0x4505a8][_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x295fda['actions'][_0x4505a8];}}else{return _0x295fda[_0x7184('0x15c')](_0x1971c6,_0x3c41fa);}}else{if(utils['getSeconds'](undefined,_0x3c41fa[_0x7184('0x1ef')])<_0x1971c6['dialRecallMeTimeout']*0x3c){if(_0x3c41fa['Agent']&&!_0x3c41fa[_0x7184('0x15b')][_0x7184('0x1f0')]){_0x295fda['preview'][_0x7184('0xfe')](_0x3c41fa['id'])['finally'](function(){utils['decrementOriginate'](_0x1971c6,_0x7184('0x1ed'));});}else{hopperUtils[_0x7184('0x1f1')]({'active':![]},_0x3c41fa['id'],0x1)[_0x7184('0x107')](function(){utils['decrementOriginate'](_0x1971c6,_0x7184('0x1ed'));});}}else{_0x1971c6[_0x7184('0x1f2')]+=0x1;utils[_0x7184('0xbd')](_0x1971c6,_0x7184('0x1ed'));if(_0x1971c6['dialRecallInQueue']){hopperUtils[_0x7184('0xec')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3c41fa['ContactId'],'ListId':_0x3c41fa['ListId'],'VoiceQueueId':_0x3c41fa['VoiceQueueId']||undefined,'CampaignId':_0x3c41fa[_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0x1f3')));hopperUtils[_0x7184('0xc7')](createObjHistory(_0x1971c6,_0x3c41fa,utils['CAMPAIGN_STATUS'][_0x7184('0x1f4')],0x17,_0x7184('0x1f5')))[_0x7184('0x9c')](loggerCatch(_0x7184('0x1f6')));}else{_0x295fda[_0x7184('0x12d')](createObjHistory(_0x1971c6,_0x3c41fa,utils['CAMPAIGN_STATUS'][_0x7184('0x1f7')],0x16,_0x7184('0x1f8')),'[Originate][HistoryRecallClose][historyCatch]',_0x7184('0x1f9'));}}}}else{_0x1971c6[_0x7184('0x1fa')]+=0x1;_0x295fda['saveInDb'](createObjHistory(_0x1971c6,_0x3c41fa,utils[_0x7184('0x63')][_0x7184('0x1fb')],0xd,'Blacklist'),_0x7184('0x1fc'),'[Originate][MoveBlacklist]');throw _0x7184('0x1fd');}};};Dialer[_0x7184('0x1c')][_0x7184('0x1fe')]=function(_0xd833d5){var _0x5817f8=this;var _0x16857e=_0xd833d5['limitCalls']-_0xd833d5[_0x7184('0x79')];emitCampaignSummary(_0xd833d5);if(_0x16857e>0x0&&_0xd833d5[_0x7184('0x1ff')]==0x0){if(_0x16857e>this['maxNumberOriginate']){_0x16857e=this[_0x7184('0x24')];}_0xd833d5[_0x7184('0x1ff')]=0x1;hopperUtils['getContactDialerIvr'](_0xd833d5,_0x16857e)[_0x7184('0x39')](function(_0x1fc218){_0xd833d5[_0x7184('0x1ff')]=0x0;if(_0x1fc218){if(!utils['checkContactEmpty'](_0x1fc218)){_0xd833d5[_0x7184('0x62')]=utils['CAMPAIGN_STATUS'][_0x7184('0x200')];logger[_0x7184('0x42')](_0x7184('0x201')+_0xd833d5[_0x7184('0x3f')]);}else{_0xd833d5['originated']+=_0x1fc218[_0x7184('0x94')];_0xd833d5[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x202')];for(var _0x54285b=0x0;_0x54285b<_0x1fc218[_0x7184('0x94')];_0x54285b+=0x1){_0xd833d5[_0x7184('0x203')]+=0x1;if(_[_0x7184('0xf7')](_0x1fc218[_0x54285b])||_[_0x7184('0xf7')](_0x1fc218[_0x54285b][_0x7184('0x17a')])||_[_0x7184('0xf7')](_0x1fc218[_0x54285b][_0x7184('0x160')])){_0x5817f8[_0x7184('0x158')](_0x7184('0x204'),_0xd833d5,_0x1fc218[_0x54285b]);}else{hopperUtils[_0x7184('0x205')](_[_0x7184('0x6f')](_0x1fc218[_0x54285b],['CampaignId',_0x7184('0x160')]))['then'](_0x5817f8[_0x7184('0x206')](_0xd833d5,_0x1fc218[_0x54285b]))[_0x7184('0x9c')](function(_0x312db5){logger[_0x7184('0x60')]('[actionOriginateIvr]',_0x312db5);utils['decrementOriginate'](_0xd833d5,_0x7184('0x207'));});}}}}})[_0x7184('0x9c')](function(_0x5e562f){_0xd833d5[_0x7184('0x1ff')]=0x0;logger[_0x7184('0x60')](_0x7184('0x208'),_0x5e562f);});}};Dialer['prototype'][_0x7184('0xae')]=function(_0x15ab23,_0x1d9343){var _0x21b7a1=this;var _0x362ed9=[];if(_0x1d9343<0x1||_0x15ab23['dialMethod']===_0x7184('0x7')){_0x1d9343=0x1;}var _0x15c013=Math[_0x7184('0x1c5')](_0x15ab23[_0x7184('0x209')]*_0x1d9343)-_0x15ab23[_0x7184('0x79')];if(_0x15ab23[_0x7184('0x20a')]>0x0){var _0x523c43=_0x15ab23[_0x7184('0x20a')]-_0x15ab23[_0x7184('0x79')]-_0x15ab23['talking']-_0x15ab23[_0x7184('0x20b')];if(_0x15c013>_0x523c43){_0x15c013=_0x523c43;}}if(_0x15c013>0x0&&_0x15ab23[_0x7184('0x1ff')]==0x0){if(_0x15ab23[_0x7184('0xab')]===_0x7184('0x7')){_0x15c013=0x1;}if(_0x15c013>this[_0x7184('0x24')]){_0x15c013=this[_0x7184('0x24')];}for(var _0x1d04fe in this[_0x7184('0x22')]){if(typeof this['agents'][_0x1d04fe]!==_0x7184('0xa4')){if(this[_0x7184('0x22')][_0x1d04fe][_0x7184('0x68')]===_0x7184('0x20c')&&this['agents'][_0x1d04fe]['status']===_0x7184('0x81')){_0x362ed9[_0x7184('0x95')](this[_0x7184('0x22')][_0x1d04fe]['id']);}}}_0x15ab23[_0x7184('0x1ff')]=0x1;hopperUtils[_0x7184('0x20d')](_0x15ab23,_0x362ed9,_0x15c013)['then'](function(_0x24412c){_0x15ab23['temp']=0x0;if(_0x24412c){if(!utils[_0x7184('0x20e')](_0x24412c)){hopperUtils[_0x7184('0x20f')](_0x15ab23)[_0x7184('0x39')](sendMessageReschedule(_0x15ab23))['catch'](loggerCatch(_0x7184('0x210')));}else{_0x15ab23[_0x7184('0x79')]+=_0x24412c[_0x7184('0x94')];_0x15ab23[_0x7184('0x62')]=_0x15ab23['dialMethod']==='booked'?utils['CAMPAIGN_STATUS'][_0x7184('0x211')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x67f3de=0x0;_0x67f3de<_0x24412c['length'];_0x67f3de+=0x1){if(_['isNil'](_0x24412c[_0x67f3de])||_['isNil'](_0x24412c[_0x67f3de]['Contact'])||_[_0x7184('0xf7')](_0x24412c[_0x67f3de][_0x7184('0x160')])){_0x21b7a1[_0x7184('0x158')](_0x7184('0x204'),_0x15ab23,_0x24412c[_0x67f3de]);}else{hopperUtils[_0x7184('0x212')](_['pick'](_0x24412c[_0x67f3de],['VoiceQueueId',_0x7184('0x160')]))['then'](_0x21b7a1[_0x7184('0x206')](_0x15ab23,_0x24412c[_0x67f3de]))[_0x7184('0x9c')](function(_0x10148d){logger['error'](_0x7184('0x213'),_0x10148d);utils[_0x7184('0xbd')](_0x15ab23,_0x7184('0x214'));});}}}}})[_0x7184('0x9c')](function(_0x47234b){_0x15ab23['temp']=0x0;logger['error'](_0x7184('0x208'),_0x47234b);});}};Dialer[_0x7184('0x1c')]['handlePredictive']=function(_0x1aab6a){if(_0x1aab6a['dialLimitQueue']>0x0){var _0x4e910f=_0x1aab6a[_0x7184('0x20a')]-_0x1aab6a['originated']-_0x1aab6a[_0x7184('0x1c4')];if(_0x4e910f>0x0&&_0x1aab6a[_0x7184('0x1ff')]==0x0){this['tryOriginatePredictive'](_0x1aab6a);}else{loggerPredictiveCalls[_0x7184('0x42')](_0x7184('0x215'));}}else{this[_0x7184('0x216')](_0x1aab6a);}};Dialer['prototype'][_0x7184('0x216')]=function(_0x975086){var _0x511012=this;var _0x51aef9=[];_0x975086[_0x7184('0x79')]+=0x1;for(var _0x336a9c in this[_0x7184('0x22')]){if(typeof this['agents'][_0x336a9c]!==_0x7184('0xa4')){if(this['agents'][_0x336a9c][_0x7184('0x68')]==='not_inuse'&&this['agents'][_0x336a9c][_0x7184('0x80')]==='reachable'){_0x51aef9[_0x7184('0x95')](this[_0x7184('0x22')][_0x336a9c]['id']);}}}_0x975086[_0x7184('0x1ff')]=0x1;return this[_0x7184('0x20d')](_0x975086['id'],_0x51aef9,0x1,_0x975086[_0x7184('0x217')],_0x975086)[_0x7184('0x39')](function(_0x53d770){_0x975086[_0x7184('0x1ff')]=0x1;if(_0x53d770){if(!utils[_0x7184('0x20e')](_0x53d770)){utils['checkContactLowerLimitOriginate'](_0x975086,0x1,0x0);return hopperUtils[_0x7184('0x20f')](_0x975086)[_0x7184('0x39')](sendMessageReschedule(_0x975086))[_0x7184('0x9c')](loggerCatch(_0x7184('0x210')));}else{_0x975086[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x202')];if(_[_0x7184('0xf7')](_0x53d770[0x0])||_[_0x7184('0xf7')](_0x53d770[0x0][_0x7184('0x17a')])||_['isNil'](_0x53d770[0x0][_0x7184('0x160')])){_0x511012['emptyContact'](_0x7184('0x204'),_0x975086,_0x53d770[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x7184('0x6f')](_0x53d770[0x0],[_0x7184('0xe2'),_0x7184('0x160')]))[_0x7184('0x39')](_0x511012[_0x7184('0x206')](_0x975086,_0x53d770[0x0]))['catch'](function(_0x162609){logger[_0x7184('0x60')]('[actionOriginatePredictive]',_0x162609);utils[_0x7184('0xbd')](_0x975086,_0x7184('0x218'));});}}}})['catch'](function(_0x232224){_0x975086[_0x7184('0x1ff')]=0x0;logger['error'](_0x7184('0x208'),_0x232224);});};Dialer[_0x7184('0x1c')][_0x7184('0x1e3')]=function(_0x109251,_0x12fcc8,_0x1599fc,_0x23ccd4,_0x3712a1,_0x3b7911){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x7184('0x42')](_0x7184('0x219'),_0x109251);loggerPredictive[_0x7184('0x42')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12fcc8);loggerPredictive[_0x7184('0x42')](_0x7184('0x21a'),_0x1599fc);loggerPredictive[_0x7184('0x42')](_0x7184('0x21b'),_0x23ccd4);loggerPredictive[_0x7184('0x42')](_0x7184('0x21c'),_0x3712a1);loggerPredictive[_0x7184('0x42')]('---------------------------');return new Promise(function(_0x39bcce,_0x925f1e){if(_0x109251<=0x0||isNaN(_0x109251)){return _0x925f1e(msgResponse(_0x7184('0x21d'),'Error',_0x7184('0x21e')+_0x109251));}if(_0x1599fc<=0x0||isNaN(_0x1599fc)){return _0x925f1e(msgResponse('[abandonmentRate]','Error',_0x7184('0x21f')+_0x1599fc));}if(_0x23ccd4<=0x0||isNaN(_0x23ccd4)){return _0x925f1e(msgResponse('[abandonmentRate]',_0x7184('0x7e'),_0x7184('0x220')+_0x23ccd4));}if(_0x12fcc8<=0x0||isNaN(_0x12fcc8)){return _0x925f1e(msgResponse(_0x7184('0x21d'),_0x7184('0x7e'),_0x7184('0x221')+_0x12fcc8));}if(_0x3712a1<=0x0||isNaN(_0x3712a1)){return _0x925f1e(msgResponse(_0x7184('0x21d'),_0x7184('0x7e'),_0x7184('0x222')+_0x3712a1));}_0x3b7911=_0x3b7911||0x0;var _0x433286=0x1/_0x1599fc;var _0x311455=0x0;var _0x349fb8=0x0;var _0x4e9342=0x0;var _0x9d219a=0x0;for(var _0x189c18=0x0;_0x4e9342<_0x3712a1;_0x189c18+=0x1){_0x349fb8=_0x189c18/_0x12fcc8;_0x311455=(_0x23ccd4*_0x349fb8+_0x3b7911)/_0x433286;_0x4e9342=utils[_0x7184('0x223')](_0x311455,_0x109251);_0x9d219a=_0x311455/_0x109251*(0x1-utils[_0x7184('0x223')](_0x311455,_0x109251));}return _0x39bcce({'erlangCalls':_0x189c18,'erlangCallToSecond':_0x12fcc8/_0x189c18,'erlangAbandonmentRate':_0x4e9342,'erlangBusyFactor':_0x9d219a});});};Dialer['prototype'][_0x7184('0x1db')]=function(_0x39dc41,_0xf78139,_0x13456c,_0x7c680f,_0x4a1ac3,_0x47f886){loggerPredictive[_0x7184('0x42')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x7184('0x42')](_0x7184('0x219'),_0x39dc41);loggerPredictive['info'](_0x7184('0x224'),_0xf78139);loggerPredictive[_0x7184('0x42')](_0x7184('0x21a'),_0x13456c);loggerPredictive[_0x7184('0x42')]('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',_0x7c680f);loggerPredictive[_0x7184('0x42')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a1ac3);loggerPredictive[_0x7184('0x42')](_0x7184('0x4d'));return new Promise(function(_0x1d660f,_0x339d50){if(_0x39dc41<=0x0||isNaN(_0x39dc41)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x21e')+_0x39dc41));}if(_0x13456c<=0x0||isNaN(_0x13456c)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x21f')+_0x13456c));}if(_0x7c680f<=0x0||isNaN(_0x7c680f)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x220')+_0x7c680f));}if(_0xf78139<=0x0||isNaN(_0xf78139)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x221')+_0xf78139));}if(_0x4a1ac3<=0x0||isNaN(_0x4a1ac3)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x226')+_0x4a1ac3));}_0x47f886=_0x47f886||0x0;var _0x1caf69=0x1/_0x13456c;var _0x23bf1e=0x0;var _0x5e40ce=0x0;var _0x30d58f=0x0;var _0x4d397c=0x0;for(var _0x24def1=0x0;_0x4d397c<_0x4a1ac3;_0x24def1+=0x1){_0x5e40ce=_0x24def1/_0xf78139;_0x23bf1e=(_0x7c680f*_0x5e40ce+_0x47f886)/_0x1caf69;_0x30d58f=utils[_0x7184('0x223')](_0x23bf1e,_0x39dc41);_0x4d397c=_0x23bf1e/_0x39dc41*(0x1-utils['erlangb'](_0x23bf1e,_0x39dc41));}return _0x1d660f({'erlangCalls':_0x24def1,'erlangCallToSecond':_0xf78139/_0x24def1,'erlangAbandonmentRate':_0x30d58f,'erlangBusyFactor':_0x4d397c});});};module[_0x7184('0x227')]=Dialer; \ No newline at end of file +var _0x6068=['locked','stateinterface','queueBooked','pick','paused','roundrobin','run','idHopper','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','ContactId','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','Machine','syncHangup','[syncHangup]','ivrAnswerCallsDay','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','getVoiceQueueRtPauses','emptyContact','notFound','[emptyContact]','saveInDb','merge','UserId','[emptyContact][createHistory]','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','dialer','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','TrunkBackup','dialOriginateCallerIdName','getCallerIdRandom','originatecalleridname','extractCalleridName','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','countcongestionretry','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','talking','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','erlangCallToSecond','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','Blacklist','[Originate][historyBlacklist]','inBlackList','temp','getContactDialerIvr','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[actionOriginate]','[handlePower]','[getContactCampaign2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','checkContactEmpty','checkContactLowerLimitOriginate','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','startPredictive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','startProgressive','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20deactivated','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','isArray','Action','command','iftime\x20%s,%s','interval','indexOf','catch','push','content','true','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','Timezone:\x20','isGlobal','uniqueid','ivr','decrementOriginate','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','[syncQueueCallerAbandon]','droptime','getSeconds','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','dialQueueProject2','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','calleridnum','syncNewExten','actions','channel','syncQueueMember','actionid','strategy','rrmemory','isNil'];(function(_0xdb1494,_0x5b46da){var _0x3e978b=function(_0x1fc319){while(--_0x1fc319){_0xdb1494['push'](_0xdb1494['shift']());}};_0x3e978b(++_0x5b46da);}(_0x6068,0x134));var _0x8606=function(_0x1379ee,_0x5b5af6){_0x1379ee=_0x1379ee-0x0;var _0x239358=_0x6068[_0x1379ee];return _0x239358;};'use strict';var util=require('util');var _=require(_0x8606('0x0'));var uuid=require(_0x8606('0x1'));var moment=require(_0x8606('0x2'));var rr=require('rr');var Redis=require(_0x8606('0x3'));var utils=require(_0x8606('0x4'));var hopperUtils=require(_0x8606('0x5'));var ut=require(_0x8606('0x6'));var config=require(_0x8606('0x7'));var logger=require(_0x8606('0x8'))('dialer');var loggerBooked=require(_0x8606('0x8'))(_0x8606('0x9'));var loggerPredictive=require(_0x8606('0x8'))(_0x8606('0xa'));var loggerPredictiveCalls=require(_0x8606('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x8606('0xb'));var ami=require(_0x8606('0xc'));config['redis']=_['defaults'](config[_0x8606('0xd')],{'host':_0x8606('0xe'),'port':0x18eb});var io=require(_0x8606('0xf'))(new Redis(config[_0x8606('0xd')]));var cmHopper=require(_0x8606('0x10'));var voiceQueueRt=require(_0x8606('0x11'));var RpcSetting=require(_0x8606('0x12'));var Interval=require(_0x8606('0x13'));var Action=require(_0x8606('0x14'));var History=require(_0x8606('0x15'));var Final=require(_0x8606('0x16'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x8606('0x17'));var Hangup=require(_0x8606('0x18'));var ipAgi=process[_0x8606('0x19')][_0x8606('0x1a')]||_0x8606('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x8606('0x1c')][_0x8606('0x1d')]=function(_0x4a88f2){this[_0x8606('0x1e')]=this[_0x8606('0x1e')]?this[_0x8606('0x1e')][_0x8606('0x1f')](_0x4a88f2):_0x4a88f2();};function Dialer(_0x4700e5,_0xeef3e4){this[_0x8606('0x20')]=new Sequence();this[_0x8606('0x21')]=_0xeef3e4;this[_0x8606('0x22')]=_0x4700e5[_0x8606('0x22')];this['campaigns']=_0x4700e5[_0x8606('0x23')];this[_0x8606('0x24')]=_0x4700e5[_0x8606('0x24')];this['trunks']=_0x4700e5[_0x8606('0x25')];this[_0x8606('0x26')]=config[_0x8606('0x26')]||0x2;this[_0x8606('0x27')]={};this['actions']={};this['contactsId']={};this[_0x8606('0x28')]={};this['optionPredictive']={};this[_0x8606('0x29')]={};this['startProgressive']={};this[_0x8606('0x2a')]={};this['queueBooked']={};this[_0x8606('0x2b')]={};this[_0x8606('0x2c')]={};ami['on'](_0x8606('0x2d'),this[_0x8606('0x2e')][_0x8606('0x2f')](this));ami['on'](_0x8606('0x30'),this['syncQueueCallerAbandon'][_0x8606('0x2f')](this));ami['on']('originateresponse',this[_0x8606('0x31')][_0x8606('0x2f')](this));ami['on'](_0x8606('0x32'),this['syncAgentComplete'][_0x8606('0x2f')](this));ami['on'](_0x8606('0x33'),this['syncQueueSummary'][_0x8606('0x2f')](this));ami['on'](_0x8606('0x34'),this[_0x8606('0x35')]['bind'](this));ami['on'](_0x8606('0x36'),this['syncHangup'][_0x8606('0x2f')](this));ami['on']('newexten',this['syncNewExten'][_0x8606('0x2f')](this));ami['on']('varset',this[_0x8606('0x37')]['bind'](this));ami['on'](_0x8606('0x38'),this['syncQueueMember'][_0x8606('0x2f')](this));ami['on'](_0x8606('0x39'),this[_0x8606('0x3a')][_0x8606('0x2f')](this));this[_0x8606('0x3b')]();this['loopClearZombieChannels']();RpcSetting[_0x8606('0x3c')]()[_0x8606('0x3d')](function(_0x3202c6){previewRecallmeReminderInterval=_0x3202c6['previewRecallmeReminderInterval'];});}function isNotNull(_0xd85249){return _0xd85249!==null&&!_[_0x8606('0x3e')](_0xd85249);}function msgResponse(_0x45cafd,_0x7d6672,_0x176c64){return{'action':_0x45cafd,'response':_0x7d6672,'message':_0x176c64,'stack':_0x176c64};}function emit(_0x5c9845,_0x189cb5,_0x557531){io['to'](_0x5c9845)[_0x8606('0x3f')](_0x189cb5,_0x557531);}function emitOutboundVoiceQueueSummary(_0x1dc6bf){if(_0x1dc6bf[_0x8606('0x40')]===_0x8606('0x41')){logger[_0x8606('0x42')](_0x8606('0x43'),util[_0x8606('0x44')](_0x1dc6bf,{'showHidden':![],'depth':null}));emit(util[_0x8606('0x45')](_0x8606('0x46'),_0x1dc6bf['name']),'voice_queue:save',_0x1dc6bf);}}function checkGetDataPredictive(_0x511ddb){if(isNotNull(_0x511ddb)&&!_[_0x8606('0x47')](_0x511ddb)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x8606('0x48')](_0x8606('0x49'),_0x511ddb[_0x8606('0x4a')]);loggerPredictive[_0x8606('0x48')](_0x8606('0x4b'),_0x511ddb[_0x8606('0x4c')]);loggerPredictive[_0x8606('0x48')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x511ddb[_0x8606('0x4d')]);loggerPredictive[_0x8606('0x48')](_0x8606('0x4e'),_0x511ddb[_0x8606('0x4f')]);loggerPredictive[_0x8606('0x48')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x511ddb[_0x8606('0x50')]);loggerPredictive[_0x8606('0x48')](_0x8606('0x51'),_0x511ddb[_0x8606('0x52')]);loggerPredictive[_0x8606('0x48')](_0x8606('0x53'));if(_0x511ddb[_0x8606('0x4a')]>0x0){if(!_[_0x8606('0x3e')](_0x511ddb['predictiveIntervalAvgTalktime'])&&_0x511ddb[_0x8606('0x52')]>0x0){return!![];}loggerPredictive[_0x8606('0x48')](_0x8606('0x54'));if(!_[_0x8606('0x3e')](_0x511ddb[_0x8606('0x50')])&&_0x511ddb['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x8606('0x48')](_0x8606('0x55'));}else{loggerPredictive[_0x8606('0x48')](_0x8606('0x56'));}}else{loggerPredictive[_0x8606('0x48')](_0x8606('0x57'));}return![];}function mergeDataErlangB(_0x59d887){return function(_0x2d1e2a){loggerPredictive[_0x8606('0x48')](_0x8606('0x58'));loggerPredictive['info'](_0x8606('0x59'),_0x2d1e2a[_0x8606('0x5a')]);loggerPredictive[_0x8606('0x48')](_0x8606('0x5b'),_0x2d1e2a['erlangCallToSecond']);loggerPredictive[_0x8606('0x48')](_0x8606('0x5c'),_0x2d1e2a[_0x8606('0x5d')]);loggerPredictive[_0x8606('0x48')](_0x8606('0x5e'),_0x2d1e2a[_0x8606('0x5f')]);loggerPredictive[_0x8606('0x48')](_0x8606('0x5c'),_0x2d1e2a[_0x8606('0x5d')]);loggerPredictive[_0x8606('0x48')]('---------------------------');_['merge'](_0x59d887,_0x2d1e2a);};}function ifInterval(_0x2569aa,_0x1aadcb){if(_[_0x8606('0x3e')](_0x1aadcb)){return![];}return utils['getSeconds'](undefined,_0x1aadcb)<_0x2569aa*0x3c;}function clearPredictiveAttributes(_0x5695cd){if(_0x5695cd[_0x8606('0x60')]){_0x5695cd['startProgressive']=undefined;loggerPredictive[_0x8606('0x42')](_0x5695cd[_0x8606('0x61')],_0x8606('0x62'));}if(_0x5695cd[_0x8606('0x29')]){_0x5695cd[_0x8606('0x29')]=undefined;loggerPredictive[_0x8606('0x42')](_0x5695cd[_0x8606('0x61')],_0x8606('0x63'));}if(_0x5695cd[_0x8606('0x64')]){clearInterval(_0x5695cd[_0x8606('0x64')]);_0x5695cd[_0x8606('0x64')]=undefined;loggerPredictive[_0x8606('0x42')](_0x5695cd[_0x8606('0x61')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x3bd8a8,_0x2a6e45){return function(_0x2c608c){loggerPredictive[_0x8606('0x65')](_0x2a6e45[_0x8606('0x61')],_0x3bd8a8);loggerPredictive[_0x8606('0x65')](_0x2c608c[_0x8606('0x66')]);clearPredictiveAttributes(_0x2a6e45);};}function loggerCatch(_0x2406a1){return function(_0x2d683f){logger['error'](_0x2406a1,util[_0x8606('0x44')](_0x2d683f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5cf8fa){return function(_0x18ba6d){if(isNotNull(_0x18ba6d)&&isNotNull(_0x18ba6d[0x0])){if(_0x18ba6d[0x0][_0x8606('0x67')]>0x0){_0x5cf8fa[_0x8606('0x68')]=utils[_0x8606('0x69')]['CONTACTS_RESCHEDULED'];logger[_0x8606('0x48')](_0x8606('0x6a')+_0x5cf8fa['name'],_0x18ba6d[0x0][_0x8606('0x67')],'contacts');}else{_0x5cf8fa[_0x8606('0x68')]=utils[_0x8606('0x69')]['NO_AVAILABLE_CONTACTS'];logger[_0x8606('0x48')](_0x8606('0x6b')+_0x5cf8fa[_0x8606('0x61')]);}}};}function createObjHistory(_0x56ecda,_0x87a7bd,_0x7bc710,_0x13f167,_0x318d9c){_0x56ecda['message']=_0x7bc710;var _0x562190=new Action(_0x56ecda,_0x87a7bd);var _0x38655e=new History(_0x562190);_0x38655e[_0x8606('0x6c')]=_0x13f167;_0x38655e[_0x8606('0x6d')]=_0x318d9c;_0x38655e[_0x8606('0x6e')]=_0x562190[_0x8606('0x6f')];return _0x38655e;}function unlockQueueStatus(_0x43fce2,_0x16abbd){setTimeout(function(){if(_['isUndefined'](_0x43fce2[_0x8606('0x70')])){loggerBooked[_0x8606('0x65')]('[unlockQueueStatus][undefined]',_0x16abbd);}_0x43fce2[_0x8606('0x70')]=!![];loggerBooked[_0x8606('0x48')](_0x8606('0x71'),_0x16abbd,JSON[_0x8606('0x72')](_['pick'](_0x43fce2,[_0x8606('0x61'),_0x8606('0x70')])));},0x1f3);}function checkInterval(_0x1219d7){return function(){if(!isNotNull(_0x1219d7[_0x8606('0x73')])){_0x1219d7[_0x8606('0x68')]=utils[_0x8606('0x69')][_0x8606('0x74')];throw _0x1219d7[_0x8606('0x61')]+_0x8606('0x75');}if(!isNotNull(_0x1219d7['Interval'][_0x8606('0x76')])){_0x1219d7[_0x8606('0x68')]=utils[_0x8606('0x69')][_0x8606('0x74')];throw _0x1219d7[_0x8606('0x61')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x1219d7[_0x8606('0x73')][_0x8606('0x76')]))){_0x1219d7[_0x8606('0x68')]=utils['CAMPAIGN_STATUS'][_0x8606('0x74')];throw _0x1219d7[_0x8606('0x61')]+_0x8606('0x75');}};}function checkIsIVRCampaignActive(_0x22edb0){return function(){if(!utils['isIVRCampaignActive'](_0x22edb0)){_0x22edb0[_0x8606('0x68')]=utils[_0x8606('0x69')]['INACTIVE'];throw _0x22edb0[_0x8606('0x61')]+_0x8606('0x77');}};}function emitCampaignSummary(_0x200915){if(utils[_0x8606('0x78')](_0x200915)){emit(util['format'](_0x8606('0x79'),_0x200915[_0x8606('0x61')]),_0x8606('0x7a'),_0x200915);}}function loggerCatchQueueSummary(_0x426e18,_0x5f24ef){return function(_0x4fa2c0){clearPredictiveAttributes(_0x5f24ef);emitCampaignSummary(_0x5f24ef);loggerSyncQueueSummary[_0x8606('0x42')](_0x426e18,util['inspect'](_0x4fa2c0,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x300da3){if(_0x300da3[_0x8606('0x7b')]){if(_0x300da3[_0x8606('0x7c')]===0x0){_0x300da3[_0x8606('0x7b')]=![];_0x300da3[_0x8606('0x68')]=utils[_0x8606('0x69')][_0x8606('0x7d')];loggerSyncQueueSummary[_0x8606('0x42')](_0x8606('0x7e'),_0x300da3['name'],_0x8606('0x7f'));}else{_0x300da3[_0x8606('0x68')]=utils[_0x8606('0x69')][_0x8606('0x80')];loggerSyncQueueSummary[_0x8606('0x42')](_0x8606('0x7e'),_0x300da3[_0x8606('0x61')],_0x8606('0x81'));}emitCampaignSummary(_0x300da3);}}function myreject(_0x10f45a){return function(_0x3a5581){return _0x10f45a(msgResponse(_0x8606('0x82'),_0x8606('0x83'),JSON['stringify'](_0x3a5581)));};}Dialer['prototype'][_0x8606('0x84')]=function(_0x549af7){return!_['isUndefined'](_0x549af7)&&_0x549af7&&!_[_0x8606('0x3e')](_0x549af7[_0x8606('0x61')])&&!_[_0x8606('0x3e')](_0x549af7[_0x8606('0x85')])&&_0x549af7[_0x8606('0x85')]&&(this[_0x8606('0x25')][util[_0x8606('0x45')](_0x8606('0x86'),_0x549af7[_0x8606('0x61')])][_0x8606('0x87')]===_0x8606('0x88')||this[_0x8606('0x25')][util[_0x8606('0x45')]('SIP/%s',_0x549af7['name'])][_0x8606('0x87')]==='unmonitored');};Dialer['prototype'][_0x8606('0x89')]=function(_0x3003e3){var _0x5bcbbc=this;return function(){if(!_0x5bcbbc[_0x8606('0x84')](_0x3003e3[_0x8606('0x8a')])){if(!_0x5bcbbc['isTrunkReachable'](_0x3003e3['TrunkBackup'])){_0x3003e3['message']=utils[_0x8606('0x69')][_0x8606('0x8b')];throw _0x3003e3[_0x8606('0x61')]+_0x8606('0x8c');}}};};Dialer[_0x8606('0x1c')][_0x8606('0x8d')]=function(_0x475b33,_0x142ba7,_0x3fefb4,_0x57a75e){var _0x5ae941=this;return function(){var _0x55b5af=!![];return _0x5ae941['ifTimeIvr'](_0x475b33,_0x142ba7,_0x3fefb4,_0x57a75e,_0x55b5af);};};Dialer[_0x8606('0x1c')][_0x8606('0x8e')]=function(_0x3b5402,_0x3ffbf7,_0x539aff,_0x3a440b){var _0x50e5d1=this;return function(){var _0xda19eb=![];return _0x50e5d1[_0x8606('0x8f')](_0x3b5402[_0x8606('0x76')],_0x3ffbf7,_0x539aff,_0x3a440b,_0xda19eb);};};Dialer[_0x8606('0x1c')]['ifTimeIvr']=function(_0x3a2648,_0x30b376,_0x4c87d3,_0x5236b8,_0x461a25){var _0x164164=[];return new Promise(function(_0x350bf5,_0x2e2d19){if(!isNotNull(_0x3a2648)){_0x5236b8[_0x8606('0x68')]=utils[_0x8606('0x69')][_0x8606('0x74')];return _0x2e2d19(msgResponse(_0x8606('0x90'),_0x8606('0x91'),_0x4c87d3+_0x8606('0x92')));}if(_['isEmpty'](_0x3a2648)){_0x5236b8['message']=utils[_0x8606('0x69')][_0x8606('0x93')];return _0x2e2d19(msgResponse(_0x8606('0x90'),_0x8606('0x91'),_0x4c87d3+_0x8606('0x94')));}if(_0x30b376&&_['isUndefined'](config[_0x8606('0x95')][_0x30b376])){_0x5236b8[_0x8606('0x68')]=utils[_0x8606('0x69')]['UNKNOWN_TIMEZONE'];return _0x2e2d19(msgResponse(_0x8606('0x90'),_0x8606('0x91'),_0x4c87d3+'\x20Timezone\x20unknow\x20'+_0x30b376));}if(_[_0x8606('0x96')](_0x3a2648)){for(var _0x223281=0x0;_0x223281<_0x3a2648['length'];_0x223281+=0x1){_0x164164['push'](ami[_0x8606('0x97')]({'action':_0x8606('0x98'),'command':util[_0x8606('0x45')](_0x8606('0x99'),_0x3a2648[_0x223281][_0x8606('0x9a')],!_['isUndefined'](config['timezones'][_0x30b376])?_0x30b376:'')})[_0x8606('0x3d')](function(_0x46aee0){return _0x46aee0['content'][_0x8606('0x9b')]('true')>=0x0;})[_0x8606('0x9c')](myreject(_0x2e2d19)));}}else{_0x164164[_0x8606('0x9d')](ami['Action']({'action':_0x8606('0x98'),'command':util[_0x8606('0x45')]('iftime\x20%s,%s',_0x3a2648,!_['isUndefined'](config['timezones'][_0x30b376])?_0x30b376:'')})[_0x8606('0x3d')](function(_0x2b0bc8){return _0x2b0bc8[_0x8606('0x9e')]['indexOf'](_0x8606('0x9f'))>=0x0;})[_0x8606('0x9c')](myreject(_0x2e2d19)));}Promise[_0x8606('0xa0')](_0x164164)[_0x8606('0x3d')](function(_0x16606a){var _0x6e5e2f=_['some'](_0x16606a);if(_0x6e5e2f){return _0x350bf5(_0x6e5e2f);}else{_0x5236b8[_0x8606('0x68')]=_0x461a25?utils[_0x8606('0x69')][_0x8606('0xa1')]:utils['CAMPAIGN_STATUS'][_0x8606('0xa2')];return _0x2e2d19(msgResponse('[ifTime][promiseAll]',_0x8606('0x91'),_0x8606('0xa3')+_0x461a25+'\x20'+_0x4c87d3+_0x8606('0xa4')+util[_0x8606('0x44')](_0x3a2648,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x30b376));}})[_0x8606('0x9c')](function(_0x5b1922){return _0x2e2d19(msgResponse('ifTime','Failure',JSON['stringify'](_0x5b1922)));});});};Dialer[_0x8606('0x1c')][_0x8606('0x3b')]=function(){var _0x48bb21=this;return cmHopper[_0x8606('0xa5')]({'active':![]},{'where':{'active':!![]}})[_0x8606('0x3d')](function(){setInterval(function(){_0x48bb21['syncCampaigns']();},0x3e8);});};Dialer[_0x8606('0x1c')][_0x8606('0xa6')]=function(){var _0x358881=this;var _0x4f0147;for(var _0x223b5b in this[_0x8606('0x23')]){if(typeof this['campaigns'][_0x223b5b]!==_0x8606('0xa7')){_0x4f0147=this['campaigns'][_0x223b5b];if(utils[_0x8606('0x78')](_0x4f0147)&&utils[_0x8606('0xa8')](_0x4f0147)){_0x4f0147['sendMessageOneNotActive']=!![];Promise[_0x8606('0xa9')]()[_0x8606('0x3d')](checkIsIVRCampaignActive(_0x4f0147))[_0x8606('0x3d')](checkInterval(_0x4f0147))[_0x8606('0x3d')](_0x358881[_0x8606('0x89')](_0x4f0147))[_0x8606('0x3d')](_0x358881[_0x8606('0x8d')](_0x4f0147[_0x8606('0xaa')],_0x4f0147[_0x8606('0xab')],_0x4f0147[_0x8606('0x61')],_0x4f0147))[_0x8606('0x3d')](_0x358881[_0x8606('0x8e')](_0x4f0147[_0x8606('0x73')],_0x4f0147[_0x8606('0xab')],_0x4f0147[_0x8606('0x61')],_0x4f0147))[_0x8606('0x3d')](_0x358881['launchHandleIvr'](_0x4f0147))[_0x8606('0x9c')](loggerCatchQueueSummary(_0x8606('0xac'),_0x4f0147));}else{notSendMessagesCampaign(_0x4f0147);}}}};Dialer[_0x8606('0x1c')][_0x8606('0xad')]=function(_0x5629c6){if(_0x5629c6[_0x8606('0xae')]!==_0x8606('0xa')){clearPredictiveAttributes(_0x5629c6);}switch(_0x5629c6[_0x8606('0xae')]){case _0x8606('0xaf'):this[_0x8606('0xb0')](_0x5629c6,0x1);break;case _0x8606('0xb1'):this[_0x8606('0xb0')](_0x5629c6,_0x5629c6['dialPowerLevel']);break;case'predictive':this['predictive'](_0x5629c6);break;case _0x8606('0x9'):this[_0x8606('0xb0')](_0x5629c6,0x1);break;default:logger[_0x8606('0x65')](_0x8606('0xb2'),_0x5629c6[_0x8606('0x61')],_0x8606('0xb3'));}};Dialer[_0x8606('0x1c')][_0x8606('0x90')]=function(_0x26b596,_0x27e6f2){var _0x30c2a5=_0x26b596[_0x8606('0xab')];var _0x1bb86d=_0x27e6f2?_0x26b596[_0x8606('0xaa')]:_0x26b596[_0x8606('0x73')][_0x8606('0x76')];logger[_0x8606('0xb4')](_0x8606('0xb5'),_0x1bb86d,_0x30c2a5,_0x26b596[_0x8606('0x61')],util[_0x8606('0x45')](_0x8606('0xb6'),_0x26b596[_0x8606('0x61')],_0x26b596['id']));var _0x212cab=null;return Interval[_0x8606('0xb7')](_0x1bb86d,_0x30c2a5)[_0x8606('0x3d')](function(_0x25a3d4){if(_0x25a3d4===!![]){return _0x25a3d4;}else{_0x26b596[_0x8606('0x68')]=_0x27e6f2?utils[_0x8606('0x69')][_0x8606('0xa1')]:utils[_0x8606('0x69')][_0x8606('0xa2')];_0x212cab=msgResponse(_0x8606('0xb8'),_0x8606('0x91'),'Global:\x20'+_0x27e6f2+'\x20'+_0x26b596[_0x8606('0x61')]+_0x8606('0xa4')+util[_0x8606('0x44')](_0x1bb86d,{'showHidden':![],'depth':null})+_0x8606('0xb9')+_0x30c2a5);}if(_0x212cab!==null){logger[_0x8606('0xb4')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x212cab);_0x212cab[_0x8606('0xba')]=_0x27e6f2;throw _0x212cab;}})[_0x8606('0x9c')](function(_0x1c3f44){logger[_0x8606('0x65')]('AMI\x20IfTime',_0x1c3f44);throw msgResponse(_0x8606('0x82'),_0x8606('0x83'),util[_0x8606('0x44')](_0x1c3f44,{'showHidden':![],'depth':null}));});};Dialer[_0x8606('0x1c')][_0x8606('0x2e')]=function(_0x51ebbe){if(this[_0x8606('0x22')][_0x51ebbe['queue']]){if(this[_0x8606('0x28')][_0x51ebbe['uniqueid']]&&this[_0x8606('0x28')][_0x51ebbe[_0x8606('0xbb')]][_0x8606('0x40')]!==_0x8606('0xbc')){utils[_0x8606('0xbd')](this[_0x8606('0x22')][_0x51ebbe[_0x8606('0xbe')]],'[syncAgentConnect]');this[_0x8606('0x28')][_0x51ebbe[_0x8606('0xbb')]][_0x8606('0xbf')]=moment()[_0x8606('0x45')](_0x8606('0xc0'));}}};Dialer['prototype'][_0x8606('0xc1')]=function(_0x12b474){var _0x590b1c=this[_0x8606('0x28')][_0x12b474['uniqueid']];if(this[_0x8606('0x22')][_0x12b474[_0x8606('0xbe')]]){if(_0x590b1c&&_0x590b1c[_0x8606('0x40')]!=='ivr'){delete this[_0x8606('0x28')][_0x12b474[_0x8606('0xbb')]];this[_0x8606('0x22')][_0x12b474[_0x8606('0xbe')]]['outboundAnswerCallsDay']+=0x1;var _0x283ec9=new AgentComplete(_0x590b1c,_0x12b474);if(_0x12b474[_0x8606('0xc2')]===_0x8606('0xc3')){_0x283ec9[_0x8606('0xc4')]=this[_0x8606('0x22')][_0x12b474['queue']]['dialQueueProject2']&&this[_0x8606('0x22')][_0x12b474['queue']][_0x8606('0xc5')]?moment()['format'](_0x8606('0xc0')):undefined;}hopperUtils[_0x8606('0xc6')](_0x283ec9)[_0x8606('0x9c')](loggerCatch(_0x8606('0xc7')));hopperUtils[_0x8606('0xc8')](_0x283ec9)[_0x8606('0x9c')](loggerCatch(_0x8606('0xc9')));}}};Dialer[_0x8606('0x1c')][_0x8606('0xca')]=function(_0x51acf9){var _0x5ca89c=this['uniqueId'][_0x51acf9['uniqueid']];var _0x467997=this;var _0x474a44=![];var _0x299e5f;var _0x3f1dbf;if(this['voiceQueues'][_0x51acf9[_0x8606('0xbe')]]){if(_0x5ca89c&&_0x5ca89c[_0x8606('0x40')]!=='ivr'){delete this[_0x8606('0x28')][_0x51acf9[_0x8606('0xbb')]];utils[_0x8606('0xbd')](this[_0x8606('0x22')][_0x51acf9[_0x8606('0xbe')]],_0x8606('0xcb'));_0x5ca89c[_0x8606('0xcc')]=moment()[_0x8606('0x45')](_0x8606('0xc0'));var _0x43a043=new QueueCallerAbandon(_0x5ca89c,_0x51acf9);if(utils[_0x8606('0xcd')](_0x5ca89c[_0x8606('0xcc')],_0x5ca89c['responsetime'])>=_0x5ca89c['dialQueueTimeout']){this[_0x8606('0x22')][_0x51acf9[_0x8606('0xbe')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x8606('0x22')][_0x51acf9[_0x8606('0xbe')]][_0x8606('0xce')]+=0x1;this['voiceQueues'][_0x51acf9['queue']][_0x8606('0xcf')]+=0x1;_0x43a043['state']=0xa;_0x43a043[_0x8606('0x6d')]=_0x8606('0xd0');_0x43a043['dropreason']=_0x8606('0xd1');_0x43a043[_0x8606('0xc4')]=this[_0x8606('0x22')][_0x51acf9[_0x8606('0xbe')]][_0x8606('0xd2')]?moment()[_0x8606('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x43a043['countdropretry']+=0x1;_0x43a043[_0x8606('0xd3')]+=0x1;_0x299e5f=this[_0x8606('0x22')][_0x51acf9['queue']]['dialDropRetryFrequency'];_0x3f1dbf=this['voiceQueues'][_0x51acf9[_0x8606('0xbe')]][_0x8606('0xd4')];hopperUtils[_0x8606('0xd5')](_0x43a043,_0x43a043[_0x8606('0x6c')],_0x5ca89c[_0x8606('0xd6')])[_0x8606('0x3d')](function(_0x2f7164){_0x474a44=_0x2f7164[_0x8606('0xd7')]==0x1;if(_0x43a043[_0x8606('0xd8')]>=_0x467997[_0x8606('0x22')][_0x51acf9[_0x8606('0xbe')]][_0x8606('0xd9')]){_0x467997[_0x8606('0xda')](_0x43a043,_0x2f7164['additional']);}else{hopperUtils[_0x8606('0xdb')]({'active':![],'countdropretry':_0x43a043[_0x8606('0xd8')],'scheduledat':moment()[_0x8606('0xdc')](_0x467997['voiceQueues'][_0x51acf9[_0x8606('0xbe')]][_0x8606('0xdd')],_0x8606('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ca89c['ContactId'],'ListId':_0x5ca89c[_0x8606('0xdf')],'VoiceQueueId':_0x5ca89c[_0x8606('0xe0')]||undefined,'CampaignId':_0x5ca89c[_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch(_0x8606('0xe2')));var _0x3052ae=new History(_0x43a043);_0x3052ae[_0x8606('0x6c')]=0xa;_0x3052ae['statedesc']=_0x8606('0xd0');_0x3052ae[_0x8606('0x6f')]=moment()['format'](_0x8606('0xc0'));_0x3052ae[_0x8606('0x6e')]=_0x3052ae[_0x8606('0x6f')];_0x3052ae['calleridname']=_0x43a043[_0x8606('0xe3')];_0x3052ae['calleridnum']=_0x43a043['calleridnum'];hopperUtils['createHistory'](_0x3052ae)[_0x8606('0x9c')](loggerCatch(_0x8606('0xe4')));}})[_0x8606('0x3d')](function(){if(_0x474a44)hopperUtils[_0x8606('0xe5')](_0x43a043,_0x299e5f,_0x3f1dbf)['then'](function(){return 0x1;});});}else{this[_0x8606('0x22')][_0x51acf9[_0x8606('0xbe')]][_0x8606('0x4f')]+=0x1;this[_0x8606('0x22')][_0x51acf9[_0x8606('0xbe')]]['outboundDropCallsDayCallersExit']+=0x1;_0x43a043[_0x8606('0x6c')]=0xb;_0x43a043[_0x8606('0x6d')]=_0x8606('0xe6');_0x43a043[_0x8606('0xe7')]=_0x8606('0xe8');_0x43a043[_0x8606('0xe9')]+=0x1;_0x43a043['countglobal']+=0x1;_0x299e5f=this[_0x8606('0x22')][_0x51acf9['queue']][_0x8606('0xea')];_0x3f1dbf=this[_0x8606('0x22')][_0x51acf9[_0x8606('0xbe')]][_0x8606('0xd4')];hopperUtils[_0x8606('0xd5')](_0x43a043,_0x43a043[_0x8606('0x6c')],_0x5ca89c[_0x8606('0xd6')])[_0x8606('0x3d')](function(_0x5c8c52){if(_0x43a043[_0x8606('0xe9')]>=_0x467997['voiceQueues'][_0x51acf9['queue']][_0x8606('0xeb')]){_0x467997[_0x8606('0xda')](_0x43a043,_0x5c8c52[_0x8606('0xd7')]);}else{hopperUtils[_0x8606('0xdb')]({'active':![],'countabandonedretry':_0x43a043[_0x8606('0xe9')],'scheduledat':moment()[_0x8606('0xdc')](_0x467997[_0x8606('0x22')][_0x51acf9[_0x8606('0xbe')]][_0x8606('0xea')],_0x8606('0xde'))[_0x8606('0x45')](_0x8606('0xc0')),'ContactId':_0x5ca89c['ContactId'],'ListId':_0x5ca89c['ListId'],'VoiceQueueId':_0x5ca89c['VoiceQueueId']||undefined,'CampaignId':_0x5ca89c[_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch(_0x8606('0xec')));var _0x5ad083=new History(_0x43a043);_0x5ad083[_0x8606('0x6c')]=0xb;_0x5ad083[_0x8606('0x6d')]='Abandoned';_0x5ad083['starttime']=moment()[_0x8606('0x45')](_0x8606('0xc0'));_0x5ad083[_0x8606('0x6e')]=_0x5ad083['starttime'];_0x5ad083[_0x8606('0xe3')]=_0x43a043[_0x8606('0xe3')];_0x5ad083['calleridnum']=_0x43a043[_0x8606('0xed')];hopperUtils[_0x8606('0xc6')](_0x5ad083)[_0x8606('0x9c')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x474a44)hopperUtils[_0x8606('0xe5')](_0x43a043,_0x299e5f,_0x3f1dbf)[_0x8606('0x3d')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x8606('0xee')]=function(_0x45df02){if(this[_0x8606('0xef')][_0x45df02[_0x8606('0xbb')]]){this[_0x8606('0xef')][_0x45df02['uniqueid']][_0x8606('0xf0')]=_0x45df02[_0x8606('0xf0')];}if(this['uniqueId'][_0x45df02[_0x8606('0xbb')]]){this[_0x8606('0x28')][_0x45df02[_0x8606('0xbb')]][_0x8606('0xf0')]=_0x45df02[_0x8606('0xf0')];}};Dialer[_0x8606('0x1c')][_0x8606('0xf1')]=function(_0xd3f1cf){if(!this[_0x8606('0xef')][_0xd3f1cf['actionid']]){return;}var _0x5d3b55=this['voiceQueues'][this['actions'][_0xd3f1cf[_0x8606('0xf2')]][_0x8606('0xbe')]][_0x8606('0xf3')]||_0x8606('0xf4');if(_0x5d3b55==='roundrobin'){if(this['actions'][_0xd3f1cf['actionid']]&&_[_0x8606('0xf5')](this['actions'][_0xd3f1cf[_0x8606('0xf2')]][_0x8606('0xf6')])&&_0xd3f1cf[_0x8606('0x87')]==='1'&&_0xd3f1cf['paused']==='0'){if(this['agents'][_0xd3f1cf[_0x8606('0xf7')]]){if(!this[_0x8606('0x24')][_0xd3f1cf[_0x8606('0xf7')]][_0x8606('0xf6')]){this['agents'][_0xd3f1cf['stateinterface']]['locked']=!![];this[_0x8606('0xef')][_0xd3f1cf['actionid']][_0x8606('0xf6')]=!![];this[_0x8606('0xef')][_0xd3f1cf[_0x8606('0xf2')]][_0x8606('0xf7')]=_0xd3f1cf['stateinterface'];}}}}else if(_0x5d3b55==='rrmemory'){if(this[_0x8606('0xef')][_0xd3f1cf[_0x8606('0xf2')]]){if(this[_0x8606('0x24')][_0xd3f1cf[_0x8606('0xf7')]]){this[_0x8606('0xef')][_0xd3f1cf['actionid']]['stateinterface']=_0xd3f1cf[_0x8606('0xf7')];if(_[_0x8606('0xf5')](this[_0x8606('0xf8')][this[_0x8606('0xef')][_0xd3f1cf[_0x8606('0xf2')]][_0x8606('0xbe')]])){this[_0x8606('0xf8')][this[_0x8606('0xef')][_0xd3f1cf[_0x8606('0xf2')]]['queue']]=[];}this[_0x8606('0xf8')][this[_0x8606('0xef')][_0xd3f1cf[_0x8606('0xf2')]][_0x8606('0xbe')]][_0x8606('0x9d')](_['merge'](_[_0x8606('0xf9')](this[_0x8606('0xef')][_0xd3f1cf[_0x8606('0xf2')]],['idHopper',_0x8606('0xf7')]),{'status':_0xd3f1cf[_0x8606('0x87')],'paused':_0xd3f1cf[_0x8606('0xfa')]}));}}}};Dialer['prototype'][_0x8606('0x3a')]=function(_0x5115bb){if(!this[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]]){return;}var _0x5c4586=this;var _0x2f992e=this[_0x8606('0x22')][this[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]]['queue']];var _0x43bc03=_0x2f992e[_0x8606('0xf3')]||_0x8606('0xf4');if(_0x43bc03===_0x8606('0xfb')){if(this['actions'][_0x5115bb[_0x8606('0xf2')]]&&this['actions'][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xf7')]){this['preview'][_0x8606('0xfc')](this[_0x8606('0xef')][_0x5115bb['actionid']][_0x8606('0xfd')],this[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]]['stateinterface'])['catch'](function(_0x561b7e){logger[_0x8606('0x65')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x561b7e,{'showHidden':![],'depth':null}));})[_0x8606('0x1f')](function(){utils['decrementOriginate'](_0x5c4586[_0x8606('0x22')][_0x5c4586[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xbe')]],_0x8606('0xfe'));_0x5c4586[_0x8606('0x24')][_0x5c4586['actions'][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xf7')]][_0x8606('0xf6')]=![];delete _0x5c4586['actions'][_0x5115bb[_0x8606('0xf2')]];unlockQueueStatus(_0x2f992e);});}else{utils[_0x8606('0xbd')](this[_0x8606('0x22')][this[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xbe')]],_0x8606('0xfe'));hopperUtils[_0x8606('0xdb')]({'active':![],'ContactId':this['actions'][_0x5115bb[_0x8606('0xf2')]]['ContactId'],'ListId':this[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xdf')],'VoiceQueueId':this[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xe0')]||undefined,'CampaignId':this['actions'][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch(_0x8606('0xff')));delete this[_0x8606('0xef')][_0x5115bb['actionid']];unlockQueueStatus(_0x2f992e);}}else if(_0x43bc03===_0x8606('0xf4')){var _0x23c565;if(this[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]]&&!_[_0x8606('0x47')](this[_0x8606('0xf8')][this['actions'][_0x5115bb['actionid']][_0x8606('0xbe')]])){if(this[_0x8606('0x2b')][_0x5c4586[_0x8606('0xef')][_0x5115bb['actionid']][_0x8606('0xbe')]]){this[_0x8606('0x2b')][_0x5c4586[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xbe')]]=this[_0x8606('0x2b')][this['actions'][_0x5115bb[_0x8606('0xf2')]]['queue']]?this[_0x8606('0x2b')][this['actions'][_0x5115bb['actionid']][_0x8606('0xbe')]]:this[_0x8606('0xf8')][this[_0x8606('0xef')][_0x5115bb['actionid']][_0x8606('0xbe')]]?this[_0x8606('0xf8')][this[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xbe')]][_0x8606('0x100')]||0x0:0x0;}this[_0x8606('0xf8')][this[_0x8606('0xef')][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xbe')]][_0x8606('0x100')]=this[_0x8606('0x2b')][this['actions'][_0x5115bb[_0x8606('0xf2')]][_0x8606('0xbe')]];for(var _0xd5fc48=0x0;_0xd5fc48=_0x54ce2a[_0x8606('0x12b')]){_0x3c1a2c[_0x8606('0x12c')](_0x16c93b,_0x1b9869,_0x274963,_0x8606('0x12d'));}else{if(_0x16c93b['countmachineretry']>=_0x54ce2a[_0x8606('0x12e')]){_0x3c1a2c[_0x8606('0x12f')](_0x16c93b,_0x1b9869,_0x274963,'reason\x2019\x20machine....');}else{hopperUtils[_0x8606('0xdb')]({'active':![],'countmachineretry':_0x16c93b['countmachineretry'],'scheduledat':moment()['add'](_0x54ce2a[_0x8606('0x130')],_0x8606('0xde'))[_0x8606('0x45')](_0x8606('0xc0')),'ContactId':_0x16c93b['ContactId'],'ListId':_0x16c93b[_0x8606('0xdf')],'VoiceQueueId':_0x16c93b[_0x8606('0xe0')]||undefined,'CampaignId':_0x16c93b[_0x8606('0xe1')]||undefined})['catch'](loggerCatch(_0x8606('0x131')));_0x1b9869({'reschedule':0x1});}}});}if(_0x3f309d[_0x8606('0x40')]===_0x8606('0xbc')&&this[_0x8606('0x23')][_0x3f309d[_0x8606('0xbe')]][_0x8606('0x117')]&&_0x2e635c[_0x8606('0x118')]===_0x8606('0x119')){delete this[_0x8606('0x28')][_0x2e635c[_0x8606('0xbb')]];utils[_0x8606('0xbd')](this[_0x8606('0x23')][_0x3f309d[_0x8606('0xbe')]],_0x8606('0x11a'));_0x282021=new Hangup(_0x3f309d,_0x2e635c);_0x282021[_0x8606('0x6c')]=0x12;_0x282021['statedesc']='HangupInAMD';_0x282021[_0x8606('0x11d')]=_0x8606('0x11e');ami[_0x8606('0x3f')]('custom:amd',ut[_0x8606('0x120')](_0x282021,'amd'));this['saveInDb'](_0x282021,'[syncHangupInAMDIvr][createHistory]',_0x8606('0x132'));}if(_0x3f309d[_0x8606('0x40')]===_0x8606('0xbc')&&this[_0x8606('0x23')][_0x3f309d['queue']][_0x8606('0x117')]&&_0x2e635c[_0x8606('0x118')]===_0x8606('0x124')){return new Promise(function(_0x462b88,_0x40e644){delete _0x3c1a2c['uniqueId'][_0x2e635c[_0x8606('0xbb')]];utils[_0x8606('0xbd')](_0x3c1a2c['campaigns'][_0x3f309d['queue']],_0x8606('0x11a'));_0x3c1a2c[_0x8606('0x23')][_0x3f309d[_0x8606('0xbe')]][_0x8606('0x11b')]+=0x1;_0x3c1a2c[_0x8606('0x23')][_0x3f309d['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x2dd2fb=_0x3c1a2c['campaigns'][_0x3f309d[_0x8606('0xbe')]];var _0x5d7879=new Hangup(_0x3f309d,_0x2e635c);_0x5d7879[_0x8606('0x6c')]=0x13;_0x5d7879['statedesc']=_0x8606('0x133');_0x5d7879[_0x8606('0x11d')]=_0x8606('0x11e');_0x5d7879['countmachineretry']+=0x1;_0x5d7879[_0x8606('0xd3')]+=0x1;_0x5d7879[_0x8606('0x121')]=!![];ami[_0x8606('0x3f')](_0x8606('0x11f'),ut[_0x8606('0x120')](_0x5d7879,_0x8606('0x121')));hopperUtils[_0x8606('0xc6')](_0x5d7879)[_0x8606('0x9c')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5d7879[_0x8606('0x127')]+_0x5d7879['countcongestionretry']+_0x5d7879[_0x8606('0x128')]+_0x5d7879[_0x8606('0x129')]+_0x5d7879['countdropretry']+_0x5d7879[_0x8606('0xe9')]+_0x5d7879[_0x8606('0x125')]+_0x5d7879['countagentrejectretry']>=_0x2dd2fb[_0x8606('0x12b')]){_0x3c1a2c[_0x8606('0x12c')](_0x5d7879,_0x462b88,_0x40e644,'reason19\x20machine....');}else{if(_0x5d7879[_0x8606('0x125')]>=_0x2dd2fb[_0x8606('0x12e')]){_0x3c1a2c[_0x8606('0x12f')](_0x5d7879,_0x462b88,_0x40e644,'reason\x2019\x20machine....');}else{hopperUtils[_0x8606('0xdb')]({'active':![],'countmachineretry':_0x5d7879[_0x8606('0x125')],'scheduledat':moment()[_0x8606('0xdc')](_0x2dd2fb['dialMachineRetryFrequency'],_0x8606('0xde'))['format'](_0x8606('0xc0')),'ContactId':_0x5d7879[_0x8606('0x109')],'ListId':_0x5d7879[_0x8606('0xdf')],'VoiceQueueId':_0x5d7879[_0x8606('0xe0')]||undefined,'CampaignId':_0x5d7879['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x462b88({'reschedule':0x1});}}});}}};Dialer[_0x8606('0x1c')][_0x8606('0x134')]=function(_0x1f3aca){var _0x29f7aa=this['uniqueId'][_0x1f3aca['uniqueid']];var _0x3f765e;if(!_0x29f7aa){return;}if(_0x29f7aa['type']===_0x8606('0xbc')){delete this[_0x8606('0x28')][_0x1f3aca[_0x8606('0xbb')]];utils[_0x8606('0xbd')](this[_0x8606('0x23')][_0x29f7aa['queue']],_0x8606('0x135'));this['campaigns'][_0x29f7aa[_0x8606('0xbe')]][_0x8606('0x136')]+=0x1;if(_0x1f3aca['cause-txt']===_0x8606('0x137')){const _0x3d6b59=new AgentComplete(_0x29f7aa,_0x1f3aca);_0x3d6b59['CampaignId']=this[_0x8606('0x23')][_0x29f7aa['queue']]['id'];hopperUtils[_0x8606('0xc6')](_0x3d6b59)[_0x8606('0x9c')](loggerCatch(_0x8606('0x138')));hopperUtils[_0x8606('0xc8')](_0x3d6b59)[_0x8606('0x9c')](loggerCatch(_0x8606('0x139')));}else{_0x3f765e=new Hangup(_0x29f7aa,_0x1f3aca);hopperUtils[_0x8606('0xc6')](_0x3f765e)[_0x8606('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x8606('0xc8')](_0x3f765e)['catch'](loggerCatch(_0x8606('0x13a')));}}else{if(isNotNull(this[_0x8606('0x22')][_0x29f7aa['queue']][_0x8606('0x13b')])){delete this['uniqueId'][_0x1f3aca['uniqueid']];utils['decrementOriginate'](this[_0x8606('0x22')][_0x29f7aa[_0x8606('0xbe')]],_0x8606('0x135'));this[_0x8606('0x22')][_0x29f7aa[_0x8606('0xbe')]][_0x8606('0x11b')]+=0x1;this[_0x8606('0x22')][_0x29f7aa[_0x8606('0xbe')]][_0x8606('0x11c')]+=0x1;_0x3f765e=new Hangup(_0x29f7aa,_0x1f3aca);_0x3f765e['state']=0x10;_0x3f765e[_0x8606('0x6d')]=_0x8606('0x13c');_0x3f765e[_0x8606('0x11d')]=_0x8606('0x13d');hopperUtils[_0x8606('0xc6')](_0x3f765e)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x8606('0xc8')](_0x3f765e)[_0x8606('0x9c')](loggerCatch(_0x8606('0x13a')));}else{delete this[_0x8606('0x28')][_0x1f3aca[_0x8606('0xbb')]];utils[_0x8606('0xbd')](this[_0x8606('0x22')][_0x29f7aa[_0x8606('0xbe')]],'[syncHangup2]');if(_0x1f3aca[_0x8606('0x13e')]===_0x8606('0x137')){this[_0x8606('0x22')][_0x29f7aa[_0x8606('0xbe')]][_0x8606('0x11b')]+=0x1;const _0x190517=new AgentComplete(_0x29f7aa,_0x1f3aca);_0x190517[_0x8606('0xe0')]=this[_0x8606('0x22')][_0x29f7aa[_0x8606('0xbe')]]['id'];hopperUtils['createHistory'](_0x190517)['catch'](loggerCatch(_0x8606('0xc7')));hopperUtils[_0x8606('0xc8')](_0x190517)['catch'](loggerCatch(_0x8606('0xc9')));}else{this[_0x8606('0x22')][_0x29f7aa[_0x8606('0xbe')]][_0x8606('0x13f')]+=0x1;_0x3f765e=new Hangup(_0x29f7aa,_0x1f3aca);_0x3f765e[_0x8606('0x6c')]=0xc;_0x3f765e[_0x8606('0x6d')]=_0x1f3aca['cause-txt'];_0x3f765e['membername']=_0x8606('0x140');hopperUtils['createHistory'](_0x3f765e)[_0x8606('0x9c')](loggerCatch(_0x8606('0x141')));hopperUtils[_0x8606('0xc8')](_0x3f765e)[_0x8606('0x9c')](loggerCatch(_0x8606('0x135')));}}}};Dialer['prototype'][_0x8606('0xb')]=function(_0x239596){var _0x497ee4=this;if(!_0x497ee4[_0x8606('0x2c')][_0x239596['name']]){_0x497ee4['queuesSummary'][_0x239596[_0x8606('0x61')]]={'running':![]};}else if(_0x497ee4[_0x8606('0x2c')][_0x239596[_0x8606('0x61')]][_0x8606('0x142')]===!![]){return;}else if(_0x497ee4['queuesSummary'][_0x239596[_0x8606('0x61')]][_0x8606('0x142')]===![]){_0x497ee4[_0x8606('0x2c')][_0x239596[_0x8606('0x61')]]['running']=!![];}var _0x19f293=_0x497ee4['voiceQueues'][_0x239596['name']];var _0x513898=_0x19f293['message']!==utils[_0x8606('0x69')][_0x8606('0x7d')];var _0x548334=utils[_0x8606('0x143')](_0x19f293);_0x19f293[_0x8606('0x144')]=utils[_0x8606('0x145')](_0x19f293,_0x497ee4[_0x8606('0x25')]);Promise['resolve']()[_0x8606('0x3d')](function(){if(_0x19f293[_0x8606('0x144')]===utils['CAMPAIGN_STATUS'][_0x8606('0x7d')]){if(_0x513898){clearPredictiveAttributes(_0x19f293);_0x239596['startPredictive']=undefined;_0x239596[_0x8606('0x60')]=undefined;}if(_0x19f293[_0x8606('0x144')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x239596[_0x8606('0x146')]=0x0;_0x239596['paused']=0x0;_0x239596[_0x8606('0x147')]=0x0;_0x239596['talking']=0x0;_0x239596[_0x8606('0x148')]=0x0;}}else if(_0x19f293[_0x8606('0x144')]===utils['CAMPAIGN_STATUS'][_0x8606('0x149')]&&!_0x548334){return _0x497ee4[_0x8606('0x90')](_0x19f293,!![])[_0x8606('0x3d')](function(){return _0x497ee4[_0x8606('0x90')](_0x19f293,![]);})[_0x8606('0x3d')](function(){return _0x497ee4[_0x8606('0xad')](_0x19f293);})[_0x8606('0x9c')](function(_0x450b91){loggerSyncQueueSummary[_0x8606('0x42')](_0x8606('0x14a'),util['inspect'](_0x450b91,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x19f293);});}else{clearPredictiveAttributes(_0x19f293);}})[_0x8606('0x3d')](function(){var _0x1f8f00=_0x239596[_0x8606('0x14b')](_0x19f293);if(_0x1f8f00||_0x19f293['queueSummaryCountersUpdated']){_0x19f293[_0x8606('0x14c')]=![];_0x239596[_0x8606('0x14d')](_0x19f293);Object[_0x8606('0x14e')](_0x19f293,_0x239596);emitOutboundVoiceQueueSummary(_0x239596);}_0x497ee4['queuesSummary'][_0x19f293[_0x8606('0x61')]][_0x8606('0x142')]=![];})[_0x8606('0x9c')](function(_0x517739){logger['error'](_0x8606('0x14a'),util['inspect'](_0x517739,{'showHidden':![],'depth':null}));_0x497ee4['queuesSummary'][_0x19f293['name']][_0x8606('0x142')]=![];});};Dialer[_0x8606('0x1c')]['syncQueueSummaryComplete']=_[_0x8606('0x14f')](function(){var _0x21ed55=_[_0x8606('0x150')](this['voiceQueues'],function(_0x23bf96){return _0x23bf96[_0x8606('0x151')];});var _0x57c509=_[_0x8606('0x150')](this[_0x8606('0x24')],function(_0x2b59c0){return _0x2b59c0[_0x8606('0x152')]&&_0x2b59c0[_0x8606('0x87')]===_0x8606('0x88');});if(_0x21ed55[_0x8606('0x101')]>0x0&&_0x57c509[_0x8606('0x101')]>0x0){return Promise[_0x8606('0xa9')]()[_0x8606('0x3d')](cmHopper[_0x8606('0x153')](_['map'](_0x21ed55,'id'),previewRecallmeReminderInterval,_[_0x8606('0x154')](_0x57c509,'id')))[_0x8606('0x3d')](function(_0x27c70c){for(var _0x2a5e95=0x0;_0x2a5e95<_0x27c70c[_0x8606('0x101')];_0x2a5e95++){var _0x3d7fee=_0x27c70c[_0x2a5e95][_0x8606('0x155')][_0x8606('0x61')];if(_0x3d7fee)io['to'](util['format'](_0x8606('0x156'),_0x3d7fee))[_0x8606('0x3f')](_0x8606('0x157'),{'hopper':_0x27c70c[_0x2a5e95]});}})['catch'](function(_0x36252e){logger[_0x8606('0x65')](_0x8606('0x158'),_0x36252e);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x8606('0x159')]=function(){var _0x5e1c5c=this;setInterval(function(){_0x5e1c5c[_0x8606('0x15a')](_0x5e1c5c[_0x8606('0x28')],_0x8606('0x15b'));_0x5e1c5c[_0x8606('0x15a')](_0x5e1c5c[_0x8606('0xef')],_0x8606('0x15c'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x5e9e51,_0x56a437){var _0x120816=this;for(var _0x259787 in _0x5e9e51){if(typeof _0x5e9e51[_0x259787]!==_0x8606('0xa7')){this[_0x8606('0x20')][_0x8606('0x1d')](function(){if(!_[_0x8606('0xf5')](_0x5e9e51[_0x259787])){return ami[_0x8606('0x97')]({'action':'status','channel':_0x5e9e51[_0x259787][_0x8606('0xf0')]})['catch'](function(_0xa1307c){if(_0xa1307c[_0x8606('0x68')]===_0x8606('0x15d')){setTimeout(function(){if(_0x5e9e51[_0x259787]&&_0x5e9e51[_0x259787][_0x8606('0x40')]!==_0x8606('0xbc')){utils['decrementOriginate'](_0x120816[_0x8606('0x22')][_0x5e9e51[_0x259787][_0x8606('0xbe')]],_0x8606('0x15e'));logger[_0x8606('0x65')](_0x8606('0x15f'),_0x56a437,_0x259787,_0x5e9e51[_0x259787][_0x8606('0xbe')]);delete _0x5e9e51[_0x259787];}if(_0x5e9e51[_0x259787]&&_0x5e9e51[_0x259787]['type']===_0x8606('0xbc')){utils[_0x8606('0xbd')](_0x120816[_0x8606('0x23')][_0x5e9e51[_0x259787]['queue']],'[clearZombieChannels]');logger[_0x8606('0x65')]('[Dialer][checkChannel][ivr]',_0x56a437,_0x259787,_0x5e9e51[_0x259787][_0x8606('0xbe')]);delete _0x5e9e51[_0x259787];}},0x2328);}});}});}}};Dialer[_0x8606('0x1c')][_0x8606('0x160')]=function(_0x132dd7){return Promise[_0x8606('0xa9')]()[_0x8606('0x3d')](voiceQueueRt[_0x8606('0x160')](_0x132dd7))[_0x8606('0x9c')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x8606('0x1c')][_0x8606('0x161')]=function(_0x33473b,_0x4fee29,_0x1b5120){var _0x59d4b3={'state':0x19,'statedesc':_0x8606('0x162')};utils[_0x8606('0xbd')](_0x4fee29,_0x8606('0x163')+_0x33473b);this[_0x8606('0x164')](_[_0x8606('0x165')](_0x59d4b3,_[_0x8606('0xf9')](_0x1b5120,['ContactId',_0x8606('0xdf'),_0x8606('0x166'),_0x8606('0xe0'),_0x8606('0xe1')])),_0x8606('0x167'),_0x8606('0x163'));logger[_0x8606('0x65')](_0x33473b);};Dialer[_0x8606('0x1c')][_0x8606('0x164')]=function(_0x5096ea,_0x230a8e,_0x5c2923){hopperUtils['createHistory'](_0x5096ea)[_0x8606('0x9c')](loggerCatch(_0x230a8e));hopperUtils[_0x8606('0xc8')](_0x5096ea)['catch'](loggerCatch(_0x5c2923));};Dialer[_0x8606('0x1c')][_0x8606('0xda')]=function(_0x4280bd,_0x3d8080){hopperUtils[_0x8606('0xc6')](_0x4280bd)[_0x8606('0x9c')](loggerCatch(_0x8606('0xc7')));if(_0x3d8080==0x0){hopperUtils[_0x8606('0xc8')](_0x4280bd)[_0x8606('0x9c')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x8606('0x1c')][_0x8606('0x158')]=function(_0x3a6e4e){return Promise['resolve']()[_0x8606('0x3d')](cmHopper[_0x8606('0x153')](_0x3a6e4e['id'],previewRecallmeReminderInterval))[_0x8606('0x3d')](function(_0x5fe51c){for(var _0x4e0dec=0x0;_0x4e0dec<_0x5fe51c[_0x8606('0x101')];_0x4e0dec++){var _0xd8a313=_0x5fe51c[_0x4e0dec]['Agent'][_0x8606('0x61')];if(_0xd8a313)io['to'](util[_0x8606('0x45')](_0x8606('0x156'),_0xd8a313))[_0x8606('0x3f')](_0x8606('0x157'),{'hopper':_0x5fe51c[_0x4e0dec]});}})[_0x8606('0x9c')](function(){});};Dialer[_0x8606('0x1c')]['launchHandleIvr']=function(_0x398190){var _0x2554f5=this;return function(){_0x2554f5[_0x8606('0x168')](_0x398190);};};Dialer[_0x8606('0x1c')][_0x8606('0x169')]=function(_0x43b919,_0x10b857){var _0x2cd223=this;var _0x187be4=uuid['v4']();this[_0x8606('0xef')][_0x187be4]=new Action(_0x43b919,_0x10b857,_0x187be4);return new Promise(function(_0x16e6bb,_0x512021){if(_[_0x8606('0x3e')](_0x43b919)&&typeof _0x43b919!==_0x8606('0x16a')){return _0x512021(msgResponse(_0x8606('0x16b'),_0x8606('0x91'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x10b857[_0x8606('0x16c')])||_0x10b857[_0x8606('0x16c')]===null){return _0x512021(msgResponse(_0x8606('0x16b'),_0x8606('0x91'),_0x8606('0x16d')));}var _0x44cea5={'XMD-CALLERID':_0x2cd223[_0x8606('0xef')][_0x187be4][_0x8606('0x16e')](),'XMD-AGI':_0x43b919[_0x8606('0x13b')]?util[_0x8606('0x45')]('\x22agi://%s/square,%s\x22',ipAgi,_0x43b919[_0x8606('0x13b')]):'NONE','XMD-AGIAFTER':_0x43b919[_0x8606('0xd2')]?util[_0x8606('0x45')]('\x22agi://%s/square,%s\x22',ipAgi,_0x43b919['dialQueueProject2']):_0x8606('0x16f'),'XMD-QUEUE':utils[_0x8606('0x170')](_0x43b919)?util[_0x8606('0x45')](_0x8606('0x171'),_0x43b919['name'],_0x43b919['dialQueueOptions']||'',_0x43b919[_0x8606('0xc5')]?'c':'',_0x43b919[_0x8606('0x172')]||0x3):'NONE','XMD-CONTACTID':_0x10b857['ContactId'],'XMD-CDRTYPE':_0x8606('0x173'),'CALLERID(all)':_0x2cd223[_0x8606('0xef')][_0x187be4]['getCaller'](),'XMD-AMD':_0x43b919[_0x8606('0x117')]?_0x8606('0x149'):_0x8606('0x16f'),'XMD-DESTINATION':_0x8606('0x116')};if(_0x43b919[_0x8606('0x117')]){_0x44cea5['XMD-AMDINITIALSILENCE']=_0x43b919[_0x8606('0x174')]||0x9c4;_0x44cea5['XMD-AMDGREETING']=_0x43b919[_0x8606('0x175')]||0x5dc;_0x44cea5[_0x8606('0x176')]=_0x43b919[_0x8606('0x177')]||0x320;_0x44cea5['XMD-AMDTOTALANALYSISTIME']=_0x43b919[_0x8606('0x178')]||0x1388;_0x44cea5[_0x8606('0x179')]=_0x43b919[_0x8606('0x17a')]||0x64;_0x44cea5[_0x8606('0x17b')]=_0x43b919[_0x8606('0x17c')]||0x32;_0x44cea5[_0x8606('0x17d')]=_0x43b919[_0x8606('0x17e')]||0x3;_0x44cea5[_0x8606('0x17f')]=_0x43b919['dialAMDSilenceThreshold']||0x100;_0x44cea5['XMD-AMDMAXIMUMWORDLENGTH']=_0x43b919[_0x8606('0x180')]||0x1388;}if(utils[_0x8606('0x170')](_0x43b919)){_0x44cea5[_0x8606('0x181')]=_0x10b857[_0x8606('0xe0')];}else{_0x44cea5[_0x8606('0x182')]=_0x10b857['CampaignId'];}var _0x1ef8f6=utils[_0x8606('0x183')](_0x10b857[_0x8606('0x184')]);Object[_0x8606('0x14e')](_0x44cea5,_0x1ef8f6);var _0x3e3c99=_0x2cd223[_0x8606('0x84')](_0x43b919['Trunk'])?utils[_0x8606('0x185')](_0x43b919[_0x8606('0x8a')][_0x8606('0x186')],_0x43b919['dialOriginateCallerIdName'],_0x43b919['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x43b919[_0x8606('0x187')],_0x43b919[_0x8606('0x188')]):_0x43b919['dialOriginateCallerIdNumber']):utils[_0x8606('0x185')](_[_0x8606('0xf5')](_0x43b919[_0x8606('0x189')])?_0x43b919['Trunk'][_0x8606('0x186')]:_0x43b919['TrunkBackup'][_0x8606('0x186')],_0x43b919[_0x8606('0x18a')],_0x43b919[_0x8606('0x188')]>0x0?utils[_0x8606('0x18b')](_0x43b919[_0x8606('0x187')],_0x43b919['dialRandomLastDigitCallerIdNumber']):_0x43b919['dialOriginateCallerIdNumber']);if(_0x3e3c99){_0x44cea5['XMD-ORIGINATECALLERIDNAME']=_0x2cd223[_0x8606('0xef')][_0x187be4][_0x8606('0x18c')]=utils[_0x8606('0x18d')](_0x3e3c99);_0x44cea5['XMD-ORIGINATECALLERIDNUM']=_0x10b857['phone'];}_0x43b919['variables']=_0x44cea5;return ami[_0x8606('0x97')]({'actionid':_0x187be4,'action':'originate','channel':_0x2cd223['isTrunkReachable'](_0x43b919['Trunk'])?util[_0x8606('0x45')](_0x8606('0x18e'),_0x43b919[_0x8606('0x8a')][_0x8606('0x61')],isNotNull(_0x43b919['dialPrefix'])?_0x43b919[_0x8606('0x18f')][_0x8606('0x190')]()||'':'',_0x43b919[_0x8606('0x191')]>0x0?_0x10b857[_0x8606('0x16c')]['substring'](_0x43b919[_0x8606('0x191')]):_0x10b857[_0x8606('0x16c')]):util[_0x8606('0x45')](_0x8606('0x18e'),_['isNil'](_0x43b919[_0x8606('0x189')])?_0x43b919[_0x8606('0x8a')]['name']:_0x43b919[_0x8606('0x189')][_0x8606('0x61')],isNotNull(_0x43b919[_0x8606('0x18f')])?_0x43b919[_0x8606('0x18f')]['trim']()||'':'',_0x43b919['dialCutDigit']>0x0?_0x10b857[_0x8606('0x16c')][_0x8606('0x192')](_0x43b919[_0x8606('0x191')]):_0x10b857[_0x8606('0x16c')]),'callerid':_0x3e3c99,'Exten':_0x8606('0x116'),'Context':_0x8606('0x193'),'Priority':'1','variable':_0x44cea5,'timeout':(_0x43b919[_0x8606('0x194')]||0x1e)*0x3e8,'async':!![],'channelid':_0x187be4})[_0x8606('0x3d')](function(_0x4822b5){return _0x16e6bb(_0x4822b5);})[_0x8606('0x9c')](function(_0x1a52d3){_0x43b919[_0x8606('0x195')]+=0x1;var _0x5e39ab=new History(_0x2cd223['actions'][_0x187be4]);logger[_0x8606('0x65')](util[_0x8606('0x45')]('[originateError]:\x20%s',JSON[_0x8606('0x72')](_0x1a52d3)));_0x5e39ab[_0x8606('0x6c')]=0xe;_0x5e39ab['statedesc']=_0x8606('0x196');_0x5e39ab['starttime']=moment()[_0x8606('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e39ab['endtime']=_0x5e39ab[_0x8606('0x6f')];hopperUtils[_0x8606('0xc6')](_0x5e39ab)[_0x8606('0x9c')](loggerCatch(_0x8606('0x197')));_0x2cd223[_0x8606('0xc8')](_0x5e39ab)[_0x8606('0x9c')](loggerCatch(_0x8606('0x197')))['finally'](function(){delete _0x2cd223['actions'][_0x187be4];return _0x512021(msgResponse(_0x8606('0x16b'),'Error',_0x8606('0x198')));});});});};Dialer[_0x8606('0x1c')][_0x8606('0x199')]=function(_0x33c987,_0x179124,_0x466c31){var _0x2b9066=new History(_0x179124);if(_0x2b9066[_0x8606('0x127')]+_0x2b9066['countcongestionretry']+_0x2b9066[_0x8606('0x128')]+_0x2b9066[_0x8606('0x129')]+_0x2b9066['countdropretry']+_0x2b9066['countabandonedretry']+_0x2b9066[_0x8606('0x125')]+_0x2b9066[_0x8606('0x12a')]>=_0x466c31[_0x8606('0x12b')]-0x1){return!![];}switch(_0x33c987){case 0x3:if(_0x2b9066[_0x8606('0x128')]>=_0x466c31['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x8606('0xdb')]({'active':![],'countnoanswerretry':_0x2b9066[_0x8606('0x128')]+=0x1,'scheduledat':moment()['add'](_0x466c31[_0x8606('0x19a')],_0x8606('0xde'))[_0x8606('0x45')](_0x8606('0xc0')),'ContactId':_0x2b9066[_0x8606('0x109')],'ListId':_0x2b9066[_0x8606('0xdf')],'VoiceQueueId':_0x2b9066[_0x8606('0xe0')]||undefined,'CampaignId':_0x2b9066[_0x8606('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2b9066[_0x8606('0x127')]>=_0x466c31[_0x8606('0x19b')]-0x1){return!![];}hopperUtils[_0x8606('0xdb')]({'active':![],'countbusyretry':_0x2b9066[_0x8606('0x127')]+=0x1,'scheduledat':moment()[_0x8606('0xdc')](_0x466c31[_0x8606('0x19c')],_0x8606('0xde'))['format'](_0x8606('0xc0')),'ContactId':_0x2b9066[_0x8606('0x109')],'ListId':_0x2b9066[_0x8606('0xdf')],'VoiceQueueId':_0x2b9066[_0x8606('0xe0')]||undefined,'CampaignId':_0x2b9066[_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2b9066[_0x8606('0x19d')]>=_0x466c31[_0x8606('0x19e')]-0x1){return!![];}hopperUtils[_0x8606('0xdb')]({'active':![],'countcongestionretry':_0x2b9066['countcongestionretry']+=0x1,'scheduledat':moment()[_0x8606('0xdc')](_0x466c31['dialCongestionRetryFrequency'],_0x8606('0xde'))[_0x8606('0x45')](_0x8606('0xc0')),'ContactId':_0x2b9066[_0x8606('0x109')],'ListId':_0x2b9066[_0x8606('0xdf')],'VoiceQueueId':_0x2b9066[_0x8606('0xe0')]||undefined,'CampaignId':_0x2b9066[_0x8606('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2b9066[_0x8606('0x129')]>=_0x466c31[_0x8606('0x19f')]-0x1){return!![];}else{hopperUtils[_0x8606('0xdb')]({'active':![],'countnosuchnumberretry':_0x2b9066[_0x8606('0x129')]+=0x1,'scheduledat':moment()[_0x8606('0xdc')](_0x466c31[_0x8606('0x1a0')],_0x8606('0xde'))[_0x8606('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b9066[_0x8606('0x109')],'ListId':_0x2b9066['ListId'],'VoiceQueueId':_0x2b9066['VoiceQueueId']||undefined,'CampaignId':_0x2b9066[_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch(_0x8606('0x1a1')));}break;case 0xa:if(_0x2b9066[_0x8606('0xd8')]>=_0x466c31[_0x8606('0xd9')]-0x1){return!![];}hopperUtils[_0x8606('0xdb')]({'active':![],'countdropretry':_0x2b9066[_0x8606('0xd8')]+=0x1,'scheduledat':moment()[_0x8606('0xdc')](_0x466c31['dialDropRetryFrequency'],_0x8606('0xde'))[_0x8606('0x45')](_0x8606('0xc0')),'ContactId':_0x2b9066[_0x8606('0x109')],'ListId':_0x2b9066[_0x8606('0xdf')],'VoiceQueueId':_0x2b9066[_0x8606('0xe0')]||undefined,'CampaignId':_0x2b9066[_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch(_0x8606('0xe2')));break;case 0xb:if(_0x2b9066[_0x8606('0xe9')]>=_0x466c31[_0x8606('0xeb')]-0x1){return!![];}hopperUtils[_0x8606('0xdb')]({'active':![],'countabandonedretry':_0x2b9066['countabandonedretry']+=0x1,'scheduledat':moment()[_0x8606('0xdc')](_0x466c31[_0x8606('0xea')],'minutes')[_0x8606('0x45')](_0x8606('0xc0')),'ContactId':_0x2b9066[_0x8606('0x109')],'ListId':_0x2b9066[_0x8606('0xdf')],'VoiceQueueId':_0x2b9066['VoiceQueueId']||undefined,'CampaignId':_0x2b9066[_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch(_0x8606('0xec')));break;case 0x13:if(_0x2b9066[_0x8606('0x125')]>=_0x466c31[_0x8606('0x12e')]-0x1){return!![];}hopperUtils[_0x8606('0xdb')]({'active':![],'countmachineretry':_0x2b9066[_0x8606('0x125')]+=0x1,'scheduledat':moment()[_0x8606('0xdc')](_0x466c31[_0x8606('0x130')],_0x8606('0xde'))['format'](_0x8606('0xc0')),'ContactId':_0x2b9066['ContactId'],'ListId':_0x2b9066[_0x8606('0xdf')],'VoiceQueueId':_0x2b9066[_0x8606('0xe0')]||undefined,'CampaignId':_0x2b9066[_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch(_0x8606('0x131')));break;case 0x14:if(_0x2b9066[_0x8606('0x12a')]>=_0x466c31[_0x8606('0x1a2')]-0x1){return!![];}hopperUtils[_0x8606('0xdb')]({'active':![],'countagentrejectretry':_0x2b9066[_0x8606('0x12a')]+=0x1,'scheduledat':moment()['add'](_0x466c31[_0x8606('0x1a3')],_0x8606('0xde'))[_0x8606('0x45')](_0x8606('0xc0')),'ContactId':_0x2b9066['ContactId'],'ListId':_0x2b9066['ListId'],'VoiceQueueId':_0x2b9066[_0x8606('0xe0')]||undefined,'CampaignId':_0x2b9066[_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch(_0x8606('0x1a4')));break;default:return!![];}};Dialer[_0x8606('0x1c')][_0x8606('0x112')]=function(_0x5113b9,_0x5bb9c0,_0x1c8106){var _0x129a60=this;var _0x2005c1=new History(_0x5113b9);var _0x33b014=![];var _0x25d72e;var _0x4c3185;return new Promise(function(_0x181929,_0x38d8b6){if(_['isUndefined'](_0x5bb9c0)&&typeof _0x5bb9c0!=='object'){return _0x38d8b6(msgResponse(_0x8606('0x1a5'),'Failure',_0x8606('0x1a6')));}if(_[_0x8606('0x3e')](_0x1c8106)&&typeof _0x1c8106!==_0x8606('0x16a')){return _0x38d8b6(msgResponse('[callProgressDetecting]',_0x8606('0x91'),_0x8606('0x1a7')));}hopperUtils[_0x8606('0xd5')](_0x2005c1,_0x1c8106[_0x8606('0xc2')],_0x5bb9c0)[_0x8606('0x3d')](function(_0x1bb96d){if(_0x1bb96d[_0x8606('0xd7')]==0x1)_0x33b014=!![];switch(_0x1c8106['reason']){case'0':_0x5bb9c0[_0x8606('0x1a8')]+=0x1;_0x2005c1[_0x8606('0x6c')]=0x0;_0x2005c1[_0x8606('0x6d')]=_0x8606('0x1a9');_0x2005c1[_0x8606('0x129')]+=0x1;_0x2005c1[_0x8606('0xd3')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x8606('0x120')](_0x5113b9,_0x8606('0x1aa')));_0x25d72e=_0x5bb9c0[_0x8606('0x1a0')];_0x4c3185=_0x5bb9c0[_0x8606('0xd4')];hopperUtils[_0x8606('0xc6')](_0x2005c1)[_0x8606('0x9c')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x129a60[_0x8606('0x199')](0x0,_0x5113b9,_0x5bb9c0)&&!_0x33b014){if(_0x2005c1[_0x8606('0x129')]>=_0x5bb9c0['dialNoSuchNumberMaxRetry']){_0x129a60[_0x8606('0x12f')](_0x2005c1,_0x181929,_0x38d8b6,'reason\x200\x20no\x20such\x20number....');}else{_0x129a60[_0x8606('0x12c')](_0x2005c1,_0x181929,_0x38d8b6,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5bb9c0['outboundNoAnswerCallsDay']+=0x1;_0x2005c1['state']=0x3;_0x2005c1[_0x8606('0x6d')]='NoAnswer';_0x2005c1[_0x8606('0x128')]+=0x1;_0x2005c1['countglobal']+=0x1;var _0x5280af=ut['buildNoAnswerEventPayload'](_0x5113b9,_0x5bb9c0);ami[_0x8606('0x3f')](_0x8606('0x1ab'),_0x5280af);_0x25d72e=_0x5bb9c0[_0x8606('0x19a')];_0x4c3185=_0x5bb9c0[_0x8606('0xd4')];hopperUtils[_0x8606('0xc6')](_0x2005c1)[_0x8606('0x9c')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x129a60[_0x8606('0x199')](0x3,_0x5113b9,_0x5bb9c0)&&!_0x33b014){if(_0x2005c1[_0x8606('0x128')]>=_0x5bb9c0['dialNoAnswerMaxRetry']){_0x129a60[_0x8606('0x12f')](_0x2005c1,_0x181929,_0x38d8b6,_0x8606('0x1ac'));}else{_0x129a60['stateGlobal'](_0x2005c1,_0x181929,_0x38d8b6,_0x8606('0x1ac'));}}break;case'5':_0x5bb9c0[_0x8606('0x1ad')]+=0x1;_0x2005c1['state']=0x5;_0x2005c1['statedesc']=_0x8606('0x1ae');_0x2005c1[_0x8606('0x127')]+=0x1;_0x2005c1[_0x8606('0xd3')]+=0x1;ami[_0x8606('0x3f')](_0x8606('0x1af'),ut[_0x8606('0x120')](_0x5113b9,_0x8606('0x1b0')));_0x25d72e=_0x5bb9c0[_0x8606('0x19c')];_0x4c3185=_0x5bb9c0[_0x8606('0xd4')];hopperUtils[_0x8606('0xc6')](_0x2005c1)[_0x8606('0x9c')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x129a60[_0x8606('0x199')](0x5,_0x5113b9,_0x5bb9c0)&&!_0x33b014){if(_0x2005c1[_0x8606('0x127')]>=_0x5bb9c0['dialBusyMaxRetry']){_0x129a60['createStateFinal'](_0x2005c1,_0x181929,_0x38d8b6,_0x8606('0x1b1'));}else{_0x129a60[_0x8606('0x12c')](_0x2005c1,_0x181929,_0x38d8b6,_0x8606('0x1b1'));}}break;case'8':_0x5bb9c0[_0x8606('0x1b2')]+=0x1;_0x2005c1[_0x8606('0x6c')]=0x8;_0x2005c1[_0x8606('0x6d')]=_0x8606('0x1b3');_0x2005c1['countcongestionretry']+=0x1;_0x2005c1[_0x8606('0xd3')]+=0x1;_0x25d72e=_0x5bb9c0['dialCongestionRetryFrequency'];_0x4c3185=_0x5bb9c0[_0x8606('0xd4')];ami[_0x8606('0x3f')](_0x8606('0x1b4'),ut[_0x8606('0x120')](_0x5113b9,_0x8606('0x1b5')));hopperUtils[_0x8606('0xc6')](_0x2005c1)[_0x8606('0x9c')](loggerCatch(_0x8606('0x1b6')));if(_0x129a60['checkRetriveMax'](0x8,_0x5113b9,_0x5bb9c0)&&!_0x33b014){if(_0x2005c1[_0x8606('0x19d')]>=_0x5bb9c0['dialCongestionMaxRetry']){_0x129a60[_0x8606('0x12f')](_0x2005c1,_0x181929,_0x38d8b6,_0x8606('0x1b7'));}else{_0x129a60['stateGlobal'](_0x2005c1,_0x181929,_0x38d8b6,'reason\x208\x20congestion');}}break;case'11':_0x5bb9c0['outboundAbandonedCallsDay']+=0x1;_0x2005c1[_0x8606('0x6c')]=0xb;_0x2005c1['statedesc']=_0x8606('0xe6');_0x2005c1[_0x8606('0xe9')]+=0x1;_0x2005c1[_0x8606('0xd3')]+=0x1;_0x25d72e=_0x5bb9c0['dialAbandonedRetryFrequency'];_0x4c3185=_0x5bb9c0[_0x8606('0xd4')];hopperUtils[_0x8606('0xc6')](_0x2005c1)[_0x8606('0x9c')](loggerCatch(_0x8606('0x1b8')));if(_0x129a60[_0x8606('0x199')](0xb,_0x5113b9,_0x5bb9c0)&&!_0x33b014){if(_0x2005c1[_0x8606('0xe9')]>=_0x5bb9c0[_0x8606('0xeb')]){_0x129a60['createStateFinal'](_0x2005c1,_0x181929,_0x38d8b6,_0x8606('0x1b9'));}else{_0x129a60[_0x8606('0x12c')](_0x2005c1,_0x181929,_0x38d8b6,'reason\x2011\x20abandoned');}}break;case'20':_0x5bb9c0[_0x8606('0x1ba')]+=0x1;_0x2005c1[_0x8606('0x6c')]=0x14;_0x2005c1[_0x8606('0x6d')]='AgentReject';_0x2005c1['countagentrejectretry']+=0x1;_0x2005c1[_0x8606('0xd3')]+=0x1;_0x25d72e=_0x5bb9c0[_0x8606('0x1a3')];_0x4c3185=_0x5bb9c0['callAdditionalPhoneAfterMin'];ami[_0x8606('0x3f')](_0x8606('0x1bb'),ut[_0x8606('0x120')](_0x5113b9,_0x8606('0x1bc')));hopperUtils[_0x8606('0xc6')](_0x2005c1)[_0x8606('0x9c')](loggerCatch(_0x8606('0x1bd')));if(_0x129a60[_0x8606('0x199')](0x14,_0x5113b9,_0x5bb9c0)&&!_0x33b014){if(_0x2005c1['countagentrejectretry']>=_0x5bb9c0[_0x8606('0x1a2')]){_0x129a60[_0x8606('0x12f')](_0x2005c1,_0x181929,_0x38d8b6,_0x8606('0x1be'));}else{_0x129a60[_0x8606('0x12c')](_0x2005c1,_0x181929,_0x38d8b6,_0x8606('0x1be'));}}break;default:_0x5bb9c0[_0x8606('0x13f')]+=0x1;_0x2005c1['state']=0xc;_0x2005c1[_0x8606('0x6d')]=_0x1c8106['reason'];_0x25d72e=_0x5bb9c0['dialAgentRejectRetryFrequency'];_0x4c3185=_0x5bb9c0[_0x8606('0xd4')];hopperUtils['createHistory'](_0x2005c1)[_0x8606('0x9c')](loggerCatch(_0x8606('0x1bf')));if(_0x129a60[_0x8606('0x199')](_0x1c8106['reason'],_0x5113b9,_0x5bb9c0)&&!_0x33b014){if(_0x2005c1[_0x8606('0x127')]+_0x2005c1[_0x8606('0x19d')]+_0x2005c1[_0x8606('0x128')]+_0x2005c1[_0x8606('0x129')]+_0x2005c1[_0x8606('0xd8')]+_0x2005c1['countabandonedretry']+_0x2005c1[_0x8606('0x125')]+_0x2005c1['countagentrejectretry']>=_0x5bb9c0[_0x8606('0x12b')]){_0x129a60['stateGlobal'](_0x2005c1,_0x181929,_0x38d8b6,_0x1c8106['reason']);}else{_0x129a60['createStateFinal'](_0x2005c1,_0x181929,_0x38d8b6,_0x1c8106[_0x8606('0xc2')]);}}}})[_0x8606('0x3d')](function(){if(_0x33b014){hopperUtils[_0x8606('0xe5')](_0x2005c1,_0x25d72e,_0x4c3185)['then'](function(){return _0x181929(0x1);});}});});};Dialer[_0x8606('0x1c')][_0x8606('0x12c')]=function(_0x863c6b,_0x233d90,_0x2fa9e2,_0x37c72b){var _0x5b672a=new Final(_0x863c6b);_0x5b672a['state']=0xf;_0x5b672a[_0x8606('0x6d')]=_0x8606('0x1c0');this['createStateFinal'](_0x5b672a,_0x233d90,_0x2fa9e2,_0x37c72b);};Dialer[_0x8606('0x1c')][_0x8606('0x12f')]=function(_0x27c69b,_0x5b9ce3,_0x4e1fc3,_0x517007){hopperUtils[_0x8606('0xc8')](_0x27c69b)['then'](function(){return _0x5b9ce3(msgResponse(_0x8606('0x1a5'),'Success',_0x517007));})[_0x8606('0x9c')](function(){return _0x4e1fc3(msgResponse(_0x8606('0x1c1'),'Failure',_0x8606('0x1c2')));});};Dialer[_0x8606('0x1c')][_0x8606('0xa')]=function(_0x28d297){var _0x29492b=_0x28d297[_0x8606('0x1c3')]/0x64;var _0x319e63=_0x28d297[_0x8606('0xce')]/(_0x28d297[_0x8606('0xce')]+_0x28d297['outboundAnswerCallsDay']);var _0x1eb759=Math[_0x8606('0x1c4')](_0x28d297[_0x8606('0x1c5')]*(_0x28d297[_0x8606('0x1c6')]/0x64));var _0x42ba39=Math['round'](_0x28d297[_0x8606('0x1c5')]*(_0x28d297[_0x8606('0x1c7')]/0x64));var _0x3865dd=_0x28d297['available']+_0x28d297['talking'];var _0x19890d=Math['floor'](_0x28d297[_0x8606('0x5a')]*_0x28d297[_0x8606('0x5d')]*_0x28d297[_0x8606('0x1c8')]*_0x28d297[_0x8606('0x1c9')]);if(_[_0x8606('0x3e')](_0x28d297['startProgressive'])){if(!_[_0x8606('0x3e')](_0x28d297['startPredictive'])){_0x28d297['startPredictive']=undefined;loggerPredictive[_0x8606('0x65')](_0x8606('0x1ca'),_0x8606('0x1cb'));}if(!_[_0x8606('0x3e')](_0x28d297[_0x8606('0x64')])){loggerPredictive[_0x8606('0x65')](_0x8606('0x1ca'),_0x8606('0x1cc'));clearInterval(_0x28d297['handlePredictive']);_0x28d297[_0x8606('0x64')]=undefined;}_0x28d297[_0x8606('0x60')]=moment()['format'](_0x8606('0xc0'));loggerPredictive['info'](_0x28d297[_0x8606('0x61')],_0x8606('0x1cd'),_0x28d297['startProgressive']);this[_0x8606('0xb0')](_0x28d297,0x1);}else if(ifInterval(_0x28d297[_0x8606('0x1ce')],_0x28d297[_0x8606('0x60')])){this[_0x8606('0xb0')](_0x28d297,0x1);loggerPredictiveCalls[_0x8606('0x48')](_0x8606('0x1cf'),_0x28d297[_0x8606('0x60')],_0x28d297[_0x8606('0x61')]);_0x28d297['erlangCalls']=0x0;_0x28d297[_0x8606('0xcf')]=0x0;}else if(_0x29492b<_0x319e63&&_0x28d297[_0x8606('0x1d0')]===_0x8606('0x1d1')){clearPredictiveAttributes(_0x28d297);loggerPredictive[_0x8606('0x48')](_0x8606('0x1d2'),'Dropped\x20calls\x20day',_0x319e63,_0x8606('0x60'),_0x28d297[_0x8606('0x61')]);}else if(_0x19890d<_0x28d297[_0x8606('0xcf')]&&_0x28d297[_0x8606('0x1d0')]==='dropRate'){clearPredictiveAttributes(_0x28d297);loggerPredictive[_0x8606('0x48')](_0x8606('0x1d3'),_0x8606('0x1d4'),_0x19890d,_0x8606('0x1d5'),_0x28d297[_0x8606('0xcf')],_0x8606('0x60'),_0x28d297[_0x8606('0x61')]);}else if(!ifInterval(_0x28d297['dialPredictiveInterval'],_0x28d297[_0x8606('0x60')])&&_[_0x8606('0x3e')](_0x28d297[_0x8606('0x29')])&&!_[_0x8606('0x3e')](_0x28d297[_0x8606('0x60')])){_0x28d297['startPredictive']=moment()[_0x8606('0x45')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8606('0x48')](_0x28d297['name'],_0x8606('0x1d6'),_0x28d297[_0x8606('0x29')]);hopperUtils[_0x8606('0x1d7')](_0x28d297['dialPredictiveInterval'])[_0x8606('0x3d')](this[_0x8606('0x1d8')](_0x28d297))[_0x8606('0x3d')](mergeDataErlangB(_0x28d297))[_0x8606('0x3d')](this[_0x8606('0x1d9')](_0x28d297))[_0x8606('0x9c')](loggerCatchPredictive(_0x8606('0x1da'),_0x28d297));}else if(!ifInterval(_0x28d297[_0x8606('0x1ce')],_0x28d297['startPredictive'])){_0x28d297['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x28d297[_0x8606('0x29')]=moment()[_0x8606('0x45')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8606('0x48')](_0x28d297[_0x8606('0x61')],_0x8606('0x1db'),_0x28d297[_0x8606('0x29')]);clearInterval(_0x28d297[_0x8606('0x64')]);_0x28d297['handlePredictive']=undefined;hopperUtils[_0x8606('0x1d7')](_0x28d297[_0x8606('0x1ce')])[_0x8606('0x3d')](this[_0x8606('0x1d8')](_0x28d297))['then'](mergeDataErlangB(_0x28d297))[_0x8606('0x3d')](this['startMethodPredictive'](_0x28d297))['catch'](loggerCatchPredictive(_0x8606('0x1dc'),_0x28d297));}else if(_0x28d297[_0x8606('0x1c5')]&&_0x3865dd<_0x28d297[_0x8606('0x1c5')]-_0x42ba39){clearPredictiveAttributes(_0x28d297);loggerPredictive['info'](_0x28d297['name'],_0x8606('0x1dd'),_0x3865dd,_0x8606('0x1de'),_0x28d297[_0x8606('0x1c5')],'-',_0x42ba39,'=',_0x28d297['predictiveIntervalAvailable']-_0x42ba39,')');}else if(_0x28d297[_0x8606('0x1c5')]&&_0x3865dd>_0x28d297[_0x8606('0x1c5')]+_0x1eb759){clearPredictiveAttributes(_0x28d297);loggerPredictive[_0x8606('0x48')](_0x28d297[_0x8606('0x61')],_0x8606('0x1dd'),_0x3865dd,_0x8606('0x1df'),_0x28d297['predictiveIntervalAvailable'],'+',_0x1eb759,'=',_0x28d297[_0x8606('0x1c5')]+_0x1eb759,')');}};Dialer[_0x8606('0x1c')][_0x8606('0x1d8')]=function(_0x1bdd54){var _0x3806ee=this;return function(_0x15e9fc){return new Promise(function(_0x31031a,_0x256c53){_[_0x8606('0x165')](_0x1bdd54,_0x15e9fc[0x0]);if(checkGetDataPredictive(_0x15e9fc[0x0])){var _0x5a4a15=_0x1bdd54['predictiveIntervalAvailable']=_0x1bdd54[_0x8606('0x1e0')]+_0x1bdd54[_0x8606('0x146')];var _0x24e250=_0x1bdd54[_0x8606('0x1ce')]*0x3c;var _0x5e5322=_0x15e9fc[0x0][_0x8606('0x52')]+_0x15e9fc[0x0][_0x8606('0x50')];var _0x3a0add=(_0x15e9fc[0x0]['predictiveIntervalAnsweredCalls']+_0x15e9fc[0x0][_0x8606('0x4d')]+_0x15e9fc[0x0][_0x8606('0x4f')])/_0x15e9fc[0x0][_0x8606('0x4a')];_0x1bdd54[_0x8606('0x1c8')]=_0x3a0add>0x0?_0x3a0add:0x1;switch(_0x1bdd54[_0x8606('0x1d0')]){case'dropRate':var _0x134975=_0x1bdd54[_0x8606('0x1c3')]/0x64;return _0x3806ee[_0x8606('0x1e1')](_0x5a4a15,_0x24e250,_0x5e5322,_0x3a0add,_0x134975)[_0x8606('0x3d')](function(_0x30b685){return _0x31031a(_0x30b685);});case _0x8606('0x1e2'):var _0x421055=_0x1bdd54[_0x8606('0x1c3')]/0x64;return _0x3806ee[_0x8606('0x1e3')](_0x5a4a15,_0x24e250,_0x5e5322,_0x3a0add,_0x421055)['then'](function(_0x10684a){return _0x31031a(_0x10684a);});default:return _0x256c53(msgResponse('[getDataPredictive]',_0x8606('0x91'),_0x8606('0x1e4')));}}else{return _0x256c53(msgResponse(_0x8606('0x1e5'),'Failure',_0x8606('0x1e6')));}});};};Dialer['prototype'][_0x8606('0x1e7')]=function(_0x2afe10){var _0x23de83=this;return function(_0x59aa8a){return new Promise(function(_0x3374d3,_0x1670a6){_[_0x8606('0x165')](_0x2afe10,_0x59aa8a[0x0]);if(checkGetDataPredictive(_0x59aa8a[0x0])){loggerPredictive[_0x8606('0x48')](JSON[_0x8606('0x72')](_0x59aa8a[0x0]));if(_0x2afe10[_0x8606('0x1d0')]===_0x8606('0x1d1')){return _0x23de83[_0x8606('0x160')](_0x2afe10['id'])['then'](function(_0x195264){var _0x4a61c0=_0x2afe10['loggedIn']-_0x195264[0x0][_0x8606('0x1e8')];var _0x18bd28=_0x2afe10[_0x8606('0x1ce')]*0x3c;var _0xaa9eeb=_0x59aa8a[0x0][_0x8606('0x52')]+_0x59aa8a[0x0]['predictiveIntervalAvgHoldtime'];var _0x5e3bc1=(_0x59aa8a[0x0][_0x8606('0x4c')]+_0x59aa8a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x59aa8a[0x0][_0x8606('0x4f')])/_0x59aa8a[0x0][_0x8606('0x4a')];var _0x2f09c7=_0x2afe10[_0x8606('0x1c3')]/0x64;_0x2afe10[_0x8606('0x1e9')]=_0x195264[0x0][_0x8606('0x1e8')]||0x0;_0x2afe10[_0x8606('0x1c8')]=_0x5e3bc1>0x0?_0x5e3bc1:0x1;return _0x23de83[_0x8606('0x1e1')](_0x4a61c0,_0x18bd28,_0xaa9eeb,_0x5e3bc1,_0x2f09c7);})[_0x8606('0x3d')](function(_0x400c54){return _0x3374d3(_0x400c54);})['catch'](function(_0x1e650e){return _0x1670a6(msgResponse(_0x8606('0x1ea'),_0x8606('0x91'),JSON[_0x8606('0x72')](_0x1e650e)));});}if(_0x2afe10[_0x8606('0x1d0')]===_0x8606('0x1e2')){return _0x23de83[_0x8606('0x160')](_0x2afe10['id'])['then'](function(_0x3ea33f){var _0x2c7017=_0x2afe10[_0x8606('0x1eb')]-_0x3ea33f[0x0]['outboundQueuePauses'];var _0x123f13=_0x2afe10[_0x8606('0x1ce')]*0x3c;var _0x22a679=_0x59aa8a[0x0][_0x8606('0x52')]+_0x59aa8a[0x0][_0x8606('0x50')];var _0x5255ec=(_0x59aa8a[0x0]['predictiveIntervalAnsweredCalls']+_0x59aa8a[0x0][_0x8606('0x4d')]+_0x59aa8a[0x0][_0x8606('0x4f')])/_0x59aa8a[0x0][_0x8606('0x4a')];var _0x2de721=_0x2afe10[_0x8606('0x1c3')]/0x64;_0x2afe10['predictiveIntervalPauses']=_0x3ea33f[0x0][_0x8606('0x1e8')]||0x0;_0x2afe10['predictiveIntervalHitRate']=_0x5255ec>0x0?_0x5255ec:0x1;return _0x23de83['busyFactor'](_0x2c7017,_0x123f13,_0x22a679,_0x5255ec,_0x2de721);})['then'](function(_0x284053){return _0x3374d3(_0x284053);})[_0x8606('0x9c')](function(_0x89258c){return _0x1670a6(msgResponse(_0x8606('0x1ea'),_0x8606('0x91'),JSON['stringify'](_0x89258c)));});}}else{return _0x1670a6(msgResponse(_0x8606('0x1e5'),_0x8606('0x91'),_0x8606('0x1e6')));}});};};Dialer[_0x8606('0x1c')]['startMethodPredictive']=function(_0x4f1149){var _0x4cec00=this;return function(){var _0x3f51a1=0x0;var _0x21bed7=Math['floor'](_0x4f1149[_0x8606('0x1ec')]*0x3e8);if(_0x21bed7>0x0){_0x21bed7=_0x21bed7<0x64?0x64:_0x21bed7;loggerPredictive[_0x8606('0x48')](_0x4f1149['name'],_0x8606('0x1ed'),_0x21bed7,_0x8606('0x1ee'));_0x4f1149[_0x8606('0x64')]=setInterval(function(){_0x4cec00[_0x8606('0x64')](_0x4f1149);loggerPredictiveCalls[_0x8606('0x48')]('[handlePredictive]',_0x3f51a1+=0x1);},_0x21bed7);}else{loggerPredictive['info'](_0x4f1149[_0x8606('0x61')],_0x8606('0x1ef'));}};};Dialer[_0x8606('0x1c')][_0x8606('0x1f0')]=function(_0x3ad1d5,_0x222c76){var _0xe88571=this;return function(_0x42a06e){if(_[_0x8606('0x47')](_0x42a06e)){if(_[_0x8606('0xf5')](_0x222c76[_0x8606('0x166')])||!_0x222c76[_0x8606('0x1f1')]){if(_0x3ad1d5[_0x8606('0xae')]===_0x8606('0x9')){_0x3ad1d5[_0x8606('0x70')]=_[_0x8606('0x3e')](_0x3ad1d5[_0x8606('0x70')])?!![]:_0x3ad1d5[_0x8606('0x70')];var _0x542f50=uuid['v4']();_0xe88571[_0x8606('0xef')][_0x542f50]=new Action(_0x3ad1d5,_0x222c76,_0x542f50);loggerBooked['info'](_0x8606('0x1f2'),_0x542f50,'queueStatusComplete:\x20',JSON['stringify'](_0x3ad1d5[_0x8606('0x70')]),'Queue:\x20',_0x3ad1d5[_0x8606('0x61')]);if(_0x3ad1d5[_0x8606('0x70')]){_0x3ad1d5[_0x8606('0x70')]=![];_0xe88571['queueBooked'][_0xe88571[_0x8606('0xef')][_0x542f50][_0x8606('0xbe')]]=[];ami[_0x8606('0x97')]({'actionid':_0x542f50,'action':_0x8606('0x1f3'),'queue':_0x3ad1d5[_0x8606('0x61')]})[_0x8606('0x9c')](function(){utils[_0x8606('0xbd')](_0x3ad1d5,'[checkContactBlack]');hopperUtils[_0x8606('0xdb')]({'active':![],'ContactId':_0xe88571['actions'][_0x542f50][_0x8606('0x109')],'ListId':_0xe88571[_0x8606('0xef')][_0x542f50][_0x8606('0xdf')],'VoiceQueueId':_0xe88571[_0x8606('0xef')][_0x542f50][_0x8606('0xe0')]||undefined,'CampaignId':_0xe88571[_0x8606('0xef')][_0x542f50][_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xe88571[_0x8606('0xef')][_0x542f50];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x8606('0x72')](_0x3ad1d5[_0x8606('0x70')]),'Queue:\x20',_0x3ad1d5[_0x8606('0x61')]);utils[_0x8606('0xbd')](_0x3ad1d5,_0x8606('0x1f4'));hopperUtils[_0x8606('0xdb')]({'active':![],'ContactId':_0xe88571['actions'][_0x542f50][_0x8606('0x109')],'ListId':_0xe88571['actions'][_0x542f50]['ListId'],'VoiceQueueId':_0xe88571[_0x8606('0xef')][_0x542f50][_0x8606('0xe0')]||undefined,'CampaignId':_0xe88571['actions'][_0x542f50][_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch(_0x8606('0x1f5')));delete _0xe88571[_0x8606('0xef')][_0x542f50];}}else{return _0xe88571['actionOriginate'](_0x3ad1d5,_0x222c76);}}else{if(utils[_0x8606('0xcd')](undefined,_0x222c76[_0x8606('0x1f6')])<_0x3ad1d5[_0x8606('0x1f7')]*0x3c){if(_0x222c76[_0x8606('0x155')]&&!_0x222c76[_0x8606('0x155')][_0x8606('0x1f8')]){_0xe88571[_0x8606('0x21')]['run'](_0x222c76['id'])[_0x8606('0x1f')](function(){utils[_0x8606('0xbd')](_0x3ad1d5,_0x8606('0x1f4'));});}else{hopperUtils['unlockContact']({'active':![]},_0x222c76['id'],0x1)[_0x8606('0x1f')](function(){utils[_0x8606('0xbd')](_0x3ad1d5,_0x8606('0x1f4'));});}}else{_0x3ad1d5['outboundReCallsDay']+=0x1;utils[_0x8606('0xbd')](_0x3ad1d5,_0x8606('0x1f4'));if(_0x3ad1d5[_0x8606('0x1f9')]){hopperUtils[_0x8606('0xdb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x222c76[_0x8606('0x109')],'ListId':_0x222c76[_0x8606('0xdf')],'VoiceQueueId':_0x222c76[_0x8606('0xe0')]||undefined,'CampaignId':_0x222c76[_0x8606('0xe1')]||undefined})[_0x8606('0x9c')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x8606('0xc6')](createObjHistory(_0x3ad1d5,_0x222c76,utils[_0x8606('0x69')]['QUEUE_RECALL'],0x17,_0x8606('0x1fa')))['catch'](loggerCatch(_0x8606('0x1fb')));}else{_0xe88571[_0x8606('0x164')](createObjHistory(_0x3ad1d5,_0x222c76,utils[_0x8606('0x69')][_0x8606('0x1fc')],0x16,_0x8606('0x1fd')),_0x8606('0x1fe'),'[Originate][HistoryRecallClose]');}}}}else{_0x3ad1d5['outboundBlacklistCallsDay']+=0x1;_0xe88571['saveInDb'](createObjHistory(_0x3ad1d5,_0x222c76,utils[_0x8606('0x69')]['BLACKLIST'],0xd,_0x8606('0x1ff')),_0x8606('0x200'),'[Originate][MoveBlacklist]');throw _0x8606('0x201');}};};Dialer[_0x8606('0x1c')]['handleIvr']=function(_0x49aad9){var _0x5584e4=this;var _0x5c494b=_0x49aad9['limitCalls']-_0x49aad9[_0x8606('0x7c')];emitCampaignSummary(_0x49aad9);if(_0x5c494b>0x0&&_0x49aad9[_0x8606('0x202')]==0x0){if(_0x5c494b>this[_0x8606('0x26')]){_0x5c494b=this[_0x8606('0x26')];}_0x49aad9[_0x8606('0x202')]=0x1;hopperUtils[_0x8606('0x203')](_0x49aad9,_0x5c494b)[_0x8606('0x3d')](function(_0x244339){_0x49aad9['temp']=0x0;if(_0x244339){if(!utils['checkContactEmpty'](_0x244339)){_0x49aad9[_0x8606('0x68')]=utils[_0x8606('0x69')][_0x8606('0x204')];logger[_0x8606('0x48')](_0x8606('0x205')+_0x49aad9[_0x8606('0x61')]);}else{_0x49aad9['originated']+=_0x244339[_0x8606('0x101')];_0x49aad9[_0x8606('0x68')]=utils[_0x8606('0x69')][_0x8606('0x206')];for(var _0x58a7dd=0x0;_0x58a7dd<_0x244339[_0x8606('0x101')];_0x58a7dd+=0x1){_0x49aad9[_0x8606('0x207')]+=0x1;if(_[_0x8606('0xf5')](_0x244339[_0x58a7dd])||_['isNil'](_0x244339[_0x58a7dd]['Contact'])||_[_0x8606('0xf5')](_0x244339[_0x58a7dd][_0x8606('0x16c')])){_0x5584e4[_0x8606('0x161')](_0x8606('0x208'),_0x49aad9,_0x244339[_0x58a7dd]);}else{hopperUtils[_0x8606('0x209')](_[_0x8606('0xf9')](_0x244339[_0x58a7dd],['CampaignId',_0x8606('0x16c')]))[_0x8606('0x3d')](_0x5584e4[_0x8606('0x1f0')](_0x49aad9,_0x244339[_0x58a7dd]))['catch'](function(_0x1faf26){logger[_0x8606('0x65')](_0x8606('0x20a'),_0x1faf26);utils[_0x8606('0xbd')](_0x49aad9,_0x8606('0x20b'));});}}}}})[_0x8606('0x9c')](function(_0x661f2a){_0x49aad9['temp']=0x0;logger[_0x8606('0x65')]('[getContactCampaign2]',_0x661f2a);});}};Dialer['prototype'][_0x8606('0xb0')]=function(_0x54c19d,_0xc72e20){var _0x92d1fb=this;var _0x773b33=[];if(_0xc72e20<0x1||_0x54c19d['dialMethod']==='booked'){_0xc72e20=0x1;}var _0x2f2c87=Math['floor'](_0x54c19d[_0x8606('0x146')]*_0xc72e20)-_0x54c19d[_0x8606('0x7c')];if(_0x54c19d[_0x8606('0x20c')]>0x0){var _0x3cbda2=_0x54c19d[_0x8606('0x20c')]-_0x54c19d[_0x8606('0x7c')]-_0x54c19d[_0x8606('0x1e0')]-_0x54c19d[_0x8606('0x148')];if(_0x2f2c87>_0x3cbda2){_0x2f2c87=_0x3cbda2;}}if(_0x2f2c87>0x0&&_0x54c19d[_0x8606('0x202')]==0x0){if(_0x54c19d[_0x8606('0xae')]===_0x8606('0x9')){_0x2f2c87=0x1;}if(_0x2f2c87>this[_0x8606('0x26')]){_0x2f2c87=this[_0x8606('0x26')];}for(var _0x99a5ef in this[_0x8606('0x24')]){if(typeof this['agents'][_0x99a5ef]!==_0x8606('0xa7')){if(this['agents'][_0x99a5ef]['state']==='not_inuse'&&this[_0x8606('0x24')][_0x99a5ef][_0x8606('0x87')]==='reachable'){_0x773b33[_0x8606('0x9d')](this[_0x8606('0x24')][_0x99a5ef]['id']);}}}_0x54c19d[_0x8606('0x202')]=0x1;hopperUtils[_0x8606('0x20d')](_0x54c19d,_0x773b33,_0x2f2c87)[_0x8606('0x3d')](function(_0x4a0979){_0x54c19d[_0x8606('0x202')]=0x0;if(_0x4a0979){if(!utils['checkContactEmpty'](_0x4a0979)){hopperUtils[_0x8606('0x20e')](_0x54c19d)[_0x8606('0x3d')](sendMessageReschedule(_0x54c19d))[_0x8606('0x9c')](loggerCatch(_0x8606('0x20f')));}else{_0x54c19d[_0x8606('0x7c')]+=_0x4a0979[_0x8606('0x101')];_0x54c19d['message']=_0x54c19d[_0x8606('0xae')]===_0x8606('0x9')?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0x8606('0x69')][_0x8606('0x206')];for(var _0x4b3a77=0x0;_0x4b3a77<_0x4a0979[_0x8606('0x101')];_0x4b3a77+=0x1){if(_[_0x8606('0xf5')](_0x4a0979[_0x4b3a77])||_[_0x8606('0xf5')](_0x4a0979[_0x4b3a77]['Contact'])||_['isNil'](_0x4a0979[_0x4b3a77][_0x8606('0x16c')])){_0x92d1fb['emptyContact']('[actionOriginate]\x20',_0x54c19d,_0x4a0979[_0x4b3a77]);}else{hopperUtils[_0x8606('0x210')](_[_0x8606('0xf9')](_0x4a0979[_0x4b3a77],[_0x8606('0xe0'),_0x8606('0x16c')]))[_0x8606('0x3d')](_0x92d1fb['checkContactBlack'](_0x54c19d,_0x4a0979[_0x4b3a77]))[_0x8606('0x9c')](function(_0x1ae1d5){logger[_0x8606('0x65')](_0x8606('0x211'),_0x1ae1d5);utils[_0x8606('0xbd')](_0x54c19d,_0x8606('0x212'));});}}}}})[_0x8606('0x9c')](function(_0x5e8ece){_0x54c19d[_0x8606('0x202')]=0x0;logger[_0x8606('0x65')](_0x8606('0x213'),_0x5e8ece);});}};Dialer[_0x8606('0x1c')][_0x8606('0x64')]=function(_0x237bf3){if(_0x237bf3[_0x8606('0x20c')]>0x0){var _0x462934=_0x237bf3[_0x8606('0x20c')]-_0x237bf3[_0x8606('0x7c')]-_0x237bf3[_0x8606('0x1e0')];if(_0x462934>0x0&&_0x237bf3[_0x8606('0x202')]==0x0){this['tryOriginatePredictive'](_0x237bf3);}else{loggerPredictiveCalls['info'](_0x8606('0x214'));}}else{this[_0x8606('0x215')](_0x237bf3);}};Dialer[_0x8606('0x1c')]['tryOriginatePredictive']=function(_0x535b33){var _0x23b82b=this;var _0x4b318c=[];_0x535b33[_0x8606('0x7c')]+=0x1;for(var _0x1de815 in this[_0x8606('0x24')]){if(typeof this[_0x8606('0x24')][_0x1de815]!=='undefined'){if(this['agents'][_0x1de815]['state']===_0x8606('0x216')&&this[_0x8606('0x24')][_0x1de815][_0x8606('0x87')]===_0x8606('0x88')){_0x4b318c['push'](this['agents'][_0x1de815]['id']);}}}_0x535b33[_0x8606('0x202')]=0x1;return this['getContactDialer'](_0x535b33['id'],_0x4b318c,0x1,_0x535b33[_0x8606('0x217')],_0x535b33)['then'](function(_0xeeb78b){_0x535b33[_0x8606('0x202')]=0x1;if(_0xeeb78b){if(!utils[_0x8606('0x218')](_0xeeb78b)){utils[_0x8606('0x219')](_0x535b33,0x1,0x0);return hopperUtils[_0x8606('0x20e')](_0x535b33)[_0x8606('0x3d')](sendMessageReschedule(_0x535b33))[_0x8606('0x9c')](loggerCatch(_0x8606('0x20f')));}else{_0x535b33['message']=utils[_0x8606('0x69')]['RUNNING'];if(_[_0x8606('0xf5')](_0xeeb78b[0x0])||_[_0x8606('0xf5')](_0xeeb78b[0x0]['Contact'])||_[_0x8606('0xf5')](_0xeeb78b[0x0][_0x8606('0x16c')])){_0x23b82b[_0x8606('0x161')](_0x8606('0x208'),_0x535b33,_0xeeb78b[0x0]);}else{return hopperUtils[_0x8606('0x210')](_[_0x8606('0xf9')](_0xeeb78b[0x0],['VoiceQueueId',_0x8606('0x16c')]))[_0x8606('0x3d')](_0x23b82b[_0x8606('0x1f0')](_0x535b33,_0xeeb78b[0x0]))[_0x8606('0x9c')](function(_0x5a40f3){logger[_0x8606('0x65')]('[actionOriginatePredictive]',_0x5a40f3);utils['decrementOriginate'](_0x535b33,_0x8606('0x21a'));});}}}})[_0x8606('0x9c')](function(_0x38e374){_0x535b33[_0x8606('0x202')]=0x0;logger['error'](_0x8606('0x213'),_0x38e374);});};Dialer['prototype'][_0x8606('0x1e1')]=function(_0xfa79b6,_0x1e1eb9,_0x5add9d,_0x2f8e60,_0x21ef8f,_0x44fac5){loggerPredictive[_0x8606('0x48')](_0x8606('0x21b'));loggerPredictive['info'](_0x8606('0x21c'),_0xfa79b6);loggerPredictive[_0x8606('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e1eb9);loggerPredictive[_0x8606('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',_0x5add9d);loggerPredictive[_0x8606('0x48')](_0x8606('0x21d'),_0x2f8e60);loggerPredictive[_0x8606('0x48')](_0x8606('0x21e'),_0x21ef8f);loggerPredictive[_0x8606('0x48')](_0x8606('0x53'));return new Promise(function(_0x5c2117,_0x1d2d38){if(_0xfa79b6<=0x0||isNaN(_0xfa79b6)){return _0x1d2d38(msgResponse(_0x8606('0x21f'),_0x8606('0x83'),_0x8606('0x220')+_0xfa79b6));}if(_0x5add9d<=0x0||isNaN(_0x5add9d)){return _0x1d2d38(msgResponse(_0x8606('0x21f'),'Error','Ts\x20=\x20'+_0x5add9d));}if(_0x2f8e60<=0x0||isNaN(_0x2f8e60)){return _0x1d2d38(msgResponse(_0x8606('0x21f'),_0x8606('0x83'),_0x8606('0x221')+_0x2f8e60));}if(_0x1e1eb9<=0x0||isNaN(_0x1e1eb9)){return _0x1d2d38(msgResponse(_0x8606('0x21f'),_0x8606('0x83'),_0x8606('0x222')+_0x1e1eb9));}if(_0x21ef8f<=0x0||isNaN(_0x21ef8f)){return _0x1d2d38(msgResponse(_0x8606('0x21f'),_0x8606('0x83'),'Amax\x20=\x20'+_0x21ef8f));}_0x44fac5=_0x44fac5||0x0;var _0x44eadd=0x1/_0x5add9d;var _0x3fa8fa=0x0;var _0x4d092a=0x0;var _0x2edae1=0x0;var _0x9dc7bc=0x0;for(var _0x30d42e=0x0;_0x2edae1<_0x21ef8f;_0x30d42e+=0x1){_0x4d092a=_0x30d42e/_0x1e1eb9;_0x3fa8fa=(_0x2f8e60*_0x4d092a+_0x44fac5)/_0x44eadd;_0x2edae1=utils[_0x8606('0x223')](_0x3fa8fa,_0xfa79b6);_0x9dc7bc=_0x3fa8fa/_0xfa79b6*(0x1-utils[_0x8606('0x223')](_0x3fa8fa,_0xfa79b6));}return _0x5c2117({'erlangCalls':_0x30d42e,'erlangCallToSecond':_0x1e1eb9/_0x30d42e,'erlangAbandonmentRate':_0x2edae1,'erlangBusyFactor':_0x9dc7bc});});};Dialer['prototype'][_0x8606('0x1e3')]=function(_0x681197,_0x3d04ca,_0x55caf5,_0x2b8a65,_0x323e91,_0x88d5e7){loggerPredictive[_0x8606('0x48')](_0x8606('0x224'));loggerPredictive[_0x8606('0x48')](_0x8606('0x21c'),_0x681197);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d04ca);loggerPredictive[_0x8606('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',_0x55caf5);loggerPredictive[_0x8606('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',_0x2b8a65);loggerPredictive[_0x8606('0x48')](_0x8606('0x225'),_0x323e91);loggerPredictive[_0x8606('0x48')](_0x8606('0x53'));return new Promise(function(_0x3eec68,_0x1fb4b5){if(_0x681197<=0x0||isNaN(_0x681197)){return _0x1fb4b5(msgResponse(_0x8606('0x226'),'Error',_0x8606('0x220')+_0x681197));}if(_0x55caf5<=0x0||isNaN(_0x55caf5)){return _0x1fb4b5(msgResponse('[busyFactor]',_0x8606('0x83'),_0x8606('0x227')+_0x55caf5));}if(_0x2b8a65<=0x0||isNaN(_0x2b8a65)){return _0x1fb4b5(msgResponse(_0x8606('0x226'),'Error','p\x20=\x20'+_0x2b8a65));}if(_0x3d04ca<=0x0||isNaN(_0x3d04ca)){return _0x1fb4b5(msgResponse(_0x8606('0x226'),_0x8606('0x83'),_0x8606('0x222')+_0x3d04ca));}if(_0x323e91<=0x0||isNaN(_0x323e91)){return _0x1fb4b5(msgResponse(_0x8606('0x226'),_0x8606('0x83'),_0x8606('0x228')+_0x323e91));}_0x88d5e7=_0x88d5e7||0x0;var _0x369296=0x1/_0x55caf5;var _0x3f0178=0x0;var _0x42b0ef=0x0;var _0x2660a7=0x0;var _0x28160f=0x0;for(var _0x2a120d=0x0;_0x28160f<_0x323e91;_0x2a120d+=0x1){_0x42b0ef=_0x2a120d/_0x3d04ca;_0x3f0178=(_0x2b8a65*_0x42b0ef+_0x88d5e7)/_0x369296;_0x2660a7=utils[_0x8606('0x223')](_0x3f0178,_0x681197);_0x28160f=_0x3f0178/_0x681197*(0x1-utils[_0x8606('0x223')](_0x3f0178,_0x681197));}return _0x3eec68({'erlangCalls':_0x2a120d,'erlangCallToSecond':_0x3d04ca/_0x2a120d,'erlangAbandonmentRate':_0x2660a7,'erlangBusyFactor':_0x28160f});});};module[_0x8606('0x229')]=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 b821e94..b5b6a52 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 _0x84e5=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','queue','util','lodash','moment','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x7460d8,_0x2fc1a1){var _0x338f82=function(_0x1cec50){while(--_0x1cec50){_0x7460d8['push'](_0x7460d8['shift']());}};_0x338f82(++_0x2fc1a1);}(_0x84e5,0x1d9));var _0x584e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x84e5[_0x17406a];return _0x1501ff;};'use strict';var util=require(_0x584e('0x0'));var _=require(_0x584e('0x1'));var moment=require(_0x584e('0x2'));function checkNameSurname(_0x263247,_0x57eef3,_0x92ac29){var _0x4f528b='';if(!_['isNil'](_0x57eef3)&&'string'===typeof _0x57eef3){_0x4f528b+=_0x57eef3;}if(!_['isNil'](_0x92ac29)&&_0x584e('0x3')===typeof _0x92ac29){_0x4f528b+='\x20'+_0x92ac29;}if(_0x4f528b!==''){return _0x4f528b;}return _0x263247;}function Action(_0x25331c,_0x193e02,_0x4825bd){this[_0x584e('0x4')]=_0x25331c;this[_0x584e('0x5')]=_0x4825bd||undefined;this[_0x584e('0x6')]=checkNameSurname(_0x193e02[_0x584e('0x7')][_0x584e('0x8')],_0x193e02[_0x584e('0x7')][_0x584e('0x9')],_0x193e02[_0x584e('0x7')][_0x584e('0xa')]);this[_0x584e('0xb')]=_0x193e02[_0x584e('0x8')];this['queue']=_0x25331c[_0x584e('0x6')];this[_0x584e('0xc')]=_0x193e02[_0x584e('0xc')]||![];this[_0x584e('0xd')]=_0x25331c[_0x584e('0xd')];this[_0x584e('0xe')]=_0x25331c[_0x584e('0xe')]||0x3;this[_0x584e('0xf')]=_0x193e02[_0x584e('0xf')];this[_0x584e('0x10')]=_0x193e02['countbusyretry'];this['countcongestionretry']=_0x193e02['countcongestionretry'];this[_0x584e('0x11')]=_0x193e02[_0x584e('0x11')];this['countnosuchnumberretry']=_0x193e02[_0x584e('0x12')];this[_0x584e('0x13')]=_0x193e02[_0x584e('0x13')];this[_0x584e('0x14')]=_0x193e02[_0x584e('0x14')];this[_0x584e('0x15')]=_0x193e02['countmachineretry'];this[_0x584e('0x16')]=_0x193e02[_0x584e('0x16')];this['ContactId']=_0x193e02[_0x584e('0x17')];this[_0x584e('0x18')]=_0x193e02[_0x584e('0x18')];this[_0x584e('0x19')]=_0x193e02[_0x584e('0x19')];this[_0x584e('0x1a')]=_0x193e02[_0x584e('0x1a')];this[_0x584e('0x1b')]=_0x193e02['CampaignId'];this[_0x584e('0x1c')]=_0x193e02['id'];this[_0x584e('0x1d')]=_0x193e02[_0x584e('0x7')][_0x584e('0x9')]||'';this[_0x584e('0x1e')]=moment()[_0x584e('0x1f')](_0x584e('0x20'));this[_0x584e('0x21')]=_0x193e02[_0x584e('0x21')];this[_0x584e('0x22')]=_0x193e02[_0x584e('0x22')];this[_0x584e('0x23')]=_0x193e02[_0x584e('0x23')];this[_0x584e('0x24')]=_0x193e02[_0x584e('0x24')];this[_0x584e('0x25')]='';this[_0x584e('0x26')]='';}Action[_0x584e('0x27')][_0x584e('0x28')]=function(){return util[_0x584e('0x1f')]('\x22%s\x22\x20<%s>',this['name'],this[_0x584e('0x4')][_0x584e('0x29')]>0x0?this[_0x584e('0xb')][_0x584e('0x2a')](this[_0x584e('0x4')][_0x584e('0x29')]):this[_0x584e('0xb')]);};Action[_0x584e('0x27')][_0x584e('0x2b')]=function(){return this[_0x584e('0x2c')];};module['exports']=Action; \ No newline at end of file +var _0x1b74=['\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','lodash','moment','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller'];(function(_0xf78723,_0x488321){var _0x18e59c=function(_0x3eacb6){while(--_0x3eacb6){_0xf78723['push'](_0xf78723['shift']());}};_0x18e59c(++_0x488321);}(_0x1b74,0xbe));var _0x41b7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b74[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require(_0x41b7('0x0'));var moment=require(_0x41b7('0x1'));function checkNameSurname(_0x2b48e6,_0x1e41fe,_0xe3bdb6){var _0x2e54da='';if(!_['isNil'](_0x1e41fe)&&_0x41b7('0x2')===typeof _0x1e41fe){_0x2e54da+=_0x1e41fe;}if(!_['isNil'](_0xe3bdb6)&&'string'===typeof _0xe3bdb6){_0x2e54da+='\x20'+_0xe3bdb6;}if(_0x2e54da!==''){return _0x2e54da;}return _0x2b48e6;}function Action(_0x4b0ca0,_0x565e15,_0xb6a97f){this[_0x41b7('0x3')]=_0x4b0ca0;this[_0x41b7('0x4')]=_0xb6a97f||undefined;this[_0x41b7('0x5')]=checkNameSurname(_0x565e15[_0x41b7('0x6')][_0x41b7('0x7')],_0x565e15[_0x41b7('0x6')][_0x41b7('0x8')],_0x565e15[_0x41b7('0x6')]['lastName']);this[_0x41b7('0x9')]=_0x565e15['phone'];this['queue']=_0x4b0ca0['name'];this['active']=_0x565e15[_0x41b7('0xa')]||![];this[_0x41b7('0xb')]=_0x4b0ca0[_0x41b7('0xb')];this['dialQueueTimeout']=_0x4b0ca0[_0x41b7('0xc')]||0x3;this[_0x41b7('0xd')]=_0x565e15[_0x41b7('0xd')];this[_0x41b7('0xe')]=_0x565e15['countbusyretry'];this[_0x41b7('0xf')]=_0x565e15['countcongestionretry'];this[_0x41b7('0x10')]=_0x565e15[_0x41b7('0x10')];this[_0x41b7('0x11')]=_0x565e15[_0x41b7('0x11')];this[_0x41b7('0x12')]=_0x565e15['countdropretry'];this['countabandonedretry']=_0x565e15[_0x41b7('0x13')];this[_0x41b7('0x14')]=_0x565e15[_0x41b7('0x14')];this['countagentrejectretry']=_0x565e15[_0x41b7('0x15')];this[_0x41b7('0x16')]=_0x565e15['ContactId'];this[_0x41b7('0x17')]=_0x565e15[_0x41b7('0x17')];this[_0x41b7('0x18')]=_0x565e15[_0x41b7('0x18')];this[_0x41b7('0x19')]=_0x565e15[_0x41b7('0x19')];this[_0x41b7('0x1a')]=_0x565e15[_0x41b7('0x1a')];this[_0x41b7('0x1b')]=_0x565e15['id'];this[_0x41b7('0x1c')]=_0x565e15['Contact']['firstName']||'';this[_0x41b7('0x1d')]=moment()[_0x41b7('0x1e')](_0x41b7('0x1f'));this['callback']=_0x565e15[_0x41b7('0x20')];this[_0x41b7('0x21')]=_0x565e15[_0x41b7('0x21')];this[_0x41b7('0x22')]=_0x565e15[_0x41b7('0x22')];this[_0x41b7('0x23')]=_0x565e15[_0x41b7('0x23')];this[_0x41b7('0x24')]='';this[_0x41b7('0x25')]='';}Action[_0x41b7('0x26')][_0x41b7('0x27')]=function(){return util[_0x41b7('0x1e')](_0x41b7('0x28'),this[_0x41b7('0x5')],this[_0x41b7('0x3')][_0x41b7('0x29')]>0x0?this[_0x41b7('0x9')][_0x41b7('0x2a')](this['voiceQueue'][_0x41b7('0x29')]):this['number']);};Action[_0x41b7('0x26')][_0x41b7('0x2b')]=function(){return this[_0x41b7('0x2c')];};module[_0x41b7('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 0245550..9383351 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 _0x447c=['membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime'];(function(_0x9d577e,_0x43b574){var _0x34466e=function(_0x31398f){while(--_0x31398f){_0x9d577e['push'](_0x9d577e['shift']());}};_0x34466e(++_0x43b574);}(_0x447c,0x6b));var _0xc447=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x447c[_0x49b207];return _0x2dc8fa;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x5ef39d,_0x4ac78d){this[_0xc447('0x0')]=0x4;this[_0xc447('0x1')]=_0xc447('0x2');this[_0xc447('0x3')]=_0x5ef39d[_0xc447('0x3')];this[_0xc447('0x4')]=_0x5ef39d[_0xc447('0x4')];this[_0xc447('0x5')]=_0x5ef39d['type']===_0xc447('0x6')?_0xc447('0x7'):_0x5ef39d[_0xc447('0x4')];this[_0xc447('0x8')]=_0x5ef39d[_0xc447('0x8')];this['countcongestionretry']=_0x5ef39d[_0xc447('0x9')];this[_0xc447('0xa')]=_0x5ef39d[_0xc447('0xa')];this[_0xc447('0xb')]=_0x5ef39d[_0xc447('0x8')]+_0x5ef39d[_0xc447('0x9')]+_0x5ef39d['countnoanswerretry']+_0x5ef39d[_0xc447('0xc')]+_0x5ef39d[_0xc447('0xd')]+_0x5ef39d[_0xc447('0xe')]+_0x5ef39d['countmachineretry']+_0x5ef39d[_0xc447('0xf')];this[_0xc447('0xc')]=_0x5ef39d[_0xc447('0xc')];this[_0xc447('0xd')]=_0x5ef39d[_0xc447('0xd')];this[_0xc447('0xe')]=_0x5ef39d[_0xc447('0xe')];this[_0xc447('0x10')]=_0x5ef39d[_0xc447('0x10')];this['countagentrejectretry']=_0x5ef39d[_0xc447('0xf')];this[_0xc447('0x11')]=_0x4ac78d[_0xc447('0x11')];this[_0xc447('0x12')]=_0x5ef39d[_0xc447('0x13')];this[_0xc447('0x14')]=_0x5ef39d[_0xc447('0x15')];this[_0xc447('0x16')]=_0x5ef39d[_0xc447('0x16')];this[_0xc447('0x17')]=_0x5ef39d[_0xc447('0x17')];this[_0xc447('0x18')]=_0x5ef39d[_0xc447('0x18')];this[_0xc447('0x19')]=moment()[_0xc447('0x1a')](_0xc447('0x1b'));this['ringtime']=utils[_0xc447('0x1c')](_0x5ef39d[_0xc447('0x17')],_0x5ef39d['starttime']);this[_0xc447('0x1d')]=utils['getSeconds'](_0x5ef39d[_0xc447('0x18')],_0x5ef39d[_0xc447('0x17')]);this[_0xc447('0x1e')]=utils[_0xc447('0x1c')](this[_0xc447('0x19')],_0x5ef39d[_0xc447('0x18')]);this['queue']=_0x4ac78d[_0xc447('0x7')];this[_0xc447('0x1f')]=_0x4ac78d[_0xc447('0x1f')];this['reason']=_0x4ac78d[_0xc447('0x20')];this[_0xc447('0x21')]=_0x5ef39d[_0xc447('0x21')];this[_0xc447('0x22')]=_0x5ef39d[_0xc447('0x22')];this[_0xc447('0x23')]=_0x5ef39d['callbackat'];this[_0xc447('0x24')]=_0x5ef39d[_0xc447('0x24')];this[_0xc447('0x25')]=_0x5ef39d['ContactId'];this['ListId']=_0x5ef39d[_0xc447('0x26')];this[_0xc447('0x27')]=_0x5ef39d[_0xc447('0x27')];this['VoiceQueueId']=_0x5ef39d[_0xc447('0x28')];this[_0xc447('0x29')]=_0x5ef39d['CampaignId'];this[_0xc447('0x2a')]=_0x5ef39d[_0xc447('0x2a')]||'';this[_0xc447('0x2b')]=_0x5ef39d[_0xc447('0x2b')]||'';this[_0xc447('0x2c')]=_0x5ef39d[_0xc447('0x2c')];}module[_0xc447('0x2d')]=AgentComplete; \ No newline at end of file +var _0x9788=['YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','format'];(function(_0x2d3711,_0x43d60d){var _0x477858=function(_0x4ffb1c){while(--_0x4ffb1c){_0x2d3711['push'](_0x2d3711['shift']());}};_0x477858(++_0x43d60d);}(_0x9788,0x9c));var _0x8978=function(_0x5d56f2,_0x49831b){_0x5d56f2=_0x5d56f2-0x0;var _0x269349=_0x9788[_0x5d56f2];return _0x269349;};'use strict';var moment=require(_0x8978('0x0'));var utils=require(_0x8978('0x1'));function AgentComplete(_0x45fc7c,_0x193fe4){this[_0x8978('0x2')]=0x4;this['statedesc']=_0x8978('0x3');this[_0x8978('0x4')]=_0x45fc7c[_0x8978('0x4')];this[_0x8978('0x5')]=_0x45fc7c['type'];this[_0x8978('0x6')]=_0x45fc7c['type']==='outbound'?_0x8978('0x7'):_0x45fc7c[_0x8978('0x5')];this[_0x8978('0x8')]=_0x45fc7c[_0x8978('0x8')];this[_0x8978('0x9')]=_0x45fc7c[_0x8978('0x9')];this[_0x8978('0xa')]=_0x45fc7c[_0x8978('0xa')];this[_0x8978('0xb')]=_0x45fc7c[_0x8978('0x8')]+_0x45fc7c[_0x8978('0x9')]+_0x45fc7c[_0x8978('0xa')]+_0x45fc7c['countnosuchnumberretry']+_0x45fc7c[_0x8978('0xc')]+_0x45fc7c[_0x8978('0xd')]+_0x45fc7c[_0x8978('0xe')]+_0x45fc7c[_0x8978('0xf')];this['countnosuchnumberretry']=_0x45fc7c['countnosuchnumberretry'];this[_0x8978('0xc')]=_0x45fc7c[_0x8978('0xc')];this[_0x8978('0xd')]=_0x45fc7c[_0x8978('0xd')];this[_0x8978('0xe')]=_0x45fc7c[_0x8978('0xe')];this[_0x8978('0xf')]=_0x45fc7c[_0x8978('0xf')];this[_0x8978('0x10')]=_0x193fe4[_0x8978('0x10')];this[_0x8978('0x11')]=_0x45fc7c[_0x8978('0x12')];this[_0x8978('0x13')]=_0x45fc7c[_0x8978('0x14')];this[_0x8978('0x15')]=_0x45fc7c[_0x8978('0x15')];this['responsetime']=_0x45fc7c['responsetime'];this['answertime']=_0x45fc7c[_0x8978('0x16')];this['endtime']=moment()[_0x8978('0x17')](_0x8978('0x18'));this[_0x8978('0x19')]=utils[_0x8978('0x1a')](_0x45fc7c[_0x8978('0x1b')],_0x45fc7c[_0x8978('0x15')]);this[_0x8978('0x1c')]=utils['getSeconds'](_0x45fc7c[_0x8978('0x16')],_0x45fc7c[_0x8978('0x1b')]);this[_0x8978('0x1d')]=utils[_0x8978('0x1a')](this[_0x8978('0x1e')],_0x45fc7c[_0x8978('0x16')]);this['queue']=_0x193fe4[_0x8978('0x7')];this[_0x8978('0x1f')]=_0x193fe4[_0x8978('0x1f')];this['reason']=_0x193fe4[_0x8978('0x20')];this[_0x8978('0x21')]=_0x45fc7c[_0x8978('0x21')];this[_0x8978('0x22')]=_0x45fc7c[_0x8978('0x22')];this[_0x8978('0x23')]=_0x45fc7c[_0x8978('0x23')];this[_0x8978('0x24')]=_0x45fc7c['recallme'];this['ContactId']=_0x45fc7c[_0x8978('0x25')];this['ListId']=_0x45fc7c[_0x8978('0x26')];this[_0x8978('0x27')]=_0x45fc7c[_0x8978('0x27')];this['VoiceQueueId']=_0x45fc7c[_0x8978('0x28')];this[_0x8978('0x29')]=_0x45fc7c[_0x8978('0x29')];this['originatecalleridnum']=_0x45fc7c['originatecalleridnum']||'';this[_0x8978('0x2a')]=_0x45fc7c[_0x8978('0x2a')]||'';this[_0x8978('0x2b')]=_0x45fc7c[_0x8978('0x2b')];}module[_0x8978('0x2c')]=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 e77de3f..7ef35ff 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 _0xa33d=['countnosuchnumberretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x4eddb5,_0xf71395){var _0x5223bb=function(_0x38e7e9){while(--_0x38e7e9){_0x4eddb5['push'](_0x4eddb5['shift']());}};_0x5223bb(++_0xf71395);}(_0xa33d,0xbb));var _0xda33=function(_0x5b4260,_0x1b4823){_0x5b4260=_0x5b4260-0x0;var _0x204aca=_0xa33d[_0x5b4260];return _0x204aca;};'use strict';function Final(_0x5511d1){this[_0xda33('0x0')]=_0x5511d1[_0xda33('0x0')];this['scheduledat']=_0x5511d1[_0xda33('0x1')];this[_0xda33('0x2')]=_0x5511d1[_0xda33('0x2')];this['campaigntype']=_0x5511d1['type']===_0xda33('0x3')?'queue':_0x5511d1[_0xda33('0x2')];this[_0xda33('0x4')]=_0x5511d1[_0xda33('0x4')];this[_0xda33('0x5')]=_0x5511d1[_0xda33('0x5')];this[_0xda33('0x6')]=_0x5511d1['countnoanswerretry'];this[_0xda33('0x7')]=_0x5511d1[_0xda33('0x4')]+_0x5511d1['countcongestionretry']+_0x5511d1['countnoanswerretry']+_0x5511d1['countnosuchnumberretry']+_0x5511d1[_0xda33('0x8')]+_0x5511d1[_0xda33('0x9')]+_0x5511d1['countmachineretry']+_0x5511d1[_0xda33('0xa')];this[_0xda33('0xb')]=_0x5511d1['countnosuchnumberretry'];this[_0xda33('0x8')]=_0x5511d1['countdropretry'];this[_0xda33('0x9')]=_0x5511d1[_0xda33('0x9')];this['countmachineretry']=_0x5511d1[_0xda33('0xc')];this[_0xda33('0xa')]=_0x5511d1[_0xda33('0xa')];this[_0xda33('0xd')]=_0x5511d1['queue'];this[_0xda33('0xe')]=_0x5511d1[_0xda33('0xe')];this['calleridnum']=_0x5511d1[_0xda33('0xf')];this[_0xda33('0x10')]=_0x5511d1[_0xda33('0x10')];this['responsetime']=_0x5511d1[_0xda33('0x11')];this['endtime']=_0x5511d1[_0xda33('0x11')];this['ringtime']=_0x5511d1['ringtime']||0x0;this['holdtime']=_0x5511d1[_0xda33('0x12')]||0x0;this['talktime']=_0x5511d1[_0xda33('0x13')]||0x0;this[_0xda33('0x14')]=_0x5511d1[_0xda33('0x14')];this[_0xda33('0x15')]=_0x5511d1[_0xda33('0x15')];this['callbackat']=_0x5511d1[_0xda33('0x16')];this[_0xda33('0x17')]=_0x5511d1[_0xda33('0x17')];this[_0xda33('0x18')]=_0x5511d1[_0xda33('0x18')];this['ListId']=_0x5511d1[_0xda33('0x19')];this[_0xda33('0x1a')]=_0x5511d1['UserId'];this[_0xda33('0x1b')]=_0x5511d1['VoiceQueueId'];this[_0xda33('0x1c')]=_0x5511d1['CampaignId'];this[_0xda33('0x1d')]=_0x5511d1['originatecalleridnum']||'';this[_0xda33('0x1e')]=_0x5511d1[_0xda33('0x1e')]||'';this[_0xda33('0x1f')]=_0x5511d1[_0xda33('0x1f')];this[_0xda33('0x20')]=_0x5511d1['statedesc'];}module['exports']=Final; \ No newline at end of file +var _0x177e=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x3350f2,_0x185a75){var _0x3badfd=function(_0x25b4e7){while(--_0x25b4e7){_0x3350f2['push'](_0x3350f2['shift']());}};_0x3badfd(++_0x185a75);}(_0x177e,0x12e));var _0xe177=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x177e[_0x20a584];return _0x4b41a8;};'use strict';function Final(_0x28be6a){this[_0xe177('0x0')]=_0x28be6a[_0xe177('0x0')];this[_0xe177('0x1')]=_0x28be6a[_0xe177('0x1')];this['type']=_0x28be6a[_0xe177('0x2')];this[_0xe177('0x3')]=_0x28be6a['type']===_0xe177('0x4')?_0xe177('0x5'):_0x28be6a[_0xe177('0x2')];this[_0xe177('0x6')]=_0x28be6a[_0xe177('0x6')];this[_0xe177('0x7')]=_0x28be6a[_0xe177('0x7')];this[_0xe177('0x8')]=_0x28be6a[_0xe177('0x8')];this[_0xe177('0x9')]=_0x28be6a[_0xe177('0x6')]+_0x28be6a[_0xe177('0x7')]+_0x28be6a['countnoanswerretry']+_0x28be6a[_0xe177('0xa')]+_0x28be6a[_0xe177('0xb')]+_0x28be6a[_0xe177('0xc')]+_0x28be6a['countmachineretry']+_0x28be6a[_0xe177('0xd')];this['countnosuchnumberretry']=_0x28be6a[_0xe177('0xa')];this[_0xe177('0xb')]=_0x28be6a[_0xe177('0xb')];this['countabandonedretry']=_0x28be6a[_0xe177('0xc')];this[_0xe177('0xe')]=_0x28be6a['countmachineretry'];this['countagentrejectretry']=_0x28be6a[_0xe177('0xd')];this['queue']=_0x28be6a[_0xe177('0x5')];this[_0xe177('0xf')]=_0x28be6a[_0xe177('0xf')];this[_0xe177('0x10')]=_0x28be6a[_0xe177('0x10')];this[_0xe177('0x11')]=_0x28be6a['starttime'];this[_0xe177('0x12')]=_0x28be6a[_0xe177('0x12')];this[_0xe177('0x13')]=_0x28be6a[_0xe177('0x12')];this[_0xe177('0x14')]=_0x28be6a['ringtime']||0x0;this[_0xe177('0x15')]=_0x28be6a['holdtime']||0x0;this[_0xe177('0x16')]=_0x28be6a[_0xe177('0x16')]||0x0;this[_0xe177('0x17')]=_0x28be6a[_0xe177('0x17')];this[_0xe177('0x18')]=_0x28be6a[_0xe177('0x18')];this[_0xe177('0x19')]=_0x28be6a['callbackat'];this['recallme']=_0x28be6a[_0xe177('0x1a')];this['ContactId']=_0x28be6a[_0xe177('0x1b')];this[_0xe177('0x1c')]=_0x28be6a[_0xe177('0x1c')];this[_0xe177('0x1d')]=_0x28be6a[_0xe177('0x1d')];this[_0xe177('0x1e')]=_0x28be6a[_0xe177('0x1e')];this['CampaignId']=_0x28be6a[_0xe177('0x1f')];this[_0xe177('0x20')]=_0x28be6a[_0xe177('0x20')]||'';this['originatecalleridname']=_0x28be6a[_0xe177('0x21')]||'';this[_0xe177('0x22')]=_0x28be6a[_0xe177('0x22')];this[_0xe177('0x23')]=_0x28be6a[_0xe177('0x23')];}module[_0xe177('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index bd01878..10dae2e 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 _0x8508=['membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','Answer','scheduledat','type','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','talktime','queue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8508,0x1b0));var _0x8850=function(_0x4c9602,_0x553667){_0x4c9602=_0x4c9602-0x0;var _0x524ddf=_0x8508[_0x4c9602];return _0x524ddf;};'use strict';var moment=require(_0x8850('0x0'));var utils=require(_0x8850('0x1'));function Hangup(_0x483ba7,_0x58517f){this[_0x8850('0x2')]=0x4;this['statedesc']=_0x8850('0x3');this['scheduledat']=_0x483ba7[_0x8850('0x4')];this[_0x8850('0x5')]=_0x483ba7[_0x8850('0x5')];this['campaigntype']=_0x483ba7['type']===_0x8850('0x6')?'queue':_0x483ba7[_0x8850('0x5')];this[_0x8850('0x7')]=_0x483ba7[_0x8850('0x7')]||![];this[_0x8850('0x8')]=_0x483ba7[_0x8850('0x8')];this[_0x8850('0x9')]=_0x483ba7['countcongestionretry'];this[_0x8850('0xa')]=_0x483ba7['countnoanswerretry'];this[_0x8850('0xb')]=_0x483ba7[_0x8850('0x8')]+_0x483ba7['countcongestionretry']+_0x483ba7[_0x8850('0xa')]+_0x483ba7['countnosuchnumberretry']+_0x483ba7[_0x8850('0xc')]+_0x483ba7[_0x8850('0xd')]+_0x483ba7[_0x8850('0xe')]+_0x483ba7[_0x8850('0xf')];this[_0x8850('0x10')]=_0x483ba7[_0x8850('0x10')];this['countdropretry']=_0x483ba7[_0x8850('0xc')];this['countabandonedretry']=_0x483ba7[_0x8850('0xd')];this[_0x8850('0xe')]=_0x483ba7[_0x8850('0xe')];this[_0x8850('0xf')]=_0x483ba7[_0x8850('0xf')];this['uniqueid']=_0x58517f[_0x8850('0x11')];this[_0x8850('0x12')]=_0x483ba7[_0x8850('0x13')];this['calleridnum']=_0x483ba7[_0x8850('0x14')];this[_0x8850('0x15')]=_0x483ba7[_0x8850('0x15')];this['responsetime']=_0x483ba7[_0x8850('0x16')];this[_0x8850('0x17')]=moment()[_0x8850('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8850('0x19')]=utils[_0x8850('0x1a')](_0x483ba7[_0x8850('0x16')],_0x483ba7[_0x8850('0x15')]);this[_0x8850('0x1b')]=0x0;this[_0x8850('0x1c')]=utils[_0x8850('0x1a')](this[_0x8850('0x17')],_0x483ba7[_0x8850('0x16')]);this[_0x8850('0x1d')]=_0x483ba7[_0x8850('0x1d')];this[_0x8850('0x1e')]=_0x8850('0x1f');this[_0x8850('0x20')]=_0x58517f['cause-txt'];this[_0x8850('0x21')]=_0x483ba7[_0x8850('0x21')];this[_0x8850('0x22')]=_0x483ba7[_0x8850('0x22')];this[_0x8850('0x23')]=_0x483ba7[_0x8850('0x23')];this[_0x8850('0x24')]=_0x483ba7[_0x8850('0x24')];this[_0x8850('0x25')]=_0x483ba7[_0x8850('0x25')];this[_0x8850('0x26')]=_0x483ba7[_0x8850('0x26')];this[_0x8850('0x27')]=_0x483ba7[_0x8850('0x27')];this[_0x8850('0x28')]=_0x483ba7['VoiceQueueId'];this[_0x8850('0x29')]=_0x483ba7[_0x8850('0x29')];}module['exports']=Hangup; \ No newline at end of file +var _0x7169=['name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname'];(function(_0xabc4b3,_0x182ea1){var _0x33632c=function(_0x290027){while(--_0x290027){_0xabc4b3['push'](_0xabc4b3['shift']());}};_0x33632c(++_0x182ea1);}(_0x7169,0x100));var _0x9716=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x7169[_0x1eda20];return _0x31b953;};'use strict';var moment=require(_0x9716('0x0'));var utils=require(_0x9716('0x1'));function Hangup(_0x288878,_0x49132f){this[_0x9716('0x2')]=0x4;this['statedesc']=_0x9716('0x3');this[_0x9716('0x4')]=_0x288878[_0x9716('0x4')];this[_0x9716('0x5')]=_0x288878[_0x9716('0x5')];this[_0x9716('0x6')]=_0x288878[_0x9716('0x5')]===_0x9716('0x7')?_0x9716('0x8'):_0x288878['type'];this[_0x9716('0x9')]=_0x288878[_0x9716('0x9')]||![];this[_0x9716('0xa')]=_0x288878['countbusyretry'];this[_0x9716('0xb')]=_0x288878['countcongestionretry'];this[_0x9716('0xc')]=_0x288878[_0x9716('0xc')];this[_0x9716('0xd')]=_0x288878['countbusyretry']+_0x288878[_0x9716('0xb')]+_0x288878[_0x9716('0xc')]+_0x288878['countnosuchnumberretry']+_0x288878[_0x9716('0xe')]+_0x288878[_0x9716('0xf')]+_0x288878[_0x9716('0x10')]+_0x288878[_0x9716('0x11')];this[_0x9716('0x12')]=_0x288878[_0x9716('0x12')];this[_0x9716('0xe')]=_0x288878[_0x9716('0xe')];this[_0x9716('0xf')]=_0x288878[_0x9716('0xf')];this[_0x9716('0x10')]=_0x288878[_0x9716('0x10')];this[_0x9716('0x11')]=_0x288878[_0x9716('0x11')];this['uniqueid']=_0x49132f['uniqueid'];this[_0x9716('0x13')]=_0x288878[_0x9716('0x14')];this[_0x9716('0x15')]=_0x288878[_0x9716('0x16')];this[_0x9716('0x17')]=_0x288878[_0x9716('0x17')];this[_0x9716('0x18')]=_0x288878['responsetime'];this['endtime']=moment()[_0x9716('0x19')](_0x9716('0x1a'));this[_0x9716('0x1b')]=utils[_0x9716('0x1c')](_0x288878[_0x9716('0x18')],_0x288878['starttime']);this[_0x9716('0x1d')]=0x0;this[_0x9716('0x1e')]=utils['getSeconds'](this[_0x9716('0x1f')],_0x288878[_0x9716('0x18')]);this['queue']=_0x288878[_0x9716('0x8')];this[_0x9716('0x20')]=_0x9716('0x21');this[_0x9716('0x22')]=_0x49132f[_0x9716('0x23')];this[_0x9716('0x24')]=_0x288878[_0x9716('0x24')];this[_0x9716('0x25')]=_0x288878[_0x9716('0x25')];this[_0x9716('0x26')]=_0x288878[_0x9716('0x26')];this[_0x9716('0x27')]=_0x288878[_0x9716('0x27')];this['ContactId']=_0x288878[_0x9716('0x28')];this[_0x9716('0x29')]=_0x288878[_0x9716('0x29')];this['UserId']=_0x288878[_0x9716('0x2a')];this['VoiceQueueId']=_0x288878[_0x9716('0x2b')];this[_0x9716('0x2c')]=_0x288878[_0x9716('0x2c')];}module[_0x9716('0x2d')]=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 25afb34..fd35255 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 _0xd5fc=['scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid'];(function(_0x5f5ac5,_0x526505){var _0x3697f2=function(_0x49cec5){while(--_0x49cec5){_0x5f5ac5['push'](_0x5f5ac5['shift']());}};_0x3697f2(++_0x526505);}(_0xd5fc,0xf4));var _0xcd5f=function(_0x565919,_0x42a861){_0x565919=_0x565919-0x0;var _0x23e3f9=_0xd5fc[_0x565919];return _0x23e3f9;};'use strict';var utils=require('../utils');function History(_0x48c24a){this[_0xcd5f('0x0')]=_0x48c24a[_0xcd5f('0x0')];this[_0xcd5f('0x1')]=_0x48c24a['scheduledat']||undefined;this[_0xcd5f('0x2')]=_0x48c24a[_0xcd5f('0x2')];this['campaigntype']=_0x48c24a[_0xcd5f('0x2')]===_0xcd5f('0x3')?'queue':_0x48c24a[_0xcd5f('0x2')];this[_0xcd5f('0x4')]=_0x48c24a['countbusyretry'];this['countcongestionretry']=_0x48c24a[_0xcd5f('0x5')];this[_0xcd5f('0x6')]=_0x48c24a[_0xcd5f('0x6')];this[_0xcd5f('0x7')]=_0x48c24a[_0xcd5f('0x4')]+_0x48c24a[_0xcd5f('0x5')]+_0x48c24a[_0xcd5f('0x6')]+_0x48c24a['countnosuchnumberretry']+_0x48c24a[_0xcd5f('0x8')]+_0x48c24a['countabandonedretry']+_0x48c24a[_0xcd5f('0x9')]+_0x48c24a['countagentrejectretry'];this['countnosuchnumberretry']=_0x48c24a['countnosuchnumberretry'];this[_0xcd5f('0x8')]=_0x48c24a['countdropretry'];this[_0xcd5f('0xa')]=_0x48c24a[_0xcd5f('0xa')];this[_0xcd5f('0x9')]=_0x48c24a['countmachineretry'];this['countagentrejectretry']=_0x48c24a[_0xcd5f('0xb')];this[_0xcd5f('0xc')]=_0x48c24a[_0xcd5f('0xc')];this[_0xcd5f('0xd')]=_0x48c24a[_0xcd5f('0xe')];this[_0xcd5f('0xf')]=_0x48c24a[_0xcd5f('0x10')];this[_0xcd5f('0x11')]=_0x48c24a['starttime'];this[_0xcd5f('0x12')]=_0x48c24a['responsetime'];this['endtime']=_0x48c24a[_0xcd5f('0x12')];this[_0xcd5f('0x13')]=utils[_0xcd5f('0x14')](_0x48c24a['responsetime'],_0x48c24a[_0xcd5f('0x11')]);this[_0xcd5f('0x15')]=0x0;this['talktime']=0x0;this[_0xcd5f('0x16')]=_0x48c24a[_0xcd5f('0x16')];this['callbackuniqueid']=_0x48c24a[_0xcd5f('0x17')];this[_0xcd5f('0x18')]=_0x48c24a[_0xcd5f('0x18')];this['recallme']=_0x48c24a[_0xcd5f('0x19')];this[_0xcd5f('0x1a')]=_0x48c24a[_0xcd5f('0x1a')];this[_0xcd5f('0x1b')]=_0x48c24a['ListId'];this['UserId']=_0x48c24a['UserId'];this[_0xcd5f('0x1c')]=_0x48c24a['VoiceQueueId'];this['CampaignId']=_0x48c24a[_0xcd5f('0x1d')];this['originatecalleridnum']=_0x48c24a[_0xcd5f('0x1e')]||'';this[_0xcd5f('0x1f')]=_0x48c24a[_0xcd5f('0x1f')]||'';this[_0xcd5f('0x20')]=_0x48c24a[_0xcd5f('0x20')];this['statedesc']=_0x48c24a[_0xcd5f('0x21')];}module[_0xcd5f('0x22')]=History; \ No newline at end of file +var _0xc8df=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','responsetime','endtime','getSeconds','starttime','holdtime','talktime','callback','callbackat','recallme','ContactId'];(function(_0x54f348,_0x522a67){var _0x1963bd=function(_0x4c0878){while(--_0x4c0878){_0x54f348['push'](_0x54f348['shift']());}};_0x1963bd(++_0x522a67);}(_0xc8df,0x1cf));var _0xfc8d=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xc8df[_0x1f9f37];return _0x21c080;};'use strict';var utils=require('../utils');function History(_0x5dddca){this[_0xfc8d('0x0')]=_0x5dddca[_0xfc8d('0x0')];this[_0xfc8d('0x1')]=_0x5dddca[_0xfc8d('0x1')]||undefined;this[_0xfc8d('0x2')]=_0x5dddca[_0xfc8d('0x2')];this[_0xfc8d('0x3')]=_0x5dddca[_0xfc8d('0x2')]===_0xfc8d('0x4')?_0xfc8d('0x5'):_0x5dddca['type'];this['countbusyretry']=_0x5dddca[_0xfc8d('0x6')];this[_0xfc8d('0x7')]=_0x5dddca['countcongestionretry'];this[_0xfc8d('0x8')]=_0x5dddca['countnoanswerretry'];this['countglobal']=_0x5dddca[_0xfc8d('0x6')]+_0x5dddca[_0xfc8d('0x7')]+_0x5dddca[_0xfc8d('0x8')]+_0x5dddca[_0xfc8d('0x9')]+_0x5dddca[_0xfc8d('0xa')]+_0x5dddca['countabandonedretry']+_0x5dddca['countmachineretry']+_0x5dddca[_0xfc8d('0xb')];this[_0xfc8d('0x9')]=_0x5dddca['countnosuchnumberretry'];this['countdropretry']=_0x5dddca[_0xfc8d('0xa')];this[_0xfc8d('0xc')]=_0x5dddca[_0xfc8d('0xc')];this['countmachineretry']=_0x5dddca['countmachineretry'];this['countagentrejectretry']=_0x5dddca['countagentrejectretry'];this[_0xfc8d('0x5')]=_0x5dddca['queue'];this[_0xfc8d('0xd')]=_0x5dddca[_0xfc8d('0xe')];this[_0xfc8d('0xf')]=_0x5dddca[_0xfc8d('0x10')];this['starttime']=_0x5dddca['starttime'];this[_0xfc8d('0x11')]=_0x5dddca['responsetime'];this[_0xfc8d('0x12')]=_0x5dddca['responsetime'];this['ringtime']=utils[_0xfc8d('0x13')](_0x5dddca[_0xfc8d('0x11')],_0x5dddca[_0xfc8d('0x14')]);this[_0xfc8d('0x15')]=0x0;this[_0xfc8d('0x16')]=0x0;this[_0xfc8d('0x17')]=_0x5dddca['callback'];this['callbackuniqueid']=_0x5dddca['callbackuniqueid'];this['callbackat']=_0x5dddca[_0xfc8d('0x18')];this['recallme']=_0x5dddca[_0xfc8d('0x19')];this[_0xfc8d('0x1a')]=_0x5dddca[_0xfc8d('0x1a')];this[_0xfc8d('0x1b')]=_0x5dddca[_0xfc8d('0x1b')];this['UserId']=_0x5dddca[_0xfc8d('0x1c')];this[_0xfc8d('0x1d')]=_0x5dddca['VoiceQueueId'];this[_0xfc8d('0x1e')]=_0x5dddca[_0xfc8d('0x1e')];this[_0xfc8d('0x1f')]=_0x5dddca['originatecalleridnum']||'';this[_0xfc8d('0x20')]=_0x5dddca[_0xfc8d('0x20')]||'';this[_0xfc8d('0x21')]=_0x5dddca[_0xfc8d('0x21')];this[_0xfc8d('0x22')]=_0x5dddca[_0xfc8d('0x22')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 53418f0..54fe137 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 _0x7ba8=['uniqueid','name','number','starttime','droptime','endtime','getSeconds','responsetime','holdtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry'];(function(_0x53e029,_0x280473){var _0x1d1885=function(_0x289e9d){while(--_0x289e9d){_0x53e029['push'](_0x53e029['shift']());}};_0x1d1885(++_0x280473);}(_0x7ba8,0x16f));var _0x87ba=function(_0x579840,_0x17d9bf){_0x579840=_0x579840-0x0;var _0x568bd3=_0x7ba8[_0x579840];return _0x568bd3;};'use strict';var utils=require(_0x87ba('0x0'));function QueueCallerAbandon(_0x471b7d,_0x3db0b4){this['scheduledat']=_0x471b7d['scheduledat'];this[_0x87ba('0x1')]=_0x471b7d[_0x87ba('0x1')];this[_0x87ba('0x2')]=_0x471b7d['type']===_0x87ba('0x3')?_0x87ba('0x4'):_0x471b7d[_0x87ba('0x1')];this[_0x87ba('0x5')]=_0x471b7d[_0x87ba('0x5')];this[_0x87ba('0x6')]=_0x471b7d[_0x87ba('0x6')];this['countnoanswerretry']=_0x471b7d[_0x87ba('0x7')];this['countglobal']=_0x471b7d['countbusyretry']+_0x471b7d[_0x87ba('0x6')]+_0x471b7d[_0x87ba('0x7')]+_0x471b7d[_0x87ba('0x8')]+_0x471b7d['countdropretry']+_0x471b7d[_0x87ba('0x9')]+_0x471b7d[_0x87ba('0xa')]+_0x471b7d['countagentrejectretry'];this[_0x87ba('0x8')]=_0x471b7d[_0x87ba('0x8')];this[_0x87ba('0xb')]=_0x471b7d['countdropretry'];this[_0x87ba('0x9')]=_0x471b7d['countabandonedretry'];this[_0x87ba('0xa')]=_0x471b7d[_0x87ba('0xa')];this[_0x87ba('0xc')]=_0x471b7d[_0x87ba('0xc')];this[_0x87ba('0xd')]=_0x3db0b4['uniqueid'];this['calleridname']=_0x471b7d[_0x87ba('0xe')];this['calleridnum']=_0x471b7d[_0x87ba('0xf')];this['starttime']=_0x471b7d[_0x87ba('0x10')];this['responsetime']=_0x471b7d['responsetime'];this[_0x87ba('0x11')]=_0x471b7d[_0x87ba('0x11')];this['dropreason']=_0x471b7d['dropreason'];this[_0x87ba('0x12')]=this[_0x87ba('0x11')];this['ringtime']=utils[_0x87ba('0x13')](_0x471b7d[_0x87ba('0x14')],_0x471b7d[_0x87ba('0x10')]);this[_0x87ba('0x15')]=utils['getSeconds'](this[_0x87ba('0x11')],_0x471b7d[_0x87ba('0x14')]);this[_0x87ba('0x16')]=0x0;this[_0x87ba('0x4')]=_0x3db0b4[_0x87ba('0x4')];this[_0x87ba('0x17')]=_0x3db0b4[_0x87ba('0x18')];this['reason']=_0x3db0b4['reason'];this[_0x87ba('0x19')]=_0x471b7d['callback'];this[_0x87ba('0x1a')]=_0x471b7d[_0x87ba('0x1a')];this['callbackat']=_0x471b7d[_0x87ba('0x1b')];this[_0x87ba('0x1c')]=_0x471b7d[_0x87ba('0x1c')];this[_0x87ba('0x1d')]=_0x471b7d['ContactId'];this[_0x87ba('0x1e')]=_0x471b7d['ListId'];this['UserId']=_0x471b7d[_0x87ba('0x1f')];this['VoiceQueueId']=_0x471b7d['VoiceQueueId'];this['CampaignId']=_0x471b7d[_0x87ba('0x20')];this[_0x87ba('0x21')]=_0x471b7d['originatecalleridnum']||'';this[_0x87ba('0x22')]=_0x471b7d[_0x87ba('0x22')]||'';this['agiafterat']=_0x471b7d[_0x87ba('0x23')];this[_0x87ba('0x24')]=_0x471b7d[_0x87ba('0x24')];this[_0x87ba('0x25')]=_0x471b7d['statedesc'];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xd57a=['../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc'];(function(_0x5141dc,_0x5d9e67){var _0x2c0934=function(_0x6ae790){while(--_0x6ae790){_0x5141dc['push'](_0x5141dc['shift']());}};_0x2c0934(++_0x5d9e67);}(_0xd57a,0x1d9));var _0xad57=function(_0x12f523,_0xd2cb5e){_0x12f523=_0x12f523-0x0;var _0x3cfb0d=_0xd57a[_0x12f523];return _0x3cfb0d;};'use strict';var utils=require(_0xad57('0x0'));function QueueCallerAbandon(_0x4d9c9a,_0x5d2e8c){this[_0xad57('0x1')]=_0x4d9c9a[_0xad57('0x1')];this[_0xad57('0x2')]=_0x4d9c9a['type'];this[_0xad57('0x3')]=_0x4d9c9a['type']===_0xad57('0x4')?_0xad57('0x5'):_0x4d9c9a[_0xad57('0x2')];this[_0xad57('0x6')]=_0x4d9c9a['countbusyretry'];this[_0xad57('0x7')]=_0x4d9c9a[_0xad57('0x7')];this[_0xad57('0x8')]=_0x4d9c9a[_0xad57('0x8')];this[_0xad57('0x9')]=_0x4d9c9a[_0xad57('0x6')]+_0x4d9c9a[_0xad57('0x7')]+_0x4d9c9a['countnoanswerretry']+_0x4d9c9a[_0xad57('0xa')]+_0x4d9c9a['countdropretry']+_0x4d9c9a[_0xad57('0xb')]+_0x4d9c9a[_0xad57('0xc')]+_0x4d9c9a['countagentrejectretry'];this[_0xad57('0xa')]=_0x4d9c9a[_0xad57('0xa')];this[_0xad57('0xd')]=_0x4d9c9a[_0xad57('0xd')];this[_0xad57('0xb')]=_0x4d9c9a[_0xad57('0xb')];this[_0xad57('0xc')]=_0x4d9c9a[_0xad57('0xc')];this[_0xad57('0xe')]=_0x4d9c9a['countagentrejectretry'];this[_0xad57('0xf')]=_0x5d2e8c[_0xad57('0xf')];this[_0xad57('0x10')]=_0x4d9c9a[_0xad57('0x11')];this[_0xad57('0x12')]=_0x4d9c9a[_0xad57('0x13')];this[_0xad57('0x14')]=_0x4d9c9a['starttime'];this[_0xad57('0x15')]=_0x4d9c9a[_0xad57('0x15')];this[_0xad57('0x16')]=_0x4d9c9a[_0xad57('0x16')];this[_0xad57('0x17')]=_0x4d9c9a[_0xad57('0x17')];this['endtime']=this[_0xad57('0x16')];this[_0xad57('0x18')]=utils[_0xad57('0x19')](_0x4d9c9a[_0xad57('0x15')],_0x4d9c9a[_0xad57('0x14')]);this[_0xad57('0x1a')]=utils[_0xad57('0x19')](this[_0xad57('0x16')],_0x4d9c9a['responsetime']);this[_0xad57('0x1b')]=0x0;this[_0xad57('0x5')]=_0x5d2e8c[_0xad57('0x5')];this['membername']=_0x5d2e8c[_0xad57('0x1c')];this[_0xad57('0x1d')]=_0x5d2e8c[_0xad57('0x1d')];this[_0xad57('0x1e')]=_0x4d9c9a[_0xad57('0x1e')];this[_0xad57('0x1f')]=_0x4d9c9a['callbackuniqueid'];this[_0xad57('0x20')]=_0x4d9c9a[_0xad57('0x20')];this['recallme']=_0x4d9c9a['recallme'];this['ContactId']=_0x4d9c9a[_0xad57('0x21')];this[_0xad57('0x22')]=_0x4d9c9a[_0xad57('0x22')];this[_0xad57('0x23')]=_0x4d9c9a[_0xad57('0x23')];this['VoiceQueueId']=_0x4d9c9a[_0xad57('0x24')];this[_0xad57('0x25')]=_0x4d9c9a[_0xad57('0x25')];this['originatecalleridnum']=_0x4d9c9a[_0xad57('0x26')]||'';this[_0xad57('0x27')]=_0x4d9c9a[_0xad57('0x27')]||'';this[_0xad57('0x28')]=_0x4d9c9a[_0xad57('0x28')];this[_0xad57('0x29')]=_0x4d9c9a[_0xad57('0x29')];this[_0xad57('0x2a')]=_0x4d9c9a[_0xad57('0x2a')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 1b086ca..dc43aab 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 _0x2da6=['../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','createHistory','[createHistory]','util','../../../../config/logger','dialer'];(function(_0x577891,_0x50762b){var _0x31ad13=function(_0x1a9ada){while(--_0x1a9ada){_0x577891['push'](_0x577891['shift']());}};_0x31ad13(++_0x50762b);}(_0x2da6,0x1dd));var _0x62da=function(_0x195552,_0x25d4d6){_0x195552=_0x195552-0x0;var _0x48166b=_0x2da6[_0x195552];return _0x48166b;};'use strict';var util=require(_0x62da('0x0'));var logger=require(_0x62da('0x1'))(_0x62da('0x2'));var cmHopper=require(_0x62da('0x3'));var cmHopperAdditionalPhone=require(_0x62da('0x4'));var cmHopperBlack=require(_0x62da('0x5'));var cmHopperHistory=require(_0x62da('0x6'));function inspectError(_0x3552dc){return util['inspect'](_0x3552dc,{'showHidden':![],'depth':null});}function getContactDialer(_0x4a8428,_0xe28204,_0x3163df){return cmHopper[_0x62da('0x7')](_0x4a8428['id'],_0xe28204,_0x3163df,_0x4a8428[_0x62da('0x8')])[_0x62da('0x9')](function(_0x9d9139){_0x4a8428[_0x62da('0xa')]=0x0;logger[_0x62da('0xb')](_0x62da('0xc'),inspectError(_0x9d9139));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x19b866,_0x2a3937){return cmHopper[_0x62da('0xd')](_0x19b866['id'],_0x2a3937,_0x19b866[_0x62da('0x8')])['catch'](function(_0x241090){_0x19b866[_0x62da('0xa')]=0x0;logger[_0x62da('0xb')](_0x62da('0xe'),inspectError(_0x241090));});}exports[_0x62da('0xd')]=getContactDialerIvr;function countReScheduled(_0x5c990c){return cmHopper[_0x62da('0xf')](_0x5c990c)[_0x62da('0x9')](function(_0xd27693){logger[_0x62da('0xb')](_0x62da('0x10'),inspectError(_0xd27693));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x47c18e){return cmHopper[_0x62da('0x11')](_0x47c18e)[_0x62da('0x9')](function(_0x1bd7f9){logger[_0x62da('0xb')](_0x62da('0x12'),inspectError(_0x1bd7f9));});}exports[_0x62da('0x11')]=rescheduleContact;function unlockContact(_0x3c6498,_0x624a1c,_0x2cbdf6){return cmHopper[_0x62da('0x13')](_0x3c6498,_0x624a1c,_0x2cbdf6)[_0x62da('0x9')](function(_0x27ab5f){logger[_0x62da('0xb')](_0x62da('0x14'),inspectError(_0x27ab5f));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x4ad626){return cmHopper[_0x62da('0x15')](_0x4ad626)['catch'](function(_0x4d6482){logger[_0x62da('0xb')](_0x62da('0x16'),inspectError(_0x4d6482));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x29191b){return cmHopperBlack['checkIsBlackList'](_0x29191b)[_0x62da('0x9')](function(_0x37c15d){logger[_0x62da('0xb')](_0x62da('0x17'),inspectError(_0x37c15d));});}exports[_0x62da('0x18')]=checkIsBlackList;function checkIsBlackListIvr(_0x267cef){return cmHopperBlack[_0x62da('0x19')](_0x267cef)[_0x62da('0x9')](function(_0x1cb647){logger['error'](_0x62da('0x1a'),inspectError(_0x1cb647));});}exports[_0x62da('0x19')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2fd925,_0x1f6f96,_0x35f687){return cmHopperAdditionalPhone[_0x62da('0x1b')](_0x2fd925,_0x1f6f96,_0x35f687)[_0x62da('0x9')](function(_0x50ed6b){logger['error']('[verifyAdditionalPhone]',inspectError(_0x50ed6b));});}exports[_0x62da('0x1b')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1d1ef3,_0x14897c,_0x3f6fc9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1d1ef3,_0x14897c,_0x3f6fc9)[_0x62da('0x9')](function(_0x3b9c06){logger['error'](_0x62da('0x1c'),inspectError(_0x3b9c06));});}exports[_0x62da('0x1d')]=swapAdditionalPhones;function avgHandleTime(_0x1775ea){return cmHopperHistory['avgHandleTime'](_0x1775ea)[_0x62da('0x9')](function(_0x87f92b){logger[_0x62da('0xb')]('[avgHandleTime]',inspectError(_0x87f92b));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x3c6274){return cmHopperHistory[_0x62da('0x1e')](_0x3c6274)[_0x62da('0x9')](function(_0x594c5a){logger[_0x62da('0xb')](_0x62da('0x1f'),inspectError(_0x594c5a));});}exports[_0x62da('0x1e')]=createHistory; \ No newline at end of file +var _0x1967=['dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger'];(function(_0x5ec84c,_0xa6b2b1){var _0x4d86d7=function(_0x2ae982){while(--_0x2ae982){_0x5ec84c['push'](_0x5ec84c['shift']());}};_0x4d86d7(++_0xa6b2b1);}(_0x1967,0x173));var _0x7196=function(_0x196cd1,_0x47a35d){_0x196cd1=_0x196cd1-0x0;var _0x10162f=_0x1967[_0x196cd1];return _0x10162f;};'use strict';var util=require('util');var logger=require(_0x7196('0x0'))(_0x7196('0x1'));var cmHopper=require(_0x7196('0x2'));var cmHopperAdditionalPhone=require(_0x7196('0x3'));var cmHopperBlack=require(_0x7196('0x4'));var cmHopperHistory=require(_0x7196('0x5'));function inspectError(_0x302f34){return util[_0x7196('0x6')](_0x302f34,{'showHidden':![],'depth':null});}function getContactDialer(_0x458ae8,_0x3ae43f,_0x5c128f){return cmHopper[_0x7196('0x7')](_0x458ae8['id'],_0x3ae43f,_0x5c128f,_0x458ae8[_0x7196('0x8')])[_0x7196('0x9')](function(_0x40e0af){_0x458ae8[_0x7196('0xa')]=0x0;logger[_0x7196('0xb')]('[getContactDialer]',inspectError(_0x40e0af));});}exports[_0x7196('0x7')]=getContactDialer;function getContactDialerIvr(_0xc6366f,_0x3f846e){return cmHopper[_0x7196('0xc')](_0xc6366f['id'],_0x3f846e,_0xc6366f[_0x7196('0x8')])['catch'](function(_0x49e5fb){_0xc6366f[_0x7196('0xa')]=0x0;logger[_0x7196('0xb')](_0x7196('0xd'),inspectError(_0x49e5fb));});}exports[_0x7196('0xc')]=getContactDialerIvr;function countReScheduled(_0x25b780){return cmHopper[_0x7196('0xe')](_0x25b780)[_0x7196('0x9')](function(_0x325641){logger[_0x7196('0xb')](_0x7196('0xf'),inspectError(_0x325641));});}exports[_0x7196('0xe')]=countReScheduled;function rescheduleContact(_0x4e8c4c){return cmHopper[_0x7196('0x10')](_0x4e8c4c)[_0x7196('0x9')](function(_0x3545aa){logger[_0x7196('0xb')]('[rescheduleContact]',inspectError(_0x3545aa));});}exports[_0x7196('0x10')]=rescheduleContact;function unlockContact(_0x539414,_0xe32933,_0x2590a6){return cmHopper[_0x7196('0x11')](_0x539414,_0xe32933,_0x2590a6)[_0x7196('0x9')](function(_0x12dce7){logger[_0x7196('0xb')](_0x7196('0x12'),inspectError(_0x12dce7));});}exports[_0x7196('0x11')]=unlockContact;function moveContactManagedDialer(_0x3e4e69){return cmHopper[_0x7196('0x13')](_0x3e4e69)[_0x7196('0x9')](function(_0x5b716a){logger['error'](_0x7196('0x14'),inspectError(_0x5b716a));});}exports[_0x7196('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x40418d){return cmHopperBlack['checkIsBlackList'](_0x40418d)[_0x7196('0x9')](function(_0x539d8b){logger['error'](_0x7196('0x15'),inspectError(_0x539d8b));});}exports[_0x7196('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x8dee9d){return cmHopperBlack['checkIsBlackListIvr'](_0x8dee9d)['catch'](function(_0x38d291){logger[_0x7196('0xb')]('[checkIsBlackListIvr]',inspectError(_0x38d291));});}exports[_0x7196('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x27ff84,_0x6e22e5,_0x18d389){return cmHopperAdditionalPhone[_0x7196('0x18')](_0x27ff84,_0x6e22e5,_0x18d389)['catch'](function(_0x3f8178){logger['error'](_0x7196('0x19'),inspectError(_0x3f8178));});}exports[_0x7196('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2e15c7,_0xa69810,_0x70aa65){return cmHopperAdditionalPhone[_0x7196('0x1a')](_0x2e15c7,_0xa69810,_0x70aa65)['catch'](function(_0x57c404){logger[_0x7196('0xb')](_0x7196('0x1b'),inspectError(_0x57c404));});}exports[_0x7196('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4e878f){return cmHopperHistory['avgHandleTime'](_0x4e878f)[_0x7196('0x9')](function(_0x162cfc){logger[_0x7196('0xb')]('[avgHandleTime]',inspectError(_0x162cfc));});}exports[_0x7196('0x1c')]=avgHandleTime;function createHistory(_0x4ecea1){return cmHopperHistory[_0x7196('0x1d')](_0x4ecea1)['catch'](function(_0x30151f){logger[_0x7196('0xb')](_0x7196('0x1e'),inspectError(_0x30151f));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 669d93c..65af7fa 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 _0x917e=['XMD-','setXMDContactVariables','lodash','moment','util','dialer','timezones','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','DISACTIVED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','[checkContactLowerLimitOriginate]\x20','tags','updatedAt','undefined','description','toUpperCase'];(function(_0x308a40,_0x336738){var _0x287fc2=function(_0xffb938){while(--_0xffb938){_0x308a40['push'](_0x308a40['shift']());}};_0x287fc2(++_0x336738);}(_0x917e,0xf2));var _0xe917=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x917e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe917('0x0'));var moment=require(_0xe917('0x1'));var util=require(_0xe917('0x2'));var logger=require('../../../../config/logger')(_0xe917('0x3'));var timezones=require('../../../../config/environment/shared')[_0xe917('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xe917('0x5'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xe917('0x6'),'EMPTY_INTERVAL':_0xe917('0x7'),'INACTIVE':_0xe917('0x8'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xe917('0x9'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xe917('0xa'),'RECALL_TIMEOUT':_0xe917('0xb'),'RUNNING':_0xe917('0xc'),'UNKNOWN_TIMEZONE':_0xe917('0xd'),'UNREACHABLE_TRUNK':_0xe917('0xe')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x181c63){return _0x181c63[_0xe917('0xf')]===_0xe917('0x10');}exports[_0xe917('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x1236c8){return _0x1236c8[_0xe917('0x12')]===_0xe917('0x13');}exports[_0xe917('0x14')]=isIVRCampaign;function isOutboundQueue(_0x262712){return _0x262712['type']==='outbound';}exports[_0xe917('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x20741b){return _0x20741b[_0xe917('0x16')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x533b53){return _0x533b53[_0xe917('0x17')];}exports[_0xe917('0x18')]=isIVRCampaignActive;function getSeconds(_0x5ebf93,_0xd38ef3){var _0xc60121=moment(_0x5ebf93)[_0xe917('0x19')](0x0);var _0x357f5c=moment(_0xd38ef3)[_0xe917('0x19')](0x0);return _0xc60121[_0xe917('0x1a')](_0x357f5c,_0xe917('0x1b'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x5acb17,_0x226dde){var _0x17ed99=![];var _0x1451d8=_0x5acb17[_0xe917('0xf')]!==_0x226dde[_0xe917('0xf')]||_0x5acb17[_0xe917('0x16')]!==_0x226dde['dialActive']||_0x5acb17[_0xe917('0x1c')]!==_0x226dde[_0xe917('0x1c')];var _0x329ba3=_0x5acb17[_0xe917('0x1d')]!==_0x226dde[_0xe917('0x1d')]||_0x5acb17[_0xe917('0x1e')]!==_0x226dde[_0xe917('0x1e')]||_0x5acb17['loggedInDb']!==_0x226dde['loggedInDb']||_0x5acb17[_0xe917('0x1f')]!==_0x226dde['paused']||_0x5acb17[_0xe917('0x20')]!==_0x226dde[_0xe917('0x20')]||_0x5acb17[_0xe917('0x21')]!==_0x226dde['pTalking']||_0x5acb17[_0xe917('0x22')]!==_0x226dde['waiting']||_0x5acb17['inUse']!==_0x226dde[_0xe917('0x23')]||_0x5acb17[_0xe917('0x24')]!==_0x226dde[_0xe917('0x24')];if(_0x5acb17['Trunk']&&_0x226dde['Trunk']){_0x17ed99=_0x5acb17[_0xe917('0x25')]['name']!==_0x226dde[_0xe917('0x25')][_0xe917('0x26')]||_0x5acb17[_0xe917('0x25')][_0xe917('0x17')]!==_0x226dde['Trunk'][_0xe917('0x17')];}return _0x1451d8||_0x329ba3||_0x17ed99;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2a2e2f){var _0x61c323=null;var _0x4f87a2=_0x2a2e2f[_0xe917('0x27')];if(_[_0xe917('0x28')](_0x2a2e2f[_0xe917('0x29')])||_[_0xe917('0x28')](_0x2a2e2f[_0xe917('0x2a')])||_[_0xe917('0x28')](_0x2a2e2f[_0xe917('0x2a')][_0xe917('0x2b')])){_0x61c323=CAMPAIGN_STATUS[_0xe917('0x2c')];}else if(_[_0xe917('0x2d')](_0x2a2e2f[_0xe917('0x29')])||_[_0xe917('0x2d')](_0x2a2e2f['Interval']['Intervals'])){_0x61c323=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x4f87a2&&!timezones[_0x4f87a2]){_0x61c323=CAMPAIGN_STATUS[_0xe917('0x2e')];}return _0x61c323;}function checkAnyValidTrunk(_0x21a891,_0x54266a){var _0xaf5ce=null;var _0x5b2476=_0xe917('0x2f');var _0x578ece=['reachable',_0xe917('0x30')];var _0x6be81e=!![];if(_0x21a891[_0xe917('0x25')]&&_0x21a891[_0xe917('0x25')][_0xe917('0x17')]){_0x5b2476+=_0x21a891[_0xe917('0x25')][_0xe917('0x26')];_0xaf5ce=_0x54266a[_0x5b2476];_0x6be81e=_0x578ece[_0xe917('0x31')](_0xaf5ce['status']);}else if(_0x21a891[_0xe917('0x32')]&&_0x21a891[_0xe917('0x32')][_0xe917('0x17')]){_0x5b2476+=_0x21a891[_0xe917('0x32')]['name'];_0xaf5ce=_0x54266a[_0x5b2476];_0x6be81e=_0x578ece['includes'](_0xaf5ce['status']);}return _0x6be81e;}function getQueueCampaignStatusMessage(_0x35219e,_0x1f1aab){var _0x5df3e2=CAMPAIGN_STATUS['ACTIVE'];var _0x462035=isPreviewCampaign(_0x35219e);if(!isQueueCampaignActive(_0x35219e)){if(_0x462035){_0x5df3e2=CAMPAIGN_STATUS[_0xe917('0x33')];}else{if(_0x35219e[_0xe917('0x24')]===0x0&&_0x35219e[_0xe917('0x20')]===0x0&&_0x35219e[_0xe917('0x22')]===0x0&&(_0x35219e[_0xe917('0x21')]||0x0)===0x0){_0x5df3e2=CAMPAIGN_STATUS['INACTIVE'];}else{_0x5df3e2=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x35219e[_0xe917('0x1e')]===0x0){_0x5df3e2=CAMPAIGN_STATUS[_0xe917('0x34')];}else if(!checkAnyValidTrunk(_0x35219e,_0x1f1aab)){_0x5df3e2=CAMPAIGN_STATUS[_0xe917('0x35')];}else if(!isPreviewCampaign(_0x35219e)){var _0x3709af=checkAnyValidQueueCampaignInterval(_0x35219e);if(_0x3709af){_0x5df3e2=_0x3709af;}}return _0x5df3e2;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5c046c){var _0x2edd23=CAMPAIGN_STATUS[_0xe917('0x36')];if(_0x5c046c[_0xe917('0x24')]===0x0&&_0x5c046c[_0xe917('0x20')]===0x0&&_0x5c046c['waiting']===0x0&&(_0x5c046c[_0xe917('0x21')]||0x0)===0x0){_0x2edd23=CAMPAIGN_STATUS['INACTIVE'];}return _0x2edd23;}exports[_0xe917('0x37')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x33537a){var _0x5a44ad=_0x33537a['match'](/"(.*?)"/);return _0x5a44ad?_0x5a44ad[0x1]:_0x33537a;}exports[_0xe917('0x38')]=extractCalleridName;function getCallerId(_0x68e6a2,_0x45a403,_0x7c4acd){if(!_[_0xe917('0x39')](_0x7c4acd)&&typeof _0x7c4acd===_0xe917('0x3a')&&!_[_0xe917('0x2d')](_0x7c4acd)){if(!_[_0xe917('0x39')](_0x45a403)&&typeof _0x45a403===_0xe917('0x3a')&&!_[_0xe917('0x2d')](_0x45a403)){return util[_0xe917('0x3b')](_0xe917('0x3c'),_0x45a403,_0x7c4acd);}return util[_0xe917('0x3b')](_0xe917('0x3c'),_0x7c4acd,_0x7c4acd);}if(!_['isUndefined'](_0x68e6a2)&&typeof _0x68e6a2==='string'&&!_[_0xe917('0x2d')](_0x68e6a2)){return _0x68e6a2;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x31a4fb,_0x278007){var _0x40d5cd;var _0x6ce51c;var _0x70591e;if(_0x278007<=0x0){_0x278007=0x1;}_0x40d5cd=new RegExp(_0xe917('0x3d')+_0x278007+'}$');_0x6ce51c=Math[_0xe917('0x3e')](0xa,_0x278007-0x1);_0x70591e=Math[_0xe917('0x3e')](0xa,_0x278007)-0x1;return util[_0xe917('0x3b')]('%s',_[_0xe917('0x3f')](_0x31a4fb,_0x40d5cd,_[_0xe917('0x40')](_0x6ce51c,_0x70591e)[_0xe917('0x41')]()));}exports[_0xe917('0x42')]=getCallerIdRandom;function decrementOriginate(_0xecf277,_0x227e35){if(_0xecf277[_0xe917('0x24')]&&_0xecf277['originated']>0x0){_0xecf277[_0xe917('0x24')]-=0x1;}else{logger[_0xe917('0x43')](_0xe917('0x44'),_0x227e35);}}exports[_0xe917('0x45')]=decrementOriginate;function checkContactEmpty(_0x1437c9){return _0x1437c9&&_0x1437c9[_0xe917('0x46')]>0x0;}exports[_0xe917('0x47')]=checkContactEmpty;function erlangb(_0x1bcd85,_0x49de2a){if(_0x49de2a===0x0){return 0x0;}var _0x5a1e4b=0x1;for(var _0x39b814=0x1;_0x39b814<=_0x49de2a;_0x39b814+=0x1){_0x5a1e4b=0x1+_0x5a1e4b*_0x39b814/_0x1bcd85;}return 0x1/_0x5a1e4b;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x2d49a4,_0x14f587,_0x437f6c){if(_0x14f587>_0x437f6c){for(var _0x1765f9=0x0;_0x1765f9<_0x14f587-_0x437f6c;_0x1765f9+=0x1){decrementOriginate(_0x2d49a4,_0xe917('0x48'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x14e8ca){var _0x1b6fb1={};var _0x4bca9f=['id','createdAt',_0xe917('0x49'),_0xe917('0x4a')];const _0x3c367c=0xfa;if(_0x14e8ca){for(var _0x191d16 in _0x14e8ca){if(typeof _0x14e8ca[_0x191d16]!==_0xe917('0x4b')){if(!_[_0xe917('0x28')](_0x14e8ca[_0x191d16])&&!_0x4bca9f[_0xe917('0x31')](_0x191d16)){if(_0x191d16===_0xe917('0x4c')&&_0x14e8ca[_0x191d16][_0xe917('0x46')]>_0x3c367c){_0x1b6fb1['XMD-'+_0x191d16[_0xe917('0x4d')]()]=_0x14e8ca[_0x191d16][_0xe917('0x41')]()['substring'](0x0,_0x3c367c);}else{_0x1b6fb1[_0xe917('0x4e')+_0x191d16[_0xe917('0x4d')]()]=_0x14e8ca[_0x191d16];}}}}}return _0x1b6fb1;}exports[_0xe917('0x4f')]=setXMDContactVariables; \ No newline at end of file +var _0xe048=['ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','tags','undefined','description','XMD-','substring','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','dialActive','available','loggedIn','paused','talking','pTalking','waiting','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup'];(function(_0x2fa67a,_0x100cd8){var _0x6325c8=function(_0x56254d){while(--_0x56254d){_0x2fa67a['push'](_0x2fa67a['shift']());}};_0x6325c8(++_0x100cd8);}(_0xe048,0x78));var _0x8e04=function(_0x2e4272,_0x3a4d55){_0x2e4272=_0x2e4272-0x0;var _0x11a555=_0xe048[_0x2e4272];return _0x11a555;};'use strict';var _=require(_0x8e04('0x0'));var moment=require(_0x8e04('0x1'));var util=require(_0x8e04('0x2'));var logger=require(_0x8e04('0x3'))(_0x8e04('0x4'));var timezones=require(_0x8e04('0x5'))[_0x8e04('0x6')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x8e04('0x7'),'DEACTIVATED':_0x8e04('0x8'),'DISACTIVED':_0x8e04('0x9'),'EMPTY_INTERVAL':_0x8e04('0xa'),'INACTIVE':_0x8e04('0xb'),'NO_AGENTS_LOGGED':_0x8e04('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x8e04('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x8e04('0xe'),'QUEUE_RECALL':_0x8e04('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x8e04('0x10'),'UNKNOWN_TIMEZONE':_0x8e04('0x11'),'UNREACHABLE_TRUNK':_0x8e04('0x12')};exports[_0x8e04('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1d59fd){return _0x1d59fd['dialMethod']===_0x8e04('0x14');}exports[_0x8e04('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x6c1912){return _0x6c1912[_0x8e04('0x16')]===_0x8e04('0x17');}exports[_0x8e04('0x18')]=isIVRCampaign;function isOutboundQueue(_0x523095){return _0x523095[_0x8e04('0x16')]===_0x8e04('0x19');}exports[_0x8e04('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x2e0afc){return _0x2e0afc['dialActive'];}exports[_0x8e04('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3054cd){return _0x3054cd[_0x8e04('0x1c')];}exports[_0x8e04('0x1d')]=isIVRCampaignActive;function getSeconds(_0x236041,_0x2ebd9f){var _0x1e0609=moment(_0x236041)[_0x8e04('0x1e')](0x0);var _0x3b2576=moment(_0x2ebd9f)[_0x8e04('0x1e')](0x0);return _0x1e0609[_0x8e04('0x1f')](_0x3b2576,_0x8e04('0x20'));}exports[_0x8e04('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x574a95,_0x5bdbef){var _0x5ba4d4=![];var _0x4aa1a4=_0x574a95[_0x8e04('0x22')]!==_0x5bdbef[_0x8e04('0x22')]||_0x574a95[_0x8e04('0x23')]!==_0x5bdbef['dialActive']||_0x574a95['message']!==_0x5bdbef['message'];var _0x498f56=_0x574a95['available']!==_0x5bdbef[_0x8e04('0x24')]||_0x574a95[_0x8e04('0x25')]!==_0x5bdbef[_0x8e04('0x25')]||_0x574a95['loggedInDb']!==_0x5bdbef['loggedInDb']||_0x574a95[_0x8e04('0x26')]!==_0x5bdbef[_0x8e04('0x26')]||_0x574a95[_0x8e04('0x27')]!==_0x5bdbef['talking']||_0x574a95[_0x8e04('0x28')]!==_0x5bdbef[_0x8e04('0x28')]||_0x574a95[_0x8e04('0x29')]!==_0x5bdbef[_0x8e04('0x29')]||_0x574a95['inUse']!==_0x5bdbef['inUse']||_0x574a95[_0x8e04('0x2a')]!==_0x5bdbef['originated'];if(_0x574a95[_0x8e04('0x2b')]&&_0x5bdbef['Trunk']){_0x5ba4d4=_0x574a95[_0x8e04('0x2b')][_0x8e04('0x2c')]!==_0x5bdbef['Trunk']['name']||_0x574a95[_0x8e04('0x2b')][_0x8e04('0x1c')]!==_0x5bdbef['Trunk'][_0x8e04('0x1c')];}return _0x4aa1a4||_0x498f56||_0x5ba4d4;}exports[_0x8e04('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3afc29){var _0x5cfabe=null;var _0xb4ae70=_0x3afc29['dialTimezone'];if(_[_0x8e04('0x2e')](_0x3afc29[_0x8e04('0x2f')])||_[_0x8e04('0x2e')](_0x3afc29[_0x8e04('0x30')])||_[_0x8e04('0x2e')](_0x3afc29['Interval'][_0x8e04('0x31')])){_0x5cfabe=CAMPAIGN_STATUS[_0x8e04('0x32')];}else if(_['isEmpty'](_0x3afc29[_0x8e04('0x2f')])||_['isEmpty'](_0x3afc29[_0x8e04('0x30')][_0x8e04('0x31')])){_0x5cfabe=CAMPAIGN_STATUS[_0x8e04('0x33')];}else if(_0xb4ae70&&!timezones[_0xb4ae70]){_0x5cfabe=CAMPAIGN_STATUS[_0x8e04('0x34')];}return _0x5cfabe;}function checkAnyValidTrunk(_0x29f651,_0x5a1cb6){var _0x65f001=null;var _0x3fc972='SIP/';var _0x51d31b=[_0x8e04('0x35'),_0x8e04('0x36')];var _0x1885b4=!![];if(_0x29f651[_0x8e04('0x2b')]&&_0x29f651[_0x8e04('0x2b')][_0x8e04('0x1c')]){_0x3fc972+=_0x29f651[_0x8e04('0x2b')][_0x8e04('0x2c')];_0x65f001=_0x5a1cb6[_0x3fc972];_0x1885b4=_0x51d31b[_0x8e04('0x37')](_0x65f001[_0x8e04('0x38')]);}else if(_0x29f651[_0x8e04('0x39')]&&_0x29f651[_0x8e04('0x39')][_0x8e04('0x1c')]){_0x3fc972+=_0x29f651['TrunkBackup'][_0x8e04('0x2c')];_0x65f001=_0x5a1cb6[_0x3fc972];_0x1885b4=_0x51d31b[_0x8e04('0x37')](_0x65f001[_0x8e04('0x38')]);}return _0x1885b4;}function getQueueCampaignStatusMessage(_0x5d983c,_0x6b9af2){var _0x16a7aa=CAMPAIGN_STATUS[_0x8e04('0x3a')];var _0x389eab=isPreviewCampaign(_0x5d983c);if(!isQueueCampaignActive(_0x5d983c)){if(_0x389eab){_0x16a7aa=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x5d983c[_0x8e04('0x2a')]===0x0&&_0x5d983c[_0x8e04('0x27')]===0x0&&_0x5d983c['waiting']===0x0&&(_0x5d983c['pTalking']||0x0)===0x0){_0x16a7aa=CAMPAIGN_STATUS[_0x8e04('0x3b')];}else{_0x16a7aa=CAMPAIGN_STATUS[_0x8e04('0x3c')];}}}else if(_0x5d983c[_0x8e04('0x25')]===0x0){_0x16a7aa=CAMPAIGN_STATUS[_0x8e04('0x3d')];}else if(!checkAnyValidTrunk(_0x5d983c,_0x6b9af2)){_0x16a7aa=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x5d983c)){var _0x1ec499=checkAnyValidQueueCampaignInterval(_0x5d983c);if(_0x1ec499){_0x16a7aa=_0x1ec499;}}return _0x16a7aa;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x14e646){var _0x22adec=CAMPAIGN_STATUS[_0x8e04('0x3c')];if(_0x14e646['originated']===0x0&&_0x14e646[_0x8e04('0x27')]===0x0&&_0x14e646[_0x8e04('0x29')]===0x0&&(_0x14e646[_0x8e04('0x28')]||0x0)===0x0){_0x22adec=CAMPAIGN_STATUS['INACTIVE'];}return _0x22adec;}exports[_0x8e04('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2bf461){var _0x3504c7=_0x2bf461['match'](/"(.*?)"/);return _0x3504c7?_0x3504c7[0x1]:_0x2bf461;}exports[_0x8e04('0x3f')]=extractCalleridName;function getCallerId(_0x38025e,_0x226c7c,_0xc932ce){if(!_[_0x8e04('0x40')](_0xc932ce)&&typeof _0xc932ce===_0x8e04('0x41')&&!_[_0x8e04('0x42')](_0xc932ce)){if(!_['isUndefined'](_0x226c7c)&&typeof _0x226c7c===_0x8e04('0x41')&&!_['isEmpty'](_0x226c7c)){return util[_0x8e04('0x43')](_0x8e04('0x44'),_0x226c7c,_0xc932ce);}return util[_0x8e04('0x43')](_0x8e04('0x44'),_0xc932ce,_0xc932ce);}if(!_['isUndefined'](_0x38025e)&&typeof _0x38025e===_0x8e04('0x41')&&!_['isEmpty'](_0x38025e)){return _0x38025e;}return _0x8e04('0x45');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x5034b8,_0x26af3e){var _0x386825;var _0x5c2f72;var _0x588d8d;if(_0x26af3e<=0x0){_0x26af3e=0x1;}_0x386825=new RegExp(_0x8e04('0x46')+_0x26af3e+'}$');_0x5c2f72=Math[_0x8e04('0x47')](0xa,_0x26af3e-0x1);_0x588d8d=Math[_0x8e04('0x47')](0xa,_0x26af3e)-0x1;return util['format']('%s',_[_0x8e04('0x48')](_0x5034b8,_0x386825,_['random'](_0x5c2f72,_0x588d8d)[_0x8e04('0x49')]()));}exports[_0x8e04('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x4a6570,_0x494e87){if(_0x4a6570[_0x8e04('0x2a')]&&_0x4a6570[_0x8e04('0x2a')]>0x0){_0x4a6570['originated']-=0x1;}else{logger['error'](_0x8e04('0x4b'),_0x494e87);}}exports[_0x8e04('0x4c')]=decrementOriginate;function checkContactEmpty(_0x3c27d2){return _0x3c27d2&&_0x3c27d2[_0x8e04('0x4d')]>0x0;}exports[_0x8e04('0x4e')]=checkContactEmpty;function erlangb(_0x48a082,_0x11a0a7){if(_0x11a0a7===0x0){return 0x0;}var _0x1cb5a5=0x1;for(var _0xbbc680=0x1;_0xbbc680<=_0x11a0a7;_0xbbc680+=0x1){_0x1cb5a5=0x1+_0x1cb5a5*_0xbbc680/_0x48a082;}return 0x1/_0x1cb5a5;}exports[_0x8e04('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x59e5da,_0x23b279,_0x46ba8b){if(_0x23b279>_0x46ba8b){for(var _0x4285c7=0x0;_0x4285c7<_0x23b279-_0x46ba8b;_0x4285c7+=0x1){decrementOriginate(_0x59e5da,_0x8e04('0x50'));}}}exports[_0x8e04('0x51')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x331c33){var _0x37a622={};var _0x3547d3=['id',_0x8e04('0x52'),_0x8e04('0x53'),'updatedAt'];const _0x524a2f=0xfa;if(_0x331c33){for(var _0x4140de in _0x331c33){if(typeof _0x331c33[_0x4140de]!==_0x8e04('0x54')){if(!_['isNil'](_0x331c33[_0x4140de])&&!_0x3547d3[_0x8e04('0x37')](_0x4140de)){if(_0x4140de===_0x8e04('0x55')&&_0x331c33[_0x4140de][_0x8e04('0x4d')]>_0x524a2f){_0x37a622[_0x8e04('0x56')+_0x4140de['toUpperCase']()]=_0x331c33[_0x4140de]['toString']()[_0x8e04('0x57')](0x0,_0x524a2f);}else{_0x37a622[_0x8e04('0x56')+_0x4140de['toUpperCase']()]=_0x331c33[_0x4140de];}}}}}return _0x37a622;}exports[_0x8e04('0x58')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 4972911..9bf160a 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(_0x44e4b7,_0x55ebac){var _0x56cdea=function(_0x519dc4){while(--_0x519dc4){_0x44e4b7['push'](_0x44e4b7['shift']());}};_0x56cdea(++_0x55ebac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x39407d,_0x33d662){var _0x2282ea=function(_0x1df132){while(--_0x1df132){_0x39407d['push'](_0x39407d['shift']());}};_0x2282ea(++_0x33d662);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 f58e713..8661b41 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 _0xbfdb=['fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','application/pdf','then','notify','calleridnum','.pdf','\x20notify\x20','error','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xbfdb,0x1d4));var _0xbbfd=function(_0x68f6a2,_0x292f96){_0x68f6a2=_0x68f6a2-0x0;var _0x52d81e=_0xbfdb[_0x68f6a2];return _0x52d81e;};'use strict';var util=require(_0xbbfd('0x0'));var _=require(_0xbbfd('0x1'));var BPromise=require(_0xbbfd('0x2'));var uuid=require('uuid');var moment=require(_0xbbfd('0x3'));var path=require(_0xbbfd('0x4'));var tiff2pdf=require(_0xbbfd('0x5'));var gs=require(_0xbbfd('0x6'));var logger=require(_0xbbfd('0x7'))(_0xbbfd('0x8'));var ami=require(_0xbbfd('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xbbfd('0xa'));var ut=require(_0xbbfd('0xb'));var Action=require(_0xbbfd('0xc'));var faxAccount=require(_0xbbfd('0xd'));var attachment=require(_0xbbfd('0xe'));var faxMessage=require(_0xbbfd('0xf'));function Fax(_0x69bc47){this[_0xbbfd('0x10')]={};this[_0xbbfd('0x11')]=_0x69bc47['faxAccounts'];this[_0xbbfd('0x12')]=_0x69bc47[_0xbbfd('0x12')];this[_0xbbfd('0x13')]={};ami['on']('newchannel',this[_0xbbfd('0x14')][_0xbbfd('0x15')](this));ami['on'](_0xbbfd('0x16'),this[_0xbbfd('0x17')][_0xbbfd('0x15')](this));ami['on'](_0xbbfd('0x18'),this[_0xbbfd('0x19')][_0xbbfd('0x15')](this));ami['on']('newexten',this[_0xbbfd('0x1a')]['bind'](this));ami['on'](_0xbbfd('0x1b'),this['syncFaxStatus'][_0xbbfd('0x15')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0xbbfd('0x1c'),this['syncHangup'][_0xbbfd('0x15')](this));ami['on'](_0xbbfd('0x1d'),this[_0xbbfd('0x1e')][_0xbbfd('0x15')](this));}Fax[_0xbbfd('0x1f')][_0xbbfd('0x14')]=function(_0xd9e8da){if(_0xd9e8da[_0xbbfd('0x20')]===_0xbbfd('0x21')){for(var _0x2642e3 in this[_0xbbfd('0x11')]){if(this[_0xbbfd('0x11')][_0xbbfd('0x22')](_0x2642e3)){if(_0xd9e8da[_0xbbfd('0x23')]===this[_0xbbfd('0x11')][_0x2642e3]['localstationid']){this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]]={};this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]][_0xbbfd('0x25')]=_0xd9e8da[_0xbbfd('0x25')];this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]]['id']=this['faxAccounts'][_0x2642e3]['id'];this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]][_0xbbfd('0x26')]=this[_0xbbfd('0x11')][_0x2642e3][_0xbbfd('0x26')];logger[_0xbbfd('0x27')](_0xd9e8da['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0xd9e8da[_0xbbfd('0x24')]]){this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]]={};this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]]['channel']=_0xd9e8da['channel'];logger['info'](_0xd9e8da[_0xbbfd('0x24')],_0xbbfd('0x28'));}};Fax['prototype'][_0xbbfd('0x17')]=function(_0x50125c){if(this[_0xbbfd('0x10')][_0x50125c['uniqueid']]){for(var _0x1d6378 in _0x50125c[_0xbbfd('0x29')]){if(_0x50125c['variable']['hasOwnProperty'](_0x1d6378)){this['channels'][_0x50125c[_0xbbfd('0x24')]][_0x1d6378]=_0x50125c[_0xbbfd('0x2a')];}}}};Fax[_0xbbfd('0x1f')]['syncNewState']=function(_0x1ee749){if(this['channels'][_0x1ee749[_0xbbfd('0x24')]]){this[_0xbbfd('0x10')][_0x1ee749[_0xbbfd('0x24')]][_0xbbfd('0x2b')]=_0x1ee749[_0xbbfd('0x2b')];this[_0xbbfd('0x10')][_0x1ee749[_0xbbfd('0x24')]][_0xbbfd('0x2c')]=_0x1ee749[_0xbbfd('0x2c')];}};Fax[_0xbbfd('0x1f')]['syncNewExten']=function(_0x30a0f7){if(this['channels'][_0x30a0f7[_0xbbfd('0x24')]]){for(var _0x5513b1 in _0x30a0f7['variable']){if(_0x30a0f7[_0xbbfd('0x29')][_0xbbfd('0x22')](_0x5513b1)){this[_0xbbfd('0x10')][_0x30a0f7[_0xbbfd('0x24')]][_0x5513b1]=_0x30a0f7[_0xbbfd('0x2a')];}}}};Fax[_0xbbfd('0x1f')]['syncFaxStatus']=function(_0xc22cea){if(this[_0xbbfd('0x10')][_0xc22cea[_0xbbfd('0x24')]]){this['channels'][_0xc22cea[_0xbbfd('0x24')]][_0xbbfd('0x2d')]=_0xc22cea[_0xbbfd('0x2d')];this[_0xbbfd('0x10')][_0xc22cea[_0xbbfd('0x24')]]['status']=_0xc22cea[_0xbbfd('0x2e')];this[_0xbbfd('0x10')][_0xc22cea[_0xbbfd('0x24')]][_0xbbfd('0x2f')]=_0xc22cea[_0xbbfd('0x2f')];this[_0xbbfd('0x10')][_0xc22cea[_0xbbfd('0x24')]][_0xbbfd('0x30')]=_0xc22cea[_0xbbfd('0x30')];logger['info'](_0xc22cea[_0xbbfd('0x24')],_0xbbfd('0x31'));}};Fax[_0xbbfd('0x1f')][_0xbbfd('0x32')]=function(_0x66d33c){var _0x25dc90=this;if(this['channels'][_0x66d33c[_0xbbfd('0x24')]]){var _0x55bf5e=this[_0xbbfd('0x10')][_0x66d33c[_0xbbfd('0x24')]]['id'];this[_0xbbfd('0x10')][_0x66d33c[_0xbbfd('0x24')]][_0xbbfd('0x33')]=_0x66d33c[_0xbbfd('0x33')];this[_0xbbfd('0x10')][_0x66d33c['uniqueid']][_0xbbfd('0x34')]=_0x66d33c[_0xbbfd('0x34')];this[_0xbbfd('0x10')][_0x66d33c[_0xbbfd('0x24')]][_0xbbfd('0x2f')]=_0x66d33c['localstationid'];this[_0xbbfd('0x10')][_0x66d33c[_0xbbfd('0x24')]][_0xbbfd('0x35')]=_0x66d33c[_0xbbfd('0x35')];this[_0xbbfd('0x10')][_0x66d33c['uniqueid']][_0xbbfd('0x36')]=_0x66d33c[_0xbbfd('0x36')];this[_0xbbfd('0x10')][_0x66d33c['uniqueid']][_0xbbfd('0x30')]=_0x66d33c[_0xbbfd('0x30')];this['channels'][_0x66d33c['uniqueid']]['calleridnum']=_0x66d33c['calleridnum'];if(this[_0xbbfd('0x10')][_0x66d33c['uniqueid']][_0xbbfd('0x34')]>0x0){tiff2pdf(_0x66d33c[_0xbbfd('0x30')],_0xbbfd('0x37'),function(_0x477372){logger[_0xbbfd('0x27')](_0x66d33c[_0xbbfd('0x24')],_0xbbfd('0x38'),_0x477372['message']);attachment[_0xbbfd('0x39')]({'name':path['parse'](_0x66d33c[_0xbbfd('0x30')])[_0xbbfd('0x26')],'basename':path[_0xbbfd('0x3a')](_0x66d33c[_0xbbfd('0x30')])[_0xbbfd('0x26')]+'.pdf','type':_0xbbfd('0x3b')})[_0xbbfd('0x3c')](function(_0x1d01d7){faxAccount[_0xbbfd('0x3d')](_0x55bf5e,{'from':_0x66d33c[_0xbbfd('0x3e')],'mapKey':_0xbbfd('0x8'),'body':path['parse'](_0x66d33c[_0xbbfd('0x30')])['name']+_0xbbfd('0x3f'),'AttachmentId':_0x1d01d7['id']})['catch'](function(_0x5833c3){logger['error'](_0x66d33c[_0xbbfd('0x24')],_0xbbfd('0x40'),JSON['stringify'](_0x5833c3));});})['catch'](function(_0x1652dc){logger[_0xbbfd('0x41')](_0x66d33c['uniqueid'],'\x20receiveFax\x20',JSON[_0xbbfd('0x42')](_0x1652dc));});});}logger[_0xbbfd('0x27')](_0x66d33c[_0xbbfd('0x24')],_0xbbfd('0x43'));}};Fax['prototype'][_0xbbfd('0x1e')]=function(_0x1a4dda){if(this[_0xbbfd('0x13')][_0x1a4dda[_0xbbfd('0x24')]]){_[_0xbbfd('0x44')](this[_0xbbfd('0x10')][_0x1a4dda['uniqueid']],_[_0xbbfd('0x45')](_0x1a4dda,[_0xbbfd('0x46'),'reason']));}};function updateStatus(_0x5dd742){if(_0x5dd742['AttachmentId']){faxMessage['update'](_0x5dd742[_0xbbfd('0x47')],{'failMessage':_0xbbfd('0x48')})[_0xbbfd('0x3c')](function(_0x2c25eb){ut[_0xbbfd('0x49')](_0xbbfd('0x4a'),_0x2c25eb);})[_0xbbfd('0x4b')](function(_0x5f1b91){ut[_0xbbfd('0x49')]('[Fax][Message][Error][NoUpdate1]',_0x5f1b91);});}else{ut[_0xbbfd('0x49')](_0xbbfd('0x4c'));}}Fax[_0xbbfd('0x1f')]['updateStatus']=function(_0x31f4d7,_0xdf2212,_0x36593f){var _0x30c60a=this;var _0x247538={};if(_0xdf2212){_0x247538={'read':_0xdf2212};}else{_0x247538={'failMessage':_0x36593f};}if(this[_0xbbfd('0x13')][_0x31f4d7][_0xbbfd('0x47')]){faxMessage['update'](this[_0xbbfd('0x13')][_0x31f4d7]['AttachmentId'],_0x247538)[_0xbbfd('0x3c')](function(_0x1bfc8d){ut['logger'](_0xbbfd('0x4d'),_0x1bfc8d);})[_0xbbfd('0x4b')](function(_0x5e5fac){ut[_0xbbfd('0x49')]('[Fax][Message][NoUpdate1]',_0x5e5fac);})[_0xbbfd('0x4e')](function(){delete _0x30c60a[_0xbbfd('0x10')][_0x31f4d7];delete _0x30c60a[_0xbbfd('0x13')][_0x31f4d7];});}else{ut[_0xbbfd('0x49')](_0xbbfd('0x4f'));this[_0xbbfd('0x50')](_0x31f4d7);delete this[_0xbbfd('0x13')][_0x31f4d7];}};Fax['prototype'][_0xbbfd('0x51')]=function(_0xfb0450){var _0x4aa44f=this;if(this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]]){if(this[_0xbbfd('0x13')][_0xfb0450[_0xbbfd('0x24')]]){this['channels'][_0xfb0450[_0xbbfd('0x24')]]['id']=this[_0xbbfd('0x13')][_0xfb0450[_0xbbfd('0x24')]]['id'];this['channels'][_0xfb0450[_0xbbfd('0x24')]][_0xbbfd('0x26')]=this[_0xbbfd('0x13')][_0xfb0450[_0xbbfd('0x24')]][_0xbbfd('0x26')];}logger[_0xbbfd('0x27')](_0xfb0450[_0xbbfd('0x24')],this[_0xbbfd('0x13')][_0xfb0450['uniqueid']]?_0xbbfd('0x52'):_0xbbfd('0x53'),JSON[_0xbbfd('0x42')](this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]]));if(this[_0xbbfd('0x13')][_0xfb0450['uniqueid']]){if(this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]]['faxpages']>0x0&&this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]][_0xbbfd('0x1b')]===_0xbbfd('0x54')){this[_0xbbfd('0x55')](_0xfb0450[_0xbbfd('0x24')],!![]);}else{this[_0xbbfd('0x55')](_0xfb0450['uniqueid'],![],this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]][_0xbbfd('0x56')]?_0xbbfd('0x57')+this[_0xbbfd('0x10')][_0xfb0450['uniqueid']][_0xbbfd('0x56')]:'SENDING\x20FAILED');}}}};Fax[_0xbbfd('0x1f')][_0xbbfd('0x58')]=function(_0x4eb25b){var _0x135d51=this;return new BPromise(function(_0x21ea87,_0x102fcd){_0x135d51[_0xbbfd('0x59')](_0x4eb25b,_0x135d51[_0xbbfd('0x11')][_0x4eb25b[_0xbbfd('0x5a')]])[_0xbbfd('0x3c')](function(_0x14e6e3){ut['logger'](_0xbbfd('0x5b'),_0x14e6e3);_0x21ea87(ut[_0xbbfd('0x5c')]('Fax\x20received'));})['catch'](function(_0x409316){ut[_0xbbfd('0x49')](_0xbbfd('0x5d'),_0x409316);updateStatus(_0x4eb25b);_0x102fcd(ut[_0xbbfd('0x5c')](_0xbbfd('0x5e')));});});};Fax[_0xbbfd('0x1f')][_0xbbfd('0x5f')]=function(_0x19d824){var _0x5a4cb4=this;return new BPromise(function(_0x127441,_0x4ca031){var _0x469470=_0x5a4cb4[_0xbbfd('0x60')](_0x5a4cb4['faxAccounts'][_0x19d824[_0xbbfd('0x5a')]][_0xbbfd('0x61')],_0x19d824);if(_0x469470[_0xbbfd('0x62')]){_0x127441(ut[_0xbbfd('0x5c')]('Trunk\x20Reachable'));}else{_0x4ca031(ut[_0xbbfd('0x5c')](_0x469470[_0xbbfd('0x5c')]));}});};function originate(_0x1129a1,_0x4c3746,_0x4295e2){return new BPromise(function(_0x545415,_0x1a5488){if(_0x4295e2){var _0x18d68b=util[_0xbbfd('0x63')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x1129a1['path'])[_0xbbfd('0x26')],_0x1129a1[_0xbbfd('0x4')]);gs[_0xbbfd('0x64')](_0x18d68b)[_0xbbfd('0x3c')](function(){_0x1129a1[_0xbbfd('0x4')]=util['format'](_0xbbfd('0x65'),path[_0xbbfd('0x3a')](_0x1129a1[_0xbbfd('0x4')])['dir'],path['parse'](_0x1129a1[_0xbbfd('0x4')])[_0xbbfd('0x26')]);_0x4c3746[_0xbbfd('0x66')]=_0x1129a1[_0xbbfd('0x4')];ut[_0xbbfd('0x49')](_0xbbfd('0x67'),'');ami['Action'](ut['variablesAction'](_0x1129a1,_0x4c3746))['then'](function(_0x2be233){_0x545415(_0x2be233);})[_0xbbfd('0x4b')](function(_0x26a34d){_0x1a5488(_0x26a34d);});})[_0xbbfd('0x4b')](function(_0x5d4cbd){_0x1a5488(_0x5d4cbd);});}else{ami[_0xbbfd('0x68')](ut[_0xbbfd('0x69')](_0x1129a1,_0x4c3746))[_0xbbfd('0x3c')](function(_0x5133b8){_0x545415(_0x5133b8);})[_0xbbfd('0x4b')](function(_0x1697fb){_0x1a5488(_0x1697fb);});}});}Fax[_0xbbfd('0x1f')][_0xbbfd('0x59')]=function(_0x307a93,_0x4f2f7f){var _0x4bc645=this;return new BPromise(function(_0x33a5f7,_0xa445e){var _0x186f32=uuid['v4']();var _0x29d923=ut['addVariables'](_0x307a93,_0x4f2f7f);_0x4bc645[_0xbbfd('0x13')][_0x186f32]=new Action(_0x186f32,_0x4f2f7f,_0x307a93);var _0x1606c7=_0x4bc645['actions'][_0x186f32];if(path[_0xbbfd('0x3a')](_0x307a93['path'])[_0xbbfd('0x6a')]===_0xbbfd('0x3f')){originate(_0x1606c7,_0x29d923,!![])[_0xbbfd('0x3c')](function(_0x45c573){_0x33a5f7(_0x45c573);})[_0xbbfd('0x4b')](function(_0x292a13){_0xa445e(_0x292a13);});}else{originate(_0x1606c7,_0x29d923,![])['then'](function(_0x2adba2){_0x33a5f7(_0x2adba2);})[_0xbbfd('0x4b')](function(_0x2bb72e){_0xa445e(_0x2bb72e);});}});};Fax[_0xbbfd('0x1f')][_0xbbfd('0x6b')]=function(_0x3877ae){return!_[_0xbbfd('0x6c')](_0x3877ae)&&!_[_0xbbfd('0x6c')](_0x3877ae[_0xbbfd('0x26')])&&!_[_0xbbfd('0x6c')](_0x3877ae[_0xbbfd('0x6d')])&&_0x3877ae[_0xbbfd('0x6d')]&&!_['isNil'](this[_0xbbfd('0x12')][util[_0xbbfd('0x63')](_0xbbfd('0x6e'),_0x3877ae['name'])])&&!_[_0xbbfd('0x6c')](this[_0xbbfd('0x12')][util[_0xbbfd('0x63')](_0xbbfd('0x6e'),_0x3877ae[_0xbbfd('0x26')])][_0xbbfd('0x2e')])&&(this[_0xbbfd('0x12')][util[_0xbbfd('0x63')](_0xbbfd('0x6e'),_0x3877ae['name'])]['status']==='reachable'||this['trunks'][util[_0xbbfd('0x63')](_0xbbfd('0x6e'),_0x3877ae[_0xbbfd('0x26')])]['status']==='unmonitored');};Fax[_0xbbfd('0x1f')]['checkTrunk']=function(_0x4e8f11,_0x14f6b6){if(!this[_0xbbfd('0x6b')](_0x4e8f11)){ut[_0xbbfd('0x49')](_0xbbfd('0x6f'),_[_0xbbfd('0x6c')](_0x4e8f11)?'':_0x4e8f11[_0xbbfd('0x26')]+_0xbbfd('0x70'));return{'isValid':![],'message':_0xbbfd('0x71')};}if(_['isNil'](_0x14f6b6[_0xbbfd('0x8')])){ut[_0xbbfd('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xbbfd('0x42')](_0x14f6b6));return{'isValid':![],'message':_0xbbfd('0x72')};}if(_[_0xbbfd('0x6c')](_0x14f6b6[_0xbbfd('0x4')])){ut[_0xbbfd('0x49')](_0xbbfd('0x73'),JSON[_0xbbfd('0x42')](_0x14f6b6));return{'isValid':![],'message':_0xbbfd('0x74')};}return{'isValid':!![],'message':_0xbbfd('0x75')};};Fax[_0xbbfd('0x1f')][_0xbbfd('0x50')]=function(_0x4cebb5,_0x1e027b=0x2710){if(this[_0xbbfd('0x10')][_0x4cebb5]){setTimeout(()=>{delete this[_0xbbfd('0x10')][_0x4cebb5];},_0x1e027b);}};module[_0xbbfd('0x76')]=Fax; \ No newline at end of file +var _0x0101=['[Fax][Message][Error][NoUpdate2]','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','[Fax][execOriginate][success]','checkAfterSend','FaxAccountId','Trunk','isValid','message','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','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','create','parse','then','notify','.pdf','catch','\x20receiveFax\x20','stringify','merge','pick','response','reason','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0x0101,0x110));var _0x1010=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0101[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x1010('0x0'));var _=require(_0x1010('0x1'));var BPromise=require('bluebird');var uuid=require(_0x1010('0x2'));var moment=require(_0x1010('0x3'));var path=require(_0x1010('0x4'));var tiff2pdf=require(_0x1010('0x5'));var gs=require(_0x1010('0x6'));var logger=require(_0x1010('0x7'))(_0x1010('0x8'));var ami=require(_0x1010('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0x1010('0xa'));var ut=require(_0x1010('0xb'));var Action=require(_0x1010('0xc'));var faxAccount=require(_0x1010('0xd'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x346c22){this[_0x1010('0xe')]={};this[_0x1010('0xf')]=_0x346c22[_0x1010('0xf')];this[_0x1010('0x10')]=_0x346c22[_0x1010('0x10')];this[_0x1010('0x11')]={};ami['on'](_0x1010('0x12'),this[_0x1010('0x13')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x1010('0x14')](this));ami['on']('newstate',this[_0x1010('0x15')]['bind'](this));ami['on'](_0x1010('0x16'),this[_0x1010('0x17')][_0x1010('0x14')](this));ami['on'](_0x1010('0x18'),this[_0x1010('0x19')][_0x1010('0x14')](this));ami['on'](_0x1010('0x1a'),this['syncReceiveFax']['bind'](this));ami['on']('hangup',this[_0x1010('0x1b')][_0x1010('0x14')](this));ami['on'](_0x1010('0x1c'),this[_0x1010('0x1d')]['bind'](this));}Fax[_0x1010('0x1e')][_0x1010('0x13')]=function(_0x30df60){if(_0x30df60[_0x1010('0x1f')]===_0x1010('0x20')){for(var _0x21e14b in this['faxAccounts']){if(this[_0x1010('0xf')][_0x1010('0x21')](_0x21e14b)){if(_0x30df60[_0x1010('0x22')]===this['faxAccounts'][_0x21e14b][_0x1010('0x23')]){this[_0x1010('0xe')][_0x30df60[_0x1010('0x24')]]={};this['channels'][_0x30df60[_0x1010('0x24')]][_0x1010('0x25')]=_0x30df60[_0x1010('0x25')];this['channels'][_0x30df60[_0x1010('0x24')]]['id']=this[_0x1010('0xf')][_0x21e14b]['id'];this[_0x1010('0xe')][_0x30df60[_0x1010('0x24')]][_0x1010('0x26')]=this[_0x1010('0xf')][_0x21e14b][_0x1010('0x26')];logger[_0x1010('0x27')](_0x30df60[_0x1010('0x24')],_0x1010('0x28'));}}}}if(this[_0x1010('0x11')][_0x30df60[_0x1010('0x24')]]){this[_0x1010('0xe')][_0x30df60[_0x1010('0x24')]]={};this[_0x1010('0xe')][_0x30df60[_0x1010('0x24')]]['channel']=_0x30df60[_0x1010('0x25')];logger[_0x1010('0x27')](_0x30df60[_0x1010('0x24')],_0x1010('0x28'));}};Fax[_0x1010('0x1e')][_0x1010('0x29')]=function(_0x53ddba){if(this['channels'][_0x53ddba[_0x1010('0x24')]]){for(var _0x9ce5d8 in _0x53ddba[_0x1010('0x2a')]){if(_0x53ddba[_0x1010('0x2a')][_0x1010('0x21')](_0x9ce5d8)){this[_0x1010('0xe')][_0x53ddba[_0x1010('0x24')]][_0x9ce5d8]=_0x53ddba[_0x1010('0x2b')];}}}};Fax[_0x1010('0x1e')][_0x1010('0x15')]=function(_0x1b45e7){if(this['channels'][_0x1b45e7[_0x1010('0x24')]]){this[_0x1010('0xe')][_0x1b45e7[_0x1010('0x24')]][_0x1010('0x2c')]=_0x1b45e7[_0x1010('0x2c')];this[_0x1010('0xe')][_0x1b45e7[_0x1010('0x24')]]['channelstatedesc']=_0x1b45e7[_0x1010('0x2d')];}};Fax['prototype'][_0x1010('0x17')]=function(_0x1fb197){if(this['channels'][_0x1fb197[_0x1010('0x24')]]){for(var _0x400054 in _0x1fb197['variable']){if(_0x1fb197[_0x1010('0x2a')][_0x1010('0x21')](_0x400054)){this['channels'][_0x1fb197[_0x1010('0x24')]][_0x400054]=_0x1fb197['value'];}}}};Fax['prototype'][_0x1010('0x19')]=function(_0x4f7cb7){if(this['channels'][_0x4f7cb7['uniqueid']]){this['channels'][_0x4f7cb7[_0x1010('0x24')]][_0x1010('0x2e')]=_0x4f7cb7[_0x1010('0x2e')];this[_0x1010('0xe')][_0x4f7cb7['uniqueid']][_0x1010('0x2f')]=_0x4f7cb7[_0x1010('0x2f')];this[_0x1010('0xe')][_0x4f7cb7[_0x1010('0x24')]][_0x1010('0x23')]=_0x4f7cb7[_0x1010('0x23')];this[_0x1010('0xe')][_0x4f7cb7[_0x1010('0x24')]][_0x1010('0x30')]=_0x4f7cb7['filename'];logger[_0x1010('0x27')](_0x4f7cb7[_0x1010('0x24')],_0x1010('0x31'));}};Fax[_0x1010('0x1e')][_0x1010('0x32')]=function(_0x58392e){var _0x37692c=this;if(this[_0x1010('0xe')][_0x58392e[_0x1010('0x24')]]){var _0x94ae56=this[_0x1010('0xe')][_0x58392e[_0x1010('0x24')]]['id'];this[_0x1010('0xe')][_0x58392e['uniqueid']][_0x1010('0x33')]=_0x58392e[_0x1010('0x33')];this[_0x1010('0xe')][_0x58392e[_0x1010('0x24')]][_0x1010('0x34')]=_0x58392e[_0x1010('0x34')];this[_0x1010('0xe')][_0x58392e[_0x1010('0x24')]]['localstationid']=_0x58392e[_0x1010('0x23')];this['channels'][_0x58392e[_0x1010('0x24')]][_0x1010('0x35')]=_0x58392e['resolution'];this[_0x1010('0xe')][_0x58392e['uniqueid']][_0x1010('0x36')]=_0x58392e[_0x1010('0x36')];this[_0x1010('0xe')][_0x58392e[_0x1010('0x24')]]['filename']=_0x58392e[_0x1010('0x30')];this['channels'][_0x58392e[_0x1010('0x24')]]['calleridnum']=_0x58392e['calleridnum'];if(this['channels'][_0x58392e[_0x1010('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x58392e[_0x1010('0x30')],_0x1010('0x37'),function(_0x1b324f){logger[_0x1010('0x27')](_0x58392e['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x1b324f['message']);attachment[_0x1010('0x38')]({'name':path[_0x1010('0x39')](_0x58392e[_0x1010('0x30')])[_0x1010('0x26')],'basename':path[_0x1010('0x39')](_0x58392e[_0x1010('0x30')])[_0x1010('0x26')]+'.pdf','type':'application/pdf'})[_0x1010('0x3a')](function(_0xa388c4){faxAccount[_0x1010('0x3b')](_0x94ae56,{'from':_0x58392e['calleridnum'],'mapKey':_0x1010('0x8'),'body':path[_0x1010('0x39')](_0x58392e[_0x1010('0x30')])[_0x1010('0x26')]+_0x1010('0x3c'),'AttachmentId':_0xa388c4['id']})[_0x1010('0x3d')](function(_0x5de905){logger['error'](_0x58392e[_0x1010('0x24')],'\x20notify\x20',JSON['stringify'](_0x5de905));});})['catch'](function(_0x4da47d){logger['error'](_0x58392e['uniqueid'],_0x1010('0x3e'),JSON[_0x1010('0x3f')](_0x4da47d));});});}logger[_0x1010('0x27')](_0x58392e[_0x1010('0x24')],_0x1010('0x3e'));}};Fax['prototype'][_0x1010('0x1d')]=function(_0xf18d27){if(this[_0x1010('0x11')][_0xf18d27[_0x1010('0x24')]]){_[_0x1010('0x40')](this[_0x1010('0xe')][_0xf18d27[_0x1010('0x24')]],_[_0x1010('0x41')](_0xf18d27,[_0x1010('0x42'),_0x1010('0x43')]));}};function updateStatus(_0x1b69cb){if(_0x1b69cb['AttachmentId']){faxMessage[_0x1010('0x44')](_0x1b69cb['AttachmentId'],{'failMessage':_0x1010('0x45')})['then'](function(_0x41ee0e){ut['logger'](_0x1010('0x46'),_0x41ee0e);})[_0x1010('0x3d')](function(_0x3fa872){ut[_0x1010('0x47')](_0x1010('0x48'),_0x3fa872);});}else{ut[_0x1010('0x47')](_0x1010('0x49'));}}Fax[_0x1010('0x1e')]['updateStatus']=function(_0xe7b60f,_0x1b556b,_0x231b22){var _0x7d8055=this;var _0x3233e0={};if(_0x1b556b){_0x3233e0={'read':_0x1b556b};}else{_0x3233e0={'failMessage':_0x231b22};}if(this[_0x1010('0x11')][_0xe7b60f][_0x1010('0x4a')]){faxMessage[_0x1010('0x44')](this['actions'][_0xe7b60f]['AttachmentId'],_0x3233e0)['then'](function(_0x10e092){ut['logger'](_0x1010('0x4b'),_0x10e092);})['catch'](function(_0x57513c){ut[_0x1010('0x47')](_0x1010('0x4c'),_0x57513c);})[_0x1010('0x4d')](function(){delete _0x7d8055['channels'][_0xe7b60f];delete _0x7d8055[_0x1010('0x11')][_0xe7b60f];});}else{ut['logger']('[Fax][Message][NoUpdate2]');this[_0x1010('0x4e')](_0xe7b60f);delete this['actions'][_0xe7b60f];}};Fax[_0x1010('0x1e')][_0x1010('0x1b')]=function(_0x335bb4){var _0x257a71=this;if(this[_0x1010('0xe')][_0x335bb4['uniqueid']]){if(this[_0x1010('0x11')][_0x335bb4[_0x1010('0x24')]]){this[_0x1010('0xe')][_0x335bb4['uniqueid']]['id']=this[_0x1010('0x11')][_0x335bb4[_0x1010('0x24')]]['id'];this[_0x1010('0xe')][_0x335bb4[_0x1010('0x24')]][_0x1010('0x26')]=this[_0x1010('0x11')][_0x335bb4[_0x1010('0x24')]][_0x1010('0x26')];}logger[_0x1010('0x27')](_0x335bb4[_0x1010('0x24')],this[_0x1010('0x11')][_0x335bb4[_0x1010('0x24')]]?_0x1010('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0x1010('0x3f')](this[_0x1010('0xe')][_0x335bb4[_0x1010('0x24')]]));if(this[_0x1010('0x11')][_0x335bb4[_0x1010('0x24')]]){if(this[_0x1010('0xe')][_0x335bb4[_0x1010('0x24')]][_0x1010('0x50')]>0x0&&this[_0x1010('0xe')][_0x335bb4[_0x1010('0x24')]]['faxstatus']==='SUCCESS'){this[_0x1010('0x51')](_0x335bb4['uniqueid'],!![]);}else{this[_0x1010('0x51')](_0x335bb4[_0x1010('0x24')],![],this[_0x1010('0xe')][_0x335bb4[_0x1010('0x24')]][_0x1010('0x52')]?_0x1010('0x53')+this[_0x1010('0xe')][_0x335bb4['uniqueid']][_0x1010('0x52')]:_0x1010('0x54'));}}}};Fax[_0x1010('0x1e')][_0x1010('0x55')]=function(_0x1b501d){var _0x115919=this;return new BPromise(function(_0x42d9ba,_0x24f884){_0x115919['execOriginate'](_0x1b501d,_0x115919['faxAccounts'][_0x1b501d['FaxAccountId']])[_0x1010('0x3a')](function(_0x113ec9){ut[_0x1010('0x47')](_0x1010('0x56'),_0x113ec9);_0x42d9ba(ut['message']('Fax\x20received'));})[_0x1010('0x3d')](function(_0x17b4bb){ut[_0x1010('0x47')]('[Fax][execOriginate][failure]',_0x17b4bb);updateStatus(_0x1b501d);_0x24f884(ut['message']('Fax\x20failed'));});});};Fax['prototype'][_0x1010('0x57')]=function(_0x2c6e9c){var _0x23247e=this;return new BPromise(function(_0x481b40,_0x54ad31){var _0x69b21c=_0x23247e['checkTrunk'](_0x23247e[_0x1010('0xf')][_0x2c6e9c[_0x1010('0x58')]][_0x1010('0x59')],_0x2c6e9c);if(_0x69b21c[_0x1010('0x5a')]){_0x481b40(ut[_0x1010('0x5b')](_0x1010('0x5c')));}else{_0x54ad31(ut['message'](_0x69b21c['message']));}});};function originate(_0x13daa7,_0x424fd6,_0x485e2f){return new BPromise(function(_0x16b622,_0x245e87){if(_0x485e2f){var _0x1bba75=util['format'](_0x1010('0x5d'),path[_0x1010('0x39')](_0x13daa7[_0x1010('0x4')])[_0x1010('0x26')],_0x13daa7[_0x1010('0x4')]);gs['execute'](_0x1bba75)[_0x1010('0x3a')](function(){_0x13daa7['path']=util[_0x1010('0x5e')]('%s/%s.tif',path['parse'](_0x13daa7[_0x1010('0x4')])[_0x1010('0x5f')],path[_0x1010('0x39')](_0x13daa7[_0x1010('0x4')])[_0x1010('0x26')]);_0x424fd6[_0x1010('0x60')]=_0x13daa7[_0x1010('0x4')];ut[_0x1010('0x47')]('Convert\x20pdf\x20to\x20tif','');ami[_0x1010('0x61')](ut[_0x1010('0x62')](_0x13daa7,_0x424fd6))[_0x1010('0x3a')](function(_0x17d0ca){_0x16b622(_0x17d0ca);})[_0x1010('0x3d')](function(_0x33ed68){_0x245e87(_0x33ed68);});})[_0x1010('0x3d')](function(_0x2df817){_0x245e87(_0x2df817);});}else{ami['Action'](ut[_0x1010('0x62')](_0x13daa7,_0x424fd6))[_0x1010('0x3a')](function(_0x4de82d){_0x16b622(_0x4de82d);})[_0x1010('0x3d')](function(_0x3f5e06){_0x245e87(_0x3f5e06);});}});}Fax[_0x1010('0x1e')][_0x1010('0x63')]=function(_0x58b672,_0xcfb82c){var _0x1a27a9=this;return new BPromise(function(_0x11a8a9,_0x200ea1){var _0x336cc8=uuid['v4']();var _0x389687=ut[_0x1010('0x64')](_0x58b672,_0xcfb82c);_0x1a27a9['actions'][_0x336cc8]=new Action(_0x336cc8,_0xcfb82c,_0x58b672);var _0x27f376=_0x1a27a9[_0x1010('0x11')][_0x336cc8];if(path[_0x1010('0x39')](_0x58b672[_0x1010('0x4')])[_0x1010('0x65')]===_0x1010('0x3c')){originate(_0x27f376,_0x389687,!![])[_0x1010('0x3a')](function(_0x37cbec){_0x11a8a9(_0x37cbec);})[_0x1010('0x3d')](function(_0x388912){_0x200ea1(_0x388912);});}else{originate(_0x27f376,_0x389687,![])['then'](function(_0x34fec0){_0x11a8a9(_0x34fec0);})[_0x1010('0x3d')](function(_0x13adba){_0x200ea1(_0x13adba);});}});};Fax[_0x1010('0x1e')][_0x1010('0x66')]=function(_0xa79a82){return!_['isNil'](_0xa79a82)&&!_[_0x1010('0x67')](_0xa79a82[_0x1010('0x26')])&&!_[_0x1010('0x67')](_0xa79a82['active'])&&_0xa79a82[_0x1010('0x68')]&&!_[_0x1010('0x67')](this[_0x1010('0x10')][util[_0x1010('0x5e')](_0x1010('0x69'),_0xa79a82[_0x1010('0x26')])])&&!_[_0x1010('0x67')](this[_0x1010('0x10')][util[_0x1010('0x5e')](_0x1010('0x69'),_0xa79a82['name'])][_0x1010('0x2f')])&&(this['trunks'][util['format'](_0x1010('0x69'),_0xa79a82[_0x1010('0x26')])][_0x1010('0x2f')]===_0x1010('0x6a')||this[_0x1010('0x10')][util[_0x1010('0x5e')](_0x1010('0x69'),_0xa79a82['name'])][_0x1010('0x2f')]===_0x1010('0x6b'));};Fax['prototype'][_0x1010('0x6c')]=function(_0x1dca84,_0x1c1a4b){if(!this['isTrunkReachable'](_0x1dca84)){ut[_0x1010('0x47')](_0x1010('0x6d'),_['isNil'](_0x1dca84)?'':_0x1dca84['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x1010('0x67')](_0x1c1a4b['fax'])){ut[_0x1010('0x47')](_0x1010('0x6e'),JSON[_0x1010('0x3f')](_0x1c1a4b));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x1010('0x67')](_0x1c1a4b[_0x1010('0x4')])){ut[_0x1010('0x47')](_0x1010('0x6f'),JSON[_0x1010('0x3f')](_0x1c1a4b));return{'isValid':![],'message':_0x1010('0x70')};}return{'isValid':!![],'message':_0x1010('0x71')};};Fax['prototype'][_0x1010('0x4e')]=function(_0x50d08f,_0x135715=0x2710){if(this['channels'][_0x50d08f]){setTimeout(()=>{delete this[_0x1010('0xe')][_0x50d08f];},_0x135715);}};module[_0x1010('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index e27ef60..204f6e5 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 _0x030a=['then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','inspect','notify','resolve'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0x030a,0xc9));var _0xa030=function(_0x153810,_0x4b3117){_0x153810=_0x153810-0x0;var _0x3df31a=_0x030a[_0x153810];return _0x3df31a;};'use strict';var util=require(_0xa030('0x0'));var BPromise=require(_0xa030('0x1'));var logger=require(_0xa030('0x2'))(_0xa030('0x3'));var _=require(_0xa030('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x42be95){return function(_0x477183){logger['error'](_0x42be95,util[_0xa030('0x5')](_0x477183,{'showHidden':![],'depth':null}));};}exports[_0xa030('0x6')]=function(_0x3165f5,_0x288af2){return BPromise[_0xa030('0x7')]()[_0xa030('0x8')](faxAccount[_0xa030('0x6')](_0x3165f5,_0x288af2))[_0xa030('0x9')](loggerCatch(_0xa030('0xa')));}; \ No newline at end of file +var _0xecb1=['inspect','notify','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x3cc8b9,_0x5c95f9){var _0x44d63f=function(_0x4d1f32){while(--_0x4d1f32){_0x3cc8b9['push'](_0x3cc8b9['shift']());}};_0x44d63f(++_0x5c95f9);}(_0xecb1,0x161));var _0x1ecb=function(_0x180226,_0x3af2ce){_0x180226=_0x180226-0x0;var _0x3407a0=_0xecb1[_0x180226];return _0x3407a0;};'use strict';var util=require(_0x1ecb('0x0'));var BPromise=require(_0x1ecb('0x1'));var logger=require(_0x1ecb('0x2'))(_0x1ecb('0x3'));var _=require(_0x1ecb('0x4'));var faxAccount=require(_0x1ecb('0x5'));function loggerCatch(_0x165a2b){return function(_0x353dc4){logger[_0x1ecb('0x6')](_0x165a2b,util[_0x1ecb('0x7')](_0x353dc4,{'showHidden':![],'depth':null}));};}exports[_0x1ecb('0x8')]=function(_0x47e103,_0x138cee){return BPromise['resolve']()['then'](faxAccount[_0x1ecb('0x8')](_0x47e103,_0x138cee))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index b630bf5..b1a83ff 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 _0xe7df=['inspect','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe7df,0x17d));var _0xfe7d=function(_0x214f7c,_0x132269){_0x214f7c=_0x214f7c-0x0;var _0x141af3=_0xe7df[_0x214f7c];return _0x141af3;};'use strict';var util=require('util');var logger=require(_0xfe7d('0x0'))(_0xfe7d('0x1'));var BPromise=require(_0xfe7d('0x2'));var exec=require(_0xfe7d('0x3'))[_0xfe7d('0x4')];exports[_0xfe7d('0x5')]=function(_0x1f5e85){return new BPromise(function(_0x338680,_0x431793){exec(_0x1f5e85,function(_0x2c0382,_0x309c49,_0x430905){logger[_0xfe7d('0x6')](_0xfe7d('0x7'),_0x309c49);if(_0x2c0382){logger[_0xfe7d('0x6')](_0xfe7d('0x7'),_0xfe7d('0x8'),util[_0xfe7d('0x9')](_0x2c0382,{'showHidden':![],'depth':null}),_0x309c49,_0x430905);_0x431793(_0x2c0382);}_0x338680(_0x309c49);});});}; \ No newline at end of file +var _0x9458=['info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax'];(function(_0x2b1c0e,_0x4e19e4){var _0x383f4c=function(_0x984a0e){while(--_0x984a0e){_0x2b1c0e['push'](_0x2b1c0e['shift']());}};_0x383f4c(++_0x4e19e4);}(_0x9458,0xbe));var _0x8945=function(_0x326034,_0x5857b6){_0x326034=_0x326034-0x0;var _0x8c0c3b=_0x9458[_0x326034];return _0x8c0c3b;};'use strict';var util=require('util');var logger=require(_0x8945('0x0'))(_0x8945('0x1'));var BPromise=require('bluebird');var exec=require('child_process')['exec'];exports['execute']=function(_0x4e2e22){return new BPromise(function(_0xc07489,_0x44a8a1){exec(_0x4e2e22,function(_0x24f688,_0x4d327e,_0x5a6767){logger[_0x8945('0x2')](_0x8945('0x3'),_0x4d327e);if(_0x24f688){logger[_0x8945('0x2')](_0x8945('0x3'),_0x8945('0x4'),util[_0x8945('0x5')](_0x24f688,{'showHidden':![],'depth':null}),_0x4d327e,_0x5a6767);_0x44a8a1(_0x24f688);}_0xc07489(_0x4d327e);});});}; \ 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 61dd2b7..4e36268 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 _0x0848=['headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','localstationid','path','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','logger','inspect','ecm'];(function(_0x17972a,_0x58da5d){var _0x2a446e=function(_0x5ca868){while(--_0x5ca868){_0x17972a['push'](_0x17972a['shift']());}};_0x2a446e(++_0x58da5d);}(_0x0848,0x15d));var _0x8084=function(_0x3bfa21,_0x3639c9){_0x3bfa21=_0x3bfa21-0x0;var _0x1f9315=_0x0848[_0x3bfa21];return _0x1f9315;};'use strict';var util=require('util');var _=require(_0x8084('0x0'));var moment=require(_0x8084('0x1'));var logger=require(_0x8084('0x2'))(_0x8084('0x3'));exports[_0x8084('0x4')]=function(_0x1751d1){return{'message':_0x1751d1};};exports[_0x8084('0x5')]=function(_0x5133e8,_0x353d88){logger['info'](_0x5133e8,util[_0x8084('0x6')](_0x353d88,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x13d677,_0x51b276){var _0x31a121={'XMF-ECM':_0x51b276[_0x8084('0x7')],'XMF-HEADERINFO':_0x51b276[_0x8084('0x8')],'XMF-MINRATE':_0x51b276[_0x8084('0x9')],'XMF-MAXRATE':_0x51b276[_0x8084('0xa')],'XMF-MODEM':util[_0x8084('0xb')]('\x22%s\x22',_0x51b276[_0x8084('0xc')]),'XMF-GATEWAY':_0x51b276[_0x8084('0xd')],'XMF-FAXDETECT':_0x51b276[_0x8084('0xe')],'XMF-T38TIMEOUT':_0x51b276['t38timeout'],'XMF-LOCALSTATIONID':_0x51b276[_0x8084('0xf')],'XMF-PATH':_0x13d677[_0x8084('0x10')]};return _0x31a121;};exports['variablesAction']=function(_0x5b5bc6,_0x57a536){return{'actionid':_0x5b5bc6[_0x8084('0x11')],'action':'originate','channel':_0x5b5bc6[_0x8084('0x12')],'Exten':'xcally-motion-fax','Context':_0x8084('0x13'),'Priority':'1','callerid':util['format'](_0x8084('0x14'),_0x5b5bc6[_0x8084('0x8')]?_0x5b5bc6[_0x8084('0x8')]:'',_0x5b5bc6[_0x8084('0xf')]),'variable':_0x57a536,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5b5bc6['uniqueid']};}; \ No newline at end of file +var _0x7416=['uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','moment','../../../../config/logger','message','info','inspect','addVariables','minrate','maxrate','format','\x22%s\x22','gateway','t38timeout','localstationid','path','variablesAction'];(function(_0x4f5e16,_0x503434){var _0x2852b0=function(_0x291041){while(--_0x291041){_0x4f5e16['push'](_0x4f5e16['shift']());}};_0x2852b0(++_0x503434);}(_0x7416,0x8a));var _0x6741=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7416[_0x465a0c];return _0x1e202e;};'use strict';var util=require(_0x6741('0x0'));var _=require('lodash');var moment=require(_0x6741('0x1'));var logger=require(_0x6741('0x2'))('fax');exports[_0x6741('0x3')]=function(_0x510ff0){return{'message':_0x510ff0};};exports['logger']=function(_0x1ab7d3,_0x9ddcc0){logger[_0x6741('0x4')](_0x1ab7d3,util[_0x6741('0x5')](_0x9ddcc0,{'showHidden':![],'depth':null}));};exports[_0x6741('0x6')]=function(_0x14a856,_0x1755f1){var _0x3ac5d7={'XMF-ECM':_0x1755f1['ecm'],'XMF-HEADERINFO':_0x1755f1['headerinfo'],'XMF-MINRATE':_0x1755f1[_0x6741('0x7')],'XMF-MAXRATE':_0x1755f1[_0x6741('0x8')],'XMF-MODEM':util[_0x6741('0x9')](_0x6741('0xa'),_0x1755f1['modem']),'XMF-GATEWAY':_0x1755f1[_0x6741('0xb')],'XMF-FAXDETECT':_0x1755f1['faxdetect'],'XMF-T38TIMEOUT':_0x1755f1[_0x6741('0xc')],'XMF-LOCALSTATIONID':_0x1755f1[_0x6741('0xd')],'XMF-PATH':_0x14a856[_0x6741('0xe')]};return _0x3ac5d7;};exports[_0x6741('0xf')]=function(_0x4aa8b9,_0x2e4a85){return{'actionid':_0x4aa8b9[_0x6741('0x10')],'action':_0x6741('0x11'),'channel':_0x4aa8b9[_0x6741('0x12')],'Exten':'xcally-motion-fax','Context':_0x6741('0x13'),'Priority':'1','callerid':util[_0x6741('0x9')](_0x6741('0x14'),_0x4aa8b9[_0x6741('0x15')]?_0x4aa8b9['headerinfo']:'',_0x4aa8b9['localstationid']),'variable':_0x2e4a85,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4aa8b9[_0x6741('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index c9a5844..5220d25 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 _0x6d6d=['get','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','sync','inspect','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami'];(function(_0x4226a,_0x47de7d){var _0x5ae293=function(_0x5810a8){while(--_0x5810a8){_0x4226a['push'](_0x4226a['shift']());}};_0x5ae293(++_0x47de7d);}(_0x6d6d,0x1c8));var _0xd6d6=function(_0x227c21,_0xc4d046){_0x227c21=_0x227c21-0x0;var _0x107b54=_0x6d6d[_0x227c21];return _0x107b54;};'use strict';var util=require(_0xd6d6('0x0'));var moment=require(_0xd6d6('0x1'));var server=require(_0xd6d6('0x2'));var Realtime=require(_0xd6d6('0x3'));var Report=require(_0xd6d6('0x4'));var Acw=require(_0xd6d6('0x5'));var Trigger=require(_0xd6d6('0x6'));var Dialer=require(_0xd6d6('0x7'));var Preview=require(_0xd6d6('0x8'));var Fax=require(_0xd6d6('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xd6d6('0xa'));var voiceQueueReport=require(_0xd6d6('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xd6d6('0xc'));var trigger=require(_0xd6d6('0xd'));var template=require(_0xd6d6('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xd6d6('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xd6d6('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xd6d6('0x11'));var freshdesk=require(_0xd6d6('0x12'));var desk=require(_0xd6d6('0x13'));var zoho=require(_0xd6d6('0x14'));var vtiger=require(_0xd6d6('0x15'));var freshsales=require(_0xd6d6('0x16'));var servicenow=require(_0xd6d6('0x17'));var dynamics365=require(_0xd6d6('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(_0xd6d6('0x19'))(_0xd6d6('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd6d6('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xd6d6('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xd6d6('0x1d')]()[_0xd6d6('0x1e')](user[_0xd6d6('0x1f')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x20')]())['then'](user['getTelephones']())['then'](realtime[_0xd6d6('0x21')]())[_0xd6d6('0x1e')](trunk['getTrunks']())['then'](realtime[_0xd6d6('0x22')]())['then'](voiceQueue['getVoiceQueues']())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x23')]())['then'](trigger[_0xd6d6('0x24')]())[_0xd6d6('0x1e')](realtime['initTriggers']())[_0xd6d6('0x1e')](template['getTemplates']())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x25')]())[_0xd6d6('0x1e')](zendesk[_0xd6d6('0x26')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x27')]())['then'](salesforce[_0xd6d6('0x28')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x29')]())[_0xd6d6('0x1e')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xd6d6('0x2a')]())[_0xd6d6('0x1e')](freshdesk['getFreshdeskAccounts']())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x2b')]())[_0xd6d6('0x1e')](desk['getDeskAccounts']())['then'](realtime[_0xd6d6('0x2c')]())[_0xd6d6('0x1e')](zoho['getZohoAccounts']())['then'](realtime[_0xd6d6('0x2d')]())[_0xd6d6('0x1e')](vtiger[_0xd6d6('0x2e')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x2f')]())[_0xd6d6('0x1e')](freshsales[_0xd6d6('0x30')]())['then'](realtime[_0xd6d6('0x31')]())['then'](servicenow[_0xd6d6('0x32')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x33')]())[_0xd6d6('0x1e')](dynamics365[_0xd6d6('0x34')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x35')]())[_0xd6d6('0x1e')](campaign[_0xd6d6('0x36')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x37')]())[_0xd6d6('0x1e')](voiceExtension['getVoiceExtensions']())[_0xd6d6('0x1e')](realtime['initVoiceExtensions']())[_0xd6d6('0x1e')](faxAccount[_0xd6d6('0x38')]())['then'](realtime[_0xd6d6('0x39')]())[_0xd6d6('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0xd6d6('0x1d')]()[_0xd6d6('0x1e')](voiceQueueReport[_0xd6d6('0x3a')]())[_0xd6d6('0x1e')](realtime['initVoiceQueueReports']())[_0xd6d6('0x1e')](cmHopperHistory[_0xd6d6('0x3b')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x3c')]())[_0xd6d6('0x1e')](cmHopperHistory[_0xd6d6('0x3d')]())['then'](realtime[_0xd6d6('0x3e')]())[_0xd6d6('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x3f')]())[_0xd6d6('0x40')](function(_0x597cdc){logger[_0xd6d6('0x41')](_0xd6d6('0x42'),util['inspect'](_0x597cdc,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(){return initRealtime();})[_0xd6d6('0x1e')](function(){return initParams();})[_0xd6d6('0x1e')](function(){report[_0xd6d6('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0xec4066){logger[_0xd6d6('0x41')]('[index.js][main]',util[_0xd6d6('0x44')](_0xec4066,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x162c=['./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','sync','error','inspect','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce'];(function(_0x21601c,_0xcb0306){var _0x33ff26=function(_0x40ffff){while(--_0x40ffff){_0x21601c['push'](_0x21601c['shift']());}};_0x33ff26(++_0xcb0306);}(_0x162c,0x7f));var _0xc162=function(_0x205081,_0x3f0823){_0x205081=_0x205081-0x0;var _0x13e35b=_0x162c[_0x205081];return _0x13e35b;};'use strict';var util=require('util');var moment=require(_0xc162('0x0'));var server=require(_0xc162('0x1'));var Realtime=require(_0xc162('0x2'));var Report=require(_0xc162('0x3'));var Acw=require(_0xc162('0x4'));var Trigger=require(_0xc162('0x5'));var Dialer=require(_0xc162('0x6'));var Preview=require(_0xc162('0x7'));var Fax=require(_0xc162('0x8'));var user=require(_0xc162('0x9'));var voiceQueue=require(_0xc162('0xa'));var voiceQueueReport=require(_0xc162('0xb'));var voiceCallReport=require(_0xc162('0xc'));var trunk=require(_0xc162('0xd'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0xc162('0xe'));var campaign=require(_0xc162('0xf'));var voiceExtension=require(_0xc162('0x10'));var faxAccount=require(_0xc162('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc162('0x12'));var sugarcrm=require(_0xc162('0x13'));var freshdesk=require(_0xc162('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xc162('0x15'));var vtiger=require(_0xc162('0x16'));var freshsales=require(_0xc162('0x17'));var servicenow=require(_0xc162('0x18'));var dynamics365=require(_0xc162('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xc162('0x1a'))(_0xc162('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc162('0x1c')](_0xc162('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xc162('0x1e')]()[_0xc162('0x1f')](user['getAgents']())['then'](realtime[_0xc162('0x20')]())[_0xc162('0x1f')](user[_0xc162('0x21')]())[_0xc162('0x1f')](realtime[_0xc162('0x22')]())[_0xc162('0x1f')](trunk['getTrunks']())['then'](realtime[_0xc162('0x23')]())[_0xc162('0x1f')](voiceQueue[_0xc162('0x24')]())[_0xc162('0x1f')](realtime[_0xc162('0x25')]())[_0xc162('0x1f')](trigger[_0xc162('0x26')]())[_0xc162('0x1f')](realtime[_0xc162('0x27')]())[_0xc162('0x1f')](template[_0xc162('0x28')]())[_0xc162('0x1f')](realtime['initTemplates']())[_0xc162('0x1f')](zendesk[_0xc162('0x29')]())[_0xc162('0x1f')](realtime['initZendeskAccounts']())[_0xc162('0x1f')](salesforce[_0xc162('0x2a')]())[_0xc162('0x1f')](realtime['initSalesforceAccounts']())[_0xc162('0x1f')](sugarcrm[_0xc162('0x2b')]())[_0xc162('0x1f')](realtime[_0xc162('0x2c')]())['then'](freshdesk[_0xc162('0x2d')]())[_0xc162('0x1f')](realtime[_0xc162('0x2e')]())[_0xc162('0x1f')](desk[_0xc162('0x2f')]())[_0xc162('0x1f')](realtime[_0xc162('0x30')]())[_0xc162('0x1f')](zoho[_0xc162('0x31')]())[_0xc162('0x1f')](realtime[_0xc162('0x32')]())['then'](vtiger[_0xc162('0x33')]())['then'](realtime['initVtigerAccounts']())[_0xc162('0x1f')](freshsales['getFreshsalesAccounts']())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0xc162('0x34')]())[_0xc162('0x1f')](realtime['initServicenowAccounts']())[_0xc162('0x1f')](dynamics365['getDynamics365Accounts']())[_0xc162('0x1f')](realtime[_0xc162('0x35')]())['then'](campaign[_0xc162('0x36')]())[_0xc162('0x1f')](realtime[_0xc162('0x37')]())[_0xc162('0x1f')](voiceExtension[_0xc162('0x38')]())[_0xc162('0x1f')](realtime[_0xc162('0x39')]())[_0xc162('0x1f')](faxAccount[_0xc162('0x3a')]())[_0xc162('0x1f')](realtime[_0xc162('0x3b')]())[_0xc162('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0xc162('0x1e')]()[_0xc162('0x1f')](voiceQueueReport[_0xc162('0x3c')]())[_0xc162('0x1f')](realtime[_0xc162('0x3d')]())[_0xc162('0x1f')](cmHopperHistory[_0xc162('0x3e')]())[_0xc162('0x1f')](realtime[_0xc162('0x3f')]())[_0xc162('0x1f')](cmHopperHistory[_0xc162('0x40')]())['then'](realtime[_0xc162('0x41')]())[_0xc162('0x1f')](voiceCallReport[_0xc162('0x42')]())[_0xc162('0x1f')](realtime[_0xc162('0x43')]())[_0xc162('0x44')](function(_0x5e88df){logger['error'](_0xc162('0x45'),util['inspect'](_0x5e88df,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xc162('0x46')]();setInterval(initRealtime,0x1388);})[_0xc162('0x44')](function(_0x4d659b){logger[_0xc162('0x47')]('[index.js][main]',util[_0xc162('0x48')](_0x4d659b,{'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 b29dc93..d557ae2 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 _0x67cd=['redis','name','email','accountcode','state','unknown','stateTime','status','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','toNumber','format','fullname','stringify','user:%s','emit','omit','user:presence','exports','lodash','moment','../../../config/environment','defaults','localhost'];(function(_0x5a0113,_0x22121d){var _0x3614f8=function(_0x143354){while(--_0x143354){_0x5a0113['push'](_0x5a0113['shift']());}};_0x3614f8(++_0x22121d);}(_0x67cd,0xdf));var _0xd67c=function(_0x114984,_0x5c9593){_0x114984=_0x114984-0x0;var _0x44822b=_0x67cd[_0x114984];return _0x44822b;};'use strict';var _=require(_0xd67c('0x0'));var util=require('util');var moment=require(_0xd67c('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xd67c('0x2'));config['redis']=_[_0xd67c('0x3')](config['redis'],{'host':_0xd67c('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd67c('0x5')]));function Agent(_0x59b512){this['id']=_0x59b512['id']||0x0;this[_0xd67c('0x6')]=_0x59b512['name']||'';this['email']=_0x59b512[_0xd67c('0x7')]||'';this[_0xd67c('0x8')]=_0x59b512['accountcode']||'';this['fullname']=_0x59b512['fullname']||'';this[_0xd67c('0x9')]=_0xd67c('0xa');this[_0xd67c('0xb')]=0x0;this[_0xd67c('0xc')]=_0xd67c('0xa');this[_0xd67c('0xd')]='';this[_0xd67c('0xe')]='';this['mobile']='';this[_0xd67c('0xf')]='';this['online']=_0x59b512[_0xd67c('0x10')]||![];this[_0xd67c('0x11')]=_0xd67c('0xa');this[_0xd67c('0x12')]=0x0;this[_0xd67c('0x13')]='';this[_0xd67c('0x14')]='';this[_0xd67c('0x15')]=![];this['local']=![];this[_0xd67c('0x16')]='';}Agent[_0xd67c('0x17')][_0xd67c('0x18')]=function(_0x23df6b){var _0x232eeb;if(_0x23df6b&&_0x23df6b[_0xd67c('0x9')]){_0x232eeb=_0x23df6b[_0xd67c('0x9')][_0xd67c('0x19')]();switch(_0x232eeb){case'not_inuse':_0x232eeb=_0xd67c('0x1a');break;case _0xd67c('0x1b'):_0x232eeb=_0xd67c('0x1c');break;}}if(_0x232eeb&&this[_0xd67c('0x11')]!==_0x232eeb||_0x23df6b['statePause']){this['voiceStatusTime']=_[_0xd67c('0x1d')](moment()[_0xd67c('0x1e')]('x'));}if(_0x232eeb){this[_0xd67c('0x11')]=_0x232eeb;}var _0x435454={'id':this['id'],'name':this[_0xd67c('0x6')],'email':this[_0xd67c('0x7')],'accountcode':this[_0xd67c('0x8')],'fullname':this[_0xd67c('0x1f')],'state':this['state'],'stateTime':this[_0xd67c('0xb')],'status':this[_0xd67c('0xc')],'address':this['address'],'online':this[_0xd67c('0x10')],'voiceStatus':this[_0xd67c('0x11')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xd67c('0xf')],'onhold':this[_0xd67c('0x15')]};var _0x5ca48a=md5(JSON[_0xd67c('0x20')](_0x435454));if(this['md5']!==_0x5ca48a){this['md5']=_0x5ca48a;io['to'](util['format'](_0xd67c('0x21'),_0x435454[_0xd67c('0x6')]))[_0xd67c('0x22')]('user:ami:update',_[_0xd67c('0x23')](_0x435454,[_0xd67c('0x10')]));io[_0xd67c('0x22')](_0xd67c('0x24'),_0x435454);}};module[_0xd67c('0x25')]=Agent; \ No newline at end of file +var _0xd0e2=['redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','idle','inuse','statePause','voiceStatusTime','toNumber','format','status','stringify','emit','user:ami:update','omit','exports','lodash','util','moment','ioredis'];(function(_0x35d557,_0x3038e3){var _0x3ecaee=function(_0x9ea905){while(--_0x9ea905){_0x35d557['push'](_0x35d557['shift']());}};_0x3ecaee(++_0x3038e3);}(_0xd0e2,0xd4));var _0x2d0e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd0e2[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2d0e('0x0'));var util=require(_0x2d0e('0x1'));var moment=require(_0x2d0e('0x2'));var md5=require('md5');var Redis=require(_0x2d0e('0x3'));var config=require('../../../config/environment');config[_0x2d0e('0x4')]=_[_0x2d0e('0x5')](config[_0x2d0e('0x4')],{'host':_0x2d0e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2d0e('0x4')]));function Agent(_0x1ad333){this['id']=_0x1ad333['id']||0x0;this[_0x2d0e('0x7')]=_0x1ad333[_0x2d0e('0x7')]||'';this[_0x2d0e('0x8')]=_0x1ad333[_0x2d0e('0x8')]||'';this[_0x2d0e('0x9')]=_0x1ad333[_0x2d0e('0x9')]||'';this[_0x2d0e('0xa')]=_0x1ad333[_0x2d0e('0xa')]||'';this[_0x2d0e('0xb')]=_0x2d0e('0xc');this[_0x2d0e('0xd')]=0x0;this['status']=_0x2d0e('0xc');this[_0x2d0e('0xe')]='';this[_0x2d0e('0xf')]='';this['mobile']='';this['interface']='';this[_0x2d0e('0x10')]=_0x1ad333[_0x2d0e('0x10')]||![];this[_0x2d0e('0x11')]=_0x2d0e('0xc');this['voiceStatusTime']=0x0;this[_0x2d0e('0x12')]='';this[_0x2d0e('0x13')]='';this[_0x2d0e('0x14')]=![];this['local']=![];this[_0x2d0e('0x15')]='';}Agent[_0x2d0e('0x16')][_0x2d0e('0x17')]=function(_0x49b4c1){var _0x2b2134;if(_0x49b4c1&&_0x49b4c1['state']){_0x2b2134=_0x49b4c1[_0x2d0e('0xb')]['toLowerCase']();switch(_0x2b2134){case'not_inuse':_0x2b2134=_0x2d0e('0x18');break;case _0x2d0e('0x19'):_0x2b2134='talking';break;}}if(_0x2b2134&&this[_0x2d0e('0x11')]!==_0x2b2134||_0x49b4c1[_0x2d0e('0x1a')]){this[_0x2d0e('0x1b')]=_[_0x2d0e('0x1c')](moment()[_0x2d0e('0x1d')]('x'));}if(_0x2b2134){this[_0x2d0e('0x11')]=_0x2b2134;}var _0xe51b58={'id':this['id'],'name':this[_0x2d0e('0x7')],'email':this[_0x2d0e('0x8')],'accountcode':this[_0x2d0e('0x9')],'fullname':this[_0x2d0e('0xa')],'state':this['state'],'stateTime':this[_0x2d0e('0xd')],'status':this[_0x2d0e('0x1e')],'address':this['address'],'online':this[_0x2d0e('0x10')],'voiceStatus':this[_0x2d0e('0x11')],'voiceStatusTime':this[_0x2d0e('0x1b')],'voiceStatusCallerIdNumber':this[_0x2d0e('0x12')],'voiceStatusQueue':this[_0x2d0e('0x13')],'interface':this['interface'],'onhold':this[_0x2d0e('0x14')]};var _0x299e54=md5(JSON[_0x2d0e('0x1f')](_0xe51b58));if(this[_0x2d0e('0x15')]!==_0x299e54){this[_0x2d0e('0x15')]=_0x299e54;io['to'](util['format']('user:%s',_0xe51b58[_0x2d0e('0x7')]))[_0x2d0e('0x20')](_0x2d0e('0x21'),_[_0x2d0e('0x22')](_0xe51b58,[_0x2d0e('0x10')]));io[_0x2d0e('0x20')]('user:presence',_0xe51b58);}};module[_0x2d0e('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8d843b2..c0af797 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 _0xd748=['type','campaign','originated','temp','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd748,0x95));var _0x8d74=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xd748[_0x47adb8];return _0x4689a8;};'use strict';function Campaign(_0x9dac8e){this['id']=_0x9dac8e['id']||0x0;this['name']=_0x9dac8e[_0x8d74('0x0')]||'';this[_0x8d74('0x1')]=_0x9dac8e['type']||_0x8d74('0x2');this[_0x8d74('0x3')]=0x0;this[_0x8d74('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x8d74('0x5')]=0x0;this[_0x8d74('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x8d74('0x7')]=_0x9dac8e[_0x8d74('0x7')];this['limitCalls']=_0x9dac8e[_0x8d74('0x8')];this['dialTimezone']=_0x9dac8e[_0x8d74('0x9')]||null;this['dialGlobalInterval']=_0x9dac8e[_0x8d74('0xa')]?_0x9dac8e[_0x8d74('0xa')]:null;this[_0x8d74('0xb')]=_0x9dac8e['dialOriginateCallerIdName'];this[_0x8d74('0xc')]=_0x9dac8e['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x9dac8e[_0x8d74('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x9dac8e[_0x8d74('0xe')];this[_0x8d74('0xf')]=_0x9dac8e['dialCongestionRetryFrequency'];this[_0x8d74('0x10')]=_0x9dac8e[_0x8d74('0x10')];this['dialBusyRetryFrequency']=_0x9dac8e[_0x8d74('0x11')];this[_0x8d74('0x12')]=_0x9dac8e[_0x8d74('0x12')];this[_0x8d74('0x13')]=_0x9dac8e['dialNoAnswerRetryFrequency'];this[_0x8d74('0x14')]=_0x9dac8e[_0x8d74('0x14')];this[_0x8d74('0x15')]=_0x9dac8e[_0x8d74('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x9dac8e[_0x8d74('0x16')]||0x96;this[_0x8d74('0x17')]=_0x9dac8e['dialDropMaxRetry']||0x3;this[_0x8d74('0x18')]=_0x9dac8e[_0x8d74('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x9dac8e[_0x8d74('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x9dac8e['dialAbandonedRetryFrequency']||0x96;this[_0x8d74('0x1a')]=_0x9dac8e[_0x8d74('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x9dac8e[_0x8d74('0x1b')]||0x96;this[_0x8d74('0x1c')]=_0x9dac8e[_0x8d74('0x1c')]||0x3;this[_0x8d74('0x1d')]=_0x9dac8e['dialAgentRejectRetryFrequency']||0x96;this[_0x8d74('0x1e')]=_0x9dac8e[_0x8d74('0x1e')]||_0x8d74('0x1f');this[_0x8d74('0x20')]=_0x9dac8e[_0x8d74('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x9dac8e[_0x8d74('0x21')]||undefined;this[_0x8d74('0x22')]=_0x9dac8e['dialCutDigit']||undefined;this[_0x8d74('0x23')]=_0x9dac8e['TrunkBackup']?_0x9dac8e[_0x8d74('0x23')]:undefined;this[_0x8d74('0x24')]=_0x9dac8e[_0x8d74('0x24')]?_0x9dac8e[_0x8d74('0x24')]:undefined;this[_0x8d74('0x25')]=_0x9dac8e[_0x8d74('0x25')]?_0x9dac8e[_0x8d74('0x25')]:undefined;this['SquareProject']=_0x9dac8e['SquareProject']?_0x9dac8e[_0x8d74('0x26')]:undefined;this[_0x8d74('0x27')]=_0x9dac8e[_0x8d74('0x26')]?_0x9dac8e[_0x8d74('0x26')][_0x8d74('0x0')]:undefined;this['dialAMDActive']=_0x9dac8e['dialAMDActive']||![];this[_0x8d74('0x28')]=_0x9dac8e[_0x8d74('0x28')];this[_0x8d74('0x29')]=_0x9dac8e['dialAMDGreeting'];this[_0x8d74('0x2a')]=_0x9dac8e[_0x8d74('0x2a')];this[_0x8d74('0x2b')]=_0x9dac8e[_0x8d74('0x2b')];this[_0x8d74('0x2c')]=_0x9dac8e[_0x8d74('0x2c')];this[_0x8d74('0x2d')]=_0x9dac8e[_0x8d74('0x2d')];this[_0x8d74('0x2e')]=_0x9dac8e[_0x8d74('0x2e')];this[_0x8d74('0x2f')]=_0x9dac8e[_0x8d74('0x2f')];this[_0x8d74('0x30')]=_0x9dac8e[_0x8d74('0x30')];}module[_0x8d74('0x31')]=Campaign; \ No newline at end of file +var _0x1b89=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','name','type','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x4c6a2a,_0x14d5aa){var _0x38a1c8=function(_0x2bfac7){while(--_0x2bfac7){_0x4c6a2a['push'](_0x4c6a2a['shift']());}};_0x38a1c8(++_0x14d5aa);}(_0x1b89,0x190));var _0x91b8=function(_0x1177d2,_0x5bd3f1){_0x1177d2=_0x1177d2-0x0;var _0x360e9c=_0x1b89[_0x1177d2];return _0x360e9c;};'use strict';function Campaign(_0x5ac6a8){this['id']=_0x5ac6a8['id']||0x0;this[_0x91b8('0x0')]=_0x5ac6a8['name']||'';this['type']=_0x5ac6a8[_0x91b8('0x1')]||'campaign';this['originated']=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x91b8('0x2')]=0x0;this[_0x91b8('0x3')]='';this['sendMessageOneNotActive']=!![];this[_0x91b8('0x4')]=_0x5ac6a8[_0x91b8('0x4')];this['limitCalls']=_0x5ac6a8[_0x91b8('0x5')];this['dialTimezone']=_0x5ac6a8[_0x91b8('0x6')]||null;this['dialGlobalInterval']=_0x5ac6a8['dialGlobalInterval']?_0x5ac6a8[_0x91b8('0x7')]:null;this['dialOriginateCallerIdName']=_0x5ac6a8['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x5ac6a8['dialOriginateCallerIdNumber'];this[_0x91b8('0x8')]=_0x5ac6a8[_0x91b8('0x8')]||0x1e;this[_0x91b8('0x9')]=_0x5ac6a8[_0x91b8('0x9')];this[_0x91b8('0xa')]=_0x5ac6a8[_0x91b8('0xa')];this[_0x91b8('0xb')]=_0x5ac6a8[_0x91b8('0xb')];this[_0x91b8('0xc')]=_0x5ac6a8['dialBusyRetryFrequency'];this[_0x91b8('0xd')]=_0x5ac6a8[_0x91b8('0xd')];this[_0x91b8('0xe')]=_0x5ac6a8[_0x91b8('0xe')];this['dialGlobalMaxRetry']=_0x5ac6a8[_0x91b8('0xf')];this[_0x91b8('0x10')]=_0x5ac6a8[_0x91b8('0x10')]||0x3;this[_0x91b8('0x11')]=_0x5ac6a8[_0x91b8('0x11')]||0x96;this[_0x91b8('0x12')]=_0x5ac6a8[_0x91b8('0x12')]||0x3;this['dialDropRetryFrequency']=_0x5ac6a8['dialDropRetryFrequency']||0x96;this[_0x91b8('0x13')]=_0x5ac6a8['dialAbandonedMaxRetry']||0x3;this[_0x91b8('0x14')]=_0x5ac6a8[_0x91b8('0x14')]||0x96;this['dialMachineMaxRetry']=_0x5ac6a8[_0x91b8('0x15')]||0x3;this['dialMachineRetryFrequency']=_0x5ac6a8[_0x91b8('0x16')]||0x96;this['dialAgentRejectMaxRetry']=_0x5ac6a8[_0x91b8('0x17')]||0x3;this[_0x91b8('0x18')]=_0x5ac6a8[_0x91b8('0x18')]||0x96;this[_0x91b8('0x19')]=_0x5ac6a8[_0x91b8('0x19')]||_0x91b8('0x1a');this[_0x91b8('0x1b')]=_0x5ac6a8[_0x91b8('0x1b')]||undefined;this[_0x91b8('0x1c')]=_0x5ac6a8[_0x91b8('0x1c')]||undefined;this[_0x91b8('0x1d')]=_0x5ac6a8[_0x91b8('0x1d')]||undefined;this[_0x91b8('0x1e')]=_0x5ac6a8['TrunkBackup']?_0x5ac6a8[_0x91b8('0x1e')]:undefined;this['Trunk']=_0x5ac6a8['Trunk']?_0x5ac6a8[_0x91b8('0x1f')]:undefined;this[_0x91b8('0x20')]=_0x5ac6a8[_0x91b8('0x20')]?_0x5ac6a8[_0x91b8('0x20')]:undefined;this[_0x91b8('0x21')]=_0x5ac6a8[_0x91b8('0x21')]?_0x5ac6a8['SquareProject']:undefined;this[_0x91b8('0x22')]=_0x5ac6a8['SquareProject']?_0x5ac6a8['SquareProject']['name']:undefined;this[_0x91b8('0x23')]=_0x5ac6a8[_0x91b8('0x23')]||![];this[_0x91b8('0x24')]=_0x5ac6a8[_0x91b8('0x24')];this['dialAMDGreeting']=_0x5ac6a8[_0x91b8('0x25')];this[_0x91b8('0x26')]=_0x5ac6a8['dialAMDAfterGreetingSilence'];this[_0x91b8('0x27')]=_0x5ac6a8[_0x91b8('0x27')];this[_0x91b8('0x28')]=_0x5ac6a8['dialAMDMinWordLength'];this[_0x91b8('0x29')]=_0x5ac6a8['dialAMDBetweenWordsSilence'];this[_0x91b8('0x2a')]=_0x5ac6a8[_0x91b8('0x2a')];this['dialAMDSilenceThreshold']=_0x5ac6a8['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x5ac6a8['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c9d011f..134cff5 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 _0x7275=['linkedid','endtime','abandoned','lastdata','billableseconds','holdtime','tag','disposition','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','uniqueid'];(function(_0xe942c5,_0x53f5a1){var _0x2d0361=function(_0x50c794){while(--_0x50c794){_0xe942c5['push'](_0xe942c5['shift']());}};_0x2d0361(++_0x53f5a1);}(_0x7275,0x143));var _0x5727=function(_0x532a08,_0x1079ab){_0x532a08=_0x532a08-0x0;var _0xd9c5ee=_0x7275[_0x532a08];return _0xd9c5ee;};'use strict';function Channel(){this[_0x5727('0x0')]=null;this[_0x5727('0x1')]='';this[_0x5727('0x2')]='';this['calleridnum']=0x0;this[_0x5727('0x3')]='';this['connectedlinenum']=undefined;this[_0x5727('0x4')]=undefined;this[_0x5727('0x5')]=0x0;this['context']='';this[_0x5727('0x6')]=0x0;this[_0x5727('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0x5727('0x8')]=null;this['unmanaged']=![];this[_0x5727('0x9')]=![];this['lastapplication']='';this[_0x5727('0xa')]='';this['duration']=0x0;this[_0x5727('0xb')]=0x0;this[_0x5727('0xc')]=0x0;this['type']=null;this[_0x5727('0xd')]=null;this[_0x5727('0xe')]=null;this['monitor']=![];this[_0x5727('0xf')]=null;this[_0x5727('0x10')]=null;this['monitors']=[];this[_0x5727('0x11')]=undefined;this[_0x5727('0x12')]=undefined;this[_0x5727('0x13')]=undefined;this[_0x5727('0x14')]=0x0;}module[_0x5727('0x15')]=Channel; \ No newline at end of file +var _0xbac6=['destinationchannel','calleridname','connectedlinename','context','uniqueid','exten','answertime','unmanaged','abandoned','type','tag','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel'];(function(_0x20d41b,_0x526b81){var _0x835995=function(_0x378ce5){while(--_0x378ce5){_0x20d41b['push'](_0x20d41b['shift']());}};_0x835995(++_0x526b81);}(_0xbac6,0x1ec));var _0x6bac=function(_0x59a664,_0x216420){_0x59a664=_0x59a664-0x0;var _0x467a02=_0xbac6[_0x59a664];return _0x467a02;};'use strict';function Channel(){this[_0x6bac('0x0')]=null;this[_0x6bac('0x1')]='';this[_0x6bac('0x2')]='';this['calleridnum']=0x0;this[_0x6bac('0x3')]='';this['connectedlinenum']=undefined;this[_0x6bac('0x4')]=undefined;this['accountcode']=0x0;this[_0x6bac('0x5')]='';this[_0x6bac('0x6')]=0x0;this['linkedid']=0x0;this[_0x6bac('0x7')]=0x0;this['answered']=![];this[_0x6bac('0x8')]=null;this['endtime']=null;this[_0x6bac('0x9')]=![];this[_0x6bac('0xa')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x6bac('0xb')]=null;this[_0x6bac('0xc')]=null;this['disposition']=null;this['monitor']=![];this['monitorFilename']=null;this[_0x6bac('0xd')]=null;this[_0x6bac('0xe')]=[];this[_0x6bac('0xf')]=undefined;this[_0x6bac('0x10')]=undefined;this[_0x6bac('0x11')]=undefined;this['mohtime']=0x0;}module[_0x6bac('0x12')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 11390b0..49b6f52 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 _0xb82e=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','username','remoteUri','authType','password'];(function(_0x590205,_0x53cafa){var _0x5bc855=function(_0x75e819){while(--_0x75e819){_0x590205['push'](_0x590205['shift']());}};_0x5bc855(++_0x53cafa);}(_0xb82e,0xcd));var _0xeb82=function(_0x935920,_0x49105f){_0x935920=_0x935920-0x0;var _0x5edc44=_0xb82e[_0x935920];return _0x5edc44;};'use strict';function DeskAccount(_0x1dc7f9){this['id']=_0x1dc7f9['id']||0x0;this['name']=_0x1dc7f9['name']||'';this[_0xeb82('0x0')]=_0x1dc7f9[_0xeb82('0x0')]||'';this[_0xeb82('0x1')]=_0x1dc7f9[_0xeb82('0x1')]||'';this[_0xeb82('0x2')]=_0x1dc7f9[_0xeb82('0x2')]||'';this[_0xeb82('0x3')]=_0x1dc7f9[_0xeb82('0x3')]||'';this[_0xeb82('0x4')]=_0x1dc7f9[_0xeb82('0x4')]||'';this[_0xeb82('0x5')]=_0x1dc7f9[_0xeb82('0x5')]||'';this[_0xeb82('0x6')]=_0x1dc7f9[_0xeb82('0x6')]||'';this[_0xeb82('0x7')]=_0x1dc7f9[_0xeb82('0x7')]||'';this[_0xeb82('0x8')]=_0x1dc7f9[_0xeb82('0x8')]||'';this['serverUrl']=_0x1dc7f9[_0xeb82('0x9')]||'';this[_0xeb82('0xa')]=_0x1dc7f9[_0xeb82('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x3940=['password','consumerKey','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3940,0x188));var _0x0394=function(_0x2265d6,_0x544d5c){_0x2265d6=_0x2265d6-0x0;var _0x5adb5e=_0x3940[_0x2265d6];return _0x5adb5e;};'use strict';function DeskAccount(_0x47244a){this['id']=_0x47244a['id']||0x0;this['name']=_0x47244a[_0x0394('0x0')]||'';this[_0x0394('0x1')]=_0x47244a[_0x0394('0x1')]||'';this[_0x0394('0x2')]=_0x47244a[_0x0394('0x2')]||'';this[_0x0394('0x3')]=_0x47244a['authType']||'';this[_0x0394('0x4')]=_0x47244a[_0x0394('0x4')]||'';this[_0x0394('0x5')]=_0x47244a[_0x0394('0x5')]||'';this['consumerSecret']=_0x47244a['consumerSecret']||'';this[_0x0394('0x6')]=_0x47244a[_0x0394('0x6')]||'';this[_0x0394('0x7')]=_0x47244a['tokenSecret']||'';this[_0x0394('0x8')]=_0x47244a[_0x0394('0x8')]||'';this[_0x0394('0x9')]=_0x47244a[_0x0394('0x9')]||'';this['Configurations']=_0x47244a[_0x0394('0xa')]||{};}module[_0x0394('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d5cacdb..2ed7a05 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 _0x8932=['tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x55e492,_0x398035){var _0x27b6a7=function(_0x3bff20){while(--_0x3bff20){_0x55e492['push'](_0x55e492['shift']());}};_0x27b6a7(++_0x398035);}(_0x8932,0xee));var _0x2893=function(_0x1e211b,_0x47f48c){_0x1e211b=_0x1e211b-0x0;var _0x29d307=_0x8932[_0x1e211b];return _0x29d307;};'use strict';function Dynamics365Account(_0x385591){this['id']=_0x385591['id']||0x0;this[_0x2893('0x0')]=_0x385591[_0x2893('0x0')]||'';this[_0x2893('0x1')]=_0x385591[_0x2893('0x1')]||'';this['password']=_0x385591[_0x2893('0x2')]||'';this[_0x2893('0x3')]=_0x385591[_0x2893('0x3')]||'';this['tenantId']=_0x385591[_0x2893('0x4')]||'';this[_0x2893('0x5')]=_0x385591[_0x2893('0x5')]||'';this[_0x2893('0x6')]=_0x385591[_0x2893('0x6')]||{};this['serverUrl']=_0x385591['serverUrl']||'';this[_0x2893('0x7')]=_0x385591[_0x2893('0x7')]||![];this[_0x2893('0x8')]=_0x385591[_0x2893('0x8')]||{};this[_0x2893('0x9')]=_0x385591['CloudProvider']||{};}module[_0x2893('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x6701=['password','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x30eb44,_0x1d157b){var _0x6f821d=function(_0x8d7cea){while(--_0x8d7cea){_0x30eb44['push'](_0x30eb44['shift']());}};_0x6f821d(++_0x1d157b);}(_0x6701,0xae));var _0x1670=function(_0x1ee35d,_0x56b6a8){_0x1ee35d=_0x1ee35d-0x0;var _0x1338d2=_0x6701[_0x1ee35d];return _0x1338d2;};'use strict';function Dynamics365Account(_0x2e85bc){this['id']=_0x2e85bc['id']||0x0;this[_0x1670('0x0')]=_0x2e85bc[_0x1670('0x0')]||'';this[_0x1670('0x1')]=_0x2e85bc[_0x1670('0x1')]||'';this['password']=_0x2e85bc[_0x1670('0x2')]||'';this['remoteUri']=_0x2e85bc['remoteUri']||'';this[_0x1670('0x3')]=_0x2e85bc[_0x1670('0x3')]||'';this['clientId']=_0x2e85bc[_0x1670('0x4')]||'';this[_0x1670('0x5')]=_0x2e85bc[_0x1670('0x5')]||{};this['serverUrl']=_0x2e85bc[_0x1670('0x6')]||'';this[_0x1670('0x7')]=_0x2e85bc['modernAuthentication']||![];this[_0x1670('0x8')]=_0x2e85bc[_0x1670('0x8')]||{};this['CloudProvider']=_0x2e85bc[_0x1670('0x9')]||{};}module[_0x1670('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index e60a2b6..3a069a7 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 _0x7643=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x941d1c,_0x3ce8e2){var _0x4ba201=function(_0x28584a){while(--_0x28584a){_0x941d1c['push'](_0x941d1c['shift']());}};_0x4ba201(++_0x3ce8e2);}(_0x7643,0x6b));var _0x3764=function(_0xaa656e,_0x250a02){_0xaa656e=_0xaa656e-0x0;var _0x2b2d99=_0x7643[_0xaa656e];return _0x2b2d99;};'use strict';function FaxAccount(_0x124408){this['id']=_0x124408['id']||0x0;this[_0x3764('0x0')]=_0x124408['name']||'';this[_0x3764('0x1')]=_0x124408[_0x3764('0x1')];this[_0x3764('0x2')]=_0x124408[_0x3764('0x2')];this[_0x3764('0x3')]=_0x124408[_0x3764('0x3')];this[_0x3764('0x4')]=_0x124408[_0x3764('0x4')];this[_0x3764('0x5')]=_0x124408[_0x3764('0x5')]||0x960;this[_0x3764('0x6')]=_0x124408[_0x3764('0x6')]||0x3840;this[_0x3764('0x7')]=_0x124408[_0x3764('0x7')]||_0x3764('0x8');this[_0x3764('0x9')]=_0x124408[_0x3764('0x9')]||'no';this[_0x3764('0xa')]=_0x124408[_0x3764('0xa')]||'no';this['t38timeout']=_0x124408[_0x3764('0xb')]||0x1388;this[_0x3764('0xc')]=_0x124408[_0x3764('0xc')]||_0x3764('0xd');this[_0x3764('0xe')]=_0x124408['Trunk']?_0x124408[_0x3764('0xe')]:undefined;this[_0x3764('0xf')]=_0x124408['ListId'];this[_0x3764('0x10')]=_0x124408[_0x3764('0x10')];}module[_0x3764('0x11')]=FaxAccount; \ No newline at end of file +var _0x40dd=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','exports'];(function(_0x25ccb5,_0x34a49f){var _0x4c7a99=function(_0x634087){while(--_0x634087){_0x25ccb5['push'](_0x25ccb5['shift']());}};_0x4c7a99(++_0x34a49f);}(_0x40dd,0x176));var _0xd40d=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x40dd[_0x3054be];return _0x3df150;};'use strict';function FaxAccount(_0x2c1dd4){this['id']=_0x2c1dd4['id']||0x0;this[_0xd40d('0x0')]=_0x2c1dd4[_0xd40d('0x0')]||'';this[_0xd40d('0x1')]=_0x2c1dd4[_0xd40d('0x1')];this[_0xd40d('0x2')]=_0x2c1dd4['ecm'];this[_0xd40d('0x3')]=_0x2c1dd4[_0xd40d('0x3')];this[_0xd40d('0x4')]=_0x2c1dd4[_0xd40d('0x4')];this['minrate']=_0x2c1dd4[_0xd40d('0x5')]||0x960;this[_0xd40d('0x6')]=_0x2c1dd4[_0xd40d('0x6')]||0x3840;this[_0xd40d('0x7')]=_0x2c1dd4[_0xd40d('0x7')]||_0xd40d('0x8');this[_0xd40d('0x9')]=_0x2c1dd4['gateway']||'no';this['faxdetect']=_0x2c1dd4[_0xd40d('0xa')]||'no';this[_0xd40d('0xb')]=_0x2c1dd4[_0xd40d('0xb')]||0x1388;this['tech']=_0x2c1dd4[_0xd40d('0xc')]||_0xd40d('0xd');this[_0xd40d('0xe')]=_0x2c1dd4['Trunk']?_0x2c1dd4[_0xd40d('0xe')]:undefined;this[_0xd40d('0xf')]=_0x2c1dd4['ListId'];this['key']=_0x2c1dd4['key'];}module[_0xd40d('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 3466874..56ebe0b 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 _0x5243=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5243,0x9e));var _0x3524=function(_0x17bd75,_0x436927){_0x17bd75=_0x17bd75-0x0;var _0x5b99cb=_0x5243[_0x17bd75];return _0x5b99cb;};'use strict';function FreshdeskAccount(_0x3ad0f5){this['id']=_0x3ad0f5['id']||0x0;this[_0x3524('0x0')]=_0x3ad0f5['name']||'';this[_0x3524('0x1')]=_0x3ad0f5[_0x3524('0x1')]||'';this[_0x3524('0x2')]=_0x3ad0f5[_0x3524('0x3')]||'';this['remoteUri']=_0x3ad0f5[_0x3524('0x4')]||'';this[_0x3524('0x5')]=_0x3ad0f5[_0x3524('0x5')]||'';this[_0x3524('0x6')]=_0x3ad0f5['Configurations']||{};}module[_0x3524('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x8ec9=['serverUrl','Configurations','name','username','apiKey','remoteUri'];(function(_0x1fa5a0,_0x38a083){var _0x2a8d85=function(_0x3269da){while(--_0x3269da){_0x1fa5a0['push'](_0x1fa5a0['shift']());}};_0x2a8d85(++_0x38a083);}(_0x8ec9,0x1a0));var _0x98ec=function(_0x566ec6,_0x12ada5){_0x566ec6=_0x566ec6-0x0;var _0x18ca32=_0x8ec9[_0x566ec6];return _0x18ca32;};'use strict';function FreshdeskAccount(_0x1373cf){this['id']=_0x1373cf['id']||0x0;this[_0x98ec('0x0')]=_0x1373cf[_0x98ec('0x0')]||'';this['username']=_0x1373cf[_0x98ec('0x1')]||'';this[_0x98ec('0x2')]=_0x1373cf['token']||'';this[_0x98ec('0x3')]=_0x1373cf['remoteUri']||'';this['serverUrl']=_0x1373cf[_0x98ec('0x4')]||'';this['Configurations']=_0x1373cf[_0x98ec('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f0eef52..14f7d04 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 _0xa786=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa786,0x1d2));var _0x6a78=function(_0x5cbdab,_0x3d2cf8){_0x5cbdab=_0x5cbdab-0x0;var _0x3b6829=_0xa786[_0x5cbdab];return _0x3b6829;};'use strict';function FreshsalesAccount(_0x1a809b){this['id']=_0x1a809b['id']||0x0;this['name']=_0x1a809b[_0x6a78('0x0')]||'';this[_0x6a78('0x1')]=_0x1a809b[_0x6a78('0x1')]||'';this[_0x6a78('0x2')]=_0x1a809b[_0x6a78('0x3')]||'';this[_0x6a78('0x4')]=_0x1a809b[_0x6a78('0x4')]||'';this['serverUrl']=_0x1a809b[_0x6a78('0x5')]||'';this[_0x6a78('0x6')]=_0x1a809b[_0x6a78('0x6')]||{};}module[_0x6a78('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x7266=['exports','name','username','remoteUri','Configurations'];(function(_0x36b691,_0xcf2e99){var _0x19de43=function(_0x1c797d){while(--_0x1c797d){_0x36b691['push'](_0x36b691['shift']());}};_0x19de43(++_0xcf2e99);}(_0x7266,0xec));var _0x6726=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x7266[_0x580576];return _0x3f55a0;};'use strict';function FreshsalesAccount(_0x25eb5d){this['id']=_0x25eb5d['id']||0x0;this[_0x6726('0x0')]=_0x25eb5d[_0x6726('0x0')]||'';this[_0x6726('0x1')]=_0x25eb5d[_0x6726('0x1')]||'';this['apiKey']=_0x25eb5d['token']||'';this[_0x6726('0x2')]=_0x25eb5d[_0x6726('0x2')]||'';this['serverUrl']=_0x25eb5d['serverUrl']||'';this[_0x6726('0x3')]=_0x25eb5d[_0x6726('0x3')]||{};}module[_0x6726('0x4')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index a1bdc26..340ec5a 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 _0xba85=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','mohtime','variables','exports','inbound'];(function(_0x169857,_0x4f3839){var _0x57dd1e=function(_0x28a448){while(--_0x28a448){_0x169857['push'](_0x169857['shift']());}};_0x57dd1e(++_0x4f3839);}(_0xba85,0x1df));var _0x5ba8=function(_0x5a94f7,_0x384db6){_0x5a94f7=_0x5a94f7-0x0;var _0x1c6049=_0xba85[_0x5a94f7];return _0x1c6049;};'use strict';function QueueReport(){this['type']=_0x5ba8('0x0');this[_0x5ba8('0x1')]='';this[_0x5ba8('0x2')]='';this[_0x5ba8('0x3')]='';this[_0x5ba8('0x4')]='';this[_0x5ba8('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x5ba8('0x6')]=0x1;this[_0x5ba8('0x7')]=0x1;this[_0x5ba8('0x8')]=![];this[_0x5ba8('0x9')]=null;this[_0x5ba8('0xa')]=![];this['queuecallercompleteAt']=null;this[_0x5ba8('0xb')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0x5ba8('0xc')]='';this[_0x5ba8('0xd')]='';this[_0x5ba8('0xe')]='';this[_0x5ba8('0xf')]='';this[_0x5ba8('0x10')]='';this[_0x5ba8('0x11')]='';this[_0x5ba8('0x12')]=0x0;this[_0x5ba8('0x13')]=![];this['lastAssignedTo']='';this[_0x5ba8('0x14')]='voice';this[_0x5ba8('0x15')]=0x0;this[_0x5ba8('0x16')]={};}module[_0x5ba8('0x17')]=QueueReport; \ No newline at end of file +var _0x14a3=['exten','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','accountcode','context'];(function(_0x4949ba,_0x5a9616){var _0x543b99=function(_0x5e5317){while(--_0x5e5317){_0x4949ba['push'](_0x4949ba['shift']());}};_0x543b99(++_0x5a9616);}(_0x14a3,0xa4));var _0x314a=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0x14a3[_0x548d7d];return _0xb1c878;};'use strict';function QueueReport(){this['type']=_0x314a('0x0');this[_0x314a('0x1')]='';this[_0x314a('0x2')]='';this[_0x314a('0x3')]='';this['queue']='';this[_0x314a('0x4')]=null;this[_0x314a('0x5')]=null;this[_0x314a('0x6')]=0x1;this[_0x314a('0x7')]=0x1;this[_0x314a('0x8')]=![];this[_0x314a('0x9')]=null;this[_0x314a('0xa')]=![];this[_0x314a('0xb')]=null;this[_0x314a('0xc')]=![];this['queuecallerexitAt']=null;this[_0x314a('0xd')]=0x1;this[_0x314a('0xe')]='';this[_0x314a('0xf')]='';this['connectedlinename']='';this[_0x314a('0x10')]='';this[_0x314a('0x11')]='';this[_0x314a('0x12')]='';this['priority']='';this[_0x314a('0x13')]=0x0;this['assigned']=![];this[_0x314a('0x14')]='';this[_0x314a('0x15')]=_0x314a('0x16');this[_0x314a('0x17')]=0x0;this[_0x314a('0x18')]={};}module[_0x314a('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 714a2fb..51f139e 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 _0x6d08=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x30ef3d,_0x4befff){var _0x4a3620=function(_0x3083a7){while(--_0x3083a7){_0x30ef3d['push'](_0x30ef3d['shift']());}};_0x4a3620(++_0x4befff);}(_0x6d08,0x13d));var _0x86d0=function(_0x2c8c94,_0x52a5b8){_0x2c8c94=_0x2c8c94-0x0;var _0x17b5d8=_0x6d08[_0x2c8c94];return _0x17b5d8;};'use strict';function SalesforceAccount(_0x1c72f4){this['id']=_0x1c72f4['id']||0x0;this[_0x86d0('0x0')]=_0x1c72f4[_0x86d0('0x0')]||'';this[_0x86d0('0x1')]=_0x1c72f4[_0x86d0('0x1')]||'';this[_0x86d0('0x2')]=_0x1c72f4[_0x86d0('0x2')]||'';this[_0x86d0('0x3')]=_0x1c72f4[_0x86d0('0x3')]||'';this[_0x86d0('0x4')]=_0x1c72f4[_0x86d0('0x4')]||'';this['clientSecret']=_0x1c72f4[_0x86d0('0x5')]||'';this[_0x86d0('0x6')]=_0x1c72f4[_0x86d0('0x6')]||'';this[_0x86d0('0x7')]=_0x1c72f4[_0x86d0('0x7')]||_0x86d0('0x8');this['serverUrl']=_0x1c72f4[_0x86d0('0x9')]||'';this['Configurations']=_0x1c72f4[_0x86d0('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xf970=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x9ae4fc){this['id']=_0x9ae4fc['id']||0x0;this['name']=_0x9ae4fc[_0x0f97('0x0')]||'';this[_0x0f97('0x1')]=_0x9ae4fc[_0x0f97('0x1')]||'';this[_0x0f97('0x2')]=_0x9ae4fc[_0x0f97('0x2')]||'';this[_0x0f97('0x3')]=_0x9ae4fc[_0x0f97('0x3')]||'';this['clientId']=_0x9ae4fc[_0x0f97('0x4')]||'';this[_0x0f97('0x5')]=_0x9ae4fc[_0x0f97('0x5')]||'';this[_0x0f97('0x6')]=_0x9ae4fc[_0x0f97('0x6')]||'';this[_0x0f97('0x7')]=_0x9ae4fc[_0x0f97('0x7')]||_0x0f97('0x8');this[_0x0f97('0x9')]=_0x9ae4fc['serverUrl']||'';this['Configurations']=_0x9ae4fc[_0x0f97('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 49a409e..2b75bcb 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 _0x6584=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0xbed368,_0x43c7b3){var _0x221bfa=function(_0x13ce14){while(--_0x13ce14){_0xbed368['push'](_0xbed368['shift']());}};_0x221bfa(++_0x43c7b3);}(_0x6584,0x175));var _0x4658=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0x6584[_0x133277];return _0x5b4a22;};'use strict';function ServicenowAccount(_0xd0b5ce){this['id']=_0xd0b5ce['id']||0x0;this[_0x4658('0x0')]=_0xd0b5ce[_0x4658('0x0')]||'';this[_0x4658('0x1')]=_0xd0b5ce['username']||'';this[_0x4658('0x2')]=_0xd0b5ce[_0x4658('0x2')]||'';this[_0x4658('0x3')]=_0xd0b5ce['remoteUri']||'';this['serverUrl']=_0xd0b5ce[_0x4658('0x4')]||'';this[_0x4658('0x5')]=_0xd0b5ce[_0x4658('0x5')]||{};}module[_0x4658('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x5a60=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x5c140c,_0x283480){var _0x1fa890=function(_0x4e659a){while(--_0x4e659a){_0x5c140c['push'](_0x5c140c['shift']());}};_0x1fa890(++_0x283480);}(_0x5a60,0xb2));var _0x05a6=function(_0x439912,_0x186f53){_0x439912=_0x439912-0x0;var _0x18caa5=_0x5a60[_0x439912];return _0x18caa5;};'use strict';function ServicenowAccount(_0x243038){this['id']=_0x243038['id']||0x0;this[_0x05a6('0x0')]=_0x243038[_0x05a6('0x0')]||'';this[_0x05a6('0x1')]=_0x243038[_0x05a6('0x1')]||'';this['password']=_0x243038[_0x05a6('0x2')]||'';this[_0x05a6('0x3')]=_0x243038[_0x05a6('0x3')]||'';this[_0x05a6('0x4')]=_0x243038[_0x05a6('0x4')]||'';this['Configurations']=_0x243038[_0x05a6('0x5')]||{};}module[_0x05a6('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 6f931f3..b7ae2f4 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 _0x2b24=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x3b6303,_0x1abd3e){var _0x51ea5f=function(_0x44d8e4){while(--_0x44d8e4){_0x3b6303['push'](_0x3b6303['shift']());}};_0x51ea5f(++_0x1abd3e);}(_0x2b24,0x82));var _0x42b2=function(_0x2fa2f2,_0x19bc20){_0x2fa2f2=_0x2fa2f2-0x0;var _0x37ec73=_0x2b24[_0x2fa2f2];return _0x37ec73;};'use strict';function SugarcrmAccount(_0x5c2dd0){this['id']=_0x5c2dd0['id']||0x0;this['name']=_0x5c2dd0[_0x42b2('0x0')]||'';this[_0x42b2('0x1')]=_0x5c2dd0[_0x42b2('0x1')]||'';this[_0x42b2('0x2')]=_0x5c2dd0['password']||'';this[_0x42b2('0x3')]=_0x5c2dd0[_0x42b2('0x3')]||'';this[_0x42b2('0x4')]=_0x5c2dd0[_0x42b2('0x4')]||'';this['Configurations']=_0x5c2dd0[_0x42b2('0x5')]||{};}module[_0x42b2('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x20cc=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20cc,0x16a));var _0xc20c=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x20cc[_0x12d033];return _0x3b4e80;};'use strict';function SugarcrmAccount(_0x195217){this['id']=_0x195217['id']||0x0;this['name']=_0x195217[_0xc20c('0x0')]||'';this[_0xc20c('0x1')]=_0x195217[_0xc20c('0x1')]||'';this['password']=_0x195217['password']||'';this[_0xc20c('0x2')]=_0x195217[_0xc20c('0x2')]||'';this[_0xc20c('0x3')]=_0x195217[_0xc20c('0x3')]||'';this[_0xc20c('0x4')]=_0x195217['Configurations']||{};}module[_0xc20c('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 1283859..d824196 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 _0xa226=['address','exports','name','accountcode','state','unknown','status'];(function(_0x426dee,_0x151359){var _0x2cc9d0=function(_0x8e4feb){while(--_0x8e4feb){_0x426dee['push'](_0x426dee['shift']());}};_0x2cc9d0(++_0x151359);}(_0xa226,0x64));var _0x6a22=function(_0x23c4e8,_0x8e4d91){_0x23c4e8=_0x23c4e8-0x0;var _0x2f10f3=_0xa226[_0x23c4e8];return _0x2f10f3;};'use strict';function Telephone(_0x45ae06){this['id']=_0x45ae06['id']||0x0;this[_0x6a22('0x0')]=_0x45ae06['name']||'';this[_0x6a22('0x1')]=_0x45ae06[_0x6a22('0x1')]||'';this[_0x6a22('0x2')]=_0x6a22('0x3');this['stateTime']=0x0;this[_0x6a22('0x4')]=_0x6a22('0x3');this[_0x6a22('0x5')]='';}module[_0x6a22('0x6')]=Telephone; \ No newline at end of file +var _0x28a6=['accountcode','unknown','stateTime','status','exports','name'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x28a6,0x8f));var _0x628a=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0x28a6[_0x479509];return _0x382da8;};'use strict';function Telephone(_0x4ee067){this['id']=_0x4ee067['id']||0x0;this[_0x628a('0x0')]=_0x4ee067[_0x628a('0x0')]||'';this[_0x628a('0x1')]=_0x4ee067['accountcode']||'';this['state']=_0x628a('0x2');this[_0x628a('0x3')]=0x0;this[_0x628a('0x4')]='unknown';this['address']='';}module[_0x628a('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a5b0bed..13ffb8c 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x579e85,_0x536108){var _0x1e6c61=function(_0x4e1ef2){while(--_0x4e1ef2){_0x579e85['push'](_0x579e85['shift']());}};_0x1e6c61(++_0x536108);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x3aa23c,_0x5cdc95){var _0x18b4d9=function(_0x5cd790){while(--_0x5cd790){_0x3aa23c['push'](_0x3aa23c['shift']());}};_0x18b4d9(++_0x5cdc95);}(_0xb10b,0x12a));var _0xbb10=function(_0x34e830,_0x3c3620){_0x34e830=_0x34e830-0x0;var _0x462e4b=_0xb10b[_0x34e830];return _0x462e4b;};'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 a2ce1c4..ee619d1 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x42f836,_0x45d3f9){var _0x3334fd=function(_0x176d7f){while(--_0x176d7f){_0x42f836['push'](_0x42f836['shift']());}};_0x3334fd(++_0x45d3f9);}(_0xda3f,0xec));var _0xfda3=function(_0x38889b,_0x2851c7){_0x38889b=_0x38889b-0x0;var _0x5c2b85=_0xda3f[_0x38889b];return _0x5c2b85;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x4d6458,_0x3d8179){var _0x3daa46=function(_0x31126f){while(--_0x31126f){_0x4d6458['push'](_0x4d6458['shift']());}};_0x3daa46(++_0x3d8179);}(_0xda2d,0x102));var _0xdda2=function(_0x546645,_0x388503){_0x546645=_0x546645-0x0;var _0x2a1a5c=_0xda2d[_0x546645];return _0x2a1a5c;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 59e3f95..257fbcf 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 _0x1d99=['registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x1d99,0x179));var _0x91d9=function(_0x65fab3,_0x390c6c){_0x65fab3=_0x65fab3-0x0;var _0x25c9ce=_0x1d99[_0x65fab3];return _0x25c9ce;};'use strict';function Trunk(_0x3fda51){this['id']=_0x3fda51['id']||0x0;this[_0x91d9('0x0')]=_0x3fda51[_0x91d9('0x0')]||![];this[_0x91d9('0x1')]=_0x3fda51['name']||'';this[_0x91d9('0x2')]=_0x91d9('0x3');this[_0x91d9('0x4')]=0x0;this[_0x91d9('0x5')]='unknown';this['registry']=_0x3fda51[_0x91d9('0x6')]&&_0x3fda51[_0x91d9('0x6')][_0x91d9('0x7')](':')?_0x3fda51['registry'][_0x91d9('0x8')](':')[0x0]:'';this[_0x91d9('0x9')]='';this['port']='';this[_0x91d9('0xa')]='';this[_0x91d9('0xb')]='';this[_0x91d9('0xc')]='';this[_0x91d9('0xd')]='unknown';this[_0x91d9('0xe')]='';this[_0x91d9('0xf')]='';this[_0x91d9('0x10')]=_0x3fda51['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0xe333=['refresh','registrationtime','address','defaultuser','exports','active','unknown','status','registry','indexOf','split','host','port','domainport'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe333,0x147));var _0x3e33=function(_0x471e72,_0x393900){_0x471e72=_0x471e72-0x0;var _0x1c5684=_0xe333[_0x471e72];return _0x1c5684;};'use strict';function Trunk(_0x21ca9f){this['id']=_0x21ca9f['id']||0x0;this[_0x3e33('0x0')]=_0x21ca9f[_0x3e33('0x0')]||![];this['name']=_0x21ca9f['name']||'';this['state']=_0x3e33('0x1');this['stateTime']=0x0;this[_0x3e33('0x2')]=_0x3e33('0x1');this['registry']=_0x21ca9f[_0x3e33('0x3')]&&_0x21ca9f[_0x3e33('0x3')][_0x3e33('0x4')](':')?_0x21ca9f[_0x3e33('0x3')][_0x3e33('0x5')](':')[0x0]:'';this[_0x3e33('0x6')]='';this[_0x3e33('0x7')]='';this['domain']='';this[_0x3e33('0x8')]='';this[_0x3e33('0x9')]='';this['stateRegistry']='unknown';this[_0x3e33('0xa')]='';this[_0x3e33('0xb')]='';this[_0x3e33('0xc')]=_0x21ca9f['defaultuser']||'';}module[_0x3e33('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 134460f..6150d22 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 _0xa2df=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x3862ed,_0x3b1524){var _0x15fea0=function(_0x124f38){while(--_0x124f38){_0x3862ed['push'](_0x3862ed['shift']());}};_0x15fea0(++_0x3b1524);}(_0xa2df,0x97));var _0xfa2d=function(_0x3fc44b,_0x2cf9c0){_0x3fc44b=_0x3fc44b-0x0;var _0x3b64f9=_0xa2df[_0x3fc44b];return _0x3b64f9;};'use strict';function voiceExtension(_0x3b3140){this['id']=_0x3b3140['id']||0x0;this[_0xfa2d('0x0')]=_0x3b3140[_0xfa2d('0x0')]||'';this[_0xfa2d('0x1')]=_0x3b3140[_0xfa2d('0x1')]||_0xfa2d('0x2');this[_0xfa2d('0x3')]=_0x3b3140['mandatoryDisposition']||![];}module[_0xfa2d('0x4')]=voiceExtension; \ No newline at end of file +var _0x1ea8=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x1ea8,0x117));var _0x81ea=function(_0xba1150,_0xf6b1fb){_0xba1150=_0xba1150-0x0;var _0x53d00c=_0x1ea8[_0xba1150];return _0x53d00c;};'use strict';function voiceExtension(_0x285eb7){this['id']=_0x285eb7['id']||0x0;this['exten']=_0x285eb7[_0x81ea('0x0')]||'';this[_0x81ea('0x1')]=_0x285eb7[_0x81ea('0x1')]||_0x81ea('0x2');this[_0x81ea('0x3')]=_0x285eb7[_0x81ea('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index c66ecb0..f619ee4 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 _0xbacd=['DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','unmanaged','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt'];(function(_0x11a6dc,_0x3537e2){var _0x121c0d=function(_0x3590ed){while(--_0x3590ed){_0x11a6dc['push'](_0x11a6dc['shift']());}};_0x121c0d(++_0x3537e2);}(_0xbacd,0x1c5));var _0xdbac=function(_0xdd84ad,_0x40ccfe){_0xdd84ad=_0xdd84ad-0x0;var _0x4bee4c=_0xbacd[_0xdd84ad];return _0x4bee4c;};'use strict';var monitorFormat={'wav':_0xdbac('0x0'),'wav49':_0xdbac('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xdbac('0x2'),'leastrecent':_0xdbac('0x3'),'linear':_0xdbac('0x4'),'random':'random','ringall':_0xdbac('0x5'),'rr':_0xdbac('0x6'),'rrmemory':_0xdbac('0x7'),'rrordered':_0xdbac('0x8'),'wrandom':_0xdbac('0x9')};function VoiceQueue(_0x376641){this['id']=_0x376641['id']||0x0;this[_0xdbac('0xa')]=_0x376641[_0xdbac('0xa')]||'';this[_0xdbac('0xb')]=_0x376641[_0xdbac('0xb')]||'';this[_0xdbac('0xc')]=_0x376641[_0xdbac('0xc')]||_0xdbac('0xd');this[_0xdbac('0xe')]=0x0;this[_0xdbac('0xf')]=0x0;this['answered']=0x0;this[_0xdbac('0x10')]=0x0;this[_0xdbac('0x11')]=0x0;this['sumBillable']=0x0;this[_0xdbac('0x12')]=0x0;this['abandoned']=0x0;this[_0xdbac('0x13')]=0x0;this[_0xdbac('0x14')]=0x0;this[_0xdbac('0x15')]=0x0;this[_0xdbac('0x16')]=0x0;this[_0xdbac('0x17')]=0x0;this[_0xdbac('0x18')]=0x0;this[_0xdbac('0x19')]=0x0;this[_0xdbac('0x1a')]=0x0;this[_0xdbac('0x1b')]=0x0;this['ringInUse']=0x0;this[_0xdbac('0x1c')]=0x0;this[_0xdbac('0x1d')]=0x0;this[_0xdbac('0x1e')]=0x0;this[_0xdbac('0x1f')]=_0x376641[_0xdbac('0x1f')]||![];this[_0xdbac('0x20')]=_0x376641[_0xdbac('0x20')]||0xa;this[_0xdbac('0x21')]=_0x376641['autopause']||'no';this[_0xdbac('0x22')]=!![];this[_0xdbac('0x23')]='';this[_0xdbac('0x24')]='';this['originated']=0x0;this[_0xdbac('0x25')]=0x0;this[_0xdbac('0x26')]=_0x376641[_0xdbac('0x26')]||null;this[_0xdbac('0x27')]=_0x376641[_0xdbac('0x27')]?_0x376641[_0xdbac('0x27')]:null;this[_0xdbac('0x28')]=_0x376641[_0xdbac('0x28')];this[_0xdbac('0x29')]=_0x376641[_0xdbac('0x29')]||_0xdbac('0x2a');this[_0xdbac('0x2b')]=_0x376641['dialLimitChannel']||0x0;this[_0xdbac('0x2c')]=_0x376641[_0xdbac('0x2c')]||0x0;this['dialPowerLevel']=_0x376641[_0xdbac('0x2d')]||0x1;this['dialPredictiveOptimization']=_0x376641[_0xdbac('0x2e')]||'dropRate';this[_0xdbac('0x2f')]=_0x376641[_0xdbac('0x2f')]||0.03;this[_0xdbac('0x30')]=_0x376641[_0xdbac('0x30')]||0x258;this[_0xdbac('0x31')]=_0x376641[_0xdbac('0x31')]||_0xdbac('0x32');this['dialOriginateCallerIdNumber']=_0x376641[_0xdbac('0x33')]||_0xdbac('0x32');this[_0xdbac('0x34')]=_0x376641[_0xdbac('0x34')]||0x1e;this[_0xdbac('0x35')]=_0x376641[_0xdbac('0x35')]||_0xdbac('0x36');this[_0xdbac('0x37')]=_0x376641[_0xdbac('0x37')]||0x3;this[_0xdbac('0x38')]=_0x376641[_0xdbac('0x38')]||undefined;this[_0xdbac('0x39')]=_0x376641[_0xdbac('0x39')]||0x3;this[_0xdbac('0x3a')]=_0x376641[_0xdbac('0x3a')]||0x96;this[_0xdbac('0x3b')]=_0x376641[_0xdbac('0x3b')]||0x3;this[_0xdbac('0x3c')]=_0x376641[_0xdbac('0x3c')]||0x96;this[_0xdbac('0x3d')]=_0x376641[_0xdbac('0x3d')]||0x3;this['dialNoAnswerRetryFrequency']=_0x376641[_0xdbac('0x3e')]||0x96;this[_0xdbac('0x3f')]=_0x376641[_0xdbac('0x3f')]||0x3;this[_0xdbac('0x40')]=_0x376641['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x376641[_0xdbac('0x41')]||0x3;this[_0xdbac('0x42')]=_0x376641[_0xdbac('0x42')]||0x96;this[_0xdbac('0x43')]=_0x376641['dialAbandonedMaxRetry']||0x3;this[_0xdbac('0x44')]=_0x376641[_0xdbac('0x44')]||0x96;this[_0xdbac('0x45')]=_0x376641[_0xdbac('0x45')]||0x3;this[_0xdbac('0x46')]=_0x376641[_0xdbac('0x46')]||0x96;this[_0xdbac('0x47')]=_0x376641[_0xdbac('0x47')]||0x3;this['dialAgentRejectRetryFrequency']=_0x376641['dialAgentRejectRetryFrequency']||0x96;this[_0xdbac('0x48')]=_0x376641[_0xdbac('0x48')]||0x3;this[_0xdbac('0x49')]=_0x376641[_0xdbac('0x49')]||0x4;this['Trunk']=_0x376641['Trunk']?_0x376641[_0xdbac('0x4a')]:undefined;this[_0xdbac('0x4b')]=_0x376641[_0xdbac('0x4b')]?_0x376641[_0xdbac('0x4b')]:undefined;this[_0xdbac('0x4c')]=_0x376641[_0xdbac('0x4c')]||undefined;this[_0xdbac('0x4d')]=_0x376641[_0xdbac('0x4d')]?_0x376641[_0xdbac('0x4d')]:undefined;this[_0xdbac('0x4e')]=_0x376641[_0xdbac('0x4e')]||_0xdbac('0x4f');this[_0xdbac('0x50')]=_0x376641['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xdbac('0x51')]=_0x376641['dialCutDigit']||undefined;this[_0xdbac('0x52')]=strategy[_0x376641[_0xdbac('0x52')]];this[_0xdbac('0x53')]=!![];this[_0xdbac('0x54')]=_0x376641['dialAMDActive']||![];this[_0xdbac('0x55')]=_0x376641[_0xdbac('0x55')];this['dialAMDGreeting']=_0x376641['dialAMDGreeting'];this[_0xdbac('0x56')]=_0x376641['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x376641[_0xdbac('0x57')];this[_0xdbac('0x58')]=_0x376641[_0xdbac('0x58')];this['dialAMDBetweenWordsSilence']=_0x376641[_0xdbac('0x59')];this[_0xdbac('0x5a')]=_0x376641[_0xdbac('0x5a')];this[_0xdbac('0x5b')]=_0x376641['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x376641[_0xdbac('0x5c')];this[_0xdbac('0x5d')]=0x0;this[_0xdbac('0x5e')]=0x0;this[_0xdbac('0x5f')]=_0x376641[_0xdbac('0x5f')];this['outboundAnswerCallsDay']=0x0;this[_0xdbac('0x60')]=0x0;this[_0xdbac('0x61')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xdbac('0x62')]=0x0;this[_0xdbac('0x63')]=0x0;this[_0xdbac('0x64')]=0x0;this[_0xdbac('0x65')]=0x0;this[_0xdbac('0x66')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xdbac('0x67')]=0x0;this[_0xdbac('0x68')]=0x0;this[_0xdbac('0x69')]=0x0;this[_0xdbac('0x6a')]=0x0;this[_0xdbac('0x6b')]=undefined;this[_0xdbac('0x6c')]=undefined;this[_0xdbac('0x6d')]=undefined;this[_0xdbac('0x6e')]=1.05;this[_0xdbac('0x6f')]=0x0;this[_0xdbac('0x70')]=0x0;this[_0xdbac('0x71')]=0x0;this[_0xdbac('0x72')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xdbac('0x73')]=_0x376641[_0xdbac('0x74')]||0x14;this[_0xdbac('0x75')]=_0x376641[_0xdbac('0x74')]||0xa;this[_0xdbac('0x76')]=0x0;this[_0xdbac('0x77')]=0x0;this[_0xdbac('0x78')]=0x1;this[_0xdbac('0x79')]=0x0;this[_0xdbac('0x7a')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x376641[_0xdbac('0x7b')]||0x1e;this[_0xdbac('0x7c')]=_0x376641['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x376641['dialPreviewAutoRecallMe']||![];this[_0xdbac('0x7d')]=!!_0x376641[_0xdbac('0x7d')]||![];this[_0xdbac('0x7e')]=_0x376641['dialQueueProject2']||undefined;this[_0xdbac('0x7f')]=_0x376641[_0xdbac('0x7f')]||![];this[_0xdbac('0x80')]=_0x376641[_0xdbac('0x80')]||![];this[_0xdbac('0xb')]=monitorFormat[_0x376641['monitor_format']]?monitorFormat[_0x376641[_0xdbac('0xb')]]:undefined;this[_0xdbac('0x81')]=_0x376641[_0xdbac('0x81')]||![];this[_0xdbac('0x82')]=_0x376641['mandatoryDispositionPause']?_0x376641[_0xdbac('0x82')]:undefined;this[_0xdbac('0x83')]=![];}module[_0xdbac('0x84')]=VoiceQueue; \ No newline at end of file +var _0x79e5=['inbound','waiting','answered','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','leastrecent','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type'];(function(_0xac795a,_0x55434b){var _0x290519=function(_0x1b317a){while(--_0x1b317a){_0xac795a['push'](_0xac795a['shift']());}};_0x290519(++_0x55434b);}(_0x79e5,0x170));var _0x579e=function(_0x1a8f12,_0x1f1791){_0x1a8f12=_0x1a8f12-0x0;var _0x1ce4c6=_0x79e5[_0x1a8f12];return _0x1ce4c6;};'use strict';var monitorFormat={'wav':_0x579e('0x0'),'wav49':'wav49','gsm':_0x579e('0x1')};var strategy={'fewestcalls':_0x579e('0x2'),'leastrecent':_0x579e('0x3'),'linear':_0x579e('0x4'),'random':'random','ringall':_0x579e('0x5'),'rr':_0x579e('0x6'),'rrmemory':_0x579e('0x7'),'rrordered':_0x579e('0x8'),'wrandom':_0x579e('0x9')};function VoiceQueue(_0x47d6f6){this['id']=_0x47d6f6['id']||0x0;this[_0x579e('0xa')]=_0x47d6f6['name']||'';this[_0x579e('0xb')]=_0x47d6f6[_0x579e('0xb')]||'';this[_0x579e('0xc')]=_0x47d6f6['type']||_0x579e('0xd');this[_0x579e('0xe')]=0x0;this['total']=0x0;this[_0x579e('0xf')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x579e('0x10')]=0x0;this[_0x579e('0x11')]=0x0;this[_0x579e('0x12')]=0x0;this[_0x579e('0x13')]=0x0;this[_0x579e('0x14')]=0x0;this[_0x579e('0x15')]=0x0;this[_0x579e('0x16')]=0x0;this['loggedIn']=0x0;this[_0x579e('0x17')]=0x0;this[_0x579e('0x18')]=0x0;this[_0x579e('0x19')]=0x0;this[_0x579e('0x1a')]=0x0;this[_0x579e('0x1b')]=0x0;this[_0x579e('0x1c')]=0x0;this[_0x579e('0x1d')]=0x0;this['unknown']=0x0;this[_0x579e('0x1e')]=_0x47d6f6[_0x579e('0x1e')]||![];this[_0x579e('0x1f')]=_0x47d6f6['acwTimeout']||0xa;this[_0x579e('0x20')]=_0x47d6f6['autopause']||'no';this[_0x579e('0x21')]=!![];this['message']='';this['statusMessage']='';this['originated']=0x0;this[_0x579e('0x22')]=0x0;this['dialTimezone']=_0x47d6f6[_0x579e('0x23')]||null;this[_0x579e('0x24')]=_0x47d6f6[_0x579e('0x24')]?_0x47d6f6[_0x579e('0x24')]:null;this[_0x579e('0x25')]=_0x47d6f6[_0x579e('0x25')];this[_0x579e('0x26')]=_0x47d6f6['dialMethod']||'progressive';this['dialLimitChannel']=_0x47d6f6[_0x579e('0x27')]||0x0;this['dialLimitQueue']=_0x47d6f6[_0x579e('0x28')]||0x0;this[_0x579e('0x29')]=_0x47d6f6['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x47d6f6[_0x579e('0x2a')]||_0x579e('0x2b');this[_0x579e('0x2c')]=_0x47d6f6['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x47d6f6['dialPredictiveInterval']||0x258;this[_0x579e('0x2d')]=_0x47d6f6[_0x579e('0x2d')]||_0x579e('0x2e');this[_0x579e('0x2f')]=_0x47d6f6[_0x579e('0x2f')]||_0x579e('0x2e');this[_0x579e('0x30')]=_0x47d6f6[_0x579e('0x30')]||0x1e;this[_0x579e('0x31')]=_0x47d6f6[_0x579e('0x31')]||_0x579e('0x32');this[_0x579e('0x33')]=_0x47d6f6[_0x579e('0x33')]||0x3;this[_0x579e('0x34')]=_0x47d6f6[_0x579e('0x34')]||undefined;this[_0x579e('0x35')]=_0x47d6f6[_0x579e('0x35')]||0x3;this[_0x579e('0x36')]=_0x47d6f6[_0x579e('0x36')]||0x96;this[_0x579e('0x37')]=_0x47d6f6[_0x579e('0x37')]||0x3;this[_0x579e('0x38')]=_0x47d6f6[_0x579e('0x38')]||0x96;this[_0x579e('0x39')]=_0x47d6f6['dialNoAnswerMaxRetry']||0x3;this[_0x579e('0x3a')]=_0x47d6f6[_0x579e('0x3a')]||0x96;this[_0x579e('0x3b')]=_0x47d6f6[_0x579e('0x3b')]||0x3;this[_0x579e('0x3c')]=_0x47d6f6[_0x579e('0x3c')]||0x96;this[_0x579e('0x3d')]=_0x47d6f6['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x47d6f6[_0x579e('0x3e')]||0x96;this[_0x579e('0x3f')]=_0x47d6f6[_0x579e('0x3f')]||0x3;this[_0x579e('0x40')]=_0x47d6f6[_0x579e('0x40')]||0x96;this[_0x579e('0x41')]=_0x47d6f6[_0x579e('0x41')]||0x3;this['dialMachineRetryFrequency']=_0x47d6f6['dialMachineRetryFrequency']||0x96;this[_0x579e('0x42')]=_0x47d6f6[_0x579e('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x47d6f6[_0x579e('0x43')]||0x96;this[_0x579e('0x44')]=_0x47d6f6[_0x579e('0x44')]||0x3;this[_0x579e('0x45')]=_0x47d6f6[_0x579e('0x45')]||0x4;this['Trunk']=_0x47d6f6[_0x579e('0x46')]?_0x47d6f6[_0x579e('0x46')]:undefined;this['TrunkBackup']=_0x47d6f6[_0x579e('0x47')]?_0x47d6f6[_0x579e('0x47')]:undefined;this['dialPrefix']=_0x47d6f6[_0x579e('0x48')]||undefined;this[_0x579e('0x49')]=_0x47d6f6[_0x579e('0x49')]?_0x47d6f6[_0x579e('0x49')]:undefined;this[_0x579e('0x4a')]=_0x47d6f6[_0x579e('0x4a')]||_0x579e('0x4b');this['dialRandomLastDigitCallerIdNumber']=_0x47d6f6[_0x579e('0x4c')]||undefined;this[_0x579e('0x4d')]=_0x47d6f6[_0x579e('0x4d')]||undefined;this[_0x579e('0x4e')]=strategy[_0x47d6f6['strategy']];this[_0x579e('0x4f')]=!![];this[_0x579e('0x50')]=_0x47d6f6['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x47d6f6[_0x579e('0x51')];this[_0x579e('0x52')]=_0x47d6f6[_0x579e('0x52')];this['dialAMDAfterGreetingSilence']=_0x47d6f6[_0x579e('0x53')];this['dialAMDTotalAnalysisTime']=_0x47d6f6['dialAMDTotalAnalysisTime'];this[_0x579e('0x54')]=_0x47d6f6[_0x579e('0x54')];this[_0x579e('0x55')]=_0x47d6f6[_0x579e('0x55')];this['dialAMDMaximumNumberOfWords']=_0x47d6f6['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x47d6f6[_0x579e('0x56')];this[_0x579e('0x57')]=_0x47d6f6['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this['timeout']=_0x47d6f6[_0x579e('0x58')];this['outboundAnswerCallsDay']=0x0;this[_0x579e('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x579e('0x5a')]=0x0;this[_0x579e('0x5b')]=0x0;this[_0x579e('0x5c')]=0x0;this[_0x579e('0x5d')]=0x0;this[_0x579e('0x5e')]=0x0;this[_0x579e('0x5f')]=0x0;this[_0x579e('0x60')]=0x0;this[_0x579e('0x61')]=0x0;this[_0x579e('0x62')]=0x0;this[_0x579e('0x63')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x579e('0x64')]=undefined;this[_0x579e('0x65')]=undefined;this[_0x579e('0x66')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x579e('0x67')]=0x0;this[_0x579e('0x68')]=0x0;this[_0x579e('0x69')]=0x0;this[_0x579e('0x6a')]=0x0;this[_0x579e('0x6b')]=0x0;this[_0x579e('0x6c')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x579e('0x6d')]=0x0;this['predictiveIntervalMaxThreshold']=_0x47d6f6[_0x579e('0x6e')]||0x14;this[_0x579e('0x6f')]=_0x47d6f6[_0x579e('0x6e')]||0xa;this[_0x579e('0x70')]=0x0;this[_0x579e('0x71')]=0x0;this[_0x579e('0x72')]=0x1;this[_0x579e('0x73')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x579e('0x74')]=_0x47d6f6[_0x579e('0x74')]||0x1e;this[_0x579e('0x75')]=_0x47d6f6[_0x579e('0x75')]||![];this[_0x579e('0x76')]=!!_0x47d6f6[_0x579e('0x76')]||![];this[_0x579e('0x77')]=!!_0x47d6f6[_0x579e('0x77')]||![];this[_0x579e('0x78')]=_0x47d6f6[_0x579e('0x78')]||undefined;this[_0x579e('0x79')]=_0x47d6f6[_0x579e('0x79')]||![];this['dialAgiAfterHangupAgent']=_0x47d6f6[_0x579e('0x7a')]||![];this['monitor_format']=monitorFormat[_0x47d6f6[_0x579e('0xb')]]?monitorFormat[_0x47d6f6[_0x579e('0xb')]]:undefined;this[_0x579e('0x7b')]=_0x47d6f6[_0x579e('0x7b')]||![];this[_0x579e('0x7c')]=_0x47d6f6[_0x579e('0x7c')]?_0x47d6f6[_0x579e('0x7c')]:undefined;this[_0x579e('0x7d')]=![];}module[_0x579e('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 80737dd..6e6d5b3 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 _0x61b8=['createReport','unknown','loggedin','callers','SIP/','online','incall','status','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','sumBillable','preview','exports','available','loggedIn','loggedInDb','ringing','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','paused','pTalking','talking','sumDuration','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','unavailable','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype'];(function(_0x1cb100,_0x5f43bd){var _0x2435d2=function(_0x30d8a1){while(--_0x30d8a1){_0x1cb100['push'](_0x1cb100['shift']());}};_0x2435d2(++_0x5f43bd);}(_0x61b8,0x169));var _0x861b=function(_0x4e92fb,_0x1eb643){_0x4e92fb=_0x4e92fb-0x0;var _0x4c75f1=_0x61b8[_0x4e92fb];return _0x4c75f1;};'use strict';var INBOUND_COUNTERS=[_0x861b('0x0'),_0x861b('0x1'),_0x861b('0x2'),'paused',_0x861b('0x3'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0x861b('0x0'),_0x861b('0x4'),_0x861b('0x5'),'loggedIn',_0x861b('0x2'),_0x861b('0x6'),_0x861b('0x7'),_0x861b('0x8'),_0x861b('0x9'),_0x861b('0xa'),_0x861b('0xb'),_0x861b('0xc'),_0x861b('0xd'),_0x861b('0xe'),_0x861b('0xf'),'outboundUnknownCallsDay',_0x861b('0x10'),_0x861b('0x11'),_0x861b('0x12'),'sumBillable',_0x861b('0x13'),'total',_0x861b('0x14')];function VoiceQueueSummary(_0xd7656){this['id']=_0xd7656['id'];this['name']=_0xd7656[_0x861b('0x15')];this[_0x861b('0x16')]=_0xd7656[_0x861b('0x16')];this[_0x861b('0x17')]=_0xd7656[_0x861b('0x17')]||0x0;this[_0x861b('0x4')]=_0xd7656[_0x861b('0x4')]||0x0;this[_0x861b('0x0')]=_0xd7656[_0x861b('0x0')]||0x0;this[_0x861b('0x18')]=_0xd7656[_0x861b('0x18')]||0x0;this[_0x861b('0x5')]=_0xd7656[_0x861b('0x5')]||0x0;this[_0x861b('0x19')]=_0xd7656[_0x861b('0x19')]||0x0;this[_0x861b('0x1')]=_0xd7656['loggedIn']||0x0;this[_0x861b('0x2')]=_0xd7656['loggedInDb']||0x0;this['onHold']=_0xd7656[_0x861b('0x1a')]||0x0;this['notInUse']=_0xd7656[_0x861b('0x1b')]||0x0;this[_0x861b('0x10')]=_0xd7656['paused']||0x0;this[_0x861b('0x3')]=_0xd7656[_0x861b('0x3')]||0x0;this[_0x861b('0x1c')]=_0xd7656[_0x861b('0x1c')];this['sumBillable']=_0xd7656['sumBillable'];this[_0x861b('0x13')]=_0xd7656[_0x861b('0x13')];this[_0x861b('0x1d')]=_0xd7656['sumHoldTime']||0x0;this[_0x861b('0x12')]=_0xd7656['talking']||0x0;this[_0x861b('0x1e')]=_0xd7656[_0x861b('0x1e')]||0x0;this['type']=_0xd7656['type'];this[_0x861b('0x1f')]=_0xd7656[_0x861b('0x1f')]||0x0;this['unknown']=_0xd7656['unknown']||0x0;this[_0x861b('0x20')]=_0xd7656['unmanaged']||0x0;this['waiting']=_0xd7656[_0x861b('0x14')]||0x0;if(_0xd7656['type']==='outbound'){this[_0x861b('0x11')]=_0xd7656[_0x861b('0x11')]||0x0;this[_0x861b('0x21')]=_0xd7656[_0x861b('0x21')];this[_0x861b('0x22')]=_0xd7656[_0x861b('0x22')];this['dialOriginateCallerIdName']=_0xd7656[_0x861b('0x23')];this[_0x861b('0x24')]=_0xd7656[_0x861b('0x24')];this[_0x861b('0x25')]=_0xd7656[_0x861b('0x25')];this[_0x861b('0x26')]=_0xd7656['dialPrefix'];this['temp']=_0xd7656[_0x861b('0x27')];this[_0x861b('0x28')]=_0xd7656[_0x861b('0x28')];this[_0x861b('0x8')]=_0xd7656[_0x861b('0x8')];this[_0x861b('0x9')]=_0xd7656['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0xd7656[_0x861b('0xa')];this['outboundCongestionCallsDay']=_0xd7656[_0x861b('0xb')];this[_0x861b('0x29')]=_0xd7656[_0x861b('0x29')];this[_0x861b('0x2a')]=_0xd7656[_0x861b('0x2a')];this[_0x861b('0x2b')]=_0xd7656[_0x861b('0x2b')];this[_0x861b('0xc')]=_0xd7656['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0xd7656[_0x861b('0xd')];this['outboundOriginateFailureCallsDay']=_0xd7656[_0x861b('0x2c')];this[_0x861b('0xe')]=_0xd7656['outboundReCallsDay'];this[_0x861b('0xf')]=_0xd7656['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0xd7656[_0x861b('0x2d')];this[_0x861b('0x2e')]=_0xd7656['predictiveIntervalAnsweredCalls'];this[_0x861b('0x2f')]=_0xd7656[_0x861b('0x2f')];this['predictiveIntervalAvgTalktime']=_0xd7656[_0x861b('0x30')];this[_0x861b('0x31')]=_0xd7656['predictiveIntervalDroppedCallsCallersExit'];this[_0x861b('0x32')]=_0xd7656[_0x861b('0x32')];this[_0x861b('0x33')]=_0xd7656[_0x861b('0x33')];this[_0x861b('0x34')]=_0xd7656[_0x861b('0x34')];this['predictiveIntervalHitRate']=_0xd7656[_0x861b('0x35')];this[_0x861b('0x36')]=_0xd7656[_0x861b('0x36')];this[_0x861b('0x37')]=_0xd7656[_0x861b('0x37')];this['predictiveIntervalAvailable']=_0xd7656['predictiveIntervalAvailable'];this[_0x861b('0x38')]=_0xd7656[_0x861b('0x38')];this['originated']=_0xd7656['originated'];this[_0x861b('0x39')]=_0xd7656[_0x861b('0x39')];this[_0x861b('0x3a')]=_0xd7656[_0x861b('0x3a')];this[_0x861b('0x3b')]=_0xd7656[_0x861b('0x3b')];this['erlangBusyFactor']=_0xd7656[_0x861b('0x3c')];this[_0x861b('0x3d')]=_0xd7656[_0x861b('0x3d')];this[_0x861b('0x3e')]=_0xd7656[_0x861b('0x3e')];this[_0x861b('0x3f')]=_0xd7656['message'];this[_0x861b('0x40')]=_0xd7656['statusMessage'];}if(_0xd7656[_0x861b('0x41')]){this['Trunk']={'id':_0xd7656[_0x861b('0x41')]['id'],'name':_0xd7656[_0x861b('0x41')][_0x861b('0x15')],'active':_0xd7656[_0x861b('0x41')][_0x861b('0x42')],'callerid':_0xd7656['Trunk'][_0x861b('0x43')]};}}VoiceQueueSummary[_0x861b('0x44')][_0x861b('0x45')]=function(_0xadca6f,_0x5c9bfa,_0x23ae99,_0x281ddb){this['loggedInDb']=0x0;this[_0x861b('0x12')]=0x0;this[_0x861b('0x10')]=0x0;this[_0x861b('0x46')]=0x0;this['notInUse']=0x0;this[_0x861b('0x5')]=0x0;this[_0x861b('0x18')]=0x0;this['invalid']=0x0;this[_0x861b('0x1f')]=0x0;this[_0x861b('0x3')]=0x0;this['ringInUse']=0x0;this[_0x861b('0x1a')]=0x0;if(_0x23ae99){if(_0x23ae99[_0x861b('0x0')]){this['available']=Number(_0x23ae99[_0x861b('0x0')]);}if(_0x23ae99[_0x861b('0x47')]){this[_0x861b('0x1')]=Number(_0x23ae99[_0x861b('0x47')]);}if(_0x23ae99[_0x861b('0x48')]){this[_0x861b('0x14')]=Number(_0x23ae99['callers']);}}for(var _0x8f3581=0x0;_0x8f3581<_0xadca6f['length'];_0x8f3581++){var _0x2b4bdc=_0x5c9bfa[_0x861b('0x49')+_0xadca6f[_0x8f3581]['name']];if(_0x2b4bdc&&_0x2b4bdc[_0x861b('0x4a')]){this[_0x861b('0x2')]+=0x1;}if(_0xadca6f[_0x8f3581][_0x861b('0x4b')]==='1'){this[_0x861b('0x12')]+=0x1;}if(_0xadca6f[_0x8f3581][_0x861b('0x10')]==='1'&&!['2','7','8']['includes'](_0xadca6f[_0x8f3581][_0x861b('0x4c')])){this[_0x861b('0x10')]+=0x1;}switch(_0xadca6f[_0x8f3581]['status']){case'0':this[_0x861b('0x46')]+=0x1;break;case'1':this[_0x861b('0x1b')]+=0x1;break;case'2':this[_0x861b('0x5')]+=0x1;break;case'3':this[_0x861b('0x18')]+=0x1;break;case'4':this[_0x861b('0x19')]+=0x1;break;case'5':this[_0x861b('0x1f')]+=0x1;break;case'6':this[_0x861b('0x3')]+=0x1;break;case'7':this[_0x861b('0x1c')]+=0x1;break;case'8':this[_0x861b('0x1a')]+=0x1;break;}}if(this[_0x861b('0x22')]==='booked'){var _0x3415d4=Object['keys'](_0x281ddb);for(var _0x1074f1=0x0;_0x1074f1<_0x3415d4['length'];_0x1074f1++){var _0x3865a7=_0x3415d4[_0x1074f1];var _0x166eee=_0x281ddb[_0x3865a7];if(_0x166eee['queue']===this[_0x861b('0x15')]&&_0x166eee['type']===_0x861b('0x4d')&&_0x166eee[_0x861b('0x4e')]===_0x861b('0x4f')){this['talking']+=0x1;}}if(this[_0x861b('0x12')]>this[_0x861b('0x5')]){this[_0x861b('0x12')]=this[_0x861b('0x5')];}this[_0x861b('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x861b('0x44')][_0x861b('0x50')]=function(_0xedf4c5){var _0x4e5147=![];if(_0xedf4c5){_0x4e5147=INBOUND_COUNTERS[_0x861b('0x51')](function(_0x4380db){return this[_0x4380db]!==_0xedf4c5[_0x4380db];},this);}return _0x4e5147;};VoiceQueueSummary[_0x861b('0x44')]['compareToOutboundQueue']=function(_0x2fdb54){var _0x9d4fef=![];var _0x4b0e1e=![];var _0x2aac41=![];if(_0x2fdb54){_0x9d4fef=this['dialMethod']!==_0x2fdb54[_0x861b('0x22')]||this[_0x861b('0x21')]!==_0x2fdb54[_0x861b('0x21')]||this[_0x861b('0x3f')]!==_0x2fdb54['message']||this[_0x861b('0x40')]!==_0x2fdb54[_0x861b('0x40')];_0x4b0e1e=OUTBOUND_COUNTERS['some'](function(_0x3fc0a7){return this[_0x3fc0a7]!==_0x2fdb54[_0x3fc0a7];},this);if(this[_0x861b('0x41')]&&_0x2fdb54['Trunk']){_0x2aac41=this[_0x861b('0x41')][_0x861b('0x15')]!==_0x2fdb54[_0x861b('0x41')][_0x861b('0x15')]||this[_0x861b('0x41')][_0x861b('0x42')]!==_0x2fdb54[_0x861b('0x41')][_0x861b('0x42')];}}return _0x9d4fef||_0x4b0e1e||_0x2aac41;};VoiceQueueSummary[_0x861b('0x44')][_0x861b('0x52')]=function(_0x4e0e32){this[_0x861b('0x4')]=_0x4e0e32[_0x861b('0x4')];this[_0x861b('0x3f')]=_0x4e0e32[_0x861b('0x3f')];this[_0x861b('0x40')]=_0x4e0e32['statusMessage'];this[_0x861b('0x6')]=_0x4e0e32[_0x861b('0x6')];this[_0x861b('0x7')]=_0x4e0e32['outboundAbandonedCallsDay'];this[_0x861b('0x8')]=_0x4e0e32['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x4e0e32[_0x861b('0x9')];this[_0x861b('0xa')]=_0x4e0e32['outboundBusyCallsDay'];this[_0x861b('0xb')]=_0x4e0e32[_0x861b('0xb')];this[_0x861b('0xc')]=_0x4e0e32[_0x861b('0xc')];this[_0x861b('0xd')]=_0x4e0e32[_0x861b('0xd')];this[_0x861b('0xe')]=_0x4e0e32[_0x861b('0xe')];this[_0x861b('0xf')]=_0x4e0e32[_0x861b('0xf')];this[_0x861b('0x2d')]=_0x4e0e32[_0x861b('0x2d')];this[_0x861b('0x53')]=_0x4e0e32['sumBillable'];this['sumDuration']=_0x4e0e32[_0x861b('0x13')];this[_0x861b('0x1e')]=_0x4e0e32[_0x861b('0x1e')];if(this[_0x861b('0x22')]===_0x861b('0x54')){this[_0x861b('0x11')]=_0x4e0e32[_0x861b('0x11')];}};module[_0x861b('0x55')]=VoiceQueueSummary; \ No newline at end of file +var _0x9206=['predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','length','SIP/','online','incall','includes','status','booked','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','active','outboundAbandonedCallsDay','exports','available','loggedIn','loggedInDb','paused','ringing','talking','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','waiting','name','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x193f38,_0x176760){var _0x174490=function(_0x392040){while(--_0x392040){_0x193f38['push'](_0x193f38['shift']());}};_0x174490(++_0x176760);}(_0x9206,0x176));var _0x6920=function(_0x1101d0,_0x417720){_0x1101d0=_0x1101d0-0x0;var _0x2ca7f5=_0x9206[_0x1101d0];return _0x2ca7f5;};'use strict';var INBOUND_COUNTERS=[_0x6920('0x0'),_0x6920('0x1'),_0x6920('0x2'),_0x6920('0x3'),_0x6920('0x4'),_0x6920('0x5'),'waiting'];var OUTBOUND_COUNTERS=['available',_0x6920('0x6'),_0x6920('0x7'),'loggedIn','loggedInDb',_0x6920('0x8'),'outboundAbandonedCallsDay',_0x6920('0x9'),_0x6920('0xa'),_0x6920('0xb'),_0x6920('0xc'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0x6920('0xd'),_0x6920('0xe'),_0x6920('0xf'),_0x6920('0x3'),_0x6920('0x10'),_0x6920('0x5'),_0x6920('0x11'),_0x6920('0x12'),_0x6920('0x13'),_0x6920('0x14')];function VoiceQueueSummary(_0xb5d14){this['id']=_0xb5d14['id'];this[_0x6920('0x15')]=_0xb5d14[_0x6920('0x15')];this['strategy']=_0xb5d14['strategy'];this[_0x6920('0x16')]=_0xb5d14[_0x6920('0x16')]||0x0;this['answered']=_0xb5d14[_0x6920('0x6')]||0x0;this[_0x6920('0x0')]=_0xb5d14[_0x6920('0x0')]||0x0;this[_0x6920('0x17')]=_0xb5d14[_0x6920('0x17')]||0x0;this['inUse']=_0xb5d14[_0x6920('0x7')]||0x0;this[_0x6920('0x18')]=_0xb5d14[_0x6920('0x18')]||0x0;this[_0x6920('0x1')]=_0xb5d14[_0x6920('0x1')]||0x0;this[_0x6920('0x2')]=_0xb5d14[_0x6920('0x2')]||0x0;this[_0x6920('0x19')]=_0xb5d14[_0x6920('0x19')]||0x0;this[_0x6920('0x1a')]=_0xb5d14[_0x6920('0x1a')]||0x0;this[_0x6920('0x3')]=_0xb5d14[_0x6920('0x3')]||0x0;this[_0x6920('0x4')]=_0xb5d14[_0x6920('0x4')]||0x0;this['ringInUse']=_0xb5d14[_0x6920('0x1b')];this[_0x6920('0x11')]=_0xb5d14[_0x6920('0x11')];this[_0x6920('0x12')]=_0xb5d14[_0x6920('0x12')];this[_0x6920('0x1c')]=_0xb5d14[_0x6920('0x1c')]||0x0;this[_0x6920('0x5')]=_0xb5d14[_0x6920('0x5')]||0x0;this[_0x6920('0x13')]=_0xb5d14[_0x6920('0x13')]||0x0;this[_0x6920('0x1d')]=_0xb5d14[_0x6920('0x1d')];this[_0x6920('0x1e')]=_0xb5d14[_0x6920('0x1e')]||0x0;this[_0x6920('0x1f')]=_0xb5d14[_0x6920('0x1f')]||0x0;this[_0x6920('0x20')]=_0xb5d14[_0x6920('0x20')]||0x0;this[_0x6920('0x14')]=_0xb5d14['waiting']||0x0;if(_0xb5d14[_0x6920('0x1d')]==='outbound'){this[_0x6920('0x10')]=_0xb5d14['pTalking']||0x0;this[_0x6920('0x21')]=_0xb5d14[_0x6920('0x21')];this[_0x6920('0x22')]=_0xb5d14[_0x6920('0x22')];this['dialOriginateCallerIdName']=_0xb5d14[_0x6920('0x23')];this[_0x6920('0x24')]=_0xb5d14[_0x6920('0x24')];this[_0x6920('0x25')]=_0xb5d14[_0x6920('0x25')];this[_0x6920('0x26')]=_0xb5d14[_0x6920('0x26')];this[_0x6920('0x27')]=_0xb5d14[_0x6920('0x27')];this[_0x6920('0x28')]=_0xb5d14[_0x6920('0x28')];this[_0x6920('0x9')]=_0xb5d14['outboundAnswerCallsDay'];this[_0x6920('0xa')]=_0xb5d14['outboundBlacklistCallsDay'];this[_0x6920('0xb')]=_0xb5d14['outboundBusyCallsDay'];this[_0x6920('0xc')]=_0xb5d14[_0x6920('0xc')];this['outboundDropCallsDayACS']=_0xb5d14[_0x6920('0x29')];this[_0x6920('0x2a')]=_0xb5d14[_0x6920('0x2a')];this['outboundDropCallsDayTimeout']=_0xb5d14['outboundDropCallsDayTimeout'];this[_0x6920('0x2b')]=_0xb5d14['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0xb5d14[_0x6920('0x2c')];this[_0x6920('0x2d')]=_0xb5d14[_0x6920('0x2d')];this[_0x6920('0xd')]=_0xb5d14[_0x6920('0xd')];this[_0x6920('0xe')]=_0xb5d14[_0x6920('0xe')];this['outboundUnknownCallsDay']=_0xb5d14[_0x6920('0xf')];this['predictiveIntervalAnsweredCalls']=_0xb5d14[_0x6920('0x2e')];this['predictiveIntervalAvgHoldtime']=_0xb5d14['predictiveIntervalAvgHoldtime'];this[_0x6920('0x2f')]=_0xb5d14[_0x6920('0x2f')];this[_0x6920('0x30')]=_0xb5d14[_0x6920('0x30')];this[_0x6920('0x31')]=_0xb5d14[_0x6920('0x31')];this[_0x6920('0x32')]=_0xb5d14[_0x6920('0x32')];this[_0x6920('0x33')]=_0xb5d14[_0x6920('0x33')];this[_0x6920('0x34')]=_0xb5d14[_0x6920('0x34')];this['predictiveIntervalMultiplicativeFactor']=_0xb5d14[_0x6920('0x35')];this['predictiveIntervalPauses']=_0xb5d14[_0x6920('0x36')];this[_0x6920('0x37')]=_0xb5d14[_0x6920('0x37')];this['predictiveIntervalTotalCalls']=_0xb5d14[_0x6920('0x38')];this[_0x6920('0x8')]=_0xb5d14[_0x6920('0x8')];this[_0x6920('0x39')]=_0xb5d14['erlangCalls'];this[_0x6920('0x3a')]=_0xb5d14[_0x6920('0x3a')];this['erlangAbandonmentRate']=_0xb5d14['erlangAbandonmentRate'];this[_0x6920('0x3b')]=_0xb5d14[_0x6920('0x3b')];this['startPredictive']=_0xb5d14[_0x6920('0x3c')];this[_0x6920('0x3d')]=_0xb5d14['startProgressive'];this['message']=_0xb5d14[_0x6920('0x3e')];this[_0x6920('0x3f')]=_0xb5d14[_0x6920('0x3f')];}if(_0xb5d14[_0x6920('0x40')]){this[_0x6920('0x40')]={'id':_0xb5d14['Trunk']['id'],'name':_0xb5d14['Trunk']['name'],'active':_0xb5d14[_0x6920('0x40')]['active'],'callerid':_0xb5d14['Trunk'][_0x6920('0x41')]};}}VoiceQueueSummary[_0x6920('0x42')]['createReport']=function(_0x3aad11,_0x4bb5e5,_0x2755fd,_0x2627ac){this[_0x6920('0x2')]=0x0;this[_0x6920('0x5')]=0x0;this[_0x6920('0x3')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x6920('0x7')]=0x0;this['busy']=0x0;this['invalid']=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0x6920('0x1b')]=0x0;this[_0x6920('0x19')]=0x0;if(_0x2755fd){if(_0x2755fd[_0x6920('0x0')]){this['available']=Number(_0x2755fd[_0x6920('0x0')]);}if(_0x2755fd[_0x6920('0x43')]){this[_0x6920('0x1')]=Number(_0x2755fd[_0x6920('0x43')]);}if(_0x2755fd[_0x6920('0x44')]){this[_0x6920('0x14')]=Number(_0x2755fd['callers']);}}for(var _0x2ff770=0x0;_0x2ff770<_0x3aad11[_0x6920('0x45')];_0x2ff770++){var _0x3b0570=_0x4bb5e5[_0x6920('0x46')+_0x3aad11[_0x2ff770][_0x6920('0x15')]];if(_0x3b0570&&_0x3b0570[_0x6920('0x47')]){this[_0x6920('0x2')]+=0x1;}if(_0x3aad11[_0x2ff770][_0x6920('0x48')]==='1'){this[_0x6920('0x5')]+=0x1;}if(_0x3aad11[_0x2ff770][_0x6920('0x3')]==='1'&&!['2','7','8'][_0x6920('0x49')](_0x3aad11[_0x2ff770][_0x6920('0x4a')])){this['paused']+=0x1;}switch(_0x3aad11[_0x2ff770][_0x6920('0x4a')]){case'0':this[_0x6920('0x1f')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x6920('0x17')]+=0x1;break;case'4':this[_0x6920('0x18')]+=0x1;break;case'5':this[_0x6920('0x1e')]+=0x1;break;case'6':this[_0x6920('0x4')]+=0x1;break;case'7':this[_0x6920('0x1b')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x6920('0x22')]===_0x6920('0x4b')){var _0x46d4a9=Object['keys'](_0x2627ac);for(var _0x4d1c79=0x0;_0x4d1c79<_0x46d4a9[_0x6920('0x45')];_0x4d1c79++){var _0x2a5e23=_0x46d4a9[_0x4d1c79];var _0x2bdc8a=_0x2627ac[_0x2a5e23];if(_0x2bdc8a[_0x6920('0x4c')]===this['name']&&_0x2bdc8a[_0x6920('0x1d')]===_0x6920('0x4d')&&_0x2bdc8a[_0x6920('0x4e')]===_0x6920('0x4f')){this[_0x6920('0x5')]+=0x1;}}if(this['talking']>this[_0x6920('0x7')]){this[_0x6920('0x5')]=this[_0x6920('0x7')];}this[_0x6920('0x10')]=0x0;}return this;};VoiceQueueSummary[_0x6920('0x42')][_0x6920('0x50')]=function(_0x4a2a71){var _0x30dd6e=![];if(_0x4a2a71){_0x30dd6e=INBOUND_COUNTERS[_0x6920('0x51')](function(_0x1c6bba){return this[_0x1c6bba]!==_0x4a2a71[_0x1c6bba];},this);}return _0x30dd6e;};VoiceQueueSummary['prototype'][_0x6920('0x52')]=function(_0x303247){var _0x127b78=![];var _0xd5567c=![];var _0x9983bc=![];if(_0x303247){_0x127b78=this[_0x6920('0x22')]!==_0x303247[_0x6920('0x22')]||this['dialActive']!==_0x303247[_0x6920('0x21')]||this[_0x6920('0x3e')]!==_0x303247[_0x6920('0x3e')]||this[_0x6920('0x3f')]!==_0x303247['statusMessage'];_0xd5567c=OUTBOUND_COUNTERS['some'](function(_0x51bc4e){return this[_0x51bc4e]!==_0x303247[_0x51bc4e];},this);if(this[_0x6920('0x40')]&&_0x303247[_0x6920('0x40')]){_0x9983bc=this[_0x6920('0x40')]['name']!==_0x303247[_0x6920('0x40')][_0x6920('0x15')]||this[_0x6920('0x40')][_0x6920('0x53')]!==_0x303247[_0x6920('0x40')][_0x6920('0x53')];}}return _0x127b78||_0xd5567c||_0x9983bc;};VoiceQueueSummary[_0x6920('0x42')]['updateReportFromOutboundQueue']=function(_0x188507){this[_0x6920('0x6')]=_0x188507['answered'];this[_0x6920('0x3e')]=_0x188507[_0x6920('0x3e')];this[_0x6920('0x3f')]=_0x188507[_0x6920('0x3f')];this[_0x6920('0x8')]=_0x188507['originated'];this[_0x6920('0x54')]=_0x188507[_0x6920('0x54')];this['outboundAnswerCallsDay']=_0x188507[_0x6920('0x9')];this[_0x6920('0xa')]=_0x188507['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x188507[_0x6920('0xb')];this[_0x6920('0xc')]=_0x188507['outboundCongestionCallsDay'];this[_0x6920('0x2b')]=_0x188507[_0x6920('0x2b')];this[_0x6920('0x2c')]=_0x188507[_0x6920('0x2c')];this[_0x6920('0xd')]=_0x188507[_0x6920('0xd')];this[_0x6920('0xe')]=_0x188507['outboundRejectCallsDay'];this[_0x6920('0xf')]=_0x188507[_0x6920('0xf')];this[_0x6920('0x11')]=_0x188507[_0x6920('0x11')];this[_0x6920('0x12')]=_0x188507[_0x6920('0x12')];this[_0x6920('0x13')]=_0x188507[_0x6920('0x13')];if(this[_0x6920('0x22')]==='preview'){this[_0x6920('0x10')]=_0x188507[_0x6920('0x10')];}};module[_0x6920('0x55')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d8e8f3d..3e88271 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 _0x91ac=['serverUrl','exports','name','username','accessKey','remoteUri'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0x91ac,0x17c));var _0xc91a=function(_0x4bbccf,_0x43982f){_0x4bbccf=_0x4bbccf-0x0;var _0x453807=_0x91ac[_0x4bbccf];return _0x453807;};'use strict';function VtigerAccount(_0x3c94eb){this['id']=_0x3c94eb['id']||0x0;this[_0xc91a('0x0')]=_0x3c94eb[_0xc91a('0x0')]||'';this[_0xc91a('0x1')]=_0x3c94eb[_0xc91a('0x1')]||'';this[_0xc91a('0x2')]=_0x3c94eb[_0xc91a('0x2')]||'';this[_0xc91a('0x3')]=_0x3c94eb[_0xc91a('0x3')]||'';this[_0xc91a('0x4')]=_0x3c94eb['serverUrl']||'';this['Configurations']=_0x3c94eb['Configurations']||{};}module[_0xc91a('0x5')]=VtigerAccount; \ No newline at end of file +var _0xd08b=['name','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd08b,0x1d4));var _0xbd08=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0xd08b[_0x17823f];return _0x51fc21;};'use strict';function VtigerAccount(_0x78b02a){this['id']=_0x78b02a['id']||0x0;this[_0xbd08('0x0')]=_0x78b02a[_0xbd08('0x0')]||'';this['username']=_0x78b02a['username']||'';this[_0xbd08('0x1')]=_0x78b02a[_0xbd08('0x1')]||'';this[_0xbd08('0x2')]=_0x78b02a[_0xbd08('0x2')]||'';this[_0xbd08('0x3')]=_0x78b02a[_0xbd08('0x3')]||'';this[_0xbd08('0x4')]=_0x78b02a[_0xbd08('0x4')]||{};}module[_0xbd08('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index b9ac6b8..b800482 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 _0xf24a=['token','remoteUri','authType','type','integrationTab','Configurations','exports','name','username','password'];(function(_0x31611f,_0x1e6d20){var _0x3185e6=function(_0x4d8ec1){while(--_0x4d8ec1){_0x31611f['push'](_0x31611f['shift']());}};_0x3185e6(++_0x1e6d20);}(_0xf24a,0x18d));var _0xaf24=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf24a[_0x321bb2];return _0x9c12ed;};'use strict';function ZendeskAccount(_0x257cfd){this['id']=_0x257cfd['id']||0x0;this[_0xaf24('0x0')]=_0x257cfd['name']||'';this[_0xaf24('0x1')]=_0x257cfd['username']||'';this[_0xaf24('0x2')]=_0x257cfd[_0xaf24('0x2')]||'';this['token']=_0x257cfd[_0xaf24('0x3')]||'';this['remoteUri']=_0x257cfd[_0xaf24('0x4')]||'';this[_0xaf24('0x5')]=_0x257cfd[_0xaf24('0x5')]||'';this['type']=_0x257cfd[_0xaf24('0x6')]||_0xaf24('0x7');this['serverUrl']=_0x257cfd['serverUrl']||'';this[_0xaf24('0x8')]=_0x257cfd[_0xaf24('0x8')]||{};}module[_0xaf24('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x484e=['token','remoteUri','authType','type','serverUrl','Configurations','name','username','password'];(function(_0x357b22,_0x1a49bb){var _0x78bc3a=function(_0x21a687){while(--_0x21a687){_0x357b22['push'](_0x357b22['shift']());}};_0x78bc3a(++_0x1a49bb);}(_0x484e,0x12f));var _0xe484=function(_0x1a4285,_0x372af9){_0x1a4285=_0x1a4285-0x0;var _0x2ece29=_0x484e[_0x1a4285];return _0x2ece29;};'use strict';function ZendeskAccount(_0x18e4f1){this['id']=_0x18e4f1['id']||0x0;this[_0xe484('0x0')]=_0x18e4f1[_0xe484('0x0')]||'';this[_0xe484('0x1')]=_0x18e4f1[_0xe484('0x1')]||'';this[_0xe484('0x2')]=_0x18e4f1[_0xe484('0x2')]||'';this[_0xe484('0x3')]=_0x18e4f1[_0xe484('0x3')]||'';this[_0xe484('0x4')]=_0x18e4f1['remoteUri']||'';this[_0xe484('0x5')]=_0x18e4f1[_0xe484('0x5')]||'';this[_0xe484('0x6')]=_0x18e4f1['type']||'integrationTab';this['serverUrl']=_0x18e4f1[_0xe484('0x7')]||'';this['Configurations']=_0x18e4f1[_0xe484('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index eae4f97..7690594 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 _0x7500=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x41ea22,_0x3b31f4){var _0x9694d3=function(_0x19a86d){while(--_0x19a86d){_0x41ea22['push'](_0x41ea22['shift']());}};_0x9694d3(++_0x3b31f4);}(_0x7500,0x7e));var _0x0750=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7500[_0x2c91e9];return _0x13f0ff;};'use strict';function ZohoAccount(_0xa9ef2f){this['id']=_0xa9ef2f['id']||0x0;this['name']=_0xa9ef2f[_0x0750('0x0')]||'';this['description']=_0xa9ef2f[_0x0750('0x1')]||'';this[_0x0750('0x2')]=_0xa9ef2f[_0x0750('0x2')]||'';this[_0x0750('0x3')]=_0xa9ef2f[_0x0750('0x3')]||'';this[_0x0750('0x4')]=_0xa9ef2f[_0x0750('0x4')]||'';this[_0x0750('0x5')]=_0xa9ef2f[_0x0750('0x5')]||'';this['serverUrl']=_0xa9ef2f[_0x0750('0x6')]||'';this[_0x0750('0x7')]=_0xa9ef2f[_0x0750('0x7')]||'';this[_0x0750('0x8')]=_0xa9ef2f[_0x0750('0x8')]||'';this[_0x0750('0x9')]=_0xa9ef2f[_0x0750('0x9')]||{};}module[_0x0750('0xa')]=ZohoAccount; \ No newline at end of file +var _0xbc5b=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x3c7a73,_0x3cd0f5){var _0xd0e2b6=function(_0x5df90d){while(--_0x5df90d){_0x3c7a73['push'](_0x3c7a73['shift']());}};_0xd0e2b6(++_0x3cd0f5);}(_0xbc5b,0x94));var _0xbbc5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbc5b[_0x20a584];return _0x4b41a8;};'use strict';function ZohoAccount(_0x30dd06){this['id']=_0x30dd06['id']||0x0;this['name']=_0x30dd06[_0xbbc5('0x0')]||'';this[_0xbbc5('0x1')]=_0x30dd06[_0xbbc5('0x1')]||'';this['host']=_0x30dd06[_0xbbc5('0x2')]||'';this[_0xbbc5('0x3')]=_0x30dd06[_0xbbc5('0x3')]||'';this[_0xbbc5('0x4')]=_0x30dd06[_0xbbc5('0x4')]||'';this['clientSecret']=_0x30dd06[_0xbbc5('0x5')]||'';this[_0xbbc5('0x6')]=_0x30dd06[_0xbbc5('0x6')]||'';this[_0xbbc5('0x7')]=_0x30dd06[_0xbbc5('0x7')]||'';this['refreshToken']=_0x30dd06[_0xbbc5('0x8')]||'';this[_0xbbc5('0x9')]=_0x30dd06[_0xbbc5('0x9')]||{};}module[_0xbbc5('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 c086fb3..3b60c72 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 _0x8603=['prototype','getCaller','number','exports','lodash','moment','isNil','string','uniqueid','type','queue','dialAnswer','Agent','name','channelAgent','format','SIP/%s','membername','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x321961,_0x2e2ccd){var _0x5bc995=function(_0x399e4a){while(--_0x399e4a){_0x321961['push'](_0x321961['shift']());}};_0x5bc995(++_0x2e2ccd);}(_0x8603,0x190));var _0x3860=function(_0x20d805,_0x3ddce9){_0x20d805=_0x20d805-0x0;var _0x2413ab=_0x8603[_0x20d805];return _0x2413ab;};'use strict';var util=require('util');var _=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));function checkNameSurname(_0x96d2bc,_0x51bfda,_0x4961d6){var _0x2ebe8b='';if(!_[_0x3860('0x2')](_0x51bfda)&&_0x3860('0x3')===typeof _0x51bfda){_0x2ebe8b+=_0x51bfda;}if(!_['isNil'](_0x4961d6)&&_0x3860('0x3')===typeof _0x4961d6){_0x2ebe8b+='\x20'+_0x4961d6;}if(_0x2ebe8b!==''){return _0x2ebe8b;}return _0x96d2bc;}function Action(_0x56f8c5,_0xb0fc24,_0x40739b,_0x1eca44,_0xd3ce26){this[_0x3860('0x4')]=_0x40739b||undefined;this['idContact']=_0x56f8c5['id'];this['queue']=_0xb0fc24['name'];this[_0x3860('0x5')]=_0xb0fc24[_0x3860('0x5')];this['campaigntype']=_0x3860('0x6');this[_0x3860('0x7')]=![];this['membername']=_[_0x3860('0x2')](_0x56f8c5[_0x3860('0x8')])?undefined:_0x56f8c5['Agent'][_0x3860('0x9')];this[_0x3860('0xa')]=this['membername']?util[_0x3860('0xb')](_0x3860('0xc'),this[_0x3860('0xd')]):_0x1eca44||undefined;this[_0x3860('0xe')]=checkNameSurname(_0x56f8c5[_0x3860('0xf')][_0x3860('0x10')],_0x56f8c5[_0x3860('0xf')][_0x3860('0x11')],_0x56f8c5[_0x3860('0xf')][_0x3860('0x12')]);this['active']=_0x56f8c5[_0x3860('0x13')]||![];this[_0x3860('0x14')]=_0x56f8c5[_0x3860('0x10')];this[_0x3860('0x15')]=_0x56f8c5[_0x3860('0x15')];this[_0x3860('0x16')]=_0x56f8c5[_0x3860('0x16')]||0x0;this[_0x3860('0x17')]=_0x56f8c5[_0x3860('0x17')]||0x0;this[_0x3860('0x18')]=_0x56f8c5[_0x3860('0x18')]||0x0;this[_0x3860('0x19')]=(_0x56f8c5['countbusyretry']||0x0)+(_0x56f8c5['countcongestionretry']||0x0)+(_0x56f8c5[_0x3860('0x18')]||0x0)+(_0x56f8c5[_0x3860('0x1a')]||0x0)+(_0x56f8c5[_0x3860('0x1b')]||0x0)+(_0x56f8c5['countabandonedretry']||0x0)+(_0x56f8c5[_0x3860('0x1c')]||0x0)+(_0x56f8c5[_0x3860('0x1d')]||0x0);this[_0x3860('0x1a')]=_0x56f8c5[_0x3860('0x1a')]||0x0;this[_0x3860('0x1b')]=_0x56f8c5[_0x3860('0x1b')]||0x0;this[_0x3860('0x1e')]=_0x56f8c5[_0x3860('0x1e')]||0x0;this[_0x3860('0x1c')]=_0x56f8c5[_0x3860('0x1c')]||0x0;this[_0x3860('0x1d')]=_0x56f8c5[_0x3860('0x1d')]||0x0;this[_0x3860('0x1f')]=_0x56f8c5[_0x3860('0x1f')];this[_0x3860('0x20')]=_0x56f8c5['callbackuniqueid'];this[_0x3860('0x21')]=_0x56f8c5[_0x3860('0x21')];this[_0x3860('0x22')]=_0x56f8c5[_0x3860('0x22')];this[_0x3860('0x23')]=_0x56f8c5['ContactId'];this[_0x3860('0x24')]=_0x56f8c5['ListId'];this['UserId']=_[_0x3860('0x2')](_0x56f8c5[_0x3860('0x8')])?_0x56f8c5['UserId']:_0x56f8c5['Agent']['id'];this['VoiceQueueId']=_0x56f8c5[_0x3860('0x25')];this[_0x3860('0x26')]='';this[_0x3860('0x27')]='';}Action[_0x3860('0x28')][_0x3860('0x29')]=function(){return util[_0x3860('0xb')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x3860('0x2a')]);};module[_0x3860('0x2b')]=Action; \ No newline at end of file +var _0xd4a2=['type','campaigntype','dialAnswer','membername','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','Agent','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','exports','util','isNil','string','uniqueid','idContact','queue','name'];(function(_0x572f2a,_0x345a9a){var _0x1f0ac2=function(_0x3b8169){while(--_0x3b8169){_0x572f2a['push'](_0x572f2a['shift']());}};_0x1f0ac2(++_0x345a9a);}(_0xd4a2,0x173));var _0x2d4a=function(_0x197468,_0x3eb01c){_0x197468=_0x197468-0x0;var _0x53cb0a=_0xd4a2[_0x197468];return _0x53cb0a;};'use strict';var util=require(_0x2d4a('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0xfba415,_0x576ffe,_0x2a8a71){var _0x57c5ca='';if(!_[_0x2d4a('0x1')](_0x576ffe)&&'string'===typeof _0x576ffe){_0x57c5ca+=_0x576ffe;}if(!_[_0x2d4a('0x1')](_0x2a8a71)&&_0x2d4a('0x2')===typeof _0x2a8a71){_0x57c5ca+='\x20'+_0x2a8a71;}if(_0x57c5ca!==''){return _0x57c5ca;}return _0xfba415;}function Action(_0x2624b5,_0x3a88e2,_0x1ca10b,_0x57058f,_0x45fefb){this[_0x2d4a('0x3')]=_0x1ca10b||undefined;this[_0x2d4a('0x4')]=_0x2624b5['id'];this[_0x2d4a('0x5')]=_0x3a88e2[_0x2d4a('0x6')];this[_0x2d4a('0x7')]=_0x3a88e2[_0x2d4a('0x7')];this[_0x2d4a('0x8')]=_0x2d4a('0x5');this[_0x2d4a('0x9')]=![];this[_0x2d4a('0xa')]=_[_0x2d4a('0x1')](_0x2624b5['Agent'])?undefined:_0x2624b5['Agent'][_0x2d4a('0x6')];this['channelAgent']=this[_0x2d4a('0xa')]?util[_0x2d4a('0xb')](_0x2d4a('0xc'),this[_0x2d4a('0xa')]):_0x57058f||undefined;this[_0x2d4a('0xd')]=checkNameSurname(_0x2624b5[_0x2d4a('0xe')][_0x2d4a('0xf')],_0x2624b5[_0x2d4a('0xe')]['firstName'],_0x2624b5['Contact'][_0x2d4a('0x10')]);this['active']=_0x2624b5[_0x2d4a('0x11')]||![];this[_0x2d4a('0x12')]=_0x2624b5[_0x2d4a('0xf')];this[_0x2d4a('0x13')]=_0x2624b5['scheduledat'];this[_0x2d4a('0x14')]=_0x2624b5['countbusyretry']||0x0;this[_0x2d4a('0x15')]=_0x2624b5['countcongestionretry']||0x0;this[_0x2d4a('0x16')]=_0x2624b5[_0x2d4a('0x16')]||0x0;this[_0x2d4a('0x17')]=(_0x2624b5[_0x2d4a('0x14')]||0x0)+(_0x2624b5['countcongestionretry']||0x0)+(_0x2624b5['countnoanswerretry']||0x0)+(_0x2624b5['countnosuchnumberretry']||0x0)+(_0x2624b5[_0x2d4a('0x18')]||0x0)+(_0x2624b5[_0x2d4a('0x19')]||0x0)+(_0x2624b5[_0x2d4a('0x1a')]||0x0)+(_0x2624b5[_0x2d4a('0x1b')]||0x0);this[_0x2d4a('0x1c')]=_0x2624b5[_0x2d4a('0x1c')]||0x0;this['countdropretry']=_0x2624b5['countdropretry']||0x0;this[_0x2d4a('0x19')]=_0x2624b5[_0x2d4a('0x19')]||0x0;this[_0x2d4a('0x1a')]=_0x2624b5[_0x2d4a('0x1a')]||0x0;this[_0x2d4a('0x1b')]=_0x2624b5[_0x2d4a('0x1b')]||0x0;this[_0x2d4a('0x1d')]=_0x2624b5[_0x2d4a('0x1d')];this['callbackuniqueid']=_0x2624b5[_0x2d4a('0x1e')];this[_0x2d4a('0x1f')]=_0x2624b5[_0x2d4a('0x1f')];this[_0x2d4a('0x20')]=_0x2624b5[_0x2d4a('0x20')];this[_0x2d4a('0x21')]=_0x2624b5[_0x2d4a('0x21')];this[_0x2d4a('0x22')]=_0x2624b5['ListId'];this['UserId']=_['isNil'](_0x2624b5[_0x2d4a('0x23')])?_0x2624b5['UserId']:_0x2624b5[_0x2d4a('0x23')]['id'];this[_0x2d4a('0x24')]=_0x2624b5[_0x2d4a('0x24')];this[_0x2d4a('0x25')]='';this[_0x2d4a('0x26')]='';}Action[_0x2d4a('0x27')][_0x2d4a('0x28')]=function(){return util[_0x2d4a('0xb')]('\x22%s\x22\x20<%s>',this[_0x2d4a('0xd')],this['number']);};module[_0x2d4a('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 ab4ea7b..f31634a 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 _0x75e3=['dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','active','SIP/%s','reachable','execRun','unlock','recallme','validateContact','isValid','phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','assign','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','socket.io-emitter','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','message','CAMPAIGN_STATUS','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','logger','\x20is\x20deactivated','loopCampaigns','syncCampaigns','preview','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','sequence','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','clearZombieChannel','recallMe','getContactRecallMe','agentReadyId','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','format','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking','custom:agentconnect','connect','acw','mandatoryDisposition','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','decrementTalking','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','activeContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay'];(function(_0x6662d9,_0x1055a5){var _0x556686=function(_0x1c6e7e){while(--_0x1c6e7e){_0x6662d9['push'](_0x6662d9['shift']());}};_0x556686(++_0x1055a5);}(_0x75e3,0x1b0));var _0x375e=function(_0x37ed96,_0x2a7a7a){_0x37ed96=_0x37ed96-0x0;var _0x53ed4d=_0x75e3[_0x37ed96];return _0x53ed4d;};'use strict';var util=require(_0x375e('0x0'));var _=require(_0x375e('0x1'));var uuid=require(_0x375e('0x2'));var moment=require(_0x375e('0x3'));var Redis=require(_0x375e('0x4'));var config=require('../../../config/environment');var logger=require(_0x375e('0x5'))('preview');var loggerAction=require('../../../config/logger')(_0x375e('0x6'));var ami=require(_0x375e('0x7'));var rpcDb=require(_0x375e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x375e('0x9'));var ut=require(_0x375e('0xa'));var utils=require(_0x375e('0xb'));config['redis']=_['defaults'](config[_0x375e('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x375e('0xd'))(new Redis(config[_0x375e('0xc')]));var Sequence=function(){};Sequence[_0x375e('0xe')][_0x375e('0xf')]=function(_0x92e865){this[_0x375e('0x10')]=this[_0x375e('0x10')]?this[_0x375e('0x10')][_0x375e('0x11')](_0x92e865):_0x92e865();};function Preview(_0x283927){this['sequence']=new Sequence();this['campaignsPreview']=_0x283927[_0x375e('0x12')];this[_0x375e('0x13')]=_0x283927[_0x375e('0x13')];this[_0x375e('0x14')]={};this[_0x375e('0x15')]=_0x283927['agents'];this[_0x375e('0x16')]=0x0;ami['on'](_0x375e('0x17'),this[_0x375e('0x18')][_0x375e('0x19')](this));ami['on'](_0x375e('0x1a'),this[_0x375e('0x1b')][_0x375e('0x19')](this));ami['on'](_0x375e('0x1c'),this[_0x375e('0x1d')]['bind'](this));ami['on']('dialend',this[_0x375e('0x1e')][_0x375e('0x19')](this));ami['on'](_0x375e('0x1f'),this[_0x375e('0x20')][_0x375e('0x19')](this));ami['on'](_0x375e('0x21'),this[_0x375e('0x22')][_0x375e('0x19')](this));ami['on'](_0x375e('0x23'),this[_0x375e('0x24')][_0x375e('0x19')](this));ami['on'](_0x375e('0x25'),this[_0x375e('0x26')][_0x375e('0x19')](this));this['loopCampaigns'](this[_0x375e('0x27')]);}function emit(_0x13014c,_0x4f8f89,_0xfb8423){io['to'](_0x13014c)[_0x375e('0x28')](_0x4f8f89,_0xfb8423);}function emitVoiceQueueChannelRemove(_0x870736){logger['info'](_0x375e('0x29'),JSON[_0x375e('0x2a')](_0x870736));emit(util['format'](_0x375e('0x2b'),_0x870736[_0x375e('0x2c')]),_0x375e('0x2d'),_0x870736);io[_0x375e('0x28')](_0x375e('0x2e'),_0x870736);}function notSendMessagesQueue(_0x4fc870){if(_0x4fc870[_0x375e('0x2f')]){if(_0x4fc870[_0x375e('0x30')]===0x0&&_0x4fc870['pTalking']===0x0){_0x4fc870[_0x375e('0x2f')]=![];_0x4fc870[_0x375e('0x31')]=0x0;_0x4fc870['paused']=0x0;_0x4fc870[_0x375e('0x32')]=utils[_0x375e('0x33')]['INACTIVE'];ut['logger'](_0x375e('0x34'),_0x4fc870[_0x375e('0x2c')]+_0x375e('0x35'));}else{_0x4fc870['message']=utils[_0x375e('0x33')][_0x375e('0x36')];ut[_0x375e('0x37')](_0x375e('0x34'),_0x4fc870['name']+_0x375e('0x38'));}}}Preview[_0x375e('0xe')][_0x375e('0x39')]=function(){var _0x1c165b=this;setInterval(function(){_0x1c165b[_0x375e('0x3a')]();},0x7cf);};Preview[_0x375e('0xe')][_0x375e('0x3a')]=function(){var _0x5dceb3=this[_0x375e('0x27')];this[_0x375e('0x16')]+=0x1;for(var _0x15c719 in _0x5dceb3){if(_0x5dceb3['hasOwnProperty'](_0x15c719)&&(_0x5dceb3[_0x15c719]['dialMethod']===_0x375e('0x3b')||_0x5dceb3[_0x15c719][_0x375e('0x3c')]===_0x375e('0x3d'))&&_0x5dceb3[_0x15c719][_0x375e('0x3e')]===_0x375e('0x3f')){if(this[_0x375e('0x16')]>0x7){this[_0x375e('0x16')]=0x0;this[_0x375e('0x40')]();}}if(_0x5dceb3[_0x375e('0x41')](_0x15c719)&&_0x5dceb3[_0x15c719][_0x375e('0x3c')]===_0x375e('0x3b')&&_0x5dceb3[_0x15c719]['type']==='outbound'){if(_0x5dceb3[_0x15c719][_0x375e('0x42')]){this[_0x375e('0x43')](_0x5dceb3[_0x15c719]);if(_0x5dceb3[_0x15c719][_0x375e('0x44')])this['recallMe'](_0x5dceb3[_0x15c719]);}else{notSendMessagesQueue(_0x5dceb3[_0x15c719]);}}}};Preview[_0x375e('0xe')]['clearZombieChannel']=function(_0x33378b){var _0x31541e=this;this[_0x375e('0x45')][_0x375e('0xf')](function(){if(!_['isNil'](_0x31541e[_0x375e('0x14')][_0x33378b])){loggerAction[_0x375e('0x46')](_0x375e('0x47'),_0x33378b,_0x375e('0x48'),_0x31541e['actions'][_0x33378b][_0x375e('0x49')],_0x375e('0x4a'),JSON[_0x375e('0x2a')](_0x31541e[_0x375e('0x27')][_0x31541e['actions'][_0x33378b][_0x375e('0x49')]][_0x375e('0x30')]),_0x375e('0x4b'),JSON[_0x375e('0x2a')](_0x31541e[_0x375e('0x27')][_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]]['pTalking']),JSON[_0x375e('0x2a')](_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x4c')]),JSON[_0x375e('0x2a')](_[_0x375e('0x4d')](_0x31541e[_0x375e('0x14')][_0x33378b],[_0x375e('0x4e'),_0x375e('0x4f'),_0x375e('0x50'),'ListId'])));return ami[_0x375e('0x51')]({'action':_0x375e('0x52'),'channel':_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x53')]})[_0x375e('0x54')](function(_0x595850){if(_0x595850[_0x375e('0x32')]===_0x375e('0x55')){setTimeout(function(){if(_0x31541e[_0x375e('0x14')][_0x33378b]){utils[_0x375e('0x56')](_0x31541e['campaignsPreview'][_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]],_0x375e('0x57'));if(_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x4c')]===!![]){ut['decrementTalking'](_0x31541e[_0x375e('0x27')][_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]],_0x375e('0x57'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x33378b,_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]);}ut[_0x375e('0x58')](_0x375e('0x59')+_0x33378b,_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]);delete _0x31541e['actions'][_0x33378b];}},0x2328);}});}});};Preview[_0x375e('0xe')][_0x375e('0x40')]=function(){var _0x5e73f1=this;loggerAction[_0x375e('0x46')](_0x375e('0x5a'),_['size'](this['actions']));for(var _0x32beca in this[_0x375e('0x14')]){if(_0x5e73f1[_0x375e('0x14')][_0x375e('0x41')](_0x32beca)){_0x5e73f1[_0x375e('0x5b')](_0x32beca);}}};Preview[_0x375e('0xe')][_0x375e('0x5c')]=function(_0x25e9b3){var _0xeba5fa=this;rpcDb[_0x375e('0x5d')](_0x25e9b3['id'],ut[_0x375e('0x5e')](this[_0x375e('0x15')]))['then'](function(_0x58826e){if(!_[_0x375e('0x5f')](_0x58826e)){for(var _0x44688b=0x0;_0x44688b<_0x58826e[_0x375e('0x60')];_0x44688b+=0x1){if(ut[_0x375e('0x61')](_0x58826e[_0x44688b][_0x375e('0x62')])<_0x25e9b3[_0x375e('0x63')]*0x3c){if(_0x58826e[_0x44688b][_0x375e('0x64')]&&!_0x58826e[_0x44688b][_0x375e('0x64')][_0x375e('0x65')]){_0xeba5fa[_0x375e('0x66')](_0x58826e[_0x44688b]['id'])[_0x375e('0x67')](ut[_0x375e('0x68')](_0x375e('0x69')))[_0x375e('0x54')](ut[_0x375e('0x68')]('[RecallMe]'));}else{rpcDb[_0x375e('0x6a')](_0x58826e[_0x44688b]['id']);}}else{var _0x5e5664=new Action(_0x58826e[_0x44688b],_0x25e9b3);_0x5e5664[_0x375e('0x6b')]=moment()[_0x375e('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');_0x25e9b3['outboundReCallsDay']+=0x1;ut[_0x375e('0x6d')](_0x5e5664,0x17,_0x375e('0x6e'));if(_0x25e9b3[_0x375e('0x6f')]){rpcDb[_0x375e('0x70')](ut[_0x375e('0x71')](_0x58826e[_0x44688b]));rpcDb[_0x375e('0x72')](_0x5e5664,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x5e5664,0x16,'RecallFailedTimeout');rpcDb[_0x375e('0x72')](_0x5e5664,'[HistoryRecallClose]');rpcDb[_0x375e('0x73')](_0x5e5664,'[HistoryRecallClose]');}}}}})['catch'](ut['logger2'](_0x375e('0x74')));};Preview['prototype'][_0x375e('0x43')]=function(_0x1baf71){_0x1baf71[_0x375e('0x2f')]=!![];if(ut[_0x375e('0x75')](_0x1baf71[_0x375e('0x76')])){_0x1baf71[_0x375e('0x32')]=utils[_0x375e('0x33')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x375e('0x77')](_0x1baf71[_0x375e('0x42')])){_0x1baf71['message']=utils[_0x375e('0x33')][_0x375e('0x78')];}else if(!this[_0x375e('0x79')](_0x1baf71[_0x375e('0x7a')])){if(!this[_0x375e('0x79')](_0x1baf71[_0x375e('0x7b')])){_0x1baf71[_0x375e('0x32')]=utils[_0x375e('0x33')][_0x375e('0x7c')];}else{_0x1baf71[_0x375e('0x32')]=utils[_0x375e('0x33')]['ACTIVE'];}}else{_0x1baf71[_0x375e('0x32')]=utils['CAMPAIGN_STATUS'][_0x375e('0x7d')];}};Preview[_0x375e('0xe')][_0x375e('0x7e')]=function(_0x5b5bb9,_0x36f775,_0x450069){var _0x419ba6=this;var _0x14d479=this['actions'][_0x36f775];var _0x3ade1c=this[_0x375e('0x27')][_0x14d479['queue']];var _0x1e9dd2;var _0x4f1cd0=![];var _0x2e4c6d=0x2;var _0x3fb22b=0x3;if(_0x3ade1c){switch(_0x450069){case'1':_0x3ade1c['outboundNoSuchCallsDay']+=0x1;_0x14d479[_0x375e('0x7f')]+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x0,'NoSuchNumber');ami['emit']('custom:agentnosuchnumber',ut[_0x375e('0x82')](_0x14d479,_0x375e('0x83')));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0x84'));_0x419ba6[_0x375e('0x85')](_0x14d479,'0',_0x3ade1c)[_0x375e('0x67')](function(_0x3851f7){_0x4f1cd0=_0x3851f7[_0x375e('0x86')]==0x1;_0x2e4c6d=_0x3ade1c[_0x375e('0x87')];_0x3fb22b=_0x3ade1c[_0x375e('0x88')];if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,'Global');rpcDb['createCustomerFinal'](_0x1e9dd2,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x14d479['countnosuchnumberretry']>=_0x3ade1c[_0x375e('0x8b')]){rpcDb[_0x375e('0x73')](_0x14d479,_0x375e('0x8c'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,'countnosuchnumberretry',_0x3ade1c[_0x375e('0x87')]),_0x14d479['unlockAgent'],_0x14d479['activeContact']);}}delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0x8f')]];}else{_0x14d479[_0x375e('0x7f')]++;logger[_0x375e('0x46')](_0x375e('0x90'),_0x14d479[_0x375e('0x7f')]);logger[_0x375e('0x46')]('id',_0x14d479[_0x375e('0x91')]);_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnosuchnumberretry':_0x14d479[_0x375e('0x7f')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case _0x375e('0x94'):var _0x1d5d06=moment()[_0x375e('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');_0x14d479[_0x375e('0x95')]=_0x1d5d06;_0x14d479['answertime']=_0x1d5d06;_0x14d479[_0x375e('0x4c')]=!![];_0x3ade1c['pTalking']+=0x1;logger[_0x375e('0x46')](_0x375e('0x96'),_0x14d479[_0x375e('0x97')],_0x375e('0x98'),_0x3ade1c[_0x375e('0x2c')],_0x375e('0x4b'),_0x3ade1c[_0x375e('0x99')]);ami[_0x375e('0x28')](_0x375e('0x9a'),ut['buildObj'](_0x14d479,_0x375e('0x9b'),this[_0x375e('0x27')][_0x14d479[_0x375e('0x49')]]));if(_0x3ade1c[_0x375e('0x9c')]||_0x3ade1c[_0x375e('0x9d')]){ami[_0x375e('0x28')]('custom:agentConnectPreview',{'queue':_0x14d479[_0x375e('0x49')],'interface':_0x14d479[_0x375e('0x9e')],'uniqueid':_0x14d479[_0x375e('0x97')]});}break;case'16':ami[_0x375e('0x28')](_0x375e('0x9f'),ut[_0x375e('0x82')](_0x14d479,_0x375e('0xa0'),this[_0x375e('0x27')][_0x14d479[_0x375e('0x49')]]));emitVoiceQueueChannelRemove(ut[_0x375e('0x82')](_0x14d479,_0x375e('0xa0')));_0x3ade1c[_0x375e('0xa1')]+=0x1;_0x3ade1c[_0x375e('0xa2')]+=0x1;_0x3ade1c['answered']+=0x1;ut[_0x375e('0xa3')](_0x3ade1c,_0x375e('0xa4'));_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x4,_0x375e('0xa5'));rpcDb['createCustomerHistory'](_0x14d479,_0x375e('0xa6'));rpcDb[_0x375e('0x73')](_0x14d479,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x375e('0xa7')](_0x14d479);_0x3ade1c[_0x375e('0xa8')]+=_0x14d479['talktime'];_0x3ade1c['sumBillable']+=_0x14d479['talktime'];logger[_0x375e('0x46')](_0x375e('0xa9'),_0x14d479[_0x375e('0x97')],_0x375e('0x98'),_0x3ade1c[_0x375e('0x2c')],_0x375e('0x4b'),_0x3ade1c[_0x375e('0x99')]);delete this[_0x375e('0x14')][_0x5b5bb9['linkedid']];break;case _0x375e('0xaa'):_0x3ade1c[_0x375e('0xab')]+=0x1;_0x14d479[_0x375e('0xac')]+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x5,_0x375e('0xad'));_0x2e4c6d=_0x3ade1c['dialBusyRetryFrequency'];_0x3fb22b=_0x3ade1c['callAdditionalPhoneAfterMin'];ami[_0x375e('0x28')]('custom:agentbusy',ut[_0x375e('0x82')](_0x14d479,'busy'));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xae'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'5',_0x3ade1c)[_0x375e('0x67')](function(_0x4bc6a4){_0x4f1cd0=_0x4bc6a4['additional']==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xb0'));}else{if(_0x14d479[_0x375e('0xac')]>=_0x3ade1c[_0x375e('0xb1')]){rpcDb['createCustomerFinal'](_0x14d479,_0x375e('0xae'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xac'),_0x3ade1c[_0x375e('0xb2')]),_0x14d479[_0x375e('0xb3')],_0x14d479['activeContact']);}}}else{_0x14d479[_0x375e('0xac')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countbusyretry':_0x14d479[_0x375e('0xac')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case _0x375e('0xb4'):_0x3ade1c[_0x375e('0xb5')]+=0x1;_0x14d479['countnoanswerretry']+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x3,_0x375e('0xb6'));_0x2e4c6d=_0x3ade1c[_0x375e('0xb7')];_0x3fb22b=_0x3ade1c[_0x375e('0x88')];var _0x3ff21c=ut[_0x375e('0xb8')](_0x14d479,_0x3ade1c);ami[_0x375e('0x28')]('custom:agentnoanswer',_0x3ff21c);rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xb9'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'3',_0x3ade1c)[_0x375e('0x67')](function(_0x195ee3){_0x4f1cd0=_0x195ee3[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c['dialGlobalMaxRetry']){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xba'));}else{if(_0x14d479[_0x375e('0xbb')]>=_0x3ade1c['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x14d479,_0x375e('0xb9'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xbb'),_0x3ade1c[_0x375e('0xb7')]),_0x14d479[_0x375e('0xb3')],_0x14d479[_0x375e('0xbc')]);}}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479[_0x375e('0xbb')]}})['then'](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case _0x375e('0xbd'):_0x3ade1c[_0x375e('0xbe')]+=0x1;_0x14d479[_0x375e('0xbf')]+=0x1;_0x14d479[_0x375e('0x80')]=ut['totalGlobal'](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x8,_0x375e('0xc0'));_0x2e4c6d=_0x3ade1c[_0x375e('0xc1')];_0x3fb22b=_0x3ade1c[_0x375e('0x88')];ami['emit'](_0x375e('0xc2'),ut[_0x375e('0x82')](_0x14d479,_0x375e('0xc3')));rpcDb['createCustomerHistory'](_0x14d479,_0x375e('0xc4'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'8',_0x3ade1c)[_0x375e('0x67')](function(_0x31a3a9){_0x4f1cd0=_0x31a3a9[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xc5'));}else{if(_0x14d479[_0x375e('0xbf')]>=_0x3ade1c[_0x375e('0xc6')]){rpcDb[_0x375e('0x73')](_0x14d479,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xbf'),_0x3ade1c['dialBusyRetryFrequency']),_0x14d479[_0x375e('0xb3')],_0x14d479[_0x375e('0xbc')]);}}}else{_0x14d479[_0x375e('0xbf')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countcongestionretry':_0x14d479[_0x375e('0xbf')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case _0x375e('0xc7'):_0x3ade1c[_0x375e('0xc8')]+=0x1;_0x14d479['countagentrejectretry']+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x14,'AgentReject');_0x2e4c6d=_0x3ade1c['dialAgentRejectRetryFrequency'];_0x3fb22b=_0x3ade1c['callAdditionalPhoneAfterMin'];ami[_0x375e('0x28')](_0x375e('0xc9'),ut[_0x375e('0x82')](_0x14d479,_0x375e('0xca')));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xcb'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'20',_0x3ade1c)[_0x375e('0x67')](function(_0x3d76b7){_0x4f1cd0=_0x3d76b7[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0x14,'AgentReject');rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xcc'));}else{if(_0x14d479[_0x375e('0xcd')]>=_0x3ade1c['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x14d479,_0x375e('0xcc'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xcd'),_0x3ade1c[_0x375e('0xce')]),_0x14d479[_0x375e('0xb3')],_0x14d479[_0x375e('0xbc')]);}}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479[_0x375e('0xbb')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)['then'](function(){});});}});break;case _0x375e('0xcf'):_0x3ade1c[_0x375e('0xd0')]+=0x1;_0x14d479['countabandonedretry']+=0x1;_0x14d479[_0x375e('0x80')]=ut['totalGlobal'](_0x14d479);ut['logCustomer'](_0x14d479,0xb,_0x375e('0xd1'));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xd2'));_0x419ba6[_0x375e('0x85')](_0x14d479,'11',_0x3ade1c)[_0x375e('0x67')](function(_0x452d5f){_0x4f1cd0=_0x452d5f[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c['dialGlobalMaxRetry']){_0x1e9dd2=ut['cloneAction'](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xd2'));}else{if(_0x14d479[_0x375e('0xd3')]>=_0x3ade1c[_0x375e('0xd4')]){rpcDb[_0x375e('0x73')](_0x14d479,_0x375e('0xd2'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xd5'),_0x3ade1c[_0x375e('0xd6')]),_0x14d479['unlockAgent'],_0x14d479[_0x375e('0xbc')]);}}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479[_0x375e('0xbb')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case'18':_0x3ade1c[_0x375e('0xd7')]+=0x1;_0x14d479['countmachineretry']+=0x1;_0x14d479[_0x375e('0x80')]=ut['totalGlobal'](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x12,_0x5b5bb9['cause-txt']||_0x5b5bb9[_0x375e('0xd8')]);ami[_0x375e('0x28')](_0x375e('0xd9'),ut[_0x375e('0x82')](_0x14d479,'amd'));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xda'));_0x419ba6[_0x375e('0x85')](_0x14d479,'18',_0x3ade1c)[_0x375e('0x67')](function(_0x3d6fe2){_0x4f1cd0=_0x3d6fe2[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0x12,'Global');rpcDb[_0x375e('0x73')](_0x1e9dd2,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x375e('0x73')](_0x14d479,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479['countnoanswerretry']}})['then'](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)['then'](function(){});});}});delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0x8f')]];break;case'19':_0x3ade1c[_0x375e('0xd7')]+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut['logCustomer'](_0x14d479,0x13,_0x5b5bb9[_0x375e('0xdb')]||_0x5b5bb9[_0x375e('0xd8')]);ami['emit'](_0x375e('0xd9'),ut['buildObj'](_0x14d479,'amd'));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xdc'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'18',_0x3ade1c)[_0x375e('0x67')](function(_0x4ba5c4){_0x4f1cd0=_0x4ba5c4[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut['totalGlobal'](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xdc'));}else{rpcDb[_0x375e('0x73')](_0x14d479,_0x375e('0xdc'));}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479['countnoanswerretry']}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0x8f')]];break;default:if(_0x14d479[_0x375e('0x4c')]){ut[_0x375e('0xa3')](_0x3ade1c,'[default]');ut['loggerError'](_0x375e('0xdd')+_0x3ade1c[_0x375e('0x2c')],_0x5b5bb9);}_0x3ade1c[_0x375e('0xd7')]+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0xc,_0x5b5bb9['cause-txt']||_0x5b5bb9[_0x375e('0xd8')]);_0x2e4c6d=_0x3ade1c[_0x375e('0xce')];_0x3fb22b=_0x3ade1c[_0x375e('0x88')];rpcDb[_0x375e('0x72')](_0x14d479,'[callProgressDetectingCustomer][logUnknown]');_0x419ba6[_0x375e('0x85')](_0x14d479,'20',_0x3ade1c)[_0x375e('0x67')](function(_0x249202){_0x4f1cd0=_0x249202['additional']==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,'Global');rpcDb[_0x375e('0x73')](_0x1e9dd2,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x14d479,_0x375e('0xde'));}delete this['actions'][_0x5b5bb9[_0x375e('0x8f')]];}else{_0x419ba6['swapAdditionalPhones'](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});}});}if(!(_0x14d479['dialAnswer']&&_0x450069==='16')){utils[_0x375e('0x56')](_0x3ade1c,_0x375e('0xdf'));logger[_0x375e('0x46')]('[originated][decrement][callProgressDetectingCustomer]',_0x14d479[_0x375e('0x97')],_0x375e('0x98'),_0x3ade1c[_0x375e('0x2c')],_0x375e('0x4a'),_0x3ade1c['originated']);}if(_0x450069!=='ANSWER'){delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0x8f')]];delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0xe0')]];}_0x3ade1c[_0x375e('0xe1')]=!![];}};Preview['prototype'][_0x375e('0xe2')]=function(_0x2cdfb5,_0x405b95,_0x3cd6bf){if(_[_0x375e('0xe3')](_0x405b95)&&_0x375e('0xe4')!==typeof _0x405b95){return;}if(_[_0x375e('0xe3')](_0x3cd6bf)&&_0x375e('0xe4')!==typeof _0x3cd6bf){return;}switch(_0x3cd6bf[_0x375e('0xe5')]){case'0':ut[_0x375e('0xe6')](_0x2cdfb5,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x2cdfb5,_0x375e('0xe7'));break;case'3':ut[_0x375e('0xe6')](_0x2cdfb5,0x3,_0x375e('0xb6'));rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xe9'));break;case'5':ut[_0x375e('0xe6')](_0x2cdfb5,0x5,_0x375e('0xad'));rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xea'));break;case'8':ut[_0x375e('0xe6')](_0x2cdfb5,0x8,'Congestion');rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xeb'));break;case'22':ut['logAgent'](_0x2cdfb5,0x16,_0x375e('0xec'));rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xed'));break;default:ut[_0x375e('0xe6')](_0x2cdfb5,0xc,_0x3cd6bf[_0x375e('0xe5')]);rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xeb'));}utils[_0x375e('0x56')](_0x405b95,'[callProgressDetectingAgent]');logger[_0x375e('0x46')](_0x375e('0xee'),_0x2cdfb5[_0x375e('0x97')],_0x375e('0x98'),_0x405b95[_0x375e('0x2c')],'originated:\x20',_0x405b95[_0x375e('0x30')]);delete this[_0x375e('0x14')][_0x2cdfb5[_0x375e('0x97')]];};Preview[_0x375e('0xe')]['verifyAdditionalPhones']=function(_0x5451c1,_0x33c3f1,_0x3b06eb){return cmHopperAdditionalPhone[_0x375e('0x85')](_0x5451c1,_0x33c3f1,_0x3b06eb)[_0x375e('0x54')](logger[_0x375e('0x46')](_0x375e('0xef')));};Preview[_0x375e('0xe')]['swapAdditionalPhones']=function(_0x5d0fe8,_0x2d02eb,_0x4f137c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5d0fe8,_0x2d02eb,_0x4f137c)[_0x375e('0x54')](logger[_0x375e('0x46')](_0x375e('0xf0')));};Preview[_0x375e('0xe')][_0x375e('0x92')]=function(_0x5c417d){return Promise[_0x375e('0xf1')]()[_0x375e('0x67')](cmHopperAdditionalPhone[_0x375e('0x92')](_0x5c417d))[_0x375e('0x54')](logger[_0x375e('0x46')](_0x375e('0xf2')));};Preview[_0x375e('0xe')][_0x375e('0xf3')]=function(_0x42afac,_0x61657b,_0x18e7bf,_0x3f6de8,_0x17316f){var _0x5995ab=this;return new Promise(function(_0x36e52e,_0x10879b){if(_[_0x375e('0x5f')](_0x61657b)||_[_0x375e('0x5f')](_0x61657b[_0x375e('0xf4')])||_[_0x375e('0x5f')](_0x61657b['phone'])||_['isNil'](_0x61657b[_0x375e('0x50')])){_0x10879b(ut[_0x375e('0x32')]('Contact\x20is\x20undefined',_0x3f6de8,_0x17316f));return;}var _0xd7bfcb=uuid['v4']();var _0x274274=_0x5995ab['campaignsPreview'][_0x61657b[_0x375e('0x48')][_0x375e('0x2c')]];var _0x5ee062=_0x18e7bf?_0x5995ab[_0x375e('0x15')][_0x18e7bf]['id']:undefined;_0x5995ab[_0x375e('0x14')][_0xd7bfcb]=new Action(_0x61657b,_0x274274,_0xd7bfcb,_0x18e7bf,_0x5ee062);var _0xa31f8=_0x5995ab[_0x375e('0x14')][_0xd7bfcb];_0xa31f8[_0x375e('0xb3')]=_0x3f6de8;_0xa31f8['activeContact']=_0x17316f;_0xa31f8[_0x375e('0xf5')]=_0x18e7bf;if(_[_0x375e('0xf6')](_0x42afac)){_0x5995ab[_0x375e('0xf7')](_0xa31f8,_0x274274,_0x61657b,_0x18e7bf)[_0x375e('0x67')](function(_0x587862){logger[_0x375e('0x46')](_0x375e('0xf8'),_0x375e('0xf9')+_0xa31f8['queue']+_0x375e('0xfa')+_0xa31f8[_0x375e('0x91')],JSON[_0x375e('0x2a')](_0x587862));ami[_0x375e('0x28')](_0x375e('0xfb'),ut[_0x375e('0x82')](_0xa31f8,_0x375e('0xfc'),_0x5995ab[_0x375e('0x27')][_0xa31f8[_0x375e('0x49')]]));_0x36e52e(ut[_0x375e('0x32')](_0x375e('0xfd')));})[_0x375e('0x54')](function(_0x15e5ed){ut[_0x375e('0x37')](_0x375e('0xfe'),_0x15e5ed);_0x10879b(ut[_0x375e('0x32')]('Call\x20failed',_0x3f6de8,_0x17316f));});}else{_0x274274[_0x375e('0xff')]+=0x1;ut['logBlacklist'](_0xa31f8);rpcDb[_0x375e('0x100')](_0xa31f8,_0x375e('0x101'));delete _0x5995ab[_0x375e('0x14')][_0xd7bfcb];_0x10879b(ut['message']('Contact\x20in\x20black\x20List',_0x3f6de8,_0x17316f));}});};Preview[_0x375e('0xe')][_0x375e('0x79')]=function(_0xaac10d){return!_[_0x375e('0x5f')](_0xaac10d)&&!_['isNil'](_0xaac10d[_0x375e('0x2c')])&&!_[_0x375e('0x5f')](_0xaac10d[_0x375e('0x102')])&&_0xaac10d[_0x375e('0x102')]&&!_['isNil'](this['trunks'][util[_0x375e('0x6c')](_0x375e('0x103'),_0xaac10d[_0x375e('0x2c')])])&&!_[_0x375e('0x5f')](this[_0x375e('0x13')][util[_0x375e('0x6c')]('SIP/%s',_0xaac10d[_0x375e('0x2c')])][_0x375e('0x52')])&&(this[_0x375e('0x13')][util[_0x375e('0x6c')](_0x375e('0x103'),_0xaac10d[_0x375e('0x2c')])][_0x375e('0x52')]===_0x375e('0x104')||this[_0x375e('0x13')][util[_0x375e('0x6c')]('SIP/%s',_0xaac10d[_0x375e('0x2c')])][_0x375e('0x52')]==='unmonitored');};Preview[_0x375e('0xe')][_0x375e('0x66')]=function(_0x511419,_0x27ed66){return this[_0x375e('0x105')](_0x511419,_0x27ed66)[_0x375e('0x67')](function(_0x4f3e66){return _['pick'](_0x4f3e66,[_0x375e('0x32')]);})[_0x375e('0x54')](function(_0x53aab4){if(_0x53aab4[_0x375e('0x106')]){rpcDb['unlockContact'](_0x511419);}if(_0x53aab4[_0x375e('0x102')]){rpcDb[_0x375e('0x6a')](_0x511419);}throw _[_0x375e('0x4d')](_0x53aab4,[_0x375e('0x32')]);});};Preview[_0x375e('0xe')][_0x375e('0x105')]=function(_0x302dbe,_0x5e7446){var _0x2f5897=this;var _0x274986,_0x361aaa;return rpcDb['getContactPreview'](_0x302dbe)[_0x375e('0x67')](function(_0x46b758){if(!_[_0x375e('0x5f')](_0x46b758[0x0])){_0x361aaa=_0x46b758[0x0]['recallme']?![]:!![];_0x274986=_0x46b758[0x0][_0x375e('0x107')]?!![]:![];_0x274986=_0x5e7446?!![]:_0x274986;}var _0x1e1ddb=_0x2f5897[_0x375e('0x108')](_0x46b758);if(_0x1e1ddb[_0x375e('0x109')]){rpcDb['checkIsBlackList'](_[_0x375e('0x4d')](_0x46b758[0x0],[_0x375e('0x50'),_0x375e('0x10a')]))[_0x375e('0x67')](function(_0x5328d4){_0x2f5897[_0x375e('0xf3')](_0x5328d4,_0x46b758[0x0],_0x5e7446,_0x361aaa,_0x274986)['then'](function(_0x35d60d){return _0x35d60d;})[_0x375e('0x54')](function(_0x5ff14a){throw _0x5ff14a;});})[_0x375e('0x54')](function(_0x24a35c){ut['logger']('[Preview][checkIsBlackList]',_0x24a35c);throw ut[_0x375e('0x32')](_0x375e('0x10b'),_0x361aaa,_0x274986);});}else{throw ut[_0x375e('0x32')](_0x1e1ddb[_0x375e('0x32')],_0x361aaa,_0x274986);}})[_0x375e('0x54')](function(_0xac861c){ut[_0x375e('0x37')]('[Preview][getContactPreview]',_0xac861c);throw ut[_0x375e('0x32')](_0x375e('0x10b'),![],!![]);});};Preview[_0x375e('0xe')][_0x375e('0x108')]=function(_0x5e5f45){if(_[_0x375e('0x5f')](_0x5e5f45)||_[_0x375e('0xf6')](_0x5e5f45)||!_[_0x375e('0x5f')](_0x5e5f45[0x0][_0x375e('0x64')])&&_[_0x375e('0x5f')](_0x5e5f45[0x0]['Agent'][_0x375e('0x2c')])){ut[_0x375e('0x37')](_0x375e('0x10c'),_0x5e5f45);return{'isValid':![],'message':_0x375e('0x10d')};}var _0x184b32=this[_0x375e('0x27')][_0x5e5f45[0x0][_0x375e('0x48')][_0x375e('0x2c')]];_0x184b32['message']=utils[_0x375e('0x33')][_0x375e('0x7d')];if(_[_0x375e('0x5f')](_0x184b32)){ut[_0x375e('0x37')]('[Preview][validateContact][Empty\x20Campaign]',_0x184b32);return{'isValid':![],'message':_0x375e('0x10e')};}if(!this[_0x375e('0x79')](_0x184b32[_0x375e('0x7a')])){ut[_0x375e('0x37')](_0x375e('0x10f'),'campaign\x20Name:\x20'+_0x184b32[_0x375e('0x2c')]+_0x375e('0x110'));if(!this['isTrunkReachable'](_0x184b32['TrunkBackup'])){ut[_0x375e('0x37')](_0x375e('0x10f'),_0x184b32[_0x375e('0x2c')]+_0x375e('0x111'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x375e('0x77')](_0x184b32[_0x375e('0x42')])){ut[_0x375e('0x37')]('[Preview][validateContact][Campaign\x20Active]',_0x184b32[_0x375e('0x2c')]+_0x375e('0x112'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x184b32['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x375e('0x113')};};Preview[_0x375e('0xe')]['execCall']=function(_0x14c1ff,_0x1b813b,_0xeaa864,_0x30abeb){var _0x52ce83=this;return new Promise(function(_0xabeac3,_0x23c98a){var _0x5d1541=_0x14c1ff[_0x375e('0x97')];var _0x2be0d1=_0x52ce83[_0x375e('0x79')](_0x1b813b[_0x375e('0x7a')])?util['format']('SIP/%s/%s%s',_0x1b813b['Trunk'][_0x375e('0x2c')],_['isNil'](_0x1b813b[_0x375e('0x114')])?'':_0x1b813b['dialPrefix'][_0x375e('0x115')]()||'',_0x1b813b[_0x375e('0x116')]>0x0?_0xeaa864[_0x375e('0x10a')][_0x375e('0x117')](_0x1b813b[_0x375e('0x116')]):_0xeaa864[_0x375e('0x10a')]):util[_0x375e('0x6c')](_0x375e('0x118'),_['isNil'](_0x1b813b[_0x375e('0x7b')])?_0x1b813b[_0x375e('0x7a')]['name']:_0x1b813b['TrunkBackup'][_0x375e('0x2c')],_[_0x375e('0x5f')](_0x1b813b[_0x375e('0x114')])?'':_0x1b813b[_0x375e('0x114')][_0x375e('0x115')]()||'',_0x1b813b[_0x375e('0x116')]>0x0?_0xeaa864[_0x375e('0x10a')]['substring'](_0x1b813b['dialCutDigit']):_0xeaa864[_0x375e('0x10a')]);var _0x494a97=_0x52ce83[_0x375e('0x79')](_0x1b813b[_0x375e('0x7a')])?ut[_0x375e('0x119')](_0x1b813b[_0x375e('0x7a')][_0x375e('0x11a')],_0x1b813b[_0x375e('0x11b')],_0x1b813b[_0x375e('0x11c')]>0x0?ut[_0x375e('0x11d')](_0x1b813b[_0x375e('0x11e')],_0x1b813b[_0x375e('0x11c')]):_0x1b813b[_0x375e('0x11e')]):ut[_0x375e('0x119')](_[_0x375e('0x5f')](_0x1b813b[_0x375e('0x7b')])?_0x1b813b[_0x375e('0x7a')][_0x375e('0x11a')]:_0x1b813b['TrunkBackup'][_0x375e('0x11a')],_0x1b813b['dialOriginateCallerIdName'],_0x1b813b['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x375e('0x11d')](_0x1b813b[_0x375e('0x11e')],_0x1b813b['dialRandomLastDigitCallerIdNumber']):_0x1b813b[_0x375e('0x11e')]);if(_0x494a97){_0x14c1ff[_0x375e('0x11f')]=ut[_0x375e('0x120')](_0x494a97);_0x14c1ff[_0x375e('0x121')]=ut[_0x375e('0x122')](_0x494a97);}var _0x2a46a3=ut['addVariables'](_0x1b813b,_0xeaa864,_0x2be0d1,_0x494a97,_0x5d1541,_0x14c1ff);var _0x53068b=utils['setXMDContactVariables'](_0xeaa864[_0x375e('0xf4')]);Object[_0x375e('0x123')](_0x2a46a3,_0x53068b);_[_0x375e('0x124')](_0x14c1ff,ut[_0x375e('0x125')](_0x2a46a3));_0x14c1ff[_0x375e('0x6b')]=moment()[_0x375e('0x6c')](_0x375e('0x126'));_0x1b813b['variables']=_0x2a46a3;var _0x5c3fe3=ut[_0x375e('0x127')](_0x14c1ff,_0x1b813b,_0x2a46a3,_0x14c1ff[_0x375e('0xbc')],_0x30abeb);return ami[_0x375e('0x51')](_0x5c3fe3)[_0x375e('0x67')](function(_0x5e9fd4){_0x1b813b[_0x375e('0x30')]+=0x1;logger['info'](_0x375e('0x128'),_0x5d1541,'\x20Queue',_0x1b813b[_0x375e('0x2c')],_0x375e('0x4a'),_0x1b813b[_0x375e('0x30')]);_0xabeac3(_0x5e9fd4);})[_0x375e('0x54')](function(_0x485249){ut[_0x375e('0xe6')](_0x14c1ff,0xe,_0x375e('0x129'));rpcDb[_0x375e('0xe8')](_0x14c1ff,_0x375e('0x12a'));_0x23c98a(_0x485249);});});};Preview[_0x375e('0xe')][_0x375e('0x20')]=function(_0x2506e5){if(this[_0x375e('0x14')][_0x2506e5[_0x375e('0x8f')]]){this['actions'][_0x2506e5[_0x375e('0x8f')]][_0x375e('0x53')]=_0x2506e5[_0x375e('0x53')];}};Preview[_0x375e('0xe')][_0x375e('0x18')]=function(_0x5341f7){var _0x96e4d1=this;var _0x146819=this[_0x375e('0x14')][_0x5341f7[_0x375e('0x12b')]];if(_0x146819){if(_0x146819[_0x375e('0xf5')]&&this[_0x375e('0x15')][_0x146819[_0x375e('0xf5')]]){ut['logLookAgent'](_0x146819,this[_0x375e('0x15')][_0x146819[_0x375e('0xf5')]][_0x375e('0x2c')],this[_0x375e('0x15')][_0x146819[_0x375e('0xf5')]]['id']);}var _0x293195=_[_0x375e('0x12c')](_0x146819);_0x293195[_0x375e('0x95')]=moment()[_0x375e('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4c2f8a=_0x96e4d1['campaignsPreview'][_0x146819[_0x375e('0x49')]];if(ut['isFailure'](_0x5341f7['response'])){if(_0x146819[_0x375e('0xb3')]){rpcDb[_0x375e('0x12d')](_0x146819['idContact']);}if(_0x146819[_0x375e('0xbc')]){rpcDb['disableContact'](_0x146819[_0x375e('0x91')]);}ami[_0x375e('0x28')](_0x375e('0x12e'),ut[_0x375e('0x82')](_0x146819,_0x375e('0x12f'),this[_0x375e('0x27')][_0x146819[_0x375e('0x49')]]));this[_0x375e('0xe2')](_0x293195,_0x4c2f8a,_0x5341f7);}else{_0x146819[_0x375e('0x6b')]=moment()[_0x375e('0x6c')](_0x375e('0x126'));ut[_0x375e('0xe6')](_0x293195,0x4,_0x375e('0xa5'));rpcDb['createAgentHistory'](_0x293195,_0x375e('0x130'));}}};Preview[_0x375e('0xe')][_0x375e('0x1b')]=function(_0x541e82){var _0x40f81e=this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]];var _0x3b188a;if(_0x40f81e){_0x3b188a=this[_0x375e('0x27')][_0x40f81e['queue']];logger['info'](_0x375e('0x131'),_0x541e82[_0x375e('0x8f')],_0x375e('0x98'),_0x3b188a[_0x375e('0x2c')],'pTalking:\x20',_0x3b188a['pTalking']);}if(this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]]&&_0x541e82[_0x375e('0x8f')]!==_0x541e82[_0x375e('0x97')]){if(_0x541e82[_0x375e('0x132')]==='16'&&this['actions'][_0x541e82['linkedid']]['dialAnswer']){this[_0x375e('0x7e')](_0x541e82,_0x541e82['linkedid'],_0x541e82['cause']);}else if(this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]]['dialAnswer']){logger[_0x375e('0x46')](_0x375e('0x133'),_0x541e82[_0x375e('0x8f')],_0x541e82[_0x375e('0x132')],_0x375e('0x98'),_0x3b188a[_0x375e('0x2c')],'pTalking:\x20',_0x3b188a['pTalking']);this[_0x375e('0x7e')](_0x541e82,_0x541e82[_0x375e('0x8f')],_0x541e82['cause']);}}else if(_0x40f81e&&_[_0x375e('0x5f')](_0x40f81e[_0x375e('0x134')])&&_0x3b188a[_0x375e('0x135')]&&_0x541e82[_0x375e('0x8f')]===_0x541e82[_0x375e('0x97')]&&_[_0x375e('0x5f')](_0x541e82['reason'])&&_0x541e82[_0x375e('0x132')]==='16'&&_0x541e82[_0x375e('0x136')]==='6'&&_[_0x375e('0xe3')](_0x40f81e[_0x375e('0x137')])){if(_0x40f81e[_0x375e('0xb3')]){rpcDb[_0x375e('0x12d')](_0x40f81e['idContact']);}if(_0x40f81e[_0x375e('0xbc')]){rpcDb['disableContact'](_0x40f81e['idContact']);}_0x541e82['reason']='22';this['callProgressDetectingAgent'](_0x40f81e,_0x3b188a,_0x541e82);}else if(_0x40f81e&&_0x40f81e[_0x375e('0x137')]){if(_0x541e82['cause']==='16'&&this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]]['dialAnswer']){logger[_0x375e('0x46')](_0x375e('0x138'),_0x541e82[_0x375e('0x8f')],_0x541e82[_0x375e('0x132')],_0x375e('0x98'),_0x3b188a[_0x375e('0x2c')],_0x375e('0x4b'),_0x3b188a[_0x375e('0x99')]);this[_0x375e('0x7e')](_0x541e82,_0x541e82['linkedid'],_0x541e82[_0x375e('0x132')]);}else if(this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]]['dialAnswer']){logger[_0x375e('0x46')]('[syncHangup][talking][cause]',_0x541e82[_0x375e('0x8f')],_0x541e82[_0x375e('0x132')],_0x375e('0x98'),_0x3b188a[_0x375e('0x2c')],_0x375e('0x4b'),_0x3b188a[_0x375e('0x99')]);this[_0x375e('0x7e')](_0x541e82,_0x541e82['linkedid'],_0x541e82[_0x375e('0x132')]);}}};Preview[_0x375e('0xe')][_0x375e('0x1e')]=function(_0x3acb1b){if(this[_0x375e('0x14')][_0x3acb1b[_0x375e('0xe0')]]&&_0x3acb1b[_0x375e('0xe0')]!==_0x3acb1b[_0x375e('0x139')]){this['callProgressDetectingCustomer'](_0x3acb1b,_0x3acb1b[_0x375e('0xe0')],_0x3acb1b[_0x375e('0xd8')]);}};Preview[_0x375e('0xe')][_0x375e('0x1d')]=function(_0x553735){if(this[_0x375e('0x14')][_0x553735[_0x375e('0x8f')]]&&_0x553735[_0x375e('0x8f')]!==_0x553735[_0x375e('0x97')]&&!this[_0x375e('0x14')][_0x553735[_0x375e('0x8f')]][_0x375e('0x4c')]){if(_0x553735[_0x375e('0x132')]==='1'){this[_0x375e('0x7e')](_0x553735,_0x553735[_0x375e('0x8f')],_0x553735[_0x375e('0x132')]);}}};Preview[_0x375e('0xe')][_0x375e('0x13a')]=function(_0x433453,_0x54f174,_0x134564){if(this[_0x375e('0x14')][_0x433453]){if(_[_0x375e('0x5f')](this['actions'][_0x433453]['variables'])){this[_0x375e('0x14')][_0x433453][_0x375e('0x13b')]={};}this[_0x375e('0x14')][_0x433453][_0x375e('0x13b')][_0x54f174]=_0x134564;}};Preview[_0x375e('0xe')][_0x375e('0x22')]=function(_0x19ddfa){try{if(!_[_0x375e('0x5f')](_0x19ddfa)){if(ut['filterKey'](_[_0x375e('0x13c')](_0x19ddfa[_0x375e('0x13d')])[0x0])){this[_0x375e('0x13a')](_0x19ddfa[_0x375e('0x97')],_[_0x375e('0x13c')](_0x19ddfa[_0x375e('0x13d')])[0x0],_0x19ddfa['value']);}}}catch(_0x1d818a){logger[_0x375e('0x13e')](_0x375e('0x13f'),util[_0x375e('0x140')](_0x1d818a,{'showHidden':![],'depth':null}));}};Preview[_0x375e('0xe')][_0x375e('0x24')]=function(_0x57cb63){if(_0x57cb63){if(this[_0x375e('0x14')][_0x57cb63[_0x375e('0x141')]]){this['actions'][_0x57cb63['transfertargetlinkedid']][_0x375e('0x137')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x3f867d){if(_0x3f867d){if(this[_0x375e('0x14')][_0x3f867d[_0x375e('0x142')]]){this[_0x375e('0x14')][_0x3f867d[_0x375e('0x142')]][_0x375e('0x137')]=!![];}}};module[_0x375e('0x143')]=Preview; \ No newline at end of file +var _0xd5f6=['NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','originated:\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','assign','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','callProgressDetectingAgent','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','variable','keys','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/environment','preview','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','redis','defaults','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','name','\x20is\x20deactivated','syncCampaigns','prototype','clockClearZombieChannels','dialMethod','booked','outbound','hasOwnProperty','type','dialActive','setMessage','recallMe','clearZombieChannel','isNil','Queue','queue','pTalking:\x20','stringify','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','decrementOriginate','decrementTalking','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','dialBusyMaxRetry','idContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry'];(function(_0xd6f4b7,_0x114ce1){var _0xc16061=function(_0x531096){while(--_0x531096){_0xd6f4b7['push'](_0xd6f4b7['shift']());}};_0xc16061(++_0x114ce1);}(_0xd5f6,0x1d9));var _0x6d5f=function(_0x574fc1,_0x9079d){_0x574fc1=_0x574fc1-0x0;var _0x422848=_0xd5f6[_0x574fc1];return _0x422848;};'use strict';var util=require(_0x6d5f('0x0'));var _=require(_0x6d5f('0x1'));var uuid=require(_0x6d5f('0x2'));var moment=require(_0x6d5f('0x3'));var Redis=require(_0x6d5f('0x4'));var config=require(_0x6d5f('0x5'));var logger=require('../../../config/logger')(_0x6d5f('0x6'));var loggerAction=require('../../../config/logger')(_0x6d5f('0x7'));var ami=require(_0x6d5f('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x6d5f('0x9'));var Action=require('./action');var ut=require('./util/util');var utils=require('../dialer/utils');config[_0x6d5f('0xa')]=_[_0x6d5f('0xb')](config[_0x6d5f('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x6d5f('0xc'))(new Redis(config[_0x6d5f('0xa')]));var Sequence=function(){};Sequence['prototype'][_0x6d5f('0xd')]=function(_0x43f4b1){this[_0x6d5f('0xe')]=this['tail']?this[_0x6d5f('0xe')][_0x6d5f('0xf')](_0x43f4b1):_0x43f4b1();};function Preview(_0x1933c2){this[_0x6d5f('0x10')]=new Sequence();this[_0x6d5f('0x11')]=_0x1933c2[_0x6d5f('0x12')];this[_0x6d5f('0x13')]=_0x1933c2[_0x6d5f('0x13')];this[_0x6d5f('0x14')]={};this['agents']=_0x1933c2[_0x6d5f('0x15')];this['clockClearZombieChannels']=0x0;ami['on'](_0x6d5f('0x16'),this[_0x6d5f('0x17')][_0x6d5f('0x18')](this));ami['on'](_0x6d5f('0x19'),this[_0x6d5f('0x1a')][_0x6d5f('0x18')](this));ami['on'](_0x6d5f('0x1b'),this[_0x6d5f('0x1c')][_0x6d5f('0x18')](this));ami['on']('dialend',this[_0x6d5f('0x1d')][_0x6d5f('0x18')](this));ami['on'](_0x6d5f('0x1e'),this[_0x6d5f('0x1f')][_0x6d5f('0x18')](this));ami['on'](_0x6d5f('0x20'),this[_0x6d5f('0x21')]['bind'](this));ami['on'](_0x6d5f('0x22'),this['syncAttendedTransfer'][_0x6d5f('0x18')](this));ami['on']('blindtransfer',this[_0x6d5f('0x23')][_0x6d5f('0x18')](this));this[_0x6d5f('0x24')](this[_0x6d5f('0x11')]);}function emit(_0x11b5e0,_0x2b9cb0,_0x1d743a){io['to'](_0x11b5e0)[_0x6d5f('0x25')](_0x2b9cb0,_0x1d743a);}function emitVoiceQueueChannelRemove(_0x539062){logger[_0x6d5f('0x26')](_0x6d5f('0x27'),JSON['stringify'](_0x539062));emit(util[_0x6d5f('0x28')]('voice:queue:%s',_0x539062['name']),'voice_queue_channel:remove',_0x539062);io[_0x6d5f('0x25')](_0x6d5f('0x29'),_0x539062);}function notSendMessagesQueue(_0x829924){if(_0x829924[_0x6d5f('0x2a')]){if(_0x829924[_0x6d5f('0x2b')]===0x0&&_0x829924['pTalking']===0x0){_0x829924['sendMessageOneNotActive']=![];_0x829924[_0x6d5f('0x2c')]=0x0;_0x829924[_0x6d5f('0x2d')]=0x0;_0x829924['message']=utils[_0x6d5f('0x2e')][_0x6d5f('0x2f')];ut[_0x6d5f('0x30')](_0x6d5f('0x31'),_0x829924['name']+_0x6d5f('0x32'));}else{_0x829924[_0x6d5f('0x33')]=utils[_0x6d5f('0x2e')][_0x6d5f('0x34')];ut[_0x6d5f('0x30')](_0x6d5f('0x31'),_0x829924[_0x6d5f('0x35')]+_0x6d5f('0x36'));}}}Preview['prototype'][_0x6d5f('0x24')]=function(){var _0x30d745=this;setInterval(function(){_0x30d745[_0x6d5f('0x37')]();},0x7cf);};Preview[_0x6d5f('0x38')][_0x6d5f('0x37')]=function(){var _0x17f4b7=this[_0x6d5f('0x11')];this[_0x6d5f('0x39')]+=0x1;for(var _0x2eb3f7 in _0x17f4b7){if(_0x17f4b7['hasOwnProperty'](_0x2eb3f7)&&(_0x17f4b7[_0x2eb3f7][_0x6d5f('0x3a')]===_0x6d5f('0x6')||_0x17f4b7[_0x2eb3f7][_0x6d5f('0x3a')]===_0x6d5f('0x3b'))&&_0x17f4b7[_0x2eb3f7]['type']===_0x6d5f('0x3c')){if(this[_0x6d5f('0x39')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x17f4b7[_0x6d5f('0x3d')](_0x2eb3f7)&&_0x17f4b7[_0x2eb3f7][_0x6d5f('0x3a')]==='preview'&&_0x17f4b7[_0x2eb3f7][_0x6d5f('0x3e')]==='outbound'){if(_0x17f4b7[_0x2eb3f7][_0x6d5f('0x3f')]){this[_0x6d5f('0x40')](_0x17f4b7[_0x2eb3f7]);if(_0x17f4b7[_0x2eb3f7]['dialPreviewAutoRecallMe'])this[_0x6d5f('0x41')](_0x17f4b7[_0x2eb3f7]);}else{notSendMessagesQueue(_0x17f4b7[_0x2eb3f7]);}}}};Preview[_0x6d5f('0x38')][_0x6d5f('0x42')]=function(_0x393c7d){var _0x27f5f4=this;this['sequence']['enqueue'](function(){if(!_[_0x6d5f('0x43')](_0x27f5f4[_0x6d5f('0x14')][_0x393c7d])){loggerAction[_0x6d5f('0x26')]('[clearZombieChannels][talking]',_0x393c7d,_0x6d5f('0x44'),_0x27f5f4[_0x6d5f('0x14')][_0x393c7d][_0x6d5f('0x45')],'originated:\x20',JSON['stringify'](_0x27f5f4['campaignsPreview'][_0x27f5f4[_0x6d5f('0x14')][_0x393c7d][_0x6d5f('0x45')]]['originated']),_0x6d5f('0x46'),JSON[_0x6d5f('0x47')](_0x27f5f4[_0x6d5f('0x11')][_0x27f5f4[_0x6d5f('0x14')][_0x393c7d][_0x6d5f('0x45')]][_0x6d5f('0x48')]),JSON['stringify'](_0x27f5f4[_0x6d5f('0x14')][_0x393c7d][_0x6d5f('0x49')]),JSON['stringify'](_[_0x6d5f('0x4a')](_0x27f5f4[_0x6d5f('0x14')][_0x393c7d],[_0x6d5f('0x4b'),_0x6d5f('0x4c'),_0x6d5f('0x4d'),_0x6d5f('0x4e')])));return ami[_0x6d5f('0x4f')]({'action':_0x6d5f('0x50'),'channel':_0x27f5f4['actions'][_0x393c7d][_0x6d5f('0x51')]})[_0x6d5f('0x52')](function(_0x30ce1f){if(_0x30ce1f[_0x6d5f('0x33')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x27f5f4[_0x6d5f('0x14')][_0x393c7d]){utils[_0x6d5f('0x53')](_0x27f5f4[_0x6d5f('0x11')][_0x27f5f4[_0x6d5f('0x14')][_0x393c7d][_0x6d5f('0x45')]],'[clearZombieChannel]');if(_0x27f5f4['actions'][_0x393c7d][_0x6d5f('0x49')]===!![]){ut[_0x6d5f('0x54')](_0x27f5f4[_0x6d5f('0x11')][_0x27f5f4[_0x6d5f('0x14')][_0x393c7d][_0x6d5f('0x45')]],_0x6d5f('0x55'));ut[_0x6d5f('0x56')](_0x6d5f('0x57')+_0x393c7d,_0x27f5f4[_0x6d5f('0x14')][_0x393c7d][_0x6d5f('0x45')]);}ut[_0x6d5f('0x56')](_0x6d5f('0x58')+_0x393c7d,_0x27f5f4[_0x6d5f('0x14')][_0x393c7d][_0x6d5f('0x45')]);delete _0x27f5f4[_0x6d5f('0x14')][_0x393c7d];}},0x2328);}});}});};Preview[_0x6d5f('0x38')]['clearZombieChannels']=function(){var _0x49e8a2=this;loggerAction['info'](_0x6d5f('0x59'),_[_0x6d5f('0x5a')](this[_0x6d5f('0x14')]));for(var _0x35c3e2 in this[_0x6d5f('0x14')]){if(_0x49e8a2[_0x6d5f('0x14')][_0x6d5f('0x3d')](_0x35c3e2)){_0x49e8a2[_0x6d5f('0x42')](_0x35c3e2);}}};Preview['prototype'][_0x6d5f('0x41')]=function(_0x2a5f96){var _0x32726a=this;rpcDb[_0x6d5f('0x5b')](_0x2a5f96['id'],ut[_0x6d5f('0x5c')](this[_0x6d5f('0x15')]))[_0x6d5f('0x5d')](function(_0x255f2b){if(!_[_0x6d5f('0x43')](_0x255f2b)){for(var _0xa813d6=0x0;_0xa813d6<_0x255f2b[_0x6d5f('0x5e')];_0xa813d6+=0x1){if(ut['getDiff'](_0x255f2b[_0xa813d6][_0x6d5f('0x5f')])<_0x2a5f96[_0x6d5f('0x60')]*0x3c){if(_0x255f2b[_0xa813d6]['Agent']&&!_0x255f2b[_0xa813d6][_0x6d5f('0x61')][_0x6d5f('0x62')]){_0x32726a[_0x6d5f('0x63')](_0x255f2b[_0xa813d6]['id'])[_0x6d5f('0x5d')](ut[_0x6d5f('0x64')](_0x6d5f('0x65')))[_0x6d5f('0x52')](ut['logger2'](_0x6d5f('0x65')));}else{rpcDb[_0x6d5f('0x66')](_0x255f2b[_0xa813d6]['id']);}}else{var _0x49e60a=new Action(_0x255f2b[_0xa813d6],_0x2a5f96);_0x49e60a[_0x6d5f('0x67')]=moment()[_0x6d5f('0x28')](_0x6d5f('0x68'));_0x2a5f96[_0x6d5f('0x69')]+=0x1;ut[_0x6d5f('0x6a')](_0x49e60a,0x17,_0x6d5f('0x6b'));if(_0x2a5f96[_0x6d5f('0x6c')]){rpcDb[_0x6d5f('0x6d')](ut[_0x6d5f('0x6e')](_0x255f2b[_0xa813d6]));rpcDb[_0x6d5f('0x6f')](_0x49e60a,_0x6d5f('0x70'));}else{ut[_0x6d5f('0x6a')](_0x49e60a,0x16,_0x6d5f('0x71'));rpcDb['createCustomerHistory'](_0x49e60a,_0x6d5f('0x72'));rpcDb[_0x6d5f('0x73')](_0x49e60a,'[HistoryRecallClose]');}}}}})[_0x6d5f('0x52')](ut[_0x6d5f('0x64')](_0x6d5f('0x74')));};Preview['prototype']['setMessage']=function(_0xa984c0){_0xa984c0[_0x6d5f('0x2a')]=!![];if(ut[_0x6d5f('0x75')](_0xa984c0[_0x6d5f('0x76')])){_0xa984c0[_0x6d5f('0x33')]=utils['CAMPAIGN_STATUS'][_0x6d5f('0x77')];}else if(!ut['isActive'](_0xa984c0[_0x6d5f('0x3f')])){_0xa984c0['message']=utils[_0x6d5f('0x2e')]['INACTIVE'];}else if(!this[_0x6d5f('0x78')](_0xa984c0[_0x6d5f('0x79')])){if(!this[_0x6d5f('0x78')](_0xa984c0[_0x6d5f('0x7a')])){_0xa984c0[_0x6d5f('0x33')]=utils[_0x6d5f('0x2e')]['UNREACHABLE_TRUNK'];}else{_0xa984c0['message']=utils[_0x6d5f('0x2e')][_0x6d5f('0x7b')];}}else{_0xa984c0[_0x6d5f('0x33')]=utils[_0x6d5f('0x2e')]['ACTIVE'];}};Preview[_0x6d5f('0x38')][_0x6d5f('0x7c')]=function(_0x90c455,_0x3b7c4e,_0x59a86f){var _0x4dd161=this;var _0x1ec75b=this[_0x6d5f('0x14')][_0x3b7c4e];var _0x2d3197=this[_0x6d5f('0x11')][_0x1ec75b[_0x6d5f('0x45')]];var _0x4a589b;var _0x158f20=![];var _0x390616=0x2;var _0x3a1a68=0x3;if(_0x2d3197){switch(_0x59a86f){case'1':_0x2d3197[_0x6d5f('0x7d')]+=0x1;_0x1ec75b['countnosuchnumberretry']+=0x1;_0x1ec75b['countglobal']=ut[_0x6d5f('0x7e')](_0x1ec75b);ut[_0x6d5f('0x6a')](_0x1ec75b,0x0,_0x6d5f('0x7f'));ami[_0x6d5f('0x25')](_0x6d5f('0x80'),ut[_0x6d5f('0x81')](_0x1ec75b,_0x6d5f('0x82')));rpcDb[_0x6d5f('0x6f')](_0x1ec75b,_0x6d5f('0x83'));_0x4dd161[_0x6d5f('0x84')](_0x1ec75b,'0',_0x2d3197)['then'](function(_0x401b9c){_0x158f20=_0x401b9c[_0x6d5f('0x85')]==0x1;_0x390616=_0x2d3197[_0x6d5f('0x86')];_0x3a1a68=_0x2d3197[_0x6d5f('0x87')];if(!_0x158f20){if(ut[_0x6d5f('0x7e')](_0x1ec75b)>=_0x2d3197['dialGlobalMaxRetry']){_0x4a589b=ut[_0x6d5f('0x88')](_0x1ec75b,0xf,_0x6d5f('0x89'));rpcDb[_0x6d5f('0x73')](_0x4a589b,_0x6d5f('0x8a'));}else{if(_0x1ec75b[_0x6d5f('0x8b')]>=_0x2d3197['dialNoSuchNumberMaxRetry']){rpcDb[_0x6d5f('0x73')](_0x1ec75b,_0x6d5f('0x8a'));}else{rpcDb[_0x6d5f('0x8c')](ut[_0x6d5f('0x8d')](_0x1ec75b,'countnosuchnumberretry',_0x2d3197[_0x6d5f('0x86')]),_0x1ec75b[_0x6d5f('0x8e')],_0x1ec75b[_0x6d5f('0x8f')]);}}delete this['actions'][_0x90c455[_0x6d5f('0x90')]];}else{_0x1ec75b[_0x6d5f('0x8b')]++;logger[_0x6d5f('0x26')](_0x6d5f('0x91'),_0x1ec75b[_0x6d5f('0x8b')]);logger[_0x6d5f('0x26')]('id',_0x1ec75b['idContact']);_0x4dd161[_0x6d5f('0x92')]({'id':_0x1ec75b['idContact'],'field':{'countnosuchnumberretry':_0x1ec75b[_0x6d5f('0x8b')]}})[_0x6d5f('0x5d')](function(){_0x4dd161[_0x6d5f('0x93')](_0x1ec75b,_0x390616,_0x3a1a68)[_0x6d5f('0x5d')](function(){});});}});break;case _0x6d5f('0x94'):var _0xb24874=moment()[_0x6d5f('0x28')](_0x6d5f('0x68'));_0x1ec75b[_0x6d5f('0x95')]=_0xb24874;_0x1ec75b[_0x6d5f('0x96')]=_0xb24874;_0x1ec75b[_0x6d5f('0x49')]=!![];_0x2d3197[_0x6d5f('0x48')]+=0x1;logger[_0x6d5f('0x26')](_0x6d5f('0x97'),_0x1ec75b['uniqueid'],_0x6d5f('0x98'),_0x2d3197['name'],'pTalking:\x20',_0x2d3197['pTalking']);ami[_0x6d5f('0x25')]('custom:agentconnect',ut[_0x6d5f('0x81')](_0x1ec75b,_0x6d5f('0x99'),this['campaignsPreview'][_0x1ec75b[_0x6d5f('0x45')]]));if(_0x2d3197[_0x6d5f('0x9a')]||_0x2d3197['mandatoryDisposition']){ami[_0x6d5f('0x25')](_0x6d5f('0x9b'),{'queue':_0x1ec75b[_0x6d5f('0x45')],'interface':_0x1ec75b['channelAgent'],'uniqueid':_0x1ec75b['uniqueid']});}break;case'16':ami[_0x6d5f('0x25')](_0x6d5f('0x9c'),ut[_0x6d5f('0x81')](_0x1ec75b,_0x6d5f('0x9d'),this[_0x6d5f('0x11')][_0x1ec75b['queue']]));emitVoiceQueueChannelRemove(ut[_0x6d5f('0x81')](_0x1ec75b,_0x6d5f('0x9d')));_0x2d3197[_0x6d5f('0x9e')]+=0x1;_0x2d3197[_0x6d5f('0x9f')]+=0x1;_0x2d3197['answered']+=0x1;ut[_0x6d5f('0x54')](_0x2d3197,_0x6d5f('0xa0'));_0x1ec75b[_0x6d5f('0xa1')]=ut[_0x6d5f('0x7e')](_0x1ec75b);ut[_0x6d5f('0x6a')](_0x1ec75b,0x4,_0x6d5f('0xa2'));rpcDb[_0x6d5f('0x6f')](_0x1ec75b,_0x6d5f('0xa3'));rpcDb[_0x6d5f('0x73')](_0x1ec75b,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x6d5f('0xa4')](_0x1ec75b);_0x2d3197[_0x6d5f('0xa5')]+=_0x1ec75b[_0x6d5f('0xa6')];_0x2d3197[_0x6d5f('0xa7')]+=_0x1ec75b['talktime'];logger[_0x6d5f('0x26')](_0x6d5f('0xa8'),_0x1ec75b[_0x6d5f('0xa9')],_0x6d5f('0x98'),_0x2d3197[_0x6d5f('0x35')],_0x6d5f('0x46'),_0x2d3197[_0x6d5f('0x48')]);delete this['actions'][_0x90c455[_0x6d5f('0x90')]];break;case _0x6d5f('0xaa'):_0x2d3197[_0x6d5f('0xab')]+=0x1;_0x1ec75b[_0x6d5f('0xac')]+=0x1;_0x1ec75b[_0x6d5f('0xa1')]=ut[_0x6d5f('0x7e')](_0x1ec75b);ut[_0x6d5f('0x6a')](_0x1ec75b,0x5,_0x6d5f('0xad'));_0x390616=_0x2d3197[_0x6d5f('0xae')];_0x3a1a68=_0x2d3197[_0x6d5f('0x87')];ami['emit'](_0x6d5f('0xaf'),ut[_0x6d5f('0x81')](_0x1ec75b,'busy'));rpcDb[_0x6d5f('0x6f')](_0x1ec75b,_0x6d5f('0xb0'));_0x4dd161[_0x6d5f('0x84')](_0x1ec75b,'5',_0x2d3197)['then'](function(_0x1b7fa1){_0x158f20=_0x1b7fa1['additional']==0x1;if(!_0x158f20){if(ut[_0x6d5f('0x7e')](_0x1ec75b)>=_0x2d3197[_0x6d5f('0xb1')]){_0x4a589b=ut['cloneAction'](_0x1ec75b,0xf,_0x6d5f('0x89'));rpcDb[_0x6d5f('0x73')](_0x4a589b,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x1ec75b['countbusyretry']>=_0x2d3197[_0x6d5f('0xb2')]){rpcDb[_0x6d5f('0x73')](_0x1ec75b,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6d5f('0x8c')](ut[_0x6d5f('0x8d')](_0x1ec75b,_0x6d5f('0xac'),_0x2d3197[_0x6d5f('0xae')]),_0x1ec75b[_0x6d5f('0x8e')],_0x1ec75b[_0x6d5f('0x8f')]);}}}else{_0x1ec75b[_0x6d5f('0xac')]++;_0x4dd161[_0x6d5f('0x92')]({'id':_0x1ec75b[_0x6d5f('0xb3')],'field':{'countbusyretry':_0x1ec75b['countbusyretry']}})['then'](function(){_0x4dd161[_0x6d5f('0x93')](_0x1ec75b,_0x390616,_0x3a1a68)['then'](function(){});});}});break;case _0x6d5f('0xb4'):_0x2d3197[_0x6d5f('0xb5')]+=0x1;_0x1ec75b[_0x6d5f('0xb6')]+=0x1;_0x1ec75b[_0x6d5f('0xa1')]=ut[_0x6d5f('0x7e')](_0x1ec75b);ut['logCustomer'](_0x1ec75b,0x3,_0x6d5f('0xb7'));_0x390616=_0x2d3197[_0x6d5f('0xb8')];_0x3a1a68=_0x2d3197[_0x6d5f('0x87')];var _0x4db422=ut['buildNoAnswerEventPayload'](_0x1ec75b,_0x2d3197);ami[_0x6d5f('0x25')](_0x6d5f('0xb9'),_0x4db422);rpcDb['createCustomerHistory'](_0x1ec75b,_0x6d5f('0xba'));_0x4dd161['verifyAdditionalPhones'](_0x1ec75b,'3',_0x2d3197)[_0x6d5f('0x5d')](function(_0x268252){_0x158f20=_0x268252[_0x6d5f('0x85')]==0x1;if(!_0x158f20){if(ut[_0x6d5f('0x7e')](_0x1ec75b)>=_0x2d3197[_0x6d5f('0xb1')]){_0x4a589b=ut[_0x6d5f('0x88')](_0x1ec75b,0xf,_0x6d5f('0x89'));rpcDb[_0x6d5f('0x73')](_0x4a589b,_0x6d5f('0xbb'));}else{if(_0x1ec75b[_0x6d5f('0xb6')]>=_0x2d3197[_0x6d5f('0xbc')]){rpcDb['createCustomerFinal'](_0x1ec75b,_0x6d5f('0xba'));}else{rpcDb[_0x6d5f('0x8c')](ut[_0x6d5f('0x8d')](_0x1ec75b,_0x6d5f('0xb6'),_0x2d3197[_0x6d5f('0xb8')]),_0x1ec75b[_0x6d5f('0x8e')],_0x1ec75b[_0x6d5f('0x8f')]);}}}else{_0x1ec75b['countnoanswerretry']++;_0x4dd161[_0x6d5f('0x92')]({'id':_0x1ec75b['idContact'],'field':{'countnoanswerretry':_0x1ec75b['countnoanswerretry']}})[_0x6d5f('0x5d')](function(){_0x4dd161[_0x6d5f('0x93')](_0x1ec75b,_0x390616,_0x3a1a68)[_0x6d5f('0x5d')](function(){});});}});break;case _0x6d5f('0xbd'):_0x2d3197[_0x6d5f('0xbe')]+=0x1;_0x1ec75b[_0x6d5f('0xbf')]+=0x1;_0x1ec75b[_0x6d5f('0xa1')]=ut[_0x6d5f('0x7e')](_0x1ec75b);ut[_0x6d5f('0x6a')](_0x1ec75b,0x8,_0x6d5f('0xc0'));_0x390616=_0x2d3197[_0x6d5f('0xc1')];_0x3a1a68=_0x2d3197[_0x6d5f('0x87')];ami[_0x6d5f('0x25')](_0x6d5f('0xc2'),ut[_0x6d5f('0x81')](_0x1ec75b,_0x6d5f('0xc3')));rpcDb[_0x6d5f('0x6f')](_0x1ec75b,_0x6d5f('0xc4'));_0x4dd161['verifyAdditionalPhones'](_0x1ec75b,'8',_0x2d3197)[_0x6d5f('0x5d')](function(_0x510aca){_0x158f20=_0x510aca[_0x6d5f('0x85')]==0x1;if(!_0x158f20){if(ut['totalGlobal'](_0x1ec75b)>=_0x2d3197[_0x6d5f('0xb1')]){_0x4a589b=ut[_0x6d5f('0x88')](_0x1ec75b,0xf,_0x6d5f('0x89'));rpcDb[_0x6d5f('0x73')](_0x4a589b,_0x6d5f('0xc5'));}else{if(_0x1ec75b[_0x6d5f('0xbf')]>=_0x2d3197[_0x6d5f('0xc6')]){rpcDb[_0x6d5f('0x73')](_0x1ec75b,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x6d5f('0x8c')](ut['scheduledAt'](_0x1ec75b,_0x6d5f('0xbf'),_0x2d3197[_0x6d5f('0xae')]),_0x1ec75b[_0x6d5f('0x8e')],_0x1ec75b[_0x6d5f('0x8f')]);}}}else{_0x1ec75b[_0x6d5f('0xbf')]++;_0x4dd161[_0x6d5f('0x92')]({'id':_0x1ec75b[_0x6d5f('0xb3')],'field':{'countcongestionretry':_0x1ec75b['countcongestionretry']}})[_0x6d5f('0x5d')](function(){_0x4dd161[_0x6d5f('0x93')](_0x1ec75b,_0x390616,_0x3a1a68)[_0x6d5f('0x5d')](function(){});});}});break;case'CANCEL':_0x2d3197['outboundRejectCallsDay']+=0x1;_0x1ec75b[_0x6d5f('0xc7')]+=0x1;_0x1ec75b['countglobal']=ut['totalGlobal'](_0x1ec75b);ut[_0x6d5f('0x6a')](_0x1ec75b,0x14,_0x6d5f('0xc8'));_0x390616=_0x2d3197['dialAgentRejectRetryFrequency'];_0x3a1a68=_0x2d3197[_0x6d5f('0x87')];ami[_0x6d5f('0x25')](_0x6d5f('0xc9'),ut['buildObj'](_0x1ec75b,'agentreject'));rpcDb[_0x6d5f('0x6f')](_0x1ec75b,_0x6d5f('0xca'));_0x4dd161['verifyAdditionalPhones'](_0x1ec75b,'20',_0x2d3197)[_0x6d5f('0x5d')](function(_0x347a9f){_0x158f20=_0x347a9f['additional']==0x1;if(!_0x158f20){if(ut[_0x6d5f('0x7e')](_0x1ec75b)>=_0x2d3197['dialGlobalMaxRetry']){_0x4a589b=ut[_0x6d5f('0x88')](_0x1ec75b,0x14,_0x6d5f('0xc8'));rpcDb['createCustomerFinal'](_0x4a589b,_0x6d5f('0xcb'));}else{if(_0x1ec75b[_0x6d5f('0xc7')]>=_0x2d3197[_0x6d5f('0xcc')]){rpcDb[_0x6d5f('0x73')](_0x1ec75b,_0x6d5f('0xcb'));}else{rpcDb[_0x6d5f('0x8c')](ut[_0x6d5f('0x8d')](_0x1ec75b,_0x6d5f('0xc7'),_0x2d3197[_0x6d5f('0xcd')]),_0x1ec75b[_0x6d5f('0x8e')],_0x1ec75b['activeContact']);}}}else{_0x1ec75b[_0x6d5f('0xb6')]++;_0x4dd161['incrementPreviewCounters']({'id':_0x1ec75b[_0x6d5f('0xb3')],'field':{'countnoanswerretry':_0x1ec75b[_0x6d5f('0xb6')]}})[_0x6d5f('0x5d')](function(){_0x4dd161[_0x6d5f('0x93')](_0x1ec75b,_0x390616,_0x3a1a68)[_0x6d5f('0x5d')](function(){});});}});break;case _0x6d5f('0xce'):_0x2d3197['outboundAbandonedCallsDay']+=0x1;_0x1ec75b[_0x6d5f('0xcf')]+=0x1;_0x1ec75b[_0x6d5f('0xa1')]=ut[_0x6d5f('0x7e')](_0x1ec75b);ut['logCustomer'](_0x1ec75b,0xb,_0x6d5f('0xd0'));rpcDb[_0x6d5f('0x6f')](_0x1ec75b,'[callProgressDetectingCustomer][logAbandoned]');_0x4dd161['verifyAdditionalPhones'](_0x1ec75b,'11',_0x2d3197)[_0x6d5f('0x5d')](function(_0x3109a2){_0x158f20=_0x3109a2[_0x6d5f('0x85')]==0x1;if(!_0x158f20){if(ut[_0x6d5f('0x7e')](_0x1ec75b)>=_0x2d3197[_0x6d5f('0xb1')]){_0x4a589b=ut[_0x6d5f('0x88')](_0x1ec75b,0xf,_0x6d5f('0x89'));rpcDb['createCustomerFinal'](_0x4a589b,_0x6d5f('0xd1'));}else{if(_0x1ec75b[_0x6d5f('0xd2')]>=_0x2d3197['dialAbandonedMaxRety']){rpcDb[_0x6d5f('0x73')](_0x1ec75b,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x6d5f('0x8c')](ut[_0x6d5f('0x8d')](_0x1ec75b,_0x6d5f('0xcf'),_0x2d3197[_0x6d5f('0xd3')]),_0x1ec75b['unlockAgent'],_0x1ec75b[_0x6d5f('0x8f')]);}}}else{_0x1ec75b[_0x6d5f('0xb6')]++;_0x4dd161[_0x6d5f('0x92')]({'id':_0x1ec75b[_0x6d5f('0xb3')],'field':{'countnoanswerretry':_0x1ec75b[_0x6d5f('0xb6')]}})[_0x6d5f('0x5d')](function(){_0x4dd161[_0x6d5f('0x93')](_0x1ec75b,_0x390616,_0x3a1a68)['then'](function(){});});}});break;case'18':_0x2d3197[_0x6d5f('0xd4')]+=0x1;_0x1ec75b[_0x6d5f('0xd5')]+=0x1;_0x1ec75b['countglobal']=ut['totalGlobal'](_0x1ec75b);ut['logCustomer'](_0x1ec75b,0x12,_0x90c455[_0x6d5f('0xd6')]||_0x90c455[_0x6d5f('0xd7')]);ami[_0x6d5f('0x25')]('custom:amd',ut[_0x6d5f('0x81')](_0x1ec75b,_0x6d5f('0xd8')));rpcDb['createCustomerHistory'](_0x1ec75b,'[callProgressDetectingCustomer][hangupInAMD]');_0x4dd161['verifyAdditionalPhones'](_0x1ec75b,'18',_0x2d3197)[_0x6d5f('0x5d')](function(_0x46dd76){_0x158f20=_0x46dd76[_0x6d5f('0x85')]==0x1;if(!_0x158f20){if(ut['totalGlobal'](_0x1ec75b)>=_0x2d3197[_0x6d5f('0xb1')]){_0x4a589b=ut[_0x6d5f('0x88')](_0x1ec75b,0x12,'Global');rpcDb[_0x6d5f('0x73')](_0x4a589b,_0x6d5f('0xd9'));}else{rpcDb['createCustomerFinal'](_0x1ec75b,_0x6d5f('0xd9'));}}else{_0x1ec75b[_0x6d5f('0xb6')]++;_0x4dd161[_0x6d5f('0x92')]({'id':_0x1ec75b[_0x6d5f('0xb3')],'field':{'countnoanswerretry':_0x1ec75b[_0x6d5f('0xb6')]}})[_0x6d5f('0x5d')](function(){_0x4dd161['swapAdditionalPhones'](_0x1ec75b,_0x390616,_0x3a1a68)[_0x6d5f('0x5d')](function(){});});}});delete this[_0x6d5f('0x14')][_0x90c455[_0x6d5f('0x90')]];break;case'19':_0x2d3197[_0x6d5f('0xd4')]+=0x1;_0x1ec75b[_0x6d5f('0xa1')]=ut[_0x6d5f('0x7e')](_0x1ec75b);ut['logCustomer'](_0x1ec75b,0x13,_0x90c455[_0x6d5f('0xd6')]||_0x90c455[_0x6d5f('0xd7')]);ami[_0x6d5f('0x25')]('custom:amd',ut[_0x6d5f('0x81')](_0x1ec75b,'amd'));rpcDb[_0x6d5f('0x6f')](_0x1ec75b,'[callProgressDetectingCustomer][machine]');_0x4dd161['verifyAdditionalPhones'](_0x1ec75b,'18',_0x2d3197)[_0x6d5f('0x5d')](function(_0x5df558){_0x158f20=_0x5df558[_0x6d5f('0x85')]==0x1;if(!_0x158f20){if(ut[_0x6d5f('0x7e')](_0x1ec75b)>=_0x2d3197['dialGlobalMaxRetry']){_0x4a589b=ut[_0x6d5f('0x88')](_0x1ec75b,0xf,_0x6d5f('0x89'));rpcDb[_0x6d5f('0x73')](_0x4a589b,_0x6d5f('0xda'));}else{rpcDb[_0x6d5f('0x73')](_0x1ec75b,_0x6d5f('0xda'));}}else{_0x1ec75b[_0x6d5f('0xb6')]++;_0x4dd161[_0x6d5f('0x92')]({'id':_0x1ec75b[_0x6d5f('0xb3')],'field':{'countnoanswerretry':_0x1ec75b[_0x6d5f('0xb6')]}})['then'](function(){_0x4dd161['swapAdditionalPhones'](_0x1ec75b,_0x390616,_0x3a1a68)[_0x6d5f('0x5d')](function(){});});}});delete this['actions'][_0x90c455['linkedid']];break;default:if(_0x1ec75b['dialAnswer']){ut[_0x6d5f('0x54')](_0x2d3197,_0x6d5f('0xdb'));ut[_0x6d5f('0x56')](_0x6d5f('0xdc')+_0x2d3197[_0x6d5f('0x35')],_0x90c455);}_0x2d3197[_0x6d5f('0xd4')]+=0x1;_0x1ec75b[_0x6d5f('0xa1')]=ut[_0x6d5f('0x7e')](_0x1ec75b);ut['logCustomer'](_0x1ec75b,0xc,_0x90c455[_0x6d5f('0xd6')]||_0x90c455[_0x6d5f('0xd7')]);_0x390616=_0x2d3197[_0x6d5f('0xcd')];_0x3a1a68=_0x2d3197[_0x6d5f('0x87')];rpcDb['createCustomerHistory'](_0x1ec75b,_0x6d5f('0xdd'));_0x4dd161[_0x6d5f('0x84')](_0x1ec75b,'20',_0x2d3197)[_0x6d5f('0x5d')](function(_0x536a6b){_0x158f20=_0x536a6b['additional']==0x1;if(!_0x158f20){if(ut[_0x6d5f('0x7e')](_0x1ec75b)>=_0x2d3197[_0x6d5f('0xb1')]){_0x4a589b=ut[_0x6d5f('0x88')](_0x1ec75b,0xf,_0x6d5f('0x89'));rpcDb[_0x6d5f('0x73')](_0x4a589b,_0x6d5f('0xde'));}else{rpcDb[_0x6d5f('0x73')](_0x1ec75b,_0x6d5f('0xde'));}delete this[_0x6d5f('0x14')][_0x90c455[_0x6d5f('0x90')]];}else{_0x4dd161[_0x6d5f('0x93')](_0x1ec75b,_0x390616,_0x3a1a68)['then'](function(){});}});}if(!(_0x1ec75b[_0x6d5f('0x49')]&&_0x59a86f==='16')){utils['decrementOriginate'](_0x2d3197,_0x6d5f('0xdf'));logger[_0x6d5f('0x26')](_0x6d5f('0xe0'),_0x1ec75b['uniqueid'],_0x6d5f('0x98'),_0x2d3197[_0x6d5f('0x35')],'originated:\x20',_0x2d3197[_0x6d5f('0x2b')]);}if(_0x59a86f!==_0x6d5f('0x94')){delete this[_0x6d5f('0x14')][_0x90c455['linkedid']];delete this['actions'][_0x90c455[_0x6d5f('0xe1')]];}_0x2d3197['queueSummaryCountersUpdated']=!![];}};Preview[_0x6d5f('0x38')]['callProgressDetectingAgent']=function(_0x2ce009,_0x4a30da,_0x106665){if(_[_0x6d5f('0xe2')](_0x4a30da)&&_0x6d5f('0xe3')!==typeof _0x4a30da){return;}if(_[_0x6d5f('0xe2')](_0x106665)&&_0x6d5f('0xe3')!==typeof _0x106665){return;}switch(_0x106665[_0x6d5f('0xe4')]){case'0':ut['logAgent'](_0x2ce009,0x0,'NoSuchNumber');rpcDb[_0x6d5f('0xe5')](_0x2ce009,_0x6d5f('0xe6'));break;case'3':ut[_0x6d5f('0xe7')](_0x2ce009,0x3,_0x6d5f('0xb7'));rpcDb[_0x6d5f('0xe5')](_0x2ce009,_0x6d5f('0xe8'));break;case'5':ut['logAgent'](_0x2ce009,0x5,'Busy');rpcDb[_0x6d5f('0xe5')](_0x2ce009,_0x6d5f('0xe9'));break;case'8':ut[_0x6d5f('0xe7')](_0x2ce009,0x8,_0x6d5f('0xc0'));rpcDb[_0x6d5f('0xe5')](_0x2ce009,_0x6d5f('0xea'));break;case'22':ut[_0x6d5f('0xe7')](_0x2ce009,0x16,_0x6d5f('0xeb'));rpcDb[_0x6d5f('0xe5')](_0x2ce009,_0x6d5f('0xec'));break;default:ut[_0x6d5f('0xe7')](_0x2ce009,0xc,_0x106665['reason']);rpcDb[_0x6d5f('0xe5')](_0x2ce009,_0x6d5f('0xea'));}utils[_0x6d5f('0x53')](_0x4a30da,_0x6d5f('0xed'));logger[_0x6d5f('0x26')]('[originated][decrement][callProgressDetectingAgent]',_0x2ce009[_0x6d5f('0xa9')],_0x6d5f('0x98'),_0x4a30da['name'],_0x6d5f('0xee'),_0x4a30da[_0x6d5f('0x2b')]);delete this[_0x6d5f('0x14')][_0x2ce009[_0x6d5f('0xa9')]];};Preview[_0x6d5f('0x38')][_0x6d5f('0x84')]=function(_0x4780ee,_0x3001ff,_0x28cff6){return cmHopperAdditionalPhone[_0x6d5f('0x84')](_0x4780ee,_0x3001ff,_0x28cff6)[_0x6d5f('0x52')](logger[_0x6d5f('0x26')]('[verifyAdditionalPhone]\x20'));};Preview[_0x6d5f('0x38')][_0x6d5f('0x93')]=function(_0x14eb25,_0x3d0692,_0x216d17){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x14eb25,_0x3d0692,_0x216d17)[_0x6d5f('0x52')](logger[_0x6d5f('0x26')](_0x6d5f('0xef')));};Preview['prototype']['incrementPreviewCounters']=function(_0x17ad08){return Promise[_0x6d5f('0xf0')]()[_0x6d5f('0x5d')](cmHopperAdditionalPhone[_0x6d5f('0x92')](_0x17ad08))[_0x6d5f('0x52')](logger['info'](_0x6d5f('0xf1')));};Preview[_0x6d5f('0x38')]['checkInBlack']=function(_0x343b11,_0x553cfc,_0x3a33d3,_0x431486,_0x438261){var _0x488d91=this;return new Promise(function(_0x26cd22,_0x4f6b6f){if(_[_0x6d5f('0x43')](_0x553cfc)||_['isNil'](_0x553cfc[_0x6d5f('0xf2')])||_['isNil'](_0x553cfc[_0x6d5f('0xf3')])||_[_0x6d5f('0x43')](_0x553cfc[_0x6d5f('0x4d')])){_0x4f6b6f(ut[_0x6d5f('0x33')](_0x6d5f('0xf4'),_0x431486,_0x438261));return;}var _0x338525=uuid['v4']();var _0x32b6e3=_0x488d91[_0x6d5f('0x11')][_0x553cfc[_0x6d5f('0x44')][_0x6d5f('0x35')]];var _0x40f56d=_0x3a33d3?_0x488d91['agents'][_0x3a33d3]['id']:undefined;_0x488d91['actions'][_0x338525]=new Action(_0x553cfc,_0x32b6e3,_0x338525,_0x3a33d3,_0x40f56d);var _0x56692a=_0x488d91[_0x6d5f('0x14')][_0x338525];_0x56692a[_0x6d5f('0x8e')]=_0x431486;_0x56692a[_0x6d5f('0x8f')]=_0x438261;_0x56692a[_0x6d5f('0xf5')]=_0x3a33d3;if(_[_0x6d5f('0xf6')](_0x343b11)){_0x488d91[_0x6d5f('0xf7')](_0x56692a,_0x32b6e3,_0x553cfc,_0x3a33d3)[_0x6d5f('0x5d')](function(_0x2b32a2){logger['info'](_0x6d5f('0xf8'),_0x6d5f('0xf9')+_0x56692a['queue']+'\x20IdHopper:\x20'+_0x56692a[_0x6d5f('0xb3')],JSON[_0x6d5f('0x47')](_0x2b32a2));ami['emit']('custom:agentcalled',ut[_0x6d5f('0x81')](_0x56692a,_0x6d5f('0xfa'),_0x488d91[_0x6d5f('0x11')][_0x56692a[_0x6d5f('0x45')]]));_0x26cd22(ut[_0x6d5f('0x33')]('Calling'));})[_0x6d5f('0x52')](function(_0x2c9794){ut[_0x6d5f('0x30')](_0x6d5f('0xfb'),_0x2c9794);_0x4f6b6f(ut[_0x6d5f('0x33')](_0x6d5f('0xfc'),_0x431486,_0x438261));});}else{_0x32b6e3[_0x6d5f('0xfd')]+=0x1;ut[_0x6d5f('0xfe')](_0x56692a);rpcDb[_0x6d5f('0xff')](_0x56692a,_0x6d5f('0x100'));delete _0x488d91['actions'][_0x338525];_0x4f6b6f(ut[_0x6d5f('0x33')]('Contact\x20in\x20black\x20List',_0x431486,_0x438261));}});};Preview['prototype'][_0x6d5f('0x78')]=function(_0x21b292){return!_[_0x6d5f('0x43')](_0x21b292)&&!_[_0x6d5f('0x43')](_0x21b292['name'])&&!_[_0x6d5f('0x43')](_0x21b292[_0x6d5f('0x101')])&&_0x21b292[_0x6d5f('0x101')]&&!_[_0x6d5f('0x43')](this[_0x6d5f('0x13')][util[_0x6d5f('0x28')](_0x6d5f('0x102'),_0x21b292['name'])])&&!_[_0x6d5f('0x43')](this[_0x6d5f('0x13')][util[_0x6d5f('0x28')](_0x6d5f('0x102'),_0x21b292[_0x6d5f('0x35')])][_0x6d5f('0x50')])&&(this[_0x6d5f('0x13')][util[_0x6d5f('0x28')](_0x6d5f('0x102'),_0x21b292[_0x6d5f('0x35')])]['status']===_0x6d5f('0x103')||this['trunks'][util[_0x6d5f('0x28')](_0x6d5f('0x102'),_0x21b292[_0x6d5f('0x35')])][_0x6d5f('0x50')]===_0x6d5f('0x104'));};Preview[_0x6d5f('0x38')]['run']=function(_0x4eee81,_0x2f15f1){return this[_0x6d5f('0x105')](_0x4eee81,_0x2f15f1)[_0x6d5f('0x5d')](function(_0x5ca3ed){return _[_0x6d5f('0x4a')](_0x5ca3ed,['message']);})[_0x6d5f('0x52')](function(_0x17103e){if(_0x17103e[_0x6d5f('0x106')]){rpcDb[_0x6d5f('0x107')](_0x4eee81);}if(_0x17103e[_0x6d5f('0x101')]){rpcDb[_0x6d5f('0x66')](_0x4eee81);}throw _[_0x6d5f('0x4a')](_0x17103e,[_0x6d5f('0x33')]);});};Preview['prototype'][_0x6d5f('0x105')]=function(_0x2e7daf,_0x585c0a){var _0x399a53=this;var _0x25fa81,_0x164939;return rpcDb[_0x6d5f('0x108')](_0x2e7daf)['then'](function(_0x46f1de){if(!_[_0x6d5f('0x43')](_0x46f1de[0x0])){_0x164939=_0x46f1de[0x0][_0x6d5f('0x109')]?![]:!![];_0x25fa81=_0x46f1de[0x0][_0x6d5f('0x109')]?!![]:![];_0x25fa81=_0x585c0a?!![]:_0x25fa81;}var _0x2e5ca0=_0x399a53['validateContact'](_0x46f1de);if(_0x2e5ca0[_0x6d5f('0x10a')]){rpcDb['checkIsBlackList'](_[_0x6d5f('0x4a')](_0x46f1de[0x0],[_0x6d5f('0x4d'),_0x6d5f('0xf3')]))['then'](function(_0x5ca9a4){_0x399a53[_0x6d5f('0x10b')](_0x5ca9a4,_0x46f1de[0x0],_0x585c0a,_0x164939,_0x25fa81)[_0x6d5f('0x5d')](function(_0xfb24b5){return _0xfb24b5;})[_0x6d5f('0x52')](function(_0xf89eb9){throw _0xf89eb9;});})['catch'](function(_0x272cf6){ut[_0x6d5f('0x30')](_0x6d5f('0x10c'),_0x272cf6);throw ut[_0x6d5f('0x33')](_0x6d5f('0x10d'),_0x164939,_0x25fa81);});}else{throw ut['message'](_0x2e5ca0['message'],_0x164939,_0x25fa81);}})[_0x6d5f('0x52')](function(_0x41dfc7){ut[_0x6d5f('0x30')](_0x6d5f('0x10e'),_0x41dfc7);throw ut['message'](_0x6d5f('0x10d'),![],!![]);});};Preview[_0x6d5f('0x38')][_0x6d5f('0x10f')]=function(_0x1252c7){if(_[_0x6d5f('0x43')](_0x1252c7)||_[_0x6d5f('0xf6')](_0x1252c7)||!_[_0x6d5f('0x43')](_0x1252c7[0x0][_0x6d5f('0x61')])&&_[_0x6d5f('0x43')](_0x1252c7[0x0]['Agent'][_0x6d5f('0x35')])){ut[_0x6d5f('0x30')](_0x6d5f('0x110'),_0x1252c7);return{'isValid':![],'message':_0x6d5f('0x111')};}var _0x21a5bd=this[_0x6d5f('0x11')][_0x1252c7[0x0][_0x6d5f('0x44')]['name']];_0x21a5bd['message']=utils[_0x6d5f('0x2e')][_0x6d5f('0x7b')];if(_[_0x6d5f('0x43')](_0x21a5bd)){ut[_0x6d5f('0x30')](_0x6d5f('0x112'),_0x21a5bd);return{'isValid':![],'message':_0x6d5f('0x113')};}if(!this['isTrunkReachable'](_0x21a5bd[_0x6d5f('0x79')])){ut[_0x6d5f('0x30')](_0x6d5f('0x114'),_0x6d5f('0x115')+_0x21a5bd['name']+_0x6d5f('0x116'));if(!this[_0x6d5f('0x78')](_0x21a5bd[_0x6d5f('0x7a')])){ut[_0x6d5f('0x30')](_0x6d5f('0x114'),_0x21a5bd[_0x6d5f('0x35')]+_0x6d5f('0x117'));return{'isValid':![],'message':_0x6d5f('0x118')};}}if(!ut['isActive'](_0x21a5bd[_0x6d5f('0x3f')])){ut[_0x6d5f('0x30')](_0x6d5f('0x119'),_0x21a5bd[_0x6d5f('0x35')]+_0x6d5f('0x11a'));return{'isValid':![],'message':_0x6d5f('0x115')+_0x21a5bd[_0x6d5f('0x35')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x6d5f('0x38')]['execCall']=function(_0x5794ab,_0x3a70f4,_0x319051,_0x42f7b2){var _0x580745=this;return new Promise(function(_0x208419,_0x4a89df){var _0x2b9eda=_0x5794ab[_0x6d5f('0xa9')];var _0x14ce80=_0x580745[_0x6d5f('0x78')](_0x3a70f4[_0x6d5f('0x79')])?util['format'](_0x6d5f('0x11b'),_0x3a70f4[_0x6d5f('0x79')][_0x6d5f('0x35')],_[_0x6d5f('0x43')](_0x3a70f4[_0x6d5f('0x11c')])?'':_0x3a70f4[_0x6d5f('0x11c')][_0x6d5f('0x11d')]()||'',_0x3a70f4[_0x6d5f('0x11e')]>0x0?_0x319051[_0x6d5f('0xf3')][_0x6d5f('0x11f')](_0x3a70f4[_0x6d5f('0x11e')]):_0x319051[_0x6d5f('0xf3')]):util['format'](_0x6d5f('0x11b'),_[_0x6d5f('0x43')](_0x3a70f4[_0x6d5f('0x7a')])?_0x3a70f4[_0x6d5f('0x79')][_0x6d5f('0x35')]:_0x3a70f4['TrunkBackup'][_0x6d5f('0x35')],_[_0x6d5f('0x43')](_0x3a70f4['dialPrefix'])?'':_0x3a70f4[_0x6d5f('0x11c')][_0x6d5f('0x11d')]()||'',_0x3a70f4['dialCutDigit']>0x0?_0x319051[_0x6d5f('0xf3')][_0x6d5f('0x11f')](_0x3a70f4[_0x6d5f('0x11e')]):_0x319051[_0x6d5f('0xf3')]);var _0x49516c=_0x580745[_0x6d5f('0x78')](_0x3a70f4[_0x6d5f('0x79')])?ut[_0x6d5f('0x120')](_0x3a70f4[_0x6d5f('0x79')]['callerid'],_0x3a70f4[_0x6d5f('0x121')],_0x3a70f4[_0x6d5f('0x122')]>0x0?ut['getCallerIdRandom'](_0x3a70f4[_0x6d5f('0x123')],_0x3a70f4[_0x6d5f('0x122')]):_0x3a70f4[_0x6d5f('0x123')]):ut[_0x6d5f('0x120')](_['isNil'](_0x3a70f4[_0x6d5f('0x7a')])?_0x3a70f4['Trunk']['callerid']:_0x3a70f4[_0x6d5f('0x7a')][_0x6d5f('0x124')],_0x3a70f4[_0x6d5f('0x121')],_0x3a70f4[_0x6d5f('0x122')]>0x0?ut[_0x6d5f('0x125')](_0x3a70f4[_0x6d5f('0x123')],_0x3a70f4[_0x6d5f('0x122')]):_0x3a70f4[_0x6d5f('0x123')]);if(_0x49516c){_0x5794ab['originatecalleridname']=ut[_0x6d5f('0x126')](_0x49516c);_0x5794ab[_0x6d5f('0x127')]=ut[_0x6d5f('0x128')](_0x49516c);}var _0xe8ab62=ut[_0x6d5f('0x129')](_0x3a70f4,_0x319051,_0x14ce80,_0x49516c,_0x2b9eda,_0x5794ab);var _0xdc536e=utils['setXMDContactVariables'](_0x319051['Contact']);Object[_0x6d5f('0x12a')](_0xe8ab62,_0xdc536e);_['merge'](_0x5794ab,ut[_0x6d5f('0x12b')](_0xe8ab62));_0x5794ab[_0x6d5f('0x67')]=moment()[_0x6d5f('0x28')](_0x6d5f('0x68'));_0x3a70f4[_0x6d5f('0x12c')]=_0xe8ab62;var _0x326e00=ut[_0x6d5f('0x12d')](_0x5794ab,_0x3a70f4,_0xe8ab62,_0x5794ab[_0x6d5f('0x8f')],_0x42f7b2);return ami[_0x6d5f('0x4f')](_0x326e00)[_0x6d5f('0x5d')](function(_0x390f01){_0x3a70f4['originated']+=0x1;logger[_0x6d5f('0x26')](_0x6d5f('0x12e'),_0x2b9eda,_0x6d5f('0x98'),_0x3a70f4['name'],_0x6d5f('0xee'),_0x3a70f4[_0x6d5f('0x2b')]);_0x208419(_0x390f01);})[_0x6d5f('0x52')](function(_0x2e5feb){ut['logAgent'](_0x5794ab,0xe,_0x6d5f('0x12f'));rpcDb['createAgentHistory'](_0x5794ab,_0x6d5f('0x130'));_0x4a89df(_0x2e5feb);});});};Preview['prototype'][_0x6d5f('0x1f')]=function(_0x4bc0eb){if(this[_0x6d5f('0x14')][_0x4bc0eb[_0x6d5f('0x90')]]){this[_0x6d5f('0x14')][_0x4bc0eb[_0x6d5f('0x90')]][_0x6d5f('0x51')]=_0x4bc0eb[_0x6d5f('0x51')];}};Preview[_0x6d5f('0x38')][_0x6d5f('0x17')]=function(_0x4c61ce){var _0x531358=this;var _0x5a178d=this[_0x6d5f('0x14')][_0x4c61ce['actionid']];if(_0x5a178d){if(_0x5a178d[_0x6d5f('0xf5')]&&this[_0x6d5f('0x15')][_0x5a178d['lookAgent']]){ut[_0x6d5f('0x131')](_0x5a178d,this[_0x6d5f('0x15')][_0x5a178d[_0x6d5f('0xf5')]][_0x6d5f('0x35')],this[_0x6d5f('0x15')][_0x5a178d[_0x6d5f('0xf5')]]['id']);}var _0x5114c2=_[_0x6d5f('0x132')](_0x5a178d);_0x5114c2['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2d9ee0=_0x531358[_0x6d5f('0x11')][_0x5a178d[_0x6d5f('0x45')]];if(ut[_0x6d5f('0x133')](_0x4c61ce[_0x6d5f('0x134')])){if(_0x5a178d['unlockAgent']){rpcDb['unlockContact'](_0x5a178d[_0x6d5f('0xb3')]);}if(_0x5a178d[_0x6d5f('0x8f')]){rpcDb[_0x6d5f('0x66')](_0x5a178d[_0x6d5f('0xb3')]);}ami[_0x6d5f('0x25')]('custom:agentringnoanswer',ut[_0x6d5f('0x81')](_0x5a178d,_0x6d5f('0x135'),this['campaignsPreview'][_0x5a178d[_0x6d5f('0x45')]]));this['callProgressDetectingAgent'](_0x5114c2,_0x2d9ee0,_0x4c61ce);}else{_0x5a178d[_0x6d5f('0x67')]=moment()[_0x6d5f('0x28')](_0x6d5f('0x68'));ut[_0x6d5f('0xe7')](_0x5114c2,0x4,_0x6d5f('0xa2'));rpcDb['createAgentHistory'](_0x5114c2,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x6d5f('0x38')]['syncHangup']=function(_0x12fde9){var _0x42e60b=this[_0x6d5f('0x14')][_0x12fde9[_0x6d5f('0x90')]];var _0x240c0b;if(_0x42e60b){_0x240c0b=this[_0x6d5f('0x11')][_0x42e60b['queue']];logger[_0x6d5f('0x26')](_0x6d5f('0x136'),_0x12fde9[_0x6d5f('0x90')],_0x6d5f('0x98'),_0x240c0b['name'],'pTalking:\x20',_0x240c0b['pTalking']);}if(this[_0x6d5f('0x14')][_0x12fde9[_0x6d5f('0x90')]]&&_0x12fde9[_0x6d5f('0x90')]!==_0x12fde9[_0x6d5f('0xa9')]){if(_0x12fde9[_0x6d5f('0x137')]==='16'&&this[_0x6d5f('0x14')][_0x12fde9['linkedid']][_0x6d5f('0x49')]){this[_0x6d5f('0x7c')](_0x12fde9,_0x12fde9[_0x6d5f('0x90')],_0x12fde9['cause']);}else if(this[_0x6d5f('0x14')][_0x12fde9[_0x6d5f('0x90')]][_0x6d5f('0x49')]){logger[_0x6d5f('0x26')](_0x6d5f('0x138'),_0x12fde9['linkedid'],_0x12fde9['cause'],_0x6d5f('0x98'),_0x240c0b['name'],_0x6d5f('0x46'),_0x240c0b['pTalking']);this['callProgressDetectingCustomer'](_0x12fde9,_0x12fde9[_0x6d5f('0x90')],_0x12fde9['cause']);}}else if(_0x42e60b&&_['isNil'](_0x42e60b['statedesc'])&&_0x240c0b[_0x6d5f('0x139')]&&_0x12fde9['linkedid']===_0x12fde9[_0x6d5f('0xa9')]&&_[_0x6d5f('0x43')](_0x12fde9[_0x6d5f('0xe4')])&&_0x12fde9[_0x6d5f('0x137')]==='16'&&_0x12fde9['channelstate']==='6'&&_[_0x6d5f('0xe2')](_0x42e60b['transfer'])){if(_0x42e60b[_0x6d5f('0x8e')]){rpcDb[_0x6d5f('0x107')](_0x42e60b[_0x6d5f('0xb3')]);}if(_0x42e60b[_0x6d5f('0x8f')]){rpcDb[_0x6d5f('0x66')](_0x42e60b[_0x6d5f('0xb3')]);}_0x12fde9[_0x6d5f('0xe4')]='22';this[_0x6d5f('0x13a')](_0x42e60b,_0x240c0b,_0x12fde9);}else if(_0x42e60b&&_0x42e60b[_0x6d5f('0x13b')]){if(_0x12fde9['cause']==='16'&&this[_0x6d5f('0x14')][_0x12fde9['linkedid']]['dialAnswer']){logger[_0x6d5f('0x26')](_0x6d5f('0x13c'),_0x12fde9['linkedid'],_0x12fde9['cause'],_0x6d5f('0x98'),_0x240c0b['name'],_0x6d5f('0x46'),_0x240c0b[_0x6d5f('0x48')]);this[_0x6d5f('0x7c')](_0x12fde9,_0x12fde9[_0x6d5f('0x90')],_0x12fde9[_0x6d5f('0x137')]);}else if(this[_0x6d5f('0x14')][_0x12fde9['linkedid']][_0x6d5f('0x49')]){logger[_0x6d5f('0x26')](_0x6d5f('0x138'),_0x12fde9[_0x6d5f('0x90')],_0x12fde9[_0x6d5f('0x137')],_0x6d5f('0x98'),_0x240c0b['name'],_0x6d5f('0x46'),_0x240c0b['pTalking']);this['callProgressDetectingCustomer'](_0x12fde9,_0x12fde9['linkedid'],_0x12fde9[_0x6d5f('0x137')]);}}};Preview[_0x6d5f('0x38')][_0x6d5f('0x1d')]=function(_0x34a871){if(this['actions'][_0x34a871[_0x6d5f('0xe1')]]&&_0x34a871[_0x6d5f('0xe1')]!==_0x34a871[_0x6d5f('0x13d')]){this[_0x6d5f('0x7c')](_0x34a871,_0x34a871[_0x6d5f('0xe1')],_0x34a871[_0x6d5f('0xd7')]);}};Preview[_0x6d5f('0x38')][_0x6d5f('0x1c')]=function(_0x40e134){if(this[_0x6d5f('0x14')][_0x40e134[_0x6d5f('0x90')]]&&_0x40e134[_0x6d5f('0x90')]!==_0x40e134[_0x6d5f('0xa9')]&&!this[_0x6d5f('0x14')][_0x40e134[_0x6d5f('0x90')]][_0x6d5f('0x49')]){if(_0x40e134[_0x6d5f('0x137')]==='1'){this['callProgressDetectingCustomer'](_0x40e134,_0x40e134['linkedid'],_0x40e134[_0x6d5f('0x137')]);}}};Preview[_0x6d5f('0x38')][_0x6d5f('0x13e')]=function(_0x5b9a42,_0x2a9f22,_0x5bbc24){if(this['actions'][_0x5b9a42]){if(_['isNil'](this['actions'][_0x5b9a42]['variables'])){this[_0x6d5f('0x14')][_0x5b9a42][_0x6d5f('0x12c')]={};}this[_0x6d5f('0x14')][_0x5b9a42]['variables'][_0x2a9f22]=_0x5bbc24;}};Preview[_0x6d5f('0x38')]['syncVarSet']=function(_0x4a4dd6){try{if(!_['isNil'](_0x4a4dd6)){if(ut[_0x6d5f('0x13f')](_['keys'](_0x4a4dd6[_0x6d5f('0x140')])[0x0])){this[_0x6d5f('0x13e')](_0x4a4dd6[_0x6d5f('0xa9')],_[_0x6d5f('0x141')](_0x4a4dd6[_0x6d5f('0x140')])[0x0],_0x4a4dd6['value']);}}}catch(_0x2a4ab7){logger[_0x6d5f('0x142')](_0x6d5f('0x143'),util[_0x6d5f('0x144')](_0x2a4ab7,{'showHidden':![],'depth':null}));}};Preview[_0x6d5f('0x38')][_0x6d5f('0x145')]=function(_0x5468a0){if(_0x5468a0){if(this[_0x6d5f('0x14')][_0x5468a0[_0x6d5f('0x146')]]){this['actions'][_0x5468a0['transfertargetlinkedid']][_0x6d5f('0x13b')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x848484){if(_0x848484){if(this[_0x6d5f('0x14')][_0x848484[_0x6d5f('0x147')]]){this[_0x6d5f('0x14')][_0x848484[_0x6d5f('0x147')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index e66058c..49db4c9 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 _0x0dcc=['create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','membername','from-sip','exten','xcally-motion-preview','lastAssignedTo'];(function(_0x5e7429,_0x17c4ca){var _0x3eed62=function(_0x5ba8f4){while(--_0x5ba8f4){_0x5e7429['push'](_0x5e7429['shift']());}};_0x3eed62(++_0x17c4ca);}(_0x0dcc,0xfa));var _0xc0dc=function(_0xa4ae3d,_0x547c45){_0xa4ae3d=_0xa4ae3d-0x0;var _0x21b4dc=_0x0dcc[_0xa4ae3d];return _0x21b4dc;};'use strict';var util=require(_0xc0dc('0x0'));var BPromise=require(_0xc0dc('0x1'));var logger=require('../../../config/logger')(_0xc0dc('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xc0dc('0x3'));var cmHopperBlack=require(_0xc0dc('0x4'));var agentReportPreview=require(_0xc0dc('0x5'));var voiceQueueReport=require(_0xc0dc('0x6'));function loggerCatch(_0x261e77){return function(_0x53da18){logger[_0xc0dc('0x7')](_0x261e77,util[_0xc0dc('0x8')](_0x53da18,{'showHidden':![],'depth':null}));};}function create(_0x6c513b){return cmHopperHistory[_0xc0dc('0x9')](_0x6c513b)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x577c37){return BPromise[_0xc0dc('0xa')]()[_0xc0dc('0xb')](agentReportPreview[_0xc0dc('0x9')](_0x577c37))[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0xd')));}function moveContact(_0x222b54){return cmHopper[_0xc0dc('0xe')](_0x222b54,!![])[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0xf')));}exports[_0xc0dc('0x10')]=function(_0xd9c7c1){return cmHopperBlack[_0xc0dc('0x10')](_0xd9c7c1)[_0xc0dc('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x581096){return BPromise[_0xc0dc('0xa')]()[_0xc0dc('0xb')](cmHopper['getContactPreview'](_0x581096))['catch'](loggerCatch(_0xc0dc('0x11')));};exports[_0xc0dc('0x9')]=function(_0x34e28a,_0x25d29f){create(_0x34e28a)['catch'](loggerCatch(_0x25d29f));moveContact(_0x34e28a)[_0xc0dc('0xc')](loggerCatch(_0x25d29f));};exports[_0xc0dc('0x12')]=function(_0x103bab,_0x26be33){createAgent(_0x103bab)[_0xc0dc('0xc')](loggerCatch(_0x26be33));};exports['createCustomerHistory']=function(_0x11276f,_0x4a5458){create(_0x11276f)[_0xc0dc('0xc')](loggerCatch(_0x4a5458));};exports[_0xc0dc('0x13')]=function(_0x3f3045,_0x5d9db1){moveContact(_0x3f3045)[_0xc0dc('0xc')](loggerCatch(_0x5d9db1));};exports[_0xc0dc('0x14')]=function(_0x2d9e2a,_0x477f42,_0x4cff22){if(_0x477f42){_0x2d9e2a[_0xc0dc('0x15')]=null;}if(_0x4cff22){_0x2d9e2a['active']=![];}return cmHopper[_0xc0dc('0x14')](_0x2d9e2a)[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0x16')));};exports[_0xc0dc('0x17')]=function(_0xe50021){return cmHopper[_0xc0dc('0x17')](_0xe50021)['catch'](loggerCatch(_0xc0dc('0x18')));};exports[_0xc0dc('0x19')]=function(_0x3de1c6){return cmHopper[_0xc0dc('0x19')]({'UserId':null},_0x3de1c6,0x1)['catch'](loggerCatch(_0xc0dc('0x1a')));};exports['disableContact']=function(_0x1a8752){return cmHopper[_0xc0dc('0x19')]({'active':![]},_0x1a8752,0x1)['catch'](loggerCatch(_0xc0dc('0x1b')));};exports[_0xc0dc('0x1c')]=function(_0x1a14e3){var _0x3259f8={};_0x3259f8[_0xc0dc('0x1d')]=_0x1a14e3['type'];_0x3259f8[_0xc0dc('0x1e')]=_0x1a14e3[_0xc0dc('0x1e')];_0x3259f8[_0xc0dc('0x1f')]=_0x1a14e3[_0xc0dc('0x1f')];_0x3259f8[_0xc0dc('0x20')]=_0x1a14e3['calleridname'];_0x3259f8[_0xc0dc('0x21')]=_0x1a14e3['queue'];_0x3259f8[_0xc0dc('0x22')]=_0x1a14e3[_0xc0dc('0x23')];_0x3259f8[_0xc0dc('0x24')]=_0x1a14e3[_0xc0dc('0x23')];_0x3259f8[_0xc0dc('0x25')]=0x1;_0x3259f8['queuecallercompleteAt']=_0x1a14e3[_0xc0dc('0x26')];_0x3259f8['connectedlinename']=_0x1a14e3[_0xc0dc('0x27')];_0x3259f8['context']=_0xc0dc('0x28');_0x3259f8[_0xc0dc('0x29')]=_0xc0dc('0x2a');_0x3259f8['holdtime']=0x0;_0x3259f8['assigned']=0x1;_0x3259f8[_0xc0dc('0x2b')]=_0x1a14e3['membername'];_0x3259f8['queuecallerexitreason']='COMPLETED';return BPromise[_0xc0dc('0xa')]()[_0xc0dc('0xb')](voiceQueueReport[_0xc0dc('0x2c')](_0x3259f8))[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0x2d')));};exports[_0xc0dc('0x2e')]=function(_0xc1eb3e,_0x5783ab){return BPromise[_0xc0dc('0xa')]()[_0xc0dc('0xb')](cmHopper['getContactRecallMe'](_0xc1eb3e,_0x5783ab))[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0x2f')));};exports['rescheduleContactInQueue']=function(_0x43a5a8){return cmHopper[_0xc0dc('0x14')](_0x43a5a8,!![],!![])[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0x30')));}; \ No newline at end of file +var _0x026b=['inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','membername','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x026b,0x12a));var _0xb026=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x026b[_0x381589];return _0x2a075d;};'use strict';var util=require('util');var BPromise=require(_0xb026('0x0'));var logger=require(_0xb026('0x1'))(_0xb026('0x2'));var cmHopper=require(_0xb026('0x3'));var cmHopperHistory=require(_0xb026('0x4'));var cmHopperBlack=require(_0xb026('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xb026('0x6'));function loggerCatch(_0x5236b1){return function(_0x1319be){logger[_0xb026('0x7')](_0x5236b1,util[_0xb026('0x8')](_0x1319be,{'showHidden':![],'depth':null}));};}function create(_0x137b43){return cmHopperHistory[_0xb026('0x9')](_0x137b43)[_0xb026('0xa')](loggerCatch(_0xb026('0xb')));}function createAgent(_0x588c9c){return BPromise[_0xb026('0xc')]()[_0xb026('0xd')](agentReportPreview['createHistory'](_0x588c9c))['catch'](loggerCatch(_0xb026('0xb')));}function moveContact(_0xcad047){return cmHopper[_0xb026('0xe')](_0xcad047,!![])[_0xb026('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xb026('0xf')]=function(_0x38d775){return cmHopperBlack[_0xb026('0xf')](_0x38d775)[_0xb026('0xa')](loggerCatch(_0xb026('0x10')));};exports[_0xb026('0x11')]=function(_0x433647){return BPromise['resolve']()['then'](cmHopper[_0xb026('0x11')](_0x433647))[_0xb026('0xa')](loggerCatch(_0xb026('0x12')));};exports[_0xb026('0x9')]=function(_0x514d3d,_0x278638){create(_0x514d3d)[_0xb026('0xa')](loggerCatch(_0x278638));moveContact(_0x514d3d)[_0xb026('0xa')](loggerCatch(_0x278638));};exports['createAgentHistory']=function(_0x3449ac,_0x478c0b){createAgent(_0x3449ac)[_0xb026('0xa')](loggerCatch(_0x478c0b));};exports[_0xb026('0x13')]=function(_0x38c8c6,_0x4ba75a){create(_0x38c8c6)[_0xb026('0xa')](loggerCatch(_0x4ba75a));};exports[_0xb026('0x14')]=function(_0x33c0f9,_0x2746ad){moveContact(_0x33c0f9)[_0xb026('0xa')](loggerCatch(_0x2746ad));};exports[_0xb026('0x15')]=function(_0x42a1a3,_0x1ed0b9,_0x7f4586){if(_0x1ed0b9){_0x42a1a3[_0xb026('0x16')]=null;}if(_0x7f4586){_0x42a1a3['active']=![];}return cmHopper[_0xb026('0x15')](_0x42a1a3)['catch'](loggerCatch(_0xb026('0x17')));};exports[_0xb026('0x18')]=function(_0x446a51){return cmHopper[_0xb026('0x18')](_0x446a51)[_0xb026('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0xb026('0x19')]=function(_0x1affef){return cmHopper['unlockContact']({'UserId':null},_0x1affef,0x1)[_0xb026('0xa')](loggerCatch('[unlockContact]\x20'));};exports[_0xb026('0x1a')]=function(_0x4fd157){return cmHopper[_0xb026('0x19')]({'active':![]},_0x4fd157,0x1)[_0xb026('0xa')](loggerCatch(_0xb026('0x1b')));};exports[_0xb026('0x1c')]=function(_0x5a2cfc){var _0x78c422={};_0x78c422['type']=_0x5a2cfc['type'];_0x78c422['uniqueid']=_0x5a2cfc['uniqueid'];_0x78c422[_0xb026('0x1d')]=_0x5a2cfc[_0xb026('0x1d')];_0x78c422[_0xb026('0x1e')]=_0x5a2cfc[_0xb026('0x1e')];_0x78c422[_0xb026('0x1f')]=_0x5a2cfc[_0xb026('0x1f')];_0x78c422[_0xb026('0x20')]=_0x5a2cfc['answertime'];_0x78c422[_0xb026('0x21')]=_0x5a2cfc[_0xb026('0x22')];_0x78c422[_0xb026('0x23')]=0x1;_0x78c422[_0xb026('0x24')]=_0x5a2cfc['endtime'];_0x78c422['connectedlinename']=_0x5a2cfc[_0xb026('0x25')];_0x78c422['context']=_0xb026('0x26');_0x78c422[_0xb026('0x27')]='xcally-motion-preview';_0x78c422[_0xb026('0x28')]=0x0;_0x78c422[_0xb026('0x29')]=0x1;_0x78c422[_0xb026('0x2a')]=_0x5a2cfc['membername'];_0x78c422[_0xb026('0x2b')]=_0xb026('0x2c');return BPromise[_0xb026('0xc')]()['then'](voiceQueueReport[_0xb026('0x2d')](_0x78c422))[_0xb026('0xa')](loggerCatch(_0xb026('0x2e')));};exports[_0xb026('0x2f')]=function(_0xe6c35c,_0x44815f){return BPromise['resolve']()[_0xb026('0xd')](cmHopper['getContactRecallMe'](_0xe6c35c,_0x44815f))[_0xb026('0xa')](loggerCatch(_0xb026('0x30')));};exports[_0xb026('0x31')]=function(_0x2df82d){return cmHopper[_0xb026('0x15')](_0x2df82d,!![],!![])[_0xb026('0xa')](loggerCatch(_0xb026('0x32')));}; \ 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 27e6ddb..2c3fa2f 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 _0x64bf=['BOOKED','from-sip','timeout','uniqueid','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','scheduledat','minutes','ListId','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','queue','interface','voice','mandatoryDisposition','buildObj','not_inuse','status','reachable','push','milliseconds','diff','seconds','filterKey','idContact','campaigntype','dialAnswer','active','countbusyretry','countcongestionretry','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','logger','info','inspect','logger2','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','starttime','logLookAgent','membername','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','calleridname'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x64bf,0x1cc));var _0xf64b=function(_0x4dc190,_0x443cdb){_0x4dc190=_0x4dc190-0x0;var _0x14dae6=_0x64bf[_0x4dc190];return _0x14dae6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf64b('0x0'));var logger=require(_0xf64b('0x1'))(_0xf64b('0x2'));var ipAgi=process['env'][_0xf64b('0x3')]||_0xf64b('0x4');var utils=require(_0xf64b('0x5'));exports['loggerCatch']=function(_0x3d5c1f){return function(_0x3c11b8){logger[_0xf64b('0x6')](_0x3d5c1f,util['inspect'](_0x3c11b8,{'showHidden':![],'depth':null}));};};exports[_0xf64b('0x7')]=function(_0x21667c,_0x244c71){logger[_0xf64b('0x8')](_0x21667c,util[_0xf64b('0x9')](_0x244c71,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5bb51f,_0xbdd784){logger['error'](_0x5bb51f,util[_0xf64b('0x9')](_0xbdd784,{'showHidden':![],'depth':null}));};exports[_0xf64b('0xa')]=function(_0x564083){return function(_0x241045){logger[_0xf64b('0x8')](_0x564083,util[_0xf64b('0x9')](_0x241045,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xf80a69,_0x26d651,_0x265b7b){return{'message':_0xf80a69,'unlock':_0x26d651,'active':_0x265b7b};};exports['getCallerId']=function(_0x2c91cd,_0x59a35e,_0x48a4a0){if(!_[_0xf64b('0xb')](_0x48a4a0)&&'string'===typeof _0x48a4a0&&!_[_0xf64b('0xc')](_0x48a4a0)){if(!_[_0xf64b('0xb')](_0x59a35e)&&_0xf64b('0xd')===typeof _0x59a35e&&!_[_0xf64b('0xc')](_0x59a35e)){return util[_0xf64b('0xe')](_0xf64b('0xf'),_0x59a35e,_0x48a4a0);}return util[_0xf64b('0xe')](_0xf64b('0xf'),_0x48a4a0,_0x48a4a0);}if(!_['isUndefined'](_0x2c91cd)&&_0xf64b('0xd')===typeof _0x2c91cd&&!_[_0xf64b('0xc')](_0x2c91cd)){return _0x2c91cd;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x501ff2){if(_[_0xf64b('0x10')](_0x501ff2)){return![];}return _0x501ff2;};exports[_0xf64b('0x11')]=function(_0x18ced3,_0x3b5d83,_0x3aaa70,_0x4e2eb3,_0x4683d9,_0x153889){var _0x2b9d86={'XMD-QUEUE':_0x3b5d83['Queue']?_0x3b5d83[_0xf64b('0x12')][_0xf64b('0x13')]:'','XMD-CALLERID':_0x4e2eb3,'XMD-CALLERID-PREVIEW':_0x153889?util[_0xf64b('0xe')](_0xf64b('0xf'),_0x153889['calleridname'],_0x153889[_0xf64b('0x14')]):_0x4e2eb3,'XMD-DIALID':_0x4683d9,'XMD-CONTACTID':_0x3b5d83[_0xf64b('0x15')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4e2eb3,'XMD-VOICEQUEUEID':_0x3b5d83[_0xf64b('0x16')],'XMD-DIALCHANNEL':_0x3aaa70,'XMD-DIALTIMEOUT':_0x18ced3['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xf64b('0x17'),_0x18ced3[_0xf64b('0x18')]?'g':'',_[_0xf64b('0xc')](_0x18ced3[_0xf64b('0x19')])?'':_0xf64b('0x1a')),'XMD-DIALURL':_0x18ced3[_0xf64b('0x1b')]||'','XMD-AGI':_0x18ced3['dialQueueProject']?util[_0xf64b('0xe')](_0xf64b('0x1c'),ipAgi,_0x18ced3[_0xf64b('0x1d')]):_0xf64b('0x1e'),'XMD-AGIAFTER':_0x18ced3[_0xf64b('0x18')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x18ced3['dialQueueProject2']):_0xf64b('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x153889?_0x153889[_0xf64b('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x153889?_0x153889[_0xf64b('0x20')]:'','XMD-DESTINATION':_0xf64b('0x21'),'SIPADDHEADER':_0xf64b('0x22')};if(!_['isEmpty'](_0x18ced3[_0xf64b('0x19')])){_0x2b9d86[util[_0xf64b('0xe')]('%s',_0xf64b('0x23'))]=_0x18ced3[_0xf64b('0x19')];_0x2b9d86[util[_0xf64b('0xe')]('%s',_0xf64b('0x24'))]=_0x4683d9;}return _0x2b9d86;};exports[_0xf64b('0x25')]=function(_0x40d1bf){var _0x286fd3={};for(var _0x5d8024 in _0x40d1bf){if(_0x40d1bf[_0xf64b('0x26')](_0x5d8024)){_0x286fd3[util[_0xf64b('0xe')]('%s',_[_0xf64b('0x27')](_0x5d8024))]=_0x40d1bf[_0x5d8024];}}return{'variables':_0x286fd3};};exports[_0xf64b('0x28')]=function(_0x9561ff){var _0x222726=moment()[_0xf64b('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x9561ff[_0xf64b('0x29')]=0xd;_0x9561ff[_0xf64b('0x2a')]=_0xf64b('0x2b');_0x9561ff['starttime']=_0x222726;_0x9561ff[_0xf64b('0x2c')]=_0x222726;_0x9561ff[_0xf64b('0x2d')]=_0x222726;};exports[_0xf64b('0x2e')]=function(_0x568f56,_0x4b772b,_0x504ca2){var _0x87205a=moment()[_0xf64b('0xe')](_0xf64b('0x2f'));_0x568f56[_0xf64b('0x29')]=_0x4b772b;_0x568f56['statedesc']=_0x504ca2;_0x568f56[_0xf64b('0x2c')]=_0x87205a;_0x568f56[_0xf64b('0x30')]=utils[_0xf64b('0x31')](_0x568f56['responsetime'],_0x568f56[_0xf64b('0x32')]);};exports[_0xf64b('0x33')]=function(_0x3fb93d,_0x5a1b72,_0x1d9a13){_0x3fb93d[_0xf64b('0x34')]=_0x5a1b72;_0x3fb93d['UserId']=_0x1d9a13;};exports[_0xf64b('0x35')]=function(_0x27ceeb,_0x4c1a6b,_0x368971){var _0x587a00=moment()[_0xf64b('0xe')](_0xf64b('0x2f'));_0x27ceeb[_0xf64b('0x29')]=_0x4c1a6b;_0x27ceeb[_0xf64b('0x2a')]=_0x368971;_0x27ceeb[_0xf64b('0x2c')]=_0x27ceeb[_0xf64b('0x2c')]?_0x27ceeb[_0xf64b('0x2c')]:_0x587a00;_0x27ceeb[_0xf64b('0x2d')]=_0x27ceeb['endtime']?_0x27ceeb[_0xf64b('0x2d')]:_0x587a00;_0x27ceeb[_0xf64b('0x30')]=utils[_0xf64b('0x31')](_0x27ceeb[_0xf64b('0x2c')]||0x0,_0x27ceeb[_0xf64b('0x32')]||0x0);_0x27ceeb[_0xf64b('0x36')]=_0x27ceeb['answertime']?utils[_0xf64b('0x31')](_0x27ceeb[_0xf64b('0x2d')],_0x27ceeb[_0xf64b('0x37')]):0x0;};exports['isFailure']=function(_0x48eb27){return _0x48eb27===_0xf64b('0x38');};exports[_0xf64b('0x39')]=function(_0x20e4a0,_0x259426,_0x1f0b5a,_0x51c4ce,_0x2f94c6){var _0x522312=_0x51c4ce?_0xf64b('0x3a'):_0x20e4a0[_0xf64b('0x3b')];_0x522312=_0x2f94c6?_0xf64b('0x3c'):_0x522312;return{'actionid':_0x20e4a0['uniqueid'],'action':'originate','channel':_0x20e4a0['channelAgent'],'callerid':util[_0xf64b('0xe')](_0xf64b('0xf'),_0x522312,_0x20e4a0[_0xf64b('0x14')]),'Exten':_0xf64b('0x21'),'Context':_0xf64b('0x3d'),'Priority':'1','variable':_0x1f0b5a,'timeout':(_0x259426[_0xf64b('0x3e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20e4a0[_0xf64b('0x3f')]};};exports[_0xf64b('0x40')]=function(_0x5ee2c2){return _0x5ee2c2['countbusyretry']+_0x5ee2c2['countcongestionretry']+_0x5ee2c2[_0xf64b('0x41')]+_0x5ee2c2[_0xf64b('0x42')]+_0x5ee2c2[_0xf64b('0x43')];};exports[_0xf64b('0x44')]=function(_0x1eafc1){var _0x15afcb=_['clone'](_0x1eafc1);_0x15afcb[_0xf64b('0x29')]=0xf;_0x15afcb['statedesc']='Global';return _0x15afcb;};exports['scheduledAt']=function(_0x426698,_0x1206da,_0x3cf230){var _0x5274f2={};_0x5274f2[_0x1206da]=_0x426698[_0x1206da];_0x5274f2['active']=![];_0x5274f2[_0xf64b('0x45')]=moment()['add'](_0x3cf230,_0xf64b('0x46'))[_0xf64b('0xe')](_0xf64b('0x2f'));_0x5274f2[_0xf64b('0x15')]=_0x426698[_0xf64b('0x15')];_0x5274f2['ListId']=_0x426698[_0xf64b('0x47')];_0x5274f2[_0xf64b('0x16')]=_0x426698[_0xf64b('0x16')]||undefined;return _0x5274f2;};exports['decrementTalking']=function(_0x898309,_0x2fe387){if(!_[_0xf64b('0x10')](_0x898309)){if(_0x898309[_0xf64b('0x48')]>0x0){_0x898309['pTalking']-=0x1;}else{logger[_0xf64b('0x8')](_0x2fe387,_0xf64b('0x49'));}}else{logger[_0xf64b('0x6')](_0x2fe387,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x331688){if(_0x331688<=0x0){return!![];}return![];};function buildObj(_0x38337a,_0x5ca7aa,_0x4509e0){_0x38337a['lastevent']=_0x5ca7aa;_0x38337a[_0xf64b('0x13')]=_0x38337a[_0xf64b('0x4a')];_0x38337a[_0xf64b('0x4b')]=_0x38337a['channelAgent'];_0x38337a['motionChannel']=_0xf64b('0x4c');if(_0x4509e0){_0x38337a[_0xf64b('0x4d')]=_0x4509e0[_0xf64b('0x4d')];}return _0x38337a;}exports[_0xf64b('0x4e')]=buildObj;exports['agentReadyId']=function(_0x15b4a6){var _0x277848=[];for(var _0x5ad9b0 in _0x15b4a6){if(_0x15b4a6['hasOwnProperty'](_0x5ad9b0)){if(!_[_0xf64b('0x10')](_0x15b4a6[_0x5ad9b0])&&_0x15b4a6[_0x5ad9b0][_0xf64b('0x29')]===_0xf64b('0x4f')&&_0x15b4a6[_0x5ad9b0][_0xf64b('0x50')]===_0xf64b('0x51')){_0x277848[_0xf64b('0x52')](_0x15b4a6[_0x5ad9b0]['id']);}}}return _0x277848;};exports['getDiff']=function(_0xea9e6a){var _0x420290=moment()['milliseconds'](0x0);var _0x5be9b8=moment(_0xea9e6a)[_0xf64b('0x53')](0x0);return _0x420290[_0xf64b('0x54')](_0x5be9b8,_0xf64b('0x55'));};exports['createBody']=function(_0x38fc6e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x38fc6e[_0xf64b('0x15')],'ListId':_0x38fc6e[_0xf64b('0x47')],'VoiceQueueId':_0x38fc6e[_0xf64b('0x16')]||undefined,'CampaignId':_0x38fc6e['CampaignId']||undefined};};exports[_0xf64b('0x56')]=function(_0x347b43){if(_0x347b43===_0xf64b('0x3f')||_0x347b43===_0xf64b('0x57')||_0x347b43==='queue'||_0x347b43==='type'||_0x347b43===_0xf64b('0x58')||_0x347b43===_0xf64b('0x59')||_0x347b43===_0xf64b('0x34')||_0x347b43==='channelAgent'||_0x347b43===_0xf64b('0x3b')||_0x347b43===_0xf64b('0x5a')||_0x347b43===_0xf64b('0x14')||_0x347b43===_0xf64b('0x45')||_0x347b43===_0xf64b('0x5b')||_0x347b43===_0xf64b('0x5c')||_0x347b43===_0xf64b('0x41')||_0x347b43==='countglobal'||_0x347b43===_0xf64b('0x5d')||_0x347b43==='callbackuniqueid'||_0x347b43===_0xf64b('0x5e')||_0x347b43===_0xf64b('0x5f')||_0x347b43===_0xf64b('0x15')||_0x347b43===_0xf64b('0x47')||_0x347b43==='UserId'||_0x347b43===_0xf64b('0x16')||_0x347b43===_0xf64b('0x60')||_0x347b43===_0xf64b('0x61')||_0x347b43===_0xf64b('0x62')||_0x347b43==='xmd-phone'||_0x347b43===_0xf64b('0x63')||_0x347b43==='xmd-dialurl'||_0x347b43===_0xf64b('0x64')||_0x347b43===_0xf64b('0x65')||_0x347b43===_0xf64b('0x66')||_0x347b43===_0xf64b('0x67')||_0x347b43==='xmd-contactid'||_0x347b43===_0xf64b('0x68')||_0x347b43==='xmd-callerid'||_0x347b43===_0xf64b('0x69')||_0x347b43===_0xf64b('0x6a')||_0x347b43===_0xf64b('0x6b')||_0x347b43===_0xf64b('0x6c')||_0x347b43===_0xf64b('0x6d')||_0x347b43===_0xf64b('0x6e')||_0x347b43===_0xf64b('0x6f')||_0x347b43===_0xf64b('0x70')||_0x347b43===_0xf64b('0x71')||_0x347b43===_0xf64b('0x72')||_0x347b43===_0xf64b('0x6b')||_0x347b43===_0xf64b('0x6c')||_0x347b43===_0xf64b('0x6d')||_0x347b43==='rtpaudioqosjitterbridged'||_0x347b43===_0xf64b('0x6f')||_0x347b43===_0xf64b('0x70')||_0x347b43===_0xf64b('0x71')||_0x347b43===_0xf64b('0x72')||_0x347b43===_0xf64b('0x73')||_0x347b43===_0xf64b('0x74')||_0x347b43===_0xf64b('0x29')||_0x347b43===_0xf64b('0x2a')){return![];}return!![];};exports[_0xf64b('0x75')]=function(_0x40001b,_0x4dc4d9){var _0x4235bb,_0x4ed8e3,_0x47cfb8;if(_0x4dc4d9<=0x0){_0x4dc4d9=0x1;}_0x4235bb=new RegExp(_0xf64b('0x76')+_0x4dc4d9+'}$');_0x4ed8e3=Math[_0xf64b('0x77')](0xa,_0x4dc4d9-0x1);_0x47cfb8=Math['pow'](0xa,_0x4dc4d9)-0x1;return util['format']('%s',_[_0xf64b('0x78')](_0x40001b,_0x4235bb,_['random'](_0x4ed8e3,_0x47cfb8)));};exports[_0xf64b('0x79')]=function(_0x37935c){var _0x3ab44a=_0x37935c[_0xf64b('0x7a')](/"(.*?)"/);return _0x3ab44a?_0x3ab44a[0x1]:_0x37935c;};exports[_0xf64b('0x7b')]=function(_0x2f2c2e){var _0x421cbe=_0x2f2c2e[_0xf64b('0x7a')](/<(.*?)>/);return _0x421cbe?_0x421cbe[0x1]:_0x2f2c2e;};function buildNoAnswerEventPayload(_0x245f1d,_0x405140){var _0x5ad6db=buildObj(_0x245f1d,_0xf64b('0x7c'));if(!_['isEmpty'](_0x405140['variables'])){Object[_0xf64b('0x7d')](_0x405140[_0xf64b('0x7e')])[_0xf64b('0x7f')](function(_0x1f888a){_0x5ad6db[_0x1f888a[_0xf64b('0x80')]()]=_0x405140[_0xf64b('0x7e')][_0x1f888a];});}return _0x5ad6db;}exports[_0xf64b('0x81')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x1d94=['dialOriginateTimeout','format','dialQueueProject2','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','logBlacklist','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','getSeconds','starttime','logLookAgent','UserId','logCustomer','responsetime','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','channelAgent','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','minutes','ContactId','ListId','isNil','pTalking','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','CampaignId','type','campaigntype','dialAnswer','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','match','extractCalleridNumber','variables','keys','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','error','inspect','logger','loggerError','logger2','info','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','isActive','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId'];(function(_0x205c8c,_0x362535){var _0x2ce2fa=function(_0x3b6ce1){while(--_0x3b6ce1){_0x205c8c['push'](_0x205c8c['shift']());}};_0x2ce2fa(++_0x362535);}(_0x1d94,0xf7));var _0x41d9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1d94[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x41d9('0x0'));var _=require(_0x41d9('0x1'));var moment=require('moment');var logger=require(_0x41d9('0x2'))('preview');var ipAgi=process[_0x41d9('0x3')][_0x41d9('0x4')]||_0x41d9('0x5');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x1354a8){return function(_0x32fe96){logger[_0x41d9('0x6')](_0x1354a8,util[_0x41d9('0x7')](_0x32fe96,{'showHidden':![],'depth':null}));};};exports[_0x41d9('0x8')]=function(_0x1ae1c8,_0x2107f9){logger['info'](_0x1ae1c8,util[_0x41d9('0x7')](_0x2107f9,{'showHidden':![],'depth':null}));};exports[_0x41d9('0x9')]=function(_0x581c44,_0x2647f1){logger[_0x41d9('0x6')](_0x581c44,util[_0x41d9('0x7')](_0x2647f1,{'showHidden':![],'depth':null}));};exports[_0x41d9('0xa')]=function(_0x528e3f){return function(_0x5f4f36){logger[_0x41d9('0xb')](_0x528e3f,util[_0x41d9('0x7')](_0x5f4f36,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x46ab17,_0x4a9427,_0x3e12b2){return{'message':_0x46ab17,'unlock':_0x4a9427,'active':_0x3e12b2};};exports[_0x41d9('0xc')]=function(_0x47a7c4,_0x22d91d,_0x27863b){if(!_[_0x41d9('0xd')](_0x27863b)&&_0x41d9('0xe')===typeof _0x27863b&&!_[_0x41d9('0xf')](_0x27863b)){if(!_[_0x41d9('0xd')](_0x22d91d)&&_0x41d9('0xe')===typeof _0x22d91d&&!_[_0x41d9('0xf')](_0x22d91d)){return util['format']('\x22%s\x22\x20<%s>',_0x22d91d,_0x27863b);}return util['format'](_0x41d9('0x10'),_0x27863b,_0x27863b);}if(!_[_0x41d9('0xd')](_0x47a7c4)&&_0x41d9('0xe')===typeof _0x47a7c4&&!_[_0x41d9('0xf')](_0x47a7c4)){return _0x47a7c4;}return'\x22\x22\x20<>';};exports[_0x41d9('0x11')]=function(_0x3ac829){if(_['isNil'](_0x3ac829)){return![];}return _0x3ac829;};exports[_0x41d9('0x12')]=function(_0x5aeaa3,_0x2a19f0,_0x12cd56,_0x1335c1,_0x5daa4e,_0x41f194){var _0x1f1ef8={'XMD-QUEUE':_0x2a19f0[_0x41d9('0x13')]?_0x2a19f0[_0x41d9('0x13')][_0x41d9('0x14')]:'','XMD-CALLERID':_0x1335c1,'XMD-CALLERID-PREVIEW':_0x41f194?util['format'](_0x41d9('0x10'),_0x41f194[_0x41d9('0x15')],_0x41f194[_0x41d9('0x16')]):_0x1335c1,'XMD-DIALID':_0x5daa4e,'XMD-CONTACTID':_0x2a19f0['ContactId'],'XMD-CDRTYPE':_0x41d9('0x17'),'CALLERID(all)':_0x1335c1,'XMD-VOICEQUEUEID':_0x2a19f0[_0x41d9('0x18')],'XMD-DIALCHANNEL':_0x12cd56,'XMD-DIALTIMEOUT':_0x5aeaa3[_0x41d9('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x41d9('0x1a')]('\x22rtTxX%s%s\x22',_0x5aeaa3[_0x41d9('0x1b')]?'g':'',_[_0x41d9('0xf')](_0x5aeaa3['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5aeaa3[_0x41d9('0x1c')]||'','XMD-AGI':_0x5aeaa3['dialQueueProject']?util['format'](_0x41d9('0x1d'),ipAgi,_0x5aeaa3['dialQueueProject']):_0x41d9('0x1e'),'XMD-AGIAFTER':_0x5aeaa3[_0x41d9('0x1b')]?util[_0x41d9('0x1a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5aeaa3[_0x41d9('0x1b')]):_0x41d9('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x41f194?_0x41f194[_0x41d9('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x41f194?_0x41f194[_0x41d9('0x20')]:'','XMD-DESTINATION':_0x41d9('0x21'),'SIPADDHEADER':_0x41d9('0x22')};if(!_['isEmpty'](_0x5aeaa3[_0x41d9('0x23')])){_0x1f1ef8[util[_0x41d9('0x1a')]('%s',_0x41d9('0x24'))]=_0x5aeaa3[_0x41d9('0x23')];_0x1f1ef8[util[_0x41d9('0x1a')]('%s',_0x41d9('0x25'))]=_0x5daa4e;}return _0x1f1ef8;};exports[_0x41d9('0x26')]=function(_0x1b7bca){var _0x2a1da6={};for(var _0x785797 in _0x1b7bca){if(_0x1b7bca['hasOwnProperty'](_0x785797)){_0x2a1da6[util[_0x41d9('0x1a')]('%s',_[_0x41d9('0x27')](_0x785797))]=_0x1b7bca[_0x785797];}}return{'variables':_0x2a1da6};};exports[_0x41d9('0x28')]=function(_0xced892){var _0x3aff72=moment()[_0x41d9('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');_0xced892['state']=0xd;_0xced892['statedesc']='Blacklist';_0xced892['starttime']=_0x3aff72;_0xced892['responsetime']=_0x3aff72;_0xced892[_0x41d9('0x29')]=_0x3aff72;};exports[_0x41d9('0x2a')]=function(_0x3f2e33,_0x24a256,_0x3e4499){var _0x2502bc=moment()[_0x41d9('0x1a')](_0x41d9('0x2b'));_0x3f2e33[_0x41d9('0x2c')]=_0x24a256;_0x3f2e33[_0x41d9('0x2d')]=_0x3e4499;_0x3f2e33['responsetime']=_0x2502bc;_0x3f2e33['ringtime']=utils[_0x41d9('0x2e')](_0x3f2e33['responsetime'],_0x3f2e33[_0x41d9('0x2f')]);};exports[_0x41d9('0x30')]=function(_0x3f709a,_0x42d23d,_0x2d452a){_0x3f709a['membername']=_0x42d23d;_0x3f709a[_0x41d9('0x31')]=_0x2d452a;};exports[_0x41d9('0x32')]=function(_0x82993c,_0x3e2c11,_0x21242c){var _0x515f66=moment()[_0x41d9('0x1a')](_0x41d9('0x2b'));_0x82993c[_0x41d9('0x2c')]=_0x3e2c11;_0x82993c[_0x41d9('0x2d')]=_0x21242c;_0x82993c['responsetime']=_0x82993c[_0x41d9('0x33')]?_0x82993c[_0x41d9('0x33')]:_0x515f66;_0x82993c['endtime']=_0x82993c[_0x41d9('0x29')]?_0x82993c[_0x41d9('0x29')]:_0x515f66;_0x82993c[_0x41d9('0x34')]=utils[_0x41d9('0x2e')](_0x82993c[_0x41d9('0x33')]||0x0,_0x82993c[_0x41d9('0x2f')]||0x0);_0x82993c[_0x41d9('0x35')]=_0x82993c['answertime']?utils[_0x41d9('0x2e')](_0x82993c[_0x41d9('0x29')],_0x82993c[_0x41d9('0x36')]):0x0;};exports[_0x41d9('0x37')]=function(_0x28ad55){return _0x28ad55===_0x41d9('0x38');};exports[_0x41d9('0x39')]=function(_0x12b7a0,_0x5e5031,_0x15b0ee,_0x51c77c,_0x2a7828){var _0x39bb6e=_0x51c77c?_0x41d9('0x3a'):_0x12b7a0[_0x41d9('0x15')];_0x39bb6e=_0x2a7828?'BOOKED':_0x39bb6e;return{'actionid':_0x12b7a0[_0x41d9('0x3b')],'action':'originate','channel':_0x12b7a0[_0x41d9('0x3c')],'callerid':util[_0x41d9('0x1a')](_0x41d9('0x10'),_0x39bb6e,_0x12b7a0[_0x41d9('0x16')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x15b0ee,'timeout':(_0x5e5031[_0x41d9('0x3d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x12b7a0[_0x41d9('0x3b')]};};exports['totalGlobal']=function(_0x3c9ec7){return _0x3c9ec7[_0x41d9('0x3e')]+_0x3c9ec7[_0x41d9('0x3f')]+_0x3c9ec7[_0x41d9('0x40')]+_0x3c9ec7['countagentrejectretry']+_0x3c9ec7[_0x41d9('0x41')];};exports[_0x41d9('0x42')]=function(_0x377776){var _0x347466=_[_0x41d9('0x43')](_0x377776);_0x347466['state']=0xf;_0x347466['statedesc']=_0x41d9('0x44');return _0x347466;};exports['scheduledAt']=function(_0x16053f,_0x3ab60a,_0x1ccf3a){var _0x47a53e={};_0x47a53e[_0x3ab60a]=_0x16053f[_0x3ab60a];_0x47a53e[_0x41d9('0x45')]=![];_0x47a53e['scheduledat']=moment()[_0x41d9('0x46')](_0x1ccf3a,_0x41d9('0x47'))[_0x41d9('0x1a')](_0x41d9('0x2b'));_0x47a53e[_0x41d9('0x48')]=_0x16053f[_0x41d9('0x48')];_0x47a53e[_0x41d9('0x49')]=_0x16053f[_0x41d9('0x49')];_0x47a53e[_0x41d9('0x18')]=_0x16053f['VoiceQueueId']||undefined;return _0x47a53e;};exports['decrementTalking']=function(_0x492e56,_0x278213){if(!_[_0x41d9('0x4a')](_0x492e56)){if(_0x492e56['pTalking']>0x0){_0x492e56[_0x41d9('0x4b')]-=0x1;}else{logger[_0x41d9('0xb')](_0x278213,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x41d9('0x6')](_0x278213,_0x41d9('0x4c'));}};exports[_0x41d9('0x4d')]=function(_0xb76c29){if(_0xb76c29<=0x0){return!![];}return![];};function buildObj(_0x26dacc,_0x5581f3,_0x34d582){_0x26dacc[_0x41d9('0x4e')]=_0x5581f3;_0x26dacc['name']=_0x26dacc[_0x41d9('0x4f')];_0x26dacc[_0x41d9('0x50')]=_0x26dacc['channelAgent'];_0x26dacc[_0x41d9('0x51')]=_0x41d9('0x52');if(_0x34d582){_0x26dacc[_0x41d9('0x53')]=_0x34d582[_0x41d9('0x53')];}return _0x26dacc;}exports[_0x41d9('0x54')]=buildObj;exports[_0x41d9('0x55')]=function(_0x23a7a9){var _0x161633=[];for(var _0x48d462 in _0x23a7a9){if(_0x23a7a9[_0x41d9('0x56')](_0x48d462)){if(!_[_0x41d9('0x4a')](_0x23a7a9[_0x48d462])&&_0x23a7a9[_0x48d462]['state']===_0x41d9('0x57')&&_0x23a7a9[_0x48d462][_0x41d9('0x58')]===_0x41d9('0x59')){_0x161633[_0x41d9('0x5a')](_0x23a7a9[_0x48d462]['id']);}}}return _0x161633;};exports[_0x41d9('0x5b')]=function(_0x509218){var _0x44692d=moment()[_0x41d9('0x5c')](0x0);var _0x2481e9=moment(_0x509218)[_0x41d9('0x5c')](0x0);return _0x44692d[_0x41d9('0x5d')](_0x2481e9,_0x41d9('0x5e'));};exports['createBody']=function(_0x5c0643){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c0643[_0x41d9('0x48')],'ListId':_0x5c0643[_0x41d9('0x49')],'VoiceQueueId':_0x5c0643['VoiceQueueId']||undefined,'CampaignId':_0x5c0643[_0x41d9('0x5f')]||undefined};};exports['filterKey']=function(_0x2d4b38){if(_0x2d4b38==='uniqueid'||_0x2d4b38==='idContact'||_0x2d4b38===_0x41d9('0x4f')||_0x2d4b38===_0x41d9('0x60')||_0x2d4b38===_0x41d9('0x61')||_0x2d4b38===_0x41d9('0x62')||_0x2d4b38===_0x41d9('0x63')||_0x2d4b38==='channelAgent'||_0x2d4b38===_0x41d9('0x15')||_0x2d4b38==='active'||_0x2d4b38==='calleridnum'||_0x2d4b38==='scheduledat'||_0x2d4b38===_0x41d9('0x3e')||_0x2d4b38==='countcongestionretry'||_0x2d4b38===_0x41d9('0x40')||_0x2d4b38===_0x41d9('0x64')||_0x2d4b38===_0x41d9('0x65')||_0x2d4b38===_0x41d9('0x66')||_0x2d4b38===_0x41d9('0x67')||_0x2d4b38===_0x41d9('0x68')||_0x2d4b38===_0x41d9('0x48')||_0x2d4b38===_0x41d9('0x49')||_0x2d4b38===_0x41d9('0x31')||_0x2d4b38===_0x41d9('0x18')||_0x2d4b38===_0x41d9('0x69')||_0x2d4b38===_0x41d9('0x6a')||_0x2d4b38==='xmd-queue'||_0x2d4b38===_0x41d9('0x6b')||_0x2d4b38===_0x41d9('0x6c')||_0x2d4b38===_0x41d9('0x6d')||_0x2d4b38===_0x41d9('0x6e')||_0x2d4b38===_0x41d9('0x6f')||_0x2d4b38===_0x41d9('0x70')||_0x2d4b38==='xmd-dialchannel'||_0x2d4b38===_0x41d9('0x71')||_0x2d4b38===_0x41d9('0x72')||_0x2d4b38==='xmd-callerid'||_0x2d4b38===_0x41d9('0x73')||_0x2d4b38===_0x41d9('0x74')||_0x2d4b38===_0x41d9('0x75')||_0x2d4b38===_0x41d9('0x76')||_0x2d4b38==='rtpaudioqosjitter'||_0x2d4b38===_0x41d9('0x77')||_0x2d4b38===_0x41d9('0x78')||_0x2d4b38==='rtpaudioqoslossbridged'||_0x2d4b38===_0x41d9('0x79')||_0x2d4b38===_0x41d9('0x7a')||_0x2d4b38===_0x41d9('0x75')||_0x2d4b38===_0x41d9('0x76')||_0x2d4b38===_0x41d9('0x7b')||_0x2d4b38==='rtpaudioqosjitterbridged'||_0x2d4b38===_0x41d9('0x78')||_0x2d4b38===_0x41d9('0x7c')||_0x2d4b38===_0x41d9('0x79')||_0x2d4b38===_0x41d9('0x7a')||_0x2d4b38===_0x41d9('0x7d')||_0x2d4b38===_0x41d9('0x7e')||_0x2d4b38==='state'||_0x2d4b38===_0x41d9('0x2d')){return![];}return!![];};exports[_0x41d9('0x7f')]=function(_0x5cb0d6,_0x366886){var _0x1fb6d2,_0x458f6b,_0x304f61;if(_0x366886<=0x0){_0x366886=0x1;}_0x1fb6d2=new RegExp(_0x41d9('0x80')+_0x366886+'}$');_0x458f6b=Math[_0x41d9('0x81')](0xa,_0x366886-0x1);_0x304f61=Math[_0x41d9('0x81')](0xa,_0x366886)-0x1;return util['format']('%s',_['replace'](_0x5cb0d6,_0x1fb6d2,_[_0x41d9('0x82')](_0x458f6b,_0x304f61)));};exports['extractCalleridName']=function(_0x3bfa2a){var _0x12cca1=_0x3bfa2a[_0x41d9('0x83')](/"(.*?)"/);return _0x12cca1?_0x12cca1[0x1]:_0x3bfa2a;};exports[_0x41d9('0x84')]=function(_0x40a5aa){var _0x392295=_0x40a5aa[_0x41d9('0x83')](/<(.*?)>/);return _0x392295?_0x392295[0x1]:_0x40a5aa;};function buildNoAnswerEventPayload(_0x46a3b7,_0x510d16){var _0x46348b=buildObj(_0x46a3b7,'noanswer');if(!_[_0x41d9('0xf')](_0x510d16[_0x41d9('0x85')])){Object[_0x41d9('0x86')](_0x510d16[_0x41d9('0x85')])['forEach'](function(_0xb94af){_0x46348b[_0xb94af['toLowerCase']()]=_0x510d16[_0x41d9('0x85')][_0xb94af];});}return _0x46348b;}exports[_0x41d9('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 5303654..ca688d6 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 _0x2d45=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0x2d45,0x170));var _0x52d4=function(_0x832f17,_0x19d302){_0x832f17=_0x832f17-0x0;var _0x59ef13=_0x2d45[_0x832f17];return _0x59ef13;};'use strict';exports[_0x52d4('0x0')]={'queue':{'type':_0x52d4('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x52d4('0x1'),'required':!![]},'penalty':{'type':_0x52d4('0x2'),'required':![]},'paused':{'type':_0x52d4('0x3'),'required':![]}};exports[_0x52d4('0x4')]={'queue':{'type':_0x52d4('0x1'),'required':!![]},'interface':{'type':_0x52d4('0x1'),'required':!![]}};exports[_0x52d4('0x5')]={'interface':{'type':_0x52d4('0x1'),'required':!![]},'paused':{'type':_0x52d4('0x3')},'reason':{'type':_0x52d4('0x1'),'required':![]}};exports[_0x52d4('0x6')]={'module':{'type':_0x52d4('0x1'),'required':![]}};exports[_0x52d4('0x7')]={'uniqueid':{'type':_0x52d4('0x1'),'required':!![]}};exports[_0x52d4('0x8')]={'uniqueid':{'type':_0x52d4('0x1'),'required':!![]},'filename':{'type':_0x52d4('0x1')},'format':{'type':_0x52d4('0x1')},'mixmonitorid':{'type':_0x52d4('0x1')}};exports[_0x52d4('0x9')]={'uniqueid':{'type':_0x52d4('0x1'),'required':!![]}};exports[_0x52d4('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x52d4('0x1'),'required':!![]},'context':{'type':_0x52d4('0x1')}}; \ No newline at end of file +var _0xec2a=['string','number','boolean','queueremove','queuepause','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x55d19f,_0x3e34cf){var _0x34c2d3=function(_0x26606c){while(--_0x26606c){_0x55d19f['push'](_0x55d19f['shift']());}};_0x34c2d3(++_0x3e34cf);}(_0xec2a,0x77));var _0xaec2=function(_0x8e1e89,_0x396be9){_0x8e1e89=_0x8e1e89-0x0;var _0x411cbd=_0xec2a[_0x8e1e89];return _0x411cbd;};'use strict';exports[_0xaec2('0x0')]={'queue':{'type':_0xaec2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xaec2('0x1'),'required':!![]},'penalty':{'type':_0xaec2('0x2'),'required':![]},'paused':{'type':_0xaec2('0x3'),'required':![]}};exports[_0xaec2('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xaec2('0x1'),'required':!![]}};exports[_0xaec2('0x5')]={'interface':{'type':_0xaec2('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0xaec2('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xaec2('0x1'),'required':!![]}};exports[_0xaec2('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xaec2('0x1')},'format':{'type':_0xaec2('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xaec2('0x7')]={'uniqueid':{'type':_0xaec2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xaec2('0x1'),'required':!![]},'exten':{'type':_0xaec2('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1f6f6dd..1cd721b 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 _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x5b5fc9,_0x1aa61a){var _0x26f48f=function(_0x13c44f){while(--_0x13c44f){_0x5b5fc9['push'](_0x5b5fc9['shift']());}};_0x26f48f(++_0x1aa61a);}(_0xdb28,0x106));var _0x8db2=function(_0x5ae700,_0x1cd241){_0x5ae700=_0x5ae700-0x0;var _0x1355c2=_0xdb28[_0x5ae700];return _0x1355c2;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0x212448,_0x5be95f){var _0x2ecc15=function(_0x25079e){while(--_0x25079e){_0x212448['push'](_0x212448['shift']());}};_0x2ecc15(++_0x5be95f);}(_0x757a,0xde));var _0xa757=function(_0x12a51a,_0x165de8){_0x12a51a=_0x12a51a-0x0;var _0x3190a2=_0x757a[_0x12a51a];return _0x3190a2;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 498ef7c..a4ece6e 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 _0xfef2=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfef2,0x10b));var _0x2fef=function(_0x137815,_0x78dd4b){_0x137815=_0x137815-0x0;var _0x29ded1=_0xfef2[_0x137815];return _0x29ded1;};'use strict';function mergeDBDataToRealtime(_0x7ea8cb,_0x12984b){var _0x12b7d6=Object[_0x2fef('0x0')]({},_0x7ea8cb);for(var _0x5ccd30 in _0x12984b){if(_0x12b7d6[_0x2fef('0x1')](_0x5ccd30)){_0x12b7d6[_0x5ccd30]=_0x12984b[_0x5ccd30];}}return _0x12b7d6;}exports[_0x2fef('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x86f7=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x3756d7,_0x5c9e2b){var _0x1b18a2=function(_0xa26048){while(--_0xa26048){_0x3756d7['push'](_0x3756d7['shift']());}};_0x1b18a2(++_0x5c9e2b);}(_0x86f7,0x148));var _0x786f=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x86f7[_0x5f3f88];return _0xd08119;};'use strict';function mergeDBDataToRealtime(_0xe6eb,_0x561b5f){var _0x482229=Object[_0x786f('0x0')]({},_0xe6eb);for(var _0x59929a in _0x561b5f){if(_0x482229[_0x786f('0x1')](_0x59929a)){_0x482229[_0x59929a]=_0x561b5f[_0x59929a];}}return _0x482229;}exports[_0x786f('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index a37c391..8b19bd7 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 _0xff5c=['disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','name','isNil','interface','format','SIP/%s','length','connectedlinenum','accountcode','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','split','calleridnum','outbound','internal','destination','type','lastapplication','queue','from-voip-provider','callerid','context','from-sip','calleridpreview','channel','destinationchannel','originatecalleridnum','disposition','ANSWERED','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','UserId','membername','monitorFilename','createdAt','monitors','exten','xcally-motion-preview','connectedlinename','forEach','startsWith','Local','substring','indexOf','lastIndexOf','voiceDialReport','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr'];(function(_0x41b846,_0x11cc08){var _0x64d7a2=function(_0x1ba074){while(--_0x1ba074){_0x41b846['push'](_0x41b846['shift']());}};_0x64d7a2(++_0x11cc08);}(_0xff5c,0x15f));var _0xcff5=function(_0x545356,_0x5e3cde){_0x545356=_0x545356-0x0;var _0x58958b=_0xff5c[_0x545356];return _0x58958b;};'use strict';var _=require(_0xcff5('0x0'));var moment=require(_0xcff5('0x1'));var util=require(_0xcff5('0x2'));var config=require(_0xcff5('0x3'));var ami=require(_0xcff5('0x4'));var RpcVoiceAgentReport=require(_0xcff5('0x5'));var RpcVoiceCallReport=require(_0xcff5('0x6'));var RpcVoiceDialReport=require(_0xcff5('0x7'));var RpcMemberReport=require(_0xcff5('0x8'));var RpcVoiceQueueReport=require(_0xcff5('0x9'));var RpcVoiceRecording=require(_0xcff5('0xa'));var RpcVoiceTransferReport=require(_0xcff5('0xb'));var VoiceQueueReport=require(_0xcff5('0xc'));var VoiceCallReport=require(_0xcff5('0xd'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xcff5('0xe'));var UserReport=require(_0xcff5('0xf'));function Report(_0xaf803c){this[_0xcff5('0x10')]=_0xaf803c;this[_0xcff5('0x11')]=_0xaf803c['agents'];this[_0xcff5('0x12')]=_0xaf803c['telephones'];}Report['prototype'][_0xcff5('0x13')]=function(_0x1fc3a4){var _0x15b916=new VoiceQueueReport(this['realtime']);var _0x5809e4=new VoiceAgentReport(this[_0xcff5('0x10')]);var _0x236754=new VoiceDialReport(this[_0xcff5('0x10')]);var _0x278ed4=new VoiceCallReport(this[_0xcff5('0x10')]);var _0x46ec2d=new UserReport(this['realtime']);if(config[_0xcff5('0x14')]&&config[_0xcff5('0x14')][_0xcff5('0x15')]){ami['on'](_0xcff5('0x16'),this[_0xcff5('0x17')][_0xcff5('0x18')](this));ami['on'](_0xcff5('0x19'),this[_0xcff5('0x1a')][_0xcff5('0x18')](this));ami['on']('custom:voiceAgentReport',this[_0xcff5('0x1b')][_0xcff5('0x18')](this));ami['on'](_0xcff5('0x1c'),this['voiceDialReport'][_0xcff5('0x18')](this));ami['on'](_0xcff5('0x1d'),this[_0xcff5('0x1e')][_0xcff5('0x18')](this));ami['on'](_0xcff5('0x1f'),this[_0xcff5('0x20')][_0xcff5('0x18')](this));}};Report[_0xcff5('0x21')][_0xcff5('0x22')]=function(_0x321cfb){var _0x3a0faa;_0x3a0faa=_[_0xcff5('0x23')](this['agents'],function(_0x50de19){return _0x50de19['accountcode']==_0x321cfb||_0x50de19[_0xcff5('0x24')]==_0x321cfb;});if(_[_0xcff5('0x25')](_0x3a0faa)){var _0x1bb5b9=_['find'](this[_0xcff5('0x12')],function(_0x4795f8){return _0x4795f8['accountcode']==_0x321cfb||_0x4795f8[_0xcff5('0x24')]==_0x321cfb;});if(_0x1bb5b9){_0x3a0faa=_['find'](this[_0xcff5('0x11')],function(_0x1fedfa){return _0x1fedfa[_0xcff5('0x26')]==util[_0xcff5('0x27')](_0xcff5('0x28'),_0x1bb5b9[_0xcff5('0x24')]);});}}return _0x3a0faa;};Report[_0xcff5('0x21')][_0xcff5('0x17')]=function(_0x3de238){for(var _0x463b63=0x0;_0x463b63<_0x3de238[_0xcff5('0x29')];_0x463b63+=0x1){var _0xc96e80=this[_0xcff5('0x22')](_0x3de238[_0x463b63][_0xcff5('0x2a')]);if(_0xc96e80){_0x3de238[_0x463b63]['accountcode']=_0xc96e80[_0xcff5('0x2b')];_0x3de238[_0x463b63][_0xcff5('0x2c')]=!![];_0x3de238[_0x463b63][_0xcff5('0x2d')]=_0xc96e80[_0xcff5('0x24')];_0x3de238[_0x463b63][_0xcff5('0x26')]=_[_0xcff5('0x25')](_0xc96e80['interface'])?util[_0xcff5('0x27')](_0xcff5('0x28'),_0xc96e80[_0xcff5('0x24')]):_0xc96e80[_0xcff5('0x26')];if(_0x3de238[_0x463b63][_0xcff5('0x2e')]){_0x3de238[_0x463b63][_0xcff5('0x2f')]=moment()[_0xcff5('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3de238[_0x463b63][_0xcff5('0x30')]){_0x3de238[_0x463b63][_0xcff5('0x31')]=moment()['format'](_0xcff5('0x32'));}RpcMemberReport['voiceQueueReport'](_0x3de238[_0x463b63]);}RpcVoiceQueueReport[_0xcff5('0x33')](_0x3de238[_0x463b63]);}};function extractCalleridNumber(_0x30986e){var _0x2d146d=_0x30986e[_0xcff5('0x34')](/<(.*?)>/);return _0x2d146d?_0x2d146d[0x1]:_0x30986e;}Report['prototype'][_0xcff5('0x35')]=function(_0x90020a){for(var _0x2e63fd=0x0;_0x2e63fd',_0x247445[_0xcff5('0x48')],_0x247445[_0xcff5('0x37')]);}if(RpcVoiceTransferReport['transfers'][_0x247445[_0xcff5('0x49')]]){var _0xd0454b=RpcVoiceTransferReport[_0xcff5('0x4a')][_0x247445[_0xcff5('0x49')]];_0xd0454b[_0xcff5('0x4b')]=_0x247445[_0xcff5('0x4c')];RpcVoiceTransferReport[_0xcff5('0x1e')](_0xd0454b);delete RpcVoiceTransferReport['transfers'][_0x247445[_0xcff5('0x49')]];}if(_[_0xcff5('0x25')](_0x247445[_0xcff5('0x3b')])){_0x247445[_0xcff5('0x3b')]=this['getCallType'](_0x247445);}if(_[_0xcff5('0x25')](_0x247445['UserId'])){var _0x5f0593=_0x247445[_0xcff5('0x43')][_0xcff5('0x36')]('-')[0x0];var _0x48067a=this['agents'][_0x5f0593];if(!_0x48067a)_0x48067a=this[_0xcff5('0x35')](_0x247445[_0xcff5('0x2b')]);if(_0x48067a){_0x247445[_0xcff5('0x4d')]=_0x48067a['id'];_0x247445[_0xcff5('0x4e')]=_0x48067a[_0xcff5('0x24')];}}RpcVoiceCallReport['create'](_0x247445);if(_0x247445['monitor']){for(var _0x2be482=0x0;_0x2be482<_0x247445['monitors'][_0xcff5('0x29')];_0x2be482+=0x1){_0x247445[_0xcff5('0x4f')]=_0x247445['monitors'][_0x2be482]['filename'];_0x247445[_0xcff5('0x50')]=_0x247445[_0xcff5('0x51')][_0x2be482]['createdAt'];if(_0x247445[_0xcff5('0x52')]==_0xcff5('0x53')){_0x247445[_0xcff5('0x37')]=_0x247445[_0xcff5('0x2a')];_0x247445['calleridname']=_0x247445['connectedlinename'];_0x247445['connectedlinenum']=_0x247445[_0xcff5('0x2b')];_0x247445[_0xcff5('0x54')]=_0x247445[_0xcff5('0x4e')];_0x247445[_0xcff5('0x52')]=_0x247445[_0xcff5('0x45')];}else if(_0x247445[_0xcff5('0x52')]=='xcally-motion-dialer'){_0x247445[_0xcff5('0x37')]=_0x247445['destination'];_0x247445['exten']=_0x247445[_0xcff5('0x45')];}RpcVoiceRecording['create'](_0x247445);}}};Report['prototype'][_0xcff5('0x1b')]=function(_0x12fdcc){if(_['isArray'](_0x12fdcc)){_0x12fdcc[_0xcff5('0x55')](function(_0x21babb){RpcVoiceAgentReport[_0xcff5('0x33')](_0x21babb);});}else{RpcVoiceAgentReport[_0xcff5('0x33')](_0x12fdcc);}};Report[_0xcff5('0x21')]['voiceDialReport']=function(_0x3a17a4){RpcVoiceDialReport[_0xcff5('0x33')](_0x3a17a4);var _0x4dbe6c;var _0x5e67ab;var _0x20dbb8=_0x3a17a4['channel'];if(_[_0xcff5('0x56')](_0x20dbb8,_0xcff5('0x57'))){_0x5e67ab=_0x20dbb8[_0xcff5('0x58')](_0x20dbb8['indexOf']('/')+0x1,_0x20dbb8[_0xcff5('0x59')]('@'));_0x4dbe6c=_['find'](this['agents'],function(_0x4646e8){return _0x4646e8['mobile']==_0x5e67ab||_0x4646e8['phone']==_0x5e67ab||_0x4646e8[_0xcff5('0x2b')]==_0x5e67ab;});}else{_0x5e67ab=_0x20dbb8[_0xcff5('0x58')](_0x20dbb8[_0xcff5('0x59')]('/')+0x1,_0x20dbb8[_0xcff5('0x5a')]('-'));_0x4dbe6c=this[_0xcff5('0x22')](_0x5e67ab);}if(_0x4dbe6c){_0x3a17a4[_0xcff5('0x26')]=_[_0xcff5('0x25')](_0x4dbe6c['interface'])?util['format'](_0xcff5('0x28'),_0x4dbe6c[_0xcff5('0x24')]):_0x4dbe6c['interface'];_0x3a17a4['membername']=_0x4dbe6c[_0xcff5('0x24')];_0x3a17a4[_0xcff5('0x2b')]=_0x4dbe6c[_0xcff5('0x2b')];RpcMemberReport[_0xcff5('0x5b')](_0x3a17a4);}};Report['prototype'][_0xcff5('0x1e')]=function(_0x4175f2){RpcVoiceTransferReport[_0xcff5('0x4a')][_0x4175f2[_0xcff5('0x5c')]]=_0x4175f2;};Report[_0xcff5('0x21')][_0xcff5('0x20')]=function(_0x475026){RpcVoiceTransferReport[_0xcff5('0x20')](_0x475026);};module['exports']=Report; \ No newline at end of file +var _0x49a7=['internal','destination','exten','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','type','UserId','membername','monitor','monitorFilename','monitors','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound'];(function(_0x1ba865,_0x110d26){var _0x35a964=function(_0x221267){while(--_0x221267){_0x1ba865['push'](_0x1ba865['shift']());}};_0x35a964(++_0x110d26);}(_0x49a7,0x82));var _0x749a=function(_0x1354f6,_0x29aee6){_0x1354f6=_0x1354f6-0x0;var _0x5cb683=_0x49a7[_0x1354f6];return _0x5cb683;};'use strict';var _=require(_0x749a('0x0'));var moment=require(_0x749a('0x1'));var util=require(_0x749a('0x2'));var config=require('../../../config/environment');var ami=require(_0x749a('0x3'));var RpcVoiceAgentReport=require(_0x749a('0x4'));var RpcVoiceCallReport=require(_0x749a('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x749a('0x6'));var RpcVoiceQueueReport=require(_0x749a('0x7'));var RpcVoiceRecording=require(_0x749a('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x749a('0x9'));var VoiceDialReport=require(_0x749a('0xa'));var UserReport=require('./userReport');function Report(_0x6cd4f){this[_0x749a('0xb')]=_0x6cd4f;this[_0x749a('0xc')]=_0x6cd4f[_0x749a('0xc')];this[_0x749a('0xd')]=_0x6cd4f[_0x749a('0xd')];}Report[_0x749a('0xe')]['sync']=function(_0xb3ab8c){var _0x101cc5=new VoiceQueueReport(this[_0x749a('0xb')]);var _0x353a58=new VoiceAgentReport(this['realtime']);var _0x4905d9=new VoiceDialReport(this['realtime']);var _0x205b86=new VoiceCallReport(this[_0x749a('0xb')]);var _0xe1dcda=new UserReport(this[_0x749a('0xb')]);if(config[_0x749a('0xf')]&&config[_0x749a('0xf')]['disabled']){ami['on'](_0x749a('0x10'),this[_0x749a('0x11')][_0x749a('0x12')](this));ami['on'](_0x749a('0x13'),this[_0x749a('0x14')][_0x749a('0x12')](this));ami['on'](_0x749a('0x15'),this[_0x749a('0x16')][_0x749a('0x12')](this));ami['on'](_0x749a('0x17'),this['voiceDialReport']['bind'](this));ami['on'](_0x749a('0x18'),this[_0x749a('0x19')][_0x749a('0x12')](this));ami['on']('attendedtransfer',this[_0x749a('0x1a')][_0x749a('0x12')](this));}};Report[_0x749a('0xe')][_0x749a('0x1b')]=function(_0x49d8c0){var _0x339897;_0x339897=_[_0x749a('0x1c')](this['agents'],function(_0x56fe31){return _0x56fe31[_0x749a('0x1d')]==_0x49d8c0||_0x56fe31[_0x749a('0x1e')]==_0x49d8c0;});if(_[_0x749a('0x1f')](_0x339897)){var _0x4e4349=_[_0x749a('0x1c')](this['telephones'],function(_0x1a415a){return _0x1a415a[_0x749a('0x1d')]==_0x49d8c0||_0x1a415a['name']==_0x49d8c0;});if(_0x4e4349){_0x339897=_['find'](this[_0x749a('0xc')],function(_0x561ad1){return _0x561ad1[_0x749a('0x20')]==util[_0x749a('0x21')](_0x749a('0x22'),_0x4e4349[_0x749a('0x1e')]);});}}return _0x339897;};Report[_0x749a('0xe')][_0x749a('0x11')]=function(_0x4e77d1){for(var _0x6e43a1=0x0;_0x6e43a1<_0x4e77d1[_0x749a('0x23')];_0x6e43a1+=0x1){var _0x1c1ff7=this['findAgent'](_0x4e77d1[_0x6e43a1][_0x749a('0x24')]);if(_0x1c1ff7){_0x4e77d1[_0x6e43a1]['accountcode']=_0x1c1ff7[_0x749a('0x1d')];_0x4e77d1[_0x6e43a1]['assigned']=!![];_0x4e77d1[_0x6e43a1][_0x749a('0x25')]=_0x1c1ff7[_0x749a('0x1e')];_0x4e77d1[_0x6e43a1][_0x749a('0x20')]=_[_0x749a('0x1f')](_0x1c1ff7[_0x749a('0x20')])?util[_0x749a('0x21')]('SIP/%s',_0x1c1ff7[_0x749a('0x1e')]):_0x1c1ff7[_0x749a('0x20')];if(_0x4e77d1[_0x6e43a1]['queuecallercomplete']){_0x4e77d1[_0x6e43a1][_0x749a('0x26')]=moment()[_0x749a('0x21')](_0x749a('0x27'));}if(_0x4e77d1[_0x6e43a1]['queuecallerexit']){_0x4e77d1[_0x6e43a1][_0x749a('0x28')]=moment()[_0x749a('0x21')](_0x749a('0x27'));}RpcMemberReport['voiceQueueReport'](_0x4e77d1[_0x6e43a1]);}RpcVoiceQueueReport[_0x749a('0x29')](_0x4e77d1[_0x6e43a1]);}};function extractCalleridNumber(_0x3f12d4){var _0x5b0f9d=_0x3f12d4[_0x749a('0x2a')](/<(.*?)>/);return _0x5b0f9d?_0x5b0f9d[0x1]:_0x3f12d4;}Report[_0x749a('0xe')][_0x749a('0x2b')]=function(_0x25d84e){for(var _0x5e4a9e=0x0;_0x5e4a9e{delete this[_0x53c8('0x9')][_0x261078];},_0x1bcc64);}};module[_0x53c8('0x9f')]=VoiceAgentReport; \ No newline at end of file +var _0x551b=['[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','destconnectedlinenum','name','accountcode','custom:agentconnect','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','isUndefined','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','seconds','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','prototype','emit','isNotNull','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','channels','interface','destuniqueid','voiceQueues','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','error'];(function(_0x4baa7c,_0x336990){var _0x364957=function(_0x150de0){while(--_0x150de0){_0x4baa7c['push'](_0x4baa7c['shift']());}};_0x364957(++_0x336990);}(_0x551b,0x66));var _0xb551=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x551b[_0x2d2ca2];return _0x48489d;};'use strict';var _=require('lodash');var moment=require(_0xb551('0x0'));var util=require(_0xb551('0x1'));var Redis=require(_0xb551('0x2'));var config=require(_0xb551('0x3'));var logger=require(_0xb551('0x4'))(_0xb551('0x5'));var ami=require('../ami');config[_0xb551('0x6')]=_[_0xb551('0x7')](config[_0xb551('0x6')],{'host':_0xb551('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x91740a){this['channels']={};this['voiceChannels']=_0x91740a['channels'];this['voiceQueues']=_0x91740a['voiceQueues'];this['agents']=_0x91740a[_0xb551('0x9')];this[_0xb551('0xa')]={};ami['on'](_0xb551('0xb'),this['syncAgentCalled'][_0xb551('0xc')](this));ami['on'](_0xb551('0xd'),this[_0xb551('0xe')]['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb551('0xf'),this[_0xb551('0x10')][_0xb551('0xc')](this));ami['on'](_0xb551('0x11'),this[_0xb551('0x12')][_0xb551('0xc')](this));ami['on'](_0xb551('0x13'),this['syncVarSet']['bind'](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xb551('0x14'),this[_0xb551('0x15')][_0xb551('0xc')](this));ami['on'](_0xb551('0x16'),this[_0xb551('0x17')][_0xb551('0xc')](this));ami['on'](_0xb551('0x18'),this[_0xb551('0x19')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));}VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x1b')]=function(_0x10c597,_0x5ed8f4,_0x45a3e7){io['to'](_0x10c597)[_0xb551('0x1b')](_0x5ed8f4,_0x45a3e7);};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x1c')]=function(_0xe48ecb){return _0xe48ecb!==null&&!_['isUndefined'](_0xe48ecb);};VoiceAgentReport['prototype'][_0xb551('0x1d')]=function(_0x4093fd){try{if(this[_0xb551('0x1c')](_0x4093fd)){logger[_0xb551('0x1e')](_0xb551('0x1f'),_0x4093fd['uniqueid'],_0x4093fd[_0xb551('0x20')],_0x4093fd['destuniqueid']);logger['debug'](_0xb551('0x21'),_0x4093fd[_0xb551('0x22')],util['inspect'](_0x4093fd,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xb551('0x23')][_0x4093fd['uniqueid']])){this['channels'][_0x4093fd[_0xb551('0x22')]]={};}var _0x1cc958=this[_0xb551('0x9')][_0x4093fd[_0xb551('0x24')]];var _0x4b04d8=this['channels'][_0x4093fd[_0xb551('0x22')]][_0x4093fd[_0xb551('0x25')]];var _0x3b7b84=this[_0xb551('0x26')][_0x4093fd[_0xb551('0x27')]];var _0x118938=this[_0xb551('0xa')][_0x4093fd[_0xb551('0x22')]];if(_['isUndefined'](_0x4b04d8)){_0x4b04d8={'agentcalledAt':moment()[_0xb551('0x28')](_0xb551('0x29')),'lastevent':_0xb551('0x2a'),'mandatoryDisposition':_0x3b7b84&&_0x3b7b84['mandatoryDisposition']?_0x3b7b84[_0xb551('0x2b')]:![],'type':_0x3b7b84&&_0x3b7b84[_0xb551('0x2c')]?_0x3b7b84[_0xb551('0x2c')]:_0xb551('0x2d'),'variables':_0x118938,'motionChannel':_0xb551('0x2e')};}Object[_0xb551('0x2f')](_0x4b04d8,_[_0xb551('0x30')](_0x4093fd,[_0xb551('0x31'),_0xb551('0x32')]));this[_0xb551('0x23')][_0x4093fd['uniqueid']][_0x4093fd['destuniqueid']]=_0x4b04d8;logger[_0xb551('0x33')](_0xb551('0x34'),_0x4093fd[_0xb551('0x22')],util[_0xb551('0x35')](_0x4b04d8,{'showHidden':![],'depth':null}));ami['emit'](_0xb551('0x36'),_0x4b04d8);var _0xde3b7a={'id':_0x1cc958['id'],'calleridnum':_0x4b04d8['calleridnum'],'queue':_0x4b04d8[_0xb551('0x27')],'variables':_0x4b04d8[_0xb551('0xa')],'uniqueid':_0x4093fd[_0xb551('0x22')]};logger[_0xb551('0x33')](_0xb551('0x37'),_0x4093fd['uniqueid'],util['inspect'](_0xde3b7a,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xb551('0x38'),_0x4093fd[_0xb551('0x20')]),'user:called',_0xde3b7a);}}catch(_0x2cdf00){logger[_0xb551('0x39')](_0xb551('0x3a'),_0x4093fd[_0xb551('0x22')],util[_0xb551('0x35')](_0x2cdf00,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0xe')]=function(_0x104380){try{if(this[_0xb551('0x1c')](_0x104380)){if(this['channels'][_0x104380[_0xb551('0x22')]]){for(var _0x4b7e23 in this[_0xb551('0x23')][_0x104380['uniqueid']]){if(this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0xb551('0x3b')](_0x4b7e23)){if(_0x104380['destuniqueid']===_0x4b7e23){logger[_0xb551('0x1e')](_0xb551('0x3c'),_0x104380['uniqueid'],_0x104380[_0xb551('0x20')],_0x104380['destuniqueid']);this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x3d')]=moment()[_0xb551('0x28')](_0xb551('0x29'));this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x3e')]=_0x104380[_0xb551('0x3e')];this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x3f')]=_0x104380[_0xb551('0x3f')];this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23]['destchannelstate']=_0x104380['destchannelstate'];this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x40')]=_0x104380[_0xb551('0x40')];this['channels'][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x41')]=_0x104380['holdtime'];this[_0xb551('0x23')][_0x104380['uniqueid']][_0x4b7e23][_0xb551('0x42')]=_0xb551('0x43');_[_0xb551('0x44')](this[_0xb551('0x9')][_0x104380['interface']],_[_0xb551('0x45')](_0x104380,[_0xb551('0x27'),_0xb551('0x46')]));var _0x9a7e7=this[_0xb551('0x9')][_0x104380[_0xb551('0x24')]];var _0x3707e9={'id':_0x9a7e7['id'],'name':_0x9a7e7[_0xb551('0x47')],'agentconnected':!![],'destaccountcode':_0x9a7e7[_0xb551('0x48')],'destconnectedlinenum':this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x104380['destuniqueid']]['exten'],'queue':this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x104380[_0xb551('0x25')]][_0xb551('0x27')],'uniqueid':this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x104380['destuniqueid']][_0xb551('0x22')]};ami[_0xb551('0x1b')](_0xb551('0x49'),this['channels'][_0x104380['uniqueid']][_0x104380[_0xb551('0x25')]]);this['emit'](util[_0xb551('0x28')](_0xb551('0x38'),_0x104380[_0xb551('0x20')]),_0xb551('0x4a'),_0x3707e9);}else if(!this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x4b')]&&!this['channels'][_0x104380['uniqueid']][_0x4b7e23]['agentcomplete']){logger[_0xb551('0x1e')](_0xb551('0x4c'),_0x104380[_0xb551('0x22')],this[_0xb551('0x23')][_0x104380['uniqueid']][_0x4b7e23][_0xb551('0x20')],_0x4b7e23);this['channels'][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x4b')]=!![];this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x4d')]=moment()[_0xb551('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x4e')]=_0x104380[_0xb551('0x25')];this['channels'][_0x104380[_0xb551('0x22')]][_0x4b7e23]['answeredelsewheremembername']=_0x104380[_0xb551('0x20')];this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23]['lastevent']=_0xb551('0x4f');this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23][_0xb551('0x50')]=_0xb551('0x4f');logger[_0xb551('0x33')](_0xb551('0x51'),_0x104380[_0xb551('0x22')],util[_0xb551('0x35')](this[_0xb551('0x23')][_0x104380[_0xb551('0x22')]][_0x4b7e23],{'showHidden':![],'depth':null}));ami['emit'](_0xb551('0x52'),this['channels'][_0x104380[_0xb551('0x22')]][_0x4b7e23]);}else{logger[_0xb551('0x33')](_0xb551('0x53'),_0x104380['uniqueid']);}}}}}}catch(_0x533806){logger[_0xb551('0x39')](_0xb551('0x54'),_0x104380['uniqueid'],util[_0xb551('0x35')](_0x533806,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x55')]=function(_0x2bc7da){try{if(this[_0xb551('0x1c')](_0x2bc7da)){logger[_0xb551('0x33')](_0xb551('0x56'),_0x2bc7da['uniqueid'],util[_0xb551('0x35')](_0x2bc7da,{'showHidden':![],'depth':null}));if(this[_0xb551('0x23')][_0x2bc7da[_0xb551('0x22')]]&&this[_0xb551('0x23')][_0x2bc7da[_0xb551('0x22')]][_0x2bc7da[_0xb551('0x25')]]){logger[_0xb551('0x1e')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x2bc7da[_0xb551('0x22')],_0x2bc7da[_0xb551('0x20')],_0x2bc7da['destuniqueid']);var _0x3eb9a9=this[_0xb551('0x9')][_0x2bc7da[_0xb551('0x24')]];var _0xbcb60f=this['channels'][_0x2bc7da[_0xb551('0x22')]][_0x2bc7da[_0xb551('0x25')]];_0xbcb60f[_0xb551('0x4b')]=!![];_0xbcb60f[_0xb551('0x4d')]=moment()[_0xb551('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0xbcb60f[_0xb551('0x42')]=_0xb551('0x57');_0xbcb60f[_0xb551('0x50')]='rejected';var _0x2acf0a={'id':_0x3eb9a9['id'],'name':_0x3eb9a9[_0xb551('0x47')],'queue':_0xbcb60f['queue'],'uniqueid':_0xbcb60f['uniqueid']};logger['debug'](_0xb551('0x58'),_0x2bc7da['uniqueid'],util[_0xb551('0x35')](_0x2acf0a,{'showHidden':![],'depth':null}));this[_0xb551('0x1b')](util['format'](_0xb551('0x38'),_0x3eb9a9[_0xb551('0x47')]),_0xb551('0x59'),_0x2acf0a);ami['emit'](_0xb551('0x5a'),_0xbcb60f);this[_0xb551('0x23')][_0x2bc7da[_0xb551('0x22')]][_0x2bc7da[_0xb551('0x25')]]=Object[_0xb551('0x2f')]({},_0xbcb60f);}}}catch(_0x355baf){logger[_0xb551('0x39')](_0xb551('0x5b'),_0x2bc7da[_0xb551('0x22')],util[_0xb551('0x35')](_0x355baf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x10')]=function(_0x1ea5ca){try{if(this['isNotNull'](_0x1ea5ca)){logger[_0xb551('0x33')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x1ea5ca[_0xb551('0x22')],util[_0xb551('0x35')](_0x1ea5ca,{'showHidden':![],'depth':null}));if(this[_0xb551('0x23')][_0x1ea5ca['uniqueid']]){for(var _0x1d9fd5 in this[_0xb551('0x23')][_0x1ea5ca['uniqueid']]){if(this[_0xb551('0x23')][_0x1ea5ca[_0xb551('0x22')]]['hasOwnProperty'](_0x1d9fd5)&&!this['channels'][_0x1ea5ca['uniqueid']][_0x1d9fd5][_0xb551('0x4b')]&&!this[_0xb551('0x23')][_0x1ea5ca['uniqueid']][_0x1d9fd5]['agentcomplete']){logger[_0xb551('0x1e')](_0xb551('0x5c'),_0x1ea5ca[_0xb551('0x22')],this[_0xb551('0x23')][_0x1ea5ca[_0xb551('0x22')]][_0x1d9fd5][_0xb551('0x20')],_0x1d9fd5);this[_0xb551('0x23')][_0x1ea5ca[_0xb551('0x22')]][_0x1d9fd5]['agentringnoanswer']=!![];this[_0xb551('0x23')][_0x1ea5ca['uniqueid']][_0x1d9fd5]['agentringnoanswerAt']=moment()[_0xb551('0x28')](_0xb551('0x29'));this[_0xb551('0x23')][_0x1ea5ca[_0xb551('0x22')]][_0x1d9fd5]['lastevent']=_0xb551('0x5d');this[_0xb551('0x23')][_0x1ea5ca[_0xb551('0x22')]][_0x1d9fd5][_0xb551('0x50')]=_0xb551('0x5d');logger[_0xb551('0x33')](_0xb551('0x5e'),_0x1ea5ca[_0xb551('0x22')],util[_0xb551('0x35')](this[_0xb551('0x23')][_0x1ea5ca[_0xb551('0x22')]][_0x1d9fd5],{'showHidden':![],'depth':null}));ami[_0xb551('0x1b')](_0xb551('0x5f'),this[_0xb551('0x23')][_0x1ea5ca[_0xb551('0x22')]][_0x1d9fd5]);}}}}}catch(_0x5cb66e){logger[_0xb551('0x39')]('[%s][voiceAgentReport][queuecallerabandon]',_0x1ea5ca['uniqueid'],util[_0xb551('0x35')](_0x5cb66e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x12')]=function(_0xb53817){try{if(this[_0xb551('0x1c')](_0xb53817)){logger[_0xb551('0x33')](_0xb551('0x60'),_0xb53817['uniqueid'],util[_0xb551('0x35')](_0xb53817,{'showHidden':![],'depth':null}));if(this['channels'][_0xb53817['uniqueid']]){for(var _0x14bf11 in this['channels'][_0xb53817[_0xb551('0x22')]]){if(this[_0xb551('0x23')][_0xb53817[_0xb551('0x22')]]['hasOwnProperty'](_0x14bf11)){if(this[_0xb551('0x23')][_0xb53817[_0xb551('0x22')]][_0x14bf11][_0xb551('0x3d')]&&!this['channels'][_0xb53817[_0xb551('0x22')]][_0x14bf11][_0xb551('0x11')]){logger[_0xb551('0x1e')](_0xb551('0x61'),_0xb53817['uniqueid'],this[_0xb551('0x23')][_0xb53817[_0xb551('0x22')]][_0x14bf11]['membername'],_0x14bf11);this[_0xb551('0x23')][_0xb53817[_0xb551('0x22')]][_0x14bf11][_0xb551('0x11')]=!![];this[_0xb551('0x23')][_0xb53817['uniqueid']][_0x14bf11]['agentcompleteAt']=moment()[_0xb551('0x28')](_0xb551('0x29'));this[_0xb551('0x23')][_0xb53817['uniqueid']][_0x14bf11][_0xb551('0x42')]=_0xb551('0x62');this[_0xb551('0x23')][_0xb53817['uniqueid']][_0x14bf11][_0xb551('0x50')]=_0xb53817['reason']==_0xb551('0x63')?'agent':_0xb53817[_0xb551('0x50')];this[_0xb551('0x23')][_0xb53817[_0xb551('0x22')]][_0x14bf11][_0xb551('0x64')]=_0xb53817[_0xb551('0x64')];if(this[_0xb551('0x26')][_0xb53817['queue']]&&this[_0xb551('0x26')][_0xb53817[_0xb551('0x27')]][_0xb551('0x65')]){this[_0xb551('0x23')][_0xb53817['uniqueid']][_0x14bf11][_0xb551('0x66')]=this[_0xb551('0x26')][_0xb53817[_0xb551('0x27')]][_0xb551('0x67')];this['channels'][_0xb53817[_0xb551('0x22')]][_0x14bf11][_0xb551('0x68')]=!![];}this[_0xb551('0x9')][_0xb53817[_0xb551('0x24')]]=_[_0xb551('0x30')](this['agents'][_0xb53817[_0xb551('0x24')]],[_0xb551('0x27'),_0xb551('0x46')]);logger[_0xb551('0x33')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0xb53817[_0xb551('0x22')],util[_0xb551('0x35')](this[_0xb551('0x23')][_0xb53817[_0xb551('0x22')]][_0x14bf11],{'showHidden':![],'depth':null}));ami[_0xb551('0x1b')]('custom:agentcomplete',this[_0xb551('0x23')][_0xb53817[_0xb551('0x22')]][_0x14bf11]);logger[_0xb551('0x33')](_0xb551('0x69'),_0xb53817['uniqueid'],util[_0xb551('0x35')]({'id':this[_0xb551('0x9')][_0xb53817[_0xb551('0x24')]]['id'],'destaccountcode':_0xb53817[_0xb551('0x6a')]},{'showHidden':![],'depth':null}));this[_0xb551('0x1b')](util[_0xb551('0x28')](_0xb551('0x38'),_0xb53817['membername']),_0xb551('0x6b'),{'id':this['agents'][_0xb53817[_0xb551('0x24')]]['id'],'destaccountcode':Number(_0xb53817['destaccountcode'])});}}}}}}catch(_0x5588f5){logger['error'](_0xb551('0x6c'),_0xb53817[_0xb551('0x22')],util['inspect'](_0x5588f5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb551('0x6d')]=function(_0x4df78b){try{if(this['isNotNull'](_0x4df78b)){logger[_0xb551('0x33')](_0xb551('0x6e'),_0x4df78b[_0xb551('0x22')],util[_0xb551('0x35')](_0x4df78b,{'showHidden':![],'depth':null}));this[_0xb551('0x6f')](_0x4df78b['uniqueid'],_[_0xb551('0x70')](_0x4df78b[_0xb551('0x71')])[0x0],_0x4df78b[_0xb551('0x72')]);if(this[_0xb551('0x23')][_0x4df78b[_0xb551('0x22')]]){for(var _0x4c7411 in this[_0xb551('0x23')][_0x4df78b[_0xb551('0x22')]]){if(this[_0xb551('0x23')][_0x4df78b[_0xb551('0x22')]][_0xb551('0x3b')](_0x4c7411)){logger['info'](_0xb551('0x73'),_0x4df78b[_0xb551('0x22')],_0x4c7411,_[_0xb551('0x70')](_0x4df78b[_0xb551('0x71')])[0x0],_0x4df78b[_0xb551('0x72')]);if(_['isUndefined'](this[_0xb551('0x23')][_0x4df78b[_0xb551('0x22')]][_0x4c7411][_0xb551('0xa')])){this[_0xb551('0x23')][_0x4df78b['uniqueid']][_0x4c7411][_0xb551('0xa')]={};}this[_0xb551('0x23')][_0x4df78b['uniqueid']][_0x4c7411][_0xb551('0xa')]=this['variables'][_0x4df78b[_0xb551('0x22')]];}}}}}catch(_0x24f007){logger[_0xb551('0x39')](_0xb551('0x74'),_0x4df78b['uniqueid'],util[_0xb551('0x35')](_0x24f007,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x6f')]=function(_0x48678f,_0x499bfd,_0x1e6d9d){var _0x17ac92=[_0xb551('0x75'),_0xb551('0x76'),_0xb551('0x77'),_0xb551('0x78'),_0xb551('0x79'),_0xb551('0x7a'),_0xb551('0x7b'),_0xb551('0x7c'),_0xb551('0x7d'),_0xb551('0x7e'),'bridgepeer','bridgepvtcallid','membercalls','memberdynamic',_0xb551('0x7f'),_0xb551('0x80'),_0xb551('0x20'),_0xb551('0x81'),_0xb551('0x82')];if(!_[_0xb551('0x83')](_0x499bfd)&&!_['includes'](_0x17ac92,_0x499bfd)){if(_[_0xb551('0x84')](this[_0xb551('0xa')][_0x48678f])){this[_0xb551('0xa')][_0x48678f]={};}this[_0xb551('0xa')][_0x48678f][_0x499bfd]=_0x1e6d9d;}};VoiceAgentReport['prototype'][_0xb551('0x85')]=function(_0x166520){try{if(this[_0xb551('0x1c')](_0x166520)){logger[_0xb551('0x33')](_0xb551('0x86'),_0x166520['uniqueid'],util[_0xb551('0x35')](_0x166520,{'showHidden':![],'depth':null}));if(this['channels'][_0x166520[_0xb551('0x22')]]){for(var _0x301277 in this[_0xb551('0x23')][_0x166520['uniqueid']]){if(this[_0xb551('0x23')][_0x166520[_0xb551('0x22')]][_0xb551('0x3b')](_0x301277)){if(this['channels'][_0x166520[_0xb551('0x22')]][_0x301277]['reason']==_0xb551('0x63')&&this[_0xb551('0x23')][_0x166520['uniqueid']][_0x301277][_0xb551('0x11')]){logger[_0xb551('0x1e')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x166520['uniqueid'],_0x301277);this[_0xb551('0x23')][_0x166520[_0xb551('0x22')]][_0x301277]['agentcompleteAt']=moment()[_0xb551('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xb551('0x33')](_0xb551('0x87'),_0x166520[_0xb551('0x22')],util[_0xb551('0x35')](_[_0xb551('0x88')](this[_0xb551('0x23')][_0x166520[_0xb551('0x22')]]),{'showHidden':![],'depth':null}));ami[_0xb551('0x1b')](_0xb551('0x89'),_[_0xb551('0x88')](this[_0xb551('0x23')][_0x166520[_0xb551('0x22')]]));this[_0xb551('0x8a')](_0x166520[_0xb551('0x22')]);}if(this[_0xb551('0xa')][_0x166520[_0xb551('0x22')]]){delete this[_0xb551('0xa')][_0x166520['uniqueid']];}}}catch(_0x25b902){logger[_0xb551('0x39')](_0xb551('0x8b'),_0x166520[_0xb551('0x22')],util['inspect'](_0x25b902,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x19')]=function(_0x567cc6){try{if(this[_0xb551('0x1c')](_0x567cc6)){logger[_0xb551('0x33')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x567cc6[_0xb551('0x22')],util[_0xb551('0x35')](_0x567cc6,{'showHidden':![],'depth':null}));if(this[_0xb551('0x23')][_0x567cc6[_0xb551('0x8c')]]){for(var _0x3a9796 in this[_0xb551('0x23')][_0x567cc6[_0xb551('0x8c')]]){if(this[_0xb551('0x23')][_0x567cc6[_0xb551('0x8c')]]['hasOwnProperty'](_0x3a9796)){if(_0x567cc6[_0xb551('0x8d')]===_0x3a9796){logger[_0xb551('0x1e')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x567cc6['uniqueid'],this[_0xb551('0x23')][_0x567cc6[_0xb551('0x8c')]][_0x3a9796][_0xb551('0x20')],_0x3a9796);var _0x4fddad=moment();this['channels'][_0x567cc6[_0xb551('0x8c')]][_0x3a9796][_0xb551('0x11')]=!![];this['channels'][_0x567cc6[_0xb551('0x8c')]][_0x3a9796]['agentcompleteAt']=moment()[_0xb551('0x28')](_0xb551('0x29'));this[_0xb551('0x23')][_0x567cc6[_0xb551('0x8c')]][_0x3a9796]['lastevent']=_0xb551('0x62');this[_0xb551('0x23')][_0x567cc6[_0xb551('0x8c')]][_0x3a9796][_0xb551('0x50')]='transfer';this['channels'][_0x567cc6[_0xb551('0x8c')]][_0x3a9796]['talktime']=_0x4fddad[_0xb551('0x8e')](this['channels'][_0x567cc6[_0xb551('0x8c')]][_0x3a9796]['agentconnectAt'],'seconds');}}}}if(this[_0xb551('0x23')][_0x567cc6[_0xb551('0x8f')]]){var _0x8633bc=this[_0xb551('0x23')][_0x567cc6[_0xb551('0x8f')]];this['channels'][_0x567cc6[_0xb551('0x8f')]]=this[_0xb551('0x23')][_0x567cc6[_0xb551('0x8c')]];this[_0xb551('0x23')][_0x567cc6['transfereeuniqueid']]=_0x8633bc;}}}catch(_0x484e07){logger[_0xb551('0x39')]('[%s][voiceAgentReport][attendedtransfer]',_0x567cc6[_0xb551('0x22')],util[_0xb551('0x35')](_0x484e07,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x90')]=function(_0x523943){try{if(this[_0xb551('0x1c')](_0x523943)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x523943[_0xb551('0x22')],util[_0xb551('0x35')](_0x523943,{'showHidden':![],'depth':null}));if(this[_0xb551('0x23')][_0x523943[_0xb551('0x8c')]]){for(var _0x25b512 in this['channels'][_0x523943[_0xb551('0x8c')]]){if(this[_0xb551('0x23')][_0x523943['transfereeuniqueid']][_0xb551('0x3b')](_0x25b512)){if(_0x523943[_0xb551('0x91')]===_0x25b512){logger[_0xb551('0x1e')](_0xb551('0x92'),_0x523943[_0xb551('0x22')],this[_0xb551('0x23')][_0x523943[_0xb551('0x8c')]][_0x25b512][_0xb551('0x20')],_0x25b512);var _0x541a41=moment();this[_0xb551('0x23')][_0x523943[_0xb551('0x8c')]][_0x25b512]['agentcomplete']=!![];this['channels'][_0x523943['transfereeuniqueid']][_0x25b512][_0xb551('0x93')]=_0x541a41;this[_0xb551('0x23')][_0x523943['transfereeuniqueid']][_0x25b512][_0xb551('0x42')]='complete';this['channels'][_0x523943[_0xb551('0x8c')]][_0x25b512][_0xb551('0x50')]=_0xb551('0x63');this['channels'][_0x523943[_0xb551('0x8c')]][_0x25b512][_0xb551('0x64')]=_0x541a41[_0xb551('0x8e')](this[_0xb551('0x23')][_0x523943['transfereeuniqueid']][_0x25b512][_0xb551('0x3d')],_0xb551('0x94'));}}}}}}catch(_0x250a94){logger[_0xb551('0x39')](_0xb551('0x95'),_0x523943[_0xb551('0x22')],util[_0xb551('0x35')](_0x250a94,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x15')]=function(_0x12f8a6){var _0x3200e7='';try{if(this[_0xb551('0x1c')](_0x12f8a6)){logger[_0xb551('0x33')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x12f8a6[_0xb551('0x22')],util[_0xb551('0x35')](_0x12f8a6,{'showHidden':![],'depth':null}));if(_0x12f8a6[_0xb551('0x96')]){_0x3200e7=_0x12f8a6[_0xb551('0x96')][_0xb551('0x97')](0x0,_0x12f8a6[_0xb551('0x96')][_0xb551('0x98')]('-'));if(this[_0xb551('0x9')][_0x3200e7]){logger[_0xb551('0x1e')](_0xb551('0x99'),_0x12f8a6[_0xb551('0x22')],_0x3200e7);this[_0xb551('0x9')][_0x3200e7][_0xb551('0x9a')]=!![];}}}}catch(_0x3f0d6f){logger['error'](_0xb551('0x9b'),_0x12f8a6['uniqueid'],util[_0xb551('0x35')](_0x3f0d6f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')]['syncMusicOnHoldStop']=function(_0xfd56f9){var _0x369f07='';try{if(this[_0xb551('0x1c')](_0xfd56f9)){logger[_0xb551('0x33')](_0xb551('0x9c'),_0xfd56f9['uniqueid'],util['inspect'](_0xfd56f9,{'showHidden':![],'depth':null}));if(_0xfd56f9[_0xb551('0x96')]){_0x369f07=_0xfd56f9[_0xb551('0x96')][_0xb551('0x97')](0x0,_0xfd56f9[_0xb551('0x96')][_0xb551('0x98')]('-'));if(this['agents'][_0x369f07]){logger[_0xb551('0x1e')](_0xb551('0x9d'),_0xfd56f9[_0xb551('0x22')],_0x369f07);this['agents'][_0x369f07][_0xb551('0x9a')]=![];}}}}catch(_0x3afeac){logger['error'](_0xb551('0x9e'),_0xfd56f9[_0xb551('0x22')],util['inspect'](_0x3afeac,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb551('0x1a')][_0xb551('0x8a')]=function(_0x4d30c7,_0x1a97d0=0x2710){if(this[_0xb551('0x23')][_0x4d30c7]){setTimeout(()=>{delete this[_0xb551('0x23')][_0x4d30c7];},_0x1a97d0);}};module[_0xb551('0x9f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 4df4aad..61e49d4 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa28b=['isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','inspect','isUndefined','merge','pick','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:%s','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','from-sip','undefined','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','match','type','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','connectedlinename','destinationchannel','UserId','membername','diff','calleridnum','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','transferType','resolve','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','then','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','transfercalleridnum','BLIND','syncHangup','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','syncNewChannel','hangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','prototype','emit'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xa28b,0x160));var _0xba28=function(_0x414e8b,_0x58fdd1){_0x414e8b=_0x414e8b-0x0;var _0x37d1d4=_0xa28b[_0x414e8b];return _0x37d1d4;};'use strict';var _=require('lodash');var moment=require(_0xba28('0x0'));var util=require('util');var path=require(_0xba28('0x1'));var Redis=require(_0xba28('0x2'));var config=require(_0xba28('0x3'));var logger=require(_0xba28('0x4'))(_0xba28('0x5'));var ami=require(_0xba28('0x6'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0xba28('0x7'),_0xba28('0x8'),_0xba28('0x9'),_0xba28('0xa'),_0xba28('0xb'),_0xba28('0xc')];var dispositions=[_0xba28('0xd'),_0xba28('0xe'),_0xba28('0xe'),_0xba28('0xd'),_0xba28('0xd'),_0xba28('0xd'),_0xba28('0xf'),_0xba28('0x10'),_0xba28('0xe'),_0xba28('0xe'),_0xba28('0xe')];config['redis']=_[_0xba28('0x11')](config[_0xba28('0x12')],{'host':_0xba28('0x13'),'port':0x18eb});var io=require(_0xba28('0x14'))(new Redis(config[_0xba28('0x12')]));function VoiceCallReport(_0x307a39){this[_0xba28('0x15')]=_0x307a39[_0xba28('0x15')];this['agents']=_0x307a39[_0xba28('0x16')];this[_0xba28('0x17')]={};ami['on'](_0xba28('0x18'),this[_0xba28('0x19')][_0xba28('0x1a')](this));ami['on']('newexten',this['syncNewExten'][_0xba28('0x1a')](this));ami['on']('newchannel',this[_0xba28('0x1b')][_0xba28('0x1a')](this));ami['on']('newstate',this['syncNewState'][_0xba28('0x1a')](this));ami['on']('varset',this['syncVarSet'][_0xba28('0x1a')](this));ami['on'](_0xba28('0x1c'),this['syncHangup'][_0xba28('0x1a')](this));ami['on']('newcallerid',this[_0xba28('0x1d')]['bind'](this));ami['on'](_0xba28('0x1e'),this[_0xba28('0x1f')]['bind'](this));ami['on'](_0xba28('0x20'),this[_0xba28('0x21')]['bind'](this));ami['on']('musiconholdstart',this[_0xba28('0x22')][_0xba28('0x1a')](this));ami['on'](_0xba28('0x23'),this[_0xba28('0x24')]['bind'](this));try{logger[_0xba28('0x25')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xba28('0x26')]();}catch(_0x493b37){logger['error'](_0xba28('0x27'),util['inspect'](_0x493b37,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x50633d){return _0x50633d!==null&&!_['isUndefined'](_0x50633d);};VoiceCallReport[_0xba28('0x28')]['emit']=function(_0x44192d,_0xc511fc,_0xf34c58){io['to'](_0x44192d)[_0xba28('0x29')](_0xc511fc,_0xf34c58);};VoiceCallReport['prototype'][_0xba28('0x1d')]=function(_0x29b7b8){try{if(this[_0xba28('0x2a')](_0x29b7b8)){logger['info'](_0xba28('0x2b'),_0x29b7b8[_0xba28('0x2c')],_0x29b7b8[_0xba28('0x2d')],_0x29b7b8['calleridnum']);logger[_0xba28('0x2e')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x29b7b8['uniqueid'],util[_0xba28('0x2f')](_0x29b7b8,{'showHidden':![],'depth':null}));if(_0x29b7b8[_0xba28('0x2c')]===_0x29b7b8['linkedid']){if(!_[_0xba28('0x30')](this[_0xba28('0x15')][_0x29b7b8[_0xba28('0x2c')]])){_[_0xba28('0x31')](this[_0xba28('0x15')][_0x29b7b8[_0xba28('0x2c')]],_[_0xba28('0x32')](_0x29b7b8,_[_0xba28('0x33')](this[_0xba28('0x15')][_0x29b7b8[_0xba28('0x2c')]])));}}if(_0x29b7b8[_0xba28('0x34')]==='from-sip'){var _0x44faf7=this['agents'][_0x29b7b8[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]];if(_0x44faf7){if(_0x29b7b8[_0xba28('0x37')]==_0xba28('0x38')){_0x44faf7[_0xba28('0x39')]=_0x29b7b8[_0xba28('0x3a')];this[_0xba28('0x29')](util['format'](_0xba28('0x3b'),_0x44faf7[_0xba28('0x3c')]),_0xba28('0x3d'),{'id':_0x44faf7['id'],'destaccountcode':_0x44faf7[_0xba28('0x3e')],'destconnectedlinenum':_0x29b7b8['connectedlinenum']});}}}}}catch(_0x492fd3){logger[_0xba28('0x3f')](_0xba28('0x40'),_0x29b7b8[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x492fd3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')][_0xba28('0x1b')]=function(_0x3a46c5){try{if(this['isNotNull'](_0x3a46c5)){logger['debug'](_0xba28('0x41'),_0x3a46c5[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x3a46c5,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a46c5[_0xba28('0x2c')]]){return;}if(_0x3a46c5['channel']===_0xba28('0x42')){return;}if(_0x3a46c5['uniqueid']!==_0x3a46c5[_0xba28('0x43')]&&!this[_0xba28('0x17')][_0x3a46c5[_0xba28('0x43')]]){return;}logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3a46c5[_0xba28('0x2c')],_0x3a46c5['context'],_0x3a46c5[_0xba28('0x37')]);this[_0xba28('0x15')][_0x3a46c5[_0xba28('0x2c')]]=new Channel();this['channels'][_0x3a46c5[_0xba28('0x2c')]][_0xba28('0x44')]=moment()[_0xba28('0x45')](_0xba28('0x46'));this['channels'][_0x3a46c5[_0xba28('0x2c')]]['disposition']=dispositions[_[_0xba28('0x47')](_0x3a46c5[_0xba28('0x48')])];_['merge'](this[_0xba28('0x15')][_0x3a46c5[_0xba28('0x2c')]],_['pick'](_0x3a46c5,_[_0xba28('0x33')](this[_0xba28('0x15')][_0x3a46c5[_0xba28('0x2c')]])));if(_0x3a46c5[_0xba28('0x34')]===_0xba28('0x49')){var _0x4662c8=this[_0xba28('0x16')][_0x3a46c5[_0xba28('0x35')]['split']('-')[0x0]];if(_0x4662c8&&typeof _0x4662c8[_0xba28('0x39')]===_0xba28('0x4a')){_0x4662c8[_0xba28('0x39')]=_0x3a46c5[_0xba28('0x37')];logger[_0xba28('0x2e')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x3a46c5[_0xba28('0x2c')],util[_0xba28('0x2f')]({'id':_0x4662c8['id'],'destaccountcode':_0x4662c8[_0xba28('0x3e')],'destconnectedlinenum':_0x3a46c5['exten']},{'showHidden':![],'depth':null}));this[_0xba28('0x29')](util[_0xba28('0x45')](_0xba28('0x3b'),_0x4662c8[_0xba28('0x3c')]),_0xba28('0x3d'),{'id':_0x4662c8['id'],'destaccountcode':_0x4662c8[_0xba28('0x3e')],'destconnectedlinenum':_0x3a46c5[_0xba28('0x37')]});}}}}catch(_0x1b28db){logger[_0xba28('0x3f')]('[%s][voiceCallReport][newchannel]',_0x3a46c5[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x1b28db,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')]['syncNewExten']=function(_0x3340e4){try{if(this['isNotNull'](_0x3340e4)){logger[_0xba28('0x2e')](_0xba28('0x4b'),_0x3340e4[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x3340e4,{'showHidden':![],'depth':null}));if(_0x3340e4[_0xba28('0x35')]===_0xba28('0x42')||_0x3340e4[_0xba28('0x37')]==='h')return;if(_0x3340e4[_0xba28('0x2c')]===_0x3340e4[_0xba28('0x43')]||this[_0xba28('0x17')][_0x3340e4[_0xba28('0x43')]]){_0x3340e4['application']=_0x3340e4['application']?_0x3340e4[_0xba28('0x4c')][_0xba28('0x4d')]():undefined;_0x3340e4[_0xba28('0x4e')]=_0x3340e4['appdata']||_0x3340e4[_0xba28('0x4e')];if(_0x3340e4[_0xba28('0x4f')]&&_0x3340e4[_0xba28('0x4c')]!==_0xba28('0x8')){_0x3340e4[_0xba28('0x4e')]=_0x3340e4[_0xba28('0x4e')][_0xba28('0x4d')]();}logger[_0xba28('0x25')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x3340e4['uniqueid'],_0x3340e4[_0xba28('0x4c')],_0x3340e4[_0xba28('0x4e')]);if(_['isUndefined'](this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]])){this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]]=new Channel();this[_0xba28('0x15')][_0x3340e4['uniqueid']][_0xba28('0x44')]=_0x3340e4[_0xba28('0x50')]?moment()[_0xba28('0x51')](moment[_0xba28('0x50')](_0x3340e4[_0xba28('0x50')])[_0xba28('0x52')](),'seconds')[_0xba28('0x45')](_0xba28('0x46')):moment()[_0xba28('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0xba28('0x53')]='NO\x20ANSWER';}_[_0xba28('0x31')](this[_0xba28('0x15')][_0x3340e4['uniqueid']],_[_0xba28('0x32')](_0x3340e4,_[_0xba28('0x33')](this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]])));if(_[_0xba28('0x54')](applications,_0x3340e4[_0xba28('0x4c')])){this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0xba28('0x55')]=_0x3340e4[_0xba28('0x4c')];this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0xba28('0x56')]=_0x3340e4[_0xba28('0x4e')];if(_0x3340e4[_0xba28('0x4c')]===_0xba28('0x7')&&_[_0xba28('0x57')](_0x3340e4[_0xba28('0x4e')][_0xba28('0x4d')](),_0xba28('0x58'))){var _0x3fdc7d=_0x3340e4['applicationdata'][_0xba28('0x36')]('=');var _0x418bb6=_0x3fdc7d[0x0][_0xba28('0x4d')]()[_0xba28('0x59')](/cdr\((.*)\)/);if(_0x418bb6){if(_0x418bb6[0x1]===_0xba28('0x5a')&&!_['isNil'](this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0x418bb6[0x1]]))return;this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0x418bb6[0x1]]=_0x3fdc7d[0x1];}}else if(_0x3340e4[_0xba28('0x4c')]===_0xba28('0x8')){this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0xba28('0x8')]=_0x3340e4[_0xba28('0x4e')][_0xba28('0x36')](',')[0x0];}}}}}catch(_0x4c3ffc){logger[_0xba28('0x3f')]('[%s][voiceCallReport][newexten]',_0x3340e4[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x4c3ffc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')][_0xba28('0x5b')]=function(_0x1a7c31){try{if(this[_0xba28('0x2a')](_0x1a7c31)){logger[_0xba28('0x25')](_0xba28('0x5c'),_0x1a7c31['uniqueid'],_0x1a7c31['linkedid'],_0x1a7c31[_0xba28('0x2d')],_0x1a7c31['calleridnum']);logger[_0xba28('0x2e')](_0xba28('0x5d'),_0x1a7c31['uniqueid'],util['inspect'](_0x1a7c31,{'showHidden':![],'depth':null}));if(_0x1a7c31['channelstate']!=='6')return;var _0x3acf24=this[_0xba28('0x16')][_0x1a7c31['channel'][_0xba28('0x36')]('-')[0x0]];if(_0x1a7c31['uniqueid']!==_0x1a7c31[_0xba28('0x43')]){var _0x3db949=moment();if(this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]]){if(!this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x5e')]){this[_0xba28('0x15')][_0x1a7c31['linkedid']]['answered']=!![];this[_0xba28('0x15')][_0x1a7c31['linkedid']][_0xba28('0x5f')]=_0x3db949[_0xba28('0x45')](_0xba28('0x46'));if(this['channels'][_0x1a7c31['linkedid']][_0xba28('0x44')]){this[_0xba28('0x15')][_0x1a7c31['linkedid']][_0xba28('0x60')]=_0x3db949['diff'](this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x44')],_0xba28('0x52'));}}this[_0xba28('0x15')][_0x1a7c31['linkedid']][_0xba28('0x43')]=_0x1a7c31[_0xba28('0x2c')];if(_0x1a7c31['calleridnum']!==_0xba28('0x38')){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x3a')]=_0x1a7c31['calleridnum'];}this[_0xba28('0x15')][_0x1a7c31['linkedid']][_0xba28('0x61')]=_0x1a7c31['calleridname'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x62')]=_0x1a7c31[_0xba28('0x35')];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]]['disposition']=dispositions[_[_0xba28('0x47')](_0x1a7c31[_0xba28('0x48')])];if(_0x3acf24){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x63')]=_0x3acf24['id'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x64')]=_0x3acf24['name'];}}if(this['channels'][_0x1a7c31['uniqueid']]){if(!this[_0xba28('0x15')][_0x1a7c31['uniqueid']][_0xba28('0x5e')]){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x5e')]=!![];this[_0xba28('0x15')][_0x1a7c31['uniqueid']][_0xba28('0x5f')]=_0x3db949[_0xba28('0x45')](_0xba28('0x46'));if(this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x44')]){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x60')]=_0x3db949[_0xba28('0x65')](this[_0xba28('0x15')][_0x1a7c31['uniqueid']][_0xba28('0x44')],_0xba28('0x52'));}}if(_0x1a7c31[_0xba28('0x66')]!==_0xba28('0x38')){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x3a')]=_0x1a7c31[_0xba28('0x66')];}this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]]['connectedlinename']=_0x1a7c31['calleridname'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x62')]=_0x1a7c31['channel'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]]['disposition']=dispositions[_[_0xba28('0x47')](_0x1a7c31['channelstate'])];}}else{if(this[_0xba28('0x15')][_0x1a7c31['uniqueid']]){if(_0x3acf24){this[_0xba28('0x15')][_0x1a7c31['uniqueid']][_0xba28('0x63')]=_0x3acf24['id'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x64')]=_0x3acf24[_0xba28('0x3c')];}}}if(_0x1a7c31[_0xba28('0x34')]===_0xba28('0x49')){if(_0x3acf24){_0x3acf24[_0xba28('0x39')]=_0x1a7c31['exten'];var _0x166c4a;if(this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]]){_0x166c4a=this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]]['queue'];}else if(this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]]){_0x166c4a=this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x8')];}_0x3acf24[_0xba28('0x8')]=_0x166c4a;var _0x11d99b={'id':_0x3acf24['id'],'name':_0x3acf24[_0xba28('0x3c')],'agentconnected':!![],'destaccountcode':_0x3acf24[_0xba28('0x3e')],'destconnectedlinenum':_0x1a7c31['exten'],'queue':_0x166c4a||undefined,'uniqueid':_0x1a7c31[_0xba28('0x43')]};logger[_0xba28('0x2e')](_0xba28('0x67'),_0x1a7c31[_0xba28('0x2c')],util['inspect'](_0x11d99b,{'showHidden':![],'depth':null}));this[_0xba28('0x29')](util['format'](_0xba28('0x3b'),_0x3acf24[_0xba28('0x3c')]),_0xba28('0x3d'),_0x11d99b);}}}}catch(_0x12e032){logger[_0xba28('0x3f')]('[%s][voiceCallReport][newstate]',_0x1a7c31[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x12e032,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')][_0xba28('0x68')]=function(_0x13b860,_0xb718cb){try{if(this[_0xba28('0x15')][_0x13b860]){logger['info'](_0xba28('0x69'),_0x13b860,_0xb718cb);this[_0xba28('0x15')][_0x13b860][_0xba28('0x6a')]=!![];if(_[_0xba28('0x6b')](_0xb718cb,_0xba28('0x6c'))){_0xb718cb=_0xb718cb[_0xba28('0x6d')](_0xba28('0x6c'),'.WAV');}this[_0xba28('0x15')][_0x13b860]['monitorFilename']=_0xb718cb;var _0x27dd91=_[_0xba28('0x6e')](this[_0xba28('0x15')][_0x13b860][_0xba28('0x6f')],{'filename':_0xb718cb});if(_['isNil'](_0x27dd91)){this[_0xba28('0x15')][_0x13b860][_0xba28('0x6f')][_0xba28('0x70')]({'filename':_0xb718cb,'createdAt':moment()[_0xba28('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xba28('0x71')});}}}catch(_0x462db2){logger[_0xba28('0x3f')](_0xba28('0x72'),_0x13b860,util[_0xba28('0x2f')](_0x462db2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')][_0xba28('0x73')]=function(_0x12cc0f){try{if(this['isNotNull'](_0x12cc0f)){logger[_0xba28('0x2e')](_0xba28('0x74'),_0x12cc0f[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x12cc0f,{'showHidden':![],'depth':null}));if(this['channels'][_0x12cc0f[_0xba28('0x2c')]]&&_0x12cc0f[_0xba28('0x35')]!=_0xba28('0x42')){if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')])){if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')][_0xba28('0x76')])){logger[_0xba28('0x25')](_0xba28('0x77'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x68')](_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);}else if(this[_0xba28('0x2a')](_0x12cc0f['variable'][_0xba28('0x79')])){logger['info'](_0xba28('0x7a'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x66')]=_0x12cc0f[_0xba28('0x78')];}else if(this['isNotNull'](_0x12cc0f[_0xba28('0x75')]['xmd-callerid'])){logger[_0xba28('0x25')](_0xba28('0x7b'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this['channels'][_0x12cc0f['uniqueid']][_0xba28('0x7c')]=_0x12cc0f[_0xba28('0x78')];}else if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')]['xmd-cdrtype'])){logger[_0xba28('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x12cc0f['uniqueid'],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x5a')]=_0x12cc0f[_0xba28('0x78')];}else if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')]['xmd-queue'])){logger[_0xba28('0x25')](_0xba28('0x7d'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')][_0xba28('0x36')](',')[0x0]);this['channels'][_0x12cc0f['uniqueid']][_0xba28('0x8')]=_0x12cc0f[_0xba28('0x78')][_0xba28('0x36')](',')[0x0];}else if(this['isNotNull'](_0x12cc0f['variable'][_0xba28('0x7e')])){logger[_0xba28('0x25')](_0xba28('0x7f'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x80')]=_0x12cc0f[_0xba28('0x78')];}else if(this[_0xba28('0x2a')](_0x12cc0f['variable'][_0xba28('0x81')])){logger[_0xba28('0x25')](_0xba28('0x82'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x83')]=_0x12cc0f['value'];}else if(this[_0xba28('0x2a')](_0x12cc0f['variable']['xmd-callerid-preview'])){logger['info'](_0xba28('0x84'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x85')]=_0x12cc0f[_0xba28('0x78')];}else if(this['isNotNull'](_0x12cc0f[_0xba28('0x75')][_0xba28('0x86')])){logger[_0xba28('0x25')](_0xba28('0x87'),_0x12cc0f['uniqueid'],_0x12cc0f['value']);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x8')]=_0x12cc0f['value'];}else if(this['isNotNull'](_0x12cc0f[_0xba28('0x75')][_0xba28('0x88')])){logger[_0xba28('0x25')](_0xba28('0x89'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this['channels'][_0x12cc0f[_0xba28('0x2c')]]['sipcalluniqueid']=_0x12cc0f['value'];}}}else if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')][_0xba28('0x76')])){if(_0x12cc0f[_0xba28('0x78')]){var _0x4840f1=path['parse'](_0x12cc0f['value'])['name'];logger[_0xba28('0x25')](_0xba28('0x77'),_0x4840f1,_0x12cc0f['value']);this[_0xba28('0x68')](_0x4840f1,_0x12cc0f[_0xba28('0x78')]);}}else if(this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x43')]]){if(this[_0xba28('0x2a')](_0x12cc0f['variable'])){if(this['isNotNull'](_0x12cc0f[_0xba28('0x75')][_0xba28('0x88')])){logger[_0xba28('0x25')](_0xba28('0x89'),_0x12cc0f[_0xba28('0x43')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x43')]]['sipcalllinkedid']=_0x12cc0f[_0xba28('0x78')];}}}}}catch(_0x3108a8){logger['error']('[%s][voiceCallReport][varset]',_0x12cc0f[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x3108a8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')]['syncHangup']=function(_0x5ae717){try{if(this[_0xba28('0x2a')](_0x5ae717)){logger['debug'](_0xba28('0x8a'),_0x5ae717['uniqueid'],util[_0xba28('0x2f')](_0x5ae717,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x5ae717['linkedid']]){if(this[_0xba28('0x15')][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]]['linkedid']]){this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x43')]]['uniqueid']=_0x5ae717[_0xba28('0x2c')];this['channels'][this[_0xba28('0x17')][_0x5ae717['linkedid']][_0xba28('0x43')]][_0xba28('0x5e')]=this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x5e')];this['channels'][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]]['linkedid']][_0xba28('0x5f')]=this[_0xba28('0x15')][_0x5ae717['uniqueid']][_0xba28('0x5f')];this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717['linkedid']][_0xba28('0x43')]][_0xba28('0x62')]=this[_0xba28('0x15')][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]][_0xba28('0x43')]][_0xba28('0x35')];this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x43')]][_0xba28('0x53')]=this['channels'][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x53')];this[_0xba28('0x15')][_0x5ae717['uniqueid']]=this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x43')]];this['deleteChannelAfterTimeout'](this['blindTransfers'][_0x5ae717[_0xba28('0x43')]]['linkedid']);}else if(this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]]){this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x2c')]=[this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]]['uniqueid']]['linkedid'],this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x43')]=this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]]['uniqueid']][_0xba28('0x2c')]][0x0];this[_0xba28('0x15')][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]]['uniqueid']]['answered']=this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]['answered'];this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x5f')]=this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x5f')];this['channels'][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x62')]=this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x35')];this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]]['uniqueid']][_0xba28('0x53')]=this['channels'][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x53')];this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]=this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]];this[_0xba28('0x8b')](this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]);}}if(this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]){logger[_0xba28('0x25')](_0xba28('0x8c'),_0x5ae717[_0xba28('0x2c')],_0x5ae717[_0xba28('0x8d')]);var _0x1ea0b4=moment();this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]['endtime']=_0x1ea0b4['format'](_0xba28('0x46'));this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x50')]=_0x1ea0b4[_0xba28('0x65')](this[_0xba28('0x15')][_0x5ae717['uniqueid']][_0xba28('0x44')],_0xba28('0x52'));if(this['channels'][_0x5ae717['uniqueid']]['answered']){this['channels'][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x8e')]=_0x1ea0b4[_0xba28('0x65')](this[_0xba28('0x15')][_0x5ae717['uniqueid']][_0xba28('0x5f')],_0xba28('0x52'));this[_0xba28('0x15')][_0x5ae717['uniqueid']][_0xba28('0x60')]=this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]['duration']-this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x8e')];}if(_0x5ae717[_0xba28('0x34')]==='from-sip'){if(this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]]){this['agents'][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]]=_[_0xba28('0x8f')](this[_0xba28('0x16')][_0x5ae717['channel'][_0xba28('0x36')]('-')[0x0]],['destconnectedlinenum']);logger[_0xba28('0x2e')](_0xba28('0x90'),_0x5ae717[_0xba28('0x2c')],util['inspect']({'id':this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x5ae717['channel'][_0xba28('0x36')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0xba28('0x45')](_0xba28('0x3b'),this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]][_0xba28('0x3c')]),'user:agentcomplete',{'id':this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]][_0xba28('0x3e')]});for(var _0x500322=0x0;_0x500322{delete this[_0xba28('0x15')][_0x264e8a];},_0x29935d);}};module[_0xba28('0xc4')]=VoiceCallReport; \ No newline at end of file +var _0x9375=['sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','cause-txt','billableseconds','omit','user:agentcomplete','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','util','ioredis','../../../config/logger','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','defaults','localhost','socket.io-emitter','redis','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','syncMusicOnHoldStop','info','error','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','channelstate','merge','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','appdata','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastdata','startsWith','cdr(','match','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','toNumber','UserId','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','.WAV','monitorFilename','find','monitors','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue'];(function(_0x5dc877,_0x31e3e8){var _0x3c98b7=function(_0x21b354){while(--_0x21b354){_0x5dc877['push'](_0x5dc877['shift']());}};_0x3c98b7(++_0x31e3e8);}(_0x9375,0xf7));var _0x5937=function(_0x3e8d33,_0x6d239c){_0x3e8d33=_0x3e8d33-0x0;var _0x48d81c=_0x9375[_0x3e8d33];return _0x48d81c;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x5937('0x0'));var path=require('path');var Redis=require(_0x5937('0x1'));var config=require('../../../config/environment');var logger=require(_0x5937('0x2'))('ami');var ami=require(_0x5937('0x3'));var Channel=require(_0x5937('0x4'));var RpcSetting=require(_0x5937('0x5'));var applications=[_0x5937('0x6'),_0x5937('0x7'),_0x5937('0x8'),_0x5937('0x9'),_0x5937('0xa'),_0x5937('0xb')];var dispositions=['NO\x20ANSWER',_0x5937('0xc'),_0x5937('0xc'),_0x5937('0xd'),'NO\x20ANSWER',_0x5937('0xd'),_0x5937('0xe'),'BUSY',_0x5937('0xc'),'FAILED',_0x5937('0xc')];config['redis']=_[_0x5937('0xf')](config['redis'],{'host':_0x5937('0x10'),'port':0x18eb});var io=require(_0x5937('0x11'))(new Redis(config[_0x5937('0x12')]));function VoiceCallReport(_0x3beda3){this[_0x5937('0x13')]=_0x3beda3[_0x5937('0x13')];this[_0x5937('0x14')]=_0x3beda3['agents'];this[_0x5937('0x15')]={};ami['on'](_0x5937('0x16'),this[_0x5937('0x17')][_0x5937('0x18')](this));ami['on']('newexten',this[_0x5937('0x17')][_0x5937('0x18')](this));ami['on']('newchannel',this[_0x5937('0x19')][_0x5937('0x18')](this));ami['on'](_0x5937('0x1a'),this[_0x5937('0x1b')][_0x5937('0x18')](this));ami['on'](_0x5937('0x1c'),this[_0x5937('0x1d')]['bind'](this));ami['on'](_0x5937('0x1e'),this[_0x5937('0x1f')][_0x5937('0x18')](this));ami['on']('newcallerid',this[_0x5937('0x20')][_0x5937('0x18')](this));ami['on'](_0x5937('0x21'),this['syncAttendedTransfer'][_0x5937('0x18')](this));ami['on'](_0x5937('0x22'),this[_0x5937('0x23')]['bind'](this));ami['on']('musiconholdstart',this[_0x5937('0x24')][_0x5937('0x18')](this));ami['on']('musiconholdstop',this[_0x5937('0x25')]['bind'](this));try{logger[_0x5937('0x26')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0xf679cf){logger[_0x5937('0x27')]('[voiceCallReport][coreshowchannels]',util[_0x5937('0x28')](_0xf679cf,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x5937('0x29')][_0x5937('0x2a')]=function(_0x4e9d63){return _0x4e9d63!==null&&!_[_0x5937('0x2b')](_0x4e9d63);};VoiceCallReport[_0x5937('0x29')][_0x5937('0x2c')]=function(_0x459d83,_0x4dbdf2,_0x27308a){io['to'](_0x459d83)[_0x5937('0x2c')](_0x4dbdf2,_0x27308a);};VoiceCallReport[_0x5937('0x29')][_0x5937('0x20')]=function(_0x15e5f5){try{if(this[_0x5937('0x2a')](_0x15e5f5)){logger['info'](_0x5937('0x2d'),_0x15e5f5[_0x5937('0x2e')],_0x15e5f5[_0x5937('0x2f')],_0x15e5f5[_0x5937('0x30')]);logger[_0x5937('0x31')](_0x5937('0x32'),_0x15e5f5[_0x5937('0x2e')],util[_0x5937('0x28')](_0x15e5f5,{'showHidden':![],'depth':null}));if(_0x15e5f5[_0x5937('0x2e')]===_0x15e5f5['linkedid']){if(!_[_0x5937('0x2b')](this[_0x5937('0x13')][_0x15e5f5[_0x5937('0x2e')]])){_['merge'](this['channels'][_0x15e5f5['uniqueid']],_[_0x5937('0x33')](_0x15e5f5,_[_0x5937('0x34')](this[_0x5937('0x13')][_0x15e5f5[_0x5937('0x2e')]])));}}if(_0x15e5f5[_0x5937('0x35')]===_0x5937('0x36')){var _0x16065d=this[_0x5937('0x14')][_0x15e5f5[_0x5937('0x37')][_0x5937('0x38')]('-')[0x0]];if(_0x16065d){if(_0x15e5f5[_0x5937('0x39')]==_0x5937('0x3a')){_0x16065d[_0x5937('0x3b')]=_0x15e5f5[_0x5937('0x3c')];this[_0x5937('0x2c')](util[_0x5937('0x3d')](_0x5937('0x3e'),_0x16065d['name']),'user:agentconnect',{'id':_0x16065d['id'],'destaccountcode':_0x16065d[_0x5937('0x3f')],'destconnectedlinenum':_0x15e5f5[_0x5937('0x3c')]});}}}}}catch(_0x2ea5c8){logger[_0x5937('0x27')](_0x5937('0x40'),_0x15e5f5[_0x5937('0x2e')],util[_0x5937('0x28')](_0x2ea5c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5937('0x29')][_0x5937('0x19')]=function(_0x4134f7){try{if(this[_0x5937('0x2a')](_0x4134f7)){logger['debug'](_0x5937('0x41'),_0x4134f7[_0x5937('0x2e')],util['inspect'](_0x4134f7,{'showHidden':![],'depth':null}));if(this[_0x5937('0x13')][_0x4134f7[_0x5937('0x2e')]]){return;}if(_0x4134f7[_0x5937('0x37')]==='OutgoingSpoolFailed'){return;}if(_0x4134f7[_0x5937('0x2e')]!==_0x4134f7['linkedid']&&!this[_0x5937('0x15')][_0x4134f7[_0x5937('0x42')]]){return;}logger[_0x5937('0x26')](_0x5937('0x43'),_0x4134f7[_0x5937('0x2e')],_0x4134f7[_0x5937('0x35')],_0x4134f7[_0x5937('0x39')]);this['channels'][_0x4134f7[_0x5937('0x2e')]]=new Channel();this[_0x5937('0x13')][_0x4134f7[_0x5937('0x2e')]][_0x5937('0x44')]=moment()[_0x5937('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5937('0x13')][_0x4134f7[_0x5937('0x2e')]][_0x5937('0x45')]=dispositions[_['toNumber'](_0x4134f7[_0x5937('0x46')])];_[_0x5937('0x47')](this[_0x5937('0x13')][_0x4134f7['uniqueid']],_['pick'](_0x4134f7,_[_0x5937('0x34')](this['channels'][_0x4134f7[_0x5937('0x2e')]])));if(_0x4134f7[_0x5937('0x35')]===_0x5937('0x36')){var _0x1df8bb=this['agents'][_0x4134f7[_0x5937('0x37')]['split']('-')[0x0]];if(_0x1df8bb&&typeof _0x1df8bb[_0x5937('0x3b')]==='undefined'){_0x1df8bb['destconnectedlinenum']=_0x4134f7[_0x5937('0x39')];logger[_0x5937('0x31')](_0x5937('0x48'),_0x4134f7[_0x5937('0x2e')],util[_0x5937('0x28')]({'id':_0x1df8bb['id'],'destaccountcode':_0x1df8bb['accountcode'],'destconnectedlinenum':_0x4134f7[_0x5937('0x39')]},{'showHidden':![],'depth':null}));this[_0x5937('0x2c')](util[_0x5937('0x3d')](_0x5937('0x3e'),_0x1df8bb[_0x5937('0x49')]),_0x5937('0x4a'),{'id':_0x1df8bb['id'],'destaccountcode':_0x1df8bb['accountcode'],'destconnectedlinenum':_0x4134f7['exten']});}}}}catch(_0x55dbd9){logger[_0x5937('0x27')]('[%s][voiceCallReport][newchannel]',_0x4134f7[_0x5937('0x2e')],util[_0x5937('0x28')](_0x55dbd9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x5de50d){try{if(this[_0x5937('0x2a')](_0x5de50d)){logger['debug'](_0x5937('0x4b'),_0x5de50d[_0x5937('0x2e')],util[_0x5937('0x28')](_0x5de50d,{'showHidden':![],'depth':null}));if(_0x5de50d[_0x5937('0x37')]===_0x5937('0x4c')||_0x5de50d['exten']==='h')return;if(_0x5de50d[_0x5937('0x2e')]===_0x5de50d[_0x5937('0x42')]||this[_0x5937('0x15')][_0x5de50d[_0x5937('0x42')]]){_0x5de50d[_0x5937('0x4d')]=_0x5de50d['application']?_0x5de50d[_0x5937('0x4d')]['toLowerCase']():undefined;_0x5de50d['applicationdata']=_0x5de50d[_0x5937('0x4e')]||_0x5de50d[_0x5937('0x4f')];if(_0x5de50d[_0x5937('0x4e')]&&_0x5de50d[_0x5937('0x4d')]!==_0x5937('0x7')){_0x5de50d[_0x5937('0x4f')]=_0x5de50d[_0x5937('0x4f')][_0x5937('0x50')]();}logger[_0x5937('0x26')](_0x5937('0x51'),_0x5de50d[_0x5937('0x2e')],_0x5de50d[_0x5937('0x4d')],_0x5de50d[_0x5937('0x4f')]);if(_[_0x5937('0x2b')](this[_0x5937('0x13')][_0x5de50d[_0x5937('0x2e')]])){this[_0x5937('0x13')][_0x5de50d[_0x5937('0x2e')]]=new Channel();this[_0x5937('0x13')][_0x5de50d[_0x5937('0x2e')]][_0x5937('0x44')]=_0x5de50d[_0x5937('0x52')]?moment()['subtract'](moment[_0x5937('0x52')](_0x5de50d[_0x5937('0x52')])[_0x5937('0x53')](),_0x5937('0x53'))[_0x5937('0x3d')](_0x5937('0x54')):moment()['format'](_0x5937('0x54'));this[_0x5937('0x13')][_0x5de50d[_0x5937('0x2e')]]['disposition']=_0x5937('0xd');}_[_0x5937('0x47')](this[_0x5937('0x13')][_0x5de50d[_0x5937('0x2e')]],_[_0x5937('0x33')](_0x5de50d,_[_0x5937('0x34')](this['channels'][_0x5de50d[_0x5937('0x2e')]])));if(_[_0x5937('0x55')](applications,_0x5de50d[_0x5937('0x4d')])){this['channels'][_0x5de50d[_0x5937('0x2e')]]['lastapplication']=_0x5de50d[_0x5937('0x4d')];this[_0x5937('0x13')][_0x5de50d[_0x5937('0x2e')]][_0x5937('0x56')]=_0x5de50d[_0x5937('0x4f')];if(_0x5de50d[_0x5937('0x4d')]===_0x5937('0x6')&&_[_0x5937('0x57')](_0x5de50d['applicationdata'][_0x5937('0x50')](),_0x5937('0x58'))){var _0xa6a36d=_0x5de50d[_0x5937('0x4f')]['split']('=');var _0x15ec3f=_0xa6a36d[0x0][_0x5937('0x50')]()[_0x5937('0x59')](/cdr\((.*)\)/);if(_0x15ec3f){if(_0x15ec3f[0x1]==='type'&&!_[_0x5937('0x5a')](this[_0x5937('0x13')][_0x5de50d[_0x5937('0x2e')]][_0x15ec3f[0x1]]))return;this[_0x5937('0x13')][_0x5de50d[_0x5937('0x2e')]][_0x15ec3f[0x1]]=_0xa6a36d[0x1];}}else if(_0x5de50d[_0x5937('0x4d')]===_0x5937('0x7')){this[_0x5937('0x13')][_0x5de50d['uniqueid']][_0x5937('0x7')]=_0x5de50d[_0x5937('0x4f')][_0x5937('0x38')](',')[0x0];}}}}}catch(_0x13b788){logger['error'](_0x5937('0x5b'),_0x5de50d[_0x5937('0x2e')],util[_0x5937('0x28')](_0x13b788,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5937('0x29')][_0x5937('0x1b')]=function(_0x5512d5){try{if(this[_0x5937('0x2a')](_0x5512d5)){logger[_0x5937('0x26')](_0x5937('0x5c'),_0x5512d5[_0x5937('0x2e')],_0x5512d5[_0x5937('0x42')],_0x5512d5[_0x5937('0x2f')],_0x5512d5[_0x5937('0x30')]);logger[_0x5937('0x31')](_0x5937('0x5d'),_0x5512d5[_0x5937('0x2e')],util[_0x5937('0x28')](_0x5512d5,{'showHidden':![],'depth':null}));if(_0x5512d5[_0x5937('0x46')]!=='6')return;var _0x156260=this[_0x5937('0x14')][_0x5512d5[_0x5937('0x37')][_0x5937('0x38')]('-')[0x0]];if(_0x5512d5[_0x5937('0x2e')]!==_0x5512d5[_0x5937('0x42')]){var _0x4a6918=moment();if(this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]]){if(!this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]][_0x5937('0x5e')]){this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]]['answered']=!![];this['channels'][_0x5512d5[_0x5937('0x42')]][_0x5937('0x5f')]=_0x4a6918[_0x5937('0x3d')](_0x5937('0x54'));if(this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]][_0x5937('0x44')]){this['channels'][_0x5512d5['linkedid']][_0x5937('0x60')]=_0x4a6918[_0x5937('0x61')](this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]]['starttime'],_0x5937('0x53'));}}this['channels'][_0x5512d5[_0x5937('0x42')]][_0x5937('0x42')]=_0x5512d5[_0x5937('0x2e')];if(_0x5512d5[_0x5937('0x30')]!=='xcally-motion-preview'){this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]]['connectedlinenum']=_0x5512d5['calleridnum'];}this[_0x5937('0x13')][_0x5512d5['linkedid']][_0x5937('0x62')]=_0x5512d5[_0x5937('0x2f')];this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]][_0x5937('0x63')]=_0x5512d5[_0x5937('0x37')];this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]]['disposition']=dispositions[_[_0x5937('0x64')](_0x5512d5['channelstate'])];if(_0x156260){this['channels'][_0x5512d5[_0x5937('0x42')]]['UserId']=_0x156260['id'];this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]]['membername']=_0x156260[_0x5937('0x49')];}}if(this['channels'][_0x5512d5[_0x5937('0x2e')]]){if(!this['channels'][_0x5512d5[_0x5937('0x2e')]][_0x5937('0x5e')]){this['channels'][_0x5512d5['uniqueid']]['answered']=!![];this[_0x5937('0x13')][_0x5512d5[_0x5937('0x2e')]][_0x5937('0x5f')]=_0x4a6918[_0x5937('0x3d')](_0x5937('0x54'));if(this['channels'][_0x5512d5['uniqueid']][_0x5937('0x44')]){this['channels'][_0x5512d5[_0x5937('0x2e')]][_0x5937('0x60')]=_0x4a6918['diff'](this['channels'][_0x5512d5[_0x5937('0x2e')]][_0x5937('0x44')],_0x5937('0x53'));}}if(_0x5512d5[_0x5937('0x30')]!=='xcally-motion-preview'){this[_0x5937('0x13')][_0x5512d5[_0x5937('0x2e')]][_0x5937('0x3c')]=_0x5512d5['calleridnum'];}this[_0x5937('0x13')][_0x5512d5[_0x5937('0x2e')]][_0x5937('0x62')]=_0x5512d5[_0x5937('0x2f')];this['channels'][_0x5512d5['uniqueid']]['destinationchannel']=_0x5512d5['channel'];this['channels'][_0x5512d5['uniqueid']][_0x5937('0x45')]=dispositions[_['toNumber'](_0x5512d5[_0x5937('0x46')])];}}else{if(this['channels'][_0x5512d5[_0x5937('0x2e')]]){if(_0x156260){this['channels'][_0x5512d5[_0x5937('0x2e')]][_0x5937('0x65')]=_0x156260['id'];this[_0x5937('0x13')][_0x5512d5['uniqueid']]['membername']=_0x156260[_0x5937('0x49')];}}}if(_0x5512d5[_0x5937('0x35')]===_0x5937('0x36')){if(_0x156260){_0x156260[_0x5937('0x3b')]=_0x5512d5[_0x5937('0x39')];var _0x295c2c;if(this[_0x5937('0x13')][_0x5512d5[_0x5937('0x2e')]]){_0x295c2c=this[_0x5937('0x13')][_0x5512d5[_0x5937('0x2e')]][_0x5937('0x7')];}else if(this[_0x5937('0x13')][_0x5512d5['linkedid']]){_0x295c2c=this[_0x5937('0x13')][_0x5512d5[_0x5937('0x42')]][_0x5937('0x7')];}_0x156260[_0x5937('0x7')]=_0x295c2c;var _0x3e97f3={'id':_0x156260['id'],'name':_0x156260['name'],'agentconnected':!![],'destaccountcode':_0x156260[_0x5937('0x3f')],'destconnectedlinenum':_0x5512d5[_0x5937('0x39')],'queue':_0x295c2c||undefined,'uniqueid':_0x5512d5[_0x5937('0x42')]};logger[_0x5937('0x31')](_0x5937('0x66'),_0x5512d5[_0x5937('0x2e')],util[_0x5937('0x28')](_0x3e97f3,{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x156260[_0x5937('0x49')]),_0x5937('0x4a'),_0x3e97f3);}}}}catch(_0x547d2b){logger[_0x5937('0x27')]('[%s][voiceCallReport][newstate]',_0x5512d5[_0x5937('0x2e')],util[_0x5937('0x28')](_0x547d2b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5937('0x29')][_0x5937('0x67')]=function(_0x1ffa44,_0x7b6155){try{if(this[_0x5937('0x13')][_0x1ffa44]){logger[_0x5937('0x26')](_0x5937('0x68'),_0x1ffa44,_0x7b6155);this[_0x5937('0x13')][_0x1ffa44][_0x5937('0x69')]=!![];if(_['endsWith'](_0x7b6155,_0x5937('0x6a'))){_0x7b6155=_0x7b6155['replace']('.wav49',_0x5937('0x6b'));}this[_0x5937('0x13')][_0x1ffa44][_0x5937('0x6c')]=_0x7b6155;var _0x59bf7c=_[_0x5937('0x6d')](this[_0x5937('0x13')][_0x1ffa44]['monitors'],{'filename':_0x7b6155});if(_[_0x5937('0x5a')](_0x59bf7c)){this[_0x5937('0x13')][_0x1ffa44][_0x5937('0x6e')]['push']({'filename':_0x7b6155,'createdAt':moment()[_0x5937('0x3d')](_0x5937('0x54')),'mixmonitorid':'','status':'rec'});}}}catch(_0x2af851){logger[_0x5937('0x27')](_0x5937('0x6f'),_0x1ffa44,util[_0x5937('0x28')](_0x2af851,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5937('0x29')][_0x5937('0x1d')]=function(_0x6f8751){try{if(this['isNotNull'](_0x6f8751)){logger[_0x5937('0x31')]('[%s][voiceCallReport][varset]\x20event:',_0x6f8751[_0x5937('0x2e')],util[_0x5937('0x28')](_0x6f8751,{'showHidden':![],'depth':null}));if(this[_0x5937('0x13')][_0x6f8751[_0x5937('0x2e')]]&&_0x6f8751[_0x5937('0x37')]!=_0x5937('0x4c')){if(this[_0x5937('0x2a')](_0x6f8751[_0x5937('0x70')])){if(this['isNotNull'](_0x6f8751[_0x5937('0x70')][_0x5937('0x71')])){logger[_0x5937('0x26')](_0x5937('0x72'),_0x6f8751['uniqueid'],_0x6f8751[_0x5937('0x73')]);this[_0x5937('0x67')](_0x6f8751[_0x5937('0x2e')],_0x6f8751[_0x5937('0x73')]);}else if(this['isNotNull'](_0x6f8751[_0x5937('0x70')]['xmd-phone'])){logger[_0x5937('0x26')](_0x5937('0x74'),_0x6f8751['uniqueid'],_0x6f8751[_0x5937('0x73')]);this['channels'][_0x6f8751[_0x5937('0x2e')]][_0x5937('0x30')]=_0x6f8751[_0x5937('0x73')];}else if(this[_0x5937('0x2a')](_0x6f8751[_0x5937('0x70')][_0x5937('0x75')])){logger[_0x5937('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x6f8751[_0x5937('0x2e')],_0x6f8751[_0x5937('0x73')]);this[_0x5937('0x13')][_0x6f8751[_0x5937('0x2e')]][_0x5937('0x76')]=_0x6f8751[_0x5937('0x73')];}else if(this[_0x5937('0x2a')](_0x6f8751['variable'][_0x5937('0x77')])){logger[_0x5937('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x6f8751[_0x5937('0x2e')],_0x6f8751[_0x5937('0x73')]);this[_0x5937('0x13')][_0x6f8751[_0x5937('0x2e')]][_0x5937('0x78')]=_0x6f8751[_0x5937('0x73')];}else if(this[_0x5937('0x2a')](_0x6f8751[_0x5937('0x70')][_0x5937('0x79')])){logger['info'](_0x5937('0x7a'),_0x6f8751[_0x5937('0x2e')],_0x6f8751[_0x5937('0x73')][_0x5937('0x38')](',')[0x0]);this[_0x5937('0x13')][_0x6f8751[_0x5937('0x2e')]]['queue']=_0x6f8751[_0x5937('0x73')][_0x5937('0x38')](',')[0x0];}else if(this['isNotNull'](_0x6f8751[_0x5937('0x70')][_0x5937('0x7b')])){logger[_0x5937('0x26')](_0x5937('0x7c'),_0x6f8751['uniqueid'],_0x6f8751[_0x5937('0x73')]);this[_0x5937('0x13')][_0x6f8751[_0x5937('0x2e')]][_0x5937('0x7d')]=_0x6f8751[_0x5937('0x73')];}else if(this[_0x5937('0x2a')](_0x6f8751[_0x5937('0x70')]['xmd-destination'])){logger['info'](_0x5937('0x7e'),_0x6f8751[_0x5937('0x2e')],_0x6f8751['value']);this[_0x5937('0x13')][_0x6f8751[_0x5937('0x2e')]][_0x5937('0x7f')]=_0x6f8751['value'];}else if(this[_0x5937('0x2a')](_0x6f8751[_0x5937('0x70')][_0x5937('0x80')])){logger[_0x5937('0x26')](_0x5937('0x81'),_0x6f8751[_0x5937('0x2e')],_0x6f8751[_0x5937('0x73')]);this['channels'][_0x6f8751[_0x5937('0x2e')]]['calleridpreview']=_0x6f8751[_0x5937('0x73')];}else if(this[_0x5937('0x2a')](_0x6f8751[_0x5937('0x70')][_0x5937('0x82')])){logger[_0x5937('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x6f8751[_0x5937('0x2e')],_0x6f8751['value']);this[_0x5937('0x13')][_0x6f8751[_0x5937('0x2e')]][_0x5937('0x7')]=_0x6f8751[_0x5937('0x73')];}else if(this[_0x5937('0x2a')](_0x6f8751[_0x5937('0x70')][_0x5937('0x83')])){logger['info'](_0x5937('0x84'),_0x6f8751[_0x5937('0x2e')],_0x6f8751[_0x5937('0x73')]);this['channels'][_0x6f8751['uniqueid']][_0x5937('0x85')]=_0x6f8751[_0x5937('0x73')];}}}else if(this['isNotNull'](_0x6f8751[_0x5937('0x70')][_0x5937('0x71')])){if(_0x6f8751['value']){var _0x49ca4a=path[_0x5937('0x86')](_0x6f8751[_0x5937('0x73')])[_0x5937('0x49')];logger[_0x5937('0x26')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x49ca4a,_0x6f8751['value']);this['syncMixMonitorFilename'](_0x49ca4a,_0x6f8751[_0x5937('0x73')]);}}else if(this['channels'][_0x6f8751[_0x5937('0x42')]]){if(this['isNotNull'](_0x6f8751[_0x5937('0x70')])){if(this[_0x5937('0x2a')](_0x6f8751[_0x5937('0x70')][_0x5937('0x83')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x6f8751[_0x5937('0x42')],_0x6f8751[_0x5937('0x73')]);this['channels'][_0x6f8751[_0x5937('0x42')]]['sipcalllinkedid']=_0x6f8751['value'];}}}}}catch(_0x487024){logger[_0x5937('0x27')](_0x5937('0x87'),_0x6f8751['uniqueid'],util['inspect'](_0x487024,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5937('0x29')]['syncHangup']=function(_0x4423fa){try{if(this[_0x5937('0x2a')](_0x4423fa)){logger['debug'](_0x5937('0x88'),_0x4423fa['uniqueid'],util[_0x5937('0x28')](_0x4423fa,{'showHidden':![],'depth':null}));if(this[_0x5937('0x15')][_0x4423fa[_0x5937('0x42')]]){if(this[_0x5937('0x13')][this['blindTransfers'][_0x4423fa[_0x5937('0x42')]]['linkedid']]){this[_0x5937('0x13')][this['blindTransfers'][_0x4423fa[_0x5937('0x42')]]['linkedid']][_0x5937('0x2e')]=_0x4423fa[_0x5937('0x2e')];this[_0x5937('0x13')][this['blindTransfers'][_0x4423fa['linkedid']]['linkedid']][_0x5937('0x5e')]=this['channels'][_0x4423fa['uniqueid']][_0x5937('0x5e')];this[_0x5937('0x13')][this[_0x5937('0x15')][_0x4423fa[_0x5937('0x42')]][_0x5937('0x42')]]['answertime']=this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]][_0x5937('0x5f')];this[_0x5937('0x13')][this['blindTransfers'][_0x4423fa[_0x5937('0x42')]]['linkedid']][_0x5937('0x63')]=this['channels'][this[_0x5937('0x15')][_0x4423fa['linkedid']][_0x5937('0x42')]][_0x5937('0x37')];this[_0x5937('0x13')][this['blindTransfers'][_0x4423fa[_0x5937('0x42')]]['linkedid']][_0x5937('0x45')]=this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]][_0x5937('0x45')];this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]]=this['channels'][this[_0x5937('0x15')][_0x4423fa['linkedid']]['linkedid']];this[_0x5937('0x89')](this[_0x5937('0x15')][_0x4423fa[_0x5937('0x42')]]['linkedid']);}else if(this[_0x5937('0x13')][this[_0x5937('0x15')][_0x4423fa['linkedid']]['uniqueid']]){this[_0x5937('0x13')][this[_0x5937('0x15')][_0x4423fa['linkedid']][_0x5937('0x2e')]][_0x5937('0x2e')]=[this[_0x5937('0x13')][this[_0x5937('0x15')][_0x4423fa[_0x5937('0x42')]][_0x5937('0x2e')]][_0x5937('0x42')],this['channels'][this['blindTransfers'][_0x4423fa[_0x5937('0x42')]][_0x5937('0x2e')]][_0x5937('0x42')]=this[_0x5937('0x13')][this['blindTransfers'][_0x4423fa['linkedid']][_0x5937('0x2e')]]['uniqueid']][0x0];this['channels'][this['blindTransfers'][_0x4423fa[_0x5937('0x42')]]['uniqueid']][_0x5937('0x5e')]=this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]][_0x5937('0x5e')];this[_0x5937('0x13')][this[_0x5937('0x15')][_0x4423fa[_0x5937('0x42')]][_0x5937('0x2e')]][_0x5937('0x5f')]=this[_0x5937('0x13')][_0x4423fa['uniqueid']][_0x5937('0x5f')];this[_0x5937('0x13')][this[_0x5937('0x15')][_0x4423fa[_0x5937('0x42')]]['uniqueid']]['destinationchannel']=this[_0x5937('0x13')][this['blindTransfers'][_0x4423fa[_0x5937('0x42')]][_0x5937('0x2e')]]['channel'];this[_0x5937('0x13')][this['blindTransfers'][_0x4423fa[_0x5937('0x42')]][_0x5937('0x2e')]][_0x5937('0x45')]=this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]][_0x5937('0x45')];this[_0x5937('0x13')][_0x4423fa['uniqueid']]=this[_0x5937('0x13')][this[_0x5937('0x15')][_0x4423fa[_0x5937('0x42')]]['uniqueid']];this[_0x5937('0x89')](this[_0x5937('0x15')][_0x4423fa[_0x5937('0x42')]][_0x5937('0x2e')]);}}if(this[_0x5937('0x13')][_0x4423fa['uniqueid']]){logger[_0x5937('0x26')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x4423fa['uniqueid'],_0x4423fa[_0x5937('0x8a')]);var _0x28eae0=moment();this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]]['endtime']=_0x28eae0[_0x5937('0x3d')](_0x5937('0x54'));this[_0x5937('0x13')][_0x4423fa['uniqueid']]['duration']=_0x28eae0[_0x5937('0x61')](this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]][_0x5937('0x44')],_0x5937('0x53'));if(this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]][_0x5937('0x5e')]){this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]][_0x5937('0x8b')]=_0x28eae0[_0x5937('0x61')](this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]][_0x5937('0x5f')],_0x5937('0x53'));this[_0x5937('0x13')][_0x4423fa['uniqueid']][_0x5937('0x60')]=this[_0x5937('0x13')][_0x4423fa['uniqueid']][_0x5937('0x52')]-this[_0x5937('0x13')][_0x4423fa[_0x5937('0x2e')]]['billableseconds'];}if(_0x4423fa['context']==='from-sip'){if(this[_0x5937('0x14')][_0x4423fa[_0x5937('0x37')]['split']('-')[0x0]]){this[_0x5937('0x14')][_0x4423fa[_0x5937('0x37')][_0x5937('0x38')]('-')[0x0]]=_[_0x5937('0x8c')](this[_0x5937('0x14')][_0x4423fa[_0x5937('0x37')]['split']('-')[0x0]],[_0x5937('0x3b')]);logger[_0x5937('0x31')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x4423fa['uniqueid'],util[_0x5937('0x28')]({'id':this['agents'][_0x4423fa['channel'][_0x5937('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x5937('0x14')][_0x4423fa[_0x5937('0x37')][_0x5937('0x38')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x5937('0x3d')](_0x5937('0x3e'),this['agents'][_0x4423fa[_0x5937('0x37')][_0x5937('0x38')]('-')[0x0]][_0x5937('0x49')]),_0x5937('0x8d'),{'id':this[_0x5937('0x14')][_0x4423fa[_0x5937('0x37')][_0x5937('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x5937('0x14')][_0x4423fa[_0x5937('0x37')]['split']('-')[0x0]]['accountcode']});for(var _0x181c09=0x0;_0x181c09{delete this[_0x5937('0x13')][_0x2180fb];},_0x3d7645);}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 8a3dae4..fd464d3 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbedd=['startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','bind','dialend','varset','syncVarSet','syncHangup','isUndefined','prototype','emit','syncDialBegin','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','syncDialEnd','isNotNull','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','voice','outboundrouteid','voice:outbound','error','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberpenalty','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','lastevent','complete','total','answered','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][newexten]\x20event:','applicationdata','toLowerCase'];(function(_0x3cb86b,_0x3c75f6){var _0x3c10a0=function(_0x71331f){while(--_0x71331f){_0x3cb86b['push'](_0x3cb86b['shift']());}};_0x3c10a0(++_0x3c75f6);}(_0xbedd,0xf3));var _0xdbed=function(_0x415470,_0x8c567){_0x415470=_0x415470-0x0;var _0x5618c8=_0xbedd[_0x415470];return _0x5618c8;};'use strict';var _=require(_0xdbed('0x0'));var moment=require('moment');var util=require(_0xdbed('0x1'));var Redis=require(_0xdbed('0x2'));var config=require(_0xdbed('0x3'));var logger=require(_0xdbed('0x4'))('ami');var ami=require('../ami');config[_0xdbed('0x5')]=_[_0xdbed('0x6')](config[_0xdbed('0x5')],{'host':_0xdbed('0x7'),'port':0x18eb});var io=require(_0xdbed('0x8'))(new Redis(config[_0xdbed('0x5')]));function VoiceDialReport(_0x26ef93){this[_0xdbed('0x9')]=_0x26ef93[_0xdbed('0xa')];this[_0xdbed('0xb')]=_0x26ef93[_0xdbed('0xb')];this[_0xdbed('0xc')]={};this[_0xdbed('0xd')]={};ami['on']('dialbegin',this['syncDialBegin'][_0xdbed('0xe')](this));ami['on'](_0xdbed('0xf'),this['syncDialEnd'][_0xdbed('0xe')](this));ami['on'](_0xdbed('0x10'),this[_0xdbed('0x11')]['bind'](this));ami['on']('hangup',this[_0xdbed('0x12')][_0xdbed('0xe')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x2a45d3){return _0x2a45d3!==null&&!_[_0xdbed('0x13')](_0x2a45d3);};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x15')]=function(_0xa64a3b,_0x54bc95,_0x233207){io['to'](_0xa64a3b)[_0xdbed('0x15')](_0x54bc95,_0x233207);};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x16')]=function(_0x1a4ffc){try{if(this['isNotNull'](_0x1a4ffc)){logger[_0xdbed('0x17')](_0xdbed('0x18'),_0x1a4ffc[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x1a4ffc,{'showHidden':![],'depth':null}));if(this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]]){_[_0xdbed('0x1b')](this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]],{'starttime':moment()[_0xdbed('0x1c')](_0xdbed('0x1d')),'lastevent':_0xdbed('0x1e'),'interface':_0x1a4ffc[_0xdbed('0x1f')][_0xdbed('0x20')](0x0,_0x1a4ffc['channel'][_0xdbed('0x21')]('-')),'membername':_0x1a4ffc[_0xdbed('0x1f')][_0xdbed('0x20')](_0x1a4ffc[_0xdbed('0x1f')]['lastIndexOf']('/')+0x1,_0x1a4ffc[_0xdbed('0x1f')][_0xdbed('0x21')]('-'))},_[_0xdbed('0x22')](_0x1a4ffc,[_0xdbed('0x23'),_0xdbed('0x24')]));logger['info'](_0xdbed('0x25'),_0x1a4ffc['uniqueid'],this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]][_0xdbed('0x26')],this['channels'][_0x1a4ffc[_0xdbed('0x19')]][_0xdbed('0x27')]);logger[_0xdbed('0x17')](_0xdbed('0x28'),_0x1a4ffc[_0xdbed('0x19')],util['inspect'](this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x1a4ffc[_0xdbed('0x19')]])_['merge'](this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]],this[_0xdbed('0xc')][_0x1a4ffc[_0xdbed('0x19')]]);this['emit']('voice:outbound',_0xdbed('0x29'),this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]]);logger[_0xdbed('0x17')](_0xdbed('0x2a'),_0x1a4ffc[_0xdbed('0x19')],util[_0xdbed('0x1a')](this[_0xdbed('0x9')][_0x1a4ffc['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xdbed('0x2b'),this['channels'][_0x1a4ffc[_0xdbed('0x19')]]);}}}catch(_0x4b9773){logger['error'](_0xdbed('0x2c'),_0x1a4ffc[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x4b9773,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x2d')]=function(_0x3db025){try{if(this[_0xdbed('0x2e')](_0x3db025)){logger[_0xdbed('0x17')]('[%s][voiceDialReport][dialend]\x20event:',_0x3db025[_0xdbed('0x19')],util['inspect'](_0x3db025,{'showHidden':![],'depth':null}));if(this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]]){this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]][_0xdbed('0x2f')]=_0x3db025[_0xdbed('0x2f')];if(_0x3db025['dialstatus']===_0xdbed('0x30')){this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]][_0xdbed('0x31')]=_0x3db025[_0xdbed('0x31')];this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]][_0xdbed('0x32')]=_0x3db025[_0xdbed('0x32')];this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]][_0xdbed('0x33')]=moment()[_0xdbed('0x1c')](_0xdbed('0x1d'));this[_0xdbed('0x9')][_0x3db025['uniqueid']]['lastevent']=_0xdbed('0x34');logger[_0xdbed('0x35')](_0xdbed('0x36'),_0x3db025['uniqueid'],_0x3db025[_0xdbed('0x1f')]['substring'](_0x3db025[_0xdbed('0x1f')][_0xdbed('0x21')]('/')+0x1,_0x3db025[_0xdbed('0x1f')][_0xdbed('0x21')]('-')));logger['debug'](_0xdbed('0x37'),_0x3db025['uniqueid'],util[_0xdbed('0x1a')](this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));ami[_0xdbed('0x15')](_0xdbed('0x38'),this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]]);}logger[_0xdbed('0x17')](_0xdbed('0x39'),_0x3db025[_0xdbed('0x19')],util['inspect'](this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0xdbed('0x29'),this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]]);}}}catch(_0x3775ce){logger['error']('[%s][voiceDialReport][dialend]',_0x3db025['uniqueid'],util[_0xdbed('0x1a')](_0x3775ce,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x11')]=function(_0x27991c){try{if(this[_0xdbed('0x2e')](_0x27991c)){logger['debug'](_0xdbed('0x3a'),_0x27991c[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x27991c,{'showHidden':![],'depth':null}));this[_0xdbed('0x3b')](_0x27991c['uniqueid'],_[_0xdbed('0x3c')](_0x27991c[_0xdbed('0x3d')])[0x0],_0x27991c[_0xdbed('0x3e')]);if(this[_0xdbed('0x2e')](_0x27991c[_0xdbed('0x3d')])&&this[_0xdbed('0x2e')](_0x27991c[_0xdbed('0x3d')]['outboundrouteid'])){if(_['isUndefined'](this['channels'][_0x27991c[_0xdbed('0x19')]])){this[_0xdbed('0x9')][_0x27991c[_0xdbed('0x19')]]={'routeId':_0x27991c[_0xdbed('0x3e')],'variables':this['variables'][_0x27991c[_0xdbed('0x19')]],'motionChannel':_0xdbed('0x3f')};logger[_0xdbed('0x35')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x27991c['uniqueid'],_0x27991c[_0xdbed('0x3d')][_0xdbed('0x40')],_[_0xdbed('0x3c')](_0x27991c[_0xdbed('0x3d')])[0x0],_0x27991c[_0xdbed('0x3e')]);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x27991c[_0xdbed('0x19')],util[_0xdbed('0x1a')](this[_0xdbed('0x9')][_0x27991c[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));this[_0xdbed('0x15')](_0xdbed('0x41'),_0xdbed('0x29'),this['channels'][_0x27991c[_0xdbed('0x19')]]);}}}}catch(_0x329efc){logger[_0xdbed('0x42')](_0xdbed('0x43'),_0x27991c[_0xdbed('0x19')],util['inspect'](_0x329efc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x3b')]=function(_0x376c80,_0x1deafc,_0x572142){var _0x805235=[_0xdbed('0x44'),_0xdbed('0x45'),'rtpaudioqosjitter',_0xdbed('0x46'),_0xdbed('0x47'),_0xdbed('0x48'),_0xdbed('0x49'),_0xdbed('0x4a'),_0xdbed('0x4b'),_0xdbed('0x4c'),_0xdbed('0x4d'),_0xdbed('0x4e'),_0xdbed('0x4f'),'memberdynamic','memberinterface','memberlastcall',_0xdbed('0x26'),_0xdbed('0x50'),'memberrealtime'];if(!_['isNil'](_0x1deafc)&&!_['includes'](_0x805235,_0x1deafc)){if(_[_0xdbed('0x13')](this[_0xdbed('0xd')][_0x376c80])){this[_0xdbed('0xd')][_0x376c80]={};}this[_0xdbed('0xd')][_0x376c80][_0x1deafc]=_0x572142;}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x12')]=function(_0x46381b){try{if(this[_0xdbed('0x2e')](_0x46381b)){logger['debug'](_0xdbed('0x51'),_0x46381b[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x46381b,{'showHidden':![],'depth':null}));if(this['channels'][_0x46381b[_0xdbed('0x19')]]){logger[_0xdbed('0x35')](_0xdbed('0x52'),_0x46381b[_0xdbed('0x19')],_0x46381b[_0xdbed('0x53')]);this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x54')]=moment()[_0xdbed('0x1c')](_0xdbed('0x1d'));this['channels'][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x55')]=moment(this['channels'][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x54')])[_0xdbed('0x56')](this[_0xdbed('0x9')][_0x46381b['uniqueid']][_0xdbed('0x57')],_0xdbed('0x58'));this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x59')]=_0xdbed('0x5a');this['outbound'][_0xdbed('0x5b')]+=0x1;if(this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x33')]){this['outbound'][_0xdbed('0x5c')]+=0x1;this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]]['holdtime']=moment(this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x33')])[_0xdbed('0x56')](this[_0xdbed('0x9')][_0x46381b['uniqueid']]['starttime'],_0xdbed('0x58'));this[_0xdbed('0x9')][_0x46381b['uniqueid']][_0xdbed('0x5d')]=moment(this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]]['endtime'])[_0xdbed('0x56')](this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x33')],_0xdbed('0x58'));this[_0xdbed('0xb')][_0xdbed('0x5e')]+=this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x5f')]||0x0;this[_0xdbed('0xb')][_0xdbed('0x60')]+=this['channels'][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x5d')];}this['outbound'][_0xdbed('0x61')]+=this[_0xdbed('0x9')][_0x46381b['uniqueid']][_0xdbed('0x55')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x46381b['uniqueid'],util['inspect'](this['channels'][_0x46381b[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));ami[_0xdbed('0x15')](_0xdbed('0x62'),this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]]);logger[_0xdbed('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x46381b[_0xdbed('0x19')],util['inspect'](this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0xdbed('0x63'),this['channels'][_0x46381b['uniqueid']]);logger['debug'](_0xdbed('0x64'),_0x46381b['uniqueid'],util['inspect'](this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));this[_0xdbed('0x15')](_0xdbed('0x41'),'voice_outbound:save',this[_0xdbed('0xb')]);logger[_0xdbed('0x35')](_0xdbed('0x65'),JSON[_0xdbed('0x66')](this[_0xdbed('0x9')][_0x46381b['uniqueid']]));logger[_0xdbed('0x17')](_0xdbed('0x67'),_0x46381b['uniqueid'],util[_0xdbed('0x1a')](this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));this[_0xdbed('0x15')]('voice:outbound',_0xdbed('0x68'),this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]]);this[_0xdbed('0x69')](_0x46381b[_0xdbed('0x19')]);}else if(this[_0xdbed('0x9')][_0x46381b['linkedid']]){this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x6a')]]['uniqueid']=this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x6a')]][_0xdbed('0x6b')];}if(this[_0xdbed('0xd')][_0x46381b[_0xdbed('0x19')]]){delete this[_0xdbed('0xd')][_0x46381b['uniqueid']];}}}catch(_0x20344f){logger['error']('[%s][voiceDialReport][hangup]',_0x46381b[_0xdbed('0x19')],util['inspect'](_0x20344f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x28d1c2){try{if(this[_0xdbed('0x2e')](_0x28d1c2)){logger[_0xdbed('0x17')](_0xdbed('0x6c'),_0x28d1c2[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x28d1c2,{'showHidden':![],'depth':null}));if(_0x28d1c2['application']['toLowerCase']()==='set'){_0x28d1c2[_0xdbed('0x6d')]=(_0x28d1c2['appdata']||_0x28d1c2[_0xdbed('0x6d')])[_0xdbed('0x6e')]();if(_[_0xdbed('0x6f')](_0x28d1c2[_0xdbed('0x6d')],_0xdbed('0x70'))){if(_[_0xdbed('0x13')](this['applications'][_0x28d1c2[_0xdbed('0x19')]]))this[_0xdbed('0xc')][_0x28d1c2[_0xdbed('0x19')]]={};logger['info'](_0xdbed('0x71'),_0x28d1c2[_0xdbed('0x19')],_0x28d1c2[_0xdbed('0x72')],_0x28d1c2[_0xdbed('0x6d')]);var _0x12deec=_0x28d1c2[_0xdbed('0x6d')][_0xdbed('0x73')]('=');var _0x48f085=_0x12deec[0x0][_0xdbed('0x74')](/cdr\((.*)\)/);if(_0x48f085)this[_0xdbed('0xc')][_0x28d1c2[_0xdbed('0x19')]][_0x48f085[0x1]]=_0x12deec[0x1];}}}}catch(_0x5688df){logger[_0xdbed('0x42')]('[%s][voiceDialReport][newexten]',_0x28d1c2['uniqueid'],util[_0xdbed('0x1a')](_0x5688df,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x69')]=function(_0x529a02,_0x3b28d3=0x2710){if(this[_0xdbed('0x9')][_0x529a02]){setTimeout(()=>{delete this[_0xdbed('0x9')][_0x529a02];},_0x3b28d3);}};module[_0xdbed('0x75')]=VoiceDialReport; \ No newline at end of file +var _0xf2cc=['[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answered','holdtime','answertime','sumHoldTime','sumBillable','billableseconds','sumDuration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','match','[%s][voiceDialReport][newexten]','exports','lodash','util','../../../config/logger','ami','../ami','redis','localhost','channels','outboundChannels','outbound','variables','dialend','bind','varset','syncVarSet','hangup','prototype','isUndefined','syncDialBegin','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','format','called','channel','substring','lastIndexOf','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','applications','emit','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','YYYY-MM-DD\x20HH:mm:ss','lastevent','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','variable','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup'];(function(_0x4f4d4a,_0x21bdaa){var _0x20b807=function(_0x496ef9){while(--_0x496ef9){_0x4f4d4a['push'](_0x4f4d4a['shift']());}};_0x20b807(++_0x21bdaa);}(_0xf2cc,0x112));var _0xcf2c=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xf2cc[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xcf2c('0x0'));var moment=require('moment');var util=require(_0xcf2c('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xcf2c('0x2'))(_0xcf2c('0x3'));var ami=require(_0xcf2c('0x4'));config[_0xcf2c('0x5')]=_['defaults'](config[_0xcf2c('0x5')],{'host':_0xcf2c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcf2c('0x5')]));function VoiceDialReport(_0x35c5c7){this[_0xcf2c('0x7')]=_0x35c5c7[_0xcf2c('0x8')];this[_0xcf2c('0x9')]=_0x35c5c7[_0xcf2c('0x9')];this['applications']={};this[_0xcf2c('0xa')]={};ami['on']('dialbegin',this['syncDialBegin']['bind'](this));ami['on'](_0xcf2c('0xb'),this['syncDialEnd'][_0xcf2c('0xc')](this));ami['on'](_0xcf2c('0xd'),this[_0xcf2c('0xe')]['bind'](this));ami['on'](_0xcf2c('0xf'),this['syncHangup'][_0xcf2c('0xc')](this));}VoiceDialReport[_0xcf2c('0x10')]['isNotNull']=function(_0x2abcce){return _0x2abcce!==null&&!_[_0xcf2c('0x11')](_0x2abcce);};VoiceDialReport[_0xcf2c('0x10')]['emit']=function(_0x4f3a85,_0x1dea8f,_0x31a2a8){io['to'](_0x4f3a85)['emit'](_0x1dea8f,_0x31a2a8);};VoiceDialReport[_0xcf2c('0x10')][_0xcf2c('0x12')]=function(_0x55edf1){try{if(this[_0xcf2c('0x13')](_0x55edf1)){logger[_0xcf2c('0x14')](_0xcf2c('0x15'),_0x55edf1['uniqueid'],util[_0xcf2c('0x16')](_0x55edf1,{'showHidden':![],'depth':null}));if(this['channels'][_0x55edf1[_0xcf2c('0x17')]]){_[_0xcf2c('0x18')](this[_0xcf2c('0x7')][_0x55edf1[_0xcf2c('0x17')]],{'starttime':moment()[_0xcf2c('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xcf2c('0x1a'),'interface':_0x55edf1[_0xcf2c('0x1b')][_0xcf2c('0x1c')](0x0,_0x55edf1[_0xcf2c('0x1b')]['lastIndexOf']('-')),'membername':_0x55edf1[_0xcf2c('0x1b')][_0xcf2c('0x1c')](_0x55edf1['channel'][_0xcf2c('0x1d')]('/')+0x1,_0x55edf1['channel'][_0xcf2c('0x1d')]('-'))},_['omit'](_0x55edf1,[_0xcf2c('0x1e'),_0xcf2c('0x1f')]));logger[_0xcf2c('0x20')](_0xcf2c('0x21'),_0x55edf1['uniqueid'],this['channels'][_0x55edf1[_0xcf2c('0x17')]][_0xcf2c('0x22')],this[_0xcf2c('0x7')][_0x55edf1[_0xcf2c('0x17')]]['interface']);logger['debug'](_0xcf2c('0x23'),_0x55edf1[_0xcf2c('0x17')],util['inspect'](this[_0xcf2c('0x7')][_0x55edf1[_0xcf2c('0x17')]],{'showHidden':![],'depth':null}));if(this[_0xcf2c('0x24')][_0x55edf1['uniqueid']])_[_0xcf2c('0x18')](this[_0xcf2c('0x7')][_0x55edf1[_0xcf2c('0x17')]],this['applications'][_0x55edf1[_0xcf2c('0x17')]]);this[_0xcf2c('0x25')](_0xcf2c('0x26'),_0xcf2c('0x27'),this[_0xcf2c('0x7')][_0x55edf1[_0xcf2c('0x17')]]);logger[_0xcf2c('0x14')](_0xcf2c('0x28'),_0x55edf1[_0xcf2c('0x17')],util['inspect'](this[_0xcf2c('0x7')][_0x55edf1[_0xcf2c('0x17')]],{'showHidden':![],'depth':null}));ami[_0xcf2c('0x25')](_0xcf2c('0x29'),this[_0xcf2c('0x7')][_0x55edf1[_0xcf2c('0x17')]]);}}}catch(_0x463cc6){logger[_0xcf2c('0x2a')](_0xcf2c('0x2b'),_0x55edf1[_0xcf2c('0x17')],util[_0xcf2c('0x16')](_0x463cc6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcf2c('0x10')][_0xcf2c('0x2c')]=function(_0x2024b0){try{if(this['isNotNull'](_0x2024b0)){logger[_0xcf2c('0x14')](_0xcf2c('0x2d'),_0x2024b0[_0xcf2c('0x17')],util[_0xcf2c('0x16')](_0x2024b0,{'showHidden':![],'depth':null}));if(this['channels'][_0x2024b0[_0xcf2c('0x17')]]){this[_0xcf2c('0x7')][_0x2024b0[_0xcf2c('0x17')]]['dialstatus']=_0x2024b0[_0xcf2c('0x2e')];if(_0x2024b0[_0xcf2c('0x2e')]===_0xcf2c('0x2f')){this[_0xcf2c('0x7')][_0x2024b0[_0xcf2c('0x17')]][_0xcf2c('0x30')]=_0x2024b0['connectedlinenum'];this[_0xcf2c('0x7')][_0x2024b0[_0xcf2c('0x17')]]['connectedlinename']=_0x2024b0['connectedlinename'];this[_0xcf2c('0x7')][_0x2024b0[_0xcf2c('0x17')]]['answertime']=moment()[_0xcf2c('0x19')](_0xcf2c('0x31'));this[_0xcf2c('0x7')][_0x2024b0[_0xcf2c('0x17')]][_0xcf2c('0x32')]='connect';logger[_0xcf2c('0x20')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x2024b0['uniqueid'],_0x2024b0[_0xcf2c('0x1b')][_0xcf2c('0x1c')](_0x2024b0[_0xcf2c('0x1b')]['lastIndexOf']('/')+0x1,_0x2024b0[_0xcf2c('0x1b')]['lastIndexOf']('-')));logger['debug'](_0xcf2c('0x33'),_0x2024b0['uniqueid'],util['inspect'](this[_0xcf2c('0x7')][_0x2024b0[_0xcf2c('0x17')]],{'showHidden':![],'depth':null}));ami[_0xcf2c('0x25')]('custom:dialconnect',this[_0xcf2c('0x7')][_0x2024b0[_0xcf2c('0x17')]]);}logger['debug'](_0xcf2c('0x34'),_0x2024b0[_0xcf2c('0x17')],util[_0xcf2c('0x16')](this['channels'][_0x2024b0['uniqueid']],{'showHidden':![],'depth':null}));this[_0xcf2c('0x25')]('voice:outbound',_0xcf2c('0x27'),this[_0xcf2c('0x7')][_0x2024b0['uniqueid']]);}}}catch(_0x4fd638){logger[_0xcf2c('0x2a')](_0xcf2c('0x35'),_0x2024b0[_0xcf2c('0x17')],util[_0xcf2c('0x16')](_0x4fd638,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcf2c('0x10')][_0xcf2c('0xe')]=function(_0x31476e){try{if(this[_0xcf2c('0x13')](_0x31476e)){logger[_0xcf2c('0x14')](_0xcf2c('0x36'),_0x31476e[_0xcf2c('0x17')],util[_0xcf2c('0x16')](_0x31476e,{'showHidden':![],'depth':null}));this[_0xcf2c('0x37')](_0x31476e[_0xcf2c('0x17')],_[_0xcf2c('0x38')](_0x31476e['variable'])[0x0],_0x31476e[_0xcf2c('0x39')]);if(this['isNotNull'](_0x31476e[_0xcf2c('0x3a')])&&this[_0xcf2c('0x13')](_0x31476e['variable'][_0xcf2c('0x3b')])){if(_['isUndefined'](this[_0xcf2c('0x7')][_0x31476e['uniqueid']])){this['channels'][_0x31476e[_0xcf2c('0x17')]]={'routeId':_0x31476e['value'],'variables':this[_0xcf2c('0xa')][_0x31476e[_0xcf2c('0x17')]],'motionChannel':_0xcf2c('0x3c')};logger[_0xcf2c('0x20')](_0xcf2c('0x3d'),_0x31476e['uniqueid'],_0x31476e['variable'][_0xcf2c('0x3b')],_[_0xcf2c('0x38')](_0x31476e[_0xcf2c('0x3a')])[0x0],_0x31476e[_0xcf2c('0x39')]);logger[_0xcf2c('0x14')](_0xcf2c('0x3e'),_0x31476e[_0xcf2c('0x17')],util[_0xcf2c('0x16')](this[_0xcf2c('0x7')][_0x31476e[_0xcf2c('0x17')]],{'showHidden':![],'depth':null}));this[_0xcf2c('0x25')]('voice:outbound',_0xcf2c('0x27'),this[_0xcf2c('0x7')][_0x31476e[_0xcf2c('0x17')]]);}}}}catch(_0x568917){logger[_0xcf2c('0x2a')](_0xcf2c('0x3f'),_0x31476e[_0xcf2c('0x17')],util[_0xcf2c('0x16')](_0x568917,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcf2c('0x10')]['addVariable']=function(_0x3dc450,_0x27f97e,_0x207744){var _0x400317=['rtpaudioqos',_0xcf2c('0x40'),_0xcf2c('0x41'),'rtpaudioqosjitterbridged',_0xcf2c('0x42'),_0xcf2c('0x43'),'rtpaudioqosrtt',_0xcf2c('0x44'),_0xcf2c('0x45'),_0xcf2c('0x46'),_0xcf2c('0x47'),'bridgepvtcallid',_0xcf2c('0x48'),_0xcf2c('0x49'),'memberinterface',_0xcf2c('0x4a'),'membername',_0xcf2c('0x4b'),_0xcf2c('0x4c')];if(!_[_0xcf2c('0x4d')](_0x27f97e)&&!_[_0xcf2c('0x4e')](_0x400317,_0x27f97e)){if(_[_0xcf2c('0x11')](this[_0xcf2c('0xa')][_0x3dc450])){this['variables'][_0x3dc450]={};}this[_0xcf2c('0xa')][_0x3dc450][_0x27f97e]=_0x207744;}};VoiceDialReport['prototype'][_0xcf2c('0x4f')]=function(_0xafe30f){try{if(this[_0xcf2c('0x13')](_0xafe30f)){logger['debug'](_0xcf2c('0x50'),_0xafe30f['uniqueid'],util[_0xcf2c('0x16')](_0xafe30f,{'showHidden':![],'depth':null}));if(this['channels'][_0xafe30f[_0xcf2c('0x17')]]){logger[_0xcf2c('0x20')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0xafe30f[_0xcf2c('0x17')],_0xafe30f[_0xcf2c('0x51')]);this[_0xcf2c('0x7')][_0xafe30f['uniqueid']][_0xcf2c('0x52')]=moment()[_0xcf2c('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x53')]=moment(this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x52')])[_0xcf2c('0x54')](this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x55')],_0xcf2c('0x56'));this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x32')]=_0xcf2c('0x57');this[_0xcf2c('0x9')][_0xcf2c('0x58')]+=0x1;if(this['channels'][_0xafe30f[_0xcf2c('0x17')]]['answertime']){this[_0xcf2c('0x9')][_0xcf2c('0x59')]+=0x1;this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x5a')]=moment(this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x5b')])[_0xcf2c('0x54')](this['channels'][_0xafe30f['uniqueid']]['starttime'],'seconds');this['channels'][_0xafe30f[_0xcf2c('0x17')]]['billableseconds']=moment(this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x52')])[_0xcf2c('0x54')](this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x5b')],'seconds');this[_0xcf2c('0x9')][_0xcf2c('0x5c')]+=this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x5a')]||0x0;this[_0xcf2c('0x9')][_0xcf2c('0x5d')]+=this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x5e')];}this[_0xcf2c('0x9')][_0xcf2c('0x5f')]+=this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]][_0xcf2c('0x53')];logger[_0xcf2c('0x14')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0xafe30f[_0xcf2c('0x17')],util[_0xcf2c('0x16')](this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]],{'showHidden':![],'depth':null}));ami[_0xcf2c('0x25')](_0xcf2c('0x60'),this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]]);logger[_0xcf2c('0x14')](_0xcf2c('0x61'),_0xafe30f[_0xcf2c('0x17')],util[_0xcf2c('0x16')](this[_0xcf2c('0x7')][_0xafe30f['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xcf2c('0x25')](_0xcf2c('0x62'),this['channels'][_0xafe30f[_0xcf2c('0x17')]]);logger[_0xcf2c('0x14')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0xafe30f[_0xcf2c('0x17')],util[_0xcf2c('0x16')](this['channels'][_0xafe30f[_0xcf2c('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0xcf2c('0x26'),_0xcf2c('0x63'),this[_0xcf2c('0x9')]);logger[_0xcf2c('0x20')](_0xcf2c('0x64'),JSON['stringify'](this[_0xcf2c('0x7')][_0xafe30f['uniqueid']]));logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0xafe30f[_0xcf2c('0x17')],util[_0xcf2c('0x16')](this['channels'][_0xafe30f[_0xcf2c('0x17')]],{'showHidden':![],'depth':null}));this[_0xcf2c('0x25')]('voice:outbound',_0xcf2c('0x65'),this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x17')]]);this[_0xcf2c('0x66')](_0xafe30f[_0xcf2c('0x17')]);}else if(this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x67')]]){this['channels'][_0xafe30f[_0xcf2c('0x67')]][_0xcf2c('0x17')]=this[_0xcf2c('0x7')][_0xafe30f[_0xcf2c('0x67')]][_0xcf2c('0x68')];}if(this[_0xcf2c('0xa')][_0xafe30f['uniqueid']]){delete this['variables'][_0xafe30f[_0xcf2c('0x17')]];}}}catch(_0x22e165){logger[_0xcf2c('0x2a')](_0xcf2c('0x69'),_0xafe30f[_0xcf2c('0x17')],util['inspect'](_0x22e165,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xcf2c('0x10')][_0xcf2c('0x6a')]=function(_0x5ef0bb){try{if(this['isNotNull'](_0x5ef0bb)){logger[_0xcf2c('0x14')](_0xcf2c('0x6b'),_0x5ef0bb[_0xcf2c('0x17')],util['inspect'](_0x5ef0bb,{'showHidden':![],'depth':null}));if(_0x5ef0bb[_0xcf2c('0x6c')][_0xcf2c('0x6d')]()===_0xcf2c('0x6e')){_0x5ef0bb[_0xcf2c('0x6f')]=(_0x5ef0bb[_0xcf2c('0x70')]||_0x5ef0bb[_0xcf2c('0x6f')])[_0xcf2c('0x6d')]();if(_[_0xcf2c('0x71')](_0x5ef0bb[_0xcf2c('0x6f')],_0xcf2c('0x72'))){if(_[_0xcf2c('0x11')](this[_0xcf2c('0x24')][_0x5ef0bb[_0xcf2c('0x17')]]))this[_0xcf2c('0x24')][_0x5ef0bb[_0xcf2c('0x17')]]={};logger[_0xcf2c('0x20')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x5ef0bb['uniqueid'],_0x5ef0bb[_0xcf2c('0x6c')],_0x5ef0bb[_0xcf2c('0x6f')]);var _0x27650f=_0x5ef0bb['applicationdata']['split']('=');var _0x5af3b7=_0x27650f[0x0][_0xcf2c('0x73')](/cdr\((.*)\)/);if(_0x5af3b7)this['applications'][_0x5ef0bb['uniqueid']][_0x5af3b7[0x1]]=_0x27650f[0x1];}}}}catch(_0x429d49){logger[_0xcf2c('0x2a')](_0xcf2c('0x74'),_0x5ef0bb[_0xcf2c('0x17')],util[_0xcf2c('0x16')](_0x429d49,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xcf2c('0x66')]=function(_0x5b3bb7,_0x243261=0x2710){if(this[_0xcf2c('0x7')][_0x5b3bb7]){setTimeout(()=>{delete this[_0xcf2c('0x7')][_0x5b3bb7];},_0x243261);}};module[_0xcf2c('0x75')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 21794b3..39d9d0a 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1ee=['rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','memberdynamic','memberlastcall','memberrealtime','includes','handleHangup','sumHoldTime','length','sumDuration','milliseconds','diff','answered','queuecallercompleteAt','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][handleHangup]','cause-txt','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','transfereeuniqueid','transferexten','transferuniqueid','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transfertype','transferid','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','set','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','applicationdata','match','[%s][voiceQueueReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuemember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','queuecallerexit','switch','sequence','isNil','status','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','queue','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','format','voice_queue_presence:remove','type','name','voice_queue:save','isNotNull','clearZombieChannels','queues','[voiceQueueReport][queues]','isRunning','then','queuestatus','actionid','createQueueSummaryReport','summaryEvent','realtime','handleInboundQueueSummaryReport','assign','emitInboundVoiceQueueSummary','inbound','custom:queuesummary','statusRequests','syncQueueSummaryComplete','completeEvent','syncQueueMember','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummary]','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','pick','keys','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinename','connectedlinenum','syncAgentConnect','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','lastAssignedTo','membername','transfer','reason','COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','add','seconds','FORWARD','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','queuecallerexitAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter'];(function(_0x233894,_0x143dc9){var _0x10338b=function(_0x57cfdb){while(--_0x57cfdb){_0x233894['push'](_0x233894['shift']());}};_0x10338b(++_0x143dc9);}(_0xa1ee,0x12f));var _0xea1e=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0xa1ee[_0x49e584];return _0x58b1be;};'use strict';var _=require('lodash');var moment=require(_0xea1e('0x0'));var util=require(_0xea1e('0x1'));var Redis=require(_0xea1e('0x2'));var config=require(_0xea1e('0x3'));var logger=require(_0xea1e('0x4'))('ami');var ami=require(_0xea1e('0x5'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0xea1e('0x6')]=_[_0xea1e('0x7')](config[_0xea1e('0x6')],{'host':_0xea1e('0x8'),'port':0x18eb});var io=require(_0xea1e('0x9'))(new Redis(config[_0xea1e('0x6')]));var Sequence=function(){};Sequence[_0xea1e('0xa')][_0xea1e('0xb')]=function(_0x1ec64b){this[_0xea1e('0xc')]=this['tail']?this[_0xea1e('0xc')]['finally'](_0x1ec64b):_0x1ec64b();};function VoiceQueueReport(_0x7122a5){this['sequence']=new Sequence();this['queueReports']={};this['realtime']=_0x7122a5;this['agents']=_0x7122a5[_0xea1e('0xd')];this[_0xea1e('0xe')]=_0x7122a5[_0xea1e('0xf')];this['voiceQueues']=_0x7122a5[_0xea1e('0x10')];this[_0xea1e('0x11')]=_0x7122a5[_0xea1e('0x11')];this[_0xea1e('0x12')]=initializeSummary();this[_0xea1e('0x13')]={};ami['on'](_0xea1e('0x14'),this[_0xea1e('0x15')][_0xea1e('0x16')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x17'),this['syncQueueMember'][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x18'),this[_0xea1e('0x19')][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x1a'),this[_0xea1e('0x1b')]['bind'](this));ami['on'](_0xea1e('0x1c'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xea1e('0x1d'),this[_0xea1e('0x1e')][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x1f'),this[_0xea1e('0x20')][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x21'),this['syncAgentConnect']['bind'](this));ami['on'](_0xea1e('0x22'),this['syncVarSet'][_0xea1e('0x16')](this));ami['on']('hangup',this[_0xea1e('0x23')][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x24'),this[_0xea1e('0x25')]['bind'](this));ami['on'](_0xea1e('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xea1e('0x27'),this[_0xea1e('0x28')][_0xea1e('0x16')](this));ami['on']('attendedtransfer',this[_0xea1e('0x29')]['bind'](this));ami['on'](_0xea1e('0x2a'),this['syncBlindTransfer'][_0xea1e('0x16')](this));this[_0xea1e('0x2b')]();this[_0xea1e('0x2c')]();}function clearChannels(_0x59365b){if(!_[_0xea1e('0x2d')](_0x59365b)){for(var _0x1f23f7 in _0x59365b){if(_0x59365b[_0xea1e('0x2e')](_0x1f23f7)){delete _0x59365b[_0x1f23f7];}}}}function clearCampaigns(_0x27129f){if(!_[_0xea1e('0x2d')](_0x27129f)){for(var _0xd3f518 in _0x27129f){if(_0x27129f[_0xea1e('0x2e')](_0xd3f518)){_0x27129f[_0xd3f518][_0xea1e('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x319341){if(!_[_0xea1e('0x2d')](_0x319341)){for(var _0x53e58d in _0x319341){if(_0x319341['hasOwnProperty'](_0x53e58d)){_0x319341[_0x53e58d][_0xea1e('0x2f')]=0x0;_0x319341[_0x53e58d][_0xea1e('0x30')]=0x0;_0x319341[_0x53e58d][_0xea1e('0x31')]=0x0;_0x319341[_0x53e58d]['waiting']=0x0;_0x319341[_0x53e58d][_0xea1e('0x32')]=!![];}}}}function clearAgentBooked(_0x53309a){if(!_[_0xea1e('0x2d')](_0x53309a)){for(var _0x45399b in _0x53309a){if(_0x53309a[_0xea1e('0x2e')](_0x45399b)){_0x53309a[_0x45399b][_0xea1e('0x33')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x25fd57){return _0x25fd57[_0xea1e('0x34')]||_0x25fd57['queuecallerabandon']||_0x25fd57['queuecallercomplete'];}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x1f19ca=this;for(var _0x82e8be in this[_0xea1e('0xe')]){if(this[_0xea1e('0xe')][_0xea1e('0x2e')](_0x82e8be)&&!this[_0xea1e('0xe')][_0x82e8be][_0xea1e('0x35')]){this[_0xea1e('0x36')][_0xea1e('0xb')](function(){if(!_[_0xea1e('0x37')](_0x1f19ca['channels'][_0x82e8be])){return ami['Action']({'action':_0xea1e('0x38'),'channel':_0x1f19ca['channels'][_0x82e8be]['channel']})[_0xea1e('0x39')](function(_0x1f862e){if(_0x1f862e[_0xea1e('0x3a')]===_0xea1e('0x3b')){setTimeout(function(){if(_0x1f19ca[_0xea1e('0xe')][_0x82e8be]){delete _0x1f19ca[_0xea1e('0xe')][_0x82e8be];logger[_0xea1e('0x3c')](_0xea1e('0x3d'),_0x82e8be,util[_0xea1e('0x3e')](_0x1f862e,{'showHidden':![],'depth':null}));}if(_0x1f19ca[_0xea1e('0x3f')][_0x82e8be]){delete _0x1f19ca[_0xea1e('0x3f')][_0x82e8be];logger[_0xea1e('0x3c')](_0xea1e('0x40'),_0x82e8be,util[_0xea1e('0x3e')](_0x1f862e,{'showHidden':![],'depth':null}));}if(_0x1f19ca[_0xea1e('0x13')][_0x82e8be]){delete _0x1f19ca[_0xea1e('0x13')][_0x82e8be];logger['error'](_0xea1e('0x41'),_0x82e8be,util['inspect'](_0x1f862e,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0xea1e('0x3c')](_0xea1e('0x42'));clearChannels(this[_0xea1e('0xe')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this[_0xea1e('0xd')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xea1e('0x11')]);this[_0xea1e('0x12')]=initializeSummary();};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x43')]=function(_0xf18ac9){var _0x522388=this;if(!_['isEmpty'](_0xf18ac9)){for(var _0x2ce997 in _0xf18ac9){if(_0xf18ac9[_0xea1e('0x2e')](_0x2ce997)){_0x522388[_0xea1e('0x44')](_0xf18ac9[_0x2ce997],_0xea1e('0x45'));delete _0xf18ac9[_0x2ce997];}}}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x46')]=function(_0x13b1d5,_0x17f0f1,_0x37d56e){io['to'](_0x13b1d5)[_0xea1e('0x46')](_0x17f0f1,_0x37d56e);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x47')]=function(_0x520298,_0x16c0c3){logger[_0xea1e('0x48')](_0xea1e('0x49')+_0x16c0c3+_0xea1e('0x4a'),_0x520298[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x520298,{'showHidden':![],'depth':null}));this[_0xea1e('0x46')](util['format']('voice:queue:%s',_0x520298[_0xea1e('0x4c')]),_0xea1e('0x4d'),_0x520298);io['emit']('voice_queue_presence:save',_0x520298);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x44')]=function(_0xad3c4,_0x3407e8){logger[_0xea1e('0x48')](_0xea1e('0x49')+_0x3407e8+_0xea1e('0x4e'),_0xad3c4['uniqueid'],util['inspect'](_0xad3c4,{'showHidden':![],'depth':null}));if(_0xad3c4[_0xea1e('0x4f')]===_0xea1e('0x50')){return;}this[_0xea1e('0x46')](util[_0xea1e('0x51')]('voice:queue:%s',_0xad3c4[_0xea1e('0x4c')]),'voice_queue_channel:remove',_0xad3c4);io[_0xea1e('0x46')](_0xea1e('0x52'),_0xad3c4);};VoiceQueueReport[_0xea1e('0xa')]['emitInboundVoiceQueueSummary']=function(_0x1d0557){if(_0x1d0557[_0xea1e('0x53')]==='inbound'){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xea1e('0x3e')](_0x1d0557,{'showHidden':![],'depth':null}));this[_0xea1e('0x46')](util[_0xea1e('0x51')]('voice:queue:%s',_0x1d0557[_0xea1e('0x54')]),_0xea1e('0x55'),_0x1d0557);}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x56')]=function(_0x57fbf7){return _0x57fbf7!==null&&!_['isUndefined'](_0x57fbf7);};VoiceQueueReport[_0xea1e('0xa')]['loopQueueShow']=function(){var _0x578463=this;setInterval(function(){_0x578463[_0xea1e('0x57')]();ami['Action']({'action':_0xea1e('0x58')})[_0xea1e('0x39')](function(_0x396f99){logger['error'](_0xea1e('0x59'),util[_0xea1e('0x3e')](_0x396f99,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x2b')]=function(){var _0x463a8c=this;setInterval(function(){if(!_0x463a8c[_0xea1e('0x12')][_0xea1e('0x5a')]){return ami['Action']({'action':_0xea1e('0x14')})[_0xea1e('0x5b')](function(_0x98d992){_0x463a8c[_0xea1e('0x12')]['id']=_0x98d992['actionid'];_0x463a8c[_0xea1e('0x12')][_0xea1e('0x5a')]=!![];_0x463a8c[_0xea1e('0x12')][_0xea1e('0x5c')][_0x98d992[_0xea1e('0x5d')]]={};})[_0xea1e('0x39')](function(_0x3a981e){logger[_0xea1e('0x3c')]('[voiceQueueReport][queuesummary]',util[_0xea1e('0x3e')](_0x3a981e,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x5e')]=function(_0xb314bc,_0x238952){var _0x198d22;if(this[_0xea1e('0x12')]&&this[_0xea1e('0x12')]['queues']&&this['summary'][_0xea1e('0x58')][_0xb314bc[_0xea1e('0x54')]]){_0x198d22=this['summary'][_0xea1e('0x58')][_0xb314bc[_0xea1e('0x54')]][_0xea1e('0x5f')];}var _0xf6717c=new VoiceQueueSummary(_0xb314bc);return _0xf6717c['createReport'](_0x238952[_0xea1e('0xd')],this['agents'],_0x198d22,this[_0xea1e('0x60')][_0xea1e('0xe')]);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x61')]=function(_0x3620c0,_0x1cc91b){var _0x383183=this[_0xea1e('0x5e')](_0x3620c0,_0x1cc91b);var _0x4f88c3=![];_0x4f88c3=_0x383183['compareToInboundQueue'](_0x3620c0);if(_0x4f88c3){Object[_0xea1e('0x62')](_0x3620c0,_0x383183);this[_0xea1e('0x60')][_0xea1e('0x10')][_0x3620c0[_0xea1e('0x54')]]=_0x3620c0;this[_0xea1e('0x63')](_0x383183);}};VoiceQueueReport[_0xea1e('0xa')]['syncQueueStatusComplete']=function(_0x3d43b9){var _0x2e0747=null;var _0x40e5e5=this['summary']['id'];if(this[_0xea1e('0x12')]['queuestatus'][_0x40e5e5]){_0x2e0747=this[_0xea1e('0x12')][_0xea1e('0x5c')][_0x40e5e5][_0x3d43b9[_0xea1e('0x5d')]];}if(!_0x2e0747){this['summary']=initializeSummary();return;}var _0x8f5a8e=this[_0xea1e('0x10')][_0x2e0747['queue']];if(_0x8f5a8e[_0xea1e('0x53')]===_0xea1e('0x64')){this['handleInboundQueueSummaryReport'](_0x8f5a8e,_0x2e0747);}else if(_0x8f5a8e[_0xea1e('0x53')]==='outbound'){var _0x40bd0d=this['createQueueSummaryReport'](_0x8f5a8e,_0x2e0747);ami[_0xea1e('0x46')](_0xea1e('0x65'),_0x40bd0d);}this[_0xea1e('0x12')][_0xea1e('0x66')]-=0x1;var _0x20c55a=this[_0xea1e('0x12')]['statusRequests']>0x0?!![]:![];if(!_0x20c55a){return this[_0xea1e('0x67')](this[_0xea1e('0x12')][_0xea1e('0x68')]);}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x69')]=function(_0x4df930){var _0x3bdef4=this[_0xea1e('0x12')]['id'];if(this['summary'][_0xea1e('0x5c')][_0x3bdef4]&&this[_0xea1e('0x12')][_0xea1e('0x5c')][_0x3bdef4][_0x4df930[_0xea1e('0x5d')]]){this['summary'][_0xea1e('0x5c')][_0x3bdef4][_0x4df930[_0xea1e('0x5d')]]['agents']['push'](_0x4df930);}};VoiceQueueReport[_0xea1e('0xa')]['syncQueueSummary']=function(_0x19e1e2){var _0x2db94a=this;try{if(this['isNotNull'](_0x19e1e2)&&this['isNotNull'](_0x19e1e2[_0xea1e('0x4c')])){logger[_0xea1e('0x48')](_0xea1e('0x6a'),util['inspect'](_0x19e1e2,{'showHidden':![],'depth':null}));var _0x1edd96=this[_0xea1e('0x10')][_0x19e1e2[_0xea1e('0x4c')]];if(_0x1edd96){logger[_0xea1e('0x48')](_0xea1e('0x6b'),_0x1edd96[_0xea1e('0x54')]);this[_0xea1e('0x12')][_0xea1e('0x58')][_0x1edd96[_0xea1e('0x54')]]={'summaryEvent':_0x19e1e2};this[_0xea1e('0x12')][_0xea1e('0x66')]+=0x1;return ami['Action']({'action':_0xea1e('0x5c'),'queue':_0x1edd96['name']})[_0xea1e('0x5b')](function(_0x145ae0){if(!_0x2db94a[_0xea1e('0x12')][_0xea1e('0x5c')][_0x19e1e2[_0xea1e('0x5d')]]){_0x2db94a[_0xea1e('0x12')][_0xea1e('0x5c')][_0x19e1e2['actionid']]={};}_0x2db94a[_0xea1e('0x12')][_0xea1e('0x5c')][_0x19e1e2[_0xea1e('0x5d')]][_0x145ae0[_0xea1e('0x5d')]]={'queue':_0x1edd96[_0xea1e('0x54')],'agents':[]};})[_0xea1e('0x39')](function(_0x4d5854){throw _0x4d5854;});}}}catch(_0x3d77ef){logger[_0xea1e('0x3c')](_0xea1e('0x6c'),util[_0xea1e('0x3e')](_0x3d77ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x67')]=function(_0x675ca2){if(this['summary'][_0xea1e('0x66')]>0x0){this['summary'][_0xea1e('0x68')]=_0x675ca2;return;}logger[_0xea1e('0x48')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xea1e('0x3e')](_0x675ca2,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x1b')]=function(_0x5d4fbd){try{if(this['isNotNull'](_0x5d4fbd)){logger[_0xea1e('0x48')](_0xea1e('0x6d'),_0x5d4fbd['uniqueid'],util[_0xea1e('0x3e')](_0x5d4fbd,{'showHidden':![],'depth':null}));if(_[_0xea1e('0x6e')](this['queueReports'][_0x5d4fbd[_0xea1e('0x4b')]])){this[_0xea1e('0x3f')][_0x5d4fbd[_0xea1e('0x4b')]]=[];}if(_[_0xea1e('0x6e')](this[_0xea1e('0xe')][_0x5d4fbd[_0xea1e('0x4b')]])){this[_0xea1e('0xe')][_0x5d4fbd['uniqueid']]={};}var _0x563a38=new QueueReport();_0x563a38[_0xea1e('0x4c')]=_0x5d4fbd[_0xea1e('0x4c')];_0x563a38['type']=this['voiceQueues'][_0x563a38['queue']]&&this['voiceQueues'][_0x563a38[_0xea1e('0x4c')]]['type']?this['voiceQueues'][_0x563a38['queue']][_0xea1e('0x53')]||_0xea1e('0x64'):_0xea1e('0x64');_0x563a38[_0xea1e('0x6f')]=moment()[_0xea1e('0x51')](_0xea1e('0x70'));_0x563a38['position']=_0x5d4fbd[_0xea1e('0x71')];_0x563a38[_0xea1e('0x72')]=_0x5d4fbd[_0xea1e('0x72')];_0x563a38[_0xea1e('0x4b')]=_0x5d4fbd[_0xea1e('0x4b')];logger[_0xea1e('0x73')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x563a38[_0xea1e('0x4c')],_0x563a38['type']);Object[_0xea1e('0x62')](_0x563a38,_[_0xea1e('0x74')](_0x5d4fbd,_[_0xea1e('0x75')](_0x563a38)));this[_0xea1e('0x3f')][_0x5d4fbd['uniqueid']]['push'](_0x563a38);this['channels'][_0x5d4fbd[_0xea1e('0x4b')]]=_0x563a38;this['emitVoiceQueueChannelSave'](_0x563a38,_0xea1e('0x1a'));}}catch(_0x215f23){logger[_0xea1e('0x3c')](_0xea1e('0x6d'),_0x5d4fbd['uniqueid'],util[_0xea1e('0x3e')](_0x215f23,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x76')]=function(_0x26ca0f){try{if(this[_0xea1e('0x56')](_0x26ca0f)){logger[_0xea1e('0x48')](_0xea1e('0x77'),_0x26ca0f[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x26ca0f,{'showHidden':![],'depth':null}));if(this[_0xea1e('0x3f')][_0x26ca0f['uniqueid']]){var _0x224746=_[_0xea1e('0x78')](this[_0xea1e('0x3f')][_0x26ca0f[_0xea1e('0x4b')]]);_0x224746[_0xea1e('0x79')]=![];_0x224746['queuecallercompleteAt']=null;_0x224746['holdtime']=_0x26ca0f[_0xea1e('0x7a')];_0x224746[_0xea1e('0x7b')]=_0x26ca0f[_0xea1e('0x7b')];_0x224746[_0xea1e('0x1c')]=!![];_0x224746[_0xea1e('0x7c')]=moment()[_0xea1e('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x224746[_0xea1e('0x4f')]='ABANDONED';_0x224746['lastAssignedTo']=null;logger['info'](_0xea1e('0x7d'),_0x224746['queue'],_0x224746[_0xea1e('0x53')]);this[_0xea1e('0xe')][_0x26ca0f[_0xea1e('0x4b')]]=_0x224746;this[_0xea1e('0x44')](_0x224746,_0xea1e('0x1c'));}}}catch(_0x1236f0){logger[_0xea1e('0x3c')](_0xea1e('0x77'),_0x26ca0f['uniqueid'],util[_0xea1e('0x3e')](_0x1236f0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')]['syncQueueCallerLeave']=function(_0xc4a9ed){try{if(this['isNotNull'](_0xc4a9ed)){logger[_0xea1e('0x48')](_0xea1e('0x7e'),_0xc4a9ed[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0xc4a9ed,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xc4a9ed[_0xea1e('0x4b')]]){var _0x3283ce=_[_0xea1e('0x78')](this[_0xea1e('0x3f')][_0xc4a9ed[_0xea1e('0x4b')]]);_0x3283ce[_0xea1e('0x7f')]=moment()[_0xea1e('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x3283ce['connectedlinenum']=_0xc4a9ed['connectedlinenum'];_0x3283ce[_0xea1e('0x80')]=_0xc4a9ed[_0xea1e('0x80')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3283ce[_0xea1e('0x4c')],_0x3283ce[_0xea1e('0x53')],_0xc4a9ed[_0xea1e('0x81')],_0xc4a9ed['connectedlinename']);this[_0xea1e('0xe')][_0xc4a9ed['uniqueid']]=_0x3283ce;this[_0xea1e('0x47')](_0x3283ce,_0xea1e('0x1d'));}}}catch(_0x4502d5){logger[_0xea1e('0x3c')](_0xea1e('0x7e'),_0xc4a9ed[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x4502d5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x82')]=function(_0x24fd31){try{if(this[_0xea1e('0x56')](_0x24fd31)){logger[_0xea1e('0x48')]('[%s][voiceQueueReport][agentconnect]',_0x24fd31[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x24fd31,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x24fd31[_0xea1e('0x4b')]]){var _0x59ad13=_[_0xea1e('0x78')](this[_0xea1e('0x3f')][_0x24fd31[_0xea1e('0x4b')]]);_0x59ad13[_0xea1e('0x79')]=!![];_0x59ad13[_0xea1e('0x4f')]=_0xea1e('0x83');logger[_0xea1e('0x73')](_0xea1e('0x84'),_0x59ad13['queue'],_0x59ad13[_0xea1e('0x53')]);}}}catch(_0xb8ca31){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x24fd31[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0xb8ca31,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0xbd70e){try{if(this[_0xea1e('0x56')](_0xbd70e)){logger[_0xea1e('0x48')]('[%s][voiceQueueReport][agentcomplete]',_0xbd70e['uniqueid'],util[_0xea1e('0x3e')](_0xbd70e,{'showHidden':![],'depth':null}));if(this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x4b')]]){var _0x4e7d75=_['last'](this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x4b')]]);_0x4e7d75[_0xea1e('0x1c')]=![];_0x4e7d75[_0xea1e('0x7c')]=null;_0x4e7d75['assigned']=!![];_0x4e7d75[_0xea1e('0x85')]=_0xbd70e[_0xea1e('0x86')];_0x4e7d75[_0xea1e('0x7a')]=_0xbd70e['holdtime'];_0x4e7d75[_0xea1e('0x79')]=!![];_0x4e7d75[_0xea1e('0x34')]=![];_0x4e7d75['queuecallerexitAt']=null;if(!_0x4e7d75[_0xea1e('0x87')]){if(_0xbd70e[_0xea1e('0x88')]==_0xea1e('0x87')){_0x4e7d75[_0xea1e('0x4f')]=_0xea1e('0x89');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4e7d75[_0xea1e('0x4c')],_0x4e7d75[_0xea1e('0x53')]);}else{if(_[_0xea1e('0x8a')](_0xbd70e[_0xea1e('0x8b')][_0xea1e('0x8c')](),_0xea1e('0x8d'))){if(this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x8e')]]){var _0x52de4f=_[_0xea1e('0x78')](this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x8e')]]);_0x52de4f[_0xea1e('0x79')]=![];_0x52de4f[_0xea1e('0x34')]=!![];_0x52de4f['queuecallerexitAt']=moment(_0x4e7d75['queuecallerjoinAt'])[_0xea1e('0x8f')](_0xbd70e['holdtime'],_0xea1e('0x90'))[_0xea1e('0x51')](_0xea1e('0x70'));_0x52de4f[_0xea1e('0x4f')]='FORWARDTRANSFER';_0x52de4f['transfer']=!![];_0x52de4f['transfertype']=_0xea1e('0x91');_0x52de4f['transferexten']=_0xbd70e[_0xea1e('0x92')];_0x52de4f['transferuniqueid']=_0xbd70e[_0xea1e('0x4b')];logger[_0xea1e('0x73')](_0xea1e('0x93'),_0x52de4f[_0xea1e('0x4c')],_0x52de4f[_0xea1e('0x53')]);var _0x459e98=this['queueReports'][_0xbd70e[_0xea1e('0x8e')]];this[_0xea1e('0x3f')][_0xbd70e['linkedid']]=this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x4b')]];this['queueReports'][_0xbd70e[_0xea1e('0x4b')]]=_0x459e98;}}else{_0x4e7d75[_0xea1e('0x4f')]=_0xea1e('0x94')+_0xbd70e[_0xea1e('0x88')][_0xea1e('0x95')]();logger[_0xea1e('0x73')](_0xea1e('0x96'),_0x4e7d75['queue'],_0x4e7d75['type'],_0x4e7d75[_0xea1e('0x4f')]);}}}this[_0xea1e('0xe')][_0xbd70e['uniqueid']]=_0x4e7d75;}}}catch(_0x41dd1a){logger[_0xea1e('0x3c')](_0xea1e('0x97'),_0xbd70e['uniqueid'],util['inspect'](_0x41dd1a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')]['syncVarSet']=function(_0x414764){try{if(this[_0xea1e('0x56')](_0x414764)){logger['debug']('[%s][voiceQueueReport][varset]',_0x414764[_0xea1e('0x4b')],util['inspect'](_0x414764,{'showHidden':![],'depth':null}));this['addVariable'](_0x414764[_0xea1e('0x4b')],_[_0xea1e('0x75')](_0x414764[_0xea1e('0x98')])[0x0],_0x414764[_0xea1e('0x99')]);if(this[_0xea1e('0x3f')][_0x414764[_0xea1e('0x4b')]]){var _0x2c2764=_[_0xea1e('0x78')](this['queueReports'][_0x414764[_0xea1e('0x4b')]]);if(_0x2c2764){if(this[_0xea1e('0x56')](_0x414764[_0xea1e('0x98')])&&this['isNotNull'](_0x414764['variable'][_0xea1e('0x5c')])){switch(_0x414764[_0xea1e('0x99')]){case _0xea1e('0x9a'):_0x2c2764[_0xea1e('0x34')]=![];_0x2c2764['queuecallerexitAt']=null;break;case _0xea1e('0x9b'):_0x2c2764[_0xea1e('0x9c')]=_0xea1e('0x9d');_0x2c2764['queuecallerexit']=!![];_0x2c2764[_0xea1e('0x9e')]=moment()[_0xea1e('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c2764[_0xea1e('0x7f')]=moment()['format'](_0xea1e('0x70'));logger[_0xea1e('0x48')](_0xea1e('0x9f'),_0x414764['uniqueid'],util[_0xea1e('0x3e')](_0x2c2764,{'showHidden':![],'depth':null}));ami[_0xea1e('0x46')](_0xea1e('0xa0'),_0x2c2764);break;default:_0x2c2764[_0xea1e('0x34')]=!![];_0x2c2764[_0xea1e('0x9e')]=moment()['format'](_0xea1e('0x70'));_0x2c2764[_0xea1e('0x7f')]=moment()[_0xea1e('0x51')](_0xea1e('0x70'));}_0x2c2764[_0xea1e('0x1c')]=![];_0x2c2764[_0xea1e('0x7c')]=null;_0x2c2764[_0xea1e('0x4f')]=_0x414764['value'];this[_0xea1e('0xe')][_0x414764['uniqueid']]=_0x2c2764;this[_0xea1e('0x44')](_0x2c2764,_0xea1e('0x22'));}else if(this['isNotNull'](_0x414764[_0xea1e('0x98')])&&this['isNotNull'](_0x414764[_0xea1e('0x98')][_0xea1e('0xa1')])){if(!_0x2c2764[_0xea1e('0x1c')]){_0x2c2764[_0xea1e('0x34')]=!![];_0x2c2764[_0xea1e('0x9e')]=moment()[_0xea1e('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c2764[_0xea1e('0x4f')]=_0xea1e('0xa2');_0x2c2764[_0xea1e('0x7f')]=moment()[_0xea1e('0x51')](_0xea1e('0x70'));this['channels'][_0x414764[_0xea1e('0x4b')]]=_0x2c2764;}}logger[_0xea1e('0x73')](_0xea1e('0xa3'),_0x414764[_0xea1e('0x4b')],_0x2c2764[_0xea1e('0x4c')],_0x2c2764['type'],_[_0xea1e('0x75')](_0x414764[_0xea1e('0x98')])[0x0],_0x414764[_0xea1e('0x99')]);_0x2c2764[_0xea1e('0x13')]=this[_0xea1e('0x13')][_0x414764[_0xea1e('0x4b')]];}}}}catch(_0x37b184){logger[_0xea1e('0x3c')](_0xea1e('0xa4'),_0x414764[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x37b184,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xea1e('0xa5')]=function(_0x6005e6,_0x5c5d89,_0x1c238d){var _0x3b25c4=[_0xea1e('0xa6'),_0xea1e('0xa7'),_0xea1e('0xa8'),'rtpaudioqosjitterbridged',_0xea1e('0xa9'),'rtpaudioqoslossbridged',_0xea1e('0xaa'),_0xea1e('0xab'),_0xea1e('0xac'),'sipuri','bridgepeer','bridgepvtcallid','membercalls',_0xea1e('0xad'),'memberinterface',_0xea1e('0xae'),_0xea1e('0x86'),'memberpenalty',_0xea1e('0xaf')];if(!_[_0xea1e('0x37')](_0x5c5d89)&&!_[_0xea1e('0xb0')](_0x3b25c4,_0x5c5d89)){if(_[_0xea1e('0x6e')](this[_0xea1e('0x13')][_0x6005e6])){this[_0xea1e('0x13')][_0x6005e6]={};}this[_0xea1e('0x13')][_0x6005e6][_0x5c5d89]=_0x1c238d;}};VoiceQueueReport['prototype'][_0xea1e('0xb1')]=function(_0x2a9042,_0x19304e,_0x4a9a19){try{var _0x3863e={};if(this['queueReports'][_0x2a9042]){for(var _0x1ba3fb=0x0;_0x1ba3fb{delete this[_0xea1e('0xe')][_0x193e8e];},_0x4a3d11);}};module[_0xea1e('0xeb')]=VoiceQueueReport; \ No newline at end of file +var _0x341f=['queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','channels','switch','sequence','Action','status','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkQueueReport]','inspect','prototype','[FullyBooted]\x20clear\x20realtime','clearQueueReport','summary','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','voice:queue:%s','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','format','queue','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','loopQueueShow','queues','[voiceQueueReport][queues]','actionid','isRunning','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','outbound','statusRequests','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20event:','then','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','position','count','info','pick','keys','emitVoiceQueueChannelSave','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','variable','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','value','queueposition','[%s][voiceQueueReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','membername','memberpenalty','memberrealtime','isNil','includes','length','sumHoldTime','diff','sumDuration','milliseconds','total','answered','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','handleHangup','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDED','transferuniqueid','transfertargetuniqueid','transferexten','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','split','match','moment','ioredis','../../../config/environment','../../../config/logger','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','queueReports','realtime','agents','queueChannels','voiceQueues','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueMember','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','pTalking','waiting'];(function(_0x37f748,_0x2086d5){var _0x257918=function(_0x5e3b29){while(--_0x5e3b29){_0x37f748['push'](_0x37f748['shift']());}};_0x257918(++_0x2086d5);}(_0x341f,0x1b5));var _0xf341=function(_0x2a748c,_0x32dd84){_0x2a748c=_0x2a748c-0x0;var _0x27fc76=_0x341f[_0x2a748c];return _0x27fc76;};'use strict';var _=require('lodash');var moment=require(_0xf341('0x0'));var util=require('util');var Redis=require(_0xf341('0x1'));var config=require(_0xf341('0x2'));var logger=require(_0xf341('0x3'))('ami');var ami=require(_0xf341('0x4'));var QueueReport=require(_0xf341('0x5'));var VoiceQueueSummary=require(_0xf341('0x6'));config[_0xf341('0x7')]=_[_0xf341('0x8')](config['redis'],{'host':_0xf341('0x9'),'port':0x18eb});var io=require(_0xf341('0xa'))(new Redis(config[_0xf341('0x7')]));var Sequence=function(){};Sequence['prototype'][_0xf341('0xb')]=function(_0x631e71){this[_0xf341('0xc')]=this['tail']?this[_0xf341('0xc')][_0xf341('0xd')](_0x631e71):_0x631e71();};function VoiceQueueReport(_0x24d3c4){this['sequence']=new Sequence();this[_0xf341('0xe')]={};this[_0xf341('0xf')]=_0x24d3c4;this[_0xf341('0x10')]=_0x24d3c4[_0xf341('0x10')];this['channels']=_0x24d3c4[_0xf341('0x11')];this[_0xf341('0x12')]=_0x24d3c4[_0xf341('0x12')];this['campaigns']=_0x24d3c4[_0xf341('0x13')];this['summary']=initializeSummary();this[_0xf341('0x14')]={};ami['on'](_0xf341('0x15'),this['syncQueueSummary'][_0xf341('0x16')](this));ami['on'](_0xf341('0x17'),this[_0xf341('0x18')][_0xf341('0x16')](this));ami['on']('queuemember',this[_0xf341('0x19')][_0xf341('0x16')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xf341('0x16')](this));ami['on']('queuecallerjoin',this[_0xf341('0x1a')][_0xf341('0x16')](this));ami['on'](_0xf341('0x1b'),this[_0xf341('0x1c')][_0xf341('0x16')](this));ami['on'](_0xf341('0x1d'),this[_0xf341('0x1e')][_0xf341('0x16')](this));ami['on'](_0xf341('0x1f'),this[_0xf341('0x20')]['bind'](this));ami['on'](_0xf341('0x21'),this[_0xf341('0x22')][_0xf341('0x16')](this));ami['on'](_0xf341('0x23'),this[_0xf341('0x24')]['bind'](this));ami['on'](_0xf341('0x25'),this[_0xf341('0x26')][_0xf341('0x16')](this));ami['on'](_0xf341('0x27'),this[_0xf341('0x28')][_0xf341('0x16')](this));ami['on'](_0xf341('0x29'),this[_0xf341('0x2a')][_0xf341('0x16')](this));ami['on'](_0xf341('0x2b'),this['syncMusicOnHoldStop'][_0xf341('0x16')](this));ami['on'](_0xf341('0x2c'),this['syncAttendedTransfer'][_0xf341('0x16')](this));ami['on'](_0xf341('0x2d'),this[_0xf341('0x2e')][_0xf341('0x16')](this));this[_0xf341('0x2f')]();this['loopQueueShow']();}function clearChannels(_0x48bd5a){if(!_[_0xf341('0x30')](_0x48bd5a)){for(var _0x51ce17 in _0x48bd5a){if(_0x48bd5a[_0xf341('0x31')](_0x51ce17)){delete _0x48bd5a[_0x51ce17];}}}}function clearCampaigns(_0x350771){if(!_[_0xf341('0x30')](_0x350771)){for(var _0x222b0a in _0x350771){if(_0x350771[_0xf341('0x31')](_0x222b0a)){_0x350771[_0x222b0a][_0xf341('0x32')]=0x0;}}}}function clearVoiceQueues(_0x2c39af){if(!_[_0xf341('0x30')](_0x2c39af)){for(var _0x7d7a31 in _0x2c39af){if(_0x2c39af[_0xf341('0x31')](_0x7d7a31)){_0x2c39af[_0x7d7a31][_0xf341('0x32')]=0x0;_0x2c39af[_0x7d7a31]['talking']=0x0;_0x2c39af[_0x7d7a31][_0xf341('0x33')]=0x0;_0x2c39af[_0x7d7a31][_0xf341('0x34')]=0x0;_0x2c39af[_0x7d7a31][_0xf341('0x35')]=!![];}}}}function clearAgentBooked(_0x44bfc6){if(!_[_0xf341('0x30')](_0x44bfc6)){for(var _0x246da6 in _0x44bfc6){if(_0x44bfc6[_0xf341('0x31')](_0x246da6)){_0x44bfc6[_0x246da6][_0xf341('0x36')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x5aa20f){return _0x5aa20f[_0xf341('0x37')]||_0x5aa20f[_0xf341('0x1b')]||_0x5aa20f[_0xf341('0x38')];}VoiceQueueReport['prototype'][_0xf341('0x39')]=function(){var _0x3c3e67=this;for(var _0x1edba3 in this[_0xf341('0x3a')]){if(this[_0xf341('0x3a')][_0xf341('0x31')](_0x1edba3)&&!this['channels'][_0x1edba3][_0xf341('0x3b')]){this[_0xf341('0x3c')][_0xf341('0xb')](function(){if(!_['isNil'](_0x3c3e67[_0xf341('0x3a')][_0x1edba3])){return ami[_0xf341('0x3d')]({'action':_0xf341('0x3e'),'channel':_0x3c3e67[_0xf341('0x3a')][_0x1edba3]['channel']})[_0xf341('0x3f')](function(_0x43098c){if(_0x43098c[_0xf341('0x40')]===_0xf341('0x41')){setTimeout(function(){if(_0x3c3e67['channels'][_0x1edba3]){delete _0x3c3e67[_0xf341('0x3a')][_0x1edba3];logger[_0xf341('0x42')]('[%s][voiceQueueReport][checkChannel]',_0x1edba3,util['inspect'](_0x43098c,{'showHidden':![],'depth':null}));}if(_0x3c3e67['queueReports'][_0x1edba3]){delete _0x3c3e67[_0xf341('0xe')][_0x1edba3];logger[_0xf341('0x42')](_0xf341('0x43'),_0x1edba3,util[_0xf341('0x44')](_0x43098c,{'showHidden':![],'depth':null}));}if(_0x3c3e67['variables'][_0x1edba3]){delete _0x3c3e67['variables'][_0x1edba3];logger['error']('[%s][voiceQueueReport][checkVariables]',_0x1edba3,util[_0xf341('0x44')](_0x43098c,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x28')]=function(){logger[_0xf341('0x42')](_0xf341('0x46'));clearChannels(this[_0xf341('0x3a')]);this[_0xf341('0x47')](this['queueReports']);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0xf341('0x12')]);clearCampaigns(this['campaigns']);this[_0xf341('0x48')]=initializeSummary();};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x47')]=function(_0x209ca0){var _0x42a3da=this;if(!_[_0xf341('0x30')](_0x209ca0)){for(var _0x4782dc in _0x209ca0){if(_0x209ca0[_0xf341('0x31')](_0x4782dc)){_0x42a3da[_0xf341('0x49')](_0x209ca0[_0x4782dc],_0xf341('0x4a'));delete _0x209ca0[_0x4782dc];}}}};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x4b')]=function(_0x32438d,_0x5e9a12,_0x10f9b6){io['to'](_0x32438d)[_0xf341('0x4b')](_0x5e9a12,_0x10f9b6);};VoiceQueueReport[_0xf341('0x45')]['emitVoiceQueueChannelSave']=function(_0x2ef209,_0x14f401){logger[_0xf341('0x4c')](_0xf341('0x4d')+_0x14f401+_0xf341('0x4e'),_0x2ef209['uniqueid'],util[_0xf341('0x44')](_0x2ef209,{'showHidden':![],'depth':null}));this[_0xf341('0x4b')](util['format'](_0xf341('0x4f'),_0x2ef209['queue']),_0xf341('0x50'),_0x2ef209);io[_0xf341('0x4b')](_0xf341('0x51'),_0x2ef209);};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x49')]=function(_0x14cc73,_0x5c0f58){logger['debug'](_0xf341('0x4d')+_0x5c0f58+_0xf341('0x52'),_0x14cc73[_0xf341('0x53')],util['inspect'](_0x14cc73,{'showHidden':![],'depth':null}));if(_0x14cc73[_0xf341('0x54')]===_0xf341('0x55')){return;}this[_0xf341('0x4b')](util[_0xf341('0x56')](_0xf341('0x4f'),_0x14cc73[_0xf341('0x57')]),_0xf341('0x58'),_0x14cc73);io[_0xf341('0x4b')](_0xf341('0x59'),_0x14cc73);};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x5a')]=function(_0x26cc31){if(_0x26cc31[_0xf341('0x5b')]===_0xf341('0x5c')){logger[_0xf341('0x4c')](_0xf341('0x5d'),util[_0xf341('0x44')](_0x26cc31,{'showHidden':![],'depth':null}));this['emit'](util[_0xf341('0x56')](_0xf341('0x4f'),_0x26cc31[_0xf341('0x5e')]),_0xf341('0x5f'),_0x26cc31);}};VoiceQueueReport[_0xf341('0x45')]['isNotNull']=function(_0x2313f8){return _0x2313f8!==null&&!_['isUndefined'](_0x2313f8);};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x60')]=function(){var _0x265b2d=this;setInterval(function(){_0x265b2d['clearZombieChannels']();ami[_0xf341('0x3d')]({'action':_0xf341('0x61')})[_0xf341('0x3f')](function(_0x3e4565){logger[_0xf341('0x42')](_0xf341('0x62'),util['inspect'](_0x3e4565,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x2f')]=function(){var _0x5a4ad4=this;setInterval(function(){if(!_0x5a4ad4[_0xf341('0x48')]['isRunning']){return ami[_0xf341('0x3d')]({'action':'queuesummary'})['then'](function(_0x341bef){_0x5a4ad4['summary']['id']=_0x341bef[_0xf341('0x63')];_0x5a4ad4[_0xf341('0x48')][_0xf341('0x64')]=!![];_0x5a4ad4['summary'][_0xf341('0x65')][_0x341bef['actionid']]={};})[_0xf341('0x3f')](function(_0x3e1efb){logger[_0xf341('0x42')](_0xf341('0x66'),util[_0xf341('0x44')](_0x3e1efb,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x67')]=function(_0x3fe47e,_0x573224){var _0x1243bc;if(this[_0xf341('0x48')]&&this[_0xf341('0x48')]['queues']&&this[_0xf341('0x48')][_0xf341('0x61')][_0x3fe47e[_0xf341('0x5e')]]){_0x1243bc=this['summary']['queues'][_0x3fe47e[_0xf341('0x5e')]][_0xf341('0x68')];}var _0x55fe9b=new VoiceQueueSummary(_0x3fe47e);return _0x55fe9b[_0xf341('0x69')](_0x573224[_0xf341('0x10')],this[_0xf341('0x10')],_0x1243bc,this['realtime'][_0xf341('0x3a')]);};VoiceQueueReport['prototype'][_0xf341('0x6a')]=function(_0x29733a,_0x29a9c0){var _0x501e00=this[_0xf341('0x67')](_0x29733a,_0x29a9c0);var _0x8a58c8=![];_0x8a58c8=_0x501e00[_0xf341('0x6b')](_0x29733a);if(_0x8a58c8){Object[_0xf341('0x6c')](_0x29733a,_0x501e00);this[_0xf341('0xf')][_0xf341('0x12')][_0x29733a[_0xf341('0x5e')]]=_0x29733a;this[_0xf341('0x5a')](_0x501e00);}};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x6d')]=function(_0x158d14){var _0x5d45f4=null;var _0x1abb86=this[_0xf341('0x48')]['id'];if(this[_0xf341('0x48')][_0xf341('0x65')][_0x1abb86]){_0x5d45f4=this[_0xf341('0x48')][_0xf341('0x65')][_0x1abb86][_0x158d14['actionid']];}if(!_0x5d45f4){this[_0xf341('0x48')]=initializeSummary();return;}var _0x442db=this['voiceQueues'][_0x5d45f4[_0xf341('0x57')]];if(_0x442db[_0xf341('0x5b')]===_0xf341('0x5c')){this[_0xf341('0x6a')](_0x442db,_0x5d45f4);}else if(_0x442db[_0xf341('0x5b')]===_0xf341('0x6e')){var _0x298e5b=this[_0xf341('0x67')](_0x442db,_0x5d45f4);ami['emit']('custom:queuesummary',_0x298e5b);}this['summary'][_0xf341('0x6f')]-=0x1;var _0x5e9d2e=this[_0xf341('0x48')][_0xf341('0x6f')]>0x0?!![]:![];if(!_0x5e9d2e){return this[_0xf341('0x18')](this[_0xf341('0x48')][_0xf341('0x70')]);}};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x19')]=function(_0xc1c5c1){var _0xa4ff38=this[_0xf341('0x48')]['id'];if(this[_0xf341('0x48')][_0xf341('0x65')][_0xa4ff38]&&this[_0xf341('0x48')]['queuestatus'][_0xa4ff38][_0xc1c5c1[_0xf341('0x63')]]){this['summary'][_0xf341('0x65')][_0xa4ff38][_0xc1c5c1[_0xf341('0x63')]][_0xf341('0x10')][_0xf341('0x71')](_0xc1c5c1);}};VoiceQueueReport[_0xf341('0x45')]['syncQueueSummary']=function(_0x534bec){var _0x46975c=this;try{if(this[_0xf341('0x72')](_0x534bec)&&this[_0xf341('0x72')](_0x534bec[_0xf341('0x57')])){logger['debug'](_0xf341('0x73'),util[_0xf341('0x44')](_0x534bec,{'showHidden':![],'depth':null}));var _0x4243b5=this[_0xf341('0x12')][_0x534bec[_0xf341('0x57')]];if(_0x4243b5){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0x4243b5[_0xf341('0x5e')]);this[_0xf341('0x48')]['queues'][_0x4243b5[_0xf341('0x5e')]]={'summaryEvent':_0x534bec};this['summary']['statusRequests']+=0x1;return ami[_0xf341('0x3d')]({'action':_0xf341('0x65'),'queue':_0x4243b5['name']})[_0xf341('0x74')](function(_0x598e60){if(!_0x46975c[_0xf341('0x48')][_0xf341('0x65')][_0x534bec[_0xf341('0x63')]]){_0x46975c[_0xf341('0x48')]['queuestatus'][_0x534bec[_0xf341('0x63')]]={};}_0x46975c['summary']['queuestatus'][_0x534bec[_0xf341('0x63')]][_0x598e60[_0xf341('0x63')]]={'queue':_0x4243b5[_0xf341('0x5e')],'agents':[]};})['catch'](function(_0xa373fe){throw _0xa373fe;});}}}catch(_0x12f0c0){logger[_0xf341('0x42')]('[voiceQueueReport][queuesummary]',util[_0xf341('0x44')](_0x12f0c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x18')]=function(_0x709db){if(this[_0xf341('0x48')][_0xf341('0x6f')]>0x0){this[_0xf341('0x48')][_0xf341('0x70')]=_0x709db;return;}logger[_0xf341('0x4c')](_0xf341('0x75'),util[_0xf341('0x44')](_0x709db,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xf341('0x4b')](_0xf341('0x76'),{});};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x1a')]=function(_0x3b5b34){try{if(this['isNotNull'](_0x3b5b34)){logger[_0xf341('0x4c')](_0xf341('0x77'),_0x3b5b34['uniqueid'],util[_0xf341('0x44')](_0x3b5b34,{'showHidden':![],'depth':null}));if(_[_0xf341('0x78')](this[_0xf341('0xe')][_0x3b5b34[_0xf341('0x53')]])){this[_0xf341('0xe')][_0x3b5b34[_0xf341('0x53')]]=[];}if(_[_0xf341('0x78')](this[_0xf341('0x3a')][_0x3b5b34['uniqueid']])){this[_0xf341('0x3a')][_0x3b5b34[_0xf341('0x53')]]={};}var _0x4b441a=new QueueReport();_0x4b441a[_0xf341('0x57')]=_0x3b5b34[_0xf341('0x57')];_0x4b441a[_0xf341('0x5b')]=this[_0xf341('0x12')][_0x4b441a['queue']]&&this[_0xf341('0x12')][_0x4b441a[_0xf341('0x57')]][_0xf341('0x5b')]?this[_0xf341('0x12')][_0x4b441a['queue']][_0xf341('0x5b')]||_0xf341('0x5c'):_0xf341('0x5c');_0x4b441a[_0xf341('0x79')]=moment()[_0xf341('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b441a['position']=_0x3b5b34[_0xf341('0x7a')];_0x4b441a[_0xf341('0x7b')]=_0x3b5b34['count'];_0x4b441a[_0xf341('0x53')]=_0x3b5b34[_0xf341('0x53')];logger[_0xf341('0x7c')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4b441a['queue'],_0x4b441a[_0xf341('0x5b')]);Object[_0xf341('0x6c')](_0x4b441a,_[_0xf341('0x7d')](_0x3b5b34,_[_0xf341('0x7e')](_0x4b441a)));this[_0xf341('0xe')][_0x3b5b34[_0xf341('0x53')]][_0xf341('0x71')](_0x4b441a);this[_0xf341('0x3a')][_0x3b5b34[_0xf341('0x53')]]=_0x4b441a;this[_0xf341('0x7f')](_0x4b441a,_0xf341('0x80'));}}catch(_0x171165){logger[_0xf341('0x42')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3b5b34[_0xf341('0x53')],util[_0xf341('0x44')](_0x171165,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x1c')]=function(_0x1cf5fb){try{if(this[_0xf341('0x72')](_0x1cf5fb)){logger[_0xf341('0x4c')](_0xf341('0x81'),_0x1cf5fb[_0xf341('0x53')],util[_0xf341('0x44')](_0x1cf5fb,{'showHidden':![],'depth':null}));if(this[_0xf341('0xe')][_0x1cf5fb[_0xf341('0x53')]]){var _0x462a2d=_['last'](this[_0xf341('0xe')][_0x1cf5fb['uniqueid']]);_0x462a2d[_0xf341('0x38')]=![];_0x462a2d[_0xf341('0x82')]=null;_0x462a2d['holdtime']=_0x1cf5fb[_0xf341('0x83')];_0x462a2d[_0xf341('0x84')]=_0x1cf5fb[_0xf341('0x84')];_0x462a2d[_0xf341('0x1b')]=!![];_0x462a2d['queuecallerabandonAt']=moment()['format'](_0xf341('0x85'));_0x462a2d[_0xf341('0x54')]=_0xf341('0x86');_0x462a2d[_0xf341('0x87')]=null;logger['info'](_0xf341('0x88'),_0x462a2d['queue'],_0x462a2d[_0xf341('0x5b')]);this[_0xf341('0x3a')][_0x1cf5fb['uniqueid']]=_0x462a2d;this[_0xf341('0x49')](_0x462a2d,_0xf341('0x1b'));}}}catch(_0xef6085){logger[_0xf341('0x42')](_0xf341('0x81'),_0x1cf5fb[_0xf341('0x53')],util[_0xf341('0x44')](_0xef6085,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf341('0x45')][_0xf341('0x1e')]=function(_0xcc8322){try{if(this[_0xf341('0x72')](_0xcc8322)){logger[_0xf341('0x4c')](_0xf341('0x89'),_0xcc8322[_0xf341('0x53')],util[_0xf341('0x44')](_0xcc8322,{'showHidden':![],'depth':null}));if(this[_0xf341('0xe')][_0xcc8322[_0xf341('0x53')]]){var _0x48376d=_[_0xf341('0x8a')](this[_0xf341('0xe')][_0xcc8322[_0xf341('0x53')]]);_0x48376d[_0xf341('0x8b')]=moment()['format'](_0xf341('0x85'));_0x48376d['connectedlinenum']=_0xcc8322[_0xf341('0x8c')];_0x48376d[_0xf341('0x8d')]=_0xcc8322[_0xf341('0x8d')];logger[_0xf341('0x7c')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x48376d[_0xf341('0x57')],_0x48376d[_0xf341('0x5b')],_0xcc8322[_0xf341('0x8c')],_0xcc8322[_0xf341('0x8d')]);this[_0xf341('0x3a')][_0xcc8322[_0xf341('0x53')]]=_0x48376d;this[_0xf341('0x7f')](_0x48376d,_0xf341('0x1d'));}}}catch(_0x4b8525){logger[_0xf341('0x42')](_0xf341('0x89'),_0xcc8322['uniqueid'],util[_0xf341('0x44')](_0x4b8525,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf341('0x22')]=function(_0x490bb8){try{if(this[_0xf341('0x72')](_0x490bb8)){logger[_0xf341('0x4c')]('[%s][voiceQueueReport][agentconnect]',_0x490bb8[_0xf341('0x53')],util['inspect'](_0x490bb8,{'showHidden':![],'depth':null}));if(this[_0xf341('0xe')][_0x490bb8[_0xf341('0x53')]]){var _0x3ed266=_['last'](this[_0xf341('0xe')][_0x490bb8['uniqueid']]);_0x3ed266[_0xf341('0x38')]=!![];_0x3ed266[_0xf341('0x54')]=_0xf341('0x8e');logger['info'](_0xf341('0x8f'),_0x3ed266[_0xf341('0x57')],_0x3ed266[_0xf341('0x5b')]);}}}catch(_0x5638e2){logger[_0xf341('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x490bb8[_0xf341('0x53')],util[_0xf341('0x44')](_0x5638e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf341('0x20')]=function(_0x5849d0){try{if(this['isNotNull'](_0x5849d0)){logger[_0xf341('0x4c')](_0xf341('0x90'),_0x5849d0['uniqueid'],util[_0xf341('0x44')](_0x5849d0,{'showHidden':![],'depth':null}));if(this[_0xf341('0xe')][_0x5849d0['uniqueid']]){var _0x4f9947=_[_0xf341('0x8a')](this[_0xf341('0xe')][_0x5849d0[_0xf341('0x53')]]);_0x4f9947[_0xf341('0x1b')]=![];_0x4f9947['queuecallerabandonAt']=null;_0x4f9947[_0xf341('0x91')]=!![];_0x4f9947[_0xf341('0x87')]=_0x5849d0['membername'];_0x4f9947[_0xf341('0x83')]=_0x5849d0[_0xf341('0x83')];_0x4f9947['queuecallercomplete']=!![];_0x4f9947[_0xf341('0x37')]=![];_0x4f9947[_0xf341('0x92')]=null;if(!_0x4f9947['transfer']){if(_0x5849d0[_0xf341('0x93')]==_0xf341('0x94')){_0x4f9947[_0xf341('0x54')]=_0xf341('0x95');logger['info'](_0xf341('0x96'),_0x4f9947[_0xf341('0x57')],_0x4f9947[_0xf341('0x5b')]);}else{if(_[_0xf341('0x97')](_0x5849d0[_0xf341('0x98')]['toLowerCase'](),_0xf341('0x99'))){if(this['queueReports'][_0x5849d0['linkedid']]){var _0xfe91f9=_['last'](this['queueReports'][_0x5849d0[_0xf341('0x9a')]]);_0xfe91f9[_0xf341('0x38')]=![];_0xfe91f9[_0xf341('0x37')]=!![];_0xfe91f9[_0xf341('0x92')]=moment(_0x4f9947[_0xf341('0x79')])[_0xf341('0x9b')](_0x5849d0[_0xf341('0x83')],_0xf341('0x9c'))[_0xf341('0x56')](_0xf341('0x85'));_0xfe91f9[_0xf341('0x54')]=_0xf341('0x9d');_0xfe91f9[_0xf341('0x94')]=!![];_0xfe91f9[_0xf341('0x9e')]=_0xf341('0x9f');_0xfe91f9['transferexten']=_0x5849d0[_0xf341('0xa0')];_0xfe91f9['transferuniqueid']=_0x5849d0[_0xf341('0x53')];logger[_0xf341('0x7c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0xfe91f9[_0xf341('0x57')],_0xfe91f9[_0xf341('0x5b')]);var _0x4b3a47=this[_0xf341('0xe')][_0x5849d0[_0xf341('0x9a')]];this[_0xf341('0xe')][_0x5849d0[_0xf341('0x9a')]]=this['queueReports'][_0x5849d0['uniqueid']];this['queueReports'][_0x5849d0['uniqueid']]=_0x4b3a47;}}else{_0x4f9947[_0xf341('0x54')]=_0xf341('0xa1')+_0x5849d0['reason']['toUpperCase']();logger[_0xf341('0x7c')](_0xf341('0xa2'),_0x4f9947[_0xf341('0x57')],_0x4f9947[_0xf341('0x5b')],_0x4f9947[_0xf341('0x54')]);}}}this[_0xf341('0x3a')][_0x5849d0[_0xf341('0x53')]]=_0x4f9947;}}}catch(_0x91ad96){logger[_0xf341('0x42')](_0xf341('0x90'),_0x5849d0[_0xf341('0x53')],util['inspect'](_0x91ad96,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf341('0x45')]['syncVarSet']=function(_0x299911){try{if(this[_0xf341('0x72')](_0x299911)){logger[_0xf341('0x4c')]('[%s][voiceQueueReport][varset]',_0x299911['uniqueid'],util[_0xf341('0x44')](_0x299911,{'showHidden':![],'depth':null}));this['addVariable'](_0x299911['uniqueid'],_['keys'](_0x299911[_0xf341('0xa3')])[0x0],_0x299911['value']);if(this[_0xf341('0xe')][_0x299911[_0xf341('0x53')]]){var _0x3a4cb1=_[_0xf341('0x8a')](this[_0xf341('0xe')][_0x299911[_0xf341('0x53')]]);if(_0x3a4cb1){if(this['isNotNull'](_0x299911['variable'])&&this['isNotNull'](_0x299911[_0xf341('0xa3')]['queuestatus'])){switch(_0x299911['value']){case'CONTINUE':_0x3a4cb1[_0xf341('0x37')]=![];_0x3a4cb1[_0xf341('0x92')]=null;break;case _0xf341('0xa4'):_0x3a4cb1[_0xf341('0xa5')]=_0xf341('0xa6');_0x3a4cb1['queuecallerexit']=!![];_0x3a4cb1['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3a4cb1[_0xf341('0x8b')]=moment()[_0xf341('0x56')](_0xf341('0x85'));logger['debug'](_0xf341('0xa7'),_0x299911[_0xf341('0x53')],util['inspect'](_0x3a4cb1,{'showHidden':![],'depth':null}));ami['emit'](_0xf341('0xa8'),_0x3a4cb1);break;default:_0x3a4cb1[_0xf341('0x37')]=!![];_0x3a4cb1[_0xf341('0x92')]=moment()[_0xf341('0x56')](_0xf341('0x85'));_0x3a4cb1[_0xf341('0x8b')]=moment()[_0xf341('0x56')](_0xf341('0x85'));}_0x3a4cb1[_0xf341('0x1b')]=![];_0x3a4cb1['queuecallerabandonAt']=null;_0x3a4cb1[_0xf341('0x54')]=_0x299911[_0xf341('0xa9')];this['channels'][_0x299911[_0xf341('0x53')]]=_0x3a4cb1;this[_0xf341('0x49')](_0x3a4cb1,'varset');}else if(this[_0xf341('0x72')](_0x299911[_0xf341('0xa3')])&&this[_0xf341('0x72')](_0x299911[_0xf341('0xa3')][_0xf341('0xaa')])){if(!_0x3a4cb1[_0xf341('0x1b')]){_0x3a4cb1[_0xf341('0x37')]=!![];_0x3a4cb1[_0xf341('0x92')]=moment()[_0xf341('0x56')](_0xf341('0x85'));_0x3a4cb1[_0xf341('0x54')]='EXITWITHKEY';_0x3a4cb1[_0xf341('0x8b')]=moment()[_0xf341('0x56')](_0xf341('0x85'));this[_0xf341('0x3a')][_0x299911[_0xf341('0x53')]]=_0x3a4cb1;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x299911[_0xf341('0x53')],_0x3a4cb1['queue'],_0x3a4cb1[_0xf341('0x5b')],_[_0xf341('0x7e')](_0x299911[_0xf341('0xa3')])[0x0],_0x299911[_0xf341('0xa9')]);_0x3a4cb1[_0xf341('0x14')]=this[_0xf341('0x14')][_0x299911[_0xf341('0x53')]];}}}}catch(_0x4f5b3b){logger[_0xf341('0x42')](_0xf341('0xab'),_0x299911['uniqueid'],util[_0xf341('0x44')](_0x4f5b3b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf341('0x45')][_0xf341('0xac')]=function(_0x31a15c,_0x328e5b,_0x2b8838){var _0x4bec6f=['rtpaudioqos',_0xf341('0xad'),_0xf341('0xae'),_0xf341('0xaf'),'rtpaudioqosloss',_0xf341('0xb0'),_0xf341('0xb1'),_0xf341('0xb2'),_0xf341('0xb3'),_0xf341('0xb4'),_0xf341('0xb5'),_0xf341('0xb6'),_0xf341('0xb7'),_0xf341('0xb8'),_0xf341('0xb9'),'memberlastcall',_0xf341('0xba'),_0xf341('0xbb'),_0xf341('0xbc')];if(!_[_0xf341('0xbd')](_0x328e5b)&&!_[_0xf341('0xbe')](_0x4bec6f,_0x328e5b)){if(_[_0xf341('0x78')](this[_0xf341('0x14')][_0x31a15c])){this[_0xf341('0x14')][_0x31a15c]={};}this[_0xf341('0x14')][_0x31a15c][_0x328e5b]=_0x2b8838;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x57bbaa,_0x3c515a,_0xeb65af){try{var _0x34bd5b={};if(this['queueReports'][_0x57bbaa]){for(var _0x2994de=0x0;_0x2994de{delete this[_0xf341('0x3a')][_0x4221a4];},_0x1771da);}};module['exports']=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 8cdd023..9b88a01 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33be=['CreateReportAgentPreview','../client','createHistory','campaign','Request'];(function(_0x372047,_0x7f5c2b){var _0x44f282=function(_0x5a3d1c){while(--_0x5a3d1c){_0x372047['push'](_0x372047['shift']());}};_0x44f282(++_0x7f5c2b);}(_0x33be,0x12d));var _0xe33b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x33be[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0xe33b('0x0'));exports[_0xe33b('0x1')]=function(_0x4f5a84){return function(){_0x4f5a84[_0xe33b('0x2')]=_0x4f5a84['queue'];return client[_0xe33b('0x3')](_0xe33b('0x4'),{'body':_0x4f5a84,'log':_0xe33b('0x4')});};}; \ No newline at end of file +var _0x7e36=['CreateReportAgentPreview','../client','createHistory','campaign','queue'];(function(_0x534621,_0x4b9879){var _0x3c6624=function(_0x1f8d38){while(--_0x1f8d38){_0x534621['push'](_0x534621['shift']());}};_0x3c6624(++_0x4b9879);}(_0x7e36,0xab));var _0x67e3=function(_0x112d20,_0x4bd3b6){_0x112d20=_0x112d20-0x0;var _0x48c4ce=_0x7e36[_0x112d20];return _0x48c4ce;};'use strict';var client=require(_0x67e3('0x0'));exports[_0x67e3('0x1')]=function(_0x2c9924){return function(){_0x2c9924[_0x67e3('0x2')]=_0x2c9924[_0x67e3('0x3')];return client['Request'](_0x67e3('0x4'),{'body':_0x2c9924,'log':_0x67e3('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 267acd7..47ef588 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x171c=['CreateAttachment','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x171c,0x16d));var _0xc171=function(_0x4f23fb,_0x13424a){_0x4f23fb=_0x4f23fb-0x0;var _0x51fd97=_0x171c[_0x4f23fb];return _0x51fd97;};'use strict';var client=require(_0xc171('0x0'));exports[_0xc171('0x1')]=function(_0x16bd08){return client[_0xc171('0x2')](_0xc171('0x3'),{'body':_0x16bd08,'log':_0xc171('0x3')});}; \ No newline at end of file +var _0xa977=['Request','CreateAttachment','../client','create'];(function(_0x51c2a6,_0x3cbca9){var _0xddfb6e=function(_0x5738b5){while(--_0x5738b5){_0x51c2a6['push'](_0x51c2a6['shift']());}};_0xddfb6e(++_0x3cbca9);}(_0xa977,0x7e));var _0x7a97=function(_0xd5cc6,_0x483ddd){_0xd5cc6=_0xd5cc6-0x0;var _0x31c969=_0xa977[_0xd5cc6];return _0x31c969;};'use strict';var client=require(_0x7a97('0x0'));exports[_0x7a97('0x1')]=function(_0xe65174){return client[_0x7a97('0x2')]('CreateAttachment',{'body':_0xe65174,'log':_0x7a97('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 8e675ab..c0cd63f 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x21aea9,_0x4cc2c3){var _0x233ea8=function(_0x1e86e9){while(--_0x1e86e9){_0x21aea9['push'](_0x21aea9['shift']());}};_0x233ea8(++_0x4cc2c3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file +var _0x7a54=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','callerid','active','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry'];(function(_0x6eade,_0x25d82c){var _0x425f38=function(_0x59b0c9){while(--_0x59b0c9){_0x6eade['push'](_0x6eade['shift']());}};_0x425f38(++_0x25d82c);}(_0x7a54,0x106));var _0x47a5=function(_0x3d96fa,_0x1dba54){_0x3d96fa=_0x3d96fa-0x0;var _0xd734b8=_0x7a54[_0x3d96fa];return _0xd734b8;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(){return client[_0x47a5('0x2')]('GetCampaign',{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),_0x47a5('0x4'),'active',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'dialCongestionRetryFrequency',_0x47a5('0xa'),'dialBusyRetryFrequency',_0x47a5('0xb'),_0x47a5('0xc'),'dialGlobalMaxRetry',_0x47a5('0xd'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency',_0x47a5('0xe'),_0x47a5('0xf'),'dialMachineMaxRetry',_0x47a5('0x10'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'dialAMDMinWordLength',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f')],'include':[{'model':'Trunk','as':_0x47a5('0x20'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x21'),_0x47a5('0x22')]},{'model':_0x47a5('0x20'),'as':'TrunkBackup','attributes':['id','name',_0x47a5('0x21'),'active']},{'model':'Interval','as':_0x47a5('0x23'),'attributes':['id',_0x47a5('0x3')],'include':[{'model':_0x47a5('0x23'),'as':_0x47a5('0x24'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x25')]}]},{'model':_0x47a5('0x26'),'as':_0x47a5('0x26'),'attributes':['id',_0x47a5('0x3')]}]},'log':'getCampaign'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 97db348..11a3607 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdde0=['../client','createContact','Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x27cd7f,_0x3e1ce4){var _0x23b7fa=function(_0x255ddf){while(--_0x255ddf){_0x27cd7f['push'](_0x27cd7f['shift']());}};_0x23b7fa(++_0x3e1ce4);}(_0xdde0,0x1e6));var _0x0dde=function(_0x541095,_0x1c21ab){_0x541095=_0x541095-0x0;var _0x57224f=_0xdde0[_0x541095];return _0x57224f;};'use strict';var client=require(_0x0dde('0x0'));exports[_0x0dde('0x1')]=function(_0x51ca77){return function(){return client[_0x0dde('0x2')]('CreateCmContact',{'body':_0x51ca77,'log':_0x0dde('0x3')});};};exports[_0x0dde('0x4')]=function(_0x4e937b){return function(){return client[_0x0dde('0x2')]('GetCmContact',{'options':_0x4e937b,'log':_0x0dde('0x5')});};}; \ No newline at end of file +var _0x1f8c=['../client','createContact','Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x2c6c8c,_0x10d242){var _0x3027f3=function(_0x24b578){while(--_0x24b578){_0x2c6c8c['push'](_0x2c6c8c['shift']());}};_0x3027f3(++_0x10d242);}(_0x1f8c,0x6c));var _0xc1f8=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x1f8c[_0x5c5c52];return _0x4229ff;};'use strict';var client=require(_0xc1f8('0x0'));exports[_0xc1f8('0x1')]=function(_0x428b3b){return function(){return client[_0xc1f8('0x2')](_0xc1f8('0x3'),{'body':_0x428b3b,'log':_0xc1f8('0x3')});};};exports[_0xc1f8('0x4')]=function(_0x4ab5c2){return function(){return client[_0xc1f8('0x2')](_0xc1f8('0x5'),{'options':_0x4ab5c2,'log':'GetCmContact'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index aeb713b..683d2d4 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc0d=['GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue','getContactRecallMe','GetContactRecallMe','priority','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','DESC','scheduledat','ASC','moveContactManagedDialer','campaign','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview'];(function(_0x144d33,_0x3168cf){var _0x34c16c=function(_0x12e8f3){while(--_0x12e8f3){_0x144d33['push'](_0x144d33['shift']());}};_0x34c16c(++_0x3168cf);}(_0xdc0d,0x1db));var _0xddc0=function(_0x5f203f,_0x58f982){_0x5f203f=_0x5f203f-0x0;var _0x328803=_0xdc0d[_0x5f203f];return _0x328803;};'use strict';var client=require(_0xddc0('0x0'));var moment=require(_0xddc0('0x1'));exports['getContacts']=function(_0x3b6966,_0x558a1a){return function(){return client[_0xddc0('0x2')](_0xddc0('0x3'),{'options':{'where':{'VoiceQueueId':_0x3b6966},'include':[{'model':_0xddc0('0x4'),'as':_0xddc0('0x5')}],'limit':_0x558a1a,'raw':![]},'log':_0xddc0('0x6')});};};exports[_0xddc0('0x7')]=function(_0x2d915c,_0x39a8da,_0x20f5a9){return function(){return client['Request'](_0xddc0('0x8'),{'body':_0x2d915c,'options':{'where':{'VoiceQueueId':_0x39a8da,'scheduledat':{'$lte':moment()[_0xddc0('0x9')](_0xddc0('0xa'))}},'limit':_0x20f5a9},'log':_0xddc0('0x8')});};};exports[_0xddc0('0xb')]=function(_0x3aad0e){return client['Request'](_0xddc0('0x8'),{'body':_0x3aad0e,'options':{'where':{'ContactId':_0x3aad0e[_0xddc0('0xc')],'ListId':_0x3aad0e[_0xddc0('0xd')],'VoiceQueueId':_0x3aad0e[_0xddc0('0xe')],'CampaignId':_0x3aad0e[_0xddc0('0xf')]}},'log':_0xddc0('0xb')});};exports[_0xddc0('0x10')]=function(_0x36cf5e,_0x53075e,_0x142874){return function(){return client[_0xddc0('0x2')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x36cf5e,'ListId':_0x53075e,'ContactId':_0x142874}},'log':_0xddc0('0x11')});};};exports[_0xddc0('0x12')]=function(_0xde1081,_0x39d44c,_0x2faa0d,_0x53fb88){return client[_0xddc0('0x2')](_0xddc0('0x13'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xde1081,'active':![],'scheduledat':{'$lte':moment()['format'](_0xddc0('0xa'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x39d44c}}]},'order':[['priority',_0xddc0('0x14')],[_0xddc0('0x15'),_0x53fb88],['id',_0xddc0('0x16')]],'raw':!![],'limit':_0x2faa0d},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x22cf96,_0x367bff,_0x39b837){return client[_0xddc0('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x22cf96,'active':![],'scheduledat':{'$lte':moment()[_0xddc0('0x9')](_0xddc0('0xa'))}},'include':[{'model':_0xddc0('0x4'),'as':_0xddc0('0x5')}],'order':[['priority',_0xddc0('0x14')],[_0xddc0('0x15'),_0x39b837],['id',_0xddc0('0x16')]],'raw':!![],'limit':_0x367bff},'log':'GetContactDialerIvr'});};exports[_0xddc0('0x17')]=function(_0x530b02,_0x2accad){_0x530b02[_0xddc0('0x18')]=_0x530b02['queue'];return client[_0xddc0('0x2')](_0xddc0('0x19'),{'body':_0x530b02,'options':{'where':{'ContactId':_0x530b02[_0xddc0('0xc')],'ListId':_0x530b02['ListId'],'VoiceQueueId':_0x530b02[_0xddc0('0xe')],'CampaignId':_0x530b02['CampaignId'],'active':_0x2accad?undefined:!![]}},'log':_0xddc0('0x19')});};exports['countReScheduled']=function(_0x1f08f4){return client['Request'](_0xddc0('0x1a'),{'options':{'where':{'VoiceQueueId':_0x1f08f4['id']?_0x1f08f4['id']||null:null}},'log':_0xddc0('0x1b')});};exports[_0xddc0('0x1c')]=function(_0x552614){return function(){return client[_0xddc0('0x2')](_0xddc0('0x1d'),{'options':{'where':{'id':_0x552614},'include':[{'model':_0xddc0('0x4'),'as':'Contact'},{'model':_0xddc0('0x1e'),'as':_0xddc0('0x1f'),'attributes':['id',_0xddc0('0x20')]},{'model':_0xddc0('0x21'),'as':_0xddc0('0x22'),'attributes':['id','name']}],'raw':!![]},'log':_0xddc0('0x6')});};};exports['unlockContact']=function(_0x5387cc,_0x5a8429,_0x2ac8bb){return client[_0xddc0('0x2')](_0xddc0('0x8'),{'body':_0x5387cc,'options':{'where':{'id':_0x5a8429},'limit':_0x2ac8bb},'log':_0xddc0('0x8')});};exports[_0xddc0('0x23')]=function(_0x410d9b,_0x279ac2){return function(){return client[_0xddc0('0x2')](_0xddc0('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x410d9b,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xddc0('0x9')](_0xddc0('0xa'))},'UserId':{'$in':_0x279ac2}},'order':[[_0xddc0('0x25'),'DESC'],[_0xddc0('0x15'),_0xddc0('0x14')],['id',_0xddc0('0x16')]],'include':[{'model':_0xddc0('0x4'),'as':_0xddc0('0x5')},{'model':_0xddc0('0x1e'),'as':_0xddc0('0x1f'),'attributes':['id',_0xddc0('0x20'),'voicePause']}],'group':_0xddc0('0x26'),'raw':!![]},'log':_0xddc0('0x13')});};};exports[_0xddc0('0x27')]=function(_0x401278,_0x162512){return client['Request']('ResetActiveCalls',{'body':_0x401278,'options':_0x162512||{},'log':_0xddc0('0x28')});};exports[_0xddc0('0x29')]=function(_0x56e1cb,_0xe784e,_0x614f06){return function(){return client['Request']('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x56e1cb,'interval':_0xe784e,'availableAgentsIds':_0x614f06}},'log':_0xddc0('0x29')});};}; \ No newline at end of file +var _0xf23b=['Contact','updateContacts','Request','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','UpdateCmHopper','ContactId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','format','scheduledat','GetContactDialer','getContactDialerIvr','DESC','ASC','moveContactManagedDialer','campaign','MoveContactManagedDialer','countReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue','getCmHopper','unlockContact','GetContactRecallMe','priority','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','GetCmHopper','CmContact'];(function(_0x5db89b,_0x248bb2){var _0x26a090=function(_0x31334e){while(--_0x31334e){_0x5db89b['push'](_0x5db89b['shift']());}};_0x26a090(++_0x248bb2);}(_0xf23b,0x133));var _0xbf23=function(_0x370fac,_0x5a6b26){_0x370fac=_0x370fac-0x0;var _0x3b983c=_0xf23b[_0x370fac];return _0x3b983c;};'use strict';var client=require(_0xbf23('0x0'));var moment=require(_0xbf23('0x1'));exports[_0xbf23('0x2')]=function(_0x1c8f27,_0x38d9e0){return function(){return client['Request'](_0xbf23('0x3'),{'options':{'where':{'VoiceQueueId':_0x1c8f27},'include':[{'model':_0xbf23('0x4'),'as':_0xbf23('0x5')}],'limit':_0x38d9e0,'raw':![]},'log':'getCmHopper'});};};exports[_0xbf23('0x6')]=function(_0x20d420,_0xc5e7dd,_0x393a52){return function(){return client[_0xbf23('0x7')]('UpdateCmHopper',{'body':_0x20d420,'options':{'where':{'VoiceQueueId':_0xc5e7dd,'scheduledat':{'$lte':moment()['format'](_0xbf23('0x8'))}},'limit':_0x393a52},'log':'UpdateCmHopper'});};};exports[_0xbf23('0x9')]=function(_0x1b45f1){return client[_0xbf23('0x7')](_0xbf23('0xa'),{'body':_0x1b45f1,'options':{'where':{'ContactId':_0x1b45f1[_0xbf23('0xb')],'ListId':_0x1b45f1['ListId'],'VoiceQueueId':_0x1b45f1[_0xbf23('0xc')],'CampaignId':_0x1b45f1[_0xbf23('0xd')]}},'log':_0xbf23('0x9')});};exports[_0xbf23('0xe')]=function(_0xf6fa46,_0x41b016,_0x5d8b88){return function(){return client[_0xbf23('0x7')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0xf6fa46,'ListId':_0x41b016,'ContactId':_0x5d8b88}},'log':_0xbf23('0xf')});};};exports['getContactDialer']=function(_0xc31cc,_0x2ed737,_0x4deb64,_0xb6880){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xc31cc,'active':![],'scheduledat':{'$lte':moment()[_0xbf23('0x10')](_0xbf23('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x2ed737}}]},'order':[['priority','DESC'],[_0xbf23('0x11'),_0xb6880],['id','ASC']],'raw':!![],'limit':_0x4deb64},'log':_0xbf23('0x12')});};exports[_0xbf23('0x13')]=function(_0x3e3575,_0xa68e7c,_0x4c1cca){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x3e3575,'active':![],'scheduledat':{'$lte':moment()[_0xbf23('0x10')](_0xbf23('0x8'))}},'include':[{'model':_0xbf23('0x4'),'as':_0xbf23('0x5')}],'order':[['priority',_0xbf23('0x14')],[_0xbf23('0x11'),_0x4c1cca],['id',_0xbf23('0x15')]],'raw':!![],'limit':_0xa68e7c},'log':'GetContactDialerIvr'});};exports[_0xbf23('0x16')]=function(_0x3b6f7e,_0x2bc340){_0x3b6f7e[_0xbf23('0x17')]=_0x3b6f7e['queue'];return client[_0xbf23('0x7')]('MoveContactManagedDialer',{'body':_0x3b6f7e,'options':{'where':{'ContactId':_0x3b6f7e[_0xbf23('0xb')],'ListId':_0x3b6f7e['ListId'],'VoiceQueueId':_0x3b6f7e[_0xbf23('0xc')],'CampaignId':_0x3b6f7e[_0xbf23('0xd')],'active':_0x2bc340?undefined:!![]}},'log':_0xbf23('0x18')});};exports[_0xbf23('0x19')]=function(_0x5a4852){return client['Request']('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x5a4852['id']?_0x5a4852['id']||null:null}},'log':_0xbf23('0x19')});};exports[_0xbf23('0x1a')]=function(_0x5195bd){return function(){return client['Request'](_0xbf23('0x1b'),{'options':{'where':{'id':_0x5195bd},'include':[{'model':_0xbf23('0x4'),'as':_0xbf23('0x5')},{'model':_0xbf23('0x1c'),'as':_0xbf23('0x1d'),'attributes':['id',_0xbf23('0x1e')]},{'model':_0xbf23('0x1f'),'as':_0xbf23('0x20'),'attributes':['id',_0xbf23('0x1e')]}],'raw':!![]},'log':_0xbf23('0x21')});};};exports[_0xbf23('0x22')]=function(_0x489a2e,_0x5d3f5b,_0x207cbd){return client['Request'](_0xbf23('0xa'),{'body':_0x489a2e,'options':{'where':{'id':_0x5d3f5b},'limit':_0x207cbd},'log':_0xbf23('0xa')});};exports['getContactRecallMe']=function(_0x9e2440,_0x55b1e2){return function(){return client['Request'](_0xbf23('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x9e2440,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0xbf23('0x8'))},'UserId':{'$in':_0x55b1e2}},'order':[[_0xbf23('0x24'),_0xbf23('0x14')],[_0xbf23('0x11'),_0xbf23('0x14')],['id',_0xbf23('0x15')]],'include':[{'model':_0xbf23('0x4'),'as':_0xbf23('0x5')},{'model':'User','as':_0xbf23('0x1d'),'attributes':['id',_0xbf23('0x1e'),'voicePause']}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0xbf23('0x12')});};};exports['resetActiveCalls']=function(_0x24a448,_0x27ae70){return client[_0xbf23('0x7')](_0xbf23('0x25'),{'body':_0x24a448,'options':_0x27ae70||{},'log':_0xbf23('0x25')});};exports[_0xbf23('0x26')]=function(_0x4b0de5,_0x51e858,_0x866838){return function(){return client[_0xbf23('0x7')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x4b0de5,'interval':_0x51e858,'availableAgentsIds':_0x866838}},'log':_0xbf23('0x26')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 9ed43af..721fc81 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8b=['VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x3ae4be,_0x4b6f08){var _0x1c5ae3=function(_0x82a260){while(--_0x82a260){_0x3ae4be['push'](_0x3ae4be['shift']());}};_0x1c5ae3(++_0x4b6f08);}(_0x8b8b,0x19a));var _0xb8b8=function(_0x522d17,_0x4fed4f){_0x522d17=_0x522d17-0x0;var _0x4422a6=_0x8b8b[_0x522d17];return _0x4422a6;};'use strict';var client=require(_0xb8b8('0x0'));exports[_0xb8b8('0x1')]=function(_0x11f4fc,_0x2f48cd,_0x5870e3){return client[_0xb8b8('0x2')](_0xb8b8('0x3'),{'body':_0x11f4fc,'reason':_0x2f48cd,'entity':_0x5870e3,'log':_0xb8b8('0x3')});};exports['swapAdditionalPhones']=function(_0x597722,_0xef40f9,_0x47d893){return client[_0xb8b8('0x2')]('SwapAdditionalPhones',{'body':_0x597722,'duration':_0xef40f9,'waitTime':_0x47d893,'log':_0xb8b8('0x4')});};exports[_0xb8b8('0x5')]=function(_0x1a999c){return function(){return client[_0xb8b8('0x2')]('IncrementPreviewCounters',{'body':_0x1a999c,'log':_0xb8b8('0x6')});};}; \ No newline at end of file +var _0xe0e5=['incrementPreviewCounters','IncrementPreviewCounters','verifyAdditionalPhones','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones'];(function(_0x2c763e,_0x4654de){var _0x53b5b8=function(_0x449c4b){while(--_0x449c4b){_0x2c763e['push'](_0x2c763e['shift']());}};_0x53b5b8(++_0x4654de);}(_0xe0e5,0xe2));var _0x5e0e=function(_0x435592,_0x363aed){_0x435592=_0x435592-0x0;var _0x2d544d=_0xe0e5[_0x435592];return _0x2d544d;};'use strict';var client=require('../client');exports[_0x5e0e('0x0')]=function(_0x5e5b5c,_0x3e109d,_0x29b016){return client[_0x5e0e('0x1')](_0x5e0e('0x2'),{'body':_0x5e5b5c,'reason':_0x3e109d,'entity':_0x29b016,'log':_0x5e0e('0x2')});};exports[_0x5e0e('0x3')]=function(_0x2a68ce,_0x27740a,_0x2fb740){return client['Request'](_0x5e0e('0x4'),{'body':_0x2a68ce,'duration':_0x27740a,'waitTime':_0x2fb740,'log':_0x5e0e('0x4')});};exports[_0x5e0e('0x5')]=function(_0x5d6e07){return function(){return client[_0x5e0e('0x1')](_0x5e0e('0x6'),{'body':_0x5d6e07,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 544e11f..266f4ec 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd02e=['../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr'];(function(_0x5ce229,_0x4ee93f){var _0xb01988=function(_0x5181dd){while(--_0x5181dd){_0x5ce229['push'](_0x5ce229['shift']());}};_0xb01988(++_0x4ee93f);}(_0xd02e,0x18c));var _0xed02=function(_0x5dc654,_0xc35062){_0x5dc654=_0x5dc654-0x0;var _0x550a18=_0xd02e[_0x5dc654];return _0x550a18;};'use strict';var client=require(_0xed02('0x0'));exports[_0xed02('0x1')]=function(_0x2662dd){return client[_0xed02('0x2')](_0xed02('0x3'),{'options':{'where':{'VoiceQueueId':_0x2662dd[_0xed02('0x4')],'phone':_0x2662dd[_0xed02('0x5')]},'raw':![]},'log':_0xed02('0x3')});};exports[_0xed02('0x6')]=function(_0x512d45){return client[_0xed02('0x2')](_0xed02('0x3'),{'options':{'where':{'CampaignId':_0x512d45[_0xed02('0x7')],'phone':_0x512d45[_0xed02('0x5')]},'raw':![]},'log':_0xed02('0x8')});}; \ No newline at end of file +var _0x9dea=['checkIsBlackList','VoiceQueueId','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','../client'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9dea,0x1eb));var _0xa9de=function(_0x4cd986,_0x49123f){_0x4cd986=_0x4cd986-0x0;var _0x1d4029=_0x9dea[_0x4cd986];return _0x1d4029;};'use strict';var client=require(_0xa9de('0x0'));exports[_0xa9de('0x1')]=function(_0x2b7b55){return client['Request']('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x2b7b55[_0xa9de('0x2')],'phone':_0x2b7b55['phone']},'raw':![]},'log':_0xa9de('0x3')});};exports[_0xa9de('0x4')]=function(_0x44fd72){return client['Request'](_0xa9de('0x3'),{'options':{'where':{'CampaignId':_0x44fd72[_0xa9de('0x5')],'phone':_0x44fd72['phone']},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index dd6acb4..4f971c3 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5e6=['../client','createContact','campaign','queue','Request','CreateCmHopperFinal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5e6,0x11a));var _0x6b5e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb5e6[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x6b5e('0x0'));exports[_0x6b5e('0x1')]=function(_0x372559){return function(){_0x372559[_0x6b5e('0x2')]=_0x372559[_0x6b5e('0x3')];return client[_0x6b5e('0x4')](_0x6b5e('0x5'),{'body':_0x372559,'log':_0x6b5e('0x5')});};}; \ No newline at end of file +var _0x4089=['createContact','Request','CreateCmHopperFinal','../client'];(function(_0x49c79f,_0x440a1d){var _0x4fea2d=function(_0x6679e1){while(--_0x6679e1){_0x49c79f['push'](_0x49c79f['shift']());}};_0x4fea2d(++_0x440a1d);}(_0x4089,0xaf));var _0x9408=function(_0x437af4,_0x18377f){_0x437af4=_0x437af4-0x0;var _0x327d7c=_0x4089[_0x437af4];return _0x327d7c;};'use strict';var client=require(_0x9408('0x0'));exports[_0x9408('0x1')]=function(_0x33dbe7){return function(){_0x33dbe7['campaign']=_0x33dbe7['queue'];return client[_0x9408('0x2')](_0x9408('0x3'),{'body':_0x33dbe7,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 82e16f4..3240471 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8a3=['campaign','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','YYYY-MM-DD\x20HH:mm:ss','format','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','endOf','day','GetCampaignHopperHistory','../client','moment','createHistory'];(function(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0xd8a3,0x1ea));var _0x3d8a=function(_0x2614a5,_0x226c88){_0x2614a5=_0x2614a5-0x0;var _0x324a66=_0xd8a3[_0x2614a5];return _0x324a66;};'use strict';var client=require(_0x3d8a('0x0'));var moment=require(_0x3d8a('0x1'));exports[_0x3d8a('0x2')]=function(_0x149990){_0x149990[_0x3d8a('0x3')]=_0x149990['queue'];return client[_0x3d8a('0x4')](_0x3d8a('0x5'),{'body':_0x149990,'log':'CreateCmHopperHistory'});};exports[_0x3d8a('0x6')]=function(_0x564b7d){return client[_0x3d8a('0x4')](_0x3d8a('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0x3d8a('0x8')](_0x564b7d,'minutes')['format'](_0x3d8a('0x9')),moment()[_0x3d8a('0xa')](_0x3d8a('0x9'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0x3d8a('0xb')]=function(){return function(){return client[_0x3d8a('0x4')](_0x3d8a('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x3d8a('0xd')]('day')[_0x3d8a('0xa')](_0x3d8a('0x9')),moment()[_0x3d8a('0xe')](_0x3d8a('0xf'))[_0x3d8a('0xa')](_0x3d8a('0x9'))]},'campaigntype':'queue'},'raw':![]},'log':_0x3d8a('0xc')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0x3d8a('0x4')](_0x3d8a('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x3d8a('0xd')](_0x3d8a('0xf'))[_0x3d8a('0xa')](_0x3d8a('0x9')),moment()[_0x3d8a('0xe')](_0x3d8a('0xf'))[_0x3d8a('0xa')](_0x3d8a('0x9'))]},'campaigntype':'ivr'},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file +var _0x0c94=['subtract','minutes','YYYY-MM-DD\x20HH:mm:ss','format','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','moment','campaign','queue','CreateCmHopperHistory','avgHandleTime','Request'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x0c94,0x71));var _0x40c9=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x0c94[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require(_0x40c9('0x0'));var moment=require(_0x40c9('0x1'));exports['createHistory']=function(_0x4c1b3b){_0x4c1b3b[_0x40c9('0x2')]=_0x4c1b3b[_0x40c9('0x3')];return client['Request'](_0x40c9('0x4'),{'body':_0x4c1b3b,'log':'CreateCmHopperHistory'});};exports[_0x40c9('0x5')]=function(_0x5a99a6){return client[_0x40c9('0x6')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x40c9('0x7')](_0x5a99a6,_0x40c9('0x8'))['format'](_0x40c9('0x9')),moment()[_0x40c9('0xa')](_0x40c9('0x9'))]}},'raw':![]},'log':_0x40c9('0xb')});};exports[_0x40c9('0xc')]=function(){return function(){return client[_0x40c9('0x6')](_0x40c9('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x40c9('0xe')](_0x40c9('0xf'))[_0x40c9('0xa')](_0x40c9('0x9')),moment()[_0x40c9('0x10')](_0x40c9('0xf'))[_0x40c9('0xa')](_0x40c9('0x9'))]},'campaigntype':_0x40c9('0x3')},'raw':![]},'log':_0x40c9('0xd')});};};exports[_0x40c9('0x11')]=function(){return function(){return client[_0x40c9('0x6')](_0x40c9('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x40c9('0xe')]('day')[_0x40c9('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x40c9('0xf'))[_0x40c9('0xa')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x40c9('0x13')},'raw':![]},'log':_0x40c9('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 0cd788d..a144668 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9ac=['../client','GetFaxAccount','name','ecm','localstationid','modem','gateway','faxdetect','t38timeout','TrunkId','ListId','Trunk','callerid','getFaxAccount','Request'];(function(_0x1f8b41,_0x35bcaa){var _0x187d93=function(_0x2c782e){while(--_0x2c782e){_0x1f8b41['push'](_0x1f8b41['shift']());}};_0x187d93(++_0x35bcaa);}(_0xf9ac,0x87));var _0xcf9a=function(_0xfb6e79,_0x305867){_0xfb6e79=_0xfb6e79-0x0;var _0x1197d1=_0xf9ac[_0xfb6e79];return _0x1197d1;};'use strict';var client=require(_0xcf9a('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request'](_0xcf9a('0x1'),{'options':{'raw':![],'attributes':['id',_0xcf9a('0x2'),'description',_0xcf9a('0x3'),'headerinfo',_0xcf9a('0x4'),'minrate','maxrate',_0xcf9a('0x5'),_0xcf9a('0x6'),_0xcf9a('0x7'),_0xcf9a('0x8'),'tech',_0xcf9a('0x9'),_0xcf9a('0xa'),'key'],'include':[{'model':'Trunk','as':_0xcf9a('0xb'),'attributes':['id','name',_0xcf9a('0xc'),'active']}]},'log':_0xcf9a('0xd')});};};exports['notify']=function(_0x3d93ad,_0x683ab8){return client[_0xcf9a('0xe')]('NotifyFaxAccount',{'account':{'id':_0x3d93ad},'body':_0x683ab8,'log':'NotifyFaxAccount'});}; \ No newline at end of file +var _0xa017=['getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','t38timeout','tech','Trunk','name','callerid','active'];(function(_0x1278e0,_0x35dbfc){var _0x13b8ea=function(_0x200d92){while(--_0x200d92){_0x1278e0['push'](_0x1278e0['shift']());}};_0x13b8ea(++_0x35dbfc);}(_0xa017,0x1f1));var _0x7a01=function(_0x2023f6,_0x35314d){_0x2023f6=_0x2023f6-0x0;var _0x75bf95=_0xa017[_0x2023f6];return _0x75bf95;};'use strict';var client=require(_0x7a01('0x0'));exports[_0x7a01('0x1')]=function(){return function(){return client[_0x7a01('0x2')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id','name',_0x7a01('0x3'),_0x7a01('0x4'),_0x7a01('0x5'),_0x7a01('0x6'),_0x7a01('0x7'),_0x7a01('0x8'),_0x7a01('0x9'),'gateway','faxdetect',_0x7a01('0xa'),_0x7a01('0xb'),'TrunkId','ListId','key'],'include':[{'model':_0x7a01('0xc'),'as':'Trunk','attributes':['id',_0x7a01('0xd'),_0x7a01('0xe'),_0x7a01('0xf')]}]},'log':_0x7a01('0x10')});};};exports[_0x7a01('0x11')]=function(_0x32a982,_0xa99efb){return client['Request'](_0x7a01('0x12'),{'account':{'id':_0x32a982},'body':_0xa99efb,'log':'NotifyFaxAccount'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index d268cd7..1d60965 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b6f=['Request','UpdateFaxMessage','../client','update'];(function(_0x28cfe2,_0x4af564){var _0x4a4e55=function(_0x12c797){while(--_0x12c797){_0x28cfe2['push'](_0x28cfe2['shift']());}};_0x4a4e55(++_0x4af564);}(_0x2b6f,0x14a));var _0xf2b6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x2b6f[_0x8c43de];return _0xa6591b;};'use strict';var client=require(_0xf2b6('0x0'));exports[_0xf2b6('0x1')]=function(_0x17ccaf,_0x3f5cbb){return client[_0xf2b6('0x2')](_0xf2b6('0x3'),{'body':_0x3f5cbb,'options':{'where':{'AttachmentId':_0x17ccaf}},'log':_0xf2b6('0x3')});}; \ No newline at end of file +var _0x5aa2=['Request','../client','update'];(function(_0x3f2036,_0x2fceaa){var _0x1775af=function(_0x144a69){while(--_0x144a69){_0x3f2036['push'](_0x3f2036['shift']());}};_0x1775af(++_0x2fceaa);}(_0x5aa2,0xac));var _0x25aa=function(_0x3ad331,_0x2fcd1d){_0x3ad331=_0x3ad331-0x0;var _0x292376=_0x5aa2[_0x3ad331];return _0x292376;};'use strict';var client=require(_0x25aa('0x0'));exports[_0x25aa('0x1')]=function(_0x2dbd58,_0x1ce7bf){return client[_0x25aa('0x2')]('UpdateFaxMessage',{'body':_0x1ce7bf,'options':{'where':{'AttachmentId':_0x2dbd58}},'log':'UpdateFaxMessage'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index f3f06f0..c38b1ed 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5897=['content','variableName','Variable','Descriptions','type','key','keyType','keyContent','Fields','idField','nameField','Tags','GetDeskAccount','../../client','getDeskAccounts','Request','name','description','username','password','remoteUri','authType','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects'];(function(_0x318fcb,_0x550aa0){var _0x1fa10c=function(_0x38fe4a){while(--_0x38fe4a){_0x318fcb['push'](_0x318fcb['shift']());}};_0x1fa10c(++_0x550aa0);}(_0x5897,0xca));var _0x7589=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x5897[_0xd050c6];return _0x7278a;};'use strict';var client=require(_0x7589('0x0'));exports[_0x7589('0x1')]=function(){return function(_0x22df09){return client[_0x7589('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x7589('0x3'),_0x7589('0x4'),_0x7589('0x5'),_0x7589('0x6'),_0x7589('0x7'),_0x7589('0x8'),'type',_0x7589('0x9')],'include':[{'model':_0x7589('0xa'),'as':_0x7589('0xb'),'attributes':['id',_0x7589('0x3')],'include':[{'model':_0x7589('0xc'),'as':_0x7589('0xd'),'attributes':['id','type',_0x7589('0xe'),_0x7589('0xf')],'include':[{'model':_0x7589('0x10'),'as':'Variable','attributes':['id',_0x7589('0x3')]}]},{'model':_0x7589('0xc'),'as':_0x7589('0x11'),'attributes':['id',_0x7589('0x12'),_0x7589('0xe'),_0x7589('0x13'),_0x7589('0x14'),_0x7589('0x15'),_0x7589('0xf')],'include':[{'model':'Variable','as':_0x7589('0x10'),'attributes':['id',_0x7589('0x3')]}]},{'model':_0x7589('0xc'),'as':_0x7589('0x16'),'attributes':['id','type',_0x7589('0xe'),_0x7589('0x17'),_0x7589('0x18'),'customField',_0x7589('0xf')],'include':[{'model':_0x7589('0x10'),'as':_0x7589('0x10'),'attributes':['id',_0x7589('0x3')]}]},{'model':'Tag','as':_0x7589('0x19'),'attributes':['id',_0x7589('0x3')]}]}]},'log':_0x7589('0x1a')});};}; \ No newline at end of file +var _0xd117=['idField','nameField','customField','Tag','Tags','../../client','Request','GetDeskAccount','name','description','username','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects','variableName','Variable','Descriptions','content','key','keyType','keyContent'];(function(_0x3e6b64,_0x4724d0){var _0x1551c0=function(_0x1b3b58){while(--_0x1b3b58){_0x3e6b64['push'](_0x3e6b64['shift']());}};_0x1551c0(++_0x4724d0);}(_0xd117,0x82));var _0x7d11=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0xd117[_0x281e5e];return _0x5a22d2;};'use strict';var client=require(_0x7d11('0x0'));exports['getDeskAccounts']=function(){return function(_0x14eb2d){return client[_0x7d11('0x1')](_0x7d11('0x2'),{'options':{'raw':![],'attributes':['id',_0x7d11('0x3'),_0x7d11('0x4'),_0x7d11('0x5'),'password','remoteUri',_0x7d11('0x6'),_0x7d11('0x7'),_0x7d11('0x8')],'include':[{'model':_0x7d11('0x9'),'as':_0x7d11('0xa'),'attributes':['id',_0x7d11('0x3')],'include':[{'model':_0x7d11('0xb'),'as':_0x7d11('0xc'),'attributes':['id',_0x7d11('0x7'),'content',_0x7d11('0xd')],'include':[{'model':'Variable','as':_0x7d11('0xe'),'attributes':['id',_0x7d11('0x3')]}]},{'model':_0x7d11('0xb'),'as':_0x7d11('0xf'),'attributes':['id','type',_0x7d11('0x10'),_0x7d11('0x11'),_0x7d11('0x12'),_0x7d11('0x13'),_0x7d11('0xd')],'include':[{'model':_0x7d11('0xe'),'as':_0x7d11('0xe'),'attributes':['id','name']}]},{'model':_0x7d11('0xb'),'as':'Fields','attributes':['id',_0x7d11('0x7'),_0x7d11('0x10'),_0x7d11('0x14'),_0x7d11('0x15'),_0x7d11('0x16'),_0x7d11('0xd')],'include':[{'model':_0x7d11('0xe'),'as':_0x7d11('0xe'),'attributes':['id','name']}]},{'model':_0x7d11('0x17'),'as':_0x7d11('0x18'),'attributes':['id',_0x7d11('0x3')]}]}]},'log':_0x7d11('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index caf9ef2..6897372 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6e4=['type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','customField','CloudProvider','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','clientId','description','modernAuthentication','Configurations','ticketType','moduleCreate','additionalSearchContact','Dynamics365Field','Subjects'];(function(_0x332102,_0x3e23b4){var _0x20e752=function(_0x2ff97d){while(--_0x2ff97d){_0x332102['push'](_0x332102['shift']());}};_0x20e752(++_0x3e23b4);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x24e056,_0x257d1a){_0x24e056=_0x24e056-0x0;var _0x57b6ea=_0xe6e4[_0x24e056];return _0x57b6ea;};'use strict';var client=require(_0x4e6e('0x0'));exports[_0x4e6e('0x1')]=function(){return function(_0x324f98){return client[_0x4e6e('0x2')](_0x4e6e('0x3'),{'options':{'raw':![],'attributes':['id',_0x4e6e('0x4'),_0x4e6e('0x5'),_0x4e6e('0x6'),_0x4e6e('0x7'),'tenantId',_0x4e6e('0x8'),'clientSecret','serverUrl',_0x4e6e('0x9'),_0x4e6e('0xa')],'include':[{'model':'Dynamics365Configuration','as':_0x4e6e('0xb'),'attributes':['id',_0x4e6e('0x4'),_0x4e6e('0xc'),_0x4e6e('0xd'),_0x4e6e('0xe'),'openNewTab'],'include':[{'model':_0x4e6e('0xf'),'as':_0x4e6e('0x10'),'attributes':['id',_0x4e6e('0x11'),_0x4e6e('0x12'),_0x4e6e('0x13')],'include':[{'model':'Variable','as':_0x4e6e('0x14'),'attributes':['id',_0x4e6e('0x4')]}]},{'model':'Dynamics365Field','as':_0x4e6e('0x15'),'attributes':['id',_0x4e6e('0x11'),_0x4e6e('0x12'),_0x4e6e('0x16'),_0x4e6e('0x17'),_0x4e6e('0x18'),_0x4e6e('0x13')],'include':[{'model':'Variable','as':_0x4e6e('0x14'),'attributes':['id',_0x4e6e('0x4')]}]},{'model':_0x4e6e('0xf'),'as':_0x4e6e('0x19'),'attributes':['id',_0x4e6e('0x11'),_0x4e6e('0x12'),'idField','nameField',_0x4e6e('0x1a'),_0x4e6e('0x13')],'include':[{'model':'Variable','as':_0x4e6e('0x14'),'attributes':['id',_0x4e6e('0x4')]}]}]},{'model':_0x4e6e('0x1b'),'as':_0x4e6e('0x1b'),'attributes':['id','data2',_0x4e6e('0x1c'),_0x4e6e('0x1d')]}]},'log':_0x4e6e('0x3')});};}; \ No newline at end of file +var _0x93e9=['../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','tenantId','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','variableName','Variable','keyType','keyContent','Fields','content','idField','nameField','customField','CloudProvider','data2','data5','data7'];(function(_0x4b418f,_0x3b6a96){var _0x2ed208=function(_0x5bb29b){while(--_0x5bb29b){_0x4b418f['push'](_0x4b418f['shift']());}};_0x2ed208(++_0x3b6a96);}(_0x93e9,0xcc));var _0x993e=function(_0x46fc33,_0x47f944){_0x46fc33=_0x46fc33-0x0;var _0x3abebc=_0x93e9[_0x46fc33];return _0x3abebc;};'use strict';var client=require(_0x993e('0x0'));exports[_0x993e('0x1')]=function(){return function(_0x444623){return client[_0x993e('0x2')](_0x993e('0x3'),{'options':{'raw':![],'attributes':['id',_0x993e('0x4'),_0x993e('0x5'),'password','remoteUri',_0x993e('0x6'),_0x993e('0x7'),_0x993e('0x8'),_0x993e('0x9'),_0x993e('0xa'),_0x993e('0xb')],'include':[{'model':_0x993e('0xc'),'as':_0x993e('0xd'),'attributes':['id','name',_0x993e('0xe'),_0x993e('0xf'),_0x993e('0x10'),_0x993e('0x11')],'include':[{'model':_0x993e('0x12'),'as':_0x993e('0x13'),'attributes':['id',_0x993e('0x14'),'content',_0x993e('0x15')],'include':[{'model':_0x993e('0x16'),'as':'Variable','attributes':['id','name']}]},{'model':_0x993e('0x12'),'as':'Descriptions','attributes':['id',_0x993e('0x14'),'content','key',_0x993e('0x17'),_0x993e('0x18'),_0x993e('0x15')],'include':[{'model':_0x993e('0x16'),'as':_0x993e('0x16'),'attributes':['id',_0x993e('0x4')]}]},{'model':_0x993e('0x12'),'as':_0x993e('0x19'),'attributes':['id',_0x993e('0x14'),_0x993e('0x1a'),_0x993e('0x1b'),_0x993e('0x1c'),_0x993e('0x1d'),_0x993e('0x15')],'include':[{'model':_0x993e('0x16'),'as':_0x993e('0x16'),'attributes':['id',_0x993e('0x4')]}]}]},{'model':'CloudProvider','as':_0x993e('0x1e'),'attributes':['id',_0x993e('0x1f'),_0x993e('0x20'),_0x993e('0x21')]}]},'log':_0x993e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index a0d1d79..74cc810 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f38=['keyContent','nameField','customField','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','FreshdeskConfiguration','Tag','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType'];(function(_0x10d88b,_0x11a58b){var _0x1ddf35=function(_0x3d8975){while(--_0x3d8975){_0x10d88b['push'](_0x10d88b['shift']());}};_0x1ddf35(++_0x11a58b);}(_0x2f38,0x1a7));var _0x82f3=function(_0xcd07c8,_0x88958){_0xcd07c8=_0xcd07c8-0x0;var _0x3d333b=_0x2f38[_0xcd07c8];return _0x3d333b;};'use strict';var client=require('../../client');exports[_0x82f3('0x0')]=function(){return function(_0x5c2f9c){return client[_0x82f3('0x1')](_0x82f3('0x2'),{'options':{'raw':![],'attributes':['id',_0x82f3('0x3'),_0x82f3('0x4'),_0x82f3('0x5'),_0x82f3('0x6'),'serverUrl'],'include':[{'model':_0x82f3('0x7'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x82f3('0x8'),'attributes':['id',_0x82f3('0x3')]},{'model':_0x82f3('0x9'),'as':_0x82f3('0xa'),'attributes':['id',_0x82f3('0xb'),_0x82f3('0xc'),_0x82f3('0xd')],'include':[{'model':_0x82f3('0xe'),'as':_0x82f3('0xe'),'attributes':['id',_0x82f3('0x3')]}]},{'model':_0x82f3('0x9'),'as':_0x82f3('0xf'),'attributes':['id',_0x82f3('0xb'),'content',_0x82f3('0x10'),_0x82f3('0x11'),_0x82f3('0x12'),_0x82f3('0xd')],'include':[{'model':_0x82f3('0xe'),'as':_0x82f3('0xe'),'attributes':['id',_0x82f3('0x3')]}]},{'model':'FreshdeskField','as':'Fields','attributes':['id',_0x82f3('0xb'),_0x82f3('0xc'),'idField',_0x82f3('0x13'),_0x82f3('0x14'),_0x82f3('0xd')],'include':[{'model':_0x82f3('0xe'),'as':_0x82f3('0xe'),'attributes':['id',_0x82f3('0x3')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file +var _0x69e6=['name','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','content','Variable','key','keyType','keyContent','variableName','Fields','nameField','getFreshdeskAccounts','Request','GetFreshdeskAccount'];(function(_0x2d4cf0,_0x209abe){var _0x22353c=function(_0x19cd19){while(--_0x19cd19){_0x2d4cf0['push'](_0x2d4cf0['shift']());}};_0x22353c(++_0x209abe);}(_0x69e6,0x1e0));var _0x669e=function(_0x5a64c9,_0x48b39a){_0x5a64c9=_0x5a64c9-0x0;var _0x2eaebb=_0x69e6[_0x5a64c9];return _0x2eaebb;};'use strict';var client=require('../../client');exports[_0x669e('0x0')]=function(){return function(_0x2df89e){return client[_0x669e('0x1')](_0x669e('0x2'),{'options':{'raw':![],'attributes':['id',_0x669e('0x3'),'username',_0x669e('0x4'),_0x669e('0x5'),_0x669e('0x6')],'include':[{'model':_0x669e('0x7'),'as':_0x669e('0x8'),'attributes':['id',_0x669e('0x3')],'include':[{'model':_0x669e('0x9'),'attributes':['id',_0x669e('0x3')]},{'model':_0x669e('0xa'),'as':_0x669e('0xb'),'attributes':['id',_0x669e('0xc'),_0x669e('0xd'),'variableName'],'include':[{'model':_0x669e('0xe'),'as':_0x669e('0xe'),'attributes':['id',_0x669e('0x3')]}]},{'model':'FreshdeskField','as':'Descriptions','attributes':['id','type',_0x669e('0xd'),_0x669e('0xf'),_0x669e('0x10'),_0x669e('0x11'),_0x669e('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x669e('0x3')]}]},{'model':_0x669e('0xa'),'as':_0x669e('0x13'),'attributes':['id',_0x669e('0xc'),'content','idField',_0x669e('0x14'),'customField',_0x669e('0x12')],'include':[{'model':_0x669e('0xe'),'as':_0x669e('0xe'),'attributes':['id','name']}]}]}]},'log':_0x669e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 8777a69..8bee02c 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90ec=['../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','username','apiKey','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','type','content','Variable','Descriptions','key','keyType','variableName'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x90ec,0x1d4));var _0xc90e=function(_0x35d559,_0x5c72b1){_0x35d559=_0x35d559-0x0;var _0x1d6da2=_0x90ec[_0x35d559];return _0x1d6da2;};'use strict';var client=require(_0xc90e('0x0'));exports[_0xc90e('0x1')]=function(){return function(_0x54f2e6){return client[_0xc90e('0x2')](_0xc90e('0x3'),{'options':{'raw':![],'attributes':['id',_0xc90e('0x4'),_0xc90e('0x5'),_0xc90e('0x6'),'remoteUri',_0xc90e('0x7')],'include':[{'model':_0xc90e('0x8'),'as':_0xc90e('0x9'),'attributes':['id','name'],'include':[{'model':_0xc90e('0xa'),'as':'Subjects','attributes':['id',_0xc90e('0xb'),_0xc90e('0xc'),'variableName'],'include':[{'model':_0xc90e('0xd'),'as':_0xc90e('0xd'),'attributes':['id',_0xc90e('0x4')]}]},{'model':_0xc90e('0xa'),'as':_0xc90e('0xe'),'attributes':['id',_0xc90e('0xb'),_0xc90e('0xc'),_0xc90e('0xf'),_0xc90e('0x10'),'keyContent',_0xc90e('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0x524e=['Subjects','type','variableName','Variable','Descriptions','content','key','keyType','keyContent','GetFreshsalesccount','Request','GetFreshsalesAccount','name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField'];(function(_0x15df1f,_0x5b6e1a){var _0x4edfcb=function(_0x12686f){while(--_0x12686f){_0x15df1f['push'](_0x15df1f['shift']());}};_0x4edfcb(++_0x5b6e1a);}(_0x524e,0x15e));var _0xe524=function(_0x2ea9f1,_0x22e03f){_0x2ea9f1=_0x2ea9f1-0x0;var _0x3ebe85=_0x524e[_0x2ea9f1];return _0x3ebe85;};'use strict';var client=require('../../client');exports['getFreshsalesAccounts']=function(){return function(_0x353d8a){return client[_0xe524('0x0')](_0xe524('0x1'),{'options':{'raw':![],'attributes':['id',_0xe524('0x2'),_0xe524('0x3'),_0xe524('0x4'),_0xe524('0x5'),_0xe524('0x6')],'include':[{'model':_0xe524('0x7'),'as':_0xe524('0x8'),'attributes':['id','name'],'include':[{'model':_0xe524('0x9'),'as':_0xe524('0xa'),'attributes':['id',_0xe524('0xb'),'content',_0xe524('0xc')],'include':[{'model':_0xe524('0xd'),'as':_0xe524('0xd'),'attributes':['id',_0xe524('0x2')]}]},{'model':_0xe524('0x9'),'as':_0xe524('0xe'),'attributes':['id',_0xe524('0xb'),_0xe524('0xf'),_0xe524('0x10'),_0xe524('0x11'),_0xe524('0x12'),_0xe524('0xc')],'include':[{'model':_0xe524('0xd'),'as':_0xe524('0xd'),'attributes':['id',_0xe524('0x2')]}]}]}]},'log':_0xe524('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index ffdaa1b..8fb72b2 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe296=['Configurations','moduleSearch','moduleCreate','ticketType','SalesforceField','Subjects','Variable','Descriptions','Fields','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','remoteUri','clientSecret','type','SalesforceConfiguration'];(function(_0x5bfa42,_0x46ec12){var _0x5b1a31=function(_0x2e1e7e){while(--_0x2e1e7e){_0x5bfa42['push'](_0x5bfa42['shift']());}};_0x5b1a31(++_0x46ec12);}(_0xe296,0x1d1));var _0x6e29=function(_0x2b97ed,_0x33f871){_0x2b97ed=_0x2b97ed-0x0;var _0x357d6e=_0xe296[_0x2b97ed];return _0x357d6e;};'use strict';var client=require(_0x6e29('0x0'));exports[_0x6e29('0x1')]=function(){return function(_0x4ffe3a){return client[_0x6e29('0x2')](_0x6e29('0x3'),{'options':{'raw':![],'attributes':['id',_0x6e29('0x4'),_0x6e29('0x5'),'password',_0x6e29('0x6'),'clientId',_0x6e29('0x7'),'securityToken','serverUrl',_0x6e29('0x8')],'include':[{'model':_0x6e29('0x9'),'as':_0x6e29('0xa'),'attributes':['id',_0x6e29('0x4'),_0x6e29('0xb'),_0x6e29('0xc'),_0x6e29('0xd'),'leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead'],'include':[{'model':_0x6e29('0xe'),'as':_0x6e29('0xf'),'include':[{'model':_0x6e29('0x10'),'as':_0x6e29('0x10'),'attributes':['id',_0x6e29('0x4')]}]},{'model':'SalesforceField','as':_0x6e29('0x11'),'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x6e29('0xe'),'as':_0x6e29('0x12'),'include':[{'model':'Variable','as':_0x6e29('0x10'),'attributes':['id',_0x6e29('0x4')]}]}]}]},'log':_0x6e29('0x3')});};}; \ No newline at end of file +var _0xf34f=['username','password','remoteUri','clientSecret','serverUrl','SalesforceConfiguration','name','moduleSearch','leadId','additionalSearchAccount','additionalSearchContact','SalesforceField','Subjects','Variable','Fields','../../client','GetSalesforceAccount'];(function(_0x5e410d,_0x4eaf38){var _0xa97676=function(_0x18d8c8){while(--_0x18d8c8){_0x5e410d['push'](_0x5e410d['shift']());}};_0xa97676(++_0x4eaf38);}(_0xf34f,0x64));var _0xff34=function(_0x59a6f5,_0x12e289){_0x59a6f5=_0x59a6f5-0x0;var _0xb5c53a=_0xf34f[_0x59a6f5];return _0xb5c53a;};'use strict';var client=require(_0xff34('0x0'));exports['getSalesforceAccounts']=function(){return function(_0x40eb8a){return client['Request'](_0xff34('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xff34('0x2'),_0xff34('0x3'),_0xff34('0x4'),'clientId',_0xff34('0x5'),'securityToken',_0xff34('0x6'),'type'],'include':[{'model':_0xff34('0x7'),'as':'Configurations','attributes':['id',_0xff34('0x8'),_0xff34('0x9'),'moduleCreate','ticketType',_0xff34('0xa'),_0xff34('0xb'),_0xff34('0xc'),'additionalSearchLead'],'include':[{'model':_0xff34('0xd'),'as':_0xff34('0xe'),'include':[{'model':'Variable','as':_0xff34('0xf'),'attributes':['id',_0xff34('0x8')]}]},{'model':_0xff34('0xd'),'as':'Descriptions','include':[{'model':_0xff34('0xf'),'as':_0xff34('0xf'),'attributes':['id',_0xff34('0x8')]}]},{'model':_0xff34('0xd'),'as':_0xff34('0x10'),'include':[{'model':_0xff34('0xf'),'as':_0xff34('0xf'),'attributes':['id',_0xff34('0x8')]}]}]}]},'log':_0xff34('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index ed7b011..1c48980 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','variableName','Variable','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x284907,_0x155309){_0x284907=_0x284907-0x0;var _0x49da09=_0xc6ac[_0x284907];return _0x49da09;};'use strict';var client=require(_0xcc6a('0x0'));exports[_0xcc6a('0x1')]=function(){return function(_0x1b6e92){return client[_0xcc6a('0x2')](_0xcc6a('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc6a('0x4'),_0xcc6a('0x5'),_0xcc6a('0x6'),_0xcc6a('0x7'),_0xcc6a('0x8'),_0xcc6a('0x9'),_0xcc6a('0xa')],'include':[{'model':_0xcc6a('0xb'),'as':_0xcc6a('0xc'),'attributes':['id','name'],'include':[{'model':_0xcc6a('0xd'),'as':_0xcc6a('0xe'),'attributes':['id',_0xcc6a('0xf'),'content',_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]},{'model':_0xcc6a('0xd'),'as':'Descriptions','attributes':['id',_0xcc6a('0xf'),_0xcc6a('0x12'),_0xcc6a('0x13'),'keyType',_0xcc6a('0x14'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xcc6a('0xd'),'as':_0xcc6a('0x15'),'attributes':['id',_0xcc6a('0xf'),'content','idField',_0xcc6a('0x16'),_0xcc6a('0x17'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]}]}]},'log':_0xcc6a('0x18')});};}; \ No newline at end of file +var _0xc6ac=['GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','variableName','Variable','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3049fd,_0x299eac){_0x3049fd=_0x3049fd-0x0;var _0x270fdf=_0xc6ac[_0x3049fd];return _0x270fdf;};'use strict';var client=require(_0xcc6a('0x0'));exports[_0xcc6a('0x1')]=function(){return function(_0x1b6e92){return client[_0xcc6a('0x2')](_0xcc6a('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc6a('0x4'),_0xcc6a('0x5'),_0xcc6a('0x6'),_0xcc6a('0x7'),_0xcc6a('0x8'),_0xcc6a('0x9'),_0xcc6a('0xa')],'include':[{'model':_0xcc6a('0xb'),'as':_0xcc6a('0xc'),'attributes':['id','name'],'include':[{'model':_0xcc6a('0xd'),'as':_0xcc6a('0xe'),'attributes':['id',_0xcc6a('0xf'),'content',_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]},{'model':_0xcc6a('0xd'),'as':'Descriptions','attributes':['id',_0xcc6a('0xf'),_0xcc6a('0x12'),_0xcc6a('0x13'),'keyType',_0xcc6a('0x14'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xcc6a('0xd'),'as':_0xcc6a('0x15'),'attributes':['id',_0xcc6a('0xf'),'content','idField',_0xcc6a('0x16'),_0xcc6a('0x17'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]}]}]},'log':_0xcc6a('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 017e3e5..b165624 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['customField','GetSugarcrmAccount','../../client','getSugarcrmAccounts','Request','name','username','password','remoteUri','serverUrl','Configurations','type','content','variableName','Variable','SugarcrmField','key','keyContent','Fields','nameField'];(function(_0x288325,_0x26e4ff){var _0x3b9fd7=function(_0x1f2816){while(--_0x1f2816){_0x288325['push'](_0x288325['shift']());}};_0x3b9fd7(++_0x26e4ff);}(_0xdb28,0x106));var _0x8db2=function(_0x3c07d3,_0x446a59){_0x3c07d3=_0x3c07d3-0x0;var _0x4968e9=_0xdb28[_0x3c07d3];return _0x4968e9;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(_0x1dc797){return client[_0x8db2('0x2')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x8db2('0x3'),_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7')],'include':[{'model':'SugarcrmConfiguration','as':_0x8db2('0x8'),'attributes':['id',_0x8db2('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x8db2('0x9'),_0x8db2('0xa'),_0x8db2('0xb')],'include':[{'model':_0x8db2('0xc'),'as':_0x8db2('0xc'),'attributes':['id',_0x8db2('0x3')]}]},{'model':_0x8db2('0xd'),'as':'Descriptions','attributes':['id',_0x8db2('0x9'),_0x8db2('0xa'),_0x8db2('0xe'),'keyType',_0x8db2('0xf'),_0x8db2('0xb')],'include':[{'model':'Variable','as':_0x8db2('0xc'),'attributes':['id',_0x8db2('0x3')]}]},{'model':_0x8db2('0xd'),'as':_0x8db2('0x10'),'attributes':['id',_0x8db2('0x9'),'content','idField',_0x8db2('0x11'),_0x8db2('0x12'),_0x8db2('0xb')],'include':[{'model':_0x8db2('0xc'),'as':_0x8db2('0xc'),'attributes':['id',_0x8db2('0x3')]}]}]}]},'log':_0x8db2('0x13')});};}; \ No newline at end of file +var _0xdb28=['customField','GetSugarcrmAccount','../../client','getSugarcrmAccounts','Request','name','username','password','remoteUri','serverUrl','Configurations','type','content','variableName','Variable','SugarcrmField','key','keyContent','Fields','nameField'];(function(_0x4e6eac,_0x3f4365){var _0x79f963=function(_0x36fc3c){while(--_0x36fc3c){_0x4e6eac['push'](_0x4e6eac['shift']());}};_0x79f963(++_0x3f4365);}(_0xdb28,0x106));var _0x8db2=function(_0x231129,_0x2837f7){_0x231129=_0x231129-0x0;var _0x1f39cd=_0xdb28[_0x231129];return _0x1f39cd;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(_0x1dc797){return client[_0x8db2('0x2')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x8db2('0x3'),_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7')],'include':[{'model':'SugarcrmConfiguration','as':_0x8db2('0x8'),'attributes':['id',_0x8db2('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x8db2('0x9'),_0x8db2('0xa'),_0x8db2('0xb')],'include':[{'model':_0x8db2('0xc'),'as':_0x8db2('0xc'),'attributes':['id',_0x8db2('0x3')]}]},{'model':_0x8db2('0xd'),'as':'Descriptions','attributes':['id',_0x8db2('0x9'),_0x8db2('0xa'),_0x8db2('0xe'),'keyType',_0x8db2('0xf'),_0x8db2('0xb')],'include':[{'model':'Variable','as':_0x8db2('0xc'),'attributes':['id',_0x8db2('0x3')]}]},{'model':_0x8db2('0xd'),'as':_0x8db2('0x10'),'attributes':['id',_0x8db2('0x9'),'content','idField',_0x8db2('0x11'),_0x8db2('0x12'),_0x8db2('0xb')],'include':[{'model':_0x8db2('0xc'),'as':_0x8db2('0xc'),'attributes':['id',_0x8db2('0x3')]}]}]}]},'log':_0x8db2('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 0bddd13..34617af 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe856=['keyType','keyContent','Fields','idField','nameField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','content','variableName','Variable','Descriptions','key'];(function(_0x17ee6c,_0x285dd3){var _0x2d599a=function(_0x3081ce){while(--_0x3081ce){_0x17ee6c['push'](_0x17ee6c['shift']());}};_0x2d599a(++_0x285dd3);}(_0xe856,0xc5));var _0x6e85=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xe856[_0x422905];return _0x33dc6c;};'use strict';var client=require(_0x6e85('0x0'));exports[_0x6e85('0x1')]=function(){return function(_0x1a3077){return client[_0x6e85('0x2')](_0x6e85('0x3'),{'options':{'raw':![],'attributes':['id',_0x6e85('0x4'),_0x6e85('0x5'),'username',_0x6e85('0x6'),_0x6e85('0x7'),_0x6e85('0x8')],'include':[{'model':_0x6e85('0x9'),'as':_0x6e85('0xa'),'attributes':['id',_0x6e85('0x4')],'include':[{'model':_0x6e85('0xb'),'as':_0x6e85('0xc'),'attributes':['id',_0x6e85('0xd'),_0x6e85('0xe'),_0x6e85('0xf')],'include':[{'model':_0x6e85('0x10'),'as':_0x6e85('0x10'),'attributes':['id','name']}]},{'model':_0x6e85('0xb'),'as':_0x6e85('0x11'),'attributes':['id',_0x6e85('0xd'),_0x6e85('0xe'),_0x6e85('0x12'),_0x6e85('0x13'),_0x6e85('0x14'),_0x6e85('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x6e85('0xb'),'as':_0x6e85('0x15'),'attributes':['id','type',_0x6e85('0xe'),_0x6e85('0x16'),_0x6e85('0x17'),'customField',_0x6e85('0xf')],'include':[{'model':_0x6e85('0x10'),'as':_0x6e85('0x10'),'attributes':['id',_0x6e85('0x4')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0x2d55=['Descriptions','key','keyType','keyContent','idField','nameField','customField','GetVtigerAccount','../../client','getVtigerAccounts','Request','name','description','username','accessKey','remoteUri','serverUrl','VtigerField','Subjects','type','content','variableName','Variable'];(function(_0x37c217,_0x20c6ea){var _0x1dcf23=function(_0x1d5403){while(--_0x1d5403){_0x37c217['push'](_0x37c217['shift']());}};_0x1dcf23(++_0x20c6ea);}(_0x2d55,0x1d4));var _0x52d5=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2d55[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0x52d5('0x0'));exports[_0x52d5('0x1')]=function(){return function(_0x3c76c4){return client[_0x52d5('0x2')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0x52d5('0x3'),_0x52d5('0x4'),_0x52d5('0x5'),_0x52d5('0x6'),_0x52d5('0x7'),_0x52d5('0x8')],'include':[{'model':'VtigerConfiguration','as':'Configurations','attributes':['id','name'],'include':[{'model':_0x52d5('0x9'),'as':_0x52d5('0xa'),'attributes':['id',_0x52d5('0xb'),_0x52d5('0xc'),_0x52d5('0xd')],'include':[{'model':_0x52d5('0xe'),'as':'Variable','attributes':['id',_0x52d5('0x3')]}]},{'model':_0x52d5('0x9'),'as':_0x52d5('0xf'),'attributes':['id',_0x52d5('0xb'),_0x52d5('0xc'),_0x52d5('0x10'),_0x52d5('0x11'),_0x52d5('0x12'),_0x52d5('0xd')],'include':[{'model':_0x52d5('0xe'),'as':_0x52d5('0xe'),'attributes':['id',_0x52d5('0x3')]}]},{'model':_0x52d5('0x9'),'as':'Fields','attributes':['id',_0x52d5('0xb'),_0x52d5('0xc'),_0x52d5('0x13'),_0x52d5('0x14'),_0x52d5('0x15'),'variableName'],'include':[{'model':_0x52d5('0xe'),'as':_0x52d5('0xe'),'attributes':['id',_0x52d5('0x3')]}]}]}]},'log':_0x52d5('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index c5dba3a..c3fa36c 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b29=['ZendeskConfiguration','Configurations','Tag','content','variableName','Variable','ZendeskField','keyContent','Fields','customField','GetZendeskAccount','../../client','Request','name','password','token','remoteUri','authType','type'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x8b29,0x115));var _0x98b2=function(_0x32f7b1,_0x27dff9){_0x32f7b1=_0x32f7b1-0x0;var _0x59612e=_0x8b29[_0x32f7b1];return _0x59612e;};'use strict';var client=require(_0x98b2('0x0'));exports['getZendeskAccounts']=function(){return function(_0x1b31c1){return client[_0x98b2('0x1')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x98b2('0x2'),'username',_0x98b2('0x3'),_0x98b2('0x4'),_0x98b2('0x5'),_0x98b2('0x6'),'serverUrl',_0x98b2('0x7')],'include':[{'model':_0x98b2('0x8'),'as':_0x98b2('0x9'),'attributes':['id',_0x98b2('0x2')],'include':[{'model':_0x98b2('0xa'),'attributes':['id',_0x98b2('0x2')]},{'model':'ZendeskField','as':'Subjects','attributes':['id',_0x98b2('0x7'),_0x98b2('0xb'),_0x98b2('0xc')],'include':[{'model':_0x98b2('0xd'),'as':'Variable','attributes':['id',_0x98b2('0x2')]}]},{'model':_0x98b2('0xe'),'as':'Descriptions','attributes':['id',_0x98b2('0x7'),_0x98b2('0xb'),'key','keyType',_0x98b2('0xf'),'variableName'],'include':[{'model':_0x98b2('0xd'),'as':_0x98b2('0xd'),'attributes':['id',_0x98b2('0x2')]}]},{'model':_0x98b2('0xe'),'as':_0x98b2('0x10'),'attributes':['id','type','content','idField','nameField',_0x98b2('0x11'),'variableName'],'include':[{'model':_0x98b2('0xd'),'as':_0x98b2('0xd'),'attributes':['id',_0x98b2('0x2')]}]}]}]},'log':_0x98b2('0x12')});};}; \ No newline at end of file +var _0x89c0=['Request','GetZendeskAccount','name','password','token','remoteUri','authType','serverUrl','type','Tag','ZendeskField','content','variableName','Variable','key','keyType','keyContent','Fields','idField','nameField','customField','../../client','getZendeskAccounts'];(function(_0x1d9964,_0x338f06){var _0x4ea394=function(_0x3a7282){while(--_0x3a7282){_0x1d9964['push'](_0x1d9964['shift']());}};_0x4ea394(++_0x338f06);}(_0x89c0,0x9f));var _0x089c=function(_0x24936e,_0x43582e){_0x24936e=_0x24936e-0x0;var _0x3d9666=_0x89c0[_0x24936e];return _0x3d9666;};'use strict';var client=require(_0x089c('0x0'));exports[_0x089c('0x1')]=function(){return function(_0x253cc7){return client[_0x089c('0x2')](_0x089c('0x3'),{'options':{'raw':![],'attributes':['id',_0x089c('0x4'),'username',_0x089c('0x5'),_0x089c('0x6'),_0x089c('0x7'),_0x089c('0x8'),_0x089c('0x9'),_0x089c('0xa')],'include':[{'model':'ZendeskConfiguration','as':'Configurations','attributes':['id',_0x089c('0x4')],'include':[{'model':_0x089c('0xb'),'attributes':['id',_0x089c('0x4')]},{'model':_0x089c('0xc'),'as':'Subjects','attributes':['id',_0x089c('0xa'),_0x089c('0xd'),_0x089c('0xe')],'include':[{'model':_0x089c('0xf'),'as':_0x089c('0xf'),'attributes':['id',_0x089c('0x4')]}]},{'model':_0x089c('0xc'),'as':'Descriptions','attributes':['id',_0x089c('0xa'),_0x089c('0xd'),_0x089c('0x10'),_0x089c('0x11'),_0x089c('0x12'),_0x089c('0xe')],'include':[{'model':_0x089c('0xf'),'as':_0x089c('0xf'),'attributes':['id','name']}]},{'model':_0x089c('0xc'),'as':_0x089c('0x13'),'attributes':['id','type','content',_0x089c('0x14'),_0x089c('0x15'),_0x089c('0x16'),_0x089c('0xe')],'include':[{'model':_0x089c('0xf'),'as':_0x089c('0xf'),'attributes':['id','name']}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 0c34dd9..acd82fd 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x192f=['Fields','idField','nameField','customField','../../client','getZohoAccounts','GetZohoAccount','name','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','moduleCreate','moduleSearch','description','ZohoField','type','variableName','Variable','Descriptions','content','key','keyContent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x192f,0x148));var _0xf192=function(_0x20b9ac,_0x2b2e46){_0x20b9ac=_0x20b9ac-0x0;var _0x1772c8=_0x192f[_0x20b9ac];return _0x1772c8;};'use strict';var client=require(_0xf192('0x0'));exports[_0xf192('0x1')]=function(){return function(_0x4a1910){return client['Request'](_0xf192('0x2'),{'options':{'raw':![],'attributes':['id',_0xf192('0x3'),'description',_0xf192('0x4'),_0xf192('0x5'),_0xf192('0x6'),_0xf192('0x7'),_0xf192('0x8'),_0xf192('0x9'),_0xf192('0xa')],'include':[{'model':_0xf192('0xb'),'as':'Configurations','attributes':['id',_0xf192('0x3'),_0xf192('0xc'),_0xf192('0xd'),_0xf192('0xe')],'include':[{'model':_0xf192('0xf'),'as':'Subjects','attributes':['id',_0xf192('0x10'),'content',_0xf192('0x11')],'include':[{'model':_0xf192('0x12'),'as':'Variable','attributes':['id',_0xf192('0x3')]}]},{'model':_0xf192('0xf'),'as':_0xf192('0x13'),'attributes':['id',_0xf192('0x10'),_0xf192('0x14'),_0xf192('0x15'),'keyType',_0xf192('0x16'),'variableName'],'include':[{'model':_0xf192('0x12'),'as':'Variable','attributes':['id','name']}]},{'model':_0xf192('0xf'),'as':_0xf192('0x17'),'attributes':['id',_0xf192('0x10'),_0xf192('0x14'),_0xf192('0x18'),_0xf192('0x19'),_0xf192('0x1a'),_0xf192('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]}]},'log':_0xf192('0x2')});};}; \ No newline at end of file +var _0x7fde=['keyType','idField','nameField','customField','getZohoAccounts','GetZohoAccount','name','host','zone','clientSecret','serverUrl','code','ZohoConfiguration','Configurations','moduleCreate','moduleSearch','description','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key'];(function(_0x8267aa,_0x496ef0){var _0x2a437f=function(_0x447f72){while(--_0x447f72){_0x8267aa['push'](_0x8267aa['shift']());}};_0x2a437f(++_0x496ef0);}(_0x7fde,0x81));var _0xe7fd=function(_0x445e68,_0x29652d){_0x445e68=_0x445e68-0x0;var _0x1fe2d2=_0x7fde[_0x445e68];return _0x1fe2d2;};'use strict';var client=require('../../client');exports[_0xe7fd('0x0')]=function(){return function(_0x5ae5a3){return client['Request'](_0xe7fd('0x1'),{'options':{'raw':![],'attributes':['id',_0xe7fd('0x2'),'description',_0xe7fd('0x3'),_0xe7fd('0x4'),'clientId',_0xe7fd('0x5'),_0xe7fd('0x6'),_0xe7fd('0x7'),'refreshToken'],'include':[{'model':_0xe7fd('0x8'),'as':_0xe7fd('0x9'),'attributes':['id',_0xe7fd('0x2'),_0xe7fd('0xa'),_0xe7fd('0xb'),_0xe7fd('0xc')],'include':[{'model':_0xe7fd('0xd'),'as':_0xe7fd('0xe'),'attributes':['id',_0xe7fd('0xf'),_0xe7fd('0x10'),_0xe7fd('0x11')],'include':[{'model':_0xe7fd('0x12'),'as':_0xe7fd('0x12'),'attributes':['id',_0xe7fd('0x2')]}]},{'model':_0xe7fd('0xd'),'as':_0xe7fd('0x13'),'attributes':['id',_0xe7fd('0xf'),_0xe7fd('0x10'),_0xe7fd('0x14'),_0xe7fd('0x15'),'keyContent',_0xe7fd('0x11')],'include':[{'model':'Variable','as':_0xe7fd('0x12'),'attributes':['id','name']}]},{'model':'ZohoField','as':'Fields','attributes':['id',_0xe7fd('0xf'),_0xe7fd('0x10'),_0xe7fd('0x16'),_0xe7fd('0x17'),_0xe7fd('0x18'),_0xe7fd('0x11')],'include':[{'model':_0xe7fd('0x12'),'as':_0xe7fd('0x12'),'attributes':['id','name']}]}]}]},'log':_0xe7fd('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index a7aea75..573ce85 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb374=['concat','Request','IntervalIftime','intervalIftime','../../../config/logger','../client','stack','replace','trim','silly','intervalIftime\x20called\x20with','length','number','every','string','map','interval'];(function(_0x59f644,_0x16665f){var _0x208d79=function(_0x5e03a6){while(--_0x5e03a6){_0x59f644['push'](_0x59f644['shift']());}};_0x208d79(++_0x16665f);}(_0xb374,0x103));var _0x4b37=function(_0x43ed18,_0x30f08e){_0x43ed18=_0x43ed18-0x0;var _0x46f6ec=_0xb374[_0x43ed18];return _0x46f6ec;};var logger=require(_0x4b37('0x0'))('dialer');var client=require(_0x4b37('0x1'));function intervalIftime(_0x1ca442,_0x761a09){const _0x308ff0=new Error()[_0x4b37('0x2')][_0x4b37('0x3')](/^Error/,'')[_0x4b37('0x4')]();logger[_0x4b37('0x5')](_0x4b37('0x6'),_0x1ca442,_0x761a09,_0x308ff0);const _0x3aa80d=Array['isArray'](_0x1ca442);if(!_0x1ca442||_0x3aa80d&&_0x1ca442[_0x4b37('0x7')]===0x0){return Promise['resolve'](![]);}else{var _0x20cf9b=[];var _0x122208=[];var _0x6166dd=_0x3aa80d?_0x1ca442:[_0x1ca442];var _0x315d3f=_0x6166dd['every'](function(_0x1f3183){return typeof _0x1f3183===_0x4b37('0x8');});var _0x4f6a55=_0x6166dd[_0x4b37('0x9')](function(_0x31aae1){return typeof _0x31aae1===_0x4b37('0xa');});if(!_0x315d3f&&!_0x4f6a55){_0x20cf9b=_0x6166dd[_0x4b37('0xb')](function(_0x289ee5){return _0x289ee5['id'];});if(_0x20cf9b[_0x4b37('0x7')]===0x0){_0x122208=_0x6166dd[_0x4b37('0xb')](function(_0x2913e6){return _0x2913e6[_0x4b37('0xc')];});}}else{if(_0x315d3f){_0x20cf9b=_0x20cf9b[_0x4b37('0xd')](_0x6166dd);}if(_0x4f6a55){_0x122208=_0x122208['concat'](_0x6166dd);}}return client[_0x4b37('0xe')](_0x4b37('0xf'),{'intervalIds':_0x20cf9b,'intervals':_0x122208,'timezone':_0x761a09,'log':_0x4b37('0xf')});}}exports[_0x4b37('0x10')]=intervalIftime; \ No newline at end of file +var _0xd75d=['../../../config/logger','stack','trim','silly','isArray','resolve','every','map','length','interval','concat','Request'];(function(_0xa8de7f,_0x14306b){var _0x1c856d=function(_0x450473){while(--_0x450473){_0xa8de7f['push'](_0xa8de7f['shift']());}};_0x1c856d(++_0x14306b);}(_0xd75d,0xd8));var _0xdd75=function(_0x386108,_0x34db08){_0x386108=_0x386108-0x0;var _0x26b3c7=_0xd75d[_0x386108];return _0x26b3c7;};var logger=require(_0xdd75('0x0'))('dialer');var client=require('../client');function intervalIftime(_0x27a769,_0x7e8bf1){const _0x42f20d=new Error()[_0xdd75('0x1')]['replace'](/^Error/,'')[_0xdd75('0x2')]();logger[_0xdd75('0x3')]('intervalIftime\x20called\x20with',_0x27a769,_0x7e8bf1,_0x42f20d);const _0xd18ac8=Array[_0xdd75('0x4')](_0x27a769);if(!_0x27a769||_0xd18ac8&&_0x27a769['length']===0x0){return Promise[_0xdd75('0x5')](![]);}else{var _0x526d14=[];var _0x24b20b=[];var _0x4073f1=_0xd18ac8?_0x27a769:[_0x27a769];var _0x18eb75=_0x4073f1[_0xdd75('0x6')](function(_0x77419a){return typeof _0x77419a==='number';});var _0x235be8=_0x4073f1[_0xdd75('0x6')](function(_0x58ec59){return typeof _0x58ec59==='string';});if(!_0x18eb75&&!_0x235be8){_0x526d14=_0x4073f1[_0xdd75('0x7')](function(_0xfa51f4){return _0xfa51f4['id'];});if(_0x526d14[_0xdd75('0x8')]===0x0){_0x24b20b=_0x4073f1[_0xdd75('0x7')](function(_0x40e0ad){return _0x40e0ad[_0xdd75('0x9')];});}}else{if(_0x18eb75){_0x526d14=_0x526d14['concat'](_0x4073f1);}if(_0x235be8){_0x24b20b=_0x24b20b[_0xdd75('0xa')](_0x4073f1);}}return client[_0xdd75('0xb')]('IntervalIftime',{'intervalIds':_0x526d14,'intervals':_0x24b20b,'timezone':_0x7e8bf1,'log':'IntervalIftime'});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 2a5fdc0..8dec181 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eb4=['toNumber','moment','lodash','util','../client','queuecallercompleteAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','SIP/%s','TALKING','diff','seconds','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','voice','membername','starttime','endtime','outbound','dialstring'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0x1eb4,0xa9));var _0x41eb=function(_0x20d400,_0x417891){_0x20d400=_0x20d400-0x0;var _0x3a99ab=_0x1eb4[_0x20d400];return _0x3a99ab;};'use strict';var moment=require(_0x41eb('0x0'));var _=require(_0x41eb('0x1'));var util=require(_0x41eb('0x2'));var client=require(_0x41eb('0x3'));exports['voiceQueueReport']=function(_0x367613){var _0xe1b671=_0x367613[_0x41eb('0x4')]||_0x367613['queuecallerexitAt'];return client[_0x41eb('0x5')](_0x41eb('0x6'),{'body':{'channel':'voice','membername':_0x367613[_0x41eb('0x7')],'interface':_[_0x41eb('0x8')](_0x367613[_0x41eb('0x9')])?util['format'](_0x41eb('0xa'),_0x367613['lastAssignedTo']):_0x367613['interface'],'type':_0x41eb('0xb'),'enterAt':_0x367613['queuecallerleaveAt'],'exitAt':_0xe1b671,'duration':moment(_0xe1b671)[_0x41eb('0xc')](_0x367613['queuecallerleaveAt'],_0x41eb('0xd')),'data1':'inbound','data2':_0x367613[_0x41eb('0xe')],'data3':_0x367613[_0x41eb('0xf')],'data4':null,'data5':_0x367613[_0x41eb('0x10')],'role':_0x41eb('0x11'),'internal':_0x367613[_0x41eb('0x12')]?_['toNumber'](_0x367613[_0x41eb('0x12')]):undefined,'uniqueid':_0x367613[_0x41eb('0x13')]},'log':_0x41eb('0x6')});};exports[_0x41eb('0x14')]=function(_0x21443f){return client[_0x41eb('0x5')](_0x41eb('0x6'),{'body':{'channel':_0x41eb('0x15'),'membername':_0x21443f[_0x41eb('0x16')],'interface':_0x21443f[_0x41eb('0x9')],'type':_0x41eb('0xb'),'enterAt':_0x21443f[_0x41eb('0x17')],'exitAt':_0x21443f['endtime'],'duration':moment(_0x21443f[_0x41eb('0x18')])[_0x41eb('0xc')](_0x21443f['starttime'],_0x41eb('0xd'))>=0x0?moment(_0x21443f[_0x41eb('0x18')])['diff'](_0x21443f[_0x41eb('0x17')],'seconds'):null,'data1':_0x41eb('0x19'),'data2':_0x21443f[_0x41eb('0x12')],'data3':_0x21443f[_0x41eb('0xf')],'data4':_0x21443f[_0x41eb('0x1a')]||null,'role':_0x41eb('0x11'),'internal':_0x21443f[_0x41eb('0x12')]?_[_0x41eb('0x1b')](_0x21443f[_0x41eb('0x12')]):undefined,'uniqueid':_0x21443f[_0x41eb('0x13')]},'log':_0x41eb('0x6')});}; \ No newline at end of file +var _0x182b=['Request','CreateMemberReport','lastAssignedTo','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','calleridnum','queue','agent','accountcode','uniqueid','voiceDialReport','voice','endtime','starttime','seconds','outbound','exten','toNumber','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x182b,0xcb));var _0xb182=function(_0x1f5203,_0x4436f1){_0x1f5203=_0x1f5203-0x0;var _0x6eb300=_0x182b[_0x1f5203];return _0x6eb300;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0xb182('0x0'));var client=require(_0xb182('0x1'));exports[_0xb182('0x2')]=function(_0x3003d0){var _0x3d946d=_0x3003d0[_0xb182('0x3')]||_0x3003d0[_0xb182('0x4')];return client[_0xb182('0x5')](_0xb182('0x6'),{'body':{'channel':'voice','membername':_0x3003d0[_0xb182('0x7')],'interface':_['isNil'](_0x3003d0[_0xb182('0x8')])?util['format'](_0xb182('0x9'),_0x3003d0['lastAssignedTo']):_0x3003d0[_0xb182('0x8')],'type':_0xb182('0xa'),'enterAt':_0x3003d0[_0xb182('0xb')],'exitAt':_0x3d946d,'duration':moment(_0x3d946d)[_0xb182('0xc')](_0x3003d0[_0xb182('0xb')],'seconds'),'data1':'inbound','data2':_0x3003d0[_0xb182('0xd')],'data3':_0x3003d0['exten'],'data4':null,'data5':_0x3003d0[_0xb182('0xe')],'role':_0xb182('0xf'),'internal':_0x3003d0['accountcode']?_['toNumber'](_0x3003d0[_0xb182('0x10')]):undefined,'uniqueid':_0x3003d0[_0xb182('0x11')]},'log':_0xb182('0x6')});};exports[_0xb182('0x12')]=function(_0x4df2a9){return client[_0xb182('0x5')]('CreateMemberReport',{'body':{'channel':_0xb182('0x13'),'membername':_0x4df2a9['membername'],'interface':_0x4df2a9[_0xb182('0x8')],'type':_0xb182('0xa'),'enterAt':_0x4df2a9['starttime'],'exitAt':_0x4df2a9[_0xb182('0x14')],'duration':moment(_0x4df2a9[_0xb182('0x14')])[_0xb182('0xc')](_0x4df2a9[_0xb182('0x15')],_0xb182('0x16'))>=0x0?moment(_0x4df2a9[_0xb182('0x14')])['diff'](_0x4df2a9['starttime'],_0xb182('0x16')):null,'data1':_0xb182('0x17'),'data2':_0x4df2a9[_0xb182('0x10')],'data3':_0x4df2a9[_0xb182('0x18')],'data4':_0x4df2a9['dialstring']||null,'role':_0xb182('0xf'),'internal':_0x4df2a9[_0xb182('0x10')]?_[_0xb182('0x19')](_0x4df2a9[_0xb182('0x10')]):undefined,'uniqueid':_0x4df2a9['uniqueid']},'log':_0xb182('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b3d187b..b619d24 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 _0x4f31=['getSettings','ShowSetting','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x4256d9,_0x2f059e){var _0x3a56b9=function(_0x2efa60){while(--_0x2efa60){_0x4256d9['push'](_0x4256d9['shift']());}};_0x3a56b9(++_0x2f059e);}(_0x4f31,0x13f));var _0x14f3=function(_0x3d1de1,_0x16f0df){_0x3d1de1=_0x3d1de1-0x0;var _0x1cbd7c=_0x4f31[_0x3d1de1];return _0x1cbd7c;};'use strict';var client=require(_0x14f3('0x0'));exports[_0x14f3('0x1')]=function(){return client['Request'](_0x14f3('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x14f3('0x3')]},'log':_0x14f3('0x4')});}; \ No newline at end of file +var _0x3013=['getSettings','Request','ShowSetting','previewRecallmeReminderInterval','../client'];(function(_0x15bba7,_0x5b0a39){var _0x327912=function(_0x8fed0e){while(--_0x8fed0e){_0x15bba7['push'](_0x15bba7['shift']());}};_0x327912(++_0x5b0a39);}(_0x3013,0xea));var _0x3301=function(_0x5b8b4d,_0x4e9ff8){_0x5b8b4d=_0x5b8b4d-0x0;var _0x4a6c12=_0x3013[_0x5b8b4d];return _0x4a6c12;};'use strict';var client=require(_0x3301('0x0'));exports[_0x3301('0x1')]=function(){return client[_0x3301('0x2')](_0x3301('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x3301('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index c6226a5..552f1ba 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 _0x573c=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x1daeaa,_0x297e73){var _0x2a6032=function(_0x11897b){while(--_0x11897b){_0x1daeaa['push'](_0x1daeaa['shift']());}};_0x2a6032(++_0x297e73);}(_0x573c,0x125));var _0xc573=function(_0x1b77f7,_0x5cc544){_0x1b77f7=_0x1b77f7-0x0;var _0x497fb4=_0x573c[_0x1b77f7];return _0x497fb4;};'use strict';var client=require(_0xc573('0x0'));exports[_0xc573('0x1')]=function(_0x4aa092){return function(_0x37072b){return client[_0xc573('0x2')](_0xc573('0x3'),{'options':{'raw':!![],'attributes':['id',_0xc573('0x4'),_0xc573('0x5')]},'log':_0xc573('0x3')});};}; \ No newline at end of file +var _0xdb21=['../client','getTemplates','Request','GetTemplate','name'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xdb21,0xcd));var _0x1db2=function(_0x1aa0e7,_0x498fbd){_0x1aa0e7=_0x1aa0e7-0x0;var _0x55f771=_0xdb21[_0x1aa0e7];return _0x55f771;};'use strict';var client=require(_0x1db2('0x0'));exports[_0x1db2('0x1')]=function(_0x5be389){return function(_0x2c0df7){return client[_0x1db2('0x2')](_0x1db2('0x3'),{'options':{'raw':!![],'attributes':['id',_0x1db2('0x4'),'html']},'log':_0x1db2('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 00ab3af..f29beb4 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 _0x7e38=['Request','GetTrigger','name','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data5','data7','../client'];(function(_0x3b8751,_0x361a10){var _0x216a83=function(_0x17aeb8){while(--_0x17aeb8){_0x3b8751['push'](_0x3b8751['shift']());}};_0x216a83(++_0x361a10);}(_0x7e38,0x13a));var _0x87e3=function(_0x49a5e2,_0x268a5a){_0x49a5e2=_0x49a5e2-0x0;var _0xe5180b=_0x7e38[_0x49a5e2];return _0xe5180b;};'use strict';var client=require(_0x87e3('0x0'));exports['getTriggers']=function(_0x46c31a){return function(_0xaa04e0){return client[_0x87e3('0x1')](_0x87e3('0x2'),{'options':{'raw':![],'attributes':['id',_0x87e3('0x3'),'channel','status'],'include':[{'model':_0x87e3('0x4'),'as':_0x87e3('0x5'),'attributes':['id',_0x87e3('0x6'),_0x87e3('0x7'),_0x87e3('0x8')]},{'model':'Condition','as':_0x87e3('0x9'),'attributes':['id','field',_0x87e3('0x7'),_0x87e3('0x8')]},{'model':_0x87e3('0xa'),'as':_0x87e3('0xb'),'attributes':['id',_0x87e3('0xc'),'data1','data2','data3','data4',_0x87e3('0xd'),'data6',_0x87e3('0xe')]}]},'log':_0x87e3('0x2')});};}; \ No newline at end of file +var _0xb97c=['data3','data4','data5','getTriggers','Request','GetTrigger','channel','status','Condition','operator','value','Actions','action','data2'];(function(_0x26aee4,_0x530ead){var _0x2e1048=function(_0x2e92db){while(--_0x2e92db){_0x26aee4['push'](_0x26aee4['shift']());}};_0x2e1048(++_0x530ead);}(_0xb97c,0x153));var _0xcb97=function(_0x1a9000,_0x516357){_0x1a9000=_0x1a9000-0x0;var _0xb16cba=_0xb97c[_0x1a9000];return _0xb16cba;};'use strict';var client=require('../client');exports[_0xcb97('0x0')]=function(_0x98b6ef){return function(_0x47c4c0){return client[_0xcb97('0x1')](_0xcb97('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xcb97('0x3'),_0xcb97('0x4')],'include':[{'model':_0xcb97('0x5'),'as':'AllConditions','attributes':['id','field',_0xcb97('0x6'),_0xcb97('0x7')]},{'model':'Condition','as':'AnyConditions','attributes':['id','field',_0xcb97('0x6'),_0xcb97('0x7')]},{'model':'Action','as':_0xcb97('0x8'),'attributes':['id',_0xcb97('0x9'),'data1',_0xcb97('0xa'),_0xcb97('0xb'),_0xcb97('0xc'),_0xcb97('0xd'),'data6','data7']}]},'log':_0xcb97('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 2f0f461..9815903 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 _0x6d6f=['Request','GetTrunk','registry'];(function(_0x582df7,_0x3d02cf){var _0x5081fd=function(_0x3f197c){while(--_0x3f197c){_0x582df7['push'](_0x582df7['shift']());}};_0x5081fd(++_0x3d02cf);}(_0x6d6f,0x159));var _0xf6d6=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x6d6f[_0x3e182f];return _0x23edc9;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x4cd1f2){return function(_0x2dc900){return client[_0xf6d6('0x0')](_0xf6d6('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xf6d6('0x2'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xb55a=['Request','name','defaultuser','getTrunks'];(function(_0xb60ae4,_0x48b458){var _0x53d530=function(_0x5c0743){while(--_0x5c0743){_0xb60ae4['push'](_0xb60ae4['shift']());}};_0x53d530(++_0x48b458);}(_0xb55a,0x1c3));var _0xab55=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb55a[_0x17b6e3];return _0x3906f3;};'use strict';var client=require('../client');exports[_0xab55('0x0')]=function(_0x154cbd){return function(_0x303d69){return client[_0xab55('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xab55('0x2'),'registry',_0xab55('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2ed3a61..02488e7 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x93e811,_0x385377){var _0x2a0461=function(_0x5d47de){while(--_0x5d47de){_0x93e811['push'](_0x93e811['shift']());}};_0x2a0461(++_0x385377);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0xcb91[_0x255ac0];return _0x437bf1;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x53e33a,_0x378aca){var _0x41eb3a=function(_0xbb8bd1){while(--_0xbb8bd1){_0x53e33a['push'](_0x53e33a['shift']());}};_0x41eb3a(++_0x378aca);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 543eba0..6fc2d03 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 _0x33ef=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x7ea5bc,_0x59b726){var _0x3484cf=function(_0x1e36cc){while(--_0x1e36cc){_0x7ea5bc['push'](_0x7ea5bc['shift']());}};_0x3484cf(++_0x59b726);}(_0x33ef,0xc6));var _0xf33e=function(_0x8dd85f,_0x102a4c){_0x8dd85f=_0x8dd85f-0x0;var _0x5d55ee=_0x33ef[_0x8dd85f];return _0x5d55ee;};'use strict';var client=require(_0xf33e('0x0'));exports[_0xf33e('0x1')]=function(_0x3a1ea8){return client[_0xf33e('0x2')]('CreateVoiceAgentReport',{'body':_0x3a1ea8,'log':_0xf33e('0x3')});};exports['update']=function(_0x5e228e,_0x2eb907,_0x71f8f2){return client[_0xf33e('0x2')](_0xf33e('0x4'),{'body':_0x5e228e,'options':{'where':{'uniqueid':_0x2eb907,'interface':_0x71f8f2,'agentcomplete':!![]}},'log':_0xf33e('0x4')});}; \ No newline at end of file +var _0x22f8=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x22f8,0x174));var _0x822f=function(_0x3d2799,_0x58c640){_0x3d2799=_0x3d2799-0x0;var _0x305e71=_0x22f8[_0x3d2799];return _0x305e71;};'use strict';var client=require('../client');exports[_0x822f('0x0')]=function(_0x420afa){return client[_0x822f('0x1')]('CreateVoiceAgentReport',{'body':_0x420afa,'log':_0x822f('0x2')});};exports[_0x822f('0x3')]=function(_0x38b398,_0x25e741,_0x2cbc60){return client[_0x822f('0x1')](_0x822f('0x4'),{'body':_0x38b398,'options':{'where':{'uniqueid':_0x25e741,'interface':_0x2cbc60,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2fba84d..3b369d9 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 _0x711c=['type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','getVoiceCallReports','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day'];(function(_0x530b95,_0x575518){var _0x482984=function(_0x32a100){while(--_0x32a100){_0x530b95['push'](_0x530b95['shift']());}};_0x482984(++_0x575518);}(_0x711c,0xec));var _0xc711=function(_0x337fb3,_0x458f30){_0x337fb3=_0x337fb3-0x0;var _0x34f370=_0x711c[_0x337fb3];return _0x34f370;};'use strict';var moment=require(_0xc711('0x0'));var util=require(_0xc711('0x1'));var _=require('lodash');var client=require(_0xc711('0x2'));exports[_0xc711('0x3')]=function(_0x5ef950){return client[_0xc711('0x4')](_0xc711('0x5'),{'body':_[_0xc711('0x6')](_0x5ef950,{'source':_0x5ef950[_0xc711('0x7')],'destinationcontext':_0x5ef950['context'],'callerid':_0x5ef950[_0xc711('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xc711('0x5')});};exports[_0xc711('0x9')]=function(){return function(){return client[_0xc711('0x4')](_0xc711('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xc711('0xb')]('day')[_0xc711('0xc')](_0xc711('0xd')),moment()[_0xc711('0xe')](_0xc711('0xf'))[_0xc711('0xc')](_0xc711('0xd'))]}},'attributes':[_0xc711('0x10'),_0xc711('0x11'),_0xc711('0x12'),_0xc711('0x13')]},'log':_0xc711('0x14')});};}; \ No newline at end of file +var _0xc588=['Request','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','day','type','disposition','duration','billableseconds','moment','lodash','../client'];(function(_0x1c004b,_0x3f3c3f){var _0x4c00f7=function(_0xb68287){while(--_0xb68287){_0x1c004b['push'](_0x1c004b['shift']());}};_0x4c00f7(++_0x3f3c3f);}(_0xc588,0x107));var _0x8c58=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xc588[_0x67f95e];return _0x538f5a;};'use strict';var moment=require(_0x8c58('0x0'));var util=require('util');var _=require(_0x8c58('0x1'));var client=require(_0x8c58('0x2'));exports['create']=function(_0x55401b){return client[_0x8c58('0x3')]('CreateVoiceCallReport',{'body':_[_0x8c58('0x4')](_0x55401b,{'source':_0x55401b[_0x8c58('0x5')],'destinationcontext':_0x55401b[_0x8c58('0x6')],'callerid':_0x55401b['callerid'],'amaflags':_0x8c58('0x7')}),'log':_0x8c58('0x8')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x8c58('0x3')](_0x8c58('0x9'),{'options':{'where':{'type':[_0x8c58('0xa')],'createdAt':{'$between':[moment()[_0x8c58('0xb')]('day')[_0x8c58('0xc')](_0x8c58('0xd')),moment()['endOf'](_0x8c58('0xe'))[_0x8c58('0xc')](_0x8c58('0xd'))]}},'attributes':[_0x8c58('0xf'),_0x8c58('0x10'),_0x8c58('0x11'),_0x8c58('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index bc12de4..6bb32b5 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 _0x8a2b=['../client','create','Request','CreateVoiceDialReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8a2b,0x1ac));var _0xb8a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8a2b[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xb8a2('0x0'));exports[_0xb8a2('0x1')]=function(_0xb5f8ca){return client[_0xb8a2('0x2')](_0xb8a2('0x3'),{'body':_0xb5f8ca,'log':_0xb8a2('0x3')});}; \ No newline at end of file +var _0xd959=['CreateVoiceDialReport','create','Request'];(function(_0x4c0ca9,_0x485ba4){var _0x30ffb5=function(_0x116fac){while(--_0x116fac){_0x4c0ca9['push'](_0x4c0ca9['shift']());}};_0x30ffb5(++_0x485ba4);}(_0xd959,0x12d));var _0x9d95=function(_0x5d992b,_0x53b677){_0x5d992b=_0x5d992b-0x0;var _0x2d71b4=_0xd959[_0x5d992b];return _0x2d71b4;};'use strict';var client=require('../client');exports[_0x9d95('0x0')]=function(_0x3b6887){return client[_0x9d95('0x1')](_0x9d95('0x2'),{'body':_0x3b6887,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ac2dbf1..eae4213 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 _0x180f=['getVoiceExtensions','GetVoiceExtension','exten','../client'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0x180f,0xf3));var _0xf180=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0x180f[_0x4c80d7];return _0x3c5095;};'use strict';var client=require(_0xf180('0x0'));exports[_0xf180('0x1')]=function(){return function(){return client['Request'](_0xf180('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf180('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xf180('0x1')});};}; \ No newline at end of file +var _0xad95=['../client','getVoiceExtensions','Request','recordingFormat'];(function(_0x2f0274,_0x2dd966){var _0x188cca=function(_0x28e7b1){while(--_0x28e7b1){_0x2f0274['push'](_0x2f0274['shift']());}};_0x188cca(++_0x2dd966);}(_0xad95,0x70));var _0x5ad9=function(_0x4aa02e,_0x21185c){_0x4aa02e=_0x4aa02e-0x0;var _0x2f2d09=_0xad95[_0x4aa02e];return _0x2f2d09;};'use strict';var client=require(_0x5ad9('0x0'));exports[_0x5ad9('0x1')]=function(){return function(){return client[_0x5ad9('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x5ad9('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x5ad9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ae60d75..198a9af 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 _0xb81a=['dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','callerid','active','Interval','Intervals','interval','getVoiceQueues','name','acw','monitor_format','type','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage'];(function(_0xe01db0,_0xc3bacb){var _0x41965f=function(_0xde7aac){while(--_0xde7aac){_0xe01db0['push'](_0xe01db0['shift']());}};_0x41965f(++_0xc3bacb);}(_0xb81a,0x186));var _0xab81=function(_0x1e494f,_0x91bb59){_0x1e494f=_0x1e494f-0x0;var _0x2bef55=_0xb81a[_0x1e494f];return _0x2bef55;};'use strict';var client=require('../client');exports[_0xab81('0x0')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xab81('0x1'),_0xab81('0x2'),'acwTimeout','autopause',_0xab81('0x3'),_0xab81('0x4'),'dialActive',_0xab81('0x5'),_0xab81('0x6'),'dialLimitQueue','dialPowerLevel',_0xab81('0x7'),_0xab81('0x8'),_0xab81('0x9'),_0xab81('0xa'),_0xab81('0xb'),'dialOriginateTimeout',_0xab81('0xc'),_0xab81('0xd'),'dialQueueProject',_0xab81('0xe'),_0xab81('0xf'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0xab81('0x10'),_0xab81('0x11'),_0xab81('0x12'),_0xab81('0x13'),'dialGlobalInterval',_0xab81('0x14'),_0xab81('0x15'),'dialAMDActive',_0xab81('0x16'),_0xab81('0x17'),_0xab81('0x18'),'dialAMDTotalAnalysisTime',_0xab81('0x19'),_0xab81('0x1a'),'dialAMDMaximumNumberOfWords',_0xab81('0x1b'),'dialAMDMaximumWordLength',_0xab81('0x1c'),_0xab81('0x1d'),_0xab81('0x1e'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0xab81('0x1f'),_0xab81('0x20'),'monitor_format',_0xab81('0x21'),_0xab81('0x22'),_0xab81('0x23'),_0xab81('0x24'),_0xab81('0x25'),_0xab81('0x26'),'dialDropRetryFrequency',_0xab81('0x27'),_0xab81('0x28'),_0xab81('0x29'),_0xab81('0x2a'),_0xab81('0x2b'),_0xab81('0x2c'),_0xab81('0x2d'),_0xab81('0x2e'),_0xab81('0x2f'),'dialPreviewAutoRecallMe',_0xab81('0x30')],'include':[{'model':_0xab81('0x31'),'as':_0xab81('0x31'),'attributes':['id',_0xab81('0x1'),'callerid','active']},{'model':_0xab81('0x32'),'as':_0xab81('0x33'),'attributes':['id',_0xab81('0x1')]},{'model':_0xab81('0x31'),'as':'TrunkBackup','attributes':['id',_0xab81('0x1'),_0xab81('0x34'),_0xab81('0x35')]},{'model':_0xab81('0x36'),'as':_0xab81('0x36'),'attributes':['id',_0xab81('0x1')],'include':[{'model':_0xab81('0x36'),'as':_0xab81('0x37'),'attributes':['id',_0xab81('0x1'),_0xab81('0x38')]}]}]},'log':_0xab81('0x0')});};}; \ No newline at end of file +var _0x4156=['dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x4156,0x1eb));var _0x6415=function(_0x3bf256,_0x5bc844){_0x3bf256=_0x3bf256-0x0;var _0x1071c0=_0x4156[_0x3bf256];return _0x1071c0;};'use strict';var client=require(_0x6415('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x6415('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x6415('0x2'),_0x6415('0x3'),_0x6415('0x4'),_0x6415('0x5'),_0x6415('0x6'),_0x6415('0x7'),'dialActive',_0x6415('0x8'),_0x6415('0x9'),_0x6415('0xa'),_0x6415('0xb'),_0x6415('0xc'),_0x6415('0xd'),'dialPredictiveInterval',_0x6415('0xe'),'dialOriginateCallerIdNumber',_0x6415('0xf'),_0x6415('0x10'),_0x6415('0x11'),'dialQueueProject',_0x6415('0x12'),'dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency',_0x6415('0x13'),_0x6415('0x14'),'dialGlobalMaxRetry','dialTimezone',_0x6415('0x15'),_0x6415('0x16'),'dialCheckDuplicateType',_0x6415('0x17'),_0x6415('0x18'),_0x6415('0x19'),_0x6415('0x1a'),'dialAMDTotalAnalysisTime',_0x6415('0x1b'),_0x6415('0x1c'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x6415('0x1d'),_0x6415('0x1e'),_0x6415('0x1f'),'dialRecallInQueue','dialOrderByScheduledAt',_0x6415('0x20'),_0x6415('0x21'),_0x6415('0x22'),_0x6415('0x6'),'strategy',_0x6415('0x23'),_0x6415('0x24'),_0x6415('0x25'),_0x6415('0x26'),_0x6415('0x27'),_0x6415('0x28'),_0x6415('0x29'),_0x6415('0x2a'),_0x6415('0x2b'),_0x6415('0x2c'),_0x6415('0x2d'),_0x6415('0x2e'),_0x6415('0x2f'),_0x6415('0x30'),_0x6415('0x31'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x6415('0x32'),'as':_0x6415('0x32'),'attributes':['id','name',_0x6415('0x33'),_0x6415('0x34')]},{'model':_0x6415('0x35'),'as':_0x6415('0x36'),'attributes':['id',_0x6415('0x2')]},{'model':_0x6415('0x32'),'as':_0x6415('0x37'),'attributes':['id',_0x6415('0x2'),_0x6415('0x33'),_0x6415('0x34')]},{'model':_0x6415('0x38'),'as':_0x6415('0x38'),'attributes':['id',_0x6415('0x2')],'include':[{'model':_0x6415('0x38'),'as':_0x6415('0x39'),'attributes':['id',_0x6415('0x2'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b146ca2..5b5abef 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(_0x4e851,_0xd07703){var _0x3d95fd=function(_0x10a759){while(--_0x10a759){_0x4e851['push'](_0x4e851['shift']());}};_0x3d95fd(++_0xd07703);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x26d46b,_0x569754){var _0x3a538b=function(_0x28a941){while(--_0x28a941){_0x26d46b['push'](_0x26d46b['shift']());}};_0x3a538b(++_0x569754);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 010d526..1d557e5 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 _0x94a5=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x2d7310,_0xa7da6c){var _0x409df1=function(_0x4ec19e){while(--_0x4ec19e){_0x2d7310['push'](_0x2d7310['shift']());}};_0x409df1(++_0xa7da6c);}(_0x94a5,0x1f3));var _0x594a=function(_0x1f0a6b,_0x46b665){_0x1f0a6b=_0x1f0a6b-0x0;var _0x18d3f9=_0x94a5[_0x1f0a6b];return _0x18d3f9;};'use strict';var client=require(_0x594a('0x0'));exports[_0x594a('0x1')]=function(_0x1fc258){return function(){return client[_0x594a('0x2')](_0x594a('0x3'),{'options':{'where':{'VoiceQueueId':_0x1fc258,'paused':!![]},'raw':!![]},'log':_0x594a('0x1')});};}; \ No newline at end of file +var _0x69b2=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x254bf8,_0x294390){var _0x1e28a4=function(_0x3cd5e0){while(--_0x3cd5e0){_0x254bf8['push'](_0x254bf8['shift']());}};_0x1e28a4(++_0x294390);}(_0x69b2,0x15f));var _0x269b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x69b2[_0xbca1b1];return _0x4e1686;};'use strict';var client=require('../client');exports[_0x269b('0x0')]=function(_0x49d13e){return function(){return client[_0x269b('0x1')](_0x269b('0x2'),{'options':{'where':{'VoiceQueueId':_0x49d13e,'paused':!![]},'raw':!![]},'log':_0x269b('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 428b1b0..b35af03 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(_0x169da5,_0x2c2bec){var _0x507cb5=function(_0x19849e){while(--_0x19849e){_0x169da5['push'](_0x169da5['shift']());}};_0x507cb5(++_0x2c2bec);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0xd95612,_0xb928fc){var _0x212ffc=function(_0x3eea19){while(--_0x3eea19){_0xd95612['push'](_0xd95612['shift']());}};_0x212ffc(++_0xb928fc);}(_0x7a54,0x106));var _0x47a5=function(_0x1ca6b3,_0x521d44){_0x1ca6b3=_0x1ca6b3-0x0;var _0x3d6317=_0x7a54[_0x1ca6b3];return _0x3d6317;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 4818c3c..9ab4152 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 _0x9c9e=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x578ba7,_0xd650ae){var _0x4aa9f3=function(_0x55a118){while(--_0x55a118){_0x578ba7['push'](_0x578ba7['shift']());}};_0x4aa9f3(++_0xd650ae);}(_0x9c9e,0xb4));var _0xe9c9=function(_0x3fd0ff,_0x88c923){_0x3fd0ff=_0x3fd0ff-0x0;var _0x130f99=_0x9c9e[_0x3fd0ff];return _0x130f99;};'use strict';var client=require(_0xe9c9('0x0'));exports[_0xe9c9('0x1')]={};exports[_0xe9c9('0x2')]=function(_0x3df876){return client[_0xe9c9('0x3')](_0xe9c9('0x4'),{'body':{'result':_0x3df876['result'],'transfererchannel':_0x3df876[_0xe9c9('0x5')],'transferercalleridnum':_0x3df876[_0xe9c9('0x6')],'transferercalleridname':_0x3df876[_0xe9c9('0x7')],'transfererconnectedlinenum':_0x3df876[_0xe9c9('0x8')],'transfererconnectedlinename':_0x3df876['transfererconnectedlinename'],'transfereraccountcode':_0x3df876[_0xe9c9('0x9')],'transferercontext':_0x3df876[_0xe9c9('0xa')],'transfererexten':_0x3df876[_0xe9c9('0xb')],'transfererlinkedid':_0x3df876[_0xe9c9('0xc')],'transfereechannel':_0x3df876[_0xe9c9('0xd')],'transfereecalleridnum':_0x3df876[_0xe9c9('0xe')],'transfereecalleridname':_0x3df876['transfereecalleridname'],'transfereeconnectedlinenum':_0x3df876[_0xe9c9('0xf')],'transfereeconnectedlinename':_0x3df876[_0xe9c9('0x10')],'transfereeaccountcode':_0x3df876[_0xe9c9('0x11')],'transfereecontext':_0x3df876['transfereecontext'],'transfereeexten':_0x3df876[_0xe9c9('0x12')],'transfereelinkedid':_0x3df876[_0xe9c9('0x13')],'isexternal':_0x3df876[_0xe9c9('0x14')],'context':_0x3df876['context'],'extension':_0x3df876['extension'],'type':'blind'},'log':_0xe9c9('0x4')});};exports[_0xe9c9('0x15')]=function(_0x2d7452){return client[_0xe9c9('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x2d7452['result'],'transfererchannel':_0x2d7452['origtransfererchannel'],'transferercalleridnum':_0x2d7452['origtransferercalleridnum'],'transferercalleridname':_0x2d7452[_0xe9c9('0x16')],'transfererconnectedlinenum':_0x2d7452[_0xe9c9('0x17')],'transfererconnectedlinename':_0x2d7452[_0xe9c9('0x18')],'transfereraccountcode':_0x2d7452[_0xe9c9('0x19')],'transferercontext':_0x2d7452['secondtransferercontext'],'transfererexten':_0x2d7452[_0xe9c9('0x1a')],'transfererlinkedid':_0x2d7452[_0xe9c9('0x1b')],'transfereechannel':_0x2d7452['transfertargetchannel'],'transfereecalleridnum':_0x2d7452['transfertargetcalleridnum'],'transfereecalleridname':_0x2d7452[_0xe9c9('0x1c')],'transfereeconnectedlinenum':_0x2d7452['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2d7452['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2d7452[_0xe9c9('0x1d')],'transfereecontext':_0x2d7452['transfertargetcontext'],'transfereeexten':_0x2d7452[_0xe9c9('0x1e')],'transfereelinkedid':_0x2d7452[_0xe9c9('0x1f')],'isexternal':_0x2d7452['isexternal'],'context':_0x2d7452[_0xe9c9('0x20')],'extension':_0x2d7452['origtransfererexten'],'type':_0xe9c9('0x21')},'log':_0xe9c9('0x4')});}; \ No newline at end of file +var _0xaf6f=['extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf6f,0x123));var _0xfaf6=function(_0x25c303,_0xae8618){_0x25c303=_0x25c303-0x0;var _0x3133ef=_0xaf6f[_0x25c303];return _0x3133ef;};'use strict';var client=require(_0xfaf6('0x0'));exports[_0xfaf6('0x1')]={};exports[_0xfaf6('0x2')]=function(_0x35f3d7){return client['Request'](_0xfaf6('0x3'),{'body':{'result':_0x35f3d7[_0xfaf6('0x4')],'transfererchannel':_0x35f3d7[_0xfaf6('0x5')],'transferercalleridnum':_0x35f3d7[_0xfaf6('0x6')],'transferercalleridname':_0x35f3d7[_0xfaf6('0x7')],'transfererconnectedlinenum':_0x35f3d7[_0xfaf6('0x8')],'transfererconnectedlinename':_0x35f3d7[_0xfaf6('0x9')],'transfereraccountcode':_0x35f3d7[_0xfaf6('0xa')],'transferercontext':_0x35f3d7[_0xfaf6('0xb')],'transfererexten':_0x35f3d7[_0xfaf6('0xc')],'transfererlinkedid':_0x35f3d7[_0xfaf6('0xd')],'transfereechannel':_0x35f3d7[_0xfaf6('0xe')],'transfereecalleridnum':_0x35f3d7[_0xfaf6('0xf')],'transfereecalleridname':_0x35f3d7['transfereecalleridname'],'transfereeconnectedlinenum':_0x35f3d7[_0xfaf6('0x10')],'transfereeconnectedlinename':_0x35f3d7[_0xfaf6('0x11')],'transfereeaccountcode':_0x35f3d7[_0xfaf6('0x12')],'transfereecontext':_0x35f3d7[_0xfaf6('0x13')],'transfereeexten':_0x35f3d7['transfereeexten'],'transfereelinkedid':_0x35f3d7[_0xfaf6('0x14')],'isexternal':_0x35f3d7['isexternal'],'context':_0x35f3d7['context'],'extension':_0x35f3d7[_0xfaf6('0x15')],'type':_0xfaf6('0x16')},'log':_0xfaf6('0x3')});};exports['attendedTransfer']=function(_0x342101){return client['Request'](_0xfaf6('0x3'),{'body':{'result':_0x342101[_0xfaf6('0x4')],'transfererchannel':_0x342101[_0xfaf6('0x17')],'transferercalleridnum':_0x342101[_0xfaf6('0x18')],'transferercalleridname':_0x342101[_0xfaf6('0x19')],'transfererconnectedlinenum':_0x342101[_0xfaf6('0x1a')],'transfererconnectedlinename':_0x342101[_0xfaf6('0x1b')],'transfereraccountcode':_0x342101[_0xfaf6('0x1c')],'transferercontext':_0x342101['secondtransferercontext'],'transfererexten':_0x342101['secondtransfererexten'],'transfererlinkedid':_0x342101[_0xfaf6('0x1d')],'transfereechannel':_0x342101[_0xfaf6('0x1e')],'transfereecalleridnum':_0x342101[_0xfaf6('0x1f')],'transfereecalleridname':_0x342101[_0xfaf6('0x20')],'transfereeconnectedlinenum':_0x342101[_0xfaf6('0x21')],'transfereeconnectedlinename':_0x342101['transfertargetconnectedlinename'],'transfereeaccountcode':_0x342101[_0xfaf6('0x22')],'transfereecontext':_0x342101['transfertargetcontext'],'transfereeexten':_0x342101[_0xfaf6('0x23')],'transfereelinkedid':_0x342101[_0xfaf6('0x24')],'isexternal':_0x342101[_0xfaf6('0x25')],'context':_0x342101[_0xfaf6('0x26')],'extension':_0x342101['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 ad5682e..933c2f8 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(_0x438021,_0x49c0f2){var _0x55ceed=function(_0x4dfc6e){while(--_0x4dfc6e){_0x438021['push'](_0x438021['shift']());}};_0x55ceed(++_0x49c0f2);}(_0xb10b,0x12a));var _0xbb10=function(_0x11adbd,_0x5055f5){_0x11adbd=_0x11adbd-0x0;var _0x270029=_0xb10b[_0x11adbd];return _0x270029;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x55a80d,_0xe35097){var _0x442575=function(_0x4ecb80){while(--_0x4ecb80){_0x55a80d['push'](_0x55a80d['shift']());}};_0x442575(++_0xe35097);}(_0xb10b,0x12a));var _0xbb10=function(_0xe80e5c,_0x38e90a){_0xe80e5c=_0xe80e5c-0x0;var _0x2bff61=_0xb10b[_0xe80e5c];return _0x2bff61;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 88dba7b..af25465 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 _0xa2fa=['firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','destcalleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','calleridnum'];(function(_0x4156e9,_0x139ecf){var _0x5a77b7=function(_0x4d2caf){while(--_0x4d2caf){_0x4156e9['push'](_0x4156e9['shift']());}};_0x5a77b7(++_0x139ecf);}(_0xa2fa,0x95));var _0xaa2f=function(_0x4d9100,_0x5d39ff){_0x4d9100=_0x4d9100-0x0;var _0x4ffd43=_0xa2fa[_0x4d9100];return _0x4ffd43;};'use strict';var _=require(_0xaa2f('0x0'));var BPromise=require(_0xaa2f('0x1'));var Redis=require(_0xaa2f('0x2'));var util=require(_0xaa2f('0x3'));var config=require(_0xaa2f('0x4'));var logger=require('../../../../config/logger')(_0xaa2f('0x5'));var cmContactRpc=require(_0xaa2f('0x6'));config[_0xaa2f('0x7')]=_[_0xaa2f('0x8')](config[_0xaa2f('0x7')],{'host':_0xaa2f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaa2f('0x7')]));function emit(_0xe1b279,_0x5eb846,_0x2aec13,_0xff4770,_0x1d80d2){logger[_0xaa2f('0xa')](_0xaa2f('0xb'),_0xe1b279,_0x5eb846['id'],_0x2aec13,_0xff4770,JSON[_0xaa2f('0xc')](_0x1d80d2));io['to'](_0x2aec13)[_0xaa2f('0xd')](_0xff4770,_0x1d80d2);}exports[_0xaa2f('0xe')]=function(_0x4a2b7c,_0x1aa8b7,_0x117964,_0x10a331){var _0x336fed,_0x161193;var _0x1f4bc8={};var _0x319013;var _0x285419=Number(_0x117964[_0xaa2f('0xf')]);var _0x2edd43=_0x117964[_0xaa2f('0x10')]?Boolean(Number(_0x117964[_0xaa2f('0x10')])):![];var _0x50f481;var _0x102de6=![];if(!_[_0xaa2f('0x11')](_0x117964[_0xaa2f('0x12')])){if(_0x117964['data5']=='1')_0x102de6=!![];}if(!_0x102de6){if(_0x10a331[_0xaa2f('0x13')]){_0x1f4bc8['id']=_0x10a331[_0xaa2f('0x13')];}}if(!_0x1f4bc8['id']){_0x1f4bc8[_0xaa2f('0x14')]=_0x285419;_0x50f481=_0x117964[_0xaa2f('0x15')]&&_0x117964['data3']!=='0'?_0x117964[_0xaa2f('0x15')][_0xaa2f('0x16')](','):[_0xaa2f('0x17')];_0x1f4bc8['$or']=_[_0xaa2f('0x18')](_0x50f481,function(_0x52af56){var _0x35ea10={};_0x35ea10[_0x52af56]=_0x10a331[_0xaa2f('0x19')]?_0x10a331[_0xaa2f('0x1a')]:_0x10a331[_0xaa2f('0x1b')];return _0x35ea10;});_0x319013=_0x10a331[_0xaa2f('0x19')]?_0x10a331[_0xaa2f('0x1a')]:_0x10a331[_0xaa2f('0x1b')];}var _0x2636dd=['id',_0xaa2f('0x1c'),_0xaa2f('0x1d'),_0xaa2f('0x17'),_0xaa2f('0x1e'),'fax',_0xaa2f('0x14'),_0xaa2f('0x1f'),_0xaa2f('0x20'),_0xaa2f('0x21')];var _0x55e804=_[_0xaa2f('0x22')](_0x2636dd,_0x50f481);BPromise[_0xaa2f('0x23')]()['then'](cmContactRpc[_0xaa2f('0x24')]({'attributes':_0x55e804,'where':_0x1f4bc8,'phone':_0x319013}))[_0xaa2f('0x25')](function(_0x32c95c){_0x161193=_0x32c95c;if(!_[_0xaa2f('0x26')](_0x161193)){if(_0x161193[_0xaa2f('0x27')]===0x1){_0x336fed=_0x161193[0x0];logger[_0xaa2f('0xa')](_0xaa2f('0x28'),_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id'],_0x336fed['id']);}else{logger[_0xaa2f('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id'],_['map'](_0x161193,'id')[_0xaa2f('0x2a')](','));}return;}else{logger['info'](_0xaa2f('0x2b'),_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id']);var _0x4e1315={'ListId':_0x285419};var _0x44e42c=_0x117964[_0xaa2f('0x2c')]&&_0x117964['data4']!=='0'?_0x117964[_0xaa2f('0x2c')]:'phone';if(_0x2edd43){logger[_0xaa2f('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id']);_0x4e1315[_0x44e42c]=_['isNil'](_0x10a331['routeId'])?_0x10a331[_0xaa2f('0x1b')]:_0x10a331[_0xaa2f('0x1a')];if(_[_0xaa2f('0x11')](_0x10a331[_0xaa2f('0x19')])){_0x4e1315['firstName']=_0x10a331[_0xaa2f('0x2d')]&&_0x10a331[_0xaa2f('0x2d')]!==''?_0x10a331[_0xaa2f('0x2d')]:'Unknown';}else{_0x4e1315[_0xaa2f('0x1c')]=_0x10a331[_0xaa2f('0x2e')]&&_0x10a331['destcalleridname']!==_0xaa2f('0x2f')?_0x10a331['destcalleridname']:_0xaa2f('0x30');}return BPromise['resolve']()['then'](cmContactRpc[_0xaa2f('0x31')](_0x4e1315))[_0xaa2f('0x25')](function(_0xcee62a){_0x336fed=_0xcee62a;_0x161193[_0xaa2f('0x32')](_0xcee62a);if(_0x336fed){logger['info'](_0xaa2f('0x33'),_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id'],_0x336fed['id']);}return;});}else{logger[_0xaa2f('0xa')](_0xaa2f('0x34'),_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id']);_0x4e1315[_0x44e42c]=_[_0xaa2f('0x11')](_0x10a331[_0xaa2f('0x19')])?_0x10a331[_0xaa2f('0x1b')]:_0x10a331[_0xaa2f('0x1a')];if(_[_0xaa2f('0x11')](_0x10a331[_0xaa2f('0x19')])){_0x4e1315[_0xaa2f('0x1c')]=_0x10a331[_0xaa2f('0x2d')]&&_0x10a331['calleridname']!==''?_0x10a331[_0xaa2f('0x2d')]:_0xaa2f('0x30');}else{_0x4e1315[_0xaa2f('0x1c')]=_0x10a331['destcalleridname']&&_0x10a331['destcalleridname']!==_0xaa2f('0x2f')?_0x10a331[_0xaa2f('0x2e')]:_0xaa2f('0x30');}_0x336fed=_0x4e1315;_0x161193[_0xaa2f('0x32')](_0x4e1315);return;}}})[_0xaa2f('0x25')](function(){if(_0x4a2b7c){emit(_0x10a331[_0xaa2f('0x29')],_0x1aa8b7,util[_0xaa2f('0x35')](_0xaa2f('0x36'),_0x4a2b7c[_0xaa2f('0x37')]),util[_0xaa2f('0x35')](_0xaa2f('0x38'),_0x117964['action'][_0xaa2f('0x39')]()),{'evt':_[_0xaa2f('0x3a')](_0x10a331,{'autoCreate':_0x2edd43}),'contact':_0x336fed===undefined?{}:_0x336fed,'contacts':_0x161193[_0xaa2f('0x27')]===0x0?undefined:_0x161193});}});}; \ No newline at end of file +var _0xca2f=['action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','ListId','data3','split','phone','destcalleridnum','calleridnum','firstName','lastName','fax','scheduledAt','union','resolve','then','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s'];(function(_0xd2b47c,_0x25a201){var _0xa76f19=function(_0x4ba820){while(--_0x4ba820){_0xd2b47c['push'](_0xd2b47c['shift']());}};_0xa76f19(++_0x25a201);}(_0xca2f,0x1f2));var _0xfca2=function(_0x466385,_0x4beea5){_0x466385=_0x466385-0x0;var _0x199f01=_0xca2f[_0x466385];return _0x199f01;};'use strict';var _=require(_0xfca2('0x0'));var BPromise=require(_0xfca2('0x1'));var Redis=require(_0xfca2('0x2'));var util=require(_0xfca2('0x3'));var config=require(_0xfca2('0x4'));var logger=require(_0xfca2('0x5'))(_0xfca2('0x6'));var cmContactRpc=require(_0xfca2('0x7'));config[_0xfca2('0x8')]=_[_0xfca2('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfca2('0xa'))(new Redis(config[_0xfca2('0x8')]));function emit(_0x1ab6b3,_0x53e9d2,_0x2f49dd,_0x5ab01a,_0x5b2fea){logger[_0xfca2('0xb')](_0xfca2('0xc'),_0x1ab6b3,_0x53e9d2['id'],_0x2f49dd,_0x5ab01a,JSON[_0xfca2('0xd')](_0x5b2fea));io['to'](_0x2f49dd)['emit'](_0x5ab01a,_0x5b2fea);}exports[_0xfca2('0xe')]=function(_0x2a8c80,_0x3921e4,_0x4ae48e,_0x57df70){var _0x299521,_0x32e8fb;var _0x5553bd={};var _0x2583f9;var _0x310e2e=Number(_0x4ae48e[_0xfca2('0xf')]);var _0x3704ac=_0x4ae48e[_0xfca2('0x10')]?Boolean(Number(_0x4ae48e[_0xfca2('0x10')])):![];var _0x2fbd60;var _0x14405e=![];if(!_[_0xfca2('0x11')](_0x4ae48e[_0xfca2('0x12')])){if(_0x4ae48e[_0xfca2('0x12')]=='1')_0x14405e=!![];}if(!_0x14405e){if(_0x57df70['xmd-contactid']){_0x5553bd['id']=_0x57df70['xmd-contactid'];}}if(!_0x5553bd['id']){_0x5553bd[_0xfca2('0x13')]=_0x310e2e;_0x2fbd60=_0x4ae48e[_0xfca2('0x14')]&&_0x4ae48e[_0xfca2('0x14')]!=='0'?_0x4ae48e['data3'][_0xfca2('0x15')](','):[_0xfca2('0x16')];_0x5553bd['$or']=_['map'](_0x2fbd60,function(_0x42f4aa){var _0x22e1fa={};_0x22e1fa[_0x42f4aa]=_0x57df70['routeId']?_0x57df70[_0xfca2('0x17')]:_0x57df70['calleridnum'];return _0x22e1fa;});_0x2583f9=_0x57df70['routeId']?_0x57df70[_0xfca2('0x17')]:_0x57df70[_0xfca2('0x18')];}var _0x163edb=['id',_0xfca2('0x19'),_0xfca2('0x1a'),_0xfca2('0x16'),'mobile',_0xfca2('0x1b'),_0xfca2('0x13'),'createdAt',_0xfca2('0x1c'),'updatedAt'];var _0x58aa16=_[_0xfca2('0x1d')](_0x163edb,_0x2fbd60);BPromise[_0xfca2('0x1e')]()[_0xfca2('0x1f')](cmContactRpc['getContacts']({'attributes':_0x58aa16,'where':_0x5553bd,'phone':_0x2583f9}))[_0xfca2('0x1f')](function(_0x3bcc9f){_0x32e8fb=_0x3bcc9f;if(!_['isEmpty'](_0x32e8fb)){if(_0x32e8fb[_0xfca2('0x20')]===0x1){_0x299521=_0x32e8fb[0x0];logger[_0xfca2('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x57df70[_0xfca2('0x21')],_0x3921e4['id'],_0x299521['id']);}else{logger[_0xfca2('0xb')](_0xfca2('0x22'),_0x57df70[_0xfca2('0x21')],_0x3921e4['id'],_[_0xfca2('0x23')](_0x32e8fb,'id')[_0xfca2('0x24')](','));}return;}else{logger['info'](_0xfca2('0x25'),_0x57df70[_0xfca2('0x21')],_0x3921e4['id']);var _0x4f9492={'ListId':_0x310e2e};var _0x1d3582=_0x4ae48e[_0xfca2('0x26')]&&_0x4ae48e[_0xfca2('0x26')]!=='0'?_0x4ae48e[_0xfca2('0x26')]:_0xfca2('0x16');if(_0x3704ac){logger[_0xfca2('0xb')](_0xfca2('0x27'),_0x57df70[_0xfca2('0x21')],_0x3921e4['id']);_0x4f9492[_0x1d3582]=_['isNil'](_0x57df70[_0xfca2('0x28')])?_0x57df70['calleridnum']:_0x57df70[_0xfca2('0x17')];if(_['isNil'](_0x57df70[_0xfca2('0x28')])){_0x4f9492[_0xfca2('0x19')]=_0x57df70[_0xfca2('0x29')]&&_0x57df70['calleridname']!==_0xfca2('0x2a')?_0x57df70[_0xfca2('0x29')]:_0xfca2('0x2b');}else{_0x4f9492[_0xfca2('0x19')]=_0x57df70[_0xfca2('0x2c')]&&_0x57df70[_0xfca2('0x2c')]!==_0xfca2('0x2a')?_0x57df70[_0xfca2('0x2c')]:_0xfca2('0x2b');}return BPromise[_0xfca2('0x1e')]()['then'](cmContactRpc['createContact'](_0x4f9492))[_0xfca2('0x1f')](function(_0x360ac3){_0x299521=_0x360ac3;_0x32e8fb[_0xfca2('0x2d')](_0x360ac3);if(_0x299521){logger[_0xfca2('0xb')](_0xfca2('0x2e'),_0x57df70[_0xfca2('0x21')],_0x3921e4['id'],_0x299521['id']);}return;});}else{logger['info'](_0xfca2('0x2f'),_0x57df70['uniqueid'],_0x3921e4['id']);_0x4f9492[_0x1d3582]=_[_0xfca2('0x11')](_0x57df70[_0xfca2('0x28')])?_0x57df70['calleridnum']:_0x57df70[_0xfca2('0x17')];if(_[_0xfca2('0x11')](_0x57df70[_0xfca2('0x28')])){_0x4f9492[_0xfca2('0x19')]=_0x57df70[_0xfca2('0x29')]&&_0x57df70['calleridname']!==_0xfca2('0x2a')?_0x57df70[_0xfca2('0x29')]:'Unknown';}else{_0x4f9492['firstName']=_0x57df70['destcalleridname']&&_0x57df70['destcalleridname']!==_0xfca2('0x2a')?_0x57df70[_0xfca2('0x2c')]:_0xfca2('0x2b');}_0x299521=_0x4f9492;_0x32e8fb[_0xfca2('0x2d')](_0x4f9492);return;}}})[_0xfca2('0x1f')](function(){if(_0x2a8c80){emit(_0x57df70[_0xfca2('0x21')],_0x3921e4,util['format'](_0xfca2('0x30'),_0x2a8c80[_0xfca2('0x31')]),util[_0xfca2('0x32')](_0xfca2('0x33'),_0x4ae48e[_0xfca2('0x34')][_0xfca2('0x35')]()),{'evt':_[_0xfca2('0x36')](_0x57df70,{'autoCreate':_0x3704ac}),'contact':_0x299521===undefined?{}:_0x299521,'contacts':_0x32e8fb['length']===0x0?undefined:_0x32e8fb});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ad1337c..8106ef4 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 _0xb547=['trigger','../ami','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','custom:dialend','syncAgentDial','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','emit','info','stringify','clone','motionChannel','debug','checkTriggers','prototype','interface','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','isNil','data3','uriLocation','data4','windowWidth','data5','windowHeight','data6','600','winApplication','winArguments','render','format','user:%s','name','jscripty','trigger:%s','exec','queue','routeId','script','buildUri','parse','search','channel','AllConditions','every','checkConditions','some','AnyConditions','inspect','evt','account','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','event','agent','membername','lastevent','mailSubstatus','undefined','substatus','offlineMessage','created','equals','lodash','url','ioredis','./urlforward','./integration','./script','../../../config/environment'];(function(_0x5057b6,_0x48fd8b){var _0x2d7dba=function(_0x3197b4){while(--_0x3197b4){_0x5057b6['push'](_0x5057b6['shift']());}};_0x2d7dba(++_0x48fd8b);}(_0xb547,0x74));var _0x7b54=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0xb547[_0x56ba92];return _0x8fe94d;};'use strict';var util=require('util');var _=require(_0x7b54('0x0'));var url=require(_0x7b54('0x1'));var Mustache=require('mustache');var Redis=require(_0x7b54('0x2'));var urlforward=require(_0x7b54('0x3'));var integration=require(_0x7b54('0x4'));var cmContact=require('./cmContact');var script=require(_0x7b54('0x5'));var config=require(_0x7b54('0x6'));var logger=require('../../../config/logger')(_0x7b54('0x7'));var ami=require(_0x7b54('0x8'));config[_0x7b54('0x9')]=_['defaults'](config['redis'],{'host':_0x7b54('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7b54('0x9')]));var operators={'equals':function(_0x4bb6f2,_0x2c4c2d){return _0x4bb6f2==_0x2c4c2d;},'not_equals':function(_0x2d2f17,_0x4bcd9a){return _0x2d2f17!=_0x4bcd9a;}};var barAndWebActions=[_0x7b54('0xb'),_0x7b54('0x1'),_0x7b54('0xc')];function Trigger(_0x364280){this[_0x7b54('0xd')]=_0x364280[_0x7b54('0xd')];this[_0x7b54('0xe')]=_0x364280['agents'];this[_0x7b54('0xf')]=_0x364280['voiceQueues'];this['templates']=_0x364280[_0x7b54('0x10')];this[_0x7b54('0x11')]=_0x364280['voiceExtensions'];this[_0x7b54('0x12')]=_0x364280['zendeskAccounts'];this[_0x7b54('0x13')]=_0x364280['freshdeskAccounts'];this[_0x7b54('0x14')]=_0x364280[_0x7b54('0x14')];this[_0x7b54('0x15')]=_0x364280[_0x7b54('0x15')];this['zohoAccounts']=_0x364280[_0x7b54('0x16')];this['deskAccounts']=_0x364280['deskAccounts'];this[_0x7b54('0x17')]=_0x364280[_0x7b54('0x17')];this[_0x7b54('0x18')]=_0x364280[_0x7b54('0x18')];this['dynamics365Accounts']=_0x364280[_0x7b54('0x19')];this[_0x7b54('0x1a')]=_0x364280[_0x7b54('0x1a')];this[_0x7b54('0x1b')]={'zendesk':this[_0x7b54('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x7b54('0x13')],'sugarcrm':this[_0x7b54('0x15')],'zoho':this[_0x7b54('0x16')],'desk':this['deskAccounts'],'vtiger':this[_0x7b54('0x17')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x7b54('0x18')]};ami['on']('custom:agentcalled',this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x1e'),this[_0x7b54('0x1c')]['bind'](this));ami['on'](_0x7b54('0x1f'),this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on']('custom:agentcomplete',this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x20'),this[_0x7b54('0x1c')]['bind'](this));ami['on'](_0x7b54('0x21'),this['syncCustomEvent'][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x22'),this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x23'),this[_0x7b54('0x1c')]['bind'](this));ami['on']('custom:agentreject',this[_0x7b54('0x1c')]['bind'](this));ami['on'](_0x7b54('0x24'),this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x25'),this[_0x7b54('0x1c')]['bind'](this));ami['on'](_0x7b54('0x26'),this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x27'),this['syncAgentDial'][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x28'),this['syncAgentDial'][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x29'),this[_0x7b54('0x2a')][_0x7b54('0x1d')](this));ami['on']('custom:newinteraction',this[_0x7b54('0x1c')]['bind'](this));ami['on'](_0x7b54('0x2b'),this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x2c'),this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x2d'),this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x2e'),this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on'](_0x7b54('0x2f'),this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on']('custom:rejectmessage',this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));ami['on']('custom:offlineMessage',this[_0x7b54('0x1c')][_0x7b54('0x1d')](this));}Trigger['prototype'][_0x7b54('0x30')]=function(_0x683db5,_0x222bc1,_0x5aa0bf){logger[_0x7b54('0x31')](_0x683db5,_0x222bc1,JSON[_0x7b54('0x32')](_0x5aa0bf));io['to'](_0x683db5)[_0x7b54('0x30')](_0x222bc1,_0x5aa0bf);};Trigger['prototype'][_0x7b54('0x1c')]=function(_0x249ed8){var _0x44facf=_[_0x7b54('0x33')](_0x249ed8);if(typeof _0x44facf[_0x7b54('0x34')]==='undefined'){_0x44facf['motionChannel']='voice';}logger[_0x7b54('0x35')](_0x7b54('0x1c'),util['inspect'](_0x44facf,{'showHidden':!![],'depth':null}));this[_0x7b54('0x36')](_0x44facf);};Trigger[_0x7b54('0x37')][_0x7b54('0x2a')]=function(_0x51c015){if(this[_0x7b54('0xe')][_0x51c015[_0x7b54('0x38')]]){this['syncCustomEvent'](_0x51c015);}};Trigger[_0x7b54('0x37')][_0x7b54('0x36')]=function(_0x33107c){var _0x475f4c;for(var _0x56e65b in this[_0x7b54('0xd')]){if(this[_0x7b54('0xd')]['hasOwnProperty'](_0x56e65b)){if(this['triggers'][_0x56e65b][_0x7b54('0x39')]){_0x475f4c=this[_0x7b54('0x3a')](this[_0x7b54('0xd')][_0x56e65b],_0x33107c);if(_0x475f4c){_[_0x7b54('0x3b')](_0x33107c,_0x33107c[_0x7b54('0x3c')]);for(var _0x4efce7=0x0,_0x3e79b0,_0x558021,_0x106487;_0x4efce70x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x4ac0e9,_0x11fca8){var _0x2354f9=function(_0x872e42){while(--_0x872e42){_0x4ac0e9['push'](_0x4ac0e9['shift']());}};_0x2354f9(++_0x11fca8);}(_0x7217,0x19e));var _0x7721=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x7217[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 1553d55..3efc582 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 _0x4804=['Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','data5','POST','clientId','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','email','userEmail','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','toUpperCase','username','catch','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','odata-entityid','substring','lastIndexOf','telephone1','contacts?$select=','\x20eq\x20\x27','replace','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','enduserId','length','forEach','includes','string','picklist','type','nameField','customField','idField','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Bearer\x20','phonecall','queue','phonecalls','assign','callDirection','Fields','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab'];(function(_0x408de5,_0x24fa7b){var _0x2015a1=function(_0x13082c){while(--_0x13082c){_0x408de5['push'](_0x408de5['shift']());}};_0x2015a1(++_0x24fa7b);}(_0x4804,0xe3));var _0x4480=function(_0x51bb4e,_0x365990){_0x51bb4e=_0x51bb4e-0x0;var _0x33d753=_0x4804[_0x51bb4e];return _0x33d753;};'use strict';var _=require('lodash');var rp=require(_0x4480('0x0'));var util=require('util');var intUtil=require('./util');var md5=require(_0x4480('0x1'));var Redis=require(_0x4480('0x2'));var logger=require(_0x4480('0x3'))(_0x4480('0x4'));var config=require('../../../../config/environment');config[_0x4480('0x5')]=_[_0x4480('0x6')](config[_0x4480('0x5')],{'host':_0x4480('0x7'),'port':0x18eb});var io=require(_0x4480('0x8'))(new Redis(config[_0x4480('0x5')]));function getAuthToken(_0x130b94,_0xeba925,_0x51219c){if(_0x130b94[_0x4480('0x9')]){_0x130b94[_0x4480('0xa')]=_0x130b94[_0x4480('0xb')]['data7'];_0x130b94[_0x4480('0xc')]=_0x130b94[_0x4480('0xb')][_0x4480('0xd')];return Promise['resolve'](_0x130b94[_0x4480('0xb')][_0x4480('0xe')]);}var _0x2734b9={'method':_0x4480('0xf'),'uri':_0xeba925,'form':{'client_id':_0x130b94[_0x4480('0x10')],'resource':_0x130b94[_0x4480('0xa')],'username':_0x130b94['username'],'password':_0x130b94[_0x4480('0x11')],'grant_type':_0x4480('0x11'),'client_secret':_0x130b94[_0x4480('0x12')]},'json':!![]};return rp(_0x2734b9)[_0x4480('0x13')](function(_0x1c155f){return _0x1c155f[_0x4480('0x14')];})['catch'](function(_0x301934){logger[_0x4480('0x15')]('['+[_0x51219c['toUpperCase']()]+_0x4480('0x16'));return _0x301934['message'];});}function getUser(_0x59e90e,_0x200722,_0x41c620,_0xa48e9,_0x4e1688,_0x38cd35){return new Promise(function(_0x35e9ba,_0xa5c872){return getAuthToken(_0x200722,_0xa48e9,_0x38cd35)[_0x4480('0x13')](function(_0x3f760f){var _0x3d0b90={'method':_0x4480('0x17'),'uri':_0x4e1688+_0x4480('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x3f760f,'OData-Version':_0x4480('0x19')},'json':!![]};return rp(_0x3d0b90);})[_0x4480('0x13')](function(_0x354094){var _0x73362a=_0x354094[_0x4480('0x1a')];var _0x4b2ddc=![];var _0x25b260=null;if(!_[_0x4480('0x1b')](_0x41c620)){if(intUtil['validateEmail'](_0x41c620[_0x4480('0x1c')])){_0x59e90e[_0x4480('0x1d')]=_0x41c620[_0x4480('0x1c')];for(_0x25b260=0x0;_0x25b260<_0x73362a['length'];_0x25b260++){if(_0x73362a[_0x25b260][_0x4480('0x1e')]===_0x41c620[_0x4480('0x1c')]&&!_0x73362a[_0x25b260][_0x4480('0x1f')]){_0x4b2ddc=!![];logger['info']('['+[_0x38cd35['toUpperCase']()]+_0x4480('0x20')+_0x73362a[_0x25b260][_0x4480('0x21')]+'!');_0x59e90e[_0x4480('0x22')]=_0x73362a[_0x25b260][_0x4480('0x21')];}}}}if(!_0x4b2ddc){logger[_0x4480('0x23')]('['+[_0x38cd35[_0x4480('0x24')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x59e90e[_0x4480('0x1d')]=_0x200722[_0x4480('0x25')];for(_0x25b260=0x0;_0x25b260<_0x73362a['length'];_0x25b260++){if(_0x73362a[_0x25b260][_0x4480('0x1e')]===_0x200722['username']){_0x59e90e['userId']=_0x73362a[_0x25b260][_0x4480('0x21')];}}}_0x35e9ba(_0x59e90e);})[_0x4480('0x26')](function(_0x5946c3){_0xa5c872(_0x5946c3[_0x4480('0x27')]);});});}function createEndUser(_0x30b18c,_0x494c1e,_0x353310,_0x1b815d,_0x4c761,_0x328c0c,_0x189de5){return new Promise(function(_0x1517fe,_0x106050){return getAuthToken(_0x494c1e,_0x353310,_0x328c0c)['then'](function(_0x1d94af){var _0x9f355c=_0x328c0c[_0x4480('0x28')]()===_0x4480('0x29')?_0x4c761[_0x4480('0x2a')]:_0x4c761[_0x4480('0x2b')];var _0x352653={'method':_0x4480('0xf'),'uri':_0x1b815d+_0x4480('0x2c'),'body':{'fullname':_0x9f355c,'firstname':_0x9f355c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x4480('0x2d')+_0x30b18c['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x1d94af,'OData-Version':_0x4480('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x352653[_0x4480('0x2e')][_0x189de5]=_0x9f355c;return rp(_0x352653);})['then'](function(_0x5af384){var _0x4e4477=_0x5af384['headers'][_0x4480('0x2f')];var _0x58b0e6=_0x4e4477[_0x4480('0x30')](_0x4e4477[_0x4480('0x31')]('(')+0x1,_0x4e4477['lastIndexOf'](')'));_0x30b18c['enduserId']=_0x58b0e6;_0x1517fe(_0x30b18c);})['catch'](function(_0x4a96a8){_0x106050(_0x4a96a8['message']);});});}function getEndUser(_0x2577f9,_0x3e8fa2,_0x373e15,_0x4bd285,_0xfcb373,_0x266776,_0xea6b1e,_0x451cb2){var _0x172269=_0x266776[_0x4480('0x28')]()===_0x4480('0x29')?_0xfcb373[_0x4480('0x2a')]:_0xfcb373[_0x4480('0x2b')];return getAuthToken(_0x3e8fa2,_0x373e15,_0x266776)[_0x4480('0x13')](function(_0x250afb){_0x451cb2=_0x451cb2?_0x451cb2:_0x4480('0x32');var _0x548079={'method':'GET','uri':_0x4bd285+_0x4480('0x33')+_0x451cb2+'&$filter='+_0x451cb2+_0x4480('0x34')+_0x172269[_0x4480('0x35')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x250afb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x548079);})[_0x4480('0x13')](function(_0x5631cb){var _0x4d4c0d=![];if(!_0x5631cb)return _0x4d4c0d;var _0x20e75b=_0x5631cb['value'];for(var _0x456c10=0x0;_0x456c10<_0x20e75b['length'];_0x456c10++){if(_0x20e75b[_0x456c10][_0x451cb2]===_0x172269){_0x4d4c0d=!![];_0x2577f9['enduserId']=_0x20e75b[_0x456c10]['contactid'];}}return _0x4d4c0d;})[_0x4480('0x13')](function(_0x34fd24){if(_0x34fd24)return _0x2577f9;if(_0xea6b1e===_0x4480('0x36')){logger[_0x4480('0x23')]('['+[_0x266776[_0x4480('0x24')]()]+_0x4480('0x37'));return _0x2577f9;}return createEndUser(_0x2577f9,_0x3e8fa2,_0x373e15,_0x4bd285,_0xfcb373,_0x266776,_0x451cb2)[_0x4480('0x13')](function(_0x1d0b3e){logger['info']('['+[_0x266776['toUpperCase']()]+_0x4480('0x38'),_0x1d0b3e[_0x4480('0x39')]);return _0x1d0b3e;});});}function getCustomFields(_0x2e3aeb,_0x308b6d,_0x4cd2cd){var _0x1ae93f={};if(_0x2e3aeb[_0x4480('0x3a')]>0x0){_[_0x4480('0x3b')](_0x2e3aeb,function(_0x3b177c){if(_[_0x4480('0x3c')]([_0x4480('0x3d'),_0x4480('0x3e')],_0x3b177c[_0x4480('0x3f')])&&_0x3b177c[_0x4480('0x40')]&&!_0x3b177c[_0x4480('0x41')]){var _0x2151e8=_0x3b177c[_0x4480('0x42')][_0x4480('0x28')]();var _0x12e5ca=_0x2151e8[_0x4480('0x30')](0x0,_0x2151e8['indexOf']('_'));var _0x304812=_0x2151e8[_0x4480('0x30')](_0x2151e8['indexOf']('_')+0x1);if(_0x12e5ca===_0x4cd2cd){_0x1ae93f[_0x304812]=_0x3b177c[_0x4480('0x43')];}}});}return _0x1ae93f;}function getTicket(_0x971e43,_0x227721,_0x245e0c,_0x2fac9d,_0x594647,_0x2c597b,_0x359160){return new Promise(function(_0x48a7c2,_0x4bad25){var _0x32c289;return getAuthToken(_0x227721,_0x245e0c,_0x359160)['then'](function(_0x8a62fc){if(_0x2c597b[_0x4480('0x44')]===_0x4480('0x45')){_0x32c289={'method':_0x4480('0xf'),'uri':_0x2fac9d+_0x4480('0x46'),'body':Object['assign']({},{'title':intUtil[_0x4480('0x47')](_0x2c597b[_0x4480('0x48')],_0x594647,'\x20'),'description':intUtil[_0x4480('0x47')](_0x2c597b[_0x4480('0x49')],_0x594647,'\x0a'),'customerid_contact@odata.bind':_0x971e43[_0x4480('0x39')]?_0x4480('0x4a')+_0x971e43[_0x4480('0x39')]+')':undefined,'ownerid@odata.bind':_0x4480('0x2d')+_0x971e43[_0x4480('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x2c597b['Fields'],_0x594647,_0x2c597b[_0x4480('0x44')])),'headers':{'Authorization':_0x4480('0x4b')+_0x8a62fc,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2c597b['ticketType']===_0x4480('0x4c')){var _0x29a8=_0x971e43[_0x4480('0x39')]?[{'partyid_systemuser@odata.bind':_0x4480('0x2d')+_0x971e43['userId']+')','participationtypemask':_0x971e43['callDirection']===_0x4480('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x4480('0x4a')+_0x971e43['enduserId']+')','participationtypemask':_0x971e43['callDirection']===_0x4480('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x4480('0x2d')+_0x971e43[_0x4480('0x22')]+')','participationtypemask':_0x971e43['callDirection']===_0x4480('0x4d')?0x2:0x1}];_0x32c289={'method':_0x4480('0xf'),'uri':_0x2fac9d+_0x4480('0x4e'),'body':Object[_0x4480('0x4f')]({},{'subject':intUtil[_0x4480('0x47')](_0x2c597b[_0x4480('0x48')],_0x594647,'\x20'),'phonenumber':String(_0x594647[_0x4480('0x2b')]),'description':intUtil[_0x4480('0x47')](_0x2c597b[_0x4480('0x49')],_0x594647,'\x0a'),'regardingobjectid_contact@odata.bind':_0x971e43[_0x4480('0x39')]?'/contacts('+_0x971e43[_0x4480('0x39')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x971e43['userId']+')','directioncode':_0x971e43[_0x4480('0x50')]===_0x4480('0x4d')?![]:!![],'phonecall_activity_parties':_0x29a8},getCustomFields(_0x2c597b[_0x4480('0x51')],_0x594647,_0x2c597b[_0x4480('0x44')])),'headers':{'Authorization':_0x4480('0x4b')+_0x8a62fc,'OData-Version':_0x4480('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x32c289);})[_0x4480('0x13')](function(_0x28e238){var _0x4dca11=_0x28e238[_0x4480('0x52')]['odata-entityid'];var _0x222cd6=_0x4dca11[_0x4480('0x30')](_0x4dca11[_0x4480('0x31')]('(')+0x1,_0x4dca11['lastIndexOf'](')'));_0x971e43[_0x4480('0x53')]=_0x222cd6;_0x48a7c2(_0x971e43);})[_0x4480('0x26')](function(_0x4ffe86){_0x4bad25(_0x4ffe86[_0x4480('0x27')]);});});}function emit(_0x22a2e7,_0x4ffe8b,_0x41d303,_0x1cdbbd){var _0x125101={'uri':util[_0x4480('0x54')](_0x4480('0x55'),_0x22a2e7,_0x41d303,_0x1cdbbd)};io['to'](util[_0x4480('0x54')]('user:%s',_0x4ffe8b))[_0x4480('0x56')](_0x4480('0x57'),_0x125101);}exports['cs']=function(_0x20d405,_0x16c4f0,_0x56bf1f,_0x277519,_0x5ede0,_0x39b0df,_0x1039a8,_0xd8a542){var _0x3cb0ab={};_0x39b0df[_0x4480('0xa')]=_0x39b0df[_0x4480('0x9')]?intUtil[_0x4480('0x58')](_0x39b0df['CloudProvider'][_0x4480('0x59')]):intUtil[_0x4480('0x58')](_0x39b0df[_0x4480('0xa')]);_0x39b0df[_0x4480('0x5a')]=intUtil['stripTrailingSlash'](_0x39b0df[_0x4480('0x5a')]);_0x3cb0ab['callDirection']=_0xd8a542===_0x4480('0x4d')||_0xd8a542==='unmanaged'?_0x4480('0x4d'):_0x4480('0x29');var _0x2e378c=_0x39b0df['modernAuthentication']?util[_0x4480('0x54')](_0x4480('0x5b'),_0x39b0df[_0x4480('0xb')][_0x4480('0x59')]):util[_0x4480('0x54')](_0x4480('0x5b'),_0x39b0df[_0x4480('0xa')]);var _0x23fcec=util[_0x4480('0x54')](_0x4480('0x5c'),_0x39b0df[_0x4480('0xc')]);var _0x1bacf0=util[_0x4480('0x54')](_0x4480('0x5d'),_0x39b0df['serverUrl'],_0x16c4f0['uniqueid'],md5(_0x16c4f0[_0x4480('0x5e')]));if(_0x5ede0&&_0x5ede0[_0x4480('0x5f')]){logger[_0x4480('0x23')](_0x4480('0x60'),_0x4480('0x61'));_0x16c4f0['recordingURL']=_0x1bacf0;}else if(_0x1039a8&&_0x1039a8[_0x4480('0x62')]&&_0x1039a8[_0x4480('0x62')]!=='none'){logger['info'](_0x4480('0x63'),_0x4480('0x61'));_0x16c4f0[_0x4480('0x64')]=_0x1bacf0;}else{_0x16c4f0[_0x4480('0x64')]='';}return getUser(_0x3cb0ab,_0x39b0df,_0x277519,_0x23fcec,_0x2e378c,_0xd8a542)['then'](function(_0x58fde9){logger[_0x4480('0x23')]('['+_0xd8a542[_0x4480('0x24')]()+']\x20The\x20User\x20ID\x20is:',_0x58fde9['userId']);logger[_0x4480('0x23')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x65'),_0x58fde9['userEmail']);return getEndUser(_0x58fde9,_0x39b0df,_0x23fcec,_0x2e378c,_0x16c4f0,_0xd8a542,_0x56bf1f[_0x4480('0x66')],_0x56bf1f['additionalSearchContact']);})[_0x4480('0x13')](function(_0x115443){logger['info']('['+_0xd8a542['toUpperCase']()+_0x4480('0x67'),_0x115443[_0x4480('0x39')]);logger[_0x4480('0x23')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x68'),_0x16c4f0[_0x4480('0x2b')]);return getTicket(_0x115443,_0x39b0df,_0x23fcec,_0x2e378c,_0x16c4f0,_0x56bf1f,_0xd8a542);})['then'](function(_0x57d192){logger[_0x4480('0x23')](util[_0x4480('0x54')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x69'),_0x56bf1f['ticketType'],_0x57d192['ticketId']));logger[_0x4480('0x23')](util[_0x4480('0x54')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x6a'),_0xd8a542));if(_0xd8a542!==_0x4480('0x6b')&&_0x56bf1f[_0x4480('0x6c')]){logger['info']('['+_0xd8a542[_0x4480('0x24')]()+']',_0x4480('0x6d'));emit(_0x39b0df[_0x4480('0xa')],_0x277519[_0x4480('0x6e')],_0x56bf1f[_0x4480('0x44')],_0x57d192['ticketId']);}})[_0x4480('0x26')](function(_0x46c816){logger[_0x4480('0x15')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x6f'),_0x46c816[_0x4480('0x27')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x46c816);});}; \ No newline at end of file +var _0x6828=['password','access_token','catch','error',']\x20Wrong\x20credentials!','message','then','GET','4.0','value','isNil','validateEmail','email','length','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','userId','Bearer\x20','body','headers','substring','enduserId','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','nameField','customField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','odata-entityid','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','CloudProvider','data7','tenantId','resolve','data5','clientId','remoteUri','username'];(function(_0x2fa55d,_0x5d83ce){var _0x14229c=function(_0x5b031c){while(--_0x5b031c){_0x2fa55d['push'](_0x2fa55d['shift']());}};_0x14229c(++_0x5d83ce);}(_0x6828,0x1a3));var _0x8682=function(_0x2a645d,_0x915cce){_0x2a645d=_0x2a645d-0x0;var _0x2d0f8e=_0x6828[_0x2a645d];return _0x2d0f8e;};'use strict';var _=require(_0x8682('0x0'));var rp=require(_0x8682('0x1'));var util=require(_0x8682('0x2'));var intUtil=require(_0x8682('0x3'));var md5=require(_0x8682('0x4'));var Redis=require(_0x8682('0x5'));var logger=require(_0x8682('0x6'))(_0x8682('0x7'));var config=require(_0x8682('0x8'));config[_0x8682('0x9')]=_[_0x8682('0xa')](config[_0x8682('0x9')],{'host':_0x8682('0xb'),'port':0x18eb});var io=require(_0x8682('0xc'))(new Redis(config['redis']));function getAuthToken(_0x1fb415,_0x562284,_0x21d96b){if(_0x1fb415['modernAuthentication']){_0x1fb415['remoteUri']=_0x1fb415[_0x8682('0xd')][_0x8682('0xe')];_0x1fb415[_0x8682('0xf')]=_0x1fb415[_0x8682('0xd')]['data2'];return Promise[_0x8682('0x10')](_0x1fb415[_0x8682('0xd')][_0x8682('0x11')]);}var _0x598bf5={'method':'POST','uri':_0x562284,'form':{'client_id':_0x1fb415[_0x8682('0x12')],'resource':_0x1fb415[_0x8682('0x13')],'username':_0x1fb415[_0x8682('0x14')],'password':_0x1fb415[_0x8682('0x15')],'grant_type':'password','client_secret':_0x1fb415['clientSecret']},'json':!![]};return rp(_0x598bf5)['then'](function(_0x8685e7){return _0x8685e7[_0x8682('0x16')];})[_0x8682('0x17')](function(_0x4e00d2){logger[_0x8682('0x18')]('['+[_0x21d96b['toUpperCase']()]+_0x8682('0x19'));return _0x4e00d2[_0x8682('0x1a')];});}function getUser(_0x301c49,_0x2d2029,_0x34fe79,_0x184917,_0x2e42ae,_0x85dc){return new Promise(function(_0x25bcb9,_0x539aea){return getAuthToken(_0x2d2029,_0x184917,_0x85dc)[_0x8682('0x1b')](function(_0xa61bf0){var _0x4bb9ab={'method':_0x8682('0x1c'),'uri':_0x2e42ae+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0xa61bf0,'OData-Version':_0x8682('0x1d')},'json':!![]};return rp(_0x4bb9ab);})[_0x8682('0x1b')](function(_0x2dc0eb){var _0x2afdee=_0x2dc0eb[_0x8682('0x1e')];var _0x35589f=![];var _0x30eeae=null;if(!_[_0x8682('0x1f')](_0x34fe79)){if(intUtil[_0x8682('0x20')](_0x34fe79['email'])){_0x301c49['userEmail']=_0x34fe79[_0x8682('0x21')];for(_0x30eeae=0x0;_0x30eeae<_0x2afdee[_0x8682('0x22')];_0x30eeae++){if(_0x2afdee[_0x30eeae]['internalemailaddress']===_0x34fe79['email']&&!_0x2afdee[_0x30eeae]['isdisabled']){_0x35589f=!![];logger[_0x8682('0x23')]('['+[_0x85dc[_0x8682('0x24')]()]+_0x8682('0x25')+_0x2afdee[_0x30eeae]['systemuserid']+'!');_0x301c49['userId']=_0x2afdee[_0x30eeae][_0x8682('0x26')];}}}}if(!_0x35589f){logger[_0x8682('0x23')]('['+[_0x85dc[_0x8682('0x24')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x301c49['userEmail']=_0x2d2029['username'];for(_0x30eeae=0x0;_0x30eeae<_0x2afdee[_0x8682('0x22')];_0x30eeae++){if(_0x2afdee[_0x30eeae]['internalemailaddress']===_0x2d2029[_0x8682('0x14')]){_0x301c49['userId']=_0x2afdee[_0x30eeae][_0x8682('0x26')];}}}_0x25bcb9(_0x301c49);})['catch'](function(_0x27a596){_0x539aea(_0x27a596[_0x8682('0x1a')]);});});}function createEndUser(_0x459845,_0x4c1d22,_0x4b2e47,_0x463880,_0x46f544,_0x332ad6,_0x41aa5e){return new Promise(function(_0x36a05f,_0x365e3d){return getAuthToken(_0x4c1d22,_0x4b2e47,_0x332ad6)[_0x8682('0x1b')](function(_0x18a87e){var _0x365a30=_0x332ad6[_0x8682('0x27')]()===_0x8682('0x28')?_0x46f544[_0x8682('0x29')]:_0x46f544[_0x8682('0x2a')];var _0x3bbf33={'method':_0x8682('0x2b'),'uri':_0x463880+_0x8682('0x2c'),'body':{'fullname':_0x365a30,'firstname':_0x365a30,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8682('0x2d')+_0x459845[_0x8682('0x2e')]+')'},'headers':{'Authorization':_0x8682('0x2f')+_0x18a87e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x3bbf33[_0x8682('0x30')][_0x41aa5e]=_0x365a30;return rp(_0x3bbf33);})[_0x8682('0x1b')](function(_0x572aff){var _0x4e751d=_0x572aff[_0x8682('0x31')]['odata-entityid'];var _0x2edd9d=_0x4e751d[_0x8682('0x32')](_0x4e751d['lastIndexOf']('(')+0x1,_0x4e751d['lastIndexOf'](')'));_0x459845[_0x8682('0x33')]=_0x2edd9d;_0x36a05f(_0x459845);})[_0x8682('0x17')](function(_0x2b6710){_0x365e3d(_0x2b6710[_0x8682('0x1a')]);});});}function getEndUser(_0x2a8394,_0x39d45d,_0xa85b43,_0xec9b2d,_0x2a4f6b,_0x1ddf98,_0x3031dd,_0x1e39f3){var _0x446faa=_0x1ddf98[_0x8682('0x27')]()===_0x8682('0x28')?_0x2a4f6b[_0x8682('0x29')]:_0x2a4f6b[_0x8682('0x2a')];return getAuthToken(_0x39d45d,_0xa85b43,_0x1ddf98)[_0x8682('0x1b')](function(_0x377fab){_0x1e39f3=_0x1e39f3?_0x1e39f3:'telephone1';var _0x58a200={'method':_0x8682('0x1c'),'uri':_0xec9b2d+_0x8682('0x34')+_0x1e39f3+_0x8682('0x35')+_0x1e39f3+_0x8682('0x36')+_0x446faa[_0x8682('0x37')]('+',_0x8682('0x38'))+'\x27','headers':{'Authorization':_0x8682('0x2f')+_0x377fab,'If-None-Match':null,'OData-Version':_0x8682('0x1d')},'json':!![]};return rp(_0x58a200);})['then'](function(_0x3e7021){var _0x9467a8=![];if(!_0x3e7021)return _0x9467a8;var _0x51325b=_0x3e7021[_0x8682('0x1e')];for(var _0x224842=0x0;_0x224842<_0x51325b[_0x8682('0x22')];_0x224842++){if(_0x51325b[_0x224842][_0x1e39f3]===_0x446faa){_0x9467a8=!![];_0x2a8394[_0x8682('0x33')]=_0x51325b[_0x224842][_0x8682('0x39')];}}return _0x9467a8;})[_0x8682('0x1b')](function(_0x19b814){if(_0x19b814)return _0x2a8394;if(_0x3031dd===_0x8682('0x3a')){logger[_0x8682('0x23')]('['+[_0x1ddf98[_0x8682('0x24')]()]+_0x8682('0x3b'));return _0x2a8394;}return createEndUser(_0x2a8394,_0x39d45d,_0xa85b43,_0xec9b2d,_0x2a4f6b,_0x1ddf98,_0x1e39f3)[_0x8682('0x1b')](function(_0x429e95){logger['info']('['+[_0x1ddf98[_0x8682('0x24')]()]+_0x8682('0x3c'),_0x429e95['enduserId']);return _0x429e95;});});}function getCustomFields(_0x3b653c,_0xc3d50b,_0x5e9f0d){var _0x2cd25a={};if(_0x3b653c['length']>0x0){_[_0x8682('0x3d')](_0x3b653c,function(_0x42f9be){if(_[_0x8682('0x3e')](['string','picklist'],_0x42f9be['type'])&&_0x42f9be[_0x8682('0x3f')]&&!_0x42f9be[_0x8682('0x40')]){var _0x27364e=_0x42f9be['idField'][_0x8682('0x27')]();var _0x3c4af1=_0x27364e[_0x8682('0x32')](0x0,_0x27364e[_0x8682('0x41')]('_'));var _0x3f3748=_0x27364e[_0x8682('0x32')](_0x27364e[_0x8682('0x41')]('_')+0x1);if(_0x3c4af1===_0x5e9f0d){_0x2cd25a[_0x3f3748]=_0x42f9be[_0x8682('0x42')];}}});}return _0x2cd25a;}function getTicket(_0x106f1c,_0x351442,_0x4511d6,_0x42c774,_0x685b69,_0x25859c,_0x2f3894){return new Promise(function(_0x3c4e39,_0x2ee6f8){var _0x3e2a30;return getAuthToken(_0x351442,_0x4511d6,_0x2f3894)[_0x8682('0x1b')](function(_0x586db9){if(_0x25859c[_0x8682('0x43')]===_0x8682('0x44')){_0x3e2a30={'method':_0x8682('0x2b'),'uri':_0x42c774+_0x8682('0x45'),'body':Object[_0x8682('0x46')]({},{'title':intUtil[_0x8682('0x47')](_0x25859c[_0x8682('0x48')],_0x685b69,'\x20'),'description':intUtil[_0x8682('0x47')](_0x25859c[_0x8682('0x49')],_0x685b69,'\x0a'),'customerid_contact@odata.bind':_0x106f1c[_0x8682('0x33')]?_0x8682('0x4a')+_0x106f1c[_0x8682('0x33')]+')':undefined,'ownerid@odata.bind':_0x8682('0x2d')+_0x106f1c[_0x8682('0x2e')]+')','caseorigincode':'1'},getCustomFields(_0x25859c[_0x8682('0x4b')],_0x685b69,_0x25859c[_0x8682('0x43')])),'headers':{'Authorization':_0x8682('0x2f')+_0x586db9,'OData-Version':_0x8682('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x25859c['ticketType']===_0x8682('0x4c')){var _0xc26aea=_0x106f1c[_0x8682('0x33')]?[{'partyid_systemuser@odata.bind':_0x8682('0x2d')+_0x106f1c[_0x8682('0x2e')]+')','participationtypemask':_0x106f1c['callDirection']===_0x8682('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x8682('0x4a')+_0x106f1c['enduserId']+')','participationtypemask':_0x106f1c['callDirection']===_0x8682('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x8682('0x2d')+_0x106f1c[_0x8682('0x2e')]+')','participationtypemask':_0x106f1c[_0x8682('0x4e')]==='queue'?0x2:0x1}];_0x3e2a30={'method':_0x8682('0x2b'),'uri':_0x42c774+'phonecalls','body':Object[_0x8682('0x46')]({},{'subject':intUtil[_0x8682('0x47')](_0x25859c[_0x8682('0x48')],_0x685b69,'\x20'),'phonenumber':String(_0x685b69[_0x8682('0x2a')]),'description':intUtil[_0x8682('0x47')](_0x25859c['Descriptions'],_0x685b69,'\x0a'),'regardingobjectid_contact@odata.bind':_0x106f1c[_0x8682('0x33')]?_0x8682('0x4a')+_0x106f1c[_0x8682('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x106f1c[_0x8682('0x2e')]+')','directioncode':_0x106f1c[_0x8682('0x4e')]===_0x8682('0x4d')?![]:!![],'phonecall_activity_parties':_0xc26aea},getCustomFields(_0x25859c['Fields'],_0x685b69,_0x25859c['ticketType'])),'headers':{'Authorization':_0x8682('0x2f')+_0x586db9,'OData-Version':_0x8682('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3e2a30);})[_0x8682('0x1b')](function(_0x35896f){var _0x22dfc5=_0x35896f['headers'][_0x8682('0x4f')];var _0x36a9a2=_0x22dfc5[_0x8682('0x32')](_0x22dfc5['lastIndexOf']('(')+0x1,_0x22dfc5[_0x8682('0x50')](')'));_0x106f1c[_0x8682('0x51')]=_0x36a9a2;_0x3c4e39(_0x106f1c);})[_0x8682('0x17')](function(_0x109d0c){_0x2ee6f8(_0x109d0c[_0x8682('0x1a')]);});});}function emit(_0x590122,_0x230ba6,_0x5494e0,_0xd6cb8b){var _0x2f275c={'uri':util[_0x8682('0x52')](_0x8682('0x53'),_0x590122,_0x5494e0,_0xd6cb8b)};io['to'](util[_0x8682('0x52')](_0x8682('0x54'),_0x230ba6))[_0x8682('0x55')]('trigger:browser:url',_0x2f275c);}exports['cs']=function(_0x39fd43,_0x57607d,_0x5c38f2,_0x27e295,_0x414856,_0x4a2d45,_0x42cc41,_0x2cb658){var _0x3829d1={};_0x4a2d45['remoteUri']=_0x4a2d45[_0x8682('0x56')]?intUtil[_0x8682('0x57')](_0x4a2d45[_0x8682('0xd')][_0x8682('0xe')]):intUtil[_0x8682('0x57')](_0x4a2d45[_0x8682('0x13')]);_0x4a2d45[_0x8682('0x58')]=intUtil[_0x8682('0x57')](_0x4a2d45[_0x8682('0x58')]);_0x3829d1['callDirection']=_0x2cb658==='queue'||_0x2cb658===_0x8682('0x59')?_0x8682('0x4d'):_0x8682('0x28');var _0x2bd859=_0x4a2d45[_0x8682('0x56')]?util[_0x8682('0x52')]('%s/api/data/v9.0/',_0x4a2d45[_0x8682('0xd')][_0x8682('0xe')]):util['format'](_0x8682('0x5a'),_0x4a2d45[_0x8682('0x13')]);var _0x17fbe5=util[_0x8682('0x52')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4a2d45['tenantId']);var _0x575f93=util[_0x8682('0x52')](_0x8682('0x5b'),_0x4a2d45[_0x8682('0x58')],_0x57607d[_0x8682('0x5c')],md5(_0x57607d[_0x8682('0x5c')]));if(_0x414856&&_0x414856[_0x8682('0x5d')]){logger[_0x8682('0x23')](_0x8682('0x5e'),'Recording\x20is\x20enabled!');_0x57607d[_0x8682('0x5f')]=_0x575f93;}else if(_0x42cc41&&_0x42cc41[_0x8682('0x60')]&&_0x42cc41['recordingFormat']!==_0x8682('0x61')){logger[_0x8682('0x23')](_0x8682('0x62'),_0x8682('0x63'));_0x57607d[_0x8682('0x5f')]=_0x575f93;}else{_0x57607d[_0x8682('0x5f')]='';}return getUser(_0x3829d1,_0x4a2d45,_0x27e295,_0x17fbe5,_0x2bd859,_0x2cb658)[_0x8682('0x1b')](function(_0x34804d){logger['info']('['+_0x2cb658[_0x8682('0x24')]()+_0x8682('0x64'),_0x34804d[_0x8682('0x2e')]);logger[_0x8682('0x23')]('['+_0x2cb658[_0x8682('0x24')]()+_0x8682('0x65'),_0x34804d[_0x8682('0x66')]);return getEndUser(_0x34804d,_0x4a2d45,_0x17fbe5,_0x2bd859,_0x57607d,_0x2cb658,_0x5c38f2[_0x8682('0x67')],_0x5c38f2[_0x8682('0x68')]);})[_0x8682('0x1b')](function(_0x58ee6d){logger[_0x8682('0x23')]('['+_0x2cb658[_0x8682('0x24')]()+_0x8682('0x69'),_0x58ee6d[_0x8682('0x33')]);logger[_0x8682('0x23')]('['+_0x2cb658[_0x8682('0x24')]()+_0x8682('0x6a'),_0x57607d[_0x8682('0x2a')]);return getTicket(_0x58ee6d,_0x4a2d45,_0x17fbe5,_0x2bd859,_0x57607d,_0x5c38f2,_0x2cb658);})[_0x8682('0x1b')](function(_0xb0321d){logger['info'](util['format']('['+_0x2cb658[_0x8682('0x24')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x5c38f2[_0x8682('0x43')],_0xb0321d[_0x8682('0x51')]));logger[_0x8682('0x23')](util[_0x8682('0x52')]('['+_0x2cb658[_0x8682('0x24')]()+_0x8682('0x6b'),_0x2cb658));if(_0x2cb658!==_0x8682('0x59')&&_0x5c38f2['openNewTab']){logger[_0x8682('0x23')]('['+_0x2cb658[_0x8682('0x24')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4a2d45[_0x8682('0x13')],_0x27e295[_0x8682('0x6c')],_0x5c38f2[_0x8682('0x43')],_0xb0321d['ticketId']);}})[_0x8682('0x17')](function(_0x3ded26){logger[_0x8682('0x18')]('['+_0x2cb658[_0x8682('0x24')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x3ded26[_0x8682('0x1a')]);console[_0x8682('0x18')](_0x8682('0x6d'),_0x3ded26);});}; \ 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 479246c..0662d36 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 _0x16cf=['uniqueid','Authorization','destcalleridnum','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','defaults','localhost','redis','emit','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','
','Tags','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','contact','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','length','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','base64','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','push','idField','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','recordingFormat','none'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x16cf,0x114));var _0xf16c=function(_0x19b8c6,_0x15fa95){_0x19b8c6=_0x19b8c6-0x0;var _0x45dfda=_0x16cf[_0x19b8c6];return _0x45dfda;};'use strict';var _=require(_0xf16c('0x0'));var rp=require(_0xf16c('0x1'));var md5=require(_0xf16c('0x2'));var util=require(_0xf16c('0x3'));var Redis=require(_0xf16c('0x4'));var intUtil=require('./util');var config=require(_0xf16c('0x5'));var logger=require('../../../../config/logger')(_0xf16c('0x6'));config['redis']=_[_0xf16c('0x7')](config['redis'],{'host':_0xf16c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf16c('0x9')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x4bd850,_0x421ede,_0x77793a){io['to'](_0x4bd850)[_0xf16c('0xa')](_0x421ede,_0x77793a);}function getTicket(_0x313194,_0x506deb,_0x110794,_0x5751f2,_0x36abd3){logger['info']('Creating\x20new\x20ticket...');var _0xa999c=_['merge']({'responder_id':_0x506deb['id'],'requester_id':_0x110794['id'],'name':util['format'](_0xf16c('0xb'),_0x36abd3[_0xf16c('0xc')]),'phone':_0x36abd3[_0xf16c('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5751f2[_0xf16c('0xe')],_0x36abd3,'\x20'),'description':intUtil['getString'](_0x5751f2['Descriptions'],_0x36abd3,_0xf16c('0xf')),'tags':getTags(_0x5751f2[_0xf16c('0x10')],'name')},getCustomFields(_0x5751f2[_0xf16c('0x11')],_0x36abd3));_0xa999c['custom_fields']=_[_0xf16c('0x12')](_[_0xf16c('0x13')](_0xa999c[_0xf16c('0x14')],'id'),_0xf16c('0x15'));return request({'uri':util[_0xf16c('0x16')](_0xf16c('0x17'),_0x313194[_0xf16c('0x18')]),'method':_0xf16c('0x19'),'body':_0xa999c})['then'](function(_0x3474f2){logger[_0xf16c('0x1a')](_0xf16c('0x1b'));return _0x3474f2;});}function getUser(_0x1317f6,_0x5f32f3){if(intUtil[_0xf16c('0x1c')](_0x5f32f3)){return request({'uri':util[_0xf16c('0x16')](_0xf16c('0x1d'),_0x1317f6[_0xf16c('0x18')]),'qs':{'email':_0x5f32f3}})[_0xf16c('0x1e')](function(_0x15480d){if(_0x15480d['length']){logger['info']('Agent\x20found!');return _['find'](_0x15480d,function(_0x2ac311){return _0x2ac311[_0xf16c('0x1f')][_0xf16c('0x20')]===_0x5f32f3;});}else{logger[_0xf16c('0x1a')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf16c('0x16')]('%s/api/v2/agents/me',_0x1317f6[_0xf16c('0x18')])})['then'](function(_0x42d928){logger[_0xf16c('0x1a')](_0xf16c('0x21'));return _0x42d928;});}});}else{logger[_0xf16c('0x1a')](_0xf16c('0x22'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x1317f6['remoteUri'])})['then'](function(_0x17f9a3){logger['info'](_0xf16c('0x21'));return _0x17f9a3;});}}function getEndUser(_0x1e5437,_0x36a724,_0x180123){logger['info']('Searching\x20enduser\x20with\x20phone',_0x180123);return request({'uri':util[_0xf16c('0x16')]('%s/api/v2/contacts',_0x1e5437[_0xf16c('0x18')]),'qs':{'phone':_0x180123}})[_0xf16c('0x1e')](function(_0x20fe95){if(_0x20fe95[_0xf16c('0x23')]){logger[_0xf16c('0x1a')](_0xf16c('0x24'));return _[_0xf16c('0x25')](_0x20fe95,{'phone':_0x180123});}else{logger[_0xf16c('0x1a')](_0xf16c('0x26'));return request({'uri':util[_0xf16c('0x16')](_0xf16c('0x27'),_0x1e5437[_0xf16c('0x18')]),'method':_0xf16c('0x19'),'body':{'name':_0x36a724,'phone':_0x180123}})[_0xf16c('0x1e')](function(_0x229f84){logger[_0xf16c('0x1a')](_0xf16c('0x28'));return _0x229f84;});}});}function getAuth(_0x55e0d9){return util[_0xf16c('0x16')](_0xf16c('0x29'),new Buffer(_0x55e0d9[_0xf16c('0x2a')]+':X')['toString'](_0xf16c('0x2b')));}function request(_0x1a0586){logger['debug'](_0xf16c('0x2c'),JSON[_0xf16c('0x2d')](_0x1a0586));return rp(_[_0xf16c('0x7')](_0x1a0586,{'method':_0xf16c('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0xadf66,_0x167baa){var _0x51b5db=[];if(_0xadf66&&_0xadf66['length']>0x0){_0x51b5db=_[_0xf16c('0x2f')](_0xadf66,_0x167baa);}return _0x51b5db;}function getCustomFields(_0x5b9101,_0x48b23f){var _0x6a5b40=[];var _0x511f58={'custom_fields':[]};if(_0x5b9101[_0xf16c('0x23')]>0x0){_[_0xf16c('0x30')](_0x5b9101,function(_0x137867){if(_[_0xf16c('0x31')]([_0xf16c('0x32'),_0xf16c('0x33')],_0x137867[_0xf16c('0x34')])&&_0x137867[_0xf16c('0x35')]&&!_0x137867[_0xf16c('0x36')]){_0x511f58[_0x137867[_0xf16c('0x35')][_0xf16c('0x37')]()]=_0x137867[_0xf16c('0x38')][_0xf16c('0x39')]();}else if(_['includes']([_0xf16c('0x32'),'picklist'],_0x137867[_0xf16c('0x34')])&&_0x137867['idField']&&_0x137867['customField']){_0x511f58[_0xf16c('0x14')][_0xf16c('0x3a')]({'id':_0x137867[_0xf16c('0x3b')],'value':_0x137867[_0xf16c('0x38')][_0xf16c('0x39')]()});}else if(_0x137867[_0xf16c('0x34')]===_0xf16c('0x3c')&&_0x137867[_0xf16c('0x3d')]&&_0x137867[_0xf16c('0x3b')]&&_0x137867[_0xf16c('0x36')]){_0x48b23f[_0x137867['variableName']]&&_0x511f58['custom_fields'][_0xf16c('0x3a')]({'id':_0x137867[_0xf16c('0x3b')],'value':_0x48b23f[_0x137867['variableName']][_0xf16c('0x39')]()});}else if(_0x137867[_0xf16c('0x34')]===_0xf16c('0x3e')&&_0x137867[_0xf16c('0x3f')]&&_0x137867[_0xf16c('0x3f')][_0xf16c('0x40')]&&_0x137867[_0xf16c('0x3b')]&&_0x137867[_0xf16c('0x36')]){_0x48b23f[_0x137867['Variable'][_0xf16c('0x40')][_0xf16c('0x37')]()]&&_0x511f58[_0xf16c('0x14')][_0xf16c('0x3a')]({'id':_0x137867[_0xf16c('0x3b')],'value':_0x48b23f[_0x137867[_0xf16c('0x3f')][_0xf16c('0x40')][_0xf16c('0x37')]()]['toString']()});}});}return _0x511f58;}exports[_0xf16c('0x41')]=function(_0x563b28,_0x521aa3,_0x309198,_0x497b24,_0x129afd,_0x10517c){var _0xd161e3,_0x2d522a;_0x10517c[_0xf16c('0x18')]=intUtil[_0xf16c('0x42')](_0x10517c[_0xf16c('0x18')]);_0x10517c[_0xf16c('0x43')]=intUtil[_0xf16c('0x42')](_0x10517c[_0xf16c('0x43')]);if(_0x129afd&&_0x129afd[_0xf16c('0x44')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x521aa3['recordingURL']=util['format'](_0xf16c('0x45'),_0x10517c['serverUrl'],_0x521aa3['uniqueid'],md5(_0x521aa3['uniqueid']));}else{_0x521aa3[_0xf16c('0x46')]='';}headers['Authorization']=getAuth(_0x10517c);return getUser(_0x10517c,_0x497b24[_0xf16c('0x20')])['then'](function(_0x289395){_0xd161e3=_0x289395;logger[_0xf16c('0x1a')](_0xf16c('0x47'),_0xd161e3['id']);return getEndUser(_0x10517c,_0x521aa3['calleridname'],_0x521aa3[_0xf16c('0xd')]);})['then'](function(_0x510727){_0x2d522a=_0x510727;logger['info'](_0xf16c('0x48'),_0x2d522a['id']);return getTicket(_0x10517c,_0xd161e3,_0x2d522a,_0x309198,_0x521aa3);})[_0xf16c('0x1e')](function(_0x13576c){if(_0x13576c&&_0x13576c['id']){logger['info'](_0xf16c('0x1b'));logger[_0xf16c('0x1a')](_0xf16c('0x49'),_0x13576c['id']);logger[_0xf16c('0x1a')](_0xf16c('0x4a'),_0xf16c('0x4b'));emit(util['format']('user:%s',_0x497b24['name']),'trigger:browser:url',{'uri':util[_0xf16c('0x16')]('%s/helpdesk/tickets/%d',_0x10517c[_0xf16c('0x18')],_0x13576c['id'])});}})[_0xf16c('0x4c')](function(_0x566128){logger[_0xf16c('0x4d')](_0xf16c('0x4a'),JSON[_0xf16c('0x2d')](_0x566128));});};exports['outbound']=function(_0x37fb1b,_0x430cf8,_0x13efcb,_0x164e37,_0x3e940c,_0x1b2d6b,_0x3abaee){var _0x2844c6,_0x5f23e4;_0x1b2d6b[_0xf16c('0x18')]=intUtil['stripTrailingSlash'](_0x1b2d6b['remoteUri']);_0x1b2d6b[_0xf16c('0x43')]=intUtil[_0xf16c('0x42')](_0x1b2d6b[_0xf16c('0x43')]);if(_0x3abaee&&_0x3abaee['recordingFormat']&&_0x3abaee[_0xf16c('0x4e')]!==_0xf16c('0x4f')){logger[_0xf16c('0x1a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x430cf8[_0xf16c('0x46')]=util[_0xf16c('0x16')](_0xf16c('0x45'),_0x1b2d6b[_0xf16c('0x43')],_0x430cf8[_0xf16c('0x50')],md5(_0x430cf8[_0xf16c('0x50')]));}headers[_0xf16c('0x51')]=getAuth(_0x1b2d6b);return getUser(_0x1b2d6b,_0x164e37[_0xf16c('0x20')])['then'](function(_0x122f1b){_0x2844c6=_0x122f1b;logger[_0xf16c('0x1a')](_0xf16c('0x47'),_0x2844c6['id']);return getEndUser(_0x1b2d6b,_0x430cf8['destcalleridname'],_0x430cf8[_0xf16c('0x52')]);})[_0xf16c('0x1e')](function(_0x3be34d){_0x5f23e4=_0x3be34d;logger[_0xf16c('0x1a')](_0xf16c('0x48'),_0x5f23e4['id']);return getTicket(_0x1b2d6b,_0x2844c6,_0x5f23e4,_0x13efcb,_0x430cf8);})[_0xf16c('0x1e')](function(_0x1fe769){if(_0x1fe769&&_0x1fe769['id']){logger['info'](_0xf16c('0x1b'));logger['info'](_0xf16c('0x49'),_0x1fe769['id']);logger['info'](_0xf16c('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf16c('0x16')](_0xf16c('0x54'),_0x164e37[_0xf16c('0x40')]),'trigger:browser:url',{'uri':util[_0xf16c('0x16')]('%s/helpdesk/tickets/%d',_0x1b2d6b[_0xf16c('0x18')],_0x1fe769['id'])});}})['catch'](function(_0x3b7241){logger[_0xf16c('0x4d')]('[OUTBOUND]',JSON['stringify'](_0x3b7241));});};exports[_0xf16c('0x55')]=function(_0x3a8cf0,_0x5c17e2,_0x4503f5,_0x4e9808,_0xaf4e15,_0x20d82e){var _0x14cdcf,_0x275a82;_0x20d82e[_0xf16c('0x18')]=intUtil[_0xf16c('0x42')](_0x20d82e[_0xf16c('0x18')]);_0x20d82e['serverUrl']=intUtil[_0xf16c('0x42')](_0x20d82e['serverUrl']);if(_0xaf4e15&&_0xaf4e15[_0xf16c('0x44')]){logger[_0xf16c('0x1a')]('['+_0x5c17e2[_0xf16c('0x56')][_0xf16c('0x57')]()+']',_0xf16c('0x58'));_0x5c17e2[_0xf16c('0x46')]=util[_0xf16c('0x16')](_0xf16c('0x45'),_0x20d82e['serverUrl'],_0x5c17e2[_0xf16c('0x50')],md5(_0x5c17e2['uniqueid']));}else{_0x5c17e2['recordingURL']='';}headers['Authorization']=getAuth(_0x20d82e);return getUser(_0x20d82e,'')['then'](function(_0x425549){_0x14cdcf=_0x425549;logger[_0xf16c('0x1a')]('The\x20User\x20ID\x20is:',_0x14cdcf['id']);return getEndUser(_0x20d82e,_0x5c17e2[_0xf16c('0xc')],_0x5c17e2[_0xf16c('0xd')]);})['then'](function(_0x442bda){_0x275a82=_0x442bda;logger[_0xf16c('0x1a')](_0xf16c('0x48'),_0x275a82['id']);return getTicket(_0x20d82e,_0x14cdcf,_0x275a82,_0x4503f5,_0x5c17e2);})[_0xf16c('0x1e')](function(_0x17ba34){if(_0x17ba34){logger[_0xf16c('0x1a')]('Ticket\x20created!');logger['info'](_0xf16c('0x49'),_0x17ba34['id']);}})[_0xf16c('0x4c')](function(_0x37a38c){logger[_0xf16c('0x4d')]('['+_0x5c17e2[_0xf16c('0x56')][_0xf16c('0x57')]()+']',JSON['stringify'](_0x37a38c));});}; \ No newline at end of file +var _0xddbc=['calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','info','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','GET','forEach','includes','nameField','toLowerCase','string','picklist','type','customField','push','idField','content','variableName','customVariable','Variable','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','serverUrl','uniqueid','recordingURL','Authorization','calleridname','trigger:browser:url','catch','error','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','format','Caller\x20-\x20%s'];(function(_0x2d065b,_0x55cf93){var _0x48e997=function(_0x177122){while(--_0x177122){_0x2d065b['push'](_0x2d065b['shift']());}};_0x48e997(++_0x55cf93);}(_0xddbc,0x161));var _0xcddb=function(_0x37d077,_0x48d014){_0x37d077=_0x37d077-0x0;var _0x5698ff=_0xddbc[_0x37d077];return _0x5698ff;};'use strict';var _=require(_0xcddb('0x0'));var rp=require(_0xcddb('0x1'));var md5=require(_0xcddb('0x2'));var util=require(_0xcddb('0x3'));var Redis=require(_0xcddb('0x4'));var intUtil=require('./util');var config=require(_0xcddb('0x5'));var logger=require('../../../../config/logger')(_0xcddb('0x6'));config[_0xcddb('0x7')]=_[_0xcddb('0x8')](config[_0xcddb('0x7')],{'host':_0xcddb('0x9'),'port':0x18eb});var io=require(_0xcddb('0xa'))(new Redis(config[_0xcddb('0x7')]));var headers={'Content-Type':_0xcddb('0xb'),'Accept':_0xcddb('0xb')};function emit(_0x59ca3d,_0x2e82e7,_0x54d62f){io['to'](_0x59ca3d)[_0xcddb('0xc')](_0x2e82e7,_0x54d62f);}function getTicket(_0x44081c,_0xd9aa4c,_0x5ae5aa,_0x3f8e3f,_0xd08f50){logger['info']('Creating\x20new\x20ticket...');var _0x22e3f8=_['merge']({'responder_id':_0xd9aa4c['id'],'requester_id':_0x5ae5aa['id'],'name':util[_0xcddb('0xd')](_0xcddb('0xe'),_0xd08f50['calleridname']),'phone':_0xd08f50[_0xcddb('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xcddb('0x10')](_0x3f8e3f[_0xcddb('0x11')],_0xd08f50,'\x20'),'description':intUtil[_0xcddb('0x10')](_0x3f8e3f[_0xcddb('0x12')],_0xd08f50,_0xcddb('0x13')),'tags':getTags(_0x3f8e3f[_0xcddb('0x14')],_0xcddb('0x15'))},getCustomFields(_0x3f8e3f[_0xcddb('0x16')],_0xd08f50));_0x22e3f8[_0xcddb('0x17')]=_[_0xcddb('0x18')](_[_0xcddb('0x19')](_0x22e3f8['custom_fields'],'id'),_0xcddb('0x1a'));return request({'uri':util['format'](_0xcddb('0x1b'),_0x44081c['remoteUri']),'method':_0xcddb('0x1c'),'body':_0x22e3f8})[_0xcddb('0x1d')](function(_0x22e14c){logger['info'](_0xcddb('0x1e'));return _0x22e14c;});}function getUser(_0x44a074,_0x38dd57){if(intUtil[_0xcddb('0x1f')](_0x38dd57)){return request({'uri':util[_0xcddb('0xd')](_0xcddb('0x20'),_0x44a074[_0xcddb('0x21')]),'qs':{'email':_0x38dd57}})[_0xcddb('0x1d')](function(_0x18961d){if(_0x18961d[_0xcddb('0x22')]){logger[_0xcddb('0x23')](_0xcddb('0x24'));return _[_0xcddb('0x25')](_0x18961d,function(_0x46dedb){return _0x46dedb[_0xcddb('0x26')][_0xcddb('0x27')]===_0x38dd57;});}else{logger[_0xcddb('0x23')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xcddb('0x28'),_0x44a074[_0xcddb('0x21')])})[_0xcddb('0x1d')](function(_0xddcbf0){logger['info'](_0xcddb('0x29'));return _0xddcbf0;});}});}else{logger[_0xcddb('0x23')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xcddb('0xd')](_0xcddb('0x28'),_0x44a074[_0xcddb('0x21')])})[_0xcddb('0x1d')](function(_0x5dd381){logger[_0xcddb('0x23')]('Admin\x20account\x20selected.');return _0x5dd381;});}}function getEndUser(_0x3e5839,_0x4ffef8,_0x3f9b95){logger['info'](_0xcddb('0x2a'),_0x3f9b95);return request({'uri':util[_0xcddb('0xd')](_0xcddb('0x2b'),_0x3e5839[_0xcddb('0x21')]),'qs':{'phone':_0x3f9b95}})[_0xcddb('0x1d')](function(_0x136722){if(_0x136722[_0xcddb('0x22')]){logger[_0xcddb('0x23')]('Enduser\x20found!');return _[_0xcddb('0x25')](_0x136722,{'phone':_0x3f9b95});}else{logger[_0xcddb('0x23')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xcddb('0xd')](_0xcddb('0x2b'),_0x3e5839['remoteUri']),'method':'POST','body':{'name':_0x4ffef8,'phone':_0x3f9b95}})['then'](function(_0x3a57fb){logger[_0xcddb('0x23')](_0xcddb('0x2c'));return _0x3a57fb;});}});}function getAuth(_0x281d01){return util[_0xcddb('0xd')](_0xcddb('0x2d'),new Buffer(_0x281d01[_0xcddb('0x2e')]+':X')[_0xcddb('0x2f')](_0xcddb('0x30')));}function request(_0x451e1b){logger[_0xcddb('0x31')]('[HTTP]',JSON[_0xcddb('0x32')](_0x451e1b));return rp(_[_0xcddb('0x8')](_0x451e1b,{'method':_0xcddb('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x597990,_0x379026){var _0x2f7427=[];if(_0x597990&&_0x597990[_0xcddb('0x22')]>0x0){_0x2f7427=_['map'](_0x597990,_0x379026);}return _0x2f7427;}function getCustomFields(_0x217ad3,_0x5bed80){var _0x3f2a4e=[];var _0x35714d={'custom_fields':[]};if(_0x217ad3[_0xcddb('0x22')]>0x0){_[_0xcddb('0x34')](_0x217ad3,function(_0x18b2e1){if(_[_0xcddb('0x35')](['string','picklist'],_0x18b2e1['type'])&&_0x18b2e1['nameField']&&!_0x18b2e1['customField']){_0x35714d[_0x18b2e1[_0xcddb('0x36')][_0xcddb('0x37')]()]=_0x18b2e1['content'][_0xcddb('0x2f')]();}else if(_['includes']([_0xcddb('0x38'),_0xcddb('0x39')],_0x18b2e1[_0xcddb('0x3a')])&&_0x18b2e1['idField']&&_0x18b2e1[_0xcddb('0x3b')]){_0x35714d['custom_fields'][_0xcddb('0x3c')]({'id':_0x18b2e1[_0xcddb('0x3d')],'value':_0x18b2e1[_0xcddb('0x3e')][_0xcddb('0x2f')]()});}else if(_0x18b2e1['type']==='variable'&&_0x18b2e1['variableName']&&_0x18b2e1['idField']&&_0x18b2e1[_0xcddb('0x3b')]){_0x5bed80[_0x18b2e1[_0xcddb('0x3f')]]&&_0x35714d[_0xcddb('0x17')][_0xcddb('0x3c')]({'id':_0x18b2e1[_0xcddb('0x3d')],'value':_0x5bed80[_0x18b2e1[_0xcddb('0x3f')]][_0xcddb('0x2f')]()});}else if(_0x18b2e1[_0xcddb('0x3a')]===_0xcddb('0x40')&&_0x18b2e1[_0xcddb('0x41')]&&_0x18b2e1[_0xcddb('0x41')][_0xcddb('0x15')]&&_0x18b2e1[_0xcddb('0x3d')]&&_0x18b2e1[_0xcddb('0x3b')]){_0x5bed80[_0x18b2e1[_0xcddb('0x41')][_0xcddb('0x15')][_0xcddb('0x37')]()]&&_0x35714d[_0xcddb('0x17')][_0xcddb('0x3c')]({'id':_0x18b2e1[_0xcddb('0x3d')],'value':_0x5bed80[_0x18b2e1[_0xcddb('0x41')][_0xcddb('0x15')][_0xcddb('0x37')]()][_0xcddb('0x2f')]()});}});}return _0x35714d;}exports[_0xcddb('0x42')]=function(_0x200466,_0x4770f5,_0x3cc09b,_0x35635b,_0x7c30fe,_0x32c373){var _0x470109,_0x34188c;_0x32c373[_0xcddb('0x21')]=intUtil[_0xcddb('0x43')](_0x32c373[_0xcddb('0x21')]);_0x32c373['serverUrl']=intUtil[_0xcddb('0x43')](_0x32c373['serverUrl']);if(_0x7c30fe&&_0x7c30fe['monitor_format']){logger[_0xcddb('0x23')](_0xcddb('0x44'),_0xcddb('0x45'));_0x4770f5['recordingURL']=util[_0xcddb('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32c373[_0xcddb('0x46')],_0x4770f5[_0xcddb('0x47')],md5(_0x4770f5['uniqueid']));}else{_0x4770f5[_0xcddb('0x48')]='';}headers[_0xcddb('0x49')]=getAuth(_0x32c373);return getUser(_0x32c373,_0x35635b['email'])[_0xcddb('0x1d')](function(_0x3f4510){_0x470109=_0x3f4510;logger['info']('The\x20User\x20ID\x20is:',_0x470109['id']);return getEndUser(_0x32c373,_0x4770f5[_0xcddb('0x4a')],_0x4770f5[_0xcddb('0xf')]);})[_0xcddb('0x1d')](function(_0x51c4d0){_0x34188c=_0x51c4d0;logger[_0xcddb('0x23')]('The\x20Enduser\x20ID\x20is:',_0x34188c['id']);return getTicket(_0x32c373,_0x470109,_0x34188c,_0x3cc09b,_0x4770f5);})[_0xcddb('0x1d')](function(_0x5764f3){if(_0x5764f3&&_0x5764f3['id']){logger[_0xcddb('0x23')](_0xcddb('0x1e'));logger[_0xcddb('0x23')]('The\x20Ticket\x20ID\x20is:',_0x5764f3['id']);logger[_0xcddb('0x23')](_0xcddb('0x44'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcddb('0xd')]('user:%s',_0x35635b[_0xcddb('0x15')]),_0xcddb('0x4b'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x32c373[_0xcddb('0x21')],_0x5764f3['id'])});}})[_0xcddb('0x4c')](function(_0x5b5cb7){logger[_0xcddb('0x4d')](_0xcddb('0x44'),JSON['stringify'](_0x5b5cb7));});};exports['outbound']=function(_0x9ee9db,_0x5c984b,_0x4761a9,_0x4e1cc5,_0x7b2349,_0x3526b7,_0x54e814){var _0x4cecd5,_0x4a9197;_0x3526b7['remoteUri']=intUtil[_0xcddb('0x43')](_0x3526b7['remoteUri']);_0x3526b7[_0xcddb('0x46')]=intUtil['stripTrailingSlash'](_0x3526b7[_0xcddb('0x46')]);if(_0x54e814&&_0x54e814['recordingFormat']&&_0x54e814[_0xcddb('0x4e')]!==_0xcddb('0x4f')){logger[_0xcddb('0x23')]('[OUTBOUND]',_0xcddb('0x45'));_0x5c984b['recordingURL']=util[_0xcddb('0xd')](_0xcddb('0x50'),_0x3526b7['serverUrl'],_0x5c984b[_0xcddb('0x47')],md5(_0x5c984b[_0xcddb('0x47')]));}headers['Authorization']=getAuth(_0x3526b7);return getUser(_0x3526b7,_0x4e1cc5['email'])[_0xcddb('0x1d')](function(_0x1f8a97){_0x4cecd5=_0x1f8a97;logger[_0xcddb('0x23')](_0xcddb('0x51'),_0x4cecd5['id']);return getEndUser(_0x3526b7,_0x5c984b[_0xcddb('0x52')],_0x5c984b[_0xcddb('0x53')]);})['then'](function(_0x39caeb){_0x4a9197=_0x39caeb;logger[_0xcddb('0x23')]('The\x20Enduser\x20ID\x20is:',_0x4a9197['id']);return getTicket(_0x3526b7,_0x4cecd5,_0x4a9197,_0x4761a9,_0x5c984b);})[_0xcddb('0x1d')](function(_0x467cf2){if(_0x467cf2&&_0x467cf2['id']){logger[_0xcddb('0x23')](_0xcddb('0x1e'));logger['info'](_0xcddb('0x54'),_0x467cf2['id']);logger[_0xcddb('0x23')](_0xcddb('0x55'),_0xcddb('0x56'));emit(util[_0xcddb('0xd')]('user:%s',_0x4e1cc5['name']),_0xcddb('0x4b'),{'uri':util[_0xcddb('0xd')](_0xcddb('0x57'),_0x3526b7['remoteUri'],_0x467cf2['id'])});}})['catch'](function(_0x73c9a){logger[_0xcddb('0x4d')]('[OUTBOUND]',JSON['stringify'](_0x73c9a));});};exports[_0xcddb('0x58')]=function(_0x3bafaa,_0x496db8,_0x3f9e81,_0x1695fa,_0x11de51,_0x577509){var _0x3cc03f,_0x115d63;_0x577509['remoteUri']=intUtil[_0xcddb('0x43')](_0x577509['remoteUri']);_0x577509[_0xcddb('0x46')]=intUtil[_0xcddb('0x43')](_0x577509[_0xcddb('0x46')]);if(_0x11de51&&_0x11de51['monitor_format']){logger[_0xcddb('0x23')]('['+_0x496db8[_0xcddb('0x59')][_0xcddb('0x5a')]()+']',_0xcddb('0x45'));_0x496db8[_0xcddb('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x577509['serverUrl'],_0x496db8['uniqueid'],md5(_0x496db8[_0xcddb('0x47')]));}else{_0x496db8['recordingURL']='';}headers[_0xcddb('0x49')]=getAuth(_0x577509);return getUser(_0x577509,'')[_0xcddb('0x1d')](function(_0x1b6c0a){_0x3cc03f=_0x1b6c0a;logger[_0xcddb('0x23')]('The\x20User\x20ID\x20is:',_0x3cc03f['id']);return getEndUser(_0x577509,_0x496db8[_0xcddb('0x4a')],_0x496db8[_0xcddb('0xf')]);})[_0xcddb('0x1d')](function(_0x23c699){_0x115d63=_0x23c699;logger[_0xcddb('0x23')](_0xcddb('0x5b'),_0x115d63['id']);return getTicket(_0x577509,_0x3cc03f,_0x115d63,_0x3f9e81,_0x496db8);})[_0xcddb('0x1d')](function(_0x49ddfe){if(_0x49ddfe){logger[_0xcddb('0x23')]('Ticket\x20created!');logger[_0xcddb('0x23')]('The\x20Ticket\x20ID\x20is:',_0x49ddfe['id']);}})[_0xcddb('0x4c')](function(_0x470960){logger[_0xcddb('0x4d')]('['+_0x496db8[_0xcddb('0x59')][_0xcddb('0x5a')]()+']',JSON[_0xcddb('0x32')](_0x470960));});}; \ 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 0f37e5b..e973211 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 _0x1c8d=['The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','userEmail','/api/lookup?q=','&f=','find','contacts','catch','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Contact','add','task','Task\x20created:','ticketId','user:%s','emit','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x1c8d,0x1b7));var _0xd1c8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1c8d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd1c8('0x0'));var rp=require(_0xd1c8('0x1'));var md5=require(_0xd1c8('0x2'));var util=require(_0xd1c8('0x3'));var moment=require(_0xd1c8('0x4'));var Promise=require('bluebird');var Redis=require(_0xd1c8('0x5'));var intUtil=require(_0xd1c8('0x6'));var config=require(_0xd1c8('0x7'));var logger=require(_0xd1c8('0x8'))('freshsales');config[_0xd1c8('0x9')]=_[_0xd1c8('0xa')](config[_0xd1c8('0x9')],{'host':_0xd1c8('0xb'),'port':0x18eb});var io=require(_0xd1c8('0xc'))(new Redis(config[_0xd1c8('0x9')]));function getAdminId(_0x28fef1,_0x2581ac,_0x22749f,_0x76be2d){return new Promise(function(_0x495fd7,_0xacb4c2){var _0x512436=![];var _0x33e4d9={'method':_0xd1c8('0xd'),'uri':_0x76be2d+_0xd1c8('0xe'),'json':!![]};_0x33e4d9['headers']=_0x22749f;logger[_0xd1c8('0xf')](_0xd1c8('0x10'));return rp(_0x33e4d9)['then'](function(_0x146f15){if(_0x146f15){var _0x5e0d6a=_0x146f15[_0xd1c8('0x11')];var _0x25c61b=null;for(_0x25c61b=0x0;_0x25c61b<_0x5e0d6a['length'];_0x25c61b++){if(_0x5e0d6a[_0x25c61b][_0xd1c8('0x12')]===_0x28fef1[_0xd1c8('0x13')]){_0x28fef1[_0xd1c8('0x14')]=_0x5e0d6a[_0x25c61b]['id'];_0x512436=!![];}}if(_0x512436){logger[_0xd1c8('0xf')](_0xd1c8('0x15'),_0x28fef1['adminId']);_0x495fd7(_0x28fef1);}else{_0xacb4c2({'statusCode':0x194,'message':_0xd1c8('0x16')});}}else{_0xacb4c2({'statusCode':0x194,'message':_0xd1c8('0x16')});}})['catch'](function(_0x2f0b01){logger[_0xd1c8('0x17')]('['+[_0x2581ac[_0xd1c8('0x18')]()]+']',_0x2f0b01[_0xd1c8('0x19')]);_0xacb4c2(_0x2f0b01);});});}function getUser(_0x4eab48,_0x44ae37,_0x3d3377){return function(_0x3eab09){return new Promise(function(_0x1a48a1,_0x2bdc34){var _0xa966df={'method':_0xd1c8('0xd'),'uri':_0x3d3377+_0xd1c8('0xe'),'json':!![]};_0xa966df[_0xd1c8('0x1a')]=_0x44ae37;logger[_0xd1c8('0xf')](_0xd1c8('0x1b'));return rp(_0xa966df)[_0xd1c8('0x1c')](function(_0xe13ebe){if(_0xe13ebe){var _0x379c77=_0xe13ebe[_0xd1c8('0x11')];var _0x26f6f5=![];var _0x2fae83=null;if(_0x3eab09[_0xd1c8('0x1d')]!==null){logger['info'](_0xd1c8('0x1e'),_0x3eab09['agentEmail']);_0x3eab09['userEmail']=_0x3eab09['agentEmail'];for(_0x2fae83=0x0;_0x2fae83<_0x379c77[_0xd1c8('0x1f')];_0x2fae83++){if(_0x379c77[_0x2fae83][_0xd1c8('0x12')]===_0x3eab09['agentEmail']){_0x26f6f5=!![];_0x3eab09[_0xd1c8('0x20')]=_0x379c77[_0x2fae83]['id'];logger[_0xd1c8('0xf')](_0xd1c8('0x21'),_0x3eab09[_0xd1c8('0x20')]);}}}if(!_0x26f6f5){logger[_0xd1c8('0xf')](_0xd1c8('0x22'));_0x3eab09[_0xd1c8('0x23')]=_0x3eab09[_0xd1c8('0x13')];_0x3eab09['userId']=_0x3eab09[_0xd1c8('0x14')];_0x26f6f5=!![];}if(_0x26f6f5){_0x1a48a1(_0x3eab09);}else{_0x2bdc34({'statusCode':0x194,'message':_0xd1c8('0x16')});}}else{_0x2bdc34({'statusCode':0x194,'message':_0xd1c8('0x16')});}})['catch'](function(_0x3b43b1){logger['error']('['+[_0x4eab48[_0xd1c8('0x18')]()]+']',_0x3b43b1[_0xd1c8('0x19')]);_0x2bdc34(_0x3b43b1);});});};}function searchContact(_0x20498c,_0x11c9a8,_0x5e1db0,_0x440be2){return new Promise(function(_0x410a79,_0x18a713){var _0x229503={'method':_0xd1c8('0xd'),'headers':_0x11c9a8,'uri':_0x20498c+_0xd1c8('0x24')+_0x440be2+_0xd1c8('0x25')+_0x5e1db0+'&entities=contact','json':!![]};rp(_0x229503)['then'](function(_0x2c5981){var _0x3d29c9=_[_0xd1c8('0x26')](_0x2c5981[_0xd1c8('0x27')][_0xd1c8('0x27')],[_0x5e1db0,_0x440be2]);_0x410a79(_0x3d29c9);})[_0xd1c8('0x28')](function(_0x14c989){_0x18a713(_0x14c989);});});}function getEndUser(_0x33e759,_0x1faaac,_0x55921f){return function(_0x210473){return new Promise(function(_0x2bcfda,_0x37c96a){logger[_0xd1c8('0xf')](util[_0xd1c8('0x29')](_0xd1c8('0x2a'),_0x210473[_0xd1c8('0x2b')]));searchContact(_0x55921f,_0x1faaac,_0xd1c8('0x2c'),_0x210473[_0xd1c8('0x2b')])[_0xd1c8('0x1c')](function(_0x1ead47){if(_0x1ead47){_0x210473[_0xd1c8('0x2d')]=_0x1ead47['id'];logger['info'](_0xd1c8('0x2e'),_0x210473[_0xd1c8('0x2d')]);return _0x2bcfda(_0x210473);}searchContact(_0x55921f,_0x1faaac,_0xd1c8('0x2f'),_0x210473[_0xd1c8('0x2b')])[_0xd1c8('0x1c')](function(_0x1e630c){if(_0x1e630c){_0x210473['endUserId']=_0x1e630c['id'];logger['info'](_0xd1c8('0x30'),_0x210473['endUserId']);return _0x2bcfda(_0x210473);}createEndUser(_0x210473,_0x33e759,_0x1faaac,_0x55921f)[_0xd1c8('0x1c')](function(_0x4c65ae){logger[_0xd1c8('0xf')](_0xd1c8('0x31'),_0x4c65ae[_0xd1c8('0x2d')]);return _0x2bcfda(_0x4c65ae);});});})[_0xd1c8('0x28')](function(_0x2c6097){_0x37c96a(_0x2c6097);});});};}function createEndUser(_0x32bab8,_0x16a55f,_0x96ef27,_0x507f38){return new Promise(function(_0x18a1c9,_0x7702f){var _0x40e0ae=moment();var _0x127135={'method':_0xd1c8('0x32'),'uri':_0x507f38+_0xd1c8('0x33'),'body':{'contact':{'last_name':_0x32bab8[_0xd1c8('0x2b')],'work_number':_0x32bab8['contactNumber'],'mobile_number':_0x32bab8[_0xd1c8('0x2b')],'owner_id':_0x32bab8['userId'],'created_at':_0x40e0ae[_0xd1c8('0x29')](_0xd1c8('0x34'))}},'json':!![]};_0x127135['headers']=_0x96ef27;logger[_0xd1c8('0xf')](_0xd1c8('0x35'));return rp(_0x127135)['then'](function(_0x5e9904){_0x32bab8[_0xd1c8('0x2d')]=_0x5e9904[_0xd1c8('0x36')]['id'];_0x18a1c9(_0x32bab8);})[_0xd1c8('0x28')](function(_0x48b9d9){logger[_0xd1c8('0x17')]('['+[_0x16a55f[_0xd1c8('0x18')]()]+']',_0x48b9d9['message']);_0x7702f(_0x48b9d9[_0xd1c8('0x19')]);});});}function getTicket(_0x8fc13c,_0x1a011e,_0x198b4d,_0x1ae1c5,_0x2b717e){return function(_0xca1b12){logger['info'](_0xd1c8('0x37'));return new Promise(function(_0x172254,_0x5de491){var _0x28add9=moment();var _0x3f2e92={'method':_0xd1c8('0x32'),'uri':_0x198b4d+'/api/tasks','body':{'title':intUtil[_0xd1c8('0x38')](_0x1ae1c5[_0xd1c8('0x39')],_0x2b717e,'\x20'),'description':intUtil['getString'](_0x1ae1c5['Descriptions'],_0x2b717e,'\x0a'),'owner_id':_0xca1b12[_0xd1c8('0x20')],'creater_id':_0xca1b12[_0xd1c8('0x14')],'targetable_id':_0xca1b12[_0xd1c8('0x2d')],'targetable_type':_0xd1c8('0x3a'),'created_at':_0x28add9[_0xd1c8('0x29')](_0xd1c8('0x34')),'due_date':_0x28add9[_0xd1c8('0x3b')](0x1e,'m')['format'](_0xd1c8('0x34'))},'json':!![]};_0x3f2e92[_0xd1c8('0x1a')]=_0x1a011e;return rp(_0x3f2e92)[_0xd1c8('0x1c')](function(_0x58b43e){_0xca1b12['ticketId']=_0x58b43e[_0xd1c8('0x3c')]['id'];logger[_0xd1c8('0xf')](_0xd1c8('0x3d'),_0xca1b12[_0xd1c8('0x3e')]);_0x172254(_0xca1b12);})[_0xd1c8('0x28')](function(_0x5044c9){logger[_0xd1c8('0x17')]('['+[_0x8fc13c[_0xd1c8('0x18')]()]+']',_0x5044c9[_0xd1c8('0x19')]);_0x5de491(_0x5044c9['message']);});});};}function emit(_0x5c4501,_0x24ea15,_0x131fad){var _0xfe44da={'uri':_0x5c4501+'/contacts/'+_0x131fad};io['to'](util[_0xd1c8('0x29')](_0xd1c8('0x3f'),_0x24ea15))[_0xd1c8('0x40')]('trigger:browser:url',_0xfe44da);}exports['cs']=function(_0x2c3007,_0x26e1f7,_0x3f584a,_0x4fe9f8,_0x55276b,_0x5845a2,_0x559a3d,_0x426e71){var _0x3b7e74={};var _0x4cc89b={'Authorization':_0xd1c8('0x41')+_0x5845a2['apiKey']};_0x5845a2['remoteUri']=intUtil['stripTrailingSlash'](_0x5845a2[_0xd1c8('0x42')]);_0x5845a2[_0xd1c8('0x43')]=intUtil[_0xd1c8('0x44')](_0x5845a2['serverUrl']);var _0x42da13=_0x5845a2[_0xd1c8('0x42')];_0x3b7e74['adminEmail']=_0x5845a2['username'];_0x3b7e74[_0xd1c8('0x2b')]=_0x426e71[_0xd1c8('0x45')]()===_0xd1c8('0x46')?_0x26e1f7[_0xd1c8('0x47')]:_0x26e1f7['calleridnum'];_0x3b7e74[_0xd1c8('0x48')]=_0x426e71==='queue'||_0x426e71===_0xd1c8('0x49')?_0xd1c8('0x4a'):'outbound';if(_0x4fe9f8){_0x3b7e74[_0xd1c8('0x1d')]=_0x4fe9f8[_0xd1c8('0x12')];}var _0x4fbd83=util[_0xd1c8('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5845a2[_0xd1c8('0x43')],_0x26e1f7[_0xd1c8('0x4b')],md5(_0x26e1f7[_0xd1c8('0x4b')]));if(_0x55276b&&_0x55276b[_0xd1c8('0x4c')]){logger[_0xd1c8('0xf')](_0xd1c8('0x4d'),_0xd1c8('0x4e'));_0x26e1f7[_0xd1c8('0x4f')]=_0x4fbd83;}else if(_0x559a3d&&_0x559a3d['recordingFormat']&&_0x559a3d[_0xd1c8('0x50')]!==_0xd1c8('0x51')){logger[_0xd1c8('0xf')](_0xd1c8('0x52'),'Recording\x20is\x20enabled!');_0x26e1f7['recordingURL']=_0x4fbd83;}else{_0x26e1f7[_0xd1c8('0x4f')]='';}return getAdminId(_0x3b7e74,_0x426e71,_0x4cc89b,_0x42da13)['then'](getUser(_0x426e71,_0x4cc89b,_0x42da13))[_0xd1c8('0x1c')](getEndUser(_0x426e71,_0x4cc89b,_0x42da13))[_0xd1c8('0x1c')](getTicket(_0x426e71,_0x4cc89b,_0x42da13,_0x3f584a,_0x26e1f7))[_0xd1c8('0x1c')](function(_0x1f30fe){logger[_0xd1c8('0xf')](util[_0xd1c8('0x29')](_0xd1c8('0x53'),_0x1f30fe[_0xd1c8('0x3e')]));if(_0x426e71!==_0xd1c8('0x49')){logger['info']('['+[_0x426e71[_0xd1c8('0x18')]()]+']',_0xd1c8('0x54'));emit(_0x42da13,_0x4fe9f8['name'],_0x1f30fe[_0xd1c8('0x2d')]);}})[_0xd1c8('0x28')](function(_0x231b25){logger[_0xd1c8('0x17')]('['+[_0x426e71['toUpperCase']()]+_0xd1c8('0x55'),util[_0xd1c8('0x56')](_0x231b25,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdde8=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminId','Requested\x20Resource\x20not\x20Found','catch','error','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','adminEmail','userId','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','toUpperCase','message','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Contact','add','task','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','calleridnum','unmanaged','queue'];(function(_0x146214,_0x13482f){var _0x2c2acb=function(_0xb0ad23){while(--_0xb0ad23){_0x146214['push'](_0x146214['shift']());}};_0x2c2acb(++_0x13482f);}(_0xdde8,0x158));var _0x8dde=function(_0x2f6057,_0x1bf849){_0x2f6057=_0x2f6057-0x0;var _0x5012f7=_0xdde8[_0x2f6057];return _0x5012f7;};'use strict';var _=require(_0x8dde('0x0'));var rp=require(_0x8dde('0x1'));var md5=require(_0x8dde('0x2'));var util=require(_0x8dde('0x3'));var moment=require(_0x8dde('0x4'));var Promise=require(_0x8dde('0x5'));var Redis=require(_0x8dde('0x6'));var intUtil=require('./util');var config=require(_0x8dde('0x7'));var logger=require(_0x8dde('0x8'))('freshsales');config['redis']=_['defaults'](config[_0x8dde('0x9')],{'host':_0x8dde('0xa'),'port':0x18eb});var io=require(_0x8dde('0xb'))(new Redis(config['redis']));function getAdminId(_0xfca0b7,_0x53fc60,_0x47a8e5,_0x36e418){return new Promise(function(_0x15e5b4,_0x4de727){var _0x5a773c=![];var _0x230bda={'method':_0x8dde('0xc'),'uri':_0x36e418+_0x8dde('0xd'),'json':!![]};_0x230bda[_0x8dde('0xe')]=_0x47a8e5;logger[_0x8dde('0xf')](_0x8dde('0x10'));return rp(_0x230bda)[_0x8dde('0x11')](function(_0x6a68d4){if(_0x6a68d4){var _0x365d35=_0x6a68d4[_0x8dde('0x12')];var _0xf2f4ef=null;for(_0xf2f4ef=0x0;_0xf2f4ef<_0x365d35[_0x8dde('0x13')];_0xf2f4ef++){if(_0x365d35[_0xf2f4ef]['email']===_0xfca0b7['adminEmail']){_0xfca0b7[_0x8dde('0x14')]=_0x365d35[_0xf2f4ef]['id'];_0x5a773c=!![];}}if(_0x5a773c){logger[_0x8dde('0xf')]('Admin\x20found:',_0xfca0b7['adminId']);_0x15e5b4(_0xfca0b7);}else{_0x4de727({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4de727({'statusCode':0x194,'message':_0x8dde('0x15')});}})[_0x8dde('0x16')](function(_0x4eaeda){logger[_0x8dde('0x17')]('['+[_0x53fc60['toUpperCase']()]+']',_0x4eaeda['message']);_0x4de727(_0x4eaeda);});});}function getUser(_0x4ee947,_0x50d8a1,_0x1cfc73){return function(_0x45192c){return new Promise(function(_0x1a6a51,_0x5d57f5){var _0x3954e4={'method':_0x8dde('0xc'),'uri':_0x1cfc73+'/api/selector/owners','json':!![]};_0x3954e4[_0x8dde('0xe')]=_0x50d8a1;logger[_0x8dde('0xf')](_0x8dde('0x18'));return rp(_0x3954e4)[_0x8dde('0x11')](function(_0x729e9a){if(_0x729e9a){var _0x2bf03f=_0x729e9a[_0x8dde('0x12')];var _0x1cbc70=![];var _0x456840=null;if(_0x45192c[_0x8dde('0x19')]!==null){logger[_0x8dde('0xf')](_0x8dde('0x1a'),_0x45192c[_0x8dde('0x19')]);_0x45192c[_0x8dde('0x1b')]=_0x45192c['agentEmail'];for(_0x456840=0x0;_0x456840<_0x2bf03f[_0x8dde('0x13')];_0x456840++){if(_0x2bf03f[_0x456840][_0x8dde('0x1c')]===_0x45192c[_0x8dde('0x19')]){_0x1cbc70=!![];_0x45192c['userId']=_0x2bf03f[_0x456840]['id'];logger[_0x8dde('0xf')](_0x8dde('0x1d'),_0x45192c['userId']);}}}if(!_0x1cbc70){logger[_0x8dde('0xf')]('Admin\x20selected');_0x45192c['userEmail']=_0x45192c[_0x8dde('0x1e')];_0x45192c[_0x8dde('0x1f')]=_0x45192c['adminId'];_0x1cbc70=!![];}if(_0x1cbc70){_0x1a6a51(_0x45192c);}else{_0x5d57f5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5d57f5({'statusCode':0x194,'message':_0x8dde('0x15')});}})[_0x8dde('0x16')](function(_0xde7fd4){logger['error']('['+[_0x4ee947['toUpperCase']()]+']',_0xde7fd4['message']);_0x5d57f5(_0xde7fd4);});});};}function searchContact(_0x39d270,_0x2b30ba,_0x5e0aaa,_0x206afc){return new Promise(function(_0x50b25c,_0x283aa4){var _0x1372c9={'method':_0x8dde('0xc'),'headers':_0x2b30ba,'uri':_0x39d270+'/api/lookup?q='+_0x206afc+_0x8dde('0x20')+_0x5e0aaa+'&entities=contact','json':!![]};rp(_0x1372c9)[_0x8dde('0x11')](function(_0x46dbc9){var _0x44aac4=_['find'](_0x46dbc9['contacts'][_0x8dde('0x21')],[_0x5e0aaa,_0x206afc]);_0x50b25c(_0x44aac4);})[_0x8dde('0x16')](function(_0x1a5385){_0x283aa4(_0x1a5385);});});}function getEndUser(_0x8874b3,_0x3b1df7,_0x559142){return function(_0x1d6712){return new Promise(function(_0x31b447,_0x42123c){logger[_0x8dde('0xf')](util[_0x8dde('0x22')](_0x8dde('0x23'),_0x1d6712[_0x8dde('0x24')]));searchContact(_0x559142,_0x3b1df7,'mobile_number',_0x1d6712[_0x8dde('0x24')])[_0x8dde('0x11')](function(_0x1bebd2){if(_0x1bebd2){_0x1d6712[_0x8dde('0x25')]=_0x1bebd2['id'];logger[_0x8dde('0xf')](_0x8dde('0x26'),_0x1d6712['endUserId']);return _0x31b447(_0x1d6712);}searchContact(_0x559142,_0x3b1df7,_0x8dde('0x27'),_0x1d6712['contactNumber'])['then'](function(_0x7a915a){if(_0x7a915a){_0x1d6712[_0x8dde('0x25')]=_0x7a915a['id'];logger[_0x8dde('0xf')](_0x8dde('0x28'),_0x1d6712[_0x8dde('0x25')]);return _0x31b447(_0x1d6712);}createEndUser(_0x1d6712,_0x8874b3,_0x3b1df7,_0x559142)[_0x8dde('0x11')](function(_0x33e39c){logger[_0x8dde('0xf')](_0x8dde('0x29'),_0x33e39c[_0x8dde('0x25')]);return _0x31b447(_0x33e39c);});});})[_0x8dde('0x16')](function(_0x5068bf){_0x42123c(_0x5068bf);});});};}function createEndUser(_0x605c8a,_0x23d095,_0x4b2979,_0x171ec6){return new Promise(function(_0x49771f,_0x276c41){var _0x9b1317=moment();var _0x1e0438={'method':'POST','uri':_0x171ec6+_0x8dde('0x2a'),'body':{'contact':{'last_name':_0x605c8a[_0x8dde('0x24')],'work_number':_0x605c8a['contactNumber'],'mobile_number':_0x605c8a[_0x8dde('0x24')],'owner_id':_0x605c8a[_0x8dde('0x1f')],'created_at':_0x9b1317['format'](_0x8dde('0x2b'))}},'json':!![]};_0x1e0438['headers']=_0x4b2979;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x1e0438)[_0x8dde('0x11')](function(_0x477b50){_0x605c8a['endUserId']=_0x477b50[_0x8dde('0x2c')]['id'];_0x49771f(_0x605c8a);})[_0x8dde('0x16')](function(_0xeb6a4e){logger[_0x8dde('0x17')]('['+[_0x23d095[_0x8dde('0x2d')]()]+']',_0xeb6a4e[_0x8dde('0x2e')]);_0x276c41(_0xeb6a4e[_0x8dde('0x2e')]);});});}function getTicket(_0x589392,_0x13fee6,_0x594f85,_0x39a68a,_0x5d8629){return function(_0x474435){logger[_0x8dde('0xf')](_0x8dde('0x2f'));return new Promise(function(_0x2acd7f,_0x274dd0){var _0x4aca84=moment();var _0xd5e1a4={'method':_0x8dde('0x30'),'uri':_0x594f85+_0x8dde('0x31'),'body':{'title':intUtil[_0x8dde('0x32')](_0x39a68a[_0x8dde('0x33')],_0x5d8629,'\x20'),'description':intUtil[_0x8dde('0x32')](_0x39a68a['Descriptions'],_0x5d8629,'\x0a'),'owner_id':_0x474435[_0x8dde('0x1f')],'creater_id':_0x474435[_0x8dde('0x14')],'targetable_id':_0x474435[_0x8dde('0x25')],'targetable_type':_0x8dde('0x34'),'created_at':_0x4aca84['format'](_0x8dde('0x2b')),'due_date':_0x4aca84[_0x8dde('0x35')](0x1e,'m')[_0x8dde('0x22')](_0x8dde('0x2b'))},'json':!![]};_0xd5e1a4[_0x8dde('0xe')]=_0x13fee6;return rp(_0xd5e1a4)[_0x8dde('0x11')](function(_0x1de905){_0x474435['ticketId']=_0x1de905[_0x8dde('0x36')]['id'];logger['info']('Task\x20created:',_0x474435[_0x8dde('0x37')]);_0x2acd7f(_0x474435);})['catch'](function(_0x121ced){logger[_0x8dde('0x17')]('['+[_0x589392[_0x8dde('0x2d')]()]+']',_0x121ced['message']);_0x274dd0(_0x121ced[_0x8dde('0x2e')]);});});};}function emit(_0x4c9dc4,_0x481dfa,_0x590ef7){var _0x1a71dc={'uri':_0x4c9dc4+_0x8dde('0x38')+_0x590ef7};io['to'](util[_0x8dde('0x22')](_0x8dde('0x39'),_0x481dfa))[_0x8dde('0x3a')](_0x8dde('0x3b'),_0x1a71dc);}exports['cs']=function(_0x2e54dc,_0x463f9c,_0x2d8689,_0x23ac6a,_0x440cd5,_0x3c7c53,_0x1e5bd9,_0x33d906){var _0x16f20f={};var _0x5aee52={'Authorization':_0x8dde('0x3c')+_0x3c7c53[_0x8dde('0x3d')]};_0x3c7c53[_0x8dde('0x3e')]=intUtil['stripTrailingSlash'](_0x3c7c53[_0x8dde('0x3e')]);_0x3c7c53[_0x8dde('0x3f')]=intUtil[_0x8dde('0x40')](_0x3c7c53[_0x8dde('0x3f')]);var _0x127ad0=_0x3c7c53[_0x8dde('0x3e')];_0x16f20f[_0x8dde('0x1e')]=_0x3c7c53['username'];_0x16f20f[_0x8dde('0x24')]=_0x33d906[_0x8dde('0x41')]()===_0x8dde('0x42')?_0x463f9c[_0x8dde('0x43')]:_0x463f9c[_0x8dde('0x44')];_0x16f20f['callDirection']=_0x33d906==='queue'||_0x33d906===_0x8dde('0x45')?_0x8dde('0x46'):'outbound';if(_0x23ac6a){_0x16f20f[_0x8dde('0x19')]=_0x23ac6a[_0x8dde('0x1c')];}var _0x2df84a=util[_0x8dde('0x22')](_0x8dde('0x47'),_0x3c7c53[_0x8dde('0x3f')],_0x463f9c[_0x8dde('0x48')],md5(_0x463f9c['uniqueid']));if(_0x440cd5&&_0x440cd5[_0x8dde('0x49')]){logger['info'](_0x8dde('0x4a'),'Recording\x20is\x20enabled!');_0x463f9c[_0x8dde('0x4b')]=_0x2df84a;}else if(_0x1e5bd9&&_0x1e5bd9[_0x8dde('0x4c')]&&_0x1e5bd9[_0x8dde('0x4c')]!==_0x8dde('0x4d')){logger['info']('[OUTBOUND]',_0x8dde('0x4e'));_0x463f9c[_0x8dde('0x4b')]=_0x2df84a;}else{_0x463f9c[_0x8dde('0x4b')]='';}return getAdminId(_0x16f20f,_0x33d906,_0x5aee52,_0x127ad0)[_0x8dde('0x11')](getUser(_0x33d906,_0x5aee52,_0x127ad0))[_0x8dde('0x11')](getEndUser(_0x33d906,_0x5aee52,_0x127ad0))[_0x8dde('0x11')](getTicket(_0x33d906,_0x5aee52,_0x127ad0,_0x2d8689,_0x463f9c))[_0x8dde('0x11')](function(_0x2d5c61){logger[_0x8dde('0xf')](util[_0x8dde('0x22')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2d5c61[_0x8dde('0x37')]));if(_0x33d906!==_0x8dde('0x45')){logger[_0x8dde('0xf')]('['+[_0x33d906[_0x8dde('0x2d')]()]+']',_0x8dde('0x4f'));emit(_0x127ad0,_0x23ac6a[_0x8dde('0x50')],_0x2d5c61[_0x8dde('0x25')]);}})[_0x8dde('0x16')](function(_0x26c804){logger['error']('['+[_0x33d906[_0x8dde('0x2d')]()]+_0x8dde('0x51'),util[_0x8dde('0x52')](_0x26c804,{'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 fea422c..73b36be 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 _0x2cbe=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unknown\x20integration','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2cbe,0x11f));var _0xe2cb=function(_0x205e83,_0x2df5a4){_0x205e83=_0x205e83-0x0;var _0x10bb19=_0x2cbe[_0x205e83];return _0x10bb19;};'use strict';var _=require(_0xe2cb('0x0'));var util=require('util');var zendesk=require(_0xe2cb('0x1'));var salesforce=require(_0xe2cb('0x2'));var sugarcrm=require(_0xe2cb('0x3'));var freshdesk=require(_0xe2cb('0x4'));var zoho=require(_0xe2cb('0x5'));var desk=require(_0xe2cb('0x6'));var vtiger=require(_0xe2cb('0x7'));var servicenow=require(_0xe2cb('0x8'));var dynamics365=require(_0xe2cb('0x9'));var freshsales=require(_0xe2cb('0xa'));var integrations=[_0xe2cb('0xb'),_0xe2cb('0xc'),_0xe2cb('0xd'),_0xe2cb('0xe'),_0xe2cb('0xf'),_0xe2cb('0x10'),_0xe2cb('0x11'),_0xe2cb('0x12'),_0xe2cb('0x13'),_0xe2cb('0x14')];exports['exec']=function(_0x4b043c,_0x41d360,_0x5cd010,_0x200d6b,_0x23a7df,_0x2b6688){if(_0x5cd010){if(_[_0xe2cb('0x15')](integrations,_0x4b043c[_0xe2cb('0x16')]['toLowerCase']())){try{var _0x4cc921=null;var _0x5cba1b='';var _0x38a4cd=_0x5cd010[_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')]()];if(_0x38a4cd){var _0x189e60=_0x38a4cd[_0x4b043c[_0xe2cb('0x18')]];if(_0x189e60){var _0x25eb8c=_['find'](_0x189e60[_0xe2cb('0x19')],{'id':parseInt(_0x4b043c[_0xe2cb('0x1a')],0xa)});if(_0x25eb8c){if(_0x200d6b){if(_0x23a7df&&_0x41d360[_0xe2cb('0x1b')]){_0x5cba1b='queue';}else if(_0x41d360[_0xe2cb('0x1c')]){_0x5cba1b=_0xe2cb('0x1d');}else{console[_0xe2cb('0x1e')](_0xe2cb('0x1f'),_0x41d360);}}else{_0x5cba1b='unmanaged';}switch(_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')]()){case'zendesk':zendesk[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0xc'):salesforce[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0xd'):sugarcrm[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case'freshdesk':freshdesk[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0xf'):zoho[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0x10'):desk[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0x11'):vtiger[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0x13'):freshsales['cs'](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688,_0x5cba1b);break;case _0xe2cb('0x14'):servicenow['cs'](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688,_0x5cba1b);break;case _0xe2cb('0x12'):dynamics365['cs'](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688,_0x5cba1b);break;default:console[_0xe2cb('0x1e')](_0xe2cb('0x20'));}}else{_0x4cc921=require('../../../../config/logger')(_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')]());_0x4cc921['error'](_0xe2cb('0x21'),util[_0xe2cb('0x22')](_0xe2cb('0x23'),_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')](),_0x4b043c['data3']));}}else{_0x4cc921=require(_0xe2cb('0x24'))(_0x4b043c['data1'][_0xe2cb('0x17')]());_0x4cc921[_0xe2cb('0x25')](_0xe2cb('0x21'),util[_0xe2cb('0x22')](_0xe2cb('0x26'),_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')](),_0x4b043c[_0xe2cb('0x18')]));}}else{}}catch(_0x394835){console[_0xe2cb('0x25')](_0x394835);}}}}; \ No newline at end of file +var _0x492d=['error','%s\x20configuration\x20#%s\x20not\x20found','data3','../../../../config/logger','[EXEC]','format','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./freshsales','zendesk','salesforce','freshdesk','desk','vtiger','dynamics365','servicenow','exec','data1','toLowerCase','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zoho','freshsales','unknown\x20integration'];(function(_0x5641b8,_0x29685e){var _0x5835e4=function(_0x1721e8){while(--_0x1721e8){_0x5641b8['push'](_0x5641b8['shift']());}};_0x5835e4(++_0x29685e);}(_0x492d,0xbb));var _0xd492=function(_0x14ac05,_0x553652){_0x14ac05=_0x14ac05-0x0;var _0x2e880e=_0x492d[_0x14ac05];return _0x2e880e;};'use strict';var _=require(_0xd492('0x0'));var util=require(_0xd492('0x1'));var zendesk=require(_0xd492('0x2'));var salesforce=require(_0xd492('0x3'));var sugarcrm=require(_0xd492('0x4'));var freshdesk=require(_0xd492('0x5'));var zoho=require(_0xd492('0x6'));var desk=require('./desk');var vtiger=require(_0xd492('0x7'));var servicenow=require(_0xd492('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xd492('0x9'));var integrations=[_0xd492('0xa'),_0xd492('0xb'),'sugarcrm',_0xd492('0xc'),'zoho',_0xd492('0xd'),_0xd492('0xe'),_0xd492('0xf'),'freshsales',_0xd492('0x10')];exports[_0xd492('0x11')]=function(_0x28b803,_0xbe2fa9,_0x53cc17,_0x40533d,_0x22b658,_0x5542f2){if(_0x53cc17){if(_['includes'](integrations,_0x28b803[_0xd492('0x12')][_0xd492('0x13')]())){try{var _0x1ce5a5=null;var _0x24baad='';var _0x1cdc7d=_0x53cc17[_0x28b803[_0xd492('0x12')][_0xd492('0x13')]()];if(_0x1cdc7d){var _0x244e0b=_0x1cdc7d[_0x28b803['data2']];if(_0x244e0b){var _0x230bba=_['find'](_0x244e0b['Configurations'],{'id':parseInt(_0x28b803['data3'],0xa)});if(_0x230bba){if(_0x40533d){if(_0x22b658&&_0xbe2fa9[_0xd492('0x14')]){_0x24baad=_0xd492('0x14');}else if(_0xbe2fa9[_0xd492('0x15')]){_0x24baad=_0xd492('0x16');}else{console[_0xd492('0x17')](_0xd492('0x18'),_0xbe2fa9);}}else{_0x24baad=_0xd492('0x19');}switch(_0x28b803[_0xd492('0x12')][_0xd492('0x13')]()){case _0xd492('0xa'):zendesk[_0x24baad](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2);break;case _0xd492('0xb'):salesforce[_0x24baad](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2);break;case'sugarcrm':sugarcrm[_0x24baad](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2);break;case _0xd492('0xc'):freshdesk[_0x24baad](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2);break;case _0xd492('0x1a'):zoho[_0x24baad](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2);break;case'desk':desk[_0x24baad](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2);break;case _0xd492('0xe'):vtiger[_0x24baad](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2);break;case _0xd492('0x1b'):freshsales['cs'](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2,_0x24baad);break;case'servicenow':servicenow['cs'](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2,_0x24baad);break;case _0xd492('0xf'):dynamics365['cs'](_0x28b803,_0xbe2fa9,_0x230bba,_0x40533d,_0x22b658,_0x244e0b,_0x5542f2,_0x24baad);break;default:console[_0xd492('0x17')](_0xd492('0x1c'));}}else{_0x1ce5a5=require('../../../../config/logger')(_0x28b803[_0xd492('0x12')]['toLowerCase']());_0x1ce5a5[_0xd492('0x1d')]('[EXEC]',util['format'](_0xd492('0x1e'),_0x28b803[_0xd492('0x12')][_0xd492('0x13')](),_0x28b803[_0xd492('0x1f')]));}}else{_0x1ce5a5=require(_0xd492('0x20'))(_0x28b803[_0xd492('0x12')]['toLowerCase']());_0x1ce5a5[_0xd492('0x1d')](_0xd492('0x21'),util[_0xd492('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x28b803[_0xd492('0x12')]['toLowerCase'](),_0x28b803[_0xd492('0x23')]));}}else{}}catch(_0x26560b){console[_0xd492('0x1d')](_0x26560b);}}}}; \ 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 805129c..6f49764 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 _0x8c1e=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','email','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','utc','IsRecurrence','endUserType','contact','account','WhatId','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','identity','display_name','moduleSearch','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','cloneDeep','additionalSearchAccount','Account','Lead','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','create','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','securityToken','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format'];(function(_0x23284a,_0xab8e95){var _0x1f4a50=function(_0x32d3bc){while(--_0x32d3bc){_0x23284a['push'](_0x23284a['shift']());}};_0x1f4a50(++_0xab8e95);}(_0x8c1e,0x118));var _0xe8c1=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c1e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var rp=require(_0xe8c1('0x0'));var moment=require(_0xe8c1('0x1'));var BPromise=require(_0xe8c1('0x2'));var md5=require(_0xe8c1('0x3'));var jsforce=require(_0xe8c1('0x4'));var util=require(_0xe8c1('0x5'));var Redis=require(_0xe8c1('0x6'));var intUtil=require(_0xe8c1('0x7'));var config=require(_0xe8c1('0x8'));var logger=require(_0xe8c1('0x9'))(_0xe8c1('0xa'));config['redis']=_[_0xe8c1('0xb')](config[_0xe8c1('0xc')],{'host':_0xe8c1('0xd'),'port':0x18eb});var io=require(_0xe8c1('0xe'))(new Redis(config['redis']));function emit(_0x351eab,_0x30d092,_0x17f8be){io['to'](_0x351eab)[_0xe8c1('0xf')](_0x30d092,_0x17f8be);}function getTicket(_0x339dc1,_0x4e122a,_0x1c94c2,_0x3c3971,_0x2f2894,_0x57362f,_0x300156,_0x1077ec){var _0x15b7e7=Object[_0xe8c1('0x10')]({},{'OwnerId':_0x4e122a['id'],'Subject':intUtil[_0xe8c1('0x11')](_0x3c3971[_0xe8c1('0x12')],_0x2f2894,'\x20'),'Description':intUtil[_0xe8c1('0x11')](_0x3c3971['Descriptions'],_0x2f2894,'\x0a')},getCustomFields(_0x57362f,_0x2f2894));if(_0x1c94c2){if(_0x3c3971[_0xe8c1('0x13')]==='Task'){_0x15b7e7['ActivityDate']=moment[_0xe8c1('0x14')]();_0x15b7e7['IsReminderSet']=![];_0x15b7e7[_0xe8c1('0x15')]=![];if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x17')||_0x1c94c2[_0xe8c1('0x16')]==='lead'){_0x15b7e7['WhoId']=_0x1c94c2['id'];}else if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x18')){_0x15b7e7[_0xe8c1('0x19')]=_0x1c94c2['id'];}}else if(_0x3c3971[_0xe8c1('0x13')]===_0xe8c1('0x1a')){if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x17')){_0x15b7e7[_0xe8c1('0x1b')]=_0x1c94c2['id'];}else if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x18')){_0x15b7e7[_0xe8c1('0x1c')]=_0x1c94c2['id'];}else if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x1d')&&_0x3c3971[_0xe8c1('0x1e')]){_0x15b7e7[_0x3c3971[_0xe8c1('0x1e')]]=_0x1c94c2['id'];}else{logger[_0xe8c1('0x1f')](_0xe8c1('0x20'));}}}return _0x300156[_0xe8c1('0x21')](_0x3c3971[_0xe8c1('0x13')])['create'](_0x15b7e7);}function getUser(_0x579a82,_0x24c277,_0x326cf8){if(!_[_0xe8c1('0x22')](_0x24c277)&&intUtil[_0xe8c1('0x23')](_0x24c277)){var _0x1f9041={'Email':_0x24c277};var _0x3c78d3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x326cf8[_0xe8c1('0x21')]('User')[_0xe8c1('0x24')](_0x1f9041,_0x3c78d3)[_0xe8c1('0x25')]()[_0xe8c1('0x26')](function(_0x4600e2){if(_0x4600e2[_0xe8c1('0x27')]){var _0x312766=_[_0xe8c1('0x24')](_0x4600e2,function(_0xba0683){return _0xba0683[_0xe8c1('0x28')]===_0x24c277;});if(_0x312766){logger[_0xe8c1('0x1f')]('Agent\x20%s\x20found.',_0x24c277);return BPromise[_0xe8c1('0x29')]({'id':_0x312766['Id'],'name':_0x312766[_0xe8c1('0x2a')]});}}else{logger[_0xe8c1('0x1f')](_0xe8c1('0x2b'),_0x24c277);return _0x326cf8['identity']()['then'](function(_0x2a6755){return BPromise[_0xe8c1('0x29')]({'id':_0x2a6755[_0xe8c1('0x2c')],'name':_0x2a6755['display_name']});});}});}else{logger[_0xe8c1('0x1f')](_0xe8c1('0x2b'),_0x24c277);return _0x326cf8[_0xe8c1('0x2d')]()[_0xe8c1('0x26')](function(_0x26d483){return BPromise['resolve']({'id':_0x26d483[_0xe8c1('0x2c')],'name':_0x26d483[_0xe8c1('0x2e')]});});}}function getEndUser(_0x14ddf4,_0x3cd096,_0x5f77d,_0x5156fd,_0x3dd4eb){var _0x424439={'$or':{'Phone':_0x5156fd}};var _0x58a1e9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe8c1('0x29')]()['then'](function(){logger[_0xe8c1('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5156fd,_0x3cd096[_0xe8c1('0x2f')]);switch(_0x3cd096[_0xe8c1('0x2f')]){case'contact_lead':var _0x568199=_['cloneDeep'](_0x424439);if(_0x3cd096[_0xe8c1('0x30')]){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x30')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x568199[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb['sobject'](_0xe8c1('0x33'))['find'](_0x568199,_0x58a1e9)['execute']()[_0xe8c1('0x26')](function(_0x42aa0b){if(_0x42aa0b&&_0x42aa0b['length']){return _0x42aa0b;}else{var _0x3533a0=_['cloneDeep'](_0x424439);if(_0x3cd096[_0xe8c1('0x34')]){var _0x4ec9fe={};_0x4ec9fe[_0x3cd096['additionalSearchLead']]=_0x5156fd;_[_0xe8c1('0x31')](_0x3533a0['$or'],_0x4ec9fe);}return _0x3dd4eb[_0xe8c1('0x21')]('Lead')[_0xe8c1('0x24')](_0x3533a0,_0x58a1e9);}});case _0xe8c1('0x35'):var _0x4ab2a3=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096[_0xe8c1('0x37')]){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x37')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x4ab2a3[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x38'))[_0xe8c1('0x24')](_0x4ab2a3,_0x58a1e9)[_0xe8c1('0x25')]()[_0xe8c1('0x26')](function(_0x4f6507){if(_0x4f6507&&_0x4f6507[_0xe8c1('0x27')]){return _0x4f6507;}else{var _0x32acbd=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096['additionalSearchContact']){var _0x28f26a={};_0x28f26a[_0x3cd096[_0xe8c1('0x30')]]=_0x5156fd;_['merge'](_0x32acbd[_0xe8c1('0x32')],_0x28f26a);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x33'))[_0xe8c1('0x24')](_0x32acbd,_0x58a1e9)[_0xe8c1('0x26')](function(_0x440af8){if(_0x440af8&&_0x440af8[_0xe8c1('0x27')]){return _0x440af8;}else{var _0x4b0a50=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096['additionalSearchLead']){var _0x40b104={};_0x40b104[_0x3cd096[_0xe8c1('0x34')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x4b0a50['$or'],_0x40b104);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x39'))[_0xe8c1('0x24')](_0x4b0a50,_0x58a1e9);}});}});case _0xe8c1('0x17'):var _0x568199=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096['additionalSearchContact']){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x30')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x568199[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb['sobject'](_0xe8c1('0x33'))[_0xe8c1('0x24')](_0x568199,_0x58a1e9)['execute']();case _0xe8c1('0x1d'):var _0x345676=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096[_0xe8c1('0x34')]){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x34')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x345676[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x39'))[_0xe8c1('0x24')](_0x345676,_0x58a1e9);case _0xe8c1('0x18'):var _0x4ab2a3=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096[_0xe8c1('0x37')]){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x37')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x4ab2a3[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x38'))[_0xe8c1('0x24')](_0x4ab2a3,_0x58a1e9);default:return null;}})[_0xe8c1('0x26')](function(_0x2a6c25){if(_0x2a6c25&&_0x2a6c25[_0xe8c1('0x27')]){var _0x468f52=_[_0xe8c1('0x3a')](_0x2a6c25);if(_0x468f52){return BPromise[_0xe8c1('0x29')]({'id':_0x468f52['Id'],'name':_0x468f52[_0xe8c1('0x2a')],'phone':_0x468f52[_0xe8c1('0x3b')],'endUserType':_0x468f52['attributes'][_0xe8c1('0x3c')][_0xe8c1('0x3d')]()});}}})[_0xe8c1('0x26')](function(_0x326cdb){if(_0x326cdb){logger['info'](_0xe8c1('0x3e'),_0x326cdb[_0xe8c1('0x16')],_0x5156fd);return BPromise[_0xe8c1('0x29')](_0x326cdb);}else{logger[_0xe8c1('0x1f')](_0xe8c1('0x3f'),_0x5156fd);var _0x58268a={'Phone':_0x5156fd};if(_0x3cd096[_0xe8c1('0x40')]){if(_0x3cd096[_0xe8c1('0x40')]==='contact'){logger['info'](_0xe8c1('0x41'),_0x5156fd,_0x3cd096['moduleCreate']);_0x58268a[_0xe8c1('0x42')]=_0x5f77d!==_0xe8c1('0x43')?_0x5f77d:util['format']('Caller\x20-\x20%s',_0x5156fd);}else if(_0x3cd096[_0xe8c1('0x40')]===_0xe8c1('0x1d')){logger['info'](_0xe8c1('0x41'),_0x5156fd,_0x3cd096[_0xe8c1('0x40')]);_0x58268a[_0xe8c1('0x42')]=_0x5f77d!==_0xe8c1('0x43')?_0x5f77d:util[_0xe8c1('0x44')](_0xe8c1('0x45'),_0x5156fd);_0x58268a['Company']=_0xe8c1('0x46');}else if(_0x3cd096[_0xe8c1('0x40')]===_0xe8c1('0x18')){logger[_0xe8c1('0x1f')](_0xe8c1('0x41'),_0x5156fd,_0x3cd096[_0xe8c1('0x40')]);_0x58268a['Name']=_0x5f77d!==_0xe8c1('0x43')?_0x5f77d:util[_0xe8c1('0x44')](_0xe8c1('0x45'),_0x5156fd);}else{return null;}}return _0x3dd4eb[_0xe8c1('0x21')](_[_0xe8c1('0x47')](_0x3cd096[_0xe8c1('0x40')]))[_0xe8c1('0x48')](_0x58268a)[_0xe8c1('0x26')](function(_0x41779d){return BPromise[_0xe8c1('0x29')]({'id':_0x41779d['id'],'endUserType':_0x3cd096['moduleCreate']});});}});}function getCustomFields(_0x303a30,_0x441f06){var _0x436e03={};if(_0x303a30['length']>0x0){_[_0xe8c1('0x49')](_0x303a30,function(_0x25f217){if(_[_0xe8c1('0x4a')]([_0xe8c1('0x4b'),_0xe8c1('0x4c')],_0x25f217[_0xe8c1('0x3c')])&&_0x25f217['idField']){_0x436e03[_0x25f217[_0xe8c1('0x4d')]]=_0x25f217[_0xe8c1('0x4e')][_0xe8c1('0x4f')]();}else if(_0x25f217[_0xe8c1('0x3c')]===_0xe8c1('0x50')&&_0x25f217['variableName']&&_0x25f217[_0xe8c1('0x4d')]){_0x441f06[_0x25f217['variableName']]&&(_0x436e03[_0x25f217[_0xe8c1('0x4d')]]=_0x441f06[_0x25f217[_0xe8c1('0x51')]][_0xe8c1('0x4f')]());}else if(_0x25f217[_0xe8c1('0x3c')]===_0xe8c1('0x52')&&_0x25f217[_0xe8c1('0x53')]&&_0x25f217[_0xe8c1('0x53')][_0xe8c1('0x54')]&&_0x25f217['idField']){_0x441f06[_0x25f217[_0xe8c1('0x53')][_0xe8c1('0x54')][_0xe8c1('0x3d')]()]&&(_0x436e03[_0x25f217[_0xe8c1('0x4d')]]=_0x441f06[_0x25f217['Variable'][_0xe8c1('0x54')]['toLowerCase']()][_0xe8c1('0x4f')]());}});}return _0x436e03;}function getConnection(_0x13a425){var _0x13840b=_0x13a425['password']['concat'](_0x13a425[_0xe8c1('0x55')]);var _0x948a70=new jsforce['Connection']({'oauth2':{'loginUrl':_0x13a425[_0xe8c1('0x56')]||_0xe8c1('0x57'),'clientId':_0x13a425['clientId'],'clientSecret':_0x13a425['clientSecret']}});return _0x948a70[_0xe8c1('0x58')](_0x13a425[_0xe8c1('0x59')],_0x13840b)['then'](function(){logger['info'](_0xe8c1('0x5a'));return _0x948a70;});}exports[_0xe8c1('0x5b')]=function(_0x1a717b,_0x306c77,_0x50c01e,_0x38a7e6,_0x3d2e8a,_0x331aa1){var _0x47e409,_0x5b2e6a,_0x5f3a06,_0x4c1b1f;_0x331aa1[_0xe8c1('0x5c')]=intUtil[_0xe8c1('0x5d')](_0x331aa1[_0xe8c1('0x5c')]);_0x331aa1[_0xe8c1('0x56')]=intUtil[_0xe8c1('0x5d')](_0x331aa1[_0xe8c1('0x56')]);if(_0x3d2e8a&&_0x3d2e8a[_0xe8c1('0x5e')]){logger[_0xe8c1('0x1f')]('[QUEUE]',_0xe8c1('0x5f'));_0x306c77[_0xe8c1('0x60')]=util[_0xe8c1('0x44')](_0xe8c1('0x61'),_0x331aa1[_0xe8c1('0x5c')],_0x306c77[_0xe8c1('0x62')],md5(_0x306c77['uniqueid']));}else{_0x306c77['recordingURL']='';}return getConnection(_0x331aa1)[_0xe8c1('0x26')](function(_0x200919){_0x4c1b1f=_0x200919;return getUser(_0x331aa1,_0x38a7e6['email'],_0x4c1b1f);})[_0xe8c1('0x26')](function(_0xa54f14){_0x47e409=_0xa54f14;return getEndUser(_0x331aa1,_0x50c01e,_0x306c77[_0xe8c1('0x63')],_0x306c77[_0xe8c1('0x64')],_0x4c1b1f);})[_0xe8c1('0x26')](function(_0x307476){_0x5b2e6a=_0x307476;return getTicket(_0x331aa1,_0x47e409,_0x5b2e6a,_0x50c01e,_0x306c77,_0x50c01e[_0xe8c1('0x65')],_0x4c1b1f,'queue');})[_0xe8c1('0x26')](function(_0x36eb4d){_0x5f3a06=_0x36eb4d;logger['info'](_0xe8c1('0x66'),_0x5f3a06['id']);logger[_0xe8c1('0x1f')](_0xe8c1('0x67'),_0x5f3a06['id'],_0x38a7e6['name'],_0x331aa1[_0xe8c1('0x3c')]);switch(_0x331aa1['type']){case _0xe8c1('0x68'):emit(util[_0xe8c1('0x44')](_0xe8c1('0x69'),_0x38a7e6['name']),_0xe8c1('0x6a'),{'recordId':_0x5f3a06['id']});break;case _0xe8c1('0x6b'):emit(util[_0xe8c1('0x44')](_0xe8c1('0x69'),_0x38a7e6[_0xe8c1('0x54')]),_0xe8c1('0x6c'),{'uri':util[_0xe8c1('0x44')]('%s/%s/e',_0x4c1b1f[_0xe8c1('0x6d')],_0x5f3a06['id'])});break;default:logger['error'](_0xe8c1('0x6e'));}})[_0xe8c1('0x6f')](function(_0x5ebd95){logger[_0xe8c1('0x70')](_0xe8c1('0x71'),_0x5ebd95);});};exports[_0xe8c1('0x72')]=function(_0x5741a9,_0x4a9d3d,_0x5bbc0a,_0x251c6d,_0x2e4535,_0x44c26d,_0x15e6d5){var _0x193390,_0x127064,_0x3be9af,_0x59f3df;_0x44c26d['serverUrl']=intUtil[_0xe8c1('0x5d')](_0x44c26d[_0xe8c1('0x5c')]);_0x44c26d[_0xe8c1('0x56')]=intUtil['stripTrailingSlash'](_0x44c26d['remoteUri']);if(_0x15e6d5&&_0x15e6d5[_0xe8c1('0x73')]&&_0x15e6d5[_0xe8c1('0x73')]!=='none'){logger['info'](_0xe8c1('0x74'),_0xe8c1('0x5f'));_0x4a9d3d[_0xe8c1('0x60')]=util[_0xe8c1('0x44')](_0xe8c1('0x61'),_0x44c26d[_0xe8c1('0x5c')],_0x4a9d3d[_0xe8c1('0x62')],md5(_0x4a9d3d[_0xe8c1('0x62')]));}return getConnection(_0x44c26d)['then'](function(_0x3498a1){_0x59f3df=_0x3498a1;return getUser(_0x44c26d,_0x251c6d[_0xe8c1('0x75')],_0x59f3df);})[_0xe8c1('0x26')](function(_0x1ff2a3){_0x193390=_0x1ff2a3;return getEndUser(_0x44c26d,_0x5bbc0a,_0x4a9d3d['destcalleridname'],_0x4a9d3d[_0xe8c1('0x76')],_0x59f3df);})[_0xe8c1('0x26')](function(_0x1cf131){_0x127064=_0x1cf131;return getTicket(_0x44c26d,_0x193390,_0x127064,_0x5bbc0a,_0x4a9d3d,_0x5bbc0a[_0xe8c1('0x65')],_0x59f3df,_0xe8c1('0x72'));})[_0xe8c1('0x26')](function(_0x4e25f2){_0x3be9af=_0x4e25f2;logger[_0xe8c1('0x1f')](_0xe8c1('0x77'),_0x3be9af['id']);logger[_0xe8c1('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3be9af['id'],_0x251c6d[_0xe8c1('0x54')],_0x44c26d[_0xe8c1('0x3c')]);switch(_0x44c26d[_0xe8c1('0x3c')]){case _0xe8c1('0x68'):emit(util[_0xe8c1('0x44')]('user:%s',_0x251c6d[_0xe8c1('0x54')]),_0xe8c1('0x6a'),{'recordId':_0x3be9af['id']});break;case _0xe8c1('0x6b'):emit(util[_0xe8c1('0x44')](_0xe8c1('0x69'),_0x251c6d[_0xe8c1('0x54')]),'trigger:browser:url',{'uri':util[_0xe8c1('0x44')](_0xe8c1('0x78'),_0x59f3df[_0xe8c1('0x6d')],_0x3be9af['id'])});break;default:logger[_0xe8c1('0x70')](_0xe8c1('0x74'),_0xe8c1('0x79'));}})[_0xe8c1('0x6f')](function(_0x1a9f43){logger[_0xe8c1('0x70')](_0xe8c1('0x74'),_0x1a9f43);});};exports['unmanaged']=function(_0x14a201,_0x320485,_0x197fe6,_0x397804,_0x5a9bcb,_0x5d47aa){var _0x25b516,_0x541d3f,_0x55c8a3,_0x37a602;_0x5d47aa['serverUrl']=intUtil[_0xe8c1('0x5d')](_0x5d47aa[_0xe8c1('0x5c')]);_0x5d47aa['remoteUri']=intUtil[_0xe8c1('0x5d')](_0x5d47aa[_0xe8c1('0x56')]);if(_0x5a9bcb&&_0x5a9bcb['monitor_format']){logger[_0xe8c1('0x1f')]('['+_0x320485['lastevent'][_0xe8c1('0x7a')]()+']',_0xe8c1('0x5f'));_0x320485['recordingURL']=util[_0xe8c1('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d47aa[_0xe8c1('0x5c')],_0x320485[_0xe8c1('0x62')],md5(_0x320485[_0xe8c1('0x62')]));}else{_0x320485[_0xe8c1('0x60')]='';}return getConnection(_0x5d47aa)[_0xe8c1('0x26')](function(_0x3b15bf){_0x37a602=_0x3b15bf;if(!_['isNil'](_0x397804)){return getUser(_0x5d47aa,_0x397804['name'],_0x37a602);}else{return getUser(_0x5d47aa,null,_0x37a602);}})['then'](function(_0x517984){_0x25b516=_0x517984;return getEndUser(_0x5d47aa,_0x197fe6,_0x320485[_0xe8c1('0x63')],_0x320485[_0xe8c1('0x64')],_0x37a602);})[_0xe8c1('0x26')](function(_0x4c5c04){_0x541d3f=_0x4c5c04;return getTicket(_0x5d47aa,_0x25b516,_0x541d3f,_0x197fe6,_0x320485,_0x197fe6[_0xe8c1('0x65')],_0x37a602);})[_0xe8c1('0x26')](function(_0x2a4dd1){_0x55c8a3=_0x2a4dd1;logger[_0xe8c1('0x1f')]('['+_0x320485[_0xe8c1('0x7b')][_0xe8c1('0x7a')]()+']\x20Ticket\x20%s\x20created.',_0x55c8a3['id']);logger[_0xe8c1('0x1f')]('['+_0x320485[_0xe8c1('0x7b')][_0xe8c1('0x7a')]()+_0xe8c1('0x7c'),_0x5d47aa['type']);})[_0xe8c1('0x6f')](function(_0x126f5b){logger[_0xe8c1('0x70')]('['+_0x320485[_0xe8c1('0x7b')][_0xe8c1('0x7a')]()+']',_0x126f5b);});}; \ No newline at end of file +var _0xbfa5=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','./util','../../../../config/logger','salesforce','redis','defaults','emit','Descriptions','Task','ActivityDate','utc','contact','endUserType','lead','WhoId','account','WhatId','ticketType','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','sobject','User','find','execute','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Lead','first','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','LastName','Caller\x20-\x20%s','Company','upperFirst','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','monitor_format','recordingURL','serverUrl','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!'];(function(_0x278b5a,_0x234c48){var _0x5831e9=function(_0x2bea1f){while(--_0x2bea1f){_0x278b5a['push'](_0x278b5a['shift']());}};_0x5831e9(++_0x234c48);}(_0xbfa5,0x106));var _0x5bfa=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xbfa5[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x5bfa('0x0'));var rp=require(_0x5bfa('0x1'));var moment=require(_0x5bfa('0x2'));var BPromise=require('bluebird');var md5=require(_0x5bfa('0x3'));var jsforce=require(_0x5bfa('0x4'));var util=require(_0x5bfa('0x5'));var Redis=require('ioredis');var intUtil=require(_0x5bfa('0x6'));var config=require('../../../../config/environment');var logger=require(_0x5bfa('0x7'))(_0x5bfa('0x8'));config[_0x5bfa('0x9')]=_[_0x5bfa('0xa')](config[_0x5bfa('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bfa('0x9')]));function emit(_0x2e0ce1,_0x309466,_0x1d2b00){io['to'](_0x2e0ce1)[_0x5bfa('0xb')](_0x309466,_0x1d2b00);}function getTicket(_0x3aa8e1,_0x44a3a4,_0x582b82,_0x3a2e70,_0x5a4121,_0x568b56,_0x532c57,_0x2d69b9){var _0x539114=Object['assign']({},{'OwnerId':_0x44a3a4['id'],'Subject':intUtil['getString'](_0x3a2e70['Subjects'],_0x5a4121,'\x20'),'Description':intUtil['getString'](_0x3a2e70[_0x5bfa('0xc')],_0x5a4121,'\x0a')},getCustomFields(_0x568b56,_0x5a4121));if(_0x582b82){if(_0x3a2e70['ticketType']===_0x5bfa('0xd')){_0x539114[_0x5bfa('0xe')]=moment[_0x5bfa('0xf')]();_0x539114['IsReminderSet']=![];_0x539114['IsRecurrence']=![];if(_0x582b82['endUserType']===_0x5bfa('0x10')||_0x582b82[_0x5bfa('0x11')]===_0x5bfa('0x12')){_0x539114[_0x5bfa('0x13')]=_0x582b82['id'];}else if(_0x582b82[_0x5bfa('0x11')]===_0x5bfa('0x14')){_0x539114[_0x5bfa('0x15')]=_0x582b82['id'];}}else if(_0x3a2e70[_0x5bfa('0x16')]==='Case'){if(_0x582b82[_0x5bfa('0x11')]==='contact'){_0x539114[_0x5bfa('0x17')]=_0x582b82['id'];}else if(_0x582b82[_0x5bfa('0x11')]==='account'){_0x539114[_0x5bfa('0x18')]=_0x582b82['id'];}else if(_0x582b82[_0x5bfa('0x11')]===_0x5bfa('0x12')&&_0x3a2e70[_0x5bfa('0x19')]){_0x539114[_0x3a2e70[_0x5bfa('0x19')]]=_0x582b82['id'];}else{logger[_0x5bfa('0x1a')](_0x5bfa('0x1b'));}}}return _0x532c57['sobject'](_0x3a2e70[_0x5bfa('0x16')])[_0x5bfa('0x1c')](_0x539114);}function getUser(_0x223fa1,_0xef0055,_0x4006e6){if(!_[_0x5bfa('0x1d')](_0xef0055)&&intUtil['validateEmail'](_0xef0055)){var _0x303c38={'Email':_0xef0055};var _0x24d68b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4006e6[_0x5bfa('0x1e')](_0x5bfa('0x1f'))[_0x5bfa('0x20')](_0x303c38,_0x24d68b)[_0x5bfa('0x21')]()['then'](function(_0x3d740d){if(_0x3d740d[_0x5bfa('0x22')]){var _0x5a5de7=_[_0x5bfa('0x20')](_0x3d740d,function(_0x3111f5){return _0x3111f5[_0x5bfa('0x23')]===_0xef0055;});if(_0x5a5de7){logger[_0x5bfa('0x1a')]('Agent\x20%s\x20found.',_0xef0055);return BPromise[_0x5bfa('0x24')]({'id':_0x5a5de7['Id'],'name':_0x5a5de7[_0x5bfa('0x25')]});}}else{logger[_0x5bfa('0x1a')](_0x5bfa('0x26'),_0xef0055);return _0x4006e6[_0x5bfa('0x27')]()[_0x5bfa('0x28')](function(_0x1a0fae){return BPromise[_0x5bfa('0x24')]({'id':_0x1a0fae['user_id'],'name':_0x1a0fae[_0x5bfa('0x29')]});});}});}else{logger[_0x5bfa('0x1a')](_0x5bfa('0x26'),_0xef0055);return _0x4006e6[_0x5bfa('0x27')]()[_0x5bfa('0x28')](function(_0x9b3cbd){return BPromise[_0x5bfa('0x24')]({'id':_0x9b3cbd[_0x5bfa('0x2a')],'name':_0x9b3cbd['display_name']});});}}function getEndUser(_0x2fb919,_0x13f103,_0x49590a,_0x4d83df,_0x5ab21a){var _0xfd359d={'$or':{'Phone':_0x4d83df}};var _0x47002e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5bfa('0x24')]()[_0x5bfa('0x28')](function(){logger[_0x5bfa('0x1a')](_0x5bfa('0x2b'),_0x4d83df,_0x13f103[_0x5bfa('0x2c')]);switch(_0x13f103[_0x5bfa('0x2c')]){case _0x5bfa('0x2d'):var _0x34f096=_[_0x5bfa('0x2e')](_0xfd359d);if(_0x13f103[_0x5bfa('0x2f')]){var _0x402560={};_0x402560[_0x13f103[_0x5bfa('0x2f')]]=_0x4d83df;_[_0x5bfa('0x30')](_0x34f096[_0x5bfa('0x31')],_0x402560);}return _0x5ab21a['sobject'](_0x5bfa('0x32'))[_0x5bfa('0x20')](_0x34f096,_0x47002e)[_0x5bfa('0x21')]()[_0x5bfa('0x28')](function(_0x5bb0f1){if(_0x5bb0f1&&_0x5bb0f1[_0x5bfa('0x22')]){return _0x5bb0f1;}else{var _0x450fc5=_[_0x5bfa('0x2e')](_0xfd359d);if(_0x13f103[_0x5bfa('0x33')]){var _0x4dc116={};_0x4dc116[_0x13f103['additionalSearchLead']]=_0x4d83df;_[_0x5bfa('0x30')](_0x450fc5[_0x5bfa('0x31')],_0x4dc116);}return _0x5ab21a[_0x5bfa('0x1e')]('Lead')['find'](_0x450fc5,_0x47002e);}});case _0x5bfa('0x34'):var _0x319abf=_[_0x5bfa('0x2e')](_0xfd359d);if(_0x13f103['additionalSearchAccount']){var _0x402560={};_0x402560[_0x13f103[_0x5bfa('0x35')]]=_0x4d83df;_[_0x5bfa('0x30')](_0x319abf[_0x5bfa('0x31')],_0x402560);}return _0x5ab21a[_0x5bfa('0x1e')]('Account')[_0x5bfa('0x20')](_0x319abf,_0x47002e)[_0x5bfa('0x21')]()[_0x5bfa('0x28')](function(_0x2c1d6f){if(_0x2c1d6f&&_0x2c1d6f[_0x5bfa('0x22')]){return _0x2c1d6f;}else{var _0x1f26b1=_['cloneDeep'](_0xfd359d);if(_0x13f103['additionalSearchContact']){var _0x4455e5={};_0x4455e5[_0x13f103[_0x5bfa('0x2f')]]=_0x4d83df;_[_0x5bfa('0x30')](_0x1f26b1[_0x5bfa('0x31')],_0x4455e5);}return _0x5ab21a[_0x5bfa('0x1e')](_0x5bfa('0x32'))[_0x5bfa('0x20')](_0x1f26b1,_0x47002e)[_0x5bfa('0x28')](function(_0x83ed57){if(_0x83ed57&&_0x83ed57['length']){return _0x83ed57;}else{var _0x589f85=_[_0x5bfa('0x2e')](_0xfd359d);if(_0x13f103[_0x5bfa('0x33')]){var _0x5f184a={};_0x5f184a[_0x13f103[_0x5bfa('0x33')]]=_0x4d83df;_[_0x5bfa('0x30')](_0x589f85[_0x5bfa('0x31')],_0x5f184a);}return _0x5ab21a[_0x5bfa('0x1e')](_0x5bfa('0x36'))[_0x5bfa('0x20')](_0x589f85,_0x47002e);}});}});case _0x5bfa('0x10'):var _0x34f096=_[_0x5bfa('0x2e')](_0xfd359d);if(_0x13f103[_0x5bfa('0x2f')]){var _0x402560={};_0x402560[_0x13f103[_0x5bfa('0x2f')]]=_0x4d83df;_[_0x5bfa('0x30')](_0x34f096['$or'],_0x402560);}return _0x5ab21a['sobject'](_0x5bfa('0x32'))[_0x5bfa('0x20')](_0x34f096,_0x47002e)[_0x5bfa('0x21')]();case'lead':var _0x29eedb=_[_0x5bfa('0x2e')](_0xfd359d);if(_0x13f103['additionalSearchLead']){var _0x402560={};_0x402560[_0x13f103[_0x5bfa('0x33')]]=_0x4d83df;_['merge'](_0x29eedb[_0x5bfa('0x31')],_0x402560);}return _0x5ab21a[_0x5bfa('0x1e')](_0x5bfa('0x36'))[_0x5bfa('0x20')](_0x29eedb,_0x47002e);case _0x5bfa('0x14'):var _0x319abf=_[_0x5bfa('0x2e')](_0xfd359d);if(_0x13f103[_0x5bfa('0x35')]){var _0x402560={};_0x402560[_0x13f103[_0x5bfa('0x35')]]=_0x4d83df;_[_0x5bfa('0x30')](_0x319abf[_0x5bfa('0x31')],_0x402560);}return _0x5ab21a[_0x5bfa('0x1e')]('Account')[_0x5bfa('0x20')](_0x319abf,_0x47002e);default:return null;}})[_0x5bfa('0x28')](function(_0x5f39ca){if(_0x5f39ca&&_0x5f39ca[_0x5bfa('0x22')]){var _0x3cc99d=_[_0x5bfa('0x37')](_0x5f39ca);if(_0x3cc99d){return BPromise['resolve']({'id':_0x3cc99d['Id'],'name':_0x3cc99d[_0x5bfa('0x25')],'phone':_0x3cc99d['Phone'],'endUserType':_0x3cc99d['attributes'][_0x5bfa('0x38')]['toLowerCase']()});}}})[_0x5bfa('0x28')](function(_0x457f9b){if(_0x457f9b){logger['info'](_0x5bfa('0x39'),_0x457f9b['endUserType'],_0x4d83df);return BPromise[_0x5bfa('0x24')](_0x457f9b);}else{logger['info'](_0x5bfa('0x3a'),_0x4d83df);var _0x56145f={'Phone':_0x4d83df};if(_0x13f103[_0x5bfa('0x3b')]){if(_0x13f103['moduleCreate']==='contact'){logger[_0x5bfa('0x1a')](_0x5bfa('0x3c'),_0x4d83df,_0x13f103[_0x5bfa('0x3b')]);_0x56145f['LastName']=_0x49590a!==_0x5bfa('0x3d')?_0x49590a:util[_0x5bfa('0x3e')]('Caller\x20-\x20%s',_0x4d83df);}else if(_0x13f103[_0x5bfa('0x3b')]===_0x5bfa('0x12')){logger['info'](_0x5bfa('0x3c'),_0x4d83df,_0x13f103['moduleCreate']);_0x56145f[_0x5bfa('0x3f')]=_0x49590a!==''?_0x49590a:util[_0x5bfa('0x3e')](_0x5bfa('0x40'),_0x4d83df);_0x56145f[_0x5bfa('0x41')]='No\x20Company';}else if(_0x13f103[_0x5bfa('0x3b')]==='account'){logger[_0x5bfa('0x1a')](_0x5bfa('0x3c'),_0x4d83df,_0x13f103['moduleCreate']);_0x56145f[_0x5bfa('0x25')]=_0x49590a!==''?_0x49590a:util[_0x5bfa('0x3e')]('Caller\x20-\x20%s',_0x4d83df);}else{return null;}}return _0x5ab21a['sobject'](_[_0x5bfa('0x42')](_0x13f103['moduleCreate']))[_0x5bfa('0x1c')](_0x56145f)[_0x5bfa('0x28')](function(_0x5ed43c){return BPromise[_0x5bfa('0x24')]({'id':_0x5ed43c['id'],'endUserType':_0x13f103[_0x5bfa('0x3b')]});});}});}function getCustomFields(_0x34bbd7,_0x4c17fc){var _0x271bf2={};if(_0x34bbd7['length']>0x0){_['forEach'](_0x34bbd7,function(_0x149b38){if(_[_0x5bfa('0x43')]([_0x5bfa('0x44'),_0x5bfa('0x45')],_0x149b38[_0x5bfa('0x38')])&&_0x149b38[_0x5bfa('0x46')]){_0x271bf2[_0x149b38[_0x5bfa('0x46')]]=_0x149b38[_0x5bfa('0x47')][_0x5bfa('0x48')]();}else if(_0x149b38['type']===_0x5bfa('0x49')&&_0x149b38[_0x5bfa('0x4a')]&&_0x149b38[_0x5bfa('0x46')]){_0x4c17fc[_0x149b38[_0x5bfa('0x4a')]]&&(_0x271bf2[_0x149b38[_0x5bfa('0x46')]]=_0x4c17fc[_0x149b38[_0x5bfa('0x4a')]][_0x5bfa('0x48')]());}else if(_0x149b38['type']===_0x5bfa('0x4b')&&_0x149b38[_0x5bfa('0x4c')]&&_0x149b38[_0x5bfa('0x4c')][_0x5bfa('0x4d')]&&_0x149b38[_0x5bfa('0x46')]){_0x4c17fc[_0x149b38[_0x5bfa('0x4c')][_0x5bfa('0x4d')][_0x5bfa('0x4e')]()]&&(_0x271bf2[_0x149b38[_0x5bfa('0x46')]]=_0x4c17fc[_0x149b38[_0x5bfa('0x4c')][_0x5bfa('0x4d')][_0x5bfa('0x4e')]()]['toString']());}});}return _0x271bf2;}function getConnection(_0x16ea30){var _0xa19f69=_0x16ea30[_0x5bfa('0x4f')][_0x5bfa('0x50')](_0x16ea30[_0x5bfa('0x51')]);var _0x4da5c3=new jsforce[(_0x5bfa('0x52'))]({'oauth2':{'loginUrl':_0x16ea30[_0x5bfa('0x53')]||_0x5bfa('0x54'),'clientId':_0x16ea30[_0x5bfa('0x55')],'clientSecret':_0x16ea30[_0x5bfa('0x56')]}});return _0x4da5c3[_0x5bfa('0x57')](_0x16ea30[_0x5bfa('0x58')],_0xa19f69)[_0x5bfa('0x28')](function(){logger[_0x5bfa('0x1a')](_0x5bfa('0x59'));return _0x4da5c3;});}exports[_0x5bfa('0x5a')]=function(_0x4870e9,_0x3a3c2d,_0x19fd1a,_0x1e5c16,_0x25fa49,_0x2f001b){var _0x148a7c,_0x11d394,_0x5f5b5c,_0x15c8bc;_0x2f001b['serverUrl']=intUtil[_0x5bfa('0x5b')](_0x2f001b['serverUrl']);_0x2f001b['remoteUri']=intUtil[_0x5bfa('0x5b')](_0x2f001b['remoteUri']);if(_0x25fa49&&_0x25fa49[_0x5bfa('0x5c')]){logger[_0x5bfa('0x1a')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3a3c2d[_0x5bfa('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f001b[_0x5bfa('0x5e')],_0x3a3c2d[_0x5bfa('0x5f')],md5(_0x3a3c2d['uniqueid']));}else{_0x3a3c2d[_0x5bfa('0x5d')]='';}return getConnection(_0x2f001b)[_0x5bfa('0x28')](function(_0x58644b){_0x15c8bc=_0x58644b;return getUser(_0x2f001b,_0x1e5c16['email'],_0x15c8bc);})[_0x5bfa('0x28')](function(_0x20d3da){_0x148a7c=_0x20d3da;return getEndUser(_0x2f001b,_0x19fd1a,_0x3a3c2d[_0x5bfa('0x60')],_0x3a3c2d[_0x5bfa('0x61')],_0x15c8bc);})[_0x5bfa('0x28')](function(_0x5b77db){_0x11d394=_0x5b77db;return getTicket(_0x2f001b,_0x148a7c,_0x11d394,_0x19fd1a,_0x3a3c2d,_0x19fd1a[_0x5bfa('0x62')],_0x15c8bc,_0x5bfa('0x5a'));})[_0x5bfa('0x28')](function(_0x5e1916){_0x5f5b5c=_0x5e1916;logger[_0x5bfa('0x1a')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x5f5b5c['id']);logger[_0x5bfa('0x1a')](_0x5bfa('0x63'),_0x5f5b5c['id'],_0x1e5c16['name'],_0x2f001b[_0x5bfa('0x38')]);switch(_0x2f001b[_0x5bfa('0x38')]){case _0x5bfa('0x64'):emit(util[_0x5bfa('0x3e')](_0x5bfa('0x65'),_0x1e5c16[_0x5bfa('0x4d')]),_0x5bfa('0x66'),{'recordId':_0x5f5b5c['id']});break;case _0x5bfa('0x67'):emit(util[_0x5bfa('0x3e')](_0x5bfa('0x65'),_0x1e5c16[_0x5bfa('0x4d')]),_0x5bfa('0x68'),{'uri':util['format'](_0x5bfa('0x69'),_0x15c8bc[_0x5bfa('0x6a')],_0x5f5b5c['id'])});break;default:logger[_0x5bfa('0x6b')](_0x5bfa('0x6c'));}})[_0x5bfa('0x6d')](function(_0xa00252){logger[_0x5bfa('0x6b')](_0x5bfa('0x6e'),_0xa00252);});};exports[_0x5bfa('0x6f')]=function(_0x1f021e,_0x53bafe,_0x917e93,_0x713077,_0xf3c368,_0x3da6d4,_0x4a7131){var _0x1e6b7d,_0x4988ab,_0xb822b9,_0x145d09;_0x3da6d4['serverUrl']=intUtil[_0x5bfa('0x5b')](_0x3da6d4[_0x5bfa('0x5e')]);_0x3da6d4[_0x5bfa('0x53')]=intUtil[_0x5bfa('0x5b')](_0x3da6d4['remoteUri']);if(_0x4a7131&&_0x4a7131[_0x5bfa('0x70')]&&_0x4a7131[_0x5bfa('0x70')]!==_0x5bfa('0x71')){logger[_0x5bfa('0x1a')](_0x5bfa('0x72'),_0x5bfa('0x73'));_0x53bafe[_0x5bfa('0x5d')]=util[_0x5bfa('0x3e')](_0x5bfa('0x74'),_0x3da6d4[_0x5bfa('0x5e')],_0x53bafe['uniqueid'],md5(_0x53bafe[_0x5bfa('0x5f')]));}return getConnection(_0x3da6d4)['then'](function(_0x239a8f){_0x145d09=_0x239a8f;return getUser(_0x3da6d4,_0x713077['email'],_0x145d09);})[_0x5bfa('0x28')](function(_0x1839e5){_0x1e6b7d=_0x1839e5;return getEndUser(_0x3da6d4,_0x917e93,_0x53bafe[_0x5bfa('0x75')],_0x53bafe[_0x5bfa('0x76')],_0x145d09);})[_0x5bfa('0x28')](function(_0x457a4e){_0x4988ab=_0x457a4e;return getTicket(_0x3da6d4,_0x1e6b7d,_0x4988ab,_0x917e93,_0x53bafe,_0x917e93['Fields'],_0x145d09,_0x5bfa('0x6f'));})[_0x5bfa('0x28')](function(_0x49b215){_0xb822b9=_0x49b215;logger[_0x5bfa('0x1a')](_0x5bfa('0x77'),_0xb822b9['id']);logger['info'](_0x5bfa('0x78'),_0xb822b9['id'],_0x713077[_0x5bfa('0x4d')],_0x3da6d4[_0x5bfa('0x38')]);switch(_0x3da6d4[_0x5bfa('0x38')]){case _0x5bfa('0x64'):emit(util[_0x5bfa('0x3e')](_0x5bfa('0x65'),_0x713077['name']),_0x5bfa('0x66'),{'recordId':_0xb822b9['id']});break;case _0x5bfa('0x67'):emit(util['format'](_0x5bfa('0x65'),_0x713077[_0x5bfa('0x4d')]),_0x5bfa('0x68'),{'uri':util[_0x5bfa('0x3e')](_0x5bfa('0x69'),_0x145d09[_0x5bfa('0x6a')],_0xb822b9['id'])});break;default:logger[_0x5bfa('0x6b')](_0x5bfa('0x72'),_0x5bfa('0x79'));}})[_0x5bfa('0x6d')](function(_0x466160){logger[_0x5bfa('0x6b')](_0x5bfa('0x72'),_0x466160);});};exports['unmanaged']=function(_0x4cb211,_0x1208e4,_0x1bc794,_0x22bc1,_0x4cf9ac,_0x5613e7){var _0x5e6d38,_0x2cae83,_0x4cb209,_0x1bceec;_0x5613e7['serverUrl']=intUtil[_0x5bfa('0x5b')](_0x5613e7['serverUrl']);_0x5613e7[_0x5bfa('0x53')]=intUtil[_0x5bfa('0x5b')](_0x5613e7[_0x5bfa('0x53')]);if(_0x4cf9ac&&_0x4cf9ac['monitor_format']){logger[_0x5bfa('0x1a')]('['+_0x1208e4[_0x5bfa('0x7a')]['toUpperCase']()+']',_0x5bfa('0x73'));_0x1208e4['recordingURL']=util[_0x5bfa('0x3e')](_0x5bfa('0x74'),_0x5613e7['serverUrl'],_0x1208e4[_0x5bfa('0x5f')],md5(_0x1208e4['uniqueid']));}else{_0x1208e4[_0x5bfa('0x5d')]='';}return getConnection(_0x5613e7)['then'](function(_0x2a0590){_0x1bceec=_0x2a0590;if(!_[_0x5bfa('0x1d')](_0x22bc1)){return getUser(_0x5613e7,_0x22bc1[_0x5bfa('0x4d')],_0x1bceec);}else{return getUser(_0x5613e7,null,_0x1bceec);}})[_0x5bfa('0x28')](function(_0x1260f1){_0x5e6d38=_0x1260f1;return getEndUser(_0x5613e7,_0x1bc794,_0x1208e4[_0x5bfa('0x60')],_0x1208e4['calleridnum'],_0x1bceec);})[_0x5bfa('0x28')](function(_0x60739e){_0x2cae83=_0x60739e;return getTicket(_0x5613e7,_0x5e6d38,_0x2cae83,_0x1bc794,_0x1208e4,_0x1bc794[_0x5bfa('0x62')],_0x1bceec);})['then'](function(_0x5dad48){_0x4cb209=_0x5dad48;logger[_0x5bfa('0x1a')]('['+_0x1208e4[_0x5bfa('0x7a')]['toUpperCase']()+_0x5bfa('0x7b'),_0x4cb209['id']);logger[_0x5bfa('0x1a')]('['+_0x1208e4[_0x5bfa('0x7a')][_0x5bfa('0x7c')]()+_0x5bfa('0x7d'),_0x5613e7[_0x5bfa('0x38')]);})[_0x5bfa('0x6d')](function(_0x5b1421){logger['error']('['+_0x1208e4['lastevent'][_0x5bfa('0x7c')]()+']',_0x5b1421);});}; \ 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 4af9b82..624b61c 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 _0x7fcd=['./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','then','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','customField','nameField','toLowerCase','content','string','picklist','idField','variable','variableName','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','POST','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis'];(function(_0x5f50eb,_0x3e7d18){var _0xb912b6=function(_0x19d99d){while(--_0x19d99d){_0x5f50eb['push'](_0x5f50eb['shift']());}};_0xb912b6(++_0x3e7d18);}(_0x7fcd,0x1cf));var _0xd7fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7fcd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7fc('0x0'));var Promise=require('bluebird');var rp=require(_0xd7fc('0x1'));var util=require(_0xd7fc('0x2'));var md5=require(_0xd7fc('0x3'));var Redis=require(_0xd7fc('0x4'));var intUtil=require(_0xd7fc('0x5'));var config=require(_0xd7fc('0x6'));var logger=require('../../../../config/logger')(_0xd7fc('0x7'));config[_0xd7fc('0x8')]=_[_0xd7fc('0x9')](config[_0xd7fc('0x8')],{'host':_0xd7fc('0xa'),'port':0x18eb});var io=require(_0xd7fc('0xb'))(new Redis(config[_0xd7fc('0x8')]));function getAdminUser(_0x4dc742,_0x14ecd4,_0x3c561f,_0x294bf3,_0x17d994,_0x2099b4){return new Promise(function(_0x2b86c3,_0x192d01){var _0x1d76f6={'method':_0xd7fc('0xc'),'uri':_0x294bf3+_0xd7fc('0xd')+'&'+_0x17d994+'&'+_0x2099b4,'auth':_0x14ecd4,'json':!![]};return rp(_0x1d76f6)['then'](function(_0x4e95a9){if(_0x4e95a9[_0xd7fc('0xe')]['length']>0x0){_0x3c561f[_0xd7fc('0xf')]=_0x4e95a9[_0xd7fc('0xe')][0x0][_0xd7fc('0x10')];}logger['info']('['+[_0x4dc742[_0xd7fc('0x11')]()]+_0xd7fc('0x12'),_0x3c561f);_0x2b86c3(_0x3c561f);})[_0xd7fc('0x13')](function(_0x998ab9){logger[_0xd7fc('0x14')]('['+[_0x4dc742[_0xd7fc('0x11')]()]+']',_0x998ab9[_0xd7fc('0x15')]);_0x192d01(_0x998ab9['message']);});});}function getUser(_0x30831e,_0x2a7ea0,_0x3b2527,_0x4f367b,_0x489d91){return function(_0x21391b){logger[_0xd7fc('0x16')]('['+[_0x30831e['toUpperCase']()]+_0xd7fc('0x17'),_0x21391b);return new Promise(function(_0x238fe6,_0x536d34){if(intUtil[_0xd7fc('0x18')](_0x21391b[_0xd7fc('0x19')])){var _0x149b5b={'method':_0xd7fc('0xc'),'uri':_0x3b2527+_0xd7fc('0x1a')+_0x21391b[_0xd7fc('0x19')]+'&'+_0x4f367b+'&'+_0x489d91,'auth':_0x2a7ea0,'json':!![]};logger[_0xd7fc('0x16')]('['+[_0x30831e['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x149b5b);return rp(_0x149b5b)[_0xd7fc('0x1b')](function(_0x24bcaa){logger['info']('['+[_0x30831e[_0xd7fc('0x11')]()]+'],\x20getUser\x20entity',_0x24bcaa);if(_0x24bcaa[_0xd7fc('0xe')][_0xd7fc('0x1c')]>0x0&&String(_0x24bcaa[_0xd7fc('0xe')][0x0]['active'])===_0xd7fc('0x1d')){_0x21391b[_0xd7fc('0x1e')]=_0x24bcaa[_0xd7fc('0xe')][0x0]['sys_id'];}else{_0x21391b['userId']=_0x21391b[_0xd7fc('0xf')];_0x21391b[_0xd7fc('0x19')]=_0x21391b[_0xd7fc('0x1f')];}logger[_0xd7fc('0x16')]('['+[_0x30831e['toUpperCase']()]+_0xd7fc('0x20'),_0x21391b);_0x238fe6(_0x21391b);})[_0xd7fc('0x13')](function(_0x1811bc){logger[_0xd7fc('0x14')]('['+[_0x30831e[_0xd7fc('0x11')]()]+']',_0x1811bc['message']);_0x536d34(_0x1811bc['message']);});}else{logger['info']('['+[_0x30831e['toUpperCase']()]+_0xd7fc('0x21'));_0x21391b[_0xd7fc('0x1e')]=_0x21391b[_0xd7fc('0xf')];_0x21391b[_0xd7fc('0x19')]=_0x21391b[_0xd7fc('0x1f')];_0x238fe6(_0x21391b);}});};}function createEndUser(_0x216647,_0x55f9ed,_0x46afb1,_0x1d3a8b,_0x2398ce){logger[_0xd7fc('0x16')]('['+[_0x216647['toUpperCase']()]+_0xd7fc('0x22'),_0x46afb1);return new Promise(function(_0x8a521b,_0x478129){var _0x181d13={'method':'POST','uri':_0x1d3a8b+_0xd7fc('0x23')+_0x2398ce,'body':{'user_name':_0x46afb1[_0xd7fc('0x24')],'roles':_0xd7fc('0x25'),'first_name':_0x46afb1[_0xd7fc('0x24')],'active':_0xd7fc('0x1d'),'date_format':_0xd7fc('0x26'),'phone':_0x46afb1[_0xd7fc('0x24')]},'auth':_0x55f9ed,'json':!![]};return rp(_0x181d13)['then'](function(_0x20225c){logger[_0xd7fc('0x16')]('['+[_0x216647[_0xd7fc('0x11')]()]+_0xd7fc('0x27'),_0x20225c['result']);_0x46afb1[_0xd7fc('0x28')]=_0x20225c[_0xd7fc('0xe')][_0xd7fc('0x10')];_0x8a521b(_0x46afb1);})[_0xd7fc('0x13')](function(_0x165264){logger['error']('['+[_0x216647['toUpperCase']()]+']',_0x165264['message']);_0x478129(_0x165264[_0xd7fc('0x15')]);});});}function getEndUser(_0x9e7f16,_0x234bbd,_0xc417e3,_0x47817e,_0x18a039){return function(_0x3daef8){logger['info']('['+[_0x9e7f16[_0xd7fc('0x11')]()]+_0xd7fc('0x29'),_0x3daef8);return new Promise(function(_0x19cf6b,_0x90ca8e){var _0x573181={'method':_0xd7fc('0xc'),'uri':_0xc417e3+_0xd7fc('0x2a')+_0x3daef8[_0xd7fc('0x24')]+'&'+_0x47817e+'&'+_0x18a039,'auth':_0x234bbd,'json':!![]};return rp(_0x573181)['then'](function(_0x274ef1){if(_0x274ef1[_0xd7fc('0xe')][_0xd7fc('0x1c')]>0x0){_0x3daef8[_0xd7fc('0x28')]=_0x274ef1[_0xd7fc('0xe')][0x0][_0xd7fc('0x10')];logger['info']('['+[_0x9e7f16[_0xd7fc('0x11')]()]+_0xd7fc('0x2b'),_0x3daef8);_0x19cf6b(_0x3daef8);}else{return createEndUser(_0x9e7f16,_0x234bbd,_0x3daef8,_0xc417e3,_0x47817e)[_0xd7fc('0x1b')](function(_0x3c877f){logger[_0xd7fc('0x16')]('['+[_0x9e7f16['toUpperCase']()]+_0xd7fc('0x2c'),_0x3c877f);_0x19cf6b(_0x3c877f);});}})[_0xd7fc('0x13')](function(_0x22fc63){logger[_0xd7fc('0x14')]('['+[_0x9e7f16[_0xd7fc('0x11')]()]+']',_0x22fc63[_0xd7fc('0x15')]);_0x90ca8e(_0x22fc63[_0xd7fc('0x15')]);});});};}function getCustomFields(_0x11aa6e,_0x4c961d){var _0x281f2f={};if(_0x11aa6e[_0xd7fc('0x1c')]>0x0){_[_0xd7fc('0x2d')](_0x11aa6e,function(_0x5768c9){if(_['includes'](['string','picklist'],_0x5768c9[_0xd7fc('0x2e')])&&_0x5768c9['nameField']&&!_0x5768c9[_0xd7fc('0x2f')]){_0x281f2f[_0x5768c9[_0xd7fc('0x30')][_0xd7fc('0x31')]()]=_0x5768c9[_0xd7fc('0x32')]['toString']();}else if(_['includes']([_0xd7fc('0x33'),_0xd7fc('0x34')],_0x5768c9['type'])&&_0x5768c9[_0xd7fc('0x35')]&&_0x5768c9[_0xd7fc('0x2f')]){_0x281f2f[_0x5768c9['idField'][_0xd7fc('0x31')]()]=_0x5768c9[_0xd7fc('0x32')]['toString']();}else if(_0x5768c9['type']===_0xd7fc('0x36')&&_0x5768c9[_0xd7fc('0x37')]&&_0x5768c9['idField']&&_0x5768c9[_0xd7fc('0x2f')]){_0x281f2f[_0x5768c9[_0xd7fc('0x35')][_0xd7fc('0x31')]()]=_0x4c961d[_0x5768c9['variableName']][_0xd7fc('0x38')]();}else if(_0x5768c9[_0xd7fc('0x2e')]===_0xd7fc('0x39')&&_0x5768c9[_0xd7fc('0x3a')]&&_0x5768c9['Variable'][_0xd7fc('0x3b')]&&_0x5768c9[_0xd7fc('0x35')]&&_0x5768c9[_0xd7fc('0x2f')]){_0x281f2f[_0x5768c9[_0xd7fc('0x35')][_0xd7fc('0x31')]()]=_0x4c961d[_0x5768c9[_0xd7fc('0x3a')][_0xd7fc('0x3b')][_0xd7fc('0x31')]()][_0xd7fc('0x38')]();}});}return _0x281f2f;}function getTicket(_0x4e63c5,_0x325118,_0x47c790,_0x522172,_0xd696f0,_0x55ae5c){return function(_0x3a2a0c){logger[_0xd7fc('0x16')]('['+[_0x4e63c5[_0xd7fc('0x11')]()]+_0xd7fc('0x3c'),_0x3a2a0c);return new Promise(function(_0x2089a1,_0x4a5bef){var _0x1961cd=_0x4e63c5['toLowerCase']()===_0xd7fc('0x3d')?_0x3a2a0c[_0xd7fc('0x1e')]:_0x3a2a0c[_0xd7fc('0x28')];var _0xb29c26={'method':'POST','uri':_0x47c790+_0xd7fc('0x3e')+'?'+_0x55ae5c,'body':Object[_0xd7fc('0x3f')]({},{'active':_0xd7fc('0x1d'),'caller_id':_0x1961cd,'assigned_to':_0x3a2a0c[_0xd7fc('0x1e')],'short_description':intUtil[_0xd7fc('0x40')](_0x522172[_0xd7fc('0x41')],_0xd696f0,'\x20'),'description':intUtil[_0xd7fc('0x40')](_0x522172[_0xd7fc('0x42')],_0xd696f0,'\x0a')},getCustomFields(_0x522172[_0xd7fc('0x43')],_0xd696f0)),'auth':_0x325118,'json':!![]};return rp(_0xb29c26)[_0xd7fc('0x1b')](function(_0x10e81d){logger['info']('['+[_0x4e63c5[_0xd7fc('0x11')]()]+_0xd7fc('0x44'),_0x10e81d[_0xd7fc('0xe')]);_0x3a2a0c[_0xd7fc('0x45')]=_0x10e81d[_0xd7fc('0xe')][_0xd7fc('0x10')];_0x3a2a0c[_0xd7fc('0x46')]=_0x10e81d['result'][_0xd7fc('0x47')];logger[_0xd7fc('0x16')]('['+[_0x4e63c5[_0xd7fc('0x11')]()]+_0xd7fc('0x48'),_0x3a2a0c);_0x2089a1(_0x3a2a0c);})[_0xd7fc('0x13')](function(_0xa5fdfa){logger['error']('['+[_0x4e63c5['toUpperCase']()]+']',_0xa5fdfa[_0xd7fc('0x15')]);_0x4a5bef(_0xa5fdfa[_0xd7fc('0x15')]);});});};}function createRemoteTag(_0x3b6888,_0x2e5ca8,_0x1f8fad,_0x541d9e){return new Promise(function(_0x49e4da,_0x1c3f46){var _0x58a02d={'method':'POST','uri':_0x1f8fad+_0xd7fc('0x49')+'?'+_0x541d9e,'body':{'short_description':_0x3b6888,'global':!![],'active':!![],'name':_0x3b6888},'auth':_0x2e5ca8,'json':!![]};return rp(_0x58a02d)[_0xd7fc('0x1b')](function(_0xaec5da){var _0x59c556=_0xaec5da[_0xd7fc('0xe')][_0xd7fc('0x10')];_0x49e4da(_0x59c556);});});}function getRemoteTag(_0x5060a1,_0x6d561d,_0x6f0902,_0x33d2ce,_0x9d7bed){return new Promise(function(_0x501a57,_0x52750c){var _0x36740c={'method':'GET','uri':_0x6f0902+_0xd7fc('0x49')+'?sysparm_query=name%3D'+_0x5060a1+'&'+_0x33d2ce,'auth':_0x6d561d,'json':!![]};return rp(_0x36740c)[_0xd7fc('0x1b')](function(_0x1b6149){if(_0x1b6149[_0xd7fc('0xe')][_0xd7fc('0x1c')]>0x0){var _0x204f7=_0x1b6149[_0xd7fc('0xe')][0x0][_0xd7fc('0x10')];_0x501a57(_0x204f7);}else{return createRemoteTag(_0x5060a1,_0x6d561d,_0x6f0902,_0x33d2ce)['then'](function(_0x49242e){_0x501a57(_0x49242e);});}});});}function assignTagToIncident(_0x15e0d5,_0x5002ae,_0x161fee,_0x2eb125,_0x240f48){return new Promise(function(_0x46a158,_0x230ed5){var _0x52415f={'method':_0xd7fc('0x4a'),'uri':_0x161fee+_0xd7fc('0x4b')+'?'+_0x240f48,'body':{'label':_0x15e0d5,'table':'incident','id_type':_0xd7fc('0x4c'),'table_key':_0x2eb125[_0xd7fc('0x45')],'title':_0xd7fc('0x4d')+_0x2eb125[_0xd7fc('0x46')],'id_display':_0x2eb125[_0xd7fc('0x46')]},'auth':_0x5002ae,'json':!![]};return rp(_0x52415f)[_0xd7fc('0x1b')](function(_0x39b189){_0x46a158();})[_0xd7fc('0x13')](function(){_0x46a158();});});}function manageTags(_0x6e91fd,_0x35eec0,_0x1c2c7c,_0x234a57,_0x5e881d,_0x42326c,_0x30ab20){return new Promise(function(_0x4fac6d,_0x536125){var _0x5ece95=[];_0x35eec0['forEach'](function(_0x5e5603){_0x5ece95[_0xd7fc('0x4e')](getRemoteTag(_0x5e5603,_0x1c2c7c,_0x234a57,_0x42326c,_0x30ab20));});return Promise[_0xd7fc('0x4f')](_0x5ece95)['then'](function(_0x41f828){if(_0x41f828['length']){logger['info']('['+[_0x6e91fd[_0xd7fc('0x11')]()]+_0xd7fc('0x50'),_0x41f828);var _0x2a1fc4=[];_0x41f828[_0xd7fc('0x2d')](function(_0x307d83){_0x2a1fc4[_0xd7fc('0x4e')](assignTagToIncident(_0x307d83,_0x1c2c7c,_0x234a57,_0x5e881d,_0x42326c));});return Promise['all'](_0x2a1fc4)[_0xd7fc('0x1b')](function(){_0x4fac6d();})[_0xd7fc('0x13')](function(){_0x4fac6d();});}else{_0x4fac6d();}});});}function getTags(_0x1b2272,_0x41c3d7,_0x5abaff,_0x227b02,_0x353e53,_0x593fd5){return function(_0x2f9df5){return new Promise(function(_0x40c6c9,_0x59906c){var _0x4a7a65=[];var _0x37ee42=_0x227b02[_0xd7fc('0x51')];if(_0x37ee42&&_0x37ee42['length']>0x0){_0x4a7a65=_[_0xd7fc('0x52')](_0x37ee42,_0xd7fc('0x3b'));}if(_0x4a7a65[_0xd7fc('0x1c')]>0x0){return manageTags(_0x1b2272,_0x4a7a65,_0x41c3d7,_0x5abaff,_0x2f9df5,_0x353e53,_0x593fd5)['then'](function(){_0x40c6c9(_0x2f9df5);});}else{_0x40c6c9(_0x2f9df5);}});};}function emit(_0x1b1b64,_0x3dda01,_0x27552e){var _0x4f3207=_0xd7fc('0x53')+_0xd7fc('0x54')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xd7fc('0x55');var _0x2d987b={'uri':_0x1b1b64+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x27552e+_0x4f3207};io['to'](util[_0xd7fc('0x56')](_0xd7fc('0x57'),_0x3dda01))[_0xd7fc('0x58')](_0xd7fc('0x59'),_0x2d987b);}exports['cs']=function(_0x37ba9e,_0x599529,_0x348dd5,_0x29652b,_0x2a47c1,_0x306104,_0x3b3ecd,_0x3a025f){var _0x2240a6={};var _0x54d933={'user':_0x306104[_0xd7fc('0x5a')],'pass':_0x306104[_0xd7fc('0x5b')]};var _0x26a7cb=_0xd7fc('0x5c');var _0x30e921=_0xd7fc('0x5d');_0x306104['remoteUri']=intUtil[_0xd7fc('0x5e')](_0x306104[_0xd7fc('0x5f')]);_0x306104[_0xd7fc('0x60')]=intUtil['stripTrailingSlash'](_0x306104['serverUrl']);var _0x232353=util[_0xd7fc('0x56')](_0xd7fc('0x61'),_0x306104[_0xd7fc('0x5f')]);_0x2240a6[_0xd7fc('0x19')]=!_[_0xd7fc('0x62')](_0x29652b)?_0x29652b[_0xd7fc('0x63')]:null;_0x2240a6['adminEmail']=_0x306104[_0xd7fc('0x63')];_0x2240a6[_0xd7fc('0x24')]=_0x3a025f['toLowerCase']()===_0xd7fc('0x3d')?_0x599529[_0xd7fc('0x64')]:_0x599529['calleridnum'];_0x2240a6[_0xd7fc('0x65')]=_0x3a025f==='queue'||_0x3a025f===_0xd7fc('0x66')?_0xd7fc('0x67'):_0xd7fc('0x3d');var _0x5830e2=util['format'](_0xd7fc('0x68'),_0x306104[_0xd7fc('0x60')],_0x599529[_0xd7fc('0x69')],md5(_0x599529['uniqueid']));if(_0x2a47c1&&_0x2a47c1[_0xd7fc('0x6a')]){logger[_0xd7fc('0x16')](_0xd7fc('0x6b'),_0xd7fc('0x6c'));_0x599529[_0xd7fc('0x6d')]=_0x5830e2;}else if(_0x3b3ecd&&_0x3b3ecd[_0xd7fc('0x6e')]&&_0x3b3ecd['recordingFormat']!==_0xd7fc('0x6f')){logger['info'](_0xd7fc('0x70'),_0xd7fc('0x6c'));_0x599529['recordingURL']=_0x5830e2;}else{_0x599529[_0xd7fc('0x6d')]='';}return getAdminUser(_0x3a025f,_0x54d933,_0x2240a6,_0x232353,_0x30e921,_0x26a7cb)[_0xd7fc('0x1b')](getUser(_0x3a025f,_0x54d933,_0x232353,_0x30e921,_0x26a7cb))['then'](getEndUser(_0x3a025f,_0x54d933,_0x232353,_0x30e921,_0x26a7cb))[_0xd7fc('0x1b')](getTicket(_0x3a025f,_0x54d933,_0x232353,_0x348dd5,_0x599529,_0x30e921))[_0xd7fc('0x1b')](function(_0x4a1a6d){logger[_0xd7fc('0x16')](util[_0xd7fc('0x56')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4a1a6d[_0xd7fc('0x45')]));logger[_0xd7fc('0x16')](util[_0xd7fc('0x56')](_0xd7fc('0x71'),_0x3a025f));if(_0x3a025f!==_0xd7fc('0x66')){logger[_0xd7fc('0x16')]('['+[_0x3a025f[_0xd7fc('0x11')]()]+']',_0xd7fc('0x72'));emit(_0x306104[_0xd7fc('0x5f')],_0x29652b[_0xd7fc('0x3b')],_0x4a1a6d['ticketId']);}})[_0xd7fc('0x13')](function(_0xbf6afa){logger[_0xd7fc('0x14')]('['+[_0x3a025f[_0xd7fc('0x11')]()]+_0xd7fc('0x73'),util[_0xd7fc('0x74')](_0xbf6afa,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x716a=['string','type','customField','nameField','toLowerCase','content','toString','picklist','idField','variableName','customVariable','Variable','name','outbound','incident','assign','Subjects','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','Incident','Incident\x20-\x20','ticketNumber','forEach','all','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','servicenow','defaults','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','result','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','sys_id','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x716a,0xad));var _0xa716=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x716a[_0x28394f];return _0x2618d2;};'use strict';var _=require(_0xa716('0x0'));var Promise=require('bluebird');var rp=require(_0xa716('0x1'));var util=require('util');var md5=require(_0xa716('0x2'));var Redis=require(_0xa716('0x3'));var intUtil=require(_0xa716('0x4'));var config=require('../../../../config/environment');var logger=require(_0xa716('0x5'))(_0xa716('0x6'));config['redis']=_[_0xa716('0x7')](config[_0xa716('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa716('0x9'))(new Redis(config['redis']));function getAdminUser(_0x1bfae5,_0x1f3e2c,_0x109409,_0x5e50fa,_0x271ebd,_0x446b0a){return new Promise(function(_0x1fbf07,_0x148b64){var _0x5caed0={'method':_0xa716('0xa'),'uri':_0x5e50fa+_0xa716('0xb')+'&'+_0x271ebd+'&'+_0x446b0a,'auth':_0x1f3e2c,'json':!![]};return rp(_0x5caed0)['then'](function(_0x1a62cf){if(_0x1a62cf['result'][_0xa716('0xc')]>0x0){_0x109409['adminId']=_0x1a62cf[_0xa716('0xd')][0x0]['sys_id'];}logger['info']('['+[_0x1bfae5[_0xa716('0xe')]()]+'],\x20getAdminUser\x20crm',_0x109409);_0x1fbf07(_0x109409);})[_0xa716('0xf')](function(_0x5a2aad){logger[_0xa716('0x10')]('['+[_0x1bfae5[_0xa716('0xe')]()]+']',_0x5a2aad['message']);_0x148b64(_0x5a2aad[_0xa716('0x11')]);});});}function getUser(_0x51ad21,_0x291d63,_0x299c2e,_0x4fe25e,_0x4dd688){return function(_0x45db22){logger['info']('['+[_0x51ad21['toUpperCase']()]+_0xa716('0x12'),_0x45db22);return new Promise(function(_0x51755a,_0x37cc25){if(intUtil['validateEmail'](_0x45db22[_0xa716('0x13')])){var _0x4581aa={'method':_0xa716('0xa'),'uri':_0x299c2e+_0xa716('0x14')+_0x45db22[_0xa716('0x13')]+'&'+_0x4fe25e+'&'+_0x4dd688,'auth':_0x291d63,'json':!![]};logger[_0xa716('0x15')]('['+[_0x51ad21[_0xa716('0xe')]()]+_0xa716('0x16'),_0x4581aa);return rp(_0x4581aa)[_0xa716('0x17')](function(_0x34dc46){logger[_0xa716('0x15')]('['+[_0x51ad21[_0xa716('0xe')]()]+_0xa716('0x18'),_0x34dc46);if(_0x34dc46['result'][_0xa716('0xc')]>0x0&&String(_0x34dc46[_0xa716('0xd')][0x0][_0xa716('0x19')])==='true'){_0x45db22['userId']=_0x34dc46['result'][0x0][_0xa716('0x1a')];}else{_0x45db22[_0xa716('0x1b')]=_0x45db22[_0xa716('0x1c')];_0x45db22['userEmail']=_0x45db22[_0xa716('0x1d')];}logger[_0xa716('0x15')]('['+[_0x51ad21[_0xa716('0xe')]()]+_0xa716('0x1e'),_0x45db22);_0x51755a(_0x45db22);})[_0xa716('0xf')](function(_0x4693f0){logger[_0xa716('0x10')]('['+[_0x51ad21[_0xa716('0xe')]()]+']',_0x4693f0[_0xa716('0x11')]);_0x37cc25(_0x4693f0[_0xa716('0x11')]);});}else{logger['info']('['+[_0x51ad21[_0xa716('0xe')]()]+_0xa716('0x1f'));_0x45db22[_0xa716('0x1b')]=_0x45db22['adminId'];_0x45db22[_0xa716('0x13')]=_0x45db22['adminEmail'];_0x51755a(_0x45db22);}});};}function createEndUser(_0x3d875a,_0x4f56e1,_0x46686a,_0x776e87,_0x4994c7){logger[_0xa716('0x15')]('['+[_0x3d875a[_0xa716('0xe')]()]+_0xa716('0x20'),_0x46686a);return new Promise(function(_0x527593,_0xc25a5f){var _0x161582={'method':_0xa716('0x21'),'uri':_0x776e87+_0xa716('0x22')+_0x4994c7,'body':{'user_name':_0x46686a['endUserNumber'],'roles':_0xa716('0x23'),'first_name':_0x46686a[_0xa716('0x24')],'active':_0xa716('0x25'),'date_format':_0xa716('0x26'),'phone':_0x46686a['endUserNumber']},'auth':_0x4f56e1,'json':!![]};return rp(_0x161582)['then'](function(_0x5dbcd9){logger[_0xa716('0x15')]('['+[_0x3d875a['toUpperCase']()]+'],\x20EndUser\x20schema',_0x5dbcd9['result']);_0x46686a['endUserId']=_0x5dbcd9[_0xa716('0xd')][_0xa716('0x1a')];_0x527593(_0x46686a);})[_0xa716('0xf')](function(_0x2d6511){logger[_0xa716('0x10')]('['+[_0x3d875a[_0xa716('0xe')]()]+']',_0x2d6511[_0xa716('0x11')]);_0xc25a5f(_0x2d6511['message']);});});}function getEndUser(_0x125fbd,_0x1437d0,_0x50c3fb,_0x4f7b01,_0x1caf1e){return function(_0xde58bf){logger[_0xa716('0x15')]('['+[_0x125fbd[_0xa716('0xe')]()]+_0xa716('0x27'),_0xde58bf);return new Promise(function(_0x42a552,_0x12705e){var _0x1f8367={'method':_0xa716('0xa'),'uri':_0x50c3fb+_0xa716('0x28')+_0xde58bf[_0xa716('0x24')]+'&'+_0x4f7b01+'&'+_0x1caf1e,'auth':_0x1437d0,'json':!![]};return rp(_0x1f8367)[_0xa716('0x17')](function(_0x123ac7){if(_0x123ac7[_0xa716('0xd')][_0xa716('0xc')]>0x0){_0xde58bf[_0xa716('0x29')]=_0x123ac7['result'][0x0][_0xa716('0x1a')];logger[_0xa716('0x15')]('['+[_0x125fbd[_0xa716('0xe')]()]+_0xa716('0x2a'),_0xde58bf);_0x42a552(_0xde58bf);}else{return createEndUser(_0x125fbd,_0x1437d0,_0xde58bf,_0x50c3fb,_0x4f7b01)[_0xa716('0x17')](function(_0x57f8d7){logger[_0xa716('0x15')]('['+[_0x125fbd[_0xa716('0xe')]()]+_0xa716('0x2b'),_0x57f8d7);_0x42a552(_0x57f8d7);});}})['catch'](function(_0x9e69ed){logger['error']('['+[_0x125fbd[_0xa716('0xe')]()]+']',_0x9e69ed[_0xa716('0x11')]);_0x12705e(_0x9e69ed['message']);});});};}function getCustomFields(_0x4c8108,_0x3296a5){var _0x24a6d9={};if(_0x4c8108[_0xa716('0xc')]>0x0){_['forEach'](_0x4c8108,function(_0x4e992e){if(_[_0xa716('0x2c')]([_0xa716('0x2d'),'picklist'],_0x4e992e[_0xa716('0x2e')])&&_0x4e992e['nameField']&&!_0x4e992e[_0xa716('0x2f')]){_0x24a6d9[_0x4e992e[_0xa716('0x30')][_0xa716('0x31')]()]=_0x4e992e[_0xa716('0x32')][_0xa716('0x33')]();}else if(_[_0xa716('0x2c')]([_0xa716('0x2d'),_0xa716('0x34')],_0x4e992e['type'])&&_0x4e992e['idField']&&_0x4e992e[_0xa716('0x2f')]){_0x24a6d9[_0x4e992e[_0xa716('0x35')]['toLowerCase']()]=_0x4e992e[_0xa716('0x32')][_0xa716('0x33')]();}else if(_0x4e992e[_0xa716('0x2e')]==='variable'&&_0x4e992e[_0xa716('0x36')]&&_0x4e992e[_0xa716('0x35')]&&_0x4e992e['customField']){_0x24a6d9[_0x4e992e[_0xa716('0x35')][_0xa716('0x31')]()]=_0x3296a5[_0x4e992e[_0xa716('0x36')]][_0xa716('0x33')]();}else if(_0x4e992e[_0xa716('0x2e')]===_0xa716('0x37')&&_0x4e992e[_0xa716('0x38')]&&_0x4e992e['Variable'][_0xa716('0x39')]&&_0x4e992e['idField']&&_0x4e992e[_0xa716('0x2f')]){_0x24a6d9[_0x4e992e[_0xa716('0x35')][_0xa716('0x31')]()]=_0x3296a5[_0x4e992e[_0xa716('0x38')][_0xa716('0x39')][_0xa716('0x31')]()][_0xa716('0x33')]();}});}return _0x24a6d9;}function getTicket(_0x281db2,_0x734b7e,_0x2518c4,_0x191105,_0x23e55d,_0x117f34){return function(_0x256791){logger[_0xa716('0x15')]('['+[_0x281db2[_0xa716('0xe')]()]+']\x20getTicket\x20input\x20crm',_0x256791);return new Promise(function(_0x527208,_0x2206c7){var _0x203628=_0x281db2['toLowerCase']()===_0xa716('0x3a')?_0x256791[_0xa716('0x1b')]:_0x256791['endUserId'];var _0x436952={'method':_0xa716('0x21'),'uri':_0x2518c4+_0xa716('0x3b')+'?'+_0x117f34,'body':Object[_0xa716('0x3c')]({},{'active':_0xa716('0x25'),'caller_id':_0x203628,'assigned_to':_0x256791['userId'],'short_description':intUtil['getString'](_0x191105[_0xa716('0x3d')],_0x23e55d,'\x20'),'description':intUtil[_0xa716('0x3e')](_0x191105[_0xa716('0x3f')],_0x23e55d,'\x0a')},getCustomFields(_0x191105['Fields'],_0x23e55d)),'auth':_0x734b7e,'json':!![]};return rp(_0x436952)[_0xa716('0x17')](function(_0x36fc0b){logger['info']('['+[_0x281db2['toUpperCase']()]+_0xa716('0x40'),_0x36fc0b[_0xa716('0xd')]);_0x256791[_0xa716('0x41')]=_0x36fc0b[_0xa716('0xd')][_0xa716('0x1a')];_0x256791['ticketNumber']=_0x36fc0b['result']['number'];logger[_0xa716('0x15')]('['+[_0x281db2[_0xa716('0xe')]()]+_0xa716('0x42'),_0x256791);_0x527208(_0x256791);})[_0xa716('0xf')](function(_0xc8d642){logger[_0xa716('0x10')]('['+[_0x281db2['toUpperCase']()]+']',_0xc8d642[_0xa716('0x11')]);_0x2206c7(_0xc8d642[_0xa716('0x11')]);});});};}function createRemoteTag(_0xe5cc72,_0x243fcf,_0x1646b3,_0x17996e){return new Promise(function(_0x3e1c8d,_0x437e14){var _0xdb7264={'method':_0xa716('0x21'),'uri':_0x1646b3+_0xa716('0x43')+'?'+_0x17996e,'body':{'short_description':_0xe5cc72,'global':!![],'active':!![],'name':_0xe5cc72},'auth':_0x243fcf,'json':!![]};return rp(_0xdb7264)[_0xa716('0x17')](function(_0x2eeca3){var _0x317611=_0x2eeca3[_0xa716('0xd')][_0xa716('0x1a')];_0x3e1c8d(_0x317611);});});}function getRemoteTag(_0x52c2b7,_0x197fd1,_0x57a54d,_0x50bd5f,_0x4cb131){return new Promise(function(_0x304796,_0x512595){var _0x597a98={'method':_0xa716('0xa'),'uri':_0x57a54d+'label'+'?sysparm_query=name%3D'+_0x52c2b7+'&'+_0x50bd5f,'auth':_0x197fd1,'json':!![]};return rp(_0x597a98)['then'](function(_0x11c052){if(_0x11c052[_0xa716('0xd')]['length']>0x0){var _0x3ae8ca=_0x11c052[_0xa716('0xd')][0x0][_0xa716('0x1a')];_0x304796(_0x3ae8ca);}else{return createRemoteTag(_0x52c2b7,_0x197fd1,_0x57a54d,_0x50bd5f)[_0xa716('0x17')](function(_0x2ae07a){_0x304796(_0x2ae07a);});}});});}function assignTagToIncident(_0x228bc0,_0x59d440,_0x225074,_0x5b521a,_0x32cbbe){return new Promise(function(_0x363bda,_0x1b6553){var _0x5dc7dc={'method':'POST','uri':_0x225074+'label_entry'+'?'+_0x32cbbe,'body':{'label':_0x228bc0,'table':_0xa716('0x3b'),'id_type':_0xa716('0x44'),'table_key':_0x5b521a[_0xa716('0x41')],'title':_0xa716('0x45')+_0x5b521a['ticketNumber'],'id_display':_0x5b521a[_0xa716('0x46')]},'auth':_0x59d440,'json':!![]};return rp(_0x5dc7dc)[_0xa716('0x17')](function(_0x103794){_0x363bda();})[_0xa716('0xf')](function(){_0x363bda();});});}function manageTags(_0x511ee2,_0x3da13e,_0x442f9c,_0x5f4d0e,_0x2b3299,_0x2316f8,_0x2cfd19){return new Promise(function(_0x2a9888,_0xb9d417){var _0x443a29=[];_0x3da13e[_0xa716('0x47')](function(_0x50a40e){_0x443a29['push'](getRemoteTag(_0x50a40e,_0x442f9c,_0x5f4d0e,_0x2316f8,_0x2cfd19));});return Promise[_0xa716('0x48')](_0x443a29)['then'](function(_0x5ae7c3){if(_0x5ae7c3[_0xa716('0xc')]){logger[_0xa716('0x15')]('['+[_0x511ee2[_0xa716('0xe')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5ae7c3);var _0x3d75d9=[];_0x5ae7c3[_0xa716('0x47')](function(_0x1cf53f){_0x3d75d9[_0xa716('0x49')](assignTagToIncident(_0x1cf53f,_0x442f9c,_0x5f4d0e,_0x2b3299,_0x2316f8));});return Promise[_0xa716('0x48')](_0x3d75d9)[_0xa716('0x17')](function(){_0x2a9888();})['catch'](function(){_0x2a9888();});}else{_0x2a9888();}});});}function getTags(_0x5ec13a,_0x255158,_0x24d938,_0x286e32,_0x34bd76,_0x53e2de){return function(_0x53bc3b){return new Promise(function(_0x2b0dae,_0x472944){var _0x5131f3=[];var _0x5331ef=_0x286e32[_0xa716('0x4a')];if(_0x5331ef&&_0x5331ef[_0xa716('0xc')]>0x0){_0x5131f3=_[_0xa716('0x4b')](_0x5331ef,'name');}if(_0x5131f3['length']>0x0){return manageTags(_0x5ec13a,_0x5131f3,_0x255158,_0x24d938,_0x53bc3b,_0x34bd76,_0x53e2de)[_0xa716('0x17')](function(){_0x2b0dae(_0x53bc3b);});}else{_0x2b0dae(_0x53bc3b);}});};}function emit(_0x1bf440,_0xd42973,_0x10fb69){var _0x40e6a3=_0xa716('0x4c')+_0xa716('0x4d')+_0xa716('0x4e')+_0xa716('0x4f');var _0x4e88c7={'uri':_0x1bf440+_0xa716('0x50')+_0x10fb69+_0x40e6a3};io['to'](util[_0xa716('0x51')](_0xa716('0x52'),_0xd42973))[_0xa716('0x53')]('trigger:browser:url',_0x4e88c7);}exports['cs']=function(_0x2212a4,_0x5268cf,_0x5572e0,_0x3ba552,_0xea2415,_0x4b7054,_0x311baa,_0x2ac708){var _0x31e047={};var _0x25f8d3={'user':_0x4b7054[_0xa716('0x54')],'pass':_0x4b7054[_0xa716('0x55')]};var _0x967bdd=_0xa716('0x56');var _0x14db83=_0xa716('0x57');_0x4b7054[_0xa716('0x58')]=intUtil[_0xa716('0x59')](_0x4b7054[_0xa716('0x58')]);_0x4b7054[_0xa716('0x5a')]=intUtil[_0xa716('0x59')](_0x4b7054[_0xa716('0x5a')]);var _0x3f83a9=util[_0xa716('0x51')]('%s/api/now/table/',_0x4b7054[_0xa716('0x58')]);_0x31e047['userEmail']=!_[_0xa716('0x5b')](_0x3ba552)?_0x3ba552[_0xa716('0x5c')]:null;_0x31e047[_0xa716('0x1d')]=_0x4b7054[_0xa716('0x5c')];_0x31e047[_0xa716('0x24')]=_0x2ac708[_0xa716('0x31')]()==='outbound'?_0x5268cf[_0xa716('0x5d')]:_0x5268cf[_0xa716('0x5e')];_0x31e047[_0xa716('0x5f')]=_0x2ac708===_0xa716('0x60')||_0x2ac708===_0xa716('0x61')?_0xa716('0x60'):'outbound';var _0x3f0b32=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b7054[_0xa716('0x5a')],_0x5268cf[_0xa716('0x62')],md5(_0x5268cf[_0xa716('0x62')]));if(_0xea2415&&_0xea2415['monitor_format']){logger[_0xa716('0x15')](_0xa716('0x63'),_0xa716('0x64'));_0x5268cf['recordingURL']=_0x3f0b32;}else if(_0x311baa&&_0x311baa[_0xa716('0x65')]&&_0x311baa[_0xa716('0x65')]!==_0xa716('0x66')){logger[_0xa716('0x15')](_0xa716('0x67'),_0xa716('0x64'));_0x5268cf['recordingURL']=_0x3f0b32;}else{_0x5268cf[_0xa716('0x68')]='';}return getAdminUser(_0x2ac708,_0x25f8d3,_0x31e047,_0x3f83a9,_0x14db83,_0x967bdd)[_0xa716('0x17')](getUser(_0x2ac708,_0x25f8d3,_0x3f83a9,_0x14db83,_0x967bdd))[_0xa716('0x17')](getEndUser(_0x2ac708,_0x25f8d3,_0x3f83a9,_0x14db83,_0x967bdd))[_0xa716('0x17')](getTicket(_0x2ac708,_0x25f8d3,_0x3f83a9,_0x5572e0,_0x5268cf,_0x14db83))['then'](function(_0x2ff198){logger[_0xa716('0x15')](util[_0xa716('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2ff198[_0xa716('0x41')]));logger[_0xa716('0x15')](util[_0xa716('0x51')](_0xa716('0x69'),_0x2ac708));if(_0x2ac708!==_0xa716('0x61')){logger[_0xa716('0x15')]('['+[_0x2ac708[_0xa716('0xe')]()]+']',_0xa716('0x6a'));emit(_0x4b7054['remoteUri'],_0x3ba552[_0xa716('0x39')],_0x2ff198[_0xa716('0x41')]);}})[_0xa716('0xf')](function(_0x306980){logger[_0xa716('0x10')]('['+[_0x2ac708[_0xa716('0xe')]()]+_0xa716('0x6b'),util[_0xa716('0x6c')](_0x306980,{'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 95cbb88..d78472c 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 _0x6c0f=['uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Fields','Outbound','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','users','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','length','variableName','push','idField','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x3371f6,_0x4ec66f){var _0x1ba130=function(_0x5aa350){while(--_0x5aa350){_0x3371f6['push'](_0x3371f6['shift']());}};_0x1ba130(++_0x4ec66f);}(_0x6c0f,0x119));var _0xf6c0=function(_0x20b278,_0x1ff931){_0x20b278=_0x20b278-0x0;var _0x441a43=_0x6c0f[_0x20b278];return _0x441a43;};'use strict';var _=require(_0xf6c0('0x0'));var rp=require(_0xf6c0('0x1'));var BPromise=require(_0xf6c0('0x2'));var md5=require(_0xf6c0('0x3'));var util=require(_0xf6c0('0x4'));var Redis=require(_0xf6c0('0x5'));var intUtil=require(_0xf6c0('0x6'));var config=require(_0xf6c0('0x7'));var logger=require(_0xf6c0('0x8'))(_0xf6c0('0x9'));config['redis']=_['defaults'](config[_0xf6c0('0xa')],{'host':_0xf6c0('0xb'),'port':0x18eb});var io=require(_0xf6c0('0xc'))(new Redis(config['redis']));var def={'method':_0xf6c0('0xd'),'json':!![]};function emit(_0x51cd40,_0x361fce,_0x5f35cb){io['to'](_0x51cd40)[_0xf6c0('0xe')](_0x361fce,_0x5f35cb);}function getTicket(_0x5b2440,_0x176119,_0x1af16f,_0x5ea17c,_0x44e822,_0x17d2ac,_0x141938,_0x1d701a){logger[_0xf6c0('0xf')](_0xf6c0('0x10'));var _0x20d767=new Date();var _0x2794ae=[{'name':'name','value':intUtil[_0xf6c0('0x11')](_0x5ea17c['Subjects'],_0x44e822,'\x20')},{'name':_0xf6c0('0x12'),'value':_0x176119['id']},{'name':_0xf6c0('0x13'),'value':_0x176119['id']},{'name':_0xf6c0('0x14'),'value':intUtil[_0xf6c0('0x11')](_0x5ea17c['Descriptions'],_0x44e822,'\x0a')},{'name':_0xf6c0('0x15'),'value':_0x20d767[_0xf6c0('0x16')]()[_0xf6c0('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':_0xf6c0('0x18'),'value':'0'},{'name':_0xf6c0('0x19'),'value':'15'},{'name':_0xf6c0('0x1a'),'value':_0x1af16f['id']},{'name':_0xf6c0('0x1b'),'value':_0xf6c0('0x1c')},{'name':_0xf6c0('0x1d'),'value':_0x1af16f[_0xf6c0('0x1e')]},{'name':_0xf6c0('0x1f'),'value':_0x1d701a}];if(_0x17d2ac[_0xf6c0('0x20')]){_['forEach'](_0x17d2ac,function(_0x262a23){if(_0x44e822[_0x262a23[_0xf6c0('0x21')]]){_0x2794ae[_0xf6c0('0x22')]({'name':_0x262a23[_0xf6c0('0x23')],'value':_0x44e822[_0x262a23[_0xf6c0('0x21')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xf6c0('0x24'),'rest_data':JSON[_0xf6c0('0x25')]({'session':_0x141938['id'],'module_name':_0xf6c0('0x26'),'name_value_list':_0x2794ae})}});}function getAuth(_0x1f97bb){return util[_0xf6c0('0x27')]('Basic\x20%s',new Buffer(_0x1f97bb[_0xf6c0('0x28')]+':X')[_0xf6c0('0x29')](_0xf6c0('0x2a')));}function getServerInfo(_0xbe90ed){return request({'form':{'method':_0xf6c0('0x2b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf6c0('0x25')]({'session':_0xbe90ed['id']})}});}function getUser(_0x559a22,_0x4fdb55,_0x1a30a6){if(!_['isNil'](_0x4fdb55)){logger[_0xf6c0('0xf')]('Getting\x20agent\x20with\x20name',_0x4fdb55);return request({'form':{'method':'get_entry_list','input_type':_0xf6c0('0x24'),'response_type':_0xf6c0('0x24'),'rest_data':JSON['stringify']({'session':_0x1a30a6['id'],'module_name':_0xf6c0('0x2c'),'query':util['format'](_0xf6c0('0x2d'),_0x4fdb55),'order_by':'','offset':'0','select_fields':['id',_0xf6c0('0x1e'),_0xf6c0('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf6c0('0x2f')](function(_0x29489b){if(_0x29489b['entry_list'][_0xf6c0('0x20')]){var _0x3ef968=_[_0xf6c0('0x30')](_0x29489b[_0xf6c0('0x31')],function(_0x3b0921){return _0x3b0921[_0xf6c0('0x32')][_0xf6c0('0x2e')][_0xf6c0('0x33')]===_0x4fdb55;});if(_0x3ef968){logger[_0xf6c0('0xf')]('Agent\x20found!');return BPromise[_0xf6c0('0x34')]({'id':_0x3ef968[_0xf6c0('0x32')]['id'][_0xf6c0('0x33')],'name':_0x3ef968['name_value_list'][_0xf6c0('0x1e')][_0xf6c0('0x33')]});}}logger[_0xf6c0('0xf')](_0xf6c0('0x35'));return BPromise[_0xf6c0('0x34')]({'id':_0x1a30a6['name_value_list'][_0xf6c0('0x36')]['value'],'name':_0x1a30a6[_0xf6c0('0x32')][_0xf6c0('0x2e')][_0xf6c0('0x33')]});});}else{logger[_0xf6c0('0xf')](_0xf6c0('0x37'));return BPromise[_0xf6c0('0x34')]({'id':_0x1a30a6['name_value_list'][_0xf6c0('0x36')]['value'],'name':_0x1a30a6['name_value_list'][_0xf6c0('0x2e')][_0xf6c0('0x33')]});}}function getEndUser(_0x233082,_0x5eddf6,_0x4c65f1,_0x4520a6){logger[_0xf6c0('0xf')](_0xf6c0('0x38'),_0x4c65f1);return request({'form':{'method':_0xf6c0('0x39'),'input_type':_0xf6c0('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4520a6['id'],'module_name':'Contacts','query':util[_0xf6c0('0x27')](_0xf6c0('0x3a'),_0x4c65f1),'order_by':'','offset':'0','select_fields':['id',_0xf6c0('0x1e'),_0xf6c0('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf6c0('0x2f')](function(_0xe57cbd){if(_0xe57cbd[_0xf6c0('0x31')][_0xf6c0('0x20')]){var _0x2db8b1=_[_0xf6c0('0x30')](_0xe57cbd['entry_list'],function(_0x186ef9){return _0x186ef9[_0xf6c0('0x32')]['phone_home'][_0xf6c0('0x33')]===_0x4c65f1;});if(_0x2db8b1){logger[_0xf6c0('0xf')](_0xf6c0('0x3c'));return BPromise[_0xf6c0('0x34')]({'id':_0x2db8b1[_0xf6c0('0x32')]['id'][_0xf6c0('0x33')],'name':_0x2db8b1[_0xf6c0('0x32')][_0xf6c0('0x1e')]['value'],'phone':_0x2db8b1[_0xf6c0('0x32')][_0xf6c0('0x3b')][_0xf6c0('0x33')]});}}else{logger[_0xf6c0('0xf')](_0xf6c0('0x3d'));return request({'form':{'method':_0xf6c0('0x3e'),'input_type':'JSON','response_type':_0xf6c0('0x24'),'rest_data':JSON[_0xf6c0('0x25')]({'session':_0x4520a6['id'],'module_name':_0xf6c0('0x1c'),'name_value_list':[{'name':'first_name','value':_0x5eddf6!==_0xf6c0('0x3f')?_0x5eddf6:util['format'](_0xf6c0('0x40'),_0x4c65f1)},{'name':_0xf6c0('0x3b'),'value':_0x4c65f1}]})}})[_0xf6c0('0x2f')](function(_0x211f0a){logger[_0xf6c0('0xf')](_0xf6c0('0x41'));return BPromise[_0xf6c0('0x34')]({'id':_0x211f0a['id'],'name':_0x211f0a[_0xf6c0('0x31')]['first_name']['value'],'phone':_0x211f0a[_0xf6c0('0x31')][_0xf6c0('0x3b')][_0xf6c0('0x33')]});});}});}function request(_0xb21a2f){logger[_0xf6c0('0x42')](_0xf6c0('0x43'),JSON[_0xf6c0('0x25')](_0xb21a2f));return rp(_[_0xf6c0('0x44')](def,_0xb21a2f));}function getTags(_0xc929f,_0x5b1d08){var _0x4b454c=[];if(_0xc929f&&_0xc929f[_0xf6c0('0x20')]>0x0){_0x4b454c=_[_0xf6c0('0x45')](_0xc929f,_0x5b1d08);}return _0x4b454c;}function getCustomFields(_0x4e8ee1,_0x1f89b8){var _0x4879d8=[];var _0x18fe7b={'custom_fields':[]};if(_0x4e8ee1[_0xf6c0('0x20')]>0x0){_[_0xf6c0('0x46')](_0x4e8ee1,function(_0x532fc2){if(_0x532fc2[_0xf6c0('0x47')]===_0xf6c0('0x48')&&_0x532fc2[_0xf6c0('0x49')]&&!_0x532fc2[_0xf6c0('0x4a')]){_0x18fe7b[_0x532fc2[_0xf6c0('0x49')][_0xf6c0('0x4b')]()]=_0x532fc2[_0xf6c0('0x4c')][_0xf6c0('0x29')]();}else if(_0x532fc2[_0xf6c0('0x47')]===_0xf6c0('0x48')&&_0x532fc2[_0xf6c0('0x23')]&&_0x532fc2[_0xf6c0('0x4a')]){_0x18fe7b[_0xf6c0('0x4d')][_0xf6c0('0x22')]({'id':_0x532fc2[_0xf6c0('0x23')],'value':_0x532fc2[_0xf6c0('0x4c')][_0xf6c0('0x29')]()});}else if(_0x532fc2['type']==='variable'&&_0x532fc2[_0xf6c0('0x21')]&&_0x532fc2[_0xf6c0('0x23')]&&_0x532fc2[_0xf6c0('0x4a')]){_0x1f89b8[_0x532fc2['variableName']]&&_0x18fe7b[_0xf6c0('0x4d')][_0xf6c0('0x22')]({'id':_0x532fc2[_0xf6c0('0x23')],'value':_0x1f89b8[_0x532fc2[_0xf6c0('0x21')]][_0xf6c0('0x29')]()});}else if(_0x532fc2[_0xf6c0('0x47')]==='customVariable'&&_0x532fc2[_0xf6c0('0x4e')]&&_0x532fc2[_0xf6c0('0x4e')][_0xf6c0('0x1e')]&&_0x532fc2[_0xf6c0('0x23')]&&_0x532fc2[_0xf6c0('0x4a')]){_0x1f89b8[_0x532fc2[_0xf6c0('0x4e')][_0xf6c0('0x1e')][_0xf6c0('0x4b')]()]&&_0x18fe7b[_0xf6c0('0x4d')][_0xf6c0('0x22')]({'id':_0x532fc2[_0xf6c0('0x23')],'value':_0x1f89b8[_0x532fc2[_0xf6c0('0x4e')][_0xf6c0('0x1e')][_0xf6c0('0x4b')]()][_0xf6c0('0x29')]()});}});}return _0x18fe7b;}function getConnection(_0x75c3f5){return request({'method':'POST','form':{'method':_0xf6c0('0x4f'),'input_type':_0xf6c0('0x24'),'response_type':_0xf6c0('0x24'),'rest_data':JSON[_0xf6c0('0x25')]({'user_auth':{'user_name':_0x75c3f5[_0xf6c0('0x50')],'password':_0x75c3f5[_0xf6c0('0x51')],'encryption':_0xf6c0('0x52')},'application':_0xf6c0('0x53')})}})[_0xf6c0('0x2f')](function(_0x1302c9){var _0x5450d3=_0x1302c9;if(_0x5450d3['id']){def['sessionID']=_0x5450d3['id'];return BPromise[_0xf6c0('0x34')](_0x5450d3);}else{throw new Error(util[_0xf6c0('0x27')]('Account\x20%d\x20is\x20not\x20valid',_0x75c3f5['id']));}});}function setRelationship(_0x46b4ae,_0x2c746e,_0x5cfa1f,_0x15146e){return request({'form':{'method':_0xf6c0('0x54'),'input_type':_0xf6c0('0x24'),'response_type':_0xf6c0('0x24'),'rest_data':JSON[_0xf6c0('0x25')]({'session':_0x46b4ae['id'],'module_name':_0xf6c0('0x26'),'module_id':_0x5cfa1f['id'],'link_field_name':_0x15146e,'related_ids':[_0x2c746e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf6c0('0x55')]=function(_0x52a3bd,_0x1a4744,_0x4012ad,_0x580c22,_0x5e2176,_0x352f56){var _0xd79247,_0x40d0c7,_0x141d65,_0x552bef;_0x352f56[_0xf6c0('0x56')]=intUtil[_0xf6c0('0x57')](_0x352f56[_0xf6c0('0x56')]);_0x352f56[_0xf6c0('0x58')]=intUtil[_0xf6c0('0x57')](_0x352f56[_0xf6c0('0x58')]);def[_0xf6c0('0x59')]=util[_0xf6c0('0x27')](_0xf6c0('0x5a'),_0x352f56[_0xf6c0('0x56')]);if(_0x5e2176&&_0x5e2176['monitor_format']){logger['info'](_0xf6c0('0x5b'),_0xf6c0('0x5c'));_0x1a4744['recordingURL']=util['format'](_0xf6c0('0x5d'),_0x352f56[_0xf6c0('0x58')],_0x1a4744[_0xf6c0('0x5e')],md5(_0x1a4744[_0xf6c0('0x5e')]));}else{_0x1a4744[_0xf6c0('0x5f')]='';}return getConnection(_0x352f56)[_0xf6c0('0x2f')](function(_0x53f2a5){_0x552bef=_0x53f2a5;return getUser(_0x352f56,_0x580c22[_0xf6c0('0x1e')],_0x552bef);})[_0xf6c0('0x2f')](function(_0x198dcf){_0xd79247=_0x198dcf;logger['info'](_0xf6c0('0x60'),_0xd79247['id']);return getEndUser(_0x352f56,_0x1a4744[_0xf6c0('0x61')],_0x1a4744[_0xf6c0('0x62')],_0x552bef);})['then'](function(_0x4c80ec){_0x40d0c7=_0x4c80ec;logger[_0xf6c0('0xf')](_0xf6c0('0x63'),_0x40d0c7['id']);return getTicket(_0x352f56,_0xd79247,_0x40d0c7,_0x4012ad,_0x1a4744,_0x4012ad['Fields'],_0x552bef,_0xf6c0('0x64'));})[_0xf6c0('0x2f')](function(_0x44bdf1){_0x141d65=_0x44bdf1;logger[_0xf6c0('0xf')](_0xf6c0('0x65'));logger['info'](_0xf6c0('0x66'),_0x141d65['id']);return setRelationship(_0x552bef,_0xd79247,_0x141d65,'users');})[_0xf6c0('0x2f')](function(){return setRelationship(_0x552bef,_0x40d0c7,_0x141d65,'contacts');})['then'](function(){return getServerInfo(_0x552bef);})['then'](function(_0x4277e0){var _0x2c9443=parseInt(_0x4277e0[_0xf6c0('0x67')][_0xf6c0('0x68')](0x0));var _0x133ca2=util[_0xf6c0('0x27')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x352f56[_0xf6c0('0x56')],_0x141d65['id']);if(_0x2c9443>0x6){_0x133ca2=util['format'](_0xf6c0('0x69'),_0x352f56[_0xf6c0('0x56')],_0x141d65['id']);}logger[_0xf6c0('0xf')](_0xf6c0('0x5b'),_0xf6c0('0x6a'));emit(util[_0xf6c0('0x27')]('user:%s',_0x580c22['name']),_0xf6c0('0x6b'),{'uri':_0x133ca2});})[_0xf6c0('0x6c')](function(_0x53119a){logger[_0xf6c0('0x6d')](_0xf6c0('0x5b'),JSON[_0xf6c0('0x25')](_0x53119a));});};exports[_0xf6c0('0x6e')]=function(_0x5bd482,_0x56b448,_0xfbf28d,_0x4a4b86,_0x33af28,_0x32a6e0,_0x43c869){var _0x31dfa1,_0x453dd4,_0x2f3b38,_0x51aad2;_0x32a6e0[_0xf6c0('0x56')]=intUtil[_0xf6c0('0x57')](_0x32a6e0[_0xf6c0('0x56')]);_0x32a6e0[_0xf6c0('0x58')]=intUtil[_0xf6c0('0x57')](_0x32a6e0[_0xf6c0('0x58')]);def[_0xf6c0('0x59')]=util[_0xf6c0('0x27')]('%s/service/v4_1/rest.php',_0x32a6e0[_0xf6c0('0x56')]);if(_0x43c869&&_0x43c869[_0xf6c0('0x6f')]&&_0x43c869[_0xf6c0('0x6f')]!==_0xf6c0('0x70')){logger[_0xf6c0('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x56b448[_0xf6c0('0x5f')]=util[_0xf6c0('0x27')](_0xf6c0('0x5d'),_0x32a6e0[_0xf6c0('0x58')],_0x56b448['uniqueid'],md5(_0x56b448['uniqueid']));}return getConnection(_0x32a6e0)['then'](function(_0x31382c){_0x51aad2=_0x31382c;return getUser(_0x32a6e0,_0x4a4b86['name'],_0x51aad2);})[_0xf6c0('0x2f')](function(_0x4681ee){_0x31dfa1=_0x4681ee;logger[_0xf6c0('0xf')](_0xf6c0('0x60'),_0x31dfa1['id']);return getEndUser(_0x32a6e0,_0x56b448[_0xf6c0('0x71')],_0x56b448[_0xf6c0('0x72')],_0x51aad2);})[_0xf6c0('0x2f')](function(_0x4fc538){_0x453dd4=_0x4fc538;logger['info'](_0xf6c0('0x63'),_0x453dd4['id']);return getTicket(_0x32a6e0,_0x31dfa1,_0x453dd4,_0xfbf28d,_0x56b448,_0xfbf28d[_0xf6c0('0x73')],_0x51aad2,_0xf6c0('0x74'));})[_0xf6c0('0x2f')](function(_0x3974cd){_0x2f3b38=_0x3974cd;logger[_0xf6c0('0xf')](_0xf6c0('0x65'));logger[_0xf6c0('0xf')](_0xf6c0('0x66'),_0x2f3b38['id']);return setRelationship(_0x51aad2,_0x31dfa1,_0x2f3b38,'users');})[_0xf6c0('0x2f')](function(){return setRelationship(_0x51aad2,_0x453dd4,_0x2f3b38,_0xf6c0('0x75'));})[_0xf6c0('0x2f')](function(){return getServerInfo(_0x51aad2);})[_0xf6c0('0x2f')](function(_0x48e7db){var _0x17eed5=parseInt(_0x48e7db[_0xf6c0('0x67')]['charAt'](0x0));var _0x1b46a3=util['format'](_0xf6c0('0x76'),_0x32a6e0[_0xf6c0('0x56')],_0x2f3b38['id']);if(_0x17eed5>0x6){_0x1b46a3=util[_0xf6c0('0x27')](_0xf6c0('0x69'),_0x32a6e0['remoteUri'],_0x2f3b38['id']);}logger[_0xf6c0('0xf')](_0xf6c0('0x77'),_0xf6c0('0x6a'));emit(util['format'](_0xf6c0('0x78'),_0x4a4b86[_0xf6c0('0x1e')]),_0xf6c0('0x6b'),{'uri':_0x1b46a3});})['catch'](function(_0x42ac0c){logger['error'](_0xf6c0('0x77'),JSON['stringify'](_0x42ac0c));});};exports[_0xf6c0('0x79')]=function(_0x515bf3,_0x5c3562,_0x469ada,_0x135dc4,_0x8d9a7,_0x2ebb20){var _0x5de335,_0x1612f7,_0x3f735a,_0x53f75a;_0x2ebb20[_0xf6c0('0x56')]=intUtil[_0xf6c0('0x57')](_0x2ebb20[_0xf6c0('0x56')]);_0x2ebb20[_0xf6c0('0x58')]=intUtil[_0xf6c0('0x57')](_0x2ebb20['serverUrl']);def[_0xf6c0('0x59')]=util[_0xf6c0('0x27')](_0xf6c0('0x5a'),_0x2ebb20['remoteUri']);if(_0x8d9a7&&_0x8d9a7['monitor_format']){logger[_0xf6c0('0xf')]('['+_0x5c3562[_0xf6c0('0x7a')][_0xf6c0('0x7b')]()+']',_0xf6c0('0x5c'));_0x5c3562[_0xf6c0('0x5f')]=util[_0xf6c0('0x27')](_0xf6c0('0x5d'),_0x2ebb20['serverUrl'],_0x5c3562[_0xf6c0('0x5e')],md5(_0x5c3562['uniqueid']));}else{_0x5c3562[_0xf6c0('0x5f')]='';}return getConnection(_0x2ebb20)[_0xf6c0('0x2f')](function(_0x5a82b1){_0x53f75a=_0x5a82b1;if(!_['isNil'](_0x135dc4)){return getUser(_0x2ebb20,_0x135dc4['name'],_0x53f75a);}else{return getUser(_0x2ebb20,null,_0x53f75a);}})[_0xf6c0('0x2f')](function(_0x580895){_0x5de335=_0x580895;logger[_0xf6c0('0xf')](_0xf6c0('0x60'),_0x5de335['id']);return getEndUser(_0x2ebb20,_0x5c3562[_0xf6c0('0x61')],_0x5c3562[_0xf6c0('0x62')],_0x53f75a);})['then'](function(_0x20ec58){_0x1612f7=_0x20ec58;logger['info'](_0xf6c0('0x63'),_0x1612f7['id']);return getTicket(_0x2ebb20,_0x5de335,_0x1612f7,_0x469ada,_0x5c3562,_0x469ada[_0xf6c0('0x73')],_0x53f75a,_0xf6c0('0x64'));})['then'](function(_0xa92781){_0x3f735a=_0xa92781;logger[_0xf6c0('0xf')](_0xf6c0('0x65'));logger[_0xf6c0('0xf')](_0xf6c0('0x66'),_0x3f735a['id']);return setRelationship(_0x53f75a,_0x5de335,_0x3f735a,_0xf6c0('0x7c'));})[_0xf6c0('0x2f')](function(){return setRelationship(_0x53f75a,_0x1612f7,_0x3f735a,_0xf6c0('0x75'));})[_0xf6c0('0x2f')](function(){return getServerInfo(_0x53f75a);})['catch'](function(_0x6431eb){logger['error']('['+_0x5c3562[_0xf6c0('0x7a')][_0xf6c0('0x7b')]()+']',JSON['stringify'](_0x6431eb));});}; \ No newline at end of file +var _0xf379=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','user:%s','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','Fields','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','name_value_list','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','push','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','users','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s'];(function(_0xc973f8,_0x1759ec){var _0x5cd9d5=function(_0x582522){while(--_0x582522){_0xc973f8['push'](_0xc973f8['shift']());}};_0x5cd9d5(++_0x1759ec);}(_0xf379,0x191));var _0x9f37=function(_0x241644,_0x2289a2){_0x241644=_0x241644-0x0;var _0x25c77c=_0xf379[_0x241644];return _0x25c77c;};'use strict';var _=require(_0x9f37('0x0'));var rp=require(_0x9f37('0x1'));var BPromise=require(_0x9f37('0x2'));var md5=require(_0x9f37('0x3'));var util=require(_0x9f37('0x4'));var Redis=require(_0x9f37('0x5'));var intUtil=require('./util');var config=require(_0x9f37('0x6'));var logger=require(_0x9f37('0x7'))(_0x9f37('0x8'));config[_0x9f37('0x9')]=_[_0x9f37('0xa')](config[_0x9f37('0x9')],{'host':_0x9f37('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x9f37('0xc'),'json':!![]};function emit(_0x20b4a9,_0x158f6c,_0xc1c7){io['to'](_0x20b4a9)[_0x9f37('0xd')](_0x158f6c,_0xc1c7);}function getTicket(_0x1e5dda,_0x2db993,_0x27265d,_0x4e7bce,_0x5db4b4,_0x1a8b82,_0x245485,_0x1d0e30){logger[_0x9f37('0xe')](_0x9f37('0xf'));var _0x56b5ff=new Date();var _0x5a4c8c=[{'name':_0x9f37('0x10'),'value':intUtil[_0x9f37('0x11')](_0x4e7bce[_0x9f37('0x12')],_0x5db4b4,'\x20')},{'name':_0x9f37('0x13'),'value':_0x2db993['id']},{'name':_0x9f37('0x14'),'value':_0x2db993['id']},{'name':_0x9f37('0x15'),'value':intUtil[_0x9f37('0x11')](_0x4e7bce[_0x9f37('0x16')],_0x5db4b4,'\x0a')},{'name':'date_start','value':_0x56b5ff[_0x9f37('0x17')]()[_0x9f37('0x18')](0x0,0x13)[_0x9f37('0x19')]('T','\x20')},{'name':_0x9f37('0x1a'),'value':'0'},{'name':_0x9f37('0x1b'),'value':'15'},{'name':_0x9f37('0x1c'),'value':_0x27265d['id']},{'name':_0x9f37('0x1d'),'value':_0x9f37('0x1e')},{'name':_0x9f37('0x1f'),'value':_0x27265d[_0x9f37('0x10')]},{'name':_0x9f37('0x20'),'value':_0x1d0e30}];if(_0x1a8b82[_0x9f37('0x21')]){_[_0x9f37('0x22')](_0x1a8b82,function(_0x582702){if(_0x5db4b4[_0x582702[_0x9f37('0x23')]]){_0x5a4c8c['push']({'name':_0x582702['idField'],'value':_0x5db4b4[_0x582702[_0x9f37('0x23')]]});}});}return request({'form':{'method':_0x9f37('0x24'),'input_type':_0x9f37('0x25'),'response_type':_0x9f37('0x25'),'rest_data':JSON[_0x9f37('0x26')]({'session':_0x245485['id'],'module_name':_0x9f37('0x27'),'name_value_list':_0x5a4c8c})}});}function getAuth(_0x55493b){return util['format'](_0x9f37('0x28'),new Buffer(_0x55493b[_0x9f37('0x29')]+':X')[_0x9f37('0x2a')](_0x9f37('0x2b')));}function getServerInfo(_0x136f6c){return request({'form':{'method':_0x9f37('0x2c'),'input_type':_0x9f37('0x25'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x136f6c['id']})}});}function getUser(_0x2ba4dc,_0x318337,_0x3cfbae){if(!_[_0x9f37('0x2d')](_0x318337)){logger[_0x9f37('0xe')]('Getting\x20agent\x20with\x20name',_0x318337);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x9f37('0x25'),'rest_data':JSON[_0x9f37('0x26')]({'session':_0x3cfbae['id'],'module_name':_0x9f37('0x2e'),'query':util[_0x9f37('0x2f')](_0x9f37('0x30'),_0x318337),'order_by':'','offset':'0','select_fields':['id',_0x9f37('0x10'),_0x9f37('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x525e8b){if(_0x525e8b['entry_list'][_0x9f37('0x21')]){var _0x3f0e0e=_['find'](_0x525e8b['entry_list'],function(_0x5825a3){return _0x5825a3[_0x9f37('0x32')][_0x9f37('0x31')]['value']===_0x318337;});if(_0x3f0e0e){logger['info'](_0x9f37('0x33'));return BPromise['resolve']({'id':_0x3f0e0e[_0x9f37('0x32')]['id'][_0x9f37('0x34')],'name':_0x3f0e0e[_0x9f37('0x32')][_0x9f37('0x10')][_0x9f37('0x34')]});}}logger[_0x9f37('0xe')](_0x9f37('0x35'));return BPromise[_0x9f37('0x36')]({'id':_0x3cfbae[_0x9f37('0x32')][_0x9f37('0x37')]['value'],'name':_0x3cfbae[_0x9f37('0x32')]['user_name'][_0x9f37('0x34')]});});}else{logger['info'](_0x9f37('0x38'));return BPromise[_0x9f37('0x36')]({'id':_0x3cfbae[_0x9f37('0x32')]['user_id'][_0x9f37('0x34')],'name':_0x3cfbae['name_value_list'][_0x9f37('0x31')]['value']});}}function getEndUser(_0x31dbd8,_0xc7cad7,_0x437997,_0xc19bad){logger[_0x9f37('0xe')](_0x9f37('0x39'),_0x437997);return request({'form':{'method':_0x9f37('0x3a'),'input_type':_0x9f37('0x25'),'response_type':_0x9f37('0x25'),'rest_data':JSON[_0x9f37('0x26')]({'session':_0xc19bad['id'],'module_name':_0x9f37('0x1e'),'query':util[_0x9f37('0x2f')](_0x9f37('0x3b'),_0x437997),'order_by':'','offset':'0','select_fields':['id',_0x9f37('0x10'),_0x9f37('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f37('0x3d')](function(_0x2543a5){if(_0x2543a5['entry_list'][_0x9f37('0x21')]){var _0x2ec78d=_['find'](_0x2543a5[_0x9f37('0x3e')],function(_0x33d77e){return _0x33d77e[_0x9f37('0x32')][_0x9f37('0x3c')][_0x9f37('0x34')]===_0x437997;});if(_0x2ec78d){logger[_0x9f37('0xe')](_0x9f37('0x3f'));return BPromise['resolve']({'id':_0x2ec78d[_0x9f37('0x32')]['id'][_0x9f37('0x34')],'name':_0x2ec78d[_0x9f37('0x32')][_0x9f37('0x10')]['value'],'phone':_0x2ec78d['name_value_list']['phone_home'][_0x9f37('0x34')]});}}else{logger['info'](_0x9f37('0x40'));return request({'form':{'method':'set_entry','input_type':_0x9f37('0x25'),'response_type':_0x9f37('0x25'),'rest_data':JSON['stringify']({'session':_0xc19bad['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9f37('0x41'),'value':_0xc7cad7!==_0x9f37('0x42')?_0xc7cad7:util['format'](_0x9f37('0x43'),_0x437997)},{'name':'phone_home','value':_0x437997}]})}})[_0x9f37('0x3d')](function(_0x35186a){logger['info'](_0x9f37('0x44'));return BPromise['resolve']({'id':_0x35186a['id'],'name':_0x35186a[_0x9f37('0x3e')][_0x9f37('0x41')]['value'],'phone':_0x35186a[_0x9f37('0x3e')][_0x9f37('0x3c')][_0x9f37('0x34')]});});}});}function request(_0x4c3f3b){logger[_0x9f37('0x45')](_0x9f37('0x46'),JSON[_0x9f37('0x26')](_0x4c3f3b));return rp(_['merge'](def,_0x4c3f3b));}function getTags(_0x24163c,_0x7be407){var _0x46bfa2=[];if(_0x24163c&&_0x24163c[_0x9f37('0x21')]>0x0){_0x46bfa2=_[_0x9f37('0x47')](_0x24163c,_0x7be407);}return _0x46bfa2;}function getCustomFields(_0x761afc,_0x5094e8){var _0x518ee=[];var _0x566cfa={'custom_fields':[]};if(_0x761afc[_0x9f37('0x21')]>0x0){_[_0x9f37('0x22')](_0x761afc,function(_0x50680d){if(_0x50680d[_0x9f37('0x48')]==='string'&&_0x50680d[_0x9f37('0x49')]&&!_0x50680d[_0x9f37('0x4a')]){_0x566cfa[_0x50680d[_0x9f37('0x49')][_0x9f37('0x4b')]()]=_0x50680d[_0x9f37('0x4c')][_0x9f37('0x2a')]();}else if(_0x50680d['type']===_0x9f37('0x4d')&&_0x50680d[_0x9f37('0x4e')]&&_0x50680d[_0x9f37('0x4a')]){_0x566cfa[_0x9f37('0x4f')]['push']({'id':_0x50680d[_0x9f37('0x4e')],'value':_0x50680d[_0x9f37('0x4c')][_0x9f37('0x2a')]()});}else if(_0x50680d['type']===_0x9f37('0x50')&&_0x50680d['variableName']&&_0x50680d[_0x9f37('0x4e')]&&_0x50680d['customField']){_0x5094e8[_0x50680d[_0x9f37('0x23')]]&&_0x566cfa['custom_fields'][_0x9f37('0x51')]({'id':_0x50680d[_0x9f37('0x4e')],'value':_0x5094e8[_0x50680d[_0x9f37('0x23')]][_0x9f37('0x2a')]()});}else if(_0x50680d[_0x9f37('0x48')]===_0x9f37('0x52')&&_0x50680d[_0x9f37('0x53')]&&_0x50680d['Variable'][_0x9f37('0x10')]&&_0x50680d[_0x9f37('0x4e')]&&_0x50680d['customField']){_0x5094e8[_0x50680d[_0x9f37('0x53')]['name'][_0x9f37('0x4b')]()]&&_0x566cfa['custom_fields'][_0x9f37('0x51')]({'id':_0x50680d[_0x9f37('0x4e')],'value':_0x5094e8[_0x50680d[_0x9f37('0x53')][_0x9f37('0x10')]['toLowerCase']()][_0x9f37('0x2a')]()});}});}return _0x566cfa;}function getConnection(_0x36dcbe){return request({'method':_0x9f37('0xc'),'form':{'method':_0x9f37('0x54'),'input_type':_0x9f37('0x25'),'response_type':_0x9f37('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x36dcbe[_0x9f37('0x55')],'password':_0x36dcbe[_0x9f37('0x56')],'encryption':_0x9f37('0x57')},'application':_0x9f37('0x58')})}})['then'](function(_0x5d1179){var _0x33fb34=_0x5d1179;if(_0x33fb34['id']){def['sessionID']=_0x33fb34['id'];return BPromise[_0x9f37('0x36')](_0x33fb34);}else{throw new Error(util[_0x9f37('0x2f')]('Account\x20%d\x20is\x20not\x20valid',_0x36dcbe['id']));}});}function setRelationship(_0x370d66,_0x261dc2,_0x1301fa,_0x58ef11){return request({'form':{'method':_0x9f37('0x59'),'input_type':_0x9f37('0x25'),'response_type':'JSON','rest_data':JSON[_0x9f37('0x26')]({'session':_0x370d66['id'],'module_name':_0x9f37('0x27'),'module_id':_0x1301fa['id'],'link_field_name':_0x58ef11,'related_ids':[_0x261dc2['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x24f0ef,_0x29205f,_0x5ba5a4,_0x41052c,_0x278e67,_0x54dbb9){var _0x29b4c0,_0x104fe2,_0x2b0b30,_0x56567;_0x54dbb9[_0x9f37('0x5a')]=intUtil[_0x9f37('0x5b')](_0x54dbb9[_0x9f37('0x5a')]);_0x54dbb9['serverUrl']=intUtil[_0x9f37('0x5b')](_0x54dbb9[_0x9f37('0x5c')]);def[_0x9f37('0x5d')]=util[_0x9f37('0x2f')]('%s/service/v4_1/rest.php',_0x54dbb9['remoteUri']);if(_0x278e67&&_0x278e67[_0x9f37('0x5e')]){logger[_0x9f37('0xe')](_0x9f37('0x5f'),_0x9f37('0x60'));_0x29205f[_0x9f37('0x61')]=util['format'](_0x9f37('0x62'),_0x54dbb9['serverUrl'],_0x29205f[_0x9f37('0x63')],md5(_0x29205f[_0x9f37('0x63')]));}else{_0x29205f[_0x9f37('0x61')]='';}return getConnection(_0x54dbb9)[_0x9f37('0x3d')](function(_0x13358a){_0x56567=_0x13358a;return getUser(_0x54dbb9,_0x41052c[_0x9f37('0x10')],_0x56567);})[_0x9f37('0x3d')](function(_0x4a3e4c){_0x29b4c0=_0x4a3e4c;logger[_0x9f37('0xe')]('The\x20User\x20ID\x20is:',_0x29b4c0['id']);return getEndUser(_0x54dbb9,_0x29205f[_0x9f37('0x64')],_0x29205f[_0x9f37('0x65')],_0x56567);})[_0x9f37('0x3d')](function(_0x2e6d25){_0x104fe2=_0x2e6d25;logger[_0x9f37('0xe')](_0x9f37('0x66'),_0x104fe2['id']);return getTicket(_0x54dbb9,_0x29b4c0,_0x104fe2,_0x5ba5a4,_0x29205f,_0x5ba5a4['Fields'],_0x56567,'Inbound');})['then'](function(_0x455806){_0x2b0b30=_0x455806;logger[_0x9f37('0xe')]('Ticket\x20created!');logger[_0x9f37('0xe')](_0x9f37('0x67'),_0x2b0b30['id']);return setRelationship(_0x56567,_0x29b4c0,_0x2b0b30,_0x9f37('0x68'));})['then'](function(){return setRelationship(_0x56567,_0x104fe2,_0x2b0b30,'contacts');})[_0x9f37('0x3d')](function(){return getServerInfo(_0x56567);})[_0x9f37('0x3d')](function(_0x35c36c){var _0x16bc9d=parseInt(_0x35c36c['version'][_0x9f37('0x69')](0x0));var _0x1b9f3f=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x54dbb9[_0x9f37('0x5a')],_0x2b0b30['id']);if(_0x16bc9d>0x6){_0x1b9f3f=util[_0x9f37('0x2f')](_0x9f37('0x6a'),_0x54dbb9[_0x9f37('0x5a')],_0x2b0b30['id']);}logger['info']('[QUEUE]',_0x9f37('0x6b'));emit(util['format']('user:%s',_0x41052c[_0x9f37('0x10')]),_0x9f37('0x6c'),{'uri':_0x1b9f3f});})[_0x9f37('0x6d')](function(_0x350764){logger[_0x9f37('0x6e')](_0x9f37('0x5f'),JSON[_0x9f37('0x26')](_0x350764));});};exports[_0x9f37('0x6f')]=function(_0x4a50de,_0x3c207a,_0x44c0c8,_0x1820b2,_0x14ea41,_0x3c152c,_0x6849c9){var _0x1708ef,_0xcfeea0,_0x5ae37f,_0x4ddf86;_0x3c152c[_0x9f37('0x5a')]=intUtil[_0x9f37('0x5b')](_0x3c152c[_0x9f37('0x5a')]);_0x3c152c[_0x9f37('0x5c')]=intUtil['stripTrailingSlash'](_0x3c152c[_0x9f37('0x5c')]);def[_0x9f37('0x5d')]=util[_0x9f37('0x2f')]('%s/service/v4_1/rest.php',_0x3c152c[_0x9f37('0x5a')]);if(_0x6849c9&&_0x6849c9['recordingFormat']&&_0x6849c9['recordingFormat']!==_0x9f37('0x70')){logger[_0x9f37('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3c207a[_0x9f37('0x61')]=util[_0x9f37('0x2f')](_0x9f37('0x62'),_0x3c152c[_0x9f37('0x5c')],_0x3c207a['uniqueid'],md5(_0x3c207a[_0x9f37('0x63')]));}return getConnection(_0x3c152c)[_0x9f37('0x3d')](function(_0x3ce2bd){_0x4ddf86=_0x3ce2bd;return getUser(_0x3c152c,_0x1820b2['name'],_0x4ddf86);})[_0x9f37('0x3d')](function(_0x27da46){_0x1708ef=_0x27da46;logger[_0x9f37('0xe')](_0x9f37('0x71'),_0x1708ef['id']);return getEndUser(_0x3c152c,_0x3c207a[_0x9f37('0x72')],_0x3c207a[_0x9f37('0x73')],_0x4ddf86);})[_0x9f37('0x3d')](function(_0x2a71f2){_0xcfeea0=_0x2a71f2;logger['info'](_0x9f37('0x66'),_0xcfeea0['id']);return getTicket(_0x3c152c,_0x1708ef,_0xcfeea0,_0x44c0c8,_0x3c207a,_0x44c0c8['Fields'],_0x4ddf86,_0x9f37('0x74'));})[_0x9f37('0x3d')](function(_0x369a9f){_0x5ae37f=_0x369a9f;logger[_0x9f37('0xe')](_0x9f37('0x75'));logger['info'](_0x9f37('0x67'),_0x5ae37f['id']);return setRelationship(_0x4ddf86,_0x1708ef,_0x5ae37f,_0x9f37('0x68'));})[_0x9f37('0x3d')](function(){return setRelationship(_0x4ddf86,_0xcfeea0,_0x5ae37f,_0x9f37('0x76'));})[_0x9f37('0x3d')](function(){return getServerInfo(_0x4ddf86);})[_0x9f37('0x3d')](function(_0x442f9a){var _0x4a7822=parseInt(_0x442f9a['version']['charAt'](0x0));var _0x3e3b7b=util[_0x9f37('0x2f')](_0x9f37('0x77'),_0x3c152c['remoteUri'],_0x5ae37f['id']);if(_0x4a7822>0x6){_0x3e3b7b=util[_0x9f37('0x2f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3c152c[_0x9f37('0x5a')],_0x5ae37f['id']);}logger[_0x9f37('0xe')](_0x9f37('0x78'),_0x9f37('0x6b'));emit(util[_0x9f37('0x2f')](_0x9f37('0x79'),_0x1820b2[_0x9f37('0x10')]),_0x9f37('0x6c'),{'uri':_0x3e3b7b});})[_0x9f37('0x6d')](function(_0xfdc7bb){logger['error']('[OUTBOUND]',JSON[_0x9f37('0x26')](_0xfdc7bb));});};exports[_0x9f37('0x7a')]=function(_0x22cc8d,_0x14a6e2,_0x47b3fa,_0x5bba02,_0x440606,_0x19091f){var _0x3674f3,_0x415bbb,_0x2a89f4,_0x298c93;_0x19091f[_0x9f37('0x5a')]=intUtil['stripTrailingSlash'](_0x19091f[_0x9f37('0x5a')]);_0x19091f[_0x9f37('0x5c')]=intUtil[_0x9f37('0x5b')](_0x19091f[_0x9f37('0x5c')]);def[_0x9f37('0x5d')]=util[_0x9f37('0x2f')](_0x9f37('0x7b'),_0x19091f[_0x9f37('0x5a')]);if(_0x440606&&_0x440606[_0x9f37('0x5e')]){logger['info']('['+_0x14a6e2[_0x9f37('0x7c')][_0x9f37('0x7d')]()+']',_0x9f37('0x60'));_0x14a6e2[_0x9f37('0x61')]=util[_0x9f37('0x2f')](_0x9f37('0x62'),_0x19091f[_0x9f37('0x5c')],_0x14a6e2[_0x9f37('0x63')],md5(_0x14a6e2['uniqueid']));}else{_0x14a6e2[_0x9f37('0x61')]='';}return getConnection(_0x19091f)[_0x9f37('0x3d')](function(_0x5be38c){_0x298c93=_0x5be38c;if(!_[_0x9f37('0x2d')](_0x5bba02)){return getUser(_0x19091f,_0x5bba02[_0x9f37('0x10')],_0x298c93);}else{return getUser(_0x19091f,null,_0x298c93);}})[_0x9f37('0x3d')](function(_0x362cbf){_0x3674f3=_0x362cbf;logger[_0x9f37('0xe')](_0x9f37('0x71'),_0x3674f3['id']);return getEndUser(_0x19091f,_0x14a6e2[_0x9f37('0x64')],_0x14a6e2[_0x9f37('0x65')],_0x298c93);})[_0x9f37('0x3d')](function(_0x11df78){_0x415bbb=_0x11df78;logger[_0x9f37('0xe')](_0x9f37('0x66'),_0x415bbb['id']);return getTicket(_0x19091f,_0x3674f3,_0x415bbb,_0x47b3fa,_0x14a6e2,_0x47b3fa[_0x9f37('0x7e')],_0x298c93,'Inbound');})['then'](function(_0x993f62){_0x2a89f4=_0x993f62;logger[_0x9f37('0xe')](_0x9f37('0x75'));logger[_0x9f37('0xe')](_0x9f37('0x67'),_0x2a89f4['id']);return setRelationship(_0x298c93,_0x3674f3,_0x2a89f4,_0x9f37('0x68'));})[_0x9f37('0x3d')](function(){return setRelationship(_0x298c93,_0x415bbb,_0x2a89f4,_0x9f37('0x76'));})[_0x9f37('0x3d')](function(){return getServerInfo(_0x298c93);})[_0x9f37('0x6d')](function(_0x5c9e30){logger[_0x9f37('0x6e')]('['+_0x14a6e2[_0x9f37('0x7c')][_0x9f37('0x7d')]()+']',JSON['stringify'](_0x5c9e30));});}; \ 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 0846e64..d3dc0c7 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 _0x23bc=['stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','name','Variable','toLowerCase','keyValue','key','%s:\x20%s','keyContent','keyType','format','join'];(function(_0x14eae9,_0x1e8cd8){var _0xe7ab39=function(_0x4da8ae){while(--_0x4da8ae){_0x14eae9['push'](_0x14eae9['shift']());}};_0xe7ab39(++_0x1e8cd8);}(_0x23bc,0x19d));var _0xc23b=function(_0x343481,_0x18c920){_0x343481=_0x343481-0x0;var _0x53c287=_0x23bc[_0x343481];return _0x53c287;};'use strict';var _=require(_0xc23b('0x0'));var util=require(_0xc23b('0x1'));exports[_0xc23b('0x2')]=function(_0x1b0bf5,_0x227579,_0x24d68d){var _0x3e954e=[];if(_0x1b0bf5[_0xc23b('0x3')]>0x0){var _0x2720eb=_[_0xc23b('0x4')](_0x1b0bf5,['id']);for(var _0x311103=0x0;_0x311103<_0x2720eb[_0xc23b('0x3')];_0x311103++){var _0x5e86a8=_0x2720eb[_0x311103];if(_0x5e86a8[_0xc23b('0x5')]===_0xc23b('0x6')){_0x3e954e[_0xc23b('0x7')](_0x5e86a8['content']);}else if(_0x5e86a8['type']===_0xc23b('0x8')&&_0x5e86a8[_0xc23b('0x9')]){_0x227579[_0x5e86a8['variableName']]&&_0x3e954e[_0xc23b('0x7')](_0x227579[_0x5e86a8[_0xc23b('0x9')]][_0xc23b('0xa')]());}else if(_0x5e86a8[_0xc23b('0x5')]===_0xc23b('0xb')&&_0x5e86a8['Variable']&&_0x5e86a8['Variable'][_0xc23b('0xc')]){_0x227579[_0x5e86a8[_0xc23b('0xd')]['name'][_0xc23b('0xe')]()]&&_0x3e954e[_0xc23b('0x7')](_0x227579[_0x5e86a8['Variable'][_0xc23b('0xc')][_0xc23b('0xe')]()][_0xc23b('0xa')]());}else if(_0x5e86a8[_0xc23b('0x5')]===_0xc23b('0xf')){if(_0x5e86a8['keyType']==='string'&&_0x5e86a8[_0xc23b('0x10')]){_0x3e954e[_0xc23b('0x7')](util['format'](_0xc23b('0x11'),_0x5e86a8['key'],_0x5e86a8[_0xc23b('0x12')]));}else if(_0x5e86a8[_0xc23b('0x13')]===_0xc23b('0x8')&&_0x5e86a8[_0xc23b('0x9')]&&_0x5e86a8[_0xc23b('0x10')]){_0x227579[_0x5e86a8[_0xc23b('0x9')]]&&_0x3e954e['push'](util['format'](_0xc23b('0x11'),_0x5e86a8['key'],_0x227579[_0x5e86a8[_0xc23b('0x9')]]));}else if(_0x5e86a8[_0xc23b('0x13')]===_0xc23b('0xb')&&_0x5e86a8[_0xc23b('0xd')]&&_0x5e86a8[_0xc23b('0xd')][_0xc23b('0xc')]&&_0x5e86a8[_0xc23b('0x10')]){_0x227579[_0x5e86a8[_0xc23b('0xd')][_0xc23b('0xc')][_0xc23b('0xe')]()]&&_0x3e954e[_0xc23b('0x7')](util[_0xc23b('0x14')](_0xc23b('0x11'),_0x5e86a8[_0xc23b('0x10')],_0x227579[_0x5e86a8[_0xc23b('0xd')]['name']['toLowerCase']()]));}}}}return _0x3e954e[_0xc23b('0x15')](_0x24d68d);};exports[_0xc23b('0x16')]=function(_0x32e437){var _0x2172fa=_0x32e437[_0xc23b('0x17')](-0x1);if(_0x2172fa==='/'){_0x32e437=_0x32e437[_0xc23b('0x18')](0x0,_0x32e437[_0xc23b('0x19')](_0x2172fa));}return _0x32e437;};exports[_0xc23b('0x1a')]=function(_0x3d0018){if(!_[_0xc23b('0x1b')](_0x3d0018)&&_0x3d0018!==''){var _0x556891=/^(([^<>()\[\]\\.,;:\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 _0x556891[_0xc23b('0x1c')](String(_0x3d0018)[_0xc23b('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xecd7=['toString','customVariable','Variable','name','toLowerCase','format','%s:\x20%s','key','keyType','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','sortBy','type','string','push','variable','variableName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecd7,0xb8));var _0x7ecd=function(_0x50c270,_0x570969){_0x50c270=_0x50c270-0x0;var _0x1cd79b=_0xecd7[_0x50c270];return _0x1cd79b;};'use strict';var _=require(_0x7ecd('0x0'));var util=require(_0x7ecd('0x1'));exports['getString']=function(_0x41ee56,_0x2ce049,_0x851f00){var _0x401d71=[];if(_0x41ee56['length']>0x0){var _0x92dd08=_[_0x7ecd('0x2')](_0x41ee56,['id']);for(var _0x127495=0x0;_0x127495<_0x92dd08['length'];_0x127495++){var _0x58c3d5=_0x92dd08[_0x127495];if(_0x58c3d5[_0x7ecd('0x3')]===_0x7ecd('0x4')){_0x401d71[_0x7ecd('0x5')](_0x58c3d5['content']);}else if(_0x58c3d5[_0x7ecd('0x3')]===_0x7ecd('0x6')&&_0x58c3d5[_0x7ecd('0x7')]){_0x2ce049[_0x58c3d5[_0x7ecd('0x7')]]&&_0x401d71['push'](_0x2ce049[_0x58c3d5[_0x7ecd('0x7')]][_0x7ecd('0x8')]());}else if(_0x58c3d5[_0x7ecd('0x3')]===_0x7ecd('0x9')&&_0x58c3d5['Variable']&&_0x58c3d5[_0x7ecd('0xa')]['name']){_0x2ce049[_0x58c3d5[_0x7ecd('0xa')][_0x7ecd('0xb')][_0x7ecd('0xc')]()]&&_0x401d71[_0x7ecd('0x5')](_0x2ce049[_0x58c3d5[_0x7ecd('0xa')]['name'][_0x7ecd('0xc')]()][_0x7ecd('0x8')]());}else if(_0x58c3d5[_0x7ecd('0x3')]==='keyValue'){if(_0x58c3d5['keyType']===_0x7ecd('0x4')&&_0x58c3d5['key']){_0x401d71[_0x7ecd('0x5')](util[_0x7ecd('0xd')](_0x7ecd('0xe'),_0x58c3d5[_0x7ecd('0xf')],_0x58c3d5['keyContent']));}else if(_0x58c3d5['keyType']===_0x7ecd('0x6')&&_0x58c3d5[_0x7ecd('0x7')]&&_0x58c3d5['key']){_0x2ce049[_0x58c3d5['variableName']]&&_0x401d71[_0x7ecd('0x5')](util['format'](_0x7ecd('0xe'),_0x58c3d5['key'],_0x2ce049[_0x58c3d5[_0x7ecd('0x7')]]));}else if(_0x58c3d5[_0x7ecd('0x10')]===_0x7ecd('0x9')&&_0x58c3d5[_0x7ecd('0xa')]&&_0x58c3d5[_0x7ecd('0xa')]['name']&&_0x58c3d5[_0x7ecd('0xf')]){_0x2ce049[_0x58c3d5[_0x7ecd('0xa')]['name'][_0x7ecd('0xc')]()]&&_0x401d71[_0x7ecd('0x5')](util[_0x7ecd('0xd')]('%s:\x20%s',_0x58c3d5[_0x7ecd('0xf')],_0x2ce049[_0x58c3d5['Variable'][_0x7ecd('0xb')][_0x7ecd('0xc')]()]));}}}}return _0x401d71['join'](_0x851f00);};exports[_0x7ecd('0x11')]=function(_0x55dd8c){var _0x4437ac=_0x55dd8c[_0x7ecd('0x12')](-0x1);if(_0x4437ac==='/'){_0x55dd8c=_0x55dd8c[_0x7ecd('0x13')](0x0,_0x55dd8c[_0x7ecd('0x14')](_0x4437ac));}return _0x55dd8c;};exports[_0x7ecd('0x15')]=function(_0x1440fe){if(!_[_0x7ecd('0x16')](_0x1440fe)&&_0x1440fe!==''){var _0x3f5adb=/^(([^<>()\[\]\\.,;:\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 _0x3f5adb[_0x7ecd('0x17')](String(_0x1440fe)[_0x7ecd('0xc')]());}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 ddaefd6..b493e87 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x352da4,_0x24fd36){var _0x183e4c=function(_0x21373c){while(--_0x21373c){_0x352da4['push'](_0x352da4['shift']());}};_0x183e4c(++_0x24fd36);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index fd04738..82d68b5 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 _0x5b20=['outbound','recordingFormat','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','toLowerCase','content','picklist','idField','customField','push','variable','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect'];(function(_0x291ac6,_0x3290fe){var _0x5cd7d4=function(_0x473ba0){while(--_0x473ba0){_0x291ac6['push'](_0x291ac6['shift']());}};_0x5cd7d4(++_0x3290fe);}(_0x5b20,0x80));var _0x05b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b20[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x05b2('0x0'));var rp=require(_0x05b2('0x1'));var md5=require(_0x05b2('0x2'));var util=require(_0x05b2('0x3'));var Redis=require(_0x05b2('0x4'));var intUtil=require(_0x05b2('0x5'));var config=require(_0x05b2('0x6'));var logger=require(_0x05b2('0x7'))(_0x05b2('0x8'));config['redis']=_[_0x05b2('0x9')](config[_0x05b2('0xa')],{'host':_0x05b2('0xb'),'port':0x18eb});var io=require(_0x05b2('0xc'))(new Redis(config[_0x05b2('0xa')]));function emit(_0x2c0831,_0x2263e7,_0xe0ab13){io['to'](_0x2c0831)['emit'](_0x2263e7,_0xe0ab13);}var headers={'Content-Type':'application/json','Accept':_0x05b2('0xd')};function getTicket(_0x344144,_0x5adcbf,_0x53d334,_0x30c281,_0x3b9c41){logger[_0x05b2('0xe')](_0x05b2('0xf'));return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x11'),_0x344144['remoteUri']),'method':_0x05b2('0x12'),'body':{'ticket':_[_0x05b2('0x13')]({'requester_id':_0x53d334['id'],'submitter_id':_0x5adcbf?_0x5adcbf['id']:undefined,'assignee_id':_0x5adcbf?_0x5adcbf['id']:undefined,'tags':getTags(_0x30c281[_0x05b2('0x14')],_0x05b2('0x15')),'subject':intUtil[_0x05b2('0x16')](_0x30c281[_0x05b2('0x17')],_0x3b9c41,'\x20'),'description':intUtil[_0x05b2('0x16')](_0x30c281[_0x05b2('0x18')],_0x3b9c41,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x30c281['Descriptions'],_0x3b9c41,'\x0a')}},getCustomFields(_0x30c281[_0x05b2('0x19')],_0x3b9c41))}})[_0x05b2('0x1a')](function(_0x1bbab0){logger[_0x05b2('0xe')](_0x05b2('0x1b'));return _0x1bbab0[_0x05b2('0x1c')];});}function getUser(_0x28154b,_0x31513e){if(intUtil[_0x05b2('0x1d')](_0x31513e)){logger[_0x05b2('0xe')](_0x05b2('0x1e'),_0x31513e);return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x1f'),_0x28154b[_0x05b2('0x20')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x31513e)}})[_0x05b2('0x1a')](function(_0x26c458){if(_0x26c458[_0x05b2('0x21')]){logger[_0x05b2('0xe')](_0x05b2('0x22'));return _[_0x05b2('0x23')](_0x26c458[_0x05b2('0x24')],{'email':_0x31513e,'role':_0x05b2('0x25')});}else{logger[_0x05b2('0xe')](_0x05b2('0x26'));return request({'uri':util[_0x05b2('0x10')]('%s/users/me.json',_0x28154b[_0x05b2('0x20')])})[_0x05b2('0x1a')](function(_0x1321a1){logger['info'](_0x05b2('0x27'));return _0x1321a1[_0x05b2('0x28')];});}});}else{logger['info'](_0x05b2('0x26'));return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x29'),_0x28154b['remoteUri'])})[_0x05b2('0x1a')](function(_0x42dfa8){logger['info'](_0x05b2('0x27'));return _0x42dfa8['user'];});}}function getEndUser(_0x40592b,_0x3536d0,_0x490a69){logger[_0x05b2('0xe')](_0x05b2('0x2a'),_0x490a69);return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x1f'),_0x40592b[_0x05b2('0x20')]),'qs':{'query':util['format'](_0x05b2('0x2b'),_0x490a69)}})[_0x05b2('0x1a')](function(_0x30e40b){var _0x34fb99;if(_0x30e40b[_0x05b2('0x24')][_0x05b2('0x2c')]){_0x30e40b[_0x05b2('0x24')]=_[_0x05b2('0x2d')](_0x30e40b['results'],{'suspended':![],'role':'end-user'});if(_0x30e40b[_0x05b2('0x24')][_0x05b2('0x2c')]){_0x34fb99=_[_0x05b2('0x2e')](_0x30e40b[_0x05b2('0x24')]);}}if(_0x34fb99){logger[_0x05b2('0xe')](_0x05b2('0x2f'));return _0x34fb99;}else{logger[_0x05b2('0xe')](_0x05b2('0x30'));return request({'uri':util[_0x05b2('0x10')]('%s/users.json',_0x40592b[_0x05b2('0x20')]),'method':_0x05b2('0x12'),'body':{'user':{'role':'end-user','name':util['format']('Caller\x20-\x20%s',_0x3536d0||_0x490a69),'phone':_0x490a69}}})['then'](function(_0x411fa2){logger[_0x05b2('0xe')](_0x05b2('0x31'));return _0x411fa2[_0x05b2('0x28')];});}});}function getAuth(_0x3f4c68){var _0x420136;if(_0x3f4c68[_0x05b2('0x32')]===_0x05b2('0x33')){_0x420136=util[_0x05b2('0x10')](_0x05b2('0x34'),_0x3f4c68[_0x05b2('0x35')],_0x3f4c68['password']);}else if(_0x3f4c68[_0x05b2('0x32')]===_0x05b2('0x36')){_0x420136=util[_0x05b2('0x10')]('%s/token:%s',_0x3f4c68[_0x05b2('0x35')],_0x3f4c68['token']);}return util['format'](_0x05b2('0x37'),new Buffer(_0x420136)[_0x05b2('0x38')]('base64'));}function request(_0x186ab1){logger['debug'](_0x05b2('0x39'),JSON[_0x05b2('0x3a')](_0x186ab1));return rp(_[_0x05b2('0x9')](_0x186ab1,{'method':_0x05b2('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x2808e1,_0x5d204e){var _0x1e86ff=[];if(_0x2808e1&&_0x2808e1[_0x05b2('0x2c')]>0x0){_0x1e86ff=_[_0x05b2('0x3c')](_0x2808e1,_0x5d204e);}return _0x1e86ff;}function getCustomFields(_0x418cb0,_0xf10abd){var _0x1184cf=[];var _0x4d4194={'custom_fields':[]};if(_0x418cb0[_0x05b2('0x2c')]>0x0){_[_0x05b2('0x3d')](_0x418cb0,function(_0x42221f){if(_[_0x05b2('0x3e')]([_0x05b2('0x3f'),'picklist'],_0x42221f[_0x05b2('0x40')])&&_0x42221f['nameField']&&!_0x42221f['customField']){_0x4d4194[_0x42221f[_0x05b2('0x41')][_0x05b2('0x42')]()]=_0x42221f[_0x05b2('0x43')][_0x05b2('0x38')]();}else if(_['includes']([_0x05b2('0x3f'),_0x05b2('0x44')],_0x42221f['type'])&&_0x42221f[_0x05b2('0x45')]&&_0x42221f[_0x05b2('0x46')]){_0x4d4194['custom_fields'][_0x05b2('0x47')]({'id':_0x42221f['idField'],'value':_0x42221f['content'][_0x05b2('0x38')]()});}else if(_0x42221f['type']===_0x05b2('0x48')&&_0x42221f[_0x05b2('0x49')]&&_0x42221f[_0x05b2('0x45')]&&_0x42221f[_0x05b2('0x46')]){_0xf10abd[_0x42221f[_0x05b2('0x49')]]&&_0x4d4194[_0x05b2('0x4a')][_0x05b2('0x47')]({'id':_0x42221f[_0x05b2('0x45')],'value':_0xf10abd[_0x42221f[_0x05b2('0x49')]][_0x05b2('0x38')]()});}else if(_0x42221f['type']===_0x05b2('0x4b')&&_0x42221f[_0x05b2('0x4c')]&&_0x42221f[_0x05b2('0x4c')][_0x05b2('0x15')]&&_0x42221f['idField']&&_0x42221f[_0x05b2('0x46')]){_0xf10abd[_0x42221f['Variable'][_0x05b2('0x15')]['toLowerCase']()]&&_0x4d4194['custom_fields']['push']({'id':_0x42221f[_0x05b2('0x45')],'value':_0xf10abd[_0x42221f[_0x05b2('0x4c')][_0x05b2('0x15')][_0x05b2('0x42')]()][_0x05b2('0x38')]()});}});}return _0x4d4194;}exports[_0x05b2('0x4d')]=function(_0x205d62,_0x3193ed,_0x462bfe,_0x3a7dcf,_0x357f98,_0x45d8d8){var _0x3acc6b,_0x298913;_0x45d8d8[_0x05b2('0x20')]=intUtil[_0x05b2('0x4e')](_0x45d8d8[_0x05b2('0x20')]);_0x45d8d8[_0x05b2('0x4f')]=intUtil[_0x05b2('0x4e')](_0x45d8d8[_0x05b2('0x4f')]);if(_0x357f98&&_0x357f98[_0x05b2('0x50')]){logger[_0x05b2('0xe')](_0x05b2('0x51'),_0x05b2('0x52'));_0x3193ed[_0x05b2('0x53')]=util[_0x05b2('0x10')](_0x05b2('0x54'),_0x45d8d8[_0x05b2('0x4f')],_0x3193ed[_0x05b2('0x55')],md5(_0x3193ed['uniqueid']));}else{_0x3193ed[_0x05b2('0x53')]='';}headers[_0x05b2('0x56')]=getAuth(_0x45d8d8);return getUser(_0x45d8d8,_0x3a7dcf[_0x05b2('0x57')])['then'](function(_0xc656fa){_0x3acc6b=_0xc656fa;logger[_0x05b2('0xe')](_0x05b2('0x58'),_0x3acc6b['id']);return getEndUser(_0x45d8d8,_0x3193ed[_0x05b2('0x59')],_0x3193ed[_0x05b2('0x5a')]);})[_0x05b2('0x1a')](function(_0x1440ea){_0x298913=_0x1440ea;logger[_0x05b2('0xe')]('The\x20Enduser\x20ID\x20is:',_0x298913['id']);return getTicket(_0x45d8d8,_0x3acc6b,_0x298913,_0x462bfe,_0x3193ed);})[_0x05b2('0x1a')](function(_0x4a029d){if(_0x4a029d){logger['info'](_0x05b2('0x5b'),_0x4a029d['id']);switch(_0x45d8d8['type']){case _0x05b2('0x5c'):logger[_0x05b2('0xe')]('[QUEUE]',_0x05b2('0x5d'));return request({'uri':util[_0x05b2('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x45d8d8[_0x05b2('0x20')],_0x3acc6b['id'],_0x4a029d['id']),'method':_0x05b2('0x12')});case'newTab':logger['info'](_0x05b2('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x05b2('0x5e'),_0x3a7dcf['name']),'trigger:browser:url',{'uri':util[_0x05b2('0x10')](_0x05b2('0x5f'),_0x45d8d8[_0x05b2('0x20')]['replace'](_0x05b2('0x60'),''),_0x4a029d['id'])});break;default:logger[_0x05b2('0x61')](_0x05b2('0x51'),_0x05b2('0x62'));}}})[_0x05b2('0x63')](function(_0x4dfe45){logger[_0x05b2('0x61')](_0x05b2('0x64'),util[_0x05b2('0x65')](_0x4dfe45,{'showHidden':!![],'depth':null}));});};exports[_0x05b2('0x66')]=function(_0x3f0365,_0x2008ca,_0x1f8b77,_0x4d29b6,_0x472fb6,_0x20e2b9,_0x58aa10){var _0x328d2f,_0x562ac0;_0x20e2b9[_0x05b2('0x20')]=intUtil[_0x05b2('0x4e')](_0x20e2b9['remoteUri']);_0x20e2b9['serverUrl']=intUtil[_0x05b2('0x4e')](_0x20e2b9[_0x05b2('0x4f')]);if(_0x58aa10&&_0x58aa10[_0x05b2('0x67')]&&_0x58aa10[_0x05b2('0x67')]!=='none'){logger['info'](_0x05b2('0x68'),_0x05b2('0x52'));_0x2008ca['recordingURL']=util[_0x05b2('0x10')](_0x05b2('0x54'),_0x20e2b9[_0x05b2('0x4f')],_0x2008ca[_0x05b2('0x55')],md5(_0x2008ca[_0x05b2('0x55')]));}headers[_0x05b2('0x56')]=getAuth(_0x20e2b9);return getUser(_0x20e2b9,_0x4d29b6[_0x05b2('0x57')])[_0x05b2('0x1a')](function(_0x4493ed){_0x328d2f=_0x4493ed;logger['info']('The\x20User\x20ID\x20is:',_0x328d2f['id']);return getEndUser(_0x20e2b9,_0x2008ca[_0x05b2('0x69')],_0x2008ca['destcalleridnum']);})['then'](function(_0xf3902f){_0x562ac0=_0xf3902f;logger[_0x05b2('0xe')](_0x05b2('0x6a'),_0x562ac0['id']);return getTicket(_0x20e2b9,_0x328d2f,_0x562ac0,_0x1f8b77,_0x2008ca);})[_0x05b2('0x1a')](function(_0x29d5f8){if(_0x29d5f8){logger['info'](_0x05b2('0x5b'),_0x29d5f8['id']);switch(_0x20e2b9[_0x05b2('0x40')]){case _0x05b2('0x5c'):logger[_0x05b2('0xe')](_0x05b2('0x68'),_0x05b2('0x5d'));return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x6b'),_0x20e2b9[_0x05b2('0x20')],_0x328d2f['id'],_0x29d5f8['id']),'method':'POST'});case _0x05b2('0x6c'):logger[_0x05b2('0xe')]('[OUTBOUND]',_0x05b2('0x6d'));emit(util[_0x05b2('0x10')](_0x05b2('0x5e'),_0x4d29b6[_0x05b2('0x15')]),_0x05b2('0x6e'),{'uri':util[_0x05b2('0x10')](_0x05b2('0x5f'),_0x20e2b9[_0x05b2('0x20')][_0x05b2('0x6f')](_0x05b2('0x60'),''),_0x29d5f8['id'])});break;default:logger[_0x05b2('0x61')](_0x05b2('0x68'),_0x05b2('0x62'));}}})[_0x05b2('0x63')](function(_0x5f3b8b){logger[_0x05b2('0x61')](_0x05b2('0x70'),util['inspect'](_0x5f3b8b,{'showHidden':!![],'depth':null}));});};exports[_0x05b2('0x71')]=function(_0x50b70b,_0x1d40ad,_0x1606d5,_0x1ee43d,_0x2700d7,_0x2e3f00){var _0x190608,_0x5e2098;_0x2e3f00[_0x05b2('0x20')]=intUtil['stripTrailingSlash'](_0x2e3f00['remoteUri']);_0x2e3f00['serverUrl']=intUtil[_0x05b2('0x4e')](_0x2e3f00[_0x05b2('0x4f')]);if(_0x2700d7&&_0x2700d7[_0x05b2('0x50')]){logger[_0x05b2('0xe')]('['+_0x1d40ad['lastevent'][_0x05b2('0x72')]()+']',_0x05b2('0x52'));_0x1d40ad[_0x05b2('0x53')]=util[_0x05b2('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e3f00[_0x05b2('0x4f')],_0x1d40ad[_0x05b2('0x55')],md5(_0x1d40ad[_0x05b2('0x55')]));}else{_0x1d40ad[_0x05b2('0x53')]='';}headers[_0x05b2('0x56')]=getAuth(_0x2e3f00);return getUser(_0x2e3f00)[_0x05b2('0x1a')](function(_0x1aecc8){_0x190608=_0x1aecc8;logger[_0x05b2('0xe')](_0x05b2('0x58'),_0x190608['id']);return getEndUser(_0x2e3f00,_0x1d40ad[_0x05b2('0x59')],_0x1d40ad['calleridnum']);})[_0x05b2('0x1a')](function(_0xc226f9){_0x5e2098=_0xc226f9;logger['info'](_0x05b2('0x6a'),_0x5e2098['id']);return getTicket(_0x2e3f00,_0x190608,_0x5e2098,_0x1606d5,_0x1d40ad);})[_0x05b2('0x1a')](function(_0x3f1999){if(_0x3f1999){logger[_0x05b2('0xe')](_0x05b2('0x5b'),_0x3f1999['id']);}})[_0x05b2('0x63')](function(_0x346980){logger['error']('['+_0x1d40ad['lastevent'][_0x05b2('0x72')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x05b2('0x65')](_0x346980,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x22a3=['%s/search.json','type:user\x20role:agent\x20email:%s','then','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','user','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','GET','forEach','string','picklist','type','customField','toLowerCase','content','includes','idField','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','ioredis','./util','../../../../config/environment','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0xd6640b,_0x475e47){var _0x4c843e=function(_0x11040f){while(--_0x11040f){_0xd6640b['push'](_0xd6640b['shift']());}};_0x4c843e(++_0x475e47);}(_0x22a3,0x13d));var _0x322a=function(_0x2b6593,_0x2c5e04){_0x2b6593=_0x2b6593-0x0;var _0x59ccf4=_0x22a3[_0x2b6593];return _0x59ccf4;};'use strict';var _=require(_0x322a('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0x322a('0x1'));var intUtil=require(_0x322a('0x2'));var config=require(_0x322a('0x3'));var logger=require('../../../../config/logger')(_0x322a('0x4'));config['redis']=_['defaults'](config[_0x322a('0x5')],{'host':_0x322a('0x6'),'port':0x18eb});var io=require(_0x322a('0x7'))(new Redis(config[_0x322a('0x5')]));function emit(_0x48ef8a,_0x4a8116,_0x4ca182){io['to'](_0x48ef8a)[_0x322a('0x8')](_0x4a8116,_0x4ca182);}var headers={'Content-Type':_0x322a('0x9'),'Accept':_0x322a('0x9')};function getTicket(_0x30512f,_0x1cbcbe,_0x58aa65,_0x325f66,_0x31ddce){logger[_0x322a('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x322a('0xb')](_0x322a('0xc'),_0x30512f[_0x322a('0xd')]),'method':_0x322a('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x58aa65['id'],'submitter_id':_0x1cbcbe?_0x1cbcbe['id']:undefined,'assignee_id':_0x1cbcbe?_0x1cbcbe['id']:undefined,'tags':getTags(_0x325f66[_0x322a('0xf')],_0x322a('0x10')),'subject':intUtil[_0x322a('0x11')](_0x325f66[_0x322a('0x12')],_0x31ddce,'\x20'),'description':intUtil[_0x322a('0x11')](_0x325f66['Descriptions'],_0x31ddce,'\x0a'),'comment':{'public':![],'body':intUtil[_0x322a('0x11')](_0x325f66[_0x322a('0x13')],_0x31ddce,'\x0a')}},getCustomFields(_0x325f66[_0x322a('0x14')],_0x31ddce))}})['then'](function(_0x5b8ef0){logger[_0x322a('0xa')](_0x322a('0x15'));return _0x5b8ef0[_0x322a('0x16')];});}function getUser(_0x975187,_0xf47dab){if(intUtil[_0x322a('0x17')](_0xf47dab)){logger[_0x322a('0xa')](_0x322a('0x18'),_0xf47dab);return request({'uri':util[_0x322a('0xb')](_0x322a('0x19'),_0x975187[_0x322a('0xd')]),'qs':{'query':util[_0x322a('0xb')](_0x322a('0x1a'),_0xf47dab)}})[_0x322a('0x1b')](function(_0x4330ed){if(_0x4330ed['count']){logger[_0x322a('0xa')]('Agent\x20found!');return _[_0x322a('0x1c')](_0x4330ed[_0x322a('0x1d')],{'email':_0xf47dab,'role':_0x322a('0x1e')});}else{logger[_0x322a('0xa')](_0x322a('0x1f'));return request({'uri':util[_0x322a('0xb')]('%s/users/me.json',_0x975187[_0x322a('0xd')])})[_0x322a('0x1b')](function(_0x773348){logger[_0x322a('0xa')]('Admin\x20account\x20selected.');return _0x773348['user'];});}});}else{logger[_0x322a('0xa')](_0x322a('0x1f'));return request({'uri':util['format'](_0x322a('0x20'),_0x975187[_0x322a('0xd')])})[_0x322a('0x1b')](function(_0x56cf4e){logger['info'](_0x322a('0x21'));return _0x56cf4e['user'];});}}function getEndUser(_0x594eb7,_0x4df456,_0x1842d8){logger[_0x322a('0xa')](_0x322a('0x22'),_0x1842d8);return request({'uri':util['format'](_0x322a('0x19'),_0x594eb7['remoteUri']),'qs':{'query':util[_0x322a('0xb')](_0x322a('0x23'),_0x1842d8)}})['then'](function(_0x399fe9){var _0x1f51f8;if(_0x399fe9[_0x322a('0x1d')][_0x322a('0x24')]){_0x399fe9['results']=_[_0x322a('0x25')](_0x399fe9[_0x322a('0x1d')],{'suspended':![],'role':_0x322a('0x26')});if(_0x399fe9['results'][_0x322a('0x24')]){_0x1f51f8=_[_0x322a('0x27')](_0x399fe9[_0x322a('0x1d')]);}}if(_0x1f51f8){logger[_0x322a('0xa')](_0x322a('0x28'));return _0x1f51f8;}else{logger[_0x322a('0xa')](_0x322a('0x29'));return request({'uri':util['format'](_0x322a('0x2a'),_0x594eb7['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x322a('0xb')](_0x322a('0x2b'),_0x4df456||_0x1842d8),'phone':_0x1842d8}}})[_0x322a('0x1b')](function(_0x223018){logger[_0x322a('0xa')]('Enduser\x20created.');return _0x223018[_0x322a('0x2c')];});}});}function getAuth(_0xfed557){var _0x20b9d1;if(_0xfed557['authType']===_0x322a('0x2d')){_0x20b9d1=util[_0x322a('0xb')](_0x322a('0x2e'),_0xfed557[_0x322a('0x2f')],_0xfed557['password']);}else if(_0xfed557[_0x322a('0x30')]===_0x322a('0x31')){_0x20b9d1=util['format'](_0x322a('0x32'),_0xfed557[_0x322a('0x2f')],_0xfed557[_0x322a('0x31')]);}return util[_0x322a('0xb')](_0x322a('0x33'),new Buffer(_0x20b9d1)[_0x322a('0x34')](_0x322a('0x35')));}function request(_0x293794){logger['debug'](_0x322a('0x36'),JSON[_0x322a('0x37')](_0x293794));return rp(_[_0x322a('0x38')](_0x293794,{'method':_0x322a('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x2b09f7,_0x507493){var _0x5b216e=[];if(_0x2b09f7&&_0x2b09f7[_0x322a('0x24')]>0x0){_0x5b216e=_['map'](_0x2b09f7,_0x507493);}return _0x5b216e;}function getCustomFields(_0x519b65,_0x3dfc87){var _0x359f96=[];var _0x101546={'custom_fields':[]};if(_0x519b65[_0x322a('0x24')]>0x0){_[_0x322a('0x3a')](_0x519b65,function(_0xfbc818){if(_['includes']([_0x322a('0x3b'),_0x322a('0x3c')],_0xfbc818[_0x322a('0x3d')])&&_0xfbc818['nameField']&&!_0xfbc818[_0x322a('0x3e')]){_0x101546[_0xfbc818['nameField'][_0x322a('0x3f')]()]=_0xfbc818[_0x322a('0x40')][_0x322a('0x34')]();}else if(_[_0x322a('0x41')]([_0x322a('0x3b'),_0x322a('0x3c')],_0xfbc818[_0x322a('0x3d')])&&_0xfbc818['idField']&&_0xfbc818[_0x322a('0x3e')]){_0x101546['custom_fields']['push']({'id':_0xfbc818[_0x322a('0x42')],'value':_0xfbc818[_0x322a('0x40')][_0x322a('0x34')]()});}else if(_0xfbc818[_0x322a('0x3d')]==='variable'&&_0xfbc818[_0x322a('0x43')]&&_0xfbc818[_0x322a('0x42')]&&_0xfbc818['customField']){_0x3dfc87[_0xfbc818['variableName']]&&_0x101546[_0x322a('0x44')][_0x322a('0x45')]({'id':_0xfbc818[_0x322a('0x42')],'value':_0x3dfc87[_0xfbc818['variableName']][_0x322a('0x34')]()});}else if(_0xfbc818[_0x322a('0x3d')]===_0x322a('0x46')&&_0xfbc818[_0x322a('0x47')]&&_0xfbc818[_0x322a('0x47')][_0x322a('0x10')]&&_0xfbc818['idField']&&_0xfbc818['customField']){_0x3dfc87[_0xfbc818[_0x322a('0x47')][_0x322a('0x10')][_0x322a('0x3f')]()]&&_0x101546[_0x322a('0x44')][_0x322a('0x45')]({'id':_0xfbc818[_0x322a('0x42')],'value':_0x3dfc87[_0xfbc818[_0x322a('0x47')][_0x322a('0x10')][_0x322a('0x3f')]()]['toString']()});}});}return _0x101546;}exports[_0x322a('0x48')]=function(_0x51b0ca,_0x4eee7e,_0x5caaad,_0x30abea,_0x1e89aa,_0x3c5fbc){var _0x4088cb,_0x3eca56;_0x3c5fbc['remoteUri']=intUtil[_0x322a('0x49')](_0x3c5fbc[_0x322a('0xd')]);_0x3c5fbc[_0x322a('0x4a')]=intUtil[_0x322a('0x49')](_0x3c5fbc['serverUrl']);if(_0x1e89aa&&_0x1e89aa[_0x322a('0x4b')]){logger[_0x322a('0xa')](_0x322a('0x4c'),_0x322a('0x4d'));_0x4eee7e[_0x322a('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c5fbc[_0x322a('0x4a')],_0x4eee7e[_0x322a('0x4f')],md5(_0x4eee7e[_0x322a('0x4f')]));}else{_0x4eee7e[_0x322a('0x4e')]='';}headers[_0x322a('0x50')]=getAuth(_0x3c5fbc);return getUser(_0x3c5fbc,_0x30abea[_0x322a('0x51')])[_0x322a('0x1b')](function(_0x20a4c4){_0x4088cb=_0x20a4c4;logger['info']('The\x20User\x20ID\x20is:',_0x4088cb['id']);return getEndUser(_0x3c5fbc,_0x4eee7e[_0x322a('0x52')],_0x4eee7e[_0x322a('0x53')]);})[_0x322a('0x1b')](function(_0xa9da0c){_0x3eca56=_0xa9da0c;logger[_0x322a('0xa')](_0x322a('0x54'),_0x3eca56['id']);return getTicket(_0x3c5fbc,_0x4088cb,_0x3eca56,_0x5caaad,_0x4eee7e);})[_0x322a('0x1b')](function(_0x20ecb2){if(_0x20ecb2){logger[_0x322a('0xa')](_0x322a('0x55'),_0x20ecb2['id']);switch(_0x3c5fbc['type']){case _0x322a('0x56'):logger[_0x322a('0xa')]('[QUEUE]',_0x322a('0x57'));return request({'uri':util[_0x322a('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3c5fbc['remoteUri'],_0x4088cb['id'],_0x20ecb2['id']),'method':'POST'});case'newTab':logger[_0x322a('0xa')](_0x322a('0x4c'),_0x322a('0x58'));emit(util[_0x322a('0xb')]('user:%s',_0x30abea[_0x322a('0x10')]),_0x322a('0x59'),{'uri':util[_0x322a('0xb')](_0x322a('0x5a'),_0x3c5fbc[_0x322a('0xd')]['replace'](_0x322a('0x5b'),''),_0x20ecb2['id'])});break;default:logger['error'](_0x322a('0x4c'),_0x322a('0x5c'));}}})['catch'](function(_0x22184c){logger[_0x322a('0x5d')](_0x322a('0x5e'),util[_0x322a('0x5f')](_0x22184c,{'showHidden':!![],'depth':null}));});};exports[_0x322a('0x60')]=function(_0x403a75,_0x3779f4,_0x366004,_0x4f56c5,_0x491907,_0x1b6905,_0x897f6){var _0x39cf0d,_0x49bbc0;_0x1b6905['remoteUri']=intUtil[_0x322a('0x49')](_0x1b6905[_0x322a('0xd')]);_0x1b6905[_0x322a('0x4a')]=intUtil[_0x322a('0x49')](_0x1b6905['serverUrl']);if(_0x897f6&&_0x897f6[_0x322a('0x61')]&&_0x897f6[_0x322a('0x61')]!==_0x322a('0x62')){logger[_0x322a('0xa')](_0x322a('0x63'),_0x322a('0x4d'));_0x3779f4[_0x322a('0x4e')]=util[_0x322a('0xb')](_0x322a('0x64'),_0x1b6905['serverUrl'],_0x3779f4[_0x322a('0x4f')],md5(_0x3779f4['uniqueid']));}headers[_0x322a('0x50')]=getAuth(_0x1b6905);return getUser(_0x1b6905,_0x4f56c5['email'])[_0x322a('0x1b')](function(_0x4d8ef3){_0x39cf0d=_0x4d8ef3;logger['info'](_0x322a('0x65'),_0x39cf0d['id']);return getEndUser(_0x1b6905,_0x3779f4[_0x322a('0x66')],_0x3779f4[_0x322a('0x67')]);})[_0x322a('0x1b')](function(_0x273e44){_0x49bbc0=_0x273e44;logger[_0x322a('0xa')](_0x322a('0x54'),_0x49bbc0['id']);return getTicket(_0x1b6905,_0x39cf0d,_0x49bbc0,_0x366004,_0x3779f4);})[_0x322a('0x1b')](function(_0x34728a){if(_0x34728a){logger[_0x322a('0xa')](_0x322a('0x55'),_0x34728a['id']);switch(_0x1b6905['type']){case _0x322a('0x56'):logger[_0x322a('0xa')](_0x322a('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x322a('0x68'),_0x1b6905[_0x322a('0xd')],_0x39cf0d['id'],_0x34728a['id']),'method':'POST'});case _0x322a('0x69'):logger[_0x322a('0xa')](_0x322a('0x63'),_0x322a('0x58'));emit(util['format'](_0x322a('0x6a'),_0x4f56c5['name']),_0x322a('0x59'),{'uri':util[_0x322a('0xb')](_0x322a('0x5a'),_0x1b6905[_0x322a('0xd')][_0x322a('0x6b')]('/api/v2',''),_0x34728a['id'])});break;default:logger['error']('[OUTBOUND]',_0x322a('0x5c'));}}})['catch'](function(_0x57b160){logger[_0x322a('0x5d')](_0x322a('0x6c'),util[_0x322a('0x5f')](_0x57b160,{'showHidden':!![],'depth':null}));});};exports[_0x322a('0x6d')]=function(_0x5572df,_0x188ae4,_0x16fba2,_0x539946,_0x1f182f,_0x4c22a2){var _0x38540e,_0x3d52e7;_0x4c22a2[_0x322a('0xd')]=intUtil[_0x322a('0x49')](_0x4c22a2[_0x322a('0xd')]);_0x4c22a2[_0x322a('0x4a')]=intUtil['stripTrailingSlash'](_0x4c22a2[_0x322a('0x4a')]);if(_0x1f182f&&_0x1f182f[_0x322a('0x4b')]){logger[_0x322a('0xa')]('['+_0x188ae4[_0x322a('0x6e')][_0x322a('0x6f')]()+']',_0x322a('0x4d'));_0x188ae4['recordingURL']=util[_0x322a('0xb')](_0x322a('0x64'),_0x4c22a2[_0x322a('0x4a')],_0x188ae4['uniqueid'],md5(_0x188ae4[_0x322a('0x4f')]));}else{_0x188ae4[_0x322a('0x4e')]='';}headers[_0x322a('0x50')]=getAuth(_0x4c22a2);return getUser(_0x4c22a2)[_0x322a('0x1b')](function(_0x53b856){_0x38540e=_0x53b856;logger['info'](_0x322a('0x65'),_0x38540e['id']);return getEndUser(_0x4c22a2,_0x188ae4[_0x322a('0x52')],_0x188ae4[_0x322a('0x53')]);})[_0x322a('0x1b')](function(_0x1ed237){_0x3d52e7=_0x1ed237;logger[_0x322a('0xa')](_0x322a('0x54'),_0x3d52e7['id']);return getTicket(_0x4c22a2,_0x38540e,_0x3d52e7,_0x16fba2,_0x188ae4);})[_0x322a('0x1b')](function(_0x56cb65){if(_0x56cb65){logger[_0x322a('0xa')](_0x322a('0x55'),_0x56cb65['id']);}})[_0x322a('0x70')](function(_0x50e98a){logger[_0x322a('0x5d')]('['+_0x188ae4['lastevent'][_0x322a('0x6f')]()+']'+_0x322a('0x71'),util[_0x322a('0x5f')](_0x50e98a,{'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 8c553e7..ed51fe8 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 _0x984b=['details','enduserType','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','stack','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','none','/downloads?type=uniqueid&token=','com','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','monitor_format','toUpperCase','The\x20User\x20ID\x20is:','calleridnum','lastevent','util','./util','moment','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','idField','toString','type','variableName','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','catch','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS'];(function(_0x4d522c,_0x5c15e4){var _0x34a72e=function(_0x47e107){while(--_0x47e107){_0x4d522c['push'](_0x4d522c['shift']());}};_0x34a72e(++_0x5c15e4);}(_0x984b,0xee));var _0xb984=function(_0x493f30,_0x21d8b6){_0x493f30=_0x493f30-0x0;var _0x19c13a=_0x984b[_0x493f30];return _0x19c13a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xb984('0x0'));var intUtil=require(_0xb984('0x1'));var moment=require(_0xb984('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xb984('0x3'));var logger=require(_0xb984('0x4'))('zoho');config['redis']=_[_0xb984('0x5')](config[_0xb984('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb984('0x7'))(new Redis(config[_0xb984('0x6')]));function emit(_0x4d72b7,_0x37fd36,_0x4e6b9a){io['to'](_0x4d72b7)[_0xb984('0x8')](_0x37fd36,_0x4e6b9a);}function request(_0x42dfd9){logger[_0xb984('0x9')](_0xb984('0xa'),JSON[_0xb984('0xb')](_0x42dfd9));return rp(_0x42dfd9);}function getCustomFields(_0x382f2b,_0x11525c){var _0xfca315={};if(_0x382f2b[_0xb984('0xc')]>0x0){_[_0xb984('0xd')](_0x382f2b,function(_0x1f107f){if(_[_0xb984('0xe')](['string',_0xb984('0xf')],_0x1f107f['type'])&&_0x1f107f[_0xb984('0x10')]){_0xfca315[_0x1f107f[_0xb984('0x10')]]=_0x1f107f['content'][_0xb984('0x11')]();}else if(_0x1f107f[_0xb984('0x12')]==='variable'&&_0x1f107f[_0xb984('0x13')]&&_0x1f107f[_0xb984('0x10')]&&_0x11525c[_0x1f107f['variableName']]){_0xfca315[_0x1f107f[_0xb984('0x10')]]=_0x11525c[_0x1f107f[_0xb984('0x13')]]['toString']();}else if(_0x1f107f[_0xb984('0x12')]==='customVariable'&&_0x1f107f[_0xb984('0x14')]&&_0x1f107f[_0xb984('0x14')][_0xb984('0x15')]&&_0x1f107f[_0xb984('0x10')]&&_0x11525c[_0x1f107f['Variable'][_0xb984('0x15')][_0xb984('0x16')]()]){_0xfca315[_0x1f107f[_0xb984('0x10')]]=_0x11525c[_0x1f107f[_0xb984('0x14')][_0xb984('0x15')][_0xb984('0x16')]()]['toString']();}});}return _0xfca315;}function getName(_0x2492f4){if(_0x2492f4[_0xb984('0x17')]('\x20')>0x0){var _0x694978=_0x2492f4[_0xb984('0x18')](/ (.+)/);if(_0x694978[0x1]){return _0x694978;}}return[_0x2492f4,_0x2492f4];}var accountsTokens={};function getAccessToken(_0x32831b){return new Promise(function(_0xcf9365,_0x54dd81){if(!_[_0xb984('0x19')](accountsTokens[_0x32831b['id']])&&!_[_0xb984('0x19')](accountsTokens[_0x32831b['id']]['access_token'])){if(moment()[_0xb984('0x1a')](accountsTokens[_0x32831b['id']][_0xb984('0x1b')])){_0xcf9365(accountsTokens[_0x32831b['id']][_0xb984('0x1c')]);}}var _0x932579;switch(_0x32831b[_0xb984('0x1d')]){case'US':_0x932579=_0xb984('0x1e');break;case'AU':_0x932579=_0xb984('0x1f');break;case'EU':_0x932579='https://accounts.zoho.eu';break;case'IN':_0x932579=_0xb984('0x20');break;case'CN':_0x932579=_0xb984('0x21');break;default:_0x932579=_0xb984('0x22');break;}var _0x5d4d38={'method':_0xb984('0x23'),'uri':_0x932579+_0xb984('0x24'),'qs':{'refresh_token':_0x32831b[_0xb984('0x25')],'client_id':_0x32831b[_0xb984('0x26')],'client_secret':_0x32831b[_0xb984('0x27')],'grant_type':_0xb984('0x28')},'json':!![]};return rp(_0x5d4d38)[_0xb984('0x29')](function(_0x4b3da0){accountsTokens[_0x32831b['id']]={'access_token':_0x4b3da0['access_token'],'expires_in':moment()[_0xb984('0x2a')](_0x4b3da0[_0xb984('0x1b')],_0xb984('0x2b'))};_0xcf9365(_0x4b3da0[_0xb984('0x1c')]);})['catch'](function(_0xa44895){logger[_0xb984('0x2c')](_0xb984('0x2d'),_0xa44895['stack']);_0x54dd81(_0xa44895);});});}function getUser(_0x363e33,_0x311e22,_0x2012ca,_0x3d2757){logger['info']('Search\x20user');return request({'method':'GET','uri':util[_0xb984('0x2e')](_0xb984('0x2f'),_0x311e22),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xb984('0x30')+_0x363e33},'json':!![]})[_0xb984('0x29')](function(_0x30d338){if(_0x30d338[_0xb984('0x31')]){var _0x518bef=-0x1;if(_['isArrayLikeObject'](_0x30d338[_0xb984('0x31')])){if(!_[_0xb984('0x19')](_0x3d2757)){_0x518bef=_[_0xb984('0x32')](_0x30d338[_0xb984('0x31')],function(_0x4df9e0){return _0x4df9e0[_0xb984('0x33')]===_0x3d2757;});}if(_0x518bef>=0x0){logger[_0xb984('0x34')](_0xb984('0x35'));}else{logger[_0xb984('0x34')](_0xb984('0x36'));_0x518bef=_[_0xb984('0x32')](_0x30d338['users'],function(_0x54a293){return _0x54a293[_0xb984('0x37')][_0xb984('0x15')]===_0xb984('0x38');});}return _0x30d338[_0xb984('0x31')][_0x518bef];}else{if(_0x30d338[_0xb984('0x39')]['profile'][_0xb984('0x15')]===_0xb984('0x38')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x30d338[_0xb984('0x39')];return user;}else{logger['error'](_0xb984('0x3a'),JSON[_0xb984('0xb')](_0x30d338));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xb984('0xb')](_0x30d338));}}}else{logger['error'](_0xb984('0x3a'),JSON['stringify'](_0x30d338));throw new Error(_0xb984('0x3b')+JSON['stringify'](_0x30d338));}})['catch'](function(_0xf6d925){console[_0xb984('0x2c')](_0xf6d925);});}function getZohoUser(_0x4dac3f,_0x26b36c){return new BPromise(function(_0x1fd248,_0x4a8171){request(_0x4dac3f)[_0xb984('0x29')](function(_0x446f45){var _0x1a635b=null;if(_0x446f45){_0x1a635b=_0x446f45[_0xb984('0x3c')][0x0];_0x1a635b['enduserType']=_0x26b36c;}_0x1fd248(_0x1a635b);})[_0xb984('0x3d')](function(_0x4d6511){_0x4a8171(_0x4d6511);});});}function createEndUser(_0x383c87,_0x474fbd,_0x2d93d5,_0x345a60,_0xc257ee,_0x2e625a){var _0x2d93d5=getName(_0x2d93d5);return request({'method':_0xb984('0x23'),'uri':'https://www.zohoapis.'+_0x474fbd+_0xb984('0x3e')+_[_0xb984('0x3f')](_0x2e625a[_0xb984('0x40')])+'s','body':{'data':[{'Last_Name':_0x2d93d5[0x1],'First_Name':_0x2d93d5[0x0],'Phone':_0x345a60,'Owner':{'name':!_[_0xb984('0x19')](_0xc257ee[_0xb984('0x41')][_0xb984('0x15')])?_0xc257ee[_0xb984('0x41')][_0xb984('0x15')]:!_['isNil'](_0xc257ee['first_name'])?_0xc257ee[_0xb984('0x42')]+'\x20'+_0xc257ee['last_name']:_0xc257ee[_0xb984('0x43')],'id':_0xc257ee['id']}}]},'headers':{'Authorization':_0xb984('0x30')+_0x383c87},'json':!![]})[_0xb984('0x29')](function(_0x1660a1){if(_0x1660a1&&_0x1660a1['data'][0x0][_0xb984('0x44')]===_0xb984('0x45')){var _0x5d5e85=_0x1660a1[_0xb984('0x3c')][0x0][_0xb984('0x46')];_0x5d5e85[_0xb984('0x47')]=_[_0xb984('0x3f')](_0x2e625a[_0xb984('0x40')])+'s';return _0x5d5e85;}logger[_0xb984('0x2c')](_0xb984('0x3a'),JSON['stringify'](data));throw new Error(_0xb984('0x48')+JSON[_0xb984('0xb')](data));})['catch'](function(_0x5cb1dd){console[_0xb984('0x49')](_0xb984('0x4a'),_0x5cb1dd);});}function getEndUser(_0x3f1ea9,_0x248800,_0x1acc7a,_0x56a3bf,_0x664cb1,_0x40666f,_0x424f65){var _0x25413d={'method':_0xb984('0x4b'),'uri':'','headers':{'Authorization':_0xb984('0x30')+_0x3f1ea9},'json':!![]};switch(_0x424f65[_0xb984('0x4c')]){case _0xb984('0x4d'):_0x25413d[_0xb984('0x4e')]=_0xb984('0x4f')+_0x248800+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x664cb1+'))';return getZohoUser(_0x25413d,_0xb984('0x50'))[_0xb984('0x29')](function(_0x4bd4db){if(_0x4bd4db)return _0x4bd4db;_0x25413d[_0xb984('0x4e')]=_0xb984('0x4f')+_0x248800+_0xb984('0x51')+_0x664cb1+'))';return getZohoUser(_0x25413d,_0xb984('0x52'))[_0xb984('0x29')](function(_0x49dde7){if(_0x49dde7)return _0x49dde7;if(_0x424f65[_0xb984('0x40')]!=_0xb984('0x53')){return createEndUser(_0x3f1ea9,_0x248800,_0x56a3bf,_0x664cb1,_0x40666f,_0x424f65);}else{return{};}});});break;case _0xb984('0x54'):_0x25413d[_0xb984('0x4e')]='https://www.zohoapis.'+_0x248800+_0xb984('0x55')+_0x664cb1+'))';return getZohoUser(_0x25413d,_0xb984('0x50'))[_0xb984('0x29')](function(_0x2ae0d8){if(_0x2ae0d8)return _0x2ae0d8;if(_0x424f65[_0xb984('0x40')]!=_0xb984('0x53')){return createEndUser(_0x3f1ea9,_0x248800,_0x56a3bf,_0x664cb1,_0x40666f,_0x424f65);}else{return{};}});break;case _0xb984('0x56'):_0x25413d[_0xb984('0x4e')]=_0xb984('0x4f')+_0x248800+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x664cb1+'))';return getZohoUser(_0x25413d,_0xb984('0x52'))[_0xb984('0x29')](function(_0x3a7cbb){if(_0x3a7cbb)return _0x3a7cbb;if(_0x424f65['moduleCreate']!=_0xb984('0x53')){return createEndUser(_0x3f1ea9,_0x248800,_0x56a3bf,_0x664cb1,_0x40666f,_0x424f65);}else{return{};}});break;}}function getCall(_0x42a9f8,_0x4e777e,_0xdb477,_0x481eac,_0x364416,_0x3a9ec3,_0x5a1a34,_0xa51a2d){logger[_0xb984('0x34')](_0xb984('0x57'));var _0x3ddeb5={};_0x3ddeb5[_0xb984('0x58')]={'name':!_[_0xb984('0x19')](_0x481eac['role'][_0xb984('0x15')])&&!_['isNil'](_0x481eac[_0xb984('0x37')][_0xb984('0x15')])&&_0x481eac[_0xb984('0x37')]['name']==='administrator'?_0x481eac[_0xb984('0x41')][_0xb984('0x15')]:!_['isNil'](_0x481eac['first_name'])?_0x481eac[_0xb984('0x42')]+'\x20'+_0x481eac[_0xb984('0x43')]:_0x481eac[_0xb984('0x43')],'id':_0x481eac['id']};_0x3ddeb5[_0xb984('0x59')]=intUtil[_0xb984('0x5a')](_0x3a9ec3[_0xb984('0x5b')],_0x5a1a34,'\x20');_0x3ddeb5['Description']=intUtil['getString'](_0x3a9ec3[_0xb984('0x5c')],_0x5a1a34,'\x0a');if(_0x364416[_0xb984('0x47')]==='Contacts'){_0x3ddeb5[_0xb984('0x5d')]={'name':!_[_0xb984('0x19')](_0x364416[_0xb984('0x5e')])?_0x364416[_0xb984('0x5e')]:!_['isNil'](_0x364416['First_Name'])?_0x364416[_0xb984('0x5f')]+'\x20'+_0x364416[_0xb984('0x60')]:_0x364416[_0xb984('0x60')],'id':_0x364416['id']};}if(_0x364416[_0xb984('0x47')]===_0xb984('0x52')){_0x3ddeb5[_0xb984('0x61')]={'name':!_['isNil'](_0x364416[_0xb984('0x5e')])?_0x364416[_0xb984('0x5e')]:!_[_0xb984('0x19')](_0x364416[_0xb984('0x5f')])?_0x364416[_0xb984('0x5f')]+'\x20'+_0x364416[_0xb984('0x60')]:_0x364416['Last_Name'],'id':_0x364416['id']};_0x3ddeb5['$se_module']=_['startCase'](_0x364416[_0xb984('0x47')]);}if(_0x5a1a34[_0xb984('0x62')]){_0x3ddeb5[_0xb984('0x63')]=moment[_0xb984('0x64')](parseInt(_0x5a1a34[_0xb984('0x62')])*0x3e8)['format'](_0xb984('0x65'));}else if(_0x5a1a34[_0xb984('0x66')]&&_0x5a1a34[_0xb984('0x67')]){_0x3ddeb5['Call_Duration']=moment[_0xb984('0x64')](moment(_0x5a1a34[_0xb984('0x67')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x5a1a34[_0xb984('0x68')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0xb984('0x65'));}switch(_0x5a1a34['lastevent']){case _0xb984('0x69'):_0x3ddeb5[_0xb984('0x6a')]=_0xb984('0x6b');break;case _0xb984('0x6c'):case _0xb984('0x6d'):_0x3ddeb5[_0xb984('0x6a')]=_0xb984('0x6e');break;case _0xb984('0x6f'):_0x3ddeb5[_0xb984('0x6a')]=_0xb984('0x70');break;case _0xb984('0x71'):_0x3ddeb5[_0xb984('0x6a')]='Abandoned';break;case _0xb984('0x72'):_0x3ddeb5[_0xb984('0x6a')]=_0xb984('0x73');default:}_0x3ddeb5['Call_Start_Time']=(_0xa51a2d==='outbound'?moment(_0x5a1a34[_0xb984('0x68')])[_0xb984('0x2e')](_0xb984('0x74')):moment(_0x5a1a34['agentcalledAt'])[_0xb984('0x2e')](_0xb984('0x74')))||moment()[_0xb984('0x2e')](_0xb984('0x74'));_0x3ddeb5[_0xb984('0x75')]=_0xa51a2d||_0xb984('0x76');_0x3ddeb5=_[_0xb984('0x77')](_0x3ddeb5,getCustomFields(_0x3a9ec3[_0xb984('0x78')],_0x5a1a34));return request({'method':_0xb984('0x23'),'uri':_0xb984('0x4f')+_0x4e777e+_0xb984('0x79'),'headers':{'Authorization':_0xb984('0x30')+_0x42a9f8},'body':{'data':[_0x3ddeb5]},'json':!![]})[_0xb984('0x29')](function(_0x9ea21f){if(_0x9ea21f&&_0x9ea21f['data'][0x0][_0xb984('0x44')]==='SUCCESS'){logger[_0xb984('0x34')]('Call\x20created!');return{'id':_0x9ea21f[_0xb984('0x3c')][0x0][_0xb984('0x46')]['id']};}})[_0xb984('0x3d')](function(_0xae996e){logger[_0xb984('0x34')](_0xb984('0x7a'),_0xae996e[_0xb984('0x7b')]);console[_0xb984('0x49')](_0xb984('0x7a'),_0xae996e);});}exports[_0xb984('0x7c')]=function(_0x2976f1,_0x4247e7,_0x23c3d5,_0x588e45,_0x4886bf,_0x917c53){var _0x441166,_0x1e90ae,_0x48f52d;_0x917c53[_0xb984('0x7d')]=intUtil[_0xb984('0x7e')](_0x917c53['host']);_0x917c53['serverUrl']=intUtil['stripTrailingSlash'](_0x917c53[_0xb984('0x7f')]);if(_0x4886bf&&_0x4886bf['monitor_format']){logger['info']('[QUEUE]',_0xb984('0x80'));_0x4247e7[_0xb984('0x81')]=_0x917c53[_0xb984('0x7f')]+_0xb984('0x82')+_0x4247e7['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4247e7[_0xb984('0x83')]);}else{_0x4247e7[_0xb984('0x81')]='';}var _0x3c6050=_0x917c53[_0xb984('0x7d')]===_0xb984('0x84')?'eu':'com';return getAccessToken(_0x917c53)[_0xb984('0x29')](function(_0x3e7ed1){_0x48f52d=_0x3e7ed1;return getUser(_0x48f52d,_0x3c6050,_0x917c53,_0x588e45[_0xb984('0x33')]);})[_0xb984('0x29')](function(_0x11992a){_0x441166=_0x11992a;logger[_0xb984('0x34')]('The\x20User\x20ID\x20is:',_0x441166['id']);return getEndUser(_0x48f52d,_0x3c6050,_0x917c53,_0x4247e7[_0xb984('0x85')],_0x4247e7['calleridnum'],_0x441166,_0x23c3d5);})[_0xb984('0x29')](function(_0x1d9392){_0x1e90ae=_0x1d9392;return getCall(_0x48f52d,_0x3c6050,_0x917c53,_0x441166,_0x1e90ae,_0x23c3d5,_0x4247e7,_0xb984('0x76'));})[_0xb984('0x29')](function(_0x1d18e8){if(_0x1d18e8){logger['info'](_0xb984('0x86'),_0x1d18e8['id']);logger[_0xb984('0x34')](_0xb984('0x87'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb984('0x2e')](_0xb984('0x88'),_0x588e45[_0xb984('0x15')]),_0xb984('0x89'),{'uri':_0xb984('0x8a')+_0x917c53['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1d18e8['id']});}})[_0xb984('0x3d')](function(_0x31d101){logger[_0xb984('0x2c')](_0xb984('0x87'),JSON['stringify'](_0x31d101));});};exports[_0xb984('0x8b')]=function(_0x34ce92,_0x286d56,_0x199e48,_0x5e4b1f,_0x1b0673,_0x2725eb,_0x417526){var _0x1a619f,_0x484a35,_0x14cd2c;_0x2725eb[_0xb984('0x7d')]=intUtil[_0xb984('0x7e')](_0x2725eb[_0xb984('0x7d')]);_0x2725eb[_0xb984('0x7f')]=intUtil[_0xb984('0x7e')](_0x2725eb[_0xb984('0x7f')]);if(_0x417526&&_0x417526[_0xb984('0x8c')]&&_0x417526[_0xb984('0x8c')]!==_0xb984('0x8d')){logger[_0xb984('0x34')]('[OUTBOUND]',_0xb984('0x80'));_0x286d56[_0xb984('0x81')]=_0x2725eb[_0xb984('0x7f')]+_0xb984('0x82')+_0x286d56[_0xb984('0x83')]+_0xb984('0x8e')+md5(_0x286d56['uniqueid']);}var _0x7845c7=_0x2725eb[_0xb984('0x7d')]===_0xb984('0x84')?'eu':_0xb984('0x8f');return getAccessToken(_0x2725eb)['then'](function(_0x41a85f){_0x14cd2c=_0x41a85f;return getUser(_0x14cd2c,_0x7845c7,_0x2725eb,_0x5e4b1f[_0xb984('0x33')]);})['then'](function(_0x18d79c){_0x1a619f=_0x18d79c;logger['info']('The\x20User\x20ID\x20is:',_0x1a619f['id']);return getEndUser(_0x14cd2c,_0x7845c7,_0x2725eb,_0x286d56[_0xb984('0x90')],_0x286d56[_0xb984('0x91')],_0x1a619f,_0x199e48);})[_0xb984('0x29')](function(_0xc27f82){_0x484a35=_0xc27f82;return getCall(_0x14cd2c,_0x7845c7,_0x2725eb,_0x1a619f,_0x484a35,_0x199e48,_0x286d56,_0xb984('0x92'));})[_0xb984('0x29')](function(_0x110745){if(_0x110745){logger[_0xb984('0x34')](_0xb984('0x86'),_0x110745['id']);logger['info']('[OUTBOUND]',_0xb984('0x93'));emit(util[_0xb984('0x2e')](_0xb984('0x88'),_0x5e4b1f[_0xb984('0x15')]),'trigger:browser:url',{'uri':_0xb984('0x8a')+_0x2725eb[_0xb984('0x7d')]+_0xb984('0x94')+_0x110745['id']});}})[_0xb984('0x3d')](function(_0x199c2){logger[_0xb984('0x2c')]('[OUTBOUND]',JSON[_0xb984('0xb')](_0x199c2));});};exports['unmanaged']=function(_0x38b0e6,_0x56cb5d,_0x3dd59c,_0x4f6b45,_0x55d92d,_0x28b95d){var _0x41fb90,_0x54a2b2,_0x38a5cc;_0x28b95d[_0xb984('0x7d')]=intUtil[_0xb984('0x7e')](_0x28b95d[_0xb984('0x7d')]);_0x28b95d[_0xb984('0x7f')]=intUtil['stripTrailingSlash'](_0x28b95d['serverUrl']);if(_0x55d92d&&_0x55d92d[_0xb984('0x95')]){logger[_0xb984('0x34')]('['+_0x56cb5d['lastevent'][_0xb984('0x96')]()+']',_0xb984('0x80'));_0x56cb5d[_0xb984('0x81')]=_0x28b95d['serverUrl']+_0xb984('0x82')+_0x56cb5d['uniqueid']+_0xb984('0x8e')+md5(_0x56cb5d[_0xb984('0x83')]);}else{_0x56cb5d['recordingURL']='';}var _0x170284=_0x28b95d[_0xb984('0x7d')]===_0xb984('0x84')?'eu':_0xb984('0x8f');return getAccessToken(_0x28b95d)['then'](function(_0x53880c){_0x38a5cc=_0x53880c;return getUser(_0x38a5cc,_0x170284,_0x28b95d);})['then'](function(_0x567cd0){_0x41fb90=_0x567cd0;logger['info'](_0xb984('0x97'),_0x41fb90['id']);return getEndUser(_0x38a5cc,_0x170284,_0x28b95d,_0x56cb5d[_0xb984('0x85')],_0x56cb5d[_0xb984('0x98')],_0x41fb90,_0x3dd59c);})[_0xb984('0x29')](function(_0xf9cc4c){_0x54a2b2=_0xf9cc4c;return getCall(_0x38a5cc,_0x170284,_0x28b95d,_0x41fb90,_0x54a2b2,_0x3dd59c,_0x56cb5d,_0xb984('0x76'));})['then'](function(_0x1e738b){if(_0x1e738b){logger['info']('The\x20Call\x20ID\x20is:',_0x1e738b['id']);}})[_0xb984('0x3d')](function(_0x51af15){logger[_0xb984('0x2c')]('['+_0x56cb5d[_0xb984('0x99')]['toUpperCase']()+']',JSON[_0xb984('0xb')](_0x51af15));});}; \ No newline at end of file +var _0xc686=['/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','[QUEUE]','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','toUpperCase','calleridname','md5','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','forEach','string','idField','content','toString','type','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','The\x20failing\x20result\x20is','log','CREATE\x20ERROR','contact_lead','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','Creating\x20new\x20call...','administrator','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','Timeout','outbound','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','stack','err','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid'];(function(_0x1eca85,_0x4cc100){var _0xe33ddc=function(_0x2540ff){while(--_0x2540ff){_0x1eca85['push'](_0x1eca85['shift']());}};_0xe33ddc(++_0x4cc100);}(_0xc686,0x148));var _0x6c68=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc686[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x6c68('0x0'));var util=require('util');var intUtil=require(_0x6c68('0x1'));var moment=require('moment');var Redis=require(_0x6c68('0x2'));var BPromise=require(_0x6c68('0x3'));var config=require(_0x6c68('0x4'));var logger=require(_0x6c68('0x5'))(_0x6c68('0x6'));config[_0x6c68('0x7')]=_[_0x6c68('0x8')](config[_0x6c68('0x7')],{'host':_0x6c68('0x9'),'port':0x18eb});var io=require(_0x6c68('0xa'))(new Redis(config[_0x6c68('0x7')]));function emit(_0x394644,_0x5634c4,_0x303a45){io['to'](_0x394644)[_0x6c68('0xb')](_0x5634c4,_0x303a45);}function request(_0x4ff2ce){logger[_0x6c68('0xc')]('[HTTP]',JSON[_0x6c68('0xd')](_0x4ff2ce));return rp(_0x4ff2ce);}function getCustomFields(_0xad9818,_0x4adae7){var _0x9d20ac={};if(_0xad9818['length']>0x0){_[_0x6c68('0xe')](_0xad9818,function(_0x4d912a){if(_['includes']([_0x6c68('0xf'),'picklist'],_0x4d912a['type'])&&_0x4d912a[_0x6c68('0x10')]){_0x9d20ac[_0x4d912a['idField']]=_0x4d912a[_0x6c68('0x11')][_0x6c68('0x12')]();}else if(_0x4d912a[_0x6c68('0x13')]==='variable'&&_0x4d912a[_0x6c68('0x14')]&&_0x4d912a[_0x6c68('0x10')]&&_0x4adae7[_0x4d912a[_0x6c68('0x14')]]){_0x9d20ac[_0x4d912a[_0x6c68('0x10')]]=_0x4adae7[_0x4d912a[_0x6c68('0x14')]]['toString']();}else if(_0x4d912a['type']==='customVariable'&&_0x4d912a[_0x6c68('0x15')]&&_0x4d912a[_0x6c68('0x15')][_0x6c68('0x16')]&&_0x4d912a[_0x6c68('0x10')]&&_0x4adae7[_0x4d912a['Variable'][_0x6c68('0x16')][_0x6c68('0x17')]()]){_0x9d20ac[_0x4d912a['idField']]=_0x4adae7[_0x4d912a['Variable'][_0x6c68('0x16')][_0x6c68('0x17')]()][_0x6c68('0x12')]();}});}return _0x9d20ac;}function getName(_0x5d7efc){if(_0x5d7efc[_0x6c68('0x18')]('\x20')>0x0){var _0x3c68bd=_0x5d7efc[_0x6c68('0x19')](/ (.+)/);if(_0x3c68bd[0x1]){return _0x3c68bd;}}return[_0x5d7efc,_0x5d7efc];}var accountsTokens={};function getAccessToken(_0x29b74d){return new Promise(function(_0x153edb,_0x232a63){if(!_[_0x6c68('0x1a')](accountsTokens[_0x29b74d['id']])&&!_[_0x6c68('0x1a')](accountsTokens[_0x29b74d['id']][_0x6c68('0x1b')])){if(moment()[_0x6c68('0x1c')](accountsTokens[_0x29b74d['id']]['expires_in'])){_0x153edb(accountsTokens[_0x29b74d['id']][_0x6c68('0x1b')]);}}var _0x3879a2;switch(_0x29b74d[_0x6c68('0x1d')]){case'US':_0x3879a2=_0x6c68('0x1e');break;case'AU':_0x3879a2=_0x6c68('0x1f');break;case'EU':_0x3879a2=_0x6c68('0x20');break;case'IN':_0x3879a2=_0x6c68('0x21');break;case'CN':_0x3879a2=_0x6c68('0x22');break;default:_0x3879a2=_0x6c68('0x20');break;}var _0xfd98ef={'method':_0x6c68('0x23'),'uri':_0x3879a2+_0x6c68('0x24'),'qs':{'refresh_token':_0x29b74d[_0x6c68('0x25')],'client_id':_0x29b74d[_0x6c68('0x26')],'client_secret':_0x29b74d[_0x6c68('0x27')],'grant_type':_0x6c68('0x28')},'json':!![]};return rp(_0xfd98ef)[_0x6c68('0x29')](function(_0x5c9c19){accountsTokens[_0x29b74d['id']]={'access_token':_0x5c9c19[_0x6c68('0x1b')],'expires_in':moment()[_0x6c68('0x2a')](_0x5c9c19[_0x6c68('0x2b')],_0x6c68('0x2c'))};_0x153edb(_0x5c9c19[_0x6c68('0x1b')]);})[_0x6c68('0x2d')](function(_0x17f3e0){logger[_0x6c68('0x2e')](_0x6c68('0x2f'),_0x17f3e0['stack']);_0x232a63(_0x17f3e0);});});}function getUser(_0x1321d1,_0x43bf40,_0x56b684,_0x5a3f37){logger[_0x6c68('0x30')](_0x6c68('0x31'));return request({'method':'GET','uri':util[_0x6c68('0x32')](_0x6c68('0x33'),_0x43bf40),'qs':{'type':_0x6c68('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1321d1},'json':!![]})[_0x6c68('0x29')](function(_0x3b59d3){if(_0x3b59d3[_0x6c68('0x35')]){var _0x18d98c=-0x1;if(_[_0x6c68('0x36')](_0x3b59d3[_0x6c68('0x35')])){if(!_[_0x6c68('0x1a')](_0x5a3f37)){_0x18d98c=_[_0x6c68('0x37')](_0x3b59d3[_0x6c68('0x35')],function(_0x22e4cf){return _0x22e4cf[_0x6c68('0x38')]===_0x5a3f37;});}if(_0x18d98c>=0x0){logger[_0x6c68('0x30')](_0x6c68('0x39'));}else{logger[_0x6c68('0x30')](_0x6c68('0x3a'));_0x18d98c=_[_0x6c68('0x37')](_0x3b59d3['users'],function(_0x59e1db){return _0x59e1db[_0x6c68('0x3b')][_0x6c68('0x16')]===_0x6c68('0x3c');});}return _0x3b59d3[_0x6c68('0x35')][_0x18d98c];}else{if(_0x3b59d3[_0x6c68('0x3d')]['profile'][_0x6c68('0x16')]===_0x6c68('0x3c')){logger[_0x6c68('0x30')](_0x6c68('0x3a'));user=_0x3b59d3[_0x6c68('0x3d')];return user;}else{logger[_0x6c68('0x2e')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x3b59d3));throw new Error(_0x6c68('0x3e')+JSON[_0x6c68('0xd')](_0x3b59d3));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x6c68('0xd')](_0x3b59d3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x6c68('0xd')](_0x3b59d3));}})[_0x6c68('0x2d')](function(_0x509ef4){console[_0x6c68('0x2e')](_0x509ef4);});}function getZohoUser(_0x383780,_0xe81cf8){return new BPromise(function(_0x16fb88,_0x3546bd){request(_0x383780)[_0x6c68('0x29')](function(_0x32a716){var _0x15b9a3=null;if(_0x32a716){_0x15b9a3=_0x32a716[_0x6c68('0x3f')][0x0];_0x15b9a3[_0x6c68('0x40')]=_0xe81cf8;}_0x16fb88(_0x15b9a3);})[_0x6c68('0x2d')](function(_0x300055){_0x3546bd(_0x300055);});});}function createEndUser(_0x30dec8,_0x798117,_0x1760f2,_0x285292,_0x29b900,_0x1a2c5a){var _0x1760f2=getName(_0x1760f2);return request({'method':_0x6c68('0x23'),'uri':_0x6c68('0x41')+_0x798117+_0x6c68('0x42')+_[_0x6c68('0x43')](_0x1a2c5a['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1760f2[0x1],'First_Name':_0x1760f2[0x0],'Phone':_0x285292,'Owner':{'name':!_[_0x6c68('0x1a')](_0x29b900[_0x6c68('0x44')][_0x6c68('0x16')])?_0x29b900['role'][_0x6c68('0x16')]:!_[_0x6c68('0x1a')](_0x29b900[_0x6c68('0x45')])?_0x29b900[_0x6c68('0x45')]+'\x20'+_0x29b900[_0x6c68('0x46')]:_0x29b900[_0x6c68('0x46')],'id':_0x29b900['id']}}]},'headers':{'Authorization':_0x6c68('0x47')+_0x30dec8},'json':!![]})[_0x6c68('0x29')](function(_0x17103f){if(_0x17103f&&_0x17103f[_0x6c68('0x3f')][0x0][_0x6c68('0x48')]===_0x6c68('0x49')){var _0x10aade=_0x17103f[_0x6c68('0x3f')][0x0][_0x6c68('0x4a')];_0x10aade[_0x6c68('0x40')]=_['startCase'](_0x1a2c5a[_0x6c68('0x4b')])+'s';return _0x10aade;}logger[_0x6c68('0x2e')](_0x6c68('0x4c'),JSON[_0x6c68('0xd')](data));throw new Error('Error:\x20'+JSON[_0x6c68('0xd')](data));})[_0x6c68('0x2d')](function(_0x4e65f9){console[_0x6c68('0x4d')](_0x6c68('0x4e'),_0x4e65f9);});}function getEndUser(_0x41d39d,_0x4d3116,_0x51060f,_0x3f6213,_0x7d0b4c,_0xff5a43,_0x2ca188){var _0x318fa5={'method':'GET','uri':'','headers':{'Authorization':_0x6c68('0x47')+_0x41d39d},'json':!![]};switch(_0x2ca188['moduleSearch']){case _0x6c68('0x4f'):_0x318fa5['uri']=_0x6c68('0x41')+_0x4d3116+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x7d0b4c+'))';return getZohoUser(_0x318fa5,_0x6c68('0x50'))[_0x6c68('0x29')](function(_0x131344){if(_0x131344)return _0x131344;_0x318fa5[_0x6c68('0x51')]=_0x6c68('0x41')+_0x4d3116+_0x6c68('0x52')+_0x7d0b4c+'))';return getZohoUser(_0x318fa5,_0x6c68('0x53'))[_0x6c68('0x29')](function(_0x4f9ab6){if(_0x4f9ab6)return _0x4f9ab6;if(_0x2ca188[_0x6c68('0x4b')]!='nothing'){return createEndUser(_0x41d39d,_0x4d3116,_0x3f6213,_0x7d0b4c,_0xff5a43,_0x2ca188);}else{return{};}});});break;case'contact':_0x318fa5[_0x6c68('0x51')]=_0x6c68('0x41')+_0x4d3116+_0x6c68('0x54')+_0x7d0b4c+'))';return getZohoUser(_0x318fa5,_0x6c68('0x50'))[_0x6c68('0x29')](function(_0x5898c1){if(_0x5898c1)return _0x5898c1;if(_0x2ca188[_0x6c68('0x4b')]!=_0x6c68('0x55')){return createEndUser(_0x41d39d,_0x4d3116,_0x3f6213,_0x7d0b4c,_0xff5a43,_0x2ca188);}else{return{};}});break;case _0x6c68('0x56'):_0x318fa5['uri']=_0x6c68('0x41')+_0x4d3116+_0x6c68('0x52')+_0x7d0b4c+'))';return getZohoUser(_0x318fa5,_0x6c68('0x53'))[_0x6c68('0x29')](function(_0x553ce0){if(_0x553ce0)return _0x553ce0;if(_0x2ca188['moduleCreate']!=_0x6c68('0x55')){return createEndUser(_0x41d39d,_0x4d3116,_0x3f6213,_0x7d0b4c,_0xff5a43,_0x2ca188);}else{return{};}});break;}}function getCall(_0x1ce44e,_0x580a23,_0x41d4c9,_0x506198,_0x501353,_0x472e49,_0x53c905,_0x42c8c1){logger[_0x6c68('0x30')](_0x6c68('0x57'));var _0x59ee26={};_0x59ee26['Owner']={'name':!_['isNil'](_0x506198[_0x6c68('0x44')][_0x6c68('0x16')])&&!_[_0x6c68('0x1a')](_0x506198[_0x6c68('0x3b')][_0x6c68('0x16')])&&_0x506198[_0x6c68('0x3b')][_0x6c68('0x16')]===_0x6c68('0x58')?_0x506198['role'][_0x6c68('0x16')]:!_['isNil'](_0x506198[_0x6c68('0x45')])?_0x506198[_0x6c68('0x45')]+'\x20'+_0x506198[_0x6c68('0x46')]:_0x506198[_0x6c68('0x46')],'id':_0x506198['id']};_0x59ee26['Subject']=intUtil[_0x6c68('0x59')](_0x472e49[_0x6c68('0x5a')],_0x53c905,'\x20');_0x59ee26['Description']=intUtil[_0x6c68('0x59')](_0x472e49[_0x6c68('0x5b')],_0x53c905,'\x0a');if(_0x501353[_0x6c68('0x40')]===_0x6c68('0x50')){_0x59ee26[_0x6c68('0x5c')]={'name':!_['isNil'](_0x501353[_0x6c68('0x5d')])?_0x501353[_0x6c68('0x5d')]:!_['isNil'](_0x501353['First_Name'])?_0x501353[_0x6c68('0x5e')]+'\x20'+_0x501353['Last_Name']:_0x501353[_0x6c68('0x5f')],'id':_0x501353['id']};}if(_0x501353[_0x6c68('0x40')]===_0x6c68('0x53')){_0x59ee26[_0x6c68('0x60')]={'name':!_[_0x6c68('0x1a')](_0x501353[_0x6c68('0x5d')])?_0x501353['Full_Name']:!_['isNil'](_0x501353[_0x6c68('0x5e')])?_0x501353[_0x6c68('0x5e')]+'\x20'+_0x501353[_0x6c68('0x5f')]:_0x501353[_0x6c68('0x5f')],'id':_0x501353['id']};_0x59ee26[_0x6c68('0x61')]=_[_0x6c68('0x43')](_0x501353[_0x6c68('0x40')]);}if(_0x53c905[_0x6c68('0x62')]){_0x59ee26['Call_Duration']=moment['utc'](parseInt(_0x53c905['talktime'])*0x3e8)[_0x6c68('0x32')]('mm:ss');}else if(_0x53c905[_0x6c68('0x63')]&&_0x53c905[_0x6c68('0x64')]){_0x59ee26['Call_Duration']=moment[_0x6c68('0x65')](moment(_0x53c905[_0x6c68('0x64')],_0x6c68('0x66'))[_0x6c68('0x67')](moment(_0x53c905[_0x6c68('0x68')],_0x6c68('0x66'))))[_0x6c68('0x32')](_0x6c68('0x69'));}switch(_0x53c905[_0x6c68('0x6a')]){case'called':_0x59ee26[_0x6c68('0x6b')]=_0x6c68('0x6c');break;case _0x6c68('0x6d'):case _0x6c68('0x6e'):_0x59ee26[_0x6c68('0x6b')]=_0x6c68('0x6f');break;case _0x6c68('0x70'):_0x59ee26['Call_Result']='Rejected';break;case _0x6c68('0x71'):_0x59ee26[_0x6c68('0x6b')]=_0x6c68('0x72');break;case'timeout':_0x59ee26['Call_Result']=_0x6c68('0x73');default:}_0x59ee26['Call_Start_Time']=(_0x42c8c1===_0x6c68('0x74')?moment(_0x53c905[_0x6c68('0x68')])[_0x6c68('0x32')](_0x6c68('0x66')):moment(_0x53c905['agentcalledAt'])[_0x6c68('0x32')](_0x6c68('0x66')))||moment()[_0x6c68('0x32')]('YYYY-MM-DDTHH:mm:ss');_0x59ee26[_0x6c68('0x75')]=_0x42c8c1||'Inbound';_0x59ee26=_[_0x6c68('0x76')](_0x59ee26,getCustomFields(_0x472e49[_0x6c68('0x77')],_0x53c905));return request({'method':_0x6c68('0x23'),'uri':_0x6c68('0x41')+_0x580a23+_0x6c68('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1ce44e},'body':{'data':[_0x59ee26]},'json':!![]})[_0x6c68('0x29')](function(_0x5a8ab9){if(_0x5a8ab9&&_0x5a8ab9[_0x6c68('0x3f')][0x0][_0x6c68('0x48')]===_0x6c68('0x49')){logger['info'](_0x6c68('0x79'));return{'id':_0x5a8ab9[_0x6c68('0x3f')][0x0][_0x6c68('0x4a')]['id']};}})[_0x6c68('0x2d')](function(_0x3406fd){logger[_0x6c68('0x30')]('err',_0x3406fd[_0x6c68('0x7a')]);console[_0x6c68('0x4d')](_0x6c68('0x7b'),_0x3406fd);});}exports['queue']=function(_0x821b3f,_0x1c9fac,_0x452fa9,_0x49c427,_0x5e4d4b,_0x473d55){var _0x5d5314,_0x164663,_0x44c0a6;_0x473d55[_0x6c68('0x7c')]=intUtil[_0x6c68('0x7d')](_0x473d55[_0x6c68('0x7c')]);_0x473d55[_0x6c68('0x7e')]=intUtil['stripTrailingSlash'](_0x473d55[_0x6c68('0x7e')]);if(_0x5e4d4b&&_0x5e4d4b['monitor_format']){logger['info']('[QUEUE]',_0x6c68('0x7f'));_0x1c9fac[_0x6c68('0x80')]=_0x473d55[_0x6c68('0x7e')]+_0x6c68('0x81')+_0x1c9fac[_0x6c68('0x82')]+_0x6c68('0x83')+md5(_0x1c9fac[_0x6c68('0x82')]);}else{_0x1c9fac[_0x6c68('0x80')]='';}var _0x25b3ed=_0x473d55['host']===_0x6c68('0x84')?'eu':_0x6c68('0x85');return getAccessToken(_0x473d55)['then'](function(_0xae16fa){_0x44c0a6=_0xae16fa;return getUser(_0x44c0a6,_0x25b3ed,_0x473d55,_0x49c427['email']);})['then'](function(_0x4185c9){_0x5d5314=_0x4185c9;logger['info'](_0x6c68('0x86'),_0x5d5314['id']);return getEndUser(_0x44c0a6,_0x25b3ed,_0x473d55,_0x1c9fac['calleridname'],_0x1c9fac[_0x6c68('0x87')],_0x5d5314,_0x452fa9);})[_0x6c68('0x29')](function(_0x4fd3de){_0x164663=_0x4fd3de;return getCall(_0x44c0a6,_0x25b3ed,_0x473d55,_0x5d5314,_0x164663,_0x452fa9,_0x1c9fac,_0x6c68('0x88'));})[_0x6c68('0x29')](function(_0x3cfd30){if(_0x3cfd30){logger[_0x6c68('0x30')](_0x6c68('0x89'),_0x3cfd30['id']);logger[_0x6c68('0x30')]('[QUEUE]',_0x6c68('0x8a'));emit(util[_0x6c68('0x32')](_0x6c68('0x8b'),_0x49c427['name']),_0x6c68('0x8c'),{'uri':_0x6c68('0x8d')+_0x473d55[_0x6c68('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3cfd30['id']});}})[_0x6c68('0x2d')](function(_0x40d176){logger[_0x6c68('0x2e')](_0x6c68('0x8e'),JSON[_0x6c68('0xd')](_0x40d176));});};exports[_0x6c68('0x74')]=function(_0x21b1c5,_0xeb3fc4,_0x197006,_0x20dab5,_0x587654,_0x25208e,_0x3ad058){var _0x2ae10c,_0x18b746,_0x2bbc06;_0x25208e[_0x6c68('0x7c')]=intUtil[_0x6c68('0x7d')](_0x25208e[_0x6c68('0x7c')]);_0x25208e[_0x6c68('0x7e')]=intUtil[_0x6c68('0x7d')](_0x25208e[_0x6c68('0x7e')]);if(_0x3ad058&&_0x3ad058['recordingFormat']&&_0x3ad058[_0x6c68('0x8f')]!==_0x6c68('0x90')){logger[_0x6c68('0x30')]('[OUTBOUND]',_0x6c68('0x7f'));_0xeb3fc4[_0x6c68('0x80')]=_0x25208e[_0x6c68('0x7e')]+_0x6c68('0x81')+_0xeb3fc4[_0x6c68('0x82')]+_0x6c68('0x83')+md5(_0xeb3fc4[_0x6c68('0x82')]);}var _0x372866=_0x25208e[_0x6c68('0x7c')]===_0x6c68('0x84')?'eu':'com';return getAccessToken(_0x25208e)['then'](function(_0x24950f){_0x2bbc06=_0x24950f;return getUser(_0x2bbc06,_0x372866,_0x25208e,_0x20dab5['email']);})[_0x6c68('0x29')](function(_0x356966){_0x2ae10c=_0x356966;logger['info'](_0x6c68('0x86'),_0x2ae10c['id']);return getEndUser(_0x2bbc06,_0x372866,_0x25208e,_0xeb3fc4['destcalleridname'],_0xeb3fc4[_0x6c68('0x91')],_0x2ae10c,_0x197006);})['then'](function(_0x48b4c5){_0x18b746=_0x48b4c5;return getCall(_0x2bbc06,_0x372866,_0x25208e,_0x2ae10c,_0x18b746,_0x197006,_0xeb3fc4,_0x6c68('0x92'));})[_0x6c68('0x29')](function(_0x194320){if(_0x194320){logger['info'](_0x6c68('0x89'),_0x194320['id']);logger[_0x6c68('0x30')](_0x6c68('0x93'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x6c68('0x8b'),_0x20dab5[_0x6c68('0x16')]),_0x6c68('0x8c'),{'uri':_0x6c68('0x8d')+_0x25208e[_0x6c68('0x7c')]+_0x6c68('0x94')+_0x194320['id']});}})[_0x6c68('0x2d')](function(_0xb9f67d){logger[_0x6c68('0x2e')](_0x6c68('0x93'),JSON[_0x6c68('0xd')](_0xb9f67d));});};exports[_0x6c68('0x95')]=function(_0xf203d7,_0x3a0b90,_0x4342ab,_0x597ed9,_0x347aec,_0x36b62e){var _0x39d06d,_0x4d0e0b,_0x5231d1;_0x36b62e[_0x6c68('0x7c')]=intUtil['stripTrailingSlash'](_0x36b62e['host']);_0x36b62e[_0x6c68('0x7e')]=intUtil[_0x6c68('0x7d')](_0x36b62e['serverUrl']);if(_0x347aec&&_0x347aec[_0x6c68('0x96')]){logger[_0x6c68('0x30')]('['+_0x3a0b90['lastevent'][_0x6c68('0x97')]()+']',_0x6c68('0x7f'));_0x3a0b90[_0x6c68('0x80')]=_0x36b62e[_0x6c68('0x7e')]+_0x6c68('0x81')+_0x3a0b90[_0x6c68('0x82')]+_0x6c68('0x83')+md5(_0x3a0b90[_0x6c68('0x82')]);}else{_0x3a0b90['recordingURL']='';}var _0x133fd8=_0x36b62e[_0x6c68('0x7c')]===_0x6c68('0x84')?'eu':_0x6c68('0x85');return getAccessToken(_0x36b62e)[_0x6c68('0x29')](function(_0x1fd495){_0x5231d1=_0x1fd495;return getUser(_0x5231d1,_0x133fd8,_0x36b62e);})[_0x6c68('0x29')](function(_0x5db3af){_0x39d06d=_0x5db3af;logger[_0x6c68('0x30')](_0x6c68('0x86'),_0x39d06d['id']);return getEndUser(_0x5231d1,_0x133fd8,_0x36b62e,_0x3a0b90[_0x6c68('0x98')],_0x3a0b90[_0x6c68('0x87')],_0x39d06d,_0x4342ab);})[_0x6c68('0x29')](function(_0x285856){_0x4d0e0b=_0x285856;return getCall(_0x5231d1,_0x133fd8,_0x36b62e,_0x39d06d,_0x4d0e0b,_0x4342ab,_0x3a0b90,_0x6c68('0x88'));})[_0x6c68('0x29')](function(_0x5d93a7){if(_0x5d93a7){logger[_0x6c68('0x30')](_0x6c68('0x89'),_0x5d93a7['id']);}})[_0x6c68('0x2d')](function(_0x22be72){logger[_0x6c68('0x2e')]('['+_0x3a0b90[_0x6c68('0x6a')][_0x6c68('0x97')]()+']',JSON[_0x6c68('0xd')](_0x22be72));});}; \ 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 f780fef..ea4a147 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 _0xbdcf=['render','data3','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','shelljs','mustache','data2','Script'];(function(_0x45cb66,_0x891fa1){var _0x57d039=function(_0x123c2c){while(--_0x123c2c){_0x45cb66['push'](_0x45cb66['shift']());}};_0x57d039(++_0x891fa1);}(_0xbdcf,0x145));var _0xfbdc=function(_0x5d56d3,_0x5e4b96){_0x5d56d3=_0x5d56d3-0x0;var _0x59358e=_0xbdcf[_0x5d56d3];return _0x59358e;};'use strict';var util=require(_0xfbdc('0x0'));var sh=require(_0xfbdc('0x1'));var Mustache=require(_0xfbdc('0x2'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x3c07bb,_0x4da76b){var _0x3e31b7=_0x3c07bb[_0xfbdc('0x3')]?_0x3c07bb[_0xfbdc('0x3')]:_0xfbdc('0x4');var _0xd511a3=_0x3c07bb['data3']?Mustache[_0xfbdc('0x5')](_0x3c07bb[_0xfbdc('0x6')],_0x4da76b):_0x4da76b;sh['exec'](_0xd511a3,function(_0x201449,_0x290327,_0x11ffae){if(_0x201449!==0x0){logger['error'](util[_0xfbdc('0x7')](_0xfbdc('0x8'),_0x3e31b7,_0xd511a3,_0x201449,_0x11ffae));}else{logger[_0xfbdc('0x9')](util[_0xfbdc('0x7')](_0xfbdc('0xa'),_0x3e31b7,_0xd511a3,_0x290327));}});}; \ No newline at end of file +var _0xceaf=['data2','Script','data3','exec','error','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger'];(function(_0xd3a53d,_0x5e5bc2){var _0x56f46b=function(_0x2aced9){while(--_0x2aced9){_0xd3a53d['push'](_0xd3a53d['shift']());}};_0x56f46b(++_0x5e5bc2);}(_0xceaf,0x11b));var _0xfcea=function(_0x14cf6a,_0x48deba){_0x14cf6a=_0x14cf6a-0x0;var _0x547400=_0xceaf[_0x14cf6a];return _0x547400;};'use strict';var util=require(_0xfcea('0x0'));var sh=require(_0xfcea('0x1'));var Mustache=require(_0xfcea('0x2'));var logger=require(_0xfcea('0x3'))(_0xfcea('0x4'));exports['exec']=function(_0x301a26,_0xdcec95){var _0x38394e=_0x301a26[_0xfcea('0x5')]?_0x301a26[_0xfcea('0x5')]:_0xfcea('0x6');var _0x2309d2=_0x301a26[_0xfcea('0x7')]?Mustache['render'](_0x301a26[_0xfcea('0x7')],_0xdcec95):_0xdcec95;sh[_0xfcea('0x8')](_0x2309d2,function(_0x3a0dc8,_0x5807f4,_0x5baef0){if(_0x3a0dc8!==0x0){logger[_0xfcea('0x9')](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x38394e,_0x2309d2,_0x3a0dc8,_0x5baef0));}else{logger[_0xfcea('0xa')](util['format'](_0xfcea('0xb'),_0x38394e,_0x2309d2,_0x5807f4));}});}; \ 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 3c2801d..fdd9fbd 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 _0x49ae=['statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','headers','data6','render','error','stack','GET','DELETE','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify',',\x20request\x20body:\x20','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s'];(function(_0xa432e0,_0x52b937){var _0x3367bf=function(_0x800c4c){while(--_0x800c4c){_0xa432e0['push'](_0xa432e0['shift']());}};_0x3367bf(++_0x52b937);}(_0x49ae,0xec));var _0xe49a=function(_0xdc82e2,_0x37832e){_0xdc82e2=_0xdc82e2-0x0;var _0x3ead18=_0x49ae[_0xdc82e2];return _0x3ead18;};'use strict';var rp=require(_0xe49a('0x0'));var util=require(_0xe49a('0x1'));var _=require(_0xe49a('0x2'));var Mustache=require('mustache');var logger=require(_0xe49a('0x3'))(_0xe49a('0x4'));exports[_0xe49a('0x5')]=function(_0x565036,_0x2e70d0){var _0x3f6ebd,_0x1a46df;var _0x1cce59={'method':_0x565036[_0xe49a('0x6')][_0xe49a('0x7')](),'uri':Mustache['render'](_0x565036[_0xe49a('0x8')],_0x2e70d0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x565036[_0xe49a('0x9')])==='number'&&parseInt(_0x565036['data5'])>=0x1&&parseInt(_0x565036['data5'])<=0xa?parseInt(_0x565036['data5'])*0x3e8:0x5*0x3e8};try{_0x1cce59[_0xe49a('0xa')]=_0x565036[_0xe49a('0xb')]?JSON['parse'](Mustache[_0xe49a('0xc')](_0x565036[_0xe49a('0xb')],_0x2e70d0)):{};}catch(_0x2389fc){logger[_0xe49a('0xd')](_0x2389fc[_0xe49a('0xe')]);}switch(_0x565036[_0xe49a('0x6')]['toUpperCase']()){case _0xe49a('0xf'):case _0xe49a('0x10'):_0x3f6ebd=null;_0x1cce59['qs']=_0x2e70d0;break;case _0xe49a('0x11'):case'PUT':if(_0x565036[_0xe49a('0x12')]){try{_0x3f6ebd=JSON[_0xe49a('0x13')](Mustache['render'](_0x565036[_0xe49a('0x12')],_0x2e70d0));_0x1cce59[_0xe49a('0x14')]=_0x3f6ebd;}catch(_0x28fe99){logger['error'](_0x28fe99[_0xe49a('0xe')]);logger[_0xe49a('0xd')](_0xe49a('0x15'));}}else{_0x3f6ebd=_0x2e70d0;_0x1cce59['body']=_0x3f6ebd;}break;}logger[_0xe49a('0x16')](util['format'](_0xe49a('0x17'),_0x565036['data1'],_0x565036[_0xe49a('0x8')],JSON[_0xe49a('0x18')](_0x1cce59)));rp(_0x1cce59)['then'](function(_0x44cd00){_0x3f6ebd=!_['isNil'](_0x3f6ebd)?_0xe49a('0x19')+_0x3f6ebd:'';_0x1a46df=typeof _0x44cd00['body']==='object'?JSON['stringify'](_0x44cd00['body']):_0x44cd00[_0xe49a('0x14')];logger[_0xe49a('0x16')](util[_0xe49a('0x1a')](_0xe49a('0x1b'),_0x565036[_0xe49a('0x6')],_0x565036[_0xe49a('0x8')],_0x44cd00[_0xe49a('0x1c')],_0x1a46df));})[_0xe49a('0x1d')](function(_0x58ef57){logger[_0xe49a('0xd')](util[_0xe49a('0x1a')](_0xe49a('0x1e'),_0x565036['data1'],_0x565036[_0xe49a('0x8')],_0x58ef57['statusCode'],_0x58ef57[_0xe49a('0x1f')],_0x58ef57[_0xe49a('0x20')]));});}; \ No newline at end of file +var _0xee76=['number','headers','data6','parse','error','stack','GET','POST','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xee76,0xfe));var _0x6ee7=function(_0x5534e3,_0x5e40c4){_0x5534e3=_0x5534e3-0x0;var _0xd605df=_0xee76[_0x5534e3];return _0xd605df;};'use strict';var rp=require(_0x6ee7('0x0'));var util=require(_0x6ee7('0x1'));var _=require(_0x6ee7('0x2'));var Mustache=require('mustache');var logger=require(_0x6ee7('0x3'))(_0x6ee7('0x4'));exports[_0x6ee7('0x5')]=function(_0x4e6dfd,_0x5f3578){var _0x1ba614,_0x40a0d0;var _0x23e6e0={'method':_0x4e6dfd[_0x6ee7('0x6')][_0x6ee7('0x7')](),'uri':Mustache[_0x6ee7('0x8')](_0x4e6dfd['data2'],_0x5f3578),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4e6dfd[_0x6ee7('0x9')])===_0x6ee7('0xa')&&parseInt(_0x4e6dfd[_0x6ee7('0x9')])>=0x1&&parseInt(_0x4e6dfd[_0x6ee7('0x9')])<=0xa?parseInt(_0x4e6dfd[_0x6ee7('0x9')])*0x3e8:0x5*0x3e8};try{_0x23e6e0[_0x6ee7('0xb')]=_0x4e6dfd[_0x6ee7('0xc')]?JSON[_0x6ee7('0xd')](Mustache[_0x6ee7('0x8')](_0x4e6dfd[_0x6ee7('0xc')],_0x5f3578)):{};}catch(_0x330067){logger[_0x6ee7('0xe')](_0x330067[_0x6ee7('0xf')]);}switch(_0x4e6dfd['data1'][_0x6ee7('0x7')]()){case _0x6ee7('0x10'):case'DELETE':_0x1ba614=null;_0x23e6e0['qs']=_0x5f3578;break;case _0x6ee7('0x11'):case'PUT':if(_0x4e6dfd['data7']){try{_0x1ba614=JSON['parse'](Mustache[_0x6ee7('0x8')](_0x4e6dfd[_0x6ee7('0x12')],_0x5f3578));_0x23e6e0['body']=_0x1ba614;}catch(_0x392c5b){logger[_0x6ee7('0xe')](_0x392c5b['stack']);logger[_0x6ee7('0xe')](_0x6ee7('0x13'));}}else{_0x1ba614=_0x5f3578;_0x23e6e0[_0x6ee7('0x14')]=_0x1ba614;}break;}logger[_0x6ee7('0x15')](util[_0x6ee7('0x16')](_0x6ee7('0x17'),_0x4e6dfd[_0x6ee7('0x6')],_0x4e6dfd[_0x6ee7('0x18')],JSON[_0x6ee7('0x19')](_0x23e6e0)));rp(_0x23e6e0)[_0x6ee7('0x1a')](function(_0x5549ee){_0x1ba614=!_[_0x6ee7('0x1b')](_0x1ba614)?_0x6ee7('0x1c')+_0x1ba614:'';_0x40a0d0=typeof _0x5549ee[_0x6ee7('0x14')]===_0x6ee7('0x1d')?JSON['stringify'](_0x5549ee[_0x6ee7('0x14')]):_0x5549ee['body'];logger['info'](util[_0x6ee7('0x16')](_0x6ee7('0x1e'),_0x4e6dfd[_0x6ee7('0x6')],_0x4e6dfd['data2'],_0x5549ee[_0x6ee7('0x1f')],_0x40a0d0));})['catch'](function(_0x2e1859){logger[_0x6ee7('0xe')](util[_0x6ee7('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4e6dfd['data1'],_0x4e6dfd[_0x6ee7('0x18')],_0x2e1859[_0x6ee7('0x1f')],_0x2e1859[_0x6ee7('0x20')],_0x2e1859['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 4c81765..a28a0ee 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 _0x98e4=['../../config/logger','client','http','Request','request','then','debug','routing','rpc','error','message','catch','exports','jayson/promise','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98e4,0x12a));var _0x498e=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x98e4[_0x4d8ed9];return _0x1e2140;};'use strict';var jayson=require(_0x498e('0x0'));var BPromise=require(_0x498e('0x1'));var logger=require(_0x498e('0x2'))('routing');var client=jayson[_0x498e('0x3')][_0x498e('0x4')]({'port':0x2329});client[_0x498e('0x5')]=function(_0x531fe3,_0x44764a){return new BPromise(function(_0x489737,_0x23d5c3){return client[_0x498e('0x6')](_0x531fe3,_0x44764a)[_0x498e('0x7')](function(_0x5b1ef4){logger[_0x498e('0x8')]('rpc',_0x498e('0x9'),_0x531fe3,_0x44764a,_0x5b1ef4);if(_0x5b1ef4['error']){logger['error'](_0x498e('0xa'),_0x498e('0x9'),_0x531fe3,_0x5b1ef4[_0x498e('0xb')][_0x498e('0xc')],_0x44764a);return _0x23d5c3(_0x5b1ef4[_0x498e('0xb')][_0x498e('0xc')]);}else{return _0x489737(_0x5b1ef4['result']);}})[_0x498e('0xd')](function(_0xe60847){logger[_0x498e('0xb')](_0x498e('0xa'),'routing',_0x531fe3,_0xe60847,_0x44764a);return _0x23d5c3(_0xe60847);});});};module[_0x498e('0xe')]=client; \ No newline at end of file +var _0x890a=['bluebird','../../config/logger','routing','http','Request','then','rpc','error','message','result','catch','exports'];(function(_0x9ae685,_0x2c6652){var _0x4c492e=function(_0xde76ce){while(--_0xde76ce){_0x9ae685['push'](_0x9ae685['shift']());}};_0x4c492e(++_0x2c6652);}(_0x890a,0xb4));var _0xa890=function(_0x2ef8c5,_0xb2b90b){_0x2ef8c5=_0x2ef8c5-0x0;var _0x4e59b4=_0x890a[_0x2ef8c5];return _0x4e59b4;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa890('0x0'));var logger=require(_0xa890('0x1'))(_0xa890('0x2'));var client=jayson['client'][_0xa890('0x3')]({'port':0x2329});client[_0xa890('0x4')]=function(_0x523577,_0x21fcf0){return new BPromise(function(_0x1182bb,_0x3ce18){return client['request'](_0x523577,_0x21fcf0)[_0xa890('0x5')](function(_0x3e59d5){logger['debug'](_0xa890('0x6'),_0xa890('0x2'),_0x523577,_0x21fcf0,_0x3e59d5);if(_0x3e59d5[_0xa890('0x7')]){logger[_0xa890('0x7')](_0xa890('0x6'),_0xa890('0x2'),_0x523577,_0x3e59d5['error'][_0xa890('0x8')],_0x21fcf0);return _0x3ce18(_0x3e59d5[_0xa890('0x7')][_0xa890('0x8')]);}else{return _0x1182bb(_0x3e59d5[_0xa890('0x9')]);}})[_0xa890('0xa')](function(_0x55507e){logger[_0xa890('0x7')](_0xa890('0x6'),_0xa890('0x2'),_0x523577,_0x55507e,_0x21fcf0);return _0x3ce18(_0x55507e);});});};module[_0xa890('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e1f2b53..6a859f3 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 _0xd567=['./realtime','then','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','./server'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0xd567,0x17f));var _0x7d56=function(_0x11d82c,_0xb3675f){_0x11d82c=_0x11d82c-0x0;var _0x4ddc00=_0xd567[_0x11d82c];return _0x4ddc00;};'use strict';var server=require(_0x7d56('0x0'));var Realtime=require(_0x7d56('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount['getMailAccounts']())[_0x7d56('0x2')](realtime[_0x7d56('0x3')]())[_0x7d56('0x2')](function(){email['refresh'](realtime[_0x7d56('0x4')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x7d56('0x2')](function(){return initRealtime();})[_0x7d56('0x2')](function(){return setting[_0x7d56('0x5')]();})['then'](function(_0x437e4e){return setInterval(initRealtime,_0x437e4e[_0x7d56('0x6')]*0x3e8);})[_0x7d56('0x7')](function(_0x4e9ba0){logger['error']('Email\x20service\x20initialization',_0x4e9ba0);});}main(); \ No newline at end of file +var _0x7cb6=['refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x4ffb23,_0x174f2b){var _0x1b9def=function(_0x314599){while(--_0x314599){_0x4ffb23['push'](_0x4ffb23['shift']());}};_0x1b9def(++_0x174f2b);}(_0x7cb6,0x126));var _0x67cb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7cb6[_0x167cc1];return _0x10bc4b;};'use strict';var server=require('./server');var Realtime=require(_0x67cb('0x0'));var EmailChannel=require(_0x67cb('0x1'));var mailAccount=require(_0x67cb('0x2'));var setting=require(_0x67cb('0x3'));var logger=require(_0x67cb('0x4'))(_0x67cb('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x67cb('0x6')]()[_0x67cb('0x7')](mailAccount[_0x67cb('0x8')]())['then'](realtime[_0x67cb('0x9')]())[_0x67cb('0x7')](function(){email[_0x67cb('0xa')](realtime[_0x67cb('0xb')]);return realtime;});}function main(){return server[_0x67cb('0xc')](realtime,email)[_0x67cb('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x67cb('0xd')]();})[_0x67cb('0x7')](function(_0xc1b3ac){return setInterval(initRealtime,_0xc1b3ac[_0x67cb('0xe')]*0x3e8);})['catch'](function(_0x535c6d){logger[_0x67cb('0xf')]('Email\x20service\x20initialization',_0x535c6d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1c9a1c6..8cd8cff 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 _0x5264=['firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','status','Imap','total','isNil','stringify','md5','refresh','hasOwnProperty','service','custom','provider','imapAccounts','email','handleImapBox','bind','handleImapEmail','end','handleImapError','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0xfb9f90,_0x1df0b3){var _0x5e004b=function(_0x3e064d){while(--_0x3e064d){_0xfb9f90['push'](_0xfb9f90['shift']());}};_0x5e004b(++_0x1df0b3);}(_0x5264,0x138));var _0x4526=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5264[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4526('0x0'));var moment=require(_0x4526('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x4526('0x2'))('email');config['redis']=_[_0x4526('0x3')](config[_0x4526('0x4')],{'host':_0x4526('0x5'),'port':0x18eb});var io=require(_0x4526('0x6'))(new Redis(config[_0x4526('0x4')]));var EmailImap=require(_0x4526('0x7'));var EmailSmtp=require(_0x4526('0x8'));var mailAccount=require(_0x4526('0x9'));var md5Accounts={};function EmailChannel(_0x461af0){logger[_0x4526('0xa')](_0x4526('0xb'));this[_0x4526('0xc')]=_0x461af0[_0x4526('0xc')];this['imapAccounts']={};this[_0x4526('0xd')]=new EmailSmtp();}EmailChannel[_0x4526('0xe')][_0x4526('0xf')]=function(_0x14989e){var _0x129007=this[_0x4526('0xc')][_0x14989e];var _0x4241ea={'id':_0x129007['id'],'name':_0x129007[_0x4526('0x10')],'key':_0x129007[_0x4526('0x11')],'active':_0x129007[_0x4526('0x12')],'Imap':{'status':_0x129007['Imap'][_0x4526('0x13')],'messageStatus':_0x129007[_0x4526('0x14')]['messageStatus'],'total':_0x129007[_0x4526('0x14')][_0x4526('0x15')]}};if(_[_0x4526('0x16')](md5Accounts[_0x14989e])){md5Accounts[_0x14989e]={};}var _0x3a1aa1=md5(JSON[_0x4526('0x17')](_0x4241ea));if(md5Accounts[_0x14989e][_0x4526('0x18')]!==_0x3a1aa1){md5Accounts[_0x14989e][_0x4526('0x18')]=_0x3a1aa1;io[_0x4526('0xf')]('mailAccount:update',_0x4241ea);}};EmailChannel['prototype'][_0x4526('0x19')]=function(_0x452aba){for(var _0x16094c in _0x452aba){if(_0x452aba[_0x4526('0x1a')](_0x16094c)){if(_0x452aba[_0x16094c]['Imap']&&_0x452aba[_0x16094c]['active']){var _0x238078=_0x452aba[_0x16094c][_0x4526('0x14')];if(!_0x238078[_0x4526('0x1b')]&&_0x452aba[_0x16094c]['provider']!==_0x4526('0x1c'))_0x238078[_0x4526('0x1b')]=_0x452aba[_0x16094c][_0x4526('0x1d')];if(!this[_0x4526('0x1e')][_0x4526('0x1a')](_0x238078['id'])){this['imapAccounts'][_0x238078['id']]=new EmailImap(_0x238078,_0x452aba[_0x16094c][_0x4526('0x1f')]);this[_0x4526('0x1e')][_0x238078['id']]['on']('box',this[_0x4526('0x20')][_0x4526('0x21')](this,_0x16094c));this['imapAccounts'][_0x238078['id']]['on'](_0x4526('0x1f'),this[_0x4526('0x22')][_0x4526('0x21')](this,_0x16094c));this[_0x4526('0x1e')][_0x238078['id']]['on'](_0x4526('0x23'),this['handleImapEnd'][_0x4526('0x21')](this,_0x16094c));this[_0x4526('0x1e')][_0x238078['id']]['on']('error',this[_0x4526('0x24')][_0x4526('0x21')](this,_0x16094c));}}else{if(_[_0x4526('0x16')](this['mailAccounts'][_0x16094c][_0x4526('0x14')])){this['mailAccounts'][_0x16094c][_0x4526('0x14')]={};}this['mailAccounts'][_0x16094c][_0x4526('0x14')][_0x4526('0x13')]=_0x4526('0x25');this[_0x4526('0xc')][_0x16094c][_0x4526('0x14')][_0x4526('0x26')]='';this['emit'](_0x16094c);}}}};EmailChannel['prototype'][_0x4526('0x20')]=function(_0x52ed79,_0x5e3d69){if(this[_0x4526('0xc')][_0x52ed79]){this[_0x4526('0xc')][_0x52ed79][_0x4526('0x14')]['status']=_0x4526('0x27');this[_0x4526('0xc')][_0x52ed79][_0x4526('0x14')][_0x4526('0x26')]=_0x5e3d69['name'];if(_0x5e3d69[_0x4526('0x28')]){this[_0x4526('0xc')][_0x52ed79][_0x4526('0x14')][_0x4526('0x15')]=_0x5e3d69['messages'][_0x4526('0x15')];}return this['emit'](_0x52ed79);}};EmailChannel[_0x4526('0xe')]['handleImapEmail']=function(_0x4d85b9,_0x45cf75){logger[_0x4526('0xa')](_0x4526('0x29'),_0x45cf75[_0x4526('0x2a')],_0x45cf75[_0x4526('0x2b')],_0x45cf75[_0x4526('0x2c')],_0x4d85b9);if(this['mailAccounts'][_0x4d85b9]){return mailAccount[_0x4526('0x2d')](_0x4d85b9,_0x45cf75)[_0x4526('0x2e')](function(_0x549e5d){if(_0x549e5d){logger[_0x4526('0xa')](_0x4526('0x2f'));}})['catch'](function(_0x55f59b){logger[_0x4526('0x30')](_0x4526('0x31'),JSON[_0x4526('0x17')](_0x55f59b));});}};EmailChannel[_0x4526('0xe')][_0x4526('0x32')]=function(_0x28a614){if(this['mailAccounts'][_0x28a614]&&this[_0x4526('0xc')][_0x28a614][_0x4526('0x14')]){if(this[_0x4526('0x1e')][this[_0x4526('0xc')][_0x28a614][_0x4526('0x14')]['id']]){delete this[_0x4526('0x1e')][this[_0x4526('0xc')][_0x28a614][_0x4526('0x14')]['id']];}this[_0x4526('0xc')][_0x28a614][_0x4526('0x14')][_0x4526('0x33')]=moment();this['emit'](_0x28a614);}};EmailChannel[_0x4526('0xe')][_0x4526('0x24')]=function(_0x89074b,_0x4db883){if(this[_0x4526('0xc')][_0x89074b]){this[_0x4526('0xc')][_0x89074b][_0x4526('0x14')][_0x4526('0x13')]=_0x4526('0x30');this[_0x4526('0xc')][_0x89074b][_0x4526('0x14')][_0x4526('0x26')]=_0x4db883;return this[_0x4526('0xf')](_0x89074b);}};EmailChannel[_0x4526('0xe')]['sendMail']=function(_0x12898a,_0x1be784){return this[_0x4526('0xd')][_0x4526('0x34')](_0x12898a,_0x1be784);};EmailChannel[_0x4526('0xe')][_0x4526('0x35')]=function(_0x8707b0){var _0x3c6de6=this;if(this[_0x4526('0xc')][_0x8707b0['id']]){if(_[_0x4526('0x16')](this[_0x4526('0xc')][_0x8707b0['id']][_0x4526('0x36')])){this[_0x4526('0xc')][_0x8707b0['id']][_0x4526('0x36')]={};}this[_0x4526('0xc')][_0x8707b0['id']][_0x4526('0x36')]['lastSync']=moment();return new BPromise(function(_0x28bb0b,_0x1e8a10){return _0x3c6de6[_0x4526('0xd')][_0x4526('0x37')](_0x8707b0)[_0x4526('0x2e')](function(_0x32126a){_0x3c6de6[_0x4526('0xc')][_0x8707b0['id']]['Smtp'][_0x4526('0x13')]=_0x4526('0x38');_0x3c6de6['mailAccounts'][_0x8707b0['id']][_0x4526('0x36')][_0x4526('0x26')]='';_0x3c6de6['emit'](_0x8707b0['id']);_0x28bb0b(_0x32126a);})[_0x4526('0x39')](function(_0x50105a){_0x3c6de6['mailAccounts'][_0x8707b0['id']][_0x4526('0x36')][_0x4526('0x13')]=_0x4526('0x30');_0x3c6de6[_0x4526('0xc')][_0x8707b0['id']]['Smtp']['messageStatus']=_0x50105a;_0x3c6de6[_0x4526('0xf')](_0x8707b0['id']);_0x1e8a10(_0x50105a);});});}return this['smtp'][_0x4526('0x37')](_0x8707b0);};module[_0x4526('0x3a')]=EmailChannel; \ No newline at end of file +var _0x1522=['end','handleImapEnd','error','handleImapError','status','disabled','connected','name','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verified','verify','exports','lodash','moment','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','messageStatus','total','isNil','stringify','refresh','service','provider','custom','hasOwnProperty','handleImapBox','bind'];(function(_0x442a73,_0x3521f2){var _0x194591=function(_0x2e0e2b){while(--_0x2e0e2b){_0x442a73['push'](_0x442a73['shift']());}};_0x194591(++_0x3521f2);}(_0x1522,0xc8));var _0x2152=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1522[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2152('0x0'));var moment=require(_0x2152('0x1'));var BPromise=require('bluebird');var md5=require(_0x2152('0x2'));var Redis=require(_0x2152('0x3'));var config=require('../../../config/environment');var logger=require(_0x2152('0x4'))(_0x2152('0x5'));config[_0x2152('0x6')]=_[_0x2152('0x7')](config['redis'],{'host':_0x2152('0x8'),'port':0x18eb});var io=require(_0x2152('0x9'))(new Redis(config[_0x2152('0x6')]));var EmailImap=require(_0x2152('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x2152('0xb'));var md5Accounts={};function EmailChannel(_0x38730b){logger['info'](_0x2152('0xc'));this['mailAccounts']=_0x38730b[_0x2152('0xd')];this[_0x2152('0xe')]={};this[_0x2152('0xf')]=new EmailSmtp();}EmailChannel[_0x2152('0x10')][_0x2152('0x11')]=function(_0x2d5382){var _0x5f11a9=this[_0x2152('0xd')][_0x2d5382];var _0x3b601a={'id':_0x5f11a9['id'],'name':_0x5f11a9['name'],'key':_0x5f11a9[_0x2152('0x12')],'active':_0x5f11a9[_0x2152('0x13')],'Imap':{'status':_0x5f11a9[_0x2152('0x14')]['status'],'messageStatus':_0x5f11a9['Imap'][_0x2152('0x15')],'total':_0x5f11a9['Imap'][_0x2152('0x16')]}};if(_[_0x2152('0x17')](md5Accounts[_0x2d5382])){md5Accounts[_0x2d5382]={};}var _0x5609a2=md5(JSON[_0x2152('0x18')](_0x3b601a));if(md5Accounts[_0x2d5382]['md5']!==_0x5609a2){md5Accounts[_0x2d5382][_0x2152('0x2')]=_0x5609a2;io[_0x2152('0x11')]('mailAccount:update',_0x3b601a);}};EmailChannel[_0x2152('0x10')][_0x2152('0x19')]=function(_0x41160a){for(var _0x5ecd82 in _0x41160a){if(_0x41160a['hasOwnProperty'](_0x5ecd82)){if(_0x41160a[_0x5ecd82][_0x2152('0x14')]&&_0x41160a[_0x5ecd82][_0x2152('0x13')]){var _0xa41783=_0x41160a[_0x5ecd82][_0x2152('0x14')];if(!_0xa41783[_0x2152('0x1a')]&&_0x41160a[_0x5ecd82][_0x2152('0x1b')]!==_0x2152('0x1c'))_0xa41783[_0x2152('0x1a')]=_0x41160a[_0x5ecd82][_0x2152('0x1b')];if(!this[_0x2152('0xe')][_0x2152('0x1d')](_0xa41783['id'])){this[_0x2152('0xe')][_0xa41783['id']]=new EmailImap(_0xa41783,_0x41160a[_0x5ecd82][_0x2152('0x5')]);this['imapAccounts'][_0xa41783['id']]['on']('box',this[_0x2152('0x1e')][_0x2152('0x1f')](this,_0x5ecd82));this['imapAccounts'][_0xa41783['id']]['on'](_0x2152('0x5'),this['handleImapEmail']['bind'](this,_0x5ecd82));this['imapAccounts'][_0xa41783['id']]['on'](_0x2152('0x20'),this[_0x2152('0x21')]['bind'](this,_0x5ecd82));this[_0x2152('0xe')][_0xa41783['id']]['on'](_0x2152('0x22'),this[_0x2152('0x23')][_0x2152('0x1f')](this,_0x5ecd82));}}else{if(_['isNil'](this[_0x2152('0xd')][_0x5ecd82][_0x2152('0x14')])){this['mailAccounts'][_0x5ecd82]['Imap']={};}this[_0x2152('0xd')][_0x5ecd82]['Imap'][_0x2152('0x24')]=_0x2152('0x25');this['mailAccounts'][_0x5ecd82]['Imap'][_0x2152('0x15')]='';this[_0x2152('0x11')](_0x5ecd82);}}}};EmailChannel[_0x2152('0x10')][_0x2152('0x1e')]=function(_0x187057,_0x5ab0eb){if(this[_0x2152('0xd')][_0x187057]){this[_0x2152('0xd')][_0x187057][_0x2152('0x14')][_0x2152('0x24')]=_0x2152('0x26');this[_0x2152('0xd')][_0x187057][_0x2152('0x14')]['messageStatus']=_0x5ab0eb[_0x2152('0x27')];if(_0x5ab0eb[_0x2152('0x28')]){this[_0x2152('0xd')][_0x187057][_0x2152('0x14')]['total']=_0x5ab0eb[_0x2152('0x28')][_0x2152('0x16')];}return this[_0x2152('0x11')](_0x187057);}};EmailChannel[_0x2152('0x10')][_0x2152('0x29')]=function(_0x15384d,_0x381628){logger[_0x2152('0x2a')](_0x2152('0x2b'),_0x381628['firstName'],_0x381628['lastName'],_0x381628[_0x2152('0x2c')],_0x15384d);if(this[_0x2152('0xd')][_0x15384d]){return mailAccount[_0x2152('0x2d')](_0x15384d,_0x381628)[_0x2152('0x2e')](function(_0x492825){if(_0x492825){logger['info'](_0x2152('0x2f'));}})[_0x2152('0x30')](function(_0x3b2abe){logger[_0x2152('0x22')](_0x2152('0x31'),JSON[_0x2152('0x18')](_0x3b2abe));});}};EmailChannel[_0x2152('0x10')][_0x2152('0x21')]=function(_0x237a8a){if(this[_0x2152('0xd')][_0x237a8a]&&this['mailAccounts'][_0x237a8a][_0x2152('0x14')]){if(this[_0x2152('0xe')][this[_0x2152('0xd')][_0x237a8a][_0x2152('0x14')]['id']]){delete this[_0x2152('0xe')][this[_0x2152('0xd')][_0x237a8a][_0x2152('0x14')]['id']];}this[_0x2152('0xd')][_0x237a8a]['Imap'][_0x2152('0x32')]=moment();this[_0x2152('0x11')](_0x237a8a);}};EmailChannel[_0x2152('0x10')][_0x2152('0x23')]=function(_0x2ea35b,_0x1ae9a4){if(this[_0x2152('0xd')][_0x2ea35b]){this[_0x2152('0xd')][_0x2ea35b][_0x2152('0x14')][_0x2152('0x24')]=_0x2152('0x22');this[_0x2152('0xd')][_0x2ea35b][_0x2152('0x14')][_0x2152('0x15')]=_0x1ae9a4;return this['emit'](_0x2ea35b);}};EmailChannel[_0x2152('0x10')][_0x2152('0x33')]=function(_0x40625a,_0x216285){return this[_0x2152('0xf')][_0x2152('0x34')](_0x40625a,_0x216285);};EmailChannel[_0x2152('0x10')][_0x2152('0x35')]=function(_0x2c069a){var _0x1ce564=this;if(this[_0x2152('0xd')][_0x2c069a['id']]){if(_['isNil'](this[_0x2152('0xd')][_0x2c069a['id']][_0x2152('0x36')])){this['mailAccounts'][_0x2c069a['id']][_0x2152('0x36')]={};}this['mailAccounts'][_0x2c069a['id']][_0x2152('0x36')]['lastSync']=moment();return new BPromise(function(_0xf306b3,_0x54bd71){return _0x1ce564[_0x2152('0xf')]['verify'](_0x2c069a)[_0x2152('0x2e')](function(_0x3a2769){_0x1ce564['mailAccounts'][_0x2c069a['id']][_0x2152('0x36')]['status']=_0x2152('0x37');_0x1ce564[_0x2152('0xd')][_0x2c069a['id']]['Smtp'][_0x2152('0x15')]='';_0x1ce564[_0x2152('0x11')](_0x2c069a['id']);_0xf306b3(_0x3a2769);})[_0x2152('0x30')](function(_0x1dbfb1){_0x1ce564[_0x2152('0xd')][_0x2c069a['id']][_0x2152('0x36')][_0x2152('0x24')]=_0x2152('0x22');_0x1ce564[_0x2152('0xd')][_0x2c069a['id']][_0x2152('0x36')]['messageStatus']=_0x1dbfb1;_0x1ce564['emit'](_0x2c069a['id']);_0x54bd71(_0x1dbfb1);});});}return this[_0x2152('0xf')][_0x2152('0x38')](_0x2c069a);};module[_0x2152('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index fef7080..37a4c61 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 _0x4155=['handleSimpleParser','error','html','parser','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','\x20bytes,\x20email\x20size:\x20','\x20bytes','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','\x20bytes]','substring','text','textCode','exports','lodash','util','imap','mailparser','iconv','Iconv','./utils','../../../config/logger','../../../config/environment','emailMaxHTMLbytesLimit','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','handleError','inherits','connTimeout','authTimeout','service','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','user','email','anonymous@xcally.com','host','port','tls','required','prototype','openBox','handleOpenBox','emit','handleCloseBox','readUnseen','handleReadUnseen','length','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody'];(function(_0xdb13ea,_0x2c691c){var _0x5452ae=function(_0x575a2c){while(--_0x575a2c){_0xdb13ea['push'](_0xdb13ea['shift']());}};_0x5452ae(++_0x2c691c);}(_0x4155,0x161));var _0x5415=function(_0xc62411,_0x16b3a){_0xc62411=_0xc62411-0x0;var _0x27de98=_0x4155[_0xc62411];return _0x27de98;};'use strict';var _=require(_0x5415('0x0'));var util=require(_0x5415('0x1'));var Imap=require(_0x5415('0x2'));var simpleParser=require(_0x5415('0x3'))['simpleParser'];var Iconv=require(_0x5415('0x4'))[_0x5415('0x5')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x5415('0x6'));var logger=require(_0x5415('0x7'))('email');var config=require(_0x5415('0x8'));const MAX_HTML_BYTES_SIZE=config[_0x5415('0x9')]||0xee6b2800;function EmailImap(_0x282e8d,_0x4188de){this[_0x5415('0xa')]=_0x282e8d[_0x5415('0xa')];this[_0x5415('0xb')]=this[_0x5415('0xc')](_0x282e8d,_0x4188de);this[_0x5415('0x2')]=new Imap(this[_0x5415('0xb')]);this[_0x5415('0x2')]['once'](_0x5415('0xd'),this[_0x5415('0xe')][_0x5415('0xf')](this));this[_0x5415('0x2')][_0x5415('0x10')](_0x5415('0x11'),this[_0x5415('0x12')][_0x5415('0xf')](this));this['imap']['on']('error',this[_0x5415('0x13')]['bind'](this));this[_0x5415('0x2')]['connect']();}util[_0x5415('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x3bf436,_0x2978b4){var _0x193e08={'connTimeout':_0x3bf436[_0x5415('0x15')]?_0x3bf436[_0x5415('0x15')]*0x3e8:0x2710,'authTimeout':_0x3bf436[_0x5415('0x16')]?_0x3bf436[_0x5415('0x16')]*0x3e8:0x1388};if(_0x3bf436[_0x5415('0x17')]){_0x193e08['user']=_0x3bf436['user'];if(_0x3bf436[_0x5415('0x18')]){_0x193e08[_0x5415('0x19')]=utils[_0x5415('0x1a')](_0x3bf436[_0x5415('0x1b')][_0x5415('0x1c')],_0x3bf436['user']);}else{_0x193e08['password']=_0x3bf436[_0x5415('0x1d')];}}else{if(_0x3bf436[_0x5415('0x1e')]){_0x193e08[_0x5415('0x1f')]=_0x3bf436['user'];_0x193e08[_0x5415('0x1d')]=_0x3bf436[_0x5415('0x1d')];}}_0x193e08[_0x5415('0x20')]=_0x2978b4||_0x3bf436['user']||_0x5415('0x21');_0x193e08['host']=_0x3bf436[_0x5415('0x22')];_0x193e08[_0x5415('0x23')]=_0x3bf436[_0x5415('0x23')]||0x3e1;if(_0x3bf436['tls']){_0x193e08[_0x5415('0x24')]=!![];}else{_0x193e08[_0x5415('0x24')]=![];_0x193e08['autotls']=_0x5415('0x25');}return _0x193e08;};EmailImap[_0x5415('0x26')][_0x5415('0xe')]=function(){this['imap'][_0x5415('0x27')](this[_0x5415('0xa')],![],this[_0x5415('0x28')][_0x5415('0xf')](this));};EmailImap[_0x5415('0x26')][_0x5415('0x28')]=function(_0x2a18ca,_0x3c4f64){if(_0x2a18ca){this['handleError'](_0x2a18ca,!![]);}else{this[_0x5415('0x29')]('box',_0x3c4f64);this['readUnseen']();}};EmailImap[_0x5415('0x26')][_0x5415('0x2a')]=function(_0x18c096){if(_0x18c096){this['handleError'](_0x18c096,!![]);}else{this[_0x5415('0x2')][_0x5415('0x11')]();this['emit'](_0x5415('0x11'));}};EmailImap['prototype'][_0x5415('0x2b')]=function(){this['imap']['search'](['UNSEEN'],this[_0x5415('0x2c')][_0x5415('0xf')](this));};EmailImap[_0x5415('0x26')]['handleReadUnseen']=function(_0x2d5e1e,_0xe7e40){if(_0x2d5e1e){this[_0x5415('0x13')](_0x2d5e1e,!![]);}else{if(_0xe7e40[_0x5415('0x2d')]){try{var _0x425162=this[_0x5415('0x2')]['fetch'](_0xe7e40['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x425162['on']('message',this[_0x5415('0x2e')][_0x5415('0xf')](this));_0x425162[_0x5415('0x10')]('error',this[_0x5415('0x2f')]['bind'](this));_0x425162[_0x5415('0x10')](_0x5415('0x11'),this[_0x5415('0x30')][_0x5415('0xf')](this));}catch(_0xe08df1){logger['error'](_0x5415('0x2c'),this[_0x5415('0xb')][_0x5415('0x20')],_0xe08df1);this['imap'][_0x5415('0x31')](!![],this['handleCloseBox'][_0x5415('0xf')](this));}}else{this[_0x5415('0x2')][_0x5415('0x31')](!![],this['handleCloseBox'][_0x5415('0xf')](this));}}};EmailImap[_0x5415('0x26')][_0x5415('0x2e')]=function(_0x2f78e2){_0x2f78e2['on'](_0x5415('0x32'),this['handleMessageBody'][_0x5415('0xf')](this));_0x2f78e2[_0x5415('0x10')](_0x5415('0x33'),this[_0x5415('0x34')][_0x5415('0xf')](this));_0x2f78e2[_0x5415('0x10')](_0x5415('0x11'),this[_0x5415('0x35')][_0x5415('0xf')](this));};EmailImap[_0x5415('0x26')][_0x5415('0x36')]=function(_0x29bbe6){simpleParser(_0x29bbe6,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x5415('0x26')][_0x5415('0x34')]=function(){};EmailImap[_0x5415('0x26')]['handleMessageEnd']=function(){};EmailImap[_0x5415('0x26')][_0x5415('0x37')]=function(_0x56ab5f,_0x2d1e1c){if(_0x56ab5f){logger[_0x5415('0x38')](_0x56ab5f);}else{var _0x25914c=this;const _0x3e3867=_0x2d1e1c[_0x5415('0x39')][_0x5415('0x2d')];if(_0x3e3867Empty\x20message

','Attachments','generateXOAuth2Token','user=','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','@xcally.com','head','name','substring','indexOf','split','length','html','test','includes','attachments','filename','_SRC','replace','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x131d39['slice'](0x0,-0x1)['join']('\x20'):_0x9a5845[_0x7b9f('0xe')];}return'Anonymous';}function getLastName(_0x311b1d){var _0x250d47=_[_0x7b9f('0xd')](_0x311b1d[_0x7b9f('0x9')]);if(_0x250d47&&_0x250d47[_0x7b9f('0xe')]){var _0x4428a4=_0x250d47[_0x7b9f('0xe')][_0x7b9f('0x11')](/\s+/);return _0x4428a4[_0x7b9f('0x12')]>0x1?_0x4428a4['pop']():'';}return'';}function getMails(_0x1a3004,_0x2ba1b6){var _0x4d7fef='';for(var _0x50cece=0x0;_0x50cece<_0x2ba1b6['value']['length'];_0x50cece+=0x1){if(_0x2ba1b6[_0x7b9f('0x9')][_0x50cece][_0x7b9f('0xa')]!==_0x1a3004){if(!_['isEmpty'](_0x4d7fef)){_0x4d7fef+=',';}_0x4d7fef+=_0x2ba1b6[_0x7b9f('0x9')][_0x50cece]['name']||_0x2ba1b6[_0x7b9f('0x9')][_0x50cece][_0x7b9f('0xa')]||'';_0x4d7fef+='\x20<';_0x4d7fef+=_0x2ba1b6[_0x7b9f('0x9')][_0x50cece][_0x7b9f('0xa')]?_0x2ba1b6[_0x7b9f('0x9')][_0x50cece][_0x7b9f('0xa')]:_0x7b9f('0xb')+random['generate'](0x6)+'@xcally.com';_0x4d7fef+='>';}}return _0x4d7fef;}function parseEmail(_0x5b19b4,_0x26a90b,_0x5e8ecc){if(_0x26a90b[_0x7b9f('0x13')]){var _0x2cf67d=/)<[^<]*)*<\/script>/gi;while(_0x2cf67d[_0x7b9f('0x14')](_0x26a90b[_0x7b9f('0x13')])){_0x26a90b[_0x7b9f('0x13')]=_0x26a90b[_0x7b9f('0x13')]['replace'](_0x2cf67d,'');}if(_0x26a90b[_0x7b9f('0x13')][_0x7b9f('0x15')]('{_0x398f01['push'](_0x1c73f7[_0x7b9f('0x17')]);});var _0x2d5616=/]+>/g;var _0x24e707=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x247e75=_0x26a90b[_0x7b9f('0x13')]['replace'](_0x24e707,_0x7b9f('0x18'));var _0x28e591=_0x247e75[_0x7b9f('0x19')](_0x2d5616,'_IMG');for(let _0x4163df=0x0;_0x4163df<_0x398f01['length'];_0x4163df++){var _0x3164cb=_0x28e591['replace'](_0x7b9f('0x1a'),_0x7b9f('0x1b')+_0x398f01[_0x4163df]+_0x7b9f('0x1c'));_0x28e591=_0x3164cb;}_0x26a90b['html']=_0x28e591;}_0x5e8ecc[_0x7b9f('0x1d')]=_0x26a90b[_0x7b9f('0x13')];}else{_0x5e8ecc[_0x7b9f('0x1d')]=_0x26a90b[_0x7b9f('0x1e')];}if(_0x5e8ecc[_0x7b9f('0x1d')]){_0x5e8ecc[_0x7b9f('0x1d')]=_0x5e8ecc[_0x7b9f('0x1d')][_0x7b9f('0x19')](/0x0){var _0x427635=[_0x7b9f('0x31'),_0x7b9f('0x32'),_0x7b9f('0x33')];for(var _0x29852b=0x0;_0x29852b<_0x26a90b[_0x7b9f('0x30')]['length'];_0x29852b++){var _0x4a6339=_[_0x7b9f('0x10')](_0x427635,_0x26a90b[_0x7b9f('0x30')][_0x29852b][_0x7b9f('0x34')]);if(_0x4a6339>=0x0){_0x5e8ecc['isAutoreply']=!![];}}}return _0x5e8ecc;}exports[_0x7b9f('0x35')]=function(_0x18c2ac,_0x1bb606,_0x30e7f8){var _0x5cad02={'from':getAddress(_0x1bb606[_0x7b9f('0x36')]),'firstName':getFirstName(_0x1bb606['from']),'lastName':getLastName(_0x1bb606[_0x7b9f('0x36')]),'mapKey':_0x7b9f('0x7'),'message':{'from':getMails(_0x18c2ac[_0x7b9f('0x7')],_0x1bb606[_0x7b9f('0x36')]),'to':_0x18c2ac[_0x7b9f('0x7')],'cc':'','subject':_0x1bb606[_0x7b9f('0x37')]||'','messageId':_0x1bb606[_0x7b9f('0x38')],'inReplyTo':_0x1bb606[_0x7b9f('0x39')],'sentAt':moment(_0x1bb606[_0x7b9f('0x3a')])['format'](_0x7b9f('0x3b')),'attach':![],'attachments':[]}};if(!_0x1bb606[_0x7b9f('0x13')]&&!_0x1bb606[_0x7b9f('0x1e')]){var _0x324335=_[_0x7b9f('0x3c')](_0x1bb606[_0x7b9f('0x16')],{'contentType':_0x7b9f('0x3d')});if(_0x324335['length']){logger[_0x7b9f('0x3e')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1bb606[_0x7b9f('0x38')]));tnef[_0x7b9f('0x3f')](_[_0x7b9f('0x40')](_0x324335)[_0x7b9f('0x2d')],function(_0xc9d3c,_0x170bb6){if(_0x170bb6){_0x1bb606[_0x7b9f('0x13')]=_0x170bb6['BodyHTML']||_0x7b9f('0x41');if(_0x170bb6[_0x7b9f('0x42')]){for(var _0x17bdf0=0x0;_0x17bdf0<_0x170bb6[_0x7b9f('0x42')][_0x7b9f('0x12')];_0x17bdf0++){var _0x41c095=_0x170bb6['Attachments'][_0x17bdf0];_0x5cad02[_0x7b9f('0x20')][_0x7b9f('0x16')]['push']({'filename':_0x41c095['Title'],'content':Buffer[_0x7b9f('0x36')](_0x41c095['Data'])});}}}_0x30e7f8(parseEmail(_0x18c2ac,_0x1bb606,_0x5cad02));});}else{_0x1bb606[_0x7b9f('0x13')]=_0x7b9f('0x41');_0x30e7f8(parseEmail(_0x18c2ac,_0x1bb606,_0x5cad02));}}else{_0x30e7f8(parseEmail(_0x18c2ac,_0x1bb606,_0x5cad02));}};exports[_0x7b9f('0x43')]=function(_0x26c826,_0x5f4c2c){var _0x52f662=[_0x7b9f('0x44')+(_0x5f4c2c||''),'auth=Bearer\x20'+_0x26c826,'',''];return Buffer[_0x7b9f('0x36')](_0x52f662[_0x7b9f('0x2a')](''),_0x7b9f('0x45'))['toString'](_0x7b9f('0x46'));}; \ No newline at end of file +var _0x641b=['pop','isEmpty','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc','attachments','attach','type','attachment','filename','attachment-','format','%s-%s','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','messageId','inReplyTo','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous'];(function(_0x13c4d5,_0x2be948){var _0x4dfc72=function(_0x51445c){while(--_0x51445c){_0x13c4d5['push'](_0x13c4d5['shift']());}};_0x4dfc72(++_0x2be948);}(_0x641b,0x1ab));var _0xb641=function(_0x599b15,_0x2bd1fd){_0x599b15=_0x599b15-0x0;var _0x19e2a4=_0x641b[_0x599b15];return _0x19e2a4;};'use strict';var _=require(_0xb641('0x0'));var moment=require(_0xb641('0x1'));var random=require(_0xb641('0x2'));var fs=require('fs');var path=require(_0xb641('0x3'));var util=require(_0xb641('0x4'));var tnef=require(_0xb641('0x5'));var logger=require(_0xb641('0x6'))(_0xb641('0x7'));var config=require(_0xb641('0x8'));function getAddress(_0x426931){var _0x57f160=_[_0xb641('0x9')](_0x426931[_0xb641('0xa')]);return _0x57f160&&_0x57f160[_0xb641('0xb')]?_0x57f160['address']:_0xb641('0xc')+random[_0xb641('0xd')](0x6)+_0xb641('0xe');}function getFirstName(_0x1c647b){var _0x3e565e=_[_0xb641('0x9')](_0x1c647b['value']);if(_0x3e565e&&_0x3e565e[_0xb641('0xf')]){if(_0x3e565e[_0xb641('0xf')]==_0x3e565e['address']){return _0x3e565e['name'][_0xb641('0x10')](0x0,_0x3e565e[_0xb641('0xf')][_0xb641('0x11')]('@'));}var _0x2c7c47=_0x3e565e[_0xb641('0xf')][_0xb641('0x12')](/\s+/);return _0x2c7c47[_0xb641('0x13')]>0x1?_0x2c7c47[_0xb641('0x14')](0x0,-0x1)[_0xb641('0x15')]('\x20'):_0x3e565e[_0xb641('0xf')];}return _0xb641('0x16');}function getLastName(_0x136471){var _0x5c7440=_[_0xb641('0x9')](_0x136471[_0xb641('0xa')]);if(_0x5c7440&&_0x5c7440[_0xb641('0xf')]){var _0x36de02=_0x5c7440[_0xb641('0xf')][_0xb641('0x12')](/\s+/);return _0x36de02[_0xb641('0x13')]>0x1?_0x36de02[_0xb641('0x17')]():'';}return'';}function getMails(_0x46e697,_0x3524af){var _0x4d242d='';for(var _0x3101e4=0x0;_0x3101e4<_0x3524af['value']['length'];_0x3101e4+=0x1){if(_0x3524af[_0xb641('0xa')][_0x3101e4]['address']!==_0x46e697){if(!_[_0xb641('0x18')](_0x4d242d)){_0x4d242d+=',';}_0x4d242d+=_0x3524af['value'][_0x3101e4][_0xb641('0xf')]||_0x3524af[_0xb641('0xa')][_0x3101e4]['address']||'';_0x4d242d+='\x20<';_0x4d242d+=_0x3524af[_0xb641('0xa')][_0x3101e4]['address']?_0x3524af[_0xb641('0xa')][_0x3101e4]['address']:_0xb641('0xc')+random[_0xb641('0xd')](0x6)+_0xb641('0xe');_0x4d242d+='>';}}return _0x4d242d;}function parseEmail(_0x4c9ada,_0x5b72d5,_0x582372){if(_0x5b72d5['html']){var _0x2d3157=/)<[^<]*)*<\/script>/gi;while(_0x2d3157['test'](_0x5b72d5[_0xb641('0x19')])){_0x5b72d5[_0xb641('0x19')]=_0x5b72d5[_0xb641('0x19')][_0xb641('0x1a')](_0x2d3157,'');}if(_0x5b72d5[_0xb641('0x19')][_0xb641('0x1b')](_0xb641('0x1c'))){var _0x30d781=[];_0x5b72d5['attachments'][_0xb641('0x1d')](_0x4db382=>{_0x30d781[_0xb641('0x1e')](_0x4db382['filename']);});var _0x35274c=/]+>/g;var _0x518784=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2ea805=_0x5b72d5['html'][_0xb641('0x1a')](_0x518784,_0xb641('0x1f'));var _0x9f417b=_0x2ea805['replace'](_0x35274c,_0xb641('0x20'));for(let _0x539c37=0x0;_0x539c37<_0x30d781['length'];_0x539c37++){var _0x35862b=_0x9f417b[_0xb641('0x1a')](_0xb641('0x20'),_0xb641('0x21')+_0x30d781[_0x539c37]+_0xb641('0x22'));_0x9f417b=_0x35862b;}_0x5b72d5[_0xb641('0x19')]=_0x9f417b;}_0x582372[_0xb641('0x23')]=_0x5b72d5[_0xb641('0x19')];}else{_0x582372[_0xb641('0x23')]=_0x5b72d5[_0xb641('0x24')];}if(_0x582372['body']){_0x582372[_0xb641('0x23')]=_0x582372[_0xb641('0x23')]['replace'](/0x0){var _0x2a8254=[_0xb641('0x35'),_0xb641('0x36'),'Precedence:\x20auto_reply'];for(var _0x4648af=0x0;_0x4648af<_0x5b72d5[_0xb641('0x34')][_0xb641('0x13')];_0x4648af++){var _0x2ba4a3=_[_0xb641('0x11')](_0x2a8254,_0x5b72d5['headerLines'][_0x4648af][_0xb641('0x37')]);if(_0x2ba4a3>=0x0){_0x582372[_0xb641('0x38')]=!![];}}}return _0x582372;}exports[_0xb641('0x39')]=function(_0x3db582,_0xce2e4c,_0x21ffa9){var _0xeb6ad4={'from':getAddress(_0xce2e4c[_0xb641('0x3a')]),'firstName':getFirstName(_0xce2e4c['from']),'lastName':getLastName(_0xce2e4c['from']),'mapKey':_0xb641('0x7'),'message':{'from':getMails(_0x3db582[_0xb641('0x7')],_0xce2e4c[_0xb641('0x3a')]),'to':_0x3db582[_0xb641('0x7')],'cc':'','subject':_0xce2e4c['subject']||'','messageId':_0xce2e4c[_0xb641('0x3b')],'inReplyTo':_0xce2e4c[_0xb641('0x3c')],'sentAt':moment(_0xce2e4c['date'])[_0xb641('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0xce2e4c[_0xb641('0x19')]&&!_0xce2e4c[_0xb641('0x24')]){var _0x340a09=_[_0xb641('0x3d')](_0xce2e4c[_0xb641('0x29')],{'contentType':_0xb641('0x3e')});if(_0x340a09[_0xb641('0x13')]){logger[_0xb641('0x3f')](util[_0xb641('0x2f')](_0xb641('0x40'),_0xce2e4c[_0xb641('0x3b')]));tnef[_0xb641('0x41')](_['first'](_0x340a09)[_0xb641('0x32')],function(_0xe3e1d5,_0x160474){if(_0x160474){_0xce2e4c[_0xb641('0x19')]=_0x160474[_0xb641('0x42')]||_0xb641('0x43');if(_0x160474[_0xb641('0x44')]){for(var _0x24e1f7=0x0;_0x24e1f7<_0x160474[_0xb641('0x44')][_0xb641('0x13')];_0x24e1f7++){var _0x5756b9=_0x160474['Attachments'][_0x24e1f7];_0xeb6ad4[_0xb641('0x25')][_0xb641('0x29')]['push']({'filename':_0x5756b9[_0xb641('0x45')],'content':Buffer[_0xb641('0x3a')](_0x5756b9[_0xb641('0x46')])});}}}_0x21ffa9(parseEmail(_0x3db582,_0xce2e4c,_0xeb6ad4));});}else{_0xce2e4c[_0xb641('0x19')]='

Empty\x20message

';_0x21ffa9(parseEmail(_0x3db582,_0xce2e4c,_0xeb6ad4));}}else{_0x21ffa9(parseEmail(_0x3db582,_0xce2e4c,_0xeb6ad4));}};exports['generateXOAuth2Token']=function(_0x3a8458,_0x13b507){var _0xa1c516=['user='+(_0x13b507||''),_0xb641('0x47')+_0x3a8458,'',''];return Buffer[_0xb641('0x3a')](_0xa1c516['join'](''),_0xb641('0x48'))[_0xb641('0x49')](_0xb641('0x4a'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 6c4e1a7..895d53a 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 _0x82c8=['lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x99b397,_0x3423a0){var _0x2d0623=function(_0x2e174a){while(--_0x2e174a){_0x99b397['push'](_0x99b397['shift']());}};_0x2d0623(++_0x3423a0);}(_0x82c8,0x128));var _0x882c=function(_0x3f6cac,_0x2bec42){_0x3f6cac=_0x3f6cac-0x0;var _0xd01fea=_0x82c8[_0x3f6cac];return _0xd01fea;};'use strict';var _=require(_0x882c('0x0'));function MailAccount(_0x40b354){this['id']=_0x40b354['id']||0x0;this[_0x882c('0x1')]=_0x40b354[_0x882c('0x1')]||_0x882c('0x2');this[_0x882c('0x3')]=_0x40b354['key']||_0x882c('0x4');this['active']=_0x40b354[_0x882c('0x5')]||![];this[_0x882c('0x6')]=_0x40b354[_0x882c('0x6')]||[];this[_0x882c('0x7')]=_0x40b354[_0x882c('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x359f=['lodash','name','key','SERV','active','Imap','Smtp','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x359f,0x190));var _0xf359=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x359f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf359('0x0'));function MailAccount(_0x58785f){this['id']=_0x58785f['id']||0x0;this[_0xf359('0x1')]=_0x58785f[_0xf359('0x1')]||'Service';this['key']=_0x58785f[_0xf359('0x2')]||_0xf359('0x3');this['active']=_0x58785f[_0xf359('0x4')]||![];this[_0xf359('0x5')]=_0x58785f['Imap']||[];this[_0xf359('0x6')]=_0x58785f['Smtp']||[];}module[_0xf359('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 9def7dc..cc1378f 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 _0xcc64=['lodash','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase','initMailAccounts','mailAccounts','merge','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc64,0x87));var _0x4cc6=function(_0x3c93df,_0x3e981e){_0x3c93df=_0x3c93df-0x0;var _0x4dd0c8=_0xcc64[_0x3c93df];return _0x4dd0c8;};'use strict';var _=require(_0x4cc6('0x0'));var MailAccount=require(_0x4cc6('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x24b910,_0x3083d1,_0x394213){var _0x172d8f=_[_0x4cc6('0x2')](_0x24b910,function(_0x480ad1,_0x117c56){return _0x480ad1[_0x394213];});for(var _0x2beda6 in _0x3083d1){if(_0x3083d1[_0x4cc6('0x3')](_0x2beda6)){if(!_0x172d8f[_0x2beda6]){delete _0x3083d1[_0x2beda6];}}}}Realtime['prototype'][_0x4cc6('0x4')]=function(_0x115ac0,_0x562ab7){for(var _0x26b56c in _0x562ab7){if(_0x115ac0[_0x4cc6('0x3')](_0x26b56c)){_0x115ac0[_0x26b56c]=_0x562ab7[_0x26b56c];}}};Realtime['prototype'][_0x4cc6('0x5')]=function(){var _0x7b0748=this;return function(_0x19356b){if(_0x19356b){freeIsNotKey(_0x19356b,_0x7b0748[_0x4cc6('0x6')],'id');for(var _0x63bafb=0x0,_0x5e6921={},_0x5669d3={};_0x63bafb<_0x19356b['length'];_0x63bafb+=0x1){_0x5e6921=_0x19356b[_0x63bafb];if(_['isUndefined'](_0x7b0748[_0x4cc6('0x6')][_0x5e6921['id']])){_0x7b0748['mailAccounts'][_0x5e6921['id']]=new MailAccount(_0x5e6921);}else{_[_0x4cc6('0x7')](_0x7b0748[_0x4cc6('0x6')][_0x5e6921['id']],_0x5e6921);}}}return _0x7b0748[_0x4cc6('0x6')];};};module[_0x4cc6('0x8')]=Realtime; \ No newline at end of file +var _0xfbe1=['exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbe1,0x15f));var _0x1fbe=function(_0x42cc9f,_0x2db012){_0x42cc9f=_0x42cc9f-0x0;var _0x43d56e=_0xfbe1[_0x42cc9f];return _0x43d56e;};'use strict';var _=require(_0x1fbe('0x0'));var MailAccount=require(_0x1fbe('0x1'));var Realtime=function(){this[_0x1fbe('0x2')]={};};function freeIsNotKey(_0x57146b,_0x32fd48,_0x401d59){var _0x359208=_[_0x1fbe('0x3')](_0x57146b,function(_0x271155,_0x24c0f6){return _0x271155[_0x401d59];});for(var _0x519872 in _0x32fd48){if(_0x32fd48[_0x1fbe('0x4')](_0x519872)){if(!_0x359208[_0x519872]){delete _0x32fd48[_0x519872];}}}}Realtime[_0x1fbe('0x5')]['mergeFromDatabase']=function(_0x2a4bab,_0x173de7){for(var _0x3eab5f in _0x173de7){if(_0x2a4bab[_0x1fbe('0x4')](_0x3eab5f)){_0x2a4bab[_0x3eab5f]=_0x173de7[_0x3eab5f];}}};Realtime[_0x1fbe('0x5')][_0x1fbe('0x6')]=function(){var _0xe8a777=this;return function(_0x3385a5){if(_0x3385a5){freeIsNotKey(_0x3385a5,_0xe8a777[_0x1fbe('0x2')],'id');for(var _0x4a8588=0x0,_0x15d732={},_0x128df5={};_0x4a8588<_0x3385a5[_0x1fbe('0x7')];_0x4a8588+=0x1){_0x15d732=_0x3385a5[_0x4a8588];if(_[_0x1fbe('0x8')](_0xe8a777['mailAccounts'][_0x15d732['id']])){_0xe8a777[_0x1fbe('0x2')][_0x15d732['id']]=new MailAccount(_0x15d732);}else{_['merge'](_0xe8a777[_0x1fbe('0x2')][_0x15d732['id']],_0x15d732);}}}return _0xe8a777[_0x1fbe('0x2')];};};module[_0x1fbe('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index cb740ba..b30074f 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 _0x76c1=['getMailAccounts','Request','GetMailAccount','name','provider','service','active','key','ListId','TemplateId','MailServerIn','CloudProvider','type','Smtp','notify','NotifyMailAccount','../client'];(function(_0x471faf,_0x48aef2){var _0x14fb3f=function(_0x5c09f0){while(--_0x5c09f0){_0x471faf['push'](_0x471faf['shift']());}};_0x14fb3f(++_0x48aef2);}(_0x76c1,0x87));var _0x176c=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x76c1[_0x4226d6];return _0x19655b;};'use strict';var client=require(_0x176c('0x0'));exports[_0x176c('0x1')]=function(){return function(){return client[_0x176c('0x2')](_0x176c('0x3'),{'options':{'attributes':['id',_0x176c('0x4'),_0x176c('0x5'),_0x176c('0x6'),'email',_0x176c('0x7'),_0x176c('0x8'),_0x176c('0x9'),_0x176c('0xa')],'raw':![],'include':[{'model':_0x176c('0xb'),'as':'Imap','include':[{'model':_0x176c('0xc'),'attributes':['id',_0x176c('0x4'),'service',_0x176c('0xd'),'data5'],'as':_0x176c('0xc')}]},{'model':'MailServerOut','as':_0x176c('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x176c('0x4'),_0x176c('0x6'),_0x176c('0xd'),'data5'],'as':_0x176c('0xc')}]}]},'log':'getMailAccount'});};};exports[_0x176c('0xf')]=function(_0x49e0f4,_0x53f496){return client[_0x176c('0x2')](_0x176c('0x10'),{'account':{'id':_0x49e0f4},'body':_0x53f496,'log':_0x176c('0x10')});}; \ No newline at end of file +var _0xae35=['key','TemplateId','MailServerIn','CloudProvider','type','data5','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email'];(function(_0x3cb300,_0x4d7a99){var _0x3e0cd9=function(_0x21d5b7){while(--_0x21d5b7){_0x3cb300['push'](_0x3cb300['shift']());}};_0x3e0cd9(++_0x4d7a99);}(_0xae35,0x172));var _0x5ae3=function(_0x4eac49,_0x2f4be0){_0x4eac49=_0x4eac49-0x0;var _0x9bdd1a=_0xae35[_0x4eac49];return _0x9bdd1a;};'use strict';var client=require(_0x5ae3('0x0'));exports[_0x5ae3('0x1')]=function(){return function(){return client[_0x5ae3('0x2')](_0x5ae3('0x3'),{'options':{'attributes':['id',_0x5ae3('0x4'),_0x5ae3('0x5'),_0x5ae3('0x6'),_0x5ae3('0x7'),'active',_0x5ae3('0x8'),'ListId',_0x5ae3('0x9')],'raw':![],'include':[{'model':_0x5ae3('0xa'),'as':'Imap','include':[{'model':_0x5ae3('0xb'),'attributes':['id',_0x5ae3('0x4'),'service',_0x5ae3('0xc'),_0x5ae3('0xd')],'as':_0x5ae3('0xb')}]},{'model':'MailServerOut','as':_0x5ae3('0xe'),'include':[{'model':_0x5ae3('0xb'),'attributes':['id','name',_0x5ae3('0x6'),'type',_0x5ae3('0xd')],'as':_0x5ae3('0xb')}]}]},'log':_0x5ae3('0xf')});};};exports[_0x5ae3('0x10')]=function(_0x2d0ab3,_0x9da71d){return client['Request'](_0x5ae3('0x11'),{'account':{'id':_0x2d0ab3},'body':_0x9da71d,'log':_0x5ae3('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6288705..f3b4f25 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 _0x0e48=['loginMailFrequency','GetSettings','../client','ShowSetting'];(function(_0x4382bc,_0x231a2d){var _0x13c82a=function(_0x3723b0){while(--_0x3723b0){_0x4382bc['push'](_0x4382bc['shift']());}};_0x13c82a(++_0x231a2d);}(_0x0e48,0x1d6));var _0x80e4=function(_0x37be46,_0x2c2fee){_0x37be46=_0x37be46-0x0;var _0x36e16e=_0x0e48[_0x37be46];return _0x36e16e;};'use strict';var client=require(_0x80e4('0x0'));exports['getSettings']=function(){return client['Request'](_0x80e4('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x80e4('0x2')]},'log':_0x80e4('0x3')});}; \ No newline at end of file +var _0xc648=['ShowSetting','GetSettings','../client','getSettings','Request'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xc648,0xfc));var _0x8c64=function(_0x3ea6df,_0x3833fd){_0x3ea6df=_0x3ea6df-0x0;var _0x2342a7=_0xc648[_0x3ea6df];return _0x2342a7;};'use strict';var client=require(_0x8c64('0x0'));exports[_0x8c64('0x1')]=function(){return client[_0x8c64('0x2')](_0x8c64('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x8c64('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 29d5b40..7bb7c75 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(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 97b7216..8500c29 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 _0xe2d7=['createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','../../config/triggers','default','../../config/socketio','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','ioredis','../../config/environment'];(function(_0x17b9e2,_0x3921fa){var _0x4335d2=function(_0x42b90b){while(--_0x42b90b){_0x17b9e2['push'](_0x17b9e2['shift']());}};_0x4335d2(++_0x3921fa);}(_0xe2d7,0xd8));var _0x7e2d=function(_0x2a564e,_0xcb1f8a){_0x2a564e=_0x2a564e-0x0;var _0x593482=_0xe2d7[_0x2a564e];return _0x593482;};'use strict';var _=require('lodash');var http=require(_0x7e2d('0x0'));var express=require('express');var sticky=require(_0x7e2d('0x1'));var Redis=require(_0x7e2d('0x2'));var config=require(_0x7e2d('0x3'));var app=express();var server=http[_0x7e2d('0x4')](app);server[_0x7e2d('0x5')]=0xdbba0;if(sticky[_0x7e2d('0x6')](server,config[_0x7e2d('0x7')])){var socketio=require(_0x7e2d('0x8'))(server,{'transports':[_0x7e2d('0x9'),_0x7e2d('0xa')]});config[_0x7e2d('0xb')]=_[_0x7e2d('0xc')](config[_0x7e2d('0xb')],{'host':_0x7e2d('0xd'),'port':0x18eb});socketio[_0x7e2d('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0x7e2d('0xb')]),'subClient':new Redis(config[_0x7e2d('0xb')])}));require(_0x7e2d('0xf'))[_0x7e2d('0x10')]();require(_0x7e2d('0x11'))[_0x7e2d('0x10')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x7e2d('0x10')](app);}else{server['once'](_0x7e2d('0x12'),function(){console[_0x7e2d('0x13')](_0x7e2d('0x14'),config[_0x7e2d('0x7')]);});}exports=module[_0x7e2d('0x15')]=app; \ No newline at end of file +var _0x322f=['http','express','sticky-session','createServer','timeout','port','websocket','polling','defaults','redis','adapter','default','../../config/socketio','../../config/express','../../routes','once','listening','log'];(function(_0x5d1ae8,_0x1cfb7b){var _0x2e3995=function(_0x4e91d5){while(--_0x4e91d5){_0x5d1ae8['push'](_0x5d1ae8['shift']());}};_0x2e3995(++_0x1cfb7b);}(_0x322f,0x10e));var _0xf322=function(_0x12d62b,_0x549583){_0x12d62b=_0x12d62b-0x0;var _0x346f8d=_0x322f[_0x12d62b];return _0x346f8d;};'use strict';var _=require('lodash');var http=require(_0xf322('0x0'));var express=require(_0xf322('0x1'));var sticky=require(_0xf322('0x2'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0xf322('0x3')](app);server[_0xf322('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0xf322('0x5')])){var socketio=require('socket.io')(server,{'transports':[_0xf322('0x6'),_0xf322('0x7')]});config['redis']=_[_0xf322('0x8')](config[_0xf322('0x9')],{'host':'localhost','port':0x18eb});socketio[_0xf322('0xa')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0xf322('0xb')]();require(_0xf322('0xc'))[_0xf322('0xb')](socketio);require(_0xf322('0xd'))[_0xf322('0xb')](app);require(_0xf322('0xe'))[_0xf322('0xb')](app);}else{server[_0xf322('0xf')](_0xf322('0x10'),function(){console[_0xf322('0x11')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xf322('0x5')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index ea85037..602894a 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 _0x1ed2=['catch','exports','../../config/logger','client','http','Request','request','debug','error','rpc','routing','message','result'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0x1ed2,0x1bc));var _0x21ed=function(_0x8fd7be,_0xcd1d8d){_0x8fd7be=_0x8fd7be-0x0;var _0xd527d7=_0x1ed2[_0x8fd7be];return _0xd527d7;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x21ed('0x0'))('routing');var client=jayson[_0x21ed('0x1')][_0x21ed('0x2')]({'port':0x2329});client[_0x21ed('0x3')]=function(_0x4c34a9,_0x13797c){return new BPromise(function(_0x3a2908,_0x1aca5f){return client[_0x21ed('0x4')](_0x4c34a9,_0x13797c)['then'](function(_0x1c6d19){logger[_0x21ed('0x5')]('rpc','routing',_0x4c34a9,_0x13797c,_0x1c6d19);if(_0x1c6d19[_0x21ed('0x6')]){logger[_0x21ed('0x6')](_0x21ed('0x7'),_0x21ed('0x8'),_0x4c34a9,_0x1c6d19[_0x21ed('0x6')]['message'],_0x13797c);return _0x1aca5f(_0x1c6d19[_0x21ed('0x6')][_0x21ed('0x9')]);}else{return _0x3a2908(_0x1c6d19[_0x21ed('0xa')]);}})[_0x21ed('0xb')](function(_0x140458){logger[_0x21ed('0x6')](_0x21ed('0x7'),_0x21ed('0x8'),_0x4c34a9,_0x140458,_0x13797c);return _0x1aca5f(_0x140458);});});};module[_0x21ed('0xc')]=client; \ No newline at end of file +var _0x7a55=['client','http','Request','request','rpc','error','message','result','exports','bluebird','../../config/logger','routing'];(function(_0x12b0fd,_0xd8e170){var _0x5b2326=function(_0x1917c4){while(--_0x1917c4){_0x12b0fd['push'](_0x12b0fd['shift']());}};_0x5b2326(++_0xd8e170);}(_0x7a55,0x1ad));var _0x57a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7a55[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x57a5('0x0'));var logger=require(_0x57a5('0x1'))(_0x57a5('0x2'));var client=jayson[_0x57a5('0x3')][_0x57a5('0x4')]({'port':0x2329});client[_0x57a5('0x5')]=function(_0x425b8d,_0x4492ae){return new BPromise(function(_0x25f882,_0x4836ff){return client[_0x57a5('0x6')](_0x425b8d,_0x4492ae)['then'](function(_0x2c41b5){logger['debug'](_0x57a5('0x7'),'routing',_0x425b8d,_0x4492ae,_0x2c41b5);if(_0x2c41b5[_0x57a5('0x8')]){logger['error'](_0x57a5('0x7'),_0x57a5('0x2'),_0x425b8d,_0x2c41b5[_0x57a5('0x8')][_0x57a5('0x9')],_0x4492ae);return _0x4836ff(_0x2c41b5[_0x57a5('0x8')][_0x57a5('0x9')]);}else{return _0x25f882(_0x2c41b5[_0x57a5('0xa')]);}})['catch'](function(_0x884020){logger['error'](_0x57a5('0x7'),_0x57a5('0x2'),_0x425b8d,_0x884020,_0x4492ae);return _0x4836ff(_0x884020);});});};module[_0x57a5('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9883647..9805e6c 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 _0x1958=['getIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x1958,0x153));var _0x8195=function(_0x1c9f90,_0x538898){_0x1c9f90=_0x1c9f90-0x0;var _0x2e0c4c=_0x1958[_0x1c9f90];return _0x2e0c4c;};'use strict';var BPromise=require(_0x8195('0x0'));var server=require(_0x8195('0x1'));var Realtime=require(_0x8195('0x2'));var user=require(_0x8195('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x8195('0x4'));var chatQueue=require(_0x8195('0x5'));var smsQueue=require(_0x8195('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x8195('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x8195('0x8')]()[_0x8195('0x9')](user[_0x8195('0xa')]())[_0x8195('0x9')](realtime['initAgents']())[_0x8195('0x9')](interval[_0x8195('0xb')]())[_0x8195('0x9')](realtime['initIntervals']())[_0x8195('0x9')](openchannelQueue[_0x8195('0xc')]())[_0x8195('0x9')](realtime[_0x8195('0xd')]())['then'](chatQueue['getChatQueues']())['then'](realtime[_0x8195('0xe')]())[_0x8195('0x9')](smsQueue['getSmsQueues']())['then'](realtime[_0x8195('0xf')]())['then'](mailQueue[_0x8195('0x10')]())[_0x8195('0x9')](realtime[_0x8195('0x11')]())[_0x8195('0x9')](faxQueue[_0x8195('0x12')]())[_0x8195('0x9')](realtime[_0x8195('0x13')]())[_0x8195('0x9')](whatsappQueue[_0x8195('0x14')]())['then'](realtime[_0x8195('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0x8195('0x16')](realtime)[_0x8195('0x9')](function(_0x353b5f){return initRealtime();})[_0x8195('0x9')](function(_0x3c6430){return setInterval(initRealtime,0x1388);})[_0x8195('0x17')](function(_0x415b47){console[_0x8195('0x18')](_0x415b47);});}main(); \ No newline at end of file +var _0x2834=['initWhatsappQueues','bluebird','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x2dba75,_0x3d92ee){var _0x28e03d=function(_0x5dac0e){while(--_0x5dac0e){_0x2dba75['push'](_0x2dba75['shift']());}};_0x28e03d(++_0x3d92ee);}(_0x2834,0x9b));var _0x4283=function(_0x1bd4c4,_0x1188d4){_0x1bd4c4=_0x1bd4c4-0x0;var _0x192b69=_0x2834[_0x1bd4c4];return _0x192b69;};'use strict';var BPromise=require(_0x4283('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x4283('0x1'));var openchannelQueue=require(_0x4283('0x2'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x4283('0x3'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x4283('0x4'));var whatsappQueue=require(_0x4283('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4283('0x6')]()[_0x4283('0x7')](user[_0x4283('0x8')]())[_0x4283('0x7')](realtime[_0x4283('0x9')]())[_0x4283('0x7')](interval[_0x4283('0xa')]())['then'](realtime['initIntervals']())['then'](openchannelQueue[_0x4283('0xb')]())[_0x4283('0x7')](realtime[_0x4283('0xc')]())['then'](chatQueue[_0x4283('0xd')]())[_0x4283('0x7')](realtime[_0x4283('0xe')]())['then'](smsQueue[_0x4283('0xf')]())[_0x4283('0x7')](realtime['initSmsQueues']())[_0x4283('0x7')](mailQueue[_0x4283('0x10')]())[_0x4283('0x7')](realtime[_0x4283('0x11')]())[_0x4283('0x7')](faxQueue[_0x4283('0x12')]())[_0x4283('0x7')](realtime[_0x4283('0x13')]())[_0x4283('0x7')](whatsappQueue[_0x4283('0x14')]())[_0x4283('0x7')](realtime[_0x4283('0x15')]())[_0x4283('0x7')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x4283('0x7')](function(_0x475a7a){return initRealtime();})[_0x4283('0x7')](function(_0x215c79){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4b1755){console['log'](_0x4b1755);});}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 93e8531..c0ca40b 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(_0x5a0e32,_0x347ae2){var _0xea8f24=function(_0x47f773){while(--_0x47f773){_0x5a0e32['push'](_0x5a0e32['shift']());}};_0xea8f24(++_0x347ae2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5fc3[_0x618414];return _0x21c19a;};'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(_0x37db03,_0x5bbea5){var _0x5f302a=function(_0x3b0c81){while(--_0x3b0c81){_0x37db03['push'](_0x37db03['shift']());}};_0x5f302a(++_0x5bbea5);}(_0xe14b,0x93));var _0xbe14=function(_0x132b2e,_0x2d4c53){_0x132b2e=_0x132b2e-0x0;var _0x1f5ba3=_0xe14b[_0x132b2e];return _0x1f5ba3;};'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 34b4062..9488ee2 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 _0x0198=['SendMail','bluebird','jayson/promise','client','request','error','message','result','catch','sendMailMessage'];(function(_0x522ebe,_0x569b6b){var _0x1135b2=function(_0x5c4a3e){while(--_0x5c4a3e){_0x522ebe['push'](_0x522ebe['shift']());}};_0x1135b2(++_0x569b6b);}(_0x0198,0xab));var _0x8019=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x0198[_0x356e8d];return _0x39e65a;};'use strict';var BPromise=require(_0x8019('0x0'));var jayson=require(_0x8019('0x1'));var client=jayson[_0x8019('0x2')]['http']({'port':0x232b});function request(_0x3e46b4,_0x438859){return new BPromise(function(_0x86ae2e,_0x205555){return client[_0x8019('0x3')](_0x3e46b4,_0x438859)['then'](function(_0x56e50a){if(_0x56e50a[_0x8019('0x4')]){return _0x205555(_0x56e50a['error'][_0x8019('0x5')]);}else{return _0x86ae2e(_0x56e50a[_0x8019('0x6')]);}})[_0x8019('0x7')](function(_0x474cd3){return _0x205555(_0x474cd3);});});}exports[_0x8019('0x8')]=function(_0x51ebc5,_0x4bc357){return request(_0x8019('0x9'),{'account':_0x51ebc5,'message':_0x4bc357});}; \ No newline at end of file +var _0x3281=['then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x3720d1,_0x968d8b){var _0x14a1e8=function(_0x454184){while(--_0x454184){_0x3720d1['push'](_0x3720d1['shift']());}};_0x14a1e8(++_0x968d8b);}(_0x3281,0x1f1));var _0x1328=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x3281[_0x2d8fc2];return _0x3a9e53;};'use strict';var BPromise=require(_0x1328('0x0'));var jayson=require(_0x1328('0x1'));var client=jayson[_0x1328('0x2')]['http']({'port':0x232b});function request(_0x35f4d4,_0x1494bb){return new BPromise(function(_0x51a7c2,_0x1afdc1){return client['request'](_0x35f4d4,_0x1494bb)[_0x1328('0x3')](function(_0x194fee){if(_0x194fee[_0x1328('0x4')]){return _0x1afdc1(_0x194fee['error'][_0x1328('0x5')]);}else{return _0x51a7c2(_0x194fee[_0x1328('0x6')]);}})[_0x1328('0x7')](function(_0x20c521){return _0x1afdc1(_0x20c521);});});}exports[_0x1328('0x8')]=function(_0x16ddb3,_0x2c5921){return request(_0x1328('0x9'),{'account':_0x16ddb3,'message':_0x2c5921});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 83f4c36..a458019 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 _0x2542=['openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','maxcapacity','working','idle','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','faxStatus','whatsappCurrentCapacity','openchannelStatus','busyQueue','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity'];(function(_0x3d7293,_0x5182fd){var _0x559e78=function(_0x8338f8){while(--_0x8338f8){_0x3d7293['push'](_0x3d7293['shift']());}};_0x559e78(++_0x5182fd);}(_0x2542,0x169));var _0x2254=function(_0xc705b1,_0x22ccad){_0xc705b1=_0xc705b1-0x0;var _0x384056=_0x2542[_0xc705b1];return _0x384056;};'use strict';var _=require(_0x2254('0x0'));var md5=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var Redis=require(_0x2254('0x3'));var config=require('../../../config/environment');config[_0x2254('0x4')]=_['defaults'](config[_0x2254('0x4')],{'host':_0x2254('0x5'),'port':0x18eb});var io=require(_0x2254('0x6'))(new Redis(config[_0x2254('0x4')]));function Agent(_0x76c902){this['id']=_0x76c902['id']||0x0;this['name']=_0x76c902[_0x2254('0x7')]||'';this[_0x2254('0x8')]=_0x76c902[_0x2254('0x8')]||!![];this[_0x2254('0x9')]=_0x76c902[_0x2254('0x9')]||![];this[_0x2254('0xa')]=_0x76c902[_0x2254('0xa')]||![];this[_0x2254('0xb')]=_0x76c902[_0x2254('0xb')]||![];this[_0x2254('0xc')]=_0x76c902[_0x2254('0xc')]||![];this['smsPause']=_0x76c902[_0x2254('0xd')]||![];this[_0x2254('0xe')]=_0x76c902[_0x2254('0xe')]||![];this[_0x2254('0xf')]='unknown';this['chatStatusTime']=0x0;this[_0x2254('0x10')]=_0x76c902[_0x2254('0x10')]||0x0;this[_0x2254('0x11')]=0x0;this[_0x2254('0x12')]=_0x2254('0x13');this[_0x2254('0x14')]=0x0;this['mailCapacity']=_0x76c902[_0x2254('0x15')]||0x0;this[_0x2254('0x16')]=0x0;this['faxStatus']=_0x2254('0x13');this[_0x2254('0x17')]=0x0;this[_0x2254('0x18')]=_0x76c902[_0x2254('0x18')]||0x0;this[_0x2254('0x19')]=0x0;this[_0x2254('0x1a')]='unknown';this[_0x2254('0x1b')]=0x0;this['smsCapacity']=_0x76c902[_0x2254('0x1c')]||0x0;this[_0x2254('0x1d')]=0x0;this[_0x2254('0x1e')]=_0x2254('0x13');this[_0x2254('0x1f')]=0x0;this[_0x2254('0x20')]=_0x76c902['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x2254('0x13');this[_0x2254('0x21')]=0x0;this[_0x2254('0x22')]=_0x76c902[_0x2254('0x22')]||0x0;this[_0x2254('0x23')]=0x0;this[_0x2254('0x24')]=![];this['busyQueue']=undefined;this[_0x2254('0x1')]='';this[_0x2254('0x25')]={};this[_0x2254('0x26')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this[_0x2254('0x27')]={};this[_0x2254('0x28')]();}Agent[_0x2254('0x29')]['getChannelStatus']=function(_0x5713e4){if(this[_0x5713e4+'CurrentCapacity']>0x0){if(this[_0x5713e4+'Capacity']>0x0&&this[_0x5713e4+'CurrentCapacity']>=this[_0x5713e4+'Capacity']){return _0x2254('0x2a');}else{return _0x2254('0x2b');}}else{return _0x2254('0x2c');}};Agent[_0x2254('0x29')][_0x2254('0x28')]=function(){var _0x1349c9=['mail','chat',_0x2254('0x2d'),'fax',_0x2254('0x2e'),_0x2254('0x2f')];for(var _0x31a543=0x0;_0x31a543<_0x1349c9[_0x2254('0x30')];_0x31a543+=0x1){var _0x19043b=this['getChannelStatus'](_0x1349c9[_0x31a543]);if(this[_0x1349c9[_0x31a543]+_0x2254('0x31')]!==_0x19043b){this[_0x1349c9[_0x31a543]+_0x2254('0x32')]=_[_0x2254('0x33')](moment()[_0x2254('0x34')]('x'));}this[_0x1349c9[_0x31a543]+_0x2254('0x31')]=_0x19043b;}var _0x377c41={'id':this['id'],'name':this[_0x2254('0x7')],'online':this[_0x2254('0x8')],'voicePause':this[_0x2254('0x9')],'chatPause':this[_0x2254('0xa')],'mailPause':this[_0x2254('0xb')],'smsPause':this[_0x2254('0xd')],'faxPause':this[_0x2254('0xc')],'openchannelPause':this[_0x2254('0xe')],'chatStatus':this[_0x2254('0xf')],'chatStatusTime':this[_0x2254('0x35')],'chatCapacity':this[_0x2254('0x10')],'chatCurrentCapacity':this[_0x2254('0x11')],'mailStatus':this[_0x2254('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x2254('0x15')],'mailCurrentCapacity':this[_0x2254('0x16')],'faxStatus':this[_0x2254('0x36')],'faxStatusTime':this[_0x2254('0x17')],'faxCapacity':this[_0x2254('0x18')],'faxCurrentCapacity':this[_0x2254('0x19')],'smsStatus':this[_0x2254('0x1a')],'smsStatusTime':this[_0x2254('0x1b')],'smsCapacity':this[_0x2254('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x2254('0x1e')],'whatsappStatusTime':this[_0x2254('0x1f')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x2254('0x37')],'openchannelStatus':this[_0x2254('0x38')],'openchannelStatusTime':this[_0x2254('0x21')],'openchannelCapacity':this[_0x2254('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x2254('0x39')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x2254('0x26')],'mailWaitingInteractions':this[_0x2254('0x3a')],'openchannelWaitingInteractions':this[_0x2254('0x3b')],'smsWaitingInteractions':this[_0x2254('0x3c')],'whatsappWaitingInteractions':this[_0x2254('0x27')]};var _0x2707f4=md5(JSON[_0x2254('0x3d')](_0x377c41));if(this['md5']!==_0x2707f4){this[_0x2254('0x1')]=_0x2707f4;io[_0x2254('0x3e')](_0x2254('0x3f'),_[_0x2254('0x40')](_0x377c41,[_0x2254('0x8')]));}};module[_0x2254('0x41')]=Agent; \ No newline at end of file +var _0x7b84=['openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','prototype','mail','chat','openchannel','sms','whatsapp','length','Status','toNumber','whatsappStatus','whatsappStatusTime','chatWaitingInteractions','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause'];(function(_0x883da9,_0x4a5184){var _0x17dbc4=function(_0x17638d){while(--_0x17638d){_0x883da9['push'](_0x883da9['shift']());}};_0x17dbc4(++_0x4a5184);}(_0x7b84,0x17c));var _0x47b8=function(_0x37c28b,_0x1cf812){_0x37c28b=_0x37c28b-0x0;var _0x12a432=_0x7b84[_0x37c28b];return _0x12a432;};'use strict';var _=require(_0x47b8('0x0'));var md5=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var Redis=require(_0x47b8('0x3'));var config=require(_0x47b8('0x4'));config[_0x47b8('0x5')]=_[_0x47b8('0x6')](config['redis'],{'host':_0x47b8('0x7'),'port':0x18eb});var io=require(_0x47b8('0x8'))(new Redis(config[_0x47b8('0x5')]));function Agent(_0x7013d7){this['id']=_0x7013d7['id']||0x0;this[_0x47b8('0x9')]=_0x7013d7[_0x47b8('0x9')]||'';this['online']=_0x7013d7[_0x47b8('0xa')]||!![];this[_0x47b8('0xb')]=_0x7013d7[_0x47b8('0xb')]||![];this[_0x47b8('0xc')]=_0x7013d7[_0x47b8('0xc')]||![];this[_0x47b8('0xd')]=_0x7013d7[_0x47b8('0xd')]||![];this[_0x47b8('0xe')]=_0x7013d7[_0x47b8('0xe')]||![];this[_0x47b8('0xf')]=_0x7013d7[_0x47b8('0xf')]||![];this[_0x47b8('0x10')]=_0x7013d7[_0x47b8('0x10')]||![];this[_0x47b8('0x11')]=_0x47b8('0x12');this[_0x47b8('0x13')]=0x0;this[_0x47b8('0x14')]=_0x7013d7[_0x47b8('0x14')]||0x0;this[_0x47b8('0x15')]=0x0;this[_0x47b8('0x16')]=_0x47b8('0x12');this[_0x47b8('0x17')]=0x0;this[_0x47b8('0x18')]=_0x7013d7[_0x47b8('0x18')]||0x0;this[_0x47b8('0x19')]=0x0;this[_0x47b8('0x1a')]=_0x47b8('0x12');this['faxStatusTime']=0x0;this[_0x47b8('0x1b')]=_0x7013d7[_0x47b8('0x1b')]||0x0;this[_0x47b8('0x1c')]=0x0;this[_0x47b8('0x1d')]=_0x47b8('0x12');this[_0x47b8('0x1e')]=0x0;this[_0x47b8('0x1f')]=_0x7013d7['smsCapacity']||0x0;this[_0x47b8('0x20')]=0x0;this['whatsappStatus']='unknown';this['whatsappStatusTime']=0x0;this[_0x47b8('0x21')]=_0x7013d7[_0x47b8('0x21')]||0x0;this[_0x47b8('0x22')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x47b8('0x23')]=_0x7013d7['openchannelCapacity']||0x0;this[_0x47b8('0x24')]=0x0;this[_0x47b8('0x25')]=![];this[_0x47b8('0x26')]=undefined;this[_0x47b8('0x1')]='';this['chatWaitingInteractions']={};this[_0x47b8('0x27')]={};this[_0x47b8('0x28')]={};this[_0x47b8('0x29')]={};this[_0x47b8('0x2a')]={};this[_0x47b8('0x2b')]={};this[_0x47b8('0x2c')]();}Agent['prototype'][_0x47b8('0x2d')]=function(_0x2a22e3){if(this[_0x2a22e3+'CurrentCapacity']>0x0){if(this[_0x2a22e3+_0x47b8('0x2e')]>0x0&&this[_0x2a22e3+_0x47b8('0x2f')]>=this[_0x2a22e3+_0x47b8('0x2e')]){return _0x47b8('0x30');}else{return'working';}}else{return _0x47b8('0x31');}};Agent[_0x47b8('0x32')][_0x47b8('0x2c')]=function(){var _0x3e3de0=[_0x47b8('0x33'),_0x47b8('0x34'),_0x47b8('0x35'),'fax',_0x47b8('0x36'),_0x47b8('0x37')];for(var _0x4bcc98=0x0;_0x4bcc98<_0x3e3de0[_0x47b8('0x38')];_0x4bcc98+=0x1){var _0x6d517a=this[_0x47b8('0x2d')](_0x3e3de0[_0x4bcc98]);if(this[_0x3e3de0[_0x4bcc98]+_0x47b8('0x39')]!==_0x6d517a){this[_0x3e3de0[_0x4bcc98]+'StatusTime']=_[_0x47b8('0x3a')](moment()['format']('x'));}this[_0x3e3de0[_0x4bcc98]+_0x47b8('0x39')]=_0x6d517a;}var _0x2255ab={'id':this['id'],'name':this[_0x47b8('0x9')],'online':this[_0x47b8('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0x47b8('0xc')],'mailPause':this[_0x47b8('0xd')],'smsPause':this[_0x47b8('0xf')],'faxPause':this[_0x47b8('0xe')],'openchannelPause':this[_0x47b8('0x10')],'chatStatus':this[_0x47b8('0x11')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x47b8('0x16')],'mailStatusTime':this[_0x47b8('0x17')],'mailCapacity':this[_0x47b8('0x18')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x47b8('0x1c')],'smsStatus':this[_0x47b8('0x1d')],'smsStatusTime':this[_0x47b8('0x1e')],'smsCapacity':this[_0x47b8('0x1f')],'smsCurrentCapacity':this[_0x47b8('0x20')],'whatsappStatus':this[_0x47b8('0x3b')],'whatsappStatusTime':this[_0x47b8('0x3c')],'whatsappCapacity':this[_0x47b8('0x21')],'whatsappCurrentCapacity':this[_0x47b8('0x22')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x47b8('0x23')],'openchannelCurrentCapacity':this[_0x47b8('0x24')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x47b8('0x3d')],'faxWaitingInteractions':this[_0x47b8('0x27')],'mailWaitingInteractions':this[_0x47b8('0x28')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x47b8('0x2a')],'whatsappWaitingInteractions':this[_0x47b8('0x2b')]};var _0x5687c2=md5(JSON['stringify'](_0x2255ab));if(this['md5']!==_0x5687c2){this['md5']=_0x5687c2;io[_0x47b8('0x3e')](_0x47b8('0x3f'),_[_0x47b8('0x40')](_0x2255ab,[_0x47b8('0xa')]));}};module[_0x47b8('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 21e6f68..5275901 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 _0x0d2c=['updateRouting','prototype','_rr','map','updateRealtime','length','online','chatPause','paused','loggedIn','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x0d2c,0xac));var _0xc0d2=function(_0x3846ce,_0x10c80a){_0x3846ce=_0x3846ce-0x0;var _0x117ce8=_0x0d2c[_0x3846ce];return _0x117ce8;};'use strict';var _=require(_0xc0d2('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xc0d2('0x1'));var config=require('../../../config/environment');config[_0xc0d2('0x2')]=_[_0xc0d2('0x3')](config[_0xc0d2('0x2')],{'host':_0xc0d2('0x4'),'port':0x18eb});var io=require(_0xc0d2('0x5'))(new Redis(config[_0xc0d2('0x2')]));function ChatQueue(_0x317b04){this['id']=_0x317b04['id']||0x0;this[_0xc0d2('0x6')]=_0x317b04[_0xc0d2('0x6')]||'';this[_0xc0d2('0x7')]=_0x317b04[_0xc0d2('0x7')]||0xa;this[_0xc0d2('0x8')]=_0x317b04[_0xc0d2('0x8')]||_0xc0d2('0x9');this['Agents']=_0x317b04[_0xc0d2('0xa')];this[_0xc0d2('0xb')]={};this[_0xc0d2('0xc')]=0x0;this[_0xc0d2('0xd')]='';this[_0xc0d2('0xe')]();this['updateRealtime']();}ChatQueue[_0xc0d2('0xf')][_0xc0d2('0xe')]=function(){var _0x2f433f=this[_0xc0d2('0xb')][_0xc0d2('0x10')];this[_0xc0d2('0xb')]=_[_0xc0d2('0x11')](this[_0xc0d2('0xa')],'id');this[_0xc0d2('0xb')]['_rr']=_0x2f433f;};ChatQueue[_0xc0d2('0xf')][_0xc0d2('0x12')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x10d685=0x0;_0x10d685=0x0?this[_0xc0d2('0x18')]:0x0;var _0x5f4ee1={'id':this['id'],'available':this[_0xc0d2('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xc0d2('0x6')],'paused':this[_0xc0d2('0x16')],'waiting':this['waiting']};var _0x4e5cbb=md5(JSON[_0xc0d2('0x19')](_0x5f4ee1));if(this[_0xc0d2('0xd')]!==_0x4e5cbb){this[_0xc0d2('0xd')]=_0x4e5cbb;io['to'](util[_0xc0d2('0x1a')](_0xc0d2('0x1b'),_0x5f4ee1[_0xc0d2('0x6')]))[_0xc0d2('0x1c')](_0xc0d2('0x1d'),_0x5f4ee1);}};module[_0xc0d2('0x1e')]=ChatQueue; \ No newline at end of file +var _0x39da=['available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','mapAgentsId','waiting','md5','updateRouting','_rr','map','prototype','updateRealtime','paused','Agents','length','online','loggedIn','chatPause'];(function(_0x1df876,_0x16315d){var _0x163102=function(_0x5dedd0){while(--_0x5dedd0){_0x1df876['push'](_0x1df876['shift']());}};_0x163102(++_0x16315d);}(_0x39da,0xc1));var _0xa39d=function(_0x5e644b,_0x231ee9){_0x5e644b=_0x5e644b-0x0;var _0x5c9cdc=_0x39da[_0x5e644b];return _0x5c9cdc;};'use strict';var _=require(_0xa39d('0x0'));var md5=require('md5');var util=require(_0xa39d('0x1'));var Redis=require(_0xa39d('0x2'));var config=require(_0xa39d('0x3'));config[_0xa39d('0x4')]=_['defaults'](config[_0xa39d('0x4')],{'host':_0xa39d('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa39d('0x4')]));function ChatQueue(_0x456f17){this['id']=_0x456f17['id']||0x0;this['name']=_0x456f17[_0xa39d('0x6')]||'';this[_0xa39d('0x7')]=_0x456f17[_0xa39d('0x7')]||0xa;this[_0xa39d('0x8')]=_0x456f17[_0xa39d('0x8')]||_0xa39d('0x9');this['Agents']=_0x456f17['Agents'];this[_0xa39d('0xa')]={};this[_0xa39d('0xb')]=0x0;this[_0xa39d('0xc')]='';this[_0xa39d('0xd')]();this['updateRealtime']();}ChatQueue['prototype'][_0xa39d('0xd')]=function(){var _0x4d05d5=this[_0xa39d('0xa')][_0xa39d('0xe')];this['mapAgentsId']=_[_0xa39d('0xf')](this['Agents'],'id');this['mapAgentsId'][_0xa39d('0xe')]=_0x4d05d5;};ChatQueue[_0xa39d('0x10')][_0xa39d('0x11')]=function(){this['loggedIn']=0x0;this[_0xa39d('0x12')]=0x0;for(var _0x1ba49d=0x0;_0x1ba49d=0x0?this[_0xa39d('0x18')]:0x0;var _0xf956cd={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa39d('0x16')],'name':this[_0xa39d('0x6')],'paused':this[_0xa39d('0x12')],'waiting':this[_0xa39d('0xb')]};var _0x5c286b=md5(JSON[_0xa39d('0x19')](_0xf956cd));if(this[_0xa39d('0xc')]!==_0x5c286b){this[_0xa39d('0xc')]=_0x5c286b;io['to'](util[_0xa39d('0x1a')](_0xa39d('0x1b'),_0xf956cd['name']))[_0xa39d('0x1c')](_0xa39d('0x1d'),_0xf956cd);}};module[_0xa39d('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 7a0ecbb..c62be50 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 _0xf263=['waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId'];(function(_0x33539a,_0xab9aa5){var _0x1a99a7=function(_0x3e95db){while(--_0x3e95db){_0x33539a['push'](_0x33539a['shift']());}};_0x1a99a7(++_0xab9aa5);}(_0xf263,0x115));var _0x3f26=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0xf263[_0x1c470d];return _0x12141b;};'use strict';var _=require('lodash');var md5=require(_0x3f26('0x0'));var util=require(_0x3f26('0x1'));var Redis=require(_0x3f26('0x2'));var config=require(_0x3f26('0x3'));config[_0x3f26('0x4')]=_[_0x3f26('0x5')](config[_0x3f26('0x4')],{'host':_0x3f26('0x6'),'port':0x18eb});var io=require(_0x3f26('0x7'))(new Redis(config[_0x3f26('0x4')]));function FaxQueue(_0x31e021){this['id']=_0x31e021['id']||0x0;this[_0x3f26('0x8')]=_0x31e021['name']||'';this['timeout']=_0x31e021['timeout']||0xa;this[_0x3f26('0x9')]=_0x31e021[_0x3f26('0x9')]||_0x3f26('0xa');this[_0x3f26('0xb')]=_0x31e021[_0x3f26('0xb')];this[_0x3f26('0xc')]={};this[_0x3f26('0xd')]=0x0;this[_0x3f26('0x0')]='';this['updateRouting']();this[_0x3f26('0xe')]();}FaxQueue[_0x3f26('0xf')][_0x3f26('0x10')]=function(){var _0x2ae41b=this[_0x3f26('0xc')][_0x3f26('0x11')];this[_0x3f26('0xc')]=_[_0x3f26('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x2ae41b;};FaxQueue[_0x3f26('0xf')]['updateRealtime']=function(){this[_0x3f26('0x13')]=0x0;this[_0x3f26('0x14')]=0x0;for(var _0x1382eb=0x0;_0x1382eb=0x0?this[_0x3f26('0x16')]:0x0;var _0x112a2f={'id':this['id'],'available':this[_0x3f26('0x16')],'loggedIn':this[_0x3f26('0x13')],'name':this[_0x3f26('0x8')],'paused':this['paused'],'waiting':this[_0x3f26('0xd')]};var _0x1f29dd=md5(JSON[_0x3f26('0x17')](_0x112a2f));if(this[_0x3f26('0x0')]!==_0x1f29dd){this[_0x3f26('0x0')]=_0x1f29dd;io['to'](util[_0x3f26('0x18')](_0x3f26('0x19'),_0x112a2f[_0x3f26('0x8')]))[_0x3f26('0x1a')](_0x3f26('0x1b'),_0x112a2f);}};module[_0x3f26('0x1c')]=FaxQueue; \ No newline at end of file +var _0x0855=['_rr','length','online','loggedIn','faxPause','paused','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','map'];(function(_0x4aa50a,_0x3db478){var _0x5ec7e6=function(_0x19c11b){while(--_0x19c11b){_0x4aa50a['push'](_0x4aa50a['shift']());}};_0x5ec7e6(++_0x3db478);}(_0x0855,0x125));var _0x5085=function(_0x2a782e,_0x4d6a78){_0x2a782e=_0x2a782e-0x0;var _0x144b02=_0x0855[_0x2a782e];return _0x144b02;};'use strict';var _=require(_0x5085('0x0'));var md5=require(_0x5085('0x1'));var util=require('util');var Redis=require(_0x5085('0x2'));var config=require(_0x5085('0x3'));config[_0x5085('0x4')]=_[_0x5085('0x5')](config[_0x5085('0x4')],{'host':_0x5085('0x6'),'port':0x18eb});var io=require(_0x5085('0x7'))(new Redis(config['redis']));function FaxQueue(_0x3f88c5){this['id']=_0x3f88c5['id']||0x0;this[_0x5085('0x8')]=_0x3f88c5[_0x5085('0x8')]||'';this[_0x5085('0x9')]=_0x3f88c5[_0x5085('0x9')]||0xa;this['strategy']=_0x3f88c5[_0x5085('0xa')]||_0x5085('0xb');this[_0x5085('0xc')]=_0x3f88c5['Agents'];this[_0x5085('0xd')]={};this['waiting']=0x0;this[_0x5085('0x1')]='';this[_0x5085('0xe')]();this['updateRealtime']();}FaxQueue[_0x5085('0xf')][_0x5085('0xe')]=function(){var _0x5b60d0=this['mapAgentsId']['_rr'];this[_0x5085('0xd')]=_[_0x5085('0x10')](this[_0x5085('0xc')],'id');this[_0x5085('0xd')][_0x5085('0x11')]=_0x5b60d0;};FaxQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x53b4e8=0x0;_0x53b4e8=0x0?this[_0x5085('0x17')]:0x0;var _0x4b4eef={'id':this['id'],'available':this[_0x5085('0x17')],'loggedIn':this[_0x5085('0x14')],'name':this[_0x5085('0x8')],'paused':this[_0x5085('0x16')],'waiting':this[_0x5085('0x18')]};var _0x3ee0cf=md5(JSON[_0x5085('0x19')](_0x4b4eef));if(this[_0x5085('0x1')]!==_0x3ee0cf){this['md5']=_0x3ee0cf;io['to'](util[_0x5085('0x1a')](_0x5085('0x1b'),_0x4b4eef[_0x5085('0x8')]))[_0x5085('0x1c')](_0x5085('0x1d'),_0x4b4eef);}};module[_0x5085('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 96cfd07..52c360a 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 _0x874e=['Intervals','exports','name'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x874e,0xd7));var _0xe874=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x874e[_0x3e6d5d];return _0x238923;};'use strict';function Interval(_0x141411){this['id']=_0x141411['id']||0x0;this[_0xe874('0x0')]=_0x141411[_0xe874('0x0')]||'';this[_0xe874('0x1')]=_0x141411[_0xe874('0x1')]||{};}module[_0xe874('0x2')]=Interval; \ No newline at end of file +var _0x5fda=['Intervals','exports','name'];(function(_0x22f40c,_0x5a259f){var _0x3ef327=function(_0x212bcb){while(--_0x212bcb){_0x22f40c['push'](_0x22f40c['shift']());}};_0x3ef327(++_0x5a259f);}(_0x5fda,0x1c1));var _0xa5fd=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x5fda[_0x2b152a];return _0x2ad4c7;};'use strict';function Interval(_0x4cdec2){this['id']=_0x4cdec2['id']||0x0;this['name']=_0x4cdec2[_0xa5fd('0x0')]||'';this[_0xa5fd('0x1')]=_0x4cdec2[_0xa5fd('0x1')]||{};}module[_0xa5fd('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 f06a0ed..e0e9020 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 _0x7cb0=['loggedIn','length','online','mailPause','paused','available','waiting','stringify','format','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr'];(function(_0x5c9bd4,_0x5c8aed){var _0x2e97f2=function(_0x5c2ed2){while(--_0x5c2ed2){_0x5c9bd4['push'](_0x5c9bd4['shift']());}};_0x2e97f2(++_0x5c8aed);}(_0x7cb0,0x1bf));var _0x07cb=function(_0x57d843,_0x2a95e0){_0x57d843=_0x57d843-0x0;var _0x42ba2d=_0x7cb0[_0x57d843];return _0x42ba2d;};'use strict';var _=require(_0x07cb('0x0'));var md5=require(_0x07cb('0x1'));var util=require('util');var Redis=require(_0x07cb('0x2'));var config=require(_0x07cb('0x3'));config['redis']=_['defaults'](config[_0x07cb('0x4')],{'host':_0x07cb('0x5'),'port':0x18eb});var io=require(_0x07cb('0x6'))(new Redis(config[_0x07cb('0x4')]));function MailQueue(_0x440e30){this['id']=_0x440e30['id']||0x0;this[_0x07cb('0x7')]=_0x440e30[_0x07cb('0x7')]||'';this[_0x07cb('0x8')]=_0x440e30[_0x07cb('0x8')]||0xa;this[_0x07cb('0x9')]=_0x440e30[_0x07cb('0x9')]||_0x07cb('0xa');this[_0x07cb('0xb')]=_0x440e30[_0x07cb('0xb')];this[_0x07cb('0xc')]={};this['waiting']=0x0;this[_0x07cb('0x1')]='';this[_0x07cb('0xd')]();this[_0x07cb('0xe')]();}MailQueue[_0x07cb('0xf')][_0x07cb('0xd')]=function(){var _0x4bafac=this[_0x07cb('0xc')][_0x07cb('0x10')];this[_0x07cb('0xc')]=_['map'](this['Agents'],'id');this[_0x07cb('0xc')][_0x07cb('0x10')]=_0x4bafac;};MailQueue[_0x07cb('0xf')]['updateRealtime']=function(){this[_0x07cb('0x11')]=0x0;this['paused']=0x0;for(var _0xa4334=0x0;_0xa4334=0x0?this[_0x07cb('0x16')]:0x0;var _0x3df235={'id':this['id'],'available':this[_0x07cb('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x07cb('0x15')],'waiting':this[_0x07cb('0x17')]};var _0x40a0a7=md5(JSON[_0x07cb('0x18')](_0x3df235));if(this[_0x07cb('0x1')]!==_0x40a0a7){this[_0x07cb('0x1')]=_0x40a0a7;io['to'](util[_0x07cb('0x19')]('mail:queue:%s',_0x3df235[_0x07cb('0x7')]))[_0x07cb('0x1a')](_0x07cb('0x1b'),_0x3df235);}};module[_0x07cb('0x1c')]=MailQueue; \ No newline at end of file +var _0xffd0=['timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','length','mailPause','available','stringify','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x5d1d64,_0x3ca1b2){var _0x2c379b=function(_0x281986){while(--_0x281986){_0x5d1d64['push'](_0x5d1d64['shift']());}};_0x2c379b(++_0x3ca1b2);}(_0xffd0,0xf4));var _0x0ffd=function(_0x11f09c,_0x2ebb88){_0x11f09c=_0x11f09c-0x0;var _0x3ffc5a=_0xffd0[_0x11f09c];return _0x3ffc5a;};'use strict';var _=require(_0x0ffd('0x0'));var md5=require(_0x0ffd('0x1'));var util=require(_0x0ffd('0x2'));var Redis=require('ioredis');var config=require(_0x0ffd('0x3'));config['redis']=_['defaults'](config[_0x0ffd('0x4')],{'host':_0x0ffd('0x5'),'port':0x18eb});var io=require(_0x0ffd('0x6'))(new Redis(config[_0x0ffd('0x4')]));function MailQueue(_0x1956be){this['id']=_0x1956be['id']||0x0;this[_0x0ffd('0x7')]=_0x1956be['name']||'';this[_0x0ffd('0x8')]=_0x1956be['timeout']||0xa;this['strategy']=_0x1956be[_0x0ffd('0x9')]||_0x0ffd('0xa');this[_0x0ffd('0xb')]=_0x1956be[_0x0ffd('0xb')];this['mapAgentsId']={};this[_0x0ffd('0xc')]=0x0;this[_0x0ffd('0x1')]='';this['updateRouting']();this[_0x0ffd('0xd')]();}MailQueue[_0x0ffd('0xe')][_0x0ffd('0xf')]=function(){var _0x4ca660=this[_0x0ffd('0x10')][_0x0ffd('0x11')];this['mapAgentsId']=_[_0x0ffd('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x4ca660;};MailQueue[_0x0ffd('0xe')][_0x0ffd('0xd')]=function(){this[_0x0ffd('0x13')]=0x0;this[_0x0ffd('0x14')]=0x0;for(var _0x234fad=0x0;_0x234fad=0x0?this[_0x0ffd('0x17')]:0x0;var _0x312fc5={'id':this['id'],'available':this[_0x0ffd('0x17')],'loggedIn':this[_0x0ffd('0x13')],'name':this[_0x0ffd('0x7')],'paused':this[_0x0ffd('0x14')],'waiting':this['waiting']};var _0x5575f1=md5(JSON[_0x0ffd('0x18')](_0x312fc5));if(this[_0x0ffd('0x1')]!==_0x5575f1){this[_0x0ffd('0x1')]=_0x5575f1;io['to'](util['format']('mail:queue:%s',_0x312fc5['name']))[_0x0ffd('0x19')](_0x0ffd('0x1a'),_0x312fc5);}};module[_0x0ffd('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ff5ae05..4c91bb7 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x326f,0xd1));var _0xf326=function(_0x4b2541,_0x50089e){_0x4b2541=_0x4b2541-0x0;var _0xca2ce7=_0x326f[_0x4b2541];return _0xca2ce7;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x5896cb,_0x541afb){var _0x3e28ae=function(_0xd04e2f){while(--_0xd04e2f){_0x5896cb['push'](_0x5896cb['shift']());}};_0x3e28ae(++_0x541afb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x5fc3[_0x41ee16];return _0x1f60de;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 033d194..abd3bdc 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 _0xcabc=['map','prototype','paused','length','online','smsPause','available','loggedIn','format','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr'];(function(_0x570c60,_0x1f9ab1){var _0x5b93d2=function(_0x495551){while(--_0x495551){_0x570c60['push'](_0x570c60['shift']());}};_0x5b93d2(++_0x1f9ab1);}(_0xcabc,0x16a));var _0xccab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcabc[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var md5=require(_0xccab('0x0'));var util=require(_0xccab('0x1'));var Redis=require(_0xccab('0x2'));var config=require(_0xccab('0x3'));config[_0xccab('0x4')]=_['defaults'](config[_0xccab('0x4')],{'host':_0xccab('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xccab('0x4')]));function SmsQueue(_0x316f83){this['id']=_0x316f83['id']||0x0;this[_0xccab('0x6')]=_0x316f83['name']||'';this[_0xccab('0x7')]=_0x316f83[_0xccab('0x7')]||0xa;this[_0xccab('0x8')]=_0x316f83['strategy']||_0xccab('0x9');this[_0xccab('0xa')]=_0x316f83['Agents'];this[_0xccab('0xb')]={};this[_0xccab('0xc')]=0x0;this[_0xccab('0x0')]='';this[_0xccab('0xd')]();this[_0xccab('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x17b729=this[_0xccab('0xb')][_0xccab('0xf')];this[_0xccab('0xb')]=_[_0xccab('0x10')](this[_0xccab('0xa')],'id');this[_0xccab('0xb')]['_rr']=_0x17b729;};SmsQueue[_0xccab('0x11')][_0xccab('0xe')]=function(){this['loggedIn']=0x0;this[_0xccab('0x12')]=0x0;for(var _0x4f0643=0x0;_0x4f0643=0x0?this['available']:0x0;var _0x4ba1c2={'id':this['id'],'available':this[_0xccab('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xccab('0x6')],'paused':this[_0xccab('0x12')],'waiting':this[_0xccab('0xc')]};var _0x4ab126=md5(JSON['stringify'](_0x4ba1c2));if(this[_0xccab('0x0')]!==_0x4ab126){this[_0xccab('0x0')]=_0x4ab126;io['to'](util[_0xccab('0x18')]('sms:queue:%s',_0x4ba1c2[_0xccab('0x6')]))['emit'](_0xccab('0x19'),_0x4ba1c2);}};module[_0xccab('0x1a')]=SmsQueue; \ No newline at end of file +var _0xf25a=['md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','paused','length','online','available','loggedIn','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash'];(function(_0x4950e3,_0x241590){var _0x14ff2f=function(_0x525a36){while(--_0x525a36){_0x4950e3['push'](_0x4950e3['shift']());}};_0x14ff2f(++_0x241590);}(_0xf25a,0x195));var _0xaf25=function(_0x19e42d,_0x164af7){_0x19e42d=_0x19e42d-0x0;var _0x17a836=_0xf25a[_0x19e42d];return _0x17a836;};'use strict';var _=require(_0xaf25('0x0'));var md5=require(_0xaf25('0x1'));var util=require(_0xaf25('0x2'));var Redis=require('ioredis');var config=require(_0xaf25('0x3'));config[_0xaf25('0x4')]=_[_0xaf25('0x5')](config['redis'],{'host':_0xaf25('0x6'),'port':0x18eb});var io=require(_0xaf25('0x7'))(new Redis(config[_0xaf25('0x4')]));function SmsQueue(_0x4b9e77){this['id']=_0x4b9e77['id']||0x0;this['name']=_0x4b9e77[_0xaf25('0x8')]||'';this['timeout']=_0x4b9e77['timeout']||0xa;this[_0xaf25('0x9')]=_0x4b9e77[_0xaf25('0x9')]||_0xaf25('0xa');this['Agents']=_0x4b9e77[_0xaf25('0xb')];this[_0xaf25('0xc')]={};this[_0xaf25('0xd')]=0x0;this[_0xaf25('0x1')]='';this[_0xaf25('0xe')]();this['updateRealtime']();}SmsQueue[_0xaf25('0xf')][_0xaf25('0xe')]=function(){var _0x350f8e=this[_0xaf25('0xc')]['_rr'];this['mapAgentsId']=_[_0xaf25('0x10')](this[_0xaf25('0xb')],'id');this[_0xaf25('0xc')][_0xaf25('0x11')]=_0x350f8e;};SmsQueue[_0xaf25('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xaf25('0x12')]=0x0;for(var _0x47bc60=0x0;_0x47bc60=0x0?this[_0xaf25('0x15')]:0x0;var _0x28bb0e={'id':this['id'],'available':this[_0xaf25('0x15')],'loggedIn':this[_0xaf25('0x16')],'name':this[_0xaf25('0x8')],'paused':this[_0xaf25('0x12')],'waiting':this[_0xaf25('0xd')]};var _0x4ed319=md5(JSON[_0xaf25('0x17')](_0x28bb0e));if(this['md5']!==_0x4ed319){this[_0xaf25('0x1')]=_0x4ed319;io['to'](util[_0xaf25('0x18')](_0xaf25('0x19'),_0x28bb0e[_0xaf25('0x8')]))[_0xaf25('0x1a')](_0xaf25('0x1b'),_0x28bb0e);}};module[_0xaf25('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 37844e4..0fa9f8d 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 _0x6781=['loggedIn','paused','online','available','stringify','md5','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime'];(function(_0x5012e0,_0x47a186){var _0x72706d=function(_0x13d02e){while(--_0x13d02e){_0x5012e0['push'](_0x5012e0['shift']());}};_0x72706d(++_0x47a186);}(_0x6781,0xa4));var _0x1678=function(_0x230f23,_0x532c40){_0x230f23=_0x230f23-0x0;var _0x177694=_0x6781[_0x230f23];return _0x177694;};'use strict';var _=require(_0x1678('0x0'));var md5=require('md5');var util=require(_0x1678('0x1'));var Redis=require(_0x1678('0x2'));var config=require(_0x1678('0x3'));config[_0x1678('0x4')]=_[_0x1678('0x5')](config[_0x1678('0x4')],{'host':_0x1678('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1678('0x4')]));function WhatsappQueue(_0x5c033c){this['id']=_0x5c033c['id']||0x0;this[_0x1678('0x7')]=_0x5c033c[_0x1678('0x7')]||'';this[_0x1678('0x8')]=_0x5c033c['timeout']||0xa;this[_0x1678('0x9')]=_0x5c033c['strategy']||'beepall';this[_0x1678('0xa')]=_0x5c033c[_0x1678('0xa')];this['mapAgentsId']={};this[_0x1678('0xb')]=0x0;this['md5']='';this[_0x1678('0xc')]();this['updateRealtime']();}WhatsappQueue[_0x1678('0xd')][_0x1678('0xc')]=function(){var _0x9414b9=this[_0x1678('0xe')][_0x1678('0xf')];this[_0x1678('0xe')]=_[_0x1678('0x10')](this[_0x1678('0xa')],'id');this[_0x1678('0xe')][_0x1678('0xf')]=_0x9414b9;};WhatsappQueue['prototype'][_0x1678('0x11')]=function(){this[_0x1678('0x12')]=0x0;this[_0x1678('0x13')]=0x0;for(var _0x3bcf15=0x0;_0x3bcf15=0x0?this[_0x1678('0x15')]:0x0;var _0x464f21={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1678('0x12')],'name':this[_0x1678('0x7')],'paused':this[_0x1678('0x13')],'waiting':this['waiting']};var _0x1949b3=md5(JSON[_0x1678('0x16')](_0x464f21));if(this[_0x1678('0x17')]!==_0x1949b3){this[_0x1678('0x17')]=_0x1949b3;io['to'](util['format']('whatsapp:queue:%s',_0x464f21['name']))[_0x1678('0x18')](_0x1678('0x19'),_0x464f21);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xc39a=['ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','paused','length','available','loggedIn','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util'];(function(_0x379bb1,_0x2d7478){var _0x465a34=function(_0x28ca57){while(--_0x28ca57){_0x379bb1['push'](_0x379bb1['shift']());}};_0x465a34(++_0x2d7478);}(_0xc39a,0x169));var _0xac39=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0xc39a[_0x12b683];return _0xfb150b;};'use strict';var _=require(_0xac39('0x0'));var md5=require(_0xac39('0x1'));var util=require(_0xac39('0x2'));var Redis=require(_0xac39('0x3'));var config=require(_0xac39('0x4'));config[_0xac39('0x5')]=_[_0xac39('0x6')](config['redis'],{'host':_0xac39('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xac39('0x5')]));function WhatsappQueue(_0x2ef5c0){this['id']=_0x2ef5c0['id']||0x0;this['name']=_0x2ef5c0[_0xac39('0x8')]||'';this[_0xac39('0x9')]=_0x2ef5c0[_0xac39('0x9')]||0xa;this[_0xac39('0xa')]=_0x2ef5c0[_0xac39('0xa')]||'beepall';this['Agents']=_0x2ef5c0[_0xac39('0xb')];this[_0xac39('0xc')]={};this[_0xac39('0xd')]=0x0;this[_0xac39('0x1')]='';this[_0xac39('0xe')]();this[_0xac39('0xf')]();}WhatsappQueue['prototype'][_0xac39('0xe')]=function(){var _0x769d2b=this[_0xac39('0xc')][_0xac39('0x10')];this[_0xac39('0xc')]=_[_0xac39('0x11')](this[_0xac39('0xb')],'id');this['mapAgentsId'][_0xac39('0x10')]=_0x769d2b;};WhatsappQueue[_0xac39('0x12')][_0xac39('0xf')]=function(){this['loggedIn']=0x0;this[_0xac39('0x13')]=0x0;for(var _0x437011=0x0;_0x437011=0x0?this[_0xac39('0x15')]:0x0;var _0x5e96d1={'id':this['id'],'available':this[_0xac39('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xac39('0x13')],'waiting':this[_0xac39('0xd')]};var _0x1d1fc3=md5(JSON[_0xac39('0x17')](_0x5e96d1));if(this[_0xac39('0x1')]!==_0x1d1fc3){this[_0xac39('0x1')]=_0x1d1fc3;io['to'](util[_0xac39('0x18')](_0xac39('0x19'),_0x5e96d1['name']))[_0xac39('0x1a')](_0xac39('0x1b'),_0x5e96d1);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8ccf3fb..8c8ac32 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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 54bc15a..f1fd267 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 _0xd965=['Request','UpdateChatInteraction','updateChatInteraction','addTags','../client','update'];(function(_0x21ad2e,_0x554906){var _0x443b40=function(_0x2668c4){while(--_0x2668c4){_0x21ad2e['push'](_0x21ad2e['shift']());}};_0x443b40(++_0x554906);}(_0xd965,0xca));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5d96('0x0'));exports[_0x5d96('0x1')]=function(_0x55789d,_0x16ccd7){return client[_0x5d96('0x2')](_0x5d96('0x3'),{'body':_0x16ccd7,'options':{'where':{'id':_0x55789d}},'log':_0x5d96('0x4')});};exports[_0x5d96('0x5')]=function(_0x5b26dd,_0x2fec03){return client[_0x5d96('0x2')]('AddTagsToChatInteraction',{'body':_0x2fec03,'options':{'where':{'id':_0x5b26dd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xea9a=['UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xea9a,0x18a));var _0xaea9=function(_0x53c408,_0x3cdd91){_0x53c408=_0x53c408-0x0;var _0xb8ac1=_0xea9a[_0x53c408];return _0xb8ac1;};'use strict';var client=require('../client');exports[_0xaea9('0x0')]=function(_0x174387,_0x4490dc){return client[_0xaea9('0x1')](_0xaea9('0x2'),{'body':_0x4490dc,'options':{'where':{'id':_0x174387}},'log':_0xaea9('0x3')});};exports['addTags']=function(_0x423cc8,_0x58dc71){return client[_0xaea9('0x1')](_0xaea9('0x4'),{'body':_0x58dc71,'options':{'where':{'id':_0x423cc8}},'log':_0xaea9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a688648..334bec0 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 _0x2c15=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x381733,_0x4d14bd){var _0x2fb114=function(_0x5741f8){while(--_0x5741f8){_0x381733['push'](_0x381733['shift']());}};_0x2fb114(++_0x4d14bd);}(_0x2c15,0x133));var _0x52c1=function(_0x79aa4f,_0x34e095){_0x79aa4f=_0x79aa4f-0x0;var _0x335ffe=_0x2c15[_0x79aa4f];return _0x335ffe;};'use strict';var client=require(_0x52c1('0x0'));exports[_0x52c1('0x1')]=function(_0x4f76e7){return client[_0x52c1('0x2')](_0x52c1('0x3'),{'body':_0x4f76e7,'log':_0x52c1('0x4')});}; \ No newline at end of file +var _0x8241=['createChatMessage','../client','CreateChatMessage'];(function(_0x37ab8a,_0x3b6fe4){var _0x1030c6=function(_0x1d66b3){while(--_0x1d66b3){_0x37ab8a['push'](_0x37ab8a['shift']());}};_0x1030c6(++_0x3b6fe4);}(_0x8241,0x1d8));var _0x1824=function(_0x106349,_0x3ad271){_0x106349=_0x106349-0x0;var _0x2661ad=_0x8241[_0x106349];return _0x2661ad;};'use strict';var client=require(_0x1824('0x0'));exports['create']=function(_0x633f92){return client['Request'](_0x1824('0x1'),{'body':_0x633f92,'log':_0x1824('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 3b526ad..394c59c 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 _0x7cab=['chatPause','../client','getChatQueues','Request','name','timeout','strategy','Agents'];(function(_0x1c3e2c,_0x1b4efa){var _0x59f7ca=function(_0x1414b6){while(--_0x1414b6){_0x1c3e2c['push'](_0x1c3e2c['shift']());}};_0x59f7ca(++_0x1b4efa);}(_0x7cab,0x91));var _0xb7ca=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0x7cab[_0x48e1ec];return _0x3b33eb;};'use strict';var client=require(_0xb7ca('0x0'));exports[_0xb7ca('0x1')]=function(){return function(){return client[_0xb7ca('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xb7ca('0x3'),_0xb7ca('0x4'),_0xb7ca('0x5')],'include':[{'model':'User','as':_0xb7ca('0x6'),'attributes':['id','name','online',_0xb7ca('0x7')]}]},'log':_0xb7ca('0x1')});};}; \ No newline at end of file +var _0xb715=['getChatQueues','GetChatQueue','name','strategy','Agents'];(function(_0x34750b,_0x34aae5){var _0x244258=function(_0x503bf2){while(--_0x503bf2){_0x34750b['push'](_0x34750b['shift']());}};_0x244258(++_0x34aae5);}(_0xb715,0x16d));var _0x5b71=function(_0x1cf891,_0x569404){_0x1cf891=_0x1cf891-0x0;var _0x3fe149=_0xb715[_0x1cf891];return _0x3fe149;};'use strict';var client=require('../client');exports[_0x5b71('0x0')]=function(){return function(){return client['Request'](_0x5b71('0x1'),{'options':{'raw':![],'attributes':['id',_0x5b71('0x2'),'timeout',_0x5b71('0x3')],'include':[{'model':'User','as':_0x5b71('0x4'),'attributes':['id',_0x5b71('0x2'),'online','chatPause']}]},'log':_0x5b71('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 83f82a8..294652e 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 _0xf4dd=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x3f20c3,_0x38729e){var _0x2e5b1e=function(_0x78359a){while(--_0x78359a){_0x3f20c3['push'](_0x3f20c3['shift']());}};_0x2e5b1e(++_0x38729e);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x1b1834,_0x165b05){_0x1b1834=_0x1b1834-0x0;var _0x5352ad=_0xf4dd[_0x1b1834];return _0x5352ad;};'use strict';var client=require(_0xdf4d('0x0'));exports[_0xdf4d('0x1')]=function(_0x160b41){return client[_0xdf4d('0x2')](_0xdf4d('0x3'),{'body':_0x160b41,'log':_0xdf4d('0x3')});};exports[_0xdf4d('0x4')]=function(_0x47d568,_0x1974da){return client['Request'](_0xdf4d('0x5'),{'body':_0x1974da,'options':{'where':{'uniqueid':_0x47d568},'order':[['id','DESC']],'limit':0x1},'log':_0xdf4d('0x5')});}; \ No newline at end of file +var _0xc79f=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x214551,_0x4f421b){var _0x568f08=function(_0x237315){while(--_0x237315){_0x214551['push'](_0x214551['shift']());}};_0x568f08(++_0x4f421b);}(_0xc79f,0x82));var _0xfc79=function(_0x3f823a,_0x29330a){_0x3f823a=_0x3f823a-0x0;var _0x440e40=_0xc79f[_0x3f823a];return _0x440e40;};'use strict';var client=require(_0xfc79('0x0'));exports[_0xfc79('0x1')]=function(_0x10d1ee){return client[_0xfc79('0x2')](_0xfc79('0x3'),{'body':_0x10d1ee,'log':'CreateChatQueueReport'});};exports[_0xfc79('0x4')]=function(_0x31cbc0,_0xa5d8da){return client[_0xfc79('0x2')](_0xfc79('0x5'),{'body':_0xa5d8da,'options':{'where':{'uniqueid':_0x31cbc0},'order':[['id',_0xfc79('0x6')]],'limit':0x1},'log':_0xfc79('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index dbc2536..72bed8f 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x7a54,0x106));var _0x47a5=function(_0x597929,_0x326ae7){_0x597929=_0x597929-0x0;var _0x489806=_0x7a54[_0x597929];return _0x489806;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x7a54,0x106));var _0x47a5=function(_0x274b60,_0x14fa24){_0x274b60=_0x274b60-0x0;var _0x326f22=_0x7a54[_0x274b60];return _0x326f22;};'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 eda997a..c853d32 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 _0x7b40=['Request','CreateFaxMessage','createFaxMessage','create'];(function(_0x403750,_0x7755fd){var _0x5a5c5d=function(_0x52f608){while(--_0x52f608){_0x403750['push'](_0x403750['shift']());}};_0x5a5c5d(++_0x7755fd);}(_0x7b40,0x197));var _0x07b4=function(_0x425ce1,_0x1cbcf6){_0x425ce1=_0x425ce1-0x0;var _0x567c82=_0x7b40[_0x425ce1];return _0x567c82;};'use strict';var client=require('../client');exports[_0x07b4('0x0')]=function(_0x38969d){return client[_0x07b4('0x1')](_0x07b4('0x2'),{'body':_0x38969d,'log':_0x07b4('0x3')});}; \ No newline at end of file +var _0x637c=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x637c,0x17f));var _0xc637=function(_0x143e89,_0x2c1e1c){_0x143e89=_0x143e89-0x0;var _0x5f4e54=_0x637c[_0x143e89];return _0x5f4e54;};'use strict';var client=require(_0xc637('0x0'));exports['create']=function(_0x5a9545){return client[_0xc637('0x1')](_0xc637('0x2'),{'body':_0x5a9545,'log':_0xc637('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 84187f4..03d0f87 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 _0x0f3a=['name','User','Agents','online','getFaxQueues','../client','Request'];(function(_0x2b993a,_0x25f37e){var _0x25ec8=function(_0x10c359){while(--_0x10c359){_0x2b993a['push'](_0x2b993a['shift']());}};_0x25ec8(++_0x25f37e);}(_0x0f3a,0x75));var _0xa0f3=function(_0xbaaaaa,_0x233ebf){_0xbaaaaa=_0xbaaaaa-0x0;var _0x6b771d=_0x0f3a[_0xbaaaaa];return _0x6b771d;};'use strict';var client=require(_0xa0f3('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xa0f3('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xa0f3('0x2'),'timeout','strategy'],'include':[{'model':_0xa0f3('0x3'),'as':_0xa0f3('0x4'),'attributes':['id','name',_0xa0f3('0x5'),'faxPause']}]},'log':_0xa0f3('0x6')});};}; \ No newline at end of file +var _0xbc09=['timeout','strategy','Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x18544f,_0x4c9559){var _0x84cbbf=function(_0x23e480){while(--_0x23e480){_0x18544f['push'](_0x18544f['shift']());}};_0x84cbbf(++_0x4c9559);}(_0xbc09,0x190));var _0x9bc0=function(_0x5a60ba,_0x99b206){_0x5a60ba=_0x5a60ba-0x0;var _0x4e0140=_0xbc09[_0x5a60ba];return _0x4e0140;};'use strict';var client=require(_0x9bc0('0x0'));exports[_0x9bc0('0x1')]=function(){return function(){return client[_0x9bc0('0x2')](_0x9bc0('0x3'),{'options':{'raw':![],'attributes':['id',_0x9bc0('0x4'),_0x9bc0('0x5'),_0x9bc0('0x6')],'include':[{'model':'User','as':_0x9bc0('0x7'),'attributes':['id',_0x9bc0('0x4'),'online',_0x9bc0('0x8')]}]},'log':_0x9bc0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index b88fd18..b19c65b 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 _0x6951=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x4e8b4a,_0x246326){var _0x555a37=function(_0x2cb124){while(--_0x2cb124){_0x4e8b4a['push'](_0x4e8b4a['shift']());}};_0x555a37(++_0x246326);}(_0x6951,0x133));var _0x1695=function(_0x594ba1,_0xa7b683){_0x594ba1=_0x594ba1-0x0;var _0x46ee83=_0x6951[_0x594ba1];return _0x46ee83;};'use strict';var client=require(_0x1695('0x0'));exports[_0x1695('0x1')]=function(_0x42af5e){return client[_0x1695('0x2')](_0x1695('0x3'),{'body':_0x42af5e,'log':_0x1695('0x3')});};exports[_0x1695('0x4')]=function(_0x356c6d,_0x1fb8d5){return client[_0x1695('0x2')](_0x1695('0x5'),{'body':_0x1fb8d5,'options':{'where':{'uniqueid':_0x356c6d},'order':[['id',_0x1695('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xf3ed=['UpdateFaxQueueReport','DESC','../client','CreateFaxQueueReport','Request'];(function(_0x53885b,_0x502115){var _0x2a17db=function(_0x3a83e0){while(--_0x3a83e0){_0x53885b['push'](_0x53885b['shift']());}};_0x2a17db(++_0x502115);}(_0xf3ed,0xed));var _0xdf3e=function(_0x40c395,_0x2006ef){_0x40c395=_0x40c395-0x0;var _0x3dc6f1=_0xf3ed[_0x40c395];return _0x3dc6f1;};'use strict';var client=require(_0xdf3e('0x0'));exports['create']=function(_0x21f8a2){return client['Request']('CreateFaxQueueReport',{'body':_0x21f8a2,'log':_0xdf3e('0x1')});};exports['update']=function(_0x514244,_0x385636){return client[_0xdf3e('0x2')](_0xdf3e('0x3'),{'body':_0x385636,'options':{'where':{'uniqueid':_0x514244},'order':[['id',_0xdf3e('0x4')]],'limit':0x1},'log':_0xdf3e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c4f3462..b92ff0a 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 _0xb8ca=['name','../client','getIntervals','Request','Interval','Intervals'];(function(_0x32a69b,_0x440e84){var _0x464b04=function(_0x82195b){while(--_0x82195b){_0x32a69b['push'](_0x32a69b['shift']());}};_0x464b04(++_0x440e84);}(_0xb8ca,0x9d));var _0xab8c=function(_0x259106,_0x2f7af3){_0x259106=_0x259106-0x0;var _0x34f733=_0xb8ca[_0x259106];return _0x34f733;};'use strict';var client=require(_0xab8c('0x0'));exports[_0xab8c('0x1')]=function(){return function(){return client[_0xab8c('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xab8c('0x3'),'as':_0xab8c('0x4'),'attributes':['id',_0xab8c('0x5'),'interval']}]},'log':_0xab8c('0x1')});};}; \ No newline at end of file +var _0x19b0=['../client','getIntervals','Request','name','Intervals','interval'];(function(_0x9b8c2c,_0x10294b){var _0x379a4e=function(_0x203d1f){while(--_0x203d1f){_0x9b8c2c['push'](_0x9b8c2c['shift']());}};_0x379a4e(++_0x10294b);}(_0x19b0,0xc6));var _0x019b=function(_0x29034d,_0x4c03da){_0x29034d=_0x29034d-0x0;var _0x2cd930=_0x19b0[_0x29034d];return _0x2cd930;};'use strict';var client=require(_0x019b('0x0'));exports[_0x019b('0x1')]=function(){return function(){return client[_0x019b('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x019b('0x3')],'include':[{'model':'Interval','as':_0x019b('0x4'),'attributes':['id',_0x019b('0x3'),_0x019b('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0d29f48..d969295 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4f4=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x27f944,_0x528f68){var _0x26e19a=function(_0x42b2ab){while(--_0x42b2ab){_0x27f944['push'](_0x27f944['shift']());}};_0x26e19a(++_0x528f68);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x33a8f3,_0x362516){_0x33a8f3=_0x33a8f3-0x0;var _0x547760=_0xf4f4[_0x33a8f3];return _0x547760;};'use strict';var client=require(_0x4f4f('0x0'));exports[_0x4f4f('0x1')]=function(_0x533895,_0x16a496){return client[_0x4f4f('0x2')](_0x4f4f('0x3'),{'body':_0x16a496,'options':{'where':{'id':_0x533895}},'log':_0x4f4f('0x4')});};exports[_0x4f4f('0x5')]=function(_0x510b24,_0x5a752b){return client['Request'](_0x4f4f('0x6'),{'body':_0x5a752b,'options':{'where':{'id':_0x510b24}},'log':_0x4f4f('0x7')});}; \ No newline at end of file +var _0x4bd3=['../client','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0xe67d1c,_0x1b21d1){var _0x11673c=function(_0x119660){while(--_0x119660){_0xe67d1c['push'](_0xe67d1c['shift']());}};_0x11673c(++_0x1b21d1);}(_0x4bd3,0x174));var _0x34bd=function(_0x45b771,_0x2caece){_0x45b771=_0x45b771-0x0;var _0x7ef73d=_0x4bd3[_0x45b771];return _0x7ef73d;};'use strict';var client=require(_0x34bd('0x0'));exports['update']=function(_0x415bd3,_0x22a9f9){return client['Request']('UpdateMailInteraction',{'body':_0x22a9f9,'options':{'where':{'id':_0x415bd3}},'log':'updateMailInteraction'});};exports[_0x34bd('0x1')]=function(_0x44854a,_0x1fc8eb){return client['Request'](_0x34bd('0x2'),{'body':_0x1fc8eb,'options':{'where':{'id':_0x44854a}},'log':_0x34bd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 85dbc96..4f966d6 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 _0xe12b=['Request','createMailMessage','../client','create'];(function(_0x3759b7,_0x5b6ae9){var _0x5a4fae=function(_0x45af0a){while(--_0x45af0a){_0x3759b7['push'](_0x3759b7['shift']());}};_0x5a4fae(++_0x5b6ae9);}(_0xe12b,0xd6));var _0xbe12=function(_0x168e02,_0x4ce6d3){_0x168e02=_0x168e02-0x0;var _0x137d9f=_0xe12b[_0x168e02];return _0x137d9f;};'use strict';var client=require(_0xbe12('0x0'));exports[_0xbe12('0x1')]=function(_0x4d133d){return client[_0xbe12('0x2')]('CreateMailMessage',{'body':_0x4d133d,'log':_0xbe12('0x3')});}; \ No newline at end of file +var _0xa2de=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa2de,0xab));var _0xea2d=function(_0x27c1d0,_0x67a968){_0x27c1d0=_0x27c1d0-0x0;var _0x3378a6=_0xa2de[_0x27c1d0];return _0x3378a6;};'use strict';var client=require(_0xea2d('0x0'));exports[_0xea2d('0x1')]=function(_0x49e7a5){return client[_0xea2d('0x2')](_0xea2d('0x3'),{'body':_0x49e7a5,'log':_0xea2d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 50ebff3..d845af7 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 _0xf03a=['getMailQueues','Request','GetMailQueue','name','strategy','User','online','mailPause'];(function(_0x39f375,_0x3aa8ec){var _0x463f93=function(_0x290215){while(--_0x290215){_0x39f375['push'](_0x39f375['shift']());}};_0x463f93(++_0x3aa8ec);}(_0xf03a,0x1a0));var _0xaf03=function(_0x5691bb,_0x252708){_0x5691bb=_0x5691bb-0x0;var _0x4a063d=_0xf03a[_0x5691bb];return _0x4a063d;};'use strict';var client=require('../client');exports[_0xaf03('0x0')]=function(){return function(){return client[_0xaf03('0x1')](_0xaf03('0x2'),{'options':{'raw':![],'attributes':['id',_0xaf03('0x3'),'timeout',_0xaf03('0x4')],'include':[{'model':_0xaf03('0x5'),'as':'Agents','attributes':['id',_0xaf03('0x3'),_0xaf03('0x6'),_0xaf03('0x7')]}]},'log':_0xaf03('0x0')});};}; \ No newline at end of file +var _0xabb2=['GetMailQueue','name','strategy','User','Agents','online','../client','getMailQueues','Request'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0xabb2,0xa8));var _0x2abb=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0xabb2[_0x400b43];return _0x3c330f;};'use strict';var client=require(_0x2abb('0x0'));exports[_0x2abb('0x1')]=function(){return function(){return client[_0x2abb('0x2')](_0x2abb('0x3'),{'options':{'raw':![],'attributes':['id',_0x2abb('0x4'),'timeout',_0x2abb('0x5')],'include':[{'model':_0x2abb('0x6'),'as':_0x2abb('0x7'),'attributes':['id',_0x2abb('0x4'),_0x2abb('0x8'),'mailPause']}]},'log':_0x2abb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index fc91821..70877ad 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 _0x82eb=['update','Request','UpdateMailQueueReport','create','CreateMailQueueReport'];(function(_0x57e9cd,_0x289043){var _0x15a8d0=function(_0x1bac87){while(--_0x1bac87){_0x57e9cd['push'](_0x57e9cd['shift']());}};_0x15a8d0(++_0x289043);}(_0x82eb,0x67));var _0xb82e=function(_0x8fc3a0,_0x1b2f6d){_0x8fc3a0=_0x8fc3a0-0x0;var _0x13f1dd=_0x82eb[_0x8fc3a0];return _0x13f1dd;};'use strict';var client=require('../client');exports[_0xb82e('0x0')]=function(_0x5d3cfd){return client['Request']('CreateMailQueueReport',{'body':_0x5d3cfd,'log':_0xb82e('0x1')});};exports[_0xb82e('0x2')]=function(_0x403d64,_0x38b509){return client[_0xb82e('0x3')]('UpdateMailQueueReport',{'body':_0x38b509,'options':{'where':{'uniqueid':_0x403d64},'order':[['id','DESC']],'limit':0x1},'log':_0xb82e('0x4')});}; \ No newline at end of file +var _0x67d7=['CreateMailQueueReport','UpdateMailQueueReport','DESC','create','Request'];(function(_0x5a0799,_0x5781c3){var _0x346b7e=function(_0x19a3dc){while(--_0x19a3dc){_0x5a0799['push'](_0x5a0799['shift']());}};_0x346b7e(++_0x5781c3);}(_0x67d7,0xd0));var _0x767d=function(_0x3c974f,_0x33a7db){_0x3c974f=_0x3c974f-0x0;var _0x157515=_0x67d7[_0x3c974f];return _0x157515;};'use strict';var client=require('../client');exports[_0x767d('0x0')]=function(_0x2df18e){return client[_0x767d('0x1')](_0x767d('0x2'),{'body':_0x2df18e,'log':_0x767d('0x2')});};exports['update']=function(_0x3cd12e,_0xecd5d8){return client[_0x767d('0x1')](_0x767d('0x3'),{'body':_0xecd5d8,'options':{'where':{'uniqueid':_0x3cd12e},'order':[['id',_0x767d('0x4')]],'limit':0x1},'log':_0x767d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ca9efe3..c410f3d 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 _0xabc8=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','update','Request'];(function(_0x424a9a,_0x6a9d23){var _0x45d46e=function(_0x46f135){while(--_0x46f135){_0x424a9a['push'](_0x424a9a['shift']());}};_0x45d46e(++_0x6a9d23);}(_0xabc8,0x9a));var _0x8abc=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xabc8[_0x2f3794];return _0x1c9fbe;};'use strict';var client=require('../client');exports[_0x8abc('0x0')]=function(_0x32b32d,_0x3c8b45){return client[_0x8abc('0x1')]('UpdateOpenchannelInteraction',{'body':_0x3c8b45,'options':{'where':{'id':_0x32b32d}},'log':_0x8abc('0x2')});};exports['addTags']=function(_0x42f405,_0x56c55b){return client[_0x8abc('0x1')](_0x8abc('0x3'),{'body':_0x56c55b,'options':{'where':{'id':_0x42f405}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xb914=['update','Request','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x52d66b,_0x446fbd){var _0x3f45e3=function(_0x32d4e1){while(--_0x32d4e1){_0x52d66b['push'](_0x52d66b['shift']());}};_0x3f45e3(++_0x446fbd);}(_0xb914,0x1b5));var _0x4b91=function(_0x36ce07,_0x4b062d){_0x36ce07=_0x36ce07-0x0;var _0x3224ee=_0xb914[_0x36ce07];return _0x3224ee;};'use strict';var client=require(_0x4b91('0x0'));exports[_0x4b91('0x1')]=function(_0x59c394,_0x3962a8){return client[_0x4b91('0x2')]('UpdateOpenchannelInteraction',{'body':_0x3962a8,'options':{'where':{'id':_0x59c394}},'log':_0x4b91('0x3')});};exports['addTags']=function(_0x390a6f,_0x1cbdc9){return client[_0x4b91('0x2')](_0x4b91('0x4'),{'body':_0x1cbdc9,'options':{'where':{'id':_0x390a6f}},'log':_0x4b91('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 87bd783..65a3898 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 _0xb95d=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2a3a89,_0x564786){var _0x4a9737=function(_0x156626){while(--_0x156626){_0x2a3a89['push'](_0x2a3a89['shift']());}};_0x4a9737(++_0x564786);}(_0xb95d,0x9b));var _0xdb95=function(_0x52e77f,_0x368694){_0x52e77f=_0x52e77f-0x0;var _0x3aad87=_0xb95d[_0x52e77f];return _0x3aad87;};'use strict';var client=require(_0xdb95('0x0'));exports[_0xdb95('0x1')]=function(_0x4f4a57){return client[_0xdb95('0x2')](_0xdb95('0x3'),{'body':_0x4f4a57,'log':_0xdb95('0x4')});}; \ No newline at end of file +var _0xc3b5=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x351598,_0x5b0756){var _0x296ac0=function(_0x2cbbc1){while(--_0x2cbbc1){_0x351598['push'](_0x351598['shift']());}};_0x296ac0(++_0x5b0756);}(_0xc3b5,0x154));var _0x5c3b=function(_0x125be2,_0x48ccb9){_0x125be2=_0x125be2-0x0;var _0x27739a=_0xc3b5[_0x125be2];return _0x27739a;};'use strict';var client=require(_0x5c3b('0x0'));exports[_0x5c3b('0x1')]=function(_0x2025fd){return client['Request'](_0x5c3b('0x2'),{'body':_0x2025fd,'log':_0x5c3b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index b761d1a..d92eef3 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 _0xdfe7=['online','getOpenchannelQueues','GetOpenchannelQueue','strategy','Agents'];(function(_0x2905f4,_0x1f2135){var _0x2eae97=function(_0x2498d8){while(--_0x2498d8){_0x2905f4['push'](_0x2905f4['shift']());}};_0x2eae97(++_0x1f2135);}(_0xdfe7,0x196));var _0x7dfe=function(_0x27b817,_0x5a7ecf){_0x27b817=_0x27b817-0x0;var _0x3c66a4=_0xdfe7[_0x27b817];return _0x3c66a4;};'use strict';var client=require('../client');exports[_0x7dfe('0x0')]=function(){return function(){return client['Request'](_0x7dfe('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x7dfe('0x2')],'include':[{'model':'User','as':_0x7dfe('0x3'),'attributes':['id','name',_0x7dfe('0x4'),'openchannelPause']}]},'log':_0x7dfe('0x0')});};}; \ No newline at end of file +var _0x8fde=['Agents','name','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','User'];(function(_0x556196,_0x402f47){var _0x5a477a=function(_0x26cdbd){while(--_0x26cdbd){_0x556196['push'](_0x556196['shift']());}};_0x5a477a(++_0x402f47);}(_0x8fde,0x138));var _0xe8fd=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x8fde[_0x36884e];return _0x1cc367;};'use strict';var client=require('../client');exports[_0xe8fd('0x0')]=function(){return function(){return client['Request'](_0xe8fd('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xe8fd('0x2'),'as':_0xe8fd('0x3'),'attributes':['id',_0xe8fd('0x4'),_0xe8fd('0x5'),_0xe8fd('0x6')]}]},'log':_0xe8fd('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3a9a766..6406357 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 _0x7b70=['UpdateOpenchannelQueueReport','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b70,0xc4));var _0x07b7=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x7b70[_0x9dfc10];return _0x4f938a;};'use strict';var client=require(_0x07b7('0x0'));exports['create']=function(_0x490521){return client[_0x07b7('0x1')](_0x07b7('0x2'),{'body':_0x490521,'log':_0x07b7('0x2')});};exports[_0x07b7('0x3')]=function(_0x3e7eb0,_0x279b6f){return client['Request'](_0x07b7('0x4'),{'body':_0x279b6f,'options':{'where':{'uniqueid':_0x3e7eb0},'order':[['id','DESC']],'limit':0x1},'log':_0x07b7('0x4')});}; \ No newline at end of file +var _0xb4b3=['update','UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport'];(function(_0x1da632,_0x329638){var _0x3b7142=function(_0x3c83f5){while(--_0x3c83f5){_0x1da632['push'](_0x1da632['shift']());}};_0x3b7142(++_0x329638);}(_0xb4b3,0x1e3));var _0x3b4b=function(_0x5cffc2,_0x22f576){_0x5cffc2=_0x5cffc2-0x0;var _0x3aeeb5=_0xb4b3[_0x5cffc2];return _0x3aeeb5;};'use strict';var client=require('../client');exports[_0x3b4b('0x0')]=function(_0x2f4b71){return client[_0x3b4b('0x1')](_0x3b4b('0x2'),{'body':_0x2f4b71,'log':_0x3b4b('0x2')});};exports[_0x3b4b('0x3')]=function(_0xa8ced7,_0x3f07e0){return client[_0x3b4b('0x1')](_0x3b4b('0x4'),{'body':_0x3f07e0,'options':{'where':{'uniqueid':_0xa8ced7},'order':[['id',_0x3b4b('0x5')]],'limit':0x1},'log':_0x3b4b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index b6e04bf..471a3fc 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 _0xdbd0=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction'];(function(_0x13524d,_0x505b49){var _0x9918b4=function(_0xef1f0a){while(--_0xef1f0a){_0x13524d['push'](_0x13524d['shift']());}};_0x9918b4(++_0x505b49);}(_0xdbd0,0x88));var _0x0dbd=function(_0x599107,_0x7eecb4){_0x599107=_0x599107-0x0;var _0x43c3b6=_0xdbd0[_0x599107];return _0x43c3b6;};'use strict';var client=require(_0x0dbd('0x0'));exports[_0x0dbd('0x1')]=function(_0x2a19c3,_0xac1778){return client[_0x0dbd('0x2')]('UpdateSmsInteraction',{'body':_0xac1778,'options':{'where':{'id':_0x2a19c3}},'log':_0x0dbd('0x3')});};exports[_0x0dbd('0x4')]=function(_0x1aeffb,_0x5ec8d7){return client[_0x0dbd('0x2')](_0x0dbd('0x5'),{'body':_0x5ec8d7,'options':{'where':{'id':_0x1aeffb}},'log':_0x0dbd('0x6')});}; \ No newline at end of file +var _0xaf5a=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x2a6919,_0x15a3c1){var _0x584122=function(_0x15a9e2){while(--_0x15a9e2){_0x2a6919['push'](_0x2a6919['shift']());}};_0x584122(++_0x15a3c1);}(_0xaf5a,0x144));var _0xaaf5=function(_0x17fd72,_0x2b8254){_0x17fd72=_0x17fd72-0x0;var _0xa8d8c6=_0xaf5a[_0x17fd72];return _0xa8d8c6;};'use strict';var client=require('../client');exports[_0xaaf5('0x0')]=function(_0x4f294c,_0x6e13c){return client[_0xaaf5('0x1')](_0xaaf5('0x2'),{'body':_0x6e13c,'options':{'where':{'id':_0x4f294c}},'log':_0xaaf5('0x3')});};exports[_0xaaf5('0x4')]=function(_0x277e58,_0x2f9a11){return client[_0xaaf5('0x1')]('AddTagsToSmsInteraction',{'body':_0x2f9a11,'options':{'where':{'id':_0x277e58}},'log':_0xaaf5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7ed2f0c..0a65e81 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 _0xec7c=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x4cb6d0,_0x58e0ab){var _0xcf5c2f=function(_0x2967a){while(--_0x2967a){_0x4cb6d0['push'](_0x4cb6d0['shift']());}};_0xcf5c2f(++_0x58e0ab);}(_0xec7c,0x1e5));var _0xcec7=function(_0x3d4b6a,_0x42a23e){_0x3d4b6a=_0x3d4b6a-0x0;var _0x2c124a=_0xec7c[_0x3d4b6a];return _0x2c124a;};'use strict';var client=require(_0xcec7('0x0'));exports[_0xcec7('0x1')]=function(_0x573c59){return client[_0xcec7('0x2')](_0xcec7('0x3'),{'body':_0x573c59,'log':_0xcec7('0x4')});}; \ No newline at end of file +var _0x143d=['../client','create','Request','CreateSmsMessage'];(function(_0x4fd42b,_0x588cac){var _0xb47bb2=function(_0x3dad91){while(--_0x3dad91){_0x4fd42b['push'](_0x4fd42b['shift']());}};_0xb47bb2(++_0x588cac);}(_0x143d,0x1ec));var _0xd143=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0x143d[_0x404eed];return _0xd45887;};'use strict';var client=require(_0xd143('0x0'));exports[_0xd143('0x1')]=function(_0x1d7c3f){return client[_0xd143('0x2')](_0xd143('0x3'),{'body':_0x1d7c3f,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9bec3a4..44456d2 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x222c93,_0x48b4cc){var _0x30ee50=function(_0x49e772){while(--_0x49e772){_0x222c93['push'](_0x222c93['shift']());}};_0x30ee50(++_0x48b4cc);}(_0x70e0,0x17b));var _0x070e=function(_0x183060,_0x273171){_0x183060=_0x183060-0x0;var _0x3d6b5a=_0x70e0[_0x183060];return _0x3d6b5a;};'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 +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x5e641f,_0x2d6a1a){var _0x25032b=function(_0x43fb7a){while(--_0x43fb7a){_0x5e641f['push'](_0x5e641f['shift']());}};_0x25032b(++_0x2d6a1a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index d7c59a4..cd32316 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0xedd9,0xfc));var _0x9edd=function(_0x5cf30b,_0x41598f){_0x5cf30b=_0x5cf30b-0x0;var _0xe6f60=_0xedd9[_0x5cf30b];return _0xe6f60;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x53ab60,_0x43b6c3){var _0x5eb6e0=function(_0x564bb4){while(--_0x564bb4){_0x53ab60['push'](_0x53ab60['shift']());}};_0x5eb6e0(++_0x43b6c3);}(_0x3e74,0x175));var _0x43e7=function(_0x1228ed,_0x4117ba){_0x1228ed=_0x1228ed-0x0;var _0x105db3=_0x3e74[_0x1228ed];return _0x105db3;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6b2dcbf..0205d3d 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(_0xbb298a,_0x5609de){var _0x4bfc4f=function(_0x3f84ab){while(--_0x3f84ab){_0xbb298a['push'](_0xbb298a['shift']());}};_0x4bfc4f(++_0x5609de);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x494a8f,_0x2325ce){var _0x102a61=function(_0x2952f6){while(--_0x2952f6){_0x494a8f['push'](_0x494a8f['shift']());}};_0x102a61(++_0x2325ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 4c73fb8..9c31557 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 _0x9f02=['addTags','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x9f02,0x68));var _0x29f0=function(_0x3cf307,_0xfb7f18){_0x3cf307=_0x3cf307-0x0;var _0x1fcbce=_0x9f02[_0x3cf307];return _0x1fcbce;};'use strict';var client=require(_0x29f0('0x0'));exports['update']=function(_0x51f5c2,_0x4bb7b2){return client[_0x29f0('0x1')](_0x29f0('0x2'),{'body':_0x4bb7b2,'options':{'where':{'id':_0x51f5c2}},'log':_0x29f0('0x3')});};exports[_0x29f0('0x4')]=function(_0x1a49c1,_0x47e569){return client[_0x29f0('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x47e569,'options':{'where':{'id':_0x1a49c1}},'log':_0x29f0('0x5')});}; \ No newline at end of file +var _0xef66=['addTagsToWhatsappInteraction','../client','update','Request','addTags','AddTagsToWhatsappInteraction'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0xef66,0x1db));var _0x6ef6=function(_0x43ef3e,_0x1f0f94){_0x43ef3e=_0x43ef3e-0x0;var _0x169e3e=_0xef66[_0x43ef3e];return _0x169e3e;};'use strict';var client=require(_0x6ef6('0x0'));exports[_0x6ef6('0x1')]=function(_0x123d45,_0x4fceec){return client[_0x6ef6('0x2')]('UpdateWhatsappInteraction',{'body':_0x4fceec,'options':{'where':{'id':_0x123d45}},'log':'updateWhatsappInteraction'});};exports[_0x6ef6('0x3')]=function(_0x2443db,_0x337718){return client[_0x6ef6('0x2')](_0x6ef6('0x4'),{'body':_0x337718,'options':{'where':{'id':_0x2443db}},'log':_0x6ef6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2a8e57e..554abf6 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 _0xe4b4=['../client','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x403c8d,_0x5e3825){var _0x4ca60d=function(_0x9326c1){while(--_0x9326c1){_0x403c8d['push'](_0x403c8d['shift']());}};_0x4ca60d(++_0x5e3825);}(_0xe4b4,0x178));var _0x4e4b=function(_0x171bff,_0x192cb0){_0x171bff=_0x171bff-0x0;var _0x4ac85b=_0xe4b4[_0x171bff];return _0x4ac85b;};'use strict';var client=require(_0x4e4b('0x0'));exports['create']=function(_0x5c18db){return client[_0x4e4b('0x1')](_0x4e4b('0x2'),{'body':_0x5c18db,'log':_0x4e4b('0x3')});}; \ No newline at end of file +var _0x1bdb=['../client','create','Request','CreateWhatsappMessage'];(function(_0x24e64f,_0xf71a4){var _0x26ce28=function(_0x59e33f){while(--_0x59e33f){_0x24e64f['push'](_0x24e64f['shift']());}};_0x26ce28(++_0xf71a4);}(_0x1bdb,0xf4));var _0xb1bd=function(_0x25487d,_0x2235a4){_0x25487d=_0x25487d-0x0;var _0x581ee4=_0x1bdb[_0x25487d];return _0x581ee4;};'use strict';var client=require(_0xb1bd('0x0'));exports[_0xb1bd('0x1')]=function(_0x3de80d){return client[_0xb1bd('0x2')](_0xb1bd('0x3'),{'body':_0x3de80d,'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 27d1630..e1771c4 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 _0xe9c7=['GetWhatsappQueue','name','timeout','strategy','Agents','whatsappPause','getWhatsappQueues','../client','Request'];(function(_0x828c9c,_0x3ab7b2){var _0x375a9a=function(_0x2f1da5){while(--_0x2f1da5){_0x828c9c['push'](_0x828c9c['shift']());}};_0x375a9a(++_0x3ab7b2);}(_0xe9c7,0xdf));var _0x7e9c=function(_0x53e0b1,_0x3ff1df){_0x53e0b1=_0x53e0b1-0x0;var _0x435d05=_0xe9c7[_0x53e0b1];return _0x435d05;};'use strict';var client=require(_0x7e9c('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x7e9c('0x1')](_0x7e9c('0x2'),{'options':{'raw':![],'attributes':['id',_0x7e9c('0x3'),_0x7e9c('0x4'),_0x7e9c('0x5')],'include':[{'model':'User','as':_0x7e9c('0x6'),'attributes':['id',_0x7e9c('0x3'),'online',_0x7e9c('0x7')]}]},'log':_0x7e9c('0x8')});};}; \ No newline at end of file +var _0x6dca=['whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout','User','Agents','online'];(function(_0x220036,_0x31d57e){var _0x1b0a06=function(_0x5305ce){while(--_0x5305ce){_0x220036['push'](_0x220036['shift']());}};_0x1b0a06(++_0x31d57e);}(_0x6dca,0xa2));var _0xa6dc=function(_0x488c38,_0x382a0c){_0x488c38=_0x488c38-0x0;var _0x55d94b=_0x6dca[_0x488c38];return _0x55d94b;};'use strict';var client=require(_0xa6dc('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xa6dc('0x1')](_0xa6dc('0x2'),{'options':{'raw':![],'attributes':['id',_0xa6dc('0x3'),_0xa6dc('0x4'),'strategy'],'include':[{'model':_0xa6dc('0x5'),'as':_0xa6dc('0x6'),'attributes':['id',_0xa6dc('0x3'),_0xa6dc('0x7'),_0xa6dc('0x8')]}]},'log':_0xa6dc('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3961ffc..c4b33a5 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 _0xad25=['../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad25,0x82));var _0x5ad2=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xad25[_0xbd08b4];return _0x314f1e;};'use strict';var client=require(_0x5ad2('0x0'));exports['create']=function(_0x24b5b1){return client[_0x5ad2('0x1')](_0x5ad2('0x2'),{'body':_0x24b5b1,'log':'CreateWhatsappQueueReport'});};exports[_0x5ad2('0x3')]=function(_0x223c8d,_0x28b1ce){return client[_0x5ad2('0x1')](_0x5ad2('0x4'),{'body':_0x28b1ce,'options':{'where':{'uniqueid':_0x223c8d},'order':[['id','DESC']],'limit':0x1},'log':_0x5ad2('0x4')});}; \ No newline at end of file +var _0x2486=['create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0x4c9447,_0x4696fd){var _0x32f0e6=function(_0x3c85aa){while(--_0x3c85aa){_0x4c9447['push'](_0x4c9447['shift']());}};_0x32f0e6(++_0x4696fd);}(_0x2486,0x15e));var _0x6248=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2486[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x6248('0x0')]=function(_0x40acf4){return client['Request'](_0x6248('0x1'),{'body':_0x40acf4,'log':'CreateWhatsappQueueReport'});};exports[_0x6248('0x2')]=function(_0x3d2960,_0x1e473c){return client[_0x6248('0x3')]('UpdateWhatsappQueueReport',{'body':_0x1e473c,'options':{'where':{'uniqueid':_0x3d2960},'order':[['id','DESC']],'limit':0x1},'log':_0x6248('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 5c03330..b2b9617 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 _0xef8b=['toLowerCase','consequence','length','map','message','stop','find','timeout','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','util','../../../../config/logger','routing','./strategy','timeout\x20is\x20a\x20number','info','format','name'];(function(_0x128cde,_0x210399){var _0x581f0f=function(_0xebf685){while(--_0xebf685){_0x128cde['push'](_0x128cde['shift']());}};_0x581f0f(++_0x210399);}(_0xef8b,0x19b));var _0xbef8=function(_0x4eb662,_0x540e40){_0x4eb662=_0x4eb662-0x0;var _0x2d7889=_0xef8b[_0x4eb662];return _0x2d7889;};'use strict';var schema=require(_0xbef8('0x0'));var _=require('lodash');var util=require(_0xbef8('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xbef8('0x2'))(_0xbef8('0x3'));var strategy=require(_0xbef8('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xbef8('0x5')}});function writeLog(_0x430cfa,_0x2514a9,_0x31ff75){return logger[_0xbef8('0x6')](util[_0xbef8('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x430cfa,_0x2514a9[_0xbef8('0x8')],_0x31ff75));}function handleFindAgent(_0x2e1a4c){return function(_0x339eb7){return _0x339eb7['name']['toLowerCase']()===_0x2e1a4c[_0xbef8('0x9')]();};}exports[_0xbef8('0xa')]=function(_0x3b3cd2,_0x198b31,_0x30080a,_0x50d550){return function(_0xe1728e){try{var _0x1dac5c={'name':_0x198b31[0x0],'timeout':_0x198b31[0x1]};var _0x6fc4b0=queue[_0xbef8('0x0')](_0x1dac5c,{'typecast':!![]});if(_0x6fc4b0[_0xbef8('0xb')]){logger['error']('[%s][AGENT]\x20%s',_0x3b3cd2,_[_0xbef8('0xc')](_0x6fc4b0,_0xbef8('0xd'))['join'](',\x20'));_0xe1728e[_0xbef8('0xe')]();}else{var _0x17a1cb=_[_0xbef8('0xf')](_0x30080a['agents'],handleFindAgent(_0x1dac5c['name']));if(_0x17a1cb){var _0x380a22=(_0x1dac5c[_0xbef8('0x10')]||0xa)*0x3e8;var _0x5c8fa6,_0x2e84d9;var _0x559685=seqqueue['createQueue'](_0x380a22);_0x559685['id']=_0x3b3cd2;_0x559685[_0xbef8('0x11')]=_0x380a22;_0x559685['channel']=_0x50d550[_0xbef8('0x12')];writeLog(_0x3b3cd2,_0x17a1cb,util['format']('START:%s',_0x380a22));_0x30080a[_0xbef8('0x13')][_0x3b3cd2]['on'](_0xbef8('0x14'),function(){logger[_0xbef8('0x6')](_0xbef8('0x15'),_0x3b3cd2);clearTimeout(_0x2e84d9);_0x2e84d9=undefined;_0x559685[_0xbef8('0x16')]();if(_0x30080a['rules'][_0x3b3cd2]){delete _0x30080a[_0xbef8('0x13')][_0x3b3cd2];}_0xe1728e[_0xbef8('0xe')]();});_0x30080a[_0xbef8('0x13')][_0x3b3cd2]['on'](_0xbef8('0x17'),function(){if(_0x30080a[_0xbef8('0x13')][_0x3b3cd2]){delete _0x30080a[_0xbef8('0x13')][_0x3b3cd2];}});_0x2e84d9=setTimeout(function(){logger[_0xbef8('0x6')](_0xbef8('0x18'),_0x3b3cd2);clearTimeout(_0x2e84d9);_0x559685[_0xbef8('0x16')]();_0xe1728e[_0xbef8('0x19')]();},_0x380a22);strategy['agent'](_0x559685,_0x17a1cb,_0x30080a,_0x50d550);}else{logger[_0xbef8('0x1a')](_0xbef8('0x1b'),_0x3b3cd2,_0x1dac5c[_0xbef8('0x8')]);_0xe1728e['stop']();}}}catch(_0x5730fb){console[_0xbef8('0x1c')](_0x5730fb);logger[_0xbef8('0x1a')]('[%s][QUEUE]\x20%s',_0x3b3cd2,_0x5730fb[_0xbef8('0x1d')]);_0xe1728e['stop']();}};}; \ No newline at end of file +var _0x288f=['[%s][AGENT]\x20%s','map','message','join','stop','agents','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','log','[%s][QUEUE]\x20%s','util','routing','./strategy','string','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error'];(function(_0x27ab1d,_0x1afd1d){var _0x9c3eb2=function(_0x3382f1){while(--_0x3382f1){_0x27ab1d['push'](_0x27ab1d['shift']());}};_0x9c3eb2(++_0x1afd1d);}(_0x288f,0x8b));var _0xf288=function(_0x49b60c,_0x2dc35a){_0x49b60c=_0x49b60c-0x0;var _0x1b6d91=_0x288f[_0x49b60c];return _0x1b6d91;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xf288('0x0'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xf288('0x1'));var strategy=require(_0xf288('0x2'));var queue=schema({'name':{'type':_0xf288('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf288('0x4'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x3c68d5,_0x5956b5,_0x2f258a){return logger['info'](util[_0xf288('0x5')](_0xf288('0x6'),_0x3c68d5,_0x5956b5[_0xf288('0x7')],_0x2f258a));}function handleFindAgent(_0x1f94cd){return function(_0x4a194e){return _0x4a194e[_0xf288('0x7')][_0xf288('0x8')]()===_0x1f94cd[_0xf288('0x8')]();};}exports[_0xf288('0x9')]=function(_0xe991cc,_0x113d76,_0x3dfea8,_0x3369ba){return function(_0x5881f5){try{var _0x2e5a5e={'name':_0x113d76[0x0],'timeout':_0x113d76[0x1]};var _0x7f6c33=queue['validate'](_0x2e5a5e,{'typecast':!![]});if(_0x7f6c33['length']){logger[_0xf288('0xa')](_0xf288('0xb'),_0xe991cc,_[_0xf288('0xc')](_0x7f6c33,_0xf288('0xd'))[_0xf288('0xe')](',\x20'));_0x5881f5[_0xf288('0xf')]();}else{var _0x41a49e=_['find'](_0x3dfea8[_0xf288('0x10')],handleFindAgent(_0x2e5a5e[_0xf288('0x7')]));if(_0x41a49e){var _0x2ac2c0=(_0x2e5a5e['timeout']||0xa)*0x3e8;var _0x296b5b,_0x9b436;var _0x5eb598=seqqueue[_0xf288('0x11')](_0x2ac2c0);_0x5eb598['id']=_0xe991cc;_0x5eb598[_0xf288('0x12')]=_0x2ac2c0;_0x5eb598[_0xf288('0x13')]=_0x3369ba[_0xf288('0x13')];writeLog(_0xe991cc,_0x41a49e,util[_0xf288('0x5')](_0xf288('0x14'),_0x2ac2c0));_0x3dfea8[_0xf288('0x15')][_0xe991cc]['on'](_0xf288('0x16'),function(){logger[_0xf288('0x17')](_0xf288('0x18'),_0xe991cc);clearTimeout(_0x9b436);_0x9b436=undefined;_0x5eb598[_0xf288('0x19')]();if(_0x3dfea8[_0xf288('0x15')][_0xe991cc]){delete _0x3dfea8[_0xf288('0x15')][_0xe991cc];}_0x5881f5[_0xf288('0xf')]();});_0x3dfea8[_0xf288('0x15')][_0xe991cc]['on']('complete',function(){if(_0x3dfea8[_0xf288('0x15')][_0xe991cc]){delete _0x3dfea8[_0xf288('0x15')][_0xe991cc];}});_0x9b436=setTimeout(function(){logger[_0xf288('0x17')](_0xf288('0x1a'),_0xe991cc);clearTimeout(_0x9b436);_0x5eb598['close']();_0x5881f5[_0xf288('0x1b')]();},_0x2ac2c0);strategy['agent'](_0x5eb598,_0x41a49e,_0x3dfea8,_0x3369ba);}else{logger[_0xf288('0xa')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0xe991cc,_0x2e5a5e[_0xf288('0x7')]);_0x5881f5[_0xf288('0xf')]();}}}catch(_0xd00611){console[_0xf288('0x1c')](_0xd00611);logger[_0xf288('0xa')](_0xf288('0x1d'),_0xe991cc,_0xd00611['stack']);_0x5881f5[_0xf288('0xf')]();}};}; \ 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 3056710..6c21e7d 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 _0x308c=['amazonlex','providerName','providerResponse','Message','dialogState','Failed','stringify','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','ChatWebsiteId','account','AccountId','upperFirst','created','body','getMustacheRender','create','then','catch','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText'];(function(_0x1ad87,_0xbf0041){var _0x5c5635=function(_0x52483f){while(--_0x52483f){_0x1ad87['push'](_0x1ad87['shift']());}};_0x5c5635(++_0xbf0041);}(_0x308c,0x149));var _0xc308=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x308c[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xc308('0x0'));var moment=require('moment');var AWS=require(_0xc308('0x1'));var utils=require('./utils');var logger=require(_0xc308('0x2'))(_0xc308('0x3'));var rpc={'chatMessage':require(_0xc308('0x4')),'openchannelMessage':require(_0xc308('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc308('0x6'))};exports[_0xc308('0x7')]=function(_0x212f78,_0x1809d0){return function(_0x315425){try{if(!_['isNil'](this[_0xc308('0x8')][_0xc308('0x9')])){logger[_0xc308('0xa')](_0xc308('0xb'),_0x212f78,_0xc308('0xc'));return _0x315425[_0xc308('0xd')]();}var _0x5df6b4={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc308('0xe')](_0xc308('0xf')),'direction':_0xc308('0x10')};if(this['channel']===_0xc308('0x11')||this[_0xc308('0x12')]==='whatsapp'){_0x5df6b4[_0xc308('0x13')]=this[_0xc308('0x8')][_0xc308('0x13')];}var _0x5bf0ee=this['channel'];if(_0x5bf0ee==='chat'){_0x5df6b4[_0xc308('0x14')]=this[_0xc308('0x15')]['id'];}else{_0x5df6b4[_['upperFirst'](_0x5bf0ee)+_0xc308('0x16')]=this['account']['id'];}_0x5df6b4[_[_0xc308('0x17')](_0x5bf0ee)+'InteractionId']=this[_0xc308('0x8')]['id'];if(this[_0xc308('0x8')][_0xc308('0x18')]){var _0x2852b9=_0x1809d0[0x4];if(!_['isEmpty'](_0x2852b9)){_0x5df6b4[_0xc308('0x19')]=utils[_0xc308('0x1a')](_0x2852b9,this);return rpc[_0x5bf0ee+'Message'][_0xc308('0x1b')](_0x5df6b4)[_0xc308('0x1c')](function(_0xfdce7a){logger[_0xc308('0xa')](_0xc308('0xb'),_0x212f78,_0x5df6b4[_0xc308('0x19')]);})[_0xc308('0x1d')](function(_0x33f9c5){logger[_0xc308('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x212f78,JSON['stringify'](_0x33f9c5));})[_0xc308('0x1f')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x212f78);_0x315425[_0xc308('0x20')]();});}else{logger[_0xc308('0xa')](_0xc308('0x21'),_0x212f78);_0x315425[_0xc308('0x20')]();}}else{var _0x489a41=this;var _0x3bce1e=new AWS[(_0xc308('0x22'))]({'accessKeyId':_0x1809d0[0x0],'secretAccessKey':_0x1809d0[0x1],'region':_0x1809d0[0x2]});var _0x14c241={'botAlias':_0xc308('0x23'),'botName':_0x1809d0[0x3],'inputText':this[_0xc308('0x24')][_0xc308('0x19')],'userId':this['channel']+':'+this[_0xc308('0x8')]['id'][_0xc308('0x25')]()};_0x3bce1e[_0xc308('0x26')](_0x14c241,function(_0x1de791,_0x4bb689){if(_0x1de791){logger[_0xc308('0x1e')](_0xc308('0xb'),_0x212f78,_0x1de791['message']);_0x315425[_0xc308('0xd')]();}else if(_0x4bb689&&_0x4bb689[_0xc308('0x24')]){_0x489a41[_0xc308('0x19')][_0xc308('0x27')]=_0x4bb689;_0x5df6b4[_0xc308('0x19')]=_0x4bb689[_0xc308('0x24')];_0x5df6b4[_0xc308('0x28')]=_0xc308('0x27');_0x5df6b4[_0xc308('0x29')]=JSON['stringify'](_0x4bb689);return rpc[_0x5bf0ee+_0xc308('0x2a')]['create'](_0x5df6b4)[_0xc308('0x1c')](function(_0x3e6043){logger[_0xc308('0xa')](_0xc308('0xb'),_0x212f78,_0x5df6b4[_0xc308('0x19')]);if(_0x4bb689[_0xc308('0x2b')]==_0xc308('0x2c')){_0x315425[_0xc308('0xd')]();}else{_0x315425[_0xc308('0x20')]();}})['catch'](function(_0x26a46e){logger['error'](_0xc308('0xb'),_0x212f78,JSON['stringify'](_0x26a46e));_0x315425[_0xc308('0xd')]();});}else{_0x315425[_0xc308('0xd')]();}});}}catch(_0x3f258e){logger['error'](_0xc308('0xb'),_0x212f78,JSON[_0xc308('0x2d')](_0x3f258e));_0x315425['stop']();}};}; \ No newline at end of file +var _0x093e=['finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','amazonlex','providerResponse','Message','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','create','then','catch','error','stringify'];(function(_0x593bca,_0x1b226e){var _0x279ebb=function(_0x138bf6){while(--_0x138bf6){_0x593bca['push'](_0x593bca['shift']());}};_0x279ebb(++_0x1b226e);}(_0x093e,0x1d8));var _0xe093=function(_0x39da12,_0x2365e3){_0x39da12=_0x39da12-0x0;var _0x3c68a3=_0x093e[_0x39da12];return _0x3c68a3;};'use strict';var _=require(_0xe093('0x0'));var moment=require(_0xe093('0x1'));var AWS=require(_0xe093('0x2'));var utils=require(_0xe093('0x3'));var logger=require(_0xe093('0x4'))(_0xe093('0x5'));var rpc={'chatMessage':require(_0xe093('0x6')),'openchannelMessage':require(_0xe093('0x7')),'mailMessage':require(_0xe093('0x8')),'smsMessage':require(_0xe093('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0xf905d3,_0x8dad9){return function(_0x2cbc90){try{if(!_[_0xe093('0xa')](this[_0xe093('0xb')][_0xe093('0xc')])){logger[_0xe093('0xd')](_0xe093('0xe'),_0xf905d3,_0xe093('0xf'));return _0x2cbc90[_0xe093('0x10')]();}var _0x39243d={'ContactId':this[_0xe093('0x11')]['id'],'sentAt':moment()[_0xe093('0x12')](_0xe093('0x13')),'direction':_0xe093('0x14')};if(this['channel']===_0xe093('0x15')||this[_0xe093('0x16')]===_0xe093('0x17')){_0x39243d[_0xe093('0x18')]=this[_0xe093('0xb')][_0xe093('0x18')];}var _0x5cb6b8=this['channel'];if(_0x5cb6b8===_0xe093('0x19')){_0x39243d['ChatWebsiteId']=this[_0xe093('0x1a')]['id'];}else{_0x39243d[_[_0xe093('0x1b')](_0x5cb6b8)+_0xe093('0x1c')]=this[_0xe093('0x1a')]['id'];}_0x39243d[_[_0xe093('0x1b')](_0x5cb6b8)+'InteractionId']=this[_0xe093('0xb')]['id'];if(this[_0xe093('0xb')][_0xe093('0x1d')]){var _0x19ebb6=_0x8dad9[0x4];if(!_[_0xe093('0x1e')](_0x19ebb6)){_0x39243d[_0xe093('0x1f')]=utils[_0xe093('0x20')](_0x19ebb6,this);return rpc[_0x5cb6b8+'Message'][_0xe093('0x21')](_0x39243d)[_0xe093('0x22')](function(_0x290bfa){logger[_0xe093('0xd')]('[%s][AMAZONLEX]\x20%s',_0xf905d3,_0x39243d[_0xe093('0x1f')]);})[_0xe093('0x23')](function(_0x3c2a4e){logger[_0xe093('0x24')](_0xe093('0xe'),_0xf905d3,JSON[_0xe093('0x25')](_0x3c2a4e));})[_0xe093('0x26')](function(){logger[_0xe093('0xd')](_0xe093('0x27'),_0xf905d3);_0x2cbc90[_0xe093('0x28')]();});}else{logger[_0xe093('0xd')](_0xe093('0x29'),_0xf905d3);_0x2cbc90[_0xe093('0x28')]();}}else{var _0x29d883=this;var _0x9e6107=new AWS[(_0xe093('0x2a'))]({'accessKeyId':_0x8dad9[0x0],'secretAccessKey':_0x8dad9[0x1],'region':_0x8dad9[0x2]});var _0x30a878={'botAlias':_0xe093('0x2b'),'botName':_0x8dad9[0x3],'inputText':this[_0xe093('0x2c')]['body'],'userId':this[_0xe093('0x16')]+':'+this[_0xe093('0xb')]['id']['toString']()};_0x9e6107[_0xe093('0x2d')](_0x30a878,function(_0x15d20b,_0x179ca0){if(_0x15d20b){logger['error'](_0xe093('0xe'),_0xf905d3,_0x15d20b['message']);_0x2cbc90[_0xe093('0x10')]();}else if(_0x179ca0&&_0x179ca0[_0xe093('0x2c')]){_0x29d883[_0xe093('0x1f')][_0xe093('0x2e')]=_0x179ca0;_0x39243d['body']=_0x179ca0['message'];_0x39243d['providerName']='amazonlex';_0x39243d[_0xe093('0x2f')]=JSON['stringify'](_0x179ca0);return rpc[_0x5cb6b8+_0xe093('0x30')]['create'](_0x39243d)[_0xe093('0x22')](function(_0xbcbcc1){logger[_0xe093('0xd')](_0xe093('0xe'),_0xf905d3,_0x39243d[_0xe093('0x1f')]);if(_0x179ca0[_0xe093('0x31')]==_0xe093('0x32')){_0x2cbc90['next']();}else{_0x2cbc90['stop']();}})[_0xe093('0x23')](function(_0x55dc43){logger[_0xe093('0x24')](_0xe093('0xe'),_0xf905d3,JSON[_0xe093('0x25')](_0x55dc43));_0x2cbc90[_0xe093('0x10')]();});}else{_0x2cbc90[_0xe093('0x10')]();}});}}catch(_0x30bc10){logger['error'](_0xe093('0xe'),_0xf905d3,JSON[_0xe093('0x25')](_0x30bc10));_0x2cbc90[_0xe093('0x28')]();}};}; \ 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 e471b63..640098d 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 _0x31c3=['isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','subject','Re:','Re:\x20','ChatWebsiteId','account','AccountId','upperFirst','Message','inReplyTo','messageId','html','replace',''+_[_0x331c('0x2e')](_0x158bdd[_0x331c('0x11')],_0x331c('0x2f'),_0x331c('0x30'))+'';_0x158bdd[_0x331c('0x31')]={'Auto-Submitted':_0x331c('0x32'),'X-Auto-Response-Suppress':_0x331c('0x33'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x331c('0x27')]['smtpOptions'],_0x158bdd)[_0x331c('0x34')](function(_0x354659){logger[_0x331c('0x13')](_0x331c('0x35'),_0x33bf63);_0x158bdd['messageId']=_0x354659[_0x331c('0x21')]['messageId'];return rpc[_0xb774c1+_0x331c('0x2a')]['create'](_0x158bdd);})[_0x331c('0x34')](function(_0x24c377){logger[_0x331c('0x13')](_0x331c('0x14'),_0x33bf63,JSON['stringify'](_0x24c377));})[_0x331c('0x36')](function(_0x1d4ab3){logger[_0x331c('0x37')](_0x331c('0x38'),_0x33bf63,JSON[_0x331c('0x39')](_0x1d4ab3));})[_0x331c('0x3a')](function(){Promise['resolve']()['then'](function(){if(_0x768252[0x0]!=='2'||_0x3a218e[_0x331c('0x1b')])return;return rpc[_0xb774c1+'Interaction'][_0x331c('0x3b')](_0x3a218e['id'],{'autoreplyExecuted':!![]})['then'](function(_0x5435f9){logger[_0x331c('0x13')](_0x331c('0x3c'),_0x33bf63,JSON[_0x331c('0x39')](_0x5435f9));})[_0x331c('0x36')](function(_0x131fe4){logger[_0x331c('0x37')](_0x331c('0x3d'),_0x33bf63,JSON[_0x331c('0x39')](_0x131fe4));});})[_0x331c('0x34')](function(){_0x5bdefd[_0x331c('0x16')]();});});}else{return rpc[this[_0x331c('0xf')]+_0x331c('0x2a')][_0x331c('0x3e')](_0x158bdd)[_0x331c('0x34')](function(){logger[_0x331c('0x13')](_0x331c('0x14'),_0x33bf63,_0x158bdd[_0x331c('0x11')]);})['catch'](function(_0x10cc81){logger[_0x331c('0x37')](_0x331c('0x14'),_0x33bf63,JSON['stringify'](_0x10cc81));})['finally'](function(){Promise[_0x331c('0x3f')]()['then'](function(){if(_0x768252[0x0]!=='2'||_0x3a218e[_0x331c('0x1b')])return;return rpc[_0xb774c1+_0x331c('0x40')][_0x331c('0x3b')](_0x3a218e['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1bb4fd){logger[_0x331c('0x13')](_0x331c('0x3c'),_0x33bf63,JSON['stringify'](_0x1bb4fd));})[_0x331c('0x36')](function(_0x2580bb){logger[_0x331c('0x37')](_0x331c('0x3d'),_0x33bf63,JSON['stringify'](_0x2580bb));});})[_0x331c('0x34')](function(){_0x5bdefd[_0x331c('0x16')]();});});}}}catch(_0x13cd63){logger['error']('[%s][AUTOREPLY]\x20%s',_0x33bf63,JSON['stringify'](_0x13cd63));_0x5bdefd[_0x331c('0x41')]();}};}; \ No newline at end of file +var _0x05d5=['create','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Message','error','stop','lodash','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','from','message','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','InteractionId','inReplyTo','messageId','','headers','auto-replied','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT'];(function(_0x5a68d0,_0x2df46b){var _0x357909=function(_0x882c0a){while(--_0x882c0a){_0x5a68d0['push'](_0x5a68d0['shift']());}};_0x357909(++_0x2df46b);}(_0x05d5,0x152));var _0x505d=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x05d5[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x505d('0x0'));var moment=require('moment');var utils=require(_0x505d('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x505d('0x2')),'mailMessage':require(_0x505d('0x3')),'smsMessage':require(_0x505d('0x4')),'faxMessage':require(_0x505d('0x5')),'whatsappMessage':require(_0x505d('0x6')),'chatInteraction':require(_0x505d('0x7')),'openchannelInteraction':require(_0x505d('0x8')),'mailInteraction':require(_0x505d('0x9')),'smsInteraction':require(_0x505d('0xa')),'faxInteraction':require(_0x505d('0xb')),'whatsappInteraction':require(_0x505d('0xc'))};var mailRpc=require(_0x505d('0xd'));exports[_0x505d('0xe')]=function(_0x2ff401,_0x2313a9,_0x203a29,_0x28ea4b){return function(_0x40accf){try{var _0x5c741a=this['channel'];if(_0x5c741a===_0x505d('0xf')&&_0x28ea4b[_0x505d('0x10')]['isAutoreply']){logger[_0x505d('0x11')](_0x505d('0x12'),_0x2ff401,_0x505d('0x13'));return _0x40accf[_0x505d('0x14')]();}if(_0x2313a9[0x0]==='1'&&(_[_0x505d('0x15')](this[_0x505d('0x16')]['created'])||!this['interaction']['created'])){logger[_0x505d('0x11')](_0x505d('0x12'),_0x2ff401,_0x505d('0x17'));return _0x40accf[_0x505d('0x14')]();}if(_0x2313a9[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x505d('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2ff401,_0x505d('0x18'));return _0x40accf[_0x505d('0x14')]();}var _0x12a875={'ContactId':this[_0x505d('0x19')]['id'],'sentAt':moment()['format'](_0x505d('0x1a')),'direction':_0x505d('0x1b')};if(this[_0x505d('0x1c')]===_0x505d('0xf')){_0x12a875[_0x505d('0x10')]=utils['getMustacheRender'](_0x2313a9[0x2],this);}else{_0x12a875[_0x505d('0x10')]=utils[_0x505d('0x1d')](_0x2313a9[0x1],this);}if(this['message']){_0x12a875['to']=this['message'][_0x505d('0x1e')]||'';if(this['channel']==='mail'&&_0x2313a9[0x1]==='1'){_0x12a875['cc']=this['message']['cc']||'';}_0x12a875[_0x505d('0x1e')]=this['message']['to']||'';_0x12a875['phone']=this[_0x505d('0x1f')][_0x505d('0x20')]||'';_0x12a875[_0x505d('0x21')]=!![];if(this[_0x505d('0x1f')][_0x505d('0x22')]){_0x12a875[_0x505d('0x22')]='';_0x12a875['subject']+=_[_0x505d('0x23')](this[_0x505d('0x1f')][_0x505d('0x22')],_0x505d('0x24'))?'':_0x505d('0x25');_0x12a875[_0x505d('0x22')]+=this[_0x505d('0x1f')][_0x505d('0x22')];}}if(this['channel']==='chat'){_0x12a875[_0x505d('0x26')]=this[_0x505d('0x27')]['id'];}else{_0x12a875[_['upperFirst'](this['channel'])+'AccountId']=this[_0x505d('0x27')]['id'];}_0x12a875[_[_0x505d('0x28')](this[_0x505d('0x1c')])+_0x505d('0x29')]=this[_0x505d('0x16')]['id'];var _0x5c008f=this[_0x505d('0x16')];if(rpc[this[_0x505d('0x1c')]+'Message']){if(this[_0x505d('0x1c')]===_0x505d('0xf')){_0x12a875[_0x505d('0x2a')]=this[_0x505d('0x1f')][_0x505d('0x2b')];_0x12a875['html']=''+_['replace'](_0x12a875['body'],']+(>|$)/g,''),'priorityTrue':_0x560d5d[0x1],'priorityFalse':_0x560d5d[0x2]};var _0x406ce8=gotoif[_0x64a9('0x0')](_0x49132f,{'typecast':!![]});if(_0x406ce8[_0x64a9('0xc')]){logger[_0x64a9('0xd')](_0x64a9('0xe'),_0x5e8ed8,_[_0x64a9('0xf')](_0x406ce8,_0x64a9('0x10'))[_0x64a9('0x11')](',\x20'));_0x21954f[_0x64a9('0x12')]();}else{try{var _0x88263f=eval('('+_0x49132f[_0x64a9('0x13')]+')');var _0x474fab=_0x88263f?_0x49132f['priorityTrue']:_0x49132f[_0x64a9('0x14')];logger['info'](_0x64a9('0x15'),_0x5e8ed8,_0x49132f[_0x64a9('0x13')],_0x88263f,_0x474fab||_0x64a9('0x16'));if(_0x474fab){var _0x481ee2=_['findIndex'](_0x21954f[_0x64a9('0x17')](),{'p':_0x474fab});if(_0x481ee2>=0x0){logger['info'](_0x64a9('0x18'),_0x5e8ed8,_0x474fab||_0x64a9('0x16'),_0x481ee2);_0x21954f[_0x64a9('0x16')](_0x481ee2);}else{logger[_0x64a9('0x19')](_0x64a9('0x1a'),_0x5e8ed8,_0x474fab||_0x64a9('0x16'));_0x21954f['stop']();}}else{_0x21954f[_0x64a9('0x16')]();}}catch(_0x582c70){logger['error'](_0x64a9('0x1b'),_0x5e8ed8,_0x582c70[_0x64a9('0x10')]);_0x21954f['stop']();}}}catch(_0x26f2c5){logger[_0x64a9('0xd')]('[%s][GOTOIF]\x20%s',_0x5e8ed8,JSON[_0x64a9('0x1c')](_0x26f2c5));_0x21954f[_0x64a9('0x12')]();}};}; \ No newline at end of file +var _0xd759=['condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message'];(function(_0x4edaaa,_0x305da7){var _0x1cc080=function(_0x58cd28){while(--_0x58cd28){_0x4edaaa['push'](_0x4edaaa['shift']());}};_0x1cc080(++_0x305da7);}(_0xd759,0xd7));var _0x9d75=function(_0x1c90a7,_0x115e4d){_0x1c90a7=_0x1c90a7-0x0;var _0x408b33=_0xd759[_0x1c90a7];return _0x408b33;};'use strict';var schema=require(_0x9d75('0x0'));var _=require('lodash');var htmlToText=require(_0x9d75('0x1'));var utils=require(_0x9d75('0x2'));var logger=require(_0x9d75('0x3'))(_0x9d75('0x4'));var gotoif=schema({'condition':{'type':_0x9d75('0x5'),'required':!![],'message':_0x9d75('0x6')},'priorityTrue':{'type':_0x9d75('0x7'),'message':_0x9d75('0x8')},'priorityFalse':{'type':_0x9d75('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x9d75('0x9')]=function(_0x2cc868,_0x517a9d){return function(_0x8fb54c){try{var _0x25f67b={'condition':htmlToText[_0x9d75('0xa')](utils[_0x9d75('0xb')](_0x517a9d[0x0],this),{'wordwrap':![]})[_0x9d75('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x517a9d[0x1],'priorityFalse':_0x517a9d[0x2]};var _0x5408af=gotoif[_0x9d75('0x0')](_0x25f67b,{'typecast':!![]});if(_0x5408af['length']){logger[_0x9d75('0xd')](_0x9d75('0xe'),_0x2cc868,_[_0x9d75('0xf')](_0x5408af,_0x9d75('0x10'))['join'](',\x20'));_0x8fb54c['stop']();}else{try{var _0x35374d=eval('('+_0x25f67b[_0x9d75('0x11')]+')');var _0x4d5629=_0x35374d?_0x25f67b[_0x9d75('0x12')]:_0x25f67b[_0x9d75('0x13')];logger['info'](_0x9d75('0x14'),_0x2cc868,_0x25f67b[_0x9d75('0x11')],_0x35374d,_0x4d5629||_0x9d75('0x15'));if(_0x4d5629){var _0x57dc26=_[_0x9d75('0x16')](_0x8fb54c[_0x9d75('0x17')](),{'p':_0x4d5629});if(_0x57dc26>=0x0){logger[_0x9d75('0x18')](_0x9d75('0x19'),_0x2cc868,_0x4d5629||_0x9d75('0x15'),_0x57dc26);_0x8fb54c[_0x9d75('0x15')](_0x57dc26);}else{logger[_0x9d75('0x18')](_0x9d75('0x1a'),_0x2cc868,_0x4d5629||_0x9d75('0x15'));_0x8fb54c[_0x9d75('0x1b')]();}}else{_0x8fb54c[_0x9d75('0x15')]();}}catch(_0x54d970){logger[_0x9d75('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2cc868,_0x54d970[_0x9d75('0x10')]);_0x8fb54c[_0x9d75('0x1b')]();}}}catch(_0x53d4cf){logger[_0x9d75('0xd')](_0x9d75('0xe'),_0x2cc868,JSON[_0x9d75('0x1c')](_0x53d4cf));_0x8fb54c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 01a5f47..b0b559a 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 _0xa03b=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','info','next'];(function(_0x28ee57,_0x3fa4f9){var _0x2d04a3=function(_0x182ade){while(--_0x182ade){_0x28ee57['push'](_0x28ee57['shift']());}};_0x2d04a3(++_0x3fa4f9);}(_0xa03b,0x167));var _0xba03=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0xa03b[_0x582274];return _0x8f14d3;};'use strict';var schema=require(_0xba03('0x0'));var _=require(_0xba03('0x1'));var logger=require('../../../../config/logger')(_0xba03('0x2'));var gotop=schema({'priority':{'type':_0xba03('0x3'),'required':!![],'message':_0xba03('0x4')}});exports[_0xba03('0x5')]=function(_0x22a46f,_0x56b85b){return function(_0x2143db){try{var _0x10239a={'priority':_0x56b85b[0x0]};var _0x22c077=gotop['validate'](_0x10239a,{'typecast':!![]});if(_0x22c077[_0xba03('0x6')]){logger[_0xba03('0x7')]('[%s][GOTOP]\x20%s',_0x22a46f,_['map'](_0x22c077,'message')[_0xba03('0x8')](',\x20'));_0x2143db[_0xba03('0x9')]();}else{logger['info'](_0xba03('0xa'),_0x22a46f,_0x10239a['priority']);if(_0x10239a[_0xba03('0xb')]){var _0x300a97=_[_0xba03('0xc')](_0x2143db['rules'](),{'p':_0x10239a[_0xba03('0xb')]});if(_0x300a97>=0x0){logger[_0xba03('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x22a46f,_0x10239a[_0xba03('0xb')]||'next',_0x300a97);_0x2143db[_0xba03('0xe')](_0x300a97);}else{logger[_0xba03('0xd')](_0xba03('0xf'),_0x22a46f,_0x10239a[_0xba03('0xb')]||'next');_0x2143db[_0xba03('0x9')]();}}else{_0x2143db[_0xba03('0xe')]();}}}catch(_0x44606a){logger[_0xba03('0x7')]('[%s][GOTOP]\x20%s',_0x22a46f,JSON[_0xba03('0x10')](_0x44606a));_0x2143db[_0xba03('0x9')]();}};}; \ No newline at end of file +var _0x8ec1=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','consequence','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x414c08,_0x20cd6c){var _0xe07d38=function(_0x1ca28b){while(--_0x1ca28b){_0x414c08['push'](_0x414c08['shift']());}};_0xe07d38(++_0x20cd6c);}(_0x8ec1,0xf3));var _0x18ec=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x8ec1[_0x1992f1];return _0x413dfe;};'use strict';var schema=require(_0x18ec('0x0'));var _=require(_0x18ec('0x1'));var logger=require(_0x18ec('0x2'))(_0x18ec('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x18ec('0x4')]=function(_0x3a792a,_0x3077d6){return function(_0x5c6cc8){try{var _0x31c5bb={'priority':_0x3077d6[0x0]};var _0x1382b0=gotop[_0x18ec('0x0')](_0x31c5bb,{'typecast':!![]});if(_0x1382b0['length']){logger[_0x18ec('0x5')](_0x18ec('0x6'),_0x3a792a,_[_0x18ec('0x7')](_0x1382b0,_0x18ec('0x8'))[_0x18ec('0x9')](',\x20'));_0x5c6cc8[_0x18ec('0xa')]();}else{logger[_0x18ec('0xb')](_0x18ec('0xc'),_0x3a792a,_0x31c5bb[_0x18ec('0xd')]);if(_0x31c5bb[_0x18ec('0xd')]){var _0x1ca269=_[_0x18ec('0xe')](_0x5c6cc8[_0x18ec('0xf')](),{'p':_0x31c5bb[_0x18ec('0xd')]});if(_0x1ca269>=0x0){logger[_0x18ec('0xb')](_0x18ec('0x10'),_0x3a792a,_0x31c5bb[_0x18ec('0xd')]||_0x18ec('0x11'),_0x1ca269);_0x5c6cc8[_0x18ec('0x11')](_0x1ca269);}else{logger[_0x18ec('0xb')](_0x18ec('0x12'),_0x3a792a,_0x31c5bb[_0x18ec('0xd')]||_0x18ec('0x11'));_0x5c6cc8[_0x18ec('0xa')]();}}else{_0x5c6cc8['next']();}}}catch(_0x1dfda5){logger[_0x18ec('0x5')](_0x18ec('0x6'),_0x3a792a,JSON[_0x18ec('0x13')](_0x1dfda5));_0x5c6cc8['stop']();}};}; \ 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 4582ec5..5cbd566 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 _0x478a=['error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','chat','upperFirst','AccountId','account','InteractionId','Message','create','info','[%s][MESSAGE]\x20%s','next','catch','stop'];(function(_0x1672f5,_0x2b5931){var _0x45866d=function(_0x26f1fd){while(--_0x26f1fd){_0x1672f5['push'](_0x1672f5['shift']());}};_0x45866d(++_0x2b5931);}(_0x478a,0x19f));var _0xa478=function(_0x4edde1,_0x111eeb){_0x4edde1=_0x4edde1-0x0;var _0x4cca18=_0x478a[_0x4edde1];return _0x4cca18;};'use strict';var _=require('lodash');var utils=require(_0xa478('0x0'));var logger=require(_0xa478('0x1'))(_0xa478('0x2'));var rpc={'chatMessage':require(_0xa478('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa478('0x4')),'smsMessage':require(_0xa478('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xa478('0x6')]=function(_0x442ad5,_0xd36106){return function(_0x256bb7){try{var _0x145724={'body':utils[_0xa478('0x7')](_0xd36106[0x0],this),'ContactId':this[_0xa478('0x8')]['id']};if(this[_0xa478('0x9')]===_0xa478('0xa')){_0x145724['ChatWebsiteId']=this['account']['id'];}else{_0x145724[_[_0xa478('0xb')](this[_0xa478('0x9')])+_0xa478('0xc')]=this[_0xa478('0xd')]['id'];}_0x145724[_['upperFirst'](this[_0xa478('0x9')])+_0xa478('0xe')]=this['interaction']['id'];if(rpc[this[_0xa478('0x9')]+_0xa478('0xf')]){return rpc[this[_0xa478('0x9')]+_0xa478('0xf')][_0xa478('0x10')](_0x145724)['then'](function(_0x1ce012){logger[_0xa478('0x11')](_0xa478('0x12'),_0x442ad5,_0x145724['body']);_0x256bb7[_0xa478('0x13')]();})[_0xa478('0x14')](function(_0x3b8aeb){logger['error'](_0xa478('0x12'),_0x442ad5,JSON['stringify'](_0x3b8aeb));_0x256bb7[_0xa478('0x15')]();});}}catch(_0x5c6c12){logger[_0xa478('0x16')](_0xa478('0x12'),_0x442ad5,JSON['stringify'](_0x5c6c12));_0x256bb7[_0xa478('0x15')]();}};}; \ No newline at end of file +var _0xe19a=['account','upperFirst','AccountId','channel','InteractionId','interaction','Message','create','then','info','error','stringify','stop','[%s][MESSAGE]\x20%s','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','ChatWebsiteId'];(function(_0x1a71d8,_0x8fa51f){var _0x57fe9b=function(_0x5d7725){while(--_0x5d7725){_0x1a71d8['push'](_0x1a71d8['shift']());}};_0x57fe9b(++_0x8fa51f);}(_0xe19a,0xd6));var _0xae19=function(_0x59ffe4,_0x1569ec){_0x59ffe4=_0x59ffe4-0x0;var _0x5e6ad2=_0xe19a[_0x59ffe4];return _0x5e6ad2;};'use strict';var _=require(_0xae19('0x0'));var utils=require('./utils');var logger=require(_0xae19('0x1'))(_0xae19('0x2'));var rpc={'chatMessage':require(_0xae19('0x3')),'openchannelMessage':require(_0xae19('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xae19('0x5')),'faxMessage':require(_0xae19('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xae19('0x7')]=function(_0x2e6abb,_0xdd4649){return function(_0x42bd22){try{var _0x5d8696={'body':utils[_0xae19('0x8')](_0xdd4649[0x0],this),'ContactId':this[_0xae19('0x9')]['id']};if(this['channel']==='chat'){_0x5d8696[_0xae19('0xa')]=this[_0xae19('0xb')]['id'];}else{_0x5d8696[_[_0xae19('0xc')](this['channel'])+_0xae19('0xd')]=this['account']['id'];}_0x5d8696[_[_0xae19('0xc')](this[_0xae19('0xe')])+_0xae19('0xf')]=this[_0xae19('0x10')]['id'];if(rpc[this[_0xae19('0xe')]+'Message']){return rpc[this[_0xae19('0xe')]+_0xae19('0x11')][_0xae19('0x12')](_0x5d8696)[_0xae19('0x13')](function(_0x162095){logger[_0xae19('0x14')]('[%s][MESSAGE]\x20%s',_0x2e6abb,_0x5d8696['body']);_0x42bd22['next']();})['catch'](function(_0x1d2a9a){logger[_0xae19('0x15')]('[%s][MESSAGE]\x20%s',_0x2e6abb,JSON[_0xae19('0x16')](_0x1d2a9a));_0x42bd22[_0xae19('0x17')]();});}}catch(_0x3bf377){logger[_0xae19('0x15')](_0xae19('0x18'),_0x2e6abb,JSON[_0xae19('0x16')](_0x3bf377));_0x42bd22['stop']();}};}; \ 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 8915b7c..06d1875 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 _0xa76e=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x6cf5ec,_0x194d2e){var _0x271c4f=function(_0x206fee){while(--_0x206fee){_0x6cf5ec['push'](_0x6cf5ec['shift']());}};_0x271c4f(++_0x194d2e);}(_0xa76e,0x13c));var _0xea76=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xa76e[_0x4d8a8f];return _0xfc4adc;};'use strict';var utils=require(_0xea76('0x0'));var logger=require(_0xea76('0x1'))(_0xea76('0x2'));exports[_0xea76('0x3')]=function(_0x26e9ea,_0xe5ea19){return function(_0x498571){try{logger[_0xea76('0x4')](_0xea76('0x5'),_0x26e9ea,utils[_0xea76('0x6')](_0xe5ea19[0x0],this));_0x498571[_0xea76('0x7')]();}catch(_0x399299){logger[_0xea76('0x8')](_0xea76('0x5'),_0x26e9ea,JSON[_0xea76('0x9')](_0x399299));_0x498571[_0xea76('0xa')]();}};}; \ No newline at end of file +var _0xfaa5=['routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','../../../../config/logger'];(function(_0x33e982,_0x1d15b1){var _0x2d3668=function(_0x3c16d5){while(--_0x3c16d5){_0x33e982['push'](_0x33e982['shift']());}};_0x2d3668(++_0x1d15b1);}(_0xfaa5,0x157));var _0x5faa=function(_0x4fe496,_0x1d8673){_0x4fe496=_0x4fe496-0x0;var _0x422b24=_0xfaa5[_0x4fe496];return _0x422b24;};'use strict';var utils=require('./utils');var logger=require(_0x5faa('0x0'))(_0x5faa('0x1'));exports[_0x5faa('0x2')]=function(_0xfd469a,_0xb5e509){return function(_0x282ce4){try{logger['info'](_0x5faa('0x3'),_0xfd469a,utils[_0x5faa('0x4')](_0xb5e509[0x0],this));_0x282ce4[_0x5faa('0x5')]();}catch(_0xd28589){logger[_0x5faa('0x6')](_0x5faa('0x3'),_0xfd469a,JSON[_0x5faa('0x7')](_0xd28589));_0x282ce4['stop']();}};}; \ 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 60ce8ac..d888dcb 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 _0x7023=['from','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','join','find','Queues','createQueue','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','stop','validate','lodash','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','socket.io-emitter','queue_id','account','queue','joinAt','emit','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','timeout\x20is\x20a\x20number','waiting','body'];(function(_0x1b2722,_0x4d6069){var _0x37f833=function(_0x554b0a){while(--_0x554b0a){_0x1b2722['push'](_0x1b2722['shift']());}};_0x37f833(++_0x4d6069);}(_0x7023,0x167));var _0x3702=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7023[_0x3bf83f];return _0x22c4a9;};'use strict';var schema=require(_0x3702('0x0'));var _=require(_0x3702('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x3702('0x2'));var Redis=require(_0x3702('0x3'));var config=require(_0x3702('0x4'));var logger=require(_0x3702('0x5'))(_0x3702('0x6'));var strategy=require(_0x3702('0x7'));config[_0x3702('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3702('0x9'))(new Redis(config['redis']));var attributes=['id',_0x3702('0xa'),_0x3702('0xb'),_0x3702('0xc'),'from',_0x3702('0xd')];function emit(_0x1d51f6,_0x1a8120,_0x4212ae){io['to'](_0x1d51f6)[_0x3702('0xe')](_0x1a8120,_0x4212ae);}function emitChannelQueueInteraction(_0x3c4967,_0x2c8846,_0x42ec6f,_0x42ac20,_0x5dc083,_0x161e38,_0x390f15,_0x5c0a13){var _0x3d3f37=_['clone'](_0x42ec6f);_0x3d3f37[_0x3702('0xa')]=_0x5c0a13;_0x3d3f37[_0x3702('0xc')]=_0x2c8846;_0x3d3f37[_0x3702('0xb')]=_0x42ac20;_0x3d3f37['id']=_0x5dc083;if(_0x161e38){attributes['push'](_['capitalize'](_0x3c4967)+'InteractionId');_0x390f15[util['format']('%sQueuesWaitingInteractions',_0x3c4967)][_0x5dc083]=_[_0x3702('0xf')](_0x3d3f37,attributes);}else{delete _0x390f15[util[_0x3702('0x10')](_0x3702('0x11'),_0x3c4967)][_0x5dc083];}emit(util[_0x3702('0x10')](_0x3702('0x12'),_0x3c4967,_0x2c8846),util[_0x3702('0x10')](_0x3702('0x13'),_0x3c4967,_0x161e38?'save':_0x3702('0x14')),_['pick'](_0x3d3f37,attributes));}var rpc={'openchannelQueueReport':require(_0x3702('0x15')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x3702('0x16')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x3702('0x17')),'whatsappQueueReport':require(_0x3702('0x18')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x3702('0x19')),'smsInteraction':require(_0x3702('0x1a')),'whatsappInteraction':require(_0x3702('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x3702('0x1c')}});function startRouting(_0x7da465,_0x183088,_0x309d8c,_0xbde3cb){if(_0x7da465&&_0x183088&&_0x309d8c){_0x183088[_0x3702('0x1d')]+=0x1;var _0x1161c4={'uniqueid':_0x7da465,'from':_0x309d8c['body']?_0x309d8c[_0x3702('0x1e')][_0x3702('0x1f')]:'','joinAt':moment()[_0x3702('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x309d8c[_0x3702('0x20')]?_0x309d8c[_0x3702('0x20')]['id']:null,'ListId':_0x309d8c[_0x3702('0x21')]?_0x309d8c[_0x3702('0x21')]['id']:null};_0x1161c4[_[_0x3702('0x22')](_0x309d8c[_0x3702('0x23')])+_0x3702('0x24')]=_0x183088['id']||null;_0x1161c4[_[_0x3702('0x22')](_0x309d8c[_0x3702('0x23')])+_0x3702('0x25')]=_0x309d8c[_0x3702('0x26')]?_0x309d8c[_0x3702('0x26')]['id']:null;_0x1161c4[_[_0x3702('0x22')](_0x309d8c[_0x3702('0x23')])+_0x3702('0x27')]=_0x309d8c['message']?_0x309d8c[_0x3702('0x28')]['id']:null;_0x1161c4[_[_0x3702('0x22')](_0x309d8c[_0x3702('0x23')])+(_0x309d8c['channel']!==_0x3702('0x29')?'AccountId':_0x3702('0x2a'))]=_0x309d8c[_0x3702('0xb')]?_0x309d8c[_0x3702('0xb')]['id']:null;logger['info'](util[_0x3702('0x10')](_0x3702('0x2b'),_0x7da465,_0x183088[_0x3702('0x2c')]));emitChannelQueueInteraction(_0x309d8c[_0x3702('0x23')],_0x183088[_0x3702('0x2c')],_0x1161c4,_0x309d8c[_0x3702('0xb')][_0x3702('0x2c')],_0x309d8c[_0x3702('0x28')]['id'],!![],_0xbde3cb,_0x183088['id']);if(rpc[_0x309d8c['channel']+_0x3702('0x2d')]){return rpc[_0x309d8c[_0x3702('0x23')]+_0x3702('0x2d')][_0x3702('0x2e')](_0x1161c4)[_0x3702('0x2f')](function(_0x60d07f){logger[_0x3702('0x30')](_0x3702('0x31'),_0x60d07f);});}}}function stopRouting(_0x14a68e,_0x142fa1,_0x53711a,_0x3fe3a2){if(_0x14a68e&&_0x142fa1){_0x142fa1['waiting']-=0x1;var _0xbe0a0f={'leaveAt':moment()[_0x3702('0x10')](_0x3702('0x32')),'acceptAt':moment()[_0x3702('0x10')](_0x3702('0x32')),'reason':'accepted'};logger['info'](util['format'](_0x3702('0x33'),_0x14a68e,_0x142fa1['name']));emitChannelQueueInteraction(_0x53711a[_0x3702('0x23')],_0x142fa1[_0x3702('0x2c')],_0x53711a['body'],_0x53711a['account'][_0x3702('0x2c')],_0x53711a[_0x3702('0x28')]['id'],![],_0x3fe3a2,_0x142fa1['id']);return rpc[_0x53711a[_0x3702('0x23')]+_0x3702('0x34')][_0x3702('0x35')](_0x53711a['interaction']['id'],{'queueId':_0x142fa1['id']})[_0x3702('0x36')](function(){if(rpc[_0x53711a[_0x3702('0x23')]+'QueueReport']){return rpc[_0x53711a['channel']+_0x3702('0x2d')][_0x3702('0x35')](_0x14a68e,_0xbe0a0f)[_0x3702('0x2f')](function(_0x10127c){logger[_0x3702('0x30')](_0x3702('0x37'),_0x10127c);});}});}}function endRouting(_0x5aed7f,_0x338072,_0x2bb23a,_0x79c782){if(_0x5aed7f&&_0x338072){_0x338072['waiting']-=0x1;var _0x146252={'leaveAt':moment()['format'](_0x3702('0x32')),'exitAt':moment()['format'](_0x3702('0x32')),'reason':_0x3702('0x38')};logger[_0x3702('0x39')](util['format'](_0x3702('0x3a'),_0x5aed7f,_0x338072[_0x3702('0x2c')]));emitChannelQueueInteraction(_0x2bb23a['channel'],_0x338072[_0x3702('0x2c')],_0x2bb23a['body'],_0x2bb23a[_0x3702('0xb')][_0x3702('0x2c')],_0x2bb23a[_0x3702('0x28')]['id'],![],_0x79c782);if(rpc[_0x2bb23a[_0x3702('0x23')]+_0x3702('0x2d')]){return rpc[_0x2bb23a[_0x3702('0x23')]+'QueueReport'][_0x3702('0x35')](_0x5aed7f,_0x146252)[_0x3702('0x2f')](function(_0x28a18a){logger[_0x3702('0x30')](_0x3702('0x37'),_0x28a18a);});}}}function handleFindQueue(_0x1c7b94){return function(_0x421c6f){return _0x421c6f[_0x3702('0x2c')][_0x3702('0x3b')]()===_0x1c7b94[_0x3702('0x3b')]();};}exports[_0x3702('0x3c')]=function(_0x4a161b,_0x2731bb,_0x38d59f,_0x4b9aeb){return function(_0xe322d0){try{var _0x620edf={'name':_0x2731bb[0x0],'timeout':_0x2731bb[0x1]};var _0x59f8b4=queue[_0x3702('0x0')](_0x620edf,{'typecast':!![]});if(_0x59f8b4['length']){logger[_0x3702('0x30')](_0x3702('0x3d'),_0x4a161b,_['map'](_0x59f8b4,'message')[_0x3702('0x3e')](',\x20'));_0xe322d0['stop']();}else{var _0x4f8442=_[_0x3702('0x3f')](_0x38d59f[_0x4b9aeb['channel']+_0x3702('0x40')],handleFindQueue(_0x620edf[_0x3702('0x2c')]));if(_0x4f8442){startRouting(_0x4a161b,_0x4f8442,_0x4b9aeb,_0x38d59f);var _0x496eb1=(_0x4f8442['timeout']||0xa)*0x3e8;var _0x402c78=(_0x620edf['timeout']||0x14)*0x3e8;var _0x4ee181;if(_0x496eb1>_0x402c78){_0x402c78=_0x496eb1;}var _0xcaa651=seqqueue[_0x3702('0x41')](_0x496eb1);_0xcaa651['id']=_0x4a161b;_0xcaa651['atimeout']=_0x496eb1;_0xcaa651[_0x3702('0x42')]=_0x402c78;_0xcaa651[_0x3702('0x23')]=_0x4b9aeb[_0x3702('0x23')];_0x38d59f[_0x3702('0x43')][_0x4a161b]['on']('end',function(){logger[_0x3702('0x39')](_0x3702('0x44'),_0x4a161b);stopRouting(_0x4a161b,_0x4f8442,_0x4b9aeb,_0x38d59f);clearTimeout(_0x4ee181);_0x4ee181=undefined;_0xcaa651['close'](!![]);if(_0x38d59f['rules'][_0x4a161b]){delete _0x38d59f[_0x3702('0x43')][_0x4a161b];}_0xe322d0['stop']();});_0x38d59f[_0x3702('0x43')][_0x4a161b]['on'](_0x3702('0x45'),function(){if(_0x38d59f[_0x3702('0x43')][_0x4a161b]){delete _0x38d59f[_0x3702('0x43')][_0x4a161b];}});_0x4ee181=setTimeout(function(){logger[_0x3702('0x39')](_0x3702('0x46'),_0x4a161b);endRouting(_0x4a161b,_0x4f8442,_0x4b9aeb,_0x38d59f);clearTimeout(_0x4ee181);_0xcaa651[_0x3702('0x47')](!![]);_0xe322d0[_0x3702('0x48')]();},_0x402c78);switch(_0x4f8442[_0x3702('0x49')]){case _0x3702('0x4a'):strategy[_0x3702('0x4a')](_0xcaa651,_0x4f8442,_0x38d59f,_0x4b9aeb);break;default:strategy['beepall'](_0xcaa651,_0x4f8442,_0x38d59f,_0x4b9aeb);}}else{logger[_0x3702('0x30')](_0x3702('0x4b'),_0x4a161b,_0x620edf[_0x3702('0x2c')]);_0xe322d0['stop']();}}}catch(_0x2fe946){logger[_0x3702('0x30')](_0x3702('0x3d'),_0x4a161b,_0x2fe946[_0x3702('0x4c')]);_0xe322d0[_0x3702('0x4d')]();}};}; \ No newline at end of file +var _0x2c91=['accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','timeout','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x2c91,0x1db));var _0x12c9=function(_0x10c712,_0x223e99){_0x10c712=_0x10c712-0x0;var _0x184cd3=_0x2c91[_0x10c712];return _0x184cd3;};'use strict';var schema=require(_0x12c9('0x0'));var _=require(_0x12c9('0x1'));var util=require('util');var seqqueue=require(_0x12c9('0x2'));var moment=require('moment');var Redis=require(_0x12c9('0x3'));var config=require(_0x12c9('0x4'));var logger=require(_0x12c9('0x5'))(_0x12c9('0x6'));var strategy=require(_0x12c9('0x7'));config['redis']=_[_0x12c9('0x8')](config[_0x12c9('0x9')],{'host':_0x12c9('0xa'),'port':0x18eb});var io=require(_0x12c9('0xb'))(new Redis(config['redis']));var attributes=['id',_0x12c9('0xc'),_0x12c9('0xd'),_0x12c9('0xe'),_0x12c9('0xf'),_0x12c9('0x10')];function emit(_0x346976,_0x221cd4,_0x54f3ed){io['to'](_0x346976)[_0x12c9('0x11')](_0x221cd4,_0x54f3ed);}function emitChannelQueueInteraction(_0x289081,_0x50eee8,_0x1ad2c0,_0x4bc9f6,_0x4a7b07,_0x3fcec5,_0x38a414,_0x39425c){var _0xa6572c=_[_0x12c9('0x12')](_0x1ad2c0);_0xa6572c[_0x12c9('0xc')]=_0x39425c;_0xa6572c[_0x12c9('0xe')]=_0x50eee8;_0xa6572c[_0x12c9('0xd')]=_0x4bc9f6;_0xa6572c['id']=_0x4a7b07;if(_0x3fcec5){attributes[_0x12c9('0x13')](_[_0x12c9('0x14')](_0x289081)+'InteractionId');_0x38a414[util['format']('%sQueuesWaitingInteractions',_0x289081)][_0x4a7b07]=_[_0x12c9('0x15')](_0xa6572c,attributes);}else{delete _0x38a414[util[_0x12c9('0x16')](_0x12c9('0x17'),_0x289081)][_0x4a7b07];}emit(util['format'](_0x12c9('0x18'),_0x289081,_0x50eee8),util[_0x12c9('0x16')](_0x12c9('0x19'),_0x289081,_0x3fcec5?_0x12c9('0x1a'):_0x12c9('0x1b')),_[_0x12c9('0x15')](_0xa6572c,attributes));}var rpc={'openchannelQueueReport':require(_0x12c9('0x1c')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x12c9('0x1d')),'smsQueueReport':require(_0x12c9('0x1e')),'faxQueueReport':require(_0x12c9('0x1f')),'whatsappQueueReport':require(_0x12c9('0x20')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x12c9('0x21')),'mailInteraction':require(_0x12c9('0x22')),'openchannelInteraction':require(_0x12c9('0x23')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x12c9('0x24'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x12c9('0x25')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x5e24c3,_0xa3ad35,_0x10729a,_0x301786){if(_0x5e24c3&&_0xa3ad35&&_0x10729a){_0xa3ad35[_0x12c9('0x26')]+=0x1;var _0xb56f79={'uniqueid':_0x5e24c3,'from':_0x10729a[_0x12c9('0x27')]?_0x10729a[_0x12c9('0x27')][_0x12c9('0xf')]:'','joinAt':moment()[_0x12c9('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x10729a['contact']?_0x10729a[_0x12c9('0x28')]['id']:null,'ListId':_0x10729a['list']?_0x10729a[_0x12c9('0x29')]['id']:null};_0xb56f79[_[_0x12c9('0x2a')](_0x10729a[_0x12c9('0x2b')])+_0x12c9('0x2c')]=_0xa3ad35['id']||null;_0xb56f79[_[_0x12c9('0x2a')](_0x10729a[_0x12c9('0x2b')])+_0x12c9('0x2d')]=_0x10729a[_0x12c9('0x2e')]?_0x10729a[_0x12c9('0x2e')]['id']:null;_0xb56f79[_[_0x12c9('0x2a')](_0x10729a[_0x12c9('0x2b')])+_0x12c9('0x2f')]=_0x10729a[_0x12c9('0x30')]?_0x10729a['message']['id']:null;_0xb56f79[_[_0x12c9('0x2a')](_0x10729a[_0x12c9('0x2b')])+(_0x10729a[_0x12c9('0x2b')]!==_0x12c9('0x31')?_0x12c9('0x32'):_0x12c9('0x33'))]=_0x10729a[_0x12c9('0xd')]?_0x10729a[_0x12c9('0xd')]['id']:null;logger['info'](util[_0x12c9('0x16')](_0x12c9('0x34'),_0x5e24c3,_0xa3ad35[_0x12c9('0x35')]));emitChannelQueueInteraction(_0x10729a[_0x12c9('0x2b')],_0xa3ad35['name'],_0xb56f79,_0x10729a[_0x12c9('0xd')]['name'],_0x10729a[_0x12c9('0x30')]['id'],!![],_0x301786,_0xa3ad35['id']);if(rpc[_0x10729a['channel']+_0x12c9('0x36')]){return rpc[_0x10729a['channel']+_0x12c9('0x36')]['create'](_0xb56f79)[_0x12c9('0x37')](function(_0x39a8a4){logger[_0x12c9('0x38')](_0x12c9('0x39'),_0x39a8a4);});}}}function stopRouting(_0x17657,_0x2515e0,_0x3badcf,_0x304b60){if(_0x17657&&_0x2515e0){_0x2515e0[_0x12c9('0x26')]-=0x1;var _0xed0cf9={'leaveAt':moment()[_0x12c9('0x16')](_0x12c9('0x3a')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x12c9('0x3b')};logger[_0x12c9('0x3c')](util[_0x12c9('0x16')](_0x12c9('0x3d'),_0x17657,_0x2515e0[_0x12c9('0x35')]));emitChannelQueueInteraction(_0x3badcf[_0x12c9('0x2b')],_0x2515e0[_0x12c9('0x35')],_0x3badcf['body'],_0x3badcf[_0x12c9('0xd')][_0x12c9('0x35')],_0x3badcf[_0x12c9('0x30')]['id'],![],_0x304b60,_0x2515e0['id']);return rpc[_0x3badcf[_0x12c9('0x2b')]+_0x12c9('0x3e')][_0x12c9('0x3f')](_0x3badcf[_0x12c9('0x2e')]['id'],{'queueId':_0x2515e0['id']})[_0x12c9('0x40')](function(){if(rpc[_0x3badcf[_0x12c9('0x2b')]+_0x12c9('0x36')]){return rpc[_0x3badcf[_0x12c9('0x2b')]+_0x12c9('0x36')][_0x12c9('0x3f')](_0x17657,_0xed0cf9)[_0x12c9('0x37')](function(_0x944014){logger[_0x12c9('0x38')]('update\x20queue\x20report',_0x944014);});}});}}function endRouting(_0x42ec3c,_0x24856b,_0xaef8ed,_0x49ee29){if(_0x42ec3c&&_0x24856b){_0x24856b[_0x12c9('0x26')]-=0x1;var _0x3cae0a={'leaveAt':moment()[_0x12c9('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x12c9('0x16')](_0x12c9('0x3a')),'reason':_0x12c9('0x41')};logger[_0x12c9('0x3c')](util[_0x12c9('0x16')]('[%s][END:QUEUE][NAME:%s]',_0x42ec3c,_0x24856b[_0x12c9('0x35')]));emitChannelQueueInteraction(_0xaef8ed[_0x12c9('0x2b')],_0x24856b[_0x12c9('0x35')],_0xaef8ed['body'],_0xaef8ed[_0x12c9('0xd')][_0x12c9('0x35')],_0xaef8ed[_0x12c9('0x30')]['id'],![],_0x49ee29);if(rpc[_0xaef8ed['channel']+'QueueReport']){return rpc[_0xaef8ed[_0x12c9('0x2b')]+_0x12c9('0x36')][_0x12c9('0x3f')](_0x42ec3c,_0x3cae0a)[_0x12c9('0x37')](function(_0x640552){logger['error'](_0x12c9('0x42'),_0x640552);});}}}function handleFindQueue(_0x468d29){return function(_0x39d3ed){return _0x39d3ed['name'][_0x12c9('0x43')]()===_0x468d29[_0x12c9('0x43')]();};}exports[_0x12c9('0x44')]=function(_0x1f4b33,_0x59fe73,_0x4d8783,_0x3d016a){return function(_0x252c8f){try{var _0x41dca5={'name':_0x59fe73[0x0],'timeout':_0x59fe73[0x1]};var _0x44f27e=queue[_0x12c9('0x0')](_0x41dca5,{'typecast':!![]});if(_0x44f27e['length']){logger[_0x12c9('0x38')](_0x12c9('0x45'),_0x1f4b33,_['map'](_0x44f27e,_0x12c9('0x30'))[_0x12c9('0x46')](',\x20'));_0x252c8f[_0x12c9('0x47')]();}else{var _0x47bbc0=_[_0x12c9('0x48')](_0x4d8783[_0x3d016a['channel']+_0x12c9('0x49')],handleFindQueue(_0x41dca5[_0x12c9('0x35')]));if(_0x47bbc0){startRouting(_0x1f4b33,_0x47bbc0,_0x3d016a,_0x4d8783);var _0x2202c5=(_0x47bbc0['timeout']||0xa)*0x3e8;var _0x73bc8d=(_0x41dca5[_0x12c9('0x41')]||0x14)*0x3e8;var _0x18b441;if(_0x2202c5>_0x73bc8d){_0x73bc8d=_0x2202c5;}var _0x31340e=seqqueue[_0x12c9('0x4a')](_0x2202c5);_0x31340e['id']=_0x1f4b33;_0x31340e[_0x12c9('0x4b')]=_0x2202c5;_0x31340e[_0x12c9('0x4c')]=_0x73bc8d;_0x31340e[_0x12c9('0x2b')]=_0x3d016a[_0x12c9('0x2b')];_0x4d8783[_0x12c9('0x4d')][_0x1f4b33]['on'](_0x12c9('0x4e'),function(){logger[_0x12c9('0x3c')](_0x12c9('0x4f'),_0x1f4b33);stopRouting(_0x1f4b33,_0x47bbc0,_0x3d016a,_0x4d8783);clearTimeout(_0x18b441);_0x18b441=undefined;_0x31340e[_0x12c9('0x50')](!![]);if(_0x4d8783[_0x12c9('0x4d')][_0x1f4b33]){delete _0x4d8783[_0x12c9('0x4d')][_0x1f4b33];}_0x252c8f[_0x12c9('0x47')]();});_0x4d8783[_0x12c9('0x4d')][_0x1f4b33]['on'](_0x12c9('0x51'),function(){if(_0x4d8783['rules'][_0x1f4b33]){delete _0x4d8783[_0x12c9('0x4d')][_0x1f4b33];}});_0x18b441=setTimeout(function(){logger[_0x12c9('0x3c')](_0x12c9('0x52'),_0x1f4b33);endRouting(_0x1f4b33,_0x47bbc0,_0x3d016a,_0x4d8783);clearTimeout(_0x18b441);_0x31340e[_0x12c9('0x50')](!![]);_0x252c8f[_0x12c9('0x53')]();},_0x73bc8d);switch(_0x47bbc0[_0x12c9('0x54')]){case _0x12c9('0x55'):strategy[_0x12c9('0x55')](_0x31340e,_0x47bbc0,_0x4d8783,_0x3d016a);break;default:strategy[_0x12c9('0x56')](_0x31340e,_0x47bbc0,_0x4d8783,_0x3d016a);}}else{logger['error'](_0x12c9('0x57'),_0x1f4b33,_0x41dca5['name']);_0x252c8f[_0x12c9('0x47')]();}}}catch(_0x57f777){logger['error'](_0x12c9('0x45'),_0x1f4b33,_0x57f777[_0x12c9('0x58')]);_0x252c8f[_0x12c9('0x47')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index fab2900..246d230 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 _0xcb99=['busy','busyQueue','saveWaitingNotification','routing','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','lodash','./util','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel'];(function(_0x4bf4a1,_0xaf7845){var _0x588de8=function(_0x12e036){while(--_0x12e036){_0x4bf4a1['push'](_0x4bf4a1['shift']());}};_0x588de8(++_0xaf7845);}(_0xcb99,0x8b));var _0x9cb9=function(_0x96691d,_0x544a9d){_0x96691d=_0x96691d-0x0;var _0x5a79ca=_0xcb99[_0x96691d];return _0x5a79ca;};'use strict';var _=require(_0x9cb9('0x0'));var uuid=require('uuid');var util=require(_0x9cb9('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x3a2f21,_0x1308a8,_0x124c48,_0x51f2ee){this[_0x9cb9('0x2')]=uuid['v4']();this[_0x9cb9('0x3')]=_0x3a2f21;this['agent']=_0x1308a8;this[_0x9cb9('0x4')]=_0x124c48;this['routing']=_0x51f2ee;this[_0x9cb9('0x3')][_0x9cb9('0x5')](this[_0x9cb9('0x6')][_0x9cb9('0x7')](this),this[_0x9cb9('0x8')][_0x9cb9('0x7')](this));this[_0x9cb9('0x3')]['on'](_0x9cb9('0x9'),this['handleTimeout']['bind'](this));this[_0x9cb9('0x3')]['on'](_0x9cb9('0xa'),this[_0x9cb9('0xb')]['bind'](this));};Agent[_0x9cb9('0xc')][_0x9cb9('0x5')]=function(){this['squeue']['push'](this[_0x9cb9('0x6')][_0x9cb9('0x7')](this),this[_0x9cb9('0x8')][_0x9cb9('0x7')](this));};Agent['prototype'][_0x9cb9('0xb')]=function(){this[_0x9cb9('0x8')](!![]);};Agent[_0x9cb9('0xc')][_0x9cb9('0x6')]=function(){logger[_0x9cb9('0xd')](_0x9cb9('0xe'),this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0xf')]['id']);if(_[_0x9cb9('0x10')](this[_0x9cb9('0x4')][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']])){logger[_0x9cb9('0xd')](_0x9cb9('0x12'),this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0xf')]['id']);setTimeout(this[_0x9cb9('0x5')][_0x9cb9('0x7')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x9cb9('0x13')](this['squeue']['id'],this['realtime']['agents'][this[_0x9cb9('0xf')]['id']],this['squeue'][_0x9cb9('0x14')],![])){this[_0x9cb9('0x4')][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']][_0x9cb9('0x15')]=!![];this[_0x9cb9('0x4')][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']][_0x9cb9('0x16')]=undefined;util[_0x9cb9('0x17')](this[_0x9cb9('0x4')],this[_0x9cb9('0x18')],this[_0x9cb9('0xf')],this[_0x9cb9('0x3')]['channel']);util['showNotification'](this[_0x9cb9('0x2')],this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0x4')][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']],null,this[_0x9cb9('0x18')]);util[_0x9cb9('0x19')](this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0x4')]['agents'][this[_0x9cb9('0xf')]['id']],_0x9cb9('0x1a')+(this[_0x9cb9('0x18')][_0x9cb9('0x1b')]?':FORCED':''));}else{logger[_0x9cb9('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0xf')]['id']);setTimeout(this[_0x9cb9('0x5')][_0x9cb9('0x7')](this),0x3e8);}}};Agent['prototype'][_0x9cb9('0x8')]=function(_0x3b7bba){if(_[_0x9cb9('0x10')](this['realtime'][_0x9cb9('0x11')][this['agent']['id']])){return logger[_0x9cb9('0xd')](_0x9cb9('0x12'),this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0xf')]['id']);}else{logger[_0x9cb9('0xd')](_0x9cb9('0x1c'),this['squeue']['id'],this[_0x9cb9('0xf')]['id']);util[_0x9cb9('0x1d')](this[_0x9cb9('0x2')],this['squeue']['id'],this['realtime'][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']],null,this[_0x9cb9('0x18')]);this['realtime']['agents'][this[_0x9cb9('0xf')]['id']][_0x9cb9('0x15')]=![];this['realtime'][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']][_0x9cb9('0x16')]=undefined;util[_0x9cb9('0x1e')](this[_0x9cb9('0x4')],this['routing'],this[_0x9cb9('0xf')],this[_0x9cb9('0x3')]['channel']);util[_0x9cb9('0x19')](this['squeue']['id'],this[_0x9cb9('0x4')][_0x9cb9('0x11')][this['agent']['id']],_0x3b7bba?'STOP':_0x9cb9('0x1f'));}if(!_0x3b7bba){setTimeout(this[_0x9cb9('0x5')][_0x9cb9('0x7')](this),0x3e8);}};function agent(_0x2595f9,_0x448e2c,_0x2dd463,_0x10a355){return new Agent(_0x2595f9,_0x448e2c,_0x2dd463,_0x10a355);}module['exports']=agent; \ No newline at end of file +var _0xb903=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','handleRun','bind','handleTimeout','handleDrained','push','debug','isNil','realtime','agents','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','RINGING',':FORCED'];(function(_0x3c8a75,_0x178cac){var _0x3d9f96=function(_0x4e365e){while(--_0x4e365e){_0x3c8a75['push'](_0x3c8a75['shift']());}};_0x3d9f96(++_0x178cac);}(_0xb903,0x185));var _0x3b90=function(_0x17da2b,_0x18077b){_0x17da2b=_0x17da2b-0x0;var _0x23c9b2=_0xb903[_0x17da2b];return _0x23c9b2;};'use strict';var _=require(_0x3b90('0x0'));var uuid=require(_0x3b90('0x1'));var util=require(_0x3b90('0x2'));var logger=require(_0x3b90('0x3'))('routing');var Agent=function(_0x3312ca,_0xf414f4,_0x3b024a,_0x1cd5d8){this[_0x3b90('0x4')]=uuid['v4']();this[_0x3b90('0x5')]=_0x3312ca;this[_0x3b90('0x6')]=_0xf414f4;this['realtime']=_0x3b024a;this[_0x3b90('0x7')]=_0x1cd5d8;this['squeue']['push'](this[_0x3b90('0x8')][_0x3b90('0x9')](this),this[_0x3b90('0xa')][_0x3b90('0x9')](this));this['squeue']['on']('timeout',this['handleTimeout']['bind'](this));this['squeue']['on']('drained',this[_0x3b90('0xb')][_0x3b90('0x9')](this));};Agent['prototype'][_0x3b90('0xc')]=function(){this[_0x3b90('0x5')]['push'](this[_0x3b90('0x8')][_0x3b90('0x9')](this),this[_0x3b90('0xa')]['bind'](this));};Agent['prototype'][_0x3b90('0xb')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x3b90('0x8')]=function(){logger[_0x3b90('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x3b90('0x6')]['id']);if(_[_0x3b90('0xe')](this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);setTimeout(this['push'][_0x3b90('0x9')](this),0x3e8);}else{if(this[_0x3b90('0x7')][_0x3b90('0x11')]||util[_0x3b90('0x12')](this['squeue']['id'],this[_0x3b90('0xf')]['agents'][this[_0x3b90('0x6')]['id']],this[_0x3b90('0x5')]['channel'],![])){this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x13')]=!![];this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x14')]=undefined;util[_0x3b90('0x15')](this[_0x3b90('0xf')],this['routing'],this[_0x3b90('0x6')],this[_0x3b90('0x5')][_0x3b90('0x16')]);util[_0x3b90('0x17')](this[_0x3b90('0x4')],this[_0x3b90('0x5')]['id'],this['realtime']['agents'][this[_0x3b90('0x6')]['id']],null,this[_0x3b90('0x7')]);util[_0x3b90('0x18')](this[_0x3b90('0x5')]['id'],this['realtime'][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']],_0x3b90('0x19')+(this['routing'][_0x3b90('0x11')]?_0x3b90('0x1a'):''));}else{logger[_0x3b90('0xd')](_0x3b90('0x1b'),this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);setTimeout(this['push'][_0x3b90('0x9')](this),0x3e8);}}};Agent['prototype'][_0x3b90('0xa')]=function(_0x9891e4){if(_[_0x3b90('0xe')](this[_0x3b90('0xf')][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']])){return logger[_0x3b90('0xd')](_0x3b90('0x1c'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x3b90('0xd')](_0x3b90('0x1d'),this[_0x3b90('0x5')]['id'],this[_0x3b90('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0x3b90('0x5')]['id'],this[_0x3b90('0xf')][_0x3b90('0x10')][this['agent']['id']],null,this[_0x3b90('0x7')]);this['realtime']['agents'][this[_0x3b90('0x6')]['id']][_0x3b90('0x13')]=![];this['realtime'][_0x3b90('0x10')][this[_0x3b90('0x6')]['id']][_0x3b90('0x14')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x3b90('0x7')],this[_0x3b90('0x6')],this[_0x3b90('0x5')][_0x3b90('0x16')]);util['writeLog'](this['squeue']['id'],this[_0x3b90('0xf')][_0x3b90('0x10')][this['agent']['id']],_0x9891e4?'STOP':_0x3b90('0x1e'));}if(!_0x9891e4){setTimeout(this[_0x3b90('0xc')][_0x3b90('0x9')](this),0x3e8);}};function agent(_0x298df6,_0x5a3266,_0x2154e2,_0x583842){return new Agent(_0x298df6,_0x5a3266,_0x2154e2,_0x583842);}module[_0x3b90('0x1f')]=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 ef48d51..fde421f 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 _0x3aa1=['handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','RINGING','busyQueue','name','saveWaitingNotification','channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','busy','removeWaitingNotification','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun'];(function(_0x4a9687,_0x2b423a){var _0x16f68b=function(_0x5f4758){while(--_0x5f4758){_0x4a9687['push'](_0x4a9687['shift']());}};_0x16f68b(++_0x2b423a);}(_0x3aa1,0x1b0));var _0x13aa=function(_0x4b3f30,_0x2ab610){_0x4b3f30=_0x4b3f30-0x0;var _0x272404=_0x3aa1[_0x4b3f30];return _0x272404;};'use strict';var _=require(_0x13aa('0x0'));var uuid=require(_0x13aa('0x1'));var util=require('./util');var logger=require(_0x13aa('0x2'))(_0x13aa('0x3'));var Beepall=function(_0x4ff031,_0x2f7c3d,_0x3cdc47,_0x12d074){this[_0x13aa('0x4')]=uuid['v4']();this[_0x13aa('0x5')]=_0x4ff031;this[_0x13aa('0x6')]=_0x2f7c3d;this[_0x13aa('0x7')]=_0x3cdc47;this['routing']=_0x12d074;this['squeue'][_0x13aa('0x8')](this[_0x13aa('0x9')]['bind'](this),this[_0x13aa('0xa')][_0x13aa('0xb')](this));this[_0x13aa('0x5')]['on'](_0x13aa('0xc'),this[_0x13aa('0xa')][_0x13aa('0xb')](this));this['squeue']['on'](_0x13aa('0xd'),this[_0x13aa('0xe')][_0x13aa('0xb')](this));};Beepall[_0x13aa('0xf')][_0x13aa('0x8')]=function(){this[_0x13aa('0x5')][_0x13aa('0x8')](this[_0x13aa('0x9')]['bind'](this),this[_0x13aa('0xa')][_0x13aa('0xb')](this));};Beepall[_0x13aa('0xf')][_0x13aa('0xe')]=function(){this[_0x13aa('0xa')](!![]);};Beepall[_0x13aa('0xf')][_0x13aa('0x9')]=function(){var _0x22a312=!![];if(!_[_0x13aa('0x10')](this['queue'])&&!_[_0x13aa('0x10')](this[_0x13aa('0x6')][_0x13aa('0x11')])&&this[_0x13aa('0x6')][_0x13aa('0x11')][_0x13aa('0x12')]>0x0){for(var _0x510183=0x0,_0x503fab;_0x5101830x0){for(var _0x93cdb8=0x0,_0x23bec9;_0x93cdb80x0&&_0x414575[_0x2843c3+_0xa579('0x1e')]>=_0x414575[_0x2843c3+'Capacity']){writeLog(_0x1a83bb,_0x414575,_0x2843c3[_0xa579('0x1f')]()+_0xa579('0x20'));return![];}}return!![];};exports[_0xa579('0x21')]=function(_0xd9b013,_0x401cb8,_0x475259,_0x31b9fd,_0xb2a714){return sendNotification(!![],_0xd9b013,_0x401cb8,_0x475259,_0x31b9fd,_0xb2a714);};exports[_0xa579('0x22')]=function(_0x153912,_0x4bc0fb,_0x1fc98a,_0x5cac4f,_0x37fe1d){return sendNotification(![],_0x153912,_0x4bc0fb,_0x1fc98a,_0x5cac4f,_0x37fe1d);};exports[_0xa579('0x23')]=function(_0x9c8e75,_0x1ef981,_0x1e59f0){var _0x321a77=_0x1ef981[_0xa579('0x24')]['UserId'];if(!_0x321a77&&_0x1e59f0){_0x321a77=_0x1e59f0['id'];}var _0x444df4=_['some'](_0x9c8e75[_0x1ef981[_0xa579('0x25')]+_0xa579('0x26')],function(_0x3d0630){var _0x35bb8a=_[_0xa579('0x27')](_0x1ef981[_0xa579('0x25')])+_0xa579('0x28');return _0x3d0630[_0x35bb8a]===_0x1ef981[_0xa579('0x24')]['id'];});if(!_0x444df4&&_0x321a77&&_0x9c8e75[_0xa579('0x29')][_0x321a77]){_0x444df4=_[_0xa579('0x2a')](_0x9c8e75['agents'][_0x321a77][_0x1ef981[_0xa579('0x25')]+'WaitingInteractions'],function(_0x3b5850){return _0x3b5850['id']===_0x1ef981['interaction']['id'];});}return _0x444df4;};exports[_0xa579('0x2b')]=function(_0x39da14,_0x6b991f,_0x18b425,_0xd1d698){if(_0x18b425&&_0x18b425['id']&&_0x39da14[_0xa579('0x29')]&&_0x39da14[_0xa579('0x29')][_0x18b425['id']]){_0x39da14[_0xa579('0x29')][_0x18b425['id']][_0xd1d698+_0xa579('0x2c')][_0x6b991f[_0xa579('0x12')]['id']]={'id':_0x6b991f[_0xa579('0x24')]['id']};}};exports[_0xa579('0x2d')]=function(_0x416184,_0x22f9e9,_0xa8c338,_0x1efb0f){if(_0xa8c338&&_0xa8c338['id']&&_0x416184[_0xa579('0x29')]&&_0x416184[_0xa579('0x29')][_0xa8c338['id']]){delete _0x416184[_0xa579('0x29')][_0xa8c338['id']][_0x1efb0f+_0xa579('0x2c')][_0x22f9e9[_0xa579('0x12')]['id']];}};exports[_0xa579('0x2e')]=writeLog; \ No newline at end of file +var _0xd0e4=['remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','routing','redis','defaults','localhost','split','\x20interaction','name','account','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','format','message','user:%s','emit','notification:%s'];(function(_0x4edce7,_0x4a6d8d){var _0x4aa038=function(_0x166f5a){while(--_0x166f5a){_0x4edce7['push'](_0x4edce7['shift']());}};_0x4aa038(++_0x4a6d8d);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x32f75b,_0x16cde7){_0x32f75b=_0x32f75b-0x0;var _0x26f5c7=_0xd0e4[_0x32f75b];return _0x26f5c7;};'use strict';var _=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var utils=require(_0x4d0e('0x2'));var Redis=require(_0x4d0e('0x3'));var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0x4d0e('0x4'));config[_0x4d0e('0x5')]=_[_0x4d0e('0x6')](config[_0x4d0e('0x5')],{'host':_0x4d0e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x5be772,_0x103596,_0x39e5c6,_0x50cd74,_0x2f900a,_0x1731e4){var _0x4e7630=_0x1731e4||{};var _0x4d1029=_0x39e5c6[_0x4d0e('0x8')]('.');var _0x4f15b3={'uniqueid':_0x103596,'channel':_0x4d1029[0x0],'id':_0x4d1029[0x1],'title':_0x4d1029[0x0]+_0x4d0e('0x9'),'interactionId':_0x4d1029[0x2],'queue':_0x2f900a?_0x2f900a[_0x4d0e('0xa')]:null,'sound':_0x4e7630[_0x4d0e('0xb')]['notificationSound'],'shake':_0x4e7630[_0x4d0e('0xb')][_0x4d0e('0xc')]};try{if(!_0x4e7630['body']){_0x4e7630['body']={};}if(_0x2f900a){_0x4e7630[_0x4d0e('0xd')][_0x4d0e('0xe')]=_0x2f900a;}else if(_0x4e7630[_0x4d0e('0xd')][_0x4d0e('0xe')]){delete _0x4e7630[_0x4d0e('0xd')][_0x4d0e('0xe')];}_0x4f15b3[_0x4d0e('0xf')]=utils[_0x4d0e('0x10')](_0x4e7630[_0x4d0e('0xb')]['notificationTemplate'],_0x4e7630);}catch(_0x8f0fde){_0x4f15b3[_0x4d0e('0xf')]=_0x4d0e('0x11');logger['error'](util[_0x4d0e('0x12')]('[%s][QUEUE]\x20%s',_0x103596,_0x8f0fde[_0x4d0e('0x13')]));}io['to'](util[_0x4d0e('0x12')](_0x4d0e('0x14'),_0x50cd74[_0x4d0e('0xa')]))[_0x4d0e('0x15')](util[_0x4d0e('0x12')](_0x4d0e('0x16'),_0x5be772?'save':_0x4d0e('0x17')),_0x4f15b3);}function writeLog(_0x2ea57f,_0x3b94cf,_0x5e06b8){return logger[_0x4d0e('0x18')](util[_0x4d0e('0x12')](_0x4d0e('0x19'),_0x2ea57f,_0x3b94cf[_0x4d0e('0xa')],_0x5e06b8));}exports[_0x4d0e('0x1a')]=function(_0x970861,_0x3dc65b,_0x1d6e52,_0x40c2f8){if(_0x3dc65b[_0x4d0e('0x1b')]){writeLog(_0x970861,_0x3dc65b,_0x4d0e('0x1c'));return![];}if(!_0x3dc65b['online']){writeLog(_0x970861,_0x3dc65b,'OFFLINE');return![];}if(_0x3dc65b[_0x1d6e52+_0x4d0e('0x1d')]){writeLog(_0x970861,_0x3dc65b,_0x4d0e('0x1e'));return![];}if(_0x40c2f8&&_0x3dc65b['hasOwnProperty'](_0x1d6e52+'Capacity')&&_0x3dc65b[_0x4d0e('0x1f')](_0x1d6e52+_0x4d0e('0x20'))){if(_0x3dc65b[_0x1d6e52+_0x4d0e('0x21')]>0x0&&_0x3dc65b[_0x1d6e52+_0x4d0e('0x20')]>=_0x3dc65b[_0x1d6e52+_0x4d0e('0x21')]){writeLog(_0x970861,_0x3dc65b,_0x1d6e52[_0x4d0e('0x22')]()+_0x4d0e('0x23'));return![];}}return!![];};exports[_0x4d0e('0x24')]=function(_0x3411dd,_0x557e6a,_0x35f58a,_0x23c176,_0x1a237f){return sendNotification(!![],_0x3411dd,_0x557e6a,_0x35f58a,_0x23c176,_0x1a237f);};exports[_0x4d0e('0x25')]=function(_0x25043b,_0x47951d,_0x2ba42a,_0x1eb479,_0x493a65){return sendNotification(![],_0x25043b,_0x47951d,_0x2ba42a,_0x1eb479,_0x493a65);};exports[_0x4d0e('0x26')]=function(_0x5ad65a,_0x519765,_0x2127b4){var _0x1073c6=_0x519765[_0x4d0e('0x27')][_0x4d0e('0x28')];if(!_0x1073c6&&_0x2127b4){_0x1073c6=_0x2127b4['id'];}var _0x17f7c2=_[_0x4d0e('0x29')](_0x5ad65a[_0x519765[_0x4d0e('0x2a')]+'QueuesWaitingInteractions'],function(_0x474769){var _0x488e21=_['capitalize'](_0x519765[_0x4d0e('0x2a')])+_0x4d0e('0x2b');return _0x474769[_0x488e21]===_0x519765[_0x4d0e('0x27')]['id'];});if(!_0x17f7c2&&_0x1073c6&&_0x5ad65a[_0x4d0e('0x2c')][_0x1073c6]){_0x17f7c2=_[_0x4d0e('0x29')](_0x5ad65a[_0x4d0e('0x2c')][_0x1073c6][_0x519765['channel']+_0x4d0e('0x2d')],function(_0x7140af){return _0x7140af['id']===_0x519765[_0x4d0e('0x27')]['id'];});}return _0x17f7c2;};exports[_0x4d0e('0x2e')]=function(_0x4c6a8e,_0xcf1a38,_0x98755a,_0x20ee9e){if(_0x98755a&&_0x98755a['id']&&_0x4c6a8e[_0x4d0e('0x2c')]&&_0x4c6a8e[_0x4d0e('0x2c')][_0x98755a['id']]){_0x4c6a8e[_0x4d0e('0x2c')][_0x98755a['id']][_0x20ee9e+_0x4d0e('0x2d')][_0xcf1a38['message']['id']]={'id':_0xcf1a38[_0x4d0e('0x27')]['id']};}};exports[_0x4d0e('0x2f')]=function(_0x5dc542,_0x34578c,_0x7909df,_0x25eab1){if(_0x7909df&&_0x7909df['id']&&_0x5dc542[_0x4d0e('0x2c')]&&_0x5dc542[_0x4d0e('0x2c')][_0x7909df['id']]){delete _0x5dc542[_0x4d0e('0x2c')][_0x7909df['id']][_0x25eab1+_0x4d0e('0x2d')][_0x34578c[_0x4d0e('0x13')]['id']];}};exports[_0x4d0e('0x30')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index d01b1a7..5255bcd 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 _0xe1bc=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x5a97d2,_0x508930){var _0x26e642=function(_0x102d3c){while(--_0x102d3c){_0x5a97d2['push'](_0x5a97d2['shift']());}};_0x26e642(++_0x508930);}(_0xe1bc,0xf4));var _0xce1b=function(_0x26d6a2,_0x25cc1e){_0x26d6a2=_0x26d6a2-0x0;var _0x11165f=_0xe1bc[_0x26d6a2];return _0x11165f;};'use strict';var schema=require('validate');var sh=require(_0xce1b('0x0'));var _=require(_0xce1b('0x1'));var utils=require(_0xce1b('0x2'));var logger=require(_0xce1b('0x3'))(_0xce1b('0x4'));var system=schema({'command':{'type':_0xce1b('0x5'),'required':!![],'message':_0xce1b('0x6')}});exports[_0xce1b('0x7')]=function(_0x208d53,_0x3ee979){return function(_0x3cdbda){try{var _0x2700a0={'command':_0x3ee979[0x0]};var _0x286300=system['validate'](_0x2700a0,{'typecast':!![]});if(_0x286300['length']){logger[_0xce1b('0x8')](_0xce1b('0x9'),_0x208d53,_[_0xce1b('0xa')](_0x286300,'message')[_0xce1b('0xb')](',\x20'));logger[_0xce1b('0xc')](_0xce1b('0xd'),_0x208d53);_0x3cdbda[_0xce1b('0xe')]();}else{var _0x17b8eb=this;var _0x3d43ea=utils[_0xce1b('0xf')](_0x3ee979[0x0],this);logger[_0xce1b('0xc')](_0xce1b('0x10'),_0x208d53,_0x3d43ea);sh[_0xce1b('0x11')](_['trim'](_0x3d43ea),function(_0x549693,_0x52bce3){logger[_0xce1b('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x208d53,_0x549693);if(_0x549693==0x0){var _0x3c734a=_0x52bce3[_0xce1b('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3ee979[0x1])||_[_0xce1b('0x13')](_0x3ee979[0x1])){logger[_0xce1b('0xc')](_0xce1b('0x14'),_0x208d53);_0x17b8eb[_0xce1b('0x15')][_0x3ee979[0x1]]=_0x3c734a;}else{logger[_0xce1b('0xc')](_0xce1b('0x16'),_0x208d53,_0x3ee979[0x1],_0x3c734a);_0x17b8eb[_0xce1b('0x15')][_0x3ee979[0x1]]=_0x3c734a;}}_0x3cdbda[_0xce1b('0xe')]();});}}catch(_0x1a35d6){logger[_0xce1b('0x8')](_0xce1b('0x9'),_0x208d53,_[_0xce1b('0x17')](_0x1a35d6)?JSON[_0xce1b('0x18')](_0x1a35d6):_0x1a35d6);logger[_0xce1b('0xc')](_0xce1b('0xd'),_0x208d53);_0x3cdbda[_0xce1b('0xe')]();}};}; \ No newline at end of file +var _0x12b3=['[%s][SYSTEM]\x20%s','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','[%s][SYSTEM]\x20no\x20variable','body','next','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x3da1c5,_0x53f43f){var _0x20d262=function(_0x5b914f){while(--_0x5b914f){_0x3da1c5['push'](_0x3da1c5['shift']());}};_0x20d262(++_0x53f43f);}(_0x12b3,0xf0));var _0x312b=function(_0x1ffabf,_0x24b017){_0x1ffabf=_0x1ffabf-0x0;var _0x1c940c=_0x12b3[_0x1ffabf];return _0x1c940c;};'use strict';var schema=require(_0x312b('0x0'));var sh=require(_0x312b('0x1'));var _=require('lodash');var utils=require(_0x312b('0x2'));var logger=require(_0x312b('0x3'))(_0x312b('0x4'));var system=schema({'command':{'type':_0x312b('0x5'),'required':!![],'message':_0x312b('0x6')}});exports[_0x312b('0x7')]=function(_0x162eba,_0x33e5cb){return function(_0x1bf0f6){try{var _0x39f7fd={'command':_0x33e5cb[0x0]};var _0x47daf3=system[_0x312b('0x0')](_0x39f7fd,{'typecast':!![]});if(_0x47daf3[_0x312b('0x8')]){logger[_0x312b('0x9')](_0x312b('0xa'),_0x162eba,_[_0x312b('0xb')](_0x47daf3,_0x312b('0xc'))[_0x312b('0xd')](',\x20'));logger[_0x312b('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x162eba);_0x1bf0f6['next']();}else{var _0x3924c8=this;var _0x19542f=utils[_0x312b('0xf')](_0x33e5cb[0x0],this);logger[_0x312b('0xe')](_0x312b('0x10'),_0x162eba,_0x19542f);sh['exec'](_[_0x312b('0x11')](_0x19542f),function(_0x74ce44,_0x210cbc){logger[_0x312b('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x162eba,_0x74ce44);if(_0x74ce44==0x0){var _0x4a9dc1=_0x210cbc[_0x312b('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x33e5cb[0x1])||_['isEmpty'](_0x33e5cb[0x1])){logger[_0x312b('0xe')](_0x312b('0x13'),_0x162eba);_0x3924c8[_0x312b('0x14')][_0x33e5cb[0x1]]=_0x4a9dc1;}else{logger[_0x312b('0xe')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x162eba,_0x33e5cb[0x1],_0x4a9dc1);_0x3924c8[_0x312b('0x14')][_0x33e5cb[0x1]]=_0x4a9dc1;}}_0x1bf0f6[_0x312b('0x15')]();});}}catch(_0x2fadc4){logger[_0x312b('0x9')](_0x312b('0xa'),_0x162eba,_[_0x312b('0x16')](_0x2fadc4)?JSON[_0x312b('0x17')](_0x2fadc4):_0x2fadc4);logger[_0x312b('0xe')](_0x312b('0x18'),_0x162eba);_0x1bf0f6[_0x312b('0x15')]();}};}; \ 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 c54b09b..1ea3f07 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 _0xe4bf=['../../rpc/smsInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x3d34f0,_0x4a5dc0){var _0x135ecd=function(_0x9a81d5){while(--_0x9a81d5){_0x3d34f0['push'](_0x3d34f0['shift']());}};_0x135ecd(++_0x4a5dc0);}(_0xe4bf,0x89));var _0xfe4b=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0xe4bf[_0x45313f];return _0x402910;};'use strict';var schema=require(_0xfe4b('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xfe4b('0x1')),'openchannelInteraction':require(_0xfe4b('0x2')),'smsInteraction':require(_0xfe4b('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xfe4b('0x4'))(_0xfe4b('0x5'));var tag=schema({'tag':{'type':_0xfe4b('0x6'),'required':!![],'message':_0xfe4b('0x7')}});exports[_0xfe4b('0x8')]=function(_0x18dc2a,_0x3f2342,_0x2fa776,_0x220431){return function(_0x426084){try{var _0x21b845={'tag':_0x3f2342[0x0]};var _0x5b3993=tag[_0xfe4b('0x0')](_0x21b845,{'typecast':!![]});if(_0x5b3993[_0xfe4b('0x9')]){logger[_0xfe4b('0xa')](_0xfe4b('0xb'),_0x18dc2a,_[_0xfe4b('0xc')](_0x5b3993,_0xfe4b('0xd'))[_0xfe4b('0xe')](',\x20'));logger[_0xfe4b('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x18dc2a);_0x426084[_0xfe4b('0x10')]();}else{var _0x18ae62={'ids':[_0x3f2342[0x0]]};if(rpc[_0x220431['channel']+_0xfe4b('0x11')]){rpc[_0x220431[_0xfe4b('0x12')]+_0xfe4b('0x11')][_0xfe4b('0x13')](_0x220431[_0xfe4b('0x14')]['id'],_0x18ae62)[_0xfe4b('0x15')](function(_0x9e5c9c){logger[_0xfe4b('0xf')](_0xfe4b('0x16'),_0x18dc2a,_0x3f2342[0x1],_0x220431['channel'],_0x220431[_0xfe4b('0x14')]['id']);})[_0xfe4b('0x17')](function(_0x4bd63d){logger[_0xfe4b('0xa')](_0xfe4b('0xb'),_0x18dc2a,JSON[_0xfe4b('0x18')](_0x4bd63d));logger['info'](_0xfe4b('0x19'),_0x18dc2a);})[_0xfe4b('0x1a')](function(){_0x426084[_0xfe4b('0x10')]();});}}}catch(_0x4b1d92){logger['error'](_0xfe4b('0xb'),_0x18dc2a,_[_0xfe4b('0x1b')](_0x4b1d92)?JSON['stringify'](_0x4b1d92):_0x4b1d92);logger[_0xfe4b('0xf')](_0xfe4b('0x19'),_0x18dc2a);_0x426084[_0xfe4b('0x10')]();}};}; \ No newline at end of file +var _0x0f6d=['[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','message','join','info','channel','Interaction','addTags','interaction','then'];(function(_0x1e55f9,_0x2f78ec){var _0x5acf93=function(_0x4cff5c){while(--_0x4cff5c){_0x1e55f9['push'](_0x1e55f9['shift']());}};_0x5acf93(++_0x2f78ec);}(_0x0f6d,0x73));var _0xd0f6=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x0f6d[_0x3c8e9a];return _0x2d4c57;};'use strict';var schema=require(_0xd0f6('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xd0f6('0x1')),'openchannelInteraction':require(_0xd0f6('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xd0f6('0x3')),'faxInteraction':require(_0xd0f6('0x4')),'whatsappInteraction':require(_0xd0f6('0x5'))};var logger=require('../../../../config/logger')(_0xd0f6('0x6'));var tag=schema({'tag':{'type':_0xd0f6('0x7'),'required':!![],'message':_0xd0f6('0x8')}});exports[_0xd0f6('0x9')]=function(_0x4a121a,_0x11c916,_0x3d96e7,_0x594d47){return function(_0x2c22d1){try{var _0x491ed6={'tag':_0x11c916[0x0]};var _0x602e56=tag[_0xd0f6('0x0')](_0x491ed6,{'typecast':!![]});if(_0x602e56['length']){logger['error'](_0xd0f6('0xa'),_0x4a121a,_[_0xd0f6('0xb')](_0x602e56,_0xd0f6('0xc'))[_0xd0f6('0xd')](',\x20'));logger[_0xd0f6('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4a121a);_0x2c22d1['next']();}else{var _0x3464a7={'ids':[_0x11c916[0x0]]};if(rpc[_0x594d47[_0xd0f6('0xf')]+_0xd0f6('0x10')]){rpc[_0x594d47[_0xd0f6('0xf')]+_0xd0f6('0x10')][_0xd0f6('0x11')](_0x594d47[_0xd0f6('0x12')]['id'],_0x3464a7)[_0xd0f6('0x13')](function(_0x24b522){logger[_0xd0f6('0xe')](_0xd0f6('0x14'),_0x4a121a,_0x11c916[0x1],_0x594d47[_0xd0f6('0xf')],_0x594d47['interaction']['id']);})[_0xd0f6('0x15')](function(_0x56c24d){logger[_0xd0f6('0x16')](_0xd0f6('0xa'),_0x4a121a,JSON[_0xd0f6('0x17')](_0x56c24d));logger[_0xd0f6('0xe')](_0xd0f6('0x18'),_0x4a121a);})['finally'](function(){_0x2c22d1[_0xd0f6('0x19')]();});}}}catch(_0x13d0d5){logger[_0xd0f6('0x16')](_0xd0f6('0xa'),_0x4a121a,_[_0xd0f6('0x1a')](_0x13d0d5)?JSON[_0xd0f6('0x17')](_0x13d0d5):_0x13d0d5);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4a121a);_0x2c22d1[_0xd0f6('0x19')]();}};}; \ 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 5e33c03..5eaae14 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 _0x19c4=['channelId=','&serviceId=','&sessionId=','&data=','info','catch','error','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','push','params','stringify','utf8','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application'];(function(_0x1d06c,_0x5548b3){var _0x247024=function(_0x55f76a){while(--_0x55f76a){_0x1d06c['push'](_0x1d06c['shift']());}};_0x247024(++_0x5548b3);}(_0x19c4,0x196));var _0x419c=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x19c4[_0x2e913b];return _0x173899;};'use strict';var rp=require(_0x419c('0x0'));var logger=require(_0x419c('0x1'))(_0x419c('0x2'));var _=require(_0x419c('0x3'));var arr=[];exports['consequence']=function(_0x4e1024,_0x59c7d3){return function(_0x57cc34){var _0x3ab50f=_0x59c7d3[0xa];var _0x440ad9=_0x59c7d3[0xb];var _0x3a1605=_0x59c7d3[0xc];var _0x5ded05=_0x59c7d3[0xd];var _0x4bf888=_0x59c7d3[0xe];var _0x22fc53=_0x59c7d3[0xf][_0x419c('0x4')](/\n/g,_0x419c('0x5'));var _0x276245=_0x59c7d3[0x10][_0x419c('0x4')](/\n/g,'\x20');if(!arr[_0x419c('0x6')](_0x440ad9)){arr['push'](_0x440ad9);var _0x720c7a=_0x59c7d3[0x3];var _0x3dd6e4=_0x59c7d3[0x4];var _0x5128f7=_0x59c7d3[0x1];var _0x42963a=_0x59c7d3[0x0];var _0x534b9b={};_0x534b9b[_0x419c('0x7')]=_0x59c7d3[0x8]+_0x419c('0x8')+_0x3a1605+'|'+_0x3ab50f+'|'+_0x5ded05+'|'+_0x440ad9+'|'+_0x4bf888;_0x534b9b[_0x419c('0x9')]=_0x59c7d3[0x7]+_0x419c('0x8')+_0x3a1605+'|'+_0x3ab50f+'|'+_0x5ded05+'|'+_0x440ad9+'|'+_0x4bf888+'|'+_0x22fc53+'|'+_0x276245;_0x534b9b[_0x419c('0xa')]=_0x59c7d3[0x9];var _0x50a8b7={};_0x50a8b7[_0x419c('0xb')]=_0x419c('0xc');_0x50a8b7[_0x419c('0xd')]='login';var _0x1cc372=[];_0x1cc372[_0x419c('0xe')](_0x59c7d3[0x2]);_0x1cc372[_0x419c('0xe')](_0x59c7d3[0x5]);_0x1cc372[_0x419c('0xe')](_0x59c7d3[0x6]);_0x50a8b7[_0x419c('0xf')]=_0x1cc372;_0x50a8b7['id']=0x1;var _0x31e7b2=JSON[_0x419c('0x10')](_0x50a8b7);var _0x439821={'encoding':_0x419c('0x11'),'method':'POST','timeout':0x2710,'url':_0x720c7a,'headers':{'Content-Type':'application/json-rpc'},'body':_0x31e7b2};return rp(_0x439821)[_0x419c('0x12')](function(_0x1f659b){const _0x2194e5=JSON[_0x419c('0x13')](_0x1f659b);if(!_0x2194e5[_0x419c('0x14')][_0x419c('0x15')]){throw new Error(_0x419c('0x16'));}var _0x3fb9c1=_0x440ad9;var _0x31539f=_0x419c('0x17')+_0x5128f7+_0x419c('0x18')+_0x42963a+_0x419c('0x19')+_0x3fb9c1+_0x419c('0x1a')+JSON[_0x419c('0x10')](_0x534b9b);var _0x39f0f1=_0x3dd6e4+'?'+_0x31539f;return rp(_0x39f0f1);})[_0x419c('0x12')](function(_0x304198){logger[_0x419c('0x1b')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4e1024,_0x304198);_0x57cc34['stop']();})[_0x419c('0x1c')](function(_0x394120){logger[_0x419c('0x1d')]('[%s][TVOX]\x20%s',_0x4e1024,_['isObject'](_0x394120)?JSON[_0x419c('0x10')](_0x394120):_0x394120);_0x57cc34[_0x419c('0x1e')]();});}else{logger[_0x419c('0x1b')](_0x419c('0x1f'),_0x4e1024);_0x57cc34[_0x419c('0x20')]();}};}; \ No newline at end of file +var _0x4f67=['&serviceId=','&sessionId=','&data=','then','info','stop','catch','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','parse','result'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0x4f67,0x1aa));var _0x74f6=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0x4f67[_0x8b631b];return _0x3e6832;};'use strict';var rp=require(_0x74f6('0x0'));var logger=require(_0x74f6('0x1'))(_0x74f6('0x2'));var _=require(_0x74f6('0x3'));var arr=[];exports[_0x74f6('0x4')]=function(_0x3f7b54,_0x1fbbfd){return function(_0x2fcbf6){var _0x1498d9=_0x1fbbfd[0xa];var _0x5f0659=_0x1fbbfd[0xb];var _0x5a1214=_0x1fbbfd[0xc];var _0x5e2ae8=_0x1fbbfd[0xd];var _0x14351a=_0x1fbbfd[0xe];var _0x176f5c=_0x1fbbfd[0xf][_0x74f6('0x5')](/\n/g,_0x74f6('0x6'));var _0xd44303=_0x1fbbfd[0x10][_0x74f6('0x5')](/\n/g,'\x20');if(!arr[_0x74f6('0x7')](_0x5f0659)){arr[_0x74f6('0x8')](_0x5f0659);var _0x659fe6=_0x1fbbfd[0x3];var _0x5e680a=_0x1fbbfd[0x4];var _0x41e3ee=_0x1fbbfd[0x1];var _0xcbea64=_0x1fbbfd[0x0];var _0xa85c92={};_0xa85c92[_0x74f6('0x9')]=_0x1fbbfd[0x8]+_0x74f6('0xa')+_0x5a1214+'|'+_0x1498d9+'|'+_0x5e2ae8+'|'+_0x5f0659+'|'+_0x14351a;_0xa85c92[_0x74f6('0xb')]=_0x1fbbfd[0x7]+_0x74f6('0xa')+_0x5a1214+'|'+_0x1498d9+'|'+_0x5e2ae8+'|'+_0x5f0659+'|'+_0x14351a+'|'+_0x176f5c+'|'+_0xd44303;_0xa85c92['title']=_0x1fbbfd[0x9];var _0xf28e61={};_0xf28e61['jsonrpc']=_0x74f6('0xc');_0xf28e61[_0x74f6('0xd')]=_0x74f6('0xe');var _0x6564d1=[];_0x6564d1['push'](_0x1fbbfd[0x2]);_0x6564d1[_0x74f6('0x8')](_0x1fbbfd[0x5]);_0x6564d1[_0x74f6('0x8')](_0x1fbbfd[0x6]);_0xf28e61[_0x74f6('0xf')]=_0x6564d1;_0xf28e61['id']=0x1;var _0x1fcbb2=JSON[_0x74f6('0x10')](_0xf28e61);var _0x57c504={'encoding':_0x74f6('0x11'),'method':_0x74f6('0x12'),'timeout':0x2710,'url':_0x659fe6,'headers':{'Content-Type':_0x74f6('0x13')},'body':_0x1fcbb2};return rp(_0x57c504)['then'](function(_0x39dc85){const _0x38c57c=JSON[_0x74f6('0x14')](_0x39dc85);if(!_0x38c57c[_0x74f6('0x15')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x54f7ba=_0x5f0659;var _0x244f2c='channelId='+_0x41e3ee+_0x74f6('0x16')+_0xcbea64+_0x74f6('0x17')+_0x54f7ba+_0x74f6('0x18')+JSON[_0x74f6('0x10')](_0xa85c92);var _0x147720=_0x5e680a+'?'+_0x244f2c;return rp(_0x147720);})[_0x74f6('0x19')](function(_0x212c9b){logger[_0x74f6('0x1a')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x3f7b54,_0x212c9b);_0x2fcbf6[_0x74f6('0x1b')]();})[_0x74f6('0x1c')](function(_0x10c3ce){logger['error']('[%s][TVOX]\x20%s',_0x3f7b54,_[_0x74f6('0x1d')](_0x10c3ce)?JSON[_0x74f6('0x10')](_0x10c3ce):_0x10c3ce);_0x2fcbf6[_0x74f6('0x1b')]();});}else{logger[_0x74f6('0x1a')](_0x74f6('0x1e'),_0x3f7b54);_0x2fcbf6[_0x74f6('0x1f')]();}};}; \ 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 8d39ab9..dc89ed2 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x6af4d9,_0x45c018){var _0x33d405=function(_0x382274){while(--_0x382274){_0x6af4d9['push'](_0x6af4d9['shift']());}};_0x33d405(++_0x45c018);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x3fffd8,_0x23cea6){var _0x526f1f=function(_0x5c1982){while(--_0x5c1982){_0x3fffd8['push'](_0x3fffd8['shift']());}};_0x526f1f(++_0x23cea6);}(_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 9f81a6e..0bfed34 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 _0xdf4d=['http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','join','app','toLowerCase','appdata','split','mail','push','slice','dialogflow','amazonlex','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','end','update','UserId','catch','error\x20update\x20queue\x20report','busyQueue','message\x20is\x20empty','hasOwnProperty','capacity','agent\x20not\x20found','chatQueues','name','paused','waiting','mailQueues','available','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server'];(function(_0x3decce,_0x6b2739){var _0x49b330=function(_0x2e9ea7){while(--_0x2e9ea7){_0x3decce['push'](_0x3decce['shift']());}};_0x49b330(++_0x6b2739);}(_0xdf4d,0xcb));var _0xddf4=function(_0x26199c,_0x5edb0c){_0x26199c=_0x26199c-0x0;var _0x58f248=_0xdf4d[_0x26199c];return _0x58f248;};'use strict';var _=require('lodash');var util=require(_0xddf4('0x0'));var path=require(_0xddf4('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xddf4('0x2'));var utils=require(_0xddf4('0x3'));var sUtils=require(_0xddf4('0x4'));var logger=require(_0xddf4('0x5'))(_0xddf4('0x6'));var rpc={'openchannelQueueReport':require(_0xddf4('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xddf4('0x8')),'faxQueueReport':require(_0xddf4('0x9')),'whatsappQueueReport':require(_0xddf4('0xa'))};var RuleEngine=require(_0xddf4('0xb'));function getId(_0x2d2ccd,_0x76de3b,_0x3ab323){return util[_0xddf4('0xc')](_0xddf4('0xd'),_0x2d2ccd,_0x76de3b||0x0,_0x3ab323||0x0);}function getIntervals(_0x1e76fd,_0x338210){var _0x52f69f=[];if(!_[_0xddf4('0xe')](_0x338210['IntervalId'])&&!_[_0xddf4('0xe')](_0x1e76fd[_0x338210[_0xddf4('0xf')]])&&!_[_0xddf4('0xe')](_0x1e76fd[_0x338210[_0xddf4('0xf')]]['Intervals'])){_0x52f69f=_[_0xddf4('0x10')](_0x1e76fd[_0x338210[_0xddf4('0xf')]][_0xddf4('0x11')],_0xddf4('0x12'));}else if(!_['isNil'](_0x338210['interval'])){_0x52f69f=[_0x338210[_0xddf4('0x12')]];}return _0x52f69f;}exports['listen']=function(_0x1d3773){_0x1d3773[_0xddf4('0x13')]={};return new BPromise(function(_0x3754f5,_0x276ab2){var _0x3ef3a1={'Start':function(_0x48412e){var _0x151b7b=this;return new Promise(function(_0x5a8cba,_0x13c576){if(_0x48412e){try{var _0x464288=[];var _0x111e2e=getId(_0x48412e[_0xddf4('0x14')],_0x48412e[_0xddf4('0x15')]?_0x48412e[_0xddf4('0x15')]['id']:0x0,_0x48412e[_0xddf4('0x16')]?_0x48412e['interaction']['id']:0x0);var _0x49e4d3=sUtils[_0xddf4('0x17')](_0x1d3773,_0x48412e);if(_0x48412e[_0xddf4('0x18')]||!_0x49e4d3&&_0x48412e['applications']&&_['isArray'](_0x48412e['applications'])&&_0x48412e[_0xddf4('0x19')][_0xddf4('0x1a')]){for(var _0x459a71=0x0;_0x459a71<_0x48412e[_0xddf4('0x19')][_0xddf4('0x1a')];_0x459a71+=0x1){var _0x56ec8f=_0x48412e[_0xddf4('0x19')][_0x459a71];if(fs['existsSync'](path[_0xddf4('0x1b')](__dirname,_0xddf4('0x19'),_0x56ec8f[_0xddf4('0x1c')]+'.js'))){var _0x1f7a04=[];switch(_0x56ec8f[_0xddf4('0x1c')][_0xddf4('0x1d')]()){case'autoreply':var _0x2ee748=_0x56ec8f[_0xddf4('0x1e')][_0xddf4('0x1f')](',');if(_0x48412e[_0xddf4('0x14')]===_0xddf4('0x20')){_0x1f7a04[_0xddf4('0x21')](_0x2ee748[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x2ee748[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x2ee748[_0xddf4('0x22')](0x2,_0x2ee748[_0xddf4('0x1a')])[_0xddf4('0x1b')](','));}else{_0x1f7a04['push'](_0x2ee748[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x2ee748['slice'](0x1,_0x2ee748[_0xddf4('0x1a')])[_0xddf4('0x1b')](','));}break;case _0xddf4('0x23'):var _0x67dbb1=_0x56ec8f[_0xddf4('0x1e')][_0xddf4('0x1f')](',');_0x1f7a04[_0xddf4('0x21')](_0x67dbb1[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x67dbb1[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x67dbb1[_0xddf4('0x22')](0x2,_0x67dbb1[_0xddf4('0x1a')])['join'](','));break;case'dialogflowv2':var _0x5980f7=_0x56ec8f[_0xddf4('0x1e')]['split'](',');_0x1f7a04[_0xddf4('0x21')](_0x5980f7[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x5980f7[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x5980f7[0x2]);_0x1f7a04[_0xddf4('0x21')](_0x5980f7[0x3]);_0x1f7a04['push'](_0x5980f7['slice'](0x4,_0x5980f7[_0xddf4('0x1a')])[_0xddf4('0x1b')](','));break;case _0xddf4('0x24'):var _0x4f5d91=_0x56ec8f[_0xddf4('0x1e')][_0xddf4('0x1f')](',');_0x1f7a04[_0xddf4('0x21')](_0x4f5d91[0x0]);_0x1f7a04['push'](_0x4f5d91[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x4f5d91[0x2]);_0x1f7a04[_0xddf4('0x21')](_0x4f5d91[0x3]);_0x1f7a04['push'](_0x4f5d91['slice'](0x4,_0x4f5d91[_0xddf4('0x1a')])['join'](','));break;case _0xddf4('0x15'):_0x1f7a04[_0xddf4('0x21')](_0x56ec8f['appdata']);break;case'tag':_0x1f7a04[_0xddf4('0x21')](_0x56ec8f['TagId']);_0x1f7a04[_0xddf4('0x21')](_0x56ec8f[_0xddf4('0x1e')]);break;case _0xddf4('0x25'):var _0x3c2c21=utils[_0xddf4('0x26')](_0x48412e[_0xddf4('0x27')][_0xddf4('0x28')],_0x48412e);var _0x4715b6=_0x56ec8f[_0xddf4('0x1e')][_0xddf4('0x1f')](',');_0x1f7a04['push'](_0x4715b6[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x2]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x3]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x4]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x5]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x6]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x7]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x8]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x9]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0xa]);_0x1f7a04[_0xddf4('0x21')](_0x48412e[_0xddf4('0x16')]['id']);_0x1f7a04[_0xddf4('0x21')](_0x48412e['message']['id']);_0x1f7a04[_0xddf4('0x21')](_0x56ec8f[_0xddf4('0x29')]);_0x1f7a04['push'](_0x48412e[_0xddf4('0x16')][_0xddf4('0x2a')]);_0x1f7a04[_0xddf4('0x21')](_0x48412e[_0xddf4('0x2b')][_0xddf4('0x2b')]);_0x1f7a04[_0xddf4('0x21')](_0x3c2c21);break;default:_0x1f7a04=_[_0xddf4('0xe')](_0x56ec8f[_0xddf4('0x1e')])?[]:_0x56ec8f['appdata'][_0xddf4('0x1f')](',');}var _0x5231d5={'id':util['format'](_0xddf4('0x2c'),_0x111e2e,_0x56ec8f['id'],_0x56ec8f[_0xddf4('0x1c')]),'condition':require(_0xddf4('0x2d'))[_0xddf4('0x2e')](_0x111e2e,getIntervals(_0x1d3773[_0xddf4('0x2f')],_0x56ec8f),_0x1d3773),'consequence':require('./applications/'+_0x56ec8f[_0xddf4('0x1c')])[_0xddf4('0x30')](_0x111e2e,_0x1f7a04,_0x1d3773,_0x48412e),'p':_0x56ec8f[_0xddf4('0x31')]||0x0};logger[_0xddf4('0x32')](_0xddf4('0x33'),_0x5231d5['id'],_0xddf4('0x34'),getIntervals(_0x1d3773[_0xddf4('0x2f')],_0x56ec8f)[_0xddf4('0x1b')](_0xddf4('0x35')));_0x464288[_0xddf4('0x21')](_0x5231d5);}else{logger[_0xddf4('0x36')](_0xddf4('0x37'),path[_0xddf4('0x1b')](__dirname,'applications',_0x56ec8f[_0xddf4('0x1c')]+_0xddf4('0x38')));}}_0x1d3773['rules'][_0x111e2e]=new RuleEngine(_0x464288);_0x1d3773[_0xddf4('0x13')][_0x111e2e][_0xddf4('0x39')](_0x48412e,function(_0x21d4f3){logger[_0xddf4('0x32')](_0xddf4('0x3a'),JSON[_0xddf4('0x3b')](_0x21d4f3[_0xddf4('0x3c')]));if(_0x1d3773[_0xddf4('0x13')][_0x111e2e]){_0x1d3773[_0xddf4('0x13')][_0x111e2e][_0xddf4('0x3d')](_0xddf4('0x3e'));}});return _0x5a8cba({'code':0xc8,'message':_0x48412e});}else{if(_0x49e4d3){logger[_0xddf4('0x32')](util['format']('Skipped\x20routing\x20for\x20%s',_0x111e2e));}else{logger[_0xddf4('0x32')](_0xddf4('0x3f'));}return _0x5a8cba({'code':0xc8,'message':_0x48412e});}}catch(_0x211ea9){logger[_0xddf4('0x36')](_0x211ea9[_0xddf4('0x40')]);return _0x13c576(_0x151b7b[_0xddf4('0x36')](0x1f4,_0x211ea9));}}return _0x13c576('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2c9db6){var _0x7953bd=this;return new Promise(function(_0x584395,_0x2053f0){if(_0x2c9db6[_0xddf4('0x41')]&&_0x2c9db6[_0xddf4('0x41')]['id']){if(_0x1d3773[_0xddf4('0x42')][_0x2c9db6['agent']['id']]){_0x1d3773[_0xddf4('0x42')][_0x2c9db6[_0xddf4('0x41')]['id']]['busy']=![];_0x1d3773['agents'][_0x2c9db6[_0xddf4('0x41')]['id']]['busyQueue']=undefined;}}if(_0x2c9db6[_0xddf4('0x15')]&&_0x2c9db6[_0xddf4('0x15')]['id']){try{var _0x303d34=getId(_0x2c9db6[_0xddf4('0x14')],_0x2c9db6['message']?_0x2c9db6[_0xddf4('0x15')]['id']:0x0,_0x2c9db6[_0xddf4('0x16')]?_0x2c9db6['interaction']['id']:0x0);if(_0x1d3773[_0xddf4('0x13')][_0x303d34]){_0x1d3773['rules'][_0x303d34][_0xddf4('0x3d')](_0xddf4('0x43'));if(rpc[_0x2c9db6[_0xddf4('0x14')]+'QueueReport']){rpc[_0x2c9db6[_0xddf4('0x14')]+'QueueReport'][_0xddf4('0x44')](_0x303d34,{'UserId':_0x2c9db6['message'][_0xddf4('0x45')]})[_0xddf4('0x46')](function(){logger[_0xddf4('0x36')](_0xddf4('0x47'));});}}return _0x584395({'code':0xc8,'message':_0x2c9db6});}catch(_0x112eca){logger['error'](_0x112eca[_0xddf4('0x40')]);return _0x2053f0(_0x7953bd[_0xddf4('0x36')](0x1f4,_0x112eca));}}logger[_0xddf4('0x36')]('message\x20is\x20empty');return _0x2053f0(_0x7953bd[_0xddf4('0x36')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x184c25){var _0x1c49a0=this;return new Promise(function(_0x7e031b,_0x196e96){if(_0x184c25[_0xddf4('0x41')]&&_0x184c25[_0xddf4('0x41')]['id']){try{if(_0x1d3773['agents'][_0x184c25[_0xddf4('0x41')]['id']]){_0x1d3773[_0xddf4('0x42')][_0x184c25[_0xddf4('0x41')]['id']]['busy']=![];_0x1d3773[_0xddf4('0x42')][_0x184c25[_0xddf4('0x41')]['id']][_0xddf4('0x48')]=undefined;}return _0x7e031b({'code':0xc8,'message':_0x184c25});}catch(_0x2789c4){logger[_0xddf4('0x36')](_0x2789c4['stack']);return _0x196e96(_0x1c49a0['error'](0x1f4,_0x2789c4));}}logger['error'](_0xddf4('0x49'));return _0x196e96(_0x1c49a0[_0xddf4('0x36')](0x1f4,_0xddf4('0x49')));});},'AbandonInteraction':function(_0x36f286){var _0x1ae44c=this;return new Promise(function(_0x5c46b0,_0x841198){if(_0x36f286[_0xddf4('0x14')]&&_0x36f286[_0xddf4('0x16')]&&_0x36f286['interaction']['id']){try{var _0x364812=getId(_0x36f286[_0xddf4('0x14')],_0x36f286[_0xddf4('0x15')]?_0x36f286['message']['id']:0x0,_0x36f286[_0xddf4('0x16')]?_0x36f286[_0xddf4('0x16')]['id']:0x0);if(_0x1d3773['rules'][_0x364812]){_0x1d3773[_0xddf4('0x13')][_0x364812][_0xddf4('0x3d')](_0xddf4('0x43'));}return _0x5c46b0({'code':0xc8,'message':_0x36f286});}catch(_0x1d06ea){logger[_0xddf4('0x36')](_0x1d06ea['stack']);return _0x841198(_0x1ae44c[_0xddf4('0x36')](0x1f4,_0x1d06ea));}}logger[_0xddf4('0x36')](_0xddf4('0x49'));return _0x841198(_0x1ae44c[_0xddf4('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x32dfbf){var _0x1b1a8c=this;return new Promise(function(_0x2eca89,_0x3ff134){if(_0x1d3773[_0xddf4('0x42')][_0xddf4('0x4a')](_0x32dfbf['id'])){for(var _0x2ed603 in _0x32dfbf[_0xddf4('0x4b')]){if(_0x32dfbf[_0xddf4('0x4b')][_0xddf4('0x4a')](_0x2ed603)){if(_0x1d3773[_0xddf4('0x42')][_0x32dfbf['id']][_0xddf4('0x4a')](_0x2ed603+'CurrentCapacity')){_0x1d3773[_0xddf4('0x42')][_0x32dfbf['id']][_0x2ed603+'CurrentCapacity']=parseInt(_0x32dfbf['capacity'][_0x2ed603],0xa);}}}_0x1d3773[_0xddf4('0x42')][_0x32dfbf['id']]['updateRealtime']();return _0x2eca89({'code':0xc8,'message':_0x1d3773['agents'][_0x32dfbf['id']]});}else{return _0x3ff134(_0x1b1a8c[_0xddf4('0x36')](0x1f4,_0xddf4('0x4c')));}});},'Agents':function(_0x30081b){return new Promise(function(_0x461073){var _0x329bd1=_['values'](_0x1d3773['agents']);if(_0x30081b&&_0x30081b['id']){var _0x1c18f1=_['find'](_0x329bd1,function(_0x42ff2a){return _0x42ff2a['id']===_0x30081b['id'];});_0x461073(_0x1c18f1);}else{_0x461073({'count':_0x329bd1[_0xddf4('0x1a')],'rows':_0x329bd1});}});},'ChatQueues':function(){return new Promise(function(_0x48e8a4){var _0xac7777=[];for(var _0x3c75e1 in _0x1d3773[_0xddf4('0x4d')]){if(_0x1d3773[_0xddf4('0x4d')][_0xddf4('0x4a')](_0x3c75e1)){var _0x372b63=_0x1d3773['chatQueues'][_0x3c75e1];var _0x4c2ad9={'id':_0x372b63['id'],'available':_0x372b63['available'],'loggedIn':_0x372b63['loggedIn'],'name':_0x372b63[_0xddf4('0x4e')],'paused':_0x372b63[_0xddf4('0x4f')],'waiting':_0x372b63[_0xddf4('0x50')]};_0xac7777[_0xddf4('0x21')](_0x4c2ad9);}}_0x48e8a4({'count':_0xac7777[_0xddf4('0x1a')],'rows':_0xac7777});});},'MailQueues':function(){return new Promise(function(_0x24612f){var _0xb7b514=[];for(var _0x58caf1 in _0x1d3773[_0xddf4('0x51')]){if(_0x1d3773[_0xddf4('0x51')][_0xddf4('0x4a')](_0x58caf1)){var _0x52fa38=_0x1d3773[_0xddf4('0x51')][_0x58caf1];var _0x514a40={'id':_0x52fa38['id'],'available':_0x52fa38[_0xddf4('0x52')],'loggedIn':_0x52fa38['loggedIn'],'name':_0x52fa38[_0xddf4('0x4e')],'paused':_0x52fa38[_0xddf4('0x4f')],'waiting':_0x52fa38[_0xddf4('0x50')]};_0xb7b514[_0xddf4('0x21')](_0x514a40);}}_0x24612f({'count':_0xb7b514[_0xddf4('0x1a')],'rows':_0xb7b514});});},'OpenchannelQueues':function(){return new Promise(function(_0x38c7e0){var _0x35de40=[];for(var _0x340ee8 in _0x1d3773[_0xddf4('0x53')]){if(_0x1d3773[_0xddf4('0x53')][_0xddf4('0x4a')](_0x340ee8)){var _0x37b462=_0x1d3773[_0xddf4('0x53')][_0x340ee8];var _0xe37710={'id':_0x37b462['id'],'available':_0x37b462[_0xddf4('0x52')],'loggedIn':_0x37b462[_0xddf4('0x54')],'name':_0x37b462[_0xddf4('0x4e')],'paused':_0x37b462['paused'],'waiting':_0x37b462['waiting']};_0x35de40[_0xddf4('0x21')](_0xe37710);}}_0x38c7e0({'count':_0x35de40[_0xddf4('0x1a')],'rows':_0x35de40});});},'SmsQueues':function(){return new Promise(function(_0x1a700b){var _0xd9034b=[];for(var _0x332fbf in _0x1d3773[_0xddf4('0x55')]){if(_0x1d3773['smsQueues'][_0xddf4('0x4a')](_0x332fbf)){var _0x296714=_0x1d3773[_0xddf4('0x55')][_0x332fbf];var _0x4c47e2={'id':_0x296714['id'],'available':_0x296714[_0xddf4('0x52')],'loggedIn':_0x296714[_0xddf4('0x54')],'name':_0x296714[_0xddf4('0x4e')],'paused':_0x296714[_0xddf4('0x4f')],'waiting':_0x296714[_0xddf4('0x50')]};_0xd9034b[_0xddf4('0x21')](_0x4c47e2);}}_0x1a700b({'count':_0xd9034b[_0xddf4('0x1a')],'rows':_0xd9034b});});},'FaxQueues':function(){return new Promise(function(_0x53619b){var _0x417db4=[];for(var _0xc2bf9e in _0x1d3773[_0xddf4('0x56')]){if(_0x1d3773[_0xddf4('0x56')]['hasOwnProperty'](_0xc2bf9e)){var _0x525548=_0x1d3773[_0xddf4('0x56')][_0xc2bf9e];var _0x382ac7={'id':_0x525548['id'],'available':_0x525548['available'],'loggedIn':_0x525548[_0xddf4('0x54')],'name':_0x525548[_0xddf4('0x4e')],'paused':_0x525548[_0xddf4('0x4f')],'waiting':_0x525548[_0xddf4('0x50')]};_0x417db4[_0xddf4('0x21')](_0x382ac7);}}_0x53619b({'count':_0x417db4['length'],'rows':_0x417db4});});},'WhatsappQueues':function(){return new Promise(function(_0x4a286b){var _0x275572=[];for(var _0x1c1976 in _0x1d3773['whatsappQueues']){if(_0x1d3773[_0xddf4('0x57')][_0xddf4('0x4a')](_0x1c1976)){var _0x563ce0=_0x1d3773[_0xddf4('0x57')][_0x1c1976];var _0x536dc2={'id':_0x563ce0['id'],'available':_0x563ce0[_0xddf4('0x52')],'loggedIn':_0x563ce0['loggedIn'],'name':_0x563ce0[_0xddf4('0x4e')],'paused':_0x563ce0['paused'],'waiting':_0x563ce0['waiting']};_0x275572[_0xddf4('0x21')](_0x536dc2);}}_0x4a286b({'count':_0x275572[_0xddf4('0x1a')],'rows':_0x275572});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x38c764){var _0x49d894=_[_0xddf4('0x58')](_0x1d3773['chatQueuesWaitingInteractions']);_0x38c764({'count':_0x49d894[_0xddf4('0x1a')],'rows':_0x49d894});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x52e6e8){var _0x152ca7=_['values'](_0x1d3773[_0xddf4('0x59')]);_0x52e6e8({'count':_0x152ca7[_0xddf4('0x1a')],'rows':_0x152ca7});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5bffb4){var _0x426d55=_[_0xddf4('0x58')](_0x1d3773['openchannelQueuesWaitingInteractions']);_0x5bffb4({'count':_0x426d55[_0xddf4('0x1a')],'rows':_0x426d55});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2af3bd){var _0xb1325=_[_0xddf4('0x58')](_0x1d3773[_0xddf4('0x5a')]);_0x2af3bd({'count':_0xb1325[_0xddf4('0x1a')],'rows':_0xb1325});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x59259c){var _0x3f6d68=_['values'](_0x1d3773[_0xddf4('0x5b')]);_0x59259c({'count':_0x3f6d68[_0xddf4('0x1a')],'rows':_0x3f6d68});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x26273f){var _0x4ffd49=_[_0xddf4('0x58')](_0x1d3773[_0xddf4('0x5c')]);_0x26273f({'count':_0x4ffd49[_0xddf4('0x1a')],'rows':_0x4ffd49});});}};var _0x499d50=jayson[_0xddf4('0x5d')](_0x3ef3a1)[_0xddf4('0x5e')]();_0x499d50['on'](_0xddf4('0x36'),function(_0x247acc){logger['error'](JSON[_0xddf4('0x3b')](_0x247acc));return _0x276ab2(_0x247acc);});_0x499d50['listen'](0x232c,_0xddf4('0x5f'),function(){console[_0xddf4('0x60')](_0xddf4('0x61'),0x232c);return _0x3754f5(_0xddf4('0x62')+0x232c);});});}; \ No newline at end of file +var _0xcdd2=['catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','end','hasOwnProperty','capacity','CurrentCapacity','find','chatQueues','name','paused','mailQueues','available','openchannelQueues','loggedIn','waiting','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','app','toLowerCase','autoreply','split','mail','push','slice','join','dialogflow','dialogflowv2','appdata','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','intervals','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','agent','agents','busy','busyQueue','QueueReport','update','UserId'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var path=require(_0x2cdd('0x2'));var fs=require('fs');var jayson=require(_0x2cdd('0x3'));var BPromise=require('bluebird');var utils=require(_0x2cdd('0x4'));var sUtils=require(_0x2cdd('0x5'));var logger=require(_0x2cdd('0x6'))(_0x2cdd('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x2cdd('0x8')),'chatQueueReport':require(_0x2cdd('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x2cdd('0xa')),'whatsappQueueReport':require(_0x2cdd('0xb'))};var RuleEngine=require(_0x2cdd('0xc'));function getId(_0x2ff8e0,_0x506b09,_0x569943){return util['format'](_0x2cdd('0xd'),_0x2ff8e0,_0x506b09||0x0,_0x569943||0x0);}function getIntervals(_0x4cd731,_0x12cdca){var _0x3e3cf0=[];if(!_[_0x2cdd('0xe')](_0x12cdca[_0x2cdd('0xf')])&&!_[_0x2cdd('0xe')](_0x4cd731[_0x12cdca[_0x2cdd('0xf')]])&&!_[_0x2cdd('0xe')](_0x4cd731[_0x12cdca[_0x2cdd('0xf')]][_0x2cdd('0x10')])){_0x3e3cf0=_[_0x2cdd('0x11')](_0x4cd731[_0x12cdca['IntervalId']]['Intervals'],_0x2cdd('0x12'));}else if(!_[_0x2cdd('0xe')](_0x12cdca['interval'])){_0x3e3cf0=[_0x12cdca[_0x2cdd('0x12')]];}return _0x3e3cf0;}exports[_0x2cdd('0x13')]=function(_0x345b45){_0x345b45[_0x2cdd('0x14')]={};return new BPromise(function(_0x4093f,_0x5934bd){var _0x367111={'Start':function(_0x25c36d){var _0x4849bc=this;return new Promise(function(_0x159f31,_0x1c6bc7){if(_0x25c36d){try{var _0x1e8479=[];var _0x1767d5=getId(_0x25c36d[_0x2cdd('0x15')],_0x25c36d[_0x2cdd('0x16')]?_0x25c36d['message']['id']:0x0,_0x25c36d[_0x2cdd('0x17')]?_0x25c36d[_0x2cdd('0x17')]['id']:0x0);var _0x281101=sUtils[_0x2cdd('0x18')](_0x345b45,_0x25c36d);if(_0x25c36d['transfer']||!_0x281101&&_0x25c36d[_0x2cdd('0x19')]&&_[_0x2cdd('0x1a')](_0x25c36d[_0x2cdd('0x19')])&&_0x25c36d[_0x2cdd('0x19')][_0x2cdd('0x1b')]){for(var _0x871fd2=0x0;_0x871fd2<_0x25c36d[_0x2cdd('0x19')][_0x2cdd('0x1b')];_0x871fd2+=0x1){var _0x3dc9ec=_0x25c36d[_0x2cdd('0x19')][_0x871fd2];if(fs['existsSync'](path['join'](__dirname,_0x2cdd('0x19'),_0x3dc9ec['app']+'.js'))){var _0x1ea860=[];switch(_0x3dc9ec[_0x2cdd('0x1c')][_0x2cdd('0x1d')]()){case _0x2cdd('0x1e'):var _0x5bb57e=_0x3dc9ec['appdata'][_0x2cdd('0x1f')](',');if(_0x25c36d[_0x2cdd('0x15')]===_0x2cdd('0x20')){_0x1ea860[_0x2cdd('0x21')](_0x5bb57e[0x0]);_0x1ea860[_0x2cdd('0x21')](_0x5bb57e[0x1]);_0x1ea860[_0x2cdd('0x21')](_0x5bb57e[_0x2cdd('0x22')](0x2,_0x5bb57e['length'])[_0x2cdd('0x23')](','));}else{_0x1ea860[_0x2cdd('0x21')](_0x5bb57e[0x0]);_0x1ea860[_0x2cdd('0x21')](_0x5bb57e['slice'](0x1,_0x5bb57e['length'])['join'](','));}break;case _0x2cdd('0x24'):var _0xcf73db=_0x3dc9ec['appdata'][_0x2cdd('0x1f')](',');_0x1ea860[_0x2cdd('0x21')](_0xcf73db[0x0]);_0x1ea860[_0x2cdd('0x21')](_0xcf73db[0x1]);_0x1ea860[_0x2cdd('0x21')](_0xcf73db[_0x2cdd('0x22')](0x2,_0xcf73db[_0x2cdd('0x1b')])['join'](','));break;case _0x2cdd('0x25'):var _0x239fad=_0x3dc9ec[_0x2cdd('0x26')][_0x2cdd('0x1f')](',');_0x1ea860['push'](_0x239fad[0x0]);_0x1ea860[_0x2cdd('0x21')](_0x239fad[0x1]);_0x1ea860[_0x2cdd('0x21')](_0x239fad[0x2]);_0x1ea860['push'](_0x239fad[0x3]);_0x1ea860[_0x2cdd('0x21')](_0x239fad[_0x2cdd('0x22')](0x4,_0x239fad[_0x2cdd('0x1b')])[_0x2cdd('0x23')](','));break;case _0x2cdd('0x27'):var _0x41f1fd=_0x3dc9ec[_0x2cdd('0x26')][_0x2cdd('0x1f')](',');_0x1ea860[_0x2cdd('0x21')](_0x41f1fd[0x0]);_0x1ea860['push'](_0x41f1fd[0x1]);_0x1ea860[_0x2cdd('0x21')](_0x41f1fd[0x2]);_0x1ea860[_0x2cdd('0x21')](_0x41f1fd[0x3]);_0x1ea860[_0x2cdd('0x21')](_0x41f1fd['slice'](0x4,_0x41f1fd['length'])['join'](','));break;case _0x2cdd('0x16'):_0x1ea860[_0x2cdd('0x21')](_0x3dc9ec['appdata']);break;case _0x2cdd('0x28'):_0x1ea860[_0x2cdd('0x21')](_0x3dc9ec[_0x2cdd('0x29')]);_0x1ea860[_0x2cdd('0x21')](_0x3dc9ec[_0x2cdd('0x26')]);break;case'tvox':var _0x5e8bc5=utils[_0x2cdd('0x2a')](_0x25c36d[_0x2cdd('0x2b')][_0x2cdd('0x2c')],_0x25c36d);var _0x1b4bd7=_0x3dc9ec[_0x2cdd('0x26')]['split'](',');_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0x0]);_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0x1]);_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0x2]);_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0x3]);_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0x4]);_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0x5]);_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0x6]);_0x1ea860['push'](_0x1b4bd7[0x7]);_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0x8]);_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0x9]);_0x1ea860[_0x2cdd('0x21')](_0x1b4bd7[0xa]);_0x1ea860[_0x2cdd('0x21')](_0x25c36d[_0x2cdd('0x17')]['id']);_0x1ea860[_0x2cdd('0x21')](_0x25c36d[_0x2cdd('0x16')]['id']);_0x1ea860[_0x2cdd('0x21')](_0x3dc9ec[_0x2cdd('0x2d')]);_0x1ea860['push'](_0x25c36d['interaction'][_0x2cdd('0x2e')]);_0x1ea860[_0x2cdd('0x21')](_0x25c36d[_0x2cdd('0x2f')]['body']);_0x1ea860[_0x2cdd('0x21')](_0x5e8bc5);break;default:_0x1ea860=_['isNil'](_0x3dc9ec['appdata'])?[]:_0x3dc9ec[_0x2cdd('0x26')][_0x2cdd('0x1f')](',');}var _0x354824={'id':util[_0x2cdd('0x30')](_0x2cdd('0x31'),_0x1767d5,_0x3dc9ec['id'],_0x3dc9ec[_0x2cdd('0x1c')]),'condition':require(_0x2cdd('0x32'))[_0x2cdd('0x33')](_0x1767d5,getIntervals(_0x345b45[_0x2cdd('0x34')],_0x3dc9ec),_0x345b45),'consequence':require('./applications/'+_0x3dc9ec[_0x2cdd('0x1c')])[_0x2cdd('0x35')](_0x1767d5,_0x1ea860,_0x345b45,_0x25c36d),'p':_0x3dc9ec[_0x2cdd('0x36')]||0x0};logger['info'](_0x2cdd('0x37'),_0x354824['id'],_0x2cdd('0x38'),getIntervals(_0x345b45[_0x2cdd('0x34')],_0x3dc9ec)[_0x2cdd('0x23')](_0x2cdd('0x39')));_0x1e8479['push'](_0x354824);}else{logger['error'](_0x2cdd('0x3a'),path[_0x2cdd('0x23')](__dirname,_0x2cdd('0x19'),_0x3dc9ec['app']+'.js'));}}_0x345b45[_0x2cdd('0x14')][_0x1767d5]=new RuleEngine(_0x1e8479);_0x345b45[_0x2cdd('0x14')][_0x1767d5]['execute'](_0x25c36d,function(_0x4cbc66){logger[_0x2cdd('0x3b')](_0x2cdd('0x3c'),JSON[_0x2cdd('0x3d')](_0x4cbc66[_0x2cdd('0x3e')]));if(_0x345b45[_0x2cdd('0x14')][_0x1767d5]){_0x345b45[_0x2cdd('0x14')][_0x1767d5][_0x2cdd('0x3f')](_0x2cdd('0x40'));}});return _0x159f31({'code':0xc8,'message':_0x25c36d});}else{if(_0x281101){logger[_0x2cdd('0x3b')](util[_0x2cdd('0x30')](_0x2cdd('0x41'),_0x1767d5));}else{logger['info'](_0x2cdd('0x42'));}return _0x159f31({'code':0xc8,'message':_0x25c36d});}}catch(_0x1f9fb3){logger[_0x2cdd('0x43')](_0x1f9fb3['stack']);return _0x1c6bc7(_0x4849bc[_0x2cdd('0x43')](0x1f4,_0x1f9fb3));}}return _0x1c6bc7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5acb44){var _0x46fad7=this;return new Promise(function(_0x57e33b,_0x46a257){if(_0x5acb44[_0x2cdd('0x44')]&&_0x5acb44[_0x2cdd('0x44')]['id']){if(_0x345b45['agents'][_0x5acb44[_0x2cdd('0x44')]['id']]){_0x345b45[_0x2cdd('0x45')][_0x5acb44[_0x2cdd('0x44')]['id']][_0x2cdd('0x46')]=![];_0x345b45[_0x2cdd('0x45')][_0x5acb44[_0x2cdd('0x44')]['id']][_0x2cdd('0x47')]=undefined;}}if(_0x5acb44[_0x2cdd('0x16')]&&_0x5acb44['message']['id']){try{var _0x26089f=getId(_0x5acb44[_0x2cdd('0x15')],_0x5acb44[_0x2cdd('0x16')]?_0x5acb44[_0x2cdd('0x16')]['id']:0x0,_0x5acb44[_0x2cdd('0x17')]?_0x5acb44[_0x2cdd('0x17')]['id']:0x0);if(_0x345b45['rules'][_0x26089f]){_0x345b45[_0x2cdd('0x14')][_0x26089f]['emit']('end');if(rpc[_0x5acb44[_0x2cdd('0x15')]+_0x2cdd('0x48')]){rpc[_0x5acb44['channel']+'QueueReport'][_0x2cdd('0x49')](_0x26089f,{'UserId':_0x5acb44['message'][_0x2cdd('0x4a')]})[_0x2cdd('0x4b')](function(){logger[_0x2cdd('0x43')](_0x2cdd('0x4c'));});}}return _0x57e33b({'code':0xc8,'message':_0x5acb44});}catch(_0x588d4c){logger[_0x2cdd('0x43')](_0x588d4c['stack']);return _0x46a257(_0x46fad7['error'](0x1f4,_0x588d4c));}}logger['error']('message\x20is\x20empty');return _0x46a257(_0x46fad7['error'](0x1f4,_0x2cdd('0x4d')));});},'RejectMessage':function(_0x20bed3){var _0x3a99c7=this;return new Promise(function(_0x231d1c,_0x7dd297){if(_0x20bed3[_0x2cdd('0x44')]&&_0x20bed3[_0x2cdd('0x44')]['id']){try{if(_0x345b45[_0x2cdd('0x45')][_0x20bed3['agent']['id']]){_0x345b45[_0x2cdd('0x45')][_0x20bed3[_0x2cdd('0x44')]['id']][_0x2cdd('0x46')]=![];_0x345b45[_0x2cdd('0x45')][_0x20bed3[_0x2cdd('0x44')]['id']][_0x2cdd('0x47')]=undefined;}return _0x231d1c({'code':0xc8,'message':_0x20bed3});}catch(_0x369f5b){logger['error'](_0x369f5b[_0x2cdd('0x4e')]);return _0x7dd297(_0x3a99c7[_0x2cdd('0x43')](0x1f4,_0x369f5b));}}logger[_0x2cdd('0x43')](_0x2cdd('0x4d'));return _0x7dd297(_0x3a99c7[_0x2cdd('0x43')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0xf4fcbf){var _0x58513b=this;return new Promise(function(_0x5c05e8,_0x568596){if(_0xf4fcbf['channel']&&_0xf4fcbf[_0x2cdd('0x17')]&&_0xf4fcbf[_0x2cdd('0x17')]['id']){try{var _0x295d4d=getId(_0xf4fcbf[_0x2cdd('0x15')],_0xf4fcbf['message']?_0xf4fcbf[_0x2cdd('0x16')]['id']:0x0,_0xf4fcbf[_0x2cdd('0x17')]?_0xf4fcbf['interaction']['id']:0x0);if(_0x345b45[_0x2cdd('0x14')][_0x295d4d]){_0x345b45[_0x2cdd('0x14')][_0x295d4d][_0x2cdd('0x3f')](_0x2cdd('0x4f'));}return _0x5c05e8({'code':0xc8,'message':_0xf4fcbf});}catch(_0x200594){logger[_0x2cdd('0x43')](_0x200594[_0x2cdd('0x4e')]);return _0x568596(_0x58513b['error'](0x1f4,_0x200594));}}logger[_0x2cdd('0x43')](_0x2cdd('0x4d'));return _0x568596(_0x58513b[_0x2cdd('0x43')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x23bf65){var _0x535bfa=this;return new Promise(function(_0x248183,_0x886d95){if(_0x345b45[_0x2cdd('0x45')][_0x2cdd('0x50')](_0x23bf65['id'])){for(var _0x4edcb9 in _0x23bf65[_0x2cdd('0x51')]){if(_0x23bf65[_0x2cdd('0x51')][_0x2cdd('0x50')](_0x4edcb9)){if(_0x345b45[_0x2cdd('0x45')][_0x23bf65['id']]['hasOwnProperty'](_0x4edcb9+_0x2cdd('0x52'))){_0x345b45['agents'][_0x23bf65['id']][_0x4edcb9+_0x2cdd('0x52')]=parseInt(_0x23bf65[_0x2cdd('0x51')][_0x4edcb9],0xa);}}}_0x345b45[_0x2cdd('0x45')][_0x23bf65['id']]['updateRealtime']();return _0x248183({'code':0xc8,'message':_0x345b45[_0x2cdd('0x45')][_0x23bf65['id']]});}else{return _0x886d95(_0x535bfa[_0x2cdd('0x43')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x39a689){return new Promise(function(_0x45411f){var _0x78074d=_['values'](_0x345b45['agents']);if(_0x39a689&&_0x39a689['id']){var _0x536511=_[_0x2cdd('0x53')](_0x78074d,function(_0x5b711a){return _0x5b711a['id']===_0x39a689['id'];});_0x45411f(_0x536511);}else{_0x45411f({'count':_0x78074d[_0x2cdd('0x1b')],'rows':_0x78074d});}});},'ChatQueues':function(){return new Promise(function(_0x19a3a5){var _0x4e5863=[];for(var _0xbbfe4b in _0x345b45['chatQueues']){if(_0x345b45[_0x2cdd('0x54')][_0x2cdd('0x50')](_0xbbfe4b)){var _0x2adb85=_0x345b45[_0x2cdd('0x54')][_0xbbfe4b];var _0x5d9d09={'id':_0x2adb85['id'],'available':_0x2adb85['available'],'loggedIn':_0x2adb85['loggedIn'],'name':_0x2adb85[_0x2cdd('0x55')],'paused':_0x2adb85[_0x2cdd('0x56')],'waiting':_0x2adb85['waiting']};_0x4e5863['push'](_0x5d9d09);}}_0x19a3a5({'count':_0x4e5863[_0x2cdd('0x1b')],'rows':_0x4e5863});});},'MailQueues':function(){return new Promise(function(_0x5a081c){var _0x770a1c=[];for(var _0x10596a in _0x345b45[_0x2cdd('0x57')]){if(_0x345b45[_0x2cdd('0x57')][_0x2cdd('0x50')](_0x10596a)){var _0x4cbc4a=_0x345b45[_0x2cdd('0x57')][_0x10596a];var _0x10ff6f={'id':_0x4cbc4a['id'],'available':_0x4cbc4a[_0x2cdd('0x58')],'loggedIn':_0x4cbc4a['loggedIn'],'name':_0x4cbc4a[_0x2cdd('0x55')],'paused':_0x4cbc4a[_0x2cdd('0x56')],'waiting':_0x4cbc4a['waiting']};_0x770a1c[_0x2cdd('0x21')](_0x10ff6f);}}_0x5a081c({'count':_0x770a1c[_0x2cdd('0x1b')],'rows':_0x770a1c});});},'OpenchannelQueues':function(){return new Promise(function(_0x58eaec){var _0x4a8c19=[];for(var _0x3862fb in _0x345b45[_0x2cdd('0x59')]){if(_0x345b45[_0x2cdd('0x59')][_0x2cdd('0x50')](_0x3862fb)){var _0x13372a=_0x345b45['openchannelQueues'][_0x3862fb];var _0x7c0da1={'id':_0x13372a['id'],'available':_0x13372a['available'],'loggedIn':_0x13372a[_0x2cdd('0x5a')],'name':_0x13372a['name'],'paused':_0x13372a[_0x2cdd('0x56')],'waiting':_0x13372a[_0x2cdd('0x5b')]};_0x4a8c19[_0x2cdd('0x21')](_0x7c0da1);}}_0x58eaec({'count':_0x4a8c19[_0x2cdd('0x1b')],'rows':_0x4a8c19});});},'SmsQueues':function(){return new Promise(function(_0x5d3fe2){var _0x26b269=[];for(var _0x6b70ee in _0x345b45['smsQueues']){if(_0x345b45['smsQueues'][_0x2cdd('0x50')](_0x6b70ee)){var _0x1082b5=_0x345b45[_0x2cdd('0x5c')][_0x6b70ee];var _0x289c73={'id':_0x1082b5['id'],'available':_0x1082b5['available'],'loggedIn':_0x1082b5[_0x2cdd('0x5a')],'name':_0x1082b5[_0x2cdd('0x55')],'paused':_0x1082b5[_0x2cdd('0x56')],'waiting':_0x1082b5[_0x2cdd('0x5b')]};_0x26b269[_0x2cdd('0x21')](_0x289c73);}}_0x5d3fe2({'count':_0x26b269[_0x2cdd('0x1b')],'rows':_0x26b269});});},'FaxQueues':function(){return new Promise(function(_0x12e3cc){var _0x2bacc1=[];for(var _0x3d98d1 in _0x345b45[_0x2cdd('0x5d')]){if(_0x345b45['faxQueues'][_0x2cdd('0x50')](_0x3d98d1)){var _0x4c3f45=_0x345b45['faxQueues'][_0x3d98d1];var _0x193eb4={'id':_0x4c3f45['id'],'available':_0x4c3f45['available'],'loggedIn':_0x4c3f45[_0x2cdd('0x5a')],'name':_0x4c3f45[_0x2cdd('0x55')],'paused':_0x4c3f45['paused'],'waiting':_0x4c3f45['waiting']};_0x2bacc1['push'](_0x193eb4);}}_0x12e3cc({'count':_0x2bacc1['length'],'rows':_0x2bacc1});});},'WhatsappQueues':function(){return new Promise(function(_0x510f39){var _0x47643e=[];for(var _0x2724c6 in _0x345b45['whatsappQueues']){if(_0x345b45[_0x2cdd('0x5e')][_0x2cdd('0x50')](_0x2724c6)){var _0x3a5840=_0x345b45['whatsappQueues'][_0x2724c6];var _0x2f2ee1={'id':_0x3a5840['id'],'available':_0x3a5840[_0x2cdd('0x58')],'loggedIn':_0x3a5840[_0x2cdd('0x5a')],'name':_0x3a5840[_0x2cdd('0x55')],'paused':_0x3a5840[_0x2cdd('0x56')],'waiting':_0x3a5840[_0x2cdd('0x5b')]};_0x47643e[_0x2cdd('0x21')](_0x2f2ee1);}}_0x510f39({'count':_0x47643e[_0x2cdd('0x1b')],'rows':_0x47643e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5cf523){var _0x350147=_[_0x2cdd('0x5f')](_0x345b45[_0x2cdd('0x60')]);_0x5cf523({'count':_0x350147[_0x2cdd('0x1b')],'rows':_0x350147});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x21b5c7){var _0x3d46f8=_['values'](_0x345b45[_0x2cdd('0x61')]);_0x21b5c7({'count':_0x3d46f8[_0x2cdd('0x1b')],'rows':_0x3d46f8});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x9f4776){var _0x391647=_[_0x2cdd('0x5f')](_0x345b45['openchannelQueuesWaitingInteractions']);_0x9f4776({'count':_0x391647[_0x2cdd('0x1b')],'rows':_0x391647});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3e7682){var _0x44d21d=_[_0x2cdd('0x5f')](_0x345b45['smsQueuesWaitingInteractions']);_0x3e7682({'count':_0x44d21d[_0x2cdd('0x1b')],'rows':_0x44d21d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x224c35){var _0x46a3ec=_[_0x2cdd('0x5f')](_0x345b45[_0x2cdd('0x62')]);_0x224c35({'count':_0x46a3ec['length'],'rows':_0x46a3ec});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x178a5b){var _0x56b3b0=_['values'](_0x345b45[_0x2cdd('0x63')]);_0x178a5b({'count':_0x56b3b0[_0x2cdd('0x1b')],'rows':_0x56b3b0});});}};var _0x4466be=jayson[_0x2cdd('0x64')](_0x367111)['http']();_0x4466be['on'](_0x2cdd('0x43'),function(_0x2175ea){logger['error'](JSON[_0x2cdd('0x3d')](_0x2175ea));return _0x5934bd(_0x2175ea);});_0x4466be[_0x2cdd('0x13')](0x232c,_0x2cdd('0x65'),function(){console['log'](_0x2cdd('0x66'),0x232c);return _0x4093f('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 47bd10d..d0bbb2c 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 _0x7e0c=['stack','stop','bluebird','jayson/promise','lodash','../../../config/logger','http','request','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','format','iftime\x20%s','then','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0x30cb22,_0x8cea7a){var _0x1b8ebb=function(_0x54fb88){while(--_0x54fb88){_0x30cb22['push'](_0x30cb22['shift']());}};_0x1b8ebb(++_0x8cea7a);}(_0x7e0c,0xfe));var _0xc7e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e0c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var BPromise=require(_0xc7e0('0x0'));var jayson=require(_0xc7e0('0x1'));var _=require(_0xc7e0('0x2'));var logger=require(_0xc7e0('0x3'))('routing');var client=jayson['client'][_0xc7e0('0x4')]({'port':0x232a});function request(_0xd486b8,_0x429af1){return new BPromise(function(_0x55d763,_0x409240){return client[_0xc7e0('0x5')](_0xd486b8,_0x429af1)['then'](function(_0x436ec9){if(_0x436ec9['error']){return _0x409240(_0x436ec9[_0xc7e0('0x6')][_0xc7e0('0x7')]);}else{return _0x55d763(_0x436ec9[_0xc7e0('0x8')]);}})['catch'](function(_0x5b5cfd){return _0x409240(_0x5b5cfd);});});}exports['condition']=function(_0x2c40ff,_0x43b506,_0x551f0f){return function(_0x128975){if(_0x551f0f[_0xc7e0('0x9')]&&!_0x551f0f[_0xc7e0('0x9')][_0x2c40ff]){logger[_0xc7e0('0xa')](_0xc7e0('0xb'),_0x2c40ff);return _0x128975['stop']();}var _0x33c8d0=[];for(var _0x36250f=0x0;_0x36250f<_0x43b506['length'];_0x36250f+=0x1){_0x33c8d0[_0xc7e0('0xc')](request('Command',{'command':util[_0xc7e0('0xd')](_0xc7e0('0xe'),_0x43b506[_0x36250f])})[_0xc7e0('0xf')](function(_0x48481b){return _0x48481b&&_0x48481b[_0xc7e0('0x7')]&&_0x48481b['message'][_0xc7e0('0x10')](_0xc7e0('0x11'))>=0x0?!![]:![];})[_0xc7e0('0x12')](function(){logger[_0xc7e0('0x6')](_0xc7e0('0x13'),_0x2c40ff,_0x43b506[_0x36250f]);}));}BPromise[_0xc7e0('0x14')](_0x33c8d0)[_0xc7e0('0xf')](function(_0x52283e){var _0x8c58e0=_[_0xc7e0('0x15')](_0x52283e);logger['info'](_0xc7e0('0x16'),_0x2c40ff,_0x43b506[_0xc7e0('0x17')](_0xc7e0('0x18')),_0x8c58e0);_0x128975[_0xc7e0('0x19')](_0x8c58e0);})['catch'](function(_0x200189){logger[_0xc7e0('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x2c40ff,_0x43b506[_0xc7e0('0x17')](_0xc7e0('0x18')),_0x200189[_0xc7e0('0x1a')]);_0x128975[_0xc7e0('0x1b')]();});};}; \ No newline at end of file +var _0x34bd=['[%s][INTERVAL]\x20%s','when','join','stack','util','jayson/promise','lodash','routing','client','http','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','indexOf'];(function(_0x9a5fb7,_0x6774cc){var _0x135636=function(_0x259e3a){while(--_0x259e3a){_0x9a5fb7['push'](_0x9a5fb7['shift']());}};_0x135636(++_0x6774cc);}(_0x34bd,0x108));var _0xd34b=function(_0x3cb7e8,_0xb8f77){_0x3cb7e8=_0x3cb7e8-0x0;var _0x72798f=_0x34bd[_0x3cb7e8];return _0x72798f;};'use strict';var util=require(_0xd34b('0x0'));var BPromise=require('bluebird');var jayson=require(_0xd34b('0x1'));var _=require(_0xd34b('0x2'));var logger=require('../../../config/logger')(_0xd34b('0x3'));var client=jayson[_0xd34b('0x4')][_0xd34b('0x5')]({'port':0x232a});function request(_0xc37a36,_0x472e08){return new BPromise(function(_0x480323,_0x247625){return client['request'](_0xc37a36,_0x472e08)[_0xd34b('0x6')](function(_0x11b2c2){if(_0x11b2c2['error']){return _0x247625(_0x11b2c2[_0xd34b('0x7')]['message']);}else{return _0x480323(_0x11b2c2[_0xd34b('0x8')]);}})[_0xd34b('0x9')](function(_0x56b291){return _0x247625(_0x56b291);});});}exports[_0xd34b('0xa')]=function(_0x23659c,_0xd47452,_0x5bfc7f){return function(_0x1199d3){if(_0x5bfc7f[_0xd34b('0xb')]&&!_0x5bfc7f[_0xd34b('0xb')][_0x23659c]){logger[_0xd34b('0xc')](_0xd34b('0xd'),_0x23659c);return _0x1199d3[_0xd34b('0xe')]();}var _0x2a1134=[];for(var _0x35d33c=0x0;_0x35d33c<_0xd47452[_0xd34b('0xf')];_0x35d33c+=0x1){_0x2a1134[_0xd34b('0x10')](request(_0xd34b('0x11'),{'command':util[_0xd34b('0x12')](_0xd34b('0x13'),_0xd47452[_0x35d33c])})[_0xd34b('0x6')](function(_0x34c595){return _0x34c595&&_0x34c595['message']&&_0x34c595[_0xd34b('0x14')][_0xd34b('0x15')]('true')>=0x0?!![]:![];})[_0xd34b('0x9')](function(){logger[_0xd34b('0x7')](_0xd34b('0x16'),_0x23659c,_0xd47452[_0x35d33c]);}));}BPromise['all'](_0x2a1134)[_0xd34b('0x6')](function(_0x363798){var _0xfd8fa3=_['some'](_0x363798);logger[_0xd34b('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x23659c,_0xd47452['join']('\x20|\x20'),_0xfd8fa3);_0x1199d3[_0xd34b('0x17')](_0xfd8fa3);})[_0xd34b('0x9')](function(_0x195703){logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x23659c,_0xd47452[_0xd34b('0x18')]('\x20|\x20'),_0x195703[_0xd34b('0x19')]);_0x1199d3[_0xd34b('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 94a5740..c6be70c 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 _0xbee3=['answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','calleridname','agentconnectAt','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','now','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid'];(function(_0x597351,_0xa9dc9){var _0x460eb7=function(_0x1e8d44){while(--_0x1e8d44){_0x597351['push'](_0x597351['shift']());}};_0x460eb7(++_0xa9dc9);}(_0xbee3,0xd5));var _0x3bee=function(_0x40e94f,_0x2d9aaf){_0x40e94f=_0x40e94f-0x0;var _0x547908=_0xbee3[_0x40e94f];return _0x547908;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x56a879,_0x45a1bf){utils[_0x3bee('0x1')](util['format'](_0x3bee('0x2'),_0x56a879[_0x3bee('0x3')],_0x56a879[_0x3bee('0x4')],_0x56a879['queue'],_0x56a879[_0x3bee('0x5')],_0x56a879[_0x3bee('0x6')],_0x56a879['calleridnum'],_0x56a879[_0x3bee('0x7')],_0x56a879[_0x3bee('0x8')]));if(_0x56a879[_0x3bee('0x9')]){utils[_0x3bee('0xa')](_0x56a879[_0x3bee('0x9')])[_0x3bee('0xb')](function(_0x3485b8){if(_0x3485b8){_0x56a879['type']=_0x3485b8[_0x3bee('0xc')];_0x56a879[_0x3bee('0xd')]=_0x56a879[_0x3bee('0xe')]?_0x3485b8[_0x3bee('0xf')]:![];_0x56a879[_0x3bee('0x10')]=_0x56a879[_0x3bee('0xd')]?_0x3485b8['acwTimeout']:0x0;}utils[_0x3bee('0x11')]('CreateVoiceAgentReport',_0x56a879);});}else{utils[_0x3bee('0x11')](_0x3bee('0x12'),_0x56a879);}if(_0x45a1bf){delete transfers[_0x56a879[_0x3bee('0x3')]];}else{delete agents[_0x56a879[_0x3bee('0x13')]];}}exports[_0x3bee('0x14')]=function(_0x459129){try{utils[_0x3bee('0x15')](util['format'](_0x3bee('0x16'),_0x459129[_0x3bee('0x3')]),_0x459129);agents[_0x459129[_0x3bee('0x13')]]=_0x459129;agents[_0x459129[_0x3bee('0x13')]][_0x3bee('0x17')]=utils['now']();agents[_0x459129['destuniqueid']][_0x3bee('0x8')]='called';agents[_0x459129[_0x3bee('0x13')]][_0x3bee('0x7')]=null;agents[_0x459129['destuniqueid']]['connectedlinename']=null;utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x19'),_0x459129[_0x3bee('0x3')],agents[_0x459129['destuniqueid']][_0x3bee('0x5')],_0x459129[_0x3bee('0x13')]));}catch(_0x440644){utils[_0x3bee('0x1a')](util[_0x3bee('0x18')](_0x3bee('0x16'),_0x459129[_0x3bee('0x3')]),_0x440644);}};exports['agentringnoanswer']=function(_0x4f36af){try{if(!_[_0x3bee('0x1b')](agents[_0x4f36af[_0x3bee('0x13')]])){utils['debug'](util[_0x3bee('0x18')](_0x3bee('0x1c'),_0x4f36af[_0x3bee('0x3')]),_0x4f36af);utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x1d'),_0x4f36af[_0x3bee('0x3')],agents[_0x4f36af['destuniqueid']][_0x3bee('0x5')],_0x4f36af[_0x3bee('0x13')]));agents[_0x4f36af[_0x3bee('0x13')]][_0x3bee('0x1e')]=!![];agents[_0x4f36af['destuniqueid']][_0x3bee('0x1f')]=utils[_0x3bee('0x20')]();agents[_0x4f36af[_0x3bee('0x13')]]['lastevent']='timeout';agents[_0x4f36af[_0x3bee('0x13')]][_0x3bee('0x21')]='timeout';agents[_0x4f36af[_0x3bee('0x13')]][_0x3bee('0x22')]=_0x4f36af[_0x3bee('0x23')]?parseInt(_0x4f36af['ringtime'])/0x3e8:0x0;agents[_0x4f36af[_0x3bee('0x13')]][_0x3bee('0x24')]=0x0;unanswered[_0x3bee('0x25')](_0x4f36af['destuniqueid']);}}catch(_0x239fa4){utils[_0x3bee('0x1a')](util[_0x3bee('0x18')]('[%s][agents][agentringnoanswer]',_0x4f36af[_0x3bee('0x3')]),_0x239fa4);}};exports[_0x3bee('0x26')]=function(_0x27ed99){try{_[_0x3bee('0x27')](agents,function(_0x3433aa,_0x559c2b){if(_0x3433aa['uniqueid']==_0x27ed99[_0x3bee('0x3')]&&!_[_0x3bee('0x28')](unanswered,_0x3433aa[_0x3bee('0x13')])){utils[_0x3bee('0x15')](util['format']('[%s][agents][queuecallerabandon]',_0x27ed99[_0x3bee('0x3')]),_0x27ed99);utils[_0x3bee('0x1')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x27ed99[_0x3bee('0x3')],_0x3433aa[_0x3bee('0x5')],_0x3433aa[_0x3bee('0x13')]));_0x3433aa[_0x3bee('0x1e')]=!![];_0x3433aa[_0x3bee('0x1f')]=utils[_0x3bee('0x20')]();_0x3433aa[_0x3bee('0x8')]=_0x3bee('0x29');_0x3433aa[_0x3bee('0x21')]=_0x3bee('0x29');_0x3433aa['holdtime']=_0x27ed99['holdtime'];_0x3433aa[_0x3bee('0x24')]=0x0;writeDB(_0x3433aa);}});}catch(_0x4a4706){utils['error'](util[_0x3bee('0x18')](_0x3bee('0x2a'),_0x27ed99[_0x3bee('0x3')]),_0x4a4706);}};exports[_0x3bee('0x2b')]=function(_0xd926f8){try{if(agents[_0xd926f8[_0x3bee('0x13')]]){utils[_0x3bee('0x15')](util[_0x3bee('0x18')]('[%s][agents][agentconnect]',_0xd926f8[_0x3bee('0x3')]),_0xd926f8);utils[_0x3bee('0x1')](util['format'](_0x3bee('0x2c'),_0xd926f8[_0x3bee('0x3')],agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x5')],_0xd926f8[_0x3bee('0x13')]));agents[_0xd926f8['destuniqueid']]['agentconnectAt']=utils[_0x3bee('0x20')]();agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x7')]=_0xd926f8[_0x3bee('0x7')];agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x2d')]=_0xd926f8[_0x3bee('0x2d')];agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x22')]=_0xd926f8[_0x3bee('0x23')];agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x8')]='connect';_[_0x3bee('0x27')](agents,function(_0x1b5eca,_0x25158b){if(_0x1b5eca[_0x3bee('0x13')]!=_0xd926f8[_0x3bee('0x13')]&&_0x1b5eca[_0x3bee('0x3')]==_0xd926f8[_0x3bee('0x3')]){_0x1b5eca[_0x3bee('0x24')]=0x0;_0x1b5eca[_0x3bee('0x22')]=_0xd926f8[_0x3bee('0x23')];_0x1b5eca[_0x3bee('0x1e')]=!![];_0x1b5eca[_0x3bee('0x1f')]=utils[_0x3bee('0x20')]();_0x1b5eca['lastevent']=_0x3bee('0x2e');_0x1b5eca[_0x3bee('0x21')]=_0x3bee('0x2e');_0x1b5eca[_0x3bee('0x2f')]=_0xd926f8[_0x3bee('0x13')];_0x1b5eca[_0x3bee('0x30')]=_0xd926f8[_0x3bee('0x5')];writeDB(_0x1b5eca);}});}}catch(_0xd1140d){utils['error'](util[_0x3bee('0x18')](_0x3bee('0x31'),_0xd926f8[_0x3bee('0x3')]),_0xd1140d);}};exports['agentcomplete']=function(_0x4567f2){try{if(!_['isNil'](agents[_0x4567f2[_0x3bee('0x13')]])){utils['debug'](util['format'](_0x3bee('0x32'),_0x4567f2[_0x3bee('0x3')]),_0x4567f2);utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x33'),_0x4567f2['uniqueid'],agents[_0x4567f2['destuniqueid']][_0x3bee('0x5')],_0x4567f2['destuniqueid']));agents[_0x4567f2[_0x3bee('0x13')]]['agentcomplete']=!![];agents[_0x4567f2[_0x3bee('0x13')]]['agentcompleteAt']=utils[_0x3bee('0x20')]();agents[_0x4567f2[_0x3bee('0x13')]][_0x3bee('0x24')]=utils[_0x3bee('0x34')](agents[_0x4567f2['destuniqueid']]['agentcompleteAt'],agents[_0x4567f2[_0x3bee('0x13')]]['agentconnectAt']);agents[_0x4567f2['destuniqueid']]['reason']=_0x4567f2[_0x3bee('0x21')];agents[_0x4567f2['destuniqueid']][_0x3bee('0x8')]=_0x3bee('0x35');writeDB(agents[_0x4567f2[_0x3bee('0x13')]]);}}catch(_0x593427){utils[_0x3bee('0x1a')](util['format'](_0x3bee('0x32'),_0x4567f2['uniqueid']),_0x593427);}};exports[_0x3bee('0x36')]=function(_0x16b096){try{if(!_[_0x3bee('0x1b')](agents[_0x16b096['transfereruniqueid']])){utils[_0x3bee('0x15')](util[_0x3bee('0x18')](_0x3bee('0x37'),_0x16b096['uniqueid']),_0x16b096);utils['info'](util[_0x3bee('0x18')](_0x3bee('0x38'),_0x16b096[_0x3bee('0x3')],agents[_0x16b096[_0x3bee('0x39')]][_0x3bee('0x5')],agents[_0x16b096[_0x3bee('0x39')]][_0x3bee('0x3')]));agents[_0x16b096['transfereruniqueid']][_0x3bee('0x3a')]=!![];agents[_0x16b096[_0x3bee('0x39')]]['transfertype']='blind';agents[_0x16b096[_0x3bee('0x39')]]['transferexten']=_0x16b096[_0x3bee('0x3b')];agents[_0x16b096[_0x3bee('0x39')]][_0x3bee('0x3c')]=agents[_0x16b096['transfereruniqueid']][_0x3bee('0x3')];}}catch(_0x3beac9){utils[_0x3bee('0x1a')](util['format'](_0x3bee('0x37'),_0x16b096[_0x3bee('0x3')]),_0x3beac9);}};exports['attendedtransfer']=function(_0x7e37ed){try{utils[_0x3bee('0x15')](util['format'](_0x3bee('0x3d'),_0x7e37ed[_0x3bee('0x3e')]),_0x7e37ed);if(_0x7e37ed[_0x3bee('0x3e')]==_0x7e37ed[_0x3bee('0x3f')]){if(!_[_0x3bee('0x1b')](agents[_0x7e37ed[_0x3bee('0x40')]])){utils[_0x3bee('0x1')](util[_0x3bee('0x18')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x7e37ed['origtransfereruniqueid'],agents[_0x7e37ed[_0x3bee('0x40')]]['membername']));agents[_0x7e37ed[_0x3bee('0x40')]][_0x3bee('0x3a')]=!![];agents[_0x7e37ed[_0x3bee('0x40')]]['transfertype']=_0x3bee('0x41');agents[_0x7e37ed[_0x3bee('0x40')]][_0x3bee('0x42')]=_0x7e37ed['origtransfererexten'];agents[_0x7e37ed[_0x3bee('0x40')]]['transferuniqueid']=_0x7e37ed[_0x3bee('0x3e')];}if(_0x7e37ed[_0x3bee('0x43')]&&agents[_0x7e37ed[_0x3bee('0x43')]]){agents[_0x7e37ed['transfereeuniqueid']][_0x3bee('0x44')]=0x1;transfers[_0x7e37ed[_0x3bee('0x43')]]=_[_0x3bee('0x45')](agents[_0x7e37ed['transfereeuniqueid']]);transfers[_0x7e37ed['transfereeuniqueid']][_0x3bee('0x46')]=agents[_0x7e37ed[_0x3bee('0x40')]][_0x3bee('0x46')];transfers[_0x7e37ed['transfereeuniqueid']]['calleridname']=agents[_0x7e37ed[_0x3bee('0x40')]]['calleridname'];transfers[_0x7e37ed['transfereeuniqueid']][_0x3bee('0x17')]=utils[_0x3bee('0x20')]();transfers[_0x7e37ed[_0x3bee('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x7e37ed[_0x3bee('0x43')]][_0x3bee('0x22')]=0x0;transfers[_0x7e37ed['transfereeuniqueid']][_0x3bee('0x44')]=0x2;}}else if(_0x7e37ed['secondtransfereruniqueid']==_0x7e37ed[_0x3bee('0x47')]){if(!_[_0x3bee('0x1b')](agents[_0x7e37ed[_0x3bee('0x3e')]])){utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x48'),_0x7e37ed[_0x3bee('0x3e')],agents[_0x7e37ed[_0x3bee('0x3e')]][_0x3bee('0x5')]));agents[_0x7e37ed[_0x3bee('0x3e')]][_0x3bee('0x3a')]=!![];agents[_0x7e37ed['origtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x7e37ed[_0x3bee('0x3e')]][_0x3bee('0x42')]=_0x7e37ed[_0x3bee('0x49')];agents[_0x7e37ed[_0x3bee('0x3e')]]['transferuniqueid']=_0x7e37ed[_0x3bee('0x40')];}if(_0x7e37ed[_0x3bee('0x4a')]&&agents[_0x7e37ed['transfertargetuniqueid']]){agents[_0x7e37ed['transfertargetuniqueid']][_0x3bee('0x44')]=0x1;transfers[_0x7e37ed[_0x3bee('0x4a')]]=_[_0x3bee('0x45')](agents[_0x7e37ed['transfertargetuniqueid']]);transfers[_0x7e37ed[_0x3bee('0x4a')]][_0x3bee('0x46')]=agents[_0x7e37ed[_0x3bee('0x3e')]]['calleridnum'];transfers[_0x7e37ed[_0x3bee('0x4a')]][_0x3bee('0x4b')]=agents[_0x7e37ed[_0x3bee('0x3e')]][_0x3bee('0x4b')];transfers[_0x7e37ed['transfertargetuniqueid']]['agentcalledAt']=utils[_0x3bee('0x20')]();transfers[_0x7e37ed[_0x3bee('0x4a')]][_0x3bee('0x4c')]=utils[_0x3bee('0x20')]();transfers[_0x7e37ed[_0x3bee('0x4a')]]['holdtime']=0x0;transfers[_0x7e37ed[_0x3bee('0x4a')]]['agententerreason']=0x2;}}}catch(_0xddc56b){utils[_0x3bee('0x1a')](util[_0x3bee('0x18')](_0x3bee('0x3d'),_0x7e37ed[_0x3bee('0x3e')]),_0xddc56b);}};exports[_0x3bee('0x4d')]=function(_0x3f7dad){try{utils['debug'](util[_0x3bee('0x18')](_0x3bee('0x4e'),_0x3f7dad[_0x3bee('0x3')]),_0x3f7dad);if(agents[_0x3f7dad[_0x3bee('0x3')]]&&agents[_0x3f7dad['uniqueid']][_0x3bee('0x21')]===_0x3bee('0x4f')){if(_0x3f7dad[_0x3bee('0x50')]==='21'){agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')]=_0x3bee('0x51');agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x8')]='rejected';}utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x52'),_0x3f7dad['uniqueid'],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x5')],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x8')]));writeDB(agents[_0x3f7dad[_0x3bee('0x3')]]);var _0x204843=unanswered[_0x3bee('0x53')](_0x3f7dad[_0x3bee('0x3')]);if(_0x204843>-0x1){unanswered[_0x3bee('0x54')](_0x204843,0x1);}}if(transfers[_0x3f7dad[_0x3bee('0x3')]]){transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0xe')]=!![];transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x55')]=utils[_0x3bee('0x20')]();transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x24')]=utils[_0x3bee('0x34')](transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x55')],transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x4c')]);transfers[_0x3f7dad[_0x3bee('0x3')]]['reason']=_0x3bee('0x56');transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x8')]=_0x3bee('0x35');utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x52'),_0x3f7dad[_0x3bee('0x3')],transfers[_0x3f7dad[_0x3bee('0x3')]]['membername'],transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')],transfers[_0x3f7dad['uniqueid']][_0x3bee('0x8')]));writeDB(transfers[_0x3f7dad['uniqueid']],!![]);}if(agents[_0x3f7dad[_0x3bee('0x3')]]&&agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x4c')]){agents[_0x3f7dad['uniqueid']]['agentcomplete']=!![];agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x55')]=utils[_0x3bee('0x20')]();agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x24')]=utils[_0x3bee('0x34')](agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x55')],agents[_0x3f7dad['uniqueid']][_0x3bee('0x4c')]);agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')]=agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x3a')]?_0x3bee('0x3a'):_0x3bee('0x56');agents[_0x3f7dad['uniqueid']][_0x3bee('0x8')]=_0x3bee('0x35');utils['info'](util[_0x3bee('0x18')](_0x3bee('0x52'),_0x3f7dad['uniqueid'],agents[_0x3f7dad[_0x3bee('0x3')]]['membername'],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x8')]));writeDB(agents[_0x3f7dad['uniqueid']]);}}catch(_0x62900b){utils[_0x3bee('0x1a')](util[_0x3bee('0x18')]('[%s][agents][hangup]',_0x3f7dad[_0x3bee('0x3')]),_0x62900b);}}; \ No newline at end of file +var _0x39cb=['util','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','then','type','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinename','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','[%s][agents][agentringnoanswer]','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','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','clone','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcomplete','agent'];(function(_0x4165db,_0x1a5c9b){var _0x17a464=function(_0xe40ecd){while(--_0xe40ecd){_0x4165db['push'](_0x4165db['shift']());}};_0x17a464(++_0x1a5c9b);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var utils=require(_0xb39c('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5ddb79,_0x266bb4){utils[_0xb39c('0x2')](util['format'](_0xb39c('0x3'),_0x5ddb79[_0xb39c('0x4')],_0x5ddb79[_0xb39c('0x5')],_0x5ddb79[_0xb39c('0x6')],_0x5ddb79[_0xb39c('0x7')],_0x5ddb79['interface'],_0x5ddb79[_0xb39c('0x8')],_0x5ddb79[_0xb39c('0x9')],_0x5ddb79[_0xb39c('0xa')]));if(_0x5ddb79[_0xb39c('0x6')]){utils['getVoiceQueueByName'](_0x5ddb79['queue'])[_0xb39c('0xb')](function(_0x7aa397){if(_0x7aa397){_0x5ddb79[_0xb39c('0xc')]=_0x7aa397[_0xb39c('0xc')];_0x5ddb79['agentacw']=_0x5ddb79['agentcomplete']?_0x7aa397['acw']:![];_0x5ddb79[_0xb39c('0xd')]=_0x5ddb79[_0xb39c('0xe')]?_0x7aa397[_0xb39c('0xf')]:0x0;}utils[_0xb39c('0x10')](_0xb39c('0x11'),_0x5ddb79);});}else{utils[_0xb39c('0x10')](_0xb39c('0x11'),_0x5ddb79);}if(_0x266bb4){delete transfers[_0x5ddb79[_0xb39c('0x4')]];}else{delete agents[_0x5ddb79['destuniqueid']];}}exports[_0xb39c('0x12')]=function(_0x468995){try{utils[_0xb39c('0x13')](util['format'](_0xb39c('0x14'),_0x468995[_0xb39c('0x4')]),_0x468995);agents[_0x468995[_0xb39c('0x15')]]=_0x468995;agents[_0x468995[_0xb39c('0x15')]][_0xb39c('0x16')]=utils[_0xb39c('0x17')]();agents[_0x468995[_0xb39c('0x15')]]['lastevent']=_0xb39c('0x18');agents[_0x468995[_0xb39c('0x15')]][_0xb39c('0x9')]=null;agents[_0x468995[_0xb39c('0x15')]][_0xb39c('0x19')]=null;utils[_0xb39c('0x2')](util[_0xb39c('0x1a')](_0xb39c('0x1b'),_0x468995[_0xb39c('0x4')],agents[_0x468995[_0xb39c('0x15')]]['membername'],_0x468995[_0xb39c('0x15')]));}catch(_0x1a8e12){utils[_0xb39c('0x1c')](util[_0xb39c('0x1a')]('[%s][agents][agentcalled]',_0x468995[_0xb39c('0x4')]),_0x1a8e12);}};exports[_0xb39c('0x1d')]=function(_0x5e4a0b){try{if(!_[_0xb39c('0x1e')](agents[_0x5e4a0b[_0xb39c('0x15')]])){utils[_0xb39c('0x13')](util['format']('[%s][agents][agentringnoanswer]',_0x5e4a0b[_0xb39c('0x4')]),_0x5e4a0b);utils[_0xb39c('0x2')](util[_0xb39c('0x1a')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5e4a0b[_0xb39c('0x4')],agents[_0x5e4a0b[_0xb39c('0x15')]][_0xb39c('0x7')],_0x5e4a0b[_0xb39c('0x15')]));agents[_0x5e4a0b[_0xb39c('0x15')]]['agentringnoanswer']=!![];agents[_0x5e4a0b[_0xb39c('0x15')]][_0xb39c('0x1f')]=utils['now']();agents[_0x5e4a0b[_0xb39c('0x15')]][_0xb39c('0xa')]=_0xb39c('0x20');agents[_0x5e4a0b[_0xb39c('0x15')]][_0xb39c('0x21')]='timeout';agents[_0x5e4a0b[_0xb39c('0x15')]][_0xb39c('0x22')]=_0x5e4a0b[_0xb39c('0x23')]?parseInt(_0x5e4a0b['ringtime'])/0x3e8:0x0;agents[_0x5e4a0b[_0xb39c('0x15')]][_0xb39c('0x24')]=0x0;unanswered['push'](_0x5e4a0b[_0xb39c('0x15')]);}}catch(_0x4b4458){utils[_0xb39c('0x1c')](util['format'](_0xb39c('0x25'),_0x5e4a0b[_0xb39c('0x4')]),_0x4b4458);}};exports['queuecallerabandon']=function(_0x2bc742){try{_['forIn'](agents,function(_0x8e2d7,_0x2d2743){if(_0x8e2d7[_0xb39c('0x4')]==_0x2bc742[_0xb39c('0x4')]&&!_[_0xb39c('0x26')](unanswered,_0x8e2d7['destuniqueid'])){utils[_0xb39c('0x13')](util['format'](_0xb39c('0x27'),_0x2bc742['uniqueid']),_0x2bc742);utils[_0xb39c('0x2')](util[_0xb39c('0x1a')](_0xb39c('0x28'),_0x2bc742[_0xb39c('0x4')],_0x8e2d7['membername'],_0x8e2d7['destuniqueid']));_0x8e2d7[_0xb39c('0x1d')]=!![];_0x8e2d7[_0xb39c('0x1f')]=utils['now']();_0x8e2d7[_0xb39c('0xa')]=_0xb39c('0x29');_0x8e2d7[_0xb39c('0x21')]=_0xb39c('0x29');_0x8e2d7[_0xb39c('0x22')]=_0x2bc742[_0xb39c('0x22')];_0x8e2d7[_0xb39c('0x24')]=0x0;writeDB(_0x8e2d7);}});}catch(_0x45e700){utils[_0xb39c('0x1c')](util[_0xb39c('0x1a')](_0xb39c('0x27'),_0x2bc742[_0xb39c('0x4')]),_0x45e700);}};exports[_0xb39c('0x2a')]=function(_0x2f6b5a){try{if(agents[_0x2f6b5a[_0xb39c('0x15')]]){utils[_0xb39c('0x13')](util[_0xb39c('0x1a')](_0xb39c('0x2b'),_0x2f6b5a[_0xb39c('0x4')]),_0x2f6b5a);utils['info'](util[_0xb39c('0x1a')](_0xb39c('0x2c'),_0x2f6b5a['uniqueid'],agents[_0x2f6b5a['destuniqueid']]['membername'],_0x2f6b5a[_0xb39c('0x15')]));agents[_0x2f6b5a[_0xb39c('0x15')]][_0xb39c('0x2d')]=utils['now']();agents[_0x2f6b5a[_0xb39c('0x15')]][_0xb39c('0x9')]=_0x2f6b5a[_0xb39c('0x9')];agents[_0x2f6b5a[_0xb39c('0x15')]][_0xb39c('0x19')]=_0x2f6b5a['connectedlinename'];agents[_0x2f6b5a[_0xb39c('0x15')]][_0xb39c('0x22')]=_0x2f6b5a['ringtime'];agents[_0x2f6b5a[_0xb39c('0x15')]]['lastevent']=_0xb39c('0x2e');_[_0xb39c('0x2f')](agents,function(_0x3eaf96,_0x4c043a){if(_0x3eaf96[_0xb39c('0x15')]!=_0x2f6b5a[_0xb39c('0x15')]&&_0x3eaf96[_0xb39c('0x4')]==_0x2f6b5a[_0xb39c('0x4')]){_0x3eaf96[_0xb39c('0x24')]=0x0;_0x3eaf96[_0xb39c('0x22')]=_0x2f6b5a[_0xb39c('0x23')];_0x3eaf96[_0xb39c('0x1d')]=!![];_0x3eaf96[_0xb39c('0x1f')]=utils[_0xb39c('0x17')]();_0x3eaf96[_0xb39c('0xa')]=_0xb39c('0x30');_0x3eaf96['reason']=_0xb39c('0x30');_0x3eaf96[_0xb39c('0x31')]=_0x2f6b5a[_0xb39c('0x15')];_0x3eaf96[_0xb39c('0x32')]=_0x2f6b5a[_0xb39c('0x7')];writeDB(_0x3eaf96);}});}}catch(_0x390cd7){utils[_0xb39c('0x1c')](util[_0xb39c('0x1a')](_0xb39c('0x2b'),_0x2f6b5a['uniqueid']),_0x390cd7);}};exports['agentcomplete']=function(_0x2f88c9){try{if(!_[_0xb39c('0x1e')](agents[_0x2f88c9['destuniqueid']])){utils['debug'](util[_0xb39c('0x1a')]('[%s][agents][agentcomplete]',_0x2f88c9[_0xb39c('0x4')]),_0x2f88c9);utils[_0xb39c('0x2')](util[_0xb39c('0x1a')](_0xb39c('0x33'),_0x2f88c9[_0xb39c('0x4')],agents[_0x2f88c9['destuniqueid']][_0xb39c('0x7')],_0x2f88c9[_0xb39c('0x15')]));agents[_0x2f88c9['destuniqueid']]['agentcomplete']=!![];agents[_0x2f88c9[_0xb39c('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x2f88c9[_0xb39c('0x15')]][_0xb39c('0x24')]=utils[_0xb39c('0x34')](agents[_0x2f88c9[_0xb39c('0x15')]][_0xb39c('0x35')],agents[_0x2f88c9[_0xb39c('0x15')]][_0xb39c('0x2d')]);agents[_0x2f88c9[_0xb39c('0x15')]][_0xb39c('0x21')]=_0x2f88c9[_0xb39c('0x21')];agents[_0x2f88c9['destuniqueid']][_0xb39c('0xa')]=_0xb39c('0x36');writeDB(agents[_0x2f88c9[_0xb39c('0x15')]]);}}catch(_0x2f790e){utils[_0xb39c('0x1c')](util[_0xb39c('0x1a')](_0xb39c('0x37'),_0x2f88c9[_0xb39c('0x4')]),_0x2f790e);}};exports[_0xb39c('0x38')]=function(_0x1ae2cb){try{if(!_[_0xb39c('0x1e')](agents[_0x1ae2cb[_0xb39c('0x39')]])){utils[_0xb39c('0x13')](util[_0xb39c('0x1a')](_0xb39c('0x3a'),_0x1ae2cb[_0xb39c('0x4')]),_0x1ae2cb);utils['info'](util[_0xb39c('0x1a')](_0xb39c('0x3b'),_0x1ae2cb[_0xb39c('0x4')],agents[_0x1ae2cb[_0xb39c('0x39')]][_0xb39c('0x7')],agents[_0x1ae2cb[_0xb39c('0x39')]][_0xb39c('0x4')]));agents[_0x1ae2cb[_0xb39c('0x39')]]['transfer']=!![];agents[_0x1ae2cb['transfereruniqueid']][_0xb39c('0x3c')]=_0xb39c('0x3d');agents[_0x1ae2cb['transfereruniqueid']]['transferexten']=_0x1ae2cb[_0xb39c('0x3e')];agents[_0x1ae2cb[_0xb39c('0x39')]]['transferuniqueid']=agents[_0x1ae2cb[_0xb39c('0x39')]]['uniqueid'];}}catch(_0x5e367e){utils[_0xb39c('0x1c')](util['format'](_0xb39c('0x3a'),_0x1ae2cb[_0xb39c('0x4')]),_0x5e367e);}};exports[_0xb39c('0x3f')]=function(_0x3fd353){try{utils[_0xb39c('0x13')](util[_0xb39c('0x1a')]('[%s][agents][attendedtransfer]',_0x3fd353[_0xb39c('0x40')]),_0x3fd353);if(_0x3fd353[_0xb39c('0x40')]==_0x3fd353[_0xb39c('0x41')]){if(!_[_0xb39c('0x1e')](agents[_0x3fd353[_0xb39c('0x42')]])){utils['info'](util[_0xb39c('0x1a')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3fd353[_0xb39c('0x40')],agents[_0x3fd353[_0xb39c('0x42')]][_0xb39c('0x7')]));agents[_0x3fd353[_0xb39c('0x42')]][_0xb39c('0x43')]=!![];agents[_0x3fd353[_0xb39c('0x42')]][_0xb39c('0x3c')]=_0xb39c('0x44');agents[_0x3fd353[_0xb39c('0x42')]][_0xb39c('0x45')]=_0x3fd353[_0xb39c('0x46')];agents[_0x3fd353[_0xb39c('0x42')]][_0xb39c('0x47')]=_0x3fd353[_0xb39c('0x40')];}if(_0x3fd353[_0xb39c('0x48')]&&agents[_0x3fd353[_0xb39c('0x48')]]){agents[_0x3fd353[_0xb39c('0x48')]][_0xb39c('0x49')]=0x1;transfers[_0x3fd353[_0xb39c('0x48')]]=_['clone'](agents[_0x3fd353['transfereeuniqueid']]);transfers[_0x3fd353[_0xb39c('0x48')]][_0xb39c('0x8')]=agents[_0x3fd353['secondtransfereruniqueid']][_0xb39c('0x8')];transfers[_0x3fd353[_0xb39c('0x48')]]['calleridname']=agents[_0x3fd353[_0xb39c('0x42')]][_0xb39c('0x4a')];transfers[_0x3fd353[_0xb39c('0x48')]][_0xb39c('0x16')]=utils[_0xb39c('0x17')]();transfers[_0x3fd353[_0xb39c('0x48')]]['agentconnectAt']=utils[_0xb39c('0x17')]();transfers[_0x3fd353[_0xb39c('0x48')]][_0xb39c('0x22')]=0x0;transfers[_0x3fd353[_0xb39c('0x48')]][_0xb39c('0x49')]=0x2;}}else if(_0x3fd353[_0xb39c('0x42')]==_0x3fd353[_0xb39c('0x4b')]){if(!_['isNil'](agents[_0x3fd353[_0xb39c('0x40')]])){utils[_0xb39c('0x2')](util[_0xb39c('0x1a')](_0xb39c('0x4c'),_0x3fd353[_0xb39c('0x40')],agents[_0x3fd353['origtransfereruniqueid']]['membername']));agents[_0x3fd353[_0xb39c('0x40')]][_0xb39c('0x43')]=!![];agents[_0x3fd353[_0xb39c('0x40')]]['transfertype']=_0xb39c('0x44');agents[_0x3fd353['origtransfereruniqueid']][_0xb39c('0x45')]=_0x3fd353['secondtransfererexten'];agents[_0x3fd353[_0xb39c('0x40')]][_0xb39c('0x47')]=_0x3fd353[_0xb39c('0x42')];}if(_0x3fd353['transfertargetuniqueid']&&agents[_0x3fd353[_0xb39c('0x4d')]]){agents[_0x3fd353[_0xb39c('0x4d')]][_0xb39c('0x49')]=0x1;transfers[_0x3fd353[_0xb39c('0x4d')]]=_[_0xb39c('0x4e')](agents[_0x3fd353[_0xb39c('0x4d')]]);transfers[_0x3fd353[_0xb39c('0x4d')]][_0xb39c('0x8')]=agents[_0x3fd353[_0xb39c('0x40')]][_0xb39c('0x8')];transfers[_0x3fd353[_0xb39c('0x4d')]][_0xb39c('0x4a')]=agents[_0x3fd353[_0xb39c('0x40')]][_0xb39c('0x4a')];transfers[_0x3fd353[_0xb39c('0x4d')]][_0xb39c('0x16')]=utils[_0xb39c('0x17')]();transfers[_0x3fd353['transfertargetuniqueid']][_0xb39c('0x2d')]=utils[_0xb39c('0x17')]();transfers[_0x3fd353[_0xb39c('0x4d')]]['holdtime']=0x0;transfers[_0x3fd353[_0xb39c('0x4d')]]['agententerreason']=0x2;}}}catch(_0x4f1dcc){utils[_0xb39c('0x1c')](util[_0xb39c('0x1a')](_0xb39c('0x4f'),_0x3fd353[_0xb39c('0x40')]),_0x4f1dcc);}};exports[_0xb39c('0x50')]=function(_0x48dd96){try{utils['debug'](util[_0xb39c('0x1a')](_0xb39c('0x51'),_0x48dd96['uniqueid']),_0x48dd96);if(agents[_0x48dd96[_0xb39c('0x4')]]&&agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x21')]===_0xb39c('0x20')){if(_0x48dd96[_0xb39c('0x52')]==='21'){agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x21')]=_0xb39c('0x53');agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0xa')]=_0xb39c('0x53');}utils[_0xb39c('0x2')](util[_0xb39c('0x1a')](_0xb39c('0x54'),_0x48dd96[_0xb39c('0x4')],agents[_0x48dd96['uniqueid']][_0xb39c('0x7')],agents[_0x48dd96['uniqueid']][_0xb39c('0x21')],agents[_0x48dd96[_0xb39c('0x4')]]['lastevent']));writeDB(agents[_0x48dd96[_0xb39c('0x4')]]);var _0x391361=unanswered[_0xb39c('0x55')](_0x48dd96[_0xb39c('0x4')]);if(_0x391361>-0x1){unanswered[_0xb39c('0x56')](_0x391361,0x1);}}if(transfers[_0x48dd96[_0xb39c('0x4')]]){transfers[_0x48dd96['uniqueid']][_0xb39c('0x57')]=!![];transfers[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x35')]=utils[_0xb39c('0x17')]();transfers[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x24')]=utils[_0xb39c('0x34')](transfers[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x35')],transfers[_0x48dd96['uniqueid']][_0xb39c('0x2d')]);transfers[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x21')]=_0xb39c('0x58');transfers[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0xa')]=_0xb39c('0x36');utils['info'](util[_0xb39c('0x1a')](_0xb39c('0x54'),_0x48dd96[_0xb39c('0x4')],transfers[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x7')],transfers[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x21')],transfers[_0x48dd96[_0xb39c('0x4')]]['lastevent']));writeDB(transfers[_0x48dd96[_0xb39c('0x4')]],!![]);}if(agents[_0x48dd96['uniqueid']]&&agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x2d')]){agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x57')]=!![];agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x35')]=utils[_0xb39c('0x17')]();agents[_0x48dd96[_0xb39c('0x4')]]['talktime']=utils[_0xb39c('0x34')](agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x35')],agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x2d')]);agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x21')]=agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x43')]?_0xb39c('0x43'):_0xb39c('0x58');agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0xa')]=_0xb39c('0x36');utils[_0xb39c('0x2')](util[_0xb39c('0x1a')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x48dd96['uniqueid'],agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0x7')],agents[_0x48dd96[_0xb39c('0x4')]]['reason'],agents[_0x48dd96[_0xb39c('0x4')]][_0xb39c('0xa')]));writeDB(agents[_0x48dd96[_0xb39c('0x4')]]);}}catch(_0x1dae6){utils[_0xb39c('0x1c')](util[_0xb39c('0x1a')](_0xb39c('0x51'),_0x48dd96['uniqueid']),_0x1dae6);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 359ef5c..f70fc83 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 _0x8332=['lodash','util','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','now','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','origtransfereruniqueid','localtwolinkedid','secondtransfererchannel','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','includes','noop','gotoif'];(function(_0x40440f,_0x5890d2){var _0x3e43a7=function(_0x49b09f){while(--_0x49b09f){_0x40440f['push'](_0x40440f['shift']());}};_0x3e43a7(++_0x5890d2);}(_0x8332,0x184));var _0x2833=function(_0x1b7cc3,_0x390fc5){_0x1b7cc3=_0x1b7cc3-0x0;var _0x48d9d1=_0x8332[_0x1b7cc3];return _0x48d9d1;};'use strict';var _=require(_0x2833('0x0'));var util=require(_0x2833('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0x2833('0x2'),'FAILED','NO\x20ANSWER','NO\x20ANSWER',_0x2833('0x3'),_0x2833('0x4'),_0x2833('0x5'),_0x2833('0x2'),_0x2833('0x2'),_0x2833('0x2')];var channels={};function writeDB(_0x1a3de8){utils[_0x2833('0x6')](util['format'](_0x2833('0x7'),_0x1a3de8[_0x2833('0x8')],_0x1a3de8[_0x2833('0x9')],_0x1a3de8['queue'],_0x1a3de8['membername'],_0x1a3de8[_0x2833('0xa')],_0x1a3de8['calleridnum'],_0x1a3de8['connectedlinenum'],_0x1a3de8[_0x2833('0xb')]));if(_0x1a3de8[_0x2833('0xc')]){utils[_0x2833('0xd')](_0x1a3de8['accountcode'])[_0x2833('0xe')](function(_0xce0eb6){if(_0xce0eb6){_0x1a3de8[_0x2833('0xf')]=_0xce0eb6['id'];}utils[_0x2833('0x10')](_0x2833('0x11'),_0x1a3de8);});}else{utils['request']('CreateVoiceCallReport',_0x1a3de8);}if(channels[_0x1a3de8[_0x2833('0x8')]]){delete channels[_0x1a3de8[_0x2833('0x8')]];}}exports['newchannel']=function(_0x47c7b8){try{utils[_0x2833('0x12')](util['format'](_0x2833('0x13'),_0x47c7b8[_0x2833('0x8')]),_0x47c7b8);if(_0x47c7b8['uniqueid']==_0x47c7b8[_0x2833('0x14')]&&_0x47c7b8[_0x2833('0x9')]!=_0x2833('0x15')){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x17'),_0x47c7b8[_0x2833('0x8')],_0x47c7b8[_0x2833('0x18')],_0x47c7b8['exten']));channels[_0x47c7b8['uniqueid']]={'uniqueid':_0x47c7b8[_0x2833('0x8')],'accountcode':_0x47c7b8[_0x2833('0xc')],'source':_0x47c7b8[_0x2833('0x19')],'destination':_0x47c7b8['exten'],'destinationcontext':_0x47c7b8['context'],'channel':_0x47c7b8[_0x2833('0x9')],'starttime':utils[_0x2833('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2833('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x35fa39){utils['error'](util[_0x2833('0x16')]('[%s][calls][newchannel]',_0x47c7b8[_0x2833('0x8')]),_0x35fa39);}};exports[_0x2833('0x1b')]=function(_0x53606e){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x53606e['uniqueid']),_0x53606e);if(!_[_0x2833('0x1c')](channels[_0x53606e[_0x2833('0x8')]])&&_0x53606e[_0x2833('0x1d')]==0x6){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x1e'),_0x53606e[_0x2833('0x8')],_0x53606e[_0x2833('0x18')],_0x53606e[_0x2833('0x9')]));if(_[_0x2833('0x1c')](channels[_0x53606e[_0x2833('0x8')]][_0x2833('0x1f')])){channels[_0x53606e[_0x2833('0x8')]][_0x2833('0x1f')]=utils['now']();}}else if(!_[_0x2833('0x1c')](channels[_0x53606e[_0x2833('0x14')]])&&_0x53606e[_0x2833('0x1d')]==0x6&&_0x53606e[_0x2833('0x18')]!='transfer'){utils['info'](util[_0x2833('0x16')](_0x2833('0x20'),_0x53606e['uniqueid'],_0x53606e[_0x2833('0x14')],_0x53606e[_0x2833('0x18')],_0x53606e[_0x2833('0x9')]));channels[_0x53606e[_0x2833('0x14')]][_0x2833('0xc')]=_0x53606e[_0x2833('0xc')];channels[_0x53606e[_0x2833('0x14')]][_0x2833('0x21')]=_0x53606e[_0x2833('0x9')];if(_[_0x2833('0x1c')](channels[_0x53606e[_0x2833('0x14')]][_0x2833('0x22')])){channels[_0x53606e['linkedid']]['answertime']=utils[_0x2833('0x1a')]();}channels[_0x53606e[_0x2833('0x14')]][_0x2833('0x23')]=dispositions[_['toNumber'](_0x53606e[_0x2833('0x1d')])]||_0x2833('0x4');}}catch(_0x51d424){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x25'),_0x53606e['uniqueid']),_0x51d424);}};exports[_0x2833('0x26')]=function(_0x569487){try{if(!_[_0x2833('0x1c')](channels[_0x569487[_0x2833('0x8')]])){utils['debug'](util[_0x2833('0x16')](_0x2833('0x27'),_0x569487[_0x2833('0x8')]),_0x569487);if(_[_0x2833('0x1c')](channels[_0x569487[_0x2833('0x8')]][_0x2833('0x28')])){channels[_0x569487[_0x2833('0x8')]][_0x2833('0x28')]=_0x569487['calleridname']+'\x20<'+_0x569487[_0x2833('0x19')]+'>';}utils[_0x2833('0x6')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x569487['uniqueid'],channels[_0x569487['uniqueid']][_0x2833('0x28')],_0x569487[_0x2833('0x29')]));channels[_0x569487[_0x2833('0x8')]][_0x2833('0x2a')]=utils['now']();channels[_0x569487[_0x2833('0x8')]][_0x2833('0x2b')]=utils[_0x2833('0x2c')](channels[_0x569487['uniqueid']]['endtime'],channels[_0x569487[_0x2833('0x8')]][_0x2833('0x2d')]);channels[_0x569487[_0x2833('0x8')]]['billableseconds']=channels[_0x569487[_0x2833('0x8')]]['answertime']?utils[_0x2833('0x2c')](channels[_0x569487[_0x2833('0x8')]][_0x2833('0x2a')],channels[_0x569487[_0x2833('0x8')]]['answertime']):0x0;writeDB(channels[_0x569487[_0x2833('0x8')]]);}}catch(_0x15dec9){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x27'),_0x569487[_0x2833('0x8')]),_0x15dec9);}};exports[_0x2833('0x2e')]=function(_0x57f1f2){try{if(!_[_0x2833('0x1c')](channels[_0x57f1f2['localtwolinkedid']])){utils[_0x2833('0x12')](util[_0x2833('0x16')]('[%s][calls][attendedtransfer]',_0x57f1f2[_0x2833('0x2f')]),_0x57f1f2);if(channels[_0x57f1f2[_0x2833('0x30')]][_0x2833('0x9')]==_0x57f1f2['transfereechannel']){utils[_0x2833('0x6')](util[_0x2833('0x16')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x57f1f2[_0x2833('0x2f')],_0x57f1f2[_0x2833('0x30')],_0x57f1f2['secondtransfererchannel']));channels[_0x57f1f2[_0x2833('0x30')]][_0x2833('0x21')]=_0x57f1f2[_0x2833('0x31')];channels[_0x57f1f2['localtwolinkedid']]['userfield']=_0x2833('0x32');}else if(channels[_0x57f1f2[_0x2833('0x30')]]['channel']=_0x57f1f2['transfertargetchannel']){utils[_0x2833('0x6')](util['format'](_0x2833('0x33'),_0x57f1f2[_0x2833('0x2f')],_0x57f1f2[_0x2833('0x30')],_0x57f1f2['origtransfererchannel']));channels[_0x57f1f2[_0x2833('0x30')]][_0x2833('0x21')]=_0x57f1f2[_0x2833('0x34')];channels[_0x57f1f2[_0x2833('0x30')]]['userfield']='_attended';}}}catch(_0x33d7b4){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x35'),_0x57f1f2[_0x2833('0x2f')]),_0x33d7b4);}};exports[_0x2833('0x36')]=function(_0x5e0290){try{if(!_[_0x2833('0x1c')](channels[_0x5e0290[_0x2833('0x8')]])){utils[_0x2833('0x12')](util[_0x2833('0x16')]('[%s][calls][musiconholdstart]',_0x5e0290[_0x2833('0x8')]),_0x5e0290);channels[_0x5e0290[_0x2833('0x8')]][_0x2833('0x37')]=utils['now']();utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x38'),_0x5e0290[_0x2833('0x8')],channels[_0x5e0290[_0x2833('0x8')]][_0x2833('0x37')]));}}catch(_0x78acb2){utils['error'](util[_0x2833('0x16')](_0x2833('0x39'),_0x5e0290['uniqueid']),_0x78acb2);}};exports[_0x2833('0x3a')]=function(_0x88d660){try{if(!_[_0x2833('0x1c')](channels[_0x88d660['uniqueid']])){utils[_0x2833('0x12')](util[_0x2833('0x16')](_0x2833('0x3b'),_0x88d660[_0x2833('0x8')]),_0x88d660);if(!_[_0x2833('0x1c')](channels[_0x88d660[_0x2833('0x8')]][_0x2833('0x37')])){channels[_0x88d660['uniqueid']][_0x2833('0x3c')]+=utils[_0x2833('0x2c')](utils[_0x2833('0x1a')](),channels[_0x88d660['uniqueid']][_0x2833('0x37')]);utils['info'](util[_0x2833('0x16')](_0x2833('0x3d'),_0x88d660[_0x2833('0x8')],channels[_0x88d660[_0x2833('0x8')]][_0x2833('0x3c')]));delete channels[_0x88d660['uniqueid']][_0x2833('0x37')];}}}catch(_0x3d380c){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x3b'),_0x88d660[_0x2833('0x8')]),_0x3d380c);}};exports[_0x2833('0x3e')]=function(_0x2ab5a5){try{if(!_['isNil'](channels[_0x2ab5a5[_0x2833('0x8')]])){utils[_0x2833('0x12')](util[_0x2833('0x16')](_0x2833('0x3f'),_0x2ab5a5['uniqueid']),_0x2ab5a5);if(!_['isNil'](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x41')])){utils[_0x2833('0x6')](util[_0x2833('0x16')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5['uniqueid']]['source']=_0x2ab5a5[_0x2833('0x42')];}if(!_['isNil'](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x43')])){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x44'),_0x2ab5a5['uniqueid'],_0x2ab5a5['value']));channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x45')]=_0x2ab5a5[_0x2833('0x42')];channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x28')]='\x22'+_0x2ab5a5[_0x2833('0x42')]+'\x22\x20<'+_0x2ab5a5[_0x2833('0x42')]+'>';}if(!_[_0x2833('0x1c')](_0x2ab5a5[_0x2833('0x40')]['xmd-callerid-preview'])||!_[_0x2833('0x1c')](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x46')])){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x47'),_0x2ab5a5[_0x2833('0x8')],!_[_0x2833('0x1c')](_0x2ab5a5['variable'][_0x2833('0x48')])?'xmd-callerid-preview':_0x2833('0x46'),_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5['uniqueid']][_0x2833('0x28')]=_0x2ab5a5[_0x2833('0x42')];}if(!_['isNil'](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x49')])||!_[_0x2833('0x1c')](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x4a')])){utils['info'](util[_0x2833('0x16')](_0x2833('0x47'),_0x2ab5a5['uniqueid'],!_['isNil'](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x49')])?_0x2833('0x49'):_0x2833('0x4a'),_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x4b')]=_0x2833('0x4c');channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x4d')]=_0x2ab5a5[_0x2833('0x42')];channels[_0x2ab5a5[_0x2833('0x8')]]['queue']=!![];}if(!_[_0x2833('0x1c')](_0x2ab5a5['variable'][_0x2833('0x4e')])){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x4f'),_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]]['ContactId']=_0x2ab5a5[_0x2833('0x42')];}if(!_[_0x2833('0x1c')](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x50')])){utils[_0x2833('0x6')](util['format'](_0x2833('0x51'),_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]]['type']=_0x2ab5a5[_0x2833('0x42')];}if(!_['isNil'](_0x2ab5a5[_0x2833('0x40')]['outboundrouteid'])){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x52'),_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x53')]=_0x2ab5a5[_0x2833('0x42')];}if(!_['isNil'](_0x2ab5a5['variable']['sipcallid'])){utils[_0x2833('0x6')](util['format'](_0x2833('0x54'),_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]]['sipcallid']=_0x2ab5a5[_0x2833('0x42')];}}}catch(_0x2999e){utils[_0x2833('0x24')](util['format'](_0x2833('0x3f'),_0x2ab5a5[_0x2833('0x8')]),_0x2999e);}};exports['newexten']=function(_0x7da627){try{if(!_[_0x2833('0x1c')](channels[_0x7da627[_0x2833('0x8')]])){utils[_0x2833('0x12')](util[_0x2833('0x16')](_0x2833('0x55'),_0x7da627[_0x2833('0x8')]),_0x7da627);utils[_0x2833('0x6')](util['format'](_0x2833('0x56'),_0x7da627[_0x2833('0x8')],_0x7da627[_0x2833('0x57')],_0x7da627[_0x2833('0x58')]));if(_0x7da627[_0x2833('0x57')][_0x2833('0x59')]()==_0x2833('0x5a')&&_[_0x2833('0x5b')](_0x7da627[_0x2833('0x58')]['toLowerCase'](),_0x2833('0x5c'))){var _0x3a3cc6=_0x7da627[_0x2833('0x58')]['split']('=');var _0x58f924=_0x3a3cc6[0x0][_0x2833('0x5d')](_0x3a3cc6[0x0]['lastIndexOf']('(')+0x1,_0x3a3cc6[0x0]['lastIndexOf'](')'));var _0x11bd8c=_0x3a3cc6[0x1];channels[_0x7da627[_0x2833('0x8')]][_0x58f924]=_0x11bd8c;}if(!_[_0x2833('0x5e')]([_0x2833('0x26'),_0x2833('0x5f'),'execif',_0x2833('0x5a'),_0x2833('0x60')],_0x7da627[_0x2833('0x57')]['toLowerCase']())){channels[_0x7da627[_0x2833('0x8')]][_0x2833('0x4b')]=_0x7da627[_0x2833('0x57')];channels[_0x7da627[_0x2833('0x8')]][_0x2833('0x4d')]=_0x7da627[_0x2833('0x58')];}}}catch(_0x3aee15){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x55'),_0x7da627[_0x2833('0x8')]),_0x3aee15);}}; \ No newline at end of file +var _0xefd3=['outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','startsWith','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','channel','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','ANSWERED','isNil','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','xmd-callerid-preview','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s'];(function(_0x23f2a7,_0x3bc14f){var _0x547933=function(_0x4137e0){while(--_0x4137e0){_0x23f2a7['push'](_0x23f2a7['shift']());}};_0x547933(++_0x3bc14f);}(_0xefd3,0x1cd));var _0x3efd=function(_0x1630f1,_0x4c5a46){_0x1630f1=_0x1630f1-0x0;var _0x20a02b=_0xefd3[_0x1630f1];return _0x20a02b;};'use strict';var _=require(_0x3efd('0x0'));var util=require(_0x3efd('0x1'));var utils=require(_0x3efd('0x2'));var dispositions=[_0x3efd('0x3'),'FAILED',_0x3efd('0x4'),'NO\x20ANSWER',_0x3efd('0x3'),_0x3efd('0x3'),'ANSWERED','BUSY',_0x3efd('0x4'),_0x3efd('0x4'),_0x3efd('0x4')];var channels={};function writeDB(_0x272742){utils[_0x3efd('0x5')](util[_0x3efd('0x6')](_0x3efd('0x7'),_0x272742[_0x3efd('0x8')],_0x272742['channel'],_0x272742[_0x3efd('0x9')],_0x272742['membername'],_0x272742[_0x3efd('0xa')],_0x272742[_0x3efd('0xb')],_0x272742[_0x3efd('0xc')],_0x272742['lastevent']));if(_0x272742[_0x3efd('0xd')]){utils[_0x3efd('0xe')](_0x272742[_0x3efd('0xd')])[_0x3efd('0xf')](function(_0x1e0f68){if(_0x1e0f68){_0x272742[_0x3efd('0x10')]=_0x1e0f68['id'];}utils[_0x3efd('0x11')](_0x3efd('0x12'),_0x272742);});}else{utils[_0x3efd('0x11')](_0x3efd('0x12'),_0x272742);}if(channels[_0x272742[_0x3efd('0x8')]]){delete channels[_0x272742[_0x3efd('0x8')]];}}exports[_0x3efd('0x13')]=function(_0x3e91ce){try{utils[_0x3efd('0x14')](util['format'](_0x3efd('0x15'),_0x3e91ce[_0x3efd('0x8')]),_0x3e91ce);if(_0x3e91ce['uniqueid']==_0x3e91ce[_0x3efd('0x16')]&&_0x3e91ce['channel']!=_0x3efd('0x17')){utils[_0x3efd('0x5')](util['format'](_0x3efd('0x18'),_0x3e91ce[_0x3efd('0x8')],_0x3e91ce['context'],_0x3e91ce[_0x3efd('0x19')]));channels[_0x3e91ce[_0x3efd('0x8')]]={'uniqueid':_0x3e91ce[_0x3efd('0x8')],'accountcode':_0x3e91ce[_0x3efd('0xd')],'source':_0x3e91ce[_0x3efd('0xb')],'destination':_0x3e91ce['exten'],'destinationcontext':_0x3e91ce['context'],'channel':_0x3e91ce[_0x3efd('0x1a')],'starttime':utils[_0x3efd('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3efd('0x3'),'amaflags':_0x3efd('0x1c')};}}catch(_0xf3264d){utils[_0x3efd('0x1d')](util['format']('[%s][calls][newchannel]',_0x3e91ce[_0x3efd('0x8')]),_0xf3264d);}};exports[_0x3efd('0x1e')]=function(_0x6838ed){try{utils[_0x3efd('0x14')](util['format'](_0x3efd('0x1f'),_0x6838ed[_0x3efd('0x8')]),_0x6838ed);if(!_['isNil'](channels[_0x6838ed['uniqueid']])&&_0x6838ed['channelstate']==0x6){utils[_0x3efd('0x5')](util[_0x3efd('0x6')](_0x3efd('0x20'),_0x6838ed[_0x3efd('0x8')],_0x6838ed[_0x3efd('0x21')],_0x6838ed[_0x3efd('0x1a')]));if(_['isNil'](channels[_0x6838ed[_0x3efd('0x8')]]['systemanswertime'])){channels[_0x6838ed[_0x3efd('0x8')]]['systemanswertime']=utils[_0x3efd('0x1b')]();}}else if(!_['isNil'](channels[_0x6838ed[_0x3efd('0x16')]])&&_0x6838ed[_0x3efd('0x22')]==0x6&&_0x6838ed['context']!=_0x3efd('0x23')){utils[_0x3efd('0x5')](util['format'](_0x3efd('0x24'),_0x6838ed[_0x3efd('0x8')],_0x6838ed[_0x3efd('0x16')],_0x6838ed['context'],_0x6838ed['channel']));channels[_0x6838ed['linkedid']]['accountcode']=_0x6838ed['accountcode'];channels[_0x6838ed[_0x3efd('0x16')]][_0x3efd('0x25')]=_0x6838ed['channel'];if(_['isNil'](channels[_0x6838ed[_0x3efd('0x16')]][_0x3efd('0x26')])){channels[_0x6838ed[_0x3efd('0x16')]][_0x3efd('0x26')]=utils[_0x3efd('0x1b')]();}channels[_0x6838ed[_0x3efd('0x16')]]['disposition']=dispositions[_[_0x3efd('0x27')](_0x6838ed['channelstate'])]||_0x3efd('0x28');}}catch(_0xa95347){utils[_0x3efd('0x1d')](util[_0x3efd('0x6')]('[%s][calls][newstate]',_0x6838ed[_0x3efd('0x8')]),_0xa95347);}};exports['hangup']=function(_0x4f2874){try{if(!_[_0x3efd('0x29')](channels[_0x4f2874[_0x3efd('0x8')]])){utils[_0x3efd('0x14')](util['format']('[%s][calls][hangup]',_0x4f2874[_0x3efd('0x8')]),_0x4f2874);if(_[_0x3efd('0x29')](channels[_0x4f2874[_0x3efd('0x8')]]['callerid'])){channels[_0x4f2874[_0x3efd('0x8')]][_0x3efd('0x2a')]=_0x4f2874[_0x3efd('0x2b')]+'\x20<'+_0x4f2874[_0x3efd('0xb')]+'>';}utils[_0x3efd('0x5')](util[_0x3efd('0x6')](_0x3efd('0x2c'),_0x4f2874[_0x3efd('0x8')],channels[_0x4f2874[_0x3efd('0x8')]]['callerid'],_0x4f2874[_0x3efd('0x2d')]));channels[_0x4f2874[_0x3efd('0x8')]][_0x3efd('0x2e')]=utils[_0x3efd('0x1b')]();channels[_0x4f2874[_0x3efd('0x8')]]['duration']=utils[_0x3efd('0x2f')](channels[_0x4f2874['uniqueid']][_0x3efd('0x2e')],channels[_0x4f2874['uniqueid']][_0x3efd('0x30')]);channels[_0x4f2874[_0x3efd('0x8')]][_0x3efd('0x31')]=channels[_0x4f2874[_0x3efd('0x8')]][_0x3efd('0x26')]?utils[_0x3efd('0x2f')](channels[_0x4f2874[_0x3efd('0x8')]][_0x3efd('0x2e')],channels[_0x4f2874['uniqueid']][_0x3efd('0x26')]):0x0;writeDB(channels[_0x4f2874[_0x3efd('0x8')]]);}}catch(_0x35affb){utils[_0x3efd('0x1d')](util[_0x3efd('0x6')](_0x3efd('0x32'),_0x4f2874[_0x3efd('0x8')]),_0x35affb);}};exports[_0x3efd('0x33')]=function(_0x2867bc){try{if(!_[_0x3efd('0x29')](channels[_0x2867bc['localtwolinkedid']])){utils[_0x3efd('0x14')](util['format'](_0x3efd('0x34'),_0x2867bc[_0x3efd('0x35')]),_0x2867bc);if(channels[_0x2867bc[_0x3efd('0x36')]][_0x3efd('0x1a')]==_0x2867bc[_0x3efd('0x37')]){utils['info'](util[_0x3efd('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2867bc[_0x3efd('0x35')],_0x2867bc[_0x3efd('0x36')],_0x2867bc['secondtransfererchannel']));channels[_0x2867bc[_0x3efd('0x36')]]['destinationchannel']=_0x2867bc['secondtransfererchannel'];channels[_0x2867bc[_0x3efd('0x36')]]['userfield']='_attended';}else if(channels[_0x2867bc[_0x3efd('0x36')]][_0x3efd('0x1a')]=_0x2867bc[_0x3efd('0x38')]){utils[_0x3efd('0x5')](util['format'](_0x3efd('0x39'),_0x2867bc['origtransfereruniqueid'],_0x2867bc[_0x3efd('0x36')],_0x2867bc['origtransfererchannel']));channels[_0x2867bc[_0x3efd('0x36')]][_0x3efd('0x25')]=_0x2867bc[_0x3efd('0x3a')];channels[_0x2867bc['localtwolinkedid']][_0x3efd('0x3b')]='_attended';}}}catch(_0x2cea2f){utils[_0x3efd('0x1d')](util[_0x3efd('0x6')]('[%s][calls][attendedtransfer]',_0x2867bc['origtransfereruniqueid']),_0x2cea2f);}};exports[_0x3efd('0x3c')]=function(_0xb52831){try{if(!_[_0x3efd('0x29')](channels[_0xb52831[_0x3efd('0x8')]])){utils[_0x3efd('0x14')](util[_0x3efd('0x6')](_0x3efd('0x3d'),_0xb52831[_0x3efd('0x8')]),_0xb52831);channels[_0xb52831[_0x3efd('0x8')]][_0x3efd('0x3e')]=utils[_0x3efd('0x1b')]();utils[_0x3efd('0x5')](util[_0x3efd('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0xb52831['uniqueid'],channels[_0xb52831[_0x3efd('0x8')]][_0x3efd('0x3e')]));}}catch(_0x59e2d3){utils[_0x3efd('0x1d')](util[_0x3efd('0x6')](_0x3efd('0x3d'),_0xb52831[_0x3efd('0x8')]),_0x59e2d3);}};exports[_0x3efd('0x3f')]=function(_0x2612e5){try{if(!_[_0x3efd('0x29')](channels[_0x2612e5[_0x3efd('0x8')]])){utils[_0x3efd('0x14')](util['format'](_0x3efd('0x40'),_0x2612e5['uniqueid']),_0x2612e5);if(!_['isNil'](channels[_0x2612e5[_0x3efd('0x8')]][_0x3efd('0x3e')])){channels[_0x2612e5[_0x3efd('0x8')]][_0x3efd('0x41')]+=utils[_0x3efd('0x2f')](utils[_0x3efd('0x1b')](),channels[_0x2612e5[_0x3efd('0x8')]][_0x3efd('0x3e')]);utils[_0x3efd('0x5')](util[_0x3efd('0x6')](_0x3efd('0x42'),_0x2612e5[_0x3efd('0x8')],channels[_0x2612e5[_0x3efd('0x8')]]['mohtime']));delete channels[_0x2612e5[_0x3efd('0x8')]][_0x3efd('0x3e')];}}}catch(_0x5207a4){utils['error'](util[_0x3efd('0x6')](_0x3efd('0x40'),_0x2612e5['uniqueid']),_0x5207a4);}};exports[_0x3efd('0x43')]=function(_0x38b03e){try{if(!_[_0x3efd('0x29')](channels[_0x38b03e['uniqueid']])){utils[_0x3efd('0x14')](util['format']('[%s][calls][varset]',_0x38b03e[_0x3efd('0x8')]),_0x38b03e);if(!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')][_0x3efd('0x45')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x38b03e['uniqueid'],_0x38b03e[_0x3efd('0x46')]));channels[_0x38b03e[_0x3efd('0x8')]][_0x3efd('0x47')]=_0x38b03e[_0x3efd('0x46')];}if(!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')][_0x3efd('0x48')])){utils[_0x3efd('0x5')](util[_0x3efd('0x6')](_0x3efd('0x49'),_0x38b03e[_0x3efd('0x8')],_0x38b03e[_0x3efd('0x46')]));channels[_0x38b03e[_0x3efd('0x8')]][_0x3efd('0x4a')]=_0x38b03e[_0x3efd('0x46')];channels[_0x38b03e[_0x3efd('0x8')]][_0x3efd('0x2a')]='\x22'+_0x38b03e[_0x3efd('0x46')]+_0x3efd('0x4b')+_0x38b03e[_0x3efd('0x46')]+'>';}if(!_['isNil'](_0x38b03e[_0x3efd('0x44')]['xmd-callerid-preview'])||!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')][_0x3efd('0x4c')])){utils[_0x3efd('0x5')](util[_0x3efd('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x38b03e[_0x3efd('0x8')],!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')]['xmd-callerid-preview'])?_0x3efd('0x4d'):_0x3efd('0x4c'),_0x38b03e[_0x3efd('0x46')]));channels[_0x38b03e[_0x3efd('0x8')]]['callerid']=_0x38b03e[_0x3efd('0x46')];}if(!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')]['xmd-queue'])||!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')][_0x3efd('0x4e')])){utils['info'](util[_0x3efd('0x6')](_0x3efd('0x4f'),_0x38b03e['uniqueid'],!_[_0x3efd('0x29')](_0x38b03e['variable'][_0x3efd('0x50')])?_0x3efd('0x50'):'xmcs-queue',_0x38b03e[_0x3efd('0x46')]));channels[_0x38b03e[_0x3efd('0x8')]][_0x3efd('0x51')]=_0x3efd('0x52');channels[_0x38b03e[_0x3efd('0x8')]][_0x3efd('0x53')]=_0x38b03e[_0x3efd('0x46')];channels[_0x38b03e['uniqueid']][_0x3efd('0x9')]=!![];}if(!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')][_0x3efd('0x54')])){utils['info'](util[_0x3efd('0x6')](_0x3efd('0x55'),_0x38b03e['uniqueid'],_0x38b03e[_0x3efd('0x46')]));channels[_0x38b03e[_0x3efd('0x8')]][_0x3efd('0x56')]=_0x38b03e[_0x3efd('0x46')];}if(!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')][_0x3efd('0x57')])){utils[_0x3efd('0x5')](util['format'](_0x3efd('0x58'),_0x38b03e[_0x3efd('0x8')],_0x38b03e[_0x3efd('0x46')]));channels[_0x38b03e['uniqueid']]['type']=_0x38b03e[_0x3efd('0x46')];}if(!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')][_0x3efd('0x59')])){utils['info'](util[_0x3efd('0x6')](_0x3efd('0x5a'),_0x38b03e[_0x3efd('0x8')],_0x38b03e[_0x3efd('0x46')]));channels[_0x38b03e[_0x3efd('0x8')]][_0x3efd('0x5b')]=_0x38b03e['value'];}if(!_[_0x3efd('0x29')](_0x38b03e[_0x3efd('0x44')]['sipcallid'])){utils[_0x3efd('0x5')](util['format'](_0x3efd('0x5c'),_0x38b03e[_0x3efd('0x8')],_0x38b03e['value']));channels[_0x38b03e['uniqueid']]['sipcallid']=_0x38b03e[_0x3efd('0x46')];}}}catch(_0x142df0){utils[_0x3efd('0x1d')](util[_0x3efd('0x6')](_0x3efd('0x5d'),_0x38b03e[_0x3efd('0x8')]),_0x142df0);}};exports[_0x3efd('0x5e')]=function(_0x3abb21){try{if(!_[_0x3efd('0x29')](channels[_0x3abb21[_0x3efd('0x8')]])){utils[_0x3efd('0x14')](util[_0x3efd('0x6')]('[%s][calls][newexten]',_0x3abb21[_0x3efd('0x8')]),_0x3abb21);utils['info'](util[_0x3efd('0x6')](_0x3efd('0x5f'),_0x3abb21['uniqueid'],_0x3abb21['application'],_0x3abb21['appdata']));if(_0x3abb21[_0x3efd('0x60')]['toLowerCase']()=='set'&&_[_0x3efd('0x61')](_0x3abb21[_0x3efd('0x62')][_0x3efd('0x63')](),_0x3efd('0x64'))){var _0x1bbeab=_0x3abb21[_0x3efd('0x62')][_0x3efd('0x65')]('=');var _0xe11c57=_0x1bbeab[0x0][_0x3efd('0x66')](_0x1bbeab[0x0][_0x3efd('0x67')]('(')+0x1,_0x1bbeab[0x0]['lastIndexOf'](')'));var _0x569c21=_0x1bbeab[0x1];channels[_0x3abb21[_0x3efd('0x8')]][_0xe11c57]=_0x569c21;}if(!_[_0x3efd('0x68')](['hangup',_0x3efd('0x69'),_0x3efd('0x6a'),_0x3efd('0x6b'),_0x3efd('0x6c')],_0x3abb21[_0x3efd('0x60')][_0x3efd('0x63')]())){channels[_0x3abb21[_0x3efd('0x8')]][_0x3efd('0x51')]=_0x3abb21[_0x3efd('0x60')];channels[_0x3abb21[_0x3efd('0x8')]][_0x3efd('0x53')]=_0x3abb21['appdata'];}}}catch(_0x5217e0){utils[_0x3efd('0x1d')](util[_0x3efd('0x6')](_0x3efd('0x6d'),_0x3abb21[_0x3efd('0x8')]),_0x5217e0);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 0175092..41e39e5 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 _0xbcc3=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown'];(function(_0x63500b,_0x508aa1){var _0x492332=function(_0x1dc594){while(--_0x1dc594){_0x63500b['push'](_0x63500b['shift']());}};_0x492332(++_0x508aa1);}(_0xbcc3,0xab));var _0x3bcc=function(_0x344128,_0x9b9e88){_0x344128=_0x344128-0x0;var _0x693fae=_0xbcc3[_0x344128];return _0x693fae;};'use strict';var utils=require('./utils');exports[_0x3bcc('0x0')]=function(){utils['info'](_0x3bcc('0x1'));};exports[_0x3bcc('0x2')]=function(){utils[_0x3bcc('0x3')](_0x3bcc('0x4'));};exports[_0x3bcc('0x5')]=function(){utils[_0x3bcc('0x3')](_0x3bcc('0x6'));};exports['error']=function(_0x21f31a){utils[_0x3bcc('0x7')](_0x3bcc('0x8'),_0x21f31a);};exports['close']=function(){utils[_0x3bcc('0x3')](_0x3bcc('0x9'));};exports[_0x3bcc('0xa')]=function(_0x36bcdf){}; \ No newline at end of file +var _0x1d59=['error','[core]\x20error','[core]\x20close','managerevent','./utils','info','shutdown','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x3e5eb4,_0x11190f){var _0x57397d=function(_0x5ba64f){while(--_0x5ba64f){_0x3e5eb4['push'](_0x3e5eb4['shift']());}};_0x57397d(++_0x11190f);}(_0x1d59,0xa6));var _0x91d5=function(_0x57157b,_0x27fd81){_0x57157b=_0x57157b-0x0;var _0x1eb4fc=_0x1d59[_0x57157b];return _0x1eb4fc;};'use strict';var utils=require(_0x91d5('0x0'));exports['connect']=function(){utils[_0x91d5('0x1')]('[core]\x20connected');};exports[_0x91d5('0x2')]=function(){utils[_0x91d5('0x1')](_0x91d5('0x3'));};exports['fullybooted']=function(){utils[_0x91d5('0x1')](_0x91d5('0x4'));};exports[_0x91d5('0x5')]=function(_0x40c175){utils[_0x91d5('0x5')](_0x91d5('0x6'),_0x40c175);};exports['close']=function(){utils[_0x91d5('0x1')](_0x91d5('0x7'));};exports[_0x91d5('0x8')]=function(_0x10b3d1){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index b7c1806..b524350 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 _0xa5f9=['answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','lodash','util','info','format','uniqueid','dialstring','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa5f9,0xd6));var _0x9a5f=function(_0x4a3f59,_0xe8bfdb){_0x4a3f59=_0x4a3f59-0x0;var _0x49d80e=_0xa5f9[_0x4a3f59];return _0x49d80e;};'use strict';var _=require(_0x9a5f('0x0'));var util=require(_0x9a5f('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x641072){utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x641072[_0x9a5f('0x4')],_0x641072['channel'],_0x641072[_0x9a5f('0x5')],_0x641072['calleridnum'],_0x641072[_0x9a5f('0x6')],_0x641072['dialstatus']));utils[_0x9a5f('0x7')](_0x9a5f('0x8'),_0x641072);delete dials[_0x641072[_0x9a5f('0x4')]];}exports[_0x9a5f('0x9')]=function(_0x51c1fa){try{utils[_0x9a5f('0xa')](util[_0x9a5f('0x3')](_0x9a5f('0xb'),_0x51c1fa['uniqueid']),_0x51c1fa);utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0xc'),_0x51c1fa[_0x9a5f('0x4')],_0x51c1fa[_0x9a5f('0xd')],_0x51c1fa[_0x9a5f('0xe')]));if(_0x51c1fa['application'][_0x9a5f('0xf')]()==_0x9a5f('0x10')&&_[_0x9a5f('0x11')](_0x51c1fa[_0x9a5f('0xe')][_0x9a5f('0xf')](),_0x9a5f('0x12'))){var _0x4c1be8=_0x51c1fa[_0x9a5f('0xe')]['split']('=');dials[_0x51c1fa['uniqueid']]={'routeId':_0x4c1be8[0x1]};}}catch(_0x276b23){utils[_0x9a5f('0x13')](util[_0x9a5f('0x3')](_0x9a5f('0xb'),_0x51c1fa[_0x9a5f('0x4')]),_0x276b23);}};exports['varset']=function(_0x550b4c){try{utils['debug'](util['format'](_0x9a5f('0x14'),_0x550b4c['uniqueid']),_0x550b4c);if(!_[_0x9a5f('0x15')](_0x550b4c['variable'][_0x9a5f('0x16')])){utils[_0x9a5f('0x2')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x550b4c['uniqueid'],_0x550b4c['value']));dials[_0x550b4c[_0x9a5f('0x4')]]={'routeId':_0x550b4c[_0x9a5f('0x17')]};}}catch(_0x11515f){utils['error'](util['format'](_0x9a5f('0x14'),_0x550b4c[_0x9a5f('0x4')]),_0x11515f);}};exports[_0x9a5f('0x18')]=function(_0x2b970e){try{if(!_[_0x9a5f('0x15')](dials[_0x2b970e[_0x9a5f('0x4')]])){utils[_0x9a5f('0xa')](util['format'](_0x9a5f('0x19'),_0x2b970e[_0x9a5f('0x4')]),_0x2b970e);dials[_0x2b970e[_0x9a5f('0x4')]]=_[_0x9a5f('0x1a')](dials[_0x2b970e[_0x9a5f('0x4')]],_0x2b970e);dials[_0x2b970e[_0x9a5f('0x4')]][_0x9a5f('0x1b')]=utils[_0x9a5f('0x1c')]();dials[_0x2b970e[_0x9a5f('0x4')]][_0x9a5f('0x1d')]=_0x9a5f('0x1e');utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0x1f'),_0x2b970e[_0x9a5f('0x4')],dials[_0x2b970e[_0x9a5f('0x4')]][_0x9a5f('0x1b')]));}}catch(_0x3d4eb7){utils[_0x9a5f('0x13')](util['format'](_0x9a5f('0x19'),_0x2b970e[_0x9a5f('0x4')]),_0x3d4eb7);}};exports[_0x9a5f('0x20')]=function(_0xca2ad7){try{if(!_[_0x9a5f('0x15')](dials[_0xca2ad7[_0x9a5f('0x4')]])){utils[_0x9a5f('0xa')](util[_0x9a5f('0x3')](_0x9a5f('0x21'),_0xca2ad7[_0x9a5f('0x4')]),_0xca2ad7);dials[_0xca2ad7[_0x9a5f('0x4')]][_0x9a5f('0x22')]=_0xca2ad7[_0x9a5f('0x22')];if(_0xca2ad7[_0x9a5f('0x22')]==_0x9a5f('0x23')){dials[_0xca2ad7[_0x9a5f('0x4')]]=_[_0x9a5f('0x1a')](dials[_0xca2ad7[_0x9a5f('0x4')]],_0xca2ad7);dials[_0xca2ad7[_0x9a5f('0x4')]][_0x9a5f('0x24')]=utils['now']();dials[_0xca2ad7[_0x9a5f('0x4')]][_0x9a5f('0x1d')]=_0x9a5f('0x25');utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0x26'),_0xca2ad7['uniqueid'],_0xca2ad7[_0x9a5f('0x22')],dials[_0xca2ad7[_0x9a5f('0x4')]][_0x9a5f('0x24')]));}else{utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0x27'),_0xca2ad7[_0x9a5f('0x4')],_0xca2ad7['dialstatus']));}}}catch(_0xd4fa92){utils[_0x9a5f('0x13')](util[_0x9a5f('0x3')](_0x9a5f('0x21'),_0xca2ad7[_0x9a5f('0x4')]),_0xd4fa92);}};exports[_0x9a5f('0x28')]=function(_0x18a89b){try{if(!_[_0x9a5f('0x15')](dials[_0x18a89b[_0x9a5f('0x4')]])){utils['debug'](util[_0x9a5f('0x3')](_0x9a5f('0x29'),_0x18a89b['uniqueid']),_0x18a89b);utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0x2a'),_0x18a89b['uniqueid'],_0x18a89b[_0x9a5f('0x2b')],_0x18a89b[_0x9a5f('0x2c')],_0x18a89b[_0x9a5f('0x2d')]));dials[_0x18a89b[_0x9a5f('0x4')]]=_['assign'](dials[_0x18a89b[_0x9a5f('0x4')]],{'endtime':utils[_0x9a5f('0x1c')](),'lastevent':_0x9a5f('0x2e')});dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x2f')]=utils[_0x9a5f('0x30')](dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x31')],dials[_0x18a89b['uniqueid']]['starttime']);dials[_0x18a89b['uniqueid']]['holdtime']=utils[_0x9a5f('0x30')](dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x24')]||dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x31')],dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x1b')]);dials[_0x18a89b['uniqueid']]['billableseconds']=dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x24')]?utils['diffTime'](dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x31')],dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x24')]):0x0;writeDB(dials[_0x18a89b[_0x9a5f('0x4')]]);}}catch(_0x187187){utils[_0x9a5f('0x13')](util[_0x9a5f('0x3')](_0x9a5f('0x29'),_0x18a89b[_0x9a5f('0x4')]),_0x187187);}}; \ No newline at end of file +var _0x2449=['hangup','calleridname','cause-txt','complete','duration','diffTime','holdtime','billableseconds','endtime','[%s][dials][hangup]','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','application','appdata','startsWith','toLowerCase','error','varset','[%s][dials][varset]','info','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s'];(function(_0x2fae95,_0x3f6e49){var _0x204192=function(_0x5a3bac){while(--_0x5a3bac){_0x2fae95['push'](_0x2fae95['shift']());}};_0x204192(++_0x3f6e49);}(_0x2449,0x196));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9244('0x0'));var util=require(_0x9244('0x1'));var utils=require(_0x9244('0x2'));var dials={};function writeDB(_0x312e6e){utils['info'](util[_0x9244('0x3')](_0x9244('0x4'),_0x312e6e[_0x9244('0x5')],_0x312e6e['channel'],_0x312e6e['dialstring'],_0x312e6e[_0x9244('0x6')],_0x312e6e['connectedlinenum'],_0x312e6e[_0x9244('0x7')]));utils[_0x9244('0x8')](_0x9244('0x9'),_0x312e6e);delete dials[_0x312e6e[_0x9244('0x5')]];}exports['newexten']=function(_0x448001){try{utils[_0x9244('0xa')](util[_0x9244('0x3')](_0x9244('0xb'),_0x448001[_0x9244('0x5')]),_0x448001);utils['info'](util[_0x9244('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x448001[_0x9244('0x5')],_0x448001[_0x9244('0xc')],_0x448001[_0x9244('0xd')]));if(_0x448001[_0x9244('0xc')]['toLowerCase']()=='set'&&_[_0x9244('0xe')](_0x448001[_0x9244('0xd')][_0x9244('0xf')](),'cdr(routeid)')){var _0x12229f=_0x448001[_0x9244('0xd')]['split']('=');dials[_0x448001['uniqueid']]={'routeId':_0x12229f[0x1]};}}catch(_0x125ffe){utils[_0x9244('0x10')](util[_0x9244('0x3')](_0x9244('0xb'),_0x448001[_0x9244('0x5')]),_0x125ffe);}};exports[_0x9244('0x11')]=function(_0x44fd00){try{utils[_0x9244('0xa')](util[_0x9244('0x3')](_0x9244('0x12'),_0x44fd00[_0x9244('0x5')]),_0x44fd00);if(!_['isNil'](_0x44fd00['variable']['outboundrouteid'])){utils[_0x9244('0x13')](util[_0x9244('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x44fd00[_0x9244('0x5')],_0x44fd00[_0x9244('0x14')]));dials[_0x44fd00[_0x9244('0x5')]]={'routeId':_0x44fd00['value']};}}catch(_0x12c7ea){utils[_0x9244('0x10')](util[_0x9244('0x3')](_0x9244('0x12'),_0x44fd00[_0x9244('0x5')]),_0x12c7ea);}};exports[_0x9244('0x15')]=function(_0x531d53){try{if(!_[_0x9244('0x16')](dials[_0x531d53[_0x9244('0x5')]])){utils[_0x9244('0xa')](util['format'](_0x9244('0x17'),_0x531d53[_0x9244('0x5')]),_0x531d53);dials[_0x531d53[_0x9244('0x5')]]=_[_0x9244('0x18')](dials[_0x531d53[_0x9244('0x5')]],_0x531d53);dials[_0x531d53[_0x9244('0x5')]]['starttime']=utils[_0x9244('0x19')]();dials[_0x531d53[_0x9244('0x5')]][_0x9244('0x1a')]=_0x9244('0x1b');utils[_0x9244('0x13')](util[_0x9244('0x3')](_0x9244('0x1c'),_0x531d53[_0x9244('0x5')],dials[_0x531d53['uniqueid']][_0x9244('0x1d')]));}}catch(_0x419efc){utils['error'](util[_0x9244('0x3')](_0x9244('0x17'),_0x531d53[_0x9244('0x5')]),_0x419efc);}};exports[_0x9244('0x1e')]=function(_0x4ce8ea){try{if(!_['isNil'](dials[_0x4ce8ea[_0x9244('0x5')]])){utils[_0x9244('0xa')](util[_0x9244('0x3')]('[%s][dials][dialend]',_0x4ce8ea[_0x9244('0x5')]),_0x4ce8ea);dials[_0x4ce8ea['uniqueid']][_0x9244('0x7')]=_0x4ce8ea[_0x9244('0x7')];if(_0x4ce8ea[_0x9244('0x7')]=='ANSWER'){dials[_0x4ce8ea[_0x9244('0x5')]]=_['assign'](dials[_0x4ce8ea[_0x9244('0x5')]],_0x4ce8ea);dials[_0x4ce8ea[_0x9244('0x5')]][_0x9244('0x1f')]=utils[_0x9244('0x19')]();dials[_0x4ce8ea[_0x9244('0x5')]]['lastevent']='connect';utils[_0x9244('0x13')](util['format'](_0x9244('0x20'),_0x4ce8ea[_0x9244('0x5')],_0x4ce8ea[_0x9244('0x7')],dials[_0x4ce8ea[_0x9244('0x5')]][_0x9244('0x1f')]));}else{utils[_0x9244('0x13')](util[_0x9244('0x3')](_0x9244('0x21'),_0x4ce8ea['uniqueid'],_0x4ce8ea[_0x9244('0x7')]));}}}catch(_0x5246b6){utils[_0x9244('0x10')](util[_0x9244('0x3')]('[%s][dials][dialend]',_0x4ce8ea['uniqueid']),_0x5246b6);}};exports[_0x9244('0x22')]=function(_0x139413){try{if(!_['isNil'](dials[_0x139413['uniqueid']])){utils[_0x9244('0xa')](util['format']('[%s][dials][hangup]',_0x139413[_0x9244('0x5')]),_0x139413);utils[_0x9244('0x13')](util[_0x9244('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x139413[_0x9244('0x5')],_0x139413['calleridnum'],_0x139413[_0x9244('0x23')],_0x139413[_0x9244('0x24')]));dials[_0x139413[_0x9244('0x5')]]=_['assign'](dials[_0x139413[_0x9244('0x5')]],{'endtime':utils[_0x9244('0x19')](),'lastevent':_0x9244('0x25')});dials[_0x139413[_0x9244('0x5')]][_0x9244('0x26')]=utils[_0x9244('0x27')](dials[_0x139413[_0x9244('0x5')]]['endtime'],dials[_0x139413[_0x9244('0x5')]][_0x9244('0x1d')]);dials[_0x139413[_0x9244('0x5')]][_0x9244('0x28')]=utils[_0x9244('0x27')](dials[_0x139413[_0x9244('0x5')]][_0x9244('0x1f')]||dials[_0x139413[_0x9244('0x5')]]['endtime'],dials[_0x139413[_0x9244('0x5')]]['starttime']);dials[_0x139413[_0x9244('0x5')]][_0x9244('0x29')]=dials[_0x139413[_0x9244('0x5')]][_0x9244('0x1f')]?utils[_0x9244('0x27')](dials[_0x139413[_0x9244('0x5')]][_0x9244('0x2a')],dials[_0x139413[_0x9244('0x5')]][_0x9244('0x1f')]):0x0;writeDB(dials[_0x139413[_0x9244('0x5')]]);}}catch(_0x37e567){utils[_0x9244('0x10')](util[_0x9244('0x3')](_0x9244('0x2b'),_0x139413[_0x9244('0x5')]),_0x37e567);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 3a4ea03..6ff26cc 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 _0xc7ee=['shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','debug','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect'];(function(_0x473d1e,_0x4df799){var _0x503be9=function(_0x4bcfff){while(--_0x4bcfff){_0x473d1e['push'](_0x473d1e['shift']());}};_0x503be9(++_0x4df799);}(_0xc7ee,0x1aa));var _0xec7e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc7ee[_0x3bf83f];return _0x22c4a9;};var AsteriskManager=require(_0xec7e('0x0'));var config=require(_0xec7e('0x1'));var utils=require(_0xec7e('0x2'));var util=require(_0xec7e('0x3'));var isXDREnabled=config[_0xec7e('0x4')]&&config[_0xec7e('0x4')]['disabled']?!config[_0xec7e('0x4')][_0xec7e('0x5')]:!![];var isProduction=config[_0xec7e('0x6')]===_0xec7e('0x7')||![];var isLocalAsterisk=config[_0xec7e('0x4')]&&config[_0xec7e('0x4')][_0xec7e('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xec7e('0x9')][_0xec7e('0xa')],config[_0xec7e('0x9')]['ip'],config[_0xec7e('0x9')][_0xec7e('0xb')],config[_0xec7e('0x9')][_0xec7e('0xc')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xec7e('0xd')](_0xec7e('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xec7e('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xec7e('0xf'));var calls=require(_0xec7e('0x10'));var queues=require(_0xec7e('0x11'));var recordings=require(_0xec7e('0x12'));var members=require(_0xec7e('0x13'));var dials=require(_0xec7e('0x14'));var transfers=require(_0xec7e('0x15'));var core=require(_0xec7e('0x16'));ami['on']('connect',core[_0xec7e('0x17')]);ami['on'](_0xec7e('0x18'),core[_0xec7e('0x18')]);ami['on'](_0xec7e('0x19'),core['fullybooted']);ami['on'](_0xec7e('0x1a'),core['error']);ami['on'](_0xec7e('0x1b'),core[_0xec7e('0x1b')]);ami['on'](_0xec7e('0x1c'),core['managerevent']);ami['on'](_0xec7e('0x1d'),function(_0x50bc12){try{utils['debug'](util[_0xec7e('0x1e')](_0xec7e('0x1f'),_0x50bc12[_0xec7e('0x20')]),_0x50bc12);members[_0xec7e('0x1d')](_0x50bc12);}catch(_0x1a3e16){utils[_0xec7e('0x1a')](util['format'](_0xec7e('0x1f'),_0x50bc12[_0xec7e('0x20')]),_0x1a3e16);}});ami['on'](_0xec7e('0x21'),function(_0xdb6bc5){try{utils['debug'](util[_0xec7e('0x1e')]('[%s][index][agentcalled]',_0xdb6bc5[_0xec7e('0x22')]),_0xdb6bc5);agents[_0xec7e('0x21')](_0xdb6bc5);}catch(_0x4a1638){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x23'),_0xdb6bc5[_0xec7e('0x22')]),_0x4a1638);}});ami['on'](_0xec7e('0x24'),function(_0x4c5528){try{utils['debug'](util[_0xec7e('0x1e')](_0xec7e('0x25'),_0x4c5528['uniqueid']),_0x4c5528);agents[_0xec7e('0x24')](_0x4c5528);}catch(_0x5e0281){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x25'),_0x4c5528['uniqueid']),_0x5e0281);}});ami['on']('agentconnect',function(_0x3cb3df){try{utils['debug'](util['format'](_0xec7e('0x26'),_0x3cb3df['uniqueid']),_0x3cb3df);agents[_0xec7e('0x27')](_0x3cb3df);queues[_0xec7e('0x27')](_0x3cb3df);}catch(_0x2f61e7){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x26'),_0x3cb3df['uniqueid']),_0x2f61e7);}});ami['on'](_0xec7e('0x28'),function(_0x337faa){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x2a'),_0x337faa[_0xec7e('0x22')]),_0x337faa);agents[_0xec7e('0x28')](_0x337faa);queues[_0xec7e('0x28')](_0x337faa);members[_0xec7e('0x28')](_0x337faa);}catch(_0x51f315){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x2a'),_0x337faa[_0xec7e('0x22')]),_0x51f315);}});ami['on']('queuecallerabandon',function(_0x4a6a81){try{utils[_0xec7e('0x29')](util['format']('[%s][index][queuecallerabandon]',_0x4a6a81[_0xec7e('0x22')]),_0x4a6a81);agents[_0xec7e('0x2b')](_0x4a6a81);queues[_0xec7e('0x2b')](_0x4a6a81);}catch(_0x6b65e5){utils[_0xec7e('0x1a')](util['format'](_0xec7e('0x2c'),_0x4a6a81[_0xec7e('0x22')]),_0x6b65e5);}});ami['on'](_0xec7e('0x2d'),function(_0x234235){try{utils[_0xec7e('0x29')](util['format']('[%s][index][queuecallerjoin]',_0x234235[_0xec7e('0x22')]),_0x234235);queues[_0xec7e('0x2d')](_0x234235);recordings[_0xec7e('0x2d')](_0x234235);}catch(_0x3d1663){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x2e'),_0x234235[_0xec7e('0x22')]),_0x3d1663);}});ami['on'](_0xec7e('0x2f'),function(_0x1f0616){try{utils['debug'](util[_0xec7e('0x1e')](_0xec7e('0x30'),_0x1f0616[_0xec7e('0x22')]),_0x1f0616);queues['queuecallerleave'](_0x1f0616);}catch(_0x579593){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x30'),_0x1f0616['uniqueid']),_0x579593);}});ami['on'](_0xec7e('0x31'),function(_0x4b4a7f){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')]('[%s][index][musiconholdstart]',_0x4b4a7f['uniqueid']),_0x4b4a7f);queues[_0xec7e('0x31')](_0x4b4a7f);calls[_0xec7e('0x31')](_0x4b4a7f);}catch(_0xb0756c){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x32'),_0x4b4a7f[_0xec7e('0x22')]),_0xb0756c);}});ami['on'](_0xec7e('0x33'),function(_0x2b7f8e){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x34'),_0x2b7f8e[_0xec7e('0x22')]),_0x2b7f8e);queues[_0xec7e('0x33')](_0x2b7f8e);calls['musiconholdstop'](_0x2b7f8e);}catch(_0x34a0aa){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x34'),_0x2b7f8e[_0xec7e('0x22')]),_0x34a0aa);}});ami['on'](_0xec7e('0x35'),function(_0x26d122){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')]('[%s][index][newstate]',_0x26d122[_0xec7e('0x22')]),_0x26d122);calls['newstate'](_0x26d122);recordings[_0xec7e('0x35')](_0x26d122);}catch(_0x25a603){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x36'),_0x26d122[_0xec7e('0x22')]),_0x25a603);}});ami['on']('hangup',function(_0x11237f){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x37'),_0x11237f[_0xec7e('0x22')]),_0x11237f);calls[_0xec7e('0x38')](_0x11237f);recordings[_0xec7e('0x38')](_0x11237f);dials[_0xec7e('0x38')](_0x11237f);agents[_0xec7e('0x38')](_0x11237f);queues[_0xec7e('0x38')](_0x11237f);}catch(_0x38c584){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')]('[%s][index][hangup]',_0x11237f[_0xec7e('0x22')]),_0x38c584);}});ami['on'](_0xec7e('0x39'),function(_0x4784b9){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x3a'),_0x4784b9['uniqueid']),_0x4784b9);members[_0xec7e('0x39')](_0x4784b9);}catch(_0x2d0d72){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x3a'),_0x4784b9[_0xec7e('0x22')]),_0x2d0d72);}});ami['on'](_0xec7e('0x3b'),function(_0x2e0b05){try{utils[_0xec7e('0x29')](util['format'](_0xec7e('0x3c'),_0x2e0b05[_0xec7e('0x22')]),_0x2e0b05);queues[_0xec7e('0x3b')](_0x2e0b05);agents['blindtransfer'](_0x2e0b05);transfers[_0xec7e('0x3b')](_0x2e0b05);}catch(_0x2cb468){utils[_0xec7e('0x1a')](util['format'](_0xec7e('0x3c'),_0x2e0b05[_0xec7e('0x22')]),_0x2cb468);}});ami['on'](_0xec7e('0x3d'),function(_0x463bb9){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x3e'),_0x463bb9[_0xec7e('0x3f')]),_0x463bb9);queues[_0xec7e('0x3d')](_0x463bb9);transfers[_0xec7e('0x3d')](_0x463bb9);agents[_0xec7e('0x3d')](_0x463bb9);calls[_0xec7e('0x3d')](_0x463bb9);}catch(_0x27cd58){utils['error'](util[_0xec7e('0x1e')]('[%s][index][attendedtransfer]',_0x463bb9[_0xec7e('0x3f')]),_0x27cd58);}});ami['on']('varset',function(_0x92e0e5){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x40'),_0x92e0e5[_0xec7e('0x22')]),_0x92e0e5);queues[_0xec7e('0x41')](_0x92e0e5);recordings['varset'](_0x92e0e5);calls['varset'](_0x92e0e5);dials[_0xec7e('0x41')](_0x92e0e5);}catch(_0x11e9af){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x40'),_0x92e0e5['uniqueid']),_0x11e9af);}});ami['on'](_0xec7e('0x42'),function(_0x314e57){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x43'),_0x314e57[_0xec7e('0x22')]),_0x314e57);calls[_0xec7e('0x42')](_0x314e57);recordings[_0xec7e('0x42')](_0x314e57);dials[_0xec7e('0x42')](_0x314e57);}catch(_0x17d986){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')]('[%s][index][newexten]',_0x314e57[_0xec7e('0x22')]),_0x17d986);}});ami['on'](_0xec7e('0x44'),function(_0x2c6e6b){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x45'),_0x2c6e6b[_0xec7e('0x22')]),_0x2c6e6b);calls[_0xec7e('0x44')](_0x2c6e6b);recordings[_0xec7e('0x44')](_0x2c6e6b);}catch(_0x12213e){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x45'),_0x2c6e6b[_0xec7e('0x22')]),_0x12213e);}});ami['on']('dialbegin',function(_0x5665e6){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x46'),_0x5665e6['uniqueid']),_0x5665e6);dials[_0xec7e('0x47')](_0x5665e6);}catch(_0x38e34a){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x48'),_0x5665e6['uniqueid']),_0x38e34a);}});ami['on'](_0xec7e('0x49'),function(_0x44cde2){try{utils[_0xec7e('0x29')](util['format'](_0xec7e('0x4a'),_0x44cde2['uniqueid']),_0x44cde2);dials[_0xec7e('0x49')](_0x44cde2);}catch(_0x5988ea){utils[_0xec7e('0x1a')](util['format']('[%s][index][dialend]',_0x44cde2[_0xec7e('0x22')]),_0x5988ea);}});} \ No newline at end of file +var _0x541a=['env','production','local','asterisk','port','username','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','[%s][index][agentcalled]','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','uniqueid','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled'];(function(_0x41b89f,_0x237cab){var _0x18af88=function(_0x3f5841){while(--_0x3f5841){_0x41b89f['push'](_0x41b89f['shift']());}};_0x18af88(++_0x237cab);}(_0x541a,0xca));var _0xa541=function(_0x5a36dd,_0x5b2d2c){_0x5a36dd=_0x5a36dd-0x0;var _0x15503d=_0x541a[_0x5a36dd];return _0x15503d;};var AsteriskManager=require(_0xa541('0x0'));var config=require('../../config/environment');var utils=require(_0xa541('0x1'));var util=require(_0xa541('0x2'));var isXDREnabled=config[_0xa541('0x3')]&&config[_0xa541('0x3')][_0xa541('0x4')]?!config[_0xa541('0x3')]['disabled']:!![];var isProduction=config[_0xa541('0x5')]===_0xa541('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0xa541('0x3')][_0xa541('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xa541('0x8')][_0xa541('0x9')],config[_0xa541('0x8')]['ip'],config['asterisk'][_0xa541('0xa')],config[_0xa541('0x8')]['password'],!![]);ami[_0xa541('0xb')]();if(!isXDREnabled){utils[_0xa541('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xa541('0xc')](_0xa541('0xd'));}else{var agents=require(_0xa541('0xe'));var calls=require('./calls.controller');var queues=require(_0xa541('0xf'));var recordings=require(_0xa541('0x10'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0xa541('0x11'));ami['on'](_0xa541('0x12'),core[_0xa541('0x12')]);ami['on'](_0xa541('0x13'),core[_0xa541('0x13')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xa541('0x14'),core[_0xa541('0x14')]);ami['on'](_0xa541('0x15'),core[_0xa541('0x15')]);ami['on'](_0xa541('0x16'),core[_0xa541('0x16')]);ami['on'](_0xa541('0x17'),function(_0x3db71b){try{utils[_0xa541('0x18')](util['format'](_0xa541('0x19'),_0x3db71b['device']),_0x3db71b);members[_0xa541('0x17')](_0x3db71b);}catch(_0x53fa3a){utils['error'](util['format']('[%s][index][devicestatechange]',_0x3db71b[_0xa541('0x1a')]),_0x53fa3a);}});ami['on']('agentcalled',function(_0x48c29c){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')](_0xa541('0x1c'),_0x48c29c['uniqueid']),_0x48c29c);agents[_0xa541('0x1d')](_0x48c29c);}catch(_0x32b007){utils[_0xa541('0x14')](util[_0xa541('0x1b')]('[%s][index][agentcalled]',_0x48c29c['uniqueid']),_0x32b007);}});ami['on'](_0xa541('0x1e'),function(_0x787473){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')](_0xa541('0x1f'),_0x787473['uniqueid']),_0x787473);agents[_0xa541('0x1e')](_0x787473);}catch(_0x3e9cef){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x1f'),_0x787473['uniqueid']),_0x3e9cef);}});ami['on'](_0xa541('0x20'),function(_0x29654c){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')](_0xa541('0x21'),_0x29654c[_0xa541('0x22')]),_0x29654c);agents[_0xa541('0x20')](_0x29654c);queues[_0xa541('0x20')](_0x29654c);}catch(_0xe1135f){utils['error'](util['format']('[%s][index][agentconnect]',_0x29654c[_0xa541('0x22')]),_0xe1135f);}});ami['on'](_0xa541('0x23'),function(_0x142e52){try{utils[_0xa541('0x18')](util['format'](_0xa541('0x24'),_0x142e52[_0xa541('0x22')]),_0x142e52);agents[_0xa541('0x23')](_0x142e52);queues['agentcomplete'](_0x142e52);members[_0xa541('0x23')](_0x142e52);}catch(_0x50c9bc){utils[_0xa541('0x14')](util['format'](_0xa541('0x24'),_0x142e52['uniqueid']),_0x50c9bc);}});ami['on'](_0xa541('0x25'),function(_0x358a63){try{utils['debug'](util[_0xa541('0x1b')](_0xa541('0x26'),_0x358a63[_0xa541('0x22')]),_0x358a63);agents[_0xa541('0x25')](_0x358a63);queues['queuecallerabandon'](_0x358a63);}catch(_0x2577c1){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x26'),_0x358a63[_0xa541('0x22')]),_0x2577c1);}});ami['on'](_0xa541('0x27'),function(_0x486208){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')]('[%s][index][queuecallerjoin]',_0x486208['uniqueid']),_0x486208);queues[_0xa541('0x27')](_0x486208);recordings[_0xa541('0x27')](_0x486208);}catch(_0x1a4844){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x28'),_0x486208[_0xa541('0x22')]),_0x1a4844);}});ami['on'](_0xa541('0x29'),function(_0x571fe9){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')](_0xa541('0x2a'),_0x571fe9[_0xa541('0x22')]),_0x571fe9);queues[_0xa541('0x29')](_0x571fe9);}catch(_0x86320f){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x2a'),_0x571fe9[_0xa541('0x22')]),_0x86320f);}});ami['on']('musiconholdstart',function(_0x337b83){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')](_0xa541('0x2b'),_0x337b83[_0xa541('0x22')]),_0x337b83);queues[_0xa541('0x2c')](_0x337b83);calls[_0xa541('0x2c')](_0x337b83);}catch(_0x450fbf){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x2b'),_0x337b83[_0xa541('0x22')]),_0x450fbf);}});ami['on'](_0xa541('0x2d'),function(_0x29f6d9){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')]('[%s][index][musiconholdstop]',_0x29f6d9['uniqueid']),_0x29f6d9);queues[_0xa541('0x2d')](_0x29f6d9);calls[_0xa541('0x2d')](_0x29f6d9);}catch(_0x16405e){utils[_0xa541('0x14')](util['format'](_0xa541('0x2e'),_0x29f6d9[_0xa541('0x22')]),_0x16405e);}});ami['on'](_0xa541('0x2f'),function(_0x25cb2e){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')]('[%s][index][newstate]',_0x25cb2e[_0xa541('0x22')]),_0x25cb2e);calls['newstate'](_0x25cb2e);recordings[_0xa541('0x2f')](_0x25cb2e);}catch(_0x42c22a){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x30'),_0x25cb2e[_0xa541('0x22')]),_0x42c22a);}});ami['on'](_0xa541('0x31'),function(_0x3870da){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')](_0xa541('0x32'),_0x3870da[_0xa541('0x22')]),_0x3870da);calls[_0xa541('0x31')](_0x3870da);recordings[_0xa541('0x31')](_0x3870da);dials[_0xa541('0x31')](_0x3870da);agents[_0xa541('0x31')](_0x3870da);queues[_0xa541('0x31')](_0x3870da);}catch(_0x2c5dea){utils[_0xa541('0x14')](util['format'](_0xa541('0x32'),_0x3870da[_0xa541('0x22')]),_0x2c5dea);}});ami['on']('cdr',function(_0xfae8fd){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')]('[%s][index][cdr]',_0xfae8fd[_0xa541('0x22')]),_0xfae8fd);members[_0xa541('0x33')](_0xfae8fd);}catch(_0x469b7b){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x34'),_0xfae8fd[_0xa541('0x22')]),_0x469b7b);}});ami['on']('blindtransfer',function(_0x505e75){try{utils['debug'](util[_0xa541('0x1b')](_0xa541('0x35'),_0x505e75[_0xa541('0x22')]),_0x505e75);queues[_0xa541('0x36')](_0x505e75);agents[_0xa541('0x36')](_0x505e75);transfers['blindtransfer'](_0x505e75);}catch(_0x2d51a1){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x35'),_0x505e75['uniqueid']),_0x2d51a1);}});ami['on'](_0xa541('0x37'),function(_0xb31f58){try{utils[_0xa541('0x18')](util[_0xa541('0x1b')]('[%s][index][attendedtransfer]',_0xb31f58[_0xa541('0x38')]),_0xb31f58);queues[_0xa541('0x37')](_0xb31f58);transfers[_0xa541('0x37')](_0xb31f58);agents[_0xa541('0x37')](_0xb31f58);calls[_0xa541('0x37')](_0xb31f58);}catch(_0x359aed){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x39'),_0xb31f58[_0xa541('0x38')]),_0x359aed);}});ami['on'](_0xa541('0x3a'),function(_0x47f911){try{utils['debug'](util[_0xa541('0x1b')](_0xa541('0x3b'),_0x47f911[_0xa541('0x22')]),_0x47f911);queues[_0xa541('0x3a')](_0x47f911);recordings[_0xa541('0x3a')](_0x47f911);calls['varset'](_0x47f911);dials[_0xa541('0x3a')](_0x47f911);}catch(_0x28b9f){utils['error'](util[_0xa541('0x1b')]('[%s][index][varset]',_0x47f911[_0xa541('0x22')]),_0x28b9f);}});ami['on']('newexten',function(_0x54a370){try{utils['debug'](util[_0xa541('0x1b')](_0xa541('0x3c'),_0x54a370['uniqueid']),_0x54a370);calls['newexten'](_0x54a370);recordings[_0xa541('0x3d')](_0x54a370);dials['newexten'](_0x54a370);}catch(_0x9ad486){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x3c'),_0x54a370[_0xa541('0x22')]),_0x9ad486);}});ami['on'](_0xa541('0x3e'),function(_0x3f59d2){try{utils['debug'](util[_0xa541('0x1b')](_0xa541('0x3f'),_0x3f59d2[_0xa541('0x22')]),_0x3f59d2);calls[_0xa541('0x3e')](_0x3f59d2);recordings[_0xa541('0x3e')](_0x3f59d2);}catch(_0x338565){utils['error'](util[_0xa541('0x1b')](_0xa541('0x3f'),_0x3f59d2[_0xa541('0x22')]),_0x338565);}});ami['on']('dialbegin',function(_0x2a2a16){try{utils['debug'](util[_0xa541('0x1b')](_0xa541('0x40'),_0x2a2a16[_0xa541('0x22')]),_0x2a2a16);dials[_0xa541('0x41')](_0x2a2a16);}catch(_0x52a3c1){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x42'),_0x2a2a16[_0xa541('0x22')]),_0x52a3c1);}});ami['on'](_0xa541('0x43'),function(_0x4a9a68){try{utils['debug'](util[_0xa541('0x1b')](_0xa541('0x44'),_0x4a9a68[_0xa541('0x22')]),_0x4a9a68);dials[_0xa541('0x43')](_0x4a9a68);}catch(_0x3cebb6){utils[_0xa541('0x14')](util[_0xa541('0x1b')](_0xa541('0x44'),_0x4a9a68[_0xa541('0x22')]),_0x3cebb6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 61a08d0..711a3fd 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 _0x15b7=['state','voice','now','agent','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr','[%s][members][cdr]','channel','split','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','data3','destinationchannel','./utils','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','then','format','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x15b7,0x13a));var _0x715b=function(_0x4a5c9b,_0x38de78){_0x4a5c9b=_0x4a5c9b-0x0;var _0x285a08=_0x15b7[_0x4a5c9b];return _0x285a08;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x715b('0x0'));var members={};var exclude=['Local/_attended@transfer',_0x715b('0x1')];function writeDB(_0x40b6e7){utils[_0x715b('0x2')](util['format'](_0x715b('0x3'),_0x40b6e7[_0x715b('0x4')],_0x40b6e7[_0x715b('0x5')],_0x40b6e7['channel'],_0x40b6e7['data2'],_0x40b6e7[_0x715b('0x6')],_0x40b6e7[_0x715b('0x7')]));if(_0x40b6e7[_0x715b('0x5')]){utils[_0x715b('0x8')](_0x40b6e7['interface'])['then'](function(_0x2546c0){if(_0x2546c0){_0x40b6e7['membername']=_0x2546c0[_0x715b('0x9')];_0x40b6e7[_0x715b('0xa')]=_0x2546c0['internal'];utils[_0x715b('0xb')](_0x715b('0xc'),_0x40b6e7);}else{utils[_0x715b('0xd')](_0x40b6e7[_0x715b('0x5')]['split']('/')[0x1])[_0x715b('0xe')](function(_0x177b5c){if(_0x177b5c){_0x40b6e7['membername']=_0x177b5c[_0x715b('0x9')];_0x40b6e7[_0x715b('0xa')]=_0x177b5c[_0x715b('0xa')];utils[_0x715b('0xb')](_0x715b('0xc'),_0x40b6e7);}});}})['catch'](function(_0x205bbe){utils['error'](util[_0x715b('0xf')](_0x715b('0x10'),_0x40b6e7['uniqueid']),_0x205bbe);});}delete members[_0x40b6e7[_0x715b('0x5')]];}function startsWith(_0x5004a6,_0x48e194){return _[_0x715b('0x11')](_0x5004a6,function(_0x31b79e){return _[_0x715b('0x12')](_0x48e194,_0x31b79e);});}exports['devicestatechange']=function(_0x13cc0b){try{utils[_0x715b('0x13')](util[_0x715b('0xf')](_0x715b('0x14'),members[_0x13cc0b[_0x715b('0x15')]]?members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x4')]:_0x13cc0b[_0x715b('0x15')]),_0x13cc0b);utils[_0x715b('0x2')](util[_0x715b('0xf')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x13cc0b['device']]?members[_0x13cc0b['device']]['uniqueid']:_0x13cc0b[_0x715b('0x15')],_0x13cc0b['state'],_0x13cc0b[_0x715b('0x15')]));switch(_0x13cc0b[_0x715b('0x16')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x13cc0b[_0x715b('0x15')])){members[_0x13cc0b[_0x715b('0x15')]]={'channel':_0x715b('0x17'),'interface':_0x13cc0b[_0x715b('0x15')],'type':'TALKING','enterAt':utils[_0x715b('0x18')](),'role':_0x715b('0x19')};}break;case'NOT_INUSE':if(!_[_0x715b('0x1a')](members[_0x13cc0b[_0x715b('0x15')]])){members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x1b')]=utils['now']();members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x1c')]=utils[_0x715b('0x1d')](members[_0x13cc0b['device']]['exitAt'],members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x1e')]);if(members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x4')]){writeDB(members[_0x13cc0b[_0x715b('0x15')]]);}}break;default:break;}}catch(_0x90eb0c){utils['error'](util[_0x715b('0xf')](_0x715b('0x14'),members[_0x13cc0b[_0x715b('0x15')]]?members[_0x13cc0b['device']][_0x715b('0x4')]:_0x13cc0b['device']),_0x90eb0c);}};exports[_0x715b('0x1f')]=function(_0x4b1ff7){try{if(!_[_0x715b('0x1a')](members[_0x4b1ff7[_0x715b('0x5')]])){utils[_0x715b('0x13')](util['format'](_0x715b('0x20'),_0x4b1ff7[_0x715b('0x4')]),_0x4b1ff7);utils[_0x715b('0x2')](util['format'](_0x715b('0x21'),_0x4b1ff7[_0x715b('0x4')],_0x4b1ff7[_0x715b('0x5')],_0x4b1ff7[_0x715b('0x22')]));members[_0x4b1ff7[_0x715b('0x5')]]=_[_0x715b('0x23')](members[_0x4b1ff7[_0x715b('0x5')]],{'data4':_0x4b1ff7[_0x715b('0x22')],'uniqueid':_0x4b1ff7[_0x715b('0x4')]});}}catch(_0x73de24){utils[_0x715b('0x24')](util[_0x715b('0xf')](_0x715b('0x20'),_0x4b1ff7['uniqueid']),_0x73de24);}};exports[_0x715b('0x25')]=function(_0x379e2e){try{utils[_0x715b('0x13')](util['format'](_0x715b('0x26'),_0x379e2e[_0x715b('0x4')]),_0x379e2e);if(_0x379e2e[_0x715b('0x27')]){var _0x42cf95=_0x379e2e[_0x715b('0x27')][_0x715b('0x28')]('-')[0x0];if(!_['isNil'](members[_0x42cf95])){members[_0x42cf95]=_[_0x715b('0x23')](members[_0x42cf95],{'data1':members[_0x42cf95][_0x715b('0x29')]||_0x379e2e[_0x715b('0x7')],'data2':members[_0x42cf95]['data2']||_0x379e2e[_0x715b('0x2a')],'data3':members[_0x42cf95]['data3']||_0x379e2e[_0x715b('0x2b')],'uniqueid':members[_0x42cf95][_0x715b('0x4')]||_0x379e2e[_0x715b('0x4')]});utils[_0x715b('0x2')](util[_0x715b('0xf')](_0x715b('0x2c'),_0x379e2e[_0x715b('0x4')],members[_0x42cf95][_0x715b('0x29')],members[_0x42cf95][_0x715b('0x2d')],members[_0x42cf95][_0x715b('0x2e')]));if(members[_0x42cf95][_0x715b('0x1b')]){writeDB(members[_0x42cf95]);}}}if(_0x379e2e[_0x715b('0x2f')]){var _0x2f31bd=_0x379e2e[_0x715b('0x2f')]['split']('-')[0x0];if(!_['isNil'](members[_0x2f31bd])){members[_0x2f31bd]=_[_0x715b('0x23')](members[_0x2f31bd],{'data1':members[_0x2f31bd][_0x715b('0x29')]||_0x379e2e['type'],'data2':members[_0x2f31bd]['data2']||_0x379e2e[_0x715b('0x2a')],'data3':members[_0x2f31bd][_0x715b('0x2e')]||_0x379e2e[_0x715b('0x2b')],'uniqueid':members[_0x2f31bd][_0x715b('0x4')]||_0x379e2e[_0x715b('0x4')]});utils[_0x715b('0x2')](util[_0x715b('0xf')](_0x715b('0x2c'),_0x379e2e['uniqueid'],members[_0x2f31bd][_0x715b('0x29')],members[_0x2f31bd][_0x715b('0x2d')],members[_0x2f31bd][_0x715b('0x2e')]));if(members[_0x2f31bd]['exitAt']){writeDB(members[_0x2f31bd]);}}}}catch(_0x11e6f9){utils[_0x715b('0x24')](util['format'](_0x715b('0x26'),_0x379e2e[_0x715b('0x4')]),_0x11e6f9);}}; \ No newline at end of file +var _0xd49c=['assign','queue','[%s][members][agentcomplete]','cdr','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','exitAt','destinationchannel','[%s][members][cdr]','util','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','uniqueid','some','debug','format','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','now','agent','isNil','diffTime','enterAt','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s'];(function(_0x594b3c,_0x6ffb3e){var _0x13e840=function(_0x2346c3){while(--_0x2346c3){_0x594b3c['push'](_0x594b3c['shift']());}};_0x13e840(++_0x6ffb3e);}(_0xd49c,0x1d8));var _0xcd49=function(_0x3a6c22,_0x25539e){_0x3a6c22=_0x3a6c22-0x0;var _0x61930a=_0xd49c[_0x3a6c22];return _0x61930a;};'use strict';var _=require('lodash');var util=require(_0xcd49('0x0'));var utils=require('./utils');var members={};var exclude=[_0xcd49('0x1'),_0xcd49('0x2')];function writeDB(_0x5bda72){utils[_0xcd49('0x3')](util['format'](_0xcd49('0x4'),_0x5bda72['uniqueid'],_0x5bda72[_0xcd49('0x5')],_0x5bda72[_0xcd49('0x6')],_0x5bda72[_0xcd49('0x7')],_0x5bda72[_0xcd49('0x8')],_0x5bda72[_0xcd49('0x9')]));if(_0x5bda72[_0xcd49('0x5')]){utils[_0xcd49('0xa')](_0x5bda72[_0xcd49('0x5')])[_0xcd49('0xb')](function(_0x80ad60){if(_0x80ad60){_0x5bda72[_0xcd49('0x8')]=_0x80ad60['name'];_0x5bda72[_0xcd49('0xc')]=_0x80ad60[_0xcd49('0xc')];utils[_0xcd49('0xd')](_0xcd49('0xe'),_0x5bda72);}else{utils[_0xcd49('0xf')](_0x5bda72[_0xcd49('0x5')][_0xcd49('0x10')]('/')[0x1])[_0xcd49('0xb')](function(_0x2b4e33){if(_0x2b4e33){_0x5bda72[_0xcd49('0x8')]=_0x2b4e33['name'];_0x5bda72['internal']=_0x2b4e33[_0xcd49('0xc')];utils[_0xcd49('0xd')](_0xcd49('0xe'),_0x5bda72);}});}})['catch'](function(_0x2963e9){utils[_0xcd49('0x11')](util['format'](_0xcd49('0x12'),_0x5bda72[_0xcd49('0x13')]),_0x2963e9);});}delete members[_0x5bda72[_0xcd49('0x5')]];}function startsWith(_0x3f23e9,_0x1e2275){return _[_0xcd49('0x14')](_0x3f23e9,function(_0x5a0c6e){return _['startsWith'](_0x1e2275,_0x5a0c6e);});}exports['devicestatechange']=function(_0x4dabea){try{utils[_0xcd49('0x15')](util[_0xcd49('0x16')](_0xcd49('0x17'),members[_0x4dabea['device']]?members[_0x4dabea[_0xcd49('0x18')]][_0xcd49('0x13')]:_0x4dabea[_0xcd49('0x18')]),_0x4dabea);utils['info'](util[_0xcd49('0x16')](_0xcd49('0x19'),members[_0x4dabea[_0xcd49('0x18')]]?members[_0x4dabea[_0xcd49('0x18')]][_0xcd49('0x13')]:_0x4dabea[_0xcd49('0x18')],_0x4dabea[_0xcd49('0x1a')],_0x4dabea[_0xcd49('0x18')]));switch(_0x4dabea[_0xcd49('0x1a')]){case'INUSE':case _0xcd49('0x1b'):if(!startsWith(exclude,_0x4dabea[_0xcd49('0x18')])){members[_0x4dabea[_0xcd49('0x18')]]={'channel':'voice','interface':_0x4dabea['device'],'type':'TALKING','enterAt':utils[_0xcd49('0x1c')](),'role':_0xcd49('0x1d')};}break;case'NOT_INUSE':if(!_[_0xcd49('0x1e')](members[_0x4dabea[_0xcd49('0x18')]])){members[_0x4dabea[_0xcd49('0x18')]]['exitAt']=utils[_0xcd49('0x1c')]();members[_0x4dabea[_0xcd49('0x18')]]['duration']=utils[_0xcd49('0x1f')](members[_0x4dabea[_0xcd49('0x18')]]['exitAt'],members[_0x4dabea[_0xcd49('0x18')]][_0xcd49('0x20')]);if(members[_0x4dabea[_0xcd49('0x18')]][_0xcd49('0x13')]){writeDB(members[_0x4dabea[_0xcd49('0x18')]]);}}break;default:break;}}catch(_0x15b8b0){utils[_0xcd49('0x11')](util[_0xcd49('0x16')](_0xcd49('0x17'),members[_0x4dabea[_0xcd49('0x18')]]?members[_0x4dabea[_0xcd49('0x18')]]['uniqueid']:_0x4dabea[_0xcd49('0x18')]),_0x15b8b0);}};exports['agentcomplete']=function(_0x43a448){try{if(!_[_0xcd49('0x1e')](members[_0x43a448['interface']])){utils[_0xcd49('0x15')](util[_0xcd49('0x16')]('[%s][members][agentcomplete]',_0x43a448[_0xcd49('0x13')]),_0x43a448);utils[_0xcd49('0x3')](util[_0xcd49('0x16')](_0xcd49('0x21'),_0x43a448[_0xcd49('0x13')],_0x43a448[_0xcd49('0x5')],_0x43a448['queue']));members[_0x43a448['interface']]=_[_0xcd49('0x22')](members[_0x43a448[_0xcd49('0x5')]],{'data4':_0x43a448[_0xcd49('0x23')],'uniqueid':_0x43a448[_0xcd49('0x13')]});}}catch(_0x39ac6f){utils[_0xcd49('0x11')](util[_0xcd49('0x16')](_0xcd49('0x24'),_0x43a448[_0xcd49('0x13')]),_0x39ac6f);}};exports[_0xcd49('0x25')]=function(_0x2fcbba){try{utils[_0xcd49('0x15')](util[_0xcd49('0x16')]('[%s][members][cdr]',_0x2fcbba[_0xcd49('0x13')]),_0x2fcbba);if(_0x2fcbba[_0xcd49('0x6')]){var _0x58a1b9=_0x2fcbba['channel'][_0xcd49('0x10')]('-')[0x0];if(!_[_0xcd49('0x1e')](members[_0x58a1b9])){members[_0x58a1b9]=_['assign'](members[_0x58a1b9],{'data1':members[_0x58a1b9][_0xcd49('0x26')]||_0x2fcbba[_0xcd49('0x9')],'data2':members[_0x58a1b9][_0xcd49('0x7')]||_0x2fcbba[_0xcd49('0x27')],'data3':members[_0x58a1b9][_0xcd49('0x28')]||_0x2fcbba[_0xcd49('0x29')],'uniqueid':members[_0x58a1b9][_0xcd49('0x13')]||_0x2fcbba['uniqueid']});utils[_0xcd49('0x3')](util[_0xcd49('0x16')](_0xcd49('0x2a'),_0x2fcbba[_0xcd49('0x13')],members[_0x58a1b9][_0xcd49('0x26')],members[_0x58a1b9][_0xcd49('0x7')],members[_0x58a1b9]['data3']));if(members[_0x58a1b9][_0xcd49('0x2b')]){writeDB(members[_0x58a1b9]);}}}if(_0x2fcbba[_0xcd49('0x2c')]){var _0x2aead0=_0x2fcbba['destinationchannel'][_0xcd49('0x10')]('-')[0x0];if(!_[_0xcd49('0x1e')](members[_0x2aead0])){members[_0x2aead0]=_[_0xcd49('0x22')](members[_0x2aead0],{'data1':members[_0x2aead0][_0xcd49('0x26')]||_0x2fcbba[_0xcd49('0x9')],'data2':members[_0x2aead0][_0xcd49('0x7')]||_0x2fcbba[_0xcd49('0x27')],'data3':members[_0x2aead0][_0xcd49('0x28')]||_0x2fcbba[_0xcd49('0x29')],'uniqueid':members[_0x2aead0][_0xcd49('0x13')]||_0x2fcbba['uniqueid']});utils['info'](util[_0xcd49('0x16')](_0xcd49('0x2a'),_0x2fcbba[_0xcd49('0x13')],members[_0x2aead0][_0xcd49('0x26')],members[_0x2aead0][_0xcd49('0x7')],members[_0x2aead0]['data3']));if(members[_0x2aead0][_0xcd49('0x2b')]){writeDB(members[_0x2aead0]);}}}}catch(_0xda9112){utils['error'](util[_0xcd49('0x16')](_0xcd49('0x2d'),_0x2fcbba[_0xcd49('0x13')]),_0xda9112);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index da55263..2ef905d 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 _0xca89=['queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','queuecallerjoinAt','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','accountcode'];(function(_0x1dd156,_0x25d0c9){var _0xac911f=function(_0x1e2b8e){while(--_0x1e2b8e){_0x1dd156['push'](_0x1dd156['shift']());}};_0xac911f(++_0x25d0c9);}(_0xca89,0x193));var _0x9ca8=function(_0x8a7179,_0x511713){_0x8a7179=_0x8a7179-0x0;var _0x2a81ce=_0xca89[_0x8a7179];return _0x2a81ce;};'use strict';var _=require('lodash');var util=require(_0x9ca8('0x0'));var utils=require(_0x9ca8('0x1'));var queues={};function writeDB(_0x2facaa){utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2facaa[_0x9ca8('0x4')],_0x2facaa[_0x9ca8('0x5')],_0x2facaa[_0x9ca8('0x6')],_0x2facaa[_0x9ca8('0x7')],_0x2facaa['calleridnum'],_0x2facaa[_0x9ca8('0x8')],_0x2facaa[_0x9ca8('0x9')]));if(_0x2facaa['queue']){utils[_0x9ca8('0xa')](_0x2facaa[_0x9ca8('0x6')])['then'](function(_0x3f140c){if(_0x3f140c){_0x2facaa[_0x9ca8('0xb')]=_0x3f140c[_0x9ca8('0xb')];}utils[_0x9ca8('0xc')](_0x9ca8('0xd'),_0x2facaa);});}else{utils[_0x9ca8('0xc')]('CreateVoiceQueueReport',_0x2facaa);}if(_0x2facaa[_0x9ca8('0xe')]){delete queues[_0x2facaa[_0x9ca8('0xe')]];}else{delete queues[_0x2facaa['uniqueid']];}}exports[_0x9ca8('0xf')]=function(_0x1b1e2d){try{utils[_0x9ca8('0x10')](util['format'](_0x9ca8('0x11'),_0x1b1e2d[_0x9ca8('0x4')]),_0x1b1e2d);utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x12'),_0x1b1e2d[_0x9ca8('0x4')],_0x1b1e2d[_0x9ca8('0x6')],_0x1b1e2d[_0x9ca8('0x13')]));queues[_0x1b1e2d[_0x9ca8('0x4')]]=_[_0x9ca8('0x14')](_0x1b1e2d,{'originalposition':_0x1b1e2d[_0x9ca8('0x13')],'queuecallerjoinAt':utils[_0x9ca8('0x15')](),'mohtime':0x0});}catch(_0x379e54){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')](_0x9ca8('0x11'),_0x1b1e2d[_0x9ca8('0x4')]),_0x379e54);}};exports['hangup']=function(_0x23f085){try{if(!_['isNil'](queues[_0x23f085[_0x9ca8('0x4')]])){utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x17'),_0x23f085[_0x9ca8('0x4')]),_0x23f085);if(queues[_0x23f085[_0x9ca8('0x4')]]['queuecallerleaveAt']){if(!queues[_0x23f085['uniqueid']][_0x9ca8('0x18')]&&!queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x19')]){queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x1a')]=!![];queues[_0x23f085['uniqueid']]['queuecallercompleteAt']=utils[_0x9ca8('0x15')]();queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x9')]=_0x9ca8('0x1b');}utils['info'](util[_0x9ca8('0x3')](_0x9ca8('0x1c'),_0x23f085[_0x9ca8('0x4')],queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x9')]));writeDB(queues[_0x23f085[_0x9ca8('0x4')]]);}else if(queues[_0x23f085['uniqueid']][_0x9ca8('0xe')]){utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x23f085['uniqueid'],queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x23f085['uniqueid']][_0x9ca8('0xe')]));queues[queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0xe')]]=queues[_0x23f085[_0x9ca8('0x4')]];queues[queues[_0x23f085['uniqueid']]['transfereduniqueid']][_0x9ca8('0x1e')]=0x2;delete queues[_0x23f085[_0x9ca8('0x4')]];}}}catch(_0x2a71d8){utils['error'](util[_0x9ca8('0x3')](_0x9ca8('0x17'),_0x23f085['uniqueid']),_0x2a71d8);}};exports[_0x9ca8('0x1f')]=function(_0xf5c8d6){try{utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x20'),_0xf5c8d6['uniqueid']),_0xf5c8d6);if(!_[_0x9ca8('0x21')](_0xf5c8d6[_0x9ca8('0x22')][_0x9ca8('0x23')])&&_0xf5c8d6[_0x9ca8('0x24')][_0x9ca8('0x25')]()!==_0x9ca8('0x26')){if(!_[_0x9ca8('0x21')](queues[_0xf5c8d6[_0x9ca8('0x4')]])){queues[_0xf5c8d6[_0x9ca8('0x4')]]['queuecallerabandon']=![];queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x27')]=null;queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x19')]=!![];queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x28')]=utils['now']();queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x9')]=_0xf5c8d6[_0x9ca8('0x24')]['toUpperCase']();utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x29'),_0xf5c8d6[_0x9ca8('0x4')],queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x1d')],_0xf5c8d6['value'],queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x9')]));writeDB(queues[_0xf5c8d6[_0x9ca8('0x4')]]);}}else if(!_[_0x9ca8('0x21')](_0xf5c8d6[_0x9ca8('0x22')][_0x9ca8('0x2a')])){if(!_[_0x9ca8('0x21')](queues[_0xf5c8d6[_0x9ca8('0x4')]])&&!queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x18')]){queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x18')]=![];queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x27')]=null;queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x19')]=!![];queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x28')]=utils[_0x9ca8('0x15')]();queues[_0xf5c8d6[_0x9ca8('0x4')]]['queuecallerexitreason']=_0x9ca8('0x2b');utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x2c'),_0xf5c8d6[_0x9ca8('0x4')],queues[_0xf5c8d6[_0x9ca8('0x4')]]['name'],_0xf5c8d6[_0x9ca8('0x24')],queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x9')]));}}}catch(_0x3e3f24){utils['error'](util['format'](_0x9ca8('0x20'),_0xf5c8d6[_0x9ca8('0x4')]),_0x3e3f24);}};exports[_0x9ca8('0x18')]=function(_0x1d46d3){try{if(!_[_0x9ca8('0x21')](queues[_0x1d46d3[_0x9ca8('0x4')]])){utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x2d'),_0x1d46d3[_0x9ca8('0x4')]),_0x1d46d3);queues[_0x1d46d3[_0x9ca8('0x4')]][_0x9ca8('0x19')]=![];queues[_0x1d46d3[_0x9ca8('0x4')]]['queuecallerexitAt']=null;queues[_0x1d46d3['uniqueid']][_0x9ca8('0x18')]=!![];queues[_0x1d46d3['uniqueid']][_0x9ca8('0x27')]=utils[_0x9ca8('0x15')]();queues[_0x1d46d3['uniqueid']][_0x9ca8('0x9')]=_0x9ca8('0x2e');utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x2f'),_0x1d46d3['uniqueid'],queues[_0x1d46d3[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x1d46d3['uniqueid']][_0x9ca8('0x9')]));}}catch(_0x1fe773){utils['error'](util[_0x9ca8('0x3')](_0x9ca8('0x2d'),_0x1d46d3[_0x9ca8('0x4')]),_0x1fe773);}};exports[_0x9ca8('0x30')]=function(_0x260752){try{if(!_[_0x9ca8('0x21')](queues[_0x260752['uniqueid']])){utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x31'),_0x260752[_0x9ca8('0x4')]),_0x260752);utils['info'](util[_0x9ca8('0x3')](_0x9ca8('0x32'),_0x260752[_0x9ca8('0x4')],queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x1d')],_0x260752[_0x9ca8('0x33')],_0x260752[_0x9ca8('0x34')]));queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x30')]=!![];queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x35')]=utils['now']();queues[_0x260752[_0x9ca8('0x4')]]['holdtime']=utils['diffTime'](queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x35')],queues[_0x260752['uniqueid']][_0x9ca8('0x36')]);queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x13')]=_0x260752['position'];queues[_0x260752['uniqueid']]['count']=_0x260752['count'];queues[_0x260752['uniqueid']][_0x9ca8('0x33')]=_0x260752[_0x9ca8('0x33')];queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x34')]=_0x260752[_0x9ca8('0x34')];}}catch(_0x31b347){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')](_0x9ca8('0x31'),_0x260752['uniqueid']),_0x31b347);}};exports[_0x9ca8('0x37')]=function(_0x129794){try{if(!_[_0x9ca8('0x21')](queues[_0x129794['uniqueid']])){utils[_0x9ca8('0x10')](util['format']('[%s][queues][agentconnect]',_0x129794[_0x9ca8('0x4')]),_0x129794);utils[_0x9ca8('0x2')](util['format'](_0x9ca8('0x38'),_0x129794[_0x9ca8('0x4')],queues[_0x129794['uniqueid']][_0x9ca8('0x1d')],_0x129794[_0x9ca8('0x39')],_0x129794[_0x9ca8('0x3a')]));queues[_0x129794[_0x9ca8('0x4')]]['queuecallerabandon']=![];queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x18')]=![];queues[_0x129794['uniqueid']][_0x9ca8('0x27')]=null;queues[_0x129794[_0x9ca8('0x4')]]['queuecallerexit']=![];queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x9')]=null;queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x28')]=null;queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x3b')]=!![];queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x8')]=_0x129794[_0x9ca8('0x3a')];queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x7')]=_0x129794['membername'];}}catch(_0x282294){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')](_0x9ca8('0x3c'),_0x129794[_0x9ca8('0x4')]),_0x282294);}};exports['agentcomplete']=function(_0x4682ae){try{if(!_[_0x9ca8('0x21')](queues[_0x4682ae[_0x9ca8('0x4')]])){if(queues[_0x4682ae[_0x9ca8('0x4')]]['queuecallerleaveAt']){utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x3d'),_0x4682ae[_0x9ca8('0x4')]),_0x4682ae);queues[_0x4682ae['uniqueid']][_0x9ca8('0x18')]=![];queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x18')]=![];queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x27')]=null;queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x19')]=![];queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x28')]=null;queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x3b')]=!![];queues[_0x4682ae['uniqueid']][_0x9ca8('0x7')]=_0x4682ae['membername'];queues[_0x4682ae[_0x9ca8('0x4')]]['queuecallercomplete']=!![];queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x3e')]=utils[_0x9ca8('0x15')]();if(_0x4682ae[_0x9ca8('0x3f')]==_0x9ca8('0x40')){if(!queues[_0x4682ae[_0x9ca8('0x4')]]['transfer']){queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x9')]=_0x9ca8('0x41');}}else{queues[_0x4682ae['uniqueid']]['queuecallerexitreason']=_0x9ca8('0x42')+_0x4682ae[_0x9ca8('0x3f')][_0x9ca8('0x25')]();}utils[_0x9ca8('0x2')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x4682ae['uniqueid'],queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x1d')],_0x4682ae[_0x9ca8('0x39')],queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x9')]));writeDB(queues[_0x4682ae[_0x9ca8('0x4')]]);}}}catch(_0x46e7fc){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')]('[%s][queues][agentcomplete]',_0x4682ae['uniqueid']),_0x46e7fc);}};exports[_0x9ca8('0x43')]=function(_0x66fa17){try{if(!_[_0x9ca8('0x21')](queues[_0x66fa17[_0x9ca8('0x44')]])){utils['debug'](util[_0x9ca8('0x3')]('[%s][queues][blindtransfer]',_0x66fa17[_0x9ca8('0x4')]),_0x66fa17);queues[_0x66fa17[_0x9ca8('0x44')]]['transfer']=!![];queues[_0x66fa17[_0x9ca8('0x44')]][_0x9ca8('0x45')]=_0x9ca8('0x46');queues[_0x66fa17[_0x9ca8('0x44')]][_0x9ca8('0x47')]=_0x66fa17['extension'];queues[_0x66fa17[_0x9ca8('0x44')]][_0x9ca8('0x48')]=_0x66fa17['transfereeuniqueid'];queues[_0x66fa17['transfereeuniqueid']]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x9ca8('0x2')](util['format'](_0x9ca8('0x49'),_0x66fa17[_0x9ca8('0x4')],queues[_0x66fa17[_0x9ca8('0x44')]][_0x9ca8('0x1d')],_0x66fa17[_0x9ca8('0x44')],_0x66fa17['extension']));}}catch(_0x48a1c3){utils['error'](util['format'](_0x9ca8('0x4a'),_0x66fa17['uniqueid']),_0x48a1c3);}};exports[_0x9ca8('0x4b')]=function(_0x559313){try{utils[_0x9ca8('0x10')](util['format'](_0x9ca8('0x4c'),_0x559313[_0x9ca8('0x4d')]),_0x559313);if(_0x559313['origtransfereruniqueid']==_0x559313[_0x9ca8('0x4e')]){if(!_['isNil'](queues[_0x559313['secondtransfererlinkedid']])){utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x559313[_0x9ca8('0x4d')],queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x1d')],_0x559313[_0x9ca8('0x50')]));queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x40')]=!![];queues[_0x559313[_0x9ca8('0x4f')]]['transfertype']=_0x9ca8('0x51');queues[_0x559313['secondtransfererlinkedid']][_0x9ca8('0x47')]=_0x559313['origtransfererexten'];queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x48')]=_0x559313['origtransfereruniqueid'];queues[_0x559313['secondtransfererlinkedid']][_0x9ca8('0x9')]=_0x9ca8('0x52');}if(!_[_0x9ca8('0x21')](queues[_0x559313[_0x9ca8('0x4e')]])){if(_0x559313['transfereelinkedid']&&queues[_0x559313[_0x9ca8('0x53')]]){queues[_0x559313['transfereelinkedid']][_0x9ca8('0x1e')]=0x1;queues[_0x559313[_0x9ca8('0x44')]]=_['clone'](queues[_0x559313[_0x9ca8('0x53')]]);queues[_0x559313['transfereeuniqueid']][_0x9ca8('0xe')]=_0x559313[_0x9ca8('0x54')];queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x1e')]=0x2;queues[_0x559313[_0x9ca8('0x44')]]['calleridnum']=queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x55')];queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x56')]=queues[_0x559313[_0x9ca8('0x4f')]]['calleridname'];queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x36')]=utils[_0x9ca8('0x15')]();queues[_0x559313['transfereeuniqueid']][_0x9ca8('0x35')]=utils['now']();queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x57')]=0x0;queues[_0x559313[_0x9ca8('0x44')]]['mohtime']=0x0;utils[_0x9ca8('0x2')](util['format'](_0x9ca8('0x58'),_0x559313[_0x9ca8('0x4d')],queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x1d')],queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x55')],queues[_0x559313[_0x9ca8('0x44')]]['calleridname']));}else{utils['info'](util[_0x9ca8('0x3')](_0x9ca8('0x59'),_0x559313['origtransfereruniqueid'],queues[_0x559313['origtransfererlinkedid']][_0x9ca8('0x1d')],_0x559313[_0x9ca8('0x4f')]));queues[_0x559313['origtransfererlinkedid']]['transfereduniqueid']=_0x559313[_0x9ca8('0x4f')];}}}else if(_0x559313[_0x9ca8('0x5a')]==_0x559313[_0x9ca8('0x4f')]){if(!_[_0x9ca8('0x21')](queues[_0x559313['origtransfererlinkedid']])){utils['info'](util[_0x9ca8('0x3')](_0x9ca8('0x5b'),_0x559313[_0x9ca8('0x4d')],queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x1d')],_0x559313[_0x9ca8('0x5a')],_0x559313[_0x9ca8('0x5c')]));queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x40')]=!![];queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x45')]=_0x9ca8('0x51');queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x47')]=_0x559313['secondtransfererexten'];queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x48')]=_0x559313[_0x9ca8('0x5a')];queues[_0x559313[_0x9ca8('0x4e')]]['queuecallerexitreason']=_0x9ca8('0x52');}if(!_[_0x9ca8('0x21')](queues[_0x559313[_0x9ca8('0x4f')]])){if(_0x559313[_0x9ca8('0x5d')]&&queues[_0x559313[_0x9ca8('0x5d')]]){queues[_0x559313[_0x9ca8('0x5d')]][_0x9ca8('0x1e')]=0x1;queues[_0x559313[_0x9ca8('0x54')]]=_['clone'](queues[_0x559313[_0x9ca8('0x5d')]]);queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0xe')]=_0x559313['transfertargetuniqueid'];queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x1e')]=0x2;queues[_0x559313['transfertargetuniqueid']][_0x9ca8('0x55')]=queues[_0x559313['origtransfererlinkedid']][_0x9ca8('0x55')];queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x56')]=queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x56')];queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x36')]=utils['now']();queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x35')]=utils['now']();queues[_0x559313['transfertargetuniqueid']][_0x9ca8('0x57')]=0x0;queues[_0x559313['transfertargetuniqueid']][_0x9ca8('0x5e')]=0x0;utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x559313[_0x9ca8('0x4d')],queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x1d')],queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0xe')],queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x55')],queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x56')]));}else{utils[_0x9ca8('0x2')](util['format'](_0x9ca8('0x59'),_0x559313['origtransfereruniqueid'],queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x1d')],_0x559313[_0x9ca8('0x4e')]));queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0xe')]=_0x559313[_0x9ca8('0x4e')];}}}}catch(_0x51e945){utils[_0x9ca8('0x16')](util['format'](_0x9ca8('0x4c'),_0x559313[_0x9ca8('0x4d')]),_0x51e945);}};exports[_0x9ca8('0x5f')]=function(_0x2bc4eb){try{if(!_['isNil'](queues[_0x2bc4eb['uniqueid']])){utils[_0x9ca8('0x10')](util['format'](_0x9ca8('0x60'),_0x2bc4eb['uniqueid']),_0x2bc4eb);queues[_0x2bc4eb[_0x9ca8('0x4')]][_0x9ca8('0x61')]=utils[_0x9ca8('0x15')]();utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x62'),_0x2bc4eb[_0x9ca8('0x4')],queues[_0x2bc4eb[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x2bc4eb[_0x9ca8('0x4')]]['musiconholdstartAt']));}}catch(_0x5c1cda){utils[_0x9ca8('0x16')](util['format'](_0x9ca8('0x60'),_0x2bc4eb[_0x9ca8('0x4')]),_0x5c1cda);}};exports[_0x9ca8('0x63')]=function(_0x3dfdfa){try{if(!_['isNil'](queues[_0x3dfdfa[_0x9ca8('0x4')]])){if(!_[_0x9ca8('0x21')](queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x61')])){utils[_0x9ca8('0x10')](util['format'](_0x9ca8('0x64'),_0x3dfdfa[_0x9ca8('0x4')]),_0x3dfdfa);queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x5e')]+=utils[_0x9ca8('0x65')](utils[_0x9ca8('0x15')](),queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x61')]);utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x66'),_0x3dfdfa[_0x9ca8('0x4')],queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x3dfdfa['uniqueid']][_0x9ca8('0x5e')]));delete queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x61')];}}}catch(_0x3122e3){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')]('[%s][queues][musiconholdstop]',_0x3dfdfa[_0x9ca8('0x4')]),_0x3122e3);}}; \ No newline at end of file +var _0xc33e=['[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','queuecallerenterreason','varset','isNil','variable','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','position','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc33e,0x83));var _0xec33=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc33e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xec33('0x0'));var util=require(_0xec33('0x1'));var utils=require(_0xec33('0x2'));var queues={};function writeDB(_0x1c9b2c){utils[_0xec33('0x3')](util['format'](_0xec33('0x4'),_0x1c9b2c[_0xec33('0x5')],_0x1c9b2c['channel'],_0x1c9b2c[_0xec33('0x6')],_0x1c9b2c[_0xec33('0x7')],_0x1c9b2c['calleridnum'],_0x1c9b2c['accountcode'],_0x1c9b2c[_0xec33('0x8')]));if(_0x1c9b2c[_0xec33('0x6')]){utils[_0xec33('0x9')](_0x1c9b2c[_0xec33('0x6')])[_0xec33('0xa')](function(_0x3fc7a6){if(_0x3fc7a6){_0x1c9b2c[_0xec33('0xb')]=_0x3fc7a6['type'];}utils[_0xec33('0xc')](_0xec33('0xd'),_0x1c9b2c);});}else{utils['request'](_0xec33('0xd'),_0x1c9b2c);}if(_0x1c9b2c['transfereduniqueid']){delete queues[_0x1c9b2c['transfereduniqueid']];}else{delete queues[_0x1c9b2c[_0xec33('0x5')]];}}exports[_0xec33('0xe')]=function(_0x2c02f4){try{utils[_0xec33('0xf')](util[_0xec33('0x10')](_0xec33('0x11'),_0x2c02f4[_0xec33('0x5')]),_0x2c02f4);utils[_0xec33('0x3')](util[_0xec33('0x10')](_0xec33('0x12'),_0x2c02f4[_0xec33('0x5')],_0x2c02f4[_0xec33('0x6')],_0x2c02f4['position']));queues[_0x2c02f4[_0xec33('0x5')]]=_[_0xec33('0x13')](_0x2c02f4,{'originalposition':_0x2c02f4['position'],'queuecallerjoinAt':utils[_0xec33('0x14')](),'mohtime':0x0});}catch(_0x1a8e82){utils['error'](util['format'](_0xec33('0x11'),_0x2c02f4[_0xec33('0x5')]),_0x1a8e82);}};exports['hangup']=function(_0x3f61cc){try{if(!_['isNil'](queues[_0x3f61cc[_0xec33('0x5')]])){utils[_0xec33('0xf')](util[_0xec33('0x10')](_0xec33('0x15'),_0x3f61cc[_0xec33('0x5')]),_0x3f61cc);if(queues[_0x3f61cc[_0xec33('0x5')]][_0xec33('0x16')]){if(!queues[_0x3f61cc[_0xec33('0x5')]]['queuecallerabandon']&&!queues[_0x3f61cc[_0xec33('0x5')]]['queuecallerexit']){queues[_0x3f61cc[_0xec33('0x5')]][_0xec33('0x17')]=!![];queues[_0x3f61cc['uniqueid']][_0xec33('0x18')]=utils[_0xec33('0x14')]();queues[_0x3f61cc[_0xec33('0x5')]][_0xec33('0x8')]=_0xec33('0x19');}utils[_0xec33('0x3')](util[_0xec33('0x10')](_0xec33('0x1a'),_0x3f61cc[_0xec33('0x5')],queues[_0x3f61cc['uniqueid']][_0xec33('0x1b')],queues[_0x3f61cc[_0xec33('0x5')]][_0xec33('0x8')]));writeDB(queues[_0x3f61cc[_0xec33('0x5')]]);}else if(queues[_0x3f61cc[_0xec33('0x5')]][_0xec33('0x1c')]){utils[_0xec33('0x3')](util[_0xec33('0x10')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3f61cc['uniqueid'],queues[_0x3f61cc[_0xec33('0x5')]][_0xec33('0x1b')],queues[_0x3f61cc[_0xec33('0x5')]][_0xec33('0x1c')]));queues[queues[_0x3f61cc['uniqueid']][_0xec33('0x1c')]]=queues[_0x3f61cc[_0xec33('0x5')]];queues[queues[_0x3f61cc[_0xec33('0x5')]][_0xec33('0x1c')]][_0xec33('0x1d')]=0x2;delete queues[_0x3f61cc[_0xec33('0x5')]];}}}catch(_0x4aeb17){utils['error'](util[_0xec33('0x10')]('[%s][queues][hangup]',_0x3f61cc[_0xec33('0x5')]),_0x4aeb17);}};exports[_0xec33('0x1e')]=function(_0x4dcbfa){try{utils[_0xec33('0xf')](util[_0xec33('0x10')]('[%s][queues][varset]',_0x4dcbfa[_0xec33('0x5')]),_0x4dcbfa);if(!_[_0xec33('0x1f')](_0x4dcbfa[_0xec33('0x20')]['queuestatus'])&&_0x4dcbfa[_0xec33('0x21')][_0xec33('0x22')]()!=='CONTINUE'){if(!_[_0xec33('0x1f')](queues[_0x4dcbfa[_0xec33('0x5')]])){queues[_0x4dcbfa['uniqueid']]['queuecallerabandon']=![];queues[_0x4dcbfa[_0xec33('0x5')]][_0xec33('0x23')]=null;queues[_0x4dcbfa[_0xec33('0x5')]][_0xec33('0x24')]=!![];queues[_0x4dcbfa['uniqueid']][_0xec33('0x25')]=utils[_0xec33('0x14')]();queues[_0x4dcbfa['uniqueid']][_0xec33('0x8')]=_0x4dcbfa[_0xec33('0x21')][_0xec33('0x22')]();utils[_0xec33('0x3')](util['format'](_0xec33('0x26'),_0x4dcbfa[_0xec33('0x5')],queues[_0x4dcbfa[_0xec33('0x5')]]['name'],_0x4dcbfa['value'],queues[_0x4dcbfa[_0xec33('0x5')]][_0xec33('0x8')]));writeDB(queues[_0x4dcbfa[_0xec33('0x5')]]);}}else if(!_['isNil'](_0x4dcbfa['variable'][_0xec33('0x27')])){if(!_['isNil'](queues[_0x4dcbfa[_0xec33('0x5')]])&&!queues[_0x4dcbfa[_0xec33('0x5')]][_0xec33('0x28')]){queues[_0x4dcbfa[_0xec33('0x5')]][_0xec33('0x28')]=![];queues[_0x4dcbfa['uniqueid']]['queuecallerabandonAt']=null;queues[_0x4dcbfa[_0xec33('0x5')]][_0xec33('0x24')]=!![];queues[_0x4dcbfa[_0xec33('0x5')]]['queuecallerexitAt']=utils[_0xec33('0x14')]();queues[_0x4dcbfa[_0xec33('0x5')]][_0xec33('0x8')]=_0xec33('0x29');utils[_0xec33('0x3')](util[_0xec33('0x10')](_0xec33('0x2a'),_0x4dcbfa[_0xec33('0x5')],queues[_0x4dcbfa[_0xec33('0x5')]][_0xec33('0x1b')],_0x4dcbfa['value'],queues[_0x4dcbfa[_0xec33('0x5')]]['queuecallerexitreason']));}}}catch(_0x1c66ff){utils['error'](util[_0xec33('0x10')](_0xec33('0x2b'),_0x4dcbfa[_0xec33('0x5')]),_0x1c66ff);}};exports['queuecallerabandon']=function(_0x46b00f){try{if(!_['isNil'](queues[_0x46b00f[_0xec33('0x5')]])){utils['debug'](util[_0xec33('0x10')](_0xec33('0x2c'),_0x46b00f[_0xec33('0x5')]),_0x46b00f);queues[_0x46b00f['uniqueid']][_0xec33('0x24')]=![];queues[_0x46b00f['uniqueid']][_0xec33('0x25')]=null;queues[_0x46b00f['uniqueid']][_0xec33('0x28')]=!![];queues[_0x46b00f[_0xec33('0x5')]]['queuecallerabandonAt']=utils['now']();queues[_0x46b00f[_0xec33('0x5')]][_0xec33('0x8')]=_0xec33('0x2d');utils[_0xec33('0x3')](util[_0xec33('0x10')](_0xec33('0x2e'),_0x46b00f[_0xec33('0x5')],queues[_0x46b00f['uniqueid']][_0xec33('0x1b')],queues[_0x46b00f[_0xec33('0x5')]][_0xec33('0x8')]));}}catch(_0x437c9f){utils[_0xec33('0x2f')](util[_0xec33('0x10')](_0xec33('0x2c'),_0x46b00f[_0xec33('0x5')]),_0x437c9f);}};exports['queuecallerleave']=function(_0x27d064){try{if(!_[_0xec33('0x1f')](queues[_0x27d064[_0xec33('0x5')]])){utils[_0xec33('0xf')](util[_0xec33('0x10')](_0xec33('0x30'),_0x27d064[_0xec33('0x5')]),_0x27d064);utils[_0xec33('0x3')](util[_0xec33('0x10')](_0xec33('0x31'),_0x27d064[_0xec33('0x5')],queues[_0x27d064['uniqueid']]['name'],_0x27d064[_0xec33('0x32')],_0x27d064[_0xec33('0x33')]));queues[_0x27d064[_0xec33('0x5')]]['queuecallerleave']=!![];queues[_0x27d064['uniqueid']][_0xec33('0x16')]=utils['now']();queues[_0x27d064[_0xec33('0x5')]][_0xec33('0x34')]=utils[_0xec33('0x35')](queues[_0x27d064[_0xec33('0x5')]][_0xec33('0x16')],queues[_0x27d064[_0xec33('0x5')]][_0xec33('0x36')]);queues[_0x27d064[_0xec33('0x5')]][_0xec33('0x37')]=_0x27d064[_0xec33('0x37')];queues[_0x27d064[_0xec33('0x5')]][_0xec33('0x38')]=_0x27d064['count'];queues[_0x27d064[_0xec33('0x5')]]['connectedlinenum']=_0x27d064['connectedlinenum'];queues[_0x27d064['uniqueid']][_0xec33('0x33')]=_0x27d064['connectedlinename'];}}catch(_0x4e7a70){utils[_0xec33('0x2f')](util[_0xec33('0x10')]('[%s][queues][queuecallerleave]',_0x27d064[_0xec33('0x5')]),_0x4e7a70);}};exports[_0xec33('0x39')]=function(_0x37dc3b){try{if(!_[_0xec33('0x1f')](queues[_0x37dc3b['uniqueid']])){utils[_0xec33('0xf')](util['format'](_0xec33('0x3a'),_0x37dc3b[_0xec33('0x5')]),_0x37dc3b);utils[_0xec33('0x3')](util[_0xec33('0x10')](_0xec33('0x3b'),_0x37dc3b[_0xec33('0x5')],queues[_0x37dc3b[_0xec33('0x5')]]['name'],_0x37dc3b[_0xec33('0x3c')],_0x37dc3b[_0xec33('0x3d')]));queues[_0x37dc3b[_0xec33('0x5')]][_0xec33('0x28')]=![];queues[_0x37dc3b[_0xec33('0x5')]]['queuecallerabandon']=![];queues[_0x37dc3b['uniqueid']]['queuecallerabandonAt']=null;queues[_0x37dc3b[_0xec33('0x5')]][_0xec33('0x24')]=![];queues[_0x37dc3b[_0xec33('0x5')]][_0xec33('0x8')]=null;queues[_0x37dc3b['uniqueid']]['queuecallerexitAt']=null;queues[_0x37dc3b['uniqueid']][_0xec33('0x3e')]=!![];queues[_0x37dc3b[_0xec33('0x5')]][_0xec33('0x3f')]=_0x37dc3b[_0xec33('0x3d')];queues[_0x37dc3b[_0xec33('0x5')]]['lastAssignedTo']=_0x37dc3b['membername'];}}catch(_0x20703e){utils['error'](util['format'](_0xec33('0x3a'),_0x37dc3b[_0xec33('0x5')]),_0x20703e);}};exports[_0xec33('0x40')]=function(_0x44e23b){try{if(!_[_0xec33('0x1f')](queues[_0x44e23b[_0xec33('0x5')]])){if(queues[_0x44e23b['uniqueid']][_0xec33('0x16')]){utils[_0xec33('0xf')](util[_0xec33('0x10')](_0xec33('0x41'),_0x44e23b[_0xec33('0x5')]),_0x44e23b);queues[_0x44e23b[_0xec33('0x5')]][_0xec33('0x28')]=![];queues[_0x44e23b[_0xec33('0x5')]][_0xec33('0x28')]=![];queues[_0x44e23b['uniqueid']][_0xec33('0x23')]=null;queues[_0x44e23b[_0xec33('0x5')]][_0xec33('0x24')]=![];queues[_0x44e23b[_0xec33('0x5')]]['queuecallerexitAt']=null;queues[_0x44e23b['uniqueid']]['assigned']=!![];queues[_0x44e23b[_0xec33('0x5')]]['lastAssignedTo']=_0x44e23b['membername'];queues[_0x44e23b[_0xec33('0x5')]][_0xec33('0x17')]=!![];queues[_0x44e23b['uniqueid']][_0xec33('0x18')]=utils[_0xec33('0x14')]();if(_0x44e23b[_0xec33('0x42')]==_0xec33('0x43')){if(!queues[_0x44e23b[_0xec33('0x5')]][_0xec33('0x43')]){queues[_0x44e23b[_0xec33('0x5')]][_0xec33('0x8')]=_0xec33('0x44');}}else{queues[_0x44e23b[_0xec33('0x5')]][_0xec33('0x8')]=_0xec33('0x45')+_0x44e23b[_0xec33('0x42')][_0xec33('0x22')]();}utils[_0xec33('0x3')](util[_0xec33('0x10')](_0xec33('0x46'),_0x44e23b['uniqueid'],queues[_0x44e23b[_0xec33('0x5')]]['name'],_0x44e23b[_0xec33('0x3c')],queues[_0x44e23b[_0xec33('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x44e23b[_0xec33('0x5')]]);}}}catch(_0x34fd1c){utils[_0xec33('0x2f')](util[_0xec33('0x10')](_0xec33('0x41'),_0x44e23b[_0xec33('0x5')]),_0x34fd1c);}};exports[_0xec33('0x47')]=function(_0x54c1b3){try{if(!_[_0xec33('0x1f')](queues[_0x54c1b3[_0xec33('0x48')]])){utils[_0xec33('0xf')](util[_0xec33('0x10')]('[%s][queues][blindtransfer]',_0x54c1b3[_0xec33('0x5')]),_0x54c1b3);queues[_0x54c1b3[_0xec33('0x48')]]['transfer']=!![];queues[_0x54c1b3[_0xec33('0x48')]][_0xec33('0x49')]=_0xec33('0x4a');queues[_0x54c1b3[_0xec33('0x48')]]['transferexten']=_0x54c1b3[_0xec33('0x4b')];queues[_0x54c1b3[_0xec33('0x48')]][_0xec33('0x4c')]=_0x54c1b3[_0xec33('0x48')];queues[_0x54c1b3[_0xec33('0x48')]][_0xec33('0x8')]=_0xec33('0x4d');utils[_0xec33('0x3')](util['format'](_0xec33('0x4e'),_0x54c1b3[_0xec33('0x5')],queues[_0x54c1b3[_0xec33('0x48')]][_0xec33('0x1b')],_0x54c1b3[_0xec33('0x48')],_0x54c1b3['extension']));}}catch(_0x4f81e4){utils['error'](util[_0xec33('0x10')](_0xec33('0x4f'),_0x54c1b3[_0xec33('0x5')]),_0x4f81e4);}};exports[_0xec33('0x50')]=function(_0x2bb4e3){try{utils['debug'](util['format'](_0xec33('0x51'),_0x2bb4e3['origtransfereruniqueid']),_0x2bb4e3);if(_0x2bb4e3[_0xec33('0x52')]==_0x2bb4e3[_0xec33('0x53')]){if(!_[_0xec33('0x1f')](queues[_0x2bb4e3[_0xec33('0x54')]])){utils['info'](util[_0xec33('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2bb4e3['origtransfereruniqueid'],queues[_0x2bb4e3[_0xec33('0x54')]]['name'],_0x2bb4e3[_0xec33('0x55')]));queues[_0x2bb4e3[_0xec33('0x54')]][_0xec33('0x43')]=!![];queues[_0x2bb4e3[_0xec33('0x54')]][_0xec33('0x49')]=_0xec33('0x56');queues[_0x2bb4e3['secondtransfererlinkedid']][_0xec33('0x57')]=_0x2bb4e3['origtransfererexten'];queues[_0x2bb4e3['secondtransfererlinkedid']][_0xec33('0x4c')]=_0x2bb4e3[_0xec33('0x52')];queues[_0x2bb4e3['secondtransfererlinkedid']]['queuecallerexitreason']=_0xec33('0x58');}if(!_['isNil'](queues[_0x2bb4e3[_0xec33('0x53')]])){if(_0x2bb4e3[_0xec33('0x59')]&&queues[_0x2bb4e3['transfereelinkedid']]){queues[_0x2bb4e3['transfereelinkedid']][_0xec33('0x1d')]=0x1;queues[_0x2bb4e3[_0xec33('0x48')]]=_[_0xec33('0x5a')](queues[_0x2bb4e3[_0xec33('0x59')]]);queues[_0x2bb4e3[_0xec33('0x48')]][_0xec33('0x1c')]=_0x2bb4e3[_0xec33('0x5b')];queues[_0x2bb4e3[_0xec33('0x48')]]['queuecallerenterreason']=0x2;queues[_0x2bb4e3[_0xec33('0x48')]][_0xec33('0x5c')]=queues[_0x2bb4e3[_0xec33('0x54')]][_0xec33('0x5c')];queues[_0x2bb4e3[_0xec33('0x48')]]['calleridname']=queues[_0x2bb4e3[_0xec33('0x54')]][_0xec33('0x5d')];queues[_0x2bb4e3[_0xec33('0x48')]][_0xec33('0x36')]=utils[_0xec33('0x14')]();queues[_0x2bb4e3[_0xec33('0x48')]][_0xec33('0x16')]=utils[_0xec33('0x14')]();queues[_0x2bb4e3[_0xec33('0x48')]][_0xec33('0x34')]=0x0;queues[_0x2bb4e3[_0xec33('0x48')]][_0xec33('0x5e')]=0x0;utils[_0xec33('0x3')](util[_0xec33('0x10')](_0xec33('0x5f'),_0x2bb4e3['origtransfereruniqueid'],queues[_0x2bb4e3[_0xec33('0x48')]][_0xec33('0x1b')],queues[_0x2bb4e3[_0xec33('0x48')]]['calleridnum'],queues[_0x2bb4e3[_0xec33('0x48')]][_0xec33('0x5d')]));}else{utils['info'](util[_0xec33('0x10')](_0xec33('0x60'),_0x2bb4e3[_0xec33('0x52')],queues[_0x2bb4e3[_0xec33('0x53')]]['name'],_0x2bb4e3[_0xec33('0x54')]));queues[_0x2bb4e3[_0xec33('0x53')]]['transfereduniqueid']=_0x2bb4e3[_0xec33('0x54')];}}}else if(_0x2bb4e3[_0xec33('0x61')]==_0x2bb4e3[_0xec33('0x54')]){if(!_[_0xec33('0x1f')](queues[_0x2bb4e3[_0xec33('0x53')]])){utils['info'](util['format'](_0xec33('0x62'),_0x2bb4e3['origtransfereruniqueid'],queues[_0x2bb4e3[_0xec33('0x53')]][_0xec33('0x1b')],_0x2bb4e3[_0xec33('0x61')],_0x2bb4e3[_0xec33('0x63')]));queues[_0x2bb4e3['origtransfererlinkedid']][_0xec33('0x43')]=!![];queues[_0x2bb4e3[_0xec33('0x53')]]['transfertype']=_0xec33('0x56');queues[_0x2bb4e3[_0xec33('0x53')]][_0xec33('0x57')]=_0x2bb4e3[_0xec33('0x63')];queues[_0x2bb4e3[_0xec33('0x53')]][_0xec33('0x4c')]=_0x2bb4e3[_0xec33('0x61')];queues[_0x2bb4e3[_0xec33('0x53')]][_0xec33('0x8')]=_0xec33('0x58');}if(!_['isNil'](queues[_0x2bb4e3['secondtransfererlinkedid']])){if(_0x2bb4e3[_0xec33('0x64')]&&queues[_0x2bb4e3[_0xec33('0x64')]]){queues[_0x2bb4e3['transfertargetlinkedid']][_0xec33('0x1d')]=0x1;queues[_0x2bb4e3[_0xec33('0x5b')]]=_[_0xec33('0x5a')](queues[_0x2bb4e3[_0xec33('0x64')]]);queues[_0x2bb4e3[_0xec33('0x5b')]][_0xec33('0x1c')]=_0x2bb4e3[_0xec33('0x5b')];queues[_0x2bb4e3[_0xec33('0x5b')]]['queuecallerenterreason']=0x2;queues[_0x2bb4e3['transfertargetuniqueid']]['calleridnum']=queues[_0x2bb4e3[_0xec33('0x53')]][_0xec33('0x5c')];queues[_0x2bb4e3[_0xec33('0x5b')]]['calleridname']=queues[_0x2bb4e3['origtransfererlinkedid']][_0xec33('0x5d')];queues[_0x2bb4e3['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0xec33('0x14')]();queues[_0x2bb4e3[_0xec33('0x5b')]][_0xec33('0x16')]=utils[_0xec33('0x14')]();queues[_0x2bb4e3[_0xec33('0x5b')]][_0xec33('0x34')]=0x0;queues[_0x2bb4e3['transfertargetuniqueid']][_0xec33('0x5e')]=0x0;utils['info'](util[_0xec33('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x2bb4e3[_0xec33('0x52')],queues[_0x2bb4e3[_0xec33('0x5b')]]['name'],queues[_0x2bb4e3[_0xec33('0x5b')]]['transfereduniqueid'],queues[_0x2bb4e3[_0xec33('0x5b')]][_0xec33('0x5c')],queues[_0x2bb4e3[_0xec33('0x5b')]][_0xec33('0x5d')]));}else{utils['info'](util['format'](_0xec33('0x60'),_0x2bb4e3[_0xec33('0x52')],queues[_0x2bb4e3['secondtransfererlinkedid']]['name'],_0x2bb4e3[_0xec33('0x53')]));queues[_0x2bb4e3[_0xec33('0x54')]]['transfereduniqueid']=_0x2bb4e3[_0xec33('0x53')];}}}}catch(_0x3b58e0){utils[_0xec33('0x2f')](util[_0xec33('0x10')](_0xec33('0x51'),_0x2bb4e3[_0xec33('0x52')]),_0x3b58e0);}};exports[_0xec33('0x65')]=function(_0x73bc2c){try{if(!_[_0xec33('0x1f')](queues[_0x73bc2c['uniqueid']])){utils['debug'](util[_0xec33('0x10')](_0xec33('0x66'),_0x73bc2c[_0xec33('0x5')]),_0x73bc2c);queues[_0x73bc2c[_0xec33('0x5')]][_0xec33('0x67')]=utils[_0xec33('0x14')]();utils[_0xec33('0x3')](util[_0xec33('0x10')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x73bc2c[_0xec33('0x5')],queues[_0x73bc2c[_0xec33('0x5')]][_0xec33('0x1b')],queues[_0x73bc2c[_0xec33('0x5')]][_0xec33('0x67')]));}}catch(_0x43446a){utils[_0xec33('0x2f')](util[_0xec33('0x10')](_0xec33('0x66'),_0x73bc2c[_0xec33('0x5')]),_0x43446a);}};exports[_0xec33('0x68')]=function(_0x478611){try{if(!_[_0xec33('0x1f')](queues[_0x478611[_0xec33('0x5')]])){if(!_[_0xec33('0x1f')](queues[_0x478611[_0xec33('0x5')]][_0xec33('0x67')])){utils['debug'](util[_0xec33('0x10')](_0xec33('0x69'),_0x478611[_0xec33('0x5')]),_0x478611);queues[_0x478611['uniqueid']][_0xec33('0x5e')]+=utils['diffTime'](utils['now'](),queues[_0x478611[_0xec33('0x5')]][_0xec33('0x67')]);utils['info'](util[_0xec33('0x10')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x478611[_0xec33('0x5')],queues[_0x478611[_0xec33('0x5')]]['name'],queues[_0x478611[_0xec33('0x5')]][_0xec33('0x5e')]));delete queues[_0x478611['uniqueid']][_0xec33('0x67')];}}}catch(_0x4f7156){utils[_0xec33('0x2f')](util['format'](_0xec33('0x69'),_0x478611[_0xec33('0x5')]),_0x4f7156);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a718981..3a0d1f9 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 _0x2dcd=['request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','replace','.WAV','find','monitors','value','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','application','toLowerCase','set','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording'];(function(_0x17e16c,_0x14b603){var _0x1fa239=function(_0x11b397){while(--_0x11b397){_0x17e16c['push'](_0x17e16c['shift']());}};_0x1fa239(++_0x14b603);}(_0x2dcd,0x15c));var _0xd2dc=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0x2dcd[_0x138836];return _0x322688;};'use strict';var _=require(_0xd2dc('0x0'));var util=require(_0xd2dc('0x1'));var utils=require(_0xd2dc('0x2'));var recordings={};function writeDB(_0x471378){utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')]('[%s][recordings][writeDB]',_0x471378[_0xd2dc('0x5')]));if(_0x471378[_0xd2dc('0x6')]){utils[_0xd2dc('0x7')](_0x471378['accountcode'])[_0xd2dc('0x8')](function(_0x82bd98){if(_0x82bd98){_0x471378[_0xd2dc('0x9')]=_0x82bd98[_0xd2dc('0xa')];_0x471378['UserId']=_0x82bd98['id'];}utils['request'](_0xd2dc('0xb'),_0x471378);});}else{utils[_0xd2dc('0xc')](_0xd2dc('0xb'),_0x471378);}}exports[_0xd2dc('0xd')]=function(_0x5cfb48){try{utils[_0xd2dc('0xe')](util['format'](_0xd2dc('0xf'),_0x5cfb48[_0xd2dc('0x5')]),_0x5cfb48);if(_0x5cfb48[_0xd2dc('0x5')]==_0x5cfb48[_0xd2dc('0x10')]){utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')](_0xd2dc('0x11'),_0x5cfb48[_0xd2dc('0x5')],_0x5cfb48[_0xd2dc('0x12')],_0x5cfb48[_0xd2dc('0x13')]));recordings[_0x5cfb48[_0xd2dc('0x5')]]={'uniqueid':_0x5cfb48[_0xd2dc('0x5')],'accountcode':_0x5cfb48[_0xd2dc('0x6')],'exten':_0x5cfb48[_0xd2dc('0x13')],'context':_0x5cfb48[_0xd2dc('0x12')],'channel':_0x5cfb48[_0xd2dc('0x14')],'monitors':[]};}}catch(_0x47abec){utils['error'](util[_0xd2dc('0x4')](_0xd2dc('0xf'),_0x5cfb48[_0xd2dc('0x5')]),_0x47abec);}};exports['newstate']=function(_0x23a9b8){try{utils[_0xd2dc('0xe')](util[_0xd2dc('0x4')](_0xd2dc('0x15'),_0x23a9b8[_0xd2dc('0x5')]),_0x23a9b8);if(!_[_0xd2dc('0x16')](recordings[_0x23a9b8['uniqueid']])&&_0x23a9b8[_0xd2dc('0x17')]==0x6){utils[_0xd2dc('0x3')](util['format'](_0xd2dc('0x18'),_0x23a9b8[_0xd2dc('0x5')],_0x23a9b8['context'],_0x23a9b8[_0xd2dc('0x14')]));}else if(!_[_0xd2dc('0x16')](recordings[_0x23a9b8[_0xd2dc('0x10')]])&&_0x23a9b8['channelstate']==0x6&&_0x23a9b8['context']!='transfer'){utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')](_0xd2dc('0x19'),_0x23a9b8[_0xd2dc('0x5')],_0x23a9b8['linkedid'],_0x23a9b8[_0xd2dc('0x12')],_0x23a9b8[_0xd2dc('0x14')]));recordings[_0x23a9b8[_0xd2dc('0x10')]][_0xd2dc('0x6')]=_0x23a9b8[_0xd2dc('0x6')];}}catch(_0x164cc0){utils[_0xd2dc('0x1a')](util[_0xd2dc('0x4')](_0xd2dc('0x15'),_0x23a9b8[_0xd2dc('0x5')]),_0x164cc0);}};exports[_0xd2dc('0x1b')]=function(_0x29a1a8){try{if(!_[_0xd2dc('0x16')](_0x29a1a8[_0xd2dc('0x1c')])&&!_[_0xd2dc('0x16')](_0x29a1a8[_0xd2dc('0x1c')][_0xd2dc('0x1d')])){utils[_0xd2dc('0xe')](util['format'](_0xd2dc('0x1e'),_0x29a1a8[_0xd2dc('0x5')]),_0x29a1a8);utils['info'](util[_0xd2dc('0x4')](_0xd2dc('0x1f'),_0x29a1a8[_0xd2dc('0x5')],_0x29a1a8[_0xd2dc('0x1c')],_0x29a1a8['value']));if(_[_0xd2dc('0x20')](_0x29a1a8['value'],_0xd2dc('0x21'))){_0x29a1a8['value']=_0x29a1a8['value'][_0xd2dc('0x22')]('.wav49',_0xd2dc('0x23'));}if(recordings[_0x29a1a8[_0xd2dc('0x10')]]){var _0x202d8b=_[_0xd2dc('0x24')](recordings[_0x29a1a8[_0xd2dc('0x10')]][_0xd2dc('0x25')],{'value':_0x29a1a8[_0xd2dc('0x26')]});if(_[_0xd2dc('0x16')](_0x202d8b)){recordings[_0x29a1a8[_0xd2dc('0x10')]][_0xd2dc('0x25')]['push']({'value':_0x29a1a8[_0xd2dc('0x26')]});}}}}catch(_0x4fac61){utils[_0xd2dc('0x1a')](util[_0xd2dc('0x4')](_0xd2dc('0x1e'),_0x29a1a8[_0xd2dc('0x5')]),_0x4fac61);}};exports['hangup']=function(_0x197adb){try{if(!_[_0xd2dc('0x16')](recordings[_0x197adb['uniqueid']])){utils['debug'](util['format'](_0xd2dc('0x27'),_0x197adb[_0xd2dc('0x5')]),_0x197adb);utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x197adb[_0xd2dc('0x5')],_0x197adb['calleridnum'],_0x197adb[_0xd2dc('0x28')],_0x197adb[_0xd2dc('0x29')]));recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2a')]=_0x197adb['calleridnum'];recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x28')]=_0x197adb['calleridname'];recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2b')]=_0x197adb[_0xd2dc('0x2b')];recordings[_0x197adb[_0xd2dc('0x5')]]['connectedlinename']=_0x197adb[_0xd2dc('0x2c')];if(recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2d')]==_0xd2dc('0x2e')&&recordings[_0x197adb['uniqueid']][_0xd2dc('0x6')]){recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2b')]=recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x6')];recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2c')]='';}recordings[_0x197adb['uniqueid']][_0xd2dc('0x25')][_0xd2dc('0x2f')](function(_0xecb285){var _0x3e752f=_[_0xd2dc('0x30')](recordings[_0x197adb[_0xd2dc('0x5')]]);_0x3e752f['value']=_0xecb285[_0xd2dc('0x26')];writeDB(_0x3e752f);});delete recordings[_0x197adb[_0xd2dc('0x5')]];}}catch(_0x397123){utils['error'](util[_0xd2dc('0x4')](_0xd2dc('0x27'),_0x197adb['uniqueid']),_0x397123);}};exports['newexten']=function(_0x30ef56){try{if(!_[_0xd2dc('0x16')](recordings[_0x30ef56[_0xd2dc('0x5')]])){utils[_0xd2dc('0xe')](util['format'](_0xd2dc('0x31'),_0x30ef56['uniqueid']),_0x30ef56);utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x30ef56[_0xd2dc('0x5')],_0x30ef56[_0xd2dc('0x32')],_0x30ef56['appdata']));if(_0x30ef56[_0xd2dc('0x32')][_0xd2dc('0x33')]()==_0xd2dc('0x34')&&_['startsWith'](_0x30ef56[_0xd2dc('0x35')][_0xd2dc('0x33')](),'cdr')){var _0x276ef9=_0x30ef56[_0xd2dc('0x35')][_0xd2dc('0x36')]('=');var _0x2ae6c8=_0x276ef9[0x0][_0xd2dc('0x37')](_0x276ef9[0x0][_0xd2dc('0x38')]('(')+0x1,_0x276ef9[0x0][_0xd2dc('0x38')](')'));var _0x4f8f76=_0x276ef9[0x1];recordings[_0x30ef56[_0xd2dc('0x5')]][_0x2ae6c8]=_0x4f8f76;}}}catch(_0xa2e6b7){utils['error'](util[_0xd2dc('0x4')](_0xd2dc('0x31'),_0x30ef56[_0xd2dc('0x5')]),_0xa2e6b7);}};exports[_0xd2dc('0x39')]=function(_0x4f6e5e){try{if(!_[_0xd2dc('0x16')](recordings[_0x4f6e5e['uniqueid']])){utils['debug'](util['format'](_0xd2dc('0x3a'),_0x4f6e5e[_0xd2dc('0x5')]),_0x4f6e5e);utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x4f6e5e[_0xd2dc('0x5')],_0x4f6e5e['queue']));recordings[_0x4f6e5e[_0xd2dc('0x5')]][_0xd2dc('0x3b')]=_0x4f6e5e['queue'];}}catch(_0x312554){utils[_0xd2dc('0x1a')](util[_0xd2dc('0x4')](_0xd2dc('0x3a'),_0x4f6e5e[_0xd2dc('0x5')]),_0x312554);}}; \ No newline at end of file +var _0x777f=['[%s][recordings][varset]','endsWith','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','membername','UserId','CreateVoiceRecording','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newchannel]','newstate','channelstate','isNil','[%s][recordings][newstate]','variable','mixmonitor_filename'];(function(_0x142fba,_0x35ac72){var _0x3f5a76=function(_0x27140c){while(--_0x27140c){_0x142fba['push'](_0x142fba['shift']());}};_0x3f5a76(++_0x35ac72);}(_0x777f,0x1a0));var _0xf777=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x777f[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xf777('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x48a84d){utils[_0xf777('0x1')](util[_0xf777('0x2')](_0xf777('0x3'),_0x48a84d[_0xf777('0x4')]));if(_0x48a84d['accountcode']){utils[_0xf777('0x5')](_0x48a84d[_0xf777('0x6')])['then'](function(_0x560b18){if(_0x560b18){_0x48a84d[_0xf777('0x7')]=_0x560b18['name'];_0x48a84d[_0xf777('0x8')]=_0x560b18['id'];}utils['request'](_0xf777('0x9'),_0x48a84d);});}else{utils['request']('CreateVoiceRecording',_0x48a84d);}}exports['newchannel']=function(_0x3afc46){try{utils[_0xf777('0xa')](util[_0xf777('0x2')]('[%s][recordings][newchannel]',_0x3afc46[_0xf777('0x4')]),_0x3afc46);if(_0x3afc46[_0xf777('0x4')]==_0x3afc46[_0xf777('0xb')]){utils[_0xf777('0x1')](util[_0xf777('0x2')](_0xf777('0xc'),_0x3afc46[_0xf777('0x4')],_0x3afc46['context'],_0x3afc46[_0xf777('0xd')]));recordings[_0x3afc46[_0xf777('0x4')]]={'uniqueid':_0x3afc46['uniqueid'],'accountcode':_0x3afc46[_0xf777('0x6')],'exten':_0x3afc46['exten'],'context':_0x3afc46[_0xf777('0xe')],'channel':_0x3afc46[_0xf777('0xf')],'monitors':[]};}}catch(_0x375918){utils[_0xf777('0x10')](util[_0xf777('0x2')](_0xf777('0x11'),_0x3afc46[_0xf777('0x4')]),_0x375918);}};exports[_0xf777('0x12')]=function(_0x20040a){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x20040a[_0xf777('0x4')]),_0x20040a);if(!_['isNil'](recordings[_0x20040a['uniqueid']])&&_0x20040a[_0xf777('0x13')]==0x6){utils[_0xf777('0x1')](util[_0xf777('0x2')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x20040a[_0xf777('0x4')],_0x20040a[_0xf777('0xe')],_0x20040a[_0xf777('0xf')]));}else if(!_[_0xf777('0x14')](recordings[_0x20040a[_0xf777('0xb')]])&&_0x20040a['channelstate']==0x6&&_0x20040a[_0xf777('0xe')]!='transfer'){utils[_0xf777('0x1')](util[_0xf777('0x2')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x20040a[_0xf777('0x4')],_0x20040a[_0xf777('0xb')],_0x20040a[_0xf777('0xe')],_0x20040a[_0xf777('0xf')]));recordings[_0x20040a[_0xf777('0xb')]][_0xf777('0x6')]=_0x20040a['accountcode'];}}catch(_0x9eb6a4){utils[_0xf777('0x10')](util['format'](_0xf777('0x15'),_0x20040a[_0xf777('0x4')]),_0x9eb6a4);}};exports['varset']=function(_0x39430e){try{if(!_[_0xf777('0x14')](_0x39430e['variable'])&&!_[_0xf777('0x14')](_0x39430e[_0xf777('0x16')][_0xf777('0x17')])){utils[_0xf777('0xa')](util[_0xf777('0x2')](_0xf777('0x18'),_0x39430e[_0xf777('0x4')]),_0x39430e);utils[_0xf777('0x1')](util[_0xf777('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x39430e[_0xf777('0x4')],_0x39430e[_0xf777('0x16')],_0x39430e['value']));if(_[_0xf777('0x19')](_0x39430e[_0xf777('0x1a')],_0xf777('0x1b'))){_0x39430e[_0xf777('0x1a')]=_0x39430e[_0xf777('0x1a')][_0xf777('0x1c')](_0xf777('0x1b'),_0xf777('0x1d'));}if(recordings[_0x39430e[_0xf777('0xb')]]){var _0x6abd89=_[_0xf777('0x1e')](recordings[_0x39430e[_0xf777('0xb')]][_0xf777('0x1f')],{'value':_0x39430e[_0xf777('0x1a')]});if(_['isNil'](_0x6abd89)){recordings[_0x39430e[_0xf777('0xb')]][_0xf777('0x1f')][_0xf777('0x20')]({'value':_0x39430e[_0xf777('0x1a')]});}}}}catch(_0x36929f){utils[_0xf777('0x10')](util['format'](_0xf777('0x18'),_0x39430e[_0xf777('0x4')]),_0x36929f);}};exports['hangup']=function(_0x4881f5){try{if(!_[_0xf777('0x14')](recordings[_0x4881f5[_0xf777('0x4')]])){utils['debug'](util[_0xf777('0x2')](_0xf777('0x21'),_0x4881f5[_0xf777('0x4')]),_0x4881f5);utils[_0xf777('0x1')](util[_0xf777('0x2')](_0xf777('0x22'),_0x4881f5[_0xf777('0x4')],_0x4881f5['calleridnum'],_0x4881f5[_0xf777('0x23')],_0x4881f5[_0xf777('0x24')]));recordings[_0x4881f5['uniqueid']][_0xf777('0x25')]=_0x4881f5[_0xf777('0x25')];recordings[_0x4881f5[_0xf777('0x4')]]['calleridname']=_0x4881f5[_0xf777('0x23')];recordings[_0x4881f5[_0xf777('0x4')]]['connectedlinenum']=_0x4881f5[_0xf777('0x26')];recordings[_0x4881f5['uniqueid']][_0xf777('0x27')]=_0x4881f5[_0xf777('0x27')];if(recordings[_0x4881f5['uniqueid']][_0xf777('0x28')]=='outbound'&&recordings[_0x4881f5[_0xf777('0x4')]][_0xf777('0x6')]){recordings[_0x4881f5[_0xf777('0x4')]][_0xf777('0x26')]=recordings[_0x4881f5['uniqueid']]['accountcode'];recordings[_0x4881f5[_0xf777('0x4')]][_0xf777('0x27')]='';}recordings[_0x4881f5[_0xf777('0x4')]]['monitors'][_0xf777('0x29')](function(_0x46aa46){var _0x385a9f=_[_0xf777('0x2a')](recordings[_0x4881f5[_0xf777('0x4')]]);_0x385a9f[_0xf777('0x1a')]=_0x46aa46[_0xf777('0x1a')];writeDB(_0x385a9f);});delete recordings[_0x4881f5[_0xf777('0x4')]];}}catch(_0x2ed1bb){utils[_0xf777('0x10')](util[_0xf777('0x2')](_0xf777('0x21'),_0x4881f5[_0xf777('0x4')]),_0x2ed1bb);}};exports[_0xf777('0x2b')]=function(_0x561333){try{if(!_['isNil'](recordings[_0x561333[_0xf777('0x4')]])){utils['debug'](util[_0xf777('0x2')](_0xf777('0x2c'),_0x561333['uniqueid']),_0x561333);utils['info'](util[_0xf777('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x561333[_0xf777('0x4')],_0x561333[_0xf777('0x2d')],_0x561333[_0xf777('0x2e')]));if(_0x561333[_0xf777('0x2d')][_0xf777('0x2f')]()==_0xf777('0x30')&&_['startsWith'](_0x561333[_0xf777('0x2e')][_0xf777('0x2f')](),'cdr')){var _0x45bd1b=_0x561333['appdata'][_0xf777('0x31')]('=');var _0x4814a7=_0x45bd1b[0x0]['substring'](_0x45bd1b[0x0][_0xf777('0x32')]('(')+0x1,_0x45bd1b[0x0][_0xf777('0x32')](')'));var _0x3b4254=_0x45bd1b[0x1];recordings[_0x561333['uniqueid']][_0x4814a7]=_0x3b4254;}}}catch(_0x5a6987){utils[_0xf777('0x10')](util['format'](_0xf777('0x2c'),_0x561333[_0xf777('0x4')]),_0x5a6987);}};exports[_0xf777('0x33')]=function(_0x4aec0e){try{if(!_[_0xf777('0x14')](recordings[_0x4aec0e[_0xf777('0x4')]])){utils[_0xf777('0xa')](util[_0xf777('0x2')]('[%s][recordings][queuecallerjoin]',_0x4aec0e[_0xf777('0x4')]),_0x4aec0e);utils[_0xf777('0x1')](util[_0xf777('0x2')](_0xf777('0x34'),_0x4aec0e[_0xf777('0x4')],_0x4aec0e[_0xf777('0x35')]));recordings[_0x4aec0e[_0xf777('0x4')]][_0xf777('0x35')]=_0x4aec0e[_0xf777('0x35')];}}catch(_0x265407){utils[_0xf777('0x10')](util[_0xf777('0x2')](_0xf777('0x36'),_0x4aec0e[_0xf777('0x4')]),_0x265407);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 97b38d2..c841000 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 _0x8b11=['info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','transferercalleridnum','transferercalleridname','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils'];(function(_0x26f9fd,_0x301ab5){var _0x44a4bf=function(_0x42b9a5){while(--_0x42b9a5){_0x26f9fd['push'](_0x26f9fd['shift']());}};_0x44a4bf(++_0x301ab5);}(_0x8b11,0x165));var _0x18b1=function(_0x438e07,_0x590a1b){_0x438e07=_0x438e07-0x0;var _0x28f1a4=_0x8b11[_0x438e07];return _0x28f1a4;};'use strict';var _=require(_0x18b1('0x0'));var util=require(_0x18b1('0x1'));var utils=require(_0x18b1('0x2'));function writeDB(_0x3ad652){utils[_0x18b1('0x3')](util[_0x18b1('0x4')](_0x18b1('0x5'),_0x3ad652[_0x18b1('0x6')]===_0x18b1('0x7')?_0x3ad652['origtransfereruniqueid']:_0x3ad652[_0x18b1('0x8')],_0x3ad652[_0x18b1('0x6')]));utils[_0x18b1('0x9')](_0x18b1('0xa'),_0x3ad652);}exports[_0x18b1('0xb')]=function(_0x100dc5){try{utils[_0x18b1('0xc')](util[_0x18b1('0x4')]('[%s][transfers][blindtransfer]',_0x100dc5[_0x18b1('0x8')]),_0x100dc5);utils[_0x18b1('0x3')](util[_0x18b1('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x100dc5[_0x18b1('0x8')],_0x100dc5[_0x18b1('0xd')],_0x100dc5[_0x18b1('0xe')],_0x100dc5['transfereecalleridnum'],_0x100dc5['transfereecalleridname']));_0x100dc5['type']='blind';writeDB(_0x100dc5);}catch(_0x31b9f8){utils[_0x18b1('0xf')](util['format'](_0x18b1('0x10'),_0x100dc5[_0x18b1('0x8')]),_0x31b9f8);}};exports['attendedtransfer']=function(_0x3250dd){try{utils[_0x18b1('0xc')](util[_0x18b1('0x4')](_0x18b1('0x11'),_0x3250dd[_0x18b1('0x12')]),_0x3250dd);utils[_0x18b1('0x3')](util[_0x18b1('0x4')](_0x18b1('0x13'),_0x3250dd['origtransfereruniqueid'],_0x3250dd[_0x18b1('0x14')],_0x3250dd[_0x18b1('0x15')],_0x3250dd['transfertargetcalleridnum'],_0x3250dd[_0x18b1('0x16')]));_0x3250dd=_['assign'](_0x3250dd,{'transfererchannel':_0x3250dd[_0x18b1('0x17')],'transferercalleridnum':_0x3250dd['origtransferercalleridnum'],'transferercalleridname':_0x3250dd['origtransferercalleridname'],'transfererconnectedlinenum':_0x3250dd[_0x18b1('0x18')],'transfererconnectedlinename':_0x3250dd[_0x18b1('0x19')],'transfereraccountcode':_0x3250dd[_0x18b1('0x1a')],'transferercontext':_0x3250dd[_0x18b1('0x1b')],'transfererexten':_0x3250dd['secondtransfererexten'],'transfererlinkedid':_0x3250dd[_0x18b1('0x1c')],'context':_0x3250dd[_0x18b1('0x1d')],'extension':_0x3250dd[_0x18b1('0x1e')],'type':'attended'});if(_[_0x18b1('0x1f')](_0x3250dd[_0x18b1('0x20')])){_0x3250dd=_[_0x18b1('0x21')](_0x3250dd,{'transfereechannel':_0x3250dd['transfertargetchannel'],'transfereecalleridnum':_0x3250dd[_0x18b1('0x22')],'transfereecalleridname':_0x3250dd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3250dd[_0x18b1('0x23')],'transfereeconnectedlinename':_0x3250dd[_0x18b1('0x24')],'transfereeaccountcode':_0x3250dd['transfertargetaccountcode'],'transfereecontext':_0x3250dd[_0x18b1('0x25')],'transfereeexten':_0x3250dd[_0x18b1('0x26')],'transfereelinkedid':_0x3250dd[_0x18b1('0x27')]});}writeDB(_0x3250dd);}catch(_0x2f2353){utils[_0x18b1('0xf')](util[_0x18b1('0x4')](_0x18b1('0x11'),_0x3250dd[_0x18b1('0x12')]),_0x2f2353);}}; \ No newline at end of file +var _0xdb53=['origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','info','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','format','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','blind','error','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign'];(function(_0x344c57,_0x5d6cf7){var _0x1a8141=function(_0x4282d5){while(--_0x4282d5){_0x344c57['push'](_0x344c57['shift']());}};_0x1a8141(++_0x5d6cf7);}(_0xdb53,0x183));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3db5('0x0'));var util=require(_0x3db5('0x1'));var utils=require('./utils');function writeDB(_0x2ee2b2){utils[_0x3db5('0x2')](util['format'](_0x3db5('0x3'),_0x2ee2b2[_0x3db5('0x4')]==='attended'?_0x2ee2b2['origtransfereruniqueid']:_0x2ee2b2[_0x3db5('0x5')],_0x2ee2b2[_0x3db5('0x4')]));utils[_0x3db5('0x6')]('CreateVoiceTransferReport',_0x2ee2b2);}exports['blindtransfer']=function(_0xd2ab11){try{utils['debug'](util[_0x3db5('0x7')](_0x3db5('0x8'),_0xd2ab11[_0x3db5('0x5')]),_0xd2ab11);utils['info'](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xd2ab11[_0x3db5('0x5')],_0xd2ab11[_0x3db5('0x9')],_0xd2ab11[_0x3db5('0xa')],_0xd2ab11['transfereecalleridnum'],_0xd2ab11['transfereecalleridname']));_0xd2ab11[_0x3db5('0x4')]=_0x3db5('0xb');writeDB(_0xd2ab11);}catch(_0x5c470a){utils[_0x3db5('0xc')](util['format']('[%s][transfers][blindtransfer]',_0xd2ab11['uniqueid']),_0x5c470a);}};exports['attendedtransfer']=function(_0x40a282){try{utils['debug'](util[_0x3db5('0x7')]('[%s][transfers][attendedtransfer]',_0x40a282[_0x3db5('0xd')]),_0x40a282);utils[_0x3db5('0x2')](util['format'](_0x3db5('0xe'),_0x40a282[_0x3db5('0xd')],_0x40a282[_0x3db5('0xf')],_0x40a282[_0x3db5('0x10')],_0x40a282[_0x3db5('0x11')],_0x40a282[_0x3db5('0x12')]));_0x40a282=_[_0x3db5('0x13')](_0x40a282,{'transfererchannel':_0x40a282[_0x3db5('0x14')],'transferercalleridnum':_0x40a282[_0x3db5('0xf')],'transferercalleridname':_0x40a282[_0x3db5('0x10')],'transfererconnectedlinenum':_0x40a282[_0x3db5('0x15')],'transfererconnectedlinename':_0x40a282[_0x3db5('0x16')],'transfereraccountcode':_0x40a282[_0x3db5('0x17')],'transferercontext':_0x40a282['secondtransferercontext'],'transfererexten':_0x40a282[_0x3db5('0x18')],'transfererlinkedid':_0x40a282[_0x3db5('0x19')],'context':_0x40a282[_0x3db5('0x1a')],'extension':_0x40a282[_0x3db5('0x1b')],'type':'attended'});if(_['isNil'](_0x40a282[_0x3db5('0x1c')])){_0x40a282=_[_0x3db5('0x13')](_0x40a282,{'transfereechannel':_0x40a282[_0x3db5('0x1d')],'transfereecalleridnum':_0x40a282['transfertargetcalleridnum'],'transfereecalleridname':_0x40a282[_0x3db5('0x12')],'transfereeconnectedlinenum':_0x40a282[_0x3db5('0x1e')],'transfereeconnectedlinename':_0x40a282[_0x3db5('0x1f')],'transfereeaccountcode':_0x40a282[_0x3db5('0x20')],'transfereecontext':_0x40a282[_0x3db5('0x21')],'transfereeexten':_0x40a282[_0x3db5('0x22')],'transfereelinkedid':_0x40a282[_0x3db5('0x23')]});}writeDB(_0x40a282);}catch(_0x3f12d5){utils[_0x3db5('0xc')](util[_0x3db5('0x7')](_0x3db5('0x24'),_0x40a282[_0x3db5('0xd')]),_0x3f12d5);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 850413e..b0ff62f 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 _0xfbf5=['[utils][getUser]\x20where:%s','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','length','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','moment','util','client','http','info','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','debug'];(function(_0x5a1b31,_0x293ffd){var _0x273ef3=function(_0x12d585){while(--_0x12d585){_0x5a1b31['push'](_0x5a1b31['shift']());}};_0x273ef3(++_0x293ffd);}(_0xfbf5,0x174));var _0x5fbf=function(_0x290896,_0x273ad3){_0x290896=_0x290896-0x0;var _0x2628e6=_0xfbf5[_0x290896];return _0x2628e6;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x5fbf('0x0'));var util=require(_0x5fbf('0x1'));var client=jayson[_0x5fbf('0x2')][_0x5fbf('0x3')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x5fbf('0x4')]=function(_0x3d3c77,_0x8c5b89){logger[_0x5fbf('0x4')](_0x3d3c77,_0x8c5b89?util['inspect'](_0x8c5b89,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0xdf2363,_0x7db035){logger['debug'](_0xdf2363,_0x7db035?util[_0x5fbf('0x5')](_0x7db035,{'showHidden':![],'depth':null}):'');};exports[_0x5fbf('0x6')]=function(_0xcf636e,_0x9ed5ef){logger[_0x5fbf('0x6')](_0xcf636e,_0x9ed5ef?util[_0x5fbf('0x5')](_0x9ed5ef,{'showHidden':![],'depth':null}):'');};exports[_0x5fbf('0x7')]=function(_0xf8e65f,_0x26548a){return client[_0x5fbf('0x7')](_0xf8e65f,{'body':_0x26548a})[_0x5fbf('0x8')](function(_0x4be8af){logger['debug'](_0x5fbf('0x9'),_0xf8e65f,_0x4be8af?util['inspect'](_0x4be8af,{'showHidden':![],'depth':null}):'');})[_0x5fbf('0xa')](function(_0x29ede8){logger['error'](_0x5fbf('0x9'),_0xf8e65f,_0x29ede8?util[_0x5fbf('0x5')](_0x29ede8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3196a8){return client['request'](_0x5fbf('0xb'),{'options':{'raw':!![],'attributes':['id','internal',_0x5fbf('0xc'),_0x5fbf('0xd')],'where':_0x3196a8,'limit':0x1}})[_0x5fbf('0x8')](function(_0x57d1b2){logger[_0x5fbf('0xe')](_0x5fbf('0xf'),JSON['stringify'](_0x3196a8),_0x57d1b2?util[_0x5fbf('0x5')](_0x57d1b2,{'showHidden':![],'depth':null}):'');return _0x57d1b2['result']['length']?_0x57d1b2['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x5e48f9){return new BPromise(function(_0xee27b7,_0x2521d5){if(_0x5e48f9){return getUser({'internal':_0x5e48f9})[_0x5fbf('0x8')](function(_0xc5a071){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x5e48f9,_0xc5a071?'found':'notfound');return _0xee27b7(_0xc5a071);})['catch'](function(_0x2627e4){logger['error'](_0x5fbf('0x10'),_0x2627e4?util['inspect'](_0x2627e4,{'showHidden':![],'depth':null}):'');return _0xee27b7(null);});}return _0xee27b7(null);});};exports[_0x5fbf('0x11')]=function(_0x45c88a){return new BPromise(function(_0x1111be,_0x13e516){if(_0x45c88a){return getUser({'interface':_0x45c88a})['then'](function(_0x11c69d){logger[_0x5fbf('0x4')](_0x5fbf('0x12'),_0x45c88a,_0x11c69d?_0x5fbf('0x13'):_0x5fbf('0x14'));return _0x1111be(_0x11c69d);})[_0x5fbf('0xa')](function(_0x1e2d80){logger[_0x5fbf('0x6')](_0x5fbf('0x15'),_0x1e2d80?util[_0x5fbf('0x5')](_0x1e2d80,{'showHidden':![],'depth':null}):'');return _0x1111be(null);});}return _0x1111be(null);});};exports[_0x5fbf('0x16')]=function(_0x4fb20f){return new BPromise(function(_0x2c0c7b,_0x4b6e59){if(_0x4fb20f){return getUser({'name':_0x4fb20f})[_0x5fbf('0x8')](function(_0x28d244){logger['info'](_0x5fbf('0x17'),_0x4fb20f,_0x28d244?_0x5fbf('0x13'):_0x5fbf('0x14'));return _0x2c0c7b(_0x28d244);})[_0x5fbf('0xa')](function(_0x55f3e9){logger['error'](_0x5fbf('0x18'),_0x55f3e9?util[_0x5fbf('0x5')](_0x55f3e9,{'showHidden':![],'depth':null}):'');return _0x2c0c7b(null);});}return _0x2c0c7b(null);});};exports['getVoiceQueueByName']=function(_0x43a57d){return new BPromise(function(_0x42e76d,_0x3a111f){if(_0x43a57d){return client[_0x5fbf('0x7')](_0x5fbf('0x19'),{'options':{'raw':!![],'attributes':['id',_0x5fbf('0xc'),_0x5fbf('0x1a'),_0x5fbf('0x1b'),'acwTimeout'],'where':{'name':_0x43a57d},'limit':0x1}})[_0x5fbf('0x8')](function(_0xd7d20f){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x43a57d,_0xd7d20f?util[_0x5fbf('0x5')](_0xd7d20f,{'showHidden':![],'depth':null}):'');logger[_0x5fbf('0x4')](_0x5fbf('0x1c'),_0x43a57d,_0xd7d20f?_0x5fbf('0x13'):_0x5fbf('0x14'));return _0x42e76d(_0xd7d20f[_0x5fbf('0x1d')][_0x5fbf('0x1e')]?_0xd7d20f['result'][0x0]:null);})['catch'](function(_0x10c182){logger[_0x5fbf('0x6')]('[utils][getVoiceQueueByName]',_0x10c182?util['inspect'](_0x10c182,{'showHidden':![],'depth':null}):'');return _0x42e76d(null);});}return _0x42e76d(null);});};exports['addTime']=function(_0x5daa4e,_0x4396d6){return moment(_0x5daa4e)[_0x5fbf('0x1f')](_0x4396d6,_0x5fbf('0x20'))[_0x5fbf('0x21')](_0x5fbf('0x22'));};exports[_0x5fbf('0x23')]=function(_0x4b7fdb,_0x150f46){return moment(_0x4b7fdb)[_0x5fbf('0x24')](_0x150f46,_0x5fbf('0x20'))[_0x5fbf('0x21')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5fbf('0x25')]=function(_0x265217,_0x2f91d7){return moment(_0x265217)[_0x5fbf('0x26')](moment(_0x2f91d7),_0x5fbf('0x20'));};exports[_0x5fbf('0x27')]=function(_0x49ed1e,_0x384379){return parseInt(_0x49ed1e,0xa)+parseInt(_0x384379,0xa);};exports[_0x5fbf('0x28')]=function(){return moment()[_0x5fbf('0x21')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5fbf('0x29')]=function(_0x53ec0a,_0x3268f4){if(_0x3268f4){return moment(_0x53ec0a)['isAfter'](_0x3268f4);}return!![];};exports[_0x5fbf('0x2a')]=function(_0x2ba083,_0x52f897){if(_0x52f897){return moment(_0x2ba083)[_0x5fbf('0x2a')](_0x52f897);}else if(_0x2ba083){return!![];}return![];}; \ No newline at end of file +var _0x4e50=['bluebird','jayson/promise','client','../../config/logger','xdr','info','debug','error','request','then','catch','inspect','GetUser','internal','name','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','length','add','format','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4e50,0xdc));var _0x04e5=function(_0x4d6e55,_0x59afcc){_0x4d6e55=_0x4d6e55-0x0;var _0x2184c6=_0x4e50[_0x4d6e55];return _0x2184c6;};'use strict';var BPromise=require(_0x04e5('0x0'));var jayson=require(_0x04e5('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0x04e5('0x2')]['http']({'port':0x2329});var logger=require(_0x04e5('0x3'))(_0x04e5('0x4'));exports[_0x04e5('0x5')]=function(_0x48b2bd,_0x10a33d){logger[_0x04e5('0x5')](_0x48b2bd,_0x10a33d?util['inspect'](_0x10a33d,{'showHidden':![],'depth':null}):'');};exports[_0x04e5('0x6')]=function(_0x6385fa,_0x16b17a){logger[_0x04e5('0x6')](_0x6385fa,_0x16b17a?util['inspect'](_0x16b17a,{'showHidden':![],'depth':null}):'');};exports[_0x04e5('0x7')]=function(_0x2bf5ce,_0x1cc214){logger[_0x04e5('0x7')](_0x2bf5ce,_0x1cc214?util['inspect'](_0x1cc214,{'showHidden':![],'depth':null}):'');};exports[_0x04e5('0x8')]=function(_0x58a02,_0x224e8c){return client['request'](_0x58a02,{'body':_0x224e8c})[_0x04e5('0x9')](function(_0x5758af){logger[_0x04e5('0x6')]('[utils][request]\x20name:%s',_0x58a02,_0x5758af?util['inspect'](_0x5758af,{'showHidden':![],'depth':null}):'');})[_0x04e5('0xa')](function(_0x33faf5){logger[_0x04e5('0x7')]('[utils][request]\x20name:%s',_0x58a02,_0x33faf5?util[_0x04e5('0xb')](_0x33faf5,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5226de){return client[_0x04e5('0x8')](_0x04e5('0xc'),{'options':{'raw':!![],'attributes':['id',_0x04e5('0xd'),_0x04e5('0xe'),'interface'],'where':_0x5226de,'limit':0x1}})[_0x04e5('0x9')](function(_0x57d809){logger[_0x04e5('0x6')]('[utils][getUser]\x20where:%s',JSON[_0x04e5('0xf')](_0x5226de),_0x57d809?util[_0x04e5('0xb')](_0x57d809,{'showHidden':![],'depth':null}):'');return _0x57d809[_0x04e5('0x10')]['length']?_0x57d809[_0x04e5('0x10')][0x0]:null;});}exports[_0x04e5('0x11')]=function(_0x4e5381){return new BPromise(function(_0x4b6de1,_0x5844f6){if(_0x4e5381){return getUser({'internal':_0x4e5381})[_0x04e5('0x9')](function(_0x2c6c88){logger['info'](_0x04e5('0x12'),_0x4e5381,_0x2c6c88?_0x04e5('0x13'):'notfound');return _0x4b6de1(_0x2c6c88);})[_0x04e5('0xa')](function(_0x363056){logger['error'](_0x04e5('0x14'),_0x363056?util[_0x04e5('0xb')](_0x363056,{'showHidden':![],'depth':null}):'');return _0x4b6de1(null);});}return _0x4b6de1(null);});};exports[_0x04e5('0x15')]=function(_0x42d660){return new BPromise(function(_0x360930,_0x34b64f){if(_0x42d660){return getUser({'interface':_0x42d660})[_0x04e5('0x9')](function(_0x2ab317){logger[_0x04e5('0x5')](_0x04e5('0x16'),_0x42d660,_0x2ab317?_0x04e5('0x13'):_0x04e5('0x17'));return _0x360930(_0x2ab317);})[_0x04e5('0xa')](function(_0x3f7e43){logger[_0x04e5('0x7')](_0x04e5('0x18'),_0x3f7e43?util['inspect'](_0x3f7e43,{'showHidden':![],'depth':null}):'');return _0x360930(null);});}return _0x360930(null);});};exports[_0x04e5('0x19')]=function(_0x4484f6){return new BPromise(function(_0x480843,_0x98ffc1){if(_0x4484f6){return getUser({'name':_0x4484f6})[_0x04e5('0x9')](function(_0x33c805){logger[_0x04e5('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x4484f6,_0x33c805?_0x04e5('0x13'):_0x04e5('0x17'));return _0x480843(_0x33c805);})[_0x04e5('0xa')](function(_0x8eb10f){logger[_0x04e5('0x7')](_0x04e5('0x1a'),_0x8eb10f?util[_0x04e5('0xb')](_0x8eb10f,{'showHidden':![],'depth':null}):'');return _0x480843(null);});}return _0x480843(null);});};exports[_0x04e5('0x1b')]=function(_0x190ac6){return new BPromise(function(_0x465cbf,_0x113f7e){if(_0x190ac6){return client[_0x04e5('0x8')](_0x04e5('0x1c'),{'options':{'raw':!![],'attributes':['id','name',_0x04e5('0x1d'),_0x04e5('0x1e'),'acwTimeout'],'where':{'name':_0x190ac6},'limit':0x1}})[_0x04e5('0x9')](function(_0x542f51){logger[_0x04e5('0x6')](_0x04e5('0x1f'),_0x190ac6,_0x542f51?util[_0x04e5('0xb')](_0x542f51,{'showHidden':![],'depth':null}):'');logger[_0x04e5('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x190ac6,_0x542f51?_0x04e5('0x13'):_0x04e5('0x17'));return _0x465cbf(_0x542f51[_0x04e5('0x10')][_0x04e5('0x20')]?_0x542f51[_0x04e5('0x10')][0x0]:null);})['catch'](function(_0x1a9c21){logger[_0x04e5('0x7')]('[utils][getVoiceQueueByName]',_0x1a9c21?util['inspect'](_0x1a9c21,{'showHidden':![],'depth':null}):'');return _0x465cbf(null);});}return _0x465cbf(null);});};exports['addTime']=function(_0xdeba76,_0xf7b1cb){return moment(_0xdeba76)[_0x04e5('0x21')](_0xf7b1cb,'seconds')[_0x04e5('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x04e5('0x23')]=function(_0x3be8c1,_0x100180){return moment(_0x3be8c1)[_0x04e5('0x24')](_0x100180,_0x04e5('0x25'))[_0x04e5('0x22')](_0x04e5('0x26'));};exports['diffTime']=function(_0x395c16,_0x4a5663){return moment(_0x395c16)[_0x04e5('0x27')](moment(_0x4a5663),_0x04e5('0x25'));};exports[_0x04e5('0x28')]=function(_0x26fa47,_0x50df25){return parseInt(_0x26fa47,0xa)+parseInt(_0x50df25,0xa);};exports[_0x04e5('0x29')]=function(){return moment()[_0x04e5('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x04e5('0x2a')]=function(_0x2a96cc,_0x430591){if(_0x430591){return moment(_0x2a96cc)[_0x04e5('0x2a')](_0x430591);}return!![];};exports[_0x04e5('0x2b')]=function(_0x3b0abc,_0x5cdd5c){if(_0x5cdd5c){return moment(_0x3b0abc)[_0x04e5('0x2b')](_0x5cdd5c);}else if(_0x3b0abc){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 cc279ec..9ef0ef9 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 _0xc274=['api','set','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','url','device','agent_name','test','setupLoggers','lodash','express-winston','path','util','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','role','name','ensureDir','catch','log','user','then','no-user','data','error'];(function(_0x20bac4,_0x4b7189){var _0x5ceb3d=function(_0x300cf1){while(--_0x300cf1){_0x20bac4['push'](_0x20bac4['shift']());}};_0x5ceb3d(++_0x4b7189);}(_0xc274,0x11e));var _0x4c27=function(_0x143708,_0x55b81a){_0x143708=_0x143708-0x0;var _0x4b2da2=_0xc274[_0x143708];return _0x4b2da2;};var fs=require('fs-extra');var _=require(_0x4c27('0x0'));var ewinston=require(_0x4c27('0x1'));var path=require(_0x4c27('0x2'));var util=require(_0x4c27('0x3'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0x4c27('0x4'))[_0x4c27('0x5')];var maskSensitiveData=require(_0x4c27('0x6'))[_0x4c27('0x7')];function ClientSideLogger(){function _0x1f264e(_0x247725){var _0x150763=path[_0x4c27('0x8')](_0x4c27('0x9'),'log',_0x4c27('0xa'));var _0x3ff9cc=path[_0x4c27('0x8')](_0x4c27('0xb'),_0x247725[_0x4c27('0xc')]+'-'+_0x247725[_0x4c27('0xd')]);return fs[_0x4c27('0xe')](path['join'](_0x150763,_0x3ff9cc))['then'](function(){var _0x196202=fileLogger(_0x4c27('0xb'),path[_0x4c27('0x8')](_0x150763,_0x3ff9cc));return _0x196202;})[_0x4c27('0xf')](function(_0x427227){throw _0x427227;});}this[_0x4c27('0x10')]=function(_0x68f321,_0x107835,_0x2a0a25,_0x46f8cc){return _0x1f264e(_0x68f321[_0x4c27('0x11')])[_0x4c27('0x12')](function(_0x10f06b){var _0x11d7a0=_0x10f06b[_0x107835];return _0x11d7a0;})[_0x4c27('0x12')](function(_0x5e15a2){var _0x56c0fb=_0x68f321[_0x4c27('0x11')]?_0x68f321[_0x4c27('0x11')]['id']:_0x4c27('0x13');var _0x13134c=_0x46f8cc[_0x4c27('0x14')];var _0x2ae06e=_0x46f8cc['timestamp'];var _0x5a1f23=new Date(Number(_0x2ae06e));return _0x5e15a2(_0x56c0fb,_0x5a1f23,_0x2a0a25,_0x13134c);})[_0x4c27('0xf')](function(_0x917610){fileLogger(_0x4c27('0xb'))[_0x4c27('0x15')](_0x917610);});};}function setupLoggers(_0x578d96){return new Promise(function(_0x315e11){var _0x4809b0=new ClientSideLogger();var _0x1cb5ce=fileLogger(_0x4c27('0x16'));var _0x4de712=fileLogger('auth');_0x578d96[_0x4c27('0x17')]('client-side-logger',_0x4809b0);_0x578d96['use'](ewinston[_0x4c27('0x18')]({'winstonInstance':_0x1cb5ce,'meta':![],'statusLevels':!![],'msg':function(_0x23bb32,_0x1979d8){var _0x3db600=_0x4c27('0x19');if(!_[_0x4c27('0x1a')](_0x23bb32[_0x4c27('0x1b')])){_0x3db600+='\x20body=%s';var _0x4048bb=_0x23bb32[_0x4c27('0x1b')];maskSensitiveData(_0x4048bb);}return safeTemplate(util[_0x4c27('0x1c')](_0x3db600,_0x23bb32[_0x4c27('0x1d')],_0x23bb32['headers']['x-forwarded-for']?_0x23bb32['headers'][_0x4c27('0x1e')]:_0x23bb32[_0x4c27('0x1f')][_0x4c27('0x20')]||_0x23bb32['ip'],_0x23bb32['url'],_0x1979d8[_0x4c27('0x21')],_0x1979d8[_0x4c27('0x22')],_0x23bb32[_0x4c27('0x11')]?_0x23bb32[_0x4c27('0x11')]['id']:null,_0x23bb32[_0x4c27('0x11')]?_0x23bb32['user'][_0x4c27('0xd')]:null,_0x23bb32[_0x4c27('0x11')]?_0x23bb32[_0x4c27('0x11')][_0x4c27('0xc')]:null,_0x4048bb?util[_0x4c27('0x23')](_0x4048bb,![],null):''));}}));_0x578d96['use'](ewinston['logger']({'winstonInstance':_0x4de712,'meta':![],'statusLevels':!![],'msg':function(_0x4cb729,_0x3df2b4){var _0x574729='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4cb729[_0x4c27('0x1b')]&&_0x4cb729[_0x4c27('0x1b')]['device']&&_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x24')]){_0x574729=_0x4c27('0x25');}return util[_0x4c27('0x1c')](_0x574729,_0x4cb729[_0x4c27('0x1d')],_0x4cb729[_0x4c27('0x26')][_0x4c27('0x1e')]?_0x4cb729[_0x4c27('0x26')]['x-forwarded-for']:_0x4cb729[_0x4c27('0x1f')][_0x4c27('0x20')]||_0x4cb729['ip'],_0x4cb729[_0x4c27('0x27')],_0x3df2b4[_0x4c27('0x21')],_0x3df2b4[_0x4c27('0x22')],_0x4cb729[_0x4c27('0x11')]?_0x4cb729['user']['id']:null,_0x4cb729[_0x4c27('0x11')]?_0x4cb729[_0x4c27('0x11')][_0x4c27('0xd')]:null,_0x4cb729[_0x4c27('0x11')]?_0x4cb729['user'][_0x4c27('0xc')]:null,_0x4cb729[_0x4c27('0x1b')]&&_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x28')]?_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x28')]:'other',_0x4cb729['body']&&_0x4cb729[_0x4c27('0x1b')]['agent_id']?_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x24')]:'',_0x4cb729[_0x4c27('0x1b')]&&_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x29')]?_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x29')]:'');},'ignoreRoute':function(_0x5339c0){var _0x3dbf3c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3dbf3c[_0x4c27('0x2a')](_0x5339c0[_0x4c27('0x27')]);}}));return _0x315e11();});}exports[_0x4c27('0x2b')]=setupLoggers; \ No newline at end of file +var _0x6fbe=['isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','url','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)','method','statusCode','responseTime','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','client','role','name','ensureDir','then','catch','user','no-user','data','error','api','set','use'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0x6fbe,0x1a8));var _0xe6fb=function(_0x370656,_0x1ea708){_0x370656=_0x370656-0x0;var _0x49075e=_0x6fbe[_0x370656];return _0x49075e;};var fs=require(_0xe6fb('0x0'));var _=require(_0xe6fb('0x1'));var ewinston=require(_0xe6fb('0x2'));var path=require(_0xe6fb('0x3'));var util=require(_0xe6fb('0x4'));var fileLogger=require(_0xe6fb('0x5'))[_0xe6fb('0x6')];var safeTemplate=require(_0xe6fb('0x7'))[_0xe6fb('0x8')];var maskSensitiveData=require(_0xe6fb('0x9'))[_0xe6fb('0xa')];function ClientSideLogger(){function _0x3b98c2(_0xb88ffc){var _0x122edd=path[_0xe6fb('0xb')](_0xe6fb('0xc'),'log','xcally');var _0x515998=path[_0xe6fb('0xb')](_0xe6fb('0xd'),_0xb88ffc[_0xe6fb('0xe')]+'-'+_0xb88ffc[_0xe6fb('0xf')]);return fs[_0xe6fb('0x10')](path['join'](_0x122edd,_0x515998))[_0xe6fb('0x11')](function(){var _0x39eb92=fileLogger(_0xe6fb('0xd'),path[_0xe6fb('0xb')](_0x122edd,_0x515998));return _0x39eb92;})[_0xe6fb('0x12')](function(_0x4d419b){throw _0x4d419b;});}this['log']=function(_0x62a414,_0x157a28,_0x1cceae,_0x18b3f2){return _0x3b98c2(_0x62a414['user'])[_0xe6fb('0x11')](function(_0xc61f88){var _0x23fc88=_0xc61f88[_0x157a28];return _0x23fc88;})['then'](function(_0x1e1c41){var _0x982fe8=_0x62a414[_0xe6fb('0x13')]?_0x62a414[_0xe6fb('0x13')]['id']:_0xe6fb('0x14');var _0x1a2244=_0x18b3f2[_0xe6fb('0x15')];var _0x5eff0f=_0x18b3f2['timestamp'];var _0x161732=new Date(Number(_0x5eff0f));return _0x1e1c41(_0x982fe8,_0x161732,_0x1cceae,_0x1a2244);})[_0xe6fb('0x12')](function(_0x59a7a8){fileLogger('client')[_0xe6fb('0x16')](_0x59a7a8);});};}function setupLoggers(_0x48fbaf){return new Promise(function(_0x8bec29){var _0x434ccb=new ClientSideLogger();var _0x363e72=fileLogger(_0xe6fb('0x17'));var _0x29734c=fileLogger('auth');_0x48fbaf[_0xe6fb('0x18')]('client-side-logger',_0x434ccb);_0x48fbaf[_0xe6fb('0x19')](ewinston['logger']({'winstonInstance':_0x363e72,'meta':![],'statusLevels':!![],'msg':function(_0x57001d,_0xc6c3f5){var _0x561590='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xe6fb('0x1a')](_0x57001d[_0xe6fb('0x1b')])){_0x561590+='\x20body=%s';var _0x4b3ed0=_0x57001d['body'];maskSensitiveData(_0x4b3ed0);}return safeTemplate(util[_0xe6fb('0x1c')](_0x561590,_0x57001d['method'],_0x57001d[_0xe6fb('0x1d')][_0xe6fb('0x1e')]?_0x57001d[_0xe6fb('0x1d')][_0xe6fb('0x1e')]:_0x57001d[_0xe6fb('0x1f')][_0xe6fb('0x20')]||_0x57001d['ip'],_0x57001d[_0xe6fb('0x21')],_0xc6c3f5['statusCode'],_0xc6c3f5['responseTime'],_0x57001d[_0xe6fb('0x13')]?_0x57001d['user']['id']:null,_0x57001d[_0xe6fb('0x13')]?_0x57001d['user']['name']:null,_0x57001d[_0xe6fb('0x13')]?_0x57001d['user'][_0xe6fb('0xe')]:null,_0x4b3ed0?util['inspect'](_0x4b3ed0,![],null):''));}}));_0x48fbaf['use'](ewinston[_0xe6fb('0x22')]({'winstonInstance':_0x29734c,'meta':![],'statusLevels':!![],'msg':function(_0x2effb6,_0x2464bb){var _0x34baf5=_0xe6fb('0x23');if(_0x2effb6[_0xe6fb('0x1b')]&&_0x2effb6[_0xe6fb('0x1b')][_0xe6fb('0x24')]&&_0x2effb6['body'][_0xe6fb('0x25')]){_0x34baf5=_0xe6fb('0x26');}return util[_0xe6fb('0x1c')](_0x34baf5,_0x2effb6[_0xe6fb('0x27')],_0x2effb6[_0xe6fb('0x1d')][_0xe6fb('0x1e')]?_0x2effb6[_0xe6fb('0x1d')][_0xe6fb('0x1e')]:_0x2effb6['connection'][_0xe6fb('0x20')]||_0x2effb6['ip'],_0x2effb6['url'],_0x2464bb[_0xe6fb('0x28')],_0x2464bb[_0xe6fb('0x29')],_0x2effb6[_0xe6fb('0x13')]?_0x2effb6['user']['id']:null,_0x2effb6[_0xe6fb('0x13')]?_0x2effb6['user'][_0xe6fb('0xf')]:null,_0x2effb6[_0xe6fb('0x13')]?_0x2effb6[_0xe6fb('0x13')][_0xe6fb('0xe')]:null,_0x2effb6[_0xe6fb('0x1b')]&&_0x2effb6[_0xe6fb('0x1b')][_0xe6fb('0x24')]?_0x2effb6[_0xe6fb('0x1b')]['device']:_0xe6fb('0x2a'),_0x2effb6[_0xe6fb('0x1b')]&&_0x2effb6[_0xe6fb('0x1b')][_0xe6fb('0x25')]?_0x2effb6[_0xe6fb('0x1b')]['agent_id']:'',_0x2effb6['body']&&_0x2effb6[_0xe6fb('0x1b')][_0xe6fb('0x2b')]?_0x2effb6[_0xe6fb('0x1b')][_0xe6fb('0x2b')]:'');},'ignoreRoute':function(_0x5a4070){var _0x12e604=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x12e604['test'](_0x5a4070[_0xe6fb('0x21')]);}}));return _0x8bec29();});}exports[_0xe6fb('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index e905611..1885449 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x304c=['length','iftime','lodash','moment-timezone','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','test','isMoment','padStart'];(function(_0x485a2e,_0x5254e3){var _0x33545d=function(_0x2cc980){while(--_0x2cc980){_0x485a2e['push'](_0x485a2e['shift']());}};_0x33545d(++_0x5254e3);}(_0x304c,0x7d));var _0xc304=function(_0x2f13a3,_0x1659ce){_0x2f13a3=_0x2f13a3-0x0;var _0x4275e2=_0x304c[_0x2f13a3];return _0x4275e2;};var _=require(_0xc304('0x0'));var moment=require(_0xc304('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x58a015){return _0x58a015[_0xc304('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc304('0x3');var EINVALID_DATE=_0xc304('0x4');function throwIfDateNotValid(_0x3351f3){if(!_0x3351f3[_0xc304('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x36cc66){var _0xc3324=_0x36cc66[_0xc304('0x6')](':')[_0xc304('0x7')](function(_0x58df6b){return parseInt(_0x58df6b,0xa);});var _0x1e3424=_0xc3324[0x0];var _0x228ab6=_0xc3324[0x1];if(_0x1e3424<0x0||_0x1e3424>0x17||_0x228ab6<0x0||_0x228ab6>0x3b){throw new Error(EINVALID_DATE);}return[_0x1e3424,_0x228ab6];}function circularDoWInterval(_0x2b7dac,_0x45b1ce){if(_0x2b7dac===_0x45b1ce){return[_0x2b7dac];}else{var _0x5211a2=moment[_0xc304('0x8')]();moment[_0xc304('0x8')]('en');var _0x18df28=moment['weekdaysShort']()[_0xc304('0x7')](function(_0x46dbde){return _0x46dbde[_0xc304('0x9')]();});moment['locale'](_0x5211a2);var _0x254a7a=_0x18df28[_0xc304('0xa')](_0x2b7dac);var _0x1310d7=_0x18df28['indexOf'](_0x45b1ce);if(_0x1310d7>_0x254a7a){return _0x18df28[_0xc304('0xb')](_0x254a7a,_0x1310d7+0x1);}else{var _0x47b4a6=_0x18df28['slice'](0x0,_0x1310d7+0x1);var _0x3396b2=_0x18df28[_0xc304('0xb')](_0x254a7a);return _0x3396b2[_0xc304('0xc')](_0x47b4a6);}}}module[_0xc304('0xd')][_0xc304('0xe')]=circularDoWInterval;function circularMonthInterval(_0x3159ab,_0x188f39){if(_0x3159ab===_0x188f39){return[_0x3159ab];}else{var _0x45b263=moment[_0xc304('0x8')]();moment[_0xc304('0x8')]('en');var _0x7934d0=moment[_0xc304('0xf')]()[_0xc304('0x7')](function(_0x6e245d){return _0x6e245d[_0xc304('0x9')]();});moment['locale'](_0x45b263);var _0x911a0d=_0x7934d0[_0xc304('0xa')](_0x3159ab);var _0x2d3abe=_0x7934d0[_0xc304('0xa')](_0x188f39);if(_0x2d3abe>_0x911a0d){return _0x7934d0[_0xc304('0xb')](_0x911a0d,_0x2d3abe+0x1);}else{var _0x29135a=_0x7934d0[_0xc304('0xb')](0x0,_0x2d3abe+0x1);var _0x37348a=_0x7934d0['slice'](_0x911a0d);return _0x37348a[_0xc304('0xc')](_0x29135a);}}}module[_0xc304('0xd')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x3d5ded){var _0x777fde=parseInt(_0x3d5ded,0xa);if(_0x777fde<0x1||_0x777fde>0x1f){throw new Error(EINVALID_DATE);}return _0x777fde;}function timeCompare(_0x33c9f7,_0x3c5998,_0x294b52){var _0x40e27f=_0x33c9f7[_0xc304('0x10')]();var _0x409ca7=extractTime(_0x3c5998);var _0x5c1f11=_0x409ca7[0x0];var _0x4b50d3=_0x409ca7[0x1];var _0x4cc9fb=_0x33c9f7[_0xc304('0x10')]()[_0xc304('0x11')](_0x5c1f11)[_0xc304('0x12')](_0x4b50d3);throwIfDateNotValid(_0x4cc9fb);var _0x3e6df3=extractTime(_0x294b52);var _0x13c2db=_0x3e6df3[0x0];var _0x4fc282=_0x3e6df3[0x1];var _0x15d748=_0x33c9f7[_0xc304('0x10')]()[_0xc304('0x11')](_0x13c2db)['minutes'](_0x4fc282);throwIfDateNotValid(_0x15d748);if(_0x15d748[_0xc304('0x13')](_0x4cc9fb)){var _0x43af5c=_0x40e27f[_0xc304('0x10')]()[_0xc304('0x14')](_0xc304('0x15'));var _0x42d682=_0x40e27f['clone']()[_0xc304('0x16')]('day');return _0x40e27f[_0xc304('0x17')](_0x4cc9fb,_0x42d682,undefined,'[]')||_0x40e27f['isBetween'](_0x43af5c,_0x15d748,undefined,'[]');}else{return _0x40e27f[_0xc304('0x17')](_0x4cc9fb,_0x15d748,undefined,'[]');}}module[_0xc304('0xd')][_0xc304('0x18')]=timeCompare;function dowCompare(_0x345e7c,_0x31e9fc,_0x526085){var _0x3828fc=_0x345e7c[_0xc304('0x8')]('en')[_0xc304('0x19')](_0xc304('0x1a'))[_0xc304('0x9')]();return circularDoWInterval(_0x31e9fc,_0x526085)[_0xc304('0x1b')](_0x3828fc);}module['exports'][_0xc304('0x1c')]=dowCompare;function domCompare(_0x4d9756,_0x56d53a,_0x5884d2){var _0x2ebabb=_0x4d9756[_0xc304('0x1d')]();if(_0x56d53a===_0x5884d2){return _0x2ebabb===_0x56d53a;}else{var _0x1238d8=_0x4d9756[_0xc304('0x1e')]();var _0x2af93e=_0x56d53a<_0x5884d2;let _0x170550=![];var _0x399318=0x0;var _0x5c027f=0x0;if(_0x2af93e){_0x399318=Math[_0xc304('0x1f')](0x1,_0x56d53a);_0x5c027f=Math[_0xc304('0x20')](_0x5884d2,_0x1238d8);_0x170550=_0x2ebabb>=_0x399318&&_0x2ebabb<=_0x5c027f;}else{_0x399318=Math[_0xc304('0x20')](_0x56d53a,_0x1238d8);_0x5c027f=Math['max'](0x1,_0x5884d2);_0x170550=_0x2ebabb>=_0x399318||_0x2ebabb<=_0x5c027f;}return _0x170550;}}module[_0xc304('0xd')][_0xc304('0x21')]=domCompare;function monthCompare(_0x22b1cc,_0xb3084c,_0x418ddf){var _0x4c7c0e=_0x22b1cc[_0xc304('0x8')]('en')[_0xc304('0x19')](_0xc304('0x22'))['toLowerCase']();return circularMonthInterval(_0xb3084c,_0x418ddf)['includes'](_0x4c7c0e);}module[_0xc304('0xd')][_0xc304('0x23')]=monthCompare;function iftime(_0x387c68,_0x1cd2f5=moment['tz']['guess'](),_0x119a17=moment()){if(!validateRx[_0xc304('0x24')](_0x387c68)){throw new Error(EINVALID_STRING);}else{var _0x3f4c8e=(moment[_0xc304('0x25')](_0x119a17)?_0x119a17[_0xc304('0x10')]():moment(_0x119a17))['tz'](_0x1cd2f5)[_0xc304('0x8')]('en');throwIfDateNotValid(_0x3f4c8e);var _0x4644ca=_0x387c68[_0xc304('0x6')](',');var _0x43d82e=_0x4644ca[0x0];var _0x4ebc63=_0x4644ca[0x1];var _0x399fa0=_0x4644ca[0x2];var _0x5d7b9f=_0x4644ca[0x3];let _0xe1f8ee=!![];if(_0x43d82e!=='*'){var _0x1cd0ba=_0x43d82e['split']('-');var _0xafe3fc=_[_0xc304('0x26')](_0x1cd0ba[0x0],0x5,'0');var _0x55bc49=_0x1cd0ba[_0xc304('0x27')]===0x2?_['padStart'](_0x1cd0ba[0x1],0x5,'0'):_0xafe3fc;_0xe1f8ee=timeCompare(_0x3f4c8e,_0xafe3fc,_0x55bc49);}let _0x46c187=!![];if(_0x4ebc63!=='*'){var _0x1fc6a2=_0x4ebc63[_0xc304('0x6')]('-');var _0x1fb3a2=_0x1fc6a2[0x0];var _0x3e7b83=_0x1fc6a2[_0xc304('0x27')]===0x2?_0x1fc6a2[0x1]:_0x1fb3a2;_0x46c187=dowCompare(_0x3f4c8e,_0x1fb3a2,_0x3e7b83);}let _0x172c5f=!![];if(_0x399fa0!=='*'){var _0x5d0d6b=_0x399fa0['split']('-');var _0x31109a=parseDom(_0x5d0d6b[0x0]);var _0xcda1c8=_0x5d0d6b[_0xc304('0x27')]===0x2?parseDom(_0x5d0d6b[0x1]):_0x31109a;_0x172c5f=domCompare(_0x3f4c8e,_0x31109a,_0xcda1c8);}let _0x38e7db=!![];if(_0x5d7b9f!=='*'){var _0x3fbd97=_0x5d7b9f[_0xc304('0x6')]('-');var _0x50b586=_0x3fbd97[0x0];var _0x859c61=_0x3fbd97[_0xc304('0x27')]===0x2?_0x3fbd97[0x1]:_0x3fbd97[0x0];_0x38e7db=monthCompare(_0x3f4c8e,_0x50b586,_0x859c61);}return _0xe1f8ee&&_0x46c187&&_0x172c5f&&_0x38e7db;}}module[_0xc304('0xd')][_0xc304('0x28')]=iftime; \ No newline at end of file +var _0x6416=['startOf','day','endOf','isBetween','format','ddd','dowCompare','date','daysInMonth','max','min','domCompare','includes','guess','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','toLowerCase','slice','concat','circularDoWInterval','indexOf','exports','clone','hours','minutes','isBefore'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x6416,0x1ce));var _0x6641=function(_0x19290b,_0x981169){_0x19290b=_0x19290b-0x0;var _0x4eebac=_0x6416[_0x19290b];return _0x4eebac;};var _=require(_0x6641('0x0'));var moment=require(_0x6641('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x6641('0x2')](function(_0x51852a){return _0x51852a[_0x6641('0x3')];})[_0x6641('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6641('0x5');var EINVALID_DATE=_0x6641('0x6');function throwIfDateNotValid(_0x591953){if(!_0x591953['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5e4a2f){var _0x277501=_0x5e4a2f[_0x6641('0x7')](':')[_0x6641('0x2')](function(_0x2fe27e){return parseInt(_0x2fe27e,0xa);});var _0x52f562=_0x277501[0x0];var _0x5a24ef=_0x277501[0x1];if(_0x52f562<0x0||_0x52f562>0x17||_0x5a24ef<0x0||_0x5a24ef>0x3b){throw new Error(EINVALID_DATE);}return[_0x52f562,_0x5a24ef];}function circularDoWInterval(_0x11201c,_0x253b25){if(_0x11201c===_0x253b25){return[_0x11201c];}else{var _0x59e83a=moment[_0x6641('0x8')]();moment['locale']('en');var _0x151042=moment['weekdaysShort']()[_0x6641('0x2')](function(_0x37583e){return _0x37583e[_0x6641('0x9')]();});moment[_0x6641('0x8')](_0x59e83a);var _0x2805cb=_0x151042['indexOf'](_0x11201c);var _0x535e9d=_0x151042['indexOf'](_0x253b25);if(_0x535e9d>_0x2805cb){return _0x151042[_0x6641('0xa')](_0x2805cb,_0x535e9d+0x1);}else{var _0x59f6c4=_0x151042[_0x6641('0xa')](0x0,_0x535e9d+0x1);var _0x41ec85=_0x151042[_0x6641('0xa')](_0x2805cb);return _0x41ec85[_0x6641('0xb')](_0x59f6c4);}}}module['exports'][_0x6641('0xc')]=circularDoWInterval;function circularMonthInterval(_0x48a13e,_0x523f56){if(_0x48a13e===_0x523f56){return[_0x48a13e];}else{var _0x28de72=moment[_0x6641('0x8')]();moment[_0x6641('0x8')]('en');var _0x1f0956=moment['monthsShort']()[_0x6641('0x2')](function(_0x43002f){return _0x43002f['toLowerCase']();});moment[_0x6641('0x8')](_0x28de72);var _0x25b954=_0x1f0956[_0x6641('0xd')](_0x48a13e);var _0x206668=_0x1f0956[_0x6641('0xd')](_0x523f56);if(_0x206668>_0x25b954){return _0x1f0956['slice'](_0x25b954,_0x206668+0x1);}else{var _0x5bdd84=_0x1f0956[_0x6641('0xa')](0x0,_0x206668+0x1);var _0x16fec8=_0x1f0956['slice'](_0x25b954);return _0x16fec8[_0x6641('0xb')](_0x5bdd84);}}}module[_0x6641('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x515408){var _0x4164e1=parseInt(_0x515408,0xa);if(_0x4164e1<0x1||_0x4164e1>0x1f){throw new Error(EINVALID_DATE);}return _0x4164e1;}function timeCompare(_0x3cfe1a,_0x42ee7e,_0x1ab3d9){var _0x2d4065=_0x3cfe1a['clone']();var _0x264941=extractTime(_0x42ee7e);var _0x1866cb=_0x264941[0x0];var _0xd9ec65=_0x264941[0x1];var _0x9657be=_0x3cfe1a[_0x6641('0xf')]()[_0x6641('0x10')](_0x1866cb)[_0x6641('0x11')](_0xd9ec65);throwIfDateNotValid(_0x9657be);var _0x3842e1=extractTime(_0x1ab3d9);var _0x57beb3=_0x3842e1[0x0];var _0x174bcf=_0x3842e1[0x1];var _0x12a05f=_0x3cfe1a[_0x6641('0xf')]()[_0x6641('0x10')](_0x57beb3)['minutes'](_0x174bcf);throwIfDateNotValid(_0x12a05f);if(_0x12a05f[_0x6641('0x12')](_0x9657be)){var _0x2a713b=_0x2d4065['clone']()[_0x6641('0x13')](_0x6641('0x14'));var _0x30573=_0x2d4065[_0x6641('0xf')]()[_0x6641('0x15')](_0x6641('0x14'));return _0x2d4065[_0x6641('0x16')](_0x9657be,_0x30573,undefined,'[]')||_0x2d4065[_0x6641('0x16')](_0x2a713b,_0x12a05f,undefined,'[]');}else{return _0x2d4065['isBetween'](_0x9657be,_0x12a05f,undefined,'[]');}}module[_0x6641('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x23bfc4,_0x247a3d,_0x5605a1){var _0x531c4e=_0x23bfc4[_0x6641('0x8')]('en')[_0x6641('0x17')](_0x6641('0x18'))[_0x6641('0x9')]();return circularDoWInterval(_0x247a3d,_0x5605a1)['includes'](_0x531c4e);}module[_0x6641('0xe')][_0x6641('0x19')]=dowCompare;function domCompare(_0x543a1c,_0x32143c,_0x27b73d){var _0x559192=_0x543a1c[_0x6641('0x1a')]();if(_0x32143c===_0x27b73d){return _0x559192===_0x32143c;}else{var _0x4aecdd=_0x543a1c[_0x6641('0x1b')]();var _0x1a245a=_0x32143c<_0x27b73d;let _0x232f60=![];var _0x3420fe=0x0;var _0x2513ab=0x0;if(_0x1a245a){_0x3420fe=Math[_0x6641('0x1c')](0x1,_0x32143c);_0x2513ab=Math[_0x6641('0x1d')](_0x27b73d,_0x4aecdd);_0x232f60=_0x559192>=_0x3420fe&&_0x559192<=_0x2513ab;}else{_0x3420fe=Math['min'](_0x32143c,_0x4aecdd);_0x2513ab=Math[_0x6641('0x1c')](0x1,_0x27b73d);_0x232f60=_0x559192>=_0x3420fe||_0x559192<=_0x2513ab;}return _0x232f60;}}module[_0x6641('0xe')][_0x6641('0x1e')]=domCompare;function monthCompare(_0xd46244,_0x219928,_0x3bab67){var _0x4e1ae2=_0xd46244[_0x6641('0x8')]('en')[_0x6641('0x17')]('MMM')[_0x6641('0x9')]();return circularMonthInterval(_0x219928,_0x3bab67)[_0x6641('0x1f')](_0x4e1ae2);}module[_0x6641('0xe')]['monthCompare']=monthCompare;function iftime(_0x35faf2,_0x35e2c0=moment['tz'][_0x6641('0x20')](),_0x5cc0df=moment()){if(!validateRx['test'](_0x35faf2)){throw new Error(EINVALID_STRING);}else{var _0x198d05=(moment[_0x6641('0x21')](_0x5cc0df)?_0x5cc0df[_0x6641('0xf')]():moment(_0x5cc0df))['tz'](_0x35e2c0)[_0x6641('0x8')]('en');throwIfDateNotValid(_0x198d05);var _0x43a94d=_0x35faf2['split'](',');var _0x26ebde=_0x43a94d[0x0];var _0x3988c7=_0x43a94d[0x1];var _0x223271=_0x43a94d[0x2];var _0x24ca20=_0x43a94d[0x3];let _0x238c95=!![];if(_0x26ebde!=='*'){var _0x500b28=_0x26ebde['split']('-');var _0x300988=_[_0x6641('0x22')](_0x500b28[0x0],0x5,'0');var _0xd0795b=_0x500b28[_0x6641('0x23')]===0x2?_[_0x6641('0x22')](_0x500b28[0x1],0x5,'0'):_0x300988;_0x238c95=timeCompare(_0x198d05,_0x300988,_0xd0795b);}let _0x45796c=!![];if(_0x3988c7!=='*'){var _0x1d8531=_0x3988c7[_0x6641('0x7')]('-');var _0x49da2f=_0x1d8531[0x0];var _0x540779=_0x1d8531[_0x6641('0x23')]===0x2?_0x1d8531[0x1]:_0x49da2f;_0x45796c=dowCompare(_0x198d05,_0x49da2f,_0x540779);}let _0x28d2d0=!![];if(_0x223271!=='*'){var _0x5a6791=_0x223271[_0x6641('0x7')]('-');var _0x2ef8cc=parseDom(_0x5a6791[0x0]);var _0xddcc8f=_0x5a6791['length']===0x2?parseDom(_0x5a6791[0x1]):_0x2ef8cc;_0x28d2d0=domCompare(_0x198d05,_0x2ef8cc,_0xddcc8f);}let _0x20ad37=!![];if(_0x24ca20!=='*'){var _0x7725f=_0x24ca20[_0x6641('0x7')]('-');var _0x5a6f79=_0x7725f[0x0];var _0x536558=_0x7725f[_0x6641('0x23')]===0x2?_0x7725f[0x1]:_0x7725f[0x0];_0x20ad37=monthCompare(_0x198d05,_0x5a6f79,_0x536558);}return _0x238c95&&_0x45796c&&_0x28d2d0&&_0x20ad37;}}module[_0x6641('0xe')][_0x6641('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 7bacb36..e7d4c68 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5f5=['fileLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','level','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger'];(function(_0x45ca0c,_0x328d3e){var _0x1ab4a9=function(_0x3250a6){while(--_0x3250a6){_0x45ca0c['push'](_0x45ca0c['shift']());}};_0x1ab4a9(++_0x328d3e);}(_0xe5f5,0x160));var _0x5e5f=function(_0x484e43,_0x2879d5){_0x484e43=_0x484e43-0x0;var _0x5eceec=_0xe5f5[_0x484e43];return _0x5eceec;};'use strict';var path=require('path');var util=require(_0x5e5f('0x0'));var moment=require(_0x5e5f('0x1'));var winston=require(_0x5e5f('0x2'));var config=require(_0x5e5f('0x3'));var debugLevel=config[_0x5e5f('0x4')]?config[_0x5e5f('0x4')][_0x5e5f('0x5')]():_0x5e5f('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':_0x5e5f('0x7'),'error':_0x5e5f('0x8'),'warn':'bold\x20yellow','info':_0x5e5f('0x9'),'print':_0x5e5f('0xa'),'success':'bold\x20green','http':_0x5e5f('0xb'),'verbose':_0x5e5f('0xc'),'debug':_0x5e5f('0xd'),'silly':_0x5e5f('0xe')};winston[_0x5e5f('0xf')](XC_LOG_COLORS);function getLogFileName(_0x1a29d6,_0x276ebb,_0xd1ea0e){var _0x312414=_0x1a29d6||'/var/log/xcally';return path['join'](_0x312414,util['format'](_0x5e5f('0x10'),_0x276ebb,_0xd1ea0e));}function formatter(_0x410d8a,_0x15fa99){_0x15fa99[_0x5e5f('0x11')]=_0x15fa99[_0x5e5f('0x11')][_0x5e5f('0x12')](/@@{/g,_0x5e5f('0x13'))['replace'](/}@@/g,_0x5e5f('0x14'))[_0x5e5f('0x12')](/@{/g,'{{')[_0x5e5f('0x12')](/}@/g,'}}');return util[_0x5e5f('0x15')](_0x5e5f('0x16'),moment()['format'](_0x5e5f('0x17')),_0x15fa99['level'][_0x5e5f('0x18')](),_0x410d8a,_0x15fa99[_0x5e5f('0x11')]);}function fileFormat(_0x5a7d4a,_0xa1dacb){_0xa1dacb[_0x5e5f('0x11')]=_0xa1dacb[_0x5e5f('0x11')]['replace'](/@@{/g,_0x5e5f('0x13'))['replace'](/}@@/g,_0x5e5f('0x14'))['replace'](/@{/g,'{{')[_0x5e5f('0x12')](/}@/g,'}}');var _0x1475a9=_0xa1dacb[_0x5e5f('0x19')]&&Object[_0x5e5f('0x1a')](_0xa1dacb[_0x5e5f('0x19')])[_0x5e5f('0x1b')]?'\x0a\x09'+JSON[_0x5e5f('0x1c')](_0xa1dacb['meta']):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x5e5f('0x15')](_0x5e5f('0x17')),_0xa1dacb[_0x5e5f('0x1d')]['toUpperCase'](),_0x5a7d4a,_0xa1dacb[_0x5e5f('0x11')],_0x1475a9);}function consoleLogger(){var _0x9c95de=new winston[(_0x5e5f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5e5f('0x1f'))][(_0x5e5f('0x20'))]({'level':_0x5e5f('0x21'),'json':![],'formatter':function(_0x174613){return formatter('',_0x174613);}})]});return _0x9c95de;}function fileLogger(_0x38870b,_0x9442c7){var _0x2bff96=new winston[(_0x5e5f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5e5f('0x1f'))][(_0x5e5f('0x22'))]({'name':util[_0x5e5f('0x15')](_0x5e5f('0x23'),_0x38870b,'error'),'filename':getLogFileName(_0x9442c7,_0x38870b,_0x5e5f('0x24')),'level':_0x5e5f('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x42a89a){return fileFormat(_0x38870b,_0x42a89a);}}),new winston[(_0x5e5f('0x1f'))]['File']({'name':util[_0x5e5f('0x15')](_0x5e5f('0x23'),_0x38870b,debugLevel),'filename':getLogFileName(_0x9442c7,_0x38870b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3619ef){return fileFormat(_0x38870b,_0x3619ef);}}),new winston['transports'][(_0x5e5f('0x20'))]({'level':'warn','json':![],'formatter':function(_0x2e5202){return fileFormat(_0x38870b,_0x2e5202);}})]});return _0x2bff96;}exports[_0x5e5f('0x25')]=consoleLogger;exports[_0x5e5f('0x26')]=fileLogger; \ No newline at end of file +var _0x262b=['debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','}}}','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment'];(function(_0x5a56a9,_0x5efb36){var _0x3de56d=function(_0x103b4b){while(--_0x103b4b){_0x5a56a9['push'](_0x5a56a9['shift']());}};_0x3de56d(++_0x5efb36);}(_0x262b,0x177));var _0xb262=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x262b[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0xb262('0x0'));var util=require(_0xb262('0x1'));var moment=require(_0xb262('0x2'));var winston=require(_0xb262('0x3'));var config=require(_0xb262('0x4'));var debugLevel=config[_0xb262('0x5')]?config['debugLevel'][_0xb262('0x6')]():_0xb262('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xb262('0x8'),'error':'red','warn':_0xb262('0x9'),'info':'white','print':_0xb262('0xa'),'success':'bold\x20green','http':_0xb262('0xb'),'verbose':_0xb262('0xc'),'debug':_0xb262('0xd'),'silly':_0xb262('0xe')};winston[_0xb262('0xf')](XC_LOG_COLORS);function getLogFileName(_0x2edb2d,_0x77382b,_0x576fd4){var _0x31188d=_0x2edb2d||_0xb262('0x10');return path[_0xb262('0x11')](_0x31188d,util[_0xb262('0x12')](_0xb262('0x13'),_0x77382b,_0x576fd4));}function formatter(_0xb33500,_0x303b46){_0x303b46[_0xb262('0x14')]=_0x303b46[_0xb262('0x14')][_0xb262('0x15')](/@@{/g,_0xb262('0x16'))['replace'](/}@@/g,'}}}')[_0xb262('0x15')](/@{/g,'{{')[_0xb262('0x15')](/}@/g,'}}');return util[_0xb262('0x12')](_0xb262('0x17'),moment()[_0xb262('0x12')](_0xb262('0x18')),_0x303b46['level']['toUpperCase'](),_0xb33500,_0x303b46[_0xb262('0x14')]);}function fileFormat(_0x4ea408,_0x58472f){_0x58472f[_0xb262('0x14')]=_0x58472f[_0xb262('0x14')][_0xb262('0x15')](/@@{/g,_0xb262('0x16'))[_0xb262('0x15')](/}@@/g,_0xb262('0x19'))[_0xb262('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x5e6bda=_0x58472f[_0xb262('0x1a')]&&Object['keys'](_0x58472f[_0xb262('0x1a')])['length']?'\x0a\x09'+JSON['stringify'](_0x58472f[_0xb262('0x1a')]):'';return util[_0xb262('0x12')](_0xb262('0x1b'),moment()[_0xb262('0x12')](_0xb262('0x18')),_0x58472f[_0xb262('0x1c')]['toUpperCase'](),_0x4ea408,_0x58472f[_0xb262('0x14')],_0x5e6bda);}function consoleLogger(){var _0x5e0b6e=new winston[(_0xb262('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb262('0x1e'))][(_0xb262('0x1f'))]({'level':_0xb262('0x20'),'json':![],'formatter':function(_0x834c82){return formatter('',_0x834c82);}})]});return _0x5e0b6e;}function fileLogger(_0x13862d,_0x1a809c){var _0x391f84=new winston[(_0xb262('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb262('0x1e'))][(_0xb262('0x21'))]({'name':util[_0xb262('0x12')](_0xb262('0x22'),_0x13862d,'error'),'filename':getLogFileName(_0x1a809c,_0x13862d,_0xb262('0x23')),'level':_0xb262('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xf7dc9a){return fileFormat(_0x13862d,_0xf7dc9a);}}),new winston[(_0xb262('0x1e'))][(_0xb262('0x21'))]({'name':util[_0xb262('0x12')](_0xb262('0x22'),_0x13862d,debugLevel),'filename':getLogFileName(_0x1a809c,_0x13862d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x275585){return fileFormat(_0x13862d,_0x275585);}}),new winston[(_0xb262('0x1e'))][(_0xb262('0x1f'))]({'level':_0xb262('0x20'),'json':![],'formatter':function(_0x498210){return fileFormat(_0x13862d,_0x498210);}})]});return _0x391f84;}exports[_0xb262('0x24')]=consoleLogger;exports[_0xb262('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 7bfce0b..bbb5875 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0xae272f,_0x1918e5){var _0x1128c4=function(_0x15d8f0){while(--_0x15d8f0){_0xae272f['push'](_0xae272f['shift']());}};_0x1128c4(++_0x1918e5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x0b0e[_0x3fad5a];return _0x4ca713;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x4975,0x86));var _0x5497=function(_0x2396b2,_0x51baec){_0x2396b2=_0x2396b2-0x0;var _0x20ace3=_0x4975[_0x2396b2];return _0x20ace3;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index dfea062..a91d867 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['\x5c$&','replace'];(function(_0x54c802,_0x7959fd){var _0x168c4e=function(_0x56085d){while(--_0x56085d){_0x54c802['push'](_0x54c802['shift']());}};_0x168c4e(++_0x7959fd);}(_0x1967,0x173));var _0x7196=function(_0x1ac794,_0xc16902){_0x1ac794=_0x1ac794-0x0;var _0x3b3f3c=_0x1967[_0x1ac794];return _0x3b3f3c;};module['exports']={'escapeRegExp'(_0x1da98b,_0xdb72bb=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1da98b[_0x7196('0x0')](_0xdb72bb,_0x7196('0x1'));}}; \ No newline at end of file +var _0x7a54=['exports','\x5c$&'];(function(_0x2a35da,_0x5d5626){var _0x53a855=function(_0x2bc6dc){while(--_0x2bc6dc){_0x2a35da['push'](_0x2a35da['shift']());}};_0x53a855(++_0x5d5626);}(_0x7a54,0x106));var _0x47a5=function(_0x282969,_0x539391){_0x282969=_0x282969-0x0;var _0x520ee0=_0x7a54[_0x282969];return _0x520ee0;};module[_0x47a5('0x0')]={'escapeRegExp'(_0x46f3fa,_0x44b31e=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x46f3fa['replace'](_0x44b31e,_0x47a5('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index c7e435e..f53ddeb 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 _0x1a85=['{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x54e765,_0x1827ae){var _0xea7918=function(_0x11ba7d){while(--_0x11ba7d){_0x54e765['push'](_0x54e765['shift']());}};_0xea7918(++_0x1827ae);}(_0x1a85,0x178));var _0x51a8=function(_0x3bfe11,_0x573678){_0x3bfe11=_0x3bfe11-0x0;var _0x19f6b2=_0x1a85[_0x3bfe11];return _0x19f6b2;};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 +var _0x0b0e=['safeTemplate','lodash','{\x20{\x20','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x9c2cd4,_0x7f8e32){var _0x10b1bd=function(_0x1dd0bb){while(--_0x1dd0bb){_0x9c2cd4['push'](_0x9c2cd4['shift']());}};_0x10b1bd(++_0x7f8e32);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x0b0e[_0x3aaf0a];return _0x33e6bc;};var _=require(_0xe0b0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x503596){return _0x503596==='{{'?_0xe0b0('0x1'):'\x20}\x20}';}function safeTemplate(_0x7e5a8a){var _0xdf715e=_0x7e5a8a;if(typeof _0x7e5a8a===_0xe0b0('0x2')){_0xdf715e=_0x7e5a8a[_0xe0b0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe0b0('0x4')](_0x7e5a8a)){_0xdf715e=_0x7e5a8a[_0xe0b0('0x5')](function(_0x399e67){return safeTemplate(_0x399e67);});}else if(_[_0xe0b0('0x6')](_0x7e5a8a)){_0xdf715e=Object[_0xe0b0('0x7')](_0x7e5a8a)[_0xe0b0('0x8')](function(_0x219b1c,_0x5cf9cc){_0x219b1c[_0x5cf9cc]=safeTemplate(_0x7e5a8a[_0x5cf9cc]);return _0x219b1c;},{});}return _0xdf715e;}module['exports'][_0xe0b0('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 8a66cf9..b74e8b1 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 _0xf304=['Updating\x20app.json','writeJSON','path','root','resolve','legacy-libs','isArray','apps','findIndex','motion2','NODE_PATH','string','env','pathExists','then','readJSON','updated','info'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xf304,0x17c));var _0x4f30=function(_0x4dd15b,_0x1d880a){_0x4dd15b=_0x4dd15b-0x0;var _0x2445f2=_0xf304[_0x4dd15b];return _0x2445f2;};var fs=require('fs-extra');var path=require(_0x4f30('0x0'));var config=require('../config/environment');var root=config[_0x4f30('0x1')];var APP_JSON_PATH=path[_0x4f30('0x2')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x4f30('0x3'));function setLegacyLibsNodeEnvPath(_0x4f8018){let _0x822136=![];if(Array[_0x4f30('0x4')](_0x4f8018[_0x4f30('0x5')])){var _0x3d4681=_0x4f8018[_0x4f30('0x5')][_0x4f30('0x6')](function(_0x43ea36){return _0x43ea36['name']===_0x4f30('0x7');});if(_0x3d4681>-0x1){var _0x5f48a7=_0x4f8018['apps'][_0x3d4681];if(typeof _0x5f48a7['env'][_0x4f30('0x8')]!==_0x4f30('0x9')){_0x5f48a7[_0x4f30('0xa')][_0x4f30('0x8')]=NODEPATH;_0x822136=!![];}}return{'appConfig':_0x4f8018,'updated':_0x822136};}}function updateAppConfig(_0x4edd1e){return fs[_0x4f30('0xb')](APP_JSON_PATH)[_0x4f30('0xc')](function(_0x1c49a5){if(_0x1c49a5){return fs[_0x4f30('0xd')](APP_JSON_PATH)[_0x4f30('0xc')](function(_0xb5101e){var _0x26364a=setLegacyLibsNodeEnvPath(_0xb5101e);if(_0x26364a[_0x4f30('0xe')]){_0x4edd1e[_0x4f30('0xf')](_0x4f30('0x10'));return fs[_0x4f30('0x11')](APP_JSON_PATH,_0xb5101e,{'spaces':0x2});}else{return Promise[_0x4f30('0x2')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0xc061=['server/app.json','resolve','legacy-libs','isArray','apps','findIndex','name','NODE_PATH','env','then','info','Updating\x20app.json','exports','fs-extra','path','../config/environment','root'];(function(_0x5abbca,_0x2b9fe1){var _0x55252c=function(_0x14e27b){while(--_0x14e27b){_0x5abbca['push'](_0x5abbca['shift']());}};_0x55252c(++_0x2b9fe1);}(_0xc061,0x183));var _0x1c06=function(_0x5160b6,_0x261d95){_0x5160b6=_0x5160b6-0x0;var _0x200f73=_0xc061[_0x5160b6];return _0x200f73;};var fs=require(_0x1c06('0x0'));var path=require(_0x1c06('0x1'));var config=require(_0x1c06('0x2'));var root=config[_0x1c06('0x3')];var APP_JSON_PATH=path['resolve'](root,_0x1c06('0x4'));var NODEPATH=path[_0x1c06('0x5')](root,_0x1c06('0x6'));function setLegacyLibsNodeEnvPath(_0x1ea658){let _0x34c556=![];if(Array[_0x1c06('0x7')](_0x1ea658[_0x1c06('0x8')])){var _0x4fa461=_0x1ea658[_0x1c06('0x8')][_0x1c06('0x9')](function(_0x10135a){return _0x10135a[_0x1c06('0xa')]==='motion2';});if(_0x4fa461>-0x1){var _0x11b370=_0x1ea658[_0x1c06('0x8')][_0x4fa461];if(typeof _0x11b370['env'][_0x1c06('0xb')]!=='string'){_0x11b370[_0x1c06('0xc')][_0x1c06('0xb')]=NODEPATH;_0x34c556=!![];}}return{'appConfig':_0x1ea658,'updated':_0x34c556};}}function updateAppConfig(_0x3b5457){return fs['pathExists'](APP_JSON_PATH)[_0x1c06('0xd')](function(_0x45b992){if(_0x45b992){return fs['readJSON'](APP_JSON_PATH)[_0x1c06('0xd')](function(_0x12a619){var _0x3f5910=setLegacyLibsNodeEnvPath(_0x12a619);if(_0x3f5910['updated']){_0x3b5457[_0x1c06('0xe')](_0x1c06('0xf'));return fs['writeJSON'](APP_JSON_PATH,_0x12a619,{'spaces':0x2});}else{return Promise[_0x1c06('0x5')]();}});}else{return Promise[_0x1c06('0x5')]();}});}module[_0x1c06('0x10')]=updateAppConfig; \ No newline at end of file